diff --git a/source/blood/src/controls.cpp b/source/blood/src/controls.cpp index 00a2d8cae..15f7823f1 100644 --- a/source/blood/src/controls.cpp +++ b/source/blood/src/controls.cpp @@ -183,22 +183,15 @@ void ctrlGetInput(void) UsesToSend.byte = 0; WeaponToSend = 0; - if (buttonMap.ButtonDown(gamefunc_Map)) - { - buttonMap.ClearButton(gamefunc_Map); - viewToggle(gViewMode); - } - if (buttonMap.ButtonDown(gamefunc_Map_Follow_Mode)) { buttonMap.ClearButton(gamefunc_Map_Follow_Mode); - gFollowMap = !gFollowMap; - gViewMap.FollowMode(gFollowMap); + automapFollow = !automapFollow; } if (buttonMap.ButtonDown(gamefunc_Shrink_Screen)) { - if (gViewMode == 3) + if (automapMode == am_off) { buttonMap.ClearButton(gamefunc_Shrink_Screen); if (!SHIFTS_IS_PRESSED) @@ -210,7 +203,7 @@ void ctrlGetInput(void) hud_scale = hud_scale - 4; } } - if (gViewMode == 4) + if (automapMode != am_off) { gZoom = ClipLow(gZoom - (gZoom >> 4), 64); gViewMap.nZoom = gZoom; @@ -219,7 +212,7 @@ void ctrlGetInput(void) if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen)) { - if (gViewMode == 3) + if (automapMode == am_off) { buttonMap.ClearButton(gamefunc_Enlarge_Screen); if (!SHIFTS_IS_PRESSED) @@ -231,8 +224,7 @@ void ctrlGetInput(void) hud_scale = hud_scale + 4; } } - if ( - gViewMode == 4) + if (automapMode != am_off) { gZoom = ClipHigh(gZoom + (gZoom >> 4), 4096); gViewMap.nZoom = gZoom; @@ -368,7 +360,7 @@ void ctrlGetInput(void) input.q16mlook = fix16_ssub(input.q16mlook, fix16_from_dbl(scaleAdjustmentToInterval(info.dpitch / mlookScale))); - if (!gViewMap.bFollowMode && gViewMode == 4) + if (!automapFollow && automapMode != am_off) { gViewMap.turn += input.q16turn<<2; gViewMap.forward += input.forward; diff --git a/source/blood/src/globals.cpp b/source/blood/src/globals.cpp index d999c6096..a90db211b 100644 --- a/source/blood/src/globals.cpp +++ b/source/blood/src/globals.cpp @@ -44,9 +44,6 @@ static int _line; int32_t gTurnSpeed = 92; int32_t gDetail = 4; -int32_t gFollowMap = 1; -int32_t gOverlayMap = 0; -int32_t gRotateMap = 0; bool gNoClip; bool gInfiniteAmmo; int32_t gDeliriumBlur = 1; diff --git a/source/blood/src/globals.h b/source/blood/src/globals.h index 78586958b..26cb015b9 100644 --- a/source/blood/src/globals.h +++ b/source/blood/src/globals.h @@ -41,9 +41,6 @@ extern bool bVanilla; extern int32_t gTurnSpeed; extern int32_t gDetail; -extern int32_t gFollowMap; -extern int32_t gOverlayMap; -extern int32_t gRotateMap; extern bool gNoClip; extern bool gInfiniteAmmo; extern int32_t gDeliriumBlur; diff --git a/source/blood/src/map2d.cpp b/source/blood/src/map2d.cpp index 4ed15ebff..816c6b502 100644 --- a/source/blood/src/map2d.cpp +++ b/source/blood/src/map2d.cpp @@ -133,7 +133,7 @@ void sub_2541C(int x, int y, int z, short a) for (int i = connecthead; i >= 0; i = connectpoint2[i]) { - if (gViewMap.bFollowMode || gView->nPlayer != i) + if (automapFollow || gView->nPlayer != i) { PLAYER *pPlayer = &gPlayer[i]; spritetype *pSprite = pPlayer->pSprite; @@ -168,19 +168,12 @@ void sub_2541C(int x, int y, int z, short a) } } -CViewMap::CViewMap() +void CViewMap::sub_25C38(int _x, int _y, int _angle, short zoom) { - bActive = 0; -} - -void CViewMap::sub_25C38(int _x, int _y, int _angle, short zoom, char unk1) -{ - bActive = 1; x = _x; y = _y; angle = _angle; nZoom = zoom; - FollowMode(unk1); forward = 0; turn = 0; strafe = 0; @@ -188,10 +181,7 @@ void CViewMap::sub_25C38(int _x, int _y, int _angle, short zoom, char unk1) void CViewMap::sub_25C74(void) { - char pBuffer[128]; - if (!bActive) - return; - char tm = 0; + int tm = 0; if (windowxy1.x > 0) { setViewport(Hud_Stbar); @@ -201,30 +191,6 @@ void CViewMap::sub_25C74(void) twod->AddColorOnlyQuad(windowxy1.x, windowxy1.y, (windowxy2.x + 1) - windowxy1.x, (windowxy2.y + 1) - windowxy1.y, 0xff000000); renderDrawMapView(x,y,nZoom>>2,angle); sub_2541C(x,y,nZoom>>2,angle); - const char *pTitle = currentLevel->DisplayName(); - const char *pFilename = currentLevel->LabelName(); - if (pTitle) - sprintf(pBuffer, "%s: %s", pFilename, pTitle); - else - sprintf(pBuffer, "%s", pFilename); -#if 0 - int nViewY; - if (g ViewSize > 3) - nViewY = gViewY1S-16; - else - nViewY = gViewY0S+1; - viewDrawText(3, pBuffer, gViewX1S /2, nViewY, -128, 0, 2, 0, 256); -#else - // This needs fixing across games, so for the time being just print the text into the upper left corner - viewDrawText(3, pBuffer, 3, 3, -128, 0, 0, 0, 256); -#endif - -#if 0 // needs to be generalized - if (gViewMap.bFollowMode) - Printf(PRINT_NOTIFY, "MAP FOLLOW MODE\n"); - else - Printf(PRINT_NOTIFY, "MAP SCROLL MODE\n"); -#endif if (tm) setViewport(hud_size); } @@ -232,7 +198,7 @@ void CViewMap::sub_25C74(void) void CViewMap::sub_25DB0(spritetype *pSprite) { nZoom = gZoom; - if (bFollowMode) + if (automapFollow) { x = pSprite->x; y = pSprite->y; @@ -260,10 +226,6 @@ void CViewMap::sub_25E84(int *_x, int *_y) *_y = y; } -void CViewMap::FollowMode(char mode) -{ - bFollowMode = mode; -} CViewMap gViewMap; diff --git a/source/blood/src/map2d.h b/source/blood/src/map2d.h index 93861fea8..3dd46f414 100644 --- a/source/blood/src/map2d.h +++ b/source/blood/src/map2d.h @@ -31,15 +31,12 @@ public: char bActive; int x, y, nZoom; short angle; - char bFollowMode; int forward, strafe; fix16_t turn; - CViewMap(); - void sub_25C38(int, int, int, short, char); + void sub_25C38(int, int, int, short); void sub_25C74(void); void sub_25DB0(spritetype *pSprite); void sub_25E84(int *, int*); - void FollowMode(char); }; extern CViewMap gViewMap; diff --git a/source/blood/src/sbar.cpp b/source/blood/src/sbar.cpp index e5411ae0f..67b7b85f0 100644 --- a/source/blood/src/sbar.cpp +++ b/source/blood/src/sbar.cpp @@ -187,7 +187,36 @@ private: void PrintLevelStats(PLAYER* pPlayer, int bottomy) { - if (gViewMode == 3 && hud_stats) + if (automapMode == am_full) + { + FString pBuffer; + const char *pTitle = currentLevel->DisplayName(); + const char *pFilename = currentLevel->LabelName(); + if (pTitle) + pBuffer.Format("%s: %s", pFilename, pTitle); + else + pBuffer = pFilename; +#if 0 + int nViewY; + if (g ViewSize > 3) + nViewY = gViewY1S-16; + else + nViewY = gViewY0S+1; + viewDrawText(3, pBuffer, gViewX1S /2, nViewY, -128, 0, 2, 0, 256); +#else + // This needs fixing across games, so for the time being just print the text into the upper left corner + viewDrawText(3, pBuffer, 3, 3, -128, 0, 0, 0, 256); +#endif + +#if 0 // needs to be generalized + if (automapFollow) + Printf(PRINT_NOTIFY, "MAP FOLLOW MODE\n"); + else + Printf(PRINT_NOTIFY, "MAP SCROLL MODE\n"); +#endif + + } + if (automapMode == am_off && hud_stats) { FLevelStats stats{}; @@ -815,7 +844,7 @@ void UpdateStatusBar(ClockTicks arg) { DBloodStatusBar sbar; - if (gViewMode == 3 && hud_size <= Hud_Stbar) + if (automapMode == am_off && hud_size <= Hud_Stbar) { UpdateFrame(); } diff --git a/source/blood/src/view.cpp b/source/blood/src/view.cpp index 2df121733..d36b9619d 100644 --- a/source/blood/src/view.cpp +++ b/source/blood/src/view.cpp @@ -61,8 +61,6 @@ struct INTERPOLATE { INTERPOLATE_TYPE type; }; -int gViewMode = 3; - double gInterpolate; int nInterpolations; char gInterpolateSprite[(kMaxSprites+7)>>3]; @@ -103,16 +101,6 @@ void FontSet(int id, int tile, int space) if (ptrs[id]) *ptrs[id] = gFont[id]; } -void viewToggle(int viewMode) -{ - if (viewMode == 3) - gViewMode = 4; - else - { - gViewMode = 3; - } -} - void viewBackupView(int nPlayer) { PLAYER *pPlayer = &gPlayer[nPlayer]; @@ -355,7 +343,7 @@ void viewInit(void) dword_172CE0[i][1] = mulscale16(wrand(), 2048); dword_172CE0[i][2] = mulscale16(wrand(), 2048); } - gViewMap.sub_25C38(0, 0, gZoom, 0, gFollowMap); + gViewMap.sub_25C38(0, 0, gZoom, 0); } void viewDrawInterface(ClockTicks arg) @@ -680,11 +668,11 @@ void viewDrawScreen(bool sceneonly) CalcInterpolations(); } - if (gViewMode == 3 || gViewMode == 4 || gOverlayMap) + if (automapMode != am_full) { DoSectorLighting(); } - if (gViewMode == 3 || gOverlayMap) + if (automapMode == am_off) { int basepal = 0; if (powerupCheck(gView, kPwUpDeathMask) > 0) basepal = 4; @@ -1046,7 +1034,7 @@ void viewDrawScreen(bool sceneonly) hudDraw(gView, nSectnum, defaultHoriz, v4c, v48, zDelta, basepal); } UpdateDacs(0, true); // keep the view palette active only for the actual 3D view and its overlays. - if (gViewMode == 4) + if (automapMode != am_off) { gViewMap.sub_25DB0(gView->pSprite); } diff --git a/source/blood/src/view.h b/source/blood/src/view.h index 7952bff1f..57060daa3 100644 --- a/source/blood/src/view.h +++ b/source/blood/src/view.h @@ -129,7 +129,6 @@ enum extern int gZoom; extern FFont *gFont[kFontNum]; -extern int gViewMode; extern VIEWPOS gViewPos; extern int gViewIndex; extern int gScreenTilt; @@ -140,12 +139,10 @@ extern char gInterpolateSprite[]; extern char gInterpolateWall[]; extern char gInterpolateSector[]; extern LOCATION gPrevSpriteLoc[kMaxSprites]; -extern int gViewMode; extern int gLastPal; extern double gInterpolate; void hudDraw(PLAYER* gView, int nSectnum, int defaultHoriz, double bobx, double boby, double zDelta, int basepal); -void viewToggle(int viewMode); void viewInitializePrediction(void); void viewUpdatePrediction(GINPUT *pInput); void viewCorrectPrediction(void);