Skip to content

Commit

Permalink
Added AI Physics Cheatcode
Browse files Browse the repository at this point in the history
  • Loading branch information
KcRobin9 authored Jun 17, 2024
1 parent d172396 commit e8018e3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
15 changes: 15 additions & 0 deletions code/midtown/mmcar/car.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,24 @@ define_dummy_symbol(mmcar_car);
#include "agi/getdlp.h"
#include "data7/timer.h"
#include "mmcity/cullcity.h"
#include "mmcityinfo/state.h"
#include "mmcityinfo/vehlist.h"
#include "mmphysics/joint3dof.h"

#include "playercaraudio.h"
#include "trailer.h"

static mem::cmd_param PARAM_aiphysics {"aiphysics"};

void mmCar::ApplyAiPhysics()
{
if (!Sim.FrontLeft.OnGround && !Sim.FrontRight.OnGround && !Sim.BackLeft.OnGround && !Sim.BackRight.OnGround)
{
Sim.ICS.AngularMomentum *= 0.1f;
CHEATING = true;
}
}

mmCar::mmCar()
{
// FIXME: mmCar is already oversampled by mmPhysicsMGR
Expand Down Expand Up @@ -65,6 +77,9 @@ void mmCar::Update()

OverSample.Update();

if (PARAM_aiphysics && MMSTATE.NetworkStatus == 0)
ApplyAiPhysics();

#ifdef ARTS_DEV_BUILD
f32 elapsed = t.Time();
mmCar::UpdateTime += elapsed;
Expand Down
2 changes: 2 additions & 0 deletions code/midtown/mmcar/car.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ class mmCar final : public mmPhysEntity
// ?DeclareFields@mmCar@@SAXXZ
ARTS_IMPORT static void DeclareFields();

void ApplyAiPhysics();

#ifdef ARTS_DEV_BUILD
// ?PostUpdateTime@mmCar@@2MA
ARTS_IMPORT static f32 PostUpdateTime;
Expand Down
1 change: 1 addition & 0 deletions docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ For a tutorial on how to use command line arguments, click [here](https://www.bl

| Name | Value | Description |
| ---------- | ----- | --- |
| aiphysics | false | Sets AI-like physics midair
| allcars | false | Unlocks All Cars |
| allrace | false | Unlocks All Races |
| maxcops | 3 | Max cops chasing you at once |
Expand Down

0 comments on commit e8018e3

Please sign in to comment.