- floatified GetRepeatFromHeight's input.

This commit is contained in:
Christoph Oelckers 2022-08-31 18:43:02 +02:00
parent 49b9863e42
commit dd171cd158
3 changed files with 9 additions and 9 deletions

View file

@ -2250,9 +2250,9 @@ inline bool Facing(DSWActor* actor1, DSWActor* actor2)
}
// Given a z height and sprite return the correct y repeat value
inline int GetRepeatFromHeight(DSWActor* sp, int zh)
inline int GetRepeatFromHeight(DSWActor* sp, double zh)
{
return zh / (4 * tileHeight(sp->spr.picnum));
return int(zh * 64) / tileHeight(sp->spr.picnum);
}
inline bool SpriteInDiveArea(DSWActor* a)

View file

@ -1494,7 +1494,7 @@ void SpawnFlashBombOnActor(DSWActor* actor)
DSWActor* flameActor = actor->user.flameActor;
if (flameActor != nullptr)
{
int sizez = (int_ActorSizeZ(actor) * 5) >> 2;
double sizez = ActorSizeZ(actor) * 1.25;
if (flameActor->user.Counter >= GetRepeatFromHeight(flameActor, sizez))
{
@ -1504,7 +1504,7 @@ void SpawnFlashBombOnActor(DSWActor* actor)
else
{
// increase max size
flameActor->user.Counter += GetRepeatFromHeight(flameActor, 8 << 8) * 2;
flameActor->user.Counter += GetRepeatFromHeight(flameActor, 8) * 2;
}
// Counter is max size
@ -1532,7 +1532,7 @@ void SpawnFlashBombOnActor(DSWActor* actor)
if (actor->user.flameActor != nullptr)
{
actorNew->user.Counter = GetRepeatFromHeight(actorNew, int_ActorSizeZ(actor) >> 1) * 4;
actorNew->user.Counter = GetRepeatFromHeight(actorNew, ActorSizeZ(actor) * 0.5) * 4;
}
else
actorNew->user.Counter = 0; // max flame size

View file

@ -9596,7 +9596,7 @@ void SpawnFireballFlames(DSWActor* actor, DSWActor* enemyActor)
auto flameActor = enemyActor->user.flameActor;
if (flameActor != nullptr)
{
int sizez = int_ActorSizeZ(enemyActor) + (int_ActorSizeZ(enemyActor) >> 2);
double sizez = ActorSizeZ(enemyActor) + (ActorSizeZ(enemyActor) * 0.25);
if ((enemyActor->spr.extra & SPRX_BURNABLE))
return;
@ -9609,7 +9609,7 @@ void SpawnFireballFlames(DSWActor* actor, DSWActor* enemyActor)
else
{
//increase max size
flameActor->user.Counter += GetRepeatFromHeight(flameActor, 8<<8);
flameActor->user.Counter += GetRepeatFromHeight(flameActor, 8);
}
// Counter is max size
@ -9640,12 +9640,12 @@ void SpawnFireballFlames(DSWActor* actor, DSWActor* enemyActor)
// large flame for trees and such
if ((enemyActor->spr.extra & SPRX_BURNABLE))
{
int sizez = int_ActorSizeZ(enemyActor) + (int_ActorSizeZ(enemyActor) >> 2);
double sizez = ActorSizeZ(enemyActor) + (ActorSizeZ(enemyActor) * 0.25);
actorNew->user.Counter = GetRepeatFromHeight(actorNew, sizez);
}
else
{
actorNew->user.Counter = GetRepeatFromHeight(actorNew, int_ActorSizeZ(enemyActor)>>1);
actorNew->user.Counter = GetRepeatFromHeight(actorNew, ActorSizeZ(enemyActor) * 0.5);
}
}
else