mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
- Pass a DAngle through to all the automap code.
This commit is contained in:
parent
7286585998
commit
f5116dd787
11 changed files with 50 additions and 49 deletions
|
@ -57,7 +57,8 @@ CVAR(Bool, am_nameontop, false, CVAR_ARCHIVE)
|
|||
|
||||
int automapMode;
|
||||
static float am_zoomdir;
|
||||
int follow_x = INT_MAX, follow_y = INT_MAX, follow_a = INT_MAX;
|
||||
int follow_x = INT_MAX, follow_y = INT_MAX;
|
||||
DAngle follow_a = DAngle::fromDeg(INT_MAX);
|
||||
static int gZoom = 768;
|
||||
bool automapping;
|
||||
bool gFullMap;
|
||||
|
@ -239,11 +240,11 @@ void AutomapControl()
|
|||
if (buttonMap.ButtonDown(gamefunc_AM_PanDown))
|
||||
panvert -= keymove;
|
||||
|
||||
int momx = MulScale(panvert, bcos(follow_a), 9);
|
||||
int momy = MulScale(panvert, bsin(follow_a), 9);
|
||||
int momx = MulScale(panvert, follow_a.Cos() * 16384., 9);
|
||||
int momy = MulScale(panvert, follow_a.Sin() * 16384., 9);
|
||||
|
||||
momx += MulScale(panhorz, bsin(follow_a), 9);
|
||||
momy += MulScale(panhorz, -bcos(follow_a), 9);
|
||||
momx += MulScale(panhorz, follow_a.Sin() * 16384., 9);
|
||||
momy += MulScale(panhorz, -follow_a.Cos() * 16384., 9);
|
||||
|
||||
follow_x += int(momx * j);
|
||||
follow_y += int(momy * j);
|
||||
|
@ -409,10 +410,10 @@ bool ShowRedLine(int j, int i)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void drawredlines(int cposx, int cposy, int czoom, int cang)
|
||||
static void drawredlines(int cposx, int cposy, int czoom, const DAngle cang)
|
||||
{
|
||||
int xvect = -bsin(cang) * czoom;
|
||||
int yvect = -bcos(cang) * czoom;
|
||||
int xvect = -cang.Sin() * 16384. * czoom;
|
||||
int yvect = -cang.Cos() * 16384. * czoom;
|
||||
int width = screen->GetWidth();
|
||||
int height = screen->GetHeight();
|
||||
|
||||
|
@ -457,10 +458,10 @@ void drawredlines(int cposx, int cposy, int czoom, int cang)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void drawwhitelines(int cposx, int cposy, int czoom, int cang)
|
||||
static void drawwhitelines(int cposx, int cposy, int czoom, const DAngle cang)
|
||||
{
|
||||
int xvect = -bsin(cang) * czoom;
|
||||
int yvect = -bcos(cang) * czoom;
|
||||
int xvect = -cang.Sin() * 16384. * czoom;
|
||||
int yvect = -cang.Cos() * 16384. * czoom;
|
||||
int width = screen->GetWidth();
|
||||
int height = screen->GetHeight();
|
||||
|
||||
|
@ -499,7 +500,7 @@ static void drawwhitelines(int cposx, int cposy, int czoom, int cang)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void DrawPlayerArrow(int cposx, int cposy, int cang, int pl_x, int pl_y, int zoom, int pl_angle)
|
||||
static void DrawPlayerArrow(int cposx, int cposy, const DAngle cang, int pl_x, int pl_y, int zoom, const DAngle pl_angle)
|
||||
{
|
||||
int arrow[] =
|
||||
{
|
||||
|
@ -508,11 +509,11 @@ void DrawPlayerArrow(int cposx, int cposy, int cang, int pl_x, int pl_y, int zoo
|
|||
0, 65536, 32768, 32878,
|
||||
};
|
||||
|
||||
int xvect = -bsin(cang) * zoom;
|
||||
int yvect = -bcos(cang) * zoom;
|
||||
int xvect = -cang.Sin() * 16384. * zoom;
|
||||
int yvect = -cang.Cos() * 16384. * zoom;
|
||||
|
||||
int pxvect = -bsin(pl_angle);
|
||||
int pyvect = -bcos(pl_angle);
|
||||
int pxvect = -pl_angle.Sin() * 16384.;
|
||||
int pyvect = -pl_angle.Cos() * 16384.;
|
||||
|
||||
int width = screen->GetWidth();
|
||||
int height = screen->GetHeight();
|
||||
|
@ -546,10 +547,10 @@ void DrawPlayerArrow(int cposx, int cposy, int cang, int pl_x, int pl_y, int zoo
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void renderDrawMapView(int cposx, int cposy, int czoom, int cang)
|
||||
static void renderDrawMapView(int cposx, int cposy, int czoom, const DAngle cang)
|
||||
{
|
||||
int xvect = -bsin(cang) * czoom;
|
||||
int yvect = -bcos(cang) * czoom;
|
||||
int xvect = -cang.Sin() * 16384. * czoom;
|
||||
int yvect = -cang.Cos() * 16384. * czoom;
|
||||
int width = screen->GetWidth();
|
||||
int height = screen->GetHeight();
|
||||
TArray<FVector4> vertices;
|
||||
|
@ -655,7 +656,7 @@ void renderDrawMapView(int cposx, int cposy, int czoom, int cang)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void DrawOverheadMap(int pl_x, int pl_y, int pl_angle, double const smoothratio)
|
||||
void DrawOverheadMap(int pl_x, int pl_y, const DAngle pl_angle, double const smoothratio)
|
||||
{
|
||||
if (am_followplayer || follow_x == INT_MAX)
|
||||
{
|
||||
|
@ -664,7 +665,7 @@ void DrawOverheadMap(int pl_x, int pl_y, int pl_angle, double const smoothratio)
|
|||
}
|
||||
int x = follow_x;
|
||||
int y = follow_y;
|
||||
follow_a = am_rotate ? pl_angle : 1536;
|
||||
follow_a = am_rotate ? pl_angle : DAngle::fromBuild(1536);
|
||||
AutomapControl();
|
||||
|
||||
if (automapMode == am_full)
|
||||
|
|
|
@ -16,7 +16,7 @@ extern BitArray show2dwall;
|
|||
void SerializeAutomap(FSerializer& arc);
|
||||
void ClearAutomap();
|
||||
void MarkSectorSeen(sectortype* sect);
|
||||
void DrawOverheadMap(int x, int y, int ang, double const smoothratio);
|
||||
void DrawOverheadMap(int pl_x, int pl_y, const DAngle pl_angle, double const smoothratio);
|
||||
bool AM_Responder(event_t* ev, bool last);
|
||||
void drawlinergb(int32_t x1, int32_t y1, int32_t x2, int32_t y2, PalEntry p);
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ struct GameInterface
|
|||
virtual void NextLevel(MapRecord* map, int skill) {}
|
||||
virtual void NewGame(MapRecord* map, int skill, bool special = false) {}
|
||||
virtual void LevelCompleted(MapRecord* map, int skill) {}
|
||||
virtual bool DrawAutomapPlayer(int mx, int my, int x, int y, int z, int a, double const smoothratio) { return false; }
|
||||
virtual bool DrawAutomapPlayer(int mx, int my, int x, int y, int z, const DAngle a, double const smoothratio) { return false; }
|
||||
virtual void SetTileProps(int tile, int surf, int vox, int shade) {}
|
||||
virtual fixed_t playerHorizMin() { return IntToFixed(-200); }
|
||||
virtual fixed_t playerHorizMax() { return IntToFixed(200); }
|
||||
|
|
|
@ -133,7 +133,7 @@ struct GameInterface : public ::GameInterface
|
|||
void NewGame(MapRecord* sng, int skill, bool) override;
|
||||
void NextLevel(MapRecord* map, int skill) override;
|
||||
void LevelCompleted(MapRecord* map, int skill) override;
|
||||
bool DrawAutomapPlayer(int mx, int my, int x, int y, int z, int a, double const smoothratio) override;
|
||||
bool DrawAutomapPlayer(int mx, int my, int x, int y, int z, const DAngle a, double const smoothratio) override;
|
||||
void SetTileProps(int til, int surf, int vox, int shade) override;
|
||||
fixed_t playerHorizMin() override { return IntToFixed(-180); }
|
||||
fixed_t playerHorizMax() override { return IntToFixed(120); }
|
||||
|
|
|
@ -474,7 +474,7 @@ static void DrawMap(DBloodActor* view)
|
|||
VIEW* pView = &gPrevView[gViewIndex];
|
||||
int x = interpolatedvalue(pView->x, view->int_pos().X, gInterpolate);
|
||||
int y = interpolatedvalue(pView->y, view->int_pos().Y, gInterpolate);
|
||||
int ang = (!SyncInput() ? gView->angle.sum() : gView->angle.interpolatedsum(gInterpolate)).Buildang();
|
||||
auto ang = !SyncInput() ? gView->angle.sum() : gView->angle.interpolatedsum(gInterpolate);
|
||||
DrawOverheadMap(x, y, ang, gInterpolate);
|
||||
if (tm)
|
||||
setViewport(hud_size);
|
||||
|
@ -860,15 +860,15 @@ std::pair<DVector3, DAngle> GameInterface::GetCoordinates()
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool GameInterface::DrawAutomapPlayer(int mx, int my, int x, int y, int z, int a, double const smoothratio)
|
||||
bool GameInterface::DrawAutomapPlayer(int mx, int my, int x, int y, int z, const DAngle a, double const smoothratio)
|
||||
{
|
||||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
{
|
||||
PLAYER* pPlayer = &gPlayer[i];
|
||||
auto actor = pPlayer->actor;
|
||||
|
||||
int xvect = -bsin(a) * z;
|
||||
int yvect = -bcos(a) * z;
|
||||
int xvect = -a.Sin() * 16384. * z;
|
||||
int yvect = -a.Cos() * 16384. * z;
|
||||
int ox = mx - x;
|
||||
int oy = my - y;
|
||||
int x1 = DMulScale(ox, xvect, -oy, yvect, 16);
|
||||
|
|
|
@ -50,7 +50,7 @@ struct GameInterface : public ::GameInterface
|
|||
void NextLevel(MapRecord* map, int skill) override;
|
||||
void NewGame(MapRecord* map, int skill, bool) override;
|
||||
void LevelCompleted(MapRecord* map, int skill) override;
|
||||
bool DrawAutomapPlayer(int mx, int my, int x, int y, int z, int a, double const smoothratio) override;
|
||||
bool DrawAutomapPlayer(int mx, int my, int x, int y, int z, const DAngle a, double const smoothratio) override;
|
||||
int playerKeyMove() override { return 40; }
|
||||
void WarpToCoords(int x, int y, int z, int a, int h) override;
|
||||
void ToggleThirdPerson() override;
|
||||
|
|
|
@ -283,7 +283,7 @@ void drawoverlays(double smoothratio)
|
|||
cposy = pp->player_int_opos().Y;
|
||||
cang = pp->angle.oang;
|
||||
}
|
||||
DrawOverheadMap(cposx, cposy, cang.Buildang(), smoothratio);
|
||||
DrawOverheadMap(cposx, cposy, cang, smoothratio);
|
||||
RestoreInterpolations();
|
||||
}
|
||||
}
|
||||
|
@ -385,17 +385,17 @@ ReservedSpace GameInterface::GetReservedScreenSpace(int viewsize)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int czoom, int cang, double const smoothratio)
|
||||
bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int 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 dax, day, cosang, sinang, xspan, yspan, sprx, spry;
|
||||
int xrepeat, yrepeat, tilenum, daang;
|
||||
int xrepeat, yrepeat, tilenum;
|
||||
int xvect, yvect;
|
||||
int p;
|
||||
PalEntry col;
|
||||
|
||||
xvect = -bsin(cang) * czoom;
|
||||
yvect = -bcos(cang) * czoom;
|
||||
xvect = -cang.Sin() * 16384. * czoom;
|
||||
yvect = -cang.Cos() * 16384. * czoom;
|
||||
|
||||
int xdim = twod->GetWidth() << 11;
|
||||
int ydim = twod->GetHeight() << 11;
|
||||
|
@ -559,7 +559,7 @@ bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int
|
|||
int xx = twod->GetWidth() / 2. + x1 / 4096.;
|
||||
int yy = twod->GetHeight() / 2. + y1 / 4096.;
|
||||
|
||||
daang = ((!SyncInput() ? act->spr.angle : act->interpolatedangle(smoothratio / 65536.)).Buildang() - cang) & 2047;
|
||||
auto const daang = -((!SyncInput() ? act->spr.angle : act->interpolatedangle(smoothratio / 65536.)) - cang).Normalized360().Degrees();
|
||||
|
||||
if (p == screenpeek || ud.coop == 1)
|
||||
{
|
||||
|
@ -576,7 +576,7 @@ bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int
|
|||
else if (j > (65536 << 1)) j = (65536 << 1);
|
||||
|
||||
DrawTexture(twod, tileGetTexture(i), xx, yy, DTA_TranslationIndex, TRANSLATION(Translation_Remap + setpal(&pp), act->spr.pal), DTA_CenterOffset, true,
|
||||
DTA_Rotate, daang * -BAngToDegree, DTA_Color, shadeToLight(act->spr.shade), DTA_ScaleX, j / 65536., DTA_ScaleY, j / 65536., TAG_DONE);
|
||||
DTA_Rotate, daang, DTA_Color, shadeToLight(act->spr.shade), DTA_ScaleX, j / 65536., DTA_ScaleY, j / 65536., TAG_DONE);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -230,7 +230,7 @@ struct GameInterface : public ::GameInterface
|
|||
void NewGame(MapRecord *map, int skill, bool) override;
|
||||
void LevelCompleted(MapRecord *map, int skill) override;
|
||||
void NextLevel(MapRecord *map, int skill) override;
|
||||
bool DrawAutomapPlayer(int mx, int my, int x, int y, int z, int a, double const smoothratio) override;
|
||||
bool DrawAutomapPlayer(int mx, int my, int x, int y, int z, const DAngle a, double const smoothratio) override;
|
||||
fixed_t playerHorizMin() override { return IntToFixed(-150); }
|
||||
fixed_t playerHorizMax() override { return IntToFixed(150); }
|
||||
int playerKeyMove() override { return 6; }
|
||||
|
|
|
@ -52,7 +52,7 @@ void DrawMap(double const smoothratio)
|
|||
|
||||
int x = pPlayerActor->__interpolatedx(smoothratio);
|
||||
int y = pPlayerActor->__interpolatedy(smoothratio);
|
||||
int ang = (!SyncInput() ? PlayerList[nLocalPlayer].angle.sum() : PlayerList[nLocalPlayer].angle.interpolatedsum(smoothratio)).Buildang();
|
||||
auto ang = !SyncInput() ? PlayerList[nLocalPlayer].angle.sum() : PlayerList[nLocalPlayer].angle.interpolatedsum(smoothratio);
|
||||
DrawOverheadMap(x, y, ang, smoothratio);
|
||||
}
|
||||
}
|
||||
|
@ -69,14 +69,14 @@ void GetActorExtents(DExhumedActor* actor, int* top, int* bottom)
|
|||
}
|
||||
}
|
||||
|
||||
bool GameInterface::DrawAutomapPlayer(int mx, int my, int x, int y, int z, int a, double const smoothratio)
|
||||
bool GameInterface::DrawAutomapPlayer(int mx, int my, int x, int y, int z, const DAngle a, double const smoothratio)
|
||||
{
|
||||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
{
|
||||
auto pPlayerActor = PlayerList[i].pActor;
|
||||
|
||||
int xvect = -bsin(a) * z;
|
||||
int yvect = -bcos(a) * z;
|
||||
int xvect = -a.Sin() * 16384. * z;
|
||||
int yvect = -a.Cos() * 16384. * z;
|
||||
int ox = mx - x;
|
||||
int oy = my - y;
|
||||
int x1 = DMulScale(ox, xvect, -oy, yvect, 16);
|
||||
|
|
|
@ -1505,7 +1505,7 @@ void drawscreen(PLAYER* pp, double smoothratio, bool sceneonly)
|
|||
}
|
||||
}
|
||||
}
|
||||
DrawOverheadMap(tx, ty, tang.Buildang(), smoothratio);
|
||||
DrawOverheadMap(tx, ty, tang, smoothratio);
|
||||
}
|
||||
|
||||
SWSpriteIterator it;
|
||||
|
@ -1567,11 +1567,11 @@ bool GameInterface::GenerateSavePic()
|
|||
|
||||
|
||||
|
||||
bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int czoom, int cang, double const smoothratio)
|
||||
bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int czoom, const DAngle cang, double const smoothratio)
|
||||
{
|
||||
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 xrepeat, yrepeat, z1, z2, startwall, endwall, tilenum, daang;
|
||||
int xrepeat, yrepeat, z1, z2, startwall, endwall, tilenum;
|
||||
int xvect, yvect;
|
||||
walltype* wal, * wal2;
|
||||
short p;
|
||||
|
@ -1579,8 +1579,8 @@ bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int
|
|||
bool sprisplayer = false;
|
||||
short txt_x, txt_y;
|
||||
|
||||
xvect = -bsin(cang) * czoom;
|
||||
yvect = -bcos(cang) * czoom;
|
||||
xvect = -cang.Sin() * 16384. * czoom;
|
||||
yvect = -cang.Cos() * 16384. * czoom;
|
||||
|
||||
int xdim = twod->GetWidth() << 11;
|
||||
int ydim = twod->GetHeight() << 11;
|
||||
|
@ -1637,7 +1637,7 @@ bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int
|
|||
|
||||
if (czoom > 192)
|
||||
{
|
||||
daang = ((!SyncInput() ? actor->spr.angle : actor->interpolatedangle(smoothratio / 65536.)).Buildang() - cang) & 2047;
|
||||
const auto daang = -((!SyncInput() ? actor->spr.angle : actor->interpolatedangle(smoothratio / 65536.)) - cang).Normalized360().Degrees();
|
||||
|
||||
// Special case tiles
|
||||
if (actor->spr.picnum == 3123) break;
|
||||
|
@ -1653,7 +1653,7 @@ bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int
|
|||
double sc = czoom * (actor->spr.yrepeat) / 32768.;
|
||||
if (spnum >= 0)
|
||||
{
|
||||
DrawTexture(twod, tileGetTexture(1196 + pspr_ndx[myconnectindex], true), xx, yy, DTA_ScaleX, sc, DTA_ScaleY, sc, DTA_Rotate, daang * -BAngToDegree,
|
||||
DrawTexture(twod, tileGetTexture(1196 + pspr_ndx[myconnectindex], true), xx, yy, DTA_ScaleX, sc, DTA_ScaleY, sc, DTA_Rotate, daang,
|
||||
DTA_CenterOffsetRel, 2, DTA_TranslationIndex, TRANSLATION(Translation_Remap, actor->spr.pal), DTA_Color, shadeToLight(actor->spr.shade),
|
||||
DTA_Alpha, (actor->spr.cstat & CSTAT_SPRITE_TRANSLUCENT) ? 0.33 : 1., TAG_DONE);
|
||||
}
|
||||
|
|
|
@ -2038,7 +2038,7 @@ struct GameInterface : public ::GameInterface
|
|||
void LevelCompleted(MapRecord *map, int skill) override;
|
||||
void NextLevel(MapRecord *map, int skill) override;
|
||||
void NewGame(MapRecord *map, int skill, bool) override;
|
||||
bool DrawAutomapPlayer(int mx, int my, int x, int y, int z, int a, double const smoothratio) override;
|
||||
bool DrawAutomapPlayer(int mx, int my, int x, int y, int z, const DAngle a, double const smoothratio) override;
|
||||
int playerKeyMove() override { return 35; }
|
||||
void WarpToCoords(int x, int y, int z, int a, int h) override;
|
||||
void ToggleThirdPerson() override;
|
||||
|
|
Loading…
Reference in a new issue