Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deploy scout when a player incarnates #422

Merged
merged 3 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/game/CAbstractPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1569,6 +1569,10 @@ void CAbstractPlayer::FrameAction() {

if (doIncarnateSound) {
IncarnateSound();
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
Expand Down
24 changes: 6 additions & 18 deletions src/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,25 +338,22 @@ vector<VectorStruct> 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();
}

// 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;
}
}
Expand All @@ -374,15 +371,6 @@ vector<VectorStruct> 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();
Expand Down Expand Up @@ -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";
Expand Down
Loading