- transitioned SW's automap to the global variables

Also copied the automap label output to the status bar for proper ordering.
This commit is contained in:
Christoph Oelckers 2020-08-24 19:36:17 +02:00
parent 7859a29e95
commit debb4b17b6
8 changed files with 52 additions and 70 deletions

View file

@ -947,7 +947,7 @@ ResizeView(PLAYERp pp)
if (M_Active() || paused)
return;
if (dimensionmode == 2 || dimensionmode == 5 || dimensionmode == 6)
if (automapMode != am_off)
{
int32_t timepassed = (int32_t)(totalclock - mapzoomclock);
mapzoomclock += timepassed;
@ -957,14 +957,6 @@ ResizeView(PLAYERp pp)
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
zoom = min<int32_t>(zoom + mulscale7(timepassed * synctics, zoom), 4096);
#if 0
if (inputState.GetKeyStatus(sc_Escape))
{
inputState.ClearKeyStatus(sc_Escape);
dimensionmode = 3;
ScrollMode2D = FALSE;
}
#endif
}
else
{
@ -1337,7 +1329,7 @@ void DrawCrosshair(PLAYERp pp)
{
extern SWBOOL CameraTestMode;
if (cl_crosshair && !(CameraTestMode) && !TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE) && dimensionmode != 6)
if (cl_crosshair && !(CameraTestMode) && !TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE) && automapMode == am_off)
{
int32_t a = 2326;
@ -1830,7 +1822,7 @@ drawscreen(PLAYERp pp)
tq16horiz = fix16_min(tq16horiz, fix16_from_int(PLAYER_HORIZ_MAX));
}
if (dimensionmode != 6)// && !ScreenSavePic)
if (automapMode != am_full)// && !ScreenSavePic)
{
// Cameras must be done before the main loop.
JS_DrawCameras(pp, tx, ty, tz);
@ -1846,7 +1838,7 @@ drawscreen(PLAYERp pp)
DrawOverlapRoom(tx, ty, tz, tq16ang, tq16horiz, tsectnum);
OverlapDraw = FALSE;
if (dimensionmode != 6)// && !ScreenSavePic)
if (automapMode != am_full)// && !ScreenSavePic)
{
// TEST this! Changed to camerapp
//JS_DrawMirrors(camerapp, tx, ty, tz, tq16ang, tq16horiz);
@ -1906,9 +1898,9 @@ drawscreen(PLAYERp pp)
}
}
if ((dimensionmode == 5 || dimensionmode == 6) && pp == Player+myconnectindex)
if ((automapMode != am_off) && pp == Player+myconnectindex)
{
if (ScrollMode2D)
if (automapFollow)
{
tx = Follow_posx;
ty = Follow_posy;
@ -1927,7 +1919,7 @@ drawscreen(PLAYERp pp)
}
}
if (dimensionmode == 6)
if (automapMode == am_full)
{
// only clear the actual window.
twod->AddColorOnlyQuad(windowxy1.x, windowxy1.y, (windowxy2.x + 1) - windowxy1.x, (windowxy2.y + 1) - windowxy1.y, 0xff000000);

View file

@ -136,7 +136,6 @@ GAME_SET gs;
SWBOOL PlayerTrackingMode = false;
SWBOOL SlowMode = false;
SWBOOL FrameAdvanceTics = 3;
SWBOOL ScrollMode2D = false;
SWBOOL DebugOperate = false;
void LoadingLevelScreen(void);
@ -339,7 +338,7 @@ void DrawMenuLevelScreen(void)
void InitLevelGlobals(void)
{
ChopTics = 0;
dimensionmode = 3;
automapMode = am_off;
zoom = 768;
PlayerGravity = 24;
wait_active_check_offset = 0;

View file

@ -881,11 +881,6 @@ extern FString ThemeSongs[6]; //
extern char EpisodeNames[3][MAX_EPISODE_NAME_LEN+2];
extern int Follow_posx, Follow_posy;
extern SWBOOL ScrollMode2D;
enum
{
@ -2225,7 +2220,7 @@ extern char keys[];
extern short screenpeek;
extern int dimensionmode, zoom;
extern int zoom;
#define STAT_DAMAGE_LIST_SIZE 20
extern int16_t StatDamageList[STAT_DAMAGE_LIST_SIZE];

View file

@ -187,24 +187,20 @@ getinput(SW_PACKET *loc, SWBOOL tied)
Follow_posx = pp->posx;
Follow_posy = pp->posy;
if (dimensionmode == 3)
dimensionmode = 5;
else if (dimensionmode == 5)
dimensionmode = 6;
else
automapMode++;
if (automapMode == am_count)
{
dimensionmode = 3;
ScrollMode2D = FALSE;
automapMode = am_off;
}
}
// Toggle follow map mode on/off
if (dimensionmode == 5 || dimensionmode == 6)
if (automapMode != am_off)
{
if (buttonMap.ButtonDown(gamefunc_Map_Follow_Mode))
{
buttonMap.ClearButton(gamefunc_Map_Follow_Mode);
ScrollMode2D = !ScrollMode2D;
automapFollow = !automapFollow;
Follow_posx = pp->posx;
Follow_posy = pp->posy;
}
@ -212,12 +208,12 @@ getinput(SW_PACKET *loc, SWBOOL tied)
// If in 2D follow mode, scroll around using glob vars
// Tried calling this in domovethings, but key response it too poor, skips key presses
// Note: ScrollMode2D = Follow mode, so this get called only during follow mode
if (!tied && ScrollMode2D && pp == Player + myconnectindex && !Prediction)
// Note: this get called only during follow mode
if (!tied && automapFollow && pp == Player + myconnectindex && !Prediction)
MoveScrollMode2D(Player + myconnectindex);
// !JIM! Added M_Active() so that you don't move at all while using menus
if (M_Active() || ScrollMode2D)
if (M_Active() || automapFollow)
return;
SET_LOC_KEY(loc->bits, SK_SPACE_BAR, buttonMap.ButtonDown(gamefunc_Open));
@ -522,7 +518,7 @@ getinput(SW_PACKET *loc, SWBOOL tied)
if (screenpeek < 0)
screenpeek = connecthead;
if (dimensionmode != 2 && screenpeek == myconnectindex)
if (screenpeek == myconnectindex)
{
// JBF: figure out what's going on here
DoPlayerDivePalette(pp); // Check Dive again
@ -577,7 +573,7 @@ void registerinputcommands()
C_RegisterFunction("invprev", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= BIT(SK_INV_LEFT); return CCMD_OK; });
C_RegisterFunction("invnext", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= BIT(SK_INV_RIGHT); return CCMD_OK; });
C_RegisterFunction("gas_bomb", nullptr, [](CCmdFuncPtr)->int { inv_hotkey = INVENTORY_CHEMBOMB + 1; return CCMD_OK; });
C_RegisterFunction("flash_bomb", nullptr, [](CCmdFuncPtr)->int { if (dimensionmode == 3) inv_hotkey = INVENTORY_FLASHBOMB + 1; return CCMD_OK; });
C_RegisterFunction("flash_bomb", nullptr, [](CCmdFuncPtr)->int { inv_hotkey = INVENTORY_FLASHBOMB + 1; return CCMD_OK; });
C_RegisterFunction("caltrops", nullptr, [](CCmdFuncPtr)->int { inv_hotkey = INVENTORY_CALTROPS + 1; return CCMD_OK; });
C_RegisterFunction("turnaround", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= BIT(SK_TURN_180); return CCMD_OK; });
C_RegisterFunction("invuse", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= BIT(SK_INV_USE); return CCMD_OK; });

View file

@ -65,29 +65,6 @@ void drawoverheadmap(int cposx, int cposy, int czoom, short cang)
int32_t tmpydim = (xdim * 5) / 8;
renderSetAspect(65536, divscale16(tmpydim * 320, xdim * 200));
// draw location text
if (hud_size == Hud_Nothing)
{
txt_x = 7;
txt_y = 168;
}
else
{
txt_x = 7;
txt_y = 147;
}
if (ScrollMode2D)
{
MNU_DrawSmallString(txt_x, txt_y - 7, "Follow Mode", 0, 0);
}
sprintf(ds,"%s",currentLevel->DisplayName());
MNU_DrawSmallString(txt_x,txt_y,ds,0, 0);
//////////////////////////////////
xvect = sintable[(2048 - cang) & 2047] * czoom;
yvect = sintable[(1536 - cang) & 2047] * czoom;
xvect2 = mulscale16(xvect, yxaspect);
@ -123,8 +100,7 @@ void drawoverheadmap(int cposx, int cposy, int czoom, short cang)
col = 152;
//if (dimensionmode == 2)
if (dimensionmode == 6)
if (automapMode == am_full)
{
if (sector[i].floorz != sector[i].ceilingz)
if (sector[wal->nextsector].floorz != sector[wal->nextsector].ceilingz)
@ -200,7 +176,7 @@ SHOWSPRITE:
x1 = mulscale16(ox, xvect) - mulscale16(oy, yvect);
y1 = mulscale16(oy, xvect2) + mulscale16(ox, yvect2);
if (dimensionmode == 5 && (gNet.MultiGameType != MULTI_GAME_COMMBAT || j == Player[screenpeek].PlayerSprite))
if (automapMode == am_overlay && (gNet.MultiGameType != MULTI_GAME_COMMBAT || j == Player[screenpeek].PlayerSprite))
{
ox = (sintable[(spr->ang + 512) & 2047] >> 7);
oy = (sintable[(spr->ang) & 2047] >> 7);
@ -293,7 +269,7 @@ SHOWSPRITE:
break;
case 32: // Floor sprite
if (dimensionmode == 5)
if (automapMode == am_overlay)
{
tilenum = spr->picnum;
xoff = (int)tileLeftOffset(tilenum) + (int)spr->xoffset;

View file

@ -7235,7 +7235,7 @@ UpdatePanel(double smoothratio)
TRAVERSE_CONNECT(pnum)
{
if (dimensionmode != 2 && pnum == screenpeek)
if (pnum == screenpeek)
pDisplaySprites(Player + pnum, smoothratio);
}
}
@ -7249,7 +7249,7 @@ PreUpdatePanel(double smoothratio)
//if (DrawBeforeView)
TRAVERSE_CONNECT(pnum)
{
if (dimensionmode != 2 && pnum == screenpeek)
if (pnum == screenpeek)
pDisplaySprites(Player + pnum, smoothratio);
}

View file

@ -124,7 +124,7 @@ extern SWBOOL DebugOperate;
//unsigned char synctics, lastsynctics;
int dimensionmode, zoom;
int zoom;
int ChopTics;
PLAYER Player[MAX_SW_PLAYERS_REG + 1];
@ -2477,7 +2477,7 @@ MoveScrollMode2D(PLAYERp pp)
if (buttonMap.ButtonDown(gamefunc_Map_Follow_Mode))
{
buttonMap.ClearButton(gamefunc_Map_Follow_Mode);
ScrollMode2D = !ScrollMode2D;
automapFollow = !automapFollow;
// Reset coords
Follow_posx = pp->posx;
Follow_posy = pp->posy;

View file

@ -895,8 +895,32 @@ private:
void PrintLevelStats(int bottomy)
{
if (automapMode == am_full)
{
int txt_x, txt_y;
// draw location text (moved here so that it gets printed on top of the border)
if (hud_size == Hud_Nothing)
{
txt_x = 7;
txt_y = 168;
}
else
{
txt_x = 7;
txt_y = 147;
}
if (automapFollow)
{
MNU_DrawSmallString(txt_x, txt_y - 7, "Follow Mode", 0, 0);
}
sprintf(ds,"%s",currentLevel->DisplayName());
MNU_DrawSmallString(txt_x,txt_y,ds,0, 0);
}
// JBF 20040124: display level stats in screen corner
if (hud_stats && !(CommEnabled || numplayers > 1))
else if (hud_stats && !(CommEnabled || numplayers > 1))
{
auto pp = Player + screenpeek;
FLevelStats stats{};