- Added names for callbacks

- Added names for sprite, wall and sector types
- Added gModernMap protection for using new features only on different version of map

# Conflicts:
#	source/blood/src/actor.cpp
#	source/blood/src/callback.cpp
#	source/blood/src/callback.h
#	source/blood/src/triggers.h
This commit is contained in:
Grind Core 2019-10-12 00:59:39 +03:00 committed by Christoph Oelckers
parent 9a4c07db27
commit 08dfee073c
37 changed files with 4056 additions and 4116 deletions

File diff suppressed because it is too large Load diff

View file

@ -82,7 +82,7 @@ struct THINGINFO
unsigned char at15; // xrepeat unsigned char at15; // xrepeat
unsigned char at16; // yrepeat unsigned char at16; // yrepeat
int at17[7]; // damage int at17[7]; // damage
bool allowThrow; // By NoOne: indicates if kCustomDude can throw it bool allowThrow; // By NoOne: indicates if kDudeModernCustom can throw it
}; };
struct AMMOITEMDATA struct AMMOITEMDATA
@ -131,7 +131,7 @@ struct MissileType
unsigned char atb; // yrepeat unsigned char atb; // yrepeat
char atc; // shade char atc; // shade
unsigned char atd; // clipdist unsigned char atd; // clipdist
int fireSound[2]; // By NoOne: predefined fire sounds. used by kCustomDude, but can be used for something else. int fireSound[2]; // By NoOne: predefined fire sounds. used by kDudeModernCustom, but can be used for something else.
}; };
struct EXPLOSION struct EXPLOSION
@ -164,7 +164,7 @@ struct VECTORDATA {
int at15; // blood splats int at15; // blood splats
int at19; // blood splat chance int at19; // blood splat chance
VECTORDATA_at1d at1d[15]; VECTORDATA_at1d at1d[15];
int fireSound[2]; // By NoOne: predefined fire sounds. used by kCustomDude, but can be used for something else. int fireSound[2]; // By NoOne: predefined fire sounds. used by kDudeModernCustom, but can be used for something else.
}; };
// by NoOne: sprite mass info for getSpriteMassBySize(); // by NoOne: sprite mass info for getSpriteMassBySize();
@ -239,7 +239,7 @@ bool actHealDude(XSPRITE *pXDude, int a2, int a3);
void actKillDude(int a1, spritetype *pSprite, DAMAGE_TYPE a3, int a4); void actKillDude(int a1, spritetype *pSprite, DAMAGE_TYPE a3, int a4);
int actDamageSprite(int nSource, spritetype *pSprite, DAMAGE_TYPE a3, int a4); int actDamageSprite(int nSource, spritetype *pSprite, DAMAGE_TYPE a3, int a4);
void actHitcodeToData(int a1, HITINFO *pHitInfo, int *a3, spritetype **a4, XSPRITE **a5, int *a6, walltype **a7, XWALL **a8, int *a9, sectortype **a10, XSECTOR **a11); void actHitcodeToData(int a1, HITINFO *pHitInfo, int *a3, spritetype **a4, XSPRITE **a5, int *a6, walltype **a7, XWALL **a8, int *a9, sectortype **a10, XSECTOR **a11);
void actImpactMissile(spritetype *pMissile, int a2); void actImpactMissile(spritetype *pMissile, int hitCode);
void actKickObject(spritetype *pSprite1, spritetype *pSprite2); void actKickObject(spritetype *pSprite1, spritetype *pSprite2);
void actTouchFloor(spritetype *pSprite, int nSector); void actTouchFloor(spritetype *pSprite, int nSector);
void ProcessTouchObjects(spritetype *pSprite, int nXSprite); void ProcessTouchObjects(spritetype *pSprite, int nXSprite);

File diff suppressed because it is too large Load diff

View file

@ -31,7 +31,7 @@ BEGIN_BLD_NS
struct AISTATE { struct AISTATE {
int stateType; // By NoOne: current type of state. Basically required for kGDXDudeTargetChanger, but can be used for something else. int stateType; // By NoOne: current type of state. Basically required for kModernDudeTargetChanger, but can be used for something else.
int at0; // seq int at0; // seq
int at4; // seq callback int at4; // seq callback
int at8; int at8;
@ -104,7 +104,7 @@ void aiProcessDudes(void);
void aiInit(void); void aiInit(void);
void aiInitSprite(spritetype *pSprite); void aiInitSprite(spritetype *pSprite);
// By NoOne: this function required for kGDXDudeTargetChanger // By NoOne: this function required for kModernDudeTargetChanger
void aiSetGenIdleState(spritetype* pSprite, XSPRITE* pXSprite); void aiSetGenIdleState(spritetype* pSprite, XSPRITE* pXSprite);
END_BLD_NS END_BLD_NS

View file

@ -134,7 +134,7 @@ static void StompSeqCallback(int, int nXSprite)
spritetype *pSprite2 = &sprite[nSprite2]; spritetype *pSprite2 = &sprite[nSprite2];
if (pSprite2->extra > 0 && pSprite2->extra < kMaxXSprites) if (pSprite2->extra > 0 && pSprite2->extra < kMaxXSprites)
{ {
if (pSprite2->type == 251) if (pSprite2->type == kDudeBeast)
continue; continue;
if (pSprite2->flags&32) if (pSprite2->flags&32)
continue; continue;
@ -195,7 +195,7 @@ static void StompSeqCallback(int, int nXSprite)
static void MorphToBeast(spritetype *pSprite, XSPRITE *pXSprite) static void MorphToBeast(spritetype *pSprite, XSPRITE *pXSprite)
{ {
actHealDude(pXSprite, dudeInfo[51].startHealth, dudeInfo[51].startHealth); actHealDude(pXSprite, dudeInfo[51].startHealth, dudeInfo[51].startHealth);
pSprite->type = 251; pSprite->type = kDudeBeast;
} }
static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite) static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite)

View file

@ -110,25 +110,25 @@ static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite)
{ {
switch (pSprite->type) switch (pSprite->type)
{ {
case 240: case kDudeBurningCultist:
aiNewState(pSprite, pXSprite, &cultistBurnSearch); aiNewState(pSprite, pXSprite, &cultistBurnSearch);
break; break;
case 241: case kDudeBurningZombieAxe:
aiNewState(pSprite, pXSprite, &zombieABurnSearch); aiNewState(pSprite, pXSprite, &zombieABurnSearch);
break; break;
case 242: case kDudeBurningZombieButcher:
aiNewState(pSprite, pXSprite, &zombieFBurnSearch); aiNewState(pSprite, pXSprite, &zombieFBurnSearch);
break; break;
case 239: case kDudeBurningInnocent:
aiNewState(pSprite, pXSprite, &innocentBurnSearch); aiNewState(pSprite, pXSprite, &innocentBurnSearch);
break; break;
case 253: case kDudeBurningBeast:
aiNewState(pSprite, pXSprite, &beastBurnSearch); aiNewState(pSprite, pXSprite, &beastBurnSearch);
break; break;
case 252: case kDudeBurningTinyCaleb:
aiNewState(pSprite, pXSprite, &tinycalebBurnSearch); aiNewState(pSprite, pXSprite, &tinycalebBurnSearch);
break; break;
case kCustomDudeBurning: case kDudeModernCustomBurning:
aiNewState(pSprite, pXSprite, &GDXGenDudeBurnSearch); aiNewState(pSprite, pXSprite, &GDXGenDudeBurnSearch);
break; break;
} }
@ -142,25 +142,25 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
{ {
switch (pSprite->type) switch (pSprite->type)
{ {
case 240: case kDudeBurningCultist:
aiNewState(pSprite, pXSprite, &cultistBurnGoto); aiNewState(pSprite, pXSprite, &cultistBurnGoto);
break; break;
case 241: case kDudeBurningZombieAxe:
aiNewState(pSprite, pXSprite, &zombieABurnGoto); aiNewState(pSprite, pXSprite, &zombieABurnGoto);
break; break;
case 242: case kDudeBurningZombieButcher:
aiNewState(pSprite, pXSprite, &zombieFBurnGoto); aiNewState(pSprite, pXSprite, &zombieFBurnGoto);
break; break;
case 239: case kDudeBurningInnocent:
aiNewState(pSprite, pXSprite, &innocentBurnGoto); aiNewState(pSprite, pXSprite, &innocentBurnGoto);
break; break;
case 253: case kDudeBurningBeast:
aiNewState(pSprite, pXSprite, &beastBurnGoto); aiNewState(pSprite, pXSprite, &beastBurnGoto);
break; break;
case 252: case kDudeBurningTinyCaleb:
aiNewState(pSprite, pXSprite, &tinycalebBurnGoto); aiNewState(pSprite, pXSprite, &tinycalebBurnGoto);
break; break;
case kCustomDudeBurning: case kDudeModernCustomBurning:
aiNewState(pSprite, pXSprite, &GDXGenDudeBurnGoto); aiNewState(pSprite, pXSprite, &GDXGenDudeBurnGoto);
break; break;
} }
@ -178,25 +178,25 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
{ {
switch (pSprite->type) switch (pSprite->type)
{ {
case 240: case kDudeBurningCultist:
aiNewState(pSprite, pXSprite, &cultistBurnSearch); aiNewState(pSprite, pXSprite, &cultistBurnSearch);
break; break;
case 241: case kDudeBurningZombieAxe:
aiNewState(pSprite, pXSprite, &zombieABurnSearch); aiNewState(pSprite, pXSprite, &zombieABurnSearch);
break; break;
case 242: case kDudeBurningZombieButcher:
aiNewState(pSprite, pXSprite, &zombieFBurnSearch); aiNewState(pSprite, pXSprite, &zombieFBurnSearch);
break; break;
case 239: case kDudeBurningInnocent:
aiNewState(pSprite, pXSprite, &innocentBurnSearch); aiNewState(pSprite, pXSprite, &innocentBurnSearch);
break; break;
case 253: case kDudeBurningBeast:
aiNewState(pSprite, pXSprite, &beastBurnSearch); aiNewState(pSprite, pXSprite, &beastBurnSearch);
break; break;
case 252: case kDudeBurningTinyCaleb:
aiNewState(pSprite, pXSprite, &tinycalebBurnSearch); aiNewState(pSprite, pXSprite, &tinycalebBurnSearch);
break; break;
case kCustomDudeBurning: case kDudeModernCustomBurning:
aiNewState(pSprite, pXSprite, &GDXGenDudeBurnSearch); aiNewState(pSprite, pXSprite, &GDXGenDudeBurnSearch);
break; break;
} }
@ -216,25 +216,25 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
{ {
switch (pSprite->type) switch (pSprite->type)
{ {
case 240: case kDudeBurningCultist:
aiNewState(pSprite, pXSprite, &cultistBurnAttack); aiNewState(pSprite, pXSprite, &cultistBurnAttack);
break; break;
case 241: case kDudeBurningZombieAxe:
aiNewState(pSprite, pXSprite, &zombieABurnAttack); aiNewState(pSprite, pXSprite, &zombieABurnAttack);
break; break;
case 242: case kDudeBurningZombieButcher:
aiNewState(pSprite, pXSprite, &zombieFBurnAttack); aiNewState(pSprite, pXSprite, &zombieFBurnAttack);
break; break;
case 239: case kDudeBurningInnocent:
aiNewState(pSprite, pXSprite, &innocentBurnAttack); aiNewState(pSprite, pXSprite, &innocentBurnAttack);
break; break;
case 253: case kDudeBurningBeast:
aiNewState(pSprite, pXSprite, &beastBurnAttack); aiNewState(pSprite, pXSprite, &beastBurnAttack);
break; break;
case 252: case kDudeBurningTinyCaleb:
aiNewState(pSprite, pXSprite, &tinycalebBurnAttack); aiNewState(pSprite, pXSprite, &tinycalebBurnAttack);
break; break;
case kCustomDudeBurning: case kDudeModernCustomBurning:
aiNewState(pSprite, pXSprite, &GDXGenDudeBurnSearch); aiNewState(pSprite, pXSprite, &GDXGenDudeBurnSearch);
break; break;
} }
@ -246,25 +246,25 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
switch (pSprite->type) switch (pSprite->type)
{ {
case 240: case kDudeBurningCultist:
aiNewState(pSprite, pXSprite, &cultistBurnGoto); aiNewState(pSprite, pXSprite, &cultistBurnGoto);
break; break;
case 241: case kDudeBurningZombieAxe:
aiNewState(pSprite, pXSprite, &zombieABurnGoto); aiNewState(pSprite, pXSprite, &zombieABurnGoto);
break; break;
case 242: case 242:
aiNewState(pSprite, pXSprite, &zombieFBurnGoto); aiNewState(pSprite, pXSprite, &zombieFBurnGoto);
break; break;
case 239: case kDudeBurningInnocent:
aiNewState(pSprite, pXSprite, &innocentBurnGoto); aiNewState(pSprite, pXSprite, &innocentBurnGoto);
break; break;
case 253: case kDudeBurningBeast:
aiNewState(pSprite, pXSprite, &beastBurnGoto); aiNewState(pSprite, pXSprite, &beastBurnGoto);
break; break;
case 252: case kDudeBurningTinyCaleb:
aiNewState(pSprite, pXSprite, &tinycalebBurnGoto); aiNewState(pSprite, pXSprite, &tinycalebBurnGoto);
break; break;
case kCustomDudeBurning: case kDudeModernCustomBurning:
aiNewState(pSprite, pXSprite, &GDXGenDudeBurnSearch); aiNewState(pSprite, pXSprite, &GDXGenDudeBurnSearch);
break; break;
} }

View file

@ -163,15 +163,14 @@ static void BurnSeqCallback(int, int nXSprite)
} }
} }
} }
switch (pSprite->type) switch (pSprite->type) {
{ case kDudeCerberusTwoHead:
case 227: actFireMissile(pSprite, -350, 0, aim.dx, aim.dy, aim.dz, kMissileFireballCerberus);
actFireMissile(pSprite, -350, 0, aim.dx, aim.dy, aim.dz, 313); actFireMissile(pSprite, 350, -100, aim.dx, aim.dy, aim.dz, kMissileFireballCerberus);
actFireMissile(pSprite, 350, -100, aim.dx, aim.dy, aim.dz, 313); break;
break; case kDudeCerberusOneHead:
case 228: actFireMissile(pSprite, 350, -100, aim.dx, aim.dy, aim.dz, kMissileFireballCerberus);
actFireMissile(pSprite, 350, -100, aim.dx, aim.dy, aim.dz, 313); break;
break;
} }
} }
@ -248,15 +247,14 @@ static void BurnSeqCallback2(int, int nXSprite)
} }
} }
} }
switch (pSprite->type) switch (pSprite->type) {
{ case kDudeCerberusTwoHead:
case 227: actFireMissile(pSprite, 350, -100, aim.dx, aim.dy, -aim.dz, kMissileFlameHound);
actFireMissile(pSprite, 350, -100, aim.dx, aim.dy, -aim.dz, 308); actFireMissile(pSprite, -350, 0, ax, ay, az, kMissileFlameHound);
actFireMissile(pSprite, -350, 0, ax, ay, az, 308); break;
break; case kDudeCerberusOneHead:
case 228: actFireMissile(pSprite, 350, -100, aim.dx, aim.dy, -aim.dz, kMissileFlameHound);
actFireMissile(pSprite, 350, -100, aim.dx, aim.dy, -aim.dz, 308); break;
break;
} }
} }
@ -278,7 +276,7 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite)
pXSprite->goalAng += 256; pXSprite->goalAng += 256;
POINT3D *pTarget = &baseSprite[pSprite->index]; POINT3D *pTarget = &baseSprite[pSprite->index];
aiSetTarget(pXSprite, pTarget->x, pTarget->y, pTarget->z); aiSetTarget(pXSprite, pTarget->x, pTarget->y, pTarget->z);
if (pSprite->type == 227) if (pSprite->type == kDudeCerberusTwoHead)
aiNewState(pSprite, pXSprite, &cerberus139890); aiNewState(pSprite, pXSprite, &cerberus139890);
else else
aiNewState(pSprite, pXSprite, &cerberus1398AC); aiNewState(pSprite, pXSprite, &cerberus1398AC);
@ -333,14 +331,13 @@ static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite)
aiChooseDirection(pSprite, pXSprite, nAngle); aiChooseDirection(pSprite, pXSprite, nAngle);
if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery)
{ {
switch (pSprite->type) switch (pSprite->type) {
{ case kDudeCerberusTwoHead:
case 227: aiNewState(pSprite, pXSprite, &cerberusSearch);
aiNewState(pSprite, pXSprite, &cerberusSearch); break;
break; case kDudeCerberusOneHead:
case 228: aiNewState(pSprite, pXSprite, &cerberus2Search);
aiNewState(pSprite, pXSprite, &cerberus2Search); break;
break;
} }
} }
aiThinkTarget(pSprite, pXSprite); aiThinkTarget(pSprite, pXSprite);
@ -348,21 +345,19 @@ static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite)
static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
{ {
if (pXSprite->target == -1) if (pXSprite->target == -1) {
{ switch (pSprite->type) {
switch (pSprite->type) case kDudeCerberusTwoHead:
{ aiNewState(pSprite, pXSprite, &cerberusGoto);
case 227: break;
aiNewState(pSprite, pXSprite, &cerberusGoto); case kDudeCerberusOneHead:
break; aiNewState(pSprite, pXSprite, &cerberus2Goto);
case 228: break;
aiNewState(pSprite, pXSprite, &cerberus2Goto);
break;
} }
return; return;
} }
if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax))
return; if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) return;
//dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); //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)) if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites))
@ -373,32 +368,31 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
int dx = pTarget->x-pSprite->x; int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y; int dy = pTarget->y-pSprite->y;
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy)); aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
if (pXTarget->health == 0)
{ if (pXTarget->health == 0) {
switch (pSprite->type) switch (pSprite->type) {
{ case kDudeCerberusTwoHead:
case 227: aiNewState(pSprite, pXSprite, &cerberusSearch);
aiNewState(pSprite, pXSprite, &cerberusSearch); break;
break; case kDudeCerberusOneHead:
case 228: aiNewState(pSprite, pXSprite, &cerberus2Search);
aiNewState(pSprite, pXSprite, &cerberus2Search); break;
break;
} }
return; return;
} }
if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0)
{ if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) {
switch (pSprite->type) switch (pSprite->type) {
{ case kDudeCerberusTwoHead:
case 227: aiNewState(pSprite, pXSprite, &cerberusSearch);
aiNewState(pSprite, pXSprite, &cerberusSearch); break;
break; case kDudeCerberusOneHead:
case 228: aiNewState(pSprite, pXSprite, &cerberus2Search);
aiNewState(pSprite, pXSprite, &cerberus2Search); break;
break;
} }
return; return;
} }
int nDist = approxDist(dx, dy); int nDist = approxDist(dx, dy);
if (nDist <= pDudeInfo->seeDist) if (nDist <= pDudeInfo->seeDist)
{ {
@ -406,72 +400,66 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
int height = (pDudeInfo->eyeHeight*pSprite->yrepeat)<<2; int height = (pDudeInfo->eyeHeight*pSprite->yrepeat)<<2;
if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum)) if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum))
{ {
if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery) {
{
aiSetTarget(pXSprite, pXSprite->target); aiSetTarget(pXSprite, pXSprite->target);
if (nDist < 0x1b00 && nDist > 0xd00 && klabs(nDeltaAngle) < 85)
{ if (nDist < 0x1b00 && nDist > 0xd00 && klabs(nDeltaAngle) < 85) {
switch (pSprite->type) switch (pSprite->type) {
{ case kDudeCerberusTwoHead:
case 227: aiNewState(pSprite, pXSprite, &cerberusBurn);
aiNewState(pSprite, pXSprite, &cerberusBurn); break;
break; case kDudeCerberusOneHead:
case 228: aiNewState(pSprite, pXSprite, &cerberus2Burn);
aiNewState(pSprite, pXSprite, &cerberus2Burn); break;
break;
} }
} }
else if (nDist < 0xb00 && nDist > 0x500 && klabs(nDeltaAngle) < 85)
{ else if (nDist < 0xb00 && nDist > 0x500 && klabs(nDeltaAngle) < 85) {
switch (pSprite->type) switch (pSprite->type) {
{ case kDudeCerberusTwoHead:
case 227: aiNewState(pSprite, pXSprite, &cerberus3Burn);
aiNewState(pSprite, pXSprite, &cerberus3Burn); break;
break; case kDudeCerberusOneHead:
case 228: aiNewState(pSprite, pXSprite, &cerberus4Burn);
aiNewState(pSprite, pXSprite, &cerberus4Burn); break;
break;
} }
} }
else if (nDist < 0x200 && klabs(nDeltaAngle) < 85) else if (nDist < 0x200 && klabs(nDeltaAngle) < 85)
{ {
int hit = HitScan(pSprite, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(pSprite, pSprite->z, dx, dy, 0, CLIPMASK1, 0);
switch (pSprite->type) switch (pSprite->type) {
{ case kDudeCerberusTwoHead:
case 227: switch (hit) {
switch (hit) case -1:
{
case -1:
aiNewState(pSprite, pXSprite, &cerberusBite);
break;
case 3:
if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != 211)
aiNewState(pSprite, pXSprite, &cerberusBite); aiNewState(pSprite, pXSprite, &cerberusBite);
break; break;
case 0: case 3:
case 4: if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeHellHound)
break; aiNewState(pSprite, pXSprite, &cerberusBite);
default: break;
aiNewState(pSprite, pXSprite, &cerberusBite); case 0:
break; case 4:
break;
default:
aiNewState(pSprite, pXSprite, &cerberusBite);
break;
} }
break; break;
case 228: case kDudeCerberusOneHead:
switch (hit) switch (hit) {
{ case -1:
case -1:
aiNewState(pSprite, pXSprite, &cerberus2Bite);
break;
case 3:
if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != 211)
aiNewState(pSprite, pXSprite, &cerberus2Bite); aiNewState(pSprite, pXSprite, &cerberus2Bite);
break; break;
case 0: case 3:
case 4: if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeHellHound)
break; aiNewState(pSprite, pXSprite, &cerberus2Bite);
default: break;
aiNewState(pSprite, pXSprite, &cerberus2Bite); case 0:
break; case 4:
break;
default:
aiNewState(pSprite, pXSprite, &cerberus2Bite);
break;
} }
break; break;
} }
@ -481,14 +469,13 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
} }
} }
switch (pSprite->type) switch (pSprite->type) {
{ case kDudeCerberusTwoHead:
case 227: aiNewState(pSprite, pXSprite, &cerberusGoto);
aiNewState(pSprite, pXSprite, &cerberusGoto); break;
break; case kDudeCerberusOneHead:
case 228: aiNewState(pSprite, pXSprite, &cerberus2Goto);
aiNewState(pSprite, pXSprite, &cerberus2Goto); break;
break;
} }
pXSprite->target = -1; pXSprite->target = -1;
} }

View file

@ -128,7 +128,7 @@ static void TeslaSeqCallback(int, int nXSprite)
dx += Random3((5-gGameOptions.nDifficulty)*1000); dx += Random3((5-gGameOptions.nDifficulty)*1000);
dy += Random3((5-gGameOptions.nDifficulty)*1000); dy += Random3((5-gGameOptions.nDifficulty)*1000);
dz += Random3((5-gGameOptions.nDifficulty)*500); dz += Random3((5-gGameOptions.nDifficulty)*500);
actFireMissile(pSprite, 0, 0, dx, dy, dz, 306); actFireMissile(pSprite, 0, 0, dx, dy, dz, kMissileTeslaRegular);
sfxPlay3DSound(pSprite, 470, -1, 0); sfxPlay3DSound(pSprite, 470, -1, 0);
} }
} }
@ -162,9 +162,9 @@ static void ThrowSeqCallback(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];
int nMissile = 418; int nMissile = kThingArmedTNTStick;
if (gGameOptions.nDifficulty > 2) if (gGameOptions.nDifficulty > 2)
nMissile = 419; nMissile = kThingArmedTNTBundle;
char v4 = Chance(0x6000); char v4 = Chance(0x6000);
sfxPlay3DSound(pSprite, 455, -1, 0); sfxPlay3DSound(pSprite, 455, -1, 0);
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
@ -181,7 +181,7 @@ static void ThrowSeqCallback(int, int nXSprite)
if (v4) if (v4)
xsprite[pMissile->extra].Impact = 1; xsprite[pMissile->extra].Impact = 1;
else else
evPost(pMissile->index, 3, 120*(1+Random(2)), COMMAND_ID_1); evPost(pMissile->index, 3, 120*(1+Random(2)), kCmdOn);
} }
static void sub_68170(int, int nXSprite) static void sub_68170(int, int nXSprite)
@ -189,12 +189,12 @@ static void sub_68170(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];
int nMissile = 418; int nMissile = kThingArmedTNTStick;
if (gGameOptions.nDifficulty > 2) if (gGameOptions.nDifficulty > 2)
nMissile = 419; nMissile = kThingArmedTNTBundle;
sfxPlay3DSound(pSprite, 455, -1, 0); sfxPlay3DSound(pSprite, 455, -1, 0);
spritetype *pMissile = actFireThing(pSprite, 0, 0, gDudeSlope[nXSprite]-9460, nMissile, 0x133333); spritetype *pMissile = actFireThing(pSprite, 0, 0, gDudeSlope[nXSprite]-9460, nMissile, 0x133333);
evPost(pMissile->index, 3, 120*(2+Random(2)), COMMAND_ID_1); evPost(pMissile->index, 3, 120*(2+Random(2)), kCmdOn);
} }
static void sub_68230(int, int nXSprite) static void sub_68230(int, int nXSprite)
@ -202,9 +202,9 @@ static void sub_68230(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];
int nMissile = 418; int nMissile = kThingArmedTNTStick;
if (gGameOptions.nDifficulty > 2) if (gGameOptions.nDifficulty > 2)
nMissile = 419; nMissile = kThingArmedTNTBundle;
sfxPlay3DSound(pSprite, 455, -1, 0); sfxPlay3DSound(pSprite, 455, -1, 0);
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target]; spritetype *pTarget = &sprite[pXSprite->target];
@ -222,7 +222,7 @@ static char TargetNearExplosion(spritetype *pSprite)
{ {
for (short nSprite = headspritesect[pSprite->sectnum]; nSprite >= 0; nSprite = nextspritesect[nSprite]) for (short nSprite = headspritesect[pSprite->sectnum]; nSprite >= 0; nSprite = nextspritesect[nSprite])
{ {
if (sprite[nSprite].type == 418 || sprite[nSprite].statnum == kStatExplosion) if (sprite[nSprite].type == kThingArmedTNTStick || sprite[nSprite].statnum == kStatExplosion)
return 1; return 1;
} }
return 0; return 0;
@ -289,7 +289,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
{ {
case 0: case 0:
aiNewState(pSprite, pXSprite, &cultistSearch); aiNewState(pSprite, pXSprite, &cultistSearch);
if (pSprite->type == 201) 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);
@ -327,9 +327,8 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
aiSetTarget(pXSprite, pXSprite->target); aiSetTarget(pXSprite, pXSprite->target);
int nXSprite = sprite[pXSprite->reference].extra; int nXSprite = sprite[pXSprite->reference].extra;
gDudeSlope[nXSprite] = divscale(pTarget->z-pSprite->z, nDist, 10); gDudeSlope[nXSprite] = divscale(pTarget->z-pSprite->z, nDist, 10);
switch (pSprite->type) switch (pSprite->type) {
{ case kDudeCultistTommy:
case 201:
if (nDist < 0x1e00 && nDist > 0xe00 && klabs(nDeltaAngle) < 85 && !TargetNearExplosion(pTarget) if (nDist < 0x1e00 && nDist > 0xe00 && klabs(nDeltaAngle) < 85 && !TargetNearExplosion(pTarget)
&& (pTarget->flags&2) && gGameOptions.nDifficulty > 2 && IsPlayerSprite(pTarget) && gPlayer[pTarget->type-kDudePlayer1].at2e && (pTarget->flags&2) && gGameOptions.nDifficulty > 2 && IsPlayerSprite(pTarget) && gPlayer[pTarget->type-kDudePlayer1].at2e
&& Chance(0x8000)) && Chance(0x8000))
@ -345,7 +344,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
case 4: case 4:
break; break;
case 3: case 3:
if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != 202 && pXSprite->medium != 1 && pXSprite->medium != 2) if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun && pXSprite->medium != 1 && pXSprite->medium != 2)
aiNewState(pSprite, pXSprite, &cultistTThrow); aiNewState(pSprite, pXSprite, &cultistTThrow);
break; break;
default: default:
@ -367,7 +366,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
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 != 202) 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 == 0)
aiNewState(pSprite, pXSprite, &cultistTFire); aiNewState(pSprite, pXSprite, &cultistTFire);
@ -397,7 +396,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
} }
} }
break; break;
case 202: case kDudeCultistShotgun:
if (nDist < 0x2c00 && nDist > 0x1400 && !TargetNearExplosion(pTarget) if (nDist < 0x2c00 && nDist > 0x1400 && !TargetNearExplosion(pTarget)
&& (pTarget->flags&2) && gGameOptions.nDifficulty >= 2 && IsPlayerSprite(pTarget) && !gPlayer[pTarget->type-kDudePlayer1].at2e && (pTarget->flags&2) && gGameOptions.nDifficulty >= 2 && IsPlayerSprite(pTarget) && !gPlayer[pTarget->type-kDudePlayer1].at2e
&& Chance(0x8000)) && Chance(0x8000))
@ -413,7 +412,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
case 4: case 4:
break; break;
case 3: case 3:
if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != 202 && pXSprite->medium != 1 && pXSprite->medium != 2) if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun && pXSprite->medium != 1 && pXSprite->medium != 2)
aiNewState(pSprite, pXSprite, &cultistSThrow); aiNewState(pSprite, pXSprite, &cultistSThrow);
break; break;
default: default:
@ -435,7 +434,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
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 != 201) 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 == 0)
aiNewState(pSprite, pXSprite, &cultistSFire); aiNewState(pSprite, pXSprite, &cultistSFire);
@ -465,7 +464,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
} }
} }
break; break;
case 247: case kDudeCultistTesla:
if (nDist < 0x1e00 && nDist > 0xe00 && !TargetNearExplosion(pTarget) if (nDist < 0x1e00 && nDist > 0xe00 && !TargetNearExplosion(pTarget)
&& (pTarget->flags&2) && gGameOptions.nDifficulty > 2 && IsPlayerSprite(pTarget) && gPlayer[pTarget->type-kDudePlayer1].at2e && (pTarget->flags&2) && gGameOptions.nDifficulty > 2 && IsPlayerSprite(pTarget) && gPlayer[pTarget->type-kDudePlayer1].at2e
&& Chance(0x8000)) && Chance(0x8000))
@ -481,7 +480,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
case 4: case 4:
break; break;
case 3: case 3:
if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != 202 && pXSprite->medium != 1 && pXSprite->medium != 2) if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun && pXSprite->medium != 1 && pXSprite->medium != 2)
aiNewState(pSprite, pXSprite, &cultistTsThrow); aiNewState(pSprite, pXSprite, &cultistTsThrow);
break; break;
default: default:
@ -503,7 +502,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
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 != 201) 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 == 0)
aiNewState(pSprite, pXSprite, &cultistTsFire); aiNewState(pSprite, pXSprite, &cultistTsFire);
@ -533,7 +532,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
} }
} }
break; break;
case 248: case kDudeCultistTNT:
if (nDist < 0x2c00 && nDist > 0x1400 && klabs(nDeltaAngle) < 85 if (nDist < 0x2c00 && nDist > 0x1400 && klabs(nDeltaAngle) < 85
&& (pTarget->flags&2) && IsPlayerSprite(pTarget)) && (pTarget->flags&2) && IsPlayerSprite(pTarget))
{ {
@ -547,7 +546,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
case 4: case 4:
break; break;
case 3: case 3:
if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != 202 && pXSprite->medium != 1 && pXSprite->medium != 2) if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun && pXSprite->medium != 1 && pXSprite->medium != 2)
aiNewState(pSprite, pXSprite, &cultistDThrow); aiNewState(pSprite, pXSprite, &cultistDThrow);
break; break;
default: default:
@ -568,7 +567,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
case 4: case 4:
break; break;
case 3: case 3:
if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != 202 && pXSprite->medium != 1 && pXSprite->medium != 2) if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun && pXSprite->medium != 1 && pXSprite->medium != 2)
aiNewState(pSprite, pXSprite, &cultist139A78); aiNewState(pSprite, pXSprite, &cultist139A78);
break; break;
default: default:
@ -577,7 +576,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
} }
} }
break; break;
case 249: case kDudeCultistBeast:
if (nDist < 0x1e00 && nDist > 0xe00 && !TargetNearExplosion(pTarget) if (nDist < 0x1e00 && nDist > 0xe00 && !TargetNearExplosion(pTarget)
&& (pTarget->flags&2) && gGameOptions.nDifficulty > 2 && IsPlayerSprite(pTarget) && gPlayer[pTarget->type-kDudePlayer1].at2e && (pTarget->flags&2) && gGameOptions.nDifficulty > 2 && IsPlayerSprite(pTarget) && gPlayer[pTarget->type-kDudePlayer1].at2e
&& Chance(0x8000)) && Chance(0x8000))
@ -593,7 +592,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
case 4: case 4:
break; break;
case 3: case 3:
if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != 202 && pXSprite->medium != 1 && pXSprite->medium != 2) if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun && pXSprite->medium != 1 && pXSprite->medium != 2)
aiNewState(pSprite, pXSprite, &cultistSThrow); aiNewState(pSprite, pXSprite, &cultistSThrow);
break; break;
default: default:
@ -615,7 +614,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
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 != 201) 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 == 0)
aiNewState(pSprite, pXSprite, &cultistSFire); aiNewState(pSprite, pXSprite, &cultistSFire);

View file

@ -125,7 +125,7 @@ static void ThrowFSeqCallback(int, int nXSprite)
{ {
XSPRITE *pXSprite = &xsprite[nXSprite]; XSPRITE *pXSprite = &xsprite[nXSprite];
int nSprite = pXSprite->reference; int nSprite = pXSprite->reference;
actFireThing(&sprite[nSprite], 0, 0, gDudeSlope[nXSprite]-7500, 421, 0xeeeee); actFireThing(&sprite[nSprite], 0, 0, gDudeSlope[nXSprite]-7500, kThingBone, 0xeeeee);
} }
static void BlastSSeqCallback(int, int nXSprite) static void BlastSSeqCallback(int, int nXSprite)
@ -210,8 +210,8 @@ static void BlastSSeqCallback(int, int nXSprite)
} }
if (IsPlayerSprite(pTarget) || !VanillaMode()) // By NoOne: allow to fire missile in non-player targets if (IsPlayerSprite(pTarget) || !VanillaMode()) // By NoOne: allow to fire missile in non-player targets
{ {
actFireMissile(pSprite, -120, 0, aim.dx, aim.dy, aim.dz, 311); actFireMissile(pSprite, -120, 0, aim.dx, aim.dy, aim.dz, kMissileArcGargoyle);
actFireMissile(pSprite, 120, 0, aim.dx, aim.dy, aim.dz, 311); actFireMissile(pSprite, 120, 0, aim.dx, aim.dy, aim.dz, kMissileArcGargoyle);
} }
} }
@ -220,7 +220,7 @@ static void ThrowSSeqCallback(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];
actFireThing(pSprite, 0, 0, gDudeSlope[nXSprite]-7500, 421, Chance(0x6000) ? 0x133333 : 0x111111); actFireThing(pSprite, 0, 0, gDudeSlope[nXSprite]-7500, kThingBone, Chance(0x6000) ? 0x133333 : 0x111111);
} }
static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite) static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite)
@ -398,9 +398,8 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
{ {
aiSetTarget(pXSprite, pXSprite->target); aiSetTarget(pXSprite, pXSprite->target);
int floorZ = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y); int floorZ = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y);
switch (pSprite->type) switch (pSprite->type) {
{ case kDudeGargoyleFlesh:
case 206:
if (nDist < 0x1800 && nDist > 0xc00 && klabs(nDeltaAngle) < 85) if (nDist < 0x1800 && nDist > 0xc00 && klabs(nDeltaAngle) < 85)
{ {
int hit = HitScan(pSprite, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(pSprite, pSprite->z, dx, dy, 0, CLIPMASK1, 0);
@ -414,7 +413,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
case 4: case 4:
break; break;
case 3: case 3:
if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != 207) if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeGargoyleStone)
{ {
sfxPlay3DSound(pSprite, 1408, 0, 0); sfxPlay3DSound(pSprite, 1408, 0, 0);
aiNewState(pSprite, pXSprite, &gargoyleFThrow); aiNewState(pSprite, pXSprite, &gargoyleFThrow);
@ -439,7 +438,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
case 4: case 4:
break; break;
case 3: case 3:
if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != 207) if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeGargoyleStone)
{ {
sfxPlay3DSound(pSprite, 1406, 0, 0); sfxPlay3DSound(pSprite, 1406, 0, 0);
aiNewState(pSprite, pXSprite, &gargoyleFSlash); aiNewState(pSprite, pXSprite, &gargoyleFSlash);
@ -459,7 +458,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
else if ((height2-height < 0x2000 || floorZ-bottom < 0x2000) && klabs(nDeltaAngle) < 85) else if ((height2-height < 0x2000 || floorZ-bottom < 0x2000) && klabs(nDeltaAngle) < 85)
aiPlay3DSound(pSprite, 1400, AI_SFX_PRIORITY_1, -1); aiPlay3DSound(pSprite, 1400, AI_SFX_PRIORITY_1, -1);
break; break;
case 207: case kDudeGargoyleStone:
if (nDist < 0x1800 && nDist > 0xc00 && klabs(nDeltaAngle) < 85) if (nDist < 0x1800 && nDist > 0xc00 && klabs(nDeltaAngle) < 85)
{ {
int hit = HitScan(pSprite, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(pSprite, pSprite->z, dx, dy, 0, CLIPMASK1, 0);
@ -473,7 +472,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
case 4: case 4:
break; break;
case 3: case 3:
if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != 206) if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeGargoyleFlesh)
{ {
sfxPlay3DSound(pSprite, 1457, 0, 0); sfxPlay3DSound(pSprite, 1457, 0, 0);
aiNewState(pSprite, pXSprite, &gargoyleSBlast); aiNewState(pSprite, pXSprite, &gargoyleSBlast);
@ -497,7 +496,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
case 4: case 4:
break; break;
case 3: case 3:
if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != 206) if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeGargoyleFlesh)
aiNewState(pSprite, pXSprite, &gargoyleFSlash); aiNewState(pSprite, pXSprite, &gargoyleFSlash);
break; break;
default: default:
@ -507,7 +506,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
} }
else if ((height2-height > 0x2000 || floorZ-bottom > 0x2000) && nDist < 0x1400 && nDist > 0x800) else if ((height2-height > 0x2000 || floorZ-bottom > 0x2000) && nDist < 0x1400 && nDist > 0x800)
{ {
if (pSprite->type == 206) if (pSprite->type == kDudeGargoyleFlesh)
aiPlay3DSound(pSprite, 1400, AI_SFX_PRIORITY_1, -1); aiPlay3DSound(pSprite, 1400, AI_SFX_PRIORITY_1, -1);
else else
aiPlay3DSound(pSprite, 1450, AI_SFX_PRIORITY_1, -1); aiPlay3DSound(pSprite, 1450, AI_SFX_PRIORITY_1, -1);
@ -535,14 +534,14 @@ static void entryFStatue(spritetype *pSprite, XSPRITE *pXSprite)
{ {
DUDEINFO *pDudeInfo = &dudeInfo[6]; DUDEINFO *pDudeInfo = &dudeInfo[6];
actHealDude(pXSprite, pDudeInfo->startHealth, pDudeInfo->startHealth); actHealDude(pXSprite, pDudeInfo->startHealth, pDudeInfo->startHealth);
pSprite->type = 206; pSprite->type = kDudeGargoyleFlesh;
} }
static void entrySStatue(spritetype *pSprite, XSPRITE *pXSprite) static void entrySStatue(spritetype *pSprite, XSPRITE *pXSprite)
{ {
DUDEINFO *pDudeInfo = &dudeInfo[7]; DUDEINFO *pDudeInfo = &dudeInfo[7];
actHealDude(pXSprite, pDudeInfo->startHealth, pDudeInfo->startHealth); actHealDude(pXSprite, pDudeInfo->startHealth, pDudeInfo->startHealth);
pSprite->type = 207; pSprite->type = kDudeGargoyleStone;
} }
static void MoveForward(spritetype *pSprite, XSPRITE *pXSprite) static void MoveForward(spritetype *pSprite, XSPRITE *pXSprite)
@ -612,14 +611,13 @@ static void MoveSlow(spritetype *pSprite, XSPRITE *pXSprite)
t2 >>= 1; t2 >>= 1;
xvel[nSprite] = dmulscale30(t1, nCos, t2, nSin); xvel[nSprite] = dmulscale30(t1, nCos, t2, nSin);
yvel[nSprite] = dmulscale30(t1, nSin, -t2, nCos); yvel[nSprite] = dmulscale30(t1, nSin, -t2, nCos);
switch (pSprite->type) switch (pSprite->type) {
{ case kDudeGargoyleFlesh:
case 206: zvel[nSprite] = 0x44444;
zvel[nSprite] = 0x44444; break;
break; case kDudeGargoyleStone:
case 207: zvel[nSprite] = 0x35555;
zvel[nSprite] = 0x35555; break;
break;
} }
} }
@ -654,14 +652,13 @@ static void MoveSwoop(spritetype *pSprite, XSPRITE *pXSprite)
t1 += nAccel>>1; t1 += nAccel>>1;
xvel[nSprite] = dmulscale30(t1, nCos, t2, nSin); xvel[nSprite] = dmulscale30(t1, nCos, t2, nSin);
yvel[nSprite] = dmulscale30(t1, nSin, -t2, nCos); yvel[nSprite] = dmulscale30(t1, nSin, -t2, nCos);
switch (pSprite->type) switch (pSprite->type) {
{ case kDudeGargoyleFlesh:
case 206: zvel[nSprite] = t1;
zvel[nSprite] = t1; break;
break; case kDudeGargoyleStone:
case 207: zvel[nSprite] = t1;
zvel[nSprite] = t1; break;
break;
} }
} }
@ -696,14 +693,13 @@ static void MoveFly(spritetype *pSprite, XSPRITE *pXSprite)
t1 += nAccel>>1; t1 += nAccel>>1;
xvel[nSprite] = dmulscale30(t1, nCos, t2, nSin); xvel[nSprite] = dmulscale30(t1, nCos, t2, nSin);
yvel[nSprite] = dmulscale30(t1, nSin, -t2, nCos); yvel[nSprite] = dmulscale30(t1, nSin, -t2, nCos);
switch (pSprite->type) switch (pSprite->type) {
{ case kDudeGargoyleFlesh:
case 206: zvel[nSprite] = -t1;
zvel[nSprite] = -t1; break;
break; case kDudeGargoyleStone:
case 207: zvel[nSprite] = -t1;
zvel[nSprite] = -t1; break;
break;
} }
klabs(zvel[nSprite]); klabs(zvel[nSprite]);
} }

View file

@ -108,7 +108,7 @@ static void ThrowSeqCallback(int, int nXSprite)
{ {
XSPRITE *pXSprite = &xsprite[nXSprite]; XSPRITE *pXSprite = &xsprite[nXSprite];
int nSprite = pXSprite->reference; int nSprite = pXSprite->reference;
actFireThing(&sprite[nSprite], 0, 0, gDudeSlope[nXSprite]-7500, 421, 0xeeeee); actFireThing(&sprite[nSprite], 0, 0, gDudeSlope[nXSprite]-7500, kThingBone, 0xeeeee);
} }
static void BlastSeqCallback(int, int nXSprite) static void BlastSeqCallback(int, int nXSprite)
@ -194,7 +194,7 @@ static void BlastSeqCallback(int, int nXSprite)
if (IsPlayerSprite(pTarget) || !VanillaMode()) // By NoOne: allow fire missile in non-player targets if not a demo if (IsPlayerSprite(pTarget) || !VanillaMode()) // By NoOne: allow fire missile in non-player targets if not a demo
{ {
sfxPlay3DSound(pSprite, 489, 0, 0); sfxPlay3DSound(pSprite, 489, 0, 0);
actFireMissile(pSprite, 0, 0, aim.dx, aim.dy, aim.dz, 307); actFireMissile(pSprite, 0, 0, aim.dx, aim.dy, aim.dz, kMissileEctoSkull);
} }
} }
@ -372,11 +372,9 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
{ {
aiSetTarget(pXSprite, pXSprite->target); aiSetTarget(pXSprite, pXSprite->target);
int floorZ = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y); int floorZ = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y);
switch (pSprite->type) switch (pSprite->type) {
{ case kDudePhantasm:
case 210: if (nDist < 0x2000 && nDist > 0x1000 && klabs(nDeltaAngle) < 85) {
if (nDist < 0x2000 && nDist > 0x1000 && klabs(nDeltaAngle) < 85)
{
int hit = HitScan(pSprite, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(pSprite, pSprite->z, dx, dy, 0, CLIPMASK1, 0);
switch (hit) switch (hit)
{ {
@ -387,7 +385,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
case 4: case 4:
break; break;
case 3: case 3:
if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != 210) if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudePhantasm)
aiNewState(pSprite, pXSprite, &ghostBlast); aiNewState(pSprite, pXSprite, &ghostBlast);
break; break;
default: default:
@ -407,7 +405,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
case 4: case 4:
break; break;
case 3: case 3:
if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != 210) if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudePhantasm)
aiNewState(pSprite, pXSprite, &ghostSlash); aiNewState(pSprite, pXSprite, &ghostSlash);
break; break;
default: default:
@ -505,11 +503,10 @@ static void MoveSlow(spritetype *pSprite, XSPRITE *pXSprite)
t2 >>= 1; t2 >>= 1;
xvel[nSprite] = dmulscale30(t1, nCos, t2, nSin); xvel[nSprite] = dmulscale30(t1, nCos, t2, nSin);
yvel[nSprite] = dmulscale30(t1, nSin, -t2, nCos); yvel[nSprite] = dmulscale30(t1, nSin, -t2, nCos);
switch (pSprite->type) switch (pSprite->type) {
{ case kDudePhantasm:
case 210: zvel[nSprite] = 0x44444;
zvel[nSprite] = 0x44444; break;
break;
} }
} }
@ -544,11 +541,10 @@ static void MoveSwoop(spritetype *pSprite, XSPRITE *pXSprite)
t1 += nAccel>>1; t1 += nAccel>>1;
xvel[nSprite] = dmulscale30(t1, nCos, t2, nSin); xvel[nSprite] = dmulscale30(t1, nCos, t2, nSin);
yvel[nSprite] = dmulscale30(t1, nSin, -t2, nCos); yvel[nSprite] = dmulscale30(t1, nSin, -t2, nCos);
switch (pSprite->type) switch (pSprite->type) {
{ case kDudePhantasm:
case 210: zvel[nSprite] = t1;
zvel[nSprite] = t1; break;
break;
} }
} }
@ -583,11 +579,10 @@ static void MoveFly(spritetype *pSprite, XSPRITE *pXSprite)
t1 += nAccel>>1; t1 += nAccel>>1;
xvel[nSprite] = dmulscale30(t1, nCos, t2, nSin); xvel[nSprite] = dmulscale30(t1, nCos, t2, nSin);
yvel[nSprite] = dmulscale30(t1, nSin, -t2, nCos); yvel[nSprite] = dmulscale30(t1, nSin, -t2, nCos);
switch (pSprite->type) switch (pSprite->type) {
{ case kDudePhantasm:
case 210: zvel[nSprite] = -t1;
zvel[nSprite] = -t1; break;
break;
} }
} }

View file

@ -86,7 +86,7 @@ static void BurnSeqCallback(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];
actFireMissile(pSprite, 0, 0, Cos(pSprite->ang)>>16, Sin(pSprite->ang)>>16, 0, 308); actFireMissile(pSprite, 0, 0, Cos(pSprite->ang)>>16, Sin(pSprite->ang)>>16, 0, kMissileFlameHound);
} }
static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite) static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite)

View file

@ -111,7 +111,7 @@ static void sub_6FFA0(int, int nXSprite)
spritetype *pMissile = NULL; spritetype *pMissile = NULL;
switch (pSprite->type) switch (pSprite->type)
{ {
case 221: case kDudePodGreen:
dz += 8000; dz += 8000;
if (pDudeInfo->seeDist*0.1 < nDist) if (pDudeInfo->seeDist*0.1 < nDist)
{ {
@ -119,17 +119,17 @@ static void sub_6FFA0(int, int nXSprite)
sfxPlay3DSound(pSprite, 2474, -1, 0); sfxPlay3DSound(pSprite, 2474, -1, 0);
else else
sfxPlay3DSound(pSprite, 2475, -1, 0); sfxPlay3DSound(pSprite, 2475, -1, 0);
pMissile = actFireThing(pSprite, 0, -8000, dz/128-14500, 430, (nDist2<<23)/120); pMissile = actFireThing(pSprite, 0, -8000, dz/128-14500, kThingPodFireBall, (nDist2<<23)/120);
} }
if (pMissile) if (pMissile)
seqSpawn(68, 3, pMissile->extra, -1); seqSpawn(68, 3, pMissile->extra, -1);
break; break;
case 223: case kDudePodFire:
dz += 8000; dz += 8000;
if (pDudeInfo->seeDist*0.1 < nDist) if (pDudeInfo->seeDist*0.1 < nDist)
{ {
sfxPlay3DSound(pSprite, 2454, -1, 0); sfxPlay3DSound(pSprite, 2454, -1, 0);
pMissile = actFireThing(pSprite, 0, -8000, dz/128-14500, 429, (nDist2<<23)/120); pMissile = actFireThing(pSprite, 0, -8000, dz/128-14500, kThingPodGreenBall, (nDist2<<23)/120);
} }
if (pMissile) if (pMissile)
seqSpawn(22, 3, pMissile->extra, -1); seqSpawn(22, 3, pMissile->extra, -1);
@ -147,19 +147,18 @@ static void sub_70284(int, int nXSprite)
sfxPlay3DSound(pSprite, 2502, -1, 0); sfxPlay3DSound(pSprite, 2502, -1, 0);
int nDist, nBurn; int nDist, nBurn;
DAMAGE_TYPE dmgType; DAMAGE_TYPE dmgType;
switch (pSprite->type) switch (pSprite->type) {
{ case kDudeTentacleGreen:
case 222: default: // ???
default: nBurn = 0;
nBurn = 0; dmgType = DAMAGE_TYPE_2;
dmgType = DAMAGE_TYPE_2; nDist = 50;
nDist = 50; break;
break; case kDudeTentacleFire: // ???
case 224: nBurn = (gGameOptions.nDifficulty*120)>>2;
nBurn = (gGameOptions.nDifficulty*120)>>2; dmgType = DAMAGE_TYPE_3;
dmgType = DAMAGE_TYPE_3; nDist = 75;
nDist = 75; break;
break;
} }
sub_2A620(nSprite, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, nDist, 1, 5*(1+gGameOptions.nDifficulty), dmgType, 2, nBurn, 0, 0); sub_2A620(nSprite, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, nDist, 1, 5*(1+gGameOptions.nDifficulty), dmgType, 2, nBurn, 0, 0);
} }
@ -182,18 +181,16 @@ static void sub_70380(spritetype *pSprite, XSPRITE *pXSprite)
int nAngle = getangle(dx, dy); int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy); int nDist = approxDist(dx, dy);
aiChooseDirection(pSprite, pXSprite, nAngle); aiChooseDirection(pSprite, pXSprite, nAngle);
if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) {
{ switch (pSprite->type) {
switch (pSprite->type) case kDudePodGreen:
{ case kDudePodFire:
case 221: aiNewState(pSprite, pXSprite, &podSearch);
case 223: break;
aiNewState(pSprite, pXSprite, &podSearch); case kDudeTentacleGreen:
break; case kDudeTentacleFire:
case 222: aiNewState(pSprite, pXSprite, &tentacleSearch);
case 224: break;
aiNewState(pSprite, pXSprite, &tentacleSearch);
break;
} }
} }
aiThinkTarget(pSprite, pXSprite); aiThinkTarget(pSprite, pXSprite);
@ -201,18 +198,16 @@ static void sub_70380(spritetype *pSprite, XSPRITE *pXSprite)
static void sub_704D8(spritetype *pSprite, XSPRITE *pXSprite) static void sub_704D8(spritetype *pSprite, XSPRITE *pXSprite)
{ {
if (pXSprite->target == -1) if (pXSprite->target == -1) {
{ switch (pSprite->type) {
switch (pSprite->type) case kDudePodGreen:
{ case kDudePodFire:
case 221: aiNewState(pSprite, pXSprite, &pod13A600);
case 223: break;
aiNewState(pSprite, pXSprite, &pod13A600); case kDudeTentacleGreen:
break; case kDudeTentacleFire:
case 222: aiNewState(pSprite, pXSprite, &tentacle13A718);
case 224: break;
aiNewState(pSprite, pXSprite, &tentacle13A718);
break;
} }
return; return;
} }
@ -228,18 +223,17 @@ static void sub_704D8(spritetype *pSprite, XSPRITE *pXSprite)
int dx = pTarget->x-pSprite->x; int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y; int dy = pTarget->y-pSprite->y;
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy)); aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
if (pXTarget->health == 0) if (pXTarget->health == 0) {
{
switch (pSprite->type) switch (pSprite->type) {
{ case kDudePodGreen:
case 221: case kDudePodFire:
case 223: aiNewState(pSprite, pXSprite, &podSearch);
aiNewState(pSprite, pXSprite, &podSearch); break;
break; case kDudeTentacleGreen:
case 222: case kDudeTentacleFire:
case 224: aiNewState(pSprite, pXSprite, &tentacleSearch);
aiNewState(pSprite, pXSprite, &tentacleSearch); break;
break;
} }
return; return;
} }
@ -253,18 +247,16 @@ static void sub_704D8(spritetype *pSprite, XSPRITE *pXSprite)
if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
aiSetTarget(pXSprite, pXSprite->target); aiSetTarget(pXSprite, pXSprite->target);
if (klabs(nDeltaAngle) < 85 && pTarget->type != 221 && pTarget->type != 223) if (klabs(nDeltaAngle) < 85 && pTarget->type != kDudePodGreen && pTarget->type != kDudePodFire) {
{ switch (pSprite->type) {
switch (pSprite->type) case kDudePodGreen:
{ case kDudePodFire:
case 221: aiNewState(pSprite, pXSprite, &pod13A638);
case 223: break;
aiNewState(pSprite, pXSprite, &pod13A638); case kDudeTentacleGreen:
break; case kDudeTentacleFire:
case 222: aiNewState(pSprite, pXSprite, &tentacle13A750);
case 224: break;
aiNewState(pSprite, pXSprite, &tentacle13A750);
break;
} }
} }
return; return;
@ -272,16 +264,15 @@ static void sub_704D8(spritetype *pSprite, XSPRITE *pXSprite)
} }
} }
switch (pSprite->type) switch (pSprite->type) {
{ case kDudePodGreen:
case 221: case kDudePodFire:
case 223: aiNewState(pSprite, pXSprite, &pod13A600);
aiNewState(pSprite, pXSprite, &pod13A600); break;
break; case kDudeTentacleGreen:
case 222: case kDudeTentacleFire:
case 224: aiNewState(pSprite, pXSprite, &tentacle13A718);
aiNewState(pSprite, pXSprite, &tentacle13A718); break;
break;
} }
pXSprite->target = -1; pXSprite->target = -1;
} }

View file

@ -101,48 +101,34 @@ static void SpidBiteSeqCallback(int, int nXSprite)
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); 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];
if (IsPlayerSprite(pTarget)) if (IsPlayerSprite(pTarget)) {
{
int hit = HitScan(pSprite, pSprite->z, dx, dy, 0, CLIPMASK1, 0); int hit = HitScan(pSprite, pSprite->z, dx, dy, 0, CLIPMASK1, 0);
if (hit == 3) if (hit == 3 && IsPlayerSprite(&sprite[gHitInfo.hitsprite])) {
{ dz += pTarget->z - pSprite->z;
if (sprite[gHitInfo.hitsprite].type <= kDudePlayer8 && sprite[gHitInfo.hitsprite].type >= kDudePlayer1) PLAYER *pPlayer = &gPlayer[pTarget->type - kDudePlayer1];
{ switch (pSprite->type) {
dz += pTarget->z-pSprite->z; case kDudeSpiderBrown:
if (pTarget->type >= kDudePlayer1 && pTarget->type <= kDudePlayer8) actFireVector(pSprite, 0, 0, dx, dy, dz, VECTOR_TYPE_17);
{ if (IsPlayerSprite(pTarget) && !pPlayer->at31a && powerupCheck(pPlayer, 14) <= 0 && Chance(0x4000))
PLAYER *pPlayer = &gPlayer[pTarget->type-kDudePlayer1]; powerupActivate(pPlayer, 28);
switch (pSprite->type) break;
{ case kDudeSpiderRed:
case 213: actFireVector(pSprite, 0, 0, dx, dy, dz, VECTOR_TYPE_17);
actFireVector(pSprite, 0, 0, dx, dy, dz, VECTOR_TYPE_17); if (Chance(0x5000)) sub_70D30(pXTarget, 4, 16);
if (IsPlayerSprite(pTarget) && !pPlayer->at31a && powerupCheck(pPlayer, 14) <= 0 break;
&& Chance(0x4000)) case kDudeSpiderBlack:
powerupActivate(pPlayer, 28); actFireVector(pSprite, 0, 0, dx, dy, dz, VECTOR_TYPE_17);
break; sub_70D30(pXTarget, 8, 16);
case 214: break;
actFireVector(pSprite, 0, 0, dx, dy, dz, VECTOR_TYPE_17); case kDudeSpiderMother:
if (Chance(0x5000)) actFireVector(pSprite, 0, 0, dx, dy, dz, VECTOR_TYPE_17);
sub_70D30(pXTarget, 4, 16); actFireVector(pSprite, 0, 0, dx + Random2(2000), dy + Random2(2000), dz + Random2(2000), VECTOR_TYPE_17);
break; sub_70D30(pXTarget, 8, 16);
case 215: break;
actFireVector(pSprite, 0, 0, dx, dy, dz, VECTOR_TYPE_17);
sub_70D30(pXTarget, 8, 16);
break;
case 216:
{
actFireVector(pSprite, 0, 0, dx, dy, dz, VECTOR_TYPE_17);
dx += Random2(2000);
dy += Random2(2000);
dz += Random2(2000);
actFireVector(pSprite, 0, 0, dx, dy, dz, VECTOR_TYPE_17);
sub_70D30(pXTarget, 8, 16);
break;
}
}
}
} }
} }
} }
} }
@ -159,21 +145,16 @@ static void SpidJumpSeqCallback(int, int nXSprite)
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target]; spritetype *pTarget = &sprite[pXSprite->target];
if (IsPlayerSprite(pTarget)) if (IsPlayerSprite(pTarget)) {
{
dz += pTarget->z-pSprite->z; dz += pTarget->z-pSprite->z;
if (pTarget->type >= kDudePlayer1 && pTarget->type <= kDudePlayer8) switch (pSprite->type) {
{ case kDudeSpiderBrown:
switch (pSprite->type) case kDudeSpiderRed:
{ case kDudeSpiderBlack:
case 213:
case 214:
case 215:
xvel[nSprite] = dx << 16; xvel[nSprite] = dx << 16;
yvel[nSprite] = dy << 16; yvel[nSprite] = dy << 16;
zvel[nSprite] = dz << 16; zvel[nSprite] = dz << 16;
break; break;
}
} }
} }
} }
@ -192,22 +173,24 @@ static void sub_71370(int, int nXSprite)
int dy = pXSprite->targetY-pSprite->y; int dy = pXSprite->targetY-pSprite->y;
int nAngle = getangle(dx, dy); int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy); int nDist = approxDist(dx, dy);
spritetype *pSpawn = NULL; spritetype *pSpawn = NULL;
if (IsPlayerSprite(pTarget) && pDudeExtraE->at4 < 10) if (IsPlayerSprite(pTarget) && pDudeExtraE->at4 < 10) {
{
if (nDist < 0x1a00 && nDist > 0x1400 && klabs(pSprite->ang-nAngle) < pDudeInfo->periphery) if (nDist < 0x1a00 && nDist > 0x1400 && klabs(pSprite->ang-nAngle) < pDudeInfo->periphery)
pSpawn = actSpawnDude(pSprite, 214, pSprite->clipdist, 0); pSpawn = actSpawnDude(pSprite, kDudeSpiderRed, pSprite->clipdist, 0);
else if (nDist < 0x1400 && nDist > 0xc00 && klabs(pSprite->ang-nAngle) < pDudeInfo->periphery) else if (nDist < 0x1400 && nDist > 0xc00 && klabs(pSprite->ang-nAngle) < pDudeInfo->periphery)
pSpawn = actSpawnDude(pSprite, 213, pSprite->clipdist, 0); pSpawn = actSpawnDude(pSprite, kDudeSpiderBrown, pSprite->clipdist, 0);
else if (nDist < 0xc00 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) else if (nDist < 0xc00 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery)
pSpawn = actSpawnDude(pSprite, 213, pSprite->clipdist, 0); pSpawn = actSpawnDude(pSprite, kDudeSpiderBrown, pSprite->clipdist, 0);
if (pSpawn)
{ if (pSpawn) {
pDudeExtraE->at4++; pDudeExtraE->at4++;
pSpawn->owner = nSprite; pSpawn->owner = nSprite;
gKillMgr.sub_263E0(1); gKillMgr.sub_263E0(1);
} }
} }
} }
static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite) static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite)
@ -256,35 +239,33 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
return; return;
} }
int nDist = approxDist(dx, dy); int nDist = approxDist(dx, dy);
if (nDist <= pDudeInfo->seeDist) if (nDist <= pDudeInfo->seeDist) {
{
int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024; int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024;
int height = (pDudeInfo->eyeHeight*pSprite->yrepeat)<<2; int height = (pDudeInfo->eyeHeight*pSprite->yrepeat)<<2;
if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum)) if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum)) {
{ if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery) {
if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(pXSprite, pXSprite->target); aiSetTarget(pXSprite, pXSprite->target);
switch (pSprite->type)
{ switch (pSprite->type) {
case 214: case kDudeSpiderRed:
if (nDist < 0x399 && klabs(nDeltaAngle) < 85) if (nDist < 0x399 && klabs(nDeltaAngle) < 85)
aiNewState(pSprite, pXSprite, &spidBite); aiNewState(pSprite, pXSprite, &spidBite);
break; break;
case 213: case kDudeSpiderBrown:
case 215: case kDudeSpiderBlack:
if (nDist < 0x733 && nDist > 0x399 && klabs(nDeltaAngle) < 85) if (nDist < 0x733 && nDist > 0x399 && klabs(nDeltaAngle) < 85)
aiNewState(pSprite, pXSprite, &spidJump); aiNewState(pSprite, pXSprite, &spidJump);
else if (nDist < 0x399 && klabs(nDeltaAngle) < 85) else if (nDist < 0x399 && klabs(nDeltaAngle) < 85)
aiNewState(pSprite, pXSprite, &spidBite); aiNewState(pSprite, pXSprite, &spidBite);
break; break;
case 216: case kDudeSpiderMother:
if (nDist < 0x733 && nDist > 0x399 && klabs(nDeltaAngle) < 85) if (nDist < 0x733 && nDist > 0x399 && klabs(nDeltaAngle) < 85)
aiNewState(pSprite, pXSprite, &spidJump); aiNewState(pSprite, pXSprite, &spidJump);
else if (Chance(0x8000)) else if (Chance(0x8000))
aiNewState(pSprite, pXSprite, &spid13A92C); aiNewState(pSprite, pXSprite, &spid13A92C);
break; break;
} }
return; return;
} }
} }

View file

@ -76,7 +76,7 @@ static void sub_71A90(int, int nXSprite)
int nTarget = pTarget->index; int nTarget = pTarget->index;
int nOwner = actSpriteIdToOwnerId(nSprite); int nOwner = actSpriteIdToOwnerId(nSprite);
if (pXTarget->burnTime == 0) if (pXTarget->burnTime == 0)
evPost(nTarget, 3, 0, CALLBACK_ID_0); evPost(nTarget, 3, 0, kCallbackFXFlameLick);
actBurnSprite(nOwner, pXTarget, 40); actBurnSprite(nOwner, pXTarget, 40);
if (Chance(0x6000)) if (Chance(0x6000))
aiNewState(pSprite, pXSprite, &tcherno13A9D4); aiNewState(pSprite, pXSprite, &tcherno13A9D4);
@ -150,8 +150,8 @@ static void sub_71BD4(int, int nXSprite)
} }
} }
} }
actFireMissile(pSprite, -350, 0, aim.dx, aim.dy, aim.dz, 314); actFireMissile(pSprite, -350, 0, aim.dx, aim.dy, aim.dz, kMissileFireballTchernobog);
actFireMissile(pSprite, 350, 0, aim.dx, aim.dy, aim.dz, 314); actFireMissile(pSprite, 350, 0, aim.dx, aim.dy, aim.dz, kMissileFireballTchernobog);
} }
static void sub_720AC(int, int nXSprite) static void sub_720AC(int, int nXSprite)
@ -226,8 +226,8 @@ static void sub_720AC(int, int nXSprite)
} }
} }
} }
actFireMissile(pSprite, 350, 0, aim.dx, aim.dy, -aim.dz, 314); actFireMissile(pSprite, 350, 0, aim.dx, aim.dy, -aim.dz, kMissileFireballTchernobog);
actFireMissile(pSprite, -350, 0, ax, ay, az, 314); actFireMissile(pSprite, -350, 0, ax, ay, az, kMissileFireballTchernobog);
} }
static void sub_72580(spritetype *pSprite, XSPRITE *pXSprite) static void sub_72580(spritetype *pSprite, XSPRITE *pXSprite)

View file

@ -261,7 +261,7 @@ static void ThrowThing(int nXIndex, bool impact) {
int dist = approxDist(dx, dy); int zThrow = 14500; int dist = approxDist(dx, dy); int zThrow = 14500;
spritetype* pThing = NULL; spritetype* pLeech = NULL; XSPRITE* pXLeech = NULL; spritetype* pThing = NULL; spritetype* pLeech = NULL; XSPRITE* pXLeech = NULL;
if (thingType == kGDXThingCustomDudeLifeLeech) { if (thingType == kModernThingEnemyLifeLeech) {
if ((pLeech = leechIsDropped(pSprite)) != NULL) { if ((pLeech = leechIsDropped(pSprite)) != NULL) {
// pickup life leech before throw it again // pickup life leech before throw it again
pXLeech = &xsprite[pLeech->extra]; pXLeech = &xsprite[pLeech->extra];
@ -274,17 +274,17 @@ static void ThrowThing(int nXIndex, bool impact) {
pThing = actFireThing(pSprite, 0, 0, (dz / 128) - zThrow, thingType, divscale(dist / 540, 120, 23)); pThing = actFireThing(pSprite, 0, 0, (dz / 128) - zThrow, thingType, divscale(dist / 540, 120, 23));
if (pThing == NULL) return; if (pThing == NULL) return;
if (pThinkInfo->at11 < 0 && pThing->type != kGDXThingThrowableRock) pThing->picnum = 0; if (pThinkInfo->at11 < 0 && pThing->type != kModernThingThrowableRock) pThing->picnum = 0;
pThing->owner = pSprite->xvel; pThing->owner = pSprite->xvel;
switch (thingType) { switch (thingType) {
case 428: case kThingNapalmBall:
impact = true; impact = true;
pThing->xrepeat = 24; pThing->xrepeat = 24;
pThing->yrepeat = 24; pThing->yrepeat = 24;
xsprite[pThing->extra].data4 = 3 + gGameOptions.nDifficulty; xsprite[pThing->extra].data4 = 3 + gGameOptions.nDifficulty;
break; break;
case kGDXThingThrowableRock: case kModernThingThrowableRock:
int sPics[6]; int sPics[6];
sPics[0] = 2406; sPics[1] = 2280; sPics[0] = 2406; sPics[1] = 2280;
sPics[2] = 2185; sPics[3] = 2155; sPics[2] = 2185; sPics[3] = 2155;
@ -306,17 +306,17 @@ static void ThrowThing(int nXIndex, bool impact) {
impact = false; impact = false;
return; return;
case 400: case kThingTNTBarrel:
case 401: case kThingArmedProxBomb:
case 420: case kThingArmedSpray:
impact = false; impact = false;
break; break;
case kGDXThingTNTProx: case kModernThingTNTProx:
xsprite[pThing->extra].state = 0; xsprite[pThing->extra].state = 0;
xsprite[pThing->extra].Proximity = true; xsprite[pThing->extra].Proximity = true;
return; return;
case 431: case kThingDroppedLifeLeech:
case kGDXThingCustomDudeLifeLeech: case kModernThingEnemyLifeLeech:
XSPRITE* pXThing = &xsprite[pThing->extra]; XSPRITE* pXThing = &xsprite[pThing->extra];
if (pLeech != NULL) pXThing->health = pXLeech->health; if (pLeech != NULL) pXThing->health = pXLeech->health;
else pXThing->health = 300 * gGameOptions.nDifficulty; else pXThing->health = 300 * gGameOptions.nDifficulty;
@ -329,14 +329,14 @@ static void ThrowThing(int nXIndex, bool impact) {
pXThing->target = pTarget->xvel; pXThing->target = pTarget->xvel;
pXThing->Proximity = true; pXThing->Proximity = true;
pXThing->stateTimer = 1; pXThing->stateTimer = 1;
evPost(pThing->xvel, 3, 80, CALLBACK_ID_20); evPost(pThing->xvel, 3, 80, kCallbackLeechStateTimer);
return; return;
} }
if (impact == true && dist <= 7680) xsprite[pThing->extra].Impact = true; if (impact == true && dist <= 7680) xsprite[pThing->extra].Impact = true;
else { else {
xsprite[pThing->extra].Impact = false; xsprite[pThing->extra].Impact = false;
evPost(pThing->xvel, 3, 120 * Random(2) + 120, COMMAND_ID_1); evPost(pThing->xvel, 3, 120 * Random(2) + 120, kCmdOn);
} }
return; return;
} }
@ -442,12 +442,12 @@ static void thinkChase( spritetype* pSprite, XSPRITE* pXSprite )
spritetype* pLeech = NULL; VECTORDATA* meleeVector = &gVectorData[22]; spritetype* pLeech = NULL; VECTORDATA* meleeVector = &gVectorData[22];
if (pXSprite->data1 >= kThingBase && pXSprite->data1 < kThingMax) { if (pXSprite->data1 >= kThingBase && pXSprite->data1 < kThingMax) {
if (pXSprite->data1 == 431) pXSprite->data1 = kGDXThingCustomDudeLifeLeech; if (pXSprite->data1 == kThingDroppedLifeLeech) pXSprite->data1 = kModernThingEnemyLifeLeech;
if ((pLeech = leechIsDropped(pSprite)) != NULL && xsprite[pLeech->extra].target != pXSprite->target) if ((pLeech = leechIsDropped(pSprite)) != NULL && xsprite[pLeech->extra].target != pXSprite->target)
xsprite[pLeech->extra].target = pXSprite->target; xsprite[pLeech->extra].target = pXSprite->target;
if (klabs(losAngle) < kAng15) { if (klabs(losAngle) < kAng15) {
if (dist < 12264 && dist > 7680 && !spriteIsUnderwater(pSprite, false) && pXSprite->data1 != kGDXThingCustomDudeLifeLeech) { if (dist < 12264 && dist > 7680 && !spriteIsUnderwater(pSprite, false) && pXSprite->data1 != kModernThingEnemyLifeLeech) {
int pHit = HitScan(pSprite, pSprite->z, dx, dy, 0, 16777280, 0); int pHit = HitScan(pSprite, pSprite->z, dx, dy, 0, 16777280, 0);
switch (pHit) { switch (pHit) {
case 0: case 0:
@ -461,7 +461,7 @@ static void thinkChase( spritetype* pSprite, XSPRITE* pXSprite )
} }
else if (dist > 4072 && dist <= 9072 && !spriteIsUnderwater(pSprite, false) && pSprite->owner != (kMaxSprites - 1)) { else if (dist > 4072 && dist <= 9072 && !spriteIsUnderwater(pSprite, false) && pSprite->owner != (kMaxSprites - 1)) {
switch (pXSprite->data1) { switch (pXSprite->data1) {
case kGDXThingCustomDudeLifeLeech: case kModernThingEnemyLifeLeech:
{ {
if (pLeech == NULL) { if (pLeech == NULL) {
aiNewState(pSprite, pXSprite, &GDXGenDudeThrow2); aiNewState(pSprite, pXSprite, &GDXGenDudeThrow2);
@ -492,7 +492,7 @@ static void thinkChase( spritetype* pSprite, XSPRITE* pXSprite )
} }
} }
return; return;
case kGDXThingThrowableRock: case kModernThingThrowableRock:
if (Chance(0x4000)) aiNewState(pSprite, pXSprite, &GDXGenDudeThrow2); if (Chance(0x4000)) aiNewState(pSprite, pXSprite, &GDXGenDudeThrow2);
else sfxPlayGDXGenDudeSound(pSprite, 0); else sfxPlayGDXGenDudeSound(pSprite, 0);
return; return;
@ -577,17 +577,17 @@ static void thinkChase( spritetype* pSprite, XSPRITE* pXSprite )
else if (pXSprite->data1 >= kMissileBase && pXSprite->data1 < kMissileMax) { else if (pXSprite->data1 >= kMissileBase && pXSprite->data1 < kMissileMax) {
// special handling for flame, explosive and life leech missiles // special handling for flame, explosive and life leech missiles
int state = checkAttackState(pSprite, pXSprite); int state = checkAttackState(pSprite, pXSprite);
int mdist = (pXSprite->data1 != 303) ? 3000 : 2500; int mdist = (pXSprite->data1 != kMissileFlareAlt) ? 3000 : 2500;
switch (pXSprite->data1) { switch (pXSprite->data1) {
case 315: case 315:
// pickup life leech if it was thrown previously // pickup life leech if it was thrown previously
if ((pLeech = leechIsDropped(pSprite)) != NULL) removeLeech(pLeech); if ((pLeech = leechIsDropped(pSprite)) != NULL) removeLeech(pLeech);
break; break;
case 303: case kMissileFlareAlt:
case 305: case kMissileFireball:
case 312: case kMissileFireballNapam:
case 313: case kMissileFireballCerberus:
case 314: case kMissileFireballTchernobog:
if (dist > mdist || pXSprite->locked == 1) break; if (dist > mdist || pXSprite->locked == 1) break;
else if (dist <= meleeVector->maxDist && Chance(0x9000)) else if (dist <= meleeVector->maxDist && Chance(0x9000))
aiNewState(pSprite, pXSprite, &GDXGenDudePunch); aiNewState(pSprite, pXSprite, &GDXGenDudePunch);
@ -597,8 +597,8 @@ static void thinkChase( spritetype* pSprite, XSPRITE* pXSprite )
return; return;
case 304: case kMissileFlameSpray:
case 308: case kMissileFlameHound:
if (spriteIsUnderwater(pSprite, false)) { if (spriteIsUnderwater(pSprite, false)) {
if (dist > meleeVector->maxDist) aiNewState(pSprite, pXSprite, &GDXGenDudeChaseW); if (dist > meleeVector->maxDist) aiNewState(pSprite, pXSprite, &GDXGenDudeChaseW);
else if (Chance(0x8000)) aiNewState(pSprite, pXSprite, &GDXGenDudePunch); else if (Chance(0x8000)) aiNewState(pSprite, pXSprite, &GDXGenDudePunch);
@ -611,9 +611,9 @@ static void thinkChase( spritetype* pSprite, XSPRITE* pXSprite )
} }
} }
else if (pXSprite->data1 >= 459 && pXSprite->data1 < (459 + kExplodeMax) - 1) { else if (pXSprite->data1 >= kTrapExploder && pXSprite->data1 < (kTrapExploder + kExplodeMax) - 1) {
int nType = pXSprite->data1 - 459; EXPLOSION* pExpl = &explodeInfo[nType]; int nType = pXSprite->data1 - kTrapExploder; EXPLOSION* pExpl = &explodeInfo[nType];
if (pExpl != NULL && CheckProximity(pSprite, pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pExpl->radius / 2) if (pExpl != NULL && CheckProximity(pSprite, pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pExpl->radius / 2)
&& doExplosion(pSprite, nType)) { && doExplosion(pSprite, nType)) {
@ -843,7 +843,7 @@ bool spriteIsUnderwater(spritetype* pSprite,bool oldWay) {
spritetype* leechIsDropped(spritetype* pSprite) { spritetype* leechIsDropped(spritetype* pSprite) {
for (int nSprite = headspritestat[kStatThing]; nSprite >= 0; nSprite = nextspritestat[nSprite]) { for (int nSprite = headspritestat[kStatThing]; nSprite >= 0; nSprite = nextspritestat[nSprite]) {
if (sprite[nSprite].type == kGDXThingCustomDudeLifeLeech && sprite[nSprite].owner == pSprite->xvel) if (sprite[nSprite].type == kModernThingEnemyLifeLeech && sprite[nSprite].owner == pSprite->xvel)
return &sprite[nSprite]; return &sprite[nSprite];
} }
@ -855,15 +855,15 @@ void removeDudeStuff(spritetype* pSprite) {
for (short nSprite = headspritestat[kStatThing]; nSprite >= 0; nSprite = nextspritestat[nSprite]) { for (short nSprite = headspritestat[kStatThing]; nSprite >= 0; nSprite = nextspritestat[nSprite]) {
if (sprite[nSprite].owner != pSprite->xvel) continue; if (sprite[nSprite].owner != pSprite->xvel) continue;
switch (sprite[nSprite].type) { switch (sprite[nSprite].type) {
case 401: case kThingArmedProxBomb:
case 402: case kThingArmedRemoteBomb:
case 433: case kModernThingTNTProx:
sprite[nSprite].type = 0; sprite[nSprite].type = 0;
actPostSprite(sprite[nSprite].xvel, kStatFree); actPostSprite(sprite[nSprite].xvel, kStatFree);
break; break;
case kGDXThingCustomDudeLifeLeech: case kModernThingEnemyLifeLeech:
killDudeLeech(&sprite[nSprite]); killDudeLeech(&sprite[nSprite]);
break; break;
} }
} }
@ -926,12 +926,12 @@ bool dudeIsMelee(XSPRITE* pXSprite) {
} else { } else {
if (pXSprite->data1 >= 459 && pXSprite->data1 < (459 + kExplodeMax) - 1) if (pXSprite->data1 >= kTrapExploder && pXSprite->data1 < (kTrapExploder + kExplodeMax) - 1)
return true; return true;
/*switch (pXSprite->data1) { /*switch (pXSprite->data1) {
case 304: case kMissileFlameSpray:
case 308: case kMissileFlameHound:
return true; return true;
default: default:
return false; return false;
@ -975,9 +975,9 @@ int getDodgeChance(spritetype* pSprite) {
return chance; return chance;
} }
void dudeLeechOperate(spritetype* pSprite, XSPRITE* pXSprite, EVENT a3) void dudeLeechOperate(spritetype* pSprite, XSPRITE* pXSprite, EVENT event)
{ {
if (a3.cmd == COMMAND_ID_0) { if (event.cmd == kCmdOff) {
actPostSprite(pSprite->xvel, kStatFree); actPostSprite(pSprite->xvel, kStatFree);
return; return;
} }
@ -1006,7 +1006,7 @@ void dudeLeechOperate(spritetype* pSprite, XSPRITE* pXSprite, EVENT a3)
int dy = Sin(pSprite->ang) >> 16; int dy = Sin(pSprite->ang) >> 16;
int tz = pTarget->z - (pTarget->yrepeat * pDudeInfo->aimHeight) * 4; int tz = pTarget->z - (pTarget->yrepeat * pDudeInfo->aimHeight) * 4;
int dz = divscale(tz - top - 256, nDist, 10); int dz = divscale(tz - top - 256, nDist, 10);
int nMissileType = 316 + (pXSprite->data3 ? 1 : 0); int nMissileType = kMissileLifeLeechAltNormal + (pXSprite->data3 ? 1 : 0);
int t2; int t2;
if (!pXSprite->data3) t2 = 120 / 10.0; if (!pXSprite->data3) t2 = 120 / 10.0;
@ -1017,7 +1017,7 @@ void dudeLeechOperate(spritetype* pSprite, XSPRITE* pXSprite, EVENT a3)
{ {
pMissile->owner = pSprite->owner; pMissile->owner = pSprite->owner;
pXSprite->stateTimer = 1; pXSprite->stateTimer = 1;
evPost(pSprite->index, 3, t2, CALLBACK_ID_20); evPost(pSprite->index, 3, t2, kCallbackLeechStateTimer);
pXSprite->data3 = ClipLow(pXSprite->data3 - 1, 0); pXSprite->data3 = ClipLow(pXSprite->data3 - 1, 0);
} }
pSprite->ang = angBak; pSprite->ang = angBak;

View file

@ -269,7 +269,7 @@ static void myThinkSearch(spritetype *pSprite, XSPRITE *pXSprite)
static void entryEZombie(spritetype *pSprite, XSPRITE *pXSprite) static void entryEZombie(spritetype *pSprite, XSPRITE *pXSprite)
{ {
UNREFERENCED_PARAMETER(pXSprite); UNREFERENCED_PARAMETER(pXSprite);
pSprite->type = 203; pSprite->type = kDudeZombieAxeNormal;
pSprite->flags |= 1; pSprite->flags |= 1;
} }

View file

@ -75,7 +75,7 @@ static void HackSeqCallback(int, int nXSprite)
if (nXSprite < 0 || nXSprite >= kMaxSprites) if (nXSprite < 0 || nXSprite >= kMaxSprites)
return; return;
spritetype *pSprite = &sprite[nSprite]; spritetype *pSprite = &sprite[nSprite];
if (pSprite->type != 204) if (pSprite->type != kDudeZombieButcher)
return; return;
spritetype *pTarget = &sprite[pXSprite->target]; spritetype *pTarget = &sprite[pXSprite->target];
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
@ -102,7 +102,7 @@ static void PukeSeqCallback(int, int nXSprite)
int dx = Cos(nAngle)>>16; int dx = Cos(nAngle)>>16;
int dy = Sin(nAngle)>>16; int dy = Sin(nAngle)>>16;
sfxPlay3DSound(pSprite, 1203, 1, 0); sfxPlay3DSound(pSprite, 1203, 1, 0);
actFireMissile(pSprite, 0, -(height-height2), dx, dy, 0, 309); actFireMissile(pSprite, 0, -(height-height2), dx, dy, 0, kMissilePukeGreen);
} }
static void ThrowSeqCallback(int, int nXSprite) static void ThrowSeqCallback(int, int nXSprite)
@ -110,7 +110,7 @@ static void ThrowSeqCallback(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];
actFireMissile(pSprite, 0, -dudeInfo[pSprite->type-kDudeBase].eyeHeight, Cos(pSprite->ang)>>16, Sin(pSprite->ang)>>16, 0, 300); actFireMissile(pSprite, 0, -dudeInfo[pSprite->type-kDudeBase].eyeHeight, Cos(pSprite->ang)>>16, Sin(pSprite->ang)>>16, 0, kMissileButcherKnife);
} }
static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite) static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite)

View file

@ -222,10 +222,10 @@ void PrecacheDude(spritetype *pSprite)
seqPrecacheId(pDudeInfo->seqStartID+2); seqPrecacheId(pDudeInfo->seqStartID+2);
switch (pSprite->type) switch (pSprite->type)
{ {
case 201: case kDudeCultistTommy:
case 202: case kDudeCultistShotgun:
case 247: case kDudeCultistTesla:
case 248: case kDudeCultistTNT:
seqPrecacheId(pDudeInfo->seqStartID+6); seqPrecacheId(pDudeInfo->seqStartID+6);
seqPrecacheId(pDudeInfo->seqStartID+7); seqPrecacheId(pDudeInfo->seqStartID+7);
seqPrecacheId(pDudeInfo->seqStartID+8); seqPrecacheId(pDudeInfo->seqStartID+8);
@ -234,8 +234,8 @@ void PrecacheDude(spritetype *pSprite)
seqPrecacheId(pDudeInfo->seqStartID+14); seqPrecacheId(pDudeInfo->seqStartID+14);
seqPrecacheId(pDudeInfo->seqStartID+15); seqPrecacheId(pDudeInfo->seqStartID+15);
break; break;
case 204: case kDudeZombieButcher:
case 217: case kDudeGillBeast:
seqPrecacheId(pDudeInfo->seqStartID+6); seqPrecacheId(pDudeInfo->seqStartID+6);
seqPrecacheId(pDudeInfo->seqStartID+7); seqPrecacheId(pDudeInfo->seqStartID+7);
seqPrecacheId(pDudeInfo->seqStartID+8); seqPrecacheId(pDudeInfo->seqStartID+8);
@ -243,51 +243,51 @@ void PrecacheDude(spritetype *pSprite)
seqPrecacheId(pDudeInfo->seqStartID+10); seqPrecacheId(pDudeInfo->seqStartID+10);
seqPrecacheId(pDudeInfo->seqStartID+11); seqPrecacheId(pDudeInfo->seqStartID+11);
break; break;
case 208: case kDudeGargoyleStatueFlesh:
case 209: case kDudeGargoyleStatueStone:
seqPrecacheId(pDudeInfo->seqStartID+6); seqPrecacheId(pDudeInfo->seqStartID+6);
seqPrecacheId(pDudeInfo->seqStartID+6); seqPrecacheId(pDudeInfo->seqStartID+6);
fallthrough__; fallthrough__;
case 206: case kDudeGargoyleFlesh:
case 207: case kDudeGargoyleStone:
seqPrecacheId(pDudeInfo->seqStartID+6); seqPrecacheId(pDudeInfo->seqStartID+6);
seqPrecacheId(pDudeInfo->seqStartID+7); seqPrecacheId(pDudeInfo->seqStartID+7);
seqPrecacheId(pDudeInfo->seqStartID+8); seqPrecacheId(pDudeInfo->seqStartID+8);
seqPrecacheId(pDudeInfo->seqStartID+9); seqPrecacheId(pDudeInfo->seqStartID+9);
break; break;
case 210: case kDudePhantasm:
case 211: case kDudeHellHound:
case 213: case kDudeSpiderBrown:
case 214: case kDudeSpiderRed:
case 215: case kDudeSpiderBlack:
case 216: case kDudeSpiderMother:
case 229: case kDudeTchernobog:
seqPrecacheId(pDudeInfo->seqStartID+6); seqPrecacheId(pDudeInfo->seqStartID+6);
seqPrecacheId(pDudeInfo->seqStartID+7); seqPrecacheId(pDudeInfo->seqStartID+7);
seqPrecacheId(pDudeInfo->seqStartID+8); seqPrecacheId(pDudeInfo->seqStartID+8);
break; break;
case 227: case kDudeCerberusTwoHead:
seqPrecacheId(pDudeInfo->seqStartID+6); seqPrecacheId(pDudeInfo->seqStartID+6);
seqPrecacheId(pDudeInfo->seqStartID+7); seqPrecacheId(pDudeInfo->seqStartID+7);
fallthrough__; fallthrough__;
case 212: case kDudeHand:
case 218: case kDudeBoneEel:
case 219: case kDudeBat:
case 220: case kDudeRat:
seqPrecacheId(pDudeInfo->seqStartID+6); seqPrecacheId(pDudeInfo->seqStartID+6);
seqPrecacheId(pDudeInfo->seqStartID+7); seqPrecacheId(pDudeInfo->seqStartID+7);
break; break;
case 249: case kDudeCultistBeast:
seqPrecacheId(pDudeInfo->seqStartID+6); seqPrecacheId(pDudeInfo->seqStartID+6);
break; break;
case 205: case kDudeZombieAxeBuried:
seqPrecacheId(pDudeInfo->seqStartID+12); seqPrecacheId(pDudeInfo->seqStartID+12);
seqPrecacheId(pDudeInfo->seqStartID+9); seqPrecacheId(pDudeInfo->seqStartID+9);
fallthrough__; fallthrough__;
case 244: case kDudeZombieAxeLaying:
seqPrecacheId(pDudeInfo->seqStartID+10); seqPrecacheId(pDudeInfo->seqStartID+10);
fallthrough__; fallthrough__;
case 203: case kDudeZombieAxeNormal:
seqPrecacheId(pDudeInfo->seqStartID+6); seqPrecacheId(pDudeInfo->seqStartID+6);
seqPrecacheId(pDudeInfo->seqStartID+7); seqPrecacheId(pDudeInfo->seqStartID+7);
seqPrecacheId(pDudeInfo->seqStartID+8); seqPrecacheId(pDudeInfo->seqStartID+8);
@ -298,34 +298,33 @@ void PrecacheDude(spritetype *pSprite)
} }
} }
void PrecacheThing(spritetype *pSprite) void PrecacheThing(spritetype *pSprite) {
{ switch (pSprite->type) {
switch (pSprite->type) case kThingGlassWindow: // worthless...
{ case kThingFluorescent:
case 406: seqPrecacheId(12);
case 407: break;
seqPrecacheId(12); case kThingSpiderWeb:
break; seqPrecacheId(15);
case 410: break;
seqPrecacheId(15); case kThingMetalGrate:
break; seqPrecacheId(21);
case 411: break;
seqPrecacheId(21); case kThingFlammableTree:
break; seqPrecacheId(25);
case 412: seqPrecacheId(26);
seqPrecacheId(25); break;
seqPrecacheId(26); case kTrapMachinegun:
break; seqPrecacheId(38);
case 413: seqPrecacheId(40);
seqPrecacheId(38); seqPrecacheId(28);
seqPrecacheId(40); break;
seqPrecacheId(28); case kThingObjectGib:
break; //case kThingObjectExplode: weird that only gib object is precached and this one is not
case 416: break;
break; default:
default: tilePreloadTile(pSprite->picnum);
tilePreloadTile(pSprite->picnum); break;
break;
} }
seqPrecacheId(3); seqPrecacheId(3);
seqPrecacheId(4); seqPrecacheId(4);
@ -611,8 +610,8 @@ void StartLevel(GAMEOPTIONS *gameOptions)
for (int i = 0; i < kMaxSprites; i++) for (int i = 0; i < kMaxSprites; i++)
{ {
spritetype *pSprite = &sprite[i]; spritetype *pSprite = &sprite[i];
if (pSprite->statnum < kMaxStatus && pSprite->extra > 0) if (pSprite->statnum < kMaxStatus && pSprite->extra > 0) {
{
XSPRITE *pXSprite = &xsprite[pSprite->extra]; XSPRITE *pXSprite = &xsprite[pSprite->extra];
if ((pXSprite->lSkill & (1 << gameOptions->nDifficulty)) || (pXSprite->lS && gameOptions->nGameType == 0) if ((pXSprite->lSkill & (1 << gameOptions->nDifficulty)) || (pXSprite->lS && gameOptions->nGameType == 0)
|| (pXSprite->lB && gameOptions->nGameType == 2) || (pXSprite->lT && gameOptions->nGameType == 3) || (pXSprite->lB && gameOptions->nGameType == 2) || (pXSprite->lT && gameOptions->nGameType == 3)
@ -621,12 +620,81 @@ void StartLevel(GAMEOPTIONS *gameOptions)
DeleteSprite(i); DeleteSprite(i);
continue; continue;
} }
if (gModernMap) {
switch (pSprite->type) {
// add statnum for faster dude searching
case kModernDudeTargetChanger:
changespritestat(i, kStatModernDudeTargetChanger);
break;
// remove kStatItem status from random item generators
case kModernRandom:
case kModernRandom2:
changespritestat(i, kStatDecoration);
break;
}
} else {
switch (pSprite->type) {
// erase all modern types if the map is not extended
case kModernCustomDudeSpawn:
case kModernRandomTX:
case kModernSequentialTX:
case kModernSeqSpawner:
case kModernObjPropertiesChanger:
case kModernObjPicnumChanger:
case kModernObjSizeChanger:
case kModernDudeTargetChanger:
case kModernSectorFXChanger:
case kModernObjDataChanger:
case kModernSpriteDamager:
case kModernObjDataAccumulator:
case kModernEffectSpawner:
case kModernWindGenerator:
pSprite->type = kSpriteDecoration;
break;
case kItemModernMapLevel:
case kDudeModernCustom:
case kDudeModernCustomBurning:
case kModernThingTNTProx:
case kModernThingEnemyLifeLeech:
pSprite->type = kSpriteDecoration;
changespritestat(pSprite->index, kStatDecoration);
break;
case kModernConcussSprite:
pSprite->type = kSpriteDecoration;
changespritestat(pSprite->index, kStatDecoration);
break;
// also erase some modernized vanilla types which was not active
case kMarkerWarpDest:
if (pSprite->statnum != kStatMarker) pSprite->type = kSpriteDecoration;
break;
}
if (pXSprite->Sight)
pXSprite->Sight = false; // it does not work in vanilla at all
if (pXSprite->Proximity) {
// proximity works only for things and dudes in vanilla
switch (pSprite->statnum) {
case kStatThing:
case kStatDude:
break;
default:
pXSprite->Proximity = false;
break;
}
}
}
} }
} }
scrLoadPLUs(); scrLoadPLUs();
startpos.z = getflorzofslope(startsectnum,startpos.x,startpos.y); startpos.z = getflorzofslope(startsectnum,startpos.x,startpos.y);
for (int i = 0; i < kMaxPlayers; i++) for (int i = 0; i < kMaxPlayers; i++) {
{
gStartZone[i].x = startpos.x; gStartZone[i].x = startpos.x;
gStartZone[i].y = startpos.y; gStartZone[i].y = startpos.y;
gStartZone[i].z = startpos.z; gStartZone[i].z = startpos.z;
@ -634,7 +702,7 @@ void StartLevel(GAMEOPTIONS *gameOptions)
gStartZone[i].ang = startang; gStartZone[i].ang = startang;
// By NoOne: Create spawn zones for players in teams mode. // By NoOne: Create spawn zones for players in teams mode.
if (i <= kMaxPlayers / 2) { if (gModernMap && i <= kMaxPlayers / 2) {
gStartZoneTeam1[i].x = startpos.x; gStartZoneTeam1[i].x = startpos.x;
gStartZoneTeam1[i].y = startpos.y; gStartZoneTeam1[i].y = startpos.y;
gStartZoneTeam1[i].z = startpos.z; gStartZoneTeam1[i].z = startpos.z;

View file

@ -48,99 +48,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS BEGIN_BLD_NS
void makeMissileBlocking(int nSprite) // 23
{
dassert(nSprite >= 0 && nSprite < kMaxSprites);
if (sprite[nSprite].statnum != kStatProjectile) return;
sprite[nSprite].cstat |= CSTAT_SPRITE_BLOCK;
}
void UniMissileBurst(int nSprite) // 22 void fxFlameLick(int nSprite) // 0
{
dassert(nSprite >= 0 && nSprite < kMaxSprites);
if (sprite[nSprite].statnum != kStatProjectile) return;
spritetype * pSprite = &sprite[nSprite];
int nAngle = getangle(xvel[nSprite], yvel[nSprite]);
int nRadius = 0x55555;
for (int i = 0; i < 8; i++)
{
spritetype* pBurst = actSpawnSprite(pSprite, 5);
pBurst->type = pSprite->type;
pBurst->shade = pSprite->shade;
pBurst->picnum = pSprite->picnum;
pBurst->cstat = pSprite->cstat;
if ((pBurst->cstat & CSTAT_SPRITE_BLOCK)) {
pBurst->cstat &= ~CSTAT_SPRITE_BLOCK; // we don't want missiles impact each other
evPost(pBurst->xvel, 3, 100, CALLBACK_ID_23); // so set blocking flag a bit later
}
pBurst->pal = pSprite->pal;
pBurst->clipdist = pSprite->clipdist / 4;
pBurst->flags = pSprite->flags;
pBurst->xrepeat = pSprite->xrepeat / 2;
pBurst->yrepeat = pSprite->yrepeat / 2;
pBurst->ang = ((pSprite->ang + missileInfo[pSprite->type - kMissileBase].at6) & 2047);
pBurst->owner = pSprite->owner;
actBuildMissile(pBurst, pBurst->extra, pSprite->xvel);
int nAngle2 = (i << 11) / 8;
int dx = 0;
int dy = mulscale30r(nRadius, Sin(nAngle2));
int dz = mulscale30r(nRadius, -Cos(nAngle2));
if (i & 1)
{
dy >>= 1;
dz >>= 1;
}
RotateVector(&dx, &dy, nAngle);
xvel[pBurst->index] += dx;
yvel[pBurst->index] += dy;
zvel[pBurst->index] += dz;
evPost(pBurst->index, 3, 960, CALLBACK_ID_1);
}
evPost(nSprite, 3, 0, CALLBACK_ID_1);
}
void sub_74C20(int nSprite) // 7
{
spritetype *pSprite = &sprite[nSprite];
spritetype *pFX = gFX.fxSpawn(FX_15, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
if (pFX)
{
xvel[pFX->index] = xvel[nSprite] + Random2(0x10000);
yvel[pFX->index] = yvel[nSprite] + Random2(0x10000);
zvel[pFX->index] = zvel[nSprite] - Random(0x1aaaa);
}
evPost(nSprite, 3, 3, CALLBACK_ID_7);
}
void sub_74D04(int nSprite) // 15
{
spritetype *pSprite = &sprite[nSprite];
spritetype *pFX = gFX.fxSpawn(FX_49, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
if (pFX)
{
xvel[pFX->index] = xvel[nSprite] + Random2(0x1aaaa);
yvel[pFX->index] = yvel[nSprite] + Random2(0x1aaaa);
zvel[pFX->index] = zvel[nSprite] - Random(0x1aaaa);
}
evPost(nSprite, 3, 3, CALLBACK_ID_15);
}
void FinishHim(int nSprite) // 13
{
spritetype *pSprite = &sprite[nSprite];
int nXSprite = pSprite->extra;
XSPRITE *pXSprite = &xsprite[nXSprite];
if (playerSeqPlaying(&gPlayer[pSprite->type-kDudePlayer1], 16) && pXSprite->target == gMe->at5b)
sndStartSample(3313, -1, 1, 0);
}
void FlameLick(int nSprite) // 0
{ {
spritetype *pSprite = &sprite[nSprite]; spritetype *pSprite = &sprite[nSprite];
int nXSprite = pSprite->extra; int nXSprite = pSprite->extra;
@ -165,7 +74,7 @@ void FlameLick(int nSprite) // 0
} }
} }
if (pXSprite->burnTime > 0) if (pXSprite->burnTime > 0)
evPost(nSprite, 3, 5, CALLBACK_ID_0); evPost(nSprite, 3, 5, kCallbackFXFlameLick);
} }
void Remove(int nSprite) // 1 void Remove(int nSprite) // 1
@ -190,7 +99,7 @@ void FlareBurst(int nSprite) // 2
pSpawn->picnum = 2424; pSpawn->picnum = 2424;
pSpawn->shade = -128; pSpawn->shade = -128;
pSpawn->xrepeat = pSpawn->yrepeat = 32; pSpawn->xrepeat = pSpawn->yrepeat = 32;
pSpawn->type = 303; pSpawn->type = kMissileFlareAlt;
pSpawn->clipdist = 2; pSpawn->clipdist = 2;
pSpawn->owner = pSprite->owner; pSpawn->owner = pSprite->owner;
int nAngle2 = (i<<11)/8; int nAngle2 = (i<<11)/8;
@ -206,12 +115,12 @@ void FlareBurst(int nSprite) // 2
xvel[pSpawn->index] += dx; xvel[pSpawn->index] += dx;
yvel[pSpawn->index] += dy; yvel[pSpawn->index] += dy;
zvel[pSpawn->index] += dz; zvel[pSpawn->index] += dz;
evPost(pSpawn->index, 3, 960, CALLBACK_ID_1); evPost(pSpawn->index, 3, 960, kCallbackRemove);
} }
evPost(nSprite, 3, 0, CALLBACK_ID_1); evPost(nSprite, 3, 0, kCallbackRemove);
} }
void FlareSpark(int nSprite) // 3 void fxFlareSpark(int nSprite) // 3
{ {
spritetype *pSprite = &sprite[nSprite]; spritetype *pSprite = &sprite[nSprite];
spritetype *pFX = gFX.fxSpawn(FX_28, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); spritetype *pFX = gFX.fxSpawn(FX_28, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
@ -221,10 +130,10 @@ void FlareSpark(int nSprite) // 3
yvel[pFX->index] = yvel[nSprite] + Random2(0x1aaaa); yvel[pFX->index] = yvel[nSprite] + Random2(0x1aaaa);
zvel[pFX->index] = zvel[nSprite] - Random(0x1aaaa); zvel[pFX->index] = zvel[nSprite] - Random(0x1aaaa);
} }
evPost(nSprite, 3, 4, CALLBACK_ID_3); evPost(nSprite, 3, 4, kCallbackFXFlareSpark);
} }
void FlareSparkLite(int nSprite) // 4 void fxFlareSparkLite(int nSprite) // 4
{ {
spritetype *pSprite = &sprite[nSprite]; spritetype *pSprite = &sprite[nSprite];
spritetype *pFX = gFX.fxSpawn(FX_28, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); spritetype *pFX = gFX.fxSpawn(FX_28, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
@ -234,10 +143,10 @@ void FlareSparkLite(int nSprite) // 4
yvel[pFX->index] = yvel[nSprite] + Random2(0x1aaaa); yvel[pFX->index] = yvel[nSprite] + Random2(0x1aaaa);
zvel[pFX->index] = zvel[nSprite] - Random(0x1aaaa); zvel[pFX->index] = zvel[nSprite] - Random(0x1aaaa);
} }
evPost(nSprite, 3, 12, CALLBACK_ID_4); evPost(nSprite, 3, 12, kCallbackFXFlareSparkLite);
} }
void ZombieSpurt(int nSprite) // 5 void fxZombieBloodSpurt(int nSprite) // 5
{ {
dassert(nSprite >= 0 && nSprite < kMaxSprites); dassert(nSprite >= 0 && nSprite < kMaxSprites);
spritetype *pSprite = &sprite[nSprite]; spritetype *pSprite = &sprite[nSprite];
@ -255,18 +164,18 @@ void ZombieSpurt(int nSprite) // 5
} }
if (pXSprite->data1 > 0) if (pXSprite->data1 > 0)
{ {
evPost(nSprite, 3, 4, CALLBACK_ID_5); evPost(nSprite, 3, 4, kCallbackFXZombieSpurt);
pXSprite->data1 -= 4; pXSprite->data1 -= 4;
} }
else if (pXSprite->data2 > 0) else if (pXSprite->data2 > 0)
{ {
evPost(nSprite, 3, 60, CALLBACK_ID_5); evPost(nSprite, 3, 60, kCallbackFXZombieSpurt);
pXSprite->data1 = 40; pXSprite->data1 = 40;
pXSprite->data2--; pXSprite->data2--;
} }
} }
void BloodSpurt(int nSprite) // 6 void fxBloodSpurt(int nSprite) // 6
{ {
spritetype *pSprite = &sprite[nSprite]; spritetype *pSprite = &sprite[nSprite];
spritetype *pFX = gFX.fxSpawn(FX_27, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); spritetype *pFX = gFX.fxSpawn(FX_27, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
@ -277,10 +186,25 @@ void BloodSpurt(int nSprite) // 6
yvel[pFX->index] = yvel[nSprite]>>8; yvel[pFX->index] = yvel[nSprite]>>8;
zvel[pFX->index] = zvel[nSprite]>>8; zvel[pFX->index] = zvel[nSprite]>>8;
} }
evPost(nSprite, 3, 6, CALLBACK_ID_6); evPost(nSprite, 3, 6, kCallbackFXBloodSpurt);
} }
void DynPuff(int nSprite) // 8
void fxArcSpark(int nSprite) // 7
{
spritetype* pSprite = &sprite[nSprite];
spritetype* pFX = gFX.fxSpawn(FX_15, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
if (pFX)
{
xvel[pFX->index] = xvel[nSprite] + Random2(0x10000);
yvel[pFX->index] = yvel[nSprite] + Random2(0x10000);
zvel[pFX->index] = zvel[nSprite] - Random(0x1aaaa);
}
evPost(nSprite, 3, 3, kCallbackFXArcSpark);
}
void fxDynPuff(int nSprite) // 8
{ {
spritetype *pSprite = &sprite[nSprite]; spritetype *pSprite = &sprite[nSprite];
if (zvel[nSprite]) if (zvel[nSprite])
@ -297,7 +221,7 @@ void DynPuff(int nSprite) // 8
zvel[pFX->index] = zvel[nSprite]; zvel[pFX->index] = zvel[nSprite];
} }
} }
evPost(nSprite, 3, 12, CALLBACK_ID_8); evPost(nSprite, 3, 12, kCallbackFXDynPuff);
} }
void Respawn(int nSprite) // 9 void Respawn(int nSprite) // 9
@ -316,14 +240,14 @@ void Respawn(int nSprite) // 9
{ {
int nTime = mulscale16(actGetRespawnTime(pSprite), 0x4000); int nTime = mulscale16(actGetRespawnTime(pSprite), 0x4000);
pXSprite->respawnPending = 2; pXSprite->respawnPending = 2;
evPost(nSprite, 3, nTime, CALLBACK_ID_9); evPost(nSprite, 3, nTime, kCallbackRespawn);
break; break;
} }
case 2: case 2:
{ {
int nTime = mulscale16(actGetRespawnTime(pSprite), 0x2000); int nTime = mulscale16(actGetRespawnTime(pSprite), 0x2000);
pXSprite->respawnPending = 3; pXSprite->respawnPending = 3;
evPost(nSprite, 3, nTime, CALLBACK_ID_9); evPost(nSprite, 3, nTime, kCallbackRespawn);
break; break;
} }
case 3: case 3:
@ -352,10 +276,10 @@ void Respawn(int nSprite) // 9
aiInitSprite(pSprite); aiInitSprite(pSprite);
pXSprite->key = 0; pXSprite->key = 0;
} }
if (pSprite->type == 400) if (pSprite->type == kThingTNTBarrel)
{ {
pSprite->cstat |= 257; pSprite->cstat |= CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN;
pSprite->cstat &= (unsigned short)~32768; pSprite->cstat &= (unsigned short)~CSTAT_SPRITE_INVISIBLE;
} }
gFX.fxSpawn(FX_29, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); gFX.fxSpawn(FX_29, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
sfxPlay3DSound(pSprite, 350, -1, 0); sfxPlay3DSound(pSprite, 350, -1, 0);
@ -393,7 +317,7 @@ void PlayerBubble(int nSprite) // 10
zvel[pFX->index] = zvel[nSprite] + Random2(0x1aaaa); zvel[pFX->index] = zvel[nSprite] + Random2(0x1aaaa);
} }
} }
evPost(nSprite, 3, 4, CALLBACK_ID_10); evPost(nSprite, 3, 4, kCallbackPlayerBubble);
} }
} }
@ -417,44 +341,44 @@ void EnemyBubble(int nSprite) // 11
zvel[pFX->index] = zvel[nSprite] + Random2(0x1aaaa); zvel[pFX->index] = zvel[nSprite] + Random2(0x1aaaa);
} }
} }
evPost(nSprite, 3, 4, CALLBACK_ID_11); evPost(nSprite, 3, 4, kCallbackEnemeyBubble);
} }
void CounterCheck(int nSector) // 12 void CounterCheck(int nSector) // 12
{ {
dassert(nSector >= 0 && nSector < kMaxSectors); dassert(nSector >= 0 && nSector < kMaxSectors);
sectortype *pSector = &sector[nSector];
// By NoOne: edits for counter sector new features.
// remove check below, so every sector can be counter if command 12 (this callback) received.
//if (pSector->type != 619) return;
int nXSprite = pSector->extra;
if (nXSprite > 0)
{
XSECTOR *pXSector = &xsector[nXSprite];
int nReq = pXSector->waitTimeA;
int nType = pXSector->data;
if (nType && nReq)
{
int nCount = 0;
for (int nSprite = headspritesect[nSector]; nSprite >= 0; nSprite = nextspritesect[nSprite])
{
if (sprite[nSprite].type == nType)
nCount++;
}
if (nCount >= nReq)
{
// By NoOne: remove check below, so every sector can be counter if command 12 (this callback) received.
//if (pSector->type != kSectorCounter) return;
if (sector[nSector].extra <= 0) return; XSECTOR *pXSector = &xsector[sector[nSector].extra];
int nReq = pXSector->waitTimeA; int nType = pXSector->data; int nCount = 0;
if (!nType || !nReq) return;
for (int nSprite = headspritesect[nSector]; nSprite >= 0; nSprite = nextspritesect[nSprite]) {
if (sprite[nSprite].type == nType) nCount++;
}
if (nCount < nReq) {
evPost(nSector, 6, 5, kCallbackCounterCheck);
return;
} else {
//pXSector->waitTimeA = 0; //do not reset necessary objects counter to zero //pXSector->waitTimeA = 0; //do not reset necessary objects counter to zero
trTriggerSector(nSector, pXSector, 1); trTriggerSector(nSector, pXSector, kCmdOn);
pXSector->locked = 1; //lock sector, so it can be opened again later pXSector->locked = 1; //lock sector, so it can be opened again later
} }
else
evPost(nSector, 6, 5, CALLBACK_ID_12);
}
}
} }
void sub_76140(int nSprite) // 14
void FinishHim(int nSprite) // 13
{
spritetype* pSprite = &sprite[nSprite];
int nXSprite = pSprite->extra;
XSPRITE* pXSprite = &xsprite[nXSprite];
if (playerSeqPlaying(&gPlayer[pSprite->type - kDudePlayer1], 16) && pXSprite->target == gMe->at5b)
sndStartSample(3313, -1, 1, 0);
}
void fxBloodBits(int nSprite) // 14
{ {
spritetype *pSprite = &sprite[nSprite]; spritetype *pSprite = &sprite[nSprite];
int ceilZ, ceilHit, floorZ, floorHit; int ceilZ, ceilHit, floorZ, floorHit;
@ -482,14 +406,65 @@ void sub_76140(int nSprite) // 14
gFX.sub_73FFC(nSprite); gFX.sub_73FFC(nSprite);
} }
void sub_7632C(spritetype *pSprite)
void fxTeslaAlt(int nSprite) // 15
{ {
xvel[pSprite->index] = yvel[pSprite->index] = zvel[pSprite->index] = 0; spritetype* pSprite = &sprite[nSprite];
if (pSprite->extra > 0) spritetype* pFX = gFX.fxSpawn(FX_49, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
seqKill(3, pSprite->extra); if (pFX)
sfxKill3DSound(pSprite, -1, -1);
switch (pSprite->type)
{ {
xvel[pFX->index] = xvel[nSprite] + Random2(0x1aaaa);
yvel[pFX->index] = yvel[nSprite] + Random2(0x1aaaa);
zvel[pFX->index] = zvel[nSprite] - Random(0x1aaaa);
}
evPost(nSprite, 3, 3, kCallbackFXTeslaAlt);
}
int tommySleeveSnd[] = { 608, 609, 611 }; // unused?
int sawedOffSleeveSnd[] = { 610, 612 };
void fxBouncingSleeve(int nSprite) // 16
{
spritetype* pSprite = &sprite[nSprite]; int ceilZ, ceilHit, floorZ, floorHit;
GetZRange(pSprite, &ceilZ, &ceilHit, &floorZ, &floorHit, pSprite->clipdist, CLIPMASK0);
int top, bottom; GetSpriteExtents(pSprite, &top, &bottom);
pSprite->z += floorZ - bottom;
int zv = zvel[nSprite] - velFloor[pSprite->sectnum];
if (zvel[nSprite] == 0) sleeveStopBouncing(pSprite);
else if (zv > 0) {
actFloorBounceVector((int*)& xvel[nSprite], (int*)& yvel[nSprite], &zv, pSprite->sectnum, 0x9000);
zvel[nSprite] = zv;
if (velFloor[pSprite->sectnum] == 0 && klabs(zvel[nSprite]) < 0x20000) {
sleeveStopBouncing(pSprite);
return;
}
int nChannel = 28 + (pSprite->index & 2);
dassert(nChannel < 32);
// tommy sleeve
if (pSprite->type >= 37 && pSprite->type <= 39) {
Random(3);
sfxPlay3DSound(pSprite, 608 + Random(2), nChannel, 1);
// sawed-off sleeve
} else {
sfxPlay3DSound(pSprite, sawedOffSleeveSnd[Random(2)], nChannel, 1);
}
}
}
void sleeveStopBouncing(spritetype* pSprite) {
xvel[pSprite->index] = yvel[pSprite->index] = zvel[pSprite->index] = 0;
if (pSprite->extra > 0) seqKill(3, pSprite->extra);
sfxKill3DSound(pSprite, -1, -1);
switch (pSprite->type) {
case 37: case 37:
case 38: case 38:
case 39: case 39:
@ -501,72 +476,56 @@ void sub_7632C(spritetype *pSprite)
pSprite->picnum = 2464; pSprite->picnum = 2464;
break; break;
} }
pSprite->type = 51; pSprite->type = 51;
pSprite->xrepeat = pSprite->yrepeat = 10; pSprite->xrepeat = pSprite->yrepeat = 10;
} }
int dword_13B32C[] = { 608, 609, 611 };
int dword_13B338[] = { 610, 612 };
void sub_763BC(int nSprite) // 16 void returnFlagToBase(int nSprite) // 17
{ {
spritetype *pSprite = &sprite[nSprite]; spritetype* pSprite = &sprite[nSprite];
int ceilZ, ceilHit, floorZ, floorHit;
GetZRange(pSprite, &ceilZ, &ceilHit, &floorZ, &floorHit, pSprite->clipdist, CLIPMASK0);
int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom);
pSprite->z += floorZ-bottom;
int zv = zvel[nSprite]-velFloor[pSprite->sectnum];
if (zv > 0)
{
actFloorBounceVector((int*)&xvel[nSprite], (int*)&yvel[nSprite], &zv, pSprite->sectnum, 0x9000);
zvel[nSprite] = zv;
if (velFloor[pSprite->sectnum] == 0 && klabs(zvel[nSprite]) < 0x20000)
{
sub_7632C(pSprite);
return;
}
int nChannel = 28+(pSprite->index&2);
dassert(nChannel < 32);
if (pSprite->type >= 37 && pSprite->type <= 39)
{
Random(3);
sfxPlay3DSound(pSprite, 608+Random(2), nChannel, 1);
}
else
sfxPlay3DSound(pSprite, dword_13B338[Random(2)], nChannel, 1);
}
else if (zvel[nSprite] == 0)
sub_7632C(pSprite);
}
void sub_765B8(int nSprite) // 17
{
spritetype *pSprite = &sprite[nSprite];
if (pSprite->owner >= 0 && pSprite->owner < kMaxSprites) if (pSprite->owner >= 0 && pSprite->owner < kMaxSprites)
{ {
spritetype *pOwner = &sprite[pSprite->owner]; spritetype* pOwner = &sprite[pSprite->owner];
XSPRITE *pXOwner = &xsprite[pOwner->extra]; XSPRITE* pXOwner = &xsprite[pOwner->extra];
switch (pSprite->type) switch (pSprite->type) {
{ case kItemFlagA:
case 147: trTriggerSprite(pOwner->index, pXOwner, kCmdOn);
trTriggerSprite(pOwner->index, pXOwner, 1);
sndStartSample(8003, 255, 2, 0); sndStartSample(8003, 255, 2, 0);
gBlueFlagDropped = false; gBlueFlagDropped = false;
viewSetMessage("Blue Flag returned to base."); viewSetMessage("Blue Flag returned to base.");
break; break;
case 148: case kItemFlagB:
trTriggerSprite(pOwner->index, pXOwner, 1); trTriggerSprite(pOwner->index, pXOwner, kCmdOn);
sndStartSample(8002, 255, 2, 0); sndStartSample(8002, 255, 2, 0);
gRedFlagDropped = false; gRedFlagDropped = false;
viewSetMessage("Red Flag returned to base."); viewSetMessage("Red Flag returned to base.");
break; break;
} }
} }
evPost(pSprite->index, 3, 0, CALLBACK_ID_1); evPost(pSprite->index, 3, 0, kCallbackRemove);
} }
void sub_766B8(int nSprite) // 19 void fxPodBloodSpray(int nSprite) // 18
{
spritetype* pSprite = &sprite[nSprite];
spritetype* pFX;
if (pSprite->type == 53)
pFX = gFX.fxSpawn(FX_53, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
else
pFX = gFX.fxSpawn(FX_54, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
if (pFX)
{
pFX->ang = 0;
xvel[pFX->index] = xvel[nSprite] >> 8;
yvel[pFX->index] = yvel[nSprite] >> 8;
zvel[pFX->index] = zvel[nSprite] >> 8;
}
evPost(nSprite, 3, 6, kCallbackFXPodBloodSpray);
}
void fxPodBloodSplat(int nSprite) // 19
{ {
spritetype *pSprite = &sprite[nSprite]; spritetype *pSprite = &sprite[nSprite];
int ceilZ, ceilHit, floorZ, floorHit; int ceilZ, ceilHit, floorZ, floorHit;
@ -585,9 +544,9 @@ void sub_766B8(int nSprite) // 19
sfxPlay3DSound(pSprite, 385, nChannel, 1); sfxPlay3DSound(pSprite, 385, nChannel, 1);
} }
spritetype *pFX = NULL; spritetype *pFX = NULL;
if (pSprite->type == 53 || pSprite->type == 430) if (pSprite->type == 53 || pSprite->type == kThingPodFireBall)
{ {
if (Chance(0x500) || pSprite->type == 430) if (Chance(0x500) || pSprite->type == kThingPodFireBall)
pFX = gFX.fxSpawn(FX_55, pSprite->sectnum, x, y, floorZ-64, 0); pFX = gFX.fxSpawn(FX_55, pSprite->sectnum, x, y, floorZ-64, 0);
if (pFX) if (pFX)
pFX->ang = nAngle; pFX->ang = nAngle;
@ -601,38 +560,22 @@ void sub_766B8(int nSprite) // 19
gFX.sub_73FFC(nSprite); gFX.sub_73FFC(nSprite);
} }
void sub_768E8(int nSprite) // 18
{
spritetype *pSprite = &sprite[nSprite];
spritetype *pFX;
if (pSprite->type == 53)
pFX = gFX.fxSpawn(FX_53, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
else
pFX = gFX.fxSpawn(FX_54, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
if (pFX)
{
pFX->ang = 0;
xvel[pFX->index] = xvel[nSprite]>>8;
yvel[pFX->index] = yvel[nSprite]>>8;
zvel[pFX->index] = zvel[nSprite]>>8;
}
evPost(nSprite, 3, 6, CALLBACK_ID_18);
}
void sub_769B4(int nSprite) // 19
void LeechStateTimer(int nSprite) // 20
{ {
spritetype *pSprite = &sprite[nSprite]; spritetype *pSprite = &sprite[nSprite];
if (pSprite->statnum == kStatThing && !(pSprite->flags & 32)) { if (pSprite->statnum == kStatThing && !(pSprite->flags & 32)) {
switch (pSprite->type) { switch (pSprite->type) {
case 431: case kThingDroppedLifeLeech:
case kGDXThingCustomDudeLifeLeech: case kModernThingEnemyLifeLeech:
xsprite[pSprite->extra].stateTimer = 0; xsprite[pSprite->extra].stateTimer = 0;
break; break;
} }
} }
} }
void sub_76A08(spritetype *pSprite, spritetype *pSprite2, PLAYER *pPlayer) void sub_76A08(spritetype *pSprite, spritetype *pSprite2, PLAYER *pPlayer) // ???
{ {
int top, bottom; int top, bottom;
int nSprite = pSprite->index; int nSprite = pSprite->index;
@ -652,13 +595,13 @@ void sub_76A08(spritetype *pSprite, spritetype *pSprite2, PLAYER *pPlayer)
} }
} }
void sub_76B78(int nSprite) void DropVoodoo(int nSprite) // unused
{ {
spritetype *pSprite = &sprite[nSprite]; spritetype *pSprite = &sprite[nSprite];
int nOwner = actSpriteOwnerToSpriteId(pSprite); int nOwner = actSpriteOwnerToSpriteId(pSprite);
if (nOwner < 0 || nOwner >= kMaxSprites) if (nOwner < 0 || nOwner >= kMaxSprites)
{ {
evPost(nSprite, 3, 0, CALLBACK_ID_1); evPost(nSprite, 3, 0, kCallbackRemove);
return; return;
} }
spritetype *pOwner = &sprite[nOwner]; spritetype *pOwner = &sprite[nOwner];
@ -669,7 +612,7 @@ void sub_76B78(int nSprite)
pPlayer = NULL; pPlayer = NULL;
if (!pPlayer) if (!pPlayer)
{ {
evPost(nSprite, 3, 0, CALLBACK_ID_1); evPost(nSprite, 3, 0, kCallbackRemove);
return; return;
} }
pSprite->ang = getangle(pOwner->x-pSprite->x, pOwner->y-pSprite->y); pSprite->ang = getangle(pOwner->x-pSprite->x, pOwner->y-pSprite->y);
@ -679,7 +622,7 @@ void sub_76B78(int nSprite)
XSPRITE *pXSprite = &xsprite[nXSprite]; XSPRITE *pXSprite = &xsprite[nXSprite];
if (pXSprite->data1 == 0) if (pXSprite->data1 == 0)
{ {
evPost(nSprite, 3, 0, CALLBACK_ID_1); evPost(nSprite, 3, 0, kCallbackRemove);
return; return;
} }
int nSprite2, nNextSprite; int nSprite2, nNextSprite;
@ -714,7 +657,7 @@ void sub_76B78(int nSprite)
int nDmg = actDamageSprite(nOwner, pSprite2, DAMAGE_TYPE_5, pXSprite->data1<<4); int nDmg = actDamageSprite(nOwner, pSprite2, DAMAGE_TYPE_5, pXSprite->data1<<4);
pXSprite->data1 = ClipLow(pXSprite->data1-nDmg, 0); pXSprite->data1 = ClipLow(pXSprite->data1-nDmg, 0);
sub_76A08(pSprite2, pSprite, pPlayer2); sub_76A08(pSprite2, pSprite, pPlayer2);
evPost(nSprite, 3, 0, CALLBACK_ID_1); evPost(nSprite, 3, 0, kCallbackRemove);
return; return;
} }
} }
@ -723,39 +666,39 @@ void sub_76B78(int nSprite)
int vd = 0x2666; int vd = 0x2666;
switch (pSprite2->type) switch (pSprite2->type)
{ {
case 218: case kDudeBoneEel:
case 219: case kDudeBat:
case 220: case kDudeRat:
case 250: case kDudeTinyCaleb:
case 251: case kDudeBeast:
vd = 0x147; vd = 0x147;
break; break;
case 205: case kDudeZombieAxeBuried:
case 221: case kDudePodGreen:
case 222: case kDudeTentacleGreen:
case 223: case kDudePodFire:
case 224: case kDudeTentacleFire:
case 225: case kDudePodMother:
case 226: case kDudeTentacleMother:
case 227: case kDudeCerberusTwoHead:
case 228: case kDudeCerberusOneHead:
case 229: case kDudeTchernobog:
case 239: case kDudeBurningInnocent:
case 240: case kDudeBurningCultist:
case 241: case kDudeBurningZombieAxe:
case 242: case kDudeBurningZombieButcher:
case 243: case kDudeCultistReserved:
case 244: case kDudeZombieAxeLaying:
case 245: case kDudeInnocent:
case 252: case kDudeBurningTinyCaleb:
case 253: case kDudeBurningBeast:
vd = 0; vd = 0;
break; break;
} }
if (vd && (Chance(vd) || nNextSprite < 0)) if (vd && (Chance(vd) || nNextSprite < 0))
{ {
sub_76A08(pSprite2, pSprite, NULL); sub_76A08(pSprite2, pSprite, NULL);
evPost(nSprite, 3, 0, CALLBACK_ID_1); evPost(nSprite, 3, 0, kCallbackRemove);
return; return;
} }
} }
@ -763,34 +706,92 @@ void sub_76B78(int nSprite)
} }
} }
pXSprite->data1 = ClipLow(pXSprite->data1-1, 0); pXSprite->data1 = ClipLow(pXSprite->data1-1, 0);
evPost(nSprite, 3, 0, CALLBACK_ID_1); evPost(nSprite, 3, 0, kCallbackRemove);
} }
} }
void UniMissileBurst(int nSprite) // 22
{
dassert(nSprite >= 0 && nSprite < kMaxSprites);
if (sprite[nSprite].statnum != kStatProjectile) return;
spritetype * pSprite = &sprite[nSprite];
int nAngle = getangle(xvel[nSprite], yvel[nSprite]);
int nRadius = 0x55555;
for (int i = 0; i < 8; i++)
{
spritetype* pBurst = actSpawnSprite(pSprite, 5);
pBurst->type = pSprite->type;
pBurst->shade = pSprite->shade;
pBurst->picnum = pSprite->picnum;
pBurst->cstat = pSprite->cstat;
if ((pBurst->cstat & CSTAT_SPRITE_BLOCK)) {
pBurst->cstat &= ~CSTAT_SPRITE_BLOCK; // we don't want missiles impact each other
evPost(pBurst->xvel, 3, 100, kCallbackMissileSpriteBlock); // so set blocking flag a bit later
}
pBurst->pal = pSprite->pal;
pBurst->clipdist = pSprite->clipdist / 4;
pBurst->flags = pSprite->flags;
pBurst->xrepeat = pSprite->xrepeat / 2;
pBurst->yrepeat = pSprite->yrepeat / 2;
pBurst->ang = ((pSprite->ang + missileInfo[pSprite->type - kMissileBase].at6) & 2047);
pBurst->owner = pSprite->owner;
actBuildMissile(pBurst, pBurst->extra, pSprite->xvel);
int nAngle2 = (i << 11) / 8;
int dx = 0;
int dy = mulscale30r(nRadius, Sin(nAngle2));
int dz = mulscale30r(nRadius, -Cos(nAngle2));
if (i & 1)
{
dy >>= 1;
dz >>= 1;
}
RotateVector(&dx, &dy, nAngle);
xvel[pBurst->index] += dx;
yvel[pBurst->index] += dy;
zvel[pBurst->index] += dz;
evPost(pBurst->index, 3, 960, kCallbackRemove);
}
evPost(nSprite, 3, 0, kCallbackRemove);
}
void makeMissileBlocking(int nSprite) // 23
{
dassert(nSprite >= 0 && nSprite < kMaxSprites);
if (sprite[nSprite].statnum != kStatProjectile) return;
sprite[nSprite].cstat |= CSTAT_SPRITE_BLOCK;
}
void(*gCallback[kCallbackMax])(int) = void(*gCallback[kCallbackMax])(int) =
{ {
FlameLick, fxFlameLick,
Remove, Remove,
FlareBurst, FlareBurst,
FlareSpark, fxFlareSpark,
FlareSparkLite, fxFlareSparkLite,
ZombieSpurt, fxZombieBloodSpurt,
BloodSpurt, fxBloodSpurt,
sub_74C20, fxArcSpark,
DynPuff, fxDynPuff,
Respawn, Respawn,
PlayerBubble, PlayerBubble,
EnemyBubble, EnemyBubble,
CounterCheck, CounterCheck,
FinishHim, FinishHim,
sub_76140, fxBloodBits,
sub_74D04, fxTeslaAlt,
sub_763BC, fxBouncingSleeve,
sub_765B8, returnFlagToBase,
sub_768E8, fxPodBloodSpray,
sub_766B8, fxPodBloodSplat,
sub_769B4, LeechStateTimer,
sub_76B78, DropVoodoo, // unused
UniMissileBurst, UniMissileBurst,
makeMissileBlocking, makeMissileBlocking,
}; };

View file

@ -23,34 +23,35 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#pragma once #pragma once
BEGIN_BLD_NS BEGIN_BLD_NS
void sleeveStopBouncing(spritetype* pSprite);
enum CALLBACK_ID { enum CALLBACK_ID {
CALLBACK_ID_NONE = -1, kCallbackNone = -1,
CALLBACK_ID_0 = 0, kCallbackFXFlameLick = 0,
CALLBACK_ID_1, kCallbackRemove = 1,
CALLBACK_ID_2, kCallbackFXFlareBurst = 2,
CALLBACK_ID_3, kCallbackFXFlareSpark = 3,
CALLBACK_ID_4, kCallbackFXFlareSparkLite = 4,
CALLBACK_ID_5, kCallbackFXZombieSpurt = 5,
CALLBACK_ID_6, kCallbackFXBloodSpurt = 6,
CALLBACK_ID_7, kCallbackFXArcSpark = 7,
CALLBACK_ID_8, kCallbackFXDynPuff = 8,
CALLBACK_ID_9, kCallbackRespawn = 9,
CALLBACK_ID_10, kCallbackPlayerBubble = 10,
CALLBACK_ID_11, kCallbackEnemeyBubble = 11,
CALLBACK_ID_12, kCallbackCounterCheck = 12,
CALLBACK_ID_13, kCallbackFinishHim = 13,
CALLBACK_ID_14, kCallbackFXBloodBits = 14,
CALLBACK_ID_15, kCallbackFXTeslaAlt = 15,
CALLBACK_ID_16, kCallbackFXBouncingSleeve = 16,
CALLBACK_ID_17, kCallbackReturnFlag = 17,
CALLBACK_ID_18, kCallbackFXPodBloodSpray = 18,
CALLBACK_ID_19, kCallbackFXPodBloodSplat = 19,
CALLBACK_ID_20, kCallbackLeechStateTimer = 20,
CALLBACK_ID_21, kCallbackDropVoodoo = 21, // unused
CALLBACK_ID_22, // by NoOne: UniMissileBurst(); kCallbackMissileBurst = 22, // by NoOne
CALLBACK_ID_23, // by NoOne: makeMissileBlocking(); kCallbackMissileSpriteBlock = 23, // by NoOne
kCallbackMax kCallbackMax = 24
}; };
extern void (*gCallback[kCallbackMax])(int); extern void (*gCallback[kCallbackMax])(int);

View file

@ -77,14 +77,7 @@ void QuitGame(void);
#define kExplodeMax 8 #define kExplodeMax 8
#define kDudeBase 200
#define kDudePlayer1 231
#define kDudePlayer8 238
#define kDudeMax 260
#define kMissileBase 300
#define kMissileMax 318
#define kThingBase 400
#define kThingMax 436
#define kMaxPowerUps 51 #define kMaxPowerUps 51
@ -119,26 +112,290 @@ void QuitGame(void);
// ------------------------------- // -------------------------------
#define kMaxPAL 5 #define kMaxPAL 5
#define kItemBase 100
#define kWeaponItemBase 40
#define kItemMax 151
// marker sprite types // SPRITE TYPES /////////////////////////////////////////////////
#define kMarkerSPStart 1 enum {
#define kMarkerMPStart 2 kSpriteDecoration = 0,
#define kMarkerOff 3
#define kMarkerOn 4 // markers
#define kMarkerAxis 5 kMarkerSPStart = 1,
#define kMarkerLowLink 6 kMarkerMPStart = 2,
#define kMarkerUpLink 7 kMarkerOff = 3,
#define kMarkerWarpDest 8 kMarkerOn = 4,
#define kMarkerUpWater 9 kMarkerAxis = 5,
#define kMarkerLowWater 10 kMarkerLowLink = 6,
#define kMarkerUpStack 11 kMarkerUpLink = 7,
#define kMarkerLowStack 12 kMarkerWarpDest = 8,
#define kMarkerUpGoo 13 kMarkerUpWater = 9,
#define kMarkerLowGoo 14 kMarkerLowWater = 10,
#define kMarkerPath 15 kMarkerUpStack = 11,
kMarkerLowStack = 12,
kMarkerUpGoo = 13,
kMarkerLowGoo = 14,
kMarkerPath = 15,
kMarkerDudeSpawn = 18,
kMarkerEarthQuake = 19,
// switches
kSwitchBase = 20,
kSwitchToggle = 20,
kSwitchOneWay = 21,
kSwitchCombo = 22,
kSwitchPadlock = 23,
kSwitchMax = 24,
// modern types (gModernMap only)
kModernCustomDudeSpawn = 24,
kModernRandomTX = 25,
kModernSequentialTX = 26,
kModernSeqSpawner = 27,
kModernObjPropertiesChanger = 28,
kModernObjPicnumChanger = 29,
kModernObjSizeChanger = 31,
kModernDudeTargetChanger = 33,
kModernSectorFXChanger = 34,
kModernObjDataChanger = 35,
kModernSpriteDamager = 36,
kModernObjDataAccumulator = 37,
kModernEffectSpawner = 38,
kModernWindGenerator = 39,
kModernConcussSprite = 712,
// decorations
kDecorationTorch = 30,
kDecorationCandle = 32,
// (weapons)
kItemWeaponBase = 40,
kModernRandom = 40, // gModernMap only
kItemWeaponSawedoff = 41,
kItemWeaponTommygun = 42,
kItemWeaponVoodooDoll = 44,
kItemWeaponLifeLeech = 50,
kItemWeaponMax = 51,
// items (ammos)
kItemAmmoBase = 60,
kItemAmmoSawedoffFew = 67,
kItemAmmoTommygunFew = 69,
kAmmoItemVoodooDoll = 70,
kModernRandom2 = 80, // gModernMap Only
kItemAmmoMax = 81,
kItemBase = 100,
// items (keys)
kItemKeyBase = kItemBase,
kItemKeySkull = kItemKeyBase,
kItemKeyEye = 101,
kItemKeyFire = 102,
kItemKeyDagger = 103,
kItemKeySpider = 104,
kItemKeyMoon = 105,
kItemKeyKey7 = 106,
kItemKeyMax = 107,
// items (health)
kItemHealthDoctorBag = 107,
kItemHealthMedPouch = 108,
kItemHealthLifeEssense = 109,
kItemHealthLifeSeed = 110,
kItemHealthRedPotion = 111,
// items (misc)
kItemFeatherFall = 112,
kItemShadowCloak = 113, // ltdInvisibility
kItemDeathMask = 114, // invulnerability
kItemJumpBoots = 115,
kItemTwoGuns = 117,
kItemDivingSuit = 118,
kItemGasMask = 119,
kItemCrystalBall = 121,
kItemReflectShots = 124,
kItemBeastVision = 125,
kItemShroomDelirium = 128,
kItemShroomGrow = 129, // gModernMap = only
kItemShroomShrink = 130, // gModernMap = only
kItemArmorAsbest = 139,
kItemArmorBasic = 140,
kItemArmorBody = 141,
kItemArmorFire = 142,
kItemArmorSpirit = 143,
kItemArmorSuper = 144,
kItemFlagABase = 145,
kItemFlagBBase = 146,
kItemFlagA = 147,
kItemFlagB = 148,
kItemModernMapLevel = 150, // once picked up, draws whole minimap
kItemMax = 151,
// dudes
kDudeBase = 200,
kDudeCultistTommy = 201,
kDudeCultistShotgun = 202,
kDudeZombieAxeNormal = 203,
kDudeZombieButcher = 204,
kDudeZombieAxeBuried = 205,
kDudeGargoyleFlesh = 206,
kDudeGargoyleStone = 207,
kDudeGargoyleStatueFlesh = 208,
kDudeGargoyleStatueStone = 209,
kDudePhantasm = 210,
kDudeHellHound = 211,
kDudeHand = 212,
kDudeSpiderBrown = 213,
kDudeSpiderRed = 214,
kDudeSpiderBlack = 215,
kDudeSpiderMother = 216,
kDudeGillBeast = 217,
kDudeBoneEel = 218,
kDudeBat = 219,
kDudeRat = 220,
kDudePodGreen = 221,
kDudeTentacleGreen = 222,
kDudePodFire = 223,
kDudeTentacleFire = 224,
kDudePodMother = 225,
kDudeTentacleMother = 226,
kDudeCerberusTwoHead = 227,
kDudeCerberusOneHead = 228,
kDudeTchernobog = 229,
kDudeCultistTommyProne = 230,
kDudePlayer1 = 231,
kDudePlayer2 = 232,
kDudePlayer3 = 233,
kDudePlayer4 = 234,
kDudePlayer5 = 235,
kDudePlayer6 = 236,
kDudePlayer7 = 237,
kDudePlayer8 = 238,
kDudeBurningInnocent = 239,
kDudeBurningCultist = 240,
kDudeBurningZombieAxe = 241,
kDudeBurningZombieButcher = 242,
kDudeCultistReserved = 243, // unused
kDudeZombieAxeLaying = 244,
kDudeInnocent = 245,
kDudeCultistShotgunProne = 246,
kDudeCultistTesla = 247,
kDudeCultistTNT = 248,
kDudeCultistBeast = 249,
kDudeTinyCaleb = 250,
kDudeBeast = 251,
kDudeBurningTinyCaleb = 252,
kDudeBurningBeast = 253,
kDudeModernCustom = 254, // gModern map only
kDudeModernCustomBurning = 255, // gModern map only
kDudeMax = 256,
kMissileBase = 300,
kMissileButcherKnife = kMissileBase,
kMissileFlareRegular = 301,
kMissileTeslaAlt = 302,
kMissileFlareAlt = 303,
kMissileFlameSpray = 304,
kMissileFireball = 305,
kMissileTeslaRegular = 306,
kMissileEctoSkull = 307,
kMissileFlameHound = 308,
kMissilePukeGreen = 309,
kMissileArcGargoyle = 311,
kMissileFireballNapam = 312,
kMissileFireballCerberus = 313,
kMissileFireballTchernobog = 314,
kMissileLifeLeechRegular = 315,
kMissileLifeLeechAltNormal = 316,
kMissileLifeLeechAltSmall = 317,
kMissileMax = 318,
// things
kThingBase = 400,
kThingTNTBarrel = 400,
kThingArmedProxBomb = 401,
kThingArmedRemoteBomb = 402,
kThingCrateFace = 405,
kThingGlassWindow = 406,
kThingFluorescent = 407,
kThingWallCrack = 408,
kThingSpiderWeb = 410,
kThingMetalGrate = 411,
kThingFlammableTree = 412,
kTrapMachinegun = 413, // not really a thing, should be in traps instead
kThingFallingRock = 414,
kThingKickablePail = 415,
kThingObjectGib = 416,
kThingObjectExplode = 417,
kThingArmedTNTStick = 418,
kThingArmedTNTBundle = 419,
kThingArmedSpray = 420,
kThingBone = 421,
kThingDripWater = 423,
kThingDripBlood = 424,
kThingBloodBits = 425,
kThingBloodChunks = 426,
kThingZombieHead = 427,
kThingNapalmBall = 428,
kThingPodGreenBall = 429,
kThingPodFireBall = 430,
kThingDroppedLifeLeech = 431,
kThingVoodooHead = 432, // unused
kModernThingTNTProx = 433, // gModernMap only - detects only players
kModernThingThrowableRock = 434, // gModernMap only - does small damage if hits target
kModernThingEnemyLifeLeech = 435, // gModernMap only - the same as normal, except it aims in specified target only
kThingMax = 436,
// traps
kTrapFlame = 452,
kTrapSawCircular = 454,
kTrapZapSwitchable = 456,
kTrapExploder = 459,
// generators
kGenTrigger = 700,
kGenDripWater = 701,
kGenDripBlood = 702,
kGenMissileFireball = 703,
kGenMissileEctoSkull = 704, // does not work in vanilla
kGenModernMissileUniversal = 704, // gModernMap only
kGenDart = 705,
kGenBubble = 706,
kGenBubbleMulti = 707,
// sound sprites
kGenSound = 708,
kSoundSector = 709,
kSoundPlayer = 711,
};
// WALL TYPES /////////////////////////////////////////////////
enum {
kWallBase = 500,
kWallStack = 501,
kWallGib = 511,
kWallMax = 512,
};
// SECTOR TYPES /////////////////////////////////////////////////
enum {
kSectorBase = 600,
kSectorZMotion = 600,
kSectorZMotionSprite = 602,
kSectorTeleport = 604,
kSectorPath = 612,
kSectorRotateStep = 613,
kSectorSlideMarked = 614,
kSectorRotateMarked = 615,
kSectorSlide = 616,
kSectorRotate = 617,
kSectorDamage = 618,
kSectorCounter = 619,
kSectorMax = 620,
};
// sprite attributes // sprite attributes
#define kHitagAutoAim 0x0008 #define kHitagAutoAim 0x0008
@ -162,21 +419,6 @@ void QuitGame(void);
#define kModernTypeFlag2 0x2 #define kModernTypeFlag2 0x2
#define kModernTypeFlag3 0x3 #define kModernTypeFlag3 0x3
// sector types
#define kSecBase 600
#define kSecZMotion kSectorBase
#define kSecZSprite 602
#define kSecWarp 603
#define kSecTeleport 604
#define kSecPath 612
#define kSecRotateStep 613
#define kSecSlideMarked 614
#define kSecRotateMarked 615
#define kSecSlide 616
#define kSecRotate 617
#define kSecDamage 618
#define kSecCounter 619
#define kSecMax 620
// sector cstat // sector cstat
#define kSecCParallax 0x01 #define kSecCParallax 0x01
@ -189,42 +431,6 @@ void QuitGame(void);
#define kSecCRelAlign 0x40 #define kSecCRelAlign 0x40
#define kSecCFloorShade 0x8000 #define kSecCFloorShade 0x8000
// switch types
#define kSwitchBase 20
#define kSwitchToggle 20
#define kSwitchOneWay 21
#define kSwitchCombo 22
#define kSwitchPadlock 23
#define kSwitchMax 24
// projectile types
#define kProjectileEctoSkull 307
// GDX types
#define kGDXTypeBase 24
#define kGDXCustomDudeSpawn 24
#define kGDXRandomTX 25
#define kGDXSequentialTX 26
#define kGDXSeqSpawner 27
#define kGDXObjPropertiesChanger 28
#define kGDXObjPicnumChanger 29
#define kGDXObjSizeChanger 31
#define kGDXDudeTargetChanger 33
#define kGDXSectorFXChanger 34
#define kGDXObjDataChanger 35
#define kGDXSpriteDamager 36
#define kGDXObjDataAccumulator 37
#define kGDXEffectSpawner 38
#define kGDXWindGenerator 39
#define kModernConcussSprite 712
#define kGDXThingTNTProx 433 // detects only players
#define kGDXThingThrowableRock 434 // does small damage if hits target
#define kGDXThingCustomDudeLifeLeech 435 // the same as normal, except it aims in specified target
#define kCustomDude 254
#define kCustomDudeBurning 255
#define kGDXItemMapLevel 150 // once picked up, draws whole minimap
// ai state types // ai state types
#define kAiStateOther -1 #define kAiStateOther -1

View file

@ -600,68 +600,37 @@ void dbInit(void)
void PropagateMarkerReferences(void) void PropagateMarkerReferences(void)
{ {
int nSprite, nNextSprite; int nSprite, nNextSprite;
for (nSprite = headspritestat[kStatMarker]; nSprite != -1; nSprite = nNextSprite) for (nSprite = headspritestat[kStatMarker]; nSprite != -1; nSprite = nNextSprite) {
{
nNextSprite = nextspritestat[nSprite]; nNextSprite = nextspritestat[nSprite];
switch (sprite[nSprite].type)
{ switch (sprite[nSprite].type) {
case 8: case kMarkerOff:
{ case kMarkerAxis:
int nOwner = sprite[nSprite].owner; case kMarkerWarpDest: {
if (nOwner >= 0 && nOwner < numsectors) int nOwner = sprite[nSprite].owner;
{ if (nOwner >= 0 && nOwner < numsectors) {
int nXSector = sector[nOwner].extra; int nXSector = sector[nOwner].extra;
if (nXSector > 0 && nXSector < kMaxXSectors) if (nXSector > 0 && nXSector < kMaxXSectors) {
{ xsector[nXSector].marker0 = nSprite;
xsector[nXSector].at2c_0 = nSprite; continue;
continue; }
}
}
break;
case kMarkerOn: {
int nOwner = sprite[nSprite].owner;
if (nOwner >= 0 && nOwner < numsectors) {
int nXSector = sector[nOwner].extra;
if (nXSector > 0 && nXSector < kMaxXSectors) {
xsector[nXSector].marker1 = nSprite;
continue;
}
} }
} }
break; break;
} }
case 3:
{
int nOwner = sprite[nSprite].owner;
if (nOwner >= 0 && nOwner < numsectors)
{
int nXSector = sector[nOwner].extra;
if (nXSector > 0 && nXSector < kMaxXSectors)
{
xsector[nXSector].at2c_0 = nSprite;
continue;
}
}
break;
}
case 4:
{
int nOwner = sprite[nSprite].owner;
if (nOwner >= 0 && nOwner < numsectors)
{
int nXSector = sector[nOwner].extra;
if (nXSector > 0 && nXSector < kMaxXSectors)
{
xsector[nXSector].at2e_0 = nSprite;
continue;
}
}
break;
}
case 5:
{
int nOwner = sprite[nSprite].owner;
if (nOwner >= 0 && nOwner < numsectors)
{
int nXSector = sector[nOwner].extra;
if (nXSector > 0 && nXSector < kMaxXSectors)
{
xsector[nXSector].at2c_0 = nSprite;
continue;
}
}
break;
}
}
DeleteSprite(nSprite); DeleteSprite(nSprite);
} }
} }
@ -789,26 +758,28 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short
return -1; return -1;
} }
byte_1A76C8 = 0; byte_1A76C8 = 0;
if ((header.version & 0xff00) == 0x600) if ((header.version & 0xff00) == 0x700) {
{
}
else if ((header.version & 0xff00) == 0x700)
{
byte_1A76C8 = 1; byte_1A76C8 = 1;
}
else // by NoOne: indicate if the map requires modern features to work properly
{ // for maps wich created in PMAPEDIT BETA13 or higher versions. Since only minor version changed,
// the map is still can be loaded with vanilla BLOOD / MAPEDIT and should work in other ports too.
if ((header.version & 0x00ff) == 0x001) gModernMap = true;
else gModernMap = false;
} else {
initprintf("Map file is wrong version"); initprintf("Map file is wrong version");
gSysRes.Unlock(pNode); gSysRes.Unlock(pNode);
return -1; return -1;
} }
MAPHEADER mapHeader; MAPHEADER mapHeader;
IOBuffer1.Read(&mapHeader,37/* sizeof(mapHeader)*/); IOBuffer1.Read(&mapHeader,37/* sizeof(mapHeader)*/);
if (mapHeader.at16 != 0 && mapHeader.at16 != 0x7474614d && mapHeader.at16 != 0x4d617474) if (mapHeader.at16 != 0 && mapHeader.at16 != 0x7474614d && mapHeader.at16 != 0x4d617474) {
{
dbCrypt((char*)&mapHeader, sizeof(mapHeader), 0x7474614d); dbCrypt((char*)&mapHeader, sizeof(mapHeader), 0x7474614d);
byte_1A76C7 = 1; byte_1A76C7 = 1;
} }
#if B_BIG_ENDIAN == 1 #if B_BIG_ENDIAN == 1
mapHeader.at0 = B_LITTLE32(mapHeader.at0); mapHeader.at0 = B_LITTLE32(mapHeader.at0);
mapHeader.at4 = B_LITTLE32(mapHeader.at4); mapHeader.at4 = B_LITTLE32(mapHeader.at4);
@ -967,7 +938,7 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short
pXSector->at16_3 = bitReader.readUnsigned(1); pXSector->at16_3 = bitReader.readUnsigned(1);
pXSector->decoupled = bitReader.readUnsigned(1); pXSector->decoupled = bitReader.readUnsigned(1);
pXSector->triggerOnce = bitReader.readUnsigned(1); pXSector->triggerOnce = bitReader.readUnsigned(1);
pXSector->at16_6 = bitReader.readUnsigned(1); pXSector->isTriggered = bitReader.readUnsigned(1);
pXSector->Key = bitReader.readUnsigned(3); pXSector->Key = bitReader.readUnsigned(3);
pXSector->Push = bitReader.readUnsigned(1); pXSector->Push = bitReader.readUnsigned(1);
pXSector->Vector = bitReader.readUnsigned(1); pXSector->Vector = bitReader.readUnsigned(1);
@ -979,15 +950,15 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short
pXSector->at18_1 = bitReader.readUnsigned(1); pXSector->at18_1 = bitReader.readUnsigned(1);
pXSector->busyTimeB = bitReader.readUnsigned(12); pXSector->busyTimeB = bitReader.readUnsigned(12);
pXSector->waitTimeB = bitReader.readUnsigned(12); pXSector->waitTimeB = bitReader.readUnsigned(12);
pXSector->at1b_2 = bitReader.readUnsigned(1); pXSector->stopOn = bitReader.readUnsigned(1);
pXSector->at1b_3 = bitReader.readUnsigned(1); pXSector->stopOff = bitReader.readUnsigned(1);
pXSector->ceilpal = bitReader.readUnsigned(4); pXSector->ceilpal = bitReader.readUnsigned(4);
pXSector->at1c_0 = bitReader.readSigned(32); pXSector->at1c_0 = bitReader.readSigned(32);
pXSector->at20_0 = bitReader.readSigned(32); pXSector->at20_0 = bitReader.readSigned(32);
pXSector->at24_0 = bitReader.readSigned(32); pXSector->at24_0 = bitReader.readSigned(32);
pXSector->at28_0 = bitReader.readSigned(32); pXSector->at28_0 = bitReader.readSigned(32);
pXSector->at2c_0 = bitReader.readUnsigned(16); pXSector->marker0 = bitReader.readUnsigned(16);
pXSector->at2e_0 = bitReader.readUnsigned(16); pXSector->marker1 = bitReader.readUnsigned(16);
pXSector->Crush = bitReader.readUnsigned(1); pXSector->Crush = bitReader.readUnsigned(1);
pXSector->at30_1 = bitReader.readUnsigned(8); pXSector->at30_1 = bitReader.readUnsigned(8);
pXSector->at31_1 = bitReader.readUnsigned(8); pXSector->at31_1 = bitReader.readUnsigned(8);
@ -1012,7 +983,7 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short
// by NoOne: indicate if the map requires modern features to work properly // by NoOne: indicate if the map requires modern features to work properly
// for maps wich created in different editors (include vanilla MAPEDIT) or in PMAPEDIT version below than BETA13 // for maps wich created in different editors (include vanilla MAPEDIT) or in PMAPEDIT version below than BETA13
if (pXSector->rxID == kChannelMapExtended && pXSector->rxID == pXSector->txID && pXSector->command == kCommandMapExtend) if (pXSector->rxID == kChannelMapExtended && pXSector->rxID == pXSector->txID && pXSector->command == kCmdModernFeaturesEnable)
gModernMap = true; gModernMap = true;
} }
} }
@ -1091,7 +1062,7 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short
// by NoOne: indicate if the map requires modern features to work properly // by NoOne: indicate if the map requires modern features to work properly
// for maps wich created in different editors (include vanilla MAPEDIT) or in PMAPEDIT version below than BETA13 // for maps wich created in different editors (include vanilla MAPEDIT) or in PMAPEDIT version below than BETA13
if (pXWall->rxID == kChannelMapExtended && pXWall->rxID == pXWall->txID && pXWall->command == kCommandMapExtend) if (pXWall->rxID == kChannelMapExtended && pXWall->rxID == pXWall->txID && pXWall->command == kCmdModernFeaturesEnable)
gModernMap = true; gModernMap = true;
} }
} }
@ -1215,7 +1186,7 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short
// by NoOne: indicate if the map requires modern features to work properly // by NoOne: indicate if the map requires modern features to work properly
// for maps wich created in different editors (include vanilla MAPEDIT) or in PMAPEDIT version below than BETA13 // for maps wich created in different editors (include vanilla MAPEDIT) or in PMAPEDIT version below than BETA13
if (pXSprite->rxID == kChannelMapExtended && pXSprite->rxID == pXSprite->txID && pXSprite->command == kCommandMapExtend) if (pXSprite->rxID == kChannelMapExtended && pXSprite->rxID == pXSprite->txID && pXSprite->command == kCmdModernFeaturesEnable)
gModernMap = true; gModernMap = true;
} }
if ((sprite[i].cstat & 0x30) == 0x30) if ((sprite[i].cstat & 0x30) == 0x30)
@ -1486,7 +1457,7 @@ int dbSaveMap(const char *pPath, int nX, int nY, int nZ, short nAngle, short nSe
bitWriter.write(pXSector->at16_3, 1); bitWriter.write(pXSector->at16_3, 1);
bitWriter.write(pXSector->decoupled, 1); bitWriter.write(pXSector->decoupled, 1);
bitWriter.write(pXSector->triggerOnce, 1); bitWriter.write(pXSector->triggerOnce, 1);
bitWriter.write(pXSector->at16_6, 1); bitWriter.write(pXSector->isTriggered, 1);
bitWriter.write(pXSector->Key, 3); bitWriter.write(pXSector->Key, 3);
bitWriter.write(pXSector->Push, 1); bitWriter.write(pXSector->Push, 1);
bitWriter.write(pXSector->Vector, 1); bitWriter.write(pXSector->Vector, 1);
@ -1498,15 +1469,15 @@ int dbSaveMap(const char *pPath, int nX, int nY, int nZ, short nAngle, short nSe
bitWriter.write(pXSector->at18_1, 1); bitWriter.write(pXSector->at18_1, 1);
bitWriter.write(pXSector->busyTimeB, 12); bitWriter.write(pXSector->busyTimeB, 12);
bitWriter.write(pXSector->waitTimeB, 12); bitWriter.write(pXSector->waitTimeB, 12);
bitWriter.write(pXSector->at1b_2, 1); bitWriter.write(pXSector->stopOn, 1);
bitWriter.write(pXSector->at1b_3, 1); bitWriter.write(pXSector->stopOff, 1);
bitWriter.write(pXSector->ceilpal, 4); bitWriter.write(pXSector->ceilpal, 4);
bitWriter.write(pXSector->at1c_0, 32); bitWriter.write(pXSector->at1c_0, 32);
bitWriter.write(pXSector->at20_0, 32); bitWriter.write(pXSector->at20_0, 32);
bitWriter.write(pXSector->at24_0, 32); bitWriter.write(pXSector->at24_0, 32);
bitWriter.write(pXSector->at28_0, 32); bitWriter.write(pXSector->at28_0, 32);
bitWriter.write(pXSector->at2c_0, 16); bitWriter.write(pXSector->marker0, 16);
bitWriter.write(pXSector->at2e_0, 16); bitWriter.write(pXSector->marker1, 16);
bitWriter.write(pXSector->Crush, 1); bitWriter.write(pXSector->Crush, 1);
bitWriter.write(pXSector->at30_1, 8); bitWriter.write(pXSector->at30_1, 8);
bitWriter.write(pXSector->at31_1, 8); bitWriter.write(pXSector->at31_1, 8);

View file

@ -110,7 +110,7 @@ struct XSPRITE {
struct XSECTOR { struct XSECTOR {
signed int reference : 14; signed int reference : 14;
unsigned int state : 1; // State 0 unsigned int state : 1; // State
unsigned int busy : 17; unsigned int busy : 17;
unsigned int data : 16; // Data unsigned int data : 16; // Data
unsigned int txID : 10; // TX ID unsigned int txID : 10; // TX ID
@ -118,7 +118,7 @@ struct XSECTOR {
unsigned int at7_2 : 3; // OFF->ON wave unsigned int at7_2 : 3; // OFF->ON wave
unsigned int at7_5 : 3; // ON->OFF wave unsigned int at7_5 : 3; // ON->OFF wave
unsigned int command : 8; // Cmd 0 unsigned int command : 8; // Cmd
unsigned int triggerOn : 1; // Send at ON unsigned int triggerOn : 1; // Send at ON
unsigned int triggerOff : 1; // Send at OFF unsigned int triggerOff : 1; // Send at OFF
unsigned int busyTimeA : 12; // OFF->ON busyTime unsigned int busyTimeA : 12; // OFF->ON busyTime
@ -148,7 +148,7 @@ struct XSECTOR {
unsigned int at16_3 : 1; unsigned int at16_3 : 1;
unsigned int decoupled : 1; // Decoupled unsigned int decoupled : 1; // Decoupled
unsigned int triggerOnce : 1; // 1-shot unsigned int triggerOnce : 1; // 1-shot
unsigned int at16_6 : 1; unsigned int isTriggered : 1;
unsigned int Key : 3; // Key unsigned int Key : 3; // Key
unsigned int Push : 1; // Push unsigned int Push : 1; // Push
unsigned int Vector : 1; // Vector unsigned int Vector : 1; // Vector
@ -160,15 +160,15 @@ struct XSECTOR {
unsigned int at18_1 : 1; unsigned int at18_1 : 1;
unsigned int busyTimeB : 12; // ON->OFF busyTime unsigned int busyTimeB : 12; // ON->OFF busyTime
unsigned int waitTimeB : 12; // ON->OFF waitTime unsigned int waitTimeB : 12; // ON->OFF waitTime
unsigned int at1b_2 : 1; unsigned int stopOn : 1;
unsigned int at1b_3 : 1; unsigned int stopOff : 1;
unsigned int ceilpal : 4; // Ceil pal2 unsigned int ceilpal : 4; // Ceil pal2
signed int at1c_0 : 32; signed int at1c_0 : 32;
signed int at20_0 : 32; signed int at20_0 : 32;
signed int at24_0 : 32; signed int at24_0 : 32;
signed int at28_0 : 32; signed int at28_0 : 32;
unsigned int at2c_0 : 16; unsigned int marker0 : 16;
unsigned int at2e_0 : 16; unsigned int marker1 : 16;
unsigned int Crush : 1; // Crush unsigned int Crush : 1; // Crush
unsigned int at30_1 : 8; // Ceiling x panning frac unsigned int at30_1 : 8; // Ceiling x panning frac
unsigned int at31_1 : 8; // Ceiling y panning frac unsigned int at31_1 : 8; // Ceiling y panning frac

View file

@ -138,22 +138,41 @@ void CKillMgr::sub_263E0(int nCount)
at0 += nCount; at0 += nCount;
} }
void CKillMgr::AddKill(spritetype *pSprite) void CKillMgr::AddKill(spritetype *pSprite) {
{ if (pSprite->statnum == kStatDude) {
if (pSprite->statnum == kStatDude && pSprite->type != 219 && pSprite->type != 220 && pSprite->type != 245 && pSprite->type != 239) switch (pSprite->type) {
case kDudeBat:
case kDudeRat:
case kDudeBurningInnocent:
case kDudeInnocent:
return;
}
at4++; at4++;
}
} }
void CKillMgr::sub_2641C(void) void CKillMgr::sub_2641C(void)
{ {
at0 = 0; at0 = 0;
for (int nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite]) for (int nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite]) {
{
spritetype *pSprite = &sprite[nSprite]; spritetype *pSprite = &sprite[nSprite];
if (pSprite->type < kDudeBase || pSprite->type >= kDudeMax) if (pSprite->type < kDudeBase || pSprite->type >= kDudeMax)
ThrowError("Non-enemy sprite (%d) in the enemy sprite list.", nSprite); ThrowError("Non-enemy sprite (%d) in the enemy sprite list.", nSprite);
if (pSprite->statnum == kStatDude && pSprite->type != 219 && pSprite->type != 220 && pSprite->type != 245 && pSprite->type != 239)
if (pSprite->statnum == kStatDude) {
switch (pSprite->type) {
case kDudeBat:
case kDudeRat:
case kDudeBurningInnocent:
case kDudeInnocent:
return;
}
at0++; at0++;
}
} }
} }

View file

@ -68,7 +68,7 @@ void EventQueue::Kill(int a1, int a2)
void EventQueue::Kill(int a1, int a2, CALLBACK_ID a3) void EventQueue::Kill(int a1, int a2, CALLBACK_ID a3)
{ {
EVENT evn = { (unsigned int)a1, (unsigned int)a2, kCommandCallback, (unsigned int)a3 }; EVENT evn = { (unsigned int)a1, (unsigned int)a2, kCmdCallback, (unsigned int)a3 };
PQueue->Kill([=](EVENT nItem)->bool {return !memcmp(&nItem, &evn, sizeof(EVENT)); }); PQueue->Kill([=](EVENT nItem)->bool {return !memcmp(&nItem, &evn, sizeof(EVENT)); });
} }
@ -364,17 +364,17 @@ void evSend(int nIndex, int nType, int rxId, COMMAND_ID command)
EVENT event; event.index = nIndex; event.type = nType; event.cmd = command; EVENT event; event.index = nIndex; event.type = nType; event.cmd = command;
switch (command) { switch (command) {
case COMMAND_ID_2: case kCmdState:
command = evGetSourceState(nType, nIndex) ? COMMAND_ID_1 : COMMAND_ID_0; command = evGetSourceState(nType, nIndex) ? kCmdOn : kCmdOff;
break; break;
case COMMAND_ID_4: case kCmdNotState:
command = evGetSourceState(nType, nIndex) ? COMMAND_ID_0 : COMMAND_ID_1; command = evGetSourceState(nType, nIndex) ? kCmdOff : kCmdOn;
break; break;
} }
switch (rxId) { switch (rxId) {
case kChannelTextOver: case kChannelTextOver:
if (command >= COMMAND_ID_64) trTextOver(command - COMMAND_ID_64); if (command >= kCmdNumberic) trTextOver(command - kCmdNumberic);
else viewSetSystemMessage("Invalid TextOver command by xobject #%d (object type %d)", nIndex, nType); else viewSetSystemMessage("Invalid TextOver command by xobject #%d (object type %d)", nIndex, nType);
return; return;
case kChannelLevelExitNormal: case kChannelLevelExitNormal:
@ -385,15 +385,15 @@ void evSend(int nIndex, int nType, int rxId, COMMAND_ID command)
return; return;
// By NoOne: finished level and load custom level ¹ via numbered command. // By NoOne: finished level and load custom level ¹ via numbered command.
case kChannelModernEndLevelCustom: case kChannelModernEndLevelCustom:
if (command >= COMMAND_ID_64) levelEndLevelCustom(command - COMMAND_ID_64); if (command >= kCmdNumberic) levelEndLevelCustom(command - kCmdNumberic);
else viewSetSystemMessage("Invalid Level-Exit# command by xobject #%d (object type %d)", nIndex, nType); else viewSetSystemMessage("Invalid Level-Exit# command by xobject #%d (object type %d)", nIndex, nType);
return; return;
case kChannelSetTotalSecrets: case kChannelSetTotalSecrets:
if (command >= COMMAND_ID_64) levelSetupSecret(command - COMMAND_ID_64); if (command >= kCmdNumberic) levelSetupSecret(command - kCmdNumberic);
else viewSetSystemMessage("Invalid Total-Secrets command by xobject #%d (object type %d)", nIndex, nType); else viewSetSystemMessage("Invalid Total-Secrets command by xobject #%d (object type %d)", nIndex, nType);
break; break;
case kChannelSecretFound: case kChannelSecretFound:
if (command >= COMMAND_ID_64) levelTriggerSecret(command - COMMAND_ID_64); if (command >= kCmdNumberic) levelTriggerSecret(command - kCmdNumberic);
else viewSetSystemMessage("Invalid Trigger-Secret command by xobject #%d (object type %d)", nIndex, nType); else viewSetSystemMessage("Invalid Trigger-Secret command by xobject #%d (object type %d)", nIndex, nType);
break; break;
case kChannelRemoteBomb0: case kChannelRemoteBomb0:
@ -469,11 +469,11 @@ void evSend(int nIndex, int nType, int rxId, COMMAND_ID command)
void evPost(int nIndex, int nType, unsigned int nDelta, COMMAND_ID command) void evPost(int nIndex, int nType, unsigned int nDelta, COMMAND_ID command)
{ {
dassert(command != kCommandCallback); dassert(command != kCmdCallback);
if (command == COMMAND_ID_2) if (command == kCmdState)
command = evGetSourceState(nType, nIndex) ? COMMAND_ID_1 : COMMAND_ID_0; command = evGetSourceState(nType, nIndex) ? kCmdOn : kCmdOff;
else if (command == COMMAND_ID_4) else if (command == kCmdNotState)
command = evGetSourceState(nType, nIndex) ? COMMAND_ID_0 : COMMAND_ID_1; command = evGetSourceState(nType, nIndex) ? kCmdOff : kCmdOn;
EVENT evn = {}; EVENT evn = {};
evn.index = nIndex; evn.index = nIndex;
evn.type = nType; evn.type = nType;
@ -487,7 +487,7 @@ void evPost(int nIndex, int nType, unsigned int nDelta, CALLBACK_ID a4)
EVENT evn = {}; EVENT evn = {};
evn.index = nIndex; evn.index = nIndex;
evn.type = nType; evn.type = nType;
evn.cmd = kCommandCallback; evn.cmd = kCmdCallback;
evn.funcID = a4; evn.funcID = a4;
eventQ.PQueue->Insert((int)gFrameClock+nDelta, evn); eventQ.PQueue->Insert((int)gFrameClock+nDelta, evn);
} }
@ -509,7 +509,7 @@ void evProcess(unsigned int nTime)
while(eventQ.IsNotEmpty(nTime)) while(eventQ.IsNotEmpty(nTime))
{ {
EVENT event = eventQ.ERemove(); EVENT event = eventQ.ERemove();
if (event.cmd == kCommandCallback) if (event.cmd == kCmdCallback)
{ {
dassert(event.funcID < kCallbackMax); dassert(event.funcID < kCallbackMax);
dassert(gCallback[event.funcID] != NULL); dassert(gCallback[event.funcID] != NULL);

View file

@ -64,22 +64,43 @@ extern RXBUCKET rxBucket[];
extern unsigned short bucketHead[]; extern unsigned short bucketHead[];
enum COMMAND_ID { enum COMMAND_ID {
COMMAND_ID_0 = 0, kCmdOff = 0,
COMMAND_ID_1, kCmdOn = 1,
COMMAND_ID_2, kCmdState = 2,
COMMAND_ID_3, kCmdToggle = 3,
COMMAND_ID_4, kCmdNotState = 4,
COMMAND_ID_5, kCmdLink = 5,
COMMAND_ID_6, kCmdLock = 6,
COMMAND_ID_7, kCmdUnlock = 7,
COMMAND_ID_8, kCmdToggleLock = 8,
COMMAND_ID_9, kCmdStopOff = 9,
kCmdStopOn = 10,
kCmdStopNext = 11,
kCmdCounterSector = 12,
kCmdCallback = 20,
kCmdRepeat = 21,
kCmdSpritePush = 30,
kCmdSpriteImpact = 31,
kCmdSpritePickup = 32,
kCmdSpriteTouch = 33,
kCmdSpriteSight = 34,
kCmdSpriteProximity = 35,
kCmdSpriteExplode = 36,
kCmdSectorPush = 40,
kCmdSectorImpact = 41,
kCmdSectorEnter = 42,
kCmdSectorExit = 43,
kCommandCallback = 20, kCmdWallPush = 50,
COMMAND_ID_21, kCmdWallImpact = 51,
kGDXCommandPaste = 53, // used by some new GDX types kCmdWallTouch = 52,
COMMAND_ID_64 = 64,
kCommandMapExtend = 100 kCmdModernUse = 53, // used by most of modern types
kCmdNumberic = 64, // 64: 0, 65: 1 and so on up to 255
kCmdModernFeaturesEnable = 100, // must be in object with kChannelMapExtended RX / TX
kCmdModernFeaturesDisable = 200 // must be in object with kChannelMapExtended RX / TX
}; };
struct EVENT { struct EVENT {

View file

@ -60,63 +60,63 @@ struct FXDATA {
}; };
FXDATA gFXData[] = { FXDATA gFXData[] = {
{ CALLBACK_ID_NONE, 0, 49, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackNone, 0, 49, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_NONE, 0, 50, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackNone, 0, 50, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_NONE, 0, 51, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackNone, 0, 51, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_NONE, 0, 52, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackNone, 0, 52, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_NONE, 0, 7, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackNone, 0, 7, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_NONE, 0, 44, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackNone, 0, 44, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_NONE, 0, 45, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackNone, 0, 45, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_NONE, 0, 46, 1, -128, 8192, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackNone, 0, 46, 1, -128, 8192, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_NONE, 2, 6, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackNone, 2, 6, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_NONE, 2, 42, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackNone, 2, 42, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_NONE, 2, 43, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackNone, 2, 43, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_NONE, 1, 48, 3, -256, 8192, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackNone, 1, 48, 3, -256, 8192, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_NONE, 1, 60, 3, -256, 8192, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackNone, 1, 60, 3, -256, 8192, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_14, 2, 0, 1, 46603, 2048, 480, 2154, 40, 40, 0, -12, 0 }, { kCallbackFXBloodBits, 2, 0, 1, 46603, 2048, 480, 2154, 40, 40, 0, -12, 0 },
{ CALLBACK_ID_NONE, 2, 0, 3, 46603, 5120, 480, 2269, 24, 24, 0, -128, 0 }, { kCallbackNone, 2, 0, 3, 46603, 5120, 480, 2269, 24, 24, 0, -128, 0 },
{ CALLBACK_ID_NONE, 2, 0, 3, 46603, 5120, 480, 1720, 24, 24, 0, -128, 0 }, { kCallbackNone, 2, 0, 3, 46603, 5120, 480, 1720, 24, 24, 0, -128, 0 },
{ CALLBACK_ID_NONE, 1, 0, 1, 58254, 3072, 480, 2280, 48, 48, 0, -128, 0 }, { kCallbackNone, 1, 0, 1, 58254, 3072, 480, 2280, 48, 48, 0, -128, 0 },
{ CALLBACK_ID_NONE, 1, 0, 1, 58254, 3072, 480, 3135, 48, 48, 0, -128, 0 }, { kCallbackNone, 1, 0, 1, 58254, 3072, 480, 3135, 48, 48, 0, -128, 0 },
{ CALLBACK_ID_NONE, 0, 0, 3, 58254, 1024, 480, 3261, 32, 32, 0, 0, 0 }, { kCallbackNone, 0, 0, 3, 58254, 1024, 480, 3261, 32, 32, 0, 0, 0 },
{ CALLBACK_ID_NONE, 1, 0, 3, 58254, 1024, 480, 3265, 32, 32, 0, 0, 0 }, { kCallbackNone, 1, 0, 3, 58254, 1024, 480, 3265, 32, 32, 0, 0, 0 },
{ CALLBACK_ID_NONE, 1, 0, 3, 58254, 1024, 480, 3269, 32, 32, 0, 0, 0 }, { kCallbackNone, 1, 0, 3, 58254, 1024, 480, 3269, 32, 32, 0, 0, 0 },
{ CALLBACK_ID_NONE, 1, 0, 3, 58254, 1024, 480, 3273, 32, 32, 0, 0, 0 }, { kCallbackNone, 1, 0, 3, 58254, 1024, 480, 3273, 32, 32, 0, 0, 0 },
{ CALLBACK_ID_NONE, 1, 0, 3, 58254, 1024, 480, 3277, 32, 32, 0, 0, 0 }, { kCallbackNone, 1, 0, 3, 58254, 1024, 480, 3277, 32, 32, 0, 0, 0 },
{ CALLBACK_ID_NONE, 2, 0, 1, -27962, 8192, 600, 1128, 16, 16, 514, -16, 0 }, // bubble 1 { kCallbackNone, 2, 0, 1, -27962, 8192, 600, 1128, 16, 16, 514, -16, 0 }, // bubble 1
{ CALLBACK_ID_NONE, 2, 0, 1, -18641, 8192, 600, 1128, 12, 12, 514, -16, 0 }, // bubble 2 { kCallbackNone, 2, 0, 1, -18641, 8192, 600, 1128, 12, 12, 514, -16, 0 }, // bubble 2
{ CALLBACK_ID_NONE, 2, 0, 1, -9320, 8192, 600, 1128, 8, 8, 514, -16, 0 }, // bubble 3 { kCallbackNone, 2, 0, 1, -9320, 8192, 600, 1128, 8, 8, 514, -16, 0 }, // bubble 3
{ CALLBACK_ID_NONE, 2, 0, 1, -18641, 8192, 600, 1131, 32, 32, 514, -16, 0 }, { kCallbackNone, 2, 0, 1, -18641, 8192, 600, 1131, 32, 32, 514, -16, 0 },
{ CALLBACK_ID_14, 2, 0, 3, 27962, 4096, 480, 733, 32, 32, 0, -16, 0 }, { kCallbackFXBloodBits, 2, 0, 3, 27962, 4096, 480, 733, 32, 32, 0, -16, 0 },
{ CALLBACK_ID_NONE, 1, 0, 3, 18641, 4096, 120, 2261, 12, 12, 0, -128, 0 }, { kCallbackNone, 1, 0, 3, 18641, 4096, 120, 2261, 12, 12, 0, -128, 0 },
{ CALLBACK_ID_NONE, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackNone, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_NONE, 1, 0, 3, 58254, 3328, 480, 2185, 48, 48, 0, 0, 0 }, { kCallbackNone, 1, 0, 3, 58254, 3328, 480, 2185, 48, 48, 0, 0, 0 },
{ CALLBACK_ID_NONE, 0, 0, 3, 58254, 1024, 480, 2620, 48, 48, 0, 0, 0 }, { kCallbackNone, 0, 0, 3, 58254, 1024, 480, 2620, 48, 48, 0, 0, 0 },
{ CALLBACK_ID_NONE, 1, 55, 1, -13981, 5120, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackNone, 1, 55, 1, -13981, 5120, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_NONE, 1, 56, 1, -13981, 5120, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackNone, 1, 56, 1, -13981, 5120, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_NONE, 1, 57, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackNone, 1, 57, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_NONE, 1, 58, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackNone, 1, 58, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_NONE, 2, 0, 0, 0, 0, 960, 956, 32, 32, 610, 0, 0 }, { kCallbackNone, 2, 0, 0, 0, 0, 960, 956, 32, 32, 610, 0, 0 },
{ CALLBACK_ID_16, 2, 62, 0, 46603, 1024, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackFXBouncingSleeve, 2, 62, 0, 46603, 1024, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_16, 2, 63, 0, 46603, 1024, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackFXBouncingSleeve, 2, 63, 0, 46603, 1024, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_16, 2, 64, 0, 46603, 1024, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackFXBouncingSleeve, 2, 64, 0, 46603, 1024, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_16, 2, 65, 0, 46603, 1024, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackFXBouncingSleeve, 2, 65, 0, 46603, 1024, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_16, 2, 66, 0, 46603, 1024, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackFXBouncingSleeve, 2, 66, 0, 46603, 1024, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_16, 2, 67, 0, 46603, 1024, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackFXBouncingSleeve, 2, 67, 0, 46603, 1024, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_NONE, 1, 0, 3, 0, 0, 0, 838, 16, 16, 80, -8, 0 }, { kCallbackNone, 1, 0, 3, 0, 0, 0, 838, 16, 16, 80, -8, 0 },
{ CALLBACK_ID_NONE, 0, 0, 3, 34952, 8192, 0, 2078, 64, 64, 0, -8, 0 }, { kCallbackNone, 0, 0, 3, 34952, 8192, 0, 2078, 64, 64, 0, -8, 0 },
{ CALLBACK_ID_NONE, 0, 0, 3, 34952, 8192, 0, 1106, 64, 64, 0, -8, 0 }, { kCallbackNone, 0, 0, 3, 34952, 8192, 0, 1106, 64, 64, 0, -8, 0 },
{ CALLBACK_ID_NONE, 0, 0, 3, 58254, 3328, 480, 2406, 48, 48, 0, 0, 0 }, { kCallbackNone, 0, 0, 3, 58254, 3328, 480, 2406, 48, 48, 0, 0, 0 },
{ CALLBACK_ID_NONE, 1, 0, 3, 46603, 4096, 480, 3511, 64, 64, 0, -128, 0 }, { kCallbackNone, 1, 0, 3, 46603, 4096, 480, 3511, 64, 64, 0, -128, 0 },
{ CALLBACK_ID_NONE, 0, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackNone, 0, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_NONE, 2, 11, 3, -256, 8192, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackNone, 2, 11, 3, -256, 8192, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_NONE, 2, 11, 3, 0, 8192, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackNone, 2, 11, 3, 0, 8192, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_NONE, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { kCallbackNone, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ CALLBACK_ID_NONE, 1, 30, 3, 0, 0, 0, 0, 40, 40, 80, -8, 0 }, { kCallbackNone, 1, 30, 3, 0, 0, 0, 0, 40, 40, 80, -8, 0 },
{ CALLBACK_ID_19, 2, 0, 3, 27962, 4096, 480, 4023, 32, 32, 0, -16, 0 }, { kCallbackFXPodBloodSplat, 2, 0, 3, 27962, 4096, 480, 4023, 32, 32, 0, -16, 0 },
{ CALLBACK_ID_19, 2, 0, 3, 27962, 4096, 480, 4028, 32, 32, 0, -16, 0 }, { kCallbackFXPodBloodSplat, 2, 0, 3, 27962, 4096, 480, 4028, 32, 32, 0, -16, 0 },
{ CALLBACK_ID_NONE, 2, 0, 0, 0, 0, 480, 926, 32, 32, 610, -12, 0 }, { kCallbackNone, 2, 0, 0, 0, 0, 480, 926, 32, 32, 610, -12, 0 },
{ CALLBACK_ID_NONE, 1, 70, 1, -13981, 5120, 0, 0, 0, 0, 0, 0, 0 } { kCallbackNone, 1, 70, 1, -13981, 5120, 0, 0, 0, 0, 0, 0, 0 }
}; };
void CFX::sub_73FB0(int nSprite) void CFX::sub_73FB0(int nSprite)
@ -199,7 +199,7 @@ spritetype * CFX::fxSpawn(FX_ID nFx, int nSector, int x, int y, int z, unsigned
if (a6 == 0) if (a6 == 0)
a6 = pFX->ate; a6 = pFX->ate;
if (a6) if (a6)
evPost((int)pSprite->index, 3, a6+Random2(a6>>1), CALLBACK_ID_1); evPost((int)pSprite->index, 3, a6+Random2(a6>>1), kCallbackRemove);
return pSprite; return pSprite;
} }
@ -288,7 +288,7 @@ void fxSpawnBlood(spritetype *pSprite, int a2)
xvel[pBlood->index] = Random2(0x6aaaa); xvel[pBlood->index] = Random2(0x6aaaa);
yvel[pBlood->index] = Random2(0x6aaaa); yvel[pBlood->index] = Random2(0x6aaaa);
zvel[pBlood->index] = -Random(0x10aaaa)-100; zvel[pBlood->index] = -Random(0x10aaaa)-100;
evPost(pBlood->index, 3, 8, CALLBACK_ID_6); evPost(pBlood->index, 3, 8, kCallbackFXBloodSpurt);
} }
} }
@ -303,7 +303,7 @@ void sub_746D4(spritetype *pSprite, int a2)
if (gbAdultContent && gGameOptions.nGameType <= 0) if (gbAdultContent && gGameOptions.nGameType <= 0)
return; return;
spritetype *pSpawn; spritetype *pSpawn;
if (pSprite->type == 221) if (pSprite->type == kDudePodGreen)
pSpawn = gFX.fxSpawn(FX_53, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); pSpawn = gFX.fxSpawn(FX_53, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
else else
pSpawn = gFX.fxSpawn(FX_54, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); pSpawn = gFX.fxSpawn(FX_54, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
@ -313,7 +313,7 @@ void sub_746D4(spritetype *pSprite, int a2)
xvel[pSpawn->index] = Random2(0x6aaaa); xvel[pSpawn->index] = Random2(0x6aaaa);
yvel[pSpawn->index] = Random2(0x6aaaa); yvel[pSpawn->index] = Random2(0x6aaaa);
zvel[pSpawn->index] = -Random(0x10aaaa)-100; zvel[pSpawn->index] = -Random(0x10aaaa)-100;
evPost(pSpawn->index, 3, 8, CALLBACK_ID_18); evPost(pSpawn->index, 3, 8, kCallbackFXPodBloodSpray);
} }
} }

View file

@ -363,11 +363,10 @@ void GibFX(spritetype *pSprite, GIBFX *pGFX, CGibPosition *pPos, CGibVelocity *p
void GibThing(spritetype *pSprite, GIBTHING *pGThing, CGibPosition *pPos, CGibVelocity *pVel) void GibThing(spritetype *pSprite, GIBTHING *pGThing, CGibPosition *pPos, CGibVelocity *pVel)
{ {
if (gbAdultContent && gGameOptions.nGameType <= 0) if (gbAdultContent && gGameOptions.nGameType <= 0)
switch (pGThing->at0) switch (pGThing->at0) {
{ case kThingBloodBits:
case 425: case kThingZombieHead:
case 427: return;
return;
} }
if (pGThing->chance == 65536 || Chance(pGThing->chance)) if (pGThing->chance == 65536 || Chance(pGThing->chance))

View file

@ -787,7 +787,7 @@ void CCheatMgr::Process(CCheatMgr::CHEATCODE nCheatCode, char* pzArgs)
case kCheatMcGee: case kCheatMcGee:
{ {
if (!gMe->pXSprite->burnTime) if (!gMe->pXSprite->burnTime)
evPost(gMe->at5b, 3, 0, CALLBACK_ID_0); evPost(gMe->at5b, 3, 0, kCallbackFXFlameLick);
actBurnSprite(actSpriteIdToOwnerId(gMe->at5b), gMe->pXSprite, 2400); actBurnSprite(actSpriteIdToOwnerId(gMe->at5b), gMe->pXSprite, 2400);
viewSetMessage("You're fired!"); viewSetMessage("You're fired!");
break; break;
@ -801,7 +801,7 @@ void CCheatMgr::Process(CCheatMgr::CHEATCODE nCheatCode, char* pzArgs)
actHealDude(gMe->pXSprite, 200, 200); actHealDude(gMe->pXSprite, 200, 200);
gMe->at33e[1] = VanillaMode() ? 200 : 3200; gMe->at33e[1] = VanillaMode() ? 200 : 3200;
if (!gMe->pXSprite->burnTime) if (!gMe->pXSprite->burnTime)
evPost(gMe->at5b, 3, 0, CALLBACK_ID_0); evPost(gMe->at5b, 3, 0, kCallbackFXFlameLick);
actBurnSprite(actSpriteIdToOwnerId(gMe->at5b), gMe->pXSprite, 2400); actBurnSprite(actSpriteIdToOwnerId(gMe->at5b), gMe->pXSprite, 2400);
viewSetMessage("Flame retardant!"); viewSetMessage("Flame retardant!");
break; break;

View file

@ -100,7 +100,7 @@ void InitMirrors(void)
int nTile = 4080+mirrorcnt; int nTile = 4080+mirrorcnt;
if (wall[i].overpicnum == 504) if (wall[i].overpicnum == 504)
{ {
if (wall[i].extra > 0 && GetWallType(i) == 501) if (wall[i].extra > 0 && GetWallType(i) == kWallStack)
{ {
wall[i].overpicnum = nTile; wall[i].overpicnum = nTile;
mirror[mirrorcnt].at14 = i; mirror[mirrorcnt].at14 = i;
@ -112,7 +112,7 @@ void InitMirrors(void)
{ {
if (j == i) if (j == i)
continue; continue;
if (wall[j].extra > 0 && GetWallType(i) == 501) if (wall[j].extra > 0 && GetWallType(i) == kWallStack)
{ {
if (tmp != xwall[wall[j].extra].data) if (tmp != xwall[wall[j].extra].data)
continue; continue;
@ -374,7 +374,7 @@ void DrawMirrors(int x, int y, int z, fix16_t a, fix16_t horiz, int smooth, int
sector[mirrorsector].floorz = sector[nSector].floorz; sector[mirrorsector].floorz = sector[nSector].floorz;
sector[mirrorsector].ceilingz = sector[nSector].ceilingz; sector[mirrorsector].ceilingz = sector[nSector].ceilingz;
int cx, cy, ca; int cx, cy, ca;
if (GetWallType(nWall) == 501) if (GetWallType(nWall) == kWallStack)
{ {
cx = x - (wall[pWall->hitag].x-wall[pWall->point2].x); cx = x - (wall[pWall->hitag].x-wall[pWall->point2].x);
cy = y - (wall[pWall->hitag].y-wall[pWall->point2].y); cy = y - (wall[pWall->hitag].y-wall[pWall->point2].y);
@ -393,7 +393,7 @@ void DrawMirrors(int x, int y, int z, fix16_t a, fix16_t horiz, int smooth, int
yax_drawrooms(viewProcessSprites, mirrorsector, didmirror, smooth); yax_drawrooms(viewProcessSprites, mirrorsector, didmirror, smooth);
viewProcessSprites(cx,cy,z,fix16_to_int(ca),smooth); viewProcessSprites(cx,cy,z,fix16_to_int(ca),smooth);
renderDrawMasks(); renderDrawMasks();
if (GetWallType(nWall) != 501) if (GetWallType(nWall) != kWallStack)
renderCompleteMirror(); renderCompleteMirror();
if (wall[nWall].pal != 0 || wall[nWall].shade != 0) if (wall[nWall].pal != 0 || wall[nWall].shade != 0)
TranslateMirrorColors(wall[nWall].shade, wall[nWall].pal); TranslateMirrorColors(wall[nWall].shade, wall[nWall].pal);

View file

@ -473,55 +473,57 @@ char powerupActivate(PLAYER *pPlayer, int nPowerUp)
int nPack = powerupToPackItem(nPowerUp); int nPack = powerupToPackItem(nPowerUp);
if (nPack >= 0) if (nPack >= 0)
pPlayer->packInfo[nPack].at0 = 1; pPlayer->packInfo[nPack].at0 = 1;
switch (nPowerUp+100)
{ switch (nPowerUp + kItemBase) {
case kGDXItemMapLevel: case kItemModernMapLevel:
gFullMap = true; if (gModernMap) gFullMap = true;
break; break;
case 130: case kItemShroomShrink:
if (isGrown(pPlayer->pSprite)) deactivateSizeShrooms(pPlayer); if (!gModernMap) break;
else shrinkPlayerSize(pPlayer, 2); else if (isGrown(pPlayer->pSprite)) deactivateSizeShrooms(pPlayer);
break; else shrinkPlayerSize(pPlayer, 2);
case 129: break;
if (isShrinked(pPlayer->pSprite)) deactivateSizeShrooms(pPlayer); case kItemShroomGrow:
else { if (!gModernMap) break;
growPlayerSize(pPlayer, 2); else if (isShrinked(pPlayer->pSprite)) deactivateSizeShrooms(pPlayer);
if (powerupCheck(&gPlayer[pPlayer->pSprite->type - kDudePlayer1], 13) > 0) { else {
powerupDeactivate(pPlayer, 13); growPlayerSize(pPlayer, 2);
pPlayer->at202[13] = 0; if (powerupCheck(&gPlayer[pPlayer->pSprite->type - kDudePlayer1], 13) > 0) {
} powerupDeactivate(pPlayer, 13);
pPlayer->at202[13] = 0;
}
if (ceilIsTooLow(pPlayer->pSprite)) if (ceilIsTooLow(pPlayer->pSprite))
actDamageSprite(pPlayer->pSprite->xvel, pPlayer->pSprite, DAMAGE_TYPE_3, 65535); actDamageSprite(pPlayer->pSprite->xvel, pPlayer->pSprite, DAMAGE_TYPE_3, 65535);
} }
break; break;
case 112: case kItemFeatherFall:
case 115: // jump boots case kItemJumpBoots:
pPlayer->ata1[0]++; pPlayer->ata1[0]++;
break; break;
case 124: // reflective shots case kItemReflectShots: // reflective shots
if (pPlayer == gMe && gGameOptions.nGameType == 0) if (pPlayer == gMe && gGameOptions.nGameType == 0)
sfxSetReverb2(1); sfxSetReverb2(1);
break; break;
case 114: // death mask case kItemDeathMask:
for (int i = 0; i < 7; i++) for (int i = 0; i < 7; i++)
pPlayer->ata1[i]++; pPlayer->ata1[i]++;
break; break;
case 118: // diving suit case kItemDivingSuit: // diving suit
pPlayer->ata1[4]++; pPlayer->ata1[4]++;
if (pPlayer == gMe && gGameOptions.nGameType == 0) if (pPlayer == gMe && gGameOptions.nGameType == 0)
sfxSetReverb(1); sfxSetReverb(1);
break; break;
case 119: case kItemGasMask:
pPlayer->ata1[4]++; pPlayer->ata1[4]++;
break; break;
case 139: case kItemArmorAsbest:
pPlayer->ata1[1]++; pPlayer->ata1[1]++;
break; break;
case 117: // guns akimbo case kItemTwoGuns:
pPlayer->atc.newWeapon = pPlayer->atbd; pPlayer->atc.newWeapon = pPlayer->atbd;
WeaponRaise(pPlayer); WeaponRaise(pPlayer);
break; break;
} }
sfxPlay3DSound(pPlayer->pSprite, 776, -1, 0); sfxPlay3DSound(pPlayer->pSprite, 776, -1, 0);
return 1; return 1;
@ -532,43 +534,45 @@ void powerupDeactivate(PLAYER *pPlayer, int nPowerUp)
int nPack = powerupToPackItem(nPowerUp); int nPack = powerupToPackItem(nPowerUp);
if (nPack >= 0) if (nPack >= 0)
pPlayer->packInfo[nPack].at0 = 0; pPlayer->packInfo[nPack].at0 = 0;
switch (nPowerUp+100)
{ switch (nPowerUp + kItemBase) {
case 130: case kItemShroomShrink:
resetPlayerSize(pPlayer); if (gModernMap) {
if (ceilIsTooLow(pPlayer->pSprite)) resetPlayerSize(pPlayer);
actDamageSprite(pPlayer->pSprite->xvel, pPlayer->pSprite, DAMAGE_TYPE_3, 65535); if (ceilIsTooLow(pPlayer->pSprite))
break; actDamageSprite(pPlayer->pSprite->xvel, pPlayer->pSprite, DAMAGE_TYPE_3, 65535);
case 129: }
resetPlayerSize(pPlayer); break;
break; case kItemShroomGrow:
case 112: if (gModernMap) resetPlayerSize(pPlayer);
case 115: // jump boots break;
pPlayer->ata1[0]--; case kItemFeatherFall:
break; case kItemJumpBoots:
case 114: // death mask pPlayer->ata1[0]--;
for (int i = 0; i < 7; i++) break;
pPlayer->ata1[i]--; case kItemDeathMask:
break; for (int i = 0; i < 7; i++)
case 118: // diving suit pPlayer->ata1[i]--;
pPlayer->ata1[4]--; break;
if (pPlayer == gMe && VanillaMode() ? true : pPlayer->at202[24] == 0) case kItemDivingSuit:
sfxSetReverb(0); pPlayer->ata1[4]--;
break; if (pPlayer == gMe && VanillaMode() ? true : pPlayer->at202[24] == 0)
case 124: // reflective shots sfxSetReverb(0);
if (pPlayer == gMe && VanillaMode() ? true : pPlayer->packInfo[1].at0 == 0) break;
sfxSetReverb(0); case kItemReflectShots:
break; if (pPlayer == gMe && VanillaMode() ? true : pPlayer->packInfo[1].at0 == 0)
case 119: sfxSetReverb(0);
pPlayer->ata1[4]--; break;
break; case kItemGasMask:
case 139: pPlayer->ata1[4]--;
pPlayer->ata1[1]--; break;
break; case kItemArmorAsbest:
case 117: // guns akimbo pPlayer->ata1[1]--;
pPlayer->atc.newWeapon = pPlayer->atbd; break;
WeaponRaise(pPlayer); case kItemTwoGuns:
break; pPlayer->atc.newWeapon = pPlayer->atbd;
WeaponRaise(pPlayer);
break;
} }
} }
@ -1061,79 +1065,67 @@ char sub_3A158(PLAYER *a1, spritetype *a2)
if (a2 && a2->index == nSprite) if (a2 && a2->index == nSprite)
continue; continue;
spritetype *pSprite = &sprite[nSprite]; spritetype *pSprite = &sprite[nSprite];
if (pSprite->type == 431 && actOwnerIdToSpriteId(pSprite->owner) == a1->at5b) if (pSprite->type == kThingDroppedLifeLeech && actOwnerIdToSpriteId(pSprite->owner) == a1->at5b)
return 1; return 1;
} }
return 0; return 0;
} }
char PickupItem(PLAYER *pPlayer, spritetype *pItem) char PickupItem(PLAYER *pPlayer, spritetype *pItem) {
{
char buffer[80]; spritetype *pSprite = pPlayer->pSprite; XSPRITE *pXSprite = pPlayer->pXSprite;
int pickupSnd = 775; char buffer[80]; int pickupSnd = 775; int nType = pItem->type - kItemBase;
spritetype *pSprite = pPlayer->pSprite;
XSPRITE *pXSprite = pPlayer->pXSprite; switch (pItem->type) {
int nType = pItem->type - 100; case kItemShadowCloak:
switch (pItem->type) if (isGrown(pPlayer->pSprite)) return false;
{ case kItemShroomShrink:
//case 129: case kItemShroomGrow:
//dudeInfo[31].seqStartID = 13568; if (gModernMap) {
//if (!powerupActivate(pPlayer, nType)) switch (pItem->type) {
//return 0; case kItemShroomShrink:
//return 1; if (isShrinked(pSprite)) return false;
case 113: break;
if (isGrown(pPlayer->pSprite)) return false; case kItemShroomGrow:
case 130: if (isGrown(pSprite)) return false;
case 129: break;
switch (pItem->type) { }
case 130: powerupActivate(pPlayer, nType);
if (isShrinked(pSprite)) return false; }
break; break;
case 129: case kItemFlagABase:
if (isGrown(pSprite)) return false; case kItemFlagBBase: {
break; if (gGameOptions.nGameType != 3 || pItem->extra <= 0) return 0;
} XSPRITE * pXItem = &xsprite[pItem->extra];
powerupActivate(pPlayer, nType); if (pItem->type == kItemFlagABase) {
break; if (pPlayer->at2ea == 1) {
case 145: if ((pPlayer->at90 & 1) == 0 && pXItem->state) {
case 146:
if (gGameOptions.nGameType != 3)
return 0;
if (pItem->extra > 0)
{
XSPRITE *pXItem = &xsprite[pItem->extra];
if (pItem->type == 145)
{
if (pPlayer->at2ea == 1)
{
if ((pPlayer->at90&1) == 0 && pXItem->state)
{
pPlayer->at90 |= 1; pPlayer->at90 |= 1;
pPlayer->at91[0] = pItem->index; pPlayer->at91[0] = pItem->index;
trTriggerSprite(pItem->index, pXItem, 0); trTriggerSprite(pItem->index, pXItem, kCmdOff);
sprintf(buffer, "%s stole Blue Flag", gProfile[pPlayer->at57].name); sprintf(buffer, "%s stole Blue Flag", gProfile[pPlayer->at57].name);
sndStartSample(8007, 255, 2, 0); sndStartSample(8007, 255, 2, 0);
viewSetMessage(buffer); viewSetMessage(buffer);
} }
} }
if (pPlayer->at2ea == 0)
{ if (pPlayer->at2ea == 0) {
if ((pPlayer->at90&1) != 0 && !pXItem->state)
{ if ((pPlayer->at90 & 1) != 0 && !pXItem->state) {
pPlayer->at90 &= ~1; pPlayer->at90 &= ~1;
pPlayer->at91[0] = -1; pPlayer->at91[0] = -1;
trTriggerSprite(pItem->index, pXItem, 1); trTriggerSprite(pItem->index, pXItem, kCmdOn);
sprintf(buffer, "%s returned Blue Flag", gProfile[pPlayer->at57].name); sprintf(buffer, "%s returned Blue Flag", gProfile[pPlayer->at57].name);
sndStartSample(8003, 255, 2, 0); sndStartSample(8003, 255, 2, 0);
viewSetMessage(buffer); viewSetMessage(buffer);
} }
if ((pPlayer->at90&2) != 0 && pXItem->state)
{ if ((pPlayer->at90 & 2) != 0 && pXItem->state) {
pPlayer->at90 &= ~2; pPlayer->at90 &= ~2;
pPlayer->at91[1] = -1; pPlayer->at91[1] = -1;
dword_21EFB0[pPlayer->at2ea] += 10; dword_21EFB0[pPlayer->at2ea] += 10;
dword_21EFD0[pPlayer->at2ea] += 240; dword_21EFD0[pPlayer->at2ea] += 240;
evSend(0, 0, 81, COMMAND_ID_1); evSend(0, 0, 81, kCmdOn);
sprintf(buffer, "%s captured Red Flag!", gProfile[pPlayer->at57].name); sprintf(buffer, "%s captured Red Flag!", gProfile[pPlayer->at57].name);
sndStartSample(8001, 255, 2, 0); sndStartSample(8001, 255, 2, 0);
viewSetMessage(buffer); viewSetMessage(buffer);
@ -1146,39 +1138,38 @@ char PickupItem(PLAYER *pPlayer, spritetype *pItem)
#endif #endif
} }
} }
} }
else if (pItem->type == 146) else if (pItem->type == kItemFlagBBase) {
{
if (pPlayer->at2ea == 0) if (pPlayer->at2ea == 0) {
{ if ((pPlayer->at90 & 2) == 0 && pXItem->state) {
if((pPlayer->at90&2) == 0 && pXItem->state)
{
pPlayer->at90 |= 2; pPlayer->at90 |= 2;
pPlayer->at91[1] = pItem->index; pPlayer->at91[1] = pItem->index;
trTriggerSprite(pItem->index, pXItem, 0); trTriggerSprite(pItem->index, pXItem, kCmdOff);
sprintf(buffer, "%s stole Red Flag", gProfile[pPlayer->at57].name); sprintf(buffer, "%s stole Red Flag", gProfile[pPlayer->at57].name);
sndStartSample(8006, 255, 2, 0); sndStartSample(8006, 255, 2, 0);
viewSetMessage(buffer); viewSetMessage(buffer);
} }
} }
if (pPlayer->at2ea == 1)
{ if (pPlayer->at2ea == 1) {
if ((pPlayer->at90&2) != 0 && !pXItem->state) if ((pPlayer->at90 & 2) != 0 && !pXItem->state)
{ {
pPlayer->at90 &= ~2; pPlayer->at90 &= ~2;
pPlayer->at91[1] = -1; pPlayer->at91[1] = -1;
trTriggerSprite(pItem->index, pXItem, 1); trTriggerSprite(pItem->index, pXItem, kCmdOn);
sprintf(buffer, "%s returned Red Flag", gProfile[pPlayer->at57].name); sprintf(buffer, "%s returned Red Flag", gProfile[pPlayer->at57].name);
sndStartSample(8002, 255, 2, 0); sndStartSample(8002, 255, 2, 0);
viewSetMessage(buffer); viewSetMessage(buffer);
} }
if ((pPlayer->at90&1) != 0 && pXItem->state) if ((pPlayer->at90 & 1) != 0 && pXItem->state)
{ {
pPlayer->at90 &= ~1; pPlayer->at90 &= ~1;
pPlayer->at91[0] = -1; pPlayer->at91[0] = -1;
dword_21EFB0[pPlayer->at2ea] += 10; dword_21EFB0[pPlayer->at2ea] += 10;
dword_21EFD0[pPlayer->at2ea] += 240; dword_21EFD0[pPlayer->at2ea] += 240;
evSend(0, 0, 80, COMMAND_ID_1); evSend(0, 0, 80, kCmdOn);
sprintf(buffer, "%s captured Blue Flag!", gProfile[pPlayer->at57].name); sprintf(buffer, "%s captured Blue Flag!", gProfile[pPlayer->at57].name);
sndStartSample(8000, 255, 2, 0); sndStartSample(8000, 255, 2, 0);
viewSetMessage(buffer); viewSetMessage(buffer);
@ -1194,135 +1185,119 @@ char PickupItem(PLAYER *pPlayer, spritetype *pItem)
} }
} }
return 0; return 0;
case 147: case kItemFlagA:
if (gGameOptions.nGameType != 3) if (gGameOptions.nGameType != 3) return 0;
return 0; evKill(pItem->index, 3, kCallbackReturnFlag);
evKill(pItem->index, 3, CALLBACK_ID_17); pPlayer->at90 |= 1;
pPlayer->at90 |= 1; pPlayer->at91[0] = pItem->index;
pPlayer->at91[0] = pItem->index; gBlueFlagDropped = false;
gBlueFlagDropped = false; break;
break; case kItemFlagB:
case 148: if (gGameOptions.nGameType != 3) return 0;
if (gGameOptions.nGameType != 3) evKill(pItem->index, 3, kCallbackReturnFlag);
return 0; pPlayer->at90 |= 2;
evKill(pItem->index, 3, CALLBACK_ID_17); pPlayer->at91[1] = pItem->index;
pPlayer->at90 |= 2; gRedFlagDropped = false;
pPlayer->at91[1] = pItem->index; break;
gRedFlagDropped = false; case kItemArmorBasic:
break; case kItemArmorBody:
case 140: case kItemArmorFire:
case 141: case kItemArmorSpirit:
case 142: case kItemArmorSuper: {
case 143: ARMORDATA *pArmorData = &armorData[pItem->type - kItemArmorBasic]; bool pickedUp = false;
case 144: if (pPlayer->at33e[1] < pArmorData->atc) {
{ pPlayer->at33e[1] = ClipHigh(pPlayer->at33e[1]+pArmorData->at8, pArmorData->atc);
ARMORDATA *pArmorData = &armorData[pItem->type-140]; pickedUp = true;
char va = 0; }
if (pPlayer->at33e[1] < pArmorData->atc)
{ if (pPlayer->at33e[0] < pArmorData->at4) {
pPlayer->at33e[1] = ClipHigh(pPlayer->at33e[1]+pArmorData->at8, pArmorData->atc); pPlayer->at33e[0] = ClipHigh(pPlayer->at33e[0]+pArmorData->at0, pArmorData->at4);
va = 1; pickedUp = true;
}
if (pPlayer->at33e[2] < pArmorData->at14) {
pPlayer->at33e[2] = ClipHigh(pPlayer->at33e[2]+pArmorData->at10, pArmorData->at14);
pickedUp = true;
}
if (!pickedUp) return 0;
pickupSnd = 779;
break;
} }
if (pPlayer->at33e[0] < pArmorData->at4) case kItemCrystalBall:
{ if (gGameOptions.nGameType == 0 || !packAddItem(pPlayer, gItemData[nType].at8)) return 0;
pPlayer->at33e[0] = ClipHigh(pPlayer->at33e[0]+pArmorData->at0, pArmorData->at4); break;
va = 1; case kItemKeySkull:
case kItemKeyEye:
case kItemKeyFire:
case kItemKeyDagger:
case kItemKeySpider:
case kItemKeyMoon:
case kItemKeyKey7:
if (pPlayer->at88[pItem->type-99]) return 0;
pPlayer->at88[pItem->type-99] = 1;
pickupSnd = 781;
break;
case kItemHealthMedPouch:
case kItemHealthLifeEssense:
case kItemHealthLifeSeed:
case kItemHealthRedPotion: {
int addPower = gPowerUpInfo[nType].at3;
// by NoOne: allow custom amount for item
if (gModernMap && sprite[pItem->xvel].extra >= 0 && xsprite[sprite[pItem->xvel].extra].data1 > 0)
addPower = xsprite[sprite[pItem->xvel].extra].data1;
if (!actHealDude(pXSprite, addPower, gPowerUpInfo[nType].at7)) return 0;
return 1;
} }
if (pPlayer->at33e[2] < pArmorData->at14) case kItemHealthDoctorBag:
{ case kItemJumpBoots:
pPlayer->at33e[2] = ClipHigh(pPlayer->at33e[2]+pArmorData->at10, pArmorData->at14); case kItemDivingSuit:
va = 1; case kItemBeastVision:
} if (!packAddItem(pPlayer, gItemData[nType].at8)) return 0;
if (!va) break;
return 0; default:
pickupSnd = 779; if (!powerupActivate(pPlayer, nType)) return 0;
break; return 1;
}
case 121:
if (gGameOptions.nGameType == 0)
return 0;
if (!packAddItem(pPlayer, gItemData[nType].at8))
return 0;
break;
case 100:
case 101:
case 102:
case 103:
case 104:
case 105:
case 106:
if (pPlayer->at88[pItem->type-99])
return 0;
pPlayer->at88[pItem->type-99] = 1;
pickupSnd = 781;
break;
case 108:
case 109:
case 110:
case 111:
{
int addPower = gPowerUpInfo[nType].at3;
// by NoOne: allow custom amount for item
if (sprite[pItem->xvel].extra >= 0 && xsprite[sprite[pItem->xvel].extra].data1 > 0 && !VanillaMode() && !DemoRecordStatus())
addPower = xsprite[sprite[pItem->xvel].extra].data1;
if (!actHealDude(pXSprite, addPower, gPowerUpInfo[nType].at7))
return 0;
return 1;
}
case 107:
case 115:
case 118:
case 125:
if (!packAddItem(pPlayer, gItemData[nType].at8))
return 0;
break;
default:
if (!powerupActivate(pPlayer, nType))
return 0;
return 1;
} }
sfxPlay3DSound(pSprite->x, pSprite->y, pSprite->z, pickupSnd, pSprite->sectnum); sfxPlay3DSound(pSprite->x, pSprite->y, pSprite->z, pickupSnd, pSprite->sectnum);
return 1; return 1;
} }
char PickupAmmo(PLAYER* pPlayer, spritetype* pAmmo) char PickupAmmo(PLAYER* pPlayer, spritetype* pAmmo) {
{ AMMOITEMDATA* pAmmoItemData = &gAmmoItemData[pAmmo->type - kItemAmmoBase];
AMMOITEMDATA* pAmmoItemData = &gAmmoItemData[pAmmo->type - 60];
int nAmmoType = pAmmoItemData->ata; int nAmmoType = pAmmoItemData->ata;
if (pPlayer->at181[nAmmoType] >= gAmmoInfo[nAmmoType].at0) return 0; if (pPlayer->at181[nAmmoType] >= gAmmoInfo[nAmmoType].at0) return 0;
else if (pAmmo->extra < 0 || xsprite[pAmmo->extra].data1 <= 0 || VanillaMode() || DemoRecordStatus()) else if (!gModernMap || pAmmo->extra < 0 || xsprite[pAmmo->extra].data1 <= 0)
pPlayer->at181[nAmmoType] = ClipHigh(pPlayer->at181[nAmmoType]+pAmmoItemData->at8, gAmmoInfo[nAmmoType].at0); pPlayer->at181[nAmmoType] = ClipHigh(pPlayer->at181[nAmmoType]+pAmmoItemData->at8, gAmmoInfo[nAmmoType].at0);
// by NoOne: allow custom amount for item // by NoOne: allow custom amount for item
else else
pPlayer->at181[nAmmoType] = ClipHigh(pPlayer->at181[nAmmoType] + xsprite[pAmmo->extra].data1, gAmmoInfo[nAmmoType].at0); pPlayer->at181[nAmmoType] = ClipHigh(pPlayer->at181[nAmmoType] + xsprite[pAmmo->extra].data1, gAmmoInfo[nAmmoType].at0);
if (pAmmoItemData->atb) if (pAmmoItemData->atb) pPlayer->atcb[pAmmoItemData->atb] = 1;
pPlayer->atcb[pAmmoItemData->atb] = 1;
sfxPlay3DSound(pPlayer->pSprite, 782, -1, 0); sfxPlay3DSound(pPlayer->pSprite, 782, -1, 0);
return 1; return 1;
} }
char PickupWeapon(PLAYER *pPlayer, spritetype *pWeapon) char PickupWeapon(PLAYER *pPlayer, spritetype *pWeapon) {
{ WEAPONITEMDATA *pWeaponItemData = &gWeaponItemData[pWeapon->type - kItemWeaponBase];
WEAPONITEMDATA *pWeaponItemData = &gWeaponItemData[pWeapon->type-40];
int nWeaponType = pWeaponItemData->at8; int nWeaponType = pWeaponItemData->at8;
int nAmmoType = pWeaponItemData->ata; int nAmmoType = pWeaponItemData->ata;
if (!pPlayer->atcb[nWeaponType] || gGameOptions.nWeaponSettings == 2 || gGameOptions.nWeaponSettings == 3) if (!pPlayer->atcb[nWeaponType] || gGameOptions.nWeaponSettings == 2 || gGameOptions.nWeaponSettings == 3) {
{ if (pWeapon->type == kItemWeaponLifeLeech && gGameOptions.nGameType > 1 && sub_3A158(pPlayer, NULL))
if (pWeapon->type == 50 && gGameOptions.nGameType > 1 && sub_3A158(pPlayer, NULL))
return 0; return 0;
pPlayer->atcb[nWeaponType] = 1; pPlayer->atcb[nWeaponType] = 1;
if (nAmmoType == -1) return 0; if (nAmmoType == -1) return 0;
// By NoOne: allow to set custom ammo count for weapon pickups // By NoOne: allow to set custom ammo count for weapon pickups
if (pWeapon->extra < 0 || xsprite[pWeapon->extra].data1 <= 0 || VanillaMode() || DemoRecordStatus()) if (!gModernMap || pWeapon->extra < 0 || xsprite[pWeapon->extra].data1 <= 0)
pPlayer->at181[nAmmoType] = ClipHigh(pPlayer->at181[nAmmoType] + pWeaponItemData->atc, gAmmoInfo[nAmmoType].at0); pPlayer->at181[nAmmoType] = ClipHigh(pPlayer->at181[nAmmoType] + pWeaponItemData->atc, gAmmoInfo[nAmmoType].at0);
else else
pPlayer->at181[nAmmoType] = ClipHigh(pPlayer->at181[nAmmoType] + xsprite[pWeapon->extra].data1, gAmmoInfo[nAmmoType].at0); pPlayer->at181[nAmmoType] = ClipHigh(pPlayer->at181[nAmmoType] + xsprite[pWeapon->extra].data1, gAmmoInfo[nAmmoType].at0);
int nNewWeapon = WeaponUpgrade(pPlayer, nWeaponType); int nNewWeapon = WeaponUpgrade(pPlayer, nWeaponType);
if (nNewWeapon != pPlayer->atbd) if (nNewWeapon != pPlayer->atbd) {
{
pPlayer->atc3 = 0; pPlayer->atc3 = 0;
pPlayer->atbe = nNewWeapon; pPlayer->atbe = nNewWeapon;
} }
@ -1331,7 +1306,7 @@ char PickupWeapon(PLAYER *pPlayer, spritetype *pWeapon)
} }
if (!actGetRespawnTime(pWeapon) || nAmmoType == -1 || pPlayer->at181[nAmmoType] >= gAmmoInfo[nAmmoType].at0) return 0; if (!actGetRespawnTime(pWeapon) || nAmmoType == -1 || pPlayer->at181[nAmmoType] >= gAmmoInfo[nAmmoType].at0) return 0;
else if (pWeapon->extra < 0 || xsprite[pWeapon->extra].data1 <= 0 || VanillaMode() || DemoRecordStatus()) else if (!gModernMap || pWeapon->extra < 0 || xsprite[pWeapon->extra].data1 <= 0)
pPlayer->at181[nAmmoType] = ClipHigh(pPlayer->at181[nAmmoType]+pWeaponItemData->atc, gAmmoInfo[nAmmoType].at0); pPlayer->at181[nAmmoType] = ClipHigh(pPlayer->at181[nAmmoType]+pWeaponItemData->atc, gAmmoInfo[nAmmoType].at0);
else else
pPlayer->at181[nAmmoType] = ClipHigh(pPlayer->at181[nAmmoType] + xsprite[pWeapon->extra].data1, gAmmoInfo[nAmmoType].at0); pPlayer->at181[nAmmoType] = ClipHigh(pPlayer->at181[nAmmoType] + xsprite[pWeapon->extra].data1, gAmmoInfo[nAmmoType].at0);
@ -1346,41 +1321,40 @@ void PickUp(PLAYER *pPlayer, spritetype *pSprite)
int nType = pSprite->type; int nType = pSprite->type;
char pickedUp = 0; char pickedUp = 0;
int customMsg = -1; int customMsg = -1;
XSPRITE* pXSprite = (pSprite->extra >= 0) ? &xsprite[pSprite->extra] : NULL;
if (pXSprite != NULL && pXSprite->txID != 3 && pXSprite->lockMsg > 0) // by NoOne: allow custom INI message instead "Picked up"
customMsg = pXSprite->lockMsg;
if (nType >= 100 && nType <= 149) if (gModernMap) { // by NoOne: allow custom INI message instead "Picked up"
{ XSPRITE* pXSprite = (pSprite->extra >= 0) ? &xsprite[pSprite->extra] : NULL;
if (pXSprite != NULL && pXSprite->txID != 3 && pXSprite->lockMsg > 0)
customMsg = pXSprite->lockMsg;
}
if (nType >= kItemBase && nType <= kItemMax) {
pickedUp = PickupItem(pPlayer, pSprite); pickedUp = PickupItem(pPlayer, pSprite);
if (pickedUp && customMsg == -1) sprintf(buffer, "Picked up %s", gItemText[nType - 100]); if (pickedUp && customMsg == -1) sprintf(buffer, "Picked up %s", gItemText[nType - 100]);
}
else if (nType >= 60 && nType < 81) } else if (nType >= kItemAmmoBase && nType < kItemAmmoMax) {
{
pickedUp = PickupAmmo(pPlayer, pSprite); pickedUp = PickupAmmo(pPlayer, pSprite);
if (pickedUp && customMsg == -1) sprintf(buffer, "Picked up %s", gAmmoText[nType - 60]); if (pickedUp && customMsg == -1) sprintf(buffer, "Picked up %s", gAmmoText[nType - kItemAmmoBase]);
}
else if (nType >= 40 && nType < 51) } else if (nType >= kItemWeaponBase && nType < kItemWeaponMax) {
{
pickedUp = PickupWeapon(pPlayer, pSprite); pickedUp = PickupWeapon(pPlayer, pSprite);
if (pickedUp && customMsg == -1) sprintf(buffer, "Picked up %s", gWeaponText[nType - 40]); if (pickedUp && customMsg == -1) sprintf(buffer, "Picked up %s", gWeaponText[nType - kItemWeaponBase]);
} }
if (pickedUp) if (!pickedUp) return;
{ else if (pSprite->extra > 0) {
if (pSprite->extra > 0) XSPRITE *pXSprite = &xsprite[pSprite->extra];
{ if (pXSprite->Pickup)
XSPRITE *pXSprite = &xsprite[pSprite->extra]; trTriggerSprite(pSprite->index, pXSprite, kCmdSpritePickup);
if (pXSprite->Pickup) }
trTriggerSprite(pSprite->index, pXSprite, 32);
} if (!actCheckRespawn(pSprite))
if (!actCheckRespawn(pSprite)) actPostSprite(pSprite->index, kStatFree);
actPostSprite(pSprite->index, kStatFree);
pPlayer->at377 = 30; pPlayer->at377 = 30;
if (pPlayer == gMe) if (pPlayer == gMe) {
if (customMsg > 0) trTextOver(customMsg - 1); if (customMsg > 0) trTextOver(customMsg - 1);
else viewSetMessage(buffer, 0, MESSAGE_PRIORITY_PICKUP); else viewSetMessage(buffer, 0, MESSAGE_PRIORITY_PICKUP);
} }
} }
@ -1392,8 +1366,7 @@ void CheckPickUp(PLAYER *pPlayer)
int z = pSprite->z; int z = pSprite->z;
int nSector = pSprite->sectnum; int nSector = pSprite->sectnum;
int nNextSprite; int nNextSprite;
for (int nSprite = headspritestat[kStatItem]; nSprite >= 0; nSprite = nNextSprite) for (int nSprite = headspritestat[kStatItem]; nSprite >= 0; nSprite = nNextSprite) {
{
spritetype *pItem = &sprite[nSprite]; spritetype *pItem = &sprite[nSprite];
nNextSprite = nextspritestat[nSprite]; nNextSprite = nextspritestat[nSprite];
if (pItem->flags&32) if (pItem->flags&32)
@ -1444,7 +1417,7 @@ int ActionScan(PLAYER *pPlayer, int *a2, int *a3)
{ {
spritetype *pSprite = &sprite[*a2]; spritetype *pSprite = &sprite[*a2];
XSPRITE *pXSprite = &xsprite[*a3]; XSPRITE *pXSprite = &xsprite[*a3];
if (pSprite->type == 431) if (pSprite->type == kThingDroppedLifeLeech)
{ {
if (gGameOptions.nGameType > 1 && sub_3A158(pPlayer, pSprite)) if (gGameOptions.nGameType > 1 && sub_3A158(pPlayer, pSprite))
return -1; return -1;
@ -1467,7 +1440,7 @@ int ActionScan(PLAYER *pPlayer, int *a2, int *a3)
zvel[*a2] += mulscale16(z, t2); zvel[*a2] += mulscale16(z, t2);
} }
if (pXSprite->Push && !pXSprite->state && !pXSprite->isTriggered) if (pXSprite->Push && !pXSprite->state && !pXSprite->isTriggered)
trTriggerSprite(*a2, pXSprite, 30); trTriggerSprite(*a2, pXSprite, kCmdSpritePush);
} }
break; break;
case 0: case 0:
@ -1541,7 +1514,7 @@ void ProcessInput(PLAYER *pPlayer)
else if (seqGetStatus(3, pPlayer->pSprite->extra) < 0) else if (seqGetStatus(3, pPlayer->pSprite->extra) < 0)
{ {
if (pPlayer->pSprite) if (pPlayer->pSprite)
pPlayer->pSprite->type = 426; pPlayer->pSprite->type = kThingBloodChunks;
actPostSprite(pPlayer->at5b, kStatThing); actPostSprite(pPlayer->at5b, kStatThing);
seqSpawn(pPlayer->pDudeInfo->seqStartID+15, 3, pPlayer->pSprite->extra, -1); seqSpawn(pPlayer->pDudeInfo->seqStartID+15, 3, pPlayer->pSprite->extra, -1);
playerReset(pPlayer); playerReset(pPlayer);
@ -1682,7 +1655,7 @@ void ProcessInput(PLAYER *pPlayer)
sndStartSample(3062, 255, 2, 0); sndStartSample(3062, 255, 2, 0);
} }
if (!key || pPlayer->at88[key]) if (!key || pPlayer->at88[key])
trTriggerSector(a2, pXSector, 30); trTriggerSector(a2, pXSector, kCmdSpritePush);
else if (pPlayer == gMe) else if (pPlayer == gMe)
{ {
viewSetMessage("That requires a key."); viewSetMessage("That requires a key.");
@ -1700,7 +1673,7 @@ void ProcessInput(PLAYER *pPlayer)
sndStartSample(3062, 255, 2, 0); sndStartSample(3062, 255, 2, 0);
} }
if (!key || pPlayer->at88[key]) if (!key || pPlayer->at88[key])
trTriggerWall(a2, pXWall, 50); trTriggerWall(a2, pXWall, kCmdWallPush);
else if (pPlayer == gMe) else if (pPlayer == gMe)
{ {
viewSetMessage("That requires a key."); viewSetMessage("That requires a key.");
@ -1715,7 +1688,7 @@ void ProcessInput(PLAYER *pPlayer)
if (pXSprite->locked && pPlayer == gMe && pXSprite->lockMsg) if (pXSprite->locked && pPlayer == gMe && pXSprite->lockMsg)
trTextOver(pXSprite->lockMsg); trTextOver(pXSprite->lockMsg);
if (!key || pPlayer->at88[key]) if (!key || pPlayer->at88[key])
trTriggerSprite(a2, pXSprite, 30); trTriggerSprite(a2, pXSprite, kCmdSpritePush);
else if (pPlayer == gMe) else if (pPlayer == gMe)
{ {
viewSetMessage("That requires a key."); viewSetMessage("That requires a key.");
@ -1728,7 +1701,7 @@ void ProcessInput(PLAYER *pPlayer)
pPlayer->at372 = ClipLow(pPlayer->at372-4*(6-gGameOptions.nDifficulty), 0); pPlayer->at372 = ClipLow(pPlayer->at372-4*(6-gGameOptions.nDifficulty), 0);
if (pPlayer->at372 <= 0 && pPlayer->at376) if (pPlayer->at372 <= 0 && pPlayer->at376)
{ {
spritetype *pSprite2 = actSpawnDude(pPlayer->pSprite, 212, pPlayer->pSprite->clipdist<<1, 0); spritetype *pSprite2 = actSpawnDude(pPlayer->pSprite, kDudeHand, pPlayer->pSprite->clipdist<<1, 0);
pSprite2->ang = (pPlayer->pSprite->ang+1024)&2047; pSprite2->ang = (pPlayer->pSprite->ang+1024)&2047;
int nSprite = pPlayer->pSprite->index; int nSprite = pPlayer->pSprite->index;
int x = Cos(pPlayer->pSprite->ang)>>16; int x = Cos(pPlayer->pSprite->ang)>>16;
@ -2087,16 +2060,16 @@ void FragPlayer(PLAYER *pPlayer, int nSprite)
if (nTeam1 == 0) if (nTeam1 == 0)
{ {
if (nTeam1 != nTeam2) if (nTeam1 != nTeam2)
evSend(0, 0, 15, COMMAND_ID_3); evSend(0, 0, 15, kCmdToggle);
else else
evSend(0, 0, 16, COMMAND_ID_3); evSend(0, 0, 16, kCmdToggle);
} }
else else
{ {
if (nTeam1 == nTeam2) if (nTeam1 == nTeam2)
evSend(0, 0, 16, COMMAND_ID_3); evSend(0, 0, 16, kCmdToggle);
else else
evSend(0, 0, 15, COMMAND_ID_3); evSend(0, 0, 15, kCmdToggle);
} }
} }
} }
@ -2128,9 +2101,9 @@ spritetype *sub_40A94(PLAYER *pPlayer, int a2)
spritetype *pSprite = NULL; spritetype *pSprite = NULL;
switch (a2) switch (a2)
{ {
case 147: case kItemFlagA:
pPlayer->at90 &= ~1; pPlayer->at90 &= ~1;
pSprite = actDropObject(pPlayer->pSprite, 147); pSprite = actDropObject(pPlayer->pSprite, kItemFlagA);
if (pSprite) if (pSprite)
pSprite->owner = pPlayer->at91[0]; pSprite->owner = pPlayer->at91[0];
gBlueFlagDropped = true; gBlueFlagDropped = true;
@ -2138,9 +2111,9 @@ spritetype *sub_40A94(PLAYER *pPlayer, int a2)
sndStartSample(8005, 255, 2, 0); sndStartSample(8005, 255, 2, 0);
viewSetMessage(buffer); viewSetMessage(buffer);
break; break;
case 148: case kItemFlagB:
pPlayer->at90 &= ~2; pPlayer->at90 &= ~2;
pSprite = actDropObject(pPlayer->pSprite, 148); pSprite = actDropObject(pPlayer->pSprite, kItemFlagB);
if (pSprite) if (pSprite)
pSprite->owner = pPlayer->at91[1]; pSprite->owner = pPlayer->at91[1];
gRedFlagDropped = true; gRedFlagDropped = true;
@ -2226,12 +2199,9 @@ int playerDamageSprite(int nSource, PLAYER *pPlayer, DAMAGE_TYPE nDamageType, in
return nDamage; return nDamage;
} }
sfxKill3DSound(pPlayer->pSprite, -1, 441); sfxKill3DSound(pPlayer->pSprite, -1, 441);
if (gGameOptions.nGameType == 3 && pPlayer->at90) if (gGameOptions.nGameType == 3 && pPlayer->at90) {
{ if (pPlayer->at90&1) sub_40A94(pPlayer, kItemFlagA);
if (pPlayer->at90&1) if (pPlayer->at90&2) sub_40A94(pPlayer, kItemFlagB);
sub_40A94(pPlayer, 147);
if (pPlayer->at90&2)
sub_40A94(pPlayer, 148);
} }
pPlayer->at1fe = 0; pPlayer->at1fe = 0;
pPlayer->at1b1 = 0; pPlayer->at1b1 = 0;
@ -2265,7 +2235,7 @@ int playerDamageSprite(int nSource, PLAYER *pPlayer, DAMAGE_TYPE nDamageType, in
nKneelingPlayer = nPlayerKneelClient; nKneelingPlayer = nPlayerKneelClient;
powerupActivate(pPlayer, 28); powerupActivate(pPlayer, 28);
pXSprite->target = nSource; pXSprite->target = nSource;
evPost(pSprite->index, 3, 15, CALLBACK_ID_13); evPost(pSprite->index, 3, 15, kCallbackFinishHim);
} }
else else
{ {
@ -2281,7 +2251,7 @@ int playerDamageSprite(int nSource, PLAYER *pPlayer, DAMAGE_TYPE nDamageType, in
{ {
powerupClear(pPlayer); powerupClear(pPlayer);
if (nXSector > 0 && xsector[nXSector].Exit) if (nXSector > 0 && xsector[nXSector].Exit)
trTriggerSector(pSprite->sectnum, &xsector[nXSector], 43); trTriggerSector(pSprite->sectnum, &xsector[nXSector], kCmdSectorExit);
pSprite->flags |= 7; pSprite->flags |= 7;
for (int p = connecthead; p >= 0; p = connectpoint2[p]) for (int p = connecthead; p >= 0; p = connectpoint2[p])
{ {
@ -2289,7 +2259,7 @@ int playerDamageSprite(int nSource, PLAYER *pPlayer, DAMAGE_TYPE nDamageType, in
gPlayer[p].at2ee = -1; gPlayer[p].at2ee = -1;
} }
FragPlayer(pPlayer, nSource); FragPlayer(pPlayer, nSource);
trTriggerSprite(nSprite, pXSprite, 0); trTriggerSprite(nSprite, pXSprite, kCmdOff);
} }
dassert(gSysRes.Lookup(pDudeInfo->seqStartID + nDeathSeqID, "SEQ") != NULL); dassert(gSysRes.Lookup(pDudeInfo->seqStartID + nDeathSeqID, "SEQ") != NULL);
seqSpawn(pDudeInfo->seqStartID+nDeathSeqID, 3, nXSprite, nKneelingPlayer); seqSpawn(pDudeInfo->seqStartID+nDeathSeqID, 3, nXSprite, nKneelingPlayer);

View file

@ -510,8 +510,8 @@ void seqProcess(int a1)
int nSprite = xsprite[nXSprite].reference; int nSprite = xsprite[nXSprite].reference;
dassert(nSprite >= 0 && nSprite < kMaxSprites); dassert(nSprite >= 0 && nSprite < kMaxSprites);
evKill(nSprite, 3); evKill(nSprite, 3);
if ((sprite[nSprite].flags & 16) && sprite[nSprite].inittype >= 200 && sprite[nSprite].inittype < 254) if ((sprite[nSprite].flags & 16) && sprite[nSprite].inittype >= kDudeBase && sprite[nSprite].inittype < kDudeMax)
evPost(nSprite, 3, gGameOptions.nMonsterSettings, (COMMAND_ID)9); evPost(nSprite, 3, gGameOptions.nMonsterSettings, kCallbackRespawn);
else else
DeleteSprite(nSprite); DeleteSprite(nSprite);
break; break;

File diff suppressed because it is too large Load diff

View file

@ -31,13 +31,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "dude.h" #include "dude.h"
BEGIN_BLD_NS BEGIN_BLD_NS
void trTriggerSector(unsigned int nSector, XSECTOR *pXSector, int command);
void trTriggerSector(unsigned int nSector, XSECTOR *pXSector, int a3); void trMessageSector(unsigned int nSector, EVENT event);
void trMessageSector(unsigned int nSector, EVENT a2); void trTriggerWall(unsigned int nWall, XWALL *pXWall, int command);
void trTriggerWall(unsigned int nWall, XWALL *pXWall, int a3); void trMessageWall(unsigned int nWall, EVENT event);
void trMessageWall(unsigned int nWall, EVENT a2); void trTriggerSprite(unsigned int nSprite, XSPRITE *pXSprite, int command);
void trTriggerSprite(unsigned int nSprite, XSPRITE *pXSprite, int a3); void trMessageSprite(unsigned int nSprite, EVENT event);
void trMessageSprite(unsigned int nSprite, EVENT a2);
void trProcessBusy(void); void trProcessBusy(void);
void trInit(void); void trInit(void);
void trTextOver(int nId); void trTextOver(int nId);

View file

@ -608,7 +608,7 @@ void fakeMoveDude(spritetype *pSprite)
if (nSector == -1) if (nSector == -1)
nSector = predict.at68; nSector = predict.at68;
if (sector[nSector].type >= 612 && sector[nSector].type <= 617) if (sector[nSector].type >= kSectorPath && sector[nSector].type <= kSectorRotate)
{ {
short nSector2 = nSector; short nSector2 = nSector;
pushmove_old((int32_t*)&predict.at50, (int32_t*)&predict.at54, (int32_t*)&predict.at58, &nSector2, wd, tz, bz, CLIPMASK0); pushmove_old((int32_t*)&predict.at50, (int32_t*)&predict.at54, (int32_t*)&predict.at58, &nSector2, wd, tz, bz, CLIPMASK0);
@ -2185,25 +2185,18 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t
pTSprite->ang = pPrevLoc->ang+mulscale16(((pTSprite->ang-pPrevLoc->ang+1024)&2047)-1024, gInterpolate); pTSprite->ang = pPrevLoc->ang+mulscale16(((pTSprite->ang-pPrevLoc->ang+1024)&2047)-1024, gInterpolate);
} }
int nAnim = 0; int nAnim = 0;
switch (picanm[nTile].extra&7) switch (picanm[nTile].extra & 7) {
{
case 0: case 0:
if (nXSprite > 0) //dassert(nXSprite > 0 && nXSprite < kMaxXSprites);
{ if (nXSprite <= 0 || nXSprite >= kMaxXSprites) break;
dassert(nXSprite < kMaxXSprites); switch (pTSprite->type) {
switch (pTSprite->type) case kSwitchToggle:
{ case kSwitchOneWay:
case 20: if (xsprite[nXSprite].state) nAnim = 1;
case 21:
if (xsprite[nXSprite].state)
{
nAnim = 1;
}
break; break;
case 22: case kSwitchCombo:
nAnim = xsprite[nXSprite].data1; nAnim = xsprite[nXSprite].data1;
break; break;
}
} }
break; break;
case 1: case 1:
@ -2362,145 +2355,106 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t
{ {
pTSprite->cstat |= 8; pTSprite->cstat |= 8;
} }
switch (pTSprite->statnum) switch (pTSprite->statnum) {
{ case kStatDecoration: {
case kStatDecoration: switch (pTSprite->type) {
{ case kDecorationCandle:
switch (pTSprite->type) if (!pTXSprite || pTXSprite->state == 1) {
{
case 32:
if (pTXSprite)
{
if (pTXSprite->state > 0)
{
pTSprite->shade = -128; pTSprite->shade = -128;
viewAddEffect(nTSprite, VIEW_EFFECT_11); viewAddEffect(nTSprite, VIEW_EFFECT_11);
} } else {
else
{
pTSprite->shade = -8; pTSprite->shade = -8;
} }
} break;
else case kDecorationTorch:
{ if (!pTXSprite || pTXSprite->state == 1) {
pTSprite->shade = -128;
viewAddEffect(nTSprite, VIEW_EFFECT_11);
}
break;
case 30:
if (pTXSprite)
{
if (pTXSprite->state > 0)
{
pTSprite->picnum++; pTSprite->picnum++;
viewAddEffect(nTSprite, VIEW_EFFECT_4); viewAddEffect(nTSprite, VIEW_EFFECT_4);
} } else {
else
{
viewAddEffect(nTSprite, VIEW_EFFECT_6); viewAddEffect(nTSprite, VIEW_EFFECT_6);
} }
} break;
else default:
{ if (pXSector && pXSector->color) pTSprite->pal = pSector->floorpal;
pTSprite->picnum++; break;
viewAddEffect(nTSprite, VIEW_EFFECT_4);
}
break;
default:
if (pXSector && pXSector->color)
{
pTSprite->pal = pSector->floorpal;
}
break;
} }
break;
} }
case kStatItem: break;
{ case kStatItem: {
switch (pTSprite->type) switch (pTSprite->type) {
{ case kItemFlagABase:
case 145: if (pTXSprite && pTXSprite->state > 0 && gGameOptions.nGameType == 3) {
if (pTXSprite && pTXSprite->state > 0 && gGameOptions.nGameType == 3) uspritetype *pNTSprite = viewAddEffect(nTSprite, VIEW_EFFECT_17);
{ if (pNTSprite) pNTSprite->pal = 10;
uspritetype *pNTSprite = viewAddEffect(nTSprite, VIEW_EFFECT_17);
if (pNTSprite)
pNTSprite->pal = 10;
}
break;
case 146:
if (pTXSprite && pTXSprite->state > 0 && gGameOptions.nGameType == 3)
{
uspritetype *pNTSprite = viewAddEffect(nTSprite, VIEW_EFFECT_17);
if (pNTSprite)
pNTSprite->pal = 7;
}
break;
case 147:
pTSprite->pal = 10;
pTSprite->cstat |= 1024;
break;
case 148:
pTSprite->pal = 7;
pTSprite->cstat |= 1024;
break;
default:
if (pTSprite->type >= 100 && pTSprite->type <= 106)
pTSprite->shade = -128;
if (pXSector && pXSector->color)
{
pTSprite->pal = pSector->floorpal;
}
break;
}
break;
}
case kStatProjectile:
{
switch (pTSprite->type)
{
case 302:
pTSprite->yrepeat = 128;
pTSprite->cstat |= 32;
break;
case 306:
viewAddEffect(nTSprite, VIEW_EFFECT_15);
break;
case 300:
viewAddEffect(nTSprite, VIEW_EFFECT_10);
break;
case 301:
case 303:
if (pTSprite->statnum == kStatFlare)
{
dassert(pTXSprite != NULL);
if (pTXSprite->target == gView->at5b)
{
pTSprite->xrepeat = 0;
break;
} }
} break;
viewAddEffect(nTSprite, VIEW_EFFECT_1); case kItemFlagBBase:
if (pTSprite->type == 301) if (pTXSprite && pTXSprite->state > 0 && gGameOptions.nGameType == 3) {
{ uspritetype *pNTSprite = viewAddEffect(nTSprite, VIEW_EFFECT_17);
if (pNTSprite) pNTSprite->pal = 7;
}
break;
case kItemFlagA:
pTSprite->pal = 10;
pTSprite->cstat |= 1024;
break;
case kItemFlagB:
pTSprite->pal = 7;
pTSprite->cstat |= 1024;
break;
default:
if (pTSprite->type >= kItemKeySkull && pTSprite->type < kItemKeyMax)
pTSprite->shade = -128;
if (pXSector && pXSector->color) {
pTSprite->pal = pSector->floorpal;
}
break;
}
}
break;
case kStatProjectile: {
switch (pTSprite->type) {
case kMissileTeslaAlt:
pTSprite->yrepeat = 128;
pTSprite->cstat |= 32;
break;
case kMissileTeslaRegular:
viewAddEffect(nTSprite, VIEW_EFFECT_15);
break;
case kMissileButcherKnife:
viewAddEffect(nTSprite, VIEW_EFFECT_10);
break;
case kMissileFlareRegular:
case kMissileFlareAlt:
if (pTSprite->statnum == kStatFlare) {
dassert(pTXSprite != NULL);
if (pTXSprite->target == gView->at5b) {
pTSprite->xrepeat = 0;
break;
}
}
viewAddEffect(nTSprite, VIEW_EFFECT_1);
if (pTSprite->type != kMissileFlareRegular) break;
sectortype *pSector = &sector[pTSprite->sectnum]; sectortype *pSector = &sector[pTSprite->sectnum];
int zDiff = (pTSprite->z-pSector->ceilingz)>>8;
if ((pSector->ceilingstat&1) == 0 && zDiff < 64) int zDiff = (pTSprite->z - pSector->ceilingz) >> 8;
{ if ((pSector->ceilingstat&1) == 0 && zDiff < 64) {
viewAddEffect(nTSprite, VIEW_EFFECT_2); viewAddEffect(nTSprite, VIEW_EFFECT_2);
} }
zDiff = (pSector->floorz-pTSprite->z)>>8;
if ((pSector->floorstat&1) == 0 && zDiff < 64) zDiff = (pSector->floorz - pTSprite->z) >> 8;
{ if ((pSector->floorstat&1) == 0 && zDiff < 64) {
viewAddEffect(nTSprite, VIEW_EFFECT_3); viewAddEffect(nTSprite, VIEW_EFFECT_3);
} }
break;
} }
break;
}
break; break;
} }
case kStatDude: case kStatDude:
{ {
if (pTSprite->type == 212 && pTXSprite->aiState == &hand13A3B4) if (pTSprite->type == kDudeHand && pTXSprite->aiState == &hand13A3B4)
{ {
spritetype *pTTarget = &sprite[pTXSprite->target]; spritetype *pTTarget = &sprite[pTXSprite->target];
dassert(pTXSprite != NULL && pTTarget != NULL); dassert(pTXSprite != NULL && pTTarget != NULL);
@ -2585,53 +2539,31 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t
} }
break; break;
} }
case kStatTraps: case kStatTraps: {
{ if (pTSprite->type == kTrapSawCircular) {
if (pTSprite->type == 454) if (pTXSprite->state) {
{ if (pTXSprite->data1) {
if (pTXSprite->state)
{
if (pTXSprite->data1)
{
pTSprite->picnum = 772; pTSprite->picnum = 772;
if (pTXSprite->data2) if (pTXSprite->data2)
{
viewAddEffect(nTSprite, VIEW_EFFECT_9); viewAddEffect(nTSprite, VIEW_EFFECT_9);
}
} }
} }
else else if (pTXSprite->data1) pTSprite->picnum = 773;
{ else pTSprite->picnum = 656;
if (pTXSprite->data1)
{
pTSprite->picnum = 773;
}
else
{
pTSprite->picnum = 656;
}
}
} }
break; break;
} }
case kStatThing: case kStatThing: {
{
if (pXSector && pXSector->color) if (pXSector && pXSector->color)
{
pTSprite->pal = pSector->floorpal; pTSprite->pal = pSector->floorpal;
if (pTSprite->type < kThingBase || pTSprite->type >= kThingMax || !gSpriteHit[nXSprite].florhit) {
if ((pTSprite->flags & kPhysMove) && getflorzofslope(pTSprite->sectnum, pTSprite->x, pTSprite->y) >= cZ)
viewAddEffect(nTSprite, VIEW_EFFECT_0);
} }
if (pTSprite->flags&1)
{
if (getflorzofslope(pTSprite->sectnum, pTSprite->x, pTSprite->y) >= cZ)
{
if (pTSprite->type < 400 || pTSprite->type >= 433 || !gSpriteHit[nXSprite].florhit)
{
viewAddEffect(nTSprite, VIEW_EFFECT_0);
}
}
}
break;
} }
break;
} }
} }
@ -3364,20 +3296,15 @@ RORHACKOTHER:
nSprite = nextspritestat[nSprite]; nSprite = nextspritestat[nSprite];
} }
nSprite = headspritestat[kStatProjectile]; nSprite = headspritestat[kStatProjectile];
while (nSprite >= 0) while (nSprite >= 0) {
{
spritetype *pSprite = &sprite[nSprite]; spritetype *pSprite = &sprite[nSprite];
switch (pSprite->type) switch (pSprite->type) {
{ case kMissileFlareRegular:
case 301: case kMissileTeslaAlt:
case 302: case kMissileFlareAlt:
case 303: case kMissileTeslaRegular:
case 306: if (TestBitString(gotsector, pSprite->sectnum)) unk += 256;
if (TestBitString(gotsector, pSprite->sectnum)) break;
{
unk += 256;
}
break;
} }
nSprite = nextspritestat[nSprite]; nSprite = nextspritestat[nSprite];
} }

View file

@ -51,90 +51,85 @@ void warpInit(void)
int team1 = 0; int team2 = 0; // increment if team start positions specified. int team1 = 0; int team2 = 0; // increment if team start positions specified.
for (int nSprite = 0; nSprite < kMaxSprites; nSprite++) for (int nSprite = 0; nSprite < kMaxSprites; nSprite++)
{ {
if (sprite[nSprite].statnum < kMaxStatus) if (sprite[nSprite].statnum < kMaxStatus) {
{
spritetype *pSprite = &sprite[nSprite]; spritetype *pSprite = &sprite[nSprite];
int nXSprite = pSprite->extra; int nXSprite = pSprite->extra;
if (nXSprite > 0) if (nXSprite > 0) {
{
XSPRITE *pXSprite = &xsprite[nXSprite]; XSPRITE *pXSprite = &xsprite[nXSprite];
switch (pSprite->type) switch (pSprite->type) {
{ case kMarkerSPStart:
case 1: if (gGameOptions.nGameType < 2 && pXSprite->data1 >= 0 && pXSprite->data1 < kMaxPlayers) {
if (gGameOptions.nGameType < 2 && pXSprite->data1 >= 0 && pXSprite->data1 < 8) ZONE *pZone = &gStartZone[pXSprite->data1];
{
ZONE *pZone = &gStartZone[pXSprite->data1];
pZone->x = pSprite->x;
pZone->y = pSprite->y;
pZone->z = pSprite->z;
pZone->sectnum = pSprite->sectnum;
pZone->ang = pSprite->ang;
}
DeleteSprite(nSprite);
break;
case 2:
if (pXSprite->data1 >= 0 && pXSprite->data2 < 8) {
if (gGameOptions.nGameType >= 2)
{
// default if BB or teams without data2 specified
ZONE* pZone = &gStartZone[pXSprite->data1];
pZone->x = pSprite->x; pZone->x = pSprite->x;
pZone->y = pSprite->y; pZone->y = pSprite->y;
pZone->z = pSprite->z; pZone->z = pSprite->z;
pZone->sectnum = pSprite->sectnum; pZone->sectnum = pSprite->sectnum;
pZone->ang = pSprite->ang; pZone->ang = pSprite->ang;
// By NoOne: fill player spawn position according team of player in TEAMS mode.
if (gGameOptions.nGameType == 3) {
if (pXSprite->data2 == 1) {
pZone = &gStartZoneTeam1[team1];
pZone->x = pSprite->x;
pZone->y = pSprite->y;
pZone->z = pSprite->z;
pZone->sectnum = pSprite->sectnum;
pZone->ang = pSprite->ang;
team1++;
} else if (pXSprite->data2 == 2) {
pZone = &gStartZoneTeam2[team2];
pZone->x = pSprite->x;
pZone->y = pSprite->y;
pZone->z = pSprite->z;
pZone->sectnum = pSprite->sectnum;
pZone->ang = pSprite->ang;
team2++;
}
}
} }
DeleteSprite(nSprite); DeleteSprite(nSprite);
} break;
break; case kMarkerMPStart:
case 7: if (pXSprite->data1 >= 0 && pXSprite->data2 < kMaxPlayers) {
gUpperLink[pSprite->sectnum] = nSprite; if (gGameOptions.nGameType >= 2) {
pSprite->cstat |= 32768; // default if BB or teams without data2 specified
pSprite->cstat &= ~257; ZONE* pZone = &gStartZone[pXSprite->data1];
break; pZone->x = pSprite->x;
case 6: pZone->y = pSprite->y;
gLowerLink[pSprite->sectnum] = nSprite; pZone->z = pSprite->z;
pSprite->cstat |= 32768; pZone->sectnum = pSprite->sectnum;
pSprite->cstat &= ~257; pZone->ang = pSprite->ang;
break;
case 9: // By NoOne: fill player spawn position according team of player in TEAMS mode.
case 11: if (gModernMap && gGameOptions.nGameType == 3) {
case 13: if (pXSprite->data2 == 1) {
gUpperLink[pSprite->sectnum] = nSprite; pZone = &gStartZoneTeam1[team1];
pSprite->cstat |= 32768; pZone->x = pSprite->x;
pSprite->cstat &= ~257; pZone->y = pSprite->y;
pSprite->z = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y); pZone->z = pSprite->z;
break; pZone->sectnum = pSprite->sectnum;
case 10: pZone->ang = pSprite->ang;
case 12: team1++;
case 14:
gLowerLink[pSprite->sectnum] = nSprite; } else if (pXSprite->data2 == 2) {
pSprite->cstat |= 32768; pZone = &gStartZoneTeam2[team2];
pSprite->cstat &= ~257; pZone->x = pSprite->x;
pSprite->z = getceilzofslope(pSprite->sectnum, pSprite->x, pSprite->y); pZone->y = pSprite->y;
break; pZone->z = pSprite->z;
pZone->sectnum = pSprite->sectnum;
pZone->ang = pSprite->ang;
team2++;
}
}
}
DeleteSprite(nSprite);
}
break;
case kMarkerUpLink:
gUpperLink[pSprite->sectnum] = nSprite;
pSprite->cstat |= 32768;
pSprite->cstat &= ~257;
break;
case kMarkerLowLink:
gLowerLink[pSprite->sectnum] = nSprite;
pSprite->cstat |= 32768;
pSprite->cstat &= ~257;
break;
case kMarkerUpWater:
case kMarkerUpStack:
case kMarkerUpGoo:
gUpperLink[pSprite->sectnum] = nSprite;
pSprite->cstat |= 32768;
pSprite->cstat &= ~257;
pSprite->z = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y);
break;
case kMarkerLowWater:
case kMarkerLowStack:
case kMarkerLowGoo:
gLowerLink[pSprite->sectnum] = nSprite;
pSprite->cstat |= 32768;
pSprite->cstat &= ~257;
pSprite->z = getceilzofslope(pSprite->sectnum, pSprite->x, pSprite->y);
break;
} }
} }
} }

View file

@ -979,7 +979,7 @@ void FirePitchfork(int, PLAYER *pPlayer)
void FireSpray(int, PLAYER *pPlayer) void FireSpray(int, PLAYER *pPlayer)
{ {
playerFireMissile(pPlayer, 0, pPlayer->at1be.dx, pPlayer->at1be.dy, pPlayer->at1be.dz, 304); playerFireMissile(pPlayer, 0, pPlayer->at1be.dx, pPlayer->at1be.dy, pPlayer->at1be.dz, kMissileFlameSpray);
UseAmmo(pPlayer, 6, 4); UseAmmo(pPlayer, 6, 4);
if (CheckAmmo(pPlayer, 6, 1)) if (CheckAmmo(pPlayer, 6, 1))
sfxPlay3DSound(pPlayer->pSprite, 441, 1, 2); sfxPlay3DSound(pPlayer->pSprite, 441, 1, 2);
@ -992,11 +992,11 @@ void ThrowCan(int, PLAYER *pPlayer)
sfxKill3DSound(pPlayer->pSprite, -1, 441); sfxKill3DSound(pPlayer->pSprite, -1, 441);
int nSpeed = mulscale16(pPlayer->at1ba, 0x177777)+0x66666; int nSpeed = mulscale16(pPlayer->at1ba, 0x177777)+0x66666;
sfxPlay3DSound(pPlayer->pSprite, 455, 1, 0); sfxPlay3DSound(pPlayer->pSprite, 455, 1, 0);
spritetype *pSprite = playerFireThing(pPlayer, 0, -9460, 420, nSpeed); spritetype *pSprite = playerFireThing(pPlayer, 0, -9460, kThingArmedSpray, nSpeed);
if (pSprite) if (pSprite)
{ {
sfxPlay3DSound(pSprite, 441, 0, 0); sfxPlay3DSound(pSprite, 441, 0, 0);
evPost(pSprite->index, 3, pPlayer->at1b2, COMMAND_ID_1); evPost(pSprite->index, 3, pPlayer->at1b2, kCmdOn);
int nXSprite = pSprite->extra; int nXSprite = pSprite->extra;
XSPRITE *pXSprite = &xsprite[nXSprite]; XSPRITE *pXSprite = &xsprite[nXSprite];
pXSprite->Impact = 1; pXSprite->Impact = 1;
@ -1008,10 +1008,10 @@ void ThrowCan(int, PLAYER *pPlayer)
void DropCan(int, PLAYER *pPlayer) void DropCan(int, PLAYER *pPlayer)
{ {
sfxKill3DSound(pPlayer->pSprite, -1, 441); sfxKill3DSound(pPlayer->pSprite, -1, 441);
spritetype *pSprite = playerFireThing(pPlayer, 0, 0, 420, 0); spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedSpray, 0);
if (pSprite) if (pSprite)
{ {
evPost(pSprite->index, 3, pPlayer->at1b2, COMMAND_ID_1); evPost(pSprite->index, 3, pPlayer->at1b2, kCmdOn);
UseAmmo(pPlayer, 6, gAmmoItemData[0].at8); UseAmmo(pPlayer, 6, gAmmoItemData[0].at8);
} }
} }
@ -1019,8 +1019,8 @@ void DropCan(int, PLAYER *pPlayer)
void ExplodeCan(int, PLAYER *pPlayer) void ExplodeCan(int, PLAYER *pPlayer)
{ {
sfxKill3DSound(pPlayer->pSprite, -1, 441); sfxKill3DSound(pPlayer->pSprite, -1, 441);
spritetype *pSprite = playerFireThing(pPlayer, 0, 0, 420, 0); spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedSpray, 0);
evPost(pSprite->index, 3, 0, COMMAND_ID_1); evPost(pSprite->index, 3, 0, kCmdOn);
UseAmmo(pPlayer, 6, gAmmoItemData[0].at8); UseAmmo(pPlayer, 6, gAmmoItemData[0].at8);
StartQAV(pPlayer, 15, -1); StartQAV(pPlayer, 15, -1);
pPlayer->atbd = 0; pPlayer->atbd = 0;
@ -1032,13 +1032,13 @@ void ThrowBundle(int, PLAYER *pPlayer)
sfxKill3DSound(pPlayer->pSprite, 16, -1); sfxKill3DSound(pPlayer->pSprite, 16, -1);
int nSpeed = mulscale16(pPlayer->at1ba, 0x177777)+0x66666; int nSpeed = mulscale16(pPlayer->at1ba, 0x177777)+0x66666;
sfxPlay3DSound(pPlayer->pSprite, 455, 1, 0); sfxPlay3DSound(pPlayer->pSprite, 455, 1, 0);
spritetype *pSprite = playerFireThing(pPlayer, 0, -9460, 419, nSpeed); spritetype *pSprite = playerFireThing(pPlayer, 0, -9460, kThingArmedTNTBundle, nSpeed);
int nXSprite = pSprite->extra; int nXSprite = pSprite->extra;
XSPRITE *pXSprite = &xsprite[nXSprite]; XSPRITE *pXSprite = &xsprite[nXSprite];
if (pPlayer->at1b2 < 0) if (pPlayer->at1b2 < 0)
pXSprite->Impact = 1; pXSprite->Impact = 1;
else else
evPost(pSprite->index, 3, pPlayer->at1b2, COMMAND_ID_1); evPost(pSprite->index, 3, pPlayer->at1b2, kCmdOn);
UseAmmo(pPlayer, 5, 1); UseAmmo(pPlayer, 5, 1);
pPlayer->at1ba = 0; pPlayer->at1ba = 0;
} }
@ -1046,16 +1046,16 @@ void ThrowBundle(int, PLAYER *pPlayer)
void DropBundle(int, PLAYER *pPlayer) void DropBundle(int, PLAYER *pPlayer)
{ {
sfxKill3DSound(pPlayer->pSprite, 16, -1); sfxKill3DSound(pPlayer->pSprite, 16, -1);
spritetype *pSprite = playerFireThing(pPlayer, 0, 0, 419, 0); spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedTNTBundle, 0);
evPost(pSprite->index, 3, pPlayer->at1b2, COMMAND_ID_1); evPost(pSprite->index, 3, pPlayer->at1b2, kCmdOn);
UseAmmo(pPlayer, 5, 1); UseAmmo(pPlayer, 5, 1);
} }
void ExplodeBundle(int, PLAYER *pPlayer) void ExplodeBundle(int, PLAYER *pPlayer)
{ {
sfxKill3DSound(pPlayer->pSprite, 16, -1); sfxKill3DSound(pPlayer->pSprite, 16, -1);
spritetype *pSprite = playerFireThing(pPlayer, 0, 0, 419, 0); spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedTNTBundle, 0);
evPost(pSprite->index, 3, 0, COMMAND_ID_1); evPost(pSprite->index, 3, 0, kCmdOn);
UseAmmo(pPlayer, 5, 1); UseAmmo(pPlayer, 5, 1);
StartQAV(pPlayer, 24, -1, 0); StartQAV(pPlayer, 24, -1, 0);
pPlayer->atbd = 0; pPlayer->atbd = 0;
@ -1066,16 +1066,16 @@ void ThrowProx(int, PLAYER *pPlayer)
{ {
int nSpeed = mulscale16(pPlayer->at1ba, 0x177777)+0x66666; int nSpeed = mulscale16(pPlayer->at1ba, 0x177777)+0x66666;
sfxPlay3DSound(pPlayer->pSprite, 455, 1, 0); sfxPlay3DSound(pPlayer->pSprite, 455, 1, 0);
spritetype *pSprite = playerFireThing(pPlayer, 0, -9460, 401, nSpeed); spritetype *pSprite = playerFireThing(pPlayer, 0, -9460, kThingArmedProxBomb, nSpeed);
evPost(pSprite->index, 3, 240, COMMAND_ID_1); evPost(pSprite->index, 3, 240, kCmdOn);
UseAmmo(pPlayer, 10, 1); UseAmmo(pPlayer, 10, 1);
pPlayer->at1ba = 0; pPlayer->at1ba = 0;
} }
void DropProx(int, PLAYER *pPlayer) void DropProx(int, PLAYER *pPlayer)
{ {
spritetype *pSprite = playerFireThing(pPlayer, 0, 0, 401, 0); spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedProxBomb, 0);
evPost(pSprite->index, 3, 240, COMMAND_ID_1); evPost(pSprite->index, 3, 240, kCmdOn);
UseAmmo(pPlayer, 10, 1); UseAmmo(pPlayer, 10, 1);
} }
@ -1083,7 +1083,7 @@ void ThrowRemote(int, PLAYER *pPlayer)
{ {
int nSpeed = mulscale16(pPlayer->at1ba, 0x177777)+0x66666; int nSpeed = mulscale16(pPlayer->at1ba, 0x177777)+0x66666;
sfxPlay3DSound(pPlayer->pSprite, 455, 1, 0); sfxPlay3DSound(pPlayer->pSprite, 455, 1, 0);
spritetype *pSprite = playerFireThing(pPlayer, 0, -9460, 402, nSpeed); spritetype *pSprite = playerFireThing(pPlayer, 0, -9460, kThingArmedRemoteBomb, nSpeed);
int nXSprite = pSprite->extra; int nXSprite = pSprite->extra;
XSPRITE *pXSprite = &xsprite[nXSprite]; XSPRITE *pXSprite = &xsprite[nXSprite];
pXSprite->rxID = 90+(pPlayer->pSprite->type-kDudePlayer1); pXSprite->rxID = 90+(pPlayer->pSprite->type-kDudePlayer1);
@ -1093,7 +1093,7 @@ void ThrowRemote(int, PLAYER *pPlayer)
void DropRemote(int, PLAYER *pPlayer) void DropRemote(int, PLAYER *pPlayer)
{ {
spritetype *pSprite = playerFireThing(pPlayer, 0, 0, 402, 0); spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedRemoteBomb, 0);
int nXSprite = pSprite->extra; int nXSprite = pSprite->extra;
XSPRITE *pXSprite = &xsprite[nXSprite]; XSPRITE *pXSprite = &xsprite[nXSprite];
pXSprite->rxID = 90+(pPlayer->pSprite->type-kDudePlayer1); pXSprite->rxID = 90+(pPlayer->pSprite->type-kDudePlayer1);
@ -1102,7 +1102,7 @@ void DropRemote(int, PLAYER *pPlayer)
void FireRemote(int, PLAYER *pPlayer) void FireRemote(int, PLAYER *pPlayer)
{ {
evSend(0, 0, 90+(pPlayer->pSprite->type-kDudePlayer1), COMMAND_ID_1); evSend(0, 0, 90+(pPlayer->pSprite->type-kDudePlayer1), kCmdOn);
} }
#define kMaxShotgunBarrels 4 #define kMaxShotgunBarrels 4
@ -1305,7 +1305,7 @@ void FireFlare(int nTrigger, PLAYER *pPlayer)
offset = 120; offset = 120;
break; break;
} }
playerFireMissile(pPlayer, offset, pPlayer->at1be.dx, pPlayer->at1be.dy, pPlayer->at1be.dz, 301); playerFireMissile(pPlayer, offset, pPlayer->at1be.dx, pPlayer->at1be.dy, pPlayer->at1be.dz, kMissileFlareRegular);
UseAmmo(pPlayer, 1, 1); UseAmmo(pPlayer, 1, 1);
sfxPlay3DSound(pSprite, 420, 2, 0); sfxPlay3DSound(pSprite, 420, 2, 0);
pPlayer->at362 = 30; pPlayer->at362 = 30;
@ -1325,7 +1325,7 @@ void AltFireFlare(int nTrigger, PLAYER *pPlayer)
offset = 120; offset = 120;
break; break;
} }
playerFireMissile(pPlayer, offset, pPlayer->at1be.dx, pPlayer->at1be.dy, pPlayer->at1be.dz, 303); playerFireMissile(pPlayer, offset, pPlayer->at1be.dx, pPlayer->at1be.dy, pPlayer->at1be.dz, kMissileFlareAlt);
UseAmmo(pPlayer, 1, 8); UseAmmo(pPlayer, 1, 8);
sfxPlay3DSound(pSprite, 420, 2, 0); sfxPlay3DSound(pSprite, 420, 2, 0);
pPlayer->at362 = 45; pPlayer->at362 = 45;
@ -1361,7 +1361,7 @@ void FireVoodoo(int nTrigger, PLAYER *pPlayer)
sfxPlay3DSound(pSprite, 460, 2, 0); sfxPlay3DSound(pSprite, 460, 2, 0);
fxSpawnBlood(pTarget, 17<<4); fxSpawnBlood(pTarget, 17<<4);
int nDamage = actDamageSprite(nSprite, pTarget, DAMAGE_TYPE_5, 9<<4); int nDamage = actDamageSprite(nSprite, pTarget, DAMAGE_TYPE_5, 9<<4);
if (pTarget->type >= kDudePlayer1 && pTarget->type <= kDudePlayer8) if (IsPlayerSprite(pTarget))
WeaponLower(&gPlayer[pTarget->type-kDudePlayer1]); WeaponLower(&gPlayer[pTarget->type-kDudePlayer1]);
UseAmmo(pPlayer, 9, nDamage/4); UseAmmo(pPlayer, 9, nDamage/4);
break; break;
@ -1379,9 +1379,9 @@ void FireVoodoo(int nTrigger, PLAYER *pPlayer)
sfxPlay3DSound(pSprite, 460, 2, 0); sfxPlay3DSound(pSprite, 460, 2, 0);
fxSpawnBlood(pTarget, 17<<4); fxSpawnBlood(pTarget, 17<<4);
int nDamage = actDamageSprite(nSprite, pTarget, DAMAGE_TYPE_5, 11<<4); int nDamage = actDamageSprite(nSprite, pTarget, DAMAGE_TYPE_5, 11<<4);
if (pTarget->type >= kDudePlayer1 && pTarget->type <= kDudePlayer8) if (IsPlayerSprite(pTarget))
{ {
PLAYER *pOtherPlayer = &gPlayer[pTarget->type-kDudePlayer1]; PLAYER *pOtherPlayer = &gPlayer[pTarget->type - kDudePlayer1];
pOtherPlayer->at36a = 128; pOtherPlayer->at36a = 128;
} }
UseAmmo(pPlayer, 9, nDamage/4); UseAmmo(pPlayer, 9, nDamage/4);
@ -1415,7 +1415,7 @@ void AltFireVoodoo(int nTrigger, PLAYER *pPlayer)
nDamage = (nDamage * ((51200 - nDist) + 1)) / 51200; nDamage = (nDamage * ((51200 - nDist) + 1)) / 51200;
nDamage = actDamageSprite(pPlayer->at5b, pTarget, DAMAGE_TYPE_5, nDamage); nDamage = actDamageSprite(pPlayer->at5b, pTarget, DAMAGE_TYPE_5, nDamage);
if (pTarget->type >= kDudePlayer1 && pTarget->type <= kDudePlayer8) 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, 14))
@ -1453,7 +1453,7 @@ void AltFireVoodoo(int nTrigger, PLAYER *pPlayer)
nDamage = (nDamage * ((51200 - nDist) + 1)) / 51200; nDamage = (nDamage * ((51200 - nDist) + 1)) / 51200;
nDamage = actDamageSprite(pPlayer->at5b, pTarget, DAMAGE_TYPE_5, nDamage); nDamage = actDamageSprite(pPlayer->at5b, pTarget, DAMAGE_TYPE_5, nDamage);
UseAmmo(pPlayer, 9, nDamage); UseAmmo(pPlayer, 9, nDamage);
if (pTarget->type >= kDudePlayer1 && pTarget->type <= kDudePlayer8) 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, 14))
@ -1473,13 +1473,13 @@ void DropVoodoo(int nTrigger, PLAYER *pPlayer)
{ {
UNREFERENCED_PARAMETER(nTrigger); UNREFERENCED_PARAMETER(nTrigger);
sfxPlay3DSound(pPlayer->pSprite, 455, 2, 0); sfxPlay3DSound(pPlayer->pSprite, 455, 2, 0);
spritetype *pSprite = playerFireThing(pPlayer, 0, -4730, 432, 0xccccc); spritetype *pSprite = playerFireThing(pPlayer, 0, -4730, kThingVoodooHead, 0xccccc);
if (pSprite) if (pSprite)
{ {
int nXSprite = pSprite->extra; int nXSprite = pSprite->extra;
XSPRITE *pXSprite = &xsprite[nXSprite]; XSPRITE *pXSprite = &xsprite[nXSprite];
pXSprite->data1 = pPlayer->at181[9]; pXSprite->data1 = pPlayer->at181[9];
evPost(pSprite->index, 3, 90, CALLBACK_ID_21); evPost(pSprite->index, 3, 90, kCallbackDropVoodoo);
UseAmmo(pPlayer, 6, gAmmoItemData[0].at8); UseAmmo(pPlayer, 6, gAmmoItemData[0].at8);
UseAmmo(pPlayer, 9, pPlayer->at181[9]); UseAmmo(pPlayer, 9, pPlayer->at181[9]);
pPlayer->atcb[10] = 0; pPlayer->atcb[10] = 0;
@ -1535,7 +1535,7 @@ void AltFireTesla(int nTrigger, PLAYER *pPlayer)
{ {
UNREFERENCED_PARAMETER(nTrigger); UNREFERENCED_PARAMETER(nTrigger);
spritetype *pSprite = pPlayer->pSprite; spritetype *pSprite = pPlayer->pSprite;
playerFireMissile(pPlayer, 0, pPlayer->at1be.dx, pPlayer->at1be.dy, pPlayer->at1be.dz, 302); playerFireMissile(pPlayer, 0, pPlayer->at1be.dx, pPlayer->at1be.dy, pPlayer->at1be.dz, kMissileTeslaAlt);
UseAmmo(pPlayer, pPlayer->atc7, 35); UseAmmo(pPlayer, pPlayer->atc7, 35);
sfxPlay3DSound(pSprite, 471, 2, 0); sfxPlay3DSound(pSprite, 471, 2, 0);
pPlayer->at362 = 40; pPlayer->at362 = 40;
@ -1555,7 +1555,7 @@ void FireNapalm(int nTrigger, PLAYER *pPlayer)
offset = 50; offset = 50;
break; break;
} }
playerFireMissile(pPlayer, offset, pPlayer->at1be.dx, pPlayer->at1be.dy, pPlayer->at1be.dz, 312); playerFireMissile(pPlayer, offset, pPlayer->at1be.dx, pPlayer->at1be.dy, pPlayer->at1be.dz, kMissileFireballNapam);
sfxPlay3DSound(pSprite, 480, 2, 0); sfxPlay3DSound(pSprite, 480, 2, 0);
UseAmmo(pPlayer, 4, 1); UseAmmo(pPlayer, 4, 1);
pPlayer->at37b = 1; pPlayer->at37b = 1;
@ -1565,8 +1565,8 @@ void FireNapalm2(int nTrigger, PLAYER *pPlayer)
{ {
UNREFERENCED_PARAMETER(nTrigger); UNREFERENCED_PARAMETER(nTrigger);
spritetype *pSprite = pPlayer->pSprite; spritetype *pSprite = pPlayer->pSprite;
playerFireMissile(pPlayer, -120, pPlayer->at1be.dx, pPlayer->at1be.dy, pPlayer->at1be.dz, 312); playerFireMissile(pPlayer, -120, pPlayer->at1be.dx, pPlayer->at1be.dy, pPlayer->at1be.dz, kMissileFireballNapam);
playerFireMissile(pPlayer, 120, pPlayer->at1be.dx, pPlayer->at1be.dy, pPlayer->at1be.dz, 312); playerFireMissile(pPlayer, 120, pPlayer->at1be.dx, pPlayer->at1be.dy, pPlayer->at1be.dz, kMissileFireballNapam);
sfxPlay3DSound(pSprite, 480, 2, 0); sfxPlay3DSound(pSprite, 480, 2, 0);
UseAmmo(pPlayer, 4, 2); UseAmmo(pPlayer, 4, 2);
pPlayer->at37b = 1; pPlayer->at37b = 1;
@ -1577,7 +1577,7 @@ void AltFireNapalm(int nTrigger, PLAYER *pPlayer)
UNREFERENCED_PARAMETER(nTrigger); UNREFERENCED_PARAMETER(nTrigger);
char UNUSED(bAkimbo) = powerupCheck(pPlayer, 17); char UNUSED(bAkimbo) = powerupCheck(pPlayer, 17);
int nSpeed = mulscale16(0x8000, 0x177777)+0x66666; int nSpeed = mulscale16(0x8000, 0x177777)+0x66666;
spritetype *pMissile = playerFireThing(pPlayer, 0, -4730, 428, nSpeed); spritetype *pMissile = playerFireThing(pPlayer, 0, -4730, kThingNapalmBall, nSpeed);
if (pMissile) if (pMissile)
{ {
XSPRITE *pXSprite = &xsprite[pMissile->extra]; XSPRITE *pXSprite = &xsprite[pMissile->extra];
@ -1585,7 +1585,7 @@ void AltFireNapalm(int nTrigger, PLAYER *pPlayer)
UseAmmo(pPlayer, 4, pXSprite->data4); UseAmmo(pPlayer, 4, pXSprite->data4);
seqSpawn(22, 3, pMissile->extra, -1); seqSpawn(22, 3, pMissile->extra, -1);
actBurnSprite(actSpriteIdToOwnerId(pPlayer->pSprite->index), pXSprite, 600); actBurnSprite(actSpriteIdToOwnerId(pPlayer->pSprite->index), pXSprite, 600);
evPost(pMissile->index, 3, 0, CALLBACK_ID_0); evPost(pMissile->index, 3, 0, kCallbackFXFlameLick);
sfxPlay3DSound(pMissile, 480, 2, 0); sfxPlay3DSound(pMissile, 480, 2, 0);
pPlayer->at362 = 30; pPlayer->at362 = 30;
pPlayer->at37b = 1; pPlayer->at37b = 1;
@ -1617,7 +1617,7 @@ void AltFireLifeLeech(int nTrigger, PLAYER *pPlayer)
{ {
UNREFERENCED_PARAMETER(nTrigger); UNREFERENCED_PARAMETER(nTrigger);
sfxPlay3DSound(pPlayer->pSprite, 455, 2, 0); sfxPlay3DSound(pPlayer->pSprite, 455, 2, 0);
spritetype *pMissile = playerFireThing(pPlayer, 0, -4730, 431, 0x19999); spritetype *pMissile = playerFireThing(pPlayer, 0, -4730, kThingDroppedLifeLeech, 0x19999);
if (pMissile) if (pMissile)
{ {
pMissile->cstat |= 4096; pMissile->cstat |= 4096;
@ -1627,7 +1627,7 @@ void AltFireLifeLeech(int nTrigger, PLAYER *pPlayer)
pXSprite->DudeLockout = 1; pXSprite->DudeLockout = 1;
pXSprite->data4 = ClipHigh(pPlayer->at181[4], 12); pXSprite->data4 = ClipHigh(pPlayer->at181[4], 12);
pXSprite->stateTimer = 1; pXSprite->stateTimer = 1;
evPost(pMissile->index, 3, 120, CALLBACK_ID_20); evPost(pMissile->index, 3, 120, kCallbackLeechStateTimer);
if (gGameOptions.nGameType <= 1) if (gGameOptions.nGameType <= 1)
{ {
int nAmmo = pPlayer->at181[8]; int nAmmo = pPlayer->at181[8];