- Blood: Replace all numerical constants for player's weaponQav with enum values.

This commit is contained in:
Mitchell Richters 2021-08-03 20:34:08 +10:00
parent cd5e01818a
commit 6a2a0da819
4 changed files with 39 additions and 37 deletions

View file

@ -130,7 +130,7 @@ void hudDraw(PLAYER *gView, int nSectnum, double bobx, double boby, double zDelt
if (gView->sceneQav < 0) WeaponDraw(gView, nShade, cX, cY, nPalette); if (gView->sceneQav < 0) WeaponDraw(gView, nShade, cX, cY, nPalette);
else if (gView->pXSprite->health > 0) playerQavSceneDraw(gView, nShade, cX, cY, nPalette); else if (gView->pXSprite->health > 0) playerQavSceneDraw(gView, nShade, cX, cY, nPalette);
else { else {
gView->sceneQav = gView->weaponQav = -1; gView->sceneQav = gView->weaponQav = kQAVNone;
gView->qavTimer = gView->weaponTimer = gView->curWeapon = 0; gView->qavTimer = gView->weaponTimer = gView->curWeapon = 0;
} }
#else #else

View file

@ -739,7 +739,7 @@ void playerStart(int nPlayer, int bNewLevel)
pPlayer->handTime = 0; pPlayer->handTime = 0;
pPlayer->weaponTimer = 0; pPlayer->weaponTimer = 0;
pPlayer->weaponState = 0; pPlayer->weaponState = 0;
pPlayer->weaponQav = -1; pPlayer->weaponQav = kQAVNone;
pPlayer->qavLastTick = 0; pPlayer->qavLastTick = 0;
pPlayer->qavTimer = 0; pPlayer->qavTimer = 0;
#ifdef NOONE_EXTENSIONS #ifdef NOONE_EXTENSIONS
@ -813,7 +813,7 @@ void playerReset(PLAYER *pPlayer)
pPlayer->armor[i] = 0; pPlayer->armor[i] = 0;
pPlayer->weaponTimer = 0; pPlayer->weaponTimer = 0;
pPlayer->weaponState = 0; pPlayer->weaponState = 0;
pPlayer->weaponQav = -1; pPlayer->weaponQav = kQAVNone;
pPlayer->qavLoop = 0; pPlayer->qavLoop = 0;
pPlayer->qavLastTick = 0; pPlayer->qavLastTick = 0;
pPlayer->qavTimer = 0; pPlayer->qavTimer = 0;

View file

@ -31,6 +31,8 @@ enum { kQavOrientationLeft = 4096 };
enum enum
{ {
kQAVNone = -1,
kQAVFORKUP = 0, kQAVFORKUP = 0,
kQAVFORKIDLE = 1, kQAVFORKIDLE = 1,
kQAVPFORK = 2, kQAVPFORK = 2,

View file

@ -258,7 +258,7 @@ bool isOriginalQAV()
void WeaponDraw(PLAYER *pPlayer, int shade, double xpos, double ypos, int palnum) void WeaponDraw(PLAYER *pPlayer, int shade, double xpos, double ypos, int palnum)
{ {
assert(pPlayer != NULL); assert(pPlayer != NULL);
if (pPlayer->weaponQav == -1) if (pPlayer->weaponQav == kQAVNone)
return; return;
QAV * pQAV = weaponQAV[pPlayer->weaponQav]; QAV * pQAV = weaponQAV[pPlayer->weaponQav];
int duration; int duration;
@ -281,7 +281,7 @@ void WeaponDraw(PLAYER *pPlayer, int shade, double xpos, double ypos, int palnum
void WeaponPlay(PLAYER *pPlayer) void WeaponPlay(PLAYER *pPlayer)
{ {
assert(pPlayer != NULL); assert(pPlayer != NULL);
if (pPlayer->weaponQav == -1) if (pPlayer->weaponQav == kQAVNone)
return; return;
QAV *pQAV = weaponQAV[pPlayer->weaponQav]; QAV *pQAV = weaponQAV[pPlayer->weaponQav];
pQAV->nSprite = pPlayer->pSprite->index; pQAV->nSprite = pPlayer->pSprite->index;
@ -839,7 +839,7 @@ void WeaponUpdateState(PLAYER *pPlayer)
switch (lastWeapon) switch (lastWeapon)
{ {
case kWeapPitchFork: case kWeapPitchFork:
pPlayer->weaponQav = 1; pPlayer->weaponQav = kQAVFORKIDLE;
break; break;
case kWeapSpraycan: case kWeapSpraycan:
switch (vb) switch (vb)
@ -855,15 +855,15 @@ void WeaponUpdateState(PLAYER *pPlayer)
StartQAV(pPlayer, 8, -1, 0); StartQAV(pPlayer, 8, -1, 0);
} }
else else
pPlayer->weaponQav = 6; pPlayer->weaponQav = kQAVLITEIDLE;
break; break;
case 3: case 3:
pPlayer->weaponQav = 9; pPlayer->weaponQav = kQAVCANIDLE;
break; break;
case 4: case 4:
if (CheckAmmo(pPlayer, 6, 1)) if (CheckAmmo(pPlayer, 6, 1))
{ {
pPlayer->weaponQav = 9; pPlayer->weaponQav = kQAVCANIDLE;
pPlayer->weaponState = 3; pPlayer->weaponState = 3;
} }
else else
@ -896,10 +896,10 @@ void WeaponUpdateState(PLAYER *pPlayer)
StartQAV(pPlayer, 16, -1, 0); StartQAV(pPlayer, 16, -1, 0);
} }
else else
pPlayer->weaponQav = 6; pPlayer->weaponQav = kQAVLITEIDLE;
break; break;
case 3: case 3:
pPlayer->weaponQav = 20; pPlayer->weaponQav = kQAVBUNIDLE;
break; break;
} }
break; break;
@ -907,7 +907,7 @@ void WeaponUpdateState(PLAYER *pPlayer)
switch (vb) switch (vb)
{ {
case 7: case 7:
pPlayer->weaponQav = 27; pPlayer->weaponQav = kQAVPROXIDLE;
break; break;
case 8: case 8:
pPlayer->weaponState = 7; pPlayer->weaponState = 7;
@ -919,10 +919,10 @@ void WeaponUpdateState(PLAYER *pPlayer)
switch (vb) switch (vb)
{ {
case 10: case 10:
pPlayer->weaponQav = 36; pPlayer->weaponQav = kQAVREMIDLE1;
break; break;
case 11: case 11:
pPlayer->weaponQav = 37; pPlayer->weaponQav = kQAVREMIDLE2;
break; break;
case 12: case 12:
if (pPlayer->ammoCount[11] > 0) if (pPlayer->ammoCount[11] > 0)
@ -945,7 +945,7 @@ void WeaponUpdateState(PLAYER *pPlayer)
pPlayer->weaponState = 1; pPlayer->weaponState = 1;
break; break;
case 7: case 7:
pPlayer->weaponQav = 60; pPlayer->weaponQav = kQAV2SHOTI;
break; break;
case 1: case 1:
if (CheckAmmo(pPlayer, 2, 1)) if (CheckAmmo(pPlayer, 2, 1))
@ -958,25 +958,25 @@ void WeaponUpdateState(PLAYER *pPlayer)
pPlayer->weaponState = 2; pPlayer->weaponState = 2;
} }
else else
pPlayer->weaponQav = 51; pPlayer->weaponQav = kQAVSHOTI3;
break; break;
case 2: case 2:
pPlayer->weaponQav = 52; pPlayer->weaponQav = kQAVSHOTI2;
break; break;
case 3: case 3:
pPlayer->weaponQav = 53; pPlayer->weaponQav = 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 = 70; pPlayer->weaponQav = kQAV2TOMIDLE;
pPlayer->weaponState = 1; pPlayer->weaponState = 1;
} }
else else
{ {
pPlayer->weaponQav = 65; pPlayer->weaponQav = kQAVTOMIDLE;
pPlayer->weaponState = 0; pPlayer->weaponState = 0;
} }
break; break;
@ -984,33 +984,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 = 46; pPlayer->weaponQav = kQAVFLAR2I;
else else
{ {
pPlayer->weaponQav = 42; pPlayer->weaponQav = kQAVFLARIDLE;
pPlayer->weaponState = 2; pPlayer->weaponState = 2;
} }
} }
else else
pPlayer->weaponQav = 42; pPlayer->weaponQav = kQAVFLARIDLE;
break; break;
case kWeapVoodooDoll: case kWeapVoodooDoll:
if (pXSprite->height < 256 && abs(pPlayer->swayHeight) > 16) if (pXSprite->height < 256 && abs(pPlayer->swayHeight) > 16)
pPlayer->weaponQav = 102; pPlayer->weaponQav = kQAVVDIDLE2;
else else
pPlayer->weaponQav = 101; pPlayer->weaponQav = 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 = 83; pPlayer->weaponQav = kQAV2SGUNIDL;
else else
pPlayer->weaponQav = 75; pPlayer->weaponQav = kQAVSGUNIDL1;
break; break;
case 3: case 3:
pPlayer->weaponQav = 76; pPlayer->weaponQav = kQAVSGUNIDL2;
break; break;
} }
break; break;
@ -1019,12 +1019,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 = 121; pPlayer->weaponQav = kQAV2NAPIDLE;
else else
pPlayer->weaponQav = 90; pPlayer->weaponQav = kQAVNAPIDLE;
break; break;
case 2: case 2:
pPlayer->weaponQav = 90; pPlayer->weaponQav = kQAVNAPIDLE;
break; break;
} }
break; break;
@ -1032,12 +1032,12 @@ void WeaponUpdateState(PLAYER *pPlayer)
switch (vb) switch (vb)
{ {
case 2: case 2:
pPlayer->weaponQav = 112; pPlayer->weaponQav = kQAVSTAFIDL1;
break; break;
} }
break; break;
case kWeapBeast: case kWeapBeast:
pPlayer->weaponQav = 94; pPlayer->weaponQav = kQAVBSTIDLE;
break; break;
} }
} }
@ -1592,7 +1592,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 = 76; pPlayer->weaponQav = kQAVSGUNIDL2;
pPlayer->flashEffect = 0; pPlayer->flashEffect = 0;
return; return;
} }
@ -2076,7 +2076,7 @@ void WeaponProcess(PLAYER *pPlayer) {
if (pPlayer->weaponTimer > 0) if (pPlayer->weaponTimer > 0)
return; return;
if (pPlayer->pXSprite->health == 0 || pPlayer->curWeapon == kWeapNone) if (pPlayer->pXSprite->health == 0 || pPlayer->curWeapon == kWeapNone)
pPlayer->weaponQav = -1; pPlayer->weaponQav = kQAVNone;
switch (pPlayer->curWeapon) switch (pPlayer->curWeapon)
{ {
case kWeapLifeLeech: case kWeapLifeLeech:
@ -2326,7 +2326,7 @@ void WeaponProcess(PLAYER *pPlayer) {
switch (pPlayer->weaponState) switch (pPlayer->weaponState)
{ {
case 7: case 7:
pPlayer->weaponQav = 27; pPlayer->weaponQav = kQAVPROXIDLE;
pPlayer->weaponState = 9; pPlayer->weaponState = 9;
pPlayer->throwTime = PlayClock; pPlayer->throwTime = PlayClock;
return; return;
@ -2336,7 +2336,7 @@ void WeaponProcess(PLAYER *pPlayer) {
switch (pPlayer->weaponState) switch (pPlayer->weaponState)
{ {
case 10: case 10:
pPlayer->weaponQav = 36; pPlayer->weaponQav = kQAVREMIDLE1;
pPlayer->weaponState = 13; pPlayer->weaponState = 13;
pPlayer->throwTime = PlayClock; pPlayer->throwTime = PlayClock;
return; return;