Skip to content

Commit

Permalink
[RA] Remaster rules consistency clean up.
Browse files Browse the repository at this point in the history
Cleans up some inconsistencies with TD over how some MP options are
implemented for remaster.
  • Loading branch information
OmniBlade committed Oct 13, 2022
1 parent 9067861 commit fa3778c
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion redalert/building.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

/***********************************************************************************************
Expand Down
4 changes: 1 addition & 3 deletions redalert/cell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2183,8 +2183,6 @@ int CellClass::Tiberium_Adjust(bool pregame)
return (0);
}

extern bool MPSuperWeaponDisable;

/***********************************************************************************************
* CellClass::Goodie_Check -- Performs crate discovery logic. *
* *
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions redalert/dllinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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(&not_allow_super_weapons, sizeof(not_allow_super_weapons));

/*
Expand Down Expand Up @@ -8675,7 +8675,7 @@ bool DLLExportClass::Load(Straw& file)
if (file.Get(&not_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];

Expand Down
3 changes: 1 addition & 2 deletions redalert/house.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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. *
Expand Down Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions redalert/infantry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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. *
* *
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions redalert/rules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions redalert/rules.h
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,11 @@ class RulesClass
RB_SELECTED = 0,
RB_ALWAYS,
} ResourceBarDisplayMode;

/*
** Are superweapons allowed?
*/
bool AllowSuperWeapons;
};

#endif

0 comments on commit fa3778c

Please sign in to comment.