Skip to content

Fix APC/BIGAPC wheels when player wasted equivalent cop car in previous race #428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
27 changes: 27 additions & 0 deletions src/DETHRACE/common/structur.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "utility.h"
#include "world.h"
#include <stdlib.h>
#include <string.h>

int gLast_wrong_checkpoint;
int gMirror_on__structur = 1; // suffix added to avoid duplicate symbol
Expand Down Expand Up @@ -480,6 +481,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 +528,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();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is required, or the calls to switch resolution, or SetCarStorageTexturingLevel.

could you try without these?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was my first approach but it didn't look good
image

The HUD is completely misaligned and cockpit view is in lowres even when hires is enabled. After that I decided to repeat complete "science & magic" that happens on regular car change and that started to work.

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
Loading