mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 04:21:47 +00:00
Don't allow 2 players to select the same profile
(Excluding the Guest profile, of course.)
This commit is contained in:
parent
abac095d06
commit
0fe3e6ceeb
2 changed files with 52 additions and 5 deletions
|
|
@ -1335,24 +1335,47 @@ static void M_DrawCharSelectPreview(UINT8 num)
|
||||||
// Profile selection
|
// Profile selection
|
||||||
if (p->mdepth == CSSTEP_PROFILE)
|
if (p->mdepth == CSSTEP_PROFILE)
|
||||||
{
|
{
|
||||||
UINT8 i = 0;
|
|
||||||
INT16 px = x+12;
|
INT16 px = x+12;
|
||||||
INT16 py = y+48 - p->profilen*12;
|
INT16 py = y+48 - p->profilen*12;
|
||||||
UINT8 maxp = PR_GetNumProfiles();
|
UINT8 maxp = PR_GetNumProfiles();
|
||||||
|
|
||||||
|
UINT8 i = 0;
|
||||||
|
UINT8 j;
|
||||||
|
|
||||||
for (i = 0; i < maxp; i++)
|
for (i = 0; i < maxp; i++)
|
||||||
{
|
{
|
||||||
profile_t *pr = PR_GetProfile(i);
|
profile_t *pr = PR_GetProfile(i);
|
||||||
INT16 dist = abs(p->profilen - i);
|
INT16 dist = abs(p->profilen - i);
|
||||||
|
INT32 notSelectable = 0;
|
||||||
|
SINT8 belongsTo = -1;
|
||||||
|
|
||||||
|
if (i != PROFILE_GUEST)
|
||||||
|
{
|
||||||
|
for (j = 0; j < setup_numplayers; j++)
|
||||||
|
{
|
||||||
|
if (setup_player[j].mdepth > CSSTEP_PROFILE
|
||||||
|
&& setup_player[j].profilen == i)
|
||||||
|
{
|
||||||
|
belongsTo = j;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (belongsTo != -1 && belongsTo != num)
|
||||||
|
{
|
||||||
|
notSelectable |= V_TRANSLUCENT;
|
||||||
|
}
|
||||||
|
|
||||||
if (dist > 2)
|
if (dist > 2)
|
||||||
{
|
{
|
||||||
py += 12;
|
py += 12;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (dist == 2)
|
|
||||||
|
if (dist == 2)
|
||||||
{
|
{
|
||||||
V_DrawCenteredFileString(px+26, py, 0, pr->version ? pr->profilename : "NEW");
|
V_DrawCenteredFileString(px+26, py, notSelectable, pr->version ? pr->profilename : "NEW");
|
||||||
V_DrawScaledPatch(px, py, V_TRANSLUCENT, W_CachePatchName("FILEBACK", PU_CACHE));
|
V_DrawScaledPatch(px, py, V_TRANSLUCENT, W_CachePatchName("FILEBACK", PU_CACHE));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1360,7 +1383,9 @@ static void M_DrawCharSelectPreview(UINT8 num)
|
||||||
V_DrawScaledPatch(px, py, 0, W_CachePatchName("FILEBACK", PU_CACHE));
|
V_DrawScaledPatch(px, py, 0, W_CachePatchName("FILEBACK", PU_CACHE));
|
||||||
|
|
||||||
if (i != p->profilen || ((setup_animcounter/10) & 1))
|
if (i != p->profilen || ((setup_animcounter/10) & 1))
|
||||||
V_DrawCenteredFileString(px+26, py, 0, pr->version ? pr->profilename : "NEW");
|
{
|
||||||
|
V_DrawCenteredFileString(px+26, py, notSelectable, pr->version ? pr->profilename : "NEW");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
py += 12;
|
py += 12;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2420,13 +2420,35 @@ static boolean M_HandleCSelectProfile(setup_player_t *p, UINT8 num)
|
||||||
}
|
}
|
||||||
else if (M_MenuConfirmPressed(num))
|
else if (M_MenuConfirmPressed(num))
|
||||||
{
|
{
|
||||||
|
SINT8 belongsTo = -1;
|
||||||
|
|
||||||
|
if (p->profilen != PROFILE_GUEST)
|
||||||
|
{
|
||||||
|
for (i = 0; i < setup_numplayers; i++)
|
||||||
|
{
|
||||||
|
if (setup_player[i].mdepth > CSSTEP_PROFILE
|
||||||
|
&& setup_player[i].profilen == p->profilen)
|
||||||
|
{
|
||||||
|
belongsTo = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (belongsTo != -1 && belongsTo != num)
|
||||||
|
{
|
||||||
|
S_StartSound(NULL, sfx_s3k7b);
|
||||||
|
M_SetMenuDelay(num);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Apply the profile.
|
// Apply the profile.
|
||||||
PR_ApplyProfile(p->profilen, realnum); // Otherwise P1 would inherit the last player's profile in splitdevice and that's not what we want...
|
PR_ApplyProfile(p->profilen, realnum); // Otherwise P1 would inherit the last player's profile in splitdevice and that's not what we want...
|
||||||
M_SetupProfileGridPos(p);
|
M_SetupProfileGridPos(p);
|
||||||
|
|
||||||
p->changeselect = 0;
|
p->changeselect = 0;
|
||||||
|
|
||||||
if (p->profilen == 0)
|
if (p->profilen == PROFILE_GUEST)
|
||||||
{
|
{
|
||||||
// Guest profile, always ask for options.
|
// Guest profile, always ask for options.
|
||||||
p->mdepth = CSSTEP_CHARS;
|
p->mdepth = CSSTEP_CHARS;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue