From 701c1e26c481af0502f51e7285ef7302ccef74a6 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Sat, 18 Jun 2022 23:35:22 -0500 Subject: [PATCH 1/8] Implement epicenter and radius support for quakes. --- src/p_tick.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/p_tick.c b/src/p_tick.c index 28ace9288..c8c927ae1 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -23,6 +23,7 @@ #include "lua_hook.h" #include "m_perfstats.h" #include "i_system.h" // I_GetPreciseTime +#include "r_main.h" // Object place #include "m_cheat.h" @@ -740,7 +741,22 @@ void P_Ticker(boolean run) if (quake.time) { fixed_t ir = quake.intensity>>1; - /// \todo Calculate distance from epicenter if set and modulate the intensity accordingly based on radius. + + if (quake.epicenter) { + // Calculate 3D distance from epicenter, using camera. + // Uses only player 1 camera because only one quake variable exists. + fixed_t xydist = R_PointToDist2(camera.x, camera.y, quake.epicenter->x, quake.epicenter->y); + fixed_t dist = R_PointToDist2(0, camera.z, xydist, quake.epicenter->z); + + CONS_Printf("%d\n", dist / FRACUNIT); + + // More effect closer to epicenter, outside of radius = no effect + if (!quake.radius || dist > quake.radius) + ir = 0; + else + ir = FixedMul(ir, FRACUNIT - FixedDiv(dist, quake.radius)); + } + quake.x = M_RandomRange(-ir,ir); quake.y = M_RandomRange(-ir,ir); quake.z = M_RandomRange(-ir,ir); From a546b553c42f14e1f0128b1e63cc9718b9f4477e Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Sat, 18 Jun 2022 23:37:53 -0500 Subject: [PATCH 2/8] Oops, forgot to remove a debug print. --- src/p_tick.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/p_tick.c b/src/p_tick.c index c8c927ae1..4915c5df2 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -748,8 +748,6 @@ void P_Ticker(boolean run) fixed_t xydist = R_PointToDist2(camera.x, camera.y, quake.epicenter->x, quake.epicenter->y); fixed_t dist = R_PointToDist2(0, camera.z, xydist, quake.epicenter->z); - CONS_Printf("%d\n", dist / FRACUNIT); - // More effect closer to epicenter, outside of radius = no effect if (!quake.radius || dist > quake.radius) ir = 0; From 90a93a516e8fe5658dc960277fab74f6232ed6d3 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Tue, 6 Sep 2022 18:42:12 -0500 Subject: [PATCH 3/8] Move quake calculation code to r_main.c, keep timer in p_tick.c --- src/p_tick.c | 22 ---------------------- src/r_main.c | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/p_tick.c b/src/p_tick.c index 4915c5df2..5430e651c 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -739,29 +739,7 @@ void P_Ticker(boolean run) countdown2--; if (quake.time) - { - fixed_t ir = quake.intensity>>1; - - if (quake.epicenter) { - // Calculate 3D distance from epicenter, using camera. - // Uses only player 1 camera because only one quake variable exists. - fixed_t xydist = R_PointToDist2(camera.x, camera.y, quake.epicenter->x, quake.epicenter->y); - fixed_t dist = R_PointToDist2(0, camera.z, xydist, quake.epicenter->z); - - // More effect closer to epicenter, outside of radius = no effect - if (!quake.radius || dist > quake.radius) - ir = 0; - else - ir = FixedMul(ir, FRACUNIT - FixedDiv(dist, quake.radius)); - } - - quake.x = M_RandomRange(-ir,ir); - quake.y = M_RandomRange(-ir,ir); - quake.z = M_RandomRange(-ir,ir); --quake.time; - } - else - quake.x = quake.y = quake.z = 0; if (metalplayback) G_ReadMetalTic(metalplayback); diff --git a/src/r_main.c b/src/r_main.c index f19962d41..f5992f98b 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1123,6 +1123,7 @@ void R_SetupFrame(player_t *player) { camera_t *thiscam; boolean chasecam = false; + boolean ispaused = paused || P_AutoPause(); if (splitscreen && player == &players[secondarydisplayplayer] && player != &players[consoleplayer]) @@ -1191,6 +1192,30 @@ void R_SetupFrame(player_t *player) } } } + + if (quake.time && !ispaused) + { + fixed_t ir = quake.intensity>>1; + + if (quake.epicenter) { + // Calculate 3D distance from epicenter, using the camera. + fixed_t xydist = R_PointToDist2(thiscam->x, thiscam->y, quake.epicenter->x, quake.epicenter->y); + fixed_t dist = R_PointToDist2(0, thiscam->z, xydist, quake.epicenter->z); + + // More effect closer to epicenter, outside of radius = no effect + if (!quake.radius || dist > quake.radius) + ir = 0; + else + ir = FixedMul(ir, FRACUNIT - FixedDiv(dist, quake.radius)); + } + + quake.x = M_RandomRange(-ir,ir); + quake.y = M_RandomRange(-ir,ir); + quake.z = M_RandomRange(-ir,ir); + } + else if (!ispaused) + quake.x = quake.y = quake.z = 0; + viewz += quake.z; viewplayer = player; From c907c20480719e908e3aa3d3fff65fb9eb4e9f43 Mon Sep 17 00:00:00 2001 From: spherallic Date: Wed, 5 Apr 2023 23:59:37 +0200 Subject: [PATCH 4/8] Do not apply pmomz when jumping through a platform --- src/p_map.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index a7d1f4abd..33d599a6c 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -3065,11 +3065,14 @@ static boolean P_ThingHeightClip(mobj_t *thing) if (!rover || ((rover->fofflags & FOF_EXISTS) && (rover->fofflags & FOF_SOLID))) { hitfloor = bouncing; - if (thing->eflags & MFE_VERTICALFLIP) - thing->pmomz = thing->ceilingz - (thing->z + thing->height); - else - thing->pmomz = thing->floorz - thing->z; - thing->eflags |= MFE_APPLYPMOMZ; + if (!(thing->player) || !(thing->player->pflags & PF_JUMPED || bouncing)) + { + if (thing->eflags & MFE_VERTICALFLIP) + thing->pmomz = thing->ceilingz - (thing->z + thing->height); + else + thing->pmomz = thing->floorz - thing->z; + thing->eflags |= MFE_APPLYPMOMZ; + } if (thing->eflags & MFE_VERTICALFLIP) thing->z = thing->ceilingz - thing->height; From 36e20ac619a7da0d8b640d36b5ff46cabc825539 Mon Sep 17 00:00:00 2001 From: Zwip-Zwap Zapony Date: Thu, 2 Feb 2023 15:47:42 +0100 Subject: [PATCH 5/8] Tiny caption loop optimisation --- src/screen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/screen.c b/src/screen.c index 0719da83c..61e63cdf4 100644 --- a/src/screen.c +++ b/src/screen.c @@ -552,7 +552,7 @@ void SCR_ClosedCaptions(void) { UINT8 i; boolean gamestopped = (paused || P_AutoPause()); - INT32 basey = BASEVIDHEIGHT; + INT32 basey = BASEVIDHEIGHT - 20; if (gamestate != wipegamestate) return; @@ -585,7 +585,7 @@ void SCR_ClosedCaptions(void) continue; flags = V_SNAPTORIGHT|V_SNAPTOBOTTOM|V_ALLOWLOWERCASE; - y = basey-((i + 2)*10); + y = basey-(i*10); if (closedcaptions[i].b) { From c2aa6d4c74d50d239cbe264bd7eddec2bc9db4d7 Mon Sep 17 00:00:00 2001 From: Zwip-Zwap Zapony Date: Thu, 2 Feb 2023 15:49:54 +0100 Subject: [PATCH 6/8] Fix captions being over-affected by GUI scale Captions' pop-in animation now starts 8 GUI pixels above the resting position, instead of (2 x GUI scale) GUI above it --- src/screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/screen.c b/src/screen.c index 61e63cdf4..73e09963c 100644 --- a/src/screen.c +++ b/src/screen.c @@ -589,7 +589,7 @@ void SCR_ClosedCaptions(void) if (closedcaptions[i].b) { - y -= closedcaptions[i].b * vid.dup; + y -= closedcaptions[i].b * 4; if (renderisnewtic) { closedcaptions[i].b--; From 8cf6e8252c4c7b9bc5b79e4e7f780364ce0418aa Mon Sep 17 00:00:00 2001 From: Zwip-Zwap Zapony Date: Thu, 2 Feb 2023 15:50:40 +0100 Subject: [PATCH 7/8] Interpolate captions --- src/s_sound.c | 2 +- src/screen.c | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/s_sound.c b/src/s_sound.c index ada1a0fd2..a579292ff 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -513,7 +513,7 @@ void S_StartCaption(sfxenum_t sfx_id, INT32 cnum, UINT16 lifespan) closedcaptions[set].c = ((cnum == -1) ? NULL : &channels[cnum]); closedcaptions[set].s = sfx; closedcaptions[set].t = lifespan; - closedcaptions[set].b = 2; // bob + closedcaptions[set].b = 3; // bob } void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) diff --git a/src/screen.c b/src/screen.c index 73e09963c..3c50ec67e 100644 --- a/src/screen.c +++ b/src/screen.c @@ -572,7 +572,8 @@ void SCR_ClosedCaptions(void) for (i = 0; i < NUMCAPTIONS; i++) { - INT32 flags, y; + INT32 flags; + fixed_t y; char dot; boolean music; @@ -585,14 +586,19 @@ void SCR_ClosedCaptions(void) continue; flags = V_SNAPTORIGHT|V_SNAPTOBOTTOM|V_ALLOWLOWERCASE; - y = basey-(i*10); + y = (basey-(i*10)) * FRACUNIT; if (closedcaptions[i].b) { - y -= closedcaptions[i].b * 4; if (renderisnewtic) - { closedcaptions[i].b--; + + if (closedcaptions[i].b) // If the caption hasn't reached its final destination... + { + y -= closedcaptions[i].b * 4 * FRACUNIT; // ...move it per tic... + y += (rendertimefrac % FRACUNIT) * 4; // ...and interpolate it per frame + // We have to modulo it by FRACUNIT, so that it won't be a tic ahead with interpolation disabled + // Unlike everything else, captions are (intentionally) interpolated from T to T+1 instead of T-1 to T } } @@ -606,7 +612,7 @@ void SCR_ClosedCaptions(void) else dot = ' '; - V_DrawRightAlignedString(BASEVIDWIDTH - 20, y, flags, + V_DrawRightAlignedStringAtFixed((BASEVIDWIDTH-20) * FRACUNIT, y, flags, va("%c [%s]", dot, (closedcaptions[i].s->caption[0] ? closedcaptions[i].s->caption : closedcaptions[i].s->name))); } } From 55444cf20460c8d38f843446195e43a8ab0b9b68 Mon Sep 17 00:00:00 2001 From: Krabs <75001008+krabsisa@users.noreply.github.com> Date: Thu, 9 Nov 2023 10:31:03 -0500 Subject: [PATCH 8/8] Update version num (no, .14 isn't releasing yet) --- appveyor.yml | 2 +- src/version.h | 6 +++--- src/win32/Srb2win.rc | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 63d801b73..d0d94b982 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 2.2.13.{branch}-{build} +version: 2.2.14.{branch}-{build} os: MinGW environment: diff --git a/src/version.h b/src/version.h index 3242cad67..8d8f8978e 100644 --- a/src/version.h +++ b/src/version.h @@ -1,4 +1,4 @@ -#define SRB2VERSION "2.2.13"/* this must be the first line, for cmake !! */ +#define SRB2VERSION "2.2.14"/* this must be the first line, for cmake !! */ // The Modification ID; must be obtained from a Master Server Admin ( https://mb.srb2.org/members/?key=ms_admin ). // DO NOT try to set this otherwise, or your modification will be unplayable through the Master Server. @@ -9,7 +9,7 @@ // it's only for detection of the version the player is using so the MS can alert them of an update. // Only set it higher, not lower, obviously. // Note that we use this to help keep internal testing in check; this is why v2.2.0 is not version "1". -#define MODVERSION 54 +#define MODVERSION 55 // Define this as a prerelease version suffix (pre#, RC#) -//#define BETAVERSION "pre1" +#define BETAVERSION "nightly" diff --git a/src/win32/Srb2win.rc b/src/win32/Srb2win.rc index b69900746..9ee9b7d3f 100644 --- a/src/win32/Srb2win.rc +++ b/src/win32/Srb2win.rc @@ -77,8 +77,8 @@ END #include "../doomdef.h" // Needed for version string VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,2,13,0 - PRODUCTVERSION 2,2,13,0 + FILEVERSION 2,2,14,0 + PRODUCTVERSION 2,2,14,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L