Skip to content

Commit

Permalink
Implemented aiGoalStop functions
Browse files Browse the repository at this point in the history
  • Loading branch information
KcRobin9 authored Jun 1, 2024
1 parent ac914e5 commit d172396
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 10 deletions.
2 changes: 1 addition & 1 deletion code/midtown/mmai/aiGoal.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class aiGoal

virtual b32 Context() = 0;

virtual i32 Priority() = 0;
virtual b32 Priority() = 0;

// ?Update@aiGoal@@UAEXXZ | inline
ARTS_EXPORT virtual void Update()
Expand Down
4 changes: 2 additions & 2 deletions code/midtown/mmai/aiGoalBackup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ b32 aiGoalBackup::Context()
return *BackingUp;
}

i32 aiGoalBackup::Priority()
b32 aiGoalBackup::Priority()
{
return 1;
return true;
}

void aiGoalBackup::Reset()
Expand Down
2 changes: 1 addition & 1 deletion code/midtown/mmai/aiGoalBackup.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class aiGoalBackup final : public aiGoal
ARTS_EXPORT void Init() override;

// ?Priority@aiGoalBackup@@UAEHXZ
ARTS_EXPORT i32 Priority() override;
ARTS_EXPORT b32 Priority() override;

// ?Reset@aiGoalBackup@@UAEXXZ
ARTS_EXPORT void Reset() override;
Expand Down
32 changes: 32 additions & 0 deletions code/midtown/mmai/aiGoalStop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,37 @@ define_dummy_symbol(mmai_aiGoalStop);

#include "aiGoalStop.h"

#include "mmcar/car.h"

aiGoalStop::aiGoalStop(mmCar* car, i16* stop_id)
: Car(car)
, StopId(stop_id)
{}

b32 aiGoalStop::Context()
{
if (*StopId)
return true;

UpdateCount = 0;
return false;
}

b32 aiGoalStop::Priority()
{
return true;
}

void aiGoalStop::Reset()
{}

void aiGoalStop::Update()
{
++UpdateCount;

Car->Sim.Steering = 0.0f;
Car->Sim.Engine.Throttle = 0.0f;
Car->Sim.Brakes = 1.0f;

Car->Sim.ICS.LinearMomentum *= 0.95f;
}
13 changes: 7 additions & 6 deletions code/midtown/mmai/aiGoalStop.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,28 @@ class aiGoalStop final : public aiGoal
{
public:
// ??0aiGoalStop@@QAE@PAVmmCar@@PAF@Z
ARTS_IMPORT aiGoalStop(mmCar* arg1, b16* arg2);
ARTS_EXPORT aiGoalStop(mmCar* car, i16* stop_id);

// ??1aiGoalStop@@QAE@XZ
ARTS_IMPORT ~aiGoalStop() = default;
ARTS_EXPORT ~aiGoalStop() = default;

// ?Context@aiGoalStop@@UAEHXZ
ARTS_IMPORT b32 Context() override;
ARTS_EXPORT b32 Context() override;

// ?Init@aiGoalStop@@UAEXXZ
ARTS_IMPORT void Init() override;

// ?Priority@aiGoalStop@@UAEHXZ
ARTS_IMPORT i32 Priority() override;
ARTS_EXPORT b32 Priority() override;

// ?Reset@aiGoalStop@@UAEXXZ
ARTS_EXPORT void Reset() override;

// ?Update@aiGoalStop@@UAEXXZ
ARTS_IMPORT void Update() override;
ARTS_EXPORT void Update() override;

u8 gap8[0x8];
mmCar* Car;
i16* StopId;
};

check_size(aiGoalStop, 0x10);

0 comments on commit d172396

Please sign in to comment.