Skip to content

Commit 5e05fc1

Browse files
Aggressive opponents (#153)
* implements crash earnings, fixes wasted message
1 parent f99be5f commit 5e05fc1

File tree

8 files changed

+696
-263
lines changed

8 files changed

+696
-263
lines changed

src/DETHRACE/common/car.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ void DamageUnitWithSmoke(tCar_spec* pCar, int pUnit_type, int pDamage_amount) {
144144
void DamageEngine(int pDamage_amount) {
145145
LOG_TRACE("(%d)", pDamage_amount);
146146

147-
// DamageUnitWithSmoke(&gProgram_state.current_car, eDamage_engine, pDamage_amount);
148-
DamageUnitWithSmoke(gProgram_state.AI_vehicles.opponents[0].car_spec, eDamage_engine, pDamage_amount);
147+
DamageUnitWithSmoke(&gProgram_state.current_car, eDamage_engine, pDamage_amount);
149148
}
150149

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

543547
// IDA: void __usercall SetInitialPositions(tRace_info *pThe_race@<EAX>)

src/DETHRACE/common/crush.c

+323-5
Large diffs are not rendered by default.

src/DETHRACE/common/displays.c

+1
Original file line numberDiff line numberDiff line change
@@ -1429,6 +1429,7 @@ void AwardTime(tU32 pTime) {
14291429
if (gRace_finished || gFreeze_timer || gNet_mode != eNet_mode_none || pTime == 0) {
14301430
return;
14311431
}
1432+
14321433
original_amount = pTime;
14331434
the_time = GetTotalTime();
14341435
for (i = COUNT_OF(gOld_times) - 1; i > 0; i--) {

src/DETHRACE/common/mainloop.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ void QueueWastedMassage(int pIndex) {
120120
if (gQueued_wasted_massages_count == 0) {
121121
gLast_wasted_massage_start = GetTotalTime();
122122
}
123-
gQueued_wasted_massages[gQueued_wasted_massages_count + 1] = pIndex;
123+
gQueued_wasted_massages[gQueued_wasted_massages_count] = pIndex;
124124
gQueued_wasted_massages_count++;
125125
}
126126

src/DETHRACE/common/opponent.c

+330-118
Large diffs are not rendered by default.

src/DETHRACE/common/oppoproc.c

+8-135
Large diffs are not rendered by default.

src/DETHRACE/common/spark.c

+4
Original file line numberDiff line numberDiff line change
@@ -1833,6 +1833,10 @@ void DrawTheGlow(br_pixelmap* pRender_screen, br_pixelmap* pDepth_buffer, br_act
18331833
tU32 seed;
18341834
LOG_TRACE("(%p, %p, %p)", pRender_screen, pDepth_buffer, pCamera);
18351835

1836+
// 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.
1837+
LOG_WARN_ONCE("DrawTheGlow is stubbed out");
1838+
return;
1839+
18361840
if (gColumn_flags) {
18371841
seed = rand();
18381842
srand(GetTotalTime());

src/DETHRACE/common/world.c

+23-2
Original file line numberDiff line numberDiff line change
@@ -1590,15 +1590,36 @@ void KillGroovadelic(int pOwner) {
15901590
int i;
15911591
tGroovidelic_spec* the_groove;
15921592
LOG_TRACE("(%d)", pOwner);
1593-
NOT_IMPLEMENTED();
1593+
1594+
for (i = 0; i < gGroovidelics_array_size; i++) {
1595+
the_groove = &gGroovidelics_array[i];
1596+
if (the_groove->owner == pOwner
1597+
&& the_groove->path_mode != eMove_controlled
1598+
&& the_groove->path_mode != eMove_absolute
1599+
&& the_groove->object_mode != eMove_controlled
1600+
&& the_groove->object_mode != eMove_absolute) {
1601+
the_groove->owner = -999;
1602+
}
1603+
}
15941604
}
15951605

15961606
// IDA: void __usercall KillFunkotronic(int pOwner@<EAX>)
15971607
void KillFunkotronic(int pOwner) {
15981608
int i;
15991609
tFunkotronic_spec* the_funk;
16001610
LOG_TRACE("(%d)", pOwner);
1601-
NOT_IMPLEMENTED();
1611+
1612+
for (i = 0; i < gFunkotronics_array_size; i++) {
1613+
the_funk = &gFunkotronics_array[i];
1614+
if (the_funk->owner == pOwner
1615+
&& the_funk->matrix_mode != eMove_controlled
1616+
&& the_funk->matrix_mode != eMove_absolute
1617+
&& the_funk->lighting_animation_type != eMove_controlled
1618+
&& the_funk->lighting_animation_type != eMove_absolute
1619+
&& (the_funk->texture_animation_data.frames_info.mode != eMove_controlled || the_funk->texture_animation_type)) {
1620+
the_funk->owner = -999;
1621+
}
1622+
}
16021623
}
16031624

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

0 commit comments

Comments
 (0)