Compare commits

...
Author SHA1 Message Date
Alug 8d3435291b fix windows compile 2025-10-03 22:41:02 +01:00
Alug 8f007155cd update libbacktrace (win x64) 2025-10-03 21:36:49 +01:00
Alug 58a38ac6c4 add "SATURN_TESTING" define
currently to hide the commit string from titlescreen on release builds
could be used for other crap
wish could use comptime to autogenerate this, but it runs after compile & linking
2025-10-03 16:40:31 +02:00
Alug 1e1dbfc450 oops all include guards 2025-10-03 16:39:51 +02:00
Alug 2eac9fc295 tiny cleanup p_map
also save a little division and abs
2025-10-03 16:39:48 +02:00
indev 4416be2ddc Merge pull request #203 from Indev450/curl-cli-args
CURL cli args
2025-10-02 19:00:29 +03:00
21 changed files with 355 additions and 175 deletions

No files matched your search

+4 -4
View File
@@ -5,13 +5,13 @@
# met: # met:
# (1) Redistributions of source code must retain the above copyright # (1) Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer.
# (2) Redistributions in binary form must reproduce the above copyright # (2) Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in # notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the # the documentation and/or other materials provided with the
# distribution. # distribution.
# (3) The name of the author may not be used to # (3) The name of the author may not be used to
# endorse or promote products derived from this software without # endorse or promote products derived from this software without
# specific prior written permission. # specific prior written permission.
@@ -26,4 +26,4 @@
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE. # POSSIBILITY OF SUCH DAMAGE.
+11 -1
View File
@@ -10,8 +10,18 @@ The libbacktrace library may be linked into a program or library and
used to produce symbolic backtraces. used to produce symbolic backtraces.
Sample uses would be to print a detailed backtrace when an error Sample uses would be to print a detailed backtrace when an error
occurs or to gather detailed profiling information. occurs or to gather detailed profiling information.
In general the functions provided by this library are async-signal-safe, In general the functions provided by this library are async-signal-safe,
meaning that they may be safely called from a signal handler. meaning that they may be safely called from a signal handler.
That said, on systems that use `dl_iterate_phdr`, such as GNU/Linux,
the first call to a libbacktrace function will call `dl_iterate_phdr`,
which is not in general async-signal-safe. Therefore, programs
that call libbacktrace from a signal handler should ensure that they
make an initial call from outside of a signal handler.
Similar considerations apply when arranging to call libbacktrace
from within malloc; `dl_iterate_phdr` can also call malloc,
so make an initial call to a libbacktrace function outside of
malloc before trying to call libbacktrace functions within malloc.
The libbacktrace library is provided under a BSD license. The libbacktrace library is provided under a BSD license.
See the source files for the exact license text. See the source files for the exact license text.
@@ -25,7 +35,7 @@ will work.
See the source file backtrace-supported.h.in for the macros that it See the source file backtrace-supported.h.in for the macros that it
defines. defines.
As of October 2020, libbacktrace supports ELF, PE/COFF, Mach-O, and As of July 2024, libbacktrace supports ELF, PE/COFF, Mach-O, and
XCOFF executables with DWARF debugging information. XCOFF executables with DWARF debugging information.
In other words, it supports GNU/Linux, *BSD, macOS, Windows, and AIX. In other words, it supports GNU/Linux, *BSD, macOS, Windows, and AIX.
The library is written to make it straightforward to add support for The library is written to make it straightforward to add support for
Binary file not shown.
@@ -0,0 +1,41 @@
# libbacktrace.la - a libtool library file
# Generated by libtool (GNU libtool 1.3134 2009-11-29) 2.2.7a
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname=''
# Names of this library.
library_names=''
# The name of the static archive.
old_library='libbacktrace.a'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags=''
# Libraries that this one depends upon.
dependency_libs=''
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libbacktrace.
current=0
age=0
revision=0
# Is this an already installed library?
installed=no
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/mingw64/lib'
@@ -0,0 +1,41 @@
# libbacktrace.la - a libtool library file
# Generated by libtool (GNU libtool 1.3134 2009-11-29) 2.2.7a
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname=''
# Names of this library.
library_names=''
# The name of the static archive.
old_library='libbacktrace.a'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags=''
# Libraries that this one depends upon.
dependency_libs=''
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libbacktrace.
current=0
age=0
revision=0
# Is this an already installed library?
installed=yes
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/mingw64/lib'
+5
View File
@@ -10,8 +10,13 @@
/// \file b_bot.h /// \file b_bot.h
/// \brief Basic bot handling /// \brief Basic bot handling
#ifndef __B_BOT__
#define __B_BOT__
void B_BuildTiccmd(player_t *player, ticcmd_t *cmd); void B_BuildTiccmd(player_t *player, ticcmd_t *cmd);
void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward, boolean left, boolean right, boolean strafeleft, boolean straferight, boolean jump, boolean spin); void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward, boolean left, boolean right, boolean strafeleft, boolean straferight, boolean jump, boolean spin);
boolean B_CheckRespawn(player_t *player); boolean B_CheckRespawn(player_t *player);
void B_MoveBlocked(player_t *player); void B_MoveBlocked(player_t *player);
void B_RespawnBot(INT32 playernum); void B_RespawnBot(INT32 playernum);
#endif
+1 -1
View File
@@ -1,4 +1,4 @@
// BLANKART // SONIC ROBO BLAST 2 KART
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2024 by Ronald "Eidolon" Kinard // Copyright (C) 2024 by Ronald "Eidolon" Kinard
// Copyright (C) 2024 by Kart Krew // Copyright (C) 2024 by Kart Krew
+1 -1
View File
@@ -1,4 +1,4 @@
// BLANKART // SONIC ROBO BLAST 2 KART
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2024 by Ronald "Eidolon" Kinard // Copyright (C) 2024 by Ronald "Eidolon" Kinard
// Copyright (C) 2024 by Kart Krew // Copyright (C) 2024 by Kart Krew
+1 -1
View File
@@ -1,4 +1,4 @@
// BLANKART // SONIC ROBO BLAST 2 KART
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2024 by Ronald "Eidolon" Kinard // Copyright (C) 2024 by Ronald "Eidolon" Kinard
// Copyright (C) 2024 by Kart Krew // Copyright (C) 2024 by Kart Krew
+5
View File
@@ -9,6 +9,9 @@
/// \file d_protocol.h /// \file d_protocol.h
/// \brief srb2kart:// protocol stuff /// \brief srb2kart:// protocol stuff
#ifndef __D_PROTOCOL__
#define __D_PROTOCOL__
void D_SetupProtocol(void); void D_SetupProtocol(void);
void D_CreateProtocol(void); void D_CreateProtocol(void);
@@ -16,3 +19,5 @@ void D_DeleteProtocol(void);
#ifdef HAVE_CURL #ifdef HAVE_CURL
void D_DownloadReplay(const char *url, const char *path); void D_DownloadReplay(const char *url, const char *path);
#endif #endif
#endif //__D_PROTOCOL__
+4 -1
View File
@@ -92,7 +92,7 @@ extern char logfilename[1024];
// not sure if this belongs here lul // not sure if this belongs here lul
// TODO: figure out whats preventing 32bit windows from working with libbacktrace // TODO: figure out whats preventing 32bit windows from working with libbacktrace
#if defined(_WIN32) && !defined(MINGW64) #if defined(_WIN32) && !defined(__MINGW64__)
#define HAVE_DRMINGW #define HAVE_DRMINGW
#endif #endif
@@ -120,6 +120,9 @@ extern char logfilename[1024];
#define SUBVERSION 6 // more precise version number #define SUBVERSION 6 // more precise version number
#define VERSIONSTRING "Saturn v9" #define VERSIONSTRING "Saturn v9"
#define VERSIONSTRINGW L"Saturn v9" #define VERSIONSTRINGW L"Saturn v9"
#define SATURN_TESTING // comment out for saturn release builds!
// Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates! // Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates!
// And change CMakeLists.txt (not src/, but in root), for CMake users! // And change CMakeLists.txt (not src/, but in root), for CMake users!
#endif #endif
+5
View File
@@ -10,9 +10,14 @@
/// \file k_director.h /// \file k_director.h
/// \brief SRB2kart automatic spectator camera. /// \brief SRB2kart automatic spectator camera.
#ifndef __K_DIRECTOR__
#define __K_DIRECTOR__
boolean K_DirectorIsAvailable(void); boolean K_DirectorIsAvailable(void);
void K_InitDirector(void); void K_InitDirector(void);
void K_UpdateDirector(void); void K_UpdateDirector(void);
void K_DrawDirectorDebugger(void); void K_DrawDirectorDebugger(void);
void K_DirectorFollowAttack(player_t *player, mobj_t *inflictor, mobj_t *source); void K_DirectorFollowAttack(player_t *player, mobj_t *inflictor, mobj_t *source);
void K_ToggleDirector(void); void K_ToggleDirector(void);
#endif
+5
View File
@@ -10,6 +10,9 @@
/// \file lua_hook.h /// \file lua_hook.h
/// \brief hooks for Lua scripting /// \brief hooks for Lua scripting
#ifndef __LUA_HOOK__
#define __LUA_HOOK__
#include "r_defs.h" #include "r_defs.h"
#include "d_player.h" #include "d_player.h"
#include "s_sound.h" #include "s_sound.h"
@@ -146,3 +149,5 @@ boolean LUA_HookPlayerSquish(player_t *player, mobj_t *inflictor, mobj_t *source
// (note: function format in lua doesn't include maxresults, so its function(result, gametype, secondgametype, prevmap) // (note: function format in lua doesn't include maxresults, so its function(result, gametype, secondgametype, prevmap)
// to get maxresults use #result) // to get maxresults use #result)
void LUA_HookSetupVote(INT16 result[], INT16 maxresults, UINT8 gt, UINT8 secondgt); void LUA_HookSetupVote(INT16 result[], INT16 maxresults, UINT8 gt, UINT8 secondgt);
#endif //__LUA_HOOK__
+5
View File
@@ -10,6 +10,9 @@
/// \file lua_libs.h /// \file lua_libs.h
/// \brief libraries for Lua scripting /// \brief libraries for Lua scripting
#ifndef __LUA_LIBS__
#define __LUA_LIBS__
#include "doomtype.h" #include "doomtype.h"
#include "blua/lua.h" #include "blua/lua.h"
@@ -73,3 +76,5 @@ int LUA_ThinkerLib(lua_State *L);
int LUA_MapLib(lua_State *L); int LUA_MapLib(lua_State *L);
int LUA_BlockmapLib(lua_State *L); int LUA_BlockmapLib(lua_State *L);
int LUA_HudLib(lua_State *L); int LUA_HudLib(lua_State *L);
#endif //__LUA_LIBS__
+5
View File
@@ -10,6 +10,9 @@
/// \file m_cond.h /// \file m_cond.h
/// \brief Unlockable condition system for SRB2 version 2.1 /// \brief Unlockable condition system for SRB2 version 2.1
#ifndef __M_COND__
#define __M_COND__
#include "doomdef.h" #include "doomdef.h"
// -------- // --------
@@ -182,3 +185,5 @@ UINT8 M_GotLowEnoughTime(INT32 tictime);
//UINT8 M_GotHighEnoughRings(INT32 trings); //UINT8 M_GotHighEnoughRings(INT32 trings);
#define M_Achieved(a) ((a) >= MAXCONDITIONSETS || conditionSets[a].achieved) #define M_Achieved(a) ((a) >= MAXCONDITIONSETS || conditionSets[a].achieved)
#endif //__M_COND__
+3 -2
View File
@@ -1432,10 +1432,11 @@ void M_Drawer(void)
V_DrawThinString(vid.dup, vid.height - 20*vid.dup, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, compbranch); V_DrawThinString(vid.dup, vid.height - 20*vid.dup, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, compbranch);
V_DrawThinString(vid.dup, vid.height - 10*vid.dup, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, comprevision); V_DrawThinString(vid.dup, vid.height - 10*vid.dup, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, comprevision);
#else // Regular build #else // Regular build
V_DrawThinString(vid.dup, vid.height - 20*vid.dup, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, comprevision); // Removeur this for release! im just lazy to make a new flag or smth #ifdef SATURN_TESTING // ok not regular build lmao, we dont need to show this stuff in Saturn release builds
V_DrawThinString(vid.dup, vid.height - 20*vid.dup, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, comprevision);
#endif
V_DrawThinString(vid.dup, vid.height - 10*vid.dup, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, va("%s", VERSIONSTRING)); V_DrawThinString(vid.dup, vid.height - 10*vid.dup, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, va("%s", VERSIONSTRING));
#endif #endif
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode == render_opengl) if (rendermode == render_opengl)
V_DrawThinString(0, 0, V_GREENMAP|V_SNAPTOTOP|V_SNAPTOLEFT|V_TRANSLUCENT|V_ALLOWLOWERCASE, ("Opengl")); V_DrawThinString(0, 0, V_GREENMAP|V_SNAPTOTOP|V_SNAPTOLEFT|V_TRANSLUCENT|V_ALLOWLOWERCASE, ("Opengl"));
+93 -46
View File
@@ -345,6 +345,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
blockdist = thing->radius + tmthing->radius; blockdist = thing->radius + tmthing->radius;
if (abs(thing->x - tmx) >= blockdist || abs(thing->y - tmy) >= blockdist) if (abs(thing->x - tmx) >= blockdist || abs(thing->y - tmy) >= blockdist)
return true; // didn't hit it return true; // didn't hit it
// see if it went over / under // see if it went over / under
if (tmthing->z > thing->z + thing->height) if (tmthing->z > thing->z + thing->height)
return true; // overhead return true; // overhead
@@ -1712,10 +1713,14 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
tmbbox[BOXRIGHT] = x + tmthing->radius; tmbbox[BOXRIGHT] = x + tmthing->radius;
tmbbox[BOXLEFT] = x - tmthing->radius; tmbbox[BOXLEFT] = x - tmthing->radius;
if (thing->x != x || thing->y != y || thing->subsector == NULL) if (thing->x != x || thing->y != y || !thing->subsector)
{
newsec = R_PointInSubsector(x, y)->sector; newsec = R_PointInSubsector(x, y)->sector;
}
else else
{
newsec = thing->subsector->sector; newsec = thing->subsector->sector;
}
ceilingline = blockingline = NULL; ceilingline = blockingline = NULL;
@@ -1808,17 +1813,17 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
midheight = (bottomheight + ((topheight - bottomheight)/2)); midheight = (bottomheight + ((topheight - bottomheight)/2));
delta1 = thing->z - midheight; delta1 = abs(thing->z - midheight);
delta2 = thingtop - midheight; delta2 = abs(thingtop - midheight);
if (topheight > tmfloorz && abs(delta1) < abs(delta2) if (topheight > tmfloorz && delta1 < delta2
&& !(rover->flags & FF_REVERSEPLATFORM)) && !(rover->flags & FF_REVERSEPLATFORM))
{ {
tmfloorz = tmdropoffz = topheight; tmfloorz = tmdropoffz = topheight;
tmfloorslope = *rover->t_slope; tmfloorslope = *rover->t_slope;
} }
if (bottomheight < tmceilingz && abs(delta1) >= abs(delta2) if (bottomheight < tmceilingz && delta1 >= delta2
&& !(rover->flags & FF_PLATFORM) && !(rover->flags & FF_PLATFORM)
&& !(thing->type == MT_SKIM && (rover->flags & FF_SWIMMABLE))) && !(thing->type == MT_SKIM && (rover->flags & FF_SWIMMABLE)))
{ {
@@ -1869,7 +1874,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
{ {
sector_t *polysec; sector_t *polysec;
fixed_t delta1, delta2, thingtop; fixed_t delta1, delta2, thingtop;
fixed_t polytop, polybottom; fixed_t polytop, polybottom, polymid;
po->validcount = validcount; po->validcount = validcount;
@@ -1895,21 +1900,24 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
} }
thingtop = thing->z + thing->height; thingtop = thing->z + thing->height;
delta1 = thing->z - (polybottom + ((polytop - polybottom)/2)); polymid = (polybottom + ((polytop - polybottom)/2));
delta2 = thingtop - (polybottom + ((polytop - polybottom)/2));
if (polytop > tmfloorz && abs(delta1) < abs(delta2)) delta1 = abs(thing->z - polymid);
delta2 = abs(thingtop - polymid);
if (polytop > tmfloorz && delta1 < delta2)
{ {
tmfloorz = tmdropoffz = polytop; tmfloorz = tmdropoffz = polytop;
tmfloorslope = NULL; tmfloorslope = NULL;
} }
if (polybottom < tmceilingz && abs(delta1) >= abs(delta2)) if (polybottom < tmceilingz && delta1 >= delta2)
{ {
tmceilingz = tmdrpoffceilz = polybottom; tmceilingz = tmdrpoffceilz = polybottom;
tmceilingslope = NULL; tmceilingslope = NULL;
} }
} }
plink = (polymaplink_t *)(plink->link.next); plink = (polymaplink_t *)(plink->link.next);
} }
} }
@@ -1994,10 +2002,14 @@ static boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
tmbbox[BOXRIGHT] = x + thiscam->radius; tmbbox[BOXRIGHT] = x + thiscam->radius;
tmbbox[BOXLEFT] = x - thiscam->radius; tmbbox[BOXLEFT] = x - thiscam->radius;
if (thiscam->x != x || thiscam->y != y || thiscam->subsector == NULL) if (thiscam->x != x || thiscam->y != y || !thiscam->subsector)
newsec = R_PointInSubsectorFast(x, y)->sector; {
newsec = R_PointInSubsector(x, y)->sector;
}
else else
{
newsec = thiscam->subsector->sector; newsec = thiscam->subsector->sector;
}
ceilingline = blockingline = NULL; ceilingline = blockingline = NULL;
@@ -2042,24 +2054,25 @@ static boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
for (rover = newsec->ffloors; rover; rover = rover->next) for (rover = newsec->ffloors; rover; rover = rover->next)
{ {
fixed_t topheight, bottomheight; fixed_t topheight, bottomheight, midheight;
if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERALL) || UNLIKELY(GETSECSPECIAL(rover->master->frontsector->special, 4) == 12)) if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERALL)
|| UNLIKELY(GETSECSPECIAL(rover->master->frontsector->special, 4) == 12))
continue; continue;
topheight = P_CameraGetFOFTopZ(thiscam, newsec, rover, x, y, NULL); topheight = P_CameraGetFOFTopZ(thiscam, newsec, rover, x, y, NULL);
bottomheight = P_CameraGetFOFBottomZ(thiscam, newsec, rover, x, y, NULL); bottomheight = P_CameraGetFOFBottomZ(thiscam, newsec, rover, x, y, NULL);
midheight = (bottomheight + ((topheight - bottomheight)/2));
delta1 = thiscam->z - (bottomheight delta1 = abs(thiscam->z - midheight);
+ ((topheight - bottomheight)/2)); delta2 = abs(thingtop - midheight);
delta2 = thingtop - (bottomheight
+ ((topheight - bottomheight)/2));
if (topheight > tmfloorz && abs(delta1) < abs(delta2)) if (topheight > tmfloorz && delta1 < delta2)
{ {
tmfloorz = tmdropoffz = topheight; tmfloorz = tmdropoffz = topheight;
} }
if (bottomheight < tmceilingz && abs(delta1) >= abs(delta2))
if (bottomheight < tmceilingz && delta1 >= delta2)
{ {
tmceilingz = tmdrpoffceilz = bottomheight; tmceilingz = tmdrpoffceilz = bottomheight;
} }
@@ -2085,6 +2098,7 @@ static boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
validcount++; validcount++;
for (by = yl; by <= yh; by++) for (by = yl; by <= yh; by++)
{
for (bx = xl; bx <= xh; bx++) for (bx = xl; bx <= xh; bx++)
{ {
INT32 offset; INT32 offset;
@@ -2106,7 +2120,7 @@ static boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
{ {
sector_t *polysec; sector_t *polysec;
fixed_t delta1, delta2, thingtop; fixed_t delta1, delta2, thingtop;
fixed_t polytop, polybottom; fixed_t polytop, polybottom, polymid;
po->validcount = validcount; po->validcount = validcount;
@@ -2137,18 +2151,21 @@ static boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
} }
thingtop = thiscam->z + thiscam->height; thingtop = thiscam->z + thiscam->height;
delta1 = thiscam->z - (polybottom + ((polytop - polybottom)/2)); polymid = (polybottom + ((polytop - polybottom)/2));
delta2 = thingtop - (polybottom + ((polytop - polybottom)/2));
if (polytop > tmfloorz && abs(delta1) < abs(delta2)) delta1 = abs(thiscam->z - polymid);
delta2 = abs(thingtop - polymid);
if (polytop > tmfloorz && delta1 < delta2)
tmfloorz = tmdropoffz = polytop; tmfloorz = tmdropoffz = polytop;
if (polybottom < tmceilingz && abs(delta1) >= abs(delta2)) if (polybottom < tmceilingz && delta1 >= delta2)
tmceilingz = tmdrpoffceilz = polybottom; tmceilingz = tmdrpoffceilz = polybottom;
} }
plink = (polymaplink_t *)(plink->link.next); plink = (polymaplink_t *)(plink->link.next);
} }
} }
}
} }
// check lines // check lines
@@ -3202,32 +3219,46 @@ stairstep:
} }
do { do {
if (tmxmove > mo->radius) { if (tmxmove > mo->radius)
{
newx = mo->x + mo->radius; newx = mo->x + mo->radius;
tmxmove -= mo->radius; tmxmove -= mo->radius;
} else if (tmxmove < -mo->radius) { }
else if (tmxmove < -mo->radius)
{
newx = mo->x - mo->radius; newx = mo->x - mo->radius;
tmxmove += mo->radius; tmxmove += mo->radius;
} else { }
else
{
newx = mo->x + tmxmove; newx = mo->x + tmxmove;
tmxmove = 0; tmxmove = 0;
} }
if (tmymove > mo->radius) {
if (tmymove > mo->radius)
{
newy = mo->y + mo->radius; newy = mo->y + mo->radius;
tmymove -= mo->radius; tmymove -= mo->radius;
} else if (tmymove < -mo->radius) { }
else if (tmymove < -mo->radius)
{
newy = mo->y - mo->radius; newy = mo->y - mo->radius;
tmymove += mo->radius; tmymove += mo->radius;
} else { }
else
{
newy = mo->y + tmymove; newy = mo->y + tmymove;
tmymove = 0; tmymove = 0;
} }
if (!P_TryMove(mo, newx, newy, true)) {
if (!P_TryMove(mo, newx, newy, true))
{
if (success) if (success)
return; // Good enough!! return; // Good enough!!
else else
goto retry; goto retry;
} }
success = true; success = true;
} while(tmxmove || tmymove); } while(tmxmove || tmymove);
} }
@@ -3603,7 +3634,7 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
if (thing->subsector->sector->ffloors && (realcrush || thing->flags & MF_PUSHABLE)) if (thing->subsector->sector->ffloors && (realcrush || thing->flags & MF_PUSHABLE))
{ {
ffloor_t *rover; ffloor_t *rover;
fixed_t topheight, bottomheight; fixed_t topheight, bottomheight, midheight;
fixed_t delta1, delta2; fixed_t delta1, delta2;
INT32 thingtop = thing->z + thing->height; INT32 thingtop = thing->z + thing->height;
@@ -3615,10 +3646,12 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
topheight = *rover->topheight; topheight = *rover->topheight;
bottomheight = *rover->bottomheight; bottomheight = *rover->bottomheight;
midheight = ((bottomheight + topheight)/2);
delta1 = thing->z - (bottomheight + topheight)/2; delta1 = abs(thing->z - midheight);
delta2 = thingtop - (bottomheight + topheight)/2; delta2 = abs(thingtop - midheight);
if (bottomheight <= thing->ceilingz && abs(delta1) >= abs(delta2))
if (bottomheight <= thing->ceilingz && delta1 >= delta2)
{ {
if (thing->flags & MF_PUSHABLE) if (thing->flags & MF_PUSHABLE)
{ {
@@ -3667,6 +3700,7 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
killer = P_SpawnMobj(thing->x, thing->y, thing->z, MT_NULL); killer = P_SpawnMobj(thing->x, thing->y, thing->z, MT_NULL);
killer->threshold = 44; // Special flag for crushing killer->threshold = 44; // Special flag for crushing
} }
if (!thing->player) if (!thing->player)
P_DamageMobj(thing, killer, killer, DMG_INSTAKILL); P_DamageMobj(thing, killer, killer, DMG_INSTAKILL);
else else
@@ -3746,9 +3780,11 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
do do
{ {
for (n = sector->touching_thinglist; n; n = n->m_thinglist_next) // go through list for (n = sector->touching_thinglist; n; n = n->m_thinglist_next) // go through list
{
if (!n->visited) // unprocessed thing found if (!n->visited) // unprocessed thing found
{ {
n->visited = true; // mark thing as processed n->visited = true; // mark thing as processed
if (!(n->m_thing->flags & MF_NOBLOCKMAP)) //jff 4/7/98 don't do these if (!(n->m_thing->flags & MF_NOBLOCKMAP)) //jff 4/7/98 don't do these
{ {
if (!PIT_ChangeSector(n->m_thing, false)) // process it if (!PIT_ChangeSector(n->m_thing, false)) // process it
@@ -3757,8 +3793,10 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
return nofit; return nofit;
} }
} }
break; // exit and start over break; // exit and start over
} }
}
} while (n); // repeat from scratch until all things left are marked valid } while (n); // repeat from scratch until all things left are marked valid
// Nothing blocked us, so lets crush for real! // Nothing blocked us, so lets crush for real!
@@ -3780,15 +3818,18 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
do do
{ {
for (n = sec->touching_thinglist; n; n = n->m_thinglist_next) for (n = sec->touching_thinglist; n; n = n->m_thinglist_next)
if (!n->visited)
{ {
n->visited = true; if (!n->visited)
if (!(n->m_thing->flags & MF_NOBLOCKMAP))
{ {
PIT_ChangeSector(n->m_thing, true); n->visited = true;
return nofit;
if (!(n->m_thing->flags & MF_NOBLOCKMAP))
{
PIT_ChangeSector(n->m_thing, true);
return nofit;
}
break;
} }
break;
} }
} while (n); } while (n);
} }
@@ -3803,9 +3844,11 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
do do
{ {
for (n = sector->touching_thinglist; n; n = n->m_thinglist_next) // go through list for (n = sector->touching_thinglist; n; n = n->m_thinglist_next) // go through list
{
if (!n->visited) // unprocessed thing found if (!n->visited) // unprocessed thing found
{ {
n->visited = true; // mark thing as processed n->visited = true; // mark thing as processed
if (!(n->m_thing->flags & MF_NOBLOCKMAP)) //jff 4/7/98 don't do these if (!(n->m_thing->flags & MF_NOBLOCKMAP)) //jff 4/7/98 don't do these
{ {
PIT_ChangeSector(n->m_thing, true); // process it PIT_ChangeSector(n->m_thing, true); // process it
@@ -3813,6 +3856,7 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
} }
break; // exit and start over break; // exit and start over
} }
}
} while (n); // repeat from scratch until all things left are marked valid } while (n); // repeat from scratch until all things left are marked valid
return nofit; return nofit;
@@ -4087,7 +4131,7 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
for (rover = sec->ffloors; rover; rover = rover->next) for (rover = sec->ffloors; rover; rover = rover->next)
{ {
fixed_t topheight, bottomheight; fixed_t topheight, bottomheight, midheight;
if (!(rover->flags & FF_EXISTS)) if (!(rover->flags & FF_EXISTS))
continue; continue;
@@ -4105,13 +4149,16 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
if (floorz < z) if (floorz < z)
floorz = z; floorz = z;
} }
continue; continue;
} }
delta1 = z - (bottomheight + ((topheight - bottomheight)/2)); midheight = (bottomheight + ((topheight - bottomheight)/2));
delta2 = thingtop - (bottomheight + ((topheight - bottomheight)/2));
if (topheight > floorz && abs(delta1) < abs(delta2)) delta1 = abs(z - midheight);
delta2 = abs(thingtop - midheight);
if (topheight > floorz && delta1 < delta2)
floorz = topheight; floorz = topheight;
} }
} }
+1 -2
View File
@@ -18,7 +18,6 @@
#include <stdint.h> #include <stdint.h>
#include "qs22j.h" #include "qs22j.h"
#include "doomdef.h"
#define INSORTTHRESH 5 // if n < this use insertion sort #define INSORTTHRESH 5 // if n < this use insertion sort
// MUST be >= 2 // MUST be >= 2
@@ -89,7 +88,7 @@ static inline char *med3(char *a, char *b, char *c, int (*compar)(const void *,
void qs22j(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) void qs22j(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *))
{ {
// we have nothing to sort // we have nothing to sort
if (UNLIKELY(nmemb <= 1)) if (__builtin_expect(!!(nmemb <= 1), 0) ) //UNLIKELY - thx windoze
{ {
return; return;
} }
+1
View File
@@ -15,6 +15,7 @@
#ifndef __R_SKINS__ #ifndef __R_SKINS__
#define __R_SKINS__ #define __R_SKINS__
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
+118 -116
View File
@@ -1453,122 +1453,7 @@ void I_SleepDuration(precise_t duration)
#endif #endif
} }
#ifdef HAVE_THREADS static void I_PrintSignal(INT32 signal_num, boolean core_dumped, char *signal_msg);
#include "../core/thread_pool.h"
static std::thread::id g_main_thread_id;
#endif
boolean g_in_exiting_signal_handler = false;
static void I_PrintSignal(INT32 signal_num, boolean core_dumped, char *signal_msg)
{
const char *sigmsg;
switch (signal_num)
{
#ifdef SIGINT
case SIGINT:
sigmsg = ("SIGINT - SRB2Kart-Saturn was interrupted prematurely by the user.");
break;
#endif
case SIGILL: // illegal instruction - invalid function image
sigmsg = ("SIGILL - SRB2Kart-Saturn has attempted to execute an illegal instruction and needs to close.");
break;
case SIGFPE: // mathematical exception
sigmsg = ("SIGFPE - SRB2Kart-Saturn has encountered a mathematical exception and needs to close.");
break;
case SIGSEGV: // segment violation
sigmsg = ("SIGSEGV - SRB2Kart-Saturn has attempted to access a memory location that it shouldn't and needs to close.");
break;
#ifdef SIGTERM
case SIGTERM: // Software termination signal from kill
sigmsg = ("SIGTERM - SRB2Kart-Saturn was terminated by a kill signal.");
break;
#endif
#ifdef SIGBREAK
case SIGBREAK: // Ctrl-Break sequence
sigmsg =("SIGBREAK - SRB2Kart-Saturn was terminated by a Ctrl-Break sequence.")
break;
#endif
case SIGABRT: // abnormal termination triggered by abort call
sigmsg = ("SIGABRT - SRB2Kart-Saturn was terminated by an abort signal.");
break;
default:
sprintf(signal_msg, "Signal number %d", signal_num);
sigmsg = (core_dumped ? "Unknown signal" : signal_msg);
break;
}
if (core_dumped)
{
if (sigmsg)
sprintf(signal_msg, "%s (core dumped)", sigmsg);
else
strcat(signal_msg, " (core dumped)");
}
else
{
sprintf(signal_msg, "%s", sigmsg);
}
}
static void I_ReportSignal(int num, int coredumped)
{
char sigmsg[512];
I_PrintSignal(num, coredumped, sigmsg);
size_t len = strlen(sigmsg);
snprintf(sigmsg + len, sizeof(sigmsg) - len, "\n\nCrash report has been saved into %s", CRASH_LOGFILE_NAME);
I_OutputMsg("\nProcess killed by signal: %s\n\n", sigmsg);
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Process killed by signal", sigmsg, NULL);
}
#ifndef NEWSIGNALHANDLER
FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num)
{
g_in_exiting_signal_handler = true;
#ifdef HAVE_THREADS
if (g_main_thread_id != std::this_thread::get_id())
{
// Do not attempt any sort of recovery if this signal triggers off the main thread
signal(num, SIG_DFL);
raise(num);
exit(-2);
}
#endif
D_QuitNetGame(); // Fix server freezes
#ifdef HAVE_LIBBACKTRACE
write_backtrace(BT_CRASH_REASON_SIGNAL(num));
#endif
I_ReportSignal(num, 0);
I_ShutdownSystem();
signal(num, SIG_DFL); //default signal action
raise(num);
I_Quit();
}
#endif
FUNCNORETURN static ATTRNORETURN void quit_handler(int num)
{
#ifdef HAVE_THREADS
if (g_main_thread_id != std::this_thread::get_id())
{
// Do not attempt any sort of recovery if this signal triggers off the main thread
signal(num, SIG_DFL);
raise(num);
exit(-2);
}
#endif
signal(num, SIG_DFL); //default signal action
raise(num);
I_Quit();
}
#ifdef HAVE_LIBBACKTRACE #ifdef HAVE_LIBBACKTRACE
#include <backtrace.h> #include <backtrace.h>
@@ -1750,6 +1635,123 @@ static void write_backtrace(bt_crash_reason_t reason)
} }
#endif #endif
#ifdef HAVE_THREADS
#include "../core/thread_pool.h"
static std::thread::id g_main_thread_id;
#endif
boolean g_in_exiting_signal_handler = false;
static void I_PrintSignal(INT32 signal_num, boolean core_dumped, char *signal_msg)
{
const char *sigmsg;
switch (signal_num)
{
#ifdef SIGINT
case SIGINT:
sigmsg = ("SIGINT - SRB2Kart-Saturn was interrupted prematurely by the user.");
break;
#endif
case SIGILL: // illegal instruction - invalid function image
sigmsg = ("SIGILL - SRB2Kart-Saturn has attempted to execute an illegal instruction and needs to close.");
break;
case SIGFPE: // mathematical exception
sigmsg = ("SIGFPE - SRB2Kart-Saturn has encountered a mathematical exception and needs to close.");
break;
case SIGSEGV: // segment violation
sigmsg = ("SIGSEGV - SRB2Kart-Saturn has attempted to access a memory location that it shouldn't and needs to close.");
break;
#ifdef SIGTERM
case SIGTERM: // Software termination signal from kill
sigmsg = ("SIGTERM - SRB2Kart-Saturn was terminated by a kill signal.");
break;
#endif
#ifdef SIGBREAK
case SIGBREAK: // Ctrl-Break sequence
sigmsg =("SIGBREAK - SRB2Kart-Saturn was terminated by a Ctrl-Break sequence.");
break;
#endif
case SIGABRT: // abnormal termination triggered by abort call
sigmsg = ("SIGABRT - SRB2Kart-Saturn was terminated by an abort signal.");
break;
default:
sprintf(signal_msg, "Signal number %d", signal_num);
sigmsg = (core_dumped ? "Unknown signal" : signal_msg);
break;
}
if (core_dumped)
{
if (sigmsg)
sprintf(signal_msg, "%s (core dumped)", sigmsg);
else
strcat(signal_msg, " (core dumped)");
}
else
{
sprintf(signal_msg, "%s", sigmsg);
}
}
static void I_ReportSignal(int num, int coredumped)
{
char sigmsg[512];
I_PrintSignal(num, coredumped, sigmsg);
size_t len = strlen(sigmsg);
snprintf(sigmsg + len, sizeof(sigmsg) - len, "\n\nCrash report has been saved into %s", CRASH_LOGFILE_NAME);
I_OutputMsg("\nProcess killed by signal: %s\n\n", sigmsg);
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Process killed by signal", sigmsg, NULL);
}
#ifndef NEWSIGNALHANDLER
FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num)
{
g_in_exiting_signal_handler = true;
#ifdef HAVE_THREADS
if (g_main_thread_id != std::this_thread::get_id())
{
// Do not attempt any sort of recovery if this signal triggers off the main thread
signal(num, SIG_DFL);
raise(num);
exit(-2);
}
#endif
D_QuitNetGame(); // Fix server freezes
#ifdef HAVE_LIBBACKTRACE
write_backtrace(BT_CRASH_REASON_SIGNAL(num));
#endif
I_ReportSignal(num, 0);
I_ShutdownSystem();
signal(num, SIG_DFL); //default signal action
raise(num);
I_Quit();
}
#endif
FUNCNORETURN static ATTRNORETURN void quit_handler(int num)
{
#ifdef HAVE_THREADS
if (g_main_thread_id != std::this_thread::get_id())
{
// Do not attempt any sort of recovery if this signal triggers off the main thread
signal(num, SIG_DFL);
raise(num);
exit(-2);
}
#endif
signal(num, SIG_DFL); //default signal action
raise(num);
I_Quit();
}
static void I_RegisterSignals(void) static void I_RegisterSignals(void)
{ {
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
+5
View File
@@ -9,6 +9,9 @@
/// \file y_inter.h /// \file y_inter.h
/// \brief Tally screens, or "Intermissions" as they were formally called in Doom /// \brief Tally screens, or "Intermissions" as they were formally called in Doom
#ifndef __Y_INTER__
#define __Y_INTER__
extern boolean usebuffer; extern boolean usebuffer;
void Y_IntermissionDrawer(void); void Y_IntermissionDrawer(void);
@@ -90,3 +93,5 @@ typedef struct
patch_t *rubyicon; // encore ruby patch patch_t *rubyicon; // encore ruby patch
} votescreen_t; } votescreen_t;
extern votescreen_t VoteScreen; extern votescreen_t VoteScreen;
#endif // __Y_INTER__