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.
This commit is contained in:
Anonymous Maarten 2023-07-06 03:13:53 +02:00 committed by GitHub
parent 80f1a8876c
commit 36cd6c9f71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 12 deletions

View File

@ -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;
}

View File

@ -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,25 @@ 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("()");
/* 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);
}
if (gIcons_pix != NULL) {
BrMapRemove(gIcons_pix);
BrPixelmapFree(gIcons_pix);

View File

@ -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(