- use all available precision to render Blood's weapon animations mpre smoothly, instead of throwing it away by needlessly storing it in some integer fields.

This commit is contained in:
Christoph Oelckers 2020-08-03 00:25:40 +02:00
parent be9402c4e0
commit 8a31e96602
7 changed files with 20 additions and 14 deletions

View file

@ -106,9 +106,8 @@ void hudDraw(PLAYER *gView, int nSectnum, int defaultHoriz, int bobx, int boby,
DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, crosshair_scale, DTA_ScaleY, crosshair_scale, DTA_CenterOffsetRel, true,
DTA_ViewportX, windowxy1.x, DTA_ViewportY, windowxy1.y, DTA_ViewportWidth, windowxy2.x - windowxy1.x + 1, DTA_ViewportHeight, windowxy2.y - windowxy1.y + 1, TAG_DONE);
}
// This is dumb. Todo: Preserve full precision here!
int cX = (bobx >> 8) + 160;
int cY = (boby >> 8) + 220 + (zDelta >> 7);
double cX = (bobx / 256.) + 160;
double cY = (boby / 256.) + 220 + (zDelta / 128.);
int nShade = sector[nSectnum].floorshade;
int nPalette = 0;
if (sector[gView->pSprite->sectnum].extra > 0) {

View file

@ -52,7 +52,7 @@ struct PLAYER;
extern QAV* weaponQAV[];
void WeaponInit(void);
void WeaponDraw(PLAYER *pPlayer, int a2, int a3, int a4, int a5, int basepal);
void WeaponDraw(PLAYER *pPlayer, int a2, double a3, double a4, int a5, int basepal);
void WeaponRaise(PLAYER *pPlayer);
void WeaponLower(PLAYER *pPlayer);
char WeaponUpgrade(PLAYER *pPlayer, char newWeapon);

View file

@ -4793,7 +4793,7 @@ void playerQavSceneProcess(PLAYER* pPlayer, QAVSCENE* pQavScene) {
}
}
void playerQavSceneDraw(PLAYER* pPlayer, int a2, int a3, int a4, int a5, int basepal) {
void playerQavSceneDraw(PLAYER* pPlayer, int a2, double a3, double a4, int a5, int basepal) {
if (pPlayer == NULL || pPlayer->sceneQav == -1) return;
QAVSCENE* pQavScene = &gPlayerCtrl[pPlayer->nPlayer].qavScene;
@ -4812,8 +4812,8 @@ void playerQavSceneDraw(PLAYER* pPlayer, int a2, int a3, int a4, int a5, int bas
// draw as weapon
if (!(pSprite->flags & kModernTypeFlag1)) {
pQAV->x = a3; pQAV->y = a4;
pQAV->Draw(&twodpsp, v4, flags, a2, a5, basepal, true);
pQAV->x = int(a3); pQAV->y = int(a4);
pQAV->Draw(&twodpsp, a3, a4, v4, flags, a2, a5, basepal, true);
// draw fullscreen (currently 4:3 only)
} else {

View file

@ -314,7 +314,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, int a3, int a4, int a5, int basepal);
void playerQavSceneDraw(PLAYER* pPlayer, int a2, double a3, double a4, int a5, int basepal);
void playerQavSceneReset(PLAYER* pPlayer);
// ------------------------------------------------------------------------- //
void callbackUniMissileBurst(int nSprite);

View file

@ -45,7 +45,7 @@ int qavRegisterClient(void(*pClient)(int, void *))
return nClients++;
}
void DrawFrame(F2DDrawer *twod, int x, int y, TILE_FRAME *pTile, int stat, int shade, int palnum, int basepal, bool to3dview)
void DrawFrame(F2DDrawer *twod, double x, double y, TILE_FRAME *pTile, int stat, int shade, int palnum, int basepal, bool to3dview)
{
stat |= pTile->stat;
x += pTile->x;
@ -78,7 +78,7 @@ void DrawFrame(F2DDrawer *twod, int x, int y, TILE_FRAME *pTile, int stat, int s
}
}
void QAV::Draw(F2DDrawer* twod, int ticks, int stat, int shade, int palnum, int basepal, bool to3dview)
void QAV::Draw(F2DDrawer* twod, double x, double y, int ticks, int stat, int shade, int palnum, int basepal, bool to3dview)
{
dassert(ticksPerFrame > 0);
int nFrame = ticks / ticksPerFrame;
@ -91,6 +91,12 @@ void QAV::Draw(F2DDrawer* twod, int ticks, int stat, int shade, int palnum, int
}
}
void QAV::Draw(F2DDrawer* twod, int ticks, int stat, int shade, int palnum, int basepal, bool to3dview)
{
Draw(twod, x, y, ticks, stat, shade, palnum, basepal, to3dview);
}
void QAV::Play(int start, int end, int nCallback, void *pData)
{
dassert(ticksPerFrame > 0);

View file

@ -82,6 +82,7 @@ struct QAV
char pad3[4]; // 20
FRAMEINFO frames[1]; // 24
void Draw(F2DDrawer *twod, int ticks, int stat, int shade, int palnum, int basepal, bool inviewport);
void Draw(F2DDrawer* twod, double x, double y, int ticks, int stat, int shade, int palnum, int basepal, bool inviewport);
void Play(int, int, int, void *);
void Preload(void);
void Precache(void);

View file

@ -232,7 +232,7 @@ void WeaponPrecache(void)
}
}
void WeaponDraw(PLAYER *pPlayer, int a2, int a3, int a4, int a5, int basepal)
void WeaponDraw(PLAYER *pPlayer, int a2, double a3, double a4, int a5, int basepal)
{
dassert(pPlayer != NULL);
if (pPlayer->weaponQav == -1)
@ -243,8 +243,8 @@ void WeaponDraw(PLAYER *pPlayer, int a2, int a3, int a4, int a5, int basepal)
v4 = (int)totalclock % pQAV->at10;
else
v4 = pQAV->at10 - pPlayer->weaponTimer;
pQAV->x = a3;
pQAV->y = a4;
pQAV->x = int(a3);
pQAV->y = int(a4);
int flags = 2;
int nInv = powerupCheck(pPlayer, kPwUpShadowCloak);
if (nInv >= 120 * 8 || (nInv != 0 && ((int)totalclock & 32)))
@ -252,7 +252,7 @@ void WeaponDraw(PLAYER *pPlayer, int a2, int a3, int a4, int a5, int basepal)
a2 = -128;
flags |= 1;
}
pQAV->Draw(&twodpsp, v4, flags, a2, a5, basepal, true);
pQAV->Draw(&twodpsp, a3, a4, v4, flags, a2, a5, basepal, true);
}
void WeaponPlay(PLAYER *pPlayer)