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
25 changed files with 550 additions and 227 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
+103
View File
@@ -80,6 +80,14 @@ static poly_t *HWR_AllocPoly(INT32 numpts)
return p; return p;
} }
static polyvertex_t *HWR_AllocVertex(void)
{
polyvertex_t *p;
size_t size = sizeof(polyvertex_t);
p = Z_Malloc(size, PU_HWRPLANE, NULL);
return p;
}
/// \todo polygons should be freed in reverse order for efficiency, /// \todo polygons should be freed in reverse order for efficiency,
/// for now don't free because it doesn't free in reverse order /// for now don't free because it doesn't free in reverse order
static void HWR_FreePoly(poly_t *poly) static void HWR_FreePoly(poly_t *poly)
@@ -847,6 +855,100 @@ static INT32 SolveTProblem(void)
return numsplitpoly; return numsplitpoly;
} }
#define NEARDIST (0.75f)
#define MYMAX (10000000000000.0f)
/* Adjust true segs (from the segs lump) to be exactely the same as
* plane polygone segs
* This also convert fixed_t point of segs in float (in moste case
* it share the same vertice
*/
static void AdjustSegs(void)
{
size_t i, count;
INT32 j;
seg_t *lseg;
poly_t *p;
INT32 v1found = 0, v2found = 0;
float nearv1, nearv2;
for (i = 0; i < numsubsectors; i++)
{
count = subsectors[i].numlines;
lseg = &segs[subsectors[i].firstline];
p = extrasubsectors[i].planepoly;
if (!p)
continue;
for (; count--; lseg++)
{
float distv1,distv2,tmp;
nearv1 = nearv2 = MYMAX;
// Don't touch polyobject segs. We'll compensate
// for this when we go about drawing them.
if (lseg->polyseg)
continue;
for (j = 0; j < p->numpts; j++)
{
distv1 = p->pts[j].x - FIXED_TO_FLOAT(lseg->v1->x);
tmp = p->pts[j].y - FIXED_TO_FLOAT(lseg->v1->y);
distv1 = distv1*distv1+tmp*tmp;
if (distv1 <= nearv1)
{
v1found = j;
nearv1 = distv1;
}
// the same with v2
distv2 = p->pts[j].x - FIXED_TO_FLOAT(lseg->v2->x);
tmp = p->pts[j].y - FIXED_TO_FLOAT(lseg->v2->y);
distv2 = distv2*distv2+tmp*tmp;
if (distv2 <= nearv2)
{
v2found = j;
nearv2 = distv2;
}
}
if (nearv1 <= NEARDIST*NEARDIST)
// share vertice with segs
lseg->pv1 = &(p->pts[v1found]);
else
{
// BP: here we can do better, using PointInSeg and compute
// the right point position also split a polygone side to
// solve a T-intersection, but too mush work
// convert fixed vertex to float vertex
polyvertex_t *pv = HWR_AllocVertex();
pv->x = FIXED_TO_FLOAT(lseg->v1->x);
pv->y = FIXED_TO_FLOAT(lseg->v1->y);
lseg->pv1 = pv;
}
if (nearv2 <= NEARDIST*NEARDIST)
lseg->pv2 = &(p->pts[v2found]);
else
{
polyvertex_t *pv = HWR_AllocVertex();
pv->x = FIXED_TO_FLOAT(lseg->v2->x);
pv->y = FIXED_TO_FLOAT(lseg->v2->y);
lseg->pv2 = pv;
}
lseg->pv1->x2 = FloatToFixed(lseg->pv1->x);
lseg->pv1->y2 = FloatToFixed(lseg->pv1->y);
lseg->pv2->x2 = FloatToFixed(lseg->pv2->x);
lseg->pv2->y2 = FloatToFixed(lseg->pv2->y);
}
}
}
// call this routine after the BSP of a Doom wad file is loaded, // call this routine after the BSP of a Doom wad file is loaded,
// and it will generate all the convex polys for the hardware renderer // and it will generate all the convex polys for the hardware renderer
@@ -915,6 +1017,7 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
#else #else
SolveTProblem(); SolveTProblem();
#endif #endif
AdjustSegs();
#ifdef DEBUG_HWBSP #ifdef DEBUG_HWBSP
//debug debug.. //debug debug..
+88 -33
View File
@@ -729,9 +729,6 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
for (i = 0; i < subsector->numlines; i++, line++) for (i = 0; i < subsector->numlines; i++, line++)
{ {
if (line->polyseg)
continue;
line_t* ld = line->linedef; line_t* ld = line->linedef;
// this check sucks and is a hotspot lel // this check sucks and is a hotspot lel
@@ -744,11 +741,27 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
P_ClosestPointOnLine(viewx, viewy, ld, &v); P_ClosestPointOnLine(viewx, viewy, ld, &v);
dist = FixedToFloat(R_PointToDist(v.x, v.y)); dist = FixedToFloat(R_PointToDist(v.x, v.y));
x1 = (line->fv1.x); if (line->pv1)
y1 = (line->fv1.y); {
x1 = line->pv1->x;
y1 = line->pv1->y;
}
else
{
x1 = FixedToFloat(line->v1->x);
y1 = FixedToFloat(line->v1->y);
}
xd = (line->fv2.x) - x1; if (line->pv2)
yd = (line->fv2.y) - y1; {
xd = line->pv2->x - x1;
yd = line->pv2->y - y1;
}
else
{
xd = FixedToFloat(line->v2->x) - x1;
yd = FixedToFloat(line->v2->y) - y1;
}
// Based on the seg length and the distance from the line, split horizon into multiple poly sets to reduce distortion // Based on the seg length and the distance from the line, split horizon into multiple poly sets to reduce distortion
dist = sqrtf((xd*xd) + (yd*yd)) / dist / 16.0f; dist = sqrtf((xd*xd) + (yd*yd)) / dist / 16.0f;
@@ -812,11 +825,11 @@ static void HWR_DrawSegsSplats(FSurfaceInfo * pSurf)
M_ClearBox(segbbox); M_ClearBox(segbbox);
M_AddToBox(segbbox, M_AddToBox(segbbox,
FloatToFixed(gl_curline->fv1.x), FloatToFixed(gl_curline->pv1->x),
FloatToFixed(gl_curline->fv1.y)); FloatToFixed(gl_curline->pv1->y));
M_AddToBox(segbbox, M_AddToBox(segbbox,
FloatToFixed(gl_curline->fv2.x), FloatToFixed(gl_curline->pv2->x),
FloatToFixed(gl_curline->fv2.y)); FloatToFixed(gl_curline->pv2->y));
splat = (wallsplat_t *)gl_curline->linedef->splats; splat = (wallsplat_t *)gl_curline->linedef->splats;
for (; splat; splat = splat->next) for (; splat; splat = splat->next)
@@ -1311,24 +1324,34 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
const boolean noencore = (gl_linedef->flags & ML_TFERLINE); const boolean noencore = (gl_linedef->flags & ML_TFERLINE);
v1x = gl_curline->v1->x; if (LIKELY(gl_curline->pv1))
v1y = gl_curline->v1->y;
v2x = gl_curline->v2->x;
v2y = gl_curline->v2->y;
if (gl_curline->polyseg)
{ {
vs.x = FixedToFloat(v1x); vs.x = gl_curline->pv1->x;
vs.y = FixedToFloat(v1y); vs.y = gl_curline->pv1->y;
ve.x = FixedToFloat(v2x); v1x = gl_curline->pv1->x2;
ve.y = FixedToFloat(v2y); v1y = gl_curline->pv1->y2;
} }
else else
{ {
vs.x = gl_curline->fv1.x; vs.x = FixedToFloat(gl_curline->v1->x);
vs.y = gl_curline->fv1.y; vs.y = FixedToFloat(gl_curline->v1->y);
ve.x = gl_curline->fv2.x; v1x = gl_curline->v1->x;
ve.y = gl_curline->fv2.y; v1y = gl_curline->v1->y;
}
if (LIKELY(gl_curline->pv2))
{
ve.x = gl_curline->pv2->x;
ve.y = gl_curline->pv2->y;
v2x = gl_curline->pv2->x2;
v2y = gl_curline->pv2->y2;
}
else
{
ve.x = FixedToFloat(gl_curline->v2->x);
ve.y = FixedToFloat(gl_curline->v2->y);
v2x = gl_curline->v2->x;
v2y = gl_curline->v2->y;
} }
#define SLOPEPARAMS(slope, end1, end2, normalheight) \ #define SLOPEPARAMS(slope, end1, end2, normalheight) \
@@ -2180,11 +2203,27 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector)
{ {
fixed_t v1x, v1y, v2x, v2y; // the seg's vertexes as fixed_t fixed_t v1x, v1y, v2x, v2y; // the seg's vertexes as fixed_t
v1x = gl_curline->v1->x; if (LIKELY(gl_curline->pv1))
v1y = gl_curline->v1->y; {
v1x = gl_curline->pv1->x2;
v1y = gl_curline->pv1->y2;
}
else
{
v1x = gl_curline->v1->x;
v1y = gl_curline->v1->y;
}
v2x = gl_curline->v2->x; if (LIKELY(gl_curline->pv2))
v2y = gl_curline->v2->y; {
v2x = gl_curline->pv2->x2;
v2y = gl_curline->pv2->y2;
}
else
{
v2x = gl_curline->v2->x;
v2y = gl_curline->v2->y;
}
#define SLOPEPARAMS(slope, end1, end2, normalheight) \ #define SLOPEPARAMS(slope, end1, end2, normalheight) \
end1 = P_GetZAt(slope, v1x, v1y, normalheight); \ end1 = P_GetZAt(slope, v1x, v1y, normalheight); \
@@ -2389,11 +2428,27 @@ static void HWR_AddLine(seg_t *line)
gl_curline = line; gl_curline = line;
v1x = gl_curline->v1->x; if (LIKELY(gl_curline->pv1))
v1y = gl_curline->v1->y; {
v1x = gl_curline->pv1->x2;
v1y = gl_curline->pv1->y2;
}
else
{
v1x = gl_curline->v1->x;
v1y = gl_curline->v1->y;
}
v2x = gl_curline->v2->x; if (LIKELY(gl_curline->pv2))
v2y = gl_curline->v2->y; {
v2x = gl_curline->pv2->x2;
v2y = gl_curline->pv2->y2;
}
else
{
v2x = gl_curline->v2->x;
v2y = gl_curline->v2->y;
}
// OPTIMIZE: quickly reject orthogonal back sides. // OPTIMIZE: quickly reject orthogonal back sides.
angle1 = R_PointToAngle64(v1x, v1y); angle1 = R_PointToAngle64(v1x, v1y);
+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;
} }
} }
-11
View File
@@ -544,18 +544,7 @@ static void P_LoadSegs(UINT8 *data)
{ {
li->v1 = &vertexes[SHORT(ml->v1)]; li->v1 = &vertexes[SHORT(ml->v1)];
li->v2 = &vertexes[SHORT(ml->v2)]; li->v2 = &vertexes[SHORT(ml->v2)];
#ifdef HWRENDER
if (rendermode == render_opengl)
{
li->fv1.x = FixedToFloat(li->v1->x);
li->fv1.y = FixedToFloat(li->v1->y);
//li->fv1.z = FixedToFloat(li->v1->z); // z is unused in gl
li->fv2.x = FixedToFloat(li->v2->x);
li->fv2.y = FixedToFloat(li->v2->y);
//li->fv2.z = FixedToFloat(li->v2->z);
}
#endif
li->length = P_SegLength(li); li->length = P_SegLength(li);
li->angle = (SHORT(ml->angle))<<FRACBITS; li->angle = (SHORT(ml->angle))<<FRACBITS;
li->offset = (SHORT(ml->offset))<<FRACBITS; li->offset = (SHORT(ml->offset))<<FRACBITS;
+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;
} }
+4 -8
View File
@@ -114,11 +114,6 @@ typedef struct
fixed_t x, y, z; fixed_t x, y, z;
} vertex_t; } vertex_t;
typedef struct
{
float x, y/*, z*/;
} floatvertex_t;
// Forward of linedefs, for sectors. // Forward of linedefs, for sectors.
struct line_s; struct line_s;
@@ -548,11 +543,12 @@ typedef struct seg_s
sector_t *frontsector; sector_t *frontsector;
sector_t *backsector; sector_t *backsector;
fixed_t length; // precalculated seg length fixed_t length; // precalculated seg length
#ifdef HWRENDER #ifdef HWRENDER
floatvertex_t fv1; // new pointers so that AdjustSegs doesn't mess with v1/v2
floatvertex_t fv2; polyvertex_t *pv1;
polyvertex_t *pv2;
#endif #endif
polyobj_t *polyseg; polyobj_t *polyseg;
+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__