Start on new menus

This commit is contained in:
TehRealSalt 2019-08-09 04:25:22 -04:00
parent 274dc434ff
commit f188c290e5
13 changed files with 762 additions and 2057 deletions

View file

@ -307,7 +307,7 @@ static void D_Display(void)
// set for all later
wipedefindex = gamestate; // wipe_xxx_toblack
if (gamestate == GS_TITLESCREEN && wipegamestate != GS_INTRO)
wipedefindex = wipe_timeattack_toblack;
wipedefindex = wipe_titlescreen_toblack;
else if (gamestate == GS_INTERMISSION)
{
if (intertype == int_spec) // Special Stage
@ -325,7 +325,7 @@ static void D_Display(void)
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeEndScreen();
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK, "FADEMAP0", false);
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_MENU, "FADEMAP0", false);
}
if (gamestate != GS_LEVEL && rendermode != render_none)
@ -360,7 +360,7 @@ static void D_Display(void)
HU_Drawer();
break;
case GS_TIMEATTACK:
case GS_MENU:
break;
case GS_INTRO:
@ -538,7 +538,7 @@ static void D_Display(void)
vid.recalc = 0;
// FIXME: draw either console or menu, not the two
if (gamestate != GS_TIMEATTACK)
if (gamestate != GS_MENU)
CON_Drawer();
M_Drawer(); // menu is drawn even on top of everything
@ -556,7 +556,7 @@ static void D_Display(void)
if (rendermode != render_none)
{
F_WipeEndScreen();
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK, "FADEMAP0", true);
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_MENU, "FADEMAP0", true);
}
}

View file

@ -3296,13 +3296,13 @@ static void readwipes(MYFILE *f)
else if (fastcmp(pword, "FINAL"))
wipeoffset = wipe_titlescreen_final;
}
else if (fastncmp(word, "TIMEATTACK_", 11))
else if (fastncmp(word, "MENU_", 11))
{
pword = word + 11;
if (fastcmp(pword, "TOBLACK"))
wipeoffset = wipe_timeattack_toblack;
wipeoffset = wipe_menu_toblack;
else if (fastcmp(pword, "FINAL"))
wipeoffset = wipe_timeattack_final;
wipeoffset = wipe_menu_final;
}
else if (fastncmp(word, "CREDITS_", 8))
{

View file

@ -85,7 +85,7 @@ enum
wipe_voting_toblack,
wipe_continuing_toblack,
wipe_titlescreen_toblack,
wipe_timeattack_toblack,
wipe_menu_toblack,
wipe_credits_toblack,
wipe_evaluation_toblack,
wipe_gameend_toblack,
@ -102,7 +102,7 @@ enum
wipe_voting_final,
wipe_continuing_final,
wipe_titlescreen_final,
wipe_timeattack_final,
wipe_menu_final,
wipe_credits_final,
wipe_evaluation_final,
wipe_gameend_final,

View file

@ -55,7 +55,7 @@ UINT8 wipedefs[NUMWIPEDEFS] = {
0, // wipe_voting_toblack,
0, // wipe_continuing_toblack
0, // wipe_titlescreen_toblack
0, // wipe_timeattack_toblack
1, // wipe_menu_toblack
99, // wipe_credits_toblack
0, // wipe_evaluation_toblack
0, // wipe_gameend_toblack
@ -71,7 +71,7 @@ UINT8 wipedefs[NUMWIPEDEFS] = {
0, // wipe_voting_final
0, // wipe_continuing_final
0, // wipe_titlescreen_final
0, // wipe_timeattack_final
1, // wipe_menu_final
99, // wipe_credits_final
0, // wipe_evaluation_final
0, // wipe_gameend_final

View file

@ -2412,7 +2412,7 @@ void G_Ticker(boolean run)
HU_Ticker();
break;
case GS_TIMEATTACK:
case GS_MENU:
break;
case GS_INTRO:
@ -3442,8 +3442,7 @@ INT16 G_SometimesGetDifferentGametype(void)
//
UINT8 G_GetGametypeColor(INT16 gt)
{
if (modeattacking // == ATTACKING_RECORD
|| gamestate == GS_TIMEATTACK)
if (modeattacking) // == ATTACKING_RECORD
return orangemap[0];
if (gt == GT_MATCH)
return redmap[0];

View file

@ -27,7 +27,7 @@ typedef enum
GS_CONTINUING, // continue screen
GS_TITLESCREEN, // title screen
GS_TIMEATTACK, // time attack menu
GS_MENU, // SRB2Kart: menu-only (previously was GS_TIMEATTACK)
GS_CREDITS, // credit sequence
GS_EVALUATION, // Evaluation at the end of a game.
GS_GAMEEND, // game end sequence

View file

@ -66,6 +66,7 @@
//-------------------------------------------
patch_t *hu_font[HU_FONTSIZE];
patch_t *kart_font[KART_FONTSIZE]; // SRB2kart
patch_t *gamemode_font[AZ_FONTSIZE];
patch_t *tny_font[HU_FONTSIZE];
patch_t *tallnum[10]; // 0-9
patch_t *nightsnum[10]; // 0-9
@ -237,6 +238,17 @@ void HU_LoadGraphics(void)
else
kart_font[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
}
j = AZ_FONTSTART; // All A to Z font sets
for (i = 0; i < AZ_FONTSIZE; i++, j++)
{
// Gamemode font
sprintf(buffer, "GAMEM%.3d", j);
if (W_CheckNumForName(buffer) == LUMPERROR)
gamemode_font[i] = NULL;
else
gamemode_font[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
}
//
j = LT_FONTSTART;

View file

@ -31,6 +31,11 @@
#define KART_FONTEND 'Z'
#define KART_FONTSIZE (KART_FONTEND - KART_FONTSTART + 1)
#define AZ_FONTSTART 'A' // the first font character
#define AZ_FONTEND 'Z'
#define AZ_FONTSIZE (AZ_FONTEND - AZ_FONTSTART + 1)
//
// Level title font
@ -78,7 +83,8 @@ void HU_AddChatText(const char *text, boolean playsound);
// set true when entering a chat message
extern boolean chat_on;
extern patch_t *hu_font[HU_FONTSIZE], *kart_font[KART_FONTSIZE], *tny_font[HU_FONTSIZE]; // SRB2kart
extern patch_t *hu_font[HU_FONTSIZE], *tny_font[HU_FONTSIZE];
extern patch_t *kart_font[KART_FONTSIZE], *gamemode_font[AZ_FONTSIZE]; // SRB2kart
extern patch_t *tallnum[10];
extern patch_t *pingnum[10];
extern patch_t *pinggfx[5];

View file

@ -58,20 +58,6 @@ typedef struct
// ==========================================================================
// Cheat responders
/*static UINT8 cheatf_ultimate(void)
{
if (menuactive && (currentMenu != &MainDef && currentMenu != &SP_LoadDef))
return 0; // Only on the main menu, or the save select!
S_StartSound(0, sfx_itemup);
ultimate_selectable = (!ultimate_selectable);
// If on the save select, move to what is now Ultimate Mode!
if (currentMenu == &SP_LoadDef)
M_ForceSaveSlotSelected(NOSAVESLOT);
return 1;
}*/
static UINT8 cheatf_warp(void)
{
UINT8 i;

File diff suppressed because it is too large Load diff

View file

@ -150,8 +150,8 @@ typedef struct menuitem_s
// FIXME: should be itemaction_t
void *itemaction;
// hotkey in menu or y of the item
UINT8 alphaKey;
// extra variables
UINT8 mvar1;
} menuitem_t;
extern menuitem_t PlayerMenu[MAXSKINS];
@ -244,6 +244,19 @@ void M_SetPlaybackMenuPointer(void);
INT32 HU_GetHighlightColor(void);
// These defines make it a little easier to make menus
#define KARTGAMEMODEMENU(header, source, prev)\
{\
header,\
sizeof(source)/sizeof(menuitem_t),\
prev,\
source,\
M_DrawGenericMenu,\
M_DrawKartGamemodeMenu,\
0, 0,\
0,\
NULL\
}
#define DEFAULTMENUSTYLE(header, source, prev, x, y)\
{\
header,\
@ -268,18 +281,6 @@ INT32 HU_GetHighlightColor(void);
NULL\
}
#define CENTERMENUSTYLE(header, source, prev, y)\
{\
header,\
sizeof(source)/sizeof(menuitem_t),\
prev,\
source,\
M_DrawCenteredMenu,\
BASEVIDWIDTH/2, y,\
0,\
NULL\
}
#define MAPICONMENUSTYLE(header, source, prev)\
{\
header,\

View file

@ -1608,6 +1608,18 @@ void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string)
}
}
void V_DrawCenteredString(INT32 x, INT32 y, INT32 option, const char *string)
{
x -= V_StringWidth(string, option)/2;
V_DrawString(x, y, option, string);
}
void V_DrawRightAlignedString(INT32 x, INT32 y, INT32 option, const char *string)
{
x -= V_StringWidth(string, option);
V_DrawString(x, y, option, string);
}
// SRB2kart
void V_DrawKartString(INT32 x, INT32 y, INT32 option, const char *string)
{
@ -1709,20 +1721,79 @@ void V_DrawKartString(INT32 x, INT32 y, INT32 option, const char *string)
cx += w;
}
}
void V_DrawGamemodeString(INT32 x, INT32 y, INT32 option, const char *string, UINT8 color)
{
INT32 w, c, cx = x, cy = y, dupx, dupy, scrwidth, left = 0;
const char *ch = string;
const UINT8 *colormap = NULL;
option &= ~V_FLIP;
if (option & V_NOSCALESTART)
{
dupx = vid.dupx;
dupy = vid.dupy;
scrwidth = vid.width;
}
else
{
dupx = dupy = 1;
scrwidth = vid.width/vid.dupx;
left = (scrwidth - BASEVIDWIDTH)/2;
}
colormap = R_GetTranslationColormap(TC_DEFAULT, color, GTC_MENUCACHE);
for (;;ch++)
{
if (!*ch)
break;
if (*ch == '\n')
{
cx = x;
cy += 34*dupy;
continue;
}
c = toupper(*ch) - AZ_FONTSTART;
// character does not exist or is a space
if (c < 0 || c >= AZ_FONTSIZE || !gamemode_font[c])
continue;
w = (SHORT(gamemode_font[c]->width) - 2) * dupx;
if (cx > scrwidth)
break;
if (cx+left + w < 0) //left boundary check
{
cx += w;
continue;
}
V_DrawFixedPatch(cx<<FRACBITS, cy<<FRACBITS, FRACUNIT, option, gamemode_font[c], colormap);
cx += w;
}
}
void V_DrawCenteredGamemodeString(INT32 x, INT32 y, INT32 option, const char *string, UINT8 color)
{
x -= V_GamemodeStringWidth(string, option)/2;
V_DrawGamemodeString(x, y, option, string, color);
}
void V_DrawRightAlignedGamemodeString(INT32 x, INT32 y, INT32 option, const char *string, UINT8 color)
{
x -= V_GamemodeStringWidth(string, option);
V_DrawGamemodeString(x, y, option, string, color);
}
//
void V_DrawCenteredString(INT32 x, INT32 y, INT32 option, const char *string)
{
x -= V_StringWidth(string, option)/2;
V_DrawString(x, y, option, string);
}
void V_DrawRightAlignedString(INT32 x, INT32 y, INT32 option, const char *string)
{
x -= V_StringWidth(string, option);
V_DrawString(x, y, option, string);
}
//
// Write a string using the hu_font, 0.5x scale
// NOTE: the text is centered for screens larger than the base width
@ -2402,6 +2473,30 @@ INT32 V_ThinStringWidth(const char *string, INT32 option)
return w;
}
//
// Find string width from gamemode_font chars
//
INT32 V_GamemodeStringWidth(const char *string, INT32 option)
{
INT32 c, w = 0;
size_t i;
(void)option;
for (i = 0; i < strlen(string); i++)
{
c = string[i];
c = toupper(c) - AZ_FONTSTART;
if (c < 0 || c >= AZ_FONTSIZE || !gamemode_font[c])
continue;
else
w += SHORT(gamemode_font[c]->width) - 2;
}
return w;
}
boolean *heatshifter = NULL;
INT32 lastheight = 0;
INT32 heatindex[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0};

View file

@ -175,10 +175,15 @@ char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string);
// draw a string using the hu_font
void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string);
void V_DrawKartString(INT32 x, INT32 y, INT32 option, const char *string); // SRB2kart
void V_DrawCenteredString(INT32 x, INT32 y, INT32 option, const char *string);
void V_DrawRightAlignedString(INT32 x, INT32 y, INT32 option, const char *string);
// SRB2kart
void V_DrawKartString(INT32 x, INT32 y, INT32 option, const char *string);
void V_DrawGamemodeString(INT32 x, INT32 y, INT32 option, const char *string, UINT8 color);
void V_DrawCenteredGamemodeString(INT32 x, INT32 y, INT32 option, const char *string, UINT8 color);
void V_DrawRightAlignedGamemodeString(INT32 x, INT32 y, INT32 option, const char *string, UINT8 color);
// draw a string using the hu_font, 0.5x scale
void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string);
void V_DrawRightAlignedSmallString(INT32 x, INT32 y, INT32 option, const char *string);
@ -212,6 +217,9 @@ INT32 V_SmallStringWidth(const char *string, INT32 option);
// Find string width from tny_font chars
INT32 V_ThinStringWidth(const char *string, INT32 option);
// SRB2Kart
INT32 V_GamemodeStringWidth(const char *string, INT32 option);
void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param);
void V_DrawPatchFill(patch_t *pat);