From ed73a48ee9e81b6b007d54843cedc989461ee2ed Mon Sep 17 00:00:00 2001 From: Justin Marshall Date: Thu, 4 Jun 2020 10:00:15 -0700 Subject: [PATCH] Hack fix for radar crash! Fix other UI elements. --- REDALERT/DISPLAY.CPP | 18 +++++++++--------- REDALERT/MENUS.CPP | 2 +- REDALERT/SIDEBAR.CPP | 2 +- REDALERT/UNIT.CPP | 13 ++++++++----- REDALERT/UNIT.H | 2 +- REDALERT/WIN32LIB/DrawMisc.cpp | 6 +++--- 6 files changed, 23 insertions(+), 20 deletions(-) diff --git a/REDALERT/DISPLAY.CPP b/REDALERT/DISPLAY.CPP index eeece61..43dadcc 100644 --- a/REDALERT/DISPLAY.CPP +++ b/REDALERT/DISPLAY.CPP @@ -571,14 +571,14 @@ void DisplayClass::Set_View_Dimensions(int x, int y, int width, int height) // ST - 3/1/2019 12:05PM // Made the below code more consistent with the width calculation. This is needed if we aren't going to draw the tabs at the top of the screen // - //if (height == -1) { - // TacLeptonHeight = Pixel_To_Lepton(SeenBuff.Get_Height() - y); - // //height = (SeenBuff.Get_Height()-y) / CELL_PIXEL_H; - //} - //else { - // TacLeptonHeight = height * CELL_LEPTON_H; - //} - TacLeptonHeight = height * CELL_LEPTON_H; + if (height == -1) { + TacLeptonHeight = Pixel_To_Lepton(SeenBuff.Get_Height() - y); + //height = (SeenBuff.Get_Height()-y) / CELL_PIXEL_H; + } + else { + TacLeptonHeight = height * CELL_LEPTON_H; + } + //TacLeptonHeight = height * CELL_LEPTON_H; /* ** Adjust the tactical cell if it is now in an invalid position @@ -3300,7 +3300,7 @@ int DisplayClass::TacticalClass::Action(unsigned flags, KeyNumType & key) } } - return true; //(GadgetClass::Action(0, key)); + return (GadgetClass::Action(0, key)); } diff --git a/REDALERT/MENUS.CPP b/REDALERT/MENUS.CPP index 43e9975..ad5be42 100644 --- a/REDALERT/MENUS.CPP +++ b/REDALERT/MENUS.CPP @@ -413,7 +413,7 @@ int Do_Menu(char const ** strings, bool ) ** specified menu. */ WindowList[WINDOW_MENU][WINDOWWIDTH] = (MenuList[0][ITEMWIDTH] + 2) * 8; - WindowList[WINDOW_MENU][WINDOWX] = (19 - (length >> 4)) * 8; + WindowList[WINDOW_MENU][WINDOWX] = ScreenWidth - ((19 - (length >> 4)) * 8); WindowList[WINDOW_MENU][WINDOWY] = 174 - (unsigned)(MenuList[0][ITEMSHIGH] * (FontHeight+FontYSpacing)); WindowList[WINDOW_MENU][WINDOWHEIGHT] = MenuList[0][ITEMSHIGH] * FontHeight + 5 /*11*/; diff --git a/REDALERT/SIDEBAR.CPP b/REDALERT/SIDEBAR.CPP index edd540a..37e8435 100644 --- a/REDALERT/SIDEBAR.CPP +++ b/REDALERT/SIDEBAR.CPP @@ -1042,7 +1042,7 @@ bool SidebarClass::Activate(int control) ** activate it on the left side of the screen. */ if (IsSidebarActive /*&& X*/) { - Set_View_Dimensions(0, 8 * RESFACTOR, ((320-SIDE_WIDTH)/ICON_PIXEL_W) * RESFACTOR); + Set_View_Dimensions(0, 8 * RESFACTOR, (((ScreenWidth/2)-SIDE_WIDTH)/ICON_PIXEL_W) * RESFACTOR); IsToRedraw = true; Help_Text(TXT_NONE); Repair.Zap(); diff --git a/REDALERT/UNIT.CPP b/REDALERT/UNIT.CPP index bdcdb65..8b63fef 100644 --- a/REDALERT/UNIT.CPP +++ b/REDALERT/UNIT.CPP @@ -1482,7 +1482,7 @@ bool UnitClass::Goto_Clear_Spot(void) * HISTORY: * * 06/18/1994 JLB : Created. * *=============================================================================================*/ -bool UnitClass::Try_To_Deploy(void) +bool UnitClass::Try_To_Deploy(bool isScriptUnpack) // jmarshall - added isScriptUnpack { assert(Units.ID(this) == ID); assert(IsActive); @@ -1498,7 +1498,10 @@ bool UnitClass::Try_To_Deploy(void) CELL cell = Coord_Cell(Adjacent_Cell(Center_Coord(), FACING_NW)); if (!BuildingTypeClass::As_Reference(STRUCT_CONST).Legal_Placement(cell)) { if (PlayerPtr == House) { - Speak(VOX_DEPLOY); + // jmarshall: Don't play failure to deploy if the map script is trying to deploy the unit. + if (!isScriptUnpack) { + Speak(VOX_DEPLOY); + } } if (!House->IsHuman) { BuildingTypeClass::As_Reference(STRUCT_CONST).Flush_For_Placement(cell, House); @@ -1629,7 +1632,7 @@ void UnitClass::Per_Cell_Process(PCPType why) ** preparing to deploy. In this case, it should begin its deploy process. */ if (IsDeploying) { - Try_To_Deploy(); + Try_To_Deploy(false); if (!IsActive) return; // Unit no longer exists -- bail. } } @@ -2574,7 +2577,7 @@ int UnitClass::Mission_Unload(void) case 1: if (!IsDriving) { - Try_To_Deploy(); + Try_To_Deploy(true); if (IsActive) { if (IsDeploying) { Status = 2; @@ -2984,7 +2987,7 @@ int UnitClass::Mission_Hunt(void) */ case FIND_SPOT: if (Goto_Clear_Spot()) { - if (Try_To_Deploy()) { + if (Try_To_Deploy(false)) { Status = WAITING; } } diff --git a/REDALERT/UNIT.H b/REDALERT/UNIT.H index 778d6a8..b9b1cb5 100644 --- a/REDALERT/UNIT.H +++ b/REDALERT/UNIT.H @@ -134,7 +134,7 @@ class UnitClass : public DriveClass static void Init(void); bool Goto_Clear_Spot(void); - bool Try_To_Deploy(void); + bool Try_To_Deploy(bool isScriptUnpack); virtual void Scatter(COORDINATE threat, bool forced=false, bool nokidding=false); bool Tiberium_Check(CELL ¢er, int x, int y); diff --git a/REDALERT/WIN32LIB/DrawMisc.cpp b/REDALERT/WIN32LIB/DrawMisc.cpp index f26bad2..a51ffd6 100644 --- a/REDALERT/WIN32LIB/DrawMisc.cpp +++ b/REDALERT/WIN32LIB/DrawMisc.cpp @@ -2252,7 +2252,7 @@ rept_loop: shr ebx , 5 imul ecx , - 13 mov [ counter_x ] , ebx - lea ecx , [ remapref_point + ecx ] + lea ecx , [ remapref_point ] mov [ entry ] , ecx remapoutter_loop: @@ -2495,7 +2495,7 @@ rept_loop: imul ecx , -13 shr ebx , 5 mov [ counter_x ] , ebx - lea ecx , [ trans_ref_point + ecx ] + lea ecx , [ trans_ref_point ] mov [ entry ] , ecx trans_outter_loop: @@ -2558,7 +2558,7 @@ rept_loop2: shr ebx , 5 imul ecx , - 17 mov [ counter_x ] , ebx - lea ecx , [ trans_remapref_point + ecx ] + lea ecx , [ trans_remapref_point ] mov [ entry ] , ecx trans_remapoutter_loop: