- doexplosion

This commit is contained in:
Christoph Oelckers 2021-05-06 09:09:58 +02:00
parent b1f55434a2
commit e415d93283
4 changed files with 22 additions and 13 deletions

View file

@ -2951,7 +2951,7 @@ static bool actKillModernDude(DBloodActor* actor, DAMAGE_TYPE damageType)
{
if (pExtra->weaponType == kGenDudeWeaponKamikaze && Chance(0x4000) && damageType != kDamageSpirit && damageType != kDamageDrown)
{
doExplosion(pSprite, pXSprite->data1 - kTrapExploder);
doExplosion(actor, pXSprite->data1 - kTrapExploder);
if (Chance(0x9000)) damageType = kDamageExplode;
}

View file

@ -1061,7 +1061,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType
removeDudeStuff(actor);
if (pExtra->weaponType == kGenDudeWeaponKamikaze)
doExplosion(pSprite, pXSprite->data1 - kTrapExploder);
doExplosion(actor, pXSprite->data1 - kTrapExploder);
if (spriteIsUnderwater(actor))
{

View file

@ -714,7 +714,7 @@ static void unicultThinkChase(DBloodActor* actor)
else if (weaponType == kGenDudeWeaponMissile)
{
// special handling for flame, explosive and life leech missiles
int state = checkAttackState(&bloodActors[pXSprite->reference]);
int state = checkAttackState(actor);
switch (curWeapon)
{
case kMissileLifeLeechRegular:
@ -763,7 +763,7 @@ static void unicultThinkChase(DBloodActor* actor)
if (CheckProximity(pSprite, pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pExpl->radius >> 1))
{
actor->xvel() = actor->yvel() = actor->zvel() = 0;
if (doExplosion(pSprite, nType) && pXSprite->health > 0)
if (doExplosion(actor, nType) && pXSprite->health > 0)
actDamageSprite(actor, actor, kDamageExplode, 65535);
}
return;
@ -1889,11 +1889,20 @@ void dudeLeechOperate(spritetype* pSprite, XSPRITE* pXSprite, EVENT event)
}
}
bool doExplosion(spritetype* pSprite, int nType)
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
bool doExplosion(DBloodActor* actor, int nType)
{
auto actor = actSpawnSprite(pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, kStatExplosion, true);
spritetype* pExplosion = &actor->s();
if (pExplosion->extra < 0 || pExplosion->extra >= kMaxXSprites)
auto const pSprite = &actor->s();
auto actExplosion = actSpawnSprite(pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, kStatExplosion, true);
auto const pExplosion = &actExplosion->s();
auto const pXExplosion = &actExplosion->x();
if (pExplosion->extra < 0 || pExplosion->extra >= kMaxXSprites)
return false;
int nSeq = 4; int nSnd = 304; const EXPLOSION* pExpl = &explodeInfo[nType];
@ -1905,9 +1914,9 @@ bool doExplosion(spritetype* pSprite, int nType)
pExplosion->yrepeat = pExplosion->xrepeat = pExpl->repeat;
xsprite[pExplosion->extra].data1 = pExpl->ticks;
xsprite[pExplosion->extra].data2 = pExpl->quakeEffect;
xsprite[pExplosion->extra].data3 = pExpl->flashEffect;
pXExplosion->data1 = pExpl->ticks;
pXExplosion->data2 = pExpl->quakeEffect;
pXExplosion->data3 = pExpl->flashEffect;
if (nType == 0) { nSeq = 3; nSnd = 303; }
else if (nType == 2) { nSeq = 4; nSnd = 305; }
@ -1917,7 +1926,7 @@ bool doExplosion(spritetype* pSprite, int nType)
else if (nType == 7) { nSeq = 4; nSnd = 303; }
seqSpawn(nSeq, 3, pExplosion->extra, -1);
sfxPlay3DSound(pExplosion, nSnd, -1, 0);
sfxPlay3DSound(actExplosion, nSnd, -1, 0);
return true;
}

View file

@ -206,7 +206,7 @@ void aiGenDudeMoveForward(DBloodActor* actor);
void aiGenDudeChooseDirection(DBloodActor* actor, int a3, int aXvel = -1, int aYvel = -1);
void aiGenDudeNewState(DBloodActor* actor, AISTATE* pAIState);
int checkAttackState(DBloodActor* actor);
bool doExplosion(spritetype* pSprite, int nType);
bool doExplosion(DBloodActor* pSprite, int nType);
spritetype* genDudeSpawn(XSPRITE* pXSource, spritetype* pSprite, int nDist);
void genDudeTransform(spritetype* pSprite);
void dudeLeechOperate(spritetype* pSprite, XSPRITE* pXSprite, EVENT a3);