From fa3778ca8df140df5c3578f156cc12ed3742fc99 Mon Sep 17 00:00:00 2001 From: OmniBlade Date: Sun, 2 May 2021 23:42:17 +0100 Subject: [PATCH] [RA] Remaster rules consistency clean up. Cleans up some inconsistencies with TD over how some MP options are implemented for remaster. --- redalert/building.cpp | 2 +- redalert/cell.cpp | 4 +--- redalert/dllinterface.cpp | 6 +++--- redalert/house.cpp | 3 +-- redalert/infantry.cpp | 4 +--- redalert/rules.cpp | 1 + redalert/rules.h | 5 +++++ 7 files changed, 13 insertions(+), 12 deletions(-) diff --git a/redalert/building.cpp b/redalert/building.cpp index c78958f3..b2a1afe5 100644 --- a/redalert/building.cpp +++ b/redalert/building.cpp @@ -5282,7 +5282,7 @@ bool BuildingClass::Can_Player_Move(void) const assert(Buildings.ID(this) == ID); assert(IsActive); - return (*this == STRUCT_CONST && (Mission == MISSION_GUARD) && Special.IsMCVDeploy); + return (*this == STRUCT_CONST && (Mission == MISSION_GUARD) && Is_MCV_Deploy()); } /*********************************************************************************************** diff --git a/redalert/cell.cpp b/redalert/cell.cpp index 2ccb3305..9e577e62 100644 --- a/redalert/cell.cpp +++ b/redalert/cell.cpp @@ -2183,8 +2183,6 @@ int CellClass::Tiberium_Adjust(bool pregame) return (0); } -extern bool MPSuperWeaponDisable; - /*********************************************************************************************** * CellClass::Goodie_Check -- Performs crate discovery logic. * * * @@ -2319,7 +2317,7 @@ bool CellClass::Goodie_Check(FootClass* object) case CRATE_SONAR: if (Session.Type != GAME_NORMAL) { #ifdef REMASTER_BUILD - if (MPSuperWeaponDisable) { + if (!Rule.AllowSuperWeapons) { powerup = CRATE_MONEY; } #endif diff --git a/redalert/dllinterface.cpp b/redalert/dllinterface.cpp index 1ec7194d..e58d6f9c 100644 --- a/redalert/dllinterface.cpp +++ b/redalert/dllinterface.cpp @@ -874,7 +874,7 @@ extern "C" __declspec(dllexport) bool __cdecl CNC_Set_Multiplayer_Data(int scena Special.IsMCVDeploy = game_options.IsMCVDeploy; Special.UseMCVDeploy = true; - MPSuperWeaponDisable = !game_options.EnableSuperweapons; // Are superweapons available + Rule.AllowSuperWeapons = game_options.EnableSuperweapons; // Are superweapons available // Session.Options.AIPlayers = WWGetPrivateProfileInt("Options", "AI", 0, buffer); //Number of AI players @@ -8573,7 +8573,7 @@ bool DLLExportClass::Save(Pipe& pipe) /* ** Special case for MPSuperWeaponDisable - store negated value so it defaults to enabled */ - bool not_allow_super_weapons = !MPSuperWeaponDisable; + bool not_allow_super_weapons = !Rule.AllowSuperWeapons; pipe.Put(¬_allow_super_weapons, sizeof(not_allow_super_weapons)); /* @@ -8675,7 +8675,7 @@ bool DLLExportClass::Load(Straw& file) if (file.Get(¬_allow_super_weapons, sizeof(not_allow_super_weapons)) != sizeof(not_allow_super_weapons)) { return false; } - MPSuperWeaponDisable = !not_allow_super_weapons; + Rule.AllowSuperWeapons = !not_allow_super_weapons; unsigned char padding[4095]; diff --git a/redalert/house.cpp b/redalert/house.cpp index f1fd2c85..5c1266d0 100644 --- a/redalert/house.cpp +++ b/redalert/house.cpp @@ -951,7 +951,6 @@ void HouseClass::Init(void) // Object selection list is switched with player context for GlyphX. ST - 8/7/2019 10:11AM extern void Logic_Switch_Player_Context(HouseClass* house); -extern bool MPSuperWeaponDisable; /*********************************************************************************************** * HouseClass::AI -- Process house logic. * @@ -1223,7 +1222,7 @@ void HouseClass::AI(void) ** Process any super weapon logic required. */ #ifdef REMASTER_BUILD - if (Session.Type != GAME_GLYPHX_MULTIPLAYER || !MPSuperWeaponDisable) { + if (Session.Type != GAME_GLYPHX_MULTIPLAYER || Rule.AllowSuperWeapons) { Super_Weapon_Handler(); } #else diff --git a/redalert/infantry.cpp b/redalert/infantry.cpp index f18e2d95..a3fe1a82 100644 --- a/redalert/infantry.cpp +++ b/redalert/infantry.cpp @@ -588,8 +588,6 @@ void InfantryClass::Draw_It(int x, int y, WindowNumberType window) const FootClass::Draw_It(x, y, window); } -extern bool MPSuperWeaponDisable; - /*********************************************************************************************** * InfantryClass::Per_Cell_Process -- Handles special operations that occur once per cell. * * * @@ -704,7 +702,7 @@ void InfantryClass::Per_Cell_Process(PCPType why) tech->House->RadarSpied |= housespy; } #ifdef REMASTER_BUILD - if (Session.Type == GAME_NORMAL || !MPSuperWeaponDisable) { + if (Session.Type == GAME_NORMAL || Rule.AllowSuperWeapons) { #else if (Session.Type == GAME_NORMAL) { #endif diff --git a/redalert/rules.cpp b/redalert/rules.cpp index 544c0aca..25f5701f 100644 --- a/redalert/rules.cpp +++ b/redalert/rules.cpp @@ -267,6 +267,7 @@ RulesClass::RulesClass(void) , TiberiumLongScan(0x2000) , HealthBarDisplayMode(HB_SELECTED) , ResourceBarDisplayMode(RB_SELECTED) + , AllowSuperWeapons(true) { #ifdef FIXIT_CSII // checked - ajw 9/28/98 NewUnitsEnabled = SecretUnitsEnabled = false; diff --git a/redalert/rules.h b/redalert/rules.h index 7deef1ee..af2377c2 100644 --- a/redalert/rules.h +++ b/redalert/rules.h @@ -886,6 +886,11 @@ class RulesClass RB_SELECTED = 0, RB_ALWAYS, } ResourceBarDisplayMode; + + /* + ** Are superweapons allowed? + */ + bool AllowSuperWeapons; }; #endif \ No newline at end of file