Skip to content

Commit

Permalink
Fix APC/BIGAPC wheels when player wasted equivalent cop car in previo…
Browse files Browse the repository at this point in the history
…us race
  • Loading branch information
b-kurczynski committed Dec 16, 2024
1 parent 1f009a2 commit 0300861
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/DETHRACE/common/loading.c
Original file line number Diff line number Diff line change
Expand Up @@ -1745,8 +1745,16 @@ void LoadCar(char* pCar_name, tDriver pDriver, tCar_spec* pCar_spec, int pOwner,
LOG_TRACE("(\"%s\", %d, %p, %d, \"%s\", %p)", pCar_name, pDriver, pCar_spec, pOwner, pDriver_name, pStorage_space);

if (pDriver == eDriver_local_human) {
#if defined(DETHRACE_FIX_BUGS)
// Player's APC/BIGAPC wheels got stuck if the equivalent cop car was wasted in previous race
if (strcmp(gProgram_state.car_name, pCar_name) == 0 &&
strcmp(gProgram_state.car_name, "APC.TXT") != 0 &&
strcmp(gProgram_state.car_name, "BIGAPC.TXT") != 0)
return;
#else
if (strcmp(gProgram_state.car_name, pCar_name) == 0)
return;
#endif
if (gProgram_state.car_name[0] != '\0') {
DisposeCar(&gProgram_state.current_car, gProgram_state.current_car.index);
ClearOutStorageSpace(&gOur_car_storage_space);
Expand Down
26 changes: 26 additions & 0 deletions src/DETHRACE/common/structur.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,10 @@ void DoGame(void) {
int second_select_race;
int first_summary_done;
int i;
#if defined(DETHRACE_FIX_BUGS)
// Player's APC/BIGAPC wheels got stuck if the equivalent cop car was wasted in previous race
int power_up_levels[3];
#endif
LOG_TRACE("()");

gAbandon_game = 0;
Expand Down Expand Up @@ -523,6 +527,28 @@ void DoGame(void) {
SwapNetCarsLoad();
}
} else {
#if defined(DETHRACE_FIX_BUGS)
// Player's APC/BIGAPC wheels got stuck if the equivalent cop car was wasted in previous race
if(strcmp(gProgram_state.car_name, "APC.TXT") == 0 ||
strcmp(gProgram_state.car_name, "BIGAPC.TXT") == 0) {
AboutToLoadFirstCar();
SwitchToRealResolution();
for (i = 0; i < COUNT_OF(power_up_levels); i++) {
power_up_levels[i] = gProgram_state.current_car.power_up_levels[i];
}
LoadCar(gOpponents[gProgram_state.cars_available[gCurrent_car_index]].car_file_name,
eDriver_local_human,
&gProgram_state.current_car,
gProgram_state.cars_available[gCurrent_car_index],
gProgram_state.player_name[gProgram_state.frank_or_anniness],
&gOur_car_storage_space);
for (i = 0; i < COUNT_OF(power_up_levels); i++) {
gProgram_state.current_car.power_up_levels[i] = power_up_levels[i];
}
SwitchToLoresMode();
SetCarStorageTexturingLevel(&gOur_car_storage_space, GetCarTexturingLevel(), eCTL_full);
}
#endif
LoadOpponentsCars(&gCurrent_race);
}
PrintMemoryDump(0, "AFTER LOADING OPPONENTS IN");
Expand Down

0 comments on commit 0300861

Please sign in to comment.