- parameter rework of several spawning functions.

This commit is contained in:
Christoph Oelckers 2016-03-23 13:31:12 +01:00
parent f60eac8dc0
commit 7c87479eea
12 changed files with 94 additions and 108 deletions

View file

@ -8685,7 +8685,7 @@ scriptwait:
bool result = false;
AActor *actor = SingleActorFromTID (STACK(5), activator);
if (actor != NULL)
result = P_MoveThing(actor, STACK(4), STACK(3), STACK(2), !!STACK(1));
result = P_MoveThing(actor, DVector3(ACSToDouble(STACK(4)), ACSToDouble(STACK(3)), ACSToDouble(STACK(2))), !!STACK(1));
sp -= 4;
STACK(1) = result;
}

View file

@ -493,11 +493,9 @@ void P_RunEffect (AActor *actor, int effects)
{
// Grenade trail
fixedvec3 pos = actor->_f_Vec3Angle(-actor->_f_radius() * 2, moveangle.BAMs(),
fixed_t(-(actor->_f_height() >> 3) * (actor->Vel.Z) + (2 * actor->_f_height()) / 3));
DVector3 pos = actor->Vec3Angle(-actor->radius * 2, moveangle, -actor->Height * actor->Vel.Z / 8 + actor->Height * (2. / 3));
P_DrawSplash2 (6, pos.x, pos.y, pos.z,
moveangle.BAMs() + ANG180, 2, 2);
P_DrawSplash2 (6, pos, moveangle + 180, 2, 2);
}
if (effects & FX_FOUNTAINMASK)
{
@ -582,7 +580,7 @@ void P_DrawSplash (int count, fixed_t x, fixed_t y, fixed_t z, angle_t angle, in
}
}
void P_DrawSplash2 (int count, fixed_t x, fixed_t y, fixed_t z, angle_t angle, int updown, int kind)
void P_DrawSplash2 (int count, const DVector3 &pos, DAngle angle, int updown, int kind)
{
int color1, color2, zvel, zspread, zadd;
@ -626,16 +624,16 @@ void P_DrawSplash2 (int count, fixed_t x, fixed_t y, fixed_t z, angle_t angle, i
p->vel.z = M_Random () * zvel;
p->accz = -FRACUNIT/22;
if (kind) {
an = (angle + ((M_Random() - 128) << 23)) >> ANGLETOFINESHIFT;
an = (angle.BAMs() + ((M_Random() - 128) << 23)) >> ANGLETOFINESHIFT;
p->vel.x = (M_Random () * finecosine[an]) >> 11;
p->vel.y = (M_Random () * finesine[an]) >> 11;
p->accx = p->vel.x >> 4;
p->accy = p->vel.y >> 4;
}
p->z = z + (M_Random () + zadd - 128) * zspread;
an = (angle + ((M_Random() - 128) << 22)) >> ANGLETOFINESHIFT;
p->x = x + ((M_Random () & 31)-15)*finecosine[an];
p->y = y + ((M_Random () & 31)-15)*finesine[an];
p->z = FLOAT2FIXED(pos.Z) + (M_Random () + zadd - 128) * zspread;
an = (angle.BAMs() + ((M_Random() - 128) << 22)) >> ANGLETOFINESHIFT;
p->x = FLOAT2FIXED(pos.X) + ((M_Random () & 31)-15)*finecosine[an];
p->y = FLOAT2FIXED(pos.X) + ((M_Random () & 31)-15)*finesine[an];
}
}

View file

@ -91,5 +91,5 @@ 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_DrawSplash2 (int count, fixed_t x, fixed_t y, fixed_t z, angle_t angle, int updown, int kind);
void P_DrawSplash2 (int count, const DVector3 &pos, DAngle angle, int updown, int kind);
void P_DisconnectEffect (AActor *actor);

View file

@ -138,22 +138,15 @@ enum EPuffFlags
PF_NORANDOMZ = 16
};
AActor *P_SpawnPuff (AActor *source, PClassActor *pufftype, fixed_t x, fixed_t y, fixed_t z, angle_t hitdir, angle_t particledir, int updown, int flags = 0, AActor *vict = NULL);
AActor *P_SpawnPuff(AActor *source, PClassActor *pufftype, const DVector3 &pos, DAngle hitdir, DAngle particledir, int updown, int flags = 0, AActor *vict = NULL);
inline AActor *P_SpawnPuff(AActor *source, PClassActor *pufftype, const fixedvec3 &pos, angle_t hitdir, angle_t particledir, int updown, int flags = 0, AActor *vict = NULL)
{
return P_SpawnPuff(source, pufftype, pos.x, pos.y, pos.z, hitdir, particledir, updown, flags, vict);
DVector3 _pos(FIXED2DBL(pos.x), FIXED2DBL(pos.y), FIXED2DBL(pos.z));
return P_SpawnPuff(source, pufftype, _pos, ANGLE2DBL(hitdir), ANGLE2DBL(particledir), updown, flags, vict);
}
inline AActor *P_SpawnPuff(AActor *source, PClassActor *pufftype, const DVector3 &pos, DAngle hitdir, DAngle particledir, int updown, int flags = 0, AActor *vict = NULL)
{
return P_SpawnPuff(source, pufftype, FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), FLOAT2FIXED(pos.Z), hitdir.BAMs(), particledir.BAMs(), updown, flags, vict);
}
void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, angle_t dir, int damage, AActor *originator);
inline void P_SpawnBlood(const fixedvec3 &pos, angle_t dir, int damage, AActor *originator)
{
P_SpawnBlood(pos.x, pos.y, pos.z, dir, damage, originator);
}
void P_BloodSplatter (fixedvec3 pos, AActor *originator);
void P_BloodSplatter2 (fixedvec3 pos, AActor *originator);
void P_SpawnBlood (const DVector3 &pos, DAngle angle, int damage, AActor *originator);
void P_BloodSplatter (const DVector3 &pos, AActor *originator, DAngle hitangle);
void P_BloodSplatter2 (const DVector3 &pos, AActor *originator, DAngle hitangle);
void P_RipperBlood (AActor *mo, AActor *bleeder);
int P_GetThingFloorType (AActor *thing);
void P_ExplodeMissile (AActor *missile, line_t *explodeline, AActor *target);
@ -219,7 +212,7 @@ bool P_Thing_Spawn (int tid, AActor *source, int type, DAngle angle, bool fog, i
bool P_Thing_Projectile (int tid, AActor *source, int type, const char * type_name, DAngle angle,
fixed_t speed, fixed_t vspeed, int dest, AActor *forcedest, int gravity, int newtid,
bool leadTarget);
bool P_MoveThing(AActor *source, fixed_t x, fixed_t y, fixed_t z, bool fog);
bool P_MoveThing(AActor *source, const DVector3 &pos, bool fog);
bool P_Thing_Move (int tid, AActor *source, int mapspot, bool fog);
int P_Thing_Damage (int tid, AActor *whofor0, int amount, FName type);
void P_Thing_SetVelocity(AActor *actor, const DVector3 &vec, bool add, bool setbob);
@ -390,10 +383,11 @@ void P_TraceBleed (int damage, AActor *target, AActor *missile); // missile ver
void P_TraceBleed(int damage, FTranslatedLineTarget *t, AActor *puff); // hitscan version
void P_TraceBleed (int damage, AActor *target); // random direction version
bool P_HitFloor (AActor *thing);
bool P_HitWater (AActor *thing, sector_t *sec, fixed_t splashx = FIXED_MIN, fixed_t splashy = FIXED_MIN, fixed_t splashz=FIXED_MIN, bool checkabove = false, bool alert = true, bool force = false);
bool P_HitWater (AActor *thing, sector_t *sec, const DVector3 &pos, bool checkabove = false, bool alert = true, bool force = false);
inline bool P_HitWater(AActor *thing, sector_t *sec, const fixedvec3 &pos, bool checkabove = false, bool alert = true, bool force = false)
{
return P_HitWater(thing, sec, pos.x, pos.y, pos.z, checkabove, alert, force);
DVector3 fpos(FIXED2DBL(pos.x), FIXED2DBL(pos.y), FIXED2DBL(pos.z));
return P_HitWater(thing, sec, fpos, checkabove, alert, force);
}
void P_CheckSplash(AActor *self, double distance);
void P_RailAttack (AActor *source, int damage, int offset_xy, fixed_t offset_z = 0, int color1 = 0, int color2 = 0, double maxdiff = 0, int flags = 0, PClassActor *puff = NULL, angle_t angleoffset = 0, angle_t pitchoffset = 0, fixed_t distance = 8192*FRACUNIT, int duration = 0, double sparsity = 1.0, double drift = 1.0, PClassActor *spawnclass = NULL, int SpiralOffset = 270); // [RH] Shoot a railgun

View file

@ -1507,7 +1507,7 @@ bool PIT_CheckThing(FMultiBlockThingsIterator &it, FMultiBlockThingsIterator::Ch
!(tm.thing->flags3 & MF3_BLOODLESSIMPACT) &&
(pr_checkthing() < 192))
{
P_BloodSplatter(tm.thing->_f_Pos(), thing);
P_BloodSplatter(tm.thing->Pos(), thing, tm.thing->AngleTo(thing));
}
if (!(tm.thing->flags3 & MF3_BLOODLESSIMPACT))
{
@ -4234,7 +4234,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
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,
puff = P_SpawnPuff(t1, pufftype, { pos.x, pos.y, trace.HitPos.z - trace.HitVector.z * 4 }, trace.SrcAngleToTarget,
trace.SrcAngleToTarget - ANGLE_90, 0, puffFlags);
puff->radius = 1/65536.;
}
@ -4292,6 +4292,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
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) ||
@ -4343,7 +4344,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
!(trace.Actor->flags & MF_NOBLOOD) &&
!(trace.Actor->flags2 & (MF2_INVULNERABLE | MF2_DORMANT)))
{
P_SpawnBlood(bleedpos, trace.SrcAngleToTarget, newdam > 0 ? newdam : damage, trace.Actor);
P_SpawnBlood(bleedposf, ANGLE2DBL(trace.SrcAngleToTarget), newdam > 0 ? newdam : damage, trace.Actor);
}
if (damage)
@ -4355,11 +4356,11 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
{
if (axeBlood)
{
P_BloodSplatter2(bleedpos, trace.Actor);
P_BloodSplatter2(bleedposf, trace.Actor, ANGLE2DBL(trace.SrcAngleToTarget));
}
if (pr_lineattack() < 192)
{
P_BloodSplatter(bleedpos, trace.Actor);
P_BloodSplatter(bleedposf, trace.Actor, ANGLE2DBL(trace.SrcAngleToTarget));
}
}
}
@ -4794,7 +4795,8 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
if (bleed)
{
P_SpawnBlood(hitpos, hitangle, newdam > 0 ? newdam : damage, hitactor);
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);
}
}
@ -5646,11 +5648,10 @@ void P_DoCrunch(AActor *thing, FChangePosition *cpos)
if (!(cl_bloodtype <= 1)) mo->renderflags |= RF_INVISIBLE;
}
angle_t an;
an = (M_Random() - 128) << 24;
DAngle an = (M_Random() - 128) * (360./256);
if (cl_bloodtype >= 1)
{
P_DrawSplash2(32, thing->_f_X(), thing->_f_Y(), thing->_f_Z() + thing->_f_height() / 2, an, 2, bloodcolor);
P_DrawSplash2(32, thing->PosPlusZ(thing->Height/2), an, 2, bloodcolor);
}
}
if (thing->CrushPainSound != 0 && !S_GetSoundPlayingInfo(thing, thing->CrushPainSound))

View file

@ -4111,7 +4111,7 @@ bool AActor::UpdateWaterLevel (fixed_t oldz, bool dosplash)
// the water flags.
if (boomwaterlevel == 0 && waterlevel != 0 && dosplash)
{
P_HitWater(this, Sector, FIXED_MIN, FIXED_MIN, FLOAT2FIXED(fh), true);
P_HitWater(this, Sector, PosAtZ(fh), true);
}
boomwaterlevel = waterlevel;
if (reset)
@ -5195,15 +5195,15 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
// P_SpawnPuff
//
AActor *P_SpawnPuff (AActor *source, PClassActor *pufftype, fixed_t x, fixed_t y, fixed_t z, angle_t hitdir, angle_t particledir, int updown, int flags, AActor *vict)
AActor *P_SpawnPuff (AActor *source, PClassActor *pufftype, const DVector3 &pos, DAngle hitdir, DAngle particledir, int updown, int flags, AActor *vict)
{
AActor *puff;
double z = 0;
if (!(flags & PF_NORANDOMZ))
z += pr_spawnpuff.Random2 () << 10;
z = pr_spawnpuff.Random2() / 64.;
DVector3 pos(FIXED2DBL(x), FIXED2DBL(y), FIXED2DBL(z));
puff = Spawn (pufftype, pos, ALLOW_REPLACE);
puff = Spawn(pufftype, pos + Vector3(0, 0, z), ALLOW_REPLACE);
if (puff == NULL) return NULL;
if ((puff->flags4 & MF4_RANDOMIZE) && puff->tics > 0)
@ -5225,7 +5225,7 @@ AActor *P_SpawnPuff (AActor *source, PClassActor *pufftype, fixed_t x, fixed_t y
puff->target = source;
// Angle is the opposite of the hit direction (i.e. the puff faces the source.)
puff->Angles.Yaw = ANGLE2DBL(hitdir + ANGLE_180);
puff->Angles.Yaw = hitdir + 180;
// If a puff has a crash state and an actor was not hit,
// it will enter the crash state. This is used by the StrifeSpark
@ -5250,7 +5250,7 @@ AActor *P_SpawnPuff (AActor *source, PClassActor *pufftype, fixed_t x, fixed_t y
{
if (cl_pufftype && updown != 3 && (puff->flags4 & MF4_ALLOWPARTICLES))
{
P_DrawSplash2 (32, x, y, z, particledir, updown, 1);
P_DrawSplash2 (32, pos, particledir, updown, 1);
puff->renderflags |= RF_INVISIBLE;
}
@ -5275,9 +5275,8 @@ AActor *P_SpawnPuff (AActor *source, PClassActor *pufftype, fixed_t x, fixed_t y
//
//---------------------------------------------------------------------------
void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, angle_t dir, int damage, AActor *originator)
void P_SpawnBlood (const DVector3 &pos, DAngle dir, int damage, AActor *originator)
{
DVector3 pos(FIXED2DBL(x), FIXED2DBL(y), FIXED2DBL(z));
AActor *th;
PalEntry bloodcolor = originator->GetBloodColor();
PClassActor *bloodcls = originator->GetBloodType();
@ -5289,8 +5288,8 @@ void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, angle_t dir, int damage, AAc
if (bloodcls != NULL)
{
z += pr_spawnblood.Random2 () << 10;
th = Spawn (bloodcls, pos, NO_REPLACE); // GetBloodType already performed the replacement
double z = pr_spawnblood.Random2 () / 64.;
th = Spawn(bloodcls, pos + DVector3(0, 0, z), NO_REPLACE); // GetBloodType already performed the replacement
th->Vel.Z = 2;
th->Angles.Yaw = ANGLE2DBL(dir);
// [NG] Applying PUFFGETSOWNER to the blood will make it target the owner
@ -5362,7 +5361,7 @@ void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, angle_t dir, int damage, AAc
}
if (bloodtype >= 1)
P_DrawSplash2 (40, x, y, z, dir, 2, bloodcolor);
P_DrawSplash2 (40, pos, ANGLE2DBL(dir), 2, bloodcolor);
}
//---------------------------------------------------------------------------
@ -5371,9 +5370,8 @@ void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, angle_t dir, int damage, AAc
//
//---------------------------------------------------------------------------
void P_BloodSplatter (fixedvec3 _pos, AActor *originator)
void P_BloodSplatter (const DVector3 &pos, AActor *originator, DAngle hitangle)
{
DVector3 pos(FIXED2DBL(_pos.x), FIXED2DBL(_pos.y), FIXED2DBL(_pos.z));
PalEntry bloodcolor = originator->GetBloodColor();
PClassActor *bloodcls = originator->GetBloodType(1);
@ -5402,7 +5400,7 @@ void P_BloodSplatter (fixedvec3 _pos, AActor *originator)
}
if (bloodtype >= 1)
{
//P_DrawSplash2 (40, pos.X, pos.Y, pos.Z, -originator->AngleTo(pos), 2, bloodcolor);
P_DrawSplash2 (40, pos, hitangle-180., 2, bloodcolor);
}
}
@ -5412,9 +5410,8 @@ void P_BloodSplatter (fixedvec3 _pos, AActor *originator)
//
//===========================================================================
void P_BloodSplatter2 (fixedvec3 _pos, AActor *originator)
void P_BloodSplatter2 (const DVector3 &pos, AActor *originator, DAngle hitangle)
{
DVector3 pos(FIXED2DBL(_pos.x), FIXED2DBL(_pos.y), FIXED2DBL(_pos.z));
PalEntry bloodcolor = originator->GetBloodColor();
PClassActor *bloodcls = originator->GetBloodType(2);
@ -5426,11 +5423,12 @@ void P_BloodSplatter2 (fixedvec3 _pos, AActor *originator)
if (bloodcls != NULL)
{
AActor *mo;
pos.X += (pr_splat()-128) / 32.;
pos.Y += (pr_splat()-128) / 32.;
mo = Spawn (bloodcls, pos, NO_REPLACE); // GetBloodType already performed the replacement
DVector2 add;
add.X = (pr_splat()-128) / 32.;
add.Y = (pr_splat()-128) / 32.;
mo = Spawn (bloodcls, pos + add, NO_REPLACE); // GetBloodType already performed the replacement
mo->target = originator;
// colorize the blood!
@ -5443,7 +5441,7 @@ void P_BloodSplatter2 (fixedvec3 _pos, AActor *originator)
}
if (bloodtype >= 1)
{
//P_DrawSplash2 (100, pos.x, pos.y, pos.z, 0u - originator->__f_AngleTo(pos), 2, bloodcolor);
P_DrawSplash2(40, pos, hitangle - 180., 2, bloodcolor);
}
}
@ -5490,7 +5488,7 @@ void P_RipperBlood (AActor *mo, AActor *bleeder)
}
if (bloodtype >= 1)
{
//P_DrawSplash2 (28, pos.X, pos.Y, pos.Z, 0, 0, bloodcolor);
P_DrawSplash2(28, pos, bleeder->AngleTo(mo) + 180., 0, bloodcolor);
}
}
@ -5519,7 +5517,7 @@ int P_GetThingFloorType (AActor *thing)
// Returns true if hit liquid and splashed, false if not.
//---------------------------------------------------------------------------
bool P_HitWater (AActor * thing, sector_t * sec, fixed_t x, fixed_t y, fixed_t z, bool checkabove, bool alert, bool force)
bool P_HitWater (AActor * thing, sector_t * sec, const DVector3 &pos, bool checkabove, bool alert, bool force)
{
if (thing->flags3 & MF3_DONTSPLASH)
return false;
@ -5532,21 +5530,17 @@ bool P_HitWater (AActor * thing, sector_t * sec, fixed_t x, fixed_t y, fixed_t z
int terrainnum;
sector_t *hsec = NULL;
if (x == FIXED_MIN) x = thing->_f_X();
if (y == FIXED_MIN) y = thing->_f_Y();
if (z == FIXED_MIN) z = thing->_f_Z();
// don't splash above the object
if (checkabove)
{
fixed_t compare_z = thing->_f_Z() + (thing->_f_height() >> 1);
double compare_z = thing->Center();
// Missiles are typically small and fast, so they might
// end up submerged by the move that calls P_HitWater.
if (thing->flags & MF_MISSILE)
compare_z -= thing->_f_velz();
if (z > compare_z)
compare_z -= thing->Vel.Z;
if (pos.Z > compare_z)
return false;
}
DVector3 pos(FIXED2DBL(x), FIXED2DBL(y), FIXED2DBL(z));
#if 0 // needs some rethinking before activation
@ -5555,10 +5549,10 @@ bool P_HitWater (AActor * thing, sector_t * sec, fixed_t x, fixed_t y, fixed_t z
// it is not guaranteed that all players have GL nodes loaded.
if (!multiplayer && thing->subsector->sector != thing->subsector->render_sector)
{
fixed_t zs = thing->subsector->sector->floorplane.ZatPoint(x, y);
fixed_t zr = thing->subsector->render_sector->floorplane.ZatPoint(x, y);
double zs = thing->subsector->sector->floorplane.ZatPoint(pos);
double zr = thing->subsector->render_sector->floorplane.ZatPoint(pos);
if (zs > zr && thing->z >= zs) return false;
if (zs > zr && thing->Z() >= zs) return false;
}
#endif
@ -5567,20 +5561,20 @@ bool P_HitWater (AActor * thing, sector_t * sec, fixed_t x, fixed_t y, fixed_t z
{
for (unsigned int i = 0; i<sec->e->XFloor.ffloors.Size(); i++)
{
F3DFloor * rover = sec->e->XFloor.ffloors[i];
if (!(rover->flags & FF_EXISTS)) continue;
fixed_t planez = rover->top.plane->ZatPoint(x, y);
if (z > planez - FRACUNIT / 2 && z < planez + FRACUNIT / 2) // allow minor imprecisions
{
if (rover->flags & (FF_SOLID | FF_SWIMMABLE))
F3DFloor * rover = sec->e->XFloor.ffloors[i];
if (!(rover->flags & FF_EXISTS)) continue;
double planez = rover->top.plane->ZatPoint(pos);
if (pos.Z > planez - 0.5 && pos.Z < planez + 0.5) // allow minor imprecisions
{
terrainnum = rover->model->GetTerrain(rover->top.isceiling);
goto foundone;
if (rover->flags & (FF_SOLID | FF_SWIMMABLE))
{
terrainnum = rover->model->GetTerrain(rover->top.isceiling);
goto foundone;
}
}
planez = rover->bottom.plane->ZatPoint(pos);
if (planez < pos.Z && !(planez < thing->floorz)) return false;
}
planez = rover->bottom.plane->ZatPoint(x, y);
if (planez < z && !(planez < thing->_f_floorz())) return false;
}
}
hsec = sec->GetHeightSec();
if (force || hsec == NULL || !(hsec->MoreFlags & SECF_CLIPFAKEPLANES))
@ -5601,13 +5595,13 @@ foundone:
return Terrains[terrainnum].IsLiquid;
// don't splash when touching an underwater floor
if (thing->waterlevel>=1 && z<=thing->_f_floorz()) return Terrains[terrainnum].IsLiquid;
if (thing->waterlevel >= 1 && pos.Z <= thing->floorz) return Terrains[terrainnum].IsLiquid;
plane = hsec != NULL? &sec->heightsec->floorplane : &sec->floorplane;
// Don't splash for living things with small vertical velocities.
// There are levels where the constant splashing from the monsters gets extremely annoying
if (((thing->flags3&MF3_ISMONSTER || thing->player) && thing->_f_velz() >= -6*FRACUNIT) && !force)
if (((thing->flags3&MF3_ISMONSTER || thing->player) && thing->Vel.Z >= -6) && !force)
return Terrains[terrainnum].IsLiquid;
splash = &Splashes[splashnum];
@ -5654,7 +5648,7 @@ foundone:
}
else
{
S_Sound (x, y, z, CHAN_ITEM, smallsplash ?
S_Sound (pos, CHAN_ITEM, smallsplash ?
splash->SmallSplashSound : splash->NormalSplashSound,
1, ATTN_IDLE);
}
@ -5736,7 +5730,8 @@ void P_CheckSplash(AActor *self, double distance)
// a separate parameter for that so this would get in the way of proper
// behavior.
fixedvec3 pos = self->PosRelative(floorsec);
P_HitWater (self, floorsec, pos.x, pos.y, self->_f_floorz(), false, false);
pos.z = self->_f_floorz();
P_HitWater (self, floorsec, pos, false, false);
}
}

View file

@ -476,7 +476,7 @@ void P_PlayerInSpecialSector (player_t *player, sector_t * sector)
}
if (sector->Flags & SECF_DMGTERRAINFX)
{
P_HitWater(player->mo, player->mo->Sector, INT_MIN, INT_MIN, INT_MIN, false, true, true);
P_HitWater(player->mo, player->mo->Sector, player->mo->Pos(), false, true, true);
}
}
}

View file

@ -123,9 +123,8 @@ bool P_Thing_Spawn (int tid, AActor *source, int type, DAngle angle, bool fog, i
// [BC] Added
// [RH] Fixed
bool P_MoveThing(AActor *source, fixed_t x, fixed_t y, fixed_t z, bool fog)
bool P_MoveThing(AActor *source, const DVector3 &pos, bool fog)
{
DVector3 pos(FIXED2DBL(x), FIXED2DBL(y), FIXED2DBL(z));
DVector3 old = source->Pos();
source->SetOrigin (pos, true);
@ -164,7 +163,7 @@ bool P_Thing_Move (int tid, AActor *source, int mapspot, bool fog)
if (source != NULL && target != NULL)
{
return P_MoveThing(source, target->_f_X(), target->_f_Y(), target->_f_Z(), fog);
return P_MoveThing(source, target->Pos(), fog);
}
return false;
}

View file

@ -1678,32 +1678,28 @@ public:
{
vt->x = vt->y = 0;
vd->zCeiling = vd->zFloor = vd->flags = 0;
sc.MustGetStringName("{");
while (!sc.CheckString("}"))
sc.MustGetToken('{');
while (!sc.CheckToken('}'))
{
sc.MustGetString();
FName key = sc.String;
sc.MustGetStringName("=");
sc.MustGetString();
FString value = sc.String;
sc.MustGetStringName(";");
switch(key)
FName key = ParseKey();
switch (key)
{
case NAME_X:
vt->x = FLOAT2FIXED(strtod(value, NULL));
vt->x = CheckFixed(key);
break;
case NAME_Y:
vt->y = FLOAT2FIXED(strtod(value, NULL));
vt->y = CheckFixed(key);
break;
case NAME_ZCeiling:
vd->zCeiling = FLOAT2FIXED(strtod(value, NULL));
vd->zCeiling = CheckFloat(key);
vd->flags |= VERTEXFLAG_ZCeilingEnabled;
break;
case NAME_ZFloor:
vd->zFloor = FLOAT2FIXED(strtod(value, NULL));
vd->zFloor = CheckFloat(key);
vd->flags |= VERTEXFLAG_ZFloorEnabled;
break;

View file

@ -88,7 +88,7 @@ enum
};
struct vertexdata_t
{
fixed_t zCeiling, zFloor;
double zCeiling, zFloor;
DWORD flags;
};
struct vertex_t

View file

@ -231,6 +231,10 @@ void S_SoundMinMaxDist (AActor *ent, int channel, FSoundID sfxid, float volume,
void S_Sound (const FPolyObj *poly, int channel, FSoundID sfxid, float volume, float attenuation);
void S_Sound (const sector_t *sec, int channel, FSoundID sfxid, float volume, float attenuation);
void S_Sound (fixed_t x, fixed_t y, fixed_t z, int channel, FSoundID sfxid, float volume, float attenuation);
inline void S_Sound(const DVector3 &pos, int channel, FSoundID sfxid, float volume, float attenuation)
{
S_Sound(FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), FLOAT2FIXED(pos.Z), channel, sfxid, volume, attenuation);
}
// sound channels
// channel 0 never willingly overrides

View file

@ -5095,8 +5095,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_WolfAttack)
// Compute position for spawning blood/puff
angle = self->target->__f_AngleTo(self);
fixedvec3 bloodpos = self->target->_f_Vec3Angle(self->target->_f_radius(), angle, self->target->_f_height() >> 1);
DVector3 BloodPos = self->target->Vec3Angle(self->target->radius, ANGLE2DBL(angle), self->target->Height/2);
int damage = flags & WAF_NORANDOM ? maxdamage : (1 + (pr_cabullet() % maxdamage));
if (dist >= pointblank)
@ -5117,7 +5116,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_WolfAttack)
if ((0 && dpuff->flags3 & MF3_PUFFONACTORS) || !spawnblood)
{
spawnblood = false;
P_SpawnPuff(self, pufftype, bloodpos, angle, angle, 0);
P_SpawnPuff(self, pufftype, BloodPos, ANGLE2DBL(angle), ANGLE2DBL(angle), 0);
}
}
else if (self->target->flags3 & MF3_GHOST)
@ -5127,7 +5126,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_WolfAttack)
int newdam = P_DamageMobj(self->target, self, self, damage, mod, DMG_THRUSTLESS);
if (spawnblood)
{
P_SpawnBlood(bloodpos, angle, newdam > 0 ? newdam : damage, self->target);
P_SpawnBlood(BloodPos, ANGLE2DBL(angle), newdam > 0 ? newdam : damage, self->target);
P_TraceBleed(newdam > 0 ? newdam : damage, self->target, self);
}
}