mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Fix Skin unlocks at the beginning of replays
- DXD_JOINDATA: Actually correctly write demo data - SetPlayerSkinByNum, bot skin iteration code: Use demo skinlist index instead of actual skin ID
This commit is contained in:
parent
e7fed5d7b5
commit
2bfcfeb560
4 changed files with 27 additions and 23 deletions
|
|
@ -317,8 +317,8 @@ void G_ReadDemoExtraData(void)
|
||||||
skinid = READUINT8(demobuf.p);
|
skinid = READUINT8(demobuf.p);
|
||||||
if (skinid >= demo.numskins)
|
if (skinid >= demo.numskins)
|
||||||
skinid = 0;
|
skinid = 0;
|
||||||
SetPlayerSkinByNum(p, demo.skinlist[skinid].mapping);
|
ghostext[p].skinid = demo.currentskinid[p] = skinid;
|
||||||
demo.currentskinid[p] = skinid;
|
SetPlayerSkinByNum(p, skinid);
|
||||||
|
|
||||||
players[p].kartspeed = ghostext[p].kartspeed = demo.skinlist[skinid].kartspeed;
|
players[p].kartspeed = ghostext[p].kartspeed = demo.skinlist[skinid].kartspeed;
|
||||||
players[p].kartweight = ghostext[p].kartweight = demo.skinlist[skinid].kartweight;
|
players[p].kartweight = ghostext[p].kartweight = demo.skinlist[skinid].kartweight;
|
||||||
|
|
@ -424,7 +424,7 @@ void G_WriteDemoExtraData(void)
|
||||||
{
|
{
|
||||||
for (j = 0; j < MAXAVAILABILITY; j++)
|
for (j = 0; j < MAXAVAILABILITY; j++)
|
||||||
{
|
{
|
||||||
WRITEUINT8(demobuf.p, players[i].availabilities[i]);
|
WRITEUINT8(demobuf.p, players[i].availabilities[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITEUINT8(demobuf.p, (UINT8)players[i].bot);
|
WRITEUINT8(demobuf.p, (UINT8)players[i].bot);
|
||||||
|
|
@ -3354,12 +3354,9 @@ void G_DoPlayDemo(const char *defdemoname)
|
||||||
|
|
||||||
// Skin
|
// Skin
|
||||||
|
|
||||||
i = READUINT8(demobuf.p);
|
demo.currentskinid[p] = READUINT8(demobuf.p);
|
||||||
if (i >= demo.numskins)
|
if (demo.currentskinid[p] >= demo.numskins)
|
||||||
i = 0;
|
demo.currentskinid[p] = 0;
|
||||||
SetPlayerSkinByNum(p, demo.skinlist[i].mapping);
|
|
||||||
demo.currentskinid[p] = ghostext[p].skinid = i;
|
|
||||||
|
|
||||||
lastfakeskin[p] = READUINT8(demobuf.p);
|
lastfakeskin[p] = READUINT8(demobuf.p);
|
||||||
|
|
||||||
// Color
|
// Color
|
||||||
|
|
@ -3442,6 +3439,15 @@ void G_DoPlayDemo(const char *defdemoname)
|
||||||
UINT8 j;
|
UINT8 j;
|
||||||
|
|
||||||
p = slots[i];
|
p = slots[i];
|
||||||
|
|
||||||
|
for (j = 0; j < MAXAVAILABILITY; j++)
|
||||||
|
{
|
||||||
|
players[p].availabilities[j] = availabilities[p][j];
|
||||||
|
}
|
||||||
|
|
||||||
|
ghostext[p].skinid = demo.currentskinid[p];
|
||||||
|
SetPlayerSkinByNum(p, demo.currentskinid[p]);
|
||||||
|
|
||||||
if (players[p].mo)
|
if (players[p].mo)
|
||||||
{
|
{
|
||||||
players[p].mo->color = players[p].skincolor;
|
players[p].mo->color = players[p].skincolor;
|
||||||
|
|
@ -3457,11 +3463,6 @@ void G_DoPlayDemo(const char *defdemoname)
|
||||||
players[p].kartweight = ghostext[p].kartweight = demo.skinlist[demo.currentskinid[p]].kartweight;
|
players[p].kartweight = ghostext[p].kartweight = demo.skinlist[demo.currentskinid[p]].kartweight;
|
||||||
players[p].charflags = ghostext[p].charflags = demo.skinlist[demo.currentskinid[p]].flags;
|
players[p].charflags = ghostext[p].charflags = demo.skinlist[demo.currentskinid[p]].flags;
|
||||||
players[p].lastfakeskin = lastfakeskin[p];
|
players[p].lastfakeskin = lastfakeskin[p];
|
||||||
|
|
||||||
for (j = 0; j < MAXAVAILABILITY; j++)
|
|
||||||
{
|
|
||||||
players[p].availabilities[j] = availabilities[p][j];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
demo.deferstart = true;
|
demo.deferstart = true;
|
||||||
|
|
|
||||||
|
|
@ -177,12 +177,12 @@ void K_UpdateMatchRaceBots(void)
|
||||||
UINT8 numbots = 0;
|
UINT8 numbots = 0;
|
||||||
UINT8 numwaiting = 0;
|
UINT8 numwaiting = 0;
|
||||||
SINT8 wantedbots = 0;
|
SINT8 wantedbots = 0;
|
||||||
UINT8 usableskins = 0;
|
UINT8 usableskins = 0, skincount = (demo.playback ? demo.numskins : numskins);;
|
||||||
UINT8 grabskins[MAXSKINS+1];
|
UINT8 grabskins[MAXSKINS+1];
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
|
|
||||||
// Init usable bot skins list
|
// Init usable bot skins list
|
||||||
for (i = 0; i < numskins; i++)
|
for (i = 0; i < skincount; i++)
|
||||||
{
|
{
|
||||||
grabskins[usableskins++] = i;
|
grabskins[usableskins++] = i;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ void K_InitGrandPrixBots(void)
|
||||||
UINT8 numplayers = 0;
|
UINT8 numplayers = 0;
|
||||||
UINT8 competitors[MAXSPLITSCREENPLAYERS];
|
UINT8 competitors[MAXSPLITSCREENPLAYERS];
|
||||||
|
|
||||||
UINT8 usableskins;
|
UINT8 usableskins, skincount = (demo.playback ? demo.numskins : numskins);;
|
||||||
UINT8 grabskins[MAXSKINS+1];
|
UINT8 grabskins[MAXSKINS+1];
|
||||||
|
|
||||||
UINT8 botskinlist[MAXPLAYERS];
|
UINT8 botskinlist[MAXPLAYERS];
|
||||||
|
|
@ -146,7 +146,7 @@ void K_InitGrandPrixBots(void)
|
||||||
memset(botskinlist, defaultbotskin, sizeof (botskinlist));
|
memset(botskinlist, defaultbotskin, sizeof (botskinlist));
|
||||||
|
|
||||||
// Init usable bot skins list
|
// Init usable bot skins list
|
||||||
for (usableskins = 0; usableskins < numskins; usableskins++)
|
for (usableskins = 0; usableskins < skincount; usableskins++)
|
||||||
{
|
{
|
||||||
grabskins[usableskins] = usableskins;
|
grabskins[usableskins] = usableskins;
|
||||||
}
|
}
|
||||||
|
|
@ -671,7 +671,7 @@ void K_RetireBots(void)
|
||||||
const UINT8 defaultbotskin = R_BotDefaultSkin();
|
const UINT8 defaultbotskin = R_BotDefaultSkin();
|
||||||
SINT8 newDifficulty;
|
SINT8 newDifficulty;
|
||||||
|
|
||||||
UINT8 usableskins;
|
UINT8 usableskins, skincount = (demo.playback ? demo.numskins : numskins);
|
||||||
UINT8 grabskins[MAXSKINS+1];
|
UINT8 grabskins[MAXSKINS+1];
|
||||||
|
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
|
|
@ -687,7 +687,7 @@ void K_RetireBots(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init usable bot skins list
|
// Init usable bot skins list
|
||||||
for (usableskins = 0; usableskins < numskins; usableskins++)
|
for (usableskins = 0; usableskins < skincount; usableskins++)
|
||||||
{
|
{
|
||||||
grabskins[usableskins] = usableskins;
|
grabskins[usableskins] = usableskins;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -226,7 +226,7 @@ UINT8 *R_GetSkinAvailabilities(boolean demolock, INT32 botforcecharacter)
|
||||||
boolean R_SkinUsable(INT32 playernum, INT32 skinnum, boolean demoskins)
|
boolean R_SkinUsable(INT32 playernum, INT32 skinnum, boolean demoskins)
|
||||||
{
|
{
|
||||||
boolean needsunlocked = false;
|
boolean needsunlocked = false;
|
||||||
boolean useplayerstruct = (Playing() && playernum != -1);
|
boolean useplayerstruct = ((Playing() || demo.playback) && playernum != -1);
|
||||||
UINT16 i;
|
UINT16 i;
|
||||||
INT32 skinid;
|
INT32 skinid;
|
||||||
|
|
||||||
|
|
@ -357,6 +357,9 @@ engineclass_t R_GetEngineClass(SINT8 speed, SINT8 weight, skinflags_t flags)
|
||||||
// Auxillary function that actually sets the skin
|
// Auxillary function that actually sets the skin
|
||||||
static void SetSkin(player_t *player, INT32 skinnum)
|
static void SetSkin(player_t *player, INT32 skinnum)
|
||||||
{
|
{
|
||||||
|
if (demo.playback)
|
||||||
|
skinnum = demo.skinlist[skinnum].mapping;
|
||||||
|
|
||||||
skin_t *skin = &skins[skinnum];
|
skin_t *skin = &skins[skinnum];
|
||||||
|
|
||||||
player->skin = skinnum;
|
player->skin = skinnum;
|
||||||
|
|
@ -404,9 +407,9 @@ static void SetSkin(player_t *player, INT32 skinnum)
|
||||||
// (If your mod locked them all, then you kinda stupid)
|
// (If your mod locked them all, then you kinda stupid)
|
||||||
static INT32 GetPlayerDefaultSkin(INT32 playernum)
|
static INT32 GetPlayerDefaultSkin(INT32 playernum)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i, skincount = (demo.playback ? demo.numskins : numskins);
|
||||||
|
|
||||||
for (i = 0; i < numskins; i++)
|
for (i = 0; i < skincount; i++)
|
||||||
{
|
{
|
||||||
if (R_SkinUsable(playernum, i, false))
|
if (R_SkinUsable(playernum, i, false))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue