From e5a9bfc968aa55783af348840047ec9cc2a337a5 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 25 Oct 2020 17:02:32 -0700 Subject: [PATCH 1/7] Fix conflicting step up/down code --- src/p_map.c | 79 ++++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 41 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index b5d4bb687..47faf63bf 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2525,60 +2525,57 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) floatok = true; - thingtop = thing->z + thing->height; - - // Step up - if (thing->z < tmfloorz) + if (maxstep > 0) { - if (tmfloorz - thing->z <= maxstep) - { - thing->z = thing->floorz = tmfloorz; - thing->floorrover = tmfloorrover; - thing->eflags |= MFE_JUSTSTEPPEDDOWN; - } - else - { - return false; // mobj must raise itself to fit - } - } - else if (tmceilingz < thingtop) - return false; // mobj must lower itself to fit + thingtop = thing->z + thing->height; - // Ramp test - if ((maxstep > 0) && !(P_MobjTouchingSectorSpecial(thing, 1, 14, false))) - { - // If the floor difference is MAXSTEPMOVE or less, and the sector isn't Section1:14, ALWAYS - // step down! Formerly required a Section1:13 sector for the full MAXSTEPMOVE, but no more. - - if (thingtop == thing->ceilingz && tmceilingz > thingtop && tmceilingz - thingtop <= maxstep) + // Step up + if (thing->z < tmfloorz) { + if (tmfloorstep <= maxstep) + { + thing->z = thing->floorz = tmfloorz; + thing->floorrover = tmfloorrover; + thing->eflags |= MFE_JUSTSTEPPEDDOWN; + } + else + { + return false; // mobj must raise itself to fit + } + } + else if (tmceilingz < thingtop) + { + if (tmceilingstep <= maxstep) + { + thing->z = ( thing->ceilingz = tmceilingz ) - thing->height; + thing->ceilingrover = tmceilingrover; + thing->eflags |= MFE_JUSTSTEPPEDDOWN; + } + else + { + return false; // mobj must lower itself to fit + } + } + else if (!(P_MobjTouchingSectorSpecial(thing, 1, 14, false))) // Step down + { + // If the floor difference is MAXSTEPMOVE or less, and the sector isn't Section1:14, ALWAYS + // step down! Formerly required a Section1:13 sector for the full MAXSTEPMOVE, but no more. + if (thingtop == thing->ceilingz && tmceilingz > thingtop && thing->ceilingdrop <= maxstep) { - thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height; + thing->z = (thing->ceilingz = tmceilingz) - thing->height; thing->ceilingrover = tmceilingrover; thing->eflags |= MFE_JUSTSTEPPEDDOWN; thing->ceilingdrop = 0; } - else if (tmceilingz < thingtop && tmceilingstep <= maxstep) + else if (thing->z == thing->floorz && tmfloorz < thing->z && thing->floordrop <= maxstep) { - thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height; - thing->ceilingrover = tmceilingrover; + thing->z = thing->floorz = tmfloorz; + thing->floorrover = tmfloorrover; thing->eflags |= MFE_JUSTSTEPPEDDOWN; + thing->floordrop = 0; } } - else if (thing->z == thing->floorz && tmfloorz < thing->z && thing->floordrop <= maxstep) - { - thing->z = thing->floorz = tmfloorz; - thing->floorrover = tmfloorrover; - thing->eflags |= MFE_JUSTSTEPPEDDOWN; - thing->floordrop = 0; - } - else if (tmfloorz > thing->z && tmfloorstep <= maxstep) - { - thing->z = thing->floorz = tmfloorz; - thing->floorrover = tmfloorrover; - thing->eflags |= MFE_JUSTSTEPPEDDOWN; - } } if (!allowdropoff && !(thing->flags & MF_FLOAT) && thing->type != MT_SKIM && !tmfloorthing) From 88a8a09516a6b117b80b70bee785799302c97226 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 26 Oct 2020 01:54:15 -0700 Subject: [PATCH 2/7] Make sneaker panels push you in spinout AGAIN LOL The old condition for player movement was... 1. player hasn't finished 2. player not in pain, or player in pain but on the ground The else condition to this is therefore player has finished or player in pain and in the air. I believe K_MomentumToFacing (prior to bots) was only for letting the player turn around after crossing the finish line, to face the camera. (K_MomentumToFacing also does nothing in the air.) --- src/k_kart.c | 4 +--- src/k_kart.h | 2 +- src/p_user.c | 28 +++++++++++++--------------- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index a6beddbbe..8a3597f1f 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2309,7 +2309,7 @@ SINT8 K_GetForwardMove(player_t *player) return forwardmove; } -fixed_t K_3dKartMovement(player_t *player, boolean onground) +fixed_t K_3dKartMovement(player_t *player) { const fixed_t accelmax = 4000; const fixed_t p_speed = K_GetKartSpeed(player, true); @@ -2319,8 +2319,6 @@ fixed_t K_3dKartMovement(player_t *player, boolean onground) fixed_t orig = ORIG_FRICTION; SINT8 forwardmove = K_GetForwardMove(player); - if (!onground) return 0; // If the player isn't on the ground, there is no change in speed - if (K_PlayerUsesBotMovement(player)) { orig = K_BotFrictionRubberband(player, ORIG_FRICTION); diff --git a/src/k_kart.h b/src/k_kart.h index d45a69570..2c1236368 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -84,7 +84,7 @@ fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower); fixed_t K_GetKartAccel(player_t *player); UINT16 K_GetKartFlashing(player_t *player); SINT8 K_GetForwardMove(player_t *player); -fixed_t K_3dKartMovement(player_t *player, boolean onground); +fixed_t K_3dKartMovement(player_t *player); boolean K_PlayerEBrake(player_t *player); void K_AdjustPlayerFriction(player_t *player); void K_MoveKartPlayer(player_t *player, boolean onground); diff --git a/src/p_user.c b/src/p_user.c index 060709ac7..a6717d212 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1930,26 +1930,24 @@ static void P_3dMovement(player_t *player) K_AdjustPlayerFriction(player); // Forward movement - if (!P_PlayerInPain(player)) + // If the player isn't on the ground, there is no change in speed + // Smiley Face + if (onground) { - if (onground) + movepushforward = K_3dKartMovement(player); + + if (player->mo->movefactor != FRACUNIT) // Friction-scaled acceleration... + movepushforward = FixedMul(movepushforward, player->mo->movefactor); + + totalthrust.x += P_ReturnThrustX(player->mo, movepushangle, movepushforward); + totalthrust.y += P_ReturnThrustY(player->mo, movepushangle, movepushforward); + + if (K_PlayerUsesBotMovement(player) == true) { - movepushforward = K_3dKartMovement(player, onground); - - if (player->mo->movefactor != FRACUNIT) // Friction-scaled acceleration... - movepushforward = FixedMul(movepushforward, player->mo->movefactor); - - totalthrust.x += P_ReturnThrustX(player->mo, movepushangle, movepushforward); - totalthrust.y += P_ReturnThrustY(player->mo, movepushangle, movepushforward); + K_MomentumToFacing(player); } } - if ((!P_PlayerInPain(player) && !onground) - || (K_PlayerUsesBotMovement(player) == true)) - { - K_MomentumToFacing(player); - } - if ((totalthrust.x || totalthrust.y) && player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && abs(player->mo->standingslope->zdelta) > FRACUNIT/2) { // Factor thrust to slope, but only for the part pushing up it! From 364b69c62188eae527d118e1b12ad60f8eb25d79 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 26 Oct 2020 03:46:49 -0700 Subject: [PATCH 3/7] Let turn while light snaking --- src/p_user.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/p_user.c b/src/p_user.c index a6717d212..6fb7ee4bc 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4415,6 +4415,11 @@ void P_PlayerThink(player_t *player) // Allows some turning P_MovePlayer(player); } + else if (player->respawn.state == RESPAWNST_MOVE) + { + angle_t angleChange = player->cmd.turning << TICCMD_REDUCE; + P_SetPlayerAngle(player, player->angleturn + angleChange); + } } else if (player->mo->reactiontime) { From b21a0a8cf2abeae6b813260629e501e2e8a34526 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 26 Oct 2020 04:19:41 -0700 Subject: [PATCH 4/7] Fix module and chip music being SRB2 LOUD --- src/sdl/mixer_sound.c | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 3d2b32737..6c669f415 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -570,17 +570,13 @@ void I_SetSfxVolume(int volume) /// Music Utilities /// ------------------------ -static UINT32 get_real_volume(int volume) +static int attenuate(int scale) { - { - // convert volume to mixer's 128 scale - // then apply internal_volume as a percentage - //return ((UINT32)volume*128/31) * (UINT32)internal_volume / 100; - return MIX_MAX_VOLUME - * musicdef_volume / 100 - * internal_volume / 100 - * volume / 100; - } + // attenuate scale by all volumes as percentages + return scale + * musicdef_volume / 100 + * internal_volume / 100 + * music_volume / 100; } static UINT32 get_adjusted_position(UINT32 position) @@ -686,7 +682,7 @@ static UINT32 music_fade(UINT32 interval, void *param) else if ((fading_timer -= 10) <= 0) { internal_volume = fading_target; - Mix_VolumeMusic(get_real_volume(music_volume)); + Mix_VolumeMusic(attenuate(MIX_MAX_VOLUME)); I_StopFadingSong(); do_fading_callback(); return 0; @@ -699,7 +695,7 @@ static UINT32 music_fade(UINT32 interval, void *param) internal_volume = max(min(internal_volume, fading_source - FixedMul(delta, factor)), fading_target); else if (fading_target > fading_source) internal_volume = min(max(internal_volume, fading_source + FixedMul(delta, factor)), fading_target); - Mix_VolumeMusic(get_real_volume(music_volume)); + Mix_VolumeMusic(attenuate(MIX_MAX_VOLUME)); return interval; } } @@ -719,13 +715,9 @@ static void mix_gme(void *udata, Uint8 *stream, int len) // play gme into stream gme_play(gme, len/2, (short *)stream); - // Limiter to prevent music from being disorted with some formats - if (music_volume >= 18) - music_volume = 18; - // apply volume to stream for (i = 0, p = (short *)stream; i < len/2; i++, p++) - *p = ((INT32)*p) * (music_volume*internal_volume/100)*2 / 40; + *p = attenuate(*p); } #endif @@ -743,13 +735,9 @@ static void mix_openmpt(void *udata, Uint8 *stream, int len) // Play module into stream openmpt_module_read_interleaved_stereo(openmpt_mhandle, SAMPLERATE, BUFFERSIZE, (short *)stream); - // Limiter to prevent music from being disorted with some formats - if (music_volume >= 18) - music_volume = 18; - // apply volume to stream for (i = 0, p = (short *)stream; i < len/2; i++, p++) - *p = ((INT32)*p) * (music_volume*internal_volume/100)*2 / 40; + *p = attenuate(*p); } #endif @@ -1398,7 +1386,7 @@ void I_SetMusicVolume(int volume) music_volume = volume; - Mix_VolumeMusic(get_real_volume(music_volume)); + Mix_VolumeMusic(attenuate(MIX_MAX_VOLUME)); } boolean I_SetSongTrack(int track) @@ -1460,7 +1448,7 @@ void I_SetInternalMusicVolume(UINT8 volume) internal_volume = volume; if (!I_SongPlaying()) return; - Mix_VolumeMusic(get_real_volume(music_volume)); + Mix_VolumeMusic(attenuate(MIX_MAX_VOLUME)); } void I_StopFadingSong(void) From 65cc5f52f2d596293031ebcf250d68b89a27d490 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 26 Oct 2020 04:21:06 -0700 Subject: [PATCH 5/7] Fix doubling the volume --- src/s_sound.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/s_sound.c b/src/s_sound.c index 197e65e57..ce62cb3e2 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -939,9 +939,9 @@ void S_UpdateSounds(void) memset(&listener4, 0, sizeof(listener_t)); // Update sound/music volumes, if changed manually at console - if (actualsfxvolume != cv_soundvolume.value) + if (actualsfxvolume != cv_soundvolume.value * USER_VOLUME_SCALE) S_SetSfxVolume (cv_soundvolume.value); - if (actualdigmusicvolume != cv_digmusicvolume.value) + if (actualdigmusicvolume != cv_digmusicvolume.value * USER_VOLUME_SCALE) S_SetDigMusicVolume (cv_digmusicvolume.value); // We're done now, if we're not in a level. From eec54356c3b50b28ec89f0fa7015f6d6b3896904 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 26 Oct 2020 18:57:32 -0700 Subject: [PATCH 6/7] Fix splitscreen fov being fucked on first R_ExecuteSetViewSize --- src/r_main.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index c64907450..8e05b8d27 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -601,6 +601,12 @@ static inline void R_InitLightTables(void) //#define WOUGHMP_WOUGHMP // I got a fish-eye lens - I'll make a rap video with a couple of friends // it's kinda laggy sometimes +#ifdef WOUGHMP_WOUGHMP +#define AHHHH_IM_SO_MAAAAD { 0U, 0, FRACUNIT, NULL, 0, 0, {0}, {0}, false } +#else +#define AHHHH_IM_SO_MAAAAD { 0U, FRACUNIT, NULL, 0, 0, {0}, {0}, false } +#endif + static struct viewmorph { angle_t rollangle; // pre-shifted by fineshift #ifdef WOUGHMP_WOUGHMP @@ -615,7 +621,14 @@ static struct viewmorph { INT16 ceilingclip[MAXVIDWIDTH], floorclip[MAXVIDWIDTH]; boolean use; -} viewmorph[MAXSPLITSCREENPLAYERS] = {0}; +} viewmorph[MAXSPLITSCREENPLAYERS] = { + AHHHH_IM_SO_MAAAAD, + AHHHH_IM_SO_MAAAAD, + AHHHH_IM_SO_MAAAAD, + AHHHH_IM_SO_MAAAAD, +}; + +#undef AHHHH_IM_SO_MAAAAD void R_CheckViewMorph(int s) { @@ -643,11 +656,6 @@ void R_CheckViewMorph(int s) fixed_t fisheye = cv_cam2_turnmultiplier.value; // temporary test value #endif - if (v->zoomneeded == 0) - { - v->zoomneeded = FRACUNIT; - } - rollangle >>= ANGLETOFINESHIFT; rollangle = ((rollangle+2) & ~3) & FINEMASK; // Limit the distinct number of angles to reduce recalcs from angles changing a lot. From 9bff8c2ecb0a7a0f62b64de7c4cdf41e5db355fc Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 26 Oct 2020 19:03:24 -0700 Subject: [PATCH 7/7] Remove the other -splitscreen parameter --- src/d_main.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index d52ded552..bf15d5bd7 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1697,12 +1697,6 @@ void D_SRB2Main(void) ultimatemode = true; }*/ - if (M_CheckParm("-splitscreen")) - { - autostart = true; - splitscreen = true; - } - // rei/miru: bootmap (Idea: starts the game on a predefined map) if (bootmap && !(M_CheckParm("-warp") && M_IsNextParm())) {