Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
00bc8bc149 | ||
|
|
f12b55f63b | ||
|
|
3e476d7658 |
No files matched your search
+42
-17
@@ -100,6 +100,10 @@ static int map_icon_request_count; // current count of icon requests sent
|
||||
static UINT8 *map_icon_data;
|
||||
static patch_t *map_icon;
|
||||
|
||||
// if true, signals the game to only load addons AND gamestate
|
||||
// instead of fully joining a server
|
||||
static boolean cl_addonsonly = false;
|
||||
|
||||
plrinfo playerinfo[MAXPLAYERS] = {};
|
||||
SINT8 joinnode = 0; // used for CL_VIEWSERVER
|
||||
|
||||
@@ -1438,6 +1442,7 @@ static void CL_DrawConnectionStatus(void)
|
||||
// Buttons
|
||||
V_DrawFill(8, BASEVIDHEIGHT - 14, BASEVIDWIDTH - 16, 12, 239);
|
||||
V_DrawThinString(16, BASEVIDHEIGHT - 12, V_ALLOWLOWERCASE, va("[%sESC%s] = Abort", "\x82", "\x80"));
|
||||
V_DrawCenteredThinString(BASEVIDWIDTH/2, BASEVIDHEIGHT - 12, V_ALLOWLOWERCASE, va("[%sSPACE%s] = Load Addons", "\x82", "\x80"));
|
||||
V_DrawRightAlignedThinString(BASEVIDWIDTH - 12, BASEVIDHEIGHT - 12, V_ALLOWLOWERCASE, va("[%sENTER%s] = Join", "\x82", "\x80"));
|
||||
}
|
||||
else if (filedownload.current != -1)
|
||||
@@ -2579,7 +2584,7 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
|
||||
return true;
|
||||
}
|
||||
|
||||
cl_mode = (cv_serverinfoscreen.value) ? CL_VIEWSERVER : CL_CHECKFILES;
|
||||
cl_mode = cv_serverinfoscreen.value ? CL_VIEWSERVER : CL_CHECKFILES;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2600,6 +2605,17 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void FreeMapIcon(void)
|
||||
{
|
||||
if (map_icon != NULL)
|
||||
Patch_Free(map_icon);
|
||||
map_icon = NULL;
|
||||
if (map_icon_data != NULL)
|
||||
Z_Free(map_icon_data);
|
||||
map_icon_data = NULL;
|
||||
map_icon_request_count = 0;
|
||||
}
|
||||
|
||||
/** Called by CL_ConnectToServer
|
||||
*
|
||||
* \param tmpsave The name of the gamestate file???
|
||||
@@ -2624,7 +2640,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
||||
|
||||
case CL_ASKFULLFILELIST:
|
||||
if (cl_lastcheckedfilecount == UINT16_MAX) // All files retrieved
|
||||
cl_mode = (cv_serverinfoscreen.value) ? CL_VIEWSERVER : CL_CHECKFILES;
|
||||
cl_mode = cv_serverinfoscreen.value ? CL_VIEWSERVER : CL_CHECKFILES;
|
||||
else if (fileneedednum != cl_lastcheckedfilecount || I_GetTime() >= *asksent)
|
||||
{
|
||||
if (CL_AskFileList(fileneedednum))
|
||||
@@ -2757,7 +2773,19 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
||||
{
|
||||
// Gamestate is now handled within CL_LoadReceivedSavegame()
|
||||
CL_LoadReceivedSavegame(false);
|
||||
cl_mode = CL_CONNECTED;
|
||||
|
||||
if (cl_addonsonly)
|
||||
{
|
||||
// close connection after savegame load
|
||||
// we want the actual server state
|
||||
// in case theres some stuff like records to be synched
|
||||
cl_mode = CL_ABORTED;
|
||||
}
|
||||
else
|
||||
{
|
||||
cl_mode = CL_CONNECTED;
|
||||
}
|
||||
|
||||
break;
|
||||
} // don't break case continue to CL_CONNECTED
|
||||
else
|
||||
@@ -2771,7 +2799,6 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
||||
case CL_ABORTED:
|
||||
cl_mode = CL_SEARCHING;
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
GetPackets();
|
||||
@@ -2793,24 +2820,21 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
||||
{
|
||||
if (key == KEY_ENTER || key == KEY_JOY1)
|
||||
{
|
||||
cl_addonsonly = false;
|
||||
cl_mode = CL_CHECKFILES;
|
||||
if (map_icon != NULL)
|
||||
Patch_Free(map_icon);
|
||||
map_icon = NULL;
|
||||
if (map_icon_data != NULL)
|
||||
Z_Free(map_icon_data);
|
||||
map_icon_data = NULL;
|
||||
FreeMapIcon();
|
||||
}
|
||||
else if (key == KEY_ESCAPE || key == KEY_JOY1+1)
|
||||
{
|
||||
cl_mode = CL_ABORTED;
|
||||
if (map_icon != NULL)
|
||||
Patch_Free(map_icon);
|
||||
map_icon = NULL;
|
||||
if (map_icon_data != NULL)
|
||||
Z_Free(map_icon_data);
|
||||
map_icon_data = NULL;
|
||||
map_icon_request_count = 0;
|
||||
cl_addonsonly = false;
|
||||
FreeMapIcon();
|
||||
}
|
||||
else if (key == KEY_SPACE || key == KEY_JOY1+2)
|
||||
{
|
||||
cl_addonsonly = true;
|
||||
cl_mode = CL_CHECKFILES;
|
||||
FreeMapIcon();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2819,6 +2843,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
||||
{
|
||||
CONS_Printf(M_GetText("Network game synchronization aborted.\n"));
|
||||
CL_AbortConnection();
|
||||
cl_addonsonly = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1009,9 +1009,6 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_gamepadled[i]);
|
||||
}
|
||||
|
||||
CV_RegisterVar(&cv_gamepadledifunfocused);
|
||||
CV_RegisterVar(&cv_rumbleifunfocused);
|
||||
|
||||
CV_RegisterVar(&cv_usemouse);
|
||||
CV_RegisterVar(&cv_invertmouse);
|
||||
CV_RegisterVar(&cv_mousexsens);
|
||||
|
||||
+4
-4
@@ -456,10 +456,10 @@ consvar_t cv_litesteer[MAXSPLITSCREENPLAYERS] = {
|
||||
|
||||
//static CV_PossibleValue_t autoaccelcons_t[] = {{0, "Off"}, {1, "Manual"}, {2, "Automatic"}, {0, NULL}};
|
||||
consvar_t cv_autoaccel[MAXSPLITSCREENPLAYERS] = {
|
||||
{"kartautoaccel", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"kartautoaccel2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"kartautoaccel3", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"kartautoaccel4", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
{"autoaccel", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"autoaccel2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"autoaccel3", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"autoaccel4", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
static CV_PossibleValue_t driftsparkpulse_t[] = {{0, "MIN"}, {FRACUNIT*3, "MAX"}, {0, NULL}};
|
||||
|
||||
+2
-5
@@ -81,9 +81,6 @@ consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS] = {
|
||||
{"gamepadled4", "Skincolor", CV_SAVE|CV_CALL|CV_NOINIT, gamepadled_cons_t, led_off_handle4, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_gamepadledifunfocused = {"gamepadledunfocused", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_rumbleifunfocused = {"rumbleifunfocused", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static void rumble_off_handle(void)
|
||||
{
|
||||
if (!cv_rumble[0].value)
|
||||
@@ -933,7 +930,7 @@ void G_SetPlayerGamepadIndicatorColor(INT32 playernum, UINT8 color)
|
||||
|
||||
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
|
||||
|
||||
if (cv_gamepadled[playernum].value == 0 || (window_notinfocus && cv_gamepadledifunfocused.value == 0)
|
||||
if (cv_gamepadled[playernum].value == 0
|
||||
|| color >= MAXTRANSLATIONS)
|
||||
{
|
||||
return;
|
||||
@@ -1012,7 +1009,7 @@ void G_PlayerDeviceRumble(INT32 playernum, UINT16 low_strength, UINT16 high_stre
|
||||
{
|
||||
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
|
||||
|
||||
if (cv_rumble[playernum].value == 0 || (window_notinfocus && cv_rumbleifunfocused.value == 0))
|
||||
if (cv_rumble[playernum].value == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -116,9 +116,6 @@ extern consvar_t cv_rumble[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_rumblestrength[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern consvar_t cv_gamepadledifunfocused;
|
||||
extern consvar_t cv_rumbleifunfocused;
|
||||
|
||||
extern INT32 mousex, mousey;
|
||||
|
||||
extern INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET];
|
||||
|
||||
@@ -335,7 +335,7 @@ angle_t gld_FrustumAngle(angle_t tiltangle)
|
||||
floatangle = 2.0 + (45.0 + ((double)tilt / 1.9)) * clipfov / 90.0;
|
||||
if (floatangle >= 180.0)
|
||||
return 0xffffffff;
|
||||
a1 = (angle_t)lrint(ANG1 * floatangle);
|
||||
a1 = (angle_t)xs_CRoundToInt(ANG1 * floatangle);
|
||||
return a1;
|
||||
}
|
||||
|
||||
|
||||
@@ -579,7 +579,7 @@ md2found:
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void HWR_AddPlayerMD2(INT32 skin, boolean local) // For MD2's that were added after startup
|
||||
void HWR_AddPlayerMD2(int skin, boolean local) // For MD2's that were added after startup
|
||||
{
|
||||
FILE *f;
|
||||
char name[20], filename[32];
|
||||
|
||||
+4
-11
@@ -1484,7 +1484,6 @@ static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
|
||||
x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return newstring;
|
||||
}
|
||||
|
||||
@@ -1523,7 +1522,7 @@ static void HU_drawMiniChat(void)
|
||||
emote_t *emote = NULL;
|
||||
int emotelen = 0;
|
||||
|
||||
while (msg[j]) // iterate through msg
|
||||
while(msg[j]) // iterate through msg
|
||||
{
|
||||
if (msg[j] < HU_FONTSTART) // don't draw
|
||||
{
|
||||
@@ -1555,17 +1554,14 @@ static void HU_drawMiniChat(void)
|
||||
{
|
||||
j++;
|
||||
}
|
||||
|
||||
prev_linereturn = false;
|
||||
dx += charwidth;
|
||||
|
||||
if (dx >= boxw)
|
||||
{
|
||||
dx = 0;
|
||||
linescount += 1;
|
||||
}
|
||||
}
|
||||
|
||||
dy = 0;
|
||||
dx = 0;
|
||||
msglines += linescount+1;
|
||||
@@ -1602,7 +1598,7 @@ static void HU_drawMiniChat(void)
|
||||
emote_t *emote = NULL;
|
||||
int emotelen = 0;
|
||||
|
||||
while (msg[j]) // iterate through msg
|
||||
while(msg[j]) // iterate through msg
|
||||
{
|
||||
if (msg[j] < HU_FONTSTART) // don't draw
|
||||
{
|
||||
@@ -1647,14 +1643,12 @@ static void HU_drawMiniChat(void)
|
||||
|
||||
dx += charwidth;
|
||||
prev_linereturn = false;
|
||||
|
||||
if (dx >= boxw)
|
||||
{
|
||||
dx = 0;
|
||||
dy += charheight;
|
||||
}
|
||||
}
|
||||
|
||||
dy += charheight;
|
||||
dx = 0;
|
||||
if (msg)
|
||||
@@ -1710,7 +1704,7 @@ static void HU_drawChatLog(INT32 offset)
|
||||
|
||||
V_DrawFillConsoleMap(chatx, chat_topy, boxw, boxh*charheight +2, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT); // log box
|
||||
|
||||
for (i = 0; i < chat_nummsg_log; i++) // iterate through our chatlog
|
||||
for (i=0; i<chat_nummsg_log; i++) // iterate through our chatlog
|
||||
{
|
||||
INT32 clrflag = 0;
|
||||
INT32 j = 0;
|
||||
@@ -1719,7 +1713,7 @@ static void HU_drawChatLog(INT32 offset)
|
||||
emote_t *emote = NULL;
|
||||
int emotelen = 0;
|
||||
|
||||
while (msg[j]) // iterate through msg
|
||||
while(msg[j]) // iterate through msg
|
||||
{
|
||||
if (msg[j] < HU_FONTSTART) // don't draw
|
||||
{
|
||||
@@ -1764,7 +1758,6 @@ static void HU_drawChatLog(INT32 offset)
|
||||
dy += charheight;
|
||||
}
|
||||
}
|
||||
|
||||
dy += charheight;
|
||||
dx = 0;
|
||||
if (msg)
|
||||
|
||||
+29
-9
@@ -20,7 +20,6 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include "doomtype.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
@@ -72,14 +71,6 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t DoubleToFixed(double f)
|
||||
#define FIXED_TO_FLOAT(x) FixedToFloat(x) // (((float)(x)) / ((float)FRACUNIT))
|
||||
#define FLOAT_TO_FIXED(f) FloatToFixed(f) // (fixed_t)((f) * ((float)FRACUNIT))
|
||||
|
||||
FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedClamp(INT64 val)
|
||||
{
|
||||
// stoopid includes
|
||||
#define FCLAMP(x, y, z) ((x) < (y) ? (y) : ((x) > (z) ? (z) : (x)))
|
||||
return (fixed_t)(FCLAMP(val, (INT64)INT32_MIN, (INT64)INT32_MAX));
|
||||
#undef FCLAMP
|
||||
}
|
||||
|
||||
/** \brief The FixedMul function
|
||||
|
||||
\param a fixed_t number
|
||||
@@ -274,6 +265,35 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedRound(fixed_t x)
|
||||
return INT32_MAX;
|
||||
}
|
||||
|
||||
/** \brief The xs_CRoundToInt function
|
||||
|
||||
\param val double number
|
||||
|
||||
\return Round toward nearest, but ties round toward even
|
||||
*/
|
||||
#if defined(SRB2_BIG_ENDIAN)
|
||||
#define _xs_iexp_ 0
|
||||
#define _xs_iman_ 1
|
||||
#else
|
||||
#define _xs_iexp_ 1 //intel is little endian
|
||||
#define _xs_iman_ 0
|
||||
#endif //BigEndian_
|
||||
|
||||
typedef double real64;
|
||||
|
||||
typedef union _xs_doubleints
|
||||
{
|
||||
real64 val;
|
||||
unsigned ival[2];
|
||||
} _xs_doubleints;
|
||||
|
||||
FUNCMATH FUNCINLINE static ATTRINLINE int xs_CRoundToInt(real64 val)
|
||||
{
|
||||
_xs_doubleints uval;
|
||||
uval.val = val + 6755399441055744.0;
|
||||
return uval.ival[_xs_iman_];
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fixed_t x;
|
||||
|
||||
+24
-14
@@ -186,8 +186,8 @@ static INT16 itemOn = 1; // menu item skull is on, Hack by Tails 09-18-2002
|
||||
static INT16 skullAnimCounter = 10; // skull animation counter
|
||||
static boolean interpTimerHackAllow = 0;
|
||||
|
||||
static UINT8 setupcontrolplayer;
|
||||
static INT32 (*setupcontrols)[2]; // pointer to the gamecontrols of the player being edited
|
||||
static UINT8 setupcontrolplayer;
|
||||
static INT32 (*setupcontrols)[2]; // pointer to the gamecontrols of the player being edited
|
||||
|
||||
// shhh... what am I doing... nooooo!
|
||||
static INT32 vidm_testingmode = 0;
|
||||
@@ -201,8 +201,8 @@ static char setupm_ip[64];
|
||||
static textinput_t setupm_input_ip;
|
||||
|
||||
|
||||
static fixed_t multi_tics;
|
||||
static state_t *multi_state;
|
||||
static fixed_t multi_tics;
|
||||
static state_t *multi_state;
|
||||
|
||||
// this is set before entering the MultiPlayer setup menu,
|
||||
// for either player 1 or 2
|
||||
@@ -1024,9 +1024,9 @@ boolean M_Responder(event_t *ev)
|
||||
//case KEY_JOY1 + 2:
|
||||
ch = KEY_ENTER;
|
||||
break;
|
||||
/*case KEY_JOY1 + 3: // Brake can function as 'n' for message boxes now.
|
||||
ch = 'n';
|
||||
break;*/
|
||||
/*case KEY_JOY1 + 3: // Brake can function as 'n' for message boxes now.
|
||||
ch = 'n';
|
||||
break;*/
|
||||
case KEY_MOUSE1 + 1:
|
||||
//case KEY_JOY1 + 1:
|
||||
ch = KEY_BACKSPACE;
|
||||
@@ -1305,12 +1305,21 @@ boolean M_Responder(event_t *ev)
|
||||
{
|
||||
playback_last_menu_interaction_leveltime = leveltime;
|
||||
// Flip left/right with up/down for the playback menu, since it's a horizontal icon row.
|
||||
|
||||
switch (ch)
|
||||
{
|
||||
case KEY_LEFTARROW: ch = KEY_UPARROW; break;
|
||||
case KEY_UPARROW: ch = KEY_RIGHTARROW; break;
|
||||
case KEY_RIGHTARROW: ch = KEY_DOWNARROW; break;
|
||||
case KEY_DOWNARROW: ch = KEY_LEFTARROW; break;
|
||||
case KEY_LEFTARROW:
|
||||
ch = KEY_UPARROW;
|
||||
break;
|
||||
case KEY_UPARROW:
|
||||
ch = KEY_RIGHTARROW;
|
||||
break;
|
||||
case KEY_RIGHTARROW:
|
||||
ch = KEY_DOWNARROW;
|
||||
break;
|
||||
case KEY_DOWNARROW:
|
||||
ch = KEY_LEFTARROW;
|
||||
break;
|
||||
|
||||
// arbitrary keyboard shortcuts because fuck you
|
||||
|
||||
@@ -1361,7 +1370,8 @@ boolean M_Responder(event_t *ev)
|
||||
G_AdjustView(4, 1, true);
|
||||
break;
|
||||
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1486,6 +1496,7 @@ boolean M_Responder(event_t *ev)
|
||||
}
|
||||
|
||||
return false;
|
||||
break;
|
||||
|
||||
default:
|
||||
CON_Responder(ev);
|
||||
@@ -4719,7 +4730,7 @@ static void M_DrawReplayHut(void)
|
||||
if (y > scaledviewheight-80)
|
||||
{
|
||||
V_DrawFill(BASEVIDWIDTH-4, 75, 4, scaledviewheight-80, V_SNAPTOTOP|V_SNAPTORIGHT|239);
|
||||
V_DrawFill(BASEVIDWIDTH-3, 76 + (scaledviewheight-80) * replayhutmenuy / y, 2, max((((scaledviewheight-80) * (scaledviewheight-80))-1) / y - 1, 1), V_SNAPTOTOP|V_SNAPTORIGHT|229);
|
||||
V_DrawFill(BASEVIDWIDTH-3, 76 + (scaledviewheight-80) * replayhutmenuy / y, 2, (((scaledviewheight-80) * (scaledviewheight-80))-1) / y - 1, V_SNAPTOTOP|V_SNAPTORIGHT|229);
|
||||
}
|
||||
|
||||
// Draw the cursor
|
||||
@@ -10046,7 +10057,6 @@ static void M_DrawVideoMode(void)
|
||||
va("Wait %d second%s", testtime, (testtime > 1) ? "s" : ""));
|
||||
M_CentreText(OP_VideoModeDef.y + 158,
|
||||
"or press ESC to return");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1205,10 +1205,6 @@ static menuitem_t OP_FocusOptionsMenu[] =
|
||||
{IT_STRING|IT_CVAR, NULL, "Show \"FOCUS LOST\"", &cv_showfocuslost, 100},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Visible Mouse", &cv_mousevisible, 120},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Gamepad LED Color While Unfocused ", &cv_gamepadledifunfocused, 140},
|
||||
{IT_STRING|IT_CVAR, NULL, "Gamepad Rumble While Unfocused", &cv_rumbleifunfocused, 150},
|
||||
|
||||
};
|
||||
|
||||
static const char* OP_FocusOptionsTooltips[] =
|
||||
@@ -1220,8 +1216,6 @@ static const char* OP_FocusOptionsTooltips[] =
|
||||
"Set manual framerate cap while the game is unfocused.",
|
||||
"Should the FOCUS LOST window appear\n while the game is unfocused?",
|
||||
"Displays the mouse cursor while the game is in focus.",
|
||||
"Should gamepad LED indicator change color when unfocused?",
|
||||
"Should gamepad rumble apply when unfocused?",
|
||||
};
|
||||
|
||||
static menuitem_t OP_DataOptionsMenu[] =
|
||||
|
||||
+2
-2
@@ -540,7 +540,7 @@ static boolean M_BackupConfig(const char *filename)
|
||||
void M_SaveConfig(const char *filename)
|
||||
{
|
||||
FILE *f;
|
||||
CLEANUP(Z_Pfree) char *filepath = NULL;
|
||||
char *filepath;
|
||||
|
||||
// make sure not to write back the config until it's been correctly loaded
|
||||
if (!loaded_config)
|
||||
@@ -558,7 +558,7 @@ void M_SaveConfig(const char *filename)
|
||||
// append srb2home to beginning of filename
|
||||
// but check if srb2home isn't already there, first
|
||||
if (!strstr(filename, srb2home))
|
||||
filepath = Z_StrDup(va(pandf, srb2home, filename));
|
||||
filepath = va(pandf,srb2home, filename);
|
||||
else
|
||||
filepath = Z_StrDup(filename);
|
||||
|
||||
|
||||
+6
-6
@@ -519,10 +519,10 @@ void R_GetRenderBlockMapDimensions(fixed_t drawdist, INT32 *xl, INT32 *xh, INT32
|
||||
const fixed_t vyright = viewy + FixedMul(drawdist, FSIN(right));
|
||||
|
||||
// Try to narrow the search to within only the field of view
|
||||
*xl = (unsigned)(FixedClamp((INT64)std::min(viewx, std::min(vxleft, vxright)) - bmaporgx))>>MAPBLOCKSHIFT;
|
||||
*xh = (unsigned)(FixedClamp((INT64)std::max(viewx, std::max(vxleft, vxright)) - bmaporgx))>>MAPBLOCKSHIFT;
|
||||
*yl = (unsigned)(FixedClamp((INT64)std::min(viewy, std::min(vyleft, vyright)) - bmaporgy))>>MAPBLOCKSHIFT;
|
||||
*yh = (unsigned)(FixedClamp((INT64)std::max(viewy, std::max(vyleft, vyright)) - bmaporgy))>>MAPBLOCKSHIFT;
|
||||
*xl = (unsigned)(std::min(viewx, std::min(vxleft, vxright)) - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
*xh = (unsigned)(std::max(viewx, std::max(vxleft, vxright)) - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
*yl = (unsigned)(std::min(viewy, std::min(vyleft, vyright)) - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
*yh = (unsigned)(std::max(viewy, std::max(vyleft, vyright)) - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
|
||||
if (*xh >= bmapwidth)
|
||||
*xh = bmapwidth - 1;
|
||||
@@ -1018,8 +1018,8 @@ static void R_InitViewMapping(void)
|
||||
|
||||
for (INT32 i = 0; i < j; i++)
|
||||
{
|
||||
fixed_t dy = abs(i - viewheight*8) << FRACBITS;
|
||||
dy = FixedMul(dy, fovtan);
|
||||
fixed_t dy = (i - viewheight*8)<<FRACBITS;
|
||||
dy = FixedMul(abs(dy), fovtan);
|
||||
yslopetab[i] = FixedDiv(centerx*FRACUNIT, dy);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -152,8 +152,8 @@ subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y);
|
||||
|
||||
FUNCMATH FUNCINLINE static ATTRINLINE fixed_t R_QuickDist(fixed_t x1, fixed_t y1, fixed_t x, fixed_t y)
|
||||
{
|
||||
const fixed_t absx = FixedClamp(labs((INT64)x - (INT64)x1));
|
||||
const fixed_t absy = FixedClamp(labs((INT64)y - (INT64)y1));
|
||||
const fixed_t absx = abs(x - x1);
|
||||
const fixed_t absy = abs(y - y1);
|
||||
#ifdef __cplusplus
|
||||
return std::max<fixed_t>(absx, absy);
|
||||
#else
|
||||
|
||||
+8
-11
@@ -57,11 +57,8 @@ visffloor_t visffloor[MAXFFLOORS] = {};
|
||||
INT32 numffloors = 0;
|
||||
|
||||
//SoM: 3/23/2000: Boom visplane hashing routine.
|
||||
constexpr unsigned int visplane_hash(const unsigned int picnum, const unsigned int lightlevel,
|
||||
const unsigned int height)
|
||||
{
|
||||
return ((picnum * 3) + lightlevel + (height * 7)) & VISPLANEHASHMASK;
|
||||
}
|
||||
#define visplane_hash(picnum,lightlevel,height) \
|
||||
((unsigned)((picnum)*3+(lightlevel)+(height)*7) & VISPLANEHASHMASK)
|
||||
|
||||
//
|
||||
// Clip values are the solid pixel bounding the range.
|
||||
@@ -139,7 +136,7 @@ void R_AllocPlaneMemory(void)
|
||||
}
|
||||
|
||||
yslopetab = static_cast<fixed_t*>(Z_Realloc(yslopetab, sizeof(*yslopetab) * (viewheight * 16), PU_STATIC, NULL));
|
||||
spanstart = static_cast<INT32*>(Z_Realloc(spanstart, sizeof(*spanstart) * viewheight, PU_STATIC, NULL));
|
||||
spanstart = static_cast<fixed_t*>(Z_Realloc(spanstart, sizeof(*spanstart) * viewheight, PU_STATIC, NULL));
|
||||
}
|
||||
|
||||
//
|
||||
@@ -228,8 +225,8 @@ static void R_MapPlane(drawspandata_t *ds, spandrawfunc_t *localspanfunc, INT32
|
||||
// to step from those to the proper texture coordinate to start drawing at.
|
||||
// That way, the texture coordinate is always calculated by its position
|
||||
// on the screen and not by its position relative to the edge of the visplane.
|
||||
ds->xfrac = FixedClamp((INT64)ds->xoffs + (INT64)FixedMul(planecos, distance) + ((INT64)x1 - (INT64)centerx) * (INT64)ds->xstep);
|
||||
ds->yfrac = FixedClamp((INT64)ds->yoffs - (INT64)FixedMul(planesin, distance) + ((INT64)x1 - (INT64)centerx) * (INT64)ds->ystep);
|
||||
ds->xfrac = ds->xoffs + FixedMul(planecos, distance) + (x1 - centerx) * ds->xstep;
|
||||
ds->yfrac = ds->yoffs - FixedMul(planesin, distance) + (x1 - centerx) * ds->ystep;
|
||||
|
||||
if (ds->planeripple.active)
|
||||
{
|
||||
@@ -454,7 +451,7 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
|
||||
}
|
||||
}
|
||||
|
||||
hash = visplane_hash(picnum, lightlevel, height >> FRACBITS);
|
||||
hash = visplane_hash(picnum, lightlevel, height);
|
||||
|
||||
for (check = visplanes[hash]; check; check = check->next)
|
||||
{
|
||||
@@ -565,7 +562,7 @@ visplane_t *R_CheckPlane(visplane_t *pl, INT32 start, INT32 stop)
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned hash = visplane_hash(pl->picnum, pl->lightlevel, pl->height >> FRACBITS);
|
||||
unsigned hash = visplane_hash(pl->picnum, pl->lightlevel, pl->height);
|
||||
new_pl = new_visplane(hash);
|
||||
}
|
||||
|
||||
@@ -1012,7 +1009,7 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
|
||||
levelflat_t *levelflat;
|
||||
void (*mapfunc)(drawspandata_t*, void(*)(drawspandata_t*), INT32, INT32, INT32, boolean) = R_MapPlane;
|
||||
|
||||
if (!(pl->minx <= pl->maxx))
|
||||
if (pl->minx > pl->maxx)
|
||||
return;
|
||||
|
||||
// sky flat
|
||||
|
||||
+2
-2
@@ -312,8 +312,8 @@ void Portal_AddSkybox(const visplane_t* plane)
|
||||
y = (viewy - skyboxmo[1]->y) * -mh->skybox_scaley;
|
||||
|
||||
// Apply transform to account for the skybox viewport angle.
|
||||
portal->viewx += FixedMul(x, FINECOSINE(ang)) - FixedMul(y, FINESINE(ang));
|
||||
portal->viewy += FixedMul(x, FINESINE(ang)) + FixedMul(y, FINECOSINE(ang));
|
||||
portal->viewx += FixedMul(x,FINECOSINE(ang)) - FixedMul(y, FINESINE(ang));
|
||||
portal->viewy += FixedMul(x, FINESINE(ang)) + FixedMul(y,FINECOSINE(ang));
|
||||
}
|
||||
|
||||
if (mh->skybox_scalez > 0)
|
||||
|
||||
+92
-81
@@ -226,11 +226,10 @@ static void R_RenderMaskedSegLoop(drawcolumndata_t* dc, drawseg_t *drawseg, INT3
|
||||
leftheight -= viewz;
|
||||
rightheight -= viewz;
|
||||
|
||||
rlight->height = FixedClamp((INT64)centeryfrac - FixedMul(leftheight, drawseg->scale1));
|
||||
rlight->heightstep = FixedClamp((INT64)centeryfrac - FixedMul(rightheight, drawseg->scale2));
|
||||
rlight->heightstep = FixedClamp((INT64)rlight->heightstep - rlight->height)/(range);
|
||||
rlight->startheight = rlight->height; // keep starting value here to reset for each repeat
|
||||
|
||||
rlight->height = (centeryfrac) - FixedMul(leftheight, drawseg->scale1);
|
||||
rlight->heightstep = (centeryfrac) - FixedMul(rightheight, drawseg->scale2);
|
||||
rlight->heightstep = (rlight->heightstep-rlight->height)/(range);
|
||||
rlight->startheight = rlight->height; // keep starting value here to reset for each repeat
|
||||
rlight->lightlevel = *light->lightlevel;
|
||||
rlight->extra_colormap = light->extra_colormap;
|
||||
rlight->flags = static_cast<ffloortype_e>(light->flags);
|
||||
@@ -342,7 +341,7 @@ static void R_RenderMaskedSegLoop(drawcolumndata_t* dc, drawseg_t *drawseg, INT3
|
||||
for (i = 0; i < dc->numlights; i++)
|
||||
{
|
||||
rlight = &dc->lightlist[i];
|
||||
rlight->height = FixedClamp((INT64)rlight->height + rlight->heightstep);
|
||||
rlight->height += rlight->heightstep;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -356,9 +355,9 @@ static void R_RenderMaskedSegLoop(drawcolumndata_t* dc, drawseg_t *drawseg, INT3
|
||||
lighttable_t **xwalllights;
|
||||
|
||||
sprbotscreen = INT32_MAX;
|
||||
sprtopscreen = windowtop = FixedClamp((INT64)centeryfrac - FixedMul(dc->texturemid, spryscale));
|
||||
sprtopscreen = windowtop = (centeryfrac - FixedMul(dc->texturemid, spryscale));
|
||||
|
||||
realbot = windowbottom = FixedClamp((INT64)FixedMul(textureheight[texnum], spryscale) + sprtopscreen);
|
||||
realbot = windowbottom = FixedMul(textureheight[texnum], spryscale) + sprtopscreen;
|
||||
dc->iscale = 0xffffffffu / (unsigned)spryscale;
|
||||
|
||||
// draw the texture
|
||||
@@ -408,8 +407,7 @@ static void R_RenderMaskedSegLoop(drawcolumndata_t* dc, drawseg_t *drawseg, INT3
|
||||
set_light_vars(i);
|
||||
|
||||
height = rlight->height;
|
||||
|
||||
rlight->height = FixedClamp((INT64)rlight->height + rlight->heightstep);
|
||||
rlight->height += rlight->heightstep;
|
||||
|
||||
if (height <= windowtop)
|
||||
{
|
||||
@@ -425,7 +423,7 @@ static void R_RenderMaskedSegLoop(drawcolumndata_t* dc, drawseg_t *drawseg, INT3
|
||||
for (i++; i < dc->numlights; i++)
|
||||
{
|
||||
rlight = &dc->lightlist[i];
|
||||
rlight->height = FixedClamp((INT64)rlight->height + rlight->heightstep);
|
||||
rlight->height += rlight->heightstep;
|
||||
}
|
||||
|
||||
continue;
|
||||
@@ -457,7 +455,7 @@ static void R_RenderMaskedSegLoop(drawcolumndata_t* dc, drawseg_t *drawseg, INT3
|
||||
if (frontsector->extra_colormap)
|
||||
dc->colormap = frontsector->extra_colormap->colormap + (dc->colormap - colormaps);
|
||||
|
||||
sprtopscreen = FixedClamp((INT64)centeryfrac - FixedMul(dc->texturemid, spryscale));
|
||||
sprtopscreen = centeryfrac - FixedMul(dc->texturemid, spryscale);
|
||||
dc->iscale = 0xffffffffu / (unsigned)spryscale;
|
||||
|
||||
// draw the texture
|
||||
@@ -712,6 +710,17 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
rw_scalestep = drawseg->scalestep;
|
||||
spryscale = drawseg->scale1 + (x1 - drawseg->x1)*rw_scalestep;
|
||||
|
||||
#define CLAMPMAX INT32_MAX
|
||||
#define CLAMPMIN (-INT32_MAX) // This is not INT32_MIN on purpose! INT32_MIN makes the drawers freak out.
|
||||
auto overflow_clamp = [&](INT64 overflow_test)
|
||||
{
|
||||
return (overflow_test > (INT64)CLAMPMAX) ? CLAMPMAX :
|
||||
(overflow_test > (INT64)CLAMPMIN) ? (fixed_t)overflow_test :
|
||||
CLAMPMIN;
|
||||
};
|
||||
#undef CLAMPMAX
|
||||
#undef CLAMPMIN
|
||||
|
||||
dc->numlights = 0;
|
||||
if (frontsector->numlights)
|
||||
{
|
||||
@@ -727,6 +736,7 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
{
|
||||
fixed_t leftheight, rightheight;
|
||||
fixed_t pfloorleft, pfloorright;
|
||||
INT64 overflow_test;
|
||||
light = &frontsector->lightlist[i];
|
||||
rlight = &dc->lightlist[p];
|
||||
|
||||
@@ -750,14 +760,17 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
continue;
|
||||
}
|
||||
|
||||
leftheight -= viewz;
|
||||
leftheight -= viewz;
|
||||
rightheight -= viewz;
|
||||
|
||||
// Monster Iestyn (25/03/18): do not skip these lights if they fail overflow test, just clamp them instead so they behave.
|
||||
rlight->height = FixedClamp((INT64)centeryfrac - (((INT64)leftheight * drawseg->scale1)>>FRACBITS));
|
||||
rlight->heightstep = FixedClamp((INT64)centeryfrac - (((INT64)rightheight * drawseg->scale2)>>FRACBITS));
|
||||
rlight->heightstep = FixedClamp((INT64)rlight->heightstep - rlight->height)/(range);
|
||||
overflow_test = (INT64)centeryfrac - (((INT64)leftheight*drawseg->scale1)>>FRACBITS);
|
||||
rlight->height = overflow_clamp(overflow_test);
|
||||
|
||||
overflow_test = (INT64)centeryfrac - (((INT64)rightheight*drawseg->scale2)>>FRACBITS);
|
||||
rlight->heightstep = overflow_clamp(overflow_test);
|
||||
|
||||
rlight->heightstep = (rlight->heightstep-rlight->height)/(range);
|
||||
rlight->flags = static_cast<ffloortype_e>(light->flags);
|
||||
|
||||
if (light->flags & FF_CUTLEVEL)
|
||||
@@ -768,9 +781,13 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
rightheight -= viewz;
|
||||
|
||||
// Monster Iestyn (25/03/18): do not skip these lights if they fail overflow test, just clamp them instead so they behave.
|
||||
rlight->botheight = FixedClamp((INT64)centeryfrac - (((INT64)leftheight*drawseg->scale1)>>FRACBITS));
|
||||
rlight->botheightstep = FixedClamp(((INT64)centeryfrac - (((INT64)rightheight*drawseg->scale2)>>FRACBITS)));
|
||||
rlight->botheightstep = FixedClamp((INT64)rlight->botheightstep - rlight->botheight)/(range);
|
||||
overflow_test = (INT64)centeryfrac - (((INT64)leftheight*drawseg->scale1)>>FRACBITS);
|
||||
rlight->botheight = overflow_clamp(overflow_test);
|
||||
|
||||
overflow_test = (INT64)centeryfrac - (((INT64)rightheight*drawseg->scale2)>>FRACBITS);
|
||||
rlight->botheightstep = overflow_clamp(overflow_test);
|
||||
|
||||
rlight->botheightstep = (rlight->botheightstep-rlight->botheight)/(range);
|
||||
}
|
||||
|
||||
rlight->lightlevel = *light->lightlevel;
|
||||
@@ -879,10 +896,10 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
right_bottom = P_GetFFloorBottomZAt(pfloor, drawseg->rightpos.x, drawseg->rightpos.y) - viewz;
|
||||
|
||||
// using INT64 to avoid 32bit overflow
|
||||
top_frac = FixedClamp((INT64)centeryfrac - (((INT64)left_top * drawseg->scale1) >> FRACBITS));
|
||||
top_step = FixedClamp((INT64)centeryfrac - (((INT64)right_top * drawseg->scale2) >> FRACBITS));
|
||||
bottom_frac = FixedClamp((INT64)centeryfrac - (((INT64)left_bottom * drawseg->scale1) >> FRACBITS));
|
||||
bottom_step = FixedClamp((INT64)centeryfrac - (((INT64)right_bottom * drawseg->scale2) >> FRACBITS));
|
||||
top_frac = (INT64)centeryfrac - (((INT64)left_top * drawseg->scale1) >> FRACBITS);
|
||||
bottom_frac = (INT64)centeryfrac - (((INT64)left_bottom * drawseg->scale1) >> FRACBITS);
|
||||
top_step = (INT64)centeryfrac - (((INT64)right_top * drawseg->scale2) >> FRACBITS);
|
||||
bottom_step = (INT64)centeryfrac - (((INT64)right_bottom * drawseg->scale2) >> FRACBITS);
|
||||
|
||||
top_step = (top_step-top_frac)/(range);
|
||||
bottom_step = (bottom_step-bottom_frac)/(range);
|
||||
@@ -904,8 +921,8 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
|
||||
// Calculate bounds
|
||||
// clamp the values if necessary to avoid overflows and rendering glitches caused by them
|
||||
sprtopscreen = windowtop = top_frac;
|
||||
sprbotscreen = windowbottom = bottom_frac;
|
||||
sprtopscreen = windowtop = overflow_clamp(top_frac);
|
||||
sprbotscreen = windowbottom = overflow_clamp(bottom_frac);
|
||||
|
||||
top_frac += top_step;
|
||||
bottom_frac += bottom_step;
|
||||
@@ -918,11 +935,9 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
for (i = 0; i < dc->numlights; i++)
|
||||
{
|
||||
rlight = &dc->lightlist[i];
|
||||
|
||||
rlight->height = FixedClamp((INT64)rlight->height + rlight->heightstep);
|
||||
|
||||
rlight->height += rlight->heightstep;
|
||||
if (rlight->flags & FF_CUTLEVEL)
|
||||
rlight->botheight = FixedClamp((INT64)rlight->botheight + rlight->botheightstep);
|
||||
rlight->botheight += rlight->botheightstep;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1030,12 +1045,12 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
solid = 0;
|
||||
|
||||
height = rlight->height;
|
||||
rlight->height = FixedClamp((INT64)rlight->height + rlight->heightstep);
|
||||
rlight->height += rlight->heightstep;
|
||||
|
||||
if (solid)
|
||||
{
|
||||
bheight = FixedClamp((INT64)rlight->botheight - (FRACUNIT >> 1));
|
||||
rlight->botheight = FixedClamp((INT64)rlight->botheight + rlight->botheightstep);
|
||||
bheight = rlight->botheight - (FRACUNIT >> 1);
|
||||
rlight->botheight += rlight->botheightstep;
|
||||
}
|
||||
|
||||
if (height <= windowtop)
|
||||
@@ -1063,7 +1078,7 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
for (i++; i < dc->numlights; i++)
|
||||
{
|
||||
rlight = &dc->lightlist[i];
|
||||
rlight->height = FixedClamp((INT64)rlight->height + rlight->heightstep);
|
||||
rlight->height += rlight->heightstep;
|
||||
|
||||
if (rlight->flags & FF_CUTLEVEL)
|
||||
rlight->botheight += rlight->botheightstep;
|
||||
@@ -1197,7 +1212,7 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
||||
for (; rw_x < rw_stopx; rw_x++)
|
||||
{
|
||||
// mark floor / ceiling areas
|
||||
yl = FixedClamp((INT64)topfrac + HEIGHTUNIT-1)>>HEIGHTBITS;
|
||||
yl = (topfrac+HEIGHTUNIT-1)>>HEIGHTBITS;
|
||||
yh = bottomfrac>>HEIGHTBITS;
|
||||
|
||||
// Mark ceiling
|
||||
@@ -1348,17 +1363,15 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
||||
//SoM: Calculate offsets for Thick fake floors.
|
||||
// calculate texture offset
|
||||
angle = (rw_centerangle + xtoviewangle[rw_x])>>ANGLETOFINESHIFT;
|
||||
|
||||
// Mask 4095 to guarantee this index is within bounds
|
||||
texturecolumn = FixedClamp((INT64)rw_offset - FixedMul(FINETANGENT(angle & 4095), rw_distance));
|
||||
texturecolumn = rw_offset-FixedMul(FINETANGENT(angle & 4095), rw_distance);
|
||||
|
||||
if (oldtexturecolumn != -1)
|
||||
{
|
||||
const fixed_t coloff = FixedClamp((INT64)oldtexturecolumn - texturecolumn);
|
||||
rw_bottomtexturemid += FixedMul(rw_bottomtextureslide, coloff);
|
||||
rw_midtexturemid += FixedMul(rw_midtextureslide, coloff);
|
||||
rw_toptexturemid += FixedMul(rw_toptextureslide, coloff);
|
||||
rw_midtextureback += FixedMul(rw_midtexturebackslide, coloff);
|
||||
rw_bottomtexturemid += FixedMul(rw_bottomtextureslide, oldtexturecolumn-texturecolumn);
|
||||
rw_midtexturemid += FixedMul(rw_midtextureslide, oldtexturecolumn-texturecolumn);
|
||||
rw_toptexturemid += FixedMul(rw_toptextureslide, oldtexturecolumn-texturecolumn);
|
||||
rw_midtextureback += FixedMul(rw_midtexturebackslide, oldtexturecolumn-texturecolumn);
|
||||
}
|
||||
oldtexturecolumn = texturecolumn;
|
||||
|
||||
@@ -1368,7 +1381,7 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
||||
// calculate lighting
|
||||
pindex = FixedMul(rw_scale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT;
|
||||
|
||||
if (pindex >= MAXLIGHTSCALE)
|
||||
if (pindex >= MAXLIGHTSCALE)
|
||||
pindex = MAXLIGHTSCALE-1;
|
||||
|
||||
dc->colormap = walllights[pindex];
|
||||
@@ -1450,8 +1463,8 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
||||
if (toptexture)
|
||||
{
|
||||
// top wall
|
||||
mid = pixhigh >> HEIGHTBITS;
|
||||
pixhigh = FixedClamp((INT64)pixhigh + pixhighstep);
|
||||
mid = pixhigh>>HEIGHTBITS;
|
||||
pixhigh += pixhighstep;
|
||||
|
||||
if (mid >= floorclip[rw_x])
|
||||
mid = floorclip[rw_x]-1;
|
||||
@@ -1480,8 +1493,8 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
||||
if (bottomtexture)
|
||||
{
|
||||
// bottom wall
|
||||
mid = FixedClamp((INT64)pixlow+HEIGHTUNIT-1)>>HEIGHTBITS;
|
||||
pixlow = FixedClamp((INT64)pixlow + pixlowstep);
|
||||
mid = (pixlow+HEIGHTUNIT-1)>>HEIGHTBITS;
|
||||
pixlow += pixlowstep;
|
||||
|
||||
// no space above wall?
|
||||
if (mid <= ceilingclip[rw_x])
|
||||
@@ -1532,10 +1545,10 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
||||
{
|
||||
for (i = 0; i < dc->numlights; i++)
|
||||
{
|
||||
dc->lightlist[i].height = FixedClamp((INT64)dc->lightlist[i].height + dc->lightlist[i].heightstep);
|
||||
dc->lightlist[i].height += dc->lightlist[i].heightstep;
|
||||
|
||||
if (dc->lightlist[i].flags & FF_CUTSOLIDS)
|
||||
dc->lightlist[i].botheight = FixedClamp((INT64)dc->lightlist[i].botheight + dc->lightlist[i].botheightstep);;
|
||||
dc->lightlist[i].botheight += dc->lightlist[i].botheightstep;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1556,10 +1569,9 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
||||
visffloor[i].b_frac += visffloor[i].b_step;
|
||||
}
|
||||
|
||||
rw_scale = FixedClamp((INT64)rw_scale + rw_scalestep);
|
||||
|
||||
topfrac = FixedClamp((INT64)topfrac + topstep);
|
||||
bottomfrac = FixedClamp((INT64)bottomfrac + bottomstep);
|
||||
rw_scale += rw_scalestep;
|
||||
topfrac += topstep;
|
||||
bottomfrac += bottomstep;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1573,7 +1585,7 @@ static void R_MarkSegBounds(void)
|
||||
for (; rw_x < rw_stopx; rw_x++)
|
||||
{
|
||||
// mark floor / ceiling areas
|
||||
yl = FixedClamp((INT64)topfrac + HEIGHTUNIT-1)>>HEIGHTBITS;
|
||||
yl = (topfrac+HEIGHTUNIT-1)>>HEIGHTBITS;
|
||||
yh = bottomfrac>>HEIGHTBITS;
|
||||
|
||||
// Mark ceiling
|
||||
@@ -1810,7 +1822,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
|
||||
// big room fix
|
||||
if (longboi)
|
||||
rw_distance = FixedClamp(R_CalcSegDist(curline, viewx, viewy));
|
||||
rw_distance = (fixed_t)R_CalcSegDist(curline,viewx,viewy);
|
||||
|
||||
ds_p->x1 = rw_x = start;
|
||||
ds_p->x2 = stop;
|
||||
@@ -2193,8 +2205,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
}
|
||||
}
|
||||
|
||||
rw_toptexturemid = FixedClamp((INT64)rw_toptexturemid + sidedef->rowoffset);
|
||||
rw_bottomtexturemid = FixedClamp((INT64)rw_bottomtexturemid + sidedef->rowoffset);
|
||||
rw_toptexturemid += sidedef->rowoffset;
|
||||
rw_bottomtexturemid += sidedef->rowoffset;
|
||||
|
||||
R_AllocTextureColumnTables(rw_stopx - start);
|
||||
|
||||
@@ -2479,9 +2491,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
rw_offset = -rw_offset;
|
||||
|
||||
/// don't use texture offset for splats
|
||||
rw_offset2 = FixedClamp((INT64)rw_offset + curline->offset);
|
||||
rw_offset = FixedClamp((INT64)rw_offset + (INT64)sidedef->textureoffset + curline->offset);
|
||||
|
||||
rw_offset2 = rw_offset + curline->offset;
|
||||
rw_offset += sidedef->textureoffset + curline->offset;
|
||||
rw_centerangle = ANGLE_90 + viewangle - rw_normalangle;
|
||||
|
||||
// calculate light table
|
||||
@@ -2541,8 +2552,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
|
||||
auto set_topstep_normal = [&]
|
||||
{
|
||||
topstep = -FixedMul(rw_scalestep, worldtop);
|
||||
topfrac = FixedClamp((INT64)(centeryfrac>>4) - FixedMul(worldtop, rw_scale));
|
||||
topstep = -FixedMul (rw_scalestep, worldtop);
|
||||
topfrac = (centeryfrac>>4) - FixedMul (worldtop, rw_scale);
|
||||
};
|
||||
|
||||
// untextured seg
|
||||
@@ -2563,14 +2574,14 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
// this is an attempt to fix issues with textureless single sided lines drawing nothing where they should just draw sky instead
|
||||
if (tophigh && !backsector && frontsector->ceilingpic == skyflatnum)
|
||||
{
|
||||
topstep = -FixedMul(rw_scalestep, worldbottom);
|
||||
topfrac = FixedClamp((INT64)(centeryfrac>>4) - FixedMul(worldbottom, rw_scale));
|
||||
topstep = -FixedMul (rw_scalestep, worldbottom);
|
||||
topfrac = (centeryfrac>>4) - FixedMul (worldbottom, rw_scale);
|
||||
|
||||
// account for slopes to try and get rid of sharp edges from the black void
|
||||
if (frontsector->f_slope || (backsector && backsector->f_slope))
|
||||
{
|
||||
topstep = -FixedMul(rw_scalestep, worldbottomslope);
|
||||
topfrac = FixedClamp((INT64)(centeryfrac>>4) - FixedMul(worldbottomslope, rw_scale));
|
||||
topstep = -FixedMul (rw_scalestep, worldbottomslope);
|
||||
topfrac = (centeryfrac>>4) - FixedMul (worldbottomslope, rw_scale);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2579,18 +2590,18 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
else
|
||||
set_topstep_normal();
|
||||
|
||||
bottomstep = -FixedMul(rw_scalestep, worldbottom);
|
||||
bottomfrac = FixedClamp((INT64)(centeryfrac>>4) - FixedMul(worldbottom, rw_scale));
|
||||
bottomstep = -FixedMul (rw_scalestep, worldbottom);
|
||||
bottomfrac = (centeryfrac>>4) - FixedMul (worldbottom, rw_scale);
|
||||
|
||||
if (frontsector->c_slope)
|
||||
{
|
||||
fixed_t topfracend = FixedClamp((INT64)(centeryfrac>>4) - FixedMul(worldtopslope, ds_p->scale2));
|
||||
fixed_t topfracend = (centeryfrac>>4) - FixedMul (worldtopslope, ds_p->scale2);
|
||||
topstep = (topfracend-topfrac)/(range);
|
||||
}
|
||||
|
||||
if (frontsector->f_slope)
|
||||
{
|
||||
fixed_t bottomfracend = FixedClamp((INT64)(centeryfrac>>4) - FixedMul(worldbottomslope, ds_p->scale2));
|
||||
fixed_t bottomfracend = (centeryfrac>>4) - FixedMul (worldbottomslope, ds_p->scale2);
|
||||
bottomstep = (bottomfracend-bottomfrac)/(range);
|
||||
}
|
||||
}
|
||||
@@ -2632,9 +2643,9 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
continue;
|
||||
}
|
||||
|
||||
rlight->height = FixedClamp((INT64)(centeryfrac>>4) - FixedMul(leftheight, rw_scale));
|
||||
rlight->heightstep = FixedClamp((INT64)(centeryfrac>>4) - FixedMul(rightheight, ds_p->scale2));
|
||||
rlight->heightstep = FixedClamp((INT64)rlight->heightstep - rlight->height)/(range);
|
||||
rlight->height = (centeryfrac>>4) - FixedMul(leftheight, rw_scale);
|
||||
rlight->heightstep = (centeryfrac>>4) - FixedMul(rightheight, ds_p->scale2);
|
||||
rlight->heightstep = (rlight->heightstep-rlight->height)/(range);
|
||||
rlight->flags = static_cast<ffloortype_e>(light->flags);
|
||||
|
||||
if (light->caster && light->caster->flags & FF_CUTSOLIDS)
|
||||
@@ -2696,9 +2707,9 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
|
||||
if (toptexture)
|
||||
{
|
||||
fixed_t topfracend = FixedClamp((INT64)(centeryfrac>>4) - FixedMul(worldhighslope, ds_p->scale2));
|
||||
fixed_t topfracend = (centeryfrac>>4) - FixedMul(worldhighslope, ds_p->scale2);
|
||||
|
||||
pixhigh = FixedClamp((INT64)(centeryfrac>>4) - FixedMul(worldhigh, rw_scale));
|
||||
pixhigh = (centeryfrac>>4) - FixedMul (worldhigh, rw_scale);
|
||||
pixhighstep = (topfracend-pixhigh)/(range);
|
||||
|
||||
// If the lowest part of a ceiling stretching down covers the entire screen
|
||||
@@ -2708,9 +2719,9 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
|
||||
if (bottomtexture)
|
||||
{
|
||||
fixed_t bottomfracend = FixedClamp((INT64)(centeryfrac>>4) - FixedMul(worldlowslope, ds_p->scale2));
|
||||
fixed_t bottomfracend = (centeryfrac>>4) - FixedMul (worldlowslope, ds_p->scale2);
|
||||
|
||||
pixlow = FixedClamp((INT64)(centeryfrac>>4) - FixedMul(worldlow, rw_scale));
|
||||
pixlow = (centeryfrac>>4) - FixedMul (worldlow, rw_scale);
|
||||
pixlowstep = (bottomfracend-pixlow)/(range);
|
||||
|
||||
// If the highest part of a floor stretching up covers the entire screen
|
||||
@@ -2731,8 +2742,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
visffloor[i].b_pos_slope = roverright;
|
||||
visffloor[i].b_pos >>= 4;
|
||||
visffloor[i].b_pos_slope >>= 4;
|
||||
visffloor[i].b_frac = FixedClamp((INT64)(centeryfrac>>4) - FixedMul(visffloor[i].b_pos, rw_scale));
|
||||
visffloor[i].b_step = FixedClamp((INT64)(centeryfrac>>4) - FixedMul(visffloor[i].b_pos_slope, ds_p->scale2));
|
||||
visffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(visffloor[i].b_pos, rw_scale);
|
||||
visffloor[i].b_step = (centeryfrac >> 4) - FixedMul(visffloor[i].b_pos_slope, ds_p->scale2);
|
||||
visffloor[i].b_step = (visffloor[i].b_step-visffloor[i].b_frac)/(range);
|
||||
};
|
||||
|
||||
@@ -2838,7 +2849,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
visffloor[i].b_pos = height;
|
||||
visffloor[i].b_pos = (visffloor[i].b_pos - viewz) >> 4;
|
||||
visffloor[i].b_step = FixedMul(-rw_scalestep, visffloor[i].b_pos);
|
||||
visffloor[i].b_frac = FixedClamp((INT64)(centeryfrac>>4) - FixedMul(visffloor[i].b_pos, rw_scale));
|
||||
visffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(visffloor[i].b_pos, rw_scale);
|
||||
};
|
||||
|
||||
while (i < numffloors && visffloor[i].polyobj != curline->polyseg)
|
||||
@@ -2869,7 +2880,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
if (markceiling)
|
||||
{
|
||||
if (ceilingplane) //SoM: 3/29/2000: Check for null ceiling planes
|
||||
ceilingplane = R_CheckPlane(ceilingplane, rw_x, rw_stopx-1);
|
||||
ceilingplane = R_CheckPlane (ceilingplane, rw_x, rw_stopx-1);
|
||||
else
|
||||
markceiling = false;
|
||||
|
||||
@@ -2883,7 +2894,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
if (markfloor)
|
||||
{
|
||||
if (floorplane) //SoM: 3/29/2000: Check for null planes
|
||||
floorplane = R_CheckPlane(floorplane, rw_x, rw_stopx-1);
|
||||
floorplane = R_CheckPlane (floorplane, rw_x, rw_stopx-1);
|
||||
else
|
||||
markfloor = false;
|
||||
|
||||
|
||||
+4
-6
@@ -11,7 +11,6 @@
|
||||
/// \file r_things.c
|
||||
/// \brief Refresh of things, i.e. objects represented by sprites
|
||||
|
||||
#include "m_fixed.h"
|
||||
#include "r_main.h" // stplyr
|
||||
#include "r_fps.h"
|
||||
#include "r_things.h"
|
||||
@@ -617,11 +616,10 @@ void R_DrawMaskedColumn(drawcolumndata_t* dc, column_t *column)
|
||||
if (topdelta <= prevdelta)
|
||||
topdelta += prevdelta;
|
||||
prevdelta = topdelta;
|
||||
topscreen = sprtopscreen + spryscale*topdelta;
|
||||
bottomscreen = topscreen + spryscale*column->length;
|
||||
|
||||
topscreen = FixedClamp((INT64)sprtopscreen + (INT64)spryscale * (INT64)topdelta);
|
||||
bottomscreen = FixedClamp((INT64)topscreen + (INT64)spryscale * (INT64)column->length);
|
||||
|
||||
dc->yl = FixedClamp((INT64)topscreen + (FRACUNIT-1))>>FRACBITS;
|
||||
dc->yl = (topscreen+FRACUNIT-1)>>FRACBITS;
|
||||
dc->yh = (bottomscreen-1)>>FRACBITS;
|
||||
|
||||
if (windowtop != INT32_MAX && windowbottom != INT32_MAX)
|
||||
@@ -887,7 +885,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||
for (dc.x = vis->x1; dc.x <= vis->x2; dc.x++, spryscale += scalestep)
|
||||
{
|
||||
angle_t angle = ((vis->centerangle + xtoviewangle[dc.x]) >> ANGLETOFINESHIFT) & 0xFFF;
|
||||
texturecolumn = FixedClamp((INT64)vis->paperoffset - FixedMul(FINETANGENT(angle), vis->paperdistance)) / horzscale;
|
||||
texturecolumn = (vis->paperoffset - FixedMul(FINETANGENT(angle), vis->paperdistance)) / horzscale;
|
||||
|
||||
if (texturecolumn < 0 || texturecolumn >= pwidth)
|
||||
continue;
|
||||
|
||||
Reference in new issue
Block a user