From a0bb448801280f97b79a7c03984a87a1dc8ca1e9 Mon Sep 17 00:00:00 2001 From: Indev Date: Tue, 18 Jul 2023 19:48:50 +0300 Subject: [PATCH 01/12] Add cvars for tweaking positions of kart hud items --- src/d_netcmd.c | 21 ++++++++ src/g_game.h | 21 ++++++++ src/k_kart.c | 142 ++++++++++++++++++++++++++++++------------------- 3 files changed, 128 insertions(+), 56 deletions(-) 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)); -- 2.54.0 From f652582891eb65bd0c47fc7c4a32dd3317b78403 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Wed, 19 Jul 2023 01:27:22 +0200 Subject: [PATCH 02/12] Adding "Hud Offset" Submenu in the Hud Menu so you dont have to do all that via console uwu --- src/m_menu.c | 49 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 13 deletions(-) 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(); -- 2.54.0 From 9009b689065d0cd7f95452380acff904f2489551 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Wed, 19 Jul 2023 04:01:46 +0200 Subject: [PATCH 03/12] eee smth smth revert a software mode sprite sorting thing didnt see it could potentioally break stuff e see :https://git.do.srb2.org/STJr/SRB2/-/merge_requests/1353?commit_id=4d6b677765d48b84addbf107caa7bb5e19f4715f --- src/r_things.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index 11779ded4..a33f908dc 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2233,19 +2233,22 @@ static void R_CreateDrawNodes(void) } else planeobjectz = planecameraz = r2->plane->height; - // bird: if any part of the sprite peeks in front the plane - if (planecameraz < viewz) + if (rover->mobjflags & MF_NOCLIPHEIGHT) { - if (rover->gzt >= planeobjectz) + //Objects with NOCLIPHEIGHT can appear halfway in. + if (planecameraz < viewz && rover->pz+(rover->thingheight/2) >= planeobjectz) + continue; + if (planecameraz > viewz && rover->pzt-(rover->thingheight/2) <= planeobjectz) continue; } - else if (planecameraz > viewz) + else { - if (rover->gz <= planeobjectz) + if (planecameraz < viewz && rover->pz >= planeobjectz) + continue; + if (planecameraz > viewz && rover->pzt <= planeobjectz) continue; } - // SoM: NOTE: Because a visplane's shape and scale is not directly // bound to any single linedef, a simple poll of it's frontscale is // not adequate. We must check the entire frontscale array for any -- 2.54.0 From 82a0decf06fe80df3a6f23fda2ad516c459b631f Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Wed, 19 Jul 2023 05:05:05 +0200 Subject: [PATCH 04/12] Clamp light level for shaders See https://git.do.srb2.org/STJr/SRB2/-/merge_requests/1085 cause why not --- src/hardware/hw_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index c765150fc..bdb6ebcb2 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -436,6 +436,9 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col poly_color.s.green = (UINT8)green; poly_color.s.blue = (UINT8)blue; } + + // Clamp the light level, since it can sometimes go out of the 0-255 range from animations + light_level = min(max(light_level, 0), 255); Surface->PolyColor.rgba = poly_color.rgba; Surface->TintColor.rgba = tint_color.rgba; -- 2.54.0 From 2b21b48005c2ca3e951941485121d1a6957d29a2 Mon Sep 17 00:00:00 2001 From: /in/dev/ Date: Wed, 19 Jul 2023 06:03:22 +0000 Subject: [PATCH 05/12] Update README.md --- README.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index db28bb84f..b5f70f9e3 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,29 @@ [SRB2Kart](https://srb2.org/mods/) is a kart racing mod based on the 3D Sonic the Hedgehog fangame [Sonic Robo Blast 2](https://srb2.org/), based on a modified version of [Doom Legacy](http://doomlegacy.sourceforge.net/). ## Saturn Features -- TODO +- Player rotation on Slopes, funny squish when landing, Sprite scaling and all that +- Kart Hud offsets are user changable +- Access for `mobj_t` and `player_t` fields from Lua has been completely rewritten, much better performance +- Lua shows tracebacks whenever an error occurs +- The Lua perfstat page now has multiple pages and is more organized (ps_thinkframe_page X) +- "addfilelocal" Command, for those who want to use their custom hud in netgames (Same as addfile but completely client sided) +- Visual Portals from haya´s HEP Client + +Techical Stuff: + +- ZFigthing Textures in Opengl mode have been fixed in engine (well almost all of it) +- Fof´s intersecting with slopes have less issues and now render correctly in Opengl +- Midtextures on slopes in Opengl arent broken anymore, all those weird guardrails and fences, aswell as some of those sticking out textures from the ground on some maps should be gone. +- A longstanding crash with "fading music changes" has been fixed +- A crash after long play sessions or when hosting a listen server regarding "FreeColormipmaps" has been fixed +- Multiple other fixes/optimizations like 3D floor clipping in software mode + +## Bugs + +- Joining a netgame midrace makes all sprites invisible until the next mapchange. +(Sadly unfixable without breaking netgame compability) + +- For the reason mentioned above, sometimes when rewinding a recorded replay from a netgame, playersprites may disappear, however normal playback is fine. ## Dependencies - NASM (x86 builds only) -- 2.54.0 From 933532ab9c54e05bde90b672bf24a303f91a4af8 Mon Sep 17 00:00:00 2001 From: /in/dev/ Date: Wed, 19 Jul 2023 06:33:28 +0000 Subject: [PATCH 06/12] Update version string --- src/doomdef.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index 31412b105..43048ae00 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -149,8 +149,8 @@ extern char logfilename[1024]; #else #define VERSION 1 // Game version #define SUBVERSION 6 // more precise version number -#define VERSIONSTRING "Saturn v5.4 " -#define VERSIONSTRINGW L"Saturn v5.4" +#define VERSIONSTRING "Saturn v6.0 " +#define VERSIONSTRINGW L"Saturn v6.0" // Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates! // And change CMakeLists.txt (not src/, but in root), for CMake users! // AND appveyor.yml, for the build bots! -- 2.54.0 From 7ed189dd93d28863d7f749846cfd149f8c56f816 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Wed, 19 Jul 2023 12:32:37 +0200 Subject: [PATCH 07/12] FPS counter stuff, again removed transparency for it and the ping display again, cause otherwise the game just does dumb things as always also added: https://git.do.srb2.org/STJr/SRB2/-/commit/e3824b9f1b759c319df85d7c710bf76a70573c38?merge_request_iid=2047 --- src/screen.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/screen.c b/src/screen.c index 1186e2d00..a9dc65169 100644 --- a/src/screen.c +++ b/src/screen.c @@ -405,10 +405,11 @@ double averageFPS = 0.0f; #define USE_FPS_SAMPLES #ifdef USE_FPS_SAMPLES -#define NUM_FPS_SAMPLES (32) // Number of samples to store +#define MAX_FRAME_TIME 0.05 +#define NUM_FPS_SAMPLES (16) // Number of samples to store -static double fps_samples[NUM_FPS_SAMPLES]; -static int fps_index; +static double total_frame_time = 0.0; +static int frame_index; #endif static boolean fps_init = false; @@ -417,7 +418,6 @@ static precise_t fps_enter = 0; void SCR_CalculateFPS(void) { precise_t fps_finish = 0; - int i; double frameElapsed = 0.0; @@ -432,13 +432,13 @@ void SCR_CalculateFPS(void) fps_enter = fps_finish; #ifdef USE_FPS_SAMPLES - fps_samples[fps_index] = frameElapsed / NUM_FPS_SAMPLES; - fps_index = (fps_index + 1) % NUM_FPS_SAMPLES; - - averageFPS = 0.0; - for (i = 0; i < NUM_FPS_SAMPLES; i++) - averageFPS += fps_samples[i]; - averageFPS = 1.0 / averageFPS; + total_frame_time += frameElapsed; + if (frame_index++ >= NUM_FPS_SAMPLES || total_frame_time >= MAX_FRAME_TIME) + { + averageFPS = 1.0 / (total_frame_time / frame_index); + total_frame_time = 0.0; + frame_index = 0; + } #else // Direct, unsampled counter. averageFPS = 1.0 / frameElapsed; @@ -454,7 +454,7 @@ void SCR_DisplayTicRate(void) double fps = round(averageFPS); // draw "FPS" - V_DrawFixedPatch(306< (benchmark - 5)) ticcntcolor = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_MINT, GTC_CACHE); @@ -473,15 +473,15 @@ void SCR_DisplayTicRate(void) } // draw total frame: - V_DrawPingNum(x, 190, V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_HUDTRANS, cap, ticcntcolor); + V_DrawPingNum(x, 190, V_SNAPTOBOTTOM|V_SNAPTORIGHT, cap, ticcntcolor); x -= digits * 4; // draw "/" - V_DrawFixedPatch(x< servermaxping)) // only show 2 (warning) if our ping is at a bad level { INT32 dispy = cv_ticrate.value ? 160 : 181; - HU_drawPing(307, dispy, ping, V_SNAPTORIGHT | V_SNAPTOBOTTOM|V_HUDTRANS); + HU_drawPing(307, dispy, ping, V_SNAPTORIGHT | V_SNAPTOBOTTOM); } } -- 2.54.0 From e5656720c7c91f75bce9bcd3e81ef8a29dccf1ff Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Wed, 19 Jul 2023 13:41:58 +0200 Subject: [PATCH 08/12] Attempt at adding more stacktraces to lua shit broke idk https://git.do.srb2.org/STJr/SRB2/-/merge_requests/1248/commits --- src/lua_consolelib.c | 17 ++++++++++++++--- src/lua_hudlib.c | 16 ++++++++++------ src/lua_infolib.c | 13 ++++++++++--- src/lua_script.c | 17 +++++++++++++++-- src/lua_script.h | 9 +-------- 5 files changed, 50 insertions(+), 22 deletions(-) diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index 3869fdc72..9ed156163 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -36,6 +36,10 @@ void Got_Luacmd(UINT8 **cp, INT32 playernum) // like sending random junk lua commands to crash the server if (!gL) goto deny; + + lua_settop(gL, 0); // Just in case... + lua_pushcfunction(gL, LUA_GetErrorMessage); + lua_getfield(gL, LUA_REGISTRYINDEX, "COM_Command"); // push COM_Command if (!lua_istable(gL, -1)) goto deny; @@ -72,7 +76,7 @@ void Got_Luacmd(UINT8 **cp, INT32 playernum) READSTRINGN(*cp, buf, 255); lua_pushstring(gL, buf); } - LUA_Call(gL, (int)argc); // argc is 1-based, so this will cover the player we passed too. + LUA_Call(gL, (int)argc, 0, 1); // argc is 1-based, so this will cover the player we passed too. return; deny: @@ -100,6 +104,10 @@ void COM_Lua_f(void) INT32 playernum = consoleplayer; I_Assert(gL != NULL); + + lua_settop(gL, 0); // Just in case... + lua_pushcfunction(gL, LUA_GetErrorMessage); + lua_getfield(gL, LUA_REGISTRYINDEX, "COM_Command"); // push COM_Command I_Assert(lua_istable(gL, -1)); @@ -169,7 +177,7 @@ void COM_Lua_f(void) LUA_PushUserdata(gL, &players[playernum], META_PLAYER); for (i = 1; i < COM_Argc(); i++) lua_pushstring(gL, COM_Argv(i)); - LUA_Call(gL, (int)COM_Argc()); // COM_Argc is 1-based, so this will cover the player we passed too. + LUA_Call(gL, (int)COM_Argc(), 0, 1); // COM_Argc is 1-based, so this will cover the player we passed too. } // Wrapper for COM_AddCommand @@ -280,6 +288,9 @@ static void Lua_OnChange(void) I_Assert(cvname != NULL); /// \todo Network this! XD_LUAVAR + + lua_settop(gL, 0); // Just in case... + lua_pushcfunction(gL, LUA_GetErrorMessage); // From CV_OnChange registry field, get the function for this cvar by name. lua_getfield(gL, LUA_REGISTRYINDEX, "CV_OnChange"); @@ -292,7 +303,7 @@ static void Lua_OnChange(void) lua_getfield(gL, -1, cvname); // get consvar_t* userdata. lua_remove(gL, -2); // pop the CV_Vars table. - LUA_Call(gL, 1); // call function(cvar) + LUA_Call(gL, 1, 0, 1); // call function(cvar) lua_pop(gL, 1); // pop CV_OnChange table } diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 9aab4920d..854721b2a 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -1050,7 +1050,9 @@ void LUAh_GameHUD(player_t *stplayr, huddrawlist_h list) lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST"); hud_running = true; - lua_pop(gL, -1); + lua_settop(gL, 0); + + lua_pushcfunction(gL, LUA_GetErrorMessage); lua_getfield(gL, LUA_REGISTRYINDEX, "HUD"); I_Assert(lua_istable(gL, -1)); @@ -1088,9 +1090,9 @@ void LUAh_GameHUD(player_t *stplayr, huddrawlist_h list) lua_pushvalue(gL, -5); // graphics library (HUD[1]) lua_pushvalue(gL, -5); // stplayr lua_pushvalue(gL, -5); // camera - LUA_Call(gL, 3); + LUA_Call(gL, 3, 0, 1); } - lua_pop(gL, -1); + lua_settop(gL, 0); hud_running = false; lua_pushlightuserdata(gL, NULL); @@ -1106,7 +1108,9 @@ void LUAh_ScoresHUD(huddrawlist_h list) lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST"); hud_running = true; - lua_pop(gL, -1); + lua_settop(gL, 0); + + lua_pushcfunction(gL, LUA_GetErrorMessage); lua_getfield(gL, LUA_REGISTRYINDEX, "HUD"); I_Assert(lua_istable(gL, -1)); @@ -1119,9 +1123,9 @@ void LUAh_ScoresHUD(huddrawlist_h list) lua_pushnil(gL); while (lua_next(gL, -3) != 0) { lua_pushvalue(gL, -3); // graphics library (HUD[1]) - LUA_Call(gL, 1); + LUA_Call(gL, 1, 0, 1); } - lua_pop(gL, -1); + lua_settop(gL, 0); hud_running = false; lua_pushlightuserdata(gL, NULL); diff --git a/src/lua_infolib.c b/src/lua_infolib.c index d8659a7e0..64a8b63d7 100644 --- a/src/lua_infolib.c +++ b/src/lua_infolib.c @@ -102,6 +102,9 @@ static void A_Lua(mobj_t *actor) { boolean found = false; I_Assert(actor != NULL); + + lua_settop(gL, 0); // Just in case... + lua_pushcfunction(gL, LUA_GetErrorMessage); // get the action for this state lua_getfield(gL, LUA_REGISTRYINDEX, LREG_STATEACTION); @@ -131,7 +134,7 @@ static void A_Lua(mobj_t *actor) LUA_PushUserdata(gL, actor, META_MOBJ); lua_pushinteger(gL, var1); lua_pushinteger(gL, var2); - LUA_Call(gL, 3); + LUA_Call(gL, 3, 0, 1); if (found) { @@ -284,6 +287,8 @@ boolean LUA_CallAction(const char *csaction, mobj_t *actor) if (superstack && fasticmp(csaction, superactions[superstack-1])) // the action is calling itself, return false; // let it call the hardcoded function instead. + + lua_pushcfunction(gL, LUA_GetErrorMessage); // grab function by uppercase name. lua_getfield(gL, LUA_REGISTRYINDEX, LREG_ACTIONS); @@ -297,13 +302,14 @@ boolean LUA_CallAction(const char *csaction, mobj_t *actor) if (lua_isnil(gL, -1)) // no match { - lua_pop(gL, 1); // pop nil + lua_pop(gL, 2); // pop nil and error handler return false; // action not called. } if (superstack == MAXRECURSION) { CONS_Alert(CONS_WARNING, "Max Lua Action recursion reached! Cool it on the calling A_Action functions from inside A_Action functions!\n"); + lua_pop(gL, 2); // pop function and error handler return true; } @@ -317,7 +323,8 @@ boolean LUA_CallAction(const char *csaction, mobj_t *actor) superactions[superstack] = csaction; ++superstack; - LUA_Call(gL, 3); + LUA_Call(gL, 3, 0, -(2 + 3)); + lua_pop(gL, -1); // Error handler --superstack; superactions[superstack] = NULL; diff --git a/src/lua_script.c b/src/lua_script.c index d9359d3b2..8f4438732 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -131,6 +131,19 @@ int LUA_GetErrorMessage(lua_State *L) return 1; } +int LUA_Call(lua_State *L, int nargs, int nresults, int errorhandlerindex) +{ + int err = lua_pcall(L, nargs, nresults, errorhandlerindex); + + if (err) + { + CONS_Alert(CONS_WARNING, "%s\n", lua_tostring(L, -1)); + lua_pop(L, 1); + } + + return err; +} + // This function decides which global variables you are allowed to set. static int noglobals(lua_State *L) { @@ -182,7 +195,7 @@ void LUA_ClearState(void) // open base libraries luaL_openlibs(L); - lua_pop(L, -1); + lua_settop(L, 0); // make LREG_VALID table for all pushed userdata cache. lua_newtable(L); @@ -372,7 +385,7 @@ fixed_t LUA_EvalMath(const char *word) *b = '\0'; // eval string. - lua_pop(L, -1); + lua_settop(L, 0); if (luaL_dostring(L, buf)) { p = lua_tostring(L, -1); diff --git a/src/lua_script.h b/src/lua_script.h index a21ce64d5..dd21ae0d9 100644 --- a/src/lua_script.h +++ b/src/lua_script.h @@ -41,6 +41,7 @@ void LUA_ClearExtVars(void); void LUA_ClearState(void); int LUA_GetErrorMessage(lua_State *L); +int LUA_Call(lua_State *L, int nargs, int nresults, int errorhandlerindex); void LUA_LoadLump(UINT16 wad, UINT16 lump); #ifdef LUA_ALLOW_BYTECODE void LUA_DumpFile(const char *filename); @@ -67,14 +68,6 @@ void LUAh_NetArchiveHook(lua_CFunction archFunc); // Console wrapper void COM_Lua_f(void); -#define LUA_Call(L,a)\ -{\ - if (lua_pcall(L, a, 0, 0)) {\ - CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(L,-1));\ - lua_pop(L, 1);\ - }\ -} - #define LUA_ErrInvalid(L, type) luaL_error(L, "accessed " type " doesn't exist anymore, please check 'valid' before using " type "."); // Deprecation warnings -- 2.54.0 From 5b0cb0404615cffd0259cabd7ac4a574a7d00b71 Mon Sep 17 00:00:00 2001 From: Indev Date: Wed, 19 Jul 2023 15:50:13 +0300 Subject: [PATCH 09/12] Fix possible segfault caused by undefined key order when iterating through table (Sometimes key "flags" could go after key "func" which caused cvar to have CV_CALL flag but no func set) Also fix CV_RegisterVar returning error handler function instead of cvar userdata for cvars with CV_CALL and without CV_NOINIT --- src/lua_consolelib.c | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index 9ed156163..d5843ff37 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -36,7 +36,7 @@ void Got_Luacmd(UINT8 **cp, INT32 playernum) // like sending random junk lua commands to crash the server if (!gL) goto deny; - + lua_settop(gL, 0); // Just in case... lua_pushcfunction(gL, LUA_GetErrorMessage); @@ -104,7 +104,7 @@ void COM_Lua_f(void) INT32 playernum = consoleplayer; I_Assert(gL != NULL); - + lua_settop(gL, 0); // Just in case... lua_pushcfunction(gL, LUA_GetErrorMessage); @@ -288,8 +288,9 @@ static void Lua_OnChange(void) I_Assert(cvname != NULL); /// \todo Network this! XD_LUAVAR - - lua_settop(gL, 0); // Just in case... + + // Why?.. + //lua_settop(gL, 0); // Just in case... lua_pushcfunction(gL, LUA_GetErrorMessage); // From CV_OnChange registry field, get the function for this cvar by name. @@ -304,7 +305,7 @@ static void Lua_OnChange(void) lua_remove(gL, -2); // pop the CV_Vars table. LUA_Call(gL, 1, 0, 1); // call function(cvar) - lua_pop(gL, 1); // pop CV_OnChange table + lua_pop(gL, 2); // pop CV_OnChange table and error handler } static int lib_cvRegisterVar(lua_State *L) @@ -393,19 +394,29 @@ static int lib_cvRegisterVar(lua_State *L) cvar->PossibleValue = cvpv; } else FIELDERROR("PossibleValue", va("%s or CV_PossibleValue_t expected, got %s", lua_typename(L, LUA_TTABLE), luaL_typename(L, -1))) - } else if (cvar->flags & CV_CALL && (i == 5 || (k && fasticmp(k, "func")))) { - if (!lua_isfunction(L, 4)) - TYPEERROR("func", LUA_TFUNCTION) - lua_getfield(L, LUA_REGISTRYINDEX, "CV_OnChange"); - I_Assert(lua_istable(L, 5)); - lua_pushvalue(L, 4); - lua_setfield(L, 5, cvar->name); - lua_pop(L, 1); - cvar->func = Lua_OnChange; } lua_pop(L, 1); } + if (cvar->flags & CV_CALL) { + lua_rawgeti(L, 1, 5); // Push function, if it stored at field 5 + + if (lua_isnil(L, -1)) { // If it is nil, try to get at field "func" + lua_pop(L, 1); + lua_getfield(L, 1, "func"); + } + + if (!lua_isfunction(L, -1)) + TYPEERROR("func", LUA_TFUNCTION) + + lua_getfield(L, LUA_REGISTRYINDEX, "CV_OnChange"); // Push table + I_Assert(lua_istable(L, -1)); + lua_pushvalue(L, -2); // Push func + lua_setfield(L, -2, cvar->name); // Pop func, add it to table + lua_pop(L, 2); // Pop table and func + cvar->func = Lua_OnChange; + } + #undef FIELDERROR #undef TYPEERROR -- 2.54.0 From 146cb6b1c343a4e7a231b85528eb7db6e52cd233 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Thu, 20 Jul 2023 00:21:03 +0200 Subject: [PATCH 10/12] remove lua stuff from sprite rotation/scaling shit can desynch people who are on another client, when this client is used to host a server esp airbrakes cause it so ugh --- src/lua_mobjlib.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index d0afa89ff..d3b5745d9 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -36,8 +36,8 @@ int mobj_snext_noset(lua_State *L); int mobj_z_setter(lua_State *L); int mobj_sprev_unimplemented(lua_State *L); int mobj_angle_setter(lua_State *L); -int mobj_sloperoll_noset(lua_State *L); -int mobj_spritescale_setter(lua_State *L); +//int mobj_sloperoll_noset(lua_State *L); +//int mobj_spritescale_setter(lua_State *L); int mobj_touching_sectorlist_unimplemented(lua_State *L); int mobj_radius_setter(lua_State *L); int mobj_height_setter(lua_State *L); @@ -76,15 +76,15 @@ static const udata_field_t mobj_fields[] = { FIELD(mobj_t, snext, udatalib_getter_mobj, mobj_snext_noset), FIELD(mobj_t, sprev, mobj_sprev_unimplemented, mobj_sprev_unimplemented), FIELD(mobj_t, angle, udatalib_getter_angle, mobj_angle_setter), - FIELD(mobj_t, rollangle, udatalib_getter_angle, udatalib_setter_angle), - FIELD(mobj_t, sloperoll, udatalib_getter_angle, mobj_sloperoll_noset), + //FIELD(mobj_t, rollangle, udatalib_getter_angle, udatalib_setter_angle), + //FIELD(mobj_t, sloperoll, udatalib_getter_angle, mobj_sloperoll_noset), FIELD(mobj_t, sprite, udatalib_getter_spritenum, udatalib_setter_spritenum), FIELD(mobj_t, frame, udatalib_getter_uint32, udatalib_setter_uint32), FIELD(mobj_t, anim_duration, udatalib_getter_uint16, udatalib_setter_uint16), - FIELD(mobj_t, spritexscale, udatalib_getter_fixed, mobj_spritescale_setter), - FIELD(mobj_t, spriteyscale, udatalib_getter_fixed, mobj_spritescale_setter), - FIELD(mobj_t, spritexoffset, udatalib_getter_fixed, udatalib_setter_fixed), - FIELD(mobj_t, spriteyoffset, udatalib_getter_fixed, udatalib_setter_fixed), + //FIELD(mobj_t, spritexscale, udatalib_getter_fixed, mobj_spritescale_setter), + //FIELD(mobj_t, spriteyscale, udatalib_getter_fixed, mobj_spritescale_setter), + //FIELD(mobj_t, spritexoffset, udatalib_getter_fixed, udatalib_setter_fixed), + //FIELD(mobj_t, spriteyoffset, udatalib_getter_fixed, udatalib_setter_fixed), FIELD(mobj_t, touching_sectorlist, mobj_touching_sectorlist_unimplemented, mobj_touching_sectorlist_unimplemented), FIELD(mobj_t, subsector, udatalib_getter_subsector, mobj_nosetpos_subsector), FIELD(mobj_t, floorz, udatalib_getter_fixed, mobj_nosetpos_floorz), @@ -133,7 +133,7 @@ static const udata_field_t mobj_fields[] = { FIELD(mobj_t, cvmem, udatalib_getter_int32, udatalib_setter_int32), FIELD(mobj_t, standingslope, udatalib_getter_slope, mobj_standingslope_noset), FIELD(mobj_t, colorized, udatalib_getter_boolean, udatalib_setter_boolean), - FIELD(mobj_t, rollmodel, udatalib_getter_boolean, udatalib_setter_boolean), + //FIELD(mobj_t, rollmodel, udatalib_getter_boolean, udatalib_setter_boolean), { NULL }, }; #undef FIELD @@ -174,7 +174,7 @@ int mobj_ ## field ## _noset(lua_State *L) \ return luaL_error(L, LUA_QL("mobj_t") " field " LUA_QS " should not be set directly.", #field); \ } -NOSET(sloperoll) +//NOSET(sloperoll) NOSET(snext) NOSET(bnext) NOSET(info) @@ -242,14 +242,14 @@ int mobj_spritescale_setter(lua_State *L) if (!mo->player) *spritescale = luaL_checkfixed(L, 2); - else + /*else { // Mmm yea if (spritescale == &mo->spritexscale) mo->realxscale = luaL_checkfixed(L, 2); else mo->realyscale = luaL_checkfixed(L, 2); - } + }*/ return 0; } -- 2.54.0 From 3c648e683981c5fbffce1e111b2c95237c9a59e8 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Thu, 20 Jul 2023 00:26:11 +0200 Subject: [PATCH 11/12] forgor smh --- src/p_enemy.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index ef0255f3b..01b1e8f56 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -7444,10 +7444,10 @@ void A_RollAngle(mobj_t *actor) INT32 locvar2 = var2; const angle_t angle = FixedAngle(locvar1*FRACUNIT); -#ifdef HAVE_BLUA +/*#ifdef HAVE_BLUA if (LUA_CallAction("A_RollAngle", actor)) return; -#endif +#endif*/ // relative (default) if (!locvar2) @@ -7470,10 +7470,10 @@ void A_ChangeRollAngleRelative(mobj_t *actor) INT32 locvar2 = var2; const fixed_t amin = locvar1*FRACUNIT; const fixed_t amax = locvar2*FRACUNIT; -#ifdef HAVE_BLUA +/*#ifdef HAVE_BLUA if (LUA_CallAction("A_ChangeRollAngleRelative", actor)) return; -#endif +#endif*/ #ifdef PARANOIA if (amin > amax) @@ -7496,10 +7496,10 @@ void A_ChangeRollAngleAbsolute(mobj_t *actor) INT32 locvar2 = var2; const fixed_t amin = locvar1*FRACUNIT; const fixed_t amax = locvar2*FRACUNIT; -#ifdef HAVE_BLUA +/*#ifdef HAVE_BLUA if (LUA_CallAction("A_ChangeRollAngleAbsolute", actor)) return; -#endif +#endif*/ #ifdef PARANOIA if (amin > amax) -- 2.54.0 From bdeb3c1105dd48ee96f642651ff6e4782a3d4273 Mon Sep 17 00:00:00 2001 From: Indev Date: Thu, 20 Jul 2023 08:45:35 +0300 Subject: [PATCH 12/12] Comment out function mobj_spritescale_setter completely --- src/lua_mobjlib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index d3b5745d9..9788e9a83 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -233,7 +233,7 @@ int mobj_angle_setter(lua_State *L) return 0; } -int mobj_spritescale_setter(lua_State *L) +/*int mobj_spritescale_setter(lua_State *L) { mobj_t *mo = GETMO(); @@ -242,16 +242,16 @@ int mobj_spritescale_setter(lua_State *L) if (!mo->player) *spritescale = luaL_checkfixed(L, 2); - /*else + else { // Mmm yea if (spritescale == &mo->spritexscale) mo->realxscale = luaL_checkfixed(L, 2); else mo->realyscale = luaL_checkfixed(L, 2); - }*/ + } return 0; -} +}*/ int mobj_radius_setter(lua_State *L) { -- 2.54.0