- floatified the return data from Trace().

This commit is contained in:
Christoph Oelckers 2016-03-23 18:07:04 +01:00
parent 70d87f94f2
commit 2dbd79cc8d
17 changed files with 105 additions and 108 deletions

View file

@ -2382,8 +2382,7 @@ void Net_DoCommand (int type, BYTE **stream, int player)
{
if (trace.HitType == TRACE_HitWall)
{
DVector3 hp(FIXED2DBL(trace.HitPos.x), FIXED2DBL(trace.HitPos.y), FIXED2DBL(trace.HitPos.z));
DImpactDecal::StaticCreate (s, hp, trace.Line->sidedef[trace.Side], NULL);
DImpactDecal::StaticCreate (s, trace.HitPos, trace.Line->sidedef[trace.Side], NULL);
}
}
}

View file

@ -286,7 +286,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks)
// with no relation to the size of the self shattering. I think it should
// base the number of shards on the size of the dead thing, so bigger
// things break up into more shards than smaller things.
// An actor with _f_radius() 20 and height 64 creates ~40 chunks.
// An actor with radius 20 and height 64 creates ~40 chunks.
numChunks = MAX<int>(4, int(self->radius * self->Height)/32);
i = (pr_freeze.Random2()) % (numChunks/4);
for (i = MAX (24, numChunks + i); i >= 0; i--)

View file

@ -9,7 +9,7 @@ static FRandom pr_orbit ("Orbit");
// Custom bridge --------------------------------------------------------
/*
args[0]: Bridge _f_radius(), in mapunits
args[0]: Bridge radius, in mapunits
args[1]: Bridge height, in mapunits
args[2]: Amount of bridge balls (if 0: Doom bridge)
args[3]: Rotation speed of bridge balls, in byte angle per seconds, sorta:

View file

@ -777,20 +777,20 @@ DBaseDecal *ShootDecal(const FDecalTemplate *tpl, AActor *basisactor, sector_t *
{
if (permanent)
{
decal = new DBaseDecal(FIXED2DBL(trace.HitPos.z));
decal = new DBaseDecal(trace.HitPos.Z);
wall = trace.Line->sidedef[trace.Side];
decal->StickToWall(wall, FIXED2DBL(trace.HitPos.x), FIXED2DBL(trace.HitPos.y), trace.ffloor);
decal->StickToWall(wall, trace.HitPos.X, trace.HitPos.Y, trace.ffloor);
tpl->ApplyToDecal(decal, wall);
// Spread decal to nearby walls if it does not all fit on this one
if (cl_spreaddecals)
{
decal->Spread(tpl, wall, FIXED2DBL(trace.HitPos.x), FIXED2DBL(trace.HitPos.y), FIXED2DBL(trace.HitPos.z), trace.ffloor);
decal->Spread(tpl, wall, trace.HitPos.X, trace.HitPos.Y, trace.HitPos.Z, trace.ffloor);
}
return decal;
}
else
{
return DImpactDecal::StaticCreate(tpl, DVector3(FIXED2DBL(trace.HitPos.x), FIXED2DBL(trace.HitPos.y), FIXED2DBL(trace.HitPos.z)), trace.Line->sidedef[trace.Side], NULL);
return DImpactDecal::StaticCreate(tpl, trace.HitPos, trace.Line->sidedef[trace.Side], NULL);
}
}
return NULL;

View file

@ -144,7 +144,7 @@ void DEarthquake::Tick ()
fixed_t dist;
dist = m_Spot->AproxDistance (victim, true);
// Check if in damage _f_radius()
// Check if in damage radius
if (dist < m_DamageRadius && victim->Z() <= victim->floorz)
{
if (pr_quake() < 50)

View file

@ -151,7 +151,7 @@ class ARandomSpawner : public AActor
{
tracer = target->target;
}
newmobj = P_SpawnMissileXYZ(_f_Pos(), target, target->target, cls, false);
newmobj = P_SpawnMissileXYZ(Pos(), target, target->target, cls, false);
}
else
{

View file

@ -50,6 +50,6 @@ IMPLEMENT_CLASS (ASpark)
void ASpark::Activate (AActor *activator)
{
Super::Activate (activator);
P_DrawSplash (args[0] ? args[0] : 32, _f_X(), _f_Y(), _f_Z(), FLOAT2ANGLE(Angles.Yaw.Degrees), 1);
P_DrawSplash (args[0] ? args[0] : 32, Pos(), Angles.Yaw, 1);
S_Sound (this, CHAN_AUTO, "world/spark", 1, ATTN_STATIC);
}

View file

@ -5789,7 +5789,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
argCount > 8 ? args[8] : 0,
argCount > 9 ? ACSToDouble(args[9]) : 1.0,
argCount > 10 ? ACSToDouble(args[10]) : 1.0,
argCount > 11 ? ACSToDouble(args[11]) : 1.0 );
argCount > 11 ? ACSToDouble(args[11]) : 1.0,
argCount > 12 ? args[12] : 0,
argCount > 13 ? args[13] : 0);
}

View file

@ -545,7 +545,7 @@ void P_RunEffect (AActor *actor, int effects)
}
}
void P_DrawSplash (int count, fixed_t x, fixed_t y, fixed_t z, angle_t angle, int kind)
void P_DrawSplash (int count, const DVector3 &pos, DAngle angle, int kind)
{
int color1, color2;
@ -562,7 +562,6 @@ void P_DrawSplash (int count, fixed_t x, fixed_t y, fixed_t z, angle_t angle, in
for (; count; count--)
{
particle_t *p = JitterParticle (10);
angle_t an;
if (!p)
break;
@ -573,10 +572,10 @@ void P_DrawSplash (int count, fixed_t x, fixed_t y, fixed_t z, angle_t angle, in
p->accz -= FRACUNIT/8;
p->accx += (M_Random () - 128) * 8;
p->accy += (M_Random () - 128) * 8;
p->z = z - M_Random () * 1024;
an = (angle + (M_Random() << 21)) >> ANGLETOFINESHIFT;
p->x = x + (M_Random () & 15)*finecosine[an];
p->y = y + (M_Random () & 15)*finesine[an];
p->z = FLOAT2FIXED(pos.Z) - M_Random () * 1024;
angle += M_Random() * (45./256);
p->x = FLOAT2FIXED(pos.X + (M_Random() & 15)*angle.Cos());
p->y = FLOAT2FIXED(pos.Y + (M_Random() & 15)*angle.Sin());
}
}

View file

@ -90,6 +90,6 @@ void P_RunEffects (void);
void P_RunEffect (AActor *actor, int effects);
void P_DrawRailTrail(AActor *source, const DVector3 &start, const DVector3 &end, int color1, int color2, double maxdiff = 0, int flags = 0, PClassActor *spawnclass = NULL, angle_t angle = 0, int duration = 35, double sparsity = 1.0, double drift = 1.0, int SpiralOffset = 270);
void P_DrawSplash (int count, fixed_t x, fixed_t y, fixed_t z, angle_t angle, int kind);
void P_DrawSplash (int count, const DVector3 &pos, DAngle angle, int kind);
void P_DrawSplash2 (int count, const DVector3 &pos, DAngle angle, int updown, int kind);
void P_DisconnectEffect (AActor *actor);

View file

@ -374,6 +374,10 @@ inline void P_TraceBleed(int damage, const fixedvec3 &pos, AActor *target, angle
{
P_TraceBleed(damage, pos.x, pos.y, pos.z, target, angle, pitch);
}
inline void P_TraceBleed(int damage, const DVector3 &pos, AActor *target, DAngle angle, DAngle pitch)
{
P_TraceBleed(damage, FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), FLOAT2FIXED(pos.Z), target,angle.BAMs(), pitch.BAMs());
}
void P_TraceBleed (int damage, AActor *target, angle_t angle, int pitch);
inline void P_TraceBleed(int damage, AActor *target, DAngle angle, DAngle pitch)
{
@ -407,7 +411,7 @@ bool P_CheckMissileSpawn(AActor *missile, double maxdist);
void P_PlaySpawnSound(AActor *missile, AActor *spawner);
// [RH] Position the chasecam
void P_AimCamera (AActor *t1, fixed_t &x, fixed_t &y, fixed_t &z, sector_t *&sec, bool &unlinked);
void P_AimCamera (AActor *t1, DVector3 &, sector_t *&sec, bool &unlinked);
// [RH] Means of death
enum

View file

@ -4219,7 +4219,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
}
if (puffDefaults != NULL && puffDefaults->flags3 & MF3_ALWAYSPUFF)
{ // Spawn the puff anyway
puff = P_SpawnPuff(t1, pufftype, trace.HitPos, trace.SrcAngleToTarget, trace.SrcAngleToTarget, 2, puffFlags);
puff = P_SpawnPuff(t1, pufftype, trace.HitPos, trace.SrcAngleFromTarget, trace.SrcAngleFromTarget, 2, puffFlags);
}
else
{
@ -4233,9 +4233,9 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
// position a bit closer for puffs
if (trace.HitType != TRACE_HitWall || trace.Line->special != Line_Horizon)
{
fixedvec2 pos = P_GetOffsetPosition(trace.HitPos.x, trace.HitPos.y, -trace.HitVector.x * 4, -trace.HitVector.y * 4);
puff = P_SpawnPuff(t1, pufftype, { pos.x, pos.y, trace.HitPos.z - trace.HitVector.z * 4 }, trace.SrcAngleToTarget,
trace.SrcAngleToTarget - ANGLE_90, 0, puffFlags);
DVector2 pos = P_GetOffsetPosition(trace.HitPos.X, trace.HitPos.Y, -trace.HitVector.X * 4, -trace.HitVector.Y * 4);
puff = P_SpawnPuff(t1, pufftype, DVector3(pos, trace.HitPos.Z - trace.HitVector.Z * 4), trace.SrcAngleFromTarget,
trace.SrcAngleFromTarget - 90, 0, puffFlags);
puff->radius = 1/65536.;
}
@ -4283,16 +4283,15 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
(t1->player->ReadyWeapon->WeaponFlags & WIF_AXEBLOOD));
// Hit a thing, so it could be either a puff or blood
fixedvec3 bleedpos = trace.HitPos;
DVector3 bleedpos = trace.HitPos;
// position a bit closer for puffs/blood if using compatibility mode.
if (i_compatflags & COMPATF_HITSCAN)
{
fixedvec2 ofs = P_GetOffsetPosition(bleedpos.x, bleedpos.y, -10 * trace.HitVector.x, -10 * trace.HitVector.y);
bleedpos.x = ofs.x;
bleedpos.y = ofs.y;
bleedpos.z -= -10 * trace.HitVector.z;
DVector2 ofs = P_GetOffsetPosition(bleedpos.X, bleedpos.Y, -10 * trace.HitVector.X, -10 * trace.HitVector.Y);
bleedpos.X = ofs.X;
bleedpos.Y = ofs.Y;
bleedpos.Z -= -10 * trace.HitVector.Z;
}
DVector3 bleedposf(FIXED2DBL(bleedpos.x), FIXED2DBL(bleedpos.y), FIXED2DBL(bleedpos.z));
// Spawn bullet puffs or blood spots, depending on target type.
if ((puffDefaults != NULL && puffDefaults->flags3 & MF3_PUFFONACTORS) ||
@ -4303,7 +4302,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
puffFlags |= PF_HITTHINGBLEED;
// We must pass the unreplaced puff type here
puff = P_SpawnPuff(t1, pufftype, bleedpos, trace.SrcAngleToTarget, trace.SrcAngleToTarget - ANGLE_90, 2, puffFlags | PF_HITTHING, trace.Actor);
puff = P_SpawnPuff(t1, pufftype, bleedpos, trace.SrcAngleFromTarget, trace.SrcAngleFromTarget - 90, 2, puffFlags | PF_HITTHING, trace.Actor);
}
// Allow puffs to inflict poison damage, so that hitscans can poison, too.
@ -4329,10 +4328,10 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
{
// Since the puff is the damage inflictor we need it here
// regardless of whether it is displayed or not.
puff = P_SpawnPuff(t1, pufftype, bleedpos, 0, 0, 2, puffFlags | PF_HITTHING | PF_TEMPORARY);
puff = P_SpawnPuff(t1, pufftype, bleedpos, 0., 0., 2, puffFlags | PF_HITTHING | PF_TEMPORARY);
killPuff = true;
}
newdam = P_DamageMobj(trace.Actor, puff ? puff : t1, t1, damage, damageType, dmgflags|DMG_USEANGLE, ANGLE2DBL(trace.SrcAngleToTarget));
newdam = P_DamageMobj(trace.Actor, puff ? puff : t1, t1, damage, damageType, dmgflags|DMG_USEANGLE, trace.SrcAngleFromTarget);
if (actualdamage != NULL)
{
*actualdamage = newdam;
@ -4344,7 +4343,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
!(trace.Actor->flags & MF_NOBLOOD) &&
!(trace.Actor->flags2 & (MF2_INVULNERABLE | MF2_DORMANT)))
{
P_SpawnBlood(bleedposf, ANGLE2DBL(trace.SrcAngleToTarget), newdam > 0 ? newdam : damage, trace.Actor);
P_SpawnBlood(bleedpos, trace.SrcAngleFromTarget, newdam > 0 ? newdam : damage, trace.Actor);
}
if (damage)
@ -4356,23 +4355,22 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
{
if (axeBlood)
{
P_BloodSplatter2(bleedposf, trace.Actor, ANGLE2DBL(trace.SrcAngleToTarget));
P_BloodSplatter2(bleedpos, trace.Actor, trace.SrcAngleFromTarget);
}
if (pr_lineattack() < 192)
{
P_BloodSplatter(bleedposf, trace.Actor, ANGLE2DBL(trace.SrcAngleToTarget));
P_BloodSplatter(bleedpos, trace.Actor, trace.SrcAngleFromTarget);
}
}
}
// [RH] Stick blood to walls
P_TraceBleed(newdam > 0 ? newdam : damage, trace.HitPos,
trace.Actor, trace.SrcAngleToTarget, srcpitch);
P_TraceBleed(newdam > 0 ? newdam : damage, trace.HitPos, trace.Actor, trace.SrcAngleFromTarget, ANGLE2DBL(srcpitch));
}
}
if (victim != NULL)
{
victim->linetarget = trace.Actor;
victim->angleFromSource = ANGLE2DBL(trace.SrcAngleToTarget);
victim->angleFromSource = trace.SrcAngleFromTarget;
victim->unlinked = trace.unlinked;
}
}
@ -4380,7 +4378,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
{
if (puff == NULL)
{ // Spawn puff just to get a mass for the splash
puff = P_SpawnPuff(t1, pufftype, trace.HitPos, 0, 0, 2, puffFlags | PF_HITTHING | PF_TEMPORARY);
puff = P_SpawnPuff(t1, pufftype, trace.HitPos, 0., 0., 2, puffFlags | PF_HITTHING | PF_TEMPORARY);
killPuff = true;
}
SpawnDeepSplash(t1, trace, puff);
@ -4539,8 +4537,7 @@ void P_TraceBleed(int damage, fixed_t x, fixed_t y, fixed_t z, AActor *actor, an
bloodcolor.a = 1;
}
DVector3 hp(FIXED2DBL(bleedtrace.HitPos.x), FIXED2DBL(bleedtrace.HitPos.y), FIXED2DBL(bleedtrace.HitPos.z));
DImpactDecal::StaticCreate(bloodType, hp,
DImpactDecal::StaticCreate(bloodType, bleedtrace.HitPos,
bleedtrace.Line->sidedef[bleedtrace.Side], bleedtrace.ffloor, bloodcolor);
}
}
@ -4629,8 +4626,8 @@ void P_TraceBleed(int damage, AActor *target)
struct SRailHit
{
AActor *HitActor;
fixedvec3 HitPos;
angle_t HitAngle;
DVector3 HitPos;
DAngle HitAngle;
};
struct RailData
{
@ -4665,13 +4662,13 @@ static ETraceStatus ProcessRailHit(FTraceResults &res, void *userdata)
SRailHit newhit;
newhit.HitActor = res.Actor;
newhit.HitPos = res.HitPos;
newhit.HitAngle = res.SrcAngleToTarget;
newhit.HitAngle = res.SrcAngleFromTarget;
if (i_compatflags & COMPATF_HITSCAN)
{
fixedvec2 ofs = P_GetOffsetPosition(newhit.HitPos.x, newhit.HitPos.y, -10 * res.HitVector.x, -10 * res.HitVector.y);
newhit.HitPos.x = ofs.x;
newhit.HitPos.y = ofs.y;
newhit.HitPos.z -= -10 * res.HitVector.z;
DVector2 ofs = P_GetOffsetPosition(newhit.HitPos.X, newhit.HitPos.Y, -10 * res.HitVector.X, -10 * res.HitVector.Y);
newhit.HitPos.X = ofs.X;
newhit.HitPos.Y = ofs.Y;
newhit.HitPos.Z -= -10 * res.HitVector.Z;
}
data->RailHits.Push(newhit);
@ -4759,8 +4756,8 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
int puffflags = PF_HITTHING;
AActor *hitactor = rail_data.RailHits[i].HitActor;
fixedvec3 &hitpos = rail_data.RailHits[i].HitPos;
angle_t hitangle = rail_data.RailHits[i].HitAngle;
DVector3 &hitpos = rail_data.RailHits[i].HitPos;
DAngle hitangle = rail_data.RailHits[i].HitAngle;
if ((hitactor->flags & MF_NOBLOOD) ||
(hitactor->flags2 & MF2_DORMANT || ((hitactor->flags2 & MF2_INVULNERABLE) && !(puffDefaults->flags3 & MF3_FOILINVUL))))
@ -4778,7 +4775,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
}
if (spawnpuff)
{
P_SpawnPuff(source, puffclass, hitpos, trace.SrcAngleToTarget, trace.SrcAngleToTarget - ANGLE_90, 1, puffflags, hitactor);
P_SpawnPuff(source, puffclass, hitpos, hitangle, hitangle - 90, 1, puffflags, hitactor);
}
int dmgFlagPass = DMG_INFLICTOR_IS_PUFF;
@ -4791,13 +4788,12 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
if (puffDefaults->flags3 & MF3_FOILINVUL) dmgFlagPass |= DMG_FOILINVUL;
if (puffDefaults->flags7 & MF7_FOILBUDDHA) dmgFlagPass |= DMG_FOILBUDDHA;
}
int newdam = P_DamageMobj(hitactor, thepuff ? thepuff : source, source, damage, damagetype, dmgFlagPass|DMG_USEANGLE, ANGLE2DBL(hitangle));
int newdam = P_DamageMobj(hitactor, thepuff ? thepuff : source, source, damage, damagetype, dmgFlagPass|DMG_USEANGLE, hitangle);
if (bleed)
{
DVector3 h(FIXED2DBL(hitpos.x), FIXED2DBL(hitpos.y), FIXED2DBL(hitpos.z));
P_SpawnBlood(h, ANGLE2DBL(hitangle), newdam > 0 ? newdam : damage, hitactor);
P_TraceBleed(newdam > 0 ? newdam : damage, hitpos, hitactor, source->_f_angle(), pitch);
P_SpawnBlood(hitpos, hitangle, newdam > 0 ? newdam : damage, hitactor);
P_TraceBleed(newdam > 0 ? newdam : damage, hitpos, hitactor, hitangle, ANGLE2DBL(pitch));
}
}
@ -4808,7 +4804,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
if (puffclass != NULL && puffDefaults->flags3 & MF3_ALWAYSPUFF)
{
puff = P_SpawnPuff(source, puffclass, trace.HitPos, trace.SrcAngleToTarget, trace.SrcAngleToTarget - ANGLE_90, 1, 0);
puff = P_SpawnPuff(source, puffclass, trace.HitPos, trace.SrcAngleFromTarget, trace.SrcAngleFromTarget - 90, 1, 0);
if (puff && (trace.Line != NULL) && (trace.Line->special == Line_Horizon) && !(puff->flags3 & MF3_SKYEXPLODE))
puff->Destroy();
}
@ -4823,7 +4819,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
AActor* puff = NULL;
if (puffclass != NULL && puffDefaults->flags3 & MF3_ALWAYSPUFF)
{
puff = P_SpawnPuff(source, puffclass, trace.HitPos, trace.SrcAngleToTarget, trace.SrcAngleToTarget - ANGLE_90, 1, 0);
puff = P_SpawnPuff(source, puffclass, trace.HitPos, trace.SrcAngleFromTarget, trace.SrcAngleFromTarget - 90, 1, 0);
if (puff && !(puff->flags3 & MF3_SKYEXPLODE) &&
(((trace.HitType == TRACE_HitFloor) && (puff->floorpic == skyflatnum)) ||
((trace.HitType == TRACE_HitCeiling) && (puff->ceilingpic == skyflatnum))))
@ -4846,9 +4842,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
}
// Draw the slug's trail.
end.X = FIXED2DBL(trace.HitPos.x);
end.Y = FIXED2DBL(trace.HitPos.y);
end.Z = FIXED2DBL(trace.HitPos.z);
end = trace.HitPos;
P_DrawRailTrail(source, start, end, color1, color2, maxdiff, railflags, spawnclass, source->_f_angle() + angleoffset, duration, sparsity, drift, SpiralOffset);
}
@ -4861,7 +4855,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
CVAR(Float, chase_height, -8.f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Float, chase_dist, 90.f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
void P_AimCamera(AActor *t1, fixed_t &CameraX, fixed_t &CameraY, fixed_t &CameraZ, sector_t *&CameraSector, bool &unlinked)
void P_AimCamera(AActor *t1, DVector3 &campos, sector_t *&CameraSector, bool &unlinked)
{
fixed_t distance = (fixed_t)(clamp<double>(chase_dist, 0, 30000) * FRACUNIT);
angle_t angle = (t1->_f_angle() - ANG180) >> ANGLETOFINESHIFT;
@ -4873,23 +4867,21 @@ void P_AimCamera(AActor *t1, fixed_t &CameraX, fixed_t &CameraY, fixed_t &Camera
vy = FixedMul(finecosine[pitch], finesine[angle]);
vz = finesine[pitch];
DVector3 vvec(vx, vy, vz);
vvec.MakeUnit();
sz = t1->_f_Z() - t1->_f_floorclip() + t1->_f_height() + (fixed_t)(clamp<double>(chase_height, -1000, 1000) * FRACUNIT);
if (Trace(t1->_f_X(), t1->_f_Y(), sz, t1->Sector,
vx, vy, vz, distance, 0, 0, NULL, trace) &&
trace.Distance > 10 * FRACUNIT)
trace.Distance > 10)
{
// Position camera slightly in front of hit thing
fixed_t dist = trace.Distance - 5 * FRACUNIT;
CameraX = t1->_f_X() + FixedMul(vx, dist);
CameraY = t1->_f_Y() + FixedMul(vy, dist);
CameraZ = sz + FixedMul(vz, dist);
campos = t1->PosAtZ(FIXED2DBL(sz)) + vvec *(trace.Distance - 5);
}
else
{
CameraX = trace.HitPos.x;
CameraY = trace.HitPos.y;
CameraZ = trace.HitPos.z;
campos = trace.HitPos;
}
CameraSector = trace.Sector;
unlinked = trace.unlinked;
@ -6418,9 +6410,8 @@ void SpawnShootDecal(AActor *t1, const FTraceResults &trace)
}
if (decalbase != NULL)
{
DVector3 hp(FIXED2DBL(trace.HitPos.x), FIXED2DBL(trace.HitPos.y), FIXED2DBL(trace.HitPos.z));
DImpactDecal::StaticCreate(decalbase->GetDecal(),
hp, trace.Line->sidedef[trace.Side], trace.ffloor);
trace.HitPos, trace.Line->sidedef[trace.Side], trace.ffloor);
}
}
@ -6432,7 +6423,7 @@ void SpawnShootDecal(AActor *t1, const FTraceResults &trace)
static void SpawnDeepSplash(AActor *t1, const FTraceResults &trace, AActor *puff)
{
const fixedvec3 *hitpos;
const DVector3 *hitpos;
if (trace.Crossed3DWater)
{
hitpos = &trace.Crossed3DWaterPos;
@ -6443,7 +6434,7 @@ static void SpawnDeepSplash(AActor *t1, const FTraceResults &trace, AActor *puff
}
else return;
P_HitWater(puff != NULL ? puff : t1, P_PointInSector(hitpos->x, hitpos->y), *hitpos);
P_HitWater(puff != NULL ? puff : t1, P_PointInSector(*hitpos), *hitpos);
}
//=============================================================================

View file

@ -5203,7 +5203,7 @@ AActor *P_SpawnPuff (AActor *source, PClassActor *pufftype, const DVector3 &pos,
if (!(flags & PF_NORANDOMZ))
z = pr_spawnpuff.Random2() / 64.;
puff = Spawn(pufftype, pos + Vector3(0, 0, z), ALLOW_REPLACE);
puff = Spawn(pufftype, pos + DVector3(0, 0, z), ALLOW_REPLACE);
if (puff == NULL) return NULL;
if ((puff->flags4 & MF4_RANDOMIZE) && puff->tics > 0)

View file

@ -94,9 +94,9 @@ struct FTraceInfo
void SetSourcePosition()
{
Results->SrcFromTarget = { StartX, StartY, StartZ };
Results->HitVector = { Vx, Vy, Vz };
Results->SrcAngleToTarget = R_PointToAngle2(0, 0, Results->HitPos.x - StartX, Results->HitPos.y - StartY);
Results->SrcFromTarget = { FIXED2DBL(StartX), FIXED2DBL(StartY), FIXED2DBL(StartZ) };
Results->HitVector = { FIXED2DBL(Vx), FIXED2DBL(Vy), FIXED2DBL(Vz) };
Results->SrcAngleFromTarget = VecToAngle(Results->HitVector);
}
@ -122,7 +122,7 @@ bool Trace (fixed_t x, fixed_t y, fixed_t z, sector_t *sector,
FTraceResults tempResult;
memset(&tempResult, 0, sizeof(tempResult));
tempResult.Fraction = tempResult.Distance = FIXED_MAX;
tempResult.Fraction = tempResult.Distance = NO_VALUE;
ptflags = actorMask ? PT_ADDLINES|PT_ADDTHINGS|PT_COMPATIBLE : PT_ADDLINES;
@ -652,10 +652,10 @@ cont:
if (Results->HitType == TRACE_HitWall)
{
Results->HitPos = { hitx, hity, hitz };
Results->HitPos = { FIXED2DBL(hitx), FIXED2DBL(hity), FIXED2DBL(hitz) };
SetSourcePosition();
Results->Distance = dist;
Results->Fraction = in->frac;
Results->Distance = FIXED2DBL(dist);
Results->Fraction = FIXED2DBL(in->frac);
Results->Line = in->d.line;
Results->Side = lineside;
}
@ -779,10 +779,10 @@ cont1:
Results->HitType = TRACE_HitActor;
Results->HitPos = { hitx, hity, hitz };
Results->HitPos = { FIXED2DBL(hitx), FIXED2DBL(hity), FIXED2DBL(hitz) };
SetSourcePosition();
Results->Distance = dist;
Results->Fraction = in->frac;
Results->Distance = FIXED2DBL(dist);
Results->Fraction = FIXED2DBL(in->frac);
Results->Actor = in->d.thing;
if (TraceCallback != NULL)
@ -836,7 +836,7 @@ bool FTraceInfo::TraceTraverse (int ptflags)
}
// We have something closer in the storage for portal subtraces.
if (TempResults->HitType != TRACE_HitNone && in->frac > TempResults->Fraction)
if (TempResults->HitType != TRACE_HitNone && FIXED2DBL(in->frac) > TempResults->Fraction)
{
break;
}
@ -859,7 +859,7 @@ bool FTraceInfo::TraceTraverse (int ptflags)
// We still need to do a water check here or this may get missed on occasion
if (Results->CrossedWater == NULL &&
CurSector->heightsec != NULL &&
CurSector->heightsec->floorplane.ZatPoint(Results->HitPos) >= Results->HitPos.z)
CurSector->heightsec->floorplane.ZatPoint(Results->HitPos) >= Results->HitPos.Z)
{
// Save the result so that the water check doesn't destroy it.
FTraceResults *res = Results;
@ -896,7 +896,7 @@ bool FTraceInfo::TraceTraverse (int ptflags)
if (Results->CrossedWater == NULL &&
CurSector->heightsec != NULL &&
CurSector->heightsec->floorplane.ZatPoint(Results->HitPos) >= Results->HitPos.z)
CurSector->heightsec->floorplane.ZatPoint(Results->HitPos) >= Results->HitPos.Z)
{
// Save the result so that the water check doesn't destroy it.
FTraceResults *res = Results;
@ -913,12 +913,12 @@ bool FTraceInfo::TraceTraverse (int ptflags)
if (Results->HitType == TRACE_HitNone && Results->Distance == 0)
{
Results->HitPos = {
StartX + FixedMul(Vx, MaxDist),
StartY + FixedMul(Vy, MaxDist),
StartZ + FixedMul(Vz, MaxDist) };
FIXED2DBL(StartX + FixedMul(Vx, MaxDist)),
FIXED2DBL(StartY + FixedMul(Vy, MaxDist)),
FIXED2DBL(StartZ + FixedMul(Vz, MaxDist)) };
SetSourcePosition();
Results->Distance = MaxDist;
Results->Fraction = FRACUNIT;
Results->Distance = FIXED2DBL(MaxDist);
Results->Fraction = 1.;
}
return Results->HitType != TRACE_HitNone;
}
@ -944,12 +944,12 @@ bool FTraceInfo::CheckPlane (const secplane_t &plane)
if (hitdist > EnterDist && hitdist < MaxDist)
{
Results->HitPos = {
StartX + FixedMul(Vx, hitdist),
StartY + FixedMul(Vy, hitdist),
StartZ + FixedMul(Vz, hitdist) };
FIXED2DBL(StartX + FixedMul(Vx, hitdist)),
FIXED2DBL(StartY + FixedMul(Vy, hitdist)),
FIXED2DBL(StartZ + FixedMul(Vz, hitdist)) };
SetSourcePosition();
Results->Distance = hitdist;
Results->Fraction = FixedDiv (hitdist, MaxDist);
Results->Distance = FIXED2DBL(hitdist);
Results->Fraction = FIXED2DBL(FixedDiv (hitdist, MaxDist));
return true;
}
}

View file

@ -65,13 +65,13 @@ struct FTraceResults
{
sector_t *Sector;
FTextureID HitTexture;
fixedvec3 HitPos;
fixedvec3 HitVector;
fixedvec3 SrcFromTarget;
angle_t SrcAngleToTarget;
DVector3 HitPos;
DVector3 HitVector;
DVector3 SrcFromTarget;
DAngle SrcAngleFromTarget;
fixed_t Distance;
fixed_t Fraction;
double Distance;
double Fraction;
AActor *Actor; // valid if hit an actor
@ -83,9 +83,9 @@ struct FTraceResults
F3DFloor *ffloor;
sector_t *CrossedWater; // For Boom-style, Transfer_Heights-based deep water
fixedvec3 CrossedWaterPos; // remember the position so that we can use it for spawning the splash
DVector3 CrossedWaterPos; // remember the position so that we can use it for spawning the splash
F3DFloor *Crossed3DWater; // For 3D floor-based deep water
fixedvec3 Crossed3DWaterPos;
DVector3 Crossed3DWaterPos;
void CopyIfCloser(FTraceResults *other)
{

View file

@ -966,7 +966,11 @@ void R_SetupFrame (AActor *actor)
{
sector_t *oldsector = R_PointInSubsector(iview->oviewx, iview->oviewy)->sector;
// [RH] Use chasecam view
P_AimCamera (camera, iview->nviewx, iview->nviewy, iview->nviewz, viewsector, unlinked);
DVector3 campos;
P_AimCamera (camera, campos, viewsector, unlinked);
iview->nviewx = FLOAT2FIXED(campos.X);
iview->nviewy = FLOAT2FIXED(campos.Y);
iview->nviewz = FLOAT2FIXED(campos.Z);
r_showviewer = true;
// Interpolating this is a very complicated thing because nothing keeps track of the aim camera's movement, so whenever we detect a portal transition
// it's probably best to just reset the interpolation for this move.

View file

@ -3843,7 +3843,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckLOF)
if (trace.HitType == TRACE_HitActor ||
((flags & CLOFF_JUMP_ON_MISS) && !lof_data.BadActor && trace.HitType != TRACE_HitNone))
{
if (minrange > 0 && trace.Distance < FLOAT2FIXED(minrange))
if (minrange > 0 && trace.Distance < minrange)
{
ACTION_RETURN_STATE(NULL);
}