mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-27 01:10:51 +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)
|
void actInit(bool bSaveLoad)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef NOONE_EXTENSIONS
|
#ifdef NOONE_EXTENSIONS
|
||||||
if (!gModernMap) nnExtResetGlobals();
|
if (!gModernMap) nnExtResetGlobals();
|
||||||
else nnExtInitModernStuff(bSaveLoad);
|
else nnExtInitModernStuff(bSaveLoad);
|
||||||
|
@ -2947,7 +2946,7 @@ static bool actKillModernDude(DBloodActor* actor, DAMAGE_TYPE damageType)
|
||||||
auto pSprite = &actor->s();
|
auto pSprite = &actor->s();
|
||||||
auto pXSprite = &actor->x();
|
auto pXSprite = &actor->x();
|
||||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra();
|
GENDUDEEXTRA* pExtra = &actor->genDudeExtra();
|
||||||
removeDudeStuff(pSprite);
|
removeDudeStuff(actor);
|
||||||
if (pXSprite->txID <= 0 || getNextIncarnation(pXSprite) == nullptr)
|
if (pXSprite->txID <= 0 || getNextIncarnation(pXSprite) == nullptr)
|
||||||
{
|
{
|
||||||
if (pExtra->weaponType == kGenDudeWeaponKamikaze && Chance(0x4000) && damageType != kDamageSpirit && damageType != kDamageDrown)
|
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;
|
if (pXSprite->health > (uint32_t)pDudeInfo->fleeHealth) return nDamage;
|
||||||
else if (pXSprite->txID <= 0 || getNextIncarnation(pXSprite) == nullptr)
|
else if (pXSprite->txID <= 0 || getNextIncarnation(pXSprite) == nullptr)
|
||||||
{
|
{
|
||||||
removeDudeStuff(pSprite);
|
removeDudeStuff(actor);
|
||||||
|
|
||||||
if (pExtra->weaponType == kGenDudeWeaponKamikaze)
|
if (pExtra->weaponType == kGenDudeWeaponKamikaze)
|
||||||
doExplosion(pSprite, pXSprite->data1 - kTrapExploder);
|
doExplosion(pSprite, pXSprite->data1 - kTrapExploder);
|
||||||
|
|
|
@ -348,7 +348,7 @@ static void ThrowThing(DBloodActor* actor, bool impact)
|
||||||
case kThingDroppedLifeLeech:
|
case kThingDroppedLifeLeech:
|
||||||
zThrow = 5000;
|
zThrow = 5000;
|
||||||
// pickup life leech before throw it again
|
// pickup life leech before throw it again
|
||||||
if (pLeech != NULL) removeLeech(pLeech);
|
if (actLeech != NULL) removeLeech(actLeech);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -719,7 +719,7 @@ static void unicultThinkChase(DBloodActor* actor)
|
||||||
{
|
{
|
||||||
case kMissileLifeLeechRegular:
|
case kMissileLifeLeechRegular:
|
||||||
// pickup life leech if it was thrown previously
|
// pickup life leech if it was thrown previously
|
||||||
if (pLeech != NULL) removeLeech(pLeech);
|
if (actLeech != NULL) removeLeech(actLeech);
|
||||||
mdist = 1500;
|
mdist = 1500;
|
||||||
break;
|
break;
|
||||||
case kMissileFlareAlt:
|
case kMissileFlareAlt:
|
||||||
|
@ -1416,37 +1416,55 @@ DBloodActor* leechIsDropped(DBloodActor* actor)
|
||||||
return actor->genDudeExtra().pLifeLeech;
|
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;
|
if ( actor2->GetOwner() != actor) continue;
|
||||||
switch (sprite[nSprite].type) {
|
auto pSprite2 = &actor2->s();
|
||||||
|
switch (pSprite2->type) {
|
||||||
case kThingArmedProxBomb:
|
case kThingArmedProxBomb:
|
||||||
case kThingArmedRemoteBomb:
|
case kThingArmedRemoteBomb:
|
||||||
case kModernThingTNTProx:
|
case kModernThingTNTProx:
|
||||||
sprite[nSprite].type = kSpriteDecoration;
|
pSprite2->type = kSpriteDecoration;
|
||||||
actPostSprite(sprite[nSprite].index, kStatFree);
|
actPostSprite(actor2, kStatFree);
|
||||||
break;
|
break;
|
||||||
case kModernThingEnemyLifeLeech:
|
case kModernThingEnemyLifeLeech:
|
||||||
killDudeLeech(&sprite[nSprite]);
|
killDudeLeech(pSprite2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
it.Reset(kStatDude);
|
it.Reset(kStatDude);
|
||||||
while ((nSprite = it.NextIndex()) >= 0)
|
while (auto actor2 = it.Next())
|
||||||
{
|
{
|
||||||
if (sprite[nSprite].owner != pSprite->index) continue;
|
if (actor2->GetOwner() != actor) continue;
|
||||||
actDamageSprite(&bloodActors[sprite[nSprite].owner], &bloodActors[nSprite], kDamageFall, 65535);
|
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->cstat = CSTAT_SPRITE_ALIGNMENT_FACING;
|
||||||
pEffect->pal = 6;
|
pEffect->pal = 6;
|
||||||
int repeat = 64 + Random(50);
|
int repeat = 64 + Random(50);
|
||||||
|
@ -1459,7 +1477,8 @@ void removeLeech(spritetype* pLeech, bool delSprite) {
|
||||||
if (pLeech->owner >= 0 && pLeech->owner < kMaxSprites)
|
if (pLeech->owner >= 0 && pLeech->owner < kMaxSprites)
|
||||||
gGenDudeExtra[sprite[pLeech->owner].index].pLifeLeech = nullptr;
|
gGenDudeExtra[sprite[pLeech->owner].index].pLifeLeech = nullptr;
|
||||||
|
|
||||||
if (delSprite) {
|
if (delSprite)
|
||||||
|
{
|
||||||
pLeech->type = kSpriteDecoration;
|
pLeech->type = kSpriteDecoration;
|
||||||
actPostSprite(pLeech->index, kStatFree);
|
actPostSprite(pLeech->index, kStatFree);
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,8 +197,8 @@ extern GENDUDEEXTRA gGenDudeExtra[kMaxSprites];
|
||||||
|
|
||||||
XSPRITE* getNextIncarnation(XSPRITE* pXSprite);
|
XSPRITE* getNextIncarnation(XSPRITE* pXSprite);
|
||||||
void killDudeLeech(spritetype* pLeech);
|
void killDudeLeech(spritetype* pLeech);
|
||||||
void removeLeech(spritetype* pLeech, bool delSprite = true);
|
void removeLeech(DBloodActor* pLeech, bool delSprite = true);
|
||||||
void removeDudeStuff(spritetype* pSprite);
|
void removeDudeStuff(DBloodActor* pSprite);
|
||||||
DBloodActor* leechIsDropped(DBloodActor* pSprite);
|
DBloodActor* leechIsDropped(DBloodActor* pSprite);
|
||||||
bool spriteIsUnderwater(DBloodActor* pSprite, bool oldWay = false);
|
bool spriteIsUnderwater(DBloodActor* pSprite, bool oldWay = false);
|
||||||
bool playGenDudeSound(DBloodActor* actor, int mode);
|
bool playGenDudeSound(DBloodActor* actor, int mode);
|
||||||
|
|
|
@ -5913,11 +5913,11 @@ void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite) {
|
||||||
aiSetTarget_(pXSprite, pSprite->x, pSprite->y, pSprite->z);
|
aiSetTarget_(pXSprite, pSprite->x, pSprite->y, pSprite->z);
|
||||||
aiSetGenIdleState(pSprite, pXSprite);
|
aiSetGenIdleState(pSprite, pXSprite);
|
||||||
if (pSprite->type == kDudeModernCustom && actLeech)
|
if (pSprite->type == kDudeModernCustom && actLeech)
|
||||||
removeLeech(&actLeech->s());
|
removeLeech(actLeech);
|
||||||
} else if (pXSource->data4 == 4) {
|
} else if (pXSource->data4 == 4) {
|
||||||
aiSetTarget_(pXSprite, pPlayer->x, pPlayer->y, pPlayer->z);
|
aiSetTarget_(pXSprite, pPlayer->x, pPlayer->y, pPlayer->z);
|
||||||
if (pSprite->type == kDudeModernCustom && actLeech)
|
if (pSprite->type == kDudeModernCustom && actLeech)
|
||||||
removeLeech(&actLeech->s());
|
removeLeech(actLeech);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue