Make menus much faster

This commit is contained in:
SinnamonLat 2022-07-22 12:08:24 +02:00
parent 10e23827c0
commit 3e904e23aa
4 changed files with 50 additions and 57 deletions

View file

@ -966,7 +966,7 @@ void M_DrawAddons(void);
source,\
0, 0,\
0, 0, \
1, 10,\
1, 5,\
M_DrawKartGamemodeMenu,\
NULL,\
NULL,\
@ -982,7 +982,7 @@ void M_DrawAddons(void);
source,\
0, 0,\
0, 0, \
1, 10,\
1, 5,\
M_DrawImageDef,\
NULL,\
NULL,\

View file

@ -153,7 +153,7 @@ menu_t PLAY_RaceDifficultyDef = {
PLAY_RaceDifficulty,
0, 0,
0, 0,
1, 10,
1, 5,
M_DrawRaceDifficulty,
NULL,
NULL,
@ -174,7 +174,7 @@ menu_t PLAY_CupSelectDef = {
PLAY_CupSelect,
0, 0,
0, 0,
2, 10,
2, 5,
M_DrawCupSelect,
M_CupSelectTick,
NULL,
@ -194,7 +194,7 @@ menu_t PLAY_LevelSelectDef = {
PLAY_LevelSelect,
0, 0,
0, 0,
2, 10,
2, 5,
M_DrawLevelSelect,
M_LevelSelectTick,
NULL,
@ -217,7 +217,7 @@ menu_t PLAY_TimeAttackDef = {
PLAY_TimeAttack,
0, 0,
0, 0,
2, 10,
2, 5,
M_DrawTimeAttack,
NULL,
NULL,
@ -404,7 +404,7 @@ menu_t OPTIONS_MainDef = {
OPTIONS_Main,
0, 0,
SKINCOLOR_SLATE, 0,
2, 10,
2, 5,
M_DrawOptions,
M_OptionsTick,
NULL,
@ -426,7 +426,7 @@ menu_t OPTIONS_ProfilesDef = {
OPTIONS_Profiles,
32, 80,
SKINCOLOR_ULTRAMARINE, 0,
2, 10,
2, 5,
M_DrawProfileSelect,
M_OptionsTick,
NULL,
@ -447,7 +447,7 @@ menu_t MAIN_ProfilesDef = {
MAIN_Profiles,
32, 80,
SKINCOLOR_ULTRAMARINE, 0,
2, 10,
2, 5,
M_DrawProfileSelect,
M_OptionsTick,
NULL,
@ -481,7 +481,7 @@ menu_t OPTIONS_EditProfileDef = {
OPTIONS_EditProfile,
32, 80,
SKINCOLOR_ULTRAMARINE, 0,
2, 10,
2, 5,
M_DrawEditProfile,
M_HandleProfileEdit,
NULL,
@ -583,7 +583,7 @@ menu_t OPTIONS_ProfileControlsDef = {
OPTIONS_ProfileControls,
32, 80,
SKINCOLOR_ULTRAMARINE, 0,
3, 10,
3, 5,
M_DrawProfileControls,
M_HandleProfileControls,
NULL,
@ -645,7 +645,7 @@ menu_t OPTIONS_VideoDef = {
OPTIONS_Video,
32, 80,
SKINCOLOR_PLAGUE, 0,
2, 10,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,
NULL,
@ -667,7 +667,7 @@ menu_t OPTIONS_VideoModesDef = {
OPTIONS_VideoModes,
48, 80,
SKINCOLOR_PLAGUE, 0,
2, 10,
2, 5,
M_DrawVideoModes,
M_OptionsTick,
NULL,
@ -726,7 +726,7 @@ menu_t OPTIONS_VideoOGLDef = {
OPTIONS_VideoOGL,
32, 80,
SKINCOLOR_PLAGUE, 0,
2, 10,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,
NULL,
@ -790,7 +790,7 @@ menu_t OPTIONS_SoundDef = {
OPTIONS_Sound,
48, 80,
SKINCOLOR_THUNDER, 0,
2, 10,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,
NULL,
@ -846,7 +846,7 @@ menu_t OPTIONS_HUDDef = {
OPTIONS_HUD,
48, 80,
SKINCOLOR_SUNSLAM, 0,
2, 10,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,
NULL,
@ -896,7 +896,7 @@ menu_t OPTIONS_HUDOnlineDef = {
OPTIONS_HUDOnline,
48, 80,
SKINCOLOR_SUNSLAM, 0,
2, 10,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,
NULL,
@ -950,7 +950,7 @@ menu_t OPTIONS_GameplayDef = {
OPTIONS_Gameplay,
48, 80,
SKINCOLOR_SCARLET, 0,
2, 10,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,
NULL,
@ -1009,7 +1009,7 @@ menu_t OPTIONS_GameplayItemsDef = {
OPTIONS_GameplayItems,
14, 40,
SKINCOLOR_SCARLET, 0,
2, 10,
2, 5,
M_DrawItemToggles,
M_OptionsTick,
NULL,
@ -1074,7 +1074,7 @@ menu_t OPTIONS_ServerDef = {
OPTIONS_Server,
48, 70, // This menu here is slightly higher because there's a lot of options...
SKINCOLOR_VIOLET, 0,
2, 10,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,
NULL,
@ -1133,7 +1133,7 @@ menu_t OPTIONS_ServerAdvancedDef = {
OPTIONS_ServerAdvanced,
48, 70, // This menu here is slightly higher because there's a lot of options...
SKINCOLOR_VIOLET, 0,
2, 10,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,
NULL,
@ -1175,7 +1175,7 @@ menu_t OPTIONS_DataDef = {
OPTIONS_Data,
48, 80,
SKINCOLOR_BLUEBERRY, 0,
2, 10,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,
NULL,
@ -1222,7 +1222,7 @@ menu_t OPTIONS_DataAddonDef = {
OPTIONS_DataAddon,
48, 80,
SKINCOLOR_BLUEBERRY, 0,
2, 10,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,
NULL,
@ -1263,7 +1263,7 @@ menu_t OPTIONS_DataScreenshotDef = {
OPTIONS_DataScreenshot,
48, 80,
SKINCOLOR_BLUEBERRY, 0,
2, 10,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,
NULL,
@ -1287,7 +1287,7 @@ menu_t OPTIONS_DataReplayDef = {
OPTIONS_DataReplay,
48, 80,
SKINCOLOR_BLUEBERRY, 0,
2, 10,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,
NULL,
@ -1325,7 +1325,7 @@ menu_t OPTIONS_DataDiscordDef = {
OPTIONS_DataDiscord,
48, 80,
SKINCOLOR_BLUEBERRY, 0,
2, 10,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,
NULL,
@ -1365,7 +1365,7 @@ menu_t OPTIONS_DataEraseDef = {
OPTIONS_DataErase,
48, 80,
SKINCOLOR_BLUEBERRY, 0,
2, 10,
2, 5,
M_DrawGenericOptions,
M_OptionsTick,
NULL,
@ -1385,7 +1385,7 @@ menu_t OPTIONS_DataProfileEraseDef = {
OPTIONS_DataProfileErase,
48, 80,
SKINCOLOR_BLUEBERRY, 0,
2, 10,
2, 5,
M_DrawProfileErase,
M_OptionsTick,
NULL,
@ -1418,7 +1418,7 @@ menu_t EXTRAS_MainDef = {
EXTRAS_Main,
0, 0,
0, 0,
2, 10,
2, 5,
M_DrawExtras,
M_ExtrasTick,
NULL,

View file

@ -659,7 +659,7 @@ void M_DrawKartGamemodeMenu(void)
if (menutransition.tics)
{
x += 24 * menutransition.tics;
x += 48 * menutransition.tics;
}
for (i = 0; i < currentMenu->numitems; i++)
@ -671,7 +671,7 @@ void M_DrawKartGamemodeMenu(void)
if (menutransition.tics)
{
x += 24 * menutransition.tics;
x += 48 * menutransition.tics;
}
}
@ -1560,11 +1560,11 @@ void M_DrawRaceDifficulty(void)
M_DrawMenuTooltips();
// Draw the box for difficulty...
V_DrawFixedPatch((111 + 24*menutransition.tics)*FRACUNIT, 33*FRACUNIT, FRACUNIT, 0, box, NULL);
V_DrawFixedPatch((111 + 48*menutransition.tics)*FRACUNIT, 33*FRACUNIT, FRACUNIT, 0, box, NULL);
if (menutransition.tics)
{
x += 24 * menutransition.tics;
x += 48 * menutransition.tics;
}
for (i = 0; i < currentMenu->numitems; i++)
@ -1584,7 +1584,7 @@ void M_DrawRaceDifficulty(void)
if (menutransition.tics)
{
x += 24 * menutransition.tics;
x += 48 * menutransition.tics;
}
}
@ -1597,12 +1597,12 @@ void M_DrawRaceDifficulty(void)
INT32 f = (i == itemOn) ? highlightflags : 0;
V_DrawString(140 + 24*menutransition.tics, y, f, currentMenu->menuitems[i].text);
V_DrawString(140 + 48*menutransition.tics, y, f, currentMenu->menuitems[i].text);
if (currentMenu->menuitems[i].status & IT_CVAR)
{
// implicitely we'll only take care of normal cvars
INT32 cx = 260 + 24*menutransition.tics;
INT32 cx = 260 + 48*menutransition.tics;
consvar_t *cv = currentMenu->menuitems[i].itemaction.cvar;
V_DrawCenteredString(cx, y, f, cv->string);
@ -1640,8 +1640,8 @@ void M_DrawRaceDifficulty(void)
if (currentMenu->menuitems[i].status & IT_CVAR)
{
INT32 fx = (x - 24*menutransition.tics);
INT32 centx = fx + (320-fx)/2 + (menutransition.tics*24); // undo the menutransition movement to redo it here otherwise the text won't move at the same speed lole.
INT32 fx = (x - 48*menutransition.tics);
INT32 centx = fx + (320-fx)/2 + (menutransition.tics*48); // undo the menutransition movement to redo it here otherwise the text won't move at the same speed lole.
// implicitely we'll only take care of normal consvars
consvar_t *cv = currentMenu->menuitems[i].itemaction.cvar;
@ -1783,7 +1783,7 @@ void M_DrawCupSelect(void)
patch = W_CachePatchName("CUPMON1A", PU_CACHE);
x = 14 + (i*42);
y = 20 + (j*44) - (15*menutransition.tics);
y = 20 + (j*44) - (30*menutransition.tics);
V_DrawScaledPatch(x, y, 0, patch);
@ -1801,12 +1801,12 @@ void M_DrawCupSelect(void)
}
V_DrawScaledPatch(14 + (cupgrid.x*42) - 4,
20 + (cupgrid.y*44) - 1 - (12*menutransition.tics),
20 + (cupgrid.y*44) - 1 - (24*menutransition.tics),
0, W_CachePatchName("CUPCURS", PU_CACHE)
);
M_DrawCupPreview(146 + (12*menutransition.tics), cup);
M_DrawCupTitle(120 - (12*menutransition.tics), cup);
M_DrawCupPreview(146 + (24*menutransition.tics), cup);
M_DrawCupTitle(120 - (24*menutransition.tics), cup);
}
static void M_DrawHighLowLevelTitle(INT16 x, INT16 y, INT16 map)
@ -1942,7 +1942,7 @@ void M_DrawLevelSelect(void)
INT16 i;
INT16 start = M_GetFirstLevelInList(levellist.newgametype);
INT16 map = start;
INT16 t = (32*menutransition.tics), tay = 0;
INT16 t = (64*menutransition.tics), tay = 0;
INT16 y = 80 - (12 * levellist.y);
boolean tatransition = ((menutransition.startmenu == &PLAY_TimeAttackDef || menutransition.endmenu == &PLAY_TimeAttackDef) && menutransition.tics);
@ -1983,7 +1983,7 @@ void M_DrawLevelSelect(void)
void M_DrawTimeAttack(void)
{
INT16 map = levellist.choosemap;
INT16 t = (24*menutransition.tics);
INT16 t = (48*menutransition.tics);
INT16 leftedge = 149+t+16;
INT16 rightedge = 149+t+155;
INT16 opty = 152;
@ -2561,7 +2561,7 @@ void M_DrawProfileSelect(void)
INT32 i;
const INT32 maxp = PR_GetNumProfiles();
INT32 x = 160 - optionsmenu.profilen*(128 + 128/8) + optionsmenu.offset;
INT32 y = 35 + menutransition.tics*16;
INT32 y = 35 + menutransition.tics*32;
M_DrawOptionsCogs();
M_DrawMenuTooltips();

View file

@ -3656,20 +3656,13 @@ void M_LevelSelectHandler(INT32 choice)
void M_LevelSelectTick(void)
{
UINT8 times = 1 + (abs(levellist.dest - levellist.y) / 21);
while (times) // increase speed as you're farther away
{
if (levellist.y > levellist.dest)
levellist.y--;
else if (levellist.y < levellist.dest)
levellist.y++;
INT16 dist = levellist.dest - levellist.y;
if (levellist.y == levellist.dest)
break;
times--;
}
if (abs(dist) == 1) // cheating to avoid off by 1 errors with divisions.
levellist.y = levellist.dest;
else
levellist.y += dist/2;
}
struct mpmenu_s mpmenu;