From 31eb55c1fa69bfe90c09ce9611e0d32445341284 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Tue, 19 May 2020 20:11:10 +1000 Subject: [PATCH] SW: Remove ScrollMode2D extern boolean and move into PLAYERp struct. --- source/sw/src/draw.cpp | 10 +++------- source/sw/src/game.cpp | 16 +++++++--------- source/sw/src/game.h | 4 ++-- source/sw/src/player.cpp | 3 +-- 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index cfb35281a..1daece273 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -1054,11 +1054,9 @@ ResizeView(PLAYERp pp) if (inputState.GetKeyStatus(KEYSC_ESC)) { - extern SWBOOL ScrollMode2D; - inputState.ClearKeyStatus(sc_Escape); dimensionmode = 3; - ScrollMode2D = FALSE; + pp->ScrollMode2D = FALSE; SetRedrawScreen(pp); } } @@ -2189,9 +2187,7 @@ drawscreen(PLAYERp pp) if ((dimensionmode == 5 || dimensionmode == 6) && pp == Player+myconnectindex) { - extern SWBOOL ScrollMode2D; - - if (ScrollMode2D) + if (pp->ScrollMode2D) { tx = pp->mfposx; ty = pp->mfposy; @@ -2218,7 +2214,7 @@ drawscreen(PLAYERp pp) } // Draw the line map on top of texture 2d map or just stand alone - drawoverheadmap(tx, ty, zoom, fix16_to_int(tq16ang)); + drawoverheadmap(tx, ty, zoom, fix16_to_int(tq16ang), pp->ScrollMode2D); } for (j = 0; j < MAXSPRITES; j++) diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index c98c743d9..c60f87b52 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -188,7 +188,6 @@ SWBOOL FirstTimeIntoGame; SWBOOL BorderAdjust = FALSE; SWBOOL InterpolateSectObj; SWBOOL LocationInfo = 0; -void drawoverheadmap(int cposx, int cposy, int czoom, short cang); int DispFrameRate = FALSE; int DispMono = TRUE; int Fog = FALSE; @@ -229,7 +228,6 @@ SWBOOL PauseMode = FALSE; SWBOOL PauseKeySet = FALSE; SWBOOL SlowMode = FALSE; SWBOOL FrameAdvanceTics = 3; -SWBOOL ScrollMode2D = FALSE; SWBOOL DebugSO = FALSE; SWBOOL DebugPanel = FALSE; @@ -2556,7 +2554,7 @@ void RunLevel(void) domovethings(); } - if (!ScrollMode2D && !pp->on_vehicle) + if (!pp->ScrollMode2D && !pp->on_vehicle) getinput(myconnectindex); } @@ -3118,7 +3116,7 @@ void getinput(int const playerNum) MirrorDelay = 1; dimensionmode = 3; SetFragBar(pp); - ScrollMode2D = FALSE; + pp->ScrollMode2D = FALSE; SetRedrawScreen(pp); } } @@ -3129,14 +3127,14 @@ void getinput(int const playerNum) if (buttonMap.ButtonDown(gamefunc_Map_Follow_Mode)) { buttonMap.ClearButton(gamefunc_Map_Follow_Mode); - ScrollMode2D = !ScrollMode2D; + pp->ScrollMode2D = !pp->ScrollMode2D; pp->mfposx = pp->posx; pp->mfposy = pp->posy; } } // If in 2D follow mode, scroll around. - if (ScrollMode2D && !Prediction) + if (pp->ScrollMode2D && !Prediction) { keymove = keymove / 2; @@ -3154,7 +3152,7 @@ void getinput(int const playerNum) if (buttonMap.ButtonDown(gamefunc_Map_Follow_Mode)) { buttonMap.ClearButton(gamefunc_Map_Follow_Mode); - ScrollMode2D = !ScrollMode2D; + pp->ScrollMode2D = !pp->ScrollMode2D; // Reset coords pp->mfposx = pp->posx; pp->mfposy = pp->posy; @@ -3208,7 +3206,7 @@ void getinput(int const playerNum) } // !JIM! Added M_Active() so that you don't move at all while using menus - if (M_Active() || ScrollMode2D || InputMode) + if (M_Active() || pp->ScrollMode2D || InputMode) return; SET_LOC_KEY(localInput.bits, SK_SPACE_BAR, ((!!inputState.GetKeyStatus(KEYSC_SPACE)) | buttonMap.ButtonDown(gamefunc_Open))); @@ -3585,7 +3583,7 @@ void getinput(int const playerNum) #define MAP_BLOCK_SPRITE (DK_BLUE + 6) -void drawoverheadmap(int cposx, int cposy, int czoom, short cang) +void drawoverheadmap(int cposx, int cposy, int czoom, short cang, SWBOOL ScrollMode2D) { int i, j, k, l, x1, y1, x2, y2, x3, y3, x4, y4, ox, oy, xoff, yoff; int dax, day, cosang, sinang, xspan, yspan, sprx, spry; diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 90c700d05..94d0338f2 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -1283,7 +1283,7 @@ struct PLAYERstruct short Heads; // Number of Accursed Heads orbiting player int PlayerVersion; - SWBOOL on_vehicle; + SWBOOL on_vehicle, ScrollMode2D; }; extern PLAYER Player[MAX_SW_PLAYERS_REG+1]; @@ -2402,7 +2402,7 @@ int DoSkullBeginDeath(int16_t SpriteNum); // skull.c void AnimateCacheCursor(void); // game.c void TerminateGame(void); // game.c void TerminateLevel(void); // game.c -void drawoverheadmap(int cposx,int cposy,int czoom,short cang); // game.c +void drawoverheadmap(int cposx,int cposy,int czoom,short cang, SWBOOL ScrollMode2D); // game.c void DrawMenuLevelScreen(void); // game.c void DebugWriteString(char *string); // game.c void ManualPlayerInsert(PLAYERp pp); // game.c diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index a6f55cfdf..b37617385 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -7794,8 +7794,7 @@ domovethings(void) DoPlayerSectorUpdatePreMove(pp); ChopsCheck(pp); -// extern SWBOOL ScrollMode2D; - //if (!ScrollMode2D) + //if (!pp->ScrollMode2D) if (pp->DoPlayerAction) pp->DoPlayerAction(pp); UpdatePlayerSprite(pp);