Skip to content

Commit 36cd6c9

Browse files
authored
Fix Car icons in menus
The DOS version loads both low and high-res car icons: one is used for in-game icons, the other for use in the menus. On Windows, only the high res car icons are used. This causes artifacts.
1 parent 80f1a88 commit 36cd6c9

File tree

3 files changed

+28
-12
lines changed

3 files changed

+28
-12
lines changed

src/DETHRACE/common/loading.c

+12-10
Original file line numberDiff line numberDiff line change
@@ -505,18 +505,20 @@ br_pixelmap* LoadPixelmap(char* pName) {
505505
end = &pName[strlen(pName)];
506506
}
507507

508-
if ((end - pName) != 4 || memcmp(pName, "none", end - pName) != 0) {
509-
PossibleService();
510-
PathCat(the_path, gApplication_path, gGraf_specs[gGraf_spec_index].data_dir_name);
511-
PathCat(the_path, the_path, "PIXELMAP");
508+
if (end - pName == 4 && memcmp(pName, "none", end - pName) == 0) {
509+
return NULL;
510+
}
511+
512+
PossibleService();
513+
PathCat(the_path, gApplication_path, gGraf_specs[gGraf_spec_index].data_dir_name);
514+
PathCat(the_path, the_path, "PIXELMAP");
515+
PathCat(the_path, the_path, pName);
516+
AllowOpenToFail();
517+
pm = DRPixelmapLoad(the_path);
518+
if (pm == NULL) {
519+
PathCat(the_path, gApplication_path, "PIXELMAP");
512520
PathCat(the_path, the_path, pName);
513-
AllowOpenToFail();
514521
pm = DRPixelmapLoad(the_path);
515-
if (pm == NULL) {
516-
PathCat(the_path, gApplication_path, "PIXELMAP");
517-
PathCat(the_path, the_path, pName);
518-
pm = DRPixelmapLoad(the_path);
519-
}
520522
}
521523
return pm;
522524
}

src/DETHRACE/common/netgame.c

+14
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "errors.h"
66
#include "globvars.h"
77
#include "globvrpb.h"
8+
#include "grafdata.h"
89
#include "graphics.h"
910
#include "harness/trace.h"
1011
#include "loading.h"
@@ -417,12 +418,25 @@ void InitNetHeadups(void) {
417418
if (gDigits_pix != NULL) {
418419
BrMapAdd(gDigits_pix);
419420
}
421+
/* The Windows version does not use gIcons_pix_low_res. */
422+
if (gGraf_data_index != 0) {
423+
SwitchToLoresMode();
424+
gIcons_pix_low_res = LoadPixelmap("CARICONS.PIX");
425+
SwitchToRealResolution();
426+
} else {
427+
gIcons_pix_low_res = gIcons_pix;
428+
}
420429
}
421430

422431
// IDA: void __cdecl DisposeNetHeadups()
423432
void DisposeNetHeadups(void) {
424433
LOG_TRACE("()");
425434

435+
/* Windows version does not use gIcons_pix_low_res. */
436+
if (gIcons_pix_low_res != NULL && gIcons_pix_low_res != gIcons_pix) {
437+
BrPixelmapFree(gIcons_pix_low_res);
438+
}
439+
426440
if (gIcons_pix != NULL) {
427441
BrMapRemove(gIcons_pix);
428442
BrPixelmapFree(gIcons_pix);

src/DETHRACE/common/racestrt.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -2561,10 +2561,10 @@ void NetSynchStartDraw(int pCurrent_choice, int pCurrent_mode) {
25612561
DRPixelmapRectangleMaskedCopy(gBack_screen,
25622562
gCurrent_graf_data->start_synch_x_0,
25632563
gCurrent_graf_data->start_synch_top + 1 + gCurrent_graf_data->start_synch_y_pitch * i,
2564-
gIcons_pix,
2564+
gIcons_pix_low_res, /* DOS version uses low res, Windows version uses normal res */
25652565
0,
25662566
gNet_players[i].car_index * gCurrent_graf_data->net_head_icon_height,
2567-
gIcons_pix->width,
2567+
gIcons_pix_low_res->width, /* DOS version uses low res, Windows version uses normal res */
25682568
gCurrent_graf_data->net_head_icon_height);
25692569
TurnOnPaletteConversion();
25702570
DrawAnItem__racestrt(

0 commit comments

Comments
 (0)