diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 3cf237a35..f8071de8b 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -918,6 +918,27 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_chatbacktint); CV_RegisterVar(&cv_songcredits); CV_RegisterVar(&cv_showfreeplay); + + CV_RegisterVar(&cv_item_xoffset); + CV_RegisterVar(&cv_item_yoffset); + CV_RegisterVar(&cv_time_xoffset); + CV_RegisterVar(&cv_time_yoffset); + CV_RegisterVar(&cv_laps_xoffset); + CV_RegisterVar(&cv_laps_yoffset); + CV_RegisterVar(&cv_spdm_xoffset); + CV_RegisterVar(&cv_spdm_yoffset); + CV_RegisterVar(&cv_posi_xoffset); + CV_RegisterVar(&cv_posi_yoffset); + CV_RegisterVar(&cv_face_xoffset); + CV_RegisterVar(&cv_face_yoffset); + CV_RegisterVar(&cv_stcd_xoffset); + CV_RegisterVar(&cv_stcd_yoffset); + CV_RegisterVar(&cv_chek_yoffset); + CV_RegisterVar(&cv_mini_xoffset); + CV_RegisterVar(&cv_mini_yoffset); + CV_RegisterVar(&cv_want_xoffset); + CV_RegisterVar(&cv_want_yoffset); + //CV_RegisterVar(&cv_crosshair); //CV_RegisterVar(&cv_crosshair2); //CV_RegisterVar(&cv_crosshair3); diff --git a/src/g_game.h b/src/g_game.h index 2671ffb4a..688ce3d5b 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -125,6 +125,27 @@ extern consvar_t cv_turnaxis3,cv_moveaxis3,cv_brakeaxis3,cv_aimaxis3,cv_lookaxis extern consvar_t cv_turnaxis4,cv_moveaxis4,cv_brakeaxis4,cv_aimaxis4,cv_lookaxis4,cv_fireaxis4,cv_driftaxis4,cv_lookbackaxis4,cv_xdeadzone4,cv_ydeadzone4; extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff; +// Hud offsets +extern consvar_t cv_item_xoffset; +extern consvar_t cv_item_yoffset; +extern consvar_t cv_time_xoffset; +extern consvar_t cv_time_yoffset; +extern consvar_t cv_laps_xoffset; +extern consvar_t cv_laps_yoffset; +extern consvar_t cv_spdm_xoffset; +extern consvar_t cv_spdm_yoffset; +extern consvar_t cv_posi_xoffset; +extern consvar_t cv_posi_yoffset; +extern consvar_t cv_face_xoffset; +extern consvar_t cv_face_yoffset; +extern consvar_t cv_stcd_xoffset; +extern consvar_t cv_stcd_yoffset; +extern consvar_t cv_chek_yoffset; +extern consvar_t cv_mini_xoffset; +extern consvar_t cv_mini_yoffset; +extern consvar_t cv_want_xoffset; +extern consvar_t cv_want_yoffset; + extern consvar_t cv_driftsparkpulse; extern consvar_t cv_gravstretch; extern consvar_t cv_sloperoll; diff --git a/src/k_kart.c b/src/k_kart.c index 8e498ed84..115eabea0 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -23,6 +23,36 @@ #include "lua_hud.h" // For Lua hud checks #include "lua_hook.h" // For MobjDamage and ShouldDamage +// Hud offset cvars +consvar_t cv_item_xoffset = {"hud_item_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_item_yoffset = {"hud_item_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; + +consvar_t cv_time_xoffset = {"hud_time_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_time_yoffset = {"hud_time_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; + +consvar_t cv_laps_xoffset = {"hud_laps_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_laps_yoffset = {"hud_laps_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; + +consvar_t cv_spdm_xoffset = {"hud_speed_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_spdm_yoffset = {"hud_speed_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; + +consvar_t cv_posi_xoffset = {"hud_position_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_posi_yoffset = {"hud_position_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; + +consvar_t cv_face_xoffset = {"hud_face_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_face_yoffset = {"hud_face_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; + +consvar_t cv_stcd_xoffset = {"hud_startcountdown_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_stcd_yoffset = {"hud_startcountdown_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; + +consvar_t cv_chek_yoffset = {"hud_check_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; + +consvar_t cv_mini_xoffset = {"hud_minimap_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_mini_yoffset = {"hud_minimap_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; + +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}; + // SOME IMPORTANT VARIABLES DEFINED IN DOOMDEF.H: // gamespeed is cc (0 for easy, 1 for normal, 2 for hard) // franticitems is Frantic Mode items, bool @@ -2850,7 +2880,7 @@ static void K_SpawnDriftSparks(player_t *player) spark->angle = travelangle-(ANGLE_45/5)*player->kartstuff[k_drift]; // scale increase while driftspark level gained timer is running - + // hack to find the correct player number for (pindex = 0; pindex < MAXPLAYERS; pindex++) { @@ -3013,11 +3043,11 @@ static angle_t K_GetSlopeRollAngle(player_t *p, boolean dontflip, boolean useRes angle_t zangle = 0; angle_t xydirection = 0; angle_t an; - + I_Assert(p != NULL); I_Assert(p->mo != NULL); I_Assert(!P_MobjWasRemoved(p->mo)); - + if (useReserves) { I_Assert(p->mo->reservezangle != NULL); @@ -3025,7 +3055,7 @@ static angle_t K_GetSlopeRollAngle(player_t *p, boolean dontflip, boolean useRes } lookAngle = R_PointToAngle(p->mo->x, p->mo->y); - + if (!R_PointToDist(p->mo->x, p->mo->y)) lookAngle = p->mo->angle; @@ -3070,7 +3100,7 @@ static void K_RollPlayerBySlopes(player_t *p, boolean usedistance) { p->mo->sloperoll = K_GetSlopeRollAngle(p, false, true); else p->mo->sloperoll = FixedAngle(0); - + return; } @@ -5382,7 +5412,7 @@ static void K_KartDrift(player_t *player, boolean onground) //S_StartSound(player->mo, sfx_s3ka2); if (P_IsLocalPlayer(player)) // UGHGHGH... S_StartSoundAtVolume(player->mo, sfx_s3ka2, 192); // Ugh... - + // hack to find the correct player number for (pindex = 0; pindex < MAXPLAYERS; pindex++) { @@ -5426,13 +5456,13 @@ static void K_KartDrift(player_t *player, boolean onground) { player->kartstuff[k_drift] = player->kartstuff[k_driftcharge] = 0; player->kartstuff[k_aizdriftstrat] = player->kartstuff[k_brakedrift] = 0; - + if (!player->sliproll) { player->sliptidemem = 0; player->sliproll = 0; } - + player->kartstuff[k_getsparks] = 0; } @@ -5449,7 +5479,7 @@ static void K_KartDrift(player_t *player, boolean onground) else if (player->kartstuff[k_aizdriftstrat] && !player->kartstuff[k_drift]) { K_SpawnAIZDust(player); - + if (player->sliproll < (32*ANG1)) player->sliproll += (4*ANG1); @@ -6176,7 +6206,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) // JugadorXEI: Do *not* calculate friction when a player is pogo'd // because they'll be in the air and friction will not reset! - if (onground && !player->kartstuff[k_pogospring]) + if (onground && !player->kartstuff[k_pogospring]) { // Friction if (!player->kartstuff[k_offroad]) @@ -6220,13 +6250,13 @@ void K_MoveKartPlayer(player_t *player, boolean onground) } K_KartDrift(player, onground); - + if ((!player->kartstuff[k_aizdriftstrat])||(!P_IsObjectOnGround(player->mo))||(player->kartstuff[k_drift])) { if (player->sliproll && (player->sliproll > 0)) player->sliproll -= (4*ANG1); } - + if (cv_gravstretch.value > 13107) K_StretchPlayerGravity(player); else @@ -6566,7 +6596,7 @@ void K_CheckSpectateStatus(void) return; // Allow if you're not in a level - if (gamestate != GS_LEVEL) + if (gamestate != GS_LEVEL) continue; // DON'T allow if anyone's exiting @@ -7127,81 +7157,81 @@ static void K_initKartHUD(void) // Single Screen (defaults) // Item Window - ITEM_X = 5; // 5 - ITEM_Y = 5; // 5 + ITEM_X = 5 + cv_item_xoffset.value; // 5 + ITEM_Y = 5 + cv_item_yoffset.value; // 5 // Level Timer - TIME_X = BASEVIDWIDTH - 148; // 172 - TIME_Y = 9; // 9 + TIME_X = BASEVIDWIDTH - 148 + cv_time_xoffset.value; // 172 + TIME_Y = 9 + cv_time_yoffset.value; // 9 // Level Laps - LAPS_X = 9; // 9 - LAPS_Y = BASEVIDHEIGHT - 29; // 171 + LAPS_X = 9 + cv_laps_xoffset.value; // 9 + LAPS_Y = BASEVIDHEIGHT - 29 + cv_laps_yoffset.value; // 171 // Speedometer - SPDM_X = 9; // 9 - SPDM_Y = BASEVIDHEIGHT - 45; // 155 + SPDM_X = 9 + cv_spdm_xoffset.value; // 9 + SPDM_Y = BASEVIDHEIGHT - 45 + cv_spdm_yoffset.value; // 155 // Position Number - POSI_X = BASEVIDWIDTH - 9; // 268 - POSI_Y = BASEVIDHEIGHT - 9; // 138 + POSI_X = BASEVIDWIDTH - 9 + cv_posi_xoffset.value; // 268 + POSI_Y = BASEVIDHEIGHT - 9 + cv_posi_yoffset.value; // 138 // Top-Four Faces - FACE_X = 9; // 9 - FACE_Y = 92; // 92 + FACE_X = 9 + cv_face_xoffset.value; // 9 + FACE_Y = 92 + cv_face_yoffset.value; // 92 // Starting countdown - STCD_X = BASEVIDWIDTH/2; // 9 - STCD_Y = BASEVIDHEIGHT/2; // 92 + STCD_X = BASEVIDWIDTH/2 + cv_stcd_xoffset.value; // 9 + STCD_Y = BASEVIDHEIGHT/2 + cv_stcd_yoffset.value; // 92 // CHECK graphic - CHEK_Y = BASEVIDHEIGHT; // 200 + CHEK_Y = BASEVIDHEIGHT + cv_chek_yoffset.value; // 200 // Minimap - MINI_X = BASEVIDWIDTH - 50; // 270 - MINI_Y = (BASEVIDHEIGHT/2)-16; // 84 + MINI_X = BASEVIDWIDTH - 50 + cv_mini_xoffset.value; // 270 + MINI_Y = (BASEVIDHEIGHT/2)-16 + cv_mini_yoffset.value; // 84 // Battle WANTED poster - WANT_X = BASEVIDWIDTH - 55; // 270 - WANT_Y = BASEVIDHEIGHT- 71; // 176 + WANT_X = BASEVIDWIDTH - 55 + cv_want_xoffset.value; // 270 + WANT_Y = BASEVIDHEIGHT- 71 + cv_want_yoffset.value; // 176 if (splitscreen) // Splitscreen { - ITEM_X = 5; - ITEM_Y = 3; + ITEM_X = 5 + cv_item_xoffset.value; + ITEM_Y = 3 + cv_item_yoffset.value; - LAPS_Y = (BASEVIDHEIGHT/2)-24; + LAPS_Y = (BASEVIDHEIGHT/2)-24 + cv_laps_yoffset.value; - POSI_Y = (BASEVIDHEIGHT/2)- 2; + POSI_Y = (BASEVIDHEIGHT/2)- 2 + cv_posi_yoffset.value; - STCD_Y = BASEVIDHEIGHT/4; + STCD_Y = BASEVIDHEIGHT/4 + cv_stcd_yoffset.value; - MINI_Y = (BASEVIDHEIGHT/2); + MINI_Y = (BASEVIDHEIGHT/2) + cv_mini_yoffset.value; if (splitscreen > 1) // 3P/4P Small Splitscreen { // 1P (top left) - ITEM_X = -9; - ITEM_Y = -8; + ITEM_X = -9 + cv_item_xoffset.value; + ITEM_Y = -8 + cv_item_yoffset.value; - LAPS_X = 3; - LAPS_Y = (BASEVIDHEIGHT/2)-13; + LAPS_X = 3 + cv_laps_xoffset.value; + LAPS_Y = (BASEVIDHEIGHT/2)-13 + cv_laps_yoffset.value; - POSI_X = 24; - POSI_Y = (BASEVIDHEIGHT/2)- 16; + POSI_X = 24 + cv_posi_xoffset.value; + POSI_Y = (BASEVIDHEIGHT/2)- 16 + cv_posi_yoffset.value; // 2P (top right) - ITEM2_X = BASEVIDWIDTH-39; - ITEM2_Y = -8; + ITEM2_X = BASEVIDWIDTH-39 + cv_item_xoffset.value; + ITEM2_Y = -8 + cv_item_yoffset.value; - LAPS2_X = BASEVIDWIDTH-40; - LAPS2_Y = (BASEVIDHEIGHT/2)-13; + LAPS2_X = BASEVIDWIDTH-40 + cv_laps_xoffset.value; + LAPS2_Y = (BASEVIDHEIGHT/2)-13 + cv_laps_yoffset.value; - POSI2_X = BASEVIDWIDTH -4; - POSI2_Y = (BASEVIDHEIGHT/2)- 16; + POSI2_X = BASEVIDWIDTH -4 + cv_posi_xoffset.value; + POSI2_Y = (BASEVIDHEIGHT/2)- 16 + cv_posi_yoffset.value; // Reminder that 3P and 4P are just 1P and 2P splitscreen'd to the bottom. - STCD_X = BASEVIDWIDTH/4; + STCD_X = BASEVIDWIDTH/4 + cv_stcd_xoffset.value; - MINI_X = (3*BASEVIDWIDTH/4); - MINI_Y = (3*BASEVIDHEIGHT/4); + MINI_X = (3*BASEVIDWIDTH/4) + cv_mini_xoffset.value; + MINI_Y = (3*BASEVIDHEIGHT/4) + cv_mini_yoffset.value; if (splitscreen > 2) // 4P-only { - MINI_X = (BASEVIDWIDTH/2); - MINI_Y = (BASEVIDHEIGHT/2); + MINI_X = (BASEVIDWIDTH/2) + cv_mini_xoffset.value; + MINI_Y = (BASEVIDHEIGHT/2) + cv_mini_yoffset.value; } } } @@ -8180,7 +8210,7 @@ static void K_drawKartSpeedometer(void) // so code breaks if someone attempts to join from spectator since it sets // their mo to NULL // so can we just check if their mo is NULL???? - if (stplyr->mo) + if (stplyr->mo) { convSpeed = (FixedDiv(stplyr->speed, FixedMul(K_GetKartSpeed(stplyr, false), ORIG_FRICTION))*100)>>FRACBITS; V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%4d P", convSpeed)); diff --git a/src/m_menu.c b/src/m_menu.c index 6cda6876a..282d203a4 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -325,6 +325,7 @@ menu_t OP_ProtocolDef; menu_t OP_DiscordOptionsDef; #endif menu_t OP_HUDOptionsDef, OP_ChatOptionsDef; +menu_t OP_HudOffsetDef; menu_t OP_GameOptionsDef, OP_ServerOptionsDef; #ifndef NONET menu_t OP_AdvServerOptionsDef; @@ -1376,6 +1377,24 @@ enum stretchyplayer, }; +static menuitem_t OP_HudOffsetMenu[] = +{ + {IT_HEADER, NULL, "Kart Hud Offsets", NULL, 0}, + + {IT_STRING | IT_CVAR, NULL, "Itembox Horizontal Offset", &cv_item_xoffset, 10}, + {IT_STRING | IT_CVAR, NULL, "Itembox Vertical Offset", &cv_item_yoffset, 20}, + {IT_STRING | IT_CVAR, NULL, "Timer Horizontal Offset", &cv_time_xoffset, 35}, + {IT_STRING | IT_CVAR, NULL, "Timer Vertical Offset", &cv_time_yoffset, 45}, + {IT_STRING | IT_CVAR, NULL, "Lapcount Horizontal Offset", &cv_laps_xoffset, 60}, + {IT_STRING | IT_CVAR, NULL, "Lapcount Vertical Offset", &cv_laps_yoffset, 70}, + {IT_STRING | IT_CVAR, NULL, "Speedometer Horizontal Offset", &cv_spdm_xoffset, 85}, + {IT_STRING | IT_CVAR, NULL, "Speedometer Vertical Offset", &cv_spdm_yoffset, 95}, + {IT_STRING | IT_CVAR, NULL, "Miniranking Horizontal Offset", &cv_face_xoffset, 110}, + {IT_STRING | IT_CVAR, NULL, "Miniranking Vertical Offset", &cv_face_yoffset, 120}, + {IT_STRING | IT_CVAR, NULL, "Minimap Horizontal Offset", &cv_mini_xoffset, 135}, + {IT_STRING | IT_CVAR, NULL, "Minimap Vertical Offset", &cv_mini_yoffset, 145}, +}; + static menuitem_t OP_SoundOptionsMenu[] = { {IT_STRING|IT_CVAR, NULL, "SFX", &cv_gamesounds, 10}, @@ -1508,25 +1527,27 @@ static menuitem_t OP_HUDOptionsMenu[] = { {IT_STRING | IT_CVAR, NULL, "Show HUD (F3)", &cv_showhud, 10}, {IT_STRING | IT_CVAR | IT_CV_SLIDER, - NULL, "HUD Visibility", &cv_translucenthud, 20}, + NULL, "HUD Visibility", &cv_translucenthud, 20}, + {IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 30}, - {IT_STRING | IT_SUBMENU, NULL, "Online HUD options...",&OP_ChatOptionsDef, 35}, - {IT_STRING | IT_CVAR, NULL, "Background Glass", &cons_backcolor, 45}, + {IT_STRING | IT_SUBMENU, NULL, "Online HUD options...",&OP_ChatOptionsDef, 45}, + {IT_STRING | IT_CVAR, NULL, "Background Glass", &cons_backcolor, 55}, {IT_STRING | IT_CVAR | IT_CV_SLIDER, - NULL, "Minimap Visibility", &cv_kartminimap, 60}, - {IT_STRING | IT_CVAR, NULL, "Speedometer Display", &cv_kartspeedometer, 70}, - {IT_STRING | IT_CVAR, NULL, "Show \"CHECK\"", &cv_kartcheck, 80}, + NULL, "Minimap Visibility", &cv_kartminimap, 65}, + {IT_STRING | IT_CVAR, NULL, "Speedometer Display", &cv_kartspeedometer, 75}, + {IT_STRING | IT_CVAR, NULL, "Show \"CHECK\"", &cv_kartcheck, 85}, - {IT_STRING | IT_CVAR, NULL, "Menu Highlights", &cons_menuhighlight, 95}, + {IT_STRING | IT_CVAR, NULL, "Menu Highlights", &cons_menuhighlight, 100}, // highlight info - (GOOD HIGHLIGHT, WARNING HIGHLIGHT) - 105 (see M_DrawHUDOptions) - {IT_STRING | IT_CVAR, NULL, "Console Text Size", &cv_constextsize, 120}, + {IT_STRING | IT_CVAR, NULL, "Console Text Size", &cv_constextsize, 125}, - {IT_STRING | IT_CVAR, NULL, "Show Track Addon Name", &cv_showtrackaddon, 135}, - {IT_STRING | IT_CVAR, NULL, "Show \"FOCUS LOST\"", &cv_showfocuslost, 145}, + {IT_STRING | IT_CVAR, NULL, "Show Track Addon Name", &cv_showtrackaddon, 140}, + {IT_STRING | IT_CVAR, NULL, "Show \"FOCUS LOST\"", &cv_showfocuslost, 150}, - {IT_STRING | IT_CVAR, NULL, "2D character select", &cv_skinselectmenu, 155}, + {IT_STRING | IT_CVAR, NULL, "2D character select", &cv_skinselectmenu, 160}, + }; // Ok it's still called chatoptions but we'll put ping display in here to be clean @@ -2193,7 +2214,7 @@ menu_t OP_HUDOptionsDef = &OP_MainDef, OP_HUDOptionsMenu, M_DrawHUDOptions, - 30, 30, + 30, 20, 0, NULL }; @@ -2246,6 +2267,8 @@ 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_HudOffsetDef = DEFAULTMENUSTYLE(NULL, OP_HudOffsetMenu, &OP_HUDOptionsDef, 30, 30); + menu_t OP_BirdDef = DEFAULTMENUSTYLE(NULL, OP_BirdMenu, &OP_MainDef, 30, 30); menu_t OP_TiltDef = DEFAULTMENUSTYLE(NULL, OP_TiltMenu, &OP_BirdDef, 30, 60); menu_t OP_AdvancedBirdDef = DEFAULTMENUSTYLE(NULL, OP_AdvancedBirdMenu, &OP_BirdDef, 30, 60); @@ -11779,7 +11802,7 @@ static void M_DrawHUDOptions(void) const char *str1 = " Warning highlight"; const char *str2 = ","; const char *str3 = "Good highlight"; - INT32 x = BASEVIDWIDTH - currentMenu->x + 2, y = currentMenu->y + 105; + INT32 x = BASEVIDWIDTH - currentMenu->x + 2, y = currentMenu->y + 110; INT32 w0 = V_StringWidth(str0, 0), w1 = V_StringWidth(str1, 0), w2 = V_StringWidth(str2, 0), w3 = V_StringWidth(str3, 0); M_DrawGenericMenu();