mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-20 15:02:37 +00:00
Merge branch 'skinchange_spectatorify' into 'master'
Skinchange Spectatorify Closes #305 See merge request KartKrew/Kart!936
This commit is contained in:
commit
8d33b5d6af
5 changed files with 177 additions and 131 deletions
195
src/d_netcmd.c
195
src/d_netcmd.c
|
|
@ -494,7 +494,7 @@ consvar_t cv_timelimit = CVAR_INIT ("timelimit", "None", CV_NETVAR|CV_CALL|CV_NO
|
||||||
static CV_PossibleValue_t numlaps_cons_t[] = {{1, "MIN"}, {MAX_LAPS, "MAX"}, {0, "Map default"}, {0, NULL}};
|
static CV_PossibleValue_t numlaps_cons_t[] = {{1, "MIN"}, {MAX_LAPS, "MAX"}, {0, "Map default"}, {0, NULL}};
|
||||||
consvar_t cv_numlaps = CVAR_INIT ("numlaps", "Map default", CV_SAVE|CV_NETVAR|CV_CALL|CV_CHEAT, numlaps_cons_t, NumLaps_OnChange);
|
consvar_t cv_numlaps = CVAR_INIT ("numlaps", "Map default", CV_SAVE|CV_NETVAR|CV_CALL|CV_CHEAT, numlaps_cons_t, NumLaps_OnChange);
|
||||||
|
|
||||||
consvar_t cv_forceskin = CVAR_INIT ("forceskin", "None", CV_NETVAR|CV_CALL|CV_CHEAT, NULL, ForceSkin_OnChange);
|
consvar_t cv_forceskin = CVAR_INIT ("forcecharacter", "None", CV_NETVAR|CV_CALL|CV_CHEAT, NULL, ForceSkin_OnChange);
|
||||||
|
|
||||||
consvar_t cv_downloading = CVAR_INIT ("downloading", "On", 0, CV_OnOff, NULL);
|
consvar_t cv_downloading = CVAR_INIT ("downloading", "On", 0, CV_OnOff, NULL);
|
||||||
consvar_t cv_allowexitlevel = CVAR_INIT ("allowexitlevel", "No", CV_NETVAR, CV_YesNo, NULL);
|
consvar_t cv_allowexitlevel = CVAR_INIT ("allowexitlevel", "No", CV_NETVAR, CV_YesNo, NULL);
|
||||||
|
|
@ -1347,69 +1347,19 @@ static void SetPlayerName(INT32 playernum, char *newname)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT8 CanChangeSkin(INT32 playernum)
|
boolean CanChangeSkin(INT32 playernum)
|
||||||
{
|
{
|
||||||
|
(void)playernum;
|
||||||
|
|
||||||
// Of course we can change if we're not playing
|
// Of course we can change if we're not playing
|
||||||
if (!Playing() || !addedtogame)
|
if (!Playing() || !addedtogame)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Force skin in effect.
|
// Force skin in effect.
|
||||||
if (cv_forceskin.value != -1)
|
if (cv_forceskin.value != -1 && K_CanChangeRules(true))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Can change skin in intermission and whatnot.
|
// ... there used to be a lot more here, but it's now handled in Got_NameAndColor.
|
||||||
if (gamestate != GS_LEVEL)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// Server has skin change restrictions.
|
|
||||||
if (cv_restrictskinchange.value)
|
|
||||||
{
|
|
||||||
UINT8 i;
|
|
||||||
|
|
||||||
// Can change skin during initial countdown.
|
|
||||||
if (leveltime < starttime)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// Not in game, so you can change
|
|
||||||
if (players[playernum].spectator)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// Check for freeeplay
|
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
|
||||||
{
|
|
||||||
if (i == consoleplayer)
|
|
||||||
continue;
|
|
||||||
if (playeringame[i] && !players[i].spectator && gamestate == GS_LEVEL)
|
|
||||||
return false; // Not freeplay!
|
|
||||||
}
|
|
||||||
|
|
||||||
// if we've gotten here, then it's freeplay, and switching anytime is fair game.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// if restrictskinchange is off and we're trying to change skins, don't allow changing skins while moving after the race has started.
|
|
||||||
else if (gamestate == GS_LEVEL && leveltime >= starttime)
|
|
||||||
return (!P_PlayerMoving(playernum));
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean CanChangeSkinWhilePlaying(INT32 playernum)
|
|
||||||
{
|
|
||||||
INT32 i;
|
|
||||||
|
|
||||||
// Force skin in effect.
|
|
||||||
if ((cv_forceskin.value != -1))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
for (i = 0; i < MAXPLAYERS; ++i)
|
|
||||||
{
|
|
||||||
if (D_IsPlayerHumanAndGaming(i) &&
|
|
||||||
!P_IsLocalPlayer(&players[i]))
|
|
||||||
{
|
|
||||||
return CanChangeSkin(playernum);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1616,6 +1566,47 @@ static void SendNameAndColor(UINT8 n)
|
||||||
SendNetXCmdForPlayer(n, XD_NAMEANDCOLOR, buf, p - buf);
|
SendNetXCmdForPlayer(n, XD_NAMEANDCOLOR, buf, p - buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void FinalisePlaystateChange(INT32 playernum)
|
||||||
|
{
|
||||||
|
demo_extradata[playernum] |= DXD_PLAYSTATE;
|
||||||
|
|
||||||
|
// Clear player score and rings if a spectator.
|
||||||
|
if (players[playernum].spectator)
|
||||||
|
{
|
||||||
|
if (gametyperules & GTR_POINTLIMIT) // SRB2kart
|
||||||
|
{
|
||||||
|
players[playernum].roundscore = 0;
|
||||||
|
K_CalculateBattleWanted();
|
||||||
|
}
|
||||||
|
|
||||||
|
K_PlayerForfeit(playernum, true);
|
||||||
|
|
||||||
|
if (players[playernum].mo)
|
||||||
|
players[playernum].mo->health = 1;
|
||||||
|
|
||||||
|
K_StripItems(&players[playernum]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset away view (some code referenced from P_SpectatorJoinGame)
|
||||||
|
{
|
||||||
|
UINT8 i = 0;
|
||||||
|
INT32 *localplayertable = (splitscreen_partied[consoleplayer] ? splitscreen_party[consoleplayer] : g_localplayers);
|
||||||
|
|
||||||
|
for (i = 0; i <= r_splitscreen; i++)
|
||||||
|
{
|
||||||
|
if (localplayertable[i] == playernum)
|
||||||
|
{
|
||||||
|
LUA_HookViewpointSwitch(players+playernum, players+playernum, true);
|
||||||
|
displayplayers[i] = playernum;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
K_CheckBumpers(); // SRB2Kart
|
||||||
|
P_CheckRacers(); // also SRB2Kart
|
||||||
|
}
|
||||||
|
|
||||||
static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
||||||
{
|
{
|
||||||
player_t *p = &players[playernum];
|
player_t *p = &players[playernum];
|
||||||
|
|
@ -1693,8 +1684,46 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
||||||
CV_StealthSet(&cv_skin[localplayer], skins[forcedskin].name);
|
CV_StealthSet(&cv_skin[localplayer], skins[forcedskin].name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
UINT8 oldskin = players[playernum].skin;
|
||||||
|
|
||||||
SetPlayerSkinByNum(playernum, skin);
|
SetPlayerSkinByNum(playernum, skin);
|
||||||
|
|
||||||
|
// The following is a miniature subset of Got_Teamchange.
|
||||||
|
if ((gamestate == GS_LEVEL) // In a level?
|
||||||
|
&& (cv_restrictskinchange.value) // Skin changes are restricted?
|
||||||
|
&& (G_GametypeHasSpectators() && players[playernum].spectator == false) // not a spectator but could be?
|
||||||
|
&& (players[playernum].jointime > 1) // permit on join
|
||||||
|
&& (leveltime > introtime) // permit during intro turnaround
|
||||||
|
&& (players[playernum].skin != oldskin)) // a skin change actually happened?
|
||||||
|
{
|
||||||
|
for (i = 0; i < MAXPLAYERS; ++i)
|
||||||
|
{
|
||||||
|
if (i == playernum)
|
||||||
|
continue;
|
||||||
|
if (!playeringame[i])
|
||||||
|
continue;
|
||||||
|
if (players[i].spectator)
|
||||||
|
continue;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i != MAXPLAYERS // Someone on your server who isn't you?
|
||||||
|
&& LUA_HookTeamSwitch(&players[playernum], 0, false, false, false)) // fiiiine, lua can except it
|
||||||
|
{
|
||||||
|
P_DamageMobj(players[playernum].mo, NULL, NULL, 1, DMG_SPECTATOR);
|
||||||
|
players[playernum].playerstate = PST_REBORN;
|
||||||
|
|
||||||
|
players[playernum].pflags &= ~PF_WANTSTOJOIN;
|
||||||
|
players[playernum].spectator = true;
|
||||||
|
|
||||||
|
HU_AddChatText(va("\x82*%s became a spectator.", player_names[playernum]), false);
|
||||||
|
|
||||||
|
FinalisePlaystateChange(playernum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// set follower colour:
|
// set follower colour:
|
||||||
// Don't bother doing garbage and kicking if we receive None,
|
// Don't bother doing garbage and kicking if we receive None,
|
||||||
// this is both silly and a waste of time,
|
// this is both silly and a waste of time,
|
||||||
|
|
@ -3700,7 +3729,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
||||||
|
|
||||||
//Safety first!
|
//Safety first!
|
||||||
// (not respawning spectators here...)
|
// (not respawning spectators here...)
|
||||||
if (!players[playernum].spectator)
|
if (!players[playernum].spectator && gamestate == GS_LEVEL)
|
||||||
{
|
{
|
||||||
if (players[playernum].mo)
|
if (players[playernum].mo)
|
||||||
{
|
{
|
||||||
|
|
@ -3764,22 +3793,6 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
||||||
else if (NetPacket.packet.newteam == 0)
|
else if (NetPacket.packet.newteam == 0)
|
||||||
HU_AddChatText(va("\x82*%s became a spectator.", player_names[playernum]), false); // "entered the game" text was moved to P_SpectatorJoinGame
|
HU_AddChatText(va("\x82*%s became a spectator.", player_names[playernum]), false); // "entered the game" text was moved to P_SpectatorJoinGame
|
||||||
|
|
||||||
// Reset away view (some code referenced from P_SpectatorJoinGame)
|
|
||||||
{
|
|
||||||
UINT8 i = 0;
|
|
||||||
INT32 *localplayertable = (splitscreen_partied[consoleplayer] ? splitscreen_party[consoleplayer] : g_localplayers);
|
|
||||||
|
|
||||||
for (i = 0; i <= r_splitscreen; i++)
|
|
||||||
{
|
|
||||||
if (localplayertable[i] == playernum)
|
|
||||||
{
|
|
||||||
LUA_HookViewpointSwitch(players+playernum, players+playernum, true);
|
|
||||||
displayplayers[i] = playernum;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*if (G_GametypeHasTeams())
|
/*if (G_GametypeHasTeams())
|
||||||
{
|
{
|
||||||
if (NetPacket.packet.newteam)
|
if (NetPacket.packet.newteam)
|
||||||
|
|
@ -3796,27 +3809,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
||||||
if (gamestate != GS_LEVEL)
|
if (gamestate != GS_LEVEL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
demo_extradata[playernum] |= DXD_PLAYSTATE;
|
FinalisePlaystateChange(playernum);
|
||||||
|
|
||||||
// Clear player score and rings if a spectator.
|
|
||||||
if (players[playernum].spectator)
|
|
||||||
{
|
|
||||||
if (gametyperules & GTR_POINTLIMIT) // SRB2kart
|
|
||||||
{
|
|
||||||
players[playernum].roundscore = 0;
|
|
||||||
K_CalculateBattleWanted();
|
|
||||||
}
|
|
||||||
|
|
||||||
K_PlayerForfeit(playernum, true);
|
|
||||||
|
|
||||||
if (players[playernum].mo)
|
|
||||||
players[playernum].mo->health = 1;
|
|
||||||
|
|
||||||
K_StripItems(&players[playernum]);
|
|
||||||
}
|
|
||||||
|
|
||||||
K_CheckBumpers(); // SRB2Kart
|
|
||||||
P_CheckRacers(); // also SRB2Kart
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -6116,14 +6109,14 @@ static void Command_Automate_Set(void)
|
||||||
static void ForceSkin_OnChange(void)
|
static void ForceSkin_OnChange(void)
|
||||||
{
|
{
|
||||||
// NOT in SP, silly!
|
// NOT in SP, silly!
|
||||||
if (!(netgame || multiplayer))
|
if (!Playing() || !K_CanChangeRules(true))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (cv_forceskin.value < 0)
|
if (cv_forceskin.value < 0)
|
||||||
CONS_Printf("The server has lifted the forced skin restrictions.\n");
|
CONS_Printf("The server has lifted the forced character restrictions.\n");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CONS_Printf("The server is restricting all players to skin \"%s\".\n",cv_forceskin.string);
|
CONS_Printf("The server is restricting all players to \"%s\".\n",cv_forceskin.string);
|
||||||
ForceAllSkins(cv_forceskin.value);
|
ForceAllSkins(cv_forceskin.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -6244,7 +6237,7 @@ static void Skin_OnChange(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CanChangeSkinWhilePlaying(consoleplayer))
|
if (CanChangeSkin(consoleplayer))
|
||||||
{
|
{
|
||||||
SendNameAndColor(0);
|
SendNameAndColor(0);
|
||||||
}
|
}
|
||||||
|
|
@ -6265,7 +6258,7 @@ static void Skin2_OnChange(void)
|
||||||
if (!Playing() || !splitscreen)
|
if (!Playing() || !splitscreen)
|
||||||
return; // do whatever you want
|
return; // do whatever you want
|
||||||
|
|
||||||
if (CanChangeSkinWhilePlaying(g_localplayers[1]))
|
if (CanChangeSkin(g_localplayers[1]))
|
||||||
SendNameAndColor(1);
|
SendNameAndColor(1);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -6279,7 +6272,7 @@ static void Skin3_OnChange(void)
|
||||||
if (!Playing() || splitscreen < 2)
|
if (!Playing() || splitscreen < 2)
|
||||||
return; // do whatever you want
|
return; // do whatever you want
|
||||||
|
|
||||||
if (CanChangeSkinWhilePlaying(g_localplayers[2]))
|
if (CanChangeSkin(g_localplayers[2]))
|
||||||
SendNameAndColor(2);
|
SendNameAndColor(2);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -6293,7 +6286,7 @@ static void Skin4_OnChange(void)
|
||||||
if (!Playing() || splitscreen < 3)
|
if (!Playing() || splitscreen < 3)
|
||||||
return; // do whatever you want
|
return; // do whatever you want
|
||||||
|
|
||||||
if (CanChangeSkinWhilePlaying(g_localplayers[3]))
|
if (CanChangeSkin(g_localplayers[3]))
|
||||||
SendNameAndColor(3);
|
SendNameAndColor(3);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -285,8 +285,7 @@ void LiveStudioAudience(void);
|
||||||
void D_Cheat(INT32 playernum, INT32 cheat, ...);
|
void D_Cheat(INT32 playernum, INT32 cheat, ...);
|
||||||
|
|
||||||
// used for the player setup menu
|
// used for the player setup menu
|
||||||
UINT8 CanChangeSkin(INT32 playernum);
|
boolean CanChangeSkin(INT32 playernum);
|
||||||
boolean CanChangeSkinWhilePlaying(INT32 playernum);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@
|
||||||
#include "k_follower.h"
|
#include "k_follower.h"
|
||||||
#include "d_player.h" // KITEM_ constants
|
#include "d_player.h" // KITEM_ constants
|
||||||
#include "doomstat.h" // MAXSPLITSCREENPLAYERS
|
#include "doomstat.h" // MAXSPLITSCREENPLAYERS
|
||||||
|
#include "k_grandprix.h" // K_CanChangeRules
|
||||||
|
|
||||||
#include "i_joy.h" // for joystick menu controls
|
#include "i_joy.h" // for joystick menu controls
|
||||||
|
|
||||||
|
|
@ -1689,6 +1690,7 @@ void M_DrawCharacterSelect(void)
|
||||||
INT16 quadx, quady;
|
INT16 quadx, quady;
|
||||||
INT16 skin;
|
INT16 skin;
|
||||||
INT32 basex = optionsmenu.profile != NULL ? 64 : 0;
|
INT32 basex = optionsmenu.profile != NULL ? 64 : 0;
|
||||||
|
boolean forceskin = (Playing() && K_CanChangeRules(true) == true) && (cv_forceskin.value != -1);
|
||||||
|
|
||||||
if (setup_numplayers > 0)
|
if (setup_numplayers > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -1696,26 +1698,29 @@ void M_DrawCharacterSelect(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// We have to loop twice -- first time to draw the drop shadows, a second time to draw the icons.
|
// We have to loop twice -- first time to draw the drop shadows, a second time to draw the icons.
|
||||||
for (i = 0; i < 9; i++)
|
if (forceskin == false)
|
||||||
{
|
{
|
||||||
for (j = 0; j < 9; j++)
|
for (i = 0; i < 9; i++)
|
||||||
{
|
{
|
||||||
skin = setup_chargrid[i][j].skinlist[setup_page];
|
for (j = 0; j < 9; j++)
|
||||||
quadx = 4 * (i / 3);
|
|
||||||
quady = 4 * (j / 3);
|
|
||||||
|
|
||||||
// Here's a quick little cheat to save on drawing time!
|
|
||||||
// Don't draw a shadow if it'll get covered by another icon
|
|
||||||
if ((i % 3 < 2) && (j % 3 < 2))
|
|
||||||
{
|
{
|
||||||
if ((setup_chargrid[i+1][j].skinlist[setup_page] != -1)
|
skin = setup_chargrid[i][j].skinlist[setup_page];
|
||||||
&& (setup_chargrid[i][j+1].skinlist[setup_page] != -1)
|
quadx = 4 * (i / 3);
|
||||||
&& (setup_chargrid[i+1][j+1].skinlist[setup_page] != -1))
|
quady = 4 * (j / 3);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (skin != -1)
|
// Here's a quick little cheat to save on drawing time!
|
||||||
V_DrawScaledPatch(basex+ 82 + (i*16) + quadx + 1, 22 + (j*16) + quady + 1, 0, W_CachePatchName("ICONBACK", PU_CACHE));
|
// Don't draw a shadow if it'll get covered by another icon
|
||||||
|
if ((i % 3 < 2) && (j % 3 < 2))
|
||||||
|
{
|
||||||
|
if ((setup_chargrid[i+1][j].skinlist[setup_page] != -1)
|
||||||
|
&& (setup_chargrid[i][j+1].skinlist[setup_page] != -1)
|
||||||
|
&& (setup_chargrid[i+1][j+1].skinlist[setup_page] != -1))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (skin != -1)
|
||||||
|
V_DrawScaledPatch(basex+ 82 + (i*16) + quadx + 1, 22 + (j*16) + quady + 1, 0, W_CachePatchName("ICONBACK", PU_CACHE));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1725,8 +1730,22 @@ void M_DrawCharacterSelect(void)
|
||||||
// Draw the icons now
|
// Draw the icons now
|
||||||
for (i = 0; i < 9; i++)
|
for (i = 0; i < 9; i++)
|
||||||
{
|
{
|
||||||
|
if ((forceskin == true) && (i != skins[cv_forceskin.value].kartspeed-1))
|
||||||
|
continue;
|
||||||
|
|
||||||
for (j = 0; j < 9; j++)
|
for (j = 0; j < 9; j++)
|
||||||
{
|
{
|
||||||
|
if (forceskin == true)
|
||||||
|
{
|
||||||
|
if (j != skins[cv_forceskin.value].kartweight-1)
|
||||||
|
continue;
|
||||||
|
skin = cv_forceskin.value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
skin = setup_chargrid[i][j].skinlist[setup_page];
|
||||||
|
}
|
||||||
|
|
||||||
for (k = 0; k < setup_numplayers; k++)
|
for (k = 0; k < setup_numplayers; k++)
|
||||||
{
|
{
|
||||||
if (setup_player[k].mdepth < CSSTEP_ASKCHANGES)
|
if (setup_player[k].mdepth < CSSTEP_ASKCHANGES)
|
||||||
|
|
@ -1736,7 +1755,6 @@ void M_DrawCharacterSelect(void)
|
||||||
break; // k == setup_numplayers means no one has it selected
|
break; // k == setup_numplayers means no one has it selected
|
||||||
}
|
}
|
||||||
|
|
||||||
skin = setup_chargrid[i][j].skinlist[setup_page];
|
|
||||||
quadx = 4 * (i / 3);
|
quadx = 4 * (i / 3);
|
||||||
quady = 4 * (j / 3);
|
quady = 4 * (j / 3);
|
||||||
|
|
||||||
|
|
@ -1752,7 +1770,7 @@ void M_DrawCharacterSelect(void)
|
||||||
V_DrawMappedPatch(basex + 82 + (i*16) + quadx, 22 + (j*16) + quady, 0, faceprefix[skin][FACE_RANK], colormap);
|
V_DrawMappedPatch(basex + 82 + (i*16) + quadx, 22 + (j*16) + quady, 0, faceprefix[skin][FACE_RANK], colormap);
|
||||||
|
|
||||||
// draw dot if there are more alts behind there!
|
// draw dot if there are more alts behind there!
|
||||||
if (setup_page+1 < setup_chargrid[i][j].numskins)
|
if (forceskin == false && setup_page+1 < setup_chargrid[i][j].numskins)
|
||||||
V_DrawScaledPatch(basex + 82 + (i*16) + quadx, 22 + (j*16) + quady + 11, 0, W_CachePatchName("ALTSDOT", PU_CACHE));
|
V_DrawScaledPatch(basex + 82 + (i*16) + quadx, 22 + (j*16) + quady + 11, 0, W_CachePatchName("ALTSDOT", PU_CACHE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -433,6 +433,9 @@ menu_t *M_SpecificMenuRestore(menu_t *torestore)
|
||||||
M_MPOptSelectInit(-1);
|
M_MPOptSelectInit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// One last catch.
|
||||||
|
PLAY_CharSelectDef.prevMenu = &MainDef;
|
||||||
|
|
||||||
return torestore;
|
return torestore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
#include "../k_menu.h"
|
#include "../k_menu.h"
|
||||||
#include "../r_skins.h"
|
#include "../r_skins.h"
|
||||||
#include "../s_sound.h"
|
#include "../s_sound.h"
|
||||||
|
#include "../k_grandprix.h" // K_CanChangeRules
|
||||||
|
|
||||||
menuitem_t PLAY_CharSelect[] =
|
menuitem_t PLAY_CharSelect[] =
|
||||||
{
|
{
|
||||||
|
|
@ -789,6 +790,7 @@ static boolean M_HandleCharacterGrid(setup_player_t *p, UINT8 num)
|
||||||
{
|
{
|
||||||
UINT8 numclones;
|
UINT8 numclones;
|
||||||
INT32 skin;
|
INT32 skin;
|
||||||
|
boolean forceskin = (Playing() && K_CanChangeRules(true) == true) && (cv_forceskin.value != -1);
|
||||||
|
|
||||||
if (cv_splitdevice.value)
|
if (cv_splitdevice.value)
|
||||||
num = 0;
|
num = 0;
|
||||||
|
|
@ -848,19 +850,35 @@ static boolean M_HandleCharacterGrid(setup_player_t *p, UINT8 num)
|
||||||
|
|
||||||
if (M_MenuConfirmPressed(num) /*|| M_MenuButtonPressed(num, MBT_START)*/)
|
if (M_MenuConfirmPressed(num) /*|| M_MenuButtonPressed(num, MBT_START)*/)
|
||||||
{
|
{
|
||||||
skin = setup_chargrid[p->gridx][p->gridy].skinlist[setup_page];
|
if (forceskin)
|
||||||
if (setup_page >= setup_chargrid[p->gridx][p->gridy].numskins || skin == -1)
|
|
||||||
{
|
{
|
||||||
S_StartSound(NULL, sfx_s3k7b); //sfx_s3kb2
|
if ((p->gridx != skins[cv_forceskin.value].kartspeed-1)
|
||||||
|
|| (p->gridy != skins[cv_forceskin.value].kartweight-1))
|
||||||
|
{
|
||||||
|
S_StartSound(NULL, sfx_s3k7b); //sfx_s3kb2
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p->mdepth = CSSTEP_COLORS;
|
||||||
|
S_StartSound(NULL, sfx_s3k63);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (setup_page+1 == setup_chargrid[p->gridx][p->gridy].numskins)
|
skin = setup_chargrid[p->gridx][p->gridy].skinlist[setup_page];
|
||||||
p->mdepth = CSSTEP_COLORS; // Skip clones menu if there are none on this page.
|
if (setup_page >= setup_chargrid[p->gridx][p->gridy].numskins || skin == -1)
|
||||||
|
{
|
||||||
|
S_StartSound(NULL, sfx_s3k7b); //sfx_s3kb2
|
||||||
|
}
|
||||||
else
|
else
|
||||||
p->mdepth = CSSTEP_ALTS;
|
{
|
||||||
|
if (setup_page+1 == setup_chargrid[p->gridx][p->gridy].numskins)
|
||||||
|
p->mdepth = CSSTEP_COLORS; // Skip clones menu if there are none on this page.
|
||||||
|
else
|
||||||
|
p->mdepth = CSSTEP_ALTS;
|
||||||
|
|
||||||
S_StartSound(NULL, sfx_s3k63);
|
S_StartSound(NULL, sfx_s3k63);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
M_SetMenuDelay(num);
|
M_SetMenuDelay(num);
|
||||||
|
|
@ -884,7 +902,7 @@ static boolean M_HandleCharacterGrid(setup_player_t *p, UINT8 num)
|
||||||
M_SetMenuDelay(num);
|
M_SetMenuDelay(num);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num == 0 && setup_numplayers == 1 && setup_maxpage) // ONLY one player.
|
if (num == 0 && setup_numplayers == 1 && setup_maxpage && !forceskin) // ONLY one player.
|
||||||
{
|
{
|
||||||
if (M_MenuButtonPressed(num, MBT_L))
|
if (M_MenuButtonPressed(num, MBT_L))
|
||||||
{
|
{
|
||||||
|
|
@ -961,6 +979,8 @@ static void M_HandleCharRotate(setup_player_t *p, UINT8 num)
|
||||||
|
|
||||||
static void M_HandleColorRotate(setup_player_t *p, UINT8 num)
|
static void M_HandleColorRotate(setup_player_t *p, UINT8 num)
|
||||||
{
|
{
|
||||||
|
boolean forceskin = (Playing() && K_CanChangeRules(true) == true) && (cv_forceskin.value != -1);
|
||||||
|
|
||||||
if (cv_splitdevice.value)
|
if (cv_splitdevice.value)
|
||||||
num = 0;
|
num = 0;
|
||||||
|
|
||||||
|
|
@ -987,7 +1007,8 @@ static void M_HandleColorRotate(setup_player_t *p, UINT8 num)
|
||||||
}
|
}
|
||||||
else if (M_MenuBackPressed(num))
|
else if (M_MenuBackPressed(num))
|
||||||
{
|
{
|
||||||
if (setup_chargrid[p->gridx][p->gridy].numskins == 1)
|
if (forceskin
|
||||||
|
|| setup_chargrid[p->gridx][p->gridy].numskins == 1)
|
||||||
{
|
{
|
||||||
p->mdepth = CSSTEP_CHARS; // Skip clones menu
|
p->mdepth = CSSTEP_CHARS; // Skip clones menu
|
||||||
}
|
}
|
||||||
|
|
@ -1253,6 +1274,7 @@ static void M_HandleFollowerColorRotate(setup_player_t *p, UINT8 num)
|
||||||
boolean M_CharacterSelectHandler(INT32 choice)
|
boolean M_CharacterSelectHandler(INT32 choice)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
boolean forceskin = (Playing() && K_CanChangeRules(true) == true) && (cv_forceskin.value != -1);
|
||||||
|
|
||||||
(void)choice;
|
(void)choice;
|
||||||
|
|
||||||
|
|
@ -1318,7 +1340,18 @@ boolean M_CharacterSelectHandler(INT32 choice)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Just makes it easier to access later
|
// Just makes it easier to access later
|
||||||
p->skin = setup_chargrid[p->gridx][p->gridy].skinlist[p->clonenum];
|
if (forceskin)
|
||||||
|
{
|
||||||
|
if (p->gridx != skins[cv_forceskin.value].kartspeed-1
|
||||||
|
|| p->gridy != skins[cv_forceskin.value].kartweight-1)
|
||||||
|
p->skin = -1;
|
||||||
|
else
|
||||||
|
p->skin = cv_forceskin.value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p->skin = setup_chargrid[p->gridx][p->gridy].skinlist[p->clonenum];
|
||||||
|
}
|
||||||
|
|
||||||
// Keep profile colour.
|
// Keep profile colour.
|
||||||
/*if (p->mdepth < CSSTEP_COLORS)
|
/*if (p->mdepth < CSSTEP_COLORS)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue