Update skin cvar from character select and compare against cvar when warping to map without character select

This commit is contained in:
pastel 2024-05-31 15:52:24 -05:00
parent a75fbd229e
commit dd1ac23bdb
3 changed files with 15 additions and 11 deletions

View file

@ -983,7 +983,7 @@ void D_StartTitle(void)
emeralds = 0; emeralds = 0;
memset(&luabanks, 0, sizeof(luabanks)); memset(&luabanks, 0, sizeof(luabanks));
lastmaploaded = 0; lastmaploaded = 0;
pickedchar = R_SkinAvailable(cv_defaultskin.string); pickedchar = R_SkinAvailable(cv_skin.string);
// In case someone exits out at the same time they start a time attack run, // In case someone exits out at the same time they start a time attack run,
// reset modeattacking // reset modeattacking

View file

@ -3674,7 +3674,7 @@ void M_StartControlPanel(void)
{ {
// Devmode unlocks Pandora's Box in the pause menu // Devmode unlocks Pandora's Box in the pause menu
boolean pandora = ((M_SecretUnlocked(SECRET_PANDORA, serverGamedata) || cv_debug || devparm) && !marathonmode); boolean pandora = ((M_SecretUnlocked(SECRET_PANDORA, serverGamedata) || cv_debug || devparm) && !marathonmode);
if (gamestate != GS_LEVEL || ultimatemode) // intermission, so gray out stuff. if (gamestate != GS_LEVEL || ultimatemode) // intermission, so gray out stuff.
{ {
SPauseMenu[spause_pandora].status = (pandora) ? (IT_GRAYEDOUT) : (IT_DISABLED); SPauseMenu[spause_pandora].status = (pandora) ? (IT_GRAYEDOUT) : (IT_DISABLED);
@ -4156,7 +4156,7 @@ static void M_DrawStaticBox(fixed_t x, fixed_t y, INT32 flags, fixed_t w, fixed_
temp = (gametic % temp) * h*2*FRACUNIT; // Which frame to draw temp = (gametic % temp) * h*2*FRACUNIT; // Which frame to draw
V_DrawCroppedPatch(x*FRACUNIT, y*FRACUNIT, (w*FRACUNIT) / 160, (h*FRACUNIT) / 100, flags, patch, NULL, 0, temp, w*2*FRACUNIT, h*2*FRACUNIT); V_DrawCroppedPatch(x*FRACUNIT, y*FRACUNIT, (w*FRACUNIT) / 160, (h*FRACUNIT) / 100, flags, patch, NULL, 0, temp, w*2*FRACUNIT, h*2*FRACUNIT);
W_UnlockCachedPatch(patch); W_UnlockCachedPatch(patch);
return; return;
} }
@ -9510,6 +9510,8 @@ static void M_ChoosePlayer(INT32 choice)
//lastmapsaved = 0; //lastmapsaved = 0;
gamecomplete = 0; gamecomplete = 0;
CV_StealthSet(&cv_skin, skins[skinnum]->name);
G_DeferedInitNew(ultmode, G_BuildMapName(startmap), skinnum, false, fromlevelselect); G_DeferedInitNew(ultmode, G_BuildMapName(startmap), skinnum, false, fromlevelselect);
COM_BufAddText("dummyconsvar 1\n"); // G_DeferedInitNew doesn't do this COM_BufAddText("dummyconsvar 1\n"); // G_DeferedInitNew doesn't do this
@ -10186,7 +10188,7 @@ void M_DrawNightsAttackMenu(void)
skinnumber = 0; //Default to Sonic skinnumber = 0; //Default to Sonic
else else
skinnumber = (cv_chooseskin.value-1); skinnumber = (cv_chooseskin.value-1);
spritedef_t *sprdef = &skins[skinnumber]->sprites[SPR2_NFLY]; //Make our patch the selected character's NFLY sprite spritedef_t *sprdef = &skins[skinnumber]->sprites[SPR2_NFLY]; //Make our patch the selected character's NFLY sprite
spritetimer = FixedInt(ntsatkdrawtimer/2) % skins[skinnumber]->sprites[SPR2_NFLY].numframes; //Make the sprite timer cycle though all the frames at 2 tics per frame spritetimer = FixedInt(ntsatkdrawtimer/2) % skins[skinnumber]->sprites[SPR2_NFLY].numframes; //Make the sprite timer cycle though all the frames at 2 tics per frame
spriteframe_t *sprframe = &sprdef->spriteframes[spritetimer]; //Our animation frame is equal to the number on the timer spriteframe_t *sprframe = &sprdef->spriteframes[spritetimer]; //Our animation frame is equal to the number on the timer
@ -10199,11 +10201,11 @@ void M_DrawNightsAttackMenu(void)
color = skins[skinnumber]->supercolor+4; color = skins[skinnumber]->supercolor+4;
else //If you don't go super in NiGHTS or at all, use prefcolor else //If you don't go super in NiGHTS or at all, use prefcolor
color = skins[skinnumber]->prefcolor; color = skins[skinnumber]->prefcolor;
angle_t fa = (FixedAngle(((FixedInt(ntsatkdrawtimer * 4)) % 360)<<FRACBITS)>>ANGLETOFINESHIFT) & FINEMASK; angle_t fa = (FixedAngle(((FixedInt(ntsatkdrawtimer * 4)) % 360)<<FRACBITS)>>ANGLETOFINESHIFT) & FINEMASK;
V_DrawFixedPatch(270<<FRACBITS, (186<<FRACBITS) - 8*FINESINE(fa), V_DrawFixedPatch(270<<FRACBITS, (186<<FRACBITS) - 8*FINESINE(fa),
FixedDiv(skins[skinnumber]->highresscale, skins[skinnumber]->shieldscale), FixedDiv(skins[skinnumber]->highresscale, skins[skinnumber]->shieldscale),
(sprframe->flip & 1<<6) ? V_FLIP : 0, (sprframe->flip & 1<<6) ? V_FLIP : 0,
natksprite, natksprite,
R_GetTranslationColormap(TC_BLINK, color, GTC_CACHE)); R_GetTranslationColormap(TC_BLINK, color, GTC_CACHE));

View file

@ -1308,7 +1308,7 @@ static void SendNameAndColor(void)
SetColorLocal(consoleplayer, cv_playercolor.value); SetColorLocal(consoleplayer, cv_playercolor.value);
if (splitscreen) if (splitscreen || (!pickedchar && stricmp(cv_skin.string, skins[consoleplayer]->name) != 0))
SetSkinLocal(consoleplayer, R_SkinAvailable(cv_skin.string)); SetSkinLocal(consoleplayer, R_SkinAvailable(cv_skin.string));
else else
SetSkinLocal(consoleplayer, pickedchar); SetSkinLocal(consoleplayer, pickedchar);
@ -4608,7 +4608,7 @@ static void Command_ExitLevel_f(void)
SendNetXCmd(XD_EXITLEVEL, NULL, 0); SendNetXCmd(XD_EXITLEVEL, NULL, 0);
return; return;
} }
// Allow exiting without cheating if at least one player beat the level // Allow exiting without cheating if at least one player beat the level
// Consistent with just setting playersforexit to one // Consistent with just setting playersforexit to one
if (splitscreen || multiplayer) if (splitscreen || multiplayer)
@ -4622,7 +4622,7 @@ static void Command_ExitLevel_f(void)
continue; continue;
if (players[i].lives <= 0) if (players[i].lives <= 0)
continue; continue;
if ((players[i].pflags & PF_FINISHED) || players[i].exiting) if ((players[i].pflags & PF_FINISHED) || players[i].exiting)
{ {
SendNetXCmd(XD_EXITLEVEL, NULL, 0); SendNetXCmd(XD_EXITLEVEL, NULL, 0);
@ -4630,7 +4630,7 @@ static void Command_ExitLevel_f(void)
} }
} }
} }
// Only consider it a cheat if we're not allowed to go to the next map // Only consider it a cheat if we're not allowed to go to the next map
if (M_CampaignWarpIsCheat(gametype, G_GetNextMap(true, true) + 1, serverGamedata)) if (M_CampaignWarpIsCheat(gametype, G_GetNextMap(true, true) + 1, serverGamedata))
CONS_Alert(CONS_NOTICE, M_GetText("Cheats must be enabled to force exit to a locked level!\n")); CONS_Alert(CONS_NOTICE, M_GetText("Cheats must be enabled to force exit to a locked level!\n"));
@ -4769,7 +4769,7 @@ static void Command_Cheats_f(void)
G_SetUsedCheats(false); G_SetUsedCheats(false);
return; return;
} }
if (usedCheats) if (usedCheats)
CONS_Printf(M_GetText("Cheats are enabled, the game cannot be saved.\n")); CONS_Printf(M_GetText("Cheats are enabled, the game cannot be saved.\n"));
else else
@ -4941,6 +4941,8 @@ static boolean Skin2_CanChange(const char *valstr)
*/ */
static void Skin_OnChange(void) static void Skin_OnChange(void)
{ {
pickedchar = R_SkinAvailable(cv_skin.string);
if (!Playing()) if (!Playing())
return; return;