- 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;
while (gChokeCounter >= COUNTRATE)
{
gChoke.at1c(gMe);
gChoke.callback(gMe);
gChokeCounter -= COUNTRATE;
}
}

View file

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

View file

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

View file

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

View file

@ -1328,7 +1328,7 @@ void trPlayerCtrlStartScene(XSPRITE* pXSource, PLAYER* pPlayer, bool force) {
if (nIndex < 0)
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.qavResrc = pQav;
@ -1337,7 +1337,7 @@ void trPlayerCtrlStartScene(XSPRITE* pXSource, PLAYER* pPlayer, bool force) {
pCtrl->qavScene.qavResrc->Preload();
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->qavLoop = false;
@ -4843,7 +4843,7 @@ void playerQavSceneDraw(PLAYER* pPlayer, int a2, double a3, double a4, int a5, i
if (pQavScene->qavResrc != NULL) {
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);
if (nInv >= 120 * 8 || (nInv != 0 && (gFrameClock & 32))) {
@ -4877,7 +4877,7 @@ void playerQavScenePlay(PLAYER* pPlayer) {
if (pQavScene->qavResrc != NULL) {
QAV* pQAV = pQavScene->qavResrc;
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);
}
}

View file

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

View file

@ -75,7 +75,7 @@ struct QAV
char pad1[8]; // 0
int nFrames; // 8
int ticksPerFrame; // C
int at10; // 10
int duration; // 10
int x; // 14
int y; // 18
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];
int v4;
if (pPlayer->weaponTimer == 0)
v4 = (gFrameClock + mulscale16(4, smoothratio)) % pQAV->at10;
v4 = (gFrameClock + mulscale16(4, smoothratio)) % pQAV->duration;
else
v4 = pQAV->at10 - pPlayer->weaponTimer;
v4 = pQAV->duration - pPlayer->weaponTimer;
pQAV->x = int(a3);
pQAV->y = int(a4);
int flags = 2;
@ -262,7 +262,7 @@ void WeaponPlay(PLAYER *pPlayer)
return;
QAV *pQAV = weaponQAV[pPlayer->weaponQav];
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);
}
@ -270,7 +270,7 @@ void StartQAV(PLAYER *pPlayer, int nWeaponQAV, int a3, char a4)
{
assert(nWeaponQAV < kQAVEnd);
pPlayer->weaponQav = nWeaponQAV;
pPlayer->weaponTimer = weaponQAV[nWeaponQAV]->at10;
pPlayer->weaponTimer = weaponQAV[nWeaponQAV]->duration;
pPlayer->qavCallback = a3;
pPlayer->qavLoop = a4;
weaponQAV[nWeaponQAV]->Preload();
@ -1977,7 +1977,7 @@ void WeaponProcess(PLAYER *pPlayer) {
if (bShoot && CheckAmmo(pPlayer, pPlayer->weaponAmmo, 1))
{
while (pPlayer->weaponTimer <= 0)
pPlayer->weaponTimer += weaponQAV[pPlayer->weaponQav]->at10;
pPlayer->weaponTimer += weaponQAV[pPlayer->weaponQav]->duration;
}
else
{