From 70e0ed9ec456a884659c719dbcd2d2de92d94a7a Mon Sep 17 00:00:00 2001 From: Grind Core Date: Sat, 19 Oct 2019 22:11:39 +0300 Subject: [PATCH] - Refactor: added names for powerups and updated some old. - AI: there is printing error message in conosole added (instead of dassert) - Updates for Player Control modern type # Conflicts: # source/blood/src/actor.cpp # source/blood/src/actor.h # source/blood/src/globals.cpp # source/blood/src/globals.h # source/blood/src/player.h # source/blood/src/sound.cpp # source/blood/src/triggers.cpp # source/blood/src/triggers.h # source/blood/src/view.cpp # source/blood/src/weapon.cpp # source/blood/src/weapon.h --- source/blood/src/actor.cpp | 76 +++++--- source/blood/src/actor.h | 1 + source/blood/src/ai.cpp | 82 ++++---- source/blood/src/aibat.cpp | 4 +- source/blood/src/aibeast.cpp | 4 +- source/blood/src/aiboneel.cpp | 4 +- source/blood/src/aicaleb.cpp | 4 +- source/blood/src/aicerber.cpp | 59 ++++-- source/blood/src/aicult.cpp | 152 +++++++-------- source/blood/src/aigarg.cpp | 65 ++++--- source/blood/src/aighost.cpp | 65 ++++--- source/blood/src/aigilbst.cpp | 4 +- source/blood/src/aihand.cpp | 2 +- source/blood/src/aihound.cpp | 33 ++-- source/blood/src/aipod.cpp | 33 +++- source/blood/src/airat.cpp | 2 +- source/blood/src/aispid.cpp | 6 +- source/blood/src/aitchern.cpp | 41 ++-- source/blood/src/aiunicult.cpp | 8 +- source/blood/src/aizomba.cpp | 6 +- source/blood/src/aizombf.cpp | 2 +- source/blood/src/blood.cpp | 4 - source/blood/src/callback.cpp | 2 +- source/blood/src/common.cpp | 1 + source/blood/src/common_game.h | 95 ++++++--- source/blood/src/eventq.h | 3 +- source/blood/src/globals.cpp | 13 ++ source/blood/src/messages.cpp | 52 ++--- source/blood/src/player.cpp | 342 ++++++++++++++++++--------------- source/blood/src/player.h | 15 +- source/blood/src/sound.cpp | 6 +- source/blood/src/triggers.cpp | 123 +++++++++--- source/blood/src/triggers.h | 2 - source/blood/src/view.cpp | 130 +++++-------- source/blood/src/warp.cpp | 16 +- source/blood/src/weapon.cpp | 78 ++++---- source/blood/src/weapon.h | 1 + 37 files changed, 890 insertions(+), 646 deletions(-) diff --git a/source/blood/src/actor.cpp b/source/blood/src/actor.cpp index 767cd9b1b..dabbb99cb 100644 --- a/source/blood/src/actor.cpp +++ b/source/blood/src/actor.cpp @@ -2540,6 +2540,8 @@ short gSightSpritesCount; // current count short gPhysSpritesList[]; // by NoOne: list of additional sprites which can be affected by physics short gPhysSpritesCount; // current count +short gQavPlayerIndex = -1; // by NoOne: index of sprite which currently activated to play qav + void actInit(bool bSaveLoad) { // by NoOne: init code for all my stuff @@ -2548,6 +2550,9 @@ void actInit(bool bSaveLoad) { // reset counters gProxySpritesCount = gSightSpritesCount = gPhysSpritesCount = 0; + // reset qav player index + gQavPlayerIndex = -1; + // fill arrays with negative values to avoid xvel 0 situation memset(gSightSpritesList, -1, sizeof(gSightSpritesList)); memset(gProxySpritesList, -1, sizeof(gProxySpritesList)); @@ -2614,7 +2619,7 @@ void actInit(bool bSaveLoad) { else { gProxySpritesList[gProxySpritesCount++] = pSprite->xvel; if (gProxySpritesCount == kMaxSuperXSprites) - ThrowError("Max (%d) *additional* Proximity sprites reached!",kMaxSuperXSprites); + viewSetSystemMessage("Max (%d) *additional* Proximity sprites reached!", kMaxSuperXSprites); } break; } @@ -2638,7 +2643,7 @@ void actInit(bool bSaveLoad) { default: gSightSpritesList[gSightSpritesCount++] = pSprite->xvel; if (gSightSpritesCount == kMaxSuperXSprites) - ThrowError("Max (%d) Sight sprites reached!", kMaxSuperXSprites); + viewSetSystemMessage("Max (%d) Sight sprites reached!", kMaxSuperXSprites); break; } } @@ -2779,13 +2784,14 @@ void ConcussSprite(int a1, spritetype *pSprite, int x, int y, int z, int a6) mass = getSpriteMassBySize(pSprite); break; } - } - else if (pSprite->type >= kThingBase && pSprite->type < kThingMax) + + } else if (pSprite->type >= kThingBase && pSprite->type < kThingMax) { mass = thingInfo[pSprite->type - kThingBase].mass; - else + } else { + consoleSysMsg("Unexpected type in ConcussSprite(): Sprite: %d Type: %d Stat: %d", (int)pSprite->index, (int)pSprite->type, (int)pSprite->statnum); return; - //else - //ThrowError("Unexpected type in ConcussSprite(): Sprite: %d Type: %d Stat: %d", (int)pSprite->index, (int)pSprite->type, (int)pSprite->statnum); + } + int size = (tilesiz[pSprite->picnum].x*pSprite->xrepeat*tilesiz[pSprite->picnum].y*pSprite->yrepeat)>>1; dassert(mass > 0); @@ -3096,7 +3102,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, } if (damageType == DAMAGE_TYPE_1) { - if ((gSysRes.Lookup(pXSprite->data2 + 15, "SEQ") || gSysRes.Lookup(pXSprite->data2 + 16, "SEQ")) && pXSprite->medium == 0) { + if ((gSysRes.Lookup(pXSprite->data2 + 15, "SEQ") || gSysRes.Lookup(pXSprite->data2 + 16, "SEQ")) && pXSprite->medium == kMediumNormal) { if (gSysRes.Lookup(pXSprite->data2 + 3, "SEQ")) { pSprite->type = kDudeModernCustomBurning; if (pXSprite->data2 == kDefaultAnimationBase) // don't inherit palette for burning if using default animation @@ -3170,7 +3176,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, case kDudeCultistShotgun: case kDudeCultistTesla: case kDudeCultistTNT: - if (damageType == DAMAGE_TYPE_1 && pXSprite->medium == 0) + if (damageType == DAMAGE_TYPE_1 && pXSprite->medium == kMediumNormal) { pSprite->type = kDudeBurningCultist; aiNewState(pSprite, pXSprite, &cultistBurnGoto); @@ -3180,7 +3186,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, // no break fallthrough__; case kDudeBeast: - if (damageType == DAMAGE_TYPE_1 && pXSprite->medium == 0) + if (damageType == DAMAGE_TYPE_1 && pXSprite->medium == kMediumNormal) { pSprite->type = kDudeBurningBeast; aiNewState(pSprite, pXSprite, &beastBurnGoto); @@ -3190,7 +3196,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, // no break fallthrough__; case kDudeInnocent: - if (damageType == DAMAGE_TYPE_1 && pXSprite->medium == 0) + if (damageType == DAMAGE_TYPE_1 && pXSprite->medium == kMediumNormal) { pSprite->type = kDudeBurningInnocent; aiNewState(pSprite, pXSprite, &innocentBurnGoto); @@ -3664,8 +3670,11 @@ int actDamageSprite(int nSource, spritetype *pSprite, DAMAGE_TYPE damageType, in switch (pSprite->statnum) { case kStatDude: { - if (!IsDudeSprite(pSprite)) - ThrowError("Bad Dude Failed: initial=%d type=%d %s\n", (int)pSprite->inittype, (int)pSprite->type, (int)(pSprite->flags & kHitagRespawn) ? "RESPAWN" : "NORMAL"); + if (!IsDudeSprite(pSprite)) { + consoleSysMsg("Bad Dude Failed: initial=%d type=%d %s\n", (int)pSprite->inittype, (int)pSprite->type, (int)(pSprite->flags & kHitagRespawn) ? "RESPAWN" : "NORMAL"); + return damage >> 4; + //ThrowError("Bad Dude Failed: initial=%d type=%d %s\n", (int)pSprite->inittype, (int)pSprite->type, (int)(pSprite->flags & kHitagRespawn) ? "RESPAWN" : "NORMAL"); + } int nType = pSprite->type - kDudeBase; int nDamageFactor = dudeInfo[nType].at70[damageType]; if (!nDamageFactor) return 0; @@ -4060,7 +4069,7 @@ void actImpactMissile(spritetype *pMissile, int hitCode) case kMissileButcherKnife: actPostSprite(pMissile->index, kStatDebris); pMissile->cstat &= ~16; - pMissile->type = 0; + pMissile->type = kSpriteDecoration; seqSpawn(20, 3, pMissile->extra, -1); if (hitCode == 3) { @@ -4225,7 +4234,7 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite) case kDudeModernCustomBurning: int dmg = (getSpriteMassBySize(pSprite2) - getSpriteMassBySize(pSprite)) + pSprite2->clipdist; if (dmg > 0) { - if (IsPlayerSprite(pSprite) && powerupCheck(&gPlayer[pSprite->type - kDudePlayer1],15) > 0) + if (IsPlayerSprite(pSprite) && powerupCheck(&gPlayer[pSprite->type - kDudePlayer1], kPwUpJumpBoots) > 0) actDamageSprite(pSprite2->xvel, pSprite, DAMAGE_TYPE_3, dmg); else actDamageSprite(pSprite2->xvel, pSprite, DAMAGE_TYPE_0, dmg); @@ -4825,9 +4834,9 @@ void MoveDude(spritetype *pSprite) } int nUpperLink = gUpperLink[nSector]; int nLowerLink = gLowerLink[nSector]; - if (nUpperLink >= 0 && (sprite[nUpperLink].type == 9 || sprite[nUpperLink].type == 13)) + if (nUpperLink >= 0 && (sprite[nUpperLink].type == kMarkerUpWater || sprite[nUpperLink].type == kMarkerUpGoo)) bDepth = 1; - if (nLowerLink >= 0 && (sprite[nLowerLink].type == 10 || sprite[nLowerLink].type == 14)) + if (nLowerLink >= 0 && (sprite[nLowerLink].type == kMarkerLowWater || sprite[nLowerLink].type == kMarkerLowGoo)) bDepth = 1; if (pPlayer) wd += 16; @@ -4897,7 +4906,7 @@ void MoveDude(spritetype *pSprite) break; case kMarkerLowWater: case kMarkerLowGoo: - pXSprite->medium = 0; + pXSprite->medium = kMediumNormal; if (pPlayer) { pPlayer->at2f = 0; pPlayer->at302 = 0; @@ -4926,7 +4935,7 @@ void MoveDude(spritetype *pSprite) case kMarkerUpWater: case kMarkerUpGoo: { - pXSprite->medium = nLink == kMarkerUpGoo ? 2 : 1; + pXSprite->medium = (nLink == kMarkerUpGoo ? kMediumGoo : kMediumWater); if (pPlayer) { @@ -5011,7 +5020,7 @@ void MoveDude(spritetype *pSprite) break; } /*case 13: - pXSprite->medium = 2; + pXSprite->medium = kMediumGoo; if (pPlayer) { pPlayer->changeTargetKin = 1; @@ -5665,6 +5674,19 @@ void actProcessSprites(void) } } + + // process playing 3-rd side qavs for player(s) + if (gQavPlayerIndex > -1) { + if (sprite[gQavPlayerIndex].extra >= 0) { + XSPRITE* pXSprite = &xsprite[sprite[gQavPlayerIndex].extra]; + if (((int)gFrameClock & pXSprite->busyTime) == 0) { + if (pXSprite->waitTime <= 0 || pXSprite->sysData1-- > 0) StartQAV(getPlayerById(pXSprite->data1), kFreeQAVEntry); + else evPost(gQavPlayerIndex, 3, 0, kCmdOff); + } + } else { + gQavPlayerIndex = -1; + } + } } for (nSprite = headspritestat[kStatThing]; nSprite >= 0; nSprite = nextspritestat[nSprite]) @@ -5713,10 +5735,10 @@ void actProcessSprites(void) else if (pSprite->type == kThingDroppedLifeLeech && pXSprite->target == -1) { int nOwner = actOwnerIdToSpriteId(pSprite->owner); spritetype *pOwner = &sprite[nOwner]; - PLAYER *pPlayer = &gPlayer[pOwner->type-kDudePlayer1]; + PLAYER *pPlayer = &gPlayer[pOwner->type - kDudePlayer1]; PLAYER *pPlayer2 = NULL; if (IsPlayerSprite(pSprite2)) - pPlayer2 = &gPlayer[pSprite2->type-kDudePlayer1]; + pPlayer2 = &gPlayer[pSprite2->type - kDudePlayer1]; if (nSprite2 == nOwner || pSprite2->type == kDudeZombieAxeBuried || pSprite2->type == kDudeRat || pSprite2->type == kDudeBat) continue; if (gGameOptions.nGameType == 3 && pPlayer2 && pPlayer->at2ea == pPlayer2->at2ea) @@ -6361,7 +6383,7 @@ spritetype * actSpawnSprite(int nSector, int x, int y, int z, int nStat, char a6 vec3_t pos = { x, y, z }; setsprite(nSprite, &pos); spritetype *pSprite = &sprite[nSprite]; - pSprite->type = 0; + pSprite->type = kSpriteDecoration; if (a6 && pSprite->extra == -1) { int nXSprite = dbInsertXSprite(nSprite); @@ -6814,12 +6836,10 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6, int nSprite = gHitInfo.hitsprite; dassert(nSprite >= 0 && nSprite < kMaxSprites); spritetype *pSprite = &sprite[nSprite]; - if (!gGameOptions.bFriendlyFire && IsTargetTeammate(pShooter, pSprite)) - return; - if (IsPlayerSprite(pSprite)) - { + if (!gGameOptions.bFriendlyFire && IsTargetTeammate(pShooter, pSprite)) return; + if (IsPlayerSprite(pSprite)) { PLAYER *pPlayer = &gPlayer[pSprite->type-kDudePlayer1]; - if (powerupCheck(pPlayer, 24)) + if (powerupCheck(pPlayer, kPwUpReflectShots)) { gHitInfo.hitsprite = nShooter; gHitInfo.hitx = pShooter->x; diff --git a/source/blood/src/actor.h b/source/blood/src/actor.h index e40577e4b..a51202a88 100644 --- a/source/blood/src/actor.h +++ b/source/blood/src/actor.h @@ -286,5 +286,6 @@ extern short gPhysSpritesList[kMaxSuperXSprites]; extern short gProxySpritesCount; extern short gSightSpritesCount; extern short gPhysSpritesCount; +extern short gQavPlayerIndex; END_BLD_NS diff --git a/source/blood/src/ai.cpp b/source/blood/src/ai.cpp index a126b4c3a..05a0c8371 100644 --- a/source/blood/src/ai.cpp +++ b/source/blood/src/ai.cpp @@ -379,15 +379,15 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) pDudeExtraE->at0 = 0; if (pXSprite->target == -1) { switch (pXSprite->medium) { - case 0: + case kMediumNormal: aiNewState(pSprite, pXSprite, &cultistSearch); if (Chance(0x8000)) { if (pSprite->type == kDudeCultistTommy) aiPlay3DSound(pSprite, 4008+Random(5), AI_SFX_PRIORITY_1, -1); else aiPlay3DSound(pSprite, 1008+Random(5), AI_SFX_PRIORITY_1, -1); } break; - case 1: - case 2: + case kMediumWater: + case kMediumGoo: aiNewState(pSprite, pXSprite, &cultistSwimSearch); break; } @@ -397,12 +397,12 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) else aiPlay3DSound(pSprite, 1003+Random(4), AI_SFX_PRIORITY_1, -1); } switch (pXSprite->medium) { - case 0: + case kMediumNormal: if (pSprite->type == kDudeCultistTommy) aiNewState(pSprite, pXSprite, &fanaticChase); else aiNewState(pSprite, pXSprite, &cultistChase); break; - case 1: - case 2: + case kMediumWater: + case kMediumGoo: aiNewState(pSprite, pXSprite, &cultistSwimChase); break; } @@ -453,8 +453,8 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) if (Chance(0x8000)) aiPlay3DSound(pSprite, 4008+Random(5), AI_SFX_PRIORITY_1, -1); break; - case 1: - case 2: + case kMediumWater: + case kMediumGoo: aiNewState(pSprite, pXSprite, &cultistSwimSearch); break; } @@ -463,11 +463,11 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) aiPlay3DSound(pSprite, 4008+Random(5), AI_SFX_PRIORITY_1, -1); switch (pXSprite->medium) { - case 0: + case kMediumNormal: aiNewState(pSprite, pXSprite, &cultistProneChase); break; - case 1: - case 2: + case kMediumWater: + case kMediumGoo: aiNewState(pSprite, pXSprite, &cultistSwimChase); break; } @@ -484,13 +484,13 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) { switch (pXSprite->medium) { - case 0: + case kMediumNormal: aiNewState(pSprite, pXSprite, &cultistSearch); if (Chance(0x8000)) aiPlay3DSound(pSprite, 1008+Random(5), AI_SFX_PRIORITY_1, -1); break; - case 1: - case 2: + case kMediumWater: + case kMediumGoo: aiNewState(pSprite, pXSprite, &cultistSwimSearch); break; } @@ -501,11 +501,11 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) aiPlay3DSound(pSprite, 1003+Random(4), AI_SFX_PRIORITY_1, -1); switch (pXSprite->medium) { - case 0: + case kMediumNormal: aiNewState(pSprite, pXSprite, &cultistProneChase); break; - case 1: - case 2: + case kMediumWater: + case kMediumGoo: aiNewState(pSprite, pXSprite, &cultistSwimChase); break; } @@ -807,11 +807,11 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) { switch (pXSprite->medium) { - case 0: + case kMediumNormal: aiNewState(pSprite, pXSprite, &tinycalebSearch); break; - case 1: - case 2: + case kMediumWater: + case kMediumGoo: aiNewState(pSprite, pXSprite, &tinycalebSwimSearch); break; } @@ -820,11 +820,11 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) { switch (pXSprite->medium) { - case 0: + case kMediumNormal: aiNewState(pSprite, pXSprite, &tinycalebChase); break; - case 1: - case 2: + case kMediumWater: + case kMediumGoo: aiNewState(pSprite, pXSprite, &tinycalebSwimChase); break; } @@ -840,11 +840,11 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) { switch (pXSprite->medium) { - case 0: + case kMediumNormal: aiNewState(pSprite, pXSprite, &beastSearch); break; - case 1: - case 2: + case kMediumWater: + case kMediumGoo: aiNewState(pSprite, pXSprite, &beastSwimSearch); break; } @@ -854,11 +854,11 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) aiPlay3DSound(pSprite, 9009+Random(2), AI_SFX_PRIORITY_1, -1); switch (pXSprite->medium) { - case 0: + case kMediumNormal: aiNewState(pSprite, pXSprite, &beastChase); break; - case 1: - case 2: + case kMediumWater: + case kMediumGoo: aiNewState(pSprite, pXSprite, &beastSwimChase); break; } @@ -953,7 +953,7 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T aiNewState(pSprite, pXSprite, &cultistDodge); else if (sub_5BDA8(pSprite, 14) && !pXSprite->medium) aiNewState(pSprite, pXSprite, &cultistProneDodge); - else if (sub_5BDA8(pSprite, 13) && (pXSprite->medium == 1 || pXSprite->medium == 2)) + else if (sub_5BDA8(pSprite, 13) && (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)) aiNewState(pSprite, pXSprite, &cultistSwimDodge); } else if (nDmgType == DAMAGE_TYPE_1 && pXSprite->health <= (unsigned int)pDudeInfo->fleeHealth/* && (pXSprite->at17_6 != 1 || pXSprite->at17_6 != 2)*/) @@ -984,13 +984,13 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T aiPlay3DSound(pSprite, 1031+Random(2), AI_SFX_PRIORITY_2, -1); gDudeExtra[pSprite->extra].at0 = (int)gFrameClock+360; } - if (Chance(0x600) && (pXSprite->medium == 1 || pXSprite->medium == 2)) + if (Chance(0x600) && (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)) { pSprite->type = kDudeCultistTommy; pXSprite->burnTime = 0; aiNewState(pSprite, pXSprite, &cultistSwimGoto); } - else if (pXSprite->medium == 1 || pXSprite->medium == 2) + else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) { pSprite->type = kDudeCultistShotgun; pXSprite->burnTime = 0; @@ -1169,16 +1169,16 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) if (pSprite->type == kDudeCultistTommy) aiPlay3DSound(pSprite, 4013+Random(2), AI_SFX_PRIORITY_2, -1); else aiPlay3DSound(pSprite, 1013+Random(2), AI_SFX_PRIORITY_2, -1); - if (!v4 && pXSprite->medium == 0) { + if (!v4 && pXSprite->medium == kMediumNormal) { if (pDudeExtra->at4) aiNewState(pSprite, pXSprite, &cultistTeslaRecoil); else aiNewState(pSprite, pXSprite, &cultistRecoil); - } else if (v4 && pXSprite->medium == 0) { + } else if (v4 && pXSprite->medium == kMediumNormal) { if (pDudeExtra->at4) aiNewState(pSprite, pXSprite, &cultistTeslaRecoil); else if (gGameOptions.nDifficulty > 0) aiNewState(pSprite, pXSprite, &cultistProneRecoil); else aiNewState(pSprite, pXSprite, &cultistRecoil); } - else if (pXSprite->medium == 1 || pXSprite->medium == 2) + else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(pSprite, pXSprite, &cultistSwimRecoil); else { @@ -1298,14 +1298,14 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &innocentRecoil); break; case kDudeTinyCaleb: - if (pXSprite->medium == 0) + if (pXSprite->medium == kMediumNormal) { if (pDudeExtra->at4) aiNewState(pSprite, pXSprite, &tinycalebTeslaRecoil); else aiNewState(pSprite, pXSprite, &tinycalebRecoil); } - else if (pXSprite->medium == 1 || pXSprite->medium == 2) + else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(pSprite, pXSprite, &tinycalebSwimRecoil); else { @@ -1317,14 +1317,14 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) break; case kDudeBeast: aiPlay3DSound(pSprite, 9004+Random(2), AI_SFX_PRIORITY_2, -1); - if (pXSprite->medium == 0) + if (pXSprite->medium == kMediumNormal) { if (pDudeExtra->at4) aiNewState(pSprite, pXSprite, &beastTeslaRecoil); else aiNewState(pSprite, pXSprite, &beastRecoil); } - else if (pXSprite->medium == 1 || pXSprite->medium == 2) + else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(pSprite, pXSprite, &beastSwimRecoil); else { @@ -1359,7 +1359,7 @@ void aiThinkTarget(spritetype *pSprite, XSPRITE *pXSprite) for (int p = connecthead; p >= 0; p = connectpoint2[p]) { PLAYER *pPlayer = &gPlayer[p]; - if (pSprite->owner == pPlayer->at5b || pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, 13) > 0) + if (pSprite->owner == pPlayer->at5b || pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0) continue; int x = pPlayer->pSprite->x; int y = pPlayer->pSprite->y; @@ -1398,7 +1398,7 @@ void sub_5F15C(spritetype *pSprite, XSPRITE *pXSprite) for (int p = connecthead; p >= 0; p = connectpoint2[p]) { PLAYER *pPlayer = &gPlayer[p]; - if (pSprite->owner == pPlayer->at5b || pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, 13) > 0) + if (pSprite->owner == pPlayer->at5b || pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0) continue; int x = pPlayer->pSprite->x; int y = pPlayer->pSprite->y; diff --git a/source/blood/src/aibat.cpp b/source/blood/src/aibat.cpp index 369313fe3..db1bb065a 100644 --- a/source/blood/src/aibat.cpp +++ b/source/blood/src/aibat.cpp @@ -112,7 +112,7 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite) for (int p = connecthead; p >= 0; p = connectpoint2[p]) { PLAYER *pPlayer = &gPlayer[p]; - if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, 13) > 0) + if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0) continue; int x = pPlayer->pSprite->x; int y = pPlayer->pSprite->y; @@ -287,7 +287,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &batSearch); return; } - if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) + if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type - kDudePlayer1], kPwUpShadowCloak) > 0) { aiNewState(pSprite, pXSprite, &batSearch); return; diff --git a/source/blood/src/aibeast.cpp b/source/blood/src/aibeast.cpp index 3bc9c3246..8c92ba3a1 100644 --- a/source/blood/src/aibeast.cpp +++ b/source/blood/src/aibeast.cpp @@ -267,7 +267,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &beastSearch); return; } - if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) + if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { XSECTOR *pXSector; int nXSector = sector[pSprite->sectnum].extra; @@ -425,7 +425,7 @@ static void thinkSwimChase(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &beastSwimSearch); return; } - if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) + if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { aiNewState(pSprite, pXSprite, &beastSwimSearch); return; diff --git a/source/blood/src/aiboneel.cpp b/source/blood/src/aiboneel.cpp index bcbd66847..27547e631 100644 --- a/source/blood/src/aiboneel.cpp +++ b/source/blood/src/aiboneel.cpp @@ -125,7 +125,7 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite) for (int p = connecthead; p >= 0; p = connectpoint2[p]) { PLAYER *pPlayer = &gPlayer[p]; - if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, 13) > 0) + if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0) continue; int x = pPlayer->pSprite->x; int y = pPlayer->pSprite->y; @@ -302,7 +302,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &eelSearch); return; } - if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) + if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { aiNewState(pSprite, pXSprite, &eelSearch); return; diff --git a/source/blood/src/aicaleb.cpp b/source/blood/src/aicaleb.cpp index af2af5499..8b36e75b8 100644 --- a/source/blood/src/aicaleb.cpp +++ b/source/blood/src/aicaleb.cpp @@ -171,7 +171,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) } return; } - if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) + if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { XSECTOR *pXSector; int nXSector = sector[pSprite->sectnum].extra; @@ -292,7 +292,7 @@ static void thinkSwimChase(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &tinycalebSwimSearch); return; } - if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) + if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { aiNewState(pSprite, pXSprite, &tinycalebSwimSearch); return; diff --git a/source/blood/src/aicerber.cpp b/source/blood/src/aicerber.cpp index eaa7a23e0..9153da8e8 100644 --- a/source/blood/src/aicerber.cpp +++ b/source/blood/src/aicerber.cpp @@ -82,12 +82,16 @@ static void BiteSeqCallback(int, int nXSprite) spritetype *pSprite = &sprite[nSprite]; int dx = Cos(pSprite->ang)>>16; int dy = Sin(pSprite->ang)>>16; - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); - if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) + } + ///dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) { + consoleSysMsg("pXSprite->target >= 0 && pXSprite->target < kMaxSprites"); return; - //dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + } spritetype *pTarget = &sprite[pXSprite->target]; int dz = pTarget->z-pSprite->z; actFireVector(pSprite, 350, -100, dx, dy, dz, VECTOR_TYPE_14); @@ -102,9 +106,11 @@ static void BurnSeqCallback(int, int nXSprite) spritetype *pSprite = &sprite[nSprite]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; int height = pDudeInfo->eyeHeight*pSprite->yrepeat; - if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) + ///dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) { + consoleSysMsg("pXSprite->target >= 0 && pXSprite->target < kMaxSprites"); return; - //dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + } int x = pSprite->x; int y = pSprite->y; int z = height; // ??? @@ -179,12 +185,14 @@ static void BurnSeqCallback2(int, int nXSprite) XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; spritetype *pSprite = &sprite[nSprite]; - if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) + ///dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) { + consoleSysMsg("pXSprite->target >= 0 && pXSprite->target < kMaxSprites"); return; - //dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; int height = pDudeInfo->eyeHeight*pSprite->yrepeat; - //dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + int x = pSprite->x; int y = pSprite->y; int z = height; // ??? @@ -266,7 +274,11 @@ static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite) static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite) { - dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); + return; + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase]; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; if (pDudeExtraE->at8 && pDudeExtraE->at4 < 10) @@ -287,7 +299,7 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite) for (int p = connecthead; p >= 0; p = connectpoint2[p]) { PLAYER *pPlayer = &gPlayer[p]; - if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, 13) > 0) + if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0) continue; int x = pPlayer->pSprite->x; int y = pPlayer->pSprite->y; @@ -322,7 +334,11 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite) static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite) { - dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); + return; + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; int dx = pXSprite->targetX-pSprite->x; int dy = pXSprite->targetY-pSprite->y; @@ -357,12 +373,19 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) return; } - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); - DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; - if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + } + + DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; + + ///dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) { + consoleSysMsg("pXSprite->target >= 0 && pXSprite->target < kMaxSprites"); + return; + } spritetype *pTarget = &sprite[pXSprite->target]; XSPRITE *pXTarget = &xsprite[pTarget->extra]; int dx = pTarget->x-pSprite->x; @@ -381,7 +404,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) return; } - if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) { + if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { switch (pSprite->type) { case kDudeCerberusTwoHead: aiNewState(pSprite, pXSprite, &cerberusSearch); diff --git a/source/blood/src/aicult.cpp b/source/blood/src/aicult.cpp index 2e4b7774c..4fab0c4b7 100644 --- a/source/blood/src/aicult.cpp +++ b/source/blood/src/aicult.cpp @@ -247,11 +247,11 @@ static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite) { switch (pXSprite->medium) { - case 0: + case kMediumNormal: aiNewState(pSprite, pXSprite, &cultistSearch); break; - case 1: - case 2: + case kMediumWater: + case kMediumGoo: aiNewState(pSprite, pXSprite, &cultistSwimSearch); break; } @@ -265,11 +265,11 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) { switch (pXSprite->medium) { - case 0: + case kMediumNormal: aiNewState(pSprite, pXSprite, &cultistGoto); break; - case 1: - case 2: + case kMediumWater: + case kMediumGoo: aiNewState(pSprite, pXSprite, &cultistSwimGoto); break; } @@ -287,29 +287,29 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) { switch (pXSprite->medium) { - case 0: + case kMediumNormal: aiNewState(pSprite, pXSprite, &cultistSearch); if (pSprite->type == kDudeCultistTommy) aiPlay3DSound(pSprite, 4021+Random(4), AI_SFX_PRIORITY_1, -1); else aiPlay3DSound(pSprite, 1021+Random(4), AI_SFX_PRIORITY_1, -1); break; - case 1: - case 2: + case kMediumWater: + case kMediumGoo: aiNewState(pSprite, pXSprite, &cultistSwimSearch); break; } return; } - if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) + if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { switch (pXSprite->medium) { - case 0: + case kMediumNormal: aiNewState(pSprite, pXSprite, &cultistSearch); break; - case 1: - case 2: + case kMediumWater: + case kMediumGoo: aiNewState(pSprite, pXSprite, &cultistSwimSearch); break; } @@ -337,14 +337,14 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) switch (hit) { case -1: - if (pXSprite->medium != 1 && pXSprite->medium != 2) + if (pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo) aiNewState(pSprite, pXSprite, &cultistTThrow); break; case 0: case 4: break; case 3: - if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun && pXSprite->medium != 1 && pXSprite->medium != 2) + if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun && pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo) aiNewState(pSprite, pXSprite, &cultistTThrow); break; default: @@ -358,39 +358,39 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) switch (hit) { case -1: - if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistTFire); - else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistTProneFire); - else if (sub_5BDA8(pSprite, 13) && (pXSprite->medium == 1 || pXSprite->medium == 2)) + else if (sub_5BDA8(pSprite, 13) && (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)) aiNewState(pSprite, pXSprite, &cultistTSwimFire); break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun) { - if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistTFire); - else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistTProneFire); - else if (pXSprite->medium == 1 || pXSprite->medium == 2) + else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(pSprite, pXSprite, &cultistTSwimFire); } else { - if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistDodge); - else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistProneDodge); - else if (pXSprite->medium == 1 || pXSprite->medium == 2) + else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(pSprite, pXSprite, &cultistSwimDodge); } break; default: - if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistTFire); - else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistTProneFire); - else if (pXSprite->medium == 1 || pXSprite->medium == 2) + else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(pSprite, pXSprite, &cultistTSwimFire); break; } @@ -405,14 +405,14 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) switch (hit) { case -1: - if (pXSprite->medium != 1 && pXSprite->medium != 2) + if (pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo) aiNewState(pSprite, pXSprite, &cultistSThrow); break; case 0: case 4: break; case 3: - if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun && pXSprite->medium != 1 && pXSprite->medium != 2) + if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun && pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo) aiNewState(pSprite, pXSprite, &cultistSThrow); break; default: @@ -426,39 +426,39 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) switch (hit) { case -1: - if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistSFire); - else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistSProneFire); - else if (pXSprite->medium == 1 || pXSprite->medium == 2) + else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(pSprite, pXSprite, &cultistSSwimFire); break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistTommy) { - if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistSFire); - else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistSProneFire); - else if (pXSprite->medium == 1 || pXSprite->medium == 2) + else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(pSprite, pXSprite, &cultistSSwimFire); } else { - if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistDodge); - else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistProneDodge); - else if (pXSprite->medium == 1 || pXSprite->medium == 2) + else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(pSprite, pXSprite, &cultistSwimDodge); } break; default: - if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistSFire); - else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistSProneFire); - else if (pXSprite->medium == 1 || pXSprite->medium == 2) + else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(pSprite, pXSprite, &cultistSSwimFire); break; } @@ -473,14 +473,14 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) switch (hit) { case -1: - if (pXSprite->medium != 1 && pXSprite->medium != 2) + if (pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo) aiNewState(pSprite, pXSprite, &cultistTsThrow); break; case 0: case 4: break; case 3: - if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun && pXSprite->medium != 1 && pXSprite->medium != 2) + if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun && pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo) aiNewState(pSprite, pXSprite, &cultistTsThrow); break; default: @@ -494,39 +494,39 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) switch (hit) { case -1: - if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistTsFire); - else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistTsProneFire); - else if (pXSprite->medium == 1 || pXSprite->medium == 2) + else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(pSprite, pXSprite, &cultistTsSwimFire); break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistTommy) { - if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistTsFire); - else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistTsProneFire); - else if (pXSprite->medium == 1 || pXSprite->medium == 2) + else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(pSprite, pXSprite, &cultistTsSwimFire); } else { - if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistDodge); - else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistProneDodge); - else if (pXSprite->medium == 1 || pXSprite->medium == 2) + else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(pSprite, pXSprite, &cultistSwimDodge); } break; default: - if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistTsFire); - else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistTsProneFire); - else if (pXSprite->medium == 1 || pXSprite->medium == 2) + else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(pSprite, pXSprite, &cultistTsSwimFire); break; } @@ -540,13 +540,13 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) switch (hit) { case -1: - if (pXSprite->medium != 1 && pXSprite->medium != 2) + if (pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo) aiNewState(pSprite, pXSprite, &cultistDThrow); break; case 4: break; case 3: - if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun && pXSprite->medium != 1 && pXSprite->medium != 2) + if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun && pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo) aiNewState(pSprite, pXSprite, &cultistDThrow); break; default: @@ -561,13 +561,13 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) switch (hit) { case -1: - if (pXSprite->medium != 1 && pXSprite->medium != 2) + if (pXSprite->medium != 1 && pXSprite->medium != kMediumGoo) aiNewState(pSprite, pXSprite, &cultist139A78); break; case 4: break; case 3: - if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun && pXSprite->medium != 1 && pXSprite->medium != 2) + if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun && pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo) aiNewState(pSprite, pXSprite, &cultist139A78); break; default: @@ -585,14 +585,14 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) switch (hit) { case -1: - if (pXSprite->medium != 1 && pXSprite->medium != 2) + if (pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo) aiNewState(pSprite, pXSprite, &cultistSThrow); break; case 0: case 4: break; case 3: - if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun && pXSprite->medium != 1 && pXSprite->medium != 2) + if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun && pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo) aiNewState(pSprite, pXSprite, &cultistSThrow); break; default: @@ -606,39 +606,39 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) switch (hit) { case -1: - if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistSFire); - else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistSProneFire); - else if (pXSprite->medium == 1 || pXSprite->medium == 2) + else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(pSprite, pXSprite, &cultistSSwimFire); break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistTommy) { - if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistSFire); - else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistSProneFire); - else if (pXSprite->medium == 1 || pXSprite->medium == 2) + else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(pSprite, pXSprite, &cultistSSwimFire); } else { - if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistDodge); - else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistProneDodge); - else if (pXSprite->medium == 1 || pXSprite->medium == 2) + else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(pSprite, pXSprite, &cultistSwimDodge); } break; default: - if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistSFire); - else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) + else if (sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal) aiNewState(pSprite, pXSprite, &cultistSProneFire); - else if (pXSprite->medium == 1 || pXSprite->medium == 2) + else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(pSprite, pXSprite, &cultistSSwimFire); break; } @@ -651,11 +651,11 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) } switch (pXSprite->medium) { - case 0: + case kMediumNormal: aiNewState(pSprite, pXSprite, &cultistGoto); break; - case 1: - case 2: + case kMediumWater: + case kMediumGoo: aiNewState(pSprite, pXSprite, &cultistSwimGoto); break; } diff --git a/source/blood/src/aigarg.cpp b/source/blood/src/aigarg.cpp index 2fa2ea468..063f94eca 100644 --- a/source/blood/src/aigarg.cpp +++ b/source/blood/src/aigarg.cpp @@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "mmulti.h" #include "common_game.h" + #include "actor.h" #include "ai.h" #include "aigarg.h" @@ -225,9 +226,11 @@ static void ThrowSSeqCallback(int, int nXSprite) static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite) { - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase]; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; if (pDudeExtraE->at8 && pDudeExtraE->at4 < 10) @@ -245,7 +248,7 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite) for (int p = connecthead; p >= 0; p = connectpoint2[p]) { PLAYER *pPlayer = &gPlayer[p]; - if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, 13) > 0) + if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0) continue; int x = pPlayer->pSprite->x; int y = pPlayer->pSprite->y; @@ -286,9 +289,11 @@ static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite) static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite) { - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; int dx = pXSprite->targetX-pSprite->x; int dy = pXSprite->targetY-pSprite->y; @@ -303,9 +308,11 @@ static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite) static void MoveDodgeUp(spritetype *pSprite, XSPRITE *pXSprite) { int nSprite = pSprite->index; - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; int nTurnRange = (pDudeInfo->angSpeed<<2)>>4; @@ -329,9 +336,11 @@ static void MoveDodgeUp(spritetype *pSprite, XSPRITE *pXSprite) static void MoveDodgeDown(spritetype *pSprite, XSPRITE *pXSprite) { int nSprite = pSprite->index; - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; int nTurnRange = (pDudeInfo->angSpeed<<2)>>4; @@ -361,13 +370,17 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &gargoyleFGoto); return; } - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; - if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) + ///dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) { + consoleSysMsg("pXSprite->target >= 0 && pXSprite->target < kMaxSprites"); return; - //dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + } spritetype *pTarget = &sprite[pXSprite->target]; XSPRITE *pXTarget = &xsprite[pTarget->extra]; int dx = pTarget->x-pSprite->x; @@ -378,7 +391,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &gargoyleFSearch); return; } - if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) + if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { aiNewState(pSprite, pXSprite, &gargoyleFSearch); return; @@ -547,9 +560,11 @@ static void entrySStatue(spritetype *pSprite, XSPRITE *pXSprite) static void MoveForward(spritetype *pSprite, XSPRITE *pXSprite) { int nSprite = pSprite->index; - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; int nTurnRange = (pDudeInfo->angSpeed<<2)>>4; @@ -582,9 +597,11 @@ static void MoveForward(spritetype *pSprite, XSPRITE *pXSprite) static void MoveSlow(spritetype *pSprite, XSPRITE *pXSprite) { int nSprite = pSprite->index; - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; int nTurnRange = (pDudeInfo->angSpeed<<2)>>4; @@ -624,9 +641,11 @@ static void MoveSlow(spritetype *pSprite, XSPRITE *pXSprite) static void MoveSwoop(spritetype *pSprite, XSPRITE *pXSprite) { int nSprite = pSprite->index; - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; int nTurnRange = (pDudeInfo->angSpeed<<2)>>4; @@ -665,9 +684,11 @@ static void MoveSwoop(spritetype *pSprite, XSPRITE *pXSprite) static void MoveFly(spritetype *pSprite, XSPRITE *pXSprite) { int nSprite = pSprite->index; - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; int nTurnRange = (pDudeInfo->angSpeed<<2)>>4; diff --git a/source/blood/src/aighost.cpp b/source/blood/src/aighost.cpp index ebc636e25..f0d310d74 100644 --- a/source/blood/src/aighost.cpp +++ b/source/blood/src/aighost.cpp @@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "mmulti.h" #include "common_game.h" + #include "actor.h" #include "ai.h" #include "aighost.h" @@ -200,9 +201,11 @@ static void BlastSeqCallback(int, int nXSprite) static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite) { - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase]; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; if (pDudeExtraE->at8 && pDudeExtraE->at4 < 10) @@ -220,7 +223,7 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite) for (int p = connecthead; p >= 0; p = connectpoint2[p]) { PLAYER *pPlayer = &gPlayer[p]; - if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, 13) > 0) + if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0) continue; int x = pPlayer->pSprite->x; int y = pPlayer->pSprite->y; @@ -260,9 +263,11 @@ static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite) static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite) { - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; int dx = pXSprite->targetX-pSprite->x; int dy = pXSprite->targetY-pSprite->y; @@ -277,9 +282,11 @@ static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite) static void MoveDodgeUp(spritetype *pSprite, XSPRITE *pXSprite) { int nSprite = pSprite->index; - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; int nTurnRange = (pDudeInfo->angSpeed<<2)>>4; @@ -303,9 +310,11 @@ static void MoveDodgeUp(spritetype *pSprite, XSPRITE *pXSprite) static void MoveDodgeDown(spritetype *pSprite, XSPRITE *pXSprite) { int nSprite = pSprite->index; - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; int nTurnRange = (pDudeInfo->angSpeed<<2)>>4; @@ -335,13 +344,17 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &ghostGoto); return; } - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; - if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) + ///dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) { + consoleSysMsg("pXSprite->target >= 0 && pXSprite->target < kMaxSprites"); return; - //dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + } spritetype *pTarget = &sprite[pXSprite->target]; XSPRITE *pXTarget = &xsprite[pTarget->extra]; int dx = pTarget->x-pSprite->x; @@ -352,7 +365,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &ghostSearch); return; } - if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) + if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { aiNewState(pSprite, pXSprite, &ghostSearch); return; @@ -439,9 +452,11 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) static void MoveForward(spritetype *pSprite, XSPRITE *pXSprite) { int nSprite = pSprite->index; - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; int nTurnRange = (pDudeInfo->angSpeed<<2)>>4; @@ -474,9 +489,11 @@ static void MoveForward(spritetype *pSprite, XSPRITE *pXSprite) static void MoveSlow(spritetype *pSprite, XSPRITE *pXSprite) { int nSprite = pSprite->index; - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; int nTurnRange = (pDudeInfo->angSpeed<<2)>>4; @@ -513,9 +530,11 @@ static void MoveSlow(spritetype *pSprite, XSPRITE *pXSprite) static void MoveSwoop(spritetype *pSprite, XSPRITE *pXSprite) { int nSprite = pSprite->index; - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; int nTurnRange = (pDudeInfo->angSpeed<<2)>>4; @@ -551,9 +570,11 @@ static void MoveSwoop(spritetype *pSprite, XSPRITE *pXSprite) static void MoveFly(spritetype *pSprite, XSPRITE *pXSprite) { int nSprite = pSprite->index; - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; int nTurnRange = (pDudeInfo->angSpeed<<2)>>4; diff --git a/source/blood/src/aigilbst.cpp b/source/blood/src/aigilbst.cpp index ecd3e2a80..267fa402d 100644 --- a/source/blood/src/aigilbst.cpp +++ b/source/blood/src/aigilbst.cpp @@ -159,7 +159,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &gillBeastSearch); return; } - if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) + if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { XSECTOR *pXSector; int nXSector = sector[pSprite->sectnum].extra; @@ -279,7 +279,7 @@ static void thinkSwimChase(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &gillBeastSwimSearch); return; } - if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) + if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { aiNewState(pSprite, pXSprite, &gillBeastSwimSearch); return; diff --git a/source/blood/src/aihand.cpp b/source/blood/src/aihand.cpp index ec6e84866..b3374be0c 100644 --- a/source/blood/src/aihand.cpp +++ b/source/blood/src/aihand.cpp @@ -116,7 +116,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &handSearch); return; } - if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) + if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { aiNewState(pSprite, pXSprite, &handSearch); return; diff --git a/source/blood/src/aihound.cpp b/source/blood/src/aihound.cpp index 275e12cef..2eb18ff94 100644 --- a/source/blood/src/aihound.cpp +++ b/source/blood/src/aihound.cpp @@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "mmulti.h" #include "common_game.h" + #include "actor.h" #include "ai.h" #include "aihound.h" @@ -69,13 +70,17 @@ static void BiteSeqCallback(int, int nXSprite) spritetype *pSprite = &sprite[nSprite]; int dx = Cos(pSprite->ang)>>16; int dy = Sin(pSprite->ang)>>16; - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } - if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) + ///dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) { + consoleSysMsg("pXSprite->target >= 0 && pXSprite->target < kMaxSprites"); return; - //dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + } spritetype *pTarget = &sprite[pXSprite->target]; if (IsPlayerSprite(pTarget) || !VanillaMode()) // allow to hit non-player targets if not a demo actFireVector(pSprite, 0, 0, dx, dy, pTarget->z-pSprite->z, VECTOR_TYPE_15); @@ -97,9 +102,11 @@ static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite) static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite) { - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; int dx = pXSprite->targetX-pSprite->x; @@ -119,13 +126,17 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &houndGoto); return; } - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; - if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) + ///dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) { + consoleSysMsg("pXSprite->target >= 0 && pXSprite->target < kMaxSprites"); return; - //dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + } spritetype *pTarget = &sprite[pXSprite->target]; XSPRITE *pXTarget = &xsprite[pTarget->extra]; int dx = pTarget->x-pSprite->x; @@ -136,7 +147,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &houndSearch); return; } - if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) + if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { aiNewState(pSprite, pXSprite, &houndSearch); return; diff --git a/source/blood/src/aipod.cpp b/source/blood/src/aipod.cpp index 186f97f02..b2af4f987 100644 --- a/source/blood/src/aipod.cpp +++ b/source/blood/src/aipod.cpp @@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "mmulti.h" #include "common_game.h" + #include "actor.h" #include "ai.h" #include "aipod.h" @@ -93,13 +94,19 @@ static void sub_6FFA0(int, int nXSprite) XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; spritetype *pSprite = &sprite[nSprite]; - if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) + ///dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) { + consoleSysMsg("pXSprite->target >= 0 && pXSprite->target < kMaxSprites"); return; - //dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + } + spritetype *pTarget = &sprite[pXSprite->target]; - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase]; int x = pTarget->x-pSprite->x; int y = pTarget->y-pSprite->y; @@ -171,9 +178,11 @@ static void sub_7034C(spritetype *pSprite, XSPRITE *pXSprite) static void sub_70380(spritetype *pSprite, XSPRITE *pXSprite) { - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; int dx = pXSprite->targetX-pSprite->x; @@ -211,13 +220,17 @@ static void sub_704D8(spritetype *pSprite, XSPRITE *pXSprite) } return; } - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; - if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) + ///dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) { + consoleSysMsg("pXSprite->target >= 0 && pXSprite->target < kMaxSprites"); return; - //dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + } spritetype *pTarget = &sprite[pXSprite->target]; XSPRITE *pXTarget = &xsprite[pTarget->extra]; int dx = pTarget->x-pSprite->x; diff --git a/source/blood/src/airat.cpp b/source/blood/src/airat.cpp index dc0e4b0cc..56b61da17 100644 --- a/source/blood/src/airat.cpp +++ b/source/blood/src/airat.cpp @@ -113,7 +113,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &ratSearch); return; } - if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) + if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { aiNewState(pSprite, pXSprite, &ratSearch); return; diff --git a/source/blood/src/aispid.cpp b/source/blood/src/aispid.cpp index 3918bef63..78166d2c0 100644 --- a/source/blood/src/aispid.cpp +++ b/source/blood/src/aispid.cpp @@ -110,8 +110,8 @@ static void SpidBiteSeqCallback(int, int nXSprite) switch (pSprite->type) { case kDudeSpiderBrown: actFireVector(pSprite, 0, 0, dx, dy, dz, VECTOR_TYPE_17); - if (IsPlayerSprite(pTarget) && !pPlayer->at31a && powerupCheck(pPlayer, 14) <= 0 && Chance(0x4000)) - powerupActivate(pPlayer, 28); + if (IsPlayerSprite(pTarget) && !pPlayer->at31a && powerupCheck(pPlayer, kPwUpDeathMask) <= 0 && Chance(0x4000)) + powerupActivate(pPlayer, kPwUpDeliriumShroom); break; case kDudeSpiderRed: actFireVector(pSprite, 0, 0, dx, dy, dz, VECTOR_TYPE_17); @@ -238,7 +238,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &spidSearch); return; } - if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) + if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { aiNewState(pSprite, pXSprite, &spidSearch); return; diff --git a/source/blood/src/aitchern.cpp b/source/blood/src/aitchern.cpp index 0f7a73677..8e5503ddf 100644 --- a/source/blood/src/aitchern.cpp +++ b/source/blood/src/aitchern.cpp @@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "mmulti.h" #include "common_game.h" + #include "actor.h" #include "ai.h" #include "aitchern.h" @@ -89,9 +90,11 @@ static void sub_71BD4(int, int nXSprite) spritetype *pSprite = &sprite[nSprite]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase]; int height = pSprite->yrepeat*pDudeInfo->eyeHeight; - if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) + ///dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) { + consoleSysMsg("pXSprite->target >= 0 && pXSprite->target < kMaxSprites"); return; - //dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + } int x = pSprite->x; int y = pSprite->y; int z = height; @@ -159,9 +162,11 @@ static void sub_720AC(int, int nXSprite) XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; spritetype *pSprite = &sprite[nSprite]; - if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) + ///dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) { + consoleSysMsg("pXSprite->target >= 0 && pXSprite->target < kMaxSprites"); return; - //dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase]; int height = pSprite->yrepeat*pDudeInfo->eyeHeight; int ax, ay, az; @@ -238,9 +243,11 @@ static void sub_72580(spritetype *pSprite, XSPRITE *pXSprite) static void sub_725A4(spritetype *pSprite, XSPRITE *pXSprite) { - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase]; DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2; if (pDudeExtraE->at4 && pDudeExtraE->at0 < 10) @@ -258,7 +265,7 @@ static void sub_725A4(spritetype *pSprite, XSPRITE *pXSprite) for (int p = connecthead; p >= 0; p = connectpoint2[p]) { PLAYER *pPlayer = &gPlayer[p]; - if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, 13) > 0) + if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0) continue; int x = pPlayer->pSprite->x; int y = pPlayer->pSprite->y; @@ -293,9 +300,11 @@ static void sub_725A4(spritetype *pSprite, XSPRITE *pXSprite) static void sub_72850(spritetype *pSprite, XSPRITE *pXSprite) { - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; int dx = pXSprite->targetX-pSprite->x; int dy = pXSprite->targetY-pSprite->y; @@ -314,13 +323,17 @@ static void sub_72934(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &tcherno13A9B8); return; } - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) + ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { + consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); return; - //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); + } DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; - if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) + ///dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) { + consoleSysMsg("pXSprite->target >= 0 && pXSprite->target < kMaxSprites"); return; - //dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); + } spritetype *pTarget = &sprite[pXSprite->target]; XSPRITE *pXTarget = &xsprite[pTarget->extra]; int dx = pTarget->x-pSprite->x; @@ -331,7 +344,7 @@ static void sub_72934(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &tchernobogSearch); return; } - if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) + if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { aiNewState(pSprite, pXSprite, &tchernobogSearch); return; diff --git a/source/blood/src/aiunicult.cpp b/source/blood/src/aiunicult.cpp index 11405230c..74dadd9d2 100644 --- a/source/blood/src/aiunicult.cpp +++ b/source/blood/src/aiunicult.cpp @@ -411,7 +411,7 @@ static void thinkChase( spritetype* pSprite, XSPRITE* pXSprite ) if (IsPlayerSprite(pTarget)) { PLAYER* pPlayer = &gPlayer[ pTarget->type - kDudePlayer1 ]; - if (powerupCheck( pPlayer, 13 ) > 0) { + if (powerupCheck(pPlayer, kPwUpShadowCloak) > 0) { if(spriteIsUnderwater(pSprite,false)) aiNewState(pSprite, pXSprite, &GDXGenDudeSearchW); else aiNewState(pSprite, pXSprite, &GDXGenDudeSearchL); return; @@ -829,7 +829,7 @@ bool sfxPlayGDXGenDudeSound(spritetype* pSprite, int mode) { bool spriteIsUnderwater(spritetype* pSprite,bool oldWay) { if (oldWay){ - if (xsprite[pSprite->extra].medium == 1 || xsprite[pSprite->extra].medium == 2) + if (xsprite[pSprite->extra].medium == kMediumWater || xsprite[pSprite->extra].medium == kMediumGoo) return true; return false; } @@ -858,7 +858,7 @@ void removeDudeStuff(spritetype* pSprite) { case kThingArmedProxBomb: case kThingArmedRemoteBomb: case kModernThingTNTProx: - sprite[nSprite].type = 0; + sprite[nSprite].type = kSpriteDecoration; actPostSprite(sprite[nSprite].xvel, kStatFree); break; case kModernThingEnemyLifeLeech: @@ -885,7 +885,7 @@ void removeLeech(spritetype* pLeech, bool delSprite) { } sfxPlay3DSoundCP(pLeech, 490, -1, 0,60000); if (delSprite) { - pLeech->type = 0; + pLeech->type = kSpriteDecoration; actPostSprite(pLeech->index, kStatFree); } } diff --git a/source/blood/src/aizomba.cpp b/source/blood/src/aizomba.cpp index 23b67cd4a..57a47f025 100644 --- a/source/blood/src/aizomba.cpp +++ b/source/blood/src/aizomba.cpp @@ -145,7 +145,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &zombieASearch); return; } - if (IsPlayerSprite(pTarget) && (powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0 || powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 31) > 0)) + if (IsPlayerSprite(pTarget) && (powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0 || powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpDeathMaskUseless) > 0)) { aiNewState(pSprite, pXSprite, &zombieAGoto); return; @@ -191,7 +191,7 @@ static void thinkPonder(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &zombieASearch); return; } - if (IsPlayerSprite(pTarget) && (powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0 || powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 31) > 0)) + if (IsPlayerSprite(pTarget) && (powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0 || powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpDeathMaskUseless) > 0)) { aiNewState(pSprite, pXSprite, &zombieAGoto); return; @@ -230,7 +230,7 @@ static void myThinkTarget(spritetype *pSprite, XSPRITE *pXSprite) { PLAYER *pPlayer = &gPlayer[p]; int nOwner = (pSprite->owner & 0x1000) ? (pSprite->owner&0xfff) : -1; - if (nOwner == pPlayer->at5b || pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, 13) > 0) + if (nOwner == pPlayer->at5b || pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0) continue; int x = pPlayer->pSprite->x; int y = pPlayer->pSprite->y; diff --git a/source/blood/src/aizombf.cpp b/source/blood/src/aizombf.cpp index 8c099a43d..f677a3995 100644 --- a/source/blood/src/aizombf.cpp +++ b/source/blood/src/aizombf.cpp @@ -153,7 +153,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &zombieFSearch); return; } - if (IsPlayerSprite(pTarget) && (powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0 || powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 31) > 0)) + if (IsPlayerSprite(pTarget) && (powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0 || powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpDeathMaskUseless) > 0)) { aiNewState(pSprite, pXSprite, &zombieFSearch); return; diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index d48682ef0..cb9eb5e2e 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -588,10 +588,6 @@ void StartLevel(GAMEOPTIONS *gameOptions) case kModernDudeTargetChanger: changespritestat(i, kStatModernDudeTargetChanger); break; - // add statnum for faster searching of already enabled qav players - case kModernPlayQAV: - changespritestat(i, kStatModernPlayQAV); - break; // remove kStatItem status from random item generators case kModernRandom: case kModernRandom2: diff --git a/source/blood/src/callback.cpp b/source/blood/src/callback.cpp index 163569ffa..4c2cfdc0e 100644 --- a/source/blood/src/callback.cpp +++ b/source/blood/src/callback.cpp @@ -649,7 +649,7 @@ void DropVoodoo(int nSprite) // unused if (gGameOptions.nGameType == 3 && pPlayer->at2ea == pPlayer2->at2ea) continue; int t = 0x8000/ClipLow(gNetPlayers-1, 1); - if (!powerupCheck(pPlayer2, 14)) + if (!powerupCheck(pPlayer2, kPwUpDeathMask)) t += ((3200-pPlayer2->at33e[2])<<15)/3200; if (Chance(t) || nNextSprite < 0) { diff --git a/source/blood/src/common.cpp b/source/blood/src/common.cpp index b31aa15dc..d7ec42738 100644 --- a/source/blood/src/common.cpp +++ b/source/blood/src/common.cpp @@ -80,6 +80,7 @@ const char *G_DefFile(void) return (g_defNamePtr == NULL) ? G_DefaultDefFile() : g_defNamePtr; } + void G_SetupGlobalPsky(void) { int skyIdx = 0; diff --git a/source/blood/src/common_game.h b/source/blood/src/common_game.h index 74e5b41f0..21a37737f 100644 --- a/source/blood/src/common_game.h +++ b/source/blood/src/common_game.h @@ -42,6 +42,7 @@ void _SetErrorLoc(const char *pzFile, int nLine); void _ThrowError(const char *pzFormat, ...); void __dassert(const char *pzExpr, const char *pzFile, int nLine); void QuitGame(void); +void _consoleSysMsg(const char* pMessage, ...); #define ThrowError(...) \ { \ @@ -49,8 +50,16 @@ void QuitGame(void); _ThrowError(__VA_ARGS__); \ } +// print error to console only +#define consoleSysMsg(...) \ + { \ + _SetErrorLoc(__FILE__,__LINE__); \ + _consoleSysMsg(__VA_ARGS__); \ + } + #define dassert(x) if (!(x)) __dassert(#x,__FILE__,__LINE__) + #define kMaxSectors MAXSECTORS #define kMaxWalls MAXWALLS #define kMaxSprites MAXSPRITES @@ -70,32 +79,6 @@ void QuitGame(void); #define kExplodeMax 8 - - -#define kMaxPowerUps 51 - -#define kStatNothing -1 -#define kStatDecoration 0 -#define kStatFX 1 -#define kStatExplosion 2 -#define kStatItem 3 -#define kStatThing 4 -#define kStatProjectile 5 -#define kStatDude 6 -#define kStatInactive 7 // inactive (ambush) dudes -#define kStatRespawn 8 -#define kStatPurge 9 -#define kStatMarker 10 -#define kStatTraps 11 -#define kStatAmbience 12 -#define kStatSpares 13 -#define kStatFlare 14 -#define kStatDebris 15 -#define kStatPathMarker 16 -#define kStatModernDudeTargetChanger 20 // gModernMap only -#define kStatModernPlayQAV 21 // gModernMap only -#define kStatFree 1024 - #define kLensSize 80 #define kViewEffectMax 19 @@ -105,7 +88,61 @@ void QuitGame(void); // defined by NoOne: // ------------------------------- #define kMaxPAL 5 +#define kFreeQAVEntry 108 +// MEDIUM ///////////////////////////////////////////////////// +enum { +kMediumNormal = 0, +kMediumWater = 1, +kMediumGoo = 2, +}; + +// STATNUMS ///////////////////////////////////////////////////// +enum { +kStatNothing = -1, +kStatDecoration = 0, +kStatFX = 1, +kStatExplosion = 2, +kStatItem = 3, +kStatThing = 4, +kStatProjectile = 5, +kStatDude = 6, +kStatInactive = 7, // inactive (ambush) dudes +kStatRespawn = 8, +kStatPurge = 9, +kStatMarker = 10, +kStatTraps = 11, +kStatAmbience = 12, +kStatSpares = 13, +kStatFlare = 14, +kStatDebris = 15, +kStatPathMarker = 16, +kStatModernDudeTargetChanger = 20, // gModernMap only +kStatFree = 1024, +}; + + +// POWERUPS ///////////////////////////////////////////////////// +enum { +kPwUpFeatherFall = 12, +kPwUpShadowCloak = 13, +kPwUpDeathMask = 14, +kPwUpJumpBoots = 15, +kPwUpTwoGuns = 17, +kPwUpDivingSuit = 18, +kPwUpGasMask = 19, +kPwUpCrystalBall = 21, +kPwUpDoppleganger = 23, +kPwUpReflectShots = 24, +kPwUpBeastVision = 25, +kPwUpShadowCloakUseless = 26, +kPwUpDeliriumShroom = 28, +kPwUpGrowShroom = 29, +kPwUpShrinkShroom = 30, +kPwUpDeathMaskUseless = 31, +kPwUpAsbestArmor = 39, +kMaxPowerUps = 51, +}; // SPRITE TYPES ///////////////////////////////////////////////// enum { @@ -154,7 +191,7 @@ enum { kModernEffectSpawner = 38, kModernWindGenerator = 39, kModernConcussSprite = 712, /// WIP - kModernPlayQAV = 713, /// WIP + kModernPlayerControl = 713, /// WIP // decorations kDecorationTorch = 30, @@ -209,8 +246,8 @@ enum { kItemReflectShots = 124, kItemBeastVision = 125, kItemShroomDelirium = 128, - kItemShroomGrow = 129, // gModernMap = only - kItemShroomShrink = 130, // gModernMap = only + kItemShroomGrow = 129, // gModernMap only + kItemShroomShrink = 130, // gModernMap only kItemArmorAsbest = 139, kItemArmorBasic = 140, diff --git a/source/blood/src/eventq.h b/source/blood/src/eventq.h index 616a09881..bb649668d 100644 --- a/source/blood/src/eventq.h +++ b/source/blood/src/eventq.h @@ -100,7 +100,8 @@ enum COMMAND_ID { kCmdModernUse = 53, // used by most of modern types kCmdNumberic = 64, // 64: 0, 65: 1 and so on up to 255 kCmdModernFeaturesEnable = 100, // must be in object with kChannelMapExtended RX / TX - kCmdModernFeaturesDisable = 200 // must be in object with kChannelMapExtended RX / TX + kCmdModernFeaturesDisable = 200, // must be in object with kChannelMapExtended RX / TX + kCmdNumbericMax = 255, }; struct EVENT { diff --git a/source/blood/src/globals.cpp b/source/blood/src/globals.cpp index 738274e25..153697ea2 100644 --- a/source/blood/src/globals.cpp +++ b/source/blood/src/globals.cpp @@ -72,6 +72,19 @@ void _ThrowError(const char *pzFormat, ...) QuitGame(); } +// by NoOne: show warning msgs in game instead of throwing errors (in some cases) +void _consoleSysMsg(const char* pzFormat, ...) { + + char buffer[1024]; + va_list args; + va_start(args, pzFormat); + vsprintf(buffer, pzFormat, args); + initprintf("%s(%i): %s\n", _module, _line, buffer); + + OSD_Printf(OSDTEXT_RED "%s(%i): %s\n", _module, _line, buffer); +} + + void __dassert(const char * pzExpr, const char * pzFile, int nLine) { initprintf("Assertion failed: %s in file %s at line %i\n", pzExpr, pzFile, nLine); diff --git a/source/blood/src/messages.cpp b/source/blood/src/messages.cpp index 47706f498..4508a5291 100644 --- a/source/blood/src/messages.cpp +++ b/source/blood/src/messages.cpp @@ -201,91 +201,91 @@ void SetWooMode(bool stat) { if (stat) { - if (!powerupCheck(gMe, 17)) - powerupActivate(gMe, 17); + if (!powerupCheck(gMe, kPwUpTwoGuns)) + powerupActivate(gMe, kPwUpTwoGuns); } else { - if (powerupCheck(gMe, 17)) + if (powerupCheck(gMe, kPwUpTwoGuns)) { if (!VanillaMode()) - gMe->at202[17] = 0; - powerupDeactivate(gMe, 17); + gMe->at202[kPwUpTwoGuns] = 0; + powerupDeactivate(gMe, kPwUpTwoGuns); } } } void ToggleWooMode(void) { - SetWooMode(!(powerupCheck(gMe, 17) != 0)); + SetWooMode(!(powerupCheck(gMe, kPwUpTwoGuns) != 0)); } void ToggleBoots(void) { - if (powerupCheck(gMe, 15)) + if (powerupCheck(gMe, kPwUpJumpBoots)) { viewSetMessage("You have no Jumping Boots."); if (!VanillaMode()) { - gMe->at202[15] = 0; + gMe->at202[kPwUpJumpBoots] = 0; gMe->packInfo[4].at1 = 0; } - powerupDeactivate(gMe, 15); + powerupDeactivate(gMe, kPwUpJumpBoots); } else { viewSetMessage("You have the Jumping Boots."); if (!VanillaMode()) - gMe->at202[15] = gPowerUpInfo[15].at3; - powerupActivate(gMe, 15); + gMe->at202[kPwUpJumpBoots] = gPowerUpInfo[kPwUpJumpBoots].bonusTime; + powerupActivate(gMe, kPwUpJumpBoots); } } void ToggleInvisibility(void) { - if (powerupCheck(gMe, 13)) + if (powerupCheck(gMe, kPwUpShadowCloak)) { viewSetMessage("You are visible."); if (!VanillaMode()) - gMe->at202[13] = 0; - powerupDeactivate(gMe, 13); + gMe->at202[kPwUpShadowCloak] = 0; + powerupDeactivate(gMe, kPwUpShadowCloak); } else { viewSetMessage("You are invisible."); - powerupActivate(gMe, 13); + powerupActivate(gMe, kPwUpShadowCloak); } } void ToggleInvulnerability(void) { - if (powerupCheck(gMe, 14)) + if (powerupCheck(gMe, kPwUpDeathMask)) { viewSetMessage("You are vulnerable."); if (!VanillaMode()) - gMe->at202[14] = 0; - powerupDeactivate(gMe, 14); + gMe->at202[kPwUpDeathMask] = 0; + powerupDeactivate(gMe, kPwUpDeathMask); } else { viewSetMessage("You are invulnerable."); - powerupActivate(gMe, 14); + powerupActivate(gMe, kPwUpDeathMask); } } void ToggleDelirium(void) { - if (powerupCheck(gMe, 28)) + if (powerupCheck(gMe, kPwUpDeliriumShroom)) { viewSetMessage("You are not delirious."); if (!VanillaMode()) - gMe->at202[28] = 0; - powerupDeactivate(gMe, 28); + gMe->at202[kPwUpDeliriumShroom] = 0; + powerupDeactivate(gMe, kPwUpDeliriumShroom); } else { viewSetMessage("You are delirious."); - powerupActivate(gMe, 28); + powerupActivate(gMe, kPwUpDeliriumShroom); } } @@ -832,7 +832,7 @@ void CCheatMgr::Process(CCheatMgr::CHEATCODE nCheatCode, char* pzArgs) case kCheatCheeseHead: gMe->packInfo[1].at1 = 100; if (!VanillaMode()) - gMe->at202[18] = gPowerUpInfo[18].at3; + gMe->at202[kPwUpDivingSuit] = gPowerUpInfo[kPwUpDivingSuit].bonusTime; break; case kCheatTequila: ToggleWooMode(); @@ -885,7 +885,7 @@ void CCheatMgr::Process(CCheatMgr::CHEATCODE nCheatCode, char* pzArgs) actHealDude(gMe->pXSprite,200,200); gMe->packInfo[1].at1 = 100; if (!VanillaMode()) - gMe->at202[18] = gPowerUpInfo[18].at3; + gMe->at202[kPwUpDivingSuit] = gPowerUpInfo[kPwUpDivingSuit].bonusTime; break; case kCheatForkYou: SetInfiniteAmmo(false); @@ -896,7 +896,7 @@ void CCheatMgr::Process(CCheatMgr::CHEATCODE nCheatCode, char* pzArgs) SetToys(false); SetKeys(false); SetWooMode(true); - powerupActivate(gMe, 28); + powerupActivate(gMe, kPwUpDeliriumShroom); gMe->pXSprite->health = 16; gMe->atcb[1] = 1; gMe->atbd = 0; diff --git a/source/blood/src/player.cpp b/source/blood/src/player.cpp index df1c2ad54..dcb6fc91a 100644 --- a/source/blood/src/player.cpp +++ b/source/blood/src/player.cpp @@ -64,72 +64,87 @@ PLAYER *gMe, *gView; bool gBlueFlagDropped = false; bool gRedFlagDropped = false; +// V = has effect in game, X = no effect in game POWERUPINFO gPowerUpInfo[kMaxPowerUps] = { - { -1, 1, 1, 1 }, - { -1, 1, 1, 1 }, - { -1, 1, 1, 1 }, - { -1, 1, 1, 1 }, - { -1, 1, 1, 1 }, - { -1, 1, 1, 1 }, - { -1, 1, 1, 1 }, - { -1, 0, 100, 100 }, - { -1, 0, 50, 100 }, - { -1, 0, 20, 100 }, - { -1, 0, 100, 200 }, - { -1, 0, 2, 200 }, - { 783, 0, 3600, 432000 }, - { -1, 0, 3600, 432000 }, // 13: cloak of invisibility - { -1, 1, 3600, 432000 }, // 14: death mask (invulnerability) - { 827, 0, 3600, 432000 }, // 15: jump boots - { 828, 0, 3600, 432000 }, - { -1, 0, 3600, 1728000 }, // 17: guns akimbo - { -1, 0, 3600, 432000 }, // 18: diving suit - { -1, 0, 3600, 432000 }, - { -1, 0, 3600, 432000 }, - { -1, 0, 3600, 432000 }, // 21: crystal ball - { -1, 0, 3600, 432000 }, - { 851, 0, 3600, 432000 }, - { 2428, 0, 3600, 432000 }, // 24: reflective shots - { -1, 0, 3600, 432000 }, // 25: beast vision - { -1, 0, 3600, 432000 }, // 26: cloak of shadow - { -1, 0, 3600, 432000 }, - { -1, 0, 900, 432000 }, - { -1, 0, 3600, 432000 }, - { -1, 0, 3600, 432000 }, - { -1, 0, 3600, 432000 }, - { -1, 0, 3600, 432000 }, - { -1, 0, 3600, 432000 }, - { -1, 0, 3600, 432000 }, - { -1, 0, 3600, 432000 }, - { -1, 0, 3600, 432000 }, - { -1, 0, 3600, 432000 }, - { -1, 0, 3600, 432000 }, - { -1, 1, 3600, 432000 }, - { -1, 0, 1, 432000 }, - { -1, 0, 1, 432000 }, - { -1, 0, 1, 432000 }, - { -1, 0, 1, 432000 }, - { -1, 0, 1, 432000 }, - { 0, 0, 0, 0 }, - { 0, 0, 0, 0 }, - { 0, 0, 0, 0 }, - { 0, 0, 0, 0 }, - { 0, 0, 0, 0 }, // dummy - { -1, 1, 1, 1 } // kGDXItemLevelMap + { -1, 1, 1, 1 }, // 00: V keys + { -1, 1, 1, 1 }, // 01: V keys + { -1, 1, 1, 1 }, // 02: V keys + { -1, 1, 1, 1 }, // 03: V keys + { -1, 1, 1, 1 }, // 04: V keys + { -1, 1, 1, 1 }, // 05: V keys + { -1, 1, 1, 1 }, // 06: V keys + { -1, 0, 100, 100 }, // 07: V doctor's bag + { -1, 0, 50, 100 }, // 08: V medicine pouch + { -1, 0, 20, 100 }, // 09: V life essense + { -1, 0, 100, 200 }, // 10: V life seed + { -1, 0, 2, 200 }, // 11: V red potion + { 783, 0, 3600, 432000 }, // 12: V feather fall + { 896, 0, 3600, 432000 }, // 13: V cloak of invisibility + { 825, 1, 3600, 432000 }, // 14: V death mask (invulnerability) + { 827, 0, 3600, 432000 }, // 15: V jump boots + { 828, 0, 3600, 432000 }, // 16: X raven flight + { 829, 0, 3600, 1728000 }, // 17: V guns akimbo + { 830, 0, 3600, 432000 }, // 18: V diving suit + { 831, 0, 3600, 432000 }, // 19: V gas mask + { -1, 0, 3600, 432000 }, // 20: X clone + { 2566, 0, 3600, 432000 }, // 21: V crystal ball + { 836, 0, 3600, 432000 }, // 22: X decoy + { 853, 0, 3600, 432000 }, // 23: V doppleganger + { 2428, 0, 3600, 432000 }, // 24: V reflective shots + { 839, 0, 3600, 432000 }, // 25: V beast vision + { 768, 0, 3600, 432000 }, // 26: X cloak of shadow (useless) + { 840, 0, 3600, 432000 }, // 27: X rage shroom + { 841, 0, 900, 432000 }, // 28: V delirium shroom + { 842, 0, 3600, 432000 }, // 29: V grow shroom (gModernMap only) + { 843, 0, 3600, 432000 }, // 30: V shrink shroom (gModernMap only) + { -1, 0, 3600, 432000 }, // 31: X death mask (useless) + { -1, 0, 3600, 432000 }, // 32: X wine goblet + { -1, 0, 3600, 432000 }, // 33: X wine bottle + { -1, 0, 3600, 432000 }, // 34: X skull grail + { -1, 0, 3600, 432000 }, // 35: X silver grail + { -1, 0, 3600, 432000 }, // 36: X tome + { -1, 0, 3600, 432000 }, // 37: X black chest + { -1, 0, 3600, 432000 }, // 38: X wooden chest + { 837, 1, 3600, 432000 }, // 39: V asbestos armor + { -1, 0, 1, 432000 }, // 40: V basic armor + { -1, 0, 1, 432000 }, // 41: V body armor + { -1, 0, 1, 432000 }, // 42: V fire armor + { -1, 0, 1, 432000 }, // 43: V spirit armor + { -1, 0, 1, 432000 }, // 44: V super armor + { 0, 0, 0, 0 }, // 45: ? unknown + { 0, 0, 0, 0 }, // 46: ? unknown + { 0, 0, 0, 0 }, // 47: ? unknown + { 0, 0, 0, 0 }, // 48: ? unknown + { 0, 0, 0, 0 }, // 49: X dummy + { 833, 1, 1, 1 } // 50: V kModernItemLevelMap (gModernMap only) }; int Handicap[] = { 144, 208, 256, 304, 368 }; +int gDefaultAccel[] = { + + // normal human + 0x4000, 0x1200, 0x2000, // stand (front, side, back) / crouch (front, side, back) / swim (front, side, back) + // normal beast + 0x4000, 0x1200, 0x2000, // stand (front, side, back) / crouch (front, side, back) / swim (front, side, back) + // shrink human + 10384, 2108, 2192, // stand (front, side, back) / crouch (front, side, back) / swim (front, side, back) + // grown human + 19384, 5608, 11192 // stand (front, side, back) / crouch (front, side, back) / swim (front, side, back) + +}; + + POSTURE gPosture[4][3] = { // normal human { { - 0x4000, - 0x4000, - 0x4000, + gDefaultAccel[0], + gDefaultAccel[0], + gDefaultAccel[0], 14, 17, 24, @@ -142,9 +157,9 @@ POSTURE gPosture[4][3] = { 0x90 }, { - 0x1200, - 0x1200, - 0x1200, + gDefaultAccel[1], + gDefaultAccel[1], + gDefaultAccel[1], 14, 17, 24, @@ -157,9 +172,9 @@ POSTURE gPosture[4][3] = { 0xb0 }, { - 0x2000, - 0x2000, - 0x2000, + gDefaultAccel[2], + gDefaultAccel[2], + gDefaultAccel[2], 22, 28, 24, @@ -176,9 +191,9 @@ POSTURE gPosture[4][3] = { // normal beast { { - 0x4000, - 0x4000, - 0x4000, + gDefaultAccel[3], + gDefaultAccel[3], + gDefaultAccel[3], 14, 17, 24, @@ -191,9 +206,9 @@ POSTURE gPosture[4][3] = { 0x90 }, { - 0x1200, - 0x1200, - 0x1200, + gDefaultAccel[4], + gDefaultAccel[4], + gDefaultAccel[4], 14, 17, 24, @@ -206,9 +221,9 @@ POSTURE gPosture[4][3] = { 0xb0 }, { - 0x2000, - 0x2000, - 0x2000, + gDefaultAccel[5], + gDefaultAccel[5], + gDefaultAccel[5], 22, 28, 24, @@ -225,9 +240,9 @@ POSTURE gPosture[4][3] = { // shrink human { { - 10384, - 12384, - 12384, + gDefaultAccel[6], + gDefaultAccel[6], + gDefaultAccel[6], 14, 17, 24, @@ -240,9 +255,9 @@ POSTURE gPosture[4][3] = { 144 }, { - 2108, - 2108, - 2108, + gDefaultAccel[7], + gDefaultAccel[7], + gDefaultAccel[7], 14, 17, 24, @@ -255,9 +270,9 @@ POSTURE gPosture[4][3] = { 176 }, { - 2192, - 3192, - 4192, + gDefaultAccel[8], + gDefaultAccel[8], + gDefaultAccel[8], 22, 28, 24, @@ -274,9 +289,9 @@ POSTURE gPosture[4][3] = { // grown human { { - 19384, - 15384, - 15384, + gDefaultAccel[9], + gDefaultAccel[9], + gDefaultAccel[9], 14, 17, 24, @@ -289,9 +304,9 @@ POSTURE gPosture[4][3] = { 144 }, { - 5608, - 5608, - 5608, + gDefaultAccel[10], + gDefaultAccel[10], + gDefaultAccel[10], 14, 17, 24, @@ -304,9 +319,9 @@ POSTURE gPosture[4][3] = { 176 }, { - 11192, - 11192, - 11192, + gDefaultAccel[11], + gDefaultAccel[11], + gDefaultAccel[11], 22, 28, 24, @@ -431,11 +446,15 @@ int powerupCheck(PLAYER *pPlayer, int nPowerUp) } bool isGrown(spritetype* pSprite) { - return (powerupCheck(&gPlayer[pSprite->type - kDudePlayer1], 29) > 0); + if (powerupCheck(&gPlayer[pSprite->type - kDudePlayer1], kPwUpGrowShroom) > 0) return true; + else if (pSprite->extra >= 0 && xsprite[pSprite->extra].scale >= 512) return true; + else return false; } bool isShrinked(spritetype* pSprite) { - return (powerupCheck(&gPlayer[pSprite->type - kDudePlayer1], 30) > 0); + if (powerupCheck(&gPlayer[pSprite->type - kDudePlayer1], kPwUpShrinkShroom) > 0) return true; + else if (pSprite->extra >= 0 && xsprite[pSprite->extra].scale > 0 && xsprite[pSprite->extra].scale <= 128) return true; + else return false; } bool shrinkPlayerSize(PLAYER* pPlayer, int divider) { @@ -447,6 +466,7 @@ bool shrinkPlayerSize(PLAYER* pPlayer, int divider) { bool growPlayerSize(PLAYER* pPlayer, int multiplier) { pPlayer->pXSprite->scale = 256*multiplier; playerSetRace(pPlayer, kModeHumanGrown); + viewSetSystemMessage("%d", pPlayer->pXSprite->scale); return true; } @@ -457,19 +477,34 @@ bool resetPlayerSize(PLAYER* pPlayer) { } void deactivateSizeShrooms(PLAYER* pPlayer) { - powerupDeactivate(pPlayer, 29); - pPlayer->at202[29] = 0; + powerupDeactivate(pPlayer, kPwUpGrowShroom); + pPlayer->at202[kPwUpGrowShroom] = 0; - powerupDeactivate(pPlayer, 30); - pPlayer->at202[30] = 0; + powerupDeactivate(pPlayer, kPwUpShrinkShroom); + pPlayer->at202[kPwUpShrinkShroom] = 0; } + +PLAYER* getPlayerById(short id) { + if (id > 0) { + for (int i = connecthead; i >= 0; i = connectpoint2[i]) { + if (id < kMaxPlayers && id == i + 1) return &gPlayer[i]; // relative to connected players + else if (id >= kDudePlayer1 && id <= kDudePlayer8 && id == gPlayer[i].pSprite->type) // absolute type + return &gPlayer[i]; + + + } + } + return NULL; +} + + char powerupActivate(PLAYER *pPlayer, int nPowerUp) { - if (powerupCheck(pPlayer, nPowerUp) > 0 && gPowerUpInfo[nPowerUp].at2) + if (powerupCheck(pPlayer, nPowerUp) > 0 && gPowerUpInfo[nPowerUp].pickupOnce) return 0; if (!pPlayer->at202[nPowerUp]) - pPlayer->at202[nPowerUp] = gPowerUpInfo[nPowerUp].at3; + pPlayer->at202[nPowerUp] = gPowerUpInfo[nPowerUp].bonusTime; int nPack = powerupToPackItem(nPowerUp); if (nPack >= 0) pPlayer->packInfo[nPack].at0 = 1; @@ -488,9 +523,9 @@ char powerupActivate(PLAYER *pPlayer, int nPowerUp) else if (isShrinked(pPlayer->pSprite)) deactivateSizeShrooms(pPlayer); else { growPlayerSize(pPlayer, 2); - if (powerupCheck(&gPlayer[pPlayer->pSprite->type - kDudePlayer1], 13) > 0) { - powerupDeactivate(pPlayer, 13); - pPlayer->at202[13] = 0; + if (powerupCheck(&gPlayer[pPlayer->pSprite->type - kDudePlayer1], kPwUpShadowCloak) > 0) { + powerupDeactivate(pPlayer, kPwUpShadowCloak); + pPlayer->at202[kPwUpShadowCloak] = 0; } if (ceilIsTooLow(pPlayer->pSprite)) @@ -596,7 +631,7 @@ void powerupProcess(PLAYER *pPlayer) { pPlayer->at202[i] = ClipLow(pPlayer->at202[i]-4, 0); if (pPlayer->at202[i]) - pPlayer->packInfo[nPack].at1 = (100*pPlayer->at202[i])/gPowerUpInfo[i].at3; + pPlayer->packInfo[nPack].at1 = (100*pPlayer->at202[i])/gPowerUpInfo[i].bonusTime; else { powerupDeactivate(pPlayer, i); @@ -629,46 +664,44 @@ void powerupInit(void) int packItemToPowerup(int nPack) { int nPowerUp = -1; - switch (nPack) - { - case 0: - break; - case 1: - nPowerUp = 18; - break; - case 2: - nPowerUp = 21; - break; - case 3: - nPowerUp = 25; - break; - case 4: - nPowerUp = 15; - break; - default: - ThrowError("Unhandled pack item %d", nPack); - break; + switch (nPack) { + case 0: + break; + case 1: + nPowerUp = kPwUpDivingSuit; + break; + case 2: + nPowerUp = kPwUpCrystalBall; + break; + case 3: + nPowerUp = kPwUpBeastVision; + break; + case 4: + nPowerUp = kPwUpJumpBoots; + break; + default: + ThrowError("Unhandled pack item %d", nPack); + break; } return nPowerUp; } int powerupToPackItem(int nPowerUp) { - const int jumpBoots = 15; - const int divingSuit = 18; - const int crystalBall = 21; - const int beastVision = 25; + //const int jumpBoots = kPwUpJumpBoots; + //const int divingSuit = kPwUpDivingSuit; + //const int crystalBall = kPwUpCrystalBall; + //const int beastVision = 25; - switch (nPowerUp) - { - case divingSuit: - return 1; - case crystalBall: - return 2; - case beastVision: - return 3; - case jumpBoots: - return 4; + switch (nPowerUp) { + case kPwUpDivingSuit: + return 1; + case kPwUpCrystalBall: + return 2; + case kPwUpBeastVision: + return 3; + case kPwUpJumpBoots: + return 4; } return -1; } @@ -682,7 +715,7 @@ char packAddItem(PLAYER *pPlayer, unsigned int nPack) pPlayer->packInfo[nPack].at1 = 100; int nPowerUp = packItemToPowerup(nPack); if (nPowerUp >= 0) - pPlayer->at202[nPowerUp] = gPowerUpInfo[nPowerUp].at3; + pPlayer->at202[nPowerUp] = gPowerUpInfo[nPowerUp].bonusTime; if (pPlayer->at321 == -1) pPlayer->at321 = nPack; if (!pPlayer->packInfo[pPlayer->at321].at1) @@ -725,19 +758,19 @@ void packUseItem(PLAYER *pPlayer, int nPack) } case 1: v4 = 1; - nPowerUp = 18; + nPowerUp = kPwUpDivingSuit; break; case 2: v4 = 1; - nPowerUp = 21; + nPowerUp = kPwUpCrystalBall; break; case 3: v4 = 1; - nPowerUp = 25; + nPowerUp = kPwUpBeastVision; break; case 4: v4 = 1; - nPowerUp = 15; + nPowerUp = kPwUpJumpBoots; break; default: ThrowError("Unhandled pack item %d", nPack); @@ -835,20 +868,14 @@ void playerCorrectInertia(PLAYER* pPlayer, vec3_t const *oldpos) void playerResetPowerUps(PLAYER* pPlayer) { - const int jumpBoots = 15; - const int divingSuit = 18; - const int crystalBall = 21; - const int beastVision = 25; + //const int jumpBoots = kPwUpJumpBoots; + //const int divingSuit = kPwUpDivingSuit; + //const int crystalBall = kPwUpCrystalBall; + //const int beastVision = 25; - for (int i = 0; i < kMaxPowerUps; i++) - { - if (!VanillaMode() - && (i == jumpBoots - || i == divingSuit - || i == crystalBall - || i == beastVision)) + for (int i = 0; i < kMaxPowerUps; i++) { + if (!VanillaMode() && (i == kPwUpJumpBoots || i == kPwUpDivingSuit || i == kPwUpCrystalBall || i == kPwUpBeastVision)) continue; - pPlayer->at202[i] = 0; } } @@ -990,7 +1017,7 @@ void playerStart(int nPlayer) if (IsUnderwaterSector(pSprite->sectnum)) { pPlayer->at2f = 1; - pPlayer->pXSprite->medium = 1; + pPlayer->pXSprite->medium = kMediumWater; } } @@ -1036,6 +1063,11 @@ void playerReset(PLAYER *pPlayer) pPlayer->packInfo[i].at0 = 0; pPlayer->packInfo[i].at1 = 0; } + + for (int i = 0; i < 4; i++) { + for (int a = 0; a < 3; a++) + gPosture[i][a].at0 = gPosture[i][a].at4 = gPosture[i][a].at8 = gDefaultAccel[a]; + } } int dword_21EFB0[8]; @@ -1244,12 +1276,12 @@ char PickupItem(PLAYER *pPlayer, spritetype *pItem) { case kItemHealthLifeEssense: case kItemHealthLifeSeed: case kItemHealthRedPotion: { - int addPower = gPowerUpInfo[nType].at3; + int addPower = gPowerUpInfo[nType].bonusTime; // by NoOne: allow custom amount for item if (gModernMap && sprite[pItem->xvel].extra >= 0 && xsprite[sprite[pItem->xvel].extra].data1 > 0) addPower = xsprite[sprite[pItem->xvel].extra].data1; - if (!actHealDude(pXSprite, addPower, gPowerUpInfo[nType].at7)) return 0; + if (!actHealDude(pXSprite, addPower, gPowerUpInfo[nType].maxTime)) return 0; return 1; } case kItemHealthDoctorBag: @@ -1940,7 +1972,7 @@ void playerProcess(PLAYER *pPlayer) pPlayer->at87 = 1; int nSector = pSprite->sectnum; int nLink = gLowerLink[nSector]; - if (nLink > 0 && (sprite[nLink].type == 14 || sprite[nLink].type == 10)) + if (nLink > 0 && (sprite[nLink].type == kMarkerLowGoo || sprite[nLink].type == kMarkerLowWater)) { if (getceilzofslope(nSector, pSprite->x, pSprite->y) > pPlayer->at67) pPlayer->at87 = 0; @@ -2195,7 +2227,7 @@ int playerDamageSprite(int nSource, PLAYER *pPlayer, DAMAGE_TYPE nDamageType, in nSound = pDamageInfo->at4[0]; else nSound = pDamageInfo->at4[Random(3)]; - if (nDamageType == DAMAGE_TYPE_4 && pXSprite->medium == 1 && !pPlayer->at376) + if (nDamageType == DAMAGE_TYPE_4 && pXSprite->medium == kMediumWater && !pPlayer->at376) nSound = 714; sfxPlay3DSound(pSprite, nSound, 0, 6); return nDamage; @@ -2235,7 +2267,7 @@ int playerDamageSprite(int nSource, PLAYER *pPlayer, DAMAGE_TYPE nDamageType, in sfxPlay3DSound(pSprite, pDamageInfo->at10[0], 0, 2); nDeathSeqID = 16; nKneelingPlayer = nPlayerKneelClient; - powerupActivate(pPlayer, 28); + powerupActivate(pPlayer, kPwUpDeliriumShroom); pXSprite->target = nSource; evPost(pSprite->index, 3, 15, kCallbackFinishHim); } diff --git a/source/blood/src/player.h b/source/blood/src/player.h index 1f3952516..a29e3784e 100644 --- a/source/blood/src/player.h +++ b/source/blood/src/player.h @@ -143,9 +143,9 @@ struct PLAYER { int at352; int at356; int at35a; // quake - int at35e; + int at35e; // tilt int at362; // light - int at366; + int at366; // pain int at36a; // blind int at36e; // choke int at372; @@ -159,6 +159,9 @@ struct PLAYER { int nWaterPal; }; +// by NoOne: defaut player movement speeds of all move states for gPosture +extern int gDefaultAccel[12]; + struct POSTURE { int at0; int at4; @@ -188,10 +191,10 @@ struct AMMOINFO { struct POWERUPINFO { - short at0; - char at2; - int at3; // max value - int at7; + short picnum; + bool pickupOnce; + int bonusTime; + int maxTime; }; extern POSTURE gPosture[4][3]; diff --git a/source/blood/src/sound.cpp b/source/blood/src/sound.cpp index ac9b20875..8f5a0e0ac 100644 --- a/source/blood/src/sound.cpp +++ b/source/blood/src/sound.cpp @@ -79,9 +79,9 @@ SAMPLE2D Channel[kMaxChannels]; SAMPLE2D * FindChannel(void) { for (int i = kMaxChannels - 1; i >= 0; i--) - if (Channel[i].at5 == 0) - return &Channel[i]; - ThrowError("No free channel available for sample"); + if (Channel[i].at5 == 0) return &Channel[i]; + consoleSysMsg("No free channel available for sample"); + //ThrowError("No free channel available for sample"); return NULL; } diff --git a/source/blood/src/triggers.cpp b/source/blood/src/triggers.cpp index 4d6460f1b..e7bea1a11 100644 --- a/source/blood/src/triggers.cpp +++ b/source/blood/src/triggers.cpp @@ -45,6 +45,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "loadsave.h" #include "player.h" #include "seq.h" +#include "qav.h" #include "sfx.h" #include "sound.h" #include "triggers.h" @@ -817,35 +818,107 @@ void OperateSprite(int nSprite, XSPRITE *pXSprite, EVENT event) break; } return; - case kModernPlayQAV: // WIP - PLAYER* pPlayer = &gPlayer[pXSprite->data1]; + case kModernPlayerControl: // WIP + PLAYER* pPlayer = NULL; + if ((pPlayer = getPlayerById(pXSprite->data1)) == NULL) return; + else if (event.cmd < kCmdNumberic) { // play qav as weapon qav switch (event.cmd) { case kCmdOff: - pPlayer->atbd = pXSprite->sysData1; - if (pXSprite->state == 1) SetSpriteState(nSprite, pXSprite, 0); - if (pPlayer->atbd != 0) + if (gQavPlayerIndex == nSprite) { + pXSprite->sysData1 = 0; + pPlayer->atc.newWeapon = pPlayer->atbd = pXSprite->data4; + gQavPlayerIndex = -1; WeaponRaise(pPlayer); + } break; - case kCmdOn: - evKill(nSprite, 3); // queue overflow protect - disableQAVPlayers(pSprite); - if (pXSprite->state == 0) SetSpriteState(nSprite, pXSprite, 1); - if (pPlayer->atbd != 0) { - pXSprite->sysData1 = pPlayer->atbd; // save current weapon + case kCmdOn: { + if (gQavPlayerIndex == nSprite && !pXSprite->Interrutable) break; + QAV* pQav = NULL; DICTNODE* hQav = gSysRes.Lookup(pXSprite->data2, "QAV"); + if (hQav) { + + pXSprite->data4 = pPlayer->atbd; + if (gQavPlayerIndex > -1 && gQavPlayerIndex != nSprite && sprite[gQavPlayerIndex].extra >= 0) { + pXSprite->data4 = xsprite[sprite[gQavPlayerIndex].extra].data4; + xsprite[sprite[gQavPlayerIndex].extra].data4 = 0; + } + WeaponLower(pPlayer); + + pQav = (QAV*)gSysRes.Load(hQav); weaponQAV[kFreeQAVEntry] = pQav; + pXSprite->busyTime = (((pQav->at10) / 12) * 120) / 10; + //pXSprite->busyTime = (((pQav->nFrames * pQav->ticksPerFrame) / 12) * 120) / 10; + pXSprite->sysData1 = pXSprite->waitTime; // how many times animation should be played + gQavPlayerIndex = nSprite; + } - fallthrough__; - case kCmdRepeat: - if (pPlayer->at26 != pXSprite->data2) - StartQAV(&gPlayer[pXSprite->data1], pXSprite->data2); - - if (pXSprite->busyTime > 0) evPost(nSprite, 3, pXSprite->busyTime, kCmdRepeat); break; + } default: - if (pXSprite->state == 0) evPost(nSprite, 3, 0, kCmdOn); + if (gQavPlayerIndex != nSprite) evPost(nSprite, 3, 0, kCmdOn); else evPost(nSprite, 3, 0, kCmdOff); break; } + } else if (event.cmd < kCmdNumbericMax) { + switch (event.cmd) { + case kCmdNumberic: // player life form + if (pXSprite->data2 >= kModeHuman || pXSprite->data2 <= kModeHumanShrink) { + playerSetRace(pPlayer, pXSprite->data2); + switch (pPlayer->at5f) { + case kModeHuman: + case kModeBeast: + resetPlayerSize(pPlayer); + break; + case kModeHumanShrink: + shrinkPlayerSize(pPlayer, 2); + break; + case kModeHumanGrown: + growPlayerSize(pPlayer, 2); + break; + } + } + break; + case kCmdNumberic + 1: // player movement speed (for all players ATM) + for (int i = (pSprite->flags & kModernTypeFlag1) ? pPlayer->at5f : 0; i < 4; i++) { + for (int a = 0; a < 3; a++) { + + int speed = pXSprite->data2 << 1; + if (speed > 0) speed = ClipRange(mulscale8(gDefaultAccel[a], speed), 0, 65535); + else if (speed < 0) speed = gDefaultAccel[a]; + + gPosture[i][a].at0 = gPosture[i][a].at4 = gPosture[i][a].at8 = speed; + + viewSetSystemMessage("%d", speed); + } + + if (pSprite->flags & kModernTypeFlag1) // for current lifeform only + break; + } + break; + case kCmdNumberic + 2: // player screen effects + if (pXSprite->data3 < 0) break; + switch (pXSprite->data2) { + case 1: // tilting + pPlayer->at35e = pXSprite->data3; + break; + case 2: // pain + pPlayer->at366 = pXSprite->data3; + break; + case 3: // blind + pPlayer->at36a = pXSprite->data3; + break; + case 4: // pickup + pPlayer->at377 = pXSprite->data3; + break; + case 5: // quake + pPlayer->at37f = pXSprite->data3; + break; + case 6: // visibility + pPlayer->at362 = pXSprite->data3; + break; + } + break; + } + } return; } } @@ -1344,7 +1417,7 @@ void usePropertiesChanger(XSPRITE* pXSource, short objType, int objIndex) { if (nIndex != -1) pXSprite->physAttr = flags; // just update physics attributes else if ((nIndex = debrisGetFreeIndex()) < 0) - ;// showWarning("Max (%d) Physics affected sprites reached!", kMaxSuperXSprites); + viewSetSystemMessage("Max (%d) Physics affected sprites reached!", kMaxSuperXSprites); else { pXSprite->physAttr = flags; // update physics attributes @@ -1474,8 +1547,8 @@ void useTeleportTarget(XSPRITE* pXSource, spritetype* pSprite) { TeleFrag(pSprite->xvel, pSource->sectnum); changespritesect((short)pSprite->xvel, pSource->sectnum); - if (pXSector != NULL && pXSector->Underwater) xsprite[pSprite->extra].medium = 1; - else xsprite[pSprite->extra].medium = 0; + if (pXSector != NULL && pXSector->Underwater) xsprite[pSprite->extra].medium = kMediumWater; + else xsprite[pSprite->extra].medium = kMediumNormal; if (pXSource->data2 == 1) pSprite->ang = pSource->ang; @@ -3790,14 +3863,6 @@ bool dudeCanSeeTarget(XSPRITE* pXDude, DUDEINFO* pDudeInfo, spritetype* pTarget) } -void disableQAVPlayers(spritetype* pException) { - for (int nSprite = headspritestat[kStatModernPlayQAV]; nSprite >= 0; nSprite = nextspritestat[nSprite]) { - if (nSprite == pException->index || sprite[nSprite].extra < 0) continue; - else if (xsprite[sprite[nSprite].extra].state == 1) - evPost(nSprite, 3, 0, kCmdOff); - } -} - // by NoOne: this function required if monsters in genIdle ai state. It wakes up monsters // when kModernDudeTargetChanger goes to off state, so they won't ignore the world. void activateDudes(int rx) { diff --git a/source/blood/src/triggers.h b/source/blood/src/triggers.h index 8596da82b..1e493a340 100644 --- a/source/blood/src/triggers.h +++ b/source/blood/src/triggers.h @@ -77,8 +77,6 @@ void useTeleportTarget(XSPRITE* pXSource, spritetype* pSprite); void usePropertiesChanger(XSPRITE* pXSource, short objType, int objIndex); void TeleFrag(int nKiller, int nSector); bool valueIsBetween(int val, int min, int max); -void disableQAVPlayers(spritetype* pException); - // ------------------------------------------------------- END_BLD_NS diff --git a/source/blood/src/view.cpp b/source/blood/src/view.cpp index 0479e63fb..0783c0740 100644 --- a/source/blood/src/view.cpp +++ b/source/blood/src/view.cpp @@ -569,7 +569,7 @@ void fakePlayerProcess(PLAYER *pPlayer, GINPUT *pInput) predict.at72 = 1; int nSector = predict.at68; int nLink = gLowerLink[nSector]; - if (nLink > 0 && (sprite[nLink].type == 14 || sprite[nLink].type == 10)) + if (nLink > 0 && (sprite[nLink].type == kMarkerLowGoo || sprite[nLink].type == kMarkerLowWater)) { if (getceilzofslope(nSector, predict.at50, predict.at54) > predict.at38) predict.at72 = 0; @@ -658,9 +658,9 @@ void fakeMoveDude(spritetype *pSprite) } int nUpperLink = gUpperLink[nSector]; int nLowerLink = gLowerLink[nSector]; - if (nUpperLink >= 0 && (sprite[nUpperLink].type == 9 || sprite[nUpperLink].type == 13)) + if (nUpperLink >= 0 && (sprite[nUpperLink].type == kMarkerUpWater || sprite[nUpperLink].type == kMarkerUpGoo)) bDepth = 1; - if (nLowerLink >= 0 && (sprite[nLowerLink].type == 10 || sprite[nLowerLink].type == 14)) + if (nLowerLink >= 0 && (sprite[nLowerLink].type == kMarkerLowWater || sprite[nLowerLink].type == kMarkerLowGoo)) bDepth = 1; if (pPlayer) wd += 16; @@ -1227,18 +1227,21 @@ void viewDrawPowerUps(PLAYER* pPlayer) if (!gPowerupDuration) return; - const int nCloakOfInvisibility = 13; - const int nReflectiveShots = 24; - const int nDeathMask = 14; // invulnerability - const int nGunsAkimbo = 17; - const int nCloakOfShadow = 26; // does nothing, only appears at near the end of Cryptic Passage's Lost Monastery (CP04) + // NoOne to author: the following powerups can be safely added in this list: + // kPwUpFeatherFall - (used in some user addons, makes player immune to fall damage) + // kPwUpGasMask - (used in some user addons, makes player immune to choke damage) + // kPwUpDoppleganger - (works in multiplayer, it swaps player's team colors, so enemy team player thinks it's a team mate) + // kPwUpAsbestArmor - (used in some user addons, makes player immune to fire damage and draws hud) + // kPwUpGrowShroom - (grows player size, works only if gModernMap == true) + // kPwUpShrinkShroom - (shrinks player size, works only if gModernMap == true) POWERUPDISPLAY powerups[5]; - powerups[0] = { 896, 0.4f, 0, pPlayer->at202[nCloakOfInvisibility] }; - powerups[1] = { 2428, 0.4f, 5, pPlayer->at202[nReflectiveShots] }; - powerups[2] = { 825, 0.3f, 9, pPlayer->at202[nDeathMask] }; - powerups[3] = { 829, 0.3f, 5, pPlayer->at202[nGunsAkimbo] }; - powerups[4] = { 768, 0.4f, 9, pPlayer->at202[nCloakOfShadow] }; + powerups[0] = { gPowerUpInfo[kPwUpShadowCloak].picnum, 0.4f, 0, pPlayer->at202[kPwUpShadowCloak] }; // invisibility + powerups[1] = { gPowerUpInfo[kPwUpReflectShots].picnum, 0.4f, 5, pPlayer->at202[kPwUpReflectShots] }; + powerups[2] = { gPowerUpInfo[kPwUpDeathMask].picnum, 0.3f, 9, pPlayer->at202[kPwUpDeathMask] }; // invulnerability + powerups[3] = { gPowerUpInfo[kPwUpTwoGuns].picnum, 0.3f, 5, pPlayer->at202[kPwUpTwoGuns] }; + // does nothing, only appears at near the end of Cryptic Passage's Lost Monastery (CP04) + powerups[4] = { gPowerUpInfo[kPwUpShadowCloakUseless].picnum, 0.4f, 9, pPlayer->at202[kPwUpShadowCloakUseless] }; sortPowerUps(powerups); @@ -2491,51 +2494,42 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t break; } } - viewApplyDefaultPal(pTSprite, pSector); - if (powerupCheck(gView, 25) > 0) - { - pTSprite->shade = -128; - } - if (IsPlayerSprite((spritetype *)pTSprite)) - { + + if (pXSector && pXSector->color) pTSprite->pal = pSector->floorpal; + if (powerupCheck(gView, kPwUpBeastVision) > 0) pTSprite->shade = -128; + + if (IsPlayerSprite((spritetype *)pTSprite)) { PLAYER *pPlayer = &gPlayer[pTSprite->type-kDudePlayer1]; - if (powerupCheck(pPlayer, 13) && !powerupCheck(gView, 25)) - { + if (powerupCheck(pPlayer, kPwUpShadowCloak) && !powerupCheck(gView, kPwUpBeastVision)) { pTSprite->cstat |= 2; pTSprite->pal = 5; - } - else if (powerupCheck(pPlayer, 14)) - { + } else if (powerupCheck(pPlayer, kPwUpDeathMask)) { pTSprite->shade = -128; pTSprite->pal = 5; - } - else if (powerupCheck(pPlayer, 23)) - { + } else if (powerupCheck(pPlayer, kPwUpDoppleganger)) { pTSprite->pal = 11+(gView->at2ea&3); } - if (powerupCheck(pPlayer, 24)) - { + + if (powerupCheck(pPlayer, kPwUpReflectShots)) { viewAddEffect(nTSprite, VIEW_EFFECT_13); } - if (gShowWeapon && gGameOptions.nGameType > 0 && gView) - { + + if (gShowWeapon && gGameOptions.nGameType > 0 && gView) { viewAddEffect(nTSprite, VIEW_EFFECT_12); } - if (pPlayer->at37b && (gView != pPlayer || gViewPos != VIEWPOS_0)) - { + + if (pPlayer->at37b && (gView != pPlayer || gViewPos != VIEWPOS_0)) { uspritetype *pNTSprite = viewAddEffect(nTSprite, VIEW_EFFECT_14); - if (pNTSprite) - { + if (pNTSprite) { POSTURE *pPosture = &gPosture[pPlayer->at5f][pPlayer->at2f]; pNTSprite->x += mulscale28(pPosture->at30, Cos(pTSprite->ang)); pNTSprite->y += mulscale28(pPosture->at30, Sin(pTSprite->ang)); pNTSprite->z = pPlayer->pSprite->z-pPosture->at2c; } } - if (pPlayer->at90 > 0 && gGameOptions.nGameType == 3) - { - if (pPlayer->at90&1) - { + + if (pPlayer->at90 > 0 && gGameOptions.nGameType == 3) { + if (pPlayer->at90&1) { uspritetype *pNTSprite = viewAddEffect(nTSprite, VIEW_EFFECT_16); if (pNTSprite) { @@ -2543,8 +2537,7 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t pNTSprite->cstat |= 4; } } - if (pPlayer->at90&2) - { + if (pPlayer->at90&2) { uspritetype *pNTSprite = viewAddEffect(nTSprite, VIEW_EFFECT_16); if (pNTSprite) { @@ -2554,8 +2547,8 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t } } } - if (pTSprite->owner != gView->pSprite->index || gViewPos != VIEWPOS_0) - { + + if (pTSprite->owner != gView->pSprite->index || gViewPos != VIEWPOS_0) { if (getflorzofslope(pTSprite->sectnum, pTSprite->x, pTSprite->y) >= cZ) { viewAddEffect(nTSprite, VIEW_EFFECT_0); @@ -2762,10 +2755,10 @@ void viewBurnTime(int gScale) // by NoOne: show warning msgs in game instead of throwing errors (in some cases) void viewSetSystemMessage(const char* pMessage, ...) { - char buffer[256]; va_list args; va_start(args, pMessage); + char buffer[1024]; va_list args; va_start(args, pMessage); vsprintf(buffer, pMessage, args); - - OSD_Printf("%s\n", buffer); + + OSD_Printf("%s\n", buffer); // print it also in console gGameMessageMgr.Add(buffer, 15, 7, MESSAGE_PRIORITY_SYSTEM); } @@ -2941,7 +2934,7 @@ void viewUpdateDelirium(void) deliriumTurnO = deliriumTurn; deliriumPitchO = deliriumPitch; int powerCount; - if ((powerCount = powerupCheck(gView,28)) != 0) + if ((powerCount = powerupCheck(gView, kPwUpDeliriumShroom)) != 0) { int tilt1 = 170, tilt2 = 170, pitch = 20; int timer = (int)gFrameClock*4; @@ -3169,10 +3162,10 @@ void viewDrawScreen(void) int v78 = interpolateang(gScreenTiltO, gScreenTilt, gInterpolate); char v14 = 0; char v10 = 0; - bool bDelirium = powerupCheck(gView, 28) > 0; + bool bDelirium = powerupCheck(gView, kPwUpDeliriumShroom) > 0; static bool bDeliriumOld = false; int tiltcs, tiltdim; - char v4 = powerupCheck(gView, 21) > 0; + char v4 = powerupCheck(gView, kPwUpCrystalBall) > 0; #ifdef USE_OPENGL renderSetRollAngle(0); #endif @@ -3493,7 +3486,7 @@ RORHACK: rotatesprite(212<<16, 77<<16, 65536, 0, 2347, 32, 0, 512+19, gViewX0, gViewY0, gViewX1, gViewY1); } } - if (powerupCheck(gView, 39) > 0) + if (powerupCheck(gView, kPwUpAsbestArmor) > 0) { rotatesprite(0, 200<<16, 65536, 0, 2358, 0, 0, 256+22, gViewX0, gViewY0, gViewX1, gViewY1); rotatesprite(320<<16, 200<<16, 65536, 1024, 2358, 0, 0, 512+18, gViewX0, gViewY0, gViewX1, gViewY1); @@ -3508,35 +3501,18 @@ RORHACK: rotatesprite(280<<16, 35<<16, 53248, 0, 1683, v10, 0, 512+35, gViewX0, gViewY0, gViewX1, gViewY1); renderSetAspect(viewingRange, yxAspect); } - if (powerupCheck(gView, 14) > 0) - { - nPalette = 4; + + if (powerupCheck(gView, kPwUpDeathMask) > 0) nPalette = 4; + else if(powerupCheck(gView, kPwUpReflectShots) > 0) nPalette = 1; + else if (gView->at87) { + if (gView->nWaterPal) nPalette = gView->nWaterPal; + else { + if (gView->pXSprite->medium == kMediumWater) nPalette = 1; + else if (gView->pXSprite->medium == kMediumGoo) nPalette = 3; + else nPalette = 2; } - else if(powerupCheck(gView, 24) > 0) - { - nPalette = 1; } - else if (gView->at87) - { - if (gView->nWaterPal) - nPalette = gView->nWaterPal; - else - { - if (gView->pXSprite->medium == 1) - { - nPalette = 1; } - else if (gView->pXSprite->medium == 2) - { - nPalette = 3; - } - else - { - nPalette = 2; - } - } - } - } if (gViewMode == 4) { gViewMap.sub_25DB0(gView->pSprite); diff --git a/source/blood/src/warp.cpp b/source/blood/src/warp.cpp index 218293a59..0c5bc5195 100644 --- a/source/blood/src/warp.cpp +++ b/source/blood/src/warp.cpp @@ -180,7 +180,7 @@ int CheckLink(spritetype *pSprite) { spritetype *pUpper = &sprite[nUpper]; int z; - if (pUpper->type == 7) + if (pUpper->type == kMarkerUpLink) z = pUpper->z; else z = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y); @@ -194,7 +194,7 @@ int CheckLink(spritetype *pSprite) pSprite->x += pLower->x-pUpper->x; pSprite->y += pLower->y-pUpper->y; int z2; - if (pLower->type == 6) + if (pLower->type == kMarkerLowLink) z2 = pLower->z; else z2 = getceilzofslope(pSprite->sectnum, pSprite->x, pSprite->y); @@ -207,7 +207,7 @@ int CheckLink(spritetype *pSprite) { spritetype *pLower = &sprite[nLower]; int z; - if (pLower->type == 6) + if (pLower->type == kMarkerLowLink) z = pLower->z; else z = getceilzofslope(pSprite->sectnum, pSprite->x, pSprite->y); @@ -221,7 +221,7 @@ int CheckLink(spritetype *pSprite) pSprite->x += pUpper->x-pLower->x; pSprite->y += pUpper->y-pLower->y; int z2; - if (pUpper->type == 7) + if (pUpper->type == kMarkerUpLink) z2 = pUpper->z; else z2 = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y); @@ -241,7 +241,7 @@ int CheckLink(int *x, int *y, int *z, int *nSector) { spritetype *pUpper = &sprite[nUpper]; int z1; - if (pUpper->type == 7) + if (pUpper->type == kMarkerUpLink) z1 = pUpper->z; else z1 = getflorzofslope(*nSector, *x, *y); @@ -255,7 +255,7 @@ int CheckLink(int *x, int *y, int *z, int *nSector) *x += pLower->x-pUpper->x; *y += pLower->y-pUpper->y; int z2; - if (pUpper->type == 6) + if (pUpper->type == kMarkerLowLink) z2 = pLower->z; else z2 = getceilzofslope(*nSector, *x, *y); @@ -267,7 +267,7 @@ int CheckLink(int *x, int *y, int *z, int *nSector) { spritetype *pLower = &sprite[nLower]; int z1; - if (pLower->type == 6) + if (pLower->type == kMarkerLowLink) z1 = pLower->z; else z1 = getceilzofslope(*nSector, *x, *y); @@ -281,7 +281,7 @@ int CheckLink(int *x, int *y, int *z, int *nSector) *x += pUpper->x-pLower->x; *y += pUpper->y-pLower->y; int z2; - if (pLower->type == 7) + if (pLower->type == kMarkerUpLink) z2 = pUpper->z; else z2 = getflorzofslope(*nSector, *x, *y); diff --git a/source/blood/src/weapon.cpp b/source/blood/src/weapon.cpp index a7af3fcb0..ed44d3c3e 100644 --- a/source/blood/src/weapon.cpp +++ b/source/blood/src/weapon.cpp @@ -120,8 +120,6 @@ int nClientAltFireLifeLeech = qavRegisterClient((QAVTypeCast)AltFireLifeLeech); int nClientDropVoodoo = qavRegisterClient((QAVTypeCast)DropVoodoo); int nClientAltFireNapalm = qavRegisterClient((QAVTypeCast)AltFireNapalm); -#define kQAVEnd 125 - QAV *weaponQAV[kQAVEnd]; void QAV::PlaySound(int nSound) @@ -242,7 +240,7 @@ void WeaponDraw(PLAYER *pPlayer, int a2, int a3, int a4, int a5) pQAV->x = a3; pQAV->y = a4; int flags = 2; - int nInv = powerupCheck(pPlayer, 13); + int nInv = powerupCheck(pPlayer, kPwUpShadowCloak); if (nInv >= 120*8 || (nInv != 0 && ((int)totalclock&32))) { a2 = -128; @@ -516,7 +514,7 @@ void WeaponRaise(PLAYER *pPlayer) } break; case 3: // sawed off - if (powerupCheck(pPlayer, 17)) + if (powerupCheck(pPlayer, kPwUpTwoGuns)) { if (gInfiniteAmmo || pPlayer->at181[2] >= 4) StartQAV(pPlayer, 59, -1, 0); @@ -543,7 +541,7 @@ void WeaponRaise(PLAYER *pPlayer) } break; case 4: // tommy gun - if (powerupCheck(pPlayer, 17) && sub_4B2C8(pPlayer, 3, 2)) + if (powerupCheck(pPlayer, kPwUpTwoGuns) && sub_4B2C8(pPlayer, 3, 2)) { pPlayer->atc3 = 1; StartQAV(pPlayer, 69, -1, 0); @@ -562,7 +560,7 @@ void WeaponRaise(PLAYER *pPlayer) } break; case 2: // flaregun - if (powerupCheck(pPlayer, 17) && sub_4B2C8(pPlayer, 1, 2)) + if (powerupCheck(pPlayer, kPwUpTwoGuns) && sub_4B2C8(pPlayer, 1, 2)) { StartQAV(pPlayer, 45, -1, 0); pPlayer->atc3 = 3; @@ -577,7 +575,7 @@ void WeaponRaise(PLAYER *pPlayer) if (sub_4B2C8(pPlayer, 7, 1)) { pPlayer->atc3 = 2; - if (powerupCheck(pPlayer, 17)) + if (powerupCheck(pPlayer, kPwUpTwoGuns)) StartQAV(pPlayer, 82, -1, 0); else StartQAV(pPlayer, 74, -1, 0); @@ -589,7 +587,7 @@ void WeaponRaise(PLAYER *pPlayer) } break; case 5: // napalm - if (powerupCheck(pPlayer, 17)) + if (powerupCheck(pPlayer, kPwUpTwoGuns)) { StartQAV(pPlayer, 120, -1, 0); pPlayer->atc3 = 3; @@ -706,19 +704,19 @@ void WeaponLower(PLAYER *pPlayer) } break; case 3: - if (powerupCheck(pPlayer, 17)) + if (powerupCheck(pPlayer, kPwUpTwoGuns)) StartQAV(pPlayer, 63, -1, 0); else StartQAV(pPlayer, 58, -1, 0); break; case 4: - if (powerupCheck(pPlayer, 17) && pPlayer->atc3 == 1) + if (powerupCheck(pPlayer, kPwUpTwoGuns) && pPlayer->atc3 == 1) StartQAV(pPlayer, 72, -1, 0); else StartQAV(pPlayer, 68, -1, 0); break; case 2: - if (powerupCheck(pPlayer, 17) && pPlayer->atc3 == 3) + if (powerupCheck(pPlayer, kPwUpTwoGuns) && pPlayer->atc3 == 3) StartQAV(pPlayer, 49, -1, 0); else StartQAV(pPlayer, 44, -1, 0); @@ -727,13 +725,13 @@ void WeaponLower(PLAYER *pPlayer) StartQAV(pPlayer, 109, -1, 0); break; case 8: - if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, 17)) + if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, kPwUpTwoGuns)) StartQAV(pPlayer, 88, -1, 0); else StartQAV(pPlayer, 81, -1, 0); break; case 5: - if (powerupCheck(pPlayer, 17)) + if (powerupCheck(pPlayer, kPwUpTwoGuns)) StartQAV(pPlayer, 124, -1, 0); else StartQAV(pPlayer, 92, -1, 0); @@ -864,7 +862,7 @@ void WeaponUpdateState(PLAYER *pPlayer) switch (vb) { case 6: - if (powerupCheck(pPlayer, 17) && (gInfiniteAmmo || CheckAmmo(pPlayer, 2, 4))) + if (powerupCheck(pPlayer, kPwUpTwoGuns) && (gInfiniteAmmo || CheckAmmo(pPlayer, 2, 4))) pPlayer->atc3 = 7; else pPlayer->atc3 = 1; @@ -894,7 +892,7 @@ void WeaponUpdateState(PLAYER *pPlayer) } break; case 4: - if (powerupCheck(pPlayer, 17) && sub_4B2C8(pPlayer, 3, 2)) + if (powerupCheck(pPlayer, kPwUpTwoGuns) && sub_4B2C8(pPlayer, 3, 2)) { pPlayer->at26 = 70; pPlayer->atc3 = 1; @@ -906,7 +904,7 @@ void WeaponUpdateState(PLAYER *pPlayer) } break; case 2: - if (powerupCheck(pPlayer, 17)) + if (powerupCheck(pPlayer, kPwUpTwoGuns)) { if (vb == 3 && sub_4B2C8(pPlayer, 1, 2)) pPlayer->at26 = 46; @@ -929,7 +927,7 @@ void WeaponUpdateState(PLAYER *pPlayer) switch (vb) { case 2: - if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, 17)) + if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, kPwUpTwoGuns)) pPlayer->at26 = 83; else pPlayer->at26 = 75; @@ -943,7 +941,7 @@ void WeaponUpdateState(PLAYER *pPlayer) switch (vb) { case 3: - if (powerupCheck(pPlayer, 17) && (gInfiniteAmmo || CheckAmmo(pPlayer,4, 4))) + if (powerupCheck(pPlayer, kPwUpTwoGuns) && (gInfiniteAmmo || CheckAmmo(pPlayer,4, 4))) pPlayer->at26 = 121; else pPlayer->at26 = 90; @@ -1249,7 +1247,7 @@ void AltFireSpread2(int nTrigger, PLAYER *pPlayer) int dx = Cos(angle)>>16; int dy = Sin(angle)>>16; sfxPlay3DSound(pPlayer->pSprite, 431, -1, 0); - if (powerupCheck(pPlayer, 17) && sub_4B2C8(pPlayer, 3, 2)) + if (powerupCheck(pPlayer, kPwUpTwoGuns) && sub_4B2C8(pPlayer, 3, 2)) { int r1, r2, r3; r1 = Random3(300); @@ -1418,8 +1416,8 @@ void AltFireVoodoo(int nTrigger, PLAYER *pPlayer) if (IsPlayerSprite(pTarget)) { PLAYER* pOtherPlayer = &gPlayer[pTarget->type - kDudePlayer1]; - if (!pOtherPlayer->at31a || !powerupCheck(pOtherPlayer, 14)) - powerupActivate(pOtherPlayer, 28); + if (!pOtherPlayer->at31a || !powerupCheck(pOtherPlayer, kPwUpDeathMask)) + powerupActivate(pOtherPlayer, kPwUpDeliriumShroom); } fxSpawnBlood(pTarget, 0); } @@ -1456,8 +1454,8 @@ void AltFireVoodoo(int nTrigger, PLAYER *pPlayer) if (IsPlayerSprite(pTarget)) { PLAYER* pOtherPlayer = &gPlayer[pTarget->type - kDudePlayer1]; - if (!pOtherPlayer->at31a || !powerupCheck(pOtherPlayer, 14)) - powerupActivate(pOtherPlayer, 28); + if (!pOtherPlayer->at31a || !powerupCheck(pOtherPlayer, kPwUpDeathMask)) + powerupActivate(pOtherPlayer, kPwUpDeliriumShroom); } fxSpawnBlood(pTarget, 0); } @@ -1574,8 +1572,8 @@ void FireNapalm2(int nTrigger, PLAYER *pPlayer) void AltFireNapalm(int nTrigger, PLAYER *pPlayer) { - UNREFERENCED_PARAMETER(nTrigger); - char UNUSED(bAkimbo) = powerupCheck(pPlayer, 17); + //UNREFERENCED_PARAMETER(nTrigger); + //char UNUSED(bAkimbo) = powerupCheck(pPlayer, kPwUpTwoGuns); int nSpeed = mulscale16(0x8000, 0x177777)+0x66666; spritetype *pMissile = playerFireThing(pPlayer, 0, -4730, kThingNapalmBall, nSpeed); if (pMissile) @@ -1897,7 +1895,7 @@ char sub_4F484(PLAYER *pPlayer) { case 4: pPlayer->atc3 = 5; - if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, 17)) + if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, kPwUpTwoGuns)) StartQAV(pPlayer, 84, nClientFireTesla, 1); else StartQAV(pPlayer, 77, nClientFireTesla, 1); @@ -1906,7 +1904,7 @@ char sub_4F484(PLAYER *pPlayer) if (!pPlayer->atc.buttonFlags.shoot) { pPlayer->atc3 = 2; - if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, 17)) + if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, kPwUpTwoGuns)) StartQAV(pPlayer, 87, -1, 0); else StartQAV(pPlayer, 80, -1, 0); @@ -1915,7 +1913,7 @@ char sub_4F484(PLAYER *pPlayer) break; case 7: pPlayer->atc3 = 2; - if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, 17)) + if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, kPwUpTwoGuns)) StartQAV(pPlayer, 87, -1, 0); else StartQAV(pPlayer, 80, -1, 0); @@ -2231,13 +2229,13 @@ void WeaponProcess(PLAYER *pPlayer) } break; case 4: - if (powerupCheck(pPlayer, 17) && sub_4B2C8(pPlayer, 3, 2)) + if (powerupCheck(pPlayer, kPwUpTwoGuns) && sub_4B2C8(pPlayer, 3, 2)) StartQAV(pPlayer, 71, nClientFireTommy, 1); else StartQAV(pPlayer, 66, nClientFireTommy, 1); return; case 2: - if (powerupCheck(pPlayer, 17) && sub_4B2C8(pPlayer, 1, 2)) + if (powerupCheck(pPlayer, kPwUpTwoGuns) && sub_4B2C8(pPlayer, 1, 2)) StartQAV(pPlayer, 48, nClientFireFlare, 0); else StartQAV(pPlayer, 43, nClientFireFlare, 0); @@ -2261,13 +2259,13 @@ void WeaponProcess(PLAYER *pPlayer) { case 2: pPlayer->atc3 = 4; - if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, 17)) + if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, kPwUpTwoGuns)) StartQAV(pPlayer, 84, nClientFireTesla, 0); else StartQAV(pPlayer, 77, nClientFireTesla, 0); return; case 5: - if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, 17)) + if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, kPwUpTwoGuns)) StartQAV(pPlayer, 84, nClientFireTesla, 0); else StartQAV(pPlayer, 77, nClientFireTesla, 0); @@ -2275,7 +2273,7 @@ void WeaponProcess(PLAYER *pPlayer) } break; case 5: - if (powerupCheck(pPlayer, 17)) + if (powerupCheck(pPlayer, kPwUpTwoGuns)) StartQAV(pPlayer, 122, nClientFireNapalm, 0); else StartQAV(pPlayer, 91, nClientFireNapalm, 0); @@ -2372,7 +2370,7 @@ void WeaponProcess(PLAYER *pPlayer) } break; case 4: - if (powerupCheck(pPlayer, 17) && sub_4B2C8(pPlayer, 3, 2)) + if (powerupCheck(pPlayer, kPwUpTwoGuns) && sub_4B2C8(pPlayer, 3, 2)) StartQAV(pPlayer, 73, nClientAltFireSpread2, 0); else StartQAV(pPlayer, 67, nClientAltFireSpread2, 0); @@ -2383,7 +2381,7 @@ void WeaponProcess(PLAYER *pPlayer) return; #if 0 case 2: - if (powerupCheck(pPlayer, 17) && sub_4B2C8(pPlayer, 1, 2)) + if (powerupCheck(pPlayer, kPwUpTwoGuns) && sub_4B2C8(pPlayer, 1, 2)) StartQAV(pPlayer, 48, nClientFireFlare, 0); else StartQAV(pPlayer, 43, nClientFireFlare, 0); @@ -2392,21 +2390,21 @@ void WeaponProcess(PLAYER *pPlayer) case 8: if (sub_4B2C8(pPlayer, 7, 35)) { - if (sub_4B2C8(pPlayer, 7, 70) && powerupCheck(pPlayer, 17)) + if (sub_4B2C8(pPlayer, 7, 70) && powerupCheck(pPlayer, kPwUpTwoGuns)) StartQAV(pPlayer, 85, nClientFireTesla, 0); else StartQAV(pPlayer, 78, nClientFireTesla, 0); } else { - if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, 17)) + if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, kPwUpTwoGuns)) StartQAV(pPlayer, 84, nClientFireTesla, 0); else StartQAV(pPlayer, 77, nClientFireTesla, 0); } return; case 5: - if (powerupCheck(pPlayer, 17)) + if (powerupCheck(pPlayer, kPwUpTwoGuns)) // by NoOne: allow napalm launcher alt fire act like in v1.0x versions if (gGameOptions.weaponsV10x && !VanillaMode() && !DemoRecordStatus()) StartQAV(pPlayer, 123, nClientFireNapalm2, 0); else StartQAV(pPlayer, 122, nClientAltFireNapalm, 0); @@ -2416,14 +2414,14 @@ void WeaponProcess(PLAYER *pPlayer) case 2: if (CheckAmmo(pPlayer, 1, 8)) { - if (powerupCheck(pPlayer, 17) && sub_4B2C8(pPlayer, 1, 16)) + if (powerupCheck(pPlayer, kPwUpTwoGuns) && sub_4B2C8(pPlayer, 1, 16)) StartQAV(pPlayer, 48, nClientAltFireFlare, 0); else StartQAV(pPlayer, 43, nClientAltFireFlare, 0); } else { - if (powerupCheck(pPlayer, 17) && sub_4B2C8(pPlayer, 1, 2)) + if (powerupCheck(pPlayer, kPwUpTwoGuns) && sub_4B2C8(pPlayer, 1, 2)) StartQAV(pPlayer, 48, nClientFireFlare, 0); else StartQAV(pPlayer, 43, nClientFireFlare, 0); diff --git a/source/blood/src/weapon.h b/source/blood/src/weapon.h index 9060da386..f234fdcb4 100644 --- a/source/blood/src/weapon.h +++ b/source/blood/src/weapon.h @@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "blood.h" #include "db.h" #include "player.h" +#include "qav.h" BEGIN_BLD_NS