Merge remote-tracking branch 'origin/master' into local-color-table
This commit is contained in:
commit
520e2148fe
124
src/am_map.c
124
src/am_map.c
|
@ -160,6 +160,7 @@ static boolean am_stopped = true;
|
||||||
static INT32 f_x, f_y; // location of window on screen (always zero for both)
|
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 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 mpoint_t m_paninc; // how far the window pans each tic (map coords)
|
||||||
static fixed_t mtof_zoommul; // how far the window zooms in each tic (map coords)
|
static fixed_t mtof_zoommul; // how far the window zooms in each tic (map coords)
|
||||||
static fixed_t ftom_zoommul; // how far the window zooms in each tic (fb coords)
|
static fixed_t ftom_zoommul; // how far the window zooms in each tic (fb coords)
|
||||||
|
@ -205,6 +206,7 @@ static boolean followplayer = true; // specifies whether to follow the player ar
|
||||||
typedef void (*AMDRAWFLINEFUNC) (const fline_t *fl, INT32 color);
|
typedef void (*AMDRAWFLINEFUNC) (const fline_t *fl, INT32 color);
|
||||||
static AMDRAWFLINEFUNC AM_drawFline;
|
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_drawFline_soft(const fline_t *fl, INT32 color);
|
||||||
|
|
||||||
static void AM_activateNewScale(void)
|
static void AM_activateNewScale(void)
|
||||||
|
@ -344,22 +346,22 @@ static void AM_initVariables(void)
|
||||||
old_m_h = m_h;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// should be called at the start of every level
|
// should be called at the start of every level
|
||||||
// right now, i figure it out myself
|
// right now, i figure it out myself
|
||||||
//
|
//
|
||||||
static void AM_LevelInit(void)
|
static void AM_LevelInit(void)
|
||||||
{
|
{
|
||||||
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();
|
AM_findMinMaxBoundaries();
|
||||||
scale_mtof = FixedDiv(min_scale_mtof*10, 7*FRACUNIT);
|
scale_mtof = FixedDiv(min_scale_mtof*10, 7*FRACUNIT);
|
||||||
if (scale_mtof > max_scale_mtof)
|
if (scale_mtof > max_scale_mtof)
|
||||||
|
@ -381,7 +383,7 @@ void AM_Stop(void)
|
||||||
*
|
*
|
||||||
* \sa AM_Stop
|
* \sa AM_Stop
|
||||||
*/
|
*/
|
||||||
static inline void AM_Start(void)
|
void AM_Start(void)
|
||||||
{
|
{
|
||||||
static INT32 lastlevel = -1;
|
static INT32 lastlevel = -1;
|
||||||
|
|
||||||
|
@ -390,8 +392,12 @@ static inline void AM_Start(void)
|
||||||
am_stopped = false;
|
am_stopped = false;
|
||||||
if (lastlevel != gamemap || am_recalc) // screen size changed
|
if (lastlevel != gamemap || am_recalc) // screen size changed
|
||||||
{
|
{
|
||||||
AM_LevelInit();
|
AM_FrameBufferInit();
|
||||||
lastlevel = gamemap;
|
if (lastlevel != gamemap)
|
||||||
|
{
|
||||||
|
AM_LevelInit();
|
||||||
|
lastlevel = gamemap;
|
||||||
|
}
|
||||||
am_recalc = false;
|
am_recalc = false;
|
||||||
}
|
}
|
||||||
AM_initVariables();
|
AM_initVariables();
|
||||||
|
@ -417,6 +423,28 @@ static void AM_maxOutWindowScale(void)
|
||||||
AM_activateNewScale();
|
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.
|
/** Responds to user inputs in automap mode.
|
||||||
*
|
*
|
||||||
* \param ev Event to possibly respond to.
|
* \param ev Event to possibly respond to.
|
||||||
|
@ -449,35 +477,49 @@ boolean AM_Responder(event_t *ev)
|
||||||
{
|
{
|
||||||
case AM_PANRIGHTKEY: // pan right
|
case AM_PANRIGHTKEY: // pan right
|
||||||
if (!followplayer)
|
if (!followplayer)
|
||||||
m_paninc.x = FTOM(F_PANINC);
|
{
|
||||||
|
m_keydown[0] = true;
|
||||||
|
AM_setWindowPanning();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
rc = false;
|
rc = false;
|
||||||
break;
|
break;
|
||||||
case AM_PANLEFTKEY: // pan left
|
case AM_PANLEFTKEY: // pan left
|
||||||
if (!followplayer)
|
if (!followplayer)
|
||||||
m_paninc.x = -FTOM(F_PANINC);
|
{
|
||||||
|
m_keydown[1] = true;
|
||||||
|
AM_setWindowPanning();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
rc = false;
|
rc = false;
|
||||||
break;
|
break;
|
||||||
case AM_PANUPKEY: // pan up
|
case AM_PANUPKEY: // pan up
|
||||||
if (!followplayer)
|
if (!followplayer)
|
||||||
m_paninc.y = FTOM(F_PANINC);
|
{
|
||||||
|
m_keydown[2] = true;
|
||||||
|
AM_setWindowPanning();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
rc = false;
|
rc = false;
|
||||||
break;
|
break;
|
||||||
case AM_PANDOWNKEY: // pan down
|
case AM_PANDOWNKEY: // pan down
|
||||||
if (!followplayer)
|
if (!followplayer)
|
||||||
m_paninc.y = -FTOM(F_PANINC);
|
{
|
||||||
|
m_keydown[3] = true;
|
||||||
|
AM_setWindowPanning();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
rc = false;
|
rc = false;
|
||||||
break;
|
break;
|
||||||
case AM_ZOOMOUTKEY: // zoom out
|
case AM_ZOOMOUTKEY: // zoom out
|
||||||
mtof_zoommul = M_ZOOMOUT;
|
mtof_zoommul = M_ZOOMOUT;
|
||||||
ftom_zoommul = M_ZOOMIN;
|
ftom_zoommul = M_ZOOMIN;
|
||||||
|
AM_setWindowPanning();
|
||||||
break;
|
break;
|
||||||
case AM_ZOOMINKEY: // zoom in
|
case AM_ZOOMINKEY: // zoom in
|
||||||
mtof_zoommul = M_ZOOMIN;
|
mtof_zoommul = M_ZOOMIN;
|
||||||
ftom_zoommul = M_ZOOMOUT;
|
ftom_zoommul = M_ZOOMOUT;
|
||||||
|
AM_setWindowPanning();
|
||||||
break;
|
break;
|
||||||
case AM_TOGGLEKEY:
|
case AM_TOGGLEKEY:
|
||||||
AM_Stop();
|
AM_Stop();
|
||||||
|
@ -491,6 +533,7 @@ boolean AM_Responder(event_t *ev)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
AM_restoreScaleAndLoc();
|
AM_restoreScaleAndLoc();
|
||||||
|
AM_setWindowPanning();
|
||||||
break;
|
break;
|
||||||
case AM_FOLLOWKEY:
|
case AM_FOLLOWKEY:
|
||||||
followplayer = !followplayer;
|
followplayer = !followplayer;
|
||||||
|
@ -510,14 +553,32 @@ boolean AM_Responder(event_t *ev)
|
||||||
switch (ev->data1)
|
switch (ev->data1)
|
||||||
{
|
{
|
||||||
case AM_PANRIGHTKEY:
|
case AM_PANRIGHTKEY:
|
||||||
|
if (!followplayer)
|
||||||
|
{
|
||||||
|
m_keydown[0] = false;
|
||||||
|
AM_setWindowPanning();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case AM_PANLEFTKEY:
|
case AM_PANLEFTKEY:
|
||||||
if (!followplayer)
|
if (!followplayer)
|
||||||
m_paninc.x = 0;
|
{
|
||||||
|
m_keydown[1] = false;
|
||||||
|
AM_setWindowPanning();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case AM_PANUPKEY:
|
case AM_PANUPKEY:
|
||||||
|
if (!followplayer)
|
||||||
|
{
|
||||||
|
m_keydown[2] = false;
|
||||||
|
AM_setWindowPanning();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case AM_PANDOWNKEY:
|
case AM_PANDOWNKEY:
|
||||||
if (!followplayer)
|
if (!followplayer)
|
||||||
m_paninc.y = 0;
|
{
|
||||||
|
m_keydown[3] = false;
|
||||||
|
AM_setWindowPanning();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case AM_ZOOMOUTKEY:
|
case AM_ZOOMOUTKEY:
|
||||||
case AM_ZOOMINKEY:
|
case AM_ZOOMINKEY:
|
||||||
|
@ -718,6 +779,17 @@ static boolean AM_clipMline(const mline_t *ml, fline_t *fl)
|
||||||
}
|
}
|
||||||
#undef DOOUTCODE
|
#undef DOOUTCODE
|
||||||
|
|
||||||
|
//
|
||||||
|
// Draws a pixel.
|
||||||
|
//
|
||||||
|
static void AM_drawPixel(INT32 xx, INT32 yy, INT32 cc)
|
||||||
|
{
|
||||||
|
UINT8 *dest = screens[0];
|
||||||
|
if (xx < 0 || yy < 0 || xx >= vid.width || yy >= vid.height)
|
||||||
|
return; // off the screen
|
||||||
|
dest[(yy*vid.width) + xx] = cc;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Classic Bresenham w/ whatever optimizations needed for speed
|
// Classic Bresenham w/ whatever optimizations needed for speed
|
||||||
//
|
//
|
||||||
|
@ -739,8 +811,6 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PUTDOT(xx,yy,cc) V_DrawFill(xx,yy,1,1,cc|V_NOSCALESTART);
|
|
||||||
|
|
||||||
dx = fl->b.x - fl->a.x;
|
dx = fl->b.x - fl->a.x;
|
||||||
ax = 2 * (dx < 0 ? -dx : dx);
|
ax = 2 * (dx < 0 ? -dx : dx);
|
||||||
sx = dx < 0 ? -1 : 1;
|
sx = dx < 0 ? -1 : 1;
|
||||||
|
@ -757,7 +827,7 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
||||||
d = ay - ax/2;
|
d = ay - ax/2;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
PUTDOT(x, y, color)
|
AM_drawPixel(x, y, color);
|
||||||
if (x == fl->b.x)
|
if (x == fl->b.x)
|
||||||
return;
|
return;
|
||||||
if (d >= 0)
|
if (d >= 0)
|
||||||
|
@ -774,7 +844,7 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
||||||
d = ax - ay/2;
|
d = ax - ay/2;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
PUTDOT(x, y, color)
|
AM_drawPixel(x, y, color);
|
||||||
if (y == fl->b.y)
|
if (y == fl->b.y)
|
||||||
return;
|
return;
|
||||||
if (d >= 0)
|
if (d >= 0)
|
||||||
|
@ -786,8 +856,6 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
||||||
d += ax;
|
d += ax;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef PUTDOT
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1100,6 +1168,12 @@ void AM_Drawer(void)
|
||||||
if (!automapactive)
|
if (!automapactive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
AM_drawFline = AM_drawFline_soft;
|
||||||
|
#ifdef HWRENDER
|
||||||
|
if (rendermode == render_opengl)
|
||||||
|
AM_drawFline = HWR_drawAMline;
|
||||||
|
#endif
|
||||||
|
|
||||||
AM_clearFB(BACKGROUND);
|
AM_clearFB(BACKGROUND);
|
||||||
if (draw_grid) AM_drawGrid(GRIDCOLORS);
|
if (draw_grid) AM_drawGrid(GRIDCOLORS);
|
||||||
AM_drawWalls();
|
AM_drawWalls();
|
||||||
|
|
|
@ -38,6 +38,9 @@ void AM_Ticker(void);
|
||||||
// Called by main loop, instead of view drawer if automap is active.
|
// Called by main loop, instead of view drawer if automap is active.
|
||||||
void AM_Drawer(void);
|
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.
|
// Called to force the automap to quit if the level is completed while it is up.
|
||||||
void AM_Stop(void);
|
void AM_Stop(void);
|
||||||
|
|
||||||
|
|
|
@ -769,7 +769,7 @@ boolean CON_Responder(event_t *ev)
|
||||||
// check for console toggle key
|
// check for console toggle key
|
||||||
if (ev->type != ev_console)
|
if (ev->type != ev_console)
|
||||||
{
|
{
|
||||||
if (modeattacking || metalrecording || menuactive)
|
if (modeattacking || metalrecording)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (key == gamecontrol[gc_console][0] || key == gamecontrol[gc_console][1])
|
if (key == gamecontrol[gc_console][0] || key == gamecontrol[gc_console][1])
|
||||||
|
|
|
@ -2693,8 +2693,18 @@ static void F_FigureActiveTtScale(void)
|
||||||
SINT8 newttscale = max(1, min(6, vid.dupx));
|
SINT8 newttscale = max(1, min(6, vid.dupx));
|
||||||
SINT8 oldttscale = activettscale;
|
SINT8 oldttscale = activettscale;
|
||||||
|
|
||||||
if (newttscale == testttscale)
|
if (needpatchrecache)
|
||||||
return;
|
ttloaded[0] = ttloaded[1] = ttloaded[2] = ttloaded[3] = ttloaded[4] = ttloaded[5] = 0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (newttscale == testttscale)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// We have a new ttscale, so load gfx
|
||||||
|
if(oldttscale > 0)
|
||||||
|
F_UnloadAlacroixGraphics(oldttscale);
|
||||||
|
}
|
||||||
|
|
||||||
testttscale = newttscale;
|
testttscale = newttscale;
|
||||||
|
|
||||||
// If ttscale is unavailable: look for lower scales, then higher scales.
|
// If ttscale is unavailable: look for lower scales, then higher scales.
|
||||||
|
@ -2712,10 +2722,6 @@ static void F_FigureActiveTtScale(void)
|
||||||
|
|
||||||
activettscale = (newttscale >= 1 && newttscale <= 6) ? newttscale : 0;
|
activettscale = (newttscale >= 1 && newttscale <= 6) ? newttscale : 0;
|
||||||
|
|
||||||
// We have a new ttscale, so load gfx
|
|
||||||
if(oldttscale > 0)
|
|
||||||
F_UnloadAlacroixGraphics(oldttscale);
|
|
||||||
|
|
||||||
if(activettscale > 0)
|
if(activettscale > 0)
|
||||||
F_LoadAlacroixGraphics(activettscale);
|
F_LoadAlacroixGraphics(activettscale);
|
||||||
}
|
}
|
||||||
|
@ -2757,12 +2763,6 @@ void F_TitleScreenDrawer(void)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (needpatchrecache && (curttmode == TTMODE_ALACROIX))
|
|
||||||
{
|
|
||||||
ttloaded[0] = ttloaded[1] = ttloaded[2] = ttloaded[3] = ttloaded[4] = ttloaded[5] = 0;
|
|
||||||
F_LoadAlacroixGraphics(activettscale);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(curttmode)
|
switch(curttmode)
|
||||||
{
|
{
|
||||||
case TTMODE_OLD:
|
case TTMODE_OLD:
|
||||||
|
@ -3628,7 +3628,6 @@ void F_StartContinue(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
wipestyleflags = WSF_FADEOUT;
|
wipestyleflags = WSF_FADEOUT;
|
||||||
F_TryColormapFade(31);
|
|
||||||
G_SetGamestate(GS_CONTINUING);
|
G_SetGamestate(GS_CONTINUING);
|
||||||
gameaction = ga_nothing;
|
gameaction = ga_nothing;
|
||||||
|
|
||||||
|
|
|
@ -5399,7 +5399,7 @@ static void HWR_AddSprites(sector_t *sec)
|
||||||
#ifdef HWPRECIP
|
#ifdef HWPRECIP
|
||||||
precipmobj_t *precipthing;
|
precipmobj_t *precipthing;
|
||||||
#endif
|
#endif
|
||||||
fixed_t approx_dist, limit_dist, hoop_limit_dist;
|
fixed_t limit_dist, hoop_limit_dist;
|
||||||
|
|
||||||
// BSP is traversed by subsector.
|
// BSP is traversed by subsector.
|
||||||
// A sector might have been split into several
|
// A sector might have been split into several
|
||||||
|
@ -5418,35 +5418,10 @@ static void HWR_AddSprites(sector_t *sec)
|
||||||
// If a limit exists, handle things a tiny bit different.
|
// If a limit exists, handle things a tiny bit different.
|
||||||
limit_dist = (fixed_t)(cv_drawdist.value) << FRACBITS;
|
limit_dist = (fixed_t)(cv_drawdist.value) << FRACBITS;
|
||||||
hoop_limit_dist = (fixed_t)(cv_drawdist_nights.value) << FRACBITS;
|
hoop_limit_dist = (fixed_t)(cv_drawdist_nights.value) << FRACBITS;
|
||||||
if (limit_dist || hoop_limit_dist)
|
for (thing = sec->thinglist; thing; thing = thing->snext)
|
||||||
{
|
{
|
||||||
for (thing = sec->thinglist; thing; thing = thing->snext)
|
if (R_ThingVisibleWithinDist(thing, limit_dist, hoop_limit_dist))
|
||||||
{
|
|
||||||
if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y);
|
|
||||||
|
|
||||||
if (thing->sprite == SPR_HOOP)
|
|
||||||
{
|
|
||||||
if (hoop_limit_dist && approx_dist > hoop_limit_dist)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (limit_dist && approx_dist > limit_dist)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
HWR_ProjectSprite(thing);
|
HWR_ProjectSprite(thing);
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Draw everything in sector, no checks
|
|
||||||
for (thing = sec->thinglist; thing; thing = thing->snext)
|
|
||||||
if (!(thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW))
|
|
||||||
HWR_ProjectSprite(thing);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HWPRECIP
|
#ifdef HWPRECIP
|
||||||
|
@ -5455,15 +5430,8 @@ static void HWR_AddSprites(sector_t *sec)
|
||||||
{
|
{
|
||||||
for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext)
|
for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext)
|
||||||
{
|
{
|
||||||
if (precipthing->precipflags & PCF_INVISIBLE)
|
if (R_PrecipThingVisible(precipthing, limit_dist))
|
||||||
continue;
|
HWR_ProjectPrecipitationSprite(precipthing);
|
||||||
|
|
||||||
approx_dist = P_AproxDistance(viewx-precipthing->x, viewy-precipthing->y);
|
|
||||||
|
|
||||||
if (approx_dist > limit_dist)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
HWR_ProjectPrecipitationSprite(precipthing);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -5727,7 +5695,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||||
if ((thing->flags2 & MF2_LINKDRAW) && thing->tracer)
|
if ((thing->flags2 & MF2_LINKDRAW) && thing->tracer)
|
||||||
{
|
{
|
||||||
// bodge support - not nearly as comprehensive as r_things.c, but better than nothing
|
// bodge support - not nearly as comprehensive as r_things.c, but better than nothing
|
||||||
if (thing->tracer->sprite == SPR_NULL || thing->tracer->flags2 & MF2_DONTDRAW)
|
if (! R_ThingVisible(thing->tracer))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1437,7 +1437,7 @@ static void HU_drawMiniChat(void)
|
||||||
|
|
||||||
for (; i>0; i--)
|
for (; i>0; i--)
|
||||||
{
|
{
|
||||||
const char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i-1]);
|
char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i-1]);
|
||||||
size_t j = 0;
|
size_t j = 0;
|
||||||
INT32 linescount = 0;
|
INT32 linescount = 0;
|
||||||
|
|
||||||
|
@ -1479,6 +1479,9 @@ static void HU_drawMiniChat(void)
|
||||||
dy = 0;
|
dy = 0;
|
||||||
dx = 0;
|
dx = 0;
|
||||||
msglines += linescount+1;
|
msglines += linescount+1;
|
||||||
|
|
||||||
|
if (msg)
|
||||||
|
Z_Free(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
y = chaty - charheight*(msglines+1);
|
y = chaty - charheight*(msglines+1);
|
||||||
|
@ -1501,7 +1504,7 @@ static void HU_drawMiniChat(void)
|
||||||
INT32 timer = ((cv_chattime.value*TICRATE)-chat_timers[i]) - cv_chattime.value*TICRATE+9; // see below...
|
INT32 timer = ((cv_chattime.value*TICRATE)-chat_timers[i]) - cv_chattime.value*TICRATE+9; // see below...
|
||||||
INT32 transflag = (timer >= 0 && timer <= 9) ? (timer*V_10TRANS) : 0; // you can make bad jokes out of this one.
|
INT32 transflag = (timer >= 0 && timer <= 9) ? (timer*V_10TRANS) : 0; // you can make bad jokes out of this one.
|
||||||
size_t j = 0;
|
size_t j = 0;
|
||||||
const char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i]); // get the current message, and word wrap it.
|
char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i]); // get the current message, and word wrap it.
|
||||||
UINT8 *colormap = NULL;
|
UINT8 *colormap = NULL;
|
||||||
|
|
||||||
while(msg[j]) // iterate through msg
|
while(msg[j]) // iterate through msg
|
||||||
|
@ -1547,6 +1550,9 @@ static void HU_drawMiniChat(void)
|
||||||
}
|
}
|
||||||
dy += charheight;
|
dy += charheight;
|
||||||
dx = 0;
|
dx = 0;
|
||||||
|
|
||||||
|
if (msg)
|
||||||
|
Z_Free(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// decrement addy and make that shit smooth:
|
// decrement addy and make that shit smooth:
|
||||||
|
@ -1598,7 +1604,7 @@ static void HU_drawChatLog(INT32 offset)
|
||||||
{
|
{
|
||||||
INT32 clrflag = 0;
|
INT32 clrflag = 0;
|
||||||
INT32 j = 0;
|
INT32 j = 0;
|
||||||
const char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_log[i]); // get the current message, and word wrap it.
|
char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_log[i]); // get the current message, and word wrap it.
|
||||||
UINT8 *colormap = NULL;
|
UINT8 *colormap = NULL;
|
||||||
while(msg[j]) // iterate through msg
|
while(msg[j]) // iterate through msg
|
||||||
{
|
{
|
||||||
|
@ -1638,6 +1644,9 @@ static void HU_drawChatLog(INT32 offset)
|
||||||
}
|
}
|
||||||
dy += charheight;
|
dy += charheight;
|
||||||
dx = 0;
|
dx = 0;
|
||||||
|
|
||||||
|
if (msg)
|
||||||
|
Z_Free(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -407,13 +407,13 @@ const UINT8 gifhead_nsid[19] = {0x21,0xFF,0x0B, // extension block + size
|
||||||
//
|
//
|
||||||
static RGBA_t *GIF_getpalette(size_t palnum)
|
static RGBA_t *GIF_getpalette(size_t palnum)
|
||||||
{
|
{
|
||||||
// In hardware mode, uses the master palette
|
// In hardware mode, always returns the local palette
|
||||||
return ((gif_colorprofile
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
&& (rendermode == render_soft)
|
if (rendermode == render_opengl)
|
||||||
|
return pLocalPalette;
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
) ? &pLocalPalette[palnum*256]
|
return (gif_colorprofile ? &pLocalPalette[palnum*256] : &pMasterPalette[palnum*256]);
|
||||||
: &pMasterPalette[palnum*256]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -537,7 +537,7 @@ static void GIF_framewrite(void)
|
||||||
// Lactozilla: Compare the header's palette with the current frame's palette and see if it changed.
|
// Lactozilla: Compare the header's palette with the current frame's palette and see if it changed.
|
||||||
if (gif_localcolortable)
|
if (gif_localcolortable)
|
||||||
{
|
{
|
||||||
gif_framepalette = GIF_getpalette((rendermode == render_soft) ? ((gif_localcolortable) ? max(st_palette, 0) : 0) : 0);
|
gif_framepalette = GIF_getpalette(gif_localcolortable ? max(st_palette, 0) : 0);
|
||||||
palchanged = memcmp(gif_headerpalette, gif_framepalette, sizeof(RGBA_t) * 256);
|
palchanged = memcmp(gif_headerpalette, gif_framepalette, sizeof(RGBA_t) * 256);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -679,14 +679,6 @@ static void GIF_framewrite(void)
|
||||||
//
|
//
|
||||||
INT32 GIF_open(const char *filename)
|
INT32 GIF_open(const char *filename)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
if (rendermode != render_soft)
|
|
||||||
{
|
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("GIFs cannot be taken in non-software modes!\n"));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gif_out = fopen(filename, "wb");
|
gif_out = fopen(filename, "wb");
|
||||||
if (!gif_out)
|
if (!gif_out)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -5389,7 +5389,8 @@ static void M_DrawNightsAttackMountains(void)
|
||||||
static INT32 bgscrollx;
|
static INT32 bgscrollx;
|
||||||
INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
|
INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
|
||||||
patch_t *background = W_CachePatchName(curbgname, PU_PATCH);
|
patch_t *background = W_CachePatchName(curbgname, PU_PATCH);
|
||||||
INT32 x = FixedInt(bgscrollx) % SHORT(background->width);
|
INT16 w = SHORT(background->width);
|
||||||
|
INT32 x = FixedInt(-bgscrollx) % w;
|
||||||
INT32 y = BASEVIDHEIGHT - SHORT(background->height)*2;
|
INT32 y = BASEVIDHEIGHT - SHORT(background->height)*2;
|
||||||
|
|
||||||
if (vid.height != BASEVIDHEIGHT * dupz)
|
if (vid.height != BASEVIDHEIGHT * dupz)
|
||||||
|
@ -5397,11 +5398,13 @@ static void M_DrawNightsAttackMountains(void)
|
||||||
V_DrawFill(0, y+50, vid.width, BASEVIDHEIGHT, V_SNAPTOLEFT|31);
|
V_DrawFill(0, y+50, vid.width, BASEVIDHEIGHT, V_SNAPTOLEFT|31);
|
||||||
|
|
||||||
V_DrawScaledPatch(x, y, V_SNAPTOLEFT, background);
|
V_DrawScaledPatch(x, y, V_SNAPTOLEFT, background);
|
||||||
x += SHORT(background->width);
|
x += w;
|
||||||
if (x < BASEVIDWIDTH)
|
if (x < BASEVIDWIDTH)
|
||||||
V_DrawScaledPatch(x, y, V_SNAPTOLEFT, background);
|
V_DrawScaledPatch(x, y, V_SNAPTOLEFT, background);
|
||||||
|
|
||||||
bgscrollx -= (FRACUNIT/2);
|
bgscrollx += (FRACUNIT/2);
|
||||||
|
if (bgscrollx > w<<FRACBITS)
|
||||||
|
bgscrollx &= 0xFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NiGHTS Attack foreground.
|
// NiGHTS Attack foreground.
|
||||||
|
|
17
src/p_user.c
17
src/p_user.c
|
@ -10790,12 +10790,23 @@ static void P_MinecartThink(player_t *player)
|
||||||
else if (angdiff > ANGLE_180 && angdiff < InvAngle(MINECARTCONEMAX))
|
else if (angdiff > ANGLE_180 && angdiff < InvAngle(MINECARTCONEMAX))
|
||||||
player->mo->angle = minecart->angle - MINECARTCONEMAX;
|
player->mo->angle = minecart->angle - MINECARTCONEMAX;
|
||||||
|
|
||||||
if (angdiff + minecart->angle != player->mo->angle && (!demoplayback || P_AnalogMove(player)))
|
if (!demoplayback || P_AnalogMove(player))
|
||||||
{
|
{
|
||||||
|
angle_t *ang = NULL;
|
||||||
|
|
||||||
if (player == &players[consoleplayer])
|
if (player == &players[consoleplayer])
|
||||||
localangle = player->mo->angle;
|
ang = &localangle;
|
||||||
else if (player == &players[secondarydisplayplayer])
|
else if (player == &players[secondarydisplayplayer])
|
||||||
localangle2 = player->mo->angle;
|
ang = &localangle2;
|
||||||
|
|
||||||
|
if (ang)
|
||||||
|
{
|
||||||
|
angdiff = *ang - minecart->angle;
|
||||||
|
if (angdiff < ANGLE_180 && angdiff > MINECARTCONEMAX)
|
||||||
|
*ang = minecart->angle + MINECARTCONEMAX;
|
||||||
|
else if (angdiff > ANGLE_180 && angdiff < InvAngle(MINECARTCONEMAX))
|
||||||
|
*ang = minecart->angle - MINECARTCONEMAX;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
src/r_data.c
12
src/r_data.c
|
@ -2465,16 +2465,20 @@ extracolormap_t *R_AddColormaps(extracolormap_t *exc_augend, extracolormap_t *ex
|
||||||
|
|
||||||
// Thanks to quake2 source!
|
// Thanks to quake2 source!
|
||||||
// utils3/qdata/images.c
|
// utils3/qdata/images.c
|
||||||
UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b)
|
UINT8 NearestPaletteColor(UINT8 r, UINT8 g, UINT8 b, RGBA_t *palette)
|
||||||
{
|
{
|
||||||
int dr, dg, db;
|
int dr, dg, db;
|
||||||
int distortion, bestdistortion = 256 * 256 * 4, bestcolor = 0, i;
|
int distortion, bestdistortion = 256 * 256 * 4, bestcolor = 0, i;
|
||||||
|
|
||||||
|
// Use master palette if none specified
|
||||||
|
if (palette == NULL)
|
||||||
|
palette = pMasterPalette;
|
||||||
|
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
{
|
{
|
||||||
dr = r - pMasterPalette[i].s.red;
|
dr = r - palette[i].s.red;
|
||||||
dg = g - pMasterPalette[i].s.green;
|
dg = g - palette[i].s.green;
|
||||||
db = b - pMasterPalette[i].s.blue;
|
db = b - palette[i].s.blue;
|
||||||
distortion = dr*dr + dg*dg + db*db;
|
distortion = dr*dr + dg*dg + db*db;
|
||||||
if (distortion < bestdistortion)
|
if (distortion < bestdistortion)
|
||||||
{
|
{
|
||||||
|
|
|
@ -171,7 +171,8 @@ const char *R_NameForColormap(extracolormap_t *extra_colormap);
|
||||||
#define R_PutRgbaRGB(r, g, b) (R_PutRgbaR(r) + R_PutRgbaG(g) + R_PutRgbaB(b))
|
#define R_PutRgbaRGB(r, g, b) (R_PutRgbaR(r) + R_PutRgbaG(g) + R_PutRgbaB(b))
|
||||||
#define R_PutRgbaRGBA(r, g, b, a) (R_PutRgbaRGB(r, g, b) + R_PutRgbaA(a))
|
#define R_PutRgbaRGBA(r, g, b, a) (R_PutRgbaRGB(r, g, b) + R_PutRgbaA(a))
|
||||||
|
|
||||||
UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b);
|
UINT8 NearestPaletteColor(UINT8 r, UINT8 g, UINT8 b, RGBA_t *palette);
|
||||||
|
#define NearestColor(r, g, b) NearestPaletteColor(r, g, b, NULL)
|
||||||
|
|
||||||
extern INT32 numtextures;
|
extern INT32 numtextures;
|
||||||
|
|
||||||
|
|
55
src/r_main.c
55
src/r_main.c
|
@ -71,6 +71,7 @@ angle_t viewangle, aimingangle;
|
||||||
fixed_t viewcos, viewsin;
|
fixed_t viewcos, viewsin;
|
||||||
sector_t *viewsector;
|
sector_t *viewsector;
|
||||||
player_t *viewplayer;
|
player_t *viewplayer;
|
||||||
|
mobj_t *r_viewmobj;
|
||||||
|
|
||||||
//
|
//
|
||||||
// precalculated math tables
|
// precalculated math tables
|
||||||
|
@ -741,8 +742,6 @@ subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y)
|
||||||
// R_SetupFrame
|
// R_SetupFrame
|
||||||
//
|
//
|
||||||
|
|
||||||
static mobj_t *viewmobj;
|
|
||||||
|
|
||||||
// WARNING: a should be unsigned but to add with 2048, it isn't!
|
// WARNING: a should be unsigned but to add with 2048, it isn't!
|
||||||
#define AIMINGTODY(a) FixedDiv((FINETANGENT((2048+(((INT32)a)>>ANGLETOFINESHIFT)) & FINEMASK)*160)>>FRACBITS, fovtan)
|
#define AIMINGTODY(a) FixedDiv((FINETANGENT((2048+(((INT32)a)>>ANGLETOFINESHIFT)) & FINEMASK)*160)>>FRACBITS, fovtan)
|
||||||
|
|
||||||
|
@ -799,16 +798,16 @@ void R_SetupFrame(player_t *player)
|
||||||
if (player->awayviewtics)
|
if (player->awayviewtics)
|
||||||
{
|
{
|
||||||
// cut-away view stuff
|
// cut-away view stuff
|
||||||
viewmobj = player->awayviewmobj; // should be a MT_ALTVIEWMAN
|
r_viewmobj = player->awayviewmobj; // should be a MT_ALTVIEWMAN
|
||||||
I_Assert(viewmobj != NULL);
|
I_Assert(r_viewmobj != NULL);
|
||||||
viewz = viewmobj->z + 20*FRACUNIT;
|
viewz = r_viewmobj->z + 20*FRACUNIT;
|
||||||
aimingangle = player->awayviewaiming;
|
aimingangle = player->awayviewaiming;
|
||||||
viewangle = viewmobj->angle;
|
viewangle = r_viewmobj->angle;
|
||||||
}
|
}
|
||||||
else if (!player->spectator && chasecam)
|
else if (!player->spectator && chasecam)
|
||||||
// use outside cam view
|
// use outside cam view
|
||||||
{
|
{
|
||||||
viewmobj = NULL;
|
r_viewmobj = NULL;
|
||||||
viewz = thiscam->z + (thiscam->height>>1);
|
viewz = thiscam->z + (thiscam->height>>1);
|
||||||
aimingangle = thiscam->aiming;
|
aimingangle = thiscam->aiming;
|
||||||
viewangle = thiscam->angle;
|
viewangle = thiscam->angle;
|
||||||
|
@ -818,11 +817,11 @@ void R_SetupFrame(player_t *player)
|
||||||
{
|
{
|
||||||
viewz = player->viewz;
|
viewz = player->viewz;
|
||||||
|
|
||||||
viewmobj = player->mo;
|
r_viewmobj = player->mo;
|
||||||
I_Assert(viewmobj != NULL);
|
I_Assert(r_viewmobj != NULL);
|
||||||
|
|
||||||
aimingangle = player->aiming;
|
aimingangle = player->aiming;
|
||||||
viewangle = viewmobj->angle;
|
viewangle = r_viewmobj->angle;
|
||||||
|
|
||||||
if (!demoplayback && player->playerstate != PST_DEAD)
|
if (!demoplayback && player->playerstate != PST_DEAD)
|
||||||
{
|
{
|
||||||
|
@ -856,13 +855,13 @@ void R_SetupFrame(player_t *player)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
viewx = viewmobj->x;
|
viewx = r_viewmobj->x;
|
||||||
viewy = viewmobj->y;
|
viewy = r_viewmobj->y;
|
||||||
viewx += quake.x;
|
viewx += quake.x;
|
||||||
viewy += quake.y;
|
viewy += quake.y;
|
||||||
|
|
||||||
if (viewmobj->subsector)
|
if (r_viewmobj->subsector)
|
||||||
viewsector = viewmobj->subsector->sector;
|
viewsector = r_viewmobj->subsector->sector;
|
||||||
else
|
else
|
||||||
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
||||||
}
|
}
|
||||||
|
@ -884,12 +883,12 @@ void R_SkyboxFrame(player_t *player)
|
||||||
thiscam = &camera;
|
thiscam = &camera;
|
||||||
|
|
||||||
// cut-away view stuff
|
// cut-away view stuff
|
||||||
viewmobj = skyboxmo[0];
|
r_viewmobj = skyboxmo[0];
|
||||||
#ifdef PARANOIA
|
#ifdef PARANOIA
|
||||||
if (!viewmobj)
|
if (!r_viewmobj)
|
||||||
{
|
{
|
||||||
const size_t playeri = (size_t)(player - players);
|
const size_t playeri = (size_t)(player - players);
|
||||||
I_Error("R_SkyboxFrame: viewmobj null (player %s)", sizeu1(playeri));
|
I_Error("R_SkyboxFrame: r_viewmobj null (player %s)", sizeu1(playeri));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (player->awayviewtics)
|
if (player->awayviewtics)
|
||||||
|
@ -920,13 +919,13 @@ void R_SkyboxFrame(player_t *player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
viewangle += viewmobj->angle;
|
viewangle += r_viewmobj->angle;
|
||||||
|
|
||||||
viewplayer = player;
|
viewplayer = player;
|
||||||
|
|
||||||
viewx = viewmobj->x;
|
viewx = r_viewmobj->x;
|
||||||
viewy = viewmobj->y;
|
viewy = r_viewmobj->y;
|
||||||
viewz = viewmobj->z; // 26/04/17: use actual Z position instead of spawnpoint angle!
|
viewz = r_viewmobj->z; // 26/04/17: use actual Z position instead of spawnpoint angle!
|
||||||
|
|
||||||
if (mapheaderinfo[gamemap-1])
|
if (mapheaderinfo[gamemap-1])
|
||||||
{
|
{
|
||||||
|
@ -966,29 +965,29 @@ void R_SkyboxFrame(player_t *player)
|
||||||
else if (mh->skybox_scaley < 0)
|
else if (mh->skybox_scaley < 0)
|
||||||
y = (campos.y - skyboxmo[1]->y) * -mh->skybox_scaley;
|
y = (campos.y - skyboxmo[1]->y) * -mh->skybox_scaley;
|
||||||
|
|
||||||
if (viewmobj->angle == 0)
|
if (r_viewmobj->angle == 0)
|
||||||
{
|
{
|
||||||
viewx += x;
|
viewx += x;
|
||||||
viewy += y;
|
viewy += y;
|
||||||
}
|
}
|
||||||
else if (viewmobj->angle == ANGLE_90)
|
else if (r_viewmobj->angle == ANGLE_90)
|
||||||
{
|
{
|
||||||
viewx -= y;
|
viewx -= y;
|
||||||
viewy += x;
|
viewy += x;
|
||||||
}
|
}
|
||||||
else if (viewmobj->angle == ANGLE_180)
|
else if (r_viewmobj->angle == ANGLE_180)
|
||||||
{
|
{
|
||||||
viewx -= x;
|
viewx -= x;
|
||||||
viewy -= y;
|
viewy -= y;
|
||||||
}
|
}
|
||||||
else if (viewmobj->angle == ANGLE_270)
|
else if (r_viewmobj->angle == ANGLE_270)
|
||||||
{
|
{
|
||||||
viewx += y;
|
viewx += y;
|
||||||
viewy -= x;
|
viewy -= x;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
angle_t ang = viewmobj->angle>>ANGLETOFINESHIFT;
|
angle_t ang = r_viewmobj->angle>>ANGLETOFINESHIFT;
|
||||||
viewx += FixedMul(x,FINECOSINE(ang)) - FixedMul(y, FINESINE(ang));
|
viewx += FixedMul(x,FINECOSINE(ang)) - FixedMul(y, FINESINE(ang));
|
||||||
viewy += FixedMul(x, FINESINE(ang)) + FixedMul(y,FINECOSINE(ang));
|
viewy += FixedMul(x, FINESINE(ang)) + FixedMul(y,FINECOSINE(ang));
|
||||||
}
|
}
|
||||||
|
@ -999,8 +998,8 @@ void R_SkyboxFrame(player_t *player)
|
||||||
viewz += campos.z * -mh->skybox_scalez;
|
viewz += campos.z * -mh->skybox_scalez;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (viewmobj->subsector)
|
if (r_viewmobj->subsector)
|
||||||
viewsector = viewmobj->subsector->sector;
|
viewsector = r_viewmobj->subsector->sector;
|
||||||
else
|
else
|
||||||
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,7 @@ extern fixed_t viewx, viewy, viewz;
|
||||||
extern angle_t viewangle, aimingangle;
|
extern angle_t viewangle, aimingangle;
|
||||||
extern sector_t *viewsector;
|
extern sector_t *viewsector;
|
||||||
extern player_t *viewplayer;
|
extern player_t *viewplayer;
|
||||||
|
extern mobj_t *r_viewmobj;
|
||||||
|
|
||||||
extern consvar_t cv_allowmlook;
|
extern consvar_t cv_allowmlook;
|
||||||
extern consvar_t cv_maxportals;
|
extern consvar_t cv_maxportals;
|
||||||
|
|
|
@ -1413,7 +1413,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
|
|
||||||
thing = thing->tracer;
|
thing = thing->tracer;
|
||||||
|
|
||||||
if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)
|
if (! R_ThingVisible(thing))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tr_x = thing->x - viewx;
|
tr_x = thing->x - viewx;
|
||||||
|
@ -1808,7 +1808,7 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel)
|
||||||
mobj_t *thing;
|
mobj_t *thing;
|
||||||
precipmobj_t *precipthing; // Tails 08-25-2002
|
precipmobj_t *precipthing; // Tails 08-25-2002
|
||||||
INT32 lightnum;
|
INT32 lightnum;
|
||||||
fixed_t approx_dist, limit_dist, hoop_limit_dist;
|
fixed_t limit_dist, hoop_limit_dist;
|
||||||
|
|
||||||
if (rendermode != render_soft)
|
if (rendermode != render_soft)
|
||||||
return;
|
return;
|
||||||
|
@ -1841,35 +1841,10 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel)
|
||||||
// If a limit exists, handle things a tiny bit different.
|
// If a limit exists, handle things a tiny bit different.
|
||||||
limit_dist = (fixed_t)(cv_drawdist.value) << FRACBITS;
|
limit_dist = (fixed_t)(cv_drawdist.value) << FRACBITS;
|
||||||
hoop_limit_dist = (fixed_t)(cv_drawdist_nights.value) << FRACBITS;
|
hoop_limit_dist = (fixed_t)(cv_drawdist_nights.value) << FRACBITS;
|
||||||
if (limit_dist || hoop_limit_dist)
|
for (thing = sec->thinglist; thing; thing = thing->snext)
|
||||||
{
|
{
|
||||||
for (thing = sec->thinglist; thing; thing = thing->snext)
|
if (R_ThingVisibleWithinDist(thing, limit_dist, hoop_limit_dist))
|
||||||
{
|
|
||||||
if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y);
|
|
||||||
|
|
||||||
if (thing->sprite == SPR_HOOP)
|
|
||||||
{
|
|
||||||
if (hoop_limit_dist && approx_dist > hoop_limit_dist)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (limit_dist && approx_dist > limit_dist)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
R_ProjectSprite(thing);
|
R_ProjectSprite(thing);
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Draw everything in sector, no checks
|
|
||||||
for (thing = sec->thinglist; thing; thing = thing->snext)
|
|
||||||
if (!(thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW))
|
|
||||||
R_ProjectSprite(thing);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// no, no infinite draw distance for precipitation. this option at zero is supposed to turn it off
|
// no, no infinite draw distance for precipitation. this option at zero is supposed to turn it off
|
||||||
|
@ -1877,15 +1852,8 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel)
|
||||||
{
|
{
|
||||||
for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext)
|
for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext)
|
||||||
{
|
{
|
||||||
if (precipthing->precipflags & PCF_INVISIBLE)
|
if (R_PrecipThingVisible(precipthing, limit_dist))
|
||||||
continue;
|
R_ProjectPrecipitationSprite(precipthing);
|
||||||
|
|
||||||
approx_dist = P_AproxDistance(viewx-precipthing->x, viewy-precipthing->y);
|
|
||||||
|
|
||||||
if (approx_dist > limit_dist)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
R_ProjectPrecipitationSprite(precipthing);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2580,6 +2548,55 @@ void R_ClipSprites(drawseg_t* dsstart, portal_t* portal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check if thing may be drawn from our current view. */
|
||||||
|
boolean R_ThingVisible (mobj_t *thing)
|
||||||
|
{
|
||||||
|
return (!(
|
||||||
|
thing->sprite == SPR_NULL ||
|
||||||
|
( thing->flags2 & (MF2_DONTDRAW) ) ||
|
||||||
|
thing == r_viewmobj
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean R_ThingVisibleWithinDist (mobj_t *thing,
|
||||||
|
fixed_t limit_dist,
|
||||||
|
fixed_t hoop_limit_dist)
|
||||||
|
{
|
||||||
|
fixed_t approx_dist;
|
||||||
|
|
||||||
|
if (! R_ThingVisible(thing))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y);
|
||||||
|
|
||||||
|
if (thing->sprite == SPR_HOOP)
|
||||||
|
{
|
||||||
|
if (hoop_limit_dist && approx_dist > hoop_limit_dist)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (limit_dist && approx_dist > limit_dist)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if precipitation may be drawn from our current view. */
|
||||||
|
boolean R_PrecipThingVisible (precipmobj_t *precipthing,
|
||||||
|
fixed_t limit_dist)
|
||||||
|
{
|
||||||
|
fixed_t approx_dist;
|
||||||
|
|
||||||
|
if (( precipthing->precipflags & PCF_INVISIBLE ))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
approx_dist = P_AproxDistance(viewx-precipthing->x, viewy-precipthing->y);
|
||||||
|
|
||||||
|
return ( approx_dist <= limit_dist );
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// R_DrawMasked
|
// R_DrawMasked
|
||||||
//
|
//
|
||||||
|
|
|
@ -61,6 +61,15 @@ void R_InitSprites(void);
|
||||||
void R_ClearSprites(void);
|
void R_ClearSprites(void);
|
||||||
void R_ClipSprites(drawseg_t* dsstart, portal_t* portal);
|
void R_ClipSprites(drawseg_t* dsstart, portal_t* portal);
|
||||||
|
|
||||||
|
boolean R_ThingVisible (mobj_t *thing);
|
||||||
|
|
||||||
|
boolean R_ThingVisibleWithinDist (mobj_t *thing,
|
||||||
|
fixed_t draw_dist,
|
||||||
|
fixed_t nights_draw_dist);
|
||||||
|
|
||||||
|
boolean R_PrecipThingVisible (precipmobj_t *precipthing,
|
||||||
|
fixed_t precip_draw_dist);
|
||||||
|
|
||||||
/** Used to count the amount of masked elements
|
/** Used to count the amount of masked elements
|
||||||
* per portal to later group them in separate
|
* per portal to later group them in separate
|
||||||
* drawnode lists.
|
* drawnode lists.
|
||||||
|
|
|
@ -360,10 +360,13 @@ void SCR_Recalc(void)
|
||||||
vid.fsmalldupy = vid.smalldupy*FRACUNIT;
|
vid.fsmalldupy = vid.smalldupy*FRACUNIT;
|
||||||
#endif
|
#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.
|
// be calculated next time the automap is activated.
|
||||||
if (automapactive)
|
if (automapactive)
|
||||||
AM_Stop();
|
{
|
||||||
|
am_recalc = true;
|
||||||
|
AM_Start();
|
||||||
|
}
|
||||||
|
|
||||||
// set the screen[x] ptrs on the new vidbuffers
|
// set the screen[x] ptrs on the new vidbuffers
|
||||||
V_Init();
|
V_Init();
|
||||||
|
|
|
@ -3244,7 +3244,6 @@ Unoptimized version
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Taken from my videos-in-SRB2 project
|
|
||||||
// Generates a color look-up table
|
// Generates a color look-up table
|
||||||
// which has up to 64 colors at each channel
|
// which has up to 64 colors at each channel
|
||||||
// (see the defines in v_video.h)
|
// (see the defines in v_video.h)
|
||||||
|
@ -3261,7 +3260,7 @@ void InitColorLUT(RGBA_t *palette)
|
||||||
for (r = 0; r < CLUTSIZE; r++)
|
for (r = 0; r < CLUTSIZE; r++)
|
||||||
for (g = 0; g < CLUTSIZE; g++)
|
for (g = 0; g < CLUTSIZE; g++)
|
||||||
for (b = 0; b < CLUTSIZE; b++)
|
for (b = 0; b < CLUTSIZE; b++)
|
||||||
colorlookup[r][g][b] = NearestColor(r << SHIFTCOLORBITS, g << SHIFTCOLORBITS, b << SHIFTCOLORBITS);
|
colorlookup[r][g][b] = NearestPaletteColor(r << SHIFTCOLORBITS, g << SHIFTCOLORBITS, b << SHIFTCOLORBITS, palette);
|
||||||
clutinit = true;
|
clutinit = true;
|
||||||
lastpalette = palette;
|
lastpalette = palette;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,10 +37,7 @@ cv_allcaps;
|
||||||
// Allocates buffer screens, call before R_Init.
|
// Allocates buffer screens, call before R_Init.
|
||||||
void V_Init(void);
|
void V_Init(void);
|
||||||
|
|
||||||
// Taken from my videos-in-SRB2 project
|
// Color look-up table
|
||||||
// Generates a color look-up table
|
|
||||||
// which has up to 64 colors at each channel
|
|
||||||
|
|
||||||
#define COLORBITS 6
|
#define COLORBITS 6
|
||||||
#define SHIFTCOLORBITS (8-COLORBITS)
|
#define SHIFTCOLORBITS (8-COLORBITS)
|
||||||
#define CLUTSIZE (1<<COLORBITS)
|
#define CLUTSIZE (1<<COLORBITS)
|
||||||
|
|
16
src/w_wad.c
16
src/w_wad.c
|
@ -822,13 +822,11 @@ UINT16 W_InitFile(const char *filename, boolean mainfile)
|
||||||
* backwards, so a later file overrides all earlier ones.
|
* backwards, so a later file overrides all earlier ones.
|
||||||
*
|
*
|
||||||
* \param filenames A null-terminated list of files to use.
|
* \param filenames A null-terminated list of files to use.
|
||||||
* \return 1 if all files were loaded, 0 if at least one was missing or
|
* \return 1 if base files were loaded, 0 if at least one was missing or
|
||||||
* invalid.
|
* invalid.
|
||||||
*/
|
*/
|
||||||
INT32 W_InitMultipleFiles(char **filenames, UINT16 mainfiles)
|
INT32 W_InitMultipleFiles(char **filenames, UINT16 mainfiles)
|
||||||
{
|
{
|
||||||
INT32 rc = 1;
|
|
||||||
|
|
||||||
// open all the files, load headers, and count lumps
|
// open all the files, load headers, and count lumps
|
||||||
numwadfiles = 0;
|
numwadfiles = 0;
|
||||||
|
|
||||||
|
@ -836,13 +834,15 @@ INT32 W_InitMultipleFiles(char **filenames, UINT16 mainfiles)
|
||||||
for (; *filenames; filenames++)
|
for (; *filenames; filenames++)
|
||||||
{
|
{
|
||||||
//CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames);
|
//CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames);
|
||||||
rc &= (W_InitFile(*filenames, numwadfiles < mainfiles) != INT16_MAX) ? 1 : 0;
|
if (W_InitFile(*filenames, numwadfiles < mainfiles) == INT16_MAX)
|
||||||
|
{
|
||||||
|
CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), *filenames);
|
||||||
|
if (numwadfiles < mainfiles)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!numwadfiles)
|
return 1;
|
||||||
I_Error("W_InitMultipleFiles: no files found");
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Make sure a lump number is valid.
|
/** Make sure a lump number is valid.
|
||||||
|
|
Loading…
Reference in New Issue