Merge branch 'Saturn-Next' into fastpoinonside
This commit is contained in:
commit
91c5dc3c19
76 files changed
+2737
-6807
No files matched your search
@@ -229,6 +229,7 @@ endif
|
||||
|
||||
ifdef LINUX
|
||||
UNIXCOMMON=1
|
||||
NOOBJDUMP=1
|
||||
ifndef NOGME
|
||||
HAVE_LIBGME=1
|
||||
endif
|
||||
|
||||
+372
-111
@@ -1,8 +1,10 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
// SONIC ROBO BLAST 2 KART
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2018 by Sonic Team Junior.
|
||||
// Copyright (C) 2024 by Vivian "toastergrl" Grannell.
|
||||
// Copyright (C) 2024 by Kart Krew.
|
||||
// Copyright (C) 2020 by Sonic Team Junior.
|
||||
// Copyright (C) 2000 by DooM Legacy Team.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
@@ -26,43 +28,37 @@
|
||||
#endif
|
||||
|
||||
// For use if I do walls with outsides/insides
|
||||
static const UINT8 REDS = (8*16);
|
||||
static const UINT8 REDS = (2*16);
|
||||
static const UINT8 REDRANGE = 16;
|
||||
static const UINT8 GRAYS = (1*16);
|
||||
static const UINT8 GRAYSRANGE = 16;
|
||||
static const UINT8 BROWNS = (3*16);
|
||||
static const UINT8 YELLOWS = (7*16);
|
||||
static const UINT8 GREENS = (10*16);
|
||||
static const UINT8 BROWNS = (15*16);
|
||||
static const UINT8 YELLOWS = (5*16)+8;
|
||||
static const UINT8 GREENS = (6*16);
|
||||
static const UINT8 BLUES = (9*16);
|
||||
static const UINT8 DBLACK = 31;
|
||||
static const UINT8 DWHITE = 0;
|
||||
|
||||
static const UINT8 NOCLIMBREDS = 248;
|
||||
static const UINT8 NOCLIMBREDRANGE = 8;
|
||||
static const UINT8 NOCLIMBGRAYS = 204;
|
||||
static const UINT8 NOCLIMBBROWNS = (2*16);
|
||||
static const UINT8 NOCLIMBYELLOWS = (11*16);
|
||||
|
||||
// Automap colors
|
||||
#define BACKGROUND DBLACK
|
||||
#define WALLCOLORS (REDS + REDRANGE/2)
|
||||
#define WALLRANGE (REDRANGE/2)
|
||||
#define NOCLIMBWALLCOLORS (NOCLIMBREDS + NOCLIMBREDRANGE/2)
|
||||
#define NOCLIMBWALLRANGE (NOCLIMBREDRANGE/2)
|
||||
#define THOKWALLCOLORS REDS
|
||||
#define THOKWALLRANGE REDRANGE
|
||||
#define NOCLIMBTHOKWALLCOLORS NOCLIMBREDS
|
||||
#define NOCLIMBTHOKWALLRANGE NOCLIMBREDRANGE
|
||||
#define TSWALLCOLORS GRAYS
|
||||
#define TSWALLRANGE GRAYSRANGE
|
||||
#define NOCLIMBTSWALLCOLORS NOCLIMBGRAYS
|
||||
#define TSWALLCOLORS DWHITE
|
||||
#define TSFINISHLINE GRAYS
|
||||
#define TSFOFINFO (BLUES + 4)
|
||||
#define FDWALLCOLORS BROWNS
|
||||
#define NOCLIMBFDWALLCOLORS NOCLIMBBROWNS
|
||||
#define CDWALLCOLORS YELLOWS
|
||||
#define NOCLIMBCDWALLCOLORS NOCLIMBYELLOWS
|
||||
#define THINGCOLORS GREENS
|
||||
#define GRIDCOLORS (GRAYS + GRAYSRANGE/2)
|
||||
#define XHAIRCOLORS GRAYS
|
||||
|
||||
// Automap passes
|
||||
#define PASS_SOLID 1
|
||||
#define PASS_INTANGIBLE 2
|
||||
#define PASS_FOF 4
|
||||
|
||||
// controls
|
||||
#define AM_PANUPKEY KEY_UPARROW
|
||||
#define AM_PANDOWNKEY KEY_DOWNARROW
|
||||
@@ -110,11 +106,6 @@ typedef struct
|
||||
mpoint_t a, b;
|
||||
} mline_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fixed_t slp, islp;
|
||||
} islope_t;
|
||||
|
||||
//
|
||||
// The vector graphics for the automap.
|
||||
// A line drawing of the player pointing right,
|
||||
@@ -136,16 +127,14 @@ static const mline_t player_arrow[] = {
|
||||
#undef R
|
||||
#define NUMPLYRLINES (sizeof (player_arrow)/sizeof (mline_t))
|
||||
|
||||
#if 0
|
||||
#define R (FRACUNIT)
|
||||
static mline_t triangle_guy[] = {
|
||||
{ { (fixed_t)-.867f*R, (fixed_t)-.5f*R }, { (fixed_t) .867f*R, (fixed_t)-.5f*R } },
|
||||
{ { (fixed_t) .867f*R, (fixed_t)-.5f*R }, { (fixed_t) 0, (fixed_t) R } },
|
||||
{ { (fixed_t) 0, (fixed_t) R }, { (fixed_t)-.867f*R, (fixed_t)-.5f*R } }
|
||||
static const mline_t cross_mark[] =
|
||||
{
|
||||
{ { -R, 0 }, { R, 0} },
|
||||
{ { 0, -R }, { 0, R } },
|
||||
};
|
||||
#undef R
|
||||
#define NUMTRIANGLEGUYLINES (sizeof (triangle_guy)/sizeof (mline_t))
|
||||
#endif
|
||||
#define NUMCROSSMARKLINES (sizeof(cross_mark)/sizeof(mline_t))
|
||||
|
||||
#define R (FRACUNIT)
|
||||
static const mline_t thintriangle_guy[] = {
|
||||
@@ -162,10 +151,14 @@ static boolean draw_grid = false;
|
||||
boolean automapactive = false;
|
||||
boolean am_recalc = false; //added : 05-02-98 : true when screen size changes
|
||||
static boolean am_stopped = true;
|
||||
static boolean am_minigen = false;
|
||||
|
||||
static UINT8 *am_buf = NULL;
|
||||
|
||||
static INT32 f_x, f_y; // location of window on screen (always zero for both)
|
||||
static INT32 f_w, f_h; // size of window on screen (always the screen width and height respectively)
|
||||
|
||||
static boolean m_keydown[4]; // which window panning keys are being pressed down?
|
||||
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 ftom_zoommul; // how far the window zooms in each tic (fb coords)
|
||||
@@ -205,12 +198,13 @@ static fixed_t scale_ftom;
|
||||
|
||||
static player_t *plr; // the player represented by an arrow
|
||||
|
||||
static INT32 followplayer = true; // specifies whether to follow the player around
|
||||
static boolean followplayer = true; // specifies whether to follow the player around
|
||||
|
||||
// function for drawing lines, depends on rendermode
|
||||
typedef void (*AMDRAWFLINEFUNC) (const fline_t *fl, INT32 color);
|
||||
static AMDRAWFLINEFUNC AM_drawFline;
|
||||
|
||||
static void AM_drawPixel(INT32 xx, INT32 yy, INT32 cc);
|
||||
static void AM_drawFline_soft(const fline_t *fl, INT32 color);
|
||||
|
||||
static void AM_activateNewScale(void)
|
||||
@@ -340,22 +334,23 @@ static void AM_initVariables(void)
|
||||
old_m_h = m_h;
|
||||
}
|
||||
|
||||
//
|
||||
// Called when the screen size changes.
|
||||
//
|
||||
static void AM_FrameBufferInit(void)
|
||||
{
|
||||
f_x = f_y = 0;
|
||||
f_w = vid.width;
|
||||
f_h = vid.height;
|
||||
am_buf = screens[0];
|
||||
}
|
||||
|
||||
//
|
||||
// should be called at the start of every level
|
||||
// right now, i figure it out myself
|
||||
//
|
||||
static void AM_LevelInit(void)
|
||||
{
|
||||
f_x = f_y = 0;
|
||||
f_w = vid.width;
|
||||
f_h = vid.height;
|
||||
|
||||
AM_drawFline = AM_drawFline_soft;
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
AM_drawFline = HWR_drawAMline;
|
||||
#endif
|
||||
|
||||
AM_findMinMaxBoundaries();
|
||||
scale_mtof = FixedDiv(min_scale_mtof*10, 7*FRACUNIT);
|
||||
if (scale_mtof > max_scale_mtof)
|
||||
@@ -377,7 +372,7 @@ void AM_Stop(void)
|
||||
*
|
||||
* \sa AM_Stop
|
||||
*/
|
||||
static inline void AM_Start(void)
|
||||
void AM_Start(void)
|
||||
{
|
||||
static INT32 lastlevel = -1;
|
||||
|
||||
@@ -386,8 +381,12 @@ static inline void AM_Start(void)
|
||||
am_stopped = false;
|
||||
if (lastlevel != gamemap || am_recalc) // screen size changed
|
||||
{
|
||||
AM_LevelInit();
|
||||
lastlevel = gamemap;
|
||||
AM_FrameBufferInit();
|
||||
if (lastlevel != gamemap)
|
||||
{
|
||||
AM_LevelInit();
|
||||
lastlevel = gamemap;
|
||||
}
|
||||
am_recalc = false;
|
||||
}
|
||||
AM_initVariables();
|
||||
@@ -413,6 +412,27 @@ static void AM_maxOutWindowScale(void)
|
||||
AM_activateNewScale();
|
||||
}
|
||||
|
||||
//
|
||||
// set window panning
|
||||
//
|
||||
static void AM_setWindowPanning(void)
|
||||
{
|
||||
// up and down
|
||||
if (m_keydown[2]) // pan up
|
||||
m_paninc.y = FTOM(F_PANINC);
|
||||
else if (m_keydown[3]) // pan down
|
||||
m_paninc.y = -FTOM(F_PANINC);
|
||||
else
|
||||
m_paninc.y = 0;
|
||||
// left and right
|
||||
if (m_keydown[0]) // pan right
|
||||
m_paninc.x = FTOM(F_PANINC);
|
||||
else if (m_keydown[1]) // pan left
|
||||
m_paninc.x = -FTOM(F_PANINC);
|
||||
else
|
||||
m_paninc.x = 0;
|
||||
}
|
||||
|
||||
/** Responds to user inputs in automap mode.
|
||||
*
|
||||
* \param ev Event to possibly respond to.
|
||||
@@ -445,35 +465,49 @@ boolean AM_Responder(event_t *ev)
|
||||
{
|
||||
case AM_PANRIGHTKEY: // pan right
|
||||
if (!followplayer)
|
||||
m_paninc.x = FTOM(F_PANINC);
|
||||
{
|
||||
m_keydown[0] = true;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
else
|
||||
rc = false;
|
||||
break;
|
||||
case AM_PANLEFTKEY: // pan left
|
||||
if (!followplayer)
|
||||
m_paninc.x = -FTOM(F_PANINC);
|
||||
{
|
||||
m_keydown[1] = true;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
else
|
||||
rc = false;
|
||||
break;
|
||||
case AM_PANUPKEY: // pan up
|
||||
if (!followplayer)
|
||||
m_paninc.y = FTOM(F_PANINC);
|
||||
{
|
||||
m_keydown[2] = true;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
else
|
||||
rc = false;
|
||||
break;
|
||||
case AM_PANDOWNKEY: // pan down
|
||||
if (!followplayer)
|
||||
m_paninc.y = -FTOM(F_PANINC);
|
||||
{
|
||||
m_keydown[3] = true;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
else
|
||||
rc = false;
|
||||
break;
|
||||
case AM_ZOOMOUTKEY: // zoom out
|
||||
mtof_zoommul = M_ZOOMOUT;
|
||||
ftom_zoommul = M_ZOOMIN;
|
||||
AM_setWindowPanning();
|
||||
break;
|
||||
case AM_ZOOMINKEY: // zoom in
|
||||
mtof_zoommul = M_ZOOMIN;
|
||||
ftom_zoommul = M_ZOOMOUT;
|
||||
AM_setWindowPanning();
|
||||
break;
|
||||
case AM_TOGGLEKEY:
|
||||
AM_Stop();
|
||||
@@ -487,6 +521,7 @@ boolean AM_Responder(event_t *ev)
|
||||
}
|
||||
else
|
||||
AM_restoreScaleAndLoc();
|
||||
AM_setWindowPanning();
|
||||
break;
|
||||
case AM_FOLLOWKEY:
|
||||
followplayer = !followplayer;
|
||||
@@ -506,14 +541,32 @@ boolean AM_Responder(event_t *ev)
|
||||
switch (ev->data1)
|
||||
{
|
||||
case AM_PANRIGHTKEY:
|
||||
if (!followplayer)
|
||||
{
|
||||
m_keydown[0] = false;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
break;
|
||||
case AM_PANLEFTKEY:
|
||||
if (!followplayer)
|
||||
m_paninc.x = 0;
|
||||
{
|
||||
m_keydown[1] = false;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
break;
|
||||
case AM_PANUPKEY:
|
||||
if (!followplayer)
|
||||
{
|
||||
m_keydown[2] = false;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
break;
|
||||
case AM_PANDOWNKEY:
|
||||
if (!followplayer)
|
||||
m_paninc.y = 0;
|
||||
{
|
||||
m_keydown[3] = false;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
break;
|
||||
case AM_ZOOMOUTKEY:
|
||||
case AM_ZOOMINKEY:
|
||||
@@ -714,6 +767,16 @@ static boolean AM_clipMline(const mline_t *ml, fline_t *fl)
|
||||
}
|
||||
#undef DOOUTCODE
|
||||
|
||||
//
|
||||
// Draws a pixel.
|
||||
//
|
||||
static void AM_drawPixel(INT32 xx, INT32 yy, INT32 cc)
|
||||
{
|
||||
if (xx < 0 || yy < 0 || xx >= f_w || yy >= f_h)
|
||||
return; // off the screen
|
||||
am_buf[(yy*f_w) + xx] = cc;
|
||||
}
|
||||
|
||||
//
|
||||
// Classic Bresenham w/ whatever optimizations needed for speed
|
||||
//
|
||||
@@ -735,8 +798,6 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
||||
}
|
||||
#endif
|
||||
|
||||
#define PUTDOT(xx,yy,cc) V_DrawFill(xx,yy,1,1,cc|V_NOSCALESTART);
|
||||
|
||||
dx = fl->b.x - fl->a.x;
|
||||
ax = 2 * (dx < 0 ? -dx : dx);
|
||||
sx = dx < 0 ? -1 : 1;
|
||||
@@ -753,7 +814,7 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
||||
d = ay - ax/2;
|
||||
for (;;)
|
||||
{
|
||||
PUTDOT(x, y, color)
|
||||
AM_drawPixel(x, y, color);
|
||||
if (x == fl->b.x)
|
||||
return;
|
||||
if (d >= 0)
|
||||
@@ -770,7 +831,7 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
||||
d = ax - ay/2;
|
||||
for (;;)
|
||||
{
|
||||
PUTDOT(x, y, color)
|
||||
AM_drawPixel(x, y, color);
|
||||
if (y == fl->b.y)
|
||||
return;
|
||||
if (d >= 0)
|
||||
@@ -782,8 +843,6 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
||||
d += ax;
|
||||
}
|
||||
}
|
||||
|
||||
#undef PUTDOT
|
||||
}
|
||||
|
||||
//
|
||||
@@ -805,17 +864,18 @@ static void AM_drawGrid(INT32 color)
|
||||
fixed_t x, y;
|
||||
fixed_t start, end;
|
||||
mline_t ml;
|
||||
fixed_t gridsize = (MAPBLOCKUNITS<<MAPBITS);
|
||||
|
||||
// Figure out start of vertical gridlines
|
||||
start = m_x;
|
||||
if ((start - bmaporgx) % (MAPBLOCKUNITS<<FRACBITS))
|
||||
start += (MAPBLOCKUNITS<<FRACBITS) - ((start - bmaporgx) % (MAPBLOCKUNITS<<FRACBITS));
|
||||
if ((start - (bmaporgx>>FRACTOMAPBITS)) % gridsize)
|
||||
start += gridsize - ((start - (bmaporgx>>FRACTOMAPBITS)) % gridsize);
|
||||
end = m_x + m_w;
|
||||
|
||||
// draw vertical gridlines
|
||||
ml.a.y = m_y;
|
||||
ml.b.y = m_y + m_h;
|
||||
for (x = start; x < end; x += (MAPBLOCKUNITS<<FRACBITS))
|
||||
for (x = start; x < end; x += gridsize)
|
||||
{
|
||||
ml.a.x = x;
|
||||
ml.b.x = x;
|
||||
@@ -824,14 +884,14 @@ static void AM_drawGrid(INT32 color)
|
||||
|
||||
// Figure out start of horizontal gridlines
|
||||
start = m_y;
|
||||
if ((start - bmaporgy) % (MAPBLOCKUNITS<<FRACBITS))
|
||||
start += (MAPBLOCKUNITS<<FRACBITS) - ((start - bmaporgy) % (MAPBLOCKUNITS<<FRACBITS));
|
||||
if ((start - (bmaporgy>>FRACTOMAPBITS)) % gridsize)
|
||||
start += gridsize - ((start - (bmaporgy>>FRACTOMAPBITS)) % gridsize);
|
||||
end = m_y + m_h;
|
||||
|
||||
// draw horizontal gridlines
|
||||
ml.a.x = m_x;
|
||||
ml.b.x = m_x + m_w;
|
||||
for (y = start; y < end; y += (MAPBLOCKUNITS<<FRACBITS))
|
||||
for (y = start; y < end; y += gridsize)
|
||||
{
|
||||
ml.a.y = y;
|
||||
ml.b.y = y;
|
||||
@@ -839,14 +899,63 @@ static void AM_drawGrid(INT32 color)
|
||||
}
|
||||
}
|
||||
|
||||
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
|
||||
if (slope) { \
|
||||
end1 = (P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y) + FRACUNIT/2) >> FRACBITS; \
|
||||
end2 = (P_GetZAt(slope, lines[i].v2->x, lines[i].v2->y) + FRACUNIT/2) >> FRACBITS; \
|
||||
} else \
|
||||
end1 = end2 = (normalheight + FRACUNIT/2) >> FRACBITS;
|
||||
|
||||
static ffloor_t *AM_CompareFOFs(size_t i, ffloor_t *rover, ffloor_t *secondarystore)
|
||||
{
|
||||
ffloor_t *secondaryrover = NULL;
|
||||
for (; rover; rover = rover->next)
|
||||
{
|
||||
fixed_t rovt1, rovt2;
|
||||
fixed_t rovb1, rovb2;
|
||||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
if (!(rover->flags & FF_BLOCKPLAYER))
|
||||
continue;
|
||||
SLOPEPARAMS(*rover->t_slope, rovt1, rovt2, *rover->topheight)
|
||||
SLOPEPARAMS(*rover->b_slope, rovb1, rovb2, *rover->bottomheight)
|
||||
for (secondaryrover = secondarystore; secondaryrover; secondaryrover = secondaryrover->next)
|
||||
{
|
||||
fixed_t sect1, sect2;
|
||||
fixed_t secb1, secb2;
|
||||
if (!(secondaryrover->flags & FF_EXISTS))
|
||||
continue;
|
||||
if (!(secondaryrover->flags & FF_BLOCKPLAYER))
|
||||
continue;
|
||||
if (secondaryrover->secnum == rover->secnum)
|
||||
break;
|
||||
SLOPEPARAMS(*secondaryrover->t_slope, sect1, sect2, *secondaryrover->topheight)
|
||||
SLOPEPARAMS(*secondaryrover->b_slope, secb1, secb2, *secondaryrover->bottomheight)
|
||||
if (rovt1 != sect1)
|
||||
continue;
|
||||
if (rovt2 != sect2)
|
||||
continue;
|
||||
if (rovb1 != secb1)
|
||||
continue;
|
||||
if (rovb2 != secb2)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
if (secondaryrover == NULL)
|
||||
break;
|
||||
}
|
||||
return rover;
|
||||
}
|
||||
|
||||
//
|
||||
// Determines visible lines, draws them.
|
||||
// This is LineDef based, not LineSeg based.
|
||||
//
|
||||
static inline void AM_drawWalls(void)
|
||||
static void AM_drawWalls(UINT8 pass)
|
||||
{
|
||||
size_t i;
|
||||
static mline_t l;
|
||||
const fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale)>>FRACBITS;
|
||||
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
|
||||
fixed_t backf1 = 0, backf2 = 0, backc1 = 0, backc2 = 0; // back floor ceiling ends
|
||||
|
||||
@@ -856,74 +965,143 @@ static inline void AM_drawWalls(void)
|
||||
l.a.y = lines[i].v1->y >> FRACTOMAPBITS;
|
||||
l.b.x = lines[i].v2->x >> FRACTOMAPBITS;
|
||||
l.b.y = lines[i].v2->y >> FRACTOMAPBITS;
|
||||
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
|
||||
if (slope) { \
|
||||
end1 = P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y); \
|
||||
end2 = P_GetZAt(slope, lines[i].v2->x, lines[i].v2->y); \
|
||||
} else \
|
||||
end1 = end2 = normalheight;
|
||||
|
||||
SLOPEPARAMS(lines[i].frontsector->f_slope, frontf1, frontf2, lines[i].frontsector->floorheight)
|
||||
SLOPEPARAMS(lines[i].frontsector->c_slope, frontc1, frontc2, lines[i].frontsector->ceilingheight)
|
||||
if (lines[i].backsector) {
|
||||
SLOPEPARAMS(lines[i].backsector->f_slope, backf1, backf2, lines[i].backsector->floorheight)
|
||||
SLOPEPARAMS(lines[i].backsector->c_slope, backc1, backc2, lines[i].backsector->ceilingheight)
|
||||
}
|
||||
#undef SLOPEPARAMS
|
||||
|
||||
if (!lines[i].backsector) // 1-sided
|
||||
{
|
||||
if (lines[i].flags & ML_NOCLIMB)
|
||||
AM_drawMline(&l, NOCLIMBWALLCOLORS);
|
||||
else
|
||||
if (!(pass & PASS_SOLID))
|
||||
;
|
||||
else if (frontf1 != frontc1 || frontf2 != frontc2 || lines[i].frontsector->f_slope)
|
||||
{
|
||||
AM_drawMline(&l, TSWALLCOLORS);
|
||||
}
|
||||
else if (!am_minigen)
|
||||
{
|
||||
AM_drawMline(&l, WALLCOLORS);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier
|
||||
SLOPEPARAMS(lines[i].backsector->f_slope, backf1, backf2, lines[i].backsector->floorheight)
|
||||
SLOPEPARAMS(lines[i].backsector->c_slope, backc1, backc2, lines[i].backsector->ceilingheight)
|
||||
if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier
|
||||
|| (frontf1 == frontc1 && frontf2 == frontc2)) // Front is thok barrier
|
||||
{
|
||||
if (backf1 == backc1 && backf2 == backc2
|
||||
&& frontf1 == frontc1 && frontf2 == frontc2) // BOTH are thok barriers
|
||||
{
|
||||
if (lines[i].flags & ML_NOCLIMB)
|
||||
AM_drawMline(&l, NOCLIMBTSWALLCOLORS);
|
||||
else
|
||||
AM_drawMline(&l, TSWALLCOLORS);
|
||||
if (!am_minigen && (pass & PASS_INTANGIBLE))
|
||||
{
|
||||
AM_drawMline(&l, GRIDCOLORS);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (pass & PASS_SOLID)
|
||||
{
|
||||
if (lines[i].flags & ML_NOCLIMB)
|
||||
AM_drawMline(&l, NOCLIMBTHOKWALLCOLORS);
|
||||
else
|
||||
AM_drawMline(&l, THOKWALLCOLORS);
|
||||
AM_drawMline(&l, TSWALLCOLORS);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lines[i].flags & ML_NOCLIMB) {
|
||||
if (backf1 != frontf1 || backf2 != frontf2) {
|
||||
AM_drawMline(&l, NOCLIMBFDWALLCOLORS); // floor level change
|
||||
}
|
||||
else if (backc1 != frontc1 || backc2 != frontc2) {
|
||||
AM_drawMline(&l, NOCLIMBCDWALLCOLORS); // ceiling level change
|
||||
//dont think kart even supports those idk?
|
||||
/*if (lines[i].flags & (ML_IMPASSABLE|ML_BLOCKPLAYERS))
|
||||
{
|
||||
if (pass & PASS_SOLID)
|
||||
AM_drawMline(&l, TSWALLCOLORS); // Completely solid course boundary
|
||||
}
|
||||
else if ((lines[i].flags & ML_MIDSOLID)
|
||||
&& sides[lines->sidenum[0]].midtexture)
|
||||
{
|
||||
if (pass & PASS_SOLID)
|
||||
AM_drawMline(&l, TSWALLCOLORS); // solid midtexture, likely a course boundary
|
||||
}*/
|
||||
if ((backf1 != frontf1 && abs(backf1 - frontf1) > maxstep)
|
||||
|| (backf2 != frontf2 && abs(backf2 - frontf2) > maxstep))
|
||||
{
|
||||
if (pass & PASS_SOLID)
|
||||
AM_drawMline(&l, TSWALLCOLORS); // floor-wall, likely a course boundary
|
||||
}
|
||||
/*else if (lines[i].special == 2001) // guh its a sector effect in kart idk how to make it work tbh lol
|
||||
{
|
||||
if (pass & PASS_SOLID)
|
||||
AM_drawMline(&l, TSFINISHLINE); // finish line
|
||||
}*/
|
||||
else if (backf1 != frontf1 || backf2 != frontf2)
|
||||
{
|
||||
if (pass & PASS_INTANGIBLE)
|
||||
AM_drawMline(&l, FDWALLCOLORS); // floorlevel change
|
||||
}
|
||||
else if (backc1 != frontc1 || backc2 != frontc2)
|
||||
{
|
||||
if (!(pass & PASS_INTANGIBLE))
|
||||
;
|
||||
else if (abs(backc1 - frontc1) < maxstep
|
||||
|| abs(backc2 - frontc2) < maxstep)
|
||||
{
|
||||
AM_drawMline(&l, CDWALLCOLORS); // ceilinglevel change
|
||||
}
|
||||
else
|
||||
AM_drawMline(&l, NOCLIMBTSWALLCOLORS);
|
||||
{
|
||||
AM_drawMline(&l, GRIDCOLORS); // ceiling-wall, not likely to be a course boundary but flagged up just in case
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (backf1 != frontf1 || backf2 != frontf2) {
|
||||
AM_drawMline(&l, FDWALLCOLORS); // floor level change
|
||||
{
|
||||
ffloor_t *rover = NULL;
|
||||
|
||||
if (lines[i].frontsector->ffloors || lines[i].backsector->ffloors)
|
||||
{
|
||||
if (lines[i].backsector->ffloors == NULL)
|
||||
{
|
||||
// Check frontside for one solid
|
||||
for (rover = lines[i].frontsector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
if (!(rover->flags & FF_BLOCKPLAYER))
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (lines[i].frontsector->ffloors == NULL)
|
||||
{
|
||||
// Check backside for one solid
|
||||
for (rover = lines[i].backsector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
if (!(rover->flags & FF_BLOCKPLAYER))
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check to see if any secnums exist in one but not the other.
|
||||
rover = AM_CompareFOFs(i, lines[i].frontsector->ffloors, lines[i].backsector->ffloors);
|
||||
if (rover == NULL)
|
||||
rover = AM_CompareFOFs(i, lines[i].backsector->ffloors, lines[i].frontsector->ffloors);
|
||||
}
|
||||
}
|
||||
if (rover != NULL)
|
||||
{
|
||||
if (pass & PASS_FOF)
|
||||
AM_drawMline(&l, TSFOFINFO); // a FOF is here but we don't know how to distinguish them yet
|
||||
}
|
||||
else if (!am_minigen)
|
||||
{
|
||||
if (pass & PASS_INTANGIBLE)
|
||||
AM_drawMline(&l, GRIDCOLORS); // likely low-relevance line
|
||||
}
|
||||
}
|
||||
else if (backc1 != frontc1 || backc2 != frontc2) {
|
||||
AM_drawMline(&l, CDWALLCOLORS); // ceiling level change
|
||||
}
|
||||
else
|
||||
AM_drawMline(&l, TSWALLCOLORS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef SLOPEPARAMS
|
||||
|
||||
//
|
||||
// Rotation in 2D.
|
||||
// Used to rotate player arrow line character.
|
||||
@@ -996,7 +1174,7 @@ static inline void AM_drawPlayers(void)
|
||||
|
||||
if (!multiplayer)
|
||||
{
|
||||
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 0, plr->mo->angle, DWHITE, plr->mo->x, plr->mo->y);
|
||||
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 16<<FRACBITS, plr->mo->angle, DWHITE, plr->mo->x, plr->mo->y);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1013,7 +1191,7 @@ static inline void AM_drawPlayers(void)
|
||||
if (p->skincolor > 0)
|
||||
color = R_GetTranslationColormap(TC_DEFAULT, p->skincolor, GTC_CACHE)[GREENS + 8];
|
||||
|
||||
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 0, p->mo->angle, color, p->mo->x, p->mo->y);
|
||||
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 16<<FRACBITS, p->mo->angle, color, p->mo->x, p->mo->y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1033,13 +1211,27 @@ static inline void AM_drawThings(UINT8 colors)
|
||||
}
|
||||
}
|
||||
|
||||
/** Draws the crosshair, actually just a dot in software mode.
|
||||
/** Draws the crosshair.
|
||||
*
|
||||
* \param color Color for the crosshair.
|
||||
*/
|
||||
static inline void AM_drawCrosshair(UINT8 color)
|
||||
{
|
||||
V_DrawFill(f_w/2 + f_x, f_h/2 + f_y, 1, 1, color|V_NOSCALESTART);
|
||||
const fixed_t scale = 4<<FRACBITS;
|
||||
size_t i;
|
||||
fline_t fl;
|
||||
for (i = 0; i < NUMCROSSMARKLINES; i++)
|
||||
{
|
||||
fl.a.x = FixedMul(cross_mark[i].a.x, scale) >> FRACBITS;
|
||||
fl.a.y = FixedMul(cross_mark[i].a.y, scale) >> FRACBITS;
|
||||
fl.b.x = FixedMul(cross_mark[i].b.x, scale) >> FRACBITS;
|
||||
fl.b.y = FixedMul(cross_mark[i].b.y, scale) >> FRACBITS;
|
||||
fl.a.x += f_x + (f_w / 2);
|
||||
fl.a.y += f_y + (f_h / 2);
|
||||
fl.b.x += f_x + (f_w / 2);
|
||||
fl.b.y += f_y + (f_h / 2);
|
||||
AM_drawFline(&fl, color);
|
||||
}
|
||||
}
|
||||
|
||||
/** Draws the automap.
|
||||
@@ -1049,11 +1241,80 @@ void AM_Drawer(void)
|
||||
if (!automapactive)
|
||||
return;
|
||||
|
||||
AM_drawFline = AM_drawFline_soft;
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
AM_drawFline = HWR_drawAMline;
|
||||
#endif
|
||||
|
||||
AM_clearFB(BACKGROUND);
|
||||
if (draw_grid) AM_drawGrid(GRIDCOLORS);
|
||||
AM_drawWalls();
|
||||
AM_drawWalls(PASS_FOF|PASS_INTANGIBLE|PASS_SOLID);
|
||||
AM_drawPlayers();
|
||||
AM_drawThings(THINGCOLORS);
|
||||
|
||||
AM_drawCrosshair(XHAIRCOLORS);
|
||||
if (!followplayer) AM_drawCrosshair(XHAIRCOLORS);
|
||||
}
|
||||
|
||||
minigen_t *AM_MinimapGenerate(INT32 mul)
|
||||
{
|
||||
static minigen_t ret = {0};
|
||||
|
||||
if (automapactive)
|
||||
return NULL;
|
||||
|
||||
am_minigen = true;
|
||||
|
||||
AM_drawFline = AM_drawFline_soft; // yes, even in GL
|
||||
|
||||
//AM_FrameBufferInit();
|
||||
f_x = f_y = 0;
|
||||
ret.w = f_w = minimapinfo.minimap_w * mul;
|
||||
ret.h = f_h = minimapinfo.minimap_h * mul;
|
||||
am_buf = ret.buf = NULL;
|
||||
|
||||
//AM_LevelInit();
|
||||
AM_findMinMaxBoundaries();
|
||||
scale_mtof = min_scale_mtof - (min_scale_mtof/20);
|
||||
scale_ftom = FixedDiv(FRACUNIT, scale_mtof);
|
||||
|
||||
//AM_initVariables();
|
||||
f_oldloc.x = INT32_MAX;
|
||||
|
||||
m_paninc.x = m_paninc.y = 0;
|
||||
ftom_zoommul = FRACUNIT;
|
||||
mtof_zoommul = FRACUNIT;
|
||||
|
||||
m_w = FTOM(f_w);
|
||||
m_h = FTOM(f_h);
|
||||
|
||||
//AM_changeWindowLoc();
|
||||
m_x = min_x - FixedMul(m_w, FRACUNIT/40);
|
||||
m_y = min_y - FixedMul(m_h, FRACUNIT/40);
|
||||
m_x2 = m_x + m_w;
|
||||
m_y2 = m_y + m_h;
|
||||
|
||||
// for saving & restoring
|
||||
old_m_x = m_x;
|
||||
old_m_y = m_y;
|
||||
old_m_w = m_w;
|
||||
old_m_h = m_h;
|
||||
|
||||
am_buf = ret.buf = malloc((f_w*f_h));
|
||||
|
||||
if (ret.buf == NULL)
|
||||
return NULL;
|
||||
|
||||
//AM_clearFB(BACKGROUND);
|
||||
memset(am_buf, 0xff, (f_w*f_h));
|
||||
AM_drawWalls(PASS_FOF);
|
||||
AM_drawWalls(PASS_INTANGIBLE);
|
||||
AM_drawWalls(PASS_SOLID);
|
||||
|
||||
am_buf = NULL;
|
||||
am_recalc = true;
|
||||
|
||||
am_minigen = false;
|
||||
|
||||
return &ret;
|
||||
}
|
||||
+17
-8
@@ -1,8 +1,10 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
// SONIC ROBO BLAST 2 KART
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2018 by Sonic Team Junior.
|
||||
// Copyright (C) 2024 by Vivian "toastergrl" Grannell.
|
||||
// Copyright (C) 2024 by Kart Krew.
|
||||
// Copyright (C) 2020 by Sonic Team Junior.
|
||||
// Copyright (C) 2000 by DooM Legacy Team.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
@@ -26,11 +28,6 @@ typedef struct
|
||||
fpoint_t a, b;
|
||||
} fline_t;
|
||||
|
||||
// Used by ST StatusBar stuff.
|
||||
#define AM_MSGHEADER (('a'<<24)+('m'<<16))
|
||||
#define AM_MSGENTERED (AM_MSGHEADER | ('e'<<8))
|
||||
#define AM_MSGEXITED (AM_MSGHEADER | ('x'<<8))
|
||||
|
||||
extern boolean am_recalc; // true if screen size changes
|
||||
extern boolean automapactive; // In AutoMap mode?
|
||||
|
||||
@@ -43,7 +40,19 @@ void AM_Ticker(void);
|
||||
// Called by main loop, instead of view drawer if automap is active.
|
||||
void AM_Drawer(void);
|
||||
|
||||
// Enables the automap.
|
||||
void AM_Start(void);
|
||||
|
||||
// Called to force the automap to quit if the level is completed while it is up.
|
||||
void AM_Stop(void);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
INT32 w, h;
|
||||
UINT8 *buf;
|
||||
} minigen_t;
|
||||
|
||||
// Minimap generation
|
||||
minigen_t *AM_MinimapGenerate(INT32 mul);
|
||||
|
||||
#endif
|
||||
+14
-52
@@ -118,9 +118,6 @@ void B_BuildTiccmd(player_t *player, ticcmd_t *cmd)
|
||||
return;
|
||||
}
|
||||
|
||||
// Bot AI isn't programmed in analog.
|
||||
//CV_SetValue(&cv_analog2, false);
|
||||
|
||||
// Let Lua scripts build ticcmds
|
||||
if (LUAh_BotTiccmd(player, cmd))
|
||||
return;
|
||||
@@ -135,55 +132,20 @@ void B_BuildTiccmd(player_t *player, ticcmd_t *cmd)
|
||||
|
||||
void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward, boolean left, boolean right, boolean strafeleft, boolean straferight, boolean jump, boolean spin)
|
||||
{
|
||||
// Turn the virtual keypresses into ticcmd_t.
|
||||
if (twodlevel || mo->flags2 & MF2_TWOD) {
|
||||
if (players[consoleplayer].climbing
|
||||
|| mo->player->pflags & PF_GLIDING) {
|
||||
// Don't mess with bot inputs during these unhandled movement conditions.
|
||||
// The normal AI doesn't use abilities, so custom AI should be sending us exactly what it wants anyway.
|
||||
if (forward)
|
||||
cmd->forwardmove += MAXPLMOVE<<FRACBITS>>16;
|
||||
if (backward)
|
||||
cmd->forwardmove -= MAXPLMOVE<<FRACBITS>>16;
|
||||
if (left || strafeleft)
|
||||
cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16;
|
||||
if (right || straferight)
|
||||
cmd->sidemove += MAXPLMOVE<<FRACBITS>>16;
|
||||
} else {
|
||||
// In standard 2D mode, interpret "forward" as "the way you're facing" and everything else as "the way you're not facing"
|
||||
if (left || right)
|
||||
backward = true;
|
||||
left = right = false;
|
||||
if (forward) {
|
||||
if (mo->angle < ANGLE_90 || mo->angle > ANGLE_270)
|
||||
right = true;
|
||||
else
|
||||
left = true;
|
||||
} else if (backward) {
|
||||
if (mo->angle < ANGLE_90 || mo->angle > ANGLE_270)
|
||||
left = true;
|
||||
else
|
||||
right = true;
|
||||
}
|
||||
if (left || strafeleft)
|
||||
cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16;
|
||||
if (right || straferight)
|
||||
cmd->sidemove += MAXPLMOVE<<FRACBITS>>16;
|
||||
}
|
||||
} else {
|
||||
if (forward)
|
||||
cmd->forwardmove += MAXPLMOVE<<FRACBITS>>16;
|
||||
if (backward)
|
||||
cmd->forwardmove -= MAXPLMOVE<<FRACBITS>>16;
|
||||
if (left)
|
||||
cmd->angleturn += 1280;
|
||||
if (right)
|
||||
cmd->angleturn -= 1280;
|
||||
if (strafeleft)
|
||||
cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16;
|
||||
if (straferight)
|
||||
cmd->sidemove += MAXPLMOVE<<FRACBITS>>16;
|
||||
}
|
||||
(void)mo;
|
||||
|
||||
if (forward)
|
||||
cmd->forwardmove += MAXPLMOVE<<FRACBITS>>16;
|
||||
if (backward)
|
||||
cmd->forwardmove -= MAXPLMOVE<<FRACBITS>>16;
|
||||
if (left)
|
||||
cmd->angleturn += 1280;
|
||||
if (right)
|
||||
cmd->angleturn -= 1280;
|
||||
if (strafeleft)
|
||||
cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16;
|
||||
if (straferight)
|
||||
cmd->sidemove += MAXPLMOVE<<FRACBITS>>16;
|
||||
if (jump)
|
||||
cmd->buttons |= BT_DRIFT;
|
||||
if (spin)
|
||||
|
||||
+216
-419
@@ -50,6 +50,7 @@
|
||||
#include "s_sound.h" // sfx_syfail
|
||||
#include "m_perfstats.h"
|
||||
#include "d_main.h"
|
||||
#include "r_fps.h"
|
||||
|
||||
#ifdef CLIENT_LOADINGSCREEN
|
||||
// cl loading screen
|
||||
@@ -139,10 +140,7 @@ static UINT8 gamestate_resend_counter[MAXNETNODES];
|
||||
boolean hu_stopped = false;
|
||||
|
||||
// Client specific
|
||||
static ticcmd_t localcmds;
|
||||
static ticcmd_t localcmds2;
|
||||
static ticcmd_t localcmds3;
|
||||
static ticcmd_t localcmds4;
|
||||
static ticcmd_t localcmds[MAXSPLITSCREENPLAYERS];
|
||||
static boolean cl_packetmissed;
|
||||
// here it is for the secondary local player (splitscreen)
|
||||
static UINT8 mynode; // my address pointofview server
|
||||
@@ -159,10 +157,7 @@ boolean is_client_saturn[MAXNETNODES];
|
||||
#define ISSATURN 69
|
||||
#endif
|
||||
|
||||
static UINT8 localtextcmd[MAXTEXTCMD];
|
||||
static UINT8 localtextcmd2[MAXTEXTCMD]; // splitscreen
|
||||
static UINT8 localtextcmd3[MAXTEXTCMD]; // splitscreen == 2
|
||||
static UINT8 localtextcmd4[MAXTEXTCMD]; // splitscreen == 3
|
||||
static UINT8 localtextcmd[MAXSPLITSCREENPLAYERS][MAXTEXTCMD];
|
||||
static tic_t neededtic;
|
||||
SINT8 servernode = 0; // the number of the server node
|
||||
char connectedservername[MAXSERVERNAME+1];
|
||||
@@ -276,77 +271,30 @@ void RegisterNetXCmd(netxcmd_t id, void (*cmd_f)(UINT8 **p, INT32 playernum))
|
||||
listnetxcmd[id] = cmd_f;
|
||||
}
|
||||
|
||||
void SendNetXCmd(netxcmd_t id, const void *param, size_t nparam)
|
||||
void SendNetXCmdForPlayer(UINT8 playerid, netxcmd_t id, const void *param, size_t nparam)
|
||||
{
|
||||
if (localtextcmd[0]+2+nparam > MAXTEXTCMD)
|
||||
if ((localtextcmd[playerid])[0]+2+nparam > MAXTEXTCMD)
|
||||
{
|
||||
// for future reference: if (cv_debug) != debug disabled.
|
||||
CONS_Alert(CONS_ERROR, M_GetText("NetXCmd buffer full, cannot add netcmd %d! (size: %d, needed: %s)\n"), id, localtextcmd[0], sizeu1(nparam));
|
||||
// for future reference: if (cht_debug) != debug disabled.
|
||||
CONS_Alert(CONS_ERROR, M_GetText("NetXCmd buffer full, cannot add netcmd %d! (size: %d, needed: %s)\n"), id, localtextcmd[playerid][0], sizeu1(nparam));
|
||||
return;
|
||||
}
|
||||
localtextcmd[0]++;
|
||||
localtextcmd[localtextcmd[0]] = (UINT8)id;
|
||||
|
||||
localtextcmd[playerid][0]++;
|
||||
localtextcmd[playerid][localtextcmd[playerid][0]] = (UINT8)id;
|
||||
|
||||
if (param && nparam)
|
||||
{
|
||||
M_Memcpy(&localtextcmd[localtextcmd[0]+1], param, nparam);
|
||||
localtextcmd[0] = (UINT8)(localtextcmd[0] + (UINT8)nparam);
|
||||
M_Memcpy(&localtextcmd[playerid][localtextcmd[playerid][0] + 1], param, nparam);
|
||||
localtextcmd[playerid][0] = (UINT8)(localtextcmd[playerid][0] + (UINT8)nparam);
|
||||
}
|
||||
}
|
||||
|
||||
// splitscreen player
|
||||
void SendNetXCmd2(netxcmd_t id, const void *param, size_t nparam)
|
||||
{
|
||||
if (localtextcmd2[0]+2+nparam > MAXTEXTCMD)
|
||||
{
|
||||
I_Error("No more place in the buffer for netcmd %d\n",id);
|
||||
return;
|
||||
}
|
||||
localtextcmd2[0]++;
|
||||
localtextcmd2[localtextcmd2[0]] = (UINT8)id;
|
||||
if (param && nparam)
|
||||
{
|
||||
M_Memcpy(&localtextcmd2[localtextcmd2[0]+1], param, nparam);
|
||||
localtextcmd2[0] = (UINT8)(localtextcmd2[0] + (UINT8)nparam);
|
||||
}
|
||||
}
|
||||
|
||||
void SendNetXCmd3(netxcmd_t id, const void *param, size_t nparam)
|
||||
{
|
||||
if (localtextcmd3[0]+2+nparam > MAXTEXTCMD)
|
||||
{
|
||||
I_Error("No more place in the buffer for netcmd %d\n",id);
|
||||
return;
|
||||
}
|
||||
localtextcmd3[0]++;
|
||||
localtextcmd3[localtextcmd3[0]] = (UINT8)id;
|
||||
if (param && nparam)
|
||||
{
|
||||
M_Memcpy(&localtextcmd3[localtextcmd3[0]+1], param, nparam);
|
||||
localtextcmd3[0] = (UINT8)(localtextcmd3[0] + (UINT8)nparam);
|
||||
}
|
||||
}
|
||||
|
||||
void SendNetXCmd4(netxcmd_t id, const void *param, size_t nparam)
|
||||
{
|
||||
if (localtextcmd4[0]+2+nparam > MAXTEXTCMD)
|
||||
{
|
||||
I_Error("No more place in the buffer for netcmd %d\n",id);
|
||||
return;
|
||||
}
|
||||
localtextcmd4[0]++;
|
||||
localtextcmd4[localtextcmd4[0]] = (UINT8)id;
|
||||
if (param && nparam)
|
||||
{
|
||||
M_Memcpy(&localtextcmd4[localtextcmd4[0]+1], param, nparam);
|
||||
localtextcmd4[0] = (UINT8)(localtextcmd4[0] + (UINT8)nparam);
|
||||
}
|
||||
}
|
||||
|
||||
UINT8 GetFreeXCmdSize(void)
|
||||
/*UINT8 GetFreeXCmdSize(UINT8 playerid)
|
||||
{
|
||||
// -1 for the size and another -1 for the ID.
|
||||
return (UINT8)(localtextcmd[0] - 2);
|
||||
}
|
||||
return (UINT8)(localtextcmd[playerid][0] - 2);
|
||||
}*/
|
||||
|
||||
// Frees all textcmd memory for the specified tic
|
||||
static void D_FreeTextcmd(tic_t tic)
|
||||
@@ -510,10 +458,8 @@ void D_ResetTiccmds(void)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
memset(&localcmds, 0, sizeof(ticcmd_t));
|
||||
memset(&localcmds2, 0, sizeof(ticcmd_t));
|
||||
memset(&localcmds3, 0, sizeof(ticcmd_t));
|
||||
memset(&localcmds4, 0, sizeof(ticcmd_t));
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
memset(&localcmds[i], 0, sizeof(ticcmd_t));
|
||||
|
||||
// Reset the net command list
|
||||
for (i = 0; i < TEXTCMD_HASH_SIZE; i++)
|
||||
@@ -856,110 +802,6 @@ static void resynch_read_player(resynch_pak *rsp)
|
||||
P_SetThingPosition(players[i].mo);
|
||||
}
|
||||
|
||||
static inline void resynch_write_ctf(resynchend_pak *rst)
|
||||
{
|
||||
mobj_t *mflag;
|
||||
UINT8 i, j;
|
||||
|
||||
for (i = 0, mflag = redflag; i < 2; ++i, mflag = blueflag)
|
||||
{
|
||||
rst->flagx[i] = rst->flagy[i] = rst->flagz[i] = 0;
|
||||
rst->flagloose[i] = rst->flagflags[i] = 0;
|
||||
rst->flagplayer[i] = -1;
|
||||
|
||||
if (!mflag)
|
||||
{
|
||||
// Should be held by a player
|
||||
for (j = 0; j < MAXPLAYERS; ++j)
|
||||
{
|
||||
// GF_REDFLAG is 1, GF_BLUEFLAG is 2
|
||||
// redflag handling is i=0, blueflag is i=1
|
||||
// so check for gotflag == (i+1)
|
||||
if (!playeringame[j] || players[j].gotflag != (i+1))
|
||||
continue;
|
||||
rst->flagplayer[i] = (SINT8)j;
|
||||
break;
|
||||
}
|
||||
if (j == MAXPLAYERS) // fine, no I_Error
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "One of the flags has gone completely missing...\n");
|
||||
rst->flagplayer[i] = -2;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
rst->flagx[i] = (fixed_t)LONG(mflag->x);
|
||||
rst->flagy[i] = (fixed_t)LONG(mflag->y);
|
||||
rst->flagz[i] = (fixed_t)LONG(mflag->z);
|
||||
rst->flagflags[i] = LONG(mflag->flags2);
|
||||
rst->flagloose[i] = LONG(mflag->fuse); // Dropped or not?
|
||||
}
|
||||
}
|
||||
|
||||
static inline void resynch_read_ctf(resynchend_pak *p)
|
||||
{
|
||||
UINT8 i;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; ++i)
|
||||
players[i].gotflag = 0;
|
||||
|
||||
// Red flag
|
||||
if (p->flagplayer[0] == -2)
|
||||
; // The server doesn't even know what happened to it...
|
||||
else if (p->flagplayer[0] != -1) // Held by a player
|
||||
{
|
||||
if (!playeringame[p->flagplayer[0]])
|
||||
I_Error("Invalid red flag player %d who isn't in the game!", (INT32)p->flagplayer[0]);
|
||||
players[p->flagplayer[0]].gotflag = GF_REDFLAG;
|
||||
if (redflag)
|
||||
{
|
||||
P_RemoveMobj(redflag);
|
||||
redflag = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!redflag)
|
||||
redflag = P_SpawnMobj(0,0,0,MT_REDFLAG);
|
||||
|
||||
P_UnsetThingPosition(redflag);
|
||||
redflag->x = (fixed_t)LONG(p->flagx[0]);
|
||||
redflag->y = (fixed_t)LONG(p->flagy[0]);
|
||||
redflag->z = (fixed_t)LONG(p->flagz[0]);
|
||||
redflag->flags2 = LONG(p->flagflags[0]);
|
||||
redflag->fuse = LONG(p->flagloose[0]);
|
||||
P_SetThingPosition(redflag);
|
||||
}
|
||||
|
||||
// Blue flag
|
||||
if (p->flagplayer[1] == -2)
|
||||
; // The server doesn't even know what happened to it...
|
||||
else if (p->flagplayer[1] != -1) // Held by a player
|
||||
{
|
||||
if (!playeringame[p->flagplayer[1]])
|
||||
I_Error("Invalid blue flag player %d who isn't in the game!", (INT32)p->flagplayer[1]);
|
||||
players[p->flagplayer[1]].gotflag = GF_BLUEFLAG;
|
||||
if (blueflag)
|
||||
{
|
||||
P_RemoveMobj(blueflag);
|
||||
blueflag = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!blueflag)
|
||||
blueflag = P_SpawnMobj(0,0,0,MT_BLUEFLAG);
|
||||
|
||||
P_UnsetThingPosition(blueflag);
|
||||
blueflag->x = (fixed_t)LONG(p->flagx[1]);
|
||||
blueflag->y = (fixed_t)LONG(p->flagy[1]);
|
||||
blueflag->z = (fixed_t)LONG(p->flagz[1]);
|
||||
blueflag->flags2 = LONG(p->flagflags[1]);
|
||||
blueflag->fuse = LONG(p->flagloose[1]);
|
||||
P_SetThingPosition(blueflag);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void resynch_write_others(resynchend_pak *rst)
|
||||
{
|
||||
UINT8 i;
|
||||
@@ -1060,8 +902,6 @@ static void SV_SendResynch(INT32 node)
|
||||
netbuffer->packettype = PT_RESYNCHEND;
|
||||
|
||||
netbuffer->u.resynchend.randomseed = P_GetRandSeed();
|
||||
if (gametype == GT_CTF)
|
||||
resynch_write_ctf(&netbuffer->u.resynchend);
|
||||
resynch_write_others(&netbuffer->u.resynchend);
|
||||
|
||||
HSendPacket(node, true, 0, (sizeof(resynchend_pak)));
|
||||
@@ -1668,20 +1508,10 @@ static void SV_SendPlayerInfo(INT32 node)
|
||||
//No, don't do that, you fuckface.
|
||||
memset(netbuffer->u.playerinfo[i].address, 0, 4);
|
||||
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
if (!players[i].ctfteam)
|
||||
netbuffer->u.playerinfo[i].team = 255;
|
||||
else
|
||||
netbuffer->u.playerinfo[i].team = (UINT8)players[i].ctfteam;
|
||||
}
|
||||
if (players[i].spectator)
|
||||
netbuffer->u.playerinfo[i].team = 255;
|
||||
else
|
||||
{
|
||||
if (players[i].spectator)
|
||||
netbuffer->u.playerinfo[i].team = 255;
|
||||
else
|
||||
netbuffer->u.playerinfo[i].team = 0;
|
||||
}
|
||||
netbuffer->u.playerinfo[i].team = 0;
|
||||
|
||||
netbuffer->u.playerinfo[i].score = LONG(players[i].score);
|
||||
netbuffer->u.playerinfo[i].timeinserver = SHORT((UINT16)(players[i].jointime / TICRATE));
|
||||
@@ -1796,7 +1626,7 @@ static boolean SV_ResendingSavegameToAnyone(void)
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < MAXNETNODES; i++)
|
||||
if (resendingsavegame[i])
|
||||
if (nodeingame[i] && resendingsavegame[i])
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@@ -2008,7 +1838,7 @@ static void CL_ReloadReceivedSavegame(void)
|
||||
// we dont have P_ForceLocalAngle so were setting it manually here
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
localangle[i] = (angle_t)(players[displayplayers[i]].cmd.angleturn<<16);
|
||||
localangle[i] = (angle_t)(players[displayplayers[i]].cmd.angleturn << 16);
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
@@ -3240,7 +3070,7 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason)
|
||||
|
||||
demo_extradata[playernum] |= DXD_PLAYSTATE;
|
||||
|
||||
if (server && !demo.playback)
|
||||
if (server && !demo.playback && playernode[playernum] != UINT8_MAX)
|
||||
{
|
||||
INT32 node = playernode[playernum];
|
||||
//playerpernode[node] = 0; // It'd be better to remove them all at once, but ghosting happened, so continue to let CL_RemovePlayer do it one-by-one
|
||||
@@ -3249,13 +3079,7 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason)
|
||||
{
|
||||
SV_InitResynchVars(node); // If a resynch was in progress, well, it no longer needs to be.
|
||||
|
||||
nodeingame[node] = false;
|
||||
#ifdef SATURNPAK
|
||||
is_client_saturn[node] = false;
|
||||
#endif
|
||||
#ifdef SATURNSYNCH
|
||||
can_receive_gamestate[node] = false;
|
||||
#endif
|
||||
nodeingame[node] = false; // do we even need this?
|
||||
Net_CloseConnection(node);
|
||||
ResetNode(node);
|
||||
}
|
||||
@@ -3264,9 +3088,6 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason)
|
||||
if (K_IsPlayerWanted(&players[playernum]))
|
||||
K_CalculateBattleWanted();
|
||||
|
||||
if (gametype == GT_CTF)
|
||||
P_PlayerFlagBurst(&players[playernum], false); // Don't take the flag with you!
|
||||
|
||||
// If in a special stage, redistribute the player's rings across
|
||||
// the remaining players.
|
||||
if (G_IsSpecialStage(gamemap))
|
||||
@@ -3299,6 +3120,9 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason)
|
||||
|
||||
LUAh_PlayerQuit(&players[playernum], reason); // Lua hook for player quitting
|
||||
|
||||
if (playernum == displayplayers[0] && !demo.playback)
|
||||
displayplayers[0] = consoleplayer; // don't look through someone's view who isn't there
|
||||
|
||||
// Reset player data
|
||||
CL_ClearPlayer(playernum);
|
||||
|
||||
@@ -3318,9 +3142,6 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason)
|
||||
RemoveAdminPlayer(playernum); // don't stay admin after you're gone
|
||||
}
|
||||
|
||||
if (playernum == displayplayers[0] && !demo.playback)
|
||||
displayplayers[0] = consoleplayer; // don't look through someone's view who isn't there
|
||||
|
||||
LUA_InvalidatePlayer(&players[playernum]);
|
||||
|
||||
if (G_BattleGametype()) // SRB2Kart
|
||||
@@ -3361,9 +3182,6 @@ void CL_Reset(void)
|
||||
if (servernode > 0 && servernode < MAXNETNODES)
|
||||
{
|
||||
nodeingame[(UINT8)servernode] = false;
|
||||
#ifdef SATURNPAK
|
||||
is_client_saturn[(UINT8)servernode] = false;
|
||||
#endif
|
||||
Net_CloseConnection(servernode);
|
||||
}
|
||||
D_CloseConnection(); // netgame = false
|
||||
@@ -3708,16 +3526,13 @@ static void Command_Kick(void)
|
||||
if (pn == -1 || pn == 0)
|
||||
return;
|
||||
|
||||
if (server)
|
||||
// Special case if we are trying to kick a player who is downloading the game state:
|
||||
// trigger a timeout instead of kicking them, because a kick would only
|
||||
// take effect after they have finished downloading
|
||||
if (server && playernode[pn] != UINT8_MAX && sendingsavegame[playernode[pn]])
|
||||
{
|
||||
// Special case if we are trying to kick a player who is downloading the game state:
|
||||
// trigger a timeout instead of kicking them, because a kick would only
|
||||
// take effect after they have finished downloading
|
||||
if (sendingsavegame[playernode[pn]])
|
||||
{
|
||||
Net_ConnectionTimeout(playernode[pn]);
|
||||
return;
|
||||
}
|
||||
Net_ConnectionTimeout(playernode[pn]);
|
||||
return;
|
||||
}
|
||||
|
||||
WRITESINT8(p, pn);
|
||||
@@ -3773,7 +3588,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
||||
|
||||
// Is playernum authorized to make this kick?
|
||||
if (playernum != serverplayer && !IsPlayerAdmin(playernum)
|
||||
/*&& !(playerpernode[playernode[playernum]] == 2
|
||||
/*&& !(playernode[playernum] != UINT8_MAX && playerpernode[playernode[playernum]] == 2
|
||||
//&& nodetoplayer2[playernode[playernum]] == pnum)*/)
|
||||
{
|
||||
// We received a kick command from someone who isn't the
|
||||
@@ -4278,17 +4093,17 @@ void SV_ResetServer(void)
|
||||
sprintf(player_names[i], "Player %d", i + 1);
|
||||
}
|
||||
|
||||
memset(player_name_changes, 0, sizeof player_name_changes);
|
||||
|
||||
memset(playeringame, false, sizeof playeringame);
|
||||
memset(playernode, UINT8_MAX, sizeof playernode);
|
||||
|
||||
ClearAdminPlayers(); // Populate the entire adminplayers array with -1.
|
||||
|
||||
memset(player_name_changes, 0, sizeof player_name_changes);
|
||||
|
||||
pingmeasurecount = 1;
|
||||
memset(realpingtable, 0, sizeof realpingtable);
|
||||
memset(playerpingtable, 0, sizeof playerpingtable);
|
||||
|
||||
ClearAdminPlayers();
|
||||
|
||||
mynode = 0;
|
||||
cl_packetmissed = false;
|
||||
#ifdef SATURNSYNCH
|
||||
@@ -4657,10 +4472,8 @@ void SV_StopServer(void)
|
||||
Y_EndVote();
|
||||
gamestate = wipegamestate = GS_NULL;
|
||||
|
||||
localtextcmd[0] = 0;
|
||||
localtextcmd2[0] = 0;
|
||||
localtextcmd3[0] = 0;
|
||||
localtextcmd4[0] = 0;
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
localtextcmd[i][0] = 0;
|
||||
|
||||
for (i = firstticstosend; i < firstticstosend + TICQUEUE; i++)
|
||||
D_Clearticcmd(i);
|
||||
@@ -5399,11 +5212,10 @@ static void HandlePacketFromPlayer(SINT8 node)
|
||||
}
|
||||
|
||||
// Check player consistancy during the level
|
||||
if (((!can_receive_gamestate[node]) && realstart <= gametic && realstart > gametic - TICQUEUE+1 && gamestate == GS_LEVEL
|
||||
&& consistancy[realstart%TICQUEUE] != SHORT(netbuffer->u.clientpak.consistancy)) || (can_receive_gamestate[node] && realstart <= gametic && realstart + TICQUEUE - 1 > gametic && gamestate == GS_LEVEL
|
||||
if (gamestate == GS_LEVEL
|
||||
&& (realstart > gametic - TICQUEUE+1 && realstart <= gametic)
|
||||
&& consistancy[realstart%TICQUEUE] != SHORT(netbuffer->u.clientpak.consistancy)
|
||||
&& !resendingsavegame[node] && savegameresendcooldown[node] <= I_GetTime()
|
||||
&& !SV_ResendingSavegameToAnyone()))
|
||||
&& (!can_receive_gamestate[node] || (!resendingsavegame[node] && savegameresendcooldown[node] <= I_GetTime() && !SV_ResendingSavegameToAnyone())))
|
||||
{
|
||||
//#ifndef SATURNPAK // lug: keep this behaviour for v7.1 atleast
|
||||
// we need to send this so the client can tell us if it can receive the savegame
|
||||
@@ -5461,8 +5273,6 @@ static void HandlePacketFromPlayer(SINT8 node)
|
||||
DEBFILE(va("player %d kicked (synch failure) [%u] %d!=%d\n",
|
||||
netconsole, realstart, consistancy[realstart%TICQUEUE],
|
||||
SHORT(netbuffer->u.clientpak.consistancy)));
|
||||
gamestate_resend_counter[node] = 0;
|
||||
DEBFILE(va("gamestate counter %d for node %d\n", gamestate_resend_counter[node], netconsole));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -5615,12 +5425,6 @@ static void HandlePacketFromPlayer(SINT8 node)
|
||||
}
|
||||
Net_CloseConnection(node);
|
||||
nodeingame[node] = false;
|
||||
#ifdef SATURNPAK
|
||||
is_client_saturn[node] = false;
|
||||
#endif
|
||||
#ifdef SATURNSYNCH
|
||||
can_receive_gamestate[node] = false;
|
||||
#endif
|
||||
break;
|
||||
// -------------------------------------------- CLIENT RECEIVE ----------
|
||||
case PT_RESYNCHEND:
|
||||
@@ -5642,9 +5446,6 @@ static void HandlePacketFromPlayer(SINT8 node)
|
||||
resynch_local_inprogress = false;
|
||||
|
||||
P_SetRandSeed(netbuffer->u.resynchend.randomseed);
|
||||
|
||||
if (gametype == GT_CTF)
|
||||
resynch_read_ctf(&netbuffer->u.resynchend);
|
||||
resynch_read_others(&netbuffer->u.resynchend);
|
||||
|
||||
break;
|
||||
@@ -6082,26 +5883,26 @@ static void CL_SendClientCmd(void)
|
||||
else if (gamestate != GS_NULL)
|
||||
{
|
||||
packetsize = sizeof (clientcmd_pak);
|
||||
G_MoveTiccmd(&netbuffer->u.clientpak.cmd, &localcmds, 1);
|
||||
G_MoveTiccmd(&netbuffer->u.clientpak.cmd, &localcmds[0], 1);
|
||||
netbuffer->u.clientpak.consistancy = SHORT(consistancy[gametic%TICQUEUE]);
|
||||
|
||||
if (splitscreen || botingame) // Send a special packet with 2 cmd for splitscreen
|
||||
{
|
||||
netbuffer->packettype = (mis ? PT_CLIENT2MIS : PT_CLIENT2CMD);
|
||||
packetsize = sizeof (client2cmd_pak);
|
||||
G_MoveTiccmd(&netbuffer->u.client2pak.cmd2, &localcmds2, 1);
|
||||
G_MoveTiccmd(&netbuffer->u.client2pak.cmd2, &localcmds[1], 1);
|
||||
|
||||
if (splitscreen > 1)
|
||||
{
|
||||
netbuffer->packettype = (mis ? PT_CLIENT3MIS : PT_CLIENT3CMD);
|
||||
packetsize = sizeof (client3cmd_pak);
|
||||
G_MoveTiccmd(&netbuffer->u.client3pak.cmd3, &localcmds3, 1);
|
||||
G_MoveTiccmd(&netbuffer->u.client3pak.cmd3, &localcmds[2], 1);
|
||||
|
||||
if (splitscreen > 2)
|
||||
{
|
||||
netbuffer->packettype = (mis ? PT_CLIENT4MIS : PT_CLIENT4CMD);
|
||||
packetsize = sizeof (client4cmd_pak);
|
||||
G_MoveTiccmd(&netbuffer->u.client4pak.cmd4, &localcmds4, 1);
|
||||
G_MoveTiccmd(&netbuffer->u.client4pak.cmd4, &localcmds[3], 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6111,44 +5912,33 @@ static void CL_SendClientCmd(void)
|
||||
|
||||
if (cl_mode == CL_CONNECTED || dedicated)
|
||||
{
|
||||
UINT8 i;
|
||||
// Send extra data if needed
|
||||
if (localtextcmd[0])
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
netbuffer->packettype = PT_TEXTCMD;
|
||||
M_Memcpy(netbuffer->u.textcmd,localtextcmd, localtextcmd[0]+1);
|
||||
// All extra data have been sent
|
||||
if (HSendPacket(servernode, true, 0, localtextcmd[0]+1)) // Send can fail...
|
||||
localtextcmd[0] = 0;
|
||||
}
|
||||
if (localtextcmd[i][0])
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 3:
|
||||
netbuffer->packettype = PT_TEXTCMD4;
|
||||
break;
|
||||
case 2:
|
||||
netbuffer->packettype = PT_TEXTCMD3;
|
||||
break;
|
||||
case 1:
|
||||
netbuffer->packettype = PT_TEXTCMD2;
|
||||
break;
|
||||
default:
|
||||
netbuffer->packettype = PT_TEXTCMD;
|
||||
break;
|
||||
}
|
||||
|
||||
// Send extra data if needed for player 2 (splitscreen == 1)
|
||||
if (localtextcmd2[0])
|
||||
{
|
||||
netbuffer->packettype = PT_TEXTCMD2;
|
||||
M_Memcpy(netbuffer->u.textcmd, localtextcmd2, localtextcmd2[0]+1);
|
||||
// All extra data have been sent
|
||||
if (HSendPacket(servernode, true, 0, localtextcmd2[0]+1)) // Send can fail...
|
||||
localtextcmd2[0] = 0;
|
||||
}
|
||||
|
||||
// Send extra data if needed for player 3 (splitscreen == 2)
|
||||
if (localtextcmd3[0])
|
||||
{
|
||||
netbuffer->packettype = PT_TEXTCMD3;
|
||||
M_Memcpy(netbuffer->u.textcmd, localtextcmd3, localtextcmd3[0]+1);
|
||||
// All extra data have been sent
|
||||
if (HSendPacket(servernode, true, 0, localtextcmd3[0]+1)) // Send can fail...
|
||||
localtextcmd3[0] = 0;
|
||||
}
|
||||
|
||||
// Send extra data if needed for player 4 (splitscreen == 3)
|
||||
if (localtextcmd4[0])
|
||||
{
|
||||
netbuffer->packettype = PT_TEXTCMD4;
|
||||
M_Memcpy(netbuffer->u.textcmd, localtextcmd4, localtextcmd4[0]+1);
|
||||
// All extra data have been sent
|
||||
if (HSendPacket(servernode, true, 0, localtextcmd4[0]+1)) // Send can fail...
|
||||
localtextcmd4[0] = 0;
|
||||
M_Memcpy(netbuffer->u.textcmd, localtextcmd[i], localtextcmd[i][0]+1);
|
||||
// All extra data have been sent
|
||||
if (HSendPacket(servernode, true, 0, localtextcmd[i][0]+1)) // Send can fail...
|
||||
localtextcmd[i][0] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6168,106 +5958,108 @@ static void SV_SendTics(void)
|
||||
// for each node create a packet with x tics and send it
|
||||
// x is computed using supposedtics[n], max packet size and maketic
|
||||
for (n = 1; n < MAXNETNODES; n++)
|
||||
if (nodeingame[n])
|
||||
{
|
||||
if (!nodeingame[n])
|
||||
continue;
|
||||
|
||||
// assert supposedtics[n]>=nettics[n]
|
||||
realfirsttic = supposedtics[n];
|
||||
lasttictosend = maketic;
|
||||
|
||||
if (lasttictosend - nettics[n] >= BACKUPTICS)
|
||||
lasttictosend = nettics[n] + BACKUPTICS-1;
|
||||
|
||||
if (realfirsttic >= lasttictosend)
|
||||
{
|
||||
// assert supposedtics[n]>=nettics[n]
|
||||
realfirsttic = supposedtics[n];
|
||||
lasttictosend = maketic;
|
||||
|
||||
if (lasttictosend - nettics[n] >= BACKUPTICS)
|
||||
lasttictosend = nettics[n] + BACKUPTICS-1;
|
||||
|
||||
if (realfirsttic >= lasttictosend)
|
||||
{
|
||||
// well we have sent all tics we will so use extrabandwidth
|
||||
// to resent packet that are supposed lost (this is necessary since lost
|
||||
// packet detection work when we have received packet with firsttic > neededtic
|
||||
// (getpacket servertics case)
|
||||
DEBFILE(va("Nothing to send node %u mak=%u sup=%u net=%u \n",
|
||||
n, lasttictosend, supposedtics[n], nettics[n]));
|
||||
realfirsttic = nettics[n];
|
||||
if (realfirsttic >= lasttictosend || (I_GetTime() + n)&3)
|
||||
// all tic are ok
|
||||
continue;
|
||||
DEBFILE(va("Sent %d anyway\n", realfirsttic));
|
||||
}
|
||||
if (realfirsttic < firstticstosend)
|
||||
realfirsttic = firstticstosend;
|
||||
|
||||
// compute the length of the packet and cut it if too large
|
||||
packsize = BASESERVERTICSSIZE;
|
||||
for (i = realfirsttic; i < lasttictosend; i++)
|
||||
{
|
||||
packsize += sizeof (ticcmd_t) * doomcom->numslots;
|
||||
packsize += TotalTextCmdPerTic(i);
|
||||
|
||||
if (packsize > software_MAXPACKETLENGTH)
|
||||
{
|
||||
DEBFILE(va("packet too large (%s) at tic %d (should be from %d to %d)\n",
|
||||
sizeu1(packsize), i, realfirsttic, lasttictosend));
|
||||
lasttictosend = i;
|
||||
|
||||
// too bad: too much player have send extradata and there is too
|
||||
// much data in one tic.
|
||||
// To avoid it put the data on the next tic. (see getpacket
|
||||
// textcmd case) but when numplayer changes the computation can be different
|
||||
if (lasttictosend == realfirsttic)
|
||||
{
|
||||
if (packsize > MAXPACKETLENGTH)
|
||||
I_Error("Too many players: can't send %s data for %d players to node %d\n"
|
||||
"Well sorry nobody is perfect....\n",
|
||||
sizeu1(packsize), doomcom->numslots, n);
|
||||
else
|
||||
{
|
||||
lasttictosend++; // send it anyway!
|
||||
DEBFILE("sending it anyway\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Send the tics
|
||||
netbuffer->packettype = PT_SERVERTICS;
|
||||
netbuffer->u.serverpak.starttic = (UINT8)realfirsttic;
|
||||
netbuffer->u.serverpak.numtics = (UINT8)(lasttictosend - realfirsttic);
|
||||
netbuffer->u.serverpak.numslots = (UINT8)SHORT(doomcom->numslots);
|
||||
bufpos = (UINT8 *)&netbuffer->u.serverpak.cmds;
|
||||
|
||||
for (i = realfirsttic; i < lasttictosend; i++)
|
||||
{
|
||||
bufpos = G_DcpyTiccmd(bufpos, netcmds[i%TICQUEUE], doomcom->numslots * sizeof (ticcmd_t));
|
||||
}
|
||||
|
||||
// add textcmds
|
||||
for (i = realfirsttic; i < lasttictosend; i++)
|
||||
{
|
||||
ntextcmd = bufpos++;
|
||||
*ntextcmd = 0;
|
||||
for (j = 0; j < MAXPLAYERS; j++)
|
||||
{
|
||||
UINT8 *textcmd = D_GetExistingTextcmd(i, j);
|
||||
INT32 size = textcmd ? textcmd[0] : 0;
|
||||
|
||||
if ((!j || playeringame[j]) && size)
|
||||
{
|
||||
(*ntextcmd)++;
|
||||
WRITEUINT8(bufpos, j);
|
||||
M_Memcpy(bufpos, textcmd, size + 1);
|
||||
bufpos += size + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
packsize = bufpos - (UINT8 *)&(netbuffer->u);
|
||||
|
||||
HSendPacket(n, false, 0, packsize);
|
||||
// when tic are too large, only one tic is sent so don't go backward!
|
||||
if (lasttictosend-doomcom->extratics > realfirsttic)
|
||||
supposedtics[n] = lasttictosend-doomcom->extratics;
|
||||
else
|
||||
supposedtics[n] = lasttictosend;
|
||||
if (supposedtics[n] < nettics[n]) supposedtics[n] = nettics[n];
|
||||
// well we have sent all tics we will so use extrabandwidth
|
||||
// to resent packet that are supposed lost (this is necessary since lost
|
||||
// packet detection work when we have received packet with firsttic > neededtic
|
||||
// (getpacket servertics case)
|
||||
DEBFILE(va("Nothing to send node %u mak=%u sup=%u net=%u \n",
|
||||
n, lasttictosend, supposedtics[n], nettics[n]));
|
||||
realfirsttic = nettics[n];
|
||||
if (realfirsttic >= lasttictosend || (I_GetTime() + n)&3)
|
||||
// all tic are ok
|
||||
continue;
|
||||
DEBFILE(va("Sent %d anyway\n", realfirsttic));
|
||||
}
|
||||
if (realfirsttic < firstticstosend)
|
||||
realfirsttic = firstticstosend;
|
||||
|
||||
// compute the length of the packet and cut it if too large
|
||||
packsize = BASESERVERTICSSIZE;
|
||||
for (i = realfirsttic; i < lasttictosend; i++)
|
||||
{
|
||||
packsize += sizeof (ticcmd_t) * doomcom->numslots;
|
||||
packsize += TotalTextCmdPerTic(i);
|
||||
|
||||
if (packsize > software_MAXPACKETLENGTH)
|
||||
{
|
||||
DEBFILE(va("packet too large (%s) at tic %d (should be from %d to %d)\n",
|
||||
sizeu1(packsize), i, realfirsttic, lasttictosend));
|
||||
lasttictosend = i;
|
||||
|
||||
// too bad: too much player have send extradata and there is too
|
||||
// much data in one tic.
|
||||
// To avoid it put the data on the next tic. (see getpacket
|
||||
// textcmd case) but when numplayer changes the computation can be different
|
||||
if (lasttictosend == realfirsttic)
|
||||
{
|
||||
if (packsize > MAXPACKETLENGTH)
|
||||
I_Error("Too many players: can't send %s data for %d players to node %d\n"
|
||||
"Well sorry nobody is perfect....\n",
|
||||
sizeu1(packsize), doomcom->numslots, n);
|
||||
else
|
||||
{
|
||||
lasttictosend++; // send it anyway!
|
||||
DEBFILE("sending it anyway\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Send the tics
|
||||
netbuffer->packettype = PT_SERVERTICS;
|
||||
netbuffer->u.serverpak.starttic = (UINT8)realfirsttic;
|
||||
netbuffer->u.serverpak.numtics = (UINT8)(lasttictosend - realfirsttic);
|
||||
netbuffer->u.serverpak.numslots = (UINT8)SHORT(doomcom->numslots);
|
||||
bufpos = (UINT8 *)&netbuffer->u.serverpak.cmds;
|
||||
|
||||
for (i = realfirsttic; i < lasttictosend; i++)
|
||||
{
|
||||
bufpos = G_DcpyTiccmd(bufpos, netcmds[i%TICQUEUE], doomcom->numslots * sizeof (ticcmd_t));
|
||||
}
|
||||
|
||||
// add textcmds
|
||||
for (i = realfirsttic; i < lasttictosend; i++)
|
||||
{
|
||||
ntextcmd = bufpos++;
|
||||
*ntextcmd = 0;
|
||||
for (j = 0; j < MAXPLAYERS; j++)
|
||||
{
|
||||
UINT8 *textcmd = D_GetExistingTextcmd(i, j);
|
||||
INT32 size = textcmd ? textcmd[0] : 0;
|
||||
|
||||
if ((!j || playeringame[j]) && size)
|
||||
{
|
||||
(*ntextcmd)++;
|
||||
WRITEUINT8(bufpos, j);
|
||||
M_Memcpy(bufpos, textcmd, size + 1);
|
||||
bufpos += size + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
packsize = bufpos - (UINT8 *)&(netbuffer->u);
|
||||
|
||||
HSendPacket(n, false, 0, packsize);
|
||||
// when tic are too large, only one tic is sent so don't go backward!
|
||||
if (lasttictosend-doomcom->extratics > realfirsttic)
|
||||
supposedtics[n] = lasttictosend-doomcom->extratics;
|
||||
else
|
||||
supposedtics[n] = lasttictosend;
|
||||
if (supposedtics[n] < nettics[n]) supposedtics[n] = nettics[n];
|
||||
}
|
||||
// node 0 is me!
|
||||
supposedtics[0] = maketic;
|
||||
}
|
||||
@@ -6275,27 +6067,27 @@ static void SV_SendTics(void)
|
||||
//
|
||||
// TryRunTics
|
||||
//
|
||||
static inline void CreateNewLocalCMD(UINT8 p, INT32 realtics)
|
||||
{
|
||||
G_BuildTiccmd(&localcmds[p], realtics, p+1);
|
||||
localcmds[p].angleturn |= TICCMD_RECEIVED;
|
||||
}
|
||||
|
||||
static void Local_Maketic(INT32 realtics)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
I_OsPolling(); // I_Getevent
|
||||
D_ProcessEvents(); // menu responder, cons responder,
|
||||
// game responder calls HU_Responder, AM_Responder, F_Responder,
|
||||
// and G_MapEventsToControls
|
||||
if (!dedicated) rendergametic = gametic;
|
||||
// translate inputs (keyboard/mouse/joystick) into game controls
|
||||
G_BuildTiccmd(&localcmds, realtics, 1);
|
||||
if (splitscreen || botingame)
|
||||
{
|
||||
G_BuildTiccmd(&localcmds2, realtics, 2);
|
||||
if (splitscreen > 1)
|
||||
{
|
||||
G_BuildTiccmd(&localcmds3, realtics, 3);
|
||||
if (splitscreen > 2)
|
||||
G_BuildTiccmd(&localcmds4, realtics, 4);
|
||||
}
|
||||
}
|
||||
|
||||
localcmds.angleturn |= TICCMD_RECEIVED;
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
CreateNewLocalCMD(i, realtics);
|
||||
}
|
||||
}
|
||||
|
||||
void SV_SpawnPlayer(INT32 playernum, INT32 x, INT32 y, angle_t angle)
|
||||
@@ -6334,29 +6126,31 @@ static void SV_Maketic(void)
|
||||
INT32 j;
|
||||
|
||||
for (j = 0; j < MAXNETNODES; j++)
|
||||
if (playerpernode[j])
|
||||
{
|
||||
INT32 player = nodetoplayer[j];
|
||||
if ((netcmds[maketic%TICQUEUE][player].angleturn & TICCMD_RECEIVED) == 0)
|
||||
{ // we didn't receive this tic
|
||||
INT32 i;
|
||||
{
|
||||
if (!playerpernode[j])
|
||||
continue;
|
||||
|
||||
DEBFILE(va("MISS tic%4d for node %d\n", maketic, j));
|
||||
INT32 player = nodetoplayer[j];
|
||||
if ((netcmds[maketic%TICQUEUE][player].angleturn & TICCMD_RECEIVED) == 0)
|
||||
{ // we didn't receive this tic
|
||||
INT32 i;
|
||||
|
||||
DEBFILE(va("MISS tic%4d for node %d\n", maketic, j));
|
||||
#if defined(PARANOIA) && 0
|
||||
CONS_Debug(DBG_NETPLAY, "Client Misstic %d\n", maketic);
|
||||
CONS_Debug(DBG_NETPLAY, "Client Misstic %d\n", maketic);
|
||||
#endif
|
||||
// copy the old tic
|
||||
for (i = 0; i < playerpernode[j]; i++)
|
||||
{
|
||||
if (i == 0) player = nodetoplayer[j];
|
||||
else if (i == 1) player = nodetoplayer2[j];
|
||||
else if (i == 2) player = nodetoplayer3[j];
|
||||
else if (i == 3) player = nodetoplayer4[j];
|
||||
netcmds[maketic%TICQUEUE][player] = netcmds[(maketic-1)%TICQUEUE][player];
|
||||
netcmds[maketic%TICQUEUE][player].angleturn &= ~TICCMD_RECEIVED;
|
||||
}
|
||||
// copy the old tic
|
||||
for (i = 0; i < playerpernode[j]; i++)
|
||||
{
|
||||
if (i == 0) player = nodetoplayer[j];
|
||||
else if (i == 1) player = nodetoplayer2[j];
|
||||
else if (i == 2) player = nodetoplayer3[j];
|
||||
else if (i == 3) player = nodetoplayer4[j];
|
||||
netcmds[maketic%TICQUEUE][player] = netcmds[(maketic-1)%TICQUEUE][player];
|
||||
netcmds[maketic%TICQUEUE][player].angleturn &= ~TICCMD_RECEIVED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// all tic are now proceed make the next
|
||||
maketic++;
|
||||
@@ -6585,7 +6379,7 @@ static void UpdatePingTable(void)
|
||||
PingUpdate();
|
||||
// update node latency values so we can take an average later.
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i])
|
||||
if (playeringame[i] && playernode[i] != UINT8_MAX)
|
||||
realpingtable[i] += GetLag(playernode[i]);
|
||||
pingmeasurecount++;
|
||||
}
|
||||
@@ -6683,6 +6477,14 @@ void NetUpdate(void)
|
||||
if (realtics <= 0) // nothing new to update
|
||||
return;
|
||||
|
||||
if (realtics > 5)
|
||||
{
|
||||
if (server)
|
||||
realtics = 1;
|
||||
else
|
||||
realtics = 5;
|
||||
}
|
||||
|
||||
#ifdef DEDICATEDIDLETIME
|
||||
if (server && dedicated && gamestate == GS_LEVEL)
|
||||
{
|
||||
@@ -6731,14 +6533,6 @@ void NetUpdate(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (realtics > 5)
|
||||
{
|
||||
if (server)
|
||||
realtics = 1;
|
||||
else
|
||||
realtics = 5;
|
||||
}
|
||||
|
||||
gametime = nowtime;
|
||||
|
||||
UpdatePingTable();
|
||||
@@ -6831,6 +6625,9 @@ void NetUpdate(void)
|
||||
}
|
||||
Net_AckTicker();
|
||||
HandleNodeTimeouts();
|
||||
|
||||
nowtime /= NEWTICRATERATIO;
|
||||
|
||||
if (nowtime > resptime)
|
||||
{
|
||||
resptime = nowtime;
|
||||
|
||||
+3
-13
@@ -182,14 +182,6 @@ typedef struct
|
||||
{
|
||||
UINT32 randomseed;
|
||||
|
||||
// CTF flag stuff
|
||||
SINT8 flagplayer[2];
|
||||
INT32 flagloose[2];
|
||||
INT32 flagflags[2];
|
||||
fixed_t flagx[2];
|
||||
fixed_t flagy[2];
|
||||
fixed_t flagz[2];
|
||||
|
||||
UINT32 ingame; // Spectator bit for each player
|
||||
INT32 ctfteam[MAXPLAYERS]; // Which team? (can't be 1 bit, since in regular Match there are no teams)
|
||||
|
||||
@@ -600,10 +592,8 @@ void D_ClientServerInit(void);
|
||||
|
||||
// Initialise the other field
|
||||
void RegisterNetXCmd(netxcmd_t id, void (*cmd_f)(UINT8 **p, INT32 playernum));
|
||||
void SendNetXCmd(netxcmd_t id, const void *param, size_t nparam);
|
||||
void SendNetXCmd2(netxcmd_t id, const void *param, size_t nparam); // splitsreen player
|
||||
void SendNetXCmd3(netxcmd_t id, const void *param, size_t nparam); // splitsreen3 player
|
||||
void SendNetXCmd4(netxcmd_t id, const void *param, size_t nparam); // splitsreen4 player
|
||||
void SendNetXCmdForPlayer(UINT8 playerid, netxcmd_t id, const void *param, size_t nparam);
|
||||
#define SendNetXCmd(id, param, nparam) SendNetXCmdForPlayer(0, id, param, nparam) // Shortcut for P1
|
||||
|
||||
// Create any new ticcmds and broadcast to other players.
|
||||
void NetKeepAlive(void);
|
||||
@@ -650,7 +640,7 @@ INT32 D_NumPlayers(void);
|
||||
void D_ResetTiccmds(void);
|
||||
|
||||
tic_t GetLag(INT32 node);
|
||||
UINT8 GetFreeXCmdSize(void);
|
||||
//UINT8 GetFreeXCmdSize(UINT8 playerid);
|
||||
|
||||
extern UINT8 hu_resynching;
|
||||
#ifdef SATURNSYNCH
|
||||
|
||||
+9
-7
@@ -15,6 +15,7 @@
|
||||
/// plus functions to parse command line parameters, configure game
|
||||
/// parameters, and call the startup functions.
|
||||
|
||||
#include "d_netcmd.h"
|
||||
#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
@@ -181,7 +182,7 @@ static inline void D_DeviceLEDTick(void)
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (G_GetDeviceForPlayer(i) == 0)
|
||||
if (cv_usejoystick[i].value == 0)
|
||||
continue;
|
||||
|
||||
color[i] = G_GetSkinColor(i);
|
||||
@@ -449,6 +450,8 @@ static boolean D_Display(void)
|
||||
{
|
||||
if (players[displayplayers[i]].mo || players[displayplayers[i]].playerstate == PST_DEAD)
|
||||
{
|
||||
viewssnum = i;
|
||||
|
||||
if (i == 0) // Initialize for P1
|
||||
{
|
||||
viewwindowy = 0;
|
||||
@@ -458,8 +461,6 @@ static boolean D_Display(void)
|
||||
objectsdrawn = 0;
|
||||
}
|
||||
|
||||
viewssnum = i;
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
HWR_RenderPlayerView(i, &players[displayplayers[i]]);
|
||||
@@ -537,6 +538,8 @@ static boolean D_Display(void)
|
||||
PS_START_TIMING(ps_uitime);
|
||||
ST_Drawer();
|
||||
HU_Drawer();
|
||||
|
||||
NetUpdate(); // TEST: run this EVERY frame
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -740,10 +743,10 @@ void D_SRB2Loop(void)
|
||||
|
||||
renderisnewtic = (realtics > 0 || singletics);
|
||||
|
||||
refreshdirmenu = 0; // not sure where to put this, here as good as any?
|
||||
|
||||
if (renderisnewtic)
|
||||
{
|
||||
refreshdirmenu = 0; // not sure where to put this, here as good as any?
|
||||
|
||||
// don't skip more than 10 frames at a time
|
||||
// (fadein / fadeout cause massive frame skip!)
|
||||
if (realtics > 8)
|
||||
@@ -852,7 +855,7 @@ void D_SRB2Loop(void)
|
||||
LUA_Step();
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
if (! dedicated)
|
||||
if (!dedicated)
|
||||
{
|
||||
Discord_RunCallbacks();
|
||||
}
|
||||
@@ -1836,7 +1839,6 @@ void D_SRB2Main(void)
|
||||
}
|
||||
|
||||
S_InitMusicDefs();
|
||||
S_InitMTDefs();
|
||||
|
||||
CONS_Printf("ST_Init(): Init status bar.\n");
|
||||
ST_Init();
|
||||
|
||||
+1
-13
@@ -69,8 +69,6 @@ INT16 hardware_MAXPACKETLENGTH;
|
||||
|
||||
boolean (*I_NetGet)(void) = NULL;
|
||||
void (*I_NetSend)(void) = NULL;
|
||||
boolean (*I_NetCanSend)(void) = NULL;
|
||||
boolean (*I_NetCanGet)(void) = NULL;
|
||||
void (*I_NetCloseSocket)(void) = NULL;
|
||||
void (*I_NetFreeNodenum)(INT32 nodenum) = NULL;
|
||||
SINT8 (*I_NetMakeNodewPort)(const char *address, const char* port) = NULL;
|
||||
@@ -1087,15 +1085,7 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen
|
||||
netbuffer->ackreturn = 0;
|
||||
if (reliable)
|
||||
{
|
||||
if (I_NetCanSend && !I_NetCanSend())
|
||||
{
|
||||
if (netbuffer->packettype < PT_CANFAIL)
|
||||
GetFreeAcknum(&netbuffer->ack, true);
|
||||
|
||||
DEBFILE("HSendPacket: Out of bandwidth\n");
|
||||
return false;
|
||||
}
|
||||
else if (!GetFreeAcknum(&netbuffer->ack, false))
|
||||
if (!GetFreeAcknum(&netbuffer->ack, false))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -1292,7 +1282,6 @@ boolean D_CheckNetGame(void)
|
||||
|
||||
I_NetGet = Internal_Get;
|
||||
I_NetSend = Internal_Send;
|
||||
I_NetCanSend = NULL;
|
||||
I_NetCloseSocket = NULL;
|
||||
I_NetFreeNodenum = Internal_FreeNodenum;
|
||||
I_NetMakeNodewPort = NULL;
|
||||
@@ -1491,7 +1480,6 @@ void D_CloseConnection(void)
|
||||
|
||||
I_NetGet = Internal_Get;
|
||||
I_NetSend = Internal_Send;
|
||||
I_NetCanSend = NULL;
|
||||
I_NetCloseSocket = NULL;
|
||||
I_NetFreeNodenum = Internal_FreeNodenum;
|
||||
I_NetMakeNodewPort = NULL;
|
||||
|
||||
+116
-751
File diff suppressed because it is too large.
Load diff
+2
-8
@@ -43,18 +43,12 @@ extern consvar_t cv_seenames, cv_allowseenames;
|
||||
extern consvar_t cv_usemouse;
|
||||
//WTF
|
||||
extern consvar_t cv_mouseturn;
|
||||
extern consvar_t cv_usejoystick;
|
||||
extern consvar_t cv_usejoystick2;
|
||||
extern consvar_t cv_usejoystick3;
|
||||
extern consvar_t cv_usejoystick4;
|
||||
extern consvar_t cv_usejoystick[4]; //MAXSPLITSCREENPLAYERS
|
||||
#ifdef LJOYSTICK
|
||||
extern consvar_t cv_joyport;
|
||||
extern consvar_t cv_joyport2;
|
||||
#endif
|
||||
extern consvar_t cv_joyscale;
|
||||
extern consvar_t cv_joyscale2;
|
||||
extern consvar_t cv_joyscale3;
|
||||
extern consvar_t cv_joyscale4;
|
||||
extern consvar_t cv_joyscale[4]; //MAXSPLITSCREENPLAYERS
|
||||
|
||||
// splitscreen with second mouse
|
||||
extern consvar_t cv_mouse2port;
|
||||
|
||||
+3
-22
@@ -257,8 +257,6 @@ static void clear_levels(void)
|
||||
// Custom map header info
|
||||
// (no need to set num to 0, we're freeing the entire header shortly)
|
||||
Z_Free(mapheaderinfo[i]->customopts);
|
||||
|
||||
P_DeleteGrades(i);
|
||||
Z_Free(mapheaderinfo[i]);
|
||||
mapheaderinfo[i] = NULL;
|
||||
}
|
||||
@@ -802,22 +800,8 @@ static void readlevelheader(MYFILE *f, INT32 num, INT32 wadnum)
|
||||
// Now go to uppercase
|
||||
strupr(word2);
|
||||
|
||||
// NiGHTS grades
|
||||
if (fastncmp(word, "GRADES", 6))
|
||||
{
|
||||
UINT8 mare = (UINT8)atoi(word + 6);
|
||||
|
||||
if (mare <= 0 || mare > 8)
|
||||
{
|
||||
deh_warning("Level header %d: unknown word '%s'", num, word);
|
||||
continue;
|
||||
}
|
||||
|
||||
P_AddGradesForMare((INT16)(num-1), mare-1, word2);
|
||||
}
|
||||
|
||||
// Strings that can be truncated
|
||||
else if (fastcmp(word, "SCRIPTNAME"))
|
||||
if (fastcmp(word, "SCRIPTNAME"))
|
||||
{
|
||||
deh_strlcpy(mapheaderinfo[num-1]->scriptname, word2,
|
||||
sizeof(mapheaderinfo[num-1]->scriptname), va("Level header %d: scriptname", num));
|
||||
@@ -1493,9 +1477,6 @@ actionpointer_t actionpointers[] =
|
||||
{{A_SpawnObjectRelative}, "A_SPAWNOBJECTRELATIVE"},
|
||||
{{A_ChangeAngleRelative}, "A_CHANGEANGLERELATIVE"},
|
||||
{{A_ChangeAngleAbsolute}, "A_CHANGEANGLEABSOLUTE"},
|
||||
{{A_RollAngle}, "A_ROLLANGLE"},
|
||||
{{A_ChangeRollAngleRelative},"A_CHANGEROLLANGLERELATIVE"},
|
||||
{{A_ChangeRollAngleAbsolute},"A_CHANGEROLLANGLEABSOLUTE"},
|
||||
{{A_PlaySound}, "A_PLAYSOUND"},
|
||||
{{A_FindTarget}, "A_FINDTARGET"},
|
||||
{{A_FindTracer}, "A_FINDTRACER"},
|
||||
@@ -8541,13 +8522,13 @@ static int lua_enumlib_basic_fallback(lua_State* L)
|
||||
|
||||
static int lua_enumlib_mariomode_get(lua_State *L)
|
||||
{
|
||||
lua_pushboolean(L, mariomode != 0);
|
||||
lua_pushboolean(L, false);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lua_enumlib_twodlevel_get(lua_State *L)
|
||||
{
|
||||
lua_pushboolean(L, twodlevel);
|
||||
lua_pushboolean(L, false);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -522,6 +522,22 @@ extern boolean capslock;
|
||||
// i_system.c, replace getchar() once the keyboard has been appropriated
|
||||
INT32 I_GetKey(void);
|
||||
|
||||
/* http://www.cse.yorku.ca/~oz/hash.html */
|
||||
static inline
|
||||
UINT32 quickncasehash (const char *p, size_t n)
|
||||
{
|
||||
size_t i = 0;
|
||||
UINT32 x = 5381;
|
||||
|
||||
while (i < n && p[i])
|
||||
{
|
||||
x = (x * 33) ^ tolower(p[i]);
|
||||
i++;
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
#ifndef min // Double-Check with WATTCP-32's cdefs.h
|
||||
#define min(x, y) (((x) < (y)) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
@@ -323,15 +323,6 @@ enum GameType // SRB2Kart
|
||||
GT_RACE = 0, // also used in record attack
|
||||
GT_MATCH, // battle, but renaming would be silly
|
||||
NUMGAMETYPES,
|
||||
|
||||
// TODO: This is *horrid*. Remove this hack ASAP.
|
||||
// the following have been left in on account of just not wanting to deal with removing all the checks for them
|
||||
GT_COOP,
|
||||
GT_COMPETITION,
|
||||
GT_TEAMMATCH,
|
||||
GT_TAG,
|
||||
GT_HIDEANDSEEK,
|
||||
GT_CTF
|
||||
};
|
||||
// If you alter this list, update dehacked.c, and Gametype_Names in g_game.c
|
||||
|
||||
|
||||
+6
-5
@@ -327,7 +327,8 @@ char menupath[1024];
|
||||
size_t menupathindex[menudepth];
|
||||
size_t menudepthleft = menudepth;
|
||||
|
||||
char menusearch[MAXSTRINGLENGTH+1];
|
||||
char menusearchbuf[MAXSTRINGLENGTH+1];
|
||||
textinput_t menusearch;
|
||||
|
||||
char **dirmenu, **coredirmenu; // core only local for this file
|
||||
size_t sizedirmenu, sizecoredirmenu; // ditto
|
||||
@@ -497,7 +498,7 @@ static boolean filemenucmp(char *haystack, char *needle)
|
||||
strupr(localhaystack);
|
||||
if (cv_addons_search_type.value)
|
||||
return (strstr(localhaystack, needle) != 0);
|
||||
return (!strncmp(localhaystack, needle, menusearch[0]));
|
||||
return (!strncmp(localhaystack, needle, menusearch.length));
|
||||
}
|
||||
|
||||
void closefilemenu(boolean validsize)
|
||||
@@ -563,7 +564,7 @@ void searchfilemenu(char *tempname)
|
||||
|
||||
first = (((UINT8)(coredirmenu[0][DIR_TYPE]) == EXT_UP) ? 1 : 0); // skip UP...
|
||||
|
||||
if (!menusearch[0])
|
||||
if (!menusearch.length)
|
||||
{
|
||||
if (dirmenu)
|
||||
Z_Free(dirmenu);
|
||||
@@ -590,7 +591,7 @@ void searchfilemenu(char *tempname)
|
||||
return;
|
||||
}
|
||||
|
||||
strcpy(localmenusearch, menusearch+1);
|
||||
strcpy(localmenusearch, menusearch.buffer);
|
||||
if (!cv_addons_search_case.value)
|
||||
strupr(localmenusearch);
|
||||
|
||||
@@ -652,7 +653,7 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
|
||||
tempname = Z_StrDup(dirmenu[dir_on[menudepthleft]]+DIR_STRING); // don't need to I_Error if can't make - not important, just QoL
|
||||
}
|
||||
else
|
||||
menusearch[0] = menusearch[1] = 0; // clear search
|
||||
M_TextInputInit(&menusearch, menusearchbuf, MAXSTRINGLENGTH+1);
|
||||
|
||||
if (!(dirhandle = opendir(menupath))) // get directory
|
||||
{
|
||||
|
||||
+3
-1
@@ -7,6 +7,7 @@
|
||||
#include "doomdef.h"
|
||||
#include "d_netfil.h"
|
||||
#include "m_menu.h" // MAXSTRINGLENGTH
|
||||
#include "m_textinput.h"
|
||||
|
||||
extern consvar_t cv_addons_option, cv_addons_folder, cv_addons_md5, cv_addons_showall, cv_addons_search_case, cv_addons_search_type;
|
||||
|
||||
@@ -34,7 +35,8 @@ extern char menupath[1024];
|
||||
extern size_t menupathindex[menudepth];
|
||||
extern size_t menudepthleft;
|
||||
|
||||
extern char menusearch[MAXSTRINGLENGTH+1];
|
||||
extern char menusearchbuf[MAXSTRINGLENGTH+1];
|
||||
extern textinput_t menusearch;
|
||||
|
||||
extern char **dirmenu;
|
||||
extern size_t sizedirmenu;
|
||||
|
||||
+175
-604
File diff suppressed because it is too large.
Load diff
+15
-10
@@ -120,12 +120,21 @@ extern consvar_t cv_pauseifunfocused;
|
||||
//extern consvar_t cv_crosshair, cv_crosshair2, cv_crosshair3, cv_crosshair4;
|
||||
extern consvar_t cv_invertmouse/*, cv_alwaysfreelook, cv_chasefreelook, cv_mousemove*/;
|
||||
extern consvar_t cv_invertmouse2/*, cv_alwaysfreelook2, cv_chasefreelook2, cv_mousemove2*/;
|
||||
extern consvar_t cv_useranalog, cv_useranalog2, cv_useranalog3, cv_useranalog4;
|
||||
extern consvar_t cv_analog, cv_analog2, cv_analog3, cv_analog4;
|
||||
extern consvar_t cv_turnaxis,cv_moveaxis,cv_brakeaxis,cv_aimaxis,cv_lookaxis,cv_fireaxis,cv_driftaxis,cv_lookbackaxis,cv_custom1axis,cv_custom2axis,cv_custom3axis,cv_xdeadzone,cv_ydeadzone;
|
||||
extern consvar_t cv_turnaxis2,cv_moveaxis2,cv_brakeaxis2,cv_aimaxis2,cv_lookaxis2,cv_fireaxis2,cv_driftaxis2,cv_lookbackaxis2,cv_custom1axis2,cv_custom2axis2,cv_custom3axis2,cv_xdeadzone2,cv_ydeadzone2;
|
||||
extern consvar_t cv_turnaxis3,cv_moveaxis3,cv_brakeaxis3,cv_aimaxis3,cv_lookaxis3,cv_fireaxis3,cv_driftaxis3,cv_lookbackaxis3,cv_custom1axis3,cv_custom2axis3,cv_custom3axis3,cv_xdeadzone3,cv_ydeadzone3;
|
||||
extern consvar_t cv_turnaxis4,cv_moveaxis4,cv_brakeaxis4,cv_aimaxis4,cv_lookaxis4,cv_fireaxis4,cv_driftaxis4,cv_lookbackaxis4,cv_custom1axis4,cv_custom2axis4,cv_custom3axis4,cv_xdeadzone4,cv_ydeadzone4;
|
||||
|
||||
extern consvar_t cv_turnaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_moveaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_brakeaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_aimaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_lookaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_lookbackaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_fireaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_driftaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_custom1axis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_custom2axis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_custom3axis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_xdeadzone[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_ydeadzone[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
|
||||
|
||||
// Hud offsets
|
||||
@@ -166,7 +175,6 @@ extern consvar_t cv_saltysquish;
|
||||
extern consvar_t cv_driftsparkpulse;
|
||||
extern consvar_t cv_gravstretch;
|
||||
extern consvar_t cv_sloperoll;
|
||||
extern consvar_t cv_spriteroll;
|
||||
extern consvar_t cv_sliptideroll;
|
||||
extern consvar_t cv_slamsound;
|
||||
extern consvar_t cv_sloperolldist;
|
||||
@@ -371,14 +379,11 @@ boolean G_DemoTitleResponder(event_t *ev);
|
||||
|
||||
INT32 G_GetGametypeByName(const char *gametypestr);
|
||||
boolean G_IsSpecialStage(INT32 mapnum);
|
||||
boolean G_GametypeUsesLives(void);
|
||||
boolean G_GametypeHasTeams(void);
|
||||
boolean G_GametypeHasSpectators(void);
|
||||
boolean G_BattleGametype(void);
|
||||
UINT8 G_SometimesGetDifferentGametype(UINT8 prefgametype);
|
||||
UINT8 G_GetGametypeColor(INT16 gt);
|
||||
boolean G_RaceGametype(void);
|
||||
boolean G_TagGametype(void);
|
||||
void G_ExitLevel(void);
|
||||
void G_NextLevel(void);
|
||||
void G_Continue(void);
|
||||
|
||||
+5
-27
@@ -908,28 +908,6 @@ static const char *gamecontrolname[num_gamecontrols] =
|
||||
|
||||
#include "k_kart.h"
|
||||
|
||||
INT32 G_GetDeviceForPlayer(INT32 player)
|
||||
{
|
||||
switch (player)
|
||||
{
|
||||
case 0:
|
||||
return cv_usejoystick.value;
|
||||
break;
|
||||
case 1:
|
||||
return cv_usejoystick2.value;
|
||||
break;
|
||||
case 2:
|
||||
return cv_usejoystick3.value;
|
||||
break;
|
||||
case 3:
|
||||
return cv_usejoystick4.value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
inline UINT16 G_GetSkinColor(INT32 player)
|
||||
{
|
||||
// make rgb rainbow vomit when invul or flash blue when grow
|
||||
@@ -972,7 +950,7 @@ void G_SetPlayerGamepadIndicatorColor(INT32 player, UINT16 color)
|
||||
if (cv_gamepadled[player].value == 0)
|
||||
return;
|
||||
|
||||
device = G_GetDeviceForPlayer(player);
|
||||
device = cv_usejoystick[player].value;
|
||||
|
||||
if (device <= 0)
|
||||
{
|
||||
@@ -989,7 +967,7 @@ static void G_ResetPlayerGamepadIndicatorColor(INT32 player)
|
||||
{
|
||||
if (cv_gamepadled[player].value == 0)
|
||||
{
|
||||
INT32 device = G_GetDeviceForPlayer(player);
|
||||
INT32 device = cv_usejoystick[player].value;
|
||||
if (device <= 0)
|
||||
return;
|
||||
|
||||
@@ -1003,7 +981,7 @@ static void G_ResetPlayerDeviceRumble(INT32 player)
|
||||
{
|
||||
INT32 device_id;
|
||||
|
||||
device_id = G_GetDeviceForPlayer(player);
|
||||
device_id = cv_usejoystick[player].value;
|
||||
|
||||
if (device_id < 1)
|
||||
{
|
||||
@@ -1022,7 +1000,7 @@ void G_ResetAllDeviceRumbles(void)
|
||||
|
||||
for (i = 0; i < devices; i++)
|
||||
{
|
||||
INT32 device_id = G_GetDeviceForPlayer(i);
|
||||
INT32 device_id = cv_usejoystick[i].value;
|
||||
|
||||
I_GamepadRumble(device_id, 0, 0, 0);
|
||||
}
|
||||
@@ -1037,7 +1015,7 @@ void G_PlayerDeviceRumble(INT32 player, UINT16 low_strength, UINT16 high_strengt
|
||||
return;
|
||||
}
|
||||
|
||||
device_id = G_GetDeviceForPlayer(player);
|
||||
device_id = cv_usejoystick[player].value;
|
||||
|
||||
if (device_id < 1)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
#include "../qs22j.h"
|
||||
|
||||
|
||||
// The texture for the next polygon given to HWR_ProcessPolygon.
|
||||
// Set with HWR_SetCurrentTexture.
|
||||
GLMipmap_t *current_texture = NULL;
|
||||
@@ -227,7 +226,7 @@ void HWR_RenderBatches(void)
|
||||
|
||||
int currentShader;
|
||||
int nextShader = 0;
|
||||
GLMipmap_t *currentTexture;
|
||||
GLMipmap_t *currentTexture = NULL;
|
||||
GLMipmap_t *nextTexture = NULL;
|
||||
FBITFIELD currentPolyFlags = 0;
|
||||
FBITFIELD nextPolyFlags = 0;
|
||||
|
||||
+64
-61
@@ -73,6 +73,9 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
||||
|
||||
(void)patchheight; // This parameter is unused
|
||||
|
||||
if (!mipmap || mipmap == NULL)
|
||||
return;
|
||||
|
||||
if (originPatch) // originPatch can be NULL here, unlike in the software version
|
||||
originy = originPatch->originy;
|
||||
|
||||
@@ -641,117 +644,117 @@ static void HWR_CacheFlat(GLMipmap_t *glMipmap, lumpnum_t flatlumpnum)
|
||||
// Download a Doom 'flat' to the hardware cache and make it ready for use
|
||||
void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap)
|
||||
{
|
||||
GLMipmap_t *glmip;
|
||||
GLMipmap_t *glMipmap;
|
||||
|
||||
if (flatlumpnum == LUMPERROR)
|
||||
return;
|
||||
|
||||
glmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
||||
glMipmap = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
||||
|
||||
glmip->colormap = colormaps;
|
||||
glMipmap->colormap = colormaps;
|
||||
|
||||
#ifdef GLENCORE
|
||||
if (!noencoremap && encoremap)
|
||||
glmip->colormap += COLORMAP_REMAPOFFSET;
|
||||
glMipmap->colormap += COLORMAP_REMAPOFFSET;
|
||||
#endif
|
||||
|
||||
if (!glmip->downloaded && !glmip->data)
|
||||
HWR_CacheFlat(glmip, flatlumpnum);
|
||||
if (!glMipmap->downloaded && !glMipmap->data)
|
||||
HWR_CacheFlat(glMipmap, flatlumpnum);
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!glmip->downloaded)
|
||||
HWD.pfnSetTexture(glmip);
|
||||
HWR_SetCurrentTexture(glmip);
|
||||
if (!glMipmap->downloaded)
|
||||
HWD.pfnSetTexture(glMipmap);
|
||||
HWR_SetCurrentTexture(glMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(glmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
//
|
||||
// HWR_LoadMappedPatch(): replace the skin color of the sprite in cache
|
||||
// : load it first in doom cache if not already
|
||||
//
|
||||
static void HWR_LoadMappedPatch(GLMipmap_t *glmip, GLPatch_t *gpatch)
|
||||
static void HWR_LoadMappedPatch(GLMipmap_t *glMipmap, GLPatch_t *glPatch)
|
||||
{
|
||||
if (!glmip->downloaded && !glmip->data)
|
||||
if (!glMipmap->downloaded && !glMipmap->data)
|
||||
{
|
||||
patch_t *patch = gpatch->rawpatch;
|
||||
patch_t *patch = glPatch->rawpatch;
|
||||
if (!patch)
|
||||
patch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||
HWR_MakePatch(patch, gpatch, glmip, true);
|
||||
patch = W_CacheLumpNumPwad(glPatch->wadnum, glPatch->lumpnum, PU_STATIC);
|
||||
HWR_MakePatch(patch, glPatch, glMipmap, true);
|
||||
|
||||
// You can't free rawpatch for some reason?
|
||||
// (Obviously I can't, sprite rotation needs that...)
|
||||
|
||||
if (!gpatch->rawpatch)
|
||||
if (!glPatch->rawpatch)
|
||||
Z_Free(patch);
|
||||
}
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!glmip->downloaded)
|
||||
HWD.pfnSetTexture(glmip);
|
||||
HWR_SetCurrentTexture(glmip);
|
||||
if (!glMipmap->downloaded)
|
||||
HWD.pfnSetTexture(glMipmap);
|
||||
HWR_SetCurrentTexture(glMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(glmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// HWR_GetPatch : Download a patch to the hardware cache and make it ready for use
|
||||
// HWR_GetPatch : Downloads a patch to the hardware cache and make it ready for use
|
||||
// -----------------+
|
||||
void HWR_GetPatch(GLPatch_t *gpatch)
|
||||
void HWR_GetPatch(GLPatch_t *glPatch)
|
||||
{
|
||||
// is it in hardware cache
|
||||
if (!gpatch->mipmap->downloaded && !gpatch->mipmap->data)
|
||||
if (!glPatch->mipmap->downloaded && !glPatch->mipmap->data)
|
||||
{
|
||||
// load the software patch, PU_STATIC or the Z_Malloc for hardware patch will
|
||||
// flush the software patch before the conversion! oh yeah I suffered
|
||||
patch_t *ptr = gpatch->rawpatch;
|
||||
patch_t *ptr = glPatch->rawpatch;
|
||||
if (!ptr)
|
||||
ptr = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||
HWR_MakePatch(ptr, gpatch, gpatch->mipmap, true);
|
||||
ptr = W_CacheLumpNumPwad(glPatch->wadnum, glPatch->lumpnum, PU_STATIC);
|
||||
HWR_MakePatch(ptr, glPatch, glPatch->mipmap, true);
|
||||
|
||||
// this is inefficient.. but the hardware patch in heap is purgeable so it should
|
||||
// not fragment memory, and besides the REAL cache here is the hardware memory
|
||||
if (!gpatch->rawpatch)
|
||||
if (!glPatch->rawpatch)
|
||||
Z_Free(ptr);
|
||||
}
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!gpatch->mipmap->downloaded)
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
HWR_SetCurrentTexture(gpatch->mipmap);
|
||||
if (!glPatch->mipmap->downloaded)
|
||||
HWD.pfnSetTexture(glPatch->mipmap);
|
||||
HWR_SetCurrentTexture(glPatch->mipmap);
|
||||
|
||||
// The system-memory patch data can be purged now.
|
||||
Z_ChangeTag(gpatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(glPatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
|
||||
// -------------------+
|
||||
// HWR_GetMappedPatch : Same as HWR_GetPatch for sprite color
|
||||
// -------------------+
|
||||
void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
|
||||
void HWR_GetMappedPatch(GLPatch_t *glPatch, const UINT8 *colormap)
|
||||
{
|
||||
GLMipmap_t *glmip, *newmip;
|
||||
GLMipmap_t *glMipmap, *newMipmap;
|
||||
|
||||
// Blatant hack for encore colormapping aside...
|
||||
if (colormap == colormaps || colormap == NULL || colormap == (const UINT8*)(COLORMAP_REMAPOFFSET))
|
||||
{
|
||||
// Load the default (green) color in doom cache (temporary?) AND hardware cache
|
||||
HWR_GetPatch(gpatch);
|
||||
HWR_GetPatch(glPatch);
|
||||
return;
|
||||
}
|
||||
|
||||
// search for the mimmap
|
||||
// search for the mipmap
|
||||
// skip the first (no colormap translated)
|
||||
for (glmip = gpatch->mipmap; glmip->nextcolormap; )
|
||||
for (glMipmap = glPatch->mipmap; glMipmap->nextcolormap; )
|
||||
{
|
||||
glmip = glmip->nextcolormap;
|
||||
glMipmap = glMipmap->nextcolormap;
|
||||
|
||||
if (glmip->colormap != colormap)
|
||||
if (glMipmap->colormap != colormap)
|
||||
continue;
|
||||
|
||||
HWR_LoadMappedPatch(glmip, gpatch);
|
||||
HWR_LoadMappedPatch(glMipmap, glPatch);
|
||||
return;
|
||||
}
|
||||
// not found, create it!
|
||||
@@ -761,38 +764,38 @@ void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
|
||||
// (it have a liste of mipmap)
|
||||
// this malloc is cleared in HWR_FreeTextureCache
|
||||
// (...) unfortunately z_malloc fragment alot the memory :(so malloc is better
|
||||
newmip = calloc(1, sizeof (*newmip));
|
||||
if (newmip == NULL)
|
||||
newMipmap = calloc(1, sizeof (*newMipmap));
|
||||
if (newMipmap == NULL)
|
||||
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
|
||||
glmip->nextcolormap = newmip;
|
||||
glMipmap->nextcolormap = newMipmap;
|
||||
|
||||
newmip->colormap = colormap;
|
||||
HWR_LoadMappedPatch(newmip, gpatch);
|
||||
newMipmap->colormap = colormap;
|
||||
HWR_LoadMappedPatch(newMipmap, glPatch);
|
||||
}
|
||||
|
||||
void HWR_UnlockCachedPatch(GLPatch_t *gpatch)
|
||||
void HWR_UnlockCachedPatch(GLPatch_t *glPatch)
|
||||
{
|
||||
if (!gpatch)
|
||||
if (!glPatch)
|
||||
return;
|
||||
|
||||
Z_ChangeTag(gpatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(glPatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
GLPatch_t *HWR_GetCachedGLPatchPwad(UINT16 wadnum, UINT16 lumpnum)
|
||||
{
|
||||
aatree_t *hwrcache = wadfiles[wadnum]->hwrcache;
|
||||
GLPatch_t *glpatch;
|
||||
GLPatch_t *glPatch;
|
||||
|
||||
if (!(glpatch = M_AATreeGet(hwrcache, lumpnum)))
|
||||
if (!(glPatch = M_AATreeGet(hwrcache, lumpnum)))
|
||||
{
|
||||
glpatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
|
||||
glpatch->wadnum = wadnum;
|
||||
glpatch->lumpnum = lumpnum;
|
||||
glpatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
|
||||
M_AATreeSet(hwrcache, lumpnum, glpatch);
|
||||
glPatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
|
||||
glPatch->wadnum = wadnum;
|
||||
glPatch->lumpnum = lumpnum;
|
||||
glPatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
|
||||
M_AATreeSet(hwrcache, lumpnum, glPatch);
|
||||
}
|
||||
|
||||
return glpatch;
|
||||
return glPatch;
|
||||
}
|
||||
|
||||
GLPatch_t *HWR_GetCachedGLPatch(lumpnum_t lumpnum)
|
||||
@@ -887,17 +890,17 @@ static void HWR_CacheFadeMask(GLMipmap_t *glMipmap, lumpnum_t fademasklumpnum)
|
||||
|
||||
void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
|
||||
{
|
||||
GLMipmap_t *glmip;
|
||||
GLMipmap_t *glMipmap;
|
||||
|
||||
glmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
|
||||
glMipmap = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
|
||||
|
||||
if (!glmip->downloaded && !glmip->data)
|
||||
HWR_CacheFadeMask(glmip, fademasklumpnum);
|
||||
if (!glMipmap->downloaded && !glMipmap->data)
|
||||
HWR_CacheFadeMask(glMipmap, fademasklumpnum);
|
||||
|
||||
HWD.pfnSetTexture(glmip);
|
||||
HWD.pfnSetTexture(glMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(glmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
// =================================================
|
||||
|
||||
@@ -340,6 +340,7 @@ enum hwdscreentexture
|
||||
HWD_SCREENTEXTURE_WIPE_END, // destination image for the wipe/fade effect
|
||||
HWD_SCREENTEXTURE_GENERIC1, // underwater/heat effect, intermission background
|
||||
HWD_SCREENTEXTURE_GENERIC2, // palette-based colormap fade, final screen texture
|
||||
HWD_SCREENTEXTURE_VHS,
|
||||
NUMSCREENTEXTURES, // (generic3 is unused if palette rendering is disabled)
|
||||
};
|
||||
typedef enum hwdscreentexture hwdscreentexture_t;
|
||||
|
||||
+17
-17
@@ -552,23 +552,23 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum
|
||||
// 0--1
|
||||
void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
{
|
||||
FOutVector v[4];
|
||||
FSurfaceInfo Surf;
|
||||
FOutVector v[4];
|
||||
FSurfaceInfo Surf;
|
||||
FBITFIELD poly_flags = PF_NoTexture|PF_Modulated|PF_NoDepthTest;
|
||||
|
||||
v[0].x = v[3].x = -1.0f;
|
||||
v[2].x = v[1].x = 1.0f;
|
||||
v[0].y = v[1].y = -1.0f;
|
||||
v[2].y = v[3].y = 1.0f;
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
v[0].x = v[3].x = -1.0f;
|
||||
v[2].x = v[1].x = 1.0f;
|
||||
v[0].y = v[1].y = -1.0f;
|
||||
v[2].y = v[3].y = 1.0f;
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = 1.0f;
|
||||
v[0].t = v[1].t = 1.0f;
|
||||
v[2].t = v[3].t = 0.0f;
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = 1.0f;
|
||||
v[0].t = v[1].t = 1.0f;
|
||||
v[2].t = v[3].t = 0.0f;
|
||||
|
||||
if (color & 0xFF00) // Do COLORMAP fade.
|
||||
{
|
||||
if (color & 0xFF00) // Do COLORMAP fade.
|
||||
{
|
||||
if (HWR_ShouldUsePaletteRendering() && cv_glscreentextures.value)
|
||||
{
|
||||
const hwdscreentexture_t scr_tex = HWD_SCREENTEXTURE_GENERIC2;
|
||||
@@ -588,9 +588,9 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
Surf.PolyColor.s.alpha = (strength*8);
|
||||
poly_flags |= PF_Translucent;
|
||||
}
|
||||
}
|
||||
else // Do TRANSMAP** fade.
|
||||
{
|
||||
}
|
||||
else // Do TRANSMAP** fade.
|
||||
{
|
||||
RGBA_t *palette = HWR_GetTexturePalette();
|
||||
Surf.PolyColor.rgba = palette[color&0xFF].rgba;
|
||||
|
||||
@@ -600,7 +600,7 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
Surf.PolyColor.s.alpha = (UINT8)(strength*25.5f);
|
||||
|
||||
poly_flags |= PF_Translucent;
|
||||
}
|
||||
}
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, poly_flags);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ EXPORT void HWRAPI(FlushScreenTextures) (void);
|
||||
EXPORT void HWRAPI(DoScreenWipe) (int wipeStart, int wipeEnd);
|
||||
EXPORT void HWRAPI(DrawScreenTexture) (int tex, FSurfaceInfo *surf, FBITFIELD polyflags);
|
||||
EXPORT void HWRAPI(MakeScreenTexture) (int tex);
|
||||
EXPORT void HWRAPI(DrawScreenFinalTexture) (int tex, INT32 width, INT32 height);
|
||||
EXPORT void HWRAPI(DrawScreenFinalTexture) (int tex, INT32 width, INT32 height, boolean useshader);
|
||||
|
||||
EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
|
||||
|
||||
|
||||
+139
-112
@@ -3225,7 +3225,7 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, GLPatch_t *gpatch)
|
||||
this_scale = FIXED_TO_FLOAT(spr->mobj->scale);
|
||||
if (hires)
|
||||
this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)( (spr->mobj->localskin) ? spr->mobj->localskin : spr->mobj->skin ))->highresscale);
|
||||
|
||||
|
||||
R_GetShadowZ(spr->mobj, &floorslope);
|
||||
|
||||
mobjfloor = HWR_OpaqueFloorAtPos(
|
||||
@@ -3238,13 +3238,13 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, GLPatch_t *gpatch)
|
||||
|
||||
// Set direction
|
||||
if (splitscreen && stplyr == &players[displayplayers[1]])
|
||||
shadowdir = localangle[1] + FixedAngle(cv_cam2_rotate.value);
|
||||
shadowdir = localangle[1] + FixedAngle(cv_cam_rotate[1].value);
|
||||
else if (splitscreen > 1 && stplyr == &players[displayplayers[2]])
|
||||
shadowdir = localangle[2] + FixedAngle(cv_cam3_rotate.value);
|
||||
shadowdir = localangle[2] + FixedAngle(cv_cam_rotate[2].value);
|
||||
else if (splitscreen > 2 && stplyr == &players[displayplayers[3]])
|
||||
shadowdir = localangle[3] + FixedAngle(cv_cam4_rotate.value);
|
||||
shadowdir = localangle[3] + FixedAngle(cv_cam_rotate[3].value);
|
||||
else
|
||||
shadowdir = localangle[0] + FixedAngle(cv_cam_rotate.value);
|
||||
shadowdir = localangle[0] + FixedAngle(cv_cam_rotate[0].value);
|
||||
|
||||
// Find floorheight
|
||||
floorheight = HWR_OpaqueFloorAtPos(
|
||||
@@ -3321,7 +3321,7 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, GLPatch_t *gpatch)
|
||||
swallVerts[0].z = spr->z1 + offset * gl_viewsin;
|
||||
swallVerts[1].z = spr->z2 + offset * gl_viewsin;
|
||||
}
|
||||
|
||||
|
||||
if (floorslope)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
@@ -3381,72 +3381,106 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, GLPatch_t *gpatch)
|
||||
// This is expecting a pointer to an array containing 4 wallVerts for a sprite
|
||||
static void HWR_RotateSpritePolyToAim(gl_vissprite_t *spr, FOutVector *wallVerts, const boolean precip)
|
||||
{
|
||||
if (cv_glspritebillboarding.value && spr && spr->mobj && !(spr->mobj->frame & FF_PAPERSPRITE) && wallVerts)
|
||||
if (!cv_glspritebillboarding.value || !spr || !spr->mobj || !wallVerts)
|
||||
{
|
||||
// uncapped/interpolation
|
||||
interpmobjstate_t interp = {0};
|
||||
float basey, lowy;
|
||||
INT32 dist = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (cv_maxinterpdist.value)
|
||||
dist = R_QuickCamDist(spr->mobj->x, spr->mobj->y);
|
||||
// uncapped/interpolation
|
||||
interpmobjstate_t interp = {0};
|
||||
float basey, lowy;
|
||||
INT32 dist = -1;
|
||||
|
||||
// do interpolation
|
||||
if (R_UsingFrameInterpolation() && !paused && (!cv_maxinterpdist.value || dist < cv_maxinterpdist.value))
|
||||
if (cv_maxinterpdist.value)
|
||||
dist = R_QuickCamDist(spr->mobj->x, spr->mobj->y);
|
||||
|
||||
// do interpolation
|
||||
if (R_UsingFrameInterpolation() && !paused && (!cv_maxinterpdist.value || dist < cv_maxinterpdist.value))
|
||||
{
|
||||
if (precip)
|
||||
{
|
||||
if (precip)
|
||||
{
|
||||
R_InterpolatePrecipMobjState((precipmobj_t *)spr->mobj, rendertimefrac, &interp);
|
||||
}
|
||||
else
|
||||
{
|
||||
R_InterpolateMobjState(spr->mobj, rendertimefrac, &interp);
|
||||
}
|
||||
R_InterpolatePrecipMobjState((precipmobj_t *)spr->mobj, rendertimefrac, &interp);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (precip)
|
||||
{
|
||||
R_InterpolatePrecipMobjState((precipmobj_t *)spr->mobj, FRACUNIT, &interp);
|
||||
}
|
||||
else
|
||||
{
|
||||
R_InterpolateMobjState(spr->mobj, FRACUNIT, &interp);
|
||||
}
|
||||
R_InterpolateMobjState(spr->mobj, rendertimefrac, &interp);
|
||||
}
|
||||
|
||||
if (!precip && P_MobjFlip(spr->mobj) == -1) // precip doesn't have eflags so they can't flip
|
||||
}
|
||||
else
|
||||
{
|
||||
if (precip)
|
||||
{
|
||||
basey = FIXED_TO_FLOAT(interp.z + spr->mobj->height);
|
||||
R_InterpolatePrecipMobjState((precipmobj_t *)spr->mobj, FRACUNIT, &interp);
|
||||
}
|
||||
else
|
||||
{
|
||||
basey = FIXED_TO_FLOAT(interp.z);
|
||||
R_InterpolateMobjState(spr->mobj, FRACUNIT, &interp);
|
||||
}
|
||||
lowy = wallVerts[0].y;
|
||||
}
|
||||
|
||||
// Rotate sprites to fully billboard with the camera
|
||||
// X, Y, AND Z need to be manipulated for the polys to rotate around the
|
||||
// origin, because of how the origin setting works I believe that should
|
||||
// be mobj->z or mobj->z + mobj->height
|
||||
wallVerts[2].y = wallVerts[3].y = (spr->gzt - basey) * gl_viewludsin + basey;
|
||||
wallVerts[0].y = wallVerts[1].y = (lowy - basey) * gl_viewludsin + basey;
|
||||
// translate back to be around 0 before translating back
|
||||
wallVerts[3].x += ((spr->gzt - basey) * gl_viewludcos) * gl_viewcos;
|
||||
wallVerts[2].x += ((spr->gzt - basey) * gl_viewludcos) * gl_viewcos;
|
||||
if (!precip && P_MobjFlip(spr->mobj) == -1) // precip doesn't have eflags so they can't flip
|
||||
{
|
||||
basey = FIXED_TO_FLOAT(interp.z + spr->mobj->height);
|
||||
}
|
||||
else
|
||||
{
|
||||
basey = FIXED_TO_FLOAT(interp.z);
|
||||
}
|
||||
lowy = wallVerts[0].y;
|
||||
|
||||
wallVerts[0].x += ((lowy - basey) * gl_viewludcos) * gl_viewcos;
|
||||
wallVerts[1].x += ((lowy - basey) * gl_viewludcos) * gl_viewcos;
|
||||
// Rotate sprites to fully billboard with the camera
|
||||
// X, Y, AND Z need to be manipulated for the polys to rotate around the
|
||||
// origin, because of how the origin setting works I believe that should
|
||||
// be mobj->z or mobj->z + mobj->height
|
||||
wallVerts[2].y = wallVerts[3].y = (spr->gzt - basey) * gl_viewludsin + basey;
|
||||
wallVerts[0].y = wallVerts[1].y = (lowy - basey) * gl_viewludsin + basey;
|
||||
// translate back to be around 0 before translating back
|
||||
wallVerts[3].x += ((spr->gzt - basey) * gl_viewludcos) * gl_viewcos;
|
||||
wallVerts[2].x += ((spr->gzt - basey) * gl_viewludcos) * gl_viewcos;
|
||||
|
||||
wallVerts[3].z += ((spr->gzt - basey) * gl_viewludcos) * gl_viewsin;
|
||||
wallVerts[2].z += ((spr->gzt - basey) * gl_viewludcos) * gl_viewsin;
|
||||
wallVerts[0].x += ((lowy - basey) * gl_viewludcos) * gl_viewcos;
|
||||
wallVerts[1].x += ((lowy - basey) * gl_viewludcos) * gl_viewcos;
|
||||
|
||||
wallVerts[0].z += ((lowy - basey) * gl_viewludcos) * gl_viewsin;
|
||||
wallVerts[1].z += ((lowy - basey) * gl_viewludcos) * gl_viewsin;
|
||||
wallVerts[3].z += ((spr->gzt - basey) * gl_viewludcos) * gl_viewsin;
|
||||
wallVerts[2].z += ((spr->gzt - basey) * gl_viewludcos) * gl_viewsin;
|
||||
|
||||
wallVerts[0].z += ((lowy - basey) * gl_viewludcos) * gl_viewsin;
|
||||
wallVerts[1].z += ((lowy - basey) * gl_viewludcos) * gl_viewsin;
|
||||
}
|
||||
|
||||
static inline void HWR_ApplyDispoffset(gl_vissprite_t *spr, FOutVector *wallVerts, const boolean papersprite)
|
||||
{
|
||||
// dont push papersprites near the cam unless they have a dispoffset
|
||||
if (papersprite)
|
||||
{
|
||||
// if it has a dispoffset, push it a little towards the camera
|
||||
if (spr->dispoffset)
|
||||
{
|
||||
float co = -gl_viewcos*(0.05f*spr->dispoffset);
|
||||
float si = -gl_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;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
HWR_RotateSpritePolyToAim(spr, wallVerts, false);
|
||||
|
||||
float sprdist = sqrtf((spr->x1 - gl_viewx)*(spr->x1 - gl_viewx) + (spr->z1 - gl_viewy)*(spr->z1 - gl_viewy) + (spr->gzt - gl_viewz)*(spr->gzt - gl_viewz));
|
||||
float distfact = ((2.0f*spr->dispoffset) + 20.0f) / sprdist;
|
||||
|
||||
for (size_t i = 0; i < 4; i++)
|
||||
{
|
||||
wallVerts[i].x += (gl_viewx - wallVerts[i].x)*distfact;
|
||||
wallVerts[i].z += (gl_viewy - wallVerts[i].z)*distfact;
|
||||
wallVerts[i].y += (gl_viewz - wallVerts[i].y)*distfact;
|
||||
}
|
||||
}
|
||||
|
||||
static void HWR_SplitSprite(gl_vissprite_t *spr)
|
||||
static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite)
|
||||
{
|
||||
FOutVector wallVerts[4];
|
||||
FOutVector baseWallVerts[4]; // This is what the verts should end up as
|
||||
@@ -3526,18 +3560,8 @@ static void HWR_SplitSprite(gl_vissprite_t *spr)
|
||||
baseWallVerts[0].t = baseWallVerts[1].t = gpatch->max_t;
|
||||
}
|
||||
|
||||
// Let dispoffset work first since this adjust each vertex
|
||||
HWR_RotateSpritePolyToAim(spr, baseWallVerts, false);
|
||||
|
||||
// push it toward the camera to mitigate floor-clipping sprites
|
||||
float sprdist = sqrtf((spr->x1 - gl_viewx)*(spr->x1 - gl_viewx) + (spr->z1 - gl_viewy)*(spr->z1 - gl_viewy) + (spr->gzt - gl_viewz)*(spr->gzt - gl_viewz));
|
||||
float distfact = ((2.0f*spr->dispoffset) + 20.0f) / sprdist;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
baseWallVerts[i].x += (gl_viewx - baseWallVerts[i].x)*distfact;
|
||||
baseWallVerts[i].z += (gl_viewy - baseWallVerts[i].z)*distfact;
|
||||
baseWallVerts[i].y += (gl_viewz - baseWallVerts[i].y)*distfact;
|
||||
}
|
||||
HWR_ApplyDispoffset(spr, baseWallVerts, papersprite);
|
||||
|
||||
realtop = top = baseWallVerts[3].y;
|
||||
realbot = bot = baseWallVerts[0].y;
|
||||
@@ -3655,7 +3679,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr)
|
||||
wallVerts[1].y = endbot;
|
||||
|
||||
// The x and y only need to be adjusted in the case that it's not a papersprite
|
||||
if (cv_glspritebillboarding.value && spr->mobj && !(spr->mobj->frame & FF_PAPERSPRITE))
|
||||
if (cv_glspritebillboarding.value && spr->mobj && !papersprite)
|
||||
{
|
||||
// Get the x and z of the vertices so billboarding draws correctly
|
||||
realheight = realbot - realtop;
|
||||
@@ -3731,9 +3755,11 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
||||
if (!spr->mobj->subsector)
|
||||
return;
|
||||
|
||||
const boolean papersprite = (spr->mobj->frame & FF_PAPERSPRITE);
|
||||
|
||||
if (spr->mobj->subsector->sector->numlights)
|
||||
{
|
||||
HWR_SplitSprite(spr);
|
||||
HWR_SplitSprite(spr, papersprite);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3799,20 +3825,8 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
||||
HWR_DrawSpriteShadow(spr, gpatch);
|
||||
}
|
||||
|
||||
// Let dispoffset work first since this adjust each vertex
|
||||
// ...nah
|
||||
HWR_RotateSpritePolyToAim(spr, wallVerts, false);
|
||||
|
||||
// push it toward the camera to mitigate floor-clipping sprites
|
||||
float sprdist = sqrtf((spr->x1 - gl_viewx)*(spr->x1 - gl_viewx) + (spr->z1 - gl_viewy)*(spr->z1 - gl_viewy) + (spr->gzt - gl_viewz)*(spr->gzt - gl_viewz));
|
||||
float distfact = ((2.0f*spr->dispoffset) + 20.0f) / sprdist;
|
||||
size_t i;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
wallVerts[i].x += (gl_viewx - wallVerts[i].x)*distfact;
|
||||
wallVerts[i].z += (gl_viewy - wallVerts[i].z)*distfact;
|
||||
wallVerts[i].y += (gl_viewz - wallVerts[i].y)*distfact;
|
||||
}
|
||||
HWR_ApplyDispoffset(spr, wallVerts, papersprite);
|
||||
|
||||
// This needs to be AFTER the shadows so that the regular sprites aren't drawn completely black.
|
||||
// sprite lighting by modulating the RGB components
|
||||
@@ -3894,7 +3908,6 @@ static inline void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
|
||||
wallVerts[0].z = wallVerts[3].z = spr->z1;
|
||||
wallVerts[1].z = wallVerts[2].z = spr->z2;
|
||||
|
||||
// Let dispoffset work first since this adjust each vertex
|
||||
HWR_RotateSpritePolyToAim(spr, wallVerts, true);
|
||||
|
||||
wallVerts[0].s = wallVerts[3].s = 0;
|
||||
@@ -3975,6 +3988,7 @@ static int CompareVisSprites(const void *p1, const void *p2)
|
||||
// make transparent sprites last
|
||||
// "boolean to int"
|
||||
|
||||
// check for precip first, because then sprX->mobj is actually a precipmobj_t and does not have flags2 or tracer
|
||||
int transparency1 = (!spr1->precip && (spr1->mobj->flags2 & MF2_SHADOW)) || (spr1->mobj->frame & FF_TRANSMASK);
|
||||
int transparency2 = (!spr2->precip && (spr2->mobj->flags2 & MF2_SHADOW)) || (spr2->mobj->frame & FF_TRANSMASK);
|
||||
|
||||
@@ -4424,7 +4438,10 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
boolean mirrored;
|
||||
boolean hflip;
|
||||
|
||||
angle_t ang, camang;
|
||||
angle_t ang = 0;
|
||||
#ifdef ROTSPRITE
|
||||
angle_t camang = 0;
|
||||
#endif
|
||||
boolean papersprite;
|
||||
INT32 heightsec, phs;
|
||||
INT32 dist = -1;
|
||||
@@ -4434,7 +4451,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
#ifdef ROTSPRITE
|
||||
patch_t *rotsprite = NULL;
|
||||
INT32 rollangle = 0;
|
||||
angle_t rollsum = 0;
|
||||
angle_t pitchnroll = 0;
|
||||
angle_t sliptiderollangle = 0;
|
||||
#endif
|
||||
|
||||
@@ -4489,7 +4506,13 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
I_Error("HWR_ProjectSprite: invalid sprite number %i ", thing->sprite);
|
||||
#endif
|
||||
|
||||
rot = thing->frame&FF_FRAMEMASK;
|
||||
rot = (thing->frame & FF_FRAMEMASK);
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
// determine here if sprite should rotate for optimization
|
||||
const boolean sliprollrotate = (cv_sloperoll.value && cv_sliptideroll.value && (thing->player && thing->player->sliproll));
|
||||
const boolean shouldrotate = (cv_sloperoll.value && (interp.roll || interp.pitch || interp.sloperoll || interp.slopepitch || thing->rollangle || sliprollrotate));
|
||||
#endif
|
||||
|
||||
//Fab : 02-08-98: 'skin' override spritedef currently used for skin
|
||||
if ((thing->skin || thing->localskin) && thing->sprite == SPR_PLAY)
|
||||
@@ -4517,7 +4540,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
#ifdef ROTSPRITE
|
||||
sprinfo = &spriteinfo[thing->sprite];
|
||||
#endif
|
||||
rot = thing->frame&FF_FRAMEMASK;
|
||||
rot = (thing->frame & FF_FRAMEMASK);
|
||||
thing->state->sprite = thing->sprite;
|
||||
thing->state->frame = thing->frame;
|
||||
}
|
||||
@@ -4529,8 +4552,13 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
I_Error("sprframes NULL for sprite %d\n", thing->sprite);
|
||||
#endif
|
||||
|
||||
ang = R_PointToAngle (interp.x, interp.y) - interp.angle;
|
||||
camang = R_PointToAngle (interp.x, interp.y);
|
||||
ang = R_PointToAngle(interp.x, interp.y);
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
camang = ang;
|
||||
#endif
|
||||
|
||||
ang -= interp.angle;
|
||||
|
||||
if (mirrored)
|
||||
ang = InvAngle(ang);
|
||||
@@ -4572,33 +4600,32 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
spr_topoffset = spritecachedinfo[lumpoff].topoffset;
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
if (cv_spriteroll.value)
|
||||
if (shouldrotate)
|
||||
{
|
||||
rollangle = FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), interp.roll)
|
||||
+ FixedMul(FINESINE((ang) >> ANGLETOFINESHIFT), interp.pitch)
|
||||
+ FixedMul(FINECOSINE((camang) >> ANGLETOFINESHIFT), interp.sloperoll)
|
||||
+ FixedMul(FINESINE((camang) >> ANGLETOFINESHIFT), interp.slopepitch)
|
||||
+ thing->rollangle;
|
||||
|
||||
if ((rollangle)||(thing->player && thing->player->sliproll))
|
||||
if (papersprite)
|
||||
{
|
||||
if (thing->player)
|
||||
// a positive rollangle should should pitch papersprites upwards relative to their facing angle
|
||||
rollangle = InvAngle(thing->rollangle);
|
||||
}
|
||||
else
|
||||
{
|
||||
// this is very messy, but it on-the-fly calculates rotations for all the
|
||||
// pitch and roll variables
|
||||
pitchnroll = R_RotationAngle(ang, camang, &interp);
|
||||
rollangle = thing->rollangle;
|
||||
}
|
||||
|
||||
if (rollangle || pitchnroll || sliprollrotate)
|
||||
{
|
||||
if (sliprollrotate)
|
||||
{
|
||||
sliptiderollangle = cv_sliptideroll.value ? thing->player->sliproll*(thing->player->sliptidemem) : 0;
|
||||
rollsum = rollangle+FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), sliptiderollangle);
|
||||
sliptiderollangle = thing->player->sliproll * (thing->player->sliptidemem);
|
||||
pitchnroll += rollangle + FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), sliptiderollangle);
|
||||
}
|
||||
else
|
||||
rollsum = rollangle;
|
||||
pitchnroll += rollangle;
|
||||
|
||||
// this is kinda dumb lkmao, but try to mitigate shadows being weirdly offset on slopes
|
||||
if (thing->type == MT_SHADOW)
|
||||
{
|
||||
sprinfo->available = true; // < lmao
|
||||
sprinfo->pivot[(thing->frame & FF_FRAMEMASK)].x = spr_offset>>FRACBITS;
|
||||
sprinfo->pivot[(thing->frame & FF_FRAMEMASK)].y = -8; // noones gonna replace shadow sprite anyways, right? that random value ftw, otherwise this clips into the ground Zzz...
|
||||
}
|
||||
|
||||
rollangle = R_GetRollAngle(rollsum);
|
||||
rollangle = R_GetRollAngle(pitchnroll);
|
||||
rotsprite = Patch_GetRotatedSprite(sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, false, sprinfo, rollangle);
|
||||
|
||||
if (rotsprite != NULL)
|
||||
@@ -4705,7 +4732,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
vis->spriteyoffset = FIXED_TO_FLOAT(spr_topoffset);
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
if ((rotsprite) && (cv_spriteroll.value))
|
||||
if (rotsprite != NULL)
|
||||
vis->gpatch = (GLPatch_t *)rotsprite;
|
||||
else
|
||||
#endif
|
||||
@@ -4831,7 +4858,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
return;
|
||||
#endif
|
||||
|
||||
sprframe = &sprdef->spriteframes[ thing->frame & FF_FRAMEMASK];
|
||||
sprframe = &sprdef->spriteframes[thing->frame & FF_FRAMEMASK];
|
||||
|
||||
// use single rotation for all views
|
||||
lumpoff = sprframe->lumpid[0];
|
||||
@@ -5272,12 +5299,12 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
|
||||
drewsky = false;
|
||||
if (skybox)
|
||||
{
|
||||
R_SkyboxFrame(player);
|
||||
R_SkyboxFrame(viewssnum);
|
||||
HWR_RenderFrame(viewnumber, player, true);
|
||||
}
|
||||
PS_STOP_TIMING(ps_skyboxtime);
|
||||
|
||||
R_SetupFrame(player, false); // This can stay false because it is only used to set viewsky in r_main.c, which isn't used here
|
||||
R_SetupFrame(viewssnum, false); // This can stay false because it is only used to set viewsky in r_main.c, which isn't used here
|
||||
framecount++; // for timedemo
|
||||
HWR_RenderFrame(viewnumber, player, false);
|
||||
}
|
||||
@@ -5613,9 +5640,9 @@ void HWR_MakeScreenFinalTexture(void)
|
||||
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2);
|
||||
}
|
||||
|
||||
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height)
|
||||
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height, boolean useshader)
|
||||
{
|
||||
HWD.pfnDrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height);
|
||||
HWD.pfnDrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height, useshader);
|
||||
}
|
||||
|
||||
#endif // HWRENDER
|
||||
@@ -131,7 +131,7 @@ void HWR_DrawIntermissionBG(void);
|
||||
void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum);
|
||||
void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
|
||||
void HWR_MakeScreenFinalTexture(void);
|
||||
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height);
|
||||
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height, boolean useshader);
|
||||
|
||||
// hw_main.c: Segs
|
||||
void HWR_ProcessSeg(void); // Sort of like GLWall::Process in GZDoom
|
||||
|
||||
+30
-31
@@ -680,7 +680,7 @@ spritemd2found:
|
||||
#define SETBRIGHTNESS(brightness,r,g,b) \
|
||||
brightness = (UINT8)(((1063*(UINT32)(r))/5000) + ((3576*(UINT32)(g))/5000) + ((361*(UINT32)(b))/5000))
|
||||
|
||||
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *glmip, INT32 skinnum, skincolors_t color)
|
||||
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *glMipmap, INT32 skinnum, skincolors_t color)
|
||||
{
|
||||
UINT16 w = gpatch->width, h = gpatch->height;
|
||||
UINT32 size = w*h;
|
||||
@@ -696,24 +696,24 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
|
||||
memset(translation, 0, sizeof(translation));
|
||||
memset(cutoff, 0, sizeof(cutoff));
|
||||
|
||||
if (glmip->width == 0)
|
||||
if (glMipmap->width == 0)
|
||||
{
|
||||
glmip->width = gpatch->width;
|
||||
glmip->height = gpatch->height;
|
||||
glMipmap->width = gpatch->width;
|
||||
glMipmap->height = gpatch->height;
|
||||
|
||||
// no wrap around, no chroma key
|
||||
glmip->flags = 0;
|
||||
glMipmap->flags = 0;
|
||||
// setup the texture info
|
||||
glmip->format = GL_TEXFMT_RGBA;
|
||||
glMipmap->format = GL_TEXFMT_RGBA;
|
||||
}
|
||||
|
||||
if (glmip->data)
|
||||
if (glMipmap->data)
|
||||
{
|
||||
Z_Free(glmip->data);
|
||||
glmip->data = NULL;
|
||||
Z_Free(glMipmap->data);
|
||||
glMipmap->data = NULL;
|
||||
}
|
||||
|
||||
cur = Z_Malloc(size*4, PU_HWRCACHE, &glmip->data);
|
||||
cur = Z_Malloc(size*4, PU_HWRCACHE, &glMipmap->data);
|
||||
memset(cur, 0x00, size*4);
|
||||
|
||||
image = gpatch->mipmap->data;
|
||||
@@ -794,10 +794,9 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (translen > 0)
|
||||
colorbrightnesses[translen] = colorbrightnesses[translen-1];
|
||||
}
|
||||
|
||||
while (size--)
|
||||
{
|
||||
@@ -1044,7 +1043,7 @@ skippixel:
|
||||
static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT32 skinnum, const UINT8 *colormap, skincolors_t color)
|
||||
{
|
||||
// mostly copied from HWR_GetMappedPatch, hence the similarities and comment
|
||||
GLMipmap_t *glmip, *newmip;
|
||||
GLMipmap_t *glMipmap, *newMipmap;
|
||||
|
||||
if (colormap == colormaps || colormap == NULL)
|
||||
{
|
||||
@@ -1053,19 +1052,20 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
||||
return;
|
||||
}
|
||||
|
||||
// search for the mimmap
|
||||
// search for the Mipmap
|
||||
// skip the first (no colormap translated)
|
||||
for (glmip = gpatch->mipmap; glmip->nextcolormap; )
|
||||
for (glMipmap = gpatch->mipmap; glMipmap->nextcolormap; )
|
||||
{
|
||||
glmip = glmip->nextcolormap;
|
||||
if (glmip->colormap == colormap)
|
||||
glMipmap = glMipmap->nextcolormap;
|
||||
|
||||
if (glMipmap->colormap != colormap)
|
||||
continue;
|
||||
|
||||
if (glMipmap->downloaded && glMipmap->data)
|
||||
{
|
||||
if (glmip->downloaded && glmip->data)
|
||||
{
|
||||
HWD.pfnSetTexture(glmip); // found the colormap, set it to the correct texture
|
||||
Z_ChangeTag(glmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
return;
|
||||
}
|
||||
HWD.pfnSetTexture(glMipmap); // found the colormap, set it to the correct texture
|
||||
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1076,19 +1076,18 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
||||
// (it have a liste of mipmap)
|
||||
// this malloc is cleared in HWR_FreeTextureCache
|
||||
// (...) unfortunately z_malloc fragment alot the memory :(so malloc is better
|
||||
newmip = calloc(1, sizeof (*newmip));
|
||||
if (newmip == NULL)
|
||||
newMipmap = calloc(1, sizeof (*newMipmap));
|
||||
if (newMipmap == NULL)
|
||||
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
|
||||
glmip->nextcolormap = newmip;
|
||||
newmip->colormap = colormap;
|
||||
glMipmap->nextcolormap = newMipmap;
|
||||
newMipmap->colormap = colormap;
|
||||
|
||||
HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, skinnum, color);
|
||||
HWR_CreateBlendedTexture(gpatch, blendgpatch, newMipmap, skinnum, color);
|
||||
|
||||
HWD.pfnSetTexture(newmip);
|
||||
Z_ChangeTag(newmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
HWD.pfnSetTexture(newMipmap);
|
||||
Z_ChangeTag(newMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// HWR_DrawMD2 : Draw MD2
|
||||
// :
|
||||
|
||||
@@ -140,13 +140,17 @@ void HWR_PortalFrame(gl_portal_t* portal)
|
||||
static void HWR_RenderPortalSeg(gl_portal_t* portal, SINT8 state)
|
||||
{
|
||||
gl_drawing_stencil = true; // do not draw outside of the stencil buffer, idiot.
|
||||
|
||||
// set our portal state and prepare to render the seg
|
||||
HWR_SetPortalState(state);
|
||||
|
||||
gl_curline = portal->seg;
|
||||
gl_frontsector = portal->seg->frontsector;
|
||||
gl_backsector = portal->seg->backsector;
|
||||
|
||||
HWR_ProcessSeg();
|
||||
gl_drawing_stencil = false;
|
||||
|
||||
// need to work around the r_opengl PF_Invisible bug with this call
|
||||
// similarly as in the linkdraw hack in HWR_DrawSprites
|
||||
HWD.pfnSetBlend(PF_Translucent|PF_Occlude|PF_Masked);
|
||||
@@ -171,7 +175,7 @@ void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float
|
||||
HWR_PortalFrame(rootportal);
|
||||
else // current frame is not a portal frame but the main view!
|
||||
{
|
||||
R_SetupFrame(player, false);
|
||||
R_SetupFrame(viewssnum, false);
|
||||
portalclipline = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -1010,6 +1010,7 @@ void SetStates(void)
|
||||
pglScalef(1.0f, 1.0f, -1.0f);
|
||||
pglGetFloatv(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer)
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// DeleteTexture : Deletes a texture from the GPU and frees its data
|
||||
// -----------------+
|
||||
@@ -3109,10 +3110,8 @@ EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2])
|
||||
// a new size
|
||||
EXPORT void HWRAPI(FlushScreenTextures) (void)
|
||||
{
|
||||
int i;
|
||||
pglDeleteTextures(NUMSCREENTEXTURES, screenTextures);
|
||||
for (i = 0; i < NUMSCREENTEXTURES; i++)
|
||||
screenTextures[i] = 0;
|
||||
memset(screenTextures, 0 , sizeof(screenTextures));
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(DrawScreenTexture)(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
|
||||
@@ -3263,6 +3262,7 @@ EXPORT void HWRAPI(DoScreenWipe)(int wipeStart, int wipeEnd)
|
||||
EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
|
||||
{
|
||||
INT32 texsize = 512;
|
||||
int tex = HWD_SCREENTEXTURE_VHS;
|
||||
float xfix, yfix;
|
||||
float fix[8];
|
||||
GLubyte color[4] = {255, 255, 255, 255};
|
||||
@@ -3287,9 +3287,9 @@ EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 upd
|
||||
yfix = 1/((float)(texsize)/((float)((screen_height))));
|
||||
|
||||
// Slight fuzziness
|
||||
MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
MakeScreenTexture(tex);
|
||||
SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
//pglBindTexture(GL_TEXTURE_2D, screentexture);
|
||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
|
||||
|
||||
for (i = 0; i < 1; i += 2.f/vid.height)
|
||||
{
|
||||
@@ -3311,8 +3311,9 @@ EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 upd
|
||||
}
|
||||
|
||||
// Upward bar
|
||||
MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
//pglBindTexture(GL_TEXTURE_2D, screentexture);
|
||||
MakeScreenTexture(tex);
|
||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
|
||||
|
||||
color[0] = color[1] = color[2] = 190;
|
||||
color[3] = 250;
|
||||
pglColor4ubv(color);
|
||||
@@ -3339,8 +3340,8 @@ EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 upd
|
||||
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
// Downward bar
|
||||
MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
//pglBindTexture(GL_TEXTURE_2D, screentexture);
|
||||
MakeScreenTexture(tex);
|
||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
|
||||
|
||||
fix[0] = 0.0f;
|
||||
fix[6] = xfix;
|
||||
@@ -3396,7 +3397,7 @@ EXPORT void HWRAPI(MakeScreenTexture) (int tex)
|
||||
tex_downloaded = screenTextures[tex];
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, INT32 width, INT32 height)
|
||||
EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, INT32 width, INT32 height, boolean useshader)
|
||||
{
|
||||
float xfix, yfix;
|
||||
float origaspect, newaspect;
|
||||
@@ -3463,7 +3464,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, INT32 width, INT32 height)
|
||||
|
||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
if (useshader)
|
||||
pglUseProgram(gl_shaders[SHADER_PALETTE_POSTPROCESS].program); // palette postprocess shader
|
||||
|
||||
pglColor4ubv(white);
|
||||
@@ -3473,7 +3474,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, INT32 width, INT32 height)
|
||||
|
||||
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
if (useshader)
|
||||
pglUseProgram(0);
|
||||
|
||||
tex_downloaded = screenTextures[tex];
|
||||
|
||||
+18
-18
@@ -289,7 +289,7 @@ int
|
||||
HMS_register (void)
|
||||
{
|
||||
struct HMS_buffer *hms;
|
||||
int ok;
|
||||
int okay;
|
||||
|
||||
char post[256];
|
||||
|
||||
@@ -316,23 +316,23 @@ HMS_register (void)
|
||||
|
||||
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDS, post);
|
||||
|
||||
ok = HMS_do(hms);
|
||||
okay = HMS_do(hms);
|
||||
|
||||
if (ok)
|
||||
if (okay)
|
||||
{
|
||||
hms_server_token = strdup(strtok(hms->buffer, "\n"));
|
||||
}
|
||||
|
||||
HMS_end(hms);
|
||||
|
||||
return ok;
|
||||
return okay;
|
||||
}
|
||||
|
||||
int
|
||||
HMS_unlist (void)
|
||||
{
|
||||
struct HMS_buffer *hms;
|
||||
int ok;
|
||||
int okay;
|
||||
|
||||
hms = HMS_connect("servers/%s/unlist", hms_server_token);
|
||||
|
||||
@@ -342,19 +342,19 @@ HMS_unlist (void)
|
||||
curl_easy_setopt(hms->curl, CURLOPT_POST, 1);
|
||||
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDSIZE, 0);
|
||||
|
||||
ok = HMS_do(hms);
|
||||
okay = HMS_do(hms);
|
||||
HMS_end(hms);
|
||||
|
||||
free(hms_server_token);
|
||||
|
||||
return ok;
|
||||
return okay;
|
||||
}
|
||||
|
||||
int
|
||||
HMS_update (void)
|
||||
{
|
||||
struct HMS_buffer *hms;
|
||||
int ok;
|
||||
int okay;
|
||||
|
||||
char post[256];
|
||||
|
||||
@@ -376,10 +376,10 @@ HMS_update (void)
|
||||
|
||||
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDS, post);
|
||||
|
||||
ok = HMS_do(hms);
|
||||
okay = HMS_do(hms);
|
||||
HMS_end(hms);
|
||||
|
||||
return ok;
|
||||
return okay;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -488,7 +488,7 @@ int
|
||||
HMS_compare_mod_version (char *buffer, size_t buffer_size)
|
||||
{
|
||||
struct HMS_buffer *hms;
|
||||
int ok;
|
||||
int okay;
|
||||
|
||||
char *version;
|
||||
char *version_name;
|
||||
@@ -498,7 +498,7 @@ HMS_compare_mod_version (char *buffer, size_t buffer_size)
|
||||
if (! hms)
|
||||
return 0;
|
||||
|
||||
ok = 0;
|
||||
okay = 0;
|
||||
|
||||
if (HMS_do(hms))
|
||||
{
|
||||
@@ -510,16 +510,16 @@ HMS_compare_mod_version (char *buffer, size_t buffer_size)
|
||||
if (atoi(version) != MODVERSION)
|
||||
{
|
||||
strlcpy(buffer, version_name, buffer_size);
|
||||
ok = 1;
|
||||
okay = 1;
|
||||
}
|
||||
else
|
||||
ok = -1;
|
||||
okay = -1;
|
||||
}
|
||||
}
|
||||
|
||||
HMS_end(hms);
|
||||
|
||||
return ok;
|
||||
return okay;
|
||||
}
|
||||
|
||||
const char *
|
||||
@@ -532,9 +532,9 @@ HMS_fetch_rules (char *buffer, size_t buffer_size)
|
||||
if (! hms)
|
||||
return NULL;
|
||||
|
||||
boolean ok = HMS_do(hms);
|
||||
boolean okay = HMS_do(hms);
|
||||
|
||||
if (ok)
|
||||
if (okay)
|
||||
{
|
||||
char *p = strstr(hms->buffer, "\n\n");
|
||||
|
||||
@@ -552,7 +552,7 @@ HMS_fetch_rules (char *buffer, size_t buffer_size)
|
||||
|
||||
HMS_end(hms);
|
||||
|
||||
if (!ok)
|
||||
if (!okay)
|
||||
return NULL;
|
||||
|
||||
return buffer;
|
||||
|
||||
+2
-25
@@ -775,10 +775,7 @@ static void Command_Sayteam_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (G_GametypeHasTeams()) // revert to normal say if we don't have teams in this gametype.
|
||||
DoSayCommand(-1, 1, 0);
|
||||
else
|
||||
DoSayCommand(0, 1, 0);
|
||||
DoSayCommand(0, 1, 0);
|
||||
}
|
||||
|
||||
/** Send a message to everyone, to be displayed by CECHO. Only
|
||||
@@ -1395,7 +1392,7 @@ boolean HU_Responder(event_t *ev)
|
||||
chat_on = true;
|
||||
w_chat_buf[0] = 0;
|
||||
M_TextInputInit(&w_chat, w_chat_buf, sizeof w_chat_buf);
|
||||
teamtalk = G_GametypeHasTeams(); // Don't teamtalk if we don't have teams.
|
||||
teamtalk = false;
|
||||
chat_scrollmedown = true;
|
||||
typelines = 1;
|
||||
return true;
|
||||
@@ -2611,7 +2608,6 @@ static inline void HU_DrawSpectatorTicker(void)
|
||||
//
|
||||
static void HU_DrawRankings(void)
|
||||
{
|
||||
patch_t *p;
|
||||
playersort_t tab[MAXPLAYERS];
|
||||
INT32 i, j, scorelines, hilicol, numplayersingame = 0;
|
||||
boolean completed[MAXPLAYERS];
|
||||
@@ -2643,25 +2639,6 @@ static void HU_DrawRankings(void)
|
||||
Z_Free(maptitle);
|
||||
}
|
||||
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
if (gametype == GT_CTF)
|
||||
p = bflagico;
|
||||
else
|
||||
p = bmatcico;
|
||||
|
||||
V_DrawSmallScaledPatch(128 - SHORT(p->width)/4, 4, 0, p);
|
||||
V_DrawCenteredString(128, 16, 0, va("%u", bluescore));
|
||||
|
||||
if (gametype == GT_CTF)
|
||||
p = rflagico;
|
||||
else
|
||||
p = rmatcico;
|
||||
|
||||
V_DrawSmallScaledPatch(192 - SHORT(p->width)/4, 4, 0, p);
|
||||
V_DrawCenteredString(192, 16, 0, va("%u", redscore));
|
||||
}
|
||||
|
||||
if (!G_RaceGametype())
|
||||
{
|
||||
if (cv_timelimit.value && timelimitintics > 0)
|
||||
|
||||
+1
-1
@@ -53,6 +53,6 @@ typedef struct JoyType_s JoyType_t;
|
||||
for palyer[sic] 1-4's joystick/gamepad
|
||||
*/
|
||||
|
||||
extern JoyType_t Joystick, Joystick2, Joystick3, Joystick4;
|
||||
extern JoyType_t Joystick[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
#endif // __I_JOY_H__
|
||||
@@ -82,18 +82,10 @@ extern holepunch_t *holepunchpacket;
|
||||
*/
|
||||
extern boolean (*I_NetGet)(void);
|
||||
|
||||
/** \brief ask to driver if there is data waiting
|
||||
*/
|
||||
extern boolean (*I_NetCanGet)(void);
|
||||
|
||||
/** \brief send packet within doomcom struct
|
||||
*/
|
||||
extern void (*I_NetSend)(void);
|
||||
|
||||
/** \brief ask to driver if all is ok to send data now
|
||||
*/
|
||||
extern boolean (*I_NetCanSend)(void);
|
||||
|
||||
/** \brief close a connection
|
||||
|
||||
\param nodenum node to be closed
|
||||
|
||||
+7
-15
@@ -202,9 +202,13 @@ void I_JoyScale4(void);
|
||||
|
||||
// Called by D_SRB2Main.
|
||||
|
||||
/** \brief to startup joystick
|
||||
*/
|
||||
void I_InitJoystick(UINT8 index);
|
||||
|
||||
/** \brief to startup the first joystick
|
||||
*/
|
||||
void I_InitJoystick(void);
|
||||
void I_InitJoystick1(void);
|
||||
|
||||
/** \brief to startup the second joystick
|
||||
*/
|
||||
@@ -307,21 +311,9 @@ INT32 I_mkdir(const char *dirname, INT32 unixright);
|
||||
*/
|
||||
const char *I_LocateWad(void);
|
||||
|
||||
/** \brief First Joystick's events
|
||||
/** \brief Joystick events
|
||||
*/
|
||||
void I_GetJoystickEvents(void);
|
||||
|
||||
/** \brief Second Joystick's events
|
||||
*/
|
||||
void I_GetJoystick2Events(void);
|
||||
|
||||
/** \brief Third Joystick's events
|
||||
*/
|
||||
void I_GetJoystick3Events(void);
|
||||
|
||||
/** \brief Fourth Joystick's events
|
||||
*/
|
||||
void I_GetJoystick4Events(void);
|
||||
void I_GetJoystickEvents(UINT8 index);
|
||||
|
||||
/** \brief Mouses events
|
||||
*/
|
||||
|
||||
+6
-75
@@ -168,7 +168,6 @@ static UINT8 UPNP_support = TRUE;
|
||||
#endif
|
||||
|
||||
#include "i_addrinfo.h"
|
||||
#define SELECTTEST
|
||||
|
||||
#define DEFAULTPORT "5029"
|
||||
|
||||
@@ -750,59 +749,6 @@ static boolean SOCK_Get(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
// check if we can send (do not go over the buffer)
|
||||
#ifndef NONET
|
||||
|
||||
static fd_set masterset;
|
||||
|
||||
#ifdef SELECTTEST
|
||||
static boolean FD_CPY(fd_set *src, fd_set *dst, SOCKET_TYPE *fd, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
boolean testset = false;
|
||||
FD_ZERO(dst);
|
||||
for (i = 0; i < len;i++)
|
||||
{
|
||||
if(fd[i] != (SOCKET_TYPE)ERRSOCKET &&
|
||||
FD_ISSET(fd[i], src) && !FD_ISSET(fd[i], dst)) // no checking for dups
|
||||
{
|
||||
FD_SET(fd[i], dst);
|
||||
testset = true;
|
||||
}
|
||||
}
|
||||
return testset;
|
||||
}
|
||||
|
||||
static boolean SOCK_CanSend(void)
|
||||
{
|
||||
struct timeval timeval_for_select = {0, 0};
|
||||
fd_set tset;
|
||||
int wselect;
|
||||
|
||||
if(!FD_CPY(&masterset, &tset, mysockets, mysocketses))
|
||||
return false;
|
||||
wselect = select(255, NULL, &tset, NULL, &timeval_for_select);
|
||||
if (wselect >= 1)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static boolean SOCK_CanGet(void)
|
||||
{
|
||||
struct timeval timeval_for_select = {0, 0};
|
||||
fd_set tset;
|
||||
int rselect;
|
||||
|
||||
if(!FD_CPY(&masterset, &tset, mysockets, mysocketses))
|
||||
return false;
|
||||
rselect = select(255, &tset, NULL, NULL, &timeval_for_select);
|
||||
if (rselect >= 1)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NONET
|
||||
static inline ssize_t SOCK_SendToAddr(SOCKET_TYPE socket, mysockaddr_t *sockaddr)
|
||||
{
|
||||
@@ -877,7 +823,7 @@ static void SOCK_Send(void)
|
||||
}
|
||||
}
|
||||
#undef ALLOWEDERROR
|
||||
#endif
|
||||
#endif //NONET
|
||||
|
||||
#ifndef NONET
|
||||
static void SOCK_FreeNodenum(INT32 numnode)
|
||||
@@ -1029,7 +975,6 @@ static boolean UDP_Socket(void)
|
||||
mysockets[s] = ERRSOCKET;
|
||||
for (s = 0; s < MAXNETNODES+1; s++)
|
||||
nodesocket[s] = ERRSOCKET;
|
||||
FD_ZERO(&masterset);
|
||||
s = 0;
|
||||
|
||||
memset(&hints, 0x00, sizeof (hints));
|
||||
@@ -1056,7 +1001,6 @@ static boolean UDP_Socket(void)
|
||||
mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen);
|
||||
if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET)
|
||||
{
|
||||
FD_SET(mysockets[s], &masterset);
|
||||
myfamily[s] = hints.ai_family;
|
||||
s++;
|
||||
}
|
||||
@@ -1077,7 +1021,6 @@ static boolean UDP_Socket(void)
|
||||
mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen);
|
||||
if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET)
|
||||
{
|
||||
FD_SET(mysockets[s], &masterset);
|
||||
myfamily[s] = hints.ai_family;
|
||||
s++;
|
||||
#ifdef HAVE_MINIUPNPC
|
||||
@@ -1110,7 +1053,6 @@ static boolean UDP_Socket(void)
|
||||
mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen);
|
||||
if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET)
|
||||
{
|
||||
FD_SET(mysockets[s], &masterset);
|
||||
myfamily[s] = hints.ai_family;
|
||||
s++;
|
||||
}
|
||||
@@ -1131,7 +1073,6 @@ static boolean UDP_Socket(void)
|
||||
mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen);
|
||||
if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET)
|
||||
{
|
||||
FD_SET(mysockets[s], &masterset);
|
||||
myfamily[s] = hints.ai_family;
|
||||
s++;
|
||||
}
|
||||
@@ -1298,16 +1239,15 @@ boolean I_InitTcpDriver(void)
|
||||
static void SOCK_CloseSocket(void)
|
||||
{
|
||||
size_t i;
|
||||
for (i=0; i < MAXNETNODES+1; i++)
|
||||
|
||||
for (i = 0; i < mysocketses; i++)
|
||||
{
|
||||
if (mysockets[i] != (SOCKET_TYPE)ERRSOCKET
|
||||
&& FD_ISSET(mysockets[i], &masterset))
|
||||
{
|
||||
FD_CLR(mysockets[i], &masterset);
|
||||
if (mysockets[i] != (SOCKET_TYPE)ERRSOCKET)
|
||||
close(mysockets[i]);
|
||||
}
|
||||
mysockets[i] = ERRSOCKET;
|
||||
}
|
||||
|
||||
mysocketses = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1417,9 +1357,7 @@ static void rendezvous(int size)
|
||||
|
||||
if (tic == refreshtic)
|
||||
{
|
||||
#ifdef HOLEPUNCH
|
||||
holepunchpacket->magic = hole_punch_magic;
|
||||
#endif
|
||||
sendto(mysockets[0], doomcom->data, size, 0, &rzv.any, sizeof rzv.ip4);
|
||||
}
|
||||
|
||||
@@ -1444,7 +1382,6 @@ static void SOCK_RegisterHolePunch(void)
|
||||
rendezvous(4);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
static boolean SOCK_OpenSocket(void)
|
||||
@@ -1464,13 +1401,7 @@ static boolean SOCK_OpenSocket(void)
|
||||
I_NetFreeNodenum = SOCK_FreeNodenum;
|
||||
I_NetMakeNodewPort = SOCK_NetMakeNodewPort;
|
||||
|
||||
#ifdef SELECTTEST
|
||||
// seem like not work with libsocket : (
|
||||
I_NetCanSend = SOCK_CanSend;
|
||||
I_NetCanGet = SOCK_CanGet;
|
||||
#endif
|
||||
#ifdef HOLEPUNCH
|
||||
|
||||
I_NetRequestHolePunch = SOCK_RequestHolePunch;
|
||||
I_NetRegisterHolePunch = SOCK_RegisterHolePunch;
|
||||
#endif
|
||||
|
||||
@@ -139,6 +139,8 @@ UINT32 I_GetRefreshRate(void);
|
||||
|
||||
boolean I_UseNativeKeyboard(void);
|
||||
|
||||
boolean I_CheckNativeRes(void);
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
#if defined (__unix__)
|
||||
extern boolean xwaylandcrap;
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ char sprnames[NUMSPRITES + 1][5] =
|
||||
"CNDL","DOCH","DUCK","GTRE","CHES","CHIM","DRGN","LZMN","PGSS","ZTCH",
|
||||
"MKMA","MKMP","RTCH","BOWL","BOWH","BRRL","BRRR","HRSE","TOAH","BFRT",
|
||||
"OFRT","RFRT","PFRT","ASPK","HBST","HBSO","HBSF","WBLZ","WBLN","OPUL",
|
||||
"TGEM","TCOI","FWRK","XMS4","XMS5","VIEW"
|
||||
"TGEM","TCOI","FWRK","XMS4","XMS5","VIEW",
|
||||
};
|
||||
|
||||
// Doesn't work with g++, needs actionf_p1 (don't modify this comment)
|
||||
|
||||
@@ -159,9 +159,6 @@ enum actionnum
|
||||
A_SPAWNOBJECTRELATIVE,
|
||||
A_CHANGEANGLERELATIVE,
|
||||
A_CHANGEANGLEABSOLUTE,
|
||||
A_ROLLANGLE,
|
||||
A_CHANGEROLLANGLERELATIVE,
|
||||
A_CHANGEROLLANGLEABSOLUTE,
|
||||
A_PLAYSOUND,
|
||||
A_FINDTARGET,
|
||||
A_FINDTRACER,
|
||||
|
||||
+53
-71
@@ -497,10 +497,9 @@ UINT8 colortranslations[MAXTRANSLATIONS][16] = {
|
||||
*/
|
||||
void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor)
|
||||
{
|
||||
INT32 i;
|
||||
INT32 i, j;
|
||||
RGBA_t color;
|
||||
UINT8 brightness;
|
||||
INT32 j;
|
||||
UINT8 colorbrightnesses[16];
|
||||
UINT16 brightdif;
|
||||
INT32 temp;
|
||||
@@ -523,6 +522,7 @@ void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor)
|
||||
color = V_GetColor(i);
|
||||
SETBRIGHTNESS(brightness, color.s.red, color.s.green, color.s.blue);
|
||||
brightdif = 256;
|
||||
|
||||
for (j = 0; j < 16; j++)
|
||||
{
|
||||
temp = abs((INT16)brightness - (INT16)colorbrightnesses[j]);
|
||||
@@ -2060,6 +2060,38 @@ void K_MomentumToFacing(player_t *player)
|
||||
player->mo->momy = FixedMul(player->mo->momy - player->cmomy, player->mo->friction) + player->cmomy;
|
||||
}
|
||||
|
||||
static inline fixed_t K_GetProjectileSpeed(void)
|
||||
{
|
||||
switch (gamespeed)
|
||||
{
|
||||
case 0:
|
||||
return 68*mapobjectscale; // Avg Speed is 34
|
||||
break;
|
||||
case 2:
|
||||
return 96*mapobjectscale; // Avg Speed is 48
|
||||
break;
|
||||
default:
|
||||
return 82*mapobjectscale; // Avg Speed is 41
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static inline fixed_t K_GetSneakerBoostSpeed(void)
|
||||
{
|
||||
switch (gamespeed)
|
||||
{
|
||||
case 0:
|
||||
return 53740+768;
|
||||
break;
|
||||
case 2:
|
||||
return 17294+768;
|
||||
break;
|
||||
default:
|
||||
return 32768;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// sets k_boostpower, k_speedboost, and k_accelboost to whatever we need it to be
|
||||
static void K_GetKartBoostPower(player_t *player)
|
||||
{
|
||||
@@ -2093,18 +2125,7 @@ static void K_GetKartBoostPower(player_t *player)
|
||||
|
||||
if (player->kartstuff[k_sneakertimer]) // Sneaker
|
||||
{
|
||||
switch (gamespeed)
|
||||
{
|
||||
case 0:
|
||||
speedboost = max(speedboost, 53740+768);
|
||||
break;
|
||||
case 2:
|
||||
speedboost = max(speedboost, 17294+768);
|
||||
break;
|
||||
default:
|
||||
speedboost = max(speedboost, 32768);
|
||||
break;
|
||||
}
|
||||
speedboost = max(speedboost, K_GetSneakerBoostSpeed());
|
||||
accelboost = max(accelboost, 8*FRACUNIT); // + 800%
|
||||
}
|
||||
|
||||
@@ -3082,7 +3103,7 @@ static void K_SpawnDriftSparks(player_t *player)
|
||||
//spark->momz = player->mo->momz/2;
|
||||
|
||||
// rotate the sparks based on pitch and roll; it just looks neat
|
||||
if (cv_sparkroll.value == 1)
|
||||
if (cv_sparkroll.value)
|
||||
{
|
||||
spark->slopepitch = player->mo->slopepitch;
|
||||
spark->sloperoll = player->mo->sloperoll;
|
||||
@@ -3296,20 +3317,22 @@ static void K_QuiteSaltyHop(player_t *p)
|
||||
}
|
||||
|
||||
#define SLOPEROLL_DIV 3
|
||||
|
||||
void K_RollMobjBySlopes(mobj_t* mo, boolean usedistance)
|
||||
{
|
||||
if (P_MobjWasRemoved(mo))
|
||||
return;
|
||||
|
||||
I_Assert(mo->subsector != NULL);
|
||||
I_Assert(mo->subsector->sector != NULL);
|
||||
|
||||
angle_t an;
|
||||
const boolean flip = mo->eflags & MFE_VERTICALFLIP;
|
||||
const fixed_t m_dist = usedistance ? R_PointToDist(mo->x, mo->y) : 0;
|
||||
const fixed_t rolldist = cv_sloperolldist.value * mapobjectscale;
|
||||
|
||||
// lifted from hw_md2
|
||||
if (mo->standingslope)
|
||||
{
|
||||
angle_t an;
|
||||
const boolean flip = (mo->eflags & MFE_VERTICALFLIP);
|
||||
const fixed_t m_dist = usedistance ? R_PointToDist(mo->x, mo->y) : 0;
|
||||
const fixed_t rolldist = cv_sloperolldist.value * mapobjectscale;
|
||||
|
||||
fixed_t tempz = mo->standingslope->normal.z;
|
||||
fixed_t tempy = mo->standingslope->normal.y;
|
||||
fixed_t tempx = mo->standingslope->normal.x;
|
||||
@@ -3318,7 +3341,7 @@ void K_RollMobjBySlopes(mobj_t* mo, boolean usedistance)
|
||||
// admittedly this is a very hacky way to do the pitch and roll easing
|
||||
|
||||
// pitch
|
||||
if ((!usedistance) || (m_dist <= (rolldist)))
|
||||
if (!usedistance || (m_dist <= (rolldist)))
|
||||
{
|
||||
an = (INT32)((angle_t)tempangle - mo->pitch_sprite) / SLOPEROLL_DIV;
|
||||
|
||||
@@ -3401,7 +3424,7 @@ void K_SpawnBoostTrail(player_t *player)
|
||||
flame->momx = 8;
|
||||
|
||||
// since you have to be on the ground for sneaker trails, this should be fine(?)
|
||||
if (cv_sparkroll.value == 1)
|
||||
if (cv_sparkroll.value)
|
||||
{
|
||||
flame->slopepitch = player->mo->slopepitch;
|
||||
flame->sloperoll = player->mo->sloperoll;
|
||||
@@ -3593,18 +3616,7 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (gamespeed)
|
||||
{
|
||||
case 0:
|
||||
PROJSPEED = 68*mapobjectscale; // Avg Speed is 34
|
||||
break;
|
||||
case 2:
|
||||
PROJSPEED = 96*mapobjectscale; // Avg Speed is 48
|
||||
break;
|
||||
default:
|
||||
PROJSPEED = 82*mapobjectscale; // Avg Speed is 41
|
||||
break;
|
||||
}
|
||||
PROJSPEED = K_GetProjectileSpeed();
|
||||
}
|
||||
|
||||
if (altthrow)
|
||||
@@ -3832,18 +3844,7 @@ void K_PuntMine(mobj_t *thismine, mobj_t *punter)
|
||||
if (!mine || P_MobjWasRemoved(mine))
|
||||
return;
|
||||
|
||||
switch (gamespeed)
|
||||
{
|
||||
case 0:
|
||||
spd = 68*mapobjectscale; // Avg Speed is 34
|
||||
break;
|
||||
case 2:
|
||||
spd = 96*mapobjectscale; // Avg Speed is 48
|
||||
break;
|
||||
default:
|
||||
spd = 82*mapobjectscale; // Avg Speed is 41
|
||||
break;
|
||||
}
|
||||
spd = K_GetProjectileSpeed();
|
||||
|
||||
mine->flags |= MF_NOCLIPTHING;
|
||||
|
||||
@@ -3990,20 +3991,7 @@ static void K_DoHyudoroSteal(player_t *player)
|
||||
|
||||
void K_DoSneaker(player_t *player, INT32 type)
|
||||
{
|
||||
fixed_t intendedboost;
|
||||
|
||||
switch (gamespeed)
|
||||
{
|
||||
case 0:
|
||||
intendedboost = 53740+768;
|
||||
break;
|
||||
case 2:
|
||||
intendedboost = 17294+768;
|
||||
break;
|
||||
default:
|
||||
intendedboost = 32768;
|
||||
break;
|
||||
}
|
||||
const fixed_t intendedboost = K_GetSneakerBoostSpeed();
|
||||
|
||||
if (!player->kartstuff[k_floorboost] || player->kartstuff[k_floorboost] == 3)
|
||||
{
|
||||
@@ -4784,10 +4772,6 @@ player_t *K_FindJawzTarget(mobj_t *actor, player_t *source)
|
||||
if (player == source)
|
||||
continue;
|
||||
|
||||
// Don't home in on teammates.
|
||||
if (G_GametypeHasTeams() && source->ctfteam == player->ctfteam)
|
||||
continue;
|
||||
|
||||
// Invisible, don't bother
|
||||
if (player->kartstuff[k_hyudorotimer])
|
||||
continue;
|
||||
@@ -6479,7 +6463,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||
|
||||
K_KartDrift(player, onground);
|
||||
|
||||
if ((!player->kartstuff[k_aizdriftstrat])||(!P_IsObjectOnGround(player->mo))||(player->kartstuff[k_drift]))
|
||||
if ((!player->kartstuff[k_aizdriftstrat]) || (!P_IsObjectOnGround(player->mo)) || (player->kartstuff[k_drift]))
|
||||
{
|
||||
if (player->sliproll && (player->sliproll > 0))
|
||||
player->sliproll -= (4*ANG1);
|
||||
@@ -6493,10 +6477,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||
player->mo->spriteyscale = player->mo->realyscale;
|
||||
}
|
||||
|
||||
if (cv_spriteroll.value && cv_sloperoll.value)
|
||||
if (cv_sloperoll.value && !player->mo->salty_jump) // seeing a character rotate mid-hop looks really janky
|
||||
{
|
||||
if ((!player->mo->salty_jump)) // seeing a character rotate mid-hop looks really janky
|
||||
K_RollMobjBySlopes(player->mo, (cv_sloperolldist.value && !splitscreen));
|
||||
K_RollMobjBySlopes(player->mo, (cv_sloperolldist.value && !splitscreen));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -6504,7 +6487,6 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||
player->mo->slopepitch = FixedAngle(0);
|
||||
}
|
||||
|
||||
|
||||
// Quick Turning
|
||||
// You can't turn your kart when you're not moving.
|
||||
// So now it's time to burn some rubber!
|
||||
@@ -8852,7 +8834,7 @@ static void K_drawKartSpeedometer(void)
|
||||
{
|
||||
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
|
||||
V_DrawStretchyFixedPatch((SPDM_X-1)<<FRACBITS, (SPDM_Y + 5)<<FRACBITS, FRACUNIT*0.765, FRACUNIT*0.55, (V_HUDTRANS|splitflags), (skp_smallstickerclr3), colormap);
|
||||
}
|
||||
}
|
||||
else
|
||||
V_DrawStretchyFixedPatch((SPDM_X-1)<<FRACBITS, (SPDM_Y + 5)<<FRACBITS, FRACUNIT*0.765, FRACUNIT*0.55, (V_HUDTRANS|splitflags), (skp_smallsticker3), NULL);
|
||||
|
||||
|
||||
+7
-20
@@ -455,14 +455,7 @@ static int lib_pSpawnAlteredDirectionMissile(lua_State *L)
|
||||
|
||||
static int lib_pColorTeamMissile(lua_State *L)
|
||||
{
|
||||
mobj_t *missile = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
player_t *source = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
||||
NOHUD
|
||||
if (!missile)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (!source)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
P_ColorTeamMissile(missile, source);
|
||||
(void)L;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1246,12 +1239,7 @@ static int lib_pPlayerEmeraldBurst(lua_State *L)
|
||||
|
||||
static int lib_pPlayerFlagBurst(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
boolean toss = lua_optboolean(L, 2);
|
||||
NOHUD
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
P_PlayerFlagBurst(player, toss);
|
||||
(void)L;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1817,7 +1805,7 @@ static int lib_sStartSoundAtVolume(lua_State *L)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
}
|
||||
if (!player || P_IsLocalPlayer(player))
|
||||
S_StartSoundAtVolume(origin, sound_id, volume);
|
||||
S_StartSoundAtVolume(origin, sound_id, volume);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1919,7 +1907,7 @@ static int lib_sChangeMusic(lua_State *L)
|
||||
music_flags = (UINT16)((music_num & 0x7FFF0000) >> 16);
|
||||
else
|
||||
#endif
|
||||
music_flags = (UINT16)luaL_optinteger(L, 4, 0);
|
||||
music_flags = (UINT16)luaL_optinteger(L, 4, 0);
|
||||
|
||||
position = (UINT32)luaL_optinteger(L, 5, 0);
|
||||
prefadems = (UINT32)luaL_optinteger(L, 6, 0);
|
||||
@@ -2446,14 +2434,14 @@ static int lib_gIsSpecialStage(lua_State *L)
|
||||
static int lib_gGametypeUsesLives(lua_State *L)
|
||||
{
|
||||
//HUDSAFE
|
||||
lua_pushboolean(L, G_GametypeUsesLives());
|
||||
lua_pushboolean(L, false);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_gGametypeHasTeams(lua_State *L)
|
||||
{
|
||||
//HUDSAFE
|
||||
lua_pushboolean(L, G_GametypeHasTeams());
|
||||
lua_pushboolean(L, false);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -2481,7 +2469,7 @@ static int lib_gRaceGametype(lua_State *L)
|
||||
static int lib_gTagGametype(lua_State *L)
|
||||
{
|
||||
//HUDSAFE
|
||||
lua_pushboolean(L, G_TagGametype());
|
||||
lua_pushboolean(L, false);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -3154,7 +3142,6 @@ static luaL_Reg lib[] = {
|
||||
{"P_LookForEnemies",lib_pLookForEnemies},
|
||||
{"P_NukeEnemies",lib_pNukeEnemies},
|
||||
{"P_HomingAttack",lib_pHomingAttack},
|
||||
//{"P_SuperReady",lib_pSuperReady},
|
||||
{"P_Telekinesis",lib_pTelekinesis},
|
||||
|
||||
// p_map
|
||||
|
||||
@@ -169,7 +169,7 @@ void COM_Lua_f(void)
|
||||
for (i = 0; i < argc; i++)
|
||||
WRITESTRINGN(p, COM_Argv(i), 255);
|
||||
if (flags & 2)
|
||||
SendNetXCmd2(XD_LUACMD, buf, p-buf);
|
||||
SendNetXCmdForPlayer(1, XD_LUACMD, buf, p-buf);
|
||||
else
|
||||
SendNetXCmd(XD_LUACMD, buf, p-buf);
|
||||
free(buf);
|
||||
|
||||
+1
-1
@@ -503,7 +503,7 @@ static int libd_getSpritePatch(lua_State *L)
|
||||
angle = (angle & 7); // modulus angle by 8
|
||||
|
||||
// rotsprite?????
|
||||
if (lua_isnumber(L, 4) && (cv_spriteroll.value))
|
||||
if (lua_isnumber(L, 4) && cv_sloperoll.value)
|
||||
{
|
||||
angle_t rollangle = luaL_checkangle(L, 4);
|
||||
INT32 rot = R_GetRollAngle(rollangle);
|
||||
|
||||
+1
-4
@@ -945,9 +945,6 @@ boolean OP_FreezeObjectplace(void)
|
||||
if (!objectplacing)
|
||||
return false;
|
||||
|
||||
if ((maptol & TOL_NIGHTS) && (players[consoleplayer].pflags & PF_NIGHTSMODE))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1091,7 +1088,7 @@ void OP_ObjectplaceMovement(player_t *player)
|
||||
{
|
||||
ticcmd_t *cmd = &player->cmd;
|
||||
|
||||
if (!player->climbing && (netgame || !cv_analog.value || (player->pflags & PF_SPINNING)))
|
||||
if (!player->climbing && (netgame || (player->pflags & PF_SPINNING)))
|
||||
player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */);
|
||||
|
||||
ticruned++;
|
||||
|
||||
+193
-267
@@ -1224,19 +1224,19 @@ static menuitem_t OP_AllControlsMenu[] =
|
||||
static menuitem_t OP_Joystick1Menu[] =
|
||||
{
|
||||
{IT_STRING | IT_CALL, NULL, "Select Gamepad..." , M_Setup1PJoystickMenu, 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis , 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis , 25},
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis , 35},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis , 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis , 55},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis , 65},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone , 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis[0] , 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis[0] , 25},
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis[0] , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis[0] , 35},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis[0] , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis[0] , 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis[0] , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis[0] , 55},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis[0] , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis[0] , 65},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis[0] , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone[0] , 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone[0] , 80},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Controller Rumble" , &cv_rumble[0] , 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Set LED to skin color" , &cv_gamepadled[0] , 95},
|
||||
@@ -1246,19 +1246,19 @@ static menuitem_t OP_Joystick1Menu[] =
|
||||
static menuitem_t OP_Joystick2Menu[] =
|
||||
{
|
||||
{IT_STRING | IT_CALL, NULL, "Select Gamepad..." , M_Setup2PJoystickMenu, 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis2 , 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis2 , 25},
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis2 , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis2 , 35},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis2 , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis2 , 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis2 , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis2 , 55},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis2 , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis2 , 65},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis2 , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone2 , 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone2 , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis[1] , 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis[1] , 25},
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis[1] , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis[1] , 35},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis[1] , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis[1] , 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis[1] , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis[1] , 55},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis[1] , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis[1] , 65},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis[1] , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone[1] , 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone[1] , 80},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Controller Rumble" , &cv_rumble[1] , 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Set LED to skin color" , &cv_gamepadled[1] , 95},
|
||||
@@ -1268,19 +1268,19 @@ static menuitem_t OP_Joystick2Menu[] =
|
||||
static menuitem_t OP_Joystick3Menu[] =
|
||||
{
|
||||
{IT_STRING | IT_CALL, NULL, "Select Gamepad..." , M_Setup3PJoystickMenu, 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis3 , 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis3 , 25},
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis3 , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis3 , 35},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis3 , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis3 , 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis3 , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis3 , 55},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis3 , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis3 , 65},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis3 , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone3 , 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone3 , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis[2] , 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis[2] , 25},
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis[2] , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis[2] , 35},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis[2] , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis[2] , 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis[2] , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis[2] , 55},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis[2] , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis[2] , 65},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis[2] , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone[2] , 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone[2] , 80},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Controller Rumble" , &cv_rumble[2] , 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Set LED to skin color" , &cv_gamepadled[2] , 95},
|
||||
@@ -1290,19 +1290,19 @@ static menuitem_t OP_Joystick3Menu[] =
|
||||
static menuitem_t OP_Joystick4Menu[] =
|
||||
{
|
||||
{IT_STRING | IT_CALL, NULL, "Select Gamepad..." , M_Setup4PJoystickMenu, 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis4 , 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis4 , 25},
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis4 , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis4 , 35},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis4 , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis4 , 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis4 , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis4 , 55},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis4 , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis4 , 65},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis4 , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone4 , 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone4 , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis[3] , 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis[3] , 25},
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis[3] , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis[3] , 35},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis[3] , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis[3] , 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis[3] , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis[3] , 55},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis[3] , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis[3] , 65},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis[3] , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone[3] , 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone[3] , 80},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Controller Rumble" , &cv_rumble[3] , 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Set LED to skin color" , &cv_gamepadled[3] , 95},
|
||||
@@ -1872,52 +1872,52 @@ static menuitem_t OP_Player1CamOptionsMenu[] =
|
||||
{
|
||||
{IT_HEADER, NULL, "Player 1 Camera Options", NULL, 0},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Flipcam", &cv_flipcam, 30},
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Distance", &cv_cam_dist, 40},
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Height", &cv_cam_height, 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Speed", &cv_cam_speed, 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Rotation Speed", &cv_cam_rotspeed, 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Flipcam", &cv_flipcam[0], 30},
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Distance", &cv_cam_dist[0], 40},
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Height", &cv_cam_height[0], 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Speed", &cv_cam_speed[0], 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Rotation Speed", &cv_cam_rotspeed[0], 70},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Third Person Camera", &cv_chasecam, 85},
|
||||
{IT_STRING | IT_CVAR, NULL, "Third Person Camera", &cv_chasecam[0], 85},
|
||||
};
|
||||
|
||||
static menuitem_t OP_Player2CamOptionsMenu[] =
|
||||
{
|
||||
{IT_HEADER, NULL, "Player 2 Camera Options", NULL, 0},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Flipcam", &cv_flipcam2, 30},
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Distance", &cv_cam2_dist, 40},
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Height", &cv_cam2_height, 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Speed", &cv_cam2_speed, 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Rotation Speed", &cv_cam2_rotspeed, 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Flipcam", &cv_flipcam[1], 30},
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Distance", &cv_cam_dist[1], 40},
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Height", &cv_cam_height[1], 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Speed", &cv_cam_speed[1], 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Rotation Speed", &cv_cam_rotspeed[1], 70},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Third Person Camera", &cv_chasecam2, 85},
|
||||
{IT_STRING | IT_CVAR, NULL, "Third Person Camera", &cv_chasecam[1], 85},
|
||||
};
|
||||
|
||||
static menuitem_t OP_Player3CamOptionsMenu[] =
|
||||
{
|
||||
{IT_HEADER, NULL, "Player 3 Camera Options", NULL, 0},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Flipcam", &cv_flipcam3, 30},
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Distance", &cv_cam3_dist, 40},
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Height", &cv_cam3_height, 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Speed", &cv_cam3_speed, 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Rotation Speed", &cv_cam3_rotspeed, 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Flipcam", &cv_flipcam[2], 30},
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Distance", &cv_cam_dist[2], 40},
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Height", &cv_cam_height[2], 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Speed", &cv_cam_speed[2], 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Rotation Speed", &cv_cam_rotspeed[2], 70},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Third Person Camera", &cv_chasecam3, 85},
|
||||
{IT_STRING | IT_CVAR, NULL, "Third Person Camera", &cv_chasecam[2], 85},
|
||||
};
|
||||
|
||||
static menuitem_t OP_Player4CamOptionsMenu[] =
|
||||
{
|
||||
{IT_HEADER, NULL, "Player 4 Camera Options", NULL, 0},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Flipcam", &cv_flipcam4, 30},
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Distance", &cv_cam4_dist, 40},
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Height", &cv_cam4_height, 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Speed", &cv_cam4_speed, 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Rotation Speed", &cv_cam4_rotspeed, 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Flipcam", &cv_flipcam[3], 30},
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Distance", &cv_cam_dist[3], 40},
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Camera Height", &cv_cam_height[3], 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Speed", &cv_cam_speed[3], 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Rotation Speed", &cv_cam_rotspeed[3], 70},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Third Person Camera", &cv_chasecam4, 85},
|
||||
{IT_STRING | IT_CVAR, NULL, "Third Person Camera", &cv_chasecam[3], 85},
|
||||
};
|
||||
|
||||
static const char* OP_PlayerCamOptionsTooltips[] =
|
||||
@@ -2224,22 +2224,20 @@ static menuitem_t OP_PlayerDistortMenu[] =
|
||||
{
|
||||
{IT_HEADER, NULL, "Sprite Distortion", NULL, 0},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Sprite Rotation", &cv_spriteroll, 15},
|
||||
{IT_STRING | IT_CVAR, NULL, "Sprite Slope Rotation", &cv_sloperoll, 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Slope Rotation Distance", &cv_sloperolldist, 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Rotate Players when Sliptiding", &cv_sliptideroll, 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Rotate Sparks and Boost Trails", &cv_sparkroll, 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Player Stretch Factor", &cv_gravstretch, 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Squish Sound Effect", &cv_slamsound, 105},
|
||||
{IT_STRING | IT_CVAR, NULL, "Saltyhop", &cv_saltyhop, 120},
|
||||
{IT_STRING | IT_CVAR, NULL, "Saltyhop Sound Effect", &cv_saltyhopsfx, 135},
|
||||
{IT_STRING | IT_CVAR, NULL, "Saltyhop Squish", &cv_saltysquish, 150},
|
||||
{IT_STRING | IT_CVAR, NULL, "Sprite Slope Rotation", &cv_sloperoll, 15},
|
||||
{IT_STRING | IT_CVAR, NULL, "Slope Rotation Distance", &cv_sloperolldist, 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Rotate Players when Sliptiding", &cv_sliptideroll, 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Rotate Sparks and Boost Trails", &cv_sparkroll, 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Player Stretch Factor", &cv_gravstretch, 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Squish Sound Effect", &cv_slamsound, 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Saltyhop", &cv_saltyhop, 105},
|
||||
{IT_STRING | IT_CVAR, NULL, "Saltyhop Sound Effect", &cv_saltyhopsfx, 120},
|
||||
{IT_STRING | IT_CVAR, NULL, "Saltyhop Squish", &cv_saltysquish, 135},
|
||||
};
|
||||
|
||||
static const char* OP_PlayerDistortTooltips[] =
|
||||
{
|
||||
NULL,
|
||||
"Sprite rotation features.",
|
||||
"Sprite rotation on slopes. Can either be just players or all objects.",
|
||||
"Distance object rotation should be visable.",
|
||||
"Player rotation when sliptiding.",
|
||||
@@ -2254,7 +2252,6 @@ static const char* OP_PlayerDistortTooltips[] =
|
||||
enum
|
||||
{
|
||||
spriteheader,
|
||||
spriterotate,
|
||||
sloperotate,
|
||||
slrotatedist,
|
||||
sliptide,
|
||||
@@ -3327,34 +3324,19 @@ static void Newgametype_OnChange(void)
|
||||
P_AllocMapHeader((INT16)(cv_nextmap.value-1));
|
||||
|
||||
if ((cv_newgametype.value == GT_RACE && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_RACE)) || // SRB2kart
|
||||
((cv_newgametype.value == GT_MATCH || cv_newgametype.value == GT_TEAMMATCH) && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_MATCH)))
|
||||
(cv_newgametype.value == GT_MATCH && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_MATCH)))
|
||||
{
|
||||
INT32 value = 0;
|
||||
|
||||
switch (cv_newgametype.value)
|
||||
{
|
||||
case GT_COOP:
|
||||
value = TOL_RACE; // SRB2kart
|
||||
break;
|
||||
case GT_COMPETITION:
|
||||
value = TOL_COMPETITION;
|
||||
break;
|
||||
case GT_RACE:
|
||||
value = TOL_RACE;
|
||||
break;
|
||||
case GT_MATCH:
|
||||
case GT_TEAMMATCH:
|
||||
value = TOL_MATCH;
|
||||
break;
|
||||
case GT_TAG:
|
||||
case GT_HIDEANDSEEK:
|
||||
value = TOL_TAG;
|
||||
break;
|
||||
case GT_CTF:
|
||||
value = TOL_CTF;
|
||||
break;
|
||||
}
|
||||
|
||||
CV_SetValue(&cv_nextmap, M_FindFirstMap(value));
|
||||
}
|
||||
}
|
||||
@@ -3397,7 +3379,7 @@ void Addons_option_Onchange(void)
|
||||
|
||||
void PDistort_menu_Onchange(void)
|
||||
{
|
||||
if (!cv_spriteroll.value)
|
||||
if (!cv_sloperoll.value)
|
||||
{
|
||||
OP_PlayerDistortMenu[sloperotate].status = IT_GRAYEDOUT;
|
||||
OP_PlayerDistortMenu[sliptide].status = IT_GRAYEDOUT;
|
||||
@@ -3408,15 +3390,10 @@ void PDistort_menu_Onchange(void)
|
||||
OP_PlayerDistortMenu[sliptide].status = IT_STRING | IT_CVAR;
|
||||
}
|
||||
|
||||
if ((cv_sloperoll.value) && (cv_spriteroll.value)) //enable/disable sloperotate distance
|
||||
if (cv_sloperoll.value) //enable/disable sloperotate distance
|
||||
OP_PlayerDistortMenu[slrotatedist].status = IT_STRING | IT_CVAR;
|
||||
else
|
||||
OP_PlayerDistortMenu[slrotatedist].status = IT_GRAYEDOUT;
|
||||
|
||||
if ((cv_sloperoll.value == 2) && (cv_spriteroll.value)) //enable/disable sparkroll depending on which setting
|
||||
OP_PlayerDistortMenu[sparkrotate].status = IT_STRING | IT_CVAR;
|
||||
else
|
||||
OP_PlayerDistortMenu[sparkrotate].status = IT_GRAYEDOUT;
|
||||
}
|
||||
|
||||
void Bird_menu_Onchange(void)
|
||||
@@ -3748,14 +3725,14 @@ boolean M_Responder(event_t *ev)
|
||||
tic_t thistime = I_GetTime();
|
||||
if (ev->type == ev_joystick)
|
||||
{
|
||||
const INT32 jxdeadzone = ((JOYAXISRANGE-1) * max(cv_xdeadzone.value, FRACUNIT/2)) >> FRACBITS;
|
||||
const INT32 jydeadzone = ((JOYAXISRANGE-1) * max(cv_ydeadzone.value, FRACUNIT/2)) >> FRACBITS;
|
||||
INT32 accelaxis = abs(cv_moveaxis.value);
|
||||
const INT32 jxdeadzone = ((JOYAXISRANGE-1) * max(cv_xdeadzone[0].value, FRACUNIT/2)) >> FRACBITS;
|
||||
const INT32 jydeadzone = ((JOYAXISRANGE-1) * max(cv_ydeadzone[0].value, FRACUNIT/2)) >> FRACBITS;
|
||||
INT32 accelaxis = abs(cv_moveaxis[0].value);
|
||||
if (ev->data1 == 0)
|
||||
{
|
||||
if (ev->data3 != INT32_MAX)
|
||||
{
|
||||
if (Joystick.bGamepadStyle || abs(ev->data3) > jydeadzone)
|
||||
if (Joystick[0].bGamepadStyle || abs(ev->data3) > jydeadzone)
|
||||
{
|
||||
if (joywaity < thistime
|
||||
&& (pjoyy == 0 || (ev->data3 < 0) != (pjoyy < 0))) // no previous direction OR change direction
|
||||
@@ -3771,7 +3748,7 @@ boolean M_Responder(event_t *ev)
|
||||
|
||||
if (ev->data2 != INT32_MAX && joywaitx < thistime)
|
||||
{
|
||||
if (Joystick.bGamepadStyle || abs(ev->data2) > jxdeadzone)
|
||||
if (Joystick[0].bGamepadStyle || abs(ev->data2) > jxdeadzone)
|
||||
{
|
||||
if (joywaitx < thistime
|
||||
&& (pjoyx == 0 || (ev->data2 < 0) != (pjoyx < 0))) // no previous direction OR change direction
|
||||
@@ -3799,10 +3776,10 @@ boolean M_Responder(event_t *ev)
|
||||
retaxis = xmode ? ev->data2 : ev->data3;
|
||||
if (retaxis != INT32_MAX)
|
||||
{
|
||||
if (cv_moveaxis.value < 0)
|
||||
if (cv_moveaxis[0].value < 0)
|
||||
retaxis = -retaxis;
|
||||
|
||||
if (Joystick.bGamepadStyle || retaxis > jacceldeadzone)
|
||||
if (Joystick[0].bGamepadStyle || retaxis > jacceldeadzone)
|
||||
{
|
||||
if (joywaitaccel < thistime && retaxis > pjoyaccel) // only on upwards event
|
||||
{
|
||||
@@ -4480,9 +4457,6 @@ void M_StartControlPanel(void)
|
||||
{
|
||||
MPauseMenu[mpause_switchmap].status = IT_STRING | IT_CALL;
|
||||
MPauseMenu[mpause_addons].status = IT_STRING | IT_CALL;
|
||||
|
||||
if (G_GametypeHasTeams())
|
||||
MPauseMenu[mpause_scramble].status = IT_STRING | IT_SUBMENU;
|
||||
}
|
||||
|
||||
if (server || (!cv_showlocalskinmenus.value))
|
||||
@@ -4503,16 +4477,7 @@ void M_StartControlPanel(void)
|
||||
|
||||
if (netgame)
|
||||
{
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
MPauseMenu[mpause_switchteam].status = IT_STRING | IT_SUBMENU;
|
||||
MPauseMenu[mpause_switchteam].alphaKey += ((splitscreen+1) * 8);
|
||||
MPauseMenu[mpause_localskin].alphaKey += 8;
|
||||
MPauseMenu[mpause_options].alphaKey += 8;
|
||||
MPauseMenu[mpause_title].alphaKey += 8;
|
||||
MPauseMenu[mpause_quit].alphaKey += 8;
|
||||
}
|
||||
else if (G_GametypeHasSpectators())
|
||||
if (G_GametypeHasSpectators())
|
||||
{
|
||||
MPauseMenu[mpause_switchspectate].status = IT_STRING | IT_SUBMENU;
|
||||
MPauseMenu[mpause_switchspectate].alphaKey += ((splitscreen+1) * 8);
|
||||
@@ -4546,9 +4511,7 @@ void M_StartControlPanel(void)
|
||||
{
|
||||
MPauseMenu[mpause_psetup].status = IT_STRING | IT_CALL;
|
||||
|
||||
if (G_GametypeHasTeams())
|
||||
MPauseMenu[mpause_switchteam].status = IT_STRING | IT_SUBMENU;
|
||||
else if (G_GametypeHasSpectators())
|
||||
if (G_GametypeHasSpectators())
|
||||
{
|
||||
if (!players[consoleplayer].spectator)
|
||||
MPauseMenu[mpause_spectate].status = IT_STRING | IT_CALL;
|
||||
@@ -5691,7 +5654,7 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt)
|
||||
if (M_MapLocked(mapnum+1)) // not unlocked
|
||||
return cv_showallmaps.value;
|
||||
|
||||
if ((gt == GT_MATCH || gt == GT_TEAMMATCH) && (mapheaderinfo[mapnum]->typeoflevel & TOL_MATCH))
|
||||
if (gt == GT_MATCH && (mapheaderinfo[mapnum]->typeoflevel & TOL_MATCH))
|
||||
return true;
|
||||
|
||||
if (gt == GT_RACE && (mapheaderinfo[mapnum]->typeoflevel & TOL_RACE))
|
||||
@@ -6371,16 +6334,14 @@ static void M_DrawAddons(void)
|
||||
y = BASEVIDHEIGHT - currentMenu->y + 1;
|
||||
|
||||
M_DrawTextBox(x - (21 + 5), y, MAXSTRINGLENGTH, 1);
|
||||
if (menusearch[0])
|
||||
V_DrawString(x - 18, y + 8, V_ALLOWLOWERCASE, menusearch+1);
|
||||
|
||||
if (menusearch.length)
|
||||
M_DrawTextInput(x - 18, y + 8, &menusearch, 0);
|
||||
else
|
||||
V_DrawString(x - 18, y + 8, V_ALLOWLOWERCASE|V_TRANSLUCENT, "Type to search...");
|
||||
if (skullAnimCounter < 4)
|
||||
V_DrawCharacter(x - 18 + V_StringWidth(menusearch+1, 0), y + 8,
|
||||
'_' | 0x80, false);
|
||||
|
||||
x -= (21 + 5 + 16);
|
||||
V_DrawSmallScaledPatch(x, y + 4, (menusearch[0] ? 0 : V_TRANSLUCENT), addonsp[NUM_EXT+3]);
|
||||
V_DrawSmallScaledPatch(x, y + 4, (menusearch.length ? 0 : V_TRANSLUCENT), addonsp[NUM_EXT+3]);
|
||||
|
||||
x = BASEVIDWIDTH - x - 16;
|
||||
V_DrawSmallScaledPatch(x, y + 4, ((!majormods) ? 0 : V_TRANSLUCENT), addonsp[NUM_EXT+4]);
|
||||
@@ -6456,43 +6417,6 @@ static void M_AddonAutoLoad(INT32 ch)
|
||||
fclose(autoloadconfigfile);
|
||||
}
|
||||
|
||||
#define len menusearch[0]
|
||||
static boolean M_ChangeStringAddons(INT32 choice)
|
||||
{
|
||||
choice = M_ShiftChar(choice);
|
||||
|
||||
switch (choice)
|
||||
{
|
||||
case KEY_DEL:
|
||||
if (len)
|
||||
{
|
||||
len = menusearch[1] = 0;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case KEY_BACKSPACE:
|
||||
if (len)
|
||||
{
|
||||
menusearch[1+--len] = 0;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (choice >= 32 && choice <= 127)
|
||||
{
|
||||
if (len < MAXSTRINGLENGTH - 1)
|
||||
{
|
||||
menusearch[1+len++] = (char)choice;
|
||||
menusearch[1+len] = 0;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#undef len
|
||||
|
||||
// i hate myself
|
||||
static boolean DumbStartsWith(const char *pre, const char *str)
|
||||
{
|
||||
@@ -6505,8 +6429,10 @@ static void M_HandleAddons(INT32 choice)
|
||||
{
|
||||
boolean exitmenu = false; // exit to previous menu
|
||||
|
||||
if (M_ChangeStringAddons(choice))
|
||||
if (M_TextInputHandle(&menusearch, choice))
|
||||
{
|
||||
S_StartSound(NULL,sfx_menu1);
|
||||
|
||||
char *tempname = NULL;
|
||||
if (dirmenu && dirmenu[dir_on[menudepthleft]])
|
||||
tempname = Z_StrDup(dirmenu[dir_on[menudepthleft]]+DIR_STRING); // don't need to I_Error if can't make - not important, just QoL
|
||||
@@ -11881,30 +11807,30 @@ static void M_DrawJoystick(void)
|
||||
//M_DrawSaveLoadBorder(OP_JoystickSetDef.x, OP_JoystickSetDef.y+LINEHEIGHT*i);
|
||||
|
||||
#ifdef JOYSTICK_HOTPLUG
|
||||
if (atoi(cv_usejoystick4.string) > I_NumJoys())
|
||||
compareval4 = atoi(cv_usejoystick4.string);
|
||||
if (atoi(cv_usejoystick[3].string) > I_NumJoys())
|
||||
compareval4 = atoi(cv_usejoystick[3].string);
|
||||
else
|
||||
compareval4 = cv_usejoystick4.value;
|
||||
compareval4 = cv_usejoystick[3].value;
|
||||
|
||||
if (atoi(cv_usejoystick3.string) > I_NumJoys())
|
||||
compareval3 = atoi(cv_usejoystick3.string);
|
||||
if (atoi(cv_usejoystick[2].string) > I_NumJoys())
|
||||
compareval3 = atoi(cv_usejoystick[2].string);
|
||||
else
|
||||
compareval3 = cv_usejoystick3.value;
|
||||
compareval3 = cv_usejoystick[2].value;
|
||||
|
||||
if (atoi(cv_usejoystick2.string) > I_NumJoys())
|
||||
compareval2 = atoi(cv_usejoystick2.string);
|
||||
if (atoi(cv_usejoystick[1].string) > I_NumJoys())
|
||||
compareval2 = atoi(cv_usejoystick[1].string);
|
||||
else
|
||||
compareval2 = cv_usejoystick2.value;
|
||||
compareval2 = cv_usejoystick[1].value;
|
||||
|
||||
if (atoi(cv_usejoystick.string) > I_NumJoys())
|
||||
compareval = atoi(cv_usejoystick.string);
|
||||
if (atoi(cv_usejoystick[0].string) > I_NumJoys())
|
||||
compareval = atoi(cv_usejoystick[0].string);
|
||||
else
|
||||
compareval = cv_usejoystick.value;
|
||||
compareval = cv_usejoystick[0].value;
|
||||
#else
|
||||
compareval4 = cv_usejoystick4.value;
|
||||
compareval3 = cv_usejoystick3.value;
|
||||
compareval2 = cv_usejoystick2.value;
|
||||
compareval = cv_usejoystick.value;
|
||||
compareval4 = cv_usejoystick[3].value;
|
||||
compareval3 = cv_usejoystick[2].value;
|
||||
compareval2 = cv_usejoystick[1].value;
|
||||
compareval = cv_usejoystick[0].value;
|
||||
#endif
|
||||
|
||||
if ((setupcontrolplayer == 4 && (i == compareval4))
|
||||
@@ -11942,14 +11868,14 @@ void M_SetupJoystickMenu(INT32 choice)
|
||||
//
|
||||
// Update cv_usejoystick.string here so that the user can
|
||||
// properly change this value.
|
||||
if (i == cv_usejoystick.value)
|
||||
CV_SetValue(&cv_usejoystick, i);
|
||||
if (i == cv_usejoystick2.value)
|
||||
CV_SetValue(&cv_usejoystick2, i);
|
||||
if (i == cv_usejoystick3.value)
|
||||
CV_SetValue(&cv_usejoystick3, i);
|
||||
if (i == cv_usejoystick4.value)
|
||||
CV_SetValue(&cv_usejoystick4, i);
|
||||
if (i == cv_usejoystick[0].value)
|
||||
CV_SetValue(&cv_usejoystick[0], i);
|
||||
if (i == cv_usejoystick[1].value)
|
||||
CV_SetValue(&cv_usejoystick[1], i);
|
||||
if (i == cv_usejoystick[2].value)
|
||||
CV_SetValue(&cv_usejoystick[2], i);
|
||||
if (i == cv_usejoystick[3].value)
|
||||
CV_SetValue(&cv_usejoystick[3], i);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -11992,27 +11918,27 @@ static void M_AssignJoystick(INT32 choice)
|
||||
|
||||
if (setupcontrolplayer == 4)
|
||||
{
|
||||
oldchoice = oldstringchoice = atoi(cv_usejoystick4.string) > numjoys ? atoi(cv_usejoystick4.string) : cv_usejoystick4.value;
|
||||
CV_SetValue(&cv_usejoystick4, choice);
|
||||
oldchoice = oldstringchoice = atoi(cv_usejoystick[3].string) > numjoys ? atoi(cv_usejoystick[3].string) : cv_usejoystick[3].value;
|
||||
CV_SetValue(&cv_usejoystick[3], choice);
|
||||
|
||||
// Just in case last-minute changes were made to cv_usejoystick.value,
|
||||
// update the string too
|
||||
// But don't do this if we're intentionally setting higher than numjoys
|
||||
if (choice <= numjoys)
|
||||
{
|
||||
CV_SetValue(&cv_usejoystick4, cv_usejoystick4.value);
|
||||
CV_SetValue(&cv_usejoystick[3], cv_usejoystick[3].value);
|
||||
|
||||
// reset this so the comparison is valid
|
||||
if (oldchoice > numjoys)
|
||||
oldchoice = cv_usejoystick4.value;
|
||||
oldchoice = cv_usejoystick[3].value;
|
||||
|
||||
if (oldchoice != choice)
|
||||
{
|
||||
if (choice && oldstringchoice > numjoys) // if we did not select "None", we likely selected a used device
|
||||
CV_SetValue(&cv_usejoystick4, (oldstringchoice > numjoys ? oldstringchoice : oldchoice));
|
||||
CV_SetValue(&cv_usejoystick[3], (oldstringchoice > numjoys ? oldstringchoice : oldchoice));
|
||||
|
||||
if (oldstringchoice ==
|
||||
(atoi(cv_usejoystick4.string) > numjoys ? atoi(cv_usejoystick4.string) : cv_usejoystick4.value))
|
||||
(atoi(cv_usejoystick[3].string) > numjoys ? atoi(cv_usejoystick[3].string) : cv_usejoystick[3].value))
|
||||
M_StartMessage("This joystick is used by another\n"
|
||||
"player. Reset the joystick\n"
|
||||
"for that player first.\n\n"
|
||||
@@ -12022,27 +11948,27 @@ static void M_AssignJoystick(INT32 choice)
|
||||
}
|
||||
else if (setupcontrolplayer == 3)
|
||||
{
|
||||
oldchoice = oldstringchoice = atoi(cv_usejoystick3.string) > numjoys ? atoi(cv_usejoystick3.string) : cv_usejoystick3.value;
|
||||
CV_SetValue(&cv_usejoystick3, choice);
|
||||
oldchoice = oldstringchoice = atoi(cv_usejoystick[2].string) > numjoys ? atoi(cv_usejoystick[2].string) : cv_usejoystick[2].value;
|
||||
CV_SetValue(&cv_usejoystick[2], choice);
|
||||
|
||||
// Just in case last-minute changes were made to cv_usejoystick.value,
|
||||
// update the string too
|
||||
// But don't do this if we're intentionally setting higher than numjoys
|
||||
if (choice <= numjoys)
|
||||
{
|
||||
CV_SetValue(&cv_usejoystick3, cv_usejoystick3.value);
|
||||
CV_SetValue(&cv_usejoystick[2], cv_usejoystick[2].value);
|
||||
|
||||
// reset this so the comparison is valid
|
||||
if (oldchoice > numjoys)
|
||||
oldchoice = cv_usejoystick3.value;
|
||||
oldchoice = cv_usejoystick[2].value;
|
||||
|
||||
if (oldchoice != choice)
|
||||
{
|
||||
if (choice && oldstringchoice > numjoys) // if we did not select "None", we likely selected a used device
|
||||
CV_SetValue(&cv_usejoystick3, (oldstringchoice > numjoys ? oldstringchoice : oldchoice));
|
||||
CV_SetValue(&cv_usejoystick[2], (oldstringchoice > numjoys ? oldstringchoice : oldchoice));
|
||||
|
||||
if (oldstringchoice ==
|
||||
(atoi(cv_usejoystick3.string) > numjoys ? atoi(cv_usejoystick3.string) : cv_usejoystick3.value))
|
||||
(atoi(cv_usejoystick[2].string) > numjoys ? atoi(cv_usejoystick[2].string) : cv_usejoystick[2].value))
|
||||
M_StartMessage("This joystick is used by another\n"
|
||||
"player. Reset the joystick\n"
|
||||
"for that player first.\n\n"
|
||||
@@ -12052,27 +11978,27 @@ static void M_AssignJoystick(INT32 choice)
|
||||
}
|
||||
else if (setupcontrolplayer == 2)
|
||||
{
|
||||
oldchoice = oldstringchoice = atoi(cv_usejoystick2.string) > numjoys ? atoi(cv_usejoystick2.string) : cv_usejoystick2.value;
|
||||
CV_SetValue(&cv_usejoystick2, choice);
|
||||
oldchoice = oldstringchoice = atoi(cv_usejoystick[1].string) > numjoys ? atoi(cv_usejoystick[1].string) : cv_usejoystick[1].value;
|
||||
CV_SetValue(&cv_usejoystick[1], choice);
|
||||
|
||||
// Just in case last-minute changes were made to cv_usejoystick.value,
|
||||
// update the string too
|
||||
// But don't do this if we're intentionally setting higher than numjoys
|
||||
if (choice <= numjoys)
|
||||
{
|
||||
CV_SetValue(&cv_usejoystick2, cv_usejoystick2.value);
|
||||
CV_SetValue(&cv_usejoystick[1], cv_usejoystick[1].value);
|
||||
|
||||
// reset this so the comparison is valid
|
||||
if (oldchoice > numjoys)
|
||||
oldchoice = cv_usejoystick2.value;
|
||||
oldchoice = cv_usejoystick[1].value;
|
||||
|
||||
if (oldchoice != choice)
|
||||
{
|
||||
if (choice && oldstringchoice > numjoys) // if we did not select "None", we likely selected a used device
|
||||
CV_SetValue(&cv_usejoystick2, (oldstringchoice > numjoys ? oldstringchoice : oldchoice));
|
||||
CV_SetValue(&cv_usejoystick[1], (oldstringchoice > numjoys ? oldstringchoice : oldchoice));
|
||||
|
||||
if (oldstringchoice ==
|
||||
(atoi(cv_usejoystick2.string) > numjoys ? atoi(cv_usejoystick2.string) : cv_usejoystick2.value))
|
||||
(atoi(cv_usejoystick[1].string) > numjoys ? atoi(cv_usejoystick[1].string) : cv_usejoystick[1].value))
|
||||
M_StartMessage("This joystick is used by another\n"
|
||||
"player. Reset the joystick\n"
|
||||
"for that player first.\n\n"
|
||||
@@ -12082,27 +12008,27 @@ static void M_AssignJoystick(INT32 choice)
|
||||
}
|
||||
else if (setupcontrolplayer == 1)
|
||||
{
|
||||
oldchoice = oldstringchoice = atoi(cv_usejoystick.string) > numjoys ? atoi(cv_usejoystick.string) : cv_usejoystick.value;
|
||||
CV_SetValue(&cv_usejoystick, choice);
|
||||
oldchoice = oldstringchoice = atoi(cv_usejoystick[0].string) > numjoys ? atoi(cv_usejoystick[0].string) : cv_usejoystick[0].value;
|
||||
CV_SetValue(&cv_usejoystick[0], choice);
|
||||
|
||||
// Just in case last-minute changes were made to cv_usejoystick.value,
|
||||
// update the string too
|
||||
// But don't do this if we're intentionally setting higher than numjoys
|
||||
if (choice <= numjoys)
|
||||
{
|
||||
CV_SetValue(&cv_usejoystick, cv_usejoystick.value);
|
||||
CV_SetValue(&cv_usejoystick[0], cv_usejoystick[0].value);
|
||||
|
||||
// reset this so the comparison is valid
|
||||
if (oldchoice > numjoys)
|
||||
oldchoice = cv_usejoystick.value;
|
||||
oldchoice = cv_usejoystick[0].value;
|
||||
|
||||
if (oldchoice != choice)
|
||||
{
|
||||
if (choice && oldstringchoice > numjoys) // if we did not select "None", we likely selected a used device
|
||||
CV_SetValue(&cv_usejoystick, (oldstringchoice > numjoys ? oldstringchoice : oldchoice));
|
||||
CV_SetValue(&cv_usejoystick[0], (oldstringchoice > numjoys ? oldstringchoice : oldchoice));
|
||||
|
||||
if (oldstringchoice ==
|
||||
(atoi(cv_usejoystick.string) > numjoys ? atoi(cv_usejoystick.string) : cv_usejoystick.value))
|
||||
(atoi(cv_usejoystick[0].string) > numjoys ? atoi(cv_usejoystick[0].string) : cv_usejoystick[0].value))
|
||||
M_StartMessage("This joystick is used by another\n"
|
||||
"player. Reset the joystick\n"
|
||||
"for that player first.\n\n"
|
||||
@@ -12112,13 +12038,13 @@ static void M_AssignJoystick(INT32 choice)
|
||||
}
|
||||
#else
|
||||
if (setupcontrolplayer == 4)
|
||||
CV_SetValue(&cv_usejoystick4, choice);
|
||||
CV_SetValue(&cv_usejoystick[3], choice);
|
||||
else if (setupcontrolplayer == 3)
|
||||
CV_SetValue(&cv_usejoystick3, choice);
|
||||
CV_SetValue(&cv_usejoystick[2], choice);
|
||||
else if (setupcontrolplayer == 2)
|
||||
CV_SetValue(&cv_usejoystick2, choice);
|
||||
CV_SetValue(&cv_usejoystick[1], choice);
|
||||
else if (setupcontrolplayer == 1)
|
||||
CV_SetValue(&cv_usejoystick, choice);
|
||||
CV_SetValue(&cv_usejoystick[0], choice);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -12472,49 +12398,49 @@ static void M_ResetControlsResponse(INT32 ch)
|
||||
switch (setupcontrolplayer)
|
||||
{
|
||||
case 4:
|
||||
CV_StealthSet(&cv_usejoystick4, cv_usejoystick4.defaultvalue);
|
||||
CV_StealthSet(&cv_turnaxis4, cv_turnaxis4.defaultvalue);
|
||||
CV_StealthSet(&cv_moveaxis4, cv_moveaxis4.defaultvalue);
|
||||
CV_StealthSet(&cv_brakeaxis4, cv_brakeaxis4.defaultvalue);
|
||||
CV_StealthSet(&cv_aimaxis4, cv_aimaxis4.defaultvalue);
|
||||
CV_StealthSet(&cv_lookaxis4, cv_lookaxis4.defaultvalue);
|
||||
CV_StealthSet(&cv_fireaxis4, cv_fireaxis4.defaultvalue);
|
||||
CV_StealthSet(&cv_driftaxis4, cv_driftaxis4.defaultvalue);
|
||||
CV_StealthSet(&cv_lookbackaxis4, cv_lookbackaxis4.defaultvalue);
|
||||
CV_StealthSet(&cv_usejoystick[3], cv_usejoystick[3].defaultvalue);
|
||||
CV_StealthSet(&cv_turnaxis[3], cv_turnaxis[3].defaultvalue);
|
||||
CV_StealthSet(&cv_moveaxis[3], cv_moveaxis[3].defaultvalue);
|
||||
CV_StealthSet(&cv_brakeaxis[3], cv_brakeaxis[3].defaultvalue);
|
||||
CV_StealthSet(&cv_aimaxis[3], cv_aimaxis[3].defaultvalue);
|
||||
CV_StealthSet(&cv_lookaxis[3], cv_lookaxis[3].defaultvalue);
|
||||
CV_StealthSet(&cv_fireaxis[3], cv_fireaxis[3].defaultvalue);
|
||||
CV_StealthSet(&cv_driftaxis[3], cv_driftaxis[3].defaultvalue);
|
||||
CV_StealthSet(&cv_lookbackaxis[3], cv_lookbackaxis[3].defaultvalue);
|
||||
break;
|
||||
case 3:
|
||||
CV_StealthSet(&cv_usejoystick3, cv_usejoystick3.defaultvalue);
|
||||
CV_StealthSet(&cv_turnaxis3, cv_turnaxis3.defaultvalue);
|
||||
CV_StealthSet(&cv_moveaxis3, cv_moveaxis3.defaultvalue);
|
||||
CV_StealthSet(&cv_brakeaxis3, cv_brakeaxis3.defaultvalue);
|
||||
CV_StealthSet(&cv_aimaxis3, cv_aimaxis3.defaultvalue);
|
||||
CV_StealthSet(&cv_lookaxis3, cv_lookaxis3.defaultvalue);
|
||||
CV_StealthSet(&cv_fireaxis3, cv_fireaxis3.defaultvalue);
|
||||
CV_StealthSet(&cv_driftaxis3, cv_driftaxis3.defaultvalue);
|
||||
CV_StealthSet(&cv_lookbackaxis3, cv_lookbackaxis3.defaultvalue);
|
||||
CV_StealthSet(&cv_usejoystick[2], cv_usejoystick[2].defaultvalue);
|
||||
CV_StealthSet(&cv_turnaxis[2], cv_turnaxis[2].defaultvalue);
|
||||
CV_StealthSet(&cv_moveaxis[2], cv_moveaxis[2].defaultvalue);
|
||||
CV_StealthSet(&cv_brakeaxis[2], cv_brakeaxis[2].defaultvalue);
|
||||
CV_StealthSet(&cv_aimaxis[2], cv_aimaxis[2].defaultvalue);
|
||||
CV_StealthSet(&cv_lookaxis[2], cv_lookaxis[2].defaultvalue);
|
||||
CV_StealthSet(&cv_fireaxis[2], cv_fireaxis[2].defaultvalue);
|
||||
CV_StealthSet(&cv_driftaxis[2], cv_driftaxis[2].defaultvalue);
|
||||
CV_StealthSet(&cv_lookbackaxis[2], cv_lookbackaxis[2].defaultvalue);
|
||||
break;
|
||||
case 2:
|
||||
CV_StealthSet(&cv_usejoystick2, cv_usejoystick2.defaultvalue);
|
||||
CV_StealthSet(&cv_turnaxis2, cv_turnaxis2.defaultvalue);
|
||||
CV_StealthSet(&cv_moveaxis2, cv_moveaxis2.defaultvalue);
|
||||
CV_StealthSet(&cv_brakeaxis2, cv_brakeaxis2.defaultvalue);
|
||||
CV_StealthSet(&cv_aimaxis2, cv_aimaxis2.defaultvalue);
|
||||
CV_StealthSet(&cv_lookaxis2, cv_lookaxis2.defaultvalue);
|
||||
CV_StealthSet(&cv_fireaxis2, cv_fireaxis2.defaultvalue);
|
||||
CV_StealthSet(&cv_driftaxis2, cv_driftaxis2.defaultvalue);
|
||||
CV_StealthSet(&cv_lookbackaxis2, cv_lookbackaxis2.defaultvalue);
|
||||
CV_StealthSet(&cv_usejoystick[1], cv_usejoystick[1].defaultvalue);
|
||||
CV_StealthSet(&cv_turnaxis[1], cv_turnaxis[1].defaultvalue);
|
||||
CV_StealthSet(&cv_moveaxis[1], cv_moveaxis[1].defaultvalue);
|
||||
CV_StealthSet(&cv_brakeaxis[1], cv_brakeaxis[1].defaultvalue);
|
||||
CV_StealthSet(&cv_aimaxis[1], cv_aimaxis[1].defaultvalue);
|
||||
CV_StealthSet(&cv_lookaxis[1], cv_lookaxis[1].defaultvalue);
|
||||
CV_StealthSet(&cv_fireaxis[1], cv_fireaxis[1].defaultvalue);
|
||||
CV_StealthSet(&cv_driftaxis[1], cv_driftaxis[1].defaultvalue);
|
||||
CV_StealthSet(&cv_lookbackaxis[1], cv_lookbackaxis[1].defaultvalue);
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
CV_StealthSet(&cv_usejoystick, cv_usejoystick.defaultvalue);
|
||||
CV_StealthSet(&cv_turnaxis, cv_turnaxis.defaultvalue);
|
||||
CV_StealthSet(&cv_moveaxis, cv_moveaxis.defaultvalue);
|
||||
CV_StealthSet(&cv_brakeaxis, cv_brakeaxis.defaultvalue);
|
||||
CV_StealthSet(&cv_aimaxis, cv_aimaxis.defaultvalue);
|
||||
CV_StealthSet(&cv_lookaxis, cv_lookaxis.defaultvalue);
|
||||
CV_StealthSet(&cv_fireaxis, cv_fireaxis.defaultvalue);
|
||||
CV_StealthSet(&cv_driftaxis, cv_driftaxis.defaultvalue);
|
||||
CV_StealthSet(&cv_lookbackaxis, cv_lookbackaxis.defaultvalue);
|
||||
CV_StealthSet(&cv_usejoystick[0], cv_usejoystick[0].defaultvalue);
|
||||
CV_StealthSet(&cv_turnaxis[0], cv_turnaxis[0].defaultvalue);
|
||||
CV_StealthSet(&cv_moveaxis[0], cv_moveaxis[0].defaultvalue);
|
||||
CV_StealthSet(&cv_brakeaxis[0], cv_brakeaxis[0].defaultvalue);
|
||||
CV_StealthSet(&cv_aimaxis[0], cv_aimaxis[0].defaultvalue);
|
||||
CV_StealthSet(&cv_lookaxis[0], cv_lookaxis[0].defaultvalue);
|
||||
CV_StealthSet(&cv_fireaxis[0], cv_fireaxis[0].defaultvalue);
|
||||
CV_StealthSet(&cv_driftaxis[0], cv_driftaxis[0].defaultvalue);
|
||||
CV_StealthSet(&cv_lookbackaxis[0], cv_lookbackaxis[0].defaultvalue);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1573,6 +1573,84 @@ boolean M_ScreenshotResponder(event_t *ev)
|
||||
return true;
|
||||
}
|
||||
|
||||
void M_MinimapGenerate(void)
|
||||
{
|
||||
#ifdef USE_PNG
|
||||
char *filepath;
|
||||
boolean ret = false;
|
||||
minigen_t *minigen = NULL;
|
||||
size_t option_scale;
|
||||
INT32 mul = 1;
|
||||
|
||||
if (gamestate != GS_LEVEL)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "You must be in a level to generate a preliminary minimap!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (automapactive)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "The automap is active! Please deactivate it and try again.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
option_scale = COM_CheckPartialParm("-m");
|
||||
|
||||
if (option_scale)
|
||||
{
|
||||
if (COM_Argc() < option_scale + 2)/* no argument after? */
|
||||
{
|
||||
CONS_Alert(CONS_ERROR,
|
||||
"No multiplier follows parameter '%s'.\n",
|
||||
COM_Argv(option_scale));
|
||||
return;
|
||||
}
|
||||
|
||||
mul = atoi(COM_Argv(option_scale + 1));
|
||||
|
||||
if (mul < 1 || mul > 10)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR,
|
||||
"Multiplier %d must be within range 1-10.\n",
|
||||
mul);
|
||||
return;
|
||||
}
|
||||
|
||||
filepath = va("%s" PATHSEP "%s-MINIMAP-%d.png", srb2home, G_BuildMapName(gamemap), mul);
|
||||
}
|
||||
else
|
||||
{
|
||||
filepath = va("%s" PATHSEP "%s-MINIMAP.png", srb2home, G_BuildMapName(gamemap));
|
||||
}
|
||||
|
||||
minigen = AM_MinimapGenerate(mul);
|
||||
|
||||
if (minigen == NULL || minigen->buf == NULL)
|
||||
goto failure;
|
||||
|
||||
M_CreateScreenShotPalette();
|
||||
ret = M_SavePNG(filepath, minigen->buf, minigen->w, minigen->h, screenshot_palette);
|
||||
|
||||
failure:
|
||||
if (minigen->buf != NULL)
|
||||
free(minigen->buf);
|
||||
|
||||
if (ret)
|
||||
{
|
||||
CONS_Printf(M_GetText("%s saved.\nRemember that this is not a complete minimap,\nand must be edited before putting in-game.\n"), filepath);
|
||||
if (mul != 1)
|
||||
{
|
||||
CONS_Printf("You should divide its size by %d!\n", mul);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Couldn't create %s\n"), filepath);
|
||||
}
|
||||
#endif //#ifdef USE_PNG
|
||||
}
|
||||
|
||||
|
||||
// ==========================================================================
|
||||
// TRANSLATION FUNCTIONS
|
||||
// ==========================================================================
|
||||
|
||||
@@ -69,6 +69,8 @@ void M_ScreenShot(void);
|
||||
void M_DoScreenShot(void);
|
||||
boolean M_ScreenshotResponder(event_t *ev);
|
||||
|
||||
void M_MinimapGenerate(void);
|
||||
|
||||
void Command_SaveConfig_f(void);
|
||||
void Command_LoadConfig_f(void);
|
||||
void Command_ChangeConfig_f(void);
|
||||
|
||||
@@ -140,6 +140,8 @@ void M_TextInputClear(textinput_t *input)
|
||||
input->cursor = 0;
|
||||
input->select = 0;
|
||||
input->length = 0;
|
||||
|
||||
input->buffer[0] = 0;
|
||||
}
|
||||
|
||||
void M_TextInputSetString(textinput_t *input, const char *c)
|
||||
|
||||
+16
-118
@@ -165,9 +165,6 @@ void A_SpawnObjectAbsolute(mobj_t *actor);
|
||||
void A_SpawnObjectRelative(mobj_t *actor);
|
||||
void A_ChangeAngleRelative(mobj_t *actor);
|
||||
void A_ChangeAngleAbsolute(mobj_t *actor);
|
||||
void A_RollAngle(mobj_t *actor);
|
||||
void A_ChangeRollAngleRelative(mobj_t *actor);
|
||||
void A_ChangeRollAngleAbsolute(mobj_t *actor);
|
||||
void A_PlaySound(mobj_t *actor);
|
||||
void A_FindTarget(mobj_t *actor);
|
||||
void A_FindTracer(mobj_t *actor);
|
||||
@@ -459,10 +456,7 @@ boolean P_Move(mobj_t *actor, fixed_t speed)
|
||||
I_Assert(movedir < NUMDIRS);
|
||||
|
||||
tryx = actor->x + FixedMul(speed*xspeed[movedir], actor->scale);
|
||||
if (twodlevel || actor->flags2 & MF2_TWOD)
|
||||
tryy = actor->y;
|
||||
else
|
||||
tryy = actor->y + FixedMul(speed*yspeed[movedir], actor->scale);
|
||||
tryy = actor->y + FixedMul(speed*yspeed[movedir], actor->scale);
|
||||
|
||||
if (actor->type == MT_SKIM && !P_WaterInSector(actor, tryx, tryy)) // bail out if sector lacks water
|
||||
return false;
|
||||
@@ -536,8 +530,6 @@ void P_NewChaseDir(mobj_t *actor)
|
||||
else
|
||||
d[1] = DI_NODIR;
|
||||
|
||||
if (twodlevel || actor->flags2 & MF2_TWOD)
|
||||
d[2] = DI_NODIR;
|
||||
if (deltay < -FixedMul(10*FRACUNIT, actor->scale))
|
||||
d[2] = DI_SOUTH;
|
||||
else if (deltay > FixedMul(10*FRACUNIT, actor->scale))
|
||||
@@ -2955,9 +2947,7 @@ void A_Invincibility(mobj_t *actor)
|
||||
if (P_IsLocalPlayer(player) && !player->powers[pw_super])
|
||||
{
|
||||
S_StopMusic();
|
||||
if (mariomode)
|
||||
G_GhostAddColor((INT32) (player - players), GHC_INVINCIBLE);
|
||||
S_ChangeMusicInternal((mariomode) ? "minvnc" : "invinc", false);
|
||||
S_ChangeMusicInternal("invinc", false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3055,11 +3045,7 @@ void A_ExtraLife(mobj_t *actor)
|
||||
return;
|
||||
}
|
||||
|
||||
// In shooter gametypes, give the player 100 rings instead of an extra life.
|
||||
if (gametype != GT_COOP && gametype != GT_COMPETITION)
|
||||
P_GivePlayerRings(player, 100);
|
||||
else
|
||||
P_GivePlayerLives(player, 1);
|
||||
P_GivePlayerRings(player, 100);
|
||||
P_PlayLivesJingle(player);
|
||||
}
|
||||
|
||||
@@ -3741,11 +3727,6 @@ void A_ThrownRing(mobj_t *actor)
|
||||
if (player->mo == actor->target)
|
||||
continue;
|
||||
|
||||
// Don't home in on teammates.
|
||||
if (gametype == GT_CTF
|
||||
&& actor->target->player->ctfteam == player->ctfteam)
|
||||
continue;
|
||||
|
||||
if (actor->target->player->kartstuff[k_position] < player->kartstuff[k_position]) // SRB2kart - Jawz only go after people ahead of you
|
||||
continue;
|
||||
|
||||
@@ -3806,11 +3787,6 @@ static inline boolean PIT_GrenadeRing(mobj_t *thing)
|
||||
|| (G_BattleGametype() && thing->player && thing->player->kartstuff[k_bumper] <= 0 && thing->player->kartstuff[k_comebacktimer])))
|
||||
return true;
|
||||
|
||||
if ((gametype == GT_CTF || gametype == GT_TEAMMATCH)
|
||||
&& !cv_friendlyfire.value && grenade->target->player && thing->player
|
||||
&& grenade->target->player->ctfteam == thing->player->ctfteam) // Don't blow up at your teammates, unless friendlyfire is on
|
||||
return true;
|
||||
|
||||
// see if it went over / under
|
||||
if (grenade->z - explodedist > thing->z + thing->height)
|
||||
return true; // overhead
|
||||
@@ -4512,12 +4488,7 @@ void A_MouseThink(mobj_t *actor)
|
||||
|| (actor->eflags & MFE_VERTICALFLIP && actor->z + actor->height == actor->ceilingz))
|
||||
&& !actor->reactiontime)
|
||||
{
|
||||
if (twodlevel || actor->flags2 & MF2_TWOD)
|
||||
{
|
||||
if (P_RandomChance(FRACUNIT/2))
|
||||
actor->angle += ANGLE_180;
|
||||
}
|
||||
else if (P_RandomChance(FRACUNIT/2))
|
||||
if (P_RandomChance(FRACUNIT/2))
|
||||
actor->angle += ANGLE_90;
|
||||
else
|
||||
actor->angle -= ANGLE_90;
|
||||
@@ -5324,7 +5295,8 @@ void A_RingExplode(mobj_t *actor)
|
||||
// var1 = object # to explode as debris
|
||||
// var2 = unused
|
||||
//
|
||||
void A_OldRingExplode(mobj_t *actor) {
|
||||
void A_OldRingExplode(mobj_t *actor)
|
||||
{
|
||||
UINT8 i;
|
||||
mobj_t *mo;
|
||||
const fixed_t ns = FixedMul(20 * FRACUNIT, actor->scale);
|
||||
@@ -5358,10 +5330,10 @@ void A_OldRingExplode(mobj_t *actor) {
|
||||
|
||||
if (changecolor)
|
||||
{
|
||||
if (gametype != GT_CTF)
|
||||
mo->color = actor->target->color; //copy color
|
||||
else if (actor->target->player->ctfteam == 2)
|
||||
if (actor->target->player->ctfteam == 2)
|
||||
mo->color = skincolor_bluering;
|
||||
else
|
||||
mo->color = actor->target->color; //copy color
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5374,10 +5346,10 @@ void A_OldRingExplode(mobj_t *actor) {
|
||||
|
||||
if (changecolor)
|
||||
{
|
||||
if (gametype != GT_CTF)
|
||||
mo->color = actor->target->color; //copy color
|
||||
else if (actor->target->player->ctfteam == 2)
|
||||
if (actor->target->player->ctfteam == 2)
|
||||
mo->color = skincolor_bluering;
|
||||
else
|
||||
mo->color = actor->target->color; //copy color
|
||||
}
|
||||
|
||||
mo = P_SpawnMobj(actor->x, actor->y, actor->z, locvar1);
|
||||
@@ -5389,10 +5361,10 @@ void A_OldRingExplode(mobj_t *actor) {
|
||||
|
||||
if (changecolor)
|
||||
{
|
||||
if (gametype != GT_CTF)
|
||||
mo->color = actor->target->color; //copy color
|
||||
else if (actor->target->player->ctfteam == 2)
|
||||
if (actor->target->player->ctfteam == 2)
|
||||
mo->color = skincolor_bluering;
|
||||
else
|
||||
mo->color = actor->target->color; //copy color
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5416,7 +5388,7 @@ void A_MixUp(mobj_t *actor)
|
||||
|
||||
// No mix-up monitors in hide and seek or time only race.
|
||||
// The random factor is okay for other game modes, but in these, it is cripplingly unfair.
|
||||
if (gametype == GT_HIDEANDSEEK || gametype == GT_RACE)
|
||||
if (gametype == GT_RACE)
|
||||
return;
|
||||
|
||||
numplayers = 0;
|
||||
@@ -7183,80 +7155,6 @@ void A_ChangeAngleAbsolute(mobj_t *actor)
|
||||
actor->angle = FixedAngle(P_RandomRange(amin, amax));
|
||||
}
|
||||
|
||||
// Function: A_RollAngle
|
||||
//
|
||||
// Description: Changes the roll angle.
|
||||
//
|
||||
// var1 = angle
|
||||
// var2 = relative? (default)
|
||||
//
|
||||
void A_RollAngle(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
const angle_t angle = FixedAngle(locvar1*FRACUNIT);
|
||||
|
||||
if (LUA_CallAction(A_ROLLANGLE, actor))
|
||||
return;
|
||||
|
||||
// relative (default)
|
||||
if (!locvar2)
|
||||
actor->rollangle += angle;
|
||||
// absolute
|
||||
else
|
||||
actor->rollangle = angle;
|
||||
}
|
||||
|
||||
// Function: A_ChangeRollAngleRelative
|
||||
//
|
||||
// Description: Changes the roll angle to a random relative value between the min and max. Set min and max to the same value to eliminate randomness
|
||||
//
|
||||
// var1 = min
|
||||
// var2 = max
|
||||
//
|
||||
void A_ChangeRollAngleRelative(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
const fixed_t amin = locvar1*FRACUNIT;
|
||||
const fixed_t amax = locvar2*FRACUNIT;
|
||||
|
||||
if (LUA_CallAction(A_CHANGEROLLANGLERELATIVE, actor))
|
||||
return;
|
||||
|
||||
#ifdef PARANOIA
|
||||
if (amin > amax)
|
||||
I_Error("A_ChangeRollAngleRelative: var1 is greater than var2");
|
||||
#endif
|
||||
|
||||
actor->rollangle += FixedAngle(P_RandomRange(amin, amax));
|
||||
}
|
||||
|
||||
// Function: A_ChangeRollAngleAbsolute
|
||||
//
|
||||
// Description: Changes the roll angle to a random absolute value between the min and max. Set min and max to the same value to eliminate randomness
|
||||
//
|
||||
// var1 = min
|
||||
// var2 = max
|
||||
//
|
||||
void A_ChangeRollAngleAbsolute(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
const fixed_t amin = locvar1*FRACUNIT;
|
||||
const fixed_t amax = locvar2*FRACUNIT;
|
||||
|
||||
if (LUA_CallAction(A_CHANGEROLLANGLEABSOLUTE, actor))
|
||||
return;
|
||||
|
||||
#ifdef PARANOIA
|
||||
if (amin > amax)
|
||||
I_Error("A_ChangeRollAngleAbsolute: var1 is greater than var2");
|
||||
#endif
|
||||
|
||||
actor->rollangle = FixedAngle(P_RandomRange(amin, amax));
|
||||
}
|
||||
|
||||
// Function: A_PlaySound
|
||||
//
|
||||
// Description: Plays a sound
|
||||
|
||||
+36
-111
@@ -2119,10 +2119,11 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||
sec = §ors[secnum];
|
||||
|
||||
FOFsector = false;
|
||||
INT32 special = GETSECSPECIAL(sec->special, 2);
|
||||
|
||||
if (GETSECSPECIAL(sec->special, 2) == 3 || GETSECSPECIAL(sec->special, 2) == 5)
|
||||
if (special == 3 || special == 5)
|
||||
floortouch = true;
|
||||
else if (GETSECSPECIAL(sec->special, 2) >= 1 && GETSECSPECIAL(sec->special, 2) <= 8)
|
||||
else if (special >= 1 && special <= 8)
|
||||
floortouch = false;
|
||||
else
|
||||
continue;
|
||||
@@ -2254,7 +2255,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||
continue;
|
||||
|
||||
if (!(players[i].mo->subsector->sector == sec
|
||||
|| P_PlayerTouchingSectorSpecial(&players[i], 2, (GETSECSPECIAL(sec->special, 2))) == sec))
|
||||
|| P_PlayerTouchingSectorSpecial(&players[i], 2, special) == sec))
|
||||
continue;
|
||||
|
||||
if (floortouch == true && P_IsObjectOnRealGround(players[i].mo, sec))
|
||||
@@ -2298,7 +2299,9 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||
|
||||
while ((affectPlayer = P_HavePlayersEnteredArea(playersArea, oldPlayersArea, inAndOut)) != -1)
|
||||
{
|
||||
if (GETSECSPECIAL(sec->special, 2) == 2 || GETSECSPECIAL(sec->special, 2) == 3)
|
||||
INT32 special = GETSECSPECIAL(sec->special, 2);
|
||||
|
||||
if (special == 2 || special == 3)
|
||||
{
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
@@ -2507,123 +2510,44 @@ void T_CameraScanner(elevator_t *elevator)
|
||||
{
|
||||
// leveltime is compared to make multiple scanners in one map function correctly.
|
||||
static tic_t lastleveltime = 32000; // any number other than 0 should do here
|
||||
static boolean camerascanned, camerascanned2, camerascanned3, camerascanned4;
|
||||
static boolean camerascanned[MAXSPLITSCREENPLAYERS];
|
||||
static fixed_t t_cam_dist[MAXSPLITSCREENPLAYERS] = {-42, -42, -42, -42};
|
||||
static fixed_t t_cam_height[MAXSPLITSCREENPLAYERS] = {-42, -42, -42, -42};
|
||||
|
||||
if (leveltime != lastleveltime) // Back on the first camera scanner
|
||||
{
|
||||
camerascanned = camerascanned2 = camerascanned3 = camerascanned4 = false;
|
||||
memset(camerascanned, false, sizeof (camerascanned));
|
||||
lastleveltime = leveltime;
|
||||
}
|
||||
|
||||
if (players[displayplayers[0]].mo)
|
||||
for (UINT8 i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (players[displayplayers[0]].mo->subsector->sector == elevator->actionsector)
|
||||
{
|
||||
if (t_cam_dist == -42)
|
||||
t_cam_dist = cv_cam_dist.value;
|
||||
if (t_cam_height == -42)
|
||||
t_cam_height = cv_cam_height.value;
|
||||
if (t_cam_rotate == -42)
|
||||
t_cam_rotate = cv_cam_rotate.value;
|
||||
CV_SetValue(&cv_cam_height, FixedInt(elevator->sector->floorheight));
|
||||
CV_SetValue(&cv_cam_dist, FixedInt(elevator->sector->ceilingheight));
|
||||
CV_SetValue(&cv_cam_rotate, elevator->distance);
|
||||
camerascanned = true;
|
||||
}
|
||||
else if (!camerascanned)
|
||||
{
|
||||
if (t_cam_height != -42 && cv_cam_height.value != t_cam_height)
|
||||
CV_Set(&cv_cam_height, va("%f", (double)FIXED_TO_FLOAT(t_cam_height)));
|
||||
if (t_cam_dist != -42 && cv_cam_dist.value != t_cam_dist)
|
||||
CV_Set(&cv_cam_dist, va("%f", (double)FIXED_TO_FLOAT(t_cam_dist)));
|
||||
if (t_cam_rotate != -42 && cv_cam_rotate.value != t_cam_rotate)
|
||||
CV_Set(&cv_cam_rotate, va("%f", (double)t_cam_rotate));
|
||||
if (!players[displayplayers[i]].mo || P_MobjWasRemoved(players[displayplayers[i]].mo))
|
||||
continue;
|
||||
|
||||
t_cam_dist = t_cam_height = t_cam_rotate = -42;
|
||||
}
|
||||
}
|
||||
|
||||
if (splitscreen && players[displayplayers[1]].mo)
|
||||
{
|
||||
if (players[displayplayers[1]].mo->subsector->sector == elevator->actionsector)
|
||||
if (players[displayplayers[i]].mo->subsector->sector == elevator->actionsector)
|
||||
{
|
||||
if (t_cam2_rotate == -42)
|
||||
t_cam2_dist = cv_cam2_dist.value;
|
||||
if (t_cam2_rotate == -42)
|
||||
t_cam2_height = cv_cam2_height.value;
|
||||
if (t_cam2_rotate == -42)
|
||||
t_cam2_rotate = cv_cam2_rotate.value;
|
||||
CV_SetValue(&cv_cam2_height, FixedInt(elevator->sector->floorheight));
|
||||
CV_SetValue(&cv_cam2_dist, FixedInt(elevator->sector->ceilingheight));
|
||||
CV_SetValue(&cv_cam2_rotate, elevator->distance);
|
||||
camerascanned2 = true;
|
||||
if (t_cam_dist[i] == -42)
|
||||
t_cam_dist[i] = cv_cam_dist[i].value;
|
||||
if (t_cam_height[i] == -42)
|
||||
t_cam_height[i] = cv_cam_height[i].value;
|
||||
if (t_cam_rotate[i] == -42)
|
||||
t_cam_rotate[i] = cv_cam_rotate[i].value;
|
||||
CV_SetValue(&cv_cam_height[i], FixedInt(elevator->sector->floorheight));
|
||||
CV_SetValue(&cv_cam_dist[i], FixedInt(elevator->sector->ceilingheight));
|
||||
CV_SetValue(&cv_cam_rotate[i], elevator->distance);
|
||||
camerascanned[i] = true;
|
||||
}
|
||||
else if (!camerascanned2)
|
||||
else if (!camerascanned[i])
|
||||
{
|
||||
if (t_cam2_height != -42 && cv_cam2_height.value != t_cam2_height)
|
||||
CV_Set(&cv_cam2_height, va("%f", (double)FIXED_TO_FLOAT(t_cam2_height)));
|
||||
if (t_cam2_dist != -42 && cv_cam2_dist.value != t_cam2_dist)
|
||||
CV_Set(&cv_cam2_dist, va("%f", (double)FIXED_TO_FLOAT(t_cam2_dist)));
|
||||
if (t_cam2_rotate != -42 && cv_cam2_rotate.value != t_cam2_rotate)
|
||||
CV_Set(&cv_cam2_rotate, va("%f", (double)t_cam2_rotate));
|
||||
if (t_cam_height[i] != -42 && cv_cam_height[i].value != t_cam_height[i])
|
||||
CV_Set(&cv_cam_height[i], va("%f", (double)FIXED_TO_FLOAT(t_cam_height[i])));
|
||||
if (t_cam_dist[i] != -42 && cv_cam_dist[i].value != t_cam_dist[i])
|
||||
CV_Set(&cv_cam_dist[i], va("%f", (double)FIXED_TO_FLOAT(t_cam_dist[i])));
|
||||
if (t_cam_rotate[i] != -42 && cv_cam_rotate[i].value != t_cam_rotate[i])
|
||||
CV_Set(&cv_cam_rotate[i], va("%f", (double)t_cam_rotate[i]));
|
||||
|
||||
t_cam2_dist = t_cam2_height = t_cam2_rotate = -42;
|
||||
}
|
||||
}
|
||||
|
||||
if (splitscreen > 1 && players[displayplayers[2]].mo)
|
||||
{
|
||||
if (players[displayplayers[2]].mo->subsector->sector == elevator->actionsector)
|
||||
{
|
||||
if (t_cam3_rotate == -42)
|
||||
t_cam3_dist = cv_cam3_dist.value;
|
||||
if (t_cam3_rotate == -42)
|
||||
t_cam3_height = cv_cam3_height.value;
|
||||
if (t_cam3_rotate == -42)
|
||||
t_cam3_rotate = cv_cam3_rotate.value;
|
||||
CV_SetValue(&cv_cam3_height, FixedInt(elevator->sector->floorheight));
|
||||
CV_SetValue(&cv_cam3_dist, FixedInt(elevator->sector->ceilingheight));
|
||||
CV_SetValue(&cv_cam3_rotate, elevator->distance);
|
||||
camerascanned3 = true;
|
||||
}
|
||||
else if (!camerascanned3)
|
||||
{
|
||||
if (t_cam3_height != -42 && cv_cam3_height.value != t_cam3_height)
|
||||
CV_Set(&cv_cam3_height, va("%f", (double)FIXED_TO_FLOAT(t_cam3_height)));
|
||||
if (t_cam3_dist != -42 && cv_cam3_dist.value != t_cam3_dist)
|
||||
CV_Set(&cv_cam3_dist, va("%f", (double)FIXED_TO_FLOAT(t_cam3_dist)));
|
||||
if (t_cam3_rotate != -42 && cv_cam3_rotate.value != t_cam3_rotate)
|
||||
CV_Set(&cv_cam3_rotate, va("%f", (double)t_cam3_rotate));
|
||||
|
||||
t_cam3_dist = t_cam3_height = t_cam3_rotate = -42;
|
||||
}
|
||||
}
|
||||
|
||||
if (splitscreen > 2 && players[displayplayers[3]].mo)
|
||||
{
|
||||
if (players[displayplayers[3]].mo->subsector->sector == elevator->actionsector)
|
||||
{
|
||||
if (t_cam4_rotate == -42)
|
||||
t_cam4_dist = cv_cam4_dist.value;
|
||||
if (t_cam4_rotate == -42)
|
||||
t_cam4_height = cv_cam4_height.value;
|
||||
if (t_cam4_rotate == -42)
|
||||
t_cam4_rotate = cv_cam4_rotate.value;
|
||||
CV_SetValue(&cv_cam4_height, FixedInt(elevator->sector->floorheight));
|
||||
CV_SetValue(&cv_cam4_dist, FixedInt(elevator->sector->ceilingheight));
|
||||
CV_SetValue(&cv_cam4_rotate, elevator->distance);
|
||||
camerascanned4 = true;
|
||||
}
|
||||
else if (!camerascanned4)
|
||||
{
|
||||
if (t_cam4_height != -42 && cv_cam4_height.value != t_cam4_height)
|
||||
CV_Set(&cv_cam4_height, va("%f", (double)FIXED_TO_FLOAT(t_cam4_height)));
|
||||
if (t_cam4_dist != -42 && cv_cam4_dist.value != t_cam4_dist)
|
||||
CV_Set(&cv_cam4_dist, va("%f", (double)FIXED_TO_FLOAT(t_cam4_dist)));
|
||||
if (t_cam4_rotate != -42 && cv_cam4_rotate.value != t_cam4_rotate)
|
||||
CV_Set(&cv_cam4_rotate, va("%f", (double)t_cam4_rotate));
|
||||
|
||||
t_cam4_dist = t_cam4_height = t_cam4_rotate = -42;
|
||||
t_cam_dist[i] = t_cam_height[i] = t_cam_rotate[i] = -42;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2996,11 +2920,12 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover)
|
||||
fixed_t a, b, c;
|
||||
mobjtype_t type = MT_ROCKCRUMBLE1;
|
||||
const fixed_t spacing = 48*mapobjectscale;
|
||||
INT32 special = GETSECSPECIAL(rover->master->frontsector->special, 3);
|
||||
|
||||
// If the control sector has a special
|
||||
// of Section3:7-15, use the custom debris.
|
||||
if (GETSECSPECIAL(rover->master->frontsector->special, 3) >= 8)
|
||||
type = MT_ROCKCRUMBLE1+(GETSECSPECIAL(rover->master->frontsector->special, 3)-7);
|
||||
if (special >= 8)
|
||||
type = MT_ROCKCRUMBLE1+(special-7);
|
||||
|
||||
// soundorg z height never gets set normally, so MEH.
|
||||
sec->soundorg.z = sec->floorheight;
|
||||
|
||||
+34
-264
@@ -662,9 +662,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
|
||||
special->momx = special->momy = special->momz = 0;
|
||||
P_GivePlayerRings(player, 1);
|
||||
|
||||
if ((maptol & TOL_NIGHTS) && special->type != MT_FLINGRING)
|
||||
P_DoNightsScore(player);
|
||||
break;
|
||||
|
||||
case MT_COIN:
|
||||
@@ -674,9 +671,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
|
||||
special->momx = special->momy = 0;
|
||||
P_GivePlayerRings(player, 1);
|
||||
|
||||
if ((maptol & TOL_NIGHTS) && special->type != MT_FLINGCOIN)
|
||||
P_DoNightsScore(player);
|
||||
break;
|
||||
case MT_BLUEBALL:
|
||||
if (!(P_CanPickupItem(player, 0)))
|
||||
@@ -690,9 +684,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
special->scalespeed = FixedDiv(FixedDiv(special->destscale, special->scale), states[special->info->deathstate].tics<<FRACBITS);
|
||||
else
|
||||
special->scalespeed = 4*FRACUNIT/5;
|
||||
|
||||
if (maptol & TOL_NIGHTS)
|
||||
P_DoNightsScore(player);
|
||||
break;
|
||||
case MT_AUTOPICKUP:
|
||||
case MT_BOUNCEPICKUP:
|
||||
@@ -842,8 +833,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
return;
|
||||
if (special->fuse == 1)
|
||||
return;
|
||||
// if (special->momz > 0)
|
||||
// return;
|
||||
{
|
||||
UINT8 flagteam = (special->type == MT_REDFLAG) ? 1 : 2;
|
||||
const char *flagtext;
|
||||
@@ -976,11 +965,10 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
break;
|
||||
case MT_HOOPCOLLIDE:
|
||||
// This produces a kind of 'domino effect' with the hoop's pieces.
|
||||
if (!midgamejoin)
|
||||
for (; special->hprev != NULL; special = special->hprev); // Move to the first sprite in the hoop
|
||||
for (; !P_MobjWasRemoved(special->hprev); special = special->hprev); // Move to the first sprite in the hoop
|
||||
|
||||
i = 0;
|
||||
for (; special->type == MT_HOOP; special = special->hnext)
|
||||
for (; !P_MobjWasRemoved(special->hnext) && special->type == MT_HOOP; special = special->hnext)
|
||||
{
|
||||
special->fuse = 11;
|
||||
special->movedir = i;
|
||||
@@ -1342,10 +1330,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
return; // SRB2kart - don't need bubbles mucking with the player
|
||||
if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL)
|
||||
return;
|
||||
if (maptol & TOL_NIGHTS)
|
||||
return;
|
||||
if (mariomode)
|
||||
return;
|
||||
else if (toucher->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
if (special->z+special->height < toucher->z + toucher->height / 3
|
||||
@@ -1434,46 +1418,36 @@ void P_CheckTimeLimit(void)
|
||||
if (gamestate == GS_LEVEL && (leveltime == (timelimitintics + TICRATE)))
|
||||
S_StartSound(NULL, sfx_strpst);
|
||||
|
||||
// Normal Match
|
||||
if (!G_GametypeHasTeams())
|
||||
//Store the nodes of participating players in an array.
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
//Store the nodes of participating players in an array.
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i] && !players[i].spectator)
|
||||
{
|
||||
if (playeringame[i] && !players[i].spectator)
|
||||
playerarray[playercount] = i;
|
||||
playercount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (playercount > MAXPLAYERS)
|
||||
playercount = MAXPLAYERS;
|
||||
|
||||
//Sort 'em.
|
||||
for (i = 1; i < playercount; i++)
|
||||
{
|
||||
for (k = i; k < playercount; k++)
|
||||
{
|
||||
if (players[playerarray[i-1]].marescore < players[playerarray[k]].marescore)
|
||||
{
|
||||
playerarray[playercount] = i;
|
||||
playercount++;
|
||||
tempplayer = playerarray[i-1];
|
||||
playerarray[i-1] = playerarray[k];
|
||||
playerarray[k] = tempplayer;
|
||||
}
|
||||
}
|
||||
|
||||
if (playercount > MAXPLAYERS)
|
||||
playercount = MAXPLAYERS;
|
||||
|
||||
//Sort 'em.
|
||||
for (i = 1; i < playercount; i++)
|
||||
{
|
||||
for (k = i; k < playercount; k++)
|
||||
{
|
||||
if (players[playerarray[i-1]].marescore < players[playerarray[k]].marescore)
|
||||
{
|
||||
tempplayer = playerarray[i-1];
|
||||
playerarray[i-1] = playerarray[k];
|
||||
playerarray[k] = tempplayer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//End the round if the top players aren't tied.
|
||||
if (players[playerarray[0]].marescore == players[playerarray[1]].marescore)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
//In team match and CTF, determining a tie is much simpler. =P
|
||||
if (redscore == bluescore)
|
||||
return;
|
||||
}
|
||||
|
||||
//End the round if the top players aren't tied.
|
||||
if (players[playerarray[0]].marescore == players[playerarray[1]].marescore)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1720,21 +1694,6 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
P_UnsetThingPosition(target);
|
||||
target->flags |= MF_NOBLOCKMAP|MF_NOCLIPHEIGHT;
|
||||
P_SetThingPosition(target);
|
||||
|
||||
if (!target->player->bot && !G_IsSpecialStage(gamemap)
|
||||
&& G_GametypeUsesLives())
|
||||
{
|
||||
target->player->lives -= 1; // Lose a life Tails 03-11-2000
|
||||
|
||||
if (target->player->lives <= 0) // Tails 03-14-2000
|
||||
{
|
||||
if (P_IsLocalPlayer(target->player)/* && target->player == &players[consoleplayer] */)
|
||||
{
|
||||
S_StopMusic(); // Stop the Music! Tails 03-14-2000
|
||||
S_ChangeMusicInternal("gmover", false); // Yousa dead now, Okieday? Tails 03-14-2000
|
||||
}
|
||||
}
|
||||
}
|
||||
target->player->playerstate = PST_DEAD;
|
||||
|
||||
if (cv_birdmusic.value && cv_fading.value && P_IsLocalPlayer(target->player))
|
||||
@@ -1786,8 +1745,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
// Drop stuff.
|
||||
// This determines the kind of object spawned
|
||||
// during the death frame of a thing.
|
||||
if (!mariomode // Don't show birds, etc. in Mario Mode Tails 12-23-2001
|
||||
&& target->flags & MF_ENEMY)
|
||||
if (target->flags & MF_ENEMY)
|
||||
{
|
||||
if (cv_soniccd.value)
|
||||
item = MT_SEED;
|
||||
@@ -2160,90 +2118,9 @@ static inline void P_NiGHTSDamage(mobj_t *target, mobj_t *source)
|
||||
}
|
||||
}
|
||||
|
||||
static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage)
|
||||
static inline boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *source)
|
||||
{
|
||||
player_t *player = target->player;
|
||||
(void)damage; //unused parm
|
||||
|
||||
// If flashing or invulnerable, ignore the tag,
|
||||
if (player->powers[pw_flashing] || player->powers[pw_invulnerability])
|
||||
return false;
|
||||
|
||||
// Ignore IT players shooting each other, unless friendlyfire is on.
|
||||
if ((player->pflags & PF_TAGIT && !(cv_friendlyfire.value &&
|
||||
source && source->player && source->player->pflags & PF_TAGIT)))
|
||||
return false;
|
||||
|
||||
// Don't allow any damage before the round starts.
|
||||
if (leveltime <= hidetime * TICRATE)
|
||||
return false;
|
||||
|
||||
// Don't allow players on the same team to hurt one another,
|
||||
// unless cv_friendlyfire is on.
|
||||
if (!cv_friendlyfire.value && (player->pflags & PF_TAGIT) == (source->player->pflags & PF_TAGIT))
|
||||
{
|
||||
if (!(inflictor->flags & MF_FIRE))
|
||||
P_GivePlayerRings(player, 1);
|
||||
if (inflictor->flags2 & MF2_BOUNCERING)
|
||||
inflictor->fuse = 0; // bounce ring disappears at -1 not 0
|
||||
return false;
|
||||
}
|
||||
|
||||
P_DoPlayerPain(player, source, inflictor);
|
||||
|
||||
// Check for a shield
|
||||
if (player->powers[pw_shield])
|
||||
{
|
||||
P_RemoveShield(player);
|
||||
S_StartSound(target, sfx_shldls);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (target->health <= 1) // Death
|
||||
{
|
||||
P_PlayDeathSound(target);
|
||||
P_PlayVictorySound(source); // Killer laughs at you! LAUGHS! BWAHAHAHHAHAA!!
|
||||
}
|
||||
else if (target->health > 1) // Ring loss
|
||||
{
|
||||
P_PlayRinglossSound(target, source);
|
||||
P_PlayerRingBurst(player, player->mo->health - 1);
|
||||
}
|
||||
|
||||
if (inflictor && ((inflictor->flags & MF_MISSILE) || inflictor->player) && player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]))
|
||||
{
|
||||
player->health -= 10;
|
||||
if (player->health < 2)
|
||||
player->health = 2;
|
||||
target->health = player->health;
|
||||
}
|
||||
else
|
||||
player->health = target->health = 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage)
|
||||
{
|
||||
player_t *player = target->player;
|
||||
|
||||
// Tag handling
|
||||
if (G_TagGametype())
|
||||
return P_TagDamage(target, inflictor, source, damage);
|
||||
else if (G_GametypeHasTeams()) // CTF + Team Match
|
||||
{
|
||||
// Don't allow players on the same team to hurt one another,
|
||||
// unless cv_friendlyfire is on.
|
||||
if (!cv_friendlyfire.value && target->player->ctfteam == source->player->ctfteam)
|
||||
{
|
||||
if (!(inflictor->flags & MF_FIRE))
|
||||
P_GivePlayerRings(target->player, 1);
|
||||
if (inflictor->flags2 & MF2_BOUNCERING)
|
||||
inflictor->fuse = 0; // bounce ring disappears at -1 not 0
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Add pity.
|
||||
if (!player->powers[pw_flashing] && !player->powers[pw_invulnerability] && !player->powers[pw_super]
|
||||
@@ -2484,9 +2361,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
{
|
||||
if (player->exiting)
|
||||
return false;
|
||||
|
||||
if (!(target->player->pflags & (PF_NIGHTSMODE|PF_NIGHTSFALL)) && (maptol & TOL_NIGHTS))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (player->pflags & PF_NIGHTSMODE) // NiGHTS damage handling
|
||||
@@ -2495,10 +2369,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
{
|
||||
if (source == target)
|
||||
return false; // Don't hit yourself with your own paraloop, baka
|
||||
if (source && source->player && !cv_friendlyfire.value
|
||||
&& (gametype == GT_COOP
|
||||
|| (G_GametypeHasTeams() && target->player->ctfteam == source->player->ctfteam)))
|
||||
return false; // Don't run eachother over in special stages and team games and such
|
||||
}
|
||||
|
||||
if (LUAh_MobjDamage(target, inflictor, source, damage))
|
||||
@@ -2531,7 +2401,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
// Player hits another player
|
||||
if (!force && source && source->player)
|
||||
{
|
||||
if (!P_PlayerHitsPlayer(target, inflictor, source, damage))
|
||||
if (!P_PlayerHitsPlayer(target, source))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2585,9 +2455,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
if (player->health < 2)
|
||||
player->health = 2;
|
||||
}
|
||||
|
||||
if (gametype == GT_CTF && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
|
||||
P_PlayerFlagBurst(player, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2739,9 +2606,7 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings)
|
||||
{
|
||||
ns = FixedMul(((i*FRACUNIT)/16)+2*FRACUNIT, mo->scale);
|
||||
mo->momx = FixedMul(FINECOSINE(fa),ns);
|
||||
|
||||
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD)))
|
||||
mo->momy = FixedMul(FINESINE(fa),ns);
|
||||
mo->momy = FixedMul(FINESINE(fa),ns);
|
||||
|
||||
P_SetObjectMomZ(mo, 8*FRACUNIT, false);
|
||||
mo->fuse = 20*TICRATE; // Adjust fuse for NiGHTS
|
||||
@@ -2763,9 +2628,7 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings)
|
||||
|
||||
ns = FixedMul(momxy, mo->scale);
|
||||
mo->momx = FixedMul(FINECOSINE(fa),ns);
|
||||
|
||||
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD)))
|
||||
mo->momy = FixedMul(FINESINE(fa),ns);
|
||||
mo->momy = FixedMul(FINESINE(fa),ns);
|
||||
|
||||
ns = momz;
|
||||
P_SetObjectMomZ(mo, ns, false);
|
||||
@@ -2870,9 +2733,7 @@ void P_PlayerWeaponPanelBurst(player_t *player)
|
||||
// >16 ring type spillout
|
||||
ns = FixedMul(3*FRACUNIT, mo->scale);
|
||||
mo->momx = FixedMul(FINECOSINE(fa),ns);
|
||||
|
||||
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD)))
|
||||
mo->momy = FixedMul(FINESINE(fa),ns);
|
||||
mo->momy = FixedMul(FINESINE(fa),ns);
|
||||
|
||||
P_SetObjectMomZ(mo, 4*FRACUNIT, false);
|
||||
|
||||
@@ -2954,9 +2815,7 @@ void P_PlayerWeaponAmmoBurst(player_t *player)
|
||||
// Spill them!
|
||||
ns = FixedMul(2*FRACUNIT, mo->scale);
|
||||
mo->momx = FixedMul(FINECOSINE(fa), ns);
|
||||
|
||||
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD)))
|
||||
mo->momy = FixedMul(FINESINE(fa),ns);
|
||||
mo->momy = FixedMul(FINESINE(fa),ns);
|
||||
|
||||
P_SetObjectMomZ(mo, 3*FRACUNIT, false);
|
||||
|
||||
@@ -3070,11 +2929,7 @@ void P_PlayerEmeraldBurst(player_t *player, boolean toss)
|
||||
}
|
||||
|
||||
momx = FixedMul(FINECOSINE(fa), ns);
|
||||
|
||||
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD)))
|
||||
momy = FixedMul(FINESINE(fa),ns);
|
||||
else
|
||||
momy = 0;
|
||||
momy = FixedMul(FINESINE(fa),ns);
|
||||
|
||||
mo = P_SpawnMobj(player->mo->x, player->mo->y, z, MT_FLINGEMERALD);
|
||||
mo->health = 1;
|
||||
@@ -3098,88 +2953,3 @@ void P_PlayerEmeraldBurst(player_t *player, boolean toss)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Makes an injured or dead player lose possession of the flag.
|
||||
*
|
||||
* \param player The player with the flag, about to lose it.
|
||||
* \sa P_PlayerRingBurst
|
||||
*/
|
||||
void P_PlayerFlagBurst(player_t *player, boolean toss)
|
||||
{
|
||||
mobj_t *flag;
|
||||
mobjtype_t type;
|
||||
|
||||
if (!(player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
|
||||
return;
|
||||
|
||||
if (player->gotflag & GF_REDFLAG)
|
||||
type = MT_REDFLAG;
|
||||
else
|
||||
type = MT_BLUEFLAG;
|
||||
|
||||
flag = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, type);
|
||||
|
||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||
flag->z += player->mo->height - flag->height;
|
||||
|
||||
if (toss)
|
||||
P_InstaThrust(flag, player->mo->angle, FixedMul(6*FRACUNIT, player->mo->scale));
|
||||
else
|
||||
{
|
||||
angle_t fa = P_RandomByte()*FINEANGLES/256;
|
||||
flag->momx = FixedMul(FINECOSINE(fa), FixedMul(6*FRACUNIT, player->mo->scale));
|
||||
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD)))
|
||||
flag->momy = FixedMul(FINESINE(fa), FixedMul(6*FRACUNIT, player->mo->scale));
|
||||
}
|
||||
|
||||
flag->momz = FixedMul(8*FRACUNIT, player->mo->scale);
|
||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||
flag->momz = -flag->momz;
|
||||
|
||||
if (type == MT_REDFLAG)
|
||||
flag->spawnpoint = rflagpoint;
|
||||
else
|
||||
flag->spawnpoint = bflagpoint;
|
||||
|
||||
flag->fuse = cv_flagtime.value * TICRATE;
|
||||
P_SetTarget(&flag->target, player->mo);
|
||||
|
||||
// Flag text
|
||||
char plname[MAXPLAYERNAME+4];
|
||||
const char *flagtext;
|
||||
char flagcolor;
|
||||
|
||||
snprintf(plname, sizeof(plname), "%s%s%s",
|
||||
CTFTEAMCODE(player),
|
||||
player_names[player - players],
|
||||
CTFTEAMENDCODE(player));
|
||||
|
||||
if (type == MT_REDFLAG)
|
||||
{
|
||||
flagtext = M_GetText("Red flag");
|
||||
flagcolor = '\x85';
|
||||
}
|
||||
else
|
||||
{
|
||||
flagtext = M_GetText("Blue flag");
|
||||
flagcolor = '\x84';
|
||||
}
|
||||
|
||||
if (toss)
|
||||
CONS_Printf(M_GetText("%s tossed the %c%s%c.\n"), plname, flagcolor, flagtext, 0x80);
|
||||
else
|
||||
CONS_Printf(M_GetText("%s dropped the %c%s%c.\n"), plname, flagcolor, flagtext, 0x80);
|
||||
|
||||
player->gotflag = 0;
|
||||
|
||||
// Pointers set for displaying time value and for consistency restoration.
|
||||
if (type == MT_REDFLAG)
|
||||
redflag = flag;
|
||||
else
|
||||
blueflag = flag;
|
||||
|
||||
if (toss)
|
||||
player->tossdelay = 2*TICRATE;
|
||||
|
||||
return;
|
||||
}
|
||||
+9
-23
@@ -57,9 +57,6 @@
|
||||
|
||||
#define AIMINGTOSLOPE(aiming) FINESINE((aiming>>ANGLETOFINESHIFT) & FINEMASK)
|
||||
|
||||
#define mariomode (maptol & TOL_MARIO)
|
||||
#define twodlevel (maptol & TOL_2D)
|
||||
|
||||
//
|
||||
// P_TICK
|
||||
//
|
||||
@@ -116,7 +113,7 @@ struct demofreecam_s {
|
||||
|
||||
camera_t *cam; // this is useful when the game is paused, notably
|
||||
mobj_t *soundmobj; // mobj to play sound from, used in s_sound
|
||||
|
||||
|
||||
angle_t localangle; // keeps track of the cam angle for cmds
|
||||
angle_t localaiming; // ditto with aiming
|
||||
boolean turnheld; // holding turn button for gradual turn speed
|
||||
@@ -126,17 +123,12 @@ struct demofreecam_s {
|
||||
extern struct demofreecam_s democam;
|
||||
|
||||
extern camera_t camera[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_dist, cv_cam_still, cv_cam_height;
|
||||
extern consvar_t cv_cam_speed, cv_cam_rotate, cv_cam_rotspeed;
|
||||
|
||||
extern consvar_t cv_cam2_dist, cv_cam2_still, cv_cam2_height;
|
||||
extern consvar_t cv_cam2_speed, cv_cam2_rotate, cv_cam2_rotspeed;
|
||||
|
||||
extern consvar_t cv_cam3_dist, cv_cam3_still, cv_cam3_height;
|
||||
extern consvar_t cv_cam3_speed, cv_cam3_rotate, cv_cam3_rotspeed;
|
||||
|
||||
extern consvar_t cv_cam4_dist, cv_cam4_still, cv_cam4_height;
|
||||
extern consvar_t cv_cam4_speed, cv_cam4_rotate, cv_cam4_rotspeed;
|
||||
extern consvar_t cv_cam_dist[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_still[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_height[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_speed[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_rotate[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_rotspeed[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern consvar_t cv_tilting;
|
||||
extern consvar_t cv_quaketilt;
|
||||
@@ -146,10 +138,7 @@ extern consvar_t cv_actionmovie;
|
||||
|
||||
extern consvar_t cv_lookbackmom;
|
||||
|
||||
extern fixed_t t_cam_dist, t_cam_height, t_cam_rotate;
|
||||
extern fixed_t t_cam2_dist, t_cam2_height, t_cam2_rotate;
|
||||
extern fixed_t t_cam3_dist, t_cam3_height, t_cam3_rotate;
|
||||
extern fixed_t t_cam4_dist, t_cam4_height, t_cam4_rotate;
|
||||
extern fixed_t t_cam_rotate[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
fixed_t P_GetPlayerHeight(player_t *player);
|
||||
fixed_t P_GetPlayerSpinHeight(player_t *player);
|
||||
@@ -265,7 +254,7 @@ void P_SceneryThinker(mobj_t *mobj);
|
||||
// To test it in Lua, check mobj.valid
|
||||
FUNCINLINE static ATTRINLINE boolean P_MobjWasRemoved(const mobj_t *mobj)
|
||||
{
|
||||
return !(mobj && mobj->thinker.function.acp1 == (actionf_p1)P_MobjThinker);
|
||||
return (!mobj || mobj->thinker.function.acp1 != (actionf_p1)P_MobjThinker);
|
||||
}
|
||||
|
||||
fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect);
|
||||
@@ -297,7 +286,6 @@ mobj_t *P_SPMAngle(mobj_t *source, mobjtype_t type, angle_t angle, UINT8 aimtype
|
||||
#ifdef SEENAMES
|
||||
#define P_SpawnNameFinder(s,t) P_SPMAngle(s,t,s->angle,true,0)
|
||||
#endif
|
||||
void P_ColorTeamMissile(mobj_t *missile, player_t *source);
|
||||
|
||||
// P_MobjFlip
|
||||
// Special utility to return +1 or -1 depending on mobj's gravity
|
||||
@@ -445,10 +433,8 @@ void P_PlayerWeaponAmmoBurst(player_t *player);
|
||||
void P_PlayerEmeraldBurst(player_t *player, boolean toss);
|
||||
|
||||
void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck);
|
||||
void P_PlayerFlagBurst(player_t *player, boolean toss);
|
||||
void P_CheckTimeLimit(void);
|
||||
void P_CheckPointLimit(void);
|
||||
//void P_CheckSurvivors(void);
|
||||
boolean P_CheckRacers(void);
|
||||
|
||||
boolean P_CanPickupItem(player_t *player, UINT8 weapon);
|
||||
|
||||
+10
-35
@@ -371,11 +371,6 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||
if (!(thing->flags & (MF_SOLID|MF_SPECIAL|MF_PAIN|MF_SHOOTABLE)) || (thing->flags & MF_NOCLIPTHING))
|
||||
return true;
|
||||
|
||||
// Don't collide with your buddies while NiGHTS-flying.
|
||||
if (tmthing->player && thing->player && (maptol & TOL_NIGHTS)
|
||||
&& ((tmthing->player->pflags & PF_NIGHTSMODE) || (thing->player->pflags & PF_NIGHTSMODE)))
|
||||
return true;
|
||||
|
||||
blockdist = thing->radius + tmthing->radius;
|
||||
|
||||
if (abs(thing->x - tmx) >= blockdist || abs(thing->y - tmy) >= blockdist)
|
||||
@@ -1727,6 +1722,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
||||
tmbbox[BOXLEFT] = x - tmthing->radius;
|
||||
|
||||
newsubsec = R_PointInSubsector(x, y);
|
||||
|
||||
ceilingline = blockingline = NULL;
|
||||
|
||||
// The base floor / ceiling is from the subsector
|
||||
@@ -2165,7 +2161,6 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
{
|
||||
subsector_t *s = R_PointInSubsector(x, y);
|
||||
boolean retval = true;
|
||||
boolean itsatwodlevel = false;
|
||||
UINT8 i;
|
||||
|
||||
floatok = false;
|
||||
@@ -2173,22 +2168,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
if (dedicated) // this crashes so don't even try it
|
||||
return false;
|
||||
|
||||
if (twodlevel)
|
||||
itsatwodlevel = true;
|
||||
else
|
||||
{
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (thiscam == &camera[i] && players[displayplayers[i]].mo
|
||||
&& (players[displayplayers[i]].mo->flags2 & MF2_TWOD))
|
||||
{
|
||||
itsatwodlevel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!itsatwodlevel && players[displayplayers[0]].mo)
|
||||
if (players[displayplayers[0]].mo)
|
||||
{
|
||||
fixed_t tryx = thiscam->x;
|
||||
fixed_t tryy = thiscam->y;
|
||||
@@ -2391,16 +2371,19 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||
{
|
||||
//All things are affected by their scale.
|
||||
fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale);
|
||||
INT32 special = 0;
|
||||
|
||||
if (thing->player)
|
||||
{
|
||||
special = GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1);
|
||||
|
||||
// If using type Section1:13, double the maxstep.
|
||||
if (P_PlayerTouchingSectorSpecial(thing->player, 1, 13)
|
||||
|| GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 13)
|
||||
|| special == 13)
|
||||
maxstep <<= 1;
|
||||
// If using type Section1:12, no maxstep. For ledges you don't want the player to climb! (see: Egg Zeppelin & SMK port walls)
|
||||
else if (P_PlayerTouchingSectorSpecial(thing->player, 1, 12)
|
||||
|| GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 12)
|
||||
|| special == 12)
|
||||
maxstep = 0;
|
||||
}
|
||||
|
||||
@@ -2446,7 +2429,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||
else if (maxstep > 0 && !(
|
||||
thing->player && (
|
||||
P_PlayerTouchingSectorSpecial(thing->player, 1, 14)
|
||||
|| GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 14)
|
||||
|| special == 14)
|
||||
)) // Step down
|
||||
{
|
||||
// If the floor difference is MAXSTEPMOVE or less, and the sector isn't Section1:14, ALWAYS
|
||||
@@ -3179,16 +3162,8 @@ stairstep:
|
||||
|
||||
P_HitSlideLine(bestslideline); // clip the moves
|
||||
|
||||
if ((twodlevel || (mo->flags2 & MF2_TWOD)) && mo->player)
|
||||
{
|
||||
mo->momx = tmxmove;
|
||||
tmymove = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
mo->momx = tmxmove;
|
||||
mo->momy = tmymove;
|
||||
}
|
||||
mo->momx = tmxmove;
|
||||
mo->momy = tmymove;
|
||||
|
||||
do {
|
||||
if (tmxmove > mo->radius) {
|
||||
|
||||
+54
-190
@@ -1174,7 +1174,7 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy)
|
||||
}
|
||||
else if (abs(player->rmomx) < FixedMul(STOPSPEED, mo->scale)
|
||||
&& abs(player->rmomy) < FixedMul(STOPSPEED, mo->scale)
|
||||
&& (!(player->cmd.forwardmove && !(twodlevel || mo->flags2 & MF2_TWOD)) && !player->cmd.sidemove && !(player->pflags & PF_SPINNING))
|
||||
&& (!player->cmd.forwardmove && !player->cmd.sidemove && !(player->pflags & PF_SPINNING))
|
||||
&& !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2))
|
||||
)
|
||||
{
|
||||
@@ -1881,12 +1881,13 @@ boolean P_CheckDeathPitCollide(mobj_t *mo)
|
||||
I_Assert(mo != NULL);
|
||||
I_Assert(!P_MobjWasRemoved(mo));
|
||||
|
||||
INT32 special = GETSECSPECIAL(mo->subsector->sector->special, 1);
|
||||
|
||||
if (((mo->z <= mo->subsector->sector->floorheight
|
||||
&& !(mo->eflags & MFE_VERTICALFLIP) && (mo->subsector->sector->flags & SF_FLIPSPECIAL_FLOOR))
|
||||
|| (mo->z + mo->height >= mo->subsector->sector->ceilingheight
|
||||
&& (mo->eflags & MFE_VERTICALFLIP) && (mo->subsector->sector->flags & SF_FLIPSPECIAL_CEILING)))
|
||||
&& (GETSECSPECIAL(mo->subsector->sector->special, 1) == 6
|
||||
|| GETSECSPECIAL(mo->subsector->sector->special, 1) == 7))
|
||||
&& (special == 6 || special == 7))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -1897,16 +1898,14 @@ boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover)
|
||||
I_Assert(mo != NULL);
|
||||
I_Assert(!P_MobjWasRemoved(mo));
|
||||
|
||||
{
|
||||
fixed_t topheight =
|
||||
*rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) :
|
||||
*rover->topheight;
|
||||
fixed_t topheight =
|
||||
*rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) :
|
||||
*rover->topheight;
|
||||
|
||||
if (rover->flags & FF_SWIMMABLE && GETSECSPECIAL(rover->master->frontsector->special, 1) == 3
|
||||
&& !(rover->master->flags & ML_BLOCKMONSTERS)
|
||||
&& ((rover->master->flags & ML_EFFECT3) || mo->z-mo->momz > topheight - FixedMul(16*FRACUNIT, mo->scale)))
|
||||
return true;
|
||||
}
|
||||
if (rover->flags & FF_SWIMMABLE && GETSECSPECIAL(rover->master->frontsector->special, 1) == 3
|
||||
&& !(rover->master->flags & ML_BLOCKMONSTERS)
|
||||
&& ((rover->master->flags & ML_EFFECT3) || mo->z-mo->momz > topheight - FixedMul(16*FRACUNIT, mo->scale)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -2218,10 +2217,7 @@ static boolean P_ZMovement(mobj_t *mo)
|
||||
|| mo->type == MT_CANNONBALLDECOR
|
||||
|| mo->type == MT_FALLINGROCK)
|
||||
{
|
||||
if (maptol & TOL_NIGHTS)
|
||||
mom.z = -FixedDiv(mom.z, 10*FRACUNIT);
|
||||
else
|
||||
mom.z = -FixedMul(mom.z, FixedDiv(17*FRACUNIT,20*FRACUNIT));
|
||||
mom.z = -FixedMul(mom.z, FixedDiv(17*FRACUNIT,20*FRACUNIT));
|
||||
|
||||
if (mo->type == MT_BIGTUMBLEWEED || mo->type == MT_LITTLETUMBLEWEED)
|
||||
{
|
||||
@@ -2359,12 +2355,7 @@ static boolean P_ZMovement(mobj_t *mo)
|
||||
else
|
||||
// Flags bounce
|
||||
if (mo->type == MT_REDFLAG || mo->type == MT_BLUEFLAG)
|
||||
{
|
||||
if (maptol & TOL_NIGHTS)
|
||||
mo->momz = -FixedDiv(mo->momz, 10*FRACUNIT);
|
||||
else
|
||||
mo->momz = -FixedMul(mo->momz, FixedDiv(17*FRACUNIT,20*FRACUNIT));
|
||||
}
|
||||
mo->momz = -FixedMul(mo->momz, FixedDiv(17*FRACUNIT,20*FRACUNIT));
|
||||
else
|
||||
mo->momz = 0;
|
||||
}
|
||||
@@ -2667,10 +2658,6 @@ nightsdone:
|
||||
} // Ugly ugly billions of braces! Argh!
|
||||
}
|
||||
|
||||
// hit the ceiling
|
||||
if (mariomode)
|
||||
S_StartSound(mo, sfx_mario1);
|
||||
|
||||
if (!mo->player->climbing)
|
||||
mo->momz = 0;
|
||||
}
|
||||
@@ -3316,7 +3303,9 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NOCLIPCAM
|
||||
P_CheckCameraPosition(thiscam->x, thiscam->y, thiscam);
|
||||
#endif
|
||||
|
||||
thiscam->subsector = R_PointInSubsectorFast(thiscam->x, thiscam->y);
|
||||
thiscam->floorz = tmfloorz;
|
||||
@@ -6011,18 +6000,17 @@ static void P_KoopaThinker(mobj_t *koopa)
|
||||
//
|
||||
void P_RollPitchMobj(mobj_t* mobj)
|
||||
{
|
||||
if (!mobj || P_MobjWasRemoved(mobj))
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
return;
|
||||
|
||||
if (cv_spriteroll.value && cv_sloperoll.value == 2)
|
||||
{
|
||||
K_RollMobjBySlopes(mobj, cv_sloperolldist.value && !splitscreen);
|
||||
}
|
||||
else
|
||||
if (cv_sloperoll.value != 2)
|
||||
{
|
||||
mobj->sloperoll = FixedAngle(0);
|
||||
mobj->slopepitch = FixedAngle(0);
|
||||
return;
|
||||
}
|
||||
|
||||
K_RollMobjBySlopes(mobj, cv_sloperolldist.value && !splitscreen);
|
||||
}
|
||||
|
||||
angle_t P_MobjPitchAndRoll(mobj_t *mobj)
|
||||
@@ -6033,14 +6021,17 @@ angle_t P_MobjPitchAndRoll(mobj_t *mobj)
|
||||
angle_t camang = 0;
|
||||
angle_t return_angle = 0;
|
||||
|
||||
if (!cv_spriteroll.value)
|
||||
if (!cv_sloperoll.value)
|
||||
return 0;
|
||||
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
return 0;
|
||||
|
||||
size_t rot = mobj->frame & FF_FRAMEMASK;
|
||||
boolean papersprite = (mobj->frame & FF_PAPERSPRITE);
|
||||
// if mobj doesent have any of those, no need to do the rest
|
||||
if (mobj->roll == 0 && mobj->pitch == 0 && mobj->sloperoll == 0 && mobj->slopepitch == 0)
|
||||
return 0;
|
||||
|
||||
size_t rot = (mobj->frame & FF_FRAMEMASK);
|
||||
|
||||
if (mobj->skin && mobj->sprite == SPR_PLAY)
|
||||
{
|
||||
@@ -6057,7 +6048,7 @@ angle_t P_MobjPitchAndRoll(mobj_t *mobj)
|
||||
if (rot >= sprdef->numframes)
|
||||
{
|
||||
sprdef = &sprites[states[S_UNKNOWN].sprite];
|
||||
rot = states[S_UNKNOWN].frame&FF_FRAMEMASK;
|
||||
rot = (states[S_UNKNOWN].frame & FF_FRAMEMASK);
|
||||
}
|
||||
|
||||
sprframe = &sprdef->spriteframes[rot];
|
||||
@@ -6065,20 +6056,16 @@ angle_t P_MobjPitchAndRoll(mobj_t *mobj)
|
||||
// No sprite frame? I guess it is possible
|
||||
if (!sprframe) return 0;
|
||||
|
||||
if (sprframe->rotate != SRF_SINGLE || papersprite)
|
||||
if (sprframe->rotate != SRF_SINGLE || (mobj->frame & FF_PAPERSPRITE))
|
||||
{
|
||||
ang = R_PointToAngle(mobj->x, mobj->y) - mobj->angle;
|
||||
camang = R_PointToAngle(mobj->x, mobj->y);
|
||||
}
|
||||
|
||||
return_angle = FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), mobj->roll)
|
||||
+ FixedMul(FINESINE((ang) >> ANGLETOFINESHIFT), mobj->pitch);
|
||||
|
||||
if (cv_sloperoll.value)
|
||||
{
|
||||
return_angle += FixedMul(FINECOSINE((camang) >> ANGLETOFINESHIFT), mobj->sloperoll)
|
||||
+ FixedMul(FINESINE((camang) >> ANGLETOFINESHIFT), mobj->slopepitch);
|
||||
}
|
||||
+ FixedMul(FINESINE((ang) >> ANGLETOFINESHIFT), mobj->pitch)
|
||||
+ FixedMul(FINECOSINE((camang) >> ANGLETOFINESHIFT), mobj->sloperoll)
|
||||
+ FixedMul(FINESINE((camang) >> ANGLETOFINESHIFT), mobj->slopepitch);
|
||||
|
||||
return return_angle;
|
||||
}
|
||||
@@ -9211,7 +9198,6 @@ void P_PushableThinker(mobj_t *mobj)
|
||||
|
||||
if (GETSECSPECIAL(sec->special, 2) == 1 && mobj->z == sec->floorheight)
|
||||
P_LinedefExecute(sec->tag, mobj, sec);
|
||||
// else if (GETSECSPECIAL(sec->special, 2) == 8)
|
||||
{
|
||||
sector_t *sec2;
|
||||
|
||||
@@ -10502,11 +10488,8 @@ void P_RespawnSpecials(void)
|
||||
}
|
||||
|
||||
//CTF rings should continue to respawn as normal rings outside of CTF.
|
||||
if (gametype != GT_CTF)
|
||||
{
|
||||
if (i == MT_REDTEAMRING || i == MT_BLUETEAMRING)
|
||||
i = MT_RING;
|
||||
}
|
||||
if (i == MT_REDTEAMRING || i == MT_BLUETEAMRING)
|
||||
i = MT_RING;
|
||||
|
||||
if (mthing->options & MTF_OBJECTFLIP)
|
||||
{
|
||||
@@ -10579,48 +10562,7 @@ void P_SpawnPlayer(INT32 playernum)
|
||||
}
|
||||
else if (multiplayer && !netgame)
|
||||
{
|
||||
// If you're in a team game and you don't have a team assigned yet...
|
||||
if (G_GametypeHasTeams() && p->ctfteam == 0)
|
||||
{
|
||||
changeteam_union NetPacket;
|
||||
UINT16 usvalue;
|
||||
NetPacket.value.l = NetPacket.value.b = 0;
|
||||
|
||||
// Spawn as a spectator,
|
||||
// yes even in splitscreen mode
|
||||
p->spectator = true;
|
||||
p->spectatorreentry = 0; //(cv_spectatorreentry.value * TICRATE);
|
||||
|
||||
if (playernum&1) p->skincolor = skincolor_redteam;
|
||||
else p->skincolor = skincolor_blueteam;
|
||||
|
||||
// but immediately send a team change packet.
|
||||
NetPacket.packet.playernum = playernum;
|
||||
NetPacket.packet.verification = true;
|
||||
NetPacket.packet.newteam = !(playernum&1) + 1;
|
||||
|
||||
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
|
||||
SendNetXCmd(XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
}
|
||||
else // Otherwise, never spectator.
|
||||
p->spectator = false;
|
||||
}
|
||||
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
// Fix stupid non spectator spectators.
|
||||
if (!p->spectator && !p->ctfteam)
|
||||
{
|
||||
p->spectator = true;
|
||||
p->spectatorreentry = 0; //(cv_spectatorreentry.value * TICRATE);
|
||||
}
|
||||
|
||||
// Fix team colors.
|
||||
// This code isn't being done right somewhere else. Oh well.
|
||||
if (p->ctfteam == 1)
|
||||
p->skincolor = skincolor_redteam;
|
||||
else if (p->ctfteam == 2)
|
||||
p->skincolor = skincolor_blueteam;
|
||||
p->spectator = false;
|
||||
}
|
||||
|
||||
mobj = P_SpawnMobj(0, 0, 0, MT_PLAYER);
|
||||
@@ -11021,36 +10963,14 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
||||
return;
|
||||
|
||||
if (i >= MT_EMERALD1 && i <= MT_EMERALD7) // Pickupable Emeralds
|
||||
{
|
||||
if (gametype != GT_COOP) // Don't place emeralds in non-coop modes
|
||||
return;
|
||||
|
||||
if (metalrecording)
|
||||
return; // Metal Sonic isn't for collecting emeralds.
|
||||
|
||||
if (emeralds & mobjinfo[i].speed) // You already have this emerald!
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
if (!G_BattleGametype() || !cv_specialrings.value)
|
||||
if (P_WeaponOrPanel(i))
|
||||
return; // Don't place weapons/panels in non-ringslinger modes
|
||||
|
||||
if (i == MT_EMERHUNT)
|
||||
{
|
||||
// Emerald Hunt is Coop only.
|
||||
if (gametype != GT_COOP)
|
||||
return;
|
||||
|
||||
ss = R_PointInSubsector(mthing->x << FRACBITS, mthing->y << FRACBITS);
|
||||
mthing->z = (INT16)(((
|
||||
ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, mthing->x << FRACBITS, mthing->y << FRACBITS) :
|
||||
ss->sector->floorheight)>>FRACBITS) + (mthing->options >> ZSHIFT));
|
||||
|
||||
if (numhuntemeralds < MAXHUNTEMERALDS)
|
||||
huntemeralds[numhuntemeralds++] = mthing;
|
||||
return;
|
||||
}
|
||||
|
||||
if (i == MT_EMERALDSPAWN)
|
||||
{
|
||||
@@ -11067,57 +10987,29 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
||||
if ((mobjinfo[i].flags & MF_ENEMY) || (mobjinfo[i].flags & MF_BOSS))
|
||||
return;
|
||||
|
||||
// Set powerup boxes to user settings for competition.
|
||||
if (gametype == GT_COMPETITION)
|
||||
{
|
||||
if ((mobjinfo[i].flags & MF_MONITOR) && cv_competitionboxes.value) // not Normal
|
||||
{
|
||||
if (cv_competitionboxes.value == 1) // Random
|
||||
i = MT_QUESTIONBOX;
|
||||
else if (cv_competitionboxes.value == 2) // Teleports
|
||||
i = MT_MIXUPBOX;
|
||||
else if (cv_competitionboxes.value == 3) // None
|
||||
return; // Don't spawn!
|
||||
}
|
||||
}
|
||||
|
||||
// Set powerup boxes to user settings for other netplay modes
|
||||
else if (gametype != GT_COOP)
|
||||
if ((mobjinfo[i].flags & MF_MONITOR) && cv_matchboxes.value) // not Normal
|
||||
{
|
||||
if ((mobjinfo[i].flags & MF_MONITOR) && cv_matchboxes.value) // not Normal
|
||||
{
|
||||
if (cv_matchboxes.value == 1) // Random
|
||||
i = MT_QUESTIONBOX;
|
||||
else if (cv_matchboxes.value == 3) // Don't spawn
|
||||
return;
|
||||
else // cv_matchboxes.value == 2, Non-Random
|
||||
{
|
||||
if (i == MT_QUESTIONBOX)
|
||||
return; // don't spawn in Non-Random
|
||||
|
||||
mthing->options &= ~(MTF_AMBUSH|MTF_OBJECTSPECIAL); // no random respawning!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (gametype != GT_CTF) // CTF specific things
|
||||
{
|
||||
if (i == MT_BLUETEAMRING || i == MT_REDTEAMRING)
|
||||
i = MT_RING;
|
||||
else if (i == MT_BLUERINGBOX || i == MT_REDRINGBOX)
|
||||
i = MT_SUPERRINGBOX;
|
||||
else if (i == MT_BLUEFLAG || i == MT_REDFLAG)
|
||||
return; // No flags in non-CTF modes!
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((i == MT_BLUEFLAG && blueflag) || (i == MT_REDFLAG && redflag))
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Only one flag per team allowed in CTF!\n"));
|
||||
if (cv_matchboxes.value == 1) // Random
|
||||
i = MT_QUESTIONBOX;
|
||||
else if (cv_matchboxes.value == 3) // Don't spawn
|
||||
return;
|
||||
else // cv_matchboxes.value == 2, Non-Random
|
||||
{
|
||||
if (i == MT_QUESTIONBOX)
|
||||
return; // don't spawn in Non-Random
|
||||
|
||||
mthing->options &= ~(MTF_AMBUSH|MTF_OBJECTSPECIAL); // no random respawning!
|
||||
}
|
||||
}
|
||||
|
||||
if (i == MT_BLUETEAMRING || i == MT_REDTEAMRING)
|
||||
i = MT_RING;
|
||||
else if (i == MT_BLUERINGBOX || i == MT_REDRINGBOX)
|
||||
i = MT_SUPERRINGBOX;
|
||||
else if (i == MT_BLUEFLAG || i == MT_REDFLAG)
|
||||
return; // No flags in non-CTF modes!
|
||||
|
||||
if (!G_RaceGametype() && (i == MT_SIGN || i == MT_STARPOST))
|
||||
return; // Don't spawn exit signs or starposts in wrong game modes
|
||||
|
||||
@@ -11147,7 +11039,7 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
||||
return; // No rings in Ultimate mode (except special stages)
|
||||
}
|
||||
|
||||
if (i == MT_EMMY && (gametype != GT_COOP || ultimatemode || tokenbits == 30 || tokenlist & (1 << tokenbits++)))
|
||||
if (i == MT_EMMY && (ultimatemode || tokenbits == 30 || tokenlist & (1 << tokenbits++)))
|
||||
return; // you already got this token, or there are too many, or the gametype's not right
|
||||
|
||||
// Objectplace landing point
|
||||
@@ -11780,12 +11672,8 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
||||
z = mthing->options << FRACBITS;
|
||||
|
||||
hoopcenter = P_SpawnMobj(x, y, z, MT_HOOPCENTER);
|
||||
|
||||
hoopcenter->spawnpoint = mthing;
|
||||
|
||||
// Screw these damn hoops, I need this thinker.
|
||||
//hoopcenter->flags |= MF_NOTHINK;
|
||||
|
||||
z +=
|
||||
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
|
||||
sec->floorheight;
|
||||
@@ -11831,10 +11719,8 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
||||
|
||||
mobj = P_SpawnMobj(finalx, finaly, finalz, MT_HOOP);
|
||||
|
||||
//if (maptol & TOL_XMAS)
|
||||
//P_SetMobjState(mobj, mobj->info->seestate + (i & 1));
|
||||
|
||||
mobj->z -= mobj->height/2;
|
||||
|
||||
P_SetTarget(&mobj->target, hoopcenter); // Link the sprite to the center.
|
||||
mobj->fuse = 0;
|
||||
|
||||
@@ -11971,9 +11857,6 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
||||
|
||||
mobj = P_SpawnMobj(finalx, finaly, finalz, MT_HOOP);
|
||||
|
||||
//if (maptol & TOL_XMAS)
|
||||
//P_SetMobjState(mobj, mobj->info->seestate + (i & 1));
|
||||
|
||||
mobj->z -= mobj->height/2;
|
||||
P_SetTarget(&mobj->target, hoopcenter); // Link the sprite to the center.
|
||||
mobj->fuse = 0;
|
||||
@@ -12331,25 +12214,6 @@ mobj_t *P_SpawnMissile(mobj_t *source, mobj_t *dest, mobjtype_t type)
|
||||
return dist ? th : NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// P_ColorTeamMissile
|
||||
// Colors a player's ring based on their team
|
||||
//
|
||||
void P_ColorTeamMissile(mobj_t *missile, player_t *source)
|
||||
{
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
if (source->ctfteam == 2)
|
||||
missile->color = skincolor_bluering;
|
||||
else if (source->ctfteam == 1)
|
||||
missile->color = skincolor_redring;
|
||||
}
|
||||
/*
|
||||
else
|
||||
missile->color = player->mo->color; //copy color
|
||||
*/
|
||||
}
|
||||
|
||||
//
|
||||
// P_SPMAngle
|
||||
// Fires missile at angle from what is presumably a player
|
||||
|
||||
@@ -153,6 +153,8 @@ FUNCINLINE static ATTRINLINE void PolyObj_AddThinker(thinker_t *th)
|
||||
th->next = thinkercap.next;
|
||||
th->prev = &thinkercap;
|
||||
thinkercap.next = th;
|
||||
|
||||
th->references = 0;
|
||||
}
|
||||
|
||||
static void FreeSideLists(void)
|
||||
|
||||
+5
-9
@@ -298,7 +298,7 @@ static void P_NetArchivePlayers(boolean resending)
|
||||
//
|
||||
// P_NetUnArchivePlayers
|
||||
//
|
||||
static void P_NetUnArchivePlayers(boolean resending)
|
||||
static void P_NetUnArchivePlayers(boolean reloading)
|
||||
{
|
||||
INT32 i, j;
|
||||
UINT16 flags;
|
||||
@@ -308,8 +308,9 @@ static void P_NetUnArchivePlayers(boolean resending)
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (resending)
|
||||
if (reloading)
|
||||
adminplayers[i] = (INT32)READSINT8(save_p);
|
||||
|
||||
// Do NOT memset player struct to 0
|
||||
// other areas may initialize data elsewhere
|
||||
//memset(&players[i], 0, sizeof (player_t));
|
||||
@@ -320,7 +321,7 @@ static void P_NetUnArchivePlayers(boolean resending)
|
||||
// sending player names, skin and color should not be necessary at all!
|
||||
// (that data is handled in the server config now)
|
||||
|
||||
if (resending)
|
||||
if (reloading)
|
||||
READSTRINGN(save_p, player_names[i], MAXPLAYERNAME);
|
||||
|
||||
players[i].aiming = READANGLE(save_p);
|
||||
@@ -347,7 +348,7 @@ static void P_NetUnArchivePlayers(boolean resending)
|
||||
players[i].flashpal = READUINT16(save_p);
|
||||
players[i].flashcount = READUINT16(save_p);
|
||||
|
||||
if (resending)
|
||||
if (reloading)
|
||||
{
|
||||
players[i].skincolor = READUINT8(save_p);
|
||||
players[i].skin = READINT32(save_p);
|
||||
@@ -2173,11 +2174,6 @@ static void LoadMobjThinker(actionf_p1 thinker)
|
||||
mobj->realyscale = FRACUNIT;
|
||||
mobj->stretchslam = 0;
|
||||
|
||||
mobj->stretchslam = 0;
|
||||
mobj->slamsoundtimer = 0;
|
||||
|
||||
mobj->mirrored = 0;
|
||||
|
||||
// Timer for slam sound effect
|
||||
mobj->slamsoundtimer = 0;
|
||||
|
||||
|
||||
+26
-174
@@ -319,8 +319,6 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
|
||||
mapheaderinfo[num]->saveoverride = SAVE_DEFAULT;
|
||||
mapheaderinfo[num]->levelflags = 0;
|
||||
mapheaderinfo[num]->menuflags = (mainwads ? 0 : LF2_EXISTSHACK); // see p_setup.c - prevents replacing maps in addons with easier versions
|
||||
// TODO grades support for delfile (pfft yeah right)
|
||||
P_DeleteGrades(num);
|
||||
// SRB2Kart
|
||||
//mapheaderinfo[num]->automap = false;
|
||||
mapheaderinfo[num]->mobj_scale = FRACUNIT;
|
||||
@@ -343,103 +341,6 @@ void P_AllocMapHeader(INT16 i)
|
||||
P_ClearSingleMapHeaderInfo(i + 1);
|
||||
}
|
||||
|
||||
/** NiGHTS Grades are a special structure,
|
||||
* we initialize them here.
|
||||
*
|
||||
* \param i Index of header to allocate grades for
|
||||
* \param mare The mare we're adding grades for
|
||||
* \param grades the string from DeHackEd, we work with it ourselves
|
||||
*/
|
||||
void P_AddGradesForMare(INT16 i, UINT8 mare, char *gtext)
|
||||
{
|
||||
INT32 g;
|
||||
char *spos = gtext;
|
||||
|
||||
CONS_Debug(DBG_SETUP, "Map %d Mare %d: ", i+1, (UINT16)mare+1);
|
||||
|
||||
if (mapheaderinfo[i]->numGradedMares < mare+1)
|
||||
{
|
||||
mapheaderinfo[i]->numGradedMares = mare+1;
|
||||
mapheaderinfo[i]->grades = Z_Realloc(mapheaderinfo[i]->grades, sizeof(nightsgrades_t) * mapheaderinfo[i]->numGradedMares, PU_STATIC, NULL);
|
||||
}
|
||||
|
||||
for (g = 0; g < 6; ++g)
|
||||
{
|
||||
// Allow "partial" grading systems
|
||||
if (spos != NULL)
|
||||
{
|
||||
mapheaderinfo[i]->grades[mare].grade[g] = atoi(spos);
|
||||
CONS_Debug(DBG_SETUP, "%u ", atoi(spos));
|
||||
// Grab next comma
|
||||
spos = strchr(spos, ',');
|
||||
if (spos)
|
||||
++spos;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Grade not reachable
|
||||
mapheaderinfo[i]->grades[mare].grade[g] = UINT32_MAX;
|
||||
}
|
||||
}
|
||||
|
||||
CONS_Debug(DBG_SETUP, "\n");
|
||||
}
|
||||
|
||||
/** And this removes the grades safely.
|
||||
*
|
||||
* \param i The header to remove grades from
|
||||
*/
|
||||
void P_DeleteGrades(INT16 i)
|
||||
{
|
||||
if (mapheaderinfo[i]->grades)
|
||||
Z_Free(mapheaderinfo[i]->grades);
|
||||
|
||||
mapheaderinfo[i]->grades = NULL;
|
||||
mapheaderinfo[i]->numGradedMares = 0;
|
||||
}
|
||||
|
||||
/** And this fetches the grades
|
||||
*
|
||||
* \param pscore The player's score.
|
||||
* \param map The game map.
|
||||
* \param mare The mare to test.
|
||||
*/
|
||||
UINT8 P_GetGrade(UINT32 pscore, INT16 map, UINT8 mare)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
// Determining the grade
|
||||
if (mapheaderinfo[map-1] && mapheaderinfo[map-1]->grades && mapheaderinfo[map-1]->numGradedMares >= mare + 1)
|
||||
{
|
||||
INT32 pgrade = 0;
|
||||
for (i = 0; i < 6; ++i)
|
||||
{
|
||||
if (pscore >= mapheaderinfo[map-1]->grades[mare].grade[i])
|
||||
++pgrade;
|
||||
}
|
||||
return (UINT8)pgrade;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINT8 P_HasGrades(INT16 map, UINT8 mare)
|
||||
{
|
||||
// Determining the grade
|
||||
// Mare 0 is treated as overall and is true if ANY grades exist
|
||||
if (mapheaderinfo[map-1] && mapheaderinfo[map-1]->grades
|
||||
&& (mare == 0 || mapheaderinfo[map-1]->numGradedMares >= mare))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
UINT32 P_GetScoreForGrade(INT16 map, UINT8 mare, UINT8 grade)
|
||||
{
|
||||
// Get the score for the grade... if it exists
|
||||
if (grade == GRADE_F || grade > GRADE_S || !P_HasGrades(map, mare)) return 0;
|
||||
|
||||
return mapheaderinfo[map-1]->grades[mare].grade[grade-1];
|
||||
}
|
||||
|
||||
// Loads the vertexes for a level.
|
||||
FUNCINLINE static ATTRINLINE void P_LoadRawVertexes(UINT8 *data)
|
||||
{
|
||||
@@ -1546,16 +1447,23 @@ static void P_CreateBlockMap(void)
|
||||
// First find limits of map
|
||||
for (i = 0; i < numvertexes; i++)
|
||||
{
|
||||
if (vertexes[i].x>>FRACBITS < minx)
|
||||
minx = vertexes[i].x>>FRACBITS;
|
||||
else if (vertexes[i].x>>FRACBITS > maxx)
|
||||
maxx = vertexes[i].x>>FRACBITS;
|
||||
if (vertexes[i].y>>FRACBITS < miny)
|
||||
miny = vertexes[i].y>>FRACBITS;
|
||||
else if (vertexes[i].y>>FRACBITS > maxy)
|
||||
maxy = vertexes[i].y>>FRACBITS;
|
||||
fixed_t t;
|
||||
|
||||
if ((t = vertexes[i].x) < minx)
|
||||
minx = t;
|
||||
else if (t > maxx)
|
||||
maxx = t;
|
||||
if ((t = vertexes[i].y) < miny)
|
||||
miny = t;
|
||||
else if (t > maxy)
|
||||
maxy = t;
|
||||
}
|
||||
|
||||
minx >>= FRACBITS;
|
||||
maxx >>= FRACBITS;
|
||||
miny >>= FRACBITS;
|
||||
maxy >>= FRACBITS;
|
||||
|
||||
// Save blockmap parameters
|
||||
bmaporgx = minx << FRACBITS;
|
||||
bmaporgy = miny << FRACBITS;
|
||||
@@ -2439,7 +2347,6 @@ static void P_SetupCamera(UINT8 pnum, camera_t *cam)
|
||||
switch (gametype)
|
||||
{
|
||||
case GT_MATCH:
|
||||
case GT_TAG:
|
||||
thing = deathmatchstarts[0];
|
||||
break;
|
||||
|
||||
@@ -2470,17 +2377,11 @@ static void P_InitCamera(void)
|
||||
P_SetupCamera(displayplayers[i], &camera[i]);
|
||||
|
||||
// Though, I don't think anyone would care about cam_rotate being reset back to the only value that makes sense :P
|
||||
if (!cv_cam_rotate.changed)
|
||||
CV_Set(&cv_cam_rotate, cv_cam_rotate.defaultvalue);
|
||||
|
||||
if (!cv_cam2_rotate.changed)
|
||||
CV_Set(&cv_cam2_rotate, cv_cam2_rotate.defaultvalue);
|
||||
|
||||
if (!cv_cam3_rotate.changed)
|
||||
CV_Set(&cv_cam3_rotate, cv_cam3_rotate.defaultvalue);
|
||||
|
||||
if (!cv_cam4_rotate.changed)
|
||||
CV_Set(&cv_cam4_rotate, cv_cam4_rotate.defaultvalue);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
if (!cv_cam_rotate[i].changed)
|
||||
CV_Set(&cv_cam_rotate[i], cv_cam_rotate[i].defaultvalue);
|
||||
}
|
||||
|
||||
displayplayers[0] = consoleplayer; // Start with your OWN view, please!
|
||||
}
|
||||
@@ -2611,18 +2512,11 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate)
|
||||
|
||||
if (!dedicated)
|
||||
{
|
||||
if (!cv_chasecam.changed)
|
||||
CV_SetValue(&cv_chasecam, chase);
|
||||
|
||||
// same for second player
|
||||
if (!cv_chasecam2.changed)
|
||||
CV_SetValue(&cv_chasecam2, chase);
|
||||
|
||||
if (!cv_chasecam3.changed)
|
||||
CV_SetValue(&cv_chasecam3, chase);
|
||||
|
||||
if (!cv_chasecam4.changed)
|
||||
CV_SetValue(&cv_chasecam4, chase);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
if (!cv_chasecam[i].changed)
|
||||
CV_SetValue(&cv_chasecam[i], chase);
|
||||
}
|
||||
}
|
||||
|
||||
// Initial height of PointOfView
|
||||
@@ -2866,44 +2760,7 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate)
|
||||
if (modeattacking == ATTACKING_RECORD && !demo.playback)
|
||||
P_LoadRecordGhosts();
|
||||
|
||||
if (G_TagGametype())
|
||||
{
|
||||
INT32 realnumplayers = 0;
|
||||
INT32 playersactive[MAXPLAYERS];
|
||||
|
||||
//I just realized how problematic this code can be.
|
||||
//D_NumPlayers() will not always cover the scope of the netgame.
|
||||
//What if one player is node 0 and the other node 31?
|
||||
//The solution? Make a temp array of all players that are currently playing and pick from them.
|
||||
//Future todo? When a player leaves, shift all nodes down so D_NumPlayers() can be used as intended?
|
||||
//Also, you'd never have to loop through all 32 players slots to find anything ever again.
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i] && !players[i].spectator)
|
||||
{
|
||||
playersactive[realnumplayers] = i; //stores the player's node in the array.
|
||||
realnumplayers++;
|
||||
}
|
||||
}
|
||||
|
||||
if (realnumplayers) //this should also fix the dedicated crash bug. You only pick a player if one exists to be picked.
|
||||
{
|
||||
i = P_RandomKey(realnumplayers);
|
||||
players[playersactive[i]].pflags |= PF_TAGIT; //choose our initial tagger before map starts.
|
||||
|
||||
// Taken and modified from G_DoReborn()
|
||||
// Remove the player so he can respawn elsewhere.
|
||||
// first dissasociate the corpse
|
||||
if (players[playersactive[i]].mo)
|
||||
P_RemoveMobj(players[playersactive[i]].mo);
|
||||
|
||||
G_SpawnPlayer(playersactive[i], false); //respawn the lucky player in his dedicated spawn location.
|
||||
}
|
||||
else
|
||||
CONS_Printf(M_GetText("No player currently available to become IT. Awaiting available players.\n"));
|
||||
|
||||
}
|
||||
else if (G_RaceGametype() && server)
|
||||
if (G_RaceGametype() && server)
|
||||
CV_StealthSetValue(&cv_numlaps,
|
||||
((netgame || multiplayer) && cv_basenumlaps.value
|
||||
&& (!(mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE)
|
||||
@@ -3167,11 +3024,6 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
||||
//
|
||||
S_LoadMusicDefs(wadnum);
|
||||
|
||||
//
|
||||
// edit music defs for stuff like musictest
|
||||
//
|
||||
S_LoadMTDefs(wadnum);
|
||||
|
||||
//
|
||||
// search for maps
|
||||
//
|
||||
|
||||
@@ -97,11 +97,4 @@ void P_UpdateSegLightOffset(seg_t *li);
|
||||
size_t P_PrecacheLevelFlats(void);
|
||||
void P_AllocMapHeader(INT16 i);
|
||||
|
||||
// Needed for NiGHTS
|
||||
void P_DeleteGrades(INT16 i);
|
||||
void P_AddGradesForMare(INT16 i, UINT8 mare, char *gtext);
|
||||
UINT8 P_GetGrade(UINT32 pscore, INT16 map, UINT8 mare);
|
||||
UINT8 P_HasGrades(INT16 map, UINT8 mare);
|
||||
UINT32 P_GetScoreForGrade(INT16 map, UINT8 mare, UINT8 grade);
|
||||
|
||||
#endif
|
||||
+9
-102
@@ -1431,12 +1431,14 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|
||||
}
|
||||
else if (caller)
|
||||
{
|
||||
if (GETSECSPECIAL(caller->special, 2) == 6)
|
||||
INT32 special = GETSECSPECIAL(caller->special, 2);
|
||||
|
||||
if (special == 6)
|
||||
{
|
||||
if (!(ALL7EMERALDS(emeralds)))
|
||||
return false;
|
||||
}
|
||||
else if (GETSECSPECIAL(caller->special, 2) == 7) // SRB2Kart: reusing for Race Lap executor
|
||||
else if (special == 7) // SRB2Kart: reusing for Race Lap executor
|
||||
{
|
||||
UINT8 lap;
|
||||
|
||||
@@ -1470,7 +1472,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|
||||
// If we were not triggered by a sector type especially for the purpose,
|
||||
// a Linedef Executor linedef trigger is not handling sector triggers properly, return.
|
||||
|
||||
else if ((!GETSECSPECIAL(caller->special, 2) || GETSECSPECIAL(caller->special, 2) > 7) && (specialtype > 322))
|
||||
else if ((!special || special > 7) && (specialtype > 322))
|
||||
{
|
||||
CONS_Alert(CONS_WARNING,
|
||||
M_GetText("Linedef executor trigger isn't handling sector triggers properly!\nspecialtype = %d, if you are not a dev, report this warning instance\nalong with the wad that caused it!\n"),
|
||||
@@ -2630,14 +2632,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||
mo->flags2 &= ~MF2_TWOD;
|
||||
else
|
||||
mo->flags2 |= MF2_TWOD;
|
||||
|
||||
// Copy effect to bot if necessary
|
||||
// (Teleport them to you so they don't break it.)
|
||||
if (bot && (bot->flags2 & MF2_TWOD) != (mo->flags2 & MF2_TWOD))
|
||||
{
|
||||
bot->flags2 = (bot->flags2 & ~MF2_TWOD) | (mo->flags2 & MF2_TWOD);
|
||||
P_SetOrigin(bot, mo->x, mo->y, mo->z);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -3401,9 +3395,6 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
|
||||
}
|
||||
|
||||
P_DoPlayerPain(player, NULL, NULL); // this does basically everything that was here before
|
||||
|
||||
if (gametype == GT_CTF && player->gotflag & (GF_REDFLAG|GF_BLUEFLAG))
|
||||
P_PlayerFlagBurst(player, false);
|
||||
break;
|
||||
case 12: // Wall Sector (Don't step-up/down)
|
||||
case 13: // Ramp Sector (Increase step-up/down)
|
||||
@@ -3423,7 +3414,7 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
|
||||
case 3: // Linedef executor requires all players present // Trigger Linedef Exec (Floor Touch, All Players)
|
||||
/// \todo check continues for proper splitscreen support?
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i] && !players[i].bot && players[i].mo && (gametype != GT_COOP || players[i].lives > 0))
|
||||
if (playeringame[i] && !players[i].bot && players[i].mo && players[i].lives > 0)
|
||||
{
|
||||
if (roversector)
|
||||
{
|
||||
@@ -3693,95 +3684,12 @@ DoneSection2:
|
||||
sstimer = 6; // Just let P_Ticker take care of the rest.
|
||||
|
||||
// Exit (for FOF exits; others are handled in P_PlayerThink in p_user.c)
|
||||
{
|
||||
INT32 lineindex;
|
||||
|
||||
P_DoPlayerExit(player);
|
||||
|
||||
P_SetupSignExit(player);
|
||||
// important: use sector->tag on next line instead of player->mo->subsector->tag
|
||||
// this part is different from in P_PlayerThink, this is what was causing
|
||||
// FOF custom exits not to work.
|
||||
lineindex = P_FindSpecialLineFromTag(2, sector->tag, -1);
|
||||
|
||||
if (gametype == GT_COOP && lineindex != -1) // Custom exit!
|
||||
{
|
||||
// Special goodies with the block monsters flag depending on emeralds collected
|
||||
if ((lines[lineindex].flags & ML_BLOCKMONSTERS) && ALL7EMERALDS(emeralds))
|
||||
nextmapoverride = (INT16)(lines[lineindex].frontsector->ceilingheight>>FRACBITS);
|
||||
else
|
||||
nextmapoverride = (INT16)(lines[lineindex].frontsector->floorheight>>FRACBITS);
|
||||
|
||||
if (lines[lineindex].flags & ML_NOCLIMB)
|
||||
skipstats = true;
|
||||
}
|
||||
}
|
||||
P_DoPlayerExit(player);
|
||||
P_SetupSignExit(player);
|
||||
break;
|
||||
|
||||
case 3: // Red Team's Base
|
||||
if (gametype == GT_CTF && P_IsObjectOnGround(player->mo))
|
||||
{
|
||||
if (player->ctfteam == 1 && (player->gotflag & GF_BLUEFLAG))
|
||||
{
|
||||
mobj_t *mo;
|
||||
|
||||
// Make sure the red team still has their own
|
||||
// flag at their base so they can score.
|
||||
if (!P_IsFlagAtBase(MT_REDFLAG))
|
||||
break;
|
||||
|
||||
HU_SetCEchoFlags(0);
|
||||
HU_SetCEchoDuration(5);
|
||||
HU_DoCEcho(va(M_GetText("%s\\captured the blue flag.\\\\\\\\"), player_names[player-players]));
|
||||
|
||||
if (splitscreen || players[consoleplayer].ctfteam == 1)
|
||||
S_StartSound(NULL, sfx_flgcap);
|
||||
else if (players[consoleplayer].ctfteam == 2)
|
||||
S_StartSound(NULL, sfx_lose);
|
||||
|
||||
mo = P_SpawnMobj(player->mo->x,player->mo->y,player->mo->z,MT_BLUEFLAG);
|
||||
player->gotflag &= ~GF_BLUEFLAG;
|
||||
mo->flags &= ~MF_SPECIAL;
|
||||
mo->fuse = TICRATE;
|
||||
mo->spawnpoint = bflagpoint;
|
||||
mo->flags2 |= MF2_JUSTATTACKED;
|
||||
redscore += 1;
|
||||
P_AddPlayerScore(player, 5);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 4: // Blue Team's Base
|
||||
if (gametype == GT_CTF && P_IsObjectOnGround(player->mo))
|
||||
{
|
||||
if (player->ctfteam == 2 && (player->gotflag & GF_REDFLAG))
|
||||
{
|
||||
mobj_t *mo;
|
||||
|
||||
// Make sure the blue team still has their own
|
||||
// flag at their base so they can score.
|
||||
if (!P_IsFlagAtBase(MT_BLUEFLAG))
|
||||
break;
|
||||
|
||||
HU_SetCEchoFlags(0);
|
||||
HU_SetCEchoDuration(5);
|
||||
HU_DoCEcho(va(M_GetText("%s\\captured the red flag.\\\\\\\\"), player_names[player-players]));
|
||||
|
||||
if (splitscreen || players[consoleplayer].ctfteam == 2)
|
||||
S_StartSound(NULL, sfx_flgcap);
|
||||
else if (players[consoleplayer].ctfteam == 1)
|
||||
S_StartSound(NULL, sfx_lose);
|
||||
|
||||
mo = P_SpawnMobj(player->mo->x,player->mo->y,player->mo->z,MT_REDFLAG);
|
||||
player->gotflag &= ~GF_REDFLAG;
|
||||
mo->flags &= ~MF_SPECIAL;
|
||||
mo->fuse = TICRATE;
|
||||
mo->spawnpoint = rflagpoint;
|
||||
mo->flags2 |= MF2_JUSTATTACKED;
|
||||
bluescore += 1;
|
||||
P_AddPlayerScore(player, 5);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 5: // Fan sector
|
||||
@@ -6081,8 +5989,7 @@ void P_SpawnSpecials(INT32 fromnetsave, boolean reloadinggamestate)
|
||||
// Linedef executor triggers for CTF teams.
|
||||
case 309:
|
||||
case 311:
|
||||
if (gametype != GT_CTF)
|
||||
lines[i].special = 0;
|
||||
lines[i].special = 0;
|
||||
break;
|
||||
|
||||
// Each time executors
|
||||
|
||||
+11
-9
@@ -327,7 +327,7 @@ static inline void P_RunThinkers(void)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void P_DeviceRumbleTick(void)
|
||||
static void P_DeviceRumbleTick(void)
|
||||
{
|
||||
UINT8 i;
|
||||
|
||||
@@ -345,7 +345,7 @@ static inline void P_DeviceRumbleTick(void)
|
||||
if (!P_IsLocalPlayer(player))
|
||||
continue;
|
||||
|
||||
if (G_GetDeviceForPlayer(i) == 0)
|
||||
if (cv_usejoystick[i].value == 0)
|
||||
continue;
|
||||
|
||||
if (!playeringame[displayplayers[i]] || player->spectator)
|
||||
@@ -397,7 +397,7 @@ void P_RunChaseCameras(void)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void P_RunQuakes(void)
|
||||
static void P_RunQuakes(void)
|
||||
{
|
||||
fixed_t ir;
|
||||
|
||||
@@ -434,7 +434,7 @@ void P_Ticker(boolean run)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
// Increment jointime and quittime even if paused
|
||||
// Increment jointime even if paused
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i])
|
||||
@@ -641,7 +641,7 @@ void P_Ticker(boolean run)
|
||||
G_WriteAllGhostTics();
|
||||
|
||||
if (cv_recordmultiplayerdemos.value && (demo.savemode == DSM_NOTSAVING || demo.savemode == DSM_WILLAUTOSAVE))
|
||||
if (demo.savebutton && demo.savebutton + 3*TICRATE < leveltime && (InputDown(gc_lookback, 1) || (cv_usejoystick.value && axis > 0)))
|
||||
if (demo.savebutton && demo.savebutton + 3*TICRATE < leveltime && (InputDown(gc_lookback, 1) || (cv_usejoystick[0].value && axis > 0)))
|
||||
demo.savemode = DSM_TITLEENTRY;
|
||||
|
||||
//if there are no players left at all, stop demo recording
|
||||
@@ -689,16 +689,18 @@ void P_Ticker(boolean run)
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
player_t *player = &players[displayplayers[i]];
|
||||
boolean isSkyVisibleForPlayer = skyVisiblePerPlayer[i];
|
||||
|
||||
if (!player->mo)
|
||||
continue;
|
||||
|
||||
if (isSkyVisibleForPlayer && skyboxmo[0] && cv_skybox.value)
|
||||
const boolean skybox = (skyboxmo[0] && cv_skybox.value);
|
||||
boolean isSkyVisibleForPlayer = skyVisiblePerPlayer[i];
|
||||
|
||||
if (isSkyVisibleForPlayer && skybox)
|
||||
{
|
||||
R_SkyboxFrame(player);
|
||||
R_SkyboxFrame(i);
|
||||
}
|
||||
R_SetupFrame(player, (skyboxmo[0] && cv_skybox.value));
|
||||
R_SetupFrame(i, skybox);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+122
-395
@@ -76,9 +76,7 @@ void P_Thrust(mobj_t *mo, angle_t angle, fixed_t move)
|
||||
angle >>= ANGLETOFINESHIFT;
|
||||
|
||||
mo->momx += FixedMul(move, FINECOSINE(angle));
|
||||
|
||||
if (!(twodlevel || (mo->flags2 & MF2_TWOD)))
|
||||
mo->momy += FixedMul(move, FINESINE(angle));
|
||||
mo->momy += FixedMul(move, FINESINE(angle));
|
||||
}
|
||||
|
||||
|
||||
@@ -93,9 +91,7 @@ void P_InstaThrust(mobj_t *mo, angle_t angle, fixed_t move)
|
||||
angle >>= ANGLETOFINESHIFT;
|
||||
|
||||
mo->momx = FixedMul(move, FINECOSINE(angle));
|
||||
|
||||
if (!(twodlevel || (mo->flags2 & MF2_TWOD)))
|
||||
mo->momy = FixedMul(move,FINESINE(angle));
|
||||
mo->momy = FixedMul(move,FINESINE(angle));
|
||||
}
|
||||
|
||||
void P_InstaThrustEvenIn2D(mobj_t *mo, angle_t angle, fixed_t move)
|
||||
@@ -427,8 +423,6 @@ void P_ResetPlayer(player_t *player)
|
||||
player->powers[pw_tailsfly] = 0;
|
||||
player->onconveyor = 0;
|
||||
player->skidtime = 0;
|
||||
/*if (player-players == consoleplayer && botingame)
|
||||
CV_SetValue(&cv_analog2, true);*/
|
||||
}
|
||||
|
||||
//
|
||||
@@ -457,24 +451,6 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings)
|
||||
player->health = 1;
|
||||
}
|
||||
//}
|
||||
|
||||
// Now extra life bonuses are handled here instead of in P_MovePlayer, since why not?
|
||||
if (!ultimatemode && !modeattacking && !G_IsSpecialStage(gamemap) && G_GametypeUsesLives())
|
||||
{
|
||||
INT32 gainlives = 0;
|
||||
|
||||
while (player->xtralife < maxXtraLife && player->health > 100 * (player->xtralife+1))
|
||||
{
|
||||
++gainlives;
|
||||
++player->xtralife;
|
||||
}
|
||||
|
||||
if (gainlives)
|
||||
{
|
||||
P_GivePlayerLives(player, gainlives);
|
||||
P_PlayLivesJingle(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -508,8 +484,6 @@ void P_DoSuperTransformation(player_t *player, boolean giverings)
|
||||
// Adds to the player's score
|
||||
void P_AddPlayerScore(player_t *player, UINT32 amount)
|
||||
{
|
||||
//UINT32 oldscore;
|
||||
|
||||
if (!(G_BattleGametype()))
|
||||
return;
|
||||
|
||||
@@ -519,22 +493,11 @@ void P_AddPlayerScore(player_t *player, UINT32 amount)
|
||||
if (player->exiting) // srb2kart
|
||||
return;
|
||||
|
||||
//oldscore = player->score;
|
||||
|
||||
// Don't go above MAXSCORE.
|
||||
if (player->marescore + amount < MAXSCORE)
|
||||
player->marescore += amount;
|
||||
else
|
||||
player->marescore = MAXSCORE;
|
||||
|
||||
// In team match, all awarded points are incremented to the team's running score.
|
||||
if (gametype == GT_TEAMMATCH)
|
||||
{
|
||||
if (player->ctfteam == 1)
|
||||
redscore += amount;
|
||||
else if (player->ctfteam == 2)
|
||||
bluescore += amount;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -547,8 +510,6 @@ void P_PlayLivesJingle(player_t *player)
|
||||
|
||||
if (use1upSound)
|
||||
S_StartSound(NULL, sfx_oneup);
|
||||
else if (mariomode)
|
||||
S_StartSound(NULL, sfx_marioa);
|
||||
else
|
||||
{
|
||||
if (player)
|
||||
@@ -580,7 +541,7 @@ void P_PlayRinglossSound(mobj_t *source, mobj_t *damager)
|
||||
S_StartSound(NULL, sfx);
|
||||
}
|
||||
else
|
||||
S_StartSound(source, (mariomode) ? sfx_mario8 : sfx_khurt1 + key);
|
||||
S_StartSound(source, sfx_khurt1 + key);
|
||||
}
|
||||
else
|
||||
S_StartSound(source, sfx_slip);
|
||||
@@ -1754,58 +1715,6 @@ static void P_DoBubbleBreath(player_t *player)
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// P_DoPlayerHeadSigns
|
||||
//
|
||||
// Spawns "IT" and "GOT FLAG" signs for Tag and CTF respectively
|
||||
//
|
||||
static void P_DoPlayerHeadSigns(player_t *player)
|
||||
{
|
||||
if (G_TagGametype())
|
||||
{
|
||||
// If you're "IT", show a big "IT" over your head for others to see.
|
||||
if (player->pflags & PF_TAGIT)
|
||||
{
|
||||
if (!P_IsDisplayPlayer(player)) // Don't display it on your own view.
|
||||
{
|
||||
if (!(player->mo->eflags & MFE_VERTICALFLIP))
|
||||
P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height, MT_TAG);
|
||||
else
|
||||
P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z - mobjinfo[MT_TAG].height, MT_TAG)->eflags |= MFE_VERTICALFLIP;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (gametype == GT_CTF)
|
||||
{
|
||||
if (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)) // If you have the flag (duh).
|
||||
{
|
||||
// Spawn a got-flag message over the head of the player that
|
||||
// has it (but not on your own screen if you have the flag).
|
||||
if (splitscreen || player != &players[consoleplayer])
|
||||
{
|
||||
if (player->gotflag & GF_REDFLAG)
|
||||
{
|
||||
if (!(player->mo->eflags & MFE_VERTICALFLIP))
|
||||
P_SpawnMobj(player->mo->x+player->mo->momx, player->mo->y+player->mo->momy,
|
||||
player->mo->z+P_GetPlayerHeight(player)+FixedMul(16*FRACUNIT, player->mo->scale)+player->mo->momz, MT_GOTFLAG);
|
||||
else
|
||||
P_SpawnMobj(player->mo->x+player->mo->momx, player->mo->y+player->mo->momy,
|
||||
player->mo->z+player->mo->height-P_GetPlayerHeight(player)-mobjinfo[MT_GOTFLAG].height-FixedMul(16*FRACUNIT, player->mo->scale)+player->mo->momz, MT_GOTFLAG)->eflags |= MFE_VERTICALFLIP;
|
||||
}
|
||||
if (player->gotflag & GF_BLUEFLAG)
|
||||
{
|
||||
if (!(player->mo->eflags & MFE_VERTICALFLIP))
|
||||
P_SpawnMobj(player->mo->x+player->mo->momx, player->mo->y+player->mo->momy,
|
||||
player->mo->z+P_GetPlayerHeight(player)+FixedMul(16*FRACUNIT, player->mo->scale)+player->mo->momz, MT_GOTFLAG2);
|
||||
else
|
||||
P_SpawnMobj(player->mo->x+player->mo->momx, player->mo->y+player->mo->momy,
|
||||
player->mo->z+player->mo->height-P_GetPlayerHeight(player)-mobjinfo[MT_GOTFLAG2].height-FixedMul(16*FRACUNIT, player->mo->scale)+player->mo->momz, MT_GOTFLAG2)->eflags |= MFE_VERTICALFLIP;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// P_DoJumpShield
|
||||
//
|
||||
@@ -2240,38 +2149,6 @@ static void P_MovePlayer(player_t *player)
|
||||
}
|
||||
// note: don't unset stasis here
|
||||
|
||||
if (!player->spectator && G_TagGametype())
|
||||
{
|
||||
// If we have stasis already here, it's because it's forced on us
|
||||
// by a linedef executor or what have you
|
||||
boolean forcestasis = false;
|
||||
|
||||
//During hide time, taggers cannot move.
|
||||
if (leveltime < hidetime * TICRATE)
|
||||
{
|
||||
if (player->pflags & PF_TAGIT)
|
||||
forcestasis = true;
|
||||
}
|
||||
else if (gametype == GT_HIDEANDSEEK)
|
||||
{
|
||||
if (!(player->pflags & PF_TAGIT))
|
||||
{
|
||||
forcestasis = true;
|
||||
if (player->pflags & PF_TAGGED) // Already hit.
|
||||
player->powers[pw_flashing] = 5;
|
||||
}
|
||||
}
|
||||
|
||||
if (forcestasis)
|
||||
{
|
||||
player->pflags |= PF_FULLSTASIS;
|
||||
// If you're in stasis in tag, you don't drown.
|
||||
/*if (player->powers[pw_underwater] <= 12*TICRATE + 1)
|
||||
P_RestoreMusic(player);*/
|
||||
player->powers[pw_underwater] = player->powers[pw_spacetime] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (player->spectator)
|
||||
{
|
||||
P_SpectatorMovement(player);
|
||||
@@ -2338,11 +2215,6 @@ static void P_MovePlayer(player_t *player)
|
||||
P_3dMovement(player);
|
||||
}
|
||||
|
||||
if (maptol & TOL_2D)
|
||||
runspd = FixedMul(runspd, 2*FRACUNIT/3);
|
||||
|
||||
//P_SkidStuff(player);
|
||||
|
||||
/////////////////////////
|
||||
// MOVEMENT ANIMATIONS //
|
||||
/////////////////////////
|
||||
@@ -2776,10 +2648,6 @@ boolean P_LookForEnemies(player_t *player)
|
||||
player->mo->z-mo->z) > FixedMul(RING_DIST, player->mo->scale))
|
||||
continue; // out of range
|
||||
|
||||
if ((twodlevel || player->mo->flags2 & MF2_TWOD)
|
||||
&& abs(player->mo->y-mo->y) > player->mo->radius)
|
||||
continue; // not in your 2d plane
|
||||
|
||||
if (mo->type == MT_PLAYER) // Don't chase after other players!
|
||||
continue;
|
||||
|
||||
@@ -2976,34 +2844,34 @@ camera_t camera[MAXSPLITSCREENPLAYERS]; // Four cameras, three for splitscreen
|
||||
|
||||
static void CV_CamRotate_OnChange(void)
|
||||
{
|
||||
if (cv_cam_rotate.value < 0)
|
||||
CV_SetValue(&cv_cam_rotate, cv_cam_rotate.value + 360);
|
||||
else if (cv_cam_rotate.value > 359)
|
||||
CV_SetValue(&cv_cam_rotate, cv_cam_rotate.value % 360);
|
||||
if (cv_cam_rotate[0].value < 0)
|
||||
CV_SetValue(&cv_cam_rotate[0], cv_cam_rotate[0].value + 360);
|
||||
else if (cv_cam_rotate[0].value > 359)
|
||||
CV_SetValue(&cv_cam_rotate[0], cv_cam_rotate[0].value % 360);
|
||||
}
|
||||
|
||||
static void CV_CamRotate2_OnChange(void)
|
||||
{
|
||||
if (cv_cam2_rotate.value < 0)
|
||||
CV_SetValue(&cv_cam2_rotate, cv_cam2_rotate.value + 360);
|
||||
else if (cv_cam2_rotate.value > 359)
|
||||
CV_SetValue(&cv_cam2_rotate, cv_cam2_rotate.value % 360);
|
||||
if (cv_cam_rotate[1].value < 0)
|
||||
CV_SetValue(&cv_cam_rotate[1], cv_cam_rotate[1].value + 360);
|
||||
else if (cv_cam_rotate[1].value > 359)
|
||||
CV_SetValue(&cv_cam_rotate[1], cv_cam_rotate[1].value % 360);
|
||||
}
|
||||
|
||||
static void CV_CamRotate3_OnChange(void)
|
||||
{
|
||||
if (cv_cam3_rotate.value < 0)
|
||||
CV_SetValue(&cv_cam3_rotate, cv_cam3_rotate.value + 360);
|
||||
else if (cv_cam3_rotate.value > 359)
|
||||
CV_SetValue(&cv_cam3_rotate, cv_cam3_rotate.value % 360);
|
||||
if (cv_cam_rotate[2].value < 0)
|
||||
CV_SetValue(&cv_cam_rotate[2], cv_cam_rotate[2].value + 360);
|
||||
else if (cv_cam_rotate[2].value > 359)
|
||||
CV_SetValue(&cv_cam_rotate[2], cv_cam_rotate[2].value % 360);
|
||||
}
|
||||
|
||||
static void CV_CamRotate4_OnChange(void)
|
||||
{
|
||||
if (cv_cam4_rotate.value < 0)
|
||||
CV_SetValue(&cv_cam4_rotate, cv_cam4_rotate.value + 360);
|
||||
else if (cv_cam4_rotate.value > 359)
|
||||
CV_SetValue(&cv_cam4_rotate, cv_cam4_rotate.value % 360);
|
||||
if (cv_cam_rotate[3].value < 0)
|
||||
CV_SetValue(&cv_cam_rotate[3], cv_cam_rotate[3].value + 360);
|
||||
else if (cv_cam_rotate[3].value > 359)
|
||||
CV_SetValue(&cv_cam_rotate[3], cv_cam_rotate[3].value % 360);
|
||||
}
|
||||
|
||||
static CV_PossibleValue_t CV_CamSpeed[] = {{0, "MIN"}, {1*FRACUNIT, "MAX"}, {0, NULL}};
|
||||
@@ -3074,33 +2942,47 @@ static void CV_PlayerCam4_OnChange(void)
|
||||
P_ResetCamera(&players[displayplayers[3]], &camera[3]);
|
||||
}
|
||||
|
||||
consvar_t cv_cam_dist = {"cam_dist", "160", CV_FLOAT|CV_SAVE|CV_CALL|CV_NOINIT, NULL, CV_PlayerCam1_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam_height = {"cam_height", "50", CV_FLOAT|CV_SAVE|CV_CALL|CV_NOINIT, NULL, CV_PlayerCam1_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam_still = {"cam_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam_speed = {"cam_speed", "0.4", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam_rotate = {"cam_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam_rotspeed = {"cam_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam_dist[MAXSPLITSCREENPLAYERS] = {
|
||||
{"cam_dist", "160", CV_FLOAT|CV_SAVE|CV_CALL|CV_NOINIT, NULL, CV_PlayerCam1_OnChange, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"cam2_dist", "160", CV_FLOAT|CV_SAVE|CV_CALL|CV_NOINIT, NULL, CV_PlayerCam2_OnChange, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"cam3_dist", "160", CV_FLOAT|CV_SAVE|CV_CALL|CV_NOINIT, NULL, CV_PlayerCam3_OnChange, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"cam4_dist", "160", CV_FLOAT|CV_SAVE|CV_CALL|CV_NOINIT, NULL, CV_PlayerCam4_OnChange, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_cam2_dist = {"cam2_dist", "160", CV_FLOAT|CV_SAVE|CV_CALL|CV_NOINIT, NULL, CV_PlayerCam2_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam2_height = {"cam2_height", "50", CV_FLOAT|CV_SAVE|CV_CALL|CV_NOINIT, NULL, CV_PlayerCam2_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam2_still = {"cam2_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam2_speed = {"cam2_speed", "0.4", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam2_rotate = {"cam2_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate2_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam2_rotspeed = {"cam2_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam_height[MAXSPLITSCREENPLAYERS] = {
|
||||
{"cam_height", "50", CV_FLOAT|CV_SAVE|CV_CALL|CV_NOINIT, NULL, CV_PlayerCam1_OnChange, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"cam2_height", "50", CV_FLOAT|CV_SAVE|CV_CALL|CV_NOINIT, NULL, CV_PlayerCam2_OnChange, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"cam3_height", "50", CV_FLOAT|CV_SAVE|CV_CALL|CV_NOINIT, NULL, CV_PlayerCam3_OnChange, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"cam4_height", "50", CV_FLOAT|CV_SAVE|CV_CALL|CV_NOINIT, NULL, CV_PlayerCam4_OnChange, 0, NULL, NULL, 0, 0, NULL},
|
||||
};
|
||||
|
||||
consvar_t cv_cam3_dist = {"cam3_dist", "160", CV_FLOAT|CV_SAVE|CV_CALL|CV_NOINIT, NULL, CV_PlayerCam3_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam3_height = {"cam3_height", "50", CV_FLOAT|CV_SAVE|CV_CALL|CV_NOINIT, NULL, CV_PlayerCam3_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam3_still = {"cam3_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam3_speed = {"cam3_speed", "0.4", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam3_rotate = {"cam3_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate3_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam3_rotspeed = {"cam3_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam_still[MAXSPLITSCREENPLAYERS] = {
|
||||
{"cam_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"cam2_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"cam3_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"cam4_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_cam4_dist = {"cam4_dist", "160", CV_FLOAT|CV_SAVE|CV_CALL|CV_NOINIT, NULL, CV_PlayerCam4_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam4_height = {"cam4_height", "50", CV_FLOAT|CV_SAVE|CV_CALL|CV_NOINIT, NULL, CV_PlayerCam4_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam4_still = {"cam4_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam4_speed = {"cam4_speed", "0.4", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam4_rotate = {"cam4_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate4_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam4_rotspeed = {"cam4_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam_speed[MAXSPLITSCREENPLAYERS] = {
|
||||
{"cam_speed", "0.4", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"cam2_speed", "0.4", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"cam3_speed", "0.4", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"cam4_speed", "0.4", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_cam_rotate[MAXSPLITSCREENPLAYERS] = {
|
||||
{"cam_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate_OnChange, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"cam2_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate2_OnChange, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"cam3_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate3_OnChange, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"cam4_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate4_OnChange, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_cam_rotspeed[MAXSPLITSCREENPLAYERS] = {
|
||||
{"cam_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"cam2_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"cam3_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"cam4_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_tilting = {"tilting", "Off", CV_SAVE|CV_CALL, CV_OnOff, Bird_menu_Onchange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_quaketilt = {"quaketilt", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -3111,18 +2993,7 @@ consvar_t cv_actionmovie = {"actionmovie", "Off", CV_SAVE, CV_OnOff, NULL, 0, NU
|
||||
static CV_PossibleValue_t lookbackmom_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Double"}, {0, NULL}};
|
||||
consvar_t cv_lookbackmom = {"cameralookbackmom", "Off", CV_SAVE, lookbackmom_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
fixed_t t_cam_dist = -42;
|
||||
fixed_t t_cam_height = -42;
|
||||
fixed_t t_cam_rotate = -42;
|
||||
fixed_t t_cam2_dist = -42;
|
||||
fixed_t t_cam2_height = -42;
|
||||
fixed_t t_cam2_rotate = -42;
|
||||
fixed_t t_cam3_dist = -42;
|
||||
fixed_t t_cam3_height = -42;
|
||||
fixed_t t_cam3_rotate = -42;
|
||||
fixed_t t_cam4_dist = -42;
|
||||
fixed_t t_cam4_height = -42;
|
||||
fixed_t t_cam4_rotate = -42;
|
||||
fixed_t t_cam_rotate[MAXSPLITSCREENPLAYERS] = {-42, -42, -42, -42};
|
||||
|
||||
#define MAXCAMERADIST 140*FRACUNIT // Max distance the camera can be in front of the player (2D mode)
|
||||
|
||||
@@ -3174,7 +3045,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam)
|
||||
|
||||
mouseaiming = true;
|
||||
invertmouse = cv_invertmouse.value;
|
||||
lookaxis = cv_lookaxis.value;
|
||||
lookaxis = cv_lookaxis[0].value;
|
||||
|
||||
usejoystick = true;
|
||||
turnright = InputDown(gc_turnright, 1);
|
||||
@@ -3388,14 +3259,8 @@ void P_ResetCamera(player_t *player, camera_t *thiscam)
|
||||
thiscam->z = z;
|
||||
thiscam->reset = true;
|
||||
|
||||
if (!(thiscam == &camera[0] && (cv_cam_still.value || cv_analog.value))
|
||||
&& !(thiscam == &camera[1] && (cv_cam2_still.value || cv_analog2.value))
|
||||
&& !(thiscam == &camera[2] && (cv_cam3_still.value || cv_analog3.value))
|
||||
&& !(thiscam == &camera[3] && (cv_cam4_still.value || cv_analog4.value)))
|
||||
{
|
||||
thiscam->angle = player->mo->angle;
|
||||
thiscam->aiming = 0;
|
||||
}
|
||||
thiscam->angle = player->mo->angle;
|
||||
thiscam->aiming = 0;
|
||||
thiscam->relativex = 0;
|
||||
|
||||
thiscam->subsector = R_PointInSubsectorFast(thiscam->x,thiscam->y);
|
||||
@@ -3410,7 +3275,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||
{
|
||||
static boolean lookbackactive[MAXSPLITSCREENPLAYERS];
|
||||
static UINT8 lookbackdelay[MAXSPLITSCREENPLAYERS];
|
||||
UINT8 num;
|
||||
UINT8 num, plyrnum;
|
||||
angle_t angle = 0, focusangle = 0, focusaiming = 0;
|
||||
fixed_t x, y, z, dist, viewpointx, viewpointy, camspeed, camdist, camheight, pviewheight;
|
||||
fixed_t pan, xpan, ypan;
|
||||
@@ -3440,6 +3305,44 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||
return true;
|
||||
}
|
||||
|
||||
if (thiscam == &camera[1]) // Camera 2
|
||||
{
|
||||
num = 1;
|
||||
}
|
||||
else if (thiscam == &camera[2]) // Camera 3
|
||||
{
|
||||
num = 2;
|
||||
}
|
||||
else if (thiscam == &camera[3]) // Camera 4
|
||||
{
|
||||
num = 3;
|
||||
}
|
||||
else // Camera 1
|
||||
{
|
||||
num = 0;
|
||||
}
|
||||
|
||||
if (player == &players[consoleplayer])
|
||||
{
|
||||
plyrnum = 0;
|
||||
}
|
||||
else if (player == &players[displayplayers[1]])
|
||||
{
|
||||
plyrnum = 1;
|
||||
}
|
||||
else if (player == &players[displayplayers[2]])
|
||||
{
|
||||
plyrnum = 2;
|
||||
}
|
||||
else if (player == &players[displayplayers[3]])
|
||||
{
|
||||
plyrnum = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
plyrnum = 255;
|
||||
}
|
||||
|
||||
mo = player->mo;
|
||||
|
||||
#ifndef NOCLIPCAM
|
||||
@@ -3458,42 +3361,22 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||
if (player->spectator) // force cam off for spectators
|
||||
return true;
|
||||
|
||||
if (!cv_chasecam.value && thiscam == &camera[0])
|
||||
return true;
|
||||
|
||||
if (!cv_chasecam2.value && thiscam == &camera[1])
|
||||
return true;
|
||||
|
||||
if (!cv_chasecam3.value && thiscam == &camera[2])
|
||||
return true;
|
||||
|
||||
if (!cv_chasecam4.value && thiscam == &camera[3])
|
||||
if (!cv_chasecam[num].value && thiscam == &camera[num])
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!thiscam->chase && !resetcalled)
|
||||
{
|
||||
if (player == &players[consoleplayer])
|
||||
focusangle = localangle[0];
|
||||
else if (player == &players[displayplayers[1]])
|
||||
focusangle = localangle[1];
|
||||
else if (player == &players[displayplayers[2]])
|
||||
focusangle = localangle[2];
|
||||
else if (player == &players[displayplayers[3]])
|
||||
focusangle = localangle[3];
|
||||
if (plyrnum != 255)
|
||||
{
|
||||
focusangle = localangle[plyrnum];
|
||||
}
|
||||
else
|
||||
{
|
||||
focusangle = mo->angle;
|
||||
}
|
||||
|
||||
if (thiscam == &camera[0])
|
||||
camrotate = cv_cam_rotate.value;
|
||||
else if (thiscam == &camera[1])
|
||||
camrotate = cv_cam2_rotate.value;
|
||||
else if (thiscam == &camera[2])
|
||||
camrotate = cv_cam3_rotate.value;
|
||||
else if (thiscam == &camera[3])
|
||||
camrotate = cv_cam4_rotate.value;
|
||||
else
|
||||
camrotate = 0;
|
||||
camrotate = cv_cam_rotate[num].value;
|
||||
|
||||
if (leveltime < introtime) // Whoooshy camera!
|
||||
{
|
||||
@@ -3509,35 +3392,15 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||
thiscam->radius = 20*mapobjectscale;
|
||||
thiscam->height = 16*mapobjectscale;
|
||||
|
||||
// Don't run while respawning from a starpost
|
||||
// Inu 4/8/13 Why not?!
|
||||
// if (leveltime > 0 && timeinmap <= 0)
|
||||
// return true;
|
||||
|
||||
if (demo.playback)
|
||||
{
|
||||
focusangle = mo->angle;
|
||||
focusaiming = 0;
|
||||
}
|
||||
else if (player == &players[consoleplayer])
|
||||
else if (plyrnum != 255)
|
||||
{
|
||||
focusangle = localangle[0];
|
||||
focusaiming = localaiming[0];
|
||||
}
|
||||
else if (player == &players[displayplayers[1]])
|
||||
{
|
||||
focusangle = localangle[1];
|
||||
focusaiming = localaiming[1];
|
||||
}
|
||||
else if (player == &players[displayplayers[2]])
|
||||
{
|
||||
focusangle = localangle[2];
|
||||
focusaiming = localaiming[2];
|
||||
}
|
||||
else if (player == &players[displayplayers[3]])
|
||||
{
|
||||
focusangle = localangle[3];
|
||||
focusaiming = localaiming[3];
|
||||
focusangle = localangle[plyrnum];
|
||||
focusaiming = localaiming[plyrnum];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3548,46 +3411,12 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||
if (P_CameraThinker(player, thiscam, resetcalled))
|
||||
return true;
|
||||
|
||||
if (thiscam == &camera[1]) // Camera 2
|
||||
{
|
||||
num = 1;
|
||||
camspeed = cv_cam2_speed.value;
|
||||
camstill = cv_cam2_still.value;
|
||||
camrotate = cv_cam2_rotate.value;
|
||||
camdist = FixedMul(cv_cam2_dist.value, mapobjectscale);
|
||||
camheight = FixedMul(cv_cam2_height.value, mapobjectscale);
|
||||
lookback = camspin[1];
|
||||
}
|
||||
else if (thiscam == &camera[2]) // Camera 3
|
||||
{
|
||||
num = 2;
|
||||
camspeed = cv_cam3_speed.value;
|
||||
camstill = cv_cam3_still.value;
|
||||
camrotate = cv_cam3_rotate.value;
|
||||
camdist = FixedMul(cv_cam3_dist.value, mapobjectscale);
|
||||
camheight = FixedMul(cv_cam3_height.value, mapobjectscale);
|
||||
lookback = camspin[2];
|
||||
}
|
||||
else if (thiscam == &camera[3]) // Camera 4
|
||||
{
|
||||
num = 3;
|
||||
camspeed = cv_cam4_speed.value;
|
||||
camstill = cv_cam4_still.value;
|
||||
camrotate = cv_cam4_rotate.value;
|
||||
camdist = FixedMul(cv_cam4_dist.value, mapobjectscale);
|
||||
camheight = FixedMul(cv_cam4_height.value, mapobjectscale);
|
||||
lookback = camspin[3];
|
||||
}
|
||||
else // Camera 1
|
||||
{
|
||||
num = 0;
|
||||
camspeed = cv_cam_speed.value;
|
||||
camstill = cv_cam_still.value;
|
||||
camrotate = cv_cam_rotate.value;
|
||||
camdist = FixedMul(cv_cam_dist.value, mapobjectscale);
|
||||
camheight = FixedMul(cv_cam_height.value, mapobjectscale);
|
||||
lookback = camspin[0];
|
||||
}
|
||||
camspeed = cv_cam_speed[num].value;
|
||||
camstill = cv_cam_still[num].value;
|
||||
camrotate = cv_cam_rotate[num].value;
|
||||
camdist = FixedMul(cv_cam_dist[num].value, mapobjectscale);
|
||||
camheight = FixedMul(cv_cam_height[num].value, mapobjectscale);
|
||||
lookback = camspin[num];
|
||||
|
||||
if (timeover)
|
||||
{
|
||||
@@ -3651,10 +3480,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||
}
|
||||
|
||||
if (!resetcalled && (leveltime > starttime && timeover != 2)
|
||||
&& ((thiscam == &camera[0] && t_cam_rotate != -42)
|
||||
|| (thiscam == &camera[1] && t_cam2_rotate != -42)
|
||||
|| (thiscam == &camera[2] && t_cam3_rotate != -42)
|
||||
|| (thiscam == &camera[3] && t_cam4_rotate != -42)))
|
||||
&& (t_cam_rotate[num] != -42))
|
||||
{
|
||||
angle = FixedAngle(camrotate*FRACUNIT);
|
||||
thiscam->angle = angle;
|
||||
@@ -3954,7 +3780,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||
if (player->playerstate != PST_DEAD && !((player->pflags & PF_NIGHTSMODE) && player->exiting))
|
||||
angle += (focusaiming < ANGLE_180 ? focusaiming/2 : InvAngle(InvAngle(focusaiming)/2)); // overcomplicated version of '((signed)focusaiming)/2;'
|
||||
|
||||
if (twodlevel || (mo->flags2 & MF2_TWOD) || (!camstill && !timeover)) // Keep the view still...
|
||||
if (!camstill && !timeover) // Keep the view still...
|
||||
{
|
||||
G_ClipAimingPitch((INT32 *)&angle);
|
||||
|
||||
@@ -4019,65 +3845,8 @@ boolean P_SpectatorJoinGame(player_t *player)
|
||||
{
|
||||
if (P_IsLocalPlayer(player))
|
||||
CONS_Printf(M_GetText("Server does not allow team change.\n"));
|
||||
//player->powers[pw_flashing] = TICRATE + 1; //to prevent message spam.
|
||||
}
|
||||
// Team changing in Team Match and CTF
|
||||
// Pressing fire assigns you to a team that needs players if allowed.
|
||||
// Partial code reproduction from p_tick.c autobalance code.
|
||||
else if (G_GametypeHasTeams())
|
||||
{
|
||||
INT32 changeto = 0;
|
||||
INT32 z, numplayersred = 0, numplayersblue = 0;
|
||||
|
||||
//find a team by num players, score, or random if all else fails.
|
||||
for (z = 0; z < MAXPLAYERS; ++z)
|
||||
if (playeringame[z])
|
||||
{
|
||||
if (players[z].ctfteam == 1)
|
||||
++numplayersred;
|
||||
else if (players[z].ctfteam == 2)
|
||||
++numplayersblue;
|
||||
}
|
||||
// for z
|
||||
|
||||
if (numplayersblue > numplayersred)
|
||||
changeto = 1;
|
||||
else if (numplayersred > numplayersblue)
|
||||
changeto = 2;
|
||||
else if (bluescore > redscore)
|
||||
changeto = 1;
|
||||
else if (redscore > bluescore)
|
||||
changeto = 2;
|
||||
else
|
||||
changeto = (P_RandomFixed() & 1) + 1;
|
||||
|
||||
if (player->mo)
|
||||
{
|
||||
P_RemoveMobj(player->mo);
|
||||
player->mo = NULL;
|
||||
}
|
||||
player->spectator = false;
|
||||
player->pflags &= ~PF_WANTSTOJOIN;
|
||||
player->kartstuff[k_spectatewait] = 0;
|
||||
player->ctfteam = changeto;
|
||||
player->playerstate = PST_REBORN;
|
||||
|
||||
//center camera
|
||||
P_ResetLocalCamAiming(player);
|
||||
|
||||
//Reset away view
|
||||
if (P_IsLocalPlayer(player) && displayplayers[0] != consoleplayer)
|
||||
displayplayers[0] = consoleplayer;
|
||||
|
||||
if (changeto == 1)
|
||||
CONS_Printf(M_GetText("%s switched to the %c%s%c.\n"), player_names[player-players], '\x85', M_GetText("Red team"), '\x80');
|
||||
else if (changeto == 2)
|
||||
CONS_Printf(M_GetText("%s switched to the %c%s%c.\n"), player_names[player-players], '\x84', M_GetText("Blue team"), '\x80');
|
||||
|
||||
return true; // no more player->mo, cannot continue.
|
||||
}
|
||||
// Joining in game from firing.
|
||||
else
|
||||
else // Joining in game from firing.
|
||||
{
|
||||
if (player->mo)
|
||||
{
|
||||
@@ -4378,8 +4147,7 @@ void P_PlayerThink(player_t *player)
|
||||
{
|
||||
seenplayer = NULL;
|
||||
|
||||
if (cv_seenames.value && cv_allowseenames.value &&
|
||||
!(G_TagGametype() && (player->pflags & PF_TAGIT)))
|
||||
if (cv_seenames.value && cv_allowseenames.value)
|
||||
{
|
||||
mobj_t *mo = P_SpawnNameFinder(player->mo, MT_NAMECHECK);
|
||||
|
||||
@@ -4654,39 +4422,6 @@ void P_PlayerThink(player_t *player)
|
||||
{
|
||||
player->pflags ^= PF_WANTSTOJOIN;
|
||||
player->powers[pw_flashing] = TICRATE/2 + 1;
|
||||
/*if (P_SpectatorJoinGame(player))
|
||||
return; // player->mo was removed.*/
|
||||
}
|
||||
|
||||
// Even if not NiGHTS, pull in nearby objects when walking around as John Q. Elliot.
|
||||
if (!objectplacing && !((netgame || multiplayer) && player->spectator)
|
||||
&& maptol & TOL_NIGHTS && (!(player->pflags & PF_NIGHTSMODE) || player->powers[pw_nights_helper]))
|
||||
{
|
||||
thinker_t *th;
|
||||
mobj_t *mo2;
|
||||
fixed_t x = player->mo->x;
|
||||
fixed_t y = player->mo->y;
|
||||
fixed_t z = player->mo->z;
|
||||
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (!(mo2->type == MT_NIGHTSWING || mo2->type == MT_RING || mo2->type == MT_COIN
|
||||
|| mo2->type == MT_BLUEBALL))
|
||||
continue;
|
||||
|
||||
if (P_AproxDistance(P_AproxDistance(mo2->x - x, mo2->y - y), mo2->z - z) > FixedMul(128*FRACUNIT, player->mo->scale))
|
||||
continue;
|
||||
|
||||
// Yay! The thing's in reach! Pull it in!
|
||||
mo2->flags |= MF_NOCLIP|MF_NOCLIPHEIGHT;
|
||||
mo2->flags2 |= MF2_NIGHTSPULL;
|
||||
P_SetTarget(&mo2->tracer, player->mo);
|
||||
}
|
||||
}
|
||||
|
||||
if (player->linktimer && !player->powers[pw_nights_linkfreeze])
|
||||
@@ -4725,14 +4460,9 @@ void P_PlayerThink(player_t *player)
|
||||
if (player->onconveyor == 1)
|
||||
player->cmomy = player->cmomx = 0;
|
||||
|
||||
//P_DoSuperStuff(player);
|
||||
//P_CheckSneakerAndLivesTimer(player);
|
||||
P_DoBubbleBreath(player); // Spawn Sonic's bubbles
|
||||
//P_CheckUnderwaterAndSpaceTimer(player); // Display the countdown drown numbers!
|
||||
P_CheckInvincibilityTimer(player); // Spawn Invincibility Sparkles
|
||||
P_DoPlayerHeadSigns(player); // Spawn Tag/CTF signs over player's head
|
||||
|
||||
#if 1
|
||||
// "Blur" a bit when you have speed shoes and are going fast enough
|
||||
if ((player->powers[pw_super] || player->powers[pw_sneakers]
|
||||
|| player->kartstuff[k_driftboost] || player->kartstuff[k_sneakertimer] || player->kartstuff[k_startboost]) && !player->kartstuff[k_invincibilitytimer] // SRB2kart
|
||||
@@ -4760,7 +4490,6 @@ void P_PlayerThink(player_t *player)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// check for use
|
||||
if (!(player->pflags & PF_NIGHTSMODE))
|
||||
@@ -4947,7 +4676,6 @@ void P_PlayerAfterThink(player_t *player)
|
||||
if (player->pflags & PF_NIGHTSMODE)
|
||||
{
|
||||
player->powers[pw_gravityboots] = 0;
|
||||
//player->mo->eflags &= ~MFE_VERTICALFLIP;
|
||||
}
|
||||
|
||||
if (player->pflags & PF_SLIDING)
|
||||
@@ -4970,8 +4698,7 @@ void P_PlayerAfterThink(player_t *player)
|
||||
else if (cmd->forwardmove < 0 && player->mo->tracer->target->lastlook > player->mo->tracer->target->movecount)
|
||||
player->mo->tracer->target->lastlook -= 2;
|
||||
|
||||
if (!(player->mo->tracer->target->flags & MF_SLIDEME) // Noclimb on chain parameters gives this
|
||||
&& !(twodlevel || player->mo->flags2 & MF2_TWOD)) // why on earth would you want to turn them in 2D mode?
|
||||
if (!(player->mo->tracer->target->flags & MF_SLIDEME)) // Noclimb on chain parameters gives this
|
||||
{
|
||||
player->mo->tracer->target->health += cmd->sidemove;
|
||||
player->mo->angle += cmd->sidemove<<ANGLETOFINESHIFT; // 2048 --> ANGLE_MAX
|
||||
|
||||
+17
-2
@@ -627,7 +627,21 @@ static boolean R_CheckBBox(const fixed_t *bspcoord)
|
||||
cliprange_t *start;
|
||||
|
||||
// Find the corners of the box that define the edges from current viewpoint.
|
||||
if ((boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 : viewx < bspcoord[BOXRIGHT] ? 1 : 2) + (viewy >= bspcoord[BOXTOP] ? 0 : viewy > bspcoord[BOXBOTTOM] ? 4 : 8)) == 5)
|
||||
if (viewx <= bspcoord[BOXLEFT])
|
||||
boxpos = 0;
|
||||
else if (viewx < bspcoord[BOXRIGHT])
|
||||
boxpos = 1;
|
||||
else
|
||||
boxpos = 2;
|
||||
|
||||
if (viewy >= bspcoord[BOXTOP])
|
||||
boxpos |= 0;
|
||||
else if (viewy > bspcoord[BOXBOTTOM])
|
||||
boxpos |= 1<<2;
|
||||
else
|
||||
boxpos |= 2<<2;
|
||||
|
||||
if (boxpos == 5)
|
||||
return true;
|
||||
|
||||
check = checkcoord[boxpos];
|
||||
@@ -656,7 +670,8 @@ static boolean R_CheckBBox(const fixed_t *bspcoord)
|
||||
sx2 = viewangletox[angle2];
|
||||
|
||||
// Does not cross a pixel.
|
||||
if (sx1 >= sx2) return false;
|
||||
if (sx1 >= sx2)
|
||||
return false;
|
||||
|
||||
start = solidsegs;
|
||||
while (start->last < sx2)
|
||||
|
||||
+1
-1
@@ -331,7 +331,7 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
|
||||
out->angle = mobj->resetinterp ? mobj->angle : R_LerpAngle(mobj->old_angle, mobj->angle, frac);
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (cv_glmdls.value)
|
||||
if (rendermode == render_opengl && cv_glmdls.value)
|
||||
{
|
||||
// pitch roll stuff
|
||||
out->pitch = mobj->resetinterp ? mobj->pitch : R_LerpAngle(mobj->old_pitch, mobj->pitch, frac);
|
||||
|
||||
+166
-348
@@ -161,14 +161,20 @@ void SendWeaponPref4(void);
|
||||
static void Precipstuff_OnChange(void);
|
||||
|
||||
consvar_t cv_tailspickup = {"tailspickup", "On", CV_NETVAR|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_chasecam = {"chasecam", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_chasecam2 = {"chasecam2", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_chasecam3 = {"chasecam3", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_chasecam4 = {"chasecam4", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_flipcam = {"flipcam", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, FlipCam_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_flipcam2 = {"flipcam2", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, FlipCam2_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_flipcam3 = {"flipcam3", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, FlipCam3_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_flipcam4 = {"flipcam4", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, FlipCam4_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_chasecam[MAXSPLITSCREENPLAYERS] = {
|
||||
{"chasecam", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"chasecam2", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"chasecam3", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"chasecam4", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_flipcam[MAXSPLITSCREENPLAYERS] = {
|
||||
{"flipcam", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, FlipCam_OnChange, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"flipcam2", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, FlipCam2_OnChange, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"flipcam3", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, FlipCam3_OnChange, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"flipcam4", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, FlipCam4_OnChange, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_shadow = {"shadow", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_shadowoffs = {"offsetshadows", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -383,17 +389,19 @@ angle_t R_PointToAngle2(fixed_t pviewx, fixed_t pviewy, fixed_t x, fixed_t y)
|
||||
angle_t R_PlayerSliptideAngle(player_t *player)
|
||||
{
|
||||
mobj_t *mo;
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
angle_t ang = 0;
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
angle_t ang = 0;
|
||||
|
||||
if (!cv_sliptideroll.value || !player || P_MobjWasRemoved(player->mo))
|
||||
return 0;
|
||||
if (!cv_sloperoll.value || !cv_sliptideroll.value || !player || P_MobjWasRemoved(player->mo))
|
||||
return 0;
|
||||
|
||||
mo = player->mo;
|
||||
mo = player->mo;
|
||||
|
||||
size_t rot = mo->frame & FF_FRAMEMASK;
|
||||
boolean papersprite = (mo->frame & FF_PAPERSPRITE);
|
||||
if (mo->player->sliproll == 0 && mo->player->sliptidemem == 0)
|
||||
return 0;
|
||||
|
||||
size_t rot = (mo->frame & FF_FRAMEMASK);
|
||||
|
||||
if (mo->skin && mo->sprite == SPR_PLAY)
|
||||
{
|
||||
@@ -410,7 +418,7 @@ angle_t R_PlayerSliptideAngle(player_t *player)
|
||||
if (rot >= sprdef->numframes)
|
||||
{
|
||||
sprdef = &sprites[states[S_UNKNOWN].sprite];
|
||||
rot = states[S_UNKNOWN].frame&FF_FRAMEMASK;
|
||||
rot = (states[S_UNKNOWN].frame & FF_FRAMEMASK);
|
||||
}
|
||||
|
||||
sprframe = &sprdef->spriteframes[rot];
|
||||
@@ -418,10 +426,10 @@ angle_t R_PlayerSliptideAngle(player_t *player)
|
||||
// No sprite frame? I guess it is possible
|
||||
if (!sprframe) return 0;
|
||||
|
||||
if (sprframe->rotate != SRF_SINGLE || papersprite)
|
||||
if (sprframe->rotate != SRF_SINGLE || (mo->frame & FF_PAPERSPRITE))
|
||||
ang = R_PointToAngle(mo->x, mo->y) - mo->angle;
|
||||
|
||||
return FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), mo->player->sliproll*(mo->player->sliptidemem));
|
||||
return FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), mo->player->sliproll * mo->player->sliptidemem);
|
||||
}
|
||||
|
||||
INT32 R_GetHudUncap(void)
|
||||
@@ -1067,10 +1075,6 @@ subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y)
|
||||
size_t nodenum;
|
||||
subsector_t *ret;
|
||||
|
||||
// single subsector is a special case
|
||||
//if (numnodes == 0)
|
||||
//return subsectors;
|
||||
|
||||
nodenum = numnodes - 1;
|
||||
|
||||
while (!(nodenum & NF_SUBSECTOR))
|
||||
@@ -1095,38 +1099,29 @@ subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y)
|
||||
|
||||
mobj_t *viewmobj;
|
||||
|
||||
void R_SkyboxFrame(player_t *player)
|
||||
static void
|
||||
R_SetupCommonFrame
|
||||
( player_t * player,
|
||||
subsector_t * subsector)
|
||||
{
|
||||
camera_t *thiscam = &camera[0];
|
||||
UINT8 i;
|
||||
newview->player = player;
|
||||
|
||||
if (splitscreen)
|
||||
{
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (player == &players[displayplayers[i]])
|
||||
{
|
||||
thiscam = &camera[i];
|
||||
R_SetViewContext(VIEWCONTEXT_SKY1 + i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
newview->x += quake.x;
|
||||
newview->y += quake.y;
|
||||
newview->z += quake.z;
|
||||
|
||||
newview->roll = R_ViewRollAngle(player);
|
||||
|
||||
if (subsector)
|
||||
newview->sector = subsector->sector;
|
||||
else
|
||||
{
|
||||
R_SetViewContext(VIEWCONTEXT_SKY1);
|
||||
}
|
||||
newview->sector = R_PointInSubsector(newview->x, newview->y)->sector;
|
||||
|
||||
// cut-away view stuff
|
||||
newview->sky = true;
|
||||
viewmobj = skyboxmo[0];
|
||||
#ifdef PARANOIA
|
||||
if (!viewmobj)
|
||||
{
|
||||
const size_t playeri = (size_t)(player - players);
|
||||
I_Error("R_SkyboxFrame: viewmobj null (player %s)", sizeu1(playeri));
|
||||
}
|
||||
#endif
|
||||
R_InterpolateView(R_UsingFrameInterpolation() ? (demo.playback && demo.freecam) ? rendertimefrac_unpaused : rendertimefrac : FRACUNIT, false);
|
||||
}
|
||||
|
||||
static void R_SetupAimingFrame(player_t *player, camera_t *thiscam)
|
||||
{
|
||||
if (player->awayviewtics)
|
||||
{
|
||||
newview->aim = player->awayviewaiming;
|
||||
@@ -1141,31 +1136,42 @@ void R_SkyboxFrame(player_t *player)
|
||||
{
|
||||
newview->aim = player->aiming;
|
||||
newview->angle = player->mo->angle;
|
||||
|
||||
if (!demo.playback && player->playerstate != PST_DEAD)
|
||||
{
|
||||
if (player == &players[consoleplayer])
|
||||
for (UINT8 i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
newview->angle = localangle[0]; // WARNING: camera uses this
|
||||
newview->aim = localaiming[0];
|
||||
}
|
||||
else if (splitscreen)
|
||||
{
|
||||
for (i = 1; i <= splitscreen; i++)
|
||||
if (player == (i == 0 ? &players[consoleplayer] : &players[displayplayers[i]]))
|
||||
{
|
||||
if (player == &players[displayplayers[i]])
|
||||
{
|
||||
newview->angle = localangle[i];
|
||||
newview->aim = localaiming[i];
|
||||
break;
|
||||
}
|
||||
newview->angle = localangle[i];
|
||||
newview->aim = localaiming[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
newview->angle += viewmobj->angle;
|
||||
newview->roll = R_ViewRollAngle(player);
|
||||
}
|
||||
|
||||
newview->player = player;
|
||||
void R_SkyboxFrame(int s)
|
||||
{
|
||||
player_t *player = &players[displayplayers[s]];
|
||||
camera_t *thiscam = &camera[s];
|
||||
|
||||
R_SetViewContext(VIEWCONTEXT_SKY1 + s);
|
||||
|
||||
// cut-away view stuff
|
||||
newview->sky = true;
|
||||
viewmobj = skyboxmo[0];
|
||||
#ifdef PARANOIA
|
||||
if (!viewmobj)
|
||||
{
|
||||
const size_t playeri = (size_t)(player - players);
|
||||
I_Error("R_SkyboxFrame: viewmobj null (player %s)", sizeu1(playeri));
|
||||
}
|
||||
#endif
|
||||
R_SetupAimingFrame(player, thiscam);
|
||||
|
||||
newview->angle += viewmobj->angle;
|
||||
|
||||
newview->x = viewmobj->x;
|
||||
newview->y = viewmobj->y;
|
||||
@@ -1173,211 +1179,83 @@ void R_SkyboxFrame(player_t *player)
|
||||
if (viewmobj->spawnpoint)
|
||||
newview->z = ((fixed_t)viewmobj->spawnpoint->angle)<<FRACBITS;
|
||||
|
||||
newview->x += quake.x;
|
||||
newview->y += quake.y;
|
||||
newview->z += quake.z;
|
||||
#define SETUPSKYVIEW(viewmo, zscale)\
|
||||
if (skyboxmo[1])\
|
||||
{\
|
||||
fixed_t x = 0, y = 0;\
|
||||
if (mh->skybox_scalex > 0)\
|
||||
x = (viewmo->x - skyboxmo[1]->x) / mh->skybox_scalex;\
|
||||
else if (mh->skybox_scalex < 0)\
|
||||
x = (viewmo->x - skyboxmo[1]->x) * -mh->skybox_scalex;\
|
||||
if (mh->skybox_scaley > 0)\
|
||||
y = (viewmo->y - skyboxmo[1]->y) / mh->skybox_scaley;\
|
||||
else if (mh->skybox_scaley < 0)\
|
||||
y = (viewmo->y - skyboxmo[1]->y) * -mh->skybox_scaley;\
|
||||
if (viewmobj->angle == 0)\
|
||||
{\
|
||||
newview->x += x;\
|
||||
newview->y += y;\
|
||||
}\
|
||||
else if (viewmobj->angle == ANGLE_90)\
|
||||
{\
|
||||
newview->x -= y;\
|
||||
newview->y += x;\
|
||||
}\
|
||||
else if (viewmobj->angle == ANGLE_180)\
|
||||
{\
|
||||
newview->x -= x;\
|
||||
newview->y -= y;\
|
||||
}\
|
||||
else if (viewmobj->angle == ANGLE_270)\
|
||||
{\
|
||||
newview->x += y;\
|
||||
newview->y -= x;\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
angle_t ang = viewmobj->angle>>ANGLETOFINESHIFT;\
|
||||
newview->x += FixedMul(x,FINECOSINE(ang)) - FixedMul(y, FINESINE(ang));\
|
||||
newview->y += FixedMul(x, FINESINE(ang)) + FixedMul(y,FINECOSINE(ang));\
|
||||
}\
|
||||
}\
|
||||
if (mh->skybox_scalez > 0)\
|
||||
newview->z += zscale / mh->skybox_scalez;\
|
||||
else if (mh->skybox_scalez < 0)\
|
||||
newview->z += zscale * -mh->skybox_scalez;
|
||||
|
||||
if (mapheaderinfo[gamemap-1])
|
||||
{
|
||||
mapheader_t *mh = mapheaderinfo[gamemap-1];
|
||||
|
||||
if (player->awayviewtics)
|
||||
{
|
||||
if (skyboxmo[1])
|
||||
{
|
||||
fixed_t x = 0, y = 0;
|
||||
if (mh->skybox_scalex > 0)
|
||||
x = (player->awayviewmobj->x - skyboxmo[1]->x) / mh->skybox_scalex;
|
||||
else if (mh->skybox_scalex < 0)
|
||||
x = (player->awayviewmobj->x - skyboxmo[1]->x) * -mh->skybox_scalex;
|
||||
|
||||
if (mh->skybox_scaley > 0)
|
||||
y = (player->awayviewmobj->y - skyboxmo[1]->y) / mh->skybox_scaley;
|
||||
else if (mh->skybox_scaley < 0)
|
||||
y = (player->awayviewmobj->y - skyboxmo[1]->y) * -mh->skybox_scaley;
|
||||
|
||||
if (viewmobj->angle == 0)
|
||||
{
|
||||
newview->x += x;
|
||||
newview->y += y;
|
||||
}
|
||||
else if (viewmobj->angle == ANGLE_90)
|
||||
{
|
||||
newview->x -= y;
|
||||
newview->y += x;
|
||||
}
|
||||
else if (viewmobj->angle == ANGLE_180)
|
||||
{
|
||||
newview->x -= x;
|
||||
newview->y -= y;
|
||||
}
|
||||
else if (viewmobj->angle == ANGLE_270)
|
||||
{
|
||||
newview->x += y;
|
||||
newview->y -= x;
|
||||
}
|
||||
else
|
||||
{
|
||||
angle_t ang = viewmobj->angle>>ANGLETOFINESHIFT;
|
||||
newview->x += FixedMul(x,FINECOSINE(ang)) - FixedMul(y, FINESINE(ang));
|
||||
newview->y += FixedMul(x, FINESINE(ang)) + FixedMul(y,FINECOSINE(ang));
|
||||
}
|
||||
}
|
||||
if (mh->skybox_scalez > 0)
|
||||
newview->z += (player->awayviewmobj->z + 20*FRACUNIT) / mh->skybox_scalez;
|
||||
else if (mh->skybox_scalez < 0)
|
||||
newview->z += (player->awayviewmobj->z + 20*FRACUNIT) * -mh->skybox_scalez;
|
||||
SETUPSKYVIEW(player->awayviewmobj, (player->awayviewmobj->z + 20*FRACUNIT));
|
||||
}
|
||||
else if (thiscam->chase)
|
||||
{
|
||||
if (skyboxmo[1])
|
||||
{
|
||||
fixed_t x = 0, y = 0;
|
||||
if (mh->skybox_scalex > 0)
|
||||
x = (thiscam->x - skyboxmo[1]->x) / mh->skybox_scalex;
|
||||
else if (mh->skybox_scalex < 0)
|
||||
x = (thiscam->x - skyboxmo[1]->x) * -mh->skybox_scalex;
|
||||
|
||||
if (mh->skybox_scaley > 0)
|
||||
y = (thiscam->y - skyboxmo[1]->y) / mh->skybox_scaley;
|
||||
else if (mh->skybox_scaley < 0)
|
||||
y = (thiscam->y - skyboxmo[1]->y) * -mh->skybox_scaley;
|
||||
|
||||
if (viewmobj->angle == 0)
|
||||
{
|
||||
newview->x += x;
|
||||
newview->y += y;
|
||||
}
|
||||
else if (viewmobj->angle == ANGLE_90)
|
||||
{
|
||||
newview->x -= y;
|
||||
newview->y += x;
|
||||
}
|
||||
else if (viewmobj->angle == ANGLE_180)
|
||||
{
|
||||
newview->x -= x;
|
||||
newview->y -= y;
|
||||
}
|
||||
else if (viewmobj->angle == ANGLE_270)
|
||||
{
|
||||
newview->x += y;
|
||||
newview->y -= x;
|
||||
}
|
||||
else
|
||||
{
|
||||
angle_t ang = viewmobj->angle>>ANGLETOFINESHIFT;
|
||||
newview->x += FixedMul(x,FINECOSINE(ang)) - FixedMul(y, FINESINE(ang));
|
||||
newview->y += FixedMul(x, FINESINE(ang)) + FixedMul(y,FINECOSINE(ang));
|
||||
}
|
||||
}
|
||||
if (mh->skybox_scalez > 0)
|
||||
newview->z += (thiscam->z + (thiscam->height>>1)) / mh->skybox_scalez;
|
||||
else if (mh->skybox_scalez < 0)
|
||||
newview->z += (thiscam->z + (thiscam->height>>1)) * -mh->skybox_scalez;
|
||||
SETUPSKYVIEW(thiscam, (thiscam->z + (thiscam->height>>1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (skyboxmo[1])
|
||||
{
|
||||
fixed_t x = 0, y = 0;
|
||||
if (mh->skybox_scalex > 0)
|
||||
x = (player->mo->x - skyboxmo[1]->x) / mh->skybox_scalex;
|
||||
else if (mh->skybox_scalex < 0)
|
||||
x = (player->mo->x - skyboxmo[1]->x) * -mh->skybox_scalex;
|
||||
if (mh->skybox_scaley > 0)
|
||||
y = (player->mo->y - skyboxmo[1]->y) / mh->skybox_scaley;
|
||||
else if (mh->skybox_scaley < 0)
|
||||
y = (player->mo->y - skyboxmo[1]->y) * -mh->skybox_scaley;
|
||||
|
||||
if (viewmobj->angle == 0)
|
||||
{
|
||||
newview->x += x;
|
||||
newview->y += y;
|
||||
}
|
||||
else if (viewmobj->angle == ANGLE_90)
|
||||
{
|
||||
newview->x -= y;
|
||||
newview->y += x;
|
||||
}
|
||||
else if (viewmobj->angle == ANGLE_180)
|
||||
{
|
||||
newview->x -= x;
|
||||
newview->y -= y;
|
||||
}
|
||||
else if (viewmobj->angle == ANGLE_270)
|
||||
{
|
||||
newview->x += y;
|
||||
newview->y -= x;
|
||||
}
|
||||
else
|
||||
{
|
||||
angle_t ang = viewmobj->angle>>ANGLETOFINESHIFT;
|
||||
newview->x += FixedMul(x,FINECOSINE(ang)) - FixedMul(y, FINESINE(ang));
|
||||
newview->y += FixedMul(x, FINESINE(ang)) + FixedMul(y,FINECOSINE(ang));
|
||||
}
|
||||
}
|
||||
if (mh->skybox_scalez > 0)
|
||||
newview->z += player->viewz / mh->skybox_scalez;
|
||||
else if (mh->skybox_scalez < 0)
|
||||
newview->z += player->viewz * -mh->skybox_scalez;
|
||||
SETUPSKYVIEW(player->mo, player->viewz);
|
||||
}
|
||||
}
|
||||
#undef SETUPSKYVIEW
|
||||
|
||||
if (viewmobj->subsector)
|
||||
newview->sector = viewmobj->subsector->sector;
|
||||
else
|
||||
newview->sector = R_PointInSubsector(newview->x, newview->y)->sector;
|
||||
|
||||
R_InterpolateView(R_UsingFrameInterpolation() ? (demo.playback && demo.freecam) ? rendertimefrac_unpaused : rendertimefrac : FRACUNIT, false);
|
||||
R_SetupCommonFrame(player, viewmobj->subsector);
|
||||
}
|
||||
|
||||
void R_SetupFrame(player_t *player, boolean skybox)
|
||||
void R_SetupFrame(int s, boolean skybox)
|
||||
{
|
||||
camera_t *thiscam;
|
||||
boolean chasecam = false;
|
||||
player_t *player = &players[displayplayers[s]];
|
||||
camera_t *thiscam = &camera[s];
|
||||
boolean chasecam = (cv_chasecam[s].value != 0);
|
||||
|
||||
if (splitscreen > 2 && player == &players[displayplayers[3]])
|
||||
R_SetViewContext(VIEWCONTEXT_PLAYER1 + s);
|
||||
if (thiscam->reset)
|
||||
{
|
||||
thiscam = &camera[3];
|
||||
chasecam = (cv_chasecam4.value != 0);
|
||||
R_SetViewContext(VIEWCONTEXT_PLAYER4);
|
||||
if (thiscam->reset)
|
||||
{
|
||||
R_ResetViewInterpolation(4);
|
||||
thiscam->reset = false;
|
||||
}
|
||||
}
|
||||
else if (splitscreen > 1 && player == &players[displayplayers[2]])
|
||||
{
|
||||
thiscam = &camera[2];
|
||||
chasecam = (cv_chasecam3.value != 0);
|
||||
R_SetViewContext(VIEWCONTEXT_PLAYER3);
|
||||
if (thiscam->reset)
|
||||
{
|
||||
R_ResetViewInterpolation(3);
|
||||
thiscam->reset = false;
|
||||
}
|
||||
}
|
||||
else if (splitscreen && player == &players[displayplayers[1]])
|
||||
{
|
||||
thiscam = &camera[1];
|
||||
chasecam = (cv_chasecam2.value != 0);
|
||||
R_SetViewContext(VIEWCONTEXT_PLAYER2);
|
||||
if (thiscam->reset)
|
||||
{
|
||||
R_ResetViewInterpolation(2);
|
||||
thiscam->reset = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
thiscam = &camera[0];
|
||||
chasecam = (cv_chasecam.value != 0);
|
||||
R_SetViewContext(VIEWCONTEXT_PLAYER1);
|
||||
if (thiscam->reset)
|
||||
{
|
||||
R_ResetViewInterpolation(1);
|
||||
thiscam->reset = false;
|
||||
}
|
||||
R_ResetViewInterpolation(s);
|
||||
thiscam->reset = false;
|
||||
}
|
||||
|
||||
if (player->spectator) // no spectator chasecam
|
||||
@@ -1395,84 +1273,40 @@ void R_SetupFrame(player_t *player, boolean skybox)
|
||||
|
||||
newview->sky = !skybox;
|
||||
|
||||
R_SetupAimingFrame(player, thiscam);
|
||||
|
||||
if (player->awayviewtics) // cut-away view stuff
|
||||
{
|
||||
viewmobj = player->awayviewmobj; // should be a MT_ALTVIEWMAN
|
||||
I_Assert(viewmobj != NULL);
|
||||
|
||||
newview->x = viewmobj->x;
|
||||
newview->y = viewmobj->y;
|
||||
newview->z = viewmobj->z + 20*FRACUNIT;
|
||||
newview->aim = player->awayviewaiming;
|
||||
newview->angle = viewmobj->angle;
|
||||
|
||||
R_SetupCommonFrame(player, viewmobj->subsector);
|
||||
}
|
||||
else if (!player->spectator && (thiscam && chasecam)) // use outside cam view
|
||||
{
|
||||
viewmobj = NULL;
|
||||
|
||||
newview->x = thiscam->x;
|
||||
newview->y = thiscam->y;
|
||||
newview->z = thiscam->z + (thiscam->height>>1);
|
||||
newview->aim = thiscam->aiming;
|
||||
newview->angle = thiscam->angle;
|
||||
|
||||
R_SetupCommonFrame(player, thiscam->subsector);
|
||||
}
|
||||
else // use the player's eyes view
|
||||
{
|
||||
newview->z = player->viewz;
|
||||
|
||||
viewmobj = player->mo;
|
||||
I_Assert(viewmobj != NULL);
|
||||
|
||||
newview->aim = player->aiming;
|
||||
newview->angle = viewmobj->angle;
|
||||
|
||||
if (!demo.playback && player->playerstate != PST_DEAD)
|
||||
{
|
||||
if (player == &players[consoleplayer])
|
||||
{
|
||||
newview->angle = localangle[0]; // WARNING: camera uses this
|
||||
newview->aim = localaiming[0];
|
||||
}
|
||||
else if (splitscreen)
|
||||
{
|
||||
UINT8 i;
|
||||
for (i = 1; i <= splitscreen; i++)
|
||||
{
|
||||
if (player == &players[displayplayers[i]])
|
||||
{
|
||||
newview->angle = localangle[i];
|
||||
newview->aim = localaiming[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
newview->roll = R_ViewRollAngle(player);
|
||||
newview->z += quake.z;
|
||||
|
||||
newview->player = player;
|
||||
|
||||
if ((thiscam && chasecam) && !player->awayviewtics && !player->spectator)
|
||||
{
|
||||
newview->x = thiscam->x;
|
||||
newview->y = thiscam->y;
|
||||
newview->x += quake.x;
|
||||
newview->y += quake.y;
|
||||
|
||||
if (thiscam->subsector && thiscam->subsector->sector)
|
||||
newview->sector = thiscam->subsector->sector;
|
||||
else
|
||||
newview->sector = R_PointInSubsector(newview->x, newview->y)->sector;
|
||||
}
|
||||
else
|
||||
{
|
||||
newview->x = viewmobj->x;
|
||||
newview->y = viewmobj->y;
|
||||
newview->x += quake.x;
|
||||
newview->y += quake.y;
|
||||
newview->z = player->viewz;
|
||||
|
||||
if (!P_MobjWasRemoved(viewmobj) && viewmobj->subsector && thiscam && thiscam->subsector->sector)
|
||||
newview->sector = viewmobj->subsector->sector;
|
||||
else
|
||||
newview->sector = R_PointInSubsector(newview->x, newview->y)->sector;
|
||||
R_SetupCommonFrame(player, viewmobj->subsector);
|
||||
}
|
||||
|
||||
R_InterpolateView(R_UsingFrameInterpolation() ? (demo.playback && demo.freecam) ? rendertimefrac_unpaused : rendertimefrac : FRACUNIT, false);
|
||||
}
|
||||
|
||||
static void R_PortalFrame(portal_t *portal)
|
||||
@@ -1555,7 +1389,7 @@ void R_RenderPlayerView(player_t *player)
|
||||
PS_START_TIMING(ps_skyboxtime);
|
||||
if (skybox && skyVisible)
|
||||
{
|
||||
R_SkyboxFrame(player);
|
||||
R_SkyboxFrame(viewssnum);
|
||||
|
||||
R_ClearClipSegs();
|
||||
R_ClearDrawSegs();
|
||||
@@ -1575,7 +1409,7 @@ void R_RenderPlayerView(player_t *player)
|
||||
}
|
||||
PS_STOP_TIMING(ps_skyboxtime);
|
||||
|
||||
R_SetupFrame(player, skybox);
|
||||
R_SetupFrame(viewssnum, skybox);
|
||||
skyVisible = false;
|
||||
framecount++;
|
||||
validcount++;
|
||||
@@ -1681,15 +1515,18 @@ void R_RenderPlayerView(player_t *player)
|
||||
|
||||
void R_RegisterEngineStuff(void)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
CV_RegisterVar(&cv_gravity);
|
||||
CV_RegisterVar(&cv_tailspickup);
|
||||
CV_RegisterVar(&cv_soniccd);
|
||||
CV_RegisterVar(&cv_allowmlook);
|
||||
CV_RegisterVar(&cv_homremoval);
|
||||
CV_RegisterVar(&cv_flipcam);
|
||||
CV_RegisterVar(&cv_flipcam2);
|
||||
CV_RegisterVar(&cv_flipcam3);
|
||||
CV_RegisterVar(&cv_flipcam4);
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_flipcam[i]);
|
||||
}
|
||||
|
||||
// Enough for dedicated server
|
||||
if (dedicated)
|
||||
@@ -1702,43 +1539,25 @@ void R_RegisterEngineStuff(void)
|
||||
CV_RegisterVar(&cv_mobjscaleprecip);
|
||||
CV_RegisterVar(&cv_fov);
|
||||
|
||||
CV_RegisterVar(&cv_chasecam);
|
||||
CV_RegisterVar(&cv_chasecam2);
|
||||
CV_RegisterVar(&cv_chasecam3);
|
||||
CV_RegisterVar(&cv_chasecam4);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_chasecam[i]);
|
||||
}
|
||||
CV_RegisterVar(&cv_shadow);
|
||||
CV_RegisterVar(&cv_shadowoffs);
|
||||
CV_RegisterVar(&cv_skybox);
|
||||
CV_RegisterVar(&cv_ffloorclip);
|
||||
CV_RegisterVar(&cv_spriteclip);
|
||||
|
||||
CV_RegisterVar(&cv_cam_dist);
|
||||
CV_RegisterVar(&cv_cam_still);
|
||||
CV_RegisterVar(&cv_cam_height);
|
||||
CV_RegisterVar(&cv_cam_speed);
|
||||
CV_RegisterVar(&cv_cam_rotate);
|
||||
CV_RegisterVar(&cv_cam_rotspeed);
|
||||
|
||||
CV_RegisterVar(&cv_cam2_dist);
|
||||
CV_RegisterVar(&cv_cam2_still);
|
||||
CV_RegisterVar(&cv_cam2_height);
|
||||
CV_RegisterVar(&cv_cam2_speed);
|
||||
CV_RegisterVar(&cv_cam2_rotate);
|
||||
CV_RegisterVar(&cv_cam2_rotspeed);
|
||||
|
||||
CV_RegisterVar(&cv_cam3_dist);
|
||||
CV_RegisterVar(&cv_cam3_still);
|
||||
CV_RegisterVar(&cv_cam3_height);
|
||||
CV_RegisterVar(&cv_cam3_speed);
|
||||
CV_RegisterVar(&cv_cam3_rotate);
|
||||
CV_RegisterVar(&cv_cam3_rotspeed);
|
||||
|
||||
CV_RegisterVar(&cv_cam4_dist);
|
||||
CV_RegisterVar(&cv_cam4_still);
|
||||
CV_RegisterVar(&cv_cam4_height);
|
||||
CV_RegisterVar(&cv_cam4_speed);
|
||||
CV_RegisterVar(&cv_cam4_rotate);
|
||||
CV_RegisterVar(&cv_cam4_rotspeed);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_cam_dist[i]);
|
||||
CV_RegisterVar(&cv_cam_still[i]);
|
||||
CV_RegisterVar(&cv_cam_height[i]);
|
||||
CV_RegisterVar(&cv_cam_speed[i]);
|
||||
CV_RegisterVar(&cv_cam_rotate[i]);
|
||||
CV_RegisterVar(&cv_cam_rotspeed[i]);
|
||||
}
|
||||
|
||||
CV_RegisterVar(&cv_tilting);
|
||||
CV_RegisterVar(&cv_quaketilt);
|
||||
@@ -1750,7 +1569,6 @@ void R_RegisterEngineStuff(void)
|
||||
CV_RegisterVar(&cv_driftsparkpulse);
|
||||
CV_RegisterVar(&cv_gravstretch);
|
||||
CV_RegisterVar(&cv_sloperoll);
|
||||
CV_RegisterVar(&cv_spriteroll);
|
||||
CV_RegisterVar(&cv_sliptideroll);
|
||||
CV_RegisterVar(&cv_sloperolldist);
|
||||
CV_RegisterVar(&cv_sparkroll);
|
||||
|
||||
+4
-4
@@ -146,8 +146,8 @@ extern ps_metric_t ps_numpolyobjects;
|
||||
|
||||
extern consvar_t cv_showhud, cv_translucenthud, cv_uncappedhud;
|
||||
extern consvar_t cv_homremoval;
|
||||
extern consvar_t cv_chasecam, cv_chasecam2, cv_chasecam3, cv_chasecam4;
|
||||
extern consvar_t cv_flipcam, cv_flipcam2, cv_flipcam3, cv_flipcam4;
|
||||
extern consvar_t cv_chasecam[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_flipcam[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_shadow, cv_shadowoffs;
|
||||
extern consvar_t cv_ffloorclip, cv_spriteclip;
|
||||
extern consvar_t cv_translucency;
|
||||
@@ -172,9 +172,9 @@ void R_SetViewSize(void);
|
||||
// do it (sometimes explicitly called)
|
||||
void R_ExecuteSetViewSize(void);
|
||||
|
||||
void R_SkyboxFrame(player_t *player);
|
||||
void R_SkyboxFrame(int s);
|
||||
void R_SetupFrame(int s, boolean skybox);
|
||||
|
||||
void R_SetupFrame(player_t *player, boolean skybox);
|
||||
// Called by G_Drawer.
|
||||
void R_RenderPlayerView(player_t *player);
|
||||
|
||||
|
||||
@@ -14,9 +14,11 @@
|
||||
|
||||
#include "byteptr.h"
|
||||
#include "dehacked.h"
|
||||
#include "doomdef.h"
|
||||
#include "i_video.h"
|
||||
#include "r_data.h"
|
||||
#include "r_draw.h"
|
||||
#include "r_fps.h"
|
||||
#include "r_patch.h"
|
||||
#include "r_things.h"
|
||||
#include "z_zone.h"
|
||||
@@ -803,6 +805,14 @@ INT32 R_GetRollAngle(angle_t rollangle)
|
||||
return ra;
|
||||
}
|
||||
|
||||
angle_t R_RotationAngle(angle_t ang, angle_t camang, interpmobjstate_t *interp)
|
||||
{
|
||||
return FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), interp->roll) +
|
||||
FixedMul(FINESINE((ang) >> ANGLETOFINESHIFT), interp->pitch) +
|
||||
FixedMul(FINECOSINE((camang) >> ANGLETOFINESHIFT), interp->sloperoll) +
|
||||
FixedMul(FINESINE((camang) >> ANGLETOFINESHIFT), interp->slopepitch);
|
||||
}
|
||||
|
||||
patch_t *Patch_GetRotatedSprite(spriteframe_t *sprite, size_t frame, size_t spriteangle, boolean flip, boolean adjustfeet, void *info, INT32 rotationangle)
|
||||
{
|
||||
rotsprite_t *rotsprite;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#define __R_PATCH__
|
||||
|
||||
#include "r_defs.h"
|
||||
#include "r_fps.h"
|
||||
#include "doomdef.h"
|
||||
|
||||
// Structs
|
||||
@@ -53,6 +54,8 @@ void R_ParseSPRTINFOLump(UINT16 wadNum, UINT16 lumpNum);
|
||||
// Sprite rotation
|
||||
#ifdef ROTSPRITE
|
||||
INT32 R_GetRollAngle(angle_t rollangle);
|
||||
angle_t R_RotationAngle(angle_t ang, angle_t camang, interpmobjstate_t *interp);
|
||||
|
||||
patch_t *Patch_GetRotatedSprite(
|
||||
spriteframe_t *sprite,
|
||||
size_t frame, size_t spriteangle,
|
||||
|
||||
+23
-29
@@ -661,13 +661,13 @@ static boolean R_IsFFloorTranslucent(visffloor_t *pfloor)
|
||||
// Renders all the thick sides in the given range.
|
||||
void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
||||
{
|
||||
size_t pindex;
|
||||
size_t pindex = 0;
|
||||
column_t * col;
|
||||
INT32 lightnum;
|
||||
INT32 texnum;
|
||||
INT32 lightnum;
|
||||
INT32 texnum;
|
||||
sector_t tempsec;
|
||||
INT32 templight;
|
||||
INT32 i, p;
|
||||
INT32 templight;
|
||||
INT32 i, p;
|
||||
fixed_t bottombounds = viewheight << FRACBITS;
|
||||
fixed_t topbounds = (con_clipviewtop - 1) << FRACBITS;
|
||||
fixed_t offsetvalue = 0;
|
||||
@@ -1036,6 +1036,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
||||
// Check if the current light effects the colormap/lightlevel
|
||||
rlight = &dc_lightlist[i];
|
||||
lighteffect = !(dc_lightlist[i].flags & FF_NOSHADE);
|
||||
|
||||
if (lighteffect)
|
||||
{
|
||||
lightnum = rlight->lightnum;
|
||||
@@ -1233,7 +1234,6 @@ static void R_RenderSegLoop (void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
yh = bottomfrac>>HEIGHTBITS;
|
||||
|
||||
bottom = floorclip[rw_x]-1;
|
||||
@@ -1244,13 +1244,14 @@ static void R_RenderSegLoop (void)
|
||||
if (markfloor)
|
||||
{
|
||||
top = yh < ceilingclip[rw_x] ? ceilingclip[rw_x] : yh;
|
||||
|
||||
if (++top <= bottom && floorplane)
|
||||
{
|
||||
floorplane->top[rw_x] = (INT16)top;
|
||||
floorplane->bottom[rw_x] = (INT16)bottom;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
rw_floormarked = false;
|
||||
rw_ceilingmarked = false;
|
||||
|
||||
@@ -1591,6 +1592,8 @@ static void R_RenderSegLoop (void)
|
||||
topfrac += topstep;
|
||||
bottomfrac += bottomstep;
|
||||
}
|
||||
|
||||
//colfunc = wallcolfunc;
|
||||
}
|
||||
|
||||
// Uses precalculated seg->length
|
||||
@@ -1853,21 +1856,19 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
rw_toptextureslide = rw_midtextureslide = rw_bottomtextureslide = 0;
|
||||
ceilingfrontslide = floorfrontslide = ceilingbackslide = floorbackslide = 0;
|
||||
|
||||
{
|
||||
angle_t lineangle = R_PointToAngle2(curline->v1->x, curline->v1->y, curline->v2->x, curline->v2->y);
|
||||
angle_t lineangle = R_PointToAngle2(curline->v1->x, curline->v1->y, curline->v2->x, curline->v2->y);
|
||||
|
||||
if (frontsector->f_slope)
|
||||
floorfrontslide = FixedMul(frontsector->f_slope->zdelta, FINECOSINE((lineangle-frontsector->f_slope->xydirection)>>ANGLETOFINESHIFT));
|
||||
if (frontsector->f_slope)
|
||||
floorfrontslide = FixedMul(frontsector->f_slope->zdelta, FINECOSINE((lineangle-frontsector->f_slope->xydirection)>>ANGLETOFINESHIFT));
|
||||
|
||||
if (frontsector->c_slope)
|
||||
ceilingfrontslide = FixedMul(frontsector->c_slope->zdelta, FINECOSINE((lineangle-frontsector->c_slope->xydirection)>>ANGLETOFINESHIFT));
|
||||
if (frontsector->c_slope)
|
||||
ceilingfrontslide = FixedMul(frontsector->c_slope->zdelta, FINECOSINE((lineangle-frontsector->c_slope->xydirection)>>ANGLETOFINESHIFT));
|
||||
|
||||
if (backsector && backsector->f_slope)
|
||||
floorbackslide = FixedMul(backsector->f_slope->zdelta, FINECOSINE((lineangle-backsector->f_slope->xydirection)>>ANGLETOFINESHIFT));
|
||||
if (backsector && backsector->f_slope)
|
||||
floorbackslide = FixedMul(backsector->f_slope->zdelta, FINECOSINE((lineangle-backsector->f_slope->xydirection)>>ANGLETOFINESHIFT));
|
||||
|
||||
if (backsector && backsector->c_slope)
|
||||
ceilingbackslide = FixedMul(backsector->c_slope->zdelta, FINECOSINE((lineangle-backsector->c_slope->xydirection)>>ANGLETOFINESHIFT));
|
||||
}
|
||||
if (backsector && backsector->c_slope)
|
||||
ceilingbackslide = FixedMul(backsector->c_slope->zdelta, FINECOSINE((lineangle-backsector->c_slope->xydirection)>>ANGLETOFINESHIFT));
|
||||
|
||||
if (!backsector)
|
||||
{
|
||||
@@ -1936,9 +1937,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
ds_p->sprtopclip = ds_p->sprbottomclip = NULL;
|
||||
ds_p->silhouette = 0;
|
||||
|
||||
if (
|
||||
worldbottomslope > worldlowslope ||
|
||||
worldbottom > worldlow)
|
||||
if (worldbottomslope > worldlowslope || worldbottom > worldlow)
|
||||
{
|
||||
ds_p->silhouette = SIL_BOTTOM;
|
||||
if ((backsector->f_slope ? P_GetZAt(backsector->f_slope, viewx, viewy) : backsector->floorheight) > viewz)
|
||||
@@ -1953,9 +1952,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
// ds_p->sprbottomclip = negonearray;
|
||||
}
|
||||
|
||||
if (
|
||||
worldtopslope < worldhighslope ||
|
||||
worldtop < worldhigh)
|
||||
if (worldtopslope < worldhighslope || worldtop < worldhigh)
|
||||
{
|
||||
ds_p->silhouette |= SIL_TOP;
|
||||
if ((backsector->c_slope ? P_GetZAt(backsector->c_slope, viewx, viewy) : backsector->ceilingheight) < viewz)
|
||||
@@ -2029,7 +2026,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
|| frontsector->extra_colormap != backsector->extra_colormap
|
||||
|| (frontsector->ffloors != backsector->ffloors && frontsector->tag != backsector->tag))
|
||||
{
|
||||
markceiling = true;
|
||||
markceiling = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2045,9 +2042,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
}
|
||||
|
||||
// check TOP TEXTURE
|
||||
if (worldhigh < worldtop
|
||||
|| worldhighslope < worldtopslope
|
||||
)
|
||||
if (worldhigh < worldtop || worldhighslope < worldtopslope)
|
||||
{
|
||||
fixed_t texheight;
|
||||
// top texture
|
||||
@@ -2124,7 +2119,6 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
// Used for height comparisons and etc across FOFs and slopes
|
||||
fixed_t high1, highslope1, low1, lowslope1, high2, highslope2, low2, lowslope2;
|
||||
|
||||
//markceiling = markfloor = true;
|
||||
maskedtexture = true;
|
||||
|
||||
ds_p->thicksidecol = maskedtexturecol = lastopening - rw_x;
|
||||
|
||||
+32
-27
@@ -965,7 +965,8 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
|
||||
|
||||
//
|
||||
// R_SplitSprite
|
||||
// runs through a sector's lightlist and
|
||||
// runs through a sector's lightlist and splits the sprite according to the heights
|
||||
//
|
||||
static void R_SplitSprite(vissprite_t *sprite, mobj_t *thing)
|
||||
{
|
||||
INT32 i, lightnum, lindex;
|
||||
@@ -1142,7 +1143,9 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
vissprite_t *vis;
|
||||
|
||||
angle_t ang = 0; // gcc 4.6 and lower fix
|
||||
#ifdef ROTSPRITE
|
||||
angle_t camang = 0;
|
||||
#endif
|
||||
fixed_t iscale;
|
||||
fixed_t scalestep; // toast '16
|
||||
fixed_t offset, offset2;
|
||||
@@ -1163,7 +1166,6 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
#ifdef ROTSPRITE
|
||||
patch_t *rotsprite = NULL;
|
||||
INT32 rollangle = 0;
|
||||
angle_t rollsum = 0;
|
||||
angle_t pitchnroll = 0;
|
||||
angle_t sliptiderollangle = 0;
|
||||
#endif
|
||||
@@ -1206,7 +1208,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
tx = -(gyt + gxt);
|
||||
|
||||
// too far off the side?
|
||||
if (!papersprite && abs(tx) > tz<<2) // papersprite clipping is handled later
|
||||
if (!papersprite && abs(tx) > (INT64)tz<<2) // papersprite clipping is handled later
|
||||
return;
|
||||
|
||||
// aspect ratio stuff
|
||||
@@ -1219,7 +1221,13 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
I_Error("R_ProjectSprite: invalid sprite number %d ", thing->sprite);
|
||||
#endif
|
||||
|
||||
rot = thing->frame&FF_FRAMEMASK;
|
||||
rot = (thing->frame & FF_FRAMEMASK);
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
// determine here if sprite should rotate for optimization
|
||||
const boolean sliprollrotate = (cv_sloperoll.value && cv_sliptideroll.value && (thing->player && thing->player->sliproll));
|
||||
const boolean shouldrotate = (cv_sloperoll.value && (interp.roll || interp.pitch || interp.sloperoll || interp.slopepitch || thing->rollangle || sliprollrotate));
|
||||
#endif
|
||||
|
||||
//Fab : 02-08-98: 'skin' override spritedef currently used for skin
|
||||
if ((thing->skin || thing->localskin) && thing->sprite == SPR_PLAY)
|
||||
@@ -1250,7 +1258,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
#ifdef ROTSPRITE
|
||||
sprinfo = &spriteinfo[thing->sprite];
|
||||
#endif
|
||||
rot = thing->frame&FF_FRAMEMASK;
|
||||
rot = (thing->frame & FF_FRAMEMASK);
|
||||
if (!thing->skin)
|
||||
{
|
||||
thing->state->sprite = thing->sprite;
|
||||
@@ -1265,10 +1273,17 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
I_Error("R_ProjectSprite: sprframes NULL for sprite %d\n", thing->sprite);
|
||||
#endif
|
||||
|
||||
if (sprframe->rotate != SRF_SINGLE || papersprite || (cv_sloperoll.value == 2 && cv_spriteroll.value))
|
||||
if (sprframe->rotate != SRF_SINGLE || papersprite ||
|
||||
#ifdef ROTSPRITE
|
||||
(shouldrotate)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
ang = R_PointToAngle (interp.x, interp.y) - interp.angle;
|
||||
camang = R_PointToAngle (interp.x, interp.y);
|
||||
ang = R_PointToAngle(interp.x, interp.y);
|
||||
#ifdef ROTSPRITE
|
||||
camang = ang;
|
||||
#endif
|
||||
ang -= interp.angle;
|
||||
|
||||
if (mirrored)
|
||||
ang = InvAngle(ang);
|
||||
@@ -1311,9 +1326,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
spr_topoffset = spritecachedinfo[lump].topoffset;
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
pitchnroll = 0; // set this to 0, non-paper sprites will affect this value
|
||||
|
||||
if (cv_spriteroll.value)
|
||||
if (shouldrotate)
|
||||
{
|
||||
if (papersprite)
|
||||
{
|
||||
@@ -1331,29 +1344,21 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
{
|
||||
// this is very messy, but it on-the-fly calculates rotations for all the
|
||||
// pitch and roll variables
|
||||
pitchnroll = FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), interp.roll) +
|
||||
FixedMul(FINESINE((ang) >> ANGLETOFINESHIFT), interp.pitch) +
|
||||
FixedMul(FINECOSINE((camang) >> ANGLETOFINESHIFT), interp.sloperoll) +
|
||||
FixedMul(FINESINE((camang) >> ANGLETOFINESHIFT), interp.slopepitch);
|
||||
|
||||
pitchnroll = R_RotationAngle(ang, camang, &interp);
|
||||
rollangle = thing->rollangle;
|
||||
}
|
||||
|
||||
if (rollangle || pitchnroll || (thing->player && thing->player->sliproll))
|
||||
if (rollangle || pitchnroll || sliprollrotate)
|
||||
{
|
||||
rollsum = pitchnroll;
|
||||
|
||||
if (thing->player)
|
||||
if (sliprollrotate)
|
||||
{
|
||||
sliptiderollangle =
|
||||
cv_sliptideroll.value ? thing->player->sliproll * (thing->player->sliptidemem) : 0;
|
||||
rollsum += thing->rollangle +
|
||||
FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), sliptiderollangle);
|
||||
sliptiderollangle = thing->player->sliproll * (thing->player->sliptidemem);
|
||||
pitchnroll += rollangle + FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), sliptiderollangle);
|
||||
}
|
||||
else
|
||||
rollsum += thing->rollangle;
|
||||
pitchnroll += rollangle;
|
||||
|
||||
rollangle = R_GetRollAngle(rollsum);
|
||||
rollangle = R_GetRollAngle(pitchnroll);
|
||||
rotsprite = Patch_GetRotatedSprite(sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, false, sprinfo, rollangle);
|
||||
|
||||
if (rotsprite != NULL)
|
||||
@@ -1664,7 +1669,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
//Fab: lumppat is the lump number of the patch to use, this is different
|
||||
// than lumpid for sprites-in-pwad : the graphics are patched
|
||||
#ifdef ROTSPRITE
|
||||
if ((rotsprite != NULL) && (cv_spriteroll.value))
|
||||
if (rotsprite != NULL)
|
||||
vis->patch = rotsprite;
|
||||
else
|
||||
#endif
|
||||
|
||||
+171
-373
@@ -652,58 +652,6 @@ void S_StartSound(const void *origin, sfxenum_t sfx_id)
|
||||
if (S_SoundDisabled())
|
||||
return;
|
||||
|
||||
if (mariomode) // Sounds change in Mario mode!
|
||||
{
|
||||
switch (sfx_id)
|
||||
{
|
||||
// case sfx_altow1:
|
||||
// case sfx_altow2:
|
||||
// case sfx_altow3:
|
||||
// case sfx_altow4:
|
||||
// sfx_id = sfx_mario8;
|
||||
// break;
|
||||
case sfx_thok:
|
||||
sfx_id = sfx_mario7;
|
||||
break;
|
||||
case sfx_pop:
|
||||
sfx_id = sfx_mario5;
|
||||
break;
|
||||
case sfx_jump:
|
||||
sfx_id = sfx_mario6;
|
||||
break;
|
||||
case sfx_shield:
|
||||
sfx_id = sfx_mario3;
|
||||
break;
|
||||
case sfx_itemup:
|
||||
sfx_id = sfx_mario4;
|
||||
break;
|
||||
// case sfx_tink:
|
||||
// sfx_id = sfx_mario1;
|
||||
// break;
|
||||
// case sfx_cgot:
|
||||
// sfx_id = sfx_mario9;
|
||||
// break;
|
||||
// case sfx_lose:
|
||||
// sfx_id = sfx_mario2;
|
||||
// break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (maptol & TOL_XMAS) // Some sounds change for xmas
|
||||
{
|
||||
switch (sfx_id)
|
||||
{
|
||||
case sfx_ideya:
|
||||
case sfx_nbmper:
|
||||
case sfx_ncitem:
|
||||
case sfx_ngdone:
|
||||
++sfx_id;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// the volume is handled 8 bits
|
||||
#ifdef HW3SOUND
|
||||
if (hws_mode != HWS_DEFAULT_MODE)
|
||||
@@ -950,7 +898,6 @@ void S_ClearSfx(void)
|
||||
|
||||
static void S_StopChannel(INT32 cnum)
|
||||
{
|
||||
INT32 i;
|
||||
channel_t *c = &channels[cnum];
|
||||
|
||||
if (c->sfxinfo)
|
||||
@@ -959,12 +906,6 @@ static void S_StopChannel(INT32 cnum)
|
||||
if (I_SoundIsPlaying(c->handle))
|
||||
I_StopSound(c->handle);
|
||||
|
||||
// check to see
|
||||
// if other channels are playing the sound
|
||||
for (i = 0; i < numofchannels; i++)
|
||||
if (cnum != i && c->sfxinfo == channels[i].sfxinfo)
|
||||
break;
|
||||
|
||||
// degrade usefulness of sound data
|
||||
c->sfxinfo->usefulness--;
|
||||
c->sfxinfo = 0;
|
||||
@@ -1317,175 +1258,191 @@ static UINT32 queue_fadeinms;
|
||||
musicdef_t *musicdefstart = NULL; // First music definition
|
||||
struct cursongcredit cursongcredit; // Currently displayed song credit info
|
||||
|
||||
//
|
||||
// search for music definition in wad
|
||||
//
|
||||
static UINT16 W_CheckForMusicDefInPwad(UINT16 wadid)
|
||||
static boolean
|
||||
ReadMusicDefFields (UINT16 wadnum, int line, char *stoken, musicdef_t **defp)
|
||||
{
|
||||
UINT16 i;
|
||||
lumpinfo_t *lump_p;
|
||||
musicdef_t *def;
|
||||
|
||||
lump_p = wadfiles[wadid]->lumpinfo;
|
||||
for (i = 0; i < wadfiles[wadid]->numlumps; i++, lump_p++)
|
||||
if (memcmp(lump_p->name, "MUSICDEF", 8) == 0)
|
||||
return i;
|
||||
|
||||
return INT16_MAX; // not found
|
||||
}
|
||||
|
||||
void S_LoadMusicDefs(UINT16 wadnum)
|
||||
{
|
||||
UINT16 lump;
|
||||
char *buf;
|
||||
char *buf2;
|
||||
char *stoken;
|
||||
char *value;
|
||||
size_t size;
|
||||
musicdef_t *def, *prev;
|
||||
UINT16 line = 1; // for better error msgs
|
||||
char *textline;
|
||||
|
||||
lump = W_CheckForMusicDefInPwad(wadnum);
|
||||
if (lump == INT16_MAX)
|
||||
return;
|
||||
|
||||
buf = W_CacheLumpNumPwad(wadnum, lump, PU_CACHE);
|
||||
size = W_LumpLengthPwad(wadnum, lump);
|
||||
|
||||
// for strtok
|
||||
buf2 = malloc(size+1);
|
||||
if (!buf2)
|
||||
I_Error("S_LoadMusicDefs: No more free memory\n");
|
||||
M_Memcpy(buf2,buf,size);
|
||||
buf2[size] = '\0';
|
||||
|
||||
def = prev = NULL;
|
||||
|
||||
stoken = strtok (buf2, "\r\n ");
|
||||
// Find music def
|
||||
while (stoken)
|
||||
if (!stricmp(stoken, "lump"))
|
||||
{
|
||||
if (!stricmp(stoken, "lump"))
|
||||
value = strtok(NULL, " ");
|
||||
if (!value)
|
||||
{
|
||||
value = strtok(NULL, "\r\n ");
|
||||
|
||||
if (!value)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "MUSICDEF: Lump '%s' is missing name. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
|
||||
stoken = strtok(NULL, "\r\n"); // skip end of line
|
||||
goto skip_lump;
|
||||
}
|
||||
|
||||
// No existing musicdefs
|
||||
if (!musicdefstart)
|
||||
{
|
||||
musicdefstart = Z_Calloc(sizeof (musicdef_t), PU_STATIC, NULL);
|
||||
STRBUFCPY(musicdefstart->name, value);
|
||||
strlwr(musicdefstart->name);
|
||||
def = musicdefstart;
|
||||
//CONS_Printf("S_LoadMusicDefs: Initialized musicdef w/ song '%s'\n", def->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
def = musicdefstart;
|
||||
|
||||
// Search if this is a replacement
|
||||
//CONS_Printf("S_LoadMusicDefs: Searching for song replacement...\n");
|
||||
while (def)
|
||||
{
|
||||
if (!stricmp(def->name, value))
|
||||
{
|
||||
//CONS_Printf("S_LoadMusicDefs: Found song replacement '%s'\n", def->name);
|
||||
break;
|
||||
}
|
||||
|
||||
prev = def;
|
||||
def = def->next;
|
||||
}
|
||||
|
||||
// Nothing found, add to the end.
|
||||
if (!def)
|
||||
{
|
||||
def = Z_Calloc(sizeof (musicdef_t), PU_STATIC, NULL);
|
||||
STRBUFCPY(def->name, value);
|
||||
strlwr(def->name);
|
||||
if (prev != NULL)
|
||||
prev->next = def;
|
||||
//CONS_Printf("S_LoadMusicDefs: Added song '%s'\n", def->name);
|
||||
}
|
||||
}
|
||||
|
||||
strncpy(def->filename, wadfiles[wadnum]->filename, 256);
|
||||
def->filename[256] = '\0';
|
||||
|
||||
skip_lump:
|
||||
stoken = strtok(NULL, "\r\n ");
|
||||
line++;
|
||||
CONS_Alert(CONS_WARNING,
|
||||
"MUSICDEF: Field '%s' is missing name. (file %s, line %d)\n",
|
||||
stoken, wadfiles[wadnum]->filename, line);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
value = strtok(NULL, "\r\n= ");
|
||||
def = S_FindMusicCredit(value);
|
||||
|
||||
if (!value)
|
||||
// Nothing found, add to the end.
|
||||
if (!def)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "MUSICDEF: Field '%s' is missing value. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
|
||||
stoken = strtok(NULL, "\r\n"); // skip end of line
|
||||
goto skip_field;
|
||||
def = Z_Calloc(sizeof (musicdef_t), PU_STATIC, NULL);
|
||||
|
||||
STRBUFCPY(def->name, value);
|
||||
strlwr(def->name);
|
||||
def->hash = quickncasehash (def->name, 6);
|
||||
|
||||
def->next = musicdefstart;
|
||||
musicdefstart = def;
|
||||
}
|
||||
|
||||
(*defp) = def;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
value = strtok(NULL, "");
|
||||
|
||||
if (value)
|
||||
{
|
||||
// Find the equals sign.
|
||||
value = strchr(value, '=');
|
||||
}
|
||||
|
||||
if (!value)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING,
|
||||
"MUSICDEF: Field '%s' is missing value. (file %s, line %d)\n",
|
||||
stoken, wadfiles[wadnum]->filename, line);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
def = (*defp);
|
||||
|
||||
if (!def)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "MUSICDEF: No music definition before field '%s'. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
|
||||
free(buf2);
|
||||
return;
|
||||
CONS_Alert(CONS_ERROR,
|
||||
"MUSICDEF: No music definition before field '%s'. (file %s, line %d)\n",
|
||||
stoken, wadfiles[wadnum]->filename, line);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Skip the equals sign.
|
||||
value++;
|
||||
|
||||
// Now skip funny whitespace.
|
||||
value += strspn(value, "\t ");
|
||||
|
||||
textline = value;
|
||||
|
||||
// turn _ into spaces.
|
||||
#define ADDDEF(field)\
|
||||
STRBUFCPY(def->field, textline);\
|
||||
for (textline = def->field; *textline; textline++)\
|
||||
if (*textline == '_') *textline = ' ';
|
||||
|
||||
if (!stricmp(stoken, "usage"))
|
||||
{
|
||||
STRBUFCPY(def->usage, value);
|
||||
for (value = def->usage; *value; value++)
|
||||
if (*value == '_') *value = ' '; // turn _ into spaces.
|
||||
//CONS_Printf("S_LoadMusicDefs: Set usage to '%s'\n", def->usage);
|
||||
ADDDEF(usage);
|
||||
}
|
||||
else if (!stricmp(stoken, "source"))
|
||||
{
|
||||
STRBUFCPY(def->source, value);
|
||||
for (value = def->source; *value; value++)
|
||||
if (*value == '_') *value = ' '; // turn _ into spaces.
|
||||
//CONS_Printf("S_LoadMusicDefs: Set source to '%s'\n", def->source);
|
||||
ADDDEF(source);
|
||||
}
|
||||
else if (!stricmp(stoken, "title"))
|
||||
{
|
||||
def->use_info = true;
|
||||
STRBUFCPY(def->title, value);
|
||||
for (value = def->title; *value; value++)
|
||||
if (*value == '_') *value = ' '; // turn _ into spaces.
|
||||
//CONS_Printf("S_LoadMusicDefs: Set source to '%s'\n", def->source);
|
||||
ADDDEF(title);
|
||||
}
|
||||
else if (!stricmp(stoken, "alttitle"))
|
||||
{
|
||||
STRBUFCPY(def->alttitle, value);
|
||||
for (value = def->alttitle; *value; value++)
|
||||
if (*value == '_') *value = ' '; // turn _ into spaces.
|
||||
//CONS_Printf("S_LoadMusicDefs: Set source to '%s'\n", def->source);
|
||||
ADDDEF(alttitle);
|
||||
}
|
||||
else if (!stricmp(stoken, "authors"))
|
||||
{
|
||||
STRBUFCPY(def->authors, value);
|
||||
for (value = def->authors; *value; value++)
|
||||
if (*value == '_') *value = ' '; // turn _ into spaces.
|
||||
//CONS_Printf("S_LoadMusicDefs: Set source to '%s'\n", def->source);
|
||||
ADDDEF(authors);
|
||||
}
|
||||
else
|
||||
CONS_Alert(CONS_WARNING, "MUSICDEF: Invalid field '%s'. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
|
||||
|
||||
skip_field:
|
||||
stoken = strtok(NULL, "\r\n= ");
|
||||
line++;
|
||||
#undef ADDDEF
|
||||
}
|
||||
}
|
||||
|
||||
free(buf2);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
void S_LoadMusicDefs(UINT16 wadnum)
|
||||
{
|
||||
UINT16 lumpnum;
|
||||
char *lump;
|
||||
char *musdeftext;
|
||||
size_t size;
|
||||
|
||||
char *lf;
|
||||
char *stoken;
|
||||
|
||||
size_t nlf;
|
||||
size_t ncr;
|
||||
|
||||
musicdef_t *def = NULL;
|
||||
int line = 1; // for better error msgs
|
||||
|
||||
for (int k = 0; k < 2; k++)
|
||||
{
|
||||
lumpnum = W_CheckNumForNamePwad((k == 1 ? "MUSCINFO" : "MUSICDEF") , wadnum, 0); //check for MUSCINFO lump on 2nd iteration
|
||||
|
||||
if (lumpnum == INT16_MAX)
|
||||
continue;
|
||||
|
||||
lump = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE);
|
||||
size = W_LumpLengthPwad(wadnum, lumpnum);
|
||||
|
||||
// Null-terminated MUSICDEF lump.
|
||||
musdeftext = malloc(size+1);
|
||||
if (!musdeftext)
|
||||
I_Error("S_LoadMusicDefs: No more free memory for the parser\n");
|
||||
M_Memcpy(musdeftext, lump, size);
|
||||
musdeftext[size] = '\0';
|
||||
|
||||
// Find music def
|
||||
stoken = musdeftext;
|
||||
for (;;)
|
||||
{
|
||||
lf = strpbrk(stoken, "\r\n");
|
||||
if (lf)
|
||||
{
|
||||
if (*lf == '\n')
|
||||
nlf = 1;
|
||||
else
|
||||
nlf = 0;
|
||||
*lf++ = '\0';/* now we can delimit to here */
|
||||
}
|
||||
|
||||
stoken = strtok(stoken, " ");
|
||||
if (stoken)
|
||||
{
|
||||
if (! ReadMusicDefFields(wadnum, line, stoken, &def))
|
||||
break;
|
||||
}
|
||||
|
||||
if (lf)
|
||||
{
|
||||
do
|
||||
{
|
||||
line += nlf;
|
||||
ncr = strspn(lf, "\r");/* skip CR */
|
||||
lf += ncr;
|
||||
nlf = strspn(lf, "\n");
|
||||
lf += nlf;
|
||||
}
|
||||
while (nlf || ncr) ;
|
||||
|
||||
stoken = lf;/* now the next nonempty line */
|
||||
}
|
||||
else
|
||||
break;/* EOF */
|
||||
}
|
||||
|
||||
free(musdeftext);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1500,164 +1457,6 @@ void S_InitMusicDefs(void)
|
||||
S_LoadMusicDefs(i);
|
||||
}
|
||||
|
||||
//
|
||||
// search for music definition in wad
|
||||
//
|
||||
static UINT16 W_CheckForMusicInfoInPwad(UINT16 wadid)
|
||||
{
|
||||
UINT16 i;
|
||||
lumpinfo_t *lump_p;
|
||||
|
||||
lump_p = wadfiles[wadid]->lumpinfo;
|
||||
for (i = 0; i < wadfiles[wadid]->numlumps; i++, lump_p++)
|
||||
if (memcmp(lump_p->name, "MUSCINFO", 8) == 0)
|
||||
return i;
|
||||
|
||||
return INT16_MAX; // not found
|
||||
}
|
||||
|
||||
void S_LoadMTDefs(UINT16 wadnum)
|
||||
{
|
||||
UINT16 lump;
|
||||
char *buf;
|
||||
char *buf2;
|
||||
char *stoken;
|
||||
char *value;
|
||||
size_t size;
|
||||
musicdef_t *def, *prev;
|
||||
UINT16 line = 1; // for better error msgs
|
||||
|
||||
lump = W_CheckForMusicInfoInPwad(wadnum);
|
||||
if (lump == INT16_MAX)
|
||||
return;
|
||||
|
||||
buf = W_CacheLumpNumPwad(wadnum, lump, PU_CACHE);
|
||||
size = W_LumpLengthPwad(wadnum, lump);
|
||||
|
||||
// for strtok
|
||||
buf2 = malloc(size+1);
|
||||
if (!buf2)
|
||||
I_Error("S_LoadMTDefs: No more free memory\n");
|
||||
M_Memcpy(buf2,buf,size);
|
||||
buf2[size] = '\0';
|
||||
|
||||
def = prev = NULL;
|
||||
|
||||
stoken = strtok (buf2, "\r\n ");
|
||||
// Find music def
|
||||
while (stoken)
|
||||
{
|
||||
if (!stricmp(stoken, "lump"))
|
||||
{
|
||||
value = strtok(NULL, "\r\n ");
|
||||
|
||||
if (!value)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "MUSICDEF: Lump '%s' is missing name. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
|
||||
stoken = strtok(NULL, "\r\n"); // skip end of line
|
||||
goto skip_lump;
|
||||
}
|
||||
|
||||
// No existing musicdefs
|
||||
if (!musicdefstart)
|
||||
{
|
||||
musicdefstart = Z_Calloc(sizeof (musicdef_t), PU_STATIC, NULL);
|
||||
STRBUFCPY(musicdefstart->name, value);
|
||||
strlwr(musicdefstart->name);
|
||||
def = musicdefstart;
|
||||
//CONS_Printf("S_LoadMusicDefs: Initialized musicdef w/ song '%s'\n", def->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
def = musicdefstart;
|
||||
|
||||
// Search if this is a replacement
|
||||
//CONS_Printf("S_LoadMusicDefs: Searching for song replacement...\n");
|
||||
while (def)
|
||||
{
|
||||
if (!stricmp(def->name, value))
|
||||
{
|
||||
//CONS_Printf("S_LoadMusicDefs: Found song replacement '%s'\n", def->name);
|
||||
break;
|
||||
}
|
||||
|
||||
prev = def;
|
||||
def = def->next;
|
||||
}
|
||||
|
||||
// Nothing found, abort.
|
||||
if (!def)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "MUSCINFO: Music def for '%s' does not exist. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
|
||||
free(buf2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
skip_lump:
|
||||
stoken = strtok(NULL, "\r\n ");
|
||||
line++;
|
||||
}
|
||||
else
|
||||
{
|
||||
value = strtok(NULL, "\r\n= ");
|
||||
|
||||
if (!value)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "MUSCINFO: Field '%s' is missing value. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
|
||||
stoken = strtok(NULL, "\r\n"); // skip end of line
|
||||
goto skip_field;
|
||||
}
|
||||
|
||||
if (!def)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "MUSCINFO: No music definition before field '%s'. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
|
||||
free(buf2);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!stricmp(stoken, "title"))
|
||||
{
|
||||
def->use_info = true;
|
||||
STRBUFCPY(def->title, value);
|
||||
for (value = def->title; *value; value++)
|
||||
if (*value == '_') *value = ' '; // turn _ into spaces.
|
||||
//CONS_Printf("S_LoadMusicDefs: Set source to '%s'\n", def->source);
|
||||
}
|
||||
else if (!stricmp(stoken, "alttitle"))
|
||||
{
|
||||
STRBUFCPY(def->alttitle, value);
|
||||
for (value = def->alttitle; *value; value++)
|
||||
if (*value == '_') *value = ' '; // turn _ into spaces.
|
||||
//CONS_Printf("S_LoadMusicDefs: Set source to '%s'\n", def->source);
|
||||
}
|
||||
else if (!stricmp(stoken, "authors"))
|
||||
{
|
||||
STRBUFCPY(def->authors, value);
|
||||
for (value = def->authors; *value; value++)
|
||||
if (*value == '_') *value = ' '; // turn _ into spaces.
|
||||
//CONS_Printf("S_LoadMusicDefs: Set source to '%s'\n", def->source);
|
||||
}
|
||||
else
|
||||
CONS_Alert(CONS_WARNING, "MUSCINFO: Invalid field '%s'. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
|
||||
|
||||
skip_field:
|
||||
stoken = strtok(NULL, "\r\n= ");
|
||||
line++;
|
||||
}
|
||||
}
|
||||
|
||||
free(buf2);
|
||||
return;
|
||||
}
|
||||
|
||||
void S_InitMTDefs(void)
|
||||
{
|
||||
UINT16 i;
|
||||
for (i = 0; i < numwadfiles; i++)
|
||||
S_LoadMTDefs(i);
|
||||
}
|
||||
|
||||
//
|
||||
// S_FindMusicCredit
|
||||
//
|
||||
@@ -1665,19 +1464,17 @@ void S_InitMTDefs(void)
|
||||
//
|
||||
musicdef_t *S_FindMusicCredit(const char *musname)
|
||||
{
|
||||
musicdef_t *def = musicdefstart;
|
||||
UINT32 hash = quickncasehash (musname, 6);
|
||||
musicdef_t *def;
|
||||
|
||||
if (!def) // No definitions
|
||||
return NULL;
|
||||
|
||||
while (def)
|
||||
for (def = musicdefstart; def; def = def->next)
|
||||
{
|
||||
if (!stricmp(def->name, musname))
|
||||
{
|
||||
return def;
|
||||
}
|
||||
else
|
||||
def = def->next;
|
||||
if (hash != def->hash)
|
||||
continue;
|
||||
if (stricmp(def->name, musname))
|
||||
continue;
|
||||
|
||||
return def;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -2191,11 +1988,11 @@ static boolean oldencore = false;
|
||||
static boolean skipmusic = false;
|
||||
boolean skipintromus = false;
|
||||
|
||||
static const char *musicexception_list[16] = {
|
||||
static const char *musicexception_list[17] = {
|
||||
"vote", "voteea", "voteeb", "racent", "krwin",
|
||||
"krok", "krlose", "krfail", "kbwin", "kbok",
|
||||
"kblose", "kstart", "estart", "wait2j", "CHRSHP",
|
||||
"CHRSHF"
|
||||
"kblose", "kstart", "estart", "wait2j", "titles",
|
||||
"CHRSHF", "CHRSHP" // no clue what those are tbh
|
||||
};
|
||||
|
||||
//checks for any kind of event music like intermission, vote etc.
|
||||
@@ -2207,7 +2004,7 @@ static void S_CheckEventMus(const char *newmus)
|
||||
if (!cv_keepmusic.value)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
for (int i = 0; i < 17; i++)
|
||||
if (stricmp(music_name, musicexception_list[i]) == 0 || stricmp(newmus, musicexception_list[i]) == 0) // weird? sure! but were lucky enough newmus reflects whats being replaced
|
||||
{
|
||||
skipmusic = true;
|
||||
@@ -2242,15 +2039,7 @@ void S_CheckMap(void)
|
||||
//
|
||||
void S_InitMapMusic(void)
|
||||
{
|
||||
if (!cv_skipintromusic.value)
|
||||
skipintromus = false;
|
||||
else
|
||||
{
|
||||
char *maptitle = G_BuildMapTitle(gamemap);
|
||||
skipintromus = cv_skipintromusic.value && stricmp(maptitle, "Wandering Falls") != 0; // thanks diggle!
|
||||
if (maptitle)
|
||||
Z_Free(maptitle);
|
||||
}
|
||||
skipintromus = false;
|
||||
|
||||
if (mapmusflags & MUSIC_RELOADRESET)
|
||||
{
|
||||
@@ -2268,6 +2057,15 @@ void S_InitMapMusic(void)
|
||||
// lug: but not when we keep the map music lol
|
||||
S_StopMusic();
|
||||
|
||||
if (cv_skipintromusic.value)
|
||||
{
|
||||
char *maptitle = G_BuildMapTitle(gamemap);
|
||||
// for some reason, occasionally the title screen music doesent seem to be reset in time, so skipping the intro may make it just continue playing it instead, weird..
|
||||
skipintromus = (stricmp(music_name, "titles") != 0) && (stricmp(maptitle, "Wandering Falls") != 0); // thanks diggle!
|
||||
if (maptitle)
|
||||
Z_Free(maptitle);
|
||||
}
|
||||
|
||||
if (skipintromus)
|
||||
return;
|
||||
|
||||
|
||||
@@ -168,6 +168,7 @@ boolean S_SpeedMusic(float speed);
|
||||
typedef struct musicdef_s
|
||||
{
|
||||
char name[7];
|
||||
UINT32 hash;
|
||||
char usage[256];
|
||||
char source[256];
|
||||
char filename[256+1];
|
||||
|
||||
+5
-2
@@ -273,10 +273,13 @@ void SCR_Recalc(void)
|
||||
vid.fsmalldupy = vid.smalldupy*FRACUNIT;
|
||||
#endif
|
||||
|
||||
// toggle off automap because some screensize-dependent values will
|
||||
// toggle off (then back on) the automap because some screensize-dependent values will
|
||||
// be calculated next time the automap is activated.
|
||||
if (automapactive)
|
||||
AM_Stop();
|
||||
{
|
||||
am_recalc = true;
|
||||
AM_Start();
|
||||
}
|
||||
|
||||
// set the screen[x] ptrs on the new vidbuffers
|
||||
V_Init();
|
||||
|
||||
+144
-1335
File diff suppressed because it is too large.
Load diff
+190
-382
@@ -667,98 +667,70 @@ static INT32 SDLJoyAxis(const Sint16 axis, evtype_t which)
|
||||
{
|
||||
// -32768 to 32767
|
||||
INT32 raxis = axis/32;
|
||||
UINT8 pid;
|
||||
|
||||
if (which == ev_joystick)
|
||||
{
|
||||
if (Joystick.bGamepadStyle)
|
||||
{
|
||||
// gamepad control type, on or off, live or die
|
||||
if (raxis < -(JOYAXISRANGE/2))
|
||||
raxis = -1;
|
||||
else if (raxis > (JOYAXISRANGE/2))
|
||||
raxis = 1;
|
||||
else
|
||||
raxis = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
raxis = JoyInfo.scale!=1?((raxis/JoyInfo.scale)*JoyInfo.scale):raxis;
|
||||
|
||||
#ifdef SDL_JDEADZONE
|
||||
if (-SDL_JDEADZONE <= raxis && raxis <= SDL_JDEADZONE)
|
||||
raxis = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
pid = 0;
|
||||
else if (which == ev_joystick2)
|
||||
{
|
||||
if (Joystick2.bGamepadStyle)
|
||||
{
|
||||
// gamepad control type, on or off, live or die
|
||||
if (raxis < -(JOYAXISRANGE/2))
|
||||
raxis = -1;
|
||||
else if (raxis > (JOYAXISRANGE/2))
|
||||
raxis = 1;
|
||||
else raxis = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
raxis = JoyInfo2.scale!=1?((raxis/JoyInfo2.scale)*JoyInfo2.scale):raxis;
|
||||
|
||||
#ifdef SDL_JDEADZONE
|
||||
if (-SDL_JDEADZONE <= raxis && raxis <= SDL_JDEADZONE)
|
||||
raxis = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
pid = 1;
|
||||
else if (which == ev_joystick3)
|
||||
{
|
||||
if (Joystick3.bGamepadStyle)
|
||||
{
|
||||
// gamepad control type, on or off, live or die
|
||||
if (raxis < -(JOYAXISRANGE/2))
|
||||
raxis = -1;
|
||||
else if (raxis > (JOYAXISRANGE/2))
|
||||
raxis = 1;
|
||||
else raxis = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
raxis = JoyInfo3.scale!=1?((raxis/JoyInfo3.scale)*JoyInfo3.scale):raxis;
|
||||
|
||||
#ifdef SDL_JDEADZONE
|
||||
if (-SDL_JDEADZONE <= raxis && raxis <= SDL_JDEADZONE)
|
||||
raxis = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
pid = 2;
|
||||
else if (which == ev_joystick4)
|
||||
pid = 3;
|
||||
else
|
||||
return 0;
|
||||
|
||||
if (Joystick[pid].bGamepadStyle)
|
||||
{
|
||||
if (Joystick4.bGamepadStyle)
|
||||
{
|
||||
// gamepad control type, on or off, live or die
|
||||
if (raxis < -(JOYAXISRANGE/2))
|
||||
raxis = -1;
|
||||
else if (raxis > (JOYAXISRANGE/2))
|
||||
raxis = 1;
|
||||
else raxis = 0;
|
||||
}
|
||||
// gamepad control type, on or off, live or die
|
||||
if (raxis < -(JOYAXISRANGE/2))
|
||||
raxis = -1;
|
||||
else if (raxis > (JOYAXISRANGE/2))
|
||||
raxis = 1;
|
||||
else
|
||||
{
|
||||
raxis = JoyInfo4.scale!=1?((raxis/JoyInfo4.scale)*JoyInfo4.scale):raxis;
|
||||
raxis = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
raxis = JoyInfo[pid].scale!=1?((raxis/JoyInfo[pid].scale)*JoyInfo[pid].scale):raxis;
|
||||
|
||||
#ifdef SDL_JDEADZONE
|
||||
if (-SDL_JDEADZONE <= raxis && raxis <= SDL_JDEADZONE)
|
||||
raxis = 0;
|
||||
if (-SDL_JDEADZONE <= raxis && raxis <= SDL_JDEADZONE)
|
||||
raxis = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return raxis;
|
||||
}
|
||||
|
||||
boolean I_CheckNativeRes(void)
|
||||
{
|
||||
static int oldwidth = 0, oldheight = 0;
|
||||
static boolean resstate = false;
|
||||
int currentDisplayIndex = 0;
|
||||
SDL_DisplayMode curmode;
|
||||
|
||||
if (oldwidth == vid.width && oldheight == vid.height)
|
||||
{
|
||||
return resstate;
|
||||
}
|
||||
|
||||
currentDisplayIndex = SDL_GetWindowDisplayIndex(window);
|
||||
|
||||
if (SDL_GetCurrentDisplayMode(currentDisplayIndex, &curmode) != 0)
|
||||
{
|
||||
return resstate;
|
||||
}
|
||||
|
||||
resstate = ((vid.width == curmode.w) && (vid.height == curmode.h));
|
||||
oldwidth = vid.width;
|
||||
oldheight = vid.height;
|
||||
return resstate;
|
||||
}
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
void I_DownSample(void)
|
||||
{
|
||||
if (!cv_glframebuffer.value || !supportFBO) //no sense to do this crap if we cant benefit from it
|
||||
if (!cv_glframebuffer.value || !supportFBO || I_CheckNativeRes()) //no sense to do this crap if we cant benefit from it
|
||||
{
|
||||
downsample = false;
|
||||
return;
|
||||
@@ -809,7 +781,7 @@ static void I_FixXwaylandNvidia(void) //dumbass crap, fix ur shit nvidia
|
||||
|
||||
static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
|
||||
{
|
||||
#define FOCUSUNION (mousefocus | (kbfocus << 1))
|
||||
#define FOCUSUNION (mousefocus | (kbfocus << 1) | (windowmoved << 2))
|
||||
static SDL_bool firsttimeonmouse = SDL_TRUE;
|
||||
static SDL_bool mousefocus = SDL_TRUE;
|
||||
static SDL_bool kbfocus = SDL_TRUE;
|
||||
@@ -1037,12 +1009,13 @@ static void Impl_HandleControllerAxisEvent(SDL_ControllerAxisEvent evt)
|
||||
event_t event;
|
||||
SDL_JoystickID joyid[4];
|
||||
INT32 value;
|
||||
UINT8 i;
|
||||
|
||||
// Determine the Joystick IDs for each current open joystick
|
||||
joyid[0] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo.dev));
|
||||
joyid[1] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo2.dev));
|
||||
joyid[2] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo3.dev));
|
||||
joyid[3] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo4.dev));
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
joyid[i] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo[i].dev));
|
||||
}
|
||||
|
||||
event.data1 = event.data2 = event.data3 = INT32_MAX;
|
||||
|
||||
@@ -1063,9 +1036,11 @@ static void Impl_HandleControllerAxisEvent(SDL_ControllerAxisEvent evt)
|
||||
event.type = ev_joystick4;
|
||||
}
|
||||
else return;
|
||||
|
||||
//axis
|
||||
if (evt.axis > JOYAXISSET*2)
|
||||
return;
|
||||
|
||||
//vaule
|
||||
value = SDLJoyAxis(evt.value, event.type);
|
||||
switch (evt.axis)
|
||||
@@ -1100,43 +1075,17 @@ static void Impl_HandleControllerAxisEvent(SDL_ControllerAxisEvent evt)
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void Impl_HandleJoystickHatEvent(SDL_JoyHatEvent evt)
|
||||
{
|
||||
event_t event;
|
||||
SDL_JoystickID joyid[2];
|
||||
|
||||
// Determine the Joystick IDs for each current open joystick
|
||||
joyid[0] = SDL_JoystickInstanceID(JoyInfo.dev);
|
||||
joyid[1] = SDL_JoystickInstanceID(JoyInfo2.dev);
|
||||
|
||||
if (evt.hat >= JOYHATS)
|
||||
return; // ignore hats with too high an index
|
||||
|
||||
if (evt.which == joyid[0])
|
||||
{
|
||||
event.data1 = KEY_HAT1 + (evt.hat*4);
|
||||
}
|
||||
else if (evt.which == joyid[1])
|
||||
{
|
||||
event.data1 = KEY_2HAT1 + (evt.hat*4);
|
||||
}
|
||||
else return;
|
||||
|
||||
// NOTE: UNFINISHED
|
||||
}
|
||||
#endif
|
||||
|
||||
static void Impl_HandleControllerButtonEvent(SDL_ControllerButtonEvent evt, Uint32 type)
|
||||
{
|
||||
event_t event;
|
||||
SDL_JoystickID joyid[4];
|
||||
UINT8 i;
|
||||
|
||||
// Determine the Joystick IDs for each current open joystick
|
||||
joyid[0] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo.dev));
|
||||
joyid[1] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo2.dev));
|
||||
joyid[2] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo3.dev));
|
||||
joyid[3] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo4.dev));
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
joyid[i] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo[i].dev));
|
||||
}
|
||||
|
||||
if (evt.button == SDL_CONTROLLER_BUTTON_DPAD_UP
|
||||
|| evt.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN
|
||||
@@ -1183,8 +1132,6 @@ static void Impl_HandleControllerButtonEvent(SDL_ControllerButtonEvent evt, Uint
|
||||
if (event.type != ev_console) D_PostEvent(&event);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void I_GetEvent(void)
|
||||
{
|
||||
SDL_Event evt;
|
||||
@@ -1192,6 +1139,7 @@ void I_GetEvent(void)
|
||||
// We only want the first motion event,
|
||||
// otherwise we'll end up catching the warp back to center.
|
||||
//int mouseMotionOnce = 0;
|
||||
INT32 i;
|
||||
|
||||
if (!graphics_started)
|
||||
{
|
||||
@@ -1257,77 +1205,42 @@ void I_GetEvent(void)
|
||||
// * BUT: If that default index is being occupied, use ANOTHER cv_usejoystick's default value!
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////
|
||||
// PLAYER 1
|
||||
//////////////////////////////
|
||||
|
||||
if (newcontroller && (!JoyInfo.dev || !SDL_GameControllerGetAttached(JoyInfo.dev))
|
||||
&& JoyInfo2.dev != newcontroller && JoyInfo3.dev != newcontroller && JoyInfo4.dev != newcontroller) // don't override a currently active device
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
cv_usejoystick.value = evt.cdevice.which + 1;
|
||||
I_UpdateJoystickDeviceIndices(1);
|
||||
}
|
||||
if (newcontroller && (!JoyInfo[i].dev || !SDL_GameControllerGetAttached(JoyInfo[i].dev)))
|
||||
{
|
||||
UINT8 j;
|
||||
|
||||
//////////////////////////////
|
||||
// PLAYER 2
|
||||
//////////////////////////////
|
||||
for (j = 0; j < MAXSPLITSCREENPLAYERS; j++)
|
||||
{
|
||||
if (i == j)
|
||||
continue;
|
||||
|
||||
else if (newcontroller && (!JoyInfo2.dev || !SDL_GameControllerGetAttached(JoyInfo2.dev))
|
||||
&& JoyInfo.dev != newcontroller && JoyInfo3.dev != newcontroller && JoyInfo4.dev != newcontroller) // don't override a currently active device
|
||||
{
|
||||
cv_usejoystick2.value = evt.cdevice.which + 1;
|
||||
I_UpdateJoystickDeviceIndices(2);
|
||||
}
|
||||
if (JoyInfo[j].dev == newcontroller)
|
||||
break;
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
// PLAYER 3
|
||||
//////////////////////////////
|
||||
|
||||
else if (newcontroller && (!JoyInfo3.dev || !SDL_GameControllerGetAttached(JoyInfo3.dev))
|
||||
&& JoyInfo.dev != newcontroller && JoyInfo2.dev != newcontroller && JoyInfo4.dev != newcontroller) // don't override a currently active device
|
||||
{
|
||||
cv_usejoystick3.value = evt.cdevice.which + 1;
|
||||
I_UpdateJoystickDeviceIndices(3);
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
// PLAYER 4
|
||||
//////////////////////////////
|
||||
|
||||
else if (newcontroller && (!JoyInfo4.dev || !SDL_GameControllerGetAttached(JoyInfo4.dev))
|
||||
&& JoyInfo.dev != newcontroller && JoyInfo2.dev != newcontroller && JoyInfo3.dev != newcontroller) // don't override a currently active device
|
||||
{
|
||||
cv_usejoystick4.value = evt.cdevice.which + 1;
|
||||
I_UpdateJoystickDeviceIndices(4);
|
||||
if (j == MAXSPLITSCREENPLAYERS)
|
||||
{
|
||||
// ensures we aren't overriding a currently active device
|
||||
cv_usejoystick[i].value = evt.jdevice.which + 1;
|
||||
I_UpdateJoystickDeviceIndices(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Was cv_usejoystick disabled in settings?
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
if (!strcmp(cv_usejoystick.string, "0") || !cv_usejoystick.value)
|
||||
cv_usejoystick.value = 0;
|
||||
else if (atoi(cv_usejoystick.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
|
||||
&& cv_usejoystick.value) // update the cvar ONLY if a device exists
|
||||
CV_SetValue(&cv_usejoystick, cv_usejoystick.value);
|
||||
|
||||
if (!strcmp(cv_usejoystick2.string, "0") || !cv_usejoystick2.value)
|
||||
cv_usejoystick2.value = 0;
|
||||
else if (atoi(cv_usejoystick2.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
|
||||
&& cv_usejoystick2.value) // update the cvar ONLY if a device exists
|
||||
CV_SetValue(&cv_usejoystick2, cv_usejoystick2.value);
|
||||
|
||||
if (!strcmp(cv_usejoystick3.string, "0") || !cv_usejoystick3.value)
|
||||
cv_usejoystick3.value = 0;
|
||||
else if (atoi(cv_usejoystick3.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
|
||||
&& cv_usejoystick3.value) // update the cvar ONLY if a device exists
|
||||
CV_SetValue(&cv_usejoystick3, cv_usejoystick3.value);
|
||||
|
||||
if (!strcmp(cv_usejoystick4.string, "0") || !cv_usejoystick4.value)
|
||||
cv_usejoystick4.value = 0;
|
||||
else if (atoi(cv_usejoystick4.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
|
||||
&& cv_usejoystick4.value) // update the cvar ONLY if a device exists
|
||||
CV_SetValue(&cv_usejoystick4, cv_usejoystick4.value);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
if (!strcmp(cv_usejoystick[i].string, "0") || !cv_usejoystick[i].value)
|
||||
cv_usejoystick[i].value = 0;
|
||||
else if (atoi(cv_usejoystick[i].string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
|
||||
&& cv_usejoystick[i].value) // update the cvar ONLY if a device exists
|
||||
CV_SetValue(&cv_usejoystick[i], cv_usejoystick[i].value);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Update all joysticks' init states
|
||||
@@ -1336,23 +1249,25 @@ void I_GetEvent(void)
|
||||
// if the device is already active, this should do nothing, effectively.
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
I_InitJoystick();
|
||||
I_InitJoystick2();
|
||||
I_InitJoystick3();
|
||||
I_InitJoystick4();
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
I_InitJoystick(i);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick1 device index: %d\n", JoyInfo.oldjoy);
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick2 device index: %d\n", JoyInfo2.oldjoy);
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick3 device index: %d\n", JoyInfo3.oldjoy);
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick4 device index: %d\n", JoyInfo4.oldjoy);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick%d device index: %d\n", i+1, JoyInfo[i].oldjoy);
|
||||
|
||||
// update the menu
|
||||
if (currentMenu == &OP_JoystickSetDef)
|
||||
M_SetupJoystickMenu(0);
|
||||
|
||||
if (JoyInfo.dev != newcontroller && JoyInfo2.dev != newcontroller && JoyInfo3.dev != newcontroller && JoyInfo4.dev != newcontroller)
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
if (JoyInfo[i].dev == newcontroller)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == MAXSPLITSCREENPLAYERS)
|
||||
SDL_GameControllerClose(newcontroller);
|
||||
}
|
||||
break;
|
||||
@@ -1360,28 +1275,13 @@ void I_GetEvent(void)
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
case SDL_CONTROLLERDEVICEREMOVED:
|
||||
if (JoyInfo.dev && !SDL_GameControllerGetAttached(JoyInfo.dev))
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick1 removed, device index: %d\n", JoyInfo.oldjoy);
|
||||
I_ShutdownJoystick();
|
||||
}
|
||||
|
||||
if (JoyInfo2.dev && !SDL_GameControllerGetAttached(JoyInfo2.dev))
|
||||
{
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick2 removed, device index: %d\n", JoyInfo2.oldjoy);
|
||||
I_ShutdownJoystick2();
|
||||
}
|
||||
|
||||
if (JoyInfo3.dev && !SDL_GameControllerGetAttached(JoyInfo3.dev))
|
||||
{
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick3 removed, device index: %d\n", JoyInfo3.oldjoy);
|
||||
I_ShutdownJoystick3();
|
||||
}
|
||||
|
||||
if (JoyInfo4.dev && !SDL_GameControllerGetAttached(JoyInfo4.dev))
|
||||
{
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick4 removed, device index: %d\n", JoyInfo4.oldjoy);
|
||||
I_ShutdownJoystick4();
|
||||
if (JoyInfo[i].dev && !SDL_GameControllerGetAttached(JoyInfo[i].dev))
|
||||
{
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick%d removed, device index: %d\n", i+1, JoyInfo[i].oldjoy);
|
||||
I_ShutdownJoystick(i);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -1390,124 +1290,32 @@ void I_GetEvent(void)
|
||||
// * BUT: If that default index is being occupied, use ANOTHER cv_usejoystick's default value!
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
if (JoyInfo.dev)
|
||||
cv_usejoystick.value = JoyInfo.oldjoy = I_GetJoystickDeviceIndex(JoyInfo.dev) + 1;
|
||||
else if (atoi(cv_usejoystick.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick.value = atoi(cv_usejoystick.string);
|
||||
else if (atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick.value = atoi(cv_usejoystick2.string);
|
||||
else if (atoi(cv_usejoystick3.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick.value = atoi(cv_usejoystick3.string);
|
||||
else if (atoi(cv_usejoystick4.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick.value = atoi(cv_usejoystick4.string);
|
||||
else // we tried...
|
||||
cv_usejoystick.value = 0;
|
||||
|
||||
if (JoyInfo2.dev)
|
||||
cv_usejoystick2.value = JoyInfo2.oldjoy = I_GetJoystickDeviceIndex(JoyInfo2.dev) + 1;
|
||||
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick2.value = atoi(cv_usejoystick.string);
|
||||
else if (atoi(cv_usejoystick2.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick2.value = atoi(cv_usejoystick2.string);
|
||||
else if (atoi(cv_usejoystick3.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick2.value = atoi(cv_usejoystick3.string);
|
||||
else if (atoi(cv_usejoystick4.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick2.value = atoi(cv_usejoystick4.string);
|
||||
else // we tried...
|
||||
cv_usejoystick2.value = 0;
|
||||
|
||||
if (JoyInfo3.dev)
|
||||
cv_usejoystick3.value = JoyInfo3.oldjoy = I_GetJoystickDeviceIndex(JoyInfo3.dev) + 1;
|
||||
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick3.value = atoi(cv_usejoystick.string);
|
||||
else if (atoi(cv_usejoystick2.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick3.value = atoi(cv_usejoystick2.string);
|
||||
else if (atoi(cv_usejoystick3.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick3.value = atoi(cv_usejoystick3.string);
|
||||
else if (atoi(cv_usejoystick4.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick3.value = atoi(cv_usejoystick4.string);
|
||||
else // we tried...
|
||||
cv_usejoystick3.value = 0;
|
||||
|
||||
if (JoyInfo4.dev)
|
||||
cv_usejoystick4.value = JoyInfo4.oldjoy = I_GetJoystickDeviceIndex(JoyInfo4.dev) + 1;
|
||||
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo3.oldjoy)
|
||||
cv_usejoystick4.value = atoi(cv_usejoystick.string);
|
||||
else if (atoi(cv_usejoystick2.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo3.oldjoy)
|
||||
cv_usejoystick4.value = atoi(cv_usejoystick2.string);
|
||||
else if (atoi(cv_usejoystick3.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy)
|
||||
cv_usejoystick4.value = atoi(cv_usejoystick3.string);
|
||||
else if (atoi(cv_usejoystick4.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo3.oldjoy)
|
||||
cv_usejoystick4.value = atoi(cv_usejoystick4.string);
|
||||
else // we tried...
|
||||
cv_usejoystick4.value = 0;
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
I_UpdateJoystickDeviceIndex(i);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Was cv_usejoystick disabled in settings?
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
if (!strcmp(cv_usejoystick.string, "0"))
|
||||
cv_usejoystick.value = 0;
|
||||
else if (atoi(cv_usejoystick.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
|
||||
&& cv_usejoystick.value) // update the cvar ONLY if a device exists
|
||||
CV_SetValue(&cv_usejoystick, cv_usejoystick.value);
|
||||
|
||||
if (!strcmp(cv_usejoystick2.string, "0"))
|
||||
cv_usejoystick2.value = 0;
|
||||
else if (atoi(cv_usejoystick2.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
|
||||
&& cv_usejoystick2.value) // update the cvar ONLY if a device exists
|
||||
CV_SetValue(&cv_usejoystick2, cv_usejoystick2.value);
|
||||
|
||||
if (!strcmp(cv_usejoystick3.string, "0"))
|
||||
cv_usejoystick3.value = 0;
|
||||
else if (atoi(cv_usejoystick3.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
|
||||
&& cv_usejoystick3.value) // update the cvar ONLY if a device exists
|
||||
CV_SetValue(&cv_usejoystick3, cv_usejoystick3.value);
|
||||
|
||||
if (!strcmp(cv_usejoystick4.string, "0"))
|
||||
cv_usejoystick4.value = 0;
|
||||
else if (atoi(cv_usejoystick4.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
|
||||
&& cv_usejoystick4.value) // update the cvar ONLY if a device exists
|
||||
CV_SetValue(&cv_usejoystick4, cv_usejoystick4.value);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
if (!strcmp(cv_usejoystick[i].string, "0"))
|
||||
{
|
||||
cv_usejoystick[i].value = 0;
|
||||
}
|
||||
else if (atoi(cv_usejoystick[i].string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
|
||||
&& cv_usejoystick[i].value) // update the cvar ONLY if a device exists
|
||||
{
|
||||
CV_SetValue(&cv_usejoystick[i], cv_usejoystick[i].value);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick1 device index: %d\n", JoyInfo.oldjoy);
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick2 device index: %d\n", JoyInfo2.oldjoy);
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick3 device index: %d\n", JoyInfo3.oldjoy);
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick4 device index: %d\n", JoyInfo4.oldjoy);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick%d device index: %d\n", i+1, JoyInfo[i].oldjoy);
|
||||
|
||||
// update the menu
|
||||
if (currentMenu == &OP_JoystickSetDef)
|
||||
@@ -1569,16 +1377,15 @@ void I_StartupMouse(void)
|
||||
void I_OsPolling(void)
|
||||
{
|
||||
SDL_Keymod mod;
|
||||
INT32 i;
|
||||
|
||||
if (consolevent)
|
||||
I_GetConsoleEvents();
|
||||
if (SDL_WasInit(SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER) == (SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER))
|
||||
{
|
||||
SDL_GameControllerUpdate();
|
||||
I_GetJoystickEvents();
|
||||
I_GetJoystick2Events();
|
||||
I_GetJoystick3Events();
|
||||
I_GetJoystick4Events();
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
I_GetJoystickEvents(i);
|
||||
}
|
||||
|
||||
I_GetMouseEvents();
|
||||
@@ -2217,27 +2024,27 @@ void I_StartupGraphics(void)
|
||||
else if (M_CheckParm("-opengl"))
|
||||
rendermode = render_opengl;
|
||||
|
||||
msaa = 0; boolean msaa_set = false;
|
||||
a2c = false; boolean a2c_set = false;
|
||||
msaa = 0; boolean msaa_set = false;
|
||||
a2c = false; boolean a2c_set = false;
|
||||
|
||||
if (M_CheckParm("-msaa") && M_IsNextParm())
|
||||
{
|
||||
const char* str = M_GetNextParm();
|
||||
if (sscanf(str, "%u", &msaa))
|
||||
{
|
||||
msaa_set = true;
|
||||
}
|
||||
}
|
||||
if (M_CheckParm("-msaa") && M_IsNextParm())
|
||||
{
|
||||
const char* str = M_GetNextParm();
|
||||
if (sscanf(str, "%u", &msaa))
|
||||
{
|
||||
msaa_set = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (M_CheckParm("-a2c"))
|
||||
{
|
||||
a2c = true;
|
||||
a2c_set = true;
|
||||
}
|
||||
else if (M_CheckParm("-noa2c"))
|
||||
{
|
||||
a2c_set = true;
|
||||
}
|
||||
if (M_CheckParm("-a2c"))
|
||||
{
|
||||
a2c = true;
|
||||
a2c_set = true;
|
||||
}
|
||||
else if (M_CheckParm("-noa2c"))
|
||||
{
|
||||
a2c_set = true;
|
||||
}
|
||||
|
||||
{
|
||||
char line[16];
|
||||
@@ -2247,52 +2054,52 @@ void I_StartupGraphics(void)
|
||||
{
|
||||
while (fgets(line, sizeof line, file) != NULL)
|
||||
{
|
||||
word = strtok(line, " \n");
|
||||
word = strtok(line, " \n");
|
||||
|
||||
if (rendermode == render_none)
|
||||
{
|
||||
if (strcasecmp(word, "software") == 0)
|
||||
{
|
||||
rendermode = render_soft;
|
||||
}
|
||||
else if (strcasecmp(word, "opengl") == 0)
|
||||
{
|
||||
rendermode = render_opengl;
|
||||
}
|
||||
if (rendermode == render_none)
|
||||
{
|
||||
if (strcasecmp(word, "software") == 0)
|
||||
{
|
||||
rendermode = render_soft;
|
||||
}
|
||||
else if (strcasecmp(word, "opengl") == 0)
|
||||
{
|
||||
rendermode = render_opengl;
|
||||
}
|
||||
|
||||
if (rendermode != render_none)
|
||||
{
|
||||
CONS_Printf("Using last known renderer: %s\n", line);
|
||||
}
|
||||
if (rendermode != render_none)
|
||||
{
|
||||
CONS_Printf("Using last known renderer: %s\n", line);
|
||||
}
|
||||
}
|
||||
|
||||
if (!msaa_set)
|
||||
{
|
||||
if (strcasecmp(word, "msaa") == 0)
|
||||
{
|
||||
const char *nextword = strtok(NULL, " \n");
|
||||
if (!msaa_set)
|
||||
{
|
||||
if (strcasecmp(word, "msaa") == 0)
|
||||
{
|
||||
const char *nextword = strtok(NULL, " \n");
|
||||
|
||||
if (!nextword || !sscanf(nextword, "%u", &msaa))
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Malformed MSAA entry in renderer.txt\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf("Using last know MSAA value: %u\n", msaa);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!nextword || !sscanf(nextword, "%u", &msaa))
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Malformed MSAA entry in renderer.txt\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf("Using last know MSAA value: %u\n", msaa);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!a2c_set)
|
||||
{
|
||||
if (strcasecmp(word, "a2c") == 0)
|
||||
{
|
||||
a2c = true;
|
||||
if (!a2c_set)
|
||||
{
|
||||
if (strcasecmp(word, "a2c") == 0)
|
||||
{
|
||||
a2c = true;
|
||||
|
||||
CONS_Printf("Using a2c because it was specified to be used earlier\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
CONS_Printf("Using a2c because it was specified to be used earlier\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
@@ -2324,13 +2131,13 @@ void I_StartupGraphics(void)
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
fprintf(file, "msaa %u\n", msaa);
|
||||
fprintf(file, "msaa %u\n", msaa);
|
||||
|
||||
if (a2c)
|
||||
fputs("a2c\n", file);
|
||||
if (a2c)
|
||||
fputs("a2c\n", file);
|
||||
#endif
|
||||
|
||||
fclose(file);
|
||||
fclose(file);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2341,8 +2148,8 @@ void I_StartupGraphics(void)
|
||||
usesdl2soft = M_CheckParm("-softblit");
|
||||
borderlesswindow = M_CheckParm("-borderless");
|
||||
|
||||
//SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY>>1,SDL_DEFAULT_REPEAT_INTERVAL<<2);
|
||||
VID_Command_ModeList_f();
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
@@ -2515,4 +2322,5 @@ static void Impl_SetVsync(void)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
+7
-2
@@ -258,7 +258,7 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
||||
GLFramebuffer_Unbind();
|
||||
#endif
|
||||
|
||||
HWR_DrawScreenFinalTexture(sdlw, sdlh);
|
||||
HWR_DrawScreenFinalTexture(sdlw, sdlh, HWR_ShouldUsePaletteRendering());
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
if (UseScreenFBO())
|
||||
@@ -271,7 +271,12 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
||||
|
||||
// Sryder: We need to draw the final screen texture again into the other buffer in the original position so that
|
||||
// effects that want to take the old screen can do so after this
|
||||
HWR_DrawScreenFinalTexture(realwidth, realheight);
|
||||
if ((!I_CheckNativeRes()) // well we dont need it on native res it seems
|
||||
#ifdef USE_FBO_OGL
|
||||
&& (!UseScreenFBO())
|
||||
#endif
|
||||
)
|
||||
HWR_DrawScreenFinalTexture(realwidth, realheight, false);
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(OglSdlSetPalette) (RGBA_t *palette)
|
||||
|
||||
+4
-18
@@ -59,38 +59,24 @@ typedef struct SDLJoyInfo_s
|
||||
|
||||
/** \brief SDL info about controller 1
|
||||
*/
|
||||
extern SDLJoyInfo_t JoyInfo;
|
||||
extern SDLJoyInfo_t JoyInfo[4]; //MAXSPLITSCREENPLAYERS
|
||||
|
||||
/** \brief joystick axis deadzone
|
||||
*/
|
||||
#define SDL_JDEADZONE 153
|
||||
#undef SDL_JDEADZONE
|
||||
|
||||
/** \brief SDL inof about controller 2
|
||||
*/
|
||||
extern SDLJoyInfo_t JoyInfo2;
|
||||
|
||||
/** \brief SDL inof about controller 3
|
||||
*/
|
||||
extern SDLJoyInfo_t JoyInfo3;
|
||||
|
||||
/** \brief SDL inof about controller 4
|
||||
*/
|
||||
extern SDLJoyInfo_t JoyInfo4;
|
||||
|
||||
void I_GetConsoleEvents(void);
|
||||
|
||||
// So we can call this from i_video event loop
|
||||
void I_ShutdownJoystick(void);
|
||||
void I_ShutdownJoystick2(void);
|
||||
void I_ShutdownJoystick3(void);
|
||||
void I_ShutdownJoystick4(void);
|
||||
void I_ShutdownJoystick(UINT8 index);
|
||||
|
||||
// Cheat to get the device index for a game controller handle
|
||||
INT32 I_GetJoystickDeviceIndex(SDL_GameController *dev);
|
||||
|
||||
// Quick thing to make SDL_JOYDEVICEADDED events less of an abomination
|
||||
void I_UpdateJoystickDeviceIndices(INT32 player);
|
||||
void I_UpdateJoystickDeviceIndex(UINT8 player);
|
||||
void I_UpdateJoystickDeviceIndices(UINT8 excludePlayer);
|
||||
|
||||
void I_GetConsoleEvents(void);
|
||||
|
||||
|
||||
+2
-15
@@ -220,13 +220,6 @@ boolean ST_SameTeam(player_t *a, player_t *b)
|
||||
if (a->spectator && b->spectator)
|
||||
return true;
|
||||
|
||||
// Team chat.
|
||||
if (G_GametypeHasTeams())
|
||||
return a->ctfteam == b->ctfteam;
|
||||
|
||||
if (G_TagGametype())
|
||||
return ((a->pflags & PF_TAGIT) == (b->pflags & PF_TAGIT));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -750,8 +743,6 @@ static void ST_overlayDrawer(void)
|
||||
itemtxt = M_GetText("Item - . . .");
|
||||
else if (stplyr->pflags & PF_WANTSTOJOIN)
|
||||
itemtxt = M_GetText("Item - Cancel Join");
|
||||
else if (G_GametypeHasTeams())
|
||||
itemtxt = M_GetText("Item - Join Team");
|
||||
|
||||
if (cv_ingamecap.value)
|
||||
{
|
||||
@@ -961,18 +952,14 @@ void ST_Drawer(void)
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF, player_names[seenplayer-players]);
|
||||
else if (cv_seenames.value == 2)
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF,
|
||||
va("%s%s", G_GametypeHasTeams() ? ((seenplayer->ctfteam == 1) ? "\x85" : "\x84") : "", player_names[seenplayer-players]));
|
||||
va("%s%s", "", player_names[seenplayer-players]));
|
||||
else //if (cv_seenames.value == 3)
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF,
|
||||
va("%s%s", !G_BattleGametype() || (G_GametypeHasTeams() && players[consoleplayer].ctfteam == seenplayer->ctfteam)
|
||||
va("%s%s", !G_BattleGametype()
|
||||
? "\x83" : "\x85", player_names[seenplayer-players]));
|
||||
}
|
||||
#endif
|
||||
|
||||
// Doom's status bar only updated if necessary.
|
||||
// However, ours updates every frame regardless, so the "refresh" param was removed
|
||||
//(void)refresh;
|
||||
|
||||
// force a set of the palette by using doPaletteStuff()
|
||||
if (vid.recalc)
|
||||
st_palette = -1;
|
||||
|
||||
+2
-24
@@ -57,26 +57,6 @@ typedef struct
|
||||
|
||||
typedef union
|
||||
{
|
||||
/*struct
|
||||
{
|
||||
char passed1[21]; // KNUCKLES GOT / CRAWLA HONCHO
|
||||
char passed2[16]; // THROUGH THE ACT / PASSED THE ACT
|
||||
INT32 passedx1;
|
||||
INT32 passedx2;
|
||||
|
||||
y_bonus_t bonuses[4];
|
||||
patch_t *bonuspatches[4];
|
||||
|
||||
SINT8 gotperfbonus; // Used for visitation flags.
|
||||
|
||||
UINT32 score, total; // fake score, total
|
||||
UINT32 tics; // time
|
||||
|
||||
patch_t *ttlnum; // act number being displayed
|
||||
patch_t *ptotal; // TOTAL
|
||||
UINT8 gotlife; // Number of extra lives obtained
|
||||
} coop;*/
|
||||
|
||||
struct
|
||||
{
|
||||
UINT8 *color[MAXPLAYERS]; // Winner's color #
|
||||
@@ -631,7 +611,7 @@ void Y_Ticker(void)
|
||||
{
|
||||
INT32 axis = JoyAxis(AXISLOOKBACK, 1);
|
||||
|
||||
if (demo.savemode == DSM_NOTSAVING && (InputDown(gc_lookback, 1) || (cv_usejoystick.value && axis > 0)))
|
||||
if (demo.savemode == DSM_NOTSAVING && (InputDown(gc_lookback, 1) || (cv_usejoystick[0].value && axis > 0)))
|
||||
demo.savemode = DSM_TITLEENTRY;
|
||||
|
||||
if (demo.savemode == DSM_WILLSAVE || demo.savemode == DSM_WILLAUTOSAVE)
|
||||
@@ -828,9 +808,7 @@ void Y_StartIntermission(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cv_inttime.value == 0 && gametype == GT_COOP)
|
||||
timer = 0;
|
||||
else if (demo.playback) // Override inttime (which is pulled from the replay anyway
|
||||
if (demo.playback) // Override inttime (which is pulled from the replay anyway
|
||||
timer = 10*TICRATE;
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user