mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-20 18:52:43 +00:00
- Blood: Utilise new weapon drawing offsets from the backend.
This commit is contained in:
parent
0741570ba9
commit
f524abdf47
10 changed files with 28 additions and 32 deletions
|
@ -72,7 +72,7 @@ void CChoke::animateChoke(int x, int y, double interpfrac)
|
|||
qav->Play(vdi - vd, vdi, -1, nullptr);
|
||||
// This originally overlaid the HUD but that simply doesn't work right with the HUD being a genuine overlay.
|
||||
// It also never adjusted for a reduced 3D view
|
||||
qav->Draw(vdi, 10, 0, 0, true);
|
||||
qav->Draw(vdi, 10, 0, 0, true, interpfrac);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -104,32 +104,28 @@ static void viewBurnTime(int gScale)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void hudDraw(PLAYER* pPlayer, sectortype* pSector, double bobx, double boby, double zDelta, int basepal, double interpfrac)
|
||||
void hudDraw(PLAYER* pPlayer, sectortype* pSector, double bobx, double boby, double zDelta, DAngle angle, int basepal, double interpfrac)
|
||||
{
|
||||
double look_anghalf = pPlayer->angle.look_anghalf(interpfrac);
|
||||
|
||||
if (gViewPos == 0)
|
||||
{
|
||||
double looking_arc = pPlayer->angle.looking_arc(interpfrac);
|
||||
auto cXY = DVector2(160, 220) + pPlayer->angle.weaponoffsets(interpfrac);
|
||||
|
||||
double cX = 160 - look_anghalf;
|
||||
double cY = 220 + looking_arc;
|
||||
if (cl_weaponsway)
|
||||
{
|
||||
if (cl_hudinterpolation)
|
||||
{
|
||||
cX += bobx;
|
||||
cY += boby + (zDelta * 2.);
|
||||
cXY.X += bobx;
|
||||
cXY.Y += boby + (zDelta * 2.);
|
||||
}
|
||||
else
|
||||
{
|
||||
cX += int(bobx);
|
||||
cY += int(boby) + int(zDelta * 2);
|
||||
cXY.X += int(bobx);
|
||||
cXY.Y += int(boby) + int(zDelta * 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cY += (-2048. / 128.);
|
||||
cXY.Y += (-2048. / 128.);
|
||||
}
|
||||
int nShade = pSector? pSector->floorshade : 0;
|
||||
int nPalette = 0;
|
||||
|
@ -141,8 +137,8 @@ void hudDraw(PLAYER* pPlayer, sectortype* pSector, double bobx, double boby, dou
|
|||
}
|
||||
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
if (pPlayer->sceneQav < 0) WeaponDraw(pPlayer, nShade, cX, cY, nPalette);
|
||||
else if (pPlayer->actor->xspr.health > 0) playerQavSceneDraw(pPlayer, nShade, cX, cY, nPalette);
|
||||
if (pPlayer->sceneQav < 0) WeaponDraw(pPlayer, nShade, cXY.X, cXY.Y, nPalette, angle);
|
||||
else if (pPlayer->actor->xspr.health > 0) playerQavSceneDraw(pPlayer, nShade, cXY.X, cXY.Y, nPalette, angle);
|
||||
else {
|
||||
pPlayer->sceneQav = pPlayer->weaponQav = kQAVNone;
|
||||
pPlayer->qavTimer = pPlayer->weaponTimer = pPlayer->curWeapon = 0;
|
||||
|
|
|
@ -49,7 +49,7 @@ struct PLAYER;
|
|||
|
||||
bool checkLitSprayOrTNT(PLAYER* pPlayer);
|
||||
void WeaponInit(void);
|
||||
void WeaponDraw(PLAYER* pPlayer, int a2, double a3, double a4, int a5);
|
||||
void WeaponDraw(PLAYER* pPlayer, int shade, double xpos, double ypos, int palnum, DAngle angle);
|
||||
void WeaponRaise(PLAYER* pPlayer);
|
||||
void WeaponLower(PLAYER* pPlayer);
|
||||
int WeaponUpgrade(PLAYER* pPlayer, int newWeapon);
|
||||
|
|
|
@ -7293,7 +7293,7 @@ void playerQavSceneProcess(PLAYER* pPlayer, QAVSCENE* pQavScene)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void playerQavSceneDraw(PLAYER* pPlayer, int a2, double a3, double a4, int a5)
|
||||
void playerQavSceneDraw(PLAYER* pPlayer, int shade, double xpos, double ypos, int palnum, DAngle angle)
|
||||
{
|
||||
if (pPlayer == NULL || pPlayer->sceneQav == -1) return;
|
||||
|
||||
|
@ -7303,22 +7303,22 @@ void playerQavSceneDraw(PLAYER* pPlayer, int a2, double a3, double a4, int a5)
|
|||
if (pQavScene->qavResrc != NULL)
|
||||
{
|
||||
QAV* pQAV = pQavScene->qavResrc;
|
||||
int v4;
|
||||
int duration;
|
||||
double interpfrac;
|
||||
|
||||
qavProcessTimer(pPlayer, pQAV, &v4, &interpfrac);
|
||||
qavProcessTimer(pPlayer, pQAV, &duration, &interpfrac);
|
||||
|
||||
int flags = 2; int nInv = powerupCheck(pPlayer, kPwUpShadowCloak);
|
||||
if (nInv >= 120 * 8 || (nInv != 0 && (PlayClock & 32)))
|
||||
{
|
||||
a2 = -128; flags |= 1;
|
||||
shade = -128; flags |= 1;
|
||||
}
|
||||
|
||||
// draw as weapon
|
||||
if (!(actor->spr.flags & kModernTypeFlag1))
|
||||
{
|
||||
pQAV->x = a3; pQAV->y = a4;
|
||||
pQAV->Draw(v4, flags, a2, a5, true, interpfrac);
|
||||
pQAV->x = xpos; pQAV->y = ypos;
|
||||
pQAV->Draw(duration, flags, shade, palnum, true, interpfrac, angle);
|
||||
|
||||
// draw fullscreen (currently 4:3 only)
|
||||
}
|
||||
|
@ -7326,7 +7326,7 @@ void playerQavSceneDraw(PLAYER* pPlayer, int a2, double a3, double a4, int a5)
|
|||
{
|
||||
// What an awful hack. This throws proper ordering out of the window, but there is no way to reproduce this better with strict layering of elements.
|
||||
// From the above commit it seems to be incomplete anyway...
|
||||
pQAV->Draw(v4, flags, a2, a5, false, interpfrac);
|
||||
pQAV->Draw(duration, flags, shade, palnum, false, interpfrac, angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -347,7 +347,7 @@ void playerDeactivateShrooms(PLAYER* pPlayer);
|
|||
QAV* playerQavSceneLoad(int qavId);
|
||||
void playerQavSceneProcess(PLAYER* pPlayer, QAVSCENE* pQavScene);
|
||||
void playerQavScenePlay(PLAYER* pPlayer);
|
||||
void playerQavSceneDraw(PLAYER* pPlayer, int a2, double a3, double a4, int a5);
|
||||
void playerQavSceneDraw(PLAYER* pPlayer, int shade, double xpos, double ypos, int palnum, DAngle angle);
|
||||
void playerQavSceneReset(PLAYER* pPlayer);
|
||||
// ------------------------------------------------------------------------- //
|
||||
void callbackUniMissileBurst(DBloodActor* actor, sectortype* nSprite);
|
||||
|
|
|
@ -163,7 +163,7 @@ void DrawFrame(double x, double y, double z, double a, double alpha, int picnum,
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void QAV::Draw(int ticks, int stat, int shade, int palnum, bool to3dview, double const interpfrac)
|
||||
void QAV::Draw(int ticks, int stat, int shade, int palnum, bool to3dview, double const interpfrac, DAngle angle)
|
||||
{
|
||||
assert(ticksPerFrame > 0);
|
||||
|
||||
|
@ -201,7 +201,7 @@ void QAV::Draw(int ticks, int stat, int shade, int palnum, bool to3dview, double
|
|||
tileY = interpolatedvalue<double>(prevTile->y, thisTile->y, interpfrac);
|
||||
tileZ = interpolatedvalue<double>(prevTile->z, thisTile->z, interpfrac);
|
||||
tileA = interpolatedvalue(prevTile->angle, thisTile->angle, interpfrac);
|
||||
tileShade = (int)interpolatedvalue<double>(prevTile->shade, thisTile->shade, interpfrac) + shade;
|
||||
tileShade = (int)interpolatedvalue<double>(prevTile->shade, thisTile->shade, interpfrac);
|
||||
tileAlpha = interpolatedvalue(prevAlpha, thisAlpha, interpfrac);
|
||||
}
|
||||
else
|
||||
|
@ -210,11 +210,11 @@ void QAV::Draw(int ticks, int stat, int shade, int palnum, bool to3dview, double
|
|||
tileY = thisTile->y;
|
||||
tileZ = thisTile->z;
|
||||
tileA = thisTile->angle;
|
||||
tileShade = thisTile->shade + shade;
|
||||
tileShade = thisTile->shade;
|
||||
tileAlpha = (tileStat & RS_TRANS1) ? glblend[0].def[!!(tileStat & RS_TRANS2)].alpha : 1.f;
|
||||
}
|
||||
|
||||
DrawFrame(tileX + x, tileY + y, tileZ, tileA.Buildfang(), tileAlpha, thisTile->picnum, tileStat, tileShade, (palnum <= 0 ? thisTile->palnum : palnum), to3dview);
|
||||
DrawFrame(tileX + x, tileY + y, tileZ, (tileA + angle).Buildfang(), tileAlpha, thisTile->picnum, tileStat, tileShade + shade, (palnum <= 0 ? thisTile->palnum : palnum), to3dview);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -229,7 +229,7 @@ struct QAV
|
|||
double y; // 18
|
||||
uint16_t res_id;
|
||||
FRAMEINFO frames[1]; // 24
|
||||
void Draw(int ticks, int stat, int shade, int palnum, bool to3dview, double const interpfrac = 1.);
|
||||
void Draw(int ticks, int stat, int shade, int palnum, bool to3dview, double const interpfrac, DAngle angle = nullAngle);
|
||||
void Play(int, int, int, PLAYER*);
|
||||
void Precache(int palette = 0);
|
||||
};
|
||||
|
|
|
@ -734,7 +734,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
}
|
||||
}
|
||||
|
||||
if (!sceneonly) hudDraw(pPlayer, pSector, shakeX, shakeY, zDelta, basepal, interpfrac);
|
||||
if (!sceneonly) hudDraw(pPlayer, pSector, shakeX, shakeY, zDelta, rotscrnang, basepal, interpfrac);
|
||||
DAngle deliriumPitchI = interpolatedvalue(maphoriz(deliriumPitchO), maphoriz(deliriumPitch), interpfrac);
|
||||
auto bakCstat = pPlayer->actor->spr.cstat;
|
||||
pPlayer->actor->spr.cstat |= (gViewPos == 0) ? CSTAT_SPRITE_INVISIBLE : CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_TRANS_FLIP;
|
||||
|
|
|
@ -92,7 +92,7 @@ extern DAngle gScreenTiltO, gScreenTilt;
|
|||
extern int gShowFrameRate;
|
||||
extern int gLastPal;
|
||||
|
||||
void hudDraw(PLAYER* pPlayer, sectortype* pSector, double bobx, double boby, double zDelta, int basepal, double interpfrac);
|
||||
void hudDraw(PLAYER* pPlayer, sectortype* pSector, double bobx, double boby, double zDelta, DAngle angle, int basepal, double interpfrac);
|
||||
void viewInitializePrediction(void);
|
||||
void viewUpdatePrediction(InputPacket* pInput);
|
||||
void viewCorrectPrediction(void);
|
||||
|
|
|
@ -328,7 +328,7 @@ void WeaponPrecache()
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void WeaponDraw(PLAYER* pPlayer, int shade, double xpos, double ypos, int palnum)
|
||||
void WeaponDraw(PLAYER* pPlayer, int shade, double xpos, double ypos, int palnum, DAngle angle)
|
||||
{
|
||||
assert(pPlayer != NULL);
|
||||
if (pPlayer->weaponQav == kQAVNone)
|
||||
|
@ -348,7 +348,7 @@ void WeaponDraw(PLAYER* pPlayer, int shade, double xpos, double ypos, int palnum
|
|||
shade = -128;
|
||||
flags |= 1;
|
||||
}
|
||||
pQAV->Draw(duration, flags, shade, palnum, true, interpfrac);
|
||||
pQAV->Draw(duration, flags, shade, palnum, true, interpfrac, angle);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue