diff --git a/src/m_menu.c b/src/m_menu.c index 227f2c8224ffc1c4e30ea3463bbab613a3d4e266..2f9e16e9cafcf36f7dd41aeb1865880f8df651fb 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -141,6 +141,7 @@ static char *char_notes = NULL; boolean menuactive = false; boolean fromlevelselect = false; +static INT32 coolalphatimer = 9; typedef enum { LLM_CREATESERVER, @@ -1350,6 +1351,58 @@ static menuitem_t OP_VideoOptionsMenu[] = {IT_STRING | IT_CVAR, NULL, "Show \"FOCUS LOST\"", &cv_showfocuslost, 231}, }; +static const char* OP_VideoTooltips[] = +{ + NULL, + "Resolution the game runs at", + "Toggle between fullscreen and windowed mode", + "Sync game framerate to display refresh rate", + NULL, + #ifdef HWRENDER + "Toggle OpenGL and Software renderer", + #else + "Does nothing on this build", + #endif + "Adjusts field of view, allowing you to have a wider perspective", + "Set the game framerate", + #ifdef HWRENDER + "Options specific to the OpenGL renderer", + #else + "Does nothing on this build", + #endif + NULL, + "Gamma (brightness) of the game", + "Saturation of the game", + "Advanced color settings for the game", + NULL, + "Toggles the Heads-up display", + "Changes the transparency of the Heads-up display", + "The appearance of the score, time and rings display", + "Show remaining duration of power up items", + "Display your ping to the server next to the FPS counter", + "Show the names of fellow players when you are near them", + NULL, + "Change the background color of the console", + "Adjust the text size of the console", + NULL, + "Choose how the game chat is displayed", + "Change the width of the chat box", + "Change the height of the chat box", + "How long chat messages appear on screen before fading out", + "Plays a chat notification sound", + "Block chat messages from sending too fast", + "Background for the chatbox", + NULL, + "How far to render objects", + "How far to render precipitation(rain/snow)", + "How far to render hoops in NiGHTS mode", + NULL, + "Display the game's framerate", + "Display the game's ticrate", + "Fixes the hall of mirrors bug in the Software renderer", + "Display a 'Focus Lost' message when the window is unfocused" +}; + static menuitem_t OP_VideoModeMenu[] = { {IT_KEYHANDLER | IT_NOTHING, NULL, "", M_HandleVideoMode, 0}, // dummy menuitem for the control func @@ -3460,11 +3513,13 @@ boolean M_Responder(event_t *ev) case KEY_DOWNARROW: M_NextOpt(); S_StartSound(NULL, sfx_menu1); + coolalphatimer = 9; return true; case KEY_UPARROW: M_PrevOpt(); S_StartSound(NULL, sfx_menu1); + coolalphatimer = 9; return true; case KEY_LEFTARROW: @@ -4321,6 +4376,58 @@ static void M_DrawMenuTitle(void) } } + +static void M_DrawSplitText(INT32 x, INT32 y, INT32 option, const char* str, INT32 alpha) +{ + char* icopy = strdup(str); + char** clines = NULL; + INT16 num_lines = 0; + + if (icopy == NULL) return; + + char* tok = strtok(icopy, "\n"); + + while (tok != NULL) + { + char* line = strdup(tok); + + if (line == NULL) return; + + clines = realloc(clines, (num_lines + 1) * sizeof(char*)); + clines[num_lines] = line; + num_lines++; + + tok = strtok(NULL, "\n"); + } + + free(icopy); + + INT16 yoffset; + yoffset = (((5*10 - num_lines*10))); + + // Draw BG first,,, + for (int i = 0; i < num_lines; i++) + { + V_DrawFill(0, (y + yoffset - 6)+5, vid.width, 11, 159|V_SNAPTOBOTTOM|V_SNAPTOLEFT); + yoffset += 11; + } + + yoffset = (((5*10 - num_lines*10))); + + // THEN the text + for (int i = 0; i < num_lines; i++) + { + V_DrawCenteredThinString(x, y + yoffset, option, clines[i]); + V_DrawCenteredThinString(x, y + yoffset, option|V_YELLOWMAP|((9 - alpha) << V_ALPHASHIFT), clines[i]); + yoffset += 10; + // Remember to free the memory for each line when you're done with it. + free(clines[i]); + } + + free(clines); +} + + static void M_DrawGenericMenu(void) { INT32 x, y, i, cursory = 0; @@ -4706,6 +4813,8 @@ static void M_DrawGenericScrollMenu(void) // DRAW THE SKULL CURSOR V_DrawScaledPatch(currentMenu->x - 24, cursory, 0, W_CachePatchName("M_CURSOR", PU_PATCH)); + + DoToolTips(OP_VideoOptionsDef, OP_VideoTooltips); } static void M_DrawPauseMenu(void) diff --git a/src/m_menu.h b/src/m_menu.h index 01384493a321100936fb791b34b43fd0fc1fd84a..45ca6c2f2edae0b07e5494a244595019d7b0d200 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -578,4 +578,15 @@ void M_FreePlayerSetupColors(void); NULL\ } +#define DoToolTips(menu, tooltip)\ +if (currentMenu == &menu)\ +{\ + if (!(tooltip[itemOn] == NULL))\ + {\ + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, tooltip[itemOn], coolalphatimer);\ + if (coolalphatimer > 0)\ + coolalphatimer--;\ + }\ +} + #endif //__X_MENU__