- Commence updating gi->DrawAutomapPlayer() for floatification, beginning with Duke's CSTAT_SPRITE_ALIGNMENT_FACING code.

This commit is contained in:
Mitchell Richters 2022-09-01 20:19:05 +10:00 committed by Christoph Oelckers
parent d9f8ac4d2a
commit 986466de67
3 changed files with 17 additions and 24 deletions

View file

@ -404,8 +404,8 @@ static void drawredlines(const DVector2& cpos, const double sine, const double c
if (ShowRedLine(wallnum(&wal), i))
{
auto v1 = OutAutomapVector(wal.pos - cpos, sine, cosine, xydim, gZoom);
auto v2 = OutAutomapVector(wal.point2Wall()->pos - cpos, sine, cosine, xydim, gZoom);
auto v1 = OutAutomapVector(wal.pos - cpos, sine, cosine, gZoom, xydim);
auto v2 = OutAutomapVector(wal.point2Wall()->pos - cpos, sine, cosine, gZoom, xydim);
drawlinergb(v1.X, v1.Y, v2.X, v2.Y, RedLineColor());
}
}
@ -432,8 +432,8 @@ static void drawwhitelines(const DVector2& cpos, const double sine, const double
if (isSWALL() && !gFullMap && !show2dwall[wallnum(&wal)])
continue;
auto v1 = OutAutomapVector(wal.pos - cpos, sine, cosine, xydim, gZoom);
auto v2 = OutAutomapVector(wal.point2Wall()->pos - cpos, sine, cosine, xydim, gZoom);
auto v1 = OutAutomapVector(wal.pos - cpos, sine, cosine, gZoom, xydim);
auto v2 = OutAutomapVector(wal.point2Wall()->pos - cpos, sine, cosine, gZoom, xydim);
drawlinergb(v1.X, v1.Y, v2.X, v2.Y, WhiteLineColor());
}
}
@ -532,7 +532,7 @@ static void renderDrawMapView(const DVector2& cpos, const double sine, const dou
vertices.Resize(mesh->vertices.Size());
for (unsigned j = 0; j < mesh->vertices.Size(); j++)
{
auto v = OutAutomapVector(DVector2(mesh->vertices[j].X - cpos.X, -mesh->vertices[j].Y - cpos.Y), sine, cosine, xydim, gZoom);
auto v = OutAutomapVector(DVector2(mesh->vertices[j].X - cpos.X, -mesh->vertices[j].Y - cpos.Y), sine, cosine, gZoom, xydim);
vertices[j] = { float(v.X), float(v.Y), mesh->texcoords[j].X, mesh->texcoords[j].Y };
}
@ -558,7 +558,7 @@ static void renderDrawMapView(const DVector2& cpos, const double sine, const dou
for (unsigned j = 0; j < 4; j++)
{
auto v = OutAutomapVector(pp[j] - cpos, sine, cosine, xydim, gZoom);
auto v = OutAutomapVector(pp[j] - cpos, sine, cosine, gZoom, xydim);
vertices[j] = { float(v.X), float(v.Y), j == 1 || j == 2 ? 1.f : 0.f, j == 2 || j == 3 ? 1.f : 0.f };
}
int shade;

View file

@ -25,7 +25,7 @@ inline void drawlinergb(int32_t x1, int32_t y1, int32_t x2, int32_t y2, PalEntry
drawlinergb(x1 / 4096., y1 / 4096., x2 / 4096., y2 / 4096., p);
}
inline DVector2 OutAutomapVector(const DVector2& pos, const double sine, const double cosine, const DVector2& xydim, const double zoom = 1.)
inline DVector2 OutAutomapVector(const DVector2& pos, const double sine, const double cosine, const double zoom = 1., const DVector2& xydim = { 0, 0 })
{
return pos.Rotated(cosine, sine).Rotated90CW() * zoom + xydim;
}

View file

@ -387,6 +387,8 @@ ReservedSpace GameInterface::GetReservedScreenSpace(int viewsize)
bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, const double czoom, const DAngle cang, double const smoothratio)
{
DVector2 v1, v2, v3, v4;
DAngle an;
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;
@ -416,27 +418,18 @@ bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, cons
sprx = act->int_pos().X;
spry = act->int_pos().Y;
auto xydim = DVector2(twod->GetWidth() * 0.5, twod->GetHeight() * 0.5);
if ((act->spr.cstat & CSTAT_SPRITE_BLOCK_ALL) != 0) switch (act->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK)
{
case CSTAT_SPRITE_ALIGNMENT_FACING:
//break;
an = -cang;
v1 = OutAutomapVector(DVector2(sprx - cposx, spry - cposy) * inttoworld, an.Sin(), an.Cos(), czoom / 1024.);
v2 = OutAutomapVector(act->spr.angle.ToVector() * 8., an.Sin(), an.Cos(), czoom / 1024.);
ox = sprx - cposx;
oy = spry - cposy;
x1 = DMulScale(ox, xvect, -oy, yvect, 16);
y1 = DMulScale(oy, xvect, ox, yvect, 16);
ox = bcos(act->int_ang(), -7);
oy = bsin(act->int_ang(), -7);
x2 = DMulScale(ox, xvect, -oy, yvect, 16);
y2 = DMulScale(oy, xvect, ox, yvect, 16);
x3 = x2;
y3 = y2;
drawlinergb(x1 - x2 + xdim, y1 - y3 + ydim, x1 + x2 + xdim, y1 + y3 + ydim, col);
drawlinergb(x1 - y2 + xdim, y1 + x3 + ydim, x1 + x2 + xdim, y1 + y3 + ydim, col);
drawlinergb(x1 + y2 + xdim, y1 - x3 + ydim, x1 + x2 + xdim, y1 + y3 + ydim, col);
drawlinergb(v1.X - v2.X + xydim.X, v1.Y - v2.Y + xydim.Y, v1.X + v2.X + xydim.X, v1.Y + v2.Y + xydim.Y, col);
drawlinergb(v1.X - v2.Y + xydim.X, v1.Y + v2.X + xydim.Y, v1.X + v2.X + xydim.X, v1.Y + v2.Y + xydim.Y, col);
drawlinergb(v1.X + v2.Y + xydim.X, v1.Y - v2.X + xydim.Y, v1.X + v2.X + xydim.X, v1.Y + v2.Y + xydim.Y, col);
break;
case CSTAT_SPRITE_ALIGNMENT_WALL: