- BuildAnim in Exhumed

This commit is contained in:
Christoph Oelckers 2022-10-07 19:40:27 +02:00
parent f30a76dfc9
commit 2ceb41fcf4
12 changed files with 35 additions and 37 deletions

View file

@ -30,10 +30,6 @@ BEGIN_PS_NS
void InitAnims();
void DestroyAnim(DExhumedActor* nAnim);
DExhumedActor* BuildAnim(DExhumedActor* actor, int val, int val2, const DVector3& pos, sectortype* pSector, double nScale, int nFlag);
DExhumedActor* BuildAnimI(DExhumedActor* actor, int val, int val2, const DVector3& pos, sectortype* pSector, int nRepeat, int nFlag)
{
return BuildAnim(actor, val, val2, pos, pSector, nRepeat * REPEAT_SCALE, nFlag);
}
void FuncAnim(int, int, int, int);
void BuildExplosion(DExhumedActor* actor);

View file

@ -268,7 +268,7 @@ void BuildExplosion(DExhumedActor* pActor)
edx = 34;
}
BuildAnimI(nullptr, edx, 0, pActor->spr.pos, pActor->sector(), pActor->spr.ScaleX() * INV_REPEAT_SCALE, 4);
BuildAnim(nullptr, edx, 0, pActor->spr.pos, pActor->sector(), pActor->spr.ScaleX(), 4);
}
//---------------------------------------------------------------------------
@ -279,17 +279,18 @@ void BuildExplosion(DExhumedActor* pActor)
void BuildSplash(DExhumedActor* pActor, sectortype* pSector)
{
int nRepeat, nSound;
int nSound;
double nScale;
if (pActor->spr.statnum != 200)
{
int rep = int(pActor->spr.ScaleX() * INV_REPEAT_SCALE);
nRepeat = rep + (RandomWord() % rep);
double rep = pActor->spr.ScaleX();
nScale = rep + RandomFloat(rep);
nSound = kSound0;
}
else
{
nRepeat = 20;
nScale = 0.3125;
nSound = kSound1;
}
@ -308,7 +309,7 @@ void BuildSplash(DExhumedActor* pActor, sectortype* pSector)
nFlag = 0;
}
auto pSpawned = BuildAnimI(nullptr, edx, 0, DVector3(pActor->spr.pos.XY(), pSector->floorz), pSector, nRepeat, nFlag);
auto pSpawned = BuildAnim(nullptr, edx, 0, DVector3(pActor->spr.pos.XY(), pSector->floorz), pSector, nScale, nFlag);
if (!bIsLava)
{

View file

@ -113,7 +113,7 @@ void AIBubble::Tick(RunListEvent* ev)
auto pSectAbove = pSector->pAbove;
if (pActor->spr.hitag > -1 && pSectAbove != nullptr) {
BuildAnimI(nullptr, 70, 0, DVector3(pActor->spr.pos.XY(), pSectAbove->floorz), pSectAbove, 64, 0);
BuildAnim(nullptr, 70, 0, DVector3(pActor->spr.pos.XY(), pSectAbove->floorz), pSectAbove, 1., 0);
}
DestroyBubble(pActor);

View file

@ -177,7 +177,7 @@ void IgniteSprite(DExhumedActor* pActor)
{
pActor->spr.hitag += 2;
auto pAnimActor = BuildAnimI(nullptr, 38, 0, pActor->spr.pos, pActor->sector(), 40, 20);
auto pAnimActor = BuildAnim(nullptr, 38, 0, pActor->spr.pos, pActor->sector(), 0.625, 20);
if (pAnimActor)
{
@ -216,7 +216,7 @@ void BulletHitsSprite(Bullet *pBullet, DExhumedActor* pBulletActor, DExhumedActo
}
if (!RandomSize(2)) {
BuildAnimI(nullptr, pBulletInfo->field_C, 0, pos, pSector, 40, pBulletInfo->nFlags);
BuildAnim(nullptr, pBulletInfo->field_C, 0, pos, pSector, 0.625, pBulletInfo->nFlags);
}
return;
@ -279,7 +279,7 @@ void BulletHitsSprite(Bullet *pBullet, DExhumedActor* pBulletActor, DExhumedActo
if (nStat <= 90 || nStat >= 199)
{
BuildAnimI(nullptr, pBulletInfo->field_C, 0, pos, pSector, 40, pBulletInfo->nFlags);
BuildAnim(nullptr, pBulletInfo->field_C, 0, pos, pSector, 0.625, pBulletInfo->nFlags);
return;
}
@ -291,13 +291,13 @@ void BulletHitsSprite(Bullet *pBullet, DExhumedActor* pBulletActor, DExhumedActo
case 102:
case kStatExplodeTrigger:
case kStatExplodeTarget:
BuildAnimI(nullptr, 12, 0, pos, pSector, 40, 0);
BuildAnim(nullptr, 12, 0, pos, pSector, 0.625, 0);
break;
default:
BuildAnimI(nullptr, 39, 0, pos, pSector, 40, 0);
BuildAnim(nullptr, 39, 0, pos, pSector, 0.625, 0);
if (pBullet->nType > 2)
{
BuildAnimI(nullptr, pBulletInfo->field_C, 0, pos, pSector, 40, pBulletInfo->nFlags);
BuildAnim(nullptr, pBulletInfo->field_C, 0, pos, pSector, 0.625, pBulletInfo->nFlags);
}
break;
}
@ -491,7 +491,7 @@ HITSPRITE:
}
else
{
BuildAnimI(nullptr, pBulletInfo->field_C, 0, pos, pHitSect, 40, pBulletInfo->nFlags);
BuildAnim(nullptr, pBulletInfo->field_C, 0, pos, pHitSect, 0.625, pBulletInfo->nFlags);
}
}
else
@ -510,7 +510,7 @@ HITSPRITE:
}
// draws bullet puff on walls when they're shot
BuildAnimI(nullptr, pBulletInfo->field_C, 0, pos.plusZ(zOffset - 16), pHitSect, 40, pBulletInfo->nFlags);
BuildAnim(nullptr, pBulletInfo->field_C, 0, pos.plusZ(zOffset - 16), pHitSect, 0.625, pBulletInfo->nFlags);
}
}
else
@ -807,7 +807,7 @@ void AIBullet::Tick(RunListEvent* ev)
if (nFlag & 0x80)
{
BuildAnimI(nullptr, 45, 0, pActor->spr.pos, pActor->sector(), pActor->spr.ScaleX() * REPEAT_SCALE, 0);
BuildAnim(nullptr, 45, 0, pActor->spr.pos, pActor->sector(), pActor->spr.ScaleX(), 0);
}
BulletList[nBullet].nFrame++;

View file

@ -78,7 +78,7 @@ void BuildFishLimb(DExhumedActor* pActor, int anim)
void BuildBlood(const DVector3& pos, sectortype* pSector)
{
BuildAnimI(nullptr, kSeqFish, 36, pos, pSector, 75, 128);
BuildAnim(nullptr, kSeqFish, 36, pos, pSector, 1.171875, 128);
}
//---------------------------------------------------------------------------

View file

@ -166,7 +166,8 @@ void BuildGrenade(int nPlayer)
void ExplodeGrenade(DExhumedActor* pActor)
{
int var_28, var_20;
int var_28;
double scale;
int nPlayer = pActor->spr.intowner;
auto pGrenadeSect = pActor->sector();
@ -176,13 +177,13 @@ void ExplodeGrenade(DExhumedActor* pActor)
if (pGrenadeSect->Flag & kSectUnderwater)
{
var_28 = 75;
var_20 = 60;
scale = 0.9375;
}
else
{
if (pActor->spr.pos.Z < pGrenadeSect->floorz)
{
var_20 = 200;
scale = 3.125;
var_28 = 36;
// TODO MonoOut("GRENPOW\n");
@ -190,7 +191,7 @@ void ExplodeGrenade(DExhumedActor* pActor)
else
{
var_28 = 34;
var_20 = 150;
scale = 2.3475;
// TODO MonoOut("GRENBOOM\n");
}
@ -219,7 +220,7 @@ void ExplodeGrenade(DExhumedActor* pActor)
runlist_RadialDamageEnemy(pActor, nDamage, BulletInfo[kWeaponGrenade].nRadius);
BuildAnimI(nullptr, var_28, 0, pActor->spr.pos, pActor->sector(), var_20, 4);
BuildAnim(nullptr, var_28, 0, pActor->spr.pos, pActor->sector(), scale, 4);
AddFlash(pActor->sector(), pActor->spr.pos, 128);
DestroyGrenade(pActor);

View file

@ -777,7 +777,7 @@ loc_flag:
else if (pActor2->spr.statnum == 102)
{
// loc_27370:
BuildAnimI(nullptr, 12, 0, thePos, pSectorB, 30, 0);
BuildAnim(nullptr, 12, 0, thePos, pSectorB, 0.46875, 0);
}
else if (pActor2->spr.statnum == kStatExplodeTrigger) {
var_28 += 2;
@ -789,7 +789,7 @@ loc_flag:
else
{
// loc_27370:
BuildAnimI(nullptr, 12, 0, thePos, pSectorB, 30, 0);
BuildAnim(nullptr, 12, 0, thePos, pSectorB, 0.46875, 0);
}
}
}

View file

@ -135,7 +135,7 @@ void BuildItemAnim(DExhumedActor* pActor)
if (nItemAnimInfo[nItem].a >= 0)
{
auto pAnimActor = BuildAnimI(pActor, 41, nItemAnimInfo[nItem].a, pActor->spr.pos, pActor->sector(), nItemAnimInfo[nItem].repeat, 20);
auto pAnimActor = BuildAnim(pActor, 41, nItemAnimInfo[nItem].a, pActor->spr.pos, pActor->sector(), nItemAnimInfo[nItem].repeat * REPEAT_SCALE, 20);
if (nItem == 44) {
pAnimActor->spr.cstat |= CSTAT_SPRITE_TRANSLUCENT;
@ -404,13 +404,13 @@ void DropMagic(DExhumedActor* pActor)
if (nMagicCount <= 0)
{
auto pAnimActor = BuildAnimI(
auto pAnimActor = BuildAnim(
nullptr,
64,
0,
pActor->spr.pos,
pActor->sector(),
48,
0.75,
4);
if (pAnimActor)
@ -481,7 +481,7 @@ void DoRegenerates()
if (pActor->spr.extra <= 0)
{
BuildAnimI(nullptr, 38, 0, pActor->spr.pos, pActor->sector(), 64, 4);
BuildAnim(nullptr, 38, 0, pActor->spr.pos, pActor->sector(), 1, 4);
D3PlayFX(StaticSound[kSoundTorchOn], pActor);
}
else {

View file

@ -2023,7 +2023,7 @@ void AIObject::Tick(RunListEvent* ev)
}
AddFlash(pActor->sector(), pActor->spr.pos, 128);
BuildAnimI(nullptr, var_18, 0, DVector3(pActor->spr.pos.XY(), pActor->sector()->floorz), pActor->sector(), 240, 4);
BuildAnim(nullptr, var_18, 0, DVector3(pActor->spr.pos.XY(), pActor->sector()->floorz), pActor->sector(), 3.75, 4);
// int edi = nSprite | 0x4000;

View file

@ -2585,7 +2585,7 @@ sectdone:
sectortype* mouthSect;
auto pos = WheresMyMouth(nPlayer, &mouthSect);
BuildAnimI(nullptr, 71, 0, DVector3(pos.XY(), pPlayerActor->spr.pos.Z + 15), mouthSect, 75, 128);
BuildAnim(nullptr, 71, 0, DVector3(pos.XY(), pPlayerActor->spr.pos.Z + 15), mouthSect, 1.171875, 128);
}
break;
case 17:

View file

@ -269,7 +269,7 @@ void DestroyEgg(int nEgg)
if (QueenEgg[nEgg].nAction != 4)
{
BuildAnimI(nullptr, 34, 0, pActor->spr.pos, pActor->sector(), pActor->spr.xrepeat, 4);
BuildAnim(nullptr, 34, 0, pActor->spr.pos, pActor->sector(), pActor->spr.ScaleX(), 4);
}
else
{
@ -1531,7 +1531,7 @@ void AIQueen::Damage(RunListEvent* ev)
QueenList[nQueen].nHealth = 4000;
QueenList[nQueen].nAction = 7;
BuildAnimI(nullptr, 36, 0, pActor->spr.pos.plusZ(-30), pActor->sector(), pActor->spr.xrepeat, 4);
BuildAnim(nullptr, 36, 0, pActor->spr.pos.plusZ(-30), pActor->sector(), pActor->spr.ScaleX(), 4);
break;
case 2:
QueenList[nQueen].nHealth = 4000;

View file

@ -146,7 +146,7 @@ void ExplodeSnakeSprite(DExhumedActor* pActor, int nPlayer)
pActor->pTarget = nOwner;
BuildAnimI(nullptr, 23, 0, pActor->spr.pos, pActor->sector(), 40, 4);
BuildAnim(nullptr, 23, 0, pActor->spr.pos, pActor->sector(), 0.625, 4);
AddFlash(pActor->sector(), pActor->spr.pos, 128);