Compare commits
85
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a9732e9564 | ||
|
|
c262d3f532 | ||
|
|
ae456fee31 | ||
|
|
68f69049d4 | ||
|
|
e180918e48 | ||
|
|
951c090b35 | ||
|
|
a87e07155a | ||
|
|
da16ce3a23 | ||
|
|
64bdae5e5d | ||
|
|
4f91a0b234 | ||
|
|
bb0a59540f | ||
|
|
dd9d6de0d6 | ||
|
|
3de4c7cbad | ||
|
|
0eeacaf51e | ||
|
|
a4684b3004 | ||
|
|
9c014eb2ea | ||
|
|
37579187cc | ||
|
|
af8ce028ba | ||
|
|
9310a68cff | ||
|
|
89b8121282 | ||
|
|
b2260bbebb | ||
|
|
6a9aea4dd1 | ||
|
|
6f4dfb35fa | ||
|
|
459b2e62ce | ||
|
|
5765f3df5a | ||
|
|
8488da4b1a | ||
|
|
c82495f48b | ||
|
|
f55b8793ec | ||
|
|
b0b048c703 | ||
|
|
b7f1a0b631 | ||
|
|
513613d83b | ||
|
|
f2afc5135c | ||
|
|
3783e30a8a | ||
|
|
ff80a34627 | ||
|
|
38c96d5ec2 | ||
|
|
2ec467f062 | ||
|
|
b3106d55d1 | ||
|
|
90c3d02dbf | ||
|
|
48dc5461cd | ||
|
|
0843a586f8 | ||
|
|
8c8f96cf49 | ||
|
|
55afe9be7e | ||
|
|
fe54f2fba2 | ||
|
|
b12989f51c | ||
|
|
57990100c5 | ||
|
|
32504b9e8e | ||
|
|
ba3404d823 | ||
|
|
c9f50ca0c8 | ||
|
|
b6943ce92e | ||
|
|
41b78feef5 | ||
|
|
c9b6276a02 | ||
|
|
39a5165d91 | ||
|
|
e5a03dc3bb | ||
|
|
4deebf8912 | ||
|
|
fa8901f6b0 | ||
|
|
23512f0a6c | ||
|
|
b44548b7ac | ||
|
|
955812bd8d | ||
|
|
e4ac394d29 | ||
|
|
2b6185d7d6 | ||
|
|
2753052ee7 | ||
|
|
3c9292c137 | ||
|
|
e68136de3e | ||
|
|
e852c23441 | ||
|
|
031e8ee477 | ||
|
|
d7422b8ec9 | ||
|
|
0bbd8246cc | ||
|
|
9e8ddd5f9e | ||
|
|
3964d4e188 | ||
|
|
005af4362e | ||
|
|
f817676033 | ||
|
|
79140b3bdc | ||
|
|
48722ef591 | ||
|
|
6be5478fa8 | ||
|
|
953d9d15d6 | ||
|
|
0c56755e09 | ||
|
|
c166075754 | ||
|
|
90ff1c4fc0 | ||
|
|
1d0fedddfd | ||
|
|
f5b60c3f36 | ||
|
|
78ad3e9710 | ||
|
|
b03d5c53ed | ||
|
|
c5dce0e785 | ||
|
|
f85c7ef961 | ||
|
|
4d211f8f82 |
No files matched your search
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
makedir:=$(makedir)/SDL
|
makedir:=$(makedir)/SDL
|
||||||
|
|
||||||
opts+=-DDIRECTFULLSCREEN -DHAVE_SDL
|
opts+=-DHAVE_SDL
|
||||||
sources+=$(call List,sdl/Sourcefile)
|
sources+=$(call List,sdl/Sourcefile)
|
||||||
|
|
||||||
NOUPNP=1
|
NOUPNP=1
|
||||||
|
|||||||
+1
-1
@@ -53,7 +53,7 @@ r_data.c
|
|||||||
r_draw.c
|
r_draw.c
|
||||||
r_fps.cpp
|
r_fps.cpp
|
||||||
r_main.cpp
|
r_main.cpp
|
||||||
r_patch.c
|
r_patch.cpp
|
||||||
r_patchrotation.c
|
r_patchrotation.c
|
||||||
r_plane.cpp
|
r_plane.cpp
|
||||||
r_segs.cpp
|
r_segs.cpp
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ void I_Error(const char *error, ...)
|
|||||||
char logbuf[8192];
|
char logbuf[8192];
|
||||||
|
|
||||||
va_start(argptr, error);
|
va_start(argptr, error);
|
||||||
vsprintf(logbuf, error, argptr);
|
vsnprintf(logbuf, 8192, error, argptr);
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
|
|
||||||
LOGE(logbuf);
|
LOGE(logbuf);
|
||||||
@@ -166,7 +166,7 @@ void I_OutputMsg(const char *fmt, ...)
|
|||||||
char logbuf[8192];
|
char logbuf[8192];
|
||||||
|
|
||||||
va_start(argptr, fmt);
|
va_start(argptr, fmt);
|
||||||
vsprintf(logbuf, fmt, argptr);
|
vsnprintf(logbuf, 8192, fmt, argptr);
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
|
|
||||||
LOGD(logbuf);
|
LOGD(logbuf);
|
||||||
|
|||||||
+18
-18
@@ -1650,13 +1650,13 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth)
|
|||||||
UINT8 *p = buf;
|
UINT8 *p = buf;
|
||||||
if (!(server || (IsPlayerAdmin(consoleplayer))))
|
if (!(server || (IsPlayerAdmin(consoleplayer))))
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("Only the server or admin can change: %s %s\n"), var->name, var->string);
|
CONS_Alert(CONS_NOTICE, "Only the server or admin can change: %s %s\n", var->name, var->string);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var == &cv_kartencore && !M_SecretUnlocked(SECRET_ENCORE))
|
if (var == &cv_kartencore && !M_SecretUnlocked(SECRET_ENCORE))
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("You haven't unlocked Encore Mode yet!\n"));
|
CONS_Alert(CONS_NOTICE, "You haven't unlocked Encore Mode yet!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1664,7 +1664,7 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth)
|
|||||||
{
|
{
|
||||||
if (!stricmp(value, "Hard") || atoi(value) == 2)
|
if (!stricmp(value, "Hard") || atoi(value) == 2)
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("You haven't unlocked this yet!\n"));
|
CONS_Alert(CONS_NOTICE, "You haven't unlocked this yet!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1681,14 +1681,13 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth)
|
|||||||
else
|
else
|
||||||
Setvalue(var, value, stealth);
|
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
|
else
|
||||||
if ((var->flags & CV_NOTINNET) && netgame)
|
Setvalue(var, value, stealth);
|
||||||
{
|
|
||||||
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.
|
/** Sets a value to a variable without calling its callback function.
|
||||||
@@ -1771,7 +1770,7 @@ void CV_AddValue(consvar_t *var, INT32 increment)
|
|||||||
newvalue = var->value - 1;
|
newvalue = var->value - 1;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if(increment > 0) // Going up!
|
if (increment > 0) // Going up!
|
||||||
{
|
{
|
||||||
if (++newvalue == NUMMAPS)
|
if (++newvalue == NUMMAPS)
|
||||||
newvalue = -1;
|
newvalue = -1;
|
||||||
@@ -1785,7 +1784,7 @@ void CV_AddValue(consvar_t *var, INT32 increment)
|
|||||||
if (newvalue == oldvalue)
|
if (newvalue == oldvalue)
|
||||||
break; // don't loop forever if there's none of a certain gametype
|
break; // don't loop forever if there's none of a certain gametype
|
||||||
|
|
||||||
if(!mapheaderinfo[newvalue])
|
if (newvalue >= 0 && !mapheaderinfo[newvalue])
|
||||||
continue; // Don't allocate the header. That just makes memory usage skyrocket.
|
continue; // Don't allocate the header. That just makes memory usage skyrocket.
|
||||||
|
|
||||||
} while (!M_CanShowLevelInList(newvalue, gt));
|
} while (!M_CanShowLevelInList(newvalue, gt));
|
||||||
@@ -1914,13 +1913,14 @@ void CV_AddValue(consvar_t *var, INT32 increment)
|
|||||||
max = (M_SecretUnlocked(SECRET_HARDSPEED) ? 3 : 2);
|
max = (M_SecretUnlocked(SECRET_HARDSPEED) ? 3 : 2);
|
||||||
}
|
}
|
||||||
#ifdef PARANOIA
|
#ifdef PARANOIA
|
||||||
if (currentindice == -1)
|
if (currentindice == -1 || max == 0)
|
||||||
I_Error("CV_AddValue: current value %d not found in possible value\n",
|
I_Error("CV_AddValue: current value %d not found in possible value\n", var->value);
|
||||||
var->value);
|
|
||||||
#endif
|
#endif
|
||||||
|
if (max > 0)
|
||||||
newindice = (currentindice + increment + max) % max;
|
{
|
||||||
CV_Set(var, var->PossibleValue[newindice].strvalue);
|
newindice = (currentindice + increment + max) % max;
|
||||||
|
CV_Set(var, var->PossibleValue[newindice].strvalue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
+2
-33
@@ -69,14 +69,9 @@ static boolean consoleready; // console prompt is ready
|
|||||||
INT32 con_destlines; // vid lines used by console at final position
|
INT32 con_destlines; // vid lines used by console at final position
|
||||||
static INT32 con_curlines; // vid lines currently used by console
|
static INT32 con_curlines; // vid lines currently used by console
|
||||||
|
|
||||||
INT32 con_clipviewtop; // (useless)
|
|
||||||
|
|
||||||
static UINT8 con_hudlines; // number of console heads up message lines
|
static UINT8 con_hudlines; // number of console heads up message lines
|
||||||
static UINT32 con_hudtime[MAXHUDLINES]; // remaining time of display for hud msg lines
|
static UINT32 con_hudtime[MAXHUDLINES]; // remaining time of display for hud msg lines
|
||||||
|
|
||||||
INT32 con_clearlines; // top screen lines to refresh when view reduced
|
|
||||||
boolean con_hudupdate; // when messages scroll, we need a backgrnd refresh
|
|
||||||
|
|
||||||
// console text output
|
// console text output
|
||||||
static char *con_line; // console text output current line
|
static char *con_line; // console text output current line
|
||||||
static size_t con_cx; // cursor position in current line
|
static size_t con_cx; // cursor position in current line
|
||||||
@@ -393,9 +388,6 @@ void CON_Init(void)
|
|||||||
|
|
||||||
Lock_state();
|
Lock_state();
|
||||||
|
|
||||||
//note: CON_Ticker should always execute at least once before D_Display()
|
|
||||||
con_clipviewtop = -1; // -1 does not clip
|
|
||||||
|
|
||||||
con_hudlines = atoi(cons_hudlines.defaultvalue);
|
con_hudlines = atoi(cons_hudlines.defaultvalue);
|
||||||
|
|
||||||
Unlock_state();
|
Unlock_state();
|
||||||
@@ -727,7 +719,6 @@ void CON_ToggleOff(void)
|
|||||||
con_curlines = 0;
|
con_curlines = 0;
|
||||||
CON_ClearHUD();
|
CON_ClearHUD();
|
||||||
con_forcepic = 0;
|
con_forcepic = 0;
|
||||||
con_clipviewtop = -1; // remove console clipping of view
|
|
||||||
|
|
||||||
I_SetTextInput(false);
|
I_SetTextInput(false);
|
||||||
|
|
||||||
@@ -779,18 +770,6 @@ void CON_Ticker(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// clip the view, so that the part under the console is not drawn
|
|
||||||
con_clipviewtop = -1;
|
|
||||||
if (cons_backpic.value) // clip only when using an opaque background
|
|
||||||
{
|
|
||||||
if (con_curlines > 0)
|
|
||||||
con_clipviewtop = con_curlines - viewwindowy - 1 - 10;
|
|
||||||
// NOTE: BIG HACK::SUBTRACT 10, SO THAT WATER DON'T COPY LINES OF THE CONSOLE
|
|
||||||
// WINDOW!!! (draw some more lines behind the bottom of the console)
|
|
||||||
if (con_clipviewtop < 0)
|
|
||||||
con_clipviewtop = -1; // maybe not necessary, provided it's < 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if console ready for prompt
|
// check if console ready for prompt
|
||||||
if (con_destlines >= minheight)
|
if (con_destlines >= minheight)
|
||||||
{
|
{
|
||||||
@@ -1100,9 +1079,6 @@ static void CON_Linefeed(void)
|
|||||||
|
|
||||||
con_line = &con_buffer[(con_cy%con_totallines)*con_width];
|
con_line = &con_buffer[(con_cy%con_totallines)*con_width];
|
||||||
memset(con_line, ' ', con_width);
|
memset(con_line, ' ', con_width);
|
||||||
|
|
||||||
// make sure the view borders are refreshed if hud messages scroll
|
|
||||||
con_hudupdate = true; // see HU_Erase()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Outputs text into the console text buffer
|
// Outputs text into the console text buffer
|
||||||
@@ -1282,7 +1258,7 @@ void CONS_Alert(alerttype_t level, const char *fmt, ...)
|
|||||||
txt = malloc(8192);
|
txt = malloc(8192);
|
||||||
|
|
||||||
va_start(argptr, fmt);
|
va_start(argptr, fmt);
|
||||||
vsprintf(txt, fmt, argptr);
|
vsnprintf(txt, 8192, fmt, argptr);
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
|
|
||||||
switch (level)
|
switch (level)
|
||||||
@@ -1318,7 +1294,7 @@ void CONS_Debug(INT32 debugflags, const char *fmt, ...)
|
|||||||
txt = malloc(8192);
|
txt = malloc(8192);
|
||||||
|
|
||||||
va_start(argptr, fmt);
|
va_start(argptr, fmt);
|
||||||
vsprintf(txt, fmt, argptr);
|
vsnprintf(txt, 8192, fmt, argptr);
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
|
|
||||||
// Again I am lazy, oh well
|
// Again I am lazy, oh well
|
||||||
@@ -1489,9 +1465,6 @@ static void CON_DrawHudlines(void)
|
|||||||
//V_DrawCharacter(x, y, (p[c]&0xff) | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
|
//V_DrawCharacter(x, y, (p[c]&0xff) | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
|
||||||
y += charheight;
|
y += charheight;
|
||||||
}
|
}
|
||||||
|
|
||||||
// top screen lines that might need clearing when view is reduced
|
|
||||||
con_clearlines = y; // this is handled by HU_Erase();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw the console background, text, and prompt if enough place
|
// draw the console background, text, and prompt if enough place
|
||||||
@@ -1509,10 +1482,6 @@ static void CON_DrawConsole(void)
|
|||||||
if (con_curlines <= 0)
|
if (con_curlines <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//FIXME: refresh borders only when console bg is translucent
|
|
||||||
con_clearlines = con_curlines; // clear console draw from view borders
|
|
||||||
con_hudupdate = true; // always refresh while console is on
|
|
||||||
|
|
||||||
// draw console background
|
// draw console background
|
||||||
if (cons_backpic.value || con_forcepic)
|
if (cons_backpic.value || con_forcepic)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,14 +30,9 @@ extern boolean con_recalc;
|
|||||||
|
|
||||||
extern boolean con_startup;
|
extern boolean con_startup;
|
||||||
|
|
||||||
// top clip value for view render: do not draw part of view hidden by console
|
|
||||||
extern INT32 con_clipviewtop;
|
|
||||||
|
|
||||||
// 0 means console if off, or moving out
|
// 0 means console if off, or moving out
|
||||||
extern INT32 con_destlines;
|
extern INT32 con_destlines;
|
||||||
|
|
||||||
extern INT32 con_clearlines; // lines of top of screen to refresh
|
|
||||||
extern boolean con_hudupdate; // hud messages have changed, need refresh
|
|
||||||
extern UINT32 con_scalefactor; // console text scale factor
|
extern UINT32 con_scalefactor; // console text scale factor
|
||||||
|
|
||||||
extern consvar_t cons_backcolor, cons_menuhighlight;
|
extern consvar_t cons_backcolor, cons_menuhighlight;
|
||||||
|
|||||||
@@ -4161,7 +4161,10 @@ static void Joinable_OnChange(void)
|
|||||||
UINT8 maxplayer;
|
UINT8 maxplayer;
|
||||||
|
|
||||||
if (!server)
|
if (!server)
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_NOTICE, ("Only the server can change: %s %s\n"), cv_allownewplayer.name, cv_allownewplayer.string);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef SATURNJOIN
|
#ifdef SATURNJOIN
|
||||||
// disabling joins should also disable saturn joins unless its called with CV_StealthSet and vice versa to make life a bit easier
|
// disabling joins should also disable saturn joins unless its called with CV_StealthSet and vice versa to make life a bit easier
|
||||||
|
|||||||
+2
-16
@@ -522,19 +522,16 @@ static boolean D_Display(void)
|
|||||||
case GS_LEVEL:
|
case GS_LEVEL:
|
||||||
if (!gametic)
|
if (!gametic)
|
||||||
break;
|
break;
|
||||||
HU_Erase();
|
|
||||||
AM_Drawer();
|
AM_Drawer();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GS_INTERMISSION:
|
case GS_INTERMISSION:
|
||||||
Y_IntermissionDrawer();
|
Y_IntermissionDrawer();
|
||||||
HU_Erase();
|
|
||||||
HU_Drawer();
|
HU_Drawer();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GS_VOTING:
|
case GS_VOTING:
|
||||||
Y_VoteDrawer();
|
Y_VoteDrawer();
|
||||||
HU_Erase();
|
|
||||||
HU_Drawer();
|
HU_Drawer();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -549,7 +546,6 @@ static boolean D_Display(void)
|
|||||||
|
|
||||||
case GS_CUTSCENE:
|
case GS_CUTSCENE:
|
||||||
F_CutsceneDrawer();
|
F_CutsceneDrawer();
|
||||||
HU_Erase();
|
|
||||||
HU_Drawer();
|
HU_Drawer();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -559,7 +555,6 @@ static boolean D_Display(void)
|
|||||||
|
|
||||||
case GS_EVALUATION:
|
case GS_EVALUATION:
|
||||||
F_GameEvaluationDrawer();
|
F_GameEvaluationDrawer();
|
||||||
HU_Erase();
|
|
||||||
HU_Drawer();
|
HU_Drawer();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -569,7 +564,6 @@ static boolean D_Display(void)
|
|||||||
|
|
||||||
case GS_CREDITS:
|
case GS_CREDITS:
|
||||||
F_CreditDrawer();
|
F_CreditDrawer();
|
||||||
HU_Erase();
|
|
||||||
HU_Drawer();
|
HU_Drawer();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -586,7 +580,6 @@ static boolean D_Display(void)
|
|||||||
{
|
{
|
||||||
// I don't think HOM from nothing drawing is independent...
|
// I don't think HOM from nothing drawing is independent...
|
||||||
F_WaitingPlayersDrawer();
|
F_WaitingPlayersDrawer();
|
||||||
HU_Erase();
|
|
||||||
HU_Drawer();
|
HU_Drawer();
|
||||||
}
|
}
|
||||||
case GS_TIMEATTACK:
|
case GS_TIMEATTACK:
|
||||||
@@ -774,6 +767,7 @@ void D_SRB2Loop(void)
|
|||||||
precise_t capbudget;
|
precise_t capbudget;
|
||||||
precise_t enterprecise = I_GetPreciseTime();
|
precise_t enterprecise = I_GetPreciseTime();
|
||||||
|
|
||||||
|
memset(&g_dc, 0, sizeof(g_dc));
|
||||||
Z_Frame_Reset();
|
Z_Frame_Reset();
|
||||||
|
|
||||||
// Casting the return value of a function is bad practice (apparently)
|
// Casting the return value of a function is bad practice (apparently)
|
||||||
@@ -889,12 +883,6 @@ void D_SRB2Loop(void)
|
|||||||
// always update console and hud
|
// always update console and hud
|
||||||
// otherwise it may take minutes to open it
|
// otherwise it may take minutes to open it
|
||||||
CON_Drawer();
|
CON_Drawer();
|
||||||
|
|
||||||
if (gamestate == GS_LEVEL)
|
|
||||||
{
|
|
||||||
ST_Drawer();
|
|
||||||
HU_Drawer();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1026,7 +1014,7 @@ void D_ClearState(void)
|
|||||||
S_StopSounds();
|
S_StopSounds();
|
||||||
S_ResetKeepAndSpecialMus(); // just in case
|
S_ResetKeepAndSpecialMus(); // just in case
|
||||||
|
|
||||||
P_FreeLevelState();
|
//P_FreeLevelState();
|
||||||
|
|
||||||
G_SetGamestate(GS_NULL);
|
G_SetGamestate(GS_NULL);
|
||||||
wipegamestate = GS_NULL;
|
wipegamestate = GS_NULL;
|
||||||
@@ -1930,9 +1918,7 @@ void D_SRB2Main(void)
|
|||||||
|
|
||||||
G_LoadGameData();
|
G_LoadGameData();
|
||||||
|
|
||||||
#if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
|
||||||
VID_PrepareModeList(); // Regenerate Modelist according to cv_fullscreen
|
VID_PrepareModeList(); // Regenerate Modelist according to cv_fullscreen
|
||||||
#endif
|
|
||||||
|
|
||||||
// set user default mode or mode set at cmdline
|
// set user default mode or mode set at cmdline
|
||||||
SCR_CheckDefaultMode();
|
SCR_CheckDefaultMode();
|
||||||
|
|||||||
@@ -1468,7 +1468,7 @@ void I_Error(const char *error, ...)
|
|||||||
if (errorcount > 20)
|
if (errorcount > 20)
|
||||||
{
|
{
|
||||||
va_start(argptr, error);
|
va_start(argptr, error);
|
||||||
vsprintf(buffer, error, argptr);
|
vsnprintf(buffer, 8192, error, argptr);
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
|
|
||||||
I_OutputMsg("SRB2Kart %s Recursive Error", buffer);
|
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
|
// Display error message in the console before we start shutting it down
|
||||||
va_start(argptr, error);
|
va_start(argptr, error);
|
||||||
vsprintf(buffer, error, argptr);
|
vsnprintf(buffer, 8192, error, argptr);
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
I_OutputMsg("\nI_Error(): %s\n", buffer);
|
I_OutputMsg("\nI_Error(): %s\n", buffer);
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ extern "C" {
|
|||||||
#define UINT64 uint64_t
|
#define UINT64 uint64_t
|
||||||
|
|
||||||
#ifdef __APPLE_CC__
|
#ifdef __APPLE_CC__
|
||||||
#define DIRECTFULLSCREEN 1
|
|
||||||
#define DEBUG_LOG
|
#define DEBUG_LOG
|
||||||
#define NOIPX
|
#define NOIPX
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+1
-195
@@ -31,11 +31,6 @@
|
|||||||
#include "../st_stuff.h"
|
#include "../st_stuff.h"
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "../i_video.h" // for rendermode != render_glide
|
|
||||||
|
|
||||||
#ifndef O_BINARY
|
|
||||||
#define O_BINARY 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -58,68 +53,6 @@ static UINT8 softwaretranstogl_lo[11] = { 0, 12, 24, 36, 48, 60, 71, 83, 95,111
|
|||||||
static const float FLOATBASEVIDWIDTH = (float)BASEVIDWIDTH;
|
static const float FLOATBASEVIDWIDTH = (float)BASEVIDWIDTH;
|
||||||
static const float FLOATBASEVIDHEIGHT = (float)BASEVIDHEIGHT;
|
static const float FLOATBASEVIDHEIGHT = (float)BASEVIDHEIGHT;
|
||||||
|
|
||||||
//
|
|
||||||
// -----------------+
|
|
||||||
// HWR_DrawPatch : Draw a 'tile' graphic
|
|
||||||
// Notes : x,y : positions relative to the original Doom resolution
|
|
||||||
// : textes(console+score) + menus + status bar
|
|
||||||
// -----------------+
|
|
||||||
void HWR_DrawPatch(patch_t *gpatch, INT32 x, INT32 y, INT32 option)
|
|
||||||
{
|
|
||||||
FOutVector v[4];
|
|
||||||
FBITFIELD flags;
|
|
||||||
GLPatch_t *hwrPatch;
|
|
||||||
|
|
||||||
// 3--2
|
|
||||||
// | /|
|
|
||||||
// |/ |
|
|
||||||
// 0--1
|
|
||||||
float sdup = FIXED_TO_FLOAT(vid.fdup)*2.0f;
|
|
||||||
float pdup = FIXED_TO_FLOAT(vid.fdup)*2.0f;
|
|
||||||
|
|
||||||
// make patch ready in hardware cache
|
|
||||||
HWR_GetPatch(gpatch);
|
|
||||||
hwrPatch = ((GLPatch_t *)gpatch->hardware);
|
|
||||||
|
|
||||||
switch (option & V_SCALEPATCHMASK)
|
|
||||||
{
|
|
||||||
case V_NOSCALEPATCH:
|
|
||||||
pdup = 2.0f;
|
|
||||||
break;
|
|
||||||
case V_SMALLSCALEPATCH:
|
|
||||||
pdup = 2.0f * FIXED_TO_FLOAT(vid.smalldup*FRACUNIT);
|
|
||||||
break;
|
|
||||||
case V_MEDSCALEPATCH:
|
|
||||||
pdup = 2.0f * FIXED_TO_FLOAT(vid.meddup*FRACUNIT);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (option & V_NOSCALESTART)
|
|
||||||
sdup = 2.0f;
|
|
||||||
|
|
||||||
v[0].x = v[3].x = (x*sdup-gpatch->leftoffset*pdup)/vid.width - 1;
|
|
||||||
v[2].x = v[1].x = (x*sdup+(gpatch->width - gpatch->leftoffset)*pdup)/vid.width - 1;
|
|
||||||
v[0].y = v[1].y = 1-(y*sdup-gpatch->topoffset*pdup)/vid.height;
|
|
||||||
v[2].y = v[3].y = 1-(y*sdup+(gpatch->height - gpatch->topoffset)*pdup)/vid.height;
|
|
||||||
|
|
||||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
|
||||||
|
|
||||||
v[0].s = v[3].s = 0.0f;
|
|
||||||
v[2].s = v[1].s = hwrPatch->max_s;
|
|
||||||
v[0].t = v[1].t = 0.0f;
|
|
||||||
v[2].t = v[3].t = hwrPatch->max_t;
|
|
||||||
|
|
||||||
flags = PF_Translucent|PF_NoDepthTest;
|
|
||||||
|
|
||||||
if (option & V_WRAPX)
|
|
||||||
flags |= PF_ForceWrapX;
|
|
||||||
if (option & V_WRAPY)
|
|
||||||
flags |= PF_ForceWrapY;
|
|
||||||
|
|
||||||
// clip it since it is used for bunny scroll in doom I
|
|
||||||
GL_DrawPolygon(NULL, v, 4, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap, INT32 bflags)
|
void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap, INT32 bflags)
|
||||||
{
|
{
|
||||||
FOutVector v[4];
|
FOutVector v[4];
|
||||||
@@ -636,133 +569,6 @@ void HWR_DrawConsoleBack(UINT32 color, INT32 height)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ==========================================================================
|
|
||||||
// R_DRAW.C STUFF
|
|
||||||
// ==========================================================================
|
|
||||||
|
|
||||||
// ------------------
|
|
||||||
// HWR_DrawViewBorder
|
|
||||||
// Fill the space around the view window with a Doom flat texture, draw the
|
|
||||||
// beveled edges.
|
|
||||||
// 'clearlines' is useful to clear the heads up messages, when the view
|
|
||||||
// window is reduced, it doesn't refresh all the view borders.
|
|
||||||
// ------------------
|
|
||||||
void HWR_DrawViewBorder(INT32 clearlines)
|
|
||||||
{
|
|
||||||
INT32 x, y;
|
|
||||||
INT32 top, side;
|
|
||||||
INT32 baseviewwidth, baseviewheight;
|
|
||||||
INT32 basewindowx, basewindowy;
|
|
||||||
patch_t *patch;
|
|
||||||
|
|
||||||
if (!clearlines)
|
|
||||||
clearlines = BASEVIDHEIGHT; // refresh all
|
|
||||||
|
|
||||||
// calc view size based on original game resolution
|
|
||||||
baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewwidth), vid.fdup)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7;
|
|
||||||
baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewheight), vid.fdup));
|
|
||||||
top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowy), vid.fdup));
|
|
||||||
side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowx), vid.fdup));
|
|
||||||
|
|
||||||
// top
|
|
||||||
HWR_DrawFlatFill(0, 0,
|
|
||||||
BASEVIDWIDTH, (top < clearlines ? top : clearlines),
|
|
||||||
st_borderpatchnum);
|
|
||||||
|
|
||||||
// left
|
|
||||||
if (top < clearlines)
|
|
||||||
HWR_DrawFlatFill(0, top, side,
|
|
||||||
(clearlines-top < baseviewheight ? clearlines-top : baseviewheight),
|
|
||||||
st_borderpatchnum);
|
|
||||||
|
|
||||||
// right
|
|
||||||
if (top < clearlines)
|
|
||||||
HWR_DrawFlatFill(side + baseviewwidth, top, side,
|
|
||||||
(clearlines-top < baseviewheight ? clearlines-top : baseviewheight),
|
|
||||||
st_borderpatchnum);
|
|
||||||
|
|
||||||
// bottom
|
|
||||||
if (top + baseviewheight < clearlines)
|
|
||||||
HWR_DrawFlatFill(0, top + baseviewheight,
|
|
||||||
BASEVIDWIDTH, BASEVIDHEIGHT, st_borderpatchnum);
|
|
||||||
|
|
||||||
//
|
|
||||||
// draw the view borders
|
|
||||||
//
|
|
||||||
|
|
||||||
basewindowx = (BASEVIDWIDTH - baseviewwidth)>>1;
|
|
||||||
if (baseviewwidth == BASEVIDWIDTH)
|
|
||||||
basewindowy = 0;
|
|
||||||
else
|
|
||||||
basewindowy = top;
|
|
||||||
|
|
||||||
// top edge
|
|
||||||
if (clearlines > basewindowy - 8)
|
|
||||||
{
|
|
||||||
patch = W_CachePatchNum(viewborderlump[BRDR_T], PU_PATCH);
|
|
||||||
for (x = 0; x < baseviewwidth; x += 8)
|
|
||||||
HWR_DrawPatch(patch, basewindowx + x, basewindowy - 8,
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// bottom edge
|
|
||||||
if (clearlines > basewindowy + baseviewheight)
|
|
||||||
{
|
|
||||||
patch = W_CachePatchNum(viewborderlump[BRDR_B], PU_PATCH);
|
|
||||||
for (x = 0; x < baseviewwidth; x += 8)
|
|
||||||
HWR_DrawPatch(patch, basewindowx + x,
|
|
||||||
basewindowy + baseviewheight, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// left edge
|
|
||||||
if (clearlines > basewindowy)
|
|
||||||
{
|
|
||||||
patch = W_CachePatchNum(viewborderlump[BRDR_L], PU_PATCH);
|
|
||||||
for (y = 0; y < baseviewheight && basewindowy + y < clearlines;
|
|
||||||
y += 8)
|
|
||||||
{
|
|
||||||
HWR_DrawPatch(patch, basewindowx - 8, basewindowy + y,
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// right edge
|
|
||||||
if (clearlines > basewindowy)
|
|
||||||
{
|
|
||||||
patch = W_CachePatchNum(viewborderlump[BRDR_R], PU_PATCH);
|
|
||||||
for (y = 0; y < baseviewheight && basewindowy+y < clearlines;
|
|
||||||
y += 8)
|
|
||||||
{
|
|
||||||
HWR_DrawPatch(patch, basewindowx + baseviewwidth,
|
|
||||||
basewindowy + y, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw beveled corners.
|
|
||||||
if (clearlines > basewindowy - 8)
|
|
||||||
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_TL],
|
|
||||||
PU_PATCH),
|
|
||||||
basewindowx - 8, basewindowy - 8, 0);
|
|
||||||
|
|
||||||
if (clearlines > basewindowy - 8)
|
|
||||||
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_TR],
|
|
||||||
PU_PATCH),
|
|
||||||
basewindowx + baseviewwidth, basewindowy - 8, 0);
|
|
||||||
|
|
||||||
if (clearlines > basewindowy+baseviewheight)
|
|
||||||
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_BL],
|
|
||||||
PU_PATCH),
|
|
||||||
basewindowx - 8, basewindowy + baseviewheight, 0);
|
|
||||||
|
|
||||||
if (clearlines > basewindowy + baseviewheight)
|
|
||||||
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_BR],
|
|
||||||
PU_PATCH),
|
|
||||||
basewindowx + baseviewwidth,
|
|
||||||
basewindowy + baseviewheight, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// AM_MAP.C DRAWING STUFF
|
// AM_MAP.C DRAWING STUFF
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
@@ -1168,7 +974,7 @@ static inline boolean saveTGA(const char *file_name, void *buffer,
|
|||||||
INT32 i;
|
INT32 i;
|
||||||
UINT8 *buf8 = buffer;
|
UINT8 *buf8 = buffer;
|
||||||
|
|
||||||
fd = open(file_name, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666);
|
fd = open(file_name, O_WRONLY | O_CREAT | O_TRUNC, 0666);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
+12
-44
@@ -65,8 +65,6 @@
|
|||||||
// Globals
|
// Globals
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
#define ABS(x) ((x) < 0 ? -(x) : (x))
|
|
||||||
|
|
||||||
// false if shaders have not been initialized yet, or if shaders are not available
|
// false if shaders have not been initialized yet, or if shaders are not available
|
||||||
boolean gl_shadersavailable = false;
|
boolean gl_shadersavailable = false;
|
||||||
|
|
||||||
@@ -77,11 +75,6 @@ boolean gl_drawing_stencil = false;
|
|||||||
|
|
||||||
static INT32 current_bsp_culling_distance = 0;
|
static INT32 current_bsp_culling_distance = 0;
|
||||||
|
|
||||||
// base values set at SetViewSize
|
|
||||||
float gl_baseviewwindowy, gl_baseviewwindowx;
|
|
||||||
static float gl_viewwindowy, gl_viewwindowx; // top left corner of view window
|
|
||||||
float gl_viewwidth, gl_viewheight; // viewport clipping boundaries (screen coords)
|
|
||||||
|
|
||||||
FTransform atransform;
|
FTransform atransform;
|
||||||
|
|
||||||
// Float variants of viewx, viewy, viewz, etc.
|
// Float variants of viewx, viewy, viewz, etc.
|
||||||
@@ -4335,7 +4328,7 @@ static int CompareDrawNodePlanes(const void *p1, const void *p2)
|
|||||||
const INT32 n1 = *(const INT32*)p1;
|
const INT32 n1 = *(const INT32*)p1;
|
||||||
const INT32 n2 = *(const INT32*)p2;
|
const INT32 n2 = *(const INT32*)p2;
|
||||||
|
|
||||||
return ABS(drawnodes[n2].u.plane.fixedheight - viewz) - ABS(drawnodes[n1].u.plane.fixedheight - viewz);
|
return abs(drawnodes[n2].u.plane.fixedheight - viewz) - abs(drawnodes[n1].u.plane.fixedheight - viewz);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -5316,10 +5309,10 @@ static void HWR_DrawSkyBackground(void)
|
|||||||
// -----------------+
|
// -----------------+
|
||||||
static inline void HWR_ClearView(void)
|
static inline void HWR_ClearView(void)
|
||||||
{
|
{
|
||||||
GL_GClipRect((INT32)gl_viewwindowx,
|
GL_GClipRect(viewwindowx,
|
||||||
(INT32)gl_viewwindowy,
|
viewwindowy,
|
||||||
(INT32)(gl_viewwindowx + gl_viewwidth),
|
(viewwindowx + viewwidth),
|
||||||
(INT32)(gl_viewwindowy + gl_viewheight),
|
(viewwindowy + viewheight),
|
||||||
ZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
ZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||||
GL_ClearBuffer(false, true, true, NULL);
|
GL_ClearBuffer(false, true, true, NULL);
|
||||||
}
|
}
|
||||||
@@ -5329,19 +5322,6 @@ static inline void HWR_ClearView(void)
|
|||||||
// -----------------+
|
// -----------------+
|
||||||
void HWR_SetViewSize(void)
|
void HWR_SetViewSize(void)
|
||||||
{
|
{
|
||||||
// setup view size
|
|
||||||
gl_viewwidth = (float)vid.width;
|
|
||||||
gl_viewheight = (float)vid.height;
|
|
||||||
|
|
||||||
if (splitscreen)
|
|
||||||
gl_viewheight /= 2;
|
|
||||||
|
|
||||||
if (splitscreen > 1)
|
|
||||||
gl_viewwidth /= 2;
|
|
||||||
|
|
||||||
gl_baseviewwindowy = 0;
|
|
||||||
gl_baseviewwindowx = 0;
|
|
||||||
|
|
||||||
GL_FlushScreenTextures();
|
GL_FlushScreenTextures();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5352,7 +5332,9 @@ static void HWR_SetTransformAiming(FTransform *trans)
|
|||||||
if (cv_glshearing.value)
|
if (cv_glshearing.value)
|
||||||
{
|
{
|
||||||
fixed_t fixedaiming = AIMINGTODY(aimingangle);
|
fixed_t fixedaiming = AIMINGTODY(aimingangle);
|
||||||
trans->viewaiming = FixedToFloat(fixedaiming);
|
trans->viewaiming = FixedToFloat(fixedaiming) * ((float)vid.width / vid.height) / ((float)BASEVIDWIDTH / BASEVIDHEIGHT);
|
||||||
|
if (splitscreen == 1) // only for 2 player splitscreen
|
||||||
|
trans->viewaiming *= 2.125; // splitscreen adjusts fov with 0.8, so compensate (but only halfway, since splitscreen means only half the screen is used)
|
||||||
trans->shearing = true;
|
trans->shearing = true;
|
||||||
gl_aimingangle = 0;
|
gl_aimingangle = 0;
|
||||||
}
|
}
|
||||||
@@ -5594,20 +5576,6 @@ extern "C" {
|
|||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
static void HWR_RenderFrame(player_t *player, boolean skybox)
|
static void HWR_RenderFrame(player_t *player, boolean skybox)
|
||||||
{
|
{
|
||||||
// set window position
|
|
||||||
gl_viewwindowx = gl_baseviewwindowx;
|
|
||||||
gl_viewwindowy = gl_baseviewwindowy;
|
|
||||||
|
|
||||||
if ((splitscreen == 1 && viewssnum == 1) || (splitscreen > 1 && viewssnum > 1))
|
|
||||||
{
|
|
||||||
gl_viewwindowy += gl_viewheight;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (splitscreen > 1 && viewssnum & 1)
|
|
||||||
{
|
|
||||||
gl_viewwindowx += gl_viewwidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check for new console commands.
|
// check for new console commands.
|
||||||
NetUpdate();
|
NetUpdate();
|
||||||
|
|
||||||
@@ -5623,10 +5591,10 @@ static void HWR_RenderFrame(player_t *player, boolean skybox)
|
|||||||
|
|
||||||
if (!skybox && cv_glrenderdistance.value)
|
if (!skybox && cv_glrenderdistance.value)
|
||||||
{
|
{
|
||||||
GL_GClipRect((INT32)gl_viewwindowx,
|
GL_GClipRect(viewwindowx,
|
||||||
(INT32)gl_viewwindowy,
|
viewwindowy,
|
||||||
(INT32)(gl_viewwindowx + gl_viewwidth),
|
(viewwindowx + viewwidth),
|
||||||
(INT32)(gl_viewwindowy + gl_viewheight),
|
(viewwindowy + viewheight),
|
||||||
ZCLIP_PLANE, clipping_distances[cv_glrenderdistance.value - 1]);
|
ZCLIP_PLANE, clipping_distances[cv_glrenderdistance.value - 1]);
|
||||||
current_bsp_culling_distance = bsp_culling_distances[cv_glrenderdistance.value - 1];
|
current_bsp_culling_distance = bsp_culling_distances[cv_glrenderdistance.value - 1];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,10 +42,6 @@ extern "C" {
|
|||||||
void HWR_Startup(void);
|
void HWR_Startup(void);
|
||||||
void HWR_Shutdown(void);
|
void HWR_Shutdown(void);
|
||||||
|
|
||||||
extern float gl_viewwidth, gl_viewheight, gl_baseviewwindowx, gl_baseviewwindowy;
|
|
||||||
|
|
||||||
extern float gl_basewindowcenterx, gl_basewindowcentery;
|
|
||||||
|
|
||||||
extern unsigned msaa;
|
extern unsigned msaa;
|
||||||
extern boolean a2c;
|
extern boolean a2c;
|
||||||
|
|
||||||
@@ -89,7 +85,6 @@ extern ps_metric_t ps_hw_batchdrawtime;
|
|||||||
extern boolean gl_shadersavailable;
|
extern boolean gl_shadersavailable;
|
||||||
|
|
||||||
// hw_draw.c
|
// hw_draw.c
|
||||||
void HWR_DrawPatch(patch_t *gpatch, INT32 x, INT32 y, INT32 option);
|
|
||||||
void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap, INT32 bflags);
|
void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap, INT32 bflags);
|
||||||
void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h);
|
void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h);
|
||||||
void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color);
|
void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color);
|
||||||
@@ -98,7 +93,6 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color);
|
|||||||
void HWR_drawAMline(const fline_t *fl, INT32 color);
|
void HWR_drawAMline(const fline_t *fl, INT32 color);
|
||||||
void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength);
|
void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength);
|
||||||
void HWR_DrawConsoleBack(UINT32 color, INT32 height);
|
void HWR_DrawConsoleBack(UINT32 color, INT32 height);
|
||||||
void HWR_DrawViewBorder(INT32 clearlines);
|
|
||||||
void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum);
|
void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum);
|
||||||
|
|
||||||
UINT8 *HWR_GetScreenshot(INT32 scale);
|
UINT8 *HWR_GetScreenshot(INT32 scale);
|
||||||
|
|||||||
@@ -114,7 +114,6 @@ void UnloadModel(model_t *model)
|
|||||||
if (model->materials)
|
if (model->materials)
|
||||||
Z_Free(model->materials);
|
Z_Free(model->materials);
|
||||||
|
|
||||||
DeleteVBOs(model);
|
|
||||||
Z_Free(model);
|
Z_Free(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +193,6 @@ model_t *LoadModel(const char *filename, int ztag)
|
|||||||
strcpy(model->mdlFilename, filename);
|
strcpy(model->mdlFilename, filename);
|
||||||
|
|
||||||
Optimize(model);
|
Optimize(model);
|
||||||
GeneratePolygonNormals(model, ztag);
|
|
||||||
|
|
||||||
// Default material properties
|
// Default material properties
|
||||||
for (i = 0 ; i < model->numMaterials; i++)
|
for (i = 0 ; i < model->numMaterials; i++)
|
||||||
@@ -246,13 +244,6 @@ void GenerateVertexNormals(model_t *model)
|
|||||||
|
|
||||||
M_Memcpy(newNormals, frame->normals, sizeof(float)*3*mesh->numTriangles*3);
|
M_Memcpy(newNormals, frame->normals, sizeof(float)*3*mesh->numTriangles*3);
|
||||||
|
|
||||||
/* if (!systemSucks)
|
|
||||||
{
|
|
||||||
memTag = Z_GetTag(frame->tangents);
|
|
||||||
float *newTangents = (float*)Z_Malloc(sizeof(float)*3*mesh->numTriangles*3, memTag);
|
|
||||||
M_Memcpy(newTangents, frame->tangents, sizeof(float)*3*mesh->numTriangles*3);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
for (k = 0; k < mesh->numVertices; k++)
|
for (k = 0; k < mesh->numVertices; k++)
|
||||||
{
|
{
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
@@ -288,32 +279,15 @@ void GenerateVertexNormals(model_t *model)
|
|||||||
|
|
||||||
if (vCount > 1)
|
if (vCount > 1)
|
||||||
{
|
{
|
||||||
// Vector::Normalize(&normal);
|
|
||||||
newNormals[3 * k + 0] = (float)normal.x;
|
newNormals[3 * k + 0] = (float)normal.x;
|
||||||
newNormals[3 * k + 1] = (float)normal.y;
|
newNormals[3 * k + 1] = (float)normal.y;
|
||||||
newNormals[3 * k + 2] = (float)normal.z;
|
newNormals[3 * k + 2] = (float)normal.z;
|
||||||
|
|
||||||
/* if (!systemSucks)
|
|
||||||
{
|
|
||||||
Vector::vector_t tangent;
|
|
||||||
Vector::Tangent(&normal, &tangent);
|
|
||||||
newTangents[3 * k + 0] = tangent.x;
|
|
||||||
newTangents[3 * k + 1] = tangent.y;
|
|
||||||
newTangents[3 * k + 2] = tangent.z;
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
oldNormals = frame->normals;
|
oldNormals = frame->normals;
|
||||||
frame->normals = newNormals;
|
frame->normals = newNormals;
|
||||||
Z_Free(oldNormals);
|
Z_Free(oldNormals);
|
||||||
|
|
||||||
/* if (!systemSucks)
|
|
||||||
{
|
|
||||||
float *oldTangents = frame->tangents;
|
|
||||||
frame->tangents = newTangents;
|
|
||||||
Z_Free(oldTangents);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -404,15 +378,11 @@ void Optimize(model_t *model)
|
|||||||
newMesh->numTriangles = numTriangles;
|
newMesh->numTriangles = numTriangles;
|
||||||
newMesh->numVertices = numTriangles * 3;
|
newMesh->numVertices = numTriangles * 3;
|
||||||
newMesh->uvs = (float*)Z_Malloc(sizeof(float)*2*numTriangles*3, memTag, 0);
|
newMesh->uvs = (float*)Z_Malloc(sizeof(float)*2*numTriangles*3, memTag, 0);
|
||||||
// if (node->material->lightmap)
|
|
||||||
// newMesh->lightuvs = (float*)Z_Malloc(sizeof(float)*2*numTriangles*3, memTag, 0);
|
|
||||||
newMesh->frames = (mdlframe_t*)Z_Calloc(sizeof(mdlframe_t), memTag, 0);
|
newMesh->frames = (mdlframe_t*)Z_Calloc(sizeof(mdlframe_t), memTag, 0);
|
||||||
curFrame = &newMesh->frames[0];
|
curFrame = &newMesh->frames[0];
|
||||||
|
|
||||||
curFrame->material = curMat;
|
curFrame->material = curMat;
|
||||||
curFrame->normals = (float*)Z_Malloc(sizeof(float)*3*numTriangles*3, memTag, 0);
|
curFrame->normals = (float*)Z_Malloc(sizeof(float)*3*numTriangles*3, memTag, 0);
|
||||||
// if (!systemSucks)
|
|
||||||
// curFrame->tangents = (float*)Z_Malloc(sizeof(float)*3*numTriangles*3, memTag, 0);
|
|
||||||
curFrame->vertices = (float*)Z_Malloc(sizeof(float)*3*numTriangles*3, memTag, 0);
|
curFrame->vertices = (float*)Z_Malloc(sizeof(float)*3*numTriangles*3, memTag, 0);
|
||||||
curFrame->colors = (char*)Z_Malloc(sizeof(char)*4*numTriangles*3, memTag, 0);
|
curFrame->colors = (char*)Z_Malloc(sizeof(char)*4*numTriangles*3, memTag, 0);
|
||||||
|
|
||||||
@@ -436,12 +406,6 @@ void Optimize(model_t *model)
|
|||||||
curMesh->uvs,
|
curMesh->uvs,
|
||||||
sizeof(float)*2*curMesh->numTriangles*3);
|
sizeof(float)*2*curMesh->numTriangles*3);
|
||||||
|
|
||||||
/* if (node->material->lightmap)
|
|
||||||
{
|
|
||||||
M_Memcpy(&newMesh->lightuvs[uvCount],
|
|
||||||
curMesh->lightuvs,
|
|
||||||
sizeof(float)*2*curMesh->numTriangles*3);
|
|
||||||
}*/
|
|
||||||
uvCount += 2*curMesh->numTriangles*3;
|
uvCount += 2*curMesh->numTriangles*3;
|
||||||
|
|
||||||
dest = (float*)newMesh->frames[0].vertices;
|
dest = (float*)newMesh->frames[0].vertices;
|
||||||
@@ -456,15 +420,6 @@ void Optimize(model_t *model)
|
|||||||
src,
|
src,
|
||||||
sizeof(float)*3*curMesh->numTriangles*3);
|
sizeof(float)*3*curMesh->numTriangles*3);
|
||||||
|
|
||||||
/* if (!systemSucks)
|
|
||||||
{
|
|
||||||
dest = (float*)newMesh->frames[0].tangents;
|
|
||||||
src = (float*)curMesh->frames[0].tangents;
|
|
||||||
M_Memcpy(&dest[vertCount],
|
|
||||||
src,
|
|
||||||
sizeof(float)*3*curMesh->numTriangles*3);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
vertCount += 3 * curMesh->numTriangles * 3;
|
vertCount += 3 * curMesh->numTriangles * 3;
|
||||||
|
|
||||||
destByte = (char*)newMesh->frames[0].colors;
|
destByte = (char*)newMesh->frames[0].colors;
|
||||||
@@ -494,103 +449,3 @@ void Optimize(model_t *model)
|
|||||||
model->meshes = newMeshes;
|
model->meshes = newMeshes;
|
||||||
model->numMeshes = numMeshes;
|
model->numMeshes = numMeshes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneratePolygonNormals(model_t *model, int ztag)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < model->numMeshes; i++)
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
mesh_t *mesh = &model->meshes[i];
|
|
||||||
|
|
||||||
if (!mesh->frames)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
for (j = 0; j < mesh->numFrames; j++)
|
|
||||||
{
|
|
||||||
int k;
|
|
||||||
mdlframe_t *frame = &mesh->frames[j];
|
|
||||||
const float *vertices = frame->vertices;
|
|
||||||
vector_t *polyNormals;
|
|
||||||
|
|
||||||
frame->polyNormals = (vector_t*)Z_Malloc(sizeof(vector_t) * mesh->numTriangles, ztag, 0);
|
|
||||||
|
|
||||||
polyNormals = frame->polyNormals;
|
|
||||||
|
|
||||||
for (k = 0; k < mesh->numTriangles; k++)
|
|
||||||
{
|
|
||||||
/// TODO: normalize vectors
|
|
||||||
(void)vertices;
|
|
||||||
(void)polyNormals;
|
|
||||||
// Vector::Normal(vertices, polyNormals);
|
|
||||||
vertices += 3 * 3;
|
|
||||||
polyNormals++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Reload
|
|
||||||
//
|
|
||||||
// Reload VBOs
|
|
||||||
//
|
|
||||||
#if 0
|
|
||||||
static void Reload(void)
|
|
||||||
{
|
|
||||||
/* model_t *node;
|
|
||||||
for (node = modelHead; node; node = node->next)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < node->numMeshes; i++)
|
|
||||||
{
|
|
||||||
mesh_t *mesh = &node->meshes[i];
|
|
||||||
|
|
||||||
if (mesh->frames)
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
for (j = 0; j < mesh->numFrames; j++)
|
|
||||||
CreateVBO(mesh, &mesh->frames[j]);
|
|
||||||
}
|
|
||||||
else if (mesh->tinyframes)
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
for (j = 0; j < mesh->numFrames; j++)
|
|
||||||
CreateVBO(mesh, &mesh->tinyframes[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void DeleteVBOs(model_t *model)
|
|
||||||
{
|
|
||||||
(void)model;
|
|
||||||
/* for (int i = 0; i < model->numMeshes; i++)
|
|
||||||
{
|
|
||||||
mesh_t *mesh = &model->meshes[i];
|
|
||||||
|
|
||||||
if (mesh->frames)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < mesh->numFrames; j++)
|
|
||||||
{
|
|
||||||
mdlframe_t *frame = &mesh->frames[j];
|
|
||||||
if (!frame->vboID)
|
|
||||||
continue;
|
|
||||||
bglDeleteBuffers(1, &frame->vboID);
|
|
||||||
frame->vboID = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (mesh->tinyframes)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < mesh->numFrames; j++)
|
|
||||||
{
|
|
||||||
tinyframe_t *frame = &mesh->tinyframes[j];
|
|
||||||
if (!frame->vboID)
|
|
||||||
continue;
|
|
||||||
bglDeleteBuffers(1, &frame->vboID);
|
|
||||||
frame->vboID = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
@@ -28,8 +28,6 @@ typedef struct
|
|||||||
float ambient[4], diffuse[4], specular[4], emissive[4];
|
float ambient[4], diffuse[4], specular[4], emissive[4];
|
||||||
float shininess;
|
float shininess;
|
||||||
boolean spheremap;
|
boolean spheremap;
|
||||||
// Texture::texture_t *texture;
|
|
||||||
// Texture::texture_t *lightmap;
|
|
||||||
} material_t;
|
} material_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@@ -40,7 +38,6 @@ typedef struct
|
|||||||
float *tangents;
|
float *tangents;
|
||||||
char *colors;
|
char *colors;
|
||||||
unsigned int vboID;
|
unsigned int vboID;
|
||||||
vector_t *polyNormals;
|
|
||||||
} mdlframe_t;
|
} mdlframe_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@@ -70,7 +67,6 @@ typedef struct mesh_s
|
|||||||
typedef struct tag_s
|
typedef struct tag_s
|
||||||
{
|
{
|
||||||
char name[64];
|
char name[64];
|
||||||
// matrix_t transform;
|
|
||||||
} tag_t;
|
} tag_t;
|
||||||
|
|
||||||
typedef struct model_s
|
typedef struct model_s
|
||||||
@@ -96,9 +92,7 @@ model_t *LoadModel(const char *filename, int ztag);
|
|||||||
void UnloadModel(model_t *model);
|
void UnloadModel(model_t *model);
|
||||||
void Optimize(model_t *model);
|
void Optimize(model_t *model);
|
||||||
void GenerateVertexNormals(model_t *model);
|
void GenerateVertexNormals(model_t *model);
|
||||||
void GeneratePolygonNormals(model_t *model, int ztag);
|
|
||||||
void CreateVBOTiny(mesh_t *mesh, tinyframe_t *frame);
|
void CreateVBOTiny(mesh_t *mesh, tinyframe_t *frame);
|
||||||
void CreateVBO(mesh_t *mesh, mdlframe_t *frame);
|
void CreateVBO(mesh_t *mesh, mdlframe_t *frame);
|
||||||
void DeleteVBOs(model_t *model);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -253,6 +253,9 @@ HMS_connect (const char *format, ...)
|
|||||||
cc = curl_easy_setopt(curl, CURLOPT_TIMEOUT, (long)cv_masterserver_timeout.value);
|
cc = curl_easy_setopt(curl, CURLOPT_TIMEOUT, (long)cv_masterserver_timeout.value);
|
||||||
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
|
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
|
||||||
|
|
||||||
|
cc = curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 30L);
|
||||||
|
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
|
||||||
|
|
||||||
cc = curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, HMS_on_read);
|
cc = curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, HMS_on_read);
|
||||||
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
|
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
|
||||||
|
|
||||||
|
|||||||
+85
-144
@@ -2391,76 +2391,6 @@ void HU_Drawer(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//======================================================================
|
|
||||||
// HUD MESSAGES CLEARING FROM SCREEN
|
|
||||||
//======================================================================
|
|
||||||
|
|
||||||
// Clear old messages from the borders around the view window
|
|
||||||
// (only for reduced view, refresh the borders when needed)
|
|
||||||
//
|
|
||||||
// startline: y coord to start clear,
|
|
||||||
// clearlines: how many lines to clear.
|
|
||||||
//
|
|
||||||
static INT32 oldclearlines;
|
|
||||||
|
|
||||||
void HU_Erase(void)
|
|
||||||
{
|
|
||||||
INT32 topline, bottomline;
|
|
||||||
INT32 y, yoffset;
|
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
// clear hud msgs on double buffer (OpenGL mode)
|
|
||||||
boolean secondframe;
|
|
||||||
static INT32 secondframelines;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (con_clearlines == oldclearlines && !con_hudupdate && !chat_on)
|
|
||||||
return;
|
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
// clear the other frame in double-buffer modes
|
|
||||||
secondframe = (con_clearlines != oldclearlines);
|
|
||||||
if (secondframe)
|
|
||||||
secondframelines = oldclearlines;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// clear the message lines that go away, so use _oldclearlines_
|
|
||||||
bottomline = oldclearlines;
|
|
||||||
oldclearlines = con_clearlines;
|
|
||||||
if (chat_on && OLDCHAT)
|
|
||||||
if (bottomline < 8)
|
|
||||||
bottomline = 8; // only do it for consolechat. consolechat is gay.
|
|
||||||
|
|
||||||
if (automapactive || viewwindowx == 0) // hud msgs don't need to be cleared
|
|
||||||
return;
|
|
||||||
|
|
||||||
// software mode copies view border pattern & beveled edges from the backbuffer
|
|
||||||
if (rendermode == render_soft)
|
|
||||||
{
|
|
||||||
topline = 0;
|
|
||||||
for (y = topline, yoffset = y*vid.width; y < bottomline; y++, yoffset += vid.width)
|
|
||||||
{
|
|
||||||
if (y < viewwindowy || y >= viewwindowy + viewheight)
|
|
||||||
R_VideoErase(yoffset, vid.width); // erase entire line
|
|
||||||
else
|
|
||||||
{
|
|
||||||
R_VideoErase(yoffset, viewwindowx); // erase left border
|
|
||||||
// erase right border
|
|
||||||
R_VideoErase(yoffset + viewwindowx + viewwidth, viewwindowx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
con_hudupdate = false; // if it was set..
|
|
||||||
}
|
|
||||||
#ifdef HWRENDER
|
|
||||||
else if (rendermode != render_none)
|
|
||||||
{
|
|
||||||
// refresh just what is needed from the view borders
|
|
||||||
HWR_DrawViewBorder(secondframelines);
|
|
||||||
con_hudupdate = secondframe;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
//======================================================================
|
//======================================================================
|
||||||
// IN-LEVEL MULTIPLAYER RANKINGS
|
// IN-LEVEL MULTIPLAYER RANKINGS
|
||||||
//======================================================================
|
//======================================================================
|
||||||
@@ -2540,17 +2470,91 @@ Ping_conversion (UINT32 lag)
|
|||||||
// HU_drawPing
|
// 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)
|
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];
|
UINT32 lag = playerpingtable[pnum];
|
||||||
const boolean gentleman = (cv_mindelay.value && (lag < (tic_t)simulated_lag));
|
const boolean gentleman = (cv_mindelay.value && (lag < (tic_t)simulated_lag));
|
||||||
|
|
||||||
@@ -2561,74 +2565,11 @@ void HU_drawPlayerPing(INT32 x, INT32 y, INT32 pnum, INT32 flags)
|
|||||||
|
|
||||||
if (cv_pingstyle.value == 0) // kart
|
if (cv_pingstyle.value == 0) // kart
|
||||||
{
|
{
|
||||||
gfxnum = Ping_gfx_num(lag);
|
HU_drawKartPing(x, y, lag, flags, gentleman);
|
||||||
|
|
||||||
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
|
else if (cv_pingstyle.value == 1) // old style ping
|
||||||
{
|
{
|
||||||
if (vid.width >= 640) // how sad, we're using a shit resolution.
|
HU_drawOldPing(x, y, lag, flags, gentleman);
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,6 @@ void HU_TickSongCredits(void);
|
|||||||
void HU_DrawSongCredits(void);
|
void HU_DrawSongCredits(void);
|
||||||
void HU_Drawer(void);
|
void HU_Drawer(void);
|
||||||
char HU_dequeueChatChar(void);
|
char HU_dequeueChatChar(void);
|
||||||
void HU_Erase(void);
|
|
||||||
void HU_clearChatChars(void);
|
void HU_clearChatChars(void);
|
||||||
void HU_drawPlayerPing(INT32 x, INT32 y, INT32 pnum, INT32 flags); // Lat': Ping drawer for scoreboard.
|
void HU_drawPlayerPing(INT32 x, INT32 y, INT32 pnum, INT32 flags); // Lat': Ping drawer for scoreboard.
|
||||||
//void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer);
|
//void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer);
|
||||||
|
|||||||
@@ -1,680 +0,0 @@
|
|||||||
// SONIC ROBO BLAST 2
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Copyright (C) 2011-2018 by Sonic Team Junior.
|
|
||||||
//
|
|
||||||
// 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 i_addrinfo.c
|
|
||||||
/// \brief getaddr stubs, for lesser OSes
|
|
||||||
///
|
|
||||||
/// Some systems/SDKs, like PSL1GHT v2 does not have addrinfo functions
|
|
||||||
/// So a stub is needed
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#ifdef _WIN32
|
|
||||||
#ifdef USE_WINSOCK2
|
|
||||||
#include <ws2tcpip.h>
|
|
||||||
#else
|
|
||||||
#include <winsock.h>
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <netdb.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "i_addrinfo.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This addrinfo stub have a testcases:
|
|
||||||
* To test the stub, use this command to compile the stub testcase:
|
|
||||||
* gcc -g -DTESTCASE -Dtest_stub -Wall -W i_addrinfo.c -o stub
|
|
||||||
* To test the real getaddrinfo API, use this command to get real one:
|
|
||||||
* gcc -g -DTESTCASE -Utest_stub -Wall -W i_addrinfo.c -o real
|
|
||||||
* For Win32,you need the WinSock library, version 1.1 or 2.2
|
|
||||||
* for 1.1, add -lwsock32
|
|
||||||
* i686-w64-mingw32-gcc -g -DTESTCASE -Dtest_stub -UUSE_WINSOCK2 -Wall -W i_addrinfo.c -o stub.exe -lwsock32
|
|
||||||
* for 2.2, add -DUSE_WINSOCK2 -lws2_32
|
|
||||||
* i686-w64-mingw32-gcc -g -DTESTCASE -Utest_stub -DUSE_WINSOCK2 -Wall -W i_addrinfo.c -o real.exe -lws2_32
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef I_getaddrinfo
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
// it seems windows doesn't define that... maybe some other OS? OS/2
|
|
||||||
static int inet_aton(const char *cp, struct in_addr *addr)
|
|
||||||
{
|
|
||||||
if( cp == NULL || addr == NULL )
|
|
||||||
{
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
if (strcmp(cp, "255.255.255.225") == 0)
|
|
||||||
{
|
|
||||||
addr->s_addr = htonl(INADDR_BROADCAST);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return (addr->s_addr = inet_addr(cp)) != htonl(INADDR_NONE);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_WINSOCK2
|
|
||||||
static HMODULE ipv6dll = NULL;
|
|
||||||
typedef int (WSAAPI *p_getaddrinfo) (const char *, const char *,
|
|
||||||
const struct my_addrinfo *,
|
|
||||||
struct my_addrinfo **);
|
|
||||||
typedef void (WSAAPI *p_freeaddrinfo) (struct my_addrinfo *);
|
|
||||||
|
|
||||||
static p_getaddrinfo WS_getaddrinfo = NULL;
|
|
||||||
static p_freeaddrinfo WS_freeaddrinfo = NULL;
|
|
||||||
|
|
||||||
static HMODULE WS_getfunctions(HMODULE tmp)
|
|
||||||
{
|
|
||||||
if (tmp != NULL)
|
|
||||||
{
|
|
||||||
WS_getaddrinfo = (p_getaddrinfo)(LPVOID)GetProcAddress(tmp, "getaddrinfo");
|
|
||||||
if (WS_getaddrinfo == NULL)
|
|
||||||
return NULL;
|
|
||||||
WS_freeaddrinfo = (p_freeaddrinfo)(LPVOID)GetProcAddress(tmp, "freeaddrinfo");
|
|
||||||
if (WS_freeaddrinfo == NULL)
|
|
||||||
{
|
|
||||||
WS_getaddrinfo = NULL;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void WS_addrinfosetup(void)
|
|
||||||
{
|
|
||||||
if (WS_getaddrinfo && WS_freeaddrinfo)
|
|
||||||
return; // already have the functions
|
|
||||||
// why not hold it into ipv6dll? becase we already link with ws2_32, silly!
|
|
||||||
if (WS_getfunctions(GetModuleHandleA("ws2_32.dll")) == NULL)
|
|
||||||
ipv6dll = WS_getfunctions(LoadLibraryA("wship6.dll"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void WS_addrinfocleanup(void)
|
|
||||||
{
|
|
||||||
if (ipv6dll)
|
|
||||||
FreeLibrary(ipv6dll);
|
|
||||||
ipv6dll = NULL;
|
|
||||||
WS_getaddrinfo = NULL;
|
|
||||||
WS_freeaddrinfo = NULL;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void WS_addrinfocleanup(void) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int I_getaddrinfo(const char *node, const char *service,
|
|
||||||
const struct my_addrinfo *hints,
|
|
||||||
struct my_addrinfo **res)
|
|
||||||
{
|
|
||||||
struct hostent *nodename = NULL;
|
|
||||||
bool hostlookup = true, passivemode = false;
|
|
||||||
int flags = 0;
|
|
||||||
int socktype = 0;
|
|
||||||
int sockport = 0;
|
|
||||||
struct my_addrinfo *ai;
|
|
||||||
struct sockaddr_in *addr;
|
|
||||||
struct in_addr ipv4;
|
|
||||||
size_t addrlen = 1;
|
|
||||||
size_t ailen = 1, i = 0, j;
|
|
||||||
size_t famsize = sizeof(struct sockaddr_in);
|
|
||||||
#ifdef USE_WINSOCK2
|
|
||||||
WS_addrinfosetup();
|
|
||||||
if (WS_getaddrinfo)
|
|
||||||
return WS_getaddrinfo(node, service, hints, res);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// param check
|
|
||||||
if (node == NULL && service == NULL)
|
|
||||||
return EAI_NONAME;
|
|
||||||
//note: testcase show NULL as res crashes libc
|
|
||||||
if (res == NULL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
// check hints
|
|
||||||
if (hints)
|
|
||||||
{
|
|
||||||
// no support for IPv6
|
|
||||||
if (hints->ai_family != AF_INET && hints->ai_family != AF_UNSPEC)
|
|
||||||
return -1; //EAI_FAMILY
|
|
||||||
#ifdef AI_NUMERICHOST
|
|
||||||
// do not look up hostnames
|
|
||||||
if ((hints->ai_flags & AI_NUMERICHOST) == AI_NUMERICHOST)
|
|
||||||
{
|
|
||||||
hostlookup = false;
|
|
||||||
flags |= AI_NUMERICHOST;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef AI_PASSIVE
|
|
||||||
// return loopback or any address?
|
|
||||||
if ((hints->ai_flags & AI_PASSIVE) == AI_PASSIVE)
|
|
||||||
{
|
|
||||||
passivemode = true;
|
|
||||||
flags |= AI_PASSIVE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// why no support for canon names? lazy
|
|
||||||
//AI_CANONNAME
|
|
||||||
// what kind of socket?
|
|
||||||
socktype = hints->ai_socktype;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#ifdef AI_V4MAPPED
|
|
||||||
flags |= AI_V4MAPPED;
|
|
||||||
#endif
|
|
||||||
#ifdef AI_ADDRCONFIG
|
|
||||||
flags |= AI_ADDRCONFIG;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// we need gethostbyname to convert numeric strings
|
|
||||||
if (node && hostlookup)
|
|
||||||
{
|
|
||||||
if (node == NULL)
|
|
||||||
return -1;
|
|
||||||
nodename = gethostbyname(node);
|
|
||||||
if (nodename == NULL)
|
|
||||||
{
|
|
||||||
if (inet_aton(node, &ipv4) != 0)
|
|
||||||
addrlen = 1;
|
|
||||||
else
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else while (nodename->h_addr_list[addrlen] != NULL)
|
|
||||||
addrlen++;
|
|
||||||
}
|
|
||||||
else if (node)
|
|
||||||
{
|
|
||||||
if (inet_aton(node, &ipv4) != 0)
|
|
||||||
addrlen = 1;
|
|
||||||
else if (!hostlookup)
|
|
||||||
return EAI_NONAME;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
addrlen = 1;
|
|
||||||
|
|
||||||
if (service) //AI_NUMERICSERV
|
|
||||||
sockport = atoi(service);
|
|
||||||
|
|
||||||
if (socktype == 0)
|
|
||||||
ailen = addrlen*3;
|
|
||||||
else
|
|
||||||
ailen = addrlen;
|
|
||||||
|
|
||||||
ai = calloc(ailen, sizeof(struct my_addrinfo));
|
|
||||||
if (ai == NULL)
|
|
||||||
return -1;
|
|
||||||
else
|
|
||||||
*res = ai;
|
|
||||||
|
|
||||||
addr = calloc(ailen*2, famsize);
|
|
||||||
if (addr == NULL)
|
|
||||||
{
|
|
||||||
free(ai);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ai->ai_addr = memset(addr, 0x00, ailen*ai->ai_addrlen);
|
|
||||||
|
|
||||||
for (i = 0; i < ailen; i++)
|
|
||||||
{
|
|
||||||
ai = *res+i;
|
|
||||||
ai->ai_flags = flags;
|
|
||||||
ai->ai_family = AF_INET;
|
|
||||||
ai->ai_socktype = socktype;
|
|
||||||
switch (ai->ai_socktype)
|
|
||||||
{
|
|
||||||
case SOCK_STREAM:
|
|
||||||
ai->ai_protocol = IPPROTO_TCP;
|
|
||||||
break;
|
|
||||||
case SOCK_DGRAM:
|
|
||||||
ai->ai_protocol = IPPROTO_UDP;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ai->ai_protocol = 0;
|
|
||||||
}
|
|
||||||
ai->ai_addrlen = famsize;
|
|
||||||
ai->ai_addr = (struct sockaddr *)&addr[i];
|
|
||||||
//ai_cannonname
|
|
||||||
ai->ai_next = ai+1;
|
|
||||||
}
|
|
||||||
ai->ai_next = NULL;
|
|
||||||
ai = *res;
|
|
||||||
|
|
||||||
for (i = 0, j = 0; i < ailen; i++, j++)
|
|
||||||
{
|
|
||||||
ai = *res+i;
|
|
||||||
addr[i].sin_port = htons((UINT16)sockport);
|
|
||||||
if (nodename)
|
|
||||||
{
|
|
||||||
memcpy(&addr[i].sin_addr, nodename->h_addr_list[j], ai->ai_addrlen);
|
|
||||||
addr[i].sin_family = nodename->h_addrtype;
|
|
||||||
}
|
|
||||||
else if (node)
|
|
||||||
{
|
|
||||||
memcpy(&addr[i].sin_addr, &ipv4, ai->ai_addrlen);
|
|
||||||
addr[i].sin_family = AF_INET;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (passivemode)
|
|
||||||
addr[i].sin_addr.s_addr = htonl(INADDR_ANY);
|
|
||||||
else
|
|
||||||
addr[i].sin_addr.s_addr = htonl(INADDR_LOOPBACK);
|
|
||||||
addr[i].sin_family = AF_INET;
|
|
||||||
}
|
|
||||||
if (socktype == 0)
|
|
||||||
{
|
|
||||||
ai->ai_socktype = SOCK_STREAM;
|
|
||||||
ai->ai_protocol = IPPROTO_TCP;
|
|
||||||
memcpy(&addr[i+1], &addr[i], ai->ai_addrlen);
|
|
||||||
i++; ai++;
|
|
||||||
ai->ai_socktype = SOCK_DGRAM;
|
|
||||||
ai->ai_protocol = IPPROTO_UDP;
|
|
||||||
memcpy(&addr[i+1], &addr[i], ai->ai_addrlen);
|
|
||||||
i++; ai++;
|
|
||||||
ai->ai_socktype = SOCK_RAW;
|
|
||||||
ai->ai_protocol = IPPROTO_IP;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef I_freeaddrinfo
|
|
||||||
void I_freeaddrinfo(struct my_addrinfo *res)
|
|
||||||
{
|
|
||||||
#ifdef USE_WINSOCK2
|
|
||||||
if (WS_freeaddrinfo)
|
|
||||||
{
|
|
||||||
WS_freeaddrinfo(res);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (!res)
|
|
||||||
return;
|
|
||||||
free(res->ai_addr);
|
|
||||||
free(res);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TESTCASE
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#ifdef USE_WINSOCK2
|
|
||||||
#define inet_ntop inet_ntopA
|
|
||||||
#define HAVE_NTOP
|
|
||||||
static const char* inet_ntopA(int af, const void *cp, char *buf, socklen_t len)
|
|
||||||
{
|
|
||||||
DWORD Dlen = len, AFlen = 0;
|
|
||||||
SOCKADDR_STORAGE any;
|
|
||||||
LPSOCKADDR anyp = (LPSOCKADDR)&any;
|
|
||||||
LPSOCKADDR_IN any4 = (LPSOCKADDR_IN)&any;
|
|
||||||
LPSOCKADDR_IN6 any6 = (LPSOCKADDR_IN6)&any;
|
|
||||||
|
|
||||||
if (!buf)
|
|
||||||
{
|
|
||||||
WSASetLastError(STATUS_INVALID_PARAMETER);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (af != AF_INET && af != AF_INET6)
|
|
||||||
{
|
|
||||||
WSASetLastError(WSAEAFNOSUPPORT);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ZeroMemory(&any, sizeof(SOCKADDR_STORAGE));
|
|
||||||
any.ss_family = af;
|
|
||||||
|
|
||||||
switch (af)
|
|
||||||
{
|
|
||||||
case AF_INET:
|
|
||||||
{
|
|
||||||
CopyMemory(&any4->sin_addr, cp, sizeof(IN_ADDR));
|
|
||||||
AFlen = sizeof(SOCKADDR_IN);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case AF_INET6:
|
|
||||||
{
|
|
||||||
CopyMemory(&any6->sin6_addr, cp, sizeof(IN6_ADDR));
|
|
||||||
AFlen = sizeof(SOCKADDR_IN6);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (WSAAddressToStringA(anyp, AFlen, NULL, buf, &Dlen) == SOCKET_ERROR)
|
|
||||||
return NULL;
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
#elif defined (_WIN32)
|
|
||||||
// w32api, ws2tcpip.h, r1.12
|
|
||||||
static inline char* gai_strerror(int ecode)
|
|
||||||
{
|
|
||||||
static char message[1024+1];
|
|
||||||
DWORD dwFlags = FORMAT_MESSAGE_FROM_SYSTEM
|
|
||||||
| FORMAT_MESSAGE_IGNORE_INSERTS
|
|
||||||
| FORMAT_MESSAGE_MAX_WIDTH_MASK;
|
|
||||||
DWORD dwLanguageId = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT);
|
|
||||||
FormatMessageA(dwFlags, NULL, ecode, dwLanguageId, message, 1024, NULL);
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define HAVE_NTOP
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef INET_ADDRSTRLEN
|
|
||||||
#define INET_ADDRSTRLEN 16
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static inline void printflags(int ai_flags)
|
|
||||||
{
|
|
||||||
printf("flags: %x(", ai_flags);
|
|
||||||
if (ai_flags == 0)
|
|
||||||
printf("NONE|");
|
|
||||||
#ifdef AI_PASSIVE
|
|
||||||
if ((ai_flags & AI_PASSIVE) == AI_PASSIVE)
|
|
||||||
printf("AI_PASSIVE|");
|
|
||||||
ai_flags &= ~AI_PASSIVE;
|
|
||||||
#endif
|
|
||||||
#ifdef AI_CANONNAME
|
|
||||||
if ((ai_flags & AI_CANONNAME) == AI_CANONNAME)
|
|
||||||
printf("AI_CANONNAME|");
|
|
||||||
ai_flags &= ~AI_CANONNAME;
|
|
||||||
#endif
|
|
||||||
#ifdef AI_NUMERICHOST
|
|
||||||
if ((ai_flags & AI_NUMERICHOST) == AI_NUMERICHOST)
|
|
||||||
printf("AI_NUMERICHOST|");
|
|
||||||
ai_flags &= ~AI_NUMERICHOST;
|
|
||||||
#endif
|
|
||||||
#ifdef AI_V4MAPPED
|
|
||||||
if ((ai_flags & AI_V4MAPPED) == AI_V4MAPPED)
|
|
||||||
printf("AI_V4MAPPED|");
|
|
||||||
ai_flags &= ~AI_V4MAPPED;
|
|
||||||
#endif
|
|
||||||
#ifdef AI_ALL
|
|
||||||
if ((ai_flags & AI_ALL) == AI_ALL)
|
|
||||||
printf("AI_ALL|");
|
|
||||||
ai_flags &= ~AI_ALL;
|
|
||||||
#endif
|
|
||||||
#ifdef AI_ADDRCONFIG
|
|
||||||
if ((ai_flags & AI_ADDRCONFIG) == AI_ADDRCONFIG)
|
|
||||||
printf("AI_ADDRCONFIG|");
|
|
||||||
ai_flags &= ~AI_ADDRCONFIG;
|
|
||||||
#endif
|
|
||||||
#ifdef AI_IDN
|
|
||||||
if ((ai_flags & AI_IDN) == AI_IDN)
|
|
||||||
printf("AI_IDN|");
|
|
||||||
ai_flags &= ~AI_IDN;
|
|
||||||
#endif
|
|
||||||
#ifdef AI_CANONIDN
|
|
||||||
if ((ai_flags & AI_CANONIDN) == AI_CANONIDN)
|
|
||||||
printf("AI_CANONIDN|");
|
|
||||||
ai_flags &= ~AI_CANONIDN;
|
|
||||||
#endif
|
|
||||||
#ifdef AI_IDN_ALLOW_UNASSIGNED
|
|
||||||
if ((ai_flags & AI_IDN_ALLOW_UNASSIGNED) == AI_IDN_ALLOW_UNASSIGNED)
|
|
||||||
printf("AI_IDN_ALLOW_UNASSIGNED|");
|
|
||||||
ai_flags &= ~AI_IDN_ALLOW_UNASSIGNED;
|
|
||||||
#endif
|
|
||||||
#ifdef AI_IDN_USE_STD3_ASCII_RULES
|
|
||||||
if ((ai_flags & AI_IDN_USE_STD3_ASCII_RULES) == AI_IDN_USE_STD3_ASCII_RULES)
|
|
||||||
printf("AI_IDN_USE_STD3_ASCII_RULES|");
|
|
||||||
ai_flags &= ~AI_PASSIVE;
|
|
||||||
#endif
|
|
||||||
#ifdef AI_NUMERICSERV
|
|
||||||
if ((ai_flags & AI_NUMERICSERV) == AI_NUMERICSERV)
|
|
||||||
printf("AI_NUMERICSERV|");
|
|
||||||
ai_flags &= ~AI_NUMERICSERV;
|
|
||||||
#endif
|
|
||||||
printf("%x", ai_flags);
|
|
||||||
printf(")\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void printsocktype(int ai_socktype)
|
|
||||||
{
|
|
||||||
printf("socktype: %d(", ai_socktype);
|
|
||||||
switch (ai_socktype)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
printf("SOCK_ Woe32");
|
|
||||||
break;
|
|
||||||
case SOCK_STREAM:
|
|
||||||
printf("SOCK_STREAM");
|
|
||||||
break;
|
|
||||||
case SOCK_DGRAM:
|
|
||||||
printf("SOCK_DGRAM");
|
|
||||||
break;
|
|
||||||
case SOCK_RAW:
|
|
||||||
printf("SOCK_RAW");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
printf("SOCK_ERROR\n");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
printf(")\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void printprotocol(int ai_protocol)
|
|
||||||
{
|
|
||||||
printf("protocol: %d(", ai_protocol);
|
|
||||||
switch (ai_protocol)
|
|
||||||
{
|
|
||||||
case IPPROTO_IP:
|
|
||||||
printf("IPPROTO_IP");
|
|
||||||
break;
|
|
||||||
case IPPROTO_TCP:
|
|
||||||
printf("IPPROTO_TCP");
|
|
||||||
break;
|
|
||||||
case IPPROTO_UDP:
|
|
||||||
printf("IPPROTO_UDP");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
printf("IPPROTO_ERROR\n");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
printf(")\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void printaddr(int ai_family, const struct sockaddr *ai_addr)
|
|
||||||
{
|
|
||||||
char str[INET_ADDRSTRLEN+1] = "FAKE";
|
|
||||||
printf("family: %d(", ai_family);
|
|
||||||
switch (ai_family)
|
|
||||||
{
|
|
||||||
case AF_UNSPEC:
|
|
||||||
printf("AF_UNSPEC");
|
|
||||||
break;
|
|
||||||
case AF_INET:
|
|
||||||
printf("AF_INET");
|
|
||||||
break;
|
|
||||||
#ifdef AF_INET6
|
|
||||||
case AF_INET6:
|
|
||||||
printf("AF_INET6");
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
|
||||||
printf("AF_ERROR\n");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
printf(")\n");
|
|
||||||
if (ai_family == AF_INET && ai_addr)
|
|
||||||
{
|
|
||||||
const struct sockaddr_in *ip4 = (void *)ai_addr;
|
|
||||||
#ifdef HAVE_NTOP
|
|
||||||
inet_ntop(ai_family, &ip4->sin_addr, str, INET_ADDRSTRLEN);
|
|
||||||
#else
|
|
||||||
strncpy(str, inet_ntoa(ip4->sin_addr), INET_ADDRSTRLEN);
|
|
||||||
#endif
|
|
||||||
printf("port: %d\n", ntohs(ip4->sin_port));
|
|
||||||
}
|
|
||||||
printf("addr: %s\n", str);
|
|
||||||
}
|
|
||||||
|
|
||||||
void printaddrinfo(const struct my_addrinfo *data)
|
|
||||||
{
|
|
||||||
if(data == NULL)
|
|
||||||
{
|
|
||||||
printf("no data\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
printf("starting addrinfo dump\n");
|
|
||||||
while (data != NULL)
|
|
||||||
{
|
|
||||||
printflags(data->ai_flags);
|
|
||||||
printsocktype(data->ai_socktype);
|
|
||||||
printaddr(data->ai_family, data->ai_addr);
|
|
||||||
printprotocol(data->ai_protocol);
|
|
||||||
//addrlen
|
|
||||||
data = data->ai_next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
struct my_addrinfo *res = NULL, hints;
|
|
||||||
int gaie;
|
|
||||||
|
|
||||||
(void)argc;
|
|
||||||
(void)argv;
|
|
||||||
memset(&hints, 0x00, sizeof(struct my_addrinfo));
|
|
||||||
hints.ai_family = AF_INET;
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
{
|
|
||||||
#ifdef USE_WINSOCK2
|
|
||||||
const WORD VerNeed = MAKEWORD(2,2);
|
|
||||||
#else
|
|
||||||
const WORD VerNeed = MAKEWORD(1,1);
|
|
||||||
#endif
|
|
||||||
WSADATA WSAData;
|
|
||||||
WSAStartup(VerNeed, &WSAData);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
printf("-----------------------------------------------------------\n");
|
|
||||||
#ifndef _WIN32 //NULL as res crashes Win32
|
|
||||||
gaie = I_getaddrinfo(NULL, NULL, &hints, NULL);
|
|
||||||
if (gaie != EAI_NONAME)
|
|
||||||
printf("NULLs test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
I_freeaddrinfo(res);
|
|
||||||
#endif
|
|
||||||
#if 0 //NULL as res crashes
|
|
||||||
gaie = I_getaddrinfo("localhost", "5029", NULL, NULL);
|
|
||||||
if (gaie == 0)
|
|
||||||
printf("NULL crashes: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
I_freeaddrinfo(res);
|
|
||||||
#endif
|
|
||||||
gaie = I_getaddrinfo("localhost", NULL, &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("NULL service test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
gaie = I_getaddrinfo(NULL, "5029", &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("NULLs test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
gaie = I_getaddrinfo("localhost", "5029", &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("no hints test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
printf("-----------------------------------------------------------\n");
|
|
||||||
hints.ai_socktype = SOCK_STREAM;
|
|
||||||
hints.ai_protocol = IPPROTO_TCP;
|
|
||||||
gaie = I_getaddrinfo("localhost", NULL, &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("NULL service test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
gaie = I_getaddrinfo(NULL, "5029", &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("NULLs test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
gaie = I_getaddrinfo("localhost", "5029", &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("no hints test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
printf("-----------------------------------------------------------\n");
|
|
||||||
hints.ai_socktype = SOCK_DGRAM;
|
|
||||||
hints.ai_protocol = IPPROTO_UDP;
|
|
||||||
gaie = I_getaddrinfo("localhost", NULL, &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("NULL service test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
gaie = I_getaddrinfo(NULL, "5029", &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("NULLs test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
gaie = I_getaddrinfo("localhost", "5029", &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("no hints test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
printf("-----------------------------------------------------------\n");
|
|
||||||
hints.ai_flags = AI_NUMERICHOST;
|
|
||||||
gaie = I_getaddrinfo("localhost", NULL, &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("NULL service test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
gaie = I_getaddrinfo(NULL, "5029", &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("NULLs test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
gaie = I_getaddrinfo("localhost", "5029", &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("no hints test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
printf("-----------------------------------------------------------\n");
|
|
||||||
gaie = I_getaddrinfo("127.0.0.1", NULL, &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("NULL service test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
gaie = I_getaddrinfo("127.0.0.1", "5029", &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("no hints test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
printf("-----------------------------------------------------------\n");
|
|
||||||
gaie = I_getaddrinfo("255.255.255.255", NULL, &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("NULL service test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
gaie = I_getaddrinfo("255.255.255.255", "5029", &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("no hints test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
printf("-----------------------------------------------------------\n");
|
|
||||||
hints.ai_flags = AI_PASSIVE;
|
|
||||||
gaie = I_getaddrinfo("0.0.0.0", NULL, &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("NULL service test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
gaie = I_getaddrinfo("0.0.0.0", "5029", &hints, &res);
|
|
||||||
//if (gaie != 0)
|
|
||||||
printf("no hints test returned: %s(%d)\n", gai_strerror(gaie), gaie);
|
|
||||||
printaddrinfo(res);
|
|
||||||
I_freeaddrinfo(res); res = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
// SONIC ROBO BLAST 2
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Copyright (C) 2011-2018 by Sonic Team Junior.
|
|
||||||
//
|
|
||||||
// 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 i_addrinfo.h
|
|
||||||
/// \brief getaddrinfo stub
|
|
||||||
|
|
||||||
#ifndef __I_ADDRINFO__
|
|
||||||
#define __I_ADDRINFO__
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
|
||||||
#pragma interface
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef AI_PASSIVE
|
|
||||||
#define AI_PASSIVE 0x01
|
|
||||||
#endif
|
|
||||||
#ifndef AI_NUMERICHOST
|
|
||||||
#define AI_NUMERICHOST 0x04
|
|
||||||
#endif
|
|
||||||
#ifndef AI_V4MAPPED
|
|
||||||
#define AI_V4MAPPED 0x08
|
|
||||||
#endif
|
|
||||||
#ifndef AI_ADDRCONFIG
|
|
||||||
#define AI_ADDRCONFIG 0x20
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#ifndef EAI_NONAME
|
|
||||||
#define EAI_NONAME WSAHOST_NOT_FOUND
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EAI_NONAME
|
|
||||||
#define EAI_NONAME -2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32 // already use the stub for Win32
|
|
||||||
// w32api, ws2tcpip.h, r1.12
|
|
||||||
struct my_addrinfo {
|
|
||||||
int ai_flags;
|
|
||||||
int ai_family;
|
|
||||||
int ai_socktype;
|
|
||||||
int ai_protocol;
|
|
||||||
size_t ai_addrlen;
|
|
||||||
char *ai_canonname;
|
|
||||||
struct sockaddr *ai_addr;
|
|
||||||
struct my_addrinfo *ai_next;
|
|
||||||
};
|
|
||||||
#else
|
|
||||||
#define my_addrinfo addrinfo
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void WS_addrinfocleanup(void);
|
|
||||||
|
|
||||||
#ifndef my_addrinfo
|
|
||||||
void I_freeaddrinfo(struct my_addrinfo *res);
|
|
||||||
int I_getaddrinfo(const char *node, const char *service,
|
|
||||||
const struct my_addrinfo *hints,
|
|
||||||
struct my_addrinfo **res);
|
|
||||||
#elif !defined (test_stub)
|
|
||||||
#define I_getaddrinfo getaddrinfo
|
|
||||||
#define I_freeaddrinfo freeaddrinfo
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
+44
-87
@@ -29,42 +29,36 @@
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define USE_WINSOCK
|
#define USE_WINSOCK
|
||||||
#if defined (_WIN64) || defined (HAVE_IPV6)
|
|
||||||
#define USE_WINSOCK2
|
|
||||||
#else //_WIN64/HAVE_IPV6
|
|
||||||
#define USE_WINSOCK1
|
|
||||||
#endif
|
|
||||||
#endif //WIN32 OS
|
#endif //WIN32 OS
|
||||||
|
|
||||||
#ifdef USE_WINSOCK2
|
#ifdef USE_WINSOCK
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
|
#define addrinfo_t ADDRINFOA
|
||||||
|
#else
|
||||||
|
#define addrinfo_t struct addrinfo
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
|
|
||||||
|
#ifndef USE_WINSOCK
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#ifdef __APPLE_CC__
|
||||||
|
#ifndef _BSD_SOCKLEN_T_
|
||||||
|
#define _BSD_SOCKLEN_T_
|
||||||
|
#endif //_BSD_SOCKLEN_T_
|
||||||
|
#endif //__APPLE_CC__
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#endif //normal BSD API
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#ifdef USE_WINSOCK1
|
|
||||||
#include <winsock.h>
|
|
||||||
#else
|
|
||||||
#ifndef USE_WINSOCK
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#ifdef __APPLE_CC__
|
|
||||||
#ifndef _BSD_SOCKLEN_T_
|
|
||||||
#define _BSD_SOCKLEN_T_
|
|
||||||
#endif //_BSD_SOCKLEN_T_
|
|
||||||
#endif //__APPLE_CC__
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <netdb.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#endif //normal BSD API
|
|
||||||
|
|
||||||
#include <errno.h>
|
#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
|
||||||
|
#include <sys/time.h>
|
||||||
#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
|
#endif // UNIXCOMMON
|
||||||
#include <sys/time.h>
|
|
||||||
#endif // UNIXCOMMON
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_WINSOCK
|
#ifdef USE_WINSOCK
|
||||||
// some undefined under win32
|
// some undefined under win32
|
||||||
@@ -152,7 +146,6 @@ static UINT8 UPNP_support = TRUE;
|
|||||||
#define close closesocket
|
#define close closesocket
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "i_addrinfo.h"
|
|
||||||
#define DEFAULTPORT "5029"
|
#define DEFAULTPORT "5029"
|
||||||
|
|
||||||
#if defined (USE_WINSOCK)
|
#if defined (USE_WINSOCK)
|
||||||
@@ -169,10 +162,6 @@ typedef unsigned long SOCKET_TYPE;
|
|||||||
|
|
||||||
#define IPV6_MULTICAST_ADDRESS "ff15::57e1:1a12"
|
#define IPV6_MULTICAST_ADDRESS "ff15::57e1:1a12"
|
||||||
|
|
||||||
#ifdef USE_WINSOCK1
|
|
||||||
typedef int socklen_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
mysockaddr_t address;
|
mysockaddr_t address;
|
||||||
@@ -232,9 +221,8 @@ static char *get_WSAErrorStr(int e)
|
|||||||
#define strerror get_WSAErrorStr
|
#define strerror get_WSAErrorStr
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_WINSOCK2
|
#ifdef USE_WINSOCK
|
||||||
#define inet_ntop inet_ntopA
|
#define inet_ntop inet_ntopA
|
||||||
#define HAVE_NTOP
|
|
||||||
static const char* inet_ntopA(short af, const void *cp, char *buf, socklen_t len)
|
static const char* inet_ntopA(short af, const void *cp, char *buf, socklen_t len)
|
||||||
{
|
{
|
||||||
DWORD Dlen = len, AFlen = 0;
|
DWORD Dlen = len, AFlen = 0;
|
||||||
@@ -278,8 +266,6 @@ static const char* inet_ntopA(short af, const void *cp, char *buf, socklen_t len
|
|||||||
return NULL;
|
return NULL;
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
#elif !defined (USE_WINSOCK1)
|
|
||||||
#define HAVE_NTOP
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_MINIUPNPC // based on old XChat patch
|
#ifdef HAVE_MINIUPNPC // based on old XChat patch
|
||||||
@@ -360,7 +346,6 @@ static const char *SOCK_AddrToStr(mysockaddr_t *sk)
|
|||||||
static char s[64]; // 255.255.255.255:65535 or
|
static char s[64]; // 255.255.255.255:65535 or
|
||||||
// [ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff]:65535
|
// [ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff]:65535
|
||||||
|
|
||||||
#ifdef HAVE_NTOP
|
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
int v6 = (sk->any.sa_family == AF_INET6);
|
int v6 = (sk->any.sa_family == AF_INET6);
|
||||||
#else
|
#else
|
||||||
@@ -398,15 +383,7 @@ static const char *SOCK_AddrToStr(mysockaddr_t *sk)
|
|||||||
#endif
|
#endif
|
||||||
else if(sk->any.sa_family == AF_INET && sk->ip4.sin_port != 0)
|
else if(sk->any.sa_family == AF_INET && sk->ip4.sin_port != 0)
|
||||||
strcat(s, va(":%d", ntohs(sk->ip4.sin_port)));
|
strcat(s, va(":%d", ntohs(sk->ip4.sin_port)));
|
||||||
#else
|
|
||||||
if (sk->any.sa_family == AF_INET)
|
|
||||||
{
|
|
||||||
strcpy(s, inet_ntoa(sk->ip4.sin_addr));
|
|
||||||
if (sk->ip4.sin_port != 0) strcat(s, va(":%d", ntohs(sk->ip4.sin_port)));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
sprintf(s, "Unknown type");
|
|
||||||
#endif
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -868,15 +845,11 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
|||||||
|
|
||||||
#ifdef USE_WINSOCK
|
#ifdef USE_WINSOCK
|
||||||
{ // Alam_GBC: disable the new UDP connection reset behavior for Win2k and up
|
{ // Alam_GBC: disable the new UDP connection reset behavior for Win2k and up
|
||||||
#ifdef USE_WINSOCK2
|
|
||||||
DWORD dwBytesReturned = 0;
|
DWORD dwBytesReturned = 0;
|
||||||
BOOL bfalse = FALSE;
|
BOOL bfalse = FALSE;
|
||||||
rc = WSAIoctl(s, SIO_UDP_CONNRESET, &bfalse, sizeof(bfalse),
|
rc = WSAIoctl(s, SIO_UDP_CONNRESET, &bfalse, sizeof(bfalse),
|
||||||
NULL, 0, &dwBytesReturned, NULL, NULL);
|
NULL, 0, &dwBytesReturned, NULL, NULL);
|
||||||
#else
|
|
||||||
unsigned long falseval = false;
|
|
||||||
rc = ioctl(s, SIO_UDP_CONNRESET, &falseval);
|
|
||||||
#endif
|
|
||||||
if (rc == -1)
|
if (rc == -1)
|
||||||
{
|
{
|
||||||
e = errno;
|
e = errno;
|
||||||
@@ -1046,7 +1019,7 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
|||||||
static boolean UDP_Socket(void)
|
static boolean UDP_Socket(void)
|
||||||
{
|
{
|
||||||
size_t s;
|
size_t s;
|
||||||
struct my_addrinfo *ai, *runp, hints;
|
addrinfo_t *ai, *runp, hints;
|
||||||
int gaie;
|
int gaie;
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
const INT32 b_ipv6 = M_CheckParm("-ipv6");
|
const INT32 b_ipv6 = M_CheckParm("-ipv6");
|
||||||
@@ -1075,7 +1048,7 @@ static boolean UDP_Socket(void)
|
|||||||
{
|
{
|
||||||
while (M_IsNextParm())
|
while (M_IsNextParm())
|
||||||
{
|
{
|
||||||
gaie = I_getaddrinfo(M_GetNextParm(), serv, &hints, &ai);
|
gaie = getaddrinfo(M_GetNextParm(), serv, &hints, &ai);
|
||||||
if (gaie == 0)
|
if (gaie == 0)
|
||||||
{
|
{
|
||||||
runp = ai;
|
runp = ai;
|
||||||
@@ -1089,13 +1062,13 @@ static boolean UDP_Socket(void)
|
|||||||
}
|
}
|
||||||
runp = runp->ai_next;
|
runp = runp->ai_next;
|
||||||
}
|
}
|
||||||
I_freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gaie = I_getaddrinfo("0.0.0.0", serv, &hints, &ai);
|
gaie = getaddrinfo("0.0.0.0", serv, &hints, &ai);
|
||||||
if (gaie == 0)
|
if (gaie == 0)
|
||||||
{
|
{
|
||||||
runp = ai;
|
runp = ai;
|
||||||
@@ -1116,7 +1089,7 @@ static boolean UDP_Socket(void)
|
|||||||
}
|
}
|
||||||
runp = runp->ai_next;
|
runp = runp->ai_next;
|
||||||
}
|
}
|
||||||
I_freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1128,7 +1101,7 @@ static boolean UDP_Socket(void)
|
|||||||
{
|
{
|
||||||
while (M_IsNextParm())
|
while (M_IsNextParm())
|
||||||
{
|
{
|
||||||
gaie = I_getaddrinfo(M_GetNextParm(), serv, &hints, &ai);
|
gaie = getaddrinfo(M_GetNextParm(), serv, &hints, &ai);
|
||||||
if (gaie == 0)
|
if (gaie == 0)
|
||||||
{
|
{
|
||||||
runp = ai;
|
runp = ai;
|
||||||
@@ -1142,13 +1115,13 @@ static boolean UDP_Socket(void)
|
|||||||
}
|
}
|
||||||
runp = runp->ai_next;
|
runp = runp->ai_next;
|
||||||
}
|
}
|
||||||
I_freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gaie = I_getaddrinfo("::", serv, &hints, &ai);
|
gaie = getaddrinfo("::", serv, &hints, &ai);
|
||||||
if (gaie == 0)
|
if (gaie == 0)
|
||||||
{
|
{
|
||||||
runp = ai;
|
runp = ai;
|
||||||
@@ -1162,7 +1135,7 @@ static boolean UDP_Socket(void)
|
|||||||
}
|
}
|
||||||
runp = runp->ai_next;
|
runp = runp->ai_next;
|
||||||
}
|
}
|
||||||
I_freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1216,11 +1189,7 @@ boolean I_InitTcpDriver(void)
|
|||||||
if (!init_tcp_driver)
|
if (!init_tcp_driver)
|
||||||
{
|
{
|
||||||
#ifdef USE_WINSOCK
|
#ifdef USE_WINSOCK
|
||||||
#ifdef USE_WINSOCK2
|
|
||||||
const WORD VerNeed = MAKEWORD(2,2);
|
const WORD VerNeed = MAKEWORD(2,2);
|
||||||
#else
|
|
||||||
const WORD VerNeed = MAKEWORD(1,1);
|
|
||||||
#endif
|
|
||||||
WSADATA WSAData;
|
WSADATA WSAData;
|
||||||
const int WSAresult = WSAStartup(VerNeed, &WSAData);
|
const int WSAresult = WSAStartup(VerNeed, &WSAData);
|
||||||
if (WSAresult != 0)
|
if (WSAresult != 0)
|
||||||
@@ -1247,21 +1216,14 @@ boolean I_InitTcpDriver(void)
|
|||||||
if (WSAresult != WSAVERNOTSUPPORTED)
|
if (WSAresult != WSAVERNOTSUPPORTED)
|
||||||
CONS_Debug(DBG_NETPLAY, "WinSock(TCP/IP) error: %s\n",WSError);
|
CONS_Debug(DBG_NETPLAY, "WinSock(TCP/IP) error: %s\n",WSError);
|
||||||
}
|
}
|
||||||
#ifdef USE_WINSOCK2
|
|
||||||
if(LOBYTE(WSAData.wVersion) != 2 ||
|
if (LOBYTE(WSAData.wVersion) != 2 ||
|
||||||
HIBYTE(WSAData.wVersion) != 2)
|
HIBYTE(WSAData.wVersion) != 2)
|
||||||
{
|
{
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
CONS_Debug(DBG_NETPLAY, "No WinSock(TCP/IP) 2.2 driver detected\n");
|
CONS_Debug(DBG_NETPLAY, "No WinSock(TCP/IP) 2.2 driver detected\n");
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (LOBYTE(WSAData.wVersion) != 1 ||
|
|
||||||
HIBYTE(WSAData.wVersion) != 1)
|
|
||||||
{
|
|
||||||
WSACleanup();
|
|
||||||
CONS_Debug(DBG_NETPLAY, "No WinSock(TCP/IP) 1.1 driver detected\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
CONS_Debug(DBG_NETPLAY, "WinSock description: %s\n",WSAData.szDescription);
|
CONS_Debug(DBG_NETPLAY, "WinSock description: %s\n",WSAData.szDescription);
|
||||||
CONS_Debug(DBG_NETPLAY, "WinSock System Status: %s\n",WSAData.szSystemStatus);
|
CONS_Debug(DBG_NETPLAY, "WinSock System Status: %s\n",WSAData.szSystemStatus);
|
||||||
#endif
|
#endif
|
||||||
@@ -1301,7 +1263,6 @@ void I_ShutdownTcpDriver(void)
|
|||||||
|
|
||||||
CONS_Printf("I_ShutdownTcpDriver: ");
|
CONS_Printf("I_ShutdownTcpDriver: ");
|
||||||
#ifdef USE_WINSOCK
|
#ifdef USE_WINSOCK
|
||||||
WS_addrinfocleanup();
|
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
#endif
|
#endif
|
||||||
CONS_Printf("shut down\n");
|
CONS_Printf("shut down\n");
|
||||||
@@ -1310,24 +1271,24 @@ void I_ShutdownTcpDriver(void)
|
|||||||
|
|
||||||
static boolean SOCK_GetAddr(struct sockaddr_in *sin, const char *address, const char *port, boolean test)
|
static boolean SOCK_GetAddr(struct sockaddr_in *sin, const char *address, const char *port, boolean test)
|
||||||
{
|
{
|
||||||
struct my_addrinfo *ai = NULL, *runp, hints;
|
addrinfo_t *ai = NULL, *runp, hints;
|
||||||
int gaie;
|
int gaie;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (!port || !port[0])
|
if (!port || !port[0])
|
||||||
port = DEFAULTPORT;
|
port = DEFAULTPORT;
|
||||||
|
|
||||||
memset (&hints, 0x00, sizeof (hints));
|
memset(&hints, 0x00, sizeof (hints));
|
||||||
hints.ai_flags = AI_ADDRCONFIG;
|
hints.ai_flags = AI_ADDRCONFIG;
|
||||||
hints.ai_family = AF_UNSPEC;
|
hints.ai_family = AF_UNSPEC;
|
||||||
hints.ai_socktype = SOCK_DGRAM;
|
hints.ai_socktype = SOCK_DGRAM;
|
||||||
hints.ai_protocol = IPPROTO_UDP;
|
hints.ai_protocol = IPPROTO_UDP;
|
||||||
|
|
||||||
gaie = I_getaddrinfo(address, port, &hints, &ai);
|
gaie = getaddrinfo(address, port, &hints, &ai);
|
||||||
|
|
||||||
if (gaie != 0)
|
if (gaie != 0)
|
||||||
{
|
{
|
||||||
I_freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1356,7 +1317,7 @@ static boolean SOCK_GetAddr(struct sockaddr_in *sin, const char *address, const
|
|||||||
if (runp != NULL)
|
if (runp != NULL)
|
||||||
memcpy(sin, runp->ai_addr, runp->ai_addrlen);
|
memcpy(sin, runp->ai_addr, runp->ai_addrlen);
|
||||||
|
|
||||||
I_freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
|
|
||||||
return (runp != NULL);
|
return (runp != NULL);
|
||||||
}
|
}
|
||||||
@@ -1554,7 +1515,7 @@ static boolean SOCK_SetUnbanTime(time_t timestamp)
|
|||||||
|
|
||||||
static boolean SOCK_SetBanAddress(const char *address, const char *mask)
|
static boolean SOCK_SetBanAddress(const char *address, const char *mask)
|
||||||
{
|
{
|
||||||
struct my_addrinfo *ai, *runp, hints;
|
addrinfo_t *ai, *runp, hints;
|
||||||
int gaie;
|
int gaie;
|
||||||
|
|
||||||
if (!address)
|
if (!address)
|
||||||
@@ -1566,7 +1527,7 @@ static boolean SOCK_SetBanAddress(const char *address, const char *mask)
|
|||||||
hints.ai_socktype = SOCK_DGRAM;
|
hints.ai_socktype = SOCK_DGRAM;
|
||||||
hints.ai_protocol = IPPROTO_UDP;
|
hints.ai_protocol = IPPROTO_UDP;
|
||||||
|
|
||||||
gaie = I_getaddrinfo(address, "0", &hints, &ai);
|
gaie = getaddrinfo(address, "0", &hints, &ai);
|
||||||
if (gaie != 0)
|
if (gaie != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -1611,7 +1572,7 @@ static boolean SOCK_SetBanAddress(const char *address, const char *mask)
|
|||||||
runp = runp->ai_next;
|
runp = runp->ai_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
I_freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1660,8 +1621,6 @@ boolean I_InitTcpNetwork(void)
|
|||||||
// FIXME: for dedicated server, numnodes needs to be set to 0 upon start
|
// FIXME: for dedicated server, numnodes needs to be set to 0 upon start
|
||||||
if (dedicated)
|
if (dedicated)
|
||||||
doomcom->numnodes = 0;
|
doomcom->numnodes = 0;
|
||||||
/* else if (M_IsNextParm())
|
|
||||||
doomcom->numnodes = (INT16)atoi(M_GetNextParm());*/
|
|
||||||
else
|
else
|
||||||
doomcom->numnodes = 1;
|
doomcom->numnodes = 1;
|
||||||
|
|
||||||
@@ -1746,5 +1705,3 @@ boolean I_InitTcpNetwork(void)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "i_addrinfo.c"
|
|
||||||
+1
-1
@@ -94,8 +94,8 @@ INT32 VID_SetMode(INT32 modenum);
|
|||||||
\return name of video mode
|
\return name of video mode
|
||||||
*/
|
*/
|
||||||
const char *VID_GetModeName(INT32 modenum);
|
const char *VID_GetModeName(INT32 modenum);
|
||||||
void VID_PrepareModeList(void); /// note hack for SDL
|
|
||||||
|
|
||||||
|
void VID_PrepareModeList(void);
|
||||||
|
|
||||||
/** \brief can video system do fullscreen
|
/** \brief can video system do fullscreen
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
// 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 "k_stats.h"
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
// 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__
|
#ifndef __K_STATS__
|
||||||
#define __K_STATS__
|
#define __K_STATS__
|
||||||
|
|
||||||
|
|||||||
+60
-16
@@ -797,8 +797,12 @@ static UINT8 ArchiveValue(UINT8 **p, int TABLESINDEX, int myindex)
|
|||||||
{
|
{
|
||||||
mobj_t *mobj = *((mobj_t **)lua_touserdata(gL, myindex));
|
mobj_t *mobj = *((mobj_t **)lua_touserdata(gL, myindex));
|
||||||
if (!mobj)
|
if (!mobj)
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_NULL);
|
WRITEUINT8(*p, ARCH_NULL);
|
||||||
else {
|
return 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_MOBJ);
|
WRITEUINT8(*p, ARCH_MOBJ);
|
||||||
WRITEUINT32(*p, mobj->mobjnum);
|
WRITEUINT32(*p, mobj->mobjnum);
|
||||||
}
|
}
|
||||||
@@ -808,8 +812,12 @@ static UINT8 ArchiveValue(UINT8 **p, int TABLESINDEX, int myindex)
|
|||||||
{
|
{
|
||||||
player_t *player = *((player_t **)lua_touserdata(gL, myindex));
|
player_t *player = *((player_t **)lua_touserdata(gL, myindex));
|
||||||
if (!player)
|
if (!player)
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_NULL);
|
WRITEUINT8(*p, ARCH_NULL);
|
||||||
else {
|
return 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_PLAYER);
|
WRITEUINT8(*p, ARCH_PLAYER);
|
||||||
WRITEUINT8(*p, player - players);
|
WRITEUINT8(*p, player - players);
|
||||||
}
|
}
|
||||||
@@ -819,8 +827,12 @@ static UINT8 ArchiveValue(UINT8 **p, int TABLESINDEX, int myindex)
|
|||||||
{
|
{
|
||||||
mapthing_t *mapthing = *((mapthing_t **)lua_touserdata(gL, myindex));
|
mapthing_t *mapthing = *((mapthing_t **)lua_touserdata(gL, myindex));
|
||||||
if (!mapthing)
|
if (!mapthing)
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_NULL);
|
WRITEUINT8(*p, ARCH_NULL);
|
||||||
else {
|
return 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_MAPTHING);
|
WRITEUINT8(*p, ARCH_MAPTHING);
|
||||||
WRITEUINT16(*p, mapthing - mapthings);
|
WRITEUINT16(*p, mapthing - mapthings);
|
||||||
}
|
}
|
||||||
@@ -830,8 +842,12 @@ static UINT8 ArchiveValue(UINT8 **p, int TABLESINDEX, int myindex)
|
|||||||
{
|
{
|
||||||
vertex_t *vertex = *((vertex_t **)lua_touserdata(gL, myindex));
|
vertex_t *vertex = *((vertex_t **)lua_touserdata(gL, myindex));
|
||||||
if (!vertex)
|
if (!vertex)
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_NULL);
|
WRITEUINT8(*p, ARCH_NULL);
|
||||||
else {
|
return 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_VERTEX);
|
WRITEUINT8(*p, ARCH_VERTEX);
|
||||||
WRITEUINT16(*p, vertex - vertexes);
|
WRITEUINT16(*p, vertex - vertexes);
|
||||||
}
|
}
|
||||||
@@ -841,8 +857,12 @@ static UINT8 ArchiveValue(UINT8 **p, int TABLESINDEX, int myindex)
|
|||||||
{
|
{
|
||||||
line_t *line = *((line_t **)lua_touserdata(gL, myindex));
|
line_t *line = *((line_t **)lua_touserdata(gL, myindex));
|
||||||
if (!line)
|
if (!line)
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_NULL);
|
WRITEUINT8(*p, ARCH_NULL);
|
||||||
else {
|
return 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_LINE);
|
WRITEUINT8(*p, ARCH_LINE);
|
||||||
WRITEUINT16(*p, line - lines);
|
WRITEUINT16(*p, line - lines);
|
||||||
}
|
}
|
||||||
@@ -852,8 +872,12 @@ static UINT8 ArchiveValue(UINT8 **p, int TABLESINDEX, int myindex)
|
|||||||
{
|
{
|
||||||
side_t *side = *((side_t **)lua_touserdata(gL, myindex));
|
side_t *side = *((side_t **)lua_touserdata(gL, myindex));
|
||||||
if (!side)
|
if (!side)
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_NULL);
|
WRITEUINT8(*p, ARCH_NULL);
|
||||||
else {
|
return 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_SIDE);
|
WRITEUINT8(*p, ARCH_SIDE);
|
||||||
WRITEUINT16(*p, side - sides);
|
WRITEUINT16(*p, side - sides);
|
||||||
}
|
}
|
||||||
@@ -863,8 +887,12 @@ static UINT8 ArchiveValue(UINT8 **p, int TABLESINDEX, int myindex)
|
|||||||
{
|
{
|
||||||
subsector_t *subsector = *((subsector_t **)lua_touserdata(gL, myindex));
|
subsector_t *subsector = *((subsector_t **)lua_touserdata(gL, myindex));
|
||||||
if (!subsector)
|
if (!subsector)
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_NULL);
|
WRITEUINT8(*p, ARCH_NULL);
|
||||||
else {
|
return 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_SUBSECTOR);
|
WRITEUINT8(*p, ARCH_SUBSECTOR);
|
||||||
WRITEUINT16(*p, subsector - subsectors);
|
WRITEUINT16(*p, subsector - subsectors);
|
||||||
}
|
}
|
||||||
@@ -874,8 +902,12 @@ static UINT8 ArchiveValue(UINT8 **p, int TABLESINDEX, int myindex)
|
|||||||
{
|
{
|
||||||
sector_t *sector = *((sector_t **)lua_touserdata(gL, myindex));
|
sector_t *sector = *((sector_t **)lua_touserdata(gL, myindex));
|
||||||
if (!sector)
|
if (!sector)
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_NULL);
|
WRITEUINT8(*p, ARCH_NULL);
|
||||||
else {
|
return 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_SECTOR);
|
WRITEUINT8(*p, ARCH_SECTOR);
|
||||||
WRITEUINT16(*p, sector - sectors);
|
WRITEUINT16(*p, sector - sectors);
|
||||||
}
|
}
|
||||||
@@ -885,8 +917,12 @@ static UINT8 ArchiveValue(UINT8 **p, int TABLESINDEX, int myindex)
|
|||||||
{
|
{
|
||||||
pslope_t *slope = *((pslope_t **)lua_touserdata(gL, myindex));
|
pslope_t *slope = *((pslope_t **)lua_touserdata(gL, myindex));
|
||||||
if (!slope)
|
if (!slope)
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_NULL);
|
WRITEUINT8(*p, ARCH_NULL);
|
||||||
else {
|
return 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_SLOPE);
|
WRITEUINT8(*p, ARCH_SLOPE);
|
||||||
WRITEUINT16(*p, slope->id);
|
WRITEUINT16(*p, slope->id);
|
||||||
}
|
}
|
||||||
@@ -896,8 +932,12 @@ static UINT8 ArchiveValue(UINT8 **p, int TABLESINDEX, int myindex)
|
|||||||
{
|
{
|
||||||
mapheader_t *header = *((mapheader_t **)lua_touserdata(gL, myindex));
|
mapheader_t *header = *((mapheader_t **)lua_touserdata(gL, myindex));
|
||||||
if (!header)
|
if (!header)
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_NULL);
|
WRITEUINT8(*p, ARCH_NULL);
|
||||||
else {
|
return 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
WRITEUINT8(*p, ARCH_MAPHEADER);
|
WRITEUINT8(*p, ARCH_MAPHEADER);
|
||||||
WRITEUINT16(*p, header - *mapheaderinfo);
|
WRITEUINT16(*p, header - *mapheaderinfo);
|
||||||
}
|
}
|
||||||
@@ -1003,19 +1043,23 @@ static void ArchiveTables(UINT8 **p)
|
|||||||
e = ArchiveValue(p, TABLESINDEX, -2); // key should be either a number or a string, ArchiveValue can handle this.
|
e = ArchiveValue(p, TABLESINDEX, -2); // key should be either a number or a string, ArchiveValue can handle this.
|
||||||
if (e == 2) // invalid key type (function, thread, lightuserdata, or anything we don't recognise)
|
if (e == 2) // invalid key type (function, thread, lightuserdata, or anything we don't recognise)
|
||||||
{
|
{
|
||||||
lua_pushvalue(gL, -2);
|
CONS_Alert(CONS_ERROR, "Index '%s' (%s) of table %d could not be archived!\n", lua_tostring(gL, -2), luaL_typename(gL, -2), i);
|
||||||
CONS_Alert(CONS_ERROR, "Index '%s' (%s) of table %d could not be archived!\n", lua_tostring(gL, -1), luaL_typename(gL, -1), i);
|
|
||||||
lua_pop(gL, 1);
|
|
||||||
}
|
}
|
||||||
|
else if (e == 3) // nil key due to invalid userdata. NOT an error.
|
||||||
|
{
|
||||||
|
lua_pop(gL, 1);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Write value
|
// Write value
|
||||||
e = ArchiveValue(p, TABLESINDEX, -1);
|
e = ArchiveValue(p, TABLESINDEX, -1);
|
||||||
if (e == 1)
|
if (e == 1)
|
||||||
|
{
|
||||||
n++; // the table contained a new table we'll have to archive. :(
|
n++; // the table contained a new table we'll have to archive. :(
|
||||||
|
}
|
||||||
else if (e == 2) // invalid value type
|
else if (e == 2) // invalid value type
|
||||||
{
|
{
|
||||||
lua_pushvalue(gL, -2);
|
CONS_Alert(CONS_ERROR, "Type of value for table %d entry '%s' (%s) could not be archived!\n", i, lua_tostring(gL, -2), luaL_typename(gL, -1));
|
||||||
CONS_Alert(CONS_ERROR, "Type of value for table %d entry '%s' (%s) could not be archived!\n", i, lua_tostring(gL, -1), luaL_typename(gL, -1));
|
|
||||||
lua_pop(gL, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lua_pop(gL, 1);
|
lua_pop(gL, 1);
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
// 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 "doomtype.h"
|
||||||
#include "m_fixed.h"
|
#include "m_fixed.h"
|
||||||
#include "lua_udatalib.h"
|
#include "lua_udatalib.h"
|
||||||
|
|||||||
+12
-1
@@ -1,3 +1,14 @@
|
|||||||
|
// 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__
|
#ifndef __LUA_UDATALIB_H__
|
||||||
#define __LUA_UDATALIB_H__
|
#define __LUA_UDATALIB_H__
|
||||||
|
|
||||||
@@ -100,4 +111,4 @@ void udatalib_addfields(lua_State *L, int mt, const udata_field_t fields[]);
|
|||||||
return 0; \
|
return 0; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -1,3 +1,14 @@
|
|||||||
|
// 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 "m_curl.h"
|
||||||
#include "doomtype.h"
|
#include "doomtype.h"
|
||||||
#include "i_system.h" // I_OutputMsg
|
#include "i_system.h" // I_OutputMsg
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
// 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__
|
#ifndef __M_CURL__
|
||||||
#define __M_CURL__
|
#define __M_CURL__
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
// 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 <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
// 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__
|
#ifndef __M_EMOTES__
|
||||||
#define __M_EMOTES__
|
#define __M_EMOTES__
|
||||||
|
|
||||||
|
|||||||
+7
-4
@@ -2713,6 +2713,10 @@ static void M_PrepareLevelSelect(void)
|
|||||||
//
|
//
|
||||||
boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt)
|
boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt)
|
||||||
{
|
{
|
||||||
|
// invalid mapnum
|
||||||
|
if (mapnum < -1)
|
||||||
|
return false;
|
||||||
|
|
||||||
// Random map!
|
// Random map!
|
||||||
if (mapnum == -1)
|
if (mapnum == -1)
|
||||||
return (gamestate != GS_TIMEATTACK && !modeattacking);
|
return (gamestate != GS_TIMEATTACK && !modeattacking);
|
||||||
@@ -7220,7 +7224,7 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
|
|||||||
if (i == oldval)
|
if (i == oldval)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!mapheaderinfo[i])
|
if (i >= 0 && !mapheaderinfo[i])
|
||||||
continue; // Don't allocate the header. That just makes memory usage skyrocket.
|
continue; // Don't allocate the header. That just makes memory usage skyrocket.
|
||||||
|
|
||||||
} while (!M_CanShowLevelInList(i, cv_newgametype.value));
|
} while (!M_CanShowLevelInList(i, cv_newgametype.value));
|
||||||
@@ -7258,7 +7262,7 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
|
|||||||
if (i == oldval)
|
if (i == oldval)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!mapheaderinfo[i])
|
if (i >= 0 && !mapheaderinfo[i])
|
||||||
continue; // Don't allocate the header. That just makes memory usage skyrocket.
|
continue; // Don't allocate the header. That just makes memory usage skyrocket.
|
||||||
|
|
||||||
} while (!M_CanShowLevelInList(i, cv_newgametype.value));
|
} while (!M_CanShowLevelInList(i, cv_newgametype.value));
|
||||||
@@ -9438,9 +9442,8 @@ static void M_VideoModeMenu(INT32 choice)
|
|||||||
|
|
||||||
memset(modedescs, 0, sizeof(modedescs));
|
memset(modedescs, 0, sizeof(modedescs));
|
||||||
|
|
||||||
#if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
|
||||||
VID_PrepareModeList(); // FIXME: hack
|
VID_PrepareModeList(); // FIXME: hack
|
||||||
#endif
|
|
||||||
vidm_nummodes = 0;
|
vidm_nummodes = 0;
|
||||||
vidm_selected = 0;
|
vidm_selected = 0;
|
||||||
nummodes = VID_NumModes();
|
nummodes = VID_NumModes();
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
// 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_textinput.h"
|
||||||
#include "m_menu.h" // MAXSTRINGLENGTH
|
#include "m_menu.h" // MAXSTRINGLENGTH
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
// 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__
|
#ifndef __M_TEXTINPUT__
|
||||||
#define __M_TEXTINPUT__
|
#define __M_TEXTINPUT__
|
||||||
|
|
||||||
|
|||||||
+32
-32
@@ -61,7 +61,7 @@ typedef enum
|
|||||||
//
|
//
|
||||||
// P_ArchivePlayer
|
// P_ArchivePlayer
|
||||||
//
|
//
|
||||||
static inline void P_ArchivePlayer(savebuffer_t *save)
|
FUNCINLINE static ATTRINLINE void P_ArchivePlayer(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
const player_t *player = &players[consoleplayer];
|
const player_t *player = &players[consoleplayer];
|
||||||
INT32 pllives = player->lives;
|
INT32 pllives = player->lives;
|
||||||
@@ -85,7 +85,7 @@ static inline void P_ArchivePlayer(savebuffer_t *save)
|
|||||||
//
|
//
|
||||||
// P_UnArchivePlayer
|
// P_UnArchivePlayer
|
||||||
//
|
//
|
||||||
static inline void P_UnArchivePlayer(savebuffer_t *save)
|
FUNCINLINE static ATTRINLINE void P_UnArchivePlayer(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
savedata.skincolor = READUINT8(save->p);
|
savedata.skincolor = READUINT8(save->p);
|
||||||
savedata.skin = READUINT8(save->p);
|
savedata.skin = READUINT8(save->p);
|
||||||
@@ -1043,25 +1043,25 @@ typedef enum
|
|||||||
tc_end
|
tc_end
|
||||||
} specials_e;
|
} specials_e;
|
||||||
|
|
||||||
static inline UINT32 SaveMobjnum(const mobj_t *mobj)
|
FUNCINLINE static ATTRINLINE UINT32 SaveMobjnum(const mobj_t *mobj)
|
||||||
{
|
{
|
||||||
if (mobj) return mobj->mobjnum;
|
if (mobj) return mobj->mobjnum;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline UINT32 SaveSector(const sector_t *sector)
|
FUNCINLINE static ATTRINLINE UINT32 SaveSector(const sector_t *sector)
|
||||||
{
|
{
|
||||||
if (sector) return (UINT32)(sector - sectors);
|
if (sector) return (UINT32)(sector - sectors);
|
||||||
return 0xFFFFFFFF;
|
return 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline UINT32 SaveLine(const line_t *line)
|
FUNCINLINE static ATTRINLINE UINT32 SaveLine(const line_t *line)
|
||||||
{
|
{
|
||||||
if (line) return (UINT32)(line - lines);
|
if (line) return (UINT32)(line - lines);
|
||||||
return 0xFFFFFFFF;
|
return 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline UINT32 SavePlayer(const player_t *player)
|
FUNCINLINE static ATTRINLINE UINT32 SavePlayer(const player_t *player)
|
||||||
{
|
{
|
||||||
if (player) return (UINT32)(player - players);
|
if (player) return (UINT32)(player - players);
|
||||||
return 0xFFFFFFFF;
|
return 0xFFFFFFFF;
|
||||||
@@ -1476,7 +1476,7 @@ static void SaveElevatorThinker(savebuffer_t *save, const thinker_t *th, const U
|
|||||||
//
|
//
|
||||||
// Saves a scroll_t thinker
|
// Saves a scroll_t thinker
|
||||||
//
|
//
|
||||||
static inline void SaveScrollThinker(savebuffer_t *save, const thinker_t *th, const UINT8 type)
|
FUNCINLINE static ATTRINLINE void SaveScrollThinker(savebuffer_t *save, const thinker_t *th, const UINT8 type)
|
||||||
{
|
{
|
||||||
const scroll_t *ht = (const void *)th;
|
const scroll_t *ht = (const void *)th;
|
||||||
WRITEUINT8(save->p, type);
|
WRITEUINT8(save->p, type);
|
||||||
@@ -1497,7 +1497,7 @@ static inline void SaveScrollThinker(savebuffer_t *save, const thinker_t *th, co
|
|||||||
//
|
//
|
||||||
// Saves a friction_t thinker
|
// Saves a friction_t thinker
|
||||||
//
|
//
|
||||||
static inline void SaveFrictionThinker(savebuffer_t *save, const thinker_t *th, const UINT8 type)
|
FUNCINLINE static ATTRINLINE void SaveFrictionThinker(savebuffer_t *save, const thinker_t *th, const UINT8 type)
|
||||||
{
|
{
|
||||||
const friction_t *ht = (const void *)th;
|
const friction_t *ht = (const void *)th;
|
||||||
WRITEUINT8(save->p, type);
|
WRITEUINT8(save->p, type);
|
||||||
@@ -1513,7 +1513,7 @@ static inline void SaveFrictionThinker(savebuffer_t *save, const thinker_t *th,
|
|||||||
//
|
//
|
||||||
// Saves a pusher_t thinker
|
// Saves a pusher_t thinker
|
||||||
//
|
//
|
||||||
static inline void SavePusherThinker(savebuffer_t *save, const thinker_t *th, const UINT8 type)
|
FUNCINLINE static ATTRINLINE void SavePusherThinker(savebuffer_t *save, const thinker_t *th, const UINT8 type)
|
||||||
{
|
{
|
||||||
const pusher_t *ht = (const void *)th;
|
const pusher_t *ht = (const void *)th;
|
||||||
WRITEUINT8(save->p, type);
|
WRITEUINT8(save->p, type);
|
||||||
@@ -1598,7 +1598,7 @@ static void SaveDisappearThinker(savebuffer_t *save, const thinker_t *th, const
|
|||||||
//
|
//
|
||||||
// Saves a polyrotate_t thinker
|
// Saves a polyrotate_t thinker
|
||||||
//
|
//
|
||||||
static inline void SavePolyrotatetThinker(savebuffer_t *save, const thinker_t *th, const UINT8 type)
|
FUNCINLINE static ATTRINLINE void SavePolyrotatetThinker(savebuffer_t *save, const thinker_t *th, const UINT8 type)
|
||||||
{
|
{
|
||||||
const polyrotate_t *ht = (const void *)th;
|
const polyrotate_t *ht = (const void *)th;
|
||||||
WRITEUINT8(save->p, type);
|
WRITEUINT8(save->p, type);
|
||||||
@@ -1935,25 +1935,25 @@ mobj_t *P_FindNewPosition(UINT32 oldposition)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline mobj_t *LoadMobj(UINT32 mobjnum)
|
FUNCINLINE static ATTRINLINE mobj_t *LoadMobj(UINT32 mobjnum)
|
||||||
{
|
{
|
||||||
if (mobjnum == 0) return NULL;
|
if (mobjnum == 0) return NULL;
|
||||||
return (mobj_t *)(size_t)mobjnum;
|
return (mobj_t *)(size_t)mobjnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline sector_t *LoadSector(UINT32 sector)
|
FUNCINLINE static ATTRINLINE sector_t *LoadSector(UINT32 sector)
|
||||||
{
|
{
|
||||||
if (sector >= numsectors) return NULL;
|
if (sector >= numsectors) return NULL;
|
||||||
return §ors[sector];
|
return §ors[sector];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline line_t *LoadLine(UINT32 line)
|
FUNCINLINE static ATTRINLINE line_t *LoadLine(UINT32 line)
|
||||||
{
|
{
|
||||||
if (line >= numlines) return NULL;
|
if (line >= numlines) return NULL;
|
||||||
return &lines[line];
|
return &lines[line];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline player_t *LoadPlayer(UINT32 player)
|
FUNCINLINE static ATTRINLINE player_t *LoadPlayer(UINT32 player)
|
||||||
{
|
{
|
||||||
if (player >= MAXPLAYERS) return NULL;
|
if (player >= MAXPLAYERS) return NULL;
|
||||||
return &players[player];
|
return &players[player];
|
||||||
@@ -2529,7 +2529,7 @@ static void LoadScrollThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
//
|
//
|
||||||
// Loads a friction_t from a save game
|
// Loads a friction_t from a save game
|
||||||
//
|
//
|
||||||
static inline void LoadFrictionThinker(savebuffer_t *save, actionf_p1 thinker)
|
FUNCINLINE static ATTRINLINE void LoadFrictionThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
friction_t *ht = (friction_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
friction_t *ht = (friction_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
||||||
ht->thinker.alloctype = TAT_LEVELPOOL;
|
ht->thinker.alloctype = TAT_LEVELPOOL;
|
||||||
@@ -2576,7 +2576,7 @@ static void LoadPusherThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
//
|
//
|
||||||
// Loads a laserthink_t from a save game
|
// Loads a laserthink_t from a save game
|
||||||
//
|
//
|
||||||
static inline void LoadLaserThinker(savebuffer_t *save, actionf_p1 thinker)
|
FUNCINLINE static ATTRINLINE void LoadLaserThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
laserthink_t *ht = (laserthink_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
laserthink_t *ht = (laserthink_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
||||||
ht->thinker.alloctype = TAT_LEVELPOOL;
|
ht->thinker.alloctype = TAT_LEVELPOOL;
|
||||||
@@ -2621,7 +2621,7 @@ FUNCINLINE static ATTRINLINE void LoadLightlevelThinker(savebuffer_t *save, acti
|
|||||||
//
|
//
|
||||||
// Loads a executor_t from a save game
|
// Loads a executor_t from a save game
|
||||||
//
|
//
|
||||||
static inline void LoadExecutorThinker(savebuffer_t *save, actionf_p1 thinker)
|
FUNCINLINE static ATTRINLINE void LoadExecutorThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
executor_t *ht = (executor_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
executor_t *ht = (executor_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
||||||
ht->thinker.alloctype = TAT_LEVELPOOL;
|
ht->thinker.alloctype = TAT_LEVELPOOL;
|
||||||
@@ -2639,7 +2639,7 @@ static inline void LoadExecutorThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
//
|
//
|
||||||
// Loads a disappear_t thinker
|
// Loads a disappear_t thinker
|
||||||
//
|
//
|
||||||
static inline void LoadDisappearThinker(savebuffer_t *save, actionf_p1 thinker)
|
FUNCINLINE static ATTRINLINE void LoadDisappearThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
disappear_t *ht = (disappear_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
disappear_t *ht = (disappear_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
||||||
ht->thinker.alloctype = TAT_LEVELPOOL;
|
ht->thinker.alloctype = TAT_LEVELPOOL;
|
||||||
@@ -2660,7 +2660,7 @@ static inline void LoadDisappearThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
//
|
//
|
||||||
// Loads a polyrotate_t thinker
|
// Loads a polyrotate_t thinker
|
||||||
//
|
//
|
||||||
static inline void LoadPolyrotatetThinker(savebuffer_t *save, actionf_p1 thinker)
|
FUNCINLINE static ATTRINLINE void LoadPolyrotatetThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
polyrotate_t *ht = (polyrotate_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
polyrotate_t *ht = (polyrotate_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
||||||
ht->thinker.alloctype = TAT_LEVELPOOL;
|
ht->thinker.alloctype = TAT_LEVELPOOL;
|
||||||
@@ -2720,7 +2720,7 @@ static void LoadPolymoveThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
//
|
//
|
||||||
// Loads a polywaypoint_t thinker
|
// Loads a polywaypoint_t thinker
|
||||||
//
|
//
|
||||||
static inline void LoadPolywaypointThinker(savebuffer_t *save, actionf_p1 thinker)
|
FUNCINLINE static ATTRINLINE void LoadPolywaypointThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
polywaypoint_t *ht = (polywaypoint_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
polywaypoint_t *ht = (polywaypoint_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
||||||
ht->thinker.alloctype = TAT_LEVELPOOL;
|
ht->thinker.alloctype = TAT_LEVELPOOL;
|
||||||
@@ -2776,7 +2776,7 @@ static inline void LoadPolywaypointThinker(savebuffer_t *save, actionf_p1 thinke
|
|||||||
//
|
//
|
||||||
// loads a polyslidedoor_t thinker
|
// loads a polyslidedoor_t thinker
|
||||||
//
|
//
|
||||||
static inline void LoadPolyslidedoorThinker(savebuffer_t *save, actionf_p1 thinker)
|
FUNCINLINE static ATTRINLINE void LoadPolyslidedoorThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
polyslidedoor_t *ht = (polyslidedoor_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
polyslidedoor_t *ht = (polyslidedoor_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
||||||
ht->thinker.alloctype = TAT_LEVELPOOL;
|
ht->thinker.alloctype = TAT_LEVELPOOL;
|
||||||
@@ -2814,7 +2814,7 @@ static inline void LoadPolyslidedoorThinker(savebuffer_t *save, actionf_p1 think
|
|||||||
//
|
//
|
||||||
// Loads a polyswingdoor_t thinker
|
// Loads a polyswingdoor_t thinker
|
||||||
//
|
//
|
||||||
static inline void LoadPolyswingdoorThinker(savebuffer_t *save, actionf_p1 thinker)
|
FUNCINLINE static ATTRINLINE void LoadPolyswingdoorThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
polyswingdoor_t *ht = (polyswingdoor_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
polyswingdoor_t *ht = (polyswingdoor_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
||||||
ht->thinker.alloctype = TAT_LEVELPOOL;
|
ht->thinker.alloctype = TAT_LEVELPOOL;
|
||||||
@@ -2847,7 +2847,7 @@ static inline void LoadPolyswingdoorThinker(savebuffer_t *save, actionf_p1 think
|
|||||||
//
|
//
|
||||||
// Loads a polydisplace_t thinker
|
// Loads a polydisplace_t thinker
|
||||||
//
|
//
|
||||||
static inline void LoadPolydisplaceThinker(savebuffer_t *save, actionf_p1 thinker)
|
FUNCINLINE static ATTRINLINE void LoadPolydisplaceThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||||
{
|
{
|
||||||
polydisplace_t *ht = (polydisplace_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
polydisplace_t *ht = (polydisplace_t*)Z_LevelPoolMalloc(sizeof (*ht));
|
||||||
ht->thinker.alloctype = TAT_LEVELPOOL;
|
ht->thinker.alloctype = TAT_LEVELPOOL;
|
||||||
@@ -3115,7 +3115,7 @@ static void P_NetUnArchiveThinkers(savebuffer_t *save)
|
|||||||
#define PD_FLAGS 0x01
|
#define PD_FLAGS 0x01
|
||||||
#define PD_TRANS 0x02
|
#define PD_TRANS 0x02
|
||||||
|
|
||||||
static inline void P_ArchivePolyObj(savebuffer_t *save, polyobj_t *po)
|
FUNCINLINE static ATTRINLINE void P_ArchivePolyObj(savebuffer_t *save, polyobj_t *po)
|
||||||
{
|
{
|
||||||
UINT8 diff = 0;
|
UINT8 diff = 0;
|
||||||
WRITEINT32(save->p, po->id);
|
WRITEINT32(save->p, po->id);
|
||||||
@@ -3137,7 +3137,7 @@ static inline void P_ArchivePolyObj(savebuffer_t *save, polyobj_t *po)
|
|||||||
WRITEINT32(save->p, po->translucency);
|
WRITEINT32(save->p, po->translucency);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void P_UnArchivePolyObj(savebuffer_t *save, polyobj_t *po)
|
FUNCINLINE static ATTRINLINE void P_UnArchivePolyObj(savebuffer_t *save, polyobj_t *po)
|
||||||
{
|
{
|
||||||
INT32 id;
|
INT32 id;
|
||||||
UINT32 angle;
|
UINT32 angle;
|
||||||
@@ -3172,7 +3172,7 @@ static inline void P_UnArchivePolyObj(savebuffer_t *save, polyobj_t *po)
|
|||||||
Polyobj_MoveOnLoad(po, angle, x, y);
|
Polyobj_MoveOnLoad(po, angle, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void P_ArchivePolyObjects(savebuffer_t *save)
|
FUNCINLINE static ATTRINLINE void P_ArchivePolyObjects(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
@@ -3185,7 +3185,7 @@ static inline void P_ArchivePolyObjects(savebuffer_t *save)
|
|||||||
P_ArchivePolyObj(save, &PolyObjects[i]);
|
P_ArchivePolyObj(save, &PolyObjects[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void P_UnArchivePolyObjects(savebuffer_t *save)
|
FUNCINLINE static ATTRINLINE void P_UnArchivePolyObjects(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
INT32 i, numSavedPolys;
|
INT32 i, numSavedPolys;
|
||||||
|
|
||||||
@@ -3203,7 +3203,7 @@ static inline void P_UnArchivePolyObjects(savebuffer_t *save)
|
|||||||
//
|
//
|
||||||
// P_FinishMobjs
|
// P_FinishMobjs
|
||||||
//
|
//
|
||||||
static inline void P_FinishMobjs(void)
|
FUNCINLINE static ATTRINLINE void P_FinishMobjs(void)
|
||||||
{
|
{
|
||||||
thinker_t *currentthinker;
|
thinker_t *currentthinker;
|
||||||
mobj_t *mobj;
|
mobj_t *mobj;
|
||||||
@@ -3220,7 +3220,7 @@ static inline void P_FinishMobjs(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline mobj_t *RelinkMobj(mobj_t **ptr)
|
FUNCINLINE static ATTRINLINE mobj_t *RelinkMobj(mobj_t **ptr)
|
||||||
{
|
{
|
||||||
UINT32 temp = (UINT32)(size_t)*ptr;
|
UINT32 temp = (UINT32)(size_t)*ptr;
|
||||||
*ptr = NULL;
|
*ptr = NULL;
|
||||||
@@ -3269,7 +3269,7 @@ static void P_RelinkPointers(void)
|
|||||||
//
|
//
|
||||||
// P_NetArchiveSpecials
|
// P_NetArchiveSpecials
|
||||||
//
|
//
|
||||||
static inline void P_NetArchiveSpecials(savebuffer_t *save)
|
FUNCINLINE static ATTRINLINE void P_NetArchiveSpecials(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
size_t i, z;
|
size_t i, z;
|
||||||
|
|
||||||
@@ -3347,7 +3347,7 @@ static void P_NetUnArchiveSpecials(savebuffer_t *save)
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
// Misc
|
// Misc
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
static inline void P_ArchiveMisc(savebuffer_t *save)
|
FUNCINLINE static ATTRINLINE void P_ArchiveMisc(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
if (gamecomplete)
|
if (gamecomplete)
|
||||||
WRITEINT16(save->p, gamemap | 8192);
|
WRITEINT16(save->p, gamemap | 8192);
|
||||||
@@ -3360,7 +3360,7 @@ static inline void P_ArchiveMisc(savebuffer_t *save)
|
|||||||
WRITESTRINGN(save->p, timeattackfolder, sizeof(timeattackfolder));
|
WRITESTRINGN(save->p, timeattackfolder, sizeof(timeattackfolder));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void P_UnArchiveSPGame(savebuffer_t *save, INT16 mapoverride)
|
FUNCINLINE static ATTRINLINE void P_UnArchiveSPGame(savebuffer_t *save, INT16 mapoverride)
|
||||||
{
|
{
|
||||||
char testname[sizeof(timeattackfolder)];
|
char testname[sizeof(timeattackfolder)];
|
||||||
|
|
||||||
|
|||||||
+113
-76
@@ -94,7 +94,7 @@ static UINT32 **texturecolumnofs; // column offset lookup table for each texture
|
|||||||
UINT8 **texturecache; // graphics data for each generated full-size 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
|
// texture width is a power of 2, so it can easily repeat along sidedefs using a simple mask
|
||||||
static INT32 *texturewidthmask;
|
static INT32 *texturewidth;
|
||||||
|
|
||||||
fixed_t *textureheight; // needed for texture pegging
|
fixed_t *textureheight; // needed for texture pegging
|
||||||
|
|
||||||
@@ -241,11 +241,12 @@ static INT32 tidcachelen = 0;
|
|||||||
// R_DrawColumnInCache
|
// R_DrawColumnInCache
|
||||||
// Clip and draw a column from a patch into a cached post.
|
// Clip and draw a column from a patch into a cached post.
|
||||||
//
|
//
|
||||||
static inline void R_DrawColumnInCache(column_t *patch, UINT8 *cache, INT32 originy, INT32 cacheheight)
|
static inline void R_DrawColumnInCache(column_t *patch, UINT8 *cache, texpatch_t *originPatch, INT32 cacheheight)
|
||||||
{
|
{
|
||||||
INT32 count, position;
|
INT32 count, position;
|
||||||
UINT8 *source;
|
UINT8 *source;
|
||||||
INT32 topdelta, prevdelta = -1;
|
INT32 topdelta, prevdelta = -1;
|
||||||
|
INT32 originy = originPatch->originy;
|
||||||
|
|
||||||
while (patch->topdelta != 0xff)
|
while (patch->topdelta != 0xff)
|
||||||
{
|
{
|
||||||
@@ -260,6 +261,7 @@ static inline void R_DrawColumnInCache(column_t *patch, UINT8 *cache, INT32 orig
|
|||||||
if (position < 0)
|
if (position < 0)
|
||||||
{
|
{
|
||||||
count += position;
|
count += position;
|
||||||
|
source -= position; // start further down the column
|
||||||
position = 0;
|
position = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,6 +275,50 @@ static inline void R_DrawColumnInCache(column_t *patch, UINT8 *cache, INT32 orig
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
// R_GenerateTexture
|
||||||
//
|
//
|
||||||
@@ -297,6 +343,10 @@ UINT8 *R_GenerateTexture(size_t texnum)
|
|||||||
column_t *patchcol;
|
column_t *patchcol;
|
||||||
UINT8 *colofs;
|
UINT8 *colofs;
|
||||||
|
|
||||||
|
UINT16 wadnum;
|
||||||
|
lumpnum_t lumpnum;
|
||||||
|
size_t lumplength;
|
||||||
|
|
||||||
I_Assert(texnum <= (size_t)numtextures);
|
I_Assert(texnum <= (size_t)numtextures);
|
||||||
texture = textures[texnum];
|
texture = textures[texnum];
|
||||||
I_Assert(texture != NULL);
|
I_Assert(texture != NULL);
|
||||||
@@ -311,45 +361,57 @@ UINT8 *R_GenerateTexture(size_t texnum)
|
|||||||
{
|
{
|
||||||
boolean holey = false;
|
boolean holey = false;
|
||||||
patch = texture->patches;
|
patch = texture->patches;
|
||||||
pdata = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_LEVEL);
|
|
||||||
|
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);
|
||||||
realpatch = (softwarepatch_t *)pdata;
|
realpatch = (softwarepatch_t *)pdata;
|
||||||
|
|
||||||
// Check the patch for holes.
|
// Check the patch for holes.
|
||||||
if (texture->width > SHORT(realpatch->width) || texture->height > SHORT(realpatch->height))
|
if (texture->width > SHORT(realpatch->width) || texture->height > SHORT(realpatch->height))
|
||||||
holey = true;
|
holey = true;
|
||||||
else
|
|
||||||
|
colofs = (UINT8 *)realpatch->columnofs;
|
||||||
|
|
||||||
|
for (x = 0; x < texture->width && !holey; x++)
|
||||||
{
|
{
|
||||||
colofs = (UINT8 *)realpatch->columnofs;
|
column_t *col = (column_t *)((UINT8 *)realpatch + LONG(*(UINT32 *)&colofs[x<<2]));
|
||||||
|
|
||||||
for (x = 0; x < texture->width; x++)
|
INT32 topdelta, prevdelta = -1, y = 0;
|
||||||
|
|
||||||
|
while (col->topdelta != 0xff)
|
||||||
{
|
{
|
||||||
column_t *col = (column_t *)((UINT8 *)realpatch + LONG(*(UINT32 *)&colofs[x<<2]));
|
topdelta = col->topdelta;
|
||||||
|
if (topdelta <= prevdelta)
|
||||||
INT32 topdelta, prevdelta = -1, y = 0;
|
topdelta += prevdelta;
|
||||||
|
prevdelta = topdelta;
|
||||||
while (col->topdelta != 0xff)
|
if (topdelta > y)
|
||||||
{
|
break;
|
||||||
topdelta = col->topdelta;
|
y = topdelta + col->length + 1;
|
||||||
if (topdelta <= prevdelta)
|
col = (column_t *)((UINT8 *)col + col->length + 4);
|
||||||
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 (y < texture->height)
|
||||||
|
holey = true; // this texture is HOLEy! D:
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the patch uses transparency, we have to save it this way.
|
// If the patch uses transparency, we have to save it this way.
|
||||||
if (holey)
|
if (holey)
|
||||||
{
|
{
|
||||||
texture->holes = true;
|
texture->holes = true;
|
||||||
blocksize = W_LumpLengthPwad(patch->wad, patch->lump);
|
blocksize = lumplength;
|
||||||
block = Z_Calloc(blocksize, PU_LEVEL, &texturecache[texnum]);
|
block = Z_Calloc(blocksize, PU_LEVEL, &texturecache[texnum]); // will change tag at end of this function
|
||||||
M_Memcpy(block, realpatch, blocksize);
|
M_Memcpy(block, realpatch, blocksize);
|
||||||
texturememory += blocksize;
|
texturememory += blocksize;
|
||||||
|
|
||||||
@@ -365,7 +427,6 @@ UINT8 *R_GenerateTexture(size_t texnum)
|
|||||||
|
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, do multipatch format.
|
// Otherwise, do multipatch format.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -384,10 +445,18 @@ UINT8 *R_GenerateTexture(size_t texnum)
|
|||||||
// texture data after the lookup table
|
// texture data after the lookup table
|
||||||
blocktex = block + (texture->width*4);
|
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.
|
// Composite the columns together.
|
||||||
for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++)
|
for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++)
|
||||||
{
|
{
|
||||||
pdata = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_LEVEL);
|
wadnum = patch->wad;
|
||||||
|
lumpnum = patch->lump;
|
||||||
|
pdata = (UINT8*)W_CacheLumpNumPwad(wadnum, lumpnum, PU_LEVEL);
|
||||||
realpatch = (softwarepatch_t *)pdata;
|
realpatch = (softwarepatch_t *)pdata;
|
||||||
|
|
||||||
x1 = patch->originx;
|
x1 = patch->originx;
|
||||||
@@ -418,9 +487,7 @@ UINT8 *R_GenerateTexture(size_t texnum)
|
|||||||
{
|
{
|
||||||
patchcol = (column_t *)((UINT8 *)realpatch + LONG(realpatch->columnofs[x-x1]));
|
patchcol = (column_t *)((UINT8 *)realpatch + LONG(realpatch->columnofs[x-x1]));
|
||||||
|
|
||||||
// generate column ofset lookup
|
R_DrawColumnInCache(patchcol, block + LONG(*(UINT32 *)&colofs[x<<2]), patch, texture->height);
|
||||||
*(UINT32 *)&colofs[x<<2] = LONG((x * texture->height) + (texture->width*4));
|
|
||||||
R_DrawColumnInCache(patchcol, block + LONG(*(UINT32 *)&colofs[x<<2]), patch->originy, texture->height);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,6 +506,7 @@ INT32 R_GetTextureNum(INT32 texnum)
|
|||||||
{
|
{
|
||||||
if (texnum < 0 || texnum >= numtextures)
|
if (texnum < 0 || texnum >= numtextures)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return texturetranslation[texnum];
|
return texturetranslation[texnum];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -456,17 +524,12 @@ void R_CheckTextureCache(INT32 tex)
|
|||||||
|
|
||||||
static inline INT32 wrap_column(fixed_t tex, INT32 col)
|
static inline INT32 wrap_column(fixed_t tex, INT32 col)
|
||||||
{
|
{
|
||||||
if (texturewidthmask[tex])
|
INT32 width = texturewidth[tex];
|
||||||
col &= texturewidthmask[tex]; // set by load textures
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const INT16 texwidth = textures[tex]->width;
|
|
||||||
|
|
||||||
// Odd width texture, cannot just mask.
|
if (width & (width - 1))
|
||||||
// Sometime gets colnum = -1 or = width, even without tiling.
|
col = (UINT32)col % width;
|
||||||
// Test LostCiv, Map 20, crates.
|
else
|
||||||
col = ((col % texwidth) + texwidth) % texwidth;
|
col &= (width - 1);
|
||||||
}
|
|
||||||
|
|
||||||
return col;
|
return col;
|
||||||
}
|
}
|
||||||
@@ -476,13 +539,6 @@ static inline INT32 wrap_column(fixed_t tex, INT32 col)
|
|||||||
//
|
//
|
||||||
UINT8 *R_GetColumn(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)]);
|
return texturecache[tex] + LONG(texturecolumnofs[tex][wrap_column(tex, col)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -516,11 +572,10 @@ static INT32
|
|||||||
Rloadtextures (INT32 i, INT32 w)
|
Rloadtextures (INT32 i, INT32 w)
|
||||||
{
|
{
|
||||||
UINT16 j, numlumps = 0;
|
UINT16 j, numlumps = 0;
|
||||||
INT32 k;
|
|
||||||
UINT16 texstart, texend, texturesLumpPos;
|
UINT16 texstart, texend, texturesLumpPos;
|
||||||
softwarepatch_t *patchlump;
|
|
||||||
texpatch_t *patch;
|
texpatch_t *patch;
|
||||||
texture_t *texture;
|
texture_t *texture;
|
||||||
|
softwarepatch_t patchlump;
|
||||||
|
|
||||||
// Get the lump numbers for the markers in the WAD, if they exist.
|
// Get the lump numbers for the markers in the WAD, if they exist.
|
||||||
if (W_FileHasFolders(wadfiles[w]))
|
if (W_FileHasFolders(wadfiles[w]))
|
||||||
@@ -560,7 +615,7 @@ Rloadtextures (INT32 i, INT32 w)
|
|||||||
continue; // If it is then SKIP IT
|
continue; // If it is then SKIP IT
|
||||||
}
|
}
|
||||||
|
|
||||||
patchlump = (softwarepatch_t *)W_CacheLumpNumPwad(wadnum, lumpnum, PU_STATIC);
|
W_ReadLumpHeaderPwad(wadnum, lumpnum, &patchlump, PNG_HEADER_SIZE, 0);
|
||||||
|
|
||||||
//CONS_Printf("\n\"%s\" is a single patch, dimensions %d x %d",W_CheckNameForNumPwad((wadnum, lumpnum), patchlump->width, patchlump->height);
|
//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);
|
texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL);
|
||||||
@@ -568,8 +623,10 @@ Rloadtextures (INT32 i, INT32 w)
|
|||||||
// Set texture properties.
|
// Set texture properties.
|
||||||
M_Memcpy(texture->name, W_CheckNameForNumPwad(wadnum, lumpnum), sizeof(texture->name));
|
M_Memcpy(texture->name, W_CheckNameForNumPwad(wadnum, lumpnum), sizeof(texture->name));
|
||||||
texture->hash = quickncasehash(texture->name, 8);
|
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->type = TEXTURETYPE_SINGLEPATCH;
|
||||||
texture->patchcount = 1;
|
texture->patchcount = 1;
|
||||||
texture->holes = false;
|
texture->holes = false;
|
||||||
@@ -581,27 +638,7 @@ Rloadtextures (INT32 i, INT32 w)
|
|||||||
patch->wad = wadnum;
|
patch->wad = wadnum;
|
||||||
patch->lump = texstart + j;
|
patch->lump = texstart + j;
|
||||||
|
|
||||||
Z_Free(patchlump);
|
texturewidth[i] = texture->width;
|
||||||
|
|
||||||
// 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;
|
textureheight[i] = texture->height << FRACBITS;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@@ -709,7 +746,7 @@ static void R_AllocateTextures(INT32 add)
|
|||||||
// Allocate texture referencing cache.
|
// Allocate texture referencing cache.
|
||||||
recallocuser(&texturecache, oldsize, newsize);
|
recallocuser(&texturecache, oldsize, newsize);
|
||||||
// Allocate texture width table.
|
// Allocate texture width table.
|
||||||
recallocuser(&texturewidthmask, oldsize, newsize);
|
recallocuser(&texturewidth, oldsize, newsize);
|
||||||
// Allocate texture height table.
|
// Allocate texture height table.
|
||||||
recallocuser(&textureheight, oldsize, newsize);
|
recallocuser(&textureheight, oldsize, newsize);
|
||||||
// Create translation table for global animation.
|
// Create translation table for global animation.
|
||||||
@@ -1181,7 +1218,7 @@ void R_ParseTEXTURESLump(UINT16 wadNum, UINT16 lumpNum, INT32 *texindex)
|
|||||||
newTexture = R_ParseTexture(true);
|
newTexture = R_ParseTexture(true);
|
||||||
// Store the new texture
|
// Store the new texture
|
||||||
textures[*texindex] = newTexture;
|
textures[*texindex] = newTexture;
|
||||||
texturewidthmask[*texindex] = newTexture->width - 1;
|
texturewidth[*texindex] = newTexture->width;
|
||||||
textureheight[*texindex] = newTexture->height << FRACBITS;
|
textureheight[*texindex] = newTexture->height << FRACBITS;
|
||||||
// Increment i back in R_LoadTextures()
|
// Increment i back in R_LoadTextures()
|
||||||
(*texindex)++;
|
(*texindex)++;
|
||||||
|
|||||||
+2
-2
@@ -615,12 +615,12 @@ typedef struct drawseg_s
|
|||||||
// Pointers to lists for sprite clipping, all three adjusted so [x1] is first value.
|
// Pointers to lists for sprite clipping, all three adjusted so [x1] is first value.
|
||||||
INT16 *sprtopclip;
|
INT16 *sprtopclip;
|
||||||
INT16 *sprbottomclip;
|
INT16 *sprbottomclip;
|
||||||
INT16 *maskedtexturecol;
|
fixed_t *maskedtexturecol;
|
||||||
|
|
||||||
struct visplane_s *ffloorplanes[MAXFFLOORS];
|
struct visplane_s *ffloorplanes[MAXFFLOORS];
|
||||||
INT32 numffloorplanes;
|
INT32 numffloorplanes;
|
||||||
struct ffloor_s *thicksides[MAXFFLOORS];
|
struct ffloor_s *thicksides[MAXFFLOORS];
|
||||||
INT16 *thicksidecol;
|
fixed_t *thicksidecol;
|
||||||
INT32 numthicksides;
|
INT32 numthicksides;
|
||||||
fixed_t *frontscale;
|
fixed_t *frontscale;
|
||||||
|
|
||||||
|
|||||||
+104
-144
@@ -41,8 +41,7 @@
|
|||||||
|
|
||||||
/** \brief view info
|
/** \brief view info
|
||||||
*/
|
*/
|
||||||
INT32 linesize, viewwidth, viewheight, viewwindowx, viewwindowy;
|
INT32 viewwidth, viewheight, viewwindowx, viewwindowy;
|
||||||
UINT8 *renderscreen; // haleyjd
|
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
// COLUMN DRAWING CODE STUFF
|
// COLUMN DRAWING CODE STUFF
|
||||||
@@ -489,6 +488,92 @@ void R_FlushTranslationColormapCache(void)
|
|||||||
// in reality, the few routines that can work for either mode, are
|
// in reality, the few routines that can work for either mode, are
|
||||||
// put here
|
// put here
|
||||||
|
|
||||||
|
enum columncontext_e columncontext = COLUMNCONTEXT_DIRECT;
|
||||||
|
|
||||||
|
enum ColumnFlushType
|
||||||
|
{
|
||||||
|
FLUSH_NONE = 0x0000,
|
||||||
|
FLUSH_OPAQUE = 0x0001,
|
||||||
|
FLUSH_TRANS = 0x0002,
|
||||||
|
FLUSH_COLORMAP = 0x0004,
|
||||||
|
FLUSH_COLORMAP_TRANS = 0x0008,
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct drawcolumndata_temp_s
|
||||||
|
{
|
||||||
|
INT32 x;
|
||||||
|
INT32 yl[8], yh[8];
|
||||||
|
|
||||||
|
// e6y: resolution limitation is removed
|
||||||
|
UINT8 *buf;
|
||||||
|
|
||||||
|
INT32 startx;
|
||||||
|
ColumnFlushType type;
|
||||||
|
INT32 commontop, commonbot;
|
||||||
|
UINT8 *transmap;
|
||||||
|
// SoM 7-28-04: Fix the fuzz problem.
|
||||||
|
UINT8 *translation;
|
||||||
|
} drawcolumndata_temp_t;
|
||||||
|
|
||||||
|
drawcolumndata_temp_t temp_dc = {};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Error functions that will abort if R_FlushColumns tries to flush
|
||||||
|
// columns without a column type.
|
||||||
|
//
|
||||||
|
FUNCNORETURN static ATTRNORETURN void R_FlushWholeError(void)
|
||||||
|
{
|
||||||
|
I_Error("R_FlushWholeColumns called without being initialized.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
FUNCNORETURN static ATTRNORETURN void R_FlushHTError(void)
|
||||||
|
{
|
||||||
|
I_Error("R_FlushHTColumns called without being initialized.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
FUNCNORETURN static ATTRNORETURN void R_QuadFlushError(void)
|
||||||
|
{
|
||||||
|
I_Error("R_FlushQuadColumn called without being initialized.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void (*R_FlushWholeColumns)(void) = R_FlushWholeError;
|
||||||
|
static void (*R_FlushHTColumns)(void) = R_FlushHTError;
|
||||||
|
static void (*R_FlushQuadColumn)(void) = R_QuadFlushError;
|
||||||
|
|
||||||
|
static void R_FlushColumns(void)
|
||||||
|
{
|
||||||
|
if (temp_dc.x != 8 || temp_dc.commontop >= temp_dc.commonbot)
|
||||||
|
R_FlushWholeColumns();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
R_FlushHTColumns();
|
||||||
|
R_FlushQuadColumn();
|
||||||
|
}
|
||||||
|
|
||||||
|
temp_dc.x = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// R_ResetColumnBuffer
|
||||||
|
//
|
||||||
|
// haleyjd 09/13/04: new function to call from main rendering loop
|
||||||
|
// which gets rid of the unnecessary reset of various variables during
|
||||||
|
// column drawing.
|
||||||
|
//
|
||||||
|
void R_ResetColumnBuffer(void)
|
||||||
|
{
|
||||||
|
// haleyjd 10/06/05: this must not be done if x == 0!
|
||||||
|
if (temp_dc.x)
|
||||||
|
{
|
||||||
|
R_FlushColumns();
|
||||||
|
}
|
||||||
|
|
||||||
|
temp_dc.type = FLUSH_NONE;
|
||||||
|
R_FlushWholeColumns = R_FlushWholeError;
|
||||||
|
R_FlushHTColumns = R_FlushHTError;
|
||||||
|
R_FlushQuadColumn = R_QuadFlushError;
|
||||||
|
}
|
||||||
|
|
||||||
/** \brief The R_InitViewBuffer function
|
/** \brief The R_InitViewBuffer function
|
||||||
|
|
||||||
Creates lookup tables for getting the framebuffer address
|
Creates lookup tables for getting the framebuffer address
|
||||||
@@ -521,7 +606,6 @@ static void R_AllocViewMemory(void)
|
|||||||
R_AllocVisSpriteMemory();
|
R_AllocVisSpriteMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void R_InitViewBuffer(INT32 width, INT32 height)
|
void R_InitViewBuffer(INT32 width, INT32 height)
|
||||||
{
|
{
|
||||||
if (width > MAXVIDWIDTH)
|
if (width > MAXVIDWIDTH)
|
||||||
@@ -534,27 +618,26 @@ void R_InitViewBuffer(INT32 width, INT32 height)
|
|||||||
viewwindowx = 0;
|
viewwindowx = 0;
|
||||||
viewwindowy = 0;
|
viewwindowy = 0;
|
||||||
|
|
||||||
linesize = vid.width; // killough 11/98
|
INT32 bufsize = (vid.width * 8) * sizeof(*temp_dc.buf);
|
||||||
renderscreen = vid.screens[0]; // haleyjd 07/02/14
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \brief viewborder patches lump numbers
|
if (temp_dc.buf)
|
||||||
*/
|
{
|
||||||
lumpnum_t viewborderlump[8];
|
#if defined(__SSE__)
|
||||||
|
aligned_free(temp_dc.buf);
|
||||||
|
#else
|
||||||
|
Z_Free(temp_dc.buf);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/** \brief Store the lumpnumber of the viewborder patches
|
memset(&temp_dc, 0, sizeof(temp_dc));
|
||||||
*/
|
|
||||||
|
|
||||||
void R_InitViewBorder(void)
|
#if defined(__SSE__)
|
||||||
{
|
while (bufsize & 15)
|
||||||
viewborderlump[BRDR_T] = W_GetNumForName("brdr_t");
|
bufsize++;
|
||||||
viewborderlump[BRDR_B] = W_GetNumForName("brdr_b");
|
temp_dc.buf = static_cast<UINT8*>(aligned_alloc(16, bufsize));
|
||||||
viewborderlump[BRDR_L] = W_GetNumForName("brdr_l");
|
#else
|
||||||
viewborderlump[BRDR_R] = W_GetNumForName("brdr_r");
|
temp_dc.buf = static_cast<UINT8*>(Z_Calloc(bufsize, PU_STATIC, NULL));
|
||||||
viewborderlump[BRDR_TL] = W_GetNumForName("brdr_tl");
|
#endif
|
||||||
viewborderlump[BRDR_BL] = W_GetNumForName("brdr_bl");
|
|
||||||
viewborderlump[BRDR_TR] = W_GetNumForName("brdr_tr");
|
|
||||||
viewborderlump[BRDR_BR] = W_GetNumForName("brdr_br");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief The R_VideoErase function
|
/** \brief The R_VideoErase function
|
||||||
@@ -578,129 +661,6 @@ void R_VideoErase(size_t ofs, INT32 count)
|
|||||||
M_Memcpy(vid.screens[0] + ofs, vid.screens[1] + ofs, count);
|
M_Memcpy(vid.screens[0] + ofs, vid.screens[1] + ofs, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/** \brief R_FillBackScreen
|
|
||||||
|
|
||||||
Fills the back screen with a pattern for variable screen sizes
|
|
||||||
Also draws a beveled edge.
|
|
||||||
*/
|
|
||||||
void R_FillBackScreen(void)
|
|
||||||
{
|
|
||||||
UINT8 *src, *dest;
|
|
||||||
patch_t *patch;
|
|
||||||
INT32 x, y, step, boff;
|
|
||||||
|
|
||||||
// quickfix, don't cache lumps in both modes
|
|
||||||
if (rendermode != render_soft)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// draw pattern around the status bar too (when hires),
|
|
||||||
// so return only when in full-screen without status bar.
|
|
||||||
if (scaledviewwidth == vid.width && viewheight == vid.height)
|
|
||||||
return;
|
|
||||||
|
|
||||||
src = scr_borderpatch;
|
|
||||||
dest = vid.screens[1];
|
|
||||||
|
|
||||||
for (y = 0; y < vid.height; y++)
|
|
||||||
{
|
|
||||||
for (x = 0; x < vid.width/128; x++)
|
|
||||||
{
|
|
||||||
M_Memcpy (dest, src+((y&127)<<7), 128);
|
|
||||||
dest += 128;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vid.width&127)
|
|
||||||
{
|
|
||||||
M_Memcpy(dest, src+((y&127)<<7), vid.width&127);
|
|
||||||
dest += (vid.width&127);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// don't draw the borders when viewwidth is full vid.width.
|
|
||||||
if (scaledviewwidth == vid.width)
|
|
||||||
return;
|
|
||||||
|
|
||||||
step = 8;
|
|
||||||
boff = 8;
|
|
||||||
|
|
||||||
patch = W_CacheLumpNum(viewborderlump[BRDR_T], PU_CACHE);
|
|
||||||
for (x = 0; x < scaledviewwidth; x += step)
|
|
||||||
V_DrawPatch(viewwindowx + x, viewwindowy - boff, 1, patch);
|
|
||||||
|
|
||||||
patch = W_CacheLumpNum(viewborderlump[BRDR_B], PU_CACHE);
|
|
||||||
for (x = 0; x < scaledviewwidth; x += step)
|
|
||||||
V_DrawPatch(viewwindowx + x, viewwindowy + viewheight, 1, patch);
|
|
||||||
|
|
||||||
patch = W_CacheLumpNum(viewborderlump[BRDR_L], PU_CACHE);
|
|
||||||
for (y = 0; y < viewheight; y += step)
|
|
||||||
V_DrawPatch(viewwindowx - boff, viewwindowy + y, 1, patch);
|
|
||||||
|
|
||||||
patch = W_CacheLumpNum(viewborderlump[BRDR_R],PU_CACHE);
|
|
||||||
for (y = 0; y < viewheight; y += step)
|
|
||||||
V_DrawPatch(viewwindowx + scaledviewwidth, viewwindowy + y, 1,
|
|
||||||
patch);
|
|
||||||
|
|
||||||
// Draw beveled corners.
|
|
||||||
V_DrawPatch(viewwindowx - boff, viewwindowy - boff, 1,
|
|
||||||
W_CacheLumpNum(viewborderlump[BRDR_TL], PU_CACHE));
|
|
||||||
V_DrawPatch(viewwindowx + scaledviewwidth, viewwindowy - boff, 1,
|
|
||||||
W_CacheLumpNum(viewborderlump[BRDR_TR], PU_CACHE));
|
|
||||||
V_DrawPatch(viewwindowx - boff, viewwindowy + viewheight, 1,
|
|
||||||
W_CacheLumpNum(viewborderlump[BRDR_BL], PU_CACHE));
|
|
||||||
V_DrawPatch(viewwindowx + scaledviewwidth, viewwindowy + viewheight, 1,
|
|
||||||
W_CacheLumpNum(viewborderlump[BRDR_BR], PU_CACHE));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \brief The R_DrawViewBorder
|
|
||||||
|
|
||||||
Draws the border around the view
|
|
||||||
for different size windows?
|
|
||||||
*/
|
|
||||||
void R_DrawViewBorder(void)
|
|
||||||
{
|
|
||||||
INT32 top, side, ofs;
|
|
||||||
|
|
||||||
if (rendermode == render_none)
|
|
||||||
return;
|
|
||||||
#ifdef HWRENDER
|
|
||||||
if (rendermode != render_soft)
|
|
||||||
{
|
|
||||||
HWR_DrawViewBorder(0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
fprintf(stderr,"RDVB: vidwidth %d vidheight %d scaledviewwidth %d viewheight %d\n",
|
|
||||||
vid.width, vid.height, scaledviewwidth, viewheight);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (scaledviewwidth == vid.width)
|
|
||||||
return;
|
|
||||||
|
|
||||||
top = (vid.height - viewheight)>>1;
|
|
||||||
side = (vid.width - scaledviewwidth)>>1;
|
|
||||||
|
|
||||||
// copy top and one line of left side
|
|
||||||
R_VideoErase(0, top*vid.width+side);
|
|
||||||
|
|
||||||
// copy one line of right side and bottom
|
|
||||||
ofs = (viewheight+top)*vid.width - side;
|
|
||||||
R_VideoErase(ofs, top*vid.width + side);
|
|
||||||
|
|
||||||
// copy sides using wraparound
|
|
||||||
ofs = top*vid.width + vid.width-side;
|
|
||||||
side <<= 1;
|
|
||||||
|
|
||||||
// simpler using our VID_Blit routine
|
|
||||||
VID_BlitLinearScreen(vid.screens[1] + ofs, vid.screens[0] + ofs, side, viewheight - 1,
|
|
||||||
vid.width, vid.width);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// INCLUDE DRAWING CODE HERE
|
// INCLUDE DRAWING CODE HERE
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|||||||
+22
-32
@@ -25,12 +25,10 @@ extern "C" {
|
|||||||
// -------------------------------
|
// -------------------------------
|
||||||
// COMMON STUFF FOR 8bpp AND 16bpp
|
// COMMON STUFF FOR 8bpp AND 16bpp
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
extern UINT8 *renderscreen;
|
|
||||||
extern INT32 linesize;
|
|
||||||
|
|
||||||
FUNCINLINE static ATTRINLINE UINT8 *R_Address(INT32 px, INT32 py)
|
FUNCINLINE static ATTRINLINE UINT8 *R_Address(INT32 px, INT32 py)
|
||||||
{
|
{
|
||||||
return renderscreen + (py + viewwindowy) * linesize + (viewwindowx + px);
|
return vid.screens[0] + (py + viewwindowy) * vid.width + (viewwindowx + px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -102,6 +100,16 @@ extern floatv3_t *ds_su, *ds_sv, *ds_sz;
|
|||||||
|
|
||||||
extern float focallengthf;
|
extern float focallengthf;
|
||||||
|
|
||||||
|
enum columncontext_e
|
||||||
|
{
|
||||||
|
COLUMNCONTEXT_DIRECT = 0,
|
||||||
|
COLUMNCONTEXT_FLUSH,
|
||||||
|
};
|
||||||
|
|
||||||
|
extern enum columncontext_e columncontext;
|
||||||
|
void R_SetColumnContext(enum columncontext_e _columncontext);
|
||||||
|
|
||||||
|
void R_ResetColumnBuffer(void);
|
||||||
|
|
||||||
typedef void (coldrawfunc_t)(drawcolumndata_t*);
|
typedef void (coldrawfunc_t)(drawcolumndata_t*);
|
||||||
typedef void (spandrawfunc_t)(drawspandata_t*);
|
typedef void (spandrawfunc_t)(drawspandata_t*);
|
||||||
@@ -152,27 +160,8 @@ extern spandrawfunc_t *spanfuncs[SPANDRAWFUNC_MAX];
|
|||||||
|
|
||||||
void R_DrawMaskedColumn(drawcolumndata_t* dc, column_t *column);
|
void R_DrawMaskedColumn(drawcolumndata_t* dc, column_t *column);
|
||||||
|
|
||||||
/// \brief Top border
|
|
||||||
#define BRDR_T 0
|
|
||||||
/// \brief Bottom border
|
|
||||||
#define BRDR_B 1
|
|
||||||
/// \brief Left border
|
|
||||||
#define BRDR_L 2
|
|
||||||
/// \brief Right border
|
|
||||||
#define BRDR_R 3
|
|
||||||
/// \brief Topleft border
|
|
||||||
#define BRDR_TL 4
|
|
||||||
/// \brief Topright border
|
|
||||||
#define BRDR_TR 5
|
|
||||||
/// \brief Bottomleft border
|
|
||||||
#define BRDR_BL 6
|
|
||||||
/// \brief Bottomright border
|
|
||||||
#define BRDR_BR 7
|
|
||||||
|
|
||||||
extern lumpnum_t viewborderlump[8];
|
|
||||||
|
|
||||||
// ------------------------------------------------
|
// ------------------------------------------------
|
||||||
// r_draw.c COMMON ROUTINES FOR BOTH 8bpp and 16bpp
|
// r_draw.c
|
||||||
// ------------------------------------------------
|
// ------------------------------------------------
|
||||||
|
|
||||||
#define GTC_CACHE 1
|
#define GTC_CACHE 1
|
||||||
@@ -221,17 +210,8 @@ boolean R_BlendLevelVisible(INT32 blendmode, INT32 alphalevel);
|
|||||||
|
|
||||||
// Custom player skin translation
|
// Custom player skin translation
|
||||||
void R_InitViewBuffer(INT32 width, INT32 height);
|
void R_InitViewBuffer(INT32 width, INT32 height);
|
||||||
void R_InitViewBorder(void);
|
|
||||||
void R_VideoErase(size_t ofs, INT32 count);
|
void R_VideoErase(size_t ofs, INT32 count);
|
||||||
|
|
||||||
// Rendering function.
|
|
||||||
#if 0
|
|
||||||
void R_FillBackScreen(void);
|
|
||||||
|
|
||||||
// If the view size is not full screen, draws a border around it.
|
|
||||||
void R_DrawViewBorder(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TRANSPARENTPIXEL 247
|
#define TRANSPARENTPIXEL 247
|
||||||
|
|
||||||
// -----------------
|
// -----------------
|
||||||
@@ -250,8 +230,18 @@ void R_DrawTranslatedTranslucentColumn(drawcolumndata_t* dc);
|
|||||||
void R_Draw2sMultiPatchColumn(drawcolumndata_t* dc);
|
void R_Draw2sMultiPatchColumn(drawcolumndata_t* dc);
|
||||||
void R_Draw2sMultiPatchTranslucentColumn(drawcolumndata_t* dc);
|
void R_Draw2sMultiPatchTranslucentColumn(drawcolumndata_t* dc);
|
||||||
|
|
||||||
|
// column drawers which use buffered drawing with flush
|
||||||
|
void R_DrawColumnFlush(drawcolumndata_t* dc);
|
||||||
|
void R_DrawTranslucentColumnFlush(drawcolumndata_t* dc);
|
||||||
|
void R_DrawTranslatedColumnFlush(drawcolumndata_t* dc);
|
||||||
|
void R_DrawColumnShadowedFlush(drawcolumndata_t* dc);
|
||||||
|
void R_DrawTranslatedTranslucentColumnFlush(drawcolumndata_t* dc);
|
||||||
|
void R_Draw2sMultiPatchColumnFlush(drawcolumndata_t* dc);
|
||||||
|
void R_Draw2sMultiPatchTranslucentColumnFlush(drawcolumndata_t* dc);
|
||||||
|
|
||||||
void R_DrawFogColumn(drawcolumndata_t* dc);
|
void R_DrawFogColumn(drawcolumndata_t* dc);
|
||||||
|
|
||||||
|
|
||||||
// span drawers
|
// span drawers
|
||||||
void R_DrawSpan(drawspandata_t* ds);
|
void R_DrawSpan(drawspandata_t* ds);
|
||||||
|
|
||||||
|
|||||||
+76
-18
@@ -21,6 +21,8 @@
|
|||||||
// a has a constant z depth from top to bottom.
|
// a has a constant z depth from top to bottom.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include "r_draw_flush.cpp"
|
||||||
|
|
||||||
enum DrawColumnType
|
enum DrawColumnType
|
||||||
{
|
{
|
||||||
DC_BASIC = 0x0000,
|
DC_BASIC = 0x0000,
|
||||||
@@ -28,10 +30,12 @@ enum DrawColumnType
|
|||||||
DC_TRANSMAP = 0x0002,
|
DC_TRANSMAP = 0x0002,
|
||||||
DC_HOLES = 0x0004,
|
DC_HOLES = 0x0004,
|
||||||
DC_LIGHTLIST = 0x0008,
|
DC_LIGHTLIST = 0x0008,
|
||||||
|
DC_DIRECT = 0x0010, // draw our columns directly to screen!
|
||||||
};
|
};
|
||||||
|
|
||||||
template<DrawColumnType Type>
|
template<DrawColumnType Type>
|
||||||
static constexpr UINT8 R_GetColumnTranslated(drawcolumndata_t* dc, UINT8 col, const UINT8 * restrict colormap)
|
FUNCINLINE static ATTRINLINE constexpr UINT8
|
||||||
|
R_GetColumnTranslated(const drawcolumndata_t* dc, UINT8 col, const UINT8 * restrict colormap)
|
||||||
{
|
{
|
||||||
if constexpr (Type & DrawColumnType::DC_COLORMAP)
|
if constexpr (Type & DrawColumnType::DC_COLORMAP)
|
||||||
{
|
{
|
||||||
@@ -41,8 +45,10 @@ static constexpr UINT8 R_GetColumnTranslated(drawcolumndata_t* dc, UINT8 col, co
|
|||||||
return colormap[col];
|
return colormap[col];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// translucency is handled on flush side now!
|
||||||
template<DrawColumnType Type>
|
template<DrawColumnType Type>
|
||||||
static constexpr UINT8 R_GetColumnTranslucent(drawcolumndata_t* dc, UINT8 * restrict dest, UINT8 col, const UINT8 * restrict colormap)
|
FUNCINLINE static ATTRINLINE constexpr UINT8
|
||||||
|
R_GetColumnTranslucent(const drawcolumndata_t* dc, UINT8 * restrict dest, UINT8 col, const UINT8 * restrict colormap)
|
||||||
{
|
{
|
||||||
col = R_GetColumnTranslated<Type>(dc, col, colormap);
|
col = R_GetColumnTranslated<Type>(dc, col, colormap);
|
||||||
|
|
||||||
@@ -57,7 +63,8 @@ static constexpr UINT8 R_GetColumnTranslucent(drawcolumndata_t* dc, UINT8 * rest
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<DrawColumnType Type>
|
template<DrawColumnType Type>
|
||||||
static constexpr UINT8 R_DrawColumnPixel(drawcolumndata_t* dc, UINT8 * restrict dest, UINT32 bit, const UINT8 * restrict source, const UINT8 * restrict colormap)
|
FUNCINLINE static ATTRINLINE constexpr UINT8
|
||||||
|
R_DrawColumnPixel(const drawcolumndata_t* dc, UINT8 * restrict dest, UINT32 bit, const UINT8 * restrict source, const UINT8 * restrict colormap)
|
||||||
{
|
{
|
||||||
UINT8 col = source[bit];
|
UINT8 col = source[bit];
|
||||||
|
|
||||||
@@ -69,7 +76,14 @@ static constexpr UINT8 R_DrawColumnPixel(drawcolumndata_t* dc, UINT8 * restrict
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return R_GetColumnTranslucent<Type>(dc, dest, col, colormap);
|
if constexpr (Type & DrawColumnType::DC_DIRECT)
|
||||||
|
{ // if we dont buffer our columns, we need to handle translucency again
|
||||||
|
return R_GetColumnTranslucent<Type>(dc, dest, col, colormap);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return R_GetColumnTranslated<Type>(dc, col, colormap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief The R_DrawColumn function
|
/** \brief The R_DrawColumn function
|
||||||
@@ -80,8 +94,18 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
|||||||
{
|
{
|
||||||
INT32 count;
|
INT32 count;
|
||||||
|
|
||||||
|
// leban 1/17/99:
|
||||||
|
// removed the + 1 here, adjusted the if test, and added an increment
|
||||||
|
// later. this helps a compiler pipeline a bit better. the x86
|
||||||
|
// assembler also does this.
|
||||||
count = dc->yh - dc->yl;
|
count = dc->yh - dc->yl;
|
||||||
|
|
||||||
|
// leban 1/17/99:
|
||||||
|
// this case isn't executed too often. depending on how many instructions
|
||||||
|
// there are between here and the second if test below, this case could
|
||||||
|
// be moved down and might save instructions overall. since there are
|
||||||
|
// probably different wads that favor one way or the other, i'll leave
|
||||||
|
// this alone for now.
|
||||||
if (count < 0) // Zero length, column does not exceed a pixel.
|
if (count < 0) // Zero length, column does not exceed a pixel.
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -150,6 +174,7 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
R_DrawColumnTemplate<NewType>(&dc_copy);
|
R_DrawColumnTemplate<NewType>(&dc_copy);
|
||||||
|
|
||||||
if (solid)
|
if (solid)
|
||||||
{
|
{
|
||||||
dc_copy.yl = bheight;
|
dc_copy.yl = bheight;
|
||||||
@@ -183,19 +208,37 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
|||||||
// killough 2/1/98: more performance tuning
|
// killough 2/1/98: more performance tuning
|
||||||
|
|
||||||
intptr_t frac;
|
intptr_t frac;
|
||||||
|
// Looks familiar.
|
||||||
const intptr_t fracstep = dc->iscale;
|
const intptr_t fracstep = dc->iscale;
|
||||||
const intptr_t heightmask = dc->sourcelength-1;
|
const intptr_t heightmask = dc->sourcelength-1; // CPhipps - specify type
|
||||||
constexpr INT32 npow2min = -1;
|
constexpr INT32 npow2min = -1;
|
||||||
const INT32 npow2max = dc->sourcelength;
|
const INT32 npow2max = dc->sourcelength;
|
||||||
const INT32 stride = vid.width;
|
|
||||||
|
|
||||||
const UINT8 * restrict source = dc->source;
|
const UINT8 * restrict source = dc->source;
|
||||||
const lighttable_t * restrict colormap = dc->colormap;
|
const lighttable_t * restrict colormap = dc->colormap;
|
||||||
|
|
||||||
// Framebuffer destination address.
|
// Framebuffer destination address.
|
||||||
UINT8 * restrict dest = R_Address(dc->x, dc->yl);
|
// SoM: MAGIC
|
||||||
|
UINT8 * restrict dest;
|
||||||
|
|
||||||
count++;
|
if constexpr (Type & DrawColumnType::DC_DIRECT)
|
||||||
|
dest = R_Address(dc->x, dc->yl);
|
||||||
|
else if constexpr ((Type & (DrawColumnType::DC_COLORMAP | DrawColumnType::DC_TRANSMAP))
|
||||||
|
== (DrawColumnType::DC_COLORMAP | DrawColumnType::DC_TRANSMAP))
|
||||||
|
dest = R_GetBufferColormapTrans(dc);
|
||||||
|
else if constexpr (Type & DrawColumnType::DC_TRANSMAP)
|
||||||
|
dest = R_GetBufferTrans(dc);
|
||||||
|
else if constexpr (Type & DrawColumnType::DC_COLORMAP)
|
||||||
|
dest = R_GetBufferColormap(dc);
|
||||||
|
else
|
||||||
|
dest = R_GetBufferOpaque(dc);
|
||||||
|
|
||||||
|
INT32 stride = 8; //SoM: Oh, Oh it's MAGIC! You know...
|
||||||
|
|
||||||
|
if constexpr (Type & DrawColumnType::DC_DIRECT)
|
||||||
|
stride = vid.width;
|
||||||
|
|
||||||
|
count++; // killough 1/99: minor tuning
|
||||||
|
|
||||||
// Determine scaling, which is the only mapping to be done.
|
// Determine scaling, which is the only mapping to be done.
|
||||||
frac = (dc->texturemid + FixedMul((dc->yl << FRACBITS) - centeryfrac, fracstep));
|
frac = (dc->texturemid + FixedMul((dc->yl << FRACBITS) - centeryfrac, fracstep));
|
||||||
@@ -205,15 +248,16 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
|||||||
case 255:
|
case 255:
|
||||||
case 127:
|
case 127:
|
||||||
{
|
{
|
||||||
while(count--)
|
while (count--)
|
||||||
{
|
{
|
||||||
*dest = R_DrawColumnPixel<Type>(dc, dest, (frac>>FRACBITS) & heightmask, source, colormap);
|
*dest = R_DrawColumnPixel<Type>(dc, dest, (frac>>FRACBITS) & heightmask, source, colormap);
|
||||||
|
|
||||||
dest += stride;
|
dest += stride;
|
||||||
frac += fracstep;
|
frac += fracstep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case -1:
|
case npow2min:
|
||||||
{
|
{
|
||||||
if (frac < 0)
|
if (frac < 0)
|
||||||
// adjust in case we underread
|
// adjust in case we underread
|
||||||
@@ -223,6 +267,7 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
|||||||
while (--count >= 0)
|
while (--count >= 0)
|
||||||
{
|
{
|
||||||
*dest = R_DrawColumnPixel<Type>(dc, dest, frac>>FRACBITS, source, colormap);
|
*dest = R_DrawColumnPixel<Type>(dc, dest, frac>>FRACBITS, source, colormap);
|
||||||
|
|
||||||
dest += stride;
|
dest += stride;
|
||||||
frac += fracstep;
|
frac += fracstep;
|
||||||
}
|
}
|
||||||
@@ -235,10 +280,12 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
|||||||
while ((count -= 2) >= 0) // texture height is a power of 2 -- killough
|
while ((count -= 2) >= 0) // texture height is a power of 2 -- killough
|
||||||
{
|
{
|
||||||
*dest = R_DrawColumnPixel<Type>(dc, dest, (frac>>FRACBITS) & heightmask, source, colormap);
|
*dest = R_DrawColumnPixel<Type>(dc, dest, (frac>>FRACBITS) & heightmask, source, colormap);
|
||||||
|
|
||||||
dest += stride;
|
dest += stride;
|
||||||
frac += fracstep;
|
frac += fracstep;
|
||||||
|
|
||||||
*dest = R_DrawColumnPixel<Type>(dc, dest, (frac>>FRACBITS) & heightmask, source, colormap);
|
*dest = R_DrawColumnPixel<Type>(dc, dest, (frac>>FRACBITS) & heightmask, source, colormap);
|
||||||
|
|
||||||
dest += stride;
|
dest += stride;
|
||||||
frac += fracstep;
|
frac += fracstep;
|
||||||
}
|
}
|
||||||
@@ -271,7 +318,7 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
|||||||
{
|
{
|
||||||
// Re-map color indices from wall texture column
|
// Re-map color indices from wall texture column
|
||||||
// using a lighting/special effects LUT.
|
// using a lighting/special effects LUT.
|
||||||
// heightmask is the Tutti-Frutti fix
|
// heightmask is the Tutti-Frutti fix -- killough
|
||||||
|
|
||||||
// -1 is the lower clamp bound because column posts have a "safe" byte before the real data
|
// -1 is the lower clamp bound because column posts have a "safe" byte before the real data
|
||||||
// and a few bytes after as well
|
// and a few bytes after as well
|
||||||
@@ -311,13 +358,24 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
|||||||
R_DrawColumnTemplate<opt>(dc); \
|
R_DrawColumnTemplate<opt>(dc); \
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_COLUMN_FUNC(R_DrawColumn, DC_BASIC)
|
DEFINE_COLUMN_FUNC(R_DrawColumn, DC_DIRECT|DC_BASIC)
|
||||||
DEFINE_COLUMN_FUNC(R_DrawTranslucentColumn, DC_TRANSMAP)
|
DEFINE_COLUMN_FUNC(R_DrawTranslucentColumn, DC_DIRECT|DC_TRANSMAP)
|
||||||
DEFINE_COLUMN_FUNC(R_DrawTranslatedColumn, DC_COLORMAP)
|
DEFINE_COLUMN_FUNC(R_DrawTranslatedColumn, DC_DIRECT|DC_COLORMAP)
|
||||||
DEFINE_COLUMN_FUNC(R_DrawColumnShadowed, DC_LIGHTLIST)
|
DEFINE_COLUMN_FUNC(R_DrawColumnShadowed, DC_DIRECT|DC_LIGHTLIST)
|
||||||
DEFINE_COLUMN_FUNC(R_DrawTranslatedTranslucentColumn, DC_COLORMAP|DC_TRANSMAP)
|
DEFINE_COLUMN_FUNC(R_DrawTranslatedTranslucentColumn, DC_DIRECT|DC_COLORMAP|DC_TRANSMAP)
|
||||||
DEFINE_COLUMN_FUNC(R_Draw2sMultiPatchColumn, DC_HOLES)
|
DEFINE_COLUMN_FUNC(R_Draw2sMultiPatchColumn, DC_DIRECT|DC_HOLES)
|
||||||
DEFINE_COLUMN_FUNC(R_Draw2sMultiPatchTranslucentColumn, DC_HOLES|DC_TRANSMAP)
|
DEFINE_COLUMN_FUNC(R_Draw2sMultiPatchTranslucentColumn, DC_DIRECT|DC_HOLES|DC_TRANSMAP)
|
||||||
|
|
||||||
|
DEFINE_COLUMN_FUNC(R_DrawColumnFlush, DC_BASIC)
|
||||||
|
DEFINE_COLUMN_FUNC(R_DrawTranslucentColumnFlush, DC_TRANSMAP)
|
||||||
|
DEFINE_COLUMN_FUNC(R_DrawTranslatedColumnFlush, DC_COLORMAP)
|
||||||
|
DEFINE_COLUMN_FUNC(R_DrawColumnShadowedFlush, DC_LIGHTLIST)
|
||||||
|
DEFINE_COLUMN_FUNC(R_DrawTranslatedTranslucentColumnFlush, DC_COLORMAP|DC_TRANSMAP)
|
||||||
|
DEFINE_COLUMN_FUNC(R_Draw2sMultiPatchColumnFlush, DC_HOLES)
|
||||||
|
DEFINE_COLUMN_FUNC(R_Draw2sMultiPatchTranslucentColumnFlush, DC_HOLES|DC_TRANSMAP)
|
||||||
|
|
||||||
|
//skymyass
|
||||||
|
//DEFINE_COLUMN_FUNC(R_DrawSkyColumn, DC_SKY)
|
||||||
|
|
||||||
/** \brief The R_DrawFogColumn function
|
/** \brief The R_DrawFogColumn function
|
||||||
Fog wall.
|
Fog wall.
|
||||||
|
|||||||
@@ -0,0 +1,247 @@
|
|||||||
|
// SONIC ROBO BLAST 2 KART
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (C) 2025 by Kart Krew.
|
||||||
|
// Copyright (C) 2020 by Sonic Team Junior.
|
||||||
|
// Copyright (C) 2000 by DooM Legacy Team.
|
||||||
|
// Copyright (C) 1996 by id Software, Inc.
|
||||||
|
// Copyright (C) 1999 by Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||||
|
// Copyright (C) 1999-2000 by Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||||
|
// Copyright (C) Copyright 2005, 2006 by Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||||
|
// Copyright (C) 2013 by James Haley, Stephen McGranahan, et al.
|
||||||
|
//
|
||||||
|
// 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 r_draw_flush.cpp
|
||||||
|
/// \brief Optimized quad column buffer code. By SoM.
|
||||||
|
/// \note no includes because this is included as part of r_draw.cpp
|
||||||
|
|
||||||
|
template<ColumnFlushType Type>
|
||||||
|
FUNCINLINE static ATTRINLINE constexpr UINT8
|
||||||
|
R_GetFlushPixelTranslated(const drawcolumndata_temp_t *t_dc, UINT8 col)
|
||||||
|
{
|
||||||
|
if constexpr (Type & (ColumnFlushType::FLUSH_COLORMAP | ColumnFlushType::FLUSH_COLORMAP_TRANS))
|
||||||
|
{
|
||||||
|
col = t_dc->translation[col];
|
||||||
|
}
|
||||||
|
|
||||||
|
return col;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<ColumnFlushType Type>
|
||||||
|
FUNCINLINE static ATTRINLINE constexpr UINT8
|
||||||
|
R_GetFlushPixelTranslucent(const drawcolumndata_temp_t *t_dc, UINT8 * restrict dest, UINT8 col)
|
||||||
|
{
|
||||||
|
col = R_GetFlushPixelTranslated<Type>(t_dc, col);
|
||||||
|
|
||||||
|
if constexpr (Type & (ColumnFlushType::FLUSH_TRANS | ColumnFlushType::FLUSH_COLORMAP_TRANS))
|
||||||
|
{
|
||||||
|
// haleyjd 09/11/04: use temptranmap here
|
||||||
|
return *(t_dc->transmap + (col << 8) + (*dest));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return col;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<ColumnFlushType Type>
|
||||||
|
FUNCINLINE static ATTRINLINE constexpr UINT8
|
||||||
|
R_DrawFlushPixel(const drawcolumndata_temp_t *t_dc, UINT8 * restrict dest, const UINT8 * restrict source)
|
||||||
|
{
|
||||||
|
UINT8 col = *source;
|
||||||
|
return R_GetFlushPixelTranslucent<Type>(t_dc, dest, col);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// R_FlushWhole
|
||||||
|
//
|
||||||
|
// Flushes the entire columns in the buffer, one at a time.
|
||||||
|
// This is used when a quad flush isn't possible.
|
||||||
|
//
|
||||||
|
template<ColumnFlushType Type>
|
||||||
|
static void R_FlushWhole(void)
|
||||||
|
{
|
||||||
|
UINT8 * restrict source;
|
||||||
|
UINT8 * restrict dest;
|
||||||
|
INT32 count, yl;
|
||||||
|
const INT32 stride = vid.width;
|
||||||
|
drawcolumndata_temp_t *t_dc = &temp_dc;
|
||||||
|
UINT8 *restrict buf = t_dc->buf;
|
||||||
|
|
||||||
|
while (--t_dc->x >= 0)
|
||||||
|
{
|
||||||
|
yl = t_dc->yl[t_dc->x];
|
||||||
|
source = &buf[t_dc->x + (yl << 3)];
|
||||||
|
dest = R_Address(t_dc->startx + t_dc->x, yl);
|
||||||
|
count = t_dc->yh[t_dc->x] - yl + 1;
|
||||||
|
|
||||||
|
while (--count >= 0)
|
||||||
|
{
|
||||||
|
*dest = R_DrawFlushPixel<Type>(t_dc, dest, source);
|
||||||
|
source += 8;
|
||||||
|
dest += stride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// R_FlushHT
|
||||||
|
//
|
||||||
|
// Flushes the head and tail of columns in the buffer in
|
||||||
|
// preparation for a quad flush.
|
||||||
|
//
|
||||||
|
template<ColumnFlushType Type>
|
||||||
|
static void R_FlushHT(void)
|
||||||
|
{
|
||||||
|
UINT8 * restrict source;
|
||||||
|
UINT8 * restrict dest;
|
||||||
|
INT32 count, colnum = 0;
|
||||||
|
INT32 yl, yh;
|
||||||
|
const INT32 stride = vid.width;
|
||||||
|
const drawcolumndata_temp_t *t_dc = &temp_dc;
|
||||||
|
UINT8 *restrict buf = t_dc->buf;
|
||||||
|
|
||||||
|
while (colnum < 8)
|
||||||
|
{
|
||||||
|
yl = t_dc->yl[colnum];
|
||||||
|
yh = t_dc->yh[colnum];
|
||||||
|
|
||||||
|
// flush column head
|
||||||
|
if (yl < t_dc->commontop)
|
||||||
|
{
|
||||||
|
source = &buf[colnum + (yl << 3)];
|
||||||
|
dest = R_Address(t_dc->startx + colnum, yl);
|
||||||
|
count = t_dc->commontop - yl;
|
||||||
|
|
||||||
|
while (--count >= 0)
|
||||||
|
{
|
||||||
|
*dest = R_DrawFlushPixel<Type>(t_dc, dest, source);
|
||||||
|
source += 8;
|
||||||
|
dest += stride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// flush column tail
|
||||||
|
if (yh > t_dc->commonbot)
|
||||||
|
{
|
||||||
|
source = &buf[colnum + ((t_dc->commonbot + 1) << 3)];
|
||||||
|
dest = R_Address(t_dc->startx + colnum, t_dc->commonbot + 1);
|
||||||
|
count = yh - t_dc->commonbot;
|
||||||
|
|
||||||
|
while (--count >= 0)
|
||||||
|
{
|
||||||
|
*dest = R_DrawFlushPixel<Type>(t_dc, dest, source);
|
||||||
|
source += 8;
|
||||||
|
dest += stride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
++colnum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Begin: Quad column flushing functions.
|
||||||
|
template<ColumnFlushType Type>
|
||||||
|
static void R_FlushQuad(void)
|
||||||
|
{
|
||||||
|
const INT32 stride = vid.width;
|
||||||
|
const drawcolumndata_temp_t *t_dc = &temp_dc;
|
||||||
|
INT32 count = t_dc->commonbot - t_dc->commontop + 1;
|
||||||
|
const UINT8 *restrict buf = t_dc->buf;
|
||||||
|
|
||||||
|
if constexpr (Type & ColumnFlushType::FLUSH_OPAQUE)
|
||||||
|
{
|
||||||
|
const INT64 *source = reinterpret_cast<const INT64 *>(buf + (t_dc->commontop << 3));
|
||||||
|
INT64 *dest = reinterpret_cast<INT64 *>(R_Address(t_dc->startx, t_dc->commontop));
|
||||||
|
const INT32 deststep = stride / 8;
|
||||||
|
|
||||||
|
while (--count >= 0)
|
||||||
|
{
|
||||||
|
*dest = *source++;
|
||||||
|
dest += deststep;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const UINT8 * restrict source = buf + (t_dc->commontop << 3);
|
||||||
|
UINT8 * restrict dest = R_Address(t_dc->startx, t_dc->commontop);
|
||||||
|
|
||||||
|
while (--count >= 0)
|
||||||
|
{
|
||||||
|
dest[0] = R_DrawFlushPixel<Type>(t_dc, &dest[0], &source[0]);
|
||||||
|
dest[1] = R_DrawFlushPixel<Type>(t_dc, &dest[1], &source[1]);
|
||||||
|
dest[2] = R_DrawFlushPixel<Type>(t_dc, &dest[2], &source[2]);
|
||||||
|
dest[3] = R_DrawFlushPixel<Type>(t_dc, &dest[3], &source[3]);
|
||||||
|
dest[4] = R_DrawFlushPixel<Type>(t_dc, &dest[4], &source[4]);
|
||||||
|
dest[5] = R_DrawFlushPixel<Type>(t_dc, &dest[5], &source[5]);
|
||||||
|
dest[6] = R_DrawFlushPixel<Type>(t_dc, &dest[6], &source[6]);
|
||||||
|
dest[7] = R_DrawFlushPixel<Type>(t_dc, &dest[7], &source[7]);
|
||||||
|
source += 8;
|
||||||
|
dest += stride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// haleyjd 09/12/04: split up R_GetBuffer into various different
|
||||||
|
// functions to minimize the number of branches and take advantage
|
||||||
|
// of as much precalculated information as possible.
|
||||||
|
template<ColumnFlushType Type>
|
||||||
|
static UINT8 *R_GetBuffer(drawcolumndata_t *dc)
|
||||||
|
{
|
||||||
|
drawcolumndata_temp_t *t_dc = &temp_dc;
|
||||||
|
|
||||||
|
// haleyjd: reordered predicates
|
||||||
|
if (t_dc->x == 8 ||
|
||||||
|
(t_dc->x && (t_dc->type != Type || t_dc->x + t_dc->startx != dc->x)))
|
||||||
|
R_FlushColumns();
|
||||||
|
|
||||||
|
if (!t_dc->x)
|
||||||
|
{
|
||||||
|
++t_dc->x;
|
||||||
|
t_dc->startx = dc->x;
|
||||||
|
t_dc->yl[0] = t_dc->commontop = dc->yl;
|
||||||
|
t_dc->yh[0] = t_dc->commonbot = dc->yh;
|
||||||
|
t_dc->type = Type;
|
||||||
|
|
||||||
|
if constexpr (Type & (ColumnFlushType::FLUSH_TRANS | ColumnFlushType::FLUSH_COLORMAP_TRANS))
|
||||||
|
{
|
||||||
|
t_dc->transmap = dc->transmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
if constexpr (Type & (ColumnFlushType::FLUSH_COLORMAP | ColumnFlushType::FLUSH_COLORMAP_TRANS))
|
||||||
|
{
|
||||||
|
t_dc->translation = dc->translation;
|
||||||
|
}
|
||||||
|
|
||||||
|
R_FlushWholeColumns = R_FlushWhole<Type>;
|
||||||
|
R_FlushHTColumns = R_FlushHT<Type>;
|
||||||
|
R_FlushQuadColumn = R_FlushQuad<Type>;
|
||||||
|
|
||||||
|
return &t_dc->buf[dc->yl << 3];
|
||||||
|
}
|
||||||
|
|
||||||
|
t_dc->yl[t_dc->x] = dc->yl;
|
||||||
|
t_dc->yh[t_dc->x] = dc->yh;
|
||||||
|
|
||||||
|
if (dc->yl > t_dc->commontop)
|
||||||
|
t_dc->commontop = dc->yl;
|
||||||
|
if (dc->yh < t_dc->commonbot)
|
||||||
|
t_dc->commonbot = dc->yh;
|
||||||
|
|
||||||
|
return &t_dc->buf[(dc->yl << 3) + t_dc->x++];
|
||||||
|
}
|
||||||
|
|
||||||
|
#define DEFINE_GETBUF_FUNC(name, flags) \
|
||||||
|
FUNCINLINE static ATTRINLINE UINT8 *name(drawcolumndata_t *dc) \
|
||||||
|
{ \
|
||||||
|
constexpr ColumnFlushType opt = static_cast<ColumnFlushType>(flags); \
|
||||||
|
return R_GetBuffer<opt>(dc); \
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_GETBUF_FUNC(R_GetBufferOpaque, FLUSH_OPAQUE)
|
||||||
|
DEFINE_GETBUF_FUNC(R_GetBufferTrans, FLUSH_TRANS)
|
||||||
|
DEFINE_GETBUF_FUNC(R_GetBufferColormap, FLUSH_COLORMAP)
|
||||||
|
DEFINE_GETBUF_FUNC(R_GetBufferColormapTrans, FLUSH_COLORMAP_TRANS)
|
||||||
|
|
||||||
+69
-72
@@ -25,6 +25,9 @@
|
|||||||
#define local_for_thread static
|
#define local_for_thread static
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// SPANS
|
// SPANS
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
@@ -47,7 +50,8 @@ enum DrawSpanType
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<DrawSpanType Type>
|
template<DrawSpanType Type>
|
||||||
static constexpr UINT8 R_GetSpanTranslated(drawspandata_t* ds, UINT8 col)
|
FUNCINLINE static ATTRINLINE constexpr UINT8
|
||||||
|
R_GetSpanTranslated(const drawspandata_t* ds, UINT8 col)
|
||||||
{
|
{
|
||||||
if constexpr (Type & DrawSpanType::DS_COLORMAP)
|
if constexpr (Type & DrawSpanType::DS_COLORMAP)
|
||||||
{
|
{
|
||||||
@@ -60,7 +64,8 @@ static constexpr UINT8 R_GetSpanTranslated(drawspandata_t* ds, UINT8 col)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<DrawSpanType Type>
|
template<DrawSpanType Type>
|
||||||
static constexpr UINT8 R_GetSpanTranslucent(drawspandata_t* ds, UINT8 *dsrc, const UINT8 *colormap, UINT8 col)
|
FUNCINLINE static ATTRINLINE constexpr UINT8
|
||||||
|
R_GetSpanTranslucent(const drawspandata_t* ds, UINT8 *dsrc, const UINT8 *colormap, UINT8 col)
|
||||||
{
|
{
|
||||||
col = colormap[R_GetSpanTranslated<Type>(ds, col)];
|
col = colormap[R_GetSpanTranslated<Type>(ds, col)];
|
||||||
|
|
||||||
@@ -75,7 +80,8 @@ static constexpr UINT8 R_GetSpanTranslucent(drawspandata_t* ds, UINT8 *dsrc, con
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<DrawSpanType Type>
|
template<DrawSpanType Type>
|
||||||
static constexpr UINT8 R_DrawSpanPixel(drawspandata_t* ds, UINT8 *dsrc, const UINT8 *colormap, UINT32 bit, const UINT8 *source)
|
FUNCINLINE static ATTRINLINE constexpr UINT8
|
||||||
|
R_DrawSpanPixel(const drawspandata_t* ds, UINT8 *dsrc, const UINT8 *colormap, UINT32 bit, const UINT8 *source)
|
||||||
{
|
{
|
||||||
UINT8 col = source[bit];
|
UINT8 col = source[bit];
|
||||||
|
|
||||||
@@ -154,14 +160,18 @@ static void R_DrawSpanTemplate(drawspandata_t* ds)
|
|||||||
{
|
{
|
||||||
bit = ((yposition >> ds->nflatyshift) & ds->nflatmask) | (xposition >> ds->nflatxshift);
|
bit = ((yposition >> ds->nflatyshift) & ds->nflatmask) | (xposition >> ds->nflatxshift);
|
||||||
|
|
||||||
dest[i] = R_DrawSpanPixel<Type>(ds, &dsrc[i], colormap, bit, source);
|
if constexpr (Type & DS_RIPPLE)
|
||||||
|
dest[i] = R_DrawSpanPixel<Type>(ds, &dsrc[i], colormap, bit, source);
|
||||||
|
else
|
||||||
|
dest[i] = R_DrawSpanPixel<Type>(ds, &dest[i], colormap, bit, source);
|
||||||
|
|
||||||
xposition += xstep;
|
xposition += xstep;
|
||||||
yposition += ystep;
|
yposition += ystep;
|
||||||
}
|
}
|
||||||
|
|
||||||
dest += 8;
|
dest += 8;
|
||||||
dsrc += 8;
|
if constexpr (Type & DS_RIPPLE)
|
||||||
|
dsrc += 8;
|
||||||
|
|
||||||
count -= 8;
|
count -= 8;
|
||||||
}
|
}
|
||||||
@@ -170,10 +180,14 @@ static void R_DrawSpanTemplate(drawspandata_t* ds)
|
|||||||
{
|
{
|
||||||
bit = ((yposition >> ds->nflatyshift) & ds->nflatmask) | (xposition >> ds->nflatxshift);
|
bit = ((yposition >> ds->nflatyshift) & ds->nflatmask) | (xposition >> ds->nflatxshift);
|
||||||
|
|
||||||
*dest = R_DrawSpanPixel<Type>(ds, dsrc, colormap, bit, source);
|
if constexpr (Type & DS_RIPPLE)
|
||||||
|
*dest = R_DrawSpanPixel<Type>(ds, dsrc, colormap, bit, source);
|
||||||
|
else
|
||||||
|
*dest = R_DrawSpanPixel<Type>(ds, dest, colormap, bit, source);
|
||||||
|
|
||||||
dest++;
|
dest++;
|
||||||
dsrc++;
|
if constexpr (Type & DS_RIPPLE)
|
||||||
|
dsrc++;
|
||||||
|
|
||||||
xposition += xstep;
|
xposition += xstep;
|
||||||
yposition += ystep;
|
yposition += ystep;
|
||||||
@@ -182,31 +196,39 @@ static void R_DrawSpanTemplate(drawspandata_t* ds)
|
|||||||
|
|
||||||
// R_CalcTiltedLighting
|
// R_CalcTiltedLighting
|
||||||
// Exactly what it says on the tin. I wish I wasn't too lazy to explain things properly.
|
// Exactly what it says on the tin. I wish I wasn't too lazy to explain things properly.
|
||||||
static void R_CalcTiltedLighting(INT32 *lightbuffer, INT32 x1, INT32 x2, fixed_t start, fixed_t end)
|
static void R_CalcTiltedLighting(std::vector<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
|
// 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.
|
// of this function. Here's my own.
|
||||||
INT32 i, left = x1, right = x2;
|
INT32 i;
|
||||||
const fixed_t step = (end-start)/(x2 - x1 + 1);
|
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,
|
// 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...
|
// 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 = left; i <= right; i++)
|
for (i = x1; i <= x2; i++)
|
||||||
{
|
{
|
||||||
lightbuffer[i] = (start += step) >> FRACBITS;
|
fixed_t light = start >> FRACBITS;
|
||||||
|
lightbuffer[i] = CLAMP(light, 0, MAXLIGHTSCALE - 1);
|
||||||
if (lightbuffer[i] < 0)
|
start += step;
|
||||||
{
|
|
||||||
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>
|
template<DrawSpanType Type>
|
||||||
static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||||
{
|
{
|
||||||
@@ -223,41 +245,23 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
|||||||
float endz, endu, endv;
|
float endz, endu, endv;
|
||||||
UINT32 stepu, stepv;
|
UINT32 stepu, stepv;
|
||||||
UINT32 bit;
|
UINT32 bit;
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
INT32 x1 = ds->x1;
|
INT32 x1 = ds->x1;
|
||||||
const INT32 nflatxshift = ds->nflatxshift;
|
const INT32 nflatxshift = ds->nflatxshift;
|
||||||
const INT32 nflatyshift = ds->nflatyshift;
|
const INT32 nflatyshift = ds->nflatyshift;
|
||||||
const INT32 nflatmask = ds->nflatmask;
|
const INT32 nflatmask = ds->nflatmask;
|
||||||
const INT32 stride = vid.width;
|
const INT32 stride = vid.width;
|
||||||
|
local_for_thread std::vector<INT32> tiltlighting;
|
||||||
|
|
||||||
iz = ds->szp.z + ds->szp.y*(centery-ds->y) + ds->szp.x*(ds->x1-centerx);
|
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
|
|
||||||
{
|
|
||||||
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);
|
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);
|
vz = ds->svp.z + ds->svp.y*(centery-ds->y) + ds->svp.x*(ds->x1-centerx);
|
||||||
|
|
||||||
const UINT8 *source = ds->source;
|
// Lighting is simple. It's just linear interpolation from start to end
|
||||||
const UINT8 *colormap = ds->colormap;
|
R_GetTiltedLighting(tiltlighting, ds, iz, width, stride);
|
||||||
|
|
||||||
|
const UINT8 * restrict source = ds->source;
|
||||||
|
const UINT8 * restrict colormap = ds->colormap;
|
||||||
|
|
||||||
if constexpr (Type & DS_RIPPLE)
|
if constexpr (Type & DS_RIPPLE)
|
||||||
{
|
{
|
||||||
@@ -319,12 +323,16 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
|||||||
{
|
{
|
||||||
bit = (((v + stepv * i) >> nflatyshift) & nflatmask) | ((u + stepu * i) >> nflatxshift);
|
bit = (((v + stepv * i) >> nflatyshift) & nflatmask) | ((u + stepu * i) >> nflatxshift);
|
||||||
colormap = ds->planezlight[tiltlighting[x1 + i]] + (ds->colormap - colormaps);
|
colormap = ds->planezlight[tiltlighting[x1 + i]] + (ds->colormap - colormaps);
|
||||||
dest[i] = R_DrawSpanPixel<Type>(ds, &dsrc[i], colormap, bit, source);
|
if constexpr (Type & DS_RIPPLE)
|
||||||
|
dest[i] = R_DrawSpanPixel<Type>(ds, &dsrc[i], colormap, bit, source);
|
||||||
|
else
|
||||||
|
dest[i] = R_DrawSpanPixel<Type>(ds, &dest[i], colormap, bit, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
ds->x1 += SPANSIZE;
|
ds->x1 += SPANSIZE;
|
||||||
dest += SPANSIZE;
|
dest += SPANSIZE;
|
||||||
dsrc += SPANSIZE;
|
if constexpr (Type & DS_RIPPLE)
|
||||||
|
dsrc += SPANSIZE;
|
||||||
startu = endu;
|
startu = endu;
|
||||||
startv = endv;
|
startv = endv;
|
||||||
width -= SPANSIZE;
|
width -= SPANSIZE;
|
||||||
@@ -338,7 +346,10 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
|||||||
v = (INT64)(startv);
|
v = (INT64)(startv);
|
||||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||||
colormap = ds->planezlight[tiltlighting[ds->x1]] + (ds->colormap - colormaps);
|
colormap = ds->planezlight[tiltlighting[ds->x1]] + (ds->colormap - colormaps);
|
||||||
*dest = R_DrawSpanPixel<Type>(ds, dsrc, colormap, bit, source);
|
if constexpr (Type & DS_RIPPLE)
|
||||||
|
*dest = R_DrawSpanPixel<Type>(ds, dsrc, colormap, bit, source);
|
||||||
|
else
|
||||||
|
*dest = R_DrawSpanPixel<Type>(ds, dest, colormap, bit, source);
|
||||||
ds->x1++;
|
ds->x1++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -361,10 +372,14 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
|||||||
{
|
{
|
||||||
bit = ((v >> ds->nflatyshift) & ds->nflatmask) | (u >> ds->nflatxshift);
|
bit = ((v >> ds->nflatyshift) & ds->nflatmask) | (u >> ds->nflatxshift);
|
||||||
colormap = ds->planezlight[tiltlighting[ds->x1]] + (ds->colormap - colormaps);
|
colormap = ds->planezlight[tiltlighting[ds->x1]] + (ds->colormap - colormaps);
|
||||||
*dest = R_DrawSpanPixel<Type>(ds, dsrc, colormap, bit, source);
|
if constexpr (Type & DS_RIPPLE)
|
||||||
|
*dest = R_DrawSpanPixel<Type>(ds, dsrc, colormap, bit, source);
|
||||||
|
else
|
||||||
|
*dest = R_DrawSpanPixel<Type>(ds, dest, colormap, bit, source);
|
||||||
dest++;
|
dest++;
|
||||||
|
if constexpr (Type & DS_RIPPLE)
|
||||||
|
dsrc++;
|
||||||
ds->x1++;
|
ds->x1++;
|
||||||
dsrc++;
|
|
||||||
u += stepu;
|
u += stepu;
|
||||||
v += stepv;
|
v += stepv;
|
||||||
}
|
}
|
||||||
@@ -395,11 +410,11 @@ DEFINE_SPAN_COMBO(R_DrawTranslucentWaterSpan, DS_TRANSMAP|DS_RIPPLE)
|
|||||||
*/
|
*/
|
||||||
void R_DrawFogSpan(drawspandata_t* ds)
|
void R_DrawFogSpan(drawspandata_t* ds)
|
||||||
{
|
{
|
||||||
|
INT32 count = ds->x2 - ds->x1 + 1;
|
||||||
|
|
||||||
const UINT8 * restrict colormap = ds->colormap;
|
const UINT8 * restrict colormap = ds->colormap;
|
||||||
UINT8 * restrict dest = R_Address(ds->x1, ds->y);
|
UINT8 * restrict dest = R_Address(ds->x1, ds->y);
|
||||||
|
|
||||||
intptr_t count = ds->x2 - ds->x1 + 1;
|
|
||||||
|
|
||||||
while (count >= 4)
|
while (count >= 4)
|
||||||
{
|
{
|
||||||
dest[0] = colormap[dest[0]];
|
dest[0] = colormap[dest[0]];
|
||||||
@@ -407,7 +422,7 @@ void R_DrawFogSpan(drawspandata_t* ds)
|
|||||||
dest[2] = colormap[dest[2]];
|
dest[2] = colormap[dest[2]];
|
||||||
dest[3] = colormap[dest[3]];
|
dest[3] = colormap[dest[3]];
|
||||||
|
|
||||||
dest += 4;
|
dest += 4;
|
||||||
count -= 4;
|
count -= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -423,31 +438,13 @@ void R_DrawFogSpan_Tilted(drawspandata_t* ds)
|
|||||||
int width = ds->x2 - ds->x1;
|
int width = ds->x2 - ds->x1;
|
||||||
float iz = ds->szp.z + ds->szp.y*(centery-ds->y) + ds->szp.x*(ds->x1-centerx);
|
float iz = ds->szp.z + ds->szp.y*(centery-ds->y) + ds->szp.x*(ds->x1-centerx);
|
||||||
UINT8 * restrict dest;
|
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);
|
dest = R_Address(ds->x1, ds->y);
|
||||||
const INT32 stride = vid.width;
|
const INT32 stride = vid.width;
|
||||||
|
|
||||||
// Lighting is simple. It's just linear interpolation from start to end
|
// 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
|
do
|
||||||
{
|
{
|
||||||
|
|||||||
+9
-3
@@ -1023,8 +1023,6 @@ void R_Init(void)
|
|||||||
//I_OutputMsg("\nR_InitData");
|
//I_OutputMsg("\nR_InitData");
|
||||||
R_InitData();
|
R_InitData();
|
||||||
|
|
||||||
//I_OutputMsg("\nR_InitViewBorder");
|
|
||||||
R_InitViewBorder();
|
|
||||||
R_SetViewSize(); // setsizeneeded is set true
|
R_SetViewSize(); // setsizeneeded is set true
|
||||||
|
|
||||||
// this is now done by SCR_Recalc() at the first mode set
|
// this is now done by SCR_Recalc() at the first mode set
|
||||||
@@ -1400,12 +1398,16 @@ void R_RenderPlayerView(player_t *player)
|
|||||||
|
|
||||||
R_ClearClipSegs();
|
R_ClearClipSegs();
|
||||||
R_ClearDrawSegs();
|
R_ClearDrawSegs();
|
||||||
|
R_ClearSegTables();
|
||||||
R_ClearPlanes();
|
R_ClearPlanes();
|
||||||
R_ClearSprites();
|
R_ClearSprites();
|
||||||
|
|
||||||
|
R_SetColumnContext(COLUMNCONTEXT_FLUSH);
|
||||||
R_RenderViewpoint(&masks[nummasks - 1], false);
|
R_RenderViewpoint(&masks[nummasks - 1], false);
|
||||||
|
|
||||||
R_ClipSprites(drawsegs, NULL);
|
R_ClipSprites(drawsegs, NULL);
|
||||||
|
R_ResetColumnBuffer();
|
||||||
|
R_SetColumnContext(COLUMNCONTEXT_DIRECT);
|
||||||
R_DrawSkyPlanes(); // draw the fucker again to prevent some artifacts
|
R_DrawSkyPlanes(); // draw the fucker again to prevent some artifacts
|
||||||
R_DrawPlanes();
|
R_DrawPlanes();
|
||||||
R_DrawMasked(masks, nummasks);
|
R_DrawMasked(masks, nummasks);
|
||||||
@@ -1434,11 +1436,13 @@ void R_RenderPlayerView(player_t *player)
|
|||||||
R_ClearClipSegs();
|
R_ClearClipSegs();
|
||||||
}
|
}
|
||||||
R_ClearDrawSegs();
|
R_ClearDrawSegs();
|
||||||
|
R_ClearSegTables();
|
||||||
R_ClearSprites();
|
R_ClearSprites();
|
||||||
|
|
||||||
// check for new console commands.
|
// check for new console commands.
|
||||||
NetUpdate();
|
NetUpdate();
|
||||||
|
|
||||||
|
R_SetColumnContext(COLUMNCONTEXT_FLUSH);
|
||||||
ps_numbspcalls.value.i = ps_numpolyobjects.value.i = ps_numdrawnodes.value.i = 0;
|
ps_numbspcalls.value.i = ps_numpolyobjects.value.i = ps_numdrawnodes.value.i = 0;
|
||||||
PS_START_TIMING(ps_bsptime);
|
PS_START_TIMING(ps_bsptime);
|
||||||
R_RenderViewpoint(&masks[nummasks - 1], true);
|
R_RenderViewpoint(&masks[nummasks - 1], true);
|
||||||
@@ -1446,6 +1450,7 @@ void R_RenderPlayerView(player_t *player)
|
|||||||
PS_START_TIMING(ps_sw_spritecliptime);
|
PS_START_TIMING(ps_sw_spritecliptime);
|
||||||
R_ClipSprites(drawsegs, NULL);
|
R_ClipSprites(drawsegs, NULL);
|
||||||
PS_STOP_TIMING(ps_sw_spritecliptime);
|
PS_STOP_TIMING(ps_sw_spritecliptime);
|
||||||
|
R_ResetColumnBuffer();
|
||||||
|
|
||||||
ps_numsprites.value.i = numvisiblesprites;
|
ps_numsprites.value.i = numvisiblesprites;
|
||||||
|
|
||||||
@@ -1482,12 +1487,14 @@ void R_RenderPlayerView(player_t *player)
|
|||||||
R_RenderViewpoint(&masks[nummasks - 1], true);
|
R_RenderViewpoint(&masks[nummasks - 1], true);
|
||||||
|
|
||||||
R_ClipSprites(ds_p - (masks[nummasks - 1].drawsegs[1] - masks[nummasks - 1].drawsegs[0]), portal);
|
R_ClipSprites(ds_p - (masks[nummasks - 1].drawsegs[1] - masks[nummasks - 1].drawsegs[0]), portal);
|
||||||
|
R_ResetColumnBuffer();
|
||||||
|
|
||||||
Portal_Remove(portal);
|
Portal_Remove(portal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PS_STOP_TIMING(ps_sw_portaltime);
|
PS_STOP_TIMING(ps_sw_portaltime);
|
||||||
|
|
||||||
|
R_SetColumnContext(COLUMNCONTEXT_DIRECT);
|
||||||
PS_START_TIMING(ps_sw_planetime);
|
PS_START_TIMING(ps_sw_planetime);
|
||||||
if (!skybox)
|
if (!skybox)
|
||||||
R_DrawSkyPlanes();
|
R_DrawSkyPlanes();
|
||||||
@@ -1498,7 +1505,6 @@ void R_RenderPlayerView(player_t *player)
|
|||||||
PS_START_TIMING(ps_sw_maskedtime);
|
PS_START_TIMING(ps_sw_maskedtime);
|
||||||
R_DrawMasked(masks, nummasks);
|
R_DrawMasked(masks, nummasks);
|
||||||
PS_STOP_TIMING(ps_sw_maskedtime);
|
PS_STOP_TIMING(ps_sw_maskedtime);
|
||||||
|
|
||||||
free(masks);
|
free(masks);
|
||||||
|
|
||||||
// Check for new console commands.
|
// Check for new console commands.
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "r_skins.h"
|
#include "r_skins.h"
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
#include "hardware/hw_glob.h"
|
#include "hardware/hw_glob.h"
|
||||||
@@ -37,7 +38,7 @@ static void R_ParseSpriteInfoFrame(spriteinfo_t *info)
|
|||||||
UINT8 frameFrame = 0xFF;
|
UINT8 frameFrame = 0xFF;
|
||||||
INT16 frameXPivot = 0;
|
INT16 frameXPivot = 0;
|
||||||
INT16 frameYPivot = 0;
|
INT16 frameYPivot = 0;
|
||||||
rotaxis_t frameRotAxis = 0;
|
rotaxis_t frameRotAxis = ROTAXIS_X;
|
||||||
|
|
||||||
// Sprite identifier
|
// Sprite identifier
|
||||||
sprinfoToken = M_GetToken(NULL);
|
sprinfoToken = M_GetToken(NULL);
|
||||||
@@ -158,14 +159,14 @@ static void R_ParseSpriteInfo(boolean spr2)
|
|||||||
I_Error("Error parsing SPRTINFO lump: Unknown sprite name \"%s\"", newSpriteName);
|
I_Error("Error parsing SPRTINFO lump: Unknown sprite name \"%s\"", newSpriteName);
|
||||||
if (!memcmp(newSpriteName,sprnames[i],4))
|
if (!memcmp(newSpriteName,sprnames[i],4))
|
||||||
{
|
{
|
||||||
sprnum = i;
|
sprnum = static_cast<spritenum_t>(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// allocate a spriteinfo
|
// allocate a spriteinfo
|
||||||
info = Z_Calloc(sizeof(spriteinfo_t), PU_STATIC, NULL);
|
info = static_cast<spriteinfo_t*>(Z_Calloc(sizeof(spriteinfo_t), PU_STATIC, NULL));
|
||||||
info->available = true;
|
info->available = true;
|
||||||
|
|
||||||
// Left Curly Brace
|
// Left Curly Brace
|
||||||
@@ -329,7 +330,7 @@ void R_LoadSpriteInfoLumps(UINT16 wadnum, UINT16 numlumps)
|
|||||||
|
|
||||||
patch_t *Patch_Create(softwarepatch_t *source, size_t srcsize, void *dest)
|
patch_t *Patch_Create(softwarepatch_t *source, size_t srcsize, void *dest)
|
||||||
{
|
{
|
||||||
patch_t *patch = (dest == NULL) ? Z_Calloc(sizeof(patch_t), PU_PATCH, NULL) : (patch_t *)(dest);
|
patch_t *patch = static_cast<patch_t*>((dest == NULL) ? Z_Calloc(sizeof(patch_t), PU_PATCH, NULL) : dest);
|
||||||
|
|
||||||
if (source)
|
if (source)
|
||||||
{
|
{
|
||||||
@@ -341,7 +342,7 @@ patch_t *Patch_Create(softwarepatch_t *source, size_t srcsize, void *dest)
|
|||||||
patch->height = SHORT(source->height);
|
patch->height = SHORT(source->height);
|
||||||
patch->leftoffset = SHORT(source->leftoffset);
|
patch->leftoffset = SHORT(source->leftoffset);
|
||||||
patch->topoffset = SHORT(source->topoffset);
|
patch->topoffset = SHORT(source->topoffset);
|
||||||
patch->columnofs = Z_Calloc(size, PU_PATCH_DATA, NULL);
|
patch->columnofs = static_cast<INT32*>(Z_Calloc(size, PU_PATCH_DATA, NULL));
|
||||||
|
|
||||||
for (col = 0; col < source->width; col++)
|
for (col = 0; col < source->width; col++)
|
||||||
{
|
{
|
||||||
@@ -357,7 +358,7 @@ patch_t *Patch_Create(softwarepatch_t *source, size_t srcsize, void *dest)
|
|||||||
if (colsize <= 0)
|
if (colsize <= 0)
|
||||||
I_Error("Patch_Create: no column data!");
|
I_Error("Patch_Create: no column data!");
|
||||||
|
|
||||||
patch->columns = Z_Calloc(colsize, PU_PATCH_DATA, NULL);
|
patch->columns = static_cast<UINT8*>(Z_Calloc(colsize, PU_PATCH_DATA, NULL));
|
||||||
M_Memcpy(patch->columns, ((UINT8 *)source + LONG(source->columnofs[0])), colsize);
|
M_Memcpy(patch->columns, ((UINT8 *)source + LONG(source->columnofs[0])), colsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,8 +430,8 @@ void *Patch_AllocateHardwarePatch(patch_t *patch)
|
|||||||
{
|
{
|
||||||
if (!patch->hardware)
|
if (!patch->hardware)
|
||||||
{
|
{
|
||||||
GLPatch_t *glPatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, &patch->hardware);
|
GLPatch_t *glPatch = static_cast<GLPatch_t*>(Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, &patch->hardware));
|
||||||
glPatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, &glPatch->mipmap);
|
glPatch->mipmap = static_cast<GLMipmap_t*>(Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, &glPatch->mipmap));
|
||||||
}
|
}
|
||||||
return (void *)(patch->hardware);
|
return (void *)(patch->hardware);
|
||||||
}
|
}
|
||||||
@@ -448,7 +449,8 @@ void *Patch_CreateGL(patch_t *patch)
|
|||||||
}
|
}
|
||||||
#endif // HWRENDER
|
#endif // HWRENDER
|
||||||
|
|
||||||
static UINT8 *imgbuf = NULL;
|
// 1 MB should be enough for most cases
|
||||||
|
static std::vector<UINT8> imgbuf(1024 * 1024);
|
||||||
|
|
||||||
//
|
//
|
||||||
// R_MaskedFlatToPatch
|
// R_MaskedFlatToPatch
|
||||||
@@ -458,17 +460,27 @@ static UINT8 *imgbuf = NULL;
|
|||||||
void *R_PixelsToPatch(UINT8 *raw, INT16 width, INT16 height, INT16 leftoffset, INT16 topoffset, size_t *destsize)
|
void *R_PixelsToPatch(UINT8 *raw, INT16 width, INT16 height, INT16 leftoffset, INT16 topoffset, size_t *destsize)
|
||||||
{
|
{
|
||||||
INT16 x, y;
|
INT16 x, y;
|
||||||
UINT8 *img;
|
UINT8 *img, *imgptr;
|
||||||
UINT8 *colpointers, *startofspan;
|
UINT8 *colpointers, *startofspan;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
|
|
||||||
if (!raw)
|
if (!raw)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!imgbuf)
|
// Allocate a staging buffer with the maximum size needed for a patch of the same size as the input.
|
||||||
imgbuf = Z_Malloc(1<<26, PU_STATIC, NULL);
|
|
||||||
|
|
||||||
UINT8 *imgptr = imgbuf;
|
// round up to nearest multiple of 254-pixel posts, plus 1 more 254-pixel post for paranoia reasons
|
||||||
|
size_t maxcolumnsize = (2 + (height - 1) / 256) * 256;
|
||||||
|
// the patch header, and width columns of the max column size
|
||||||
|
size_t maxoutsize = maxcolumnsize * width + (8 + 4 * width);
|
||||||
|
// so, a 512x512 flat should maximally need 393,760 (384.53 KiB) bytes.
|
||||||
|
// quite a bit smaller than 64 megabytes, and much less annoying to the windows debug allocator!
|
||||||
|
while (imgbuf.size() < maxoutsize)
|
||||||
|
{
|
||||||
|
imgbuf.resize(imgbuf.size() * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
imgptr = imgbuf.data();
|
||||||
|
|
||||||
// Write image size and offset
|
// Write image size and offset
|
||||||
WRITEINT16(imgptr, width);
|
WRITEINT16(imgptr, width);
|
||||||
@@ -488,7 +500,7 @@ void *R_PixelsToPatch(UINT8 *raw, INT16 width, INT16 height, INT16 leftoffset, I
|
|||||||
startofspan = NULL;
|
startofspan = NULL;
|
||||||
|
|
||||||
// Write column pointer
|
// Write column pointer
|
||||||
WRITEINT32(colpointers, imgptr - imgbuf);
|
WRITEINT32(colpointers, imgptr - imgbuf.data());
|
||||||
|
|
||||||
// Write pixels
|
// Write pixels
|
||||||
for (y = 0; y < height; y++)
|
for (y = 0; y < height; y++)
|
||||||
@@ -557,9 +569,9 @@ void *R_PixelsToPatch(UINT8 *raw, INT16 width, INT16 height, INT16 leftoffset, I
|
|||||||
WRITEUINT8(imgptr, 0xFF);
|
WRITEUINT8(imgptr, 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
size = imgptr-imgbuf;
|
size = imgptr-imgbuf.data();
|
||||||
img = Z_Malloc(size, PU_STATIC, NULL);
|
img = static_cast<UINT8*>(Z_Malloc(size, PU_STATIC, NULL));
|
||||||
memcpy(img, imgbuf, size);
|
memcpy(img, imgbuf.data(), size);
|
||||||
|
|
||||||
if (destsize != NULL)
|
if (destsize != NULL)
|
||||||
*destsize = size;
|
*destsize = size;
|
||||||
@@ -582,17 +594,27 @@ void *R_PixelsToPatch(UINT8 *raw, INT16 width, INT16 height, INT16 leftoffset, I
|
|||||||
void *R_MaskedFlatToPatch(UINT16 *raw, INT16 width, INT16 height, INT16 leftoffset, INT16 topoffset, size_t *destsize)
|
void *R_MaskedFlatToPatch(UINT16 *raw, INT16 width, INT16 height, INT16 leftoffset, INT16 topoffset, size_t *destsize)
|
||||||
{
|
{
|
||||||
INT16 x, y;
|
INT16 x, y;
|
||||||
UINT8 *img;
|
UINT8 *img, *imgptr;
|
||||||
UINT8 *colpointers, *startofspan;
|
UINT8 *colpointers, *startofspan;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
|
|
||||||
if (!raw)
|
if (!raw)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!imgbuf)
|
// Allocate a staging buffer with the maximum size needed for a patch of the same size as the input.
|
||||||
imgbuf = Z_Malloc(1<<26, PU_STATIC, NULL);
|
|
||||||
|
|
||||||
UINT8 *imgptr = imgbuf;
|
// round up to nearest multiple of 254-pixel posts, plus 1 more 254-pixel post for paranoia reasons
|
||||||
|
size_t maxcolumnsize = (2 + (height - 1) / 256) * 256;
|
||||||
|
// the patch header, and width columns of the max column size
|
||||||
|
size_t maxoutsize = maxcolumnsize * width + (8 + 4 * width);
|
||||||
|
// so, a 512x512 flat should maximally need 393,760 (384.53 KiB) bytes.
|
||||||
|
// quite a bit smaller than 64 megabytes, and much less annoying to the windows debug allocator!
|
||||||
|
while (imgbuf.size() < maxoutsize)
|
||||||
|
{
|
||||||
|
imgbuf.resize(imgbuf.size() * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
imgptr = imgbuf.data();
|
||||||
|
|
||||||
// Write image size and offset
|
// Write image size and offset
|
||||||
WRITEINT16(imgptr, width);
|
WRITEINT16(imgptr, width);
|
||||||
@@ -612,7 +634,7 @@ void *R_MaskedFlatToPatch(UINT16 *raw, INT16 width, INT16 height, INT16 leftoffs
|
|||||||
startofspan = NULL;
|
startofspan = NULL;
|
||||||
|
|
||||||
// Write column pointer
|
// Write column pointer
|
||||||
WRITEINT32(colpointers, imgptr - imgbuf);
|
WRITEINT32(colpointers, imgptr - imgbuf.data());
|
||||||
|
|
||||||
// Write pixels
|
// Write pixels
|
||||||
for (y = 0; y < height; y++)
|
for (y = 0; y < height; y++)
|
||||||
@@ -682,9 +704,9 @@ void *R_MaskedFlatToPatch(UINT16 *raw, INT16 width, INT16 height, INT16 leftoffs
|
|||||||
WRITEUINT8(imgptr, 0xFF);
|
WRITEUINT8(imgptr, 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
size = imgptr-imgbuf;
|
size = imgptr-imgbuf.data();
|
||||||
img = Z_Malloc(size, PU_STATIC, NULL);
|
img = static_cast<UINT8*>(Z_Malloc(size, PU_STATIC, NULL));
|
||||||
memcpy(img, imgbuf, size);
|
memcpy(img, imgbuf.data(), size);
|
||||||
|
|
||||||
if (destsize != NULL)
|
if (destsize != NULL)
|
||||||
*destsize = size;
|
*destsize = size;
|
||||||
@@ -14,6 +14,10 @@
|
|||||||
#ifndef __R_PATCH__
|
#ifndef __R_PATCH__
|
||||||
#define __R_PATCH__
|
#define __R_PATCH__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "r_defs.h"
|
#include "r_defs.h"
|
||||||
|
|
||||||
// Structs
|
// Structs
|
||||||
@@ -36,6 +40,8 @@ typedef struct
|
|||||||
boolean available;
|
boolean available;
|
||||||
} spriteinfo_t;
|
} spriteinfo_t;
|
||||||
|
|
||||||
|
#define PNG_HEADER_SIZE (8)
|
||||||
|
|
||||||
// Patch functions
|
// Patch functions
|
||||||
patch_t *Patch_Create(softwarepatch_t *source, size_t srcsize, void *dest);
|
patch_t *Patch_Create(softwarepatch_t *source, size_t srcsize, void *dest);
|
||||||
void Patch_Free(patch_t *patch);
|
void Patch_Free(patch_t *patch);
|
||||||
@@ -61,4 +67,8 @@ void *R_PixelsToPatch(UINT8 *raw, INT16 width, INT16 height, INT16 leftoffset, I
|
|||||||
UINT16 R_GetPatchPixel(patch_t *patch, INT32 x, INT32 y, boolean flip);
|
UINT16 R_GetPatchPixel(patch_t *patch, INT32 x, INT32 y, boolean flip);
|
||||||
void R_PatchToPixels(patch_t *patch, UINT8 *dst); // Important: dst must have enough space for patch->width*patch->height pixels!
|
void R_PatchToPixels(patch_t *patch, UINT8 *dst); // Important: dst must have enough space for patch->width*patch->height pixels!
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} // extern "C"
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // __R_PATCH__
|
#endif // __R_PATCH__
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "r_patchrotation.h"
|
#include "r_patchrotation.h"
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#ifdef ROTSPRITE
|
#ifdef ROTSPRITE
|
||||||
//
|
//
|
||||||
@@ -89,14 +90,14 @@ patch_t *Patch_GetRotatedSprite(spriteframe_t *sprite, size_t frame, size_t spri
|
|||||||
RotatedPatch_DoRotation(rotsprite, patch, rotationangle, xpivot, ypivot, flip);
|
RotatedPatch_DoRotation(rotsprite, patch, rotationangle, xpivot, ypivot, flip);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rotsprite->patches[idx];
|
return static_cast<patch_t*>(rotsprite->patches[idx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
rotsprite_t *RotatedPatch_Create(INT32 numangles)
|
rotsprite_t *RotatedPatch_Create(INT32 numangles)
|
||||||
{
|
{
|
||||||
rotsprite_t *rotsprite = Z_Calloc(sizeof(rotsprite_t), PU_STATIC, NULL);
|
rotsprite_t *rotsprite = static_cast<rotsprite_t*>(Z_Calloc(sizeof(rotsprite_t), PU_STATIC, NULL));
|
||||||
rotsprite->angles = numangles;
|
rotsprite->angles = numangles;
|
||||||
rotsprite->patches = Z_Calloc(rotsprite->angles * 2 * sizeof(void *), PU_STATIC, NULL);
|
rotsprite->patches = static_cast<void**>(Z_Calloc(rotsprite->angles * 2 * sizeof(void *), PU_STATIC, NULL));
|
||||||
return rotsprite;
|
return rotsprite;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,30 +119,8 @@ static void RotatedPatch_CalculateDimensions(
|
|||||||
h1 = FixedInt(FixedCeil(h1 + (FRACUNIT/2)));
|
h1 = FixedInt(FixedCeil(h1 + (FRACUNIT/2)));
|
||||||
h2 = FixedInt(FixedCeil(h2 + (FRACUNIT/2)));
|
h2 = FixedInt(FixedCeil(h2 + (FRACUNIT/2)));
|
||||||
|
|
||||||
*newwidth = max(width, max(w1, w2));
|
*newwidth = std::max(width, std::max(w1, w2));
|
||||||
*newheight = max(height, max(h1, h2));
|
*newheight = std::max(height, std::max(h1, h2));
|
||||||
}
|
|
||||||
|
|
||||||
static void RotatedPatch_AllocImgBuf(UINT16 **buf, size_t size, size_t *capacity)
|
|
||||||
{
|
|
||||||
if (!*buf)
|
|
||||||
{
|
|
||||||
*buf = Z_Malloc(*capacity, PU_STATIC, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t allocsize = size * sizeof(UINT16);
|
|
||||||
|
|
||||||
// make sure our buffer always fits with what we need
|
|
||||||
if (allocsize > *capacity)
|
|
||||||
{
|
|
||||||
while (*capacity < allocsize)
|
|
||||||
*capacity *= 2;
|
|
||||||
|
|
||||||
Z_Free(*buf);
|
|
||||||
*buf = Z_Malloc(*capacity, PU_STATIC, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
//CONS_Printf("RotatedPatch_AllocBuf: Allocated %.2f KB\n", *capacity / 1024.0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle, INT32 xpivot, INT32 ypivot, boolean flip)
|
void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle, INT32 xpivot, INT32 ypivot, boolean flip)
|
||||||
@@ -149,10 +128,10 @@ void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle
|
|||||||
UINT32 i;
|
UINT32 i;
|
||||||
patch_t *rotated;
|
patch_t *rotated;
|
||||||
|
|
||||||
static UINT16 *rawdst = NULL, *rawconv = NULL;
|
static std::vector<UINT16> rawdst(1024 * 1024), rawconv(1024 * 1024); // 1 MB should be enough for most cases
|
||||||
|
|
||||||
UINT16 *rawout;
|
UINT16 *rawout;
|
||||||
size_t size;
|
size_t size;
|
||||||
static size_t dst_capacity = (1024 * 1024), conv_capacity = (1024 * 1024); // 1 MB should be enough for most cases
|
|
||||||
INT32 bflip = (flip != 0x00);
|
INT32 bflip = (flip != 0x00);
|
||||||
|
|
||||||
INT32 width = patch->width;
|
INT32 width = patch->width;
|
||||||
@@ -206,7 +185,10 @@ void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle
|
|||||||
if (!size)
|
if (!size)
|
||||||
size = (width * height);
|
size = (width * height);
|
||||||
|
|
||||||
RotatedPatch_AllocImgBuf(&rawdst, size, &dst_capacity);
|
while (rawdst.size() < size)
|
||||||
|
{
|
||||||
|
rawdst.resize(rawdst.size() * 2);
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < size; i++)
|
for (i = 0; i < size; i++)
|
||||||
rawdst[i] = 0xFF00;
|
rawdst[i] = 0xFF00;
|
||||||
@@ -250,11 +232,11 @@ void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle
|
|||||||
|
|
||||||
size = (width * height);
|
size = (width * height);
|
||||||
|
|
||||||
RotatedPatch_AllocImgBuf(&rawconv, size, &conv_capacity);
|
rawconv.resize(size);
|
||||||
memset(rawconv, 0, conv_capacity * sizeof(UINT16));
|
memset(rawconv.data(), 0, size * sizeof(UINT16));
|
||||||
|
|
||||||
src = &rawdst[(miny * newwidth) + minx];
|
src = &rawdst[(miny * newwidth) + minx];
|
||||||
dest = rawconv;
|
dest = rawconv.data();
|
||||||
dy = height;
|
dy = height;
|
||||||
|
|
||||||
while (dy--)
|
while (dy--)
|
||||||
@@ -267,14 +249,14 @@ void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle
|
|||||||
ox -= minx;
|
ox -= minx;
|
||||||
oy -= miny;
|
oy -= miny;
|
||||||
|
|
||||||
rawout = rawconv;
|
rawout = rawconv.data();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
width = newwidth;
|
width = newwidth;
|
||||||
height = newheight;
|
height = newheight;
|
||||||
|
|
||||||
rawout = rawdst;
|
rawout = rawdst.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
// make patch
|
// make patch
|
||||||
+16
-27
@@ -60,10 +60,6 @@ INT32 numffloors;
|
|||||||
#define visplane_hash(picnum,lightlevel,height) \
|
#define visplane_hash(picnum,lightlevel,height) \
|
||||||
((unsigned)((picnum)*3+(lightlevel)+(height)*7) & VISPLANEHASHMASK)
|
((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.
|
// Clip values are the solid pixel bounding the range.
|
||||||
// floorclip starts out SCREENHEIGHT
|
// floorclip starts out SCREENHEIGHT
|
||||||
@@ -339,13 +335,13 @@ void R_ClearPlanes(void)
|
|||||||
R_ClearFFloorClips();
|
R_ClearFFloorClips();
|
||||||
|
|
||||||
for (i = 0; i < MAXVISPLANES; i++)
|
for (i = 0; i < MAXVISPLANES; i++)
|
||||||
|
{
|
||||||
for (*freehead = visplanes[i], visplanes[i] = NULL;
|
for (*freehead = visplanes[i], visplanes[i] = NULL;
|
||||||
freehead && *freehead ;)
|
freehead && *freehead ;)
|
||||||
{
|
{
|
||||||
freehead = &(*freehead)->next;
|
freehead = &(*freehead)->next;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
lastopening = openings;
|
|
||||||
|
|
||||||
// left to right mapping
|
// left to right mapping
|
||||||
angle = (viewangle-ANGLE_90)>>ANGLETOFINESHIFT;
|
angle = (viewangle-ANGLE_90)>>ANGLETOFINESHIFT;
|
||||||
@@ -720,13 +716,10 @@ void R_DrawPlanes(void)
|
|||||||
visplane_t *pl;
|
visplane_t *pl;
|
||||||
INT32 i;
|
INT32 i;
|
||||||
drawspandata_t ds = {};
|
drawspandata_t ds = {};
|
||||||
#ifdef HAVE_THREADS
|
|
||||||
srb2::ThreadPool::Sema tp_sema;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
R_UpdatePlaneRipple(&ds);
|
R_UpdatePlaneRipple(&ds);
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
|
srb2::ThreadPool::Sema tp_sema;
|
||||||
srb2::g_main_threadpool->begin_sema();
|
srb2::g_main_threadpool->begin_sema();
|
||||||
#endif
|
#endif
|
||||||
for (i = 0; i < MAXVISPLANES; i++, pl++)
|
for (i = 0; i < MAXVISPLANES; i++, pl++)
|
||||||
@@ -753,6 +746,13 @@ void R_DrawSkyPlanes(void)
|
|||||||
visplane_t *pl;
|
visplane_t *pl;
|
||||||
INT32 i;
|
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
|
#ifdef HAVE_THREADS
|
||||||
srb2::ThreadPool::Sema tp_sema;
|
srb2::ThreadPool::Sema tp_sema;
|
||||||
srb2::g_main_threadpool->begin_sema();
|
srb2::g_main_threadpool->begin_sema();
|
||||||
@@ -781,16 +781,10 @@ static void R_DrawSkyPlane(visplane_t *pl, void(*colfunc2)(drawcolumndata_t*), b
|
|||||||
if (!(pl->minx <= pl->maxx))
|
if (!(pl->minx <= pl->maxx))
|
||||||
return;
|
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 = {};
|
drawcolumndata_t dc = {};
|
||||||
|
const INT32 texture = texturetranslation[skytexture];
|
||||||
|
|
||||||
// Reset column drawer function (note: couldn't we just call walldrawerfunc directly?)
|
// Reset column drawer function (note: couldn't we just call colfuncs[BASEDRAWFUNC] directly?)
|
||||||
// (that is, unless we'll need to switch drawers in future for some reason)
|
// (that is, unless we'll need to switch drawers in future for some reason)
|
||||||
R_SetColumnFunc(BASEDRAWFUNC);
|
R_SetColumnFunc(BASEDRAWFUNC);
|
||||||
|
|
||||||
@@ -807,16 +801,13 @@ static void R_DrawSkyPlane(visplane_t *pl, void(*colfunc2)(drawcolumndata_t*), b
|
|||||||
dc.colormap += COLORMAP_REMAPOFFSET;
|
dc.colormap += COLORMAP_REMAPOFFSET;
|
||||||
|
|
||||||
dc.texturemid = skytexturemid;
|
dc.texturemid = skytexturemid;
|
||||||
dc.texheight = textureheight[skytexture] >>FRACBITS;
|
dc.texheight = textureheight[texture] >>FRACBITS;
|
||||||
dc.sourcelength = dc.texheight;
|
dc.sourcelength = dc.texheight;
|
||||||
|
|
||||||
x = pl->minx;
|
x = pl->minx;
|
||||||
|
|
||||||
// Precache the texture so we don't corrupt the zoned heap off-main thread
|
// Precache the texture so we don't corrupt the zoned heap off-main thread
|
||||||
if (!texturecache[texturetranslation[skytexture]])
|
R_CheckTextureCache(texture);
|
||||||
{
|
|
||||||
R_GenerateTexture(texturetranslation[skytexture]);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
while (x <= pl->maxx)
|
while (x <= pl->maxx)
|
||||||
@@ -841,9 +832,7 @@ static void R_DrawSkyPlane(visplane_t *pl, void(*colfunc2)(drawcolumndata_t*), b
|
|||||||
|
|
||||||
dc.iscale = FixedMul(skyscale, FINECOSINE(xtoviewangle[x + i]>>ANGLETOFINESHIFT));
|
dc.iscale = FixedMul(skyscale, FINECOSINE(xtoviewangle[x + i]>>ANGLETOFINESHIFT));
|
||||||
dc.x = x + i;
|
dc.x = x + i;
|
||||||
dc.source =
|
dc.source = R_GetColumn(texture, -angle); // get negative of angle for each column to display sky correct way round! --Monster Iestyn 27/01/18
|
||||||
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);
|
colfunc2(&dc);
|
||||||
}
|
}
|
||||||
@@ -1167,7 +1156,7 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
|
|||||||
offset = (scry*vid.width) + scrx;
|
offset = (scry*vid.width) + scrx;
|
||||||
|
|
||||||
// No idea if this works
|
// No idea if this works
|
||||||
VID_BlitLinearScreen(renderscreen + offset,
|
VID_BlitLinearScreen(vid.screens[0] + offset,
|
||||||
vid.screens[1] + (top*vid.width), // intentionally not +offset
|
vid.screens[1] + (top*vid.width), // intentionally not +offset
|
||||||
viewwidth, bottom-top,
|
viewwidth, bottom-top,
|
||||||
vid.width, vid.width);
|
vid.width, vid.width);
|
||||||
|
|||||||
@@ -67,8 +67,6 @@ extern visplane_t *floorplane;
|
|||||||
extern visplane_t *ceilingplane;
|
extern visplane_t *ceilingplane;
|
||||||
|
|
||||||
// Visplane related.
|
// Visplane related.
|
||||||
extern INT16 *lastopening, *openings;
|
|
||||||
extern size_t maxopenings;
|
|
||||||
|
|
||||||
extern INT16 *floorclip, *ceilingclip;
|
extern INT16 *floorclip, *ceilingclip;
|
||||||
extern fixed_t *frontscale, *yslopetab;
|
extern fixed_t *frontscale, *yslopetab;
|
||||||
|
|||||||
+271
-210
@@ -26,7 +26,6 @@
|
|||||||
#include "p_local.h" // Camera...
|
#include "p_local.h" // Camera...
|
||||||
#include "p_setup.h"
|
#include "p_setup.h"
|
||||||
#include "p_slopes.h"
|
#include "p_slopes.h"
|
||||||
#include "console.h" // con_clipviewtop
|
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
|
|
||||||
#include "core/memory.h"
|
#include "core/memory.h"
|
||||||
@@ -78,9 +77,21 @@ static fixed_t topfrac, topstep;
|
|||||||
static fixed_t bottomfrac, bottomstep;
|
static fixed_t bottomfrac, bottomstep;
|
||||||
|
|
||||||
static lighttable_t **walllights;
|
static lighttable_t **walllights;
|
||||||
static INT16 *maskedtexturecol;
|
static fixed_t *maskedtexturecol;
|
||||||
static fixed_t *maskedtextureheight = NULL;
|
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
|
// R_RenderMaskedSegRange
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
@@ -140,7 +151,18 @@ static void R_Render2sidedMultiPatchColumn(drawcolumndata_t* dc, column_t *colum
|
|||||||
|
|
||||||
transnum_t R_GetLinedefTransTable(fixed_t alpha)
|
transnum_t R_GetLinedefTransTable(fixed_t alpha)
|
||||||
{
|
{
|
||||||
return static_cast<transnum_t>((20*(FRACUNIT - alpha - 1) + FRACUNIT) >> (FRACBITS+1));
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline boolean R_OverflowTest(drawcolumndata_t* dc)
|
static inline boolean R_OverflowTest(drawcolumndata_t* dc)
|
||||||
@@ -173,7 +195,7 @@ static void R_RenderMaskedSegLoop(drawcolumndata_t* dc, drawseg_t *drawseg, INT3
|
|||||||
|
|
||||||
ldef = curline->linedef;
|
ldef = curline->linedef;
|
||||||
|
|
||||||
range = std::max(drawseg->x2-drawseg->x1, 1);
|
range = std::max<INT32>(drawseg->x2-drawseg->x1, 1);
|
||||||
|
|
||||||
// Setup lighting based on the presence/lack-of 3D floors.
|
// Setup lighting based on the presence/lack-of 3D floors.
|
||||||
dc->numlights = 0;
|
dc->numlights = 0;
|
||||||
@@ -306,141 +328,137 @@ static void R_RenderMaskedSegLoop(drawcolumndata_t* dc, drawseg_t *drawseg, INT3
|
|||||||
else
|
else
|
||||||
dc->texturemid -= (textureheight[texnum])*times;
|
dc->texturemid -= (textureheight[texnum])*times;
|
||||||
|
|
||||||
const INT16 colnum = maskedtexturecol[dc->x];
|
// 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;
|
||||||
|
}
|
||||||
|
|
||||||
// calculate lighting
|
// calculate lighting
|
||||||
if (colnum != INT16_MAX)
|
if (dc->numlights)
|
||||||
{
|
{
|
||||||
// Check for overflows first
|
lighttable_t **xwalllights;
|
||||||
if (R_OverflowTest(dc))
|
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
// Eh, no, go away, don't waste our time
|
rlight = &dc->lightlist[k];
|
||||||
if (dc->numlights)
|
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
for (i = 0; i < dc->numlights; i++)
|
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 = &dc->lightlist[i];
|
||||||
rlight->height += rlight->heightstep;
|
rlight->height += rlight->heightstep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
spryscale += rw_scalestep;
|
colfunc_2s(dc, col);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dc->numlights)
|
windowtop = windowbottom + 1;
|
||||||
{
|
|
||||||
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();
|
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;
|
|
||||||
}
|
}
|
||||||
|
windowbottom = realbot;
|
||||||
|
if (windowtop < windowbottom)
|
||||||
|
colfunc_2s(dc, col);
|
||||||
|
|
||||||
// calculate lighting
|
spryscale += rw_scalestep;
|
||||||
pindex = FixedMul(spryscale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT;
|
continue;
|
||||||
|
|
||||||
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;
|
spryscale += rw_scalestep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -609,8 +627,6 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
|||||||
sector_t tempsec;
|
sector_t tempsec;
|
||||||
INT32 templight;
|
INT32 templight;
|
||||||
INT32 i, p;
|
INT32 i, p;
|
||||||
fixed_t bottombounds = viewheight << FRACBITS;
|
|
||||||
fixed_t topbounds = (con_clipviewtop - 1) << FRACBITS;
|
|
||||||
fixed_t offsetvalue = 0;
|
fixed_t offsetvalue = 0;
|
||||||
lightlist_t *light;
|
lightlist_t *light;
|
||||||
r_lightlist_t *rlight;
|
r_lightlist_t *rlight;
|
||||||
@@ -632,6 +648,7 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
|||||||
|
|
||||||
void (*colfunc_2s) (drawcolumndata_t* dc, column_t *);
|
void (*colfunc_2s) (drawcolumndata_t* dc, column_t *);
|
||||||
|
|
||||||
|
|
||||||
// Calculate light table.
|
// Calculate light table.
|
||||||
// Use different light tables
|
// Use different light tables
|
||||||
// for horizontal / vertical / diagonal. Diagonal?
|
// for horizontal / vertical / diagonal. Diagonal?
|
||||||
@@ -674,7 +691,7 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
|||||||
fog = true;
|
fog = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
range = std::max(drawseg->x2-drawseg->x1, 1);
|
range = std::max<INT32>(drawseg->x2-drawseg->x1, 1);
|
||||||
//SoM: Moved these up here so they are available for my lightlist calculations
|
//SoM: Moved these up here so they are available for my lightlist calculations
|
||||||
rw_scalestep = drawseg->scalestep;
|
rw_scalestep = drawseg->scalestep;
|
||||||
spryscale = drawseg->scale1 + (x1 - drawseg->x1)*rw_scalestep;
|
spryscale = drawseg->scale1 + (x1 - drawseg->x1)*rw_scalestep;
|
||||||
@@ -899,14 +916,11 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
|||||||
// draw the columns
|
// draw the columns
|
||||||
for (dc->x = x1; dc->x <= x2; dc->x++)
|
for (dc->x = x1; dc->x <= x2; dc->x++)
|
||||||
{
|
{
|
||||||
if (maskedtexturecol[dc->x] == INT16_MAX)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// skew FOF walls
|
// skew FOF walls
|
||||||
if (ffloortextureslide)
|
if (ffloortextureslide)
|
||||||
{
|
{
|
||||||
if (oldx != -1)
|
if (oldx != -1)
|
||||||
dc->texturemid += FixedMul(ffloortextureslide, (maskedtexturecol[oldx]-maskedtexturecol[dc->x])<<FRACBITS);
|
dc->texturemid += FixedMul(ffloortextureslide, (maskedtexturecol[oldx]-maskedtexturecol[dc->x]));
|
||||||
oldx = dc->x;
|
oldx = dc->x;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -919,7 +933,7 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
|||||||
bottom_frac += bottom_step;
|
bottom_frac += bottom_step;
|
||||||
|
|
||||||
// SoM: If column is out of range, why bother with it??
|
// SoM: If column is out of range, why bother with it??
|
||||||
if (windowbottom < topbounds || windowtop > bottombounds)
|
if (windowbottom < 0 || windowtop > (viewheight << FRACBITS))
|
||||||
{
|
{
|
||||||
if (dc->numlights)
|
if (dc->numlights)
|
||||||
{
|
{
|
||||||
@@ -936,9 +950,6 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get data for the column
|
|
||||||
col = (column_t *)((UINT8 *)R_GetColumn(texnum, maskedtexturecol[dc->x]) - 3);
|
|
||||||
|
|
||||||
if (!fog)
|
if (!fog)
|
||||||
{
|
{
|
||||||
dc->iscale = 0xffffffffu / (unsigned)spryscale;
|
dc->iscale = 0xffffffffu / (unsigned)spryscale;
|
||||||
@@ -949,6 +960,9 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
|||||||
R_SetColumnFunc(BASEDRAWFUNC);
|
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
|
// SoM: New code does not rely on R_DrawColumnShadowed which
|
||||||
// will (hopefully) put less strain on the stack.
|
// will (hopefully) put less strain on the stack.
|
||||||
if (dc->numlights)
|
if (dc->numlights)
|
||||||
@@ -1159,13 +1173,14 @@ 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)
|
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->yl = yl;
|
||||||
dc->yh = yh;
|
dc->yh = yh;
|
||||||
dc->texturemid = mid;
|
dc->texturemid = mid;
|
||||||
dc->source = R_GetColumn(texture, texturecolumn);
|
dc->source = R_GetColumn(texture, itexturecolumn);
|
||||||
dc->texheight = textureheight[texture] >> FRACBITS;
|
dc->texheight = textureheight[texture] >> FRACBITS;
|
||||||
dc->sourcelength = dc->texheight;
|
dc->sourcelength = dc->texheight;
|
||||||
//R_SetColumnFunc(colfunctype);
|
R_SetColumnFunc(colfunctype);
|
||||||
coldrawfunc_t* colfunccopy = colfunc;
|
coldrawfunc_t* colfunccopy = colfunc;
|
||||||
drawcolumndata_t dc_copy = *dc;
|
drawcolumndata_t dc_copy = *dc;
|
||||||
if (remap)
|
if (remap)
|
||||||
@@ -1191,13 +1206,21 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
|||||||
INT32 bottom;
|
INT32 bottom;
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
|
if (midtexture)
|
||||||
|
R_CheckTextureCache(midtexture);
|
||||||
|
if (toptexture)
|
||||||
|
R_CheckTextureCache(toptexture);
|
||||||
|
if (bottomtexture)
|
||||||
|
R_CheckTextureCache(bottomtexture);
|
||||||
|
|
||||||
// Loop over width
|
// Loop over width
|
||||||
for (; rw_x < rw_stopx; rw_x++)
|
for (; rw_x < rw_stopx; rw_x++)
|
||||||
{
|
{
|
||||||
// mark floor / ceiling areas
|
// mark floor / ceiling areas
|
||||||
yl = (topfrac+HEIGHTUNIT-1)>>HEIGHTBITS;
|
yl = (topfrac+HEIGHTUNIT-1)>>HEIGHTBITS;
|
||||||
|
yh = bottomfrac>>HEIGHTBITS;
|
||||||
|
|
||||||
// no space above wall?
|
// Mark ceiling
|
||||||
top = ceilingclip[rw_x]+1;
|
top = ceilingclip[rw_x]+1;
|
||||||
|
|
||||||
// no space above wall?
|
// no space above wall?
|
||||||
@@ -1214,10 +1237,10 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
yh = bottomfrac>>HEIGHTBITS;
|
// Mark floor
|
||||||
|
|
||||||
bottom = floorclip[rw_x]-1;
|
bottom = floorclip[rw_x]-1;
|
||||||
|
|
||||||
|
// no space below floor?
|
||||||
if (yh > bottom)
|
if (yh > bottom)
|
||||||
yh = bottom;
|
yh = bottom;
|
||||||
|
|
||||||
@@ -1346,7 +1369,7 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
|||||||
// calculate texture offset
|
// calculate texture offset
|
||||||
angle = (rw_centerangle + xtoviewangle[rw_x])>>ANGLETOFINESHIFT;
|
angle = (rw_centerangle + xtoviewangle[rw_x])>>ANGLETOFINESHIFT;
|
||||||
// Mask 4095 to guarantee this index is within bounds
|
// 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)
|
if (oldtexturecolumn != -1)
|
||||||
{
|
{
|
||||||
@@ -1357,8 +1380,6 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
|||||||
}
|
}
|
||||||
oldtexturecolumn = texturecolumn;
|
oldtexturecolumn = texturecolumn;
|
||||||
|
|
||||||
texturecolumn >>= FRACBITS;
|
|
||||||
|
|
||||||
// texturecolumn and lighting are independent of wall tiers
|
// texturecolumn and lighting are independent of wall tiers
|
||||||
if (segtextured)
|
if (segtextured)
|
||||||
{
|
{
|
||||||
@@ -1515,7 +1536,7 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
|||||||
if (maskedtexture || numthicksides)
|
if (maskedtexture || numthicksides)
|
||||||
{
|
{
|
||||||
// save texturecol for backdrawing of masked mid texture
|
// save texturecol for backdrawing of masked mid texture
|
||||||
maskedtexturecol[rw_x] = (INT16)texturecolumn;
|
maskedtexturecol[rw_x] = texturecolumn;
|
||||||
|
|
||||||
if (maskedtextureheight != NULL)
|
if (maskedtextureheight != NULL)
|
||||||
{
|
{
|
||||||
@@ -1561,7 +1582,7 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
|||||||
|
|
||||||
static void R_MarkSegBounds(void)
|
static void R_MarkSegBounds(void)
|
||||||
{
|
{
|
||||||
INT32 yl, yh;
|
INT32 yl, yh;
|
||||||
INT32 top, bottom;
|
INT32 top, bottom;
|
||||||
INT16 topclip, bottomclip;
|
INT16 topclip, bottomclip;
|
||||||
|
|
||||||
@@ -1570,8 +1591,9 @@ static void R_MarkSegBounds(void)
|
|||||||
{
|
{
|
||||||
// mark floor / ceiling areas
|
// mark floor / ceiling areas
|
||||||
yl = (topfrac+HEIGHTUNIT-1)>>HEIGHTBITS;
|
yl = (topfrac+HEIGHTUNIT-1)>>HEIGHTBITS;
|
||||||
|
yh = bottomfrac>>HEIGHTBITS;
|
||||||
|
|
||||||
// no space above wall?
|
// Mark ceiling
|
||||||
top = ceilingclip[rw_x]+1;
|
top = ceilingclip[rw_x]+1;
|
||||||
|
|
||||||
// no space above wall?
|
// no space above wall?
|
||||||
@@ -1588,10 +1610,10 @@ static void R_MarkSegBounds(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
yh = bottomfrac>>HEIGHTBITS;
|
// Mark floor
|
||||||
|
|
||||||
bottom = floorclip[rw_x]-1;
|
bottom = floorclip[rw_x]-1;
|
||||||
|
|
||||||
|
// no space below floor?
|
||||||
if (yh > bottom)
|
if (yh > bottom)
|
||||||
yh = bottom;
|
yh = bottom;
|
||||||
|
|
||||||
@@ -1616,12 +1638,6 @@ static void R_MarkSegBounds(void)
|
|||||||
if (markfloor) // no bottom wall
|
if (markfloor) // no bottom wall
|
||||||
floorclip[rw_x] = bottomclip;
|
floorclip[rw_x] = bottomclip;
|
||||||
|
|
||||||
if (floorclip[rw_x] <= ceilingclip[rw_x] + 1)
|
|
||||||
{
|
|
||||||
solidcol[rw_x] = 1;
|
|
||||||
didsolidcol = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
rw_scale += rw_scalestep;
|
rw_scale += rw_scalestep;
|
||||||
topfrac += topstep;
|
topfrac += topstep;
|
||||||
bottomfrac += bottomstep;
|
bottomfrac += bottomstep;
|
||||||
@@ -1663,15 +1679,87 @@ void R_AllocSegMemory(void)
|
|||||||
fixed_t *frontscale_p = frontscaletable;
|
fixed_t *frontscale_p = frontscaletable;
|
||||||
fixed_t *maskedheight_p = maskedheighttable;
|
fixed_t *maskedheight_p = maskedheighttable;
|
||||||
|
|
||||||
for (drawseg_t *ds = drawsegs; ds < lastseg; ds++)
|
for (drawseg_t *drawseg = drawsegs; drawseg < lastseg; drawseg++)
|
||||||
{
|
{
|
||||||
ds->frontscale = frontscale_p;
|
drawseg->frontscale = frontscale_p;
|
||||||
ds->maskedtextureheight = maskedheight_p;
|
drawseg->maskedtextureheight = maskedheight_p;
|
||||||
frontscale_p += viewwidth;
|
frontscale_p += viewwidth;
|
||||||
maskedheight_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
|
// R_StoreWallRange
|
||||||
// A wall segment will be drawn
|
// A wall segment will be drawn
|
||||||
@@ -1684,12 +1772,13 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||||||
angle_t distangle, offsetangle;
|
angle_t distangle, offsetangle;
|
||||||
boolean longboi;
|
boolean longboi;
|
||||||
INT32 lightnum;
|
INT32 lightnum;
|
||||||
INT32 i, p;
|
INT32 i = 0, p;
|
||||||
lightlist_t *light;
|
lightlist_t *light;
|
||||||
r_lightlist_t *rlight;
|
r_lightlist_t *rlight;
|
||||||
INT32 range;
|
INT32 range;
|
||||||
vertex_t segleft, segright;
|
vertex_t segleft, segright;
|
||||||
fixed_t ceilingfrontslide, floorfrontslide, ceilingbackslide, floorbackslide;
|
fixed_t ceilingfrontslide, floorfrontslide, ceilingbackslide, floorbackslide;
|
||||||
|
const INT32 twosidedmidtexture = R_GetTextureNum(curline->sidedef->midtexture);
|
||||||
drawcolumndata_t dc = {};
|
drawcolumndata_t dc = {};
|
||||||
|
|
||||||
maskedtextureheight = NULL;
|
maskedtextureheight = NULL;
|
||||||
@@ -1745,41 +1834,6 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||||||
ds_p->curline = curline;
|
ds_p->curline = curline;
|
||||||
rw_stopx = stop+1;
|
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
|
// calculate scale at both ends and step
|
||||||
ds_p->scale1 = rw_scale = R_ScaleFromGlobalAngle(viewangle + xtoviewangle[start]);
|
ds_p->scale1 = rw_scale = R_ScaleFromGlobalAngle(viewangle + xtoviewangle[start]);
|
||||||
|
|
||||||
@@ -1874,8 +1928,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||||||
|
|
||||||
numbackffloors = 0;
|
numbackffloors = 0;
|
||||||
|
|
||||||
for (i = 0; i < MAXFFLOORS; i++)
|
memset(ds_p->thicksides, 0, MAXFFLOORS * sizeof(*ds_p->thicksides));
|
||||||
ds_p->thicksides[i] = NULL;
|
|
||||||
|
|
||||||
if (numffloors)
|
if (numffloors)
|
||||||
{
|
{
|
||||||
@@ -2160,6 +2213,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||||||
rw_toptexturemid += sidedef->rowoffset;
|
rw_toptexturemid += sidedef->rowoffset;
|
||||||
rw_bottomtexturemid += sidedef->rowoffset;
|
rw_bottomtexturemid += sidedef->rowoffset;
|
||||||
|
|
||||||
|
R_AllocTextureColumnTables(rw_stopx - start);
|
||||||
|
|
||||||
// allocate space for masked texture tables
|
// allocate space for masked texture tables
|
||||||
if (frontsector && backsector && (frontsector->tag != backsector->tag) && (backsector->ffloors || frontsector->ffloors))
|
if (frontsector && backsector && (frontsector->tag != backsector->tag) && (backsector->ffloors || frontsector->ffloors))
|
||||||
{
|
{
|
||||||
@@ -2173,8 +2228,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||||||
|
|
||||||
maskedtexture = true;
|
maskedtexture = true;
|
||||||
|
|
||||||
ds_p->thicksidecol = maskedtexturecol = lastopening - rw_x;
|
ds_p->thicksidecol = maskedtexturecol = curtexturecolumntable - rw_x;
|
||||||
lastopening += rw_stopx - rw_x;
|
curtexturecolumntable += rw_stopx - rw_x;
|
||||||
|
|
||||||
lowcut = std::max(worldbottom, worldlow) + viewz;
|
lowcut = std::max(worldbottom, worldlow) + viewz;
|
||||||
highcut = std::min(worldtop, worldhigh) + viewz;
|
highcut = std::min(worldtop, worldhigh) + viewz;
|
||||||
@@ -2353,13 +2408,14 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||||||
ds_p->numthicksides = numthicksides = i;
|
ds_p->numthicksides = numthicksides = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sidedef->midtexture > 0 && sidedef->midtexture < numtextures)
|
if (twosidedmidtexture)
|
||||||
{
|
{
|
||||||
// masked midtexture
|
// masked midtexture
|
||||||
|
|
||||||
if (!ds_p->thicksidecol)
|
if (!ds_p->thicksidecol)
|
||||||
{
|
{
|
||||||
ds_p->maskedtexturecol = maskedtexturecol = lastopening - rw_x;
|
ds_p->maskedtexturecol = maskedtexturecol = curtexturecolumntable - rw_x;
|
||||||
lastopening += rw_stopx - rw_x;
|
curtexturecolumntable += rw_stopx - rw_x;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ds_p->maskedtexturecol = ds_p->thicksidecol;
|
ds_p->maskedtexturecol = ds_p->thicksidecol;
|
||||||
@@ -2939,18 +2995,23 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// save sprite clipping info
|
// save sprite clipping info
|
||||||
if (((ds_p->silhouette & SIL_TOP) || maskedtexture) && !ds_p->sprtopclip)
|
if (maskedtexture || (ds_p->silhouette & (SIL_TOP | SIL_BOTTOM)))
|
||||||
{
|
{
|
||||||
M_Memcpy(lastopening, ceilingclip+start, 2*(rw_stopx - start));
|
R_AllocClippingTables(rw_stopx - start);
|
||||||
ds_p->sprtopclip = lastopening - start;
|
|
||||||
lastopening += rw_stopx - start;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (((ds_p->silhouette & SIL_BOTTOM) || maskedtexture) && !ds_p->sprbottomclip)
|
if (((ds_p->silhouette & SIL_TOP) || maskedtexture) && !ds_p->sprtopclip)
|
||||||
{
|
{
|
||||||
M_Memcpy(lastopening, floorclip + start, 2*(rw_stopx-start));
|
M_Memcpy(lastopening, ceilingclip + start, 2*(rw_stopx - start));
|
||||||
ds_p->sprbottomclip = lastopening - start;
|
ds_p->sprtopclip = lastopening - start;
|
||||||
lastopening += rw_stopx - 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)
|
if (maskedtexture)
|
||||||
@@ -2958,13 +3019,13 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||||||
if (!(ds_p->silhouette & SIL_TOP))
|
if (!(ds_p->silhouette & SIL_TOP))
|
||||||
{
|
{
|
||||||
ds_p->silhouette |= SIL_TOP;
|
ds_p->silhouette |= SIL_TOP;
|
||||||
ds_p->tsilheight = (sidedef->midtexture > 0 && sidedef->midtexture < numtextures) ? INT32_MIN: INT32_MAX;
|
ds_p->tsilheight = (twosidedmidtexture) ? INT32_MIN : INT32_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(ds_p->silhouette & SIL_BOTTOM))
|
if (!(ds_p->silhouette & SIL_BOTTOM))
|
||||||
{
|
{
|
||||||
ds_p->silhouette |= SIL_BOTTOM;
|
ds_p->silhouette |= SIL_BOTTOM;
|
||||||
ds_p->bsilheight = (sidedef->midtexture > 0 && sidedef->midtexture < numtextures) ? INT32_MAX: INT32_MIN;
|
ds_p->bsilheight = (twosidedmidtexture) ? INT32_MAX : INT32_MIN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ extern "C" {
|
|||||||
void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2);
|
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_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pffloor);
|
||||||
void R_StoreWallRange(INT32 start, INT32 stop);
|
void R_StoreWallRange(INT32 start, INT32 stop);
|
||||||
|
void R_ClearSegTables(void);
|
||||||
|
|
||||||
void R_AllocSegMemory(void);
|
void R_AllocSegMemory(void);
|
||||||
|
|
||||||
|
|||||||
+13
-16
@@ -94,13 +94,6 @@ static drawseg_xrange_item_t *drawsegs_xrange;
|
|||||||
static size_t drawsegs_xrange_size = 0;
|
static size_t drawsegs_xrange_size = 0;
|
||||||
static INT32 drawsegs_xrange_count = 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,
|
// Sprite rotation 0 is facing the viewer,
|
||||||
// rotation 1 is one angle turn CLOCKWISE around the axis.
|
// rotation 1 is one angle turn CLOCKWISE around the axis.
|
||||||
@@ -312,7 +305,7 @@ boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, UINT16
|
|||||||
|
|
||||||
// store sprite info in lookup tables
|
// store sprite info in lookup tables
|
||||||
//FIXME : numspritelumps do not duplicate sprite replacements
|
//FIXME : numspritelumps do not duplicate sprite replacements
|
||||||
W_ReadLumpHeaderPwad(wadnum, l, &patch, (sizeof(INT16) *4), 0);
|
W_ReadLumpHeaderPwad(wadnum, l, &patch, PNG_HEADER_SIZE, 0);
|
||||||
spritecachedinfo[numspritelumps].width = (INT32)(SHORT(patch.width))<<FRACBITS;
|
spritecachedinfo[numspritelumps].width = (INT32)(SHORT(patch.width))<<FRACBITS;
|
||||||
spritecachedinfo[numspritelumps].offset = (INT32)(SHORT(patch.leftoffset))<<FRACBITS;
|
spritecachedinfo[numspritelumps].offset = (INT32)(SHORT(patch.leftoffset))<<FRACBITS;
|
||||||
spritecachedinfo[numspritelumps].topoffset = (INT32)(SHORT(patch.topoffset))<<FRACBITS;
|
spritecachedinfo[numspritelumps].topoffset = (INT32)(SHORT(patch.topoffset))<<FRACBITS;
|
||||||
@@ -2249,11 +2242,13 @@ static void R_CreateDrawNodes(maskcount_t* mask, drawnode_t* head, boolean temps
|
|||||||
}
|
}
|
||||||
ds->curline->polyseg->visplane = NULL;
|
ds->curline->polyseg->visplane = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds->maskedtexturecol)
|
if (ds->maskedtexturecol)
|
||||||
{
|
{
|
||||||
entry = R_CreateDrawNode(head);
|
entry = R_CreateDrawNode(head);
|
||||||
entry->seg = ds;
|
entry->seg = ds;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds->numffloorplanes)
|
if (ds->numffloorplanes)
|
||||||
{
|
{
|
||||||
for (i = 0; i < ds->numffloorplanes; i++)
|
for (i = 0; i < ds->numffloorplanes; i++)
|
||||||
@@ -2523,8 +2518,6 @@ void R_InitDrawNodes(void)
|
|||||||
// R_DrawSprite
|
// R_DrawSprite
|
||||||
//
|
//
|
||||||
//Fab : 26-04-98:
|
//Fab : 26-04-98:
|
||||||
// NOTE : uses con_clipviewtop, so that when console is on,
|
|
||||||
// don't draw the part of sprites hidden under the console
|
|
||||||
static void R_DrawSprite(vissprite_t *spr)
|
static void R_DrawSprite(vissprite_t *spr)
|
||||||
{
|
{
|
||||||
mfloorclip = spr->clipbot;
|
mfloorclip = spr->clipbot;
|
||||||
@@ -2808,6 +2801,11 @@ void R_ClipSprites(drawseg_t* dsstart, portal_t* portal)
|
|||||||
drawseg_t* ds;
|
drawseg_t* ds;
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
|
if (visspritecount - clippedvissprites <= 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// e6y
|
// e6y
|
||||||
// Reducing of cache misses in the following R_DrawSprite()
|
// Reducing of cache misses in the following R_DrawSprite()
|
||||||
// Makes sense for scenes with huge amount of drawsegs.
|
// Makes sense for scenes with huge amount of drawsegs.
|
||||||
@@ -2817,13 +2815,9 @@ void R_ClipSprites(drawseg_t* dsstart, portal_t* portal)
|
|||||||
drawsegs_xranges[i].count = 0;
|
drawsegs_xranges[i].count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (visspritecount - clippedvissprites <= 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (drawsegs_xrange_size < maxdrawsegs)
|
if (drawsegs_xrange_size < maxdrawsegs)
|
||||||
{
|
{
|
||||||
|
// haleyjd: fix reallocation to track 2x size
|
||||||
drawsegs_xrange_size = 2 * maxdrawsegs;
|
drawsegs_xrange_size = 2 * maxdrawsegs;
|
||||||
|
|
||||||
for (i = 0; i < DS_RANGES_COUNT; i++)
|
for (i = 0; i < DS_RANGES_COUNT; i++)
|
||||||
@@ -2863,6 +2857,9 @@ 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++)
|
for (; clippedvissprites < visspritecount; clippedvissprites++)
|
||||||
{
|
{
|
||||||
vissprite_t *spr = R_GetVisSprite(clippedvissprites);
|
vissprite_t *spr = R_GetVisSprite(clippedvissprites);
|
||||||
@@ -3028,7 +3025,7 @@ static void R_DrawMaskedList(drawnode_t* head)
|
|||||||
else if (r2->seg && r2->seg->maskedtexturecol != NULL)
|
else if (r2->seg && r2->seg->maskedtexturecol != NULL)
|
||||||
{
|
{
|
||||||
next = r2->prev;
|
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;
|
r2->seg->maskedtexturecol = NULL;
|
||||||
R_DoneWithNode(r2);
|
R_DoneWithNode(r2);
|
||||||
r2 = next;
|
r2 = next;
|
||||||
|
|||||||
+8
-5
@@ -23,10 +23,10 @@ extern "C" {
|
|||||||
|
|
||||||
// number of sprite lumps for spritewidth,offset,topoffset lookup tables
|
// number of sprite lumps for spritewidth,offset,topoffset lookup tables
|
||||||
// Fab: this is a hack : should allocate the lookup tables per sprite
|
// Fab: this is a hack : should allocate the lookup tables per sprite
|
||||||
#if defined(__x86_64__) || defined(__amd64__) || defined(__aarch64__) || defined(__arm64__) // only for 64bit (idk how else to proper check lmao)
|
#if __SIZEOF_POINTER__ < 8
|
||||||
#define MAXVISSPRITES 4096
|
|
||||||
#else
|
|
||||||
#define MAXVISSPRITES 2048 // added 2-2-98 was 128
|
#define MAXVISSPRITES 2048 // added 2-2-98 was 128
|
||||||
|
#else
|
||||||
|
#define MAXVISSPRITES 4096 // only for 64bit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define VISSPRITECHUNKBITS 6 // 2^6 = 64 sprites per chunk
|
#define VISSPRITECHUNKBITS 6 // 2^6 = 64 sprites per chunk
|
||||||
@@ -63,7 +63,10 @@ extern fixed_t windowtop;
|
|||||||
extern fixed_t windowbottom;
|
extern fixed_t windowbottom;
|
||||||
extern INT32 lengthcol;
|
extern INT32 lengthcol;
|
||||||
|
|
||||||
INT32 R_ThingLightLevel(mobj_t *thing);
|
FUNCINLINE static ATTRINLINE INT32 R_ThingLightLevel(mobj_t* thing)
|
||||||
|
{
|
||||||
|
return (INT32)thing->lightlevel;
|
||||||
|
}
|
||||||
fixed_t R_GetSpriteDirectionalLighting(angle_t angle);
|
fixed_t R_GetSpriteDirectionalLighting(angle_t angle);
|
||||||
|
|
||||||
fixed_t R_GetShadowZ(mobj_t *thing, pslope_t **shadowslope);
|
fixed_t R_GetShadowZ(mobj_t *thing, pslope_t **shadowslope);
|
||||||
@@ -83,7 +86,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
size_t drawsegs[2];
|
size_t drawsegs[2];
|
||||||
size_t vissprites[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;
|
sector_t* viewsector;
|
||||||
} maskcount_t;
|
} maskcount_t;
|
||||||
|
|
||||||
|
|||||||
+119
-77
@@ -80,11 +80,7 @@ consvar_t cv_accuratefps = {"fpssampling", "1", CV_SAVE, accuratefps_cons_t, NUL
|
|||||||
// SCREEN VARIABLES
|
// SCREEN VARIABLES
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
||||||
UINT8 *scr_borderpatch; // flat used to fill the reduced view borders set at ST_Init()
|
static void SCR_SetDrawFuncs(enum columncontext_e _columncontext)
|
||||||
|
|
||||||
// =========================================================================
|
|
||||||
|
|
||||||
static void SCR_SetDrawFuncs(void)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// setup the right draw routines
|
// setup the right draw routines
|
||||||
@@ -103,13 +99,27 @@ static void SCR_SetDrawFuncs(void)
|
|||||||
spanfuncs[SPANDRAWFUNC_FOG] = R_DrawFogSpan;
|
spanfuncs[SPANDRAWFUNC_FOG] = R_DrawFogSpan;
|
||||||
spanfuncs[SPANDRAWFUNC_TILTEDFOG] = R_DrawFogSpan_Tilted;
|
spanfuncs[SPANDRAWFUNC_TILTEDFOG] = R_DrawFogSpan_Tilted;
|
||||||
|
|
||||||
colfuncs[BASEDRAWFUNC] = R_DrawColumn;
|
if (_columncontext == COLUMNCONTEXT_FLUSH)
|
||||||
colfuncs[COLDRAWFUNC_FUZZY] = R_DrawTranslucentColumn;
|
{
|
||||||
colfuncs[COLDRAWFUNC_TRANS] = R_DrawTranslatedColumn;
|
colfuncs[BASEDRAWFUNC] = R_DrawColumnFlush;
|
||||||
colfuncs[COLDRAWFUNC_SHADOWED] = R_DrawColumnShadowed;
|
colfuncs[COLDRAWFUNC_FUZZY] = R_DrawTranslucentColumnFlush;
|
||||||
colfuncs[COLDRAWFUNC_TRANSTRANS] = R_DrawTranslatedTranslucentColumn;
|
colfuncs[COLDRAWFUNC_TRANS] = R_DrawTranslatedColumnFlush;
|
||||||
colfuncs[COLDRAWFUNC_TWOSMULTIPATCH] = R_Draw2sMultiPatchColumn;
|
colfuncs[COLDRAWFUNC_SHADOWED] = R_DrawColumnShadowedFlush;
|
||||||
colfuncs[COLDRAWFUNC_TWOSMULTIPATCHTRANS] = R_Draw2sMultiPatchTranslucentColumn;
|
colfuncs[COLDRAWFUNC_TRANSTRANS] = R_DrawTranslatedTranslucentColumnFlush;
|
||||||
|
colfuncs[COLDRAWFUNC_TWOSMULTIPATCH] = R_Draw2sMultiPatchColumnFlush;
|
||||||
|
colfuncs[COLDRAWFUNC_TWOSMULTIPATCHTRANS] = R_Draw2sMultiPatchTranslucentColumnFlush;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
colfuncs[BASEDRAWFUNC] = R_DrawColumn;
|
||||||
|
colfuncs[COLDRAWFUNC_FUZZY] = R_DrawTranslucentColumn;
|
||||||
|
colfuncs[COLDRAWFUNC_TRANS] = R_DrawTranslatedColumn;
|
||||||
|
colfuncs[COLDRAWFUNC_SHADOWED] = R_DrawColumnShadowed;
|
||||||
|
colfuncs[COLDRAWFUNC_TRANSTRANS] = R_DrawTranslatedTranslucentColumn;
|
||||||
|
colfuncs[COLDRAWFUNC_TWOSMULTIPATCH] = R_Draw2sMultiPatchColumn;
|
||||||
|
colfuncs[COLDRAWFUNC_TWOSMULTIPATCHTRANS] = R_Draw2sMultiPatchTranslucentColumn;
|
||||||
|
}
|
||||||
|
|
||||||
colfuncs[COLDRAWFUNC_FOG] = R_DrawFogColumn;
|
colfuncs[COLDRAWFUNC_FOG] = R_DrawFogColumn;
|
||||||
|
|
||||||
R_SetColumnFunc(BASEDRAWFUNC);
|
R_SetColumnFunc(BASEDRAWFUNC);
|
||||||
@@ -131,12 +141,23 @@ void SCR_SetMode(void)
|
|||||||
|
|
||||||
V_SetPalette(0);
|
V_SetPalette(0);
|
||||||
|
|
||||||
SCR_SetDrawFuncs();
|
SCR_SetDrawFuncs(COLUMNCONTEXT_DIRECT);
|
||||||
|
|
||||||
// set the apprpriate drawer for the sky (tall or INT16)
|
// set the apprpriate drawer for the sky (tall or INT16)
|
||||||
setmodeneeded = 0;
|
setmodeneeded = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// used to switch between column buffering and drawing them directly to screen
|
||||||
|
// our sky "plane" drawer cannot handle the buffer system due to multithreading
|
||||||
|
// (that would require alot of extra complexity for smth with massive diminishing results)
|
||||||
|
// Our masked drawing step draws things in a very particular order, which results in alot of flushing to screen
|
||||||
|
// effectively adding massive overhead due to excessive flushing, so we draw our masked thing directly to screen instead
|
||||||
|
void R_SetColumnContext(enum columncontext_e _columncontext)
|
||||||
|
{
|
||||||
|
columncontext = _columncontext;
|
||||||
|
SCR_SetDrawFuncs(_columncontext); // set our column drawers
|
||||||
|
}
|
||||||
|
|
||||||
void R_SetColumnFunc(size_t id)
|
void R_SetColumnFunc(size_t id)
|
||||||
{
|
{
|
||||||
I_Assert(id < COLDRAWFUNC_MAX);
|
I_Assert(id < COLDRAWFUNC_MAX);
|
||||||
@@ -298,7 +319,6 @@ void SCR_SetDefaultMode(void)
|
|||||||
// Change fullscreen on/off according to cv_fullscreen
|
// Change fullscreen on/off according to cv_fullscreen
|
||||||
void SCR_ChangeFullscreen(void)
|
void SCR_ChangeFullscreen(void)
|
||||||
{
|
{
|
||||||
#ifdef DIRECTFULLSCREEN
|
|
||||||
I_SetBorderlessWindow(); // Running this here so we can have borderless window at startup
|
I_SetBorderlessWindow(); // Running this here so we can have borderless window at startup
|
||||||
|
|
||||||
// allow_fullscreen is set by VID_PrepareModeList
|
// allow_fullscreen is set by VID_PrepareModeList
|
||||||
@@ -311,8 +331,8 @@ void SCR_ChangeFullscreen(void)
|
|||||||
VID_PrepareModeList();
|
VID_PrepareModeList();
|
||||||
setmodeneeded = VID_GetModeForSize(vid.width, vid.height) + 1;
|
setmodeneeded = VID_GetModeForSize(vid.width, vid.height) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean SCR_IsAspectCorrect(INT32 width, INT32 height)
|
boolean SCR_IsAspectCorrect(INT32 width, INT32 height)
|
||||||
@@ -400,74 +420,97 @@ void SCR_CalculateFPS(void)
|
|||||||
#endif
|
#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)
|
void SCR_DisplayTicRate(void)
|
||||||
{
|
{
|
||||||
UINT32 cap = R_GetFramerateCap();
|
UINT32 cap, benchmark;
|
||||||
UINT32 benchmark = (cap == 0) ? I_GetRefreshRate() : cap;
|
double fps;
|
||||||
double fps = round(averageFPS);
|
INT32 fpsflags;
|
||||||
INT32 fpsflags = V_LocalTransFlag()|V_SNAPTOBOTTOM|V_SNAPTORIGHT;
|
|
||||||
|
|
||||||
if (gamestate == GS_NULL)
|
if (gamestate == GS_NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// new kart counter
|
cap = R_GetFramerateCap();
|
||||||
if (cv_ticrate.value == 1 || cv_ticrate.value == 2)
|
benchmark = (cap == 0) ? I_GetRefreshRate() : cap;
|
||||||
|
fps = round(averageFPS);
|
||||||
|
fpsflags = V_LocalTransFlag()|V_SNAPTOBOTTOM|V_SNAPTORIGHT;
|
||||||
|
|
||||||
|
switch (cv_ticrate.value)
|
||||||
{
|
{
|
||||||
const UINT8 *ticcntcolor = NULL;
|
case 1: // new kart counter
|
||||||
INT32 x = 318;
|
case 2:
|
||||||
|
SCR_DrawKartTicRate(cap, benchmark, fps, fpsflags);
|
||||||
// draw "FPS"
|
break;
|
||||||
if (cv_ticrate.value == 1)
|
case 3: // kart v1.0/srb2 counter
|
||||||
V_DrawFixedPatch(306<<FRACBITS, 183<<FRACBITS, FRACUNIT, fpsflags, framecounter, R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_YELLOW, GTC_CACHE));
|
case 4:
|
||||||
|
SCR_DrawOldTicRate(cap, benchmark, fps, fpsflags);
|
||||||
if (fps > (benchmark - 5))
|
break;
|
||||||
ticcntcolor = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_MINT, GTC_CACHE);
|
default:
|
||||||
else if (fps < 20)
|
break;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -482,7 +525,6 @@ 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
|
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
|
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
|
HU_drawPlayerPing(308, dispy, consoleplayer, pingflags); // consoleplayer's ping is everyone's ping in a splitnetgame :P
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-2
@@ -84,8 +84,6 @@ enum
|
|||||||
extern viddef_t vid;
|
extern viddef_t vid;
|
||||||
extern INT32 setmodeneeded; // mode number to set if needed, or 0
|
extern INT32 setmodeneeded; // mode number to set if needed, or 0
|
||||||
|
|
||||||
extern UINT8 *scr_borderpatch; // patch used to fill the view borders
|
|
||||||
|
|
||||||
extern consvar_t cv_scr_width, cv_scr_height, cv_renderview, cv_frameskip, cv_fullscreen, cv_vhseffect, cv_shittyscreen;
|
extern consvar_t cv_scr_width, cv_scr_height, cv_renderview, cv_frameskip, cv_fullscreen, cv_vhseffect, cv_shittyscreen;
|
||||||
extern consvar_t cv_parallelsoftware;
|
extern consvar_t cv_parallelsoftware;
|
||||||
extern consvar_t cv_paralleldrawmasked;
|
extern consvar_t cv_paralleldrawmasked;
|
||||||
@@ -96,6 +94,7 @@ extern consvar_t cv_vidwait;
|
|||||||
|
|
||||||
extern consvar_t cv_votebgscaling;
|
extern consvar_t cv_votebgscaling;
|
||||||
|
|
||||||
|
//void R_SetColumnContext(enum columncontext_e _columncontext); // declared in r_draw!
|
||||||
void R_SetColumnFunc(size_t id);
|
void R_SetColumnFunc(size_t id);
|
||||||
void R_SetSpanFunc(size_t id);
|
void R_SetSpanFunc(size_t id);
|
||||||
boolean R_CheckColumnFunc(size_t id);
|
boolean R_CheckColumnFunc(size_t id);
|
||||||
|
|||||||
+2
-2
@@ -45,7 +45,7 @@ MTL=midl.exe
|
|||||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
# ADD CPP /nologo /G5 /W3 /GX /Zi /Ot /Og /Oi /Op /Oy /Ob1 /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "NDEBUG" /D "SDLMAIN" /D "NO_STDIO_REDIRECT" /D "USE_WGL_SWAP" /D "DIRECTFULLSCREEN" /D "HAVE_SDL" /D "HWRENDER" /D "HAVE_FILTER" /D "HAVE_MIXER" /D "USEASM" /D "HAVE_PNG" /FR /FD /GF /c
|
# ADD CPP /nologo /G5 /W3 /GX /Zi /Ot /Og /Oi /Op /Oy /Ob1 /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "NDEBUG" /D "SDLMAIN" /D "NO_STDIO_REDIRECT" /D "USE_WGL_SWAP" /D "HAVE_SDL" /D "HWRENDER" /D "HAVE_FILTER" /D "HAVE_MIXER" /D "USEASM" /D "HAVE_PNG" /FR /FD /GF /c
|
||||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||||
# SUBTRACT RSC /x
|
# SUBTRACT RSC /x
|
||||||
@@ -72,7 +72,7 @@ LINK32=link.exe
|
|||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
MTL=midl.exe
|
MTL=midl.exe
|
||||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||||
# ADD CPP /nologo /G6 /W4 /WX /Gm /GX /ZI /Od /Op /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "_DEBUG" /D "USE_WGL_SWAP" /D "DIRECTFULLSCREEN" /D "HAVE_SDL" /D "HWRENDER" /D "HAVE_FILTER" /D "HAVE_MIXER" /D "USEASM" /D "HAVE_PNG" /FR /FD /GZ /c
|
# ADD CPP /nologo /G6 /W4 /WX /Gm /GX /ZI /Od /Op /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "_DEBUG" /D "USE_WGL_SWAP" /D "HAVE_SDL" /D "HWRENDER" /D "HAVE_FILTER" /D "HAVE_MIXER" /D "USEASM" /D "HAVE_PNG" /FR /FD /GZ /c
|
||||||
# SUBTRACT CPP /YX
|
# SUBTRACT CPP /YX
|
||||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<!-- x86/x64 defines: has specific libraries that ARM does not -->
|
<!-- x86/x64 defines: has specific libraries that ARM does not -->
|
||||||
<PreprocessorDefinitions Condition="'$(Platform)' == 'Win32' OR '$(Platform)' == 'x64'">HAVE_ZLIB;HAVE_LIBGME;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HAVE_FILTER;HAVE_MIXER;SDLMAIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Platform)' == 'Win32' OR '$(Platform)' == 'x64'">HAVE_ZLIB;HAVE_LIBGME;USE_WGL_SWAP;HAVE_SDL;HWRENDER;HAVE_FILTER;HAVE_MIXER;SDLMAIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<!-- ARM defines -->
|
<!-- ARM defines -->
|
||||||
<PreprocessorDefinitions Condition="'$(Platform)' != 'Win32' AND '$(Platform)' != 'x64'">USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HAVE_FILTER;HAVE_MIXER;SDLMAIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Platform)' != 'Win32' AND '$(Platform)' != 'x64'">USE_WGL_SWAP;HAVE_SDL;HWRENDER;HAVE_FILTER;HAVE_MIXER;SDLMAIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
|
|||||||
@@ -2021,7 +2021,7 @@ FUNCIERROR void ATTRNORETURN I_Error(const char *error, ...)
|
|||||||
if (errorcount > 20)
|
if (errorcount > 20)
|
||||||
{
|
{
|
||||||
va_start(argptr, error);
|
va_start(argptr, error);
|
||||||
vsprintf(buffer, error, argptr);
|
vsnprintf(buffer, 8192, error, argptr);
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
// Implement message box with SDL_ShowSimpleMessageBox,
|
// Implement message box with SDL_ShowSimpleMessageBox,
|
||||||
// which should fail gracefully if it can't put a message box up
|
// which should fail gracefully if it can't put a message box up
|
||||||
@@ -2039,7 +2039,7 @@ FUNCIERROR void ATTRNORETURN I_Error(const char *error, ...)
|
|||||||
|
|
||||||
// Display error message in the console before we start shutting it down
|
// Display error message in the console before we start shutting it down
|
||||||
va_start(argptr, error);
|
va_start(argptr, error);
|
||||||
vsprintf(buffer, error, argptr);
|
vsnprintf(buffer, 8192, error, argptr);
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
I_OutputMsg("\nI_Error(): %s\n", buffer);
|
I_OutputMsg("\nI_Error(): %s\n", buffer);
|
||||||
|
|
||||||
|
|||||||
@@ -219,10 +219,6 @@ void ST_UnloadGraphics(void)
|
|||||||
|
|
||||||
void ST_LoadGraphics(void)
|
void ST_LoadGraphics(void)
|
||||||
{
|
{
|
||||||
// SRB2 border patch
|
|
||||||
//st_borderpatchnum = W_GetNumForName("GFZFLR01");
|
|
||||||
//scr_borderpatch = W_CacheLumpNum(st_borderpatchnum, PU_HUDGFX);
|
|
||||||
|
|
||||||
// the original Doom uses 'STF' as base name for all face graphics
|
// the original Doom uses 'STF' as base name for all face graphics
|
||||||
// Graue 04-08-2004: face/name graphics are now indexed by skins
|
// Graue 04-08-2004: face/name graphics are now indexed by skins
|
||||||
// but load them in R_AddSkins, that gets called
|
// but load them in R_AddSkins, that gets called
|
||||||
|
|||||||
+1
-4
@@ -45,6 +45,7 @@
|
|||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
#include "fastcmp.h"
|
#include "fastcmp.h"
|
||||||
|
#include "console.h"
|
||||||
|
|
||||||
#include "g_game.h" // G_LoadGameData
|
#include "g_game.h" // G_LoadGameData
|
||||||
#include "d_main.h"
|
#include "d_main.h"
|
||||||
@@ -760,11 +761,7 @@ static UINT16 W_InitFileError(const char *filename, boolean exitworthy)
|
|||||||
{
|
{
|
||||||
if (exitworthy)
|
if (exitworthy)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
|
||||||
CONS_Error(va("%s was not found or not valid.\nCheck the log for more details.\n", filename));
|
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
|
else
|
||||||
CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), filename);
|
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;
|
DWORD bytesWritten;
|
||||||
|
|
||||||
va_start(arglist, lpFmt);
|
va_start(arglist, lpFmt);
|
||||||
vsprintf(str, lpFmt, arglist);
|
vsnprintf(str, 1999, lpFmt, arglist);
|
||||||
va_end(arglist);
|
va_end(arglist);
|
||||||
|
|
||||||
WriteFile(fileHandle, str, (DWORD)strlen(str), &bytesWritten, NULL);
|
WriteFile(fileHandle, str, (DWORD)strlen(str), &bytesWritten, NULL);
|
||||||
|
|||||||
Reference in new issue
Block a user