Skip to content

Commit

Permalink
Customize max opponent colors when using -maxoppcolors (closes #102)
Browse files Browse the repository at this point in the history
  • Loading branch information
KcRobin9 authored May 9, 2024
2 parents ee694ff + 54af95b commit ec4038b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
13 changes: 8 additions & 5 deletions code/midtown/mmai/aiVehicleOpponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ define_dummy_symbol(mmai_aiVehicleOpponent);
#include "agi/dlptmpl.h"
#include "agi/getdlp.h"
#include "agiworld/quality.h"
#include "data7/str.h"
#include "mmcityinfo/vehlist.h"

#include "aiData.h"
#include "aiGoalBackup.h"
#include "aiGoalFollowWayPts.h"
#include "aiGoalStop.h"

static mem::cmd_param PARAM_maxoppcolors {"maxoppcolors"};

void aiVehicleOpponent::DrawDamage()
{}

Expand All @@ -38,10 +42,10 @@ void aiVehicleOpponent::Init(i32 opp_id, aiRaceData* race_data, char* race_name)
if (agiRQ.TextureQuality)
--agiRQ.TextureQuality;

i32 paint_job = opp_id & 3;
i32 index = opp_id + 1;
OpponentRaceData* opp = static_cast<OpponentRaceData*>(race_data->Opponents.Access(opp_id + 1));

OpponentRaceData* opp = static_cast<OpponentRaceData*>(race_data->Opponents.Access(index));
mmVehInfo* veh_info = VehList()->GetVehicleInfo(opp->Model);
i32 paint_job = opp_id % PARAM_maxoppcolors.get_or(string(veh_info->Colors).NumSubStrings());

Car.Init(opp->Model, CAR_TYPE_OPPONENT, paint_job);

Expand All @@ -52,9 +56,7 @@ void aiVehicleOpponent::Init(i32 opp_id, aiRaceData* race_data, char* race_name)

WayPts = arnew aiGoalFollowWayPts(
opp->PathFile, &RailSet, this, &IsBackup, &IsFinished, &IsStopped, xconst(race_name), opp->MaxThrottle);

BackupGoal = arnew aiGoalBackup(&RailSet, &Car, &IsBackup);

StopGoal = arnew aiGoalStop(&Car, &IsStopped);

IsSemi = !std::strcmp("vpsemi", opp->Model);
Expand All @@ -71,5 +73,6 @@ void aiVehicleOpponent::Init(i32 opp_id, aiRaceData* race_data, char* race_name)
RailSet.BackBumperDist = max.z;
RailSet.RSideDist = max.x;
}

AudIndexNumber = -1;
}
1 change: 1 addition & 0 deletions docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ For a tutorial on how to use command line arguments, click [here](https://www.bl
| allrace | false | Unlocks All Races |
| maxcops | 3 | Max cops chasing you at once |
| nodamage | false | Disables Damage |
| maxoppcolors | auto | Cycles through the opponent car colors based on the number of paintjobs available |

## Basic

Expand Down

0 comments on commit ec4038b

Please sign in to comment.