mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 22:51:50 +00:00
- cleaned up burn code.
This commit is contained in:
parent
c0b013ac0c
commit
484d016172
9 changed files with 23 additions and 29 deletions
|
@ -2976,7 +2976,7 @@ static bool actKillModernDude(DBloodActor* actor, DAMAGE_TYPE damageType)
|
|||
else
|
||||
{
|
||||
pXSprite->burnTime = 0;
|
||||
pXSprite->burnSource = -1;
|
||||
actor->SetBurnSource(nullptr);
|
||||
damageType = kDamageFall;
|
||||
}
|
||||
}
|
||||
|
@ -7369,6 +7369,13 @@ void MakeSplash(DBloodActor* actor)
|
|||
}
|
||||
}
|
||||
|
||||
void actBurnSprite(DBloodActor* pSource, DBloodActor* pTarget, int nTime)
|
||||
{
|
||||
auto pXSprite = &pTarget->x();
|
||||
pXSprite->burnTime = ClipHigh(pXSprite->burnTime + nTime, sprite[pXSprite->reference].statnum == kStatDude ? 2400 : 1200);
|
||||
pTarget->SetBurnSource(pSource);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
|
|
@ -198,11 +198,6 @@ template<typename T> bool IsAmmoSprite(T const * const pSprite)
|
|||
return pSprite->type >= kItemAmmoBase && pSprite->type < kItemAmmoMax;
|
||||
}
|
||||
|
||||
inline void actBurnSprite(int nSource, XSPRITE *pXSprite, int nTime)
|
||||
{
|
||||
pXSprite->burnTime = ClipHigh(pXSprite->burnTime + nTime, sprite[pXSprite->reference].statnum == kStatDude ? 2400 : 1200);
|
||||
pXSprite->burnSource = nSource;
|
||||
}
|
||||
|
||||
#ifdef POLYMER
|
||||
void actAddGameLight(int lightRadius, int spriteNum, int zOffset, int lightRange, int lightColor, int lightPrio);
|
||||
|
@ -236,6 +231,8 @@ DBloodActor * actSpawnThing(int nSector, int x, int y, int z, int nThingType);
|
|||
DBloodActor* actFireThing(DBloodActor* pSprite, int a2, int a3, int a4, int thingType, int a6);
|
||||
DBloodActor* actFireMissile(DBloodActor *pSprite, int a2, int a3, int a4, int a5, int a6, int nType);
|
||||
|
||||
void actBurnSprite(DBloodActor* pSource, DBloodActor* pTarget, int nTime);
|
||||
|
||||
int actGetRespawnTime(DBloodActor *pSprite);
|
||||
bool actCheckRespawn(DBloodActor *pSprite);
|
||||
bool actCanSplatWall(int nWall);
|
||||
|
|
|
@ -51,13 +51,10 @@ void sub_71A90(int, DBloodActor* actor)
|
|||
XSPRITE* pXSprite = &actor->x();
|
||||
spritetype* pSprite = &actor->s();
|
||||
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||
spritetype* pTarget = &actor->GetTarget()->s();
|
||||
XSPRITE* pXTarget = &actor->GetTarget()->x();
|
||||
int nTarget = pTarget->index;
|
||||
int nOwner = pSprite->owner;
|
||||
if (pXTarget->burnTime == 0)
|
||||
evPostActor(actor->GetTarget(), 0, kCallbackFXFlameLick);
|
||||
actBurnSprite(nOwner, pXTarget, 40);
|
||||
auto target = actor->GetTarget();
|
||||
if (target->x().burnTime == 0)
|
||||
evPostActor(target, 0, kCallbackFXFlameLick);
|
||||
actBurnSprite(actor->GetOwner(), target, 40);
|
||||
if (Chance(0x6000))
|
||||
aiNewState(actor, &tcherno13A9D4);
|
||||
}
|
||||
|
|
|
@ -745,7 +745,7 @@ static void unicultThinkChase(DBloodActor* actor)
|
|||
else aiGenDudeNewState(actor, &genDudeDodgeShortW);
|
||||
return;
|
||||
}
|
||||
else if (dist <= 4000 && pXTarget->burnTime >= 2000 && pXTarget->burnSource == pSprite->index)
|
||||
else if (dist <= 4000 && pXTarget->burnTime >= 2000 && targetactor->GetBurnSource() == actor)
|
||||
{
|
||||
if (dist > meleeVector->maxDist) aiGenDudeNewState(actor, &genDudeChaseL);
|
||||
else aiGenDudeNewState(actor, &genDudePunch);
|
||||
|
|
|
@ -275,13 +275,6 @@ inline int DeleteSprite(DBloodActor* nSprite)
|
|||
return 0;
|
||||
}
|
||||
|
||||
inline void actBurnSprite(DBloodActor* pSource, DBloodActor* pTarget, int nTime)
|
||||
{
|
||||
auto pXSprite = &pTarget->x();
|
||||
pXSprite->burnTime = ClipHigh(pXSprite->burnTime + nTime, sprite[pXSprite->reference].statnum == kStatDude ? 2400 : 1200);
|
||||
pXSprite->burnSource = pSource? pSource->s().index : -1;
|
||||
}
|
||||
|
||||
inline void GetActorExtents(DBloodActor* actor, int* top, int* bottom)
|
||||
{
|
||||
GetSpriteExtents(&actor->s(), top, bottom);
|
||||
|
|
|
@ -311,7 +311,7 @@ const char* GameInterface::GenericCheat(int player, int cheat)
|
|||
{
|
||||
if (!gMe->pXSprite->burnTime)
|
||||
evPostActor(gMe->actor(), 0, kCallbackFXFlameLick);
|
||||
actBurnSprite(gMe->pSprite->index, gMe->pXSprite, 2400);
|
||||
actBurnSprite(gMe->actor(), gMe->actor(), 2400);
|
||||
return GStrings("TXTB_FIRED");
|
||||
}
|
||||
case kCheatEdmark:
|
||||
|
@ -324,7 +324,7 @@ const char* GameInterface::GenericCheat(int player, int cheat)
|
|||
gMe->armor[1] = VanillaMode() ? 200 : 3200;
|
||||
if (!gMe->pXSprite->burnTime)
|
||||
evPostActor(gMe->actor(), 0, kCallbackFXFlameLick);
|
||||
actBurnSprite(gMe->pSprite->index, gMe->pXSprite, 2400);
|
||||
actBurnSprite(gMe->actor(), gMe->actor(), 2400);
|
||||
return GStrings("TXTB_RETARD");
|
||||
}
|
||||
case kCheatSterno:
|
||||
|
|
|
@ -4710,7 +4710,7 @@ bool condCheckSprite(DBloodActor* aCond, int cmpOp, bool PUSH)
|
|||
case 65: // compare burn time (in %)
|
||||
var = (objActor->IsDudeActor()) ? 2400 : 1200;
|
||||
if (!condCmp((kPercFull * pXSpr->burnTime) / var, arg1, arg2, cmpOp)) return false;
|
||||
else if (PUSH && spriRangeIsFine(pXSpr->burnSource)) condPush(aCond, OBJ_SPRITE, 0, objActor->GetBurnSource());
|
||||
else if (PUSH && objActor->GetBurnSource()) condPush(aCond, OBJ_SPRITE, 0, objActor->GetBurnSource());
|
||||
return true;
|
||||
|
||||
case 66: // any flares stuck in this sprite?
|
||||
|
@ -6913,7 +6913,7 @@ void useTargetChanger(DBloodActor* sourceactor, DBloodActor* actor)
|
|||
int matesPerEnemy = 1;
|
||||
|
||||
// dude is burning?
|
||||
if (pXSprite->burnTime > 0 && spriRangeIsFine(pXSprite->burnSource))
|
||||
if (pXSprite->burnTime > 0 && actor->GetBurnSource())
|
||||
{
|
||||
if (IsBurningDude(actor)) return;
|
||||
else
|
||||
|
@ -6985,7 +6985,7 @@ void useTargetChanger(DBloodActor* sourceactor, DBloodActor* actor)
|
|||
if (actor->GetBurnSource() == targetactor)
|
||||
{
|
||||
pXSprite->burnTime = 0;
|
||||
pXSprite->burnSource = -1;
|
||||
actor->SetBurnSource(nullptr);
|
||||
}
|
||||
|
||||
// force stop attack dude
|
||||
|
@ -6993,7 +6993,7 @@ void useTargetChanger(DBloodActor* sourceactor, DBloodActor* actor)
|
|||
if (targetactor->GetBurnSource() == actor)
|
||||
{
|
||||
pXTarget->burnTime = 0;
|
||||
pXTarget->burnSource = -1;
|
||||
targetactor->SetBurnSource(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -684,7 +684,7 @@ void playerStart(int nPlayer, int bNewLevel)
|
|||
pSprite->clipdist = pDudeInfo->clipdist;
|
||||
pSprite->flags = 15;
|
||||
pXSprite->burnTime = 0;
|
||||
pXSprite->burnSource = -1;
|
||||
actor->SetBurnSource(nullptr);
|
||||
pPlayer->pXSprite->health = pDudeInfo->startHealth<<4;
|
||||
pPlayer->pSprite->cstat &= (unsigned short)~32768;
|
||||
pPlayer->bloodlust = 0;
|
||||
|
|
|
@ -1684,7 +1684,7 @@ void AltFireNapalm(int , PLAYER *pPlayer)
|
|||
pXSprite->data4 = ClipHigh(pPlayer->ammoCount[4], 12);
|
||||
UseAmmo(pPlayer, 4, pXSprite->data4);
|
||||
seqSpawn(22, 3, pMissile->extra, -1);
|
||||
actBurnSprite(pPlayer->pSprite->index, pXSprite, 600);
|
||||
actBurnSprite(pPlayer->actor(), &bloodActors[pMissile->index], 600);
|
||||
evPostActor(&bloodActors[pMissile->index], 0, kCallbackFXFlameLick);
|
||||
sfxPlay3DSound(pMissile, 480, 2, 0);
|
||||
pPlayer->visibility = 30;
|
||||
|
|
Loading…
Reference in a new issue