Fix gear rendering for standard resolution mode (#269)

A different gear mask is being used for standard and hi-res modes.
Supply a hardcoded mask value for standard resolution and detect the
graphics mode.
This commit is contained in:
Artur Rojek 2022-12-12 03:06:32 +01:00 committed by GitHub
parent 1531f4a9d6
commit de6d6a02bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -1056,6 +1056,7 @@ void DoInstruments(tU32 pThe_time) {
int the_wobble_x;
int the_wobble_y;
int gear;
int gear_height; /* Added by dethrace. */
double the_angle;
double the_angle2;
double sin_angle;
@ -1161,24 +1162,27 @@ void DoInstruments(tU32 pThe_time) {
}
#if defined(DETHRACE_FIX_BUGS)
/*
* The OG derives gear mask height of 28 by `gears_image->height / 8`, but
* The OG derives gear mask height of 16 or 28 by `gears_image->height / 8`, but
* this is only valid for HGEARS.PIX, which contains 8 gear images. Hardcoding
* this number fixes gear rendering for cars using HGEARS4.PIX, which consists
* of 11 gear images.
*/
#define GEAR_HEIGHT 28
#define GEAR_HEIGHT 16
#define GEAR_HEIGHT_HIRES 28
#else
#define GEAR_HEIGHT ((int)gProgram_state.current_car.gears_image->height / 8)
#define GEAR_HEIGHT_HIRES GEAR_HEIGHT
#endif
gear_height = gGraf_spec_index ? GEAR_HEIGHT_HIRES : GEAR_HEIGHT;
DRPixelmapRectangleMaskedCopy(
gBack_screen,
the_wobble_x + gProgram_state.current_car.gear_x[gProgram_state.cockpit_on],
the_wobble_y + gProgram_state.current_car.gear_y[gProgram_state.cockpit_on],
gProgram_state.current_car.gears_image,
0,
(gear + 1) * GEAR_HEIGHT,
(gear + 1) * gear_height,
gProgram_state.current_car.gears_image->width,
GEAR_HEIGHT);
gear_height);
}
speedo_image = gProgram_state.current_car.speedo_image[gProgram_state.cockpit_on];
if (gProgram_state.current_car.speedo_radius_2[gProgram_state.cockpit_on] >= 0) {