# Conflicts, ignored these upstream changes:
#	REDALERT/MiscAsm.cpp
#	REDALERT/WIN32LIB/DrawMisc.cpp
This commit is contained in:
Justin Marshall
2020-06-22 17:19:05 -07:00
68 changed files with 1189 additions and 571 deletions
+67 -25
View File
@@ -107,6 +107,7 @@ typedef enum {
#define RANDOM_START_POSITION 0x7f
#define KILL_PLAYER_ON_DISCONNECT 1
@@ -1864,18 +1865,34 @@ extern "C" __declspec(dllexport) void __cdecl CNC_Handle_Player_Switch_To_AI(uin
return;
}
HousesType house;
HouseClass *ptr;
GlyphX_Debug_Print("CNC_Handle_Player_Switch_To_AI");
if (GAME_TO_PLAY == GAME_NORMAL) {
return;
}
#ifdef KILL_PLAYER_ON_DISCONNECT
/*
** Kill player's units on disconnect.
*/
if (player_id != 0) {
DLLExportClass::Set_Player_Context(player_id);
if (PlayerPtr) {
PlayerPtr->Flag_To_Die();
}
}
#else //KILL_PLAYER_ON_DISCONNECT
if (player_id != 0) {
HousesType house;
HouseClass *ptr;
DLLExportClass::Set_Player_Context(player_id);
if (PlayerPtr) {
PlayerPtr->WasHuman = true;
PlayerPtr->IsHuman = false;
@@ -1920,6 +1937,9 @@ extern "C" __declspec(dllexport) void __cdecl CNC_Handle_Player_Switch_To_AI(uin
}
}
}
#endif //KILL_PLAYER_ON_DISCONNECT
}
@@ -2763,12 +2783,24 @@ void DLLExportClass::On_Multiplayer_Game_Over(void)
event.GameOver.SabotagedStructureType = 0;
event.GameOver.TimerRemaining = -1;
// Trigger an event for each human player
for (int i=0 ; i<player_count; i++) {
// Trigger an event for each human player, winner first (even if it's an AI)
for (int i = 0; i < player_count; i++) {
HouseClass *player_ptr = HouseClass::As_Pointer(Session.Players[i]->Player.ID);
if (player_ptr->IsHuman) {
if (!player_ptr->IsDefeated) {
event.GlyphXPlayerID = Get_GlyphX_Player_ID(player_ptr);
event.GameOver.PlayerWins = !player_ptr->IsDefeated;
event.GameOver.IsHuman = player_ptr->IsHuman;
event.GameOver.PlayerWins = true;
event.GameOver.RemainingCredits = player_ptr->Available_Money();
EventCallback(event);
}
}
for (int i = 0; i < player_count; i++) {
HouseClass *player_ptr = HouseClass::As_Pointer(Session.Players[i]->Player.ID);
if (player_ptr->IsHuman && player_ptr->IsDefeated) {
event.GlyphXPlayerID = Get_GlyphX_Player_ID(player_ptr);
event.GameOver.IsHuman = true;
event.GameOver.PlayerWins = false;
event.GameOver.RemainingCredits = player_ptr->Available_Money();
EventCallback(event);
}
@@ -4000,6 +4032,10 @@ extern "C" __declspec(dllexport) void __cdecl CNC_Handle_Sidebar_Request(Sidebar
switch (request_type) {
// MBL 06.02.2020 - Changing right-click support for first put building on hold, and then subsequenct right-clicks to decrement that queue count for 1x or 5x; Then, 1x or 5x Left click will resume from hold
// Handle and fall through to start construction (from hold state) below
case SIDEBAR_REQUEST_START_CONSTRUCTION_MULTI:
case SIDEBAR_REQUEST_START_CONSTRUCTION:
DLLExportClass::Start_Construction(player_id, buildable_type, buildable_id);
break;
@@ -4237,7 +4273,7 @@ bool DLLExportClass::Get_Sidebar_State(uint64 player_id, unsigned char *buffer_i
if (tech) {
sidebar_entry.Cost = tech->Cost * PlayerPtr->CostBias;
sidebar_entry.PowerProvided = 0;
sidebar_entry.BuildTime = tech->Time_To_Build(); // sidebar_entry.BuildTime = tech->Time_To_Build() / 60;
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);
} else {
sidebar_entry.Cost = 0;
@@ -4392,7 +4428,7 @@ bool DLLExportClass::Get_Sidebar_State(uint64 player_id, unsigned char *buffer_i
if (tech) {
sidebar_entry.Cost = tech->Cost;
sidebar_entry.PowerProvided = 0;
sidebar_entry.BuildTime = tech->Time_To_Build(); // sidebar_entry.BuildTime = tech->Time_To_Build() / 60;
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);
} else {
sidebar_entry.Cost = 0;
@@ -7241,8 +7277,12 @@ void DLLExportClass::Selected_Guard_Mode(uint64 player_id)
for (int index = 0; index < CurrentObject.Count(); index++) {
ObjectClass const * tech = CurrentObject[index];
if (tech != NULL && tech->Can_Player_Move() && tech->Can_Player_Fire()) {
OutList.Add(EventClass(TargetClass(tech), MISSION_GUARD_AREA));
if (tech != NULL && tech->Can_Player_Fire()) {
if (tech->Can_Player_Move()) {
OutList.Add(EventClass(TargetClass(tech), MISSION_GUARD_AREA));
} else {
OutList.Add(EventClass(TargetClass(tech), MISSION_GUARD));
}
}
}
}
@@ -7323,6 +7363,8 @@ void DLLExportClass::Team_Units_Formation_Toggle_On(uint64 player_id)
int index;
bool setform = 0;
TeamFormDataStruct& team_form_data = TeamFormData[PlayerPtr->Class->House];
//
// Recording support
//
@@ -7346,8 +7388,8 @@ void DLLExportClass::Team_Units_Formation_Toggle_On(uint64 player_id)
team = obj->Group;
if (team < MAX_TEAMS) {
setform = obj->XFormOffset == (int)0x80000000;
TeamSpeed[team] = SPEED_WHEEL;
TeamMaxSpeed[team] = MPH_LIGHT_SPEED;
team_form_data.TeamSpeed[team] = SPEED_WHEEL;
team_form_data.TeamMaxSpeed[team] = MPH_LIGHT_SPEED;
break;
}
}
@@ -7365,8 +7407,8 @@ void DLLExportClass::Team_Units_Formation_Toggle_On(uint64 player_id)
team = obj->Group;
if (team < MAX_TEAMS) {
setform = obj->XFormOffset == (int)0x80000000;
TeamSpeed[team] = SPEED_WHEEL;
TeamMaxSpeed[team] = MPH_LIGHT_SPEED;
team_form_data.TeamSpeed[team] = SPEED_WHEEL;
team_form_data.TeamMaxSpeed[team] = MPH_LIGHT_SPEED;
break;
}
}
@@ -7386,8 +7428,8 @@ void DLLExportClass::Team_Units_Formation_Toggle_On(uint64 player_id)
team = obj->Group;
if (team < MAX_TEAMS) {
setform = obj->XFormOffset == 0x80000000UL;
TeamSpeed[team] = SPEED_WHEEL;
TeamMaxSpeed[team] = MPH_LIGHT_SPEED;
team_form_data.TeamSpeed[team] = SPEED_WHEEL;
team_form_data.TeamMaxSpeed[team] = MPH_LIGHT_SPEED;
break;
}
}
@@ -7412,9 +7454,9 @@ void DLLExportClass::Team_Units_Formation_Toggle_On(uint64 player_id)
if (xc > maxx) maxx = xc;
if (yc < miny) miny = yc;
if (yc > maxy) maxy = yc;
if (obj->Class->MaxSpeed < TeamMaxSpeed[team]) {
TeamMaxSpeed[team] = obj->Class->MaxSpeed;
TeamSpeed[team] = obj->Class->Speed;
if (obj->Class->MaxSpeed < team_form_data.TeamMaxSpeed[team]) {
team_form_data.TeamMaxSpeed[team] = obj->Class->MaxSpeed;
team_form_data.TeamSpeed[team] = obj->Class->Speed;
}
} else {
obj->XFormOffset = obj->YFormOffset = (int)0x80000000;
@@ -7433,8 +7475,8 @@ void DLLExportClass::Team_Units_Formation_Toggle_On(uint64 player_id)
if (xc > maxx) maxx = xc;
if (yc < miny) miny = yc;
if (yc > maxy) maxy = yc;
if (obj->Class->MaxSpeed < TeamMaxSpeed[team]) {
TeamMaxSpeed[team] = obj->Class->MaxSpeed;
if (obj->Class->MaxSpeed < team_form_data.TeamMaxSpeed[team]) {
team_form_data.TeamMaxSpeed[team] = obj->Class->MaxSpeed;
}
} else {
obj->XFormOffset = obj->YFormOffset = (int)0x80000000;
@@ -7453,8 +7495,8 @@ void DLLExportClass::Team_Units_Formation_Toggle_On(uint64 player_id)
if (xc > maxx) maxx = xc;
if (yc < miny) miny = yc;
if (yc > maxy) maxy = yc;
if (obj->Class->MaxSpeed < TeamMaxSpeed[team]) {
TeamMaxSpeed[team] = obj->Class->MaxSpeed;
if (obj->Class->MaxSpeed < team_form_data.TeamMaxSpeed[team]) {
team_form_data.TeamMaxSpeed[team] = obj->Class->MaxSpeed;
}
} else {
obj->XFormOffset = obj->YFormOffset = 0x80000000UL;
@@ -8023,7 +8065,7 @@ void DLLExportClass::Debug_Heal_Unit(int x, int y)
CellClass* cells[cellcount];
cells[0] = cellptr;
for (FacingType index = FACING_N; index < FACING_COUNT; index++) {
cells[(int)index + 1] = &cellptr->Adjacent_Cell(index);
cells[(int)index + 1] = cellptr->Adjacent_Cell(index);
}
for (int index = 0; index < cellcount; index++) {