From 35a5c82c42834cd5fc86fc9ccea007ba44f3cd70 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Fri, 27 May 2022 13:36:55 -0500 Subject: [PATCH 1/9] Update triggertag on sector tag fset Fixes STJr/SRB2#865 --- src/taglist.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/taglist.c b/src/taglist.c index 9bc6021b0..e933b71fd 100644 --- a/src/taglist.c +++ b/src/taglist.c @@ -14,6 +14,7 @@ #include "taglist.h" #include "z_zone.h" #include "r_data.h" +#include "r_defs.h" // Bit array of whether a tag exists for sectors/lines/things. bitarray_t tags_available[BIT_ARRAY_SIZE (MAXTAGS)]; @@ -454,6 +455,13 @@ void Tag_SectorFSet (const size_t id, const mtag_t tag) Taggroup_Remove(tags_sectors, curtag, id); Taggroup_Add(tags_sectors, tag, id); Tag_FSet(&sec->tags, tag); + + // Sectors with linedef trigger effects need to have their trigger tag updated too + // This is a bit of a hack... + if (sec->flags & MSF_TRIGGERLINE_PLANE || sec->flags & MSF_TRIGGERLINE_MOBJ) + { + sec->triggertag = tag; + } } mtag_t Tag_NextUnused(mtag_t start) From f94c25c05c5b990bd233717acea2b9f32d7f9198 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Thu, 26 May 2022 23:38:50 -0500 Subject: [PATCH 2/9] Change UDMF wall scroll scale to SCROLL_SHIFT UDMF special 502 now must scale arg 2 and 3 in the same scale space as line length scrolling in binary format. This is to ensure compatibility with the binary format. Fixes STJr/SRB2#862 Co-Authored-By: MascaraSnake --- src/p_setup.c | 8 ++++---- src/p_spec.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index ea099e13e..89b419953 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -5552,13 +5552,13 @@ static void P_ConvertBinaryLinedefTypes(void) lines[i].args[1] = 0; if (lines[i].flags & ML_NOSKEW) { - lines[i].args[2] = lines[i].dx >> (FRACBITS + SCROLL_SHIFT); - lines[i].args[3] = lines[i].dy >> (FRACBITS + SCROLL_SHIFT); + lines[i].args[2] = sides[lines[i].sidenum[0]].textureoffset >> (FRACBITS - SCROLL_SHIFT); + lines[i].args[3] = sides[lines[i].sidenum[0]].rowoffset >> (FRACBITS - SCROLL_SHIFT); } else { - lines[i].args[2] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; - lines[i].args[3] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + lines[i].args[2] = lines[i].dx >> FRACBITS; + lines[i].args[3] = lines[i].dy >> FRACBITS; } lines[i].args[4] = lines[i].special - 502; lines[i].special = 502; diff --git a/src/p_spec.c b/src/p_spec.c index 69e1e3925..c000960b5 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -7563,9 +7563,9 @@ static void P_SpawnScrollers(void) if (s != (INT32)i) { if (l->args[1] != TMSD_BACK) - Add_Scroller(sc_side, l->args[2] << FRACBITS, l->args[3] << FRACBITS, control, lines[s].sidenum[0], accel, 0); + Add_Scroller(sc_side, l->args[2] << (FRACBITS - SCROLL_SHIFT), l->args[3] << (FRACBITS - SCROLL_SHIFT), control, lines[s].sidenum[0], accel, 0); if (l->args[1] != TMSD_FRONT && lines[s].sidenum[1] != 0xffff) - Add_Scroller(sc_side, l->args[2] << FRACBITS, l->args[3] << FRACBITS, control, lines[s].sidenum[1], accel, 0); + Add_Scroller(sc_side, l->args[2] << (FRACBITS - SCROLL_SHIFT), l->args[3] << (FRACBITS - SCROLL_SHIFT), control, lines[s].sidenum[1], accel, 0); } break; } From 37da148996f5c32966f47d2b46bc7eb9935ddb0b Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 29 May 2022 11:56:30 +0200 Subject: [PATCH 3/9] Update triggertag on Tag_SectorFSet if in binary map and the sector has a trigger special --- src/taglist.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/taglist.c b/src/taglist.c index e933b71fd..305b05f04 100644 --- a/src/taglist.c +++ b/src/taglist.c @@ -14,7 +14,7 @@ #include "taglist.h" #include "z_zone.h" #include "r_data.h" -#include "r_defs.h" +#include "p_spec.h" // Bit array of whether a tag exists for sectors/lines/things. bitarray_t tags_available[BIT_ARRAY_SIZE (MAXTAGS)]; @@ -458,10 +458,8 @@ void Tag_SectorFSet (const size_t id, const mtag_t tag) // Sectors with linedef trigger effects need to have their trigger tag updated too // This is a bit of a hack... - if (sec->flags & MSF_TRIGGERLINE_PLANE || sec->flags & MSF_TRIGGERLINE_MOBJ) - { + if (!udmf && GETSECSPECIAL(sec->special, 2) >= 1 && GETSECSPECIAL(sec->special, 2) <= 7) sec->triggertag = tag; - } } mtag_t Tag_NextUnused(mtag_t start) From af7c0f4d6c3dae2fdc463c162431b82d5030f2e7 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 29 May 2022 12:24:14 +0200 Subject: [PATCH 4/9] Allow linedef types 409/410 to change the trigger tag --- extras/conf/udb/Includes/SRB222_linedefs.cfg | 2 ++ src/p_spec.c | 6 ++++++ src/p_spec.h | 1 + 3 files changed, 9 insertions(+) diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg index 0aa7ea629..fff9edf10 100644 --- a/extras/conf/udb/Includes/SRB222_linedefs.cfg +++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg @@ -3677,6 +3677,7 @@ udmf 0 = "Add tag"; 1 = "Remove tag"; 2 = "Replace first tag"; + 3 = "Change trigger tag"; } } } @@ -3699,6 +3700,7 @@ udmf 0 = "Add tag"; 1 = "Remove tag"; 2 = "Replace first tag"; + 3 = "Change trigger tag"; } } } diff --git a/src/p_spec.c b/src/p_spec.c index 69e1e3925..cd36053c9 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2396,6 +2396,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) default: Tag_SectorFSet(secnum, newtag); break; + case TMT_TRIGGERTAG: + sectors[secnum].triggertag = newtag; + break; } } break; @@ -2418,6 +2421,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) default: Tag_SectorFSet(secnum, newtag); break; + case TMT_TRIGGERTAG: + sectors[secnum].triggertag = newtag; + break; } break; } diff --git a/src/p_spec.h b/src/p_spec.h index bdc912c34..33d18d63e 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -306,6 +306,7 @@ typedef enum TMT_ADD = 0, TMT_REMOVE = 1, TMT_REPLACEFIRST = 2, + TMT_TRIGGERTAG = 3, } textmaptagoptions_t; typedef enum From 9971592dc6f8479ce0ee099006444447ef1ef84d Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sat, 4 Jun 2022 11:14:31 +0200 Subject: [PATCH 5/9] UDMF conversion: Fix noclimb flag not being applied to linedef types 66-68 --- src/p_setup.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/p_setup.c b/src/p_setup.c index 89b419953..083b8f236 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -4248,6 +4248,8 @@ static void P_ConvertBinaryLinedefTypes(void) lines[i].args[0] = tag; lines[i].args[1] = lines[i].special - 66; lines[i].args[2] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[2] *= -1; lines[i].special = 66; break; case 76: //Make FOF bouncy From c9536ff4dc9409eb99c5951c390ca021d55cd820 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sat, 4 Jun 2022 17:46:00 +0200 Subject: [PATCH 6/9] Fix copypaste error in P_GetMobjGravity --- src/p_mobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 9017c2f16..36253569b 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1456,7 +1456,7 @@ fixed_t P_GetMobjGravity(mobj_t *mo) if ((rover->flags & (FF_SWIMMABLE|FF_GOOWATER)) == (FF_SWIMMABLE|FF_GOOWATER)) goopgravity = true; - gravfactor = P_GetSectorGravityFactor(mo->subsector->sector); + gravfactor = P_GetSectorGravityFactor(rover->master->frontsector); if (gravfactor == FRACUNIT) continue; From a3ffd042239878dccc844e660a5c8bd0f58308b1 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Thu, 14 Jul 2022 18:33:40 -0500 Subject: [PATCH 7/9] cmake: Adjust linkage for macOS This properly links dylibs set during build instead of expecting the libraries to be in the system path. --- src/sdl/CMakeLists.txt | 49 +++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index 4f19d93df..7fece1647 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -87,39 +87,30 @@ if(${SDL2_FOUND}) endif() if(${CMAKE_SYSTEM} MATCHES Darwin) - find_library(CORE_LIB CoreFoundation) + find_library(CORE_FOUNDATION_LIBRARY "CoreFoundation") target_link_libraries(SRB2SDL2 PRIVATE - ${CORE_LIB} - SDL2 - SDL2_mixer - ${GME_LIBRARIES} - ${OPENMPT_LIBRARIES} - ${MIXERX_LIBRARIES} - ${PNG_LIBRARIES} - ${ZLIB_LIBRARIES} - ${OPENGL_LIBRARIES} - ${CURL_LIBRARIES} + ${CORE_FOUNDATION_LIBRARY} ) set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}") - else() - target_link_libraries(SRB2SDL2 PRIVATE - ${SDL2_LIBRARIES} - ${SDL2_MIXER_LIBRARIES} - ${GME_LIBRARIES} - ${OPENMPT_LIBRARIES} - ${MIXERX_LIBRARIES} - ${PNG_LIBRARIES} - ${ZLIB_LIBRARIES} - ${OPENGL_LIBRARIES} - ${CURL_LIBRARIES} - ) + endif() - if(${CMAKE_SYSTEM} MATCHES Linux) - target_link_libraries(SRB2SDL2 PRIVATE - m - rt - ) - endif() + target_link_libraries(SRB2SDL2 PRIVATE + ${SDL2_LIBRARIES} + ${SDL2_MIXER_LIBRARIES} + ${GME_LIBRARIES} + ${OPENMPT_LIBRARIES} + ${MIXERX_LIBRARIES} + ${PNG_LIBRARIES} + ${ZLIB_LIBRARIES} + ${OPENGL_LIBRARIES} + ${CURL_LIBRARIES} + ) + + if(${CMAKE_SYSTEM} MATCHES Linux) + target_link_libraries(SRB2SDL2 PRIVATE + m + rt + ) endif() #target_link_libraries(SRB2SDL2 PRIVATE SRB2Core) From 66ab96363c2d7e621e559b258da2df9421a6265a Mon Sep 17 00:00:00 2001 From: Eidolon Date: Thu, 14 Jul 2022 23:32:34 -0500 Subject: [PATCH 8/9] cmake: Fix rpath issues in macOS bundle fixup --- src/sdl/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index 7fece1647..11c0f8398 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -127,8 +127,6 @@ if(${SDL2_FOUND}) endif() endif() - set_target_properties(SRB2SDL2 PROPERTIES VERSION ${SRB2_VERSION}) - if(${CMAKE_SYSTEM} MATCHES Windows) target_link_libraries(SRB2SDL2 PRIVATE ws2_32 @@ -179,6 +177,7 @@ if(${SDL2_FOUND}) install(TARGETS SRB2SDL2 BUNDLE DESTINATION . ) + set_property(TARGET SRB2SDL2 PROPERTY INSTALL_RPATH_USE_LINK_PATH ON) else() install(TARGETS SRB2SDL2 SRB2SDL2 RUNTIME DESTINATION . From 0e5b5bf5d9a33e1f44d0dbb876b0b26c7be83cec Mon Sep 17 00:00:00 2001 From: Eidolon Date: Thu, 14 Jul 2022 23:57:53 -0500 Subject: [PATCH 9/9] cmake: Set plist properties for macOS bundle yay icon --- src/sdl/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index 11c0f8398..d369d11c0 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -92,6 +92,16 @@ if(${SDL2_FOUND}) ${CORE_FOUNDATION_LIBRARY} ) set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}") + + # Configure the app bundle icon and plist properties + target_sources(SRB2SDL2 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/macosx/Srb2mac.icns") + set_target_properties(SRB2SDL2 PROPERTIES + MACOSX_BUNDLE_ICON_FILE "Srb2mac" + MACOSX_BUNDLE_BUNDLE_NAME "Sonic Robo Blast 2" + MACOSX_BUNDLE_BUNDLE_VERSION ${SRB2_VERSION} + + RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/macosx/Srb2mac.icns" + ) endif() target_link_libraries(SRB2SDL2 PRIVATE