mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 00:42:08 +00:00
- Convert angle in hud_drawsprite()
to work on true degrees, and in the right direction.
This commit is contained in:
parent
3a1729a9ce
commit
67b40ee1d5
9 changed files with 16 additions and 23 deletions
|
@ -1428,11 +1428,6 @@ public:
|
|||
return int(Degrees_ * (512 / 90.0));
|
||||
}
|
||||
|
||||
constexpr double Buildfang() const
|
||||
{
|
||||
return Degrees_ * (512 / 90.0);
|
||||
}
|
||||
|
||||
constexpr int Q16() const
|
||||
{
|
||||
return int(Degrees_ * (16384 / 90.0));
|
||||
|
|
|
@ -73,7 +73,7 @@ void hud_drawsprite(double sx, double sy, double sz, double a, int picnum, int d
|
|||
DTA_FlipX, !!(dastat & RS_XFLIPHUD),
|
||||
DTA_FlipY, !!(dastat & RS_YFLIPHUD),
|
||||
DTA_Pin, (dastat & RS_ALIGN_R) ? 1 : (dastat & RS_ALIGN_L) ? -1 : 0,
|
||||
DTA_Rotate, a * -BAngToDegree,
|
||||
DTA_Rotate, a,
|
||||
DTA_FlipOffsets, !(dastat & (/*RS_TOPLEFT |*/ RS_CENTER)),
|
||||
DTA_Alpha, alpha,
|
||||
TAG_DONE);
|
||||
|
|
|
@ -72,7 +72,7 @@ static void drawElement(int x, int y, int tile, double scale = 1, int flipx = 0,
|
|||
if (flipy) flags |= RS_YFLIPHUD;
|
||||
if (pin == -1) flags |= RS_ALIGN_L;
|
||||
else if (pin == 1) flags |= RS_ALIGN_R;
|
||||
hud_drawsprite(x, y, int(scale * 65536), 0, tile, 0, basepal, flags, alpha);
|
||||
hud_drawsprite(x, y, FloatToFixed(scale), 0, tile, 0, basepal, flags, alpha);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ void QAV::Draw(int ticks, int stat, int shade, int palnum, bool to3dview, double
|
|||
tileAlpha = (tileStat & RS_TRANS1) ? glblend[0].def[!!(tileStat & RS_TRANS2)].alpha : 1.f;
|
||||
}
|
||||
|
||||
DrawFrame(tileX + x, tileY + y, tileZ, (tileA - angle).Buildfang(), tileAlpha, thisTile->picnum, tileStat, tileShade + shade, (palnum <= 0 ? thisTile->palnum : palnum), to3dview);
|
||||
DrawFrame(tileX + x, tileY + y, tileZ, (angle - tileA).Degrees(), tileAlpha, thisTile->picnum, tileStat, tileShade + shade, (palnum <= 0 ? thisTile->palnum : palnum), to3dview);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ inline static double getavel(int snum)
|
|||
|
||||
inline static void hud_drawpal(double x, double y, int tilenum, int shade, int orientation, int p, DAngle angle)
|
||||
{
|
||||
hud_drawsprite(x, y, 65536, angle.Buildfang(), tilenum, shade, p, 2 | orientation);
|
||||
hud_drawsprite(x, y, 65536, angle.Degrees(), tilenum, shade, p, 2 | orientation);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -70,11 +70,11 @@ static void displayloogie(player_struct* p, double const interpfrac)
|
|||
|
||||
for (int i = 0; i < p->numloogs; i++)
|
||||
{
|
||||
const double a = fabs(BobVal((loogi + i) * 32.) * 512);
|
||||
const double a = fabs(BobVal((loogi + i) * 32.) * 90);
|
||||
const double z = 4096. + ((loogi + i) * 512.);
|
||||
const double x = -getavel(p->GetPlayerNum()) + BobVal((loogi + i) * 64.) * 16;
|
||||
|
||||
hud_drawsprite((p->loogie[i].X + x), (200 + p->loogie[i].Y - y), z - (i << 8), 256 - a, DTILE_LOOGIE, 0, 0, 2);
|
||||
hud_drawsprite((p->loogie[i].X + x), (200 + p->loogie[i].Y - y), z - (i << 8), a - 22.5, DTILE_LOOGIE, 0, 0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,7 @@ void displayweapon_d(int snum, double interpfrac)
|
|||
auto offsets = offpair.first;
|
||||
auto pitchoffset = interpolatedvalue(0., 16., p->Angles.getRenderAngles(interpfrac).Pitch / DAngle90);
|
||||
auto yawinput = getavel(snum) * (1. / 16.);
|
||||
auto angle = -offpair.second;
|
||||
auto angle = offpair.second;
|
||||
auto weapon_xoffset = 160 - 90 - (BobVal(512 + weapon_sway * 0.5) * (16384. / 1536.)) - 58 - p->weapon_ang;
|
||||
auto shade = min(p->GetActor()->spr.shade, (int8_t)24);
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ BEGIN_DUKE_NS
|
|||
|
||||
inline static void hud_drawpal(double x, double y, int tilenum, int shade, int orientation, int p, DAngle angle, int scale = 32768)
|
||||
{
|
||||
hud_drawsprite(x, y, scale, angle.Buildfang(), tilenum, shade, p, 2 | orientation);
|
||||
hud_drawsprite(x, y, scale, angle.Degrees(), tilenum, shade, p, 2 | orientation);
|
||||
}
|
||||
|
||||
inline static void rdmyospal(double x, double y, int tilenum, int shade, int orientation, int p, DAngle angle)
|
||||
|
@ -77,7 +77,7 @@ void displaymasks_r(int snum, int p, double interpfrac)
|
|||
hud_drawsprite((320 - tileWidth(RTILE_SCUBAMASK + 4)), (200 - tileHeight(RTILE_SCUBAMASK + 4)), 65536, 0, RTILE_SCUBAMASK + 4, 0, p, 2 + 16 + pin);
|
||||
hud_drawsprite(tileWidth(RTILE_SCUBAMASK + 4), (200 - tileHeight(RTILE_SCUBAMASK + 4)), 65536, 0, RTILE_SCUBAMASK + 4, 0, p, 2 + 4 + 16 + pin);
|
||||
hud_drawsprite(35, (-1), 65536, 0, RTILE_SCUBAMASK + 3, 0, p, 2 + 16 + pin);
|
||||
hud_drawsprite(285, 200, 65536, 1024, RTILE_SCUBAMASK + 3, 0, p, 2 + 16 + pin);
|
||||
hud_drawsprite(285, 200, 65536, -180, RTILE_SCUBAMASK + 3, 0, p, 2 + 16 + pin);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,13 +89,13 @@ void displaymasks_r(int snum, int p, double interpfrac)
|
|||
|
||||
inline static void ShowMotorcycle(double x, double y, int tilenum, int shade, int orientation, int p, double a)
|
||||
{
|
||||
hud_drawsprite(x, y, 34816, a, tilenum, shade, p, 2 | orientation);
|
||||
hud_drawsprite(x, y, 34816, a * -BAngToDegree, tilenum, shade, p, 2 | orientation);
|
||||
}
|
||||
|
||||
|
||||
inline static void ShowBoat(double x, double y, int tilenum, int shade, int orientation, int p, double a)
|
||||
{
|
||||
hud_drawsprite(x, y, 66048, a, tilenum, shade, p, 2 | orientation);
|
||||
hud_drawsprite(x, y, 66048, a * -BAngToDegree, tilenum, shade, p, 2 | orientation);
|
||||
}
|
||||
|
||||
|
||||
|
@ -134,7 +134,7 @@ void displayweapon_r(int snum, double interpfrac)
|
|||
|
||||
auto offpair = p->Angles.getWeaponOffsets(interpfrac);
|
||||
auto offsets = offpair.first;
|
||||
auto angle = -offpair.second;
|
||||
auto angle = offpair.second;
|
||||
auto weapon_xoffset = 160 - 90 - (BobVal(512 + weapon_sway * 0.5) * (16384. / 1536.)) - 58 - p->weapon_ang;
|
||||
auto shade = min(p->insector() && p->cursector->shadedsector == 1 ? 16 : p->GetActor()->spr.shade, 24);
|
||||
auto pal = !p->insector()? 0 : p->GetActor()->spr.pal == 1? 1 : p->cursector->floorpal;
|
||||
|
|
|
@ -1001,7 +1001,7 @@ void DrawWeapons(double interpfrac)
|
|||
}
|
||||
|
||||
const auto weaponOffsets = PlayerList[nLocalPlayer].Angles.getWeaponOffsets(interpfrac);
|
||||
const auto angle = -weaponOffsets.second;
|
||||
const auto angle = weaponOffsets.second;
|
||||
xOffset += weaponOffsets.first.X;
|
||||
yOffset += weaponOffsets.first.Y;
|
||||
|
||||
|
|
|
@ -414,7 +414,7 @@ void seq_DrawPilotLightSeq(double xOffset, double yOffset)
|
|||
double x = ChunkXpos[nFrameBase] + (160 + xOffset);
|
||||
double y = ChunkYpos[nFrameBase] + (100 + yOffset);
|
||||
|
||||
hud_drawsprite(x, y, 65536, fmod(-2 * PlayerList[nLocalPlayer].pActor->spr.Angles.Yaw.Buildfang(), kAngleMask + 1), nTile, 0, 0, 1);
|
||||
hud_drawsprite(x, y, 65536, PlayerList[nLocalPlayer].pActor->spr.Angles.Yaw.Normalized180().Degrees() * 2., nTile, 0, 0, 1);
|
||||
nFrameBase++;
|
||||
}
|
||||
}
|
||||
|
@ -461,7 +461,7 @@ int seq_DrawGunSequence(int nSeqOffset, int16_t dx, double xOffs, double yOffs,
|
|||
alpha = 0.3;
|
||||
}
|
||||
|
||||
hud_drawsprite(x + xOffs, y + yOffs, 65536, angle.Buildfang(), nTile, nShade, nPal, stat, alpha);
|
||||
hud_drawsprite(x + xOffs, y + yOffs, 65536, angle.Degrees(), nTile, nShade, nPal, stat, alpha);
|
||||
nFrameBase++;
|
||||
}
|
||||
|
||||
|
|
|
@ -7382,17 +7382,15 @@ void pDisplaySprites(PLAYER* pp, double interpfrac)
|
|||
unsigned i;
|
||||
|
||||
uint8_t pal = 0;
|
||||
double ang;
|
||||
int flags;
|
||||
|
||||
const auto offpair = pp->Angles.getWeaponOffsets(interpfrac);
|
||||
const auto offsets = offpair.first;
|
||||
const auto angle = -offpair.second.Buildfang();
|
||||
|
||||
auto list = pp->GetPanelSpriteList();
|
||||
for (auto psp = list->Next; next = psp->Next, psp != list; psp = next)
|
||||
{
|
||||
ang = angle + psp->rotate_ang;
|
||||
double ang = (offpair.second - DAngle::fromBuild(psp->rotate_ang)).Degrees();
|
||||
shade = 0;
|
||||
flags = 0;
|
||||
if (cl_hudinterpolation)
|
||||
|
|
Loading…
Reference in a new issue