From 2392d3b8afd5f5aad53043f07b383ae729c92a12 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 5 Jul 2023 23:54:20 +0200 Subject: [PATCH 1/3] Re-order LoadPixelmap slightly --- src/DETHRACE/common/loading.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/DETHRACE/common/loading.c b/src/DETHRACE/common/loading.c index 80967ec7..6683e039 100644 --- a/src/DETHRACE/common/loading.c +++ b/src/DETHRACE/common/loading.c @@ -505,18 +505,20 @@ br_pixelmap* LoadPixelmap(char* pName) { end = &pName[strlen(pName)]; } - if ((end - pName) != 4 || memcmp(pName, "none", end - pName) != 0) { - PossibleService(); - PathCat(the_path, gApplication_path, gGraf_specs[gGraf_spec_index].data_dir_name); - PathCat(the_path, the_path, "PIXELMAP"); + if (end - pName == 4 && memcmp(pName, "none", end - pName) == 0) { + return NULL; + } + + PossibleService(); + PathCat(the_path, gApplication_path, gGraf_specs[gGraf_spec_index].data_dir_name); + PathCat(the_path, the_path, "PIXELMAP"); + PathCat(the_path, the_path, pName); + AllowOpenToFail(); + pm = DRPixelmapLoad(the_path); + if (pm == NULL) { + PathCat(the_path, gApplication_path, "PIXELMAP"); PathCat(the_path, the_path, pName); - AllowOpenToFail(); pm = DRPixelmapLoad(the_path); - if (pm == NULL) { - PathCat(the_path, gApplication_path, "PIXELMAP"); - PathCat(the_path, the_path, pName); - pm = DRPixelmapLoad(the_path); - } } return pm; } From e3e2f30d650a57584bc1d1290d389fb4db251109 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 5 Jul 2023 23:54:48 +0200 Subject: [PATCH 2/3] DOS Carmageddon uses gIcons_pix_low_res for the menu's --- src/DETHRACE/common/netgame.c | 13 +++++++++++++ src/DETHRACE/common/racestrt.c | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/DETHRACE/common/netgame.c b/src/DETHRACE/common/netgame.c index 75f51890..ed97f994 100644 --- a/src/DETHRACE/common/netgame.c +++ b/src/DETHRACE/common/netgame.c @@ -5,6 +5,7 @@ #include "errors.h" #include "globvars.h" #include "globvrpb.h" +#include "grafdata.h" #include "graphics.h" #include "harness/trace.h" #include "loading.h" @@ -417,12 +418,24 @@ void InitNetHeadups(void) { if (gDigits_pix != NULL) { BrMapAdd(gDigits_pix); } + /* The Windows version does not use gIcons_pix_low_res. */ + if (gGraf_data_index != 0) { + SwitchToLoresMode(); + gIcons_pix_low_res = LoadPixelmap("CARICONS.PIX"); + SwitchToRealResolution(); + } else { + gIcons_pix_low_res = gIcons_pix; + } } // IDA: void __cdecl DisposeNetHeadups() void DisposeNetHeadups(void) { LOG_TRACE("()"); + if (gIcons_pix_low_res != NULL && gIcons_pix_low_res != gIcons_pix) { + BrPixelmapFree(gIcons_pix_low_res); + } + if (gIcons_pix != NULL) { BrMapRemove(gIcons_pix); BrPixelmapFree(gIcons_pix); diff --git a/src/DETHRACE/common/racestrt.c b/src/DETHRACE/common/racestrt.c index 3ccae3df..970a2901 100644 --- a/src/DETHRACE/common/racestrt.c +++ b/src/DETHRACE/common/racestrt.c @@ -2561,10 +2561,10 @@ void NetSynchStartDraw(int pCurrent_choice, int pCurrent_mode) { DRPixelmapRectangleMaskedCopy(gBack_screen, gCurrent_graf_data->start_synch_x_0, gCurrent_graf_data->start_synch_top + 1 + gCurrent_graf_data->start_synch_y_pitch * i, - gIcons_pix, + gIcons_pix_low_res, /* DOS version uses low res, Windows version uses normal res */ 0, gNet_players[i].car_index * gCurrent_graf_data->net_head_icon_height, - gIcons_pix->width, + gIcons_pix_low_res->width, /* DOS version uses low res, Windows version uses normal res */ gCurrent_graf_data->net_head_icon_height); TurnOnPaletteConversion(); DrawAnItem__racestrt( From f38971dce48c805adf5ba530a86ef994ffb79356 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 6 Jul 2023 01:12:12 +0000 Subject: [PATCH 3/3] Update src/DETHRACE/common/netgame.c --- src/DETHRACE/common/netgame.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/DETHRACE/common/netgame.c b/src/DETHRACE/common/netgame.c index ed97f994..b7c9d5d1 100644 --- a/src/DETHRACE/common/netgame.c +++ b/src/DETHRACE/common/netgame.c @@ -432,6 +432,7 @@ void InitNetHeadups(void) { void DisposeNetHeadups(void) { LOG_TRACE("()"); + /* Windows version does not use gIcons_pix_low_res. */ if (gIcons_pix_low_res != NULL && gIcons_pix_low_res != gIcons_pix) { BrPixelmapFree(gIcons_pix_low_res); }