mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Fix the automap
This commit is contained in:
parent
feb7b05e6e
commit
6b22dc183b
6 changed files with 116 additions and 288 deletions
362
src/am_map.c
362
src/am_map.c
|
@ -11,8 +11,8 @@
|
|||
/// \file am_map.c
|
||||
/// \brief Code for the 'automap', former Doom feature used for DEVMODE testing
|
||||
|
||||
#include "g_game.h"
|
||||
#include "am_map.h"
|
||||
#include "g_game.h"
|
||||
#include "g_input.h"
|
||||
#include "p_local.h"
|
||||
#include "p_slopes.h"
|
||||
|
@ -33,7 +33,6 @@ 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 GREENRANGE = 16;
|
||||
static const UINT8 DBLACK = 31;
|
||||
static const UINT8 DWHITE = 0;
|
||||
|
||||
|
@ -50,8 +49,6 @@ static const UINT8 NOCLIMBYELLOWS = (11*16);
|
|||
|
||||
// Automap colors
|
||||
#define BACKGROUND DBLACK
|
||||
#define YOURCOLORS DWHITE
|
||||
#define YOURRANGE 0
|
||||
#define WALLCOLORS (REDS + REDRANGE/2)
|
||||
#define WALLRANGE (REDRANGE/2)
|
||||
#define NOCLIMBWALLCOLORS (NOCLIMBREDS + NOCLIMBREDRANGE/2)
|
||||
|
@ -68,31 +65,23 @@ static const UINT8 NOCLIMBYELLOWS = (11*16);
|
|||
#define CDWALLCOLORS YELLOWS
|
||||
#define NOCLIMBCDWALLCOLORS NOCLIMBYELLOWS
|
||||
#define THINGCOLORS GREENS
|
||||
#define THINGRANGE GREENRANGE
|
||||
#define SECRETWALLCOLORS WALLCOLORS
|
||||
#define SECRETWALLRANGE WALLRANGE
|
||||
#define GRIDCOLORS (GRAYS + GRAYSRANGE/2)
|
||||
#define GRIDRANGE 0
|
||||
#define XHAIRCOLORS GRAYS
|
||||
|
||||
// drawing stuff
|
||||
#define FB 0
|
||||
|
||||
#define AM_PANDOWNKEY KEY_DOWNARROW
|
||||
// controls
|
||||
#define AM_PANUPKEY KEY_UPARROW
|
||||
#define AM_PANRIGHTKEY KEY_RIGHTARROW
|
||||
#define AM_PANDOWNKEY KEY_DOWNARROW
|
||||
#define AM_PANLEFTKEY KEY_LEFTARROW
|
||||
#define AM_PANRIGHTKEY KEY_RIGHTARROW
|
||||
|
||||
#define AM_ZOOMINKEY '='
|
||||
#define AM_ZOOMOUTKEY '-'
|
||||
#define AM_STARTKEY KEY_TAB
|
||||
#define AM_ENDKEY KEY_TAB
|
||||
#define AM_GOBIGKEY '0'
|
||||
|
||||
#define AM_FOLLOWKEY 'f'
|
||||
#define AM_GRIDKEY 'g'
|
||||
#define AM_MARKKEY 'm'
|
||||
#define AM_CLEARMARKKEY 'c'
|
||||
|
||||
#define AM_NUMMARKPOINTS 10
|
||||
#define AM_TOGGLEKEY KEY_TAB
|
||||
|
||||
// scale on entry
|
||||
#define INITSCALEMTOF (FRACUNIT/5)
|
||||
|
@ -110,8 +99,11 @@ static const UINT8 NOCLIMBYELLOWS = (11*16);
|
|||
#define FTOM(x) FixedMul(((x)<<FRACBITS),scale_ftom)
|
||||
#define MTOF(x) (FixedMul((x),scale_mtof)>>FRACBITS)
|
||||
// translates between frame-buffer and map coordinates
|
||||
#define CXMTOF(x) (f_x + MTOF((x)-m_x))
|
||||
#define CYMTOF(y) (f_y + (f_h - MTOF((y)-m_y)))
|
||||
#define CXMTOF(x) (f_x - (f_x/2) + MTOF((x)-m_x))
|
||||
#define CYMTOF(y) (f_y - (f_y/2) + (f_h - MTOF((y)-m_y)))
|
||||
|
||||
#define MAPBITS (FRACBITS-4)
|
||||
#define FRACTOMAPBITS (FRACBITS-MAPBITS)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -133,7 +125,10 @@ typedef struct
|
|||
// A line drawing of the player pointing right,
|
||||
// starting from the middle.
|
||||
//
|
||||
|
||||
#define PLAYERRADIUS (16*(1<<MAPBITS))
|
||||
#define R ((8*PLAYERRADIUS)/7)
|
||||
|
||||
static const mline_t player_arrow[] = {
|
||||
{ { -R+R/8, 0 }, { R, 0 } }, // -----
|
||||
{ { R, 0 }, { R-R/2, R/4 } }, // ----->
|
||||
|
@ -166,27 +161,15 @@ static const mline_t thintriangle_guy[] = {
|
|||
#undef R
|
||||
#define NUMTHINTRIANGLEGUYLINES (sizeof (thintriangle_guy)/sizeof (mline_t))
|
||||
|
||||
static INT32 bigstate; //added : 24-01-98 : moved here, toggle between
|
||||
// user view and large view (full map view)
|
||||
|
||||
static INT32 grid = 0;
|
||||
|
||||
static INT32 leveljuststarted = 1; // kluge until AM_LevelInit() is called
|
||||
static boolean bigstate; // user view and large view (full map view)
|
||||
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;
|
||||
|
||||
// location of window on screen
|
||||
static INT32 f_x;
|
||||
static INT32 f_y;
|
||||
|
||||
// size of window on screen
|
||||
static INT32 f_w;
|
||||
static INT32 f_h;
|
||||
|
||||
static INT32 lightlev; // used for funky strobing effect
|
||||
static UINT8 *fb; // pseudo-frame buffer
|
||||
static INT32 amclock;
|
||||
static 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 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)
|
||||
|
@ -210,11 +193,6 @@ static fixed_t max_y;
|
|||
static fixed_t max_w; // max_x-min_x,
|
||||
static fixed_t max_h; // max_y-min_y
|
||||
|
||||
// based on player size
|
||||
static fixed_t min_w;
|
||||
static fixed_t min_h;
|
||||
|
||||
|
||||
static fixed_t min_scale_mtof; // used to tell when to stop zooming out
|
||||
static fixed_t max_scale_mtof; // used to tell when to stop zooming in
|
||||
|
||||
|
@ -232,13 +210,7 @@ static fixed_t scale_ftom;
|
|||
|
||||
static player_t *plr; // the player represented by an arrow
|
||||
|
||||
static patch_t *marknums[10]; // numbers used for marking by the automap
|
||||
static mpoint_t markpoints[AM_NUMMARKPOINTS]; // where the points are
|
||||
static INT32 markpointnum = 0; // next point to be assigned
|
||||
|
||||
static INT32 followplayer = 1; // specifies whether to follow the player around
|
||||
|
||||
static boolean stopped = true;
|
||||
static INT32 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);
|
||||
|
@ -277,8 +249,8 @@ static inline void AM_restoreScaleAndLoc(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
m_x = plr->mo->x - m_w/2;
|
||||
m_y = plr->mo->y - m_h/2;
|
||||
m_x = (plr->mo->x >> FRACTOMAPBITS) - m_w/2;
|
||||
m_y = (plr->mo->y >> FRACTOMAPBITS) - m_h/2;
|
||||
}
|
||||
m_x2 = m_x + m_w;
|
||||
m_y2 = m_y + m_h;
|
||||
|
@ -288,15 +260,6 @@ static inline void AM_restoreScaleAndLoc(void)
|
|||
scale_ftom = FixedDiv(FRACUNIT, scale_mtof);
|
||||
}
|
||||
|
||||
/** Adds a marker at the current location.
|
||||
*/
|
||||
static inline void AM_addMark(void)
|
||||
{
|
||||
markpoints[markpointnum].x = m_x + m_w/2;
|
||||
markpoints[markpointnum].y = m_y + m_h/2;
|
||||
markpointnum = (markpointnum + 1) % AM_NUMMARKPOINTS;
|
||||
}
|
||||
|
||||
/** Determines the bounding box around all vertices.
|
||||
* This is used to set global variables controlling the zoom range.
|
||||
*/
|
||||
|
@ -322,11 +285,8 @@ static void AM_findMinMaxBoundaries(void)
|
|||
max_y = vertexes[i].y;
|
||||
}
|
||||
|
||||
max_w = max_x - min_x;
|
||||
max_h = max_y - min_y;
|
||||
|
||||
min_w = 2*PLAYERRADIUS; // const? never changed?
|
||||
min_h = 2*PLAYERRADIUS;
|
||||
max_w = (max_x >>= FRACTOMAPBITS) - (min_x >>= FRACTOMAPBITS);
|
||||
max_h = (max_y >>= FRACTOMAPBITS) - (min_y >>= FRACTOMAPBITS);
|
||||
|
||||
a = FixedDiv(f_w<<FRACBITS, max_w);
|
||||
b = FixedDiv(f_h<<FRACBITS, max_h);
|
||||
|
@ -339,7 +299,7 @@ static void AM_changeWindowLoc(void)
|
|||
{
|
||||
if (m_paninc.x || m_paninc.y)
|
||||
{
|
||||
followplayer = 0;
|
||||
followplayer = false;
|
||||
f_oldloc.x = INT32_MAX;
|
||||
}
|
||||
|
||||
|
@ -365,11 +325,7 @@ static void AM_initVariables(void)
|
|||
INT32 pnum;
|
||||
|
||||
automapactive = true;
|
||||
fb = screens[0];
|
||||
|
||||
f_oldloc.x = INT32_MAX;
|
||||
amclock = 0;
|
||||
lightlev = 0;
|
||||
|
||||
m_paninc.x = m_paninc.y = 0;
|
||||
ftom_zoommul = FRACUNIT;
|
||||
|
@ -385,8 +341,11 @@ static void AM_initVariables(void)
|
|||
break;
|
||||
|
||||
plr = &players[pnum];
|
||||
m_x = plr->mo->x - m_w/2;
|
||||
m_y = plr->mo->y - m_h/2;
|
||||
if (plr != NULL && plr->mo != NULL)
|
||||
{
|
||||
m_x = (plr->mo->x >> FRACTOMAPBITS) - m_w/2;
|
||||
m_y = (plr->mo->y >> FRACTOMAPBITS) - m_h/2;
|
||||
}
|
||||
AM_changeWindowLoc();
|
||||
|
||||
// for saving & restoring
|
||||
|
@ -396,41 +355,27 @@ static void AM_initVariables(void)
|
|||
old_m_h = m_h;
|
||||
}
|
||||
|
||||
static const UINT8 *maplump; // pointer to the raw data for the automap background.
|
||||
|
||||
/** Clears all map markers.
|
||||
*/
|
||||
static void AM_clearMarks(void)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < AM_NUMMARKPOINTS; i++)
|
||||
markpoints[i].x = -1; // means empty
|
||||
markpointnum = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// should be called at the start of every level
|
||||
// right now, i figure it out myself
|
||||
//
|
||||
static void AM_LevelInit(void)
|
||||
{
|
||||
leveljuststarted = 0;
|
||||
|
||||
f_x = f_y = 0;
|
||||
f_w = vid.width;
|
||||
f_h = vid.height;
|
||||
|
||||
if (rendermode == render_soft)
|
||||
AM_drawFline = AM_drawFline_soft;
|
||||
#ifdef HWRENDER // not win32 only 19990829 by Kin
|
||||
else if (rendermode != render_none)
|
||||
// Jimita
|
||||
#ifdef MINIAUTOMAP
|
||||
f_x = f_w / 2;
|
||||
f_y = f_h / 2;
|
||||
#endif
|
||||
|
||||
AM_drawFline = AM_drawFline_soft;
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
AM_drawFline = HWR_drawAMline;
|
||||
#endif
|
||||
else
|
||||
I_Error("Automap can't run without a render system");
|
||||
|
||||
AM_clearMarks();
|
||||
|
||||
AM_findMinMaxBoundaries();
|
||||
scale_mtof = FixedDiv(min_scale_mtof*10, 7*FRACUNIT);
|
||||
|
@ -446,7 +391,7 @@ static void AM_LevelInit(void)
|
|||
void AM_Stop(void)
|
||||
{
|
||||
automapactive = false;
|
||||
stopped = true;
|
||||
am_stopped = true;
|
||||
}
|
||||
|
||||
/** Enables automap.
|
||||
|
@ -457,15 +402,14 @@ static inline void AM_Start(void)
|
|||
{
|
||||
static INT32 lastlevel = -1;
|
||||
|
||||
if (!stopped)
|
||||
if (!am_stopped)
|
||||
AM_Stop();
|
||||
stopped = false;
|
||||
am_stopped = false;
|
||||
if (lastlevel != gamemap || am_recalc) // screen size changed
|
||||
{
|
||||
am_recalc = false;
|
||||
|
||||
AM_LevelInit();
|
||||
lastlevel = gamemap;
|
||||
am_recalc = false;
|
||||
}
|
||||
AM_initVariables();
|
||||
}
|
||||
|
@ -503,7 +447,7 @@ boolean AM_Responder(event_t *ev)
|
|||
{
|
||||
if (!automapactive)
|
||||
{
|
||||
if (ev->type == ev_keydown && ev->data1 == AM_STARTKEY)
|
||||
if (ev->type == ev_keydown && ev->data1 == AM_TOGGLEKEY)
|
||||
{
|
||||
//faB: prevent alt-tab in win32 version to activate automap just before
|
||||
// minimizing the app; doesn't do any harm to the DOS version
|
||||
|
@ -515,10 +459,8 @@ boolean AM_Responder(event_t *ev)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (ev->type == ev_keydown)
|
||||
{
|
||||
|
||||
rc = true;
|
||||
switch (ev->data1)
|
||||
{
|
||||
|
@ -554,7 +496,7 @@ boolean AM_Responder(event_t *ev)
|
|||
mtof_zoommul = M_ZOOMIN;
|
||||
ftom_zoommul = M_ZOOMOUT;
|
||||
break;
|
||||
case AM_ENDKEY:
|
||||
case AM_TOGGLEKEY:
|
||||
AM_Stop();
|
||||
break;
|
||||
case AM_GOBIGKEY:
|
||||
|
@ -572,13 +514,7 @@ boolean AM_Responder(event_t *ev)
|
|||
f_oldloc.x = INT32_MAX;
|
||||
break;
|
||||
case AM_GRIDKEY:
|
||||
grid = !grid;
|
||||
break;
|
||||
case AM_MARKKEY:
|
||||
AM_addMark();
|
||||
break;
|
||||
case AM_CLEARMARKKEY:
|
||||
AM_clearMarks();
|
||||
draw_grid = !draw_grid;
|
||||
break;
|
||||
default:
|
||||
rc = false;
|
||||
|
@ -632,8 +568,8 @@ static inline void AM_doFollowPlayer(void)
|
|||
{
|
||||
if (f_oldloc.x != plr->mo->x || f_oldloc.y != plr->mo->y)
|
||||
{
|
||||
m_x = FTOM(MTOF(plr->mo->x)) - m_w/2;
|
||||
m_y = FTOM(MTOF(plr->mo->y)) - m_h/2;
|
||||
m_x = FTOM(MTOF(plr->mo->x >> FRACTOMAPBITS)) - m_w/2;
|
||||
m_y = FTOM(MTOF(plr->mo->y >> FRACTOMAPBITS)) - m_h/2;
|
||||
m_x2 = m_x + m_w;
|
||||
m_y2 = m_y + m_h;
|
||||
f_oldloc.x = plr->mo->x;
|
||||
|
@ -651,8 +587,6 @@ void AM_Ticker(void)
|
|||
if (dedicated || !automapactive)
|
||||
return;
|
||||
|
||||
amclock++;
|
||||
|
||||
if (followplayer)
|
||||
AM_doFollowPlayer();
|
||||
|
||||
|
@ -671,72 +605,7 @@ void AM_Ticker(void)
|
|||
*/
|
||||
static void AM_clearFB(INT32 color)
|
||||
{
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft && rendermode != render_none)
|
||||
{
|
||||
HWR_clearAutomap();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!maplump)
|
||||
memset(fb, color, f_w*f_h*vid.bpp);
|
||||
else
|
||||
{
|
||||
INT32 dmapx, dmapy, i, y;
|
||||
static INT32 mapxstart, mapystart;
|
||||
UINT8 *dest = screens[0];
|
||||
const UINT8 *src;
|
||||
#define MAPLUMPHEIGHT (200 - 42)
|
||||
|
||||
if (followplayer)
|
||||
{
|
||||
static vertex_t oldplr;
|
||||
|
||||
dmapx = MTOF(plr->mo->x) - MTOF(oldplr.x); //fixed point
|
||||
dmapy = MTOF(oldplr.y) - MTOF(plr->mo->y);
|
||||
|
||||
oldplr.x = plr->mo->x;
|
||||
oldplr.y = plr->mo->y;
|
||||
mapxstart += dmapx>>1;
|
||||
mapystart += dmapy>>1;
|
||||
|
||||
while (mapxstart >= BASEVIDWIDTH)
|
||||
mapxstart -= BASEVIDWIDTH;
|
||||
while (mapxstart < 0)
|
||||
mapxstart += BASEVIDWIDTH;
|
||||
while (mapystart >= MAPLUMPHEIGHT)
|
||||
mapystart -= MAPLUMPHEIGHT;
|
||||
while (mapystart < 0)
|
||||
mapystart += MAPLUMPHEIGHT;
|
||||
}
|
||||
else
|
||||
{
|
||||
mapxstart += (MTOF(m_paninc.x)>>1);
|
||||
mapystart -= (MTOF(m_paninc.y)>>1);
|
||||
if (mapxstart >= BASEVIDWIDTH)
|
||||
mapxstart -= BASEVIDWIDTH;
|
||||
if (mapxstart < 0)
|
||||
mapxstart += BASEVIDWIDTH;
|
||||
if (mapystart >= MAPLUMPHEIGHT)
|
||||
mapystart -= MAPLUMPHEIGHT;
|
||||
if (mapystart < 0)
|
||||
mapystart += MAPLUMPHEIGHT;
|
||||
}
|
||||
|
||||
//blit the automap background to the screen.
|
||||
for (y = 0; y < f_h; y++)
|
||||
{
|
||||
src = maplump + mapxstart + (y + mapystart)*BASEVIDWIDTH;
|
||||
for (i = 0; i < BASEVIDWIDTH*vid.dupx; i++)
|
||||
{
|
||||
while (src > maplump + BASEVIDWIDTH*MAPLUMPHEIGHT)
|
||||
src -= BASEVIDWIDTH*MAPLUMPHEIGHT;
|
||||
*dest++ = *src++;
|
||||
}
|
||||
dest += vid.width - vid.dupx*BASEVIDWIDTH;
|
||||
}
|
||||
}
|
||||
V_DrawFill(f_x, f_y, f_w, f_h, color|V_NOSCALESTART);
|
||||
}
|
||||
|
||||
/** Performs automap clipping of lines.
|
||||
|
@ -871,7 +740,7 @@ static boolean AM_clipMline(const mline_t *ml, fline_t *fl)
|
|||
//
|
||||
static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
||||
{
|
||||
register INT32 x, y, dx, dy, sx, sy, ax, ay, d;
|
||||
fixed_t x, y, dx, dy, sx, sy, ax, ay, d;
|
||||
|
||||
#ifdef _DEBUG
|
||||
static INT32 num = 0;
|
||||
|
@ -887,7 +756,8 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
|||
}
|
||||
#endif
|
||||
|
||||
#define PUTDOT(xx,yy,cc) fb[(yy)*f_w + (xx)]=(UINT8)(cc)
|
||||
#define PUTDOT(xx,yy,cc) V_DrawFill(xx,yy,1,1,cc|V_NOSCALESTART);
|
||||
#define CLIPDOT (x >= f_x && y >= f_y && x < f_x + f_w && y < f_y + f_h)
|
||||
|
||||
dx = fl->b.x - fl->a.x;
|
||||
ax = 2 * (dx < 0 ? -dx : dx);
|
||||
|
@ -905,7 +775,8 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
|||
d = ay - ax/2;
|
||||
for (;;)
|
||||
{
|
||||
PUTDOT(x, y, color);
|
||||
if (CLIPDOT)
|
||||
PUTDOT(x, y, color)
|
||||
if (x == fl->b.x)
|
||||
return;
|
||||
if (d >= 0)
|
||||
|
@ -922,7 +793,8 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
|||
d = ax - ay/2;
|
||||
for (;;)
|
||||
{
|
||||
PUTDOT(x, y, color);
|
||||
if (CLIPDOT)
|
||||
PUTDOT(x, y, color)
|
||||
if (y == fl->b.y)
|
||||
return;
|
||||
if (d >= 0)
|
||||
|
@ -934,6 +806,9 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
|||
d += ax;
|
||||
}
|
||||
}
|
||||
|
||||
#undef CLIPDOT
|
||||
#undef PUTDOT
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1004,15 +879,15 @@ static inline void AM_drawWalls(void)
|
|||
|
||||
for (i = 0; i < numlines; i++)
|
||||
{
|
||||
l.a.x = lines[i].v1->x;
|
||||
l.a.y = lines[i].v1->y;
|
||||
l.b.x = lines[i].v2->x;
|
||||
l.b.y = lines[i].v2->y;
|
||||
l.a.x = lines[i].v1->x >> FRACTOMAPBITS;
|
||||
l.a.y = lines[i].v1->y >> FRACTOMAPBITS;
|
||||
l.b.x = lines[i].v2->x >> FRACTOMAPBITS;
|
||||
l.b.y = lines[i].v2->y >> FRACTOMAPBITS;
|
||||
#ifdef ESLOPE
|
||||
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
|
||||
if (slope) { \
|
||||
end1 = P_GetZAt(slope, l.a.x, l.a.y); \
|
||||
end2 = P_GetZAt(slope, l.b.x, l.b.y); \
|
||||
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;
|
||||
|
||||
|
@ -1025,17 +900,12 @@ static inline void AM_drawWalls(void)
|
|||
#undef SLOPEPARAMS
|
||||
#endif
|
||||
|
||||
// AM_drawMline(&l, GRAYS + 3); // Old, everything-is-gray automap
|
||||
if (!lines[i].backsector) // 1-sided
|
||||
{
|
||||
if (lines[i].flags & ML_NOCLIMB)
|
||||
{
|
||||
AM_drawMline(&l, NOCLIMBWALLCOLORS+lightlev);
|
||||
}
|
||||
AM_drawMline(&l, NOCLIMBWALLCOLORS);
|
||||
else
|
||||
{
|
||||
AM_drawMline(&l, WALLCOLORS+lightlev);
|
||||
}
|
||||
AM_drawMline(&l, WALLCOLORS);
|
||||
}
|
||||
#ifdef ESLOPE
|
||||
else if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier
|
||||
|
@ -1052,24 +922,16 @@ static inline void AM_drawWalls(void)
|
|||
#endif
|
||||
{
|
||||
if (lines[i].flags & ML_NOCLIMB)
|
||||
{
|
||||
AM_drawMline(&l, NOCLIMBTSWALLCOLORS+lightlev);
|
||||
}
|
||||
AM_drawMline(&l, NOCLIMBTSWALLCOLORS);
|
||||
else
|
||||
{
|
||||
AM_drawMline(&l, TSWALLCOLORS+lightlev);
|
||||
}
|
||||
AM_drawMline(&l, TSWALLCOLORS);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lines[i].flags & ML_NOCLIMB)
|
||||
{
|
||||
AM_drawMline(&l, NOCLIMBTHOKWALLCOLORS+lightlev);
|
||||
}
|
||||
AM_drawMline(&l, NOCLIMBTHOKWALLCOLORS);
|
||||
else
|
||||
{
|
||||
AM_drawMline(&l, THOKWALLCOLORS+lightlev);
|
||||
}
|
||||
AM_drawMline(&l, THOKWALLCOLORS);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1081,7 +943,7 @@ static inline void AM_drawWalls(void)
|
|||
if (lines[i].backsector->floorheight
|
||||
!= lines[i].frontsector->floorheight) {
|
||||
#endif
|
||||
AM_drawMline(&l, NOCLIMBFDWALLCOLORS + lightlev); // floor level change
|
||||
AM_drawMline(&l, NOCLIMBFDWALLCOLORS); // floor level change
|
||||
}
|
||||
#ifdef ESLOPE
|
||||
else if (backc1 != frontc1 || backc2 != frontc2) {
|
||||
|
@ -1089,11 +951,10 @@ static inline void AM_drawWalls(void)
|
|||
else if (lines[i].backsector->ceilingheight
|
||||
!= lines[i].frontsector->ceilingheight) {
|
||||
#endif
|
||||
AM_drawMline(&l, NOCLIMBCDWALLCOLORS+lightlev); // ceiling level change
|
||||
}
|
||||
else {
|
||||
AM_drawMline(&l, NOCLIMBTSWALLCOLORS+lightlev);
|
||||
AM_drawMline(&l, NOCLIMBCDWALLCOLORS); // ceiling level change
|
||||
}
|
||||
else
|
||||
AM_drawMline(&l, NOCLIMBTSWALLCOLORS);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1103,7 +964,7 @@ static inline void AM_drawWalls(void)
|
|||
if (lines[i].backsector->floorheight
|
||||
!= lines[i].frontsector->floorheight) {
|
||||
#endif
|
||||
AM_drawMline(&l, FDWALLCOLORS + lightlev); // floor level change
|
||||
AM_drawMline(&l, FDWALLCOLORS); // floor level change
|
||||
}
|
||||
#ifdef ESLOPE
|
||||
else if (backc1 != frontc1 || backc2 != frontc2) {
|
||||
|
@ -1111,11 +972,10 @@ static inline void AM_drawWalls(void)
|
|||
else if (lines[i].backsector->ceilingheight
|
||||
!= lines[i].frontsector->ceilingheight) {
|
||||
#endif
|
||||
AM_drawMline(&l, CDWALLCOLORS+lightlev); // ceiling level change
|
||||
}
|
||||
else {
|
||||
AM_drawMline(&l, TSWALLCOLORS+lightlev);
|
||||
AM_drawMline(&l, CDWALLCOLORS); // ceiling level change
|
||||
}
|
||||
else
|
||||
AM_drawMline(&l, TSWALLCOLORS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1176,6 +1036,11 @@ static void AM_drawLineCharacter(const mline_t *lineguy, size_t lineguylines, fi
|
|||
l.b.x += x;
|
||||
l.b.y += y;
|
||||
|
||||
l.a.x >>= FRACTOMAPBITS;
|
||||
l.a.y >>= FRACTOMAPBITS;
|
||||
l.b.x >>= FRACTOMAPBITS;
|
||||
l.b.y >>= FRACTOMAPBITS;
|
||||
|
||||
AM_drawMline(&l, color);
|
||||
}
|
||||
}
|
||||
|
@ -1184,83 +1049,51 @@ static inline void AM_drawPlayers(void)
|
|||
{
|
||||
INT32 i;
|
||||
player_t *p;
|
||||
INT32 color;
|
||||
INT32 color = GREENS;
|
||||
|
||||
if (!multiplayer)
|
||||
{
|
||||
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 0,
|
||||
plr->mo->angle, DWHITE, plr->mo->x, plr->mo->y);
|
||||
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 0, plr->mo->angle, DWHITE, plr->mo->x, plr->mo->y);
|
||||
return;
|
||||
}
|
||||
|
||||
// multiplayer
|
||||
// multiplayer (how??)
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator)
|
||||
continue;
|
||||
|
||||
p = &players[i];
|
||||
if (p->skincolor == 0)
|
||||
color = GREENS;
|
||||
else
|
||||
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, 0, p->mo->angle, color, p->mo->x, p->mo->y);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void AM_drawThings(INT32 colors, INT32 colorrange)
|
||||
static inline void AM_drawThings(UINT8 colors)
|
||||
{
|
||||
size_t i;
|
||||
mobj_t *t;
|
||||
|
||||
(void)colorrange;
|
||||
for (i = 0; i < numsectors; i++)
|
||||
{
|
||||
t = sectors[i].thinglist;
|
||||
while (t)
|
||||
{
|
||||
AM_drawLineCharacter(thintriangle_guy, NUMTHINTRIANGLEGUYLINES,
|
||||
16<<FRACBITS, t->angle, colors + lightlev, t->x, t->y);
|
||||
AM_drawLineCharacter(thintriangle_guy, NUMTHINTRIANGLEGUYLINES, 16<<FRACBITS, t->angle, colors, t->x, t->y);
|
||||
t = t->snext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void AM_drawMarks(void)
|
||||
{
|
||||
INT32 i, fx, fy, w, h;
|
||||
|
||||
for (i = 0; i < AM_NUMMARKPOINTS; i++)
|
||||
{
|
||||
if (markpoints[i].x != -1 && marknums[i])
|
||||
{
|
||||
// w = SHORT(marknums[i]->width);
|
||||
// h = SHORT(marknums[i]->height);
|
||||
w = 5; // because something's wrong with the wad, i guess
|
||||
h = 6; // because something's wrong with the wad, i guess
|
||||
fx = CXMTOF(markpoints[i].x);
|
||||
fy = CYMTOF(markpoints[i].y);
|
||||
if (fx >= f_x && fx <= f_w - w && fy >= f_y && fy <= f_h - h)
|
||||
V_DrawPatch(fx, fy, FB, marknums[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Draws the crosshair, actually just a dot in software mode.
|
||||
*
|
||||
* \param color Color for the crosshair.
|
||||
*/
|
||||
static inline void AM_drawCrosshair(INT32 color)
|
||||
static inline void AM_drawCrosshair(UINT8 color)
|
||||
{
|
||||
if (rendermode != render_soft)
|
||||
return; // BP: should be putpixel here
|
||||
|
||||
if (scr_bpp == 1)
|
||||
fb[(f_w*(f_h + 1))/2] = (UINT8)color; // single point for now
|
||||
else
|
||||
*((INT16 *)(void *)fb + (f_w*(f_h + 1))/2) = (INT16)color;
|
||||
V_DrawFill(f_w/2 + f_x, f_h/2 + f_y, 1, 1, color|V_NOSCALESTART);
|
||||
}
|
||||
|
||||
/** Draws the automap.
|
||||
|
@ -1271,13 +1104,10 @@ void AM_Drawer(void)
|
|||
return;
|
||||
|
||||
AM_clearFB(BACKGROUND);
|
||||
if (grid)
|
||||
AM_drawGrid(GRIDCOLORS);
|
||||
if (draw_grid) AM_drawGrid(GRIDCOLORS);
|
||||
AM_drawWalls();
|
||||
AM_drawPlayers();
|
||||
AM_drawThings(THINGCOLORS, THINGRANGE);
|
||||
AM_drawThings(THINGCOLORS);
|
||||
|
||||
AM_drawCrosshair(XHAIRCOLORS);
|
||||
|
||||
AM_drawMarks();
|
||||
}
|
||||
|
|
|
@ -31,6 +31,9 @@ typedef struct
|
|||
#define AM_MSGENTERED (AM_MSGHEADER | ('e'<<8))
|
||||
#define AM_MSGEXITED (AM_MSGHEADER | ('x'<<8))
|
||||
|
||||
// Jimita
|
||||
//#define MINIAUTOMAP
|
||||
|
||||
extern boolean am_recalc; // true if screen size changes
|
||||
extern boolean automapactive; // In AutoMap mode?
|
||||
|
||||
|
|
23
src/d_main.c
23
src/d_main.c
|
@ -319,8 +319,6 @@ static void D_Display(void)
|
|||
if (!gametic)
|
||||
break;
|
||||
HU_Erase();
|
||||
if (automapactive)
|
||||
AM_Drawer();
|
||||
break;
|
||||
|
||||
case GS_INTERMISSION:
|
||||
|
@ -374,12 +372,22 @@ static void D_Display(void)
|
|||
break;
|
||||
}
|
||||
|
||||
// clean up border stuff
|
||||
// see if the border needs to be initially drawn
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
// draw the view directly
|
||||
if (!automapactive && !dedicated && cv_renderview.value)
|
||||
boolean dorenderview = cv_renderview.value;
|
||||
boolean dorenderautomap = false;
|
||||
|
||||
// Jimita
|
||||
if (automapactive)
|
||||
{
|
||||
dorenderautomap = true;
|
||||
#ifndef MINIAUTOMAP
|
||||
dorenderview = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (dorenderview)
|
||||
{
|
||||
if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD)
|
||||
{
|
||||
|
@ -436,8 +444,11 @@ static void D_Display(void)
|
|||
lastdraw = false;
|
||||
}
|
||||
|
||||
ST_Drawer();
|
||||
// Jimita
|
||||
if (dorenderautomap)
|
||||
AM_Drawer();
|
||||
|
||||
ST_Drawer();
|
||||
HU_Drawer();
|
||||
}
|
||||
|
||||
|
|
|
@ -770,18 +770,6 @@ void HWR_DrawViewBorder(INT32 clearlines)
|
|||
// AM_MAP.C DRAWING STUFF
|
||||
// ==========================================================================
|
||||
|
||||
// Clear the automap part of the screen
|
||||
void HWR_clearAutomap(void)
|
||||
{
|
||||
FRGBAFloat fColor = {0, 0, 0, 1};
|
||||
|
||||
// minx,miny,maxx,maxy
|
||||
HWD.pfnGClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE);
|
||||
HWD.pfnClearBuffer(true, true, &fColor);
|
||||
HWD.pfnGClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE);
|
||||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// HWR_drawAMline : draw a line of the automap (the clipping is already done in automap code)
|
||||
// Arg : color is a RGB 888 value
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
void HWR_Startup(void);
|
||||
void HWR_Shutdown(void);
|
||||
|
||||
void HWR_clearAutomap(void);
|
||||
void HWR_drawAMline(const fline_t *fl, INT32 color);
|
||||
void HWR_FadeScreenMenuBack(UINT32 color, INT32 height);
|
||||
void HWR_DrawConsoleBack(UINT32 color, INT32 height);
|
||||
|
|
|
@ -41,9 +41,6 @@
|
|||
// Convenience macro to fix issue with collision along bottom/left edges of blockmap -Red
|
||||
#define BMBOUNDFIX(xl, xh, yl, yh) {if (xl > xh) xl = 0; if (yl > yh) yl = 0;}
|
||||
|
||||
// player radius used only in am_map.c
|
||||
#define PLAYERRADIUS (16*FRACUNIT)
|
||||
|
||||
// MAXRADIUS is for precalculated sector block boxes
|
||||
// the spider demon is larger,
|
||||
// but we do not have any moving sectors nearby
|
||||
|
|
Loading…
Reference in a new issue