mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-26 21:20:57 +00:00
- floatified some stuff in g_shared.
Note: This commit does not handle z-spawn positions correctly.
This commit is contained in:
parent
301f5abadc
commit
2a0d5a621a
7 changed files with 79 additions and 105 deletions
|
@ -1190,7 +1190,7 @@ public:
|
||||||
// no matter what (even if shot)
|
// no matter what (even if shot)
|
||||||
player_t *player; // only valid if type of APlayerPawn
|
player_t *player; // only valid if type of APlayerPawn
|
||||||
TObjPtr<AActor> LastLookActor; // Actor last looked for (if TIDtoHate != 0)
|
TObjPtr<AActor> LastLookActor; // Actor last looked for (if TIDtoHate != 0)
|
||||||
fixed_t SpawnPoint[3]; // For nightmare respawn
|
DVector3 SpawnPoint; // For nightmare respawn
|
||||||
WORD SpawnAngle;
|
WORD SpawnAngle;
|
||||||
int StartHealth;
|
int StartHealth;
|
||||||
BYTE WeaveIndexXY; // Separated from special2 because it's used by globally accessible functions.
|
BYTE WeaveIndexXY; // Separated from special2 because it's used by globally accessible functions.
|
||||||
|
@ -1341,6 +1341,10 @@ public:
|
||||||
int GetTics(FState * newstate);
|
int GetTics(FState * newstate);
|
||||||
bool SetState (FState *newstate, bool nofunction=false);
|
bool SetState (FState *newstate, bool nofunction=false);
|
||||||
virtual bool UpdateWaterLevel (fixed_t oldz, bool splash=true);
|
virtual bool UpdateWaterLevel (fixed_t oldz, bool splash=true);
|
||||||
|
bool UpdateWaterLevel(double oldz, bool splash = true)
|
||||||
|
{
|
||||||
|
return UpdateWaterLevel(FLOAT2FIXED(oldz), splash);
|
||||||
|
}
|
||||||
bool isFast();
|
bool isFast();
|
||||||
bool isSlow();
|
bool isSlow();
|
||||||
void SetIdle(bool nofunction=false);
|
void SetIdle(bool nofunction=false);
|
||||||
|
|
|
@ -22,13 +22,11 @@ IMPLEMENT_CLASS(AFastProjectile)
|
||||||
void AFastProjectile::Tick ()
|
void AFastProjectile::Tick ()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
fixed_t xfrac;
|
DVector3 frac;
|
||||||
fixed_t yfrac;
|
|
||||||
fixed_t zfrac;
|
|
||||||
int changexy;
|
int changexy;
|
||||||
|
|
||||||
ClearInterpolation();
|
ClearInterpolation();
|
||||||
fixed_t oldz = _f_Z();
|
double oldz = Z();
|
||||||
|
|
||||||
if (!(flags5 & MF5_NOTIMEFREEZE))
|
if (!(flags5 & MF5_NOTIMEFREEZE))
|
||||||
{
|
{
|
||||||
|
@ -43,26 +41,22 @@ void AFastProjectile::Tick ()
|
||||||
// [RH] Ripping is a little different than it was in Hexen
|
// [RH] Ripping is a little different than it was in Hexen
|
||||||
FCheckPosition tm(!!(flags2 & MF2_RIP));
|
FCheckPosition tm(!!(flags2 & MF2_RIP));
|
||||||
|
|
||||||
int shift = 3;
|
|
||||||
int count = 8;
|
int count = 8;
|
||||||
if (_f_radius() > 0)
|
if (radius > 0)
|
||||||
{
|
{
|
||||||
while ( ((abs(_f_velx()) >> shift) > _f_radius()) || ((abs(_f_vely()) >> shift) > _f_radius()))
|
while ( fabs(Vel.X) > radius * count || fabs(Vel.Y) > radius * count)
|
||||||
{
|
{
|
||||||
// we need to take smaller steps.
|
// we need to take smaller steps.
|
||||||
shift++;
|
count += count;
|
||||||
count<<=1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle movement
|
// Handle movement
|
||||||
if (!Vel.isZero() || (Z() != floorz))
|
if (!Vel.isZero() || (Z() != floorz))
|
||||||
{
|
{
|
||||||
xfrac = _f_velx() >> shift;
|
frac = Vel / count;
|
||||||
yfrac = _f_vely() >> shift;
|
changexy = frac.X != 0 || frac.Y != 0;
|
||||||
zfrac = _f_velz() >> shift;
|
int ripcount = count / 8;
|
||||||
changexy = xfrac || yfrac;
|
|
||||||
int ripcount = count >> 3;
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
if (changexy)
|
if (changexy)
|
||||||
|
@ -72,14 +66,14 @@ void AFastProjectile::Tick ()
|
||||||
tm.LastRipped.Clear(); // [RH] Do rip damage each step, like Hexen
|
tm.LastRipped.Clear(); // [RH] Do rip damage each step, like Hexen
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!P_TryMove (this, _f_X() + xfrac,_f_Y() + yfrac, true, NULL, tm))
|
if (!P_TryMove (this, X() + frac.X, Y() + frac.Y, true, NULL, tm))
|
||||||
{ // Blocked move
|
{ // Blocked move
|
||||||
if (!(flags3 & MF3_SKYEXPLODE))
|
if (!(flags3 & MF3_SKYEXPLODE))
|
||||||
{
|
{
|
||||||
if (tm.ceilingline &&
|
if (tm.ceilingline &&
|
||||||
tm.ceilingline->backsector &&
|
tm.ceilingline->backsector &&
|
||||||
tm.ceilingline->backsector->GetTexture(sector_t::ceiling) == skyflatnum &&
|
tm.ceilingline->backsector->GetTexture(sector_t::ceiling) == skyflatnum &&
|
||||||
_f_Z() >= tm.ceilingline->backsector->ceilingplane.ZatPoint(PosRelative(tm.ceilingline)))
|
Z() >= tm.ceilingline->backsector->ceilingplane.ZatPointF(PosRelative(tm.ceilingline)))
|
||||||
{
|
{
|
||||||
// Hack to prevent missiles exploding against the sky.
|
// Hack to prevent missiles exploding against the sky.
|
||||||
// Does not handle sky floors.
|
// Does not handle sky floors.
|
||||||
|
@ -98,10 +92,10 @@ void AFastProjectile::Tick ()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_f_AddZ(zfrac);
|
AddZ(frac.Z);
|
||||||
UpdateWaterLevel (oldz);
|
UpdateWaterLevel (oldz);
|
||||||
oldz = _f_Z();
|
oldz = Z();
|
||||||
if (Z() <= floorz)
|
if (oldz <= floorz)
|
||||||
{ // Hit the floor
|
{ // Hit the floor
|
||||||
|
|
||||||
if (floorpic == skyflatnum && !(flags3 & MF3_SKYEXPLODE))
|
if (floorpic == skyflatnum && !(flags3 & MF3_SKYEXPLODE))
|
||||||
|
|
|
@ -298,7 +298,7 @@ void APathFollower::Tick ()
|
||||||
if (CurrNode->args[2])
|
if (CurrNode->args[2])
|
||||||
{
|
{
|
||||||
HoldTime = level.time + CurrNode->args[2] * TICRATE / 8;
|
HoldTime = level.time + CurrNode->args[2] * TICRATE / 8;
|
||||||
SetXYZ(CurrNode->_f_X(), CurrNode->_f_Y(), CurrNode->_f_Z());
|
SetXYZ(CurrNode->Pos());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,37 +352,32 @@ void APathFollower::NewNode ()
|
||||||
|
|
||||||
bool APathFollower::Interpolate ()
|
bool APathFollower::Interpolate ()
|
||||||
{
|
{
|
||||||
fixed_t dx = 0, dy = 0, dz = 0;
|
DVector3 dpos(0, 0, 0);
|
||||||
|
|
||||||
if ((args[2] & 8) && Time > 0.f)
|
if ((args[2] & 8) && Time > 0.f)
|
||||||
{
|
{
|
||||||
dx = _f_X();
|
dpos = Pos();
|
||||||
dy = _f_Y();
|
|
||||||
dz = _f_Z();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CurrNode->Next==NULL) return false;
|
if (CurrNode->Next==NULL) return false;
|
||||||
|
|
||||||
UnlinkFromWorld ();
|
UnlinkFromWorld ();
|
||||||
fixed_t x, y, z;
|
DVector3 newpos;
|
||||||
if (args[2] & 1)
|
if (args[2] & 1)
|
||||||
{ // linear
|
{ // linear
|
||||||
x = FLOAT2FIXED(Lerp (FIXED2DBL(CurrNode->_f_X()), FIXED2DBL(CurrNode->Next->_f_X())));
|
newpos.X = Lerp(CurrNode->X(), CurrNode->Next->X());
|
||||||
y = FLOAT2FIXED(Lerp (FIXED2DBL(CurrNode->_f_Y()), FIXED2DBL(CurrNode->Next->_f_Y())));
|
newpos.Y = Lerp(CurrNode->Y(), CurrNode->Next->Y());
|
||||||
z = FLOAT2FIXED(Lerp (FIXED2DBL(CurrNode->_f_Z()), FIXED2DBL(CurrNode->Next->_f_Z())));
|
newpos.Z = Lerp(CurrNode->Z(), CurrNode->Next->Z());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // spline
|
{ // spline
|
||||||
if (CurrNode->Next->Next==NULL) return false;
|
if (CurrNode->Next->Next==NULL) return false;
|
||||||
|
|
||||||
x = FLOAT2FIXED(Splerp (FIXED2DBL(PrevNode->_f_X()), FIXED2DBL(CurrNode->_f_X()),
|
newpos.X = Splerp(PrevNode->X(), CurrNode->X(), CurrNode->Next->X(), CurrNode->Next->Next->X());
|
||||||
FIXED2DBL(CurrNode->Next->_f_X()), FIXED2DBL(CurrNode->Next->Next->_f_X())));
|
newpos.X = Splerp(PrevNode->Y(), CurrNode->Y(), CurrNode->Next->Y(), CurrNode->Next->Next->Y());
|
||||||
y = FLOAT2FIXED(Splerp (FIXED2DBL(PrevNode->_f_Y()), FIXED2DBL(CurrNode->_f_Y()),
|
newpos.X = Splerp(PrevNode->Z(), CurrNode->Z(), CurrNode->Next->Z(), CurrNode->Next->Next->Z());
|
||||||
FIXED2DBL(CurrNode->Next->_f_Y()), FIXED2DBL(CurrNode->Next->Next->_f_Y())));
|
|
||||||
z = FLOAT2FIXED(Splerp (FIXED2DBL(PrevNode->_f_Z()), FIXED2DBL(CurrNode->_f_Z()),
|
|
||||||
FIXED2DBL(CurrNode->Next->_f_Z()), FIXED2DBL(CurrNode->Next->Next->_f_Z())));
|
|
||||||
}
|
}
|
||||||
SetXYZ(x, y, z);
|
SetXYZ(newpos);
|
||||||
LinkToWorld ();
|
LinkToWorld ();
|
||||||
|
|
||||||
if (args[2] & 6)
|
if (args[2] & 6)
|
||||||
|
@ -391,46 +386,35 @@ bool APathFollower::Interpolate ()
|
||||||
{
|
{
|
||||||
if (args[2] & 1)
|
if (args[2] & 1)
|
||||||
{ // linear
|
{ // linear
|
||||||
dx = CurrNode->Next->_f_X() - CurrNode->_f_X();
|
dpos.X = CurrNode->Next->X() - CurrNode->X();
|
||||||
dy = CurrNode->Next->_f_Y() - CurrNode->_f_Y();
|
dpos.Y = CurrNode->Next->Y() - CurrNode->Y();
|
||||||
dz = CurrNode->Next->_f_Z() - CurrNode->_f_Z();
|
dpos.Z = CurrNode->Next->Z() - CurrNode->Z();
|
||||||
}
|
}
|
||||||
else if (Time > 0.f)
|
else if (Time > 0.f)
|
||||||
{ // spline
|
{ // spline
|
||||||
dx = x - dx;
|
dpos = newpos - dpos;
|
||||||
dy = y - dy;
|
|
||||||
dz = z - dz;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int realarg = args[2];
|
int realarg = args[2];
|
||||||
args[2] &= ~(2|4|8);
|
args[2] &= ~(2|4|8);
|
||||||
Time += 0.1f;
|
Time += 0.1f;
|
||||||
dx = x;
|
dpos = newpos;
|
||||||
dy = y;
|
|
||||||
dz = z;
|
|
||||||
Interpolate ();
|
Interpolate ();
|
||||||
Time -= 0.1f;
|
Time -= 0.1f;
|
||||||
args[2] = realarg;
|
args[2] = realarg;
|
||||||
dx = x - dx;
|
dpos = newpos - dpos;
|
||||||
dy = y - dy;
|
newpos -= dpos;
|
||||||
dz = z - dz;
|
SetXYZ(newpos);
|
||||||
x -= dx;
|
|
||||||
y -= dy;
|
|
||||||
z -= dz;
|
|
||||||
SetXYZ(x, y, z);
|
|
||||||
}
|
}
|
||||||
if (args[2] & 2)
|
if (args[2] & 2)
|
||||||
{ // adjust yaw
|
{ // adjust yaw
|
||||||
Angles.Yaw = VecToAngle(dx, dy);
|
Angles.Yaw = dpos.Angle();
|
||||||
}
|
}
|
||||||
if (args[2] & 4)
|
if (args[2] & 4)
|
||||||
{ // adjust pitch; use floats for precision
|
{ // adjust pitch; use floats for precision
|
||||||
double fdx = FIXED2DBL(dx);
|
double dist = dpos.XY().Length();
|
||||||
double fdy = FIXED2DBL(dy);
|
Angles.Pitch = dist != 0.f ? VecToAngle(dist, -dpos.Z) : 0.;
|
||||||
double fdz = FIXED2DBL(-dz);
|
|
||||||
double dist = g_sqrt (fdx*fdx + fdy*fdy);
|
|
||||||
Angles.Pitch = dist != 0.f ? VecToAngle(dist, fdz) : 0.;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -517,11 +501,11 @@ bool AActorMover::Interpolate ()
|
||||||
|
|
||||||
if (Super::Interpolate ())
|
if (Super::Interpolate ())
|
||||||
{
|
{
|
||||||
fixed_t savedz = tracer->_f_Z();
|
double savedz = tracer->Z();
|
||||||
tracer->_f_SetZ(_f_Z());
|
tracer->SetZ(Z());
|
||||||
if (!P_TryMove (tracer, _f_X(), _f_Y(), true))
|
if (!P_TryMove (tracer, Pos(), true))
|
||||||
{
|
{
|
||||||
tracer->_f_SetZ(savedz);
|
tracer->SetZ(savedz);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -636,12 +620,10 @@ bool AMovingCamera::Interpolate ()
|
||||||
Angles.Yaw = AngleTo(tracer, true);
|
Angles.Yaw = AngleTo(tracer, true);
|
||||||
|
|
||||||
if (args[2] & 4)
|
if (args[2] & 4)
|
||||||
{ // Also aim camera's pitch; use floats for precision
|
{ // Also aim camera's pitch;
|
||||||
double dx = FIXED2DBL(_f_X() - tracer->_f_X());
|
DVector3 diff = Pos() - tracer->PosPlusZ(tracer->Height / 2);
|
||||||
double dy = FIXED2DBL(_f_Y() - tracer->_f_Y());
|
double dist = diff.XY().Length();
|
||||||
double dz = FIXED2DBL(_f_Z() - tracer->_f_Z() - tracer->_f_height()/2);
|
Angles.Pitch = dist != 0.f ? VecToAngle(dist, diff.Z) : 0.;
|
||||||
double dist = g_sqrt (dx*dx + dy*dy);
|
|
||||||
Angles.Pitch = dist != 0.f ? VecToAngle(dist, dz) : 0.;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -413,20 +413,17 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialPosition)
|
||||||
PARAM_ACTION_PROLOGUE;
|
PARAM_ACTION_PROLOGUE;
|
||||||
|
|
||||||
// Move item back to its original location
|
// Move item back to its original location
|
||||||
fixed_t _x, _y;
|
DVector2 sp = self->SpawnPoint;
|
||||||
|
|
||||||
_x = self->SpawnPoint[0];
|
|
||||||
_y = self->SpawnPoint[1];
|
|
||||||
|
|
||||||
self->UnlinkFromWorld();
|
self->UnlinkFromWorld();
|
||||||
self->SetXY(_x, _y);
|
self->SetXY(sp);
|
||||||
self->LinkToWorld(true);
|
self->LinkToWorld(true);
|
||||||
self->_f_SetZ(self->Sector->floorplane.ZatPoint(_x, _y));
|
self->SetZ(self->Sector->floorplane.ZatPoint(sp));
|
||||||
P_FindFloorCeiling(self, FFCF_ONLYSPAWNPOS | FFCF_NOPORTALS); // no portal checks here so that things get spawned in this sector.
|
P_FindFloorCeiling(self, FFCF_ONLYSPAWNPOS | FFCF_NOPORTALS); // no portal checks here so that things get spawned in this sector.
|
||||||
|
|
||||||
if (self->flags & MF_SPAWNCEILING)
|
if (self->flags & MF_SPAWNCEILING)
|
||||||
{
|
{
|
||||||
self->_f_SetZ(self->_f_ceilingz() - self->_f_height() - self->SpawnPoint[2]);
|
self->SetZ(self->ceilingz - self->Height - self->SpawnPoint.Z);
|
||||||
}
|
}
|
||||||
else if (self->flags2 & MF2_SPAWNFLOAT)
|
else if (self->flags2 & MF2_SPAWNFLOAT)
|
||||||
{
|
{
|
||||||
|
@ -443,7 +440,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialPosition)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
self->_f_SetZ(self->SpawnPoint[2] + self->_f_floorz());
|
self->SetZ(self->SpawnPoint.Z + self->floorz);
|
||||||
}
|
}
|
||||||
// Redo floor/ceiling check, in case of 3D floors and portals
|
// Redo floor/ceiling check, in case of 3D floors and portals
|
||||||
P_FindFloorCeiling(self, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT);
|
P_FindFloorCeiling(self, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT);
|
||||||
|
@ -1354,7 +1351,7 @@ bool AInventory::DoRespawn ()
|
||||||
if (spot != NULL)
|
if (spot != NULL)
|
||||||
{
|
{
|
||||||
SetOrigin (spot->Pos(), false);
|
SetOrigin (spot->Pos(), false);
|
||||||
_f_SetZ(_f_floorz());
|
SetZ(floorz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -162,7 +162,7 @@ class ARandomSpawner : public AActor
|
||||||
// copy everything relevant
|
// copy everything relevant
|
||||||
newmobj->SpawnAngle = SpawnAngle;
|
newmobj->SpawnAngle = SpawnAngle;
|
||||||
newmobj->Angles = Angles;
|
newmobj->Angles = Angles;
|
||||||
newmobj->SpawnPoint[2] = SpawnPoint[2];
|
newmobj->SpawnPoint = SpawnPoint;
|
||||||
newmobj->special = special;
|
newmobj->special = special;
|
||||||
newmobj->args[0] = args[0];
|
newmobj->args[0] = args[0];
|
||||||
newmobj->args[1] = args[1];
|
newmobj->args[1] = args[1];
|
||||||
|
@ -188,7 +188,7 @@ class ARandomSpawner : public AActor
|
||||||
// Handle special altitude flags
|
// Handle special altitude flags
|
||||||
if (newmobj->flags & MF_SPAWNCEILING)
|
if (newmobj->flags & MF_SPAWNCEILING)
|
||||||
{
|
{
|
||||||
newmobj->_f_SetZ(newmobj->_f_ceilingz() - newmobj->_f_height() - SpawnPoint[2]);
|
newmobj->SetZ(newmobj->ceilingz - newmobj->Height - SpawnPoint.Z);
|
||||||
}
|
}
|
||||||
else if (newmobj->flags2 & MF2_SPAWNFLOAT)
|
else if (newmobj->flags2 & MF2_SPAWNFLOAT)
|
||||||
{
|
{
|
||||||
|
@ -198,7 +198,7 @@ class ARandomSpawner : public AActor
|
||||||
space -= 40;
|
space -= 40;
|
||||||
newmobj->SetZ((space * pr_randomspawn()) / 256. + newmobj->floorz + 40);
|
newmobj->SetZ((space * pr_randomspawn()) / 256. + newmobj->floorz + 40);
|
||||||
}
|
}
|
||||||
newmobj->_f_AddZ(SpawnPoint[2]);
|
newmobj->AddZ(SpawnPoint.Z);
|
||||||
}
|
}
|
||||||
if (newmobj->flags & MF_MISSILE)
|
if (newmobj->flags & MF_MISSILE)
|
||||||
P_CheckMissileSpawn(newmobj, 0);
|
P_CheckMissileSpawn(newmobj, 0);
|
||||||
|
|
|
@ -315,7 +315,7 @@ void AActor::Serialize(FArchive &arc)
|
||||||
<< reactiontime
|
<< reactiontime
|
||||||
<< threshold
|
<< threshold
|
||||||
<< player
|
<< player
|
||||||
<< SpawnPoint[0] << SpawnPoint[1] << SpawnPoint[2]
|
<< SpawnPoint
|
||||||
<< SpawnAngle;
|
<< SpawnAngle;
|
||||||
if (SaveVersion >= 4506)
|
if (SaveVersion >= 4506)
|
||||||
{
|
{
|
||||||
|
@ -2739,7 +2739,7 @@ static void PlayerLandedOnThing (AActor *mo, AActor *onmobj)
|
||||||
//
|
//
|
||||||
void P_NightmareRespawn (AActor *mobj)
|
void P_NightmareRespawn (AActor *mobj)
|
||||||
{
|
{
|
||||||
fixed_t x, y, z;
|
double z;
|
||||||
AActor *mo;
|
AActor *mo;
|
||||||
AActor *info = mobj->GetDefault();
|
AActor *info = mobj->GetDefault();
|
||||||
|
|
||||||
|
@ -2754,13 +2754,11 @@ void P_NightmareRespawn (AActor *mobj)
|
||||||
z = ONFLOORZ;
|
z = ONFLOORZ;
|
||||||
|
|
||||||
// spawn it
|
// spawn it
|
||||||
x = mobj->SpawnPoint[0];
|
mo = AActor::StaticSpawn(mobj->GetClass(), mobj->SpawnPoint.X, mobj->SpawnPoint.Y, z, NO_REPLACE, true);
|
||||||
y = mobj->SpawnPoint[1];
|
|
||||||
mo = AActor::StaticSpawn(mobj->GetClass(), x, y, z, NO_REPLACE, true);
|
|
||||||
|
|
||||||
if (z == ONFLOORZ)
|
if (z == ONFLOORZ)
|
||||||
{
|
{
|
||||||
mo->_f_AddZ(mobj->SpawnPoint[2]);
|
mo->AddZ(mobj->SpawnPoint.Z);
|
||||||
if (mo->Z() < mo->floorz)
|
if (mo->Z() < mo->floorz)
|
||||||
{ // Do not respawn monsters in the floor, even if that's where they
|
{ // Do not respawn monsters in the floor, even if that's where they
|
||||||
// started. The initial P_ZMovement() call would have put them on
|
// started. The initial P_ZMovement() call would have put them on
|
||||||
|
@ -2775,7 +2773,7 @@ void P_NightmareRespawn (AActor *mobj)
|
||||||
}
|
}
|
||||||
else if (z == ONCEILINGZ)
|
else if (z == ONCEILINGZ)
|
||||||
{
|
{
|
||||||
mo->_f_AddZ(-mobj->SpawnPoint[2]);
|
mo->AddZ(-mobj->SpawnPoint.Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there are 3D floors, we need to find floor/ceiling again.
|
// If there are 3D floors, we need to find floor/ceiling again.
|
||||||
|
@ -2797,7 +2795,7 @@ void P_NightmareRespawn (AActor *mobj)
|
||||||
}
|
}
|
||||||
|
|
||||||
// something is occupying its position?
|
// something is occupying its position?
|
||||||
if (!P_CheckPosition(mo, mo->_f_X(), mo->_f_Y(), true))
|
if (!P_CheckPosition(mo, mo->Pos(), true))
|
||||||
{
|
{
|
||||||
//[GrafZahl] MF_COUNTKILL still needs to be checked here.
|
//[GrafZahl] MF_COUNTKILL still needs to be checked here.
|
||||||
mo->ClearCounters();
|
mo->ClearCounters();
|
||||||
|
@ -2808,9 +2806,7 @@ void P_NightmareRespawn (AActor *mobj)
|
||||||
z = mo->_f_Z();
|
z = mo->_f_Z();
|
||||||
|
|
||||||
// inherit attributes from deceased one
|
// inherit attributes from deceased one
|
||||||
mo->SpawnPoint[0] = mobj->SpawnPoint[0];
|
mo->SpawnPoint = mobj->SpawnPoint;
|
||||||
mo->SpawnPoint[1] = mobj->SpawnPoint[1];
|
|
||||||
mo->SpawnPoint[2] = mobj->SpawnPoint[2];
|
|
||||||
mo->SpawnAngle = mobj->SpawnAngle;
|
mo->SpawnAngle = mobj->SpawnAngle;
|
||||||
mo->SpawnFlags = mobj->SpawnFlags & ~MTF_DORMANT; // It wasn't dormant when it died, so it's not dormant now, either.
|
mo->SpawnFlags = mobj->SpawnFlags & ~MTF_DORMANT; // It wasn't dormant when it died, so it's not dormant now, either.
|
||||||
mo->Angles.Yaw = (double)mobj->SpawnAngle;
|
mo->Angles.Yaw = (double)mobj->SpawnAngle;
|
||||||
|
@ -2822,13 +2818,13 @@ void P_NightmareRespawn (AActor *mobj)
|
||||||
|
|
||||||
mo->skillrespawncount = mobj->skillrespawncount;
|
mo->skillrespawncount = mobj->skillrespawncount;
|
||||||
|
|
||||||
mo->PrevZ = z; // Do not interpolate Z position if we changed it since spawning.
|
mo->PrevZ = FLOAT2FIXED(z); // Do not interpolate Z position if we changed it since spawning.
|
||||||
|
|
||||||
// spawn a teleport fog at old spot because of removal of the body?
|
// spawn a teleport fog at old spot because of removal of the body?
|
||||||
P_SpawnTeleportFog(mobj, mobj->PosPlusZ(TELEFOGHEIGHT), true, true);
|
P_SpawnTeleportFog(mobj, mobj->PosPlusZ(TELEFOGHEIGHT), true, true);
|
||||||
|
|
||||||
// spawn a teleport fog at the new spot
|
// spawn a teleport fog at the new spot
|
||||||
P_SpawnTeleportFog(mobj, FIXED2DBL(x), FIXED2DBL(y), FIXED2DBL(z) + TELEFOGHEIGHT, false, true);
|
P_SpawnTeleportFog(mobj, mobj->SpawnPoint.X, mobj->SpawnPoint.Y, z + TELEFOGHEIGHT, false, true);
|
||||||
|
|
||||||
// remove the old monster
|
// remove the old monster
|
||||||
mobj->Destroy ();
|
mobj->Destroy ();
|
||||||
|
@ -4132,8 +4128,12 @@ 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, fixed_t _ix, fixed_t _iy, fixed_t _iz, replace_t allowreplacement, bool SpawningMapThing)
|
||||||
{
|
{
|
||||||
|
double ix = FIXED2DBL(_ix);
|
||||||
|
double iy = FIXED2DBL(_iy);
|
||||||
|
double iz = FIXED2DBL(_iz);
|
||||||
|
|
||||||
if (type == NULL)
|
if (type == NULL)
|
||||||
{
|
{
|
||||||
I_Error ("Tried to spawn a class-less actor\n");
|
I_Error ("Tried to spawn a class-less actor\n");
|
||||||
|
@ -4196,10 +4196,9 @@ AActor *AActor::StaticSpawn (PClassActor *type, fixed_t ix, fixed_t iy, fixed_t
|
||||||
actor->LinkToWorld (SpawningMapThing);
|
actor->LinkToWorld (SpawningMapThing);
|
||||||
actor->ClearInterpolation();
|
actor->ClearInterpolation();
|
||||||
|
|
||||||
actor->dropoffz = // killough 11/98: for tracking dropoffs
|
actor->floorz = actor->Sector->floorplane.ZatPoint (ix, iy);
|
||||||
actor->Sector->floorplane.ZatPoint (ix, iy);
|
actor->dropoffz = FLOAT2FIXED(actor->floorz); // killough 11/98: for tracking dropoffs
|
||||||
actor->floorz = FIXED2DBL(actor->dropoffz);
|
actor->ceilingz = actor->Sector->ceilingplane.ZatPoint (ix, iy);
|
||||||
actor->ceilingz = FIXED2DBL(actor->Sector->ceilingplane.ZatPoint (ix, iy));
|
|
||||||
|
|
||||||
// The z-coordinate needs to be set once before calling P_FindFloorCeiling
|
// The z-coordinate needs to be set once before calling P_FindFloorCeiling
|
||||||
// For FLOATRANDZ just use the floor here.
|
// For FLOATRANDZ just use the floor here.
|
||||||
|
@ -4243,8 +4242,8 @@ AActor *AActor::StaticSpawn (PClassActor *type, fixed_t ix, fixed_t iy, fixed_t
|
||||||
actor->ceilingsector = actor->Sector;
|
actor->ceilingsector = actor->Sector;
|
||||||
}
|
}
|
||||||
|
|
||||||
actor->SpawnPoint[0] = ix;
|
actor->SpawnPoint.X = ix;
|
||||||
actor->SpawnPoint[1] = iy;
|
actor->SpawnPoint.Y = iy;
|
||||||
|
|
||||||
if (iz == ONFLOORZ)
|
if (iz == ONFLOORZ)
|
||||||
{
|
{
|
||||||
|
@ -4269,7 +4268,7 @@ AActor *AActor::StaticSpawn (PClassActor *type, fixed_t ix, fixed_t iy, fixed_t
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
actor->SpawnPoint[2] = (actor->_f_Z() - actor->Sector->floorplane.ZatPoint(actor));
|
actor->SpawnPoint.Z = (actor->Z() - actor->Sector->floorplane.ZatPointF(actor));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (actor->FloatBobPhase == (BYTE)-1) actor->FloatBobPhase = rng(); // Don't make everything bob in sync (unless deliberately told to do)
|
if (actor->FloatBobPhase == (BYTE)-1) actor->FloatBobPhase = rng(); // Don't make everything bob in sync (unless deliberately told to do)
|
||||||
|
@ -5129,9 +5128,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
|
||||||
else if (z == ONCEILINGZ)
|
else if (z == ONCEILINGZ)
|
||||||
mobj->_f_AddZ(-mthing->z);
|
mobj->_f_AddZ(-mthing->z);
|
||||||
|
|
||||||
mobj->SpawnPoint[0] = mthing->x;
|
mobj->SpawnPoint = { FIXED2DBL(mthing->x), FIXED2DBL(mthing->y),FIXED2DBL(mthing->z) };
|
||||||
mobj->SpawnPoint[1] = mthing->y;
|
|
||||||
mobj->SpawnPoint[2] = mthing->z;
|
|
||||||
mobj->SpawnAngle = mthing->angle;
|
mobj->SpawnAngle = mthing->angle;
|
||||||
mobj->SpawnFlags = mthing->flags;
|
mobj->SpawnFlags = mthing->flags;
|
||||||
if (mthing->FloatbobPhase >= 0 && mthing->FloatbobPhase < 64) mobj->FloatBobPhase = mthing->FloatbobPhase;
|
if (mthing->FloatbobPhase >= 0 && mthing->FloatbobPhase < 64) mobj->FloatBobPhase = mthing->FloatbobPhase;
|
||||||
|
|
|
@ -727,7 +727,7 @@ void CalculateCPUSpeed()
|
||||||
PerfToMillisec = PerfToSec * 1000.0;
|
PerfToMillisec = PerfToSec * 1000.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!batchrun) Printf ("CPU _f_speed(): %.0f MHz\n", 0.001 / PerfToMillisec);
|
if (!batchrun) Printf ("CPU speed: %.0f MHz\n", 0.001 / PerfToMillisec);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
Loading…
Reference in a new issue