mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 04:41:23 +00:00
Merge branch 'next' into sw_largeroomfix
This commit is contained in:
commit
ffd5061531
32 changed files with 608 additions and 738 deletions
3
debian/rules
vendored
3
debian/rules
vendored
|
@ -59,6 +59,7 @@ DBGNAME = debug/$(EXENAME)
|
||||||
|
|
||||||
PKGDIR = usr/games/SRB2
|
PKGDIR = usr/games/SRB2
|
||||||
DBGDIR = usr/lib/debug/$(PKGDIR)
|
DBGDIR = usr/lib/debug/$(PKGDIR)
|
||||||
|
LINKDIR = usr/games
|
||||||
PIXMAPS_DIR = usr/share/pixmaps
|
PIXMAPS_DIR = usr/share/pixmaps
|
||||||
DESKTOP_DIR = usr/share/applications
|
DESKTOP_DIR = usr/share/applications
|
||||||
PREFIX = $(shell test "$(CROSS_COMPILE_BUILD)" != "$(CROSS_COMPILE_HOST)" && echo "PREFIX=$(CROSS_COMPILE_HOST)")
|
PREFIX = $(shell test "$(CROSS_COMPILE_BUILD)" != "$(CROSS_COMPILE_HOST)" && echo "PREFIX=$(CROSS_COMPILE_HOST)")
|
||||||
|
@ -133,7 +134,7 @@ binary-arch:
|
||||||
# dh_installcron
|
# dh_installcron
|
||||||
# dh_installinfo
|
# dh_installinfo
|
||||||
# dh_installman
|
# dh_installman
|
||||||
# dh_link
|
dh_link $(PKGDIR)/$(EXENAME) $(LINKDIR)/$(EXENAME)
|
||||||
dh_compress
|
dh_compress
|
||||||
dh_fixperms
|
dh_fixperms
|
||||||
# dh_perl
|
# dh_perl
|
||||||
|
|
348
src/am_map.c
348
src/am_map.c
|
@ -11,8 +11,8 @@
|
||||||
/// \file am_map.c
|
/// \file am_map.c
|
||||||
/// \brief Code for the 'automap', former Doom feature used for DEVMODE testing
|
/// \brief Code for the 'automap', former Doom feature used for DEVMODE testing
|
||||||
|
|
||||||
#include "g_game.h"
|
|
||||||
#include "am_map.h"
|
#include "am_map.h"
|
||||||
|
#include "g_game.h"
|
||||||
#include "g_input.h"
|
#include "g_input.h"
|
||||||
#include "p_local.h"
|
#include "p_local.h"
|
||||||
#include "p_slopes.h"
|
#include "p_slopes.h"
|
||||||
|
@ -33,7 +33,6 @@ static const UINT8 GRAYSRANGE = 16;
|
||||||
static const UINT8 BROWNS = (3*16);
|
static const UINT8 BROWNS = (3*16);
|
||||||
static const UINT8 YELLOWS = (7*16);
|
static const UINT8 YELLOWS = (7*16);
|
||||||
static const UINT8 GREENS = (10*16);
|
static const UINT8 GREENS = (10*16);
|
||||||
static const UINT8 GREENRANGE = 16;
|
|
||||||
static const UINT8 DBLACK = 31;
|
static const UINT8 DBLACK = 31;
|
||||||
static const UINT8 DWHITE = 0;
|
static const UINT8 DWHITE = 0;
|
||||||
|
|
||||||
|
@ -50,8 +49,6 @@ static const UINT8 NOCLIMBYELLOWS = (11*16);
|
||||||
|
|
||||||
// Automap colors
|
// Automap colors
|
||||||
#define BACKGROUND DBLACK
|
#define BACKGROUND DBLACK
|
||||||
#define YOURCOLORS DWHITE
|
|
||||||
#define YOURRANGE 0
|
|
||||||
#define WALLCOLORS (REDS + REDRANGE/2)
|
#define WALLCOLORS (REDS + REDRANGE/2)
|
||||||
#define WALLRANGE (REDRANGE/2)
|
#define WALLRANGE (REDRANGE/2)
|
||||||
#define NOCLIMBWALLCOLORS (NOCLIMBREDS + NOCLIMBREDRANGE/2)
|
#define NOCLIMBWALLCOLORS (NOCLIMBREDS + NOCLIMBREDRANGE/2)
|
||||||
|
@ -68,31 +65,23 @@ static const UINT8 NOCLIMBYELLOWS = (11*16);
|
||||||
#define CDWALLCOLORS YELLOWS
|
#define CDWALLCOLORS YELLOWS
|
||||||
#define NOCLIMBCDWALLCOLORS NOCLIMBYELLOWS
|
#define NOCLIMBCDWALLCOLORS NOCLIMBYELLOWS
|
||||||
#define THINGCOLORS GREENS
|
#define THINGCOLORS GREENS
|
||||||
#define THINGRANGE GREENRANGE
|
|
||||||
#define SECRETWALLCOLORS WALLCOLORS
|
|
||||||
#define SECRETWALLRANGE WALLRANGE
|
|
||||||
#define GRIDCOLORS (GRAYS + GRAYSRANGE/2)
|
#define GRIDCOLORS (GRAYS + GRAYSRANGE/2)
|
||||||
#define GRIDRANGE 0
|
|
||||||
#define XHAIRCOLORS GRAYS
|
#define XHAIRCOLORS GRAYS
|
||||||
|
|
||||||
// drawing stuff
|
// controls
|
||||||
#define FB 0
|
|
||||||
|
|
||||||
#define AM_PANDOWNKEY KEY_DOWNARROW
|
|
||||||
#define AM_PANUPKEY KEY_UPARROW
|
#define AM_PANUPKEY KEY_UPARROW
|
||||||
#define AM_PANRIGHTKEY KEY_RIGHTARROW
|
#define AM_PANDOWNKEY KEY_DOWNARROW
|
||||||
#define AM_PANLEFTKEY KEY_LEFTARROW
|
#define AM_PANLEFTKEY KEY_LEFTARROW
|
||||||
|
#define AM_PANRIGHTKEY KEY_RIGHTARROW
|
||||||
|
|
||||||
#define AM_ZOOMINKEY '='
|
#define AM_ZOOMINKEY '='
|
||||||
#define AM_ZOOMOUTKEY '-'
|
#define AM_ZOOMOUTKEY '-'
|
||||||
#define AM_STARTKEY KEY_TAB
|
|
||||||
#define AM_ENDKEY KEY_TAB
|
|
||||||
#define AM_GOBIGKEY '0'
|
#define AM_GOBIGKEY '0'
|
||||||
|
|
||||||
#define AM_FOLLOWKEY 'f'
|
#define AM_FOLLOWKEY 'f'
|
||||||
#define AM_GRIDKEY 'g'
|
#define AM_GRIDKEY 'g'
|
||||||
#define AM_MARKKEY 'm'
|
|
||||||
#define AM_CLEARMARKKEY 'c'
|
|
||||||
|
|
||||||
#define AM_NUMMARKPOINTS 10
|
#define AM_TOGGLEKEY KEY_TAB
|
||||||
|
|
||||||
// scale on entry
|
// scale on entry
|
||||||
#define INITSCALEMTOF (FRACUNIT/5)
|
#define INITSCALEMTOF (FRACUNIT/5)
|
||||||
|
@ -113,6 +102,9 @@ static const UINT8 NOCLIMBYELLOWS = (11*16);
|
||||||
#define CXMTOF(x) (f_x + MTOF((x)-m_x))
|
#define CXMTOF(x) (f_x + MTOF((x)-m_x))
|
||||||
#define CYMTOF(y) (f_y + (f_h - MTOF((y)-m_y)))
|
#define CYMTOF(y) (f_y + (f_h - MTOF((y)-m_y)))
|
||||||
|
|
||||||
|
#define MAPBITS (FRACBITS-4)
|
||||||
|
#define FRACTOMAPBITS (FRACBITS-MAPBITS)
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
fixed_t x, y;
|
fixed_t x, y;
|
||||||
|
@ -133,7 +125,10 @@ typedef struct
|
||||||
// A line drawing of the player pointing right,
|
// A line drawing of the player pointing right,
|
||||||
// starting from the middle.
|
// starting from the middle.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#define PLAYERRADIUS (16*(1<<MAPBITS))
|
||||||
#define R ((8*PLAYERRADIUS)/7)
|
#define R ((8*PLAYERRADIUS)/7)
|
||||||
|
|
||||||
static const mline_t player_arrow[] = {
|
static const mline_t player_arrow[] = {
|
||||||
{ { -R+R/8, 0 }, { R, 0 } }, // -----
|
{ { -R+R/8, 0 }, { R, 0 } }, // -----
|
||||||
{ { R, 0 }, { R-R/2, R/4 } }, // ----->
|
{ { R, 0 }, { R-R/2, R/4 } }, // ----->
|
||||||
|
@ -166,27 +161,15 @@ static const mline_t thintriangle_guy[] = {
|
||||||
#undef R
|
#undef R
|
||||||
#define NUMTHINTRIANGLEGUYLINES (sizeof (thintriangle_guy)/sizeof (mline_t))
|
#define NUMTHINTRIANGLEGUYLINES (sizeof (thintriangle_guy)/sizeof (mline_t))
|
||||||
|
|
||||||
static INT32 bigstate; //added : 24-01-98 : moved here, toggle between
|
static boolean bigstate; // user view and large view (full map view)
|
||||||
// user view and large view (full map view)
|
static boolean draw_grid = false;
|
||||||
|
|
||||||
static INT32 grid = 0;
|
|
||||||
|
|
||||||
static INT32 leveljuststarted = 1; // kluge until AM_LevelInit() is called
|
|
||||||
|
|
||||||
boolean automapactive = false;
|
boolean automapactive = false;
|
||||||
boolean am_recalc = false; //added : 05-02-98 : true when screen size changes
|
boolean am_recalc = false; //added : 05-02-98 : true when screen size changes
|
||||||
|
static boolean am_stopped = true;
|
||||||
|
|
||||||
// location of window on screen
|
static INT32 f_x, f_y; // location of window on screen (always zero for both)
|
||||||
static INT32 f_x;
|
static INT32 f_w, f_h; // size of window on screen (always the screen width and height respectively)
|
||||||
static INT32 f_y;
|
|
||||||
|
|
||||||
// size of window on screen
|
|
||||||
static INT32 f_w;
|
|
||||||
static INT32 f_h;
|
|
||||||
|
|
||||||
static INT32 lightlev; // used for funky strobing effect
|
|
||||||
static UINT8 *fb; // pseudo-frame buffer
|
|
||||||
static INT32 amclock;
|
|
||||||
|
|
||||||
static mpoint_t m_paninc; // how far the window pans each tic (map coords)
|
static mpoint_t m_paninc; // how far the window pans each tic (map coords)
|
||||||
static fixed_t mtof_zoommul; // how far the window zooms in each tic (map coords)
|
static fixed_t mtof_zoommul; // how far the window zooms in each tic (map coords)
|
||||||
|
@ -210,11 +193,6 @@ static fixed_t max_y;
|
||||||
static fixed_t max_w; // max_x-min_x,
|
static fixed_t max_w; // max_x-min_x,
|
||||||
static fixed_t max_h; // max_y-min_y
|
static fixed_t max_h; // max_y-min_y
|
||||||
|
|
||||||
// based on player size
|
|
||||||
static fixed_t min_w;
|
|
||||||
static fixed_t min_h;
|
|
||||||
|
|
||||||
|
|
||||||
static fixed_t min_scale_mtof; // used to tell when to stop zooming out
|
static fixed_t min_scale_mtof; // used to tell when to stop zooming out
|
||||||
static fixed_t max_scale_mtof; // used to tell when to stop zooming in
|
static fixed_t max_scale_mtof; // used to tell when to stop zooming in
|
||||||
|
|
||||||
|
@ -232,13 +210,7 @@ static fixed_t scale_ftom;
|
||||||
|
|
||||||
static player_t *plr; // the player represented by an arrow
|
static player_t *plr; // the player represented by an arrow
|
||||||
|
|
||||||
static patch_t *marknums[10]; // numbers used for marking by the automap
|
static INT32 followplayer = true; // specifies whether to follow the player around
|
||||||
static mpoint_t markpoints[AM_NUMMARKPOINTS]; // where the points are
|
|
||||||
static INT32 markpointnum = 0; // next point to be assigned
|
|
||||||
|
|
||||||
static INT32 followplayer = 1; // specifies whether to follow the player around
|
|
||||||
|
|
||||||
static boolean stopped = true;
|
|
||||||
|
|
||||||
// function for drawing lines, depends on rendermode
|
// function for drawing lines, depends on rendermode
|
||||||
typedef void (*AMDRAWFLINEFUNC) (const fline_t *fl, INT32 color);
|
typedef void (*AMDRAWFLINEFUNC) (const fline_t *fl, INT32 color);
|
||||||
|
@ -277,8 +249,8 @@ static inline void AM_restoreScaleAndLoc(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_x = plr->mo->x - m_w/2;
|
m_x = (plr->mo->x >> FRACTOMAPBITS) - m_w/2;
|
||||||
m_y = plr->mo->y - m_h/2;
|
m_y = (plr->mo->y >> FRACTOMAPBITS) - m_h/2;
|
||||||
}
|
}
|
||||||
m_x2 = m_x + m_w;
|
m_x2 = m_x + m_w;
|
||||||
m_y2 = m_y + m_h;
|
m_y2 = m_y + m_h;
|
||||||
|
@ -288,15 +260,6 @@ static inline void AM_restoreScaleAndLoc(void)
|
||||||
scale_ftom = FixedDiv(FRACUNIT, scale_mtof);
|
scale_ftom = FixedDiv(FRACUNIT, scale_mtof);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Adds a marker at the current location.
|
|
||||||
*/
|
|
||||||
static inline void AM_addMark(void)
|
|
||||||
{
|
|
||||||
markpoints[markpointnum].x = m_x + m_w/2;
|
|
||||||
markpoints[markpointnum].y = m_y + m_h/2;
|
|
||||||
markpointnum = (markpointnum + 1) % AM_NUMMARKPOINTS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Determines the bounding box around all vertices.
|
/** Determines the bounding box around all vertices.
|
||||||
* This is used to set global variables controlling the zoom range.
|
* This is used to set global variables controlling the zoom range.
|
||||||
*/
|
*/
|
||||||
|
@ -322,11 +285,8 @@ static void AM_findMinMaxBoundaries(void)
|
||||||
max_y = vertexes[i].y;
|
max_y = vertexes[i].y;
|
||||||
}
|
}
|
||||||
|
|
||||||
max_w = max_x - min_x;
|
max_w = (max_x >>= FRACTOMAPBITS) - (min_x >>= FRACTOMAPBITS);
|
||||||
max_h = max_y - min_y;
|
max_h = (max_y >>= FRACTOMAPBITS) - (min_y >>= FRACTOMAPBITS);
|
||||||
|
|
||||||
min_w = 2*PLAYERRADIUS; // const? never changed?
|
|
||||||
min_h = 2*PLAYERRADIUS;
|
|
||||||
|
|
||||||
a = FixedDiv(f_w<<FRACBITS, max_w);
|
a = FixedDiv(f_w<<FRACBITS, max_w);
|
||||||
b = FixedDiv(f_h<<FRACBITS, max_h);
|
b = FixedDiv(f_h<<FRACBITS, max_h);
|
||||||
|
@ -339,7 +299,7 @@ static void AM_changeWindowLoc(void)
|
||||||
{
|
{
|
||||||
if (m_paninc.x || m_paninc.y)
|
if (m_paninc.x || m_paninc.y)
|
||||||
{
|
{
|
||||||
followplayer = 0;
|
followplayer = false;
|
||||||
f_oldloc.x = INT32_MAX;
|
f_oldloc.x = INT32_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,11 +325,7 @@ static void AM_initVariables(void)
|
||||||
INT32 pnum;
|
INT32 pnum;
|
||||||
|
|
||||||
automapactive = true;
|
automapactive = true;
|
||||||
fb = screens[0];
|
|
||||||
|
|
||||||
f_oldloc.x = INT32_MAX;
|
f_oldloc.x = INT32_MAX;
|
||||||
amclock = 0;
|
|
||||||
lightlev = 0;
|
|
||||||
|
|
||||||
m_paninc.x = m_paninc.y = 0;
|
m_paninc.x = m_paninc.y = 0;
|
||||||
ftom_zoommul = FRACUNIT;
|
ftom_zoommul = FRACUNIT;
|
||||||
|
@ -385,8 +341,11 @@ static void AM_initVariables(void)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
plr = &players[pnum];
|
plr = &players[pnum];
|
||||||
m_x = plr->mo->x - m_w/2;
|
if (plr != NULL && plr->mo != NULL)
|
||||||
m_y = plr->mo->y - m_h/2;
|
{
|
||||||
|
m_x = (plr->mo->x >> FRACTOMAPBITS) - m_w/2;
|
||||||
|
m_y = (plr->mo->y >> FRACTOMAPBITS) - m_h/2;
|
||||||
|
}
|
||||||
AM_changeWindowLoc();
|
AM_changeWindowLoc();
|
||||||
|
|
||||||
// for saving & restoring
|
// for saving & restoring
|
||||||
|
@ -396,41 +355,21 @@ static void AM_initVariables(void)
|
||||||
old_m_h = m_h;
|
old_m_h = m_h;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const UINT8 *maplump; // pointer to the raw data for the automap background.
|
|
||||||
|
|
||||||
/** Clears all map markers.
|
|
||||||
*/
|
|
||||||
static void AM_clearMarks(void)
|
|
||||||
{
|
|
||||||
INT32 i;
|
|
||||||
|
|
||||||
for (i = 0; i < AM_NUMMARKPOINTS; i++)
|
|
||||||
markpoints[i].x = -1; // means empty
|
|
||||||
markpointnum = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// should be called at the start of every level
|
// should be called at the start of every level
|
||||||
// right now, i figure it out myself
|
// right now, i figure it out myself
|
||||||
//
|
//
|
||||||
static void AM_LevelInit(void)
|
static void AM_LevelInit(void)
|
||||||
{
|
{
|
||||||
leveljuststarted = 0;
|
|
||||||
|
|
||||||
f_x = f_y = 0;
|
f_x = f_y = 0;
|
||||||
f_w = vid.width;
|
f_w = vid.width;
|
||||||
f_h = vid.height;
|
f_h = vid.height;
|
||||||
|
|
||||||
if (rendermode == render_soft)
|
AM_drawFline = AM_drawFline_soft;
|
||||||
AM_drawFline = AM_drawFline_soft;
|
#ifdef HWRENDER
|
||||||
#ifdef HWRENDER // not win32 only 19990829 by Kin
|
if (rendermode == render_opengl)
|
||||||
else if (rendermode != render_none)
|
|
||||||
AM_drawFline = HWR_drawAMline;
|
AM_drawFline = HWR_drawAMline;
|
||||||
#endif
|
#endif
|
||||||
else
|
|
||||||
I_Error("Automap can't run without a render system");
|
|
||||||
|
|
||||||
AM_clearMarks();
|
|
||||||
|
|
||||||
AM_findMinMaxBoundaries();
|
AM_findMinMaxBoundaries();
|
||||||
scale_mtof = FixedDiv(min_scale_mtof*10, 7*FRACUNIT);
|
scale_mtof = FixedDiv(min_scale_mtof*10, 7*FRACUNIT);
|
||||||
|
@ -446,7 +385,7 @@ static void AM_LevelInit(void)
|
||||||
void AM_Stop(void)
|
void AM_Stop(void)
|
||||||
{
|
{
|
||||||
automapactive = false;
|
automapactive = false;
|
||||||
stopped = true;
|
am_stopped = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Enables automap.
|
/** Enables automap.
|
||||||
|
@ -457,15 +396,14 @@ static inline void AM_Start(void)
|
||||||
{
|
{
|
||||||
static INT32 lastlevel = -1;
|
static INT32 lastlevel = -1;
|
||||||
|
|
||||||
if (!stopped)
|
if (!am_stopped)
|
||||||
AM_Stop();
|
AM_Stop();
|
||||||
stopped = false;
|
am_stopped = false;
|
||||||
if (lastlevel != gamemap || am_recalc) // screen size changed
|
if (lastlevel != gamemap || am_recalc) // screen size changed
|
||||||
{
|
{
|
||||||
am_recalc = false;
|
|
||||||
|
|
||||||
AM_LevelInit();
|
AM_LevelInit();
|
||||||
lastlevel = gamemap;
|
lastlevel = gamemap;
|
||||||
|
am_recalc = false;
|
||||||
}
|
}
|
||||||
AM_initVariables();
|
AM_initVariables();
|
||||||
}
|
}
|
||||||
|
@ -503,7 +441,7 @@ boolean AM_Responder(event_t *ev)
|
||||||
{
|
{
|
||||||
if (!automapactive)
|
if (!automapactive)
|
||||||
{
|
{
|
||||||
if (ev->type == ev_keydown && ev->data1 == AM_STARTKEY)
|
if (ev->type == ev_keydown && ev->data1 == AM_TOGGLEKEY)
|
||||||
{
|
{
|
||||||
//faB: prevent alt-tab in win32 version to activate automap just before
|
//faB: prevent alt-tab in win32 version to activate automap just before
|
||||||
// minimizing the app; doesn't do any harm to the DOS version
|
// minimizing the app; doesn't do any harm to the DOS version
|
||||||
|
@ -515,10 +453,8 @@ boolean AM_Responder(event_t *ev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (ev->type == ev_keydown)
|
else if (ev->type == ev_keydown)
|
||||||
{
|
{
|
||||||
|
|
||||||
rc = true;
|
rc = true;
|
||||||
switch (ev->data1)
|
switch (ev->data1)
|
||||||
{
|
{
|
||||||
|
@ -554,7 +490,7 @@ boolean AM_Responder(event_t *ev)
|
||||||
mtof_zoommul = M_ZOOMIN;
|
mtof_zoommul = M_ZOOMIN;
|
||||||
ftom_zoommul = M_ZOOMOUT;
|
ftom_zoommul = M_ZOOMOUT;
|
||||||
break;
|
break;
|
||||||
case AM_ENDKEY:
|
case AM_TOGGLEKEY:
|
||||||
AM_Stop();
|
AM_Stop();
|
||||||
break;
|
break;
|
||||||
case AM_GOBIGKEY:
|
case AM_GOBIGKEY:
|
||||||
|
@ -572,13 +508,7 @@ boolean AM_Responder(event_t *ev)
|
||||||
f_oldloc.x = INT32_MAX;
|
f_oldloc.x = INT32_MAX;
|
||||||
break;
|
break;
|
||||||
case AM_GRIDKEY:
|
case AM_GRIDKEY:
|
||||||
grid = !grid;
|
draw_grid = !draw_grid;
|
||||||
break;
|
|
||||||
case AM_MARKKEY:
|
|
||||||
AM_addMark();
|
|
||||||
break;
|
|
||||||
case AM_CLEARMARKKEY:
|
|
||||||
AM_clearMarks();
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
rc = false;
|
rc = false;
|
||||||
|
@ -632,8 +562,8 @@ static inline void AM_doFollowPlayer(void)
|
||||||
{
|
{
|
||||||
if (f_oldloc.x != plr->mo->x || f_oldloc.y != plr->mo->y)
|
if (f_oldloc.x != plr->mo->x || f_oldloc.y != plr->mo->y)
|
||||||
{
|
{
|
||||||
m_x = FTOM(MTOF(plr->mo->x)) - m_w/2;
|
m_x = FTOM(MTOF(plr->mo->x >> FRACTOMAPBITS)) - m_w/2;
|
||||||
m_y = FTOM(MTOF(plr->mo->y)) - m_h/2;
|
m_y = FTOM(MTOF(plr->mo->y >> FRACTOMAPBITS)) - m_h/2;
|
||||||
m_x2 = m_x + m_w;
|
m_x2 = m_x + m_w;
|
||||||
m_y2 = m_y + m_h;
|
m_y2 = m_y + m_h;
|
||||||
f_oldloc.x = plr->mo->x;
|
f_oldloc.x = plr->mo->x;
|
||||||
|
@ -651,8 +581,6 @@ void AM_Ticker(void)
|
||||||
if (dedicated || !automapactive)
|
if (dedicated || !automapactive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
amclock++;
|
|
||||||
|
|
||||||
if (followplayer)
|
if (followplayer)
|
||||||
AM_doFollowPlayer();
|
AM_doFollowPlayer();
|
||||||
|
|
||||||
|
@ -671,72 +599,7 @@ void AM_Ticker(void)
|
||||||
*/
|
*/
|
||||||
static void AM_clearFB(INT32 color)
|
static void AM_clearFB(INT32 color)
|
||||||
{
|
{
|
||||||
#ifdef HWRENDER
|
V_DrawFill(f_x, f_y, f_w, f_h, color|V_NOSCALESTART);
|
||||||
if (rendermode != render_soft && rendermode != render_none)
|
|
||||||
{
|
|
||||||
HWR_clearAutomap();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!maplump)
|
|
||||||
memset(fb, color, f_w*f_h*vid.bpp);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
INT32 dmapx, dmapy, i, y;
|
|
||||||
static INT32 mapxstart, mapystart;
|
|
||||||
UINT8 *dest = screens[0];
|
|
||||||
const UINT8 *src;
|
|
||||||
#define MAPLUMPHEIGHT (200 - 42)
|
|
||||||
|
|
||||||
if (followplayer)
|
|
||||||
{
|
|
||||||
static vertex_t oldplr;
|
|
||||||
|
|
||||||
dmapx = MTOF(plr->mo->x) - MTOF(oldplr.x); //fixed point
|
|
||||||
dmapy = MTOF(oldplr.y) - MTOF(plr->mo->y);
|
|
||||||
|
|
||||||
oldplr.x = plr->mo->x;
|
|
||||||
oldplr.y = plr->mo->y;
|
|
||||||
mapxstart += dmapx>>1;
|
|
||||||
mapystart += dmapy>>1;
|
|
||||||
|
|
||||||
while (mapxstart >= BASEVIDWIDTH)
|
|
||||||
mapxstart -= BASEVIDWIDTH;
|
|
||||||
while (mapxstart < 0)
|
|
||||||
mapxstart += BASEVIDWIDTH;
|
|
||||||
while (mapystart >= MAPLUMPHEIGHT)
|
|
||||||
mapystart -= MAPLUMPHEIGHT;
|
|
||||||
while (mapystart < 0)
|
|
||||||
mapystart += MAPLUMPHEIGHT;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mapxstart += (MTOF(m_paninc.x)>>1);
|
|
||||||
mapystart -= (MTOF(m_paninc.y)>>1);
|
|
||||||
if (mapxstart >= BASEVIDWIDTH)
|
|
||||||
mapxstart -= BASEVIDWIDTH;
|
|
||||||
if (mapxstart < 0)
|
|
||||||
mapxstart += BASEVIDWIDTH;
|
|
||||||
if (mapystart >= MAPLUMPHEIGHT)
|
|
||||||
mapystart -= MAPLUMPHEIGHT;
|
|
||||||
if (mapystart < 0)
|
|
||||||
mapystart += MAPLUMPHEIGHT;
|
|
||||||
}
|
|
||||||
|
|
||||||
//blit the automap background to the screen.
|
|
||||||
for (y = 0; y < f_h; y++)
|
|
||||||
{
|
|
||||||
src = maplump + mapxstart + (y + mapystart)*BASEVIDWIDTH;
|
|
||||||
for (i = 0; i < BASEVIDWIDTH*vid.dupx; i++)
|
|
||||||
{
|
|
||||||
while (src > maplump + BASEVIDWIDTH*MAPLUMPHEIGHT)
|
|
||||||
src -= BASEVIDWIDTH*MAPLUMPHEIGHT;
|
|
||||||
*dest++ = *src++;
|
|
||||||
}
|
|
||||||
dest += vid.width - vid.dupx*BASEVIDWIDTH;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Performs automap clipping of lines.
|
/** Performs automap clipping of lines.
|
||||||
|
@ -871,7 +734,7 @@ static boolean AM_clipMline(const mline_t *ml, fline_t *fl)
|
||||||
//
|
//
|
||||||
static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
||||||
{
|
{
|
||||||
register INT32 x, y, dx, dy, sx, sy, ax, ay, d;
|
INT32 x, y, dx, dy, sx, sy, ax, ay, d;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
static INT32 num = 0;
|
static INT32 num = 0;
|
||||||
|
@ -887,7 +750,7 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PUTDOT(xx,yy,cc) fb[(yy)*f_w + (xx)]=(UINT8)(cc)
|
#define PUTDOT(xx,yy,cc) V_DrawFill(xx,yy,1,1,cc|V_NOSCALESTART);
|
||||||
|
|
||||||
dx = fl->b.x - fl->a.x;
|
dx = fl->b.x - fl->a.x;
|
||||||
ax = 2 * (dx < 0 ? -dx : dx);
|
ax = 2 * (dx < 0 ? -dx : dx);
|
||||||
|
@ -905,7 +768,7 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
||||||
d = ay - ax/2;
|
d = ay - ax/2;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
PUTDOT(x, y, color);
|
PUTDOT(x, y, color)
|
||||||
if (x == fl->b.x)
|
if (x == fl->b.x)
|
||||||
return;
|
return;
|
||||||
if (d >= 0)
|
if (d >= 0)
|
||||||
|
@ -922,7 +785,7 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
||||||
d = ax - ay/2;
|
d = ax - ay/2;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
PUTDOT(x, y, color);
|
PUTDOT(x, y, color)
|
||||||
if (y == fl->b.y)
|
if (y == fl->b.y)
|
||||||
return;
|
return;
|
||||||
if (d >= 0)
|
if (d >= 0)
|
||||||
|
@ -934,6 +797,8 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
||||||
d += ax;
|
d += ax;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef PUTDOT
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1004,15 +869,15 @@ static inline void AM_drawWalls(void)
|
||||||
|
|
||||||
for (i = 0; i < numlines; i++)
|
for (i = 0; i < numlines; i++)
|
||||||
{
|
{
|
||||||
l.a.x = lines[i].v1->x;
|
l.a.x = lines[i].v1->x >> FRACTOMAPBITS;
|
||||||
l.a.y = lines[i].v1->y;
|
l.a.y = lines[i].v1->y >> FRACTOMAPBITS;
|
||||||
l.b.x = lines[i].v2->x;
|
l.b.x = lines[i].v2->x >> FRACTOMAPBITS;
|
||||||
l.b.y = lines[i].v2->y;
|
l.b.y = lines[i].v2->y >> FRACTOMAPBITS;
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
|
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
|
||||||
if (slope) { \
|
if (slope) { \
|
||||||
end1 = P_GetZAt(slope, l.a.x, l.a.y); \
|
end1 = P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y); \
|
||||||
end2 = P_GetZAt(slope, l.b.x, l.b.y); \
|
end2 = P_GetZAt(slope, lines[i].v2->x, lines[i].v2->y); \
|
||||||
} else \
|
} else \
|
||||||
end1 = end2 = normalheight;
|
end1 = end2 = normalheight;
|
||||||
|
|
||||||
|
@ -1025,17 +890,12 @@ static inline void AM_drawWalls(void)
|
||||||
#undef SLOPEPARAMS
|
#undef SLOPEPARAMS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// AM_drawMline(&l, GRAYS + 3); // Old, everything-is-gray automap
|
|
||||||
if (!lines[i].backsector) // 1-sided
|
if (!lines[i].backsector) // 1-sided
|
||||||
{
|
{
|
||||||
if (lines[i].flags & ML_NOCLIMB)
|
if (lines[i].flags & ML_NOCLIMB)
|
||||||
{
|
AM_drawMline(&l, NOCLIMBWALLCOLORS);
|
||||||
AM_drawMline(&l, NOCLIMBWALLCOLORS+lightlev);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
AM_drawMline(&l, WALLCOLORS);
|
||||||
AM_drawMline(&l, WALLCOLORS+lightlev);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
else if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier
|
else if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier
|
||||||
|
@ -1052,24 +912,16 @@ static inline void AM_drawWalls(void)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (lines[i].flags & ML_NOCLIMB)
|
if (lines[i].flags & ML_NOCLIMB)
|
||||||
{
|
AM_drawMline(&l, NOCLIMBTSWALLCOLORS);
|
||||||
AM_drawMline(&l, NOCLIMBTSWALLCOLORS+lightlev);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
AM_drawMline(&l, TSWALLCOLORS);
|
||||||
AM_drawMline(&l, TSWALLCOLORS+lightlev);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (lines[i].flags & ML_NOCLIMB)
|
if (lines[i].flags & ML_NOCLIMB)
|
||||||
{
|
AM_drawMline(&l, NOCLIMBTHOKWALLCOLORS);
|
||||||
AM_drawMline(&l, NOCLIMBTHOKWALLCOLORS+lightlev);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
AM_drawMline(&l, THOKWALLCOLORS);
|
||||||
AM_drawMline(&l, THOKWALLCOLORS+lightlev);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1081,7 +933,7 @@ static inline void AM_drawWalls(void)
|
||||||
if (lines[i].backsector->floorheight
|
if (lines[i].backsector->floorheight
|
||||||
!= lines[i].frontsector->floorheight) {
|
!= lines[i].frontsector->floorheight) {
|
||||||
#endif
|
#endif
|
||||||
AM_drawMline(&l, NOCLIMBFDWALLCOLORS + lightlev); // floor level change
|
AM_drawMline(&l, NOCLIMBFDWALLCOLORS); // floor level change
|
||||||
}
|
}
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
else if (backc1 != frontc1 || backc2 != frontc2) {
|
else if (backc1 != frontc1 || backc2 != frontc2) {
|
||||||
|
@ -1089,11 +941,10 @@ static inline void AM_drawWalls(void)
|
||||||
else if (lines[i].backsector->ceilingheight
|
else if (lines[i].backsector->ceilingheight
|
||||||
!= lines[i].frontsector->ceilingheight) {
|
!= lines[i].frontsector->ceilingheight) {
|
||||||
#endif
|
#endif
|
||||||
AM_drawMline(&l, NOCLIMBCDWALLCOLORS+lightlev); // ceiling level change
|
AM_drawMline(&l, NOCLIMBCDWALLCOLORS); // ceiling level change
|
||||||
}
|
|
||||||
else {
|
|
||||||
AM_drawMline(&l, NOCLIMBTSWALLCOLORS+lightlev);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
AM_drawMline(&l, NOCLIMBTSWALLCOLORS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1103,7 +954,7 @@ static inline void AM_drawWalls(void)
|
||||||
if (lines[i].backsector->floorheight
|
if (lines[i].backsector->floorheight
|
||||||
!= lines[i].frontsector->floorheight) {
|
!= lines[i].frontsector->floorheight) {
|
||||||
#endif
|
#endif
|
||||||
AM_drawMline(&l, FDWALLCOLORS + lightlev); // floor level change
|
AM_drawMline(&l, FDWALLCOLORS); // floor level change
|
||||||
}
|
}
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
else if (backc1 != frontc1 || backc2 != frontc2) {
|
else if (backc1 != frontc1 || backc2 != frontc2) {
|
||||||
|
@ -1111,11 +962,10 @@ static inline void AM_drawWalls(void)
|
||||||
else if (lines[i].backsector->ceilingheight
|
else if (lines[i].backsector->ceilingheight
|
||||||
!= lines[i].frontsector->ceilingheight) {
|
!= lines[i].frontsector->ceilingheight) {
|
||||||
#endif
|
#endif
|
||||||
AM_drawMline(&l, CDWALLCOLORS+lightlev); // ceiling level change
|
AM_drawMline(&l, CDWALLCOLORS); // ceiling level change
|
||||||
}
|
|
||||||
else {
|
|
||||||
AM_drawMline(&l, TSWALLCOLORS+lightlev);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
AM_drawMline(&l, TSWALLCOLORS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1176,6 +1026,11 @@ static void AM_drawLineCharacter(const mline_t *lineguy, size_t lineguylines, fi
|
||||||
l.b.x += x;
|
l.b.x += x;
|
||||||
l.b.y += y;
|
l.b.y += y;
|
||||||
|
|
||||||
|
l.a.x >>= FRACTOMAPBITS;
|
||||||
|
l.a.y >>= FRACTOMAPBITS;
|
||||||
|
l.b.x >>= FRACTOMAPBITS;
|
||||||
|
l.b.y >>= FRACTOMAPBITS;
|
||||||
|
|
||||||
AM_drawMline(&l, color);
|
AM_drawMline(&l, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1184,83 +1039,51 @@ static inline void AM_drawPlayers(void)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
player_t *p;
|
player_t *p;
|
||||||
INT32 color;
|
INT32 color = GREENS;
|
||||||
|
|
||||||
if (!multiplayer)
|
if (!multiplayer)
|
||||||
{
|
{
|
||||||
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 0,
|
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 0, plr->mo->angle, DWHITE, plr->mo->x, plr->mo->y);
|
||||||
plr->mo->angle, DWHITE, plr->mo->x, plr->mo->y);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// multiplayer
|
// multiplayer (how??)
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
if (!playeringame[i] || players[i].spectator)
|
if (!playeringame[i] || players[i].spectator)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
p = &players[i];
|
p = &players[i];
|
||||||
if (p->skincolor == 0)
|
if (p->skincolor > 0)
|
||||||
color = GREENS;
|
|
||||||
else
|
|
||||||
color = R_GetTranslationColormap(TC_DEFAULT, p->skincolor, GTC_CACHE)[GREENS + 8];
|
color = R_GetTranslationColormap(TC_DEFAULT, p->skincolor, GTC_CACHE)[GREENS + 8];
|
||||||
|
|
||||||
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 0, p->mo->angle,
|
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 0, p->mo->angle, color, p->mo->x, p->mo->y);
|
||||||
color, p->mo->x, p->mo->y);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void AM_drawThings(INT32 colors, INT32 colorrange)
|
static inline void AM_drawThings(UINT8 colors)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
mobj_t *t;
|
mobj_t *t;
|
||||||
|
|
||||||
(void)colorrange;
|
|
||||||
for (i = 0; i < numsectors; i++)
|
for (i = 0; i < numsectors; i++)
|
||||||
{
|
{
|
||||||
t = sectors[i].thinglist;
|
t = sectors[i].thinglist;
|
||||||
while (t)
|
while (t)
|
||||||
{
|
{
|
||||||
AM_drawLineCharacter(thintriangle_guy, NUMTHINTRIANGLEGUYLINES,
|
AM_drawLineCharacter(thintriangle_guy, NUMTHINTRIANGLEGUYLINES, 16<<FRACBITS, t->angle, colors, t->x, t->y);
|
||||||
16<<FRACBITS, t->angle, colors + lightlev, t->x, t->y);
|
|
||||||
t = t->snext;
|
t = t->snext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void AM_drawMarks(void)
|
|
||||||
{
|
|
||||||
INT32 i, fx, fy, w, h;
|
|
||||||
|
|
||||||
for (i = 0; i < AM_NUMMARKPOINTS; i++)
|
|
||||||
{
|
|
||||||
if (markpoints[i].x != -1 && marknums[i])
|
|
||||||
{
|
|
||||||
// w = SHORT(marknums[i]->width);
|
|
||||||
// h = SHORT(marknums[i]->height);
|
|
||||||
w = 5; // because something's wrong with the wad, i guess
|
|
||||||
h = 6; // because something's wrong with the wad, i guess
|
|
||||||
fx = CXMTOF(markpoints[i].x);
|
|
||||||
fy = CYMTOF(markpoints[i].y);
|
|
||||||
if (fx >= f_x && fx <= f_w - w && fy >= f_y && fy <= f_h - h)
|
|
||||||
V_DrawPatch(fx, fy, FB, marknums[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Draws the crosshair, actually just a dot in software mode.
|
/** Draws the crosshair, actually just a dot in software mode.
|
||||||
*
|
*
|
||||||
* \param color Color for the crosshair.
|
* \param color Color for the crosshair.
|
||||||
*/
|
*/
|
||||||
static inline void AM_drawCrosshair(INT32 color)
|
static inline void AM_drawCrosshair(UINT8 color)
|
||||||
{
|
{
|
||||||
if (rendermode != render_soft)
|
V_DrawFill(f_w/2 + f_x, f_h/2 + f_y, 1, 1, color|V_NOSCALESTART);
|
||||||
return; // BP: should be putpixel here
|
|
||||||
|
|
||||||
if (scr_bpp == 1)
|
|
||||||
fb[(f_w*(f_h + 1))/2] = (UINT8)color; // single point for now
|
|
||||||
else
|
|
||||||
*((INT16 *)(void *)fb + (f_w*(f_h + 1))/2) = (INT16)color;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Draws the automap.
|
/** Draws the automap.
|
||||||
|
@ -1271,13 +1094,10 @@ void AM_Drawer(void)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AM_clearFB(BACKGROUND);
|
AM_clearFB(BACKGROUND);
|
||||||
if (grid)
|
if (draw_grid) AM_drawGrid(GRIDCOLORS);
|
||||||
AM_drawGrid(GRIDCOLORS);
|
|
||||||
AM_drawWalls();
|
AM_drawWalls();
|
||||||
AM_drawPlayers();
|
AM_drawPlayers();
|
||||||
AM_drawThings(THINGCOLORS, THINGRANGE);
|
AM_drawThings(THINGCOLORS);
|
||||||
|
|
||||||
AM_drawCrosshair(XHAIRCOLORS);
|
AM_drawCrosshair(XHAIRCOLORS);
|
||||||
|
|
||||||
AM_drawMarks();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "hu_stuff.h"
|
#include "hu_stuff.h"
|
||||||
#include "p_setup.h"
|
#include "p_setup.h"
|
||||||
#include "lua_script.h"
|
#include "lua_script.h"
|
||||||
|
#include "d_netfil.h" // findfile
|
||||||
|
|
||||||
//========
|
//========
|
||||||
// protos.
|
// protos.
|
||||||
|
@ -641,6 +642,7 @@ static void COM_CEchoDuration_f(void)
|
||||||
static void COM_Exec_f(void)
|
static void COM_Exec_f(void)
|
||||||
{
|
{
|
||||||
UINT8 *buf = NULL;
|
UINT8 *buf = NULL;
|
||||||
|
char filename[256];
|
||||||
|
|
||||||
if (COM_Argc() < 2 || COM_Argc() > 3)
|
if (COM_Argc() < 2 || COM_Argc() > 3)
|
||||||
{
|
{
|
||||||
|
@ -649,13 +651,23 @@ static void COM_Exec_f(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// load file
|
// load file
|
||||||
|
// Try with Argv passed verbatim first, for back compat
|
||||||
FIL_ReadFile(COM_Argv(1), &buf);
|
FIL_ReadFile(COM_Argv(1), &buf);
|
||||||
|
|
||||||
if (!buf)
|
if (!buf)
|
||||||
{
|
{
|
||||||
if (!COM_CheckParm("-noerror"))
|
// Now try by searching the file path
|
||||||
CONS_Printf(M_GetText("couldn't execute file %s\n"), COM_Argv(1));
|
// filename is modified with the full found path
|
||||||
return;
|
strcpy(filename, COM_Argv(1));
|
||||||
|
if (findfile(filename, NULL, true) != FS_NOTFOUND)
|
||||||
|
FIL_ReadFile(filename, &buf);
|
||||||
|
|
||||||
|
if (!buf)
|
||||||
|
{
|
||||||
|
if (!COM_CheckParm("-noerror"))
|
||||||
|
CONS_Printf(M_GetText("couldn't execute file %s\n"), COM_Argv(1));
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!COM_CheckParm("-silent"))
|
if (!COM_CheckParm("-silent"))
|
||||||
|
|
|
@ -58,10 +58,7 @@ 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; // clip value for planes & sprites, so that the
|
INT32 con_clipviewtop; // (useless)
|
||||||
// part of the view covered by the console is not
|
|
||||||
// drawn when not needed, this must be -1 when
|
|
||||||
// console is off
|
|
||||||
|
|
||||||
static INT32 con_hudlines; // number of console heads up message lines
|
static INT32 con_hudlines; // number of console heads up message lines
|
||||||
static INT32 con_hudtime[MAXHUDLINES]; // remaining time of display for hud msg lines
|
static INT32 con_hudtime[MAXHUDLINES]; // remaining time of display for hud msg lines
|
||||||
|
|
|
@ -429,9 +429,9 @@ extern doomdata_t *netbuffer;
|
||||||
|
|
||||||
extern consvar_t cv_playbackspeed;
|
extern consvar_t cv_playbackspeed;
|
||||||
|
|
||||||
#define BASEPACKETSIZE ((size_t)&(((doomdata_t *)0)->u))
|
#define BASEPACKETSIZE offsetof(doomdata_t, u)
|
||||||
#define FILETXHEADER ((size_t)((filetx_pak *)0)->data)
|
#define FILETXHEADER offsetof(filetx_pak, data)
|
||||||
#define BASESERVERTICSSIZE ((size_t)&(((doomdata_t *)0)->u.serverpak.cmds[0]))
|
#define BASESERVERTICSSIZE offsetof(doomdata_t, u.serverpak.cmds[0])
|
||||||
|
|
||||||
#define KICK_MSG_GO_AWAY 1
|
#define KICK_MSG_GO_AWAY 1
|
||||||
#define KICK_MSG_CON_FAIL 2
|
#define KICK_MSG_CON_FAIL 2
|
||||||
|
|
|
@ -319,8 +319,7 @@ static void D_Display(void)
|
||||||
if (!gametic)
|
if (!gametic)
|
||||||
break;
|
break;
|
||||||
HU_Erase();
|
HU_Erase();
|
||||||
if (automapactive)
|
AM_Drawer();
|
||||||
AM_Drawer();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GS_INTERMISSION:
|
case GS_INTERMISSION:
|
||||||
|
@ -374,12 +373,10 @@ static void D_Display(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// clean up border stuff
|
|
||||||
// see if the border needs to be initially drawn
|
|
||||||
if (gamestate == GS_LEVEL)
|
if (gamestate == GS_LEVEL)
|
||||||
{
|
{
|
||||||
// draw the view directly
|
// draw the view directly
|
||||||
if (!automapactive && !dedicated && cv_renderview.value)
|
if (cv_renderview.value && !automapactive)
|
||||||
{
|
{
|
||||||
if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD)
|
if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD)
|
||||||
{
|
{
|
||||||
|
@ -437,7 +434,6 @@ static void D_Display(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
ST_Drawer();
|
ST_Drawer();
|
||||||
|
|
||||||
HU_Drawer();
|
HU_Drawer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "d_clisrv.h"
|
#include "d_clisrv.h"
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
#include "i_tcp.h"
|
#include "i_tcp.h"
|
||||||
|
#include "d_main.h" // srb2home
|
||||||
|
|
||||||
//
|
//
|
||||||
// NETWORKING
|
// NETWORKING
|
||||||
|
@ -1374,12 +1375,12 @@ boolean D_CheckNetGame(void)
|
||||||
{
|
{
|
||||||
k++;
|
k++;
|
||||||
sprintf(filename, "debug%d.txt", k);
|
sprintf(filename, "debug%d.txt", k);
|
||||||
debugfile = fopen(filename, "w");
|
debugfile = fopen(va("%s" PATHSEP "%s", srb2home, filename), "w");
|
||||||
}
|
}
|
||||||
if (debugfile)
|
if (debugfile)
|
||||||
CONS_Printf(M_GetText("debug output to: %s\n"), filename);
|
CONS_Printf(M_GetText("debug output to: %s\n"), va("%s" PATHSEP "%s", srb2home, filename));
|
||||||
else
|
else
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("cannot debug output to file %s!\n"), filename);
|
CONS_Alert(CONS_WARNING, M_GetText("cannot debug output to file %s!\n"), va("%s" PATHSEP "%s", srb2home, filename));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3440,7 +3440,7 @@ static void Command_Version_f(void)
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
CONS_Printf("Linux ");
|
CONS_Printf("Linux ");
|
||||||
#elif defined(MACOSX)
|
#elif defined(MACOSX)
|
||||||
CONS_Printf("macOS" );
|
CONS_Printf("macOS ");
|
||||||
#elif defined(UNIXCOMMON)
|
#elif defined(UNIXCOMMON)
|
||||||
CONS_Printf("Unix (Common) ");
|
CONS_Printf("Unix (Common) ");
|
||||||
#else
|
#else
|
||||||
|
@ -3465,6 +3465,11 @@ static void Command_Version_f(void)
|
||||||
CONS_Printf("\x85" "DEBUG " "\x80");
|
CONS_Printf("\x85" "DEBUG " "\x80");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// DEVELOP build
|
||||||
|
#ifdef DEVELOP
|
||||||
|
CONS_Printf("\x87" "DEVELOP " "\x80");
|
||||||
|
#endif
|
||||||
|
|
||||||
CONS_Printf("\n");
|
CONS_Printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1248,6 +1248,18 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
||||||
deh_warning("Level header %d: invalid bonus type number %d", num, i);
|
deh_warning("Level header %d: invalid bonus type number %d", num, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (fastcmp(word, "SAVEOVERRIDE"))
|
||||||
|
{
|
||||||
|
if (fastcmp(word2, "DEFAULT")) i = SAVE_DEFAULT;
|
||||||
|
else if (fastcmp(word2, "ALWAYS")) i = SAVE_ALWAYS;
|
||||||
|
else if (fastcmp(word2, "NEVER")) i = SAVE_NEVER;
|
||||||
|
|
||||||
|
if (i >= SAVE_NEVER && i <= SAVE_ALWAYS)
|
||||||
|
mapheaderinfo[num-1]->saveoverride = (SINT8)i;
|
||||||
|
else
|
||||||
|
deh_warning("Level header %d: invalid save override number %d", num, i);
|
||||||
|
}
|
||||||
|
|
||||||
else if (fastcmp(word, "LEVELFLAGS"))
|
else if (fastcmp(word, "LEVELFLAGS"))
|
||||||
mapheaderinfo[num-1]->levelflags = (UINT8)i;
|
mapheaderinfo[num-1]->levelflags = (UINT8)i;
|
||||||
else if (fastcmp(word, "MENUFLAGS"))
|
else if (fastcmp(word, "MENUFLAGS"))
|
||||||
|
@ -3080,7 +3092,7 @@ static void readmaincfg(MYFILE *f)
|
||||||
strncpy(timeattackfolder, gamedatafilename, min(filenamelen, sizeof (timeattackfolder)));
|
strncpy(timeattackfolder, gamedatafilename, min(filenamelen, sizeof (timeattackfolder)));
|
||||||
timeattackfolder[min(filenamelen, sizeof (timeattackfolder) - 1)] = '\0';
|
timeattackfolder[min(filenamelen, sizeof (timeattackfolder) - 1)] = '\0';
|
||||||
|
|
||||||
strncpy(savegamename, timeattackfolder, strlen(timeattackfolder));
|
strcpy(savegamename, timeattackfolder);
|
||||||
strlcat(savegamename, "%u.ssg", sizeof(savegamename));
|
strlcat(savegamename, "%u.ssg", sizeof(savegamename));
|
||||||
// can't use sprintf since there is %u in savegamename
|
// can't use sprintf since there is %u in savegamename
|
||||||
strcatbf(savegamename, srb2home, PATHSEP);
|
strcatbf(savegamename, srb2home, PATHSEP);
|
||||||
|
@ -7074,6 +7086,11 @@ struct {
|
||||||
{"LF2_NIGHTSATTACK",LF2_NIGHTSATTACK},
|
{"LF2_NIGHTSATTACK",LF2_NIGHTSATTACK},
|
||||||
{"LF2_NOVISITNEEDED",LF2_NOVISITNEEDED},
|
{"LF2_NOVISITNEEDED",LF2_NOVISITNEEDED},
|
||||||
|
|
||||||
|
// Save override
|
||||||
|
{"SAVE_NEVER",SAVE_NEVER},
|
||||||
|
{"SAVE_DEFAULT",SAVE_DEFAULT},
|
||||||
|
{"SAVE_ALWAYS",SAVE_ALWAYS},
|
||||||
|
|
||||||
// NiGHTS grades
|
// NiGHTS grades
|
||||||
{"GRADE_F",GRADE_F},
|
{"GRADE_F",GRADE_F},
|
||||||
{"GRADE_E",GRADE_E},
|
{"GRADE_E",GRADE_E},
|
||||||
|
@ -8303,6 +8320,7 @@ static inline int lib_getenum(lua_State *L)
|
||||||
LUA_PushUserdata(L, &players[serverplayer], META_PLAYER);
|
LUA_PushUserdata(L, &players[serverplayer], META_PLAYER);
|
||||||
return 1;
|
return 1;
|
||||||
} else if (fastcmp(word,"admin")) { // BACKWARDS COMPATIBILITY HACK: This was replaced with IsPlayerAdmin(), but some 2.1 Lua scripts still use the admin variable. It now points to the first admin player in the array.
|
} else if (fastcmp(word,"admin")) { // BACKWARDS COMPATIBILITY HACK: This was replaced with IsPlayerAdmin(), but some 2.1 Lua scripts still use the admin variable. It now points to the first admin player in the array.
|
||||||
|
LUA_Deprecated(L, "admin", "IsPlayerAdmin(player)");
|
||||||
if (!playeringame[adminplayers[0]] || IsPlayerAdmin(serverplayer))
|
if (!playeringame[adminplayers[0]] || IsPlayerAdmin(serverplayer))
|
||||||
return 0;
|
return 0;
|
||||||
LUA_PushUserdata(L, &players[adminplayers[0]], META_PLAYER);
|
LUA_PushUserdata(L, &players[adminplayers[0]], META_PLAYER);
|
||||||
|
|
|
@ -234,6 +234,7 @@ typedef struct
|
||||||
SINT8 unlockrequired; ///< Is an unlockable required to play this level? -1 if no.
|
SINT8 unlockrequired; ///< Is an unlockable required to play this level? -1 if no.
|
||||||
UINT8 levelselect; ///< Is this map available in the level select? If so, which map list is it available in?
|
UINT8 levelselect; ///< Is this map available in the level select? If so, which map list is it available in?
|
||||||
SINT8 bonustype; ///< What type of bonus does this level have? (-1 for null.)
|
SINT8 bonustype; ///< What type of bonus does this level have? (-1 for null.)
|
||||||
|
SINT8 saveoverride; ///< Set how the game is allowed to save (1 for always, -1 for never, 0 is 2.1 default)
|
||||||
|
|
||||||
UINT8 levelflags; ///< LF_flags: merged eight booleans into one UINT8 for space, see below
|
UINT8 levelflags; ///< LF_flags: merged eight booleans into one UINT8 for space, see below
|
||||||
UINT8 menuflags; ///< LF2_flags: options that affect record attack / nights mode menus
|
UINT8 menuflags; ///< LF2_flags: options that affect record attack / nights mode menus
|
||||||
|
@ -261,6 +262,11 @@ typedef struct
|
||||||
#define LF2_NIGHTSATTACK 8 ///< Show this map in NiGHTS mode menu
|
#define LF2_NIGHTSATTACK 8 ///< Show this map in NiGHTS mode menu
|
||||||
#define LF2_NOVISITNEEDED 16 ///< Available in time attack/nights mode without visiting the level
|
#define LF2_NOVISITNEEDED 16 ///< Available in time attack/nights mode without visiting the level
|
||||||
|
|
||||||
|
// Save override
|
||||||
|
#define SAVE_NEVER -1
|
||||||
|
#define SAVE_DEFAULT 0
|
||||||
|
#define SAVE_ALWAYS 1
|
||||||
|
|
||||||
extern mapheader_t* mapheaderinfo[NUMMAPS];
|
extern mapheader_t* mapheaderinfo[NUMMAPS];
|
||||||
|
|
||||||
enum TypeOfLevel
|
enum TypeOfLevel
|
||||||
|
|
|
@ -193,14 +193,14 @@ static polyvertex_t *fracdivline(fdivline_t *bsp, polyvertex_t *v1,
|
||||||
v2dy = bsp->dy;
|
v2dy = bsp->dy;
|
||||||
|
|
||||||
den = v2dy*v1dx - v2dx*v1dy;
|
den = v2dy*v1dx - v2dx*v1dy;
|
||||||
if (den == 0)
|
if (fabs(den) < 1.0E-36f) // avoid checking exactly for 0.0
|
||||||
return NULL; // parallel
|
return NULL; // parallel
|
||||||
|
|
||||||
// first check the frac along the polygon segment,
|
// first check the frac along the polygon segment,
|
||||||
// (do not accept hit with the extensions)
|
// (do not accept hit with the extensions)
|
||||||
num = (v2x - v1x)*v2dy + (v1y - v2y)*v2dx;
|
num = (v2x - v1x)*v2dy + (v1y - v2y)*v2dx;
|
||||||
frac = num / den;
|
frac = num / den;
|
||||||
if (frac < 0 || frac > 1)
|
if (frac < 0.0 || frac > 1.0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// now get the frac along the BSP line
|
// now get the frac along the BSP line
|
||||||
|
@ -217,29 +217,6 @@ static polyvertex_t *fracdivline(fdivline_t *bsp, polyvertex_t *v1,
|
||||||
return &pt;
|
return &pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
//Hurdler: it's not used anymore
|
|
||||||
static boolean NearVertice (polyvertex_t *p1, polyvertex_t *p2)
|
|
||||||
{
|
|
||||||
#if 1
|
|
||||||
float diff;
|
|
||||||
diff = p2->x - p1->x;
|
|
||||||
if (diff < -1.5f || diff > 1.5f)
|
|
||||||
return false;
|
|
||||||
diff = p2->y - p1->y;
|
|
||||||
if (diff < -1.5f || diff > 1.5f)
|
|
||||||
return false;
|
|
||||||
#else
|
|
||||||
if (p1->x != p2->x)
|
|
||||||
return false;
|
|
||||||
if (p1->y != p2->y)
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
// p1 and p2 are considered the same vertex
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// if two vertice coords have a x and/or y difference
|
// if two vertice coords have a x and/or y difference
|
||||||
// of less or equal than 1 FRACUNIT, they are considered the same
|
// of less or equal than 1 FRACUNIT, they are considered the same
|
||||||
// point. Note: hardcoded value, 1.0f could be anything else.
|
// point. Note: hardcoded value, 1.0f could be anything else.
|
||||||
|
@ -253,11 +230,18 @@ static boolean SameVertice (polyvertex_t *p1, polyvertex_t *p2)
|
||||||
diff = p2->y - p1->y;
|
diff = p2->y - p1->y;
|
||||||
if (diff < -1.5f || diff > 1.5f)
|
if (diff < -1.5f || diff > 1.5f)
|
||||||
return false;
|
return false;
|
||||||
#else
|
#elif 0
|
||||||
if (p1->x != p2->x)
|
if (p1->x != p2->x)
|
||||||
return false;
|
return false;
|
||||||
if (p1->y != p2->y)
|
if (p1->y != p2->y)
|
||||||
return false;
|
return false;
|
||||||
|
#else
|
||||||
|
#define DIVLINE_VERTEX_DIFF 0.45f
|
||||||
|
float ep = DIVLINE_VERTEX_DIFF;
|
||||||
|
if (fabsf( p2->x - p1->x ) > ep )
|
||||||
|
return false;
|
||||||
|
if (fabsf( p2->y - p1->y ) > ep )
|
||||||
|
return false;
|
||||||
#endif
|
#endif
|
||||||
// p1 and p2 are considered the same vertex
|
// p1 and p2 are considered the same vertex
|
||||||
return true;
|
return true;
|
||||||
|
@ -294,57 +278,57 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line
|
||||||
// start & end points
|
// start & end points
|
||||||
pv = fracdivline(bsp, &poly->pts[i], &poly->pts[j]);
|
pv = fracdivline(bsp, &poly->pts[i], &poly->pts[j]);
|
||||||
|
|
||||||
if (pv)
|
if (pv == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (ps < 0)
|
||||||
{
|
{
|
||||||
if (ps < 0)
|
// first point
|
||||||
|
ps = i;
|
||||||
|
vs = *pv;
|
||||||
|
fracs = bspfrac;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//the partition line traverse a junction between two segments
|
||||||
|
// or the two points are so close, they can be considered as one
|
||||||
|
// thus, don't accept, since split 2 must be another vertex
|
||||||
|
if (SameVertice(pv, &lastpv))
|
||||||
{
|
{
|
||||||
// first point
|
if (pe < 0)
|
||||||
ps = i;
|
|
||||||
vs = *pv;
|
|
||||||
fracs = bspfrac;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//the partition line traverse a junction between two segments
|
|
||||||
// or the two points are so close, they can be considered as one
|
|
||||||
// thus, don't accept, since split 2 must be another vertex
|
|
||||||
if (SameVertice(pv, &lastpv))
|
|
||||||
{
|
{
|
||||||
if (pe < 0)
|
ps = i;
|
||||||
{
|
psonline = 1;
|
||||||
ps = i;
|
|
||||||
psonline = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pe = i;
|
|
||||||
peonline = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pe < 0)
|
pe = i;
|
||||||
{
|
peonline = 1;
|
||||||
pe = i;
|
}
|
||||||
ve = *pv;
|
}
|
||||||
frace = bspfrac;
|
else
|
||||||
}
|
{
|
||||||
else
|
if (pe < 0)
|
||||||
{
|
{
|
||||||
// a frac, not same vertice as last one
|
pe = i;
|
||||||
// we already got pt2 so pt 2 is not on the line,
|
ve = *pv;
|
||||||
// so we probably got back to the start point
|
frace = bspfrac;
|
||||||
// which is on the line
|
}
|
||||||
if (SameVertice(pv, &vs))
|
else
|
||||||
psonline = 1;
|
{
|
||||||
break;
|
// a frac, not same vertice as last one
|
||||||
}
|
// we already got pt2 so pt 2 is not on the line,
|
||||||
|
// so we probably got back to the start point
|
||||||
|
// which is on the line
|
||||||
|
if (SameVertice(pv, &vs))
|
||||||
|
psonline = 1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// remember last point intercept to detect identical points
|
|
||||||
lastpv = *pv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remember last point intercept to detect identical points
|
||||||
|
lastpv = *pv;
|
||||||
}
|
}
|
||||||
|
|
||||||
// no split: the partition line is either parallel and
|
// no split: the partition line is either parallel and
|
||||||
|
@ -368,7 +352,7 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ps >= 0 && pe < 0)
|
if (pe < 0)
|
||||||
{
|
{
|
||||||
//I_Error("SplitPoly: only one point for split line (%d %d)", ps, pe);
|
//I_Error("SplitPoly: only one point for split line (%d %d)", ps, pe);
|
||||||
*frontpoly = poly;
|
*frontpoly = poly;
|
||||||
|
@ -387,7 +371,7 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line
|
||||||
*backpoly = HWR_AllocPoly(2 + nptback);
|
*backpoly = HWR_AllocPoly(2 + nptback);
|
||||||
else
|
else
|
||||||
*backpoly = NULL;
|
*backpoly = NULL;
|
||||||
if (nptfront)
|
if (nptfront > 0)
|
||||||
*frontpoly = HWR_AllocPoly(2 + nptfront);
|
*frontpoly = HWR_AllocPoly(2 + nptfront);
|
||||||
else
|
else
|
||||||
*frontpoly = NULL;
|
*frontpoly = NULL;
|
||||||
|
@ -482,42 +466,42 @@ static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
|
||||||
|
|
||||||
pv = fracdivline(&cutseg, &poly->pts[i], &poly->pts[j]);
|
pv = fracdivline(&cutseg, &poly->pts[i], &poly->pts[j]);
|
||||||
|
|
||||||
if (pv)
|
if (pv == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (ps < 0)
|
||||||
{
|
{
|
||||||
if (ps < 0)
|
ps = i;
|
||||||
|
vs = *pv;
|
||||||
|
fracs = bspfrac;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//frac 1 on previous segment,
|
||||||
|
// 0 on the next,
|
||||||
|
//the split line goes through one of the convex poly
|
||||||
|
// vertices, happens quite often since the convex
|
||||||
|
// poly is already adjacent to the subsector segs
|
||||||
|
// on most borders
|
||||||
|
if (SameVertice(pv, &vs))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (fracs <= bspfrac)
|
||||||
{
|
{
|
||||||
|
nump = 2 + poly->numpts - (i-ps);
|
||||||
|
pe = ps;
|
||||||
ps = i;
|
ps = i;
|
||||||
vs = *pv;
|
ve = *pv;
|
||||||
fracs = bspfrac;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//frac 1 on previous segment,
|
nump = 2 + (i-ps);
|
||||||
// 0 on the next,
|
pe = i;
|
||||||
//the split line goes through one of the convex poly
|
ve = vs;
|
||||||
// vertices, happens quite often since the convex
|
vs = *pv;
|
||||||
// poly is already adjacent to the subsector segs
|
|
||||||
// on most borders
|
|
||||||
if (SameVertice(pv, &vs))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (fracs <= bspfrac)
|
|
||||||
{
|
|
||||||
nump = 2 + poly->numpts - (i-ps);
|
|
||||||
pe = ps;
|
|
||||||
ps = i;
|
|
||||||
ve = *pv;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nump = 2 + (i-ps);
|
|
||||||
pe = i;
|
|
||||||
ve = vs;
|
|
||||||
vs = *pv;
|
|
||||||
}
|
|
||||||
//found 2nd point
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
//found 2nd point
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -581,18 +565,42 @@ static inline void HWR_SubsecPoly(INT32 num, poly_t *poly)
|
||||||
// search for the segs source of this divline
|
// search for the segs source of this divline
|
||||||
static inline void SearchDivline(node_t *bsp, fdivline_t *divline)
|
static inline void SearchDivline(node_t *bsp, fdivline_t *divline)
|
||||||
{
|
{
|
||||||
#if 0 // MAR - If you don't use the same partition line that the BSP uses, the front/back polys won't match the subsectors in the BSP!
|
|
||||||
#endif
|
|
||||||
divline->x = FIXED_TO_FLOAT(bsp->x);
|
divline->x = FIXED_TO_FLOAT(bsp->x);
|
||||||
divline->y = FIXED_TO_FLOAT(bsp->y);
|
divline->y = FIXED_TO_FLOAT(bsp->y);
|
||||||
divline->dx = FIXED_TO_FLOAT(bsp->dx);
|
divline->dx = FIXED_TO_FLOAT(bsp->dx);
|
||||||
divline->dy = FIXED_TO_FLOAT(bsp->dy);
|
divline->dy = FIXED_TO_FLOAT(bsp->dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HWR_LOADING_SCREEN
|
||||||
//Hurdler: implement a loading status
|
//Hurdler: implement a loading status
|
||||||
static size_t ls_count = 0;
|
static size_t ls_count = 0;
|
||||||
static UINT8 ls_percent = 0;
|
static UINT8 ls_percent = 0;
|
||||||
|
|
||||||
|
static void loading_status(void)
|
||||||
|
{
|
||||||
|
char s[16];
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
I_OsPolling();
|
||||||
|
CON_Drawer();
|
||||||
|
sprintf(s, "%d%%", (++ls_percent)<<1);
|
||||||
|
x = BASEVIDWIDTH/2;
|
||||||
|
y = BASEVIDHEIGHT/2;
|
||||||
|
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); // Black background to match fade in effect
|
||||||
|
//V_DrawPatchFill(W_CachePatchName("SRB2BACK",PU_CACHE)); // SRB2 background, ehhh too bright.
|
||||||
|
M_DrawTextBox(x-58, y-8, 13, 1);
|
||||||
|
V_DrawString(x-50, y, V_YELLOWMAP, "Loading...");
|
||||||
|
V_DrawRightAlignedString(x+50, y, V_YELLOWMAP, s);
|
||||||
|
|
||||||
|
// Is this really necessary at this point..?
|
||||||
|
V_DrawCenteredString(BASEVIDWIDTH/2, 40, V_YELLOWMAP, "OPENGL MODE IS INCOMPLETE AND MAY");
|
||||||
|
V_DrawCenteredString(BASEVIDWIDTH/2, 50, V_YELLOWMAP, "NOT DISPLAY SOME SURFACES.");
|
||||||
|
V_DrawCenteredString(BASEVIDWIDTH/2, 70, V_YELLOWMAP, "USE AT SONIC'S RISK.");
|
||||||
|
|
||||||
|
I_UpdateNoVsync();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// poly : the convex polygon that encloses all child subsectors
|
// poly : the convex polygon that encloses all child subsectors
|
||||||
static void WalkBSPNode(INT32 bspnum, poly_t *poly, UINT16 *leafnode, fixed_t *bbox)
|
static void WalkBSPNode(INT32 bspnum, poly_t *poly, UINT16 *leafnode, fixed_t *bbox)
|
||||||
{
|
{
|
||||||
|
@ -630,38 +638,19 @@ static void WalkBSPNode(INT32 bspnum, poly_t *poly, UINT16 *leafnode, fixed_t *b
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HWR_SubsecPoly(bspnum&(~NF_SUBSECTOR), poly);
|
HWR_SubsecPoly(bspnum & ~NF_SUBSECTOR, poly);
|
||||||
//Hurdler: implement a loading status
|
|
||||||
|
|
||||||
|
//Hurdler: implement a loading status
|
||||||
#ifdef HWR_LOADING_SCREEN
|
#ifdef HWR_LOADING_SCREEN
|
||||||
if (ls_count-- <= 0)
|
if (ls_count-- <= 0)
|
||||||
{
|
{
|
||||||
char s[16];
|
|
||||||
int x, y;
|
|
||||||
|
|
||||||
I_OsPolling();
|
|
||||||
ls_count = numsubsectors/50;
|
ls_count = numsubsectors/50;
|
||||||
CON_Drawer();
|
loading_status();
|
||||||
sprintf(s, "%d%%", (++ls_percent)<<1);
|
|
||||||
x = BASEVIDWIDTH/2;
|
|
||||||
y = BASEVIDHEIGHT/2;
|
|
||||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); // Black background to match fade in effect
|
|
||||||
//V_DrawPatchFill(W_CachePatchName("SRB2BACK",PU_CACHE)); // SRB2 background, ehhh too bright.
|
|
||||||
M_DrawTextBox(x-58, y-8, 13, 1);
|
|
||||||
V_DrawString(x-50, y, V_YELLOWMAP, "Loading...");
|
|
||||||
V_DrawRightAlignedString(x+50, y, V_YELLOWMAP, s);
|
|
||||||
|
|
||||||
// Is this really necessary at this point..?
|
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, 40, V_YELLOWMAP, "OPENGL MODE IS INCOMPLETE AND MAY");
|
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, 50, V_YELLOWMAP, "NOT DISPLAY SOME SURFACES.");
|
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, 70, V_YELLOWMAP, "USE AT SONIC'S RISK.");
|
|
||||||
|
|
||||||
I_UpdateNoVsync();
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
M_ClearBox(bbox);
|
M_ClearBox(bbox);
|
||||||
poly = extrasubsectors[bspnum&~NF_SUBSECTOR].planepoly;
|
poly = extrasubsectors[bspnum & ~NF_SUBSECTOR].planepoly;
|
||||||
|
|
||||||
for (i = 0, pt = poly->pts; i < poly->numpts; i++,pt++)
|
for (i = 0, pt = poly->pts; i < poly->numpts; i++,pt++)
|
||||||
M_AddToBox(bbox, FLOAT_TO_FIXED(pt->x), FLOAT_TO_FIXED(pt->y));
|
M_AddToBox(bbox, FLOAT_TO_FIXED(pt->x), FLOAT_TO_FIXED(pt->y));
|
||||||
|
@ -693,14 +682,13 @@ static void WalkBSPNode(INT32 bspnum, poly_t *poly, UINT16 *leafnode, fixed_t *b
|
||||||
if (backpoly)
|
if (backpoly)
|
||||||
{
|
{
|
||||||
// Correct back bbox to include floor/ceiling convex polygon
|
// Correct back bbox to include floor/ceiling convex polygon
|
||||||
WalkBSPNode(bsp->children[1], backpoly, &bsp->children[1],
|
WalkBSPNode(bsp->children[1], backpoly, &bsp->children[1], bsp->bbox[1]);
|
||||||
bsp->bbox[1]);
|
|
||||||
|
|
||||||
// enlarge bbox with seconde child
|
// enlarge bbox with second child
|
||||||
M_AddToBox(bbox, bsp->bbox[1][BOXLEFT ],
|
M_AddToBox(bbox, bsp->bbox[1][BOXLEFT ],
|
||||||
bsp->bbox[1][BOXTOP ]);
|
bsp->bbox[1][BOXTOP ]);
|
||||||
M_AddToBox(bbox, bsp->bbox[1][BOXRIGHT ],
|
M_AddToBox(bbox, bsp->bbox[1][BOXRIGHT ],
|
||||||
bsp->bbox[1][BOXBOTTOM]);
|
bsp->bbox[1][BOXBOTTOM]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -780,9 +768,9 @@ static void SearchSegInBSP(INT32 bspnum,polyvertex_t *p,poly_t *poly)
|
||||||
|
|
||||||
if (bspnum & NF_SUBSECTOR)
|
if (bspnum & NF_SUBSECTOR)
|
||||||
{
|
{
|
||||||
if (bspnum!=-1)
|
if (bspnum != -1)
|
||||||
{
|
{
|
||||||
bspnum&=~NF_SUBSECTOR;
|
bspnum &= ~NF_SUBSECTOR;
|
||||||
q = extrasubsectors[bspnum].planepoly;
|
q = extrasubsectors[bspnum].planepoly;
|
||||||
if (poly == q || !q)
|
if (poly == q || !q)
|
||||||
return;
|
return;
|
||||||
|
@ -968,7 +956,9 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
|
||||||
fixed_t rootbbox[4];
|
fixed_t rootbbox[4];
|
||||||
|
|
||||||
CONS_Debug(DBG_RENDER, "Creating polygons, please wait...\n");
|
CONS_Debug(DBG_RENDER, "Creating polygons, please wait...\n");
|
||||||
|
#ifdef HWR_LOADING_SCREEN
|
||||||
ls_count = ls_percent = 0; // reset the loading status
|
ls_count = ls_percent = 0; // reset the loading status
|
||||||
|
#endif
|
||||||
CON_Drawer(); //let the user know what we are doing
|
CON_Drawer(); //let the user know what we are doing
|
||||||
I_FinishUpdate(); // page flip or blit buffer
|
I_FinishUpdate(); // page flip or blit buffer
|
||||||
|
|
||||||
|
|
|
@ -770,18 +770,6 @@ void HWR_DrawViewBorder(INT32 clearlines)
|
||||||
// AM_MAP.C DRAWING STUFF
|
// AM_MAP.C DRAWING STUFF
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
// Clear the automap part of the screen
|
|
||||||
void HWR_clearAutomap(void)
|
|
||||||
{
|
|
||||||
FRGBAFloat fColor = {0, 0, 0, 1};
|
|
||||||
|
|
||||||
// minx,miny,maxx,maxy
|
|
||||||
HWD.pfnGClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE);
|
|
||||||
HWD.pfnClearBuffer(true, true, &fColor);
|
|
||||||
HWD.pfnGClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// -----------------+
|
// -----------------+
|
||||||
// HWR_drawAMline : draw a line of the automap (the clipping is already done in automap code)
|
// HWR_drawAMline : draw a line of the automap (the clipping is already done in automap code)
|
||||||
// Arg : color is a RGB 888 value
|
// Arg : color is a RGB 888 value
|
||||||
|
|
|
@ -4334,6 +4334,16 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
|
||||||
wallVerts[0].tow = wallVerts[1].tow = gpatch->max_t;
|
wallVerts[0].tow = wallVerts[1].tow = gpatch->max_t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if it has a dispoffset, push it a little towards the camera
|
||||||
|
if (spr->dispoffset) {
|
||||||
|
float co = -gr_viewcos*(0.05f*spr->dispoffset);
|
||||||
|
float si = -gr_viewsin*(0.05f*spr->dispoffset);
|
||||||
|
wallVerts[0].z = wallVerts[3].z = wallVerts[0].z+si;
|
||||||
|
wallVerts[1].z = wallVerts[2].z = wallVerts[1].z+si;
|
||||||
|
wallVerts[0].x = wallVerts[3].x = wallVerts[0].x+co;
|
||||||
|
wallVerts[1].x = wallVerts[2].x = wallVerts[1].x+co;
|
||||||
|
}
|
||||||
|
|
||||||
realtop = top = wallVerts[3].y;
|
realtop = top = wallVerts[3].y;
|
||||||
realbot = bot = wallVerts[0].y;
|
realbot = bot = wallVerts[0].y;
|
||||||
towtop = wallVerts[3].tow;
|
towtop = wallVerts[3].tow;
|
||||||
|
@ -4635,6 +4645,16 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
|
||||||
HWR_DrawSpriteShadow(spr, gpatch, this_scale);
|
HWR_DrawSpriteShadow(spr, gpatch, this_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if it has a dispoffset, push it a little towards the camera
|
||||||
|
if (spr->dispoffset) {
|
||||||
|
float co = -gr_viewcos*(0.05f*spr->dispoffset);
|
||||||
|
float si = -gr_viewsin*(0.05f*spr->dispoffset);
|
||||||
|
wallVerts[0].z = wallVerts[3].z = wallVerts[0].z+si;
|
||||||
|
wallVerts[1].z = wallVerts[2].z = wallVerts[1].z+si;
|
||||||
|
wallVerts[0].x = wallVerts[3].x = wallVerts[0].x+co;
|
||||||
|
wallVerts[1].x = wallVerts[2].x = wallVerts[1].x+co;
|
||||||
|
}
|
||||||
|
|
||||||
// This needs to be AFTER the shadows so that the regular sprites aren't drawn completely black.
|
// This needs to be AFTER the shadows so that the regular sprites aren't drawn completely black.
|
||||||
// sprite lighting by modulating the RGB components
|
// sprite lighting by modulating the RGB components
|
||||||
/// \todo coloured
|
/// \todo coloured
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
void HWR_Startup(void);
|
void HWR_Startup(void);
|
||||||
void HWR_Shutdown(void);
|
void HWR_Shutdown(void);
|
||||||
|
|
||||||
void HWR_clearAutomap(void);
|
|
||||||
void HWR_drawAMline(const fline_t *fl, INT32 color);
|
void HWR_drawAMline(const fline_t *fl, INT32 color);
|
||||||
void HWR_FadeScreenMenuBack(UINT32 color, INT32 height);
|
void HWR_FadeScreenMenuBack(UINT32 color, INT32 height);
|
||||||
void HWR_DrawConsoleBack(UINT32 color, INT32 height);
|
void HWR_DrawConsoleBack(UINT32 color, INT32 height);
|
||||||
|
|
|
@ -1682,6 +1682,25 @@ static int lib_rSetPlayerSkin(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// R_DATA
|
||||||
|
////////////
|
||||||
|
|
||||||
|
static int lib_rCheckTextureNumForName(lua_State *L)
|
||||||
|
{
|
||||||
|
const char *name = luaL_checkstring(L, 1);
|
||||||
|
//HUDSAFE
|
||||||
|
lua_pushinteger(L, R_CheckTextureNumForName(name));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lib_rTextureNumForName(lua_State *L)
|
||||||
|
{
|
||||||
|
const char *name = luaL_checkstring(L, 1);
|
||||||
|
//HUDSAFE
|
||||||
|
lua_pushinteger(L, R_TextureNumForName(name));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// S_SOUND
|
// S_SOUND
|
||||||
////////////
|
////////////
|
||||||
|
|
||||||
|
@ -1897,28 +1916,45 @@ static int lib_gDoReborn(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_gExitLevel(lua_State *L)
|
// Another Lua function that doesn't actually exist!
|
||||||
|
// Sets nextmapoverride & skipstats without instantly ending the level, for instances where other sources should be exiting the level, like normal signposts.
|
||||||
|
static int lib_gSetCustomExitVars(lua_State *L)
|
||||||
{
|
{
|
||||||
int n = lua_gettop(L); // Num arguments
|
int n = lua_gettop(L); // Num arguments
|
||||||
NOHUD
|
NOHUD
|
||||||
|
|
||||||
// LUA EXTENSION: Custom exit like support
|
// LUA EXTENSION: Custom exit like support
|
||||||
// Supported:
|
// Supported:
|
||||||
// G_ExitLevel(); [no modifications]
|
// G_SetCustomExitVars(); [reset to defaults]
|
||||||
// G_ExitLevel(int) [nextmap override only]
|
// G_SetCustomExitVars(int) [nextmap override only]
|
||||||
// G_ExitLevel(bool) [skipstats only]
|
// G_SetCustomExitVars(bool) [skipstats only]
|
||||||
// G_ExitLevel(int, bool) [both of the above]
|
// G_SetCustomExitVars(int, bool) [both of the above]
|
||||||
if (n >= 1)
|
if (n >= 1)
|
||||||
{
|
{
|
||||||
if (lua_isnumber(L, 1) || n >= 2)
|
if (lua_isnumber(L, 1) || n >= 2)
|
||||||
{
|
{
|
||||||
nextmapoverride = (INT16)luaL_checknumber(L, 1);
|
nextmapoverride = (INT16)luaL_checknumber(L, 1);
|
||||||
lua_pop(L, 1); // pop nextmapoverride; skipstats now 1 if available
|
lua_remove(L, 1); // remove nextmapoverride; skipstats now 1 if available
|
||||||
}
|
}
|
||||||
skipstats = lua_optboolean(L, 1);
|
skipstats = lua_optboolean(L, 1);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nextmapoverride = 0;
|
||||||
|
skipstats = false;
|
||||||
|
}
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lib_gExitLevel(lua_State *L)
|
||||||
|
{
|
||||||
|
int n = lua_gettop(L); // Num arguments
|
||||||
|
NOHUD
|
||||||
|
// Moved this bit to G_SetCustomExitVars
|
||||||
|
if (n >= 1) // Don't run the reset to defaults option
|
||||||
|
lib_gSetCustomExitVars(L);
|
||||||
G_ExitLevel();
|
G_ExitLevel();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2165,6 +2201,10 @@ static luaL_Reg lib[] = {
|
||||||
{"R_Frame2Char",lib_rFrame2Char},
|
{"R_Frame2Char",lib_rFrame2Char},
|
||||||
{"R_SetPlayerSkin",lib_rSetPlayerSkin},
|
{"R_SetPlayerSkin",lib_rSetPlayerSkin},
|
||||||
|
|
||||||
|
// r_data
|
||||||
|
{"R_CheckTextureNumForName",lib_rCheckTextureNumForName},
|
||||||
|
{"R_TextureNumForName",lib_rTextureNumForName},
|
||||||
|
|
||||||
// s_sound
|
// s_sound
|
||||||
{"S_StartSound",lib_sStartSound},
|
{"S_StartSound",lib_sStartSound},
|
||||||
{"S_StartSoundAtVolume",lib_sStartSoundAtVolume},
|
{"S_StartSoundAtVolume",lib_sStartSoundAtVolume},
|
||||||
|
@ -2179,6 +2219,7 @@ static luaL_Reg lib[] = {
|
||||||
// g_game
|
// g_game
|
||||||
{"G_BuildMapName",lib_gBuildMapName},
|
{"G_BuildMapName",lib_gBuildMapName},
|
||||||
{"G_DoReborn",lib_gDoReborn},
|
{"G_DoReborn",lib_gDoReborn},
|
||||||
|
{"G_SetCustomExitVars",lib_gSetCustomExitVars},
|
||||||
{"G_ExitLevel",lib_gExitLevel},
|
{"G_ExitLevel",lib_gExitLevel},
|
||||||
{"G_IsSpecialStage",lib_gIsSpecialStage},
|
{"G_IsSpecialStage",lib_gIsSpecialStage},
|
||||||
{"G_GametypeUsesLives",lib_gGametypeUsesLives},
|
{"G_GametypeUsesLives",lib_gGametypeUsesLives},
|
||||||
|
|
|
@ -795,16 +795,16 @@ static int side_set(lua_State *L)
|
||||||
side->rowoffset = luaL_checkfixed(L, 3);
|
side->rowoffset = luaL_checkfixed(L, 3);
|
||||||
break;
|
break;
|
||||||
case side_toptexture:
|
case side_toptexture:
|
||||||
side->toptexture = luaL_checkinteger(L, 3);
|
side->toptexture = luaL_checkinteger(L, 3);
|
||||||
break;
|
break;
|
||||||
case side_bottomtexture:
|
case side_bottomtexture:
|
||||||
side->bottomtexture = luaL_checkinteger(L, 3);
|
side->bottomtexture = luaL_checkinteger(L, 3);
|
||||||
break;
|
break;
|
||||||
case side_midtexture:
|
case side_midtexture:
|
||||||
side->midtexture = luaL_checkinteger(L, 3);
|
side->midtexture = luaL_checkinteger(L, 3);
|
||||||
break;
|
break;
|
||||||
case side_repeatcnt:
|
case side_repeatcnt:
|
||||||
side->repeatcnt = luaL_checkinteger(L, 3);
|
side->repeatcnt = luaL_checkinteger(L, 3);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1504,6 +1504,8 @@ static int mapheaderinfo_get(lua_State *L)
|
||||||
lua_pushinteger(L, header->levelselect);
|
lua_pushinteger(L, header->levelselect);
|
||||||
else if (fastcmp(field,"bonustype"))
|
else if (fastcmp(field,"bonustype"))
|
||||||
lua_pushinteger(L, header->bonustype);
|
lua_pushinteger(L, header->bonustype);
|
||||||
|
else if (fastcmp(field,"saveoverride"))
|
||||||
|
lua_pushinteger(L, header->saveoverride);
|
||||||
else if (fastcmp(field,"levelflags"))
|
else if (fastcmp(field,"levelflags"))
|
||||||
lua_pushinteger(L, header->levelflags);
|
lua_pushinteger(L, header->levelflags);
|
||||||
else if (fastcmp(field,"menuflags"))
|
else if (fastcmp(field,"menuflags"))
|
||||||
|
|
14
src/m_misc.c
14
src/m_misc.c
|
@ -518,6 +518,7 @@ void M_FirstLoadConfig(void)
|
||||||
void M_SaveConfig(const char *filename)
|
void M_SaveConfig(const char *filename)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
char *filepath;
|
||||||
|
|
||||||
// make sure not to write back the config until it's been correctly loaded
|
// make sure not to write back the config until it's been correctly loaded
|
||||||
if (!gameconfig_loaded)
|
if (!gameconfig_loaded)
|
||||||
|
@ -532,13 +533,20 @@ void M_SaveConfig(const char *filename)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
f = fopen(filename, "w");
|
// append srb2home to beginning of filename
|
||||||
|
// but check if srb2home isn't already there, first
|
||||||
|
if (!strstr(filename, srb2home))
|
||||||
|
filepath = va(pandf,srb2home, filename);
|
||||||
|
else
|
||||||
|
filepath = Z_StrDup(filename);
|
||||||
|
|
||||||
|
f = fopen(filepath, "w");
|
||||||
// change it only if valid
|
// change it only if valid
|
||||||
if (f)
|
if (f)
|
||||||
strcpy(configfile, filename);
|
strcpy(configfile, filepath);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_ERROR, M_GetText("Couldn't save game config file %s\n"), filename);
|
CONS_Alert(CONS_ERROR, M_GetText("Couldn't save game config file %s\n"), filepath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,9 +41,6 @@
|
||||||
// Convenience macro to fix issue with collision along bottom/left edges of blockmap -Red
|
// Convenience macro to fix issue with collision along bottom/left edges of blockmap -Red
|
||||||
#define BMBOUNDFIX(xl, xh, yl, yh) {if (xl > xh) xl = 0; if (yl > yh) yl = 0;}
|
#define BMBOUNDFIX(xl, xh, yl, yh) {if (xl > xh) xl = 0; if (yl > yh) yl = 0;}
|
||||||
|
|
||||||
// player radius used only in am_map.c
|
|
||||||
#define PLAYERRADIUS (16*FRACUNIT)
|
|
||||||
|
|
||||||
// MAXRADIUS is for precalculated sector block boxes
|
// MAXRADIUS is for precalculated sector block boxes
|
||||||
// the spider demon is larger,
|
// the spider demon is larger,
|
||||||
// but we do not have any moving sectors nearby
|
// but we do not have any moving sectors nearby
|
||||||
|
|
|
@ -3506,7 +3506,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
|
||||||
|
|
||||||
if (player->pflags & PF_FLIPCAM && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP)
|
if (player->pflags & PF_FLIPCAM && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP)
|
||||||
postimg = postimg_flip;
|
postimg = postimg_flip;
|
||||||
else if (player->awayviewtics && player->awayviewmobj != NULL) // Camera must obviously exist
|
else if (player->awayviewtics && player->awayviewmobj && !P_MobjWasRemoved(player->awayviewmobj)) // Camera must obviously exist
|
||||||
{
|
{
|
||||||
camera_t dummycam;
|
camera_t dummycam;
|
||||||
dummycam.subsector = player->awayviewmobj->subsector;
|
dummycam.subsector = player->awayviewmobj->subsector;
|
||||||
|
|
|
@ -219,6 +219,8 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
|
||||||
mapheaderinfo[num]->levelselect = 0;
|
mapheaderinfo[num]->levelselect = 0;
|
||||||
DEH_WriteUndoline("BONUSTYPE", va("%d", mapheaderinfo[num]->bonustype), UNDO_NONE);
|
DEH_WriteUndoline("BONUSTYPE", va("%d", mapheaderinfo[num]->bonustype), UNDO_NONE);
|
||||||
mapheaderinfo[num]->bonustype = 0;
|
mapheaderinfo[num]->bonustype = 0;
|
||||||
|
DEH_WriteUndoline("SAVEOVERRIDE", va("%d", mapheaderinfo[num]->saveoverride), UNDO_NONE);
|
||||||
|
mapheaderinfo[num]->saveoverride = SAVE_DEFAULT;
|
||||||
DEH_WriteUndoline("LEVELFLAGS", va("%d", mapheaderinfo[num]->levelflags), UNDO_NONE);
|
DEH_WriteUndoline("LEVELFLAGS", va("%d", mapheaderinfo[num]->levelflags), UNDO_NONE);
|
||||||
mapheaderinfo[num]->levelflags = 0;
|
mapheaderinfo[num]->levelflags = 0;
|
||||||
DEH_WriteUndoline("MENUFLAGS", va("%d", mapheaderinfo[num]->menuflags), UNDO_NONE);
|
DEH_WriteUndoline("MENUFLAGS", va("%d", mapheaderinfo[num]->menuflags), UNDO_NONE);
|
||||||
|
@ -1994,7 +1996,7 @@ static boolean P_LoadRawBlockMap(UINT8 *data, size_t count, const char *lumpname
|
||||||
if (!count || count >= 0x20000)
|
if (!count || count >= 0x20000)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
CONS_Printf("Reading blockmap lump for pk3...\n");
|
//CONS_Printf("Reading blockmap lump for pk3...\n");
|
||||||
|
|
||||||
// no need to malloc anything, assume the data is uncompressed for now
|
// no need to malloc anything, assume the data is uncompressed for now
|
||||||
count /= 2;
|
count /= 2;
|
||||||
|
@ -2620,6 +2622,28 @@ static void P_SetupCamera(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static boolean P_CanSave(void)
|
||||||
|
{
|
||||||
|
// Saving is completely ignored under these conditions:
|
||||||
|
if ((cursaveslot < 0) // Playing without saving
|
||||||
|
|| (!modifiedgame || savemoddata) // Game is modified
|
||||||
|
|| (netgame || multiplayer) // Not in single-player
|
||||||
|
|| (demoplayback || demorecording || metalrecording) // Currently in demo
|
||||||
|
|| (players[consoleplayer].lives <= 0) // Completely dead
|
||||||
|
|| (modeattacking || ultimatemode || G_IsSpecialStage(gamemap))) // Specialized instances
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (mapheaderinfo[gamemap-1]->saveoverride == SAVE_ALWAYS)
|
||||||
|
return true; // Saving should ALWAYS happen!
|
||||||
|
else if (mapheaderinfo[gamemap-1]->saveoverride == SAVE_NEVER)
|
||||||
|
return false; // Saving should NEVER happen!
|
||||||
|
|
||||||
|
// Default condition: In a non-hidden map, at the beginning of a zone or on a completed save-file, and not on save reload.
|
||||||
|
return (!(mapheaderinfo[gamemap-1]->menuflags & LF2_HIDEINMENU)
|
||||||
|
&& (mapheaderinfo[gamemap-1]->actnum < 2 || gamecomplete)
|
||||||
|
&& (gamemap != lastmapsaved));
|
||||||
|
}
|
||||||
|
|
||||||
/** Loads a level from a lump or external wad.
|
/** Loads a level from a lump or external wad.
|
||||||
*
|
*
|
||||||
* \param skipprecip If true, don't spawn precipitation.
|
* \param skipprecip If true, don't spawn precipitation.
|
||||||
|
@ -3097,10 +3121,7 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||||
|
|
||||||
P_RunCachedActions();
|
P_RunCachedActions();
|
||||||
|
|
||||||
if (!(netgame || multiplayer || demoplayback || demorecording || metalrecording || modeattacking || players[consoleplayer].lives <= 0)
|
if (P_CanSave())
|
||||||
&& (!modifiedgame || savemoddata) && cursaveslot >= 0 && !ultimatemode
|
|
||||||
&& !(mapheaderinfo[gamemap-1]->menuflags & LF2_HIDEINMENU)
|
|
||||||
&& (!G_IsSpecialStage(gamemap)) && gamemap != lastmapsaved && (mapheaderinfo[gamemap-1]->actnum < 2 || gamecomplete))
|
|
||||||
G_SaveGame((UINT32)cursaveslot);
|
G_SaveGame((UINT32)cursaveslot);
|
||||||
|
|
||||||
if (savedata.lives > 0)
|
if (savedata.lives > 0)
|
||||||
|
|
26
src/p_user.c
26
src/p_user.c
|
@ -8372,7 +8372,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||||
if (!(multiplayer || netgame) && !splitscreen)
|
if (!(multiplayer || netgame) && !splitscreen)
|
||||||
{
|
{
|
||||||
fixed_t vx = thiscam->x, vy = thiscam->y;
|
fixed_t vx = thiscam->x, vy = thiscam->y;
|
||||||
if (player->awayviewtics && player->awayviewmobj != NULL) // Camera must obviously exist
|
if (player->awayviewtics && player->awayviewmobj != NULL && !P_MobjWasRemoved(player->awayviewmobj)) // Camera must obviously exist
|
||||||
{
|
{
|
||||||
vx = player->awayviewmobj->x;
|
vx = player->awayviewmobj->x;
|
||||||
vy = player->awayviewmobj->y;
|
vy = player->awayviewmobj->y;
|
||||||
|
@ -8534,7 +8534,7 @@ static void P_CalcPostImg(player_t *player)
|
||||||
else
|
else
|
||||||
pviewheight = player->mo->z + player->viewheight;
|
pviewheight = player->mo->z + player->viewheight;
|
||||||
|
|
||||||
if (player->awayviewtics)
|
if (player->awayviewtics && player->awayviewmobj && !P_MobjWasRemoved(player->awayviewmobj))
|
||||||
{
|
{
|
||||||
sector = player->awayviewmobj->subsector->sector;
|
sector = player->awayviewmobj->subsector->sector;
|
||||||
pviewheight = player->awayviewmobj->z + 20*FRACUNIT;
|
pviewheight = player->awayviewmobj->z + 20*FRACUNIT;
|
||||||
|
@ -8701,6 +8701,13 @@ void P_PlayerThink(player_t *player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (player->awayviewmobj && P_MobjWasRemoved(player->awayviewmobj))
|
||||||
|
{
|
||||||
|
P_SetTarget(&player->awayviewmobj, NULL); // remove awayviewmobj asap if invalid
|
||||||
|
player->awayviewtics = 0; // reset to zero
|
||||||
|
}
|
||||||
|
|
||||||
if (player->pflags & PF_GLIDING)
|
if (player->pflags & PF_GLIDING)
|
||||||
{
|
{
|
||||||
if (player->panim != PA_ABILITY)
|
if (player->panim != PA_ABILITY)
|
||||||
|
@ -8712,9 +8719,14 @@ void P_PlayerThink(player_t *player)
|
||||||
if (player->flashcount)
|
if (player->flashcount)
|
||||||
player->flashcount--;
|
player->flashcount--;
|
||||||
|
|
||||||
// By the time P_MoveChaseCamera is called, this might be zero. Do not do it here.
|
// Re-fixed by Jimita (11-12-2018)
|
||||||
//if (player->awayviewtics)
|
if (player->awayviewtics)
|
||||||
// player->awayviewtics--;
|
{
|
||||||
|
player->awayviewtics--;
|
||||||
|
if (!player->awayviewtics)
|
||||||
|
player->awayviewtics = -1;
|
||||||
|
// The timer might've reached zero, but we'll run the remote view camera anyway by setting it to -1.
|
||||||
|
}
|
||||||
|
|
||||||
/// \note do this in the cheat code
|
/// \note do this in the cheat code
|
||||||
if (player->pflags & PF_NOCLIP)
|
if (player->pflags & PF_NOCLIP)
|
||||||
|
@ -9492,8 +9504,8 @@ void P_PlayerAfterThink(player_t *player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->awayviewtics)
|
if (player->awayviewtics < 0)
|
||||||
player->awayviewtics--;
|
player->awayviewtics = 0;
|
||||||
|
|
||||||
// spectator invisibility and nogravity.
|
// spectator invisibility and nogravity.
|
||||||
if ((netgame || multiplayer) && player->spectator)
|
if ((netgame || multiplayer) && player->spectator)
|
||||||
|
|
|
@ -1083,7 +1083,6 @@ static void R_Subsector(size_t num)
|
||||||
}
|
}
|
||||||
|
|
||||||
light = R_GetPlaneLight(frontsector, polysec->floorheight, viewz < polysec->floorheight);
|
light = R_GetPlaneLight(frontsector, polysec->floorheight, viewz < polysec->floorheight);
|
||||||
light = 0;
|
|
||||||
ffloor[numffloors].plane = R_FindPlane(polysec->floorheight, polysec->floorpic,
|
ffloor[numffloors].plane = R_FindPlane(polysec->floorheight, polysec->floorpic,
|
||||||
polysec->lightlevel, xoff, yoff,
|
polysec->lightlevel, xoff, yoff,
|
||||||
polysec->floorpic_angle-po->angle,
|
polysec->floorpic_angle-po->angle,
|
||||||
|
@ -1131,7 +1130,6 @@ static void R_Subsector(size_t num)
|
||||||
}
|
}
|
||||||
|
|
||||||
light = R_GetPlaneLight(frontsector, polysec->ceilingheight, viewz < polysec->ceilingheight);
|
light = R_GetPlaneLight(frontsector, polysec->ceilingheight, viewz < polysec->ceilingheight);
|
||||||
light = 0;
|
|
||||||
ffloor[numffloors].plane = R_FindPlane(polysec->ceilingheight, polysec->ceilingpic,
|
ffloor[numffloors].plane = R_FindPlane(polysec->ceilingheight, polysec->ceilingpic,
|
||||||
polysec->lightlevel, xoff, yoff, polysec->ceilingpic_angle-po->angle,
|
polysec->lightlevel, xoff, yoff, polysec->ceilingpic_angle-po->angle,
|
||||||
NULL, NULL
|
NULL, NULL
|
||||||
|
|
289
src/r_main.c
289
src/r_main.c
|
@ -574,13 +574,11 @@ void R_SetViewSize(void)
|
||||||
//
|
//
|
||||||
void R_ExecuteSetViewSize(void)
|
void R_ExecuteSetViewSize(void)
|
||||||
{
|
{
|
||||||
fixed_t cosadj;
|
|
||||||
fixed_t dy;
|
fixed_t dy;
|
||||||
INT32 i;
|
INT32 i;
|
||||||
INT32 j;
|
INT32 j;
|
||||||
INT32 level;
|
INT32 level;
|
||||||
INT32 startmapl;
|
INT32 startmapl;
|
||||||
INT32 aspectx; //added : 02-02-98 : for aspect ratio calc. below...
|
|
||||||
|
|
||||||
setsizeneeded = false;
|
setsizeneeded = false;
|
||||||
|
|
||||||
|
@ -620,31 +618,22 @@ void R_ExecuteSetViewSize(void)
|
||||||
for (i = 0; i < viewwidth; i++)
|
for (i = 0; i < viewwidth; i++)
|
||||||
screenheightarray[i] = (INT16)viewheight;
|
screenheightarray[i] = (INT16)viewheight;
|
||||||
|
|
||||||
// setup sky scaling (uses pspriteyscale)
|
// setup sky scaling
|
||||||
R_SetSkyScale();
|
R_SetSkyScale();
|
||||||
|
|
||||||
// planes
|
// planes
|
||||||
//aspectx = (((vid.height*centerx*BASEVIDWIDTH)/BASEVIDHEIGHT)/vid.width);
|
|
||||||
aspectx = centerx;
|
|
||||||
|
|
||||||
if (rendermode == render_soft)
|
if (rendermode == render_soft)
|
||||||
{
|
{
|
||||||
// this is only used for planes rendering in software mode
|
// this is only used for planes rendering in software mode
|
||||||
j = viewheight*8;
|
j = viewheight*16;
|
||||||
for (i = 0; i < j; i++)
|
for (i = 0; i < j; i++)
|
||||||
{
|
{
|
||||||
dy = ((i - viewheight*2)<<FRACBITS) + FRACUNIT/2;
|
dy = ((i - viewheight*8)<<FRACBITS) + FRACUNIT/2;
|
||||||
dy = abs(dy);
|
dy = abs(dy);
|
||||||
yslopetab[i] = FixedDiv(aspectx*FRACUNIT, dy);
|
yslopetab[i] = FixedDiv(centerx*FRACUNIT, dy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < viewwidth; i++)
|
|
||||||
{
|
|
||||||
cosadj = abs(FINECOSINE(xtoviewangle[i]>>ANGLETOFINESHIFT));
|
|
||||||
distscale[i] = FixedDiv(FRACUNIT, cosadj);
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(scalelight, 0xFF, sizeof(scalelight));
|
memset(scalelight, 0xFF, sizeof(scalelight));
|
||||||
|
|
||||||
// Calculate the light levels to use for each level/scale combination.
|
// Calculate the light levels to use for each level/scale combination.
|
||||||
|
@ -757,9 +746,136 @@ static mobj_t *viewmobj;
|
||||||
// WARNING: a should be unsigned but to add with 2048, it isn't!
|
// WARNING: a should be unsigned but to add with 2048, it isn't!
|
||||||
#define AIMINGTODY(a) ((FINETANGENT((2048+(((INT32)a)>>ANGLETOFINESHIFT)) & FINEMASK)*160)>>FRACBITS)
|
#define AIMINGTODY(a) ((FINETANGENT((2048+(((INT32)a)>>ANGLETOFINESHIFT)) & FINEMASK)*160)>>FRACBITS)
|
||||||
|
|
||||||
void R_SkyboxFrame(player_t *player)
|
// recalc necessary stuff for mouseaiming
|
||||||
|
// slopes are already calculated for the full possible view (which is 4*viewheight).
|
||||||
|
// 18/08/18: (No it's actually 16*viewheight, thanks Jimita for finding this out)
|
||||||
|
static void R_SetupFreelook(void)
|
||||||
{
|
{
|
||||||
INT32 dy = 0;
|
INT32 dy = 0;
|
||||||
|
if (rendermode == render_soft)
|
||||||
|
{
|
||||||
|
// clip it in the case we are looking a hardware 90 degrees full aiming
|
||||||
|
// (lmps, network and use F12...)
|
||||||
|
G_SoftwareClipAimingPitch((INT32 *)&aimingangle);
|
||||||
|
dy = AIMINGTODY(aimingangle) * viewwidth/BASEVIDWIDTH;
|
||||||
|
yslope = &yslopetab[viewheight*8 - (viewheight/2 + dy)];
|
||||||
|
}
|
||||||
|
centery = (viewheight/2) + dy;
|
||||||
|
centeryfrac = centery<<FRACBITS;
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef AIMINGTODY
|
||||||
|
|
||||||
|
void R_SetupFrame(player_t *player, boolean skybox)
|
||||||
|
{
|
||||||
|
camera_t *thiscam;
|
||||||
|
boolean chasecam = false;
|
||||||
|
|
||||||
|
if (splitscreen && player == &players[secondarydisplayplayer]
|
||||||
|
&& player != &players[consoleplayer])
|
||||||
|
{
|
||||||
|
thiscam = &camera2;
|
||||||
|
chasecam = (cv_chasecam2.value != 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
thiscam = &camera;
|
||||||
|
chasecam = (cv_chasecam.value != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player->climbing || (player->pflags & PF_NIGHTSMODE) || player->playerstate == PST_DEAD)
|
||||||
|
chasecam = true; // force chasecam on
|
||||||
|
else if (player->spectator) // no spectator chasecam
|
||||||
|
chasecam = false; // force chasecam off
|
||||||
|
|
||||||
|
if (chasecam && !thiscam->chase)
|
||||||
|
{
|
||||||
|
P_ResetCamera(player, thiscam);
|
||||||
|
thiscam->chase = true;
|
||||||
|
}
|
||||||
|
else if (!chasecam)
|
||||||
|
thiscam->chase = false;
|
||||||
|
|
||||||
|
viewsky = !skybox;
|
||||||
|
if (player->awayviewtics)
|
||||||
|
{
|
||||||
|
// cut-away view stuff
|
||||||
|
viewmobj = player->awayviewmobj; // should be a MT_ALTVIEWMAN
|
||||||
|
I_Assert(viewmobj != NULL);
|
||||||
|
viewz = viewmobj->z + 20*FRACUNIT;
|
||||||
|
aimingangle = player->awayviewaiming;
|
||||||
|
viewangle = viewmobj->angle;
|
||||||
|
}
|
||||||
|
else if (!player->spectator && chasecam)
|
||||||
|
// use outside cam view
|
||||||
|
{
|
||||||
|
viewmobj = NULL;
|
||||||
|
viewz = thiscam->z + (thiscam->height>>1);
|
||||||
|
aimingangle = thiscam->aiming;
|
||||||
|
viewangle = thiscam->angle;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
// use the player's eyes view
|
||||||
|
{
|
||||||
|
viewz = player->viewz;
|
||||||
|
|
||||||
|
viewmobj = player->mo;
|
||||||
|
I_Assert(viewmobj != NULL);
|
||||||
|
|
||||||
|
aimingangle = player->aiming;
|
||||||
|
viewangle = viewmobj->angle;
|
||||||
|
|
||||||
|
if (!demoplayback && player->playerstate != PST_DEAD)
|
||||||
|
{
|
||||||
|
if (player == &players[consoleplayer])
|
||||||
|
{
|
||||||
|
viewangle = localangle; // WARNING: camera uses this
|
||||||
|
aimingangle = localaiming;
|
||||||
|
}
|
||||||
|
else if (player == &players[secondarydisplayplayer])
|
||||||
|
{
|
||||||
|
viewangle = localangle2;
|
||||||
|
aimingangle = localaiming2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
viewz += quake.z;
|
||||||
|
|
||||||
|
viewplayer = player;
|
||||||
|
|
||||||
|
if (chasecam && !player->awayviewtics && !player->spectator)
|
||||||
|
{
|
||||||
|
viewx = thiscam->x;
|
||||||
|
viewy = thiscam->y;
|
||||||
|
viewx += quake.x;
|
||||||
|
viewy += quake.y;
|
||||||
|
|
||||||
|
if (thiscam->subsector)
|
||||||
|
viewsector = thiscam->subsector->sector;
|
||||||
|
else
|
||||||
|
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
viewx = viewmobj->x;
|
||||||
|
viewy = viewmobj->y;
|
||||||
|
viewx += quake.x;
|
||||||
|
viewy += quake.y;
|
||||||
|
|
||||||
|
if (viewmobj->subsector)
|
||||||
|
viewsector = viewmobj->subsector->sector;
|
||||||
|
else
|
||||||
|
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
||||||
|
}
|
||||||
|
|
||||||
|
viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
|
||||||
|
viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
|
||||||
|
|
||||||
|
R_SetupFreelook();
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_SkyboxFrame(player_t *player)
|
||||||
|
{
|
||||||
camera_t *thiscam;
|
camera_t *thiscam;
|
||||||
|
|
||||||
if (splitscreen && player == &players[secondarydisplayplayer]
|
if (splitscreen && player == &players[secondarydisplayplayer]
|
||||||
|
@ -973,146 +1089,7 @@ void R_SkyboxFrame(player_t *player)
|
||||||
viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
|
viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
|
||||||
viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
|
viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
|
||||||
|
|
||||||
// recalc necessary stuff for mouseaiming
|
R_SetupFreelook();
|
||||||
// slopes are already calculated for the full possible view (which is 4*viewheight).
|
|
||||||
// 18/08/18: (No it's actually 8*viewheight, thanks MPC aka Jimita for finding this out)
|
|
||||||
|
|
||||||
if (rendermode == render_soft)
|
|
||||||
{
|
|
||||||
// clip it in the case we are looking a hardware 90 degrees full aiming
|
|
||||||
// (lmps, network and use F12...)
|
|
||||||
G_SoftwareClipAimingPitch((INT32 *)&aimingangle);
|
|
||||||
|
|
||||||
dy = AIMINGTODY(aimingangle) * viewwidth/BASEVIDWIDTH;
|
|
||||||
|
|
||||||
yslope = &yslopetab[(3*viewheight/2) - dy];
|
|
||||||
}
|
|
||||||
centery = (viewheight/2) + dy;
|
|
||||||
centeryfrac = centery<<FRACBITS;
|
|
||||||
}
|
|
||||||
|
|
||||||
void R_SetupFrame(player_t *player, boolean skybox)
|
|
||||||
{
|
|
||||||
INT32 dy = 0;
|
|
||||||
camera_t *thiscam;
|
|
||||||
boolean chasecam = false;
|
|
||||||
|
|
||||||
if (splitscreen && player == &players[secondarydisplayplayer]
|
|
||||||
&& player != &players[consoleplayer])
|
|
||||||
{
|
|
||||||
thiscam = &camera2;
|
|
||||||
chasecam = (cv_chasecam2.value != 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
thiscam = &camera;
|
|
||||||
chasecam = (cv_chasecam.value != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player->climbing || (player->pflags & PF_NIGHTSMODE) || player->playerstate == PST_DEAD)
|
|
||||||
chasecam = true; // force chasecam on
|
|
||||||
else if (player->spectator) // no spectator chasecam
|
|
||||||
chasecam = false; // force chasecam off
|
|
||||||
|
|
||||||
if (chasecam && !thiscam->chase)
|
|
||||||
{
|
|
||||||
P_ResetCamera(player, thiscam);
|
|
||||||
thiscam->chase = true;
|
|
||||||
}
|
|
||||||
else if (!chasecam)
|
|
||||||
thiscam->chase = false;
|
|
||||||
|
|
||||||
viewsky = !skybox;
|
|
||||||
if (player->awayviewtics)
|
|
||||||
{
|
|
||||||
// cut-away view stuff
|
|
||||||
viewmobj = player->awayviewmobj; // should be a MT_ALTVIEWMAN
|
|
||||||
I_Assert(viewmobj != NULL);
|
|
||||||
viewz = viewmobj->z + 20*FRACUNIT;
|
|
||||||
aimingangle = player->awayviewaiming;
|
|
||||||
viewangle = viewmobj->angle;
|
|
||||||
}
|
|
||||||
else if (!player->spectator && chasecam)
|
|
||||||
// use outside cam view
|
|
||||||
{
|
|
||||||
viewmobj = NULL;
|
|
||||||
viewz = thiscam->z + (thiscam->height>>1);
|
|
||||||
aimingangle = thiscam->aiming;
|
|
||||||
viewangle = thiscam->angle;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
// use the player's eyes view
|
|
||||||
{
|
|
||||||
viewz = player->viewz;
|
|
||||||
|
|
||||||
viewmobj = player->mo;
|
|
||||||
I_Assert(viewmobj != NULL);
|
|
||||||
|
|
||||||
aimingangle = player->aiming;
|
|
||||||
viewangle = viewmobj->angle;
|
|
||||||
|
|
||||||
if (!demoplayback && player->playerstate != PST_DEAD)
|
|
||||||
{
|
|
||||||
if (player == &players[consoleplayer])
|
|
||||||
{
|
|
||||||
viewangle = localangle; // WARNING: camera uses this
|
|
||||||
aimingangle = localaiming;
|
|
||||||
}
|
|
||||||
else if (player == &players[secondarydisplayplayer])
|
|
||||||
{
|
|
||||||
viewangle = localangle2;
|
|
||||||
aimingangle = localaiming2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
viewz += quake.z;
|
|
||||||
|
|
||||||
viewplayer = player;
|
|
||||||
|
|
||||||
if (chasecam && !player->awayviewtics && !player->spectator)
|
|
||||||
{
|
|
||||||
viewx = thiscam->x;
|
|
||||||
viewy = thiscam->y;
|
|
||||||
viewx += quake.x;
|
|
||||||
viewy += quake.y;
|
|
||||||
|
|
||||||
if (thiscam->subsector)
|
|
||||||
viewsector = thiscam->subsector->sector;
|
|
||||||
else
|
|
||||||
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
viewx = viewmobj->x;
|
|
||||||
viewy = viewmobj->y;
|
|
||||||
viewx += quake.x;
|
|
||||||
viewy += quake.y;
|
|
||||||
|
|
||||||
if (viewmobj->subsector)
|
|
||||||
viewsector = viewmobj->subsector->sector;
|
|
||||||
else
|
|
||||||
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
|
||||||
}
|
|
||||||
|
|
||||||
viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
|
|
||||||
viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
|
|
||||||
|
|
||||||
// recalc necessary stuff for mouseaiming
|
|
||||||
// slopes are already calculated for the full possible view (which is 4*viewheight).
|
|
||||||
// 18/08/18: (No it's actually 8*viewheight, thanks MPC aka Jimita for finding this out)
|
|
||||||
|
|
||||||
if (rendermode == render_soft)
|
|
||||||
{
|
|
||||||
// clip it in the case we are looking a hardware 90 degrees full aiming
|
|
||||||
// (lmps, network and use F12...)
|
|
||||||
G_SoftwareClipAimingPitch((INT32 *)&aimingangle);
|
|
||||||
|
|
||||||
dy = AIMINGTODY(aimingangle) * viewwidth/BASEVIDWIDTH;
|
|
||||||
|
|
||||||
yslope = &yslopetab[(3*viewheight/2) - dy];
|
|
||||||
}
|
|
||||||
centery = (viewheight/2) + dy;
|
|
||||||
centeryfrac = centery<<FRACBITS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ANGLED_PORTALS
|
#define ANGLED_PORTALS
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
|
#include "p_setup.h" // levelflats
|
||||||
|
#include "p_slopes.h"
|
||||||
#include "r_data.h"
|
#include "r_data.h"
|
||||||
#include "r_local.h"
|
#include "r_local.h"
|
||||||
#include "r_state.h"
|
#include "r_state.h"
|
||||||
|
@ -26,9 +28,12 @@
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
#include "p_tick.h"
|
#include "p_tick.h"
|
||||||
|
|
||||||
#include "p_setup.h" // levelflats
|
#ifdef TIMING
|
||||||
|
#include "p5prof.h"
|
||||||
#include "p_slopes.h"
|
INT64 mycount;
|
||||||
|
INT64 mytotal = 0;
|
||||||
|
UINT32 nombre = 100000;
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// opening
|
// opening
|
||||||
|
@ -51,7 +56,7 @@ visplane_t *floorplane;
|
||||||
visplane_t *ceilingplane;
|
visplane_t *ceilingplane;
|
||||||
static visplane_t *currentplane;
|
static visplane_t *currentplane;
|
||||||
|
|
||||||
planemgr_t ffloor[MAXFFLOORS];
|
visffloor_t ffloor[MAXFFLOORS];
|
||||||
INT32 numffloors;
|
INT32 numffloors;
|
||||||
|
|
||||||
//SoM: 3/23/2000: Boom visplane hashing routine.
|
//SoM: 3/23/2000: Boom visplane hashing routine.
|
||||||
|
@ -89,10 +94,9 @@ static fixed_t planeheight;
|
||||||
// (this is to calculate yslopes only when really needed)
|
// (this is to calculate yslopes only when really needed)
|
||||||
// (when mouselookin', yslope is moving into yslopetab)
|
// (when mouselookin', yslope is moving into yslopetab)
|
||||||
// Check R_SetupFrame, R_SetViewSize for more...
|
// Check R_SetupFrame, R_SetViewSize for more...
|
||||||
fixed_t yslopetab[MAXVIDHEIGHT*8];
|
fixed_t yslopetab[MAXVIDHEIGHT*16];
|
||||||
fixed_t *yslope;
|
fixed_t *yslope;
|
||||||
|
|
||||||
fixed_t distscale[MAXVIDWIDTH];
|
|
||||||
fixed_t basexscale, baseyscale;
|
fixed_t basexscale, baseyscale;
|
||||||
|
|
||||||
fixed_t cachedheight[MAXVIDHEIGHT];
|
fixed_t cachedheight[MAXVIDHEIGHT];
|
||||||
|
@ -155,34 +159,19 @@ void R_PortalRestoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//profile stuff ---------------------------------------------------------
|
|
||||||
//#define TIMING
|
|
||||||
#ifdef TIMING
|
|
||||||
#include "p5prof.h"
|
|
||||||
INT64 mycount;
|
|
||||||
INT64 mytotal = 0;
|
|
||||||
UINT32 nombre = 100000;
|
|
||||||
#endif
|
|
||||||
//profile stuff ---------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// R_MapPlane
|
// R_MapPlane
|
||||||
//
|
//
|
||||||
// Uses global vars:
|
// Uses global vars:
|
||||||
// planeheight
|
|
||||||
// ds_source
|
|
||||||
// basexscale
|
// basexscale
|
||||||
// baseyscale
|
// baseyscale
|
||||||
|
// centerx
|
||||||
// viewx
|
// viewx
|
||||||
// viewy
|
// viewy
|
||||||
// xoffs
|
// viewsin
|
||||||
// yoffs
|
// viewcos
|
||||||
// planeangle
|
// viewheight
|
||||||
//
|
|
||||||
// BASIC PRIMITIVE
|
|
||||||
//
|
|
||||||
#ifndef NOWATER
|
#ifndef NOWATER
|
||||||
static INT32 bgofs;
|
static INT32 bgofs;
|
||||||
static INT32 wtofs=0;
|
static INT32 wtofs=0;
|
||||||
|
@ -190,10 +179,6 @@ static INT32 waterofs;
|
||||||
static boolean itswater;
|
static boolean itswater;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __mips__
|
|
||||||
//#define NOWATER
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NOWATER
|
#ifndef NOWATER
|
||||||
static void R_DrawTranslucentWaterSpan_8(void)
|
static void R_DrawTranslucentWaterSpan_8(void)
|
||||||
{
|
{
|
||||||
|
@ -275,8 +260,8 @@ static void R_DrawTranslucentWaterSpan_8(void)
|
||||||
|
|
||||||
void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
|
void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
|
||||||
{
|
{
|
||||||
angle_t angle;
|
angle_t angle, planecos, planesin;
|
||||||
fixed_t distance, length;
|
fixed_t distance, span;
|
||||||
size_t pindex;
|
size_t pindex;
|
||||||
|
|
||||||
#ifdef RANGECHECK
|
#ifdef RANGECHECK
|
||||||
|
@ -287,12 +272,22 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
|
||||||
// from r_splats's R_RenderFloorSplat
|
// from r_splats's R_RenderFloorSplat
|
||||||
if (x1 >= vid.width) x1 = vid.width - 1;
|
if (x1 >= vid.width) x1 = vid.width - 1;
|
||||||
|
|
||||||
|
angle = (currentplane->viewangle + currentplane->plangle)>>ANGLETOFINESHIFT;
|
||||||
|
planecos = FINECOSINE(angle);
|
||||||
|
planesin = FINESINE(angle);
|
||||||
|
|
||||||
if (planeheight != cachedheight[y])
|
if (planeheight != cachedheight[y])
|
||||||
{
|
{
|
||||||
cachedheight[y] = planeheight;
|
cachedheight[y] = planeheight;
|
||||||
distance = cacheddistance[y] = FixedMul(planeheight, yslope[y]);
|
distance = cacheddistance[y] = FixedMul(planeheight, yslope[y]);
|
||||||
ds_xstep = cachedxstep[y] = FixedMul(distance, basexscale);
|
ds_xstep = cachedxstep[y] = FixedMul(distance, basexscale);
|
||||||
ds_ystep = cachedystep[y] = FixedMul(distance, baseyscale);
|
ds_ystep = cachedystep[y] = FixedMul(distance, baseyscale);
|
||||||
|
|
||||||
|
if ((span = abs(centery-y)))
|
||||||
|
{
|
||||||
|
ds_xstep = cachedxstep[y] = FixedMul(planesin, planeheight) / span;
|
||||||
|
ds_ystep = cachedystep[y] = FixedMul(planecos, planeheight) / span;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -301,13 +296,8 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
|
||||||
ds_ystep = cachedystep[y];
|
ds_ystep = cachedystep[y];
|
||||||
}
|
}
|
||||||
|
|
||||||
length = FixedMul (distance,distscale[x1]);
|
ds_xfrac = xoffs + FixedMul(planecos, distance) + (x1 - centerx) * ds_xstep;
|
||||||
angle = (currentplane->viewangle + currentplane->plangle + xtoviewangle[x1])>>ANGLETOFINESHIFT;
|
ds_yfrac = yoffs - FixedMul(planesin, distance) + (x1 - centerx) * ds_ystep;
|
||||||
/// \note Wouldn't it be faster just to add viewx and viewy
|
|
||||||
// to the plane's x/yoffs anyway??
|
|
||||||
|
|
||||||
ds_xfrac = FixedMul(FINECOSINE(angle), length) + xoffs;
|
|
||||||
ds_yfrac = yoffs - FixedMul(FINESINE(angle), length);
|
|
||||||
|
|
||||||
#ifndef NOWATER
|
#ifndef NOWATER
|
||||||
if (itswater)
|
if (itswater)
|
||||||
|
@ -315,8 +305,9 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
|
||||||
const INT32 yay = (wtofs + (distance>>9) ) & 8191;
|
const INT32 yay = (wtofs + (distance>>9) ) & 8191;
|
||||||
// ripples da water texture
|
// ripples da water texture
|
||||||
bgofs = FixedDiv(FINESINE(yay), (1<<12) + (distance>>11))>>FRACBITS;
|
bgofs = FixedDiv(FINESINE(yay), (1<<12) + (distance>>11))>>FRACBITS;
|
||||||
|
angle = (currentplane->viewangle + currentplane->plangle + xtoviewangle[x1])>>ANGLETOFINESHIFT;
|
||||||
|
|
||||||
angle = (angle + 2048) & 8191; //90<EFBFBD>
|
angle = (angle + 2048) & 8191; // 90 degrees
|
||||||
ds_xfrac += FixedMul(FINECOSINE(angle), (bgofs<<FRACBITS));
|
ds_xfrac += FixedMul(FINECOSINE(angle), (bgofs<<FRACBITS));
|
||||||
ds_yfrac += FixedMul(FINESINE(angle), (bgofs<<FRACBITS));
|
ds_yfrac += FixedMul(FINESINE(angle), (bgofs<<FRACBITS));
|
||||||
|
|
||||||
|
@ -328,7 +319,6 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pindex = distance >> LIGHTZSHIFT;
|
pindex = distance >> LIGHTZSHIFT;
|
||||||
|
|
||||||
if (pindex >= MAXLIGHTZ)
|
if (pindex >= MAXLIGHTZ)
|
||||||
pindex = MAXLIGHTZ - 1;
|
pindex = MAXLIGHTZ - 1;
|
||||||
|
|
||||||
|
@ -365,8 +355,6 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
|
||||||
// R_ClearPlanes
|
// R_ClearPlanes
|
||||||
// At begining of frame.
|
// At begining of frame.
|
||||||
//
|
//
|
||||||
// NOTE: Uses con_clipviewtop, so that when console is on,
|
|
||||||
// we don't draw the part of the view hidden under the console.
|
|
||||||
void R_ClearPlanes(void)
|
void R_ClearPlanes(void)
|
||||||
{
|
{
|
||||||
INT32 i, p;
|
INT32 i, p;
|
||||||
|
@ -376,12 +364,12 @@ void R_ClearPlanes(void)
|
||||||
for (i = 0; i < viewwidth; i++)
|
for (i = 0; i < viewwidth; i++)
|
||||||
{
|
{
|
||||||
floorclip[i] = (INT16)viewheight;
|
floorclip[i] = (INT16)viewheight;
|
||||||
ceilingclip[i] = (INT16)con_clipviewtop;
|
ceilingclip[i] = -1;
|
||||||
frontscale[i] = INT32_MAX;
|
frontscale[i] = INT32_MAX;
|
||||||
for (p = 0; p < MAXFFLOORS; p++)
|
for (p = 0; p < MAXFFLOORS; p++)
|
||||||
{
|
{
|
||||||
ffloor[p].f_clip[i] = (INT16)viewheight;
|
ffloor[p].f_clip[i] = (INT16)viewheight;
|
||||||
ffloor[p].c_clip[i] = (INT16)con_clipviewtop;
|
ffloor[p].c_clip[i] = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
//
|
//
|
||||||
// Now what is a visplane, anyway?
|
// Now what is a visplane, anyway?
|
||||||
// Simple: kinda floor/ceiling polygon optimised for SRB2 rendering.
|
// Simple: kinda floor/ceiling polygon optimised for SRB2 rendering.
|
||||||
// 7764 bytes! (for win32, anyway)
|
|
||||||
//
|
//
|
||||||
typedef struct visplane_s
|
typedef struct visplane_s
|
||||||
{
|
{
|
||||||
|
@ -39,25 +38,12 @@ typedef struct visplane_s
|
||||||
extracolormap_t *extra_colormap;
|
extracolormap_t *extra_colormap;
|
||||||
|
|
||||||
// leave pads for [minx-1]/[maxx+1]
|
// leave pads for [minx-1]/[maxx+1]
|
||||||
|
UINT16 padtopstart, top[MAXVIDWIDTH], padtopend;
|
||||||
// words sucks .. should get rid of that.. but eats memory
|
UINT16 padbottomstart, bottom[MAXVIDWIDTH], padbottomend;
|
||||||
// THIS IS UNSIGNED! VERY IMPORTANT!!
|
|
||||||
UINT16 pad1;
|
|
||||||
UINT16 top[MAXVIDWIDTH];
|
|
||||||
UINT16 pad2;
|
|
||||||
UINT16 pad3;
|
|
||||||
UINT16 bottom[MAXVIDWIDTH];
|
|
||||||
UINT16 pad4;
|
|
||||||
|
|
||||||
INT32 high, low; // R_PlaneBounds should set these.
|
INT32 high, low; // R_PlaneBounds should set these.
|
||||||
|
|
||||||
fixed_t xoffs, yoffs; // Scrolling flats.
|
fixed_t xoffs, yoffs; // Scrolling flats.
|
||||||
|
|
||||||
// SoM: frontscale should be stored in the first seg of the subsector
|
|
||||||
// where the planes themselves are stored. I'm doing this now because
|
|
||||||
// the old way caused trouble with the drawseg array was re-sized.
|
|
||||||
INT32 scaleseg;
|
|
||||||
|
|
||||||
struct ffloor_s *ffloor;
|
struct ffloor_s *ffloor;
|
||||||
#ifdef POLYOBJECTS_PLANES
|
#ifdef POLYOBJECTS_PLANES
|
||||||
polyobj_t *polyobj;
|
polyobj_t *polyobj;
|
||||||
|
@ -75,17 +61,15 @@ extern INT16 *lastopening, *openings;
|
||||||
extern size_t maxopenings;
|
extern size_t maxopenings;
|
||||||
|
|
||||||
extern INT16 floorclip[MAXVIDWIDTH], ceilingclip[MAXVIDWIDTH];
|
extern INT16 floorclip[MAXVIDWIDTH], ceilingclip[MAXVIDWIDTH];
|
||||||
extern fixed_t frontscale[MAXVIDWIDTH], yslopetab[MAXVIDHEIGHT*8];
|
extern fixed_t frontscale[MAXVIDWIDTH], yslopetab[MAXVIDHEIGHT*16];
|
||||||
extern fixed_t cachedheight[MAXVIDHEIGHT];
|
extern fixed_t cachedheight[MAXVIDHEIGHT];
|
||||||
extern fixed_t cacheddistance[MAXVIDHEIGHT];
|
extern fixed_t cacheddistance[MAXVIDHEIGHT];
|
||||||
extern fixed_t cachedxstep[MAXVIDHEIGHT];
|
extern fixed_t cachedxstep[MAXVIDHEIGHT];
|
||||||
extern fixed_t cachedystep[MAXVIDHEIGHT];
|
extern fixed_t cachedystep[MAXVIDHEIGHT];
|
||||||
extern fixed_t basexscale, baseyscale;
|
extern fixed_t basexscale, baseyscale;
|
||||||
|
|
||||||
extern lighttable_t **planezlight;
|
|
||||||
|
|
||||||
extern fixed_t *yslope;
|
extern fixed_t *yslope;
|
||||||
extern fixed_t distscale[MAXVIDWIDTH];
|
extern lighttable_t **planezlight;
|
||||||
|
|
||||||
void R_InitPlanes(void);
|
void R_InitPlanes(void);
|
||||||
void R_PortalStoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor, fixed_t *scale);
|
void R_PortalStoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor, fixed_t *scale);
|
||||||
|
@ -134,8 +118,8 @@ typedef struct planemgr_s
|
||||||
#ifdef POLYOBJECTS_PLANES
|
#ifdef POLYOBJECTS_PLANES
|
||||||
polyobj_t *polyobj;
|
polyobj_t *polyobj;
|
||||||
#endif
|
#endif
|
||||||
} planemgr_t;
|
} visffloor_t;
|
||||||
|
|
||||||
extern planemgr_t ffloor[MAXFFLOORS];
|
extern visffloor_t ffloor[MAXFFLOORS];
|
||||||
extern INT32 numffloors;
|
extern INT32 numffloors;
|
||||||
#endif
|
#endif
|
||||||
|
|
48
src/r_segs.c
48
src/r_segs.c
|
@ -1344,24 +1344,12 @@ static void R_RenderSegLoop (void)
|
||||||
|
|
||||||
if (markfloor)
|
if (markfloor)
|
||||||
{
|
{
|
||||||
#if 0 // Old Doom Legacy code
|
top = yh < ceilingclip[rw_x] ? ceilingclip[rw_x] : yh;
|
||||||
bottom = floorclip[rw_x]-1;
|
|
||||||
if (top <= ceilingclip[rw_x])
|
|
||||||
top = ceilingclip[rw_x]+1;
|
|
||||||
if (top <= bottom && floorplane)
|
|
||||||
{
|
|
||||||
floorplane->top[rw_x] = (INT16)top;
|
|
||||||
floorplane->bottom[rw_x] = (INT16)bottom;
|
|
||||||
}
|
|
||||||
#else // Spiffy new PRBoom code
|
|
||||||
top = yh < ceilingclip[rw_x] ? ceilingclip[rw_x] : yh;
|
|
||||||
|
|
||||||
if (++top <= bottom && floorplane)
|
if (++top <= bottom && floorplane)
|
||||||
{
|
{
|
||||||
floorplane->top[rw_x] = (INT16)top;
|
floorplane->top[rw_x] = (INT16)top;
|
||||||
floorplane->bottom[rw_x] = (INT16)bottom;
|
floorplane->bottom[rw_x] = (INT16)bottom;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numffloors)
|
if (numffloors)
|
||||||
|
@ -1645,26 +1633,11 @@ static void R_RenderSegLoop (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < numffloors; i++)
|
for (i = 0; i < numffloors; i++)
|
||||||
{
|
|
||||||
#ifdef POLYOBJECTS_PLANES
|
|
||||||
if (ffloor[i].polyobj && (!curline->polyseg || ffloor[i].polyobj != curline->polyseg))
|
|
||||||
continue;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ffloor[i].f_frac += ffloor[i].f_step;
|
ffloor[i].f_frac += ffloor[i].f_step;
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < numbackffloors; i++)
|
for (i = 0; i < numbackffloors; i++)
|
||||||
{
|
{
|
||||||
INT32 y_w;
|
ffloor[i].f_clip[rw_x] = ffloor[i].c_clip[rw_x] = (INT16)((ffloor[i].b_frac >> HEIGHTBITS) & 0xFFFF);
|
||||||
|
|
||||||
#ifdef POLYOBJECTS_PLANES
|
|
||||||
if (ffloor[i].polyobj && (!curline->polyseg || ffloor[i].polyobj != curline->polyseg))
|
|
||||||
continue;
|
|
||||||
#endif
|
|
||||||
y_w = ffloor[i].b_frac >> HEIGHTBITS;
|
|
||||||
|
|
||||||
ffloor[i].f_clip[rw_x] = ffloor[i].c_clip[rw_x] = (INT16)(y_w & 0xFFFF);
|
|
||||||
ffloor[i].b_frac += ffloor[i].b_step;
|
ffloor[i].b_frac += ffloor[i].b_step;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2808,11 +2781,6 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
{
|
{
|
||||||
for (i = 0; i < numffloors; i++)
|
for (i = 0; i < numffloors; i++)
|
||||||
{
|
{
|
||||||
#ifdef POLYOBJECTS_PLANES
|
|
||||||
if (ffloor[i].polyobj && (!curline->polyseg || ffloor[i].polyobj != curline->polyseg))
|
|
||||||
continue;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ffloor[i].f_pos >>= 4;
|
ffloor[i].f_pos >>= 4;
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
ffloor[i].f_pos_slope >>= 4;
|
ffloor[i].f_pos_slope >>= 4;
|
||||||
|
@ -3093,7 +3061,11 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
if (ceilingplane) //SoM: 3/29/2000: Check for null ceiling planes
|
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
|
else
|
||||||
markceiling = 0;
|
markceiling = false;
|
||||||
|
|
||||||
|
// Don't render the ceiling again when rendering polyobjects
|
||||||
|
if (curline->polyseg)
|
||||||
|
markceiling = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get a new or use the same visplane
|
// get a new or use the same visplane
|
||||||
|
@ -3102,7 +3074,11 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
if (floorplane) //SoM: 3/29/2000: Check for null planes
|
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
|
else
|
||||||
markfloor = 0;
|
markfloor = false;
|
||||||
|
|
||||||
|
// Don't render the floor again when rendering polyobjects
|
||||||
|
if (curline->polyseg)
|
||||||
|
markfloor = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ds_p->numffloorplanes = 0;
|
ds_p->numffloorplanes = 0;
|
||||||
|
|
|
@ -365,9 +365,8 @@ static void R_RenderFloorSplat(floorsplat_t *pSplat, vertex_t *verts, UINT8 *pTe
|
||||||
#else
|
#else
|
||||||
lighttable_t **planezlight;
|
lighttable_t **planezlight;
|
||||||
fixed_t planeheight;
|
fixed_t planeheight;
|
||||||
angle_t angle;
|
angle_t angle, planecos, planesin;
|
||||||
fixed_t distance;
|
fixed_t distance, span;
|
||||||
fixed_t length;
|
|
||||||
size_t indexr;
|
size_t indexr;
|
||||||
INT32 light;
|
INT32 light;
|
||||||
#endif
|
#endif
|
||||||
|
@ -473,12 +472,22 @@ static void R_RenderFloorSplat(floorsplat_t *pSplat, vertex_t *verts, UINT8 *pTe
|
||||||
if (x2 >= vid.width)
|
if (x2 >= vid.width)
|
||||||
x2 = vid.width - 1;
|
x2 = vid.width - 1;
|
||||||
|
|
||||||
|
angle = (currentplane->viewangle + currentplane->plangle)>>ANGLETOFINESHIFT;
|
||||||
|
planecos = FINECOSINE(angle);
|
||||||
|
planesin = FINESINE(angle);
|
||||||
|
|
||||||
if (planeheight != cachedheight[y])
|
if (planeheight != cachedheight[y])
|
||||||
{
|
{
|
||||||
cachedheight[y] = planeheight;
|
cachedheight[y] = planeheight;
|
||||||
distance = cacheddistance[y] = FixedMul(planeheight, yslope[y]);
|
distance = cacheddistance[y] = FixedMul(planeheight, yslope[y]);
|
||||||
ds_xstep = cachedxstep[y] = FixedMul(distance,basexscale);
|
ds_xstep = cachedxstep[y] = FixedMul(distance,basexscale);
|
||||||
ds_ystep = cachedystep[y] = FixedMul(distance,baseyscale);
|
ds_ystep = cachedystep[y] = FixedMul(distance,baseyscale);
|
||||||
|
|
||||||
|
if ((span = abs(centery-y)))
|
||||||
|
{
|
||||||
|
ds_xstep = cachedxstep[y] = FixedMul(planesin, planeheight) / span;
|
||||||
|
ds_ystep = cachedystep[y] = FixedMul(planecos, planeheight) / span;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -486,10 +495,9 @@ static void R_RenderFloorSplat(floorsplat_t *pSplat, vertex_t *verts, UINT8 *pTe
|
||||||
ds_xstep = cachedxstep[y];
|
ds_xstep = cachedxstep[y];
|
||||||
ds_ystep = cachedystep[y];
|
ds_ystep = cachedystep[y];
|
||||||
}
|
}
|
||||||
length = FixedMul(distance, distscale[x1]);
|
|
||||||
angle = (viewangle + xtoviewangle[x1])>>ANGLETOFINESHIFT;
|
ds_xfrac = xoffs + FixedMul(planecos, distance) + (x1 - centerx) * ds_xstep;
|
||||||
ds_xfrac = viewx + FixedMul(FINECOSINE(angle), length);
|
ds_yfrac = yoffs - FixedMul(planesin, distance) + (x1 - centerx) * ds_ystep;
|
||||||
ds_yfrac = -viewy - FixedMul(FINESINE(angle), length);
|
|
||||||
ds_xfrac -= offsetx;
|
ds_xfrac -= offsetx;
|
||||||
ds_yfrac += offsety;
|
ds_yfrac += offsety;
|
||||||
|
|
||||||
|
|
|
@ -1733,7 +1733,7 @@ static void R_CreateDrawNodes(void)
|
||||||
plane = ds->curline->polyseg->visplane;
|
plane = ds->curline->polyseg->visplane;
|
||||||
R_PlaneBounds(plane);
|
R_PlaneBounds(plane);
|
||||||
|
|
||||||
if (plane->low < con_clipviewtop || plane->high > vid.height || plane->high > plane->low)
|
if (plane->low < 0 || plane->high > vid.height || plane->high > plane->low)
|
||||||
;
|
;
|
||||||
else {
|
else {
|
||||||
// Put it in!
|
// Put it in!
|
||||||
|
@ -1762,7 +1762,7 @@ static void R_CreateDrawNodes(void)
|
||||||
plane = ds->ffloorplanes[p];
|
plane = ds->ffloorplanes[p];
|
||||||
R_PlaneBounds(plane);
|
R_PlaneBounds(plane);
|
||||||
|
|
||||||
if (plane->low < con_clipviewtop || plane->high > vid.height || plane->high > plane->low || plane->polyobj)
|
if (plane->low < 0 || plane->high > vid.height || plane->high > plane->low || plane->polyobj)
|
||||||
{
|
{
|
||||||
ds->ffloorplanes[p] = NULL;
|
ds->ffloorplanes[p] = NULL;
|
||||||
continue;
|
continue;
|
||||||
|
@ -1799,7 +1799,7 @@ static void R_CreateDrawNodes(void)
|
||||||
plane = PolyObjects[i].visplane;
|
plane = PolyObjects[i].visplane;
|
||||||
R_PlaneBounds(plane);
|
R_PlaneBounds(plane);
|
||||||
|
|
||||||
if (plane->low < con_clipviewtop || plane->high > vid.height || plane->high > plane->low)
|
if (plane->low < 0 || plane->high > vid.height || plane->high > plane->low)
|
||||||
{
|
{
|
||||||
PolyObjects[i].visplane = NULL;
|
PolyObjects[i].visplane = NULL;
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -219,6 +219,7 @@ FUNCMATH FUNCINLINE static ATTRINLINE char R_Frame2Char(UINT8 frame)
|
||||||
FUNCMATH FUNCINLINE static ATTRINLINE UINT8 R_Char2Frame(char cn)
|
FUNCMATH FUNCINLINE static ATTRINLINE UINT8 R_Char2Frame(char cn)
|
||||||
{
|
{
|
||||||
#if 1 // 2.1 compat
|
#if 1 // 2.1 compat
|
||||||
|
if (cn == '+') return '\\' - 'A'; // PK3 can't use backslash, so use + instead
|
||||||
return cn - 'A';
|
return cn - 'A';
|
||||||
#else
|
#else
|
||||||
if (cn >= 'A' && cn <= 'Z') return cn - 'A';
|
if (cn >= 'A' && cn <= 'Z') return cn - 'A';
|
||||||
|
|
|
@ -309,14 +309,6 @@ void SCR_Recalc(void)
|
||||||
if (automapactive)
|
if (automapactive)
|
||||||
AM_Stop();
|
AM_Stop();
|
||||||
|
|
||||||
// r_plane stuff: visplanes, openings, floorclip, ceilingclip, spanstart,
|
|
||||||
// spanstop, yslope, distscale, cachedheight, cacheddistance,
|
|
||||||
// cachedxstep, cachedystep
|
|
||||||
// -> allocated at the maximum vidsize, static.
|
|
||||||
|
|
||||||
// r_main: xtoviewangle, allocated at the maximum size.
|
|
||||||
// r_things: negonearray, screenheightarray allocated max. size.
|
|
||||||
|
|
||||||
// set the screen[x] ptrs on the new vidbuffers
|
// set the screen[x] ptrs on the new vidbuffers
|
||||||
V_Init();
|
V_Init();
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,12 @@ void I_StartupSound(void)
|
||||||
{
|
{
|
||||||
I_Assert(!sound_started);
|
I_Assert(!sound_started);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
// Force DirectSound instead of WASAPI
|
||||||
|
// SDL 2.0.6+ defaults to the latter and it screws up our sound effects
|
||||||
|
SDL_setenv("SDL_AUDIODRIVER", "directsound", 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
// EE inits audio first so we're following along.
|
// EE inits audio first so we're following along.
|
||||||
if (SDL_WasInit(SDL_INIT_AUDIO) == SDL_INIT_AUDIO)
|
if (SDL_WasInit(SDL_INIT_AUDIO) == SDL_INIT_AUDIO)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1186,6 +1186,12 @@ void I_StartupSound(void)
|
||||||
// Configure sound device
|
// Configure sound device
|
||||||
CONS_Printf("I_StartupSound:\n");
|
CONS_Printf("I_StartupSound:\n");
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
// Force DirectSound instead of WASAPI
|
||||||
|
// SDL 2.0.6+ defaults to the latter and it screws up our sound effects
|
||||||
|
SDL_setenv("SDL_AUDIODRIVER", "directsound", 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
// EE inits audio first so we're following along.
|
// EE inits audio first so we're following along.
|
||||||
if (SDL_WasInit(SDL_INIT_AUDIO) == SDL_INIT_AUDIO)
|
if (SDL_WasInit(SDL_INIT_AUDIO) == SDL_INIT_AUDIO)
|
||||||
CONS_Printf("SDL Audio already started\n");
|
CONS_Printf("SDL Audio already started\n");
|
||||||
|
|
Loading…
Reference in a new issue