mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- canSwim et.al.
This commit is contained in:
parent
acec23e034
commit
fb5916a3dd
5 changed files with 45 additions and 23 deletions
|
@ -5184,7 +5184,7 @@ void MoveDude(DBloodActor* actor)
|
|||
if (pSprite->type == kDudeModernCustom) {
|
||||
|
||||
evPost(actor, 0, kCallbackEnemeyBubble);
|
||||
if (!canSwim(pSprite)) actKillDude(actor, actor, kDamageFall, 1000 << 4);
|
||||
if (!canSwim(actor)) actKillDude(actor, actor, kDamageFall, 1000 << 4);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ bool CanMove(DBloodActor* actor, DBloodActor* target, int nAngle, int nRange)
|
|||
#ifdef NOONE_EXTENSIONS
|
||||
case kDudeModernCustom:
|
||||
case kDudeModernCustomBurning:
|
||||
if ((Crusher && !nnExtIsImmune(pSprite, pXSector->damageType)) || ((Water || Underwater) && !canSwim(pSprite))) return false;
|
||||
if ((Crusher && !nnExtIsImmune(pSprite, pXSector->damageType)) || ((Water || Underwater) && !canSwim(actor))) return false;
|
||||
return true;
|
||||
[[fallthrough]];
|
||||
#endif
|
||||
|
@ -1092,8 +1092,8 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType
|
|||
{
|
||||
actKillDude(actor, actor, kDamageFall, 65535);
|
||||
}
|
||||
}
|
||||
else if (canWalk(pSprite) && !inDodge(pXSprite->aiState) && !inRecoil(pXSprite->aiState))
|
||||
}
|
||||
else if (canWalk(actor) && !inDodge(pXSprite->aiState) && !inRecoil(pXSprite->aiState))
|
||||
{
|
||||
if (!dudeIsMelee(actor))
|
||||
{
|
||||
|
@ -1101,7 +1101,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType
|
|||
{
|
||||
if (!spriteIsUnderwater(actor))
|
||||
{
|
||||
if (!canDuck(pSprite) || !dudeIsPlayingSeq(actor, 14)) aiGenDudeNewState(actor, &genDudeDodgeShortL);
|
||||
if (!canDuck(actor) || !dudeIsPlayingSeq(actor, 14)) aiGenDudeNewState(actor, &genDudeDodgeShortL);
|
||||
else aiGenDudeNewState(actor, &genDudeDodgeShortD);
|
||||
|
||||
if (Chance(0x0200))
|
||||
|
@ -1279,7 +1279,7 @@ void RecoilDude(DBloodActor* actor)
|
|||
{
|
||||
if (Chance(rChance << 3) || (dudeIsMelee(actor) && Chance(rChance << 4))) aiGenDudeNewState(actor, &genDudeRecoilTesla);
|
||||
else if (pExtra->canRecoil && Chance(rChance)) aiGenDudeNewState(actor, &genDudeRecoilL);
|
||||
else if (canWalk(pSprite))
|
||||
else if (canWalk(actor))
|
||||
{
|
||||
|
||||
if (Chance(rChance >> 2)) aiGenDudeNewState(actor, &genDudeDodgeL);
|
||||
|
@ -1298,7 +1298,7 @@ void RecoilDude(DBloodActor* actor)
|
|||
short rState = inRecoil(pXSprite->aiState);
|
||||
if (rState > 0)
|
||||
{
|
||||
if (!canWalk(pSprite))
|
||||
if (!canWalk(actor))
|
||||
{
|
||||
if (rState == 1) pXSprite->aiState->nextState = &genDudeChaseNoWalkL;
|
||||
else if (rState == 2) pXSprite->aiState->nextState = &genDudeChaseNoWalkD;
|
||||
|
|
|
@ -627,7 +627,7 @@ static void unicultThinkChase(DBloodActor* actor)
|
|||
genDudeThrow2.nextState = &genDudeChaseL;
|
||||
if (dist > 5072 && Chance(0x5000))
|
||||
{
|
||||
if (!canDuck(pSprite) || Chance(0x4000)) aiGenDudeNewState(actor, &genDudeDodgeShortL);
|
||||
if (!canDuck(actor) || Chance(0x4000)) aiGenDudeNewState(actor, &genDudeDodgeShortL);
|
||||
else aiGenDudeNewState(actor, &genDudeDodgeShortD);
|
||||
}
|
||||
else
|
||||
|
@ -1202,7 +1202,7 @@ void aiGenDudeMoveForward(DBloodActor* actor)
|
|||
int sin = Sin(pSprite->ang);
|
||||
int cos = Cos(pSprite->ang);
|
||||
|
||||
int frontSpeed = gGenDudeExtra[pSprite->index].moveSpeed;
|
||||
int frontSpeed = actor->genDudeExtra().moveSpeed;
|
||||
actor->xvel() += MulScale(cos, frontSpeed, 30);
|
||||
actor->yvel() += MulScale(sin, frontSpeed, 30);
|
||||
}
|
||||
|
@ -1304,7 +1304,7 @@ void aiGenDudeNewState(DBloodActor* actor, AISTATE* pAIState)
|
|||
|
||||
}
|
||||
|
||||
if (!gGenDudeExtra[pSprite->index].canRecoil)
|
||||
if (!actor->genDudeExtra().canRecoil)
|
||||
{
|
||||
if (pAIState == &genDudeRecoilL || pAIState == &genDudeRecoilD) pAIState = &genDudeIdleL;
|
||||
else if (pAIState == &genDudeRecoilW) pAIState = &genDudeIdleW;
|
||||
|
@ -1474,8 +1474,8 @@ void removeLeech(DBloodActor* actLeech, bool delSprite)
|
|||
|
||||
sfxPlay3DSoundCP(pLeech, 490, -1, 0,60000);
|
||||
|
||||
if (pLeech->owner >= 0 && pLeech->owner < kMaxSprites)
|
||||
gGenDudeExtra[sprite[pLeech->owner].index].pLifeLeech = nullptr;
|
||||
if (actLeech->GetOwner())
|
||||
actLeech->GetOwner()->genDudeExtra().pLifeLeech = nullptr;
|
||||
|
||||
if (delSprite)
|
||||
{
|
||||
|
@ -2254,7 +2254,14 @@ void updateTargetOfSlaves(DBloodActor* actor)
|
|||
pExtra->slaveCount = writeindex;
|
||||
}
|
||||
|
||||
short inDodge(AISTATE* aiState) {
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
short inDodge(AISTATE* aiState)
|
||||
{
|
||||
if (aiState == &genDudeDodgeL) return 1;
|
||||
else if (aiState == &genDudeDodgeD) return 2;
|
||||
else if (aiState == &genDudeDodgeW) return 3;
|
||||
|
@ -2309,18 +2316,33 @@ short inDuck(AISTATE* aiState) {
|
|||
}
|
||||
|
||||
|
||||
bool canSwim(spritetype* pSprite) {
|
||||
return gGenDudeExtra[pSprite->index].canSwim;
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool canSwim(DBloodActor* actor)
|
||||
{
|
||||
return actor->genDudeExtra().canSwim;
|
||||
}
|
||||
|
||||
bool canDuck(spritetype* pSprite) {
|
||||
return gGenDudeExtra[pSprite->index].canDuck;
|
||||
bool canDuck(DBloodActor* actor)
|
||||
{
|
||||
return actor->genDudeExtra().canDuck;
|
||||
}
|
||||
|
||||
bool canWalk(spritetype* pSprite) {
|
||||
return gGenDudeExtra[pSprite->index].canWalk;
|
||||
bool canWalk(DBloodActor* actor)
|
||||
{
|
||||
return actor->genDudeExtra().canWalk;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int genDudeSeqStartId(XSPRITE* pXSprite) {
|
||||
if (genDudePrepare(&sprite[pXSprite->reference], kGenDudePropertyStates)) return pXSprite->data2;
|
||||
else return kGenDudeDefaultSeq;
|
||||
|
|
|
@ -215,9 +215,9 @@ int getRecoilChance(DBloodActor* pSprite);
|
|||
bool dudeIsMelee(DBloodActor* pXSprite);
|
||||
void updateTargetOfSlaves(DBloodActor* pSprite);
|
||||
void updateTargetOfLeech(DBloodActor* pSprite);
|
||||
bool canSwim(spritetype* pSprite);
|
||||
bool canDuck(spritetype* pSprite);
|
||||
bool canWalk(spritetype* pSprite);
|
||||
bool canSwim(DBloodActor* actor);
|
||||
bool canDuck(DBloodActor* actor);
|
||||
bool canWalk(DBloodActor* actor);
|
||||
short inDodge(AISTATE* aiState);
|
||||
bool inIdle(AISTATE* aiState);
|
||||
bool inAttack(AISTATE* aiState);
|
||||
|
|
|
@ -7485,7 +7485,7 @@ void aiPatrolThink(DBloodActor* actor) {
|
|||
|
||||
|
||||
bool crouch = (pXSprite->unused1 & kDudeFlagCrouch), uwater = spriteIsUnderwater(actor);
|
||||
if (!spriRangeIsFine(nMarker) || (pSprite->type == kDudeModernCustom && ((uwater && !canSwim(pSprite)) || !canWalk(pSprite)))) {
|
||||
if (!spriRangeIsFine(nMarker) || (pSprite->type == kDudeModernCustom && ((uwater && !canSwim(actor)) || !canWalk(actor)))) {
|
||||
aiPatrolStop(pSprite, -1);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue