From c6a3244ced3e0f3796e66611a40b565fe3d73318 Mon Sep 17 00:00:00 2001 From: assertivist Date: Fri, 16 Aug 2024 20:38:56 -0700 Subject: [PATCH 1/3] deploy scout when a player incarnates --- src/game/CAbstractPlayer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/game/CAbstractPlayer.cpp b/src/game/CAbstractPlayer.cpp index 831a53c5..d644c0a4 100644 --- a/src/game/CAbstractPlayer.cpp +++ b/src/game/CAbstractPlayer.cpp @@ -1569,6 +1569,7 @@ void CAbstractPlayer::FrameAction() { if (doIncarnateSound) { IncarnateSound(); + if (itsScout->action == kScoutInactive) itsScout->ToggleState(kScoutUp); } // if a frag frame is specified with /dbg, force a frag on that frame by messing with FRandSeed From e6c96aa32ee121444d2f35516b6d0faf5c4bf951 Mon Sep 17 00:00:00 2001 From: assertivist Date: Sat, 17 Aug 2024 13:34:52 -0700 Subject: [PATCH 2/3] adapt missile/grenade tests for new scout deployment default --- src/tests.cpp | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/tests.cpp b/src/tests.cpp index 533ee878..e98863cf 100644 --- a/src/tests.cpp +++ b/src/tests.cpp @@ -338,15 +338,13 @@ vector FireGrenade(int settleSteps, int steps, int frameTime) { CGrenade *grenade = 0; // hopefully there are two objects now. a hector and a grenade. - CAbstractActor *aa = scenario.game->actorList; - int count = 2; - for (count = 0; aa; aa = aa->nextActor, count++) { - if (aa != scenario.hector) { + for (CAbstractActor *aa = scenario.game->actorList; aa; aa = aa->nextActor) { + if (typeid(*aa) == typeid(CGrenade)) { grenade = (CGrenade*)aa; } } - for (int i = 0; i < steps && count == 2; i++) { + for (int i = 0; i < steps && grenade != 0; i++) { trajectory.push_back(*(VectorStruct*)grenade->location); for (int k = 0; k < ticksPerStep; k++) { scenario.game->GameTick(); @@ -354,9 +352,8 @@ vector FireGrenade(int settleSteps, int steps, int frameTime) { // this intends to figure out whether the grenade has exploded. grenade = 0; - aa = scenario.game->actorList; - for (count = 0; aa; aa = aa->nextActor, count++) { - if (aa != scenario.hector) { + for (CAbstractActor *aa = scenario.game->actorList; aa; aa = aa->nextActor) { + if (typeid(*aa) == typeid(CGrenade)) { grenade = (CGrenade*)aa; } } @@ -374,15 +371,6 @@ vector FireMissile(int hectorSettle, int scoutSettle, int steps, i scenario.game->GameTick(); } - // scout up - scenario.hector->itsManager->GetFunctions()->held = (1 << kfuScoutControl); - scenario.hector->itsManager->GetFunctions()->down = (1 << kfuAimForward); - scenario.hector->itsManager->GetFunctions()->up = (1 << kfuScoutControl) | (1 << kfuAimForward); - scenario.game->GameTick(); - scenario.hector->itsManager->GetFunctions()->held = 0; - scenario.hector->itsManager->GetFunctions()->down = 0; - scenario.hector->itsManager->GetFunctions()->up = 0; - // load missile scenario.hector->itsManager->GetFunctions()->down = (1 << kfuLoadMissile); scenario.game->GameTick(); @@ -1116,7 +1104,7 @@ TEST(MISSILE, Trajectory) { // index 15 is the furthest left the missile goes, and index 26 is the furthest forward ASSERT_NEAR(at64ms[15].theVec[0], -591030, 3*MILLIMETER) << "64ms simulation is wrong on min X"; - ASSERT_NEAR(at64ms[26].theVec[2], 1306106, 3*MILLIMETER) << "64ms simulation is wrong on max Z"; + ASSERT_NEAR(at64ms[26].theVec[2], 1306446, 3*MILLIMETER) << "64ms simulation is wrong on max Z"; ASSERT_EQ(at64ms.size(), 37) << "64ms simulation blows up in the wrong frame"; ASSERT_NEAR(at64ms.size(), at32ms.size(), 1) << "32ms simulation should blows up in wrong frame"; ASSERT_NEAR(at64ms.size(), at16ms.size(), 1) << "16ms simulation should blows up at wrong frame"; From 5eb9c050606b560e1886dea775412b6dae617c33 Mon Sep 17 00:00:00 2001 From: assertivist Date: Sat, 17 Aug 2024 13:40:41 -0700 Subject: [PATCH 3/3] ensure player is active (not spectating or away) before autodeploying scout --- src/game/CAbstractPlayer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/game/CAbstractPlayer.cpp b/src/game/CAbstractPlayer.cpp index d644c0a4..7caf4ef1 100644 --- a/src/game/CAbstractPlayer.cpp +++ b/src/game/CAbstractPlayer.cpp @@ -1569,7 +1569,10 @@ void CAbstractPlayer::FrameAction() { if (doIncarnateSound) { IncarnateSound(); - if (itsScout->action == kScoutInactive) itsScout->ToggleState(kScoutUp); + if (itsManager->Presence() == kzAvailable && + itsScout->action == kScoutInactive) { + itsScout->ToggleState(kScoutUp); + } } // if a frag frame is specified with /dbg, force a frag on that frame by messing with FRandSeed