diff --git a/source/blood/src/actor.cpp b/source/blood/src/actor.cpp index 96c583354..31ff1854b 100644 --- a/source/blood/src/actor.cpp +++ b/source/blood/src/actor.cpp @@ -2269,7 +2269,7 @@ THINGINFO thingInfo[] = { 0, 0, 0, 0, 0, 0, 0, 1, }, - // 433 - kGDXThingTNTProx + // 433 - kModernThingTNTProx { 5, 5, @@ -2286,7 +2286,7 @@ THINGINFO thingInfo[] = { 256, 256, 256, 64, 0, 0, 512, 1 }, - // 434 - kGDXThingThrowableRock + // 434 - kModernThingThrowableRock { 5, 6, @@ -2303,7 +2303,7 @@ THINGINFO thingInfo[] = { 0, 0, 0, 0, 0, 0, 0, 1 }, - // 435 - kGDXThingCustomDudeLifeLeech + // 435 - kModernThingEnemyLifeLeech { 150, 30, @@ -2450,17 +2450,17 @@ static char buffer[120]; bool IsItemSprite(spritetype *pSprite) { - return pSprite->type >= 100 && pSprite->type < 149; + return pSprite->type >= kItemBase && pSprite->type < kItemMax; } bool IsWeaponSprite(spritetype *pSprite) { - return pSprite->type >= 40 && pSprite->type < 51; + return pSprite->type >= kItemWeaponBase && pSprite->type < kItemWeaponMax; } bool IsAmmoSprite(spritetype *pSprite) { - return pSprite->type >= 60 && pSprite->type < 81; + return pSprite->type >= kItemAmmoBase && pSprite->type < kItemAmmoMax; } bool IsUnderwaterSector(int nSector) @@ -2486,7 +2486,7 @@ void actPropagateSpriteOwner(spritetype *pTarget, spritetype *pSource) { dassert(pTarget != NULL && pSource != NULL); if (IsPlayerSprite(pSource)) - pTarget->owner = (pSource->type-kDudePlayer1) | kMaxSprites; + pTarget->owner = (pSource->type - kDudePlayer1) | kMaxSprites; else pTarget->owner = pSource->index; } @@ -2498,7 +2498,7 @@ int actSpriteIdToOwnerId(int nSprite) dassert(nSprite >= 0 && nSprite < kMaxSprites); spritetype *pSprite = &sprite[nSprite]; if (IsPlayerSprite(pSprite)) - nSprite = (pSprite->type-kDudePlayer1) | kMaxSprites; + nSprite = (pSprite->type - kDudePlayer1) | kMaxSprites; return nSprite; } @@ -2559,17 +2559,8 @@ void actInit(bool bSaveLoad) { XSPRITE* pXSprite = &xsprite[i]; spritetype* pSprite = &sprite[pXSprite->reference]; switch (pSprite->type) { - // add statnum for faster dude searching - case kGDXDudeTargetChanger: - changespritestat(i, kStatModernDudeTargetChanger); - break; - // remove kStatItem status from random item generators - case 40: // Random weapon - case 80: // Random ammo - changespritestat(i, kStatDecoration); - break; - case kCustomDude: - case kCustomDudeBurning: + case kDudeModernCustom: + case kDudeModernCustomBurning: getSpriteMassBySize(pSprite); // create mass cache break; } @@ -2587,8 +2578,8 @@ void actInit(bool bSaveLoad) { switch (pSprite->statnum) { case kStatDude: switch (pSprite->type) { - case kCustomDude: - case kCustomDudeBurning: + case kDudeModernCustom: + case kDudeModernCustomBurning: pXSprite->data3 = pXSprite->sysData1; // move sndStartId back from sysData1 to data3 break; } @@ -2657,8 +2648,8 @@ void actInit(bool bSaveLoad) { for (int nSprite = headspritestat[kStatItem]; nSprite >= 0; nSprite = nextspritestat[nSprite]) { spritetype *pSprite = &sprite[nSprite]; - if (pSprite->type == 44) // Voodoo doll (ammo) - pSprite->type = 70; // Voodoo doll (weapon) + if (pSprite->type == kItemWeaponVoodooDoll) + pSprite->type = kAmmoItemVoodooDoll; } for (int nSprite = headspritestat[kStatTraps]; nSprite >= 0; nSprite = nextspritestat[nSprite]) @@ -2668,8 +2659,7 @@ void actInit(bool bSaveLoad) { XSPRITE *pXSprite = NULL; if (nXSprite > 0 && nXSprite < kMaxXSprites) pXSprite = &xsprite[nXSprite]; - if (pSprite->type == 459) - { + if (pSprite->type == kTrapExploder) { pXSprite->state = 0; pXSprite->waitTime = ClipLow(pXSprite->waitTime, 1); pSprite->cstat &= ~1; @@ -2683,28 +2673,24 @@ void actInit(bool bSaveLoad) { if (nXSprite <= 0 || nXSprite >= kMaxXSprites) ThrowError("WARNING: Sprite %d is on the wrong status list!\n", nSprite); XSPRITE *pXSprite = &xsprite[nXSprite]; - int nType = pSprite->type - 400; + int nType = pSprite->type - kThingBase; pSprite->clipdist = thingInfo[nType].at4; pSprite->flags = thingInfo[nType].at5; if (pSprite->flags&2) pSprite->flags |= 4; xvel[nSprite] = yvel[nSprite] = zvel[nSprite] = 0; pXSprite->health = thingInfo[nType].at0<<4; - switch (pSprite->type) - { - case 401: - case 413: - case kGDXThingTNTProx: + switch (pSprite->type) { + case kThingArmedProxBomb: + case kTrapMachinegun: + case kModernThingTNTProx: pXSprite->state = 0; break; - case 426: - { + case kThingBloodChunks: { SEQINST *pInst = GetInstance(3, nXSprite); - if (pInst && pInst->at13) - { + if (pInst && pInst->at13) { DICTNODE *hSeq = gSysRes.Lookup(pInst->at8, "SEQ"); - if (!hSeq) - break; + if (!hSeq) break; seqSpawn(pInst->at8, 3, nXSprite); } break; @@ -2760,15 +2746,16 @@ void actInit(bool bSaveLoad) { if (!IsPlayerSprite(pSprite)) { switch (pSprite->type) { - case 225: // by NoOne: FakeDude type (no seq, custom flags, clipdist and cstat) - break; - case kCustomDude: - case kCustomDudeBurning: + case kDudeModernCustom: + case kDudeModernCustomBurning: pSprite->cstat |= 4096 + 256 + 1; seqStartId = getSeqStartId(pXSprite); // by NoOne: Custom Dude stores it's SEQ in data2 pXSprite->sysData1 = pXSprite->data3; // by NoOne move sndStartId to sysData1, because data3 used by the game; pXSprite->data3 = 0; break; + case kDudePodMother: // by NoOne: FakeDude type (no seq, custom flags, clipdist and cstat) + if (gModernMap) break; + fallthrough__; default: pSprite->clipdist = dudeInfo[nType].clipdist; pSprite->cstat |= 4096 + 256 + 1; @@ -2778,7 +2765,7 @@ void actInit(bool bSaveLoad) { xvel[nSprite] = yvel[nSprite] = zvel[nSprite] = 0; // By NoOne: add a way to set custom hp for every enemy - should work only if map just started and not loaded. - if (pXSprite->data4 <= 0) pXSprite->health = dudeInfo[nType].startHealth << 4; + if (!gModernMap || pXSprite->data4 <= 0) pXSprite->health = dudeInfo[nType].startHealth << 4; else pXSprite->health = ClipRange(pXSprite->data4 << 4, 1, 65535); } @@ -2804,14 +2791,14 @@ void ConcussSprite(int a1, spritetype *pSprite, int x, int y, int z, int a6) if (IsDudeSprite(pSprite)) { mass = dudeInfo[pSprite->type - kDudeBase].mass; switch (pSprite->type) { - case kCustomDude: - case kCustomDudeBurning: + case kDudeModernCustom: + case kDudeModernCustomBurning: mass = getSpriteMassBySize(pSprite); break; } } else if (pSprite->type >= kThingBase && pSprite->type < kThingMax) - mass = thingInfo[pSprite->type-400].at2; + mass = thingInfo[pSprite->type - kThingBase].at2; else ThrowError("Unexpected type in ConcussSprite(): Sprite: %d Type: %d Stat: %d", (int)pSprite->index, (int)pSprite->type, (int)pSprite->statnum); int size = (tilesiz[pSprite->picnum].x*pSprite->xrepeat*tilesiz[pSprite->picnum].y*pSprite->yrepeat)>>1; @@ -2965,7 +2952,7 @@ void sub_2AA94(spritetype *pSprite, XSPRITE *pXSprite) int t1 = Random(0x33333)+0x33333; int t2 = Random2(0x71); pSprite->ang = (t2+v4+2048)&2047; - spritetype *pSprite2 = actFireThing(pSprite, 0, 0, -0x93d0, 428, t1); + spritetype *pSprite2 = actFireThing(pSprite, 0, 0, -0x93d0, kThingNapalmBall, t1); XSPRITE *pXSprite2 = &xsprite[pSprite2->extra]; pSprite2->owner = pSprite->owner; seqSpawn(61, 3, pSprite2->extra, nNapalmClient); @@ -2990,10 +2977,10 @@ spritetype *actSpawnFloor(spritetype *pSprite) spritetype *actDropAmmo(spritetype *pSprite, int nType) { spritetype *pSprite2 = NULL; - if (pSprite && pSprite->statnum < kMaxStatus && nType >= 60 && nType < 81) + if (pSprite && pSprite->statnum < kMaxStatus && nType >= kItemAmmoBase && nType < kItemAmmoMax) { pSprite2 = actSpawnFloor(pSprite); - AMMOITEMDATA *pAmmo = &gAmmoItemData[nType-60]; + AMMOITEMDATA *pAmmo = &gAmmoItemData[nType - kItemAmmoBase]; pSprite2->type = nType; pSprite2->picnum = pAmmo->picnum; pSprite2->shade = pAmmo->shade; @@ -3006,10 +2993,10 @@ spritetype *actDropAmmo(spritetype *pSprite, int nType) spritetype *actDropWeapon(spritetype *pSprite, int nType) { spritetype *pSprite2 = NULL; - if (pSprite && pSprite->statnum < kMaxStatus && nType >= 40 && nType < 51) + if (pSprite && pSprite->statnum < kMaxStatus && nType >= kItemWeaponBase && nType < kItemWeaponMax) { pSprite2 = actSpawnFloor(pSprite); - WEAPONITEMDATA *pWeapon = &gWeaponItemData[nType-40]; + WEAPONITEMDATA *pWeapon = &gWeaponItemData[nType - kItemWeaponBase]; pSprite2->type = nType; pSprite2->picnum = pWeapon->picnum; pSprite2->shade = pWeapon->shade; @@ -3022,10 +3009,10 @@ spritetype *actDropWeapon(spritetype *pSprite, int nType) spritetype *actDropItem(spritetype *pSprite, int nType) { spritetype *pSprite2 = NULL; - if (pSprite && pSprite->statnum < kMaxStatus && nType >= 100 && nType < 149) + if (pSprite && pSprite->statnum < kMaxStatus && nType >= kItemBase && nType < kItemMax) { pSprite2 = actSpawnFloor(pSprite); - ITEMDATA *pItem = &gItemData[nType-100]; + ITEMDATA *pItem = &gItemData[nType - kItemBase]; pSprite2->type = nType; pSprite2->picnum = pItem->picnum; pSprite2->shade = pItem->shade; @@ -3038,7 +3025,7 @@ spritetype *actDropItem(spritetype *pSprite, int nType) spritetype *actDropKey(spritetype *pSprite, int nType) { spritetype *pSprite2 = NULL; - if (pSprite && pSprite->statnum < kMaxStatus && nType >= 100 && nType <= 106) + if (pSprite && pSprite->statnum < kMaxStatus && nType >= kItemKeyBase && nType < kItemKeyMax) { pSprite2 = actDropItem(pSprite, nType); if (pSprite2 && gGameOptions.nGameType == 1) @@ -3061,32 +3048,28 @@ spritetype *actDropFlag(spritetype *pSprite, int nType) pSprite2 = actDropItem(pSprite, nType); if (pSprite2 && gGameOptions.nGameType == 3) { - evPost(pSprite2->index, 3, 1800, CALLBACK_ID_17); + evPost(pSprite2->index, 3, 1800, kCallbackReturnFlag); } } return pSprite2; } -spritetype *actDropObject(spritetype *pSprite, int nType) -{ +spritetype *actDropObject(spritetype *pSprite, int nType) { spritetype *pSprite2 = NULL; - if (nType >= 100 && nType <= 106) - pSprite2 = actDropKey(pSprite, nType); - else if (nType == 147 || nType == 148) - pSprite2 = actDropFlag(pSprite, nType); - else if (nType >= 100 && nType < 149) - pSprite2 = actDropItem(pSprite, nType); - else if (nType >= 60 && nType < 81) - pSprite2 = actDropAmmo(pSprite, nType); - else if (nType >= 40 && nType < 51) - pSprite2 = actDropWeapon(pSprite, nType); - if (pSprite2) - { + + if (nType >= kItemKeyBase && nType < kItemKeyMax) pSprite2 = actDropKey(pSprite, nType); + else if (nType == kItemFlagA || nType == kItemFlagB) pSprite2 = actDropFlag(pSprite, nType); + else if (nType >= kItemBase && nType < kItemMax) pSprite2 = actDropItem(pSprite, nType); + else if (nType >= kItemAmmoBase && nType < kItemAmmoMax) pSprite2 = actDropAmmo(pSprite, nType); + else if (nType >= kItemWeaponBase && nType < kItemWeaponMax) pSprite2 = actDropWeapon(pSprite, nType); + + if (pSprite2) { int top, bottom; GetSpriteExtents(pSprite2, &top, &bottom); if (bottom >= pSprite2->z) pSprite2->z -= bottom - pSprite2->z; } + return pSprite2; } @@ -3115,21 +3098,21 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, dassert(nXSprite > 0); XSPRITE *pXSprite = &xsprite[pSprite->extra]; switch (pSprite->type) { - case kCustomDude: { + case kDudeModernCustom: { removeDudeStuff(pSprite); if (pXSprite->txID <= 0 || getNextIncarnation(pXSprite) == NULL) { - if (pXSprite->data1 >= 459 && pXSprite->data1 < (459 + kExplodeMax) - 1 && + if (pXSprite->data1 >= kTrapExploder && pXSprite->data1 < (kTrapExploder + kExplodeMax) - 1 && Chance(0x4000) && damageType != 5 && damageType != 4) { - doExplosion(pSprite, pXSprite->data1 - 459); + doExplosion(pSprite, pXSprite->data1 - kTrapExploder); if (Chance(0x9000)) damageType = (DAMAGE_TYPE) 3; } if (damageType == DAMAGE_TYPE_1) { if ((gSysRes.Lookup(pXSprite->data2 + 15, "SEQ") || gSysRes.Lookup(pXSprite->data2 + 16, "SEQ")) && pXSprite->medium == 0) { if (gSysRes.Lookup(pXSprite->data2 + 3, "SEQ")) { - pSprite->type = kCustomDudeBurning; + pSprite->type = kDudeModernCustomBurning; if (pXSprite->data2 == kDefaultAnimationBase) // don't inherit palette for burning if using default animation pSprite->pal = 0; @@ -3154,7 +3137,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, aiSetGenIdleState(pSprite, pXSprite); // set idle state if (pXSprite->key > 0) // drop keys - actDropObject(pSprite, 100 + pXSprite->key - 1); + actDropObject(pSprite, kItemKeyBase + pXSprite->key - 1); if (pXSprite->dropMsg > 0) // drop items actDropObject(pSprite, pXSprite->dropMsg); @@ -3194,36 +3177,36 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, } break; } - case 227: // Cerberus + case kDudeCerberusTwoHead: // Cerberus seqSpawn(dudeInfo[nType].seqStartID+1, 3, nXSprite, -1); return; - case 201: - case 202: - case 247: - case 248: + case kDudeCultistTommy: + case kDudeCultistShotgun: + case kDudeCultistTesla: + case kDudeCultistTNT: if (damageType == DAMAGE_TYPE_1 && pXSprite->medium == 0) { - pSprite->type = 240; + pSprite->type = kDudeBurningCultist; aiNewState(pSprite, pXSprite, &cultistBurnGoto); actHealDude(pXSprite, dudeInfo[40].startHealth, dudeInfo[40].startHealth); return; } // no break fallthrough__; - case 251: + case kDudeBeast: if (damageType == DAMAGE_TYPE_1 && pXSprite->medium == 0) { - pSprite->type = 253; + pSprite->type = kDudeBurningBeast; aiNewState(pSprite, pXSprite, &beastBurnGoto); actHealDude(pXSprite, dudeInfo[53].startHealth, dudeInfo[53].startHealth); return; } // no break fallthrough__; - case 245: + case kDudeInnocent: if (damageType == DAMAGE_TYPE_1 && pXSprite->medium == 0) { - pSprite->type = 239; + pSprite->type = kDudeBurningInnocent; aiNewState(pSprite, pXSprite, &innocentBurnGoto); actHealDude(pXSprite, dudeInfo[39].startHealth, dudeInfo[39].startHealth); return; @@ -3235,71 +3218,70 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, if (gPlayer[p].at2ee == pSprite->index && gPlayer[p].at1fe > 0) gPlayer[p].at2ee = -1; } - if (pSprite->type != 249) - trTriggerSprite(pSprite->index, pXSprite, 0); + if (pSprite->type != kDudeCultistBeast) + trTriggerSprite(pSprite->index, pXSprite, kCmdOff); pSprite->flags |= 7; - if (VanillaMode()) - { - if (IsPlayerSprite(pKillerSprite)) - { - PLAYER *pPlayer = &gPlayer[pKillerSprite->type-kDudePlayer1]; + if (VanillaMode()) { + if (IsPlayerSprite(pKillerSprite)) { + PLAYER *pPlayer = &gPlayer[pKillerSprite->type - kDudePlayer1]; if (gGameOptions.nGameType == 1) pPlayer->at2c6++; } - } - else - { - if (gGameOptions.nGameType == 1 && IsPlayerSprite(pKillerSprite) - && pSprite->statnum == kStatDude && pSprite->type != 219 && pSprite->type != 220 && pSprite->type != 245 && pSprite->type != 239) - { - PLAYER *pKillerPlayer = &gPlayer[pKillerSprite->type-kDudePlayer1]; + } else if (gGameOptions.nGameType == 1 && IsPlayerSprite(pKillerSprite) && pSprite->statnum == kStatDude) { + switch (pSprite->type) { + case kDudeBat: + case kDudeRat: + case kDudeInnocent: + case kDudeBurningInnocent: + break; + default: + PLAYER* pKillerPlayer = &gPlayer[pKillerSprite->type - kDudePlayer1]; pKillerPlayer->at2c6++; + break; } + } if (pXSprite->key > 0) - actDropObject(pSprite, 100+pXSprite->key-1); + actDropObject(pSprite, kItemKeyBase + pXSprite->key - 1); + if (pXSprite->dropMsg > 0) actDropObject(pSprite, pXSprite->dropMsg); - if (pSprite->type == 201) - { + int nRand = Random(100); - if (nRand < 10) - actDropObject(pSprite, 42); - else if (nRand < 50) - actDropObject(pSprite, 69); - } - else if (pSprite->type == 202) - { - int nRand = Random(100); - if (nRand <= 10) - actDropObject(pSprite, 41); - else if (nRand <= 50) - actDropObject(pSprite, 67); + switch (pSprite->type) { + case kDudeCultistTommy: + if (nRand < 10) actDropObject(pSprite, kItemWeaponTommygun); + else if (nRand < 50) actDropObject(pSprite, kItemAmmoTommygunFew); + break; + case kDudeCultistShotgun: + if (nRand <= 10) actDropObject(pSprite, kItemWeaponSawedoff); + else if (nRand <= 50) actDropObject(pSprite, kItemAmmoSawedoffFew); + break; } + int nSeq; switch (damageType) { case DAMAGE_TYPE_3: nSeq = 2; - switch (pSprite->type) - { - case kCustomDude: - case kCustomDudeBurning: + switch (pSprite->type) { + case kDudeModernCustom: + case kDudeModernCustomBurning: sfxPlayGDXGenDudeSound(pSprite, 4); break; - case 201: - case 202: - case 230: - case 239: - case 240: - case 245: - case 246: - case 247: - case 248: - case 249: - case 250: - case 252: + case kDudeCultistTommy: + case kDudeCultistShotgun: + case kDudeCultistTommyProne: + case kDudeBurningInnocent: + case kDudeBurningCultist: + case kDudeInnocent: + case kDudeCultistShotgunProne: + case kDudeCultistTesla: + case kDudeCultistTNT: + case kDudeCultistBeast: + case kDudeTinyCaleb: + case kDudeBurningTinyCaleb: sfxPlay3DSound(pSprite, 717,-1,0); break; } @@ -3309,13 +3291,12 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, sfxPlay3DSound(pSprite, 351, -1, 0); break; case DAMAGE_TYPE_5: - switch (pSprite->type) - { - case 203: - case 205: + switch (pSprite->type) { + case kDudeZombieAxeNormal: + case kDudeZombieAxeBuried: nSeq = 14; break; - case 204: + case kDudeZombieButcher: nSeq = 11; break; default: @@ -3326,8 +3307,8 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, case DAMAGE_TYPE_0: switch (pSprite->type) { - case 201: - case 202: + case kDudeCultistTommy: + case kDudeCultistShotgun: nSeq = 1; break; default: @@ -3348,23 +3329,22 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, return; } - switch (pSprite->type) - { - case 203: + switch (pSprite->type) { + case kDudeZombieAxeNormal: sfxPlay3DSound(pSprite, 1107+Random(2), -1, 0); - if (nSeq == 2) - { + if (nSeq == 2) { + seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, nDudeToGibClient1); int top, bottom; GetSpriteExtents(pSprite, &top, &bottom); CGibPosition gibPos(pSprite->x, pSprite->y, top); CGibVelocity gibVel(xvel[pSprite->index]>>1, yvel[pSprite->index]>>1, -0xccccc); GibSprite(pSprite, GIBTYPE_27, &gibPos, &gibVel); - } - else if (nSeq == 1 && Chance(0x4000)) - { + + } else if (nSeq == 1 && Chance(0x4000)) { + seqSpawn(dudeInfo[nType].seqStartID+7, 3, nXSprite, nDudeToGibClient1); - evPost(pSprite->index, 3, 0, CALLBACK_ID_5); + evPost(pSprite->index, 3, 0, kCallbackFXZombieSpurt); sfxPlay3DSound(pSprite, 362, -1, 0); pXSprite->data1 = 35; pXSprite->data2 = 5; @@ -3373,25 +3353,25 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, CGibPosition gibPos(pSprite->x, pSprite->y, top); CGibVelocity gibVel(xvel[pSprite->index] >> 1, yvel[pSprite->index] >> 1, -0x111111); GibSprite(pSprite, GIBTYPE_27, &gibPos, &gibVel); - } - else if (nSeq == 14) + + } else if (nSeq == 14) seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1); else if (nSeq == 3) seqSpawn(dudeInfo[nType].seqStartID+13, 3, nXSprite, nDudeToGibClient2); else seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, nDudeToGibClient1); break; - case 201: - case 202: - case 247: - case 248: + case kDudeCultistTommy: + case kDudeCultistShotgun: + case kDudeCultistTesla: + case kDudeCultistTNT: sfxPlay3DSound(pSprite, 1018+Random(2), -1, 0); if (nSeq == 3) seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, nDudeToGibClient2); else seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, nDudeToGibClient1); break; - case 240: + case kDudeBurningCultist: if (Chance(0x4000) && nSeq == 3) sfxPlay3DSound(pSprite, 718, -1, 0); else @@ -3406,7 +3386,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, else seqSpawn(dudeInfo[nType].seqStartID+15, 3, nXSprite, nDudeToGibClient2); break; - case kCustomDude: + case kDudeModernCustom: sfxPlayGDXGenDudeSound(pSprite, 2); if (nSeq == 3) { @@ -3424,7 +3404,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, pXSprite->txID = 0; // to avoid second trigger. break; - case kCustomDudeBurning: + case kDudeModernCustomBurning: { sfxPlayGDXGenDudeSound(pSprite, 4); damageType = DAMAGE_TYPE_3; @@ -3447,7 +3427,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, seqSpawn(seqId, 3, nXSprite, nDudeToGibClient1); break; } - case 241: + case kDudeBurningZombieAxe: if (Chance(0x8000) && nSeq == 3) sfxPlay3DSound(pSprite, 1109, -1, 0); else @@ -3465,20 +3445,19 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, else seqSpawn(dudeInfo[nType].seqStartID+13, 3, nXSprite, nDudeToGibClient2); break; - case 242: + case kDudeBurningZombieButcher: if (Chance(0x4000) && nSeq == 3) sfxPlay3DSound(pSprite, 1206, -1, 0); else sfxPlay3DSound(pSprite, 1204+Random(2), -1, 0); seqSpawn(dudeInfo[4].seqStartID+10, 3, nXSprite, -1); break; - case 239: + case kDudeBurningInnocent: damageType = DAMAGE_TYPE_3; seqSpawn(dudeInfo[nType].seqStartID+7, 3, nXSprite, nDudeToGibClient1); break; - case 204: - if (nSeq == 14) - { + case kDudeZombieButcher: + if (nSeq == 14) { sfxPlay3DSound(pSprite, 1206, -1, 0); seqSpawn(dudeInfo[nType].seqStartID+11, 3, nXSprite, -1); break; @@ -3489,178 +3468,158 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, else seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1); break; - case 206: - if (Chance(0x4000) && nSeq == 3) - sfxPlay3DSound(pSprite, 1405, -1, 0); - else - sfxPlay3DSound(pSprite, 1403+Random(2), -1, 0); + case kDudeGargoyleFlesh: + if (Chance(0x4000) && nSeq == 3) sfxPlay3DSound(pSprite, 1405, -1, 0); + else sfxPlay3DSound(pSprite, 1403+Random(2), -1, 0); seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1); break; - case 207: - if (Chance(0x4000) && nSeq == 3) - sfxPlay3DSound(pSprite, 1455, -1, 0); - else - sfxPlay3DSound(pSprite, 1453+Random(2), -1, 0); + case kDudeGargoyleStone: + if (Chance(0x4000) && nSeq == 3) sfxPlay3DSound(pSprite, 1455, -1, 0); + else sfxPlay3DSound(pSprite, 1453+Random(2), -1, 0); seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1); break; - case 210: - if (Chance(0x4000) && nSeq == 3) - sfxPlay3DSound(pSprite, 1605, -1, 0); - else - sfxPlay3DSound(pSprite, 1603+Random(2), -1, 0); + case kDudePhantasm: + if (Chance(0x4000) && nSeq == 3) sfxPlay3DSound(pSprite, 1605, -1, 0); + else sfxPlay3DSound(pSprite, 1603+Random(2), -1, 0); seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1); break; - case 211: - if (Chance(0x4000) && nSeq == 3) - sfxPlay3DSound(pSprite, 1305, -1, 0); - else - sfxPlay3DSound(pSprite, 1303+Random(2), -1, 0); + case kDudeHellHound: + if (Chance(0x4000) && nSeq == 3) sfxPlay3DSound(pSprite, 1305, -1, 0); + else sfxPlay3DSound(pSprite, 1303+Random(2), -1, 0); seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1); break; - case 212: - if (Chance(0x4000) && nSeq == 3) - sfxPlay3DSound(pSprite, 1905, -1, 0); - else - sfxPlay3DSound(pSprite, 1903+Random(2), -1, 0); + case kDudeHand: + if (Chance(0x4000) && nSeq == 3) sfxPlay3DSound(pSprite, 1905, -1, 0); + else sfxPlay3DSound(pSprite, 1903+Random(2), -1, 0); seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1); break; - case 213: - if (pSprite->owner != -1) - { + case kDudeSpiderBrown: + if (pSprite->owner != -1) { spritetype *pOwner = &sprite[actSpriteOwnerToSpriteId(pSprite)]; gDudeExtra[pOwner->extra].at6.u1.at4--; } - if (Chance(0x4000) && nSeq == 3) - sfxPlay3DSound(pSprite, 1805, -1, 0); - else - sfxPlay3DSound(pSprite, 1803+Random(2), -1, 0); + + if (Chance(0x4000) && nSeq == 3) sfxPlay3DSound(pSprite, 1805, -1, 0); + else sfxPlay3DSound(pSprite, 1803+Random(2), -1, 0); seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1); break; - case 214: - if (pSprite->owner != -1) - { + case kDudeSpiderRed: + if (pSprite->owner != -1) { spritetype *pOwner = &sprite[actSpriteOwnerToSpriteId(pSprite)]; gDudeExtra[pOwner->extra].at6.u1.at4--; } - if (Chance(0x4000) && nSeq == 3) - sfxPlay3DSound(pSprite, 1805, -1, 0); - else - sfxPlay3DSound(pSprite, 1803+Random(2), -1, 0); + + if (Chance(0x4000) && nSeq == 3) sfxPlay3DSound(pSprite, 1805, -1, 0); + else sfxPlay3DSound(pSprite, 1803+Random(2), -1, 0); seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1); break; - case 215: - if (pSprite->owner != -1) - { + case kDudeSpiderBlack: + if (pSprite->owner != -1) { spritetype *pOwner = &sprite[actSpriteOwnerToSpriteId(pSprite)]; gDudeExtra[pOwner->extra].at6.u1.at4--; } - if (Chance(0x4000) && nSeq == 3) - sfxPlay3DSound(pSprite, 1805, -1, 0); - else - sfxPlay3DSound(pSprite, 1803+Random(2), -1, 0); + + if (Chance(0x4000) && nSeq == 3) sfxPlay3DSound(pSprite, 1805, -1, 0); + else sfxPlay3DSound(pSprite, 1803+Random(2), -1, 0); seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1); break; - case 216: + case kDudeSpiderMother: sfxPlay3DSound(pSprite, 1850, -1, 0); seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1); break; - case 217: - if (Chance(0x4000) && nSeq == 3) - sfxPlay3DSound(pSprite, 1705, -1, 0); - else - sfxPlay3DSound(pSprite, 1703+Random(2), -1, 0); + case kDudeGillBeast: + if (Chance(0x4000) && nSeq == 3) sfxPlay3DSound(pSprite, 1705, -1, 0); + else sfxPlay3DSound(pSprite, 1703+Random(2), -1, 0); seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1); break; - case 218: - if (Chance(0x4000) && nSeq == 3) - sfxPlay3DSound(pSprite, 1505, -1, 0); - else - sfxPlay3DSound(pSprite, 1503+Random(2), -1, 0); + case kDudeBoneEel: + if (Chance(0x4000) && nSeq == 3) sfxPlay3DSound(pSprite, 1505, -1, 0); + else sfxPlay3DSound(pSprite, 1503+Random(2), -1, 0); seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1); break; - case 219: + case kDudeBat: if (Chance(0x4000) && nSeq == 3) sfxPlay3DSound(pSprite, 2005, -1, 0); else sfxPlay3DSound(pSprite, 2003+Random(2), -1, 0); seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1); break; - case 220: + case kDudeRat: if (Chance(0x4000) && nSeq == 3) sfxPlay3DSound(pSprite, 2105, -1, 0); else sfxPlay3DSound(pSprite, 2103+Random(2), -1, 0); seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1); break; - case 221: + case kDudePodGreen: if (Chance(0x4000) && nSeq == 3) sfxPlay3DSound(pSprite, 2205, -1, 0); else sfxPlay3DSound(pSprite, 2203+Random(2), -1, 0); seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1); break; - case 222: + case kDudeTentacleGreen: if (damage == 5) sfxPlay3DSound(pSprite, 2471, -1, 0); else sfxPlay3DSound(pSprite, 2472, -1, 0); seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1); break; - case 223: + case kDudePodFire: if (damage == 5) sfxPlay3DSound(pSprite, 2451, -1, 0); else sfxPlay3DSound(pSprite, 2452, -1, 0); seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1); break; - case 224: + case kDudeTentacleFire: sfxPlay3DSound(pSprite, 2501, -1, 0); seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1); break; - case 225: + case kDudePodMother: if (Chance(0x4000) && nSeq == 3) sfxPlay3DSound(pSprite, 2205, -1, 0); else sfxPlay3DSound(pSprite, 2203+Random(2), -1, 0); seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1); break; - case 226: + case kDudeTentacleMother: if (Chance(0x4000) && nSeq == 3) sfxPlay3DSound(pSprite, 2205, -1, 0); else sfxPlay3DSound(pSprite, 2203+Random(2), -1, 0); seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1); break; - case 227: + case kDudeCerberusTwoHead: if (Chance(0x4000) && nSeq == 3) sfxPlay3DSound(pSprite, 2305, -1, 0); else sfxPlay3DSound(pSprite, 2305+Random(2), -1, 0); seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1); break; - case 228: + case kDudeCerberusOneHead: if (Chance(0x4000) && nSeq == 3) sfxPlay3DSound(pSprite, 2305, -1, 0); else sfxPlay3DSound(pSprite, 2305+Random(2), -1, 0); seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1); break; - case 229: + case kDudeTchernobog: sfxPlay3DSound(pSprite, 2380, -1, 0); seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, -1); break; - case 252: + case kDudeBurningTinyCaleb: damageType = DAMAGE_TYPE_3; seqSpawn(dudeInfo[nType].seqStartID+11, 3, nXSprite, nDudeToGibClient1); break; - case 251: + case kDudeBeast: sfxPlay3DSound(pSprite, 9000+Random(2), -1, 0); if (nSeq == 3) seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, nDudeToGibClient2); else seqSpawn(dudeInfo[nType].seqStartID+nSeq, 3, nXSprite, nDudeToGibClient1); break; - case 253: + case kDudeBurningBeast: damageType = DAMAGE_TYPE_3; seqSpawn(dudeInfo[nType].seqStartID+12, 3, nXSprite, nDudeToGibClient1); break; @@ -3674,8 +3633,8 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, //int owner = actSpriteIdToOwnerId(pSprite->xvel); int owner = pSprite->owner; switch (sprite[owner].type) { - case kCustomDude: - case kCustomDudeBurning: + case kDudeModernCustom: + case kDudeModernCustomBurning: if (owner != -1) gDudeExtra[sprite[owner].extra].at6.u1.at4--; break; default: @@ -3694,7 +3653,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, } gKillMgr.AddKill(pSprite); actCheckRespawn(pSprite); - pSprite->type = 426; + pSprite->type = kThingBloodChunks; actPostSprite(pSprite->index, kStatThing); } @@ -3765,7 +3724,7 @@ int actDamageSprite(int nSource, spritetype *pSprite, DAMAGE_TYPE damageType, in pXSprite->health = ClipLow(pXSprite->health-damage, 0); if (!pXSprite->health) { - if (pSprite->type == 431 || pSprite->type == kGDXThingCustomDudeLifeLeech) + if (pSprite->type == kThingDroppedLifeLeech || pSprite->type == kModernThingEnemyLifeLeech) { GibSprite(pSprite, GIBTYPE_14, NULL, NULL); pXSprite->data1 = 0; @@ -3776,42 +3735,40 @@ int actDamageSprite(int nSource, spritetype *pSprite, DAMAGE_TYPE damageType, in pXSprite->isTriggered = 0; pXSprite->DudeLockout = 0; - if (pSprite->owner >= 0 && sprite[pSprite->owner].type == kCustomDude) + if (pSprite->owner >= 0 && sprite[pSprite->owner].type == kDudeModernCustom) sprite[pSprite->owner].owner = kMaxSprites -1; // By NoOne: indicates if custom dude had life leech. } else if (!(pSprite->flags&16)) actPropagateSpriteOwner(pSprite, &sprite[nSource]); - trTriggerSprite(pSprite->index, pXSprite, 0); - switch (pSprite->type) - { - case 416: - case 417: - case 425: - case 426: - case 427: - if (damageType == 3 && pSourcePlayer && gFrameClock > pSourcePlayer->at312 && Chance(0x4000)) - { + + trTriggerSprite(pSprite->index, pXSprite, kCmdOff); + switch (pSprite->type) { + case kThingObjectGib: + case kThingObjectExplode: + case kThingBloodBits: + case kThingBloodChunks: + case kThingZombieHead: + if (damageType == 3 && pSourcePlayer && gFrameClock > pSourcePlayer->at312 && Chance(0x4000)) { sfxPlay3DSound(pSourcePlayer->pSprite, gPlayerGibThingComments[Random(10)], 0, 2); pSourcePlayer->at312 = (int)gFrameClock+3600; } break; - case 413: + case kTrapMachinegun: seqSpawn(28, 3, pSprite->extra, -1); break; - case 407: + case kThingFluorescent: seqSpawn(12, 3, pSprite->extra, -1); GibSprite(pSprite, GIBTYPE_6, NULL, NULL); break; - case 410: + case kThingSpiderWeb: seqSpawn(15, 3, pSprite->extra, -1); break; - case 411: + case kThingMetalGrate: seqSpawn(21, 3, pSprite->extra, -1); GibSprite(pSprite, GIBTYPE_4, NULL, NULL); break; - case 412: - switch (pXSprite->data1) - { + case kThingFlammableTree: + switch (pXSprite->data1) { case -1: GibSprite(pSprite, GIBTYPE_14, NULL, NULL); sfxPlay3DSound(pSprite->x, pSprite->y, pSprite->z, 312, pSprite->sectnum); @@ -3827,10 +3784,6 @@ int actDamageSprite(int nSource, spritetype *pSprite, DAMAGE_TYPE damageType, in break; } break; - case 422: - if (seqGetStatus(3, nXSprite) < 0) - seqSpawn(19, 3, pSprite->extra, -1); - break; } } break; @@ -3898,44 +3851,36 @@ void actHitcodeToData(int a1, HITINFO *pHitInfo, int *a3, spritetype **a4, XSPRI *a11 = pXSector; } -void actImpactMissile(spritetype *pMissile, int a2) +void actImpactMissile(spritetype *pMissile, int hitCode) { int nXMissile = pMissile->extra; dassert(nXMissile > 0 && nXMissile < kMaxXSprites); XSPRITE *pXMissile = &xsprite[pMissile->extra]; - int nSpriteHit = -1; - spritetype *pSpriteHit = NULL; - XSPRITE *pXSpriteHit = NULL; - int nWallHit = -1; - walltype *pWallHit = NULL; - XWALL *pXWallHit = NULL; - int nSectorHit = -1; - sectortype *pSectorHit = NULL; - XSECTOR *pXSectorHit = NULL; - actHitcodeToData(a2, &gHitInfo, &nSpriteHit, &pSpriteHit, &pXSpriteHit, &nWallHit, &pWallHit, &pXWallHit, &nSectorHit, &pSectorHit, &pXSectorHit); - THINGINFO *pThingInfo = NULL; - DUDEINFO *pDudeInfo = NULL; - if (a2 == 3 && pSpriteHit) - { - if (pSpriteHit->statnum == kStatThing) - { - dassert(pXSpriteHit != NULL); - pThingInfo = &thingInfo[pSpriteHit->type-kThingBase]; + + int nSpriteHit = -1; int nWallHit = -1; int nSectorHit = -1; + spritetype *pSpriteHit = NULL; XSPRITE *pXSpriteHit = NULL; + walltype *pWallHit = NULL; XWALL *pXWallHit = NULL; + sectortype *pSectorHit = NULL; XSECTOR *pXSectorHit = NULL; + + actHitcodeToData(hitCode, &gHitInfo, &nSpriteHit, &pSpriteHit, &pXSpriteHit, &nWallHit, &pWallHit, &pXWallHit, &nSectorHit, &pSectorHit, &pXSectorHit); + THINGINFO *pThingInfo = NULL; DUDEINFO *pDudeInfo = NULL; + + if (hitCode == 3 && pSpriteHit) { + switch (pSpriteHit->statnum) { + case kStatThing: + pThingInfo = &thingInfo[pSpriteHit->type - kThingBase]; + break; + case kStatDude: + pDudeInfo = &dudeInfo[pSpriteHit->type - kDudeBase]; + break; } - else if (pSpriteHit->statnum == kStatDude) - { - dassert(pXSpriteHit != NULL); - pDudeInfo = &dudeInfo[pSpriteHit->type-kDudeBase]; } - } - switch (pMissile->type) - { - case 315: - if (a2 == 3 && pSpriteHit && (pThingInfo || pDudeInfo)) - { + switch (pMissile->type) { + case kMissileLifeLeechRegular: + if (hitCode == 3 && pSpriteHit && (pThingInfo || pDudeInfo)) { int nOwner = actSpriteOwnerToSpriteId(pMissile); DAMAGE_TYPE rand1 = (DAMAGE_TYPE)Random(7); - int rand2 = (7+Random(7))<<4; + int rand2 = (7 + Random(7)) << 4; int nDamage = actDamageSprite(nOwner, pSpriteHit, rand1, rand2); if ((pThingInfo && pThingInfo->at17[DAMAGE_TYPE_1] != 0) || (pDudeInfo && pDudeInfo->at70[DAMAGE_TYPE_1] != 0)) actBurnSprite(pMissile->owner, pXSpriteHit, 360); @@ -3949,33 +3894,32 @@ void actImpactMissile(spritetype *pMissile, int a2) actHealDude(pXSource, nDamage >> 2, dudeInfo[pSource->type - kDudeBase].startHealth); } } - if (pMissile->extra > 0) - { + + if (pMissile->extra > 0) { actPostSprite(pMissile->index, kStatDecoration); - if (pMissile->ang == 1024) - sfxPlay3DSound(pMissile, 307, -1, 0); - pMissile->type = 0; + if (pMissile->ang == 1024) sfxPlay3DSound(pMissile, 307, -1, 0); + pMissile->type = kSpriteDecoration; seqSpawn(9, 3, pMissile->extra, -1); - } - else - { + } else { actPostSprite(pMissile->index, kStatFree); } + break; - case 302: - sub_51340(pMissile, a2); - if ((a2 == 0 || a2 == 4) && pWallHit) - { - spritetype *pFX = gFX.fxSpawn(FX_52, pMissile->sectnum, pMissile->x, pMissile->y, pMissile->z, 0); - if (pFX) - pFX->ang = (GetWallAngle(nWallHit)+512)&2047; + case kMissileTeslaAlt: + sub_51340(pMissile, hitCode); + switch (hitCode) { + case 0: + case 4: + if (!pWallHit) break; + spritetype* pFX = gFX.fxSpawn(FX_52, pMissile->sectnum, pMissile->x, pMissile->y, pMissile->z, 0); + if (pFX) pFX->ang = (GetWallAngle(nWallHit) + 512) & 2047; } GibSprite(pMissile, GIBTYPE_24, NULL, NULL); actPostSprite(pMissile->index, kStatFree); break; - case 309: + case kMissilePukeGreen: seqKill(3, nXMissile); - if (a2 == 3 && pSpriteHit && (pThingInfo || pDudeInfo)) + if (hitCode == 3 && pSpriteHit && (pThingInfo || pDudeInfo)) { int nOwner = actSpriteOwnerToSpriteId(pMissile); int nDamage = (15+Random(7))<<4; @@ -3983,11 +3927,11 @@ void actImpactMissile(spritetype *pMissile, int a2) } actPostSprite(pMissile->index, kStatFree); break; - case 311: + case kMissileArcGargoyle: sfxKill3DSound(pMissile, -1, -1); sfxPlay3DSound(pMissile->x, pMissile->y, pMissile->z, 306, pMissile->sectnum); GibSprite(pMissile, GIBTYPE_6, NULL, NULL); - if (a2 == 3 && pSpriteHit && (pThingInfo || pDudeInfo)) + if (hitCode == 3 && pSpriteHit && (pThingInfo || pDudeInfo)) { int nOwner = actSpriteOwnerToSpriteId(pMissile); int nDamage = (25+Random(20))<<4; @@ -3995,51 +3939,42 @@ void actImpactMissile(spritetype *pMissile, int a2) } actPostSprite(pMissile->index, kStatFree); break; - case 316: - case 317: + case kMissileLifeLeechAltNormal: + case kMissileLifeLeechAltSmall: sfxKill3DSound(pMissile, -1, -1); sfxPlay3DSound(pMissile->x, pMissile->y, pMissile->z, 306, pMissile->sectnum); - if (a2 == 3 && pSpriteHit && (pThingInfo || pDudeInfo)) - { - if (pDudeInfo) - { - } + if (hitCode == 3 && pSpriteHit && (pThingInfo || pDudeInfo)) { int nOwner = actSpriteOwnerToSpriteId(pMissile); - int nDmgMul = 3; - if (pMissile->type == 317) - nDmgMul = 6; + int nDmgMul = (pMissile->type == kMissileLifeLeechAltSmall) ? 6 : 3; int nDamage = (nDmgMul+Random(nDmgMul))<<4; actDamageSprite(nOwner, pSpriteHit, DAMAGE_TYPE_5, nDamage); } actPostSprite(pMissile->index, kStatFree); break; - case 305: - case 312: - if (a2 == 3 && pSpriteHit && (pThingInfo || pDudeInfo)) + case kMissileFireball: + case kMissileFireballNapam: + if (hitCode == 3 && pSpriteHit && (pThingInfo || pDudeInfo)) { - if (pThingInfo && pSpriteHit->type == 400 && pXSpriteHit->burnTime == 0) - evPost(nSpriteHit, 3, 0, CALLBACK_ID_0); + if (pThingInfo && pSpriteHit->type == kThingTNTBarrel && pXSpriteHit->burnTime == 0) + evPost(nSpriteHit, 3, 0, kCallbackFXFlameLick); int nOwner = actSpriteOwnerToSpriteId(pMissile); int nDamage = (50+Random(50))<<4; actDamageSprite(nOwner, pSpriteHit, DAMAGE_TYPE_2, nDamage); } actExplodeSprite(pMissile); break; - case 303: + case kMissileFlareAlt: sfxKill3DSound(pMissile, -1, -1); actExplodeSprite(pMissile); break; - case 301: + case kMissileFlareRegular: sfxKill3DSound(pMissile, -1, -1); - if (a2 == 3 && pSpriteHit) - { - if (pThingInfo || pDudeInfo) - { + if ((hitCode == 3 && pSpriteHit) && (pThingInfo || pDudeInfo)) { int nOwner = actSpriteOwnerToSpriteId(pMissile); - if ((pThingInfo && pThingInfo->at17[DAMAGE_TYPE_1] != 0) || (pDudeInfo && pDudeInfo->at70[DAMAGE_TYPE_1] != 0)) - { - if (pThingInfo && pSpriteHit->type == 400 && pXSpriteHit->burnTime == 0) - evPost(nSpriteHit, 3, 0, CALLBACK_ID_0); + if ((pThingInfo && pThingInfo->at17[DAMAGE_TYPE_1] != 0) || (pDudeInfo && pDudeInfo->at70[DAMAGE_TYPE_1] != 0)) { + if (pThingInfo && pSpriteHit->type == kThingTNTBarrel && pXSpriteHit->burnTime == 0) + evPost(nSpriteHit, 3, 0, kCallbackFXFlameLick); + actBurnSprite(pMissile->owner, pXSpriteHit, 480); sub_2A620(nOwner, pMissile->x, pMissile->y, pMissile->z, pMissile->sectnum, 16, 20, 10, DAMAGE_TYPE_2, 6, 480, 0, 0); @@ -4048,14 +3983,12 @@ void actImpactMissile(spritetype *pMissile, int a2) int nDamage = (20 + Random(10)) << 4; actDamageSprite(nOwner, pSpriteHit, DAMAGE_TYPE_2, nDamage); } - } - else - { + } else { int nDamage = (20+Random(10))<<4; actDamageSprite(nOwner, pSpriteHit, DAMAGE_TYPE_2, nDamage); } - if (surfType[pSpriteHit->picnum] == kSurfFlesh) - { + + if (surfType[pSpriteHit->picnum] == kSurfFlesh) { pMissile->picnum = 2123; pXMissile->target = nSpriteHit; pXMissile->targetZ = pMissile->z-pSpriteHit->z; @@ -4066,13 +3999,12 @@ void actImpactMissile(spritetype *pMissile, int a2) break; } } - } GibSprite(pMissile, GIBTYPE_17, NULL, NULL); actPostSprite(pMissile->index, kStatFree); break; - case 304: - case 308: - if (a2 == 3) + case kMissileFlameSpray: + case kMissileFlameHound: + if (hitCode == 3) { int nObject = gHitInfo.hitsprite; dassert(nObject >= 0 && nObject < kMaxSprites); @@ -4081,16 +4013,16 @@ void actImpactMissile(spritetype *pMissile, int a2) { XSPRITE *pXObject = &xsprite[pObject->extra]; if ((pObject->statnum == kStatThing || pObject->statnum == kStatDude) && pXObject->burnTime == 0) - evPost(nObject, 3, 0, CALLBACK_ID_0); + evPost(nObject, 3, 0, kCallbackFXFlameLick); int nOwner = actSpriteOwnerToSpriteId(pMissile); actBurnSprite(pMissile->owner, pXObject, (4+gGameOptions.nDifficulty)<<2); actDamageSprite(nOwner, pObject, DAMAGE_TYPE_1, 8); } } break; - case 313: + case kMissileFireballCerberus: actExplodeSprite(pMissile); - if (a2 == 3) + if (hitCode == 3) { int nObject = gHitInfo.hitsprite; dassert(nObject >= 0 && nObject < kMaxSprites); @@ -4099,7 +4031,7 @@ void actImpactMissile(spritetype *pMissile, int a2) { XSPRITE *pXObject = &xsprite[pObject->extra]; if ((pObject->statnum == kStatThing || pObject->statnum == kStatDude) && pXObject->burnTime == 0) - evPost(nObject, 3, 0, CALLBACK_ID_0); + evPost(nObject, 3, 0, kCallbackFXFlameLick); int nOwner = actSpriteOwnerToSpriteId(pMissile); actBurnSprite(pMissile->owner, pXObject, (4+gGameOptions.nDifficulty)<<2); actDamageSprite(nOwner, pObject, DAMAGE_TYPE_1, 8); @@ -4109,9 +4041,9 @@ void actImpactMissile(spritetype *pMissile, int a2) } actExplodeSprite(pMissile); break; - case 314: + case kMissileFireballTchernobog: actExplodeSprite(pMissile); - if (a2 == 3) + if (hitCode == 3) { int nObject = gHitInfo.hitsprite; dassert(nObject >= 0 && nObject < kMaxSprites); @@ -4120,7 +4052,7 @@ void actImpactMissile(spritetype *pMissile, int a2) { XSPRITE *pXObject = &xsprite[pObject->extra]; if ((pObject->statnum == kStatThing || pObject->statnum == kStatDude) && pXObject->burnTime == 0) - evPost(nObject, 3, 0, CALLBACK_ID_0); + evPost(nObject, 3, 0, kCallbackFXFlameLick); int nOwner = actSpriteOwnerToSpriteId(pMissile); actBurnSprite(pMissile->owner, pXObject, 32); actDamageSprite(nOwner, pObject, DAMAGE_TYPE_5, 12); @@ -4130,12 +4062,12 @@ void actImpactMissile(spritetype *pMissile, int a2) } actExplodeSprite(pMissile); break; - case 307: + case kMissileEctoSkull: sfxKill3DSound(pMissile, -1, -1); sfxPlay3DSound(pMissile->x, pMissile->y, pMissile->z, 522, pMissile->sectnum); actPostSprite(pMissile->index, kStatDebris); seqSpawn(20, 3, pMissile->extra, -1); - if (a2 == 3) + if (hitCode == 3) { int nObject = gHitInfo.hitsprite; dassert(nObject >= 0 && nObject < kMaxSprites); @@ -4148,12 +4080,12 @@ void actImpactMissile(spritetype *pMissile, int a2) } } break; - case 300: + case kMissileButcherKnife: actPostSprite(pMissile->index, kStatDebris); pMissile->cstat &= ~16; pMissile->type = 0; seqSpawn(20, 3, pMissile->extra, -1); - if (a2 == 3) + if (hitCode == 3) { int nObject = gHitInfo.hitsprite; dassert(nObject >= 0 && nObject < kMaxSprites); @@ -4171,14 +4103,14 @@ void actImpactMissile(spritetype *pMissile, int a2) } } break; - case 306: + case kMissileTeslaRegular: sfxKill3DSound(pMissile, -1, -1); sfxPlay3DSound(pMissile->x, pMissile->y, pMissile->z, 518, pMissile->sectnum); - GibSprite(pMissile, (a2 == 2) ? GIBTYPE_23 : GIBTYPE_22, NULL, NULL); + GibSprite(pMissile, (hitCode == 2) ? GIBTYPE_23 : GIBTYPE_22, NULL, NULL); evKill(pMissile->index, 3); seqKill(3, nXMissile); actPostSprite(pMissile->index, kStatFree); - if (a2 == 3) + if (hitCode == 3) { int nObject = gHitInfo.hitsprite; dassert(nObject >= 0 && nObject < kMaxSprites); @@ -4188,11 +4120,10 @@ void actImpactMissile(spritetype *pMissile, int a2) actDamageSprite(nOwner, pObject, DAMAGE_TYPE_6, nDamage); } break; - case 310: default: seqKill(3, nXMissile); actPostSprite(pMissile->index, kStatFree); - if (a2 == 3) + if (hitCode == 3) { int nObject = gHitInfo.hitsprite; dassert(nObject >= 0 && nObject < kMaxSprites); @@ -4226,10 +4157,10 @@ void actTouchFloor(spritetype *pSprite, int nSector) if (pSector->extra > 0) pXSector = &xsector[pSector->extra]; - if (pXSector && (pSector->type == 618 || pXSector->damageType > 0)) + if (pXSector && (pSector->type == kSectorDamage || pXSector->damageType > 0)) { DAMAGE_TYPE nDamageType; - if (pSector->type == 618) + if (pSector->type == kSectorDamage) nDamageType = (DAMAGE_TYPE)ClipRange(pXSector->damageType, DAMAGE_TYPE_0, DAMAGE_TYPE_6); else nDamageType = (DAMAGE_TYPE)ClipRange(pXSector->damageType - 1, DAMAGE_TYPE_0, DAMAGE_TYPE_6); @@ -4291,8 +4222,8 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite) int mass1 = dudeInfo[pSprite2->type - kDudeBase].mass; int mass2 = dudeInfo[pSprite->type - kDudeBase].mass; switch (pSprite->type) { - case kCustomDude: - case kCustomDudeBurning: + case kDudeModernCustom: + case kDudeModernCustomBurning: mass2 = getSpriteMassBySize(pSprite); break; } @@ -4310,11 +4241,11 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite) if (!IsPlayerSprite(pSprite) || gPlayer[pSprite->type - kDudePlayer1].at31a == 0) { switch (pSprite2->type) { - case 229: + case kDudeTchernobog: actDamageSprite(pSprite2->index, pSprite, DAMAGE_TYPE_3, pXSprite->health << 2); break; - case kCustomDude: - case kCustomDudeBurning: + case kDudeModernCustom: + case kDudeModernCustomBurning: int dmg = (getSpriteMassBySize(pSprite2) - getSpriteMassBySize(pSprite)) + pSprite2->clipdist; if (dmg > 0) { if (IsPlayerSprite(pSprite) && powerupCheck(&gPlayer[pSprite->type - kDudePlayer1],15) > 0) @@ -4332,17 +4263,16 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite) } } } - if (pSprite2->type == 454) - { - if (pXSprite2->state) - { + + if (pSprite2->type == kTrapSawCircular) { + if (!pXSprite2->state) actDamageSprite(nSprite, pSprite, DAMAGE_TYPE_2, 1); + else { pXSprite2->data1 = 1; pXSprite2->data2 = ClipHigh(pXSprite2->data2+8, 600); actDamageSprite(nSprite, pSprite, DAMAGE_TYPE_2, 16); } - else - actDamageSprite(nSprite, pSprite, DAMAGE_TYPE_2, 1); } + } break; } @@ -4363,8 +4293,8 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite) int mass1 = dudeInfo[pSprite->type - kDudeBase].mass; int mass2 = dudeInfo[pSprite2->type - kDudeBase].mass; switch (pSprite2->type) { - case kCustomDude: - case kCustomDudeBurning: + case kDudeModernCustom: + case kDudeModernCustomBurning: mass2 = getSpriteMassBySize(pSprite2); break; } @@ -4379,8 +4309,8 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite) } switch (pSprite->type) { - case kCustomDude: - case kCustomDudeBurning: + case kDudeModernCustom: + case kDudeModernCustomBurning: { if (IsDudeSprite(pSprite2) && !IsPlayerSprite(pSprite2)) { int mass1 = getSpriteMassBySize(pSprite); @@ -4397,20 +4327,19 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite) } } - switch (pSprite2->type) - { - case 415: + switch (pSprite2->type) { + case kThingKickablePail: actKickObject(pSprite, pSprite2); break; - case 427: + case kThingZombieHead: sfxPlay3DSound(pSprite->x, pSprite->y, pSprite->z, 357, pSprite->sectnum); actKickObject(pSprite, pSprite2); actDamageSprite(-1, pSprite2, DAMAGE_TYPE_0, 80); break; - case 239: - case 240: - case 241: - case 242: + case kDudeBurningInnocent: + case kDudeBurningCultist: + case kDudeBurningZombieAxe: + case kDudeBurningZombieButcher: // This does not make sense pXSprite->burnTime = ClipLow(pXSprite->burnTime-4, 0); actDamageSprite(actOwnerIdToSpriteId(pXSprite->burnSource), pSprite, DAMAGE_TYPE_1, 8); @@ -4439,8 +4368,8 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite) int mass1 = dudeInfo[pSprite->type - kDudeBase].mass; int mass2 = dudeInfo[pSprite2->type - kDudeBase].mass; switch (pSprite2->type) { - case kCustomDude: - case kCustomDudeBurning: + case kDudeModernCustom: + case kDudeModernCustomBurning: mass2 = getSpriteMassBySize(pSprite2); break; } @@ -4455,8 +4384,8 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite) } switch (pSprite->type) { - case kCustomDude: - case kCustomDudeBurning: + case kDudeModernCustom: + case kDudeModernCustomBurning: { if (IsDudeSprite(pSprite2) && !IsPlayerSprite(pSprite2)) { int mass1 = getSpriteMassBySize(pSprite); @@ -4473,73 +4402,66 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite) } - switch (pSprite2->type) - { - case 415: - if (pPlayer) - { - if (pPlayer->at30e > gFrameClock) - return; + switch (pSprite2->type) { + case kThingKickablePail: + if (pPlayer) { + if (pPlayer->at30e > gFrameClock) return; pPlayer->at30e = (int)gFrameClock+60; } actKickObject(pSprite, pSprite2); sfxPlay3DSound(pSprite->x, pSprite->y, pSprite->z, 357, pSprite->sectnum); sfxPlay3DSound(pSprite, 374, 0, 0); break; - case 427: - if (pPlayer) - { - if (pPlayer->at30e > gFrameClock) - return; + case kThingZombieHead: + if (pPlayer) { + if (pPlayer->at30e > gFrameClock) return; pPlayer->at30e = (int)gFrameClock+60; } actKickObject(pSprite, pSprite2); sfxPlay3DSound(pSprite->x, pSprite->y, pSprite->z, 357, pSprite->sectnum); actDamageSprite(-1, pSprite2, DAMAGE_TYPE_0, 80); break; - case 454: - if (pXSprite2->state) - { + case kTrapSawCircular: + if (!pXSprite2->state) actDamageSprite(nSprite, pSprite, DAMAGE_TYPE_2, 1); + else { pXSprite2->data1 = 1; pXSprite2->data2 = ClipHigh(pXSprite2->data2+8, 600); actDamageSprite(nSprite, pSprite, DAMAGE_TYPE_2, 16); } - else - actDamageSprite(nSprite, pSprite, DAMAGE_TYPE_2, 1); break; - case 201: - case 202: - case 203: - case 204: - case 205: - case 206: - case 207: - case 210: - case 211: - case 212: - case 213: - case 214: - case 215: - case 217: - case 219: - case 220: - case 221: - case 222: - case 223: - case 224: - case 225: - case 226: - case 227: - case 228: - case 229: - case 231: - case 232: - case 233: - case 234: - case 235: - case 236: - case 237: - case 238: + case kDudeCultistTommy: + case kDudeCultistShotgun: + case kDudeZombieAxeNormal: + case kDudeZombieButcher: + case kDudeZombieAxeBuried: + case kDudeGargoyleFlesh: + case kDudeGargoyleStone: + case kDudePhantasm: + case kDudeHellHound: + case kDudeHand: + case kDudeSpiderBrown: + case kDudeSpiderRed: + case kDudeSpiderBlack: + case kDudeGillBeast: + case kDudeBat: + case kDudeRat: + case kDudePodGreen: + case kDudeTentacleGreen: + case kDudePodFire: + case kDudeTentacleFire: + case kDudePodMother: + case kDudeTentacleMother: + case kDudeCerberusTwoHead: + case kDudeCerberusOneHead: + case kDudeTchernobog: + case kDudePlayer1: + case kDudePlayer2: + case kDudePlayer3: + case kDudePlayer4: + case kDudePlayer5: + case kDudePlayer6: + case kDudePlayer7: + case kDudePlayer8: if (pPlayer && !isShrinked(pSprite)) actDamageSprite(nSprite, pSprite2,DAMAGE_TYPE_2, 8); break; @@ -4549,7 +4471,7 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite) } // by NoOne: add more trigger statements for Touch flag - if (!VanillaMode()) { + if (gModernMap) { // Touch sprites int nHSprite = -1; @@ -4563,7 +4485,7 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite) if (nHSprite >= 0 && sprite[nHSprite].extra >= 0) { XSPRITE* pXHSprite = &xsprite[sprite[nHSprite].extra]; if (pXHSprite->Touch && !pXHSprite->isTriggered && (!pXHSprite->DudeLockout || IsPlayerSprite(pSprite))) - trTriggerSprite(nHSprite, pXHSprite, 33); + trTriggerSprite(nHSprite, pXHSprite, kCmdSpriteTouch); } // Touch walls @@ -4572,7 +4494,7 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite) if ((nHWall = gSpriteHit[nXSprite].hit & 0x3fff) >= 0 && wall[nHWall].extra >= 0) { XWALL* pXHWall = &xwall[wall[nHWall].extra]; if (pXHWall->triggerTouch && !pXHWall->isTriggered && (!pXHWall->dudeLockout || IsPlayerSprite(pSprite))) - trTriggerWall(nHWall, pXHWall, 52); + trTriggerWall(nHWall, pXHWall, kCmdWallTouch); } } } @@ -4629,17 +4551,15 @@ int MoveThing(spritetype *pSprite) dassert(nSector >= 0 && nSector < kMaxSectors); ChangeSpriteSect(nSprite, nSector); } - if ((gSpriteHit[nXSprite].hit&0xc000) == 0x8000) - { + if ((gSpriteHit[nXSprite].hit&0xc000) == 0x8000) { int nHitWall = gSpriteHit[nXSprite].hit&0x3fff; actWallBounceVector((int*)&xvel[nSprite], (int*)&yvel[nSprite], nHitWall, pThingInfo->at7); - switch (pSprite->type) - { - case 427: + switch (pSprite->type) { + case kThingZombieHead: sfxPlay3DSound(pSprite, 607, 0, 0); actDamageSprite(-1, pSprite, DAMAGE_TYPE_0, 80); break; - case 415: + case kThingKickablePail: sfxPlay3DSound(pSprite, 374, 0, 0); break; } @@ -4659,7 +4579,7 @@ int MoveThing(spritetype *pSprite) { pSprite->z += 455; zvel[nSprite] += 58254; - if (pSprite->type == 427) + if (pSprite->type == kThingZombieHead) { spritetype *pFX = gFX.fxSpawn(FX_27, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); if (pFX) @@ -4701,24 +4621,23 @@ int MoveThing(spritetype *pSprite) zvel[nSprite] = 0; pSprite->flags &= ~4; } - switch (pSprite->type) - { - case 428: - if (zvel[nSprite] == 0 || Chance(0xA000)) - sub_2AA94(pSprite, pXSprite); + + switch (pSprite->type) { + case kThingNapalmBall: + if (zvel[nSprite] == 0 || Chance(0xA000)) sub_2AA94(pSprite, pXSprite); break; - case 427: - if (klabs(zvel[nSprite]) > 0x80000) - { + case kThingZombieHead: + if (klabs(zvel[nSprite]) > 0x80000) { sfxPlay3DSound(pSprite, 607, 0, 0); actDamageSprite(-1, pSprite, DAMAGE_TYPE_0, 80); } break; - case 415: + case kThingKickablePail: if (klabs(zvel[nSprite]) > 0x80000) sfxPlay3DSound(pSprite, 374, 0, 0); break; } + v8 = 0x4000|nSector; } else if (zvel[nSprite] == 0) @@ -4739,16 +4658,14 @@ int MoveThing(spritetype *pSprite) xvel[nSprite] = mulscale16(xvel[nSprite], 0xc000); yvel[nSprite] = mulscale16(yvel[nSprite], 0xc000); zvel[nSprite] = mulscale16(-zvel[nSprite], 0x4000); - switch (pSprite->type) - { - case 427: - if (klabs(zvel[nSprite]) > 0x80000) - { + switch (pSprite->type) { + case kThingZombieHead: + if (klabs(zvel[nSprite]) > 0x80000) { sfxPlay3DSound(pSprite, 607, 0, 0); actDamageSprite(-1, pSprite, DAMAGE_TYPE_0, 80); } break; - case 415: + case kThingKickablePail: if (klabs(zvel[nSprite]) > 0x80000) sfxPlay3DSound(pSprite, 374, 0, 0); break; @@ -4820,7 +4737,7 @@ void MoveDude(spritetype *pSprite) if (pSprite->statnum == kStatDude || pSprite->statnum == kStatThing) actDamageSprite(pSprite->index, pSprite, DAMAGE_TYPE_0, 1000<<4); } - if (sector[nSector].type >= 612 && sector[nSector].type <= 617) + if (sector[nSector].type >= kSectorPath && sector[nSector].type <= kSectorRotate) { short nSector2 = nSector; if (pushmove_old(&pSprite->x, &pSprite->y, &pSprite->z, &nSector2, wd, tz, bz, CLIPMASK0) == -1) @@ -4849,12 +4766,19 @@ void MoveDude(spritetype *pSprite) actImpactMissile(pHitSprite, 3); gHitInfo = hitInfo; } - // by NoOne: this is why touch for things never worked; they always ON - if (pHitXSprite && pHitXSprite->Touch /*&& !pHitXSprite->state*/ && !pHitXSprite->isTriggered) { - if (!pHitXSprite->DudeLockout || IsPlayerSprite(pSprite)) // allow dudeLockout for Touch flag - trTriggerSprite(nHitSprite, pHitXSprite, 33); - } if (pDudeInfo->lockOut && pHitXSprite && pHitXSprite->Push && !pHitXSprite->key && !pHitXSprite->DudeLockout && !pHitXSprite->state && !pHitXSprite->busy && !pPlayer) - trTriggerSprite(nHitSprite, pHitXSprite, 30); + + if (pHitXSprite && pHitXSprite->Touch && !pHitXSprite->isTriggered) { + + // by NoOne: do not check state (so, things can work with touch too) and allow dudelockout + if ((gModernMap) && (!pHitXSprite->DudeLockout || IsPlayerSprite(pSprite))) + trTriggerSprite(nHitSprite, pHitXSprite, kCmdSpriteTouch); + else if (!pHitXSprite->state) // or check like vanilla do + trTriggerSprite(nHitSprite, pHitXSprite, kCmdSpriteTouch); + } + + if (pDudeInfo->lockOut && pHitXSprite && pHitXSprite->Push && !pHitXSprite->key && !pHitXSprite->DudeLockout && !pHitXSprite->state && !pHitXSprite->busy && !pPlayer) + trTriggerSprite(nHitSprite, pHitXSprite, kCmdSpritePush); + break; } case 0x8000: @@ -4865,7 +4789,7 @@ void MoveDude(spritetype *pSprite) if (pHitWall->extra > 0) pHitXWall = &xwall[pHitWall->extra]; if (pDudeInfo->lockOut && pHitXWall && pHitXWall->triggerPush && !pHitXWall->key && !pHitXWall->dudeLockout && !pHitXWall->state && !pHitXWall->busy && !pPlayer) - trTriggerWall(nHitWall, pHitXWall, 50); + trTriggerWall(nHitWall, pHitXWall, kCmdWallPush); if (pHitWall->nextsector != -1) { sectortype *pHitSector = §or[pHitWall->nextsector]; @@ -4873,7 +4797,7 @@ void MoveDude(spritetype *pSprite) if (pHitSector->extra > 0) pHitXSector = &xsector[pHitSector->extra]; if (pDudeInfo->lockOut && pHitXSector && pHitXSector->Wallpush && !pHitXSector->Key && !pHitXSector->at37_7 && !pHitXSector->state && !pHitXSector->busy && !pPlayer) - trTriggerSector(pHitWall->nextsector, pHitXSector, 40); + trTriggerSector(pHitWall->nextsector, pHitXSector, kCmdSectorPush); if (top < pHitSector->ceilingz || bottom > pHitSector->floorz) { // ??? @@ -4899,19 +4823,17 @@ void MoveDude(spritetype *pSprite) else pXSector = NULL; if (pXSector && pXSector->Exit && (pPlayer || !pXSector->at37_7)) - trTriggerSector(pSprite->sectnum, pXSector, 43); + trTriggerSector(pSprite->sectnum, pXSector, kCmdSectorExit); ChangeSpriteSect(nSprite, nSector); + nXSector = sector[nSector].extra; - if (nXSector > 0) - pXSector = &xsector[nXSector]; - else - pXSector = NULL; - if (pXSector && pXSector->Enter && (pPlayer || !pXSector->at37_7)) - { - if (sector[nSector].type == 604) + pXSector = (nXSector > 0) ? pXSector = &xsector[nXSector] : NULL; + if (pXSector && pXSector->Enter && (pPlayer || !pXSector->at37_7)) { + if (sector[nSector].type == kSectorTeleport) pXSector->data = pPlayer ? nSprite : -1; - trTriggerSector(nSector, pXSector, 42); + trTriggerSector(nSector, pXSector, kCmdSectorEnter); } + nSector = pSprite->sectnum; } char bUnderwater = 0; @@ -4987,43 +4909,37 @@ void MoveDude(spritetype *pSprite) else playerCorrectInertia(pPlayer, &oldpos); } - switch (nLink) - { - case 12: + switch (nLink) { + case kMarkerLowStack: if (pPlayer == gView) SetBitString(gotpic, sector[pSprite->sectnum].floorpicnum); break; - case 11: + case kMarkerUpStack: if (pPlayer == gView) SetBitString(gotpic, sector[pSprite->sectnum].ceilingpicnum); break; - case 10: - case 14: + case kMarkerLowWater: + case kMarkerLowGoo: pXSprite->medium = 0; - if (pPlayer) - { + if (pPlayer) { pPlayer->at2f = 0; pPlayer->at302 = 0; - if (!pPlayer->at31c && pPlayer->atc.buttonFlags.jump) - { + if (!pPlayer->at31c && pPlayer->atc.buttonFlags.jump) { zvel[nSprite] = -0x6aaaa; pPlayer->at31c = 1; } sfxPlay3DSound(pSprite, 721, -1, 0); - } - else - { - switch (pSprite->type) - { - case 201: - case 202: + } else { + switch (pSprite->type) { + case kDudeCultistTommy: + case kDudeCultistShotgun: aiNewState(pSprite, pXSprite, &cultistGoto); break; - case 217: + case kDudeGillBeast: aiNewState(pSprite, pXSprite, &gillBeastGoto); pSprite->flags |= 6; break; - case 218: + case kDudeBoneEel: actKillDude(pSprite->index, pSprite, DAMAGE_TYPE_0, 1000<<4); break; } @@ -5046,72 +4962,71 @@ void MoveDude(spritetype *pSprite) pPlayer->at2f = 1; pXSprite->burnTime = 0; pPlayer->at302 = klabs(zvel[nSprite]) >> 12; - evPost(nSprite, 3, 0, CALLBACK_ID_10); + evPost(nSprite, 3, 0, kCallbackPlayerBubble); sfxPlay3DSound(pSprite, 720, -1, 0); } else { - switch (pSprite->type) - { - case 201: - case 202: + switch (pSprite->type) { + case kDudeCultistTommy: + case kDudeCultistShotgun: pXSprite->burnTime = 0; - evPost(nSprite, 3, 0, CALLBACK_ID_11); + evPost(nSprite, 3, 0, kCallbackEnemeyBubble); sfxPlay3DSound(pSprite, 720, -1, 0); aiNewState(pSprite, pXSprite, &cultistSwimGoto); break; - case 240: + case kDudeBurningCultist: { // There is no difference between water and goo except following chance: if (Chance(nLink == kMarkerUpGoo ? 0x400 : 0xa00)) { - pSprite->type = 201; + pSprite->type = kDudeCultistTommy; pXSprite->burnTime = 0; - evPost(nSprite, 3, 0, CALLBACK_ID_11); + evPost(nSprite, 3, 0, kCallbackEnemeyBubble); sfxPlay3DSound(pSprite, 720, -1, 0); aiNewState(pSprite, pXSprite, &cultistSwimGoto); } else { - pSprite->type = 202; + pSprite->type = kDudeCultistShotgun; pXSprite->burnTime = 0; - evPost(nSprite, 3, 0, CALLBACK_ID_11); + evPost(nSprite, 3, 0, kCallbackEnemeyBubble); sfxPlay3DSound(pSprite, 720, -1, 0); aiNewState(pSprite, pXSprite, &cultistSwimGoto); } break; } - case 203: + case kDudeZombieAxeNormal: pXSprite->burnTime = 0; - evPost(nSprite, 3, 0, CALLBACK_ID_11); + evPost(nSprite, 3, 0, kCallbackEnemeyBubble); sfxPlay3DSound(pSprite, 720, -1, 0); aiNewState(pSprite, pXSprite, &zombieAGoto); break; - case 204: + case kDudeZombieButcher: pXSprite->burnTime = 0; - evPost(nSprite, 3, 0, CALLBACK_ID_11); + evPost(nSprite, 3, 0, kCallbackEnemeyBubble); sfxPlay3DSound(pSprite, 720, -1, 0); aiNewState(pSprite, pXSprite, &zombieFGoto); break; - case 217: + case kDudeGillBeast: pXSprite->burnTime = 0; - evPost(nSprite, 3, 0, CALLBACK_ID_11); + evPost(nSprite, 3, 0, kCallbackEnemeyBubble); sfxPlay3DSound(pSprite, 720, -1, 0); aiNewState(pSprite, pXSprite, &gillBeastSwimGoto); pSprite->flags &= ~6; break; - case 206: - case 211: - case 213: - case 214: - case 215: - case 219: - case 220: - case 239: + case kDudeGargoyleFlesh: + case kDudeHellHound: + case kDudeSpiderBrown: + case kDudeSpiderRed: + case kDudeSpiderBlack: + case kDudeBat: + case kDudeRat: + case kDudeBurningInnocent: actKillDude(pSprite->index, pSprite, DAMAGE_TYPE_0, 1000 << 4); break; - case kCustomDude: - evPost(nSprite, 3, 0, CALLBACK_ID_11); + case kDudeModernCustom: + evPost(nSprite, 3, 0, kCallbackEnemeyBubble); if (!canSwim(pSprite)) actKillDude(pSprite->index, pSprite, DAMAGE_TYPE_0, 1000 << 4); break; } @@ -5125,65 +5040,65 @@ void MoveDude(spritetype *pSprite) pPlayer->changeTargetKin = 1; pXSprite->burnTime = 0; pPlayer->at302 = klabs(zvel[nSprite])>>12; - evPost(nSprite, 3, 0, CALLBACK_ID_10); + evPost(nSprite, 3, 0, kCallbackPlayerBubble); sfxPlay3DSound(pSprite, 720, -1, 0); } else { switch (pSprite->type) { - case 201: - case 202: + case kDudeCultistTommy: + case kDudeCultistShotgun: pXSprite->burnTime = 0; - evPost(nSprite, 3, 0, CALLBACK_ID_11); + evPost(nSprite, 3, 0, kCallbackEnemeyBubble); sfxPlay3DSound(pSprite, 720, -1, 0); aiNewState(pSprite, pXSprite, &cultistSwimGoto); break; - case 240: + case kDudeBurningCultist: if (Chance(0x400)) { - pSprite->type = 201; + pSprite->type = kDudeCultistTommy; pXSprite->burnTime = 0; - evPost(nSprite, 3, 0, CALLBACK_ID_11); + evPost(nSprite, 3, 0, kCallbackEnemeyBubble); sfxPlay3DSound(pSprite, 720, -1, 0); aiNewState(pSprite, pXSprite, &cultistSwimGoto); } else { - pSprite->type = 202; + pSprite->type = kDudeCultistShotgun; pXSprite->burnTime = 0; - evPost(nSprite, 3, 0, CALLBACK_ID_11); + evPost(nSprite, 3, 0, kCallbackEnemeyBubble); sfxPlay3DSound(pSprite, 720, -1, 0); aiNewState(pSprite, pXSprite, &cultistSwimGoto); } break; - case 203: + case kDudeZombieAxeNormal: pXSprite->burnTime = 0; - evPost(nSprite, 3, 0, CALLBACK_ID_11); + evPost(nSprite, 3, 0, kCallbackEnemeyBubble); sfxPlay3DSound(pSprite, 720, -1, 0); aiNewState(pSprite, pXSprite, &zombieAGoto); break; - case 204: + case kDudeZombieButcher: pXSprite->burnTime = 0; - evPost(nSprite, 3, 0, CALLBACK_ID_11); + evPost(nSprite, 3, 0, kCallbackEnemeyBubble); sfxPlay3DSound(pSprite, 720, -1, 0); aiNewState(pSprite, pXSprite, &zombieFGoto); break; - case 217: + case kDudeGillBeast: pXSprite->burnTime = 0; - evPost(nSprite, 3, 0, CALLBACK_ID_11); + evPost(nSprite, 3, 0, kCallbackEnemeyBubble); sfxPlay3DSound(pSprite, 720, -1, 0); aiNewState(pSprite, pXSprite, &gillBeastSwimGoto); pSprite->flags &= ~6; break; - case 206: - case 211: - case 213: - case 214: - case 215: - case 219: - case 220: - case 239: + case kDudeGargoyleFlesh: + case kDudeHellHound: + case kDudeSpiderBrown: + case kDudeSpiderRed: + case kDudeSpiderBlack: + case kDudeBat: + case kDudeRat: + case kDudeBurningInnocent: actKillDude(pSprite->index, pSprite, DAMAGE_TYPE_0, 1000<<4); break; } @@ -5327,7 +5242,7 @@ int MoveMissile(spritetype *pSprite) gHitInfo.hitsect = -1; gHitInfo.hitwall = -1; gHitInfo.hitsprite = -1; - if (pSprite->type == 304) + if (pSprite->type == kMissileFlameSpray) actAirDrag(pSprite, 0x1000); int nSprite = pSprite->index; if (pXSprite->target != -1 && (xvel[nSprite] || yvel[nSprite] || zvel[nSprite])) @@ -5342,7 +5257,7 @@ int MoveMissile(spritetype *pSprite) { int nTargetAngle = getangle(-(pTarget->y-pSprite->y), pTarget->x-pSprite->x); int UNUSED(nAngle) = getangle(xvel[nSprite]>>12,yvel[nSprite]>>12); - int vx = missileInfo[pSprite->type-300].at2; + int vx = missileInfo[pSprite->type - kMissileBase].at2; int vy = 0; RotatePoint(&vx, &vy, (nTargetAngle+1536)&2047, 0, 0); xvel[nSprite] = vx; @@ -5411,7 +5326,7 @@ int MoveMissile(spritetype *pSprite) XWALL *pXWall = &xwall[pWall->extra]; if (pXWall->triggerVector) { - trTriggerWall(gHitInfo.hitwall, pXWall, 51); + trTriggerWall(gHitInfo.hitwall, pXWall, kCmdWallImpact); if (!(pWall->cstat&64)) { vdi = -1; @@ -5483,7 +5398,7 @@ void actExplodeSprite(spritetype *pSprite) int nType; switch (pSprite->type) { - case 312: + case kMissileFireballNapam: nType = 7; seqSpawn(4, 3, nXSprite, -1); if (Chance(0x8000)) @@ -5491,7 +5406,7 @@ void actExplodeSprite(spritetype *pSprite) sfxPlay3DSound(pSprite, 303, -1, 0); GibSprite(pSprite, GIBTYPE_5, NULL, NULL); break; - case 303: + case kMissileFlareAlt: nType = 3; seqSpawn(9, 3, nXSprite, -1); if (Chance(0x8000)) @@ -5499,26 +5414,24 @@ void actExplodeSprite(spritetype *pSprite) sfxPlay3DSound(pSprite, 306, 24+(pSprite->index&3), 1); GibSprite(pSprite, GIBTYPE_5, NULL, NULL); break; - case 313: - case 314: + case kMissileFireballCerberus: + case kMissileFireballTchernobog: nType = 3; seqSpawn(5, 3, nXSprite, -1); sfxPlay3DSound(pSprite, 304, -1, 0); GibSprite(pSprite, GIBTYPE_5, NULL, NULL); break; - case 418: + case kThingArmedTNTStick: nType = 0; - if (gSpriteHit[nXSprite].florhit == 0) - seqSpawn(4,3,nXSprite,-1); - else - seqSpawn(3,3,nXSprite,-1); + if (gSpriteHit[nXSprite].florhit == 0) seqSpawn(4,3,nXSprite,-1); + else seqSpawn(3,3,nXSprite,-1); sfxPlay3DSound(pSprite, 303, -1, 0); GibSprite(pSprite, GIBTYPE_5, NULL, NULL); break; - case 401: - case 402: - case 419: - case kGDXThingTNTProx: + case kThingArmedProxBomb: + case kThingArmedRemoteBomb: + case kThingArmedTNTBundle: + case kModernThingTNTProx: nType = 1; if (gSpriteHit[nXSprite].florhit == 0) seqSpawn(4,3,nXSprite,-1); @@ -5527,13 +5440,13 @@ void actExplodeSprite(spritetype *pSprite) sfxPlay3DSound(pSprite, 304, -1, 0); GibSprite(pSprite, GIBTYPE_5, NULL, NULL); break; - case 420: + case kThingArmedSpray: nType = 4; seqSpawn(5, 3, nXSprite, -1); sfxPlay3DSound(pSprite, 307, -1, 0); GibSprite(pSprite, GIBTYPE_5, NULL, NULL); break; - case 400: + case kThingTNTBarrel: { spritetype *pSprite2 = actSpawnSprite(pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0, 1); pSprite2->owner = pSprite->owner; @@ -5553,16 +5466,17 @@ void actExplodeSprite(spritetype *pSprite) pSprite = pSprite2; break; } - case 459: // By NoOne: allow to customize hidden exploder thing + case kTrapExploder: // By NoOne: allow to customize hidden exploder trap { // Defaults for exploder nType = 1; int nSnd = 304; int nSeq = 4; + if (gModernMap) { // Temp variables for override via data fields int tSnd = 0; int tSeq = 0; - XSPRITE *pXSPrite = &xsprite[nXSprite]; + XSPRITE* pXSPrite = &xsprite[nXSprite]; nType = pXSPrite->data1; // Explosion type tSeq = pXSPrite->data2; // SEQ id tSnd = pXSPrite->data3; // Sound Id @@ -5578,14 +5492,15 @@ void actExplodeSprite(spritetype *pSprite) // Override previous sound and seq assigns if (tSeq > 0) nSeq = tSeq; if (tSnd > 0) nSnd = tSnd; - - if (gSysRes.Lookup(pXSPrite->data2, "SEQ")) + } + + if (gSysRes.Lookup(nSeq, "SEQ")) seqSpawn(nSeq, 3, nXSprite, -1); sfxPlay3DSound(pSprite, nSnd, -1, 0); } break; - case 429: + case kThingPodGreenBall: nType = 3; seqSpawn(9, 3, nXSprite, -1); sfxPlay3DSound(pSprite, 307, -1, 0); @@ -5652,7 +5567,7 @@ void actProcessSprites(void) int nSprite; int nNextSprite; - if (!VanillaMode()) { + if (gModernMap) { // by NoOne: process additional proximity sprites if (gProxySpritesCount > 0) { @@ -5672,7 +5587,7 @@ void actProcessSprites(void) for (int nAffected = headspritestat[kStatDude]; nAffected >= 0; nAffected = nextspritestat[nAffected]) { if ((sprite[nAffected].flags & 32) || xsprite[sprite[nAffected].extra].health <= 0) continue; else if (CheckProximity(&sprite[nAffected], x, y, z, sectnum, 96)) { - trTriggerSprite(index, pXProxSpr, 35); + trTriggerSprite(index, pXProxSpr, kCmdSpriteProximity); break; } } @@ -5681,7 +5596,7 @@ void actProcessSprites(void) for (int a = connecthead; a >= 0; a = connectpoint2[a]) { if (gPlayer[a].pXSprite->health > 0 && CheckProximity(gPlayer[a].pSprite, x, y, z, sectnum, 96)) { - trTriggerSprite(index, pXProxSpr, 35); + trTriggerSprite(index, pXProxSpr, kCmdSpriteProximity); break; } } @@ -5706,7 +5621,7 @@ void actProcessSprites(void) for (int a = connecthead; a >= 0; a = connectpoint2[a]) { spritetype* pPlaySprite = gPlayer[a].pSprite; if (gPlayer[a].pXSprite->health > 0 && cansee(x, y, z, sectnum, pPlaySprite->x, pPlaySprite->y, pPlaySprite->z, pPlaySprite->sectnum)) { - trTriggerSprite(index, pXSightSpr, 34); + trTriggerSprite(index, pXSightSpr, kCmdSpriteSight); break; } } @@ -5781,20 +5696,28 @@ void actProcessSprites(void) if (pSprite->flags&32) continue; int nXSprite = pSprite->extra; - if (nXSprite > 0) - { + if (nXSprite > 0) { XSPRITE *pXSprite = &xsprite[nXSprite]; - if (pSprite->type == 425 || pSprite->type == 426 || pSprite->type == 427) - if (pXSprite->locked && gFrameClock >= pXSprite->targetX) - pXSprite->locked = 0; + switch (pSprite->type) { + case kThingBloodBits: + case kThingBloodChunks: + case kThingZombieHead: + if (pXSprite->locked && gFrameClock >= pXSprite->targetX) pXSprite->locked = 0; + break; + } + if (pXSprite->burnTime > 0) { pXSprite->burnTime = ClipLow(pXSprite->burnTime-4,0); actDamageSprite(actOwnerIdToSpriteId(pXSprite->burnSource), pSprite, DAMAGE_TYPE_1, 8); } + + if (pXSprite->Proximity) { // by NoOne: don't process locked or 1-shot things for proximity - if (pXSprite->Proximity && (VanillaMode() || (pXSprite->locked != 1 && pXSprite->isTriggered != true))) { - if (pSprite->type == 431) pXSprite->target = -1; + if (gModernMap && (pXSprite->locked || pXSprite->isTriggered)) + continue; + + //if (pSprite->type == kThingDroppedLifeLeech) pXSprite->target = -1; why? for (int nSprite2 = headspritestat[kStatDude]; nSprite2 >= 0; nSprite2 = nNextSprite) { @@ -5802,24 +5725,22 @@ void actProcessSprites(void) spritetype *pSprite2 = &sprite[nSprite2]; if (pSprite2->flags&32) continue; XSPRITE *pXSprite2 = &xsprite[pSprite2->extra]; - if ((unsigned int)pXSprite2->health > 0) - { + if ((unsigned int)pXSprite2->health > 0) { // by NoOne: allow dudeLockout for proximity flag - if (pSprite->type != 431 && pXSprite->DudeLockout && !IsPlayerSprite(pSprite2)) + if (gModernMap && pSprite->type != kThingDroppedLifeLeech && pXSprite->DudeLockout && !IsPlayerSprite(pSprite2)) continue; int proxyDist = 96; - if (pSprite->type == kGDXThingCustomDudeLifeLeech) proxyDist = 512; - else if (pSprite->type == 431 && pXSprite->target == -1) - { + if (pSprite->type == kModernThingEnemyLifeLeech) proxyDist = 512; + else if (pSprite->type == kThingDroppedLifeLeech /*&& pXSprite->target == -1*/) { int nOwner = actOwnerIdToSpriteId(pSprite->owner); spritetype *pOwner = &sprite[nOwner]; PLAYER *pPlayer = &gPlayer[pOwner->type-kDudePlayer1]; PLAYER *pPlayer2 = NULL; if (IsPlayerSprite(pSprite2)) pPlayer2 = &gPlayer[pSprite2->type-kDudePlayer1]; - if (nSprite2 == nOwner || pSprite2->type == 205 || pSprite2->type == 220 || pSprite2->type == 219) + if (nSprite2 == nOwner || pSprite2->type == kDudeZombieAxeBuried || pSprite2->type == kDudeRat || pSprite2->type == kDudeBat) continue; if (gGameOptions.nGameType == 3 && pPlayer2 && pPlayer->at2ea == pPlayer2->at2ea) continue; @@ -5827,24 +5748,25 @@ void actProcessSprites(void) continue; proxyDist = 512; } + if (CheckProximity(pSprite2, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, proxyDist)) { switch (pSprite->type) { - case kGDXThingTNTProx: + case kModernThingTNTProx: if (!IsPlayerSprite(pSprite2)) continue; pSprite->pal = 0; break; - case 431: + case kThingDroppedLifeLeech: if (!Chance(0x4000) && nNextSprite >= 0) continue; if (pSprite2->cstat & CLIPMASK0) pXSprite->target = pSprite2->index; else continue; break; - case kGDXThingCustomDudeLifeLeech: + case kModernThingEnemyLifeLeech: if (pXSprite->target != pSprite2->xvel) continue; break; } if (pSprite->owner == -1) actPropagateSpriteOwner(pSprite, pSprite2); - trTriggerSprite(nSprite, pXSprite, 35); + trTriggerSprite(nSprite, pXSprite, kCmdSpriteProximity); } } } @@ -5915,14 +5837,14 @@ void actProcessSprites(void) { XSPRITE *pXSprite = &xsprite[nXSprite]; if (pXSprite->Impact) - trTriggerSprite(nSprite, pXSprite, 0); + trTriggerSprite(nSprite, pXSprite, kCmdOff); switch (pSprite->type) { - case 423: - case 424: + case kThingDripWater: + case kThingDripBlood: MakeSplash(pSprite, pXSprite); break; - case kGDXThingThrowableRock: + case kModernThingThrowableRock: seqSpawn(24, 3, nXSprite, -1); if ((hit & 0xc000) == 0xc000) { @@ -5934,7 +5856,7 @@ void actProcessSprites(void) actDamageSprite(actSpriteOwnerToSpriteId(pSprite), pObject, DAMAGE_TYPE_0, pXSprite->data1); } break; - case 421: + case kThingBone: seqSpawn(24, 3, nXSprite, -1); if ((hit&0xc000) == 0xc000) { @@ -5944,11 +5866,11 @@ void actProcessSprites(void) actDamageSprite(actSpriteOwnerToSpriteId(pSprite), pObject, DAMAGE_TYPE_0, 12); } break; - case 430: + case kThingPodFireBall: if ((hit&0xc000) == 0x4000) { sub_2A620(actSpriteOwnerToSpriteId(pSprite), pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, 200, 1, 20, DAMAGE_TYPE_3, 6, 0, 0, 0); - evPost(pSprite->index, 3, 0, CALLBACK_ID_19); + evPost(pSprite->index, 3, 0, kCallbackFXPodBloodSplat); } else { @@ -5958,10 +5880,10 @@ void actProcessSprites(void) dassert(nObject >= 0 && nObject < kMaxSprites); spritetype *pObject = &sprite[nObject]; actDamageSprite(actSpriteOwnerToSpriteId(pSprite), pObject, DAMAGE_TYPE_0, 12); - evPost(pSprite->index, 3, 0, CALLBACK_ID_19); + evPost(pSprite->index, 3, 0, kCallbackFXPodBloodSplat); } break; - case 429: + case kThingPodGreenBall: { int nObject = hit & 0x3fff; if ((hit&0xc000) != 0xc000 && (nObject < 0 || nObject >= 4096)) @@ -6006,12 +5928,12 @@ void actProcessSprites(void) int nSector = pSprite->sectnum; gAffectedSectors[0] = -1; gAffectedXWalls[0] = -1; - + int radius = pExplodeInfo->radius; + // By NoOne: Allow to override explosion radius by data4 field of any sprite which have statnum 2 set in editor // or of Hidden Exploder. - int radius = pXSprite->data4; - if (pXSprite->data4 <= 0) - radius = pExplodeInfo->radius; + if (gModernMap && pXSprite->data4 > 0) + radius = pXSprite->data4; GetClosestSpriteSectors(nSector, x, y, radius, gAffectedSectors, v24c, gAffectedXWalls); @@ -6021,7 +5943,7 @@ void actProcessSprites(void) if (nWall == -1) break; XWALL *pXWall = &xwall[wall[nWall].extra]; - trTriggerWall(nWall, pXWall, 51); + trTriggerWall(nWall, pXWall, kCmdWallImpact); } for (int nSprite2 = headspritestat[kStatDude]; nSprite2 >= 0; nSprite2 = nextspritestat[nSprite2]) @@ -6045,7 +5967,7 @@ void actProcessSprites(void) dassert(pDude->extra > 0 && pDude->extra < kMaxXSprites); XSPRITE *pXDude = &xsprite[pDude->extra]; if (!pXDude->burnTime) - evPost(nSprite2, 3, 0, CALLBACK_ID_0); + evPost(nSprite2, 3, 0, kCallbackFXFlameLick); actBurnSprite(pSprite->owner, pXDude, pExplodeInfo->atb<<2); } } @@ -6070,8 +5992,8 @@ void actProcessSprites(void) { dassert(pThing->extra > 0 && pThing->extra < kMaxXSprites); XSPRITE *pXThing = &xsprite[pThing->extra]; - if (pThing->type == 400 && !pXThing->burnTime) - evPost(nSprite2, 3, 0, CALLBACK_ID_0); + if (pThing->type == kThingTNTBarrel && !pXThing->burnTime) + evPost(nSprite2, 3, 0, kCallbackFXFlameLick); actBurnSprite(pSprite->owner, pXThing, pExplodeInfo->atb<<2); } } @@ -6105,7 +6027,7 @@ void actProcessSprites(void) // By NoOne: if data4 > 0, do not remove explosion. This can be useful when designer wants put explosion generator in map manually // via sprite statnum 2. - if (!(pSprite->flags & kModernTypeFlag1)) { + if (!gModernMap || !(pSprite->flags & kModernTypeFlag1)) { pXSprite->data1 = ClipLow(pXSprite->data1 - 4, 0); pXSprite->data2 = ClipLow(pXSprite->data2 - 4, 0); pXSprite->data3 = ClipLow(pXSprite->data3 - 4, 0); @@ -6122,14 +6044,12 @@ void actProcessSprites(void) int nXSprite = pSprite->extra; dassert(nXSprite > 0 && nXSprite < kMaxXSprites); XSPRITE *pXSprite = &xsprite[nXSprite]; - switch (pSprite->type) - { - case 454: + switch (pSprite->type) { + case kTrapSawCircular: pXSprite->data2 = ClipLow(pXSprite->data2-4, 0); break; - case 452: - if (pXSprite->state && seqGetStatus(3, nXSprite) < 0) - { + case kTrapFlame: + if (pXSprite->state && seqGetStatus(3, nXSprite) < 0) { int x = pSprite->x; int y = pSprite->y; int z = pSprite->z; @@ -6169,10 +6089,10 @@ void actProcessSprites(void) { switch (pSprite->type) { - case 239: - case 240: - case 241: - case 242: + case kDudeBurningInnocent: + case kDudeBurningCultist: + case kDudeBurningZombieAxe: + case kDudeBurningZombieButcher: actDamageSprite(actOwnerIdToSpriteId(pXSprite->burnSource), pSprite, DAMAGE_TYPE_1, 8); break; default: @@ -6183,7 +6103,7 @@ void actProcessSprites(void) } // By NoOne: handle incarnations of custom dude - if (pSprite->type == kCustomDude && pXSprite->txID > 0 && pXSprite->health <= 0 && seqGetStatus(3, nXSprite) < 0) { + if (pSprite->type == kDudeModernCustom && pXSprite->txID > 0 && pXSprite->health <= 0 && seqGetStatus(3, nXSprite) < 0) { XSPRITE* pXIncarnation = getNextIncarnation(pXSprite); if (pXIncarnation != NULL) { spritetype* pIncarnation = &sprite[pXIncarnation->reference]; @@ -6198,7 +6118,7 @@ void actProcessSprites(void) pXIncarnation->triggerOff = false; // trigger dude death before transform - trTriggerSprite(nSprite, pXSprite, COMMAND_ID_0); + trTriggerSprite(nSprite, pXSprite, kCmdOff); pSprite->type = pIncarnation->type; pSprite->flags = pIncarnation->flags; @@ -6222,7 +6142,7 @@ void actProcessSprites(void) short oldData2 = pXSprite->data2; pXSprite->data2 = pXIncarnation->data2; // seq new seqId and save old one. // if incarnation is active dude, it's sndStartId will be stored in sysData1, otherwise it will be data3 - if (pIncarnation->statnum == kStatDude && pIncarnation->type == kCustomDude) pXSprite->sysData1 = pXIncarnation->sysData1; + if (pIncarnation->statnum == kStatDude && pIncarnation->type == kDudeModernCustom) pXSprite->sysData1 = pXIncarnation->sysData1; else pXIncarnation->data3; pXSprite->data4 = pXIncarnation->data4; @@ -6247,11 +6167,11 @@ void actProcessSprites(void) int seqId = dudeInfo[pSprite->type - kDudeBase].seqStartID; switch (pSprite->type) { - case 225: // fake dude - case 226: // fake dude + case kDudePodMother: // fake dude + case kDudeTentacleMother: // fake dude break; - case kCustomDude: - case kCustomDudeBurning: + case kDudeModernCustom: + case kDudeModernCustomBurning: seqId = getSeqStartId(pXSprite); if (seqId != oldData2) getSpriteMassBySize(pSprite); // create or refresh mass cache @@ -6288,17 +6208,17 @@ void actProcessSprites(void) } else { // just trigger dude death - trTriggerSprite(nSprite, pXSprite, COMMAND_ID_0); + trTriggerSprite(nSprite, pXSprite, kCmdOff); } } - if (pSprite->type == 227) + if (pSprite->type == kDudeCerberusTwoHead) { if (pXSprite->health <= 0 && seqGetStatus(3, nXSprite) < 0) { pXSprite->health = dudeInfo[28].startHealth<<4; - pSprite->type = 228; + pSprite->type = kDudeCerberusOneHead; if (pXSprite->target != -1) aiSetTarget(pXSprite, pXSprite->target); aiActivateDude(pSprite, pXSprite); @@ -6313,11 +6233,11 @@ void actProcessSprites(void) if (pSprite2->flags&32) continue; XSPRITE *pXSprite2 = &xsprite[pSprite2->extra]; - if ((unsigned int)pXSprite2->health > 0 && pSprite2->type >= kDudePlayer1 && pSprite2->type <= kDudePlayer8) + if ((unsigned int)pXSprite2->health > 0 && IsPlayerSprite(pSprite2)) { if (CheckProximity(pSprite2, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, 128)) { - trTriggerSprite(nSprite, pXSprite, 35); + trTriggerSprite(nSprite, pXSprite, kCmdSpriteProximity); } } } @@ -6508,9 +6428,9 @@ spritetype *actSpawnDude(spritetype *pSource, short nType, int a3, int a4) // By NoOne: add a way to inherit some values of spawner type 18 by dude. // This way designer can count enemies via switches and do many other interesting things. - if (pSource->flags & kModernTypeFlag1) { + if (gModernMap && pSource->flags & kModernTypeFlag1) { switch (pSource->type) { // allow inheriting only for selected source types - case 18: + case kMarkerDudeSpawn: //inherit pal? if (pSprite2->pal <= 0) pSprite2->pal = pSource->pal; @@ -6586,9 +6506,8 @@ spritetype * actSpawnThing(int nSector, int x, int y, int z, int nThingType) if (pThingInfo->at16) pSprite->yrepeat = pThingInfo->at16; SetBitString(show2dsprite, pSprite->index); - switch (nThingType) - { - case 432: + switch (nThingType) { + case kThingVoodooHead: pXThing->data1 = 0; pXThing->data2 = 0; pXThing->data3 = 0; @@ -6597,8 +6516,8 @@ spritetype * actSpawnThing(int nSector, int x, int y, int z, int nThingType) pXThing->triggerOnce = 1; pXThing->isTriggered = 0; break; - case 431: - case kGDXThingCustomDudeLifeLeech: + case kThingDroppedLifeLeech: + case kModernThingEnemyLifeLeech: pXThing->data1 = 0; pXThing->data2 = 0; pXThing->data3 = 0; @@ -6607,7 +6526,7 @@ spritetype * actSpawnThing(int nSector, int x, int y, int z, int nThingType) pXThing->triggerOnce = 0; pXThing->isTriggered = 0; break; - case 427: + case kThingZombieHead: pXThing->data1 = 8; pXThing->data2 = 0; pXThing->data3 = 0; @@ -6618,12 +6537,9 @@ spritetype * actSpawnThing(int nSector, int x, int y, int z, int nThingType) pXThing->triggerOnce = 0; pXThing->isTriggered = 0; break; - case 425: - case 426: - if (nThingType == 425) - pXThing->data1 = 19; - else if (nThingType == 426) - pXThing->data1 = 8; + case kThingBloodBits: + case kThingBloodChunks: + pXThing->data1 = (nThingType == kThingBloodBits) ? 19 : 8; pXThing->data2 = 0; pXThing->data3 = 0; pXThing->data4 = 318; @@ -6633,16 +6549,16 @@ spritetype * actSpawnThing(int nSector, int x, int y, int z, int nThingType) pXThing->triggerOnce = 0; pXThing->isTriggered = 0; break; - case 418: - evPost(nThing, 3, 0, CALLBACK_ID_8); + case kThingArmedTNTStick: + evPost(nThing, 3, 0, kCallbackFXDynPuff); sfxPlay3DSound(pSprite, 450, 0, 0); break; - case 419: + case kThingArmedTNTBundle: sfxPlay3DSound(pSprite, 450, 0, 0); - evPost(nThing, 3, 0, CALLBACK_ID_8); + evPost(nThing, 3, 0, kCallbackFXDynPuff); break; - case 420: - evPost(nThing, 3, 0, CALLBACK_ID_8); + case kThingArmedSpray: + evPost(nThing, 3, 0, kCallbackFXDynPuff); break; } return pSprite; @@ -6721,7 +6637,7 @@ spritetype* actFireMissile(spritetype *pSprite, int a2, int a3, int a4, int a5, int nXSprite = pMissile->extra; dassert(nXSprite > 0 && nXSprite < kMaxXSprites); xsprite[nXSprite].target = -1; - evPost(nMissile, 3, 600, CALLBACK_ID_1); + evPost(nMissile, 3, 600, kCallbackRemove); actBuildMissile(pMissile, nXSprite, nSprite); @@ -6735,52 +6651,51 @@ spritetype* actFireMissile(spritetype *pSprite, int a2, int a3, int a4, int a5, void actBuildMissile(spritetype* pMissile, int nXSprite, int nSprite) { int nMissile = pMissile->index; - switch (pMissile->type) - { - case 315: - evPost(nMissile, 3, 0, CALLBACK_ID_0); + switch (pMissile->type) { + case kMissileLifeLeechRegular: + evPost(nMissile, 3, 0, kCallbackFXFlameLick); break; - case 302: - evPost(nMissile, 3, 0, CALLBACK_ID_15); + case kMissileTeslaAlt: + evPost(nMissile, 3, 0, kCallbackFXTeslaAlt); break; - case 309: + case kMissilePukeGreen: seqSpawn(29, 3, nXSprite, -1); break; - case 300: + case kMissileButcherKnife: pMissile->cstat |= 16; break; - case 306: + case kMissileTeslaRegular: sfxPlay3DSound(pMissile, 251, 0, 0); break; - case 307: + case kMissileEctoSkull: seqSpawn(2, 3, nXSprite, -1); sfxPlay3DSound(pMissile, 493, 0, 0); break; - case 312: + case kMissileFireballNapam: seqSpawn(61, 3, nXSprite, nNapalmClient); sfxPlay3DSound(pMissile, 441, 0, 0); break; - case 305: + case kMissileFireball: seqSpawn(22, 3, nXSprite, nFireballClient); sfxPlay3DSound(pMissile, 441, 0, 0); break; - case 308: + case kMissileFlameHound: seqSpawn(27, 3, nXSprite, -1); xvel[nMissile] += xvel[nSprite] / 2 + Random2(0x11111); yvel[nMissile] += yvel[nSprite] / 2 + Random2(0x11111); zvel[nMissile] += zvel[nSprite] / 2 + Random2(0x11111); break; - case 313: + case kMissileFireballCerberus: seqSpawn(61, 3, nXSprite, dword_2192E0); sfxPlay3DSound(pMissile, 441, 0, 0); break; - case 314: + case kMissileFireballTchernobog: seqSpawn(23, 3, nXSprite, dword_2192D8); xvel[nMissile] += xvel[nSprite] / 2 + Random2(0x11111); yvel[nMissile] += yvel[nSprite] / 2 + Random2(0x11111); zvel[nMissile] += zvel[nSprite] / 2 + Random2(0x11111); break; - case 304: + case kMissileFlameSpray: if (Chance(0x8000)) seqSpawn(0, 3, nXSprite, -1); else @@ -6789,19 +6704,19 @@ void actBuildMissile(spritetype* pMissile, int nXSprite, int nSprite) { yvel[nMissile] += yvel[nSprite] + Random2(0x11111); zvel[nMissile] += zvel[nSprite] + Random2(0x11111); break; - case 303: - evPost(nMissile, 3, 30, CALLBACK_ID_2); - evPost(nMissile, 3, 0, CALLBACK_ID_3); + case kMissileFlareAlt: + evPost(nMissile, 3, 30, kCallbackFXFlareBurst); + evPost(nMissile, 3, 0, kCallbackFXFlareSpark); sfxPlay3DSound(pMissile, 422, 0, 0); break; - case 301: - evPost(nMissile, 3, 0, CALLBACK_ID_3); + case kMissileFlareRegular: + evPost(nMissile, 3, 0, kCallbackFXFlareSpark); sfxPlay3DSound(pMissile, 422, 0, 0); break; case 317: - evPost(nMissile, 3, 0, CALLBACK_ID_7); + evPost(nMissile, 3, 0, kCallbackFXArcSpark); break; - case 311: + case kMissileArcGargoyle: sfxPlay3DSound(pMissile, 252, 0, 0); break; } @@ -6870,7 +6785,7 @@ bool actCheckRespawn(spritetype *pSprite) if (pSprite->type >= kThingBase && pSprite->type < kThingMax) { pXSprite->respawnPending = 3; - if (pSprite->type == 400) + if (pSprite->type == kThingTNTBarrel) pSprite->cstat |= 32768; } if (nRespawnTime > 0) @@ -6887,7 +6802,7 @@ bool actCheckRespawn(spritetype *pSprite) pSprite->y = baseSprite[nSprite].y; pSprite->z = baseSprite[nSprite].z; } - evPost(nSprite, 3, nRespawnTime, CALLBACK_ID_9); + evPost(nSprite, 3, nRespawnTime, kCallbackRespawn); } return 1; } @@ -6903,12 +6818,12 @@ bool actCanSplatWall(int nWall) if (pWall->cstat & 32768) return 0; int nType = GetWallType(nWall); - if (nType >= 500 && nType < 512) + if (nType >= kWallBase && nType < kWallMax) return 0; if (pWall->nextsector != -1) { sectortype *pSector = §or[pWall->nextsector]; - if (pSector->type >= 600 && pSector->type < 620) + if (pSector->type >= kSectorBase && pSector->type < kSectorMax) return 0; } return 1; @@ -7001,7 +6916,7 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6, { XWALL *pXWall = &xwall[nXWall]; if (pXWall->triggerVector) - trTriggerWall(nWall, pXWall, 51); + trTriggerWall(nWall, pXWall, kCmdWallImpact); } break; } @@ -7023,7 +6938,7 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6, { XSPRITE *pXSprite = &xsprite[nXSprite]; if (pXSprite->Vector) - trTriggerSprite(nSprite, pXSprite, 31); + trTriggerSprite(nSprite, pXSprite, kCmdSpriteImpact); } if (pSprite->statnum == kStatThing) { @@ -7039,18 +6954,18 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6, { XSPRITE *pXSprite = &xsprite[nXSprite]; if (!pXSprite->burnTime) - evPost(nSprite, 3, 0, CALLBACK_ID_0); + evPost(nSprite, 3, 0, kCallbackFXFlameLick); actBurnSprite(actSpriteIdToOwnerId(nShooter), pXSprite, pVectorData->at11); } } if (pSprite->statnum == kStatDude) { - int t = pSprite->type == 426 ? 0 : dudeInfo[pSprite->type-kDudeBase].mass; + int t = pSprite->type == kThingBloodChunks ? 0 : dudeInfo[pSprite->type-kDudeBase].mass; if (IsDudeSprite(pSprite)) { switch (pSprite->type) { - case kCustomDude: - case kCustomDudeBurning: + case kDudeModernCustom: + case kDudeModernCustomBurning: t = getSpriteMassBySize(pSprite); break; } @@ -7067,7 +6982,7 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6, { XSPRITE *pXSprite = &xsprite[nXSprite]; if (!pXSprite->burnTime) - evPost(nSprite, 3, 0, CALLBACK_ID_0); + evPost(nSprite, 3, 0, kCallbackFXFlameLick); actBurnSprite(actSpriteIdToOwnerId(nShooter), pXSprite, pVectorData->at11); } if (Chance(pVectorData->atd)) @@ -7121,7 +7036,7 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6, zvel[nSprite] += mulscale16(a6, impulse); if (pVectorData->at11 != 0) { - if (!xsprite[nXSprite].burnTime) evPost(nSprite, 3, 0, CALLBACK_ID_0); + if (!xsprite[nXSprite].burnTime) evPost(nSprite, 3, 0, kCallbackFXFlameLick); actBurnSprite(actSpriteIdToOwnerId(nShooter), &xsprite[nXSprite], pVectorData->at11); } @@ -7209,7 +7124,7 @@ void TreeToGibCallback(int, int nXSprite) XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; spritetype *pSprite = &sprite[nSprite]; - pSprite->type = 417; + pSprite->type = kThingObjectExplode; pXSprite->state = 1; pXSprite->data1 = 15; pXSprite->data2 = 0; @@ -7224,7 +7139,7 @@ void DudeToGibCallback1(int, int nXSprite) XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; spritetype *pSprite = &sprite[nSprite]; - pSprite->type = 426; + pSprite->type = kThingBloodChunks; pXSprite->data1 = 8; pXSprite->data2 = 0; pXSprite->data3 = 0; @@ -7242,7 +7157,7 @@ void DudeToGibCallback2(int, int nXSprite) XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; spritetype *pSprite = &sprite[nSprite]; - pSprite->type = 426; + pSprite->type = kThingBloodChunks; pXSprite->data1 = 3; pXSprite->data2 = 0; pXSprite->data3 = 0; @@ -7305,23 +7220,22 @@ void MakeSplash(spritetype *pSprite, XSPRITE *pXSprite) UNREFERENCED_PARAMETER(pXSprite); pSprite->flags &= ~2; int nXSprite = pSprite->extra; - pSprite->z -= 4<<8; + pSprite->z -= 4 << 8; int nSurface = tileGetSurfType(gSpriteHit[nXSprite].florhit); - switch (pSprite->type) - { - case 423: - if (nSurface == kSurfWater) - { + switch (pSprite->type) { + case kThingDripWater: + switch (nSurface) { + case kSurfWater: seqSpawn(6, 3, nXSprite, -1); sfxPlay3DSound(pSprite, 356, -1, 0); - } - else - { + break; + default: seqSpawn(7, 3, nXSprite, -1); sfxPlay3DSound(pSprite, 354, -1, 0); + break; } break; - case 424: + case kThingDripBlood: seqSpawn(8, 3, nXSprite, -1); sfxPlay3DSound(pSprite, 354, -1, 0); break; @@ -7453,7 +7367,7 @@ spritetype* DropRandomPickupObject(spritetype* pSprite, short prevItem) { // randomize only in case if at least 2 data fields fits. for (int i = 0; i <= 3; i++) - if (rData[i] < kWeaponItemBase || rData[i] >= kItemMax) + if (rData[i] < kItemWeaponBase || rData[i] >= kItemMax) rData[i] = 0; int maxRetries = 9; @@ -7539,7 +7453,7 @@ spritetype* actSpawnCustomDude(spritetype* pSprite, int nDist) { spritetype* pSource = pSprite; XSPRITE* pXSource = &xsprite[pSource->extra]; spritetype* pDude = actSpawnSprite(pSprite,6); XSPRITE* pXDude = &xsprite[pDude->extra]; - int x, y, z = pSprite->z, nAngle = pSprite->ang, nType = kCustomDude; + int x, y, z = pSprite->z, nAngle = pSprite->ang, nType = kDudeModernCustom; if (nDist > 0) { x = pSprite->x + mulscale30r(Cos(nAngle), nDist); @@ -7575,7 +7489,7 @@ spritetype* actSpawnCustomDude(spritetype* pSprite, int nDist) { if (pSource->flags & kModernTypeFlag1) { switch (pSource->type) { - case kGDXCustomDudeSpawn: + case kModernCustomDudeSpawn: //inherit pal? if (pDude->pal <= 0) pDude->pal = pSource->pal; @@ -7609,10 +7523,10 @@ int getSpriteMassBySize(spritetype* pSprite) { if (IsDudeSprite(pSprite)) { switch (pSprite->type) { - case 225: // fake dude, no seq + case kDudePodMother: // fake dude, no seq break; - case kCustomDude: - case kCustomDudeBurning: + case kDudeModernCustom: + case kDudeModernCustomBurning: seqId = xsprite[pSprite->extra].data2; break; default: @@ -7828,14 +7742,14 @@ void debrisMove(int listIndex) { sfxPlay3DSoundCP(pSprite, 720, -1, 0, pitch, 75 - Random(40)); if (sector[pSprite->sectnum].extra < 0 || !xsector[sector[pSprite->sectnum].extra].Underwater) - evKill(pSprite->xvel, 3, CALLBACK_ID_11); + evKill(pSprite->xvel, 3, kCallbackEnemeyBubble); else { if (Chance(0x8000)) - evPost(pSprite->xvel, 3, 0, CALLBACK_ID_11); + evPost(pSprite->xvel, 3, 0, kCallbackEnemeyBubble); for (int i = 2; i <= 5; i++) { if (Chance(0x3000 * i)) - evPost(pSprite->xvel, 3, 0, CALLBACK_ID_11); + evPost(pSprite->xvel, 3, 0, kCallbackEnemeyBubble); } } break; @@ -7930,8 +7844,8 @@ void debrisMove(int listIndex) { //actPostSprite(nSprite, kStatThing); // !!!! not working here for some reason changespritestat(nSprite, kStatThing); - if (pXDebris->state == 1) trTriggerSprite(pSprite->xvel, pXDebris, COMMAND_ID_0); - else trTriggerSprite(pSprite->xvel, pXDebris, COMMAND_ID_1); + if (pXDebris->state == 1) trTriggerSprite(pSprite->xvel, pXDebris, kCmdOff); + else trTriggerSprite(pSprite->xvel, pXDebris, kCmdOn); } } diff --git a/source/blood/src/actor.h b/source/blood/src/actor.h index 94cf5c067..2a11dfbb3 100644 --- a/source/blood/src/actor.h +++ b/source/blood/src/actor.h @@ -82,7 +82,7 @@ struct THINGINFO unsigned char at15; // xrepeat unsigned char at16; // yrepeat 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 @@ -131,7 +131,7 @@ struct MissileType unsigned char atb; // yrepeat char atc; // shade 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 @@ -164,7 +164,7 @@ struct VECTORDATA { int at15; // blood splats int at19; // blood splat chance 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(); @@ -239,7 +239,7 @@ bool actHealDude(XSPRITE *pXDude, int a2, int a3); void actKillDude(int a1, 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 actImpactMissile(spritetype *pMissile, int a2); +void actImpactMissile(spritetype *pMissile, int hitCode); void actKickObject(spritetype *pSprite1, spritetype *pSprite2); void actTouchFloor(spritetype *pSprite, int nSector); void ProcessTouchObjects(spritetype *pSprite, int nXSprite); diff --git a/source/blood/src/ai.cpp b/source/blood/src/ai.cpp index 90902d489..a126b4c3a 100644 --- a/source/blood/src/ai.cpp +++ b/source/blood/src/ai.cpp @@ -116,8 +116,8 @@ void aiNewState(spritetype *pSprite, XSPRITE *pXSprite, AISTATE *pAIState) if (pAIState->at0 >= 0) { // By NoOne: Custom dude uses data2 to keep it's seqStartId switch (pSprite->type) { - case kCustomDude: - case kCustomDudeBurning: + case kDudeModernCustom: + case kDudeModernCustomBurning: seqStartId = pXSprite->data2; break; } @@ -167,14 +167,14 @@ bool CanMove(spritetype *pSprite, int a2, int nAngle, int nRange) Underwater = 1; if (pXSector->Depth) Depth = 1; - if (sector[nSector].type == kSecDamage || pXSector->damageType > 0) { + if (sector[nSector].type == kSectorDamage || pXSector->damageType > 0) { // By NoOne: a quick fix for Cerberus spinning in E3M7-like maps, where damage sectors is used. // It makes ignore danger if enemy immune to N damageType. As result Cerberus start acting like // in Blood 1.0 so it can move normally to player. It's up to you for adding rest of enemies here as // i don't think it will broke something in game. switch (pSprite->type) { - case 227: // Cerberus - case 228: // 1 Head Cerberus + case kDudeCerberusTwoHead: // Cerberus + case kDudeCerberusOneHead: // 1 Head Cerberus if (VanillaMode() || !dudeIsImmune(pSprite, pXSector->damageType)) Crusher = 1; break; @@ -196,11 +196,10 @@ bool CanMove(spritetype *pSprite, int a2, int nAngle, int nRange) if (sprite[nLower].type == kMarkerLowWater || sprite[nLower].type == kMarkerLowGoo) Depth = 1; } - switch (pSprite->type) - { - case 206: - case 207: - case 219: + switch (pSprite->type) { + case kDudeGargoyleFlesh: + case kDudeGargoyleStone: + case kDudeBat: if (pSprite->clipdist > nDist) return 0; if (Depth) @@ -212,7 +211,7 @@ bool CanMove(spritetype *pSprite, int a2, int nAngle, int nRange) return false; } break; - case 218: + case kDudeBoneEel: if (Water) return false; if (!Underwater) @@ -220,15 +219,15 @@ bool CanMove(spritetype *pSprite, int a2, int nAngle, int nRange) if (Underwater) return true; break; - case 204: - case 213: - case 214: - case 215: - case 216: - case 211: - case 220: - case 227: - case 245: + case kDudeZombieButcher: + case kDudeSpiderBrown: + case kDudeSpiderRed: + case kDudeSpiderBlack: + case kDudeSpiderMother: + case kDudeHellHound: + case kDudeRat: + case kDudeCerberusTwoHead: + case kDudeInnocent: if (Crusher) return false; if (Depth || Underwater) @@ -236,14 +235,14 @@ bool CanMove(spritetype *pSprite, int a2, int nAngle, int nRange) if (floorZ - bottom > 0x2000) return false; break; - case kCustomDude: - case kCustomDudeBurning: + case kDudeModernCustom: + case kDudeModernCustomBurning: if ((Crusher && !dudeIsImmune(pSprite, pXSector->damageType)) || ((Water || Underwater) && !canSwim(pSprite))) return false; return true; fallthrough__; - case 203: - case 210: - case 217: + case kDudeZombieAxeNormal: + case kDudePhantasm: + case kDudeGillBeast: default: if (Crusher) return false; @@ -349,14 +348,12 @@ void aiMoveDodge(spritetype *pSprite, XSPRITE *pXSprite) void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) { dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); - if (!pXSprite->state) - { + if (!pXSprite->state) { aiChooseDirection(pSprite, pXSprite, getangle(pXSprite->targetX-pSprite->x, pXSprite->targetY-pSprite->y)); pXSprite->state = 1; } - switch (pSprite->type) - { - case 210: + switch (pSprite->type) { + case kDudePhantasm: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; pDudeExtraE->at4 = 0; @@ -371,62 +368,49 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) } break; } - case 201: - case 202: - case 247: - case 248: - case 249: + case kDudeCultistTommy: + case kDudeCultistShotgun: + case kDudeCultistTesla: + case kDudeCultistTNT: + case kDudeCultistBeast: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; pDudeExtraE->at8 = 1; pDudeExtraE->at0 = 0; - if (pXSprite->target == -1) - { - switch (pXSprite->medium) - { - case 0: - aiNewState(pSprite, pXSprite, &cultistSearch); - if (Chance(0x8000)) - { - if (pSprite->type == 201) - aiPlay3DSound(pSprite, 4008+Random(5), AI_SFX_PRIORITY_1, -1); - else - aiPlay3DSound(pSprite, 1008+Random(5), AI_SFX_PRIORITY_1, -1); - } - break; - case 1: - case 2: - aiNewState(pSprite, pXSprite, &cultistSwimSearch); - break; + if (pXSprite->target == -1) { + switch (pXSprite->medium) { + case 0: + aiNewState(pSprite, pXSprite, &cultistSearch); + if (Chance(0x8000)) { + if (pSprite->type == kDudeCultistTommy) aiPlay3DSound(pSprite, 4008+Random(5), AI_SFX_PRIORITY_1, -1); + else aiPlay3DSound(pSprite, 1008+Random(5), AI_SFX_PRIORITY_1, -1); + } + break; + case 1: + case 2: + aiNewState(pSprite, pXSprite, &cultistSwimSearch); + break; } - } - else - { - if (Chance(0x8000)) - { - if (pSprite->type == 201) - aiPlay3DSound(pSprite, 4003+Random(4), AI_SFX_PRIORITY_1, -1); - else - aiPlay3DSound(pSprite, 1003+Random(4), AI_SFX_PRIORITY_1, -1); + } else { + if (Chance(0x8000)) { + if (pSprite->type == kDudeCultistTommy) aiPlay3DSound(pSprite, 4003+Random(4), AI_SFX_PRIORITY_1, -1); + else aiPlay3DSound(pSprite, 1003+Random(4), AI_SFX_PRIORITY_1, -1); } - switch (pXSprite->medium) - { - case 0: - if (pSprite->type == 201) - aiNewState(pSprite, pXSprite, &fanaticChase); - else - aiNewState(pSprite, pXSprite, &cultistChase); - break; - case 1: - case 2: - aiNewState(pSprite, pXSprite, &cultistSwimChase); - break; + switch (pXSprite->medium) { + case 0: + if (pSprite->type == kDudeCultistTommy) aiNewState(pSprite, pXSprite, &fanaticChase); + else aiNewState(pSprite, pXSprite, &cultistChase); + break; + case 1: + case 2: + aiNewState(pSprite, pXSprite, &cultistSwimChase); + break; } } break; } - case kCustomDude: + case kDudeModernCustom: { DUDEEXTRA_at6_u1* pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; pDudeExtraE->at8 = 1; @@ -452,56 +436,50 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) } break; } - case kCustomDudeBurning: + case kDudeModernCustomBurning: if (pXSprite->target == -1) aiNewState(pSprite, pXSprite, &GDXGenDudeBurnSearch); else aiNewState(pSprite, pXSprite, &GDXGenDudeBurnChase); break; - case 230: - { + case kDudeCultistTommyProne: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; - pDudeExtraE->at8 = 1; - pDudeExtraE->at0 = 0; - pSprite->type = 201; - if (pXSprite->target == -1) - { - switch (pXSprite->medium) - { - case 0: - aiNewState(pSprite, pXSprite, &cultistSearch); - if (Chance(0x8000)) - aiPlay3DSound(pSprite, 4008+Random(5), AI_SFX_PRIORITY_1, -1); - break; - case 1: - case 2: - aiNewState(pSprite, pXSprite, &cultistSwimSearch); - break; + pDudeExtraE->at8 = 1; pDudeExtraE->at0 = 0; + pSprite->type = kDudeCultistTommy; + if (pXSprite->target == -1) { + switch (pXSprite->medium) { + case 0: + aiNewState(pSprite, pXSprite, &cultistSearch); + if (Chance(0x8000)) + aiPlay3DSound(pSprite, 4008+Random(5), AI_SFX_PRIORITY_1, -1); + break; + case 1: + case 2: + aiNewState(pSprite, pXSprite, &cultistSwimSearch); + break; } - } - else - { + } else { if (Chance(0x8000)) aiPlay3DSound(pSprite, 4008+Random(5), AI_SFX_PRIORITY_1, -1); - switch (pXSprite->medium) - { - case 0: - aiNewState(pSprite, pXSprite, &cultistProneChase); - break; - case 1: - case 2: - aiNewState(pSprite, pXSprite, &cultistSwimChase); - break; + + switch (pXSprite->medium) { + case 0: + aiNewState(pSprite, pXSprite, &cultistProneChase); + break; + case 1: + case 2: + aiNewState(pSprite, pXSprite, &cultistSwimChase); + break; } } break; } - case 246: + case kDudeCultistShotgunProne: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; pDudeExtraE->at8 = 1; pDudeExtraE->at0 = 0; - pSprite->type = 202; + pSprite->type = kDudeCultistShotgun; if (pXSprite->target == -1) { switch (pXSprite->medium) @@ -534,13 +512,13 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) } break; } - case 240: + case kDudeBurningCultist: if (pXSprite->target == -1) aiNewState(pSprite, pXSprite, &cultistBurnSearch); else aiNewState(pSprite, pXSprite, &cultistBurnChase); break; - case 219: + case kDudeBat: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; pDudeExtraE->at4 = 0; @@ -558,7 +536,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) } break; } - case 218: + case kDudeBoneEel: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; pDudeExtraE->at4 = 0; @@ -576,8 +554,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) } break; } - case 217: - { + case kDudeGillBeast: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; XSECTOR *pXSector = NULL; if (sector[pSprite->sectnum].extra > 0) @@ -605,8 +582,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) } break; } - case 203: - { + case kDudeZombieAxeNormal: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2; pDudeExtraE->at4 = 1; pDudeExtraE->at0 = 0; @@ -635,7 +611,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) } break; } - case 205: + case kDudeZombieAxeBuried: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2; pDudeExtraE->at4 = 1; @@ -644,7 +620,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &zombieEUp); break; } - case 244: + case kDudeZombieAxeLaying: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2; pDudeExtraE->at4 = 1; @@ -653,8 +629,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &zombie13AC2C); break; } - case 204: - { + case kDudeZombieButcher: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2; pDudeExtraE->at4 = 1; pDudeExtraE->at0 = 0; @@ -670,20 +645,19 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) } break; } - case 241: + case kDudeBurningZombieAxe: if (pXSprite->target == -1) aiNewState(pSprite, pXSprite, &zombieABurnSearch); else aiNewState(pSprite, pXSprite, &zombieABurnChase); break; - case 242: + case kDudeBurningZombieButcher: if (pXSprite->target == -1) aiNewState(pSprite, pXSprite, &zombieFBurnSearch); else aiNewState(pSprite, pXSprite, &zombieFBurnChase); break; - case 206: - { + case kDudeGargoyleFlesh: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; pDudeExtraE->at4 = 0; pDudeExtraE->at8 = 1; @@ -700,7 +674,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) } break; } - case 207: + case kDudeGargoyleStone: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; pDudeExtraE->at4 = 0; @@ -718,23 +692,21 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) } break; } - case 208: - case 209: + case kDudeGargoyleStatueFlesh: + case kDudeGargoyleStatueStone: // By NoOne: play gargoyle statue breaking animation if data1 = 1. - if (pXSprite->data1 == 1) { - if (pSprite->type == 208) - aiNewState(pSprite, pXSprite, &statueFBreakSEQ); - else - aiNewState(pSprite, pXSprite, &statueSBreakSEQ); + if (gModernMap && pXSprite->data1 == 1) { + if (pSprite->type == kDudeGargoyleStatueFlesh) aiNewState(pSprite, pXSprite, &statueFBreakSEQ); + else aiNewState(pSprite, pXSprite, &statueSBreakSEQ); } else { if (Chance(0x4000)) aiPlay3DSound(pSprite, 1401, AI_SFX_PRIORITY_1, -1); else aiPlay3DSound(pSprite, 1400, AI_SFX_PRIORITY_1, -1); - if (pSprite->type == 208) aiNewState(pSprite, pXSprite, &gargoyleFMorph); + if (pSprite->type == kDudeGargoyleStatueFlesh) aiNewState(pSprite, pXSprite, &gargoyleFMorph); else aiNewState(pSprite, pXSprite, &gargoyleSMorph); } break; - case 227: + case kDudeCerberusTwoHead: if (pXSprite->target == -1) aiNewState(pSprite, pXSprite, &cerberusSearch); else @@ -743,7 +715,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &cerberusChase); } break; - case 228: + case kDudeCerberusOneHead: if (pXSprite->target == -1) aiNewState(pSprite, pXSprite, &cerberus2Search); else @@ -752,7 +724,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &cerberus2Chase); } break; - case 211: + case kDudeHellHound: if (pXSprite->target == -1) aiNewState(pSprite, pXSprite, &houndSearch); else @@ -761,7 +733,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &houndChase); } break; - case 212: + case kDudeHand: if (pXSprite->target == -1) aiNewState(pSprite, pXSprite, &handSearch); else @@ -770,7 +742,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &handChase); } break; - case 220: + case kDudeRat: if (pXSprite->target == -1) aiNewState(pSprite, pXSprite, &ratSearch); else @@ -779,7 +751,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &ratChase); } break; - case 245: + case kDudeInnocent: if (pXSprite->target == -1) aiNewState(pSprite, pXSprite, &innocentSearch); else @@ -789,7 +761,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &innocentChase); } break; - case 229: + case kDudeTchernobog: if (pXSprite->target == -1) aiNewState(pSprite, pXSprite, &tchernobogSearch); else @@ -798,9 +770,9 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &tchernobogChase); } break; - case 213: - case 214: - case 215: + case kDudeSpiderBrown: + case kDudeSpiderRed: + case kDudeSpiderBlack: pSprite->flags |= 2; pSprite->cstat &= ~8; if (pXSprite->target == -1) @@ -811,14 +783,13 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &spidChase); } break; - case 216: - { + case kDudeSpiderMother: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; pDudeExtraE->at8 = 1; pDudeExtraE->at0 = 0; pSprite->flags |= 2; pSprite->cstat &= ~8; - if (pXSprite->target == -1) + if (pXSprite->target == -1) aiNewState(pSprite, pXSprite, &spidSearch); else { @@ -827,7 +798,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) } break; } - case 250: + case kDudeTinyCaleb: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2; pDudeExtraE->at4 = 1; @@ -860,7 +831,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) } break; } - case 251: + case kDudeBeast: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2; pDudeExtraE->at4 = 1; @@ -894,21 +865,21 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) } break; } - case 221: - case 223: + case kDudePodGreen: + case kDudePodFire: if (pXSprite->target == -1) aiNewState(pSprite, pXSprite, &podSearch); else { - if (pSprite->type == 223) + if (pSprite->type == kDudePodFire) aiPlay3DSound(pSprite, 2453, AI_SFX_PRIORITY_1, -1); else aiPlay3DSound(pSprite, 2473, AI_SFX_PRIORITY_1, -1); aiNewState(pSprite, pXSprite, &podChase); } break; - case 222: - case 224: + case kDudeTentacleGreen: + case kDudeTentacleFire: if (pXSprite->target == -1) aiNewState(pSprite, pXSprite, &tentacleSearch); else @@ -972,10 +943,10 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T } switch (pSprite->type) { - case 201: - case 202: - case 247: - case 248: + case kDudeCultistTommy: + case kDudeCultistShotgun: + case kDudeCultistTesla: + case kDudeCultistTNT: if (nDmgType != DAMAGE_TYPE_1) { if (!sub_5BDA8(pSprite, 14) && !pXSprite->medium) @@ -987,27 +958,27 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T } else if (nDmgType == DAMAGE_TYPE_1 && pXSprite->health <= (unsigned int)pDudeInfo->fleeHealth/* && (pXSprite->at17_6 != 1 || pXSprite->at17_6 != 2)*/) { - pSprite->type = 240; + pSprite->type = kDudeBurningCultist; aiNewState(pSprite, pXSprite, &cultistBurnGoto); aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); aiPlay3DSound(pSprite, 1031+Random(2), AI_SFX_PRIORITY_2, -1); gDudeExtra[pSprite->extra].at0 = (int)gFrameClock+360; actHealDude(pXSprite, dudeInfo[40].startHealth, dudeInfo[40].startHealth); - evKill(nSprite, 3, CALLBACK_ID_0); + evKill(nSprite, 3, kCallbackFXFlameLick); } break; - case 245: // innocent + case kDudeInnocent: // innocent if (nDmgType == DAMAGE_TYPE_1 && pXSprite->health <= (unsigned int)pDudeInfo->fleeHealth/* && (pXSprite->at17_6 != 1 || pXSprite->at17_6 != 2)*/) { - pSprite->type = 239; + pSprite->type = kDudeBurningInnocent; aiNewState(pSprite, pXSprite, &cultistBurnGoto); aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); gDudeExtra[pSprite->extra].at0 = (int)gFrameClock+360; actHealDude(pXSprite, dudeInfo[39].startHealth, dudeInfo[39].startHealth); - evKill(nSprite, 3, CALLBACK_ID_0); + evKill(nSprite, 3, kCallbackFXFlameLick); } break; - case 240: + case kDudeBurningCultist: if (Chance(0x4000) && gDudeExtra[pSprite->extra].at0 < gFrameClock) { aiPlay3DSound(pSprite, 1031+Random(2), AI_SFX_PRIORITY_2, -1); @@ -1015,66 +986,65 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T } if (Chance(0x600) && (pXSprite->medium == 1 || pXSprite->medium == 2)) { - pSprite->type = 201; + pSprite->type = kDudeCultistTommy; pXSprite->burnTime = 0; aiNewState(pSprite, pXSprite, &cultistSwimGoto); } else if (pXSprite->medium == 1 || pXSprite->medium == 2) { - pSprite->type = 202; + pSprite->type = kDudeCultistShotgun; pXSprite->burnTime = 0; aiNewState(pSprite, pXSprite, &cultistSwimGoto); } break; - case 206: + case kDudeGargoyleFlesh: aiNewState(pSprite, pXSprite, &gargoyleFChase); break; - case 204: - if (nDmgType == DAMAGE_TYPE_1 && pXSprite->health <= (unsigned int)pDudeInfo->fleeHealth) - { + case kDudeZombieButcher: + if (nDmgType == DAMAGE_TYPE_1 && pXSprite->health <= (unsigned int)pDudeInfo->fleeHealth) { aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); aiPlay3DSound(pSprite, 1202, AI_SFX_PRIORITY_2, -1); - pSprite->type = 242; + pSprite->type = kDudeBurningZombieButcher; aiNewState(pSprite, pXSprite, &zombieFBurnGoto); actHealDude(pXSprite, dudeInfo[42].startHealth, dudeInfo[42].startHealth); - evKill(nSprite, 3, CALLBACK_ID_0); + evKill(nSprite, 3, kCallbackFXFlameLick); } break; - case 250: // tiny Caleb + case kDudeTinyCaleb: // tiny Caleb if (nDmgType == DAMAGE_TYPE_1 && pXSprite->health <= (unsigned int)pDudeInfo->fleeHealth/* && (pXSprite->at17_6 != 1 || pXSprite->at17_6 != 2)*/) { - pSprite->type = 239; + pSprite->type = kDudeBurningInnocent; if (!VanillaMode()) pXSprite->scale = 64; aiNewState(pSprite, pXSprite, &cultistBurnGoto); aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); gDudeExtra[pSprite->extra].at0 = (int)gFrameClock+360; actHealDude(pXSprite, dudeInfo[39].startHealth, dudeInfo[39].startHealth); - evKill(nSprite, 3, CALLBACK_ID_0); + evKill(nSprite, 3, kCallbackFXFlameLick); } break; - case kCustomDudeBurning: + case kDudeModernCustomBurning: if (Chance(0x2000) && gDudeExtra[pSprite->extra].at0 < (int)gFrameClock) { sfxPlayGDXGenDudeSound(pSprite, 3); gDudeExtra[pSprite->extra].at0 = (int)gFrameClock + 360; } if (pXSprite->burnTime == 0) pXSprite->burnTime = 2400; if (spriteIsUnderwater(pSprite, false)) { - pSprite->type = kCustomDude; + pSprite->type = kDudeModernCustom; pXSprite->burnTime = 0; pXSprite->health = 1; // so it can be killed with flame weapons while underwater and if already was burning dude before. aiNewState(pSprite, pXSprite, &GDXGenDudeGotoW); } break; - case kCustomDude: + case kDudeModernCustom: { if (nDmgType == DAMAGE_TYPE_1) { if (pXSprite->health <= pDudeInfo->fleeHealth) { if (pXSprite->txID <= 0 || getNextIncarnation(pXSprite) == NULL) { removeDudeStuff(pSprite); - if (pXSprite->data1 >= 459 && pXSprite->data1 < (459 + kExplodeMax) - 1) - doExplosion(pSprite, pXSprite->data1 - 459); + if (pXSprite->data1 >= kTrapExploder && pXSprite->data1 < (kTrapExploder + kExplodeMax) - 1) + doExplosion(pSprite, pXSprite->data1 - kTrapExploder); if (spriteIsUnderwater(pSprite, false)) { pXSprite->health = 0; @@ -1089,7 +1059,7 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); sfxPlayGDXGenDudeSound(pSprite, 3); - pSprite->type = kCustomDudeBurning; + pSprite->type = kDudeModernCustomBurning; if (pXSprite->data2 == kDefaultAnimationBase) // don't inherit palette for burning if using default animation pSprite->pal = 0; @@ -1097,7 +1067,7 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T aiNewState(pSprite, pXSprite, &GDXGenDudeBurnGoto); actHealDude(pXSprite, dudeInfo[55].startHealth, dudeInfo[55].startHealth); gDudeExtra[pSprite->extra].at0 = (int)gFrameClock + 360; - evKill(nSprite, 3, CALLBACK_ID_0); + evKill(nSprite, 3, kCallbackFXFlameLick); } @@ -1122,25 +1092,25 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T break; } - case 249: + case kDudeCultistBeast: if (pXSprite->health <= (unsigned int)pDudeInfo->fleeHealth) { - pSprite->type = 251; + pSprite->type = kDudeBeast; aiPlay3DSound(pSprite, 9008, AI_SFX_PRIORITY_1, -1); aiNewState(pSprite, pXSprite, &beastMorphFromCultist); actHealDude(pXSprite, dudeInfo[51].startHealth, dudeInfo[51].startHealth); } break; - case 203: - case 205: + case kDudeZombieAxeNormal: + case kDudeZombieAxeBuried: if (nDmgType == DAMAGE_TYPE_1 && pXSprite->health <= (unsigned int)pDudeInfo->fleeHealth) { aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); aiPlay3DSound(pSprite, 1106, AI_SFX_PRIORITY_2, -1); - pSprite->type = 241; + pSprite->type = kDudeBurningZombieAxe; aiNewState(pSprite, pXSprite, &zombieABurnGoto); actHealDude(pXSprite, dudeInfo[41].startHealth, dudeInfo[41].startHealth); - evKill(nSprite, 3, CALLBACK_ID_0); + evKill(nSprite, 3, kCallbackFXFlameLick); } break; } @@ -1157,7 +1127,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase]; switch (pSprite->type) { - case kCustomDude: + case kDudeModernCustom: { int mass = getSpriteMassBySize(pSprite); int chance4 = getRecoilChance(pSprite); bool chance3 = Chance(chance4); if (pDudeExtra->at4 && (inIdle(pXSprite->aiState) || mass < 155 || (mass >= 155 && chance3)) && !spriteIsUnderwater(pSprite, false)) @@ -1191,30 +1161,22 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) break; } - case 201: - case 202: - case 247: - case 248: - case 249: - if (pSprite->type == 201) - aiPlay3DSound(pSprite, 4013+Random(2), AI_SFX_PRIORITY_2, -1); - else - aiPlay3DSound(pSprite, 1013+Random(2), AI_SFX_PRIORITY_2, -1); - if (!v4 && pXSprite->medium == 0) - { - if (pDudeExtra->at4) - aiNewState(pSprite, pXSprite, &cultistTeslaRecoil); - else - aiNewState(pSprite, pXSprite, &cultistRecoil); - } - else if (v4 && pXSprite->medium == 0) - { - if (pDudeExtra->at4) - aiNewState(pSprite, pXSprite, &cultistTeslaRecoil); - else if (gGameOptions.nDifficulty > 0) - aiNewState(pSprite, pXSprite, &cultistProneRecoil); - else - aiNewState(pSprite, pXSprite, &cultistRecoil); + case kDudeCultistTommy: + case kDudeCultistShotgun: + case kDudeCultistTesla: + case kDudeCultistTNT: + case kDudeCultistBeast: + if (pSprite->type == kDudeCultistTommy) aiPlay3DSound(pSprite, 4013+Random(2), AI_SFX_PRIORITY_2, -1); + else aiPlay3DSound(pSprite, 1013+Random(2), AI_SFX_PRIORITY_2, -1); + + if (!v4 && pXSprite->medium == 0) { + if (pDudeExtra->at4) aiNewState(pSprite, pXSprite, &cultistTeslaRecoil); + else aiNewState(pSprite, pXSprite, &cultistRecoil); + + } else if (v4 && pXSprite->medium == 0) { + if (pDudeExtra->at4) aiNewState(pSprite, pXSprite, &cultistTeslaRecoil); + else if (gGameOptions.nDifficulty > 0) aiNewState(pSprite, pXSprite, &cultistProneRecoil); + else aiNewState(pSprite, pXSprite, &cultistRecoil); } else if (pXSprite->medium == 1 || pXSprite->medium == 2) aiNewState(pSprite, pXSprite, &cultistSwimRecoil); @@ -1226,21 +1188,21 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &cultistRecoil); } break; - case 240: + case kDudeBurningCultist: aiNewState(pSprite, pXSprite, &cultistBurnGoto); break; - case kCustomDudeBurning: + case kDudeModernCustomBurning: aiNewState(pSprite, pXSprite, &GDXGenDudeBurnGoto); break; - case 204: + case kDudeZombieButcher: aiPlay3DSound(pSprite, 1202, AI_SFX_PRIORITY_2, -1); if (pDudeExtra->at4) aiNewState(pSprite, pXSprite, &zombieFTeslaRecoil); else aiNewState(pSprite, pXSprite, &zombieFRecoil); break; - case 203: - case 205: + case kDudeZombieAxeNormal: + case kDudeZombieAxeBuried: aiPlay3DSound(pSprite, 1106, AI_SFX_PRIORITY_2, -1); if (pDudeExtra->at4 && pXSprite->data3 > pDudeInfo->startHealth/3) aiNewState(pSprite, pXSprite, &zombieATeslaRecoil); @@ -1249,59 +1211,58 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) else aiNewState(pSprite, pXSprite, &zombieARecoil); break; - case 241: + case kDudeBurningZombieAxe: aiPlay3DSound(pSprite, 1106, AI_SFX_PRIORITY_2, -1); aiNewState(pSprite, pXSprite, &zombieABurnGoto); break; - case 242: + case kDudeBurningZombieButcher: aiPlay3DSound(pSprite, 1202, AI_SFX_PRIORITY_2, -1); aiNewState(pSprite, pXSprite, &zombieFBurnGoto); break; - case 206: - case 207: + case kDudeGargoyleFlesh: + case kDudeGargoyleStone: aiPlay3DSound(pSprite, 1402, AI_SFX_PRIORITY_2, -1); aiNewState(pSprite, pXSprite, &gargoyleFRecoil); break; - case 227: + case kDudeCerberusTwoHead: aiPlay3DSound(pSprite, 2302+Random(2), AI_SFX_PRIORITY_2, -1); if (pDudeExtra->at4 && pXSprite->data3 > pDudeInfo->startHealth/3) aiNewState(pSprite, pXSprite, &cerberusTeslaRecoil); else aiNewState(pSprite, pXSprite, &cerberusRecoil); break; - case 228: + case kDudeCerberusOneHead: aiPlay3DSound(pSprite, 2302+Random(2), AI_SFX_PRIORITY_2, -1); aiNewState(pSprite, pXSprite, &cerberus2Recoil); break; - case 211: + case kDudeHellHound: aiPlay3DSound(pSprite, 1302, AI_SFX_PRIORITY_2, -1); if (pDudeExtra->at4) aiNewState(pSprite, pXSprite, &houndTeslaRecoil); else aiNewState(pSprite, pXSprite, &houndRecoil); break; - case 229: + case kDudeTchernobog: aiPlay3DSound(pSprite, 2370+Random(2), AI_SFX_PRIORITY_2, -1); aiNewState(pSprite, pXSprite, &tchernobogRecoil); break; - case 212: + case kDudeHand: aiPlay3DSound(pSprite, 1902, AI_SFX_PRIORITY_2, -1); aiNewState(pSprite, pXSprite, &handRecoil); break; - case 220: + case kDudeRat: aiPlay3DSound(pSprite, 2102, AI_SFX_PRIORITY_2, -1); aiNewState(pSprite, pXSprite, &ratRecoil); break; - case 219: + case kDudeBat: aiPlay3DSound(pSprite, 2002, AI_SFX_PRIORITY_2, -1); aiNewState(pSprite, pXSprite, &batRecoil); break; - case 218: + case kDudeBoneEel: aiPlay3DSound(pSprite, 1502, AI_SFX_PRIORITY_2, -1); aiNewState(pSprite, pXSprite, &eelRecoil); break; - case 217: - { + case kDudeGillBeast: { XSECTOR *pXSector = NULL; if (sector[pSprite->sectnum].extra > 0) pXSector = &xsector[sector[pSprite->sectnum].extra]; @@ -1312,31 +1273,31 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &gillBeastRecoil); break; } - case 210: + case kDudePhantasm: aiPlay3DSound(pSprite, 1602, AI_SFX_PRIORITY_2, -1); if (pDudeExtra->at4) aiNewState(pSprite, pXSprite, &ghostTeslaRecoil); else aiNewState(pSprite, pXSprite, &ghostRecoil); break; - case 213: - case 214: - case 215: + case kDudeSpiderBrown: + case kDudeSpiderRed: + case kDudeSpiderBlack: aiPlay3DSound(pSprite, 1802+Random(1), AI_SFX_PRIORITY_2, -1); aiNewState(pSprite, pXSprite, &spidDodge); break; - case 216: + case kDudeSpiderMother: aiPlay3DSound(pSprite, 1851+Random(1), AI_SFX_PRIORITY_2, -1); aiNewState(pSprite, pXSprite, &spidDodge); break; - case 245: + case kDudeInnocent: aiPlay3DSound(pSprite, 7007+Random(2), AI_SFX_PRIORITY_2, -1); if (pDudeExtra->at4) aiNewState(pSprite, pXSprite, &innocentTeslaRecoil); else aiNewState(pSprite, pXSprite, &innocentRecoil); break; - case 250: + case kDudeTinyCaleb: if (pXSprite->medium == 0) { if (pDudeExtra->at4) @@ -1354,7 +1315,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &tinycalebRecoil); } break; - case 251: + case kDudeBeast: aiPlay3DSound(pSprite, 9004+Random(2), AI_SFX_PRIORITY_2, -1); if (pXSprite->medium == 0) { @@ -1373,12 +1334,12 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &beastRecoil); } break; - case 221: - case 223: + case kDudePodGreen: + case kDudePodFire: aiNewState(pSprite, pXSprite, &podRecoil); break; - case 222: - case 224: + case kDudeTentacleGreen: + case kDudeTentacleFire: aiNewState(pSprite, pXSprite, &tentacleRecoil); break; default: @@ -1476,7 +1437,7 @@ void sub_5F15C(spritetype *pSprite, XSPRITE *pXSprite) int dx = pSprite2->x-pSprite->x; int dy = pSprite2->y-pSprite->y; int nDist = approxDist(dx, dy); - if (pSprite2->type == 245) + if (pSprite2->type == kDudeInnocent) { DUDEINFO *pDudeInfo = &dudeInfo[pSprite2->type-kDudeBase]; if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist) @@ -1500,11 +1461,8 @@ void aiProcessDudes(void) continue; int nXSprite = pSprite->extra; XSPRITE *pXSprite = &xsprite[nXSprite]; - DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase]; - if (pSprite->type >= kDudePlayer1 && pSprite->type <= kDudePlayer8) - continue; - if (pXSprite->health == 0) - continue; + DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; + if (IsPlayerSprite(pSprite) || pXSprite->health == 0) continue; pXSprite->stateTimer = ClipLow(pXSprite->stateTimer-4, 0); if (pXSprite->aiState->at10) pXSprite->aiState->at10(pSprite, pXSprite); @@ -1546,9 +1504,8 @@ void aiInitSprite(spritetype *pSprite) DUDEEXTRA *pDudeExtra = &gDudeExtra[pSprite->extra]; pDudeExtra->at4 = 0; pDudeExtra->at0 = 0; - switch (pSprite->type) - { - case kCustomDude: + switch (pSprite->type) { + case kDudeModernCustom: { DUDEEXTRA_at6_u1* pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; pDudeExtraE->at8 = 0; @@ -1557,15 +1514,15 @@ void aiInitSprite(spritetype *pSprite) aiNewState(pSprite, pXSprite, &GDXGenDudeIdleL); break; } - case kCustomDudeBurning: + case kDudeModernCustomBurning: aiNewState(pSprite, pXSprite, &GDXGenDudeBurnGoto); pXSprite->burnTime = 1200; break; - case 201: - case 202: - case 247: - case 248: - case 249: + case kDudeCultistTommy: + case kDudeCultistShotgun: + case kDudeCultistTesla: + case kDudeCultistTNT: + case kDudeCultistBeast: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; pDudeExtraE->at8 = 0; @@ -1573,7 +1530,7 @@ void aiInitSprite(spritetype *pSprite) aiNewState(pSprite, pXSprite, &cultistIdle); break; } - case 230: + case kDudeCultistTommyProne: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; pDudeExtraE->at8 = 0; @@ -1581,7 +1538,7 @@ void aiInitSprite(spritetype *pSprite) aiNewState(pSprite, pXSprite, &fanaticProneIdle); break; } - case 246: + case kDudeCultistShotgunProne: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; pDudeExtraE->at8 = 0; @@ -1589,23 +1546,21 @@ void aiInitSprite(spritetype *pSprite) aiNewState(pSprite, pXSprite, &cultistProneIdle); break; } - case 204: - { + case kDudeZombieButcher: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2; pDudeExtraE->at4 = 0; pDudeExtraE->at0 = 0; aiNewState(pSprite, pXSprite, &zombieFIdle); break; } - case 203: - { + case kDudeZombieAxeNormal: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2; pDudeExtraE->at4 = 0; pDudeExtraE->at0 = 0; aiNewState(pSprite, pXSprite, &zombieAIdle); break; } - case 244: + case kDudeZombieAxeLaying: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2; pDudeExtraE->at4 = 0; @@ -1614,17 +1569,15 @@ void aiInitSprite(spritetype *pSprite) pSprite->flags &= ~1; break; } - case 205: - { + case kDudeZombieAxeBuried: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2; pDudeExtraE->at4 = 0; pDudeExtraE->at0 = 0; aiNewState(pSprite, pXSprite, &zombieEIdle); break; } - case 206: - case 207: - { + case kDudeGargoyleFlesh: + case kDudeGargoyleStone: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; pDudeExtraE->at4 = 0; pDudeExtraE->at8 = 0; @@ -1632,25 +1585,24 @@ void aiInitSprite(spritetype *pSprite) aiNewState(pSprite, pXSprite, &gargoyleFIdle); break; } - case 208: - case 209: + case kDudeGargoyleStatueFlesh: + case kDudeGargoyleStatueStone: aiNewState(pSprite, pXSprite, &gargoyleStatueIdle); break; - case 227: - { + case kDudeCerberusTwoHead: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2; pDudeExtraE->at4 = 0; pDudeExtraE->at0 = 0; aiNewState(pSprite, pXSprite, &cerberusIdle); break; } - case 211: + case kDudeHellHound: aiNewState(pSprite, pXSprite, &houndIdle); break; - case 212: + case kDudeHand: aiNewState(pSprite, pXSprite, &handIdle); break; - case 210: + case kDudePhantasm: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; pDudeExtraE->at4 = 0; @@ -1659,13 +1611,13 @@ void aiInitSprite(spritetype *pSprite) aiNewState(pSprite, pXSprite, &ghostIdle); break; } - case 245: + case kDudeInnocent: aiNewState(pSprite, pXSprite, &innocentIdle); break; - case 220: + case kDudeRat: aiNewState(pSprite, pXSprite, &ratIdle); break; - case 218: + case kDudeBoneEel: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; pDudeExtraE->at4 = 0; @@ -1674,13 +1626,13 @@ void aiInitSprite(spritetype *pSprite) aiNewState(pSprite, pXSprite, &eelIdle); break; } - case 217: + case kDudeGillBeast: if (pXSector && pXSector->Underwater) aiNewState(pSprite, pXSprite, &gillBeastIdle); else aiNewState(pSprite, pXSprite, &gillBeastIdle); break; - case 219: + case kDudeBat: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; pDudeExtraE->at4 = 0; @@ -1689,9 +1641,9 @@ void aiInitSprite(spritetype *pSprite) aiNewState(pSprite, pXSprite, &batIdle); break; } - case 213: - case 214: - case 215: + case kDudeSpiderBrown: + case kDudeSpiderRed: + case kDudeSpiderBlack: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; pDudeExtraE->at8 = 0; @@ -1700,7 +1652,7 @@ void aiInitSprite(spritetype *pSprite) aiNewState(pSprite, pXSprite, &spidIdle); break; } - case 216: + case kDudeSpiderMother: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; pDudeExtraE->at8 = 0; @@ -1709,7 +1661,7 @@ void aiInitSprite(spritetype *pSprite) aiNewState(pSprite, pXSprite, &spidIdle); break; } - case 229: + case kDudeTchernobog: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2; pDudeExtraE->at4 = 0; @@ -1717,18 +1669,18 @@ void aiInitSprite(spritetype *pSprite) aiNewState(pSprite, pXSprite, &tchernobogIdle); break; } - case 250: + case kDudeTinyCaleb: aiNewState(pSprite, pXSprite, &tinycalebIdle); break; - case 251: + case kDudeBeast: aiNewState(pSprite, pXSprite, &beastIdle); break; - case 221: - case 223: + case kDudePodGreen: + case kDudePodFire: aiNewState(pSprite, pXSprite, &podIdle); break; - case 222: - case 224: + case kDudeTentacleGreen: + case kDudeTentacleFire: aiNewState(pSprite, pXSprite, &tentacleIdle); break; default: @@ -1739,40 +1691,37 @@ void aiInitSprite(spritetype *pSprite) pXSprite->stateTimer = 0; switch (pSprite->type) { - case 213: - case 214: - case 215: - if (pSprite->cstat&8) - pSprite->flags |= 9; - else - pSprite->flags = 15; + case kDudeSpiderBrown: + case kDudeSpiderRed: + case kDudeSpiderBlack: + if (pSprite->cstat&8) pSprite->flags |= 9; + else pSprite->flags = 15; break; - case 206: - case 207: - case 210: - case 218: - case 219: + case kDudeGargoyleFlesh: + case kDudeGargoyleStone: + case kDudePhantasm: + case kDudeBoneEel: + case kDudeBat: pSprite->flags |= 9; break; - case 217: - if (pXSector && pXSector->Underwater) - pSprite->flags |= 9; - else - pSprite->flags = 15; + case kDudeGillBeast: + if (pXSector && pXSector->Underwater) pSprite->flags |= 9; + else pSprite->flags = 15; break; - case 205: - case 244: + case kDudeZombieAxeBuried: + case kDudeZombieAxeLaying: pSprite->flags = 7; break; - case 225: // by NoOne: FakeDude type - break; + case kDudePodMother: // by NoOne: FakeDude type + if (gModernMap) break; + fallthrough__; // By NoOne: Allow put pods and tentacles on ceilings if sprite is y-flipped. - case 221: - case 222: - case 223: - case 224: - case 226: - if ((pSprite->cstat & CSTAT_SPRITE_YFLIP) != 0) { + case kDudePodGreen: + case kDudeTentacleGreen: + case kDudePodFire: + case kDudeTentacleFire: + case kDudeTentacleMother: + if (gModernMap && (pSprite->cstat & CSTAT_SPRITE_YFLIP)) { if (!(pSprite->flags & kModernTypeFlag1)) // don't add autoaim for player if hitag 1 specified in editor. pSprite->flags = kHitagAutoAim; break; diff --git a/source/blood/src/ai.h b/source/blood/src/ai.h index 570975213..7843d7a06 100644 --- a/source/blood/src/ai.h +++ b/source/blood/src/ai.h @@ -31,7 +31,7 @@ BEGIN_BLD_NS 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 at4; // seq callback int at8; @@ -104,7 +104,7 @@ void aiProcessDudes(void); void aiInit(void); void aiInitSprite(spritetype *pSprite); -// By NoOne: this function required for kGDXDudeTargetChanger +// By NoOne: this function required for kModernDudeTargetChanger void aiSetGenIdleState(spritetype* pSprite, XSPRITE* pXSprite); END_BLD_NS diff --git a/source/blood/src/aibeast.cpp b/source/blood/src/aibeast.cpp index 2ab701a64..3bc9c3246 100644 --- a/source/blood/src/aibeast.cpp +++ b/source/blood/src/aibeast.cpp @@ -134,7 +134,7 @@ static void StompSeqCallback(int, int nXSprite) spritetype *pSprite2 = &sprite[nSprite2]; if (pSprite2->extra > 0 && pSprite2->extra < kMaxXSprites) { - if (pSprite2->type == 251) + if (pSprite2->type == kDudeBeast) continue; if (pSprite2->flags&32) continue; @@ -195,7 +195,7 @@ static void StompSeqCallback(int, int nXSprite) static void MorphToBeast(spritetype *pSprite, XSPRITE *pXSprite) { actHealDude(pXSprite, dudeInfo[51].startHealth, dudeInfo[51].startHealth); - pSprite->type = 251; + pSprite->type = kDudeBeast; } static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite) diff --git a/source/blood/src/aiburn.cpp b/source/blood/src/aiburn.cpp index 1be007fd9..cf6fff060 100644 --- a/source/blood/src/aiburn.cpp +++ b/source/blood/src/aiburn.cpp @@ -110,25 +110,25 @@ static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite) { switch (pSprite->type) { - case 240: + case kDudeBurningCultist: aiNewState(pSprite, pXSprite, &cultistBurnSearch); break; - case 241: + case kDudeBurningZombieAxe: aiNewState(pSprite, pXSprite, &zombieABurnSearch); break; - case 242: + case kDudeBurningZombieButcher: aiNewState(pSprite, pXSprite, &zombieFBurnSearch); break; - case 239: + case kDudeBurningInnocent: aiNewState(pSprite, pXSprite, &innocentBurnSearch); break; - case 253: + case kDudeBurningBeast: aiNewState(pSprite, pXSprite, &beastBurnSearch); break; - case 252: + case kDudeBurningTinyCaleb: aiNewState(pSprite, pXSprite, &tinycalebBurnSearch); break; - case kCustomDudeBurning: + case kDudeModernCustomBurning: aiNewState(pSprite, pXSprite, &GDXGenDudeBurnSearch); break; } @@ -142,25 +142,25 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) { switch (pSprite->type) { - case 240: + case kDudeBurningCultist: aiNewState(pSprite, pXSprite, &cultistBurnGoto); break; - case 241: + case kDudeBurningZombieAxe: aiNewState(pSprite, pXSprite, &zombieABurnGoto); break; - case 242: + case kDudeBurningZombieButcher: aiNewState(pSprite, pXSprite, &zombieFBurnGoto); break; - case 239: + case kDudeBurningInnocent: aiNewState(pSprite, pXSprite, &innocentBurnGoto); break; - case 253: + case kDudeBurningBeast: aiNewState(pSprite, pXSprite, &beastBurnGoto); break; - case 252: + case kDudeBurningTinyCaleb: aiNewState(pSprite, pXSprite, &tinycalebBurnGoto); break; - case kCustomDudeBurning: + case kDudeModernCustomBurning: aiNewState(pSprite, pXSprite, &GDXGenDudeBurnGoto); break; } @@ -178,25 +178,25 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) { switch (pSprite->type) { - case 240: + case kDudeBurningCultist: aiNewState(pSprite, pXSprite, &cultistBurnSearch); break; - case 241: + case kDudeBurningZombieAxe: aiNewState(pSprite, pXSprite, &zombieABurnSearch); break; - case 242: + case kDudeBurningZombieButcher: aiNewState(pSprite, pXSprite, &zombieFBurnSearch); break; - case 239: + case kDudeBurningInnocent: aiNewState(pSprite, pXSprite, &innocentBurnSearch); break; - case 253: + case kDudeBurningBeast: aiNewState(pSprite, pXSprite, &beastBurnSearch); break; - case 252: + case kDudeBurningTinyCaleb: aiNewState(pSprite, pXSprite, &tinycalebBurnSearch); break; - case kCustomDudeBurning: + case kDudeModernCustomBurning: aiNewState(pSprite, pXSprite, &GDXGenDudeBurnSearch); break; } @@ -216,25 +216,25 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) { switch (pSprite->type) { - case 240: + case kDudeBurningCultist: aiNewState(pSprite, pXSprite, &cultistBurnAttack); break; - case 241: + case kDudeBurningZombieAxe: aiNewState(pSprite, pXSprite, &zombieABurnAttack); break; - case 242: + case kDudeBurningZombieButcher: aiNewState(pSprite, pXSprite, &zombieFBurnAttack); break; - case 239: + case kDudeBurningInnocent: aiNewState(pSprite, pXSprite, &innocentBurnAttack); break; - case 253: + case kDudeBurningBeast: aiNewState(pSprite, pXSprite, &beastBurnAttack); break; - case 252: + case kDudeBurningTinyCaleb: aiNewState(pSprite, pXSprite, &tinycalebBurnAttack); break; - case kCustomDudeBurning: + case kDudeModernCustomBurning: aiNewState(pSprite, pXSprite, &GDXGenDudeBurnSearch); break; } @@ -246,25 +246,25 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) switch (pSprite->type) { - case 240: + case kDudeBurningCultist: aiNewState(pSprite, pXSprite, &cultistBurnGoto); break; - case 241: + case kDudeBurningZombieAxe: aiNewState(pSprite, pXSprite, &zombieABurnGoto); break; case 242: aiNewState(pSprite, pXSprite, &zombieFBurnGoto); break; - case 239: + case kDudeBurningInnocent: aiNewState(pSprite, pXSprite, &innocentBurnGoto); break; - case 253: + case kDudeBurningBeast: aiNewState(pSprite, pXSprite, &beastBurnGoto); break; - case 252: + case kDudeBurningTinyCaleb: aiNewState(pSprite, pXSprite, &tinycalebBurnGoto); break; - case kCustomDudeBurning: + case kDudeModernCustomBurning: aiNewState(pSprite, pXSprite, &GDXGenDudeBurnSearch); break; } diff --git a/source/blood/src/aicerber.cpp b/source/blood/src/aicerber.cpp index 12db78cd5..eaa7a23e0 100644 --- a/source/blood/src/aicerber.cpp +++ b/source/blood/src/aicerber.cpp @@ -163,15 +163,14 @@ static void BurnSeqCallback(int, int nXSprite) } } } - switch (pSprite->type) - { - case 227: - actFireMissile(pSprite, -350, 0, aim.dx, aim.dy, aim.dz, 313); - actFireMissile(pSprite, 350, -100, aim.dx, aim.dy, aim.dz, 313); - break; - case 228: - actFireMissile(pSprite, 350, -100, aim.dx, aim.dy, aim.dz, 313); - break; + switch (pSprite->type) { + case kDudeCerberusTwoHead: + actFireMissile(pSprite, -350, 0, aim.dx, aim.dy, aim.dz, kMissileFireballCerberus); + actFireMissile(pSprite, 350, -100, aim.dx, aim.dy, aim.dz, kMissileFireballCerberus); + break; + case kDudeCerberusOneHead: + actFireMissile(pSprite, 350, -100, aim.dx, aim.dy, aim.dz, kMissileFireballCerberus); + break; } } @@ -248,15 +247,14 @@ static void BurnSeqCallback2(int, int nXSprite) } } } - switch (pSprite->type) - { - case 227: - actFireMissile(pSprite, 350, -100, aim.dx, aim.dy, -aim.dz, 308); - actFireMissile(pSprite, -350, 0, ax, ay, az, 308); - break; - case 228: - actFireMissile(pSprite, 350, -100, aim.dx, aim.dy, -aim.dz, 308); - break; + switch (pSprite->type) { + case kDudeCerberusTwoHead: + actFireMissile(pSprite, 350, -100, aim.dx, aim.dy, -aim.dz, kMissileFlameHound); + actFireMissile(pSprite, -350, 0, ax, ay, az, kMissileFlameHound); + break; + case kDudeCerberusOneHead: + actFireMissile(pSprite, 350, -100, aim.dx, aim.dy, -aim.dz, kMissileFlameHound); + break; } } @@ -278,7 +276,7 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite) pXSprite->goalAng += 256; POINT3D *pTarget = &baseSprite[pSprite->index]; aiSetTarget(pXSprite, pTarget->x, pTarget->y, pTarget->z); - if (pSprite->type == 227) + if (pSprite->type == kDudeCerberusTwoHead) aiNewState(pSprite, pXSprite, &cerberus139890); else aiNewState(pSprite, pXSprite, &cerberus1398AC); @@ -333,14 +331,13 @@ static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite) aiChooseDirection(pSprite, pXSprite, nAngle); if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) { - switch (pSprite->type) - { - case 227: - aiNewState(pSprite, pXSprite, &cerberusSearch); - break; - case 228: - aiNewState(pSprite, pXSprite, &cerberus2Search); - break; + switch (pSprite->type) { + case kDudeCerberusTwoHead: + aiNewState(pSprite, pXSprite, &cerberusSearch); + break; + case kDudeCerberusOneHead: + aiNewState(pSprite, pXSprite, &cerberus2Search); + break; } } aiThinkTarget(pSprite, pXSprite); @@ -348,21 +345,19 @@ static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite) static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) { - if (pXSprite->target == -1) - { - switch (pSprite->type) - { - case 227: - aiNewState(pSprite, pXSprite, &cerberusGoto); - break; - case 228: - aiNewState(pSprite, pXSprite, &cerberus2Goto); - break; + if (pXSprite->target == -1) { + switch (pSprite->type) { + case kDudeCerberusTwoHead: + aiNewState(pSprite, pXSprite, &cerberusGoto); + break; + case kDudeCerberusOneHead: + aiNewState(pSprite, pXSprite, &cerberus2Goto); + break; } return; } - if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) - return; + + if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) return; //dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) @@ -373,32 +368,31 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(pSprite, pXSprite, getangle(dx, dy)); - if (pXTarget->health == 0) - { - switch (pSprite->type) - { - case 227: - aiNewState(pSprite, pXSprite, &cerberusSearch); - break; - case 228: - aiNewState(pSprite, pXSprite, &cerberus2Search); - break; + + if (pXTarget->health == 0) { + switch (pSprite->type) { + case kDudeCerberusTwoHead: + aiNewState(pSprite, pXSprite, &cerberusSearch); + break; + case kDudeCerberusOneHead: + aiNewState(pSprite, pXSprite, &cerberus2Search); + break; } return; } - if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) - { - switch (pSprite->type) - { - case 227: - aiNewState(pSprite, pXSprite, &cerberusSearch); - break; - case 228: - aiNewState(pSprite, pXSprite, &cerberus2Search); - break; + + if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], 13) > 0) { + switch (pSprite->type) { + case kDudeCerberusTwoHead: + aiNewState(pSprite, pXSprite, &cerberusSearch); + break; + case kDudeCerberusOneHead: + aiNewState(pSprite, pXSprite, &cerberus2Search); + break; } return; } + int nDist = approxDist(dx, dy); if (nDist <= pDudeInfo->seeDist) { @@ -406,72 +400,66 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) 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 (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery) - { + if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery) { aiSetTarget(pXSprite, pXSprite->target); - if (nDist < 0x1b00 && nDist > 0xd00 && klabs(nDeltaAngle) < 85) - { - switch (pSprite->type) - { - case 227: - aiNewState(pSprite, pXSprite, &cerberusBurn); - break; - case 228: - aiNewState(pSprite, pXSprite, &cerberus2Burn); - break; + + if (nDist < 0x1b00 && nDist > 0xd00 && klabs(nDeltaAngle) < 85) { + switch (pSprite->type) { + case kDudeCerberusTwoHead: + aiNewState(pSprite, pXSprite, &cerberusBurn); + break; + case kDudeCerberusOneHead: + aiNewState(pSprite, pXSprite, &cerberus2Burn); + break; } } - else if (nDist < 0xb00 && nDist > 0x500 && klabs(nDeltaAngle) < 85) - { - switch (pSprite->type) - { - case 227: - aiNewState(pSprite, pXSprite, &cerberus3Burn); - break; - case 228: - aiNewState(pSprite, pXSprite, &cerberus4Burn); - break; + + else if (nDist < 0xb00 && nDist > 0x500 && klabs(nDeltaAngle) < 85) { + switch (pSprite->type) { + case kDudeCerberusTwoHead: + aiNewState(pSprite, pXSprite, &cerberus3Burn); + break; + case kDudeCerberusOneHead: + aiNewState(pSprite, pXSprite, &cerberus4Burn); + break; } } else if (nDist < 0x200 && klabs(nDeltaAngle) < 85) { int hit = HitScan(pSprite, pSprite->z, dx, dy, 0, CLIPMASK1, 0); - switch (pSprite->type) - { - case 227: - switch (hit) - { - case -1: - aiNewState(pSprite, pXSprite, &cerberusBite); - break; - case 3: - if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != 211) + switch (pSprite->type) { + case kDudeCerberusTwoHead: + switch (hit) { + case -1: aiNewState(pSprite, pXSprite, &cerberusBite); - break; - case 0: - case 4: - break; - default: - aiNewState(pSprite, pXSprite, &cerberusBite); - break; + break; + case 3: + if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeHellHound) + aiNewState(pSprite, pXSprite, &cerberusBite); + break; + case 0: + case 4: + break; + default: + aiNewState(pSprite, pXSprite, &cerberusBite); + break; } break; - case 228: - switch (hit) - { - case -1: - aiNewState(pSprite, pXSprite, &cerberus2Bite); - break; - case 3: - if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != 211) + case kDudeCerberusOneHead: + switch (hit) { + case -1: aiNewState(pSprite, pXSprite, &cerberus2Bite); - break; - case 0: - case 4: - break; - default: - aiNewState(pSprite, pXSprite, &cerberus2Bite); - break; + break; + case 3: + if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeHellHound) + aiNewState(pSprite, pXSprite, &cerberus2Bite); + break; + case 0: + case 4: + break; + default: + aiNewState(pSprite, pXSprite, &cerberus2Bite); + break; } break; } @@ -481,14 +469,13 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) } } - switch (pSprite->type) - { - case 227: - aiNewState(pSprite, pXSprite, &cerberusGoto); - break; - case 228: - aiNewState(pSprite, pXSprite, &cerberus2Goto); - break; + switch (pSprite->type) { + case kDudeCerberusTwoHead: + aiNewState(pSprite, pXSprite, &cerberusGoto); + break; + case kDudeCerberusOneHead: + aiNewState(pSprite, pXSprite, &cerberus2Goto); + break; } pXSprite->target = -1; } diff --git a/source/blood/src/aicult.cpp b/source/blood/src/aicult.cpp index b5d9a024a..2e4b7774c 100644 --- a/source/blood/src/aicult.cpp +++ b/source/blood/src/aicult.cpp @@ -128,7 +128,7 @@ static void TeslaSeqCallback(int, int nXSprite) dx += Random3((5-gGameOptions.nDifficulty)*1000); dy += Random3((5-gGameOptions.nDifficulty)*1000); 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); } } @@ -162,9 +162,9 @@ static void ThrowSeqCallback(int, int nXSprite) XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; spritetype *pSprite = &sprite[nSprite]; - int nMissile = 418; + int nMissile = kThingArmedTNTStick; if (gGameOptions.nDifficulty > 2) - nMissile = 419; + nMissile = kThingArmedTNTBundle; char v4 = Chance(0x6000); sfxPlay3DSound(pSprite, 455, -1, 0); dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); @@ -181,7 +181,7 @@ static void ThrowSeqCallback(int, int nXSprite) if (v4) xsprite[pMissile->extra].Impact = 1; 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) @@ -189,12 +189,12 @@ static void sub_68170(int, int nXSprite) XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; spritetype *pSprite = &sprite[nSprite]; - int nMissile = 418; + int nMissile = kThingArmedTNTStick; if (gGameOptions.nDifficulty > 2) - nMissile = 419; + nMissile = kThingArmedTNTBundle; sfxPlay3DSound(pSprite, 455, -1, 0); 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) @@ -202,9 +202,9 @@ static void sub_68230(int, int nXSprite) XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; spritetype *pSprite = &sprite[nSprite]; - int nMissile = 418; + int nMissile = kThingArmedTNTStick; if (gGameOptions.nDifficulty > 2) - nMissile = 419; + nMissile = kThingArmedTNTBundle; sfxPlay3DSound(pSprite, 455, -1, 0); dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); 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]) { - if (sprite[nSprite].type == 418 || sprite[nSprite].statnum == kStatExplosion) + if (sprite[nSprite].type == kThingArmedTNTStick || sprite[nSprite].statnum == kStatExplosion) return 1; } return 0; @@ -289,7 +289,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) { case 0: aiNewState(pSprite, pXSprite, &cultistSearch); - if (pSprite->type == 201) + if (pSprite->type == kDudeCultistTommy) aiPlay3DSound(pSprite, 4021+Random(4), AI_SFX_PRIORITY_1, -1); else aiPlay3DSound(pSprite, 1021+Random(4), AI_SFX_PRIORITY_1, -1); @@ -327,9 +327,8 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) aiSetTarget(pXSprite, pXSprite->target); int nXSprite = sprite[pXSprite->reference].extra; gDudeSlope[nXSprite] = divscale(pTarget->z-pSprite->z, nDist, 10); - switch (pSprite->type) - { - case 201: + switch (pSprite->type) { + case kDudeCultistTommy: if (nDist < 0x1e00 && nDist > 0xe00 && klabs(nDeltaAngle) < 85 && !TargetNearExplosion(pTarget) && (pTarget->flags&2) && gGameOptions.nDifficulty > 2 && IsPlayerSprite(pTarget) && gPlayer[pTarget->type-kDudePlayer1].at2e && Chance(0x8000)) @@ -345,7 +344,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) case 4: break; 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); break; default: @@ -367,7 +366,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &cultistTSwimFire); break; 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) aiNewState(pSprite, pXSprite, &cultistTFire); @@ -397,7 +396,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) } } break; - case 202: + case kDudeCultistShotgun: if (nDist < 0x2c00 && nDist > 0x1400 && !TargetNearExplosion(pTarget) && (pTarget->flags&2) && gGameOptions.nDifficulty >= 2 && IsPlayerSprite(pTarget) && !gPlayer[pTarget->type-kDudePlayer1].at2e && Chance(0x8000)) @@ -413,7 +412,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) case 4: break; 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); break; default: @@ -435,7 +434,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &cultistSSwimFire); break; 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) aiNewState(pSprite, pXSprite, &cultistSFire); @@ -465,7 +464,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) } } break; - case 247: + case kDudeCultistTesla: if (nDist < 0x1e00 && nDist > 0xe00 && !TargetNearExplosion(pTarget) && (pTarget->flags&2) && gGameOptions.nDifficulty > 2 && IsPlayerSprite(pTarget) && gPlayer[pTarget->type-kDudePlayer1].at2e && Chance(0x8000)) @@ -481,7 +480,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) case 4: break; 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); break; default: @@ -503,7 +502,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &cultistTsSwimFire); break; 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) aiNewState(pSprite, pXSprite, &cultistTsFire); @@ -533,7 +532,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) } } break; - case 248: + case kDudeCultistTNT: if (nDist < 0x2c00 && nDist > 0x1400 && klabs(nDeltaAngle) < 85 && (pTarget->flags&2) && IsPlayerSprite(pTarget)) { @@ -547,7 +546,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) case 4: break; 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); break; default: @@ -568,7 +567,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) case 4: break; 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); break; default: @@ -577,7 +576,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) } } break; - case 249: + case kDudeCultistBeast: if (nDist < 0x1e00 && nDist > 0xe00 && !TargetNearExplosion(pTarget) && (pTarget->flags&2) && gGameOptions.nDifficulty > 2 && IsPlayerSprite(pTarget) && gPlayer[pTarget->type-kDudePlayer1].at2e && Chance(0x8000)) @@ -593,7 +592,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) case 4: break; 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); break; default: @@ -615,7 +614,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &cultistSSwimFire); break; 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) aiNewState(pSprite, pXSprite, &cultistSFire); diff --git a/source/blood/src/aigarg.cpp b/source/blood/src/aigarg.cpp index de8994aec..2fa2ea468 100644 --- a/source/blood/src/aigarg.cpp +++ b/source/blood/src/aigarg.cpp @@ -125,7 +125,7 @@ static void ThrowFSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; 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) @@ -210,8 +210,8 @@ static void BlastSSeqCallback(int, int nXSprite) } 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, 311); + actFireMissile(pSprite, -120, 0, aim.dx, aim.dy, aim.dz, kMissileArcGargoyle); + 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]; int nSprite = pXSprite->reference; 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) @@ -398,9 +398,8 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) { aiSetTarget(pXSprite, pXSprite->target); int floorZ = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y); - switch (pSprite->type) - { - case 206: + switch (pSprite->type) { + case kDudeGargoyleFlesh: if (nDist < 0x1800 && nDist > 0xc00 && klabs(nDeltaAngle) < 85) { int hit = HitScan(pSprite, pSprite->z, dx, dy, 0, CLIPMASK1, 0); @@ -414,7 +413,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) case 4: break; 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); aiNewState(pSprite, pXSprite, &gargoyleFThrow); @@ -439,7 +438,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) case 4: break; 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); 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) aiPlay3DSound(pSprite, 1400, AI_SFX_PRIORITY_1, -1); break; - case 207: + case kDudeGargoyleStone: if (nDist < 0x1800 && nDist > 0xc00 && klabs(nDeltaAngle) < 85) { int hit = HitScan(pSprite, pSprite->z, dx, dy, 0, CLIPMASK1, 0); @@ -473,7 +472,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) case 4: break; 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); aiNewState(pSprite, pXSprite, &gargoyleSBlast); @@ -497,7 +496,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) case 4: break; 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); break; default: @@ -507,7 +506,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) } 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); else aiPlay3DSound(pSprite, 1450, AI_SFX_PRIORITY_1, -1); @@ -535,14 +534,14 @@ static void entryFStatue(spritetype *pSprite, XSPRITE *pXSprite) { DUDEINFO *pDudeInfo = &dudeInfo[6]; actHealDude(pXSprite, pDudeInfo->startHealth, pDudeInfo->startHealth); - pSprite->type = 206; + pSprite->type = kDudeGargoyleFlesh; } static void entrySStatue(spritetype *pSprite, XSPRITE *pXSprite) { DUDEINFO *pDudeInfo = &dudeInfo[7]; actHealDude(pXSprite, pDudeInfo->startHealth, pDudeInfo->startHealth); - pSprite->type = 207; + pSprite->type = kDudeGargoyleStone; } static void MoveForward(spritetype *pSprite, XSPRITE *pXSprite) @@ -612,14 +611,13 @@ static void MoveSlow(spritetype *pSprite, XSPRITE *pXSprite) t2 >>= 1; xvel[nSprite] = dmulscale30(t1, nCos, t2, nSin); yvel[nSprite] = dmulscale30(t1, nSin, -t2, nCos); - switch (pSprite->type) - { - case 206: - zvel[nSprite] = 0x44444; - break; - case 207: - zvel[nSprite] = 0x35555; - break; + switch (pSprite->type) { + case kDudeGargoyleFlesh: + zvel[nSprite] = 0x44444; + break; + case kDudeGargoyleStone: + zvel[nSprite] = 0x35555; + break; } } @@ -654,14 +652,13 @@ static void MoveSwoop(spritetype *pSprite, XSPRITE *pXSprite) t1 += nAccel>>1; xvel[nSprite] = dmulscale30(t1, nCos, t2, nSin); yvel[nSprite] = dmulscale30(t1, nSin, -t2, nCos); - switch (pSprite->type) - { - case 206: - zvel[nSprite] = t1; - break; - case 207: - zvel[nSprite] = t1; - break; + switch (pSprite->type) { + case kDudeGargoyleFlesh: + zvel[nSprite] = t1; + break; + case kDudeGargoyleStone: + zvel[nSprite] = t1; + break; } } @@ -696,14 +693,13 @@ static void MoveFly(spritetype *pSprite, XSPRITE *pXSprite) t1 += nAccel>>1; xvel[nSprite] = dmulscale30(t1, nCos, t2, nSin); yvel[nSprite] = dmulscale30(t1, nSin, -t2, nCos); - switch (pSprite->type) - { - case 206: - zvel[nSprite] = -t1; - break; - case 207: - zvel[nSprite] = -t1; - break; + switch (pSprite->type) { + case kDudeGargoyleFlesh: + zvel[nSprite] = -t1; + break; + case kDudeGargoyleStone: + zvel[nSprite] = -t1; + break; } klabs(zvel[nSprite]); } diff --git a/source/blood/src/aighost.cpp b/source/blood/src/aighost.cpp index d95244d16..ebc636e25 100644 --- a/source/blood/src/aighost.cpp +++ b/source/blood/src/aighost.cpp @@ -108,7 +108,7 @@ static void ThrowSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; 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) @@ -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 { 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); int floorZ = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y); - switch (pSprite->type) - { - case 210: - if (nDist < 0x2000 && nDist > 0x1000 && klabs(nDeltaAngle) < 85) - { + switch (pSprite->type) { + case kDudePhantasm: + if (nDist < 0x2000 && nDist > 0x1000 && klabs(nDeltaAngle) < 85) { int hit = HitScan(pSprite, pSprite->z, dx, dy, 0, CLIPMASK1, 0); switch (hit) { @@ -387,7 +385,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) case 4: break; 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); break; default: @@ -407,7 +405,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) case 4: break; 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); break; default: @@ -505,11 +503,10 @@ static void MoveSlow(spritetype *pSprite, XSPRITE *pXSprite) t2 >>= 1; xvel[nSprite] = dmulscale30(t1, nCos, t2, nSin); yvel[nSprite] = dmulscale30(t1, nSin, -t2, nCos); - switch (pSprite->type) - { - case 210: - zvel[nSprite] = 0x44444; - break; + switch (pSprite->type) { + case kDudePhantasm: + zvel[nSprite] = 0x44444; + break; } } @@ -544,11 +541,10 @@ static void MoveSwoop(spritetype *pSprite, XSPRITE *pXSprite) t1 += nAccel>>1; xvel[nSprite] = dmulscale30(t1, nCos, t2, nSin); yvel[nSprite] = dmulscale30(t1, nSin, -t2, nCos); - switch (pSprite->type) - { - case 210: - zvel[nSprite] = t1; - break; + switch (pSprite->type) { + case kDudePhantasm: + zvel[nSprite] = t1; + break; } } @@ -583,11 +579,10 @@ static void MoveFly(spritetype *pSprite, XSPRITE *pXSprite) t1 += nAccel>>1; xvel[nSprite] = dmulscale30(t1, nCos, t2, nSin); yvel[nSprite] = dmulscale30(t1, nSin, -t2, nCos); - switch (pSprite->type) - { - case 210: - zvel[nSprite] = -t1; - break; + switch (pSprite->type) { + case kDudePhantasm: + zvel[nSprite] = -t1; + break; } } diff --git a/source/blood/src/aihound.cpp b/source/blood/src/aihound.cpp index d7298a103..275e12cef 100644 --- a/source/blood/src/aihound.cpp +++ b/source/blood/src/aihound.cpp @@ -86,7 +86,7 @@ static void BurnSeqCallback(int, int nXSprite) XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; 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) diff --git a/source/blood/src/aipod.cpp b/source/blood/src/aipod.cpp index d1fa72582..186f97f02 100644 --- a/source/blood/src/aipod.cpp +++ b/source/blood/src/aipod.cpp @@ -111,7 +111,7 @@ static void sub_6FFA0(int, int nXSprite) spritetype *pMissile = NULL; switch (pSprite->type) { - case 221: + case kDudePodGreen: dz += 8000; if (pDudeInfo->seeDist*0.1 < nDist) { @@ -119,17 +119,17 @@ static void sub_6FFA0(int, int nXSprite) sfxPlay3DSound(pSprite, 2474, -1, 0); else 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) seqSpawn(68, 3, pMissile->extra, -1); break; - case 223: + case kDudePodFire: dz += 8000; if (pDudeInfo->seeDist*0.1 < nDist) { 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) seqSpawn(22, 3, pMissile->extra, -1); @@ -147,19 +147,18 @@ static void sub_70284(int, int nXSprite) sfxPlay3DSound(pSprite, 2502, -1, 0); int nDist, nBurn; DAMAGE_TYPE dmgType; - switch (pSprite->type) - { - case 222: - default: - nBurn = 0; - dmgType = DAMAGE_TYPE_2; - nDist = 50; - break; - case 224: - nBurn = (gGameOptions.nDifficulty*120)>>2; - dmgType = DAMAGE_TYPE_3; - nDist = 75; - break; + switch (pSprite->type) { + case kDudeTentacleGreen: + default: // ??? + nBurn = 0; + dmgType = DAMAGE_TYPE_2; + nDist = 50; + break; + case kDudeTentacleFire: // ??? + nBurn = (gGameOptions.nDifficulty*120)>>2; + dmgType = DAMAGE_TYPE_3; + nDist = 75; + break; } 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 nDist = approxDist(dx, dy); aiChooseDirection(pSprite, pXSprite, nAngle); - if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) - { - switch (pSprite->type) - { - case 221: - case 223: - aiNewState(pSprite, pXSprite, &podSearch); - break; - case 222: - case 224: - aiNewState(pSprite, pXSprite, &tentacleSearch); - break; + if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) { + switch (pSprite->type) { + case kDudePodGreen: + case kDudePodFire: + aiNewState(pSprite, pXSprite, &podSearch); + break; + case kDudeTentacleGreen: + case kDudeTentacleFire: + aiNewState(pSprite, pXSprite, &tentacleSearch); + break; } } aiThinkTarget(pSprite, pXSprite); @@ -201,18 +198,16 @@ static void sub_70380(spritetype *pSprite, XSPRITE *pXSprite) static void sub_704D8(spritetype *pSprite, XSPRITE *pXSprite) { - if (pXSprite->target == -1) - { - switch (pSprite->type) - { - case 221: - case 223: - aiNewState(pSprite, pXSprite, &pod13A600); - break; - case 222: - case 224: - aiNewState(pSprite, pXSprite, &tentacle13A718); - break; + if (pXSprite->target == -1) { + switch (pSprite->type) { + case kDudePodGreen: + case kDudePodFire: + aiNewState(pSprite, pXSprite, &pod13A600); + break; + case kDudeTentacleGreen: + case kDudeTentacleFire: + aiNewState(pSprite, pXSprite, &tentacle13A718); + break; } return; } @@ -228,18 +223,17 @@ static void sub_704D8(spritetype *pSprite, XSPRITE *pXSprite) int dx = pTarget->x-pSprite->x; int dy = pTarget->y-pSprite->y; aiChooseDirection(pSprite, pXSprite, getangle(dx, dy)); - if (pXTarget->health == 0) - { - switch (pSprite->type) - { - case 221: - case 223: - aiNewState(pSprite, pXSprite, &podSearch); - break; - case 222: - case 224: - aiNewState(pSprite, pXSprite, &tentacleSearch); - break; + if (pXTarget->health == 0) { + + switch (pSprite->type) { + case kDudePodGreen: + case kDudePodFire: + aiNewState(pSprite, pXSprite, &podSearch); + break; + case kDudeTentacleGreen: + case kDudeTentacleFire: + aiNewState(pSprite, pXSprite, &tentacleSearch); + break; } return; } @@ -253,18 +247,16 @@ static void sub_704D8(spritetype *pSprite, XSPRITE *pXSprite) if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery) { aiSetTarget(pXSprite, pXSprite->target); - if (klabs(nDeltaAngle) < 85 && pTarget->type != 221 && pTarget->type != 223) - { - switch (pSprite->type) - { - case 221: - case 223: - aiNewState(pSprite, pXSprite, &pod13A638); - break; - case 222: - case 224: - aiNewState(pSprite, pXSprite, &tentacle13A750); - break; + if (klabs(nDeltaAngle) < 85 && pTarget->type != kDudePodGreen && pTarget->type != kDudePodFire) { + switch (pSprite->type) { + case kDudePodGreen: + case kDudePodFire: + aiNewState(pSprite, pXSprite, &pod13A638); + break; + case kDudeTentacleGreen: + case kDudeTentacleFire: + aiNewState(pSprite, pXSprite, &tentacle13A750); + break; } } return; @@ -272,16 +264,15 @@ static void sub_704D8(spritetype *pSprite, XSPRITE *pXSprite) } } - switch (pSprite->type) - { - case 221: - case 223: - aiNewState(pSprite, pXSprite, &pod13A600); - break; - case 222: - case 224: - aiNewState(pSprite, pXSprite, &tentacle13A718); - break; + switch (pSprite->type) { + case kDudePodGreen: + case kDudePodFire: + aiNewState(pSprite, pXSprite, &pod13A600); + break; + case kDudeTentacleGreen: + case kDudeTentacleFire: + aiNewState(pSprite, pXSprite, &tentacle13A718); + break; } pXSprite->target = -1; } diff --git a/source/blood/src/aispid.cpp b/source/blood/src/aispid.cpp index 35f560458..7e2800ace 100644 --- a/source/blood/src/aispid.cpp +++ b/source/blood/src/aispid.cpp @@ -101,48 +101,34 @@ static void SpidBiteSeqCallback(int, int nXSprite) dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); spritetype *pTarget = &sprite[pXSprite->target]; XSPRITE *pXTarget = &xsprite[pTarget->extra]; - if (IsPlayerSprite(pTarget)) - { + if (IsPlayerSprite(pTarget)) { + int hit = HitScan(pSprite, pSprite->z, dx, dy, 0, CLIPMASK1, 0); - if (hit == 3) - { - if (sprite[gHitInfo.hitsprite].type <= kDudePlayer8 && sprite[gHitInfo.hitsprite].type >= kDudePlayer1) - { - dz += pTarget->z-pSprite->z; - if (pTarget->type >= kDudePlayer1 && pTarget->type <= kDudePlayer8) - { - PLAYER *pPlayer = &gPlayer[pTarget->type-kDudePlayer1]; - switch (pSprite->type) - { - case 213: - actFireVector(pSprite, 0, 0, dx, dy, dz, VECTOR_TYPE_17); - if (IsPlayerSprite(pTarget) && !pPlayer->at31a && powerupCheck(pPlayer, 14) <= 0 - && Chance(0x4000)) - powerupActivate(pPlayer, 28); - break; - case 214: - actFireVector(pSprite, 0, 0, dx, dy, dz, VECTOR_TYPE_17); - if (Chance(0x5000)) - sub_70D30(pXTarget, 4, 16); - break; - case 215: - 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; - } - } - } + if (hit == 3 && IsPlayerSprite(&sprite[gHitInfo.hitsprite])) { + dz += pTarget->z - pSprite->z; + PLAYER *pPlayer = &gPlayer[pTarget->type - kDudePlayer1]; + switch (pSprite->type) { + case kDudeSpiderBrown: + actFireVector(pSprite, 0, 0, dx, dy, dz, VECTOR_TYPE_17); + if (IsPlayerSprite(pTarget) && !pPlayer->at31a && powerupCheck(pPlayer, 14) <= 0 && Chance(0x4000)) + powerupActivate(pPlayer, 28); + break; + case kDudeSpiderRed: + actFireVector(pSprite, 0, 0, dx, dy, dz, VECTOR_TYPE_17); + if (Chance(0x5000)) sub_70D30(pXTarget, 4, 16); + break; + case kDudeSpiderBlack: + actFireVector(pSprite, 0, 0, dx, dy, dz, VECTOR_TYPE_17); + sub_70D30(pXTarget, 8, 16); + break; + case kDudeSpiderMother: + actFireVector(pSprite, 0, 0, dx, dy, dz, VECTOR_TYPE_17); + actFireVector(pSprite, 0, 0, dx + Random2(2000), dy + Random2(2000), dz + Random2(2000), 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(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); spritetype *pTarget = &sprite[pXSprite->target]; - if (IsPlayerSprite(pTarget)) - { + if (IsPlayerSprite(pTarget)) { dz += pTarget->z-pSprite->z; - if (pTarget->type >= kDudePlayer1 && pTarget->type <= kDudePlayer8) - { - switch (pSprite->type) - { - case 213: - case 214: - case 215: + switch (pSprite->type) { + case kDudeSpiderBrown: + case kDudeSpiderRed: + case kDudeSpiderBlack: xvel[nSprite] = dx << 16; yvel[nSprite] = dy << 16; zvel[nSprite] = dz << 16; break; - } } } } @@ -192,22 +173,24 @@ static void sub_71370(int, int nXSprite) int dy = pXSprite->targetY-pSprite->y; int nAngle = getangle(dx, dy); int nDist = approxDist(dx, dy); + 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) - 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) - pSpawn = actSpawnDude(pSprite, 213, pSprite->clipdist, 0); + pSpawn = actSpawnDude(pSprite, kDudeSpiderBrown, pSprite->clipdist, 0); else if (nDist < 0xc00 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) - pSpawn = actSpawnDude(pSprite, 213, pSprite->clipdist, 0); - if (pSpawn) - { + pSpawn = actSpawnDude(pSprite, kDudeSpiderBrown, pSprite->clipdist, 0); + + if (pSpawn) { pDudeExtraE->at4++; pSpawn->owner = nSprite; gKillMgr.sub_263E0(1); } } + } static void thinkSearch(spritetype *pSprite, XSPRITE *pXSprite) @@ -256,35 +239,33 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite) return; } int nDist = approxDist(dx, dy); - if (nDist <= pDudeInfo->seeDist) - { + if (nDist <= pDudeInfo->seeDist) { int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024; 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 (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery) - { + 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) { aiSetTarget(pXSprite, pXSprite->target); - switch (pSprite->type) - { - case 214: - if (nDist < 0x399 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &spidBite); - break; - case 213: - case 215: - if (nDist < 0x733 && nDist > 0x399 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &spidJump); - else if (nDist < 0x399 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &spidBite); - break; - case 216: - if (nDist < 0x733 && nDist > 0x399 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &spidJump); - else if (Chance(0x8000)) - aiNewState(pSprite, pXSprite, &spid13A92C); - break; + + switch (pSprite->type) { + case kDudeSpiderRed: + if (nDist < 0x399 && klabs(nDeltaAngle) < 85) + aiNewState(pSprite, pXSprite, &spidBite); + break; + case kDudeSpiderBrown: + case kDudeSpiderBlack: + if (nDist < 0x733 && nDist > 0x399 && klabs(nDeltaAngle) < 85) + aiNewState(pSprite, pXSprite, &spidJump); + else if (nDist < 0x399 && klabs(nDeltaAngle) < 85) + aiNewState(pSprite, pXSprite, &spidBite); + break; + case kDudeSpiderMother: + if (nDist < 0x733 && nDist > 0x399 && klabs(nDeltaAngle) < 85) + aiNewState(pSprite, pXSprite, &spidJump); + else if (Chance(0x8000)) + aiNewState(pSprite, pXSprite, &spid13A92C); + break; } + return; } } diff --git a/source/blood/src/aitchern.cpp b/source/blood/src/aitchern.cpp index 5ff0de1a8..0f7a73677 100644 --- a/source/blood/src/aitchern.cpp +++ b/source/blood/src/aitchern.cpp @@ -76,7 +76,7 @@ static void sub_71A90(int, int nXSprite) int nTarget = pTarget->index; int nOwner = actSpriteIdToOwnerId(nSprite); if (pXTarget->burnTime == 0) - evPost(nTarget, 3, 0, CALLBACK_ID_0); + evPost(nTarget, 3, 0, kCallbackFXFlameLick); actBurnSprite(nOwner, pXTarget, 40); if (Chance(0x6000)) 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, 314); + actFireMissile(pSprite, -350, 0, aim.dx, aim.dy, aim.dz, kMissileFireballTchernobog); + actFireMissile(pSprite, 350, 0, aim.dx, aim.dy, aim.dz, kMissileFireballTchernobog); } 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, ax, ay, az, 314); + actFireMissile(pSprite, 350, 0, aim.dx, aim.dy, -aim.dz, kMissileFireballTchernobog); + actFireMissile(pSprite, -350, 0, ax, ay, az, kMissileFireballTchernobog); } static void sub_72580(spritetype *pSprite, XSPRITE *pXSprite) diff --git a/source/blood/src/aiunicult.cpp b/source/blood/src/aiunicult.cpp index 24749ed52..11405230c 100644 --- a/source/blood/src/aiunicult.cpp +++ b/source/blood/src/aiunicult.cpp @@ -261,7 +261,7 @@ static void ThrowThing(int nXIndex, bool impact) { int dist = approxDist(dx, dy); int zThrow = 14500; spritetype* pThing = NULL; spritetype* pLeech = NULL; XSPRITE* pXLeech = NULL; - if (thingType == kGDXThingCustomDudeLifeLeech) { + if (thingType == kModernThingEnemyLifeLeech) { if ((pLeech = leechIsDropped(pSprite)) != NULL) { // pickup life leech before throw it again 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)); 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; switch (thingType) { - case 428: + case kThingNapalmBall: impact = true; pThing->xrepeat = 24; pThing->yrepeat = 24; xsprite[pThing->extra].data4 = 3 + gGameOptions.nDifficulty; break; - case kGDXThingThrowableRock: + case kModernThingThrowableRock: int sPics[6]; sPics[0] = 2406; sPics[1] = 2280; sPics[2] = 2185; sPics[3] = 2155; @@ -306,17 +306,17 @@ static void ThrowThing(int nXIndex, bool impact) { impact = false; return; - case 400: - case 401: - case 420: + case kThingTNTBarrel: + case kThingArmedProxBomb: + case kThingArmedSpray: impact = false; break; - case kGDXThingTNTProx: + case kModernThingTNTProx: xsprite[pThing->extra].state = 0; xsprite[pThing->extra].Proximity = true; return; - case 431: - case kGDXThingCustomDudeLifeLeech: + case kThingDroppedLifeLeech: + case kModernThingEnemyLifeLeech: XSPRITE* pXThing = &xsprite[pThing->extra]; if (pLeech != NULL) pXThing->health = pXLeech->health; else pXThing->health = 300 * gGameOptions.nDifficulty; @@ -329,14 +329,14 @@ static void ThrowThing(int nXIndex, bool impact) { pXThing->target = pTarget->xvel; pXThing->Proximity = true; pXThing->stateTimer = 1; - evPost(pThing->xvel, 3, 80, CALLBACK_ID_20); + evPost(pThing->xvel, 3, 80, kCallbackLeechStateTimer); return; } if (impact == true && dist <= 7680) xsprite[pThing->extra].Impact = true; else { 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; } @@ -442,12 +442,12 @@ static void thinkChase( spritetype* pSprite, XSPRITE* pXSprite ) spritetype* pLeech = NULL; VECTORDATA* meleeVector = &gVectorData[22]; 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) xsprite[pLeech->extra].target = pXSprite->target; 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); switch (pHit) { 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)) { switch (pXSprite->data1) { - case kGDXThingCustomDudeLifeLeech: + case kModernThingEnemyLifeLeech: { if (pLeech == NULL) { aiNewState(pSprite, pXSprite, &GDXGenDudeThrow2); @@ -492,7 +492,7 @@ static void thinkChase( spritetype* pSprite, XSPRITE* pXSprite ) } } return; - case kGDXThingThrowableRock: + case kModernThingThrowableRock: if (Chance(0x4000)) aiNewState(pSprite, pXSprite, &GDXGenDudeThrow2); else sfxPlayGDXGenDudeSound(pSprite, 0); return; @@ -577,17 +577,17 @@ static void thinkChase( spritetype* pSprite, XSPRITE* pXSprite ) else if (pXSprite->data1 >= kMissileBase && pXSprite->data1 < kMissileMax) { // special handling for flame, explosive and life leech missiles int state = checkAttackState(pSprite, pXSprite); - int mdist = (pXSprite->data1 != 303) ? 3000 : 2500; + int mdist = (pXSprite->data1 != kMissileFlareAlt) ? 3000 : 2500; switch (pXSprite->data1) { case 315: // pickup life leech if it was thrown previously if ((pLeech = leechIsDropped(pSprite)) != NULL) removeLeech(pLeech); break; - case 303: - case 305: - case 312: - case 313: - case 314: + case kMissileFlareAlt: + case kMissileFireball: + case kMissileFireballNapam: + case kMissileFireballCerberus: + case kMissileFireballTchernobog: if (dist > mdist || pXSprite->locked == 1) break; else if (dist <= meleeVector->maxDist && Chance(0x9000)) aiNewState(pSprite, pXSprite, &GDXGenDudePunch); @@ -597,8 +597,8 @@ static void thinkChase( spritetype* pSprite, XSPRITE* pXSprite ) return; - case 304: - case 308: + case kMissileFlameSpray: + case kMissileFlameHound: if (spriteIsUnderwater(pSprite, false)) { if (dist > meleeVector->maxDist) aiNewState(pSprite, pXSprite, &GDXGenDudeChaseW); 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) && doExplosion(pSprite, nType)) { @@ -843,7 +843,7 @@ bool spriteIsUnderwater(spritetype* pSprite,bool oldWay) { spritetype* leechIsDropped(spritetype* pSprite) { 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]; } @@ -855,15 +855,15 @@ void removeDudeStuff(spritetype* pSprite) { for (short nSprite = headspritestat[kStatThing]; nSprite >= 0; nSprite = nextspritestat[nSprite]) { if (sprite[nSprite].owner != pSprite->xvel) continue; switch (sprite[nSprite].type) { - case 401: - case 402: - case 433: - sprite[nSprite].type = 0; - actPostSprite(sprite[nSprite].xvel, kStatFree); - break; - case kGDXThingCustomDudeLifeLeech: - killDudeLeech(&sprite[nSprite]); - break; + case kThingArmedProxBomb: + case kThingArmedRemoteBomb: + case kModernThingTNTProx: + sprite[nSprite].type = 0; + actPostSprite(sprite[nSprite].xvel, kStatFree); + break; + case kModernThingEnemyLifeLeech: + killDudeLeech(&sprite[nSprite]); + break; } } @@ -926,12 +926,12 @@ bool dudeIsMelee(XSPRITE* pXSprite) { } else { - if (pXSprite->data1 >= 459 && pXSprite->data1 < (459 + kExplodeMax) - 1) + if (pXSprite->data1 >= kTrapExploder && pXSprite->data1 < (kTrapExploder + kExplodeMax) - 1) return true; /*switch (pXSprite->data1) { - case 304: - case 308: + case kMissileFlameSpray: + case kMissileFlameHound: return true; default: return false; @@ -975,9 +975,9 @@ int getDodgeChance(spritetype* pSprite) { 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); return; } @@ -1006,7 +1006,7 @@ void dudeLeechOperate(spritetype* pSprite, XSPRITE* pXSprite, EVENT a3) int dy = Sin(pSprite->ang) >> 16; int tz = pTarget->z - (pTarget->yrepeat * pDudeInfo->aimHeight) * 4; int dz = divscale(tz - top - 256, nDist, 10); - int nMissileType = 316 + (pXSprite->data3 ? 1 : 0); + int nMissileType = kMissileLifeLeechAltNormal + (pXSprite->data3 ? 1 : 0); int t2; if (!pXSprite->data3) t2 = 120 / 10.0; @@ -1017,7 +1017,7 @@ void dudeLeechOperate(spritetype* pSprite, XSPRITE* pXSprite, EVENT a3) { pMissile->owner = pSprite->owner; pXSprite->stateTimer = 1; - evPost(pSprite->index, 3, t2, CALLBACK_ID_20); + evPost(pSprite->index, 3, t2, kCallbackLeechStateTimer); pXSprite->data3 = ClipLow(pXSprite->data3 - 1, 0); } pSprite->ang = angBak; diff --git a/source/blood/src/aizomba.cpp b/source/blood/src/aizomba.cpp index fefd8bf2a..23b67cd4a 100644 --- a/source/blood/src/aizomba.cpp +++ b/source/blood/src/aizomba.cpp @@ -269,7 +269,7 @@ static void myThinkSearch(spritetype *pSprite, XSPRITE *pXSprite) static void entryEZombie(spritetype *pSprite, XSPRITE *pXSprite) { UNREFERENCED_PARAMETER(pXSprite); - pSprite->type = 203; + pSprite->type = kDudeZombieAxeNormal; pSprite->flags |= 1; } diff --git a/source/blood/src/aizombf.cpp b/source/blood/src/aizombf.cpp index c80949d2f..8c099a43d 100644 --- a/source/blood/src/aizombf.cpp +++ b/source/blood/src/aizombf.cpp @@ -75,7 +75,7 @@ static void HackSeqCallback(int, int nXSprite) if (nXSprite < 0 || nXSprite >= kMaxSprites) return; spritetype *pSprite = &sprite[nSprite]; - if (pSprite->type != 204) + if (pSprite->type != kDudeZombieButcher) return; spritetype *pTarget = &sprite[pXSprite->target]; DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase]; @@ -102,7 +102,7 @@ static void PukeSeqCallback(int, int nXSprite) int dx = Cos(nAngle)>>16; int dy = Sin(nAngle)>>16; 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) @@ -110,7 +110,7 @@ static void ThrowSeqCallback(int, int nXSprite) XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; 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) diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index 512033916..7a2bb6d5c 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -222,10 +222,10 @@ void PrecacheDude(spritetype *pSprite) seqPrecacheId(pDudeInfo->seqStartID+2); switch (pSprite->type) { - case 201: - case 202: - case 247: - case 248: + case kDudeCultistTommy: + case kDudeCultistShotgun: + case kDudeCultistTesla: + case kDudeCultistTNT: seqPrecacheId(pDudeInfo->seqStartID+6); seqPrecacheId(pDudeInfo->seqStartID+7); seqPrecacheId(pDudeInfo->seqStartID+8); @@ -234,8 +234,8 @@ void PrecacheDude(spritetype *pSprite) seqPrecacheId(pDudeInfo->seqStartID+14); seqPrecacheId(pDudeInfo->seqStartID+15); break; - case 204: - case 217: + case kDudeZombieButcher: + case kDudeGillBeast: seqPrecacheId(pDudeInfo->seqStartID+6); seqPrecacheId(pDudeInfo->seqStartID+7); seqPrecacheId(pDudeInfo->seqStartID+8); @@ -243,51 +243,51 @@ void PrecacheDude(spritetype *pSprite) seqPrecacheId(pDudeInfo->seqStartID+10); seqPrecacheId(pDudeInfo->seqStartID+11); break; - case 208: - case 209: + case kDudeGargoyleStatueFlesh: + case kDudeGargoyleStatueStone: seqPrecacheId(pDudeInfo->seqStartID+6); seqPrecacheId(pDudeInfo->seqStartID+6); fallthrough__; - case 206: - case 207: + case kDudeGargoyleFlesh: + case kDudeGargoyleStone: seqPrecacheId(pDudeInfo->seqStartID+6); seqPrecacheId(pDudeInfo->seqStartID+7); seqPrecacheId(pDudeInfo->seqStartID+8); seqPrecacheId(pDudeInfo->seqStartID+9); break; - case 210: - case 211: - case 213: - case 214: - case 215: - case 216: - case 229: + case kDudePhantasm: + case kDudeHellHound: + case kDudeSpiderBrown: + case kDudeSpiderRed: + case kDudeSpiderBlack: + case kDudeSpiderMother: + case kDudeTchernobog: seqPrecacheId(pDudeInfo->seqStartID+6); seqPrecacheId(pDudeInfo->seqStartID+7); seqPrecacheId(pDudeInfo->seqStartID+8); break; - case 227: + case kDudeCerberusTwoHead: seqPrecacheId(pDudeInfo->seqStartID+6); seqPrecacheId(pDudeInfo->seqStartID+7); fallthrough__; - case 212: - case 218: - case 219: - case 220: + case kDudeHand: + case kDudeBoneEel: + case kDudeBat: + case kDudeRat: seqPrecacheId(pDudeInfo->seqStartID+6); seqPrecacheId(pDudeInfo->seqStartID+7); break; - case 249: + case kDudeCultistBeast: seqPrecacheId(pDudeInfo->seqStartID+6); break; - case 205: + case kDudeZombieAxeBuried: seqPrecacheId(pDudeInfo->seqStartID+12); seqPrecacheId(pDudeInfo->seqStartID+9); fallthrough__; - case 244: + case kDudeZombieAxeLaying: seqPrecacheId(pDudeInfo->seqStartID+10); fallthrough__; - case 203: + case kDudeZombieAxeNormal: seqPrecacheId(pDudeInfo->seqStartID+6); seqPrecacheId(pDudeInfo->seqStartID+7); seqPrecacheId(pDudeInfo->seqStartID+8); @@ -298,34 +298,33 @@ void PrecacheDude(spritetype *pSprite) } } -void PrecacheThing(spritetype *pSprite) -{ - switch (pSprite->type) - { - case 406: - case 407: - seqPrecacheId(12); - break; - case 410: - seqPrecacheId(15); - break; - case 411: - seqPrecacheId(21); - break; - case 412: - seqPrecacheId(25); - seqPrecacheId(26); - break; - case 413: - seqPrecacheId(38); - seqPrecacheId(40); - seqPrecacheId(28); - break; - case 416: - break; - default: - tilePreloadTile(pSprite->picnum); - break; +void PrecacheThing(spritetype *pSprite) { + switch (pSprite->type) { + case kThingGlassWindow: // worthless... + case kThingFluorescent: + seqPrecacheId(12); + break; + case kThingSpiderWeb: + seqPrecacheId(15); + break; + case kThingMetalGrate: + seqPrecacheId(21); + break; + case kThingFlammableTree: + seqPrecacheId(25); + seqPrecacheId(26); + break; + case kTrapMachinegun: + seqPrecacheId(38); + seqPrecacheId(40); + seqPrecacheId(28); + break; + case kThingObjectGib: + //case kThingObjectExplode: weird that only gib object is precached and this one is not + break; + default: + tilePreloadTile(pSprite->picnum); + break; } seqPrecacheId(3); seqPrecacheId(4); @@ -611,8 +610,8 @@ void StartLevel(GAMEOPTIONS *gameOptions) for (int i = 0; i < kMaxSprites; i++) { spritetype *pSprite = &sprite[i]; - if (pSprite->statnum < kMaxStatus && pSprite->extra > 0) - { + if (pSprite->statnum < kMaxStatus && pSprite->extra > 0) { + XSPRITE *pXSprite = &xsprite[pSprite->extra]; if ((pXSprite->lSkill & (1 << gameOptions->nDifficulty)) || (pXSprite->lS && gameOptions->nGameType == 0) || (pXSprite->lB && gameOptions->nGameType == 2) || (pXSprite->lT && gameOptions->nGameType == 3) @@ -621,12 +620,81 @@ void StartLevel(GAMEOPTIONS *gameOptions) DeleteSprite(i); 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(); 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].y = startpos.y; gStartZone[i].z = startpos.z; @@ -634,7 +702,7 @@ void StartLevel(GAMEOPTIONS *gameOptions) gStartZone[i].ang = startang; // 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].y = startpos.y; gStartZoneTeam1[i].z = startpos.z; diff --git a/source/blood/src/callback.cpp b/source/blood/src/callback.cpp index 98fe055b2..2fae2e4f4 100644 --- a/source/blood/src/callback.cpp +++ b/source/blood/src/callback.cpp @@ -48,99 +48,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 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 -{ - 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 +void fxFlameLick(int nSprite) // 0 { spritetype *pSprite = &sprite[nSprite]; int nXSprite = pSprite->extra; @@ -165,7 +74,7 @@ void FlameLick(int nSprite) // 0 } } if (pXSprite->burnTime > 0) - evPost(nSprite, 3, 5, CALLBACK_ID_0); + evPost(nSprite, 3, 5, kCallbackFXFlameLick); } void Remove(int nSprite) // 1 @@ -190,7 +99,7 @@ void FlareBurst(int nSprite) // 2 pSpawn->picnum = 2424; pSpawn->shade = -128; pSpawn->xrepeat = pSpawn->yrepeat = 32; - pSpawn->type = 303; + pSpawn->type = kMissileFlareAlt; pSpawn->clipdist = 2; pSpawn->owner = pSprite->owner; int nAngle2 = (i<<11)/8; @@ -206,12 +115,12 @@ void FlareBurst(int nSprite) // 2 xvel[pSpawn->index] += dx; yvel[pSpawn->index] += dy; 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 *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); 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 *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); 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); spritetype *pSprite = &sprite[nSprite]; @@ -255,18 +164,18 @@ void ZombieSpurt(int nSprite) // 5 } if (pXSprite->data1 > 0) { - evPost(nSprite, 3, 4, CALLBACK_ID_5); + evPost(nSprite, 3, 4, kCallbackFXZombieSpurt); pXSprite->data1 -= 4; } else if (pXSprite->data2 > 0) { - evPost(nSprite, 3, 60, CALLBACK_ID_5); + evPost(nSprite, 3, 60, kCallbackFXZombieSpurt); pXSprite->data1 = 40; pXSprite->data2--; } } -void BloodSpurt(int nSprite) // 6 +void fxBloodSpurt(int nSprite) // 6 { spritetype *pSprite = &sprite[nSprite]; 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; 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]; if (zvel[nSprite]) @@ -297,7 +221,7 @@ void DynPuff(int nSprite) // 8 zvel[pFX->index] = zvel[nSprite]; } } - evPost(nSprite, 3, 12, CALLBACK_ID_8); + evPost(nSprite, 3, 12, kCallbackFXDynPuff); } void Respawn(int nSprite) // 9 @@ -316,14 +240,14 @@ void Respawn(int nSprite) // 9 { int nTime = mulscale16(actGetRespawnTime(pSprite), 0x4000); pXSprite->respawnPending = 2; - evPost(nSprite, 3, nTime, CALLBACK_ID_9); + evPost(nSprite, 3, nTime, kCallbackRespawn); break; } case 2: { int nTime = mulscale16(actGetRespawnTime(pSprite), 0x2000); pXSprite->respawnPending = 3; - evPost(nSprite, 3, nTime, CALLBACK_ID_9); + evPost(nSprite, 3, nTime, kCallbackRespawn); break; } case 3: @@ -352,10 +276,10 @@ void Respawn(int nSprite) // 9 aiInitSprite(pSprite); pXSprite->key = 0; } - if (pSprite->type == 400) + if (pSprite->type == kThingTNTBarrel) { - pSprite->cstat |= 257; - pSprite->cstat &= (unsigned short)~32768; + pSprite->cstat |= CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN; + pSprite->cstat &= (unsigned short)~CSTAT_SPRITE_INVISIBLE; } gFX.fxSpawn(FX_29, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); sfxPlay3DSound(pSprite, 350, -1, 0); @@ -393,7 +317,7 @@ void PlayerBubble(int nSprite) // 10 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); } } - evPost(nSprite, 3, 4, CALLBACK_ID_11); + evPost(nSprite, 3, 4, kCallbackEnemeyBubble); } void CounterCheck(int nSector) // 12 { dassert(nSector >= 0 && nSector < kMaxSectors); - sectortype *pSector = §or[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 - trTriggerSector(nSector, pXSector, 1); + trTriggerSector(nSector, pXSector, kCmdOn); 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]; int ceilZ, ceilHit, floorZ, floorHit; @@ -482,14 +406,65 @@ void sub_76140(int nSprite) // 14 gFX.sub_73FFC(nSprite); } -void sub_7632C(spritetype *pSprite) + +void fxTeslaAlt(int nSprite) // 15 { - 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) + 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, 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 38: case 39: @@ -501,72 +476,56 @@ void sub_7632C(spritetype *pSprite) pSprite->picnum = 2464; break; } + pSprite->type = 51; 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]; - 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]; + spritetype* pSprite = &sprite[nSprite]; if (pSprite->owner >= 0 && pSprite->owner < kMaxSprites) { - spritetype *pOwner = &sprite[pSprite->owner]; - XSPRITE *pXOwner = &xsprite[pOwner->extra]; - switch (pSprite->type) - { - case 147: - trTriggerSprite(pOwner->index, pXOwner, 1); + spritetype* pOwner = &sprite[pSprite->owner]; + XSPRITE* pXOwner = &xsprite[pOwner->extra]; + switch (pSprite->type) { + case kItemFlagA: + trTriggerSprite(pOwner->index, pXOwner, kCmdOn); sndStartSample(8003, 255, 2, 0); gBlueFlagDropped = false; viewSetMessage("Blue Flag returned to base."); break; - case 148: - trTriggerSprite(pOwner->index, pXOwner, 1); + case kItemFlagB: + trTriggerSprite(pOwner->index, pXOwner, kCmdOn); sndStartSample(8002, 255, 2, 0); gRedFlagDropped = false; viewSetMessage("Red Flag returned to base."); 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]; int ceilZ, ceilHit, floorZ, floorHit; @@ -585,9 +544,9 @@ void sub_766B8(int nSprite) // 19 sfxPlay3DSound(pSprite, 385, nChannel, 1); } 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); if (pFX) pFX->ang = nAngle; @@ -601,38 +560,22 @@ void sub_766B8(int nSprite) // 19 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]; if (pSprite->statnum == kStatThing && !(pSprite->flags & 32)) { switch (pSprite->type) { - case 431: - case kGDXThingCustomDudeLifeLeech: + case kThingDroppedLifeLeech: + case kModernThingEnemyLifeLeech: xsprite[pSprite->extra].stateTimer = 0; break; } } } -void sub_76A08(spritetype *pSprite, spritetype *pSprite2, PLAYER *pPlayer) +void sub_76A08(spritetype *pSprite, spritetype *pSprite2, PLAYER *pPlayer) // ??? { int top, bottom; 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]; int nOwner = actSpriteOwnerToSpriteId(pSprite); if (nOwner < 0 || nOwner >= kMaxSprites) { - evPost(nSprite, 3, 0, CALLBACK_ID_1); + evPost(nSprite, 3, 0, kCallbackRemove); return; } spritetype *pOwner = &sprite[nOwner]; @@ -669,7 +612,7 @@ void sub_76B78(int nSprite) pPlayer = NULL; if (!pPlayer) { - evPost(nSprite, 3, 0, CALLBACK_ID_1); + evPost(nSprite, 3, 0, kCallbackRemove); return; } pSprite->ang = getangle(pOwner->x-pSprite->x, pOwner->y-pSprite->y); @@ -679,7 +622,7 @@ void sub_76B78(int nSprite) XSPRITE *pXSprite = &xsprite[nXSprite]; if (pXSprite->data1 == 0) { - evPost(nSprite, 3, 0, CALLBACK_ID_1); + evPost(nSprite, 3, 0, kCallbackRemove); return; } int nSprite2, nNextSprite; @@ -714,7 +657,7 @@ void sub_76B78(int nSprite) int nDmg = actDamageSprite(nOwner, pSprite2, DAMAGE_TYPE_5, pXSprite->data1<<4); pXSprite->data1 = ClipLow(pXSprite->data1-nDmg, 0); sub_76A08(pSprite2, pSprite, pPlayer2); - evPost(nSprite, 3, 0, CALLBACK_ID_1); + evPost(nSprite, 3, 0, kCallbackRemove); return; } } @@ -723,39 +666,39 @@ void sub_76B78(int nSprite) int vd = 0x2666; switch (pSprite2->type) { - case 218: - case 219: - case 220: - case 250: - case 251: + case kDudeBoneEel: + case kDudeBat: + case kDudeRat: + case kDudeTinyCaleb: + case kDudeBeast: vd = 0x147; break; - case 205: - case 221: - case 222: - case 223: - case 224: - case 225: - case 226: - case 227: - case 228: - case 229: - case 239: - case 240: - case 241: - case 242: - case 243: - case 244: - case 245: - case 252: - case 253: + case kDudeZombieAxeBuried: + case kDudePodGreen: + case kDudeTentacleGreen: + case kDudePodFire: + case kDudeTentacleFire: + case kDudePodMother: + case kDudeTentacleMother: + case kDudeCerberusTwoHead: + case kDudeCerberusOneHead: + case kDudeTchernobog: + case kDudeBurningInnocent: + case kDudeBurningCultist: + case kDudeBurningZombieAxe: + case kDudeBurningZombieButcher: + case kDudeCultistReserved: + case kDudeZombieAxeLaying: + case kDudeInnocent: + case kDudeBurningTinyCaleb: + case kDudeBurningBeast: vd = 0; break; } if (vd && (Chance(vd) || nNextSprite < 0)) { sub_76A08(pSprite2, pSprite, NULL); - evPost(nSprite, 3, 0, CALLBACK_ID_1); + evPost(nSprite, 3, 0, kCallbackRemove); return; } } @@ -763,34 +706,92 @@ void sub_76B78(int nSprite) } } 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) = { - FlameLick, + fxFlameLick, Remove, FlareBurst, - FlareSpark, - FlareSparkLite, - ZombieSpurt, - BloodSpurt, - sub_74C20, - DynPuff, + fxFlareSpark, + fxFlareSparkLite, + fxZombieBloodSpurt, + fxBloodSpurt, + fxArcSpark, + fxDynPuff, Respawn, PlayerBubble, EnemyBubble, CounterCheck, FinishHim, - sub_76140, - sub_74D04, - sub_763BC, - sub_765B8, - sub_768E8, - sub_766B8, - sub_769B4, - sub_76B78, + fxBloodBits, + fxTeslaAlt, + fxBouncingSleeve, + returnFlagToBase, + fxPodBloodSpray, + fxPodBloodSplat, + LeechStateTimer, + DropVoodoo, // unused UniMissileBurst, makeMissileBlocking, }; diff --git a/source/blood/src/callback.h b/source/blood/src/callback.h index e1cb74870..71bb52bb3 100644 --- a/source/blood/src/callback.h +++ b/source/blood/src/callback.h @@ -23,34 +23,35 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #pragma once BEGIN_BLD_NS +void sleeveStopBouncing(spritetype* pSprite); enum CALLBACK_ID { - CALLBACK_ID_NONE = -1, - CALLBACK_ID_0 = 0, - CALLBACK_ID_1, - CALLBACK_ID_2, - CALLBACK_ID_3, - CALLBACK_ID_4, - CALLBACK_ID_5, - CALLBACK_ID_6, - CALLBACK_ID_7, - CALLBACK_ID_8, - CALLBACK_ID_9, - CALLBACK_ID_10, - CALLBACK_ID_11, - CALLBACK_ID_12, - CALLBACK_ID_13, - CALLBACK_ID_14, - CALLBACK_ID_15, - CALLBACK_ID_16, - CALLBACK_ID_17, - CALLBACK_ID_18, - CALLBACK_ID_19, - CALLBACK_ID_20, - CALLBACK_ID_21, - CALLBACK_ID_22, // by NoOne: UniMissileBurst(); - CALLBACK_ID_23, // by NoOne: makeMissileBlocking(); - kCallbackMax + kCallbackNone = -1, + kCallbackFXFlameLick = 0, + kCallbackRemove = 1, + kCallbackFXFlareBurst = 2, + kCallbackFXFlareSpark = 3, + kCallbackFXFlareSparkLite = 4, + kCallbackFXZombieSpurt = 5, + kCallbackFXBloodSpurt = 6, + kCallbackFXArcSpark = 7, + kCallbackFXDynPuff = 8, + kCallbackRespawn = 9, + kCallbackPlayerBubble = 10, + kCallbackEnemeyBubble = 11, + kCallbackCounterCheck = 12, + kCallbackFinishHim = 13, + kCallbackFXBloodBits = 14, + kCallbackFXTeslaAlt = 15, + kCallbackFXBouncingSleeve = 16, + kCallbackReturnFlag = 17, + kCallbackFXPodBloodSpray = 18, + kCallbackFXPodBloodSplat = 19, + kCallbackLeechStateTimer = 20, + kCallbackDropVoodoo = 21, // unused + kCallbackMissileBurst = 22, // by NoOne + kCallbackMissileSpriteBlock = 23, // by NoOne + kCallbackMax = 24 }; extern void (*gCallback[kCallbackMax])(int); diff --git a/source/blood/src/common_game.h b/source/blood/src/common_game.h index b6608d274..389509d26 100644 --- a/source/blood/src/common_game.h +++ b/source/blood/src/common_game.h @@ -77,14 +77,7 @@ void QuitGame(void); #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 @@ -119,26 +112,290 @@ void QuitGame(void); // ------------------------------- #define kMaxPAL 5 -#define kItemBase 100 -#define kWeaponItemBase 40 -#define kItemMax 151 -// marker sprite types -#define kMarkerSPStart 1 -#define kMarkerMPStart 2 -#define kMarkerOff 3 -#define kMarkerOn 4 -#define kMarkerAxis 5 -#define kMarkerLowLink 6 -#define kMarkerUpLink 7 -#define kMarkerWarpDest 8 -#define kMarkerUpWater 9 -#define kMarkerLowWater 10 -#define kMarkerUpStack 11 -#define kMarkerLowStack 12 -#define kMarkerUpGoo 13 -#define kMarkerLowGoo 14 -#define kMarkerPath 15 +// SPRITE TYPES ///////////////////////////////////////////////// +enum { + kSpriteDecoration = 0, + + // markers + kMarkerSPStart = 1, + kMarkerMPStart = 2, + kMarkerOff = 3, + kMarkerOn = 4, + kMarkerAxis = 5, + kMarkerLowLink = 6, + kMarkerUpLink = 7, + kMarkerWarpDest = 8, + kMarkerUpWater = 9, + kMarkerLowWater = 10, + 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 #define kHitagAutoAim 0x0008 @@ -162,21 +419,6 @@ void QuitGame(void); #define kModernTypeFlag2 0x2 #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 #define kSecCParallax 0x01 @@ -189,42 +431,6 @@ void QuitGame(void); #define kSecCRelAlign 0x40 #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 #define kAiStateOther -1 diff --git a/source/blood/src/db.cpp b/source/blood/src/db.cpp index d8f681b48..51eaaee0b 100644 --- a/source/blood/src/db.cpp +++ b/source/blood/src/db.cpp @@ -600,68 +600,37 @@ void dbInit(void) void PropagateMarkerReferences(void) { int nSprite, nNextSprite; - for (nSprite = headspritestat[kStatMarker]; nSprite != -1; nSprite = nNextSprite) - { + for (nSprite = headspritestat[kStatMarker]; nSprite != -1; nSprite = nNextSprite) { + nNextSprite = nextspritestat[nSprite]; - switch (sprite[nSprite].type) - { - case 8: - { - 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; + + switch (sprite[nSprite].type) { + case kMarkerOff: + case kMarkerAxis: + case kMarkerWarpDest: { + int nOwner = sprite[nSprite].owner; + if (nOwner >= 0 && nOwner < numsectors) { + int nXSector = sector[nOwner].extra; + if (nXSector > 0 && nXSector < kMaxXSectors) { + xsector[nXSector].marker0 = nSprite; + 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; } - 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); } } @@ -789,26 +758,28 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short return -1; } byte_1A76C8 = 0; - if ((header.version & 0xff00) == 0x600) - { - } - else if ((header.version & 0xff00) == 0x700) - { + if ((header.version & 0xff00) == 0x700) { 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"); gSysRes.Unlock(pNode); return -1; } + MAPHEADER 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); byte_1A76C7 = 1; } + #if B_BIG_ENDIAN == 1 mapHeader.at0 = B_LITTLE32(mapHeader.at0); 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->decoupled = 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->Push = 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->busyTimeB = bitReader.readUnsigned(12); pXSector->waitTimeB = bitReader.readUnsigned(12); - pXSector->at1b_2 = bitReader.readUnsigned(1); - pXSector->at1b_3 = bitReader.readUnsigned(1); + pXSector->stopOn = bitReader.readUnsigned(1); + pXSector->stopOff = bitReader.readUnsigned(1); pXSector->ceilpal = bitReader.readUnsigned(4); pXSector->at1c_0 = bitReader.readSigned(32); pXSector->at20_0 = bitReader.readSigned(32); pXSector->at24_0 = bitReader.readSigned(32); pXSector->at28_0 = bitReader.readSigned(32); - pXSector->at2c_0 = bitReader.readUnsigned(16); - pXSector->at2e_0 = bitReader.readUnsigned(16); + pXSector->marker0 = bitReader.readUnsigned(16); + pXSector->marker1 = bitReader.readUnsigned(16); pXSector->Crush = bitReader.readUnsigned(1); pXSector->at30_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 // 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; } } @@ -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 // 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; } } @@ -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 // 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; } 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->decoupled, 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->Push, 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->busyTimeB, 12); bitWriter.write(pXSector->waitTimeB, 12); - bitWriter.write(pXSector->at1b_2, 1); - bitWriter.write(pXSector->at1b_3, 1); + bitWriter.write(pXSector->stopOn, 1); + bitWriter.write(pXSector->stopOff, 1); bitWriter.write(pXSector->ceilpal, 4); bitWriter.write(pXSector->at1c_0, 32); bitWriter.write(pXSector->at20_0, 32); bitWriter.write(pXSector->at24_0, 32); bitWriter.write(pXSector->at28_0, 32); - bitWriter.write(pXSector->at2c_0, 16); - bitWriter.write(pXSector->at2e_0, 16); + bitWriter.write(pXSector->marker0, 16); + bitWriter.write(pXSector->marker1, 16); bitWriter.write(pXSector->Crush, 1); bitWriter.write(pXSector->at30_1, 8); bitWriter.write(pXSector->at31_1, 8); diff --git a/source/blood/src/db.h b/source/blood/src/db.h index 2709d60a1..55c525059 100644 --- a/source/blood/src/db.h +++ b/source/blood/src/db.h @@ -110,7 +110,7 @@ struct XSPRITE { struct XSECTOR { signed int reference : 14; - unsigned int state : 1; // State 0 + unsigned int state : 1; // State unsigned int busy : 17; unsigned int data : 16; // Data unsigned int txID : 10; // TX ID @@ -118,7 +118,7 @@ struct XSECTOR { unsigned int at7_2 : 3; // OFF->ON 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 triggerOff : 1; // Send at OFF unsigned int busyTimeA : 12; // OFF->ON busyTime @@ -148,7 +148,7 @@ struct XSECTOR { unsigned int at16_3 : 1; unsigned int decoupled : 1; // Decoupled unsigned int triggerOnce : 1; // 1-shot - unsigned int at16_6 : 1; + unsigned int isTriggered : 1; unsigned int Key : 3; // Key unsigned int Push : 1; // Push unsigned int Vector : 1; // Vector @@ -160,15 +160,15 @@ struct XSECTOR { unsigned int at18_1 : 1; unsigned int busyTimeB : 12; // ON->OFF busyTime unsigned int waitTimeB : 12; // ON->OFF waitTime - unsigned int at1b_2 : 1; - unsigned int at1b_3 : 1; + unsigned int stopOn : 1; + unsigned int stopOff : 1; unsigned int ceilpal : 4; // Ceil pal2 signed int at1c_0 : 32; signed int at20_0 : 32; signed int at24_0 : 32; signed int at28_0 : 32; - unsigned int at2c_0 : 16; - unsigned int at2e_0 : 16; + unsigned int marker0 : 16; + unsigned int marker1 : 16; unsigned int Crush : 1; // Crush unsigned int at30_1 : 8; // Ceiling x panning frac unsigned int at31_1 : 8; // Ceiling y panning frac diff --git a/source/blood/src/endgame.cpp b/source/blood/src/endgame.cpp index c66b72908..a969ce1ed 100644 --- a/source/blood/src/endgame.cpp +++ b/source/blood/src/endgame.cpp @@ -138,22 +138,41 @@ void CKillMgr::sub_263E0(int nCount) at0 += nCount; } -void CKillMgr::AddKill(spritetype *pSprite) -{ - if (pSprite->statnum == kStatDude && pSprite->type != 219 && pSprite->type != 220 && pSprite->type != 245 && pSprite->type != 239) +void CKillMgr::AddKill(spritetype *pSprite) { + if (pSprite->statnum == kStatDude) { + switch (pSprite->type) { + case kDudeBat: + case kDudeRat: + case kDudeBurningInnocent: + case kDudeInnocent: + return; + } + at4++; + } } void CKillMgr::sub_2641C(void) { 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]; if (pSprite->type < kDudeBase || pSprite->type >= kDudeMax) 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++; + } + } } diff --git a/source/blood/src/eventq.cpp b/source/blood/src/eventq.cpp index 94a86be4f..849a2643b 100644 --- a/source/blood/src/eventq.cpp +++ b/source/blood/src/eventq.cpp @@ -68,7 +68,7 @@ void EventQueue::Kill(int a1, int a2) 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)); }); } @@ -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; switch (command) { - case COMMAND_ID_2: - command = evGetSourceState(nType, nIndex) ? COMMAND_ID_1 : COMMAND_ID_0; + case kCmdState: + command = evGetSourceState(nType, nIndex) ? kCmdOn : kCmdOff; break; - case COMMAND_ID_4: - command = evGetSourceState(nType, nIndex) ? COMMAND_ID_0 : COMMAND_ID_1; + case kCmdNotState: + command = evGetSourceState(nType, nIndex) ? kCmdOff : kCmdOn; break; } switch (rxId) { 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); return; case kChannelLevelExitNormal: @@ -385,15 +385,15 @@ void evSend(int nIndex, int nType, int rxId, COMMAND_ID command) return; // By NoOne: finished level and load custom level ¹ via numbered command. 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); return; 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); break; 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); break; 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) { - dassert(command != kCommandCallback); - if (command == COMMAND_ID_2) - command = evGetSourceState(nType, nIndex) ? COMMAND_ID_1 : COMMAND_ID_0; - else if (command == COMMAND_ID_4) - command = evGetSourceState(nType, nIndex) ? COMMAND_ID_0 : COMMAND_ID_1; + dassert(command != kCmdCallback); + if (command == kCmdState) + command = evGetSourceState(nType, nIndex) ? kCmdOn : kCmdOff; + else if (command == kCmdNotState) + command = evGetSourceState(nType, nIndex) ? kCmdOff : kCmdOn; EVENT evn = {}; evn.index = nIndex; evn.type = nType; @@ -487,7 +487,7 @@ void evPost(int nIndex, int nType, unsigned int nDelta, CALLBACK_ID a4) EVENT evn = {}; evn.index = nIndex; evn.type = nType; - evn.cmd = kCommandCallback; + evn.cmd = kCmdCallback; evn.funcID = a4; eventQ.PQueue->Insert((int)gFrameClock+nDelta, evn); } @@ -509,7 +509,7 @@ void evProcess(unsigned int nTime) while(eventQ.IsNotEmpty(nTime)) { EVENT event = eventQ.ERemove(); - if (event.cmd == kCommandCallback) + if (event.cmd == kCmdCallback) { dassert(event.funcID < kCallbackMax); dassert(gCallback[event.funcID] != NULL); diff --git a/source/blood/src/eventq.h b/source/blood/src/eventq.h index 1a36c3202..616a09881 100644 --- a/source/blood/src/eventq.h +++ b/source/blood/src/eventq.h @@ -64,22 +64,43 @@ extern RXBUCKET rxBucket[]; extern unsigned short bucketHead[]; enum COMMAND_ID { - COMMAND_ID_0 = 0, - COMMAND_ID_1, - COMMAND_ID_2, - COMMAND_ID_3, - COMMAND_ID_4, - COMMAND_ID_5, - COMMAND_ID_6, - COMMAND_ID_7, - COMMAND_ID_8, - COMMAND_ID_9, + kCmdOff = 0, + kCmdOn = 1, + kCmdState = 2, + kCmdToggle = 3, + kCmdNotState = 4, + kCmdLink = 5, + kCmdLock = 6, + kCmdUnlock = 7, + kCmdToggleLock = 8, + 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, - COMMAND_ID_21, - kGDXCommandPaste = 53, // used by some new GDX types - COMMAND_ID_64 = 64, - kCommandMapExtend = 100 + kCmdWallPush = 50, + kCmdWallImpact = 51, + kCmdWallTouch = 52, + + 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 { diff --git a/source/blood/src/fx.cpp b/source/blood/src/fx.cpp index 7ec464a55..57e281662 100644 --- a/source/blood/src/fx.cpp +++ b/source/blood/src/fx.cpp @@ -60,63 +60,63 @@ struct FXDATA { }; FXDATA gFXData[] = { - { CALLBACK_ID_NONE, 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 }, - { CALLBACK_ID_NONE, 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 }, - { CALLBACK_ID_NONE, 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 }, - { CALLBACK_ID_NONE, 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 }, - { CALLBACK_ID_NONE, 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 }, - { CALLBACK_ID_NONE, 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 }, - { CALLBACK_ID_NONE, 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 }, - { CALLBACK_ID_NONE, 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 }, - { CALLBACK_ID_NONE, 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 }, - { CALLBACK_ID_NONE, 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 }, - { CALLBACK_ID_NONE, 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 }, - { CALLBACK_ID_NONE, 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 - { CALLBACK_ID_NONE, 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 - { CALLBACK_ID_NONE, 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 }, - { CALLBACK_ID_NONE, 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 }, - { CALLBACK_ID_NONE, 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 }, - { CALLBACK_ID_NONE, 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 }, - { CALLBACK_ID_NONE, 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 }, - { CALLBACK_ID_NONE, 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 }, - { CALLBACK_ID_16, 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 }, - { CALLBACK_ID_16, 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 }, - { CALLBACK_ID_16, 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 }, - { CALLBACK_ID_NONE, 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 }, - { CALLBACK_ID_NONE, 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 }, - { CALLBACK_ID_NONE, 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 }, - { CALLBACK_ID_NONE, 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 }, - { CALLBACK_ID_NONE, 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 }, - { CALLBACK_ID_19, 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 }, - { CALLBACK_ID_NONE, 1, 70, 1, -13981, 5120, 0, 0, 0, 0, 0, 0, 0 } + { kCallbackNone, 0, 49, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackNone, 0, 50, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackNone, 0, 51, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackNone, 0, 52, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackNone, 0, 7, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackNone, 0, 44, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackNone, 0, 45, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackNone, 0, 46, 1, -128, 8192, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackNone, 2, 6, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackNone, 2, 42, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackNone, 2, 43, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackNone, 1, 48, 3, -256, 8192, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackNone, 1, 60, 3, -256, 8192, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackFXBloodBits, 2, 0, 1, 46603, 2048, 480, 2154, 40, 40, 0, -12, 0 }, + { kCallbackNone, 2, 0, 3, 46603, 5120, 480, 2269, 24, 24, 0, -128, 0 }, + { kCallbackNone, 2, 0, 3, 46603, 5120, 480, 1720, 24, 24, 0, -128, 0 }, + { kCallbackNone, 1, 0, 1, 58254, 3072, 480, 2280, 48, 48, 0, -128, 0 }, + { kCallbackNone, 1, 0, 1, 58254, 3072, 480, 3135, 48, 48, 0, -128, 0 }, + { kCallbackNone, 0, 0, 3, 58254, 1024, 480, 3261, 32, 32, 0, 0, 0 }, + { kCallbackNone, 1, 0, 3, 58254, 1024, 480, 3265, 32, 32, 0, 0, 0 }, + { kCallbackNone, 1, 0, 3, 58254, 1024, 480, 3269, 32, 32, 0, 0, 0 }, + { kCallbackNone, 1, 0, 3, 58254, 1024, 480, 3273, 32, 32, 0, 0, 0 }, + { kCallbackNone, 1, 0, 3, 58254, 1024, 480, 3277, 32, 32, 0, 0, 0 }, + { kCallbackNone, 2, 0, 1, -27962, 8192, 600, 1128, 16, 16, 514, -16, 0 }, // bubble 1 + { kCallbackNone, 2, 0, 1, -18641, 8192, 600, 1128, 12, 12, 514, -16, 0 }, // bubble 2 + { kCallbackNone, 2, 0, 1, -9320, 8192, 600, 1128, 8, 8, 514, -16, 0 }, // bubble 3 + { kCallbackNone, 2, 0, 1, -18641, 8192, 600, 1131, 32, 32, 514, -16, 0 }, + { kCallbackFXBloodBits, 2, 0, 3, 27962, 4096, 480, 733, 32, 32, 0, -16, 0 }, + { kCallbackNone, 1, 0, 3, 18641, 4096, 120, 2261, 12, 12, 0, -128, 0 }, + { kCallbackNone, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackNone, 1, 0, 3, 58254, 3328, 480, 2185, 48, 48, 0, 0, 0 }, + { kCallbackNone, 0, 0, 3, 58254, 1024, 480, 2620, 48, 48, 0, 0, 0 }, + { kCallbackNone, 1, 55, 1, -13981, 5120, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackNone, 1, 56, 1, -13981, 5120, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackNone, 1, 57, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackNone, 1, 58, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackNone, 2, 0, 0, 0, 0, 960, 956, 32, 32, 610, 0, 0 }, + { kCallbackFXBouncingSleeve, 2, 62, 0, 46603, 1024, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackFXBouncingSleeve, 2, 63, 0, 46603, 1024, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackFXBouncingSleeve, 2, 64, 0, 46603, 1024, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackFXBouncingSleeve, 2, 65, 0, 46603, 1024, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackFXBouncingSleeve, 2, 66, 0, 46603, 1024, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackFXBouncingSleeve, 2, 67, 0, 46603, 1024, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackNone, 1, 0, 3, 0, 0, 0, 838, 16, 16, 80, -8, 0 }, + { kCallbackNone, 0, 0, 3, 34952, 8192, 0, 2078, 64, 64, 0, -8, 0 }, + { kCallbackNone, 0, 0, 3, 34952, 8192, 0, 1106, 64, 64, 0, -8, 0 }, + { kCallbackNone, 0, 0, 3, 58254, 3328, 480, 2406, 48, 48, 0, 0, 0 }, + { kCallbackNone, 1, 0, 3, 46603, 4096, 480, 3511, 64, 64, 0, -128, 0 }, + { kCallbackNone, 0, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackNone, 2, 11, 3, -256, 8192, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackNone, 2, 11, 3, 0, 8192, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackNone, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { kCallbackNone, 1, 30, 3, 0, 0, 0, 0, 40, 40, 80, -8, 0 }, + { kCallbackFXPodBloodSplat, 2, 0, 3, 27962, 4096, 480, 4023, 32, 32, 0, -16, 0 }, + { kCallbackFXPodBloodSplat, 2, 0, 3, 27962, 4096, 480, 4028, 32, 32, 0, -16, 0 }, + { kCallbackNone, 2, 0, 0, 0, 0, 480, 926, 32, 32, 610, -12, 0 }, + { kCallbackNone, 1, 70, 1, -13981, 5120, 0, 0, 0, 0, 0, 0, 0 } }; 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) a6 = pFX->ate; 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; } @@ -288,7 +288,7 @@ void fxSpawnBlood(spritetype *pSprite, int a2) xvel[pBlood->index] = Random2(0x6aaaa); yvel[pBlood->index] = Random2(0x6aaaa); 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) return; spritetype *pSpawn; - if (pSprite->type == 221) + if (pSprite->type == kDudePodGreen) pSpawn = gFX.fxSpawn(FX_53, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); else 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); yvel[pSpawn->index] = Random2(0x6aaaa); zvel[pSpawn->index] = -Random(0x10aaaa)-100; - evPost(pSpawn->index, 3, 8, CALLBACK_ID_18); + evPost(pSpawn->index, 3, 8, kCallbackFXPodBloodSpray); } } diff --git a/source/blood/src/gib.cpp b/source/blood/src/gib.cpp index ef12fe531..b2751894f 100644 --- a/source/blood/src/gib.cpp +++ b/source/blood/src/gib.cpp @@ -363,11 +363,10 @@ void GibFX(spritetype *pSprite, GIBFX *pGFX, CGibPosition *pPos, CGibVelocity *p void GibThing(spritetype *pSprite, GIBTHING *pGThing, CGibPosition *pPos, CGibVelocity *pVel) { if (gbAdultContent && gGameOptions.nGameType <= 0) - switch (pGThing->at0) - { - case 425: - case 427: - return; + switch (pGThing->at0) { + case kThingBloodBits: + case kThingZombieHead: + return; } if (pGThing->chance == 65536 || Chance(pGThing->chance)) diff --git a/source/blood/src/messages.cpp b/source/blood/src/messages.cpp index 7a7812afb..d3ca8a8b1 100644 --- a/source/blood/src/messages.cpp +++ b/source/blood/src/messages.cpp @@ -787,7 +787,7 @@ void CCheatMgr::Process(CCheatMgr::CHEATCODE nCheatCode, char* pzArgs) case kCheatMcGee: { 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); viewSetMessage("You're fired!"); break; @@ -801,7 +801,7 @@ void CCheatMgr::Process(CCheatMgr::CHEATCODE nCheatCode, char* pzArgs) actHealDude(gMe->pXSprite, 200, 200); gMe->at33e[1] = VanillaMode() ? 200 : 3200; 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); viewSetMessage("Flame retardant!"); break; diff --git a/source/blood/src/mirrors.cpp b/source/blood/src/mirrors.cpp index ef5ad55bc..a74c36a1c 100644 --- a/source/blood/src/mirrors.cpp +++ b/source/blood/src/mirrors.cpp @@ -100,7 +100,7 @@ void InitMirrors(void) int nTile = 4080+mirrorcnt; 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; mirror[mirrorcnt].at14 = i; @@ -112,7 +112,7 @@ void InitMirrors(void) { if (j == i) continue; - if (wall[j].extra > 0 && GetWallType(i) == 501) + if (wall[j].extra > 0 && GetWallType(i) == kWallStack) { if (tmp != xwall[wall[j].extra].data) 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].ceilingz = sector[nSector].ceilingz; int cx, cy, ca; - if (GetWallType(nWall) == 501) + if (GetWallType(nWall) == kWallStack) { cx = x - (wall[pWall->hitag].x-wall[pWall->point2].x); 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); viewProcessSprites(cx,cy,z,fix16_to_int(ca),smooth); renderDrawMasks(); - if (GetWallType(nWall) != 501) + if (GetWallType(nWall) != kWallStack) renderCompleteMirror(); if (wall[nWall].pal != 0 || wall[nWall].shade != 0) TranslateMirrorColors(wall[nWall].shade, wall[nWall].pal); diff --git a/source/blood/src/player.cpp b/source/blood/src/player.cpp index 270a1caec..ee50c6bc0 100644 --- a/source/blood/src/player.cpp +++ b/source/blood/src/player.cpp @@ -473,55 +473,57 @@ char powerupActivate(PLAYER *pPlayer, int nPowerUp) int nPack = powerupToPackItem(nPowerUp); if (nPack >= 0) pPlayer->packInfo[nPack].at0 = 1; - switch (nPowerUp+100) - { - case kGDXItemMapLevel: - gFullMap = true; - break; - case 130: - if (isGrown(pPlayer->pSprite)) deactivateSizeShrooms(pPlayer); - else shrinkPlayerSize(pPlayer, 2); - break; - case 129: - if (isShrinked(pPlayer->pSprite)) deactivateSizeShrooms(pPlayer); - else { - growPlayerSize(pPlayer, 2); - if (powerupCheck(&gPlayer[pPlayer->pSprite->type - kDudePlayer1], 13) > 0) { - powerupDeactivate(pPlayer, 13); - pPlayer->at202[13] = 0; - } + + switch (nPowerUp + kItemBase) { + case kItemModernMapLevel: + if (gModernMap) gFullMap = true; + break; + case kItemShroomShrink: + if (!gModernMap) break; + else if (isGrown(pPlayer->pSprite)) deactivateSizeShrooms(pPlayer); + else shrinkPlayerSize(pPlayer, 2); + break; + case kItemShroomGrow: + if (!gModernMap) break; + else if (isShrinked(pPlayer->pSprite)) deactivateSizeShrooms(pPlayer); + else { + growPlayerSize(pPlayer, 2); + if (powerupCheck(&gPlayer[pPlayer->pSprite->type - kDudePlayer1], 13) > 0) { + powerupDeactivate(pPlayer, 13); + pPlayer->at202[13] = 0; + } - if (ceilIsTooLow(pPlayer->pSprite)) - actDamageSprite(pPlayer->pSprite->xvel, pPlayer->pSprite, DAMAGE_TYPE_3, 65535); - } - break; - case 112: - case 115: // jump boots - pPlayer->ata1[0]++; - break; - case 124: // reflective shots - if (pPlayer == gMe && gGameOptions.nGameType == 0) - sfxSetReverb2(1); - break; - case 114: // death mask - for (int i = 0; i < 7; i++) - pPlayer->ata1[i]++; - break; - case 118: // diving suit - pPlayer->ata1[4]++; - if (pPlayer == gMe && gGameOptions.nGameType == 0) - sfxSetReverb(1); - break; - case 119: - pPlayer->ata1[4]++; - break; - case 139: - pPlayer->ata1[1]++; - break; - case 117: // guns akimbo - pPlayer->atc.newWeapon = pPlayer->atbd; - WeaponRaise(pPlayer); - break; + if (ceilIsTooLow(pPlayer->pSprite)) + actDamageSprite(pPlayer->pSprite->xvel, pPlayer->pSprite, DAMAGE_TYPE_3, 65535); + } + break; + case kItemFeatherFall: + case kItemJumpBoots: + pPlayer->ata1[0]++; + break; + case kItemReflectShots: // reflective shots + if (pPlayer == gMe && gGameOptions.nGameType == 0) + sfxSetReverb2(1); + break; + case kItemDeathMask: + for (int i = 0; i < 7; i++) + pPlayer->ata1[i]++; + break; + case kItemDivingSuit: // diving suit + pPlayer->ata1[4]++; + if (pPlayer == gMe && gGameOptions.nGameType == 0) + sfxSetReverb(1); + break; + case kItemGasMask: + pPlayer->ata1[4]++; + break; + case kItemArmorAsbest: + pPlayer->ata1[1]++; + break; + case kItemTwoGuns: + pPlayer->atc.newWeapon = pPlayer->atbd; + WeaponRaise(pPlayer); + break; } sfxPlay3DSound(pPlayer->pSprite, 776, -1, 0); return 1; @@ -532,43 +534,45 @@ void powerupDeactivate(PLAYER *pPlayer, int nPowerUp) int nPack = powerupToPackItem(nPowerUp); if (nPack >= 0) pPlayer->packInfo[nPack].at0 = 0; - switch (nPowerUp+100) - { - case 130: - resetPlayerSize(pPlayer); - if (ceilIsTooLow(pPlayer->pSprite)) - actDamageSprite(pPlayer->pSprite->xvel, pPlayer->pSprite, DAMAGE_TYPE_3, 65535); - break; - case 129: - resetPlayerSize(pPlayer); - break; - case 112: - case 115: // jump boots - pPlayer->ata1[0]--; - break; - case 114: // death mask - for (int i = 0; i < 7; i++) - pPlayer->ata1[i]--; - break; - case 118: // diving suit - pPlayer->ata1[4]--; - if (pPlayer == gMe && VanillaMode() ? true : pPlayer->at202[24] == 0) - sfxSetReverb(0); - break; - case 124: // reflective shots - if (pPlayer == gMe && VanillaMode() ? true : pPlayer->packInfo[1].at0 == 0) - sfxSetReverb(0); - break; - case 119: - pPlayer->ata1[4]--; - break; - case 139: - pPlayer->ata1[1]--; - break; - case 117: // guns akimbo - pPlayer->atc.newWeapon = pPlayer->atbd; - WeaponRaise(pPlayer); - break; + + switch (nPowerUp + kItemBase) { + case kItemShroomShrink: + if (gModernMap) { + resetPlayerSize(pPlayer); + if (ceilIsTooLow(pPlayer->pSprite)) + actDamageSprite(pPlayer->pSprite->xvel, pPlayer->pSprite, DAMAGE_TYPE_3, 65535); + } + break; + case kItemShroomGrow: + if (gModernMap) resetPlayerSize(pPlayer); + break; + case kItemFeatherFall: + case kItemJumpBoots: + pPlayer->ata1[0]--; + break; + case kItemDeathMask: + for (int i = 0; i < 7; i++) + pPlayer->ata1[i]--; + break; + case kItemDivingSuit: + pPlayer->ata1[4]--; + if (pPlayer == gMe && VanillaMode() ? true : pPlayer->at202[24] == 0) + sfxSetReverb(0); + break; + case kItemReflectShots: + if (pPlayer == gMe && VanillaMode() ? true : pPlayer->packInfo[1].at0 == 0) + sfxSetReverb(0); + break; + case kItemGasMask: + pPlayer->ata1[4]--; + break; + case kItemArmorAsbest: + pPlayer->ata1[1]--; + break; + case kItemTwoGuns: + pPlayer->atc.newWeapon = pPlayer->atbd; + WeaponRaise(pPlayer); + break; } } @@ -1061,79 +1065,67 @@ char sub_3A158(PLAYER *a1, spritetype *a2) if (a2 && a2->index == nSprite) continue; 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 0; } -char PickupItem(PLAYER *pPlayer, spritetype *pItem) -{ - char buffer[80]; - int pickupSnd = 775; - spritetype *pSprite = pPlayer->pSprite; - XSPRITE *pXSprite = pPlayer->pXSprite; - int nType = pItem->type - 100; - switch (pItem->type) - { - //case 129: - //dudeInfo[31].seqStartID = 13568; - //if (!powerupActivate(pPlayer, nType)) - //return 0; - //return 1; - case 113: - if (isGrown(pPlayer->pSprite)) return false; - case 130: - case 129: - switch (pItem->type) { - case 130: - if (isShrinked(pSprite)) return false; +char PickupItem(PLAYER *pPlayer, spritetype *pItem) { + + spritetype *pSprite = pPlayer->pSprite; XSPRITE *pXSprite = pPlayer->pXSprite; + char buffer[80]; int pickupSnd = 775; int nType = pItem->type - kItemBase; + + switch (pItem->type) { + case kItemShadowCloak: + if (isGrown(pPlayer->pSprite)) return false; + case kItemShroomShrink: + case kItemShroomGrow: + if (gModernMap) { + switch (pItem->type) { + case kItemShroomShrink: + if (isShrinked(pSprite)) return false; + break; + case kItemShroomGrow: + if (isGrown(pSprite)) return false; + break; + } + powerupActivate(pPlayer, nType); + } break; - case 129: - if (isGrown(pSprite)) return false; - break; - } - powerupActivate(pPlayer, nType); - break; - case 145: - 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) - { + case kItemFlagABase: + case kItemFlagBBase: { + if (gGameOptions.nGameType != 3 || pItem->extra <= 0) return 0; + XSPRITE * pXItem = &xsprite[pItem->extra]; + if (pItem->type == kItemFlagABase) { + if (pPlayer->at2ea == 1) { + if ((pPlayer->at90 & 1) == 0 && pXItem->state) { pPlayer->at90 |= 1; 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); sndStartSample(8007, 255, 2, 0); viewSetMessage(buffer); } } - if (pPlayer->at2ea == 0) - { - if ((pPlayer->at90&1) != 0 && !pXItem->state) - { + + if (pPlayer->at2ea == 0) { + + if ((pPlayer->at90 & 1) != 0 && !pXItem->state) { pPlayer->at90 &= ~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); sndStartSample(8003, 255, 2, 0); viewSetMessage(buffer); } - if ((pPlayer->at90&2) != 0 && pXItem->state) - { + + if ((pPlayer->at90 & 2) != 0 && pXItem->state) { pPlayer->at90 &= ~2; pPlayer->at91[1] = -1; dword_21EFB0[pPlayer->at2ea] += 10; 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); sndStartSample(8001, 255, 2, 0); viewSetMessage(buffer); @@ -1146,39 +1138,38 @@ char PickupItem(PLAYER *pPlayer, spritetype *pItem) #endif } } + } - else if (pItem->type == 146) - { - if (pPlayer->at2ea == 0) - { - if((pPlayer->at90&2) == 0 && pXItem->state) - { + else if (pItem->type == kItemFlagBBase) { + + if (pPlayer->at2ea == 0) { + if ((pPlayer->at90 & 2) == 0 && pXItem->state) { pPlayer->at90 |= 2; 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); sndStartSample(8006, 255, 2, 0); viewSetMessage(buffer); } } - if (pPlayer->at2ea == 1) - { - if ((pPlayer->at90&2) != 0 && !pXItem->state) + + if (pPlayer->at2ea == 1) { + if ((pPlayer->at90 & 2) != 0 && !pXItem->state) { pPlayer->at90 &= ~2; pPlayer->at91[1] = -1; - trTriggerSprite(pItem->index, pXItem, 1); + trTriggerSprite(pItem->index, pXItem, kCmdOn); sprintf(buffer, "%s returned Red Flag", gProfile[pPlayer->at57].name); sndStartSample(8002, 255, 2, 0); viewSetMessage(buffer); } - if ((pPlayer->at90&1) != 0 && pXItem->state) + if ((pPlayer->at90 & 1) != 0 && pXItem->state) { pPlayer->at90 &= ~1; pPlayer->at91[0] = -1; dword_21EFB0[pPlayer->at2ea] += 10; 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); sndStartSample(8000, 255, 2, 0); viewSetMessage(buffer); @@ -1194,135 +1185,119 @@ char PickupItem(PLAYER *pPlayer, spritetype *pItem) } } return 0; - case 147: - if (gGameOptions.nGameType != 3) - return 0; - evKill(pItem->index, 3, CALLBACK_ID_17); - pPlayer->at90 |= 1; - pPlayer->at91[0] = pItem->index; - gBlueFlagDropped = false; - break; - case 148: - if (gGameOptions.nGameType != 3) - return 0; - evKill(pItem->index, 3, CALLBACK_ID_17); - pPlayer->at90 |= 2; - pPlayer->at91[1] = pItem->index; - gRedFlagDropped = false; - break; - case 140: - case 141: - case 142: - case 143: - case 144: - { - ARMORDATA *pArmorData = &armorData[pItem->type-140]; - char va = 0; - if (pPlayer->at33e[1] < pArmorData->atc) - { - pPlayer->at33e[1] = ClipHigh(pPlayer->at33e[1]+pArmorData->at8, pArmorData->atc); - va = 1; + case kItemFlagA: + if (gGameOptions.nGameType != 3) return 0; + evKill(pItem->index, 3, kCallbackReturnFlag); + pPlayer->at90 |= 1; + pPlayer->at91[0] = pItem->index; + gBlueFlagDropped = false; + break; + case kItemFlagB: + if (gGameOptions.nGameType != 3) return 0; + evKill(pItem->index, 3, kCallbackReturnFlag); + pPlayer->at90 |= 2; + pPlayer->at91[1] = pItem->index; + gRedFlagDropped = false; + break; + case kItemArmorBasic: + case kItemArmorBody: + case kItemArmorFire: + case kItemArmorSpirit: + case kItemArmorSuper: { + ARMORDATA *pArmorData = &armorData[pItem->type - kItemArmorBasic]; bool pickedUp = false; + if (pPlayer->at33e[1] < pArmorData->atc) { + pPlayer->at33e[1] = ClipHigh(pPlayer->at33e[1]+pArmorData->at8, pArmorData->atc); + pickedUp = true; + } + + if (pPlayer->at33e[0] < pArmorData->at4) { + pPlayer->at33e[0] = ClipHigh(pPlayer->at33e[0]+pArmorData->at0, pArmorData->at4); + 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) - { - pPlayer->at33e[0] = ClipHigh(pPlayer->at33e[0]+pArmorData->at0, pArmorData->at4); - va = 1; + case kItemCrystalBall: + if (gGameOptions.nGameType == 0 || !packAddItem(pPlayer, gItemData[nType].at8)) return 0; + break; + 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) - { - pPlayer->at33e[2] = ClipHigh(pPlayer->at33e[2]+pArmorData->at10, pArmorData->at14); - va = 1; - } - if (!va) - return 0; - pickupSnd = 779; - break; - } - 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; + case kItemHealthDoctorBag: + case kItemJumpBoots: + case kItemDivingSuit: + case kItemBeastVision: + 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); return 1; } -char PickupAmmo(PLAYER* pPlayer, spritetype* pAmmo) -{ - AMMOITEMDATA* pAmmoItemData = &gAmmoItemData[pAmmo->type - 60]; +char PickupAmmo(PLAYER* pPlayer, spritetype* pAmmo) { + AMMOITEMDATA* pAmmoItemData = &gAmmoItemData[pAmmo->type - kItemAmmoBase]; int nAmmoType = pAmmoItemData->ata; 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); // by NoOne: allow custom amount for item else pPlayer->at181[nAmmoType] = ClipHigh(pPlayer->at181[nAmmoType] + xsprite[pAmmo->extra].data1, gAmmoInfo[nAmmoType].at0); - if (pAmmoItemData->atb) - pPlayer->atcb[pAmmoItemData->atb] = 1; + if (pAmmoItemData->atb) pPlayer->atcb[pAmmoItemData->atb] = 1; sfxPlay3DSound(pPlayer->pSprite, 782, -1, 0); return 1; } -char PickupWeapon(PLAYER *pPlayer, spritetype *pWeapon) -{ - WEAPONITEMDATA *pWeaponItemData = &gWeaponItemData[pWeapon->type-40]; +char PickupWeapon(PLAYER *pPlayer, spritetype *pWeapon) { + WEAPONITEMDATA *pWeaponItemData = &gWeaponItemData[pWeapon->type - kItemWeaponBase]; int nWeaponType = pWeaponItemData->at8; int nAmmoType = pWeaponItemData->ata; - if (!pPlayer->atcb[nWeaponType] || gGameOptions.nWeaponSettings == 2 || gGameOptions.nWeaponSettings == 3) - { - if (pWeapon->type == 50 && gGameOptions.nGameType > 1 && sub_3A158(pPlayer, NULL)) + if (!pPlayer->atcb[nWeaponType] || gGameOptions.nWeaponSettings == 2 || gGameOptions.nWeaponSettings == 3) { + if (pWeapon->type == kItemWeaponLifeLeech && gGameOptions.nGameType > 1 && sub_3A158(pPlayer, NULL)) return 0; pPlayer->atcb[nWeaponType] = 1; if (nAmmoType == -1) return 0; // 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); else pPlayer->at181[nAmmoType] = ClipHigh(pPlayer->at181[nAmmoType] + xsprite[pWeapon->extra].data1, gAmmoInfo[nAmmoType].at0); int nNewWeapon = WeaponUpgrade(pPlayer, nWeaponType); - if (nNewWeapon != pPlayer->atbd) - { + if (nNewWeapon != pPlayer->atbd) { pPlayer->atc3 = 0; 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; - 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); else 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; char pickedUp = 0; 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); 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); - if (pickedUp && customMsg == -1) sprintf(buffer, "Picked up %s", gAmmoText[nType - 60]); - } - else if (nType >= 40 && nType < 51) - { + if (pickedUp && customMsg == -1) sprintf(buffer, "Picked up %s", gAmmoText[nType - kItemAmmoBase]); + + } else if (nType >= kItemWeaponBase && nType < kItemWeaponMax) { 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 (pSprite->extra > 0) - { - XSPRITE *pXSprite = &xsprite[pSprite->extra]; - if (pXSprite->Pickup) - trTriggerSprite(pSprite->index, pXSprite, 32); - } - if (!actCheckRespawn(pSprite)) - actPostSprite(pSprite->index, kStatFree); - pPlayer->at377 = 30; - if (pPlayer == gMe) - if (customMsg > 0) trTextOver(customMsg - 1); - else viewSetMessage(buffer, 0, MESSAGE_PRIORITY_PICKUP); + if (!pickedUp) return; + else if (pSprite->extra > 0) { + XSPRITE *pXSprite = &xsprite[pSprite->extra]; + if (pXSprite->Pickup) + trTriggerSprite(pSprite->index, pXSprite, kCmdSpritePickup); + } + + if (!actCheckRespawn(pSprite)) + actPostSprite(pSprite->index, kStatFree); + + pPlayer->at377 = 30; + if (pPlayer == gMe) { + if (customMsg > 0) trTextOver(customMsg - 1); + else viewSetMessage(buffer, 0, MESSAGE_PRIORITY_PICKUP); } } @@ -1392,8 +1366,7 @@ void CheckPickUp(PLAYER *pPlayer) int z = pSprite->z; int nSector = pSprite->sectnum; int nNextSprite; - for (int nSprite = headspritestat[kStatItem]; nSprite >= 0; nSprite = nNextSprite) - { + for (int nSprite = headspritestat[kStatItem]; nSprite >= 0; nSprite = nNextSprite) { spritetype *pItem = &sprite[nSprite]; nNextSprite = nextspritestat[nSprite]; if (pItem->flags&32) @@ -1444,7 +1417,7 @@ int ActionScan(PLAYER *pPlayer, int *a2, int *a3) { spritetype *pSprite = &sprite[*a2]; XSPRITE *pXSprite = &xsprite[*a3]; - if (pSprite->type == 431) + if (pSprite->type == kThingDroppedLifeLeech) { if (gGameOptions.nGameType > 1 && sub_3A158(pPlayer, pSprite)) return -1; @@ -1467,7 +1440,7 @@ int ActionScan(PLAYER *pPlayer, int *a2, int *a3) zvel[*a2] += mulscale16(z, t2); } if (pXSprite->Push && !pXSprite->state && !pXSprite->isTriggered) - trTriggerSprite(*a2, pXSprite, 30); + trTriggerSprite(*a2, pXSprite, kCmdSpritePush); } break; case 0: @@ -1541,7 +1514,7 @@ void ProcessInput(PLAYER *pPlayer) else if (seqGetStatus(3, pPlayer->pSprite->extra) < 0) { if (pPlayer->pSprite) - pPlayer->pSprite->type = 426; + pPlayer->pSprite->type = kThingBloodChunks; actPostSprite(pPlayer->at5b, kStatThing); seqSpawn(pPlayer->pDudeInfo->seqStartID+15, 3, pPlayer->pSprite->extra, -1); playerReset(pPlayer); @@ -1682,7 +1655,7 @@ void ProcessInput(PLAYER *pPlayer) sndStartSample(3062, 255, 2, 0); } if (!key || pPlayer->at88[key]) - trTriggerSector(a2, pXSector, 30); + trTriggerSector(a2, pXSector, kCmdSpritePush); else if (pPlayer == gMe) { viewSetMessage("That requires a key."); @@ -1700,7 +1673,7 @@ void ProcessInput(PLAYER *pPlayer) sndStartSample(3062, 255, 2, 0); } if (!key || pPlayer->at88[key]) - trTriggerWall(a2, pXWall, 50); + trTriggerWall(a2, pXWall, kCmdWallPush); else if (pPlayer == gMe) { viewSetMessage("That requires a key."); @@ -1715,7 +1688,7 @@ void ProcessInput(PLAYER *pPlayer) if (pXSprite->locked && pPlayer == gMe && pXSprite->lockMsg) trTextOver(pXSprite->lockMsg); if (!key || pPlayer->at88[key]) - trTriggerSprite(a2, pXSprite, 30); + trTriggerSprite(a2, pXSprite, kCmdSpritePush); else if (pPlayer == gMe) { viewSetMessage("That requires a key."); @@ -1728,7 +1701,7 @@ void ProcessInput(PLAYER *pPlayer) pPlayer->at372 = ClipLow(pPlayer->at372-4*(6-gGameOptions.nDifficulty), 0); 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; int nSprite = pPlayer->pSprite->index; int x = Cos(pPlayer->pSprite->ang)>>16; @@ -2087,16 +2060,16 @@ void FragPlayer(PLAYER *pPlayer, int nSprite) if (nTeam1 == 0) { if (nTeam1 != nTeam2) - evSend(0, 0, 15, COMMAND_ID_3); + evSend(0, 0, 15, kCmdToggle); else - evSend(0, 0, 16, COMMAND_ID_3); + evSend(0, 0, 16, kCmdToggle); } else { if (nTeam1 == nTeam2) - evSend(0, 0, 16, COMMAND_ID_3); + evSend(0, 0, 16, kCmdToggle); 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; switch (a2) { - case 147: + case kItemFlagA: pPlayer->at90 &= ~1; - pSprite = actDropObject(pPlayer->pSprite, 147); + pSprite = actDropObject(pPlayer->pSprite, kItemFlagA); if (pSprite) pSprite->owner = pPlayer->at91[0]; gBlueFlagDropped = true; @@ -2138,9 +2111,9 @@ spritetype *sub_40A94(PLAYER *pPlayer, int a2) sndStartSample(8005, 255, 2, 0); viewSetMessage(buffer); break; - case 148: + case kItemFlagB: pPlayer->at90 &= ~2; - pSprite = actDropObject(pPlayer->pSprite, 148); + pSprite = actDropObject(pPlayer->pSprite, kItemFlagB); if (pSprite) pSprite->owner = pPlayer->at91[1]; gRedFlagDropped = true; @@ -2226,12 +2199,9 @@ int playerDamageSprite(int nSource, PLAYER *pPlayer, DAMAGE_TYPE nDamageType, in return nDamage; } sfxKill3DSound(pPlayer->pSprite, -1, 441); - if (gGameOptions.nGameType == 3 && pPlayer->at90) - { - if (pPlayer->at90&1) - sub_40A94(pPlayer, 147); - if (pPlayer->at90&2) - sub_40A94(pPlayer, 148); + if (gGameOptions.nGameType == 3 && pPlayer->at90) { + if (pPlayer->at90&1) sub_40A94(pPlayer, kItemFlagA); + if (pPlayer->at90&2) sub_40A94(pPlayer, kItemFlagB); } pPlayer->at1fe = 0; pPlayer->at1b1 = 0; @@ -2265,7 +2235,7 @@ int playerDamageSprite(int nSource, PLAYER *pPlayer, DAMAGE_TYPE nDamageType, in nKneelingPlayer = nPlayerKneelClient; powerupActivate(pPlayer, 28); pXSprite->target = nSource; - evPost(pSprite->index, 3, 15, CALLBACK_ID_13); + evPost(pSprite->index, 3, 15, kCallbackFinishHim); } else { @@ -2281,7 +2251,7 @@ int playerDamageSprite(int nSource, PLAYER *pPlayer, DAMAGE_TYPE nDamageType, in { powerupClear(pPlayer); if (nXSector > 0 && xsector[nXSector].Exit) - trTriggerSector(pSprite->sectnum, &xsector[nXSector], 43); + trTriggerSector(pSprite->sectnum, &xsector[nXSector], kCmdSectorExit); pSprite->flags |= 7; 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; } FragPlayer(pPlayer, nSource); - trTriggerSprite(nSprite, pXSprite, 0); + trTriggerSprite(nSprite, pXSprite, kCmdOff); } dassert(gSysRes.Lookup(pDudeInfo->seqStartID + nDeathSeqID, "SEQ") != NULL); seqSpawn(pDudeInfo->seqStartID+nDeathSeqID, 3, nXSprite, nKneelingPlayer); diff --git a/source/blood/src/seq.cpp b/source/blood/src/seq.cpp index 99023194e..82caf18c4 100644 --- a/source/blood/src/seq.cpp +++ b/source/blood/src/seq.cpp @@ -510,8 +510,8 @@ void seqProcess(int a1) int nSprite = xsprite[nXSprite].reference; dassert(nSprite >= 0 && nSprite < kMaxSprites); evKill(nSprite, 3); - if ((sprite[nSprite].flags & 16) && sprite[nSprite].inittype >= 200 && sprite[nSprite].inittype < 254) - evPost(nSprite, 3, gGameOptions.nMonsterSettings, (COMMAND_ID)9); + if ((sprite[nSprite].flags & 16) && sprite[nSprite].inittype >= kDudeBase && sprite[nSprite].inittype < kDudeMax) + evPost(nSprite, 3, gGameOptions.nMonsterSettings, kCallbackRespawn); else DeleteSprite(nSprite); break; diff --git a/source/blood/src/triggers.cpp b/source/blood/src/triggers.cpp index 720cfbf7c..769cdc6c3 100644 --- a/source/blood/src/triggers.cpp +++ b/source/blood/src/triggers.cpp @@ -93,16 +93,16 @@ char SetSpriteState(int nSprite, XSPRITE* pXSprite, int nState) if ((sprite[nSprite].flags & 16) != 0 && sprite[nSprite].inittype >= kDudeBase && sprite[nSprite].inittype < kDudeMax) { pXSprite->respawnPending = 3; - evPost(nSprite, 3, gGameOptions.nMonsterRespawnTime, CALLBACK_ID_9); + evPost(nSprite, 3, gGameOptions.nMonsterRespawnTime, kCallbackRespawn); return 1; } if (pXSprite->restState != nState && pXSprite->waitTime > 0) - evPost(nSprite, 3, (pXSprite->waitTime * 120) / 10, pXSprite->restState ? COMMAND_ID_1 : COMMAND_ID_0); + evPost(nSprite, 3, (pXSprite->waitTime * 120) / 10, pXSprite->restState ? kCmdOn : kCmdOff); if (pXSprite->txID) { - if (pXSprite->command != 5 && pXSprite->triggerOn && pXSprite->state) + if (pXSprite->command != kCmdLink && pXSprite->triggerOn && pXSprite->state) evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); - if (pXSprite->command != 5 && pXSprite->triggerOff && !pXSprite->state) + if (pXSprite->command != kCmdLink && pXSprite->triggerOff && !pXSprite->state) evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); } return 1; @@ -118,27 +118,27 @@ char modernTypeSetSpriteState(int nSprite, XSPRITE *pXSprite, int nState) if ((sprite[nSprite].flags & 16) != 0 && sprite[nSprite].inittype >= kDudeBase && sprite[nSprite].inittype < kDudeMax) { pXSprite->respawnPending = 3; - evPost(nSprite, 3, gGameOptions.nMonsterRespawnTime, CALLBACK_ID_9); + evPost(nSprite, 3, gGameOptions.nMonsterRespawnTime, kCallbackRespawn); return 1; } if (pXSprite->restState != nState && pXSprite->waitTime > 0) - evPost(nSprite, 3, (pXSprite->waitTime*120) / 10, pXSprite->restState ? COMMAND_ID_1 : COMMAND_ID_0); + evPost(nSprite, 3, (pXSprite->waitTime*120) / 10, pXSprite->restState ? kCmdOn : kCmdOff); if (pXSprite->txID != 0 && ((pXSprite->triggerOn && pXSprite->state) || (pXSprite->triggerOff && !pXSprite->state))) { // by NoOne: Sending new command instead of link is *required*, because types above //are universal and can paste properties in different objects. switch (pXSprite->command) { - case COMMAND_ID_5: - case kGDXCommandPaste: - evSend(nSprite, 3, pXSprite->txID, kGDXCommandPaste); // just send command to change properties + case kCmdLink: + case kCmdModernUse: + evSend(nSprite, 3, pXSprite->txID, kCmdModernUse); // just send command to change properties return 1; - case COMMAND_ID_7: + case kCmdUnlock: evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); // send normal command first - evSend(nSprite, 3, pXSprite->txID, kGDXCommandPaste); // then send command to change properties + evSend(nSprite, 3, pXSprite->txID, kCmdModernUse); // then send command to change properties return 1; default: - evSend(nSprite, 3, pXSprite->txID, kGDXCommandPaste); // send first command to change properties + evSend(nSprite, 3, pXSprite->txID, kCmdModernUse); // send first command to change properties evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); // then send normal command return 1; } @@ -155,12 +155,12 @@ char SetWallState(int nWall, XWALL *pXWall, int nState) pXWall->state = nState; evKill(nWall, 0); if (pXWall->restState != nState && pXWall->waitTime > 0) - evPost(nWall, 0, (pXWall->waitTime*120) / 10, pXWall->restState ? COMMAND_ID_1 : COMMAND_ID_0); + evPost(nWall, 0, (pXWall->waitTime*120) / 10, pXWall->restState ? kCmdOn : kCmdOff); if (pXWall->txID) { - if (pXWall->command != 5 && pXWall->triggerOn && pXWall->state) + if (pXWall->command != kCmdLink && pXWall->triggerOn && pXWall->state) evSend(nWall, 0, pXWall->txID, (COMMAND_ID)pXWall->command); - if (pXWall->command != 5 && pXWall->triggerOff && !pXWall->state) + if (pXWall->command != kCmdLink && pXWall->triggerOff && !pXWall->state) evSend(nWall, 0, pXWall->txID, (COMMAND_ID)pXWall->command); } return 1; @@ -175,27 +175,27 @@ char SetSectorState(int nSector, XSECTOR *pXSector, int nState) evKill(nSector, 6); if (nState == 1) { - if (pXSector->command != 5 && pXSector->triggerOn && pXSector->txID) + if (pXSector->command != kCmdLink && pXSector->triggerOn && pXSector->txID) evSend(nSector, 6, pXSector->txID, (COMMAND_ID)pXSector->command); - if (pXSector->at1b_2) + if (pXSector->stopOn) { - pXSector->at1b_2 = 0; - pXSector->at1b_3 = 0; + pXSector->stopOn = 0; + pXSector->stopOff = 0; } else if (pXSector->atf_6) - evPost(nSector, 6, (pXSector->waitTimeA * 120) / 10, COMMAND_ID_0); + evPost(nSector, 6, (pXSector->waitTimeA * 120) / 10, kCmdOff); } else { - if (pXSector->command != 5 && pXSector->triggerOff && pXSector->txID) + if (pXSector->command != kCmdLink && pXSector->triggerOff && pXSector->txID) evSend(nSector, 6, pXSector->txID, (COMMAND_ID)pXSector->command); - if (pXSector->at1b_3) + if (pXSector->stopOff) { - pXSector->at1b_2 = 0; - pXSector->at1b_3 = 0; + pXSector->stopOn = 0; + pXSector->stopOff = 0; } else if (pXSector->atf_7) - evPost(nSector, 6, (pXSector->waitTimeB * 120) / 10, COMMAND_ID_1); + evPost(nSector, 6, (pXSector->waitTimeB * 120) / 10, kCmdOn); } return 1; } @@ -283,11 +283,10 @@ unsigned int GetSourceBusy(EVENT a1) return 0; } -void sub_43CF8(spritetype *pSprite, XSPRITE *pXSprite, EVENT a3) +void LifeLeechOperate(spritetype *pSprite, XSPRITE *pXSprite, EVENT event) { - switch (a3.cmd) - { - case 30: + switch (event.cmd) { + case kCmdSpritePush: { int nPlayer = pXSprite->data4; if (nPlayer >= 0 && nPlayer < gNetPlayers) @@ -307,7 +306,7 @@ void sub_43CF8(spritetype *pSprite, XSPRITE *pXSprite, EVENT a3) } break; } - case 35: + case kCmdSpriteProximity: { int nTarget = pXSprite->target; if (nTarget >= 0 && nTarget < kMaxSprites) @@ -337,7 +336,7 @@ void sub_43CF8(spritetype *pSprite, XSPRITE *pXSprite, EVENT a3) int dy = Sin(pSprite->ang)>>16; int tz = pTarget->z - (pTarget->yrepeat * pDudeInfo->aimHeight) * 4; int dz = divscale(tz - top - 256, nDist, 10); - int nMissileType = 316+(pXSprite->data3 ? 1 : 0); + int nMissileType = kMissileLifeLeechAltNormal + (pXSprite->data3 ? 1 : 0); int t2; if (!pXSprite->data3) t2 = 120 / 10.0; @@ -348,7 +347,7 @@ void sub_43CF8(spritetype *pSprite, XSPRITE *pXSprite, EVENT a3) { pMissile->owner = pSprite->owner; pXSprite->stateTimer = 1; - evPost(pSprite->index, 3, t2, CALLBACK_ID_20); + evPost(pSprite->index, 3, t2, kCallbackLeechStateTimer); pXSprite->data3 = ClipLow(pXSprite->data3-1, 0); } pSprite->ang = angBak; @@ -364,416 +363,618 @@ void sub_43CF8(spritetype *pSprite, XSPRITE *pXSprite, EVENT a3) void ActivateGenerator(int); -void OperateSprite(int nSprite, XSPRITE *pXSprite, EVENT a3) +void OperateSprite(int nSprite, XSPRITE *pXSprite, EVENT event) { spritetype *pSprite = &sprite[nSprite]; - switch (a3.cmd) - { - case 6: - pXSprite->locked = 1; - switch (pSprite->type) { - case kGDXWindGenerator: - stopWindOnSectors(pXSprite); - break; - } - return; - case 7: - pXSprite->locked = 0; - return; - case 8: - pXSprite->locked = pXSprite->locked ^ 1; - switch(pSprite->type) { - case kGDXWindGenerator: - if (pXSprite->locked == 1) stopWindOnSectors(pXSprite); - break; - } - return; - } - if (pSprite->statnum == kStatDude && pSprite->type >= kDudeBase && pSprite->type < kDudeMax) - { - switch (a3.cmd) - { - case 0: - SetSpriteState(nSprite, pXSprite, 0); - break; - case 35: - if (pXSprite->state) - break; - fallthrough__; - case 1: - case 30: - case 33: - if (!pXSprite->state) - SetSpriteState(nSprite, pXSprite, 1); - aiActivateDude(pSprite, pXSprite); - break; - } - return; - } - switch (pSprite->type) - { - /* - Random Event Switch takes random data field and uses it as TX ID - */ - /* - ranged TX ID is now supported also - */ - case kGDXRandomTX: - { - std::default_random_engine rng; int tx = 0; int maxRetries = 10; - // set range of TX ID if data2 and data3 is empty. - if (pXSprite->data1 > 0 && pXSprite->data2 <= 0 && pXSprite->data3 <= 0 && pXSprite->data4 > 0) { - - // data1 must be less than data4 - if (pXSprite->data1 > pXSprite->data4) { - short tmp = pXSprite->data1; - pXSprite->data1 = (short) pXSprite->data4; - pXSprite->data4 = tmp; - } - - int total = pXSprite->data4 - pXSprite->data1; - while (maxRetries > 0) { - - // use true random only for single player mode - // otherwise use Blood's default one. In the future it maybe possible to make - // host send info to clients about what was generated. - - if (gGameOptions.nGameType != 0 || VanillaMode() || DemoRecordStatus()) tx = Random(total) + pXSprite->data1; - else { - rng.seed(std::random_device()()); - tx = (int)my_random(pXSprite->data1, pXSprite->data4); - } - - if (tx != pXSprite->txID) break; - maxRetries--; - } - - } else { - while (maxRetries > 0) { - if ((tx = GetRandDataVal(NULL, pSprite)) > 0 && tx != pXSprite->txID) break; - maxRetries--; - } - } - - if (tx > 0) { - pXSprite->txID = tx; - SetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1); - } - break; - } - /* - Sequential Switch takes values from data fields starting from data1 and uses it as TX ID - */ - /* - ranged TX ID is now supported also - */ - case kGDXSequentialTX: - { - bool range = false; int cnt = 3; int tx = 0; - // set range of TX ID if data2 and data3 is empty. - if (pXSprite->data1 > 0 && pXSprite->data2 <= 0 && pXSprite->data3 <= 0 && pXSprite->data4 > 0) { - - // data1 must be less than data4 - if (pXSprite->data1 > pXSprite->data4) { - short tmp = pXSprite->data1; - pXSprite->data1 = (short) pXSprite->data4; - pXSprite->data4 = tmp; - } - - // force send command to all TX id in a range - if (pSprite->flags & kModernTypeFlag1) { - for (pXSprite->txID = pXSprite->data1; pXSprite->txID <= pXSprite->data4; pXSprite->txID++) { - if (pXSprite->txID > 0) - evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); - } - - pXSprite->txID = pXSprite->sysData1 = 0; - return; - } - - // Make sure txIndex is correct as we store current index of TX ID here. - if (pXSprite->sysData1 < pXSprite->data1) pXSprite->sysData1 = pXSprite->data1; - else if (pXSprite->sysData1 > pXSprite->data4) pXSprite->sysData1 = pXSprite->data4; - - range = true; - - } else { - - // force send command to all TX id specified in data - if (pSprite->flags & kModernTypeFlag1) { - for (int i = 0; i <= 3; i++) { - if ((pXSprite->txID = GetDataVal(pSprite, i)) > 0) - evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); - } - - pXSprite->txID = pXSprite->sysData1 = 0; - return; - } - - // Make sure txIndex is correct as we store current index of data field here. - if (pXSprite->sysData1 > 3) pXSprite->sysData1 = 0; - else if (pXSprite->sysData1 < 0) pXSprite->sysData1 = 3; - - } - - switch (a3.cmd) { - case COMMAND_ID_0: - if (range == false) { - while (cnt-- >= 0) { // skip empty data fields - pXSprite->sysData1--; - if (pXSprite->sysData1 < 0) pXSprite->sysData1 = 3; - tx = GetDataVal(pSprite, pXSprite->sysData1); - if (tx < 0) ThrowError(" -- Current data index is negative"); - if (tx > 0) break; - continue; - } - } else { - pXSprite->sysData1--; - if (pXSprite->sysData1 < pXSprite->data1) { - pXSprite->sysData1 = pXSprite->data4; - } - tx = pXSprite->sysData1; + if (gModernMap) { + switch (event.cmd) { + case kCmdUnlock: + case kCmdToggleLock: + switch (pSprite->type) { + case kModernWindGenerator: + if (pXSprite->locked) stopWindOnSectors(pXSprite); + break; } break; + } + } - default: - if (range == false) { - while (cnt-- >= 0) { // skip empty data fields - if (pXSprite->sysData1 > 3) pXSprite->sysData1 = 0; - tx = GetDataVal(pSprite, pXSprite->sysData1); - if (tx < 0) ThrowError(" ++ Current data index is negative"); - pXSprite->sysData1++; - if (tx > 0) break; - continue; + switch (event.cmd) { + case kCmdLock: + pXSprite->locked = 1; + return; + case kCmdUnlock: + pXSprite->locked = 0; + return; + case kCmdToggleLock: + pXSprite->locked = pXSprite->locked ^ 1; + return; + } + + if (gModernMap) { + switch (pSprite->type) { + + // add linking for path markers and stacks feature + case kMarkerLowWater: + case kMarkerUpWater: + case kMarkerUpGoo: + case kMarkerLowGoo: + case kMarkerUpLink: + case kMarkerLowLink: + case kMarkerUpStack: + case kMarkerLowStack: + case kMarkerPath: + switch (pXSprite->command) { + case kCmdLink: + if (pXSprite->txID <= 0) return; + evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); + return; + } + break; // go normal operate switch + + // Random Event Switch takes random data field and uses it as TX ID + case kModernRandomTX: { + std::default_random_engine rng; int tx = 0; int maxRetries = 10; + // set range of TX ID if data2 and data3 is empty. + if (pXSprite->data1 > 0 && pXSprite->data2 <= 0 && pXSprite->data3 <= 0 && pXSprite->data4 > 0) { + + // data1 must be less than data4 + if (pXSprite->data1 > pXSprite->data4) { + short tmp = pXSprite->data1; + pXSprite->data1 = (short)pXSprite->data4; + pXSprite->data4 = tmp; } + + int total = pXSprite->data4 - pXSprite->data1; + while (maxRetries > 0) { + + // use true random only for single player mode + // otherwise use Blood's default one. In the future it maybe possible to make + // host send info to clients about what was generated. + + if (gGameOptions.nGameType != 0 || VanillaMode() || DemoRecordStatus()) tx = Random(total) + pXSprite->data1; + else { + rng.seed(std::random_device()()); + tx = (int)my_random(pXSprite->data1, pXSprite->data4); + } + + if (tx != pXSprite->txID) break; + maxRetries--; + } + } else { - tx = pXSprite->sysData1; - if (pXSprite->sysData1 >= pXSprite->data4) { - pXSprite->sysData1 = pXSprite->data1; + while (maxRetries > 0) { + if ((tx = GetRandDataVal(NULL, pSprite)) > 0 && tx != pXSprite->txID) break; + maxRetries--; + } + } + + if (tx > 0) { + pXSprite->txID = tx; + SetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1); + } + } + return; + + // Sequential Switch takes values from data fields starting from data1 and uses it as TX ID + case kModernSequentialTX: { + bool range = false; int cnt = 3; int tx = 0; + // set range of TX ID if data2 and data3 is empty. + if (pXSprite->data1 > 0 && pXSprite->data2 <= 0 && pXSprite->data3 <= 0 && pXSprite->data4 > 0) { + + // data1 must be less than data4 + if (pXSprite->data1 > pXSprite->data4) { + short tmp = pXSprite->data1; + pXSprite->data1 = (short)pXSprite->data4; + pXSprite->data4 = tmp; + } + + // force send command to all TX id in a range + if (pSprite->flags & kModernTypeFlag1) { + for (pXSprite->txID = pXSprite->data1; pXSprite->txID <= pXSprite->data4; pXSprite->txID++) { + if (pXSprite->txID > 0) + evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); + } + + pXSprite->txID = pXSprite->sysData1 = 0; + return; + } + + // Make sure txIndex is correct as we store current index of TX ID here. + if (pXSprite->sysData1 < pXSprite->data1) pXSprite->sysData1 = pXSprite->data1; + else if (pXSprite->sysData1 > pXSprite->data4) pXSprite->sysData1 = pXSprite->data4; + + range = true; + + } else { + + // force send command to all TX id specified in data + if (pSprite->flags & kModernTypeFlag1) { + for (int i = 0; i <= 3; i++) { + if ((pXSprite->txID = GetDataVal(pSprite, i)) > 0) + evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); + } + + pXSprite->txID = pXSprite->sysData1 = 0; + return; + } + + // Make sure txIndex is correct as we store current index of data field here. + if (pXSprite->sysData1 > 3) pXSprite->sysData1 = 0; + else if (pXSprite->sysData1 < 0) pXSprite->sysData1 = 3; + + } + + switch (event.cmd) { + case kCmdOff: + if (range == false) { + while (cnt-- >= 0) { // skip empty data fields + pXSprite->sysData1--; + if (pXSprite->sysData1 < 0) pXSprite->sysData1 = 3; + tx = GetDataVal(pSprite, pXSprite->sysData1); + if (tx < 0) ThrowError(" -- Current data index is negative"); + if (tx > 0) break; + continue; + } + } else { + pXSprite->sysData1--; + if (pXSprite->sysData1 < pXSprite->data1) { + pXSprite->sysData1 = pXSprite->data4; + } + tx = pXSprite->sysData1; + } + break; + default: + if (range == false) { + while (cnt-- >= 0) { // skip empty data fields + if (pXSprite->sysData1 > 3) pXSprite->sysData1 = 0; + tx = GetDataVal(pSprite, pXSprite->sysData1); + if (tx < 0) ThrowError(" ++ Current data index is negative"); + pXSprite->sysData1++; + if (tx > 0) break; + continue; + } + } else { + tx = pXSprite->sysData1; + if (pXSprite->sysData1 >= pXSprite->data4) { + pXSprite->sysData1 = pXSprite->data1; + break; + } + pXSprite->sysData1++; + } + break; + } + + pXSprite->txID = tx; + SetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1); + } + return; + + case kMarkerWarpDest: + if (pXSprite->txID <= 0) { + if (SetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1) == 1) + useTeleportTarget(pXSprite, NULL); + return; + } + modernTypeSetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1); + return; + + case kModernSpriteDamager: + if (pXSprite->txID <= 0) { + if (SetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1) == 1) + useSpriteDamager(pXSprite, NULL); + return; + } + modernTypeSetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1); + return; + + case kModernObjPropertiesChanger: + if (pXSprite->txID <= 0) { + if (SetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1) == 1) + usePropertiesChanger(pXSprite, -1, -1); + return; + } + modernTypeSetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1); + return; + + case kModernObjPicnumChanger: + case kModernObjSizeChanger: + case kModernSectorFXChanger: + case kModernObjDataChanger: + case kModernConcussSprite: + modernTypeSetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1); + return; + + case kModernCustomDudeSpawn: + if (gGameOptions.nMonsterSettings && actSpawnCustomDude(pSprite, -1) != NULL) + gKillMgr.sub_263E0(1); + return; + + case kModernSeqSpawner: + case kModernEffectSpawner: + switch (event.cmd) { + case kCmdOff: + if (pXSprite->state == 1) SetSpriteState(nSprite, pXSprite, 0); + break; + case kCmdOn: + evKill(nSprite, 3); // queue overflow protect + if (pXSprite->state == 0) SetSpriteState(nSprite, pXSprite, 1); + fallthrough__; + case kCmdRepeat: + if (pXSprite->txID <= 0) + (pSprite->type == kModernSeqSpawner) ? useSeqSpawnerGen(pXSprite, 3, pSprite->xvel) : useEffectGen(pXSprite, NULL); + else { + + switch (pXSprite->command) { + case kCmdLink: + evSend(nSprite, 3, pXSprite->txID, kCmdModernUse); // just send command to change properties + break; + case kCmdUnlock: + evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); // send normal command first + evSend(nSprite, 3, pXSprite->txID, kCmdModernUse); // then send command to change properties + break; + default: + evSend(nSprite, 3, pXSprite->txID, kCmdModernUse); // send first command to change properties + evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); // then send normal command + break; + } + + } + + if (pXSprite->busyTime > 0) + evPost(nSprite, 3, ClipLow((int(pXSprite->busyTime) + Random2(pXSprite->data1)) * 120 / 10, 0), kCmdRepeat); + break; + default: + if (pXSprite->state == 0) evPost(nSprite, 3, 0, kCmdOn); + else evPost(nSprite, 3, 0, kCmdOff); + break; + } + return; + + case kModernWindGenerator: + switch (event.cmd) { + case kCmdOff: + stopWindOnSectors(pXSprite); + if (pXSprite->state == 1) SetSpriteState(nSprite, pXSprite, 0); + break; + case kCmdOn: + evKill(nSprite, 3); // queue overflow protect + if (pXSprite->state == 0) SetSpriteState(nSprite, pXSprite, 1); + fallthrough__; + case kCmdRepeat: + if (pXSprite->txID <= 0) useSectorWindGen(pXSprite, NULL); + else { + + switch (pXSprite->command) { + case kCmdLink: + evSend(nSprite, 3, pXSprite->txID, kCmdModernUse); // just send command to change properties + break; + case kCmdUnlock: + evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); // send normal command first + evSend(nSprite, 3, pXSprite->txID, kCmdModernUse); // then send command to change properties + break; + default: + evSend(nSprite, 3, pXSprite->txID, kCmdModernUse); // send first command to change properties + evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); // then send normal command + break; + } + + } + + if (pXSprite->busyTime > 0) evPost(nSprite, 3, pXSprite->busyTime, kCmdRepeat); + break; + default: + if (pXSprite->state == 0) evPost(nSprite, 3, 0, kCmdOn); + else evPost(nSprite, 3, 0, kCmdOff); + break; + } + return; + + case kModernDudeTargetChanger: { + + // this one is required if data4 of generator was dynamically changed + // it turns monsters in normal idle state instead of genIdle, so they + // not ignore the world. + bool activated = false; + if (pXSprite->dropMsg == 3 && 3 != pXSprite->data4) { + activateDudes(pXSprite->txID); + activated = true; + } + + switch (event.cmd) { + case kCmdOff: + if (pXSprite->data4 == 3 && activated == false) activateDudes(pXSprite->txID); + if (pXSprite->state == 1) SetSpriteState(nSprite, pXSprite, 0); + break; + case kCmdOn: + evKill(nSprite, 3); // queue overflow protect + if (pXSprite->state == 0) SetSpriteState(nSprite, pXSprite, 1); + fallthrough__; + case kCmdRepeat: + if (pXSprite->txID <= 0 || !getDudesForTargetChg(pXSprite)) { + freeAllTargets(pXSprite); + evPost(nSprite, 3, 0, kCmdOff); + break; + } + else { + + switch (pXSprite->command) { + case kCmdLink: + evSend(nSprite, 3, pXSprite->txID, kCmdModernUse); // just send command to change properties + break; + case kCmdUnlock: + evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); // send normal command first + evSend(nSprite, 3, pXSprite->txID, kCmdModernUse); // then send command to change properties + break; + default: + evSend(nSprite, 3, pXSprite->txID, kCmdModernUse); // send first command to change properties + evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); // then send normal command + break; + } + + } + + if (pXSprite->busyTime > 0) evPost(nSprite, 3, pXSprite->busyTime, kCmdRepeat); + break; + default: + if (pXSprite->state == 0) evPost(nSprite, 3, 0, kCmdOn); + else evPost(nSprite, 3, 0, kCmdOff); break; } - pXSprite->sysData1++; + + pXSprite->dropMsg = (short)pXSprite->data4; + } + return; + + case kModernObjDataAccumulator: + switch (event.cmd) { + case kCmdOff: + if (pXSprite->state == 1) SetSpriteState(nSprite, pXSprite, 0); + break; + case kCmdOn: + evKill(nSprite, 3); // queue overflow protect + if (pXSprite->state == 0) SetSpriteState(nSprite, pXSprite, 1); + fallthrough__; + case kCmdRepeat: + + // force OFF after *all* TX objects reach the goal value + if (pSprite->flags == 0 && goalValueIsReached(pXSprite)) { + evPost(nSprite, 3, 0, kCmdOff); + break; + } + + if (pXSprite->txID > 0 && pXSprite->data1 > 0 && pXSprite->data1 <= 4) { + + switch (pXSprite->command) { + case kCmdLink: + evSend(nSprite, 3, pXSprite->txID, kCmdModernUse); // just send command to change properties + break; + case kCmdUnlock: + evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); // send normal command first + evSend(nSprite, 3, pXSprite->txID, kCmdModernUse); // then send command to change properties + break; + default: + evSend(nSprite, 3, pXSprite->txID, kCmdModernUse); // send first command to change properties + evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); // then send normal command + break; + } + + if (pXSprite->busyTime > 0) evPost(nSprite, 3, pXSprite->busyTime, kCmdRepeat); + } + break; + default: + if (pXSprite->state == 0) evPost(nSprite, 3, 0, kCmdOn); + else evPost(nSprite, 3, 0, kCmdOff); + break; } + return; + + case kModernRandom: + case kModernRandom2: + switch (event.cmd) { + case kCmdOff: + if (pXSprite->state == 1) SetSpriteState(nSprite, pXSprite, 0); + break; + case kCmdOn: + evKill(nSprite, 3); // queue overflow protect + if (pXSprite->state == 0) SetSpriteState(nSprite, pXSprite, 1); + fallthrough__; + case kCmdRepeat: + ActivateGenerator(nSprite); + if (pXSprite->busyTime > 0) + evPost(nSprite, 3, (120 * pXSprite->busyTime) / 10, kCmdRepeat); + break; + default: + if (pXSprite->state == 0) evPost(nSprite, 3, 0, kCmdOn); + else evPost(nSprite, 3, 0, kCmdOff); + break; + } + return; + + case kModernThingEnemyLifeLeech: + dudeLeechOperate(pSprite, pXSprite, event); + return; + + case kGenModernMissileUniversal: + switch (event.cmd) { + case kCmdOff: + if (pXSprite->state == 1) SetSpriteState(nSprite, pXSprite, 0); + break; + case kCmdOn: + evKill(nSprite, 3); // queue overflow protect + if (pXSprite->state == 0) SetSpriteState(nSprite, pXSprite, 1); + fallthrough__; + case kCmdRepeat: + ActivateGenerator(nSprite); + if (pXSprite->txID) evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); + if (pXSprite->busyTime > 0) evPost(nSprite, 3, (120 * pXSprite->busyTime) / 10, kCmdRepeat); + break; + default: + if (pXSprite->state == 0) evPost(nSprite, 3, 0, kCmdOn); + else evPost(nSprite, 3, 0, kCmdOff); + break; + } + return; + } + } + + if (pSprite->statnum == kStatDude && pSprite->type >= kDudeBase && pSprite->type < kDudeMax) { + switch (event.cmd) { + case kCmdOff: + SetSpriteState(nSprite, pXSprite, 0); + break; + case kCmdSpriteProximity: + if (pXSprite->state) break; + fallthrough__; + case kCmdOn: + case kCmdSpritePush: + case kCmdSpriteTouch: + if (!pXSprite->state) SetSpriteState(nSprite, pXSprite, 1); + aiActivateDude(pSprite, pXSprite); + break; + default: + return; + } + } + + + switch (pSprite->type) { + case kTrapMachinegun: + if (pXSprite->health <= 0) break; + switch (event.cmd) { + case kCmdOff: + if (!SetSpriteState(nSprite, pXSprite, 0)) break; + seqSpawn(40, 3, pSprite->extra, -1); + break; + case kCmdOn: + if (!SetSpriteState(nSprite, pXSprite, 1)) break; + seqSpawn(38, 3, pSprite->extra, nMGunOpenClient); + if (pXSprite->data1 > 0) + pXSprite->data2 = pXSprite->data1; break; } - - pXSprite->txID = tx; - SetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1); - } - break; - case 413: - if (pXSprite->health > 0) - { - if (a3.cmd == 1) - { - if (SetSpriteState(nSprite, pXSprite, 1)) - { - seqSpawn(38, 3, pSprite->extra, nMGunOpenClient); - if (pXSprite->data1 > 0) - pXSprite->data2 = pXSprite->data1; - } - } - else if (a3.cmd == 0) - { - if (SetSpriteState(nSprite, pXSprite, 0)) - seqSpawn(40, 3, pSprite->extra, -1); - } - } break; - case 414: + case kThingFallingRock: if (SetSpriteState(nSprite, pXSprite, 1)) pSprite->flags |= 7; break; - case 408: + case kThingWallCrack: if (SetSpriteState(nSprite, pXSprite, 0)) actPostSprite(nSprite, kStatFree); break; - case 405: + case kThingCrateFace: if (SetSpriteState(nSprite, pXSprite, 0)) actPostSprite(nSprite, kStatFree); break; - case 456: - switch (a3.cmd) - { - case 0: - pXSprite->state = 0; - pSprite->cstat |= 32768; - pSprite->cstat &= ~1; - break; - case 1: - pXSprite->state = 1; - pSprite->cstat &= (unsigned short)~32768; - pSprite->cstat |= 1; - break; - case 3: - pXSprite->state ^= 1; - pSprite->cstat ^= 32768; - pSprite->cstat ^= 1; - break; + case kTrapZapSwitchable: + switch (event.cmd) { + case kCmdOff: + pXSprite->state = 0; + pSprite->cstat |= CSTAT_SPRITE_INVISIBLE; + pSprite->cstat &= ~CSTAT_SPRITE_BLOCK; + break; + case kCmdOn: + pXSprite->state = 1; + pSprite->cstat &= (unsigned short)~CSTAT_SPRITE_INVISIBLE; + pSprite->cstat |= CSTAT_SPRITE_BLOCK; + break; + case kCmdToggle: + pXSprite->state ^= 1; + pSprite->cstat ^= CSTAT_SPRITE_INVISIBLE; + pSprite->cstat ^= CSTAT_SPRITE_BLOCK; + break; } break; - case 452: - if (a3.cmd == 1) - { - if (SetSpriteState(nSprite, pXSprite, 1)) - { - seqSpawn(38, 3, pSprite->extra, -1); - sfxPlay3DSound(pSprite, 441, 0, 0); - } - } - else if (a3.cmd == 0) - { - if (SetSpriteState(nSprite, pXSprite, 0)) - { + case kTrapFlame: + switch (event.cmd) { + case kCmdOff: + if (!SetSpriteState(nSprite, pXSprite, 0)) break; seqSpawn(40, 3, pSprite->extra, -1); sfxKill3DSound(pSprite, 0, -1); - } + break; + case kCmdOn: + if (SetSpriteState(nSprite, pXSprite, 1)) break; + seqSpawn(38, 3, pSprite->extra, -1); + sfxPlay3DSound(pSprite, 441, 0, 0); + break; } break; - case 23: - switch (a3.cmd) - { - case 0: - SetSpriteState(nSprite, pXSprite, 0); - break; - case 1: - if (SetSpriteState(nSprite, pXSprite, 1)) - seqSpawn(37, 3, pSprite->extra, -1); - break; - default: - SetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1); - if (pXSprite->state) - seqSpawn(37, 3, pSprite->extra, -1); - break; - } - break; - // by NoOne: various modern types - case kMarkerWarpDest: - if (pXSprite->txID <= 0) { - if (SetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1) == 1) - useTeleportTarget(pXSprite, NULL); - break; - } - modernTypeSetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1); - break; - case kGDXSpriteDamager: - if (pXSprite->txID <= 0) { - if (SetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1) == 1) - useSpriteDamager(pXSprite, NULL); - break; - } - modernTypeSetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1); - break; - case kGDXObjPropertiesChanger: - if (pXSprite->txID <= 0) { - if (SetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1) == 1) - usePropertiesChanger(pXSprite, -1, -1); - break; - } - modernTypeSetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1); - break; - case kGDXObjPicnumChanger: - case kGDXObjSizeChanger: - case kGDXSectorFXChanger: - case kGDXObjDataChanger: - case kModernConcussSprite: - modernTypeSetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1); - break; - case 20: - switch (a3.cmd) - { - case 0: - if (SetSpriteState(nSprite, pXSprite, 0)) - sfxPlay3DSound(pSprite, pXSprite->data2, 0, 0); - break; - case 1: - if (SetSpriteState(nSprite, pXSprite, 1)) - sfxPlay3DSound(pSprite, pXSprite->data1, 0, 0); - break; - default: - if (SetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1)) - { - if (pXSprite->state) - sfxPlay3DSound(pSprite, pXSprite->data1, 0, 0); - else - sfxPlay3DSound(pSprite, pXSprite->data2, 0, 0); - } - break; - } - break; - case 21: - switch (a3.cmd) - { - case 0: - if (SetSpriteState(nSprite, pXSprite, 0)) - sfxPlay3DSound(pSprite, pXSprite->data2, 0, 0); - break; - case 1: - if (SetSpriteState(nSprite, pXSprite, 1)) - sfxPlay3DSound(pSprite, pXSprite->data1, 0, 0); - break; - default: - if (SetSpriteState(nSprite, pXSprite, pXSprite->restState ^ 1)) - { - if (pXSprite->state) - sfxPlay3DSound(pSprite, pXSprite->data1, 0, 0); - else - sfxPlay3DSound(pSprite, pXSprite->data2, 0, 0); - } - break; - } - break; - // By NoOne: add linking for path markers and stacks feature - case kMarkerLowWater: - case kMarkerUpWater: - case kMarkerUpGoo: - case kMarkerLowGoo: - case kMarkerUpLink: - case kMarkerLowLink: - case kMarkerUpStack: - case kMarkerLowStack: - if (pXSprite->command == 5 && pXSprite->txID != 0) - evSend(nSprite, 3, pXSprite->txID, COMMAND_ID_5); - break; - // by NoOne: add triggering sprite feature. Path sector will trigger the marker after - // it gets reached so it can send commands. - case kMarkerPath: - switch (a3.cmd) { - case COMMAND_ID_0: + case kSwitchPadlock: + switch (event.cmd) { + case kCmdOff: SetSpriteState(nSprite, pXSprite, 0); break; - case COMMAND_ID_1: - SetSpriteState(nSprite, pXSprite, 1); - break; - case COMMAND_ID_5: - if (pXSprite->txID != 0) - evSend(nSprite, 3, pXSprite->txID, COMMAND_ID_5); // don't forget linking! + case kCmdOn: + if (!SetSpriteState(nSprite, pXSprite, 1)) break; + seqSpawn(37, 3, pSprite->extra, -1); break; default: SetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1); + if (pXSprite->state) seqSpawn(37, 3, pSprite->extra, -1); break; } break; - case 22: - switch (a3.cmd) - { - case 0: - pXSprite->data1--; - if (pXSprite->data1 < 0) - pXSprite->data1 += pXSprite->data3; - break; - default: - pXSprite->data1++; - if (pXSprite->data1 >= pXSprite->data3) - pXSprite->data1 -= pXSprite->data3; - break; + case kSwitchToggle: + switch (event.cmd) { + case kCmdOff: + if (!SetSpriteState(nSprite, pXSprite, 0)) break; + sfxPlay3DSound(pSprite, pXSprite->data2, 0, 0); + break; + case kCmdOn: + if (!SetSpriteState(nSprite, pXSprite, 1)) break; + sfxPlay3DSound(pSprite, pXSprite->data1, 0, 0); + break; + default: + if (!SetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1)) break; + if (pXSprite->state) sfxPlay3DSound(pSprite, pXSprite->data1, 0, 0); + else sfxPlay3DSound(pSprite, pXSprite->data2, 0, 0); + break; } - if (pXSprite->command == 5 && pXSprite->txID) - evSend(nSprite, 3, pXSprite->txID, COMMAND_ID_5); + break; + case kSwitchOneWay: + switch (event.cmd) { + case kCmdOff: + if (!SetSpriteState(nSprite, pXSprite, 0)) break; + sfxPlay3DSound(pSprite, pXSprite->data2, 0, 0); + break; + case kCmdOn: + if (!SetSpriteState(nSprite, pXSprite, 1)) break; + sfxPlay3DSound(pSprite, pXSprite->data1, 0, 0); + break; + default: + if (!SetSpriteState(nSprite, pXSprite, pXSprite->restState ^ 1)) break; + if (pXSprite->state) sfxPlay3DSound(pSprite, pXSprite->data1, 0, 0); + else sfxPlay3DSound(pSprite, pXSprite->data2, 0, 0); + break; + } + break; + case kSwitchCombo: + switch (event.cmd) { + case kCmdOff: + pXSprite->data1--; + if (pXSprite->data1 < 0) + pXSprite->data1 += pXSprite->data3; + break; + default: + pXSprite->data1++; + if (pXSprite->data1 >= pXSprite->data3) + pXSprite->data1 -= pXSprite->data3; + break; + } + sfxPlay3DSound(pSprite, pXSprite->data4, -1, 0); - if (pXSprite->data1 == pXSprite->data2) + + if (pXSprite->command == kCmdLink && pXSprite->txID > 0) + evSend(nSprite, 3, pXSprite->txID, kCmdLink); + + if (pXSprite->data1 == pXSprite->data2) SetSpriteState(nSprite, pXSprite, 1); - else + else SetSpriteState(nSprite, pXSprite, 0); + break; - case kGDXCustomDudeSpawn: - if (gGameOptions.nMonsterSettings && actSpawnCustomDude(pSprite, -1) != NULL) - gKillMgr.sub_263E0(1); - break; - case 18: + case kMarkerDudeSpawn: if (gGameOptions.nMonsterSettings && pXSprite->data1 >= kDudeBase && pXSprite->data1 < kDudeMax) { @@ -790,30 +991,28 @@ void OperateSprite(int nSprite, XSPRITE *pXSprite, EVENT a3) { XSPRITE *pXSpawn = &xsprite[pSpawn->extra]; gKillMgr.sub_263E0(1); - switch (pXSprite->data1) - { - case 239: - case 240: - case 242: - case 252: - case 253: - { - pXSpawn->health = dudeInfo[pXSprite->data1 - kDudeBase].startHealth << 4; - pXSpawn->burnTime = 10; - pXSpawn->target = -1; - aiActivateDude(pSpawn, pXSpawn); - break; - } + switch (pXSprite->data1) { + case kDudeBurningInnocent: + case kDudeBurningCultist: + case kDudeBurningZombieButcher: + case kDudeBurningTinyCaleb: + case kDudeBurningBeast: + { + pXSpawn->health = dudeInfo[pXSprite->data1 - kDudeBase].startHealth << 4; + pXSpawn->burnTime = 10; + pXSpawn->target = -1; + aiActivateDude(pSpawn, pXSpawn); + break; + } } } } break; - case 19: + case kMarkerEarthQuake: pXSprite->triggerOn = 0; pXSprite->isTriggered = 1; SetSpriteState(nSprite, pXSprite, 1); - for (int p = connecthead; p >= 0; p = connectpoint2[p]) - { + for (int p = connecthead; p >= 0; p = connectpoint2[p]) { spritetype *pPlayerSprite = gPlayer[p].pSprite; int dx = (pSprite->x - pPlayerSprite->x)>>4; int dy = (pSprite->y - pPlayerSprite->y)>>4; @@ -822,361 +1021,125 @@ void OperateSprite(int nSprite, XSPRITE *pXSprite, EVENT a3) gPlayer[p].at37f = divscale16(pXSprite->data1, nDist); } break; - case 400: - if (pSprite->flags&16) - return; + case kThingTNTBarrel: + if (pSprite->flags&16) return; fallthrough__; - case 418: - case 419: - case 420: + case kThingArmedTNTStick: + case kThingArmedTNTBundle: + case kThingArmedSpray: actExplodeSprite(pSprite); break; - case 459: - switch (a3.cmd) - { - case 1: - SetSpriteState(nSprite, pXSprite, 1); - break; - default: - pSprite->cstat &= (unsigned short)~32768; - actExplodeSprite(pSprite); - break; - } - break; - case kGDXSeqSpawner: - case kGDXEffectSpawner: - switch (a3.cmd) { - case COMMAND_ID_0: - if (pXSprite->state == 1) SetSpriteState(nSprite, pXSprite, 0); - break; - case COMMAND_ID_1: - evKill(nSprite, 3); // queue overflow protect - if (pXSprite->state == 0) SetSpriteState(nSprite, pXSprite, 1); - fallthrough__; - case COMMAND_ID_21: - if (pXSprite->txID <= 0) - (pSprite->type == kGDXSeqSpawner) ? useSeqSpawnerGen(pXSprite, 3, pSprite->xvel) : useEffectGen(pXSprite, NULL); - else { - - switch (pXSprite->command) { - case COMMAND_ID_5: - evSend(nSprite, 3, pXSprite->txID, kGDXCommandPaste); // just send command to change properties - break; - case COMMAND_ID_7: - evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); // send normal command first - evSend(nSprite, 3, pXSprite->txID, kGDXCommandPaste); // then send command to change properties - break; - default: - evSend(nSprite, 3, pXSprite->txID, kGDXCommandPaste); // send first command to change properties - evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); // then send normal command - break; - } - - } - - if (pXSprite->busyTime > 0) - evPost(nSprite, 3, ClipLow((int(pXSprite->busyTime) + Random2(pXSprite->data1)) * 120 / 10, 0), COMMAND_ID_21); + case kTrapExploder: + switch (event.cmd) { + case kCmdOn: + SetSpriteState(nSprite, pXSprite, 1); break; default: - if (pXSprite->state == 0) evPost(nSprite, 3, 0, COMMAND_ID_1); - else evPost(nSprite, 3, 0, COMMAND_ID_0); + pSprite->cstat &= (unsigned short)~CSTAT_SPRITE_INVISIBLE; + actExplodeSprite(pSprite); break; } - break; - case 402: - if (pSprite->statnum == kStatRespawn) - break; - if (a3.cmd != 1) - actExplodeSprite(pSprite); - else - { - sfxPlay3DSound(pSprite, 454, 0, 0); - evPost(nSprite, 3, 18, COMMAND_ID_0); - } - break; - case 401: - case kGDXThingTNTProx: - if (pSprite->statnum == kStatRespawn) - break; - switch (a3.cmd) - { - case 35: - if (!pXSprite->state) - { - sfxPlay3DSound(pSprite, 452, 0, 0); - evPost(nSprite, 3, 30, COMMAND_ID_0); - pXSprite->state = 1; - } - break; - case 1: - sfxPlay3DSound(pSprite, 451, 0, 0); - pXSprite->Proximity = 1; - break; - default: - actExplodeSprite(pSprite); - break; - } - break; - case 431: - sub_43CF8(pSprite, pXSprite, a3); - break; - case kGDXThingCustomDudeLifeLeech: - dudeLeechOperate(pSprite, pXSprite, a3); - break; - case kGDXWindGenerator: - switch (a3.cmd) { - case COMMAND_ID_0: - stopWindOnSectors(pXSprite); - if (pXSprite->state == 1) SetSpriteState(nSprite, pXSprite, 0); - break; - case COMMAND_ID_1: - evKill(nSprite, 3); // queue overflow protect - if (pXSprite->state == 0) SetSpriteState(nSprite, pXSprite, 1); - fallthrough__; - case COMMAND_ID_21: - if (pXSprite->txID <= 0) useSectorWindGen(pXSprite, NULL); - else { - - switch (pXSprite->command) { - case COMMAND_ID_5: - evSend(nSprite, 3, pXSprite->txID, kGDXCommandPaste); // just send command to change properties - break; - case COMMAND_ID_7: - evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); // send normal command first - evSend(nSprite, 3, pXSprite->txID, kGDXCommandPaste); // then send command to change properties + case kThingArmedRemoteBomb: + if (pSprite->statnum != kStatRespawn) { + switch (event.cmd) { + case kCmdOn: + actExplodeSprite(pSprite); break; default: - evSend(nSprite, 3, pXSprite->txID, kGDXCommandPaste); // send first command to change properties - evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); // then send normal command + sfxPlay3DSound(pSprite, 454, 0, 0); + evPost(nSprite, 3, 18, kCmdOff); break; - } - } - - if (pXSprite->busyTime > 0) evPost(nSprite, 3, pXSprite->busyTime, COMMAND_ID_21); - break; - default: - if (pXSprite->state == 0) evPost(nSprite, 3, 0, COMMAND_ID_1); - else evPost(nSprite, 3, 0, COMMAND_ID_0); - break; - } - - break; - case kGDXDudeTargetChanger: - { - // this one is required if data4 of generator was dynamically changed - // it turns monsters in normal idle state instead of genIdle, so they - // not ignore the world. - bool activated = false; - if (pXSprite->dropMsg == 3 && 3 != pXSprite->data4) { - activateDudes(pXSprite->txID); - activated = true; - } - - switch (a3.cmd) - { - case COMMAND_ID_0: - if (pXSprite->data4 == 3 && activated == false) activateDudes(pXSprite->txID); - if (pXSprite->state == 1) SetSpriteState(nSprite, pXSprite, 0); - break; - case COMMAND_ID_1: - evKill(nSprite, 3); // queue overflow protect - if (pXSprite->state == 0) SetSpriteState(nSprite, pXSprite, 1); - fallthrough__; - case COMMAND_ID_21: - if (pXSprite->txID <= 0 || !getDudesForTargetChg(pXSprite)) { - freeAllTargets(pXSprite); - evPost(nSprite, 3, 0, COMMAND_ID_0); - break; - } else { - - switch (pXSprite->command) { - case COMMAND_ID_5: - evSend(nSprite, 3, pXSprite->txID, kGDXCommandPaste); // just send command to change properties - break; - case COMMAND_ID_7: - evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); // send normal command first - evSend(nSprite, 3, pXSprite->txID, kGDXCommandPaste); // then send command to change properties - break; - default: - evSend(nSprite, 3, pXSprite->txID, kGDXCommandPaste); // send first command to change properties - evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); // then send normal command - break; - } - - } - - if (pXSprite->busyTime > 0) evPost(nSprite, 3, pXSprite->busyTime, COMMAND_ID_21); - break; - default: - if (pXSprite->state == 0) evPost(nSprite, 3, 0, COMMAND_ID_1); - else evPost(nSprite, 3, 0, COMMAND_ID_0); - break; - } - - pXSprite->dropMsg = (short)pXSprite->data4; - break; - } - case kGDXObjDataAccumulator: - switch (a3.cmd) { - case COMMAND_ID_0: - if (pXSprite->state == 1) SetSpriteState(nSprite, pXSprite, 0); - break; - case COMMAND_ID_1: - evKill(nSprite, 3); // queue overflow protect - if (pXSprite->state == 0) SetSpriteState(nSprite, pXSprite, 1); - fallthrough__; - case COMMAND_ID_21: - - // force OFF after *all* TX objects reach the goal value - if (pSprite->flags == 0 && goalValueIsReached(pXSprite)) { - evPost(nSprite, 3, 0, COMMAND_ID_0); - break; - } - - if (pXSprite->txID > 0 && pXSprite->data1 > 0 && pXSprite->data1 <= 4) { - - switch (pXSprite->command) { - case COMMAND_ID_5: - evSend(nSprite, 3, pXSprite->txID, kGDXCommandPaste); // just send command to change properties - break; - case COMMAND_ID_7: - evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); // send normal command first - evSend(nSprite, 3, pXSprite->txID, kGDXCommandPaste); // then send command to change properties - break; - default: - evSend(nSprite, 3, pXSprite->txID, kGDXCommandPaste); // send first command to change properties - evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); // then send normal command - break; - } - - if (pXSprite->busyTime > 0) evPost(nSprite, 3, pXSprite->busyTime, COMMAND_ID_21); - } - break; - default: - if (pXSprite->state == 0) evPost(nSprite, 3, 0, COMMAND_ID_1); - else evPost(nSprite, 3, 0, COMMAND_ID_0); - break; - } - break; - case 704: // ecto skull gen - switch (a3.cmd) { - case COMMAND_ID_0: - if (pXSprite->state == 1) SetSpriteState(nSprite, pXSprite, 0); - break; - case COMMAND_ID_1: - evKill(nSprite, 3); // queue overflow protect - if (pXSprite->state == 0) SetSpriteState(nSprite, pXSprite, 1); - fallthrough__; - case COMMAND_ID_21: - ActivateGenerator(nSprite); - if (pXSprite->txID) evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); - if (pXSprite->busyTime > 0) evPost(nSprite, 3, (120 * pXSprite->busyTime) / 10, COMMAND_ID_21); - break; - default: - if (pXSprite->state == 0) evPost(nSprite, 3, 0, COMMAND_ID_1); - else evPost(nSprite, 3, 0, COMMAND_ID_0); - break; } break; - case 40: // Random ammo - case 80: // Random weapon - switch (a3.cmd) { - case COMMAND_ID_0: - if (pXSprite->state == 1) SetSpriteState(nSprite, pXSprite, 0); + case kThingArmedProxBomb: + case kModernThingTNTProx: + if (pSprite->statnum != kStatRespawn) { + switch (event.cmd) { + case kCmdSpriteProximity: + if (pXSprite->state) break; + sfxPlay3DSound(pSprite, 452, 0, 0); + evPost(nSprite, 3, 30, kCmdOff); + pXSprite->state = 1; + case kCmdOn: + sfxPlay3DSound(pSprite, 451, 0, 0); + pXSprite->Proximity = 1; + break; + default: + actExplodeSprite(pSprite); + break; + } + } + break; + case kThingDroppedLifeLeech: + LifeLeechOperate(pSprite, pXSprite, event); + break; + case kGenTrigger: + case kGenDripWater: + case kGenDripBlood: + case kGenMissileFireball: + case kGenMissileEctoSkull: + case kGenDart: + case kGenBubble: + case kGenBubbleMulti: + case kGenSound: + switch (event.cmd) { + case kCmdOff: + SetSpriteState(nSprite, pXSprite, 0); break; - case COMMAND_ID_1: - evKill(nSprite, 3); // queue overflow protect - if (pXSprite->state == 0) SetSpriteState(nSprite, pXSprite, 1); - fallthrough__; - case COMMAND_ID_21: - ActivateGenerator(nSprite); - if (pXSprite->busyTime > 0) - evPost(nSprite, 3, (120 * pXSprite->busyTime) / 10, COMMAND_ID_21); + case kCmdRepeat: + if (pSprite->type != kGenTrigger) ActivateGenerator(nSprite); + if (pXSprite->txID) evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); + if (pXSprite->busyTime > 0) { + int nRand = Random2(pXSprite->data1); + evPost(nSprite, 3, 120*(nRand+pXSprite->busyTime) / 10, kCmdRepeat); + } break; default: - if (pXSprite->state == 0) evPost(nSprite, 3, 0, COMMAND_ID_1); - else evPost(nSprite, 3, 0, COMMAND_ID_0); + if (!pXSprite->state) { + SetSpriteState(nSprite, pXSprite, 1); + evPost(nSprite, 3, 0, kCmdRepeat); + } break; } break; - case 700: - case 701: - case 702: - case 703: - case 705: - case 706: - case 707: - case 708: - switch (a3.cmd) - { - case 0: - SetSpriteState(nSprite, pXSprite, 0); - break; - case 21: - if (pSprite->type != 700) - ActivateGenerator(nSprite); - if (pXSprite->txID) - evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); - if (pXSprite->busyTime > 0) - { - int nRand = Random2(pXSprite->data1); - evPost(nSprite, 3, 120*(nRand+pXSprite->busyTime) / 10, COMMAND_ID_21); - } - break; - default: - if (!pXSprite->state) - { - SetSpriteState(nSprite, pXSprite, 1); - evPost(nSprite, 3, 0, COMMAND_ID_21); - } - break; - } + case kSoundPlayer: + if (gGameOptions.nGameType != 0 || gMe->pXSprite->health <= 0) break; + gMe->at30a = 0; sndStartSample(pXSprite->data1, -1, 1, 0); break; - case 711: - if (gGameOptions.nGameType == 0) - { - if (gMe->pXSprite->health <= 0) + case kThingObjectGib: + case kThingObjectExplode: + case kThingBloodBits: + case kThingBloodChunks: + case kThingZombieHead: + switch (event.cmd) { + case kCmdOff: + if (!SetSpriteState(nSprite, pXSprite, 0)) break; + actActivateGibObject(pSprite, pXSprite); break; - gMe->at30a = 0; - } - sndStartSample(pXSprite->data1, -1, 1, 0); - break; - case 416: - case 417: - case 425: - case 426: - case 427: - switch (a3.cmd) - { - case 0: - if (SetSpriteState(nSprite, pXSprite, 0)) + case kCmdOn: + if (!SetSpriteState(nSprite, pXSprite, 1)) break; actActivateGibObject(pSprite, pXSprite); - break; - case 1: - if (SetSpriteState(nSprite, pXSprite, 1)) + break; + default: + if (!SetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1)) break; actActivateGibObject(pSprite, pXSprite); - break; - default: - if (SetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1)) - actActivateGibObject(pSprite, pXSprite); - break; + break; } break; default: - switch (a3.cmd) - { - case 0: - SetSpriteState(nSprite, pXSprite, 0); - break; - case 1: - SetSpriteState(nSprite, pXSprite, 1); - break; - default: - SetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1); - break; + switch (event.cmd) { + case kCmdOff: + SetSpriteState(nSprite, pXSprite, 0); + break; + case kCmdOn: + SetSpriteState(nSprite, pXSprite, 1); + break; + default: + SetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1); + break; } break; } @@ -1746,72 +1709,77 @@ void SetupGibWallState(walltype *pWall, XWALL *pXWall) } } -void OperateWall(int nWall, XWALL *pXWall, EVENT a3) -{ +void OperateWall(int nWall, XWALL *pXWall, EVENT event) { walltype *pWall = &wall[nWall]; - switch (a3.cmd) - { - case 6: - pXWall->locked = 1; - return; - case 7: - pXWall->locked = 0; - return; - case 8: - pXWall->locked ^= 1; - return; + switch (event.cmd) { + case kCmdLock: + pXWall->locked = 1; + return; + case kCmdUnlock: + pXWall->locked = 0; + return; + case kCmdToggleLock: + pXWall->locked ^= 1; + return; } - switch (pWall->type) { + if (gModernMap) { + // by NoOne: make 1-Way switch type for walls to work... - case 21: - if (VanillaMode()) break; - switch (a3.cmd) { - case 0: - SetWallState(nWall,pXWall,0); + switch (pWall->type) { + case kSwitchOneWay: + switch (event.cmd) { + case kCmdOff: + SetWallState(nWall, pXWall, 0); break; - case 1: + case kCmdOn: SetWallState(nWall, pXWall, 1); break; default: SetWallState(nWall, pXWall, pXWall->restState ^ 1); break; + } + return; + } + + } else { + + switch (pWall->type) { + case kWallGib: + if (GetWallType(nWall) != pWall->type) break; + char bStatus; + switch (event.cmd) { + case kCmdOn: + case kCmdWallImpact: + bStatus = SetWallState(nWall, pXWall, 1); + break; + case kCmdOff: + bStatus = SetWallState(nWall, pXWall, 0); + break; + default: + bStatus = SetWallState(nWall, pXWall, pXWall->state ^ 1); + break; + } + + if (bStatus) { + SetupGibWallState(pWall, pXWall); + if (pXWall->state) { + CGibVelocity vel(100, 100, 250); + int nType = ClipRange(pXWall->data, 0, 31); + if (nType > 0) + GibWall(nWall, (GIBTYPE)nType, &vel); + } } return; - case 511: - if (GetWallType(nWall) == 511) { - char bStatus; - switch (a3.cmd) { - case 1: - case 51: - bStatus = SetWallState(nWall, pXWall, 1); - break; - case 0: - bStatus = SetWallState(nWall, pXWall, 0); - break; - default: - bStatus = SetWallState(nWall, pXWall, pXWall->state ^ 1); - break; - } - if (bStatus) { - SetupGibWallState(pWall, pXWall); - if (pXWall->state) { - CGibVelocity vel(100, 100, 250); - int nType = ClipRange(pXWall->data, 0, 31); - if (nType > 0) - GibWall(nWall, (GIBTYPE)nType, &vel); - } - } - return; - } - break; + } + } - switch (a3.cmd) { - case 0: + switch (event.cmd) { + case kCmdOff: SetWallState(nWall, pXWall, 0); break; - case 1: + case kCmdOn: SetWallState(nWall, pXWall, 1); break; default: @@ -1826,7 +1794,7 @@ void SectorStartSound(int nSector, int nState) for (int nSprite = headspritesect[nSector]; nSprite >= 0; nSprite = nextspritesect[nSprite]) { spritetype *pSprite = &sprite[nSprite]; - if (pSprite->statnum == kStatDecoration && pSprite->type == 709) + if (pSprite->statnum == kStatDecoration && pSprite->type == kSoundSector) { int nXSprite = pSprite->extra; dassert(nXSprite > 0 && nXSprite < kMaxXSprites); @@ -1850,7 +1818,7 @@ void SectorEndSound(int nSector, int nState) for (int nSprite = headspritesect[nSector]; nSprite >= 0; nSprite = nextspritesect[nSprite]) { spritetype *pSprite = &sprite[nSprite]; - if (pSprite->statnum == kStatDecoration && pSprite->type == 709) + if (pSprite->statnum == kStatDecoration && pSprite->type == kSoundSector) { int nXSprite = pSprite->extra; dassert(nXSprite > 0 && nXSprite < kMaxXSprites); @@ -1874,7 +1842,7 @@ void PathSound(int nSector, int nSound) for (int nSprite = headspritesect[nSector]; nSprite >= 0; nSprite = nextspritesect[nSprite]) { spritetype *pSprite = &sprite[nSprite]; - if (pSprite->statnum == kStatDecoration && pSprite->type == 709) + if (pSprite->statnum == kStatDecoration && pSprite->type == kSoundSector) sfxPlay3DSound(pSprite, nSound, 0, 0); } } @@ -1987,9 +1955,13 @@ void TranslateSector(int nSector, int a2, int a3, int a4, int a5, int a6, int a7 { spritetype *pSprite = &sprite[nSprite]; // By NoOne: allow to move markers by sector movements in game if flags 1 is added in editor. - if (pSprite->statnum == kStatMarker || pSprite->statnum == kStatPathMarker) { - if (!(pSprite->flags & kModernTypeFlag1)) continue; + switch (pSprite->statnum) { + case kStatMarker: + case kStatPathMarker: + if (!gModernMap || !(pSprite->flags & 0x1)) continue; + break; } + x = baseSprite[nSprite].x; y = baseSprite[nSprite].y; if (sprite[nSprite].cstat&8192) @@ -2154,8 +2126,8 @@ int VCrushBusy(unsigned int nSector, unsigned int a2) if (dz2 != 0) sector[nSector].floorz = v10; pXSector->busy = a2; - if (pXSector->command == 5 && pXSector->txID) - evSend(nSector, 6, pXSector->txID, COMMAND_ID_5); + if (pXSector->command == kCmdLink && pXSector->txID) + evSend(nSector, 6, pXSector->txID, kCmdLink); if ((a2&0xffff) == 0) { SetSectorState(nSector, pXSector, a2>>16); @@ -2203,8 +2175,8 @@ int VSpriteBusy(unsigned int nSector, unsigned int a2) } } pXSector->busy = a2; - if (pXSector->command == 5 && pXSector->txID) - evSend(nSector, 6, pXSector->txID, COMMAND_ID_5); + if (pXSector->command == kCmdLink && pXSector->txID) + evSend(nSector, 6, pXSector->txID, kCmdLink); if ((a2&0xffff) == 0) { SetSectorState(nSector, pXSector, a2>>16); @@ -2302,8 +2274,8 @@ int VDoorBusy(unsigned int nSector, unsigned int a2) nWave = pXSector->at7_5; ZTranslateSector(nSector, pXSector, a2, nWave); pXSector->busy = a2; - if (pXSector->command == 5 && pXSector->txID) - evSend(nSector, 6, pXSector->txID, COMMAND_ID_5); + if (pXSector->command == kCmdLink && pXSector->txID) + evSend(nSector, 6, pXSector->txID, kCmdLink); if ((a2&0xffff) == 0) { SetSectorState(nSector, pXSector, a2>>16); @@ -2325,13 +2297,13 @@ int HDoorBusy(unsigned int nSector, unsigned int a2) nWave = pXSector->at7_2; else nWave = pXSector->at7_5; - spritetype *pSprite1 = &sprite[pXSector->at2c_0]; - spritetype *pSprite2 = &sprite[pXSector->at2e_0]; - TranslateSector(nSector, GetWaveValue(pXSector->busy, nWave), GetWaveValue(a2, nWave), pSprite1->x, pSprite1->y, pSprite1->x, pSprite1->y, pSprite1->ang, pSprite2->x, pSprite2->y, pSprite2->ang, pSector->type == 616); + spritetype *pSprite1 = &sprite[pXSector->marker0]; + spritetype *pSprite2 = &sprite[pXSector->marker1]; + TranslateSector(nSector, GetWaveValue(pXSector->busy, nWave), GetWaveValue(a2, nWave), pSprite1->x, pSprite1->y, pSprite1->x, pSprite1->y, pSprite1->ang, pSprite2->x, pSprite2->y, pSprite2->ang, pSector->type == kSectorSlide); ZTranslateSector(nSector, pXSector, a2, nWave); pXSector->busy = a2; - if (pXSector->command == 5 && pXSector->txID) - evSend(nSector, 6, pXSector->txID, COMMAND_ID_5); + if (pXSector->command == kCmdLink && pXSector->txID) + evSend(nSector, 6, pXSector->txID, kCmdLink); if ((a2&0xffff) == 0) { SetSectorState(nSector, pXSector, a2>>16); @@ -2353,12 +2325,12 @@ int RDoorBusy(unsigned int nSector, unsigned int a2) nWave = pXSector->at7_2; else nWave = pXSector->at7_5; - spritetype *pSprite = &sprite[pXSector->at2c_0]; - TranslateSector(nSector, GetWaveValue(pXSector->busy, nWave), GetWaveValue(a2, nWave), pSprite->x, pSprite->y, pSprite->x, pSprite->y, 0, pSprite->x, pSprite->y, pSprite->ang, pSector->type == 617); + spritetype *pSprite = &sprite[pXSector->marker0]; + TranslateSector(nSector, GetWaveValue(pXSector->busy, nWave), GetWaveValue(a2, nWave), pSprite->x, pSprite->y, pSprite->x, pSprite->y, 0, pSprite->x, pSprite->y, pSprite->ang, pSector->type == kSectorRotate); ZTranslateSector(nSector, pXSector, a2, nWave); pXSector->busy = a2; - if (pXSector->command == 5 && pXSector->txID) - evSend(nSector, 6, pXSector->txID, COMMAND_ID_5); + if (pXSector->command == kCmdLink && pXSector->txID) + evSend(nSector, 6, pXSector->txID, kCmdLink); if ((a2&0xffff) == 0) { SetSectorState(nSector, pXSector, a2>>16); @@ -2375,7 +2347,7 @@ int StepRotateBusy(unsigned int nSector, unsigned int a2) int nXSector = pSector->extra; dassert(nXSector > 0 && nXSector < kMaxXSectors); XSECTOR *pXSector = &xsector[nXSector]; - spritetype *pSprite = &sprite[pXSector->at2c_0]; + spritetype *pSprite = &sprite[pXSector->marker0]; int vbp; if (pXSector->busy < a2) { @@ -2390,8 +2362,8 @@ int StepRotateBusy(unsigned int nSector, unsigned int a2) TranslateSector(nSector, GetWaveValue(pXSector->busy, nWave), GetWaveValue(a2, nWave), pSprite->x, pSprite->y, pSprite->x, pSprite->y, vbp, pSprite->x, pSprite->y, pXSector->data, 1); } pXSector->busy = a2; - if (pXSector->command == 5 && pXSector->txID) - evSend(nSector, 6, pXSector->txID, COMMAND_ID_5); + if (pXSector->command == kCmdLink && pXSector->txID) + evSend(nSector, 6, pXSector->txID, kCmdLink); if ((a2&0xffff) == 0) { SetSectorState(nSector, pXSector, a2>>16); @@ -2410,8 +2382,8 @@ int GenSectorBusy(unsigned int nSector, unsigned int a2) dassert(nXSector > 0 && nXSector < kMaxXSectors); XSECTOR *pXSector = &xsector[nXSector]; pXSector->busy = a2; - if (pXSector->command == 5 && pXSector->txID) - evSend(nSector, 6, pXSector->txID, COMMAND_ID_5); + if (pXSector->command == kCmdLink && pXSector->txID) + evSend(nSector, 6, pXSector->txID, kCmdLink); if ((a2&0xffff) == 0) { SetSectorState(nSector, pXSector, a2>>16); @@ -2429,9 +2401,9 @@ int PathBusy(unsigned int nSector, unsigned int a2) dassert(nXSector > 0 && nXSector < kMaxXSectors); XSECTOR *pXSector = &xsector[nXSector]; spritetype *pSprite = &sprite[basePath[nSector]]; - spritetype *pSprite1 = &sprite[pXSector->at2c_0]; + spritetype *pSprite1 = &sprite[pXSector->marker0]; XSPRITE *pXSprite1 = &xsprite[pSprite1->extra]; - spritetype *pSprite2 = &sprite[pXSector->at2e_0]; + spritetype *pSprite2 = &sprite[pXSector->marker1]; XSPRITE *pXSprite2 = &xsprite[pSprite2->extra]; int nWave = pXSprite1->wave; TranslateSector(nSector, GetWaveValue(pXSector->busy, nWave), GetWaveValue(a2, nWave), pSprite->x, pSprite->y, pSprite1->x, pSprite1->y, pSprite1->ang, pSprite2->x, pSprite2->y, pSprite2->ang, 1); @@ -2439,57 +2411,47 @@ int PathBusy(unsigned int nSector, unsigned int a2) pXSector->busy = a2; if ((a2&0xffff) == 0) { - evPost(nSector, 6, (120*pXSprite2->waitTime)/10, COMMAND_ID_1); + evPost(nSector, 6, (120*pXSprite2->waitTime)/10, kCmdOn); pXSector->state = 0; pXSector->busy = 0; if (pXSprite1->data4) PathSound(nSector, pXSprite1->data4); - pXSector->at2c_0 = pXSector->at2e_0; + pXSector->marker0 = pXSector->marker1; pXSector->data = pXSprite2->data1; return 3; } return 0; } -void OperateDoor(unsigned int nSector, XSECTOR *pXSector, EVENT a3, BUSYID a4) +void OperateDoor(unsigned int nSector, XSECTOR *pXSector, EVENT event, BUSYID busyWave) { - switch (a3.cmd) - { - case 0: - if (pXSector->busy) - { - AddBusy(nSector, a4, -65536/ClipLow((pXSector->busyTimeB*120)/10, 1)); + switch (event.cmd) { + case kCmdOff: + if (!pXSector->busy) break; + AddBusy(nSector, busyWave, -65536/ClipLow((pXSector->busyTimeB*120)/10, 1)); SectorStartSound(nSector, 1); - } - break; - case 1: - if (pXSector->busy != 0x10000) - { - AddBusy(nSector, a4, 65536/ClipLow((pXSector->busyTimeA*120)/10, 1)); + break; + case kCmdOn: + if (pXSector->busy == 0x10000) break; + AddBusy(nSector, busyWave, 65536/ClipLow((pXSector->busyTimeA*120)/10, 1)); SectorStartSound(nSector, 0); - } - break; - default: - if (pXSector->busy&0xffff) - { - if (pXSector->interruptable) - { - ReverseBusy(nSector, a4); - pXSector->state = !pXSector->state; + break; + default: + if (pXSector->busy & 0xffff) { + if (pXSector->interruptable) { + ReverseBusy(nSector, busyWave); + pXSector->state = !pXSector->state; + } + } else { + char t = !pXSector->state; int nDelta; + + if (t) nDelta = 65536/ClipLow((pXSector->busyTimeA*120)/10, 1); + else nDelta = -65536/ClipLow((pXSector->busyTimeB*120)/10, 1); + + AddBusy(nSector, busyWave, nDelta); + SectorStartSound(nSector, pXSector->state); } - } - else - { - char t = !pXSector->state; - int nDelta; - if (t) - nDelta = 65536/ClipLow((pXSector->busyTimeA*120)/10, 1); - else - nDelta = -65536/ClipLow((pXSector->busyTimeB*120)/10, 1); - AddBusy(nSector, a4, nDelta); - SectorStartSound(nSector, pXSector->state); - } - break; + break; } } @@ -2518,7 +2480,7 @@ void TeleFrag(int nKiller, int nSector) void OperateTeleport(unsigned int nSector, XSECTOR *pXSector) { dassert(nSector < (unsigned int)numsectors); - int nDest = pXSector->at2c_0; + int nDest = pXSector->marker0; dassert(nDest < kMaxSprites); spritetype *pDest = &sprite[nDest]; dassert(pDest->statnum == kStatMarker); @@ -2558,13 +2520,13 @@ void OperateTeleport(unsigned int nSector, XSECTOR *pXSector) } } -void OperatePath(unsigned int nSector, XSECTOR *pXSector, EVENT a3) +void OperatePath(unsigned int nSector, XSECTOR *pXSector, EVENT event) { int nSprite; spritetype *pSprite = NULL; XSPRITE *pXSprite; dassert(nSector < (unsigned int)numsectors); - spritetype *pSprite2 = &sprite[pXSector->at2c_0]; + spritetype *pSprite2 = &sprite[pXSector->marker0]; XSPRITE *pXSprite2 = &xsprite[pSprite2->extra]; int nId = pXSprite2->data2; for (nSprite = headspritestat[kStatPathMarker]; nSprite >= 0; nSprite = nextspritestat[nSprite]) @@ -2579,125 +2541,134 @@ void OperatePath(unsigned int nSector, XSECTOR *pXSector, EVENT a3) } // by NoOne: trigger marker after it gets reached - if (pXSprite2->state != 1) - trTriggerSprite(pSprite2->xvel, pXSprite2, COMMAND_ID_1); + if (gModernMap && pXSprite2->state != 1) + trTriggerSprite(pSprite2->xvel, pXSprite2, kCmdOn); - if (nSprite < 0) - ThrowError("Unable to find path marker with id #%d", nId); - pXSector->at2e_0 = nSprite; - pXSector->at24_0 = pSprite2->z; - pXSector->at28_0 = pSprite->z; - switch (a3.cmd) - { - case 1: + if (nSprite < 0) { + viewSetSystemMessage("Unable to find path marker with id #%d for path sector #%d", nId, nSector); pXSector->state = 0; pXSector->busy = 0; - AddBusy(nSector, BUSYID_7, 65536/ClipLow((120*pXSprite2->busyTime)/10,1)); - if (pXSprite2->data3) - PathSound(nSector, pXSprite2->data3); - break; + return; + } + + pXSector->marker1 = nSprite; + pXSector->at24_0 = pSprite2->z; + pXSector->at28_0 = pSprite->z; + switch (event.cmd) { + case kCmdOn: + pXSector->state = 0; + pXSector->busy = 0; + AddBusy(nSector, BUSYID_7, 65536/ClipLow((120*pXSprite2->busyTime)/10,1)); + if (pXSprite2->data3) PathSound(nSector, pXSprite2->data3); + break; } } -void OperateSector(unsigned int nSector, XSECTOR *pXSector, EVENT a3) +void OperateSector(unsigned int nSector, XSECTOR *pXSector, EVENT event) { dassert(nSector < (unsigned int)numsectors); sectortype *pSector = §or[nSector]; - switch (a3.cmd) - { - case 6: - pXSector->locked = 1; - break; - case 7: - pXSector->locked = 0; - // By NoOne: reset counter sector state and make it work again after unlock, so it can be used again. - // See callback.cpp for more info. - if (pSector->type == kSecCounter) { - pXSector->state = 0; - evPost(nSector, 6, 0, CALLBACK_ID_12); - } - break; - case 8: - pXSector->locked ^= 1; - // same as above... - if (pSector->type == kSecCounter && pXSector->locked != 1) { - pXSector->state = 0; - evPost(nSector, 6, 0, CALLBACK_ID_12); - } - break; - case 9: - pXSector->at1b_2 = 0; - pXSector->at1b_3 = 1; - break; - case 10: - pXSector->at1b_2 = 1; - pXSector->at1b_3 = 0; - break; - case 11: - pXSector->at1b_2 = 1; - pXSector->at1b_3 = 1; - break; - default: - switch (pSector->type) - { - case 602: - OperateDoor(nSector, pXSector, a3, BUSYID_1); - break; - case 600: - OperateDoor(nSector, pXSector, a3, BUSYID_2); - break; - case 614: - case 616: - OperateDoor(nSector, pXSector, a3, BUSYID_3); - break; - case 615: - case 617: - OperateDoor(nSector, pXSector, a3, BUSYID_4); - break; - case 613: - switch (a3.cmd) - { - case 1: - pXSector->state = 0; - pXSector->busy = 0; - AddBusy(nSector, BUSYID_5, 65536/ClipLow((120*pXSector->busyTimeA)/10, 1)); - SectorStartSound(nSector, 0); + + if (gModernMap) { + switch (pSector->type) { + // By NoOne: reset counter sector state and make it work again after unlock, so it can be used again. + case kSectorCounter: + switch (event.cmd) { + case kCmdUnlock: + case kCmdToggleLock: + if (pXSector->locked != 1) break; + pXSector->state = 0; + evPost(nSector, 6, 0, kCallbackCounterCheck); + break; + } break; - case 0: - pXSector->state = 1; - pXSector->busy = 65536; - AddBusy(nSector, BUSYID_5, -65536/ClipLow((120*pXSector->busyTimeB)/10, 1)); - SectorStartSound(nSector, 1); - break; - } + } + } + + switch (event.cmd) { + case kCmdLock: + pXSector->locked = 1; break; - case 604: - OperateTeleport(nSector, pXSector); + case kCmdUnlock: + pXSector->locked = 0; break; - case 612: - OperatePath(nSector, pXSector, a3); + case kCmdToggleLock: + pXSector->locked ^= 1; + break; + case kCmdStopOff: + pXSector->stopOn = 0; + pXSector->stopOff = 1; + break; + case kCmdStopOn: + pXSector->stopOn = 1; + pXSector->stopOff = 0; + break; + case kCmdStopNext: + pXSector->stopOn = 1; + pXSector->stopOff = 1; break; default: - if (pXSector->busyTimeA || pXSector->busyTimeB) - OperateDoor(nSector, pXSector, a3, BUSYID_6); - else - { - switch (a3.cmd) - { - case 0: - SetSectorState(nSector, pXSector, 0); + switch (pSector->type) { + case kSectorZMotionSprite: + OperateDoor(nSector, pXSector, event, BUSYID_1); break; - case 1: - SetSectorState(nSector, pXSector, 1); + case kSectorZMotion: + OperateDoor(nSector, pXSector, event, BUSYID_2); + break; + case kSectorSlideMarked: + case kSectorSlide: + OperateDoor(nSector, pXSector, event, BUSYID_3); + break; + case kSectorRotateMarked: + case kSectorRotate: + OperateDoor(nSector, pXSector, event, BUSYID_4); + break; + case kSectorRotateStep: + switch (event.cmd) { + case kCmdOn: + pXSector->state = 0; + pXSector->busy = 0; + AddBusy(nSector, BUSYID_5, 65536/ClipLow((120*pXSector->busyTimeA)/10, 1)); + SectorStartSound(nSector, 0); + break; + case kCmdOff: + pXSector->state = 1; + pXSector->busy = 65536; + AddBusy(nSector, BUSYID_5, -65536/ClipLow((120*pXSector->busyTimeB)/10, 1)); + SectorStartSound(nSector, 1); + break; + } + break; + case kSectorTeleport: + OperateTeleport(nSector, pXSector); + break; + case kSectorPath: + OperatePath(nSector, pXSector, event); break; default: - SetSectorState(nSector, pXSector, pXSector->state^1); + if (!pXSector->busyTimeA && !pXSector->busyTimeB) { + + switch (event.cmd) { + case kCmdOff: + SetSectorState(nSector, pXSector, 0); + break; + case kCmdOn: + SetSectorState(nSector, pXSector, 1); + break; + default: + SetSectorState(nSector, pXSector, pXSector->state ^ 1); + break; + } + + } else { + + OperateDoor(nSector, pXSector, event, BUSYID_6); + + } + break; - } } break; - } - break; } } @@ -2718,196 +2689,192 @@ void InitPath(unsigned int nSector, XSECTOR *pXSector) break; } } - if (nSprite < 0) - ThrowError("Unable to find path marker with id #%d", nId); - pXSector->at2c_0 = nSprite; + + if (nSprite < 0) { + //ThrowError("Unable to find path marker with id #%d", nId); + viewSetSystemMessage("Unable to find path marker with id #%d for path sector #%d", nId, nSector); + return; + + } + + pXSector->marker0 = nSprite; basePath[nSector] = nSprite; if (pXSector->state) - evPost(nSector, 6, 0, COMMAND_ID_1); + evPost(nSector, 6, 0, kCmdOn); } -void LinkSector(int nSector, XSECTOR *pXSector, EVENT a3) +void LinkSector(int nSector, XSECTOR *pXSector, EVENT event) { sectortype *pSector = §or[nSector]; - int nBusy = GetSourceBusy(a3); - switch (pSector->type) - { - case 602: - VSpriteBusy(nSector, nBusy); - break; - case 600: - VDoorBusy(nSector, nBusy); - break; - case 614: - case 616: - HDoorBusy(nSector, nBusy); - break; - case 615: - case 617: - RDoorBusy(nSector, nBusy); - break; - /* By NoOne: add link support for counter sectors so they can change necessary type and count of types*/ - case kSecCounter: - { - int nXIndex; - nXIndex = sector[a3.index].extra; - XSECTOR* pXSector2 = &xsector[nXIndex]; - pXSector->waitTimeA = pXSector2->waitTimeA; - pXSector->data = pXSector2->data; - break; - } - default: - pXSector->busy = nBusy; - if ((pXSector->busy&0xffff) == 0) - SetSectorState(nSector, pXSector, nBusy>>16); - break; + int nBusy = GetSourceBusy(event); + switch (pSector->type) { + case kSectorZMotionSprite: + VSpriteBusy(nSector, nBusy); + break; + case kSectorZMotion: + VDoorBusy(nSector, nBusy); + break; + case kSectorSlideMarked: + case kSectorSlide: + HDoorBusy(nSector, nBusy); + break; + case kSectorRotateMarked: + case kSectorRotate: + RDoorBusy(nSector, nBusy); + break; + /* By NoOne: add link support for counter sectors so they can change necessary type and count of types*/ + case kSectorCounter: + pXSector->waitTimeA = xsector[sector[event.index].extra].waitTimeA; + pXSector->data = xsector[sector[event.index].extra].data; + break; + default: + pXSector->busy = nBusy; + if ((pXSector->busy&0xffff) == 0) + SetSectorState(nSector, pXSector, nBusy>>16); + break; } } -void LinkSprite(int nSprite, XSPRITE *pXSprite, EVENT a3) -{ +void LinkSprite(int nSprite, XSPRITE *pXSprite, EVENT event) { spritetype *pSprite = &sprite[nSprite]; - int nBusy = GetSourceBusy(a3); - switch (pSprite->type) - { - - //By NoOne: these can be linked too now, so it's possible to change palette, underwater status and more... - case kMarkerLowWater: - case kMarkerUpWater: - case kMarkerUpGoo: - case kMarkerLowGoo: - case kMarkerUpLink: - case kMarkerLowLink: - case kMarkerUpStack: - case kMarkerLowStack: - { - if (a3.type != 3) break; - spritetype *pSprite2 = &sprite[a3.index]; - if (pSprite2->extra < 0) break; - XSPRITE *pXSprite2 = &xsprite[pSprite2->extra]; - - // Only lower to lower and upper to upper linking allowed. - switch (pSprite->type) { + int nBusy = GetSourceBusy(event); + switch (pSprite->type) { + //By NoOne: these can be linked too now, so it's possible to change palette, underwater status and more... case kMarkerLowWater: - case kMarkerLowLink: - case kMarkerLowStack: + case kMarkerUpWater: + case kMarkerUpGoo: case kMarkerLowGoo: - switch (pSprite2->type) { + case kMarkerUpLink: + case kMarkerLowLink: + case kMarkerUpStack: + case kMarkerLowStack: { + if (event.type != 3) break; + spritetype *pSprite2 = &sprite[event.index]; + if (pSprite2->extra < 0) break; + XSPRITE *pXSprite2 = &xsprite[pSprite2->extra]; + + // Only lower to lower and upper to upper linking allowed. + switch (pSprite->type) { case kMarkerLowWater: case kMarkerLowLink: case kMarkerLowStack: case kMarkerLowGoo: + switch (pSprite2->type) { + case kMarkerLowWater: + case kMarkerLowLink: + case kMarkerLowStack: + case kMarkerLowGoo: + break; + default: + return; + } break; - default: - return; - } - break; - case kMarkerUpWater: - case kMarkerUpLink: - case kMarkerUpStack: - case kMarkerUpGoo: - switch (pSprite2->type) { case kMarkerUpWater: case kMarkerUpLink: case kMarkerUpStack: case kMarkerUpGoo: + switch (pSprite2->type) { + case kMarkerUpWater: + case kMarkerUpLink: + case kMarkerUpStack: + case kMarkerUpGoo: + break; + default: + return; + } break; - default: - return; } - break; + + // swap link location + /*short tmp1 = pXSprite2.data1;*/ + /*pXSprite2.data1 = pXSprite.data1;*/ + /*pXSprite.data1 = tmp1;*/ + + if (pXSprite->data2 < kMaxPAL && pXSprite2->data2 < kMaxPAL) + { + // swap medium + int tmp2 = pXSprite2->data2; + pXSprite2->data2 = pXSprite->data2; + pXSprite->data2 = tmp2; + } + + + // swap link type // swap link owners (sectors) + short tmp3 = pSprite2->type; //short tmp7 = pSprite2.owner; + pSprite2->type = pSprite->type; //pSprite2.owner = pSprite.owner; + pSprite->type = tmp3; //pSprite.owner = tmp7; + + // Deal with linked sectors + sectortype *pSector = §or[pSprite->sectnum]; + sectortype *pSector2 = §or[pSprite2->sectnum]; + + // Check for underwater + XSECTOR *pXSector = NULL; XSECTOR *pXSector2 = NULL; + if (pSector->extra > 0) pXSector = &xsector[pSector->extra]; + if (pSector2->extra > 0) pXSector2 = &xsector[pSector2->extra]; + if (pXSector != NULL && pXSector2 != NULL) { + bool tmp6 = pXSector->Underwater; + pXSector->Underwater = pXSector2->Underwater; + pXSector2->Underwater = tmp6; + } + + // optionally swap floorpic + if (pXSprite2->data3 == 1) { + short tmp4 = pSector->floorpicnum; + pSector->floorpicnum = pSector2->floorpicnum; + pSector2->floorpicnum = tmp4; + } + + // optionally swap ceilpic + if (pXSprite2->data4 == 1) { + short tmp5 = pSector->ceilingpicnum; + pSector->ceilingpicnum = pSector2->ceilingpicnum; + pSector2->ceilingpicnum = tmp5; + } } - - // swap link location - /*short tmp1 = pXSprite2.data1;*/ - /*pXSprite2.data1 = pXSprite.data1;*/ - /*pXSprite.data1 = tmp1;*/ - - if (pXSprite->data2 < kMaxPAL && pXSprite2->data2 < kMaxPAL) + break; + // By NoOne: add a way to link between path markers, so path sectors can change their path on the fly. + case kMarkerPath: { - // swap medium - int tmp2 = pXSprite2->data2; - pXSprite2->data2 = pXSprite->data2; - pXSprite->data2 = tmp2; + // only path marker to path marker link allowed + if (event.type == 3) + { + int nXSprite2 = sprite[event.index].extra; + // get master path marker data fields + pXSprite->data1 = xsprite[nXSprite2].data1; + pXSprite->data2 = xsprite[nXSprite2].data2; + pXSprite->data3 = xsprite[nXSprite2].data3; // include soundId(?) + + // get master path marker busy and wait times + pXSprite->busyTime = xsprite[nXSprite2].busyTime; + pXSprite->waitTime = xsprite[nXSprite2].waitTime; + + } } - - - // swap link type // swap link owners (sectors) - short tmp3 = pSprite2->type; //short tmp7 = pSprite2.owner; - pSprite2->type = pSprite->type; //pSprite2.owner = pSprite.owner; - pSprite->type = tmp3; //pSprite.owner = tmp7; - - // Deal with linked sectors - sectortype *pSector = §or[pSprite->sectnum]; - sectortype *pSector2 = §or[pSprite2->sectnum]; - - // Check for underwater - XSECTOR *pXSector = NULL; XSECTOR *pXSector2 = NULL; - if (pSector->extra > 0) pXSector = &xsector[pSector->extra]; - if (pSector2->extra > 0) pXSector2 = &xsector[pSector2->extra]; - if (pXSector != NULL && pXSector2 != NULL) { - bool tmp6 = pXSector->Underwater; - pXSector->Underwater = pXSector2->Underwater; - pXSector2->Underwater = tmp6; - } - - // optionally swap floorpic - if (pXSprite2->data3 == 1) { - short tmp4 = pSector->floorpicnum; - pSector->floorpicnum = pSector2->floorpicnum; - pSector2->floorpicnum = tmp4; - } - - // optionally swap ceilpic - if (pXSprite2->data4 == 1) { - short tmp5 = pSector->ceilingpicnum; - pSector->ceilingpicnum = pSector2->ceilingpicnum; - pSector2->ceilingpicnum = tmp5; - } - } - break; - // By NoOne: add a way to link between path markers, so path sectors can change their path on the fly. - case kMarkerPath: - { - // only path marker to path marker link allowed - if (a3.type == 3) + break; + case kSwitchCombo: { - int nXSprite2 = sprite[a3.index].extra; - // get master path marker data fields - pXSprite->data1 = xsprite[nXSprite2].data1; - pXSprite->data2 = xsprite[nXSprite2].data2; - pXSprite->data3 = xsprite[nXSprite2].data3; // include soundId(?) - - // get master path marker busy and wait times - pXSprite->busyTime = xsprite[nXSprite2].busyTime; - pXSprite->waitTime = xsprite[nXSprite2].waitTime; - + if (event.type == 3) + { + int nSprite2 = event.index; + int nXSprite2 = sprite[nSprite2].extra; + dassert(nXSprite2 > 0 && nXSprite2 < kMaxXSprites); + pXSprite->data1 = xsprite[nXSprite2].data1; + if (pXSprite->data1 == pXSprite->data2) + SetSpriteState(nSprite, pXSprite, 1); + else + SetSpriteState(nSprite, pXSprite, 0); + } } - } - break; - case kSwitchCombo: - { - if (a3.type == 3) + break; + default: { - int nSprite2 = a3.index; - int nXSprite2 = sprite[nSprite2].extra; - dassert(nXSprite2 > 0 && nXSprite2 < kMaxXSprites); - pXSprite->data1 = xsprite[nXSprite2].data1; - if (pXSprite->data1 == pXSprite->data2) - SetSpriteState(nSprite, pXSprite, 1); - else - SetSpriteState(nSprite, pXSprite, 0); + pXSprite->busy = nBusy; + if ((pXSprite->busy & 0xffff) == 0) + SetSpriteState(nSprite, pXSprite, nBusy >> 16); } - } - break; - default: - { - pXSprite->busy = nBusy; - if ((pXSprite->busy & 0xffff) == 0) - SetSpriteState(nSprite, pXSprite, nBusy >> 16); - } - break; + break; } } @@ -2919,123 +2886,126 @@ void LinkWall(int nWall, XWALL *pXWall, EVENT a3) SetWallState(nWall, pXWall, nBusy>>16); } -void trTriggerSector(unsigned int nSector, XSECTOR *pXSector, int a3) -{ +void trTriggerSector(unsigned int nSector, XSECTOR *pXSector, int command) { dassert(nSector < (unsigned int)numsectors); - if (!pXSector->locked && !pXSector->at16_6) - { - if (pXSector->triggerOnce) - pXSector->at16_6 = 1; - if (pXSector->decoupled) - { - if (pXSector->txID) - evSend(nSector, 6, pXSector->txID, (COMMAND_ID)pXSector->command); - } - else - { - EVENT evnt; - evnt.cmd = a3; - OperateSector(nSector, pXSector, evnt); + if (!pXSector->locked && !pXSector->isTriggered) { + + if (pXSector->triggerOnce) + pXSector->isTriggered = 1; + + if (pXSector->decoupled && pXSector->txID > 0) + evSend(nSector, 6, pXSector->txID, (COMMAND_ID)pXSector->command); + + else { + EVENT event; + event.cmd = command; + OperateSector(nSector, pXSector, event); } + } } -void trMessageSector(unsigned int nSector, EVENT a2) -{ +void trMessageSector(unsigned int nSector, EVENT event) { dassert(nSector < (unsigned int)numsectors); dassert(sector[nSector].extra > 0 && sector[nSector].extra < kMaxXSectors); - int nXSector = sector[nSector].extra; - XSECTOR *pXSector = &xsector[nXSector]; - if (!pXSector->locked || a2.cmd == 7 || a2.cmd == 8) - { - if (a2.cmd == 5) - LinkSector(nSector, pXSector, a2); - else if (a2.cmd == kGDXCommandPaste) - pastePropertiesInObj(6, nSector, a2); - else - OperateSector(nSector, pXSector, a2); + XSECTOR *pXSector = &xsector[sector[nSector].extra]; + if (!pXSector->locked || event.cmd == kCmdUnlock || event.cmd == kCmdToggleLock) { + switch (event.cmd) { + case kCmdLink: + LinkSector(nSector, pXSector, event); + break; + case kCmdModernUse: + pastePropertiesInObj(6, nSector, event); + break; + default: + OperateSector(nSector, pXSector, event); + break; + } } } -void trTriggerWall(unsigned int nWall, XWALL *pXWall, int a3) -{ +void trTriggerWall(unsigned int nWall, XWALL *pXWall, int command) { dassert(nWall < (unsigned int)numwalls); - if (!pXWall->locked && !pXWall->isTriggered) - { + if (!pXWall->locked && !pXWall->isTriggered) { + if (pXWall->triggerOnce) pXWall->isTriggered = 1; - if (pXWall->decoupled) - { - if (pXWall->txID) - evSend(nWall, 0, pXWall->txID, (COMMAND_ID)pXWall->command); - } - else - { - EVENT evnt; - evnt.cmd = a3; - OperateWall(nWall, pXWall, evnt); + + if (pXWall->decoupled && pXWall->txID > 0) + evSend(nWall, 0, pXWall->txID, (COMMAND_ID)pXWall->command); + + else { + EVENT event; + event.cmd = command; + OperateWall(nWall, pXWall, event); } + } } -void trMessageWall(unsigned int nWall, EVENT a2) -{ +void trMessageWall(unsigned int nWall, EVENT event) { dassert(nWall < (unsigned int)numwalls); dassert(wall[nWall].extra > 0 && wall[nWall].extra < kMaxXWalls); - int nXWall = wall[nWall].extra; - XWALL *pXWall = &xwall[nXWall]; - if (!pXWall->locked || a2.cmd == 7 || a2.cmd == 8) - { - if (a2.cmd == 5) - LinkWall(nWall, pXWall, a2); - else if (a2.cmd == kGDXCommandPaste) - pastePropertiesInObj(0, nWall, a2); - else - OperateWall(nWall, pXWall, a2); + + XWALL *pXWall = &xwall[wall[nWall].extra]; + if (!pXWall->locked || event.cmd == kCmdUnlock || event.cmd == kCmdToggleLock) { + switch (event.cmd) { + case kCmdLink: + LinkWall(nWall, pXWall, event); + break; + case kCmdModernUse: + pastePropertiesInObj(0, nWall, event); + break; + default: + OperateWall(nWall, pXWall, event); + break; + } } } -void trTriggerSprite(unsigned int nSprite, XSPRITE *pXSprite, int a3) -{ - if (!pXSprite->locked && !pXSprite->isTriggered) - { +void trTriggerSprite(unsigned int nSprite, XSPRITE *pXSprite, int command) { + if (!pXSprite->locked && !pXSprite->isTriggered) { + if (pXSprite->triggerOnce) pXSprite->isTriggered = 1; - if (pXSprite->Decoupled) - { - if (pXSprite->txID) - evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); - } - else - { - EVENT evnt; - evnt.cmd = a3; - OperateSprite(nSprite, pXSprite, evnt); + + if (pXSprite->Decoupled && pXSprite->txID > 0) + evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command); + + else { + EVENT event; + event.cmd = command; + OperateSprite(nSprite, pXSprite, event); } + } } -void trMessageSprite(unsigned int nSprite, EVENT a2) -{ - if (sprite[nSprite].statnum == kStatFree) - return; - int nXSprite = sprite[nSprite].extra; - XSPRITE *pXSprite = &xsprite[nXSprite]; - if (!pXSprite->locked || a2.cmd == 7 || a2.cmd == 8) - { - if (a2.cmd == 5) - LinkSprite(nSprite, pXSprite, a2); - else if (a2.cmd == kGDXCommandPaste) - pastePropertiesInObj(3, nSprite, a2); - else - OperateSprite(nSprite, pXSprite, a2); +void trMessageSprite(unsigned int nSprite, EVENT event) { + if (sprite[nSprite].statnum != kStatFree) { + + XSPRITE* pXSprite = &xsprite[sprite[nSprite].extra]; + if (!pXSprite->locked || event.cmd == kCmdUnlock || event.cmd == kCmdToggleLock) { + switch (event.cmd) { + case kCmdLink: + LinkSprite(nSprite, pXSprite, event); + break; + case kCmdModernUse: + pastePropertiesInObj(3, nSprite, event); + break; + default: + OperateSprite(nSprite, pXSprite, event); + break; + } + } + } } bool valueIsBetween(int val, int min, int max) { return (val > min && val < max); } -// By NoOne: this function used by various new GDX types. +// By NoOne: this function used by various new modern types. void pastePropertiesInObj(int type, int nDest, EVENT event) { if (event.type != 3) return; @@ -3070,26 +3040,26 @@ void pastePropertiesInObj(int type, int nDest, EVENT event) { useTeleportTarget(pXSource, &sprite[nDest]); return; - } else if (pSource->type == kGDXSpriteDamager) { + } else if (pSource->type == kModernSpriteDamager) { /* - damages xsprite via TX ID - */ if (type != 3) return; else if (xsprite[sprite[nDest].extra].health > 0) useSpriteDamager(pXSource, &sprite[nDest]); return; - } if (pSource->type == kGDXEffectSpawner) { + } if (pSource->type == kModernEffectSpawner) { /* - Effect Spawner can spawn any effect passed in data2 on it's or txID sprite - */ if (pXSource->data2 < 0 || pXSource->data2 >= kFXMax) return; else if (type == 3) useEffectGen(pXSource, &sprite[nDest]); return; } - else if (pSource->type == kGDXSeqSpawner) { + else if (pSource->type == kModernSeqSpawner) { /* - SEQ Spawner takes data2 as SEQ ID and spawns it on it's or TX ID sprite - */ if (pXSource->data2 > 0 && !gSysRes.Lookup(pXSource->data2, "SEQ")) return; useSeqSpawnerGen(pXSource, type, nDest); return; } - else if (pSource->type == kGDXWindGenerator) { + else if (pSource->type == kModernWindGenerator) { /* - Wind generator via TX or for current sector if TX ID not specified - */ /* - sprite.ang = sector wind direction - */ /* - data1 = randomness settings - */ @@ -3110,7 +3080,7 @@ void pastePropertiesInObj(int type, int nDest, EVENT event) { if (pXSource->data2 < 0) return; else if (type == 6) useSectorWindGen(pXSource, §or[nDest]); return; - } else if (pSource->type == kGDXObjDataAccumulator) { + } else if (pSource->type == kModernObjDataAccumulator) { /* - Object Data Accumulator allows to perform sum and sub operations in data fields of object - */ /* - data1 = destination data index - */ /* - data2 = min value - */ @@ -3181,7 +3151,7 @@ void pastePropertiesInObj(int type, int nDest, EVENT event) { return; - } else if (pSource->type == kGDXObjDataChanger) { + } else if (pSource->type == kModernObjDataChanger) { /* - Data field changer via TX - */ /* - data1 = sprite data1 / sector data / wall data - */ @@ -3217,7 +3187,7 @@ void pastePropertiesInObj(int type, int nDest, EVENT event) { break; } - } else if (pSource->type == kGDXSectorFXChanger) { + } else if (pSource->type == kModernSectorFXChanger) { /* - FX Wave changer for sector via TX - */ /* - data1 = Wave - */ @@ -3259,7 +3229,7 @@ void pastePropertiesInObj(int type, int nDest, EVENT event) { shadeList[shadeCount++] = sector[nDest].extra; } - } else if (pSource->type == kGDXDudeTargetChanger) { + } else if (pSource->type == kModernDudeTargetChanger) { /* - Target changer for dudes via TX - */ @@ -3280,8 +3250,8 @@ void pastePropertiesInObj(int type, int nDest, EVENT event) { else if (!IsDudeSprite(&sprite[nDest]) && sprite[nDest].statnum != kStatDude && xsprite[sprite[nDest].extra].data3 != 0) { switch (sprite[nDest].type) { // can be dead dude turned in gib // make current target and all other dudes not attack this dude anymore - case 425: - case 426: + case kThingBloodBits: + case kThingBloodChunks: xsprite[sprite[nDest].extra].data3 = 0; freeTargets(nDest); return; @@ -3318,7 +3288,7 @@ void pastePropertiesInObj(int type, int nDest, EVENT event) { // dude is dead? if (pXSprite->health <= 0) { - pSprite->type = 426; actPostSprite(pSprite->xvel, kStatThing); // turn it in gib + pSprite->type = kThingBloodChunks; actPostSprite(pSprite->xvel, kStatThing); // turn it in gib return; } @@ -3328,12 +3298,12 @@ void pastePropertiesInObj(int type, int nDest, EVENT event) { if (pXSource->data4 == 3) { aiSetTarget(pXSprite, pSprite->x, pSprite->y, pSprite->z); aiSetGenIdleState(pSprite, pXSprite); - if (pSprite->type == kCustomDude) + if (pSprite->type == kDudeModernCustom) removeLeech(leechIsDropped(pSprite)); } else if (pXSource->data4 == 4) { aiSetTarget(pXSprite, pPlayer->x, pPlayer->y, pPlayer->z); - if (pSprite->type == kCustomDude) + if (pSprite->type == kDudeModernCustom) removeLeech(leechIsDropped(pSprite)); } } @@ -3534,7 +3504,7 @@ void pastePropertiesInObj(int type, int nDest, EVENT event) { } } - } else if (pSource->type == kGDXObjSizeChanger) { + } else if (pSource->type == kModernObjSizeChanger) { /* - size and pan changer of sprite/wall/sector via TX ID - */ /* - data1 = sprite xrepeat / wall xrepeat / floor xpan - */ @@ -3599,7 +3569,7 @@ void pastePropertiesInObj(int type, int nDest, EVENT event) { break; } - } else if (pSource->type == kGDXObjPicnumChanger) { + } else if (pSource->type == kModernObjPicnumChanger) { /* - picnum changer can change picnum of sprite/wall/sector via TX ID - */ /* - data1 = sprite pic / wall pic / sector floor pic - */ @@ -3654,13 +3624,13 @@ void pastePropertiesInObj(int type, int nDest, EVENT event) { break; } - } else if (pSource->type == kGDXObjPropertiesChanger) { + } else if (pSource->type == kModernObjPropertiesChanger) { /* - properties changer can change various properties - */ usePropertiesChanger(pXSource, type, nDest); } } -// By NoOne: the following functions required for kGDXDudeTargetChanger +// By NoOne: the following functions required for kModernDudeTargetChanger //--------------------------------------- spritetype* getTargetInRange(spritetype* pSprite, int minDist, int maxDist, short data, short teamMode) { DUDEINFO* pDudeInfo = &dudeInfo[pSprite->type - kDudeBase]; XSPRITE* pXSprite = &xsprite[pSprite->extra]; @@ -3789,7 +3759,7 @@ bool dudeCanSeeTarget(XSPRITE* pXDude, DUDEINFO* pDudeInfo, spritetype* pTarget) } // by NoOne: this function required if monsters in genIdle ai state. It wakes up monsters -// when kGDXDudeTargetChanger goes to off state, so they won't ignore the world. +// when kModernDudeTargetChanger goes to off state, so they won't ignore the world. void activateDudes(int rx) { for (int i = bucketHead[rx]; i < bucketHead[rx + 1]; i++) { if (rxBucket[i].type != 3) continue; @@ -3849,7 +3819,7 @@ int getDataFieldOfObject(int objType, int objIndex, int dataIndex) { return xsprite[sprite[objIndex].extra].data2; case 3: switch (sprite[objIndex].type) { - case kCustomDude: + case kDudeModernCustom: return xsprite[sprite[objIndex].extra].sysData1; default: return xsprite[sprite[objIndex].extra].data3; @@ -3888,7 +3858,7 @@ bool setDataValueOfObject(int objType, int objIndex, int dataIndex, int value) { return true; case 3: switch (sprite[objIndex].type) { - case kCustomDude: + case kDudeModernCustom: xsprite[sprite[objIndex].extra].sysData1 = value; break; default: @@ -3922,7 +3892,7 @@ bool goalValueIsReached(XSPRITE* pXSprite) { return true; } -// by NoOne: this function tells if there any dude found for kGDXDudeTargetChanger +// by NoOne: this function tells if there any dude found for kModernDudeTargetChanger bool getDudesForTargetChg(XSPRITE* pXSprite) { for (int i = bucketHead[pXSprite->txID]; i < bucketHead[pXSprite->txID + 1]; i++) { if (rxBucket[i].type != 3) continue; @@ -3986,13 +3956,13 @@ int getFineTargetDist(spritetype* pSprite, spritetype* pTarget) { bool IsBurningDude(spritetype* pSprite) { if (pSprite == NULL) return false; switch (pSprite->type) { - case 239: // burning dude - case 240: // cultist burning - case 241: // axe zombie burning - case 242: // fat zombie burning - case 252: // tiny caleb burning - case 253: // beast burning - case kCustomDudeBurning: + case kDudeBurningInnocent: // burning dude + case kDudeBurningCultist: // cultist burning + case kDudeBurningZombieAxe: // axe zombie burning + case kDudeBurningZombieButcher: // fat zombie burning + case kDudeBurningTinyCaleb: // tiny caleb burning + case kDudeBurningBeast: // beast burning + case kDudeModernCustomBurning: return true; } @@ -4001,8 +3971,8 @@ bool IsBurningDude(spritetype* pSprite) { bool IsKillableDude(spritetype* pSprite) { switch (pSprite->type) { - case 208: // flesh statue - case 209: // stone statue + case kDudeGargoyleStatueFlesh: // flesh statue + case kDudeGargoyleStatueStone: // stone statue return false; default: if (!IsDudeSprite(pSprite) || xsprite[pSprite->extra].locked == 1) return false; @@ -4012,19 +3982,19 @@ bool IsKillableDude(spritetype* pSprite) { bool isAnnoyingUnit(spritetype* pDude) { switch (pDude->type) { - case 212: // hand - case 213: // brown spider - case 214: // red spider - case 215: // black spider - case 216: // mother spider - case 218: // eel - case 219: // bat - case 220: // rat - case 222: // green tentacle - case 224: // fire tentacle - case 226: // mother tentacle - case 223: // green pod - case 225: // fire pod + case kDudeHand: // hand + case kDudeSpiderBrown: // brown spider + case kDudeSpiderRed: // red spider + case kDudeSpiderBlack: // black spider + case kDudeSpiderMother: // mother spider + case kDudeBoneEel: // eel + case kDudeBat: // bat + case kDudeRat: // rat + case kDudePodGreen: // green pod + case kDudeTentacleGreen: // green tentacle + case kDudeTentacleFire: // fire tentacle + case kDudeTentacleMother: // mother tentacle + case kDudePodFire: // fire pod return true; default: return false; @@ -4033,10 +4003,10 @@ bool isAnnoyingUnit(spritetype* pDude) { bool unitCanFly(spritetype* pDude) { switch (pDude->type) { - case 219: // bat - case 206: // gargoyle - case 207: // stone gargoyle - case 210: // phantasm + case kDudeBat: // bat + case kDudeGargoyleFlesh: // gargoyle + case kDudeGargoyleStone: // stone gargoyle + case kDudePhantasm: // phantasm return true; default: return false; @@ -4045,27 +4015,27 @@ bool unitCanFly(spritetype* pDude) { bool isMeleeUnit(spritetype* pDude) { switch (pDude->type) { - case 203: // axe zombie - case 205: // earth zombie - case 206: // gargoyle - case 212: // hand - case 213: // brown spider - case 214: // red spider - case 215: // black spider - case 216: // mother spider - case 217: // gill beast - case 218: // eel - case 219: // bat - case 220: // rat - case 222: // green tentacle - case 224: // fire tentacle - case 226: // mother tentacle - case 244: // sleep zombie - case 245: // innocent - case 250: // tiny caleb - case 251: // beast + case kDudeZombieAxeNormal: // axe zombie + case kDudeZombieAxeBuried: // earth zombie + case kDudeGargoyleFlesh: // gargoyle + case kDudeHand: // hand + case kDudeSpiderBrown: // brown spider + case kDudeSpiderRed: // red spider + case kDudeSpiderBlack: // black spider + case kDudeSpiderMother: // mother spider + case kDudeGillBeast: // gill beast + case kDudeBoneEel: // eel + case kDudeBat: // bat + case kDudeRat: // rat + case kDudeTentacleGreen: // green tentacle + case kDudeTentacleFire: // fire tentacle + case kDudeTentacleMother: // mother tentacle + case kDudeZombieAxeLaying: // sleep zombie + case kDudeInnocent: // innocent + case kDudeTinyCaleb: // tiny caleb + case kDudeBeast: // beast return true; - case kCustomDude: + case kDudeModernCustom: return (pDude->extra >= 0 && dudeIsMelee(&xsprite[pDude->extra])); default: return false; @@ -4254,21 +4224,21 @@ void trInit(void) pXSector->busy = 65536; switch (pSector->type) { - case kSecCounter: + case kSectorCounter: //By NoOne: no need to trigger once it, instead lock so it can be unlocked and used again. - //pXSector->triggerOnce = 1; - evPost(i, 6, 0, CALLBACK_ID_12); + if (!gModernMap) pXSector->triggerOnce = 1; + evPost(i, 6, 0, kCallbackCounterCheck); break; - case 600: - case 602: + case kSectorZMotion: + case kSectorZMotionSprite: ZTranslateSector(i, pXSector, pXSector->busy, 1); break; - case 614: - case 616: + case kSectorSlideMarked: + case kSectorSlide: { - spritetype *pSprite1 = &sprite[pXSector->at2c_0]; - spritetype *pSprite2 = &sprite[pXSector->at2e_0]; - TranslateSector(i, 0, -65536, pSprite1->x, pSprite1->y, pSprite1->x, pSprite1->y, pSprite1->ang, pSprite2->x, pSprite2->y, pSprite2->ang, pSector->type == 616); + spritetype *pSprite1 = &sprite[pXSector->marker0]; + spritetype *pSprite2 = &sprite[pXSector->marker1]; + TranslateSector(i, 0, -65536, pSprite1->x, pSprite1->y, pSprite1->x, pSprite1->y, pSprite1->ang, pSprite2->x, pSprite2->y, pSprite2->ang, pSector->type == kSectorSlide); for (int j = 0; j < pSector->wallnum; j++) { baseWall[pSector->wallptr+j].x = wall[pSector->wallptr+j].x; @@ -4280,15 +4250,15 @@ void trInit(void) baseSprite[nSprite].y = sprite[nSprite].y; baseSprite[nSprite].z = sprite[nSprite].z; } - TranslateSector(i, 0, pXSector->busy, pSprite1->x, pSprite1->y, pSprite1->x, pSprite1->y, pSprite1->ang, pSprite2->x, pSprite2->y, pSprite2->ang, pSector->type == 616); + TranslateSector(i, 0, pXSector->busy, pSprite1->x, pSprite1->y, pSprite1->x, pSprite1->y, pSprite1->ang, pSprite2->x, pSprite2->y, pSprite2->ang, pSector->type == kSectorSlide); ZTranslateSector(i, pXSector, pXSector->busy, 1); break; } - case 615: - case 617: + case kSectorRotateMarked: + case kSectorRotate: { - spritetype *pSprite1 = &sprite[pXSector->at2c_0]; - TranslateSector(i, 0, -65536, pSprite1->x, pSprite1->y, pSprite1->x, pSprite1->y, 0, pSprite1->x, pSprite1->y, pSprite1->ang, pSector->type == 617); + spritetype *pSprite1 = &sprite[pXSector->marker0]; + TranslateSector(i, 0, -65536, pSprite1->x, pSprite1->y, pSprite1->x, pSprite1->y, 0, pSprite1->x, pSprite1->y, pSprite1->ang, pSector->type == kSectorRotate); for (int j = 0; j < pSector->wallnum; j++) { baseWall[pSector->wallptr+j].x = wall[pSector->wallptr+j].x; @@ -4300,11 +4270,11 @@ void trInit(void) baseSprite[nSprite].y = sprite[nSprite].y; baseSprite[nSprite].z = sprite[nSprite].z; } - TranslateSector(i, 0, pXSector->busy, pSprite1->x, pSprite1->y, pSprite1->x, pSprite1->y, 0, pSprite1->x, pSprite1->y, pSprite1->ang, pSector->type == 617); + TranslateSector(i, 0, pXSector->busy, pSprite1->x, pSprite1->y, pSprite1->x, pSprite1->y, 0, pSprite1->x, pSprite1->y, pSprite1->ang, pSector->type == kSectorRotate); ZTranslateSector(i, pXSector, pXSector->busy, 1); break; } - case 612: + case kSectorPath: InitPath(i, pXSector); break; default: @@ -4321,38 +4291,35 @@ void trInit(void) XSPRITE *pXSprite = &xsprite[nXSprite]; if (pXSprite->state) pXSprite->busy = 65536; - switch (sprite[i].type) - { - case 23: + switch (sprite[i].type) { + case kSwitchPadlock: pXSprite->triggerOnce = 1; break; - case 40: // Random weapon - case 80: // Random ammo - case kGDXSeqSpawner: - case kGDXObjDataAccumulator: - case kGDXDudeTargetChanger: - case kGDXEffectSpawner: - case kGDXWindGenerator: - case 700: - case 701: - case 702: - case 703: - case 704: - case 705: - case 706: - case 707: - case 708: + case kModernRandom: + case kModernRandom2: + case kModernSeqSpawner: + case kModernObjDataAccumulator: + case kModernDudeTargetChanger: + case kModernEffectSpawner: + case kModernWindGenerator: + case kGenTrigger: + case kGenDripWater: + case kGenDripBlood: + case kGenMissileFireball: + case kGenModernMissileUniversal: + case kGenDart: + case kGenBubble: + case kGenBubbleMulti: + case kGenSound: InitGenerator(i); break; - case 401: - case kGDXThingTNTProx: + case kThingArmedProxBomb: + case kModernThingTNTProx: pXSprite->Proximity = 1; break; - case 414: - if (pXSprite->state) - sprite[i].flags |= 7; - else - sprite[i].flags &= ~7; + case kThingFallingRock: + if (pXSprite->state) sprite[i].flags |= 7; + else sprite[i].flags &= ~7; break; } if (pXSprite->Vector) @@ -4361,15 +4328,15 @@ void trInit(void) sprite[i].cstat |= 4096; } } - evSend(0, 0, 7, COMMAND_ID_1); + evSend(0, 0, 7, kCmdOn); if (gGameOptions.nGameType == 1) - evSend(0, 0, 9, COMMAND_ID_1); + evSend(0, 0, 9, kCmdOn); else if (gGameOptions.nGameType == 2) - evSend(0, 0, 8, COMMAND_ID_1); + evSend(0, 0, 8, kCmdOn); else if (gGameOptions.nGameType == 3) { - evSend(0, 0, 8, COMMAND_ID_1); - evSend(0, 0, 10, COMMAND_ID_1); + evSend(0, 0, 8, kCmdOn); + evSend(0, 0, 10, kCmdOn); } } @@ -4389,44 +4356,44 @@ void InitGenerator(int nSprite) dassert(nXSprite > 0); XSPRITE *pXSprite = &xsprite[nXSprite]; switch (sprite[nSprite].type) { - // By NoOne: intialize GDX generators - case 40: // Random weapon - case 80: // Random ammo - pSprite->cstat &= ~CSTAT_SPRITE_BLOCK; - pSprite->cstat |= CSTAT_SPRITE_INVISIBLE; - if (pXSprite->state != pXSprite->restState) - evPost(nSprite, 3, (120 * pXSprite->busyTime) / 10, COMMAND_ID_21); - return; - case kGDXDudeTargetChanger: - pSprite->cstat &= ~CSTAT_SPRITE_BLOCK; - pSprite->cstat |= CSTAT_SPRITE_INVISIBLE; - if (pXSprite->busyTime <= 0) pXSprite->busyTime = 5; - if (pXSprite->state != pXSprite->restState) - evPost(nSprite, 3, 0, COMMAND_ID_21); - return; - case kGDXEffectSpawner: - case kGDXSeqSpawner: - if (pXSprite->state != pXSprite->restState) - evPost(nSprite, 3, 0, COMMAND_ID_21); - return; - case kGDXObjDataAccumulator: - pSprite->cstat &= ~CSTAT_SPRITE_BLOCK; - pSprite->cstat |= CSTAT_SPRITE_INVISIBLE; - if (pXSprite->state != pXSprite->restState) - evPost(nSprite, 3, 0, COMMAND_ID_21); - return; - case kGDXWindGenerator: - pSprite->cstat &= ~CSTAT_SPRITE_BLOCK; - if (pXSprite->state != pXSprite->restState) - evPost(nSprite, 3, 0, COMMAND_ID_21); - return; - case 700: - pSprite->cstat &= ~CSTAT_SPRITE_BLOCK; - pSprite->cstat |= CSTAT_SPRITE_INVISIBLE; - break; + // By NoOne: intialize modern generators + case kModernRandom: + case kModernRandom2: + pSprite->cstat &= ~CSTAT_SPRITE_BLOCK; + pSprite->cstat |= CSTAT_SPRITE_INVISIBLE; + if (pXSprite->state != pXSprite->restState) + evPost(nSprite, 3, (120 * pXSprite->busyTime) / 10, kCmdRepeat); + return; + case kModernDudeTargetChanger: + pSprite->cstat &= ~CSTAT_SPRITE_BLOCK; + pSprite->cstat |= CSTAT_SPRITE_INVISIBLE; + if (pXSprite->busyTime <= 0) pXSprite->busyTime = 5; + if (pXSprite->state != pXSprite->restState) + evPost(nSprite, 3, 0, kCmdRepeat); + return; + case kModernEffectSpawner: + case kModernSeqSpawner: + if (pXSprite->state != pXSprite->restState) + evPost(nSprite, 3, 0, kCmdRepeat); + return; + case kModernObjDataAccumulator: + pSprite->cstat &= ~CSTAT_SPRITE_BLOCK; + pSprite->cstat |= CSTAT_SPRITE_INVISIBLE; + if (pXSprite->state != pXSprite->restState) + evPost(nSprite, 3, 0, kCmdRepeat); + return; + case kModernWindGenerator: + pSprite->cstat &= ~CSTAT_SPRITE_BLOCK; + if (pXSprite->state != pXSprite->restState) + evPost(nSprite, 3, 0, kCmdRepeat); + return; + case kGenTrigger: + pSprite->cstat &= ~CSTAT_SPRITE_BLOCK; + pSprite->cstat |= CSTAT_SPRITE_INVISIBLE; + break; } if (pXSprite->state != pXSprite->restState && pXSprite->busyTime > 0) - evPost(nSprite, 3, (120*(pXSprite->busyTime+Random2(pXSprite->data1)))/10, COMMAND_ID_21); + evPost(nSprite, 3, (120*(pXSprite->busyTime+Random2(pXSprite->data1)))/10, kCmdRepeat); } void ActivateGenerator(int nSprite) @@ -4438,8 +4405,8 @@ void ActivateGenerator(int nSprite) dassert(nXSprite > 0); XSPRITE *pXSprite = &xsprite[nXSprite]; switch (pSprite->type) { - case 40: // Random weapon - case 80: { // Random ammo + case kModernRandom: + case kModernRandom2: { // let's first search for previously dropped items and remove it if (pXSprite->dropMsg > 0) { for (short nItem = headspritestat[kStatItem]; nItem >= 0; nItem = nextspritestat[nItem]) { @@ -4467,62 +4434,46 @@ void ActivateGenerator(int nSprite) getSpriteMassBySize(pDrop); // create mass cache } } - } break; - case 701: - { + } + case kGenDripWater: + case kGenDripBlood: { int top, bottom; GetSpriteExtents(pSprite, &top, &bottom); - actSpawnThing(pSprite->sectnum, pSprite->x, pSprite->y, bottom, 423); + actSpawnThing(pSprite->sectnum, pSprite->x, pSprite->y, bottom, (pSprite->type == kGenDripWater) ? kThingDripWater : kThingDripBlood); break; } - case 702: - { - int top, bottom; - GetSpriteExtents(pSprite, &top, &bottom); - actSpawnThing(pSprite->sectnum, pSprite->x, pSprite->y, bottom, 424); - break; - } - case 708: - { + case kGenSound: { // By NoOne: allow custom pitch and volume for sounds in SFX gen. - if (VanillaMode()) sfxPlay3DSound(pSprite, pXSprite->data2, -1, 0); + if (!gModernMap) sfxPlay3DSound(pSprite, pXSprite->data2, -1, 0); else { int pitch = pXSprite->data4 << 1; if (pitch < 2000) pitch = 0; sfxPlay3DSoundCP(pSprite, pXSprite->data2, -1, 0, pitch, pXSprite->data3); } break; } - case 703: - switch (pXSprite->data2) - { - case 0: - FireballTrapSeqCallback(3, nXSprite); - break; - case 1: - seqSpawn(35, 3, nXSprite, nFireballTrapClient); - break; - case 2: - seqSpawn(36, 3, nXSprite, nFireballTrapClient); - break; + case kGenMissileFireball: + switch (pXSprite->data2) { + case 0: + FireballTrapSeqCallback(3, nXSprite); + break; + case 1: + seqSpawn(35, 3, nXSprite, nFireballTrapClient); + break; + case 2: + seqSpawn(36, 3, nXSprite, nFireballTrapClient); + break; } break; // By NoOne: EctoSkull gen can now fire any missile - case 704: - UniMissileTrapSeqCallback(3, nXSprite); + case kGenModernMissileUniversal: + if (gModernMap) UniMissileTrapSeqCallback(3, nXSprite); break; - case 706: - { + case kGenBubble: + case kGenBubbleMulti: { int top, bottom; GetSpriteExtents(pSprite, &top, &bottom); - gFX.fxSpawn(FX_23, pSprite->sectnum, pSprite->x, pSprite->y, top, 0); - break; - } - case 707: - { - int top, bottom; - GetSpriteExtents(pSprite, &top, &bottom); - gFX.fxSpawn(FX_26, pSprite->sectnum, pSprite->x, pSprite->y, top, 0); + gFX.fxSpawn((pSprite->type == kGenBubble) ? FX_23 : FX_26, pSprite->sectnum, pSprite->x, pSprite->y, top, 0); break; } } @@ -4534,9 +4485,9 @@ void FireballTrapSeqCallback(int, int nXSprite) int nSprite = pXSprite->reference; spritetype *pSprite = &sprite[nSprite]; if (pSprite->cstat&32) - actFireMissile(pSprite, 0, 0, 0, 0, (pSprite->cstat&8) ? 0x4000 : -0x4000, 305); + actFireMissile(pSprite, 0, 0, 0, 0, (pSprite->cstat&8) ? 0x4000 : -0x4000, kMissileFireball); else - actFireMissile(pSprite, 0, 0, Cos(pSprite->ang)>>16, Sin(pSprite->ang)>>16, 0, 305); + actFireMissile(pSprite, 0, 0, Cos(pSprite->ang)>>16, Sin(pSprite->ang)>>16, 0, kMissileFireball); } // By NoOne: Callback for trap that can fire any missile specified in data1 @@ -4586,8 +4537,8 @@ void UniMissileTrapSeqCallback(int, int nXSprite) } // add bursting for missiles - if (pMissile->type != 303 && pXSprite->data4 > 0) - evPost(pMissile->xvel, 3, (pXSprite->data4 > 500) ? 500 : pXSprite->data4 - 1, CALLBACK_ID_22); + if (pMissile->type != kMissileFlareAlt && pXSprite->data4 > 0) + evPost(pMissile->xvel, 3, (pXSprite->data4 > 500) ? 500 : pXSprite->data4 - 1, kCallbackMissileBurst); } @@ -4604,7 +4555,7 @@ void MGunFireSeqCallback(int, int nXSprite) { pXSprite->data2--; if (pXSprite->data2 == 0) - evPost(nSprite, 3, 1, COMMAND_ID_0); + evPost(nSprite, 3, 1, kCmdOff); } int dx = (Cos(pSprite->ang)>>16)+Random2(1000); int dy = (Sin(pSprite->ang)>>16)+Random2(1000); diff --git a/source/blood/src/triggers.h b/source/blood/src/triggers.h index 14a6acef1..1fea456b7 100644 --- a/source/blood/src/triggers.h +++ b/source/blood/src/triggers.h @@ -31,13 +31,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "dude.h" BEGIN_BLD_NS - -void trTriggerSector(unsigned int nSector, XSECTOR *pXSector, int a3); -void trMessageSector(unsigned int nSector, EVENT a2); -void trTriggerWall(unsigned int nWall, XWALL *pXWall, int a3); -void trMessageWall(unsigned int nWall, EVENT a2); -void trTriggerSprite(unsigned int nSprite, XSPRITE *pXSprite, int a3); -void trMessageSprite(unsigned int nSprite, EVENT a2); +void trTriggerSector(unsigned int nSector, XSECTOR *pXSector, int command); +void trMessageSector(unsigned int nSector, EVENT event); +void trTriggerWall(unsigned int nWall, XWALL *pXWall, int command); +void trMessageWall(unsigned int nWall, EVENT event); +void trTriggerSprite(unsigned int nSprite, XSPRITE *pXSprite, int command); +void trMessageSprite(unsigned int nSprite, EVENT event); void trProcessBusy(void); void trInit(void); void trTextOver(int nId); diff --git a/source/blood/src/view.cpp b/source/blood/src/view.cpp index 1f2dd4d47..2d8ee18a8 100644 --- a/source/blood/src/view.cpp +++ b/source/blood/src/view.cpp @@ -608,7 +608,7 @@ void fakeMoveDude(spritetype *pSprite) if (nSector == -1) nSector = predict.at68; - if (sector[nSector].type >= 612 && sector[nSector].type <= 617) + if (sector[nSector].type >= kSectorPath && sector[nSector].type <= kSectorRotate) { short nSector2 = nSector; 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); } int nAnim = 0; - switch (picanm[nTile].extra&7) - { + switch (picanm[nTile].extra & 7) { case 0: - if (nXSprite > 0) - { - dassert(nXSprite < kMaxXSprites); - switch (pTSprite->type) - { - case 20: - case 21: - if (xsprite[nXSprite].state) - { - nAnim = 1; - } + //dassert(nXSprite > 0 && nXSprite < kMaxXSprites); + if (nXSprite <= 0 || nXSprite >= kMaxXSprites) break; + switch (pTSprite->type) { + case kSwitchToggle: + case kSwitchOneWay: + if (xsprite[nXSprite].state) nAnim = 1; break; - case 22: + case kSwitchCombo: nAnim = xsprite[nXSprite].data1; break; - } } break; 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; } - switch (pTSprite->statnum) - { - case kStatDecoration: - { - switch (pTSprite->type) - { - case 32: - if (pTXSprite) - { - if (pTXSprite->state > 0) - { + switch (pTSprite->statnum) { + case kStatDecoration: { + switch (pTSprite->type) { + case kDecorationCandle: + if (!pTXSprite || pTXSprite->state == 1) { pTSprite->shade = -128; viewAddEffect(nTSprite, VIEW_EFFECT_11); - } - else - { + } else { pTSprite->shade = -8; } - } - else - { - pTSprite->shade = -128; - viewAddEffect(nTSprite, VIEW_EFFECT_11); - } - break; - case 30: - if (pTXSprite) - { - if (pTXSprite->state > 0) - { + break; + case kDecorationTorch: + if (!pTXSprite || pTXSprite->state == 1) { pTSprite->picnum++; viewAddEffect(nTSprite, VIEW_EFFECT_4); - } - else - { + } else { viewAddEffect(nTSprite, VIEW_EFFECT_6); } - } - else - { - pTSprite->picnum++; - viewAddEffect(nTSprite, VIEW_EFFECT_4); - } - break; - default: - if (pXSector && pXSector->color) - { - pTSprite->pal = pSector->floorpal; - } - break; + break; + default: + if (pXSector && pXSector->color) pTSprite->pal = pSector->floorpal; + break; } - break; } - case kStatItem: - { - switch (pTSprite->type) - { - case 145: - if (pTXSprite && pTXSprite->state > 0 && gGameOptions.nGameType == 3) - { - 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; + case kStatItem: { + switch (pTSprite->type) { + case kItemFlagABase: + if (pTXSprite && pTXSprite->state > 0 && gGameOptions.nGameType == 3) { + uspritetype *pNTSprite = viewAddEffect(nTSprite, VIEW_EFFECT_17); + if (pNTSprite) pNTSprite->pal = 10; } - } - viewAddEffect(nTSprite, VIEW_EFFECT_1); - if (pTSprite->type == 301) - { + break; + case kItemFlagBBase: + 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 = §or[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); } - 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); } + break; } - break; - } break; } case kStatDude: { - if (pTSprite->type == 212 && pTXSprite->aiState == &hand13A3B4) + if (pTSprite->type == kDudeHand && pTXSprite->aiState == &hand13A3B4) { spritetype *pTTarget = &sprite[pTXSprite->target]; 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; } - case kStatTraps: - { - if (pTSprite->type == 454) - { - if (pTXSprite->state) - { - if (pTXSprite->data1) - { + case kStatTraps: { + if (pTSprite->type == kTrapSawCircular) { + if (pTXSprite->state) { + if (pTXSprite->data1) { pTSprite->picnum = 772; if (pTXSprite->data2) - { viewAddEffect(nTSprite, VIEW_EFFECT_9); - } } - } - else - { - if (pTXSprite->data1) - { - pTSprite->picnum = 773; - } - else - { - pTSprite->picnum = 656; - } - } + } + else if (pTXSprite->data1) pTSprite->picnum = 773; + else pTSprite->picnum = 656; + } break; } - case kStatThing: - { + case kStatThing: { if (pXSector && pXSector->color) - { 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 = headspritestat[kStatProjectile]; - while (nSprite >= 0) - { + while (nSprite >= 0) { spritetype *pSprite = &sprite[nSprite]; - switch (pSprite->type) - { - case 301: - case 302: - case 303: - case 306: - if (TestBitString(gotsector, pSprite->sectnum)) - { - unk += 256; - } - break; + switch (pSprite->type) { + case kMissileFlareRegular: + case kMissileTeslaAlt: + case kMissileFlareAlt: + case kMissileTeslaRegular: + if (TestBitString(gotsector, pSprite->sectnum)) unk += 256; + break; } nSprite = nextspritestat[nSprite]; } diff --git a/source/blood/src/warp.cpp b/source/blood/src/warp.cpp index 63f8c7cb5..218293a59 100644 --- a/source/blood/src/warp.cpp +++ b/source/blood/src/warp.cpp @@ -51,90 +51,85 @@ void warpInit(void) int team1 = 0; int team2 = 0; // increment if team start positions specified. for (int nSprite = 0; nSprite < kMaxSprites; nSprite++) { - if (sprite[nSprite].statnum < kMaxStatus) - { + if (sprite[nSprite].statnum < kMaxStatus) { spritetype *pSprite = &sprite[nSprite]; int nXSprite = pSprite->extra; - if (nXSprite > 0) - { + if (nXSprite > 0) { XSPRITE *pXSprite = &xsprite[nXSprite]; - switch (pSprite->type) - { - case 1: - if (gGameOptions.nGameType < 2 && pXSprite->data1 >= 0 && pXSprite->data1 < 8) - { - 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]; + switch (pSprite->type) { + case kMarkerSPStart: + if (gGameOptions.nGameType < 2 && pXSprite->data1 >= 0 && pXSprite->data1 < kMaxPlayers) { + 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; - - // 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); - } - break; - case 7: - gUpperLink[pSprite->sectnum] = nSprite; - pSprite->cstat |= 32768; - pSprite->cstat &= ~257; - break; - case 6: - gLowerLink[pSprite->sectnum] = nSprite; - pSprite->cstat |= 32768; - pSprite->cstat &= ~257; - break; - case 9: - case 11: - case 13: - gUpperLink[pSprite->sectnum] = nSprite; - pSprite->cstat |= 32768; - pSprite->cstat &= ~257; - pSprite->z = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y); - break; - case 10: - case 12: - case 14: - gLowerLink[pSprite->sectnum] = nSprite; - pSprite->cstat |= 32768; - pSprite->cstat &= ~257; - pSprite->z = getceilzofslope(pSprite->sectnum, pSprite->x, pSprite->y); - break; + break; + case kMarkerMPStart: + if (pXSprite->data1 >= 0 && pXSprite->data2 < kMaxPlayers) { + if (gGameOptions.nGameType >= 2) { + // default if BB or teams without data2 specified + 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; + + // By NoOne: fill player spawn position according team of player in TEAMS mode. + if (gModernMap && 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); + } + 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; } } } diff --git a/source/blood/src/weapon.cpp b/source/blood/src/weapon.cpp index 3aa34825f..a7af3fcb0 100644 --- a/source/blood/src/weapon.cpp +++ b/source/blood/src/weapon.cpp @@ -979,7 +979,7 @@ void FirePitchfork(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); if (CheckAmmo(pPlayer, 6, 1)) sfxPlay3DSound(pPlayer->pSprite, 441, 1, 2); @@ -992,11 +992,11 @@ void ThrowCan(int, PLAYER *pPlayer) sfxKill3DSound(pPlayer->pSprite, -1, 441); int nSpeed = mulscale16(pPlayer->at1ba, 0x177777)+0x66666; sfxPlay3DSound(pPlayer->pSprite, 455, 1, 0); - spritetype *pSprite = playerFireThing(pPlayer, 0, -9460, 420, nSpeed); + spritetype *pSprite = playerFireThing(pPlayer, 0, -9460, kThingArmedSpray, nSpeed); if (pSprite) { 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; XSPRITE *pXSprite = &xsprite[nXSprite]; pXSprite->Impact = 1; @@ -1008,10 +1008,10 @@ void ThrowCan(int, PLAYER *pPlayer) void DropCan(int, PLAYER *pPlayer) { sfxKill3DSound(pPlayer->pSprite, -1, 441); - spritetype *pSprite = playerFireThing(pPlayer, 0, 0, 420, 0); + spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedSpray, 0); if (pSprite) { - evPost(pSprite->index, 3, pPlayer->at1b2, COMMAND_ID_1); + evPost(pSprite->index, 3, pPlayer->at1b2, kCmdOn); UseAmmo(pPlayer, 6, gAmmoItemData[0].at8); } } @@ -1019,8 +1019,8 @@ void DropCan(int, PLAYER *pPlayer) void ExplodeCan(int, PLAYER *pPlayer) { sfxKill3DSound(pPlayer->pSprite, -1, 441); - spritetype *pSprite = playerFireThing(pPlayer, 0, 0, 420, 0); - evPost(pSprite->index, 3, 0, COMMAND_ID_1); + spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedSpray, 0); + evPost(pSprite->index, 3, 0, kCmdOn); UseAmmo(pPlayer, 6, gAmmoItemData[0].at8); StartQAV(pPlayer, 15, -1); pPlayer->atbd = 0; @@ -1032,13 +1032,13 @@ void ThrowBundle(int, PLAYER *pPlayer) sfxKill3DSound(pPlayer->pSprite, 16, -1); int nSpeed = mulscale16(pPlayer->at1ba, 0x177777)+0x66666; 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; XSPRITE *pXSprite = &xsprite[nXSprite]; if (pPlayer->at1b2 < 0) pXSprite->Impact = 1; else - evPost(pSprite->index, 3, pPlayer->at1b2, COMMAND_ID_1); + evPost(pSprite->index, 3, pPlayer->at1b2, kCmdOn); UseAmmo(pPlayer, 5, 1); pPlayer->at1ba = 0; } @@ -1046,16 +1046,16 @@ void ThrowBundle(int, PLAYER *pPlayer) void DropBundle(int, PLAYER *pPlayer) { sfxKill3DSound(pPlayer->pSprite, 16, -1); - spritetype *pSprite = playerFireThing(pPlayer, 0, 0, 419, 0); - evPost(pSprite->index, 3, pPlayer->at1b2, COMMAND_ID_1); + spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedTNTBundle, 0); + evPost(pSprite->index, 3, pPlayer->at1b2, kCmdOn); UseAmmo(pPlayer, 5, 1); } void ExplodeBundle(int, PLAYER *pPlayer) { sfxKill3DSound(pPlayer->pSprite, 16, -1); - spritetype *pSprite = playerFireThing(pPlayer, 0, 0, 419, 0); - evPost(pSprite->index, 3, 0, COMMAND_ID_1); + spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedTNTBundle, 0); + evPost(pSprite->index, 3, 0, kCmdOn); UseAmmo(pPlayer, 5, 1); StartQAV(pPlayer, 24, -1, 0); pPlayer->atbd = 0; @@ -1066,16 +1066,16 @@ void ThrowProx(int, PLAYER *pPlayer) { int nSpeed = mulscale16(pPlayer->at1ba, 0x177777)+0x66666; sfxPlay3DSound(pPlayer->pSprite, 455, 1, 0); - spritetype *pSprite = playerFireThing(pPlayer, 0, -9460, 401, nSpeed); - evPost(pSprite->index, 3, 240, COMMAND_ID_1); + spritetype *pSprite = playerFireThing(pPlayer, 0, -9460, kThingArmedProxBomb, nSpeed); + evPost(pSprite->index, 3, 240, kCmdOn); UseAmmo(pPlayer, 10, 1); pPlayer->at1ba = 0; } void DropProx(int, PLAYER *pPlayer) { - spritetype *pSprite = playerFireThing(pPlayer, 0, 0, 401, 0); - evPost(pSprite->index, 3, 240, COMMAND_ID_1); + spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedProxBomb, 0); + evPost(pSprite->index, 3, 240, kCmdOn); UseAmmo(pPlayer, 10, 1); } @@ -1083,7 +1083,7 @@ void ThrowRemote(int, PLAYER *pPlayer) { int nSpeed = mulscale16(pPlayer->at1ba, 0x177777)+0x66666; 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; XSPRITE *pXSprite = &xsprite[nXSprite]; pXSprite->rxID = 90+(pPlayer->pSprite->type-kDudePlayer1); @@ -1093,7 +1093,7 @@ void ThrowRemote(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; XSPRITE *pXSprite = &xsprite[nXSprite]; pXSprite->rxID = 90+(pPlayer->pSprite->type-kDudePlayer1); @@ -1102,7 +1102,7 @@ void DropRemote(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 @@ -1305,7 +1305,7 @@ void FireFlare(int nTrigger, PLAYER *pPlayer) offset = 120; 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); sfxPlay3DSound(pSprite, 420, 2, 0); pPlayer->at362 = 30; @@ -1325,7 +1325,7 @@ void AltFireFlare(int nTrigger, PLAYER *pPlayer) offset = 120; 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); sfxPlay3DSound(pSprite, 420, 2, 0); pPlayer->at362 = 45; @@ -1361,7 +1361,7 @@ void FireVoodoo(int nTrigger, PLAYER *pPlayer) sfxPlay3DSound(pSprite, 460, 2, 0); fxSpawnBlood(pTarget, 17<<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]); UseAmmo(pPlayer, 9, nDamage/4); break; @@ -1379,9 +1379,9 @@ void FireVoodoo(int nTrigger, PLAYER *pPlayer) sfxPlay3DSound(pSprite, 460, 2, 0); fxSpawnBlood(pTarget, 17<<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; } UseAmmo(pPlayer, 9, nDamage/4); @@ -1415,7 +1415,7 @@ void AltFireVoodoo(int nTrigger, PLAYER *pPlayer) nDamage = (nDamage * ((51200 - nDist) + 1)) / 51200; 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]; if (!pOtherPlayer->at31a || !powerupCheck(pOtherPlayer, 14)) @@ -1453,7 +1453,7 @@ void AltFireVoodoo(int nTrigger, PLAYER *pPlayer) nDamage = (nDamage * ((51200 - nDist) + 1)) / 51200; nDamage = actDamageSprite(pPlayer->at5b, pTarget, DAMAGE_TYPE_5, nDamage); UseAmmo(pPlayer, 9, nDamage); - if (pTarget->type >= kDudePlayer1 && pTarget->type <= kDudePlayer8) + if (IsPlayerSprite(pTarget)) { PLAYER* pOtherPlayer = &gPlayer[pTarget->type - kDudePlayer1]; if (!pOtherPlayer->at31a || !powerupCheck(pOtherPlayer, 14)) @@ -1473,13 +1473,13 @@ void DropVoodoo(int nTrigger, PLAYER *pPlayer) { UNREFERENCED_PARAMETER(nTrigger); sfxPlay3DSound(pPlayer->pSprite, 455, 2, 0); - spritetype *pSprite = playerFireThing(pPlayer, 0, -4730, 432, 0xccccc); + spritetype *pSprite = playerFireThing(pPlayer, 0, -4730, kThingVoodooHead, 0xccccc); if (pSprite) { int nXSprite = pSprite->extra; XSPRITE *pXSprite = &xsprite[nXSprite]; 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, 9, pPlayer->at181[9]); pPlayer->atcb[10] = 0; @@ -1535,7 +1535,7 @@ void AltFireTesla(int nTrigger, PLAYER *pPlayer) { UNREFERENCED_PARAMETER(nTrigger); 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); sfxPlay3DSound(pSprite, 471, 2, 0); pPlayer->at362 = 40; @@ -1555,7 +1555,7 @@ void FireNapalm(int nTrigger, PLAYER *pPlayer) offset = 50; 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); UseAmmo(pPlayer, 4, 1); pPlayer->at37b = 1; @@ -1565,8 +1565,8 @@ void FireNapalm2(int nTrigger, PLAYER *pPlayer) { UNREFERENCED_PARAMETER(nTrigger); 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, 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, kMissileFireballNapam); sfxPlay3DSound(pSprite, 480, 2, 0); UseAmmo(pPlayer, 4, 2); pPlayer->at37b = 1; @@ -1577,7 +1577,7 @@ void AltFireNapalm(int nTrigger, PLAYER *pPlayer) UNREFERENCED_PARAMETER(nTrigger); char UNUSED(bAkimbo) = powerupCheck(pPlayer, 17); int nSpeed = mulscale16(0x8000, 0x177777)+0x66666; - spritetype *pMissile = playerFireThing(pPlayer, 0, -4730, 428, nSpeed); + spritetype *pMissile = playerFireThing(pPlayer, 0, -4730, kThingNapalmBall, nSpeed); if (pMissile) { XSPRITE *pXSprite = &xsprite[pMissile->extra]; @@ -1585,7 +1585,7 @@ void AltFireNapalm(int nTrigger, PLAYER *pPlayer) UseAmmo(pPlayer, 4, pXSprite->data4); seqSpawn(22, 3, pMissile->extra, -1); 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); pPlayer->at362 = 30; pPlayer->at37b = 1; @@ -1617,7 +1617,7 @@ void AltFireLifeLeech(int nTrigger, PLAYER *pPlayer) { UNREFERENCED_PARAMETER(nTrigger); sfxPlay3DSound(pPlayer->pSprite, 455, 2, 0); - spritetype *pMissile = playerFireThing(pPlayer, 0, -4730, 431, 0x19999); + spritetype *pMissile = playerFireThing(pPlayer, 0, -4730, kThingDroppedLifeLeech, 0x19999); if (pMissile) { pMissile->cstat |= 4096; @@ -1627,7 +1627,7 @@ void AltFireLifeLeech(int nTrigger, PLAYER *pPlayer) pXSprite->DudeLockout = 1; pXSprite->data4 = ClipHigh(pPlayer->at181[4], 12); pXSprite->stateTimer = 1; - evPost(pMissile->index, 3, 120, CALLBACK_ID_20); + evPost(pMissile->index, 3, 120, kCallbackLeechStateTimer); if (gGameOptions.nGameType <= 1) { int nAmmo = pPlayer->at181[8];