mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Memory management fixes
Date: Mon Aug 9 15:57:07 2021 -0300
This commit is contained in:
parent
f2472d88b8
commit
2aa9bb59ef
32 changed files with 303 additions and 420 deletions
|
@ -1944,7 +1944,7 @@ static void CV_SetValueMaybeStealth(consvar_t *var, INT32 value, boolean stealth
|
|||
if ((value < 0) || (value >= numskins))
|
||||
tmpskin = "None";
|
||||
else
|
||||
tmpskin = skins[value].name;
|
||||
tmpskin = skins[value]->name;
|
||||
strncpy(val, tmpskin, SKINNAMESIZE);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1187,9 +1187,9 @@ static void ForceAllSkins(INT32 forcedskin)
|
|||
if (!dedicated) // But don't do this for dedicated servers, of course.
|
||||
{
|
||||
if (i == consoleplayer)
|
||||
CV_StealthSet(&cv_skin, skins[forcedskin].name);
|
||||
CV_StealthSet(&cv_skin, skins[forcedskin]->name);
|
||||
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);
|
||||
else if (skincolors[atoi(cv_playercolor.defaultvalue)].accessible)
|
||||
CV_StealthSet(&cv_playercolor, cv_playercolor.defaultvalue);
|
||||
else if (skins[players[consoleplayer].skin].prefcolor && skincolors[skins[players[consoleplayer].skin].prefcolor].accessible)
|
||||
CV_StealthSetValue(&cv_playercolor, skins[players[consoleplayer].skin].prefcolor);
|
||||
else if (skins[players[consoleplayer].skin]->prefcolor && skincolors[skins[players[consoleplayer].skin]->prefcolor].accessible)
|
||||
CV_StealthSetValue(&cv_playercolor, skins[players[consoleplayer].skin]->prefcolor);
|
||||
else {
|
||||
UINT16 i = 0;
|
||||
while (i<numskincolors && !skincolors[i].accessible) i++;
|
||||
|
@ -1232,7 +1232,7 @@ static void SendNameAndColor(void)
|
|||
|
||||
if (!strcmp(cv_playername.string, player_names[consoleplayer])
|
||||
&& 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;
|
||||
|
||||
players[consoleplayer].availabilities = R_GetSkinAvailabilities();
|
||||
|
@ -1257,7 +1257,7 @@ static void SendNameAndColor(void)
|
|||
if (metalrecording)
|
||||
{ // Starring Metal Sonic as themselves, obviously.
|
||||
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))
|
||||
{
|
||||
|
@ -1268,11 +1268,11 @@ static void SendNameAndColor(void)
|
|||
//notsame = (cv_skin.value != players[consoleplayer].skin);
|
||||
|
||||
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)
|
||||
{
|
||||
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;
|
||||
|
||||
|
@ -1283,7 +1283,7 @@ static void SendNameAndColor(void)
|
|||
else
|
||||
{
|
||||
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
|
||||
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.
|
||||
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
|
||||
// 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))
|
||||
{
|
||||
INT32 defaultSkinNum = GetPlayerDefaultSkin(consoleplayer);
|
||||
CV_StealthSet(&cv_skin, skins[defaultSkinNum].name);
|
||||
CV_StealthSet(&cv_skin, skins[defaultSkinNum]->name);
|
||||
cv_skin.value = defaultSkinNum;
|
||||
}
|
||||
|
||||
|
@ -1355,8 +1355,8 @@ static void SendNameAndColor2(void)
|
|||
CV_StealthSetValue(&cv_playercolor2, players[secondplaya].skincolor);
|
||||
else if (skincolors[atoi(cv_playercolor2.defaultvalue)].accessible)
|
||||
CV_StealthSet(&cv_playercolor, cv_playercolor2.defaultvalue);
|
||||
else if (skins[players[secondplaya].skin].prefcolor && skincolors[skins[players[secondplaya].skin].prefcolor].accessible)
|
||||
CV_StealthSetValue(&cv_playercolor2, skins[players[secondplaya].skin].prefcolor);
|
||||
else if (skins[players[secondplaya].skin]->prefcolor && skincolors[skins[players[secondplaya].skin]->prefcolor].accessible)
|
||||
CV_StealthSetValue(&cv_playercolor2, skins[players[secondplaya].skin]->prefcolor);
|
||||
else {
|
||||
UINT16 i = 0;
|
||||
while (i<numskincolors && !skincolors[i].accessible) i++;
|
||||
|
@ -1397,7 +1397,7 @@ static void SendNameAndColor2(void)
|
|||
const INT32 forcedskin = cv_forceskin.value;
|
||||
|
||||
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))
|
||||
{
|
||||
|
@ -1408,11 +1408,11 @@ static void SendNameAndColor2(void)
|
|||
//notsame = (cv_skin2.value != players[secondplaya].skin);
|
||||
|
||||
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)
|
||||
{
|
||||
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;
|
||||
|
||||
|
@ -1423,7 +1423,7 @@ static void SendNameAndColor2(void)
|
|||
else
|
||||
{
|
||||
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
|
||||
SetPlayerSkin(secondplaya, cv_skin2.string);
|
||||
}
|
||||
|
@ -1512,7 +1512,7 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
|||
{
|
||||
illegalMask &= ~(1 << i);
|
||||
}
|
||||
|
||||
|
||||
if ((p->availabilities & illegalMask) != 0)
|
||||
{
|
||||
kick = true;
|
||||
|
@ -1534,9 +1534,9 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
|||
SetPlayerSkinByNum(playernum, forcedskin);
|
||||
|
||||
if (playernum == consoleplayer)
|
||||
CV_StealthSet(&cv_skin, skins[forcedskin].name);
|
||||
CV_StealthSet(&cv_skin, skins[forcedskin]->name);
|
||||
else if (playernum == secondarydisplayplayer)
|
||||
CV_StealthSet(&cv_skin2, skins[forcedskin].name);
|
||||
CV_StealthSet(&cv_skin2, skins[forcedskin]->name);
|
||||
}
|
||||
else
|
||||
SetPlayerSkinByNum(playernum, skin);
|
||||
|
@ -2112,7 +2112,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
|||
if (modeattacking)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -4467,7 +4467,7 @@ static void ForceSkin_OnChange(void)
|
|||
CONS_Printf("The server has lifted the forced skin restrictions.\n");
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -4508,7 +4508,7 @@ static void Skin_OnChange(void)
|
|||
if (!(cv_debug || devparm) && !(multiplayer || netgame) // In single player.
|
||||
&& (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;
|
||||
}
|
||||
|
||||
|
@ -4517,7 +4517,7 @@ static void Skin_OnChange(void)
|
|||
else
|
||||
{
|
||||
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
|
||||
{
|
||||
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.
|
||||
{
|
||||
CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin].name);
|
||||
CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin]->name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1055,7 +1055,7 @@ void readspriteinfo(MYFILE *f, INT32 num, boolean sprite2)
|
|||
for (i = 0; i < foundskins; i++)
|
||||
{
|
||||
size_t skinnum = skinnumbers[i];
|
||||
skin_t *skin = &skins[skinnum];
|
||||
skin_t *skin = skins[skinnum];
|
||||
spriteinfo_t *sprinfo = skin->sprinfo;
|
||||
M_Memcpy(&sprinfo[num], info, sizeof(spriteinfo_t));
|
||||
}
|
||||
|
|
|
@ -1624,9 +1624,9 @@ void F_GameEvaluationDrawer(void)
|
|||
rtatext = (marathonmode & MA_INGAME) ? "In-game timer" : "RTA timer";
|
||||
cuttext = (marathonmode & MA_NOCUTSCENES) ? "" : " w/ cutscenes";
|
||||
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
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -1748,9 +1748,9 @@ static void F_CacheEnding(void)
|
|||
UINT8 skinnum = players[consoleplayer].skin;
|
||||
spritedef_t *sprdef;
|
||||
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
|
||||
sprframe = &sprdef->spriteframes[XTRA_ENDING];
|
||||
endfwrk[0] = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH_LOWPRIORITY);
|
||||
|
@ -2196,7 +2196,7 @@ void F_EndingDrawer(void)
|
|||
boolean donttouch = false;
|
||||
const char *str;
|
||||
if (goodending)
|
||||
str = va("[S] %s: Engage.", skins[players[consoleplayer].skin].realname);
|
||||
str = va("[S] %s: Engage.", skins[players[consoleplayer].skin]->realname);
|
||||
else
|
||||
str = "[S] Eggman: Abscond.";
|
||||
|
||||
|
@ -3576,7 +3576,7 @@ void F_StartContinue(void)
|
|||
S_ChangeMusicInternal("_conti", false);
|
||||
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][2] = contskins[0]->contangle & 7;
|
||||
contcolormaps[0] = R_GetTranslationColormap(players[consoleplayer].skin, players[consoleplayer].skincolor, GTC_CACHE);
|
||||
|
@ -3592,7 +3592,7 @@ void F_StartContinue(void)
|
|||
else // HACK
|
||||
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][2] = (contskins[1]->contangle >> 3) & 7;
|
||||
contcolormaps[1] = R_GetTranslationColormap(players[secondplaya].skin, players[secondplaya].skincolor, GTC_CACHE);
|
||||
|
|
18
src/g_demo.c
18
src/g_demo.c
|
@ -488,7 +488,7 @@ void G_WriteGhostTic(mobj_t *ghost)
|
|||
if (ghost->player->followmobj->colorized)
|
||||
followtic |= FZT_COLORIZED;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -757,7 +757,7 @@ void G_GhostTicker(void)
|
|||
g->mo->color = SKINCOLOR_WHITE;
|
||||
break;
|
||||
case GHC_NIGHTSSKIN: // not actually a colour
|
||||
g->mo->skin = &skins[DEFAULTNIGHTSSKIN];
|
||||
g->mo->skin = skins[DEFAULTNIGHTSSKIN];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -900,7 +900,7 @@ void G_GhostTicker(void)
|
|||
follow->colorized = true;
|
||||
|
||||
if (followtic & FZT_SKIN)
|
||||
follow->skin = &skins[READUINT8(g->p)];
|
||||
follow->skin = skins[READUINT8(g->p)];
|
||||
}
|
||||
if (follow)
|
||||
{
|
||||
|
@ -1144,7 +1144,7 @@ void G_ReadMetalTic(mobj_t *metal)
|
|||
follow->colorized = true;
|
||||
|
||||
if (followtic & FZT_SKIN)
|
||||
follow->skin = &skins[READUINT8(metal_p)];
|
||||
follow->skin = skins[READUINT8(metal_p)];
|
||||
}
|
||||
if (follow)
|
||||
{
|
||||
|
@ -1329,7 +1329,7 @@ void G_WriteMetalTic(mobj_t *metal)
|
|||
if (metal->player->followmobj->colorized)
|
||||
followtic |= FZT_COLORIZED;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -1976,7 +1976,7 @@ void G_DoPlayDemo(char *defdemoname)
|
|||
G_InitNew(false, G_BuildMapName(gamemap), true, true, false);
|
||||
|
||||
// Set color
|
||||
players[0].skincolor = skins[players[0].skin].prefcolor;
|
||||
players[0].skincolor = skins[players[0].skin]->prefcolor;
|
||||
for (i = 0; i < numskincolors; i++)
|
||||
if (!stricmp(skincolors[i].name,color))
|
||||
{
|
||||
|
@ -2221,11 +2221,11 @@ void G_AddGhost(char *defdemoname)
|
|||
gh->oldmo.z = gh->mo->z;
|
||||
|
||||
// Set skin
|
||||
gh->mo->skin = &skins[0];
|
||||
gh->mo->skin = skins[0];
|
||||
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;
|
||||
}
|
||||
gh->oldmo.skin = gh->mo->skin;
|
||||
|
|
22
src/g_game.c
22
src/g_game.c
|
@ -582,14 +582,14 @@ static void G_UpdateRecordReplays(void)
|
|||
I_Error("Out of memory for replay filepath\n");
|
||||
|
||||
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))
|
||||
{
|
||||
UINT8 *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)
|
||||
{ // Better time, save this demo.
|
||||
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);
|
||||
}
|
||||
|
||||
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)))
|
||||
{ // Better score, save this demo.
|
||||
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);
|
||||
}
|
||||
|
||||
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)))
|
||||
{ // Better rings, save this demo.
|
||||
if (FIL_FileExists(bestdemo))
|
||||
|
@ -704,14 +704,14 @@ void G_SetNightsRecords(void)
|
|||
I_Error("Out of memory for replay filepath\n");
|
||||
|
||||
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))
|
||||
{
|
||||
UINT8 *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)
|
||||
{ // Better time, save this demo.
|
||||
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);
|
||||
}
|
||||
|
||||
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)))
|
||||
{ // Better score, save this demo.
|
||||
if (FIL_FileExists(bestdemo))
|
||||
|
@ -4733,7 +4733,7 @@ cleanup:
|
|||
//
|
||||
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;
|
||||
|
||||
if (demoplayback)
|
||||
|
@ -4746,7 +4746,7 @@ void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, b
|
|||
if (savedata.lives > 0)
|
||||
{
|
||||
if ((botingame = ((botskin = savedata.botskin) != 0)))
|
||||
botcolor = skins[botskin-1].prefcolor;
|
||||
botcolor = skins[botskin-1]->prefcolor;
|
||||
}
|
||||
else if (splitscreen != SSSG)
|
||||
{
|
||||
|
@ -4754,9 +4754,9 @@ void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, b
|
|||
SplitScreen_OnChange();
|
||||
}
|
||||
|
||||
color = skins[pickedchar].prefcolor;
|
||||
color = skins[pickedchar]->prefcolor;
|
||||
SetPlayerSkinByNum(consoleplayer, pickedchar);
|
||||
CV_StealthSet(&cv_skin, skins[pickedchar].name);
|
||||
CV_StealthSet(&cv_skin, skins[pickedchar]->name);
|
||||
CV_StealthSetValue(&cv_playercolor, color);
|
||||
|
||||
if (mapname)
|
||||
|
|
|
@ -4870,7 +4870,7 @@ static void HWR_DrawSprites(void)
|
|||
|
||||
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);
|
||||
else
|
||||
{
|
||||
|
@ -4880,7 +4880,7 @@ static void HWR_DrawSprites(void)
|
|||
}
|
||||
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);
|
||||
else
|
||||
{
|
||||
|
@ -5029,11 +5029,11 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
|||
if (cv_glmodels.value) //Yellow: Only MD2's dont disappear
|
||||
{
|
||||
if (thing->skin && thing->sprite == SPR_PLAY)
|
||||
md2 = &md2_playermodels[( (skin_t *)thing->skin - skins )];
|
||||
md2 = &md2_playermodels[((skin_t *)thing->skin)->skinnum];
|
||||
else
|
||||
md2 = &md2_models[thing->sprite];
|
||||
|
||||
if (md2->notfound || md2->scale < 0.0f)
|
||||
if (!md2->found || md2->scale < 0.0f)
|
||||
return;
|
||||
}
|
||||
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!
|
||||
{
|
||||
size_t skinnum = (skin_t*)thing->skin-skins;
|
||||
vis->colormap = R_GetTranslationColormap((INT32)skinnum, thing->color, GTC_CACHE);
|
||||
INT32 skinnum = ((skin_t*)thing->skin)->skinnum;
|
||||
vis->colormap = R_GetTranslationColormap(skinnum, thing->color, GTC_CACHE);
|
||||
}
|
||||
else
|
||||
vis->colormap = R_GetTranslationColormap(TC_DEFAULT, vis->mobj->color ? vis->mobj->color : SKINCOLOR_CYAN, GTC_CACHE);
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "../m_misc.h"
|
||||
#include "../w_wad.h"
|
||||
#include "../z_zone.h"
|
||||
#include "../r_state.h"
|
||||
#include "../r_things.h"
|
||||
#include "../r_draw.h"
|
||||
#include "../p_tick.h"
|
||||
|
@ -72,6 +73,7 @@
|
|||
|
||||
md2_t md2_models[NUMSPRITES];
|
||||
md2_t *md2_playermodels = NULL;
|
||||
size_t md2_numplayermodels = 0;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -483,28 +485,6 @@ static boolean nomd2s = false;
|
|||
void HWR_InitModels(void)
|
||||
{
|
||||
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++)
|
||||
{
|
||||
|
@ -513,82 +493,23 @@ void HWR_InitModels(void)
|
|||
md2_models[i].grpatch = NULL;
|
||||
md2_models[i].notexturefile = false;
|
||||
md2_models[i].noblendfile = false;
|
||||
md2_models[i].skin = -1;
|
||||
md2_models[i].notfound = true;
|
||||
md2_models[i].found = false;
|
||||
md2_models[i].error = false;
|
||||
}
|
||||
|
||||
// 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 (!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);
|
||||
if (numsprites && numskins)
|
||||
HWR_LoadModels();
|
||||
}
|
||||
|
||||
void HWR_AddPlayerModel(INT32 skin) // For skins that were added after startup
|
||||
void HWR_LoadModels(void)
|
||||
{
|
||||
size_t i;
|
||||
INT32 s;
|
||||
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;
|
||||
size_t prefixlen;
|
||||
|
@ -596,7 +517,23 @@ void HWR_AddPlayerModel(INT32 skin) // For skins that were added after startup
|
|||
if (nomd2s)
|
||||
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
|
||||
//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
|
||||
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)
|
||||
{
|
||||
char *skinname = name;
|
||||
size_t len = strlen(name);
|
||||
|
||||
// ignore the player model prefix.
|
||||
// Check for the player model prefix.
|
||||
if (!strnicmp(name, PLAYERMODELPREFIX, prefixlen) && (len > prefixlen))
|
||||
{
|
||||
skinname += prefixlen;
|
||||
|
||||
if (stricmp(skinname, skins[skin].name) == 0)
|
||||
{
|
||||
md2_playermodels[skin].skin = skin;
|
||||
md2_playermodels[skin].scale = scale;
|
||||
md2_playermodels[skin].offset = offset;
|
||||
md2_playermodels[skin].notfound = false;
|
||||
strcpy(md2_playermodels[skin].filename, filename);
|
||||
goto playermodelfound;
|
||||
goto addskinmodel;
|
||||
}
|
||||
|
||||
// Add sprite models.
|
||||
// Must be 4 characters long exactly. Otherwise, it's not a sprite name.
|
||||
if (len == 4)
|
||||
{
|
||||
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].found = true;
|
||||
strcpy(md2_models[i].filename, filename);
|
||||
goto modelfound;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addskinmodel:
|
||||
// Add player models.
|
||||
for (s = 0; s < numskins; s++)
|
||||
{
|
||||
if (stricmp(skinname, skins[s]->name) == 0)
|
||||
{
|
||||
md2_playermodels[s].scale = scale;
|
||||
md2_playermodels[s].offset = offset;
|
||||
md2_playermodels[s].found = true;
|
||||
strcpy(md2_playermodels[s].filename, filename);
|
||||
goto modelfound;
|
||||
}
|
||||
}
|
||||
|
||||
modelfound:
|
||||
// Move on to the next line...
|
||||
continue;
|
||||
}
|
||||
|
||||
md2_playermodels[skin].notfound = true;
|
||||
playermodelfound:
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
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 (!f)
|
||||
{
|
||||
CONS_Printf("%s %s\n", M_GetText("Error while loading models.dat:"), strerror(errno));
|
||||
nomd2s = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Check for any models that match the names of sprite names!
|
||||
while (fscanf(f, "%25s %31s %f %f", name, filename, &scale, &offset) == 4)
|
||||
{
|
||||
// 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;
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -1369,8 +1271,8 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
|||
// 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
|
||||
{
|
||||
md2 = &md2_playermodels[(skin_t*)spr->mobj->skin-skins];
|
||||
md2->skin = (skin_t*)spr->mobj->skin-skins;
|
||||
INT32 skinnum = ((skin_t*)spr->mobj->skin)->skinnum;
|
||||
md2 = &md2_playermodels[skinnum];
|
||||
sprinfo = &((skin_t *)spr->mobj->skin)->sprinfo[spr->mobj->sprite2];
|
||||
}
|
||||
else
|
||||
|
@ -1468,7 +1370,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
|||
skinnum = TC_RAINBOW;
|
||||
}
|
||||
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
|
||||
skinnum = TC_DEFAULT;
|
||||
}
|
||||
|
|
|
@ -31,17 +31,17 @@ typedef struct
|
|||
boolean notexturefile; // true if texture file was not found
|
||||
void *blendgrpatch;
|
||||
boolean noblendfile; // true if blend texture file was not found
|
||||
boolean notfound;
|
||||
INT32 skin;
|
||||
boolean found;
|
||||
boolean error;
|
||||
} md2_t;
|
||||
|
||||
extern md2_t md2_models[NUMSPRITES];
|
||||
extern md2_t *md2_playermodels;
|
||||
extern size_t md2_numplayermodels;
|
||||
|
||||
void HWR_InitModels(void);
|
||||
void HWR_AddPlayerModel(INT32 skin);
|
||||
void HWR_AddSpriteModel(size_t spritenum);
|
||||
void HWR_LoadModels(void);
|
||||
|
||||
boolean HWR_DrawModel(gl_vissprite_t *spr);
|
||||
|
||||
#define PLAYERMODELPREFIX "PLAYER"
|
||||
|
|
|
@ -328,8 +328,8 @@ model_t *MD2_LoadModel(const char *fileName, int ztag, boolean useFloat)
|
|||
texcoords = (md2texcoord_t*)&buffer[header->offsetST];
|
||||
frames = (md2frame_t*)&buffer[header->offsetFrames];
|
||||
|
||||
retModel->framenames = (char*)Z_Calloc(header->numFrames*16, ztag, 0);
|
||||
fname = retModel->framenames;
|
||||
retModel->frameNames = (char*)Z_Calloc(header->numFrames*16, ztag, 0);
|
||||
fname = retModel->frameNames;
|
||||
for (i = 0; i < header->numFrames; i++)
|
||||
{
|
||||
md2frame_t *fr = (md2frame_t*)&buffer[header->offsetFrames + foffset];
|
||||
|
|
|
@ -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);
|
||||
|
||||
frames = (md3Frame*)&buffer[mdh->offsetFrames];
|
||||
retModel->framenames = (char*)Z_Calloc(mdh->numFrames*16, ztag, 0);
|
||||
fname = retModel->framenames;
|
||||
retModel->frameNames = (char*)Z_Calloc(mdh->numFrames*16, ztag, 0);
|
||||
fname = retModel->frameNames;
|
||||
for (i = 0; i < mdh->numFrames; i++)
|
||||
{
|
||||
memcpy(fname, frames->name, 16);
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "../doomtype.h"
|
||||
#include "../info.h"
|
||||
#include "../r_skins.h"
|
||||
#include "../r_state.h"
|
||||
#include "../z_zone.h"
|
||||
#include "hw_model.h"
|
||||
#include "hw_md2load.h"
|
||||
|
@ -142,9 +143,7 @@ tag_t *GetTagByName(model_t *model, char *name, int frame)
|
|||
//
|
||||
// LoadModel
|
||||
//
|
||||
// Load a model and
|
||||
// convert it to the
|
||||
// internal format.
|
||||
// Load a model and convert it to the internal format.
|
||||
//
|
||||
model_t *LoadModel(const char *filename, int ztag)
|
||||
{
|
||||
|
@ -194,9 +193,6 @@ model_t *LoadModel(const char *filename, int ztag)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
model->mdlFilename = (char*)Z_Malloc(strlen(filename)+1, ztag, 0);
|
||||
strcpy(model->mdlFilename, filename);
|
||||
|
||||
Optimize(model);
|
||||
GeneratePolygonNormals(model, ztag);
|
||||
LoadModelSprite2(model);
|
||||
|
@ -237,17 +233,16 @@ model_t *LoadModel(const char *filename, int ztag)
|
|||
void HWR_ReloadModels(void)
|
||||
{
|
||||
size_t i;
|
||||
INT32 s;
|
||||
|
||||
if (md2_playermodels != NULL)
|
||||
for (s = 0; s < numskins; s++)
|
||||
{
|
||||
CONS_Printf("%u\n", s);
|
||||
if (md2_playermodels[s].model)
|
||||
LoadModelSprite2(md2_playermodels[s].model);
|
||||
}
|
||||
HWR_LoadModels();
|
||||
|
||||
for (i = 0; i < NUMSPRITES; i++)
|
||||
for (i = 0; i < md2_numplayermodels; i++)
|
||||
{
|
||||
if (md2_playermodels[i].model)
|
||||
LoadModelSprite2(md2_playermodels[i].model);
|
||||
}
|
||||
|
||||
for (i = 0; i < numsprites; i++)
|
||||
{
|
||||
if (md2_models[i].model)
|
||||
LoadModelInterpolationSettings(md2_models[i].model);
|
||||
|
@ -258,7 +253,7 @@ void LoadModelInterpolationSettings(model_t *model)
|
|||
{
|
||||
INT32 i;
|
||||
INT32 numframes = model->meshes[0].numFrames;
|
||||
char *framename = model->framenames;
|
||||
char *framename = model->frameNames;
|
||||
|
||||
if (!framename)
|
||||
return;
|
||||
|
@ -298,7 +293,7 @@ void LoadModelSprite2(model_t *model)
|
|||
INT32 i;
|
||||
modelspr2frames_t *spr2frames = NULL;
|
||||
INT32 numframes = model->meshes[0].numFrames;
|
||||
char *framename = model->framenames;
|
||||
char *framename = model->frameNames;
|
||||
|
||||
if (!framename)
|
||||
return;
|
||||
|
|
|
@ -91,17 +91,14 @@ typedef struct model_s
|
|||
{
|
||||
int maxNumFrames;
|
||||
|
||||
int numMaterials;
|
||||
material_t *materials;
|
||||
int numMeshes;
|
||||
mesh_t *meshes;
|
||||
int numMaterials;
|
||||
material_t *materials;
|
||||
int numTags;
|
||||
tag_t *tags;
|
||||
|
||||
char *mdlFilename;
|
||||
boolean unloaded;
|
||||
|
||||
char *framenames;
|
||||
char *frameNames;
|
||||
boolean interpolate[256];
|
||||
modelspr2frames_t *spr2frames;
|
||||
|
||||
|
|
|
@ -2240,7 +2240,7 @@ void HU_Erase(void)
|
|||
// 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))
|
||||
|
||||
//
|
||||
|
|
|
@ -501,7 +501,7 @@ static int libd_getSprite2Patch(lua_State *L)
|
|||
{
|
||||
const char *name = luaL_checkstring(L, 1);
|
||||
for (i = 0; i < numskins; i++)
|
||||
if (fastcmp(skins[i].name, name))
|
||||
if (fastcmp(skins[i]->name, name))
|
||||
break;
|
||||
if (i >= numskins)
|
||||
return 0;
|
||||
|
@ -543,9 +543,9 @@ static int libd_getSprite2Patch(lua_State *L)
|
|||
if (super)
|
||||
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
|
||||
frame = luaL_optinteger(L, 2, 0);
|
||||
|
@ -573,7 +573,7 @@ static int libd_getSprite2Patch(lua_State *L)
|
|||
INT32 rot = R_GetRollAngle(rollangle);
|
||||
|
||||
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_pushboolean(L, false);
|
||||
lua_pushboolean(L, true);
|
||||
|
|
|
@ -638,10 +638,10 @@ static int mobj_set(lua_State *L)
|
|||
strlcpy(skin, luaL_checkstring(L, 3), sizeof skin);
|
||||
strlwr(skin); // all skin names are lowercase
|
||||
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))
|
||||
mo->skin = &skins[i];
|
||||
mo->skin = skins[i];
|
||||
return 0;
|
||||
}
|
||||
return luaL_error(L, "mobj.skin '%s' not found!", skin);
|
||||
|
|
|
@ -226,7 +226,7 @@ static int skin_num(lua_State *L)
|
|||
// skins are always valid, only added, never removed
|
||||
I_Assert(skin != NULL);
|
||||
|
||||
lua_pushinteger(L, skin-skins);
|
||||
lua_pushinteger(L, skin->skinnum);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -245,14 +245,14 @@ static int lib_iterateSkins(lua_State *L)
|
|||
lua_remove(L, 1); // state is unused.
|
||||
|
||||
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
|
||||
i = 0;
|
||||
|
||||
// skins are always valid, only added, never removed
|
||||
if (i < numskins)
|
||||
{
|
||||
LUA_PushUserdata(L, &skins[i], META_SKIN);
|
||||
LUA_PushUserdata(L, skins[i], META_SKIN);
|
||||
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);
|
||||
if (i >= numskins)
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &skins[i], META_SKIN);
|
||||
LUA_PushUserdata(L, skins[i], META_SKIN);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -287,9 +287,9 @@ static int lib_getSkin(lua_State *L)
|
|||
|
||||
// find skin by name
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
66
src/m_menu.c
66
src/m_menu.c
|
@ -2311,7 +2311,7 @@ void Nextmap_OnChange(void)
|
|||
SP_NightsAttackMenu[naghost].status = IT_DISABLED;
|
||||
|
||||
// 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
|
||||
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;
|
||||
|
||||
// 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++) {
|
||||
SP_ReplayMenu[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);
|
||||
if (skinno != -1)
|
||||
CV_SetValue(cv,skins[skinno].prefcolor);
|
||||
CV_SetValue(cv,skins[skinno]->prefcolor);
|
||||
return;
|
||||
}
|
||||
CV_Set(cv,cv->defaultvalue);
|
||||
|
@ -4993,9 +4993,9 @@ static void M_PatchSkinNameTable(void)
|
|||
|
||||
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;
|
||||
}
|
||||
else
|
||||
|
@ -8397,7 +8397,7 @@ static void M_DrawLoadGameData(void)
|
|||
savetodraw--;
|
||||
|
||||
if (savegameinfo[savetodraw].lives > 0)
|
||||
charskin = &skins[savegameinfo[savetodraw].skinnum];
|
||||
charskin = skins[savegameinfo[savetodraw].skinnum];
|
||||
|
||||
// signpost background
|
||||
{
|
||||
|
@ -8531,7 +8531,7 @@ static void M_DrawLoadGameData(void)
|
|||
// botskin first
|
||||
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];
|
||||
if (!sprdef->numframes)
|
||||
goto skipbot;
|
||||
|
@ -9091,9 +9091,9 @@ static void M_CacheCharacterSelectEntry(INT32 i, INT32 skinnum)
|
|||
{
|
||||
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];
|
||||
description[i].charpic = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
}
|
||||
|
@ -9308,7 +9308,7 @@ static void M_DrawSetupChoosePlayerMenu(void)
|
|||
{
|
||||
const INT32 my = 16;
|
||||
|
||||
skin_t *charskin = &skins[0];
|
||||
skin_t *charskin = skins[0];
|
||||
INT32 skinnum = 0;
|
||||
UINT16 col;
|
||||
UINT8 *colormap = NULL;
|
||||
|
@ -9340,7 +9340,7 @@ static void M_DrawSetupChoosePlayerMenu(void)
|
|||
|
||||
// Find skin number from description[]
|
||||
skinnum = description[char_on].skinnum[0];
|
||||
charskin = &skins[skinnum];
|
||||
charskin = skins[skinnum];
|
||||
|
||||
// Use the opposite of the character's skincolor
|
||||
col = description[char_on].oppositecolor;
|
||||
|
@ -9443,7 +9443,7 @@ static void M_DrawSetupChoosePlayerMenu(void)
|
|||
prevoutlinecolor = description[prev].tagoutlinecolor;
|
||||
if (prevtext[0] == '\0')
|
||||
prevpatch = description[prev].namepic;
|
||||
charskin = &skins[description[prev].skinnum[0]];
|
||||
charskin = skins[description[prev].skinnum[0]];
|
||||
if (!prevtextcolor)
|
||||
prevtextcolor = charskin->prefcolor;
|
||||
if (!prevoutlinecolor)
|
||||
|
@ -9473,7 +9473,7 @@ static void M_DrawSetupChoosePlayerMenu(void)
|
|||
nextoutlinecolor = description[next].tagoutlinecolor;
|
||||
if (nexttext[0] == '\0')
|
||||
nextpatch = description[next].namepic;
|
||||
charskin = &skins[description[next].skinnum[0]];
|
||||
charskin = skins[description[next].skinnum[0]];
|
||||
if (!nexttextcolor)
|
||||
nexttextcolor = charskin->prefcolor;
|
||||
if (!nextoutlinecolor)
|
||||
|
@ -9531,7 +9531,7 @@ static void M_ChoosePlayer(INT32 choice)
|
|||
if ((botingame = (description[choice].skinnum[1] != -1))) {
|
||||
// this character has a second skin
|
||||
botskin = (UINT8)(description[choice].skinnum[1]+1);
|
||||
botcolor = skins[description[choice].skinnum[1]].prefcolor;
|
||||
botcolor = skins[description[choice].skinnum[1]]->prefcolor;
|
||||
}
|
||||
else
|
||||
botskin = botcolor = 0;
|
||||
|
@ -9816,7 +9816,7 @@ void M_DrawTimeAttackMenu(void)
|
|||
{
|
||||
INT32 i, x, y, empatx, empaty, cursory = 0;
|
||||
UINT16 dispstatus;
|
||||
patch_t *PictureOfUrFace; // my WHAT
|
||||
patch_t *PictureOfUrFace;
|
||||
patch_t *empatch;
|
||||
|
||||
M_SetMenuCurBackground("RECATKBG");
|
||||
|
@ -9885,9 +9885,9 @@ void M_DrawTimeAttackMenu(void)
|
|||
|
||||
// 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];
|
||||
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");
|
||||
|
||||
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)
|
||||
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");
|
||||
|
||||
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)
|
||||
remove(va("%s"PATHSEP"%s.lmp", srb2home, nameofdemo));
|
||||
|
@ -10395,7 +10395,7 @@ static void M_ReplayTimeAttack(INT32 choice)
|
|||
return;
|
||||
}
|
||||
// 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)
|
||||
{
|
||||
|
@ -10415,7 +10415,7 @@ static void M_ReplayTimeAttack(INT32 choice)
|
|||
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.
|
||||
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)));
|
||||
UINT8 *buf;
|
||||
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) {
|
||||
return;
|
||||
|
@ -11875,11 +11875,11 @@ static void M_DrawSetupMultiPlayerMenu(void)
|
|||
// draw skin string
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH - x, y,
|
||||
((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)
|
||||
{
|
||||
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);
|
||||
V_DrawCharacter(BASEVIDWIDTH - x + 2 + (skullAnimCounter/5), y,
|
||||
'\x1D' | V_YELLOWMAP, false);
|
||||
|
@ -11900,7 +11900,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
|
|||
// draw box around character
|
||||
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
|
||||
goto faildraw;
|
||||
|
@ -11921,7 +11921,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
|
|||
V_DrawFixedPatch(
|
||||
x<<FRACBITS,
|
||||
chary<<FRACBITS,
|
||||
FixedDiv(skins[setupm_fakeskin].highresscale, skins[setupm_fakeskin].shieldscale),
|
||||
FixedDiv(skins[setupm_fakeskin]->highresscale, skins[setupm_fakeskin]->shieldscale),
|
||||
flags, patch, colormap);
|
||||
|
||||
goto colordraw;
|
||||
|
@ -12051,7 +12051,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
|
|||
setupm_fakeskin = numskins-1;
|
||||
}
|
||||
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
|
||||
{
|
||||
|
@ -12067,7 +12067,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
|
|||
{
|
||||
S_StartSound(NULL,sfx_strpst);
|
||||
// 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));
|
||||
break;
|
||||
}
|
||||
|
@ -12084,7 +12084,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
|
|||
setupm_fakeskin = 0;
|
||||
}
|
||||
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
|
||||
{
|
||||
|
@ -12105,7 +12105,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
|
|||
}
|
||||
else if (itemOn == 2)
|
||||
{
|
||||
UINT16 col = skins[setupm_fakeskin].prefcolor;
|
||||
UINT16 col = skins[setupm_fakeskin]->prefcolor;
|
||||
if ((setupm_fakecolor->color != col) && skincolors[col].accessible)
|
||||
{
|
||||
S_StartSound(NULL,sfx_menu1); // Tails
|
||||
|
@ -12195,7 +12195,7 @@ static void M_SetupMultiPlayer(INT32 choice)
|
|||
else
|
||||
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;
|
||||
M_SetupNextMenu(&MP_PlayerSetupDef);
|
||||
|
@ -12239,7 +12239,7 @@ static void M_SetupMultiPlayer2(INT32 choice)
|
|||
else
|
||||
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;
|
||||
M_SetupNextMenu(&MP_PlayerSetupDef);
|
||||
|
@ -12257,7 +12257,7 @@ static boolean M_QuitMultiPlayerMenu(void)
|
|||
setupm_name[l] =0;
|
||||
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
|
||||
if (setupm_fakecolor->color != setupm_cvcolor->value)
|
||||
COM_BufAddText (va("%s %d\n",setupm_cvcolor->name,setupm_fakecolor->color));
|
||||
|
|
|
@ -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.
|
||||
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->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);
|
||||
|
||||
// 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->skin = &skins[players[closestplayer].skin];
|
||||
actor->tracer->skin = skins[players[closestplayer].skin];
|
||||
}
|
||||
|
||||
// Function: A_MonitorPop
|
||||
|
@ -3707,7 +3707,7 @@ void A_MonitorPop(mobj_t *actor)
|
|||
P_SetTarget(&newmobj->tracer, livesico);
|
||||
|
||||
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);
|
||||
|
||||
// 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);
|
||||
|
||||
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);
|
||||
|
||||
// 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)
|
||||
return;
|
||||
|
||||
skin = &skins[actor->target->player->skin];
|
||||
skin = skins[actor->target->player->skin];
|
||||
facecolor = actor->target->player->skincolor;
|
||||
|
||||
if (signcolor)
|
||||
|
@ -5203,10 +5203,10 @@ void A_SignPlayer(mobj_t *actor)
|
|||
if (!SignSkinCheck(player, skincount))
|
||||
skinnum++;
|
||||
}
|
||||
skin = &skins[skinnum];
|
||||
skin = skins[skinnum];
|
||||
}
|
||||
else // specific skin
|
||||
skin = &skins[locvar1];
|
||||
skin = skins[locvar1];
|
||||
|
||||
facecolor = skin->prefcolor;
|
||||
if (signcolor)
|
||||
|
|
20
src/p_mobj.c
20
src/p_mobj.c
|
@ -207,7 +207,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
|
|||
return P_SetPlayerMobjState(mobj, S_PLAY_FALL);
|
||||
|
||||
// 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)
|
||||
return P_SetPlayerMobjState(player->mo, S_PLAY_SWIM);
|
||||
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;
|
||||
|
||||
// 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;
|
||||
else if (player->panim == PA_EDGE && (player->charflags & SF_FASTEDGE))
|
||||
mobj->tics = 2;
|
||||
|
@ -3292,7 +3292,7 @@ void P_MobjCheckWater(mobj_t *mobj)
|
|||
{ // Water removes electric and non-water fire shields...
|
||||
if (electric)
|
||||
P_FlashPal(p, PAL_WHITE, 1);
|
||||
|
||||
|
||||
p->powers[pw_shield] = p->powers[pw_shield] & SH_STACK;
|
||||
}
|
||||
}
|
||||
|
@ -10707,10 +10707,10 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
|||
nummaprings++;
|
||||
break;
|
||||
case MT_METALSONIC_RACE:
|
||||
mobj->skin = &skins[5];
|
||||
mobj->skin = skins[5];
|
||||
/* FALLTHRU */
|
||||
case MT_METALSONIC_BATTLE:
|
||||
mobj->color = skins[5].prefcolor;
|
||||
mobj->color = skins[5]->prefcolor;
|
||||
sc = 5;
|
||||
break;
|
||||
case MT_FANG:
|
||||
|
@ -11381,7 +11381,7 @@ void P_SpawnPlayer(INT32 playernum)
|
|||
// set 'spritedef' override in mobj for player skins.. (see ProjectSprite)
|
||||
// (usefulness: when body mobj is detached from player (who respawns),
|
||||
// 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);
|
||||
|
||||
mobj->health = 1;
|
||||
|
@ -11389,14 +11389,14 @@ void P_SpawnPlayer(INT32 playernum)
|
|||
|
||||
p->bonustime = false;
|
||||
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!
|
||||
if (p->dashmode)
|
||||
{
|
||||
p->dashmode = 0;
|
||||
p->normalspeed = skins[p->skin].normalspeed;
|
||||
p->jumpfactor = skins[p->skin].jumpfactor;
|
||||
p->normalspeed = skins[p->skin]->normalspeed;
|
||||
p->jumpfactor = skins[p->skin]->jumpfactor;
|
||||
}
|
||||
|
||||
// Clear lastlinehit and lastsidehit
|
||||
|
@ -11412,7 +11412,7 @@ void P_SpawnPlayer(INT32 playernum)
|
|||
P_FlashPal(p, 0, 0); // Resets
|
||||
|
||||
// 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);
|
||||
|
||||
if (!leveltime && !p->spectator && ((maptol & TOL_NIGHTS) == TOL_NIGHTS) != (G_IsSpecialStage(gamemap))) // non-special NiGHTS stage or special non-NiGHTS stage
|
||||
|
|
|
@ -76,11 +76,11 @@ static inline void P_ArchivePlayer(void)
|
|||
|
||||
// Write skin names, so that loading skins in different orders
|
||||
// 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)
|
||||
{
|
||||
WRITESTRINGN(save_p, skins[botskin-1].name, SKINNAMESIZE);
|
||||
WRITESTRINGN(save_p, skins[botskin-1]->name, SKINNAMESIZE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1815,7 +1815,7 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|
|||
if (diff2 & MD2_CVMEM)
|
||||
WRITEINT32(save_p, mobj->cvmem);
|
||||
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)
|
||||
WRITEUINT16(save_p, mobj->color);
|
||||
if (diff2 & MD2_EXTVAL1)
|
||||
|
@ -2855,7 +2855,7 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker)
|
|||
if (diff2 & MD2_CVMEM)
|
||||
mobj->cvmem = READINT32(save_p);
|
||||
if (diff2 & MD2_SKIN)
|
||||
mobj->skin = &skins[READUINT8(save_p)];
|
||||
mobj->skin = skins[READUINT8(save_p)];
|
||||
if (diff2 & MD2_COLOR)
|
||||
mobj->color = READUINT16(save_p);
|
||||
if (diff2 & MD2_EXTVAL1)
|
||||
|
|
|
@ -3235,7 +3235,7 @@ static void P_ConvertBinaryMap(void)
|
|||
lines[i].args[4] |= TMSC_BACKTOFRONTCEILING;
|
||||
lines[i].special = 720;
|
||||
break;
|
||||
|
||||
|
||||
case 900: //Translucent wall (10%)
|
||||
case 901: //Translucent wall (20%)
|
||||
case 902: //Translucent wall (30%)
|
||||
|
@ -3622,19 +3622,19 @@ static void P_ForceCharacter(const char *forcecharskin)
|
|||
if (splitscreen)
|
||||
{
|
||||
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);
|
||||
players[secondarydisplayplayer].skincolor = skins[players[secondarydisplayplayer].skin].prefcolor;
|
||||
CV_StealthSetValue(&cv_playercolor2, skins[players[secondarydisplayplayer].skin]->prefcolor);
|
||||
players[secondarydisplayplayer].skincolor = skins[players[secondarydisplayplayer].skin]->prefcolor;
|
||||
}
|
||||
}
|
||||
|
||||
SetPlayerSkin(consoleplayer, forcecharskin);
|
||||
// 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);
|
||||
players[consoleplayer].skincolor = skins[players[consoleplayer].skin].prefcolor;
|
||||
CV_StealthSetValue(&cv_playercolor, 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)
|
||||
continue;
|
||||
|
||||
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));
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3691,8 +3691,8 @@ static void P_LoadRecordGhosts(void)
|
|||
if (cv_ghost_besttime.value == 1 && players[consoleplayer].skin != i)
|
||||
continue;
|
||||
|
||||
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));
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3704,8 +3704,8 @@ static void P_LoadRecordGhosts(void)
|
|||
if (cv_ghost_bestrings.value == 1 && players[consoleplayer].skin != i)
|
||||
continue;
|
||||
|
||||
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));
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3717,8 +3717,8 @@ static void P_LoadRecordGhosts(void)
|
|||
if (cv_ghost_last.value == 1 && players[consoleplayer].skin != i)
|
||||
continue;
|
||||
|
||||
if (FIL_FileExists(va("%s-%s-last.lmp", gpath, skins[i].name)))
|
||||
G_AddGhost(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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3748,8 +3748,8 @@ static void P_LoadNightsGhosts(void)
|
|||
if (cv_ghost_bestscore.value == 1 && players[consoleplayer].skin != i)
|
||||
continue;
|
||||
|
||||
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));
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3761,8 +3761,8 @@ static void P_LoadNightsGhosts(void)
|
|||
if (cv_ghost_besttime.value == 1 && players[consoleplayer].skin != i)
|
||||
continue;
|
||||
|
||||
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));
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3774,8 +3774,8 @@ static void P_LoadNightsGhosts(void)
|
|||
if (cv_ghost_last.value == 1 && players[consoleplayer].skin != i)
|
||||
continue;
|
||||
|
||||
if (FIL_FileExists(va("%s-%s-last.lmp", gpath, skins[i].name)))
|
||||
G_AddGhost(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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4251,7 +4251,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
|
|||
players[consoleplayer].lives = savedata.lives;
|
||||
players[consoleplayer].score = savedata.score;
|
||||
if ((botingame = ((botskin = savedata.botskin) != 0)))
|
||||
botcolor = skins[botskin-1].prefcolor;
|
||||
botcolor = skins[botskin-1]->prefcolor;
|
||||
emeralds = savedata.emeralds;
|
||||
savedata.lives = 0;
|
||||
}
|
||||
|
|
|
@ -1779,7 +1779,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|
|||
case 331: // continuous
|
||||
case 332: // each time
|
||||
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;
|
||||
break;
|
||||
case 334: // object dye - continuous
|
||||
|
|
30
src/p_user.c
30
src/p_user.c
|
@ -682,8 +682,8 @@ static void P_DeNightserizePlayer(player_t *player)
|
|||
|
||||
player->mo->flags &= ~MF_NOGRAVITY;
|
||||
|
||||
player->mo->skin = &skins[player->skin];
|
||||
player->followitem = skins[player->skin].followitem;
|
||||
player->mo->skin = skins[player->skin];
|
||||
player->followitem = skins[player->skin]->followitem;
|
||||
player->mo->color = player->skincolor;
|
||||
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->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))
|
||||
player->mo->color = skins[DEFAULTNIGHTSSKIN].prefcolor;
|
||||
player->followitem = skins[DEFAULTNIGHTSSKIN].followitem;
|
||||
player->mo->color = skins[DEFAULTNIGHTSSKIN]->prefcolor;
|
||||
player->followitem = skins[DEFAULTNIGHTSSKIN]->followitem;
|
||||
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)
|
||||
? (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);
|
||||
|
||||
|
@ -11469,7 +11469,7 @@ static void P_DoMetalJetFume(player_t *player, mobj_t *fume)
|
|||
P_SetThingPosition(fume);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -12294,20 +12294,20 @@ void P_PlayerThink(player_t *player)
|
|||
{
|
||||
if (prevdashmode >= DASHMODE_THRESHOLD)
|
||||
{
|
||||
player->normalspeed = skins[player->skin].normalspeed; // Reset to default if not capable of entering dash mode.
|
||||
player->jumpfactor = skins[player->skin].jumpfactor;
|
||||
player->normalspeed = skins[player->skin]->normalspeed; // Reset to default if not capable of entering dash mode.
|
||||
player->jumpfactor = skins[player->skin]->jumpfactor;
|
||||
}
|
||||
}
|
||||
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.
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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
|
||||
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!
|
||||
{
|
||||
player->normalspeed = skins[player->skin].normalspeed;
|
||||
player->jumpfactor = skins[player->skin].jumpfactor;
|
||||
player->normalspeed = skins[player->skin]->normalspeed;
|
||||
player->jumpfactor = skins[player->skin]->jumpfactor;
|
||||
S_StartSound(player->mo, sfx_kc65);
|
||||
}
|
||||
dashmode = 0;
|
||||
|
|
|
@ -548,7 +548,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U
|
|||
if (skinnum < 0 && skinnum > TC_DEFAULT)
|
||||
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)
|
||||
I_Error("Invalid startcolor #%d.", starttranscolor);
|
||||
|
|
|
@ -1612,7 +1612,7 @@ static void R_ParseSpriteInfo(boolean spr2)
|
|||
for (i = 0; i < foundskins; i++)
|
||||
{
|
||||
size_t skinnum = skinnumbers[i];
|
||||
skin_t *skin = &skins[skinnum];
|
||||
skin_t *skin = skins[skinnum];
|
||||
spriteinfo_t *sprinfo = skin->sprinfo;
|
||||
M_Memcpy(&sprinfo[spr2num], info, sizeof(spriteinfo_t));
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#endif
|
||||
|
||||
INT32 numskins = 0;
|
||||
skin_t *skins = NULL;
|
||||
skin_t **skins = NULL;
|
||||
|
||||
//
|
||||
// P_GetSkinSprite2
|
||||
|
@ -100,7 +100,7 @@ static void Sk_SetDefaultValue(skin_t *skin)
|
|||
//
|
||||
memset(skin, 0, sizeof (skin_t));
|
||||
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->wadnum = INT16_MAX;
|
||||
|
||||
|
@ -221,7 +221,7 @@ boolean R_SkinUsable(INT32 playernum, INT32 skinnum)
|
|||
// Force 2.
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (metalrecording && skinnum == 5)
|
||||
{
|
||||
// Force 3.
|
||||
|
@ -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
|
||||
INT32 R_SkinAvailable(const char *name)
|
||||
{
|
||||
|
@ -277,8 +277,8 @@ INT32 R_SkinAvailable(const char *name)
|
|||
for (i = 0; i < numskins; i++)
|
||||
{
|
||||
// search in the skin list
|
||||
if (stricmp(skins[i].name,name)==0)
|
||||
return i;
|
||||
if (!stricmp(skins[i]->name,name))
|
||||
return skins[i]->skinnum;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ INT32 R_SkinAvailable(const char *name)
|
|||
// Auxillary function that actually sets the skin
|
||||
static void SetSkin(player_t *player, INT32 skinnum)
|
||||
{
|
||||
skin_t *skin = &skins[skinnum];
|
||||
skin_t *skin = skins[skinnum];
|
||||
UINT16 newcolor = 0;
|
||||
|
||||
player->skin = skinnum;
|
||||
|
@ -347,7 +347,7 @@ static void SetSkin(player_t *player, INT32 skinnum)
|
|||
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.
|
||||
{
|
||||
skin = &skins[DEFAULTNIGHTSSKIN];
|
||||
skin = skins[DEFAULTNIGHTSSKIN];
|
||||
player->followitem = skin->followitem;
|
||||
if (!(cv_debug || devparm) && !(netgame || multiplayer || demoplayback))
|
||||
newcolor = skin->prefcolor; // will be updated in thinker to flashing
|
||||
|
@ -687,9 +687,10 @@ void R_AddSkins(UINT16 wadnum, boolean mainfile)
|
|||
buf2[size] = '\0';
|
||||
|
||||
// set defaults
|
||||
skins = Z_Realloc(skins, sizeof(skin_t) * (numskins + 1), PU_STATIC, NULL);
|
||||
skin = &skins[numskins];
|
||||
skins = Z_Realloc(skins, sizeof(skin_t*) * (numskins + 1), PU_STATIC, NULL);
|
||||
skin = skins[numskins] = Z_Calloc(sizeof(skin_t), PU_STATIC, NULL);
|
||||
Sk_SetDefaultValue(skin);
|
||||
skin->skinnum = numskins;
|
||||
skin->wadnum = wadnum;
|
||||
hudname = realname = false;
|
||||
// parse
|
||||
|
@ -785,11 +786,6 @@ next_token:
|
|||
CONS_Printf(M_GetText("Added skin '%s'\n"), skin->name);
|
||||
|
||||
numskins++;
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
HWR_AddPlayerModel(numskins-1);
|
||||
#endif
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -858,7 +854,7 @@ void R_PatchSkins(UINT16 wadnum, boolean mainfile)
|
|||
strlwr(value);
|
||||
skinnum = R_SkinAvailable(value);
|
||||
if (skinnum != -1)
|
||||
skin = &skins[skinnum];
|
||||
skin = skins[skinnum];
|
||||
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);
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
typedef struct
|
||||
{
|
||||
char name[SKINNAMESIZE+1]; // INT16 descriptive name of the skin
|
||||
UINT32 skinnum;
|
||||
UINT16 wadnum;
|
||||
skinflags_t flags;
|
||||
|
||||
|
@ -84,7 +85,7 @@ typedef struct
|
|||
|
||||
/// Externs
|
||||
extern INT32 numskins;
|
||||
extern skin_t *skins;
|
||||
extern skin_t **skins;
|
||||
|
||||
/// Function prototypes
|
||||
void R_InitSkins(void);
|
||||
|
|
|
@ -476,10 +476,6 @@ void R_AddSpriteDefs(UINT16 wadnum)
|
|||
|
||||
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)
|
||||
addsprites++;
|
||||
#ifndef ZDEBUG
|
||||
|
@ -553,14 +549,10 @@ void R_InitSprites(void)
|
|||
}
|
||||
ST_ReloadSkinFaceGraphics();
|
||||
|
||||
//
|
||||
// check if all sprites have frames
|
||||
//
|
||||
/*
|
||||
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]);
|
||||
*/
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
HWR_LoadModels();
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -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!
|
||||
{
|
||||
size_t skinnum = (skin_t*)vis->mobj->skin-skins;
|
||||
return R_GetTranslationColormap((INT32)skinnum, vis->mobj->color, GTC_CACHE);
|
||||
INT32 skinnum = ((skin_t*)vis->mobj->skin)->skinnum;
|
||||
return R_GetTranslationColormap(skinnum, vis->mobj->color, GTC_CACHE);
|
||||
}
|
||||
else // Use the defaults
|
||||
return R_GetTranslationColormap(TC_DEFAULT, vis->mobj->color, GTC_CACHE);
|
||||
|
|
|
@ -345,14 +345,14 @@ void ST_LoadGraphics(void)
|
|||
// made separate so that skins code can reload custom face graphics
|
||||
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];
|
||||
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];
|
||||
superprefix[skinnum] = W_CachePatchNum(sprframe->lumppat[0], PU_HUDGFX);
|
||||
}
|
||||
|
@ -960,14 +960,14 @@ static void ST_drawLivesArea(void)
|
|||
|
||||
// name
|
||||
v_colmap |= (V_HUDTRANS|hudinfo[HUD_LIVES].f|V_PERPLAYER);
|
||||
if (strlen(skins[stplyr->skin].hudname) <= 5)
|
||||
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)
|
||||
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)
|
||||
V_DrawRightAlignedThinString(hudinfo[HUD_LIVES].x+58, hudinfo[HUD_LIVES].y, v_colmap, skins[stplyr->skin].hudname);
|
||||
if (strlen(skins[stplyr->skin]->hudname) <= 5)
|
||||
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)
|
||||
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)
|
||||
V_DrawRightAlignedThinString(hudinfo[HUD_LIVES].x+58, hudinfo[HUD_LIVES].y, v_colmap, skins[stplyr->skin]->hudname);
|
||||
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
|
||||
if (G_RingSlingerGametype() && LUA_HudEnabled(hud_powerstones))
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
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];
|
||||
patch_t *patch = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
const UINT8 *colormap = R_GetTranslationColormap(skinnum, skincolor, GTC_CACHE);
|
||||
|
|
|
@ -1358,22 +1358,22 @@ void Y_StartIntermission(void)
|
|||
else
|
||||
{
|
||||
// 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.passed2, (mapheaderinfo[gamemap-1]->actnum) ? "through act" : "through 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");
|
||||
}
|
||||
// length is okay for normal use
|
||||
else
|
||||
{
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
@ -1445,7 +1445,7 @@ void Y_StartIntermission(void)
|
|||
{
|
||||
snprintf(data.spec.passed1,
|
||||
sizeof data.spec.passed1, "%s",
|
||||
skins[players[consoleplayer].skin].realname);
|
||||
skins[players[consoleplayer].skin]->realname);
|
||||
data.spec.passed1[sizeof data.spec.passed1 - 1] = '\0';
|
||||
strcpy(data.spec.passed2, "got them all!");
|
||||
|
||||
|
@ -1454,17 +1454,17 @@ void Y_StartIntermission(void)
|
|||
strcpy(data.spec.passed3, "can now become");
|
||||
snprintf(data.spec.passed4,
|
||||
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';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strlen(skins[players[consoleplayer].skin].realname) <= SKINNAMESIZE-5)
|
||||
if (strlen(skins[players[consoleplayer].skin]->realname) <= SKINNAMESIZE-5)
|
||||
{
|
||||
snprintf(data.spec.passed1,
|
||||
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';
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue