From 7092f1126eaaa34cf92b8d10dd932d84dbc08c2c Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 26 Jan 2023 23:33:00 -0800 Subject: [PATCH 01/15] cmake: move ACSVM fetch to cpm-acsvm.cmake Remove SRB2_CONFIG_SYSTEM_LIBRARIES condition. This is because I am lazy and don't want to write a FindACSVM.cmake. I also don't think it will be common for it to be installed at the system level. --- src/CMakeLists.txt | 2 +- thirdparty/CMakeLists.txt | 81 +------------------------------------- thirdparty/cpm-acsvm.cmake | 77 ++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+), 81 deletions(-) create mode 100644 thirdparty/cpm-acsvm.cmake diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bc7ee527e..e0a5bcd70 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -229,7 +229,7 @@ target_link_libraries(SRB2SDL2 PRIVATE glad::glad) target_link_libraries(SRB2SDL2 PRIVATE fmt) target_link_libraries(SRB2SDL2 PRIVATE imgui::imgui) -target_link_libraries(SRB2SDL2 PRIVATE acsvm::acsvm) +target_link_libraries(SRB2SDL2 PRIVATE acsvm) set(SRB2_HAVE_THREADS ON) target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_THREADS) diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index 3a37bae85..479fd26a9 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -22,86 +22,7 @@ include("cpm-discordrpc.cmake") include("cpm-xmp-lite.cmake") include("cpm-fmt.cmake") include("cpm-imgui.cmake") - -if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}") - CPMAddPackage( - NAME acsvm - VERSION 0 - URL "https://github.com/DavidPH/ACSVM/archive/7011af443dd03e8592d7810b0b91f46c49bdde59.zip" - EXCLUDE_FROM_ALL ON - DOWNLOAD_ONLY YES - ) - - if(acsvm_ADDED) - # Sal -- While ACSVM can be built as a shared library, a lot of its options are - # tied to directories existing, because the project suggests just copying it into - # your own project directly. I don't want us to do that, so I made our own target. - set( - acsvm_SOURCES - - ACSVM/Action.cpp - ACSVM/Action.hpp - ACSVM/Array.cpp - ACSVM/Array.hpp - ACSVM/BinaryIO.cpp - ACSVM/BinaryIO.hpp - ACSVM/CallFunc.cpp - ACSVM/CallFunc.hpp - ACSVM/Code.hpp - ACSVM/CodeData.cpp - ACSVM/CodeData.hpp - ACSVM/CodeList.hpp - ACSVM/Environment.cpp - ACSVM/Environment.hpp - ACSVM/Error.cpp - ACSVM/Error.hpp - ACSVM/Function.cpp - ACSVM/Function.hpp - ACSVM/HashMap.hpp - ACSVM/HashMapFixed.hpp - ACSVM/ID.hpp - ACSVM/Init.cpp - ACSVM/Init.hpp - ACSVM/Jump.cpp - ACSVM/Jump.hpp - ACSVM/Module.cpp - ACSVM/Module.hpp - ACSVM/ModuleACS0.cpp - ACSVM/ModuleACSE.cpp - ACSVM/PrintBuf.cpp - ACSVM/PrintBuf.hpp - ACSVM/Scope.cpp - ACSVM/Scope.hpp - ACSVM/Script.cpp - ACSVM/Script.hpp - ACSVM/Serial.cpp - ACSVM/Serial.hpp - ACSVM/Stack.hpp - ACSVM/Store.hpp - ACSVM/String.cpp - ACSVM/String.hpp - ACSVM/Thread.cpp - ACSVM/Thread.hpp - ACSVM/ThreadExec.cpp - ACSVM/Tracer.cpp - ACSVM/Tracer.hpp - ACSVM/Types.hpp - ACSVM/Vector.hpp - - Util/Floats.cpp - Util/Floats.hpp - ) - list(TRANSFORM acsvm_SOURCES PREPEND "${acsvm_SOURCE_DIR}/") - add_library(acsvm "${SRB2_INTERNAL_LIBRARY_TYPE}" ${acsvm_SOURCES}) - - target_compile_features(acsvm PRIVATE cxx_std_11) - - target_include_directories(acsvm INTERFACE "${acsvm_SOURCE_DIR}") - - target_link_libraries(acsvm PRIVATE acsvm::acsvm) - add_library(acsvm::acsvm ALIAS acsvm) - endif() -endif() +include("cpm-acsvm.cmake") add_subdirectory(tcbrindle_span) add_subdirectory(stb_vorbis) diff --git a/thirdparty/cpm-acsvm.cmake b/thirdparty/cpm-acsvm.cmake new file mode 100644 index 000000000..2318050bb --- /dev/null +++ b/thirdparty/cpm-acsvm.cmake @@ -0,0 +1,77 @@ +CPMAddPackage( + NAME acsvm + VERSION 0 + URL "https://github.com/DavidPH/ACSVM/archive/7011af443dd03e8592d7810b0b91f46c49bdde59.zip" + EXCLUDE_FROM_ALL ON + DOWNLOAD_ONLY YES +) + +if(acsvm_ADDED) + # Sal -- While ACSVM can be built as a shared library, a lot of its options are + # tied to directories existing, because the project suggests just copying it into + # your own project directly. I don't want us to do that, so I made our own target. + set( + acsvm_SOURCES + + ACSVM/Action.cpp + ACSVM/Action.hpp + ACSVM/Array.cpp + ACSVM/Array.hpp + ACSVM/BinaryIO.cpp + ACSVM/BinaryIO.hpp + ACSVM/CallFunc.cpp + ACSVM/CallFunc.hpp + ACSVM/Code.hpp + ACSVM/CodeData.cpp + ACSVM/CodeData.hpp + ACSVM/CodeList.hpp + ACSVM/Environment.cpp + ACSVM/Environment.hpp + ACSVM/Error.cpp + ACSVM/Error.hpp + ACSVM/Function.cpp + ACSVM/Function.hpp + ACSVM/HashMap.hpp + ACSVM/HashMapFixed.hpp + ACSVM/ID.hpp + ACSVM/Init.cpp + ACSVM/Init.hpp + ACSVM/Jump.cpp + ACSVM/Jump.hpp + ACSVM/Module.cpp + ACSVM/Module.hpp + ACSVM/ModuleACS0.cpp + ACSVM/ModuleACSE.cpp + ACSVM/PrintBuf.cpp + ACSVM/PrintBuf.hpp + ACSVM/Scope.cpp + ACSVM/Scope.hpp + ACSVM/Script.cpp + ACSVM/Script.hpp + ACSVM/Serial.cpp + ACSVM/Serial.hpp + ACSVM/Stack.hpp + ACSVM/Store.hpp + ACSVM/String.cpp + ACSVM/String.hpp + ACSVM/Thread.cpp + ACSVM/Thread.hpp + ACSVM/ThreadExec.cpp + ACSVM/Tracer.cpp + ACSVM/Tracer.hpp + ACSVM/Types.hpp + ACSVM/Vector.hpp + + Util/Floats.cpp + Util/Floats.hpp + ) + list(TRANSFORM acsvm_SOURCES PREPEND "${acsvm_SOURCE_DIR}/") + add_library(acsvm "${SRB2_INTERNAL_LIBRARY_TYPE}" ${acsvm_SOURCES}) + + target_compile_features(acsvm PRIVATE cxx_std_11) + + target_include_directories(acsvm INTERFACE "${acsvm_SOURCE_DIR}") + + target_link_libraries(acsvm PRIVATE acsvm::acsvm) + add_library(acsvm::acsvm ALIAS acsvm) +endif() From 917062b6c651283716ace6960534f0655757a04a Mon Sep 17 00:00:00 2001 From: toaster Date: Fri, 27 Jan 2023 19:57:56 +0000 Subject: [PATCH 02/15] K_BuildBotTiccmd: Catch NULL track predictions Predict can be NULL if the bot's nextwaypoint is NULL, which happens consistently at the beginning of Speed Highway and can sometimes also occour on other otherwise functionally-waypointed sprint courses. --- src/k_bot.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/k_bot.c b/src/k_bot.c index e6604d338..56b9a8c1f 100644 --- a/src/k_bot.c +++ b/src/k_bot.c @@ -1397,7 +1397,10 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd) } } - turnamt = K_HandleBotTrack(player, cmd, predict, destangle); + if (predict != NULL) + { + turnamt = K_HandleBotTrack(player, cmd, predict, destangle); + } cmd->buttons &= ~(BT_ACCELERATE|BT_BRAKE); cmd->forwardmove = 0; trySpindash = true; @@ -1431,7 +1434,10 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd) } } - turnamt = K_HandleBotTrack(player, cmd, predict, destangle); + if (predict != NULL) + { + turnamt = K_HandleBotTrack(player, cmd, predict, destangle); + } } } else @@ -1450,7 +1456,10 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd) } } - turnamt = K_HandleBotTrack(player, cmd, predict, destangle); + if (predict != NULL) + { + turnamt = K_HandleBotTrack(player, cmd, predict, destangle); + } } if (trySpindash == true) From 915bf831726a4b826ca19b0e86a037f7fbf11f9f Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 31 Jul 2022 15:12:59 +0200 Subject: [PATCH 03/15] Fix equation slopes overflow --- src/p_slopes.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index 5b4ead3e3..4a4e84332 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -201,10 +201,14 @@ void P_ReconfigureViaVertexes (pslope_t *slope, const vector3_t v1, const vector static void ReconfigureViaConstants (pslope_t *slope, const fixed_t a, const fixed_t b, const fixed_t c, const fixed_t d) { fixed_t m; + fixed_t o = 0; vector3_t *normal = &slope->normal; + if (c) + o = abs(c) <= FRACUNIT ? -FixedMul(d, FixedDiv(FRACUNIT, c)) : -FixedDiv(d, c); + // Set origin. - FV3_Load(&slope->o, 0, 0, c ? -FixedDiv(d, c) : 0); + FV3_Load(&slope->o, 0, 0, o); // Get slope's normal. FV3_Load(normal, a, b, c); From 23f9d8e924e4bfc8998ea23637dd5d15ea429ce1 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Wed, 25 Jan 2023 20:44:04 -0600 Subject: [PATCH 04/15] Adjust caption pop-in by tics instead of frames Fixes STJr/SRB2#900 pop-in animation being affected by framerate --- src/screen.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/screen.c b/src/screen.c index f1b53a7f2..9b1036d7c 100644 --- a/src/screen.c +++ b/src/screen.c @@ -675,7 +675,13 @@ void SCR_ClosedCaptions(void) y = basey-((i + 2)*10); if (closedcaptions[i].b) - y -= (closedcaptions[i].b--)*vid.dupy; + { + y -= closedcaptions[i].b * vid.dupy; + if (renderisnewtic) + { + closedcaptions[i].b--; + } + } if (closedcaptions[i].t < CAPTIONFADETICS) flags |= (((CAPTIONFADETICS-closedcaptions[i].t)/2)*V_10TRANS); From 10660411b8d1774bb864a2be9d5c3e62b2602a52 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 4 Dec 2022 09:14:55 +0100 Subject: [PATCH 05/15] Fix callcount typo --- src/p_spec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_spec.c b/src/p_spec.c index 4438401a6..40501ff62 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1608,7 +1608,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller // "Trigger on X calls" linedefs reset if args[2] is set if (specialtype == 321 && triggerline->args[2]) - triggerline->callcount = triggerline->args[3]; + triggerline->callcount = triggerline->args[1]; else { // These special types work only once From ce15c47a4d3c05f3efff76ddaa9f7fbd5d6f9d11 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Sat, 12 Nov 2022 15:14:04 -0600 Subject: [PATCH 06/15] Only interpolate shadowcasters if they exist # Conflicts: # src/hardware/hw_main.c --- src/hardware/hw_main.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 32f46bda3..d729439cc 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5362,21 +5362,24 @@ static void HWR_ProjectSprite(mobj_t *thing) if (thing->renderflags & RF_SHADOWEFFECTS) { mobj_t *caster = thing->target; - interpmobjstate_t casterinterp = {0}; - - if (R_UsingFrameInterpolation() && !paused) - { - R_InterpolateMobjState(caster, rendertimefrac, &casterinterp); - } - else - { - R_InterpolateMobjState(caster, FRACUNIT, &casterinterp); - } if (caster && !P_MobjWasRemoved(caster)) { - fixed_t groundz = R_GetShadowZ(thing, NULL); - fixed_t floordiff = abs(((thing->eflags & MFE_VERTICALFLIP) ? caster->height : 0) + casterinterp.z - groundz); + interpmobjstate_t casterinterp = {0}; + fixed_t groundz; + fixed_t floordiff; + + if (R_UsingFrameInterpolation() && !paused) + { + R_InterpolateMobjState(caster, rendertimefrac, &casterinterp); + } + else + { + R_InterpolateMobjState(caster, FRACUNIT, &casterinterp); + } + + groundz = R_GetShadowZ(thing, NULL); + floordiff = abs(((thing->eflags & MFE_VERTICALFLIP) ? caster->height : 0) + casterinterp.z - groundz); shadowheight = FIXED_TO_FLOAT(floordiff); shadowscale = FIXED_TO_FLOAT(FixedMul(FRACUNIT - floordiff/640, casterinterp.scale)); From 6d415c3d9c2eb96675549259ef98578e097efd82 Mon Sep 17 00:00:00 2001 From: spherallic Date: Mon, 26 Sep 2022 23:51:51 +0200 Subject: [PATCH 07/15] Start bustable FOF sounds at the correct height --- src/p_floor.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/p_floor.c b/src/p_floor.c index a81287102..01d893bcd 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -2149,12 +2149,11 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover) } } -#undef controlsec - - // soundorg z height never gets set normally, so MEH. - sec->soundorg.z = sec->floorheight; + sec->soundorg.z = (controlsec->floorheight + controlsec->ceilingheight)/2; S_StartSound(&sec->soundorg, mobjinfo[type].activesound); +#undef controlsec + // Find the outermost vertexes in the subsector for (i = 0; i < sec->linecount; i++) { From d666ebc2cf1f5b6b493ade7fb650d2871c52dd5b Mon Sep 17 00:00:00 2001 From: spherallic Date: Mon, 26 Sep 2022 20:32:57 +0200 Subject: [PATCH 08/15] Prevent floating crumbling platforms from being triggered twice --- src/p_floor.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/p_floor.c b/src/p_floor.c index 01d893bcd..2d25e8208 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -591,7 +591,6 @@ void T_BounceCheese(bouncecheese_t *bouncer) if (bouncer->sector->crumblestate == CRUMBLE_RESTORE || bouncer->sector->crumblestate == CRUMBLE_WAIT || bouncer->sector->crumblestate == CRUMBLE_ACTIVATED) // Oops! Crumbler says to remove yourself! { - bouncer->sector->crumblestate = CRUMBLE_WAIT; bouncer->sector->ceilingdata = NULL; bouncer->sector->ceilspeed = 0; bouncer->sector->floordata = NULL; From 39097e7433a29aea33785735e22025a0a7766800 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 6 Nov 2022 07:52:54 +0100 Subject: [PATCH 09/15] Fix typo in rising FOF binary-to-UDMF conversion # Conflicts: # src/p_setup.c --- src/p_setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_setup.c b/src/p_setup.c index fa139eff5..e4950261d 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -4588,7 +4588,7 @@ static void P_ConvertBinaryLinedefTypes(void) //Flags if (lines[i].flags & ML_BLOCKPLAYERS) lines[i].args[6] |= TMFR_REVERSE; - if (lines[i].flags & ML_BLOCKPLAYERS) + if (lines[i].flags & ML_NOCLIMB) lines[i].args[6] |= TMFR_SPINDASH; lines[i].special = 190; From 236394f6391220878033898d0cb7560af092a149 Mon Sep 17 00:00:00 2001 From: SteelT Date: Tue, 22 Mar 2022 13:09:29 -0400 Subject: [PATCH 10/15] Fix "unknown command" not being printed on dedicated --- src/command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/command.c b/src/command.c index 88d11105a..b3b657705 100644 --- a/src/command.c +++ b/src/command.c @@ -730,7 +730,7 @@ static void COM_ExecuteString(char *ptext) // check cvars // Hurdler: added at Ebola's request ;) // (don't flood the console in software mode with bad gl_xxx command) - if (!CV_Command() && con_destlines) + if (!CV_Command() && (con_destlines || dedicated)) CONS_Printf(M_GetText("Unknown command '%s'\n"), COM_Argv(0)); } From e710d13ef1831206883956931588a26a9d7c39c7 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 2 Feb 2023 22:03:59 +0000 Subject: [PATCH 11/15] P_ConvertBinarySectorTypes: Stumble is now binary sector type 11 Was 9, but conflicted with Ring Drain --- src/p_setup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/p_setup.c b/src/p_setup.c index e10f18a29..7a9b8d03b 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -6017,7 +6017,9 @@ static void P_ConvertBinarySectorTypes(void) case 8: //Instakill sectors[i].damagetype = SD_INSTAKILL; break; - case 9: // Stumble + //case 9: -- Ring Drainer (Floor Touch) + //case 10: -- Ring Drainer (No Floor Touch) + case 11: // Stumble sectors[i].damagetype = SD_STUMBLE; break; case 12: //Wall sector From 057b46f4bd211167ec8d366c3d0cad41500b97b7 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 2 Feb 2023 22:18:28 +0000 Subject: [PATCH 12/15] P_DamageMobj: DMG_STUMBLE should not drop shields --- src/p_inter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_inter.c b/src/p_inter.c index c1bcb5b8e..fbd6a2b5e 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2356,7 +2356,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da } else { - K_DropHnextList(player, false); + K_DropHnextList(player, (type != DMG_STUMBLE)); } if (type != DMG_STUMBLE) From 9bf5328d5555c633f9d63635c4e1dc2e06442d1c Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 2 Feb 2023 22:19:22 +0000 Subject: [PATCH 13/15] P_DamageMobj: Fix DMG_STING not playing sound --- src/p_inter.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index fbd6a2b5e..b6a864a0d 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2337,13 +2337,11 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da break; } - if (type != DMG_STING && type != DMG_STUMBLE) + if (type != DMG_STUMBLE) { - player->flashing = K_GetKartFlashing(player); - } + if (type != DMG_STING) + player->flashing = K_GetKartFlashing(player); - if (ringburst > 0) - { P_PlayRinglossSound(target); P_PlayerRingBurst(player, ringburst); } From 8b7faa10c1df045c68665527a5c71a1807850572 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 6 Feb 2023 20:46:47 +0000 Subject: [PATCH 14/15] M_LevelListFromGametype: Remove memory-corrupting memset - firstlen was in units of raw UINT8 address (pre-multiplied by sizeof(cupheader_t*)) to permit being used in Z_Realloc. However, it was being added onto the cupgrid.builtgrid pointer BEFORE it was cast into UINT8* for memset, leading to an offset, when considered in terms of UINT8 address. - Z_Realloc2 is always guaranteed to memset any appended memory so this wasn't even required --- src/menus/transient/level-select.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/menus/transient/level-select.c b/src/menus/transient/level-select.c index 3ccbd7a7e..74b854a79 100644 --- a/src/menus/transient/level-select.c +++ b/src/menus/transient/level-select.c @@ -288,7 +288,6 @@ boolean M_LevelListFromGametype(INT16 gt) I_Error("M_LevelListFromGametype: Not enough memory to reallocate builtgrid"); } - memset(cupgrid.builtgrid + firstlen, 0, firstlen); cupgrid.cappages *= 2; } From daf11a1407f7a5a656ca3329c1b47b0c02f5da48 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 6 Feb 2023 20:47:48 +0000 Subject: [PATCH 15/15] M_LevelListFromGametype: Z_Malloc instead of Z_Calloc for initialisation of cupgrid.builtgrid A memset is already guaranteed to follow this initialisation. --- src/menus/transient/level-select.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/menus/transient/level-select.c b/src/menus/transient/level-select.c index 74b854a79..b4cf228cf 100644 --- a/src/menus/transient/level-select.c +++ b/src/menus/transient/level-select.c @@ -251,7 +251,7 @@ boolean M_LevelListFromGametype(INT16 gt) if (cupgrid.cappages == 0) { cupgrid.cappages = 2; - cupgrid.builtgrid = Z_Calloc( + cupgrid.builtgrid = Z_Malloc( cupgrid.cappages * pagelen, PU_STATIC, NULL);