- first stage of generic automap code.

Lines and textures get rendered, not all colors are correct - sprites yet to do...
This commit is contained in:
Christoph Oelckers 2020-09-06 20:49:43 +02:00
parent 2395749192
commit 18b39fd952
27 changed files with 494 additions and 241 deletions

View file

@ -166,20 +166,10 @@ void GetInputInternal(InputPacket &inputParm)
input.q16horz -= FloatToFixed(scaleAdjustmentToInterval(info.dpitch / mlookScale)); input.q16horz -= FloatToFixed(scaleAdjustmentToInterval(info.dpitch / mlookScale));
if (automapFollow && automapMode != am_off)
{
inputParm.q16horz = 0;
inputParm.q16avel = 0;
inputParm.fvel = 0;
inputParm.svel = 0;
}
else
{
inputParm.fvel = clamp(inputParm.fvel + input.fvel, -2048, 2048); inputParm.fvel = clamp(inputParm.fvel + input.fvel, -2048, 2048);
inputParm.svel = clamp(inputParm.svel + input.svel, -2048, 2048); inputParm.svel = clamp(inputParm.svel + input.svel, -2048, 2048);
inputParm.q16avel += input.q16avel; inputParm.q16avel += input.q16avel;
inputParm.q16horz = clamp(inputParm.q16horz + input.q16horz, IntToFixed(-127) >> 2, IntToFixed(127) >> 2); inputParm.q16horz = clamp(inputParm.q16horz + input.q16horz, IntToFixed(-127) >> 2, IntToFixed(127) >> 2);
}
if (gMe && gMe->pXSprite && gMe->pXSprite->health != 0 && !paused) if (gMe && gMe->pXSprite && gMe->pXSprite->health != 0 && !paused)
{ {

View file

@ -46,6 +46,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "v_font.h" #include "v_font.h"
#include "glbackend/glbackend.h" #include "glbackend/glbackend.h"
#include "statusbar.h" #include "statusbar.h"
#include "automap.h"
CVARD(Bool, hud_powerupduration, true, CVAR_ARCHIVE/*|CVAR_FRONTEND_BLOOD*/, "enable/disable displaying the remaining seconds for power-ups") CVARD(Bool, hud_powerupduration, true, CVAR_ARCHIVE/*|CVAR_FRONTEND_BLOOD*/, "enable/disable displaying the remaining seconds for power-ups")

View file

@ -626,9 +626,6 @@ void videoInit();
void videoClearViewableArea(int32_t dacol); void videoClearViewableArea(int32_t dacol);
void videoClearScreen(int32_t dacol); void videoClearScreen(int32_t dacol);
void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang); void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang);
void renderDrawLine(int32_t x1, int32_t y1, int32_t x2, int32_t y2, uint8_t col);
void drawlinergb(int32_t x1, int32_t y1, int32_t x2, int32_t y2, palette_t p);
void drawlinergb(int32_t x1, int32_t y1, int32_t x2, int32_t y2, PalEntry p);
class F2DDrawer; class F2DDrawer;

View file

@ -1851,22 +1851,6 @@ void FillPolygon(int* rx1, int* ry1, int* xb1, int32_t npoints, int picnum, int
twod->AddPoly(tileGetTexture(picnum), points.Data(), points.Size(), indices.data(), indices.size(), translation, pe, rs, clipx1, clipy1, clipx2, clipy2); twod->AddPoly(tileGetTexture(picnum), points.Data(), points.Size(), indices.data(), indices.size(), translation, pe, rs, clipx1, clipy1, clipx2, clipy2);
} }
void drawlinergb(int32_t x1, int32_t y1, int32_t x2, int32_t y2, PalEntry p)
{
twod->AddLine(x1 / 4096.f, y1 / 4096.f, x2 / 4096.f, y2 / 4096.f, windowxy1.x, windowxy1.y, windowxy2.x, windowxy2.y, p);
}
void drawlinergb(int32_t x1, int32_t y1, int32_t x2, int32_t y2, palette_t p)
{
drawlinergb(x1, y1, x2, y2, PalEntry(p.r, p.g, p.b));
}
void renderDrawLine(int32_t x1, int32_t y1, int32_t x2, int32_t y2, uint8_t col)
{
drawlinergb(x1, y1, x2, y2, GPalette.BaseColors[GPalette.Remap[col]]);
}
//========================================================================== //==========================================================================
// //
// //

View file

@ -33,13 +33,210 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#include "gstrings.h" #include "gstrings.h"
#include "printf.h" #include "printf.h"
#include "serializer.h" #include "serializer.h"
#include "v_2ddrawer.h"
#include "earcut.hpp"
#include "buildtiles.h"
#include "d_event.h"
#include "c_bind.h"
#include "gamestate.h"
#include "gamecontrol.h"
#include "quotemgr.h"
#include "v_video.h"
#include "gamestruct.h"
CVAR(Bool, am_followplayer, true, CVAR_ARCHIVE)
CVAR(Bool, am_rotate, true, CVAR_ARCHIVE)
CVAR(Bool, am_textfont, false, CVAR_ARCHIVE)
CVAR(Bool, am_showlabel, false, CVAR_ARCHIVE)
CVAR(Bool, am_nameontop, false, CVAR_ARCHIVE)
int automapMode;
static int am_zoomdir;
int follow_x = INT_MAX, follow_y = INT_MAX, follow_a = INT_MAX;
static int gZoom = 768;
bool automapping; bool automapping;
bool gFullMap; bool gFullMap;
FixedBitArray<MAXSECTORS> show2dsector; FixedBitArray<MAXSECTORS> show2dsector;
FixedBitArray<MAXWALLS> show2dwall; FixedBitArray<MAXWALLS> show2dwall;
FixedBitArray<MAXSPRITES> show2dsprite; FixedBitArray<MAXSPRITES> show2dsprite;
static int x_min_bound = INT_MAX, y_min_bound, x_max_bound, y_max_bound;
CVAR(Color, am_twosidedcolor, 0xaaaaaa, CVAR_ARCHIVE)
CVAR(Color, am_onesidedcolor, 0xaaaaaa, CVAR_ARCHIVE)
CVAR(Color, am_playercolor, 0xaaaaaa, CVAR_ARCHIVE)
CVAR(Color, am_ovtwosidedcolor, 0xaaaaaa, CVAR_ARCHIVE)
CVAR(Color, am_ovonesidedcolor, 0xaaaaaa, CVAR_ARCHIVE)
CVAR(Color, am_ovplayercolor, 0xaaaaaa, CVAR_ARCHIVE)
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
CCMD(allmap)
{
if (!CheckCheatmode(true, false))
{
gFullMap = !gFullMap;
Printf("%s\n", GStrings(gFullMap ? "SHOW MAP: ON" : "SHOW MAP: OFF"));
}
}
CCMD(togglemap)
{
if (gamestate == GS_LEVEL)
{
automapMode++;
if (automapMode == am_count) automapMode = am_off;
if ((g_gameType & GAMEFLAG_BLOOD) && automapMode == am_overlay) automapMode = am_full; // todo: investigate if this can be re-enabled
}
}
CCMD(togglefollow)
{
am_followplayer = !am_followplayer;
auto msg = quoteMgr.GetQuote(am_followplayer ? 84 : 83);
if (!msg || !*msg) msg = am_followplayer ? GStrings("FOLLOW MODE ON") : GStrings("FOLLOW MODE Off");
Printf("%s\n", msg);
follow_x = follow_y = 0;
}
CCMD(am_zoom)
{
if (argv.argc() >= 2)
{
am_zoomdir = (float)atof(argv[1]);
}
}
//==========================================================================
//
// AM_Responder
// Handle automap exclusive bindings.
//
//==========================================================================
bool AM_Responder(event_t* ev, bool last)
{
if (ev->type == EV_KeyDown || ev->type == EV_KeyUp)
{
if (am_followplayer)
{
// check for am_pan* and ignore in follow mode
const char* defbind = AutomapBindings.GetBind(ev->data1);
if (defbind && !strnicmp(defbind, "+am_pan", 7)) return false;
}
bool res = C_DoKey(ev, &AutomapBindings, nullptr);
if (res && ev->type == EV_KeyUp && !last)
{
// If this is a release event we also need to check if it released a button in the main Bindings
// so that that button does not get stuck.
const char* defbind = Bindings.GetBind(ev->data1);
return (!defbind || defbind[0] != '+'); // Let G_Responder handle button releases
}
return res;
}
return false;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
static void CalcMapBounds()
{
x_min_bound = 999999;
y_min_bound = 999999;
x_max_bound = -999999;
y_max_bound = -999999;
for (int i = 0; i < numwalls; i++)
{
// get map min and max coordinates
x_min_bound = min(TrackerCast(wall[i].x), x_min_bound);
y_min_bound = min(TrackerCast(wall[i].y), y_min_bound);
x_max_bound = max(TrackerCast(wall[i].x), x_max_bound);
y_max_bound = max(TrackerCast(wall[i].y), y_max_bound);
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void AutomapControl()
{
static int nonsharedtimer;
int ms = screen->FrameTime;
int interval;
static int panvert = 0, panhorz = 0;
if (nonsharedtimer > 0 || ms < nonsharedtimer)
{
interval = ms - nonsharedtimer;
}
else
{
interval = 0;
}
nonsharedtimer = screen->FrameTime;
if (System_WantGuiCapture())
return;
if (automapMode != am_off)
{
const int keymove = 35;
if (am_zoomdir > 0)
{
gZoom = xs_CRoundToInt(gZoom * am_zoomdir);
}
else if (am_zoomdir < 0)
{
gZoom = xs_CRoundToInt(gZoom / -am_zoomdir);
}
am_zoomdir = 0;
double j = interval * (120. / 1000);
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
gZoom += (int)fmulscale6(j, max(gZoom, 256));
if (buttonMap.ButtonDown(gamefunc_Shrink_Screen))
gZoom -= (int)fmulscale6(j, max(gZoom, 256));
if (buttonMap.ButtonDown(gamefunc_AM_PanLeft))
panhorz += keymove;
if (buttonMap.ButtonDown(gamefunc_AM_PanRight))
panhorz -= keymove;
if (buttonMap.ButtonDown(gamefunc_AM_PanUp))
panvert += keymove;
if (buttonMap.ButtonDown(gamefunc_AM_PanDown))
panvert -= keymove;
int momx = mulscale9(panvert, sintable[(follow_a + 512) & 2047]);
int momy = mulscale9(panvert, sintable[follow_a]);
momx += mulscale9(panhorz, sintable[follow_a]);
momy += mulscale9(panhorz, sintable[(follow_a + 1536) & 2047]);
follow_x += Scale(momx, gZoom, 768);
follow_y += Scale(momy, gZoom, 768);
follow_x = clamp(follow_x, x_min_bound, x_max_bound);
follow_y = clamp(follow_y, y_min_bound, y_max_bound);
gZoom = clamp(gZoom, 48, 2048);
}
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
@ -62,21 +259,6 @@ void SerializeAutomap(FSerializer& arc)
} }
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
CCMD(allmap)
{
if (!CheckCheatmode(true, false))
{
gFullMap = !gFullMap;
Printf("%s\n", GStrings(gFullMap ? "SHOW MAP: ON" : "SHOW MAP: OFF"));
}
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// //
@ -88,6 +270,7 @@ void ClearAutomap()
show2dsector.Zero(); show2dsector.Zero();
show2dwall.Zero(); show2dwall.Zero();
show2dsprite.Zero(); show2dsprite.Zero();
x_min_bound = INT_MAX;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -121,7 +304,249 @@ void MarkSectorSeen(int i)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void DrawOverheadMap(int pl_x, int pl_y, int pl_angle) void drawlinergb(int32_t x1, int32_t y1, int32_t x2, int32_t y2, PalEntry p)
{ {
twod->AddLine(x1 / 4096.f, y1 / 4096.f, x2 / 4096.f, y2 / 4096.f, windowxy1.x, windowxy1.y, windowxy2.x, windowxy2.y, p);
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
PalEntry RedLineColor()
{
// todo:
// Blood uses palette index 12 (99,99,99)
// Exhumed uses palette index 111 (roughly 170,170,170) but darkens the line in overlay mode the farther it is away from the player in vertical direction.
// Shadow Warrior uses palette index 152 in overlay mode and index 12 in full map mode. (152: 84, 88, 40)
return automapMode == am_overlay? *am_ovtwosidedcolor : *am_twosidedcolor;
}
PalEntry WhiteLineColor()
{
// todo:
// Blood uses palette index 24
// Exhumed uses palette index 111 (roughly 170,170,170) but darkens the line in overlay mode the farther it is away from the player in vertical direction.
// Shadow Warrior uses palette index 24 (60,60,60)
return automapMode == am_overlay ? *am_ovonesidedcolor : *am_onesidedcolor;
}
PalEntry PlayerLineColor()
{
return automapMode == am_overlay ? *am_ovplayercolor : *am_playercolor;
}
CCMD(printpalcol)
{
if (argv.argc() < 2) return;
int i = atoi(argv[1]);
Printf("%d, %d, %d\n", GPalette.BaseColors[i].r, GPalette.BaseColors[i].g, GPalette.BaseColors[i].b);
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
bool ShowRedLine(int j, int i)
{
auto wal = &wall[j];
if (!(g_gameType & GAMEFLAG_SW))
{
return !gFullMap && !show2dsector[wal->nextsector];
}
else
{
if (!gFullMap)
{
if (!show2dwall[j]) return false;
int k = wal->nextwall;
if (k > j && !show2dwall[k]) return false; //???
}
if (automapMode == am_full)
{
if (sector[i].floorz != sector[i].ceilingz)
if (sector[wal->nextsector].floorz != sector[wal->nextsector].ceilingz)
if (((wal->cstat | wall[wal->nextwall].cstat) & (16 + 32)) == 0)
if (sector[i].floorz == sector[wal->nextsector].floorz)
return false;
if (sector[i].floorpicnum != sector[wal->nextsector].floorpicnum)
return false;
if (sector[i].floorshade != sector[wal->nextsector].floorshade)
return false;
}
return true;
}
}
//---------------------------------------------------------------------------
//
// two sided lines
//
//---------------------------------------------------------------------------
void drawredlines(int cposx, int cposy, int czoom, int cang)
{
int xvect = sintable[(-cang) & 2047] * czoom;
int yvect = sintable[(1536 - cang) & 2047] * czoom;
int xvect2 = mulscale16(xvect, yxaspect);
int yvect2 = mulscale16(yvect, yxaspect);
for (int i = 0; i < numsectors; i++)
{
if (!gFullMap && !show2dsector[i]) continue;
int startwall = sector[i].wallptr;
int endwall = sector[i].wallptr + sector[i].wallnum;
int z1 = sector[i].ceilingz;
int z2 = sector[i].floorz;
walltype* wal;
int j;
for (j = startwall, wal = &wall[startwall]; j < endwall; j++, wal++)
{
int k = wal->nextwall;
if (k < 0 || k >= MAXWALLS) continue;
if (sector[wal->nextsector].ceilingz == z1 && sector[wal->nextsector].floorz == z2)
if (((wal->cstat | wall[wal->nextwall].cstat) & (16 + 32)) == 0) continue;
if (ShowRedLine(j, i))
{
int ox = wal->x - cposx;
int oy = wal->y - cposy;
int x1 = dmulscale16(ox, xvect, -oy, yvect) + (xdim << 11);
int y1 = dmulscale16(oy, xvect2, ox, yvect2) + (ydim << 11);
auto wal2 = &wall[wal->point2];
ox = wal2->x - cposx;
oy = wal2->y - cposy;
int x2 = dmulscale16(ox, xvect, -oy, yvect) + (xdim << 11);
int y2 = dmulscale16(oy, xvect2, ox, yvect2) + (ydim << 11);
drawlinergb(x1, y1, x2, y2, RedLineColor());
}
}
}
}
//---------------------------------------------------------------------------
//
// one sided lines
//
//---------------------------------------------------------------------------
static void drawwhitelines(int cposx, int cposy, int czoom, int cang)
{
int xvect = sintable[(-cang) & 2047] * czoom;
int yvect = sintable[(1536 - cang) & 2047] * czoom;
int xvect2 = mulscale16(xvect, yxaspect);
int yvect2 = mulscale16(yvect, yxaspect);
for (int i = numsectors - 1; i >= 0; i--)
{
if (!gFullMap && !show2dsector[i] && !(g_gameType & GAMEFLAG_SW)) continue;
int startwall = sector[i].wallptr;
int endwall = sector[i].wallptr + sector[i].wallnum;
walltype* wal;
int j;
for (j = startwall, wal = &wall[startwall]; j < endwall; j++, wal++)
{
if (wal->nextwall >= 0) continue;
if (!tileGetTexture(wal->picnum)->isValid()) continue;
if ((g_gameType & GAMEFLAG_SW) && !gFullMap && !show2dwall[j])
continue;
int ox = wal->x - cposx;
int oy = wal->y - cposy;
int x1 = dmulscale16(ox, xvect, -oy, yvect) + (xdim << 11);
int y1 = dmulscale16(oy, xvect2, ox, yvect2) + (ydim << 11);
int k = wal->point2;
auto wal2 = &wall[k];
ox = wal2->x - cposx;
oy = wal2->y - cposy;
int x2 = dmulscale16(ox, xvect, -oy, yvect) + (xdim << 11);
int y2 = dmulscale16(oy, xvect2, ox, yvect2) + (ydim << 11);
drawlinergb(x1, y1, x2, y2, WhiteLineColor());
}
}
}
void DrawPlayerArrow(int cposx, int cposy, int cang, int pl_x, int pl_y, int zoom, int pl_angle)
{
int arrow[] =
{
0, 65536, 0, -65536,
0, 65536, -32768, 32878,
0, 65536, 32768, 32878,
};
int xvect = sintable[(-cang) & 2047] * zoom;
int yvect = sintable[(1536 - cang) & 2047] * zoom;
int xvect2 = mulscale16(xvect, yxaspect);
int yvect2 = mulscale16(yvect, yxaspect);
int pxvect = sintable[(-pl_angle) & 2047];
int pyvect = sintable[(1536 - pl_angle) & 2047];
for (int i = 0; i < 12; i += 4)
{
int px1 = dmulscale16(arrow[i], pxvect, -arrow[i+1], pyvect);
int py1 = dmulscale16(arrow[i+1], pxvect, arrow[i], pyvect) + (ydim << 11);
int px2 = dmulscale16(arrow[i+2], pxvect, -arrow[i + 3], pyvect);
int py2 = dmulscale16(arrow[i + 3], pxvect, arrow[i+2], pyvect) + (ydim << 11);
int ox1 = px1 - cposx;
int oy1 = py1 - cposx;
int ox2 = px2 - cposx;
int oy2 = py2 - cposx;
int sx1 = dmulscale16(ox1, xvect, -oy1, yvect) + (xdim << 11);
int sy1 = dmulscale16(oy1, xvect2, ox1, yvect2) + (ydim << 11);
int sx2 = dmulscale16(ox2, xvect, -oy2, yvect) + (xdim << 11);
int sy2 = dmulscale16(oy2, xvect2, ox2, yvect2) + (ydim << 11);
drawlinergb(sx1, sy1, sx2, sy2, WhiteLineColor());
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void DrawOverheadMap(int pl_x, int pl_y, int pl_angle)
{
int x = am_followplayer ? pl_x : follow_x;
int y = am_followplayer ? pl_y : follow_y;
follow_a = am_rotate ? pl_angle : 0;
if (automapMode == am_full)
{
twod->ClearScreen();
renderDrawMapView(x, y, gZoom, follow_a);
}
int32_t tmpydim = (xdim * 5) / 8;
renderSetAspect(65536, divscale16(tmpydim * 320, xdim * 200));
drawredlines(x, y, gZoom, follow_a);
drawwhitelines(x, y, gZoom, follow_a);
DrawPlayerArrow(x, y, follow_a, pl_x, pl_y, gZoom, -pl_angle);
} }

View file

@ -2,8 +2,10 @@
#include "tarray.h" #include "tarray.h"
#include "build.h" #include "build.h"
#include "c_cvars.h"
class FSerializer; class FSerializer;
struct event_t;
extern bool automapping; extern bool automapping;
extern bool gFullMap; extern bool gFullMap;
@ -15,4 +17,15 @@ void SerializeAutomap(FSerializer& arc);
void ClearAutomap(); void ClearAutomap();
void MarkSectorSeen(int sect); void MarkSectorSeen(int sect);
void DrawOverheadMap(int x, int y, int ang); void DrawOverheadMap(int x, int y, int ang);
bool AM_Responder(event_t* ev, bool last);
enum AM_Mode
{
am_off,
am_overlay,
am_full,
am_count
};
extern int automapMode;
EXTERN_CVAR(Bool, am_followplayer)

View file

@ -42,40 +42,7 @@
#include "gamestate.h" #include "gamestate.h"
#include "gamecontrol.h" #include "gamecontrol.h"
#include "uiinput.h" #include "uiinput.h"
#include "automap.h"
//==========================================================================
//
// AM_Responder
// Handle automap exclusive bindings.
//
//==========================================================================
bool AM_Responder (event_t *ev, bool last)
{
if (ev->type == EV_KeyDown || ev->type == EV_KeyUp)
{
#if 0 // this feature does not exist yet.
if (automapFollow)
{
// check for am_pan* and ignore in follow mode
const char *defbind = AutomapBindings.GetBind(ev->data1);
if (defbind && !strnicmp(defbind, "+am_pan", 7)) return false;
}
#endif
bool res = C_DoKey(ev, &AutomapBindings, nullptr);
if (res && ev->type == EV_KeyUp && !last)
{
// If this is a release event we also need to check if it released a button in the main Bindings
// so that that button does not get stuck.
const char *defbind = Bindings.GetBind(ev->data1);
return (!defbind || defbind[0] != '+'); // Let G_Responder handle button releases
}
return res;
}
return false;
}
//========================================================================== //==========================================================================
// //

View file

@ -70,6 +70,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "statusbar.h" #include "statusbar.h"
#include "uiinput.h" #include "uiinput.h"
#include "d_net.h" #include "d_net.h"
#include "automap.h"
CVAR(Bool, autoloadlights, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR(Bool, autoloadlights, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR(Bool, autoloadbrightmaps, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CVAR(Bool, autoloadbrightmaps, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
@ -98,27 +99,8 @@ int connecthead, connectpoint2[MAXMULTIPLAYERS];
auto vsnprintfptr = vsnprintf; // This is an inline in Visual Studio but we need an address for it to satisfy the MinGW compiled libraries. auto vsnprintfptr = vsnprintf; // This is an inline in Visual Studio but we need an address for it to satisfy the MinGW compiled libraries.
int lastTic; int lastTic;
int automapMode;
bool automapFollow;
extern bool pauseext; extern bool pauseext;
CCMD(togglemap)
{
if (gamestate == GS_LEVEL)
{
automapMode++;
if (automapMode == am_count) automapMode = am_off;
if ((g_gameType & GAMEFLAG_BLOOD) && automapMode == am_overlay) automapMode = am_full; // todo: investigate if this can be re-enabled
gi->ResetFollowPos(false);
}
}
CCMD(togglefollow)
{
automapFollow = !automapFollow;
gi->ResetFollowPos(true);
}
cycle_t thinktime, actortime, gameupdatetime, drawtime; cycle_t thinktime, actortime, gameupdatetime, drawtime;
gamestate_t gamestate = GS_STARTUP; gamestate_t gamestate = GS_STARTUP;
@ -1265,64 +1247,6 @@ void GameInterface::FreeLevelData()
currentLevel = nullptr; currentLevel = nullptr;
} }
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
static float am_zoomdir;
int GetAutomapZoom(int gZoom)
{
static int nonsharedtimer;
int ms = screen->FrameTime;
int interval;
if (nonsharedtimer > 0 || ms < nonsharedtimer)
{
interval = ms - nonsharedtimer;
}
else
{
interval = 0;
}
nonsharedtimer = screen->FrameTime;
if (System_WantGuiCapture())
return gZoom;
if (automapMode != am_off)
{
if (am_zoomdir > 0)
{
gZoom = xs_CRoundToInt(gZoom * am_zoomdir);
}
else if (am_zoomdir < 0)
{
gZoom = xs_CRoundToInt(gZoom / -am_zoomdir);
}
am_zoomdir = 0;
double j = interval * (120. / 1000);
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
gZoom += (int)fmulscale6(j, max(gZoom, 256));
if (buttonMap.ButtonDown(gamefunc_Shrink_Screen))
gZoom -= (int)fmulscale6(j, max(gZoom, 256));
gZoom = clamp(gZoom, 48, 2048);
}
return gZoom;
}
CCMD(am_zoom)
{
if (argv.argc() >= 2)
{
am_zoomdir = (float)atof(argv[1]);
}
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// Load crosshair definitions // Load crosshair definitions

View file

@ -220,15 +220,6 @@ enum
extern int paused; extern int paused;
extern int chatmodeon; extern int chatmodeon;
enum AM_Mode
{
am_off,
am_overlay,
am_full,
am_count
};
extern int automapMode;
extern bool automapFollow;
extern bool sendPause; extern bool sendPause;
extern int lastTic; extern int lastTic;

View file

@ -357,9 +357,6 @@ CUSTOM_CVAR(Int, playergender, 0, CVAR_USERINFO|CVAR_ARCHIVE)
} }
CVAR(Bool, am_textfont, false, CVAR_ARCHIVE)
CVAR(Bool, am_showlabel, false, CVAR_ARCHIVE)
CVAR(Bool, am_nameontop, false, CVAR_ARCHIVE)
CVAR(Int, m_coop, 0, CVAR_NOSET) CVAR(Int, m_coop, 0, CVAR_NOSET)

View file

@ -92,7 +92,6 @@ struct GameInterface
virtual FString GetCoordString() { return "'stat coord' not implemented"; } virtual FString GetCoordString() { return "'stat coord' not implemented"; }
virtual void ExitFromMenu() { throw CExitEvent(0); } virtual void ExitFromMenu() { throw CExitEvent(0); }
virtual ReservedSpace GetReservedScreenSpace(int viewsize) { return { 0, 0 }; } virtual ReservedSpace GetReservedScreenSpace(int viewsize) { return { 0, 0 }; }
virtual void ResetFollowPos(bool) {}
virtual void GetInput(InputPacket* packet) {} virtual void GetInput(InputPacket* packet) {}
virtual void UpdateSounds() {} virtual void UpdateSounds() {}
virtual void ErrorCleanup() {} virtual void ErrorCleanup() {}

View file

@ -230,6 +230,11 @@ void SetupGameButtons()
"Dpad_Aiming", "Dpad_Aiming",
"Toggle_Crouch", "Toggle_Crouch",
"Quick_Kick", "Quick_Kick",
"AM_PanLeft",
"AM_PanRight",
"AM_PanUp",
"AM_PanDown",
}; };
buttonMap.SetButtons(actions, NUM_ACTIONS); buttonMap.SetButtons(actions, NUM_ACTIONS);
} }

View file

@ -92,6 +92,10 @@ enum GameFunction_t
gamefunc_Dpad_Aiming, gamefunc_Dpad_Aiming,
gamefunc_Toggle_Crouch, gamefunc_Toggle_Crouch,
gamefunc_Quick_Kick, gamefunc_Quick_Kick,
gamefunc_AM_PanLeft,
gamefunc_AM_PanRight,
gamefunc_AM_PanUp,
gamefunc_AM_PanDown,
NUM_ACTIONS NUM_ACTIONS
}; };

View file

@ -47,6 +47,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "g_input.h" #include "g_input.h"
#include "core/menu/menu.h" #include "core/menu/menu.h"
#include "d_net.h" #include "d_net.h"
#include "automap.h"
BEGIN_PS_NS BEGIN_PS_NS

View file

@ -220,19 +220,9 @@ void PlayerInterruptKeys(bool after)
if (buttonMap.ButtonDown(gamefunc_Move_Backward)) if (buttonMap.ButtonDown(gamefunc_Move_Backward))
tempinput.fvel += -keyMove; tempinput.fvel += -keyMove;
if ((automapFollow && automapMode != am_off))
{
// neutralize all movement when in automap follow mode
localInput.fvel = localInput.svel = 0;
localInput.q16avel = localInput.q16horz = 0;
input_angle = 0;
}
else
{
localInput.fvel = clamp(localInput.fvel + tempinput.fvel, -12, 12); localInput.fvel = clamp(localInput.fvel + tempinput.fvel, -12, 12);
localInput.svel = clamp(localInput.svel + tempinput.svel, -12, 12); localInput.svel = clamp(localInput.svel + tempinput.svel, -12, 12);
localInput.q16avel += input_angle; localInput.q16avel += input_angle;
}
if (!nFreeze) if (!nFreeze)
{ {

View file

@ -32,6 +32,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gstrings.h" #include "gstrings.h"
#include "gamestate.h" #include "gamestate.h"
#include "mapinfo.h" #include "mapinfo.h"
#include "automap.h"
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>

View file

@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "texturemanager.h" #include "texturemanager.h"
#include "statusbar.h" #include "statusbar.h"
#include "v_draw.h" #include "v_draw.h"
#include "automap.h"
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>

View file

@ -928,7 +928,7 @@ static void FinalizeInput(int playerNum, InputPacket& input, bool vehicle)
auto p = &ps[playerNum]; auto p = &ps[playerNum];
bool blocked = movementBlocked(playerNum) || sprite[p->i].extra <= 0 || (p->dead_flag && !ud.god); bool blocked = movementBlocked(playerNum) || sprite[p->i].extra <= 0 || (p->dead_flag && !ud.god);
if ((automapFollow && automapMode != am_off) || blocked) if (blocked)
{ {
// neutralize all movement when blocked or in automap follow mode // neutralize all movement when blocked or in automap follow mode
loc.fvel = loc.svel = 0; loc.fvel = loc.svel = 0;

View file

@ -30,6 +30,7 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#include "build.h" #include "build.h"
#include "v_video.h" #include "v_video.h"
#include "prediction.h" #include "prediction.h"
#include "automap.h"
BEGIN_DUKE_NS BEGIN_DUKE_NS

View file

@ -40,6 +40,7 @@ source as it is released.
#include "v_draw.h" #include "v_draw.h"
#include "texturemanager.h" #include "texturemanager.h"
#include "mapinfo.h" #include "mapinfo.h"
#include "automap.h"
BEGIN_DUKE_NS BEGIN_DUKE_NS

View file

@ -40,6 +40,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "d_protocol.h" #include "d_protocol.h"
#include "cheats.h" #include "cheats.h"
#include "gamestate.h" #include "gamestate.h"
#include "automap.h"
//#include "inv.h" //#include "inv.h"
BEGIN_SW_NS BEGIN_SW_NS
@ -128,9 +129,9 @@ bool MapCheat(cheatseq_t* c)
{ {
PLAYERp pp; PLAYERp pp;
if (!(pp=checkCheat(c))) return false; if (!(pp=checkCheat(c))) return false;
mapcheat = !mapcheat; gFullMap = !gFullMap;
// Need to do this differently. The code here was completely broken. // Need to do this differently. The code here was completely broken.
PutStringInfo(pp, GStrings(mapcheat ? "TXTS_AMON" : "TXTS_AMOFF")); PutStringInfo(pp, GStrings(gFullMap ? "TXTS_AMON" : "TXTS_AMOFF"));
return true; return true;
} }

View file

@ -96,8 +96,6 @@ extern int sw_snd_scratch;
int GameVersion = 20; int GameVersion = 20;
int Follow_posx=0,Follow_posy=0;
SWBOOL NoMeters = false; SWBOOL NoMeters = false;
SWBOOL FinishAnim = 0; SWBOOL FinishAnim = 0;
SWBOOL ReloadPrompt = false; SWBOOL ReloadPrompt = false;

View file

@ -762,8 +762,6 @@ extern FString ThemeSongs[6]; //
#define MAX_EPISODE_NAME_LEN 24 #define MAX_EPISODE_NAME_LEN 24
extern char EpisodeNames[3][MAX_EPISODE_NAME_LEN+2]; extern char EpisodeNames[3][MAX_EPISODE_NAME_LEN+2];
extern int Follow_posx, Follow_posy;
enum enum
{ {
MAX_KEYS = 8, MAX_KEYS = 8,
@ -1625,7 +1623,6 @@ typedef struct
extern SPIN Spin[17]; extern SPIN Spin[17];
extern DOOR_AUTO_CLOSE DoorAutoClose[MAX_DOOR_AUTO_CLOSE]; extern DOOR_AUTO_CLOSE DoorAutoClose[MAX_DOOR_AUTO_CLOSE];
extern int x_min_bound, y_min_bound, x_max_bound, y_max_bound;
#define MAXANIM 256 #define MAXANIM 256
typedef void ANIM_CALLBACK (ANIMp, void *); typedef void ANIM_CALLBACK (ANIMp, void *);
@ -1998,8 +1995,6 @@ extern int GodMode;
extern SWBOOL ReloadPrompt; extern SWBOOL ReloadPrompt;
extern int x_min_bound, y_min_bound, x_max_bound, y_max_bound;
//extern unsigned char synctics, lastsynctics; //extern unsigned char synctics, lastsynctics;
extern short snum; extern short snum;
@ -2205,7 +2200,6 @@ struct GameInterface : ::GameInterface
FString GetCoordString() override; FString GetCoordString() override;
ReservedSpace GetReservedScreenSpace(int viewsize) override; ReservedSpace GetReservedScreenSpace(int viewsize) override;
void QuitToTitle() override; void QuitToTitle() override;
void ResetFollowPos(bool message) override;
void UpdateSounds() override; void UpdateSounds() override;
void ErrorCleanup() override; void ErrorCleanup() override;
void GetInput(InputPacket* input) override; void GetInput(InputPacket* input) override;

View file

@ -60,13 +60,6 @@ InitTimingVars(void)
void GameInterface::ResetFollowPos(bool)
{
auto pp = &Player[myconnectindex];
Follow_posx = pp->posx;
Follow_posy = pp->posy;
}
static void getinput(InputPacket *loc) static void getinput(InputPacket *loc)
{ {
int i; int i;
@ -107,10 +100,6 @@ static void getinput(InputPacket *loc)
if (paused) if (paused)
return; return;
// !JIM! Added M_Active() so that you don't move at all while using menus
if (M_Active() || (automapFollow && automapMode != am_off))
return;
int32_t turnamount; int32_t turnamount;
int32_t keymove; int32_t keymove;

View file

@ -451,12 +451,6 @@ bool GameInterface::SaveGame(FSaveGameNode *sv)
MWRITE(SineWaveFloor, sizeof(SineWaveFloor),1,fil); MWRITE(SineWaveFloor, sizeof(SineWaveFloor),1,fil);
MWRITE(SineWall, sizeof(SineWall),1,fil); MWRITE(SineWall, sizeof(SineWall),1,fil);
MWRITE(SpringBoard, sizeof(SpringBoard),1,fil); MWRITE(SpringBoard, sizeof(SpringBoard),1,fil);
//MWRITE(Rotate, sizeof(Rotate),1,fil);
//MWRITE(DoorAutoClose, sizeof(DoorAutoClose),1,fil);
MWRITE(&x_min_bound, sizeof(x_min_bound),1,fil);
MWRITE(&y_min_bound, sizeof(y_min_bound),1,fil);
MWRITE(&x_max_bound, sizeof(x_max_bound),1,fil);
MWRITE(&y_max_bound, sizeof(y_max_bound),1,fil);
MWRITE(Track, sizeof(Track),1,fil); MWRITE(Track, sizeof(Track),1,fil);
@ -838,12 +832,6 @@ bool GameInterface::LoadGame(FSaveGameNode* sv)
MREAD(SineWaveFloor, sizeof(SineWaveFloor),1,fil); MREAD(SineWaveFloor, sizeof(SineWaveFloor),1,fil);
MREAD(SineWall, sizeof(SineWall),1,fil); MREAD(SineWall, sizeof(SineWall),1,fil);
MREAD(SpringBoard, sizeof(SpringBoard),1,fil); MREAD(SpringBoard, sizeof(SpringBoard),1,fil);
//MREAD(Rotate, sizeof(Rotate),1,fil);
//MREAD(DoorAutoClose, sizeof(DoorAutoClose),1,fil);
MREAD(&x_min_bound, sizeof(x_min_bound),1,fil);
MREAD(&y_min_bound, sizeof(y_min_bound),1,fil);
MREAD(&x_max_bound, sizeof(x_max_bound),1,fil);
MREAD(&y_max_bound, sizeof(y_max_bound),1,fil);
MREAD(Track, sizeof(Track),1,fil); MREAD(Track, sizeof(Track),1,fil);
for (i = 0; i < MAX_TRACKS; i++) for (i = 0; i < MAX_TRACKS; i++)

View file

@ -40,6 +40,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "network.h" #include "network.h"
#include "v_draw.h" #include "v_draw.h"
#include "menus.h" #include "menus.h"
#include "automap.h"
BEGIN_SW_NS BEGIN_SW_NS

View file

@ -92,7 +92,6 @@ short AnimCnt = 0;
SINE_WAVE_FLOOR SineWaveFloor[MAX_SINE_WAVE][21]; SINE_WAVE_FLOOR SineWaveFloor[MAX_SINE_WAVE][21];
SINE_WALL SineWall[MAX_SINE_WALL][MAX_SINE_WALL_POINTS]; SINE_WALL SineWall[MAX_SINE_WALL][MAX_SINE_WALL_POINTS];
SPRING_BOARD SpringBoard[20]; SPRING_BOARD SpringBoard[20];
int x_min_bound, y_min_bound, x_max_bound, y_max_bound;
void SetSectorWallBits(short sectnum, int bit_mask, SWBOOL set_sectwall, SWBOOL set_nextwall) void SetSectorWallBits(short sectnum, int bit_mask, SWBOOL set_sectwall, SWBOOL set_nextwall)
{ {
@ -178,11 +177,7 @@ WallSetup(void)
memset(SineWall, -1, sizeof(SineWall)); memset(SineWall, -1, sizeof(SineWall));
x_min_bound = 999999; extern int x_min_bound, y_min_bound, x_max_bound, y_max_bound;
y_min_bound = 999999;
x_max_bound = -999999;
y_max_bound = -999999;
for (wp = wall, i = 0; wp < &wall[numwalls]; i++, wp++) for (wp = wall, i = 0; wp < &wall[numwalls]; i++, wp++)
{ {
@ -192,12 +187,6 @@ WallSetup(void)
if (wall[i].picnum == FAF_PLACE_MIRROR_PIC+1) if (wall[i].picnum == FAF_PLACE_MIRROR_PIC+1)
wall[i].picnum = FAF_MIRROR_PIC+1; wall[i].picnum = FAF_MIRROR_PIC+1;
// get map min and max coordinates
x_min_bound = min(TrackerCast(wp->x), x_min_bound);
y_min_bound = min(TrackerCast(wp->y), y_min_bound);
x_max_bound = max(TrackerCast(wp->x), x_max_bound);
y_max_bound = max(TrackerCast(wp->y), y_max_bound);
// this overwrites the lotag so it needs to be called LAST - its down there // this overwrites the lotag so it needs to be called LAST - its down there
// SetupWallForBreak(wp); // SetupWallForBreak(wp);