mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 12:31:54 +00:00
Extract K_DrawGameControl calls from M_DrawChallengePreview
Done to fix weird layering issues with Challenge hint text
This commit is contained in:
parent
69315d9163
commit
cba9292960
1 changed files with 67 additions and 66 deletions
133
src/k_menudraw.c
133
src/k_menudraw.c
|
|
@ -7194,7 +7194,7 @@ void M_DrawCharacterIconAndEngine(INT32 x, INT32 y, UINT8 skin, UINT8 *colormap,
|
||||||
V_DrawFill(x+16 + (s*5), y + (w*5), 6, 6, 0);
|
V_DrawFill(x+16 + (s*5), y + (w*5), 6, 6, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void M_DrawChallengePreview(INT32 x, INT32 y)
|
static const char* M_DrawChallengePreview(INT32 x, INT32 y)
|
||||||
{
|
{
|
||||||
unlockable_t *ref = NULL;
|
unlockable_t *ref = NULL;
|
||||||
UINT8 *colormap = NULL;
|
UINT8 *colormap = NULL;
|
||||||
|
|
@ -7202,12 +7202,9 @@ static void M_DrawChallengePreview(INT32 x, INT32 y)
|
||||||
|
|
||||||
if (challengesmenu.currentunlock >= MAXUNLOCKABLES)
|
if (challengesmenu.currentunlock >= MAXUNLOCKABLES)
|
||||||
{
|
{
|
||||||
return;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Okay, this is what we want to draw.
|
|
||||||
ref = &unlockables[challengesmenu.currentunlock];
|
|
||||||
|
|
||||||
// Funny question mark?
|
// Funny question mark?
|
||||||
if (!gamedata->unlocked[challengesmenu.currentunlock])
|
if (!gamedata->unlocked[challengesmenu.currentunlock])
|
||||||
{
|
{
|
||||||
|
|
@ -7219,7 +7216,7 @@ static void M_DrawChallengePreview(INT32 x, INT32 y)
|
||||||
|
|
||||||
if (!sprdef->numframes)
|
if (!sprdef->numframes)
|
||||||
{
|
{
|
||||||
return;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
useframe = (challengesmenu.ticker / 2) % sprdef->numframes;
|
useframe = (challengesmenu.ticker / 2) % sprdef->numframes;
|
||||||
|
|
@ -7233,9 +7230,14 @@ static void M_DrawChallengePreview(INT32 x, INT32 y)
|
||||||
}
|
}
|
||||||
|
|
||||||
V_DrawFixedPatch(x*FRACUNIT, (y+2)*FRACUNIT, FRACUNIT, addflags, patch, NULL);
|
V_DrawFixedPatch(x*FRACUNIT, (y+2)*FRACUNIT, FRACUNIT, addflags, patch, NULL);
|
||||||
return;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Okay, this is what we want to draw.
|
||||||
|
ref = &unlockables[challengesmenu.currentunlock];
|
||||||
|
|
||||||
|
const char *actiontext = NULL;
|
||||||
|
|
||||||
switch (ref->type)
|
switch (ref->type)
|
||||||
{
|
{
|
||||||
case SECRET_SKIN:
|
case SECRET_SKIN:
|
||||||
|
|
@ -7253,17 +7255,11 @@ static void M_DrawChallengePreview(INT32 x, INT32 y)
|
||||||
{
|
{
|
||||||
profile_t *pr = PR_GetProfile(cv_lastprofile[0].value);
|
profile_t *pr = PR_GetProfile(cv_lastprofile[0].value);
|
||||||
|
|
||||||
if (pr)
|
actiontext = (pr && strcmp(pr->skinname, skins[skin]->name))
|
||||||
{
|
? "<a> <sky>Set on Profile"
|
||||||
K_DrawGameControl(
|
: "<a_pressed> <gray>Set on Profile";
|
||||||
4, y, 0,
|
|
||||||
strcmp(pr->skinname, skins[skin]->name)
|
y -= 14;
|
||||||
? "<a> <sky>Set on Profile"
|
|
||||||
: "<a_pressed> <gray>Set on Profile",
|
|
||||||
0, TINY_FONT, 0
|
|
||||||
);
|
|
||||||
y -= 14;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < skin; i++)
|
for (i = 0; i < skin; i++)
|
||||||
|
|
@ -7303,8 +7299,6 @@ static void M_DrawChallengePreview(INT32 x, INT32 y)
|
||||||
|
|
||||||
y = (BASEVIDHEIGHT-14);
|
y = (BASEVIDHEIGHT-14);
|
||||||
|
|
||||||
const char *actiontext = NULL;
|
|
||||||
|
|
||||||
if (setup_numplayers <= 1 && cv_lastprofile[0].value != PROFILE_GUEST)
|
if (setup_numplayers <= 1 && cv_lastprofile[0].value != PROFILE_GUEST)
|
||||||
{
|
{
|
||||||
profile_t *pr = PR_GetProfile(cv_lastprofile[0].value);
|
profile_t *pr = PR_GetProfile(cv_lastprofile[0].value);
|
||||||
|
|
@ -7340,11 +7334,6 @@ static void M_DrawChallengePreview(INT32 x, INT32 y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
K_DrawGameControl(
|
|
||||||
4, y, 0,
|
|
||||||
actiontext,
|
|
||||||
0, TINY_FONT, 0
|
|
||||||
);
|
|
||||||
y -= 14;
|
y -= 14;
|
||||||
|
|
||||||
if (followers[fskin].category < numfollowercategories)
|
if (followers[fskin].category < numfollowercategories)
|
||||||
|
|
@ -7374,16 +7363,9 @@ static void M_DrawChallengePreview(INT32 x, INT32 y)
|
||||||
{
|
{
|
||||||
profile_t *pr = PR_GetProfile(cv_lastprofile[0].value);
|
profile_t *pr = PR_GetProfile(cv_lastprofile[0].value);
|
||||||
|
|
||||||
if (pr)
|
actiontext = (pr && pr->color != colorid)
|
||||||
{
|
? "<a> <sky>Set on Profile"
|
||||||
K_DrawGameControl(
|
: "<a_pressed> <gray>Set on Profile";
|
||||||
4, (BASEVIDHEIGHT-14), 0,
|
|
||||||
(pr->color != colorid)
|
|
||||||
? "<a> <sky>Set on Profile"
|
|
||||||
: "<a_pressed> <gray>Set on Profile",
|
|
||||||
0, TINY_FONT, 0
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
@ -7516,11 +7498,7 @@ static void M_DrawChallengePreview(INT32 x, INT32 y)
|
||||||
if (setup_numplayers <= 1 && guessgt == GT_TUTORIAL)
|
if (setup_numplayers <= 1 && guessgt == GT_TUTORIAL)
|
||||||
{
|
{
|
||||||
// Only for 1p
|
// Only for 1p
|
||||||
K_DrawGameControl(
|
actiontext = "<a_animated> <orange>Play Tutorial";
|
||||||
4, y, 0,
|
|
||||||
"<a_animated> <orange>Play Tutorial",
|
|
||||||
0, TINY_FONT, 0
|
|
||||||
);
|
|
||||||
gtname = NULL;
|
gtname = NULL;
|
||||||
}
|
}
|
||||||
else if (guessgt == GT_SPECIAL && !M_SecretUnlocked(SECRET_SPECIALATTACK, true))
|
else if (guessgt == GT_SPECIAL && !M_SecretUnlocked(SECRET_SPECIALATTACK, true))
|
||||||
|
|
@ -7674,7 +7652,7 @@ static void M_DrawChallengePreview(INT32 x, INT32 y)
|
||||||
if (map >= nummapheaders
|
if (map >= nummapheaders
|
||||||
|| !mapheaderinfo[map])
|
|| !mapheaderinfo[map])
|
||||||
{
|
{
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT8 musicid;
|
UINT8 musicid;
|
||||||
|
|
@ -7686,7 +7664,7 @@ static void M_DrawChallengePreview(INT32 x, INT32 y)
|
||||||
|
|
||||||
if (musicid == MAXMUSNAMES)
|
if (musicid == MAXMUSNAMES)
|
||||||
{
|
{
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *tune = "challenge_altmusic";
|
const char *tune = "challenge_altmusic";
|
||||||
|
|
@ -7758,31 +7736,32 @@ static void M_DrawChallengePreview(INT32 x, INT32 y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
x = 4;
|
if (musicid < mapheaderinfo[map]->musname_size)
|
||||||
y = (BASEVIDHEIGHT-14);
|
{
|
||||||
|
actiontext = (pushed > 0)
|
||||||
|
? "<a_animated> <sky>Stop CD"
|
||||||
|
: "<a_animated> <sky>Play CD";
|
||||||
|
}
|
||||||
|
|
||||||
if (epossible)
|
if (epossible)
|
||||||
{
|
{
|
||||||
K_DrawGameControl(
|
const char *secondtext = (pushed < 0)
|
||||||
x, y, 0,
|
? "<l_animated> <magenta>E Stop"
|
||||||
(pushed < 0)
|
: "<l_animated> <magenta>E Side";
|
||||||
? "<l_animated> <magenta>E Stop"
|
if (actiontext)
|
||||||
: "<l_animated> <magenta>E Side",
|
{
|
||||||
0, TINY_FONT, 0
|
// weird encoded height
|
||||||
);
|
actiontext = va("\x1""%s\n%s",
|
||||||
|
(pushed < 0)
|
||||||
y -= 14;
|
? "<l_animated> <magenta>E Stop"
|
||||||
}
|
: "<l_animated> <magenta>E Side",
|
||||||
|
actiontext
|
||||||
if (musicid < mapheaderinfo[map]->musname_size)
|
);
|
||||||
{
|
}
|
||||||
K_DrawGameControl(
|
else
|
||||||
x, y, 0,
|
{
|
||||||
(pushed > 0)
|
actiontext = secondtext;
|
||||||
? "<a_animated> <sky>Stop CD"
|
}
|
||||||
: "<a_animated> <sky>Play CD",
|
|
||||||
0, TINY_FONT, 0
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
@ -7792,7 +7771,7 @@ static void M_DrawChallengePreview(INT32 x, INT32 y)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (specialmap == NEXTMAP_INVALID || !ref)
|
if (specialmap == NEXTMAP_INVALID || !ref)
|
||||||
return;
|
return actiontext;
|
||||||
|
|
||||||
x -= 50;
|
x -= 50;
|
||||||
y = 146+2;
|
y = 146+2;
|
||||||
|
|
@ -7840,6 +7819,8 @@ static void M_DrawChallengePreview(INT32 x, INT32 y)
|
||||||
W_CachePatchName("K_LAPE02", PU_CACHE),
|
W_CachePatchName("K_LAPE02", PU_CACHE),
|
||||||
colormap);
|
colormap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return actiontext;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define challengesgridstep 22
|
#define challengesgridstep 22
|
||||||
|
|
@ -8396,9 +8377,10 @@ challengedesc:
|
||||||
y = BASEVIDHEIGHT-16;
|
y = BASEVIDHEIGHT-16;
|
||||||
|
|
||||||
// Unlock preview
|
// Unlock preview
|
||||||
M_DrawChallengePreview(x, y);
|
const char *actiontext = M_DrawChallengePreview(x, y);
|
||||||
|
|
||||||
// Conditions for unlock
|
// Conditions for unlock
|
||||||
|
// { -- please don't call va() anywhere between here...
|
||||||
i = (challengesmenu.hilix * CHALLENGEGRIDHEIGHT) + challengesmenu.hiliy;
|
i = (challengesmenu.hilix * CHALLENGEGRIDHEIGHT) + challengesmenu.hiliy;
|
||||||
|
|
||||||
if (challengesmenu.unlockcondition != NULL
|
if (challengesmenu.unlockcondition != NULL
|
||||||
|
|
@ -8411,6 +8393,25 @@ challengedesc:
|
||||||
{
|
{
|
||||||
V_DrawCenteredThinString(BASEVIDWIDTH/2, 120 + 32, 0, challengesmenu.unlockcondition);
|
V_DrawCenteredThinString(BASEVIDWIDTH/2, 120 + 32, 0, challengesmenu.unlockcondition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Extracted from M_DrawCharSelectPreview for ordering reasons
|
||||||
|
if (actiontext && actiontext[0])
|
||||||
|
{
|
||||||
|
x = 4;
|
||||||
|
y = (BASEVIDHEIGHT-14);
|
||||||
|
if (actiontext[0] < '\x5')
|
||||||
|
{
|
||||||
|
// weird encoded height, supports max 5 rows
|
||||||
|
y -= (13 * actiontext[0]);
|
||||||
|
actiontext++;
|
||||||
|
}
|
||||||
|
K_DrawGameControl(
|
||||||
|
x, y, 0,
|
||||||
|
actiontext,
|
||||||
|
0, TINY_FONT, 0
|
||||||
|
);
|
||||||
|
// } -- ...and here (since actiontext needs it)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef challengetransparentstrength
|
#undef challengetransparentstrength
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue