- renamed some of those annoying 'atxx' variables.

This commit is contained in:
Christoph Oelckers 2020-11-21 15:45:37 +01:00
parent 1535182577
commit fe845d7e12
8 changed files with 72 additions and 73 deletions

View file

@ -330,7 +330,7 @@ void GameInterface::Ticker()
gChokeCounter += CHOKERATE; gChokeCounter += CHOKERATE;
while (gChokeCounter >= COUNTRATE) while (gChokeCounter >= COUNTRATE)
{ {
gChoke.at1c(gMe); gChoke.callback(gMe);
gChokeCounter -= COUNTRATE; gChokeCounter -= COUNTRATE;
} }
} }

View file

@ -37,49 +37,48 @@ BEGIN_BLD_NS
void CChoke::init(int a1, void(*a2)(PLAYER*)) void CChoke::init(int a1, void(*a2)(PLAYER*))
{ {
TotalKills = NULL; TotalKills = nullptr;
at1c = a2; callback = a2;
if (!at8 && a1 != -1) if (!qav && a1 != -1)
{ {
at8 = getQAV(a1); qav = getQAV(a1);
if (!at8) if (!qav)
I_Error("Could not load QAV %d\n", a1); I_Error("Could not load QAV %d\n", a1);
at8->nSprite = -1; qav->nSprite = -1;
at8->x = at14; qav->x = x;
at8->y = at18; qav->y = y;
//at8->Preload(); duration = qav->duration;
atc = at8->at10; time = 0;
at10 = 0; }
}
} }
void CChoke::animateChoke(int x, int y, int smoothratio) void CChoke::animateChoke(int x, int y, int smoothratio)
{ {
if (!at8) if (!qav)
return; return;
int myclock = gFrameClock + mulscale16(4, smoothratio); int myclock = gFrameClock + mulscale16(4, smoothratio);
at8->x = x; qav->x = x;
at8->y = y; qav->y = y;
int vd = myclock-at10; int vd = myclock - time;
at10 = myclock; time = myclock;
atc -= vd; duration -= vd;
if (atc <= 0 || atc > at8->at10) if (duration <= 0 || duration > qav->duration)
atc = at8->at10; duration = qav->duration;
int vdi = at8->at10-atc; int vdi = qav->duration - duration;
at8->Play(vdi-vd, vdi, -1, NULL); 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. // 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 // It also never adjusted for a reduced 3D view
at8->Draw(vdi, 10, 0, 0, true); qav->Draw(vdi, 10, 0, 0, true);
} }
void sub_84230(PLAYER *pPlayer) void sub_84230(PLAYER* pPlayer)
{ {
int t = gGameOptions.nDifficulty+2; int t = gGameOptions.nDifficulty + 2;
if (pPlayer->handTime < 64) if (pPlayer->handTime < 64)
pPlayer->handTime = ClipHigh(pPlayer->handTime+t, 64); pPlayer->handTime = min(pPlayer->handTime + t, 64);
if (pPlayer->handTime > (7-gGameOptions.nDifficulty)*5) if (pPlayer->handTime > (7 - gGameOptions.nDifficulty) * 5)
pPlayer->blindEffect = ClipHigh(pPlayer->blindEffect+t*4, 128); pPlayer->blindEffect = min(pPlayer->blindEffect + t * 4, 128);
} }
CChoke gChoke; CChoke gChoke;

View file

@ -31,26 +31,26 @@ BEGIN_BLD_NS
class CChoke class CChoke
{ {
public: public:
CChoke() CChoke()
{ {
TotalKills = NULL; TotalKills = nullptr;
at8 = NULL; qav = nullptr;
atc = 0; duration = 0;
at10 = 0; time = 0;
at1c = NULL; callback = nullptr;
at14 = 0; x = 0;
at18 = 0; y = 0;
}; };
void init(int a1, void(*a2)(PLAYER*)); void init(int a1, void(*a2)(PLAYER*));
void animateChoke(int x, int y, int smoothratio); void animateChoke(int x, int y, int smoothratio);
void reset() { at10 = 0; } void reset() { time = 0; }
char *TotalKills; char* TotalKills;
QAV *at8; QAV* qav;
int atc; int duration;
int at10; int time;
int at14; int x;
int at18; int y;
void(*at1c)(PLAYER *); void(*callback)(PLAYER*);
}; };
void sub_84230(PLAYER*); void sub_84230(PLAYER*);

View file

@ -49,7 +49,7 @@ class CGameMenuItemQAV
public: public:
int m_nX, m_nY; int m_nX, m_nY;
TArray<uint8_t> raw; TArray<uint8_t> raw;
int at2c; int duration;
int lastTick; int lastTick;
bool bWideScreen; bool bWideScreen;
bool bClearBackground; bool bClearBackground;
@ -75,7 +75,7 @@ CGameMenuItemQAV::CGameMenuItemQAV(int a3, int a4, const char* name, bool widesc
data->x = m_nX; data->x = m_nX;
data->y = m_nY; data->y = m_nY;
data->Preload(); data->Preload();
at2c = data->at10; duration = data->duration;
lastTick = I_GetBuildTime(); lastTick = I_GetBuildTime();
} }
} }
@ -94,12 +94,12 @@ void CGameMenuItemQAV::Draw(void)
gFrameClock = currentclock; gFrameClock = currentclock;
int nTicks = currentclock - lastTick; int nTicks = currentclock - lastTick;
lastTick = currentclock; lastTick = currentclock;
at2c -= nTicks; duration -= nTicks;
if (at2c <= 0 || at2c > data->at10) if (duration <= 0 || duration > data->duration)
{ {
at2c = data->at10; duration = data->duration;
} }
data->Play(data->at10 - at2c - nTicks, data->at10 - at2c, -1, NULL); data->Play(data->duration - duration - nTicks, data->duration - duration, -1, NULL);
if (bWideScreen) if (bWideScreen)
{ {
@ -108,13 +108,13 @@ void CGameMenuItemQAV::Draw(void)
int backX = data->x; int backX = data->x;
for (int i = 0; i < nCount; i++) for (int i = 0; i < nCount; i++)
{ {
data->Draw(data->at10 - at2c, 10 + kQavOrientationLeft, 0, 0, false); data->Draw(data->duration - duration, 10 + kQavOrientationLeft, 0, 0, false);
data->x += 320; data->x += 320;
} }
data->x = backX; data->x = backX;
} }
else else
data->Draw(data->at10 - at2c, 10, 0, 0, false); data->Draw(data->duration - duration, 10, 0, 0, false);
gFrameClock = backFC; gFrameClock = backFC;
} }

View file

@ -1328,7 +1328,7 @@ void trPlayerCtrlStartScene(XSPRITE* pXSource, PLAYER* pPlayer, bool force) {
if (nIndex < 0) if (nIndex < 0)
WeaponLower(pPlayer); WeaponLower(pPlayer);
pXSource->sysData1 = ClipLow((pQav->at10 * pXSource->waitTime) / 4, 0); // how many times animation should be played pXSource->sysData1 = ClipLow((pQav->duration * pXSource->waitTime) / 4, 0); // how many times animation should be played
pCtrl->qavScene.index = nSource; pCtrl->qavScene.index = nSource;
pCtrl->qavScene.qavResrc = pQav; pCtrl->qavScene.qavResrc = pQav;
@ -1337,7 +1337,7 @@ void trPlayerCtrlStartScene(XSPRITE* pXSource, PLAYER* pPlayer, bool force) {
pCtrl->qavScene.qavResrc->Preload(); pCtrl->qavScene.qavResrc->Preload();
pPlayer->sceneQav = pXSource->data2; pPlayer->sceneQav = pXSource->data2;
pPlayer->weaponTimer = pCtrl->qavScene.qavResrc->at10; pPlayer->weaponTimer = pCtrl->qavScene.qavResrc->duration;
pPlayer->qavCallback = (pXSource->data3 > 0) ? ClipRange(pXSource->data3 - 1, 0, 32) : -1; pPlayer->qavCallback = (pXSource->data3 > 0) ? ClipRange(pXSource->data3 - 1, 0, 32) : -1;
pPlayer->qavLoop = false; pPlayer->qavLoop = false;
@ -4843,7 +4843,7 @@ void playerQavSceneDraw(PLAYER* pPlayer, int a2, double a3, double a4, int a5, i
if (pQavScene->qavResrc != NULL) { if (pQavScene->qavResrc != NULL) {
QAV* pQAV = pQavScene->qavResrc; QAV* pQAV = pQavScene->qavResrc;
int v4 = (pPlayer->weaponTimer == 0) ? ((gFrameClock + mulscale16(4, smoothratio)) % pQAV->at10) : pQAV->at10 - pPlayer->weaponTimer; int v4 = (pPlayer->weaponTimer == 0) ? ((gFrameClock + mulscale16(4, smoothratio)) % pQAV->duration) : pQAV->duration - pPlayer->weaponTimer;
int flags = 2; int nInv = powerupCheck(pPlayer, kPwUpShadowCloak); int flags = 2; int nInv = powerupCheck(pPlayer, kPwUpShadowCloak);
if (nInv >= 120 * 8 || (nInv != 0 && (gFrameClock & 32))) { if (nInv >= 120 * 8 || (nInv != 0 && (gFrameClock & 32))) {
@ -4877,7 +4877,7 @@ void playerQavScenePlay(PLAYER* pPlayer) {
if (pQavScene->qavResrc != NULL) { if (pQavScene->qavResrc != NULL) {
QAV* pQAV = pQavScene->qavResrc; QAV* pQAV = pQavScene->qavResrc;
pQAV->nSprite = pPlayer->pSprite->index; pQAV->nSprite = pPlayer->pSprite->index;
int nTicks = pQAV->at10 - pPlayer->weaponTimer; int nTicks = pQAV->duration - pPlayer->weaponTimer;
pQAV->Play(nTicks - 4, nTicks, pPlayer->qavCallback, pPlayer); pQAV->Play(nTicks - 4, nTicks, pPlayer->qavCallback, pPlayer);
} }
} }

View file

@ -189,7 +189,7 @@ void ByteSwapQAV(void* p)
QAV* qav = (QAV*)p; QAV* qav = (QAV*)p;
qav->nFrames = LittleLong(qav->nFrames); qav->nFrames = LittleLong(qav->nFrames);
qav->ticksPerFrame = LittleLong(qav->ticksPerFrame); qav->ticksPerFrame = LittleLong(qav->ticksPerFrame);
qav->at10 = LittleLong(qav->at10); qav->version = LittleLong(qav->version);
qav->x = LittleLong(qav->x); qav->x = LittleLong(qav->x);
qav->y = LittleLong(qav->y); qav->y = LittleLong(qav->y);
qav->nSprite = LittleLong(qav->nSprite); qav->nSprite = LittleLong(qav->nSprite);

View file

@ -75,7 +75,7 @@ struct QAV
char pad1[8]; // 0 char pad1[8]; // 0
int nFrames; // 8 int nFrames; // 8
int ticksPerFrame; // C int ticksPerFrame; // C
int at10; // 10 int duration; // 10
int x; // 14 int x; // 14
int y; // 18 int y; // 18
int nSprite; // 1c int nSprite; // 1c

View file

@ -240,9 +240,9 @@ void WeaponDraw(PLAYER *pPlayer, int a2, double a3, double a4, int a5, int smoot
QAV * pQAV = weaponQAV[pPlayer->weaponQav]; QAV * pQAV = weaponQAV[pPlayer->weaponQav];
int v4; int v4;
if (pPlayer->weaponTimer == 0) if (pPlayer->weaponTimer == 0)
v4 = (gFrameClock + mulscale16(4, smoothratio)) % pQAV->at10; v4 = (gFrameClock + mulscale16(4, smoothratio)) % pQAV->duration;
else else
v4 = pQAV->at10 - pPlayer->weaponTimer; v4 = pQAV->duration - pPlayer->weaponTimer;
pQAV->x = int(a3); pQAV->x = int(a3);
pQAV->y = int(a4); pQAV->y = int(a4);
int flags = 2; int flags = 2;
@ -262,7 +262,7 @@ void WeaponPlay(PLAYER *pPlayer)
return; return;
QAV *pQAV = weaponQAV[pPlayer->weaponQav]; QAV *pQAV = weaponQAV[pPlayer->weaponQav];
pQAV->nSprite = pPlayer->pSprite->index; pQAV->nSprite = pPlayer->pSprite->index;
int nTicks = pQAV->at10 - pPlayer->weaponTimer; int nTicks = pQAV->duration - pPlayer->weaponTimer;
pQAV->Play(nTicks-4, nTicks, pPlayer->qavCallback, pPlayer); pQAV->Play(nTicks-4, nTicks, pPlayer->qavCallback, pPlayer);
} }
@ -270,7 +270,7 @@ void StartQAV(PLAYER *pPlayer, int nWeaponQAV, int a3, char a4)
{ {
assert(nWeaponQAV < kQAVEnd); assert(nWeaponQAV < kQAVEnd);
pPlayer->weaponQav = nWeaponQAV; pPlayer->weaponQav = nWeaponQAV;
pPlayer->weaponTimer = weaponQAV[nWeaponQAV]->at10; pPlayer->weaponTimer = weaponQAV[nWeaponQAV]->duration;
pPlayer->qavCallback = a3; pPlayer->qavCallback = a3;
pPlayer->qavLoop = a4; pPlayer->qavLoop = a4;
weaponQAV[nWeaponQAV]->Preload(); weaponQAV[nWeaponQAV]->Preload();
@ -1977,7 +1977,7 @@ void WeaponProcess(PLAYER *pPlayer) {
if (bShoot && CheckAmmo(pPlayer, pPlayer->weaponAmmo, 1)) if (bShoot && CheckAmmo(pPlayer, pPlayer->weaponAmmo, 1))
{ {
while (pPlayer->weaponTimer <= 0) while (pPlayer->weaponTimer <= 0)
pPlayer->weaponTimer += weaponQAV[pPlayer->weaponQav]->at10; pPlayer->weaponTimer += weaponQAV[pPlayer->weaponQav]->duration;
} }
else else
{ {