Compare commits

..
Author SHA1 Message Date
Alug 21920112ee a thousand curses upon you polyobjects! 2025-10-02 18:37:18 +02:00
Alug 9b7bf5e7d8 Merge remote-tracking branch 'origin/Saturn-Next' into deletglseg 2025-10-02 18:00:59 +02:00
Alug 524168b20b experiment: remove opengl adjusted segs
in theory this should improve levelload times and reduce memory usage?
gotta see if it really does, visually so far there seems to be no difference at all
2025-10-02 17:57:52 +02:00
25 changed files with 226 additions and 549 deletions

No files matched your search

+4 -4
View File
@@ -5,13 +5,13 @@
# met:
# (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
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# distribution.
# (3) The name of the author may not be used to
# endorse or promote products derived from this software without
# specific prior written permission.
@@ -26,4 +26,4 @@
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# POSSIBILITY OF SUCH DAMAGE.
+1 -11
View File
@@ -10,18 +10,8 @@ The libbacktrace library may be linked into a program or library and
used to produce symbolic backtraces.
Sample uses would be to print a detailed backtrace when an error
occurs or to gather detailed profiling information.
In general the functions provided by this library are async-signal-safe,
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.
See the source files for the exact license text.
@@ -35,7 +25,7 @@ will work.
See the source file backtrace-supported.h.in for the macros that it
defines.
As of July 2024, libbacktrace supports ELF, PE/COFF, Mach-O, and
As of October 2020, libbacktrace supports ELF, PE/COFF, Mach-O, and
XCOFF executables with DWARF debugging information.
In other words, it supports GNU/Linux, *BSD, macOS, Windows, and AIX.
The library is written to make it straightforward to add support for
Binary file not shown.
@@ -1,41 +0,0 @@
# 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'
@@ -1,41 +0,0 @@
# 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,13 +10,8 @@
/// \file b_bot.h
/// \brief Basic bot handling
#ifndef __B_BOT__
#define __B_BOT__
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);
boolean B_CheckRespawn(player_t *player);
void B_MoveBlocked(player_t *player);
void B_RespawnBot(INT32 playernum);
#endif
+1 -1
View File
@@ -1,4 +1,4 @@
// SONIC ROBO BLAST 2 KART
// BLANKART
//-----------------------------------------------------------------------------
// Copyright (C) 2024 by Ronald "Eidolon" Kinard
// Copyright (C) 2024 by Kart Krew
+1 -1
View File
@@ -1,4 +1,4 @@
// SONIC ROBO BLAST 2 KART
// BLANKART
//-----------------------------------------------------------------------------
// Copyright (C) 2024 by Ronald "Eidolon" Kinard
// Copyright (C) 2024 by Kart Krew
+1 -1
View File
@@ -1,4 +1,4 @@
// SONIC ROBO BLAST 2 KART
// BLANKART
//-----------------------------------------------------------------------------
// Copyright (C) 2024 by Ronald "Eidolon" Kinard
// Copyright (C) 2024 by Kart Krew
-5
View File
@@ -9,9 +9,6 @@
/// \file d_protocol.h
/// \brief srb2kart:// protocol stuff
#ifndef __D_PROTOCOL__
#define __D_PROTOCOL__
void D_SetupProtocol(void);
void D_CreateProtocol(void);
@@ -19,5 +16,3 @@ void D_DeleteProtocol(void);
#ifdef HAVE_CURL
void D_DownloadReplay(const char *url, const char *path);
#endif
#endif //__D_PROTOCOL__
+1 -4
View File
@@ -92,7 +92,7 @@ extern char logfilename[1024];
// not sure if this belongs here lul
// TODO: figure out whats preventing 32bit windows from working with libbacktrace
#if defined(_WIN32) && !defined(__MINGW64__)
#if defined(_WIN32) && !defined(MINGW64)
#define HAVE_DRMINGW
#endif
@@ -120,9 +120,6 @@ extern char logfilename[1024];
#define SUBVERSION 6 // more precise version number
#define VERSIONSTRING "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!
// And change CMakeLists.txt (not src/, but in root), for CMake users!
#endif
-103
View File
@@ -80,14 +80,6 @@ static poly_t *HWR_AllocPoly(INT32 numpts)
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,
/// for now don't free because it doesn't free in reverse order
static void HWR_FreePoly(poly_t *poly)
@@ -855,100 +847,6 @@ static INT32 SolveTProblem(void)
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,
// and it will generate all the convex polys for the hardware renderer
@@ -1017,7 +915,6 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
#else
SolveTProblem();
#endif
AdjustSegs();
#ifdef DEBUG_HWBSP
//debug debug..
+32 -87
View File
@@ -729,6 +729,9 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
for (i = 0; i < subsector->numlines; i++, line++)
{
if (line->polyseg)
continue;
line_t* ld = line->linedef;
// this check sucks and is a hotspot lel
@@ -741,27 +744,11 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
P_ClosestPointOnLine(viewx, viewy, ld, &v);
dist = FixedToFloat(R_PointToDist(v.x, v.y));
if (line->pv1)
{
x1 = line->pv1->x;
y1 = line->pv1->y;
}
else
{
x1 = FixedToFloat(line->v1->x);
y1 = FixedToFloat(line->v1->y);
}
x1 = (line->fv1.x);
y1 = (line->fv1.y);
if (line->pv2)
{
xd = line->pv2->x - x1;
yd = line->pv2->y - y1;
}
else
{
xd = FixedToFloat(line->v2->x) - x1;
yd = FixedToFloat(line->v2->y) - y1;
}
xd = (line->fv2.x) - x1;
yd = (line->fv2.y) - y1;
// 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;
@@ -825,11 +812,11 @@ static void HWR_DrawSegsSplats(FSurfaceInfo * pSurf)
M_ClearBox(segbbox);
M_AddToBox(segbbox,
FloatToFixed(gl_curline->pv1->x),
FloatToFixed(gl_curline->pv1->y));
FloatToFixed(gl_curline->fv1.x),
FloatToFixed(gl_curline->fv1.y));
M_AddToBox(segbbox,
FloatToFixed(gl_curline->pv2->x),
FloatToFixed(gl_curline->pv2->y));
FloatToFixed(gl_curline->fv2.x),
FloatToFixed(gl_curline->fv2.y));
splat = (wallsplat_t *)gl_curline->linedef->splats;
for (; splat; splat = splat->next)
@@ -1324,34 +1311,24 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
const boolean noencore = (gl_linedef->flags & ML_TFERLINE);
if (LIKELY(gl_curline->pv1))
{
vs.x = gl_curline->pv1->x;
vs.y = gl_curline->pv1->y;
v1x = gl_curline->pv1->x2;
v1y = gl_curline->pv1->y2;
}
else
{
vs.x = FixedToFloat(gl_curline->v1->x);
vs.y = FixedToFloat(gl_curline->v1->y);
v1x = gl_curline->v1->x;
v1y = gl_curline->v1->y;
}
v1x = gl_curline->v1->x;
v1y = gl_curline->v1->y;
v2x = gl_curline->v2->x;
v2y = gl_curline->v2->y;
if (LIKELY(gl_curline->pv2))
if (gl_curline->polyseg)
{
ve.x = gl_curline->pv2->x;
ve.y = gl_curline->pv2->y;
v2x = gl_curline->pv2->x2;
v2y = gl_curline->pv2->y2;
vs.x = FixedToFloat(v1x);
vs.y = FixedToFloat(v1y);
ve.x = FixedToFloat(v2x);
ve.y = FixedToFloat(v2y);
}
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;
vs.x = gl_curline->fv1.x;
vs.y = gl_curline->fv1.y;
ve.x = gl_curline->fv2.x;
ve.y = gl_curline->fv2.y;
}
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
@@ -2203,27 +2180,11 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector)
{
fixed_t v1x, v1y, v2x, v2y; // the seg's vertexes as fixed_t
if (LIKELY(gl_curline->pv1))
{
v1x = gl_curline->pv1->x2;
v1y = gl_curline->pv1->y2;
}
else
{
v1x = gl_curline->v1->x;
v1y = gl_curline->v1->y;
}
v1x = gl_curline->v1->x;
v1y = gl_curline->v1->y;
if (LIKELY(gl_curline->pv2))
{
v2x = gl_curline->pv2->x2;
v2y = gl_curline->pv2->y2;
}
else
{
v2x = gl_curline->v2->x;
v2y = gl_curline->v2->y;
}
v2x = gl_curline->v2->x;
v2y = gl_curline->v2->y;
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
end1 = P_GetZAt(slope, v1x, v1y, normalheight); \
@@ -2428,27 +2389,11 @@ static void HWR_AddLine(seg_t *line)
gl_curline = line;
if (LIKELY(gl_curline->pv1))
{
v1x = gl_curline->pv1->x2;
v1y = gl_curline->pv1->y2;
}
else
{
v1x = gl_curline->v1->x;
v1y = gl_curline->v1->y;
}
v1x = gl_curline->v1->x;
v1y = gl_curline->v1->y;
if (LIKELY(gl_curline->pv2))
{
v2x = gl_curline->pv2->x2;
v2y = gl_curline->pv2->y2;
}
else
{
v2x = gl_curline->v2->x;
v2y = gl_curline->v2->y;
}
v2x = gl_curline->v2->x;
v2y = gl_curline->v2->y;
// OPTIMIZE: quickly reject orthogonal back sides.
angle1 = R_PointToAngle64(v1x, v1y);
-5
View File
@@ -10,14 +10,9 @@
/// \file k_director.h
/// \brief SRB2kart automatic spectator camera.
#ifndef __K_DIRECTOR__
#define __K_DIRECTOR__
boolean K_DirectorIsAvailable(void);
void K_InitDirector(void);
void K_UpdateDirector(void);
void K_DrawDirectorDebugger(void);
void K_DirectorFollowAttack(player_t *player, mobj_t *inflictor, mobj_t *source);
void K_ToggleDirector(void);
#endif
-5
View File
@@ -10,9 +10,6 @@
/// \file lua_hook.h
/// \brief hooks for Lua scripting
#ifndef __LUA_HOOK__
#define __LUA_HOOK__
#include "r_defs.h"
#include "d_player.h"
#include "s_sound.h"
@@ -149,5 +146,3 @@ 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)
// to get maxresults use #result)
void LUA_HookSetupVote(INT16 result[], INT16 maxresults, UINT8 gt, UINT8 secondgt);
#endif //__LUA_HOOK__
-5
View File
@@ -10,9 +10,6 @@
/// \file lua_libs.h
/// \brief libraries for Lua scripting
#ifndef __LUA_LIBS__
#define __LUA_LIBS__
#include "doomtype.h"
#include "blua/lua.h"
@@ -76,5 +73,3 @@ int LUA_ThinkerLib(lua_State *L);
int LUA_MapLib(lua_State *L);
int LUA_BlockmapLib(lua_State *L);
int LUA_HudLib(lua_State *L);
#endif //__LUA_LIBS__
-5
View File
@@ -10,9 +10,6 @@
/// \file m_cond.h
/// \brief Unlockable condition system for SRB2 version 2.1
#ifndef __M_COND__
#define __M_COND__
#include "doomdef.h"
// --------
@@ -185,5 +182,3 @@ UINT8 M_GotLowEnoughTime(INT32 tictime);
//UINT8 M_GotHighEnoughRings(INT32 trings);
#define M_Achieved(a) ((a) >= MAXCONDITIONSETS || conditionSets[a].achieved)
#endif //__M_COND__
+2 -3
View File
@@ -1432,11 +1432,10 @@ 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 - 10*vid.dup, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, comprevision);
#else // Regular build
#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 - 20*vid.dup, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, comprevision); // Removeur this for release! im just lazy to make a new flag or smth
V_DrawThinString(vid.dup, vid.height - 10*vid.dup, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, va("%s", VERSIONSTRING));
#endif
#ifdef HWRENDER
if (rendermode == render_opengl)
V_DrawThinString(0, 0, V_GREENMAP|V_SNAPTOTOP|V_SNAPTOLEFT|V_TRANSLUCENT|V_ALLOWLOWERCASE, ("Opengl"));
+46 -93
View File
@@ -345,7 +345,6 @@ static boolean PIT_CheckThing(mobj_t *thing)
blockdist = thing->radius + tmthing->radius;
if (abs(thing->x - tmx) >= blockdist || abs(thing->y - tmy) >= blockdist)
return true; // didn't hit it
// see if it went over / under
if (tmthing->z > thing->z + thing->height)
return true; // overhead
@@ -1713,14 +1712,10 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
tmbbox[BOXRIGHT] = x + tmthing->radius;
tmbbox[BOXLEFT] = x - tmthing->radius;
if (thing->x != x || thing->y != y || !thing->subsector)
{
if (thing->x != x || thing->y != y || thing->subsector == NULL)
newsec = R_PointInSubsector(x, y)->sector;
}
else
{
newsec = thing->subsector->sector;
}
ceilingline = blockingline = NULL;
@@ -1813,17 +1808,17 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
midheight = (bottomheight + ((topheight - bottomheight)/2));
delta1 = abs(thing->z - midheight);
delta2 = abs(thingtop - midheight);
delta1 = thing->z - midheight;
delta2 = thingtop - midheight;
if (topheight > tmfloorz && delta1 < delta2
if (topheight > tmfloorz && abs(delta1) < abs(delta2)
&& !(rover->flags & FF_REVERSEPLATFORM))
{
tmfloorz = tmdropoffz = topheight;
tmfloorslope = *rover->t_slope;
}
if (bottomheight < tmceilingz && delta1 >= delta2
if (bottomheight < tmceilingz && abs(delta1) >= abs(delta2)
&& !(rover->flags & FF_PLATFORM)
&& !(thing->type == MT_SKIM && (rover->flags & FF_SWIMMABLE)))
{
@@ -1874,7 +1869,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
{
sector_t *polysec;
fixed_t delta1, delta2, thingtop;
fixed_t polytop, polybottom, polymid;
fixed_t polytop, polybottom;
po->validcount = validcount;
@@ -1900,24 +1895,21 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
}
thingtop = thing->z + thing->height;
polymid = (polybottom + ((polytop - polybottom)/2));
delta1 = thing->z - (polybottom + ((polytop - polybottom)/2));
delta2 = thingtop - (polybottom + ((polytop - polybottom)/2));
delta1 = abs(thing->z - polymid);
delta2 = abs(thingtop - polymid);
if (polytop > tmfloorz && delta1 < delta2)
if (polytop > tmfloorz && abs(delta1) < abs(delta2))
{
tmfloorz = tmdropoffz = polytop;
tmfloorslope = NULL;
}
if (polybottom < tmceilingz && delta1 >= delta2)
if (polybottom < tmceilingz && abs(delta1) >= abs(delta2))
{
tmceilingz = tmdrpoffceilz = polybottom;
tmceilingslope = NULL;
}
}
plink = (polymaplink_t *)(plink->link.next);
}
}
@@ -2002,14 +1994,10 @@ static boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
tmbbox[BOXRIGHT] = x + thiscam->radius;
tmbbox[BOXLEFT] = x - thiscam->radius;
if (thiscam->x != x || thiscam->y != y || !thiscam->subsector)
{
newsec = R_PointInSubsector(x, y)->sector;
}
if (thiscam->x != x || thiscam->y != y || thiscam->subsector == NULL)
newsec = R_PointInSubsectorFast(x, y)->sector;
else
{
newsec = thiscam->subsector->sector;
}
ceilingline = blockingline = NULL;
@@ -2054,25 +2042,24 @@ static boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
for (rover = newsec->ffloors; rover; rover = rover->next)
{
fixed_t topheight, bottomheight, midheight;
fixed_t topheight, bottomheight;
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;
topheight = P_CameraGetFOFTopZ(thiscam, newsec, rover, x, y, NULL);
bottomheight = P_CameraGetFOFBottomZ(thiscam, newsec, rover, x, y, NULL);
midheight = (bottomheight + ((topheight - bottomheight)/2));
delta1 = abs(thiscam->z - midheight);
delta2 = abs(thingtop - midheight);
delta1 = thiscam->z - (bottomheight
+ ((topheight - bottomheight)/2));
delta2 = thingtop - (bottomheight
+ ((topheight - bottomheight)/2));
if (topheight > tmfloorz && delta1 < delta2)
if (topheight > tmfloorz && abs(delta1) < abs(delta2))
{
tmfloorz = tmdropoffz = topheight;
}
if (bottomheight < tmceilingz && delta1 >= delta2)
if (bottomheight < tmceilingz && abs(delta1) >= abs(delta2))
{
tmceilingz = tmdrpoffceilz = bottomheight;
}
@@ -2098,7 +2085,6 @@ static boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
validcount++;
for (by = yl; by <= yh; by++)
{
for (bx = xl; bx <= xh; bx++)
{
INT32 offset;
@@ -2120,7 +2106,7 @@ static boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
{
sector_t *polysec;
fixed_t delta1, delta2, thingtop;
fixed_t polytop, polybottom, polymid;
fixed_t polytop, polybottom;
po->validcount = validcount;
@@ -2151,21 +2137,18 @@ static boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
}
thingtop = thiscam->z + thiscam->height;
polymid = (polybottom + ((polytop - polybottom)/2));
delta1 = thiscam->z - (polybottom + ((polytop - polybottom)/2));
delta2 = thingtop - (polybottom + ((polytop - polybottom)/2));
delta1 = abs(thiscam->z - polymid);
delta2 = abs(thingtop - polymid);
if (polytop > tmfloorz && delta1 < delta2)
if (polytop > tmfloorz && abs(delta1) < abs(delta2))
tmfloorz = tmdropoffz = polytop;
if (polybottom < tmceilingz && delta1 >= delta2)
if (polybottom < tmceilingz && abs(delta1) >= abs(delta2))
tmceilingz = tmdrpoffceilz = polybottom;
}
plink = (polymaplink_t *)(plink->link.next);
}
}
}
}
// check lines
@@ -3219,46 +3202,32 @@ stairstep:
}
do {
if (tmxmove > mo->radius)
{
if (tmxmove > mo->radius) {
newx = mo->x + mo->radius;
tmxmove -= mo->radius;
}
else if (tmxmove < -mo->radius)
{
} else if (tmxmove < -mo->radius) {
newx = mo->x - mo->radius;
tmxmove += mo->radius;
}
else
{
} else {
newx = mo->x + tmxmove;
tmxmove = 0;
}
if (tmymove > mo->radius)
{
if (tmymove > mo->radius) {
newy = mo->y + mo->radius;
tmymove -= mo->radius;
}
else if (tmymove < -mo->radius)
{
} else if (tmymove < -mo->radius) {
newy = mo->y - mo->radius;
tmymove += mo->radius;
}
else
{
} else {
newy = mo->y + tmymove;
tmymove = 0;
}
if (!P_TryMove(mo, newx, newy, true))
{
if (!P_TryMove(mo, newx, newy, true)) {
if (success)
return; // Good enough!!
else
goto retry;
}
success = true;
} while(tmxmove || tmymove);
}
@@ -3634,7 +3603,7 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
if (thing->subsector->sector->ffloors && (realcrush || thing->flags & MF_PUSHABLE))
{
ffloor_t *rover;
fixed_t topheight, bottomheight, midheight;
fixed_t topheight, bottomheight;
fixed_t delta1, delta2;
INT32 thingtop = thing->z + thing->height;
@@ -3646,12 +3615,10 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
midheight = ((bottomheight + topheight)/2);
delta1 = abs(thing->z - midheight);
delta2 = abs(thingtop - midheight);
if (bottomheight <= thing->ceilingz && delta1 >= delta2)
delta1 = thing->z - (bottomheight + topheight)/2;
delta2 = thingtop - (bottomheight + topheight)/2;
if (bottomheight <= thing->ceilingz && abs(delta1) >= abs(delta2))
{
if (thing->flags & MF_PUSHABLE)
{
@@ -3700,7 +3667,6 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
killer = P_SpawnMobj(thing->x, thing->y, thing->z, MT_NULL);
killer->threshold = 44; // Special flag for crushing
}
if (!thing->player)
P_DamageMobj(thing, killer, killer, DMG_INSTAKILL);
else
@@ -3780,11 +3746,9 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
do
{
for (n = sector->touching_thinglist; n; n = n->m_thinglist_next) // go through list
{
if (!n->visited) // unprocessed thing found
{
n->visited = true; // mark thing as processed
if (!(n->m_thing->flags & MF_NOBLOCKMAP)) //jff 4/7/98 don't do these
{
if (!PIT_ChangeSector(n->m_thing, false)) // process it
@@ -3793,10 +3757,8 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
return nofit;
}
}
break; // exit and start over
}
}
} while (n); // repeat from scratch until all things left are marked valid
// Nothing blocked us, so lets crush for real!
@@ -3818,18 +3780,15 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
do
{
for (n = sec->touching_thinglist; n; n = n->m_thinglist_next)
if (!n->visited)
{
if (!n->visited)
n->visited = true;
if (!(n->m_thing->flags & MF_NOBLOCKMAP))
{
n->visited = true;
if (!(n->m_thing->flags & MF_NOBLOCKMAP))
{
PIT_ChangeSector(n->m_thing, true);
return nofit;
}
break;
PIT_ChangeSector(n->m_thing, true);
return nofit;
}
break;
}
} while (n);
}
@@ -3844,11 +3803,9 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
do
{
for (n = sector->touching_thinglist; n; n = n->m_thinglist_next) // go through list
{
if (!n->visited) // unprocessed thing found
{
n->visited = true; // mark thing as processed
if (!(n->m_thing->flags & MF_NOBLOCKMAP)) //jff 4/7/98 don't do these
{
PIT_ChangeSector(n->m_thing, true); // process it
@@ -3856,7 +3813,6 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
}
break; // exit and start over
}
}
} while (n); // repeat from scratch until all things left are marked valid
return nofit;
@@ -4131,7 +4087,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)
{
fixed_t topheight, bottomheight, midheight;
fixed_t topheight, bottomheight;
if (!(rover->flags & FF_EXISTS))
continue;
@@ -4149,16 +4105,13 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
if (floorz < z)
floorz = z;
}
continue;
}
midheight = (bottomheight + ((topheight - bottomheight)/2));
delta1 = z - (bottomheight + ((topheight - bottomheight)/2));
delta2 = thingtop - (bottomheight + ((topheight - bottomheight)/2));
delta1 = abs(z - midheight);
delta2 = abs(thingtop - midheight);
if (topheight > floorz && delta1 < delta2)
if (topheight > floorz && abs(delta1) < abs(delta2))
floorz = topheight;
}
}
+11
View File
@@ -544,7 +544,18 @@ static void P_LoadSegs(UINT8 *data)
{
li->v1 = &vertexes[SHORT(ml->v1)];
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->angle = (SHORT(ml->angle))<<FRACBITS;
li->offset = (SHORT(ml->offset))<<FRACBITS;
+2 -1
View File
@@ -18,6 +18,7 @@
#include <stdint.h>
#include "qs22j.h"
#include "doomdef.h"
#define INSORTTHRESH 5 // if n < this use insertion sort
// MUST be >= 2
@@ -88,7 +89,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 *))
{
// we have nothing to sort
if (__builtin_expect(!!(nmemb <= 1), 0) ) //UNLIKELY - thx windoze
if (UNLIKELY(nmemb <= 1))
{
return;
}
+8 -4
View File
@@ -114,6 +114,11 @@ typedef struct
fixed_t x, y, z;
} vertex_t;
typedef struct
{
float x, y/*, z*/;
} floatvertex_t;
// Forward of linedefs, for sectors.
struct line_s;
@@ -543,12 +548,11 @@ typedef struct seg_s
sector_t *frontsector;
sector_t *backsector;
fixed_t length; // precalculated seg length
fixed_t length; // precalculated seg length
#ifdef HWRENDER
// new pointers so that AdjustSegs doesn't mess with v1/v2
polyvertex_t *pv1;
polyvertex_t *pv2;
floatvertex_t fv1;
floatvertex_t fv2;
#endif
polyobj_t *polyseg;
-1
View File
@@ -15,7 +15,6 @@
#ifndef __R_SKINS__
#define __R_SKINS__
#ifdef __cplusplus
extern "C" {
#endif
+116 -118
View File
@@ -1453,7 +1453,122 @@ void I_SleepDuration(precise_t duration)
#endif
}
static void I_PrintSignal(INT32 signal_num, boolean core_dumped, char *signal_msg);
#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();
}
#ifdef HAVE_LIBBACKTRACE
#include <backtrace.h>
@@ -1635,123 +1750,6 @@ static void write_backtrace(bt_crash_reason_t reason)
}
#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)
{
#ifdef HAVE_THREADS
-5
View File
@@ -9,9 +9,6 @@
/// \file y_inter.h
/// \brief Tally screens, or "Intermissions" as they were formally called in Doom
#ifndef __Y_INTER__
#define __Y_INTER__
extern boolean usebuffer;
void Y_IntermissionDrawer(void);
@@ -93,5 +90,3 @@ typedef struct
patch_t *rubyicon; // encore ruby patch
} votescreen_t;
extern votescreen_t VoteScreen;
#endif // __Y_INTER__