2019-09-19 22:42:45 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2010-2019 EDuke32 developers and contributors
|
|
|
|
Copyright (C) 2019 Nuke.YKT
|
|
|
|
|
|
|
|
This file is part of NBlood.
|
|
|
|
|
|
|
|
NBlood is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2019-09-21 18:59:54 +00:00
|
|
|
#include "ns.h" // Must come before everything else!
|
|
|
|
|
2019-09-19 22:42:45 +00:00
|
|
|
#include "build.h"
|
|
|
|
#include "blood.h"
|
2020-12-05 17:32:49 +00:00
|
|
|
#include "bloodactor.h"
|
2019-09-19 22:42:45 +00:00
|
|
|
|
2019-09-22 06:39:22 +00:00
|
|
|
BEGIN_BLD_NS
|
|
|
|
|
2019-09-21 11:02:17 +00:00
|
|
|
|
2019-10-11 21:59:39 +00:00
|
|
|
void fxFlameLick(int nSprite) // 0
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
spritetype *pSprite = &sprite[nSprite];
|
|
|
|
int nXSprite = pSprite->extra;
|
|
|
|
XSPRITE *pXSprite = &xsprite[nXSprite];
|
|
|
|
int top, bottom;
|
|
|
|
GetSpriteExtents(pSprite, &top, &bottom);
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
{
|
2020-11-22 23:18:07 +00:00
|
|
|
int nDist = (pSprite->xrepeat*(tileWidth(pSprite->picnum)/2))>>3;
|
2019-09-19 22:42:45 +00:00
|
|
|
int nAngle = Random(2048);
|
2021-01-04 11:36:54 +00:00
|
|
|
int dx = MulScale(nDist, Cos(nAngle), 30);
|
|
|
|
int dy = MulScale(nDist, Sin(nAngle), 30);
|
2019-09-19 22:42:45 +00:00
|
|
|
int x = pSprite->x + dx;
|
|
|
|
int y = pSprite->y + dy;
|
|
|
|
int z = bottom-Random(bottom-top);
|
|
|
|
spritetype *pFX = gFX.fxSpawn(FX_32, pSprite->sectnum, x, y, z, 0);
|
|
|
|
if (pFX)
|
|
|
|
{
|
|
|
|
xvel[pFX->index] = xvel[nSprite] + Random2(-dx);
|
|
|
|
yvel[pFX->index] = yvel[nSprite] + Random2(-dy);
|
|
|
|
zvel[pFX->index] = zvel[nSprite] - Random(0x1aaaa);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (pXSprite->burnTime > 0)
|
2019-10-11 21:59:39 +00:00
|
|
|
evPost(nSprite, 3, 5, kCallbackFXFlameLick);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Remove(int nSprite) // 1
|
|
|
|
{
|
|
|
|
spritetype *pSprite = &sprite[nSprite];
|
|
|
|
evKill(nSprite, 3);
|
|
|
|
if (pSprite->extra > 0)
|
|
|
|
seqKill(3, pSprite->extra);
|
|
|
|
sfxKill3DSound(pSprite, 0, -1);
|
|
|
|
DeleteSprite(nSprite);
|
|
|
|
}
|
|
|
|
|
|
|
|
void FlareBurst(int nSprite) // 2
|
|
|
|
{
|
2020-10-11 10:38:17 +00:00
|
|
|
assert(nSprite >= 0 && nSprite < kMaxSprites);
|
2020-12-05 17:32:49 +00:00
|
|
|
auto actor = &bloodActors[nSprite];
|
2019-09-19 22:42:45 +00:00
|
|
|
spritetype *pSprite = &sprite[nSprite];
|
|
|
|
int nAngle = getangle(xvel[nSprite], yvel[nSprite]);
|
|
|
|
int nRadius = 0x55555;
|
|
|
|
for (int i = 0; i < 8; i++)
|
|
|
|
{
|
2020-12-05 17:32:49 +00:00
|
|
|
spritetype *pSpawn = &actSpawnSprite(actor, 5)->s();
|
2019-09-19 22:42:45 +00:00
|
|
|
pSpawn->picnum = 2424;
|
|
|
|
pSpawn->shade = -128;
|
|
|
|
pSpawn->xrepeat = pSpawn->yrepeat = 32;
|
2019-10-11 21:59:39 +00:00
|
|
|
pSpawn->type = kMissileFlareAlt;
|
2019-09-19 22:42:45 +00:00
|
|
|
pSpawn->clipdist = 2;
|
|
|
|
pSpawn->owner = pSprite->owner;
|
|
|
|
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[pSpawn->index] += dx;
|
|
|
|
yvel[pSpawn->index] += dy;
|
|
|
|
zvel[pSpawn->index] += dz;
|
2019-10-11 21:59:39 +00:00
|
|
|
evPost(pSpawn->index, 3, 960, kCallbackRemove);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
2019-10-11 21:59:39 +00:00
|
|
|
evPost(nSprite, 3, 0, kCallbackRemove);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
2019-10-11 21:59:39 +00:00
|
|
|
void fxFlareSpark(int nSprite) // 3
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
spritetype *pSprite = &sprite[nSprite];
|
|
|
|
spritetype *pFX = gFX.fxSpawn(FX_28, 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);
|
|
|
|
}
|
2019-10-11 21:59:39 +00:00
|
|
|
evPost(nSprite, 3, 4, kCallbackFXFlareSpark);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
2019-10-11 21:59:39 +00:00
|
|
|
void fxFlareSparkLite(int nSprite) // 4
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
spritetype *pSprite = &sprite[nSprite];
|
|
|
|
spritetype *pFX = gFX.fxSpawn(FX_28, 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);
|
|
|
|
}
|
2019-10-11 21:59:39 +00:00
|
|
|
evPost(nSprite, 3, 12, kCallbackFXFlareSparkLite);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
2019-10-11 21:59:39 +00:00
|
|
|
void fxZombieBloodSpurt(int nSprite) // 5
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2020-10-11 10:38:17 +00:00
|
|
|
assert(nSprite >= 0 && nSprite < kMaxSprites);
|
2019-09-19 22:42:45 +00:00
|
|
|
spritetype *pSprite = &sprite[nSprite];
|
|
|
|
int nXSprite = pSprite->extra;
|
2020-10-11 10:38:17 +00:00
|
|
|
assert(nXSprite > 0 && nXSprite < kMaxXSprites);
|
2019-09-19 22:42:45 +00:00
|
|
|
XSPRITE *pXSprite = &xsprite[nXSprite];
|
|
|
|
int top, bottom;
|
|
|
|
GetSpriteExtents(pSprite, &top, &bottom);
|
|
|
|
spritetype *pFX = gFX.fxSpawn(FX_27, pSprite->sectnum, pSprite->x, pSprite->y, top, 0);
|
|
|
|
if (pFX)
|
|
|
|
{
|
|
|
|
xvel[pFX->index] = xvel[nSprite] + Random2(0x11111);
|
|
|
|
yvel[pFX->index] = yvel[nSprite] + Random2(0x11111);
|
|
|
|
zvel[pFX->index] = zvel[nSprite] - 0x6aaaa;
|
|
|
|
}
|
|
|
|
if (pXSprite->data1 > 0)
|
|
|
|
{
|
2019-10-11 21:59:39 +00:00
|
|
|
evPost(nSprite, 3, 4, kCallbackFXZombieSpurt);
|
2019-09-19 22:42:45 +00:00
|
|
|
pXSprite->data1 -= 4;
|
|
|
|
}
|
|
|
|
else if (pXSprite->data2 > 0)
|
|
|
|
{
|
2019-10-11 21:59:39 +00:00
|
|
|
evPost(nSprite, 3, 60, kCallbackFXZombieSpurt);
|
2019-09-19 22:42:45 +00:00
|
|
|
pXSprite->data1 = 40;
|
|
|
|
pXSprite->data2--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-11 21:59:39 +00:00
|
|
|
void fxBloodSpurt(int nSprite) // 6
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
spritetype *pSprite = &sprite[nSprite];
|
|
|
|
spritetype *pFX = gFX.fxSpawn(FX_27, 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;
|
|
|
|
}
|
2019-10-11 21:59:39 +00:00
|
|
|
evPost(nSprite, 3, 6, kCallbackFXBloodSpurt);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
2019-10-11 21:59:39 +00:00
|
|
|
|
|
|
|
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
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
spritetype *pSprite = &sprite[nSprite];
|
|
|
|
if (zvel[nSprite])
|
|
|
|
{
|
2020-11-22 23:18:07 +00:00
|
|
|
int nDist = (pSprite->xrepeat*(tileWidth(pSprite->picnum)/2))>>2;
|
2021-01-04 11:36:54 +00:00
|
|
|
int x = pSprite->x + MulScale(nDist, Cos(pSprite->ang-512), 30);
|
|
|
|
int y = pSprite->y + MulScale(nDist, Sin(pSprite->ang-512), 30);
|
2019-09-19 22:42:45 +00:00
|
|
|
int z = pSprite->z;
|
|
|
|
spritetype *pFX = gFX.fxSpawn(FX_7, pSprite->sectnum, x, y, z, 0);
|
|
|
|
if (pFX)
|
|
|
|
{
|
|
|
|
xvel[pFX->index] = xvel[nSprite];
|
|
|
|
yvel[pFX->index] = yvel[nSprite];
|
|
|
|
zvel[pFX->index] = zvel[nSprite];
|
|
|
|
}
|
|
|
|
}
|
2019-10-11 21:59:39 +00:00
|
|
|
evPost(nSprite, 3, 12, kCallbackFXDynPuff);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Respawn(int nSprite) // 9
|
|
|
|
{
|
2021-08-30 18:21:49 +00:00
|
|
|
auto actor = &bloodActors[nSprite];
|
2019-09-19 22:42:45 +00:00
|
|
|
spritetype *pSprite = &sprite[nSprite];
|
2020-10-11 10:38:17 +00:00
|
|
|
assert(pSprite->extra > 0 && pSprite->extra < kMaxXSprites);
|
2019-10-12 20:45:46 +00:00
|
|
|
XSPRITE *pXSprite = &xsprite[pSprite->extra];
|
|
|
|
|
|
|
|
if (pSprite->statnum != kStatRespawn && pSprite->statnum != kStatThing) {
|
|
|
|
viewSetSystemMessage("Sprite #%d is not on Respawn or Thing list\n", nSprite);
|
|
|
|
return;
|
|
|
|
} else if (!(pSprite->flags & kHitagRespawn)) {
|
|
|
|
viewSetSystemMessage("Sprite #%d does not have the respawn attribute\n", nSprite);
|
|
|
|
return;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
2019-10-12 20:45:46 +00:00
|
|
|
|
|
|
|
switch (pXSprite->respawnPending) {
|
|
|
|
case 1: {
|
2021-08-30 18:21:49 +00:00
|
|
|
int nTime = MulScale(actGetRespawnTime(actor), 0x4000, 16);
|
2019-10-12 20:45:46 +00:00
|
|
|
pXSprite->respawnPending = 2;
|
|
|
|
evPost(nSprite, 3, nTime, kCallbackRespawn);
|
|
|
|
break;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
2019-10-12 20:45:46 +00:00
|
|
|
case 2: {
|
2021-08-30 18:21:49 +00:00
|
|
|
int nTime = MulScale(actGetRespawnTime(actor), 0x2000, 16);
|
2019-10-12 20:45:46 +00:00
|
|
|
pXSprite->respawnPending = 3;
|
|
|
|
evPost(nSprite, 3, nTime, kCallbackRespawn);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 3: {
|
2020-10-11 10:38:17 +00:00
|
|
|
assert(pSprite->owner != kStatRespawn);
|
|
|
|
assert(pSprite->owner >= 0 && pSprite->owner < kMaxStatus);
|
2019-10-12 20:45:46 +00:00
|
|
|
ChangeSpriteStat(nSprite, pSprite->owner);
|
|
|
|
pSprite->type = pSprite->inittype;
|
|
|
|
pSprite->owner = -1;
|
2019-10-15 12:36:50 +00:00
|
|
|
pSprite->flags &= ~kHitagRespawn;
|
2019-10-12 20:45:46 +00:00
|
|
|
xvel[nSprite] = yvel[nSprite] = zvel[nSprite] = 0;
|
|
|
|
pXSprite->respawnPending = 0;
|
|
|
|
pXSprite->burnTime = 0;
|
|
|
|
pXSprite->isTriggered = 0;
|
|
|
|
if (IsDudeSprite(pSprite)) {
|
|
|
|
int nType = pSprite->type-kDudeBase;
|
|
|
|
pSprite->x = baseSprite[nSprite].x;
|
|
|
|
pSprite->y = baseSprite[nSprite].y;
|
|
|
|
pSprite->z = baseSprite[nSprite].z;
|
|
|
|
pSprite->cstat |= 0x1101;
|
2020-04-07 20:30:00 +00:00
|
|
|
#ifdef NOONE_EXTENSIONS
|
|
|
|
if (!gModernMap || pXSprite->sysData2 <= 0) pXSprite->health = dudeInfo[pSprite->type - kDudeBase].startHealth << 4;
|
|
|
|
else pXSprite->health = ClipRange(pXSprite->sysData2 << 4, 1, 65535);
|
2020-12-06 20:56:09 +00:00
|
|
|
|
2020-04-04 19:48:23 +00:00
|
|
|
switch (pSprite->type) {
|
|
|
|
default:
|
|
|
|
pSprite->clipdist = getDudeInfo(nType + kDudeBase)->clipdist;
|
2020-07-25 20:47:46 +00:00
|
|
|
if (getSequence(getDudeInfo(nType + kDudeBase)->seqStartID))
|
2020-04-04 19:48:23 +00:00
|
|
|
seqSpawn(getDudeInfo(nType + kDudeBase)->seqStartID, 3, pSprite->extra, -1);
|
|
|
|
break;
|
|
|
|
case kDudeModernCustom:
|
|
|
|
seqSpawn(genDudeSeqStartId(pXSprite), 3, pSprite->extra, -1);
|
|
|
|
break;
|
|
|
|
}
|
2020-12-06 20:56:09 +00:00
|
|
|
|
|
|
|
// return dude to the patrol state
|
|
|
|
if (gModernMap && pXSprite->dudeFlag4) {
|
|
|
|
pXSprite->data3 = 0;
|
|
|
|
pXSprite->target = -1;
|
|
|
|
}
|
2020-04-07 20:30:00 +00:00
|
|
|
#else
|
|
|
|
pSprite->clipdist = getDudeInfo(nType + kDudeBase)->clipdist;
|
|
|
|
pXSprite->health = getDudeInfo(nType + kDudeBase)->startHealth << 4;
|
2020-07-25 20:47:46 +00:00
|
|
|
if (getSequence(getDudeInfo(nType + kDudeBase)->seqStartID))
|
2020-04-07 20:30:00 +00:00
|
|
|
seqSpawn(getDudeInfo(nType + kDudeBase)->seqStartID, 3, pSprite->extra, -1);
|
|
|
|
#endif
|
2019-10-12 20:45:46 +00:00
|
|
|
aiInitSprite(pSprite);
|
|
|
|
pXSprite->key = 0;
|
|
|
|
} else if (pSprite->type == kThingTNTBarrel) {
|
|
|
|
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);
|
|
|
|
break;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void PlayerBubble(int nSprite) // 10
|
|
|
|
{
|
|
|
|
spritetype *pSprite = &sprite[nSprite];
|
|
|
|
if (IsPlayerSprite(pSprite))
|
|
|
|
{
|
|
|
|
PLAYER *pPlayer = &gPlayer[pSprite->type-kDudePlayer1];
|
2020-10-11 10:38:17 +00:00
|
|
|
assert(pPlayer != NULL);
|
2019-10-21 19:46:41 +00:00
|
|
|
if (!pPlayer->bubbleTime)
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
|
|
|
int top, bottom;
|
|
|
|
GetSpriteExtents(pSprite, &top, &bottom);
|
2019-10-21 19:46:41 +00:00
|
|
|
for (int i = 0; i < (pPlayer->bubbleTime>>6); i++)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2020-11-22 23:18:07 +00:00
|
|
|
int nDist = (pSprite->xrepeat*(tileWidth(pSprite->picnum)/2))>>2;
|
2019-09-19 22:42:45 +00:00
|
|
|
int nAngle = Random(2048);
|
2021-01-04 11:36:54 +00:00
|
|
|
int x = pSprite->x + MulScale(nDist, Cos(nAngle), 30);
|
|
|
|
int y = pSprite->y + MulScale(nDist, Sin(nAngle), 30);
|
2019-09-19 22:42:45 +00:00
|
|
|
int z = bottom-Random(bottom-top);
|
|
|
|
spritetype *pFX = gFX.fxSpawn((FX_ID)(FX_23+Random(3)), pSprite->sectnum, x, y, z, 0);
|
|
|
|
if (pFX)
|
|
|
|
{
|
|
|
|
xvel[pFX->index] = xvel[nSprite] + Random2(0x1aaaa);
|
|
|
|
yvel[pFX->index] = yvel[nSprite] + Random2(0x1aaaa);
|
|
|
|
zvel[pFX->index] = zvel[nSprite] + Random2(0x1aaaa);
|
|
|
|
}
|
|
|
|
}
|
2019-10-11 21:59:39 +00:00
|
|
|
evPost(nSprite, 3, 4, kCallbackPlayerBubble);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void EnemyBubble(int nSprite) // 11
|
|
|
|
{
|
|
|
|
spritetype *pSprite = &sprite[nSprite];
|
|
|
|
int top, bottom;
|
|
|
|
GetSpriteExtents(pSprite, &top, &bottom);
|
2021-01-04 12:02:00 +00:00
|
|
|
for (int i = 0; i < (abs(zvel[nSprite])>>18); i++)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2020-11-22 23:18:07 +00:00
|
|
|
int nDist = (pSprite->xrepeat*(tileWidth(pSprite->picnum)/2))>>2;
|
2019-09-19 22:42:45 +00:00
|
|
|
int nAngle = Random(2048);
|
2021-01-04 11:36:54 +00:00
|
|
|
int x = pSprite->x + MulScale(nDist, Cos(nAngle), 30);
|
|
|
|
int y = pSprite->y + MulScale(nDist, Sin(nAngle), 30);
|
2019-09-19 22:42:45 +00:00
|
|
|
int z = bottom-Random(bottom-top);
|
|
|
|
spritetype *pFX = gFX.fxSpawn((FX_ID)(FX_23+Random(3)), pSprite->sectnum, x, y, z, 0);
|
|
|
|
if (pFX)
|
|
|
|
{
|
|
|
|
xvel[pFX->index] = xvel[nSprite] + Random2(0x1aaaa);
|
|
|
|
yvel[pFX->index] = yvel[nSprite] + Random2(0x1aaaa);
|
|
|
|
zvel[pFX->index] = zvel[nSprite] + Random2(0x1aaaa);
|
|
|
|
}
|
|
|
|
}
|
2019-10-11 21:59:39 +00:00
|
|
|
evPost(nSprite, 3, 4, kCallbackEnemeyBubble);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CounterCheck(int nSector) // 12
|
|
|
|
{
|
2020-10-11 10:38:17 +00:00
|
|
|
assert(nSector >= 0 && nSector < kMaxSectors);
|
2020-01-26 11:19:01 +00:00
|
|
|
if (sector[nSector].type != kSectorCounter) return;
|
2019-12-05 20:42:35 +00:00
|
|
|
if (sector[nSector].extra <= 0) return;
|
|
|
|
|
|
|
|
XSECTOR *pXSector = &xsector[sector[nSector].extra];
|
2019-10-11 21:59:39 +00:00
|
|
|
int nReq = pXSector->waitTimeA; int nType = pXSector->data; int nCount = 0;
|
|
|
|
if (!nType || !nReq) return;
|
|
|
|
|
2020-10-15 14:59:43 +00:00
|
|
|
int nSprite;
|
|
|
|
SectIterator it(nSector);
|
|
|
|
while ((nSprite = it.NextIndex()) >= 0)
|
|
|
|
{
|
2019-10-11 21:59:39 +00:00
|
|
|
if (sprite[nSprite].type == nType) nCount++;
|
2019-10-20 15:09:01 +00:00
|
|
|
}
|
2019-10-11 21:59:39 +00:00
|
|
|
|
|
|
|
if (nCount < nReq) {
|
|
|
|
evPost(nSector, 6, 5, kCallbackCounterCheck);
|
|
|
|
return;
|
|
|
|
} else {
|
2019-10-20 15:09:01 +00:00
|
|
|
//pXSector->waitTimeA = 0; //do not reset necessary objects counter to zero
|
2020-01-11 21:07:05 +00:00
|
|
|
trTriggerSector(nSector, pXSector, kCmdOn);
|
2019-10-20 15:09:01 +00:00
|
|
|
pXSector->locked = 1; //lock sector, so it can be opened again later
|
|
|
|
}
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
2019-10-11 21:59:39 +00:00
|
|
|
|
|
|
|
void FinishHim(int nSprite) // 13
|
|
|
|
{
|
|
|
|
spritetype* pSprite = &sprite[nSprite];
|
|
|
|
int nXSprite = pSprite->extra;
|
|
|
|
XSPRITE* pXSprite = &xsprite[nXSprite];
|
2020-02-06 08:48:45 +00:00
|
|
|
if (IsPlayerSprite(pSprite) && playerSeqPlaying(&gPlayer[pSprite->type - kDudePlayer1], 16) && pXSprite->target == gMe->nSprite)
|
2019-10-11 21:59:39 +00:00
|
|
|
sndStartSample(3313, -1, 1, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void fxBloodBits(int nSprite) // 14
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
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 nAngle = Random(2048);
|
|
|
|
int nDist = Random(16)<<4;
|
2021-01-04 11:36:54 +00:00
|
|
|
int x = pSprite->x+MulScale(nDist, Cos(nAngle), 28);
|
|
|
|
int y = pSprite->y+MulScale(nDist, Sin(nAngle), 28);
|
2019-09-19 22:42:45 +00:00
|
|
|
gFX.fxSpawn(FX_48, pSprite->sectnum, x, y, pSprite->z, 0);
|
|
|
|
if (pSprite->ang == 1024)
|
|
|
|
{
|
|
|
|
int nChannel = 28+(pSprite->index&2);
|
2020-10-11 10:38:17 +00:00
|
|
|
assert(nChannel < 32);
|
2019-09-19 22:42:45 +00:00
|
|
|
sfxPlay3DSound(pSprite, 385, nChannel, 1);
|
|
|
|
}
|
|
|
|
if (Chance(0x5000))
|
|
|
|
{
|
|
|
|
spritetype *pFX = gFX.fxSpawn(FX_36, pSprite->sectnum, x, y, floorZ-64, 0);
|
|
|
|
if (pFX)
|
|
|
|
pFX->ang = nAngle;
|
|
|
|
}
|
2020-11-21 19:10:45 +00:00
|
|
|
gFX.remove(nSprite);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
2019-10-11 21:59:39 +00:00
|
|
|
|
|
|
|
void fxTeslaAlt(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, kCallbackFXTeslaAlt);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int tommySleeveSnd[] = { 608, 609, 611 }; // unused?
|
|
|
|
int sawedOffSleeveSnd[] = { 610, 612 };
|
|
|
|
|
|
|
|
void fxBouncingSleeve(int nSprite) // 16
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-11 21:59:39 +00:00
|
|
|
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;
|
2021-01-04 12:02:00 +00:00
|
|
|
if (velFloor[pSprite->sectnum] == 0 && abs(zvel[nSprite]) < 0x20000) {
|
2019-10-11 21:59:39 +00:00
|
|
|
sleeveStopBouncing(pSprite);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int nChannel = 28 + (pSprite->index & 2);
|
2020-10-11 10:38:17 +00:00
|
|
|
assert(nChannel < 32);
|
2019-10-11 21:59:39 +00:00
|
|
|
|
|
|
|
// 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) {
|
2019-09-19 22:42:45 +00:00
|
|
|
xvel[pSprite->index] = yvel[pSprite->index] = zvel[pSprite->index] = 0;
|
2019-10-11 21:59:39 +00:00
|
|
|
if (pSprite->extra > 0) seqKill(3, pSprite->extra);
|
2019-09-19 22:42:45 +00:00
|
|
|
sfxKill3DSound(pSprite, -1, -1);
|
2019-10-11 21:59:39 +00:00
|
|
|
|
|
|
|
switch (pSprite->type) {
|
2019-09-19 22:42:45 +00:00
|
|
|
case 37:
|
|
|
|
case 38:
|
|
|
|
case 39:
|
|
|
|
pSprite->picnum = 2465;
|
|
|
|
break;
|
|
|
|
case 40:
|
|
|
|
case 41:
|
|
|
|
case 42:
|
|
|
|
pSprite->picnum = 2464;
|
|
|
|
break;
|
|
|
|
}
|
2019-10-11 21:59:39 +00:00
|
|
|
|
2019-09-19 22:42:45 +00:00
|
|
|
pSprite->type = 51;
|
|
|
|
pSprite->xrepeat = pSprite->yrepeat = 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-10-11 21:59:39 +00:00
|
|
|
void returnFlagToBase(int nSprite) // 17
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-11 21:59:39 +00:00
|
|
|
spritetype* pSprite = &sprite[nSprite];
|
2019-09-19 22:42:45 +00:00
|
|
|
if (pSprite->owner >= 0 && pSprite->owner < kMaxSprites)
|
|
|
|
{
|
2019-10-11 21:59:39 +00:00
|
|
|
spritetype* pOwner = &sprite[pSprite->owner];
|
|
|
|
XSPRITE* pXOwner = &xsprite[pOwner->extra];
|
|
|
|
switch (pSprite->type) {
|
|
|
|
case kItemFlagA:
|
2020-01-11 21:07:05 +00:00
|
|
|
trTriggerSprite(pOwner->index, pXOwner, kCmdOn);
|
2019-10-20 15:09:01 +00:00
|
|
|
sndStartSample(8003, 255, 2, 0);
|
|
|
|
gBlueFlagDropped = false;
|
|
|
|
viewSetMessage("Blue Flag returned to base.");
|
|
|
|
break;
|
2019-10-11 21:59:39 +00:00
|
|
|
case kItemFlagB:
|
2020-01-11 21:07:05 +00:00
|
|
|
trTriggerSprite(pOwner->index, pXOwner, kCmdOn);
|
2019-10-20 15:09:01 +00:00
|
|
|
sndStartSample(8002, 255, 2, 0);
|
|
|
|
gRedFlagDropped = false;
|
|
|
|
viewSetMessage("Red Flag returned to base.");
|
|
|
|
break;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
}
|
2019-10-11 21:59:39 +00:00
|
|
|
evPost(pSprite->index, 3, 0, kCallbackRemove);
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
2019-10-11 21:59:39 +00:00
|
|
|
void fxPodBloodSplat(int nSprite) // 19
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
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 nAngle = Random(2048);
|
|
|
|
int nDist = Random(16)<<4;
|
2021-01-04 11:36:54 +00:00
|
|
|
int x = pSprite->x+MulScale(nDist, Cos(nAngle), 28);
|
|
|
|
int y = pSprite->y+MulScale(nDist, Sin(nAngle), 28);
|
2019-09-19 22:42:45 +00:00
|
|
|
if (pSprite->ang == 1024)
|
|
|
|
{
|
|
|
|
int nChannel = 28+(pSprite->index&2);
|
2020-10-11 10:38:17 +00:00
|
|
|
assert(nChannel < 32);
|
2019-09-19 22:42:45 +00:00
|
|
|
sfxPlay3DSound(pSprite, 385, nChannel, 1);
|
|
|
|
}
|
|
|
|
spritetype *pFX = NULL;
|
2019-11-08 19:57:01 +00:00
|
|
|
if (pSprite->type == 53 || pSprite->type == kThingPodGreenBall)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-11-08 19:57:01 +00:00
|
|
|
if (Chance(0x500) || pSprite->type == kThingPodGreenBall)
|
2019-09-19 22:42:45 +00:00
|
|
|
pFX = gFX.fxSpawn(FX_55, pSprite->sectnum, x, y, floorZ-64, 0);
|
|
|
|
if (pFX)
|
|
|
|
pFX->ang = nAngle;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pFX = gFX.fxSpawn(FX_32, pSprite->sectnum, x, y, floorZ-64, 0);
|
|
|
|
if (pFX)
|
|
|
|
pFX->ang = nAngle;
|
|
|
|
}
|
2020-11-21 19:10:45 +00:00
|
|
|
gFX.remove(nSprite);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-10-11 21:59:39 +00:00
|
|
|
|
|
|
|
void LeechStateTimer(int nSprite) // 20
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
spritetype *pSprite = &sprite[nSprite];
|
2019-10-07 19:29:52 +00:00
|
|
|
if (pSprite->statnum == kStatThing && !(pSprite->flags & 32)) {
|
2019-09-30 07:18:01 +00:00
|
|
|
switch (pSprite->type) {
|
2019-10-11 21:59:39 +00:00
|
|
|
case kThingDroppedLifeLeech:
|
2020-01-26 11:19:01 +00:00
|
|
|
#ifdef NOONE_EXTENSIONS
|
2019-10-11 21:59:39 +00:00
|
|
|
case kModernThingEnemyLifeLeech:
|
2020-01-26 11:19:01 +00:00
|
|
|
#endif
|
2019-09-19 22:42:45 +00:00
|
|
|
xsprite[pSprite->extra].stateTimer = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-11 21:59:39 +00:00
|
|
|
void sub_76A08(spritetype *pSprite, spritetype *pSprite2, PLAYER *pPlayer) // ???
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
int top, bottom;
|
|
|
|
int nSprite = pSprite->index;
|
|
|
|
GetSpriteExtents(pSprite, &top, &bottom);
|
|
|
|
pSprite->x = pSprite2->x;
|
|
|
|
pSprite->y = pSprite2->y;
|
|
|
|
pSprite->z = sector[pSprite2->sectnum].floorz-(bottom-pSprite->z);
|
|
|
|
pSprite->ang = pSprite2->ang;
|
|
|
|
ChangeSpriteSect(nSprite, pSprite2->sectnum);
|
|
|
|
sfxPlay3DSound(pSprite2, 201, -1, 0);
|
|
|
|
xvel[nSprite] = yvel[nSprite] = zvel[nSprite] = 0;
|
|
|
|
viewBackupSpriteLoc(nSprite, pSprite);
|
|
|
|
if (pPlayer)
|
|
|
|
{
|
|
|
|
playerResetInertia(pPlayer);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->zViewVel = pPlayer->zWeaponVel = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-11 08:52:13 +00:00
|
|
|
void DropVoodooCb(int nSprite) // unused
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2020-12-05 22:49:51 +00:00
|
|
|
auto actor = &bloodActors[nSprite];
|
2019-09-19 22:42:45 +00:00
|
|
|
spritetype *pSprite = &sprite[nSprite];
|
2020-12-02 18:56:32 +00:00
|
|
|
int nOwner = pSprite->owner;
|
2019-09-19 22:42:45 +00:00
|
|
|
if (nOwner < 0 || nOwner >= kMaxSprites)
|
|
|
|
{
|
2019-10-11 21:59:39 +00:00
|
|
|
evPost(nSprite, 3, 0, kCallbackRemove);
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
spritetype *pOwner = &sprite[nOwner];
|
|
|
|
PLAYER *pPlayer;
|
|
|
|
if (IsPlayerSprite(pOwner))
|
|
|
|
pPlayer = &gPlayer[pOwner->type-kDudePlayer1];
|
|
|
|
else
|
|
|
|
pPlayer = NULL;
|
|
|
|
if (!pPlayer)
|
|
|
|
{
|
2019-10-11 21:59:39 +00:00
|
|
|
evPost(nSprite, 3, 0, kCallbackRemove);
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
pSprite->ang = getangle(pOwner->x-pSprite->x, pOwner->y-pSprite->y);
|
|
|
|
int nXSprite = pSprite->extra;
|
|
|
|
if (nXSprite > 0)
|
|
|
|
{
|
|
|
|
XSPRITE *pXSprite = &xsprite[nXSprite];
|
|
|
|
if (pXSprite->data1 == 0)
|
|
|
|
{
|
2019-10-11 21:59:39 +00:00
|
|
|
evPost(nSprite, 3, 0, kCallbackRemove);
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-10-15 15:15:45 +00:00
|
|
|
int nSprite2;
|
|
|
|
StatIterator it(kStatDude);
|
|
|
|
while ((nSprite2 = it.NextIndex()) >= 0)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2020-10-15 15:15:45 +00:00
|
|
|
int nNextSprite = it.PeekIndex();
|
2019-09-19 22:42:45 +00:00
|
|
|
if (nOwner == nSprite2)
|
|
|
|
continue;
|
2020-12-05 22:49:51 +00:00
|
|
|
auto actor2 = &bloodActors[nSprite2];
|
2019-09-19 22:42:45 +00:00
|
|
|
spritetype *pSprite2 = &sprite[nSprite2];
|
|
|
|
int nXSprite2 = pSprite2->extra;
|
|
|
|
if (nXSprite2 > 0 && nXSprite2 < kMaxXSprites)
|
|
|
|
{
|
|
|
|
XSPRITE *pXSprite2 = &xsprite[nXSprite2];
|
|
|
|
PLAYER *pPlayer2;
|
|
|
|
if (IsPlayerSprite(pSprite2))
|
|
|
|
pPlayer2 = &gPlayer[pSprite2->type-kDudePlayer1];
|
|
|
|
else
|
|
|
|
pPlayer2 = NULL;
|
|
|
|
if (pXSprite2->health > 0 && (pPlayer2 || pXSprite2->key == 0))
|
|
|
|
{
|
|
|
|
if (pPlayer2)
|
|
|
|
{
|
|
|
|
if (gGameOptions.nGameType == 1)
|
|
|
|
continue;
|
2019-10-21 19:46:41 +00:00
|
|
|
if (gGameOptions.nGameType == 3 && pPlayer->teamId == pPlayer2->teamId)
|
2019-09-19 22:42:45 +00:00
|
|
|
continue;
|
|
|
|
int t = 0x8000/ClipLow(gNetPlayers-1, 1);
|
2019-10-19 19:11:39 +00:00
|
|
|
if (!powerupCheck(pPlayer2, kPwUpDeathMask))
|
2019-10-21 19:46:41 +00:00
|
|
|
t += ((3200-pPlayer2->armor[2])<<15)/3200;
|
2019-09-19 22:42:45 +00:00
|
|
|
if (Chance(t) || nNextSprite < 0)
|
|
|
|
{
|
2020-12-05 22:49:51 +00:00
|
|
|
int nDmg = actDamageSprite(actor, actor2, kDamageSpirit, pXSprite->data1<<4);
|
2019-09-19 22:42:45 +00:00
|
|
|
pXSprite->data1 = ClipLow(pXSprite->data1-nDmg, 0);
|
|
|
|
sub_76A08(pSprite2, pSprite, pPlayer2);
|
2019-10-11 21:59:39 +00:00
|
|
|
evPost(nSprite, 3, 0, kCallbackRemove);
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int vd = 0x2666;
|
|
|
|
switch (pSprite2->type)
|
|
|
|
{
|
2019-10-11 21:59:39 +00:00
|
|
|
case kDudeBoneEel:
|
|
|
|
case kDudeBat:
|
|
|
|
case kDudeRat:
|
|
|
|
case kDudeTinyCaleb:
|
|
|
|
case kDudeBeast:
|
2019-09-19 22:42:45 +00:00
|
|
|
vd = 0x147;
|
|
|
|
break;
|
2019-10-11 21:59:39 +00:00
|
|
|
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:
|
2019-09-19 22:42:45 +00:00
|
|
|
vd = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (vd && (Chance(vd) || nNextSprite < 0))
|
|
|
|
{
|
|
|
|
sub_76A08(pSprite2, pSprite, NULL);
|
2019-10-11 21:59:39 +00:00
|
|
|
evPost(nSprite, 3, 0, kCallbackRemove);
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pXSprite->data1 = ClipLow(pXSprite->data1-1, 0);
|
2019-10-11 21:59:39 +00:00
|
|
|
evPost(nSprite, 3, 0, kCallbackRemove);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-13 20:59:13 +00:00
|
|
|
void callbackCondition(int nSprite) {
|
|
|
|
|
2020-05-05 18:50:14 +00:00
|
|
|
XSPRITE* pXSprite = &xsprite[sprite[nSprite].extra];
|
|
|
|
if (pXSprite->isTriggered) return;
|
2020-03-13 20:59:13 +00:00
|
|
|
|
|
|
|
TRCONDITION* pCond = &gCondition[pXSprite->sysData1];
|
2021-05-12 00:00:06 +00:00
|
|
|
for (unsigned i = 0; i < pCond->length; i++) {
|
2020-03-13 20:59:13 +00:00
|
|
|
EVENT evn; evn.index = pCond->obj[i].index; evn.type = pCond->obj[i].type;
|
|
|
|
evn.cmd = pCond->obj[i].cmd; evn.funcID = kCallbackCondition;
|
2020-05-05 18:50:14 +00:00
|
|
|
useCondition(&sprite[pXSprite->reference], pXSprite, evn);
|
2020-03-13 20:59:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
evPost(nSprite, OBJ_SPRITE, pXSprite->busyTime, kCallbackCondition);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-09-19 22:42:45 +00:00
|
|
|
void(*gCallback[kCallbackMax])(int) =
|
|
|
|
{
|
2019-10-11 21:59:39 +00:00
|
|
|
fxFlameLick,
|
2019-09-19 22:42:45 +00:00
|
|
|
Remove,
|
|
|
|
FlareBurst,
|
2019-10-11 21:59:39 +00:00
|
|
|
fxFlareSpark,
|
|
|
|
fxFlareSparkLite,
|
|
|
|
fxZombieBloodSpurt,
|
|
|
|
fxBloodSpurt,
|
|
|
|
fxArcSpark,
|
|
|
|
fxDynPuff,
|
2019-09-19 22:42:45 +00:00
|
|
|
Respawn,
|
|
|
|
PlayerBubble,
|
|
|
|
EnemyBubble,
|
|
|
|
CounterCheck,
|
|
|
|
FinishHim,
|
2019-10-11 21:59:39 +00:00
|
|
|
fxBloodBits,
|
|
|
|
fxTeslaAlt,
|
|
|
|
fxBouncingSleeve,
|
|
|
|
returnFlagToBase,
|
|
|
|
fxPodBloodSpray,
|
|
|
|
fxPodBloodSplat,
|
|
|
|
LeechStateTimer,
|
2020-10-11 08:52:13 +00:00
|
|
|
DropVoodooCb, // unused
|
2020-02-07 19:47:43 +00:00
|
|
|
#ifdef NOONE_EXTENSIONS
|
|
|
|
callbackUniMissileBurst, // the code is in nnexts.cpp
|
|
|
|
callbackMakeMissileBlocking, // the code is in nnexts.cpp
|
|
|
|
callbackGenDudeUpdate, // the code is in nnexts.cpp
|
2020-03-13 20:59:13 +00:00
|
|
|
callbackCondition,
|
2020-02-07 19:47:43 +00:00
|
|
|
#endif
|
2019-09-19 22:42:45 +00:00
|
|
|
};
|
2019-09-22 06:39:22 +00:00
|
|
|
|
|
|
|
END_BLD_NS
|