- Automap: Put in framework to interpolate automap player.

This commit is contained in:
Mitchell Richters 2021-01-02 18:23:01 +11:00
parent 2fa2d93084
commit be12da6bfb
14 changed files with 21 additions and 20 deletions

View file

@ -122,7 +122,7 @@ struct GameInterface : ::GameInterface
void NewGame(MapRecord *sng, int skill) override; void NewGame(MapRecord *sng, int skill) 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 x, int y, int z, int a) override; bool DrawAutomapPlayer(int x, int y, int z, int 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

@ -489,7 +489,7 @@ static void DrawMap(spritetype* pSprite)
setViewport(Hud_Stbar); setViewport(Hud_Stbar);
tm = 1; tm = 1;
} }
DrawOverheadMap(pSprite->x, pSprite->y, pSprite->ang); DrawOverheadMap(pSprite->x, pSprite->y, pSprite->ang, gInterpolate);
if (tm) if (tm)
setViewport(hud_size); setViewport(hud_size);
} }
@ -932,7 +932,7 @@ FString GameInterface::GetCoordString()
} }
bool GameInterface::DrawAutomapPlayer(int x, int y, int z, int a) bool GameInterface::DrawAutomapPlayer(int x, int y, int z, int a, double const smoothratio)
{ {
// [MR]: Confirm that this is correct as math doesn't match the variable names. // [MR]: Confirm that this is correct as math doesn't match the variable names.
int nCos = z * -bsin(a); int nCos = z * -bsin(a);

View file

@ -544,7 +544,7 @@ void DrawPlayerArrow(int cposx, int cposy, int cang, int pl_x, int pl_y, int zoo
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void DrawOverheadMap(int pl_x, int pl_y, int pl_angle) void DrawOverheadMap(int pl_x, int pl_y, int pl_angle, double const smoothratio)
{ {
if (am_followplayer || follow_x == INT_MAX) if (am_followplayer || follow_x == INT_MAX)
{ {
@ -566,7 +566,7 @@ void DrawOverheadMap(int pl_x, int pl_y, int pl_angle)
drawredlines(x, y, gZoom, follow_a); drawredlines(x, y, gZoom, follow_a);
drawwhitelines(x, y, gZoom, follow_a); drawwhitelines(x, y, gZoom, follow_a);
if (!gi->DrawAutomapPlayer(x, y, gZoom, follow_a)) if (!gi->DrawAutomapPlayer(x, y, gZoom, follow_a, smoothratio))
DrawPlayerArrow(x, y, follow_a, pl_x, pl_y, gZoom, -pl_angle); DrawPlayerArrow(x, y, follow_a, pl_x, pl_y, gZoom, -pl_angle);
} }

View file

@ -17,7 +17,7 @@ extern FixedBitArray<MAXSPRITES> show2dsprite;
void SerializeAutomap(FSerializer& arc); 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, double const smoothratio);
bool AM_Responder(event_t* ev, bool last); bool AM_Responder(event_t* ev, bool last);
void drawlinergb(int32_t x1, int32_t y1, int32_t x2, int32_t y2, PalEntry p); void drawlinergb(int32_t x1, int32_t y1, int32_t x2, int32_t y2, PalEntry p);

View file

@ -88,7 +88,7 @@ struct GameInterface
virtual void NextLevel(MapRecord* map, int skill) {} virtual void NextLevel(MapRecord* map, int skill) {}
virtual void NewGame(MapRecord* map, int skill) {} virtual void NewGame(MapRecord* map, int skill) {}
virtual void LevelCompleted(MapRecord* map, int skill) {} virtual void LevelCompleted(MapRecord* map, int skill) {}
virtual bool DrawAutomapPlayer(int x, int y, int z, int a) { return false; } virtual bool DrawAutomapPlayer(int x, int y, int z, int 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

@ -103,7 +103,7 @@ extern short bShowTowers;
void GrabMap(); void GrabMap();
void UpdateMap(); void UpdateMap();
void DrawMap(); void DrawMap(double const smoothratio);
// random // random

View file

@ -249,7 +249,7 @@ struct GameInterface : ::GameInterface
void NewGame(MapRecord *map, int skill) override; void NewGame(MapRecord *map, int skill) 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 x, int y, int z, int a) override; bool DrawAutomapPlayer(int x, int y, int z, int 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

@ -46,11 +46,11 @@ void UpdateMap()
} }
} }
void DrawMap() void DrawMap(double const smoothratio)
{ {
if (!nFreeze && automapMode != am_off) if (!nFreeze && automapMode != am_off)
{ {
DrawOverheadMap(initx, inity, inita); DrawOverheadMap(initx, inity, inita, smoothratio);
} }
} }
@ -66,7 +66,7 @@ template<typename T> void GetSpriteExtents(T const* const pSprite, int* top, int
} }
} }
bool GameInterface::DrawAutomapPlayer(int x, int y, int z, int a) bool GameInterface::DrawAutomapPlayer(int x, int y, int z, int a, double const smoothratio)
{ {
// [MR]: Confirm that this is correct as math doesn't match the variable names. // [MR]: Confirm that this is correct as math doesn't match the variable names.
int nCos = z * -bsin(a); int nCos = z * -bsin(a);

View file

@ -436,7 +436,7 @@ void DrawView(double smoothRatio, bool sceneonly)
if (nSnakeCam < 0) if (nSnakeCam < 0)
{ {
DrawWeapons(smoothRatio); DrawWeapons(smoothRatio);
DrawMap(); DrawMap(smoothRatio);
} }
else else
{ {
@ -445,7 +445,7 @@ void DrawView(double smoothRatio, bool sceneonly)
sprite[enemy].pal = nEnemyPal; sprite[enemy].pal = nEnemyPal;
} }
DrawMap(); DrawMap(smoothRatio);
} }
} }
} }

View file

@ -5391,6 +5391,7 @@ void recordoldspritepos()
ac->bposx = ac->s.x; ac->bposx = ac->s.x;
ac->bposy = ac->s.y; ac->bposy = ac->s.y;
ac->bposz = ac->s.z; ac->bposz = ac->s.z;
ac->tempang = ac->s.ang;
} }
} }
} }

View file

@ -57,7 +57,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) override; void NewGame(MapRecord* map, int skill) override;
void LevelCompleted(MapRecord* map, int skill) override; void LevelCompleted(MapRecord* map, int skill) override;
bool DrawAutomapPlayer(int x, int y, int z, int a) override; bool DrawAutomapPlayer(int x, int y, int z, int 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

@ -283,7 +283,7 @@ void drawoverlays(double smoothratio)
cposy = pp->oposy; cposy = pp->oposy;
cang = pp->angle.oang.asbuild(); cang = pp->angle.oang.asbuild();
} }
DrawOverheadMap(cposx, cposy, cang); DrawOverheadMap(cposx, cposy, cang, smoothratio);
RestoreInterpolations(); RestoreInterpolations();
} }
} }
@ -394,7 +394,7 @@ ReservedSpace GameInterface::GetReservedScreenSpace(int viewsize)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang) bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int 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

@ -1812,7 +1812,7 @@ drawscreen(PLAYERp pp, double smoothratio)
} }
} }
} }
DrawOverheadMap(tx, ty, tang.asbuild()); DrawOverheadMap(tx, ty, tang.asbuild(), smoothratio);
} }
for (j = 0; j < MAXSPRITES; j++) for (j = 0; j < MAXSPRITES; j++)
@ -1873,7 +1873,7 @@ bool GameInterface::GenerateSavePic()
bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang) bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int 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

@ -2252,7 +2252,7 @@ struct GameInterface : ::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) override; void NewGame(MapRecord *map, int skill) override;
bool DrawAutomapPlayer(int x, int y, int z, int a) override; bool DrawAutomapPlayer(int x, int y, int z, int 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;