August 6th Patch Update

Accumulated DLL source code changes since June 22nd patch
This commit is contained in:
PG-SteveT 2020-08-06 09:44:54 -07:00
parent 93a1af2eff
commit ae72fce5dd
76 changed files with 1071 additions and 210 deletions

View file

@ -384,6 +384,8 @@ bool MPSuperWeaponDisable = false;
bool ShareAllyVisibility = true;
bool UseGlyphXStartLocations = true;
SpecialClass* SpecialBackup = NULL;
int GetRandSeed()
{
@ -800,6 +802,8 @@ extern "C" __declspec(dllexport) bool __cdecl CNC_Set_Multiplayer_Data(int scena
Special.IsEarlyWin = game_options.DestroyStructures;
Special.ModernBalance = game_options.ModernBalance;
/*
** Enable Counterstrike/Aftermath units
*/
@ -844,6 +848,13 @@ extern "C" __declspec(dllexport) bool __cdecl CNC_Set_Multiplayer_Data(int scena
*/
Rule.IsSmartDefense = true;
/*
** Backup special
*/
if (SpecialBackup != NULL) {
memcpy(SpecialBackup, &Special, sizeof(SpecialClass));
}
return true;
}
@ -1662,7 +1673,7 @@ extern "C" __declspec(dllexport) bool __cdecl CNC_Advance_Instance(uint64 player
if (Frame <= 10) { // Don't spam forever, but useful to know that we actually started advancing
GlyphX_Debug_Print("CNC_Advance_Instance - RA");
}
/*
** Shouldn't really need to do this, but I like the idea of always running the main loop in the context of the same player.
** Might make tbe bugs more repeatable and consistent. ST - 3/15/2019 11:58AM
@ -1673,6 +1684,13 @@ extern "C" __declspec(dllexport) bool __cdecl CNC_Advance_Instance(uint64 player
DLLExportClass::Set_Player_Context(DLLExportClass::GlyphxPlayerIDs[0]);
}
/*
** Restore special from backup
*/
if (SpecialBackup != NULL) {
memcpy(&Special, SpecialBackup, sizeof(SpecialClass));
}
#ifdef FIXIT_CSII // checked - ajw 9/28/98
TimeQuake = PendingTimeQuake;
PendingTimeQuake = false;
@ -1865,6 +1883,15 @@ extern "C" __declspec(dllexport) bool __cdecl CNC_Advance_Instance(uint64 player
//Sync_Delay();
//DLLExportClass::Set_Event_Callback(NULL);
Color_Cycle();
/*
** Don't respect GameActive. Game will end in multiplayer on win/loss
*/
if (GAME_TO_PLAY == GAME_GLYPHX_MULTIPLAYER) {
return true;
}
return(GameActive);
}
@ -1910,6 +1937,12 @@ extern "C" __declspec(dllexport) bool __cdecl CNC_Save_Load(bool save, const cha
}
result = Load_Game(file_path_and_name);
// MBL 07.21.2020
if (result == false)
{
return false;
}
DLLExportClass::Set_Player_Context(DLLExportClass::GlyphxPlayerIDs[0], true);
Set_Logic_Page(SeenBuff);
@ -2130,6 +2163,11 @@ void DLLExportClass::Init(void)
CurrentLocalPlayerIndex = 0;
MessagesSent.clear();
if (SpecialBackup == NULL) {
SpecialBackup = new SpecialClass;
}
memcpy(SpecialBackup, &Special, sizeof(SpecialClass));
}
@ -2146,6 +2184,9 @@ void DLLExportClass::Init(void)
**************************************************************************************************/
void DLLExportClass::Shutdown(void)
{
delete SpecialBackup;
SpecialBackup = NULL;
for (int i=0 ; i<ModSearchPaths.Count() ; i++) {
delete [] ModSearchPaths[i];
}
@ -3252,6 +3293,7 @@ void DLL_Draw_Pip_Intercept(const ObjectClass* object, int pip)
void DLLExportClass::DLL_Draw_Intercept(int shape_number, int x, int y, int width, int height, int flags, const ObjectClass *object, DirType rotation, long scale, const char *shape_file_name, char override_owner)
{
CNCObjectStruct& new_object = ObjectList->Objects[TotalObjectCount + CurrentDrawCount];
memset(&new_object, 0, sizeof(new_object));
Convert_Type(object, new_object);
if (new_object.Type == UNKNOWN) {
return;
@ -4394,6 +4436,8 @@ bool DLLExportClass::Get_Sidebar_State(uint64 player_id, unsigned char *buffer_i
return false;
}
memset(&sidebar_entry, 0, sizeof(sidebar_entry));
sidebar_entry.AssetName[0] = 0;
sidebar_entry.Type = UNKNOWN;
sidebar_entry.BuildableID = Map.Column[c].Buildables[b].BuildableID;
@ -4406,7 +4450,7 @@ bool DLLExportClass::Get_Sidebar_State(uint64 player_id, unsigned char *buffer_i
sidebar_entry.SuperWeaponType = SW_NONE;
if (tech) {
sidebar_entry.Cost = tech->Cost * PlayerPtr->CostBias;
sidebar_entry.Cost = tech->Cost * PlayerPtr->CostBias; // MBL: If this gets modified, also modify below for skirmish and multiplayer
sidebar_entry.PowerProvided = 0;
sidebar_entry.BuildTime = tech->Time_To_Build(PlayerPtr->Class->House); // sidebar_entry.BuildTime = tech->Time_To_Build() / 60;
strncpy(sidebar_entry.AssetName, tech->IniName, CNC_OBJECT_ASSET_NAME_LENGTH);
@ -4549,6 +4593,8 @@ bool DLLExportClass::Get_Sidebar_State(uint64 player_id, unsigned char *buffer_i
return false;
}
memset(&sidebar_entry, 0, sizeof(sidebar_entry));
sidebar_entry.AssetName[0] = 0;
sidebar_entry.Type = UNKNOWN;
sidebar_entry.BuildableID = context_sidebar->Column[c].Buildables[b].BuildableID;
@ -4561,7 +4607,13 @@ bool DLLExportClass::Get_Sidebar_State(uint64 player_id, unsigned char *buffer_i
sidebar_entry.SuperWeaponType = SW_NONE;
if (tech) {
sidebar_entry.Cost = tech->Cost;
// MBL 06.22.2020 - Updated to apply and difficulty abd/or faction price modifier; See https://jaas.ea.com/browse/TDRA-6864
// If this gets modified, also modify above for non-skirmish / non-multiplayer
//
// sidebar_entry.Cost = tech->Cost;
sidebar_entry.Cost = tech->Cost * PlayerPtr->CostBias;
sidebar_entry.PowerProvided = 0;
sidebar_entry.BuildTime = tech->Time_To_Build(PlayerPtr->Class->House); // sidebar_entry.BuildTime = tech->Time_To_Build() / 60;
strncpy(sidebar_entry.AssetName, tech->IniName, CNC_OBJECT_ASSET_NAME_LENGTH);
@ -8480,10 +8532,16 @@ bool DLLExportClass::Save(Pipe & pipe)
pipe.Put(&Special, sizeof(Special));
/*
** Special case for MPSuperWeaponDisable - store negated value so it defaults to enabled
*/
bool not_allow_super_weapons = !MPSuperWeaponDisable;
pipe.Put(&not_allow_super_weapons, sizeof(not_allow_super_weapons));
/*
** Room for save game expansion
*/
unsigned char padding[4096];
unsigned char padding[4095];
memset(padding, 0, sizeof(padding));
pipe.Put(padding, sizeof(padding));
@ -8566,7 +8624,23 @@ bool DLLExportClass::Load(Straw & file)
return false;
}
unsigned char padding[4096];
/*
** Restore backup
*/
if (SpecialBackup != NULL) {
memcpy(SpecialBackup, &Special, sizeof(SpecialClass));
}
/*
** Special case for MPSuperWeaponDisable - store negated value so it defaults to enabled
*/
bool not_allow_super_weapons = false;
if (file.Get(&not_allow_super_weapons, sizeof(not_allow_super_weapons)) != sizeof(not_allow_super_weapons)) {
return false;
}
MPSuperWeaponDisable = !not_allow_super_weapons;
unsigned char padding[4095];
if (file.Get(padding, sizeof(padding)) != sizeof(padding)) {
return false;