mirror of
https://github.com/ZDoom/Raze.git
synced 2025-04-07 00:11:22 +00:00
- Blood: Floatify actAirDrag()
and some associated XSECTOR
members.
* Left `XSECTOR::windVel` as an integer type for now.
This commit is contained in:
parent
7747205e03
commit
4788e26596
6 changed files with 16 additions and 20 deletions
|
@ -4469,10 +4469,9 @@ static void ProcessTouchObjects(DBloodActor* actor)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void actAirDrag(DBloodActor* actor, int a2)
|
||||
void actAirDrag(DBloodActor* actor, fixed_t drag)
|
||||
{
|
||||
int wind_x = 0;
|
||||
int wind_y = 0;
|
||||
DVector2 windvel{};
|
||||
assert(actor->sector());
|
||||
sectortype* pSector = actor->sector();
|
||||
if (pSector->hasX())
|
||||
|
@ -4480,15 +4479,12 @@ void actAirDrag(DBloodActor* actor, int a2)
|
|||
XSECTOR* pXSector = &pSector->xs();
|
||||
if (pXSector->windVel && (pXSector->windAlways || pXSector->busy))
|
||||
{
|
||||
int wind = pXSector->windVel << 12;
|
||||
if (!pXSector->windAlways && pXSector->busy) wind = MulScale(wind, pXSector->busy, 16);
|
||||
wind_x = MulScale(wind, Cos(pXSector->windAng), 30);
|
||||
wind_y = MulScale(wind, Sin(pXSector->windAng), 30);
|
||||
double wind = FixedToFloat<4>(pXSector->windVel);
|
||||
if (!pXSector->windAlways && pXSector->busy) wind *= FixedToFloat(pXSector->busy);
|
||||
windvel = pXSector->windAng.ToVector() * wind;
|
||||
}
|
||||
}
|
||||
actor->add_int_bvel_x(MulScale(wind_x - actor->int_vel().X, a2, 16));
|
||||
actor->add_int_bvel_y(MulScale(wind_y - actor->int_vel().Y, a2, 16));
|
||||
actor->add_int_bvel_z(-MulScale(actor->int_vel().Z, a2, 16));
|
||||
actor->vel += DVector3(windvel - actor->vel.XY(), -actor->vel.Z) * FixedToFloat(drag);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -5640,7 +5636,7 @@ static void actCheckThings()
|
|||
GetActorExtents(actor, &top, &bottom);
|
||||
if (getflorzofslopeptr(pSector, actor->spr.pos) <= bottom)
|
||||
{
|
||||
int angle = pXSector->panAngle;
|
||||
int angle = pXSector->panAngle.Buildang();
|
||||
int speed = 0;
|
||||
if (pXSector->panAlways || pXSector->state || pXSector->busy)
|
||||
{
|
||||
|
@ -6065,7 +6061,7 @@ static void actCheckDudes()
|
|||
GetActorExtents(actor, &top, &bottom);
|
||||
if (getflorzofslopeptr(pSector, actor->spr.pos) <= bottom)
|
||||
{
|
||||
int angle = pXSector->panAngle;
|
||||
int angle = pXSector->panAngle.Buildang();
|
||||
int speed = 0;
|
||||
if (pXSector->panAlways || pXSector->state || pXSector->busy)
|
||||
{
|
||||
|
|
|
@ -218,7 +218,7 @@ bool actHealDude(DBloodActor* pXDude, int a2, int a3);
|
|||
void actKillDude(DBloodActor* a1, DBloodActor* pSprite, DAMAGE_TYPE a3, int a4);
|
||||
int actDamageSprite(DBloodActor* pSource, DBloodActor* pTarget, DAMAGE_TYPE damageType, int damage);
|
||||
void actHitcodeToData(int a1, HitInfo *pHitInfo, DBloodActor **actor, walltype **a7 = nullptr);
|
||||
void actAirDrag(DBloodActor *pSprite, int a2);
|
||||
void actAirDrag(DBloodActor *pSprite, fixed_t drag);
|
||||
void actExplodeSprite(DBloodActor *pSprite);
|
||||
void actActivateGibObject(DBloodActor *actor);
|
||||
void actProcessSprites(void);
|
||||
|
|
|
@ -329,7 +329,7 @@ void dbLoadMap(const char* pPath, DVector3& pos, short* pAngle, int* cursectnum,
|
|||
pXSector->Underwater = bitReader.readUnsigned(1);
|
||||
pXSector->Depth = bitReader.readUnsigned(3);
|
||||
pXSector->panVel = bitReader.readUnsigned(8);
|
||||
pXSector->panAngle = bitReader.readUnsigned(11);
|
||||
pXSector->panAngle = mapangle(bitReader.readUnsigned(11));
|
||||
pXSector->unused1 = bitReader.readUnsigned(1);
|
||||
pXSector->decoupled = bitReader.readUnsigned(1);
|
||||
pXSector->triggerOnce = bitReader.readUnsigned(1);
|
||||
|
@ -363,7 +363,7 @@ void dbLoadMap(const char* pPath, DVector3& pos, short* pAngle, int* cursectnum,
|
|||
pSector->floorypan_ += bitReader.readUnsigned(8) / 256.f;
|
||||
pXSector->locked = bitReader.readUnsigned(1);
|
||||
pXSector->windVel = bitReader.readUnsigned(10);
|
||||
pXSector->windAng = bitReader.readUnsigned(11);
|
||||
pXSector->windAng = mapangle(bitReader.readUnsigned(11));
|
||||
pXSector->windAlways = bitReader.readUnsigned(1);
|
||||
pXSector->dudeLockout = bitReader.readUnsigned(1);
|
||||
pXSector->bobTheta = bitReader.readUnsigned(11);
|
||||
|
|
|
@ -201,10 +201,10 @@ struct XSECTOR {
|
|||
uint16_t rxID; // RX ID
|
||||
uint16_t busyTimeA; // OFF->ON busyTime
|
||||
uint16_t waitTimeA; // OFF->ON waitTime
|
||||
uint16_t panAngle; // Motion angle
|
||||
DAngle panAngle; // Motion angle
|
||||
uint16_t busyTimeB; // ON->OFF busyTime
|
||||
uint16_t waitTimeB; // ON->OFF waitTime
|
||||
uint16_t windAng; // Wind ang
|
||||
DAngle windAng; // Wind ang
|
||||
uint16_t bobTheta; // Motion Theta
|
||||
int16_t bobSpeed; // Motion speed
|
||||
|
||||
|
|
|
@ -1303,7 +1303,7 @@ void nnExtProcessSuperSprites()
|
|||
if ((uwater = pXSector->Underwater) != 0) airVel <<= 6;
|
||||
if (pXSector->panVel != 0 && getflorzofslopeptrf(debrisactor->sector(), debrisactor->spr.pos) <= bottom)
|
||||
{
|
||||
int angle = pXSector->panAngle; int speed = 0;
|
||||
int angle = pXSector->panAngle.Buildang(); int speed = 0;
|
||||
if (pXSector->panAlways || pXSector->state || pXSector->busy)
|
||||
{
|
||||
speed = pXSector->panVel << 9;
|
||||
|
@ -3470,7 +3470,7 @@ void useSectorWindGen(DBloodActor* sourceactor, sectortype* pSector)
|
|||
sourceactor->set_int_ang(ClipLow(ang, -kAng180));
|
||||
}
|
||||
|
||||
pXSector->windAng = sourceactor->int_ang();
|
||||
pXSector->windAng = sourceactor->spr.angle;
|
||||
|
||||
if (sourceactor->xspr.data3 > 0 && sourceactor->xspr.data3 < 4)
|
||||
{
|
||||
|
|
|
@ -277,7 +277,7 @@ void DoSectorPanning(void)
|
|||
XSECTOR* pXSector = &pSector->xs();
|
||||
if (pXSector->panAlways || pXSector->busy)
|
||||
{
|
||||
int angle = pXSector->panAngle + 1024;
|
||||
int angle = pXSector->panAngle.Buildang() + 1024;
|
||||
int speed = pXSector->panVel << 10;
|
||||
if (!pXSector->panAlways && (pXSector->busy & 0xffff))
|
||||
speed = MulScale(speed, pXSector->busy, 16);
|
||||
|
|
Loading…
Reference in a new issue