From 97cae4de591e14ef3bbb8a54e15410ab0819aed0 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 8 Dec 2024 21:18:39 +0100 Subject: [PATCH 1/2] smol things --- src/k_kart.c | 2 ++ src/p_tick.c | 4 ++-- src/s_sound.c | 5 +---- src/sdl/mixer_sound.c | 1 + 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 066c8a4e3..a86d93ff1 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6039,10 +6039,12 @@ void K_MoveKartPlayer(player_t *player, boolean onground) P_SetScale(overlay, player->mo->scale); } player->kartstuff[k_invincibilitytimer] = itemtime+(2*TICRATE); // 10 seconds + if (P_IsLocalPlayer(player) && cv_supermusic.value == 1 && cv_birdmusic.value) S_ChangeMusicSpecial("kinvnc"); else S_StartSound(player->mo, (cv_kartinvinsfx.value ? sfx_alarmi : sfx_kinvnc)); + P_RestoreMusic(player); K_PlayPowerGloatSound(player->mo); player->kartstuff[k_itemamount]--; diff --git a/src/p_tick.c b/src/p_tick.c index 266defd74..3b0cadde8 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -720,12 +720,12 @@ void P_Ticker(boolean run) continue; const boolean skybox = (skyboxmo[0] && cv_skybox.value); - boolean isSkyVisibleForPlayer = skyVisiblePerPlayer[i]; - if (isSkyVisibleForPlayer && skybox) + if (skyVisiblePerPlayer[i] && skybox) { R_SkyboxFrame(i); } + R_SetupFrame(i, skybox); } } diff --git a/src/s_sound.c b/src/s_sound.c index 122b07525..119b0cbb9 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1854,10 +1854,7 @@ void S_StopMusic(void) || demo.title) // SRB2Kart: Demos don't interrupt title screen music return; - if (cv_birdmusic.value && (strcasecmp(music_name, mapmusname) == 0)) - mapmusresume = I_GetSongPosition(); - else - mapmusresume = 0; + mapmusresume = (cv_birdmusic.value && (strcasecmp(music_name, mapmusname) == 0)) ? I_GetSongPosition() : 0; if (I_SongPaused()) I_ResumeSong(); diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 20cd3107c..ced911eba 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -615,6 +615,7 @@ Countstutter (int len) } else bytes = ( music_bytes - music_stutter_bytes ); + I_SetSongPosition((int)( bytes/4/44100.0*1000 )); } } From 4da9c5ac07074264b5062ac6be9a6aa2144d7598 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 9 Dec 2024 10:48:50 +0100 Subject: [PATCH 2/2] "P_CheckSightFast" for lua should be faster than normal P_CheckSight only to be used for things like nametags etc so nothing gameplaywise as it will desynch --- src/lua_baselib.c | 13 +++++++++++++ src/p_sight.c | 6 +++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 13e578d5c..b1d77d737 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -1102,6 +1102,18 @@ static int lib_pCheckSight(lua_State *L) return 1; } +// DONT USE THIS FOR ANYTHING GAMEPLAY, THIS WILL DESYNCH! +static int lib_pCheckSightFast(lua_State *L) +{ + mobj_t *t1 = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); + mobj_t *t2 = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); + //HUDSAFE? + if (!t1 || !t2) + return LUA_ErrInvalid(L, "mobj_t"); + lua_pushboolean(L, P_CheckSightFast(t1, t2)); + return 1; +} + static int lib_pCheckHoopPosition(lua_State *L) { mobj_t *hoopthing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); @@ -3154,6 +3166,7 @@ static luaL_Reg lib[] = { {"P_SlideMove",lib_pSlideMove}, {"P_BounceMove",lib_pBounceMove}, {"P_CheckSight", lib_pCheckSight}, + {"P_CheckSightFast", lib_pCheckSightFast}, {"P_CheckHoopPosition",lib_pCheckHoopPosition}, {"P_RadiusAttack",lib_pRadiusAttack}, {"P_FloorzAtPos",lib_pFloorzAtPos}, diff --git a/src/p_sight.c b/src/p_sight.c index bf98fe470..1d71e5553 100644 --- a/src/p_sight.c +++ b/src/p_sight.c @@ -305,8 +305,8 @@ static boolean P_CrossBSPNode(INT32 bspnum, register los_t *los, boolean fast) { register node_t *bsp = nodes + bspnum; - INT32 side = fast ? R_PointOnSideFast(los->strace.x, los->strace.y, bsp) : (P_DivlineSide(los->strace.x,los->strace.y,(divline_t *)bsp) & 1); - INT32 side2 = fast ? R_PointOnSideFast(los->t2x, los->t2y, bsp) : P_DivlineSide(los->t2x, los->t2y, (divline_t *) bsp); + INT32 side = (fast ? R_PointOnSideFast(los->strace.x, los->strace.y, bsp) : (P_DivlineSide(los->strace.x,los->strace.y, (divline_t *)bsp) & 1)); + INT32 side2 = (fast ? R_PointOnSideFast(los->t2x, los->t2y, bsp) : P_DivlineSide(los->t2x, los->t2y, (divline_t *) bsp)); if (side == side2) { @@ -321,7 +321,7 @@ static boolean P_CrossBSPNode(INT32 bspnum, register los_t *los, boolean fast) } else { - bspnum = bsp->children[side ^ 1]; // cross the ending side + bspnum = bsp->children[side^1]; // cross the ending side } } }