mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 04:20:42 +00:00
- merged genDudeExtra into DBloodActor.
This commit is contained in:
parent
017bcb056f
commit
c2f6084988
7 changed files with 78 additions and 74 deletions
|
@ -2945,7 +2945,7 @@ static bool actKillModernDude(DBloodActor* actor, DAMAGE_TYPE damageType)
|
|||
{
|
||||
auto pSprite = &actor->s();
|
||||
auto pXSprite = &actor->x();
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra();
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra;
|
||||
removeDudeStuff(actor);
|
||||
if (pXSprite->txID <= 0 || getNextIncarnation(actor) == nullptr)
|
||||
{
|
||||
|
@ -3194,7 +3194,7 @@ static int checkDamageType(DBloodActor* actor, DAMAGE_TYPE damageType)
|
|||
case kDudeModernCustomBurning:
|
||||
{
|
||||
playGenDudeSound(actor, kGenDudeSndDeathExplode);
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra();
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra;
|
||||
if (!pExtra->availDeaths[damageType])
|
||||
{
|
||||
nSeq = 1;
|
||||
|
@ -3342,7 +3342,7 @@ static void modernCustomDudeDeath(DBloodActor* actor, int nSeq, int damageType)
|
|||
int dudeToGib = (actCheckRespawn(actor)) ? -1 : ((nSeq == 3) ? nDudeToGibClient2 : nDudeToGibClient1);
|
||||
if (nSeq == 3)
|
||||
{
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra();
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra;
|
||||
if (pExtra->availDeaths[kDmgBurn] == 3) seqSpawn((15 + Random(2)) + pXSprite->data2, actor, dudeToGib);
|
||||
else if (pExtra->availDeaths[kDmgBurn] == 2) seqSpawn(16 + pXSprite->data2, actor, dudeToGib);
|
||||
else if (pExtra->availDeaths[kDmgBurn] == 1) seqSpawn(15 + pXSprite->data2, actor, dudeToGib);
|
||||
|
@ -3371,7 +3371,7 @@ static void modernCustomDudeBurningDeath(DBloodActor* actor, int nSeq)
|
|||
|
||||
if (Chance(0x4000)) spawnGibs(actor, GIBTYPE_27, -0xccccc);
|
||||
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra();
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra;
|
||||
int seqofs = actor->x().data2;
|
||||
if (pExtra->availDeaths[kDmgBurn] == 3) seqSpawn((15 + Random(2)) + seqofs, actor, dudeToGib);
|
||||
else if (pExtra->availDeaths[kDmgBurn] == 2) seqSpawn(16 + seqofs, actor, dudeToGib);
|
||||
|
@ -3684,7 +3684,7 @@ static int actDamageDude(DBloodActor* source, DBloodActor* actor, int damage, DA
|
|||
int nDamageFactor = getDudeInfo(nType + kDudeBase)->damageVal[damageType];
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
if (pSprite->type == kDudeModernCustom)
|
||||
nDamageFactor = actor->genDudeExtra().dmgControl[damageType];
|
||||
nDamageFactor = actor->genDudeExtra.dmgControl[damageType];
|
||||
#endif
|
||||
|
||||
if (!nDamageFactor) return 0;
|
||||
|
|
|
@ -1055,7 +1055,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType
|
|||
|
||||
if (pSprite->type == kDudeModernCustom)
|
||||
{
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra();
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra;
|
||||
if (nDmgType == kDamageBurn)
|
||||
{
|
||||
if (pXSprite->health > (uint32_t)pDudeInfo->fleeHealth) return nDamage;
|
||||
|
@ -1276,7 +1276,7 @@ void RecoilDude(DBloodActor* actor)
|
|||
#ifdef NOONE_EXTENSIONS
|
||||
case kDudeModernCustom:
|
||||
{
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra();
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra;
|
||||
int rChance = getRecoilChance(actor);
|
||||
if (pExtra->canElectrocute && pDudeExtra->teslaHit && !spriteIsUnderwater(actor, false))
|
||||
{
|
||||
|
@ -1671,7 +1671,7 @@ void aiProcessDudes(void)
|
|||
#ifdef NOONE_EXTENSIONS
|
||||
case kDudeModernCustom:
|
||||
case kDudeModernCustomBurning: {
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra();
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra;
|
||||
if (pExtra->slaveCount > 0) updateTargetOfSlaves(actor);
|
||||
if (pExtra->pLifeLeech != nullptr) updateTargetOfLeech(actor);
|
||||
if (pXSprite->stateTimer == 0 && pXSprite->aiState && pXSprite->aiState->nextState
|
||||
|
|
|
@ -111,8 +111,6 @@ short gCustomDudeDebrisPics[6] = {
|
|||
|
||||
};
|
||||
|
||||
GENDUDEEXTRA gGenDudeExtra[kMaxSprites]; // savegame handling in ai.cpp
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
@ -123,7 +121,7 @@ static void forcePunch(DBloodActor* actor)
|
|||
{
|
||||
auto pXSprite = &actor->x();
|
||||
auto pSprite = &actor->s();
|
||||
if (actor->genDudeExtra().forcePunch && seqGetStatus(3, pSprite->extra) == -1)
|
||||
if (actor->genDudeExtra.forcePunch && seqGetStatus(3, pSprite->extra) == -1)
|
||||
punchCallback(0, actor);
|
||||
}
|
||||
|
||||
|
@ -146,7 +144,7 @@ static bool genDudeAdjustSlope(DBloodActor* actor, int dist, int weaponType, int
|
|||
{
|
||||
int fStart = 0;
|
||||
int fEnd = 0;
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra();
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra;
|
||||
unsigned int clipMask = (weaponType == kGenDudeWeaponMissile) ? CLIPMASK0 : CLIPMASK1;
|
||||
|
||||
for (int i = -8191; i < 8192; i += by)
|
||||
|
@ -186,7 +184,7 @@ static bool genDudeAdjustSlope(DBloodActor* actor, int dist, int weaponType, int
|
|||
|
||||
void genDudeUpdate(DBloodActor* actor)
|
||||
{
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra();
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra;
|
||||
for (int i = 0; i < kGenDudePropertyMax; i++) {
|
||||
if (pExtra->updReq[i]) genDudePrepare(actor, i);
|
||||
}
|
||||
|
@ -240,7 +238,7 @@ void genDudeAttack1(int, DBloodActor* actor)
|
|||
int dx, dy, dz;
|
||||
actor->xvel() = actor->yvel() = 0;
|
||||
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra();
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra;
|
||||
short dispersion = pExtra->baseDispersion;
|
||||
if (inDuck(pXSprite->aiState))
|
||||
dispersion = ClipLow(dispersion >> 1, kGenDudeMinDispesion);
|
||||
|
@ -324,8 +322,8 @@ static void ThrowThing(DBloodActor* actor, bool impact)
|
|||
if (!(pTarget->type >= kDudeBase && pTarget->type < kDudeMax))
|
||||
return;
|
||||
|
||||
int curWeapon = actor->genDudeExtra().curWeapon;
|
||||
int weaponType = actor->genDudeExtra().weaponType;
|
||||
int curWeapon = actor->genDudeExtra.curWeapon;
|
||||
int weaponType = actor->genDudeExtra.weaponType;
|
||||
if (weaponType != kGenDudeWeaponThrow) return;
|
||||
|
||||
const THINGINFO* pThinkInfo = &thingInfo[curWeapon - kThingBase];
|
||||
|
@ -404,7 +402,7 @@ static void ThrowThing(DBloodActor* actor, bool impact)
|
|||
pXSpawned->Proximity = true;
|
||||
pXSpawned->stateTimer = 1;
|
||||
|
||||
actor->genDudeExtra().pLifeLeech = spawned;
|
||||
actor->genDudeExtra.pLifeLeech = spawned;
|
||||
evPostActor(spawned, 80, kCallbackLeechStateTimer);
|
||||
return;
|
||||
}
|
||||
|
@ -529,7 +527,7 @@ static void unicultThinkChase(DBloodActor* actor)
|
|||
//aiChooseDirection(actor,getangle(dx, dy));
|
||||
aiGenDudeChooseDirection(actor, getangle(dx, dy), xvelocity, yvelocity);
|
||||
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra();
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra;
|
||||
if (!pExtra->canAttack)
|
||||
{
|
||||
if (pExtra->canWalk) aiSetTarget(actor, actor); // targeting self???
|
||||
|
@ -570,8 +568,8 @@ static void unicultThinkChase(DBloodActor* actor)
|
|||
|
||||
actor->dudeSlope = dist == 0 ? 0 : DivScale(pTarget->z - pSprite->z, dist, 10);
|
||||
|
||||
int curWeapon = actor->genDudeExtra().curWeapon;
|
||||
int weaponType = actor->genDudeExtra().weaponType;
|
||||
int curWeapon = actor->genDudeExtra.curWeapon;
|
||||
int weaponType = actor->genDudeExtra.weaponType;
|
||||
|
||||
auto actLeech = leechIsDropped(actor);
|
||||
spritetype* pLeech = actLeech? &actLeech->s() : nullptr;
|
||||
|
@ -677,7 +675,7 @@ static void unicultThinkChase(DBloodActor* actor)
|
|||
else
|
||||
{
|
||||
int vdist; int mdist; int defDist;
|
||||
defDist = vdist = mdist = actor->genDudeExtra().fireDist;
|
||||
defDist = vdist = mdist = actor->genDudeExtra.fireDist;
|
||||
|
||||
if (weaponType == kGenDudeWeaponHitscan)
|
||||
{
|
||||
|
@ -693,7 +691,7 @@ static void unicultThinkChase(DBloodActor* actor)
|
|||
aiSetTarget(actor, pSprite->x, pSprite->y, pSprite->z);
|
||||
return;
|
||||
}
|
||||
else if (actor->genDudeExtra().slaveCount > gGameOptions.nDifficulty || dist < meleeVector->maxDist)
|
||||
else if (actor->genDudeExtra.slaveCount > gGameOptions.nDifficulty || dist < meleeVector->maxDist)
|
||||
{
|
||||
if (dist <= meleeVector->maxDist)
|
||||
{
|
||||
|
@ -1159,7 +1157,7 @@ void aiGenDudeMoveForward(DBloodActor* actor)
|
|||
auto pXSprite = &actor->x();
|
||||
auto pSprite = &actor->s();
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra();
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra;
|
||||
int maxTurn = pDudeInfo->angSpeed * 4 >> 4;
|
||||
|
||||
if (pExtra->canFly)
|
||||
|
@ -1202,7 +1200,7 @@ void aiGenDudeMoveForward(DBloodActor* actor)
|
|||
int sin = Sin(pSprite->ang);
|
||||
int cos = Cos(pSprite->ang);
|
||||
|
||||
int frontSpeed = actor->genDudeExtra().moveSpeed;
|
||||
int frontSpeed = actor->genDudeExtra.moveSpeed;
|
||||
actor->xvel() += MulScale(cos, frontSpeed, 30);
|
||||
actor->yvel() += MulScale(sin, frontSpeed, 30);
|
||||
}
|
||||
|
@ -1272,7 +1270,7 @@ void aiGenDudeNewState(DBloodActor* actor, AISTATE* pAIState)
|
|||
auto const pXSprite = &actor->x();
|
||||
|
||||
// redirect dudes which cannot walk to non-walk states
|
||||
if (!actor->genDudeExtra().canWalk)
|
||||
if (!actor->genDudeExtra.canWalk)
|
||||
{
|
||||
|
||||
if (pAIState == &genDudeDodgeL || pAIState == &genDudeDodgeShortL || pAIState == &genDudeDodgeShorterL)
|
||||
|
@ -1304,7 +1302,7 @@ void aiGenDudeNewState(DBloodActor* actor, AISTATE* pAIState)
|
|||
|
||||
}
|
||||
|
||||
if (!actor->genDudeExtra().canRecoil)
|
||||
if (!actor->genDudeExtra.canRecoil)
|
||||
{
|
||||
if (pAIState == &genDudeRecoilL || pAIState == &genDudeRecoilD) pAIState = &genDudeIdleL;
|
||||
else if (pAIState == &genDudeRecoilW) pAIState = &genDudeIdleW;
|
||||
|
@ -1337,7 +1335,7 @@ bool playGenDudeSound(DBloodActor* actor, int mode)
|
|||
short sndStartId = pXSprite->sysData1;
|
||||
int rand = sndInfo->randomRange;
|
||||
int sndId = (sndStartId <= 0) ? sndInfo->defaultSndId : sndStartId + sndInfo->sndIdOffset;
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra();
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra;
|
||||
|
||||
// let's check if there same sounds already played by other dudes
|
||||
// so we won't get a lot of annoying screams in the same time and ensure sound played in it's full length (if not interruptable)
|
||||
|
@ -1413,7 +1411,7 @@ bool spriteIsUnderwater(DBloodActor* actor, bool oldWay)
|
|||
|
||||
DBloodActor* leechIsDropped(DBloodActor* actor)
|
||||
{
|
||||
return actor->genDudeExtra().pLifeLeech;
|
||||
return actor->genDudeExtra.pLifeLeech;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -1476,7 +1474,7 @@ void removeLeech(DBloodActor* actLeech, bool delSprite)
|
|||
sfxPlay3DSoundCP(pLeech, 490, -1, 0,60000);
|
||||
|
||||
if (actLeech->GetOwner())
|
||||
actLeech->GetOwner()->genDudeExtra().pLifeLeech = nullptr;
|
||||
actLeech->GetOwner()->genDudeExtra.pLifeLeech = nullptr;
|
||||
|
||||
if (delSprite)
|
||||
{
|
||||
|
@ -1497,7 +1495,7 @@ void killDudeLeech(DBloodActor* actLeech)
|
|||
sfxPlay3DSoundCP(actLeech, 522, -1, 0, 60000);
|
||||
|
||||
if (actLeech->GetOwner() != nullptr)
|
||||
actLeech->GetOwner()->genDudeExtra().pLifeLeech = nullptr;
|
||||
actLeech->GetOwner()->genDudeExtra.pLifeLeech = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1521,7 +1519,7 @@ DBloodActor* getNextIncarnation(DBloodActor* actor)
|
|||
|
||||
bool dudeIsMelee(DBloodActor* actor)
|
||||
{
|
||||
return actor->genDudeExtra().isMelee;
|
||||
return actor->genDudeExtra.isMelee;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -1533,9 +1531,9 @@ bool dudeIsMelee(DBloodActor* actor)
|
|||
static void scaleDamage(DBloodActor* actor)
|
||||
{
|
||||
auto const pXSprite = &actor->x();
|
||||
short curWeapon = actor->genDudeExtra().curWeapon;
|
||||
short weaponType = actor->genDudeExtra().weaponType;
|
||||
signed short* curScale = actor->genDudeExtra().dmgControl;
|
||||
short curWeapon = actor->genDudeExtra.curWeapon;
|
||||
short weaponType = actor->genDudeExtra.weaponType;
|
||||
signed short* curScale = actor->genDudeExtra.dmgControl;
|
||||
for (int i = 0; i < kDmgMax; i++)
|
||||
curScale[i] = getDudeInfo(kDudeModernCustom)->startDamage[i];
|
||||
|
||||
|
@ -2178,7 +2176,7 @@ void updateTargetOfLeech(DBloodActor* actor)
|
|||
auto const pSprite = &actor->s();
|
||||
|
||||
auto actLeech = leechIsDropped(actor);
|
||||
if (actLeech == NULL || !actLeech->hasX()) actor->genDudeExtra().pLifeLeech = nullptr;
|
||||
if (actLeech == NULL || !actLeech->hasX()) actor->genDudeExtra.pLifeLeech = nullptr;
|
||||
else
|
||||
{
|
||||
XSPRITE* pXDude = &actor->x();
|
||||
|
@ -2211,7 +2209,7 @@ void updateTargetOfSlaves(DBloodActor* actor)
|
|||
auto const pSprite = &actor->s();
|
||||
auto const pXSprite = &actor->x();
|
||||
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra();
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra;
|
||||
auto slave = pExtra->slave;
|
||||
auto actTarget = actor->GetTarget();
|
||||
if (!actTarget || !actTarget->IsDudeActor() || !actTarget->hasX() || actTarget->x().health <= 0) actTarget = nullptr;
|
||||
|
@ -2322,17 +2320,17 @@ short inDuck(AISTATE* aiState) {
|
|||
|
||||
bool canSwim(DBloodActor* actor)
|
||||
{
|
||||
return actor->genDudeExtra().canSwim;
|
||||
return actor->genDudeExtra.canSwim;
|
||||
}
|
||||
|
||||
bool canDuck(DBloodActor* actor)
|
||||
{
|
||||
return actor->genDudeExtra().canDuck;
|
||||
return actor->genDudeExtra.canDuck;
|
||||
}
|
||||
|
||||
bool canWalk(DBloodActor* actor)
|
||||
{
|
||||
return actor->genDudeExtra().canWalk;
|
||||
return actor->genDudeExtra.canWalk;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -2362,7 +2360,7 @@ bool genDudePrepare(DBloodActor* actor, int propId)
|
|||
return false;
|
||||
}
|
||||
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra();
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra;
|
||||
pExtra->updReq[propId] = false;
|
||||
|
||||
switch (propId) {
|
||||
|
|
|
@ -193,8 +193,6 @@ struct GENDUDEEXTRA
|
|||
};
|
||||
};
|
||||
|
||||
extern GENDUDEEXTRA gGenDudeExtra[kMaxSprites];
|
||||
|
||||
DBloodActor* getNextIncarnation(DBloodActor* actor);
|
||||
void killDudeLeech(DBloodActor* pLeech);
|
||||
void removeLeech(DBloodActor* pLeech, bool delSprite = true);
|
||||
|
|
|
@ -95,6 +95,7 @@ public:
|
|||
int dudeSlope;
|
||||
DUDEEXTRA dudeExtra;
|
||||
SPRITEMASS spriteMass;
|
||||
GENDUDEEXTRA genDudeExtra;
|
||||
|
||||
int cumulDamage;
|
||||
|
||||
|
@ -120,7 +121,6 @@ public:
|
|||
int& zvel() { return Blood::zvel[index]; }
|
||||
int GetIndex() { return s().time; } // For error printing only! This is only identical with the sprite index for items spawned at map start.
|
||||
|
||||
GENDUDEEXTRA& genDudeExtra() { return Blood::gGenDudeExtra[index]; }
|
||||
POINT3D& basePoint() { return Blood::baseSprite[index]; }
|
||||
|
||||
void SetOwner(DBloodActor* own)
|
||||
|
|
|
@ -488,6 +488,12 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, DBloodActor& w, DB
|
|||
{
|
||||
#ifndef OLD_SAVEGAME
|
||||
arc("spritemass", w.spriteMass, def->spriteMass);
|
||||
|
||||
// GenDudeExtra only contains valid info for kDudeModernCustom and kDudeModernCustomBurning so only save when needed as these are not small.
|
||||
if (w.s().type == kDudeModernCustom || w.s().time == kDudeModernCustomBurning)
|
||||
{
|
||||
arc("gendudeextra", w.genDudeExtra);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -361,7 +361,7 @@ bool nnExtIsImmune(DBloodActor* actor, int dmgType, int minScale)
|
|||
else if (actor->IsDudeActor())
|
||||
{
|
||||
if (actor->IsPlayerActor()) return (gPlayer[pSprite->type - kDudePlayer1].damageControl[dmgType]);
|
||||
else if (pSprite->type == kDudeModernCustom) return (actor->genDudeExtra().dmgControl[dmgType] <= minScale);
|
||||
else if (pSprite->type == kDudeModernCustom) return (actor->genDudeExtra.dmgControl[dmgType] <= minScale);
|
||||
else return (getDudeInfo(pSprite->type)->damageVal[dmgType] <= minScale);
|
||||
}
|
||||
}
|
||||
|
@ -1516,7 +1516,7 @@ int getSpriteMassBySize(DBloodActor* actor)
|
|||
case kDudeModernCustom:
|
||||
case kDudeModernCustomBurning:
|
||||
seqId = actor->x().data2;
|
||||
clipDist = actor->genDudeExtra().initVals[2];
|
||||
clipDist = actor->genDudeExtra.initVals[2];
|
||||
break;
|
||||
default:
|
||||
seqId = getDudeInfo(pSprite->type)->seqStartID;
|
||||
|
@ -2591,10 +2591,10 @@ void useObjResizer(DBloodActor* sourceactor, int targType, int targIndex, DBlood
|
|||
{
|
||||
// request properties update for custom dude
|
||||
|
||||
targetactor->genDudeExtra().updReq[kGenDudePropertySpriteSize] = true;
|
||||
targetactor->genDudeExtra().updReq[kGenDudePropertyAttack] = true;
|
||||
targetactor->genDudeExtra().updReq[kGenDudePropertyMass] = true;
|
||||
targetactor->genDudeExtra().updReq[kGenDudePropertyDmgScale] = true;
|
||||
targetactor->genDudeExtra.updReq[kGenDudePropertySpriteSize] = true;
|
||||
targetactor->genDudeExtra.updReq[kGenDudePropertyAttack] = true;
|
||||
targetactor->genDudeExtra.updReq[kGenDudePropertyMass] = true;
|
||||
targetactor->genDudeExtra.updReq[kGenDudePropertyDmgScale] = true;
|
||||
evPostActor(targetactor, kGenDudeUpdTimeRate, kCallbackGenDudeUpdate);
|
||||
|
||||
}
|
||||
|
@ -4334,36 +4334,37 @@ bool condCheckDude(XSPRITE* pXCond, int cmpOp, bool PUSH) {
|
|||
switch (cond) {
|
||||
case 20: // life leech is thrown?
|
||||
{
|
||||
auto act = actor->genDudeExtra().pLifeLeech;
|
||||
auto act = actor->genDudeExtra.pLifeLeech;
|
||||
if (!act) return false;
|
||||
else if (PUSH) condPush(pXCond, OBJ_SPRITE, act->s().index);
|
||||
return true;
|
||||
}
|
||||
case 21: // life leech is destroyed?
|
||||
{
|
||||
auto act = actor->genDudeExtra().pLifeLeech;
|
||||
auto act = actor->genDudeExtra.pLifeLeech;
|
||||
if (!act) return false;
|
||||
if (pSpr->owner == kMaxSprites - 1) return true;
|
||||
else if (PUSH) condPush(pXCond, OBJ_SPRITE, act->s().index);
|
||||
return false;
|
||||
}
|
||||
case 22: // are required amount of dudes is summoned?
|
||||
return condCmp(gGenDudeExtra[pSpr->index].slaveCount, arg1, arg2, cmpOp);
|
||||
return condCmp(actor->genDudeExtra.slaveCount, arg1, arg2, cmpOp);
|
||||
|
||||
case 23: // check if dude can...
|
||||
switch (arg3) {
|
||||
case 1: return actor->genDudeExtra().canAttack;
|
||||
case 2: return actor->genDudeExtra().canBurn;
|
||||
case 3: return actor->genDudeExtra().canDuck;
|
||||
case 4: return actor->genDudeExtra().canElectrocute;
|
||||
case 5: return actor->genDudeExtra().canFly;
|
||||
case 6: return actor->genDudeExtra().canRecoil;
|
||||
case 7: return actor->genDudeExtra().canSwim;
|
||||
case 8: return actor->genDudeExtra().canWalk;
|
||||
case 1: return actor->genDudeExtra.canAttack;
|
||||
case 2: return actor->genDudeExtra.canBurn;
|
||||
case 3: return actor->genDudeExtra.canDuck;
|
||||
case 4: return actor->genDudeExtra.canElectrocute;
|
||||
case 5: return actor->genDudeExtra.canFly;
|
||||
case 6: return actor->genDudeExtra.canRecoil;
|
||||
case 7: return actor->genDudeExtra.canSwim;
|
||||
case 8: return actor->genDudeExtra.canWalk;
|
||||
default: condError(pXCond, "Invalid argument %d", arg3); break;
|
||||
}
|
||||
break;
|
||||
case 24: // compare weapon dispersion
|
||||
return condCmp(actor->genDudeExtra().baseDispersion, arg1, arg2, cmpOp);
|
||||
return condCmp(actor->genDudeExtra.baseDispersion, arg1, arg2, cmpOp);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -7262,8 +7263,8 @@ bool setDataValueOfObject(int objType, int objIndex, DBloodActor* objActor, int
|
|||
break;
|
||||
case kDudeModernCustom:
|
||||
case kDudeModernCustomBurning:
|
||||
objActor->genDudeExtra().updReq[kGenDudePropertyWeapon] = true;
|
||||
objActor->genDudeExtra().updReq[kGenDudePropertyDmgScale] = true;
|
||||
objActor->genDudeExtra.updReq[kGenDudePropertyWeapon] = true;
|
||||
objActor->genDudeExtra.updReq[kGenDudePropertyDmgScale] = true;
|
||||
evPostActor(objActor, kGenDudeUpdTimeRate, kCallbackGenDudeUpdate);
|
||||
break;
|
||||
}
|
||||
|
@ -7274,11 +7275,11 @@ bool setDataValueOfObject(int objType, int objIndex, DBloodActor* objActor, int
|
|||
{
|
||||
case kDudeModernCustom:
|
||||
case kDudeModernCustomBurning:
|
||||
objActor->genDudeExtra().updReq[kGenDudePropertySpriteSize] = true;
|
||||
objActor->genDudeExtra().updReq[kGenDudePropertyMass] = true;
|
||||
objActor->genDudeExtra().updReq[kGenDudePropertyDmgScale] = true;
|
||||
objActor->genDudeExtra().updReq[kGenDudePropertyStates] = true;
|
||||
objActor->genDudeExtra().updReq[kGenDudePropertyAttack] = true;
|
||||
objActor->genDudeExtra.updReq[kGenDudePropertySpriteSize] = true;
|
||||
objActor->genDudeExtra.updReq[kGenDudePropertyMass] = true;
|
||||
objActor->genDudeExtra.updReq[kGenDudePropertyDmgScale] = true;
|
||||
objActor->genDudeExtra.updReq[kGenDudePropertyStates] = true;
|
||||
objActor->genDudeExtra.updReq[kGenDudePropertyAttack] = true;
|
||||
evPostActor(objActor, kGenDudeUpdTimeRate, kCallbackGenDudeUpdate);
|
||||
break;
|
||||
}
|
||||
|
@ -7933,12 +7934,13 @@ bool spritesTouching(int nXSprite1, int nXSprite2) {
|
|||
return hitactor->hasX() && hitactor->s().extra == nXSprite2;
|
||||
}
|
||||
|
||||
bool aiCanCrouch(spritetype* pSprite) {
|
||||
|
||||
bool aiCanCrouch(DBloodActor* actor)
|
||||
{
|
||||
auto pSprite = &actor->s();
|
||||
if (pSprite->type >= kDudeBase && pSprite->type < kDudeVanillaMax)
|
||||
return (gDudeInfoExtra[pSprite->type - kDudeBase].idlcseqofs >= 0 && gDudeInfoExtra[pSprite->type - kDudeBase].mvecseqofs >= 0);
|
||||
else if (pSprite->type == kDudeModernCustom || pSprite->type == kDudeModernCustomBurning)
|
||||
return gGenDudeExtra[pSprite->index].canDuck;
|
||||
return actor->genDudeExtra.canDuck;
|
||||
|
||||
return false;
|
||||
|
||||
|
@ -8445,7 +8447,7 @@ void aiPatrolThink(DBloodActor* actor) {
|
|||
|
||||
if ((pMarker->flags & kModernTypeFlag2) && (pMarker->flags & kModernTypeFlag1)) crouch = !crouch;
|
||||
else if (pMarker->flags & kModernTypeFlag2) crouch = false;
|
||||
else if ((pMarker->flags & kModernTypeFlag1) && aiCanCrouch(pSprite)) crouch = true;
|
||||
else if ((pMarker->flags & kModernTypeFlag1) && aiCanCrouch(actor)) crouch = true;
|
||||
|
||||
}
|
||||
|
||||
|
@ -8837,6 +8839,7 @@ void SerializeNNExts(FSerializer& arc)
|
|||
{
|
||||
if (arc.BeginObject("nnexts"))
|
||||
{
|
||||
#ifdef OLD_SAVEGAME
|
||||
// the GenDudeArray only contains valid info for kDudeModernCustom and kDudeModernCustomBurning so only save the relevant entries as these are not small.
|
||||
bool foundsome = false;
|
||||
for (int i = 0; i < kMaxSprites; i++)
|
||||
|
@ -8845,12 +8848,11 @@ void SerializeNNExts(FSerializer& arc)
|
|||
{
|
||||
if (!foundsome) arc.BeginArray("gendudeextra");
|
||||
foundsome = true;
|
||||
arc(nullptr, gGenDudeExtra[i]);
|
||||
arc(nullptr, bloodActors[i].genDudeExtra);
|
||||
}
|
||||
}
|
||||
if (foundsome) arc.EndArray();
|
||||
|
||||
#ifdef OLD_SAVEGAME
|
||||
// In compatibility mode write this out as a sparse array sorted by xsprite index.
|
||||
SPRITEMASS gSpriteMass[kMaxSprites];
|
||||
for (int i = 0; i < kMaxSprites; i++)
|
||||
|
|
Loading…
Reference in a new issue