From 87d772df9d40c049aa743aef0ee6599d3b9225b0 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Mon, 25 Aug 2025 15:37:16 +1000 Subject: [PATCH 1/4] feat: Enable special power EVA events for observed players --- .../Object/SpecialPower/SpecialPowerModule.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp index 60f36ff172..6c9e15d252 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp @@ -550,7 +550,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location ) // Let EVA do her thing SpecialPowerType type = getSpecialPowerModuleData()->m_specialPowerTemplate->getSpecialPowerType(); - Player *localPlayer = ThePlayerList->getLocalPlayer(); + Player *localPlayer = TheControlBar->getCurrentlyViewedPlayer(); // Only play the EVA sounds if this is not the local player, and the local player doesn't consider the // person an enemy. @@ -564,7 +564,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location ) { TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_ParticleCannon); } - else if ( localPlayer->getRelationship(getObject()->getTeam()) != ENEMIES ) + else if ( TheControlBar->getCurrentlyViewedPlayerRelationship(getObject()->getTeam()) != ENEMIES ) { // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_ParticleCannon); @@ -580,7 +580,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location ) { TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_Nuke); } - else if ( localPlayer->getRelationship(getObject()->getTeam()) != ENEMIES ) + else if ( TheControlBar->getCurrentlyViewedPlayerRelationship(getObject()->getTeam()) != ENEMIES ) { // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_Nuke); @@ -596,7 +596,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location ) { TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_ScudStorm); } - else if ( localPlayer->getRelationship(getObject()->getTeam()) != ENEMIES ) + else if ( TheControlBar->getCurrentlyViewedPlayerRelationship(getObject()->getTeam()) != ENEMIES ) { // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_ScudStorm); @@ -614,7 +614,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location ) { TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_GPS_Scrambler); } - else if ( localPlayer->getRelationship(getObject()->getTeam()) != ENEMIES ) + else if ( TheControlBar->getCurrentlyViewedPlayerRelationship(getObject()->getTeam()) != ENEMIES ) { // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_GPS_Scrambler); @@ -630,7 +630,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location ) { TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_Sneak_Attack); } - else if ( localPlayer->getRelationship(getObject()->getTeam()) != ENEMIES ) + else if ( TheControlBar->getCurrentlyViewedPlayerRelationship(getObject()->getTeam()) != ENEMIES ) { // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_Sneak_Attack); From 2324788eb1cd64ce98d6956b62558eaa69b23cd3 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Sun, 14 Sep 2025 00:02:45 +1000 Subject: [PATCH 2/4] refactor: Cache relationship --- .../Object/SpecialPower/SpecialPowerModule.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp index 6c9e15d252..8407ee8638 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp @@ -551,6 +551,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location ) SpecialPowerType type = getSpecialPowerModuleData()->m_specialPowerTemplate->getSpecialPowerType(); Player *localPlayer = TheControlBar->getCurrentlyViewedPlayer(); + Relationship relationship = TheControlBar->getCurrentlyViewedPlayerRelationship(getObject()->getTeam()); // Only play the EVA sounds if this is not the local player, and the local player doesn't consider the // person an enemy. @@ -564,7 +565,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location ) { TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_ParticleCannon); } - else if ( TheControlBar->getCurrentlyViewedPlayerRelationship(getObject()->getTeam()) != ENEMIES ) + else if (relationship != ENEMIES) { // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_ParticleCannon); @@ -580,7 +581,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location ) { TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_Nuke); } - else if ( TheControlBar->getCurrentlyViewedPlayerRelationship(getObject()->getTeam()) != ENEMIES ) + else if (relationship != ENEMIES) { // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_Nuke); @@ -596,7 +597,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location ) { TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_ScudStorm); } - else if ( TheControlBar->getCurrentlyViewedPlayerRelationship(getObject()->getTeam()) != ENEMIES ) + else if (relationship != ENEMIES) { // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_ScudStorm); @@ -614,7 +615,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location ) { TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_GPS_Scrambler); } - else if ( TheControlBar->getCurrentlyViewedPlayerRelationship(getObject()->getTeam()) != ENEMIES ) + else if (relationship != ENEMIES) { // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_GPS_Scrambler); @@ -630,7 +631,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location ) { TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_Sneak_Attack); } - else if ( TheControlBar->getCurrentlyViewedPlayerRelationship(getObject()->getTeam()) != ENEMIES ) + else if (relationship != ENEMIES) { // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_Sneak_Attack); From 8341ac5d3e66462178773eaa845718ea0915e996 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Fri, 14 Nov 2025 19:46:36 +1100 Subject: [PATCH 3/4] tweak: Use new utility logic --- .../GameLogic/Object/SpecialPower/SpecialPowerModule.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp index 8407ee8638..05f7b0fa97 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp @@ -31,6 +31,7 @@ #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine #include "Common/GameAudio.h" +#include "Common/GameUtility.h" #include "Common/GlobalData.h" #include "Common/INI.h" #include "Common/Player.h" @@ -550,7 +551,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location ) // Let EVA do her thing SpecialPowerType type = getSpecialPowerModuleData()->m_specialPowerTemplate->getSpecialPowerType(); - Player *localPlayer = TheControlBar->getCurrentlyViewedPlayer(); + Player *localPlayer = rts::getObservedOrLocalPlayer(); Relationship relationship = TheControlBar->getCurrentlyViewedPlayerRelationship(getObject()->getTeam()); // Only play the EVA sounds if this is not the local player, and the local player doesn't consider the From 988d947d4e514a482a025dd9c662dfccc9b876e9 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Fri, 14 Nov 2025 19:53:51 +1100 Subject: [PATCH 4/4] refactor: Adjust relationship logic --- .../Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp index 05f7b0fa97..37aaf7dd34 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp @@ -552,7 +552,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location ) SpecialPowerType type = getSpecialPowerModuleData()->m_specialPowerTemplate->getSpecialPowerType(); Player *localPlayer = rts::getObservedOrLocalPlayer(); - Relationship relationship = TheControlBar->getCurrentlyViewedPlayerRelationship(getObject()->getTeam()); + Relationship relationship = localPlayer->getRelationship(getObject()->getTeam()); // Only play the EVA sounds if this is not the local player, and the local player doesn't consider the // person an enemy.