Merge branch 'fix-slow-split-crash' into 'master'

Store initial skin configuration for split display

See merge request kart-krew-dev/ring-racers-internal!2734
This commit is contained in:
AJ Martinez 2025-08-13 21:50:23 +00:00
commit 5ec12247ba
2 changed files with 15 additions and 4 deletions

View file

@ -2251,9 +2251,8 @@ void G_SetDemoCheckpointTiming(player_t *player, tic_t time, UINT8 checkpoint)
if (lowest > g->splits[checkpoint])
{
lowest = g->splits[checkpoint];
lowestskin = ((skin_t*)g->mo->skin)->skinnum;
lowestcolor = g->mo->color;
lowestskin = g->initialskin;
lowestcolor = g->initialcolor;
}
}
@ -3389,6 +3388,8 @@ void G_AddGhost(savebuffer_t *buffer, const char *defdemoname)
UINT8 *p;
mapthing_t *mthing;
UINT16 count, ghostversion;
UINT16 initialskin = 0;
UINT16 initialcolor = 0;
skin_t *ghskin = skins[0];
UINT8 worknumskins;
UINT32 num_classes;
@ -3538,7 +3539,11 @@ void G_AddGhost(savebuffer_t *buffer, const char *defdemoname)
// Skin
i = READUINT8(p);
if (i < worknumskins)
{
ghskin = skins[skinlist[i].mapping];
initialskin = skinlist[i].mapping;
}
p++; // lastfakeskin
p++; // team
@ -3630,15 +3635,19 @@ void G_AddGhost(savebuffer_t *buffer, const char *defdemoname)
gh->mo->skin = gh->oldmo.skin = ghskin;
// Set color
gh->mo->color = ((skin_t*)gh->mo->skin)->prefcolor;
gh->mo->color = initialcolor = ((skin_t*)gh->mo->skin)->prefcolor;
for (i = 0; i < numskincolors; i++)
if (!stricmp(skincolors[i].name,color))
{
gh->mo->color = (UINT16)i;
initialcolor = (UINT16)i;
break;
}
gh->oldmo.color = gh->mo->color;
gh->initialskin = initialskin;
gh->initialcolor = initialcolor;
CONS_Printf(M_GetText("Added ghost %s from %s\n"), name, defdemoname);
}

View file

@ -201,6 +201,8 @@ struct DemoBufferSizes
struct demoghost {
UINT8 checksum[16];
UINT8 *buffer, *p, color;
UINT16 initialskin;
UINT16 initialcolor;
UINT8 fadein;
UINT16 version;
UINT8 numskins;