Skip to content

Commit

Permalink
Aggressive opponents (#153)
Browse files Browse the repository at this point in the history
* implements crash earnings, fixes wasted message
  • Loading branch information
dethrace-labs committed Sep 11, 2022
1 parent f99be5f commit 5e05fc1
Show file tree
Hide file tree
Showing 8 changed files with 696 additions and 263 deletions.
8 changes: 6 additions & 2 deletions src/DETHRACE/common/car.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ void DamageUnitWithSmoke(tCar_spec* pCar, int pUnit_type, int pDamage_amount) {
void DamageEngine(int pDamage_amount) {
LOG_TRACE("(%d)", pDamage_amount);

// DamageUnitWithSmoke(&gProgram_state.current_car, eDamage_engine, pDamage_amount);
DamageUnitWithSmoke(gProgram_state.AI_vehicles.opponents[0].car_spec, eDamage_engine, pDamage_amount);
DamageUnitWithSmoke(&gProgram_state.current_car, eDamage_engine, pDamage_amount);
}

// IDA: void __usercall DamageTrans(int pDamage_amount@<EAX>)
Expand Down Expand Up @@ -538,6 +537,11 @@ void SetInitialPosition(tRace_info* pThe_race, int pCar_index, int pGrid_index)
if (gNet_mode && car->disabled && car_actor->t.t.translate.t.v[0] < 500.0) {
DisableCar(car);
}
// Enable to start all opponent cars upside down ;)
// if (strstr(car->name, "EAGLE") == 0) {
// car_actor->t.t.translate.t.v[1] += 2;
// car_actor->t.t.look_up.up.v[1] = -1;
// }
}

// IDA: void __usercall SetInitialPositions(tRace_info *pThe_race@<EAX>)
Expand Down
328 changes: 323 additions & 5 deletions src/DETHRACE/common/crush.c

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/DETHRACE/common/displays.c
Original file line number Diff line number Diff line change
Expand Up @@ -1429,6 +1429,7 @@ void AwardTime(tU32 pTime) {
if (gRace_finished || gFreeze_timer || gNet_mode != eNet_mode_none || pTime == 0) {
return;
}

original_amount = pTime;
the_time = GetTotalTime();
for (i = COUNT_OF(gOld_times) - 1; i > 0; i--) {
Expand Down
2 changes: 1 addition & 1 deletion src/DETHRACE/common/mainloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void QueueWastedMassage(int pIndex) {
if (gQueued_wasted_massages_count == 0) {
gLast_wasted_massage_start = GetTotalTime();
}
gQueued_wasted_massages[gQueued_wasted_massages_count + 1] = pIndex;
gQueued_wasted_massages[gQueued_wasted_massages_count] = pIndex;
gQueued_wasted_massages_count++;
}

Expand Down
448 changes: 330 additions & 118 deletions src/DETHRACE/common/opponent.c

Large diffs are not rendered by default.

143 changes: 8 additions & 135 deletions src/DETHRACE/common/oppoproc.c

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/DETHRACE/common/spark.c
Original file line number Diff line number Diff line change
Expand Up @@ -1833,6 +1833,10 @@ void DrawTheGlow(br_pixelmap* pRender_screen, br_pixelmap* pDepth_buffer, br_act
tU32 seed;
LOG_TRACE("(%p, %p, %p)", pRender_screen, pDepth_buffer, pCamera);

// FIXME: sometimes this function causes a segfault (most commonly when looking at a glow fairly close up and the camera swings away). Stubbing it out for now.
LOG_WARN_ONCE("DrawTheGlow is stubbed out");
return;

if (gColumn_flags) {
seed = rand();
srand(GetTotalTime());
Expand Down
25 changes: 23 additions & 2 deletions src/DETHRACE/common/world.c
Original file line number Diff line number Diff line change
Expand Up @@ -1590,15 +1590,36 @@ void KillGroovadelic(int pOwner) {
int i;
tGroovidelic_spec* the_groove;
LOG_TRACE("(%d)", pOwner);
NOT_IMPLEMENTED();

for (i = 0; i < gGroovidelics_array_size; i++) {
the_groove = &gGroovidelics_array[i];
if (the_groove->owner == pOwner
&& the_groove->path_mode != eMove_controlled
&& the_groove->path_mode != eMove_absolute
&& the_groove->object_mode != eMove_controlled
&& the_groove->object_mode != eMove_absolute) {
the_groove->owner = -999;
}
}
}

// IDA: void __usercall KillFunkotronic(int pOwner@<EAX>)
void KillFunkotronic(int pOwner) {
int i;
tFunkotronic_spec* the_funk;
LOG_TRACE("(%d)", pOwner);
NOT_IMPLEMENTED();

for (i = 0; i < gFunkotronics_array_size; i++) {
the_funk = &gFunkotronics_array[i];
if (the_funk->owner == pOwner
&& the_funk->matrix_mode != eMove_controlled
&& the_funk->matrix_mode != eMove_absolute
&& the_funk->lighting_animation_type != eMove_controlled
&& the_funk->lighting_animation_type != eMove_absolute
&& (the_funk->texture_animation_data.frames_info.mode != eMove_controlled || the_funk->texture_animation_type)) {
the_funk->owner = -999;
}
}
}

// IDA: br_uint_32 __usercall DeleteBastards@<EAX>(br_actor *pActor@<EAX>, br_matrix34 *pMatrix@<EDX>, void *pArg@<EBX>)
Expand Down

0 comments on commit 5e05fc1

Please sign in to comment.