- Floatified automap's gZoom.

* Also use the global directly in automap functions instead of passing it around as function variables.
This commit is contained in:
Mitchell Richters 2022-08-29 23:05:10 +10:00 committed by Christoph Oelckers
parent f5116dd787
commit 4d04a4dd3a
10 changed files with 24 additions and 24 deletions

View file

@ -59,7 +59,7 @@ int automapMode;
static float am_zoomdir; static float am_zoomdir;
int follow_x = INT_MAX, follow_y = INT_MAX; int follow_x = INT_MAX, follow_y = INT_MAX;
DAngle follow_a = DAngle::fromDeg(INT_MAX); DAngle follow_a = DAngle::fromDeg(INT_MAX);
static int gZoom = 768; static double gZoom = 768;
bool automapping; bool automapping;
bool gFullMap; bool gFullMap;
BitArray show2dsector; BitArray show2dsector;
@ -186,9 +186,9 @@ static void CalcMapBounds()
void AutomapControl() void AutomapControl()
{ {
static int nonsharedtimer; static double nonsharedtimer;
int ms = (int)screen->FrameTime; double ms = screen->FrameTime;
int interval; double interval;
int panvert = 0, panhorz = 0; int panvert = 0, panhorz = 0;
if (nonsharedtimer > 0 || ms < nonsharedtimer) if (nonsharedtimer > 0 || ms < nonsharedtimer)
@ -209,22 +209,22 @@ void AutomapControl()
const int keymove = 4; const int keymove = 4;
if (am_zoomdir > 0) if (am_zoomdir > 0)
{ {
gZoom = xs_CRoundToInt(gZoom * am_zoomdir); gZoom = gZoom * am_zoomdir;
} }
else if (am_zoomdir < 0) else if (am_zoomdir < 0)
{ {
gZoom = xs_CRoundToInt(gZoom / -am_zoomdir); gZoom = gZoom / -am_zoomdir;
} }
am_zoomdir = 0; am_zoomdir = 0;
double j = interval * 35. / gZoom; double j = interval * 35. / gZoom;
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen)) if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
gZoom += (int)MulScaleF(j, max(gZoom, 256), 6); gZoom += MulScaleF(j, max(gZoom, 256.), 6);
if (buttonMap.ButtonDown(gamefunc_Shrink_Screen)) if (buttonMap.ButtonDown(gamefunc_Shrink_Screen))
gZoom -= (int)MulScaleF(j, max(gZoom, 256), 6); gZoom -= MulScaleF(j, max(gZoom, 256.), 6);
gZoom = clamp(gZoom, 48, 2048); gZoom = clamp(gZoom, 48., 2048.);
if (!am_followplayer) if (!am_followplayer)
{ {
@ -410,7 +410,7 @@ bool ShowRedLine(int j, int i)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
static void drawredlines(int cposx, int cposy, int czoom, const DAngle cang) static void drawredlines(int cposx, int cposy, const double czoom, const DAngle cang)
{ {
int xvect = -cang.Sin() * 16384. * czoom; int xvect = -cang.Sin() * 16384. * czoom;
int yvect = -cang.Cos() * 16384. * czoom; int yvect = -cang.Cos() * 16384. * czoom;
@ -458,7 +458,7 @@ static void drawredlines(int cposx, int cposy, int czoom, const DAngle cang)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
static void drawwhitelines(int cposx, int cposy, int czoom, const DAngle cang) static void drawwhitelines(int cposx, int cposy, const double czoom, const DAngle cang)
{ {
int xvect = -cang.Sin() * 16384. * czoom; int xvect = -cang.Sin() * 16384. * czoom;
int yvect = -cang.Cos() * 16384. * czoom; int yvect = -cang.Cos() * 16384. * czoom;
@ -500,7 +500,7 @@ static void drawwhitelines(int cposx, int cposy, int czoom, const DAngle cang)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
static void DrawPlayerArrow(int cposx, int cposy, const DAngle cang, int pl_x, int pl_y, int zoom, const DAngle pl_angle) static void DrawPlayerArrow(int cposx, int cposy, const DAngle cang, int pl_x, int pl_y, const double czoom, const DAngle pl_angle)
{ {
int arrow[] = int arrow[] =
{ {
@ -509,8 +509,8 @@ static void DrawPlayerArrow(int cposx, int cposy, const DAngle cang, int pl_x, i
0, 65536, 32768, 32878, 0, 65536, 32768, 32878,
}; };
int xvect = -cang.Sin() * 16384. * zoom; int xvect = -cang.Sin() * 16384. * czoom;
int yvect = -cang.Cos() * 16384. * zoom; int yvect = -cang.Cos() * 16384. * czoom;
int pxvect = -pl_angle.Sin() * 16384.; int pxvect = -pl_angle.Sin() * 16384.;
int pyvect = -pl_angle.Cos() * 16384.; int pyvect = -pl_angle.Cos() * 16384.;
@ -547,7 +547,7 @@ static void DrawPlayerArrow(int cposx, int cposy, const DAngle cang, int pl_x, i
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
static void renderDrawMapView(int cposx, int cposy, int czoom, const DAngle cang) static void renderDrawMapView(int cposx, int cposy, const double czoom, const DAngle cang)
{ {
int xvect = -cang.Sin() * 16384. * czoom; int xvect = -cang.Sin() * 16384. * czoom;
int yvect = -cang.Cos() * 16384. * czoom; int yvect = -cang.Cos() * 16384. * czoom;

View file

@ -107,7 +107,7 @@ struct GameInterface
virtual void NextLevel(MapRecord* map, int skill) {} virtual void NextLevel(MapRecord* map, int skill) {}
virtual void NewGame(MapRecord* map, int skill, bool special = false) {} virtual void NewGame(MapRecord* map, int skill, bool special = false) {}
virtual void LevelCompleted(MapRecord* map, int skill) {} virtual void LevelCompleted(MapRecord* map, int skill) {}
virtual bool DrawAutomapPlayer(int mx, int my, int x, int y, int z, const DAngle a, double const smoothratio) { return false; } virtual bool DrawAutomapPlayer(int mx, int my, int x, int y, const double z, const DAngle a, double const smoothratio) { return false; }
virtual void SetTileProps(int tile, int surf, int vox, int shade) {} virtual void SetTileProps(int tile, int surf, int vox, int shade) {}
virtual fixed_t playerHorizMin() { return IntToFixed(-200); } virtual fixed_t playerHorizMin() { return IntToFixed(-200); }
virtual fixed_t playerHorizMax() { return IntToFixed(200); } virtual fixed_t playerHorizMax() { return IntToFixed(200); }

View file

@ -133,7 +133,7 @@ struct GameInterface : public ::GameInterface
void NewGame(MapRecord* sng, int skill, bool) override; void NewGame(MapRecord* sng, int skill, bool) override;
void NextLevel(MapRecord* map, int skill) override; void NextLevel(MapRecord* map, int skill) override;
void LevelCompleted(MapRecord* map, int skill) override; void LevelCompleted(MapRecord* map, int skill) override;
bool DrawAutomapPlayer(int mx, int my, int x, int y, int z, const DAngle a, double const smoothratio) override; bool DrawAutomapPlayer(int mx, int my, int x, int y, const double z, const DAngle a, double const smoothratio) override;
void SetTileProps(int til, int surf, int vox, int shade) override; void SetTileProps(int til, int surf, int vox, int shade) override;
fixed_t playerHorizMin() override { return IntToFixed(-180); } fixed_t playerHorizMin() override { return IntToFixed(-180); }
fixed_t playerHorizMax() override { return IntToFixed(120); } fixed_t playerHorizMax() override { return IntToFixed(120); }

View file

@ -860,7 +860,7 @@ std::pair<DVector3, DAngle> GameInterface::GetCoordinates()
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool GameInterface::DrawAutomapPlayer(int mx, int my, int x, int y, int z, const DAngle a, double const smoothratio) bool GameInterface::DrawAutomapPlayer(int mx, int my, int x, int y, const double z, const DAngle a, double const smoothratio)
{ {
for (int i = connecthead; i >= 0; i = connectpoint2[i]) for (int i = connecthead; i >= 0; i = connectpoint2[i])
{ {

View file

@ -50,7 +50,7 @@ struct GameInterface : public ::GameInterface
void NextLevel(MapRecord* map, int skill) override; void NextLevel(MapRecord* map, int skill) override;
void NewGame(MapRecord* map, int skill, bool) override; void NewGame(MapRecord* map, int skill, bool) override;
void LevelCompleted(MapRecord* map, int skill) override; void LevelCompleted(MapRecord* map, int skill) override;
bool DrawAutomapPlayer(int mx, int my, int x, int y, int z, const DAngle a, double const smoothratio) override; bool DrawAutomapPlayer(int mx, int my, int x, int y, const double z, const DAngle a, double const smoothratio) override;
int playerKeyMove() override { return 40; } int playerKeyMove() override { return 40; }
void WarpToCoords(int x, int y, int z, int a, int h) override; void WarpToCoords(int x, int y, int z, int a, int h) override;
void ToggleThirdPerson() override; void ToggleThirdPerson() override;

View file

@ -385,7 +385,7 @@ ReservedSpace GameInterface::GetReservedScreenSpace(int viewsize)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int czoom, const DAngle cang, double const smoothratio) bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, const double czoom, const DAngle cang, double const smoothratio)
{ {
int i, j, k, l, x1, y1, x2, y2, x3, y3, x4, y4, ox, oy, xoff, yoff; 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; int dax, day, cosang, sinang, xspan, yspan, sprx, spry;

View file

@ -230,7 +230,7 @@ struct GameInterface : public ::GameInterface
void NewGame(MapRecord *map, int skill, bool) override; void NewGame(MapRecord *map, int skill, bool) override;
void LevelCompleted(MapRecord *map, int skill) override; void LevelCompleted(MapRecord *map, int skill) override;
void NextLevel(MapRecord *map, int skill) override; void NextLevel(MapRecord *map, int skill) override;
bool DrawAutomapPlayer(int mx, int my, int x, int y, int z, const DAngle a, double const smoothratio) override; bool DrawAutomapPlayer(int mx, int my, int x, int y, const double z, const DAngle a, double const smoothratio) override;
fixed_t playerHorizMin() override { return IntToFixed(-150); } fixed_t playerHorizMin() override { return IntToFixed(-150); }
fixed_t playerHorizMax() override { return IntToFixed(150); } fixed_t playerHorizMax() override { return IntToFixed(150); }
int playerKeyMove() override { return 6; } int playerKeyMove() override { return 6; }

View file

@ -69,7 +69,7 @@ void GetActorExtents(DExhumedActor* actor, int* top, int* bottom)
} }
} }
bool GameInterface::DrawAutomapPlayer(int mx, int my, int x, int y, int z, const DAngle a, double const smoothratio) bool GameInterface::DrawAutomapPlayer(int mx, int my, int x, int y, const double z, const DAngle a, double const smoothratio)
{ {
for (int i = connecthead; i >= 0; i = connectpoint2[i]) for (int i = connecthead; i >= 0; i = connectpoint2[i])
{ {

View file

@ -1567,7 +1567,7 @@ bool GameInterface::GenerateSavePic()
bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int czoom, const DAngle cang, double const smoothratio) bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, const double czoom, const DAngle cang, double const smoothratio)
{ {
int k, l, x1, y1, x2, y2, x3, y3, x4, y4, ox, oy, xoff, yoff; int k, l, x1, y1, x2, y2, x3, y3, x4, y4, ox, oy, xoff, yoff;
int dax, day, cosang, sinang, xspan, yspan, sprx, spry; int dax, day, cosang, sinang, xspan, yspan, sprx, spry;

View file

@ -2038,7 +2038,7 @@ struct GameInterface : public ::GameInterface
void LevelCompleted(MapRecord *map, int skill) override; void LevelCompleted(MapRecord *map, int skill) override;
void NextLevel(MapRecord *map, int skill) override; void NextLevel(MapRecord *map, int skill) override;
void NewGame(MapRecord *map, int skill, bool) override; void NewGame(MapRecord *map, int skill, bool) override;
bool DrawAutomapPlayer(int mx, int my, int x, int y, int z, const DAngle a, double const smoothratio) override; bool DrawAutomapPlayer(int mx, int my, int x, int y, const double z, const DAngle a, double const smoothratio) override;
int playerKeyMove() override { return 35; } int playerKeyMove() override { return 35; }
void WarpToCoords(int x, int y, int z, int a, int h) override; void WarpToCoords(int x, int y, int z, int a, int h) override;
void ToggleThirdPerson() override; void ToggleThirdPerson() override;