Time Attack screen

No functionality ported yet
This commit is contained in:
TehRealSalt 2019-10-04 13:27:09 -04:00
parent 67e63442da
commit 94e8fddd46
4 changed files with 169 additions and 45 deletions

View file

@ -157,6 +157,9 @@ extern menu_t PLAY_CupSelectDef;
extern menuitem_t PLAY_LevelSelect[]; extern menuitem_t PLAY_LevelSelect[];
extern menu_t PLAY_LevelSelectDef; extern menu_t PLAY_LevelSelectDef;
extern menuitem_t PLAY_TimeAttack[];
extern menu_t PLAY_TimeAttackDef;
extern menuitem_t PLAY_BattleGamemodesMenu[]; extern menuitem_t PLAY_BattleGamemodesMenu[];
extern menu_t PLAY_BattleGamemodesDef; extern menu_t PLAY_BattleGamemodesDef;
@ -191,7 +194,8 @@ extern INT16 skullAnimCounter; // skull animation counter
extern struct menutransition_s { extern struct menutransition_s {
INT16 tics; INT16 tics;
INT16 dest; INT16 dest;
struct menu_s *newmenu; struct menu_s *startmenu;
struct menu_s *endmenu;
boolean in; boolean in;
} menutransition; } menutransition;
@ -336,6 +340,7 @@ void M_DrawCharacterSelect(void);
void M_DrawCupSelect(void); void M_DrawCupSelect(void);
void M_DrawLevelSelect(void); void M_DrawLevelSelect(void);
void M_DrawTimeAttack(void);
void M_DrawPlaybackMenu(void); void M_DrawPlaybackMenu(void);

View file

@ -132,6 +132,26 @@ menu_t PLAY_LevelSelectDef = {
NULL NULL
}; };
menuitem_t PLAY_TimeAttack[] =
{
{IT_STRING, "Replay...", NULL, NULL, NULL, 0, 0},
{IT_STRING, "Ghosts...", NULL, NULL, NULL, 0, 0},
{IT_SPACE, NULL, NULL, NULL, NULL, 0, 0},
{IT_STRING, "Start", NULL, NULL, NULL, 0, 0},
};
menu_t PLAY_TimeAttackDef = {
sizeof(PLAY_TimeAttack) / sizeof(menuitem_t),
&PLAY_LevelSelectDef,
0,
PLAY_TimeAttack,
0, 0,
2, 10,
M_DrawTimeAttack,
NULL,
NULL
};
// BATTLE // BATTLE
menuitem_t PLAY_BattleGamemodesMenu[] = menuitem_t PLAY_BattleGamemodesMenu[] =

View file

@ -923,8 +923,8 @@ void M_DrawCupSelect(void)
static void M_DrawHighLowLevelTitle(INT16 x, INT16 y, INT16 map) static void M_DrawHighLowLevelTitle(INT16 x, INT16 y, INT16 map)
{ {
static char word1[21]; char word1[22];
static char word2[21]; char word2[22];
UINT8 word1len = 0; UINT8 word1len = 0;
UINT8 word2len = 0; UINT8 word2len = 0;
INT16 x2 = x; INT16 x2 = x;
@ -935,29 +935,44 @@ static void M_DrawHighLowLevelTitle(INT16 x, INT16 y, INT16 map)
if (mapheaderinfo[map]->zonttl[0]) if (mapheaderinfo[map]->zonttl[0])
{ {
strcpy(word1, mapheaderinfo[map]->lvlttl); boolean one = true;
strcpy(word2, mapheaderinfo[map]->zonttl); boolean two = true;
for (i = 0; i < 22; i++)
{
if (!one && !two)
break;
if (mapheaderinfo[map]->lvlttl[i] && one)
{
word1[word1len] = mapheaderinfo[map]->lvlttl[i];
word1len++;
}
else
one = false;
if (mapheaderinfo[map]->zonttl[i] && two)
{
word2[word2len] = mapheaderinfo[map]->zonttl[i];
word2len++;
}
else
two = false;
}
} }
else else
{ {
boolean donewithone = false; boolean donewithone = false;
for (i = 0; i < 21; i++) for (i = 0; i < 22; i++)
{ {
if (!mapheaderinfo[map]->lvlttl[i]) if (!mapheaderinfo[map]->lvlttl[i])
{
if (donewithone)
word2[word2len] = '\0';
else
word1[word1len] = '\0';
break; break;
}
if (mapheaderinfo[map]->lvlttl[i] == ' ') if (mapheaderinfo[map]->lvlttl[i] == ' ')
{ {
if (!donewithone) if (!donewithone)
{ {
word1[word1len] = '\0';
donewithone = true; donewithone = true;
continue; continue;
} }
@ -976,6 +991,9 @@ static void M_DrawHighLowLevelTitle(INT16 x, INT16 y, INT16 map)
} }
} }
word1[word1len] = '\0';
word2[word2len] = '\0';
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
{ {
INT32 c; INT32 c;
@ -991,42 +1009,110 @@ static void M_DrawHighLowLevelTitle(INT16 x, INT16 y, INT16 map)
V_DrawLSTitleLowString(x2, y+28, 0, word2); V_DrawLSTitleLowString(x2, y+28, 0, word2);
} }
static void M_DrawLevelSelectBlock(INT16 x, INT16 y, INT16 map, boolean redblink, boolean greyscale)
{
lumpnum_t lumpnum;
patch_t *PictureOfLevel;
UINT8 *colormap = NULL;
if (greyscale)
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_GREY, GTC_MENUCACHE);
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(map)));
if (lumpnum != LUMPERROR)
PictureOfLevel = W_CachePatchNum(lumpnum, PU_CACHE);
else
PictureOfLevel = W_CachePatchName("BLANKLVL", PU_CACHE);
if (redblink)
V_DrawScaledPatch(3+x, y, 0, W_CachePatchName("LVLSEL2", PU_CACHE));
else
V_DrawScaledPatch(3+x, y, 0, W_CachePatchName("LVLSEL", PU_CACHE));
V_DrawSmallMappedPatch(9+x, y+6, 0, PictureOfLevel, colormap);
M_DrawHighLowLevelTitle(98+x, y+8, map-1);
}
void M_DrawLevelSelect(void) void M_DrawLevelSelect(void)
{ {
UINT8 i; UINT8 i;
INT16 t = (32*menutransition.tics); INT16 t = (32*menutransition.tics), tay = 0;
INT16 y = 80 - (12 * levellist_scroll.y); INT16 y = 80 - (12 * levellist_scroll.y);
boolean tatransition = (menutransition.startmenu == &PLAY_TimeAttackDef || menutransition.endmenu == &PLAY_TimeAttackDef);
if (tatransition)
{
t = -t;
tay = t/2;
}
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
{ {
lumpnum_t lumpnum;
patch_t *PictureOfLevel;
UINT8 *colormap = NULL;
INT16 map = 1 + (levellist_scroll.cupid * 5) + i; INT16 map = 1 + (levellist_scroll.cupid * 5) + i;
INT16 lvlx = t, lvly = y;
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(map))); if (i == levellist_scroll.cursor && tatransition)
if (lumpnum != LUMPERROR) {
PictureOfLevel = W_CachePatchNum(lumpnum, PU_CACHE); lvlx = 0;
else lvly = max(2, y+tay);
PictureOfLevel = W_CachePatchName("BLANKLVL", PU_CACHE); }
if (i == levellist_scroll.cursor && ((skullAnimCounter / 4) & 1)) M_DrawLevelSelectBlock(lvlx, lvly, map,
V_DrawScaledPatch(3+t, y, 0, W_CachePatchName("LVLSEL2", PU_CACHE)); (i == levellist_scroll.cursor && ((skullAnimCounter / 4) & 1)),
else (i != levellist_scroll.cursor)
V_DrawScaledPatch(3+t, y, 0, W_CachePatchName("LVLSEL", PU_CACHE)); );
if (i != levellist_scroll.cursor)
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_GREY, GTC_MENUCACHE);
V_DrawSmallMappedPatch(9+t, y+6, 0, PictureOfLevel, colormap);
M_DrawHighLowLevelTitle(98+t, y+8, map-1);
y += 72; y += 72;
} }
V_DrawScaledPatch(0, 0, 0, W_CachePatchName("MENUHINT", PU_CACHE)); V_DrawScaledPatch(0, tay, 0, W_CachePatchName("MENUHINT", PU_CACHE));
V_DrawCenteredLSTitleLowString(BASEVIDWIDTH/2, 6, 0, "SNEAKER CUP"); V_DrawCenteredLSTitleLowString(BASEVIDWIDTH/2, 6+tay, 0, "SNEAKER CUP");
}
void M_DrawTimeAttack(void)
{
INT16 map = cv_nextmap.value;
INT16 t = (24*menutransition.tics);
INT16 leftedge = 149+t+16;
INT16 rightedge = 149+t+155;
INT16 opty = 152;
lumpnum_t lumpnum;
UINT8 i;
M_DrawLevelSelectBlock(0, 2, map, false, false);
//V_DrawFill(24-t, 82, 100, 100, 36); // size test
lumpnum = W_CheckNumForName(va("%sR", G_BuildMapName(map)));
if (lumpnum != LUMPERROR)
V_DrawScaledPatch(24-t, 82, 0, W_CachePatchNum(lumpnum, PU_CACHE));
V_DrawScaledPatch(149+t, 70, 0, W_CachePatchName("BESTTIME", PU_CACHE));
V_DrawRightAlignedString(rightedge-12, 82, highlightflags, "BEST LAP:");
K_drawKartTimestamp(0, 162+t, 88, 0, 2);
V_DrawRightAlignedString(rightedge-12, 112, highlightflags, "BEST TIME:");
K_drawKartTimestamp(0, 162+t, 118, map, 1);
for (i = 0; i < currentMenu->numitems; i++)
{
UINT32 f = (i == itemOn) ? recommendedflags : highlightflags;
switch (currentMenu->menuitems[i].status & IT_DISPLAY)
{
case IT_STRING:
if (i >= currentMenu->numitems-1)
V_DrawRightAlignedString(rightedge, opty, f, currentMenu->menuitems[i].text);
else
V_DrawString(leftedge, opty, f, currentMenu->menuitems[i].text);
opty += 10;
break;
case IT_SPACE:
opty += 4;
break;
}
}
} }
// //

View file

@ -1180,10 +1180,12 @@ void M_SetupNextMenu(menu_t *menudef, boolean notransition)
if (currentMenu->transitionID == menudef->transitionID if (currentMenu->transitionID == menudef->transitionID
&& currentMenu->transitionTics) && currentMenu->transitionTics)
{ {
menutransition.startmenu = currentMenu;
menutransition.endmenu = menudef;
menutransition.tics = 0; menutransition.tics = 0;
menutransition.dest = currentMenu->transitionTics; menutransition.dest = currentMenu->transitionTics;
menutransition.in = false; menutransition.in = false;
menutransition.newmenu = menudef;
return; // Don't change menu yet, the transition will call this again return; // Don't change menu yet, the transition will call this again
} }
else if (gamestate == GS_MENU) else if (gamestate == GS_MENU)
@ -1267,12 +1269,15 @@ void M_Ticker(void)
// If dest is non-zero, we've started transition and want to switch menus // If dest is non-zero, we've started transition and want to switch menus
// If dest is zero, we're mid-transition and want to end it // If dest is zero, we're mid-transition and want to end it
if (menutransition.tics == menutransition.dest && menutransition.newmenu != NULL) if (menutransition.tics == menutransition.dest
&& menutransition.endmenu != NULL
&& currentMenu != menutransition.endmenu
)
{ {
if (currentMenu->transitionID == menutransition.newmenu->transitionID if (menutransition.startmenu->transitionID == menutransition.endmenu->transitionID
&& menutransition.newmenu->transitionTics) && menutransition.endmenu->transitionTics)
{ {
menutransition.tics = menutransition.newmenu->transitionTics; menutransition.tics = menutransition.endmenu->transitionTics;
menutransition.dest = 0; menutransition.dest = 0;
menutransition.in = true; menutransition.in = true;
} }
@ -1287,14 +1292,21 @@ void M_Ticker(void)
F_RunWipe(wipedefs[wipe_menu_toblack], false, "FADEMAP0", false, false); F_RunWipe(wipedefs[wipe_menu_toblack], false, "FADEMAP0", false, false);
} }
M_SetupNextMenu(menutransition.newmenu, true); M_SetupNextMenu(menutransition.endmenu, true);
menutransition.newmenu = NULL;
} }
} }
else else
{ {
// reset input trigger if (menuwipe)
noFurtherInput = false; {
// try not to let people input during the fadeout
noFurtherInput = true;
}
else
{
// reset input trigger
noFurtherInput = false;
}
} }
if (currentMenu->tickroutine) if (currentMenu->tickroutine)
@ -2214,7 +2226,8 @@ void M_LevelSelectHandler(INT32 choice)
S_StartSound(NULL, sfx_s3k5b); S_StartSound(NULL, sfx_s3k5b);
break; break;
case KEY_ENTER: case KEY_ENTER:
//M_SetupNextMenu(&PLAY_TimeAttack, false); CV_SetValue(&cv_nextmap, 1 + (levellist_scroll.cupid * 5) + levellist_scroll.cursor);
M_SetupNextMenu(&PLAY_TimeAttackDef, false);
S_StartSound(NULL, sfx_s3k63); S_StartSound(NULL, sfx_s3k63);
break; break;
case KEY_ESCAPE: case KEY_ESCAPE: