From e298a309926b502b2a455b63af6f2fef27b549d7 Mon Sep 17 00:00:00 2001 From: Justin Marshall Date: Sat, 4 Jul 2020 22:10:04 -0700 Subject: [PATCH] Shroud now renders with a circle alpha image, shrouded terrain no longer renders and is no longer simply covered with a black rectangle. Creating skirmish maps in multiplayer no longer causes a crash. --- code/redalert/cell.cpp | 1 + code/redalert/display.cpp | 51 +++++++++++++++++++------------------- code/redalert/display.h | 2 +- code/redalert/radar.cpp | 6 ++--- ui/shroud.png | Bin 0 -> 3039 bytes 5 files changed, 31 insertions(+), 29 deletions(-) create mode 100644 ui/shroud.png diff --git a/code/redalert/cell.cpp b/code/redalert/cell.cpp index 786ea96..23048b6 100644 --- a/code/redalert/cell.cpp +++ b/code/redalert/cell.cpp @@ -1421,6 +1421,7 @@ void CellClass::Draw_It(int x, int y, bool objects) if (HasRenderedObject(object)) { continue; } + renderedFrameObjects.push_back(object); int xx,yy; if (object->IsToDisplay && (!object->Is_Techno() || ((TechnoClass *)object)->Visual_Character() == VISUAL_NORMAL) && Map.Coord_To_Pixel(object->Render_Coord(), xx, yy)) { diff --git a/code/redalert/display.cpp b/code/redalert/display.cpp index 4cc5dcf..ee907cd 100644 --- a/code/redalert/display.cpp +++ b/code/redalert/display.cpp @@ -116,7 +116,7 @@ unsigned char DisplayClass::UnitShadow[(USHADOW_COL_COUNT+1)*256]; unsigned char DisplayClass::UnitShadowAir[(USHADOW_COL_COUNT+1)*256]; unsigned char DisplayClass::SpecialGhost[2*256]; -void const * DisplayClass::ShadowShapes; +Image_t *DisplayClass::ShadowShapes; unsigned char DisplayClass::ShadowTrans[(SHADOW_COL_COUNT+1)*256]; /* @@ -236,18 +236,9 @@ void DisplayClass::One_Time(void) TransIconsetHD[0] = Image_LoadImage("ui/trans/trans0.png"); TransIconsetHD[1] = Image_LoadImage("ui/trans/trans1.png"); TransIconsetHD[2] = Image_LoadImage("ui/trans/trans2.png"); -// jmarshall end - #ifndef NDEBUG - RawFileClass file("SHADOW.SHP"); - if (file.Is_Available()) { - ShadowShapes = Load_Alloc_Data(file); - } else { - ShadowShapes = MFCD::Retrieve("SHADOW.SHP"); - } - #else - ShadowShapes = MFCD::Retrieve("SHADOW.SHP"); - #endif + ShadowShapes = Image_LoadImage("ui/shroud.png"); +// jmarshall end Set_View_Dimensions(0, 0); } @@ -2275,7 +2266,12 @@ ObjectClass * DisplayClass::Cell_Object(CELL cell, int x, int y) const // continue; // } assert(ptr->IsActive); - ptr->Render(forced); +// jmarshall - added a Is_Mapped check here so we don't see the trees through shrouded terrain. + CellClass* cellptr = &(*this)[ptr->Coord]; + if (cellptr->Is_Mapped(PlayerPtr) || Debug_Unshroud) { + ptr->Render(forced); + } +// jmarshall end } } BEnd(BENCH_OBJECTS); @@ -2356,6 +2352,9 @@ void DisplayClass::Redraw_Icons(void) CELL cell = Coord_Cell(coord); coord = Coord_Whole(Cell_Coord(cell)); + if (Cell_Shadow(cell, PlayerPtr) >= 0 && !Debug_Unshroud) + continue; + /* ** Only cells flagged to be redraw are examined. */ @@ -2399,6 +2398,9 @@ void DisplayClass::Redraw_OIcons(void) CELL cell = Coord_Cell(coord); coord = Coord_Whole(Cell_Coord(cell)); + if (Cell_Shadow(cell, PlayerPtr) >= 0 && !Debug_Unshroud) + continue; + /* ** Only cells flagged to be redraw are examined. */ @@ -2465,20 +2467,19 @@ void DisplayClass::Redraw_Shadow(void) if (cellptr->Is_Visible(PlayerPtr)) continue; // Use PlayerPtr since we won't be rendering in MP. ST - 8/6/2019 10:44AM int shadow = -2; //if (cellptr->IsMapped) { - if (cellptr->Is_Mapped(PlayerPtr)) { // Use PlayerPtr since we won't be rendering in MP. ST - 8/6/2019 10:44AM - shadow = Cell_Shadow(cell, PlayerPtr); // Use PlayerPtr since we won't be rendering in MP. ST - 8/6/2019 10:44AM + if (cellptr->Is_Mapped(PlayerPtr)) { + shadow = Cell_Shadow(cell, PlayerPtr); } - if (shadow >= 0) { - CC_Draw_Shape(ShadowShapes, shadow, xpixel, ypixel, WINDOW_TACTICAL, SHAPE_GHOST, NULL, ShadowTrans); - } else { - if (shadow != -1) { - int ww = CELL_PIXEL_W; - int hh = CELL_PIXEL_H; - if (Clip_Rect(&xpixel, &ypixel, &ww, &hh, Lepton_To_Pixel(TacLeptonWidth), Lepton_To_Pixel(TacLeptonHeight)) >= 0) { - LogicPage->Fill_Rect(TacPixelX+xpixel, TacPixelY+ypixel, TacPixelX+xpixel+ww-1, TacPixelY+ypixel+hh-1, BLACK); - } - } + int ww = CELL_PIXEL_W; + int hh = CELL_PIXEL_H; + + //if (Clip_Rect(&xpixel, &ypixel, &ww, &hh, Lepton_To_Pixel(TacLeptonWidth), Lepton_To_Pixel(TacLeptonHeight)) >= 0) { + // LogicPage->Fill_Rect(TacPixelX + xpixel, TacPixelY + ypixel, TacPixelX + xpixel + ww - 1, TacPixelY + ypixel + hh - 1, BLACK); + //} + + if (shadow >= 0) { + CC_DrawHD_Shape(ShadowShapes, 0, xpixel, ypixel, WINDOW_TACTICAL, SHAPE_GHOST, NULL, ShadowTrans); } } } diff --git a/code/redalert/display.h b/code/redalert/display.h index 2217eb6..e1cf10f 100644 --- a/code/redalert/display.h +++ b/code/redalert/display.h @@ -311,7 +311,7 @@ public: //ST - 1/21/2019 11:59AM int BandX,BandY; int NewX,NewY; - static void const *ShadowShapes; + static Image_t *ShadowShapes; static unsigned char ShadowTrans[(SHADOW_COL_COUNT+1)*256]; void Redraw_Icons(void); diff --git a/code/redalert/radar.cpp b/code/redalert/radar.cpp index 96b0d0e..1f40905 100644 --- a/code/redalert/radar.cpp +++ b/code/redalert/radar.cpp @@ -393,7 +393,7 @@ void RadarClass::Draw_It(bool forced) // strcpy(name, "NATORADR.SHP" ); // if (Session.Type == GAME_NORMAL) { - strcpy(name, _hiresradarnames[PlayerPtr->ActLike]); + strcpy(name, _hiresradarnames[PlayerPtr->ActLike % HOUSE_BAD]); // } #ifndef NDEBUG RawFileClass file(name); @@ -409,12 +409,12 @@ void RadarClass::Draw_It(bool forced) } else { RadarPulse = MFCD::Retrieve(name); } - strcpy(name, _frames[PlayerPtr->ActLike]); + strcpy(name, _frames[PlayerPtr->ActLike % HOUSE_BAD]); RawFileClass file3(name); if (file3.Is_Available()) { RadarFrame = Load_Alloc_Data(file3); } else { - RadarFrame = MFCD::Retrieve(_frames[PlayerPtr->ActLike]); + RadarFrame = MFCD::Retrieve(_frames[PlayerPtr->ActLike % HOUSE_BAD]); } #else RadarAnim = MFCD::Retrieve(name); diff --git a/ui/shroud.png b/ui/shroud.png new file mode 100644 index 0000000000000000000000000000000000000000..d23656ab9b86443abef418d0c9b5d22c218a5b9c GIT binary patch literal 3039 zcmcImX;c$g77kHaL|jlrMI{6jx1=g7BpTL$p*83MWDy6fR8>fXq(TxPfXJdPxL^aK zJp>vTaA>whP~3Zn9v4s%v~3sMGD_nv5o`ohoC@3YnbYm~XL3%Z-mCiVcfY&5durQi z|K(QWXN@Ni2v&XqegJ+4jhDG8{vSf@%fxRM3PG5PK(L%@yi5q%q8S9jxJGGEs5(@* zk_%%pDuiGnl&X;_a5RCi%w3~^;Am7$5}{F2Igi|Vx`9lRB0O>kO9%=T-l#+>NK&GK zN&Z1_QZ&p#$nI{WWg0F{AVbvd)jSfkn!qp^i zOo@`%RFDFLAf4pGq0-n)1{+*LqJwl00O=x8(1lB86mHKvkae-X#%>(OWw zTyG@`sWD{`hQ*8&YV`;UiH?(#7KBLU2$rB)XjC+8fbt z8WZ1gL2w8v#QOk&)X>*~F+?g({2HiG$n}$})Q}uT{rEgGE{ZCZB3up~g+YkJriff& zl)@A>&&S|6WBQEtLv4#-FwQZWAugNgDn>Z43vLdf z6gI+SQCwjTOhF+QEMmbRf{IupY^#(~{Nz9}e`GbPLU2ZeEk;FRCP+bO9F)QlF+~&( z0?{d;n8T#GFhvj(KTsqD=87?;48r?FDubd>Kp~GJlm4T|8;ik|LJYxk&MHTdoi z<7fnq&p6|9bhzT1(eaGRacU(#d=Exo0(_?b?8o;ElBEBtm4(>3O#ars##W)BZ7p?> zD%(DP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