Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21920112ee | ||
|
|
9b7bf5e7d8 | ||
|
|
524168b20b |
No files matched your search
@@ -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.
|
||||
@@ -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'
|
||||
+1
-1
@@ -785,7 +785,7 @@ static void AM_drawPixel(INT32 xx, INT32 yy, INT32 cc)
|
||||
{
|
||||
if (xx < 0 || yy < 0 || xx >= f_w || yy >= f_h)
|
||||
return; // off the screen
|
||||
am_buf[(xx*f_h) + yy] = cc;
|
||||
am_buf[(yy*f_w) + xx] = cc;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -110,7 +110,7 @@ void I_Error(const char *error, ...)
|
||||
char logbuf[8192];
|
||||
|
||||
va_start(argptr, error);
|
||||
vsnprintf(logbuf, 8192, error, argptr);
|
||||
vsprintf(logbuf, error, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
LOGE(logbuf);
|
||||
@@ -166,7 +166,7 @@ void I_OutputMsg(const char *fmt, ...)
|
||||
char logbuf[8192];
|
||||
|
||||
va_start(argptr, fmt);
|
||||
vsnprintf(logbuf, 8192, fmt, argptr);
|
||||
vsprintf(logbuf, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
LOGD(logbuf);
|
||||
|
||||
@@ -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
|
||||
+12
-11
@@ -1650,13 +1650,13 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth)
|
||||
UINT8 *p = buf;
|
||||
if (!(server || (IsPlayerAdmin(consoleplayer))))
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, "Only the server or admin can change: %s %s\n", var->name, var->string);
|
||||
CONS_Printf(M_GetText("Only the server or admin can change: %s %s\n"), var->name, var->string);
|
||||
return;
|
||||
}
|
||||
|
||||
if (var == &cv_kartencore && !M_SecretUnlocked(SECRET_ENCORE))
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, "You haven't unlocked Encore Mode yet!\n");
|
||||
CONS_Printf(M_GetText("You haven't unlocked Encore Mode yet!\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1664,7 +1664,7 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth)
|
||||
{
|
||||
if (!stricmp(value, "Hard") || atoi(value) == 2)
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, "You haven't unlocked this yet!\n");
|
||||
CONS_Printf(M_GetText("You haven't unlocked this yet!\n"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1681,13 +1681,14 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth)
|
||||
else
|
||||
Setvalue(var, value, stealth);
|
||||
}
|
||||
else if ((var->flags & CV_NOTINNET) && netgame)
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, "This variable can't be changed while in netgame: %s %s\n", var->name, var->string);
|
||||
return;
|
||||
}
|
||||
else
|
||||
Setvalue(var, value, stealth);
|
||||
if ((var->flags & CV_NOTINNET) && netgame)
|
||||
{
|
||||
CONS_Printf(M_GetText("This variable can't be changed while in netgame: %s %s\n"), var->name, var->string);
|
||||
return;
|
||||
}
|
||||
else
|
||||
Setvalue(var, value, stealth);
|
||||
}
|
||||
|
||||
/** Sets a value to a variable without calling its callback function.
|
||||
@@ -1770,7 +1771,7 @@ void CV_AddValue(consvar_t *var, INT32 increment)
|
||||
newvalue = var->value - 1;
|
||||
do
|
||||
{
|
||||
if (increment > 0) // Going up!
|
||||
if(increment > 0) // Going up!
|
||||
{
|
||||
if (++newvalue == NUMMAPS)
|
||||
newvalue = -1;
|
||||
@@ -1784,7 +1785,7 @@ void CV_AddValue(consvar_t *var, INT32 increment)
|
||||
if (newvalue == oldvalue)
|
||||
break; // don't loop forever if there's none of a certain gametype
|
||||
|
||||
if (newvalue >= 0 && !mapheaderinfo[newvalue])
|
||||
if(!mapheaderinfo[newvalue])
|
||||
continue; // Don't allocate the header. That just makes memory usage skyrocket.
|
||||
|
||||
} while (!M_CanShowLevelInList(newvalue, gt));
|
||||
|
||||
+2
-2
@@ -1282,7 +1282,7 @@ void CONS_Alert(alerttype_t level, const char *fmt, ...)
|
||||
txt = malloc(8192);
|
||||
|
||||
va_start(argptr, fmt);
|
||||
vsnprintf(txt, 8192, fmt, argptr);
|
||||
vsprintf(txt, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
switch (level)
|
||||
@@ -1318,7 +1318,7 @@ void CONS_Debug(INT32 debugflags, const char *fmt, ...)
|
||||
txt = malloc(8192);
|
||||
|
||||
va_start(argptr, fmt);
|
||||
vsnprintf(txt, 8192, fmt, argptr);
|
||||
vsprintf(txt, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
// Again I am lazy, oh well
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// SONIC ROBO BLAST 2 KART
|
||||
// BLANKART
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2024 by Ronald "Eidolon" Kinard
|
||||
// Copyright (C) 2024 by Kart Krew
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// SONIC ROBO BLAST 2 KART
|
||||
// BLANKART
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2024 by Ronald "Eidolon" Kinard
|
||||
// Copyright (C) 2024 by Kart Krew
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// SONIC ROBO BLAST 2 KART
|
||||
// BLANKART
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2024 by Ronald "Eidolon" Kinard
|
||||
// Copyright (C) 2024 by Kart Krew
|
||||
|
||||
@@ -4161,10 +4161,7 @@ static void Joinable_OnChange(void)
|
||||
UINT8 maxplayer;
|
||||
|
||||
if (!server)
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, ("Only the server can change: %s %s\n"), cv_allownewplayer.name, cv_allownewplayer.string);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef SATURNJOIN
|
||||
// disabling joins should also disable saturn joins unless its called with CV_StealthSet and vice versa to make life a bit easier
|
||||
|
||||
+8
-3
@@ -609,7 +609,7 @@ static boolean D_Display(void)
|
||||
{
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
VID_BlitLinearScreen(vid.screens[0], vid.screens[1], vid.width, vid.height, vid.height, vid.height);
|
||||
VID_BlitLinearScreen(vid.screens[0], vid.screens[1], vid.width, vid.height, vid.width, vid.width);
|
||||
}
|
||||
|
||||
lastdraw = false;
|
||||
@@ -774,7 +774,6 @@ void D_SRB2Loop(void)
|
||||
precise_t capbudget;
|
||||
precise_t enterprecise = I_GetPreciseTime();
|
||||
|
||||
memset(&g_dc, 0, sizeof(g_dc));
|
||||
Z_Frame_Reset();
|
||||
|
||||
// Casting the return value of a function is bad practice (apparently)
|
||||
@@ -890,6 +889,12 @@ void D_SRB2Loop(void)
|
||||
// always update console and hud
|
||||
// otherwise it may take minutes to open it
|
||||
CON_Drawer();
|
||||
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
ST_Drawer();
|
||||
HU_Drawer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1021,7 +1026,7 @@ void D_ClearState(void)
|
||||
S_StopSounds();
|
||||
S_ResetKeepAndSpecialMus(); // just in case
|
||||
|
||||
//P_FreeLevelState();
|
||||
P_FreeLevelState();
|
||||
|
||||
G_SetGamestate(GS_NULL);
|
||||
wipegamestate = GS_NULL;
|
||||
|
||||
@@ -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__
|
||||
@@ -1468,7 +1468,7 @@ void I_Error(const char *error, ...)
|
||||
if (errorcount > 20)
|
||||
{
|
||||
va_start(argptr, error);
|
||||
vsnprintf(buffer, 8192, error, argptr);
|
||||
vsprintf(buffer, error, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
I_OutputMsg("SRB2Kart %s Recursive Error", buffer);
|
||||
@@ -1482,7 +1482,7 @@ void I_Error(const char *error, ...)
|
||||
|
||||
// Display error message in the console before we start shutting it down
|
||||
va_start(argptr, error);
|
||||
vsnprintf(buffer, 8192, error, argptr);
|
||||
vsprintf(buffer, error, argptr);
|
||||
va_end(argptr);
|
||||
I_OutputMsg("\nI_Error(): %s\n", buffer);
|
||||
|
||||
|
||||
+1
-4
@@ -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
|
||||
|
||||
+10
-10
@@ -249,16 +249,16 @@ static void F_DoWipe(fademask_t *fademask)
|
||||
draw_linestart = scrypos[masky];
|
||||
draw_lineend = scrypos[masky + 1];
|
||||
|
||||
relativepos = (draw_rowstart * vid.height) + draw_linestart;
|
||||
draw_linestogo = draw_rowend - draw_rowstart;
|
||||
relativepos = (draw_linestart * vid.width) + draw_rowstart;
|
||||
draw_linestogo = draw_lineend - draw_linestart;
|
||||
|
||||
if (*mask == 0)
|
||||
{
|
||||
// shortcut - memcpy source to work
|
||||
while (draw_linestogo--)
|
||||
{
|
||||
M_Memcpy(w_base+relativepos, s_base+relativepos, draw_lineend-draw_linestart);
|
||||
relativepos += vid.height;
|
||||
M_Memcpy(w_base+relativepos, s_base+relativepos, draw_rowend-draw_rowstart);
|
||||
relativepos += vid.width;
|
||||
}
|
||||
}
|
||||
else if (*mask == 10)
|
||||
@@ -266,8 +266,8 @@ static void F_DoWipe(fademask_t *fademask)
|
||||
// shortcut - memcpy target to work
|
||||
while (draw_linestogo--)
|
||||
{
|
||||
M_Memcpy(w_base+relativepos, e_base+relativepos, draw_lineend-draw_linestart);
|
||||
relativepos += vid.height;
|
||||
M_Memcpy(w_base+relativepos, e_base+relativepos, draw_rowend-draw_rowstart);
|
||||
relativepos += vid.width;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -281,12 +281,12 @@ static void F_DoWipe(fademask_t *fademask)
|
||||
w = w_base + relativepos;
|
||||
s = s_base + relativepos;
|
||||
e = e_base + relativepos;
|
||||
draw_rowstogo = draw_lineend - draw_linestart;
|
||||
draw_rowstogo = draw_rowend - draw_rowstart;
|
||||
|
||||
while (draw_rowstogo--)
|
||||
*w++ = transtbl[ ( *e++ << 8 ) + *s++ ];
|
||||
|
||||
relativepos += vid.height;
|
||||
relativepos += vid.width;
|
||||
}
|
||||
// END DRAWING LOOP
|
||||
}
|
||||
@@ -314,7 +314,7 @@ void F_WipeStartScreen(void)
|
||||
}
|
||||
#endif
|
||||
wipe_scr_start = vid.screens[3];
|
||||
M_Memcpy(wipe_scr_start, vid.screens[0], vid.width*vid.height);
|
||||
I_ReadScreen(wipe_scr_start, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ void F_WipeEndScreen(void)
|
||||
}
|
||||
#endif
|
||||
wipe_scr_end = vid.screens[4];
|
||||
M_Memcpy(wipe_scr_end, vid.screens[0], vid.width*vid.height);
|
||||
I_ReadScreen(wipe_scr_end, 1);
|
||||
V_DrawBlock(0, 0, 0, vid.width, vid.height, wipe_scr_start);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -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
@@ -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);
|
||||
|
||||
+74
-85
@@ -2540,91 +2540,17 @@ Ping_conversion (UINT32 lag)
|
||||
// HU_drawPing
|
||||
//
|
||||
|
||||
static void HU_drawOldPing(INT32 x, INT32 y, UINT32 lag, INT32 flags, boolean gentleman)
|
||||
{
|
||||
const INT32 measureid = cv_pingmeasurement.value ? 1 : 0;
|
||||
|
||||
if (vid.width >= 640) // how sad, we're using a shit resolution.
|
||||
{
|
||||
if (measureid == 1)
|
||||
{
|
||||
V_DrawRightAlignedSmallString(x+12, y+13, V_ALLOWLOWERCASE|flags, va("%dms", Ping_conversion(lag)));
|
||||
}
|
||||
else if (measureid == 0)
|
||||
{
|
||||
V_DrawRightAlignedSmallString(x+12, y+13, flags, va("d%d", Ping_conversion(lag)));
|
||||
}
|
||||
}
|
||||
|
||||
if (cv_pingicon.value)
|
||||
{
|
||||
UINT8 numbars = 0; // how many ping bars do we draw?
|
||||
UINT8 barcolor = 31; // color we use for the bars (green, yellow, red or black)
|
||||
SINT8 i = 0;
|
||||
SINT8 yoffset = 6;
|
||||
|
||||
switch (lag)
|
||||
{
|
||||
case 0 ... 1:
|
||||
numbars = 3;
|
||||
barcolor = 215; // Blue
|
||||
break;
|
||||
case 2 ... 3:
|
||||
numbars = 3;
|
||||
barcolor = 184; // Green
|
||||
break;
|
||||
case 4 ... 6:
|
||||
numbars = 2; // Apparently ternaries w/ multiple statements don't look good in C so I decided against it.
|
||||
barcolor = 103; // Yellow
|
||||
break;
|
||||
case 7 ... 9:
|
||||
numbars = 1;
|
||||
barcolor = 155; // Red
|
||||
break;
|
||||
default: // Brazil
|
||||
numbars = 0;
|
||||
barcolor = 31; // black
|
||||
break;
|
||||
}
|
||||
|
||||
if (gentleman)
|
||||
{
|
||||
barcolor = 194; // make it purplish
|
||||
// bars get indirectly set earlier
|
||||
}
|
||||
|
||||
for (i = 0; (i < 3); i++) // Draw the ping bar
|
||||
{
|
||||
V_DrawFill(x+2 *(i-1)+7, y+8+yoffset-4, 2, 8-yoffset, 31|flags);
|
||||
if (i < numbars)
|
||||
V_DrawFill(x+2 *(i-1)+7, y+8+yoffset-3, 1, 8-yoffset-1, barcolor|flags);
|
||||
|
||||
yoffset -= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void HU_drawKartPing(INT32 x, INT32 y, UINT32 lag, INT32 flags, boolean gentleman)
|
||||
{
|
||||
const INT32 measureid = cv_pingmeasurement.value ? 1 : 0;
|
||||
|
||||
if (measureid == 1)
|
||||
V_DrawScaledPatch(x+11 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
|
||||
|
||||
if (cv_pingicon.value)
|
||||
{
|
||||
INT32 gfxnum = Ping_gfx_num(lag); // gfx to draw
|
||||
V_DrawScaledPatch(x+2, y, flags, pinggfx[gfxnum]);
|
||||
}
|
||||
|
||||
x = V_DrawPingNum(x + (measureid == 1 ? 11 - pingmeasure[measureid]->width : 10), y+9, flags, Ping_conversion(lag), Ping_gfx_colormap(lag, gentleman));
|
||||
|
||||
if (measureid == 0)
|
||||
V_DrawScaledPatch(x+1 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
|
||||
}
|
||||
|
||||
void HU_drawPlayerPing(INT32 x, INT32 y, INT32 pnum, INT32 flags)
|
||||
{
|
||||
INT32 measureid = cv_pingmeasurement.value ? 1 : 0;
|
||||
INT32 gfxnum; // gfx to draw
|
||||
|
||||
//SRB2/Kart v1.0 style
|
||||
UINT8 numbars = 0; // how many ping bars do we draw?
|
||||
UINT8 barcolor = 31; // color we use for the bars (green, yellow, red or black)
|
||||
SINT8 i = 0;
|
||||
SINT8 yoffset = 6;
|
||||
|
||||
UINT32 lag = playerpingtable[pnum];
|
||||
const boolean gentleman = (cv_mindelay.value && (lag < (tic_t)simulated_lag));
|
||||
|
||||
@@ -2635,11 +2561,74 @@ void HU_drawPlayerPing(INT32 x, INT32 y, INT32 pnum, INT32 flags)
|
||||
|
||||
if (cv_pingstyle.value == 0) // kart
|
||||
{
|
||||
HU_drawKartPing(x, y, lag, flags, gentleman);
|
||||
gfxnum = Ping_gfx_num(lag);
|
||||
|
||||
if (measureid == 1)
|
||||
V_DrawScaledPatch(x+11 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
|
||||
|
||||
if (cv_pingicon.value)
|
||||
V_DrawScaledPatch(x+2, y, flags, pinggfx[gfxnum]);
|
||||
|
||||
x = V_DrawPingNum(x + (measureid == 1 ? 11 - pingmeasure[measureid]->width : 10), y+9, flags, Ping_conversion(lag), Ping_gfx_colormap(lag, gentleman));
|
||||
|
||||
if (measureid == 0)
|
||||
V_DrawScaledPatch(x+1 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
|
||||
}
|
||||
else if (cv_pingstyle.value == 1) // old style ping
|
||||
{
|
||||
HU_drawOldPing(x, y, lag, flags, gentleman);
|
||||
if (vid.width >= 640) // how sad, we're using a shit resolution.
|
||||
{
|
||||
if (measureid == 1)
|
||||
{
|
||||
V_DrawRightAlignedSmallString(x+12, y+13, V_ALLOWLOWERCASE|flags, va("%dms", Ping_conversion(lag)));
|
||||
}
|
||||
else if (measureid == 0)
|
||||
{
|
||||
V_DrawRightAlignedSmallString(x+12, y+13, flags, va("d%d", Ping_conversion(lag)));
|
||||
}
|
||||
}
|
||||
|
||||
if (cv_pingicon.value)
|
||||
{
|
||||
switch (lag)
|
||||
{
|
||||
case 0 ... 1:
|
||||
numbars = 3;
|
||||
barcolor = 215; // Blue
|
||||
break;
|
||||
case 2 ... 3:
|
||||
numbars = 3;
|
||||
barcolor = 184; // Green
|
||||
break;
|
||||
case 4 ... 6:
|
||||
numbars = 2; // Apparently ternaries w/ multiple statements don't look good in C so I decided against it.
|
||||
barcolor = 103; // Yellow
|
||||
break;
|
||||
case 7 ... 9:
|
||||
numbars = 1;
|
||||
barcolor = 155; // Red
|
||||
break;
|
||||
default: // Brazil
|
||||
numbars = 0;
|
||||
barcolor = 31; // black
|
||||
break;
|
||||
}
|
||||
|
||||
if (gentleman)
|
||||
{
|
||||
barcolor = 194; // make it purplish
|
||||
// bars get indirectly set earlier
|
||||
}
|
||||
|
||||
for (i = 0; (i < 3); i++) // Draw the ping bar
|
||||
{
|
||||
V_DrawFill(x+2 *(i-1)+7, y+8+yoffset-4, 2, 8-yoffset, 31|flags);
|
||||
if (i < numbars)
|
||||
V_DrawFill(x+2 *(i-1)+7, y+8+yoffset-3, 1, 8-yoffset-1, barcolor|flags);
|
||||
|
||||
yoffset -= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -1,14 +1,3 @@
|
||||
// SONIC ROBO BLAST 2 KART SATURN
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2025 by Indev.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file k_stats.c
|
||||
/// \brief Game statistics handling
|
||||
|
||||
#include "k_stats.h"
|
||||
#include "doomstat.h"
|
||||
#include "g_game.h"
|
||||
|
||||
@@ -1,14 +1,3 @@
|
||||
// SONIC ROBO BLAST 2 KART SATURN
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2025 by Indev.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file k_stats.h
|
||||
/// \brief Game statistics handling
|
||||
|
||||
#ifndef __K_STATS__
|
||||
#define __K_STATS__
|
||||
|
||||
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -1,14 +1,3 @@
|
||||
// SONIC ROBO BLAST 2 KART SATURN
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2025 by Indev.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file lua_udatalib.c
|
||||
/// \brief Implementation of lua userdata object metatables based on getter/setter functions
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "m_fixed.h"
|
||||
#include "lua_udatalib.h"
|
||||
|
||||
+1
-12
@@ -1,14 +1,3 @@
|
||||
// SONIC ROBO BLAST 2 KART SATURN
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2025 by Indev.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file lua_udatalib.h
|
||||
/// \brief Implementation of lua userdata object metatables based on getter/setter functions
|
||||
|
||||
#ifndef __LUA_UDATALIB_H__
|
||||
#define __LUA_UDATALIB_H__
|
||||
|
||||
@@ -111,4 +100,4 @@ void udatalib_addfields(lua_State *L, int mt, const udata_field_t fields[]);
|
||||
return 0; \
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -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__
|
||||
@@ -1,14 +1,3 @@
|
||||
// SONIC ROBO BLAST 2 KART SATURN
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2025 by Indev.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file m_curl.c
|
||||
/// \brief Common curl-related functions shared across http-mserv and file download
|
||||
|
||||
#include "m_curl.h"
|
||||
#include "doomtype.h"
|
||||
#include "i_system.h" // I_OutputMsg
|
||||
|
||||
@@ -1,14 +1,3 @@
|
||||
// SONIC ROBO BLAST 2 KART SATURN
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2025 by Indev.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file m_curl.h
|
||||
/// \brief Common curl-related functions shared across http-mserv and file download
|
||||
|
||||
#ifndef __M_CURL__
|
||||
#define __M_CURL__
|
||||
|
||||
|
||||
@@ -1,14 +1,3 @@
|
||||
// SONIC ROBO BLAST 2 KART SATURN
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2025 by Indev.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file m_emotes.cpp
|
||||
/// \brief Chat emotes handling
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
@@ -1,14 +1,3 @@
|
||||
// SONIC ROBO BLAST 2 KART SATURN
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2025 by Indev.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file m_emotes.h
|
||||
/// \brief Chat emotes handling
|
||||
|
||||
#ifndef __M_EMOTES__
|
||||
#define __M_EMOTES__
|
||||
|
||||
|
||||
+4
-9
@@ -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"));
|
||||
@@ -2713,10 +2712,6 @@ static void M_PrepareLevelSelect(void)
|
||||
//
|
||||
boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt)
|
||||
{
|
||||
// invalid mapnum
|
||||
if (mapnum < -1)
|
||||
return false;
|
||||
|
||||
// Random map!
|
||||
if (mapnum == -1)
|
||||
return (gamestate != GS_TIMEATTACK && !modeattacking);
|
||||
@@ -7224,7 +7219,7 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
|
||||
if (i == oldval)
|
||||
return;
|
||||
|
||||
if (i >= 0 && !mapheaderinfo[i])
|
||||
if(!mapheaderinfo[i])
|
||||
continue; // Don't allocate the header. That just makes memory usage skyrocket.
|
||||
|
||||
} while (!M_CanShowLevelInList(i, cv_newgametype.value));
|
||||
@@ -7262,7 +7257,7 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
|
||||
if (i == oldval)
|
||||
return;
|
||||
|
||||
if (i >= 0 && !mapheaderinfo[i])
|
||||
if(!mapheaderinfo[i])
|
||||
continue; // Don't allocate the header. That just makes memory usage skyrocket.
|
||||
|
||||
} while (!M_CanShowLevelInList(i, cv_newgametype.value));
|
||||
|
||||
@@ -1,14 +1,3 @@
|
||||
// SONIC ROBO BLAST 2 KART SATURN
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2025 by Indev.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file m_textinput.c
|
||||
/// \brief User text input implementation
|
||||
|
||||
#include "m_textinput.h"
|
||||
#include "m_menu.h" // MAXSTRINGLENGTH
|
||||
#include "v_video.h"
|
||||
|
||||
@@ -1,14 +1,3 @@
|
||||
// SONIC ROBO BLAST 2 KART SATURN
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2025 by Indev.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file m_textinput.h
|
||||
/// \brief User text input implementation
|
||||
|
||||
#ifndef __M_TEXTINPUT__
|
||||
#define __M_TEXTINPUT__
|
||||
|
||||
|
||||
+46
-93
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
@@ -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;
|
||||
}
|
||||
|
||||
+76
-113
@@ -94,7 +94,7 @@ static UINT32 **texturecolumnofs; // column offset lookup table for each texture
|
||||
UINT8 **texturecache; // graphics data for each generated full-size texture
|
||||
|
||||
// texture width is a power of 2, so it can easily repeat along sidedefs using a simple mask
|
||||
static INT32 *texturewidth;
|
||||
static INT32 *texturewidthmask;
|
||||
|
||||
fixed_t *textureheight; // needed for texture pegging
|
||||
|
||||
@@ -241,12 +241,11 @@ static INT32 tidcachelen = 0;
|
||||
// R_DrawColumnInCache
|
||||
// Clip and draw a column from a patch into a cached post.
|
||||
//
|
||||
static inline void R_DrawColumnInCache(column_t *patch, UINT8 *cache, texpatch_t *originPatch, INT32 cacheheight)
|
||||
static inline void R_DrawColumnInCache(column_t *patch, UINT8 *cache, INT32 originy, INT32 cacheheight)
|
||||
{
|
||||
INT32 count, position;
|
||||
UINT8 *source;
|
||||
INT32 topdelta, prevdelta = -1;
|
||||
INT32 originy = originPatch->originy;
|
||||
|
||||
while (patch->topdelta != 0xff)
|
||||
{
|
||||
@@ -261,7 +260,6 @@ static inline void R_DrawColumnInCache(column_t *patch, UINT8 *cache, texpatch_t
|
||||
if (position < 0)
|
||||
{
|
||||
count += position;
|
||||
source -= position; // start further down the column
|
||||
position = 0;
|
||||
}
|
||||
|
||||
@@ -275,50 +273,6 @@ static inline void R_DrawColumnInCache(column_t *patch, UINT8 *cache, texpatch_t
|
||||
}
|
||||
}
|
||||
|
||||
static UINT8 *R_AllocateTextureBlock(size_t blocksize, UINT8 **user)
|
||||
{
|
||||
texturememory += blocksize;
|
||||
|
||||
return Z_Malloc(blocksize, PU_LEVEL, user);
|
||||
}
|
||||
|
||||
static UINT8 *R_AllocateDummyTextureBlock(size_t width, UINT8 **user)
|
||||
{
|
||||
// Allocate dummy data. Keep 4-bytes aligned.
|
||||
// Column offsets will be initialized to 0, which points to the 0xff byte (empty column flag).
|
||||
size_t blocksize = 4 + (width * 4);
|
||||
UINT8 *block = R_AllocateTextureBlock(blocksize, user);
|
||||
|
||||
memset(block, 0, blocksize);
|
||||
block[0] = 0xff;
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
static boolean R_CheckTextureLumpLength(texture_t *texture, size_t patch)
|
||||
{
|
||||
UINT16 wadnum = texture->patches[patch].wad;
|
||||
UINT16 lumpnum = texture->patches[patch].lump;
|
||||
size_t lumplength = W_LumpLengthPwad(wadnum, lumpnum);
|
||||
|
||||
// The header does not exist
|
||||
if (lumplength < offsetof(softwarepatch_t, columnofs))
|
||||
{
|
||||
CONS_Alert(
|
||||
CONS_ERROR,
|
||||
"%.8s: texture lump data is too small. Expected %s bytes, got %s. (%s)\n",
|
||||
texture->name,
|
||||
sizeu1(offsetof(softwarepatch_t, columnofs)),
|
||||
sizeu2(lumplength),
|
||||
wadfiles[wadnum]->lumpinfo[lumpnum].fullname
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// R_GenerateTexture
|
||||
//
|
||||
@@ -343,10 +297,6 @@ UINT8 *R_GenerateTexture(size_t texnum)
|
||||
column_t *patchcol;
|
||||
UINT8 *colofs;
|
||||
|
||||
UINT16 wadnum;
|
||||
lumpnum_t lumpnum;
|
||||
size_t lumplength;
|
||||
|
||||
I_Assert(texnum <= (size_t)numtextures);
|
||||
texture = textures[texnum];
|
||||
I_Assert(texture != NULL);
|
||||
@@ -361,57 +311,45 @@ UINT8 *R_GenerateTexture(size_t texnum)
|
||||
{
|
||||
boolean holey = false;
|
||||
patch = texture->patches;
|
||||
|
||||
wadnum = patch->wad;
|
||||
lumpnum = patch->lump;
|
||||
lumplength = W_LumpLengthPwad(wadnum, lumpnum);
|
||||
|
||||
// The header does not exist
|
||||
if (R_CheckTextureLumpLength(texture, 0) == false)
|
||||
{
|
||||
block = R_AllocateDummyTextureBlock(texture->width, &texturecache[texnum]);
|
||||
texturecolumnofs[texnum] = (UINT32*)&block[4];
|
||||
textures[texnum]->holes = true;
|
||||
return block;
|
||||
}
|
||||
|
||||
pdata = (UINT8*)W_CacheLumpNumPwad(wadnum, lumpnum, PU_LEVEL);
|
||||
pdata = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_LEVEL);
|
||||
realpatch = (softwarepatch_t *)pdata;
|
||||
|
||||
// Check the patch for holes.
|
||||
if (texture->width > SHORT(realpatch->width) || texture->height > SHORT(realpatch->height))
|
||||
holey = true;
|
||||
|
||||
colofs = (UINT8 *)realpatch->columnofs;
|
||||
|
||||
for (x = 0; x < texture->width && !holey; x++)
|
||||
else
|
||||
{
|
||||
column_t *col = (column_t *)((UINT8 *)realpatch + LONG(*(UINT32 *)&colofs[x<<2]));
|
||||
colofs = (UINT8 *)realpatch->columnofs;
|
||||
|
||||
INT32 topdelta, prevdelta = -1, y = 0;
|
||||
|
||||
while (col->topdelta != 0xff)
|
||||
for (x = 0; x < texture->width; x++)
|
||||
{
|
||||
topdelta = col->topdelta;
|
||||
if (topdelta <= prevdelta)
|
||||
topdelta += prevdelta;
|
||||
prevdelta = topdelta;
|
||||
if (topdelta > y)
|
||||
break;
|
||||
y = topdelta + col->length + 1;
|
||||
col = (column_t *)((UINT8 *)col + col->length + 4);
|
||||
}
|
||||
column_t *col = (column_t *)((UINT8 *)realpatch + LONG(*(UINT32 *)&colofs[x<<2]));
|
||||
|
||||
if (y < texture->height)
|
||||
holey = true; // this texture is HOLEy! D:
|
||||
INT32 topdelta, prevdelta = -1, y = 0;
|
||||
|
||||
while (col->topdelta != 0xff)
|
||||
{
|
||||
topdelta = col->topdelta;
|
||||
if (topdelta <= prevdelta)
|
||||
topdelta += prevdelta;
|
||||
prevdelta = topdelta;
|
||||
if (topdelta > y)
|
||||
break;
|
||||
y = topdelta + col->length + 1;
|
||||
col = (column_t *)((UINT8 *)col + col->length + 4);
|
||||
}
|
||||
|
||||
if (y < texture->height)
|
||||
holey = true; // this texture is HOLEy! D:
|
||||
}
|
||||
}
|
||||
|
||||
// If the patch uses transparency, we have to save it this way.
|
||||
if (holey)
|
||||
{
|
||||
texture->holes = true;
|
||||
blocksize = lumplength;
|
||||
block = Z_Calloc(blocksize, PU_LEVEL, &texturecache[texnum]); // will change tag at end of this function
|
||||
blocksize = W_LumpLengthPwad(patch->wad, patch->lump);
|
||||
block = Z_Calloc(blocksize, PU_LEVEL, &texturecache[texnum]);
|
||||
M_Memcpy(block, realpatch, blocksize);
|
||||
texturememory += blocksize;
|
||||
|
||||
@@ -427,6 +365,7 @@ UINT8 *R_GenerateTexture(size_t texnum)
|
||||
|
||||
goto done;
|
||||
}
|
||||
|
||||
// Otherwise, do multipatch format.
|
||||
}
|
||||
|
||||
@@ -445,18 +384,10 @@ UINT8 *R_GenerateTexture(size_t texnum)
|
||||
// texture data after the lookup table
|
||||
blocktex = block + (texture->width*4);
|
||||
|
||||
for (x = 0; x < texture->width; ++x)
|
||||
{
|
||||
// generate column ofset lookup
|
||||
*(UINT32 *)&colofs[x<<2] = LONG((x * texture->height) + (texture->width*4));
|
||||
}
|
||||
|
||||
// Composite the columns together.
|
||||
for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++)
|
||||
{
|
||||
wadnum = patch->wad;
|
||||
lumpnum = patch->lump;
|
||||
pdata = (UINT8*)W_CacheLumpNumPwad(wadnum, lumpnum, PU_LEVEL);
|
||||
pdata = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_LEVEL);
|
||||
realpatch = (softwarepatch_t *)pdata;
|
||||
|
||||
x1 = patch->originx;
|
||||
@@ -487,7 +418,9 @@ UINT8 *R_GenerateTexture(size_t texnum)
|
||||
{
|
||||
patchcol = (column_t *)((UINT8 *)realpatch + LONG(realpatch->columnofs[x-x1]));
|
||||
|
||||
R_DrawColumnInCache(patchcol, block + LONG(*(UINT32 *)&colofs[x<<2]), patch, texture->height);
|
||||
// generate column ofset lookup
|
||||
*(UINT32 *)&colofs[x<<2] = LONG((x * texture->height) + (texture->width*4));
|
||||
R_DrawColumnInCache(patchcol, block + LONG(*(UINT32 *)&colofs[x<<2]), patch->originy, texture->height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -506,7 +439,6 @@ INT32 R_GetTextureNum(INT32 texnum)
|
||||
{
|
||||
if (texnum < 0 || texnum >= numtextures)
|
||||
return 0;
|
||||
|
||||
return texturetranslation[texnum];
|
||||
}
|
||||
|
||||
@@ -524,12 +456,17 @@ void R_CheckTextureCache(INT32 tex)
|
||||
|
||||
static inline INT32 wrap_column(fixed_t tex, INT32 col)
|
||||
{
|
||||
INT32 width = texturewidth[tex];
|
||||
|
||||
if (width & (width - 1))
|
||||
col = (UINT32)col % width;
|
||||
if (texturewidthmask[tex])
|
||||
col &= texturewidthmask[tex]; // set by load textures
|
||||
else
|
||||
col &= (width - 1);
|
||||
{
|
||||
const INT16 texwidth = textures[tex]->width;
|
||||
|
||||
// Odd width texture, cannot just mask.
|
||||
// Sometime gets colnum = -1 or = width, even without tiling.
|
||||
// Test LostCiv, Map 20, crates.
|
||||
col = ((col % texwidth) + texwidth) % texwidth;
|
||||
}
|
||||
|
||||
return col;
|
||||
}
|
||||
@@ -539,6 +476,13 @@ static inline INT32 wrap_column(fixed_t tex, INT32 col)
|
||||
//
|
||||
UINT8 *R_GetColumn(fixed_t tex, INT32 col)
|
||||
{
|
||||
if (!texturecache[tex])
|
||||
{
|
||||
// This must be here because cache can be freed by other operations.
|
||||
// To prevent must lock individual texture cache on every draw.
|
||||
R_GenerateTexture(tex);
|
||||
}
|
||||
|
||||
return texturecache[tex] + LONG(texturecolumnofs[tex][wrap_column(tex, col)]);
|
||||
}
|
||||
|
||||
@@ -572,10 +516,11 @@ static INT32
|
||||
Rloadtextures (INT32 i, INT32 w)
|
||||
{
|
||||
UINT16 j, numlumps = 0;
|
||||
INT32 k;
|
||||
UINT16 texstart, texend, texturesLumpPos;
|
||||
softwarepatch_t *patchlump;
|
||||
texpatch_t *patch;
|
||||
texture_t *texture;
|
||||
softwarepatch_t patchlump;
|
||||
|
||||
// Get the lump numbers for the markers in the WAD, if they exist.
|
||||
if (W_FileHasFolders(wadfiles[w]))
|
||||
@@ -615,7 +560,7 @@ Rloadtextures (INT32 i, INT32 w)
|
||||
continue; // If it is then SKIP IT
|
||||
}
|
||||
|
||||
W_ReadLumpHeaderPwad(wadnum, lumpnum, &patchlump, PNG_HEADER_SIZE, 0);
|
||||
patchlump = (softwarepatch_t *)W_CacheLumpNumPwad(wadnum, lumpnum, PU_STATIC);
|
||||
|
||||
//CONS_Printf("\n\"%s\" is a single patch, dimensions %d x %d",W_CheckNameForNumPwad((wadnum, lumpnum), patchlump->width, patchlump->height);
|
||||
texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL);
|
||||
@@ -623,10 +568,8 @@ Rloadtextures (INT32 i, INT32 w)
|
||||
// Set texture properties.
|
||||
M_Memcpy(texture->name, W_CheckNameForNumPwad(wadnum, lumpnum), sizeof(texture->name));
|
||||
texture->hash = quickncasehash(texture->name, 8);
|
||||
|
||||
texture->width = SHORT(patchlump.width);
|
||||
texture->height = SHORT(patchlump.height);
|
||||
|
||||
texture->width = SHORT(patchlump->width);
|
||||
texture->height = SHORT(patchlump->height);
|
||||
texture->type = TEXTURETYPE_SINGLEPATCH;
|
||||
texture->patchcount = 1;
|
||||
texture->holes = false;
|
||||
@@ -638,7 +581,27 @@ Rloadtextures (INT32 i, INT32 w)
|
||||
patch->wad = wadnum;
|
||||
patch->lump = texstart + j;
|
||||
|
||||
texturewidth[i] = texture->width;
|
||||
Z_Free(patchlump);
|
||||
|
||||
// determine width power of 2
|
||||
#if 1
|
||||
// [WDJ] only need to determine if exact power of 2.
|
||||
k = 1;
|
||||
while (k < texture->width)
|
||||
k<<=1;
|
||||
#else
|
||||
// Largest power of 2 that fits within width.
|
||||
k = 1;
|
||||
while (k << 1 <= texture->width)
|
||||
k <<= 1;
|
||||
#endif
|
||||
if (k != texture->width)
|
||||
{
|
||||
// Odd width
|
||||
k = 1; // make texturewidthmask = 0
|
||||
}
|
||||
|
||||
texturewidthmask[i] = k - 1;
|
||||
textureheight[i] = texture->height << FRACBITS;
|
||||
i++;
|
||||
}
|
||||
@@ -746,7 +709,7 @@ static void R_AllocateTextures(INT32 add)
|
||||
// Allocate texture referencing cache.
|
||||
recallocuser(&texturecache, oldsize, newsize);
|
||||
// Allocate texture width table.
|
||||
recallocuser(&texturewidth, oldsize, newsize);
|
||||
recallocuser(&texturewidthmask, oldsize, newsize);
|
||||
// Allocate texture height table.
|
||||
recallocuser(&textureheight, oldsize, newsize);
|
||||
// Create translation table for global animation.
|
||||
@@ -1218,7 +1181,7 @@ void R_ParseTEXTURESLump(UINT16 wadNum, UINT16 lumpNum, INT32 *texindex)
|
||||
newTexture = R_ParseTexture(true);
|
||||
// Store the new texture
|
||||
textures[*texindex] = newTexture;
|
||||
texturewidth[*texindex] = newTexture->width;
|
||||
texturewidthmask[*texindex] = newTexture->width - 1;
|
||||
textureheight[*texindex] = newTexture->height << FRACBITS;
|
||||
// Increment i back in R_LoadTextures()
|
||||
(*texindex)++;
|
||||
|
||||
+10
-6
@@ -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;
|
||||
@@ -615,12 +619,12 @@ typedef struct drawseg_s
|
||||
// Pointers to lists for sprite clipping, all three adjusted so [x1] is first value.
|
||||
INT16 *sprtopclip;
|
||||
INT16 *sprbottomclip;
|
||||
fixed_t *maskedtexturecol;
|
||||
INT16 *maskedtexturecol;
|
||||
|
||||
struct visplane_s *ffloorplanes[MAXFFLOORS];
|
||||
INT32 numffloorplanes;
|
||||
struct ffloor_s *thicksides[MAXFFLOORS];
|
||||
fixed_t *thicksidecol;
|
||||
INT16 *thicksidecol;
|
||||
INT32 numthicksides;
|
||||
fixed_t *frontscale;
|
||||
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ extern INT32 linesize;
|
||||
|
||||
FUNCINLINE static ATTRINLINE UINT8 *R_Address(INT32 px, INT32 py)
|
||||
{
|
||||
return renderscreen + (py + viewwindowy) + (viewwindowx + px) * vid.height;
|
||||
return renderscreen + (py + viewwindowy) * linesize + (viewwindowx + px);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+12
-13
@@ -31,8 +31,7 @@ enum DrawColumnType
|
||||
};
|
||||
|
||||
template<DrawColumnType Type>
|
||||
FUNCINLINE static ATTRINLINE constexpr UINT8
|
||||
R_GetColumnTranslated(drawcolumndata_t* dc, UINT8 col, const UINT8 * restrict colormap)
|
||||
static constexpr UINT8 R_GetColumnTranslated(drawcolumndata_t* dc, UINT8 col, const UINT8 * restrict colormap)
|
||||
{
|
||||
if constexpr (Type & DrawColumnType::DC_COLORMAP)
|
||||
{
|
||||
@@ -43,8 +42,7 @@ R_GetColumnTranslated(drawcolumndata_t* dc, UINT8 col, const UINT8 * restrict co
|
||||
}
|
||||
|
||||
template<DrawColumnType Type>
|
||||
FUNCINLINE static ATTRINLINE constexpr UINT8
|
||||
R_GetColumnTranslucent(drawcolumndata_t* dc, UINT8 * restrict dest, UINT8 col, const UINT8 * restrict colormap)
|
||||
static constexpr UINT8 R_GetColumnTranslucent(drawcolumndata_t* dc, UINT8 * restrict dest, UINT8 col, const UINT8 * restrict colormap)
|
||||
{
|
||||
col = R_GetColumnTranslated<Type>(dc, col, colormap);
|
||||
|
||||
@@ -59,8 +57,7 @@ R_GetColumnTranslucent(drawcolumndata_t* dc, UINT8 * restrict dest, UINT8 col, c
|
||||
}
|
||||
|
||||
template<DrawColumnType Type>
|
||||
FUNCINLINE static ATTRINLINE constexpr UINT8
|
||||
R_DrawColumnPixel(drawcolumndata_t* dc, UINT8 * restrict dest, UINT32 bit, const UINT8 * restrict source, const UINT8 * restrict colormap)
|
||||
static constexpr UINT8 R_DrawColumnPixel(drawcolumndata_t* dc, UINT8 * restrict dest, UINT32 bit, const UINT8 * restrict source, const UINT8 * restrict colormap)
|
||||
{
|
||||
UINT8 col = source[bit];
|
||||
|
||||
@@ -190,6 +187,7 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
||||
const intptr_t heightmask = dc->sourcelength-1;
|
||||
constexpr INT32 npow2min = -1;
|
||||
const INT32 npow2max = dc->sourcelength;
|
||||
const INT32 stride = vid.width;
|
||||
|
||||
const UINT8 * restrict source = dc->source;
|
||||
const lighttable_t * restrict colormap = dc->colormap;
|
||||
@@ -210,12 +208,12 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
||||
while(count--)
|
||||
{
|
||||
*dest = R_DrawColumnPixel<Type>(dc, dest, (frac>>FRACBITS) & heightmask, source, colormap);
|
||||
dest++;
|
||||
dest += stride;
|
||||
frac += fracstep;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case npow2min:
|
||||
case -1:
|
||||
{
|
||||
if (frac < 0)
|
||||
// adjust in case we underread
|
||||
@@ -225,7 +223,7 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
||||
while (--count >= 0)
|
||||
{
|
||||
*dest = R_DrawColumnPixel<Type>(dc, dest, frac>>FRACBITS, source, colormap);
|
||||
dest++;
|
||||
dest += stride;
|
||||
frac += fracstep;
|
||||
}
|
||||
}
|
||||
@@ -237,11 +235,11 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
||||
while ((count -= 2) >= 0) // texture height is a power of 2 -- killough
|
||||
{
|
||||
*dest = R_DrawColumnPixel<Type>(dc, dest, (frac>>FRACBITS) & heightmask, source, colormap);
|
||||
dest++;
|
||||
dest += stride;
|
||||
frac += fracstep;
|
||||
|
||||
*dest = R_DrawColumnPixel<Type>(dc, dest, (frac>>FRACBITS) & heightmask, source, colormap);
|
||||
dest++;
|
||||
dest += stride;
|
||||
frac += fracstep;
|
||||
}
|
||||
|
||||
@@ -279,7 +277,7 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
||||
// and a few bytes after as well
|
||||
*dest = R_DrawColumnPixel<Type>(dc, dest, CLAMP((frac >> FRACBITS), npow2min, npow2max), source, colormap);
|
||||
|
||||
dest++;
|
||||
dest += stride;
|
||||
|
||||
#if __SIZEOF_POINTER__ < 8 // 64-bit systems have large enough numbers for this to be a non-issue
|
||||
// Avoid overflow.
|
||||
@@ -345,6 +343,7 @@ void R_DrawFogColumn(drawcolumndata_t* dc)
|
||||
// Framebuffer destination address.
|
||||
dest = R_Address(dc->x, dc->yl);
|
||||
|
||||
const INT32 stride = vid.width;
|
||||
const lighttable_t * restrict colormap = dc->colormap;
|
||||
|
||||
// Determine scaling, which is the only mapping to be done.
|
||||
@@ -352,6 +351,6 @@ void R_DrawFogColumn(drawcolumndata_t* dc)
|
||||
{
|
||||
// Simple. Apply the colormap to what's already on the screen.
|
||||
*dest = colormap[*dest];
|
||||
dest++;
|
||||
dest += stride;
|
||||
} while (count--);
|
||||
}
|
||||
+77
-73
@@ -25,9 +25,6 @@
|
||||
#define local_for_thread static
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
// ==========================================================================
|
||||
// SPANS
|
||||
// ==========================================================================
|
||||
@@ -50,8 +47,7 @@ enum DrawSpanType
|
||||
};
|
||||
|
||||
template<DrawSpanType Type>
|
||||
FUNCINLINE static ATTRINLINE constexpr UINT8
|
||||
R_GetSpanTranslated(drawspandata_t* ds, UINT8 col)
|
||||
static constexpr UINT8 R_GetSpanTranslated(drawspandata_t* ds, UINT8 col)
|
||||
{
|
||||
if constexpr (Type & DrawSpanType::DS_COLORMAP)
|
||||
{
|
||||
@@ -64,8 +60,7 @@ R_GetSpanTranslated(drawspandata_t* ds, UINT8 col)
|
||||
}
|
||||
|
||||
template<DrawSpanType Type>
|
||||
FUNCINLINE static ATTRINLINE constexpr UINT8
|
||||
R_GetSpanTranslucent(drawspandata_t* ds, UINT8 *dsrc, const UINT8 *colormap, UINT8 col)
|
||||
static constexpr UINT8 R_GetSpanTranslucent(drawspandata_t* ds, UINT8 *dsrc, const UINT8 *colormap, UINT8 col)
|
||||
{
|
||||
col = colormap[R_GetSpanTranslated<Type>(ds, col)];
|
||||
|
||||
@@ -80,8 +75,7 @@ R_GetSpanTranslucent(drawspandata_t* ds, UINT8 *dsrc, const UINT8 *colormap, UIN
|
||||
}
|
||||
|
||||
template<DrawSpanType Type>
|
||||
FUNCINLINE static ATTRINLINE constexpr UINT8
|
||||
R_DrawSpanPixel(drawspandata_t* ds, UINT8 *dsrc, const UINT8 *colormap, UINT32 bit, const UINT8 *source)
|
||||
static constexpr UINT8 R_DrawSpanPixel(drawspandata_t* ds, UINT8 *dsrc, const UINT8 *colormap, UINT32 bit, const UINT8 *source)
|
||||
{
|
||||
UINT8 col = source[bit];
|
||||
|
||||
@@ -110,17 +104,15 @@ static void R_DrawSpanTemplate(drawspandata_t* ds)
|
||||
UINT8 * restrict dest = R_Address(ds->x1, ds->y);
|
||||
UINT8 * restrict dsrc;
|
||||
|
||||
const UINT8 * restrict deststop = vid.screens[0] + vid.height *vid.width;
|
||||
const UINT8 * restrict deststop = vid.screens[0] + vid.width * vid.height;
|
||||
|
||||
if (dest > deststop)
|
||||
if (dest+8 > deststop)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
intptr_t count = (ds->x2 - ds->x1 + 1);
|
||||
//size_t i;
|
||||
|
||||
const INT32 stride = vid.height;
|
||||
size_t i;
|
||||
|
||||
xposition = ds->xfrac; yposition = ds->yfrac;
|
||||
xstep = ds->xstep; ystep = ds->ystep;
|
||||
@@ -145,14 +137,14 @@ static void R_DrawSpanTemplate(drawspandata_t* ds)
|
||||
|
||||
if constexpr (Type & DS_RIPPLE)
|
||||
{
|
||||
dsrc = vid.screens[1] + (ds->y + ds->bgofs) + ds->x1 * vid.height;
|
||||
dsrc = vid.screens[1] + (ds->y + ds->bgofs) * vid.width + ds->x1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dsrc = dest;
|
||||
}
|
||||
|
||||
/*while (count >= 8)
|
||||
while (count >= 8)
|
||||
{
|
||||
// SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't
|
||||
// have the uber complicated math to calculate it now, so that was a memory write we didn't
|
||||
@@ -172,7 +164,7 @@ static void R_DrawSpanTemplate(drawspandata_t* ds)
|
||||
dsrc += 8;
|
||||
|
||||
count -= 8;
|
||||
}*/
|
||||
}
|
||||
|
||||
while (count-- && dest <= deststop)
|
||||
{
|
||||
@@ -180,8 +172,8 @@ static void R_DrawSpanTemplate(drawspandata_t* ds)
|
||||
|
||||
*dest = R_DrawSpanPixel<Type>(ds, dsrc, colormap, bit, source);
|
||||
|
||||
dest += stride;
|
||||
dsrc += stride;
|
||||
dest++;
|
||||
dsrc++;
|
||||
|
||||
xposition += xstep;
|
||||
yposition += ystep;
|
||||
@@ -190,39 +182,31 @@ static void R_DrawSpanTemplate(drawspandata_t* ds)
|
||||
|
||||
// R_CalcTiltedLighting
|
||||
// Exactly what it says on the tin. I wish I wasn't too lazy to explain things properly.
|
||||
static void R_CalcTiltedLighting(std::vector<INT32>& lightbuffer, INT32 x1, INT32 x2, fixed_t start, fixed_t end)
|
||||
static void R_CalcTiltedLighting(INT32 *lightbuffer, INT32 x1, INT32 x2, fixed_t start, fixed_t end)
|
||||
{
|
||||
// ZDoom uses a different lighting setup to us, and I couldn't figure out how to adapt their version
|
||||
// of this function. Here's my own.
|
||||
INT32 i;
|
||||
INT32 i, left = x1, right = x2;
|
||||
const fixed_t step = (end-start)/(x2 - x1 + 1);
|
||||
|
||||
// I wanna do some optimizing by checking for out-of-range segments on either side to fill in all at once,
|
||||
// but I'm too bad at coding to not crash the game trying to do that. I guess this is fast enough for now...
|
||||
|
||||
for (i = x1; i <= x2; i++)
|
||||
for (i = left; i <= right; i++)
|
||||
{
|
||||
fixed_t light = start >> FRACBITS;
|
||||
lightbuffer[i] = CLAMP(light, 0, MAXLIGHTSCALE - 1);
|
||||
start += step;
|
||||
lightbuffer[i] = (start += step) >> FRACBITS;
|
||||
|
||||
if (lightbuffer[i] < 0)
|
||||
{
|
||||
lightbuffer[i] = 0;
|
||||
}
|
||||
else if (lightbuffer[i] >= MAXLIGHTSCALE)
|
||||
{
|
||||
lightbuffer[i] = MAXLIGHTSCALE-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void R_GetTiltedLighting(std::vector<INT32>& tiltlighting, const drawspandata_t* ds, const float iz, const int width, const INT32 stride)
|
||||
{
|
||||
float planelightfloat = PLANELIGHTFLOAT;
|
||||
const fixed_t lightstart = FloatToFixed(iz * planelightfloat);
|
||||
const fixed_t lightend = FloatToFixed((iz + ds->szp.x * width) * planelightfloat);
|
||||
|
||||
if (tiltlighting.size() != (size_t)viewwidth)
|
||||
{
|
||||
tiltlighting.resize(viewwidth);
|
||||
}
|
||||
|
||||
R_CalcTiltedLighting(tiltlighting, ds->x1, ds->x2, lightstart, lightend);
|
||||
//CONS_Printf("tilted lighting %f to %f (foc %f)\n", FixedToFloat(lightstart), FixedToFloat(lightend), focallengthf);
|
||||
}
|
||||
|
||||
template<DrawSpanType Type>
|
||||
static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||
{
|
||||
@@ -239,18 +223,35 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||
float endz, endu, endv;
|
||||
UINT32 stepu, stepv;
|
||||
UINT32 bit;
|
||||
local_for_thread INT32 *tiltlighting = NULL;
|
||||
local_for_thread INT32 oldviewwidth = 0;
|
||||
|
||||
//INT32 x1 = ds->x1;
|
||||
// dont realloc every frame pls thx
|
||||
if (tiltlighting == NULL || oldviewwidth != viewwidth)
|
||||
{
|
||||
tiltlighting = static_cast<INT32*>(realloc(tiltlighting, sizeof(*tiltlighting) * viewwidth));
|
||||
oldviewwidth = viewwidth;
|
||||
}
|
||||
|
||||
INT32 x1 = ds->x1;
|
||||
const INT32 nflatxshift = ds->nflatxshift;
|
||||
const INT32 nflatyshift = ds->nflatyshift;
|
||||
const INT32 nflatmask = ds->nflatmask;
|
||||
const INT32 stride = vid.height;
|
||||
local_for_thread std::vector<INT32> tiltlighting;
|
||||
const INT32 stride = vid.width;
|
||||
|
||||
iz = ds->szp.z + ds->szp.y*(centery-ds->y) + ds->szp.x*(ds->x1-centerx);
|
||||
|
||||
// Lighting is simple. It's just linear interpolation from start to end
|
||||
R_GetTiltedLighting(tiltlighting, ds, iz, width, stride);
|
||||
{
|
||||
float planelightfloat = PLANELIGHTFLOAT;
|
||||
float lightstart, lightend;
|
||||
|
||||
lightend = (iz + ds->szp.x*width) * planelightfloat;
|
||||
lightstart = iz * planelightfloat;
|
||||
|
||||
R_CalcTiltedLighting(tiltlighting, ds->x1, ds->x2, FLOAT_TO_FIXED(lightstart), FLOAT_TO_FIXED(lightend));
|
||||
//CONS_Printf("tilted lighting %f to %f (foc %f)\n", lightstart, lightend, focallengthf);
|
||||
}
|
||||
|
||||
uz = ds->sup.z + ds->sup.y*(centery-ds->y) + ds->sup.x*(ds->x1-centerx);
|
||||
vz = ds->svp.z + ds->svp.y*(centery-ds->y) + ds->svp.x*(ds->x1-centerx);
|
||||
@@ -260,7 +261,7 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||
|
||||
if constexpr (Type & DS_RIPPLE)
|
||||
{
|
||||
dsrc = vid.screens[1] + (ds->y + ds->bgofs) + ds->x1 * stride;
|
||||
dsrc = vid.screens[1] + (ds->y + ds->bgofs) * stride + ds->x1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -312,31 +313,18 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||
u = (INT64)(startu);
|
||||
v = (INT64)(startv);
|
||||
|
||||
//x1 = ds->x1;
|
||||
x1 = ds->x1;
|
||||
|
||||
// not sure which one does a better job
|
||||
|
||||
for (i = SPANSIZE-1; i >= 0; i--)
|
||||
{
|
||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||
colormap = ds->planezlight[tiltlighting[ds->x1++]] + (ds->colormap - colormaps);
|
||||
*dest = R_DrawSpanPixel<Type>(ds, dsrc, colormap, bit, source);
|
||||
dest += stride;
|
||||
dsrc += stride;
|
||||
u += stepu;
|
||||
v += stepv;
|
||||
}
|
||||
|
||||
/*for (i = 0; i < SPANSIZE; i++)
|
||||
for (i = 0; i < SPANSIZE; i++)
|
||||
{
|
||||
bit = (((v + stepv * i) >> nflatyshift) & nflatmask) | ((u + stepu * i) >> nflatxshift);
|
||||
colormap = ds->planezlight[tiltlighting[x1 + i]] + (ds->colormap - colormaps);
|
||||
dest[i * stride] = R_DrawSpanPixel<Type>(ds, &dsrc[i * stride], colormap, bit, source);
|
||||
dest[i] = R_DrawSpanPixel<Type>(ds, &dsrc[i], colormap, bit, source);
|
||||
}
|
||||
|
||||
ds->x1 += SPANSIZE;
|
||||
dest += SPANSIZE * stride;
|
||||
dsrc += SPANSIZE * stride;*/
|
||||
dest += SPANSIZE;
|
||||
dsrc += SPANSIZE;
|
||||
startu = endu;
|
||||
startv = endv;
|
||||
width -= SPANSIZE;
|
||||
@@ -374,9 +362,9 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||
bit = ((v >> ds->nflatyshift) & ds->nflatmask) | (u >> ds->nflatxshift);
|
||||
colormap = ds->planezlight[tiltlighting[ds->x1]] + (ds->colormap - colormaps);
|
||||
*dest = R_DrawSpanPixel<Type>(ds, dsrc, colormap, bit, source);
|
||||
dest += stride;
|
||||
dsrc += stride;
|
||||
dest++;
|
||||
ds->x1++;
|
||||
dsrc++;
|
||||
u += stepu;
|
||||
v += stepv;
|
||||
}
|
||||
@@ -412,9 +400,7 @@ void R_DrawFogSpan(drawspandata_t* ds)
|
||||
|
||||
intptr_t count = ds->x2 - ds->x1 + 1;
|
||||
|
||||
const INT32 stride = vid.height;
|
||||
|
||||
/*while (count >= 4)
|
||||
while (count >= 4)
|
||||
{
|
||||
dest[0] = colormap[dest[0]];
|
||||
dest[1] = colormap[dest[1]];
|
||||
@@ -423,12 +409,12 @@ void R_DrawFogSpan(drawspandata_t* ds)
|
||||
|
||||
dest += 4;
|
||||
count -= 4;
|
||||
}*/
|
||||
}
|
||||
|
||||
while (count--)
|
||||
{
|
||||
*dest = colormap[*dest];
|
||||
dest += stride;
|
||||
dest++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,19 +423,37 @@ void R_DrawFogSpan_Tilted(drawspandata_t* ds)
|
||||
int width = ds->x2 - ds->x1;
|
||||
float iz = ds->szp.z + ds->szp.y*(centery-ds->y) + ds->szp.x*(ds->x1-centerx);
|
||||
UINT8 * restrict dest;
|
||||
local_for_thread std::vector<INT32> tiltlighting;
|
||||
|
||||
local_for_thread INT32 *tiltlighting = NULL;
|
||||
local_for_thread INT32 oldviewwidth = 0;
|
||||
|
||||
// dont realloc every frame pls thx
|
||||
if (tiltlighting == NULL || oldviewwidth != viewwidth)
|
||||
{
|
||||
tiltlighting = static_cast<INT32*>(realloc(tiltlighting, sizeof(*tiltlighting) * viewwidth));
|
||||
oldviewwidth = viewwidth;
|
||||
}
|
||||
|
||||
dest = R_Address(ds->x1, ds->y);
|
||||
const INT32 stride = vid.width;
|
||||
|
||||
// Lighting is simple. It's just linear interpolation from start to end
|
||||
R_GetTiltedLighting(tiltlighting, ds, iz, width, stride);
|
||||
{
|
||||
float planelightfloat = PLANELIGHTFLOAT;
|
||||
float lightstart, lightend;
|
||||
|
||||
lightend = (iz + ds->szp.x*width) * planelightfloat;
|
||||
lightstart = iz * planelightfloat;
|
||||
|
||||
R_CalcTiltedLighting(tiltlighting, ds->x1, ds->x2, FLOAT_TO_FIXED(lightstart), FLOAT_TO_FIXED(lightend));
|
||||
//CONS_Printf("tilted lighting %f to %f (foc %f)\n", lightstart, lightend, focallengthf);
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
UINT8 *colormap = ds->planezlight[tiltlighting[ds->x1++]] + (ds->colormap - colormaps);
|
||||
*dest = colormap[*dest];
|
||||
dest += stride;
|
||||
dest++;
|
||||
}
|
||||
while (--width >= 0);
|
||||
}
|
||||
@@ -1400,7 +1400,6 @@ void R_RenderPlayerView(player_t *player)
|
||||
|
||||
R_ClearClipSegs();
|
||||
R_ClearDrawSegs();
|
||||
R_ClearSegTables();
|
||||
R_ClearPlanes();
|
||||
R_ClearSprites();
|
||||
|
||||
@@ -1435,7 +1434,6 @@ void R_RenderPlayerView(player_t *player)
|
||||
R_ClearClipSegs();
|
||||
}
|
||||
R_ClearDrawSegs();
|
||||
R_ClearSegTables();
|
||||
R_ClearSprites();
|
||||
|
||||
// check for new console commands.
|
||||
|
||||
@@ -36,8 +36,6 @@ typedef struct
|
||||
boolean available;
|
||||
} spriteinfo_t;
|
||||
|
||||
#define PNG_HEADER_SIZE (8)
|
||||
|
||||
// Patch functions
|
||||
patch_t *Patch_Create(softwarepatch_t *source, size_t srcsize, void *dest);
|
||||
void Patch_Free(patch_t *patch);
|
||||
|
||||
+29
-23
@@ -60,6 +60,10 @@ INT32 numffloors;
|
||||
#define visplane_hash(picnum,lightlevel,height) \
|
||||
((unsigned)((picnum)*3+(lightlevel)+(height)*7) & VISPLANEHASHMASK)
|
||||
|
||||
//SoM: 3/23/2000: Use boom opening limit removal
|
||||
size_t maxopenings;
|
||||
INT16 *openings, *lastopening; /// \todo free leak
|
||||
|
||||
//
|
||||
// Clip values are the solid pixel bounding the range.
|
||||
// floorclip starts out SCREENHEIGHT
|
||||
@@ -335,13 +339,13 @@ void R_ClearPlanes(void)
|
||||
R_ClearFFloorClips();
|
||||
|
||||
for (i = 0; i < MAXVISPLANES; i++)
|
||||
{
|
||||
for (*freehead = visplanes[i], visplanes[i] = NULL;
|
||||
freehead && *freehead ;)
|
||||
{
|
||||
freehead = &(*freehead)->next;
|
||||
}
|
||||
}
|
||||
|
||||
lastopening = openings;
|
||||
|
||||
// left to right mapping
|
||||
angle = (viewangle-ANGLE_90)>>ANGLETOFINESHIFT;
|
||||
@@ -630,9 +634,8 @@ static void R_MakeSpans(void (*mapfunc)(drawspandata_t* ds, void(*spanfunc)(draw
|
||||
// coarse enough to not be too slow due to task scheduling overhead.
|
||||
// To safely do this, we need to copy part of spanstart to a local.
|
||||
// This is essentially loop unrolling across threads.
|
||||
constexpr const int kSpanTaskGranularity = 16;
|
||||
constexpr const int kSpanTaskGranularity = 8;
|
||||
drawspandata_t ds_copy = *ds;
|
||||
|
||||
while (t1 < t2 && t1 <= b1)
|
||||
{
|
||||
INT32 spanstartcopy[kSpanTaskGranularity] = {0};
|
||||
@@ -750,13 +753,6 @@ void R_DrawSkyPlanes(void)
|
||||
visplane_t *pl;
|
||||
INT32 i;
|
||||
|
||||
// If we're not supposed to draw the sky (e.g. for skyboxes), don't do anything!
|
||||
// This probably utterly ruins sky rendering for FOFs and polyobjects, unfortunately
|
||||
if (!newview->sky)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
srb2::ThreadPool::Sema tp_sema;
|
||||
srb2::g_main_threadpool->begin_sema();
|
||||
@@ -785,8 +781,14 @@ static void R_DrawSkyPlane(visplane_t *pl, void(*colfunc2)(drawcolumndata_t*), b
|
||||
if (!(pl->minx <= pl->maxx))
|
||||
return;
|
||||
|
||||
// If we're not supposed to draw the sky (e.g. for skyboxes), don't do anything!
|
||||
// This probably utterly ruins sky rendering for FOFs and polyobjects, unfortunately
|
||||
if (!newview->sky)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
drawcolumndata_t dc = {};
|
||||
const INT32 texture = texturetranslation[skytexture];
|
||||
|
||||
// Reset column drawer function (note: couldn't we just call walldrawerfunc directly?)
|
||||
// (that is, unless we'll need to switch drawers in future for some reason)
|
||||
@@ -805,21 +807,24 @@ static void R_DrawSkyPlane(visplane_t *pl, void(*colfunc2)(drawcolumndata_t*), b
|
||||
dc.colormap += COLORMAP_REMAPOFFSET;
|
||||
|
||||
dc.texturemid = skytexturemid;
|
||||
dc.texheight = textureheight[texture] >>FRACBITS;
|
||||
dc.texheight = textureheight[skytexture] >>FRACBITS;
|
||||
dc.sourcelength = dc.texheight;
|
||||
|
||||
x = pl->minx;
|
||||
|
||||
// Precache the texture so we don't corrupt the zoned heap off-main thread
|
||||
R_CheckTextureCache(texture);
|
||||
if (!texturecache[texturetranslation[skytexture]])
|
||||
{
|
||||
R_GenerateTexture(texturetranslation[skytexture]);
|
||||
}
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
// Tune concurrency granularity here to maximize throughput
|
||||
// The cheaper colfunc is, the more coarse the task should be
|
||||
constexpr const int kSkyPlaneMacroColumns = 8;
|
||||
|
||||
while (x <= pl->maxx)
|
||||
{
|
||||
// Tune concurrency granularity here to maximize throughput
|
||||
// The cheaper colfunc is, the more coarse the task should be
|
||||
constexpr const int kSkyPlaneMacroColumns = 8;
|
||||
|
||||
auto thunk = [=]() mutable -> void {
|
||||
for (int i = 0; i < kSkyPlaneMacroColumns && i + x <= pl->maxx; i++)
|
||||
{
|
||||
@@ -836,7 +841,9 @@ static void R_DrawSkyPlane(visplane_t *pl, void(*colfunc2)(drawcolumndata_t*), b
|
||||
|
||||
dc.iscale = FixedMul(skyscale, FINECOSINE(xtoviewangle[x + i]>>ANGLETOFINESHIFT));
|
||||
dc.x = x + i;
|
||||
dc.source = R_GetColumn(texture, -angle); // get negative of angle for each column to display sky correct way round! --Monster Iestyn 27/01/18
|
||||
dc.source =
|
||||
R_GetColumn(texturetranslation[skytexture],
|
||||
-angle); // get negative of angle for each column to display sky correct way round! --Monster Iestyn 27/01/18
|
||||
|
||||
colfunc2(&dc);
|
||||
}
|
||||
@@ -1157,14 +1164,13 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
|
||||
}
|
||||
}
|
||||
|
||||
//offset = (scry*vid.width) + scrx;
|
||||
offset = (scrx*vid.height) + scry;
|
||||
offset = (scry*vid.width) + scrx;
|
||||
|
||||
// No idea if this works
|
||||
VID_BlitLinearScreen(renderscreen + offset,
|
||||
vid.screens[1] + top, // intentionally not +offset
|
||||
vid.screens[1] + (top*vid.width), // intentionally not +offset
|
||||
viewwidth, bottom-top,
|
||||
vid.height, vid.height);
|
||||
vid.width, vid.width);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +67,8 @@ extern visplane_t *floorplane;
|
||||
extern visplane_t *ceilingplane;
|
||||
|
||||
// Visplane related.
|
||||
extern INT16 *lastopening, *openings;
|
||||
extern size_t maxopenings;
|
||||
|
||||
extern INT16 *floorclip, *ceilingclip;
|
||||
extern fixed_t *frontscale, *yslopetab;
|
||||
|
||||
+208
-272
@@ -78,21 +78,9 @@ static fixed_t topfrac, topstep;
|
||||
static fixed_t bottomfrac, bottomstep;
|
||||
|
||||
static lighttable_t **walllights;
|
||||
static fixed_t *maskedtexturecol;
|
||||
static INT16 *maskedtexturecol;
|
||||
static fixed_t *maskedtextureheight = NULL;
|
||||
|
||||
static size_t numopenings;
|
||||
static INT16 *openings, *lastopening;
|
||||
|
||||
static size_t texturecolumntablesize;
|
||||
static fixed_t *texturecolumntable, *curtexturecolumntable;
|
||||
|
||||
void R_ClearSegTables(void)
|
||||
{
|
||||
lastopening = openings;
|
||||
curtexturecolumntable = texturecolumntable;
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
// R_RenderMaskedSegRange
|
||||
// ==========================================================================
|
||||
@@ -152,18 +140,7 @@ static void R_Render2sidedMultiPatchColumn(drawcolumndata_t* dc, column_t *colum
|
||||
|
||||
transnum_t R_GetLinedefTransTable(fixed_t alpha)
|
||||
{
|
||||
if (alpha >= FRACUNIT)
|
||||
{
|
||||
return static_cast<transnum_t>(0);
|
||||
}
|
||||
else if (alpha <= 0)
|
||||
{
|
||||
return NUMTRANSMAPS;
|
||||
}
|
||||
else
|
||||
{
|
||||
return static_cast<transnum_t>((20*(FRACUNIT - alpha - 1) + FRACUNIT) >> (FRACBITS+1));
|
||||
}
|
||||
return static_cast<transnum_t>((20*(FRACUNIT - alpha - 1) + FRACUNIT) >> (FRACBITS+1));
|
||||
}
|
||||
|
||||
static inline boolean R_OverflowTest(drawcolumndata_t* dc)
|
||||
@@ -196,7 +173,7 @@ static void R_RenderMaskedSegLoop(drawcolumndata_t* dc, drawseg_t *drawseg, INT3
|
||||
|
||||
ldef = curline->linedef;
|
||||
|
||||
range = std::max<INT32>(drawseg->x2-drawseg->x1, 1);
|
||||
range = std::max(drawseg->x2-drawseg->x1, 1);
|
||||
|
||||
// Setup lighting based on the presence/lack-of 3D floors.
|
||||
dc->numlights = 0;
|
||||
@@ -329,137 +306,141 @@ static void R_RenderMaskedSegLoop(drawcolumndata_t* dc, drawseg_t *drawseg, INT3
|
||||
else
|
||||
dc->texturemid -= (textureheight[texnum])*times;
|
||||
|
||||
// Check for overflows first
|
||||
if (R_OverflowTest(dc))
|
||||
{
|
||||
// Eh, no, go away, don't waste our time
|
||||
if (dc->numlights)
|
||||
{
|
||||
for (i = 0; i < dc->numlights; i++)
|
||||
{
|
||||
rlight = &dc->lightlist[i];
|
||||
rlight->height += rlight->heightstep;
|
||||
}
|
||||
}
|
||||
|
||||
spryscale += rw_scalestep;
|
||||
continue;
|
||||
}
|
||||
const INT16 colnum = maskedtexturecol[dc->x];
|
||||
|
||||
// calculate lighting
|
||||
if (dc->numlights)
|
||||
if (colnum != INT16_MAX)
|
||||
{
|
||||
lighttable_t **xwalllights;
|
||||
|
||||
sprbotscreen = INT32_MAX;
|
||||
sprtopscreen = windowtop = (centeryfrac - FixedMul(dc->texturemid, spryscale));
|
||||
|
||||
realbot = windowbottom = FixedMul(textureheight[texnum], spryscale) + sprtopscreen;
|
||||
dc->iscale = 0xffffffffu / (unsigned)spryscale;
|
||||
|
||||
// draw the texture
|
||||
col = (column_t *)((UINT8 *)R_GetColumn(texnum, (maskedtexturecol[dc->x] >> FRACBITS)) - 3);
|
||||
|
||||
auto set_light_vars = [&](INT32 k)
|
||||
// Check for overflows first
|
||||
if (R_OverflowTest(dc))
|
||||
{
|
||||
rlight = &dc->lightlist[k];
|
||||
|
||||
lightnum = rlight->lightnum;
|
||||
|
||||
if (lightnum < 0)
|
||||
xwalllights = scalelight[0];
|
||||
else if (lightnum >= LIGHTLEVELS)
|
||||
xwalllights = scalelight[LIGHTLEVELS-1];
|
||||
else
|
||||
xwalllights = scalelight[lightnum];
|
||||
|
||||
pindex = FixedMul(spryscale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT;
|
||||
|
||||
if (pindex >= MAXLIGHTSCALE)
|
||||
pindex = MAXLIGHTSCALE - 1;
|
||||
|
||||
if (rlight->extra_colormap)
|
||||
rlight->rcolormap = rlight->extra_colormap->colormap + (xwalllights[pindex] - colormaps);
|
||||
else
|
||||
rlight->rcolormap = xwalllights[pindex];
|
||||
};
|
||||
|
||||
auto set_colormap_below_light = [&]
|
||||
{
|
||||
dc->colormap = rlight->rcolormap;
|
||||
if (encoremap && !(ldef->flags & ML_TFERLINE))
|
||||
dc->colormap += COLORMAP_REMAPOFFSET;
|
||||
};
|
||||
|
||||
// Use the base sector's light level above the first FOF.
|
||||
// You can imagine it as the sky casting its light on top of the highest FOF.
|
||||
set_light_vars(0);
|
||||
set_colormap_below_light();
|
||||
|
||||
for (i = 0; i < dc->numlights; i++)
|
||||
{
|
||||
if ((dc->lightlist[i].flags & FF_NOSHADE))
|
||||
continue;
|
||||
|
||||
set_light_vars(i);
|
||||
|
||||
height = rlight->height;
|
||||
rlight->height += rlight->heightstep;
|
||||
|
||||
if (height <= windowtop)
|
||||
// Eh, no, go away, don't waste our time
|
||||
if (dc->numlights)
|
||||
{
|
||||
set_colormap_below_light();
|
||||
continue;
|
||||
}
|
||||
|
||||
windowbottom = height;
|
||||
if (windowbottom >= realbot)
|
||||
{
|
||||
windowbottom = realbot;
|
||||
colfunc_2s(dc, col);
|
||||
for (i++; i < dc->numlights; i++)
|
||||
for (i = 0; i < dc->numlights; i++)
|
||||
{
|
||||
rlight = &dc->lightlist[i];
|
||||
rlight->height += rlight->heightstep;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
colfunc_2s(dc, col);
|
||||
|
||||
windowtop = windowbottom + 1;
|
||||
set_colormap_below_light();
|
||||
spryscale += rw_scalestep;
|
||||
continue;
|
||||
}
|
||||
windowbottom = realbot;
|
||||
if (windowtop < windowbottom)
|
||||
colfunc_2s(dc, col);
|
||||
|
||||
spryscale += rw_scalestep;
|
||||
continue;
|
||||
if (dc->numlights)
|
||||
{
|
||||
lighttable_t **xwalllights;
|
||||
|
||||
sprbotscreen = INT32_MAX;
|
||||
sprtopscreen = windowtop = (centeryfrac - FixedMul(dc->texturemid, spryscale));
|
||||
|
||||
realbot = windowbottom = FixedMul(textureheight[texnum], spryscale) + sprtopscreen;
|
||||
dc->iscale = 0xffffffffu / (unsigned)spryscale;
|
||||
|
||||
// draw the texture
|
||||
col = (column_t *)((UINT8 *)R_GetColumn(texnum, colnum) - 3);
|
||||
|
||||
auto set_light_vars = [&](INT32 k)
|
||||
{
|
||||
rlight = &dc->lightlist[k];
|
||||
|
||||
lightnum = rlight->lightnum;
|
||||
|
||||
if (lightnum < 0)
|
||||
xwalllights = scalelight[0];
|
||||
else if (lightnum >= LIGHTLEVELS)
|
||||
xwalllights = scalelight[LIGHTLEVELS-1];
|
||||
else
|
||||
xwalllights = scalelight[lightnum];
|
||||
|
||||
pindex = FixedMul(spryscale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT;
|
||||
|
||||
if (pindex >= MAXLIGHTSCALE)
|
||||
pindex = MAXLIGHTSCALE - 1;
|
||||
|
||||
if (rlight->extra_colormap)
|
||||
rlight->rcolormap = rlight->extra_colormap->colormap + (xwalllights[pindex] - colormaps);
|
||||
else
|
||||
rlight->rcolormap = xwalllights[pindex];
|
||||
};
|
||||
|
||||
auto set_colormap_below_light = [&]
|
||||
{
|
||||
dc->colormap = rlight->rcolormap;
|
||||
if (encoremap && !(ldef->flags & ML_TFERLINE))
|
||||
dc->colormap += COLORMAP_REMAPOFFSET;
|
||||
};
|
||||
|
||||
// Use the base sector's light level above the first FOF.
|
||||
// You can imagine it as the sky casting its light on top of the highest FOF.
|
||||
set_light_vars(0);
|
||||
set_colormap_below_light();
|
||||
|
||||
for (i = 0; i < dc->numlights; i++)
|
||||
{
|
||||
if ((dc->lightlist[i].flags & FF_NOSHADE))
|
||||
continue;
|
||||
|
||||
set_light_vars(i);
|
||||
|
||||
height = rlight->height;
|
||||
rlight->height += rlight->heightstep;
|
||||
|
||||
if (height <= windowtop)
|
||||
{
|
||||
set_colormap_below_light();
|
||||
continue;
|
||||
}
|
||||
|
||||
windowbottom = height;
|
||||
if (windowbottom >= realbot)
|
||||
{
|
||||
windowbottom = realbot;
|
||||
colfunc_2s(dc, col);
|
||||
for (i++; i < dc->numlights; i++)
|
||||
{
|
||||
rlight = &dc->lightlist[i];
|
||||
rlight->height += rlight->heightstep;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
colfunc_2s(dc, col);
|
||||
|
||||
windowtop = windowbottom + 1;
|
||||
set_colormap_below_light();
|
||||
}
|
||||
windowbottom = realbot;
|
||||
if (windowtop < windowbottom)
|
||||
colfunc_2s(dc, col);
|
||||
|
||||
spryscale += rw_scalestep;
|
||||
continue;
|
||||
}
|
||||
|
||||
// calculate lighting
|
||||
pindex = FixedMul(spryscale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT;
|
||||
|
||||
if (pindex >= MAXLIGHTSCALE)
|
||||
pindex = MAXLIGHTSCALE - 1;
|
||||
|
||||
dc->colormap = walllights[pindex];
|
||||
if (encoremap && !(ldef->flags & ML_TFERLINE))
|
||||
dc->colormap += COLORMAP_REMAPOFFSET;
|
||||
|
||||
if (frontsector->extra_colormap)
|
||||
dc->colormap = frontsector->extra_colormap->colormap + (dc->colormap - colormaps);
|
||||
|
||||
sprtopscreen = centeryfrac - FixedMul(dc->texturemid, spryscale);
|
||||
dc->iscale = 0xffffffffu / (unsigned)spryscale;
|
||||
|
||||
// draw the texture
|
||||
col = (column_t *)((UINT8 *)R_GetColumn(texnum, colnum) - 3);
|
||||
|
||||
colfunc_2s(dc, col);
|
||||
}
|
||||
|
||||
// calculate lighting
|
||||
pindex = FixedMul(spryscale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT;
|
||||
|
||||
if (pindex >= MAXLIGHTSCALE)
|
||||
pindex = MAXLIGHTSCALE - 1;
|
||||
|
||||
dc->colormap = walllights[pindex];
|
||||
if (encoremap && !(ldef->flags & ML_TFERLINE))
|
||||
dc->colormap += COLORMAP_REMAPOFFSET;
|
||||
|
||||
if (frontsector->extra_colormap)
|
||||
dc->colormap = frontsector->extra_colormap->colormap + (dc->colormap - colormaps);
|
||||
|
||||
sprtopscreen = centeryfrac - FixedMul(dc->texturemid, spryscale);
|
||||
dc->iscale = 0xffffffffu / (unsigned)spryscale;
|
||||
|
||||
// draw the texture
|
||||
col = (column_t *)((UINT8 *)R_GetColumn(texnum, (maskedtexturecol[dc->x] >> FRACBITS)) - 3);
|
||||
|
||||
colfunc_2s(dc, col);
|
||||
|
||||
spryscale += rw_scalestep;
|
||||
}
|
||||
}
|
||||
@@ -651,7 +632,6 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
|
||||
void (*colfunc_2s) (drawcolumndata_t* dc, column_t *);
|
||||
|
||||
|
||||
// Calculate light table.
|
||||
// Use different light tables
|
||||
// for horizontal / vertical / diagonal. Diagonal?
|
||||
@@ -694,7 +674,7 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
fog = true;
|
||||
}
|
||||
|
||||
range = std::max<INT32>(drawseg->x2-drawseg->x1, 1);
|
||||
range = std::max(drawseg->x2-drawseg->x1, 1);
|
||||
//SoM: Moved these up here so they are available for my lightlist calculations
|
||||
rw_scalestep = drawseg->scalestep;
|
||||
spryscale = drawseg->scale1 + (x1 - drawseg->x1)*rw_scalestep;
|
||||
@@ -919,11 +899,14 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
// draw the columns
|
||||
for (dc->x = x1; dc->x <= x2; dc->x++)
|
||||
{
|
||||
if (maskedtexturecol[dc->x] == INT16_MAX)
|
||||
continue;
|
||||
|
||||
// skew FOF walls
|
||||
if (ffloortextureslide)
|
||||
{
|
||||
if (oldx != -1)
|
||||
dc->texturemid += FixedMul(ffloortextureslide, (maskedtexturecol[oldx]-maskedtexturecol[dc->x]));
|
||||
dc->texturemid += FixedMul(ffloortextureslide, (maskedtexturecol[oldx]-maskedtexturecol[dc->x])<<FRACBITS);
|
||||
oldx = dc->x;
|
||||
}
|
||||
|
||||
@@ -953,6 +936,9 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get data for the column
|
||||
col = (column_t *)((UINT8 *)R_GetColumn(texnum, maskedtexturecol[dc->x]) - 3);
|
||||
|
||||
if (!fog)
|
||||
{
|
||||
dc->iscale = 0xffffffffu / (unsigned)spryscale;
|
||||
@@ -963,9 +949,6 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
R_SetColumnFunc(BASEDRAWFUNC);
|
||||
}
|
||||
|
||||
// Get data for the column
|
||||
col = (column_t *)((UINT8 *)R_GetColumn(texnum, (maskedtexturecol[dc->x] >> FRACBITS)) - 3);
|
||||
|
||||
// SoM: New code does not rely on R_DrawColumnShadowed which
|
||||
// will (hopefully) put less strain on the stack.
|
||||
if (dc->numlights)
|
||||
@@ -1176,14 +1159,13 @@ static inline void R_ExpandPlaneY(visplane_t *pl, INT32 x, INT16 top, INT16 bott
|
||||
|
||||
static void R_DrawWallColumn(drawcolumndata_t* dc, INT32 yl, INT32 yh, fixed_t mid, fixed_t texturecolumn, INT32 texture, boolean remap)
|
||||
{
|
||||
const INT32 itexturecolumn = texturecolumn >> FRACBITS;
|
||||
dc->yl = yl;
|
||||
dc->yh = yh;
|
||||
dc->texturemid = mid;
|
||||
dc->source = R_GetColumn(texture, itexturecolumn);
|
||||
dc->source = R_GetColumn(texture, texturecolumn);
|
||||
dc->texheight = textureheight[texture] >> FRACBITS;
|
||||
dc->sourcelength = dc->texheight;
|
||||
R_SetColumnFunc(colfunctype);
|
||||
//R_SetColumnFunc(colfunctype);
|
||||
coldrawfunc_t* colfunccopy = colfunc;
|
||||
drawcolumndata_t dc_copy = *dc;
|
||||
if (remap)
|
||||
@@ -1209,21 +1191,13 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
||||
INT32 bottom;
|
||||
INT32 i;
|
||||
|
||||
if (midtexture)
|
||||
R_CheckTextureCache(midtexture);
|
||||
if (toptexture)
|
||||
R_CheckTextureCache(toptexture);
|
||||
if (bottomtexture)
|
||||
R_CheckTextureCache(bottomtexture);
|
||||
|
||||
// Loop over width
|
||||
for (; rw_x < rw_stopx; rw_x++)
|
||||
{
|
||||
// mark floor / ceiling areas
|
||||
yl = (topfrac+HEIGHTUNIT-1)>>HEIGHTBITS;
|
||||
yh = bottomfrac>>HEIGHTBITS;
|
||||
|
||||
// Mark ceiling
|
||||
// no space above wall?
|
||||
top = ceilingclip[rw_x]+1;
|
||||
|
||||
// no space above wall?
|
||||
@@ -1240,10 +1214,10 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
||||
}
|
||||
}
|
||||
|
||||
// Mark floor
|
||||
yh = bottomfrac>>HEIGHTBITS;
|
||||
|
||||
bottom = floorclip[rw_x]-1;
|
||||
|
||||
// no space below floor?
|
||||
if (yh > bottom)
|
||||
yh = bottom;
|
||||
|
||||
@@ -1372,7 +1346,7 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
||||
// calculate texture offset
|
||||
angle = (rw_centerangle + xtoviewangle[rw_x])>>ANGLETOFINESHIFT;
|
||||
// Mask 4095 to guarantee this index is within bounds
|
||||
texturecolumn = rw_offset-FixedMul(FINETANGENT(angle & 4095), rw_distance);
|
||||
texturecolumn = rw_offset-FixedMul(FINETANGENT(angle & 4095),rw_distance);
|
||||
|
||||
if (oldtexturecolumn != -1)
|
||||
{
|
||||
@@ -1383,6 +1357,8 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
||||
}
|
||||
oldtexturecolumn = texturecolumn;
|
||||
|
||||
texturecolumn >>= FRACBITS;
|
||||
|
||||
// texturecolumn and lighting are independent of wall tiers
|
||||
if (segtextured)
|
||||
{
|
||||
@@ -1539,7 +1515,7 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
||||
if (maskedtexture || numthicksides)
|
||||
{
|
||||
// save texturecol for backdrawing of masked mid texture
|
||||
maskedtexturecol[rw_x] = texturecolumn;
|
||||
maskedtexturecol[rw_x] = (INT16)texturecolumn;
|
||||
|
||||
if (maskedtextureheight != NULL)
|
||||
{
|
||||
@@ -1585,7 +1561,7 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
||||
|
||||
static void R_MarkSegBounds(void)
|
||||
{
|
||||
INT32 yl, yh;
|
||||
INT32 yl, yh;
|
||||
INT32 top, bottom;
|
||||
INT16 topclip, bottomclip;
|
||||
|
||||
@@ -1594,9 +1570,8 @@ static void R_MarkSegBounds(void)
|
||||
{
|
||||
// mark floor / ceiling areas
|
||||
yl = (topfrac+HEIGHTUNIT-1)>>HEIGHTBITS;
|
||||
yh = bottomfrac>>HEIGHTBITS;
|
||||
|
||||
// Mark ceiling
|
||||
// no space above wall?
|
||||
top = ceilingclip[rw_x]+1;
|
||||
|
||||
// no space above wall?
|
||||
@@ -1613,10 +1588,10 @@ static void R_MarkSegBounds(void)
|
||||
}
|
||||
}
|
||||
|
||||
// Mark floor
|
||||
yh = bottomfrac>>HEIGHTBITS;
|
||||
|
||||
bottom = floorclip[rw_x]-1;
|
||||
|
||||
// no space below floor?
|
||||
if (yh > bottom)
|
||||
yh = bottom;
|
||||
|
||||
@@ -1641,6 +1616,12 @@ static void R_MarkSegBounds(void)
|
||||
if (markfloor) // no bottom wall
|
||||
floorclip[rw_x] = bottomclip;
|
||||
|
||||
if (floorclip[rw_x] <= ceilingclip[rw_x] + 1)
|
||||
{
|
||||
solidcol[rw_x] = 1;
|
||||
didsolidcol = true;
|
||||
}
|
||||
|
||||
rw_scale += rw_scalestep;
|
||||
topfrac += topstep;
|
||||
bottomfrac += bottomstep;
|
||||
@@ -1682,87 +1663,15 @@ void R_AllocSegMemory(void)
|
||||
fixed_t *frontscale_p = frontscaletable;
|
||||
fixed_t *maskedheight_p = maskedheighttable;
|
||||
|
||||
for (drawseg_t *drawseg = drawsegs; drawseg < lastseg; drawseg++)
|
||||
for (drawseg_t *ds = drawsegs; ds < lastseg; ds++)
|
||||
{
|
||||
drawseg->frontscale = frontscale_p;
|
||||
drawseg->maskedtextureheight = maskedheight_p;
|
||||
ds->frontscale = frontscale_p;
|
||||
ds->maskedtextureheight = maskedheight_p;
|
||||
frontscale_p += viewwidth;
|
||||
maskedheight_p += viewwidth;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//SoM: Code to remove limits on openings.
|
||||
static void R_AllocClippingTables(size_t range)
|
||||
{
|
||||
size_t pos = lastopening - openings;
|
||||
size_t need = range * 2; // for both sprtopclip and sprbottomclip
|
||||
|
||||
if (pos + need < numopenings)
|
||||
return;
|
||||
|
||||
INT16 *oldopenings = openings;
|
||||
INT16 *oldlast = lastopening;
|
||||
|
||||
if (numopenings == 0)
|
||||
numopenings = 16384;
|
||||
|
||||
numopenings += need;
|
||||
openings = static_cast<INT16*>(Z_Realloc(openings, numopenings * sizeof (*openings), PU_STATIC, NULL));
|
||||
lastopening = openings + pos;
|
||||
|
||||
if (oldopenings == NULL)
|
||||
return;
|
||||
|
||||
// borrowed fix from *cough* zdoom *cough*
|
||||
// [RH] We also need to adjust the openings pointers that
|
||||
// were already stored in drawsegs.
|
||||
for (drawseg_t *drawseg = drawsegs; drawseg < ds_p; drawseg++)
|
||||
{
|
||||
// Check if it's in range of the openings
|
||||
#define CHECK(which) \
|
||||
if (which + drawseg->x1 >= oldopenings && which + drawseg->x1 <= oldlast) \
|
||||
which = (which - oldopenings) + openings
|
||||
CHECK(drawseg->sprtopclip);
|
||||
CHECK(drawseg->sprbottomclip);
|
||||
#undef CHECK
|
||||
}
|
||||
}
|
||||
|
||||
static void R_AllocTextureColumnTables(size_t range)
|
||||
{
|
||||
size_t pos = curtexturecolumntable - texturecolumntable;
|
||||
|
||||
// For both tables, we reserve exactly an amount of memory that's equivalent to
|
||||
// how many columns the seg will take on the entire screen (think about it)
|
||||
if (pos + range < texturecolumntablesize)
|
||||
return;
|
||||
|
||||
fixed_t *oldtable = texturecolumntable;
|
||||
fixed_t *oldlast = curtexturecolumntable;
|
||||
|
||||
if (texturecolumntablesize == 0)
|
||||
texturecolumntablesize = 16384;
|
||||
|
||||
texturecolumntablesize += range;
|
||||
texturecolumntable = static_cast<fixed_t*>(Z_Realloc(texturecolumntable, texturecolumntablesize * sizeof (*texturecolumntable), PU_STATIC, NULL));
|
||||
curtexturecolumntable = texturecolumntable + pos;
|
||||
|
||||
if (oldtable == NULL)
|
||||
return;
|
||||
|
||||
for (drawseg_t *drawseg = drawsegs; drawseg < ds_p; drawseg++)
|
||||
{
|
||||
// Check if it's in range of the tables
|
||||
#define CHECK(which) \
|
||||
if (which + drawseg->x1 >= oldtable && which + drawseg->x1 <= oldlast) \
|
||||
which = (which - oldtable) + texturecolumntable
|
||||
CHECK(drawseg->maskedtexturecol);
|
||||
CHECK(drawseg->thicksidecol);
|
||||
#undef CHECK
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// R_StoreWallRange
|
||||
// A wall segment will be drawn
|
||||
@@ -1775,13 +1684,12 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
angle_t distangle, offsetangle;
|
||||
boolean longboi;
|
||||
INT32 lightnum;
|
||||
INT32 i = 0, p;
|
||||
INT32 i, p;
|
||||
lightlist_t *light;
|
||||
r_lightlist_t *rlight;
|
||||
INT32 range;
|
||||
vertex_t segleft, segright;
|
||||
fixed_t ceilingfrontslide, floorfrontslide, ceilingbackslide, floorbackslide;
|
||||
const INT32 twosidedmidtexture = R_GetTextureNum(curline->sidedef->midtexture);
|
||||
drawcolumndata_t dc = {};
|
||||
|
||||
maskedtextureheight = NULL;
|
||||
@@ -1837,6 +1745,41 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
ds_p->curline = curline;
|
||||
rw_stopx = stop+1;
|
||||
|
||||
//SoM: Code to remove limits on openings.
|
||||
{
|
||||
size_t pos = lastopening - openings;
|
||||
size_t need = (rw_stopx - start)*4 + pos;
|
||||
|
||||
if (need > maxopenings)
|
||||
{
|
||||
drawseg_t *ds; //needed for fix from *cough* zdoom *cough*
|
||||
INT16 *oldopenings = openings;
|
||||
INT16 *oldlast = lastopening;
|
||||
|
||||
do
|
||||
maxopenings = maxopenings ? maxopenings*2 : 16384;
|
||||
while (need > maxopenings);
|
||||
openings = static_cast<INT16*>(Z_Realloc(openings, maxopenings * sizeof (*openings), PU_STATIC, NULL));
|
||||
lastopening = openings + pos;
|
||||
|
||||
if (oldopenings == NULL)
|
||||
return;
|
||||
|
||||
// borrowed fix from *cough* zdoom *cough*
|
||||
// [RH] We also need to adjust the openings pointers that
|
||||
// were already stored in drawsegs.
|
||||
for (ds = drawsegs; ds < ds_p; ds++)
|
||||
{
|
||||
#define ADJUST(p) if (ds->p + ds->x1 >= oldopenings && ds->p + ds->x1 <= oldlast) ds->p = (ds->p - oldopenings) + openings;
|
||||
ADJUST(maskedtexturecol);
|
||||
ADJUST(sprtopclip);
|
||||
ADJUST(sprbottomclip);
|
||||
ADJUST(thicksidecol);
|
||||
#undef ADJUST
|
||||
}
|
||||
}
|
||||
} // end of code to remove limits on openings
|
||||
|
||||
// calculate scale at both ends and step
|
||||
ds_p->scale1 = rw_scale = R_ScaleFromGlobalAngle(viewangle + xtoviewangle[start]);
|
||||
|
||||
@@ -1931,7 +1874,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
|
||||
numbackffloors = 0;
|
||||
|
||||
memset(ds_p->thicksides, 0, MAXFFLOORS * sizeof(*ds_p->thicksides));
|
||||
for (i = 0; i < MAXFFLOORS; i++)
|
||||
ds_p->thicksides[i] = NULL;
|
||||
|
||||
if (numffloors)
|
||||
{
|
||||
@@ -2216,8 +2160,6 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
rw_toptexturemid += sidedef->rowoffset;
|
||||
rw_bottomtexturemid += sidedef->rowoffset;
|
||||
|
||||
R_AllocTextureColumnTables(rw_stopx - start);
|
||||
|
||||
// allocate space for masked texture tables
|
||||
if (frontsector && backsector && (frontsector->tag != backsector->tag) && (backsector->ffloors || frontsector->ffloors))
|
||||
{
|
||||
@@ -2231,8 +2173,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
|
||||
maskedtexture = true;
|
||||
|
||||
ds_p->thicksidecol = maskedtexturecol = curtexturecolumntable - rw_x;
|
||||
curtexturecolumntable += rw_stopx - rw_x;
|
||||
ds_p->thicksidecol = maskedtexturecol = lastopening - rw_x;
|
||||
lastopening += rw_stopx - rw_x;
|
||||
|
||||
lowcut = std::max(worldbottom, worldlow) + viewz;
|
||||
highcut = std::min(worldtop, worldhigh) + viewz;
|
||||
@@ -2411,14 +2353,13 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
ds_p->numthicksides = numthicksides = i;
|
||||
}
|
||||
|
||||
if (twosidedmidtexture)
|
||||
if (sidedef->midtexture > 0 && sidedef->midtexture < numtextures)
|
||||
{
|
||||
// masked midtexture
|
||||
|
||||
if (!ds_p->thicksidecol)
|
||||
{
|
||||
ds_p->maskedtexturecol = maskedtexturecol = curtexturecolumntable - rw_x;
|
||||
curtexturecolumntable += rw_stopx - rw_x;
|
||||
ds_p->maskedtexturecol = maskedtexturecol = lastopening - rw_x;
|
||||
lastopening += rw_stopx - rw_x;
|
||||
}
|
||||
else
|
||||
ds_p->maskedtexturecol = ds_p->thicksidecol;
|
||||
@@ -2998,23 +2939,18 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
}
|
||||
|
||||
// save sprite clipping info
|
||||
if (maskedtexture || (ds_p->silhouette & (SIL_TOP | SIL_BOTTOM)))
|
||||
if (((ds_p->silhouette & SIL_TOP) || maskedtexture) && !ds_p->sprtopclip)
|
||||
{
|
||||
R_AllocClippingTables(rw_stopx - start);
|
||||
M_Memcpy(lastopening, ceilingclip+start, 2*(rw_stopx - start));
|
||||
ds_p->sprtopclip = lastopening - start;
|
||||
lastopening += rw_stopx - start;
|
||||
}
|
||||
|
||||
if (((ds_p->silhouette & SIL_TOP) || maskedtexture) && !ds_p->sprtopclip)
|
||||
{
|
||||
M_Memcpy(lastopening, ceilingclip + start, 2*(rw_stopx - start));
|
||||
ds_p->sprtopclip = lastopening - start;
|
||||
lastopening += rw_stopx - start;
|
||||
}
|
||||
|
||||
if (((ds_p->silhouette & SIL_BOTTOM) || maskedtexture) && !ds_p->sprbottomclip)
|
||||
{
|
||||
M_Memcpy(lastopening, floorclip + start, 2*(rw_stopx - start));
|
||||
ds_p->sprbottomclip = lastopening - start;
|
||||
lastopening += rw_stopx - start;
|
||||
}
|
||||
if (((ds_p->silhouette & SIL_BOTTOM) || maskedtexture) && !ds_p->sprbottomclip)
|
||||
{
|
||||
M_Memcpy(lastopening, floorclip + start, 2*(rw_stopx-start));
|
||||
ds_p->sprbottomclip = lastopening - start;
|
||||
lastopening += rw_stopx - start;
|
||||
}
|
||||
|
||||
if (maskedtexture)
|
||||
@@ -3022,13 +2958,13 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
if (!(ds_p->silhouette & SIL_TOP))
|
||||
{
|
||||
ds_p->silhouette |= SIL_TOP;
|
||||
ds_p->tsilheight = (twosidedmidtexture) ? INT32_MIN : INT32_MAX;
|
||||
ds_p->tsilheight = (sidedef->midtexture > 0 && sidedef->midtexture < numtextures) ? INT32_MIN: INT32_MAX;
|
||||
}
|
||||
|
||||
if (!(ds_p->silhouette & SIL_BOTTOM))
|
||||
{
|
||||
ds_p->silhouette |= SIL_BOTTOM;
|
||||
ds_p->bsilheight = (twosidedmidtexture) ? INT32_MAX : INT32_MIN;
|
||||
ds_p->bsilheight = (sidedef->midtexture > 0 && sidedef->midtexture < numtextures) ? INT32_MAX: INT32_MIN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ extern "C" {
|
||||
void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2);
|
||||
void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pffloor);
|
||||
void R_StoreWallRange(INT32 start, INT32 stop);
|
||||
void R_ClearSegTables(void);
|
||||
|
||||
void R_AllocSegMemory(void);
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
#ifndef __R_SKINS__
|
||||
#define __R_SKINS__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
+9
-8
@@ -94,6 +94,13 @@ static drawseg_xrange_item_t *drawsegs_xrange;
|
||||
static size_t drawsegs_xrange_size = 0;
|
||||
static INT32 drawsegs_xrange_count = 0;
|
||||
|
||||
INT32 R_ThingLightLevel(mobj_t* thing)
|
||||
{
|
||||
INT32 lightlevel = thing->lightlevel;
|
||||
|
||||
return lightlevel;
|
||||
}
|
||||
|
||||
//
|
||||
// Sprite rotation 0 is facing the viewer,
|
||||
// rotation 1 is one angle turn CLOCKWISE around the axis.
|
||||
@@ -305,7 +312,7 @@ boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, UINT16
|
||||
|
||||
// store sprite info in lookup tables
|
||||
//FIXME : numspritelumps do not duplicate sprite replacements
|
||||
W_ReadLumpHeaderPwad(wadnum, l, &patch, PNG_HEADER_SIZE, 0);
|
||||
W_ReadLumpHeaderPwad(wadnum, l, &patch, (sizeof(INT16) *4), 0);
|
||||
spritecachedinfo[numspritelumps].width = (INT32)(SHORT(patch.width))<<FRACBITS;
|
||||
spritecachedinfo[numspritelumps].offset = (INT32)(SHORT(patch.leftoffset))<<FRACBITS;
|
||||
spritecachedinfo[numspritelumps].topoffset = (INT32)(SHORT(patch.topoffset))<<FRACBITS;
|
||||
@@ -2242,13 +2249,11 @@ static void R_CreateDrawNodes(maskcount_t* mask, drawnode_t* head, boolean temps
|
||||
}
|
||||
ds->curline->polyseg->visplane = NULL;
|
||||
}
|
||||
|
||||
if (ds->maskedtexturecol)
|
||||
{
|
||||
entry = R_CreateDrawNode(head);
|
||||
entry->seg = ds;
|
||||
}
|
||||
|
||||
if (ds->numffloorplanes)
|
||||
{
|
||||
for (i = 0; i < ds->numffloorplanes; i++)
|
||||
@@ -2819,7 +2824,6 @@ void R_ClipSprites(drawseg_t* dsstart, portal_t* portal)
|
||||
|
||||
if (drawsegs_xrange_size < maxdrawsegs)
|
||||
{
|
||||
// haleyjd: fix reallocation to track 2x size
|
||||
drawsegs_xrange_size = 2 * maxdrawsegs;
|
||||
|
||||
for (i = 0; i < DS_RANGES_COUNT; i++)
|
||||
@@ -2859,9 +2863,6 @@ void R_ClipSprites(drawseg_t* dsstart, portal_t* portal)
|
||||
}
|
||||
}
|
||||
|
||||
// haleyjd: terminate with a nullptr user for faster loop - adds ~3 FPS
|
||||
drawsegs_xranges[0].items[drawsegs_xranges[0].count].user = nullptr;
|
||||
|
||||
for (; clippedvissprites < visspritecount; clippedvissprites++)
|
||||
{
|
||||
vissprite_t *spr = R_GetVisSprite(clippedvissprites);
|
||||
@@ -3027,7 +3028,7 @@ static void R_DrawMaskedList(drawnode_t* head)
|
||||
else if (r2->seg && r2->seg->maskedtexturecol != NULL)
|
||||
{
|
||||
next = r2->prev;
|
||||
R_RenderMaskedSegRange(r2->seg, r2->seg->x1, r2->seg->x2);
|
||||
R_RenderMaskedSegRange( r2->seg, r2->seg->x1, r2->seg->x2);
|
||||
r2->seg->maskedtexturecol = NULL;
|
||||
R_DoneWithNode(r2);
|
||||
r2 = next;
|
||||
|
||||
+5
-8
@@ -23,10 +23,10 @@ extern "C" {
|
||||
|
||||
// number of sprite lumps for spritewidth,offset,topoffset lookup tables
|
||||
// Fab: this is a hack : should allocate the lookup tables per sprite
|
||||
#if __SIZEOF_POINTER__ < 8
|
||||
#define MAXVISSPRITES 2048 // added 2-2-98 was 128
|
||||
#if defined(__x86_64__) || defined(__amd64__) || defined(__aarch64__) || defined(__arm64__) // only for 64bit (idk how else to proper check lmao)
|
||||
#define MAXVISSPRITES 4096
|
||||
#else
|
||||
#define MAXVISSPRITES 4096 // only for 64bit
|
||||
#define MAXVISSPRITES 2048 // added 2-2-98 was 128
|
||||
#endif
|
||||
|
||||
#define VISSPRITECHUNKBITS 6 // 2^6 = 64 sprites per chunk
|
||||
@@ -63,10 +63,7 @@ extern fixed_t windowtop;
|
||||
extern fixed_t windowbottom;
|
||||
extern INT32 lengthcol;
|
||||
|
||||
FUNCINLINE static ATTRINLINE INT32 R_ThingLightLevel(mobj_t* thing)
|
||||
{
|
||||
return (INT32)thing->lightlevel;
|
||||
}
|
||||
INT32 R_ThingLightLevel(mobj_t *thing);
|
||||
fixed_t R_GetSpriteDirectionalLighting(angle_t angle);
|
||||
|
||||
fixed_t R_GetShadowZ(mobj_t *thing, pslope_t **shadowslope);
|
||||
@@ -86,7 +83,7 @@ typedef struct
|
||||
{
|
||||
size_t drawsegs[2];
|
||||
size_t vissprites[2];
|
||||
fixed_t viewx, viewy, viewz; /**< View z stored at the time of the BSP traversal for the view/portal. Masked sorting/drawing needs it. */
|
||||
fixed_t viewx, viewy, viewz; /**< View z stored at the time of the BSP traversal for the view/portal. Masked sorting/drawing needs it. */
|
||||
sector_t* viewsector;
|
||||
} maskcount_t;
|
||||
|
||||
|
||||
+62
-84
@@ -400,97 +400,74 @@ void SCR_CalculateFPS(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void SCR_DrawOldTicRate(UINT32 cap, UINT32 benchmark, double fps, INT32 fpsflags)
|
||||
{
|
||||
const char *fps_string;
|
||||
INT32 ticcntcolor = 0;
|
||||
|
||||
if (fps > (benchmark - 5))
|
||||
ticcntcolor = V_GREENMAP;
|
||||
else if (fps < 20)
|
||||
ticcntcolor = V_REDMAP;
|
||||
|
||||
if (cap != 0)
|
||||
fps_string = va("%d/%d\x82", (INT32)fps, cap);
|
||||
else
|
||||
fps_string = va("%d\x82", (INT32)fps);
|
||||
|
||||
// draw "FPS"
|
||||
if (cv_ticrate.value == 3)
|
||||
V_DrawRightAlignedString(319, 181, V_YELLOWMAP|fpsflags, "FPS");
|
||||
|
||||
V_DrawRightAlignedString(319, 190, ticcntcolor|fpsflags, fps_string);
|
||||
}
|
||||
|
||||
static void SCR_DrawKartTicRate(UINT32 cap, UINT32 benchmark, double fps, INT32 fpsflags)
|
||||
{
|
||||
UINT8 *ticcntcolor = NULL;
|
||||
INT32 x = 318;
|
||||
|
||||
// draw "FPS"
|
||||
if (cv_ticrate.value == 1)
|
||||
{
|
||||
ticcntcolor = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_YELLOW, GTC_CACHE);
|
||||
V_DrawFixedPatch(306<<FRACBITS, 183<<FRACBITS, FRACUNIT, fpsflags, framecounter, ticcntcolor);
|
||||
}
|
||||
|
||||
if (fps > (benchmark - 5))
|
||||
ticcntcolor = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_MINT, GTC_CACHE);
|
||||
else if (fps < 20)
|
||||
ticcntcolor = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_RASPBERRY, GTC_CACHE);
|
||||
else
|
||||
ticcntcolor = NULL;
|
||||
|
||||
if (cap != 0)
|
||||
{
|
||||
UINT32 digits = 1;
|
||||
UINT32 c2 = cap;
|
||||
|
||||
while (c2 > 0)
|
||||
{
|
||||
c2 = c2 / 10;
|
||||
digits++;
|
||||
}
|
||||
|
||||
// draw total frame:
|
||||
V_DrawPingNum(x, 190, fpsflags, cap, ticcntcolor);
|
||||
|
||||
x -= digits * 4;
|
||||
|
||||
// draw "/"
|
||||
V_DrawFixedPatch(x<<FRACBITS, 190<<FRACBITS, FRACUNIT, fpsflags, frameslash, ticcntcolor);
|
||||
}
|
||||
|
||||
// draw our actual framerate
|
||||
V_DrawPingNum(x, 190, fpsflags, fps, ticcntcolor);
|
||||
}
|
||||
|
||||
void SCR_DisplayTicRate(void)
|
||||
{
|
||||
UINT32 cap, benchmark;
|
||||
double fps;
|
||||
INT32 fpsflags;
|
||||
UINT32 cap = R_GetFramerateCap();
|
||||
UINT32 benchmark = (cap == 0) ? I_GetRefreshRate() : cap;
|
||||
double fps = round(averageFPS);
|
||||
INT32 fpsflags = V_LocalTransFlag()|V_SNAPTOBOTTOM|V_SNAPTORIGHT;
|
||||
|
||||
if (gamestate == GS_NULL)
|
||||
return;
|
||||
|
||||
cap = R_GetFramerateCap();
|
||||
benchmark = (cap == 0) ? I_GetRefreshRate() : cap;
|
||||
fps = round(averageFPS);
|
||||
fpsflags = V_LocalTransFlag()|V_SNAPTOBOTTOM|V_SNAPTORIGHT;
|
||||
|
||||
switch (cv_ticrate.value)
|
||||
// new kart counter
|
||||
if (cv_ticrate.value == 1 || cv_ticrate.value == 2)
|
||||
{
|
||||
case 1: // new kart counter
|
||||
case 2:
|
||||
SCR_DrawKartTicRate(cap, benchmark, fps, fpsflags);
|
||||
break;
|
||||
case 3: // kart v1.0/srb2 counter
|
||||
case 4:
|
||||
SCR_DrawOldTicRate(cap, benchmark, fps, fpsflags);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
const UINT8 *ticcntcolor = NULL;
|
||||
INT32 x = 318;
|
||||
|
||||
// draw "FPS"
|
||||
if (cv_ticrate.value == 1)
|
||||
V_DrawFixedPatch(306<<FRACBITS, 183<<FRACBITS, FRACUNIT, fpsflags, framecounter, R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_YELLOW, GTC_CACHE));
|
||||
|
||||
if (fps > (benchmark - 5))
|
||||
ticcntcolor = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_MINT, GTC_CACHE);
|
||||
else if (fps < 20)
|
||||
ticcntcolor = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_RASPBERRY, GTC_CACHE);
|
||||
|
||||
if (cap != 0)
|
||||
{
|
||||
UINT32 digits = 1;
|
||||
UINT32 c2 = cap;
|
||||
|
||||
while (c2 > 0)
|
||||
{
|
||||
c2 = c2 / 10;
|
||||
digits++;
|
||||
}
|
||||
|
||||
// draw total frame:
|
||||
V_DrawPingNum(x, 190, fpsflags, cap, ticcntcolor);
|
||||
|
||||
x -= digits * 4;
|
||||
|
||||
// draw "/"
|
||||
V_DrawFixedPatch(x<<FRACBITS, 190<<FRACBITS, FRACUNIT, fpsflags, frameslash, ticcntcolor);
|
||||
}
|
||||
|
||||
// draw our actual framerate
|
||||
V_DrawPingNum(x, 190, fpsflags, fps, ticcntcolor);
|
||||
}
|
||||
else if (cv_ticrate.value == 3 || cv_ticrate.value == 4) // kart v1.0/srb2 counter
|
||||
{
|
||||
const char *fps_string;
|
||||
INT32 ticcntcolor2 = 0;
|
||||
|
||||
if (fps > (benchmark - 5))
|
||||
ticcntcolor2 = V_GREENMAP;
|
||||
else if (fps < 20)
|
||||
ticcntcolor2 = V_REDMAP;
|
||||
|
||||
if (cap != 0)
|
||||
fps_string = va("%d/%d\x82", (INT32)fps, cap);
|
||||
else
|
||||
fps_string = va("%d\x82", (INT32)fps);
|
||||
|
||||
// draw "FPS"
|
||||
if (cv_ticrate.value == 3)
|
||||
V_DrawRightAlignedString(319, 181, V_YELLOWMAP|fpsflags, "FPS");
|
||||
|
||||
V_DrawRightAlignedString(319, 190, ticcntcolor2|fpsflags, fps_string);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -505,6 +482,7 @@ void SCR_DisplayLocalPing(void)
|
||||
if (cv_showping.value == 1 || (cv_showping.value == 2 && ping > servermaxping)) // only show 2 (warning) if our ping is at a bad level
|
||||
{
|
||||
INT32 dispy = (cv_ticrate.value == 1) ? 165 : ((cv_ticrate.value == 2 || cv_ticrate.value == 4) ? 172 : ((cv_ticrate.value == 3) ? 163 : 181)); // absolute buttpain
|
||||
|
||||
HU_drawPlayerPing(308, dispy, consoleplayer, pingflags); // consoleplayer's ping is everyone's ping in a splitnetgame :P
|
||||
}
|
||||
}
|
||||
+118
-120
@@ -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
|
||||
@@ -2021,7 +2019,7 @@ FUNCIERROR void ATTRNORETURN I_Error(const char *error, ...)
|
||||
if (errorcount > 20)
|
||||
{
|
||||
va_start(argptr, error);
|
||||
vsnprintf(buffer, 8192, error, argptr);
|
||||
vsprintf(buffer, error, argptr);
|
||||
va_end(argptr);
|
||||
// Implement message box with SDL_ShowSimpleMessageBox,
|
||||
// which should fail gracefully if it can't put a message box up
|
||||
@@ -2039,7 +2037,7 @@ FUNCIERROR void ATTRNORETURN I_Error(const char *error, ...)
|
||||
|
||||
// Display error message in the console before we start shutting it down
|
||||
va_start(argptr, error);
|
||||
vsnprintf(buffer, 8192, error, argptr);
|
||||
vsprintf(buffer, error, argptr);
|
||||
va_end(argptr);
|
||||
I_OutputMsg("\nI_Error(): %s\n", buffer);
|
||||
|
||||
|
||||
+10
-18
@@ -1304,7 +1304,7 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
|
||||
SDL_DestroyTexture(texture);
|
||||
}
|
||||
|
||||
texture = SDL_CreateTexture(renderer, sw_texture_format, SDL_TEXTUREACCESS_STREAMING, height, width);
|
||||
texture = SDL_CreateTexture(renderer, sw_texture_format, SDL_TEXTUREACCESS_STREAMING, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1339,7 +1339,6 @@ void I_UpdateNoBlit(void)
|
||||
// I_FinishUpdate
|
||||
//
|
||||
static SDL_Rect src_rect = { 0, 0, 0, 0 };
|
||||
static SDL_Rect dst_rect = { 0, 0, 0, 0 };
|
||||
|
||||
void I_FinishUpdate(void)
|
||||
{
|
||||
@@ -1369,13 +1368,13 @@ void I_FinishUpdate(void)
|
||||
void *pixels;
|
||||
int pitch;
|
||||
SDL_LockTexture(texture, NULL, &pixels, &pitch);
|
||||
int step = pitch / 4 - vid.height;
|
||||
int step = pitch / 4 - vid.width;
|
||||
UINT32 *restrict dst = pixels;
|
||||
UINT8 *restrict src = vid.screens[0];
|
||||
UINT32 *restrict palette = localPalette;
|
||||
for (INT32 y = 0; y < vid.width; y++)
|
||||
for (INT32 y = 0; y < vid.height; y++)
|
||||
{
|
||||
UINT8 *restrict end = src + vid.height;
|
||||
UINT8 *restrict end = src + vid.width;
|
||||
do *dst++ = palette[*src++];
|
||||
while (src < end);
|
||||
dst += step;
|
||||
@@ -1383,8 +1382,7 @@ void I_FinishUpdate(void)
|
||||
SDL_UnlockTexture(texture);
|
||||
|
||||
SDL_RenderClear(renderer);
|
||||
//SDL_RenderCopy(renderer, texture, &src_rect, NULL);
|
||||
SDL_RenderCopyEx(renderer, texture, NULL, &dst_rect, 90.0, NULL, SDL_FLIP_VERTICAL);
|
||||
SDL_RenderCopy(renderer, texture, &src_rect, NULL);
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
#ifdef HWRENDER
|
||||
@@ -1415,17 +1413,18 @@ void I_ReadScreen(UINT8 * restrict scr, INT32 scale)
|
||||
{
|
||||
if (rendermode != render_soft)
|
||||
I_Error("I_ReadScreen: called while in non-software mode");
|
||||
else if (scale == 1)
|
||||
VID_BlitLinearScreen(vid.screens[0], scr, vid.width, vid.height, vid.width, vid.width);
|
||||
else
|
||||
{
|
||||
UINT8 * restrict source = vid.screens[0];
|
||||
|
||||
uintptr_t w = vid.width/scale*scale, h = vid.height/scale*scale;
|
||||
|
||||
// size_t saves a lea + movsxd over INT32. mind your types!
|
||||
// uintptr_t is even better since it's guaranteed to be the size of a pointer
|
||||
for (uintptr_t y = 0; y < h; y += scale)
|
||||
for (uintptr_t x = 0; x < w; x += scale)
|
||||
*scr++ = source[x*vid.height + y];
|
||||
*scr++ = source[y*vid.width + x];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1563,15 +1562,8 @@ INT32 VID_SetMode(INT32 modeNum)
|
||||
|
||||
SDLSetMode(vid.width, vid.height, USE_FULLSCREEN);
|
||||
|
||||
src_rect.w = vid.height;
|
||||
src_rect.h = vid.width;
|
||||
|
||||
|
||||
dst_rect.x = (vid.width - vid.height) / 2;
|
||||
dst_rect.y = (vid.height - vid.width) / 2;
|
||||
dst_rect.w = vid.height;
|
||||
dst_rect.h = vid.width;
|
||||
|
||||
src_rect.w = vid.width;
|
||||
src_rect.h = vid.height;
|
||||
|
||||
refresh_rate = VID_GetRefreshRate();
|
||||
|
||||
|
||||
+130
-196
@@ -614,9 +614,9 @@ static void CV_constextsize_OnChange(void)
|
||||
// --------------------------------------------------------------------------
|
||||
void VID_BlitLinearScreen(const UINT8 *restrict srcptr, UINT8 *restrict destptr, INT32 width, INT32 height, size_t srcrowbytes, size_t destrowbytes)
|
||||
{
|
||||
if (srcrowbytes == destrowbytes && srcrowbytes == (size_t)height)
|
||||
if (srcrowbytes == destrowbytes && srcrowbytes == (size_t)width)
|
||||
{
|
||||
size_t i = srcrowbytes * width;
|
||||
size_t i = srcrowbytes * height;
|
||||
#if defined(__SSE__)
|
||||
while (i >= 16)
|
||||
{
|
||||
@@ -631,9 +631,9 @@ void VID_BlitLinearScreen(const UINT8 *restrict srcptr, UINT8 *restrict destptr,
|
||||
}
|
||||
else
|
||||
{
|
||||
while (width--)
|
||||
while (height--)
|
||||
{
|
||||
M_Memcpy(destptr, srcptr, height);
|
||||
M_Memcpy(destptr, srcptr, width);
|
||||
|
||||
destptr += destrowbytes;
|
||||
srcptr += srcrowbytes;
|
||||
@@ -663,7 +663,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
|
||||
fixed_t col, ofs, colfrac, rowfrac, fdup, vdup;
|
||||
INT32 dup;
|
||||
const column_t *column;
|
||||
UINT8 *desttop, *dest/*, *deststart, *destend*/;
|
||||
UINT8 *desttop, *dest, *deststart, *destend;
|
||||
const UINT8 *source, *deststop;
|
||||
fixed_t pwidth; // patch width
|
||||
fixed_t offx = 0; // x offset
|
||||
@@ -791,10 +791,13 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
|
||||
if (!desttop)
|
||||
return;
|
||||
|
||||
deststop = desttop + vid.width * vid.height;
|
||||
|
||||
if (scrn & V_NOSCALESTART)
|
||||
{
|
||||
x >>= FRACBITS;
|
||||
y >>= FRACBITS;
|
||||
desttop += (y*vid.width) + x;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -840,8 +843,9 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
|
||||
y += (vid.height - (BASEVIDHEIGHT * dup)) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
desttop += (y*vid.width) + x;
|
||||
}
|
||||
desttop += (x*vid.height) + y;
|
||||
|
||||
if (pscale != FRACUNIT) // scale width properly
|
||||
{
|
||||
@@ -853,29 +857,29 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
|
||||
else
|
||||
pwidth = patch->width * dup;
|
||||
|
||||
//deststart = desttop;
|
||||
//destend = desttop + pwidth*vid.height;
|
||||
deststart = desttop;
|
||||
destend = desttop + pwidth;
|
||||
|
||||
for (col = 0; (col>>FRACBITS) < patch->width; col += colfrac, ++offx, desttop += vid.height)
|
||||
const INT32 stride = vid.width;
|
||||
|
||||
for (col = 0; (col>>FRACBITS) < patch->width; col += colfrac, ++offx, desttop++)
|
||||
{
|
||||
INT32 topdelta, prevdelta = -1;
|
||||
if (scrn & V_FLIP) // offx is measured from right edge instead of left
|
||||
{
|
||||
if (x+pwidth-offx < 0) // don't draw off the left of the screen (WRAP PREVENTION)
|
||||
break;
|
||||
if (x+pwidth-offx >= vid.width) // don't draw off the right of the screen (WRAP PREVENTION)
|
||||
if (x+pwidth-offx >= stride) // don't draw off the right of the screen (WRAP PREVENTION)
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (x+offx < 0) // don't draw off the left of the screen (WRAP PREVENTION)
|
||||
continue;
|
||||
if (x+offx >= vid.width) // don't draw off the right of the screen (WRAP PREVENTION)
|
||||
if (x+offx >= stride) // don't draw off the right of the screen (WRAP PREVENTION)
|
||||
break;
|
||||
}
|
||||
|
||||
INT32 realcol = (scrn & V_FLIP) ? ((patch->width-(col>>FRACBITS)-1)<<FRACBITS) : col;
|
||||
column = (const column_t *)((const UINT8 *)(patch->columns) + (patch->columnofs[realcol>>FRACBITS]));
|
||||
column = (const column_t *)((const UINT8 *)(patch->columns) + (patch->columnofs[col>>FRACBITS]));
|
||||
|
||||
switch (patchdrawtype)
|
||||
{
|
||||
@@ -888,16 +892,15 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
|
||||
prevdelta = topdelta;
|
||||
source = (const UINT8 *)(column) + 3;
|
||||
dest = desttop;
|
||||
dest += FixedInt(FixedMul(topdelta<<FRACBITS,vdup));
|
||||
if (scrn & V_FLIP)
|
||||
dest = deststart + (destend - desttop);
|
||||
dest += FixedInt(FixedMul(topdelta<<FRACBITS,vdup))*stride;
|
||||
|
||||
UINT8 *col_start = vid.screens[0] + ((x + offx)*vid.height);
|
||||
deststop = col_start + vid.height;
|
||||
|
||||
for (ofs = 0; dest < deststop && (size_t)(ofs>>FRACBITS) < column->length; ofs += rowfrac)
|
||||
for (ofs = 0; dest < deststop && (ofs>>FRACBITS) < column->length; ofs += rowfrac)
|
||||
{
|
||||
if (dest >= col_start) // don't draw off the top of the screen (CRASH PREVENTION)
|
||||
if (dest >= vid.screens[scrn&V_PARAMMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
|
||||
*dest = source[ofs>>FRACBITS];
|
||||
dest++;
|
||||
dest += stride;
|
||||
}
|
||||
column = (const column_t *)((const UINT8 *)column + column->length + 4);
|
||||
}
|
||||
@@ -912,16 +915,15 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
|
||||
prevdelta = topdelta;
|
||||
source = (const UINT8 *)(column) + 3;
|
||||
dest = desttop;
|
||||
dest += FixedInt(FixedMul(topdelta<<FRACBITS,vdup));
|
||||
if (scrn & V_FLIP)
|
||||
dest = deststart + (destend - desttop);
|
||||
dest += FixedInt(FixedMul(topdelta<<FRACBITS,vdup))*stride;
|
||||
|
||||
UINT8 *col_start = vid.screens[0] + ((x + offx)*vid.height);
|
||||
deststop = col_start + vid.height;
|
||||
|
||||
for (ofs = 0; dest < deststop && (size_t)(ofs>>FRACBITS) < column->length; ofs += rowfrac)
|
||||
for (ofs = 0; dest < deststop && (ofs>>FRACBITS) < column->length; ofs += rowfrac)
|
||||
{
|
||||
if (dest >= col_start) // don't draw off the top of the screen (CRASH PREVENTION)
|
||||
if (dest >= vid.screens[scrn&V_PARAMMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
|
||||
*dest = *(v_colormap + source[ofs>>FRACBITS]);
|
||||
dest++;
|
||||
dest += stride;
|
||||
}
|
||||
column = (const column_t *)((const UINT8 *)column + column->length + 4);
|
||||
}
|
||||
@@ -936,16 +938,15 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
|
||||
prevdelta = topdelta;
|
||||
source = (const UINT8 *)(column) + 3;
|
||||
dest = desttop;
|
||||
dest += FixedInt(FixedMul(topdelta<<FRACBITS,vdup));
|
||||
if (scrn & V_FLIP)
|
||||
dest = deststart + (destend - desttop);
|
||||
dest += FixedInt(FixedMul(topdelta<<FRACBITS,vdup))*stride;
|
||||
|
||||
UINT8 *col_start = vid.screens[0] + ((x + offx)*vid.height);
|
||||
deststop = col_start + vid.height;
|
||||
|
||||
for (ofs = 0; dest < deststop && (size_t)(ofs>>FRACBITS) < column->length; ofs += rowfrac)
|
||||
for (ofs = 0; dest < deststop && (ofs>>FRACBITS) < column->length; ofs += rowfrac)
|
||||
{
|
||||
if (dest >= col_start) // don't draw off the top of the screen (CRASH PREVENTION)
|
||||
if (dest >= vid.screens[scrn&V_PARAMMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
|
||||
*dest = *(v_translevel + ((source[ofs>>FRACBITS]<<8)&0xff00) + (*dest&0xff));
|
||||
dest++;
|
||||
dest += stride;
|
||||
}
|
||||
column = (const column_t *)((const UINT8 *)column + column->length + 4);
|
||||
}
|
||||
@@ -960,16 +961,15 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
|
||||
prevdelta = topdelta;
|
||||
source = (const UINT8 *)(column) + 3;
|
||||
dest = desttop;
|
||||
dest += FixedInt(FixedMul(topdelta<<FRACBITS,vdup));
|
||||
if (scrn & V_FLIP)
|
||||
dest = deststart + (destend - desttop);
|
||||
dest += FixedInt(FixedMul(topdelta<<FRACBITS,vdup))*stride;
|
||||
|
||||
UINT8 *col_start = vid.screens[0] + ((x + offx)*vid.height);
|
||||
deststop = col_start + vid.height;
|
||||
|
||||
for (ofs = 0; dest < deststop && (size_t)(ofs>>FRACBITS) < column->length; ofs += rowfrac)
|
||||
for (ofs = 0; dest < deststop && (ofs>>FRACBITS) < column->length; ofs += rowfrac)
|
||||
{
|
||||
if (dest >= col_start) // don't draw off the top of the screen (CRASH PREVENTION)
|
||||
if (dest >= vid.screens[scrn&V_PARAMMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
|
||||
*dest = *(v_translevel + (((*(v_colormap + source[ofs>>FRACBITS]))<<8)&0xff00) + (*dest&0xff));
|
||||
dest++;
|
||||
dest += stride;
|
||||
}
|
||||
column = (const column_t *)((const UINT8 *)column + column->length + 4);
|
||||
}
|
||||
@@ -1039,10 +1039,13 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
|
||||
if (!desttop)
|
||||
return;
|
||||
|
||||
deststop = desttop + vid.width * vid.height;
|
||||
|
||||
if (scrn & V_NOSCALESTART)
|
||||
{
|
||||
x >>= FRACBITS;
|
||||
y >>= FRACBITS;
|
||||
desttop += (y*vid.width) + x;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1076,18 +1079,20 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
|
||||
y += (vid.height - (BASEVIDHEIGHT * vid.dup)) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
desttop += (y*vid.width) + x;
|
||||
}
|
||||
|
||||
desttop += (y*vid.width) + x;
|
||||
const INT32 stride = vid.width;
|
||||
|
||||
for (col = sx<<FRACBITS; (col>>FRACBITS) < patch->width && ((col>>FRACBITS) - sx) < w; col += colfrac, ++x, desttop += vid.height)
|
||||
for (col = sx<<FRACBITS; (col>>FRACBITS) < patch->width && ((col>>FRACBITS) - sx) < w; col += colfrac, ++x, desttop++)
|
||||
{
|
||||
INT32 topdelta, prevdelta = -1;
|
||||
|
||||
if (x < 0) // don't draw off the left of the screen (WRAP PREVENTION)
|
||||
continue;
|
||||
|
||||
if (x >= vid.width) // don't draw off the right of the screen (WRAP PREVENTION)
|
||||
if (x >= stride) // don't draw off the right of the screen (WRAP PREVENTION)
|
||||
break;
|
||||
|
||||
column = (const column_t *)((const UINT8 *)(patch->columns) + (patch->columnofs[col>>FRACBITS]));
|
||||
@@ -1105,20 +1110,17 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
|
||||
dest = desttop;
|
||||
if (topdelta-sy > 0)
|
||||
{
|
||||
dest += FixedInt(FixedMul((topdelta-sy)<<FRACBITS,fdup));
|
||||
dest += FixedInt(FixedMul((topdelta-sy)<<FRACBITS,fdup))*stride;
|
||||
ofs = 0;
|
||||
}
|
||||
else
|
||||
ofs = (sy-topdelta)<<FRACBITS;
|
||||
|
||||
UINT8 *col_start = vid.screens[0] + (x*vid.height);
|
||||
deststop = col_start + vid.height;
|
||||
|
||||
for (; dest < deststop && (size_t)(ofs>>FRACBITS) < column->length && (((ofs>>FRACBITS) - sy) + topdelta) < h; ofs += rowfrac)
|
||||
for (; dest < deststop && (ofs>>FRACBITS) < column->length && (((ofs>>FRACBITS) - sy) + topdelta) < h; ofs += rowfrac)
|
||||
{
|
||||
if (dest >= col_start) // don't draw off the top of the screen (CRASH PREVENTION)
|
||||
if (dest >= vid.screens[scrn&V_PARAMMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
|
||||
*dest = source[ofs>>FRACBITS];
|
||||
dest++;
|
||||
dest += stride;
|
||||
}
|
||||
column = (const column_t *)((const UINT8 *)column + column->length + 4);
|
||||
}
|
||||
@@ -1135,20 +1137,17 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
|
||||
dest = desttop;
|
||||
if (topdelta-sy > 0)
|
||||
{
|
||||
dest += FixedInt(FixedMul((topdelta-sy)<<FRACBITS,fdup));
|
||||
dest += FixedInt(FixedMul((topdelta-sy)<<FRACBITS,fdup))*stride;
|
||||
ofs = 0;
|
||||
}
|
||||
else
|
||||
ofs = (sy-topdelta)<<FRACBITS;
|
||||
|
||||
UINT8 *col_start = vid.screens[0] + (x*vid.height);
|
||||
deststop = col_start + vid.height;
|
||||
|
||||
for (; dest < deststop && (size_t)(ofs>>FRACBITS) < column->length && (((ofs>>FRACBITS) - sy) + topdelta) < h; ofs += rowfrac)
|
||||
for (; dest < deststop && (ofs>>FRACBITS) < column->length && (((ofs>>FRACBITS) - sy) + topdelta) < h; ofs += rowfrac)
|
||||
{
|
||||
if (dest >= col_start) // don't draw off the top of the screen (CRASH PREVENTION)
|
||||
if (dest >= vid.screens[scrn&V_PARAMMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
|
||||
*dest = *(v_translevel + ((source[ofs>>FRACBITS]<<8)&0xff00) + (*dest&0xff));
|
||||
dest++;
|
||||
dest += stride;
|
||||
}
|
||||
column = (const column_t *)((const UINT8 *)column + column->length + 4);
|
||||
}
|
||||
@@ -1190,8 +1189,8 @@ void V_DrawBlock(INT32 x, INT32 y, INT32 scrn, INT32 width, INT32 height, const
|
||||
I_Error("Bad V_DrawBlock");
|
||||
#endif
|
||||
|
||||
dest = vid.screens[scrn] + x*vid.height + y;
|
||||
deststop = vid.screens[scrn] + vid.height * vid.width;
|
||||
dest = vid.screens[scrn] + y*vid.width + x;
|
||||
deststop = vid.screens[scrn] + vid.width * vid.height;
|
||||
|
||||
while (height--)
|
||||
{
|
||||
@@ -1210,7 +1209,7 @@ void V_DrawBlock(INT32 x, INT32 y, INT32 scrn, INT32 width, INT32 height, const
|
||||
// alug: now with translucency support X)
|
||||
void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
{
|
||||
UINT8 *dest, *desttop;
|
||||
UINT8 *dest;
|
||||
const UINT8 *deststop;
|
||||
UINT32 alphalevel = ((c & V_ALPHAMASK) >> V_ALPHASHIFT);
|
||||
|
||||
@@ -1286,8 +1285,8 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
if (y + h > vid.height)
|
||||
h = vid.height-y;
|
||||
|
||||
dest = desttop = vid.screens[0] + x*vid.height + y;
|
||||
deststop = vid.screens[0] + vid.height * vid.width;
|
||||
dest = vid.screens[0] + y*vid.width + x;
|
||||
deststop = vid.screens[0] + vid.width * vid.height;
|
||||
|
||||
if (alphalevel)
|
||||
{
|
||||
@@ -1313,31 +1312,16 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
if (alphalevel)
|
||||
{
|
||||
const UINT8 *fadetable = ((UINT8 *)transtables + ((alphalevel-1)<<FF_TRANSSHIFT) + (c*256));
|
||||
for (;(--h >= 0) && desttop < deststop; desttop++)
|
||||
for (;(--h >= 0) && dest < deststop; dest += vid.width)
|
||||
{
|
||||
dest = desttop;
|
||||
|
||||
UINT8 *row_end = dest + (w * vid.height);
|
||||
while (dest < row_end)
|
||||
{
|
||||
*dest = fadetable[*dest];
|
||||
dest += vid.height;
|
||||
}
|
||||
for (x = 0; x < w; x++)
|
||||
dest[x] = fadetable[dest[x]];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (;(--h >= 0) && desttop < deststop; desttop++)
|
||||
{
|
||||
dest = desttop;
|
||||
|
||||
UINT8 *row_end = dest + (w * vid.height);
|
||||
while (dest < row_end)
|
||||
{
|
||||
*dest = c;
|
||||
dest += vid.height;
|
||||
}
|
||||
}
|
||||
for (;(--h >= 0) && dest < deststop; dest += vid.width)
|
||||
memset(dest, c, w);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1383,8 +1367,8 @@ static UINT32 V_GetHWConsBackColor(void)
|
||||
|
||||
void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
{
|
||||
UINT8 *dest, *desttop;
|
||||
INT32 v;
|
||||
UINT8 *dest;
|
||||
INT32 u, v;
|
||||
UINT32 alphalevel = 0;
|
||||
|
||||
if (rendermode == render_none)
|
||||
@@ -1451,7 +1435,7 @@ void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
if (y + h > vid.height)
|
||||
h = vid.height-y;
|
||||
|
||||
dest = desttop = vid.screens[0] + x*vid.height + y;
|
||||
dest = vid.screens[0] + y*vid.width + x;
|
||||
|
||||
if ((alphalevel = ((c & V_ALPHAMASK) >> V_ALPHASHIFT)))
|
||||
{
|
||||
@@ -1476,14 +1460,11 @@ void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
|
||||
if (!alphalevel)
|
||||
{
|
||||
for (v = 0; v < h; v++, desttop++)
|
||||
for (v = 0; v < h; v++, dest += vid.width)
|
||||
{
|
||||
dest = desttop;
|
||||
UINT8 *row_end = dest + w*vid.height;
|
||||
while (dest < row_end)
|
||||
for (u = 0; u < w; u++)
|
||||
{
|
||||
*dest = consolebgmap[*dest];
|
||||
dest += vid.height;
|
||||
dest[u] = consolebgmap[dest[u]];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1494,14 +1475,11 @@ void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
w = clip(w,vid.width);
|
||||
h = clip(h,vid.height);
|
||||
#undef clip
|
||||
for (v = 0; v < h; v++, desttop++)
|
||||
for (v = 0; v < h; v++, dest += vid.width)
|
||||
{
|
||||
dest = desttop;
|
||||
UINT8 *row_end = dest + w*vid.height;
|
||||
while (dest < row_end)
|
||||
for (u = 0; u < w; u++)
|
||||
{
|
||||
*dest = fadetable[consolebgmap[*dest]];
|
||||
dest += vid.height;
|
||||
dest[u] = fadetable[consolebgmap[dest[u]]];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1516,8 +1494,7 @@ void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
//
|
||||
void V_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 c)
|
||||
{
|
||||
UINT8 *dest, *desttop;
|
||||
|
||||
UINT8 *dest;
|
||||
const UINT8 *deststop;
|
||||
INT32 w, h, wait = 0;
|
||||
|
||||
@@ -1592,28 +1569,19 @@ void V_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 c)
|
||||
if (h > w)
|
||||
h = w;
|
||||
|
||||
dest = desttop = vid.screens[0] + x*vid.height + y;
|
||||
deststop = vid.screens[0] + vid.height * vid.width;
|
||||
dest = vid.screens[0] + y*vid.width + x;
|
||||
deststop = vid.screens[0] + vid.width * vid.height;
|
||||
|
||||
c &= 255;
|
||||
|
||||
for (;(--h >= 0) && desttop < deststop; desttop++)
|
||||
for (;(--h >= 0) && dest < deststop; dest += vid.width)
|
||||
{
|
||||
dest = desttop;
|
||||
|
||||
UINT8 *row_end = dest + (w * vid.height);
|
||||
while (dest < row_end)
|
||||
{
|
||||
*dest = c;
|
||||
dest += vid.height;
|
||||
}
|
||||
|
||||
memset(dest, c, w);
|
||||
if (wait)
|
||||
wait--;
|
||||
else
|
||||
w--;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1624,7 +1592,7 @@ void V_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatnum)
|
||||
INT32 u, v;
|
||||
fixed_t dx, dy, xfrac, yfrac;
|
||||
const UINT8 *src, *deststop;
|
||||
UINT8 *flat, *dest, *desttop;
|
||||
UINT8 *flat, *dest;
|
||||
size_t size, lflatsize, flatshift;
|
||||
|
||||
#ifdef HWRENDER
|
||||
@@ -1671,7 +1639,7 @@ void V_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatnum)
|
||||
|
||||
flat = W_CacheLumpNum(flatnum, PU_CACHE);
|
||||
|
||||
dest = desttop = vid.screens[0] + y*vid.dup*vid.width + x*vid.dup;
|
||||
dest = vid.screens[0] + y*vid.dup*vid.width + x*vid.dup;
|
||||
deststop = vid.screens[0] + vid.width * vid.height;
|
||||
|
||||
// from V_DrawScaledPatch
|
||||
@@ -1695,18 +1663,15 @@ void V_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatnum)
|
||||
dy = FixedDiv(FRACUNIT, vid.dup<<(FRACBITS-2));
|
||||
|
||||
yfrac = 0;
|
||||
for (v = 0; v < h; v++, desttop++)
|
||||
for (v = 0; v < h; v++, dest += vid.width)
|
||||
{
|
||||
xfrac = 0;
|
||||
src = flat + (((yfrac>>FRACBITS) & (lflatsize - 1)) << flatshift);
|
||||
dest = desttop;
|
||||
|
||||
for (u = 0; u < w; u++)
|
||||
{
|
||||
if (dest > deststop)
|
||||
if (&dest[u] > deststop)
|
||||
return;
|
||||
*dest = src[(xfrac>>FRACBITS)&(lflatsize-1)];
|
||||
dest += vid.height;
|
||||
dest[u] = src[(xfrac>>FRACBITS)&(lflatsize-1)];
|
||||
xfrac += dx;
|
||||
}
|
||||
yfrac += dy;
|
||||
@@ -1778,7 +1743,7 @@ void V_DrawVhsEffect(boolean rewind)
|
||||
|
||||
UINT8 *buf = vid.screens[0], *tmp = vid.screens[4];
|
||||
UINT16 y;
|
||||
INT32 x;
|
||||
UINT32 x, pos = 0;
|
||||
|
||||
UINT8 *normalmapstart = ((UINT8 *)transtables + (8<<FF_TRANSSHIFT|(19<<8)));
|
||||
#ifdef HQ_VHS
|
||||
@@ -1812,40 +1777,32 @@ void V_DrawVhsEffect(boolean rewind)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Since we go through columns now instead of rows, we need to keep same random offset values for each row
|
||||
// Don't need a random value for each row, just a bunch of values to cycle through will do
|
||||
#define ROWOFFSLEN 128
|
||||
SINT8 rowoffs[ROWOFFSLEN];
|
||||
for (y = 0; y < ROWOFFSLEN; y++)
|
||||
rowoffs[y] = M_RandomKey(vid.dup<<1);
|
||||
|
||||
for (x = 0; x < vid.width; ++x)
|
||||
for (y = 0; y < vid.height; y+=2)
|
||||
{
|
||||
for (y = 0; y < vid.height; y++)
|
||||
thismapstart = normalmapstart;
|
||||
offs = 0;
|
||||
|
||||
if (y >= uby && y < uby+barsize)
|
||||
{
|
||||
offs = rowoffs[y/2 % ROWOFFSLEN];
|
||||
thismapstart -= (2<<FF_TRANSSHIFT) - (5<<8);
|
||||
offs += updistort * 2.0f * min(y-uby, uby+barsize-y) / barsize;
|
||||
}
|
||||
|
||||
thismapstart = normalmapstart;
|
||||
if (y >= dby && y < dby+barsize)
|
||||
{
|
||||
thismapstart -= (2<<FF_TRANSSHIFT) - (5<<8);
|
||||
offs -= downdistort * 2.0f * min(y-dby, dby+barsize-y) / barsize;
|
||||
}
|
||||
|
||||
if (y >= uby && y < uby+barsize)
|
||||
{
|
||||
thismapstart -= (2<<FF_TRANSSHIFT) - (5<<8);
|
||||
offs += updistort * 2.0f * min(y-uby, uby+barsize-y) / barsize;
|
||||
}
|
||||
offs += M_RandomKey(vid.dup<<1);
|
||||
|
||||
if (y >= dby && y < dby+barsize)
|
||||
{
|
||||
thismapstart -= (2<<FF_TRANSSHIFT) - (5<<8);
|
||||
offs -= downdistort * 2.0f * min(y-dby, dby+barsize-y) / barsize;
|
||||
}
|
||||
// lazy way to avoid crashes
|
||||
if ((y == 0 && offs < 0) || (y >= vid.height-2 && offs > 0))
|
||||
offs = 0;
|
||||
|
||||
INT32 pos = x*vid.height + y;
|
||||
INT32 offspos = pos + offs*vid.height;
|
||||
|
||||
if (offspos < 0 || offspos > vid.width*vid.height)
|
||||
offspos = pos;
|
||||
|
||||
tmp[pos] = thismapstart[buf[offspos]];
|
||||
for (x = min(pos+(size_t)vid.width*2, (size_t)vid.width*vid.height); pos < x; pos++)
|
||||
{
|
||||
tmp[pos] = thismapstart[buf[pos+offs]];
|
||||
#ifdef HQ_VHS
|
||||
tmp[pos] = tmapstart[buf[pos]<<8 | tmp[pos]];
|
||||
#endif
|
||||
@@ -1853,7 +1810,6 @@ void V_DrawVhsEffect(boolean rewind)
|
||||
}
|
||||
|
||||
memcpy(buf, tmp, vid.width*vid.height);
|
||||
#undef ROWOFFSLEN
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1881,7 +1837,7 @@ void V_DrawFadeScreen(UINT16 color, UINT8 strength)
|
||||
: ((color & 0xFF00) // Color is not palette index?
|
||||
? ((UINT8 *)colormaps + strength*256) // Do COLORMAP fade.
|
||||
: ((UINT8 *)transtables + ((9-strength)<<FF_TRANSSHIFT) + color*256)); // Else, do TRANSMAP** fade.
|
||||
const UINT8 *deststop = vid.screens[0] + vid.height * vid.width;
|
||||
const UINT8 *deststop = vid.screens[0] + vid.width * vid.height;
|
||||
UINT8 *buf = vid.screens[0];
|
||||
|
||||
// heavily simplified -- we don't need to know x or y
|
||||
@@ -1893,7 +1849,7 @@ void V_DrawFadeScreen(UINT16 color, UINT8 strength)
|
||||
// Simple translucency with one color, over a set number of lines starting from the top.
|
||||
void V_DrawFadeConsBack(INT32 plines)
|
||||
{
|
||||
UINT8 *deststop, *dest, *desttop;
|
||||
UINT8 *deststop, *buf;
|
||||
|
||||
#ifdef HWRENDER // not win32 only 19990829 by Kin
|
||||
if (rendermode == render_opengl)
|
||||
@@ -1906,18 +1862,9 @@ void V_DrawFadeConsBack(INT32 plines)
|
||||
|
||||
// heavily simplified -- we don't need to know x or y position,
|
||||
// just the stop position
|
||||
dest = desttop = vid.screens[0];
|
||||
deststop = vid.screens[0] + min(plines, vid.height);
|
||||
for (; desttop < deststop; desttop++)
|
||||
{
|
||||
dest = desttop;
|
||||
UINT8 *row_end = dest + (vid.width * vid.height);
|
||||
while (dest < row_end)
|
||||
{
|
||||
*dest = consolebgmap[*dest];
|
||||
dest += vid.height;
|
||||
}
|
||||
}
|
||||
deststop = vid.screens[0] + vid.width * min(plines, vid.height);
|
||||
for (buf = vid.screens[0]; buf < deststop; ++buf)
|
||||
*buf = consolebgmap[*buf];
|
||||
}
|
||||
|
||||
// Gets string colormap, used for 0x80 color codes
|
||||
@@ -3652,7 +3599,7 @@ void V_DoPostProcessor(INT32 view, INT32 param)
|
||||
|
||||
if (thiscam->postimg & POSTIMG_WATER)
|
||||
{
|
||||
INT32 y, x;
|
||||
INT32 y;
|
||||
// Set disStart to a range from 0 to FINEANGLE, incrementing by 128 per tic
|
||||
angle_t disStart = (((leveltime-1)*128) + (R_GetTimeFrac(RTF_LEVEL) / (FRACUNIT/128))) & FINEMASK;
|
||||
INT32 newpix;
|
||||
@@ -3662,7 +3609,7 @@ void V_DoPostProcessor(INT32 view, INT32 param)
|
||||
for (y = yoffset; y < yoffset+viewheight; y++)
|
||||
{
|
||||
sine = (FINESINE(disStart)*5)>>FRACBITS;
|
||||
/*newpix = abs(sine);
|
||||
newpix = abs(sine);
|
||||
|
||||
if (sine < 0)
|
||||
{
|
||||
@@ -3685,7 +3632,7 @@ void V_DoPostProcessor(INT32 view, INT32 param)
|
||||
tmpscr[(y*vid.width)+xoffset+viewwidth-newpix] = srcscr[(y*vid.width)+xoffset+(viewwidth-1)];
|
||||
newpix--;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/*
|
||||
Unoptimized version
|
||||
@@ -3701,18 +3648,6 @@ void V_DoPostProcessor(INT32 view, INT32 param)
|
||||
tmpscr[y*vid.width + x] = srcscr[y*vid.width+newpix]; // *(transme + (srcscr[y*vid.width+x]<<8) + srcscr[y*vid.width+newpix]);
|
||||
}*/
|
||||
|
||||
for (x = 0; x < vid.width; x++)
|
||||
{
|
||||
newpix = (x + sine);
|
||||
|
||||
if (newpix < 0)
|
||||
newpix = 0;
|
||||
else if (newpix >= vid.width)
|
||||
newpix = vid.width-1;
|
||||
|
||||
tmpscr[y + x*vid.height] = srcscr[y+newpix*vid.height]; // *(transme + (srcscr[y*vid.width+x]<<8) + srcscr[y*vid.width+newpix]);
|
||||
}
|
||||
|
||||
disStart += 22;//the offset into the displacement map, increment each game loop
|
||||
disStart &= FINEMASK; //clip it to FINEMASK
|
||||
}
|
||||
@@ -3723,7 +3658,7 @@ void V_DoPostProcessor(INT32 view, INT32 param)
|
||||
}
|
||||
else if (thiscam->postimg & POSTIMG_HEAT) // Heat wave
|
||||
{
|
||||
INT32 y, x;
|
||||
INT32 y;
|
||||
|
||||
// Make sure table is built
|
||||
if (heatshifter == NULL || lastheight != viewheight)
|
||||
@@ -3748,12 +3683,11 @@ void V_DoPostProcessor(INT32 view, INT32 param)
|
||||
if (heatshifter[heatindex[view]++])
|
||||
{
|
||||
// Shift this row of pixels to the right by 2
|
||||
tmpscr[y] = srcscr[y];
|
||||
for (x = vid.dup; x < vid.width; x++)
|
||||
tmpscr[y+x*vid.height] = srcscr[y+(x-vid.dup)*vid.height];
|
||||
tmpscr[(y*vid.width)+xoffset] = srcscr[(y*vid.width)+xoffset];
|
||||
M_Memcpy(&tmpscr[(y*vid.width)+xoffset], &srcscr[(y*vid.width)+xoffset+vid.dup], viewwidth-vid.dup);
|
||||
}
|
||||
else for (x = 0; x < vid.width; x++)
|
||||
tmpscr[y+x*vid.height] = srcscr[y+x*vid.height];
|
||||
else
|
||||
M_Memcpy(&tmpscr[(y*vid.width)+xoffset], &srcscr[(y*vid.width)+xoffset], viewwidth);
|
||||
|
||||
heatindex[view] %= viewheight;
|
||||
}
|
||||
@@ -3785,11 +3719,10 @@ void V_DoPostProcessor(INT32 view, INT32 param)
|
||||
|
||||
if ((thiscam->postimg & POSTIMG_FLIP) && !(thiscam->postimg & POSTIMG_MIRROR)) // Flip the screen upside-down
|
||||
{
|
||||
INT32 x, y, y2;
|
||||
INT32 y, y2;
|
||||
|
||||
for (x = xoffset; x < xoffset+viewwidth; x++)
|
||||
for (y = yoffset, y2 = yoffset+(viewheight-1); y < yoffset+viewheight; y++, y2--)
|
||||
tmpscr[x*vid.height + y2] = srcscr[x*vid.height + y];
|
||||
for (y = yoffset, y2 = yoffset+viewheight - 1; y < yoffset+viewheight; y++, y2--)
|
||||
M_Memcpy(&tmpscr[(y2*vid.width)+xoffset], &srcscr[(y*vid.width)+xoffset], viewwidth);
|
||||
|
||||
UINT8 *tmp = tmpscr;
|
||||
tmpscr = srcscr;
|
||||
@@ -3797,10 +3730,11 @@ void V_DoPostProcessor(INT32 view, INT32 param)
|
||||
}
|
||||
else if ((thiscam->postimg & POSTIMG_MIRROR) && !(thiscam->postimg & POSTIMG_FLIP)) // Flip the screen on the x axis
|
||||
{
|
||||
INT32 x, x2;
|
||||
INT32 y, x, x2;
|
||||
|
||||
for (x = xoffset, x2 = xoffset+viewwidth - 1; x < xoffset+viewwidth; x++, x2--)
|
||||
M_Memcpy(&tmpscr[(x2*vid.height)+yoffset], &srcscr[(x*vid.height)+yoffset], viewheight);
|
||||
for (y = yoffset; y < yoffset+viewheight; y++)
|
||||
for (x = xoffset, x2 = xoffset+(viewwidth-1); x < xoffset+viewwidth; x++, x2--)
|
||||
tmpscr[y*vid.width + x2] = srcscr[y*vid.width + x];
|
||||
|
||||
UINT8 *tmp = tmpscr;
|
||||
tmpscr = srcscr;
|
||||
@@ -3820,7 +3754,7 @@ void V_DoPostProcessor(INT32 view, INT32 param)
|
||||
}
|
||||
|
||||
VID_BlitLinearScreen(srcscr+vid.width*yoffset+xoffset, tmpscr+vid.width*yoffset+xoffset,
|
||||
viewwidth, viewheight, vid.height, vid.height);
|
||||
viewwidth, viewheight, vid.width, vid.width);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -3876,7 +3810,7 @@ UINT8 GetColorLUTDirect(colorlookup_t *lut, UINT8 r, UINT8 g, UINT8 b)
|
||||
void V_Init(void)
|
||||
{
|
||||
INT32 i;
|
||||
INT32 screensize = vid.height * vid.width;
|
||||
INT32 screensize = vid.width * vid.height;
|
||||
|
||||
for (i = 0; i < NUMSCREENS; i++)
|
||||
{
|
||||
|
||||
+4
-1
@@ -45,7 +45,6 @@
|
||||
#include "w_wad.h"
|
||||
#include "z_zone.h"
|
||||
#include "fastcmp.h"
|
||||
#include "console.h"
|
||||
|
||||
#include "g_game.h" // G_LoadGameData
|
||||
#include "d_main.h"
|
||||
@@ -761,7 +760,11 @@ static UINT16 W_InitFileError(const char *filename, boolean exitworthy)
|
||||
{
|
||||
if (exitworthy)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
CONS_Error(va("%s was not found or not valid.\nCheck the log for more details.\n", filename));
|
||||
#else
|
||||
I_Error("%s was not found or not valid.\nCheck the log for more details.\n", filename);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), filename);
|
||||
|
||||
+1
-1
@@ -118,7 +118,7 @@ static VOID FPrintf(HANDLE fileHandle, LPCSTR lpFmt, ...)
|
||||
DWORD bytesWritten;
|
||||
|
||||
va_start(arglist, lpFmt);
|
||||
vsnprintf(str, 1999, lpFmt, arglist);
|
||||
vsprintf(str, lpFmt, arglist);
|
||||
va_end(arglist);
|
||||
|
||||
WriteFile(fileHandle, str, (DWORD)strlen(str), &bytesWritten, NULL);
|
||||
|
||||
+1
-1
@@ -450,7 +450,7 @@ void Y_IntermissionDrawer(void)
|
||||
else
|
||||
{
|
||||
if (rendermode == render_soft)
|
||||
VID_BlitLinearScreen(vid.screens[1], vid.screens[0], vid.width, vid.height, vid.height, vid.height);
|
||||
VID_BlitLinearScreen(vid.screens[1], vid.screens[0], vid.width, vid.height, vid.width, vid.width);
|
||||
#ifdef HWRENDER
|
||||
else if (rendermode == render_opengl)
|
||||
HWR_DrawIntermissionBG();
|
||||
|
||||
@@ -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__
|
||||
Reference in new issue
Block a user