mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-26 00:40:56 +00:00
- more leech stuff.
# Conflicts: # source/games/blood/src/ai.cpp
This commit is contained in:
parent
d2f16ec8ab
commit
040049f83e
5 changed files with 44 additions and 26 deletions
|
@ -2526,7 +2526,6 @@ static void actInitDudes()
|
|||
|
||||
void actInit(bool bSaveLoad)
|
||||
{
|
||||
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
if (!gModernMap) nnExtResetGlobals();
|
||||
else nnExtInitModernStuff(bSaveLoad);
|
||||
|
@ -2947,7 +2946,7 @@ static bool actKillModernDude(DBloodActor* actor, DAMAGE_TYPE damageType)
|
|||
auto pSprite = &actor->s();
|
||||
auto pXSprite = &actor->x();
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra();
|
||||
removeDudeStuff(pSprite);
|
||||
removeDudeStuff(actor);
|
||||
if (pXSprite->txID <= 0 || getNextIncarnation(pXSprite) == nullptr)
|
||||
{
|
||||
if (pExtra->weaponType == kGenDudeWeaponKamikaze && Chance(0x4000) && damageType != kDamageSpirit && damageType != kDamageDrown)
|
||||
|
|
|
@ -1058,7 +1058,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType
|
|||
if (pXSprite->health > (uint32_t)pDudeInfo->fleeHealth) return nDamage;
|
||||
else if (pXSprite->txID <= 0 || getNextIncarnation(pXSprite) == nullptr)
|
||||
{
|
||||
removeDudeStuff(pSprite);
|
||||
removeDudeStuff(actor);
|
||||
|
||||
if (pExtra->weaponType == kGenDudeWeaponKamikaze)
|
||||
doExplosion(pSprite, pXSprite->data1 - kTrapExploder);
|
||||
|
|
|
@ -348,7 +348,7 @@ static void ThrowThing(DBloodActor* actor, bool impact)
|
|||
case kThingDroppedLifeLeech:
|
||||
zThrow = 5000;
|
||||
// pickup life leech before throw it again
|
||||
if (pLeech != NULL) removeLeech(pLeech);
|
||||
if (actLeech != NULL) removeLeech(actLeech);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -719,7 +719,7 @@ static void unicultThinkChase(DBloodActor* actor)
|
|||
{
|
||||
case kMissileLifeLeechRegular:
|
||||
// pickup life leech if it was thrown previously
|
||||
if (pLeech != NULL) removeLeech(pLeech);
|
||||
if (actLeech != NULL) removeLeech(actLeech);
|
||||
mdist = 1500;
|
||||
break;
|
||||
case kMissileFlareAlt:
|
||||
|
@ -1416,37 +1416,55 @@ DBloodActor* leechIsDropped(DBloodActor* actor)
|
|||
return actor->genDudeExtra().pLifeLeech;
|
||||
}
|
||||
|
||||
void removeDudeStuff(spritetype* pSprite) {
|
||||
int nSprite;
|
||||
StatIterator it(kStatThing);
|
||||
while ((nSprite = it.NextIndex()) >= 0)
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void removeDudeStuff(DBloodActor* actor)
|
||||
{
|
||||
auto pSprite = &actor->s();
|
||||
BloodStatIterator it(kStatThing);
|
||||
while (auto actor2 = it.Next())
|
||||
{
|
||||
if (sprite[nSprite].owner != pSprite->index) continue;
|
||||
switch (sprite[nSprite].type) {
|
||||
if ( actor2->GetOwner() != actor) continue;
|
||||
auto pSprite2 = &actor2->s();
|
||||
switch (pSprite2->type) {
|
||||
case kThingArmedProxBomb:
|
||||
case kThingArmedRemoteBomb:
|
||||
case kModernThingTNTProx:
|
||||
sprite[nSprite].type = kSpriteDecoration;
|
||||
actPostSprite(sprite[nSprite].index, kStatFree);
|
||||
pSprite2->type = kSpriteDecoration;
|
||||
actPostSprite(actor2, kStatFree);
|
||||
break;
|
||||
case kModernThingEnemyLifeLeech:
|
||||
killDudeLeech(&sprite[nSprite]);
|
||||
killDudeLeech(pSprite2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
it.Reset(kStatDude);
|
||||
while ((nSprite = it.NextIndex()) >= 0)
|
||||
while (auto actor2 = it.Next())
|
||||
{
|
||||
if (sprite[nSprite].owner != pSprite->index) continue;
|
||||
actDamageSprite(&bloodActors[sprite[nSprite].owner], &bloodActors[nSprite], kDamageFall, 65535);
|
||||
if (actor2->GetOwner() != actor) continue;
|
||||
actDamageSprite(actor2->GetOwner(), actor2, kDamageFall, 65535);
|
||||
}
|
||||
}
|
||||
|
||||
void removeLeech(spritetype* pLeech, bool delSprite) {
|
||||
if (pLeech != NULL) {
|
||||
spritetype* pEffect = gFX.fxSpawn((FX_ID)52,pLeech->sectnum,pLeech->x,pLeech->y,pLeech->z,pLeech->ang);
|
||||
if (pEffect != NULL) {
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void removeLeech(DBloodActor* actLeech, bool delSprite)
|
||||
{
|
||||
if (actLeech != NULL)
|
||||
{
|
||||
auto const pLeech = &actLeech->s();
|
||||
spritetype* pEffect = gFX.fxSpawn((FX_ID)52, pLeech->sectnum, pLeech->x, pLeech->y, pLeech->z, pLeech->ang);
|
||||
if (pEffect != NULL)
|
||||
{
|
||||
pEffect->cstat = CSTAT_SPRITE_ALIGNMENT_FACING;
|
||||
pEffect->pal = 6;
|
||||
int repeat = 64 + Random(50);
|
||||
|
@ -1459,7 +1477,8 @@ void removeLeech(spritetype* pLeech, bool delSprite) {
|
|||
if (pLeech->owner >= 0 && pLeech->owner < kMaxSprites)
|
||||
gGenDudeExtra[sprite[pLeech->owner].index].pLifeLeech = nullptr;
|
||||
|
||||
if (delSprite) {
|
||||
if (delSprite)
|
||||
{
|
||||
pLeech->type = kSpriteDecoration;
|
||||
actPostSprite(pLeech->index, kStatFree);
|
||||
}
|
||||
|
|
|
@ -197,8 +197,8 @@ extern GENDUDEEXTRA gGenDudeExtra[kMaxSprites];
|
|||
|
||||
XSPRITE* getNextIncarnation(XSPRITE* pXSprite);
|
||||
void killDudeLeech(spritetype* pLeech);
|
||||
void removeLeech(spritetype* pLeech, bool delSprite = true);
|
||||
void removeDudeStuff(spritetype* pSprite);
|
||||
void removeLeech(DBloodActor* pLeech, bool delSprite = true);
|
||||
void removeDudeStuff(DBloodActor* pSprite);
|
||||
DBloodActor* leechIsDropped(DBloodActor* pSprite);
|
||||
bool spriteIsUnderwater(DBloodActor* pSprite, bool oldWay = false);
|
||||
bool playGenDudeSound(DBloodActor* actor, int mode);
|
||||
|
|
|
@ -5913,11 +5913,11 @@ void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite) {
|
|||
aiSetTarget_(pXSprite, pSprite->x, pSprite->y, pSprite->z);
|
||||
aiSetGenIdleState(pSprite, pXSprite);
|
||||
if (pSprite->type == kDudeModernCustom && actLeech)
|
||||
removeLeech(&actLeech->s());
|
||||
removeLeech(actLeech);
|
||||
} else if (pXSource->data4 == 4) {
|
||||
aiSetTarget_(pXSprite, pPlayer->x, pPlayer->y, pPlayer->z);
|
||||
if (pSprite->type == kDudeModernCustom && actLeech)
|
||||
removeLeech(&actLeech->s());
|
||||
removeLeech(actLeech);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue