- 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
This commit is contained in:
Grind Core 2019-10-19 22:11:39 +03:00 committed by Christoph Oelckers
parent a278a85b3b
commit 70e0ed9ec4
37 changed files with 890 additions and 646 deletions

View file

@ -2540,6 +2540,8 @@ short gSightSpritesCount; // current count
short gPhysSpritesList[]; // by NoOne: list of additional sprites which can be affected by physics short gPhysSpritesList[]; // by NoOne: list of additional sprites which can be affected by physics
short gPhysSpritesCount; // current count short gPhysSpritesCount; // current count
short gQavPlayerIndex = -1; // by NoOne: index of sprite which currently activated to play qav
void actInit(bool bSaveLoad) { void actInit(bool bSaveLoad) {
// by NoOne: init code for all my stuff // by NoOne: init code for all my stuff
@ -2548,6 +2550,9 @@ void actInit(bool bSaveLoad) {
// reset counters // reset counters
gProxySpritesCount = gSightSpritesCount = gPhysSpritesCount = 0; gProxySpritesCount = gSightSpritesCount = gPhysSpritesCount = 0;
// reset qav player index
gQavPlayerIndex = -1;
// fill arrays with negative values to avoid xvel 0 situation // fill arrays with negative values to avoid xvel 0 situation
memset(gSightSpritesList, -1, sizeof(gSightSpritesList)); memset(gSightSpritesList, -1, sizeof(gSightSpritesList));
memset(gProxySpritesList, -1, sizeof(gProxySpritesList)); memset(gProxySpritesList, -1, sizeof(gProxySpritesList));
@ -2614,7 +2619,7 @@ void actInit(bool bSaveLoad) {
else { else {
gProxySpritesList[gProxySpritesCount++] = pSprite->xvel; gProxySpritesList[gProxySpritesCount++] = pSprite->xvel;
if (gProxySpritesCount == kMaxSuperXSprites) if (gProxySpritesCount == kMaxSuperXSprites)
ThrowError("Max (%d) *additional* Proximity sprites reached!",kMaxSuperXSprites); viewSetSystemMessage("Max (%d) *additional* Proximity sprites reached!", kMaxSuperXSprites);
} }
break; break;
} }
@ -2638,7 +2643,7 @@ void actInit(bool bSaveLoad) {
default: default:
gSightSpritesList[gSightSpritesCount++] = pSprite->xvel; gSightSpritesList[gSightSpritesCount++] = pSprite->xvel;
if (gSightSpritesCount == kMaxSuperXSprites) if (gSightSpritesCount == kMaxSuperXSprites)
ThrowError("Max (%d) Sight sprites reached!", kMaxSuperXSprites); viewSetSystemMessage("Max (%d) Sight sprites reached!", kMaxSuperXSprites);
break; break;
} }
} }
@ -2779,13 +2784,14 @@ void ConcussSprite(int a1, spritetype *pSprite, int x, int y, int z, int a6)
mass = getSpriteMassBySize(pSprite); mass = getSpriteMassBySize(pSprite);
break; break;
} }
}
else if (pSprite->type >= kThingBase && pSprite->type < kThingMax) } else if (pSprite->type >= kThingBase && pSprite->type < kThingMax) {
mass = thingInfo[pSprite->type - kThingBase].mass; 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; 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; int size = (tilesiz[pSprite->picnum].x*pSprite->xrepeat*tilesiz[pSprite->picnum].y*pSprite->yrepeat)>>1;
dassert(mass > 0); dassert(mass > 0);
@ -3096,7 +3102,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType,
} }
if (damageType == DAMAGE_TYPE_1) { 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")) { if (gSysRes.Lookup(pXSprite->data2 + 3, "SEQ")) {
pSprite->type = kDudeModernCustomBurning; pSprite->type = kDudeModernCustomBurning;
if (pXSprite->data2 == kDefaultAnimationBase) // don't inherit palette for burning if using default animation 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 kDudeCultistShotgun:
case kDudeCultistTesla: case kDudeCultistTesla:
case kDudeCultistTNT: case kDudeCultistTNT:
if (damageType == DAMAGE_TYPE_1 && pXSprite->medium == 0) if (damageType == DAMAGE_TYPE_1 && pXSprite->medium == kMediumNormal)
{ {
pSprite->type = kDudeBurningCultist; pSprite->type = kDudeBurningCultist;
aiNewState(pSprite, pXSprite, &cultistBurnGoto); aiNewState(pSprite, pXSprite, &cultistBurnGoto);
@ -3180,7 +3186,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType,
// no break // no break
fallthrough__; fallthrough__;
case kDudeBeast: case kDudeBeast:
if (damageType == DAMAGE_TYPE_1 && pXSprite->medium == 0) if (damageType == DAMAGE_TYPE_1 && pXSprite->medium == kMediumNormal)
{ {
pSprite->type = kDudeBurningBeast; pSprite->type = kDudeBurningBeast;
aiNewState(pSprite, pXSprite, &beastBurnGoto); aiNewState(pSprite, pXSprite, &beastBurnGoto);
@ -3190,7 +3196,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType,
// no break // no break
fallthrough__; fallthrough__;
case kDudeInnocent: case kDudeInnocent:
if (damageType == DAMAGE_TYPE_1 && pXSprite->medium == 0) if (damageType == DAMAGE_TYPE_1 && pXSprite->medium == kMediumNormal)
{ {
pSprite->type = kDudeBurningInnocent; pSprite->type = kDudeBurningInnocent;
aiNewState(pSprite, pXSprite, &innocentBurnGoto); aiNewState(pSprite, pXSprite, &innocentBurnGoto);
@ -3664,8 +3670,11 @@ int actDamageSprite(int nSource, spritetype *pSprite, DAMAGE_TYPE damageType, in
switch (pSprite->statnum) { switch (pSprite->statnum) {
case kStatDude: { case kStatDude: {
if (!IsDudeSprite(pSprite)) 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"); 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]; int nType = pSprite->type - kDudeBase; int nDamageFactor = dudeInfo[nType].at70[damageType];
if (!nDamageFactor) return 0; if (!nDamageFactor) return 0;
@ -4060,7 +4069,7 @@ void actImpactMissile(spritetype *pMissile, int hitCode)
case kMissileButcherKnife: case kMissileButcherKnife:
actPostSprite(pMissile->index, kStatDebris); actPostSprite(pMissile->index, kStatDebris);
pMissile->cstat &= ~16; pMissile->cstat &= ~16;
pMissile->type = 0; pMissile->type = kSpriteDecoration;
seqSpawn(20, 3, pMissile->extra, -1); seqSpawn(20, 3, pMissile->extra, -1);
if (hitCode == 3) if (hitCode == 3)
{ {
@ -4225,7 +4234,7 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite)
case kDudeModernCustomBurning: case kDudeModernCustomBurning:
int dmg = (getSpriteMassBySize(pSprite2) - getSpriteMassBySize(pSprite)) + pSprite2->clipdist; int dmg = (getSpriteMassBySize(pSprite2) - getSpriteMassBySize(pSprite)) + pSprite2->clipdist;
if (dmg > 0) { 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); actDamageSprite(pSprite2->xvel, pSprite, DAMAGE_TYPE_3, dmg);
else else
actDamageSprite(pSprite2->xvel, pSprite, DAMAGE_TYPE_0, dmg); actDamageSprite(pSprite2->xvel, pSprite, DAMAGE_TYPE_0, dmg);
@ -4825,9 +4834,9 @@ void MoveDude(spritetype *pSprite)
} }
int nUpperLink = gUpperLink[nSector]; int nUpperLink = gUpperLink[nSector];
int nLowerLink = gLowerLink[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; 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; bDepth = 1;
if (pPlayer) if (pPlayer)
wd += 16; wd += 16;
@ -4897,7 +4906,7 @@ void MoveDude(spritetype *pSprite)
break; break;
case kMarkerLowWater: case kMarkerLowWater:
case kMarkerLowGoo: case kMarkerLowGoo:
pXSprite->medium = 0; pXSprite->medium = kMediumNormal;
if (pPlayer) { if (pPlayer) {
pPlayer->at2f = 0; pPlayer->at2f = 0;
pPlayer->at302 = 0; pPlayer->at302 = 0;
@ -4926,7 +4935,7 @@ void MoveDude(spritetype *pSprite)
case kMarkerUpWater: case kMarkerUpWater:
case kMarkerUpGoo: case kMarkerUpGoo:
{ {
pXSprite->medium = nLink == kMarkerUpGoo ? 2 : 1; pXSprite->medium = (nLink == kMarkerUpGoo ? kMediumGoo : kMediumWater);
if (pPlayer) if (pPlayer)
{ {
@ -5011,7 +5020,7 @@ void MoveDude(spritetype *pSprite)
break; break;
} }
/*case 13: /*case 13:
pXSprite->medium = 2; pXSprite->medium = kMediumGoo;
if (pPlayer) if (pPlayer)
{ {
pPlayer->changeTargetKin = 1; 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]) for (nSprite = headspritestat[kStatThing]; nSprite >= 0; nSprite = nextspritestat[nSprite])
@ -6361,7 +6383,7 @@ spritetype * actSpawnSprite(int nSector, int x, int y, int z, int nStat, char a6
vec3_t pos = { x, y, z }; vec3_t pos = { x, y, z };
setsprite(nSprite, &pos); setsprite(nSprite, &pos);
spritetype *pSprite = &sprite[nSprite]; spritetype *pSprite = &sprite[nSprite];
pSprite->type = 0; pSprite->type = kSpriteDecoration;
if (a6 && pSprite->extra == -1) if (a6 && pSprite->extra == -1)
{ {
int nXSprite = dbInsertXSprite(nSprite); 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; int nSprite = gHitInfo.hitsprite;
dassert(nSprite >= 0 && nSprite < kMaxSprites); dassert(nSprite >= 0 && nSprite < kMaxSprites);
spritetype *pSprite = &sprite[nSprite]; spritetype *pSprite = &sprite[nSprite];
if (!gGameOptions.bFriendlyFire && IsTargetTeammate(pShooter, pSprite)) if (!gGameOptions.bFriendlyFire && IsTargetTeammate(pShooter, pSprite)) return;
return; if (IsPlayerSprite(pSprite)) {
if (IsPlayerSprite(pSprite))
{
PLAYER *pPlayer = &gPlayer[pSprite->type-kDudePlayer1]; PLAYER *pPlayer = &gPlayer[pSprite->type-kDudePlayer1];
if (powerupCheck(pPlayer, 24)) if (powerupCheck(pPlayer, kPwUpReflectShots))
{ {
gHitInfo.hitsprite = nShooter; gHitInfo.hitsprite = nShooter;
gHitInfo.hitx = pShooter->x; gHitInfo.hitx = pShooter->x;

View file

@ -286,5 +286,6 @@ extern short gPhysSpritesList[kMaxSuperXSprites];
extern short gProxySpritesCount; extern short gProxySpritesCount;
extern short gSightSpritesCount; extern short gSightSpritesCount;
extern short gPhysSpritesCount; extern short gPhysSpritesCount;
extern short gQavPlayerIndex;
END_BLD_NS END_BLD_NS

View file

@ -379,15 +379,15 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
pDudeExtraE->at0 = 0; pDudeExtraE->at0 = 0;
if (pXSprite->target == -1) { if (pXSprite->target == -1) {
switch (pXSprite->medium) { switch (pXSprite->medium) {
case 0: case kMediumNormal:
aiNewState(pSprite, pXSprite, &cultistSearch); aiNewState(pSprite, pXSprite, &cultistSearch);
if (Chance(0x8000)) { if (Chance(0x8000)) {
if (pSprite->type == kDudeCultistTommy) aiPlay3DSound(pSprite, 4008+Random(5), AI_SFX_PRIORITY_1, -1); 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); else aiPlay3DSound(pSprite, 1008+Random(5), AI_SFX_PRIORITY_1, -1);
} }
break; break;
case 1: case kMediumWater:
case 2: case kMediumGoo:
aiNewState(pSprite, pXSprite, &cultistSwimSearch); aiNewState(pSprite, pXSprite, &cultistSwimSearch);
break; break;
} }
@ -397,12 +397,12 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
else aiPlay3DSound(pSprite, 1003+Random(4), AI_SFX_PRIORITY_1, -1); else aiPlay3DSound(pSprite, 1003+Random(4), AI_SFX_PRIORITY_1, -1);
} }
switch (pXSprite->medium) { switch (pXSprite->medium) {
case 0: case kMediumNormal:
if (pSprite->type == kDudeCultistTommy) aiNewState(pSprite, pXSprite, &fanaticChase); if (pSprite->type == kDudeCultistTommy) aiNewState(pSprite, pXSprite, &fanaticChase);
else aiNewState(pSprite, pXSprite, &cultistChase); else aiNewState(pSprite, pXSprite, &cultistChase);
break; break;
case 1: case kMediumWater:
case 2: case kMediumGoo:
aiNewState(pSprite, pXSprite, &cultistSwimChase); aiNewState(pSprite, pXSprite, &cultistSwimChase);
break; break;
} }
@ -453,8 +453,8 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
if (Chance(0x8000)) if (Chance(0x8000))
aiPlay3DSound(pSprite, 4008+Random(5), AI_SFX_PRIORITY_1, -1); aiPlay3DSound(pSprite, 4008+Random(5), AI_SFX_PRIORITY_1, -1);
break; break;
case 1: case kMediumWater:
case 2: case kMediumGoo:
aiNewState(pSprite, pXSprite, &cultistSwimSearch); aiNewState(pSprite, pXSprite, &cultistSwimSearch);
break; break;
} }
@ -463,11 +463,11 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
aiPlay3DSound(pSprite, 4008+Random(5), AI_SFX_PRIORITY_1, -1); aiPlay3DSound(pSprite, 4008+Random(5), AI_SFX_PRIORITY_1, -1);
switch (pXSprite->medium) { switch (pXSprite->medium) {
case 0: case kMediumNormal:
aiNewState(pSprite, pXSprite, &cultistProneChase); aiNewState(pSprite, pXSprite, &cultistProneChase);
break; break;
case 1: case kMediumWater:
case 2: case kMediumGoo:
aiNewState(pSprite, pXSprite, &cultistSwimChase); aiNewState(pSprite, pXSprite, &cultistSwimChase);
break; break;
} }
@ -484,13 +484,13 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
{ {
switch (pXSprite->medium) switch (pXSprite->medium)
{ {
case 0: case kMediumNormal:
aiNewState(pSprite, pXSprite, &cultistSearch); aiNewState(pSprite, pXSprite, &cultistSearch);
if (Chance(0x8000)) if (Chance(0x8000))
aiPlay3DSound(pSprite, 1008+Random(5), AI_SFX_PRIORITY_1, -1); aiPlay3DSound(pSprite, 1008+Random(5), AI_SFX_PRIORITY_1, -1);
break; break;
case 1: case kMediumWater:
case 2: case kMediumGoo:
aiNewState(pSprite, pXSprite, &cultistSwimSearch); aiNewState(pSprite, pXSprite, &cultistSwimSearch);
break; break;
} }
@ -501,11 +501,11 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
aiPlay3DSound(pSprite, 1003+Random(4), AI_SFX_PRIORITY_1, -1); aiPlay3DSound(pSprite, 1003+Random(4), AI_SFX_PRIORITY_1, -1);
switch (pXSprite->medium) switch (pXSprite->medium)
{ {
case 0: case kMediumNormal:
aiNewState(pSprite, pXSprite, &cultistProneChase); aiNewState(pSprite, pXSprite, &cultistProneChase);
break; break;
case 1: case kMediumWater:
case 2: case kMediumGoo:
aiNewState(pSprite, pXSprite, &cultistSwimChase); aiNewState(pSprite, pXSprite, &cultistSwimChase);
break; break;
} }
@ -807,11 +807,11 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
{ {
switch (pXSprite->medium) switch (pXSprite->medium)
{ {
case 0: case kMediumNormal:
aiNewState(pSprite, pXSprite, &tinycalebSearch); aiNewState(pSprite, pXSprite, &tinycalebSearch);
break; break;
case 1: case kMediumWater:
case 2: case kMediumGoo:
aiNewState(pSprite, pXSprite, &tinycalebSwimSearch); aiNewState(pSprite, pXSprite, &tinycalebSwimSearch);
break; break;
} }
@ -820,11 +820,11 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
{ {
switch (pXSprite->medium) switch (pXSprite->medium)
{ {
case 0: case kMediumNormal:
aiNewState(pSprite, pXSprite, &tinycalebChase); aiNewState(pSprite, pXSprite, &tinycalebChase);
break; break;
case 1: case kMediumWater:
case 2: case kMediumGoo:
aiNewState(pSprite, pXSprite, &tinycalebSwimChase); aiNewState(pSprite, pXSprite, &tinycalebSwimChase);
break; break;
} }
@ -840,11 +840,11 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
{ {
switch (pXSprite->medium) switch (pXSprite->medium)
{ {
case 0: case kMediumNormal:
aiNewState(pSprite, pXSprite, &beastSearch); aiNewState(pSprite, pXSprite, &beastSearch);
break; break;
case 1: case kMediumWater:
case 2: case kMediumGoo:
aiNewState(pSprite, pXSprite, &beastSwimSearch); aiNewState(pSprite, pXSprite, &beastSwimSearch);
break; break;
} }
@ -854,11 +854,11 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
aiPlay3DSound(pSprite, 9009+Random(2), AI_SFX_PRIORITY_1, -1); aiPlay3DSound(pSprite, 9009+Random(2), AI_SFX_PRIORITY_1, -1);
switch (pXSprite->medium) switch (pXSprite->medium)
{ {
case 0: case kMediumNormal:
aiNewState(pSprite, pXSprite, &beastChase); aiNewState(pSprite, pXSprite, &beastChase);
break; break;
case 1: case kMediumWater:
case 2: case kMediumGoo:
aiNewState(pSprite, pXSprite, &beastSwimChase); aiNewState(pSprite, pXSprite, &beastSwimChase);
break; break;
} }
@ -953,7 +953,7 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T
aiNewState(pSprite, pXSprite, &cultistDodge); aiNewState(pSprite, pXSprite, &cultistDodge);
else if (sub_5BDA8(pSprite, 14) && !pXSprite->medium) else if (sub_5BDA8(pSprite, 14) && !pXSprite->medium)
aiNewState(pSprite, pXSprite, &cultistProneDodge); 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); aiNewState(pSprite, pXSprite, &cultistSwimDodge);
} }
else if (nDmgType == DAMAGE_TYPE_1 && pXSprite->health <= (unsigned int)pDudeInfo->fleeHealth/* && (pXSprite->at17_6 != 1 || pXSprite->at17_6 != 2)*/) 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); aiPlay3DSound(pSprite, 1031+Random(2), AI_SFX_PRIORITY_2, -1);
gDudeExtra[pSprite->extra].at0 = (int)gFrameClock+360; 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; pSprite->type = kDudeCultistTommy;
pXSprite->burnTime = 0; pXSprite->burnTime = 0;
aiNewState(pSprite, pXSprite, &cultistSwimGoto); aiNewState(pSprite, pXSprite, &cultistSwimGoto);
} }
else if (pXSprite->medium == 1 || pXSprite->medium == 2) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
{ {
pSprite->type = kDudeCultistShotgun; pSprite->type = kDudeCultistShotgun;
pXSprite->burnTime = 0; 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); 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); 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); if (pDudeExtra->at4) aiNewState(pSprite, pXSprite, &cultistTeslaRecoil);
else aiNewState(pSprite, pXSprite, &cultistRecoil); else aiNewState(pSprite, pXSprite, &cultistRecoil);
} else if (v4 && pXSprite->medium == 0) { } else if (v4 && pXSprite->medium == kMediumNormal) {
if (pDudeExtra->at4) aiNewState(pSprite, pXSprite, &cultistTeslaRecoil); if (pDudeExtra->at4) aiNewState(pSprite, pXSprite, &cultistTeslaRecoil);
else if (gGameOptions.nDifficulty > 0) aiNewState(pSprite, pXSprite, &cultistProneRecoil); else if (gGameOptions.nDifficulty > 0) aiNewState(pSprite, pXSprite, &cultistProneRecoil);
else aiNewState(pSprite, pXSprite, &cultistRecoil); 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); aiNewState(pSprite, pXSprite, &cultistSwimRecoil);
else else
{ {
@ -1298,14 +1298,14 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &innocentRecoil); aiNewState(pSprite, pXSprite, &innocentRecoil);
break; break;
case kDudeTinyCaleb: case kDudeTinyCaleb:
if (pXSprite->medium == 0) if (pXSprite->medium == kMediumNormal)
{ {
if (pDudeExtra->at4) if (pDudeExtra->at4)
aiNewState(pSprite, pXSprite, &tinycalebTeslaRecoil); aiNewState(pSprite, pXSprite, &tinycalebTeslaRecoil);
else else
aiNewState(pSprite, pXSprite, &tinycalebRecoil); aiNewState(pSprite, pXSprite, &tinycalebRecoil);
} }
else if (pXSprite->medium == 1 || pXSprite->medium == 2) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(pSprite, pXSprite, &tinycalebSwimRecoil); aiNewState(pSprite, pXSprite, &tinycalebSwimRecoil);
else else
{ {
@ -1317,14 +1317,14 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite)
break; break;
case kDudeBeast: case kDudeBeast:
aiPlay3DSound(pSprite, 9004+Random(2), AI_SFX_PRIORITY_2, -1); aiPlay3DSound(pSprite, 9004+Random(2), AI_SFX_PRIORITY_2, -1);
if (pXSprite->medium == 0) if (pXSprite->medium == kMediumNormal)
{ {
if (pDudeExtra->at4) if (pDudeExtra->at4)
aiNewState(pSprite, pXSprite, &beastTeslaRecoil); aiNewState(pSprite, pXSprite, &beastTeslaRecoil);
else else
aiNewState(pSprite, pXSprite, &beastRecoil); aiNewState(pSprite, pXSprite, &beastRecoil);
} }
else if (pXSprite->medium == 1 || pXSprite->medium == 2) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(pSprite, pXSprite, &beastSwimRecoil); aiNewState(pSprite, pXSprite, &beastSwimRecoil);
else else
{ {
@ -1359,7 +1359,7 @@ void aiThinkTarget(spritetype *pSprite, XSPRITE *pXSprite)
for (int p = connecthead; p >= 0; p = connectpoint2[p]) for (int p = connecthead; p >= 0; p = connectpoint2[p])
{ {
PLAYER *pPlayer = &gPlayer[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; continue;
int x = pPlayer->pSprite->x; int x = pPlayer->pSprite->x;
int y = pPlayer->pSprite->y; 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]) for (int p = connecthead; p >= 0; p = connectpoint2[p])
{ {
PLAYER *pPlayer = &gPlayer[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; continue;
int x = pPlayer->pSprite->x; int x = pPlayer->pSprite->x;
int y = pPlayer->pSprite->y; int y = pPlayer->pSprite->y;

View file

@ -112,7 +112,7 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite)
for (int p = connecthead; p >= 0; p = connectpoint2[p]) for (int p = connecthead; p >= 0; p = connectpoint2[p])
{ {
PLAYER *pPlayer = &gPlayer[p]; PLAYER *pPlayer = &gPlayer[p];
if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, 13) > 0) if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
continue; continue;
int x = pPlayer->pSprite->x; int x = pPlayer->pSprite->x;
int y = pPlayer->pSprite->y; int y = pPlayer->pSprite->y;
@ -287,7 +287,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &batSearch); aiNewState(pSprite, pXSprite, &batSearch);
return; 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); aiNewState(pSprite, pXSprite, &batSearch);
return; return;

View file

@ -267,7 +267,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &beastSearch); aiNewState(pSprite, pXSprite, &beastSearch);
return; return;
} }
if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0)
{ {
XSECTOR *pXSector; XSECTOR *pXSector;
int nXSector = sector[pSprite->sectnum].extra; int nXSector = sector[pSprite->sectnum].extra;
@ -425,7 +425,7 @@ static void thinkSwimChase(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &beastSwimSearch); aiNewState(pSprite, pXSprite, &beastSwimSearch);
return; 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); aiNewState(pSprite, pXSprite, &beastSwimSearch);
return; return;

View file

@ -125,7 +125,7 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite)
for (int p = connecthead; p >= 0; p = connectpoint2[p]) for (int p = connecthead; p >= 0; p = connectpoint2[p])
{ {
PLAYER *pPlayer = &gPlayer[p]; PLAYER *pPlayer = &gPlayer[p];
if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, 13) > 0) if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
continue; continue;
int x = pPlayer->pSprite->x; int x = pPlayer->pSprite->x;
int y = pPlayer->pSprite->y; int y = pPlayer->pSprite->y;
@ -302,7 +302,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &eelSearch); aiNewState(pSprite, pXSprite, &eelSearch);
return; 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); aiNewState(pSprite, pXSprite, &eelSearch);
return; return;

View file

@ -171,7 +171,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
} }
return; return;
} }
if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0)
{ {
XSECTOR *pXSector; XSECTOR *pXSector;
int nXSector = sector[pSprite->sectnum].extra; int nXSector = sector[pSprite->sectnum].extra;
@ -292,7 +292,7 @@ static void thinkSwimChase(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &tinycalebSwimSearch); aiNewState(pSprite, pXSprite, &tinycalebSwimSearch);
return; 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); aiNewState(pSprite, pXSprite, &tinycalebSwimSearch);
return; return;

View file

@ -82,12 +82,16 @@ static void BiteSeqCallback(int, int nXSprite)
spritetype *pSprite = &sprite[nSprite]; spritetype *pSprite = &sprite[nSprite];
int dx = Cos(pSprite->ang)>>16; int dx = Cos(pSprite->ang)>>16;
int dy = Sin(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; 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; return;
//dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); }
spritetype *pTarget = &sprite[pXSprite->target]; spritetype *pTarget = &sprite[pXSprite->target];
int dz = pTarget->z-pSprite->z; int dz = pTarget->z-pSprite->z;
actFireVector(pSprite, 350, -100, dx, dy, dz, VECTOR_TYPE_14); actFireVector(pSprite, 350, -100, dx, dy, dz, VECTOR_TYPE_14);
@ -102,9 +106,11 @@ static void BurnSeqCallback(int, int nXSprite)
spritetype *pSprite = &sprite[nSprite]; spritetype *pSprite = &sprite[nSprite];
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
int height = pDudeInfo->eyeHeight*pSprite->yrepeat; 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; return;
//dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); }
int x = pSprite->x; int x = pSprite->x;
int y = pSprite->y; int y = pSprite->y;
int z = height; // ??? int z = height; // ???
@ -179,12 +185,14 @@ static void BurnSeqCallback2(int, int nXSprite)
XSPRITE *pXSprite = &xsprite[nXSprite]; XSPRITE *pXSprite = &xsprite[nXSprite];
int nSprite = pXSprite->reference; int nSprite = pXSprite->reference;
spritetype *pSprite = &sprite[nSprite]; 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; return;
//dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
int height = pDudeInfo->eyeHeight*pSprite->yrepeat; int height = pDudeInfo->eyeHeight*pSprite->yrepeat;
//dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
int x = pSprite->x; int x = pSprite->x;
int y = pSprite->y; int y = pSprite->y;
int z = height; // ??? int z = height; // ???
@ -266,7 +274,11 @@ static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite)
static void thinkTarget(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]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
if (pDudeExtraE->at8 && pDudeExtraE->at4 < 10) 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]) for (int p = connecthead; p >= 0; p = connectpoint2[p])
{ {
PLAYER *pPlayer = &gPlayer[p]; PLAYER *pPlayer = &gPlayer[p];
if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, 13) > 0) if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
continue; continue;
int x = pPlayer->pSprite->x; int x = pPlayer->pSprite->x;
int y = pPlayer->pSprite->y; int y = pPlayer->pSprite->y;
@ -322,7 +334,11 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite)
static void thinkGoto(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]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
int dx = pXSprite->targetX-pSprite->x; int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y; int dy = pXSprite->targetY-pSprite->y;
@ -357,12 +373,19 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
return; return;
} }
if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) return; ///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) {
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites))
return; 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]; spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra]; XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x; int dx = pTarget->x-pSprite->x;
@ -381,7 +404,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
return; return;
} }
if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) { if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) {
switch (pSprite->type) { switch (pSprite->type) {
case kDudeCerberusTwoHead: case kDudeCerberusTwoHead:
aiNewState(pSprite, pXSprite, &cerberusSearch); aiNewState(pSprite, pXSprite, &cerberusSearch);

View file

@ -247,11 +247,11 @@ static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite)
{ {
switch (pXSprite->medium) switch (pXSprite->medium)
{ {
case 0: case kMediumNormal:
aiNewState(pSprite, pXSprite, &cultistSearch); aiNewState(pSprite, pXSprite, &cultistSearch);
break; break;
case 1: case kMediumWater:
case 2: case kMediumGoo:
aiNewState(pSprite, pXSprite, &cultistSwimSearch); aiNewState(pSprite, pXSprite, &cultistSwimSearch);
break; break;
} }
@ -265,11 +265,11 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
{ {
switch (pXSprite->medium) switch (pXSprite->medium)
{ {
case 0: case kMediumNormal:
aiNewState(pSprite, pXSprite, &cultistGoto); aiNewState(pSprite, pXSprite, &cultistGoto);
break; break;
case 1: case kMediumWater:
case 2: case kMediumGoo:
aiNewState(pSprite, pXSprite, &cultistSwimGoto); aiNewState(pSprite, pXSprite, &cultistSwimGoto);
break; break;
} }
@ -287,29 +287,29 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
{ {
switch (pXSprite->medium) switch (pXSprite->medium)
{ {
case 0: case kMediumNormal:
aiNewState(pSprite, pXSprite, &cultistSearch); aiNewState(pSprite, pXSprite, &cultistSearch);
if (pSprite->type == kDudeCultistTommy) if (pSprite->type == kDudeCultistTommy)
aiPlay3DSound(pSprite, 4021+Random(4), AI_SFX_PRIORITY_1, -1); aiPlay3DSound(pSprite, 4021+Random(4), AI_SFX_PRIORITY_1, -1);
else else
aiPlay3DSound(pSprite, 1021+Random(4), AI_SFX_PRIORITY_1, -1); aiPlay3DSound(pSprite, 1021+Random(4), AI_SFX_PRIORITY_1, -1);
break; break;
case 1: case kMediumWater:
case 2: case kMediumGoo:
aiNewState(pSprite, pXSprite, &cultistSwimSearch); aiNewState(pSprite, pXSprite, &cultistSwimSearch);
break; break;
} }
return; return;
} }
if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0)
{ {
switch (pXSprite->medium) switch (pXSprite->medium)
{ {
case 0: case kMediumNormal:
aiNewState(pSprite, pXSprite, &cultistSearch); aiNewState(pSprite, pXSprite, &cultistSearch);
break; break;
case 1: case kMediumWater:
case 2: case kMediumGoo:
aiNewState(pSprite, pXSprite, &cultistSwimSearch); aiNewState(pSprite, pXSprite, &cultistSwimSearch);
break; break;
} }
@ -337,14 +337,14 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
switch (hit) switch (hit)
{ {
case -1: case -1:
if (pXSprite->medium != 1 && pXSprite->medium != 2) if (pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo)
aiNewState(pSprite, pXSprite, &cultistTThrow); aiNewState(pSprite, pXSprite, &cultistTThrow);
break; break;
case 0: case 0:
case 4: case 4:
break; break;
case 3: 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); aiNewState(pSprite, pXSprite, &cultistTThrow);
break; break;
default: default:
@ -358,39 +358,39 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
switch (hit) switch (hit)
{ {
case -1: case -1:
if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal)
aiNewState(pSprite, pXSprite, &cultistTFire); 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); 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); aiNewState(pSprite, pXSprite, &cultistTSwimFire);
break; break;
case 3: case 3:
if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun) 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); 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); aiNewState(pSprite, pXSprite, &cultistTProneFire);
else if (pXSprite->medium == 1 || pXSprite->medium == 2) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(pSprite, pXSprite, &cultistTSwimFire); aiNewState(pSprite, pXSprite, &cultistTSwimFire);
} }
else else
{ {
if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal)
aiNewState(pSprite, pXSprite, &cultistDodge); 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); aiNewState(pSprite, pXSprite, &cultistProneDodge);
else if (pXSprite->medium == 1 || pXSprite->medium == 2) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(pSprite, pXSprite, &cultistSwimDodge); aiNewState(pSprite, pXSprite, &cultistSwimDodge);
} }
break; break;
default: default:
if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal)
aiNewState(pSprite, pXSprite, &cultistTFire); 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); aiNewState(pSprite, pXSprite, &cultistTProneFire);
else if (pXSprite->medium == 1 || pXSprite->medium == 2) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(pSprite, pXSprite, &cultistTSwimFire); aiNewState(pSprite, pXSprite, &cultistTSwimFire);
break; break;
} }
@ -405,14 +405,14 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
switch (hit) switch (hit)
{ {
case -1: case -1:
if (pXSprite->medium != 1 && pXSprite->medium != 2) if (pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo)
aiNewState(pSprite, pXSprite, &cultistSThrow); aiNewState(pSprite, pXSprite, &cultistSThrow);
break; break;
case 0: case 0:
case 4: case 4:
break; break;
case 3: 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); aiNewState(pSprite, pXSprite, &cultistSThrow);
break; break;
default: default:
@ -426,39 +426,39 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
switch (hit) switch (hit)
{ {
case -1: case -1:
if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal)
aiNewState(pSprite, pXSprite, &cultistSFire); 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); aiNewState(pSprite, pXSprite, &cultistSProneFire);
else if (pXSprite->medium == 1 || pXSprite->medium == 2) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(pSprite, pXSprite, &cultistSSwimFire); aiNewState(pSprite, pXSprite, &cultistSSwimFire);
break; break;
case 3: case 3:
if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistTommy) 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); 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); aiNewState(pSprite, pXSprite, &cultistSProneFire);
else if (pXSprite->medium == 1 || pXSprite->medium == 2) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(pSprite, pXSprite, &cultistSSwimFire); aiNewState(pSprite, pXSprite, &cultistSSwimFire);
} }
else else
{ {
if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal)
aiNewState(pSprite, pXSprite, &cultistDodge); 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); aiNewState(pSprite, pXSprite, &cultistProneDodge);
else if (pXSprite->medium == 1 || pXSprite->medium == 2) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(pSprite, pXSprite, &cultistSwimDodge); aiNewState(pSprite, pXSprite, &cultistSwimDodge);
} }
break; break;
default: default:
if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal)
aiNewState(pSprite, pXSprite, &cultistSFire); 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); aiNewState(pSprite, pXSprite, &cultistSProneFire);
else if (pXSprite->medium == 1 || pXSprite->medium == 2) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(pSprite, pXSprite, &cultistSSwimFire); aiNewState(pSprite, pXSprite, &cultistSSwimFire);
break; break;
} }
@ -473,14 +473,14 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
switch (hit) switch (hit)
{ {
case -1: case -1:
if (pXSprite->medium != 1 && pXSprite->medium != 2) if (pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo)
aiNewState(pSprite, pXSprite, &cultistTsThrow); aiNewState(pSprite, pXSprite, &cultistTsThrow);
break; break;
case 0: case 0:
case 4: case 4:
break; break;
case 3: 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); aiNewState(pSprite, pXSprite, &cultistTsThrow);
break; break;
default: default:
@ -494,39 +494,39 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
switch (hit) switch (hit)
{ {
case -1: case -1:
if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal)
aiNewState(pSprite, pXSprite, &cultistTsFire); 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); aiNewState(pSprite, pXSprite, &cultistTsProneFire);
else if (pXSprite->medium == 1 || pXSprite->medium == 2) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(pSprite, pXSprite, &cultistTsSwimFire); aiNewState(pSprite, pXSprite, &cultistTsSwimFire);
break; break;
case 3: case 3:
if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistTommy) 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); 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); aiNewState(pSprite, pXSprite, &cultistTsProneFire);
else if (pXSprite->medium == 1 || pXSprite->medium == 2) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(pSprite, pXSprite, &cultistTsSwimFire); aiNewState(pSprite, pXSprite, &cultistTsSwimFire);
} }
else else
{ {
if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal)
aiNewState(pSprite, pXSprite, &cultistDodge); 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); aiNewState(pSprite, pXSprite, &cultistProneDodge);
else if (pXSprite->medium == 1 || pXSprite->medium == 2) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(pSprite, pXSprite, &cultistSwimDodge); aiNewState(pSprite, pXSprite, &cultistSwimDodge);
} }
break; break;
default: default:
if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal)
aiNewState(pSprite, pXSprite, &cultistTsFire); 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); aiNewState(pSprite, pXSprite, &cultistTsProneFire);
else if (pXSprite->medium == 1 || pXSprite->medium == 2) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(pSprite, pXSprite, &cultistTsSwimFire); aiNewState(pSprite, pXSprite, &cultistTsSwimFire);
break; break;
} }
@ -540,13 +540,13 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
switch (hit) switch (hit)
{ {
case -1: case -1:
if (pXSprite->medium != 1 && pXSprite->medium != 2) if (pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo)
aiNewState(pSprite, pXSprite, &cultistDThrow); aiNewState(pSprite, pXSprite, &cultistDThrow);
break; break;
case 4: case 4:
break; break;
case 3: 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); aiNewState(pSprite, pXSprite, &cultistDThrow);
break; break;
default: default:
@ -561,13 +561,13 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
switch (hit) switch (hit)
{ {
case -1: case -1:
if (pXSprite->medium != 1 && pXSprite->medium != 2) if (pXSprite->medium != 1 && pXSprite->medium != kMediumGoo)
aiNewState(pSprite, pXSprite, &cultist139A78); aiNewState(pSprite, pXSprite, &cultist139A78);
break; break;
case 4: case 4:
break; break;
case 3: 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); aiNewState(pSprite, pXSprite, &cultist139A78);
break; break;
default: default:
@ -585,14 +585,14 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
switch (hit) switch (hit)
{ {
case -1: case -1:
if (pXSprite->medium != 1 && pXSprite->medium != 2) if (pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo)
aiNewState(pSprite, pXSprite, &cultistSThrow); aiNewState(pSprite, pXSprite, &cultistSThrow);
break; break;
case 0: case 0:
case 4: case 4:
break; break;
case 3: 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); aiNewState(pSprite, pXSprite, &cultistSThrow);
break; break;
default: default:
@ -606,39 +606,39 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
switch (hit) switch (hit)
{ {
case -1: case -1:
if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal)
aiNewState(pSprite, pXSprite, &cultistSFire); 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); aiNewState(pSprite, pXSprite, &cultistSProneFire);
else if (pXSprite->medium == 1 || pXSprite->medium == 2) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(pSprite, pXSprite, &cultistSSwimFire); aiNewState(pSprite, pXSprite, &cultistSSwimFire);
break; break;
case 3: case 3:
if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistTommy) 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); 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); aiNewState(pSprite, pXSprite, &cultistSProneFire);
else if (pXSprite->medium == 1 || pXSprite->medium == 2) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(pSprite, pXSprite, &cultistSSwimFire); aiNewState(pSprite, pXSprite, &cultistSSwimFire);
} }
else else
{ {
if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal)
aiNewState(pSprite, pXSprite, &cultistDodge); 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); aiNewState(pSprite, pXSprite, &cultistProneDodge);
else if (pXSprite->medium == 1 || pXSprite->medium == 2) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(pSprite, pXSprite, &cultistSwimDodge); aiNewState(pSprite, pXSprite, &cultistSwimDodge);
} }
break; break;
default: default:
if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == 0) if (!sub_5BDA8(pSprite, 14) && pXSprite->medium == kMediumNormal)
aiNewState(pSprite, pXSprite, &cultistSFire); 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); aiNewState(pSprite, pXSprite, &cultistSProneFire);
else if (pXSprite->medium == 1 || pXSprite->medium == 2) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(pSprite, pXSprite, &cultistSSwimFire); aiNewState(pSprite, pXSprite, &cultistSSwimFire);
break; break;
} }
@ -651,11 +651,11 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
} }
switch (pXSprite->medium) switch (pXSprite->medium)
{ {
case 0: case kMediumNormal:
aiNewState(pSprite, pXSprite, &cultistGoto); aiNewState(pSprite, pXSprite, &cultistGoto);
break; break;
case 1: case kMediumWater:
case 2: case kMediumGoo:
aiNewState(pSprite, pXSprite, &cultistSwimGoto); aiNewState(pSprite, pXSprite, &cultistSwimGoto);
break; break;
} }

View file

@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "mmulti.h" #include "mmulti.h"
#include "common_game.h" #include "common_game.h"
#include "actor.h" #include "actor.h"
#include "ai.h" #include "ai.h"
#include "aigarg.h" #include "aigarg.h"
@ -225,9 +226,11 @@ static void ThrowSSeqCallback(int, int nXSprite)
static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite) 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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
if (pDudeExtraE->at8 && pDudeExtraE->at4 < 10) 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]) for (int p = connecthead; p >= 0; p = connectpoint2[p])
{ {
PLAYER *pPlayer = &gPlayer[p]; PLAYER *pPlayer = &gPlayer[p];
if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, 13) > 0) if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
continue; continue;
int x = pPlayer->pSprite->x; int x = pPlayer->pSprite->x;
int y = pPlayer->pSprite->y; int y = pPlayer->pSprite->y;
@ -286,9 +289,11 @@ static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite)
static void thinkGoto(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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
int dx = pXSprite->targetX-pSprite->x; int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y; int dy = pXSprite->targetY-pSprite->y;
@ -303,9 +308,11 @@ static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite)
static void MoveDodgeUp(spritetype *pSprite, XSPRITE *pXSprite) static void MoveDodgeUp(spritetype *pSprite, XSPRITE *pXSprite)
{ {
int nSprite = pSprite->index; 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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4; int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
@ -329,9 +336,11 @@ static void MoveDodgeUp(spritetype *pSprite, XSPRITE *pXSprite)
static void MoveDodgeDown(spritetype *pSprite, XSPRITE *pXSprite) static void MoveDodgeDown(spritetype *pSprite, XSPRITE *pXSprite)
{ {
int nSprite = pSprite->index; 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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4; int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
@ -361,13 +370,17 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &gargoyleFGoto); aiNewState(pSprite, pXSprite, &gargoyleFGoto);
return; 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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; 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; return;
//dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); }
spritetype *pTarget = &sprite[pXSprite->target]; spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra]; XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x; int dx = pTarget->x-pSprite->x;
@ -378,7 +391,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &gargoyleFSearch); aiNewState(pSprite, pXSprite, &gargoyleFSearch);
return; 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); aiNewState(pSprite, pXSprite, &gargoyleFSearch);
return; return;
@ -547,9 +560,11 @@ static void entrySStatue(spritetype *pSprite, XSPRITE *pXSprite)
static void MoveForward(spritetype *pSprite, XSPRITE *pXSprite) static void MoveForward(spritetype *pSprite, XSPRITE *pXSprite)
{ {
int nSprite = pSprite->index; 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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4; int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
@ -582,9 +597,11 @@ static void MoveForward(spritetype *pSprite, XSPRITE *pXSprite)
static void MoveSlow(spritetype *pSprite, XSPRITE *pXSprite) static void MoveSlow(spritetype *pSprite, XSPRITE *pXSprite)
{ {
int nSprite = pSprite->index; 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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4; int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
@ -624,9 +641,11 @@ static void MoveSlow(spritetype *pSprite, XSPRITE *pXSprite)
static void MoveSwoop(spritetype *pSprite, XSPRITE *pXSprite) static void MoveSwoop(spritetype *pSprite, XSPRITE *pXSprite)
{ {
int nSprite = pSprite->index; 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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4; int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
@ -665,9 +684,11 @@ static void MoveSwoop(spritetype *pSprite, XSPRITE *pXSprite)
static void MoveFly(spritetype *pSprite, XSPRITE *pXSprite) static void MoveFly(spritetype *pSprite, XSPRITE *pXSprite)
{ {
int nSprite = pSprite->index; 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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4; int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;

View file

@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "mmulti.h" #include "mmulti.h"
#include "common_game.h" #include "common_game.h"
#include "actor.h" #include "actor.h"
#include "ai.h" #include "ai.h"
#include "aighost.h" #include "aighost.h"
@ -200,9 +201,11 @@ static void BlastSeqCallback(int, int nXSprite)
static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite) 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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
if (pDudeExtraE->at8 && pDudeExtraE->at4 < 10) 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]) for (int p = connecthead; p >= 0; p = connectpoint2[p])
{ {
PLAYER *pPlayer = &gPlayer[p]; PLAYER *pPlayer = &gPlayer[p];
if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, 13) > 0) if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
continue; continue;
int x = pPlayer->pSprite->x; int x = pPlayer->pSprite->x;
int y = pPlayer->pSprite->y; int y = pPlayer->pSprite->y;
@ -260,9 +263,11 @@ static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite)
static void thinkGoto(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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
int dx = pXSprite->targetX-pSprite->x; int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y; int dy = pXSprite->targetY-pSprite->y;
@ -277,9 +282,11 @@ static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite)
static void MoveDodgeUp(spritetype *pSprite, XSPRITE *pXSprite) static void MoveDodgeUp(spritetype *pSprite, XSPRITE *pXSprite)
{ {
int nSprite = pSprite->index; 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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4; int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
@ -303,9 +310,11 @@ static void MoveDodgeUp(spritetype *pSprite, XSPRITE *pXSprite)
static void MoveDodgeDown(spritetype *pSprite, XSPRITE *pXSprite) static void MoveDodgeDown(spritetype *pSprite, XSPRITE *pXSprite)
{ {
int nSprite = pSprite->index; 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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4; int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
@ -335,13 +344,17 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &ghostGoto); aiNewState(pSprite, pXSprite, &ghostGoto);
return; 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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; 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; return;
//dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); }
spritetype *pTarget = &sprite[pXSprite->target]; spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra]; XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x; int dx = pTarget->x-pSprite->x;
@ -352,7 +365,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &ghostSearch); aiNewState(pSprite, pXSprite, &ghostSearch);
return; 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); aiNewState(pSprite, pXSprite, &ghostSearch);
return; return;
@ -439,9 +452,11 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
static void MoveForward(spritetype *pSprite, XSPRITE *pXSprite) static void MoveForward(spritetype *pSprite, XSPRITE *pXSprite)
{ {
int nSprite = pSprite->index; 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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4; int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
@ -474,9 +489,11 @@ static void MoveForward(spritetype *pSprite, XSPRITE *pXSprite)
static void MoveSlow(spritetype *pSprite, XSPRITE *pXSprite) static void MoveSlow(spritetype *pSprite, XSPRITE *pXSprite)
{ {
int nSprite = pSprite->index; 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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4; int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
@ -513,9 +530,11 @@ static void MoveSlow(spritetype *pSprite, XSPRITE *pXSprite)
static void MoveSwoop(spritetype *pSprite, XSPRITE *pXSprite) static void MoveSwoop(spritetype *pSprite, XSPRITE *pXSprite)
{ {
int nSprite = pSprite->index; 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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4; int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;
@ -551,9 +570,11 @@ static void MoveSwoop(spritetype *pSprite, XSPRITE *pXSprite)
static void MoveFly(spritetype *pSprite, XSPRITE *pXSprite) static void MoveFly(spritetype *pSprite, XSPRITE *pXSprite)
{ {
int nSprite = pSprite->index; 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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024; int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
int nTurnRange = (pDudeInfo->angSpeed<<2)>>4; int nTurnRange = (pDudeInfo->angSpeed<<2)>>4;

View file

@ -159,7 +159,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &gillBeastSearch); aiNewState(pSprite, pXSprite, &gillBeastSearch);
return; return;
} }
if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0)
{ {
XSECTOR *pXSector; XSECTOR *pXSector;
int nXSector = sector[pSprite->sectnum].extra; int nXSector = sector[pSprite->sectnum].extra;
@ -279,7 +279,7 @@ static void thinkSwimChase(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &gillBeastSwimSearch); aiNewState(pSprite, pXSprite, &gillBeastSwimSearch);
return; 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); aiNewState(pSprite, pXSprite, &gillBeastSwimSearch);
return; return;

View file

@ -116,7 +116,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &handSearch); aiNewState(pSprite, pXSprite, &handSearch);
return; 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); aiNewState(pSprite, pXSprite, &handSearch);
return; return;

View file

@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "mmulti.h" #include "mmulti.h"
#include "common_game.h" #include "common_game.h"
#include "actor.h" #include "actor.h"
#include "ai.h" #include "ai.h"
#include "aihound.h" #include "aihound.h"
@ -69,13 +70,17 @@ static void BiteSeqCallback(int, int nXSprite)
spritetype *pSprite = &sprite[nSprite]; spritetype *pSprite = &sprite[nSprite];
int dx = Cos(pSprite->ang)>>16; int dx = Cos(pSprite->ang)>>16;
int dy = Sin(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; 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; return;
//dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); }
spritetype *pTarget = &sprite[pXSprite->target]; spritetype *pTarget = &sprite[pXSprite->target];
if (IsPlayerSprite(pTarget) || !VanillaMode()) // allow to hit non-player targets if not a demo 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); 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) 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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
int dx = pXSprite->targetX-pSprite->x; int dx = pXSprite->targetX-pSprite->x;
@ -119,13 +126,17 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &houndGoto); aiNewState(pSprite, pXSprite, &houndGoto);
return; 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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; 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; return;
//dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); }
spritetype *pTarget = &sprite[pXSprite->target]; spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra]; XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x; int dx = pTarget->x-pSprite->x;
@ -136,7 +147,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &houndSearch); aiNewState(pSprite, pXSprite, &houndSearch);
return; 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); aiNewState(pSprite, pXSprite, &houndSearch);
return; return;

View file

@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "mmulti.h" #include "mmulti.h"
#include "common_game.h" #include "common_game.h"
#include "actor.h" #include "actor.h"
#include "ai.h" #include "ai.h"
#include "aipod.h" #include "aipod.h"
@ -93,13 +94,19 @@ static void sub_6FFA0(int, int nXSprite)
XSPRITE *pXSprite = &xsprite[nXSprite]; XSPRITE *pXSprite = &xsprite[nXSprite];
int nSprite = pXSprite->reference; int nSprite = pXSprite->reference;
spritetype *pSprite = &sprite[nSprite]; 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; return;
//dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); }
spritetype *pTarget = &sprite[pXSprite->target]; 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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
int x = pTarget->x-pSprite->x; int x = pTarget->x-pSprite->x;
int y = pTarget->y-pSprite->y; 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) 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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
int dx = pXSprite->targetX-pSprite->x; int dx = pXSprite->targetX-pSprite->x;
@ -211,13 +220,17 @@ static void sub_704D8(spritetype *pSprite, XSPRITE *pXSprite)
} }
return; 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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; 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; return;
//dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); }
spritetype *pTarget = &sprite[pXSprite->target]; spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra]; XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x; int dx = pTarget->x-pSprite->x;

View file

@ -113,7 +113,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &ratSearch); aiNewState(pSprite, pXSprite, &ratSearch);
return; 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); aiNewState(pSprite, pXSprite, &ratSearch);
return; return;

View file

@ -110,8 +110,8 @@ static void SpidBiteSeqCallback(int, int nXSprite)
switch (pSprite->type) { switch (pSprite->type) {
case kDudeSpiderBrown: case kDudeSpiderBrown:
actFireVector(pSprite, 0, 0, dx, dy, dz, VECTOR_TYPE_17); actFireVector(pSprite, 0, 0, dx, dy, dz, VECTOR_TYPE_17);
if (IsPlayerSprite(pTarget) && !pPlayer->at31a && powerupCheck(pPlayer, 14) <= 0 && Chance(0x4000)) if (IsPlayerSprite(pTarget) && !pPlayer->at31a && powerupCheck(pPlayer, kPwUpDeathMask) <= 0 && Chance(0x4000))
powerupActivate(pPlayer, 28); powerupActivate(pPlayer, kPwUpDeliriumShroom);
break; break;
case kDudeSpiderRed: case kDudeSpiderRed:
actFireVector(pSprite, 0, 0, dx, dy, dz, VECTOR_TYPE_17); 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); aiNewState(pSprite, pXSprite, &spidSearch);
return; 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); aiNewState(pSprite, pXSprite, &spidSearch);
return; return;

View file

@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "mmulti.h" #include "mmulti.h"
#include "common_game.h" #include "common_game.h"
#include "actor.h" #include "actor.h"
#include "ai.h" #include "ai.h"
#include "aitchern.h" #include "aitchern.h"
@ -89,9 +90,11 @@ static void sub_71BD4(int, int nXSprite)
spritetype *pSprite = &sprite[nSprite]; spritetype *pSprite = &sprite[nSprite];
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
int height = pSprite->yrepeat*pDudeInfo->eyeHeight; 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; return;
//dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); }
int x = pSprite->x; int x = pSprite->x;
int y = pSprite->y; int y = pSprite->y;
int z = height; int z = height;
@ -159,9 +162,11 @@ static void sub_720AC(int, int nXSprite)
XSPRITE *pXSprite = &xsprite[nXSprite]; XSPRITE *pXSprite = &xsprite[nXSprite];
int nSprite = pXSprite->reference; int nSprite = pXSprite->reference;
spritetype *pSprite = &sprite[nSprite]; 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; return;
//dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
int height = pSprite->yrepeat*pDudeInfo->eyeHeight; int height = pSprite->yrepeat*pDudeInfo->eyeHeight;
int ax, ay, az; int ax, ay, az;
@ -238,9 +243,11 @@ static void sub_72580(spritetype *pSprite, XSPRITE *pXSprite)
static void sub_725A4(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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2; DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2;
if (pDudeExtraE->at4 && pDudeExtraE->at0 < 10) 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]) for (int p = connecthead; p >= 0; p = connectpoint2[p])
{ {
PLAYER *pPlayer = &gPlayer[p]; PLAYER *pPlayer = &gPlayer[p];
if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, 13) > 0) if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
continue; continue;
int x = pPlayer->pSprite->x; int x = pPlayer->pSprite->x;
int y = pPlayer->pSprite->y; 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) 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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
int dx = pXSprite->targetX-pSprite->x; int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y; int dy = pXSprite->targetY-pSprite->y;
@ -314,13 +323,17 @@ static void sub_72934(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &tcherno13A9B8); aiNewState(pSprite, pXSprite, &tcherno13A9B8);
return; 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; return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); }
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; 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; return;
//dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); }
spritetype *pTarget = &sprite[pXSprite->target]; spritetype *pTarget = &sprite[pXSprite->target];
XSPRITE *pXTarget = &xsprite[pTarget->extra]; XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x; int dx = pTarget->x-pSprite->x;
@ -331,7 +344,7 @@ static void sub_72934(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &tchernobogSearch); aiNewState(pSprite, pXSprite, &tchernobogSearch);
return; 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); aiNewState(pSprite, pXSprite, &tchernobogSearch);
return; return;

View file

@ -411,7 +411,7 @@ static void thinkChase( spritetype* pSprite, XSPRITE* pXSprite )
if (IsPlayerSprite(pTarget)) if (IsPlayerSprite(pTarget))
{ {
PLAYER* pPlayer = &gPlayer[ pTarget->type - kDudePlayer1 ]; PLAYER* pPlayer = &gPlayer[ pTarget->type - kDudePlayer1 ];
if (powerupCheck( pPlayer, 13 ) > 0) { if (powerupCheck(pPlayer, kPwUpShadowCloak) > 0) {
if(spriteIsUnderwater(pSprite,false)) aiNewState(pSprite, pXSprite, &GDXGenDudeSearchW); if(spriteIsUnderwater(pSprite,false)) aiNewState(pSprite, pXSprite, &GDXGenDudeSearchW);
else aiNewState(pSprite, pXSprite, &GDXGenDudeSearchL); else aiNewState(pSprite, pXSprite, &GDXGenDudeSearchL);
return; return;
@ -829,7 +829,7 @@ bool sfxPlayGDXGenDudeSound(spritetype* pSprite, int mode) {
bool spriteIsUnderwater(spritetype* pSprite,bool oldWay) { bool spriteIsUnderwater(spritetype* pSprite,bool oldWay) {
if (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 true;
return false; return false;
} }
@ -858,7 +858,7 @@ void removeDudeStuff(spritetype* pSprite) {
case kThingArmedProxBomb: case kThingArmedProxBomb:
case kThingArmedRemoteBomb: case kThingArmedRemoteBomb:
case kModernThingTNTProx: case kModernThingTNTProx:
sprite[nSprite].type = 0; sprite[nSprite].type = kSpriteDecoration;
actPostSprite(sprite[nSprite].xvel, kStatFree); actPostSprite(sprite[nSprite].xvel, kStatFree);
break; break;
case kModernThingEnemyLifeLeech: case kModernThingEnemyLifeLeech:
@ -885,7 +885,7 @@ void removeLeech(spritetype* pLeech, bool delSprite) {
} }
sfxPlay3DSoundCP(pLeech, 490, -1, 0,60000); sfxPlay3DSoundCP(pLeech, 490, -1, 0,60000);
if (delSprite) { if (delSprite) {
pLeech->type = 0; pLeech->type = kSpriteDecoration;
actPostSprite(pLeech->index, kStatFree); actPostSprite(pLeech->index, kStatFree);
} }
} }

View file

@ -145,7 +145,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &zombieASearch); aiNewState(pSprite, pXSprite, &zombieASearch);
return; 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); aiNewState(pSprite, pXSprite, &zombieAGoto);
return; return;
@ -191,7 +191,7 @@ static void thinkPonder(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &zombieASearch); aiNewState(pSprite, pXSprite, &zombieASearch);
return; 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); aiNewState(pSprite, pXSprite, &zombieAGoto);
return; return;
@ -230,7 +230,7 @@ static void myThinkTarget(spritetype *pSprite, XSPRITE *pXSprite)
{ {
PLAYER *pPlayer = &gPlayer[p]; PLAYER *pPlayer = &gPlayer[p];
int nOwner = (pSprite->owner & 0x1000) ? (pSprite->owner&0xfff) : -1; 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; continue;
int x = pPlayer->pSprite->x; int x = pPlayer->pSprite->x;
int y = pPlayer->pSprite->y; int y = pPlayer->pSprite->y;

View file

@ -153,7 +153,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &zombieFSearch); aiNewState(pSprite, pXSprite, &zombieFSearch);
return; 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); aiNewState(pSprite, pXSprite, &zombieFSearch);
return; return;

View file

@ -588,10 +588,6 @@ void StartLevel(GAMEOPTIONS *gameOptions)
case kModernDudeTargetChanger: case kModernDudeTargetChanger:
changespritestat(i, kStatModernDudeTargetChanger); changespritestat(i, kStatModernDudeTargetChanger);
break; break;
// add statnum for faster searching of already enabled qav players
case kModernPlayQAV:
changespritestat(i, kStatModernPlayQAV);
break;
// remove kStatItem status from random item generators // remove kStatItem status from random item generators
case kModernRandom: case kModernRandom:
case kModernRandom2: case kModernRandom2:

View file

@ -649,7 +649,7 @@ void DropVoodoo(int nSprite) // unused
if (gGameOptions.nGameType == 3 && pPlayer->at2ea == pPlayer2->at2ea) if (gGameOptions.nGameType == 3 && pPlayer->at2ea == pPlayer2->at2ea)
continue; continue;
int t = 0x8000/ClipLow(gNetPlayers-1, 1); int t = 0x8000/ClipLow(gNetPlayers-1, 1);
if (!powerupCheck(pPlayer2, 14)) if (!powerupCheck(pPlayer2, kPwUpDeathMask))
t += ((3200-pPlayer2->at33e[2])<<15)/3200; t += ((3200-pPlayer2->at33e[2])<<15)/3200;
if (Chance(t) || nNextSprite < 0) if (Chance(t) || nNextSprite < 0)
{ {

View file

@ -80,6 +80,7 @@ const char *G_DefFile(void)
return (g_defNamePtr == NULL) ? G_DefaultDefFile() : g_defNamePtr; return (g_defNamePtr == NULL) ? G_DefaultDefFile() : g_defNamePtr;
} }
void G_SetupGlobalPsky(void) void G_SetupGlobalPsky(void)
{ {
int skyIdx = 0; int skyIdx = 0;

View file

@ -42,6 +42,7 @@ void _SetErrorLoc(const char *pzFile, int nLine);
void _ThrowError(const char *pzFormat, ...); void _ThrowError(const char *pzFormat, ...);
void __dassert(const char *pzExpr, const char *pzFile, int nLine); void __dassert(const char *pzExpr, const char *pzFile, int nLine);
void QuitGame(void); void QuitGame(void);
void _consoleSysMsg(const char* pMessage, ...);
#define ThrowError(...) \ #define ThrowError(...) \
{ \ { \
@ -49,8 +50,16 @@ void QuitGame(void);
_ThrowError(__VA_ARGS__); \ _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 dassert(x) if (!(x)) __dassert(#x,__FILE__,__LINE__)
#define kMaxSectors MAXSECTORS #define kMaxSectors MAXSECTORS
#define kMaxWalls MAXWALLS #define kMaxWalls MAXWALLS
#define kMaxSprites MAXSPRITES #define kMaxSprites MAXSPRITES
@ -70,32 +79,6 @@ void QuitGame(void);
#define kExplodeMax 8 #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 kLensSize 80
#define kViewEffectMax 19 #define kViewEffectMax 19
@ -105,7 +88,61 @@ void QuitGame(void);
// defined by NoOne: // defined by NoOne:
// ------------------------------- // -------------------------------
#define kMaxPAL 5 #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 ///////////////////////////////////////////////// // SPRITE TYPES /////////////////////////////////////////////////
enum { enum {
@ -154,7 +191,7 @@ enum {
kModernEffectSpawner = 38, kModernEffectSpawner = 38,
kModernWindGenerator = 39, kModernWindGenerator = 39,
kModernConcussSprite = 712, /// WIP kModernConcussSprite = 712, /// WIP
kModernPlayQAV = 713, /// WIP kModernPlayerControl = 713, /// WIP
// decorations // decorations
kDecorationTorch = 30, kDecorationTorch = 30,
@ -209,8 +246,8 @@ enum {
kItemReflectShots = 124, kItemReflectShots = 124,
kItemBeastVision = 125, kItemBeastVision = 125,
kItemShroomDelirium = 128, kItemShroomDelirium = 128,
kItemShroomGrow = 129, // gModernMap = only kItemShroomGrow = 129, // gModernMap only
kItemShroomShrink = 130, // gModernMap = only kItemShroomShrink = 130, // gModernMap only
kItemArmorAsbest = 139, kItemArmorAsbest = 139,
kItemArmorBasic = 140, kItemArmorBasic = 140,

View file

@ -100,7 +100,8 @@ enum COMMAND_ID {
kCmdModernUse = 53, // used by most of modern types kCmdModernUse = 53, // used by most of modern types
kCmdNumberic = 64, // 64: 0, 65: 1 and so on up to 255 kCmdNumberic = 64, // 64: 0, 65: 1 and so on up to 255
kCmdModernFeaturesEnable = 100, // must be in object with kChannelMapExtended RX / TX 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 { struct EVENT {

View file

@ -72,6 +72,19 @@ void _ThrowError(const char *pzFormat, ...)
QuitGame(); 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) void __dassert(const char * pzExpr, const char * pzFile, int nLine)
{ {
initprintf("Assertion failed: %s in file %s at line %i\n", pzExpr, pzFile, nLine); initprintf("Assertion failed: %s in file %s at line %i\n", pzExpr, pzFile, nLine);

View file

@ -201,91 +201,91 @@ void SetWooMode(bool stat)
{ {
if (stat) if (stat)
{ {
if (!powerupCheck(gMe, 17)) if (!powerupCheck(gMe, kPwUpTwoGuns))
powerupActivate(gMe, 17); powerupActivate(gMe, kPwUpTwoGuns);
} }
else else
{ {
if (powerupCheck(gMe, 17)) if (powerupCheck(gMe, kPwUpTwoGuns))
{ {
if (!VanillaMode()) if (!VanillaMode())
gMe->at202[17] = 0; gMe->at202[kPwUpTwoGuns] = 0;
powerupDeactivate(gMe, 17); powerupDeactivate(gMe, kPwUpTwoGuns);
} }
} }
} }
void ToggleWooMode(void) void ToggleWooMode(void)
{ {
SetWooMode(!(powerupCheck(gMe, 17) != 0)); SetWooMode(!(powerupCheck(gMe, kPwUpTwoGuns) != 0));
} }
void ToggleBoots(void) void ToggleBoots(void)
{ {
if (powerupCheck(gMe, 15)) if (powerupCheck(gMe, kPwUpJumpBoots))
{ {
viewSetMessage("You have no Jumping Boots."); viewSetMessage("You have no Jumping Boots.");
if (!VanillaMode()) if (!VanillaMode())
{ {
gMe->at202[15] = 0; gMe->at202[kPwUpJumpBoots] = 0;
gMe->packInfo[4].at1 = 0; gMe->packInfo[4].at1 = 0;
} }
powerupDeactivate(gMe, 15); powerupDeactivate(gMe, kPwUpJumpBoots);
} }
else else
{ {
viewSetMessage("You have the Jumping Boots."); viewSetMessage("You have the Jumping Boots.");
if (!VanillaMode()) if (!VanillaMode())
gMe->at202[15] = gPowerUpInfo[15].at3; gMe->at202[kPwUpJumpBoots] = gPowerUpInfo[kPwUpJumpBoots].bonusTime;
powerupActivate(gMe, 15); powerupActivate(gMe, kPwUpJumpBoots);
} }
} }
void ToggleInvisibility(void) void ToggleInvisibility(void)
{ {
if (powerupCheck(gMe, 13)) if (powerupCheck(gMe, kPwUpShadowCloak))
{ {
viewSetMessage("You are visible."); viewSetMessage("You are visible.");
if (!VanillaMode()) if (!VanillaMode())
gMe->at202[13] = 0; gMe->at202[kPwUpShadowCloak] = 0;
powerupDeactivate(gMe, 13); powerupDeactivate(gMe, kPwUpShadowCloak);
} }
else else
{ {
viewSetMessage("You are invisible."); viewSetMessage("You are invisible.");
powerupActivate(gMe, 13); powerupActivate(gMe, kPwUpShadowCloak);
} }
} }
void ToggleInvulnerability(void) void ToggleInvulnerability(void)
{ {
if (powerupCheck(gMe, 14)) if (powerupCheck(gMe, kPwUpDeathMask))
{ {
viewSetMessage("You are vulnerable."); viewSetMessage("You are vulnerable.");
if (!VanillaMode()) if (!VanillaMode())
gMe->at202[14] = 0; gMe->at202[kPwUpDeathMask] = 0;
powerupDeactivate(gMe, 14); powerupDeactivate(gMe, kPwUpDeathMask);
} }
else else
{ {
viewSetMessage("You are invulnerable."); viewSetMessage("You are invulnerable.");
powerupActivate(gMe, 14); powerupActivate(gMe, kPwUpDeathMask);
} }
} }
void ToggleDelirium(void) void ToggleDelirium(void)
{ {
if (powerupCheck(gMe, 28)) if (powerupCheck(gMe, kPwUpDeliriumShroom))
{ {
viewSetMessage("You are not delirious."); viewSetMessage("You are not delirious.");
if (!VanillaMode()) if (!VanillaMode())
gMe->at202[28] = 0; gMe->at202[kPwUpDeliriumShroom] = 0;
powerupDeactivate(gMe, 28); powerupDeactivate(gMe, kPwUpDeliriumShroom);
} }
else else
{ {
viewSetMessage("You are delirious."); viewSetMessage("You are delirious.");
powerupActivate(gMe, 28); powerupActivate(gMe, kPwUpDeliriumShroom);
} }
} }
@ -832,7 +832,7 @@ void CCheatMgr::Process(CCheatMgr::CHEATCODE nCheatCode, char* pzArgs)
case kCheatCheeseHead: case kCheatCheeseHead:
gMe->packInfo[1].at1 = 100; gMe->packInfo[1].at1 = 100;
if (!VanillaMode()) if (!VanillaMode())
gMe->at202[18] = gPowerUpInfo[18].at3; gMe->at202[kPwUpDivingSuit] = gPowerUpInfo[kPwUpDivingSuit].bonusTime;
break; break;
case kCheatTequila: case kCheatTequila:
ToggleWooMode(); ToggleWooMode();
@ -885,7 +885,7 @@ void CCheatMgr::Process(CCheatMgr::CHEATCODE nCheatCode, char* pzArgs)
actHealDude(gMe->pXSprite,200,200); actHealDude(gMe->pXSprite,200,200);
gMe->packInfo[1].at1 = 100; gMe->packInfo[1].at1 = 100;
if (!VanillaMode()) if (!VanillaMode())
gMe->at202[18] = gPowerUpInfo[18].at3; gMe->at202[kPwUpDivingSuit] = gPowerUpInfo[kPwUpDivingSuit].bonusTime;
break; break;
case kCheatForkYou: case kCheatForkYou:
SetInfiniteAmmo(false); SetInfiniteAmmo(false);
@ -896,7 +896,7 @@ void CCheatMgr::Process(CCheatMgr::CHEATCODE nCheatCode, char* pzArgs)
SetToys(false); SetToys(false);
SetKeys(false); SetKeys(false);
SetWooMode(true); SetWooMode(true);
powerupActivate(gMe, 28); powerupActivate(gMe, kPwUpDeliriumShroom);
gMe->pXSprite->health = 16; gMe->pXSprite->health = 16;
gMe->atcb[1] = 1; gMe->atcb[1] = 1;
gMe->atbd = 0; gMe->atbd = 0;

View file

@ -64,72 +64,87 @@ PLAYER *gMe, *gView;
bool gBlueFlagDropped = false; bool gBlueFlagDropped = false;
bool gRedFlagDropped = false; bool gRedFlagDropped = false;
// V = has effect in game, X = no effect in game
POWERUPINFO gPowerUpInfo[kMaxPowerUps] = { POWERUPINFO gPowerUpInfo[kMaxPowerUps] = {
{ -1, 1, 1, 1 }, { -1, 1, 1, 1 }, // 00: V keys
{ -1, 1, 1, 1 }, { -1, 1, 1, 1 }, // 01: V keys
{ -1, 1, 1, 1 }, { -1, 1, 1, 1 }, // 02: V keys
{ -1, 1, 1, 1 }, { -1, 1, 1, 1 }, // 03: V keys
{ -1, 1, 1, 1 }, { -1, 1, 1, 1 }, // 04: V keys
{ -1, 1, 1, 1 }, { -1, 1, 1, 1 }, // 05: V keys
{ -1, 1, 1, 1 }, { -1, 1, 1, 1 }, // 06: V keys
{ -1, 0, 100, 100 }, { -1, 0, 100, 100 }, // 07: V doctor's bag
{ -1, 0, 50, 100 }, { -1, 0, 50, 100 }, // 08: V medicine pouch
{ -1, 0, 20, 100 }, { -1, 0, 20, 100 }, // 09: V life essense
{ -1, 0, 100, 200 }, { -1, 0, 100, 200 }, // 10: V life seed
{ -1, 0, 2, 200 }, { -1, 0, 2, 200 }, // 11: V red potion
{ 783, 0, 3600, 432000 }, { 783, 0, 3600, 432000 }, // 12: V feather fall
{ -1, 0, 3600, 432000 }, // 13: cloak of invisibility { 896, 0, 3600, 432000 }, // 13: V cloak of invisibility
{ -1, 1, 3600, 432000 }, // 14: death mask (invulnerability) { 825, 1, 3600, 432000 }, // 14: V death mask (invulnerability)
{ 827, 0, 3600, 432000 }, // 15: jump boots { 827, 0, 3600, 432000 }, // 15: V jump boots
{ 828, 0, 3600, 432000 }, { 828, 0, 3600, 432000 }, // 16: X raven flight
{ -1, 0, 3600, 1728000 }, // 17: guns akimbo { 829, 0, 3600, 1728000 }, // 17: V guns akimbo
{ -1, 0, 3600, 432000 }, // 18: diving suit { 830, 0, 3600, 432000 }, // 18: V diving suit
{ -1, 0, 3600, 432000 }, { 831, 0, 3600, 432000 }, // 19: V gas mask
{ -1, 0, 3600, 432000 }, { -1, 0, 3600, 432000 }, // 20: X clone
{ -1, 0, 3600, 432000 }, // 21: crystal ball { 2566, 0, 3600, 432000 }, // 21: V crystal ball
{ -1, 0, 3600, 432000 }, { 836, 0, 3600, 432000 }, // 22: X decoy
{ 851, 0, 3600, 432000 }, { 853, 0, 3600, 432000 }, // 23: V doppleganger
{ 2428, 0, 3600, 432000 }, // 24: reflective shots { 2428, 0, 3600, 432000 }, // 24: V reflective shots
{ -1, 0, 3600, 432000 }, // 25: beast vision { 839, 0, 3600, 432000 }, // 25: V beast vision
{ -1, 0, 3600, 432000 }, // 26: cloak of shadow { 768, 0, 3600, 432000 }, // 26: X cloak of shadow (useless)
{ -1, 0, 3600, 432000 }, { 840, 0, 3600, 432000 }, // 27: X rage shroom
{ -1, 0, 900, 432000 }, { 841, 0, 900, 432000 }, // 28: V delirium shroom
{ -1, 0, 3600, 432000 }, { 842, 0, 3600, 432000 }, // 29: V grow shroom (gModernMap only)
{ -1, 0, 3600, 432000 }, { 843, 0, 3600, 432000 }, // 30: V shrink shroom (gModernMap only)
{ -1, 0, 3600, 432000 }, { -1, 0, 3600, 432000 }, // 31: X death mask (useless)
{ -1, 0, 3600, 432000 }, { -1, 0, 3600, 432000 }, // 32: X wine goblet
{ -1, 0, 3600, 432000 }, { -1, 0, 3600, 432000 }, // 33: X wine bottle
{ -1, 0, 3600, 432000 }, { -1, 0, 3600, 432000 }, // 34: X skull grail
{ -1, 0, 3600, 432000 }, { -1, 0, 3600, 432000 }, // 35: X silver grail
{ -1, 0, 3600, 432000 }, { -1, 0, 3600, 432000 }, // 36: X tome
{ -1, 0, 3600, 432000 }, { -1, 0, 3600, 432000 }, // 37: X black chest
{ -1, 0, 3600, 432000 }, { -1, 0, 3600, 432000 }, // 38: X wooden chest
{ -1, 1, 3600, 432000 }, { 837, 1, 3600, 432000 }, // 39: V asbestos armor
{ -1, 0, 1, 432000 }, { -1, 0, 1, 432000 }, // 40: V basic armor
{ -1, 0, 1, 432000 }, { -1, 0, 1, 432000 }, // 41: V body armor
{ -1, 0, 1, 432000 }, { -1, 0, 1, 432000 }, // 42: V fire armor
{ -1, 0, 1, 432000 }, { -1, 0, 1, 432000 }, // 43: V spirit armor
{ -1, 0, 1, 432000 }, { -1, 0, 1, 432000 }, // 44: V super armor
{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, // 45: ? unknown
{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, // 46: ? unknown
{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, // 47: ? unknown
{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, // 48: ? unknown
{ 0, 0, 0, 0 }, // dummy { 0, 0, 0, 0 }, // 49: X dummy
{ -1, 1, 1, 1 } // kGDXItemLevelMap { 833, 1, 1, 1 } // 50: V kModernItemLevelMap (gModernMap only)
}; };
int Handicap[] = { int Handicap[] = {
144, 208, 256, 304, 368 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] = { POSTURE gPosture[4][3] = {
// normal human // normal human
{ {
{ {
0x4000, gDefaultAccel[0],
0x4000, gDefaultAccel[0],
0x4000, gDefaultAccel[0],
14, 14,
17, 17,
24, 24,
@ -142,9 +157,9 @@ POSTURE gPosture[4][3] = {
0x90 0x90
}, },
{ {
0x1200, gDefaultAccel[1],
0x1200, gDefaultAccel[1],
0x1200, gDefaultAccel[1],
14, 14,
17, 17,
24, 24,
@ -157,9 +172,9 @@ POSTURE gPosture[4][3] = {
0xb0 0xb0
}, },
{ {
0x2000, gDefaultAccel[2],
0x2000, gDefaultAccel[2],
0x2000, gDefaultAccel[2],
22, 22,
28, 28,
24, 24,
@ -176,9 +191,9 @@ POSTURE gPosture[4][3] = {
// normal beast // normal beast
{ {
{ {
0x4000, gDefaultAccel[3],
0x4000, gDefaultAccel[3],
0x4000, gDefaultAccel[3],
14, 14,
17, 17,
24, 24,
@ -191,9 +206,9 @@ POSTURE gPosture[4][3] = {
0x90 0x90
}, },
{ {
0x1200, gDefaultAccel[4],
0x1200, gDefaultAccel[4],
0x1200, gDefaultAccel[4],
14, 14,
17, 17,
24, 24,
@ -206,9 +221,9 @@ POSTURE gPosture[4][3] = {
0xb0 0xb0
}, },
{ {
0x2000, gDefaultAccel[5],
0x2000, gDefaultAccel[5],
0x2000, gDefaultAccel[5],
22, 22,
28, 28,
24, 24,
@ -225,9 +240,9 @@ POSTURE gPosture[4][3] = {
// shrink human // shrink human
{ {
{ {
10384, gDefaultAccel[6],
12384, gDefaultAccel[6],
12384, gDefaultAccel[6],
14, 14,
17, 17,
24, 24,
@ -240,9 +255,9 @@ POSTURE gPosture[4][3] = {
144 144
}, },
{ {
2108, gDefaultAccel[7],
2108, gDefaultAccel[7],
2108, gDefaultAccel[7],
14, 14,
17, 17,
24, 24,
@ -255,9 +270,9 @@ POSTURE gPosture[4][3] = {
176 176
}, },
{ {
2192, gDefaultAccel[8],
3192, gDefaultAccel[8],
4192, gDefaultAccel[8],
22, 22,
28, 28,
24, 24,
@ -274,9 +289,9 @@ POSTURE gPosture[4][3] = {
// grown human // grown human
{ {
{ {
19384, gDefaultAccel[9],
15384, gDefaultAccel[9],
15384, gDefaultAccel[9],
14, 14,
17, 17,
24, 24,
@ -289,9 +304,9 @@ POSTURE gPosture[4][3] = {
144 144
}, },
{ {
5608, gDefaultAccel[10],
5608, gDefaultAccel[10],
5608, gDefaultAccel[10],
14, 14,
17, 17,
24, 24,
@ -304,9 +319,9 @@ POSTURE gPosture[4][3] = {
176 176
}, },
{ {
11192, gDefaultAccel[11],
11192, gDefaultAccel[11],
11192, gDefaultAccel[11],
22, 22,
28, 28,
24, 24,
@ -431,11 +446,15 @@ int powerupCheck(PLAYER *pPlayer, int nPowerUp)
} }
bool isGrown(spritetype* pSprite) { 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) { 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) { bool shrinkPlayerSize(PLAYER* pPlayer, int divider) {
@ -447,6 +466,7 @@ bool shrinkPlayerSize(PLAYER* pPlayer, int divider) {
bool growPlayerSize(PLAYER* pPlayer, int multiplier) { bool growPlayerSize(PLAYER* pPlayer, int multiplier) {
pPlayer->pXSprite->scale = 256*multiplier; pPlayer->pXSprite->scale = 256*multiplier;
playerSetRace(pPlayer, kModeHumanGrown); playerSetRace(pPlayer, kModeHumanGrown);
viewSetSystemMessage("%d", pPlayer->pXSprite->scale);
return true; return true;
} }
@ -457,19 +477,34 @@ bool resetPlayerSize(PLAYER* pPlayer) {
} }
void deactivateSizeShrooms(PLAYER* pPlayer) { void deactivateSizeShrooms(PLAYER* pPlayer) {
powerupDeactivate(pPlayer, 29); powerupDeactivate(pPlayer, kPwUpGrowShroom);
pPlayer->at202[29] = 0; pPlayer->at202[kPwUpGrowShroom] = 0;
powerupDeactivate(pPlayer, 30); powerupDeactivate(pPlayer, kPwUpShrinkShroom);
pPlayer->at202[30] = 0; 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) char powerupActivate(PLAYER *pPlayer, int nPowerUp)
{ {
if (powerupCheck(pPlayer, nPowerUp) > 0 && gPowerUpInfo[nPowerUp].at2) if (powerupCheck(pPlayer, nPowerUp) > 0 && gPowerUpInfo[nPowerUp].pickupOnce)
return 0; return 0;
if (!pPlayer->at202[nPowerUp]) if (!pPlayer->at202[nPowerUp])
pPlayer->at202[nPowerUp] = gPowerUpInfo[nPowerUp].at3; pPlayer->at202[nPowerUp] = gPowerUpInfo[nPowerUp].bonusTime;
int nPack = powerupToPackItem(nPowerUp); int nPack = powerupToPackItem(nPowerUp);
if (nPack >= 0) if (nPack >= 0)
pPlayer->packInfo[nPack].at0 = 1; pPlayer->packInfo[nPack].at0 = 1;
@ -488,9 +523,9 @@ char powerupActivate(PLAYER *pPlayer, int nPowerUp)
else if (isShrinked(pPlayer->pSprite)) deactivateSizeShrooms(pPlayer); else if (isShrinked(pPlayer->pSprite)) deactivateSizeShrooms(pPlayer);
else { else {
growPlayerSize(pPlayer, 2); growPlayerSize(pPlayer, 2);
if (powerupCheck(&gPlayer[pPlayer->pSprite->type - kDudePlayer1], 13) > 0) { if (powerupCheck(&gPlayer[pPlayer->pSprite->type - kDudePlayer1], kPwUpShadowCloak) > 0) {
powerupDeactivate(pPlayer, 13); powerupDeactivate(pPlayer, kPwUpShadowCloak);
pPlayer->at202[13] = 0; pPlayer->at202[kPwUpShadowCloak] = 0;
} }
if (ceilIsTooLow(pPlayer->pSprite)) if (ceilIsTooLow(pPlayer->pSprite))
@ -596,7 +631,7 @@ void powerupProcess(PLAYER *pPlayer)
{ {
pPlayer->at202[i] = ClipLow(pPlayer->at202[i]-4, 0); pPlayer->at202[i] = ClipLow(pPlayer->at202[i]-4, 0);
if (pPlayer->at202[i]) 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 else
{ {
powerupDeactivate(pPlayer, i); powerupDeactivate(pPlayer, i);
@ -629,21 +664,20 @@ void powerupInit(void)
int packItemToPowerup(int nPack) int packItemToPowerup(int nPack)
{ {
int nPowerUp = -1; int nPowerUp = -1;
switch (nPack) switch (nPack) {
{
case 0: case 0:
break; break;
case 1: case 1:
nPowerUp = 18; nPowerUp = kPwUpDivingSuit;
break; break;
case 2: case 2:
nPowerUp = 21; nPowerUp = kPwUpCrystalBall;
break; break;
case 3: case 3:
nPowerUp = 25; nPowerUp = kPwUpBeastVision;
break; break;
case 4: case 4:
nPowerUp = 15; nPowerUp = kPwUpJumpBoots;
break; break;
default: default:
ThrowError("Unhandled pack item %d", nPack); ThrowError("Unhandled pack item %d", nPack);
@ -654,20 +688,19 @@ int packItemToPowerup(int nPack)
int powerupToPackItem(int nPowerUp) int powerupToPackItem(int nPowerUp)
{ {
const int jumpBoots = 15; //const int jumpBoots = kPwUpJumpBoots;
const int divingSuit = 18; //const int divingSuit = kPwUpDivingSuit;
const int crystalBall = 21; //const int crystalBall = kPwUpCrystalBall;
const int beastVision = 25; //const int beastVision = 25;
switch (nPowerUp) switch (nPowerUp) {
{ case kPwUpDivingSuit:
case divingSuit:
return 1; return 1;
case crystalBall: case kPwUpCrystalBall:
return 2; return 2;
case beastVision: case kPwUpBeastVision:
return 3; return 3;
case jumpBoots: case kPwUpJumpBoots:
return 4; return 4;
} }
return -1; return -1;
@ -682,7 +715,7 @@ char packAddItem(PLAYER *pPlayer, unsigned int nPack)
pPlayer->packInfo[nPack].at1 = 100; pPlayer->packInfo[nPack].at1 = 100;
int nPowerUp = packItemToPowerup(nPack); int nPowerUp = packItemToPowerup(nPack);
if (nPowerUp >= 0) if (nPowerUp >= 0)
pPlayer->at202[nPowerUp] = gPowerUpInfo[nPowerUp].at3; pPlayer->at202[nPowerUp] = gPowerUpInfo[nPowerUp].bonusTime;
if (pPlayer->at321 == -1) if (pPlayer->at321 == -1)
pPlayer->at321 = nPack; pPlayer->at321 = nPack;
if (!pPlayer->packInfo[pPlayer->at321].at1) if (!pPlayer->packInfo[pPlayer->at321].at1)
@ -725,19 +758,19 @@ void packUseItem(PLAYER *pPlayer, int nPack)
} }
case 1: case 1:
v4 = 1; v4 = 1;
nPowerUp = 18; nPowerUp = kPwUpDivingSuit;
break; break;
case 2: case 2:
v4 = 1; v4 = 1;
nPowerUp = 21; nPowerUp = kPwUpCrystalBall;
break; break;
case 3: case 3:
v4 = 1; v4 = 1;
nPowerUp = 25; nPowerUp = kPwUpBeastVision;
break; break;
case 4: case 4:
v4 = 1; v4 = 1;
nPowerUp = 15; nPowerUp = kPwUpJumpBoots;
break; break;
default: default:
ThrowError("Unhandled pack item %d", nPack); ThrowError("Unhandled pack item %d", nPack);
@ -835,20 +868,14 @@ void playerCorrectInertia(PLAYER* pPlayer, vec3_t const *oldpos)
void playerResetPowerUps(PLAYER* pPlayer) void playerResetPowerUps(PLAYER* pPlayer)
{ {
const int jumpBoots = 15; //const int jumpBoots = kPwUpJumpBoots;
const int divingSuit = 18; //const int divingSuit = kPwUpDivingSuit;
const int crystalBall = 21; //const int crystalBall = kPwUpCrystalBall;
const int beastVision = 25; //const int beastVision = 25;
for (int i = 0; i < kMaxPowerUps; i++) for (int i = 0; i < kMaxPowerUps; i++) {
{ if (!VanillaMode() && (i == kPwUpJumpBoots || i == kPwUpDivingSuit || i == kPwUpCrystalBall || i == kPwUpBeastVision))
if (!VanillaMode()
&& (i == jumpBoots
|| i == divingSuit
|| i == crystalBall
|| i == beastVision))
continue; continue;
pPlayer->at202[i] = 0; pPlayer->at202[i] = 0;
} }
} }
@ -990,7 +1017,7 @@ void playerStart(int nPlayer)
if (IsUnderwaterSector(pSprite->sectnum)) if (IsUnderwaterSector(pSprite->sectnum))
{ {
pPlayer->at2f = 1; 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].at0 = 0;
pPlayer->packInfo[i].at1 = 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]; int dword_21EFB0[8];
@ -1244,12 +1276,12 @@ char PickupItem(PLAYER *pPlayer, spritetype *pItem) {
case kItemHealthLifeEssense: case kItemHealthLifeEssense:
case kItemHealthLifeSeed: case kItemHealthLifeSeed:
case kItemHealthRedPotion: { case kItemHealthRedPotion: {
int addPower = gPowerUpInfo[nType].at3; int addPower = gPowerUpInfo[nType].bonusTime;
// by NoOne: allow custom amount for item // by NoOne: allow custom amount for item
if (gModernMap && sprite[pItem->xvel].extra >= 0 && xsprite[sprite[pItem->xvel].extra].data1 > 0) if (gModernMap && sprite[pItem->xvel].extra >= 0 && xsprite[sprite[pItem->xvel].extra].data1 > 0)
addPower = xsprite[sprite[pItem->xvel].extra].data1; 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; return 1;
} }
case kItemHealthDoctorBag: case kItemHealthDoctorBag:
@ -1940,7 +1972,7 @@ void playerProcess(PLAYER *pPlayer)
pPlayer->at87 = 1; pPlayer->at87 = 1;
int nSector = pSprite->sectnum; int nSector = pSprite->sectnum;
int nLink = gLowerLink[nSector]; 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) if (getceilzofslope(nSector, pSprite->x, pSprite->y) > pPlayer->at67)
pPlayer->at87 = 0; pPlayer->at87 = 0;
@ -2195,7 +2227,7 @@ int playerDamageSprite(int nSource, PLAYER *pPlayer, DAMAGE_TYPE nDamageType, in
nSound = pDamageInfo->at4[0]; nSound = pDamageInfo->at4[0];
else else
nSound = pDamageInfo->at4[Random(3)]; 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; nSound = 714;
sfxPlay3DSound(pSprite, nSound, 0, 6); sfxPlay3DSound(pSprite, nSound, 0, 6);
return nDamage; return nDamage;
@ -2235,7 +2267,7 @@ int playerDamageSprite(int nSource, PLAYER *pPlayer, DAMAGE_TYPE nDamageType, in
sfxPlay3DSound(pSprite, pDamageInfo->at10[0], 0, 2); sfxPlay3DSound(pSprite, pDamageInfo->at10[0], 0, 2);
nDeathSeqID = 16; nDeathSeqID = 16;
nKneelingPlayer = nPlayerKneelClient; nKneelingPlayer = nPlayerKneelClient;
powerupActivate(pPlayer, 28); powerupActivate(pPlayer, kPwUpDeliriumShroom);
pXSprite->target = nSource; pXSprite->target = nSource;
evPost(pSprite->index, 3, 15, kCallbackFinishHim); evPost(pSprite->index, 3, 15, kCallbackFinishHim);
} }

View file

@ -143,9 +143,9 @@ struct PLAYER {
int at352; int at352;
int at356; int at356;
int at35a; // quake int at35a; // quake
int at35e; int at35e; // tilt
int at362; // light int at362; // light
int at366; int at366; // pain
int at36a; // blind int at36a; // blind
int at36e; // choke int at36e; // choke
int at372; int at372;
@ -159,6 +159,9 @@ struct PLAYER {
int nWaterPal; int nWaterPal;
}; };
// by NoOne: defaut player movement speeds of all move states for gPosture
extern int gDefaultAccel[12];
struct POSTURE { struct POSTURE {
int at0; int at0;
int at4; int at4;
@ -188,10 +191,10 @@ struct AMMOINFO {
struct POWERUPINFO struct POWERUPINFO
{ {
short at0; short picnum;
char at2; bool pickupOnce;
int at3; // max value int bonusTime;
int at7; int maxTime;
}; };
extern POSTURE gPosture[4][3]; extern POSTURE gPosture[4][3];

View file

@ -79,9 +79,9 @@ SAMPLE2D Channel[kMaxChannels];
SAMPLE2D * FindChannel(void) SAMPLE2D * FindChannel(void)
{ {
for (int i = kMaxChannels - 1; i >= 0; i--) for (int i = kMaxChannels - 1; i >= 0; i--)
if (Channel[i].at5 == 0) if (Channel[i].at5 == 0) return &Channel[i];
return &Channel[i]; consoleSysMsg("No free channel available for sample");
ThrowError("No free channel available for sample"); //ThrowError("No free channel available for sample");
return NULL; return NULL;
} }

View file

@ -45,6 +45,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "loadsave.h" #include "loadsave.h"
#include "player.h" #include "player.h"
#include "seq.h" #include "seq.h"
#include "qav.h"
#include "sfx.h" #include "sfx.h"
#include "sound.h" #include "sound.h"
#include "triggers.h" #include "triggers.h"
@ -817,35 +818,107 @@ void OperateSprite(int nSprite, XSPRITE *pXSprite, EVENT event)
break; break;
} }
return; return;
case kModernPlayQAV: // WIP case kModernPlayerControl: // WIP
PLAYER* pPlayer = &gPlayer[pXSprite->data1]; PLAYER* pPlayer = NULL;
if ((pPlayer = getPlayerById(pXSprite->data1)) == NULL) return;
else if (event.cmd < kCmdNumberic) { // play qav as weapon qav
switch (event.cmd) { switch (event.cmd) {
case kCmdOff: case kCmdOff:
pPlayer->atbd = pXSprite->sysData1; if (gQavPlayerIndex == nSprite) {
if (pXSprite->state == 1) SetSpriteState(nSprite, pXSprite, 0); pXSprite->sysData1 = 0;
if (pPlayer->atbd != 0) pPlayer->atc.newWeapon = pPlayer->atbd = pXSprite->data4;
gQavPlayerIndex = -1;
WeaponRaise(pPlayer); 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
WeaponLower(pPlayer);
} }
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; break;
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;
}
break;
}
default: default:
if (pXSprite->state == 0) evPost(nSprite, 3, 0, kCmdOn); if (gQavPlayerIndex != nSprite) evPost(nSprite, 3, 0, kCmdOn);
else evPost(nSprite, 3, 0, kCmdOff); else evPost(nSprite, 3, 0, kCmdOff);
break; 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; return;
} }
} }
@ -1344,7 +1417,7 @@ void usePropertiesChanger(XSPRITE* pXSource, short objType, int objIndex) {
if (nIndex != -1) pXSprite->physAttr = flags; // just update physics attributes if (nIndex != -1) pXSprite->physAttr = flags; // just update physics attributes
else if ((nIndex = debrisGetFreeIndex()) < 0) else if ((nIndex = debrisGetFreeIndex()) < 0)
;// showWarning("Max (%d) Physics affected sprites reached!", kMaxSuperXSprites); viewSetSystemMessage("Max (%d) Physics affected sprites reached!", kMaxSuperXSprites);
else { else {
pXSprite->physAttr = flags; // update physics attributes pXSprite->physAttr = flags; // update physics attributes
@ -1474,8 +1547,8 @@ void useTeleportTarget(XSPRITE* pXSource, spritetype* pSprite) {
TeleFrag(pSprite->xvel, pSource->sectnum); TeleFrag(pSprite->xvel, pSource->sectnum);
changespritesect((short)pSprite->xvel, pSource->sectnum); changespritesect((short)pSprite->xvel, pSource->sectnum);
if (pXSector != NULL && pXSector->Underwater) xsprite[pSprite->extra].medium = 1; if (pXSector != NULL && pXSector->Underwater) xsprite[pSprite->extra].medium = kMediumWater;
else xsprite[pSprite->extra].medium = 0; else xsprite[pSprite->extra].medium = kMediumNormal;
if (pXSource->data2 == 1) if (pXSource->data2 == 1)
pSprite->ang = pSource->ang; 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 // 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. // when kModernDudeTargetChanger goes to off state, so they won't ignore the world.
void activateDudes(int rx) { void activateDudes(int rx) {

View file

@ -77,8 +77,6 @@ void useTeleportTarget(XSPRITE* pXSource, spritetype* pSprite);
void usePropertiesChanger(XSPRITE* pXSource, short objType, int objIndex); void usePropertiesChanger(XSPRITE* pXSource, short objType, int objIndex);
void TeleFrag(int nKiller, int nSector); void TeleFrag(int nKiller, int nSector);
bool valueIsBetween(int val, int min, int max); bool valueIsBetween(int val, int min, int max);
void disableQAVPlayers(spritetype* pException);
// ------------------------------------------------------- // -------------------------------------------------------
END_BLD_NS END_BLD_NS

View file

@ -569,7 +569,7 @@ void fakePlayerProcess(PLAYER *pPlayer, GINPUT *pInput)
predict.at72 = 1; predict.at72 = 1;
int nSector = predict.at68; int nSector = predict.at68;
int nLink = gLowerLink[nSector]; 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) if (getceilzofslope(nSector, predict.at50, predict.at54) > predict.at38)
predict.at72 = 0; predict.at72 = 0;
@ -658,9 +658,9 @@ void fakeMoveDude(spritetype *pSprite)
} }
int nUpperLink = gUpperLink[nSector]; int nUpperLink = gUpperLink[nSector];
int nLowerLink = gLowerLink[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; 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; bDepth = 1;
if (pPlayer) if (pPlayer)
wd += 16; wd += 16;
@ -1227,18 +1227,21 @@ void viewDrawPowerUps(PLAYER* pPlayer)
if (!gPowerupDuration) if (!gPowerupDuration)
return; return;
const int nCloakOfInvisibility = 13; // NoOne to author: the following powerups can be safely added in this list:
const int nReflectiveShots = 24; // kPwUpFeatherFall - (used in some user addons, makes player immune to fall damage)
const int nDeathMask = 14; // invulnerability // kPwUpGasMask - (used in some user addons, makes player immune to choke damage)
const int nGunsAkimbo = 17; // kPwUpDoppleganger - (works in multiplayer, it swaps player's team colors, so enemy team player thinks it's a team mate)
const int nCloakOfShadow = 26; // does nothing, only appears at near the end of Cryptic Passage's Lost Monastery (CP04) // 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]; POWERUPDISPLAY powerups[5];
powerups[0] = { 896, 0.4f, 0, pPlayer->at202[nCloakOfInvisibility] }; powerups[0] = { gPowerUpInfo[kPwUpShadowCloak].picnum, 0.4f, 0, pPlayer->at202[kPwUpShadowCloak] }; // invisibility
powerups[1] = { 2428, 0.4f, 5, pPlayer->at202[nReflectiveShots] }; powerups[1] = { gPowerUpInfo[kPwUpReflectShots].picnum, 0.4f, 5, pPlayer->at202[kPwUpReflectShots] };
powerups[2] = { 825, 0.3f, 9, pPlayer->at202[nDeathMask] }; powerups[2] = { gPowerUpInfo[kPwUpDeathMask].picnum, 0.3f, 9, pPlayer->at202[kPwUpDeathMask] }; // invulnerability
powerups[3] = { 829, 0.3f, 5, pPlayer->at202[nGunsAkimbo] }; powerups[3] = { gPowerUpInfo[kPwUpTwoGuns].picnum, 0.3f, 5, pPlayer->at202[kPwUpTwoGuns] };
powerups[4] = { 768, 0.4f, 9, pPlayer->at202[nCloakOfShadow] }; // 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); sortPowerUps(powerups);
@ -2491,51 +2494,42 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t
break; break;
} }
} }
viewApplyDefaultPal(pTSprite, pSector);
if (powerupCheck(gView, 25) > 0) if (pXSector && pXSector->color) pTSprite->pal = pSector->floorpal;
{ if (powerupCheck(gView, kPwUpBeastVision) > 0) pTSprite->shade = -128;
pTSprite->shade = -128;
} if (IsPlayerSprite((spritetype *)pTSprite)) {
if (IsPlayerSprite((spritetype *)pTSprite))
{
PLAYER *pPlayer = &gPlayer[pTSprite->type-kDudePlayer1]; PLAYER *pPlayer = &gPlayer[pTSprite->type-kDudePlayer1];
if (powerupCheck(pPlayer, 13) && !powerupCheck(gView, 25)) if (powerupCheck(pPlayer, kPwUpShadowCloak) && !powerupCheck(gView, kPwUpBeastVision)) {
{
pTSprite->cstat |= 2; pTSprite->cstat |= 2;
pTSprite->pal = 5; pTSprite->pal = 5;
} } else if (powerupCheck(pPlayer, kPwUpDeathMask)) {
else if (powerupCheck(pPlayer, 14))
{
pTSprite->shade = -128; pTSprite->shade = -128;
pTSprite->pal = 5; pTSprite->pal = 5;
} } else if (powerupCheck(pPlayer, kPwUpDoppleganger)) {
else if (powerupCheck(pPlayer, 23))
{
pTSprite->pal = 11+(gView->at2ea&3); pTSprite->pal = 11+(gView->at2ea&3);
} }
if (powerupCheck(pPlayer, 24))
{ if (powerupCheck(pPlayer, kPwUpReflectShots)) {
viewAddEffect(nTSprite, VIEW_EFFECT_13); viewAddEffect(nTSprite, VIEW_EFFECT_13);
} }
if (gShowWeapon && gGameOptions.nGameType > 0 && gView)
{ if (gShowWeapon && gGameOptions.nGameType > 0 && gView) {
viewAddEffect(nTSprite, VIEW_EFFECT_12); 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); uspritetype *pNTSprite = viewAddEffect(nTSprite, VIEW_EFFECT_14);
if (pNTSprite) if (pNTSprite) {
{
POSTURE *pPosture = &gPosture[pPlayer->at5f][pPlayer->at2f]; POSTURE *pPosture = &gPosture[pPlayer->at5f][pPlayer->at2f];
pNTSprite->x += mulscale28(pPosture->at30, Cos(pTSprite->ang)); pNTSprite->x += mulscale28(pPosture->at30, Cos(pTSprite->ang));
pNTSprite->y += mulscale28(pPosture->at30, Sin(pTSprite->ang)); pNTSprite->y += mulscale28(pPosture->at30, Sin(pTSprite->ang));
pNTSprite->z = pPlayer->pSprite->z-pPosture->at2c; pNTSprite->z = pPlayer->pSprite->z-pPosture->at2c;
} }
} }
if (pPlayer->at90 > 0 && gGameOptions.nGameType == 3)
{ if (pPlayer->at90 > 0 && gGameOptions.nGameType == 3) {
if (pPlayer->at90&1) if (pPlayer->at90&1) {
{
uspritetype *pNTSprite = viewAddEffect(nTSprite, VIEW_EFFECT_16); uspritetype *pNTSprite = viewAddEffect(nTSprite, VIEW_EFFECT_16);
if (pNTSprite) 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; pNTSprite->cstat |= 4;
} }
} }
if (pPlayer->at90&2) if (pPlayer->at90&2) {
{
uspritetype *pNTSprite = viewAddEffect(nTSprite, VIEW_EFFECT_16); uspritetype *pNTSprite = viewAddEffect(nTSprite, VIEW_EFFECT_16);
if (pNTSprite) 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) if (getflorzofslope(pTSprite->sectnum, pTSprite->x, pTSprite->y) >= cZ)
{ {
viewAddEffect(nTSprite, VIEW_EFFECT_0); 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) // by NoOne: show warning msgs in game instead of throwing errors (in some cases)
void viewSetSystemMessage(const char* pMessage, ...) { 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); 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); gGameMessageMgr.Add(buffer, 15, 7, MESSAGE_PRIORITY_SYSTEM);
} }
@ -2941,7 +2934,7 @@ void viewUpdateDelirium(void)
deliriumTurnO = deliriumTurn; deliriumTurnO = deliriumTurn;
deliriumPitchO = deliriumPitch; deliriumPitchO = deliriumPitch;
int powerCount; int powerCount;
if ((powerCount = powerupCheck(gView,28)) != 0) if ((powerCount = powerupCheck(gView, kPwUpDeliriumShroom)) != 0)
{ {
int tilt1 = 170, tilt2 = 170, pitch = 20; int tilt1 = 170, tilt2 = 170, pitch = 20;
int timer = (int)gFrameClock*4; int timer = (int)gFrameClock*4;
@ -3169,10 +3162,10 @@ void viewDrawScreen(void)
int v78 = interpolateang(gScreenTiltO, gScreenTilt, gInterpolate); int v78 = interpolateang(gScreenTiltO, gScreenTilt, gInterpolate);
char v14 = 0; char v14 = 0;
char v10 = 0; char v10 = 0;
bool bDelirium = powerupCheck(gView, 28) > 0; bool bDelirium = powerupCheck(gView, kPwUpDeliriumShroom) > 0;
static bool bDeliriumOld = false; static bool bDeliriumOld = false;
int tiltcs, tiltdim; int tiltcs, tiltdim;
char v4 = powerupCheck(gView, 21) > 0; char v4 = powerupCheck(gView, kPwUpCrystalBall) > 0;
#ifdef USE_OPENGL #ifdef USE_OPENGL
renderSetRollAngle(0); renderSetRollAngle(0);
#endif #endif
@ -3493,7 +3486,7 @@ RORHACK:
rotatesprite(212<<16, 77<<16, 65536, 0, 2347, 32, 0, 512+19, gViewX0, gViewY0, gViewX1, gViewY1); 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(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); rotatesprite(320<<16, 200<<16, 65536, 1024, 2358, 0, 0, 512+18, gViewX0, gViewY0, gViewX1, gViewY1);
@ -3508,32 +3501,15 @@ RORHACK:
rotatesprite(280<<16, 35<<16, 53248, 0, 1683, v10, 0, 512+35, gViewX0, gViewY0, gViewX1, gViewY1); rotatesprite(280<<16, 35<<16, 53248, 0, 1683, v10, 0, 512+35, gViewX0, gViewY0, gViewX1, gViewY1);
renderSetAspect(viewingRange, yxAspect); renderSetAspect(viewingRange, yxAspect);
} }
if (powerupCheck(gView, 14) > 0)
{ if (powerupCheck(gView, kPwUpDeathMask) > 0) nPalette = 4;
nPalette = 4; else if(powerupCheck(gView, kPwUpReflectShots) > 0) nPalette = 1;
} else if (gView->at87) {
else if(powerupCheck(gView, 24) > 0) if (gView->nWaterPal) nPalette = gView->nWaterPal;
{ else {
nPalette = 1; if (gView->pXSprite->medium == kMediumWater) nPalette = 1;
} else if (gView->pXSprite->medium == kMediumGoo) nPalette = 3;
else if (gView->at87) else nPalette = 2;
{
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;
}
} }
} }
} }

View file

@ -180,7 +180,7 @@ int CheckLink(spritetype *pSprite)
{ {
spritetype *pUpper = &sprite[nUpper]; spritetype *pUpper = &sprite[nUpper];
int z; int z;
if (pUpper->type == 7) if (pUpper->type == kMarkerUpLink)
z = pUpper->z; z = pUpper->z;
else else
z = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y); z = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y);
@ -194,7 +194,7 @@ int CheckLink(spritetype *pSprite)
pSprite->x += pLower->x-pUpper->x; pSprite->x += pLower->x-pUpper->x;
pSprite->y += pLower->y-pUpper->y; pSprite->y += pLower->y-pUpper->y;
int z2; int z2;
if (pLower->type == 6) if (pLower->type == kMarkerLowLink)
z2 = pLower->z; z2 = pLower->z;
else else
z2 = getceilzofslope(pSprite->sectnum, pSprite->x, pSprite->y); z2 = getceilzofslope(pSprite->sectnum, pSprite->x, pSprite->y);
@ -207,7 +207,7 @@ int CheckLink(spritetype *pSprite)
{ {
spritetype *pLower = &sprite[nLower]; spritetype *pLower = &sprite[nLower];
int z; int z;
if (pLower->type == 6) if (pLower->type == kMarkerLowLink)
z = pLower->z; z = pLower->z;
else else
z = getceilzofslope(pSprite->sectnum, pSprite->x, pSprite->y); z = getceilzofslope(pSprite->sectnum, pSprite->x, pSprite->y);
@ -221,7 +221,7 @@ int CheckLink(spritetype *pSprite)
pSprite->x += pUpper->x-pLower->x; pSprite->x += pUpper->x-pLower->x;
pSprite->y += pUpper->y-pLower->y; pSprite->y += pUpper->y-pLower->y;
int z2; int z2;
if (pUpper->type == 7) if (pUpper->type == kMarkerUpLink)
z2 = pUpper->z; z2 = pUpper->z;
else else
z2 = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y); 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]; spritetype *pUpper = &sprite[nUpper];
int z1; int z1;
if (pUpper->type == 7) if (pUpper->type == kMarkerUpLink)
z1 = pUpper->z; z1 = pUpper->z;
else else
z1 = getflorzofslope(*nSector, *x, *y); z1 = getflorzofslope(*nSector, *x, *y);
@ -255,7 +255,7 @@ int CheckLink(int *x, int *y, int *z, int *nSector)
*x += pLower->x-pUpper->x; *x += pLower->x-pUpper->x;
*y += pLower->y-pUpper->y; *y += pLower->y-pUpper->y;
int z2; int z2;
if (pUpper->type == 6) if (pUpper->type == kMarkerLowLink)
z2 = pLower->z; z2 = pLower->z;
else else
z2 = getceilzofslope(*nSector, *x, *y); z2 = getceilzofslope(*nSector, *x, *y);
@ -267,7 +267,7 @@ int CheckLink(int *x, int *y, int *z, int *nSector)
{ {
spritetype *pLower = &sprite[nLower]; spritetype *pLower = &sprite[nLower];
int z1; int z1;
if (pLower->type == 6) if (pLower->type == kMarkerLowLink)
z1 = pLower->z; z1 = pLower->z;
else else
z1 = getceilzofslope(*nSector, *x, *y); z1 = getceilzofslope(*nSector, *x, *y);
@ -281,7 +281,7 @@ int CheckLink(int *x, int *y, int *z, int *nSector)
*x += pUpper->x-pLower->x; *x += pUpper->x-pLower->x;
*y += pUpper->y-pLower->y; *y += pUpper->y-pLower->y;
int z2; int z2;
if (pLower->type == 7) if (pLower->type == kMarkerUpLink)
z2 = pUpper->z; z2 = pUpper->z;
else else
z2 = getflorzofslope(*nSector, *x, *y); z2 = getflorzofslope(*nSector, *x, *y);

View file

@ -120,8 +120,6 @@ int nClientAltFireLifeLeech = qavRegisterClient((QAVTypeCast)AltFireLifeLeech);
int nClientDropVoodoo = qavRegisterClient((QAVTypeCast)DropVoodoo); int nClientDropVoodoo = qavRegisterClient((QAVTypeCast)DropVoodoo);
int nClientAltFireNapalm = qavRegisterClient((QAVTypeCast)AltFireNapalm); int nClientAltFireNapalm = qavRegisterClient((QAVTypeCast)AltFireNapalm);
#define kQAVEnd 125
QAV *weaponQAV[kQAVEnd]; QAV *weaponQAV[kQAVEnd];
void QAV::PlaySound(int nSound) 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->x = a3;
pQAV->y = a4; pQAV->y = a4;
int flags = 2; int flags = 2;
int nInv = powerupCheck(pPlayer, 13); int nInv = powerupCheck(pPlayer, kPwUpShadowCloak);
if (nInv >= 120*8 || (nInv != 0 && ((int)totalclock&32))) if (nInv >= 120*8 || (nInv != 0 && ((int)totalclock&32)))
{ {
a2 = -128; a2 = -128;
@ -516,7 +514,7 @@ void WeaponRaise(PLAYER *pPlayer)
} }
break; break;
case 3: // sawed off case 3: // sawed off
if (powerupCheck(pPlayer, 17)) if (powerupCheck(pPlayer, kPwUpTwoGuns))
{ {
if (gInfiniteAmmo || pPlayer->at181[2] >= 4) if (gInfiniteAmmo || pPlayer->at181[2] >= 4)
StartQAV(pPlayer, 59, -1, 0); StartQAV(pPlayer, 59, -1, 0);
@ -543,7 +541,7 @@ void WeaponRaise(PLAYER *pPlayer)
} }
break; break;
case 4: // tommy gun 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; pPlayer->atc3 = 1;
StartQAV(pPlayer, 69, -1, 0); StartQAV(pPlayer, 69, -1, 0);
@ -562,7 +560,7 @@ void WeaponRaise(PLAYER *pPlayer)
} }
break; break;
case 2: // flaregun 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); StartQAV(pPlayer, 45, -1, 0);
pPlayer->atc3 = 3; pPlayer->atc3 = 3;
@ -577,7 +575,7 @@ void WeaponRaise(PLAYER *pPlayer)
if (sub_4B2C8(pPlayer, 7, 1)) if (sub_4B2C8(pPlayer, 7, 1))
{ {
pPlayer->atc3 = 2; pPlayer->atc3 = 2;
if (powerupCheck(pPlayer, 17)) if (powerupCheck(pPlayer, kPwUpTwoGuns))
StartQAV(pPlayer, 82, -1, 0); StartQAV(pPlayer, 82, -1, 0);
else else
StartQAV(pPlayer, 74, -1, 0); StartQAV(pPlayer, 74, -1, 0);
@ -589,7 +587,7 @@ void WeaponRaise(PLAYER *pPlayer)
} }
break; break;
case 5: // napalm case 5: // napalm
if (powerupCheck(pPlayer, 17)) if (powerupCheck(pPlayer, kPwUpTwoGuns))
{ {
StartQAV(pPlayer, 120, -1, 0); StartQAV(pPlayer, 120, -1, 0);
pPlayer->atc3 = 3; pPlayer->atc3 = 3;
@ -706,19 +704,19 @@ void WeaponLower(PLAYER *pPlayer)
} }
break; break;
case 3: case 3:
if (powerupCheck(pPlayer, 17)) if (powerupCheck(pPlayer, kPwUpTwoGuns))
StartQAV(pPlayer, 63, -1, 0); StartQAV(pPlayer, 63, -1, 0);
else else
StartQAV(pPlayer, 58, -1, 0); StartQAV(pPlayer, 58, -1, 0);
break; break;
case 4: case 4:
if (powerupCheck(pPlayer, 17) && pPlayer->atc3 == 1) if (powerupCheck(pPlayer, kPwUpTwoGuns) && pPlayer->atc3 == 1)
StartQAV(pPlayer, 72, -1, 0); StartQAV(pPlayer, 72, -1, 0);
else else
StartQAV(pPlayer, 68, -1, 0); StartQAV(pPlayer, 68, -1, 0);
break; break;
case 2: case 2:
if (powerupCheck(pPlayer, 17) && pPlayer->atc3 == 3) if (powerupCheck(pPlayer, kPwUpTwoGuns) && pPlayer->atc3 == 3)
StartQAV(pPlayer, 49, -1, 0); StartQAV(pPlayer, 49, -1, 0);
else else
StartQAV(pPlayer, 44, -1, 0); StartQAV(pPlayer, 44, -1, 0);
@ -727,13 +725,13 @@ void WeaponLower(PLAYER *pPlayer)
StartQAV(pPlayer, 109, -1, 0); StartQAV(pPlayer, 109, -1, 0);
break; break;
case 8: 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); StartQAV(pPlayer, 88, -1, 0);
else else
StartQAV(pPlayer, 81, -1, 0); StartQAV(pPlayer, 81, -1, 0);
break; break;
case 5: case 5:
if (powerupCheck(pPlayer, 17)) if (powerupCheck(pPlayer, kPwUpTwoGuns))
StartQAV(pPlayer, 124, -1, 0); StartQAV(pPlayer, 124, -1, 0);
else else
StartQAV(pPlayer, 92, -1, 0); StartQAV(pPlayer, 92, -1, 0);
@ -864,7 +862,7 @@ void WeaponUpdateState(PLAYER *pPlayer)
switch (vb) switch (vb)
{ {
case 6: case 6:
if (powerupCheck(pPlayer, 17) && (gInfiniteAmmo || CheckAmmo(pPlayer, 2, 4))) if (powerupCheck(pPlayer, kPwUpTwoGuns) && (gInfiniteAmmo || CheckAmmo(pPlayer, 2, 4)))
pPlayer->atc3 = 7; pPlayer->atc3 = 7;
else else
pPlayer->atc3 = 1; pPlayer->atc3 = 1;
@ -894,7 +892,7 @@ void WeaponUpdateState(PLAYER *pPlayer)
} }
break; break;
case 4: case 4:
if (powerupCheck(pPlayer, 17) && sub_4B2C8(pPlayer, 3, 2)) if (powerupCheck(pPlayer, kPwUpTwoGuns) && sub_4B2C8(pPlayer, 3, 2))
{ {
pPlayer->at26 = 70; pPlayer->at26 = 70;
pPlayer->atc3 = 1; pPlayer->atc3 = 1;
@ -906,7 +904,7 @@ void WeaponUpdateState(PLAYER *pPlayer)
} }
break; break;
case 2: case 2:
if (powerupCheck(pPlayer, 17)) if (powerupCheck(pPlayer, kPwUpTwoGuns))
{ {
if (vb == 3 && sub_4B2C8(pPlayer, 1, 2)) if (vb == 3 && sub_4B2C8(pPlayer, 1, 2))
pPlayer->at26 = 46; pPlayer->at26 = 46;
@ -929,7 +927,7 @@ void WeaponUpdateState(PLAYER *pPlayer)
switch (vb) switch (vb)
{ {
case 2: case 2:
if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, 17)) if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, kPwUpTwoGuns))
pPlayer->at26 = 83; pPlayer->at26 = 83;
else else
pPlayer->at26 = 75; pPlayer->at26 = 75;
@ -943,7 +941,7 @@ void WeaponUpdateState(PLAYER *pPlayer)
switch (vb) switch (vb)
{ {
case 3: case 3:
if (powerupCheck(pPlayer, 17) && (gInfiniteAmmo || CheckAmmo(pPlayer,4, 4))) if (powerupCheck(pPlayer, kPwUpTwoGuns) && (gInfiniteAmmo || CheckAmmo(pPlayer,4, 4)))
pPlayer->at26 = 121; pPlayer->at26 = 121;
else else
pPlayer->at26 = 90; pPlayer->at26 = 90;
@ -1249,7 +1247,7 @@ void AltFireSpread2(int nTrigger, PLAYER *pPlayer)
int dx = Cos(angle)>>16; int dx = Cos(angle)>>16;
int dy = Sin(angle)>>16; int dy = Sin(angle)>>16;
sfxPlay3DSound(pPlayer->pSprite, 431, -1, 0); 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; int r1, r2, r3;
r1 = Random3(300); r1 = Random3(300);
@ -1418,8 +1416,8 @@ void AltFireVoodoo(int nTrigger, PLAYER *pPlayer)
if (IsPlayerSprite(pTarget)) if (IsPlayerSprite(pTarget))
{ {
PLAYER* pOtherPlayer = &gPlayer[pTarget->type - kDudePlayer1]; PLAYER* pOtherPlayer = &gPlayer[pTarget->type - kDudePlayer1];
if (!pOtherPlayer->at31a || !powerupCheck(pOtherPlayer, 14)) if (!pOtherPlayer->at31a || !powerupCheck(pOtherPlayer, kPwUpDeathMask))
powerupActivate(pOtherPlayer, 28); powerupActivate(pOtherPlayer, kPwUpDeliriumShroom);
} }
fxSpawnBlood(pTarget, 0); fxSpawnBlood(pTarget, 0);
} }
@ -1456,8 +1454,8 @@ void AltFireVoodoo(int nTrigger, PLAYER *pPlayer)
if (IsPlayerSprite(pTarget)) if (IsPlayerSprite(pTarget))
{ {
PLAYER* pOtherPlayer = &gPlayer[pTarget->type - kDudePlayer1]; PLAYER* pOtherPlayer = &gPlayer[pTarget->type - kDudePlayer1];
if (!pOtherPlayer->at31a || !powerupCheck(pOtherPlayer, 14)) if (!pOtherPlayer->at31a || !powerupCheck(pOtherPlayer, kPwUpDeathMask))
powerupActivate(pOtherPlayer, 28); powerupActivate(pOtherPlayer, kPwUpDeliriumShroom);
} }
fxSpawnBlood(pTarget, 0); fxSpawnBlood(pTarget, 0);
} }
@ -1574,8 +1572,8 @@ void FireNapalm2(int nTrigger, PLAYER *pPlayer)
void AltFireNapalm(int nTrigger, PLAYER *pPlayer) void AltFireNapalm(int nTrigger, PLAYER *pPlayer)
{ {
UNREFERENCED_PARAMETER(nTrigger); //UNREFERENCED_PARAMETER(nTrigger);
char UNUSED(bAkimbo) = powerupCheck(pPlayer, 17); //char UNUSED(bAkimbo) = powerupCheck(pPlayer, kPwUpTwoGuns);
int nSpeed = mulscale16(0x8000, 0x177777)+0x66666; int nSpeed = mulscale16(0x8000, 0x177777)+0x66666;
spritetype *pMissile = playerFireThing(pPlayer, 0, -4730, kThingNapalmBall, nSpeed); spritetype *pMissile = playerFireThing(pPlayer, 0, -4730, kThingNapalmBall, nSpeed);
if (pMissile) if (pMissile)
@ -1897,7 +1895,7 @@ char sub_4F484(PLAYER *pPlayer)
{ {
case 4: case 4:
pPlayer->atc3 = 5; 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); StartQAV(pPlayer, 84, nClientFireTesla, 1);
else else
StartQAV(pPlayer, 77, nClientFireTesla, 1); StartQAV(pPlayer, 77, nClientFireTesla, 1);
@ -1906,7 +1904,7 @@ char sub_4F484(PLAYER *pPlayer)
if (!pPlayer->atc.buttonFlags.shoot) if (!pPlayer->atc.buttonFlags.shoot)
{ {
pPlayer->atc3 = 2; 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); StartQAV(pPlayer, 87, -1, 0);
else else
StartQAV(pPlayer, 80, -1, 0); StartQAV(pPlayer, 80, -1, 0);
@ -1915,7 +1913,7 @@ char sub_4F484(PLAYER *pPlayer)
break; break;
case 7: case 7:
pPlayer->atc3 = 2; 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); StartQAV(pPlayer, 87, -1, 0);
else else
StartQAV(pPlayer, 80, -1, 0); StartQAV(pPlayer, 80, -1, 0);
@ -2231,13 +2229,13 @@ void WeaponProcess(PLAYER *pPlayer)
} }
break; break;
case 4: 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); StartQAV(pPlayer, 71, nClientFireTommy, 1);
else else
StartQAV(pPlayer, 66, nClientFireTommy, 1); StartQAV(pPlayer, 66, nClientFireTommy, 1);
return; return;
case 2: 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); StartQAV(pPlayer, 48, nClientFireFlare, 0);
else else
StartQAV(pPlayer, 43, nClientFireFlare, 0); StartQAV(pPlayer, 43, nClientFireFlare, 0);
@ -2261,13 +2259,13 @@ void WeaponProcess(PLAYER *pPlayer)
{ {
case 2: case 2:
pPlayer->atc3 = 4; 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); StartQAV(pPlayer, 84, nClientFireTesla, 0);
else else
StartQAV(pPlayer, 77, nClientFireTesla, 0); StartQAV(pPlayer, 77, nClientFireTesla, 0);
return; return;
case 5: 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); StartQAV(pPlayer, 84, nClientFireTesla, 0);
else else
StartQAV(pPlayer, 77, nClientFireTesla, 0); StartQAV(pPlayer, 77, nClientFireTesla, 0);
@ -2275,7 +2273,7 @@ void WeaponProcess(PLAYER *pPlayer)
} }
break; break;
case 5: case 5:
if (powerupCheck(pPlayer, 17)) if (powerupCheck(pPlayer, kPwUpTwoGuns))
StartQAV(pPlayer, 122, nClientFireNapalm, 0); StartQAV(pPlayer, 122, nClientFireNapalm, 0);
else else
StartQAV(pPlayer, 91, nClientFireNapalm, 0); StartQAV(pPlayer, 91, nClientFireNapalm, 0);
@ -2372,7 +2370,7 @@ void WeaponProcess(PLAYER *pPlayer)
} }
break; break;
case 4: 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); StartQAV(pPlayer, 73, nClientAltFireSpread2, 0);
else else
StartQAV(pPlayer, 67, nClientAltFireSpread2, 0); StartQAV(pPlayer, 67, nClientAltFireSpread2, 0);
@ -2383,7 +2381,7 @@ void WeaponProcess(PLAYER *pPlayer)
return; return;
#if 0 #if 0
case 2: 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); StartQAV(pPlayer, 48, nClientFireFlare, 0);
else else
StartQAV(pPlayer, 43, nClientFireFlare, 0); StartQAV(pPlayer, 43, nClientFireFlare, 0);
@ -2392,21 +2390,21 @@ void WeaponProcess(PLAYER *pPlayer)
case 8: case 8:
if (sub_4B2C8(pPlayer, 7, 35)) 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); StartQAV(pPlayer, 85, nClientFireTesla, 0);
else else
StartQAV(pPlayer, 78, nClientFireTesla, 0); StartQAV(pPlayer, 78, nClientFireTesla, 0);
} }
else else
{ {
if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, 17)) if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, kPwUpTwoGuns))
StartQAV(pPlayer, 84, nClientFireTesla, 0); StartQAV(pPlayer, 84, nClientFireTesla, 0);
else else
StartQAV(pPlayer, 77, nClientFireTesla, 0); StartQAV(pPlayer, 77, nClientFireTesla, 0);
} }
return; return;
case 5: case 5:
if (powerupCheck(pPlayer, 17)) if (powerupCheck(pPlayer, kPwUpTwoGuns))
// by NoOne: allow napalm launcher alt fire act like in v1.0x versions // by NoOne: allow napalm launcher alt fire act like in v1.0x versions
if (gGameOptions.weaponsV10x && !VanillaMode() && !DemoRecordStatus()) StartQAV(pPlayer, 123, nClientFireNapalm2, 0); if (gGameOptions.weaponsV10x && !VanillaMode() && !DemoRecordStatus()) StartQAV(pPlayer, 123, nClientFireNapalm2, 0);
else StartQAV(pPlayer, 122, nClientAltFireNapalm, 0); else StartQAV(pPlayer, 122, nClientAltFireNapalm, 0);
@ -2416,14 +2414,14 @@ void WeaponProcess(PLAYER *pPlayer)
case 2: case 2:
if (CheckAmmo(pPlayer, 1, 8)) 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); StartQAV(pPlayer, 48, nClientAltFireFlare, 0);
else else
StartQAV(pPlayer, 43, nClientAltFireFlare, 0); StartQAV(pPlayer, 43, nClientAltFireFlare, 0);
} }
else else
{ {
if (powerupCheck(pPlayer, 17) && sub_4B2C8(pPlayer, 1, 2)) if (powerupCheck(pPlayer, kPwUpTwoGuns) && sub_4B2C8(pPlayer, 1, 2))
StartQAV(pPlayer, 48, nClientFireFlare, 0); StartQAV(pPlayer, 48, nClientFireFlare, 0);
else else
StartQAV(pPlayer, 43, nClientFireFlare, 0); StartQAV(pPlayer, 43, nClientFireFlare, 0);

View file

@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "blood.h" #include "blood.h"
#include "db.h" #include "db.h"
#include "player.h" #include "player.h"
#include "qav.h"
BEGIN_BLD_NS BEGIN_BLD_NS