diff --git a/src/k_kart.c b/src/k_kart.c index ce9918d85..247c549bc 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -54,6 +54,10 @@ consvar_t cv_mini_yoffset = {"hud_minimap_yoffset", "0", CV_SAVE, NULL, NULL, 0, consvar_t cv_want_xoffset = {"hud_wanted_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_want_yoffset = {"hud_wanted_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_stat_xoffset = {"hud_stat_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_stat_yoffset = {"hud_stat_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; + +consvar_t cv_showstats = {"showstats", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_showinput = {"showinput", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_newspeedometer = {"newspeedometer", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -679,7 +683,10 @@ void K_RegisterKartStuff(void) CV_RegisterVar(&cv_mini_yoffset); CV_RegisterVar(&cv_want_xoffset); CV_RegisterVar(&cv_want_yoffset); + CV_RegisterVar(&cv_stat_xoffset); + CV_RegisterVar(&cv_stat_yoffset); + CV_RegisterVar(&cv_showstats); CV_RegisterVar(&cv_showinput); CV_RegisterVar(&cv_newspeedometer); @@ -7531,6 +7538,100 @@ INT32 K_calcSplitFlags(INT32 snapflags) return (splitflags|snapflags); } +static void K_drawKartStats(void) +{ + INT32 x, y, spdoffset, flags; + + // For 1-player display + x = 15; + y = 150; + spdoffset = 0; + flags = V_SNAPTOBOTTOM|V_SNAPTOLEFT; + + UINT8 splitnum = 0; + + for (; splitnum < MAXSPLITSCREENPLAYERS; ++splitnum) + { + if (stplyr == &players[displayplayers[splitnum]]) + break; + } + + // I tried my best, but this is still mess :/ + if (splitscreen) + { + if (splitscreen == 1) + { + // If we are in 2-player splitscreen, for player 1 we move hud to up and remove snapping + // to bottom + if (splitnum == 0) + { + y /= 2; + flags = V_SNAPTOLEFT; + } + else + { + // Can move it down a bit + y += 20; + } + } + else + { + // In 4-player splitscreen... + flags = 0; + + // ...For players 2 and 4, which are at right side, we move x coordinate... + if (splitnum == 1 || splitnum == 3) + x += BASEVIDWIDTH/2; + // ...Else, for players on left side we can snap position to left... + else + flags |= V_SNAPTOLEFT; + + // ...For players 1 and 2, which are at top side, we move y coordinate... + if (splitnum == 0 || splitnum == 1) + y /= 2; + // ...Else, for players on bottom side we can snap position to bottom + else + { + flags |= V_SNAPTOBOTTOM; + // Can move it down a bit + y += 20; + } + } + } + + //Internal offset for speedometer + if (cv_kartspeedometer.value) + { + if (cv_newspeedometer.value) + spdoffset = -10; + else + spdoffset = -14; + } + else + spdoffset = 0; + + // Customizations c: + x += cv_stat_xoffset.value; + y += cv_stat_yoffset.value + (G_BattleGametype() ? (stplyr->kartstuff[k_bumper] ? -5 : -8) : 0) + spdoffset; + flags |= V_HUDTRANS; + + if (!splitscreen) + { + // Skin name + V_DrawSmallString(x+20, y+12, flags|V_ALLOWLOWERCASE, va("%c%s", V_GetSkincolorChar(stplyr->skincolor), skins[stplyr->skin].realname)); + + // Icon and stats + V_DrawMappedPatch(x, y, flags, W_CachePatchName(skins[stplyr->skin].facerank, PU_CACHE), R_GetTranslationColormap(stplyr->skin, stplyr->skincolor, GTC_CACHE)); + V_DrawMappedPatch(x-3, y-2, flags, kp_facenum[min(9, max(1, stplyr->kartspeed))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BLUEBERRY, GTC_CACHE)); + V_DrawMappedPatch(x+10, y+10, flags, kp_facenum[min(9, max(1, stplyr->kartweight))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BURGUNDY, GTC_CACHE)); + } + else + { + // In splitscreen, just draw a string with stats + V_DrawString(x, y+10, flags, va("\x84%dS \x87%dW", stplyr->kartspeed, stplyr->kartweight)); + } +} + static void K_drawKartItem(void) { // ITEM_X = BASEVIDWIDTH-50; // 270 @@ -9809,6 +9910,9 @@ void K_drawKartHUD(void) #endif K_drawInput(); + if (!demo.title && cv_showstats.value) + K_drawKartStats(); + if (demo.title) // Draw title logo instead in demo.titles { INT32 x = BASEVIDWIDTH - 32, y = 128, offs; diff --git a/src/k_kart.h b/src/k_kart.h index 1b8e9c7ab..e5dbad724 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -26,6 +26,9 @@ extern consvar_t cv_colorizeditembox; extern consvar_t cv_colorizedhudcolor; extern consvar_t cv_darkitembox; extern consvar_t cv_biglaps; +extern consvar_t cv_stat_xoffset; +extern consvar_t cv_stat_yoffset; +extern consvar_t cv_showstats; boolean K_IsPlayerLosing(player_t *player); boolean K_IsPlayerWanted(player_t *player); diff --git a/src/m_menu.c b/src/m_menu.c index 454b6a3dd..040bc348e 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1721,21 +1721,23 @@ static menuitem_t OP_SaturnMenu[] = { {IT_HEADER, NULL, "Saturn Options", NULL, 0}, {IT_STRING | IT_CVAR, NULL, "Serverqueue waittime", &cv_connectawaittime, 15}, - {IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 35}, - {IT_STRING | IT_CVAR, NULL, "Input Display outside of RA", &cv_showinput, 45}, - {IT_STRING | IT_CVAR, NULL, "Small Speedometer", &cv_newspeedometer, 55}, - {IT_STRING | IT_CVAR, NULL, "Colourized HUD", &cv_colorizedhud, 65}, - {IT_STRING | IT_CVAR, NULL, "Colourized Itembox", &cv_colorizeditembox, 75}, - {IT_STRING | IT_CVAR, NULL, "Colourized HUD Color", &cv_colorizedhudcolor, 85}, - {IT_STRING | IT_CVAR, NULL, "Show Lap Emblem", &cv_showlapemblem, 95}, - {IT_STRING | IT_CVAR, NULL, "Show Minimap Names", &cv_showminimapnames, 105}, - {IT_STRING | IT_CVAR, NULL, "Small Minimap Players", &cv_minihead, 115}, - {IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 125}, + {IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 30}, + {IT_STRING | IT_CVAR, NULL, "Input Display outside of RA", &cv_showinput, 40}, + {IT_STRING | IT_CVAR, NULL, "Small Speedometer", &cv_newspeedometer, 50}, + {IT_STRING | IT_CVAR, NULL, "Stat Display", &cv_showstats, 60}, - {IT_SUBMENU|IT_STRING, NULL, "Player distortion...", &OP_PlayerDistortDef, 140}, - {IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 155}, + {IT_STRING | IT_CVAR, NULL, "Colourized HUD", &cv_colorizedhud, 75}, + {IT_STRING | IT_CVAR, NULL, "Colourized Itembox", &cv_colorizeditembox, 85}, + {IT_STRING | IT_CVAR, NULL, "Colourized HUD Color", &cv_colorizedhudcolor, 95}, + {IT_STRING | IT_CVAR, NULL, "Show Lap Emblem", &cv_showlapemblem, 105}, + {IT_STRING | IT_CVAR, NULL, "Show Minimap Names", &cv_showminimapnames, 115}, + {IT_STRING | IT_CVAR, NULL, "Small Minimap Players", &cv_minihead, 125}, + {IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 135}, - {IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 170}, // uwu + {IT_SUBMENU|IT_STRING, NULL, "Player distortion...", &OP_PlayerDistortDef, 150}, + {IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 160}, + + {IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 175}, // uwu }; enum @@ -1745,6 +1747,7 @@ enum sm_skinselspeed, sm_input, sm_speedometer, + sm_statdisplay, sm_colorhud, sm_colorhud_customcolor, sm_lapemblem, @@ -1798,6 +1801,8 @@ static menuitem_t OP_HudOffsetMenu[] = {IT_STRING | IT_CVAR, NULL, "Miniranking Vertical Offset", &cv_face_yoffset, 130}, {IT_STRING | IT_CVAR, NULL, "Minimap Horizontal Offset", &cv_mini_xoffset, 145}, {IT_STRING | IT_CVAR, NULL, "Minimap Vertical Offset", &cv_mini_yoffset, 155}, + {IT_STRING | IT_CVAR, NULL, "Stat Display Horizontal Offset", &cv_stat_xoffset, 170}, + {IT_STRING | IT_CVAR, NULL, "Stat Display Vertical Offset", &cv_stat_yoffset, 180}, }; static menuitem_t OP_SaturnCreditsMenu[] = @@ -2417,9 +2422,9 @@ menu_t OP_DiscordOptionsDef = DEFAULTMENUSTYLE(NULL, OP_DiscordOptionsMenu, &OP_ #endif menu_t OP_EraseDataDef = DEFAULTMENUSTYLE("M_DATA", OP_EraseDataMenu, &OP_DataOptionsDef, 30, 30); -menu_t OP_SaturnDef = DEFAULTMENUSTYLE(NULL, OP_SaturnMenu, &OP_MainDef, 30, 15); +menu_t OP_SaturnDef = DEFAULTMENUSTYLE(NULL, OP_SaturnMenu, &OP_MainDef, 30, 10); menu_t OP_PlayerDistortDef = DEFAULTMENUSTYLE("M_VIDEO", OP_PlayerDistortMenu, &OP_SaturnDef, 30, 30); -menu_t OP_HudOffsetDef = DEFAULTMENUSTYLE(NULL, OP_HudOffsetMenu, &OP_SaturnDef, 30, 20); +menu_t OP_HudOffsetDef = DEFAULTMENUSTYLE(NULL, OP_HudOffsetMenu, &OP_SaturnDef, 30, 5); menu_t OP_SaturnCreditsDef = DEFAULTMENUSTYLE(NULL, OP_SaturnCreditsMenu, &OP_SaturnDef, 30, 10); menu_t OP_BirdDef = DEFAULTMENUSTYLE(NULL, OP_BirdMenu, &OP_MainDef, 30, 30);