mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 04:00:42 +00:00
- Blood: Add SetQAV()
static function to abstract away from directly setting the player's weaponQav
variable to allow us to properly reset the framerate QAV timer values to 0 as well.
This commit is contained in:
parent
3c09f41b43
commit
726edc199e
2 changed files with 39 additions and 31 deletions
|
@ -294,7 +294,7 @@ void qavProcessTimer(PLAYER* const pPlayer, QAV* const pQAV, int* duration, doub
|
||||||
// Process clock based on QAV's ticrate and last tick value.
|
// Process clock based on QAV's ticrate and last tick value.
|
||||||
qavProcessTicker(pQAV, &pPlayer->qavTimer, &pPlayer->qavLastTick);
|
qavProcessTicker(pQAV, &pPlayer->qavTimer, &pPlayer->qavLastTick);
|
||||||
|
|
||||||
if (pPlayer->weaponTimer == 0 && !ignoreWeaponTimer)
|
if (pPlayer->weaponTimer == 0 && pPlayer->qavTimer == 0 && !ignoreWeaponTimer)
|
||||||
{
|
{
|
||||||
// Check if we're playing an idle QAV as per the ticker's weapon timer.
|
// Check if we're playing an idle QAV as per the ticker's weapon timer.
|
||||||
*duration = fixedduration ? pQAV->duration - 1 : I_GetBuildTime() % pQAV->duration;
|
*duration = fixedduration ? pQAV->duration - 1 : I_GetBuildTime() % pQAV->duration;
|
||||||
|
|
|
@ -297,6 +297,14 @@ static void StartQAV(PLAYER *pPlayer, int nWeaponQAV, int callback = -1, bool lo
|
||||||
pPlayer->weaponTimer -= 4;
|
pPlayer->weaponTimer -= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void SetQAV(PLAYER *pPlayer, int nWeaponQAV)
|
||||||
|
{
|
||||||
|
assert(nWeaponQAV < kQAVEnd);
|
||||||
|
pPlayer->weaponQav = qavGetCorrectID(nWeaponQAV);
|
||||||
|
pPlayer->qavTimer = 0;
|
||||||
|
pPlayer->qavLastTick = 0;
|
||||||
|
}
|
||||||
|
|
||||||
struct WEAPONTRACK
|
struct WEAPONTRACK
|
||||||
{
|
{
|
||||||
int aimSpeedHorz;
|
int aimSpeedHorz;
|
||||||
|
@ -833,7 +841,7 @@ void WeaponUpdateState(PLAYER *pPlayer)
|
||||||
switch (lastWeapon)
|
switch (lastWeapon)
|
||||||
{
|
{
|
||||||
case kWeapPitchFork:
|
case kWeapPitchFork:
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVFORKIDLE);
|
SetQAV(pPlayer, kQAVFORKIDLE);
|
||||||
break;
|
break;
|
||||||
case kWeapSpraycan:
|
case kWeapSpraycan:
|
||||||
switch (vb)
|
switch (vb)
|
||||||
|
@ -849,15 +857,15 @@ void WeaponUpdateState(PLAYER *pPlayer)
|
||||||
StartQAV(pPlayer, kQAVCANPREF);
|
StartQAV(pPlayer, kQAVCANPREF);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVLITEIDLE);
|
SetQAV(pPlayer, kQAVLITEIDLE);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVCANIDLE);
|
SetQAV(pPlayer, kQAVCANIDLE);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if (CheckAmmo(pPlayer, 6, 1))
|
if (CheckAmmo(pPlayer, 6, 1))
|
||||||
{
|
{
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVCANIDLE);
|
SetQAV(pPlayer, kQAVCANIDLE);
|
||||||
pPlayer->weaponState = 3;
|
pPlayer->weaponState = 3;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -890,10 +898,10 @@ void WeaponUpdateState(PLAYER *pPlayer)
|
||||||
StartQAV(pPlayer, kQAVBUNUP);
|
StartQAV(pPlayer, kQAVBUNUP);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVLITEIDLE);
|
SetQAV(pPlayer, kQAVLITEIDLE);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVBUNIDLE);
|
SetQAV(pPlayer, kQAVBUNIDLE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -901,7 +909,7 @@ void WeaponUpdateState(PLAYER *pPlayer)
|
||||||
switch (vb)
|
switch (vb)
|
||||||
{
|
{
|
||||||
case 7:
|
case 7:
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVPROXIDLE);
|
SetQAV(pPlayer, kQAVPROXIDLE);
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
pPlayer->weaponState = 7;
|
pPlayer->weaponState = 7;
|
||||||
|
@ -913,10 +921,10 @@ void WeaponUpdateState(PLAYER *pPlayer)
|
||||||
switch (vb)
|
switch (vb)
|
||||||
{
|
{
|
||||||
case 10:
|
case 10:
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVREMIDLE1);
|
SetQAV(pPlayer, kQAVREMIDLE1);
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVREMIDLE2);
|
SetQAV(pPlayer, kQAVREMIDLE2);
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
if (pPlayer->ammoCount[11] > 0)
|
if (pPlayer->ammoCount[11] > 0)
|
||||||
|
@ -939,7 +947,7 @@ void WeaponUpdateState(PLAYER *pPlayer)
|
||||||
pPlayer->weaponState = 1;
|
pPlayer->weaponState = 1;
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAV2SHOTI);
|
SetQAV(pPlayer, kQAV2SHOTI);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (CheckAmmo(pPlayer, 2, 1))
|
if (CheckAmmo(pPlayer, 2, 1))
|
||||||
|
@ -952,25 +960,25 @@ void WeaponUpdateState(PLAYER *pPlayer)
|
||||||
pPlayer->weaponState = 2;
|
pPlayer->weaponState = 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVSHOTI3);
|
SetQAV(pPlayer, kQAVSHOTI3);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVSHOTI2);
|
SetQAV(pPlayer, kQAVSHOTI2);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVSHOTI1);
|
SetQAV(pPlayer, kQAVSHOTI1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case kWeapTommyGun:
|
case kWeapTommyGun:
|
||||||
if (powerupCheck(pPlayer, kPwUpTwoGuns) && checkAmmo2(pPlayer, 3, 2))
|
if (powerupCheck(pPlayer, kPwUpTwoGuns) && checkAmmo2(pPlayer, 3, 2))
|
||||||
{
|
{
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAV2TOMIDLE);
|
SetQAV(pPlayer, kQAV2TOMIDLE);
|
||||||
pPlayer->weaponState = 1;
|
pPlayer->weaponState = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVTOMIDLE);
|
SetQAV(pPlayer, kQAVTOMIDLE);
|
||||||
pPlayer->weaponState = 0;
|
pPlayer->weaponState = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -978,33 +986,33 @@ void WeaponUpdateState(PLAYER *pPlayer)
|
||||||
if (powerupCheck(pPlayer, kPwUpTwoGuns))
|
if (powerupCheck(pPlayer, kPwUpTwoGuns))
|
||||||
{
|
{
|
||||||
if (vb == 3 && checkAmmo2(pPlayer, 1, 2))
|
if (vb == 3 && checkAmmo2(pPlayer, 1, 2))
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVFLAR2I);
|
SetQAV(pPlayer, kQAVFLAR2I);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVFLARIDLE);
|
SetQAV(pPlayer, kQAVFLARIDLE);
|
||||||
pPlayer->weaponState = 2;
|
pPlayer->weaponState = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVFLARIDLE);
|
SetQAV(pPlayer, kQAVFLARIDLE);
|
||||||
break;
|
break;
|
||||||
case kWeapVoodooDoll:
|
case kWeapVoodooDoll:
|
||||||
if (pXSprite->height < 256 && pPlayer->swayHeight != 0)
|
if (pXSprite->height < 256 && pPlayer->swayHeight != 0)
|
||||||
StartQAV(pPlayer, kQAVVDIDLE2);
|
StartQAV(pPlayer, kQAVVDIDLE2);
|
||||||
else
|
else
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVVDIDLE1);
|
SetQAV(pPlayer, kQAVVDIDLE1);
|
||||||
break;
|
break;
|
||||||
case kWeapTeslaCannon:
|
case kWeapTeslaCannon:
|
||||||
switch (vb)
|
switch (vb)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
if (checkAmmo2(pPlayer, 7, 10) && powerupCheck(pPlayer, kPwUpTwoGuns))
|
if (checkAmmo2(pPlayer, 7, 10) && powerupCheck(pPlayer, kPwUpTwoGuns))
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAV2SGUNIDL);
|
SetQAV(pPlayer, kQAV2SGUNIDL);
|
||||||
else
|
else
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVSGUNIDL1);
|
SetQAV(pPlayer, kQAVSGUNIDL1);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVSGUNIDL2);
|
SetQAV(pPlayer, kQAVSGUNIDL2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1013,12 +1021,12 @@ void WeaponUpdateState(PLAYER *pPlayer)
|
||||||
{
|
{
|
||||||
case 3:
|
case 3:
|
||||||
if (powerupCheck(pPlayer, kPwUpTwoGuns) && (gInfiniteAmmo || CheckAmmo(pPlayer,4, 4)))
|
if (powerupCheck(pPlayer, kPwUpTwoGuns) && (gInfiniteAmmo || CheckAmmo(pPlayer,4, 4)))
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAV2NAPIDLE);
|
SetQAV(pPlayer, kQAV2NAPIDLE);
|
||||||
else
|
else
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVNAPIDLE);
|
SetQAV(pPlayer, kQAVNAPIDLE);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVNAPIDLE);
|
SetQAV(pPlayer, kQAVNAPIDLE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1026,12 +1034,12 @@ void WeaponUpdateState(PLAYER *pPlayer)
|
||||||
switch (vb)
|
switch (vb)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVSTAFIDL1);
|
SetQAV(pPlayer, kQAVSTAFIDL1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case kWeapBeast:
|
case kWeapBeast:
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVBSTIDLE);
|
SetQAV(pPlayer, kQAVBSTIDLE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1586,7 +1594,7 @@ void FireTesla(int nTrigger, PLAYER *pPlayer)
|
||||||
if (!checkAmmo2(pPlayer, 7, pMissile->ammouse))
|
if (!checkAmmo2(pPlayer, 7, pMissile->ammouse))
|
||||||
{
|
{
|
||||||
pPlayer->weaponState = -1;
|
pPlayer->weaponState = -1;
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVSGUNIDL2);
|
SetQAV(pPlayer, kQAVSGUNIDL2);
|
||||||
pPlayer->flashEffect = 0;
|
pPlayer->flashEffect = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2355,7 +2363,7 @@ void WeaponProcess(PLAYER *pPlayer) {
|
||||||
switch (pPlayer->weaponState)
|
switch (pPlayer->weaponState)
|
||||||
{
|
{
|
||||||
case 7:
|
case 7:
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVPROXIDLE);
|
SetQAV(pPlayer, kQAVPROXIDLE);
|
||||||
pPlayer->weaponState = 9;
|
pPlayer->weaponState = 9;
|
||||||
pPlayer->throwTime = PlayClock;
|
pPlayer->throwTime = PlayClock;
|
||||||
return;
|
return;
|
||||||
|
@ -2365,7 +2373,7 @@ void WeaponProcess(PLAYER *pPlayer) {
|
||||||
switch (pPlayer->weaponState)
|
switch (pPlayer->weaponState)
|
||||||
{
|
{
|
||||||
case 10:
|
case 10:
|
||||||
pPlayer->weaponQav = qavGetCorrectID(kQAVREMIDLE1);
|
SetQAV(pPlayer, kQAVREMIDLE1);
|
||||||
pPlayer->weaponState = 13;
|
pPlayer->weaponState = 13;
|
||||||
pPlayer->throwTime = PlayClock;
|
pPlayer->throwTime = PlayClock;
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue