Memory management fixes

Date:      Mon Aug 9 15:57:07 2021 -0300
This commit is contained in:
Jaime Ita Passos 2021-08-09 15:57:07 -03:00
parent f2472d88b8
commit 2aa9bb59ef
32 changed files with 303 additions and 420 deletions

View file

@ -1944,7 +1944,7 @@ static void CV_SetValueMaybeStealth(consvar_t *var, INT32 value, boolean stealth
if ((value < 0) || (value >= numskins)) if ((value < 0) || (value >= numskins))
tmpskin = "None"; tmpskin = "None";
else else
tmpskin = skins[value].name; tmpskin = skins[value]->name;
strncpy(val, tmpskin, SKINNAMESIZE); strncpy(val, tmpskin, SKINNAMESIZE);
} }
else else

View file

@ -1187,9 +1187,9 @@ static void ForceAllSkins(INT32 forcedskin)
if (!dedicated) // But don't do this for dedicated servers, of course. if (!dedicated) // But don't do this for dedicated servers, of course.
{ {
if (i == consoleplayer) if (i == consoleplayer)
CV_StealthSet(&cv_skin, skins[forcedskin].name); CV_StealthSet(&cv_skin, skins[forcedskin]->name);
else if (i == secondarydisplayplayer) else if (i == secondarydisplayplayer)
CV_StealthSet(&cv_skin2, skins[forcedskin].name); CV_StealthSet(&cv_skin2, skins[forcedskin]->name);
} }
} }
} }
@ -1221,8 +1221,8 @@ static void SendNameAndColor(void)
CV_StealthSetValue(&cv_playercolor, players[consoleplayer].skincolor); CV_StealthSetValue(&cv_playercolor, players[consoleplayer].skincolor);
else if (skincolors[atoi(cv_playercolor.defaultvalue)].accessible) else if (skincolors[atoi(cv_playercolor.defaultvalue)].accessible)
CV_StealthSet(&cv_playercolor, cv_playercolor.defaultvalue); CV_StealthSet(&cv_playercolor, cv_playercolor.defaultvalue);
else if (skins[players[consoleplayer].skin].prefcolor && skincolors[skins[players[consoleplayer].skin].prefcolor].accessible) else if (skins[players[consoleplayer].skin]->prefcolor && skincolors[skins[players[consoleplayer].skin]->prefcolor].accessible)
CV_StealthSetValue(&cv_playercolor, skins[players[consoleplayer].skin].prefcolor); CV_StealthSetValue(&cv_playercolor, skins[players[consoleplayer].skin]->prefcolor);
else { else {
UINT16 i = 0; UINT16 i = 0;
while (i<numskincolors && !skincolors[i].accessible) i++; while (i<numskincolors && !skincolors[i].accessible) i++;
@ -1232,7 +1232,7 @@ static void SendNameAndColor(void)
if (!strcmp(cv_playername.string, player_names[consoleplayer]) if (!strcmp(cv_playername.string, player_names[consoleplayer])
&& cv_playercolor.value == players[consoleplayer].skincolor && cv_playercolor.value == players[consoleplayer].skincolor
&& !strcmp(cv_skin.string, skins[players[consoleplayer].skin].name)) && !strcmp(cv_skin.string, skins[players[consoleplayer].skin]->name))
return; return;
players[consoleplayer].availabilities = R_GetSkinAvailabilities(); players[consoleplayer].availabilities = R_GetSkinAvailabilities();
@ -1257,7 +1257,7 @@ static void SendNameAndColor(void)
if (metalrecording) if (metalrecording)
{ // Starring Metal Sonic as themselves, obviously. { // Starring Metal Sonic as themselves, obviously.
SetPlayerSkinByNum(consoleplayer, 5); SetPlayerSkinByNum(consoleplayer, 5);
CV_StealthSet(&cv_skin, skins[5].name); CV_StealthSet(&cv_skin, skins[5]->name);
} }
else if ((foundskin = R_SkinAvailable(cv_skin.string)) != -1 && R_SkinUsable(consoleplayer, foundskin)) else if ((foundskin = R_SkinAvailable(cv_skin.string)) != -1 && R_SkinUsable(consoleplayer, foundskin))
{ {
@ -1268,11 +1268,11 @@ static void SendNameAndColor(void)
//notsame = (cv_skin.value != players[consoleplayer].skin); //notsame = (cv_skin.value != players[consoleplayer].skin);
SetPlayerSkin(consoleplayer, cv_skin.string); SetPlayerSkin(consoleplayer, cv_skin.string);
CV_StealthSet(&cv_skin, skins[cv_skin.value].name); CV_StealthSet(&cv_skin, skins[cv_skin.value]->name);
/*if (notsame) /*if (notsame)
{ {
CV_StealthSetValue(&cv_playercolor, skins[cv_skin.value].prefcolor); CV_StealthSetValue(&cv_playercolor, skins[cv_skin.value]->prefcolor);
players[consoleplayer].skincolor = cv_playercolor.value % numskincolors; players[consoleplayer].skincolor = cv_playercolor.value % numskincolors;
@ -1283,7 +1283,7 @@ static void SendNameAndColor(void)
else else
{ {
cv_skin.value = players[consoleplayer].skin; cv_skin.value = players[consoleplayer].skin;
CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin].name); CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin]->name);
// will always be same as current // will always be same as current
SetPlayerSkin(consoleplayer, cv_skin.string); SetPlayerSkin(consoleplayer, cv_skin.string);
} }
@ -1306,7 +1306,7 @@ static void SendNameAndColor(void)
// Don't change skin if the server doesn't want you to. // Don't change skin if the server doesn't want you to.
if (!CanChangeSkin(consoleplayer)) if (!CanChangeSkin(consoleplayer))
CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin].name); CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin]->name);
// check if player has the skin loaded (cv_skin may have // check if player has the skin loaded (cv_skin may have
// the name of a skin that was available in the previous game) // the name of a skin that was available in the previous game)
@ -1314,7 +1314,7 @@ static void SendNameAndColor(void)
if ((cv_skin.value < 0) || !R_SkinUsable(consoleplayer, cv_skin.value)) if ((cv_skin.value < 0) || !R_SkinUsable(consoleplayer, cv_skin.value))
{ {
INT32 defaultSkinNum = GetPlayerDefaultSkin(consoleplayer); INT32 defaultSkinNum = GetPlayerDefaultSkin(consoleplayer);
CV_StealthSet(&cv_skin, skins[defaultSkinNum].name); CV_StealthSet(&cv_skin, skins[defaultSkinNum]->name);
cv_skin.value = defaultSkinNum; cv_skin.value = defaultSkinNum;
} }
@ -1355,8 +1355,8 @@ static void SendNameAndColor2(void)
CV_StealthSetValue(&cv_playercolor2, players[secondplaya].skincolor); CV_StealthSetValue(&cv_playercolor2, players[secondplaya].skincolor);
else if (skincolors[atoi(cv_playercolor2.defaultvalue)].accessible) else if (skincolors[atoi(cv_playercolor2.defaultvalue)].accessible)
CV_StealthSet(&cv_playercolor, cv_playercolor2.defaultvalue); CV_StealthSet(&cv_playercolor, cv_playercolor2.defaultvalue);
else if (skins[players[secondplaya].skin].prefcolor && skincolors[skins[players[secondplaya].skin].prefcolor].accessible) else if (skins[players[secondplaya].skin]->prefcolor && skincolors[skins[players[secondplaya].skin]->prefcolor].accessible)
CV_StealthSetValue(&cv_playercolor2, skins[players[secondplaya].skin].prefcolor); CV_StealthSetValue(&cv_playercolor2, skins[players[secondplaya].skin]->prefcolor);
else { else {
UINT16 i = 0; UINT16 i = 0;
while (i<numskincolors && !skincolors[i].accessible) i++; while (i<numskincolors && !skincolors[i].accessible) i++;
@ -1397,7 +1397,7 @@ static void SendNameAndColor2(void)
const INT32 forcedskin = cv_forceskin.value; const INT32 forcedskin = cv_forceskin.value;
SetPlayerSkinByNum(secondplaya, forcedskin); SetPlayerSkinByNum(secondplaya, forcedskin);
CV_StealthSet(&cv_skin2, skins[forcedskin].name); CV_StealthSet(&cv_skin2, skins[forcedskin]->name);
} }
else if ((foundskin = R_SkinAvailable(cv_skin2.string)) != -1 && R_SkinUsable(secondplaya, foundskin)) else if ((foundskin = R_SkinAvailable(cv_skin2.string)) != -1 && R_SkinUsable(secondplaya, foundskin))
{ {
@ -1408,11 +1408,11 @@ static void SendNameAndColor2(void)
//notsame = (cv_skin2.value != players[secondplaya].skin); //notsame = (cv_skin2.value != players[secondplaya].skin);
SetPlayerSkin(secondplaya, cv_skin2.string); SetPlayerSkin(secondplaya, cv_skin2.string);
CV_StealthSet(&cv_skin2, skins[cv_skin2.value].name); CV_StealthSet(&cv_skin2, skins[cv_skin2.value]->name);
/*if (notsame) /*if (notsame)
{ {
CV_StealthSetValue(&cv_playercolor2, skins[players[secondplaya].skin].prefcolor); CV_StealthSetValue(&cv_playercolor2, skins[players[secondplaya].skin]->prefcolor);
players[secondplaya].skincolor = cv_playercolor2.value % numskincolors; players[secondplaya].skincolor = cv_playercolor2.value % numskincolors;
@ -1423,7 +1423,7 @@ static void SendNameAndColor2(void)
else else
{ {
cv_skin2.value = players[secondplaya].skin; cv_skin2.value = players[secondplaya].skin;
CV_StealthSet(&cv_skin2, skins[players[secondplaya].skin].name); CV_StealthSet(&cv_skin2, skins[players[secondplaya].skin]->name);
// will always be same as current // will always be same as current
SetPlayerSkin(secondplaya, cv_skin2.string); SetPlayerSkin(secondplaya, cv_skin2.string);
} }
@ -1534,9 +1534,9 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
SetPlayerSkinByNum(playernum, forcedskin); SetPlayerSkinByNum(playernum, forcedskin);
if (playernum == consoleplayer) if (playernum == consoleplayer)
CV_StealthSet(&cv_skin, skins[forcedskin].name); CV_StealthSet(&cv_skin, skins[forcedskin]->name);
else if (playernum == secondarydisplayplayer) else if (playernum == secondarydisplayplayer)
CV_StealthSet(&cv_skin2, skins[forcedskin].name); CV_StealthSet(&cv_skin2, skins[forcedskin]->name);
} }
else else
SetPlayerSkinByNum(playernum, skin); SetPlayerSkinByNum(playernum, skin);
@ -2112,7 +2112,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
if (modeattacking) if (modeattacking)
{ {
SetPlayerSkinByNum(0, cv_chooseskin.value-1); SetPlayerSkinByNum(0, cv_chooseskin.value-1);
players[0].skincolor = skins[players[0].skin].prefcolor; players[0].skincolor = skins[players[0].skin]->prefcolor;
CV_StealthSetValue(&cv_playercolor, players[0].skincolor); CV_StealthSetValue(&cv_playercolor, players[0].skincolor);
} }
@ -4467,7 +4467,7 @@ static void ForceSkin_OnChange(void)
CONS_Printf("The server has lifted the forced skin restrictions.\n"); CONS_Printf("The server has lifted the forced skin restrictions.\n");
else else
{ {
CONS_Printf("The server is restricting all players to skin \"%s\".\n",skins[cv_forceskin.value].name); CONS_Printf("The server is restricting all players to skin \"%s\".\n",skins[cv_forceskin.value]->name);
ForceAllSkins(cv_forceskin.value); ForceAllSkins(cv_forceskin.value);
} }
} }
@ -4508,7 +4508,7 @@ static void Skin_OnChange(void)
if (!(cv_debug || devparm) && !(multiplayer || netgame) // In single player. if (!(cv_debug || devparm) && !(multiplayer || netgame) // In single player.
&& (gamestate != GS_WAITINGPLAYERS)) // allows command line -warp x +skin y && (gamestate != GS_WAITINGPLAYERS)) // allows command line -warp x +skin y
{ {
CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin].name); CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin]->name);
return; return;
} }
@ -4517,7 +4517,7 @@ static void Skin_OnChange(void)
else else
{ {
CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n")); CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n"));
CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin].name); CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin]->name);
} }
} }
@ -4536,7 +4536,7 @@ static void Skin2_OnChange(void)
else else
{ {
CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n")); CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n"));
CV_StealthSet(&cv_skin2, skins[players[secondarydisplayplayer].skin].name); CV_StealthSet(&cv_skin2, skins[players[secondarydisplayplayer].skin]->name);
} }
} }
@ -4554,7 +4554,7 @@ static void Color_OnChange(void)
{ {
if (!(cv_debug || devparm) && !(multiplayer || netgame)) // In single player. if (!(cv_debug || devparm) && !(multiplayer || netgame)) // In single player.
{ {
CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin].name); CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin]->name);
return; return;
} }

View file

@ -1055,7 +1055,7 @@ void readspriteinfo(MYFILE *f, INT32 num, boolean sprite2)
for (i = 0; i < foundskins; i++) for (i = 0; i < foundskins; i++)
{ {
size_t skinnum = skinnumbers[i]; size_t skinnum = skinnumbers[i];
skin_t *skin = &skins[skinnum]; skin_t *skin = skins[skinnum];
spriteinfo_t *sprinfo = skin->sprinfo; spriteinfo_t *sprinfo = skin->sprinfo;
M_Memcpy(&sprinfo[num], info, sizeof(spriteinfo_t)); M_Memcpy(&sprinfo[num], info, sizeof(spriteinfo_t));
} }

View file

@ -1624,9 +1624,9 @@ void F_GameEvaluationDrawer(void)
rtatext = (marathonmode & MA_INGAME) ? "In-game timer" : "RTA timer"; rtatext = (marathonmode & MA_INGAME) ? "In-game timer" : "RTA timer";
cuttext = (marathonmode & MA_NOCUTSCENES) ? "" : " w/ cutscenes"; cuttext = (marathonmode & MA_NOCUTSCENES) ? "" : " w/ cutscenes";
if (botskin) if (botskin)
endingtext = va("%s & %s, %s%s", skins[players[consoleplayer].skin].realname, skins[botskin-1].realname, rtatext, cuttext); endingtext = va("%s & %s, %s%s", skins[players[consoleplayer].skin]->realname, skins[botskin-1]->realname, rtatext, cuttext);
else else
endingtext = va("%s, %s%s", skins[players[consoleplayer].skin].realname, rtatext, cuttext); endingtext = va("%s, %s%s", skins[players[consoleplayer].skin]->realname, rtatext, cuttext);
V_DrawCenteredString(BASEVIDWIDTH/2, 182, V_SNAPTOBOTTOM|(ultimatemode ? V_REDMAP : V_YELLOWMAP), endingtext); V_DrawCenteredString(BASEVIDWIDTH/2, 182, V_SNAPTOBOTTOM|(ultimatemode ? V_REDMAP : V_YELLOWMAP), endingtext);
} }
} }
@ -1748,9 +1748,9 @@ static void F_CacheEnding(void)
UINT8 skinnum = players[consoleplayer].skin; UINT8 skinnum = players[consoleplayer].skin;
spritedef_t *sprdef; spritedef_t *sprdef;
spriteframe_t *sprframe; spriteframe_t *sprframe;
if (skins[skinnum].sprites[SPR2_XTRA].numframes > (XTRA_ENDING+2)) if (skins[skinnum]->sprites[SPR2_XTRA].numframes > (XTRA_ENDING+2))
{ {
sprdef = &skins[skinnum].sprites[SPR2_XTRA]; sprdef = &skins[skinnum]->sprites[SPR2_XTRA];
// character head, skin specific // character head, skin specific
sprframe = &sprdef->spriteframes[XTRA_ENDING]; sprframe = &sprdef->spriteframes[XTRA_ENDING];
endfwrk[0] = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH_LOWPRIORITY); endfwrk[0] = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH_LOWPRIORITY);
@ -2196,7 +2196,7 @@ void F_EndingDrawer(void)
boolean donttouch = false; boolean donttouch = false;
const char *str; const char *str;
if (goodending) if (goodending)
str = va("[S] %s: Engage.", skins[players[consoleplayer].skin].realname); str = va("[S] %s: Engage.", skins[players[consoleplayer].skin]->realname);
else else
str = "[S] Eggman: Abscond."; str = "[S] Eggman: Abscond.";
@ -3576,7 +3576,7 @@ void F_StartContinue(void)
S_ChangeMusicInternal("_conti", false); S_ChangeMusicInternal("_conti", false);
S_StopSounds(); S_StopSounds();
contskins[0] = &skins[players[consoleplayer].skin]; contskins[0] = skins[players[consoleplayer].skin];
cont_spr2[0][0] = P_GetSkinSprite2(contskins[0], SPR2_CNT1, NULL); cont_spr2[0][0] = P_GetSkinSprite2(contskins[0], SPR2_CNT1, NULL);
cont_spr2[0][2] = contskins[0]->contangle & 7; cont_spr2[0][2] = contskins[0]->contangle & 7;
contcolormaps[0] = R_GetTranslationColormap(players[consoleplayer].skin, players[consoleplayer].skincolor, GTC_CACHE); contcolormaps[0] = R_GetTranslationColormap(players[consoleplayer].skin, players[consoleplayer].skincolor, GTC_CACHE);
@ -3592,7 +3592,7 @@ void F_StartContinue(void)
else // HACK else // HACK
secondplaya = 1; secondplaya = 1;
contskins[1] = &skins[players[secondplaya].skin]; contskins[1] = skins[players[secondplaya].skin];
cont_spr2[1][0] = P_GetSkinSprite2(contskins[1], SPR2_CNT4, NULL); cont_spr2[1][0] = P_GetSkinSprite2(contskins[1], SPR2_CNT4, NULL);
cont_spr2[1][2] = (contskins[1]->contangle >> 3) & 7; cont_spr2[1][2] = (contskins[1]->contangle >> 3) & 7;
contcolormaps[1] = R_GetTranslationColormap(players[secondplaya].skin, players[secondplaya].skincolor, GTC_CACHE); contcolormaps[1] = R_GetTranslationColormap(players[secondplaya].skin, players[secondplaya].skincolor, GTC_CACHE);

View file

@ -488,7 +488,7 @@ void G_WriteGhostTic(mobj_t *ghost)
if (ghost->player->followmobj->colorized) if (ghost->player->followmobj->colorized)
followtic |= FZT_COLORIZED; followtic |= FZT_COLORIZED;
if (followtic & FZT_SKIN) if (followtic & FZT_SKIN)
WRITEUINT8(demo_p,(UINT8)(((skin_t *)(ghost->player->followmobj->skin))-skins)); WRITEUINT8(demo_p,(UINT8)(((skin_t *)ghost->player->followmobj->skin)->skinnum));
oldghost.flags2 |= MF2_AMBUSH; oldghost.flags2 |= MF2_AMBUSH;
} }
@ -757,7 +757,7 @@ void G_GhostTicker(void)
g->mo->color = SKINCOLOR_WHITE; g->mo->color = SKINCOLOR_WHITE;
break; break;
case GHC_NIGHTSSKIN: // not actually a colour case GHC_NIGHTSSKIN: // not actually a colour
g->mo->skin = &skins[DEFAULTNIGHTSSKIN]; g->mo->skin = skins[DEFAULTNIGHTSSKIN];
break; break;
} }
} }
@ -900,7 +900,7 @@ void G_GhostTicker(void)
follow->colorized = true; follow->colorized = true;
if (followtic & FZT_SKIN) if (followtic & FZT_SKIN)
follow->skin = &skins[READUINT8(g->p)]; follow->skin = skins[READUINT8(g->p)];
} }
if (follow) if (follow)
{ {
@ -1144,7 +1144,7 @@ void G_ReadMetalTic(mobj_t *metal)
follow->colorized = true; follow->colorized = true;
if (followtic & FZT_SKIN) if (followtic & FZT_SKIN)
follow->skin = &skins[READUINT8(metal_p)]; follow->skin = skins[READUINT8(metal_p)];
} }
if (follow) if (follow)
{ {
@ -1329,7 +1329,7 @@ void G_WriteMetalTic(mobj_t *metal)
if (metal->player->followmobj->colorized) if (metal->player->followmobj->colorized)
followtic |= FZT_COLORIZED; followtic |= FZT_COLORIZED;
if (followtic & FZT_SKIN) if (followtic & FZT_SKIN)
WRITEUINT8(demo_p,(UINT8)(((skin_t *)(metal->player->followmobj->skin))-skins)); WRITEUINT8(demo_p,(UINT8)(((skin_t *)metal->player->followmobj->skin)->skinnum));
oldmetal.flags2 |= MF2_AMBUSH; oldmetal.flags2 |= MF2_AMBUSH;
} }
@ -1976,7 +1976,7 @@ void G_DoPlayDemo(char *defdemoname)
G_InitNew(false, G_BuildMapName(gamemap), true, true, false); G_InitNew(false, G_BuildMapName(gamemap), true, true, false);
// Set color // Set color
players[0].skincolor = skins[players[0].skin].prefcolor; players[0].skincolor = skins[players[0].skin]->prefcolor;
for (i = 0; i < numskincolors; i++) for (i = 0; i < numskincolors; i++)
if (!stricmp(skincolors[i].name,color)) if (!stricmp(skincolors[i].name,color))
{ {
@ -2221,11 +2221,11 @@ void G_AddGhost(char *defdemoname)
gh->oldmo.z = gh->mo->z; gh->oldmo.z = gh->mo->z;
// Set skin // Set skin
gh->mo->skin = &skins[0]; gh->mo->skin = skins[0];
for (i = 0; i < numskins; i++) for (i = 0; i < numskins; i++)
if (!stricmp(skins[i].name,skin)) if (!stricmp(skins[i]->name,skin))
{ {
gh->mo->skin = &skins[i]; gh->mo->skin = skins[i];
break; break;
} }
gh->oldmo.skin = gh->mo->skin; gh->oldmo.skin = gh->mo->skin;

View file

@ -582,14 +582,14 @@ static void G_UpdateRecordReplays(void)
I_Error("Out of memory for replay filepath\n"); I_Error("Out of memory for replay filepath\n");
sprintf(gpath,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(gamemap)); sprintf(gpath,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(gamemap));
snprintf(lastdemo, 255, "%s-%s-last.lmp", gpath, skins[cv_chooseskin.value-1].name); snprintf(lastdemo, 255, "%s-%s-last.lmp", gpath, skins[cv_chooseskin.value-1]->name);
if (FIL_FileExists(lastdemo)) if (FIL_FileExists(lastdemo))
{ {
UINT8 *buf; UINT8 *buf;
size_t len = FIL_ReadFile(lastdemo, &buf); size_t len = FIL_ReadFile(lastdemo, &buf);
snprintf(bestdemo, 255, "%s-%s-time-best.lmp", gpath, skins[cv_chooseskin.value-1].name); snprintf(bestdemo, 255, "%s-%s-time-best.lmp", gpath, skins[cv_chooseskin.value-1]->name);
if (!FIL_FileExists(bestdemo) || G_CmpDemoTime(bestdemo, lastdemo) & 1) if (!FIL_FileExists(bestdemo) || G_CmpDemoTime(bestdemo, lastdemo) & 1)
{ // Better time, save this demo. { // Better time, save this demo.
if (FIL_FileExists(bestdemo)) if (FIL_FileExists(bestdemo))
@ -598,7 +598,7 @@ static void G_UpdateRecordReplays(void)
CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW RECORD TIME!"), M_GetText("Saved replay as"), bestdemo); CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW RECORD TIME!"), M_GetText("Saved replay as"), bestdemo);
} }
snprintf(bestdemo, 255, "%s-%s-score-best.lmp", gpath, skins[cv_chooseskin.value-1].name); snprintf(bestdemo, 255, "%s-%s-score-best.lmp", gpath, skins[cv_chooseskin.value-1]->name);
if (!FIL_FileExists(bestdemo) || (G_CmpDemoTime(bestdemo, lastdemo) & (1<<1))) if (!FIL_FileExists(bestdemo) || (G_CmpDemoTime(bestdemo, lastdemo) & (1<<1)))
{ // Better score, save this demo. { // Better score, save this demo.
if (FIL_FileExists(bestdemo)) if (FIL_FileExists(bestdemo))
@ -607,7 +607,7 @@ static void G_UpdateRecordReplays(void)
CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW HIGH SCORE!"), M_GetText("Saved replay as"), bestdemo); CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW HIGH SCORE!"), M_GetText("Saved replay as"), bestdemo);
} }
snprintf(bestdemo, 255, "%s-%s-rings-best.lmp", gpath, skins[cv_chooseskin.value-1].name); snprintf(bestdemo, 255, "%s-%s-rings-best.lmp", gpath, skins[cv_chooseskin.value-1]->name);
if (!FIL_FileExists(bestdemo) || (G_CmpDemoTime(bestdemo, lastdemo) & (1<<2))) if (!FIL_FileExists(bestdemo) || (G_CmpDemoTime(bestdemo, lastdemo) & (1<<2)))
{ // Better rings, save this demo. { // Better rings, save this demo.
if (FIL_FileExists(bestdemo)) if (FIL_FileExists(bestdemo))
@ -704,14 +704,14 @@ void G_SetNightsRecords(void)
I_Error("Out of memory for replay filepath\n"); I_Error("Out of memory for replay filepath\n");
sprintf(gpath,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(gamemap)); sprintf(gpath,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(gamemap));
snprintf(lastdemo, 255, "%s-%s-last.lmp", gpath, skins[cv_chooseskin.value-1].name); snprintf(lastdemo, 255, "%s-%s-last.lmp", gpath, skins[cv_chooseskin.value-1]->name);
if (FIL_FileExists(lastdemo)) if (FIL_FileExists(lastdemo))
{ {
UINT8 *buf; UINT8 *buf;
size_t len = FIL_ReadFile(lastdemo, &buf); size_t len = FIL_ReadFile(lastdemo, &buf);
snprintf(bestdemo, 255, "%s-%s-time-best.lmp", gpath, skins[cv_chooseskin.value-1].name);; snprintf(bestdemo, 255, "%s-%s-time-best.lmp", gpath, skins[cv_chooseskin.value-1]->name);;
if (!FIL_FileExists(bestdemo) || G_CmpDemoTime(bestdemo, lastdemo) & 1) if (!FIL_FileExists(bestdemo) || G_CmpDemoTime(bestdemo, lastdemo) & 1)
{ // Better time, save this demo. { // Better time, save this demo.
if (FIL_FileExists(bestdemo)) if (FIL_FileExists(bestdemo))
@ -720,7 +720,7 @@ void G_SetNightsRecords(void)
CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW RECORD TIME!"), M_GetText("Saved replay as"), bestdemo); CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW RECORD TIME!"), M_GetText("Saved replay as"), bestdemo);
} }
snprintf(bestdemo, 255, "%s-%s-score-best.lmp", gpath, skins[cv_chooseskin.value-1].name); snprintf(bestdemo, 255, "%s-%s-score-best.lmp", gpath, skins[cv_chooseskin.value-1]->name);
if (!FIL_FileExists(bestdemo) || (G_CmpDemoTime(bestdemo, lastdemo) & (1<<1))) if (!FIL_FileExists(bestdemo) || (G_CmpDemoTime(bestdemo, lastdemo) & (1<<1)))
{ // Better score, save this demo. { // Better score, save this demo.
if (FIL_FileExists(bestdemo)) if (FIL_FileExists(bestdemo))
@ -4733,7 +4733,7 @@ cleanup:
// //
void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, boolean SSSG, boolean FLS) void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, boolean SSSG, boolean FLS)
{ {
UINT16 color = skins[pickedchar].prefcolor; UINT16 color = skins[pickedchar]->prefcolor;
paused = false; paused = false;
if (demoplayback) if (demoplayback)
@ -4746,7 +4746,7 @@ void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, b
if (savedata.lives > 0) if (savedata.lives > 0)
{ {
if ((botingame = ((botskin = savedata.botskin) != 0))) if ((botingame = ((botskin = savedata.botskin) != 0)))
botcolor = skins[botskin-1].prefcolor; botcolor = skins[botskin-1]->prefcolor;
} }
else if (splitscreen != SSSG) else if (splitscreen != SSSG)
{ {
@ -4754,9 +4754,9 @@ void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, b
SplitScreen_OnChange(); SplitScreen_OnChange();
} }
color = skins[pickedchar].prefcolor; color = skins[pickedchar]->prefcolor;
SetPlayerSkinByNum(consoleplayer, pickedchar); SetPlayerSkinByNum(consoleplayer, pickedchar);
CV_StealthSet(&cv_skin, skins[pickedchar].name); CV_StealthSet(&cv_skin, skins[pickedchar]->name);
CV_StealthSetValue(&cv_playercolor, color); CV_StealthSetValue(&cv_playercolor, color);
if (mapname) if (mapname)

View file

@ -4870,7 +4870,7 @@ static void HWR_DrawSprites(void)
if (spr->mobj && spr->mobj->skin && spr->mobj->sprite == SPR_PLAY) if (spr->mobj && spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
{ {
if (!cv_glmodels.value || md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound || md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale < 0.0f) if (!cv_glmodels.value || !md2_playermodels[((skin_t*)spr->mobj->skin)->skinnum].found || md2_playermodels[((skin_t*)spr->mobj->skin)->skinnum].scale < 0.0f)
HWR_DrawSprite(spr); HWR_DrawSprite(spr);
else else
{ {
@ -4880,7 +4880,7 @@ static void HWR_DrawSprites(void)
} }
else else
{ {
if (!cv_glmodels.value || md2_models[spr->mobj->sprite].notfound || md2_models[spr->mobj->sprite].scale < 0.0f) if (!cv_glmodels.value || !md2_models[spr->mobj->sprite].found || md2_models[spr->mobj->sprite].scale < 0.0f)
HWR_DrawSprite(spr); HWR_DrawSprite(spr);
else else
{ {
@ -5029,11 +5029,11 @@ static void HWR_ProjectSprite(mobj_t *thing)
if (cv_glmodels.value) //Yellow: Only MD2's dont disappear if (cv_glmodels.value) //Yellow: Only MD2's dont disappear
{ {
if (thing->skin && thing->sprite == SPR_PLAY) if (thing->skin && thing->sprite == SPR_PLAY)
md2 = &md2_playermodels[( (skin_t *)thing->skin - skins )]; md2 = &md2_playermodels[((skin_t *)thing->skin)->skinnum];
else else
md2 = &md2_models[thing->sprite]; md2 = &md2_models[thing->sprite];
if (md2->notfound || md2->scale < 0.0f) if (!md2->found || md2->scale < 0.0f)
return; return;
} }
else else
@ -5359,8 +5359,8 @@ static void HWR_ProjectSprite(mobj_t *thing)
} }
else if (thing->skin && thing->sprite == SPR_PLAY) // This thing is a player! else if (thing->skin && thing->sprite == SPR_PLAY) // This thing is a player!
{ {
size_t skinnum = (skin_t*)thing->skin-skins; INT32 skinnum = ((skin_t*)thing->skin)->skinnum;
vis->colormap = R_GetTranslationColormap((INT32)skinnum, thing->color, GTC_CACHE); vis->colormap = R_GetTranslationColormap(skinnum, thing->color, GTC_CACHE);
} }
else else
vis->colormap = R_GetTranslationColormap(TC_DEFAULT, vis->mobj->color ? vis->mobj->color : SKINCOLOR_CYAN, GTC_CACHE); vis->colormap = R_GetTranslationColormap(TC_DEFAULT, vis->mobj->color ? vis->mobj->color : SKINCOLOR_CYAN, GTC_CACHE);

View file

@ -34,6 +34,7 @@
#include "../m_misc.h" #include "../m_misc.h"
#include "../w_wad.h" #include "../w_wad.h"
#include "../z_zone.h" #include "../z_zone.h"
#include "../r_state.h"
#include "../r_things.h" #include "../r_things.h"
#include "../r_draw.h" #include "../r_draw.h"
#include "../p_tick.h" #include "../p_tick.h"
@ -72,6 +73,7 @@
md2_t md2_models[NUMSPRITES]; md2_t md2_models[NUMSPRITES];
md2_t *md2_playermodels = NULL; md2_t *md2_playermodels = NULL;
size_t md2_numplayermodels = 0;
/* /*
@ -483,28 +485,6 @@ static boolean nomd2s = false;
void HWR_InitModels(void) void HWR_InitModels(void)
{ {
size_t i; size_t i;
INT32 s;
FILE *f;
char name[24], filename[32];
float scale, offset;
size_t prefixlen;
CONS_Printf("HWR_InitModels()...\n");
if (numskins && md2_playermodels == NULL)
md2_playermodels = Z_Malloc(sizeof(md2_t) * numskins, PU_STATIC, NULL);
for (s = 0; s < numskins; s++)
{
md2_playermodels[s].scale = -1.0f;
md2_playermodels[s].model = NULL;
md2_playermodels[s].grpatch = NULL;
md2_playermodels[s].notexturefile = false;
md2_playermodels[s].noblendfile = false;
md2_playermodels[s].skin = -1;
md2_playermodels[s].notfound = true;
md2_playermodels[s].error = false;
}
for (i = 0; i < NUMSPRITES; i++) for (i = 0; i < NUMSPRITES; i++)
{ {
@ -513,82 +493,23 @@ void HWR_InitModels(void)
md2_models[i].grpatch = NULL; md2_models[i].grpatch = NULL;
md2_models[i].notexturefile = false; md2_models[i].notexturefile = false;
md2_models[i].noblendfile = false; md2_models[i].noblendfile = false;
md2_models[i].skin = -1; md2_models[i].found = false;
md2_models[i].notfound = true;
md2_models[i].error = false; md2_models[i].error = false;
} }
// read the models.dat file if (numsprites && numskins)
//Filename checking fixed ~Monster Iestyn and Golden HWR_LoadModels();
f = fopen(va("%s"PATHSEP"%s", srb2home, "models.dat"), "rt");
if (!f)
{
f = fopen(va("%s"PATHSEP"%s", srb2path, "models.dat"), "rt");
if (!f)
{
CONS_Printf("%s %s\n", M_GetText("Error while loading models.dat:"), strerror(errno));
nomd2s = true;
return;
}
}
// length of the player model prefix
prefixlen = strlen(PLAYERMODELPREFIX);
while (fscanf(f, "%25s %31s %f %f", name, filename, &scale, &offset) == 4)
{
char *skinname = name;
size_t len = strlen(name);
// check for the player model prefix.
if (!strnicmp(name, PLAYERMODELPREFIX, prefixlen) && (len > prefixlen))
{
skinname += prefixlen;
goto addskinmodel;
}
// add sprite model
if (len == 4) // must be 4 characters long exactly. otherwise it's not a sprite name.
{
for (i = 0; i < NUMSPRITES; i++)
{
if (stricmp(name, sprnames[i]) == 0)
{
md2_models[i].scale = scale;
md2_models[i].offset = offset;
md2_models[i].notfound = false;
strcpy(md2_models[i].filename, filename);
goto modelfound;
}
}
}
addskinmodel:
// add player model
for (s = 0; s < numskins; s++)
{
if (stricmp(skinname, skins[s].name) == 0)
{
md2_playermodels[s].skin = s;
md2_playermodels[s].scale = scale;
md2_playermodels[s].offset = offset;
md2_playermodels[s].notfound = false;
strcpy(md2_playermodels[s].filename, filename);
goto modelfound;
}
}
modelfound:
// move on to next line...
continue;
}
fclose(f);
} }
void HWR_AddPlayerModel(INT32 skin) // For skins that were added after startup void HWR_LoadModels(void)
{ {
size_t i;
INT32 s;
FILE *f; FILE *f;
// name[24] is used to check for names in the models.dat file that match with sprites or player skins
// sprite names are always 4 characters long, and names is for player skins can be up to 19 characters long
// PLAYERMODELPREFIX is 6 characters long
char name[24], filename[32]; char name[24], filename[32];
float scale, offset; float scale, offset;
size_t prefixlen; size_t prefixlen;
@ -596,7 +517,23 @@ void HWR_AddPlayerModel(INT32 skin) // For skins that were added after startup
if (nomd2s) if (nomd2s)
return; return;
//CONS_Printf("HWR_AddPlayerModel()...\n"); // realloc player models table
if (numskins != (INT32)md2_numplayermodels)
{
md2_numplayermodels = (size_t)numskins;
md2_playermodels = Z_Realloc(md2_playermodels, sizeof(md2_t) * md2_numplayermodels, PU_STATIC, NULL);
for (s = 0; s < numskins; s++)
{
md2_playermodels[s].scale = -1.0f;
md2_playermodels[s].model = NULL;
md2_playermodels[s].grpatch = NULL;
md2_playermodels[s].notexturefile = false;
md2_playermodels[s].noblendfile = false;
md2_playermodels[s].found = false;
md2_playermodels[s].error = false;
}
}
// read the models.dat file // read the models.dat file
//Filename checking fixed ~Monster Iestyn and Golden //Filename checking fixed ~Monster Iestyn and Golden
@ -613,92 +550,57 @@ void HWR_AddPlayerModel(INT32 skin) // For skins that were added after startup
} }
} }
// realloc player models table
md2_playermodels = Z_Realloc(md2_playermodels, sizeof(md2_t) * numskins, PU_STATIC, NULL);
// length of the player model prefix // length of the player model prefix
prefixlen = strlen(PLAYERMODELPREFIX); prefixlen = strlen(PLAYERMODELPREFIX);
// Check for any models that match the names of player skins!
while (fscanf(f, "%25s %31s %f %f", name, filename, &scale, &offset) == 4) while (fscanf(f, "%25s %31s %f %f", name, filename, &scale, &offset) == 4)
{ {
char *skinname = name; char *skinname = name;
size_t len = strlen(name); size_t len = strlen(name);
// ignore the player model prefix. // Check for the player model prefix.
if (!strnicmp(name, PLAYERMODELPREFIX, prefixlen) && (len > prefixlen)) if (!strnicmp(name, PLAYERMODELPREFIX, prefixlen) && (len > prefixlen))
{
skinname += prefixlen; skinname += prefixlen;
goto addskinmodel;
}
if (stricmp(skinname, skins[skin].name) == 0) // Add sprite models.
// Must be 4 characters long exactly. Otherwise, it's not a sprite name.
if (len == 4)
{ {
md2_playermodels[skin].skin = skin; for (i = 0; i < numsprites; i++)
md2_playermodels[skin].scale = scale; {
md2_playermodels[skin].offset = offset; if (stricmp(name, sprnames[i]) == 0)
md2_playermodels[skin].notfound = false; {
strcpy(md2_playermodels[skin].filename, filename); md2_models[i].scale = scale;
goto playermodelfound; md2_models[i].offset = offset;
md2_models[i].found = true;
strcpy(md2_models[i].filename, filename);
goto modelfound;
}
} }
} }
md2_playermodels[skin].notfound = true; addskinmodel:
playermodelfound: // Add player models.
fclose(f); for (s = 0; s < numskins; s++)
}
void HWR_AddSpriteModel(size_t spritenum) // For sprites that were added after startup
{
FILE *f;
// name[24] is used to check for names in the models.dat file that match with sprites or player skins
// sprite names are always 4 characters long, and names is for player skins can be up to 19 characters long
// PLAYERMODELPREFIX is 6 characters long
char name[24], filename[32];
float scale, offset;
if (nomd2s)
return;
if (spritenum == SPR_PLAY) // Handled already NEWMD2: Per sprite, per-skin check
return;
// Read the models.dat file
//Filename checking fixed ~Monster Iestyn and Golden
f = fopen(va("%s"PATHSEP"%s", srb2home, "models.dat"), "rt");
if (!f)
{ {
f = fopen(va("%s"PATHSEP"%s", srb2path, "models.dat"), "rt"); if (stricmp(skinname, skins[s]->name) == 0)
if (!f)
{ {
CONS_Printf("%s %s\n", M_GetText("Error while loading models.dat:"), strerror(errno)); md2_playermodels[s].scale = scale;
nomd2s = true; md2_playermodels[s].offset = offset;
return; md2_playermodels[s].found = true;
strcpy(md2_playermodels[s].filename, filename);
goto modelfound;
} }
} }
// Check for any models that match the names of sprite names! modelfound:
while (fscanf(f, "%25s %31s %f %f", name, filename, &scale, &offset) == 4) // Move on to the next line...
{
// length of the sprite name
size_t len = strlen(name);
if (len != 4) // must be 4 characters long exactly. otherwise it's not a sprite name.
continue; continue;
// check for the player model prefix.
if (!strnicmp(name, PLAYERMODELPREFIX, strlen(PLAYERMODELPREFIX)))
continue; // that's not a sprite...
if (stricmp(name, sprnames[spritenum]) == 0)
{
md2_models[spritenum].scale = scale;
md2_models[spritenum].offset = offset;
md2_models[spritenum].notfound = false;
strcpy(md2_models[spritenum].filename, filename);
goto spritemodelfound;
}
} }
md2_models[spritenum].notfound = true;
spritemodelfound:
fclose(f); fclose(f);
} }
@ -1369,8 +1271,8 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
// 2. draw model with correct position, rotation,... // 2. draw model with correct position, rotation,...
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY) // Use the player MD2 list if the mobj has a skin and is using the player sprites if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY) // Use the player MD2 list if the mobj has a skin and is using the player sprites
{ {
md2 = &md2_playermodels[(skin_t*)spr->mobj->skin-skins]; INT32 skinnum = ((skin_t*)spr->mobj->skin)->skinnum;
md2->skin = (skin_t*)spr->mobj->skin-skins; md2 = &md2_playermodels[skinnum];
sprinfo = &((skin_t *)spr->mobj->skin)->sprinfo[spr->mobj->sprite2]; sprinfo = &((skin_t *)spr->mobj->skin)->sprinfo[spr->mobj->sprite2];
} }
else else
@ -1468,7 +1370,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
skinnum = TC_RAINBOW; skinnum = TC_RAINBOW;
} }
else if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY) else if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
skinnum = (INT32)((skin_t*)spr->mobj->skin-skins); skinnum = ((skin_t*)spr->mobj->skin)->skinnum;
else else
skinnum = TC_DEFAULT; skinnum = TC_DEFAULT;
} }

View file

@ -31,17 +31,17 @@ typedef struct
boolean notexturefile; // true if texture file was not found boolean notexturefile; // true if texture file was not found
void *blendgrpatch; void *blendgrpatch;
boolean noblendfile; // true if blend texture file was not found boolean noblendfile; // true if blend texture file was not found
boolean notfound; boolean found;
INT32 skin;
boolean error; boolean error;
} md2_t; } md2_t;
extern md2_t md2_models[NUMSPRITES]; extern md2_t md2_models[NUMSPRITES];
extern md2_t *md2_playermodels; extern md2_t *md2_playermodels;
extern size_t md2_numplayermodels;
void HWR_InitModels(void); void HWR_InitModels(void);
void HWR_AddPlayerModel(INT32 skin); void HWR_LoadModels(void);
void HWR_AddSpriteModel(size_t spritenum);
boolean HWR_DrawModel(gl_vissprite_t *spr); boolean HWR_DrawModel(gl_vissprite_t *spr);
#define PLAYERMODELPREFIX "PLAYER" #define PLAYERMODELPREFIX "PLAYER"

View file

@ -328,8 +328,8 @@ model_t *MD2_LoadModel(const char *fileName, int ztag, boolean useFloat)
texcoords = (md2texcoord_t*)&buffer[header->offsetST]; texcoords = (md2texcoord_t*)&buffer[header->offsetST];
frames = (md2frame_t*)&buffer[header->offsetFrames]; frames = (md2frame_t*)&buffer[header->offsetFrames];
retModel->framenames = (char*)Z_Calloc(header->numFrames*16, ztag, 0); retModel->frameNames = (char*)Z_Calloc(header->numFrames*16, ztag, 0);
fname = retModel->framenames; fname = retModel->frameNames;
for (i = 0; i < header->numFrames; i++) for (i = 0; i < header->numFrames; i++)
{ {
md2frame_t *fr = (md2frame_t*)&buffer[header->offsetFrames + foffset]; md2frame_t *fr = (md2frame_t*)&buffer[header->offsetFrames + foffset];

View file

@ -230,8 +230,8 @@ model_t *MD3_LoadModel(const char *fileName, int ztag, boolean useFloat)
retModel->meshes = (mesh_t*)Z_Calloc(sizeof(mesh_t)*retModel->numMeshes, ztag, 0); retModel->meshes = (mesh_t*)Z_Calloc(sizeof(mesh_t)*retModel->numMeshes, ztag, 0);
frames = (md3Frame*)&buffer[mdh->offsetFrames]; frames = (md3Frame*)&buffer[mdh->offsetFrames];
retModel->framenames = (char*)Z_Calloc(mdh->numFrames*16, ztag, 0); retModel->frameNames = (char*)Z_Calloc(mdh->numFrames*16, ztag, 0);
fname = retModel->framenames; fname = retModel->frameNames;
for (i = 0; i < mdh->numFrames; i++) for (i = 0; i < mdh->numFrames; i++)
{ {
memcpy(fname, frames->name, 16); memcpy(fname, frames->name, 16);

View file

@ -11,6 +11,7 @@
#include "../doomtype.h" #include "../doomtype.h"
#include "../info.h" #include "../info.h"
#include "../r_skins.h" #include "../r_skins.h"
#include "../r_state.h"
#include "../z_zone.h" #include "../z_zone.h"
#include "hw_model.h" #include "hw_model.h"
#include "hw_md2load.h" #include "hw_md2load.h"
@ -142,9 +143,7 @@ tag_t *GetTagByName(model_t *model, char *name, int frame)
// //
// LoadModel // LoadModel
// //
// Load a model and // Load a model and convert it to the internal format.
// convert it to the
// internal format.
// //
model_t *LoadModel(const char *filename, int ztag) model_t *LoadModel(const char *filename, int ztag)
{ {
@ -194,9 +193,6 @@ model_t *LoadModel(const char *filename, int ztag)
return NULL; return NULL;
} }
model->mdlFilename = (char*)Z_Malloc(strlen(filename)+1, ztag, 0);
strcpy(model->mdlFilename, filename);
Optimize(model); Optimize(model);
GeneratePolygonNormals(model, ztag); GeneratePolygonNormals(model, ztag);
LoadModelSprite2(model); LoadModelSprite2(model);
@ -237,17 +233,16 @@ model_t *LoadModel(const char *filename, int ztag)
void HWR_ReloadModels(void) void HWR_ReloadModels(void)
{ {
size_t i; size_t i;
INT32 s;
if (md2_playermodels != NULL) HWR_LoadModels();
for (s = 0; s < numskins; s++)
for (i = 0; i < md2_numplayermodels; i++)
{ {
CONS_Printf("%u\n", s); if (md2_playermodels[i].model)
if (md2_playermodels[s].model) LoadModelSprite2(md2_playermodels[i].model);
LoadModelSprite2(md2_playermodels[s].model);
} }
for (i = 0; i < NUMSPRITES; i++) for (i = 0; i < numsprites; i++)
{ {
if (md2_models[i].model) if (md2_models[i].model)
LoadModelInterpolationSettings(md2_models[i].model); LoadModelInterpolationSettings(md2_models[i].model);
@ -258,7 +253,7 @@ void LoadModelInterpolationSettings(model_t *model)
{ {
INT32 i; INT32 i;
INT32 numframes = model->meshes[0].numFrames; INT32 numframes = model->meshes[0].numFrames;
char *framename = model->framenames; char *framename = model->frameNames;
if (!framename) if (!framename)
return; return;
@ -298,7 +293,7 @@ void LoadModelSprite2(model_t *model)
INT32 i; INT32 i;
modelspr2frames_t *spr2frames = NULL; modelspr2frames_t *spr2frames = NULL;
INT32 numframes = model->meshes[0].numFrames; INT32 numframes = model->meshes[0].numFrames;
char *framename = model->framenames; char *framename = model->frameNames;
if (!framename) if (!framename)
return; return;

View file

@ -91,17 +91,14 @@ typedef struct model_s
{ {
int maxNumFrames; int maxNumFrames;
int numMaterials;
material_t *materials;
int numMeshes; int numMeshes;
mesh_t *meshes; mesh_t *meshes;
int numMaterials;
material_t *materials;
int numTags; int numTags;
tag_t *tags; tag_t *tags;
char *mdlFilename; char *frameNames;
boolean unloaded;
char *framenames;
boolean interpolate[256]; boolean interpolate[256];
modelspr2frames_t *spr2frames; modelspr2frames_t *spr2frames;

View file

@ -2240,7 +2240,7 @@ void HU_Erase(void)
// IN-LEVEL MULTIPLAYER RANKINGS // IN-LEVEL MULTIPLAYER RANKINGS
//====================================================================== //======================================================================
#define supercheckdef (!(players[tab[i].num].charflags & SF_NOSUPERSPRITES) && ((players[tab[i].num].powers[pw_super] && players[tab[i].num].mo && (players[tab[i].num].mo->state < &states[S_PLAY_SUPER_TRANS1] || players[tab[i].num].mo->state >= &states[S_PLAY_SUPER_TRANS6])) || (players[tab[i].num].powers[pw_carry] == CR_NIGHTSMODE && skins[players[tab[i].num].skin].flags & SF_SUPER))) #define supercheckdef (!(players[tab[i].num].charflags & SF_NOSUPERSPRITES) && ((players[tab[i].num].powers[pw_super] && players[tab[i].num].mo && (players[tab[i].num].mo->state < &states[S_PLAY_SUPER_TRANS1] || players[tab[i].num].mo->state >= &states[S_PLAY_SUPER_TRANS6])) || (players[tab[i].num].powers[pw_carry] == CR_NIGHTSMODE && skins[players[tab[i].num].skin]->flags & SF_SUPER)))
#define greycheckdef (players[tab[i].num].spectator || players[tab[i].num].playerstate == PST_DEAD || (G_IsSpecialStage(gamemap) && players[tab[i].num].exiting)) #define greycheckdef (players[tab[i].num].spectator || players[tab[i].num].playerstate == PST_DEAD || (G_IsSpecialStage(gamemap) && players[tab[i].num].exiting))
// //

View file

@ -501,7 +501,7 @@ static int libd_getSprite2Patch(lua_State *L)
{ {
const char *name = luaL_checkstring(L, 1); const char *name = luaL_checkstring(L, 1);
for (i = 0; i < numskins; i++) for (i = 0; i < numskins; i++)
if (fastcmp(skins[i].name, name)) if (fastcmp(skins[i]->name, name))
break; break;
if (i >= numskins) if (i >= numskins)
return 0; return 0;
@ -543,9 +543,9 @@ static int libd_getSprite2Patch(lua_State *L)
if (super) if (super)
j |= FF_SPR2SUPER; j |= FF_SPR2SUPER;
j = P_GetSkinSprite2(&skins[i], j, NULL); // feed skin and current sprite2 through to change sprite2 used if necessary j = P_GetSkinSprite2(skins[i], j, NULL); // feed skin and current sprite2 through to change sprite2 used if necessary
sprdef = &skins[i].sprites[j]; sprdef = &skins[i]->sprites[j];
// set frame number // set frame number
frame = luaL_optinteger(L, 2, 0); frame = luaL_optinteger(L, 2, 0);
@ -573,7 +573,7 @@ static int libd_getSprite2Patch(lua_State *L)
INT32 rot = R_GetRollAngle(rollangle); INT32 rot = R_GetRollAngle(rollangle);
if (rot) { if (rot) {
patch_t *rotsprite = Patch_GetRotatedSprite(sprframe, frame, angle, sprframe->flip & (1<<angle), true, &skins[i].sprinfo[j], rot); patch_t *rotsprite = Patch_GetRotatedSprite(sprframe, frame, angle, sprframe->flip & (1<<angle), true, &skins[i]->sprinfo[j], rot);
LUA_PushUserdata(L, rotsprite, META_PATCH); LUA_PushUserdata(L, rotsprite, META_PATCH);
lua_pushboolean(L, false); lua_pushboolean(L, false);
lua_pushboolean(L, true); lua_pushboolean(L, true);

View file

@ -638,10 +638,10 @@ static int mobj_set(lua_State *L)
strlcpy(skin, luaL_checkstring(L, 3), sizeof skin); strlcpy(skin, luaL_checkstring(L, 3), sizeof skin);
strlwr(skin); // all skin names are lowercase strlwr(skin); // all skin names are lowercase
for (i = 0; i < numskins; i++) for (i = 0; i < numskins; i++)
if (fastcmp(skins[i].name, skin)) if (fastcmp(skins[i]->name, skin))
{ {
if (!mo->player || R_SkinUsable(mo->player-players, i)) if (!mo->player || R_SkinUsable(mo->player-players, i))
mo->skin = &skins[i]; mo->skin = skins[i];
return 0; return 0;
} }
return luaL_error(L, "mobj.skin '%s' not found!", skin); return luaL_error(L, "mobj.skin '%s' not found!", skin);

View file

@ -226,7 +226,7 @@ static int skin_num(lua_State *L)
// skins are always valid, only added, never removed // skins are always valid, only added, never removed
I_Assert(skin != NULL); I_Assert(skin != NULL);
lua_pushinteger(L, skin-skins); lua_pushinteger(L, skin->skinnum);
return 1; return 1;
} }
@ -245,14 +245,14 @@ static int lib_iterateSkins(lua_State *L)
lua_remove(L, 1); // state is unused. lua_remove(L, 1); // state is unused.
if (!lua_isnil(L, 1)) if (!lua_isnil(L, 1))
i = (INT32)(*((skin_t **)luaL_checkudata(L, 1, META_SKIN)) - skins) + 1; i = (INT32)((*((skin_t **)luaL_checkudata(L, 1, META_SKIN)))->skinnum) + 1;
else else
i = 0; i = 0;
// skins are always valid, only added, never removed // skins are always valid, only added, never removed
if (i < numskins) if (i < numskins)
{ {
LUA_PushUserdata(L, &skins[i], META_SKIN); LUA_PushUserdata(L, skins[i], META_SKIN);
return 1; return 1;
} }
@ -272,7 +272,7 @@ static int lib_getSkin(lua_State *L)
return luaL_error(L, "skins[] index %d out of range (0 - %d)", i, MAXSKINS-1); return luaL_error(L, "skins[] index %d out of range (0 - %d)", i, MAXSKINS-1);
if (i >= numskins) if (i >= numskins)
return 0; return 0;
LUA_PushUserdata(L, &skins[i], META_SKIN); LUA_PushUserdata(L, skins[i], META_SKIN);
return 1; return 1;
} }
@ -287,9 +287,9 @@ static int lib_getSkin(lua_State *L)
// find skin by name // find skin by name
for (i = 0; i < numskins; i++) for (i = 0; i < numskins; i++)
if (fastcmp(skins[i].name, field)) if (fastcmp(skins[i]->name, field))
{ {
LUA_PushUserdata(L, &skins[i], META_SKIN); LUA_PushUserdata(L, skins[i], META_SKIN);
return 1; return 1;
} }

View file

@ -2311,7 +2311,7 @@ void Nextmap_OnChange(void)
SP_NightsAttackMenu[naghost].status = IT_DISABLED; SP_NightsAttackMenu[naghost].status = IT_DISABLED;
// Check if file exists, if not, disable REPLAY option // Check if file exists, if not, disable REPLAY option
sprintf(tabase,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s",srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), skins[cv_chooseskin.value-1].name); sprintf(tabase,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s",srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), skins[cv_chooseskin.value-1]->name);
#ifdef OLDNREPLAYNAME #ifdef OLDNREPLAYNAME
sprintf(tabaseold,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s",srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value)); sprintf(tabaseold,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s",srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value));
@ -2382,7 +2382,7 @@ void Nextmap_OnChange(void)
SP_TimeAttackMenu[taghost].status = IT_DISABLED; SP_TimeAttackMenu[taghost].status = IT_DISABLED;
// Check if file exists, if not, disable REPLAY option // Check if file exists, if not, disable REPLAY option
sprintf(tabase,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s",srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), skins[cv_chooseskin.value-1].name); sprintf(tabase,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s",srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), skins[cv_chooseskin.value-1]->name);
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
SP_ReplayMenu[i].status = IT_DISABLED; SP_ReplayMenu[i].status = IT_DISABLED;
SP_GuestReplayMenu[i].status = IT_DISABLED; SP_GuestReplayMenu[i].status = IT_DISABLED;
@ -3080,7 +3080,7 @@ static void M_ChangeCvar(INT32 choice)
{ {
SINT8 skinno = R_SkinAvailable(cv_chooseskin.string); SINT8 skinno = R_SkinAvailable(cv_chooseskin.string);
if (skinno != -1) if (skinno != -1)
CV_SetValue(cv,skins[skinno].prefcolor); CV_SetValue(cv,skins[skinno]->prefcolor);
return; return;
} }
CV_Set(cv,cv->defaultvalue); CV_Set(cv,cv->defaultvalue);
@ -4993,9 +4993,9 @@ static void M_PatchSkinNameTable(void)
for (j = 0; j < MAXSKINS; j++) for (j = 0; j < MAXSKINS; j++)
{ {
if (j < numskins && skins[j].name[0] != '\0' && R_SkinUsable(-1, j)) if (j < numskins && skins[j]->name[0] != '\0' && R_SkinUsable(-1, j))
{ {
skins_cons_t[j].strvalue = skins[j].realname; skins_cons_t[j].strvalue = skins[j]->realname;
skins_cons_t[j].value = j+1; skins_cons_t[j].value = j+1;
} }
else else
@ -8397,7 +8397,7 @@ static void M_DrawLoadGameData(void)
savetodraw--; savetodraw--;
if (savegameinfo[savetodraw].lives > 0) if (savegameinfo[savetodraw].lives > 0)
charskin = &skins[savegameinfo[savetodraw].skinnum]; charskin = skins[savegameinfo[savetodraw].skinnum];
// signpost background // signpost background
{ {
@ -8531,7 +8531,7 @@ static void M_DrawLoadGameData(void)
// botskin first // botskin first
if (savegameinfo[savetodraw].botskin) if (savegameinfo[savetodraw].botskin)
{ {
skin_t *charbotskin = &skins[savegameinfo[savetodraw].botskin-1]; skin_t *charbotskin = skins[savegameinfo[savetodraw].botskin-1];
sprdef = &charbotskin->sprites[SPR2_SIGN]; sprdef = &charbotskin->sprites[SPR2_SIGN];
if (!sprdef->numframes) if (!sprdef->numframes)
goto skipbot; goto skipbot;
@ -9091,9 +9091,9 @@ static void M_CacheCharacterSelectEntry(INT32 i, INT32 skinnum)
{ {
if (!(description[i].picname[0])) if (!(description[i].picname[0]))
{ {
if (skins[skinnum].sprites[SPR2_XTRA].numframes > XTRA_CHARSEL) if (skins[skinnum]->sprites[SPR2_XTRA].numframes > XTRA_CHARSEL)
{ {
spritedef_t *sprdef = &skins[skinnum].sprites[SPR2_XTRA]; spritedef_t *sprdef = &skins[skinnum]->sprites[SPR2_XTRA];
spriteframe_t *sprframe = &sprdef->spriteframes[XTRA_CHARSEL]; spriteframe_t *sprframe = &sprdef->spriteframes[XTRA_CHARSEL];
description[i].charpic = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH); description[i].charpic = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
} }
@ -9308,7 +9308,7 @@ static void M_DrawSetupChoosePlayerMenu(void)
{ {
const INT32 my = 16; const INT32 my = 16;
skin_t *charskin = &skins[0]; skin_t *charskin = skins[0];
INT32 skinnum = 0; INT32 skinnum = 0;
UINT16 col; UINT16 col;
UINT8 *colormap = NULL; UINT8 *colormap = NULL;
@ -9340,7 +9340,7 @@ static void M_DrawSetupChoosePlayerMenu(void)
// Find skin number from description[] // Find skin number from description[]
skinnum = description[char_on].skinnum[0]; skinnum = description[char_on].skinnum[0];
charskin = &skins[skinnum]; charskin = skins[skinnum];
// Use the opposite of the character's skincolor // Use the opposite of the character's skincolor
col = description[char_on].oppositecolor; col = description[char_on].oppositecolor;
@ -9443,7 +9443,7 @@ static void M_DrawSetupChoosePlayerMenu(void)
prevoutlinecolor = description[prev].tagoutlinecolor; prevoutlinecolor = description[prev].tagoutlinecolor;
if (prevtext[0] == '\0') if (prevtext[0] == '\0')
prevpatch = description[prev].namepic; prevpatch = description[prev].namepic;
charskin = &skins[description[prev].skinnum[0]]; charskin = skins[description[prev].skinnum[0]];
if (!prevtextcolor) if (!prevtextcolor)
prevtextcolor = charskin->prefcolor; prevtextcolor = charskin->prefcolor;
if (!prevoutlinecolor) if (!prevoutlinecolor)
@ -9473,7 +9473,7 @@ static void M_DrawSetupChoosePlayerMenu(void)
nextoutlinecolor = description[next].tagoutlinecolor; nextoutlinecolor = description[next].tagoutlinecolor;
if (nexttext[0] == '\0') if (nexttext[0] == '\0')
nextpatch = description[next].namepic; nextpatch = description[next].namepic;
charskin = &skins[description[next].skinnum[0]]; charskin = skins[description[next].skinnum[0]];
if (!nexttextcolor) if (!nexttextcolor)
nexttextcolor = charskin->prefcolor; nexttextcolor = charskin->prefcolor;
if (!nextoutlinecolor) if (!nextoutlinecolor)
@ -9531,7 +9531,7 @@ static void M_ChoosePlayer(INT32 choice)
if ((botingame = (description[choice].skinnum[1] != -1))) { if ((botingame = (description[choice].skinnum[1] != -1))) {
// this character has a second skin // this character has a second skin
botskin = (UINT8)(description[choice].skinnum[1]+1); botskin = (UINT8)(description[choice].skinnum[1]+1);
botcolor = skins[description[choice].skinnum[1]].prefcolor; botcolor = skins[description[choice].skinnum[1]]->prefcolor;
} }
else else
botskin = botcolor = 0; botskin = botcolor = 0;
@ -9816,7 +9816,7 @@ void M_DrawTimeAttackMenu(void)
{ {
INT32 i, x, y, empatx, empaty, cursory = 0; INT32 i, x, y, empatx, empaty, cursory = 0;
UINT16 dispstatus; UINT16 dispstatus;
patch_t *PictureOfUrFace; // my WHAT patch_t *PictureOfUrFace;
patch_t *empatch; patch_t *empatch;
M_SetMenuCurBackground("RECATKBG"); M_SetMenuCurBackground("RECATKBG");
@ -9885,9 +9885,9 @@ void M_DrawTimeAttackMenu(void)
// Character face! // Character face!
{ {
if (skins[cv_chooseskin.value-1].sprites[SPR2_XTRA].numframes > XTRA_CHARSEL) if (skins[cv_chooseskin.value-1]->sprites[SPR2_XTRA].numframes > XTRA_CHARSEL)
{ {
spritedef_t *sprdef = &skins[cv_chooseskin.value-1].sprites[SPR2_XTRA]; spritedef_t *sprdef = &skins[cv_chooseskin.value-1]->sprites[SPR2_XTRA];
spriteframe_t *sprframe = &sprdef->spriteframes[XTRA_CHARSEL]; spriteframe_t *sprframe = &sprdef->spriteframes[XTRA_CHARSEL];
PictureOfUrFace = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH); PictureOfUrFace = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
} }
@ -10326,7 +10326,7 @@ static void M_ChooseNightsAttack(INT32 choice)
I_Error("Out of memory for replay filepath\n"); I_Error("Out of memory for replay filepath\n");
sprintf(gpath,"replay"PATHSEP"%s"PATHSEP"%s", timeattackfolder, G_BuildMapName(cv_nextmap.value)); sprintf(gpath,"replay"PATHSEP"%s"PATHSEP"%s", timeattackfolder, G_BuildMapName(cv_nextmap.value));
snprintf(nameofdemo, sizeof nameofdemo, "%s-%s-last", gpath, skins[cv_chooseskin.value-1].name); snprintf(nameofdemo, sizeof nameofdemo, "%s-%s-last", gpath, skins[cv_chooseskin.value-1]->name);
if (!cv_autorecord.value) if (!cv_autorecord.value)
remove(va("%s"PATHSEP"%s.lmp", srb2home, nameofdemo)); remove(va("%s"PATHSEP"%s.lmp", srb2home, nameofdemo));
@ -10355,7 +10355,7 @@ static void M_ChooseTimeAttack(INT32 choice)
I_Error("Out of memory for replay filepath\n"); I_Error("Out of memory for replay filepath\n");
sprintf(gpath,"replay"PATHSEP"%s"PATHSEP"%s", timeattackfolder, G_BuildMapName(cv_nextmap.value)); sprintf(gpath,"replay"PATHSEP"%s"PATHSEP"%s", timeattackfolder, G_BuildMapName(cv_nextmap.value));
snprintf(nameofdemo, sizeof nameofdemo, "%s-%s-last", gpath, skins[cv_chooseskin.value-1].name); snprintf(nameofdemo, sizeof nameofdemo, "%s-%s-last", gpath, skins[cv_chooseskin.value-1]->name);
if (!cv_autorecord.value) if (!cv_autorecord.value)
remove(va("%s"PATHSEP"%s.lmp", srb2home, nameofdemo)); remove(va("%s"PATHSEP"%s.lmp", srb2home, nameofdemo));
@ -10395,7 +10395,7 @@ static void M_ReplayTimeAttack(INT32 choice)
return; return;
} }
// srb2/replay/main/map01-sonic-time-best.lmp // srb2/replay/main/map01-sonic-time-best.lmp
G_DoPlayDemo(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s-%s.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), skins[cv_chooseskin.value-1].name, which)); G_DoPlayDemo(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s-%s.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), skins[cv_chooseskin.value-1]->name, which));
} }
else if (currentMenu == &SP_NightsReplayDef) else if (currentMenu == &SP_NightsReplayDef)
{ {
@ -10415,7 +10415,7 @@ static void M_ReplayTimeAttack(INT32 choice)
return; return;
} }
demoname = va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s-%s.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), skins[cv_chooseskin.value-1].name, which); demoname = va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s-%s.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), skins[cv_chooseskin.value-1]->name, which);
#ifdef OLDNREPLAYNAME // Check for old style named NiGHTS replay if a new style replay doesn't exist. #ifdef OLDNREPLAYNAME // Check for old style named NiGHTS replay if a new style replay doesn't exist.
if (!FIL_FileExists(demoname)) if (!FIL_FileExists(demoname))
@ -10445,7 +10445,7 @@ static void M_OverwriteGuest(const char *which)
char *rguest = Z_StrDup(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-guest.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value))); char *rguest = Z_StrDup(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-guest.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value)));
UINT8 *buf; UINT8 *buf;
size_t len; size_t len;
len = FIL_ReadFile(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s-%s.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), skins[cv_chooseskin.value-1].name, which), &buf); len = FIL_ReadFile(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s-%s.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), skins[cv_chooseskin.value-1]->name, which), &buf);
if (!len) { if (!len) {
return; return;
@ -11875,11 +11875,11 @@ static void M_DrawSetupMultiPlayerMenu(void)
// draw skin string // draw skin string
V_DrawRightAlignedString(BASEVIDWIDTH - x, y, V_DrawRightAlignedString(BASEVIDWIDTH - x, y,
((MP_PlayerSetupMenu[1].status & IT_TYPE) == IT_SPACE ? V_TRANSLUCENT : 0)|(itemOn == 1 ? V_YELLOWMAP : 0)|V_ALLOWLOWERCASE, ((MP_PlayerSetupMenu[1].status & IT_TYPE) == IT_SPACE ? V_TRANSLUCENT : 0)|(itemOn == 1 ? V_YELLOWMAP : 0)|V_ALLOWLOWERCASE,
skins[setupm_fakeskin].realname); skins[setupm_fakeskin]->realname);
if (itemOn == 1 && (MP_PlayerSetupMenu[1].status & IT_TYPE) != IT_SPACE) if (itemOn == 1 && (MP_PlayerSetupMenu[1].status & IT_TYPE) != IT_SPACE)
{ {
V_DrawCharacter(BASEVIDWIDTH - x - 10 - V_StringWidth(skins[setupm_fakeskin].realname, V_ALLOWLOWERCASE) - (skullAnimCounter/5), y, V_DrawCharacter(BASEVIDWIDTH - x - 10 - V_StringWidth(skins[setupm_fakeskin]->realname, V_ALLOWLOWERCASE) - (skullAnimCounter/5), y,
'\x1C' | V_YELLOWMAP, false); '\x1C' | V_YELLOWMAP, false);
V_DrawCharacter(BASEVIDWIDTH - x + 2 + (skullAnimCounter/5), y, V_DrawCharacter(BASEVIDWIDTH - x + 2 + (skullAnimCounter/5), y,
'\x1D' | V_YELLOWMAP, false); '\x1D' | V_YELLOWMAP, false);
@ -11900,7 +11900,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
// draw box around character // draw box around character
V_DrawFill(x-(charw/2), y, charw, 84, 159); V_DrawFill(x-(charw/2), y, charw, 84, 159);
sprdef = &skins[setupm_fakeskin].sprites[multi_spr2]; sprdef = &skins[setupm_fakeskin]->sprites[multi_spr2];
if (!setupm_fakecolor->color || !sprdef->numframes) // should never happen but hey, who knows if (!setupm_fakecolor->color || !sprdef->numframes) // should never happen but hey, who knows
goto faildraw; goto faildraw;
@ -11921,7 +11921,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
V_DrawFixedPatch( V_DrawFixedPatch(
x<<FRACBITS, x<<FRACBITS,
chary<<FRACBITS, chary<<FRACBITS,
FixedDiv(skins[setupm_fakeskin].highresscale, skins[setupm_fakeskin].shieldscale), FixedDiv(skins[setupm_fakeskin]->highresscale, skins[setupm_fakeskin]->shieldscale),
flags, patch, colormap); flags, patch, colormap);
goto colordraw; goto colordraw;
@ -12051,7 +12051,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
setupm_fakeskin = numskins-1; setupm_fakeskin = numskins-1;
} }
while ((prev_setupm_fakeskin != setupm_fakeskin) && !(R_SkinUsable(-1, setupm_fakeskin))); while ((prev_setupm_fakeskin != setupm_fakeskin) && !(R_SkinUsable(-1, setupm_fakeskin)));
multi_spr2 = P_GetSkinSprite2(&skins[setupm_fakeskin], SPR2_WALK, NULL); multi_spr2 = P_GetSkinSprite2(skins[setupm_fakeskin], SPR2_WALK, NULL);
} }
else if (itemOn == 2) // player color else if (itemOn == 2) // player color
{ {
@ -12067,7 +12067,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
{ {
S_StartSound(NULL,sfx_strpst); S_StartSound(NULL,sfx_strpst);
// you know what? always putting these in the buffer won't hurt anything. // you know what? always putting these in the buffer won't hurt anything.
COM_BufAddText (va("%s \"%s\"\n",setupm_cvdefaultskin->name,skins[setupm_fakeskin].name)); COM_BufAddText (va("%s \"%s\"\n",setupm_cvdefaultskin->name,skins[setupm_fakeskin]->name));
COM_BufAddText (va("%s %d\n",setupm_cvdefaultcolor->name,setupm_fakecolor->color)); COM_BufAddText (va("%s %d\n",setupm_cvdefaultcolor->name,setupm_fakecolor->color));
break; break;
} }
@ -12084,7 +12084,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
setupm_fakeskin = 0; setupm_fakeskin = 0;
} }
while ((prev_setupm_fakeskin != setupm_fakeskin) && !(R_SkinUsable(-1, setupm_fakeskin))); while ((prev_setupm_fakeskin != setupm_fakeskin) && !(R_SkinUsable(-1, setupm_fakeskin)));
multi_spr2 = P_GetSkinSprite2(&skins[setupm_fakeskin], SPR2_WALK, NULL); multi_spr2 = P_GetSkinSprite2(skins[setupm_fakeskin], SPR2_WALK, NULL);
} }
else if (itemOn == 2) // player color else if (itemOn == 2) // player color
{ {
@ -12105,7 +12105,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
} }
else if (itemOn == 2) else if (itemOn == 2)
{ {
UINT16 col = skins[setupm_fakeskin].prefcolor; UINT16 col = skins[setupm_fakeskin]->prefcolor;
if ((setupm_fakecolor->color != col) && skincolors[col].accessible) if ((setupm_fakecolor->color != col) && skincolors[col].accessible)
{ {
S_StartSound(NULL,sfx_menu1); // Tails S_StartSound(NULL,sfx_menu1); // Tails
@ -12195,7 +12195,7 @@ static void M_SetupMultiPlayer(INT32 choice)
else else
MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER|IT_STRING); MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER|IT_STRING);
multi_spr2 = P_GetSkinSprite2(&skins[setupm_fakeskin], SPR2_WALK, NULL); multi_spr2 = P_GetSkinSprite2(skins[setupm_fakeskin], SPR2_WALK, NULL);
MP_PlayerSetupDef.prevMenu = currentMenu; MP_PlayerSetupDef.prevMenu = currentMenu;
M_SetupNextMenu(&MP_PlayerSetupDef); M_SetupNextMenu(&MP_PlayerSetupDef);
@ -12239,7 +12239,7 @@ static void M_SetupMultiPlayer2(INT32 choice)
else else
MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER|IT_STRING); MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER|IT_STRING);
multi_spr2 = P_GetSkinSprite2(&skins[setupm_fakeskin], SPR2_WALK, NULL); multi_spr2 = P_GetSkinSprite2(skins[setupm_fakeskin], SPR2_WALK, NULL);
MP_PlayerSetupDef.prevMenu = currentMenu; MP_PlayerSetupDef.prevMenu = currentMenu;
M_SetupNextMenu(&MP_PlayerSetupDef); M_SetupNextMenu(&MP_PlayerSetupDef);
@ -12257,7 +12257,7 @@ static boolean M_QuitMultiPlayerMenu(void)
setupm_name[l] =0; setupm_name[l] =0;
COM_BufAddText (va("%s \"%s\"\n",setupm_cvname->name,setupm_name)); COM_BufAddText (va("%s \"%s\"\n",setupm_cvname->name,setupm_name));
} }
COM_BufAddText (va("%s \"%s\"\n",setupm_cvskin->name,skins[setupm_fakeskin].name)); COM_BufAddText (va("%s \"%s\"\n",setupm_cvskin->name,skins[setupm_fakeskin]->name));
// send color if changed // send color if changed
if (setupm_fakecolor->color != setupm_cvcolor->value) if (setupm_fakecolor->color != setupm_cvcolor->value)
COM_BufAddText (va("%s %d\n",setupm_cvcolor->name,setupm_fakecolor->color)); COM_BufAddText (va("%s %d\n",setupm_cvcolor->name,setupm_fakecolor->color));

View file

@ -3609,7 +3609,7 @@ void A_1upThinker(mobj_t *actor)
} }
} }
if (closestplayer == -1 || skins[players[closestplayer].skin].sprites[SPR2_LIFE].numframes == 0) if (closestplayer == -1 || skins[players[closestplayer].skin]->sprites[SPR2_LIFE].numframes == 0)
{ // Closest player not found (no players in game?? may be empty dedicated server!), or does not have correct sprite. { // Closest player not found (no players in game?? may be empty dedicated server!), or does not have correct sprite.
if (actor->tracer) if (actor->tracer)
{ {
@ -3627,7 +3627,7 @@ void A_1upThinker(mobj_t *actor)
{ {
P_SetTarget(&actor->tracer, P_SpawnMobj(actor->x, actor->y, actor->z, MT_OVERLAY)); P_SetTarget(&actor->tracer, P_SpawnMobj(actor->x, actor->y, actor->z, MT_OVERLAY));
P_SetTarget(&actor->tracer->target, actor); P_SetTarget(&actor->tracer->target, actor);
actor->tracer->skin = &skins[players[closestplayer].skin]; // required here to prevent spr2 default showing stand for a single frame actor->tracer->skin = skins[players[closestplayer].skin]; // required here to prevent spr2 default showing stand for a single frame
P_SetMobjState(actor->tracer, actor->info->seestate); P_SetMobjState(actor->tracer, actor->info->seestate);
// The overlay is going to be one tic early turning off and on // The overlay is going to be one tic early turning off and on
@ -3637,7 +3637,7 @@ void A_1upThinker(mobj_t *actor)
} }
actor->tracer->color = players[closestplayer].mo->color; actor->tracer->color = players[closestplayer].mo->color;
actor->tracer->skin = &skins[players[closestplayer].skin]; actor->tracer->skin = skins[players[closestplayer].skin];
} }
// Function: A_MonitorPop // Function: A_MonitorPop
@ -3707,7 +3707,7 @@ void A_MonitorPop(mobj_t *actor)
P_SetTarget(&newmobj->tracer, livesico); P_SetTarget(&newmobj->tracer, livesico);
livesico->color = newmobj->target->player->mo->color; livesico->color = newmobj->target->player->mo->color;
livesico->skin = &skins[newmobj->target->player->skin]; livesico->skin = skins[newmobj->target->player->skin];
P_SetMobjState(livesico, newmobj->info->seestate); P_SetMobjState(livesico, newmobj->info->seestate);
// We're using the overlay, so use the overlay 1up sprite (no text) // We're using the overlay, so use the overlay 1up sprite (no text)
@ -3793,7 +3793,7 @@ void A_GoldMonitorPop(mobj_t *actor)
P_SetTarget(&newmobj->tracer, livesico); P_SetTarget(&newmobj->tracer, livesico);
livesico->color = newmobj->target->player->mo->color; livesico->color = newmobj->target->player->mo->color;
livesico->skin = &skins[newmobj->target->player->skin]; livesico->skin = skins[newmobj->target->player->skin];
P_SetMobjState(livesico, newmobj->info->seestate); P_SetMobjState(livesico, newmobj->info->seestate);
// We're using the overlay, so use the overlay 1up sprite (no text) // We're using the overlay, so use the overlay 1up sprite (no text)
@ -5172,7 +5172,7 @@ void A_SignPlayer(mobj_t *actor)
if (!actor->target->player) if (!actor->target->player)
return; return;
skin = &skins[actor->target->player->skin]; skin = skins[actor->target->player->skin];
facecolor = actor->target->player->skincolor; facecolor = actor->target->player->skincolor;
if (signcolor) if (signcolor)
@ -5203,10 +5203,10 @@ void A_SignPlayer(mobj_t *actor)
if (!SignSkinCheck(player, skincount)) if (!SignSkinCheck(player, skincount))
skinnum++; skinnum++;
} }
skin = &skins[skinnum]; skin = skins[skinnum];
} }
else // specific skin else // specific skin
skin = &skins[locvar1]; skin = skins[locvar1];
facecolor = skin->prefcolor; facecolor = skin->prefcolor;
if (signcolor) if (signcolor)

View file

@ -207,7 +207,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
return P_SetPlayerMobjState(mobj, S_PLAY_FALL); return P_SetPlayerMobjState(mobj, S_PLAY_FALL);
// Catch swimming versus flying // Catch swimming versus flying
if ((state == S_PLAY_FLY || (state == S_PLAY_GLIDE && skins[player->skin].sprites[SPR2_SWIM].numframes)) if ((state == S_PLAY_FLY || (state == S_PLAY_GLIDE && skins[player->skin]->sprites[SPR2_SWIM].numframes))
&& player->mo->eflags & MFE_UNDERWATER && !player->skidtime) && player->mo->eflags & MFE_UNDERWATER && !player->skidtime)
return P_SetPlayerMobjState(player->mo, S_PLAY_SWIM); return P_SetPlayerMobjState(player->mo, S_PLAY_SWIM);
else if (state == S_PLAY_SWIM && !(player->mo->eflags & MFE_UNDERWATER)) else if (state == S_PLAY_SWIM && !(player->mo->eflags & MFE_UNDERWATER))
@ -325,7 +325,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
mobj->tics = st->tics; mobj->tics = st->tics;
// Adjust the player's animation speed to match their velocity. // Adjust the player's animation speed to match their velocity.
if (state == S_PLAY_STND && player->powers[pw_super] && skins[player->skin].sprites[SPR2_WAIT|FF_SPR2SUPER].numframes == 0) // if no super wait, don't wait at all if (state == S_PLAY_STND && player->powers[pw_super] && skins[player->skin]->sprites[SPR2_WAIT|FF_SPR2SUPER].numframes == 0) // if no super wait, don't wait at all
mobj->tics = -1; mobj->tics = -1;
else if (player->panim == PA_EDGE && (player->charflags & SF_FASTEDGE)) else if (player->panim == PA_EDGE && (player->charflags & SF_FASTEDGE))
mobj->tics = 2; mobj->tics = 2;
@ -10707,10 +10707,10 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
nummaprings++; nummaprings++;
break; break;
case MT_METALSONIC_RACE: case MT_METALSONIC_RACE:
mobj->skin = &skins[5]; mobj->skin = skins[5];
/* FALLTHRU */ /* FALLTHRU */
case MT_METALSONIC_BATTLE: case MT_METALSONIC_BATTLE:
mobj->color = skins[5].prefcolor; mobj->color = skins[5]->prefcolor;
sc = 5; sc = 5;
break; break;
case MT_FANG: case MT_FANG:
@ -11381,7 +11381,7 @@ void P_SpawnPlayer(INT32 playernum)
// set 'spritedef' override in mobj for player skins.. (see ProjectSprite) // set 'spritedef' override in mobj for player skins.. (see ProjectSprite)
// (usefulness: when body mobj is detached from player (who respawns), // (usefulness: when body mobj is detached from player (who respawns),
// the dead body mobj retains the skin through the 'spritedef' override). // the dead body mobj retains the skin through the 'spritedef' override).
mobj->skin = &skins[p->skin]; mobj->skin = skins[p->skin];
P_SetupStateAnimation(mobj, mobj->state); P_SetupStateAnimation(mobj, mobj->state);
mobj->health = 1; mobj->health = 1;
@ -11389,14 +11389,14 @@ void P_SpawnPlayer(INT32 playernum)
p->bonustime = false; p->bonustime = false;
p->realtime = leveltime; p->realtime = leveltime;
p->followitem = skins[p->skin].followitem; p->followitem = skins[p->skin]->followitem;
// Make sure player's stats are reset if they were in dashmode! // Make sure player's stats are reset if they were in dashmode!
if (p->dashmode) if (p->dashmode)
{ {
p->dashmode = 0; p->dashmode = 0;
p->normalspeed = skins[p->skin].normalspeed; p->normalspeed = skins[p->skin]->normalspeed;
p->jumpfactor = skins[p->skin].jumpfactor; p->jumpfactor = skins[p->skin]->jumpfactor;
} }
// Clear lastlinehit and lastsidehit // Clear lastlinehit and lastsidehit
@ -11412,7 +11412,7 @@ void P_SpawnPlayer(INT32 playernum)
P_FlashPal(p, 0, 0); // Resets P_FlashPal(p, 0, 0); // Resets
// Set bounds accurately. // Set bounds accurately.
mobj->radius = FixedMul(skins[p->skin].radius, mobj->scale); mobj->radius = FixedMul(skins[p->skin]->radius, mobj->scale);
mobj->height = P_GetPlayerHeight(p); mobj->height = P_GetPlayerHeight(p);
if (!leveltime && !p->spectator && ((maptol & TOL_NIGHTS) == TOL_NIGHTS) != (G_IsSpecialStage(gamemap))) // non-special NiGHTS stage or special non-NiGHTS stage if (!leveltime && !p->spectator && ((maptol & TOL_NIGHTS) == TOL_NIGHTS) != (G_IsSpecialStage(gamemap))) // non-special NiGHTS stage or special non-NiGHTS stage

View file

@ -76,11 +76,11 @@ static inline void P_ArchivePlayer(void)
// Write skin names, so that loading skins in different orders // Write skin names, so that loading skins in different orders
// doesn't change who the save file is for! // doesn't change who the save file is for!
WRITESTRINGN(save_p, skins[player->skin].name, SKINNAMESIZE); WRITESTRINGN(save_p, skins[player->skin]->name, SKINNAMESIZE);
if (botskin != 0) if (botskin != 0)
{ {
WRITESTRINGN(save_p, skins[botskin-1].name, SKINNAMESIZE); WRITESTRINGN(save_p, skins[botskin-1]->name, SKINNAMESIZE);
} }
else else
{ {
@ -1815,7 +1815,7 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
if (diff2 & MD2_CVMEM) if (diff2 & MD2_CVMEM)
WRITEINT32(save_p, mobj->cvmem); WRITEINT32(save_p, mobj->cvmem);
if (diff2 & MD2_SKIN) if (diff2 & MD2_SKIN)
WRITEUINT8(save_p, (UINT8)((skin_t *)mobj->skin - skins)); WRITEUINT8(save_p, (UINT8)(((skin_t *)mobj->skin)->skinnum));
if (diff2 & MD2_COLOR) if (diff2 & MD2_COLOR)
WRITEUINT16(save_p, mobj->color); WRITEUINT16(save_p, mobj->color);
if (diff2 & MD2_EXTVAL1) if (diff2 & MD2_EXTVAL1)
@ -2855,7 +2855,7 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker)
if (diff2 & MD2_CVMEM) if (diff2 & MD2_CVMEM)
mobj->cvmem = READINT32(save_p); mobj->cvmem = READINT32(save_p);
if (diff2 & MD2_SKIN) if (diff2 & MD2_SKIN)
mobj->skin = &skins[READUINT8(save_p)]; mobj->skin = skins[READUINT8(save_p)];
if (diff2 & MD2_COLOR) if (diff2 & MD2_COLOR)
mobj->color = READUINT16(save_p); mobj->color = READUINT16(save_p);
if (diff2 & MD2_EXTVAL1) if (diff2 & MD2_EXTVAL1)

View file

@ -3622,19 +3622,19 @@ static void P_ForceCharacter(const char *forcecharskin)
if (splitscreen) if (splitscreen)
{ {
SetPlayerSkin(secondarydisplayplayer, forcecharskin); SetPlayerSkin(secondarydisplayplayer, forcecharskin);
if ((unsigned)cv_playercolor2.value != skins[players[secondarydisplayplayer].skin].prefcolor) if ((unsigned)cv_playercolor2.value != skins[players[secondarydisplayplayer].skin]->prefcolor)
{ {
CV_StealthSetValue(&cv_playercolor2, skins[players[secondarydisplayplayer].skin].prefcolor); CV_StealthSetValue(&cv_playercolor2, skins[players[secondarydisplayplayer].skin]->prefcolor);
players[secondarydisplayplayer].skincolor = skins[players[secondarydisplayplayer].skin].prefcolor; players[secondarydisplayplayer].skincolor = skins[players[secondarydisplayplayer].skin]->prefcolor;
} }
} }
SetPlayerSkin(consoleplayer, forcecharskin); SetPlayerSkin(consoleplayer, forcecharskin);
// normal player colors in single player // normal player colors in single player
if ((unsigned)cv_playercolor.value != skins[players[consoleplayer].skin].prefcolor) if ((unsigned)cv_playercolor.value != skins[players[consoleplayer].skin]->prefcolor)
{ {
CV_StealthSetValue(&cv_playercolor, skins[players[consoleplayer].skin].prefcolor); CV_StealthSetValue(&cv_playercolor, skins[players[consoleplayer].skin]->prefcolor);
players[consoleplayer].skincolor = skins[players[consoleplayer].skin].prefcolor; players[consoleplayer].skincolor = skins[players[consoleplayer].skin]->prefcolor;
} }
} }
} }
@ -3678,8 +3678,8 @@ static void P_LoadRecordGhosts(void)
if (cv_ghost_bestscore.value == 1 && players[consoleplayer].skin != i) if (cv_ghost_bestscore.value == 1 && players[consoleplayer].skin != i)
continue; continue;
if (FIL_FileExists(va("%s-%s-score-best.lmp", gpath, skins[i].name))) if (FIL_FileExists(va("%s-%s-score-best.lmp", gpath, skins[i]->name)))
G_AddGhost(va("%s-%s-score-best.lmp", gpath, skins[i].name)); G_AddGhost(va("%s-%s-score-best.lmp", gpath, skins[i]->name));
} }
} }
@ -3691,8 +3691,8 @@ static void P_LoadRecordGhosts(void)
if (cv_ghost_besttime.value == 1 && players[consoleplayer].skin != i) if (cv_ghost_besttime.value == 1 && players[consoleplayer].skin != i)
continue; continue;
if (FIL_FileExists(va("%s-%s-time-best.lmp", gpath, skins[i].name))) if (FIL_FileExists(va("%s-%s-time-best.lmp", gpath, skins[i]->name)))
G_AddGhost(va("%s-%s-time-best.lmp", gpath, skins[i].name)); G_AddGhost(va("%s-%s-time-best.lmp", gpath, skins[i]->name));
} }
} }
@ -3704,8 +3704,8 @@ static void P_LoadRecordGhosts(void)
if (cv_ghost_bestrings.value == 1 && players[consoleplayer].skin != i) if (cv_ghost_bestrings.value == 1 && players[consoleplayer].skin != i)
continue; continue;
if (FIL_FileExists(va("%s-%s-rings-best.lmp", gpath, skins[i].name))) if (FIL_FileExists(va("%s-%s-rings-best.lmp", gpath, skins[i]->name)))
G_AddGhost(va("%s-%s-rings-best.lmp", gpath, skins[i].name)); G_AddGhost(va("%s-%s-rings-best.lmp", gpath, skins[i]->name));
} }
} }
@ -3717,8 +3717,8 @@ static void P_LoadRecordGhosts(void)
if (cv_ghost_last.value == 1 && players[consoleplayer].skin != i) if (cv_ghost_last.value == 1 && players[consoleplayer].skin != i)
continue; continue;
if (FIL_FileExists(va("%s-%s-last.lmp", gpath, skins[i].name))) if (FIL_FileExists(va("%s-%s-last.lmp", gpath, skins[i]->name)))
G_AddGhost(va("%s-%s-last.lmp", gpath, skins[i].name)); G_AddGhost(va("%s-%s-last.lmp", gpath, skins[i]->name));
} }
} }
@ -3748,8 +3748,8 @@ static void P_LoadNightsGhosts(void)
if (cv_ghost_bestscore.value == 1 && players[consoleplayer].skin != i) if (cv_ghost_bestscore.value == 1 && players[consoleplayer].skin != i)
continue; continue;
if (FIL_FileExists(va("%s-%s-score-best.lmp", gpath, skins[i].name))) if (FIL_FileExists(va("%s-%s-score-best.lmp", gpath, skins[i]->name)))
G_AddGhost(va("%s-%s-score-best.lmp", gpath, skins[i].name)); G_AddGhost(va("%s-%s-score-best.lmp", gpath, skins[i]->name));
} }
} }
@ -3761,8 +3761,8 @@ static void P_LoadNightsGhosts(void)
if (cv_ghost_besttime.value == 1 && players[consoleplayer].skin != i) if (cv_ghost_besttime.value == 1 && players[consoleplayer].skin != i)
continue; continue;
if (FIL_FileExists(va("%s-%s-time-best.lmp", gpath, skins[i].name))) if (FIL_FileExists(va("%s-%s-time-best.lmp", gpath, skins[i]->name)))
G_AddGhost(va("%s-%s-time-best.lmp", gpath, skins[i].name)); G_AddGhost(va("%s-%s-time-best.lmp", gpath, skins[i]->name));
} }
} }
@ -3774,8 +3774,8 @@ static void P_LoadNightsGhosts(void)
if (cv_ghost_last.value == 1 && players[consoleplayer].skin != i) if (cv_ghost_last.value == 1 && players[consoleplayer].skin != i)
continue; continue;
if (FIL_FileExists(va("%s-%s-last.lmp", gpath, skins[i].name))) if (FIL_FileExists(va("%s-%s-last.lmp", gpath, skins[i]->name)))
G_AddGhost(va("%s-%s-last.lmp", gpath, skins[i].name)); G_AddGhost(va("%s-%s-last.lmp", gpath, skins[i]->name));
} }
} }
@ -4251,7 +4251,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
players[consoleplayer].lives = savedata.lives; players[consoleplayer].lives = savedata.lives;
players[consoleplayer].score = savedata.score; players[consoleplayer].score = savedata.score;
if ((botingame = ((botskin = savedata.botskin) != 0))) if ((botingame = ((botskin = savedata.botskin) != 0)))
botcolor = skins[botskin-1].prefcolor; botcolor = skins[botskin-1]->prefcolor;
emeralds = savedata.emeralds; emeralds = savedata.emeralds;
savedata.lives = 0; savedata.lives = 0;
} }

View file

@ -1779,7 +1779,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
case 331: // continuous case 331: // continuous
case 332: // each time case 332: // each time
case 333: // once case 333: // once
if (!(actor && actor->player && ((stricmp(triggerline->text, skins[actor->player->skin].name) == 0) ^ ((triggerline->flags & ML_NOCLIMB) == ML_NOCLIMB)))) if (!(actor && actor->player && ((stricmp(triggerline->text, skins[actor->player->skin]->name) == 0) ^ ((triggerline->flags & ML_NOCLIMB) == ML_NOCLIMB))))
return false; return false;
break; break;
case 334: // object dye - continuous case 334: // object dye - continuous

View file

@ -682,8 +682,8 @@ static void P_DeNightserizePlayer(player_t *player)
player->mo->flags &= ~MF_NOGRAVITY; player->mo->flags &= ~MF_NOGRAVITY;
player->mo->skin = &skins[player->skin]; player->mo->skin = skins[player->skin];
player->followitem = skins[player->skin].followitem; player->followitem = skins[player->skin]->followitem;
player->mo->color = player->skincolor; player->mo->color = player->skincolor;
G_GhostAddColor(GHC_RETURNSKIN); G_GhostAddColor(GHC_RETURNSKIN);
@ -785,12 +785,12 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
player->mo->height = P_GetPlayerHeight(player); // Just to make sure jumping into the drone doesn't result in a squashed hitbox. player->mo->height = P_GetPlayerHeight(player); // Just to make sure jumping into the drone doesn't result in a squashed hitbox.
player->oldscale = player->mo->scale; player->oldscale = player->mo->scale;
if (skins[player->skin].sprites[SPR2_NFLY].numframes == 0) // If you don't have a sprite for flying horizontally, use the default NiGHTS skin. if (skins[player->skin]->sprites[SPR2_NFLY].numframes == 0) // If you don't have a sprite for flying horizontally, use the default NiGHTS skin.
{ {
player->mo->skin = &skins[DEFAULTNIGHTSSKIN]; player->mo->skin = skins[DEFAULTNIGHTSSKIN];
if (!(cv_debug || devparm) && !(netgame || multiplayer || demoplayback)) if (!(cv_debug || devparm) && !(netgame || multiplayer || demoplayback))
player->mo->color = skins[DEFAULTNIGHTSSKIN].prefcolor; player->mo->color = skins[DEFAULTNIGHTSSKIN]->prefcolor;
player->followitem = skins[DEFAULTNIGHTSSKIN].followitem; player->followitem = skins[DEFAULTNIGHTSSKIN]->followitem;
G_GhostAddColor(GHC_NIGHTSSKIN); G_GhostAddColor(GHC_NIGHTSSKIN);
} }
} }
@ -4264,7 +4264,7 @@ static void P_DoSuperStuff(player_t *player)
player->mo->color = (player->pflags & PF_GODMODE && cv_debug == 0) player->mo->color = (player->pflags & PF_GODMODE && cv_debug == 0)
? (SKINCOLOR_SUPERSILVER1 + 5*(((signed)leveltime >> 1) % 7)) // A wholesome easter egg. ? (SKINCOLOR_SUPERSILVER1 + 5*(((signed)leveltime >> 1) % 7)) // A wholesome easter egg.
: skins[player->skin].supercolor + abs( ( (player->powers[pw_super] >> 1) % 9) - 4); // This is where super flashing is handled. : skins[player->skin]->supercolor + abs( ( (player->powers[pw_super] >> 1) % 9) - 4); // This is where super flashing is handled.
G_GhostAddColor(GHC_SUPER); G_GhostAddColor(GHC_SUPER);
@ -11469,7 +11469,7 @@ static void P_DoMetalJetFume(player_t *player, mobj_t *fume)
P_SetThingPosition(fume); P_SetThingPosition(fume);
// If dashmode is high enough, spawn a trail // If dashmode is high enough, spawn a trail
if (player->normalspeed >= skins[player->skin].normalspeed*2) if (player->normalspeed >= skins[player->skin]->normalspeed*2)
P_SpawnGhostMobj(fume); P_SpawnGhostMobj(fume);
} }
@ -12294,20 +12294,20 @@ void P_PlayerThink(player_t *player)
{ {
if (prevdashmode >= DASHMODE_THRESHOLD) if (prevdashmode >= DASHMODE_THRESHOLD)
{ {
player->normalspeed = skins[player->skin].normalspeed; // Reset to default if not capable of entering dash mode. player->normalspeed = skins[player->skin]->normalspeed; // Reset to default if not capable of entering dash mode.
player->jumpfactor = skins[player->skin].jumpfactor; player->jumpfactor = skins[player->skin]->jumpfactor;
} }
} }
else if (P_IsObjectOnGround(player->mo)) // Activate dash mode if we're on the ground. else if (P_IsObjectOnGround(player->mo)) // Activate dash mode if we're on the ground.
{ {
if (player->normalspeed < skins[player->skin].normalspeed*2) // If the player normalspeed is not currently at normalspeed*2 in dash mode, add speed each tic if (player->normalspeed < skins[player->skin]->normalspeed*2) // If the player normalspeed is not currently at normalspeed*2 in dash mode, add speed each tic
player->normalspeed += FRACUNIT/5; // Enter Dash Mode smoothly. player->normalspeed += FRACUNIT/5; // Enter Dash Mode smoothly.
if (player->jumpfactor < FixedMul(skins[player->skin].jumpfactor, 5*FRACUNIT/4)) // Boost jump height. if (player->jumpfactor < FixedMul(skins[player->skin]->jumpfactor, 5*FRACUNIT/4)) // Boost jump height.
player->jumpfactor += FRACUNIT/300; player->jumpfactor += FRACUNIT/300;
} }
if (player->normalspeed >= skins[player->skin].normalspeed*2) if (player->normalspeed >= skins[player->skin]->normalspeed*2)
{ {
mobj_t *ghost = P_SpawnGhostMobj(player->mo); // Spawns afterimages mobj_t *ghost = P_SpawnGhostMobj(player->mo); // Spawns afterimages
ghost->fuse = 2; // Makes the images fade quickly ghost->fuse = 2; // Makes the images fade quickly
@ -12319,8 +12319,8 @@ void P_PlayerThink(player_t *player)
{ {
if (dashmode >= DASHMODE_THRESHOLD) // catch getting the flag! if (dashmode >= DASHMODE_THRESHOLD) // catch getting the flag!
{ {
player->normalspeed = skins[player->skin].normalspeed; player->normalspeed = skins[player->skin]->normalspeed;
player->jumpfactor = skins[player->skin].jumpfactor; player->jumpfactor = skins[player->skin]->jumpfactor;
S_StartSound(player->mo, sfx_kc65); S_StartSound(player->mo, sfx_kc65);
} }
dashmode = 0; dashmode = 0;

View file

@ -548,7 +548,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U
if (skinnum < 0 && skinnum > TC_DEFAULT) if (skinnum < 0 && skinnum > TC_DEFAULT)
I_Error("Invalid translation colormap index %d.", skinnum); I_Error("Invalid translation colormap index %d.", skinnum);
starttranscolor = (skinnum != TC_DEFAULT) ? skins[skinnum].starttranscolor : DEFAULT_STARTTRANSCOLOR; starttranscolor = (skinnum != TC_DEFAULT) ? skins[skinnum]->starttranscolor : DEFAULT_STARTTRANSCOLOR;
if (starttranscolor >= NUM_PALETTE_ENTRIES) if (starttranscolor >= NUM_PALETTE_ENTRIES)
I_Error("Invalid startcolor #%d.", starttranscolor); I_Error("Invalid startcolor #%d.", starttranscolor);

View file

@ -1612,7 +1612,7 @@ static void R_ParseSpriteInfo(boolean spr2)
for (i = 0; i < foundskins; i++) for (i = 0; i < foundskins; i++)
{ {
size_t skinnum = skinnumbers[i]; size_t skinnum = skinnumbers[i];
skin_t *skin = &skins[skinnum]; skin_t *skin = skins[skinnum];
spriteinfo_t *sprinfo = skin->sprinfo; spriteinfo_t *sprinfo = skin->sprinfo;
M_Memcpy(&sprinfo[spr2num], info, sizeof(spriteinfo_t)); M_Memcpy(&sprinfo[spr2num], info, sizeof(spriteinfo_t));
} }

View file

@ -33,7 +33,7 @@
#endif #endif
INT32 numskins = 0; INT32 numskins = 0;
skin_t *skins = NULL; skin_t **skins = NULL;
// //
// P_GetSkinSprite2 // P_GetSkinSprite2
@ -100,7 +100,7 @@ static void Sk_SetDefaultValue(skin_t *skin)
// //
memset(skin, 0, sizeof (skin_t)); memset(skin, 0, sizeof (skin_t));
snprintf(skin->name, snprintf(skin->name,
sizeof skin->name, "skin %u", (UINT32)(skin-skins)); sizeof skin->name, "skin %u", (UINT32)(skin->skinnum));
skin->name[sizeof skin->name - 1] = '\0'; skin->name[sizeof skin->name - 1] = '\0';
skin->wadnum = INT16_MAX; skin->wadnum = INT16_MAX;
@ -268,7 +268,7 @@ boolean R_SkinUsable(INT32 playernum, INT32 skinnum)
} }
} }
// returns true if the skin name is found (loaded from pwad) // returns the skin number if the skin name is found (loaded from pwad)
// warning return -1 if not found // warning return -1 if not found
INT32 R_SkinAvailable(const char *name) INT32 R_SkinAvailable(const char *name)
{ {
@ -277,8 +277,8 @@ INT32 R_SkinAvailable(const char *name)
for (i = 0; i < numskins; i++) for (i = 0; i < numskins; i++)
{ {
// search in the skin list // search in the skin list
if (stricmp(skins[i].name,name)==0) if (!stricmp(skins[i]->name,name))
return i; return skins[i]->skinnum;
} }
return -1; return -1;
} }
@ -286,7 +286,7 @@ INT32 R_SkinAvailable(const char *name)
// 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)
{ {
skin_t *skin = &skins[skinnum]; skin_t *skin = skins[skinnum];
UINT16 newcolor = 0; UINT16 newcolor = 0;
player->skin = skinnum; player->skin = skinnum;
@ -347,7 +347,7 @@ static void SetSkin(player_t *player, INT32 skinnum)
fixed_t radius = FixedMul(skin->radius, player->mo->scale); fixed_t radius = FixedMul(skin->radius, player->mo->scale);
if ((player->powers[pw_carry] == CR_NIGHTSMODE) && (skin->sprites[SPR2_NFLY].numframes == 0)) // If you don't have a sprite for flying horizontally, use the default NiGHTS skin. if ((player->powers[pw_carry] == CR_NIGHTSMODE) && (skin->sprites[SPR2_NFLY].numframes == 0)) // If you don't have a sprite for flying horizontally, use the default NiGHTS skin.
{ {
skin = &skins[DEFAULTNIGHTSSKIN]; skin = skins[DEFAULTNIGHTSSKIN];
player->followitem = skin->followitem; player->followitem = skin->followitem;
if (!(cv_debug || devparm) && !(netgame || multiplayer || demoplayback)) if (!(cv_debug || devparm) && !(netgame || multiplayer || demoplayback))
newcolor = skin->prefcolor; // will be updated in thinker to flashing newcolor = skin->prefcolor; // will be updated in thinker to flashing
@ -687,9 +687,10 @@ void R_AddSkins(UINT16 wadnum, boolean mainfile)
buf2[size] = '\0'; buf2[size] = '\0';
// set defaults // set defaults
skins = Z_Realloc(skins, sizeof(skin_t) * (numskins + 1), PU_STATIC, NULL); skins = Z_Realloc(skins, sizeof(skin_t*) * (numskins + 1), PU_STATIC, NULL);
skin = &skins[numskins]; skin = skins[numskins] = Z_Calloc(sizeof(skin_t), PU_STATIC, NULL);
Sk_SetDefaultValue(skin); Sk_SetDefaultValue(skin);
skin->skinnum = numskins;
skin->wadnum = wadnum; skin->wadnum = wadnum;
hudname = realname = false; hudname = realname = false;
// parse // parse
@ -785,11 +786,6 @@ next_token:
CONS_Printf(M_GetText("Added skin '%s'\n"), skin->name); CONS_Printf(M_GetText("Added skin '%s'\n"), skin->name);
numskins++; numskins++;
#ifdef HWRENDER
if (rendermode == render_opengl)
HWR_AddPlayerModel(numskins-1);
#endif
} }
return; return;
} }
@ -858,7 +854,7 @@ void R_PatchSkins(UINT16 wadnum, boolean mainfile)
strlwr(value); strlwr(value);
skinnum = R_SkinAvailable(value); skinnum = R_SkinAvailable(value);
if (skinnum != -1) if (skinnum != -1)
skin = &skins[skinnum]; skin = skins[skinnum];
else else
{ {
CONS_Debug(DBG_SETUP, "R_PatchSkins: unknown skin name in P_SKIN lump# %d(%s) in WAD %s\n", lump, W_CheckNameForNumPwad(wadnum,lump), wadfiles[wadnum]->filename); CONS_Debug(DBG_SETUP, "R_PatchSkins: unknown skin name in P_SKIN lump# %d(%s) in WAD %s\n", lump, W_CheckNameForNumPwad(wadnum,lump), wadfiles[wadnum]->filename);

View file

@ -32,6 +32,7 @@
typedef struct typedef struct
{ {
char name[SKINNAMESIZE+1]; // INT16 descriptive name of the skin char name[SKINNAMESIZE+1]; // INT16 descriptive name of the skin
UINT32 skinnum;
UINT16 wadnum; UINT16 wadnum;
skinflags_t flags; skinflags_t flags;
@ -84,7 +85,7 @@ typedef struct
/// Externs /// Externs
extern INT32 numskins; extern INT32 numskins;
extern skin_t *skins; extern skin_t **skins;
/// Function prototypes /// Function prototypes
void R_InitSkins(void); void R_InitSkins(void);

View file

@ -476,10 +476,6 @@ void R_AddSpriteDefs(UINT16 wadnum)
if (R_AddSingleSpriteDef(sprnames[i], &sprites[i], wadnum, start, end)) if (R_AddSingleSpriteDef(sprnames[i], &sprites[i], wadnum, start, end))
{ {
#ifdef HWRENDER
if (rendermode == render_opengl)
HWR_AddSpriteModel(i);
#endif
// if a new sprite was added (not just replaced) // if a new sprite was added (not just replaced)
addsprites++; addsprites++;
#ifndef ZDEBUG #ifndef ZDEBUG
@ -553,14 +549,10 @@ void R_InitSprites(void)
} }
ST_ReloadSkinFaceGraphics(); ST_ReloadSkinFaceGraphics();
// #ifdef HWRENDER
// check if all sprites have frames if (rendermode == render_opengl)
// HWR_LoadModels();
/* #endif
for (i = 0; i < numsprites; i++)
if (sprites[i].numframes < 1)
CONS_Debug(DBG_SETUP, "R_InitSprites: sprite %s has no frames at all\n", sprnames[i]);
*/
} }
// //
@ -772,8 +764,8 @@ UINT8 *R_GetSpriteTranslation(vissprite_t *vis)
} }
else if (!(vis->cut & SC_PRECIP) && vis->mobj->skin && vis->mobj->sprite == SPR_PLAY) // This thing is a player! else if (!(vis->cut & SC_PRECIP) && vis->mobj->skin && vis->mobj->sprite == SPR_PLAY) // This thing is a player!
{ {
size_t skinnum = (skin_t*)vis->mobj->skin-skins; INT32 skinnum = ((skin_t*)vis->mobj->skin)->skinnum;
return R_GetTranslationColormap((INT32)skinnum, vis->mobj->color, GTC_CACHE); return R_GetTranslationColormap(skinnum, vis->mobj->color, GTC_CACHE);
} }
else // Use the defaults else // Use the defaults
return R_GetTranslationColormap(TC_DEFAULT, vis->mobj->color, GTC_CACHE); return R_GetTranslationColormap(TC_DEFAULT, vis->mobj->color, GTC_CACHE);

View file

@ -345,14 +345,14 @@ void ST_LoadGraphics(void)
// made separate so that skins code can reload custom face graphics // made separate so that skins code can reload custom face graphics
void ST_LoadFaceGraphics(INT32 skinnum) void ST_LoadFaceGraphics(INT32 skinnum)
{ {
if (skins[skinnum].sprites[SPR2_XTRA].numframes > XTRA_LIFEPIC) if (skins[skinnum]->sprites[SPR2_XTRA].numframes > XTRA_LIFEPIC)
{ {
spritedef_t *sprdef = &skins[skinnum].sprites[SPR2_XTRA]; spritedef_t *sprdef = &skins[skinnum]->sprites[SPR2_XTRA];
spriteframe_t *sprframe = &sprdef->spriteframes[XTRA_LIFEPIC]; spriteframe_t *sprframe = &sprdef->spriteframes[XTRA_LIFEPIC];
faceprefix[skinnum] = W_CachePatchNum(sprframe->lumppat[0], PU_HUDGFX); faceprefix[skinnum] = W_CachePatchNum(sprframe->lumppat[0], PU_HUDGFX);
if (skins[skinnum].sprites[(SPR2_XTRA|FF_SPR2SUPER)].numframes > XTRA_LIFEPIC) if (skins[skinnum]->sprites[(SPR2_XTRA|FF_SPR2SUPER)].numframes > XTRA_LIFEPIC)
{ {
sprdef = &skins[skinnum].sprites[SPR2_XTRA|FF_SPR2SUPER]; sprdef = &skins[skinnum]->sprites[SPR2_XTRA|FF_SPR2SUPER];
sprframe = &sprdef->spriteframes[0]; sprframe = &sprdef->spriteframes[0];
superprefix[skinnum] = W_CachePatchNum(sprframe->lumppat[0], PU_HUDGFX); superprefix[skinnum] = W_CachePatchNum(sprframe->lumppat[0], PU_HUDGFX);
} }
@ -960,14 +960,14 @@ static void ST_drawLivesArea(void)
// name // name
v_colmap |= (V_HUDTRANS|hudinfo[HUD_LIVES].f|V_PERPLAYER); v_colmap |= (V_HUDTRANS|hudinfo[HUD_LIVES].f|V_PERPLAYER);
if (strlen(skins[stplyr->skin].hudname) <= 5) if (strlen(skins[stplyr->skin]->hudname) <= 5)
V_DrawRightAlignedString(hudinfo[HUD_LIVES].x+58, hudinfo[HUD_LIVES].y, v_colmap, skins[stplyr->skin].hudname); V_DrawRightAlignedString(hudinfo[HUD_LIVES].x+58, hudinfo[HUD_LIVES].y, v_colmap, skins[stplyr->skin]->hudname);
else if (V_StringWidth(skins[stplyr->skin].hudname, v_colmap) <= 48) else if (V_StringWidth(skins[stplyr->skin]->hudname, v_colmap) <= 48)
V_DrawString(hudinfo[HUD_LIVES].x+18, hudinfo[HUD_LIVES].y, v_colmap, skins[stplyr->skin].hudname); V_DrawString(hudinfo[HUD_LIVES].x+18, hudinfo[HUD_LIVES].y, v_colmap, skins[stplyr->skin]->hudname);
else if (V_ThinStringWidth(skins[stplyr->skin].hudname, v_colmap) <= 40) else if (V_ThinStringWidth(skins[stplyr->skin]->hudname, v_colmap) <= 40)
V_DrawRightAlignedThinString(hudinfo[HUD_LIVES].x+58, hudinfo[HUD_LIVES].y, v_colmap, skins[stplyr->skin].hudname); V_DrawRightAlignedThinString(hudinfo[HUD_LIVES].x+58, hudinfo[HUD_LIVES].y, v_colmap, skins[stplyr->skin]->hudname);
else else
V_DrawThinString(hudinfo[HUD_LIVES].x+18, hudinfo[HUD_LIVES].y, v_colmap, skins[stplyr->skin].hudname); V_DrawThinString(hudinfo[HUD_LIVES].x+18, hudinfo[HUD_LIVES].y, v_colmap, skins[stplyr->skin]->hudname);
// Power Stones collected // Power Stones collected
if (G_RingSlingerGametype() && LUA_HudEnabled(hud_powerstones)) if (G_RingSlingerGametype() && LUA_HudEnabled(hud_powerstones))

View file

@ -1041,9 +1041,9 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
// //
void V_DrawContinueIcon(INT32 x, INT32 y, INT32 flags, INT32 skinnum, UINT16 skincolor) void V_DrawContinueIcon(INT32 x, INT32 y, INT32 flags, INT32 skinnum, UINT16 skincolor)
{ {
if (skinnum >= 0 && skinnum < numskins && skins[skinnum].sprites[SPR2_XTRA].numframes > XTRA_CONTINUE) if (skinnum >= 0 && skinnum < numskins && skins[skinnum]->sprites[SPR2_XTRA].numframes > XTRA_CONTINUE)
{ {
spritedef_t *sprdef = &skins[skinnum].sprites[SPR2_XTRA]; spritedef_t *sprdef = &skins[skinnum]->sprites[SPR2_XTRA];
spriteframe_t *sprframe = &sprdef->spriteframes[XTRA_CONTINUE]; spriteframe_t *sprframe = &sprdef->spriteframes[XTRA_CONTINUE];
patch_t *patch = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH); patch_t *patch = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
const UINT8 *colormap = R_GetTranslationColormap(skinnum, skincolor, GTC_CACHE); const UINT8 *colormap = R_GetTranslationColormap(skinnum, skincolor, GTC_CACHE);

View file

@ -1358,22 +1358,22 @@ void Y_StartIntermission(void)
else else
{ {
// too long so just show "YOU GOT THROUGH THE ACT" // too long so just show "YOU GOT THROUGH THE ACT"
if (strlen(skins[players[consoleplayer].skin].realname) > 13) if (strlen(skins[players[consoleplayer].skin]->realname) > 13)
{ {
strcpy(data.coop.passed1, "you got"); strcpy(data.coop.passed1, "you got");
strcpy(data.coop.passed2, (mapheaderinfo[gamemap-1]->actnum) ? "through act" : "through the act"); strcpy(data.coop.passed2, (mapheaderinfo[gamemap-1]->actnum) ? "through act" : "through the act");
} }
// long enough that "X GOT" won't fit so use "X PASSED THE ACT" // long enough that "X GOT" won't fit so use "X PASSED THE ACT"
else if (strlen(skins[players[consoleplayer].skin].realname) > 8) else if (strlen(skins[players[consoleplayer].skin]->realname) > 8)
{ {
strcpy(data.coop.passed1, skins[players[consoleplayer].skin].realname); strcpy(data.coop.passed1, skins[players[consoleplayer].skin]->realname);
strcpy(data.coop.passed2, (mapheaderinfo[gamemap-1]->actnum) ? "passed act" : "passed the act"); strcpy(data.coop.passed2, (mapheaderinfo[gamemap-1]->actnum) ? "passed act" : "passed the act");
} }
// length is okay for normal use // length is okay for normal use
else else
{ {
snprintf(data.coop.passed1, sizeof data.coop.passed1, "%s got", snprintf(data.coop.passed1, sizeof data.coop.passed1, "%s got",
skins[players[consoleplayer].skin].realname); skins[players[consoleplayer].skin]->realname);
strcpy(data.coop.passed2, (mapheaderinfo[gamemap-1]->actnum) ? "through act" : "through the act"); strcpy(data.coop.passed2, (mapheaderinfo[gamemap-1]->actnum) ? "through act" : "through the act");
} }
} }
@ -1445,7 +1445,7 @@ void Y_StartIntermission(void)
{ {
snprintf(data.spec.passed1, snprintf(data.spec.passed1,
sizeof data.spec.passed1, "%s", sizeof data.spec.passed1, "%s",
skins[players[consoleplayer].skin].realname); skins[players[consoleplayer].skin]->realname);
data.spec.passed1[sizeof data.spec.passed1 - 1] = '\0'; data.spec.passed1[sizeof data.spec.passed1 - 1] = '\0';
strcpy(data.spec.passed2, "got them all!"); strcpy(data.spec.passed2, "got them all!");
@ -1454,17 +1454,17 @@ void Y_StartIntermission(void)
strcpy(data.spec.passed3, "can now become"); strcpy(data.spec.passed3, "can now become");
snprintf(data.spec.passed4, snprintf(data.spec.passed4,
sizeof data.spec.passed4, "Super %s", sizeof data.spec.passed4, "Super %s",
skins[players[consoleplayer].skin].realname); skins[players[consoleplayer].skin]->realname);
data.spec.passed4[sizeof data.spec.passed4 - 1] = '\0'; data.spec.passed4[sizeof data.spec.passed4 - 1] = '\0';
} }
} }
else else
{ {
if (strlen(skins[players[consoleplayer].skin].realname) <= SKINNAMESIZE-5) if (strlen(skins[players[consoleplayer].skin]->realname) <= SKINNAMESIZE-5)
{ {
snprintf(data.spec.passed1, snprintf(data.spec.passed1,
sizeof data.spec.passed1, "%s got", sizeof data.spec.passed1, "%s got",
skins[players[consoleplayer].skin].realname); skins[players[consoleplayer].skin]->realname);
data.spec.passed1[sizeof data.spec.passed1 - 1] = '\0'; data.spec.passed1[sizeof data.spec.passed1 - 1] = '\0';
} }
else else