mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-02-24 14:31:02 +00:00
Challenge Grid: Introduce flipping tiles
- When a tile is selected, flips from category side to specific icon side - Flips back when unselected - Hold R (drift) to flip all tiles to visible side
This commit is contained in:
parent
339617a54e
commit
9779d6066c
4 changed files with 67 additions and 9 deletions
|
|
@ -1137,6 +1137,8 @@ void M_DrawAddons(void);
|
|||
#define CC_ANIM 3
|
||||
#define CC_MAX 4
|
||||
|
||||
#define TILEFLIP_MAX 16
|
||||
|
||||
// Keep track of some pause menu data for visual goodness.
|
||||
extern struct challengesmenu_s {
|
||||
|
||||
|
|
|
|||
|
|
@ -4518,7 +4518,7 @@ static void M_DrawChallengeTile(INT16 i, INT16 j, INT32 x, INT32 y, boolean hili
|
|||
unlockable_t *ref = NULL;
|
||||
patch_t *pat = missingpat;
|
||||
UINT8 *colormap = NULL, *bgmap = NULL;
|
||||
fixed_t siz;
|
||||
fixed_t siz, accordion;
|
||||
UINT8 id, num;
|
||||
boolean unlockedyet;
|
||||
boolean categoryside;
|
||||
|
|
@ -4569,14 +4569,26 @@ static void M_DrawChallengeTile(INT16 i, INT16 j, INT32 x, INT32 y, boolean hili
|
|||
goto drawborder;
|
||||
}
|
||||
|
||||
accordion = FRACUNIT;
|
||||
|
||||
if (challengesmenu.extradata[id].flip != 0
|
||||
&& challengesmenu.extradata[id].flip != (TILEFLIP_MAX/2))
|
||||
{
|
||||
angle_t bad = (FixedAngle((fixed_t)(challengesmenu.extradata[id].flip) * (360*FRACUNIT/TILEFLIP_MAX)) >> ANGLETOFINESHIFT) & FINEMASK;
|
||||
accordion = FINECOSINE(bad);
|
||||
if (accordion < 0)
|
||||
accordion = -accordion;
|
||||
}
|
||||
|
||||
pat = W_CachePatchName(
|
||||
(ref->majorunlock ? "UN_BORDB" : "UN_BORDA"),
|
||||
PU_CACHE);
|
||||
|
||||
bgmap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_SILVER, GTC_MENUCACHE);
|
||||
|
||||
V_DrawFixedPatch(
|
||||
x*FRACUNIT, y*FRACUNIT,
|
||||
V_DrawStretchyFixedPatch(
|
||||
(x*FRACUNIT) + (SHORT(pat->width)*(FRACUNIT-accordion)/2), y*FRACUNIT,
|
||||
accordion,
|
||||
FRACUNIT,
|
||||
0, pat,
|
||||
bgmap
|
||||
|
|
@ -4584,7 +4596,8 @@ static void M_DrawChallengeTile(INT16 i, INT16 j, INT32 x, INT32 y, boolean hili
|
|||
|
||||
pat = missingpat;
|
||||
|
||||
categoryside = !hili; // temporary
|
||||
categoryside = (challengesmenu.extradata[id].flip <= TILEFLIP_MAX/4
|
||||
|| challengesmenu.extradata[id].flip > (3*TILEFLIP_MAX)/4);
|
||||
|
||||
if (categoryside)
|
||||
{
|
||||
|
|
@ -4725,8 +4738,9 @@ static void M_DrawChallengeTile(INT16 i, INT16 j, INT32 x, INT32 y, boolean hili
|
|||
; // prevent div/0
|
||||
else if (ref->majorunlock)
|
||||
{
|
||||
V_DrawFixedPatch(
|
||||
(x + 5)*FRACUNIT, (y + 5)*FRACUNIT,
|
||||
V_DrawStretchyFixedPatch(
|
||||
((x + 5)*FRACUNIT) + (32*(FRACUNIT-accordion)/2), (y + 5)*FRACUNIT,
|
||||
FixedDiv(32*accordion, siz),
|
||||
FixedDiv(32 << FRACBITS, siz),
|
||||
0, pat,
|
||||
colormap
|
||||
|
|
@ -4734,8 +4748,9 @@ static void M_DrawChallengeTile(INT16 i, INT16 j, INT32 x, INT32 y, boolean hili
|
|||
}
|
||||
else
|
||||
{
|
||||
V_DrawFixedPatch(
|
||||
(x + 2)*FRACUNIT, (y + 2)*FRACUNIT,
|
||||
V_DrawStretchyFixedPatch(
|
||||
((x + 2)*FRACUNIT) + (16*(FRACUNIT-accordion)/2), (y + 2)*FRACUNIT,
|
||||
FixedDiv(16*accordion, siz),
|
||||
FixedDiv(16 << FRACBITS, siz),
|
||||
0, pat,
|
||||
colormap
|
||||
|
|
|
|||
|
|
@ -197,6 +197,7 @@ void M_PopulateChallengeGrid(void);
|
|||
struct challengegridextradata_t
|
||||
{
|
||||
UINT8 flags;
|
||||
UINT8 flip;
|
||||
};
|
||||
|
||||
void M_UpdateChallengeGridExtraData(challengegridextradata_t *extradata);
|
||||
|
|
|
|||
|
|
@ -84,6 +84,16 @@ static void M_ChallengesAutoFocus(UINT8 unlockid, boolean fresh)
|
|||
challengesmenu.col = challengesmenu.hilix = i/CHALLENGEGRIDHEIGHT;
|
||||
challengesmenu.row = challengesmenu.hiliy = i%CHALLENGEGRIDHEIGHT;
|
||||
|
||||
// Begin animation
|
||||
if (challengesmenu.extradata[i].flip == 0)
|
||||
{
|
||||
challengesmenu.extradata[i].flip =
|
||||
(challengesmenu.pending
|
||||
? (TILEFLIP_MAX/2)
|
||||
: 1
|
||||
);
|
||||
}
|
||||
|
||||
if (fresh)
|
||||
{
|
||||
// We're just entering the menu. Immediately jump to the desired position...
|
||||
|
|
@ -261,7 +271,8 @@ void M_Challenges(INT32 choice)
|
|||
void M_ChallengesTick(void)
|
||||
{
|
||||
const UINT8 pid = 0;
|
||||
UINT8 i, newunlock = MAXUNLOCKABLES;
|
||||
UINT16 i;
|
||||
UINT8 newunlock = MAXUNLOCKABLES;
|
||||
|
||||
// Ticking
|
||||
challengesmenu.ticker++;
|
||||
|
|
@ -275,6 +286,29 @@ void M_ChallengesTick(void)
|
|||
challengesmenu.unlockcount[CC_ANIM]--;
|
||||
M_CupSelectTick();
|
||||
|
||||
// Update tile flip state.
|
||||
if (challengesmenu.extradata != NULL)
|
||||
{
|
||||
UINT16 id = (challengesmenu.hilix * CHALLENGEGRIDHEIGHT) + challengesmenu.hiliy;
|
||||
boolean seeeveryone = M_MenuButtonHeld(pid, MBT_R);
|
||||
boolean allthewaythrough;
|
||||
UINT8 maxflip;
|
||||
for (i = 0; i < (CHALLENGEGRIDHEIGHT * gamedata->challengegridwidth); i++)
|
||||
{
|
||||
allthewaythrough = (!seeeveryone && !challengesmenu.pending && i != id);
|
||||
maxflip = ((seeeveryone || !allthewaythrough) ? (TILEFLIP_MAX/2) : TILEFLIP_MAX);
|
||||
if ((seeeveryone || (challengesmenu.extradata[i].flip > 0))
|
||||
&& (challengesmenu.extradata[i].flip != maxflip))
|
||||
{
|
||||
challengesmenu.extradata[i].flip++;
|
||||
if (challengesmenu.extradata[i].flip >= TILEFLIP_MAX)
|
||||
{
|
||||
challengesmenu.extradata[i].flip = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (challengesmenu.pending)
|
||||
{
|
||||
// Pending mode.
|
||||
|
|
@ -594,8 +628,14 @@ boolean M_ChallengesInputs(INT32 ch)
|
|||
challengesmenu.hilix = gamedata->challengegridwidth-1;
|
||||
}
|
||||
}
|
||||
|
||||
i = (challengesmenu.hilix * CHALLENGEGRIDHEIGHT) + challengesmenu.hiliy;
|
||||
}
|
||||
|
||||
// Begin animation
|
||||
if (challengesmenu.extradata[i].flip == 0)
|
||||
challengesmenu.extradata[i].flip++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue