mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-27 22:42:57 +00:00
- trimmed down the AActor Spawn interface and removed all non-float variants.
This still needs some cleanup in a few calling functions.
This commit is contained in:
parent
2a0d5a621a
commit
f8cf4bcf3d
29 changed files with 214 additions and 277 deletions
82
src/actor.h
82
src/actor.h
|
@ -580,7 +580,7 @@ public:
|
|||
|
||||
void Serialize (FArchive &arc);
|
||||
|
||||
static AActor *StaticSpawn (PClassActor *type, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement, bool SpawningMapThing = false);
|
||||
static AActor *StaticSpawn (PClassActor *type, const DVector3 &pos, replace_t allowreplacement, bool SpawningMapThing = false);
|
||||
|
||||
inline AActor *GetDefault () const
|
||||
{
|
||||
|
@ -1666,96 +1666,36 @@ public:
|
|||
bool P_IsTIDUsed(int tid);
|
||||
int P_FindUniqueTID(int start_tid, int limit);
|
||||
|
||||
inline AActor *Spawn (PClassActor *type, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement)
|
||||
{
|
||||
return AActor::StaticSpawn (type, x, y, z, allowreplacement);
|
||||
}
|
||||
PClassActor *ClassForSpawn(FName classname);
|
||||
|
||||
inline AActor *Spawn(PClassActor *type)
|
||||
{
|
||||
return AActor::StaticSpawn(type, 0, 0, 0, NO_REPLACE);
|
||||
}
|
||||
inline AActor *Spawn (PClassActor *type, const fixedvec3 &pos, replace_t allowreplacement)
|
||||
{
|
||||
return AActor::StaticSpawn (type, pos.x, pos.y, pos.z, allowreplacement);
|
||||
return AActor::StaticSpawn(type, DVector3(0, 0, 0), NO_REPLACE);
|
||||
}
|
||||
|
||||
inline AActor *Spawn(PClassActor *type, const DVector3 &pos, replace_t allowreplacement)
|
||||
{
|
||||
fixed_t zz;
|
||||
if (pos.Z != ONFLOORZ && pos.Z != ONCEILINGZ && pos.Z != FLOATRANDZ) zz = FLOAT2FIXED(pos.Z);
|
||||
else zz = (int)pos.Z;
|
||||
return Spawn(type, FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), zz, allowreplacement);
|
||||
return AActor::StaticSpawn(type, pos, allowreplacement);
|
||||
}
|
||||
|
||||
AActor *Spawn (const char *type, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement);
|
||||
AActor *Spawn (FName classname, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement);
|
||||
|
||||
inline AActor *Spawn(FName type)
|
||||
{
|
||||
return Spawn(type, 0, 0, 0, NO_REPLACE);
|
||||
}
|
||||
|
||||
inline AActor *Spawn (const char *type, const fixedvec3 &pos, replace_t allowreplacement)
|
||||
{
|
||||
return Spawn (type, pos.x, pos.y, pos.z, allowreplacement);
|
||||
}
|
||||
|
||||
inline AActor *Spawn(const char *type, const DVector3 &pos, replace_t allowreplacement)
|
||||
{
|
||||
fixed_t zz;
|
||||
if (pos.Z != ONFLOORZ && pos.Z != ONCEILINGZ && pos.Z != FLOATRANDZ) zz = FLOAT2FIXED(pos.Z);
|
||||
else zz = (int)pos.Z;
|
||||
return Spawn(type, FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), zz, allowreplacement);
|
||||
}
|
||||
|
||||
inline AActor *Spawn (FName classname, const fixedvec3 &pos, replace_t allowreplacement)
|
||||
{
|
||||
return Spawn (classname, pos.x, pos.y, pos.z, allowreplacement);
|
||||
return AActor::StaticSpawn(ClassForSpawn(type), DVector3(0, 0, 0), NO_REPLACE);
|
||||
}
|
||||
|
||||
inline AActor *Spawn(FName type, const DVector3 &pos, replace_t allowreplacement)
|
||||
{
|
||||
fixed_t zz;
|
||||
if (pos.Z != ONFLOORZ && pos.Z != ONCEILINGZ && pos.Z != FLOATRANDZ) zz = FLOAT2FIXED(pos.Z);
|
||||
else zz = (int)pos.Z;
|
||||
return Spawn(type, FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), zz, allowreplacement);
|
||||
return AActor::StaticSpawn(ClassForSpawn(type), pos, allowreplacement);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline T *Spawn (fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement)
|
||||
template<class T> inline T *Spawn(const DVector3 &pos, replace_t allowreplacement)
|
||||
{
|
||||
return static_cast<T *>(AActor::StaticSpawn (RUNTIME_TEMPLATE_CLASS(T), x, y, z, allowreplacement));
|
||||
return static_cast<T *>(AActor::StaticSpawn(RUNTIME_TEMPLATE_CLASS(T), pos, allowreplacement));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline T *Spawn (const fixedvec3 &pos, replace_t allowreplacement)
|
||||
template<class T> inline T *Spawn() // for inventory items we do not need coordinates and replacement info.
|
||||
{
|
||||
return static_cast<T *>(AActor::StaticSpawn (RUNTIME_TEMPLATE_CLASS(T), pos.x, pos.y, pos.z, allowreplacement));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline T *Spawn(const DVector3 &pos, replace_t allowreplacement)
|
||||
{
|
||||
fixed_t zz;
|
||||
if (pos.Z != ONFLOORZ && pos.Z != ONCEILINGZ && pos.Z != FLOATRANDZ) zz = FLOAT2FIXED(pos.Z);
|
||||
else zz = (int)pos.Z;
|
||||
return static_cast<T *>(AActor::StaticSpawn(RUNTIME_TEMPLATE_CLASS(T), FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), zz, allowreplacement));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline T *Spawn(double x, double y, double z, replace_t allowreplacement)
|
||||
{
|
||||
fixed_t zz;
|
||||
if (z != ONFLOORZ && z != ONCEILINGZ && z != FLOATRANDZ) zz = FLOAT2FIXED(z);
|
||||
else zz = (int)z;
|
||||
return static_cast<T *>(AActor::StaticSpawn(RUNTIME_TEMPLATE_CLASS(T), FLOAT2FIXED(x), FLOAT2FIXED(y), zz, allowreplacement));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline T *Spawn() // for inventory items we do not need coordinates and replacement info.
|
||||
{
|
||||
return static_cast<T *>(AActor::StaticSpawn(RUNTIME_TEMPLATE_CLASS(T), 0, 0, 0, NO_REPLACE));
|
||||
return static_cast<T *>(AActor::StaticSpawn(RUNTIME_TEMPLATE_CLASS(T), DVector3(0, 0, 0), NO_REPLACE));
|
||||
}
|
||||
|
||||
inline fixedvec2 Vec2Angle(fixed_t length, angle_t angle)
|
||||
|
|
|
@ -103,7 +103,7 @@ public:
|
|||
void StartTravel ();
|
||||
void FinishTravel ();
|
||||
bool IsLeader (player_t *player);
|
||||
void SetBodyAt (fixed_t x, fixed_t y, fixed_t z, int hostnum);
|
||||
void SetBodyAt (const DVector3 &pos, int hostnum);
|
||||
fixed_t FakeFire (AActor *source, AActor *dest, ticcmd_t *cmd);
|
||||
bool SafeCheckPosition (AActor *actor, fixed_t x, fixed_t y, FCheckPosition &tm);
|
||||
|
||||
|
|
|
@ -141,8 +141,10 @@ void DBot::Dofire (ticcmd_t *cmd)
|
|||
int aiming_penalty=0; //For shooting at shading target, if screen is red, MAKEME: When screen red.
|
||||
int aiming_value; //The final aiming value.
|
||||
fixed_t dist;
|
||||
double fdist;
|
||||
angle_t an;
|
||||
int m;
|
||||
double fm;
|
||||
|
||||
if (!enemy || !(enemy->flags & MF_SHOOTABLE) || enemy->health <= 0)
|
||||
return;
|
||||
|
@ -221,9 +223,9 @@ void DBot::Dofire (ticcmd_t *cmd)
|
|||
}
|
||||
// prediction aiming
|
||||
shootmissile:
|
||||
dist = player->mo->AproxDistance (enemy);
|
||||
m = dist / GetDefaultByType (player->ReadyWeapon->ProjectileType)->_f_speed();
|
||||
bglobal.SetBodyAt (enemy->_f_X() + enemy->_f_velx()*m*2, enemy->_f_Y() + enemy->_f_vely()*m*2, enemy->_f_Z(), 1);
|
||||
fdist = player->mo->Distance2D(enemy);
|
||||
fm = fdist / GetDefaultByType (player->ReadyWeapon->ProjectileType)->Speed;
|
||||
bglobal.SetBodyAt(enemy->Pos() + enemy->Vel.XY() * fm * 2, 1);
|
||||
angle = player->mo->__f_AngleTo(bglobal.body1);
|
||||
if (Check_LOS (enemy, SHOOTFOV))
|
||||
no_fire = false;
|
||||
|
@ -425,28 +427,28 @@ AActor *DBot::Find_enemy ()
|
|||
|
||||
|
||||
//Creates a temporary mobj (invisible) at the given location.
|
||||
void FCajunMaster::SetBodyAt (fixed_t x, fixed_t y, fixed_t z, int hostnum)
|
||||
void FCajunMaster::SetBodyAt (const DVector3 &pos, int hostnum)
|
||||
{
|
||||
if (hostnum == 1)
|
||||
{
|
||||
if (body1)
|
||||
{
|
||||
body1->SetOrigin (x, y, z, false);
|
||||
body1->SetOrigin (pos, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
body1 = Spawn ("CajunBodyNode", x, y, z, NO_REPLACE);
|
||||
body1 = Spawn ("CajunBodyNode", pos, NO_REPLACE);
|
||||
}
|
||||
}
|
||||
else if (hostnum == 2)
|
||||
{
|
||||
if (body2)
|
||||
{
|
||||
body2->SetOrigin (x, y, z, false);
|
||||
body2->SetOrigin (pos, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
body2 = Spawn ("CajunBodyNode", x, y, z, NO_REPLACE);
|
||||
body2 = Spawn ("CajunBodyNode", pos, NO_REPLACE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -463,7 +465,7 @@ void FCajunMaster::SetBodyAt (fixed_t x, fixed_t y, fixed_t z, int hostnum)
|
|||
//Emulates missile travel. Returns distance travelled.
|
||||
fixed_t FCajunMaster::FakeFire (AActor *source, AActor *dest, ticcmd_t *cmd)
|
||||
{
|
||||
AActor *th = Spawn ("CajunTrace", source->PosPlusZ(4*8*FRACUNIT), NO_REPLACE);
|
||||
AActor *th = Spawn ("CajunTrace", source->PosPlusZ(4*8.), NO_REPLACE);
|
||||
|
||||
th->target = source; // where it came from
|
||||
|
||||
|
@ -485,25 +487,22 @@ fixed_t FCajunMaster::FakeFire (AActor *source, AActor *dest, ticcmd_t *cmd)
|
|||
|
||||
angle_t DBot::FireRox (AActor *enemy, ticcmd_t *cmd)
|
||||
{
|
||||
fixed_t dist;
|
||||
double dist;
|
||||
angle_t ang;
|
||||
AActor *actor;
|
||||
int m;
|
||||
double m;
|
||||
|
||||
bglobal.SetBodyAt (player->mo->_f_X() + FixedMul(player->mo->_f_velx(), 5*FRACUNIT),
|
||||
player->mo->_f_Y() + FixedMul(player->mo->_f_vely(), 5*FRACUNIT),
|
||||
player->mo->_f_Z() + (player->mo->_f_height() / 2), 2);
|
||||
bglobal.SetBodyAt(player->mo->PosPlusZ(player->mo->Height / 2) + player->mo->Vel.XY() * 5, 2);
|
||||
|
||||
actor = bglobal.body2;
|
||||
|
||||
dist = actor->AproxDistance (enemy);
|
||||
if (dist < SAFE_SELF_MISDIST)
|
||||
dist = actor->Distance2D (enemy);
|
||||
if (dist < SAFE_SELF_MISDIST/FRACUNIT)
|
||||
return 0;
|
||||
//Predict.
|
||||
m = (((dist+1)/FRACUNIT) / GetDefaultByName("Rocket")->_f_speed());
|
||||
m = ((dist+1) / GetDefaultByName("Rocket")->Speed);
|
||||
|
||||
bglobal.SetBodyAt (enemy->_f_X() + FixedMul(enemy->_f_velx(), (m+2*FRACUNIT)),
|
||||
enemy->_f_Y() + FixedMul(enemy->_f_vely(), (m+2*FRACUNIT)), ONFLOORZ, 1);
|
||||
bglobal.SetBodyAt(DVector3((enemy->Pos() + enemy->Vel * (m + 2)), ONFLOORZ), 1);
|
||||
|
||||
//try the predicted location
|
||||
if (P_CheckSight (actor, bglobal.body1, SF_IGNOREVISIBILITY)) //See the predicted location, so give a test missile
|
||||
|
|
|
@ -2321,7 +2321,7 @@ void Net_DoCommand (int type, BYTE **stream, int player)
|
|||
else
|
||||
{
|
||||
const AActor *def = GetDefaultByType (typeinfo);
|
||||
fixedvec3 spawnpos = source->_f_Vec3Angle(def->_f_radius() * 2 + source->_f_radius(), source->_f_angle(), 8 * FRACUNIT);
|
||||
DVector3 spawnpos = source->Vec3Angle(def->radius * 2 + source->radius, source->Angles.Yaw, 8.);
|
||||
|
||||
AActor *spawned = Spawn (typeinfo, spawnpos, ALLOW_REPLACE);
|
||||
if (spawned != NULL)
|
||||
|
|
|
@ -862,7 +862,7 @@ void FParser::SF_Player(void)
|
|||
|
||||
void FParser::SF_Spawn(void)
|
||||
{
|
||||
int x, y, z;
|
||||
DVector3 pos;
|
||||
PClassActor *pclass;
|
||||
DAngle angle = 0.;
|
||||
|
||||
|
@ -870,22 +870,22 @@ void FParser::SF_Spawn(void)
|
|||
{
|
||||
if (!(pclass=T_GetMobjType(t_argv[0]))) return;
|
||||
|
||||
x = fixedvalue(t_argv[1]);
|
||||
y = fixedvalue(t_argv[2]);
|
||||
pos.X = floatvalue(t_argv[1]);
|
||||
pos.Y = floatvalue(t_argv[2]);
|
||||
|
||||
if(t_argc >= 5)
|
||||
{
|
||||
z = fixedvalue(t_argv[4]);
|
||||
pos.Z = floatvalue(t_argv[4]);
|
||||
// [Graf Zahl] added option of spawning with a relative z coordinate
|
||||
if(t_argc > 5)
|
||||
{
|
||||
if (intvalue(t_argv[5])) z+=P_PointInSector(x, y)->floorplane.ZatPoint(x,y);
|
||||
if (intvalue(t_argv[5])) pos.Z += P_PointInSector(pos)->floorplane.ZatPoint(pos);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Legacy compatibility is more important than correctness.
|
||||
z = ONFLOORZ;// (GetDefaultByType(PClass)->flags & MF_SPAWNCEILING) ? ONCEILINGZ : ONFLOORZ;
|
||||
pos.Z = ONFLOORZ;// (GetDefaultByType(PClass)->flags & MF_SPAWNCEILING) ? ONCEILINGZ : ONFLOORZ;
|
||||
}
|
||||
|
||||
if(t_argc >= 4)
|
||||
|
@ -894,7 +894,7 @@ void FParser::SF_Spawn(void)
|
|||
}
|
||||
|
||||
t_return.type = svt_mobj;
|
||||
t_return.value.mobj = Spawn(pclass, x, y, z, ALLOW_REPLACE);
|
||||
t_return.value.mobj = Spawn(pclass, pos, ALLOW_REPLACE);
|
||||
|
||||
if (t_return.value.mobj)
|
||||
{
|
||||
|
@ -3340,7 +3340,7 @@ void FParser::SF_FixedValue(void)
|
|||
|
||||
void FParser::SF_SpawnExplosion()
|
||||
{
|
||||
fixed_t x, y, z;
|
||||
DVector3 pos;
|
||||
AActor* spawn;
|
||||
PClassActor * pclass;
|
||||
|
||||
|
@ -3348,14 +3348,14 @@ void FParser::SF_SpawnExplosion()
|
|||
{
|
||||
if (!(pclass=T_GetMobjType(t_argv[0]))) return;
|
||||
|
||||
x = fixedvalue(t_argv[1]);
|
||||
y = fixedvalue(t_argv[2]);
|
||||
pos.X = floatvalue(t_argv[1]);
|
||||
pos.Y = floatvalue(t_argv[2]);
|
||||
if(t_argc > 3)
|
||||
z = fixedvalue(t_argv[3]);
|
||||
pos.Z = floatvalue(t_argv[3]);
|
||||
else
|
||||
z = P_PointInSector(x, y)->floorplane.ZatPoint(x,y);
|
||||
pos.Z = P_PointInSector(pos)->floorplane.ZatPoint(pos);
|
||||
|
||||
spawn = Spawn (pclass, x, y, z, ALLOW_REPLACE);
|
||||
spawn = Spawn (pclass, pos, ALLOW_REPLACE);
|
||||
t_return.type = svt_int;
|
||||
t_return.value.i=0;
|
||||
if (spawn)
|
||||
|
@ -4239,31 +4239,31 @@ void FParser::SF_SpawnShot2(void)
|
|||
{
|
||||
AActor *source = NULL;
|
||||
PClassActor * pclass;
|
||||
int z=0;
|
||||
|
||||
double z = 0;
|
||||
|
||||
// t_argv[0] = type to spawn
|
||||
// t_argv[1] = source mobj, optional, -1 to default
|
||||
// shoots at source's angle
|
||||
|
||||
|
||||
if (CheckArgs(2))
|
||||
{
|
||||
if(t_argv[1].type == svt_int && t_argv[1].value.i < 0)
|
||||
if (t_argv[1].type == svt_int && t_argv[1].value.i < 0)
|
||||
source = Script->trigger;
|
||||
else
|
||||
source = actorvalue(t_argv[1]);
|
||||
|
||||
if (t_argc>2) z=fixedvalue(t_argv[2]);
|
||||
|
||||
if(!source) return;
|
||||
|
||||
if (!(pclass=T_GetMobjType(t_argv[0]))) return;
|
||||
|
||||
if (t_argc > 2) z = floatvalue(t_argv[2]);
|
||||
|
||||
if (!source) return;
|
||||
|
||||
if (!(pclass = T_GetMobjType(t_argv[0]))) return;
|
||||
|
||||
t_return.type = svt_mobj;
|
||||
|
||||
AActor *mo = Spawn (pclass, source->PosPlusZ(z), ALLOW_REPLACE);
|
||||
if (mo)
|
||||
AActor *mo = Spawn(pclass, source->PosPlusZ(z), ALLOW_REPLACE);
|
||||
if (mo)
|
||||
{
|
||||
S_Sound (mo, CHAN_VOICE, mo->SeeSound, 1, ATTN_NORM);
|
||||
S_Sound(mo, CHAN_VOICE, mo->SeeSound, 1, ATTN_NORM);
|
||||
mo->target = source;
|
||||
mo->Angles.Yaw = source->Angles.Yaw;
|
||||
mo->Thrust();
|
||||
|
|
|
@ -66,7 +66,7 @@ void AFastProjectile::Tick ()
|
|||
tm.LastRipped.Clear(); // [RH] Do rip damage each step, like Hexen
|
||||
}
|
||||
|
||||
if (!P_TryMove (this, X() + frac.X, Y() + frac.Y, true, NULL, tm))
|
||||
if (!P_TryMove (this, Pos() + frac, true, NULL, tm))
|
||||
{ // Blocked move
|
||||
if (!(flags3 & MF3_SKYEXPLODE))
|
||||
{
|
||||
|
|
|
@ -787,7 +787,7 @@ AInventory *AInventory::CreateTossable ()
|
|||
flags &= ~(MF_SPECIAL|MF_SOLID);
|
||||
return this;
|
||||
}
|
||||
copy = static_cast<AInventory *>(Spawn (GetClass(), Owner->_f_Pos(), NO_REPLACE));
|
||||
copy = static_cast<AInventory *>(Spawn (GetClass(), Owner->Pos(), NO_REPLACE));
|
||||
if (copy != NULL)
|
||||
{
|
||||
copy->MaxAmount = MaxAmount;
|
||||
|
|
|
@ -77,7 +77,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnEntity)
|
|||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
|
||||
AActor *entity = Spawn("EntityBoss", self->PosPlusZ(70), ALLOW_REPLACE);
|
||||
AActor *entity = Spawn("EntityBoss", self->PosPlusZ(70.), ALLOW_REPLACE);
|
||||
if (entity != NULL)
|
||||
{
|
||||
entity->Angles.Yaw = self->Angles.Yaw;
|
||||
|
|
|
@ -127,7 +127,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_TossArm)
|
|||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
|
||||
AActor *foo = Spawn("InquisitorArm", self->PosPlusZ(24), ALLOW_REPLACE);
|
||||
AActor *foo = Spawn("InquisitorArm", self->PosPlusZ(24.), ALLOW_REPLACE);
|
||||
foo->Angles.Yaw = self->Angles.Yaw - 90. + pr_inq.Random2() * (360./1024.);
|
||||
foo->VelFromAngle(foo->Speed / 8);
|
||||
foo->Vel.Z = pr_inq() / 64.;
|
||||
|
|
|
@ -130,7 +130,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnProgrammerBase)
|
|||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
|
||||
AActor *foo = Spawn("ProgrammerBase", self->PosPlusZ(24), ALLOW_REPLACE);
|
||||
AActor *foo = Spawn("ProgrammerBase", self->PosPlusZ(24.), ALLOW_REPLACE);
|
||||
if (foo != NULL)
|
||||
{
|
||||
foo->Angles.Yaw = self->Angles.Yaw + 180. + pr_prog.Random2() * (360. / 1024.);
|
||||
|
|
|
@ -251,7 +251,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_TossGib)
|
|||
PARAM_ACTION_PROLOGUE;
|
||||
|
||||
const char *gibtype = (self->flags & MF_NOBLOOD) ? "Junk" : "Meat";
|
||||
AActor *gib = Spawn (gibtype, self->PosPlusZ(24), ALLOW_REPLACE);
|
||||
AActor *gib = Spawn (gibtype, self->PosPlusZ(24.), ALLOW_REPLACE);
|
||||
|
||||
if (gib == NULL)
|
||||
{
|
||||
|
|
|
@ -667,7 +667,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Burnination)
|
|||
pos = self->Pos();
|
||||
}
|
||||
|
||||
AActor *drop = Spawn<APhosphorousFire> (pos.X, pos.Y, self->Z() + 4., ALLOW_REPLACE);
|
||||
AActor *drop = Spawn<APhosphorousFire> (DVector3(pos, self->Z() + 4.), ALLOW_REPLACE);
|
||||
if (drop != NULL)
|
||||
{
|
||||
drop->Vel.X = self->Vel.X + pr_phburn.Random2 (7);
|
||||
|
|
|
@ -3462,7 +3462,7 @@ void DLevelScript::ReplaceTextures (int fromnamei, int tonamei, int flags)
|
|||
}
|
||||
}
|
||||
|
||||
int DLevelScript::DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, int angle, bool force)
|
||||
int DLevelScript::DoSpawn (int type, const DVector3 &pos, int tid, DAngle angle, bool force)
|
||||
{
|
||||
PClassActor *info = PClass::FindActor(FBehavior::StaticLookupString (type));
|
||||
AActor *actor = NULL;
|
||||
|
@ -3478,14 +3478,14 @@ int DLevelScript::DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, i
|
|||
return 0;
|
||||
}
|
||||
|
||||
actor = Spawn (info, x, y, z, ALLOW_REPLACE);
|
||||
actor = Spawn (info, pos, ALLOW_REPLACE);
|
||||
if (actor != NULL)
|
||||
{
|
||||
ActorFlags2 oldFlags2 = actor->flags2;
|
||||
actor->flags2 |= MF2_PASSMOBJ;
|
||||
if (force || P_TestMobjLocation (actor))
|
||||
{
|
||||
actor->Angles.Yaw = angle * (360. / 256);
|
||||
actor->Angles.Yaw = angle;
|
||||
actor->tid = tid;
|
||||
actor->AddToHash ();
|
||||
if (actor->flags & MF_SPECIAL)
|
||||
|
@ -3506,6 +3506,12 @@ int DLevelScript::DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, i
|
|||
return spawncount;
|
||||
}
|
||||
|
||||
int DLevelScript::DoSpawn(int type, int x, int y, int z, int tid, int angle, bool force)
|
||||
{
|
||||
return DoSpawn(type, DVector3(ACSToDouble(x), ACSToDouble(y), ACSToDouble(z)), tid, angle * (360. / 256), force);
|
||||
}
|
||||
|
||||
|
||||
int DLevelScript::DoSpawnSpot (int type, int spot, int tid, int angle, bool force)
|
||||
{
|
||||
int spawned = 0;
|
||||
|
@ -3517,12 +3523,12 @@ int DLevelScript::DoSpawnSpot (int type, int spot, int tid, int angle, bool forc
|
|||
|
||||
while ( (aspot = iterator.Next ()) )
|
||||
{
|
||||
spawned += DoSpawn (type, aspot->_f_X(), aspot->_f_Y(), aspot->_f_Z(), tid, angle, force);
|
||||
spawned += DoSpawn (type, aspot->Pos(), tid, angle * (360. / 256), force);
|
||||
}
|
||||
}
|
||||
else if (activator != NULL)
|
||||
{
|
||||
spawned += DoSpawn (type, activator->_f_X(), activator->_f_Y(), activator->_f_Z(), tid, angle, force);
|
||||
spawned += DoSpawn (type, activator->Pos(), tid, angle * (360. / 256), force);
|
||||
}
|
||||
return spawned;
|
||||
}
|
||||
|
@ -3538,12 +3544,12 @@ int DLevelScript::DoSpawnSpotFacing (int type, int spot, int tid, bool force)
|
|||
|
||||
while ( (aspot = iterator.Next ()) )
|
||||
{
|
||||
spawned += DoSpawn (type, aspot->_f_X(), aspot->_f_Y(), aspot->_f_Z(), tid, aspot->_f_angle() >> 24, force);
|
||||
spawned += DoSpawn (type, aspot->Pos(), tid, aspot->Angles.Yaw, force);
|
||||
}
|
||||
}
|
||||
else if (activator != NULL)
|
||||
{
|
||||
spawned += DoSpawn (type, activator->_f_X(), activator->_f_Y(), activator->_f_Z(), tid, activator->_f_angle() >> 24, force);
|
||||
spawned += DoSpawn (type, activator->Pos(), tid, activator->Angles.Yaw, force);
|
||||
}
|
||||
return spawned;
|
||||
}
|
||||
|
|
|
@ -907,7 +907,8 @@ protected:
|
|||
static int CountPlayers ();
|
||||
static void SetLineTexture (int lineid, int side, int position, int name);
|
||||
static void ReplaceTextures (int fromname, int toname, int flags);
|
||||
static int DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, int angle, bool force);
|
||||
static int DoSpawn (int type, const DVector3 &pos, int tid, DAngle angle, bool force);
|
||||
static int DoSpawn(int type, int x, int y, int z, int tid, int angle, bool force);
|
||||
static bool DoCheckActorTexture(int tid, AActor *activator, int string, bool floor);
|
||||
int DoSpawnSpot (int type, int spot, int tid, int angle, bool forced);
|
||||
int DoSpawnSpotFacing (int type, int spot, int tid, bool forced);
|
||||
|
|
|
@ -862,9 +862,7 @@ void P_DrawRailTrail(AActor *source, const DVector3 &start, const DVector3 &end,
|
|||
if (rnd & 4)
|
||||
diff.Z = clamp<double>(diff.Z + ((rnd & 32) ? 1 : -1), -maxdiff, maxdiff);
|
||||
}
|
||||
DVector3 postmp = pos + diff;
|
||||
|
||||
AActor *thing = Spawn (spawnclass, FLOAT2FIXED(postmp.X), FLOAT2FIXED(postmp.Y), FLOAT2FIXED(postmp.Z), ALLOW_REPLACE);
|
||||
AActor *thing = Spawn (spawnclass, pos + diff, ALLOW_REPLACE);
|
||||
if (thing)
|
||||
thing->Angles.Yaw = ANGLE2DBL(angle);
|
||||
pos += trail_step;
|
||||
|
|
|
@ -3161,9 +3161,8 @@ AInventory *P_DropItem (AActor *source, PClassActor *type, int dropamount, int c
|
|||
if (type != NULL && pr_dropitem() <= chance)
|
||||
{
|
||||
AActor *mo;
|
||||
fixed_t spawnz;
|
||||
double spawnz = 0;
|
||||
|
||||
spawnz = source->_f_Z();
|
||||
if (!(i_compatflags & COMPATF_NOTOSSDROPS))
|
||||
{
|
||||
int style = sv_dropstyle;
|
||||
|
@ -3173,14 +3172,14 @@ AInventory *P_DropItem (AActor *source, PClassActor *type, int dropamount, int c
|
|||
}
|
||||
if (style == 2)
|
||||
{
|
||||
spawnz += 24*FRACUNIT;
|
||||
spawnz = 24*FRACUNIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
spawnz += source->_f_height() / 2;
|
||||
spawnz = source->Height / 2;
|
||||
}
|
||||
}
|
||||
mo = Spawn(type, source->_f_X(), source->_f_Y(), spawnz, ALLOW_REPLACE);
|
||||
mo = Spawn(type, source->PosPlusZ(spawnz), ALLOW_REPLACE);
|
||||
if (mo != NULL)
|
||||
{
|
||||
mo->flags |= MF_DROPPED;
|
||||
|
|
|
@ -3268,19 +3268,23 @@ FUNC(LS_GlassBreak)
|
|||
{
|
||||
if (!arg0)
|
||||
{ // Break some glass
|
||||
fixed_t x, y;
|
||||
AActor *glass;
|
||||
|
||||
x = ln->v1->x + ln->dx/2;
|
||||
y = ln->v1->y + ln->dy/2;
|
||||
DVector2 linemid((ln->v1->fX() + ln->v2->fX()) / 2, (ln->v1->fY() + ln->v2->fY()) / 2);
|
||||
|
||||
// remove dependence on sector size and always spawn 2 map units in front of the line.
|
||||
DVector2 normal(ln->Delta().Y, -ln->Delta().X);
|
||||
linemid += normal.Unit() * 2;
|
||||
/* old code:
|
||||
x += (ln->frontsector->centerspot.x - x) / 5;
|
||||
y += (ln->frontsector->centerspot.y - y) / 5;
|
||||
*/
|
||||
|
||||
for (int i = 0; i < 7; ++i)
|
||||
{
|
||||
glass = Spawn("GlassJunk", x, y, ONFLOORZ, ALLOW_REPLACE);
|
||||
glass = Spawn("GlassJunk", DVector3(linemid, ONFLOORZ), ALLOW_REPLACE);
|
||||
|
||||
glass->_f_AddZ(24 * FRACUNIT);
|
||||
glass->AddZ(24.);
|
||||
glass->SetState (glass->SpawnState + (pr_glass() % glass->health));
|
||||
|
||||
glass->Angles.Yaw = pr_glass() * (360 / 256.);
|
||||
|
|
|
@ -23,10 +23,13 @@
|
|||
#ifndef __P_LOCAL__
|
||||
#define __P_LOCAL__
|
||||
|
||||
#include <float.h>
|
||||
#include "doomtype.h"
|
||||
#include "tables.h"
|
||||
#include "vectors.h"
|
||||
|
||||
const double NO_VALUE = FLT_MAX;
|
||||
|
||||
class player_t;
|
||||
class AActor;
|
||||
struct FPlayerStart;
|
||||
|
@ -301,6 +304,10 @@ inline bool P_TryMove(AActor* thing, const DVector2 &pos, int dropoff, const sec
|
|||
{
|
||||
return P_TryMove(thing, FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), dropoff, onfloor);
|
||||
}
|
||||
inline bool P_TryMove(AActor* thing, const DVector2 &pos, int dropoff, const secplane_t * onfloor, FCheckPosition &tm, bool missileCheck = false)
|
||||
{
|
||||
return P_TryMove(thing, FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), dropoff, onfloor, tm, missileCheck);
|
||||
}
|
||||
bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y);
|
||||
void P_ApplyTorque(AActor *mo);
|
||||
bool P_TeleportMove (AActor* thing, fixed_t x, fixed_t y, fixed_t z, bool telefrag, bool modifyactor = true); // [RH] Added z and telefrag parameters
|
||||
|
|
|
@ -4749,7 +4749,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
|
|||
// used as damage inflictor
|
||||
AActor *thepuff = NULL;
|
||||
|
||||
if (puffclass != NULL) thepuff = Spawn(puffclass, source->_f_Pos(), ALLOW_REPLACE);
|
||||
if (puffclass != NULL) thepuff = Spawn(puffclass, source->Pos(), ALLOW_REPLACE);
|
||||
|
||||
for (i = 0; i < rail_data.RailHits.Size(); i++)
|
||||
{
|
||||
|
@ -5636,7 +5636,7 @@ void P_DoCrunch(AActor *thing, FChangePosition *cpos)
|
|||
{
|
||||
AActor *mo;
|
||||
|
||||
mo = Spawn(bloodcls, thing->PosPlusZ(thing->_f_height() / 2), ALLOW_REPLACE);
|
||||
mo = Spawn(bloodcls, thing->PosPlusZ(thing->Height / 2), ALLOW_REPLACE);
|
||||
|
||||
mo->Vel.X = pr_crunch.Random2() / 16.;
|
||||
mo->Vel.Y = pr_crunch.Random2() / 16.;
|
||||
|
|
128
src/p_mobj.cpp
128
src/p_mobj.cpp
|
@ -838,7 +838,7 @@ AInventory *AActor::DropInventory (AInventory *item)
|
|||
{
|
||||
return NULL;
|
||||
}
|
||||
drop->SetOrigin(PosPlusZ(10*FRACUNIT), false);
|
||||
drop->SetOrigin(PosPlusZ(10.), false);
|
||||
drop->Angles.Yaw = Angles.Yaw;
|
||||
drop->VelFromAngle(5.);
|
||||
drop->Vel.Z = 1.;
|
||||
|
@ -2754,7 +2754,7 @@ void P_NightmareRespawn (AActor *mobj)
|
|||
z = ONFLOORZ;
|
||||
|
||||
// spawn it
|
||||
mo = AActor::StaticSpawn(mobj->GetClass(), mobj->SpawnPoint.X, mobj->SpawnPoint.Y, z, NO_REPLACE, true);
|
||||
mo = AActor::StaticSpawn(mobj->GetClass(), DVector3(mobj->SpawnPoint.X, mobj->SpawnPoint.Y, z), NO_REPLACE, true);
|
||||
|
||||
if (z == ONFLOORZ)
|
||||
{
|
||||
|
@ -2803,7 +2803,7 @@ void P_NightmareRespawn (AActor *mobj)
|
|||
return; // no respawn
|
||||
}
|
||||
|
||||
z = mo->_f_Z();
|
||||
z = mo->Z();
|
||||
|
||||
// inherit attributes from deceased one
|
||||
mo->SpawnPoint = mobj->SpawnPoint;
|
||||
|
@ -2824,7 +2824,7 @@ void P_NightmareRespawn (AActor *mobj)
|
|||
P_SpawnTeleportFog(mobj, mobj->PosPlusZ(TELEFOGHEIGHT), true, true);
|
||||
|
||||
// spawn a teleport fog at the new spot
|
||||
P_SpawnTeleportFog(mobj, mobj->SpawnPoint.X, mobj->SpawnPoint.Y, z + TELEFOGHEIGHT, false, true);
|
||||
P_SpawnTeleportFog(mobj, DVector3(mobj->SpawnPoint, z + TELEFOGHEIGHT), false, true);
|
||||
|
||||
// remove the old monster
|
||||
mobj->Destroy ();
|
||||
|
@ -3441,7 +3441,7 @@ void AActor::Tick ()
|
|||
{
|
||||
// add some smoke behind the rocket
|
||||
smokecounter = 0;
|
||||
AActor *th = Spawn("RocketSmokeTrail", Vec3Offset(-_f_velx(), -_f_vely(), -_f_velz()), ALLOW_REPLACE);
|
||||
AActor *th = Spawn("RocketSmokeTrail", Vec3Offset(-Vel), ALLOW_REPLACE);
|
||||
if (th)
|
||||
{
|
||||
th->tics -= pr_rockettrail()&3;
|
||||
|
@ -4128,12 +4128,8 @@ bool AActor::UpdateWaterLevel (fixed_t oldz, bool dosplash)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
AActor *AActor::StaticSpawn (PClassActor *type, fixed_t _ix, fixed_t _iy, fixed_t _iz, replace_t allowreplacement, bool SpawningMapThing)
|
||||
AActor *AActor::StaticSpawn (PClassActor *type, const DVector3 &pos, replace_t allowreplacement, bool SpawningMapThing)
|
||||
{
|
||||
double ix = FIXED2DBL(_ix);
|
||||
double iy = FIXED2DBL(_iy);
|
||||
double iz = FIXED2DBL(_iz);
|
||||
|
||||
if (type == NULL)
|
||||
{
|
||||
I_Error ("Tried to spawn a class-less actor\n");
|
||||
|
@ -4159,7 +4155,7 @@ AActor *AActor::StaticSpawn (PClassActor *type, fixed_t _ix, fixed_t _iy, fixed_
|
|||
actor->Conversation = NULL;
|
||||
}
|
||||
|
||||
actor->SetXYZ(ix, iy, iz);
|
||||
actor->SetXYZ(pos);
|
||||
actor->picnum.SetInvalid();
|
||||
actor->health = actor->SpawnHealth();
|
||||
|
||||
|
@ -4196,17 +4192,17 @@ AActor *AActor::StaticSpawn (PClassActor *type, fixed_t _ix, fixed_t _iy, fixed_
|
|||
actor->LinkToWorld (SpawningMapThing);
|
||||
actor->ClearInterpolation();
|
||||
|
||||
actor->floorz = actor->Sector->floorplane.ZatPoint (ix, iy);
|
||||
actor->floorz = actor->Sector->floorplane.ZatPoint(pos);
|
||||
actor->dropoffz = FLOAT2FIXED(actor->floorz); // killough 11/98: for tracking dropoffs
|
||||
actor->ceilingz = actor->Sector->ceilingplane.ZatPoint (ix, iy);
|
||||
actor->ceilingz = actor->Sector->ceilingplane.ZatPoint(pos);
|
||||
|
||||
// The z-coordinate needs to be set once before calling P_FindFloorCeiling
|
||||
// For FLOATRANDZ just use the floor here.
|
||||
if (iz == ONFLOORZ || iz == FLOATRANDZ)
|
||||
if (pos.Z == ONFLOORZ || pos.Z == FLOATRANDZ)
|
||||
{
|
||||
actor->SetZ(actor->floorz);
|
||||
}
|
||||
else if (iz == ONCEILINGZ)
|
||||
else if (pos.Z == ONCEILINGZ)
|
||||
{
|
||||
actor->SetZ(actor->ceilingz - actor->Height);
|
||||
}
|
||||
|
@ -4242,18 +4238,19 @@ AActor *AActor::StaticSpawn (PClassActor *type, fixed_t _ix, fixed_t _iy, fixed_
|
|||
actor->ceilingsector = actor->Sector;
|
||||
}
|
||||
|
||||
actor->SpawnPoint.X = ix;
|
||||
actor->SpawnPoint.Y = iy;
|
||||
actor->SpawnPoint.X = pos.X;
|
||||
actor->SpawnPoint.Y = pos.Y;
|
||||
// do not copy Z!
|
||||
|
||||
if (iz == ONFLOORZ)
|
||||
if (pos.Z == ONFLOORZ)
|
||||
{
|
||||
actor->SetZ(actor->floorz);
|
||||
}
|
||||
else if (iz == ONCEILINGZ)
|
||||
else if (pos.Z == ONCEILINGZ)
|
||||
{
|
||||
actor->SetZ(actor->ceilingz - actor->Height);
|
||||
}
|
||||
else if (iz == FLOATRANDZ)
|
||||
else if (pos.Z == FLOATRANDZ)
|
||||
{
|
||||
double space = actor->ceilingz - actor->Height - actor->floorz;
|
||||
if (space > 48)
|
||||
|
@ -4280,7 +4277,7 @@ AActor *AActor::StaticSpawn (PClassActor *type, fixed_t _ix, fixed_t _iy, fixed_
|
|||
{
|
||||
actor->Floorclip = 0;
|
||||
}
|
||||
actor->UpdateWaterLevel (actor->_f_Z(), false);
|
||||
actor->UpdateWaterLevel (actor->Z(), false);
|
||||
if (!SpawningMapThing)
|
||||
{
|
||||
actor->BeginPlay ();
|
||||
|
@ -4311,20 +4308,10 @@ AActor *AActor::StaticSpawn (PClassActor *type, fixed_t _ix, fixed_t _iy, fixed_
|
|||
return actor;
|
||||
}
|
||||
|
||||
AActor *Spawn (const char *type, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement)
|
||||
PClassActor *ClassForSpawn(FName classname)
|
||||
{
|
||||
FName classname(type, true);
|
||||
if (classname == NAME_None)
|
||||
{
|
||||
I_Error("Attempt to spawn actor of unknown type '%s'\n", type);
|
||||
}
|
||||
return Spawn(classname, x, y, z, allowreplacement);
|
||||
}
|
||||
|
||||
AActor *Spawn (FName classname, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement)
|
||||
{
|
||||
const PClass *cls = PClass::FindClass(classname);
|
||||
if (cls == NULL)
|
||||
PClass *cls = PClass::FindClass(classname);
|
||||
if (cls == NULL)
|
||||
{
|
||||
I_Error("Attempt to spawn actor of unknown type '%s'\n", classname.GetChars());
|
||||
}
|
||||
|
@ -4332,7 +4319,7 @@ AActor *Spawn (FName classname, fixed_t x, fixed_t y, fixed_t z, replace_t allow
|
|||
{
|
||||
I_Error("Attempt to spawn non-actor of type '%s'\n", classname.GetChars());
|
||||
}
|
||||
return AActor::StaticSpawn (const_cast<PClassActor *>(static_cast<const PClassActor *>(cls)), x, y, z, allowreplacement);
|
||||
return static_cast<PClassActor*>(cls);
|
||||
}
|
||||
|
||||
void AActor::LevelSpawned ()
|
||||
|
@ -4571,7 +4558,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
|
|||
player_t *p;
|
||||
APlayerPawn *mobj, *oldactor;
|
||||
BYTE state;
|
||||
fixed_t spawn_x, spawn_y, spawn_z;
|
||||
DVector3 spawn;
|
||||
DAngle SpawnAngle;
|
||||
|
||||
if (mthing == NULL)
|
||||
|
@ -4627,16 +4614,13 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
|
|||
( NULL != p->attacker ) && // don't respawn on damaging floors
|
||||
( p->mo->Sector->damageamount < TELEFRAG_DAMAGE )) // this really should be a bit smarter...
|
||||
{
|
||||
spawn_x = p->mo->_f_X();
|
||||
spawn_y = p->mo->_f_Y();
|
||||
spawn_z = p->mo->_f_Z();
|
||||
|
||||
spawn = p->mo->Pos();
|
||||
SpawnAngle = p->mo->Angles.Yaw;
|
||||
}
|
||||
else
|
||||
{
|
||||
spawn_x = mthing->_f_X();
|
||||
spawn_y = mthing->_f_Y();
|
||||
spawn.X = mthing->pos.X;
|
||||
spawn.Y = mthing->pos.Y;
|
||||
|
||||
// Allow full angular precision
|
||||
SpawnAngle = (double)mthing->angle;
|
||||
|
@ -4646,21 +4630,21 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
|
|||
}
|
||||
|
||||
if (GetDefaultByType(p->cls)->flags & MF_SPAWNCEILING)
|
||||
spawn_z = ONCEILINGZ;
|
||||
spawn.Z = ONCEILINGZ;
|
||||
else if (GetDefaultByType(p->cls)->flags2 & MF2_SPAWNFLOAT)
|
||||
spawn_z = FLOATRANDZ;
|
||||
spawn.Z = FLOATRANDZ;
|
||||
else
|
||||
spawn_z = ONFLOORZ;
|
||||
spawn.Z = ONFLOORZ;
|
||||
}
|
||||
|
||||
mobj = static_cast<APlayerPawn *>
|
||||
(Spawn (p->cls, spawn_x, spawn_y, spawn_z, NO_REPLACE));
|
||||
(Spawn (p->cls, spawn, NO_REPLACE));
|
||||
|
||||
if (level.flags & LEVEL_USEPLAYERSTARTZ)
|
||||
{
|
||||
if (spawn_z == ONFLOORZ)
|
||||
if (spawn.Z == ONFLOORZ)
|
||||
mobj->AddZ(mthing->pos.Z);
|
||||
else if (spawn_z == ONCEILINGZ)
|
||||
else if (spawn.Z == ONCEILINGZ)
|
||||
mobj->AddZ(-mthing->pos.Z);
|
||||
P_FindFloorCeiling(mobj, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT);
|
||||
}
|
||||
|
@ -4781,7 +4765,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
|
|||
|
||||
if (multiplayer)
|
||||
{
|
||||
Spawn ("TeleportFog", mobj->Vec3Angle(20, mobj->Angles.Yaw, TELEFOGHEIGHT), ALLOW_REPLACE);
|
||||
Spawn ("TeleportFog", mobj->Vec3Angle(20., mobj->Angles.Yaw, TELEFOGHEIGHT), ALLOW_REPLACE);
|
||||
}
|
||||
|
||||
// "Fix" for one of the starts on exec.wad MAP01: If you start inside the ceiling,
|
||||
|
@ -5115,7 +5099,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
|
|||
else
|
||||
z = ONFLOORZ;
|
||||
|
||||
mobj = AActor::StaticSpawn (i, x, y, z, NO_REPLACE, true);
|
||||
mobj = AActor::StaticSpawn (i, DVector3(FIXED2DBL(mthing->x), FIXED2DBL(mthing->y), z), NO_REPLACE, true);
|
||||
|
||||
if (z == ONFLOORZ)
|
||||
{
|
||||
|
@ -5222,7 +5206,8 @@ AActor *P_SpawnPuff (AActor *source, PClassActor *pufftype, fixed_t x, fixed_t y
|
|||
if (!(flags & PF_NORANDOMZ))
|
||||
z += pr_spawnpuff.Random2 () << 10;
|
||||
|
||||
puff = Spawn (pufftype, x, y, z, ALLOW_REPLACE);
|
||||
DVector3 pos(FIXED2DBL(x), FIXED2DBL(y), FIXED2DBL(z));
|
||||
puff = Spawn (pufftype, pos, ALLOW_REPLACE);
|
||||
if (puff == NULL) return NULL;
|
||||
|
||||
if ((puff->flags4 & MF4_RANDOMIZE) && puff->tics > 0)
|
||||
|
@ -5296,6 +5281,7 @@ 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)
|
||||
{
|
||||
DVector3 pos(FIXED2DBL(x), FIXED2DBL(y), FIXED2DBL(z));
|
||||
AActor *th;
|
||||
PalEntry bloodcolor = originator->GetBloodColor();
|
||||
PClassActor *bloodcls = originator->GetBloodType();
|
||||
|
@ -5308,7 +5294,7 @@ 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, x, y, z, NO_REPLACE); // GetBloodType already performed the replacement
|
||||
th = Spawn (bloodcls, pos, 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
|
||||
|
@ -5389,8 +5375,9 @@ 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 (fixedvec3 _pos, AActor *originator)
|
||||
{
|
||||
DVector3 pos(FIXED2DBL(_pos.x), FIXED2DBL(_pos.y), FIXED2DBL(_pos.z));
|
||||
PalEntry bloodcolor = originator->GetBloodColor();
|
||||
PClassActor *bloodcls = originator->GetBloodType(1);
|
||||
|
||||
|
@ -5419,7 +5406,7 @@ void P_BloodSplatter (fixedvec3 pos, AActor *originator)
|
|||
}
|
||||
if (bloodtype >= 1)
|
||||
{
|
||||
P_DrawSplash2 (40, pos.x, pos.y, pos.z, 0u - originator->__f_AngleTo(pos), 2, bloodcolor);
|
||||
//P_DrawSplash2 (40, pos.X, pos.Y, pos.Z, -originator->AngleTo(pos), 2, bloodcolor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5429,8 +5416,9 @@ void P_BloodSplatter (fixedvec3 pos, AActor *originator)
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
void P_BloodSplatter2 (fixedvec3 pos, AActor *originator)
|
||||
void P_BloodSplatter2 (fixedvec3 _pos, AActor *originator)
|
||||
{
|
||||
DVector3 pos(FIXED2DBL(_pos.x), FIXED2DBL(_pos.y), FIXED2DBL(_pos.z));
|
||||
PalEntry bloodcolor = originator->GetBloodColor();
|
||||
PClassActor *bloodcls = originator->GetBloodType(2);
|
||||
|
||||
|
@ -5443,8 +5431,8 @@ void P_BloodSplatter2 (fixedvec3 pos, AActor *originator)
|
|||
{
|
||||
AActor *mo;
|
||||
|
||||
pos.x += ((pr_splat()-128)<<11);
|
||||
pos.y += ((pr_splat()-128)<<11);
|
||||
pos.X += (pr_splat()-128) / 32.;
|
||||
pos.Y += (pr_splat()-128) / 32.;
|
||||
|
||||
mo = Spawn (bloodcls, pos, NO_REPLACE); // GetBloodType already performed the replacement
|
||||
mo->target = originator;
|
||||
|
@ -5459,7 +5447,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 (100, pos.x, pos.y, pos.z, 0u - originator->__f_AngleTo(pos), 2, bloodcolor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5474,10 +5462,10 @@ void P_RipperBlood (AActor *mo, AActor *bleeder)
|
|||
PalEntry bloodcolor = bleeder->GetBloodColor();
|
||||
PClassActor *bloodcls = bleeder->GetBloodType();
|
||||
|
||||
fixed_t xo = (pr_ripperblood.Random2() << 12);
|
||||
fixed_t yo = (pr_ripperblood.Random2() << 12);
|
||||
fixed_t zo = (pr_ripperblood.Random2() << 12);
|
||||
fixedvec3 pos = mo->Vec3Offset(xo, yo, zo);
|
||||
double xo = pr_ripperblood.Random2() / 16.;
|
||||
double yo = pr_ripperblood.Random2() / 16.;
|
||||
double zo = pr_ripperblood.Random2() / 16.;
|
||||
DVector3 pos = mo->Vec3Offset(xo, yo, zo);
|
||||
|
||||
int bloodtype = cl_bloodtype;
|
||||
|
||||
|
@ -5506,7 +5494,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.X, pos.Y, pos.Z, 0, 0, bloodcolor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5562,6 +5550,7 @@ bool P_HitWater (AActor * thing, sector_t * sec, fixed_t x, fixed_t y, fixed_t z
|
|||
if (z > compare_z)
|
||||
return false;
|
||||
}
|
||||
DVector3 pos(FIXED2DBL(x), FIXED2DBL(y), FIXED2DBL(z));
|
||||
|
||||
#if 0 // needs some rethinking before activation
|
||||
|
||||
|
@ -5633,14 +5622,14 @@ foundone:
|
|||
|
||||
if (smallsplash && splash->SmallSplash)
|
||||
{
|
||||
mo = Spawn (splash->SmallSplash, x, y, z, ALLOW_REPLACE);
|
||||
mo = Spawn (splash->SmallSplash, pos, ALLOW_REPLACE);
|
||||
if (mo) mo->Floorclip += FIXED2DBL(splash->SmallSplashClip);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (splash->SplashChunk)
|
||||
{
|
||||
mo = Spawn (splash->SplashChunk, x, y, z, ALLOW_REPLACE);
|
||||
mo = Spawn (splash->SplashChunk, pos, ALLOW_REPLACE);
|
||||
mo->target = thing;
|
||||
if (splash->ChunkXVelShift != 255)
|
||||
{
|
||||
|
@ -5654,7 +5643,7 @@ foundone:
|
|||
}
|
||||
if (splash->SplashBase)
|
||||
{
|
||||
mo = Spawn (splash->SplashBase, x, y, z, ALLOW_REPLACE);
|
||||
mo = Spawn (splash->SplashBase, pos, ALLOW_REPLACE);
|
||||
}
|
||||
if (thing->player && !splash->NoAlert && alert)
|
||||
{
|
||||
|
@ -5928,7 +5917,8 @@ AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z,
|
|||
z -= source->_f_floorclip();
|
||||
}
|
||||
|
||||
AActor *th = Spawn (type, x, y, z, ALLOW_REPLACE);
|
||||
DVector3 pos(FIXED2DBL(x), FIXED2DBL(y), FIXED2DBL(z));
|
||||
AActor *th = Spawn (type, pos, ALLOW_REPLACE);
|
||||
|
||||
P_PlaySpawnSound(th, source);
|
||||
|
||||
|
@ -5988,7 +5978,7 @@ AActor *P_OldSpawnMissile(AActor *source, AActor *owner, AActor *dest, PClassAct
|
|||
{
|
||||
return NULL;
|
||||
}
|
||||
AActor *th = Spawn (type, source->PosPlusZ(4*8*FRACUNIT), ALLOW_REPLACE);
|
||||
AActor *th = Spawn (type, source->PosPlusZ(32.), ALLOW_REPLACE);
|
||||
|
||||
P_PlaySpawnSound(th, source);
|
||||
th->target = owner; // record missile's originator
|
||||
|
@ -6094,7 +6084,7 @@ AActor *P_SpawnMissileAngleZSpeed (AActor *source, fixed_t z,
|
|||
z -= source->_f_floorclip();
|
||||
}
|
||||
|
||||
mo = Spawn (type, source->_f_X(), source->_f_Y(), z, ALLOW_REPLACE);
|
||||
mo = Spawn (type, source->PosAtZ(FIXED2FLOAT(z)), ALLOW_REPLACE);
|
||||
|
||||
P_PlaySpawnSound(mo, source);
|
||||
if (owner == NULL) owner = source;
|
||||
|
|
|
@ -3609,7 +3609,7 @@ void P_SetupLevel (const char *lumpname, int position)
|
|||
translationtables[TRANSLATION_LevelScripted].Clear();
|
||||
|
||||
// Initial height of PointOfView will be set by player think.
|
||||
players[consoleplayer].viewz = -FLT_MAX;
|
||||
players[consoleplayer].viewz = NO_VALUE;
|
||||
|
||||
// Make sure all sounds are stopped before Z_FreeTags.
|
||||
S_Start ();
|
||||
|
|
|
@ -1036,22 +1036,19 @@ void P_SpawnPortal(line_t *line, int sectortag, int plane, int alpha, int linked
|
|||
lines[i].args[3] == 1)
|
||||
{
|
||||
// beware of overflows.
|
||||
fixed_t x1 = fixed_t((SQWORD(line->v1->x) + SQWORD(line->v2->x)) >> 1);
|
||||
fixed_t y1 = fixed_t((SQWORD(line->v1->y) + SQWORD(line->v2->y)) >> 1);
|
||||
fixed_t x2 = fixed_t((SQWORD(lines[i].v1->x) + SQWORD(lines[i].v2->x)) >> 1);
|
||||
fixed_t y2 = fixed_t((SQWORD(lines[i].v1->y) + SQWORD(lines[i].v2->y)) >> 1);
|
||||
fixed_t z = linked ? line->frontsector->planes[plane].TexZ : 0; // the map's sector height defines the portal plane for linked portals
|
||||
DVector3 pos1((line->v1->fX() + line->v2->fX()) / 2, (line->v1->fY() + line->v2->fY()) / 2, 0);
|
||||
DVector3 pos2((lines[i].v1->fX() + lines[i].v2->fX()) / 2, (lines[i].v1->fY() + lines[i].v2->fY()) / 2, 0);
|
||||
double z = linked ? line->frontsector->GetPlaneTexZF(plane) : 0; // the map's sector height defines the portal plane for linked portals
|
||||
|
||||
fixed_t alpha = Scale (lines[i].args[4], OPAQUE, 255);
|
||||
|
||||
AStackPoint *anchor = Spawn<AStackPoint>(x1, y1, 0, NO_REPLACE);
|
||||
AStackPoint *reference = Spawn<AStackPoint>(x2, y2, 0, NO_REPLACE);
|
||||
AStackPoint *anchor = Spawn<AStackPoint>(pos1, NO_REPLACE);
|
||||
AStackPoint *reference = Spawn<AStackPoint>(pos2, NO_REPLACE);
|
||||
reference->special1 = linked ? SKYBOX_LINKEDPORTAL : SKYBOX_PORTAL;
|
||||
anchor->special1 = SKYBOX_ANCHOR;
|
||||
// store the portal displacement in the unused scaleX/Y members of the portal reference actor.
|
||||
anchor->Scale.X = -(reference->Scale.X = FIXED2DBL(x2 - x1));
|
||||
anchor->Scale.Y = -(reference->Scale.Y = FIXED2DBL(y2 - y1));
|
||||
anchor->specialf1 = reference->specialf1 = FIXED2FLOAT(z);
|
||||
anchor->Scale = -(reference->Scale = pos2 - pos1);
|
||||
anchor->specialf1 = reference->specialf1 = z;
|
||||
|
||||
reference->Mate = anchor;
|
||||
anchor->Mate = reference;
|
||||
|
|
19
src/p_spec.h
19
src/p_spec.h
|
@ -924,19 +924,18 @@ enum
|
|||
TELF_KEEPHEIGHT = 16,
|
||||
};
|
||||
|
||||
void P_SpawnTeleportFog(AActor *mobj, fixed_t x, fixed_t y, fixed_t z, bool beforeTele = true, bool setTarget = false); //Spawns teleport fog. Pass the actor to pluck TeleFogFromType and TeleFogToType. 'from' determines if this is the fog to spawn at the old position (true) or new (false).
|
||||
inline void P_SpawnTeleportFog(AActor *mobj, const fixedvec3 &pos, bool beforeTele = true, bool setTarget = false)
|
||||
{
|
||||
P_SpawnTeleportFog(mobj, pos.x, pos.y, pos.z, beforeTele, setTarget);
|
||||
}
|
||||
inline void P_SpawnTeleportFog(AActor *mobj, const DVector3 &pos, bool beforeTele = true, bool setTarget = false)
|
||||
{
|
||||
P_SpawnTeleportFog(mobj, FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), FLOAT2FIXED(pos.Z), beforeTele, setTarget);
|
||||
}
|
||||
inline void P_SpawnTeleportFog(AActor *mobj, double x, double y, double z, bool beforeTele = true, bool setTarget = false)
|
||||
//Spawns teleport fog. Pass the actor to pluck TeleFogFromType and TeleFogToType. 'from' determines if this is the fog to spawn at the old position (true) or new (false).
|
||||
void P_SpawnTeleportFog(AActor *mobj, const DVector3 &pos, bool beforeTele = true, bool setTarget = false);
|
||||
|
||||
void P_SpawnTeleportFog(AActor *mobj, fixed_t x, fixed_t y, fixed_t z, bool beforeTele = true, bool setTarget = false) = delete;
|
||||
inline void P_SpawnTeleportFog(AActor *mobj, const fixedvec3 &pos, bool beforeTele = true, bool setTarget = false) = delete;
|
||||
inline void P_SpawnTeleportFog(AActor *mobj, double x, double y, double z, bool beforeTele = true, bool setTarget = false) = delete;
|
||||
/*
|
||||
{
|
||||
P_SpawnTeleportFog(mobj, FLOAT2FIXED(x), FLOAT2FIXED(y), FLOAT2FIXED(z), beforeTele, setTarget);
|
||||
}
|
||||
*/
|
||||
|
||||
bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, DAngle angle, int flags); // bool useFog, bool sourceFog, bool keepOrientation, bool haltVelocity = true, bool keepHeight = false
|
||||
inline bool P_Teleport(AActor *thing, const DVector3 &pos, DAngle angle, int flags)
|
||||
{
|
||||
|
|
|
@ -78,7 +78,7 @@ void ATeleportFog::PostBeginPlay ()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void P_SpawnTeleportFog(AActor *mobj, fixed_t x, fixed_t y, fixed_t z, bool beforeTele, bool setTarget)
|
||||
void P_SpawnTeleportFog(AActor *mobj, const DVector3 &pos, bool beforeTele, bool setTarget)
|
||||
{
|
||||
AActor *mo;
|
||||
if ((beforeTele ? mobj->TeleFogSourceType : mobj->TeleFogDestType) == NULL)
|
||||
|
@ -88,7 +88,7 @@ void P_SpawnTeleportFog(AActor *mobj, fixed_t x, fixed_t y, fixed_t z, bool befo
|
|||
}
|
||||
else
|
||||
{
|
||||
mo = Spawn((beforeTele ? mobj->TeleFogSourceType : mobj->TeleFogDestType), x, y, z, ALLOW_REPLACE);
|
||||
mo = Spawn((beforeTele ? mobj->TeleFogSourceType : mobj->TeleFogDestType), pos, ALLOW_REPLACE);
|
||||
}
|
||||
|
||||
if (mo != NULL && setTarget)
|
||||
|
@ -103,7 +103,7 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, DAngle angle, i
|
|||
{
|
||||
bool predicting = (thing->player && (thing->player->cheats & CF_PREDICTING));
|
||||
|
||||
fixedvec3 old;
|
||||
DVector3 old;
|
||||
fixed_t aboveFloor;
|
||||
player_t *player;
|
||||
sector_t *destsect;
|
||||
|
@ -111,7 +111,7 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, DAngle angle, i
|
|||
fixed_t floorheight, ceilingheight;
|
||||
double missilespeed = 0;
|
||||
|
||||
old = thing->_f_Pos();
|
||||
old = thing->Pos();
|
||||
aboveFloor = thing->_f_Z() - thing->_f_floorz();
|
||||
destsect = P_PointInSector (x, y);
|
||||
// killough 5/12/98: exclude voodoo dolls:
|
||||
|
@ -194,7 +194,7 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, DAngle angle, i
|
|||
double fogDelta = thing->flags & MF_MISSILE ? 0 : TELEFOGHEIGHT;
|
||||
DVector2 vector = angle.ToVector(20);
|
||||
DVector2 fogpos = P_GetOffsetPosition(FIXED2DBL(x), FIXED2DBL(y), vector.X, vector.Y);
|
||||
P_SpawnTeleportFog(thing, fogpos.X, fogpos.Y, thing->Z() + fogDelta, false, true);
|
||||
P_SpawnTeleportFog(thing, DVector3(fogpos, thing->Z() + fogDelta), false, true);
|
||||
|
||||
}
|
||||
if (thing->player)
|
||||
|
|
|
@ -125,19 +125,16 @@ bool P_Thing_Spawn (int tid, AActor *source, int type, DAngle angle, bool fog, i
|
|||
|
||||
bool P_MoveThing(AActor *source, fixed_t x, fixed_t y, fixed_t z, bool fog)
|
||||
{
|
||||
fixed_t oldx, oldy, oldz;
|
||||
DVector3 pos(FIXED2DBL(x), FIXED2DBL(y), FIXED2DBL(z));
|
||||
DVector3 old = source->Pos();
|
||||
|
||||
oldx = source->_f_X();
|
||||
oldy = source->_f_Y();
|
||||
oldz = source->_f_Z();
|
||||
|
||||
source->SetOrigin (x, y, z, true);
|
||||
source->SetOrigin (pos, true);
|
||||
if (P_TestMobjLocation (source))
|
||||
{
|
||||
if (fog)
|
||||
{
|
||||
P_SpawnTeleportFog(source, x, y, z, false, true);
|
||||
P_SpawnTeleportFog(source, oldx, oldy, oldz, true, true);
|
||||
P_SpawnTeleportFog(source, pos, false, true);
|
||||
P_SpawnTeleportFog(source, old, true, true);
|
||||
}
|
||||
source->ClearInterpolation();
|
||||
if (source == players[consoleplayer].camera)
|
||||
|
@ -148,7 +145,7 @@ bool P_MoveThing(AActor *source, fixed_t x, fixed_t y, fixed_t z, bool fog)
|
|||
}
|
||||
else
|
||||
{
|
||||
source->SetOrigin (oldx, oldy, oldz, true);
|
||||
source->SetOrigin (old, true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -221,7 +218,7 @@ bool P_Thing_Projectile (int tid, AActor *source, int type, const char *type_nam
|
|||
{
|
||||
do
|
||||
{
|
||||
fixed_t z = spot->_f_Z();
|
||||
double z = spot->Z();
|
||||
if (defflags3 & MF3_FLOORHUGGER)
|
||||
{
|
||||
z = ONFLOORZ;
|
||||
|
@ -232,9 +229,9 @@ bool P_Thing_Projectile (int tid, AActor *source, int type, const char *type_nam
|
|||
}
|
||||
else if (z != ONFLOORZ)
|
||||
{
|
||||
z -= spot->_f_floorclip();
|
||||
z -= spot->Floorclip;
|
||||
}
|
||||
mobj = Spawn (kind, spot->_f_X(), spot->_f_Y(), z, ALLOW_REPLACE);
|
||||
mobj = Spawn (kind, spot->PosAtZ(z), ALLOW_REPLACE);
|
||||
|
||||
if (mobj)
|
||||
{
|
||||
|
|
|
@ -57,7 +57,7 @@ bool P_CheckTickerPaused ()
|
|||
ConsoleState == c_down || ConsoleState == c_falling)
|
||||
&& !demoplayback
|
||||
&& !demorecording
|
||||
&& players[consoleplayer].viewz != -FLT_MAX
|
||||
&& players[consoleplayer].viewz != NO_VALUE
|
||||
&& wipegamestate == gamestate)
|
||||
{
|
||||
S_PauseSound (!(level.flags2 & LEVEL2_PAUSE_MUSIC_IN_MENUS), false);
|
||||
|
|
|
@ -1650,7 +1650,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SkullPop)
|
|||
}
|
||||
|
||||
self->flags &= ~MF_SOLID;
|
||||
mo = (APlayerPawn *)Spawn (spawntype, self->PosPlusZ(48*FRACUNIT), NO_REPLACE);
|
||||
mo = (APlayerPawn *)Spawn (spawntype, self->PosPlusZ(48.), NO_REPLACE);
|
||||
//mo->target = self;
|
||||
mo->Vel.X = pr_skullpop.Random2() / 128.;
|
||||
mo->Vel.Y = pr_skullpop.Random2() / 128.;
|
||||
|
|
|
@ -2638,7 +2638,7 @@ CCMD (loopsound)
|
|||
}
|
||||
else
|
||||
{
|
||||
AActor *icon = Spawn("SpeakerIcon", players[consoleplayer].mo->PosPlusZ(32*FRACUNIT), ALLOW_REPLACE);
|
||||
AActor *icon = Spawn("SpeakerIcon", players[consoleplayer].mo->PosPlusZ(32.), ALLOW_REPLACE);
|
||||
if (icon != NULL)
|
||||
{
|
||||
S_Sound(icon, CHAN_BODY | CHAN_LOOP, id, 1.f, ATTN_IDLE);
|
||||
|
|
|
@ -616,7 +616,7 @@ static void DoAttack (AActor *self, bool domelee, bool domissile,
|
|||
// This seemingly senseless code is needed for proper aiming.
|
||||
double add = MissileHeight + FIXED2FLOAT(self->GetBobOffset()) - 32;
|
||||
self->AddZ(add);
|
||||
AActor *missile = P_SpawnMissileXYZ (self->PosPlusZ(32*FRACUNIT), self, self->target, MissileType, false);
|
||||
AActor *missile = P_SpawnMissileXYZ (self->PosPlusZ(32.), self, self->target, MissileType, false);
|
||||
self->AddZ(-add);
|
||||
|
||||
if (missile)
|
||||
|
@ -1227,7 +1227,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile)
|
|||
default:
|
||||
// same adjustment as above (in all 3 directions this time) - for better aiming!
|
||||
self->SetXYZ(self->Vec3Offset(x, y, z));
|
||||
missile = P_SpawnMissileXYZ(self->PosPlusZ(32*FRACUNIT), self, ref, ti, false);
|
||||
missile = P_SpawnMissileXYZ(self->PosPlusZ(32.), self, ref, ti, false);
|
||||
self->SetXYZ(pos);
|
||||
break;
|
||||
|
||||
|
@ -1467,7 +1467,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomComboAttack)
|
|||
{
|
||||
// This seemingly senseless code is needed for proper aiming.
|
||||
self->_f_AddZ(spawnheight + self->GetBobOffset() - 32*FRACUNIT);
|
||||
AActor *missile = P_SpawnMissileXYZ (self->PosPlusZ(32*FRACUNIT), self, self->target, ti, false);
|
||||
AActor *missile = P_SpawnMissileXYZ (self->PosPlusZ(32.), self, self->target, ti, false);
|
||||
self->_f_AddZ(-(spawnheight + self->GetBobOffset() - 32*FRACUNIT));
|
||||
|
||||
if (missile)
|
||||
|
@ -2378,7 +2378,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItem)
|
|||
PARAM_ACTION_PROLOGUE;
|
||||
PARAM_CLASS_OPT (missile, AActor) { missile = PClass::FindActor("Unknown"); }
|
||||
PARAM_FIXED_OPT (distance) { distance = 0; }
|
||||
PARAM_FIXED_OPT (zheight) { zheight = 0; }
|
||||
PARAM_FLOAT_OPT (zheight) { zheight = 0; }
|
||||
PARAM_BOOL_OPT (useammo) { useammo = true; }
|
||||
PARAM_BOOL_OPT (transfer_translation) { transfer_translation = false; }
|
||||
|
||||
|
@ -2414,7 +2414,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItem)
|
|||
}
|
||||
}
|
||||
|
||||
AActor *mo = Spawn( missile, self->_f_Vec3Angle(distance, self->_f_angle(), -self->_f_floorclip() + self->GetBobOffset() + zheight), ALLOW_REPLACE);
|
||||
AActor *mo = Spawn( missile, self->Vec3Angle(distance, self->Angles.Yaw, -self->Floorclip + self->GetBobOffset() + zheight), ALLOW_REPLACE);
|
||||
|
||||
int flags = (transfer_translation ? SIXF_TRANSFERTRANSLATION : 0) + (useammo ? SIXF_SETMASTER : 0);
|
||||
ACTION_RETURN_BOOL(InitSpawnedItem(self, mo, flags)); // for an inventory item's use state
|
||||
|
@ -2431,9 +2431,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItemEx)
|
|||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
PARAM_CLASS (missile, AActor);
|
||||
PARAM_FIXED_OPT (xofs) { xofs = 0; }
|
||||
PARAM_FIXED_OPT (yofs) { yofs = 0; }
|
||||
PARAM_FIXED_OPT (zofs) { zofs = 0; }
|
||||
PARAM_FLOAT_OPT (xofs) { xofs = 0; }
|
||||
PARAM_FLOAT_OPT (yofs) { yofs = 0; }
|
||||
PARAM_FLOAT_OPT (zofs) { zofs = 0; }
|
||||
PARAM_FLOAT_OPT (xvel) { xvel = 0; }
|
||||
PARAM_FLOAT_OPT (yvel) { yvel = 0; }
|
||||
PARAM_FLOAT_OPT (zvel) { zvel = 0; }
|
||||
|
@ -2456,7 +2456,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItemEx)
|
|||
ACTION_RETURN_BOOL(true);
|
||||
}
|
||||
|
||||
fixedvec2 pos;
|
||||
DVector2 pos;
|
||||
|
||||
if (!(flags & SIXF_ABSOLUTEANGLE))
|
||||
{
|
||||
|
@ -2473,7 +2473,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItemEx)
|
|||
{
|
||||
// in relative mode negative y values mean 'left' and positive ones mean 'right'
|
||||
// This is the inverse orientation of the absolute mode!
|
||||
pos = self->Vec2Offset(fixed_t(xofs * c + yofs * s), fixed_t(xofs * s - yofs*c));
|
||||
pos = self->Vec2Offset(xofs * c + yofs * s, xofs * s - yofs*c);
|
||||
}
|
||||
|
||||
if (!(flags & SIXF_ABSOLUTEVELOCITY))
|
||||
|
@ -2484,7 +2484,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItemEx)
|
|||
xvel = newxvel;
|
||||
}
|
||||
|
||||
AActor *mo = Spawn(missile, pos.x, pos.y, self->_f_Z() - self->_f_floorclip() + self->GetBobOffset() + zofs, ALLOW_REPLACE);
|
||||
AActor *mo = Spawn(missile, DVector3(pos, self->Z() - self->Floorclip + self->GetBobOffset() + zofs), ALLOW_REPLACE);
|
||||
bool res = InitSpawnedItem(self, mo, flags);
|
||||
if (res)
|
||||
{
|
||||
|
@ -2542,7 +2542,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ThrowGrenade)
|
|||
AActor *bo;
|
||||
|
||||
bo = Spawn(missile,
|
||||
self->PosPlusZ(-self->_f_floorclip() + self->GetBobOffset() + zheight + 35*FRACUNIT + (self->player? FLOAT2FIXED(self->player->crouchoffset) : 0)),
|
||||
self->PosPlusZ(-self->Floorclip + self->GetBobOffset() + zheight + 35 + (self->player? self->player->crouchoffset : 0.)),
|
||||
ALLOW_REPLACE);
|
||||
if (bo)
|
||||
{
|
||||
|
@ -2936,9 +2936,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnDebris)
|
|||
|
||||
for (i = 0; i < GetDefaultByType(debris)->health; i++)
|
||||
{
|
||||
fixed_t xo = ((pr_spawndebris() - 128) << 12);
|
||||
fixed_t yo = ((pr_spawndebris() - 128) << 12);
|
||||
fixed_t zo = (pr_spawndebris()*self->_f_height() / 256 + self->GetBobOffset());
|
||||
double xo = (pr_spawndebris() - 128) / 16.;
|
||||
double yo = (pr_spawndebris() - 128) / 16.;
|
||||
double zo = pr_spawndebris()*self->Height / 256 + self->GetBobOffset();
|
||||
mo = Spawn(debris, self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
|
||||
if (mo)
|
||||
{
|
||||
|
@ -3435,7 +3435,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Respawn)
|
|||
PARAM_INT_OPT(flags) { flags = RSF_FOG; }
|
||||
|
||||
bool oktorespawn = false;
|
||||
fixedvec3 pos = self->_f_Pos();
|
||||
DVector3 pos = self->Pos();
|
||||
|
||||
self->flags |= MF_SOLID;
|
||||
self->Height = self->GetDefault()->Height;
|
||||
|
@ -3445,11 +3445,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Respawn)
|
|||
if (flags & RSF_TELEFRAG)
|
||||
{
|
||||
// [KS] DIE DIE DIE DIE erm *ahem* =)
|
||||
oktorespawn = P_TeleportMove(self, self->_f_Pos(), true, false);
|
||||
oktorespawn = P_TeleportMove(self, self->Pos(), true, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
oktorespawn = P_CheckPosition(self, self->_f_X(), self->_f_Y(), true);
|
||||
oktorespawn = P_CheckPosition(self, self->Pos(), true);
|
||||
}
|
||||
|
||||
if (oktorespawn)
|
||||
|
@ -3487,7 +3487,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Respawn)
|
|||
if (flags & RSF_FOG)
|
||||
{
|
||||
P_SpawnTeleportFog(self, pos, true, true);
|
||||
P_SpawnTeleportFog(self, self->_f_Pos(), false, true);
|
||||
P_SpawnTeleportFog(self, self->Pos(), false, true);
|
||||
}
|
||||
if (self->CountsAsKill())
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue