Conflicts:
	src/actor.h
This commit is contained in:
Christoph Oelckers 2016-01-17 22:16:27 +01:00
commit 3f34083e88
30 changed files with 417 additions and 279 deletions

View File

@ -588,6 +588,36 @@ enum
AMETA_BloodType3, // AxeBlood replacement type AMETA_BloodType3, // AxeBlood replacement type
}; };
struct fixedvec3
{
fixed_t x, y, z;
operator FVector3()
{
return FVector3(FIXED2FLOAT(x), FIXED2FLOAT(y), FIXED2FLOAT(z));
}
operator TVector3<double>()
{
return TVector3<double>(FIXED2DBL(x), FIXED2DBL(y), FIXED2DBL(z));
}
};
struct fixedvec2
{
fixed_t x, y;
operator FVector2()
{
return FVector2(FIXED2FLOAT(x), FIXED2FLOAT(y));
}
operator TVector2<double>()
{
return TVector2<double>(FIXED2DBL(x), FIXED2DBL(y));
}
};
struct FDropItem struct FDropItem
{ {
FName Name; FName Name;
@ -909,6 +939,35 @@ public:
return R_PointToAngle2(myx, myy, other->x, other->y); return R_PointToAngle2(myx, myy, other->x, other->y);
} }
fixedvec2 Vec2To(AActor *other) const
{
fixedvec2 ret = { other->x - x, other->y - y };
return ret;
}
fixedvec3 Vec3To(AActor *other) const
{
fixedvec3 ret = { other->x - x, other->y - y, other->z - z };
return ret;
}
fixedvec2 Vec2Offset(fixed_t dx, fixed_t dy) const
{
fixedvec2 ret = { x + dx, y + dy };
return ret;
}
fixedvec3 Vec3Offset(fixed_t dx, fixed_t dy, fixed_t dz) const
{
fixedvec3 ret = { x + dx, y + dy, z + dz };
return ret;
}
void Move(fixed_t dx, fixed_t dy, fixed_t dz)
{
SetOrigin(x + dx, y + dy, z + dz, true);
}
inline void SetFriendPlayer(player_t *player); inline void SetFriendPlayer(player_t *player);
bool IsVisibleToPlayer() const; bool IsVisibleToPlayer() const;
@ -1126,7 +1185,7 @@ public:
void LinkToWorld (sector_t *sector); void LinkToWorld (sector_t *sector);
void UnlinkFromWorld (); void UnlinkFromWorld ();
void AdjustFloorClip (); void AdjustFloorClip ();
void SetOrigin (fixed_t x, fixed_t y, fixed_t z); void SetOrigin (fixed_t x, fixed_t y, fixed_t z, bool moving = false);
bool InStateSequence(FState * newstate, FState * basestate); bool InStateSequence(FState * newstate, FState * basestate);
int GetTics(FState * newstate); int GetTics(FState * newstate);
bool SetState (FState *newstate, bool nofunction=false); bool SetState (FState *newstate, bool nofunction=false);
@ -1156,6 +1215,24 @@ public:
bool HasSpecialDeathStates () const; bool HasSpecialDeathStates () const;
fixed_t X() const
{
return x;
}
fixed_t Y() const
{
return y;
}
fixed_t Z() const
{
return z;
}
void SetZ(fixed_t newz)
{
z = newz;
}
// begin of GZDoom specific additions // begin of GZDoom specific additions
TArray<TObjPtr<AActor> > dynamiclights; TArray<TObjPtr<AActor> > dynamiclights;
void * lightassociations; void * lightassociations;
@ -1236,15 +1313,36 @@ inline AActor *Spawn (const PClass *type, fixed_t x, fixed_t y, fixed_t z, repla
return AActor::StaticSpawn (type, x, y, z, allowreplacement); return AActor::StaticSpawn (type, x, y, z, allowreplacement);
} }
inline AActor *Spawn (const PClass *type, const fixedvec3 &pos, replace_t allowreplacement)
{
return AActor::StaticSpawn (type, pos.x, pos.y, pos.z, allowreplacement);
}
AActor *Spawn (const char *type, fixed_t x, fixed_t y, fixed_t z, replace_t 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); AActor *Spawn (FName classname, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement);
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 (FName classname, const fixedvec3 &pos, replace_t allowreplacement)
{
return Spawn (classname, pos.x, pos.y, pos.z, allowreplacement);
}
template<class T> template<class T>
inline T *Spawn (fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement) inline T *Spawn (fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement)
{ {
return static_cast<T *>(AActor::StaticSpawn (RUNTIME_CLASS(T), x, y, z, allowreplacement)); return static_cast<T *>(AActor::StaticSpawn (RUNTIME_CLASS(T), x, y, z, allowreplacement));
} }
template<class T>
inline T *Spawn (const fixedvec3 &pos, replace_t allowreplacement)
{
return static_cast<T *>(AActor::StaticSpawn (RUNTIME_CLASS(T), pos.x, pos.y, pos.z, allowreplacement));
}
void PrintMiscActorInfo(AActor * query); void PrintMiscActorInfo(AActor * query);

View File

@ -998,8 +998,8 @@ void AM_restoreScaleAndLoc ()
} }
else else
{ {
m_x = (players[consoleplayer].camera->x >> FRACTOMAPBITS) - m_w/2; m_x = (players[consoleplayer].camera->X() >> FRACTOMAPBITS) - m_w/2;
m_y = (players[consoleplayer].camera->y >> FRACTOMAPBITS)- m_h/2; m_y = (players[consoleplayer].camera->Y() >> FRACTOMAPBITS)- m_h/2;
} }
m_x2 = m_x + m_w; m_x2 = m_x + m_w;
m_y2 = m_y + m_h; m_y2 = m_y + m_h;
@ -1249,8 +1249,8 @@ void AM_initVariables ()
if (playeringame[pnum]) if (playeringame[pnum])
break; break;
assert(pnum >= 0 && pnum < MAXPLAYERS); assert(pnum >= 0 && pnum < MAXPLAYERS);
m_x = (players[pnum].camera->x >> FRACTOMAPBITS) - m_w/2; m_x = (players[pnum].camera->X() >> FRACTOMAPBITS) - m_w/2;
m_y = (players[pnum].camera->y >> FRACTOMAPBITS) - m_h/2; m_y = (players[pnum].camera->Y() >> FRACTOMAPBITS) - m_h/2;
AM_changeWindowLoc(); AM_changeWindowLoc();
// for saving & restoring // for saving & restoring
@ -1571,25 +1571,25 @@ void AM_doFollowPlayer ()
fixed_t sx, sy; fixed_t sx, sy;
if (players[consoleplayer].camera != NULL && if (players[consoleplayer].camera != NULL &&
(f_oldloc.x != players[consoleplayer].camera->x || (f_oldloc.x != players[consoleplayer].camera->X() ||
f_oldloc.y != players[consoleplayer].camera->y)) f_oldloc.y != players[consoleplayer].camera->Y()))
{ {
m_x = (players[consoleplayer].camera->x >> FRACTOMAPBITS) - m_w/2; m_x = (players[consoleplayer].camera->X() >> FRACTOMAPBITS) - m_w/2;
m_y = (players[consoleplayer].camera->y >> FRACTOMAPBITS) - m_h/2; m_y = (players[consoleplayer].camera->Y() >> FRACTOMAPBITS) - m_h/2;
m_x2 = m_x + m_w; m_x2 = m_x + m_w;
m_y2 = m_y + m_h; m_y2 = m_y + m_h;
// do the parallax parchment scrolling. // do the parallax parchment scrolling.
sx = (players[consoleplayer].camera->x - f_oldloc.x) >> FRACTOMAPBITS; sx = (players[consoleplayer].camera->X() - f_oldloc.x) >> FRACTOMAPBITS;
sy = (f_oldloc.y - players[consoleplayer].camera->y) >> FRACTOMAPBITS; sy = (f_oldloc.y - players[consoleplayer].camera->Y()) >> FRACTOMAPBITS;
if (am_rotate == 1 || (am_rotate == 2 && viewactive)) if (am_rotate == 1 || (am_rotate == 2 && viewactive))
{ {
AM_rotate (&sx, &sy, players[consoleplayer].camera->angle - ANG90); AM_rotate (&sx, &sy, players[consoleplayer].camera->angle - ANG90);
} }
AM_ScrollParchment (sx, sy); AM_ScrollParchment (sx, sy);
f_oldloc.x = players[consoleplayer].camera->x; f_oldloc.x = players[consoleplayer].camera->X();
f_oldloc.y = players[consoleplayer].camera->y; f_oldloc.y = players[consoleplayer].camera->Y();
} }
} }
@ -2612,8 +2612,8 @@ void AM_drawPlayers ()
mline_t *arrow; mline_t *arrow;
int numarrowlines; int numarrowlines;
pt.x = players[consoleplayer].camera->x >> FRACTOMAPBITS; pt.x = players[consoleplayer].camera->X() >> FRACTOMAPBITS;
pt.y = players[consoleplayer].camera->y >> FRACTOMAPBITS; pt.y = players[consoleplayer].camera->Y() >> FRACTOMAPBITS;
if (am_rotate == 1 || (am_rotate == 2 && viewactive)) if (am_rotate == 1 || (am_rotate == 2 && viewactive))
{ {
angle = ANG90; angle = ANG90;
@ -2675,8 +2675,8 @@ void AM_drawPlayers ()
if (p->mo != NULL) if (p->mo != NULL)
{ {
pt.x = p->mo->x >> FRACTOMAPBITS; pt.x = p->mo->X() >> FRACTOMAPBITS;
pt.y = p->mo->y >> FRACTOMAPBITS; pt.y = p->mo->Y() >> FRACTOMAPBITS;
angle = p->mo->angle; angle = p->mo->angle;
if (am_rotate == 1 || (am_rotate == 2 && viewactive)) if (am_rotate == 1 || (am_rotate == 2 && viewactive))
@ -2707,8 +2707,8 @@ void AM_drawKeys ()
while ((key = it.Next()) != NULL) while ((key = it.Next()) != NULL)
{ {
p.x = key->x >> FRACTOMAPBITS; p.x = key->X() >> FRACTOMAPBITS;
p.y = key->y >> FRACTOMAPBITS; p.y = key->Y() >> FRACTOMAPBITS;
angle = key->angle; angle = key->angle;
if (am_rotate == 1 || (am_rotate == 2 && viewactive)) if (am_rotate == 1 || (am_rotate == 2 && viewactive))
@ -2752,8 +2752,8 @@ void AM_drawThings ()
{ {
if (am_cheat > 0 || !(t->flags6 & MF6_NOTONAUTOMAP)) if (am_cheat > 0 || !(t->flags6 & MF6_NOTONAUTOMAP))
{ {
p.x = t->x >> FRACTOMAPBITS; p.x = t->X() >> FRACTOMAPBITS;
p.y = t->y >> FRACTOMAPBITS; p.y = t->Y() >> FRACTOMAPBITS;
if (am_showthingsprites > 0 && t->sprite > 0) if (am_showthingsprites > 0 && t->sprite > 0)
{ {
@ -2979,7 +2979,7 @@ void AM_drawAuthorMarkers ()
marked->subsector->flags & SSECF_DRAWN : marked->subsector->flags & SSECF_DRAWN :
marked->Sector->MoreFlags & SECF_DRAWN))) marked->Sector->MoreFlags & SECF_DRAWN)))
{ {
DrawMarker (tex, marked->x >> FRACTOMAPBITS, marked->y >> FRACTOMAPBITS, 0, DrawMarker (tex, marked->X() >> FRACTOMAPBITS, marked->Y() >> FRACTOMAPBITS, 0,
flip, mark->scaleX, mark->scaleY, mark->Translation, flip, mark->scaleX, mark->scaleY, mark->Translation,
mark->alpha, mark->fillcolor, mark->RenderStyle); mark->alpha, mark->fillcolor, mark->RenderStyle);
} }

View File

@ -30,17 +30,17 @@ bool DBot::Reachable (AActor *rtarget)
if (player->mo == rtarget) if (player->mo == rtarget)
return false; return false;
if ((rtarget->Sector->ceilingplane.ZatPoint (rtarget->x, rtarget->y) - if ((rtarget->Sector->ceilingplane.ZatPoint (rtarget) -
rtarget->Sector->floorplane.ZatPoint (rtarget->x, rtarget->y)) rtarget->Sector->floorplane.ZatPoint (rtarget))
< player->mo->height) //Where rtarget is, player->mo can't be. < player->mo->height) //Where rtarget is, player->mo can't be.
return false; return false;
sector_t *last_s = player->mo->Sector; sector_t *last_s = player->mo->Sector;
fixed_t last_z = last_s->floorplane.ZatPoint (player->mo->x, player->mo->y); fixed_t last_z = last_s->floorplane.ZatPoint (player->mo);
fixed_t estimated_dist = player->mo->AproxDistance(rtarget); fixed_t estimated_dist = player->mo->AproxDistance(rtarget);
bool reachable = true; bool reachable = true;
FPathTraverse it(player->mo->x+player->mo->velx, player->mo->y+player->mo->vely, rtarget->x, rtarget->y, PT_ADDLINES|PT_ADDTHINGS); FPathTraverse it(player->mo->X()+player->mo->velx, player->mo->Y()+player->mo->vely, rtarget->X(), rtarget->Y(), PT_ADDLINES|PT_ADDTHINGS);
intercept_t *in; intercept_t *in;
while ((in = it.Next())) while ((in = it.Next()))
{ {
@ -96,7 +96,7 @@ bool DBot::Reachable (AActor *rtarget)
thing = in->d.thing; thing = in->d.thing;
if (thing == player->mo) //Can't reach self in this case. if (thing == player->mo) //Can't reach self in this case.
continue; continue;
if (thing == rtarget && (rtarget->Sector->floorplane.ZatPoint (rtarget->x, rtarget->y) <= (last_z+MAXMOVEHEIGHT))) if (thing == rtarget && (rtarget->Sector->floorplane.ZatPoint (rtarget) <= (last_z+MAXMOVEHEIGHT)))
{ {
return true; return true;
} }
@ -219,7 +219,7 @@ void DBot::Dofire (ticcmd_t *cmd)
shootmissile: shootmissile:
dist = player->mo->AproxDistance (enemy); dist = player->mo->AproxDistance (enemy);
m = dist / GetDefaultByType (player->ReadyWeapon->ProjectileType)->Speed; m = dist / GetDefaultByType (player->ReadyWeapon->ProjectileType)->Speed;
bglobal.SetBodyAt (enemy->x + enemy->velx*m*2, enemy->y + enemy->vely*m*2, enemy->z, 1); bglobal.SetBodyAt (enemy->X() + enemy->velx*m*2, enemy->Y() + enemy->vely*m*2, enemy->Z(), 1);
angle = player->mo->AngleTo(bglobal.body1); angle = player->mo->AngleTo(bglobal.body1);
if (Check_LOS (enemy, SHOOTFOV)) if (Check_LOS (enemy, SHOOTFOV))
no_fire = false; no_fire = false;
@ -427,7 +427,7 @@ void FCajunMaster::SetBodyAt (fixed_t x, fixed_t y, fixed_t z, int hostnum)
{ {
if (body1) if (body1)
{ {
body1->SetOrigin (x, y, z); body1->SetOrigin (x, y, z, false);
} }
else else
{ {
@ -438,7 +438,7 @@ void FCajunMaster::SetBodyAt (fixed_t x, fixed_t y, fixed_t z, int hostnum)
{ {
if (body2) if (body2)
{ {
body2->SetOrigin (x, y, z); body2->SetOrigin (x, y, z, false);
} }
else else
{ {
@ -459,16 +459,13 @@ void FCajunMaster::SetBodyAt (fixed_t x, fixed_t y, fixed_t z, int hostnum)
//Emulates missile travel. Returns distance travelled. //Emulates missile travel. Returns distance travelled.
fixed_t FCajunMaster::FakeFire (AActor *source, AActor *dest, ticcmd_t *cmd) fixed_t FCajunMaster::FakeFire (AActor *source, AActor *dest, ticcmd_t *cmd)
{ {
AActor *th = Spawn ("CajunTrace", source->x, source->y, source->z + 4*8*FRACUNIT, NO_REPLACE); AActor *th = Spawn ("CajunTrace", source->X(), source->Y(), source->Z() + 4*8*FRACUNIT, NO_REPLACE);
th->target = source; // where it came from th->target = source; // where it came from
float speed = (float)th->Speed; float speed = (float)th->Speed;
FVector3 velocity; TVector3<double> velocity = source->Vec3To(dest);
velocity[0] = FIXED2FLOAT(dest->x - source->x);
velocity[1] = FIXED2FLOAT(dest->y - source->y);
velocity[2] = FIXED2FLOAT(dest->z - source->z);
velocity.MakeUnit(); velocity.MakeUnit();
th->velx = FLOAT2FIXED(velocity[0] * speed); th->velx = FLOAT2FIXED(velocity[0] * speed);
th->vely = FLOAT2FIXED(velocity[1] * speed); th->vely = FLOAT2FIXED(velocity[1] * speed);
@ -479,8 +476,8 @@ fixed_t FCajunMaster::FakeFire (AActor *source, AActor *dest, ticcmd_t *cmd)
while (dist < SAFE_SELF_MISDIST) while (dist < SAFE_SELF_MISDIST)
{ {
dist += th->Speed; dist += th->Speed;
th->SetOrigin (th->x + th->velx, th->y + th->vely, th->z + th->velz); th->Move(th->velx, th->vely, th->velz);
if (!CleanAhead (th, th->x, th->y, cmd)) if (!CleanAhead (th, th->X(), th->Y(), cmd))
break; break;
} }
th->Destroy (); th->Destroy ();
@ -494,9 +491,9 @@ angle_t DBot::FireRox (AActor *enemy, ticcmd_t *cmd)
AActor *actor; AActor *actor;
int m; int m;
bglobal.SetBodyAt (player->mo->x + FixedMul(player->mo->velx, 5*FRACUNIT), bglobal.SetBodyAt (player->mo->X() + FixedMul(player->mo->velx, 5*FRACUNIT),
player->mo->y + FixedMul(player->mo->vely, 5*FRACUNIT), player->mo->Y() + FixedMul(player->mo->vely, 5*FRACUNIT),
player->mo->z + (player->mo->height / 2), 2); player->mo->Z() + (player->mo->height / 2), 2);
actor = bglobal.body2; actor = bglobal.body2;
@ -506,14 +503,14 @@ angle_t DBot::FireRox (AActor *enemy, ticcmd_t *cmd)
//Predict. //Predict.
m = (((dist+1)/FRACUNIT) / GetDefaultByName("Rocket")->Speed); m = (((dist+1)/FRACUNIT) / GetDefaultByName("Rocket")->Speed);
bglobal.SetBodyAt (enemy->x + FixedMul(enemy->velx, (m+2*FRACUNIT)), bglobal.SetBodyAt (enemy->X() + FixedMul(enemy->velx, (m+2*FRACUNIT)),
enemy->y + FixedMul(enemy->vely, (m+2*FRACUNIT)), ONFLOORZ, 1); enemy->Y() + FixedMul(enemy->vely, (m+2*FRACUNIT)), ONFLOORZ, 1);
//try the predicted location //try the predicted location
if (P_CheckSight (actor, bglobal.body1, SF_IGNOREVISIBILITY)) //See the predicted location, so give a test missile if (P_CheckSight (actor, bglobal.body1, SF_IGNOREVISIBILITY)) //See the predicted location, so give a test missile
{ {
FCheckPosition tm; FCheckPosition tm;
if (bglobal.SafeCheckPosition (player->mo, actor->x, actor->y, tm)) if (bglobal.SafeCheckPosition (player->mo, actor->X(), actor->Y(), tm))
{ {
if (bglobal.FakeFire (actor, bglobal.body1, cmd) >= SAFE_SELF_MISDIST) if (bglobal.FakeFire (actor, bglobal.body1, cmd) >= SAFE_SELF_MISDIST)
{ {

View File

@ -67,8 +67,8 @@ bool DBot::Move (ticcmd_t *cmd)
if ((unsigned)player->mo->movedir >= 8) if ((unsigned)player->mo->movedir >= 8)
I_Error ("Weird bot movedir!"); I_Error ("Weird bot movedir!");
tryx = player->mo->x + 8*xspeed[player->mo->movedir]; tryx = player->mo->X() + 8*xspeed[player->mo->movedir];
tryy = player->mo->y + 8*yspeed[player->mo->movedir]; tryy = player->mo->Y() + 8*yspeed[player->mo->movedir];
try_ok = bglobal.CleanAhead (player->mo, tryx, tryy, cmd); try_ok = bglobal.CleanAhead (player->mo, tryx, tryy, cmd);
@ -124,9 +124,6 @@ bool DBot::TryWalk (ticcmd_t *cmd)
void DBot::NewChaseDir (ticcmd_t *cmd) void DBot::NewChaseDir (ticcmd_t *cmd)
{ {
fixed_t deltax;
fixed_t deltay;
dirtype_t d[3]; dirtype_t d[3];
int tdir; int tdir;
@ -145,19 +142,18 @@ void DBot::NewChaseDir (ticcmd_t *cmd)
olddir = (dirtype_t)player->mo->movedir; olddir = (dirtype_t)player->mo->movedir;
turnaround = opposite[olddir]; turnaround = opposite[olddir];
deltax = dest->x - player->mo->x; fixedvec2 delta = player->mo->Vec2To(dest);
deltay = dest->y - player->mo->y;
if (deltax > 10*FRACUNIT) if (delta.x > 10*FRACUNIT)
d[1] = DI_EAST; d[1] = DI_EAST;
else if (deltax < -10*FRACUNIT) else if (delta.x < -10*FRACUNIT)
d[1] = DI_WEST; d[1] = DI_WEST;
else else
d[1] = DI_NODIR; d[1] = DI_NODIR;
if (deltay < -10*FRACUNIT) if (delta.y < -10*FRACUNIT)
d[2] = DI_SOUTH; d[2] = DI_SOUTH;
else if (deltay > 10*FRACUNIT) else if (delta.y > 10*FRACUNIT)
d[2] = DI_NORTH; d[2] = DI_NORTH;
else else
d[2] = DI_NODIR; d[2] = DI_NODIR;
@ -165,14 +161,14 @@ void DBot::NewChaseDir (ticcmd_t *cmd)
// try direct route // try direct route
if (d[1] != DI_NODIR && d[2] != DI_NODIR) if (d[1] != DI_NODIR && d[2] != DI_NODIR)
{ {
player->mo->movedir = diags[((deltay<0)<<1)+(deltax>0)]; player->mo->movedir = diags[((delta.y<0)<<1)+(delta.x>0)];
if (player->mo->movedir != turnaround && TryWalk(cmd)) if (player->mo->movedir != turnaround && TryWalk(cmd))
return; return;
} }
// try other directions // try other directions
if (pr_botnewchasedir() > 200 if (pr_botnewchasedir() > 200
|| abs(deltay)>abs(deltax)) || abs(delta.y)>abs(delta.x))
{ {
tdir=d[1]; tdir=d[1];
d[1]=d[2]; d[1]=d[2];
@ -282,7 +278,7 @@ bool FCajunMaster::CleanAhead (AActor *thing, fixed_t x, fixed_t y, ticcmd_t *cm
if ( !(thing->flags & MF_TELEPORT) && if ( !(thing->flags & MF_TELEPORT) &&
tm.ceilingz - thing->z < thing->height) tm.ceilingz - thing->Z() < thing->height)
return false; // mobj must lower itself to fit return false; // mobj must lower itself to fit
// jump out of water // jump out of water
@ -290,7 +286,7 @@ bool FCajunMaster::CleanAhead (AActor *thing, fixed_t x, fixed_t y, ticcmd_t *cm
// maxstep=37*FRACUNIT; // maxstep=37*FRACUNIT;
if ( !(thing->flags & MF_TELEPORT) && if ( !(thing->flags & MF_TELEPORT) &&
(tm.floorz - thing->z > maxstep ) ) (tm.floorz - thing->Z() > maxstep ) )
return false; // too big a step up return false; // too big a step up
@ -346,7 +342,7 @@ void DBot::Pitch (AActor *target)
double aim; double aim;
double diff; double diff;
diff = target->z - player->mo->z; diff = target->Z() - player->mo->Z();
aim = atan(diff / (double)player->mo->AproxDistance(target)); aim = atan(diff / (double)player->mo->AproxDistance(target));
player->mo->pitch = -(int)(aim * ANGLE_180/M_PI); player->mo->pitch = -(int)(aim * ANGLE_180/M_PI);
} }

View File

@ -303,8 +303,8 @@ void DBot::ThinkForMove (ticcmd_t *cmd)
if (t_fight<(AFTERTICS/2)) if (t_fight<(AFTERTICS/2))
player->mo->flags |= MF_DROPOFF; player->mo->flags |= MF_DROPOFF;
oldx = player->mo->x; oldx = player->mo->X();
oldy = player->mo->y; oldy = player->mo->Y();
} }
//BOT_WhatToGet //BOT_WhatToGet

View File

@ -944,7 +944,7 @@ static void PrintFilteredActorList(const ActorTypeChecker IsActorType, const cha
{ {
Printf ("%s at (%d,%d,%d)\n", Printf ("%s at (%d,%d,%d)\n",
mo->GetClass()->TypeName.GetChars(), mo->GetClass()->TypeName.GetChars(),
mo->x >> FRACBITS, mo->y >> FRACBITS, mo->z >> FRACBITS); mo->X() >> FRACBITS, mo->Y() >> FRACBITS, mo->Z() >> FRACBITS);
} }
} }
} }
@ -1084,7 +1084,7 @@ CCMD(currentpos)
{ {
AActor *mo = players[consoleplayer].mo; AActor *mo = players[consoleplayer].mo;
Printf("Current player position: (%1.3f,%1.3f,%1.3f), angle: %1.3f, floorheight: %1.3f, sector:%d, lightlevel: %d\n", Printf("Current player position: (%1.3f,%1.3f,%1.3f), angle: %1.3f, floorheight: %1.3f, sector:%d, lightlevel: %d\n",
FIXED2FLOAT(mo->x), FIXED2FLOAT(mo->y), FIXED2FLOAT(mo->z), mo->angle/float(ANGLE_1), FIXED2FLOAT(mo->floorz), mo->Sector->sectornum, mo->Sector->lightlevel); FIXED2FLOAT(mo->X()), FIXED2FLOAT(mo->Y()), FIXED2FLOAT(mo->Z()), mo->angle/float(ANGLE_1), FIXED2FLOAT(mo->floorz), mo->Sector->sectornum, mo->Sector->lightlevel);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -3056,7 +3056,7 @@ bool ADehackedPickup::TryPickup (AActor *&toucher)
{ {
return false; return false;
} }
RealPickup = static_cast<AInventory *>(Spawn (type, x, y, z, NO_REPLACE)); RealPickup = static_cast<AInventory *>(Spawn (type, X(), Y(), Z(), NO_REPLACE));
if (RealPickup != NULL) if (RealPickup != NULL)
{ {
// The internally spawned item should never count towards statistics. // The internally spawned item should never count towards statistics.

View File

@ -2319,10 +2319,12 @@ void Net_DoCommand (int type, BYTE **stream, int player)
else else
{ {
const AActor *def = GetDefaultByType (typeinfo); const AActor *def = GetDefaultByType (typeinfo);
AActor *spawned = Spawn (typeinfo, fixedvec3 spawnpos = source->Vec3Offset(
source->x + FixedMul (def->radius * 2 + source->radius, finecosine[source->angle>>ANGLETOFINESHIFT]), FixedMul (def->radius * 2 + source->radius, finecosine[source->angle>>ANGLETOFINESHIFT]),
source->y + FixedMul (def->radius * 2 + source->radius, finesine[source->angle>>ANGLETOFINESHIFT]), FixedMul (def->radius * 2 + source->radius, finesine[source->angle>>ANGLETOFINESHIFT]),
source->z + 8 * FRACUNIT, ALLOW_REPLACE); 8 * FRACUNIT);
AActor *spawned = Spawn (typeinfo, spawnpos, ALLOW_REPLACE);
if (spawned != NULL) if (spawned != NULL)
{ {
if (type == DEM_SUMMONFRIEND || type == DEM_SUMMONFRIEND2 || type == DEM_SUMMONMBF) if (type == DEM_SUMMONFRIEND || type == DEM_SUMMONFRIEND2 || type == DEM_SUMMONMBF)
@ -2373,8 +2375,8 @@ void Net_DoCommand (int type, BYTE **stream, int player)
s = ReadString (stream); s = ReadString (stream);
if (Trace (players[player].mo->x, players[player].mo->y, if (Trace (players[player].mo->X(), players[player].mo->Y(),
players[player].mo->z + players[player].mo->height - (players[player].mo->height>>2), players[player].mo->Z() + players[player].mo->height - (players[player].mo->height>>2),
players[player].mo->Sector, players[player].mo->Sector,
vx, vy, vz, 172*FRACUNIT, 0, ML_BLOCKEVERYTHING, players[player].mo, vx, vy, vz, 172*FRACUNIT, 0, ML_BLOCKEVERYTHING, players[player].mo,
trace, TRACE_NoSky)) trace, TRACE_NoSky))

View File

@ -1176,7 +1176,7 @@ void G_Ticker ()
} }
if (players[i].mo) if (players[i].mo)
{ {
DWORD sum = rngsum + players[i].mo->x + players[i].mo->y + players[i].mo->z DWORD sum = rngsum + players[i].mo->X() + players[i].mo->Y() + players[i].mo->Z()
+ players[i].mo->angle + players[i].mo->pitch; + players[i].mo->angle + players[i].mo->pitch;
sum ^= players[i].health; sum ^= players[i].health;
consistancy[i][buf] = sum; consistancy[i][buf] = sum;
@ -1435,13 +1435,13 @@ bool G_CheckSpot (int playernum, FPlayerStart *mthing)
if (!players[playernum].mo) if (!players[playernum].mo)
{ // first spawn of level, before corpses { // first spawn of level, before corpses
for (i = 0; i < playernum; i++) for (i = 0; i < playernum; i++)
if (players[i].mo && players[i].mo->x == x && players[i].mo->y == y) if (players[i].mo && players[i].mo->X() == x && players[i].mo->Y() == y)
return false; return false;
return true; return true;
} }
oldz = players[playernum].mo->z; // [RH] Need to save corpse's z-height oldz = players[playernum].mo->Z(); // [RH] Need to save corpse's z-height
players[playernum].mo->z = z; // [RH] Checks are now full 3-D players[playernum].mo->SetZ(z); // [RH] Checks are now full 3-D
// killough 4/2/98: fix bug where P_CheckPosition() uses a non-solid // killough 4/2/98: fix bug where P_CheckPosition() uses a non-solid
// corpse to detect collisions with other players in DM starts // corpse to detect collisions with other players in DM starts
@ -1453,7 +1453,7 @@ bool G_CheckSpot (int playernum, FPlayerStart *mthing)
players[playernum].mo->flags |= MF_SOLID; players[playernum].mo->flags |= MF_SOLID;
i = P_CheckPosition(players[playernum].mo, x, y); i = P_CheckPosition(players[playernum].mo, x, y);
players[playernum].mo->flags &= ~MF_SOLID; players[playernum].mo->flags &= ~MF_SOLID;
players[playernum].mo->z = oldz; // [RH] Restore corpse's height players[playernum].mo->SetZ(oldz); // [RH] Restore corpse's height
if (!i) if (!i)
return false; return false;

View File

@ -1099,7 +1099,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_HideInCeiling)
F3DFloor * rover = self->Sector->e->XFloor.ffloors[i]; F3DFloor * rover = self->Sector->e->XFloor.ffloors[i];
if(!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue; if(!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue;
if ((foo = rover->bottom.plane->ZatPoint(self->x, self->y)) >= (self->z + self->height)) if ((foo = rover->bottom.plane->ZatPoint(self)) >= (self->z + self->height))
{ {
self->z = foo + 4*FRACUNIT; self->z = foo + 4*FRACUNIT;
self->bouncecount = i; self->bouncecount = i;

View File

@ -628,7 +628,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CheckTerrain)
{ {
sector_t *sec = self->Sector; sector_t *sec = self->Sector;
if (self->z == sec->floorplane.ZatPoint (self->x, self->y)) if (self->z == sec->floorplane.ZatPoint(self))
{ {
if (sec->special == Damage_InstantDeath) if (sec->special == Damage_InstantDeath)
{ {

View File

@ -580,7 +580,7 @@ void GiveSpawner (player_t *player, const PClass *type, int amount)
} }
AInventory *item = static_cast<AInventory *> AInventory *item = static_cast<AInventory *>
(Spawn (type, player->mo->x, player->mo->y, player->mo->z, NO_REPLACE)); (Spawn (type, player->mo->X(), player->mo->Y(), player->mo->Z(), NO_REPLACE));
if (item != NULL) if (item != NULL)
{ {
if (amount > 0) if (amount > 0)

View File

@ -334,13 +334,13 @@ void P_PlayerOnSpecial3DFloor(player_t* player)
if(rover->flags & FF_SOLID) if(rover->flags & FF_SOLID)
{ {
// Player must be on top of the floor to be affected... // Player must be on top of the floor to be affected...
if(player->mo->z != rover->top.plane->ZatPoint(player->mo->x, player->mo->y)) continue; if(player->mo->Z() != rover->top.plane->ZatPoint(player->mo)) continue;
} }
else else
{ {
//Water and DEATH FOG!!! heh //Water and DEATH FOG!!! heh
if (player->mo->z > rover->top.plane->ZatPoint(player->mo->x, player->mo->y) || if (player->mo->Z() > rover->top.plane->ZatPoint(player->mo) ||
(player->mo->z + player->mo->height) < rover->bottom.plane->ZatPoint(player->mo->x, player->mo->y)) (player->mo->Z() + player->mo->height) < rover->bottom.plane->ZatPoint(player->mo))
continue; continue;
} }
@ -375,7 +375,7 @@ bool P_CheckFor3DFloorHit(AActor * mo)
if(rover->flags & FF_SOLID && rover->model->SecActTarget) if(rover->flags & FF_SOLID && rover->model->SecActTarget)
{ {
if(mo->floorz == rover->top.plane->ZatPoint(mo->x, mo->y)) if(mo->floorz == rover->top.plane->ZatPoint(mo))
{ {
rover->model->SecActTarget->TriggerAction (mo, SECSPAC_HitFloor); rover->model->SecActTarget->TriggerAction (mo, SECSPAC_HitFloor);
return true; return true;
@ -405,7 +405,7 @@ bool P_CheckFor3DCeilingHit(AActor * mo)
if(rover->flags & FF_SOLID && rover->model->SecActTarget) if(rover->flags & FF_SOLID && rover->model->SecActTarget)
{ {
if(mo->ceilingz == rover->bottom.plane->ZatPoint(mo->x, mo->y)) if(mo->ceilingz == rover->bottom.plane->ZatPoint(mo))
{ {
rover->model->SecActTarget->TriggerAction (mo, SECSPAC_HitCeiling); rover->model->SecActTarget->TriggerAction (mo, SECSPAC_HitCeiling);
return true; return true;
@ -755,7 +755,7 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li
{ {
fixed_t thingbot, thingtop; fixed_t thingbot, thingtop;
thingbot = thing->z; thingbot = thing->Z();
thingtop = thingbot + (thing->height==0? 1:thing->height); thingtop = thingbot + (thing->height==0? 1:thing->height);
extsector_t::xfloor *xf[2] = {&linedef->frontsector->e->XFloor, &linedef->backsector->e->XFloor}; extsector_t::xfloor *xf[2] = {&linedef->frontsector->e->XFloor, &linedef->backsector->e->XFloor};
@ -796,13 +796,13 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li
lowestceilingpic = *rover->bottom.texture; lowestceilingpic = *rover->bottom.texture;
} }
if(ff_top > highestfloor && delta1 < delta2 && (!restrict || thing->z >= ff_top)) if(ff_top > highestfloor && delta1 < delta2 && (!restrict || thing->Z() >= ff_top))
{ {
highestfloor = ff_top; highestfloor = ff_top;
highestfloorpic = *rover->top.texture; highestfloorpic = *rover->top.texture;
highestfloorterrain = rover->model->GetTerrain(rover->top.isceiling); highestfloorterrain = rover->model->GetTerrain(rover->top.isceiling);
} }
if(ff_top > lowestfloor[j] && ff_top <= thing->z + thing->MaxStepHeight) lowestfloor[j] = ff_top; if(ff_top > lowestfloor[j] && ff_top <= thing->Z() + thing->MaxStepHeight) lowestfloor[j] = ff_top;
} }
} }

View File

@ -276,7 +276,7 @@ bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, FLineOpening &
open.abovemidtex = false; open.abovemidtex = false;
if (P_GetMidTexturePosition(linedef, 0, &tt, &tb)) if (P_GetMidTexturePosition(linedef, 0, &tt, &tb))
{ {
if (thing->z + (thing->height/2) < (tt + tb)/2) if (thing->Z() + (thing->height/2) < (tt + tb)/2)
{ {
if (tb < open.top) if (tb < open.top)
{ {
@ -286,7 +286,7 @@ bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, FLineOpening &
} }
else else
{ {
if (tt > open.bottom && (!restrict || thing->z >= tt)) if (tt > open.bottom && (!restrict || thing->Z() >= tt))
{ {
open.bottom = tt; open.bottom = tt;
open.abovemidtex = true; open.abovemidtex = true;
@ -295,7 +295,7 @@ bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, FLineOpening &
} }
// returns true if it touches the midtexture // returns true if it touches the midtexture
return (abs(thing->z - tt) <= thing->MaxStepHeight); return (abs(thing->Z() - tt) <= thing->MaxStepHeight);
} }
} }
return false; return false;

View File

@ -3441,12 +3441,12 @@ int DLevelScript::DoSpawnSpot (int type, int spot, int tid, int angle, bool forc
while ( (aspot = iterator.Next ()) ) while ( (aspot = iterator.Next ()) )
{ {
spawned += DoSpawn (type, aspot->x, aspot->y, aspot->z, tid, angle, force); spawned += DoSpawn (type, aspot->X(), aspot->Y(), aspot->Z(), tid, angle, force);
} }
} }
else if (activator != NULL) else if (activator != NULL)
{ {
spawned += DoSpawn (type, activator->x, activator->y, activator->z, tid, angle, force); spawned += DoSpawn (type, activator->X(), activator->Y(), activator->Z(), tid, angle, force);
} }
return spawned; return spawned;
} }
@ -3462,12 +3462,12 @@ int DLevelScript::DoSpawnSpotFacing (int type, int spot, int tid, bool force)
while ( (aspot = iterator.Next ()) ) while ( (aspot = iterator.Next ()) )
{ {
spawned += DoSpawn (type, aspot->x, aspot->y, aspot->z, tid, aspot->angle >> 24, force); spawned += DoSpawn (type, aspot->X(), aspot->Y(), aspot->Z(), tid, aspot->angle >> 24, force);
} }
} }
else if (activator != NULL) else if (activator != NULL)
{ {
spawned += DoSpawn (type, activator->x, activator->y, activator->z, tid, activator->angle >> 24, force); spawned += DoSpawn (type, activator->X(), activator->Y(), activator->Z(), tid, activator->angle >> 24, force);
} }
return spawned; return spawned;
} }
@ -4145,7 +4145,7 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b
F3DFloor *ff = sec->e->XFloor.ffloors[i]; F3DFloor *ff = sec->e->XFloor.ffloors[i];
if ((ff->flags & (FF_EXISTS | FF_SOLID)) == (FF_EXISTS | FF_SOLID) && if ((ff->flags & (FF_EXISTS | FF_SOLID)) == (FF_EXISTS | FF_SOLID) &&
actor->z >= ff->top.plane->ZatPoint(actor->x, actor->y)) actor->Z() >= ff->top.plane->ZatPoint(actor))
{ // This floor is beneath our feet. { // This floor is beneath our feet.
secpic = *ff->top.texture; secpic = *ff->top.texture;
break; break;
@ -4158,14 +4158,14 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b
} }
else else
{ {
fixed_t z = actor->z + actor->height; fixed_t z = actor->Z() + actor->height;
// Looking through planes from bottom to top // Looking through planes from bottom to top
for (i = numff-1; i >= 0; --i) for (i = numff-1; i >= 0; --i)
{ {
F3DFloor *ff = sec->e->XFloor.ffloors[i]; F3DFloor *ff = sec->e->XFloor.ffloors[i];
if ((ff->flags & (FF_EXISTS | FF_SOLID)) == (FF_EXISTS | FF_SOLID) && if ((ff->flags & (FF_EXISTS | FF_SOLID)) == (FF_EXISTS | FF_SOLID) &&
z <= ff->bottom.plane->ZatPoint(actor->x, actor->y)) z <= ff->bottom.plane->ZatPoint(actor))
{ // This floor is above our eyes. { // This floor is above our eyes.
secpic = *ff->bottom.texture; secpic = *ff->bottom.texture;
break; break;
@ -4728,8 +4728,8 @@ static bool DoSpawnDecal(AActor *actor, const FDecalTemplate *tpl, int flags, an
{ {
angle += actor->angle; angle += actor->angle;
} }
return NULL != ShootDecal(tpl, actor, actor->Sector, actor->x, actor->y, return NULL != ShootDecal(tpl, actor, actor->Sector, actor->X(), actor->Y(),
actor->z + (actor->height>>1) - actor->floorclip + actor->GetBobOffset() + zofs, actor->Z() + (actor->height>>1) - actor->floorclip + actor->GetBobOffset() + zofs,
angle, distance, !!(flags & SDF_PERMANENT)); angle, distance, !!(flags & SDF_PERMANENT));
} }
@ -8598,11 +8598,11 @@ scriptwait:
} }
else if (pcd == PCD_GETACTORZ) else if (pcd == PCD_GETACTORZ)
{ {
STACK(1) = actor->z + actor->GetBobOffset(); STACK(1) = actor->Z() + actor->GetBobOffset();
} }
else else
{ {
STACK(1) = (&actor->x)[pcd - PCD_GETACTORX]; STACK(1) = pcd == PCD_GETACTORX ? actor->X() : pcd == PCD_GETACTORY ? actor->Y() : actor->Z();
} }
} }
break; break;

View File

@ -356,9 +356,10 @@ static void MakeFountain (AActor *actor, int color1, int color2)
angle_t an = M_Random()<<(24-ANGLETOFINESHIFT); angle_t an = M_Random()<<(24-ANGLETOFINESHIFT);
fixed_t out = FixedMul (actor->radius, M_Random()<<8); fixed_t out = FixedMul (actor->radius, M_Random()<<8);
particle->x = actor->x + FixedMul (out, finecosine[an]); fixedvec3 pos = actor->Vec3Offset(FixedMul(out, finecosine[an]), FixedMul(out, finesine[an]), actor->height + FRACUNIT);
particle->y = actor->y + FixedMul (out, finesine[an]); particle->x = pos.x;
particle->z = actor->z + actor->height + FRACUNIT; particle->y = pos.y;
particle->z = pos.z;
if (out < actor->radius/8) if (out < actor->radius/8)
particle->velz += FRACUNIT*10/3; particle->velz += FRACUNIT*10/3;
else else
@ -395,9 +396,10 @@ void P_RunEffect (AActor *actor, int effects)
{ {
// Rocket trail // Rocket trail
fixed_t backx = actor->x - FixedMul (finecosine[(moveangle)>>ANGLETOFINESHIFT], actor->radius*2);
fixed_t backy = actor->y - FixedMul (finesine[(moveangle)>>ANGLETOFINESHIFT], actor->radius*2); fixed_t backx = - FixedMul (finecosine[(moveangle)>>ANGLETOFINESHIFT], actor->radius*2);
fixed_t backz = actor->z - (actor->height>>3) * (actor->velz>>16) + (2*actor->height)/3; fixed_t backy = - FixedMul (finesine[(moveangle)>>ANGLETOFINESHIFT], actor->radius*2);
fixed_t backz = - (actor->height>>3) * (actor->velz>>16) + (2*actor->height)/3;
angle_t an = (moveangle + ANG90) >> ANGLETOFINESHIFT; angle_t an = (moveangle + ANG90) >> ANGLETOFINESHIFT;
int speed; int speed;
@ -405,9 +407,13 @@ void P_RunEffect (AActor *actor, int effects)
particle = JitterParticle (3 + (M_Random() & 31)); particle = JitterParticle (3 + (M_Random() & 31));
if (particle) { if (particle) {
fixed_t pathdist = M_Random()<<8; fixed_t pathdist = M_Random()<<8;
particle->x = backx - FixedMul(actor->velx, pathdist); fixedvec3 pos = actor->Vec3Offset(
particle->y = backy - FixedMul(actor->vely, pathdist); backx - FixedMul(actor->velx, pathdist),
particle->z = backz - FixedMul(actor->velz, pathdist); backy - FixedMul(actor->vely, pathdist),
backz - FixedMul(actor->velz, pathdist));
particle->x = pos.x;
particle->y = pos.y;
particle->z = pos.z;
speed = (M_Random () - 128) * (FRACUNIT/200); speed = (M_Random () - 128) * (FRACUNIT/200);
particle->velx += FixedMul (speed, finecosine[an]); particle->velx += FixedMul (speed, finecosine[an]);
particle->vely += FixedMul (speed, finesine[an]); particle->vely += FixedMul (speed, finesine[an]);
@ -420,9 +426,13 @@ void P_RunEffect (AActor *actor, int effects)
particle_t *particle = JitterParticle (3 + (M_Random() & 31)); particle_t *particle = JitterParticle (3 + (M_Random() & 31));
if (particle) { if (particle) {
fixed_t pathdist = M_Random()<<8; fixed_t pathdist = M_Random()<<8;
particle->x = backx - FixedMul(actor->velx, pathdist); fixedvec3 pos = actor->Vec3Offset(
particle->y = backy - FixedMul(actor->vely, pathdist); backx - FixedMul(actor->velx, pathdist),
particle->z = backz - FixedMul(actor->velz, pathdist) + (M_Random() << 10); backy - FixedMul(actor->vely, pathdist),
backz - FixedMul(actor->velz, pathdist) + (M_Random() << 10));
particle->x = pos.x;
particle->y = pos.y;
particle->z = pos.z;
speed = (M_Random () - 128) * (FRACUNIT/200); speed = (M_Random () - 128) * (FRACUNIT/200);
particle->velx += FixedMul (speed, finecosine[an]); particle->velx += FixedMul (speed, finecosine[an]);
particle->vely += FixedMul (speed, finesine[an]); particle->vely += FixedMul (speed, finesine[an]);
@ -441,10 +451,12 @@ void P_RunEffect (AActor *actor, int effects)
{ {
// Grenade trail // Grenade trail
P_DrawSplash2 (6, fixedvec3 pos = actor->Vec3Offset(
actor->x - FixedMul (finecosine[(moveangle)>>ANGLETOFINESHIFT], actor->radius*2), -FixedMul(finecosine[(moveangle) >> ANGLETOFINESHIFT], actor->radius * 2),
actor->y - FixedMul (finesine[(moveangle)>>ANGLETOFINESHIFT], actor->radius*2), -FixedMul(finesine[(moveangle) >> ANGLETOFINESHIFT], actor->radius * 2),
actor->z - (actor->height>>3) * (actor->velz>>16) + (2*actor->height)/3, -(actor->height >> 3) * (actor->velz >> 16) + (2 * actor->height) / 3);
P_DrawSplash2 (6, pos.x, pos.y, pos.z,
moveangle + ANG180, 2, 2); moveangle + ANG180, 2, 2);
} }
if (effects & FX_FOUNTAINMASK) if (effects & FX_FOUNTAINMASK)
@ -476,10 +488,11 @@ void P_RunEffect (AActor *actor, int effects)
if (particle != NULL) if (particle != NULL)
{ {
angle_t ang = M_Random () << (32-ANGLETOFINESHIFT-8); angle_t ang = M_Random () << (32-ANGLETOFINESHIFT-8);
particle->x = actor->x + FixedMul (actor->radius, finecosine[ang]); fixedvec3 pos = actor->Vec3Offset(FixedMul (actor->radius, finecosine[ang]), FixedMul (actor->radius, finesine[ang]), 0);
particle->y = actor->y + FixedMul (actor->radius, finesine[ang]); particle->x = pos.x;
particle->y = pos.y;
particle->z = pos.z;
particle->color = *protectColors[M_Random() & 1]; particle->color = *protectColors[M_Random() & 1];
particle->z = actor->z;
particle->velz = FRACUNIT; particle->velz = FRACUNIT;
particle->accz = M_Random () << 7; particle->accz = M_Random () << 7;
particle->size = 1; particle->size = 1;
@ -619,8 +632,8 @@ void P_DrawRailTrail(AActor *source, const TVector3<double> &start, const TVecto
double r; double r;
double dirz; double dirz;
if (abs(mo->x - FLOAT2FIXED(start.X)) < 20 * FRACUNIT if (abs(mo->X() - FLOAT2FIXED(start.X)) < 20 * FRACUNIT
&& (mo->y - FLOAT2FIXED(start.Y)) < 20 * FRACUNIT) && (mo->Y() - FLOAT2FIXED(start.Y)) < 20 * FRACUNIT)
{ // This player (probably) fired the railgun { // This player (probably) fired the railgun
S_Sound (mo, CHAN_WEAPON, sound, 1, ATTN_NORM); S_Sound (mo, CHAN_WEAPON, sound, 1, ATTN_NORM);
} }
@ -630,7 +643,7 @@ void P_DrawRailTrail(AActor *source, const TVector3<double> &start, const TVecto
// Only consider sound in 2D (for now, anyway) // Only consider sound in 2D (for now, anyway)
// [BB] You have to divide by lengthsquared here, not multiply with it. // [BB] You have to divide by lengthsquared here, not multiply with it.
r = ((start.Y - FIXED2DBL(mo->y)) * (-dir.Y) - (start.X - FIXED2DBL(mo->x)) * (dir.X)) / lengthsquared; r = ((start.Y - FIXED2DBL(mo->Y())) * (-dir.Y) - (start.X - FIXED2DBL(mo->X())) * (dir.X)) / lengthsquared;
r = clamp<double>(r, 0., 1.); r = clamp<double>(r, 0., 1.);
dirz = dir.Z; dirz = dir.Z;
@ -832,9 +845,13 @@ void P_DisconnectEffect (AActor *actor)
if (!p) if (!p)
break; break;
p->x = actor->x + ((M_Random()-128)<<9) * (actor->radius>>FRACBITS); fixedvec3 pos = actor->Vec3Offset(
p->y = actor->y + ((M_Random()-128)<<9) * (actor->radius>>FRACBITS); ((M_Random()-128)<<9) * (actor->radius>>FRACBITS),
p->z = actor->z + (M_Random()<<8) * (actor->height>>FRACBITS); ((M_Random()-128)<<9) * (actor->radius>>FRACBITS),
(M_Random()<<8) * (actor->height>>FRACBITS));
p->x = pos.x;
p->y = pos.y;
p->z = pos.z;
p->accz -= FRACUNIT/4096; p->accz -= FRACUNIT/4096;
p->color = M_Random() < 128 ? maroon1 : maroon2; p->color = M_Random() < 128 ? maroon1 : maroon2;
p->size = 4; p->size = 4;

View File

@ -243,9 +243,9 @@ bool AActor::CheckMeleeRange ()
// [RH] Don't melee things too far above or below actor. // [RH] Don't melee things too far above or below actor.
if (!(flags5 & MF5_NOVERTICALMELEERANGE)) if (!(flags5 & MF5_NOVERTICALMELEERANGE))
{ {
if (pl->z > z + height) if (pl->Z() > Z() + height)
return false; return false;
if (pl->z + pl->height < z) if (pl->Z() + pl->height < Z())
return false; return false;
} }
@ -280,11 +280,11 @@ bool P_CheckMeleeRange2 (AActor *actor)
{ {
return false; return false;
} }
if (mo->z > actor->z+actor->height) if (mo->Z() > actor->Z()+actor->height)
{ // Target is higher than the attacker { // Target is higher than the attacker
return false; return false;
} }
else if (actor->z > mo->z+mo->height) else if (actor->Z() > mo->Z()+mo->height)
{ // Attacker is higher { // Attacker is higher
return false; return false;
} }
@ -434,7 +434,7 @@ bool P_Move (AActor *actor)
// it difficult to thrust them vertically in a reasonable manner. // it difficult to thrust them vertically in a reasonable manner.
// [GZ] Let jumping actors jump. // [GZ] Let jumping actors jump.
if (!((actor->flags & MF_NOGRAVITY) || (actor->flags6 & MF6_CANJUMP)) if (!((actor->flags & MF_NOGRAVITY) || (actor->flags6 & MF6_CANJUMP))
&& actor->z > actor->floorz && !(actor->flags2 & MF2_ONMOBJ)) && actor->Z() > actor->floorz && !(actor->flags2 & MF2_ONMOBJ))
{ {
return false; return false;
} }
@ -473,8 +473,8 @@ bool P_Move (AActor *actor)
} }
} }
tryx = (origx = actor->x) + (deltax = FixedMul (speed, xspeed[actor->movedir])); tryx = (origx = actor->X()) + (deltax = FixedMul (speed, xspeed[actor->movedir]));
tryy = (origy = actor->y) + (deltay = FixedMul (speed, yspeed[actor->movedir])); tryy = (origy = actor->Y()) + (deltay = FixedMul (speed, yspeed[actor->movedir]));
// Like P_XYMovement this should do multiple moves if the step size is too large // Like P_XYMovement this should do multiple moves if the step size is too large
@ -519,15 +519,14 @@ bool P_Move (AActor *actor)
// so make it switchable // so make it switchable
if (nomonsterinterpolation) if (nomonsterinterpolation)
{ {
actor->PrevX = actor->x; actor->PrevX = actor->X();
actor->PrevY = actor->y; actor->PrevY = actor->Y();
actor->PrevZ = actor->z; actor->PrevZ = actor->Z();
} }
if (try_ok && friction > ORIG_FRICTION) if (try_ok && friction > ORIG_FRICTION)
{ {
actor->x = origx; actor->SetOrigin(origx, origy, actor->Z(), false);
actor->y = origy;
movefactor *= FRACUNIT / ORIG_FRICTION_FACTOR / 4; movefactor *= FRACUNIT / ORIG_FRICTION_FACTOR / 4;
actor->velx += FixedMul (deltax, movefactor); actor->velx += FixedMul (deltax, movefactor);
actor->vely += FixedMul (deltay, movefactor); actor->vely += FixedMul (deltay, movefactor);
@ -538,22 +537,22 @@ bool P_Move (AActor *actor)
// actually walking down a step. // actually walking down a step.
if (try_ok && if (try_ok &&
!((actor->flags & MF_NOGRAVITY) || (actor->flags6 & MF6_CANJUMP)) !((actor->flags & MF_NOGRAVITY) || (actor->flags6 & MF6_CANJUMP))
&& actor->z > actor->floorz && !(actor->flags2 & MF2_ONMOBJ)) && actor->Z() > actor->floorz && !(actor->flags2 & MF2_ONMOBJ))
{ {
if (actor->z <= actor->floorz + actor->MaxStepHeight) if (actor->Y() <= actor->floorz + actor->MaxStepHeight)
{ {
fixed_t savedz = actor->z; fixed_t savedz = actor->Z();
actor->z = actor->floorz; actor->SetZ(actor->floorz);
// Make sure that there isn't some other actor between us and // Make sure that there isn't some other actor between us and
// the floor we could get stuck in. The old code did not do this. // the floor we could get stuck in. The old code did not do this.
if (!P_TestMobjZ(actor)) if (!P_TestMobjZ(actor))
{ {
actor->z = savedz; actor->SetZ(savedz);
} }
else else
{ // The monster just hit the floor, so trigger any actions. { // The monster just hit the floor, so trigger any actions.
if (actor->floorsector->SecActTarget != NULL && if (actor->floorsector->SecActTarget != NULL &&
actor->floorz == actor->floorsector->floorplane.ZatPoint(actor->x, actor->y)) actor->floorz == actor->floorsector->floorplane.ZatPoint(actor))
{ {
actor->floorsector->SecActTarget->TriggerAction(actor, SECSPAC_HitFloor); actor->floorsector->SecActTarget->TriggerAction(actor, SECSPAC_HitFloor);
} }
@ -566,12 +565,12 @@ bool P_Move (AActor *actor)
{ {
if (((actor->flags6 & MF6_CANJUMP)||(actor->flags & MF_FLOAT)) && tm.floatok) if (((actor->flags6 & MF6_CANJUMP)||(actor->flags & MF_FLOAT)) && tm.floatok)
{ // must adjust height { // must adjust height
fixed_t savedz = actor->z; fixed_t savedz = actor->Z();
if (actor->z < tm.floorz) if (actor->Z() < tm.floorz)
actor->z += actor->FloatSpeed; actor->SetZ(actor->Z() + actor->FloatSpeed);
else else
actor->z -= actor->FloatSpeed; actor->SetZ(actor->Z() - actor->FloatSpeed);
// [RH] Check to make sure there's nothing in the way of the float // [RH] Check to make sure there's nothing in the way of the float
@ -580,7 +579,7 @@ bool P_Move (AActor *actor)
actor->flags |= MF_INFLOAT; actor->flags |= MF_INFLOAT;
return true; return true;
} }
actor->z = savedz; actor->SetZ(savedz);
} }
if (!spechit.Size ()) if (!spechit.Size ())
@ -812,28 +811,25 @@ void P_DoNewChaseDir (AActor *actor, fixed_t deltax, fixed_t deltay)
void P_NewChaseDir(AActor * actor) void P_NewChaseDir(AActor * actor)
{ {
fixed_t deltax; fixedvec2 delta;
fixed_t deltay;
actor->strafecount = 0; actor->strafecount = 0;
if ((actor->flags5&MF5_CHASEGOAL || actor->goal == actor->target) && actor->goal!=NULL) if ((actor->flags5&MF5_CHASEGOAL || actor->goal == actor->target) && actor->goal!=NULL)
{ {
deltax = actor->goal->x - actor->x; delta = actor->Vec2To(actor->goal);
deltay = actor->goal->y - actor->y;
} }
else if (actor->target != NULL) else if (actor->target != NULL)
{ {
deltax = actor->target->x - actor->x; delta = actor->Vec2To(actor->target);
deltay = actor->target->y - actor->y;
if (!(actor->flags6 & MF6_NOFEAR)) if (!(actor->flags6 & MF6_NOFEAR))
{ {
if ((actor->target->player != NULL && (actor->target->player->cheats & CF_FRIGHTENING)) || if ((actor->target->player != NULL && (actor->target->player->cheats & CF_FRIGHTENING)) ||
(actor->flags4 & MF4_FRIGHTENED)) (actor->flags4 & MF4_FRIGHTENED))
{ {
deltax = -deltax; delta.x = -delta.x;
deltay = -deltay; delta.y = -delta.y;
} }
} }
} }
@ -847,11 +843,11 @@ void P_NewChaseDir(AActor * actor)
// Try to move away from a dropoff // Try to move away from a dropoff
if (actor->floorz - actor->dropoffz > actor->MaxDropOffHeight && if (actor->floorz - actor->dropoffz > actor->MaxDropOffHeight &&
actor->z <= actor->floorz && !(actor->flags & MF_DROPOFF) && actor->Z() <= actor->floorz && !(actor->flags & MF_DROPOFF) &&
!(actor->flags2 & MF2_ONMOBJ) && !(actor->flags2 & MF2_ONMOBJ) &&
!(actor->flags & MF_FLOAT) && !(i_compatflags & COMPATF_DROPOFF)) !(actor->flags & MF_FLOAT) && !(i_compatflags & COMPATF_DROPOFF))
{ {
FBoundingBox box(actor->x, actor->y, actor->radius); FBoundingBox box(actor->X(), actor->Y(), actor->radius);
FBlockLinesIterator it(box); FBlockLinesIterator it(box);
line_t *line; line_t *line;
@ -866,18 +862,18 @@ void P_NewChaseDir(AActor * actor)
box.Bottom() < line->bbox[BOXTOP] && box.Bottom() < line->bbox[BOXTOP] &&
box.BoxOnLineSide(line) == -1) box.BoxOnLineSide(line) == -1)
{ {
fixed_t front = line->frontsector->floorplane.ZatPoint(actor->x,actor->y); fixed_t front = line->frontsector->floorplane.ZatPoint(actor);
fixed_t back = line->backsector->floorplane.ZatPoint(actor->x,actor->y); fixed_t back = line->backsector->floorplane.ZatPoint(actor);
angle_t angle; angle_t angle;
// The monster must contact one of the two floors, // The monster must contact one of the two floors,
// and the other must be a tall dropoff. // and the other must be a tall dropoff.
if (back == actor->z && front < actor->z - actor->MaxDropOffHeight) if (back == actor->Z() && front < actor->Z() - actor->MaxDropOffHeight)
{ {
angle = R_PointToAngle2(0,0,line->dx,line->dy); // front side dropoff angle = R_PointToAngle2(0,0,line->dx,line->dy); // front side dropoff
} }
else if (front == actor->z && back < actor->z - actor->MaxDropOffHeight) else if (front == actor->Z() && back < actor->Z() - actor->MaxDropOffHeight)
{ {
angle = R_PointToAngle2(line->dx,line->dy,0,0); // back side dropoff angle = R_PointToAngle2(line->dx,line->dy,0,0); // back side dropoff
} }
@ -946,12 +942,12 @@ void P_NewChaseDir(AActor * actor)
if (ismeleeattacker) if (ismeleeattacker)
{ {
actor->strafecount = pr_enemystrafe() & 15; actor->strafecount = pr_enemystrafe() & 15;
deltax = -deltax, deltay = -deltay; delta.x = -delta.x, delta.y = -delta.y;
} }
} }
} }
P_DoNewChaseDir(actor, deltax, deltay); P_DoNewChaseDir(actor, delta.x, delta.y);
// If strafing, set movecount to strafecount so that old Doom // If strafing, set movecount to strafecount so that old Doom
// logic still works the same, except in the strafing part // logic still works the same, except in the strafing part
@ -983,7 +979,7 @@ void P_RandomChaseDir (AActor *actor)
if (actor->flags & MF_FRIENDLY) if (actor->flags & MF_FRIENDLY)
{ {
AActor *player; AActor *player;
fixed_t deltax, deltay; fixedvec2 delta;
dirtype_t d[3]; dirtype_t d[3];
if (actor->FriendPlayer != 0) if (actor->FriendPlayer != 0)
@ -1005,19 +1001,18 @@ void P_RandomChaseDir (AActor *actor)
{ {
if (pr_newchasedir() & 1 || !P_CheckSight (actor, player)) if (pr_newchasedir() & 1 || !P_CheckSight (actor, player))
{ {
deltax = player->x - actor->x; delta = actor->Vec2To(player);
deltay = player->y - actor->y;
if (deltax>128*FRACUNIT) if (delta.x>128*FRACUNIT)
d[1]= DI_EAST; d[1]= DI_EAST;
else if (deltax<-128*FRACUNIT) else if (delta.x<-128*FRACUNIT)
d[1]= DI_WEST; d[1]= DI_WEST;
else else
d[1]=DI_NODIR; d[1]=DI_NODIR;
if (deltay<-128*FRACUNIT) if (delta.y<-128*FRACUNIT)
d[2]= DI_SOUTH; d[2]= DI_SOUTH;
else if (deltay>128*FRACUNIT) else if (delta.y>128*FRACUNIT)
d[2]= DI_NORTH; d[2]= DI_NORTH;
else else
d[2]=DI_NODIR; d[2]=DI_NODIR;
@ -1025,13 +1020,13 @@ void P_RandomChaseDir (AActor *actor)
// try direct route // try direct route
if (d[1] != DI_NODIR && d[2] != DI_NODIR) if (d[1] != DI_NODIR && d[2] != DI_NODIR)
{ {
actor->movedir = diags[((deltay<0)<<1) + (deltax>0)]; actor->movedir = diags[((delta.y<0)<<1) + (delta.x>0)];
if (actor->movedir != turnaround && P_TryWalk(actor)) if (actor->movedir != turnaround && P_TryWalk(actor))
return; return;
} }
// try other directions // try other directions
if (pr_newchasedir() > 200 || abs(deltay) > abs(deltax)) if (pr_newchasedir() > 200 || abs(delta.y) > abs(delta.x))
{ {
swapvalues (d[1], d[2]); swapvalues (d[1], d[2]);
} }
@ -2474,8 +2469,8 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi
if ((!fastchase || !actor->FastChaseStrafeCount) && !dontmove) if ((!fastchase || !actor->FastChaseStrafeCount) && !dontmove)
{ {
// CANTLEAVEFLOORPIC handling was completely missing in the non-serpent functions. // CANTLEAVEFLOORPIC handling was completely missing in the non-serpent functions.
fixed_t oldX = actor->x; fixed_t oldX = actor->X();
fixed_t oldY = actor->y; fixed_t oldY = actor->Y();
FTextureID oldFloor = actor->floorpic; FTextureID oldFloor = actor->floorpic;
// chase towards player // chase towards player
@ -2526,11 +2521,12 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates)
if (self->movedir != DI_NODIR) if (self->movedir != DI_NODIR)
{ {
const fixed_t absSpeed = abs (self->Speed); const fixed_t absSpeed = abs (self->Speed);
fixed_t viletryx = self->x + FixedMul (absSpeed, xspeed[self->movedir]); fixedvec2 viletry = self->Vec2Offset(
fixed_t viletryy = self->y + FixedMul (absSpeed, yspeed[self->movedir]); FixedMul (absSpeed, xspeed[self->movedir]),
FixedMul (absSpeed, yspeed[self->movedir]), true);
AActor *corpsehit; AActor *corpsehit;
FBlockThingsIterator it(FBoundingBox(viletryx, viletryy, 32*FRACUNIT)); FBlockThingsIterator it(FBoundingBox(viletry.x, viletry.y, 32*FRACUNIT));
while ((corpsehit = it.Next())) while ((corpsehit = it.Next()))
{ {
FState *raisestate = corpsehit->GetRaiseState(); FState *raisestate = corpsehit->GetRaiseState();
@ -2539,8 +2535,8 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates)
// use the current actor's radius instead of the Arch Vile's default. // use the current actor's radius instead of the Arch Vile's default.
fixed_t maxdist = corpsehit->GetDefault()->radius + self->radius; fixed_t maxdist = corpsehit->GetDefault()->radius + self->radius;
if (abs(corpsehit->x - viletryx) > maxdist || if (abs(corpsehit->X() - viletry.x) > maxdist ||
abs(corpsehit->y - viletryy) > maxdist) abs(corpsehit->Y() - viletry.y) > maxdist)
continue; // not actually touching continue; // not actually touching
// Let's check if there are floors in between the archvile and its target // Let's check if there are floors in between the archvile and its target
sector_t *vilesec = self->Sector; sector_t *vilesec = self->Sector;
@ -2551,11 +2547,11 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates)
if (testsec) if (testsec)
{ {
fixed_t zdist1, zdist2; fixed_t zdist1, zdist2;
if (P_Find3DFloor(testsec, corpsehit->x, corpsehit->y, corpsehit->z, false, true, zdist1) if (P_Find3DFloor(testsec, corpsehit->X(), corpsehit->Y(), corpsehit->Z(), false, true, zdist1)
!= P_Find3DFloor(testsec, self->x, self->y, self->z, false, true, zdist2)) != P_Find3DFloor(testsec, self->X(), self->Y(), self->Z(), false, true, zdist2))
{ {
// Not on same floor // Not on same floor
if (vilesec == corpsec || abs(zdist1 - self->z) > self->height) if (vilesec == corpsec || abs(zdist1 - self->Z()) > self->height)
continue; continue;
} }
} }
@ -2569,7 +2565,7 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates)
corpsehit->flags |= MF_SOLID; corpsehit->flags |= MF_SOLID;
corpsehit->height = corpsehit->GetDefault()->height; corpsehit->height = corpsehit->GetDefault()->height;
bool check = P_CheckPosition(corpsehit, corpsehit->x, corpsehit->y); bool check = P_CheckPosition(corpsehit, corpsehit->X(), corpsehit->Y());
corpsehit->flags = oldflags; corpsehit->flags = oldflags;
corpsehit->radius = oldradius; corpsehit->radius = oldradius;
corpsehit->height = oldheight; corpsehit->height = oldheight;
@ -2783,34 +2779,33 @@ void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch, a
{ {
// [DH] Don't need to do proper fixed->double conversion, since the // [DH] Don't need to do proper fixed->double conversion, since the
// result is only used in a ratio. // result is only used in a ratio.
double dist_x = other->x - self->x; fixedvec2 dist = self->Vec2To(other);
double dist_y = other->y - self->y;
// Positioning ala missile spawning, 32 units above foot level // Positioning ala missile spawning, 32 units above foot level
fixed_t source_z = self->z + 32*FRACUNIT + self->GetBobOffset(); fixed_t source_z = self->Z() + 32*FRACUNIT + self->GetBobOffset();
fixed_t target_z = other->z + 32*FRACUNIT + other->GetBobOffset(); fixed_t target_z = other->Z() + 32*FRACUNIT + other->GetBobOffset();
// If the target z is above the target's head, reposition to the middle of // If the target z is above the target's head, reposition to the middle of
// its body. // its body.
if (target_z >= other->z + other->height) if (target_z >= other->Z() + other->height)
{ {
target_z = other->z + (other->height / 2); target_z = other->Z() + (other->height / 2);
} }
//Note there is no +32*FRACUNIT on purpose. This is for customization sake. //Note there is no +32*FRACUNIT on purpose. This is for customization sake.
//If one doesn't want this behavior, just don't use FAF_BOTTOM. //If one doesn't want this behavior, just don't use FAF_BOTTOM.
if (flags & FAF_BOTTOM) if (flags & FAF_BOTTOM)
target_z = other->z + other->GetBobOffset(); target_z = other->Z() + other->GetBobOffset();
if (flags & FAF_MIDDLE) if (flags & FAF_MIDDLE)
target_z = other->z + (other->height / 2) + other->GetBobOffset(); target_z = other->Z() + (other->height / 2) + other->GetBobOffset();
if (flags & FAF_TOP) if (flags & FAF_TOP)
target_z = other->z + (other->height) + other->GetBobOffset(); target_z = other->Z() + (other->height) + other->GetBobOffset();
if (!(flags & FAF_NODISTFACTOR)) if (!(flags & FAF_NODISTFACTOR))
target_z += pitch_offset; target_z += pitch_offset;
double dist_z = target_z - source_z; double dist_z = target_z - source_z;
double dist = sqrt(dist_x*dist_x + dist_y*dist_y + dist_z*dist_z); double ddist = sqrt(dist.x*dist.x + dist.y*dist.y + dist_z*dist_z);
int other_pitch = (int)rad2bam(asin(dist_z / dist)); int other_pitch = (int)rad2bam(asin(dist_z / ddist));
if (max_pitch != 0) if (max_pitch != 0)
{ {
@ -2922,9 +2917,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail)
if (linetarget == NULL) if (linetarget == NULL)
{ {
// We probably won't hit the target, but aim at it anyway so we don't look stupid. // We probably won't hit the target, but aim at it anyway so we don't look stupid.
TVector2<double> xydiff(self->target->x - self->x, self->target->y - self->y); TVector2<double> xydiff = self->Vec2To(self->target);
double zdiff = (self->target->z + (self->target->height>>1)) - double zdiff = (self->target->Z() + (self->target->height>>1)) -
(self->z + (self->height>>1) - self->floorclip); (self->Z() + (self->height>>1) - self->floorclip);
self->pitch = int(atan2(zdiff, xydiff.Length()) * ANGLE_180 / -M_PI); self->pitch = int(atan2(zdiff, xydiff.Length()) * ANGLE_180 / -M_PI);
} }
@ -3072,7 +3067,7 @@ AInventory *P_DropItem (AActor *source, const PClass *type, int dropamount, int
AActor *mo; AActor *mo;
fixed_t spawnz; fixed_t spawnz;
spawnz = source->z; spawnz = source->Z();
if (!(i_compatflags & COMPATF_NOTOSSDROPS)) if (!(i_compatflags & COMPATF_NOTOSSDROPS))
{ {
int style = sv_dropstyle; int style = sv_dropstyle;
@ -3087,7 +3082,7 @@ AInventory *P_DropItem (AActor *source, const PClass *type, int dropamount, int
spawnz += source->height / 2; spawnz += source->height / 2;
} }
} }
mo = Spawn (type, source->x, source->y, spawnz, ALLOW_REPLACE); mo = Spawn (type, source->X(), source->Y(), spawnz, ALLOW_REPLACE);
if (mo != NULL) if (mo != NULL)
{ {
mo->flags |= MF_DROPPED; mo->flags |= MF_DROPPED;

View File

@ -84,7 +84,7 @@ FName MeansOfDeath;
// //
void P_TouchSpecialThing (AActor *special, AActor *toucher) void P_TouchSpecialThing (AActor *special, AActor *toucher)
{ {
fixed_t delta = special->z - toucher->z; fixed_t delta = special->Z() - toucher->Z();
// The pickup is at or above the toucher's feet OR // The pickup is at or above the toucher's feet OR
// The pickup is below the toucher. // The pickup is below the toucher.
@ -1158,7 +1158,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
// If the origin and target are in exactly the same spot, choose a random direction. // If the origin and target are in exactly the same spot, choose a random direction.
// (Most likely cause is from telefragging somebody during spawning because they // (Most likely cause is from telefragging somebody during spawning because they
// haven't moved from their spawn spot at all.) // haven't moved from their spawn spot at all.)
if (origin->x == target->x && origin->y == target->y) if (origin->X() == target->X() && origin->Y() == target->Y())
{ {
ang = pr_kickbackdir.GenRand32(); ang = pr_kickbackdir.GenRand32();
} }
@ -1184,7 +1184,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
// make fall forwards sometimes // make fall forwards sometimes
if ((damage < 40) && (damage > target->health) if ((damage < 40) && (damage > target->health)
&& (target->z - origin->z > 64*FRACUNIT) && (target->Z() - origin->Z() > 64*FRACUNIT)
&& (pr_damagemobj()&1) && (pr_damagemobj()&1)
// [RH] But only if not too fast and not flying // [RH] But only if not too fast and not flying
&& thrust < 10*FRACUNIT && thrust < 10*FRACUNIT

View File

@ -148,7 +148,7 @@ FUNC(LS_Polyobj_MoveToSpot)
FActorIterator iterator (arg2); FActorIterator iterator (arg2);
AActor *spot = iterator.Next(); AActor *spot = iterator.Next();
if (spot == NULL) return false; if (spot == NULL) return false;
return EV_MovePolyTo (ln, arg0, SPEED(arg1), spot->x, spot->y, false); return EV_MovePolyTo (ln, arg0, SPEED(arg1), spot->X(), spot->Y(), false);
} }
FUNC(LS_Polyobj_DoorSwing) FUNC(LS_Polyobj_DoorSwing)
@ -199,7 +199,7 @@ FUNC(LS_Polyobj_OR_MoveToSpot)
FActorIterator iterator (arg2); FActorIterator iterator (arg2);
AActor *spot = iterator.Next(); AActor *spot = iterator.Next();
if (spot == NULL) return false; if (spot == NULL) return false;
return EV_MovePolyTo (ln, arg0, SPEED(arg1), spot->x, spot->y, true); return EV_MovePolyTo (ln, arg0, SPEED(arg1), spot->X(), spot->Y(), true);
} }
FUNC(LS_Polyobj_Stop) FUNC(LS_Polyobj_Stop)
@ -3107,7 +3107,7 @@ FUNC(LS_GlassBreak)
{ {
glass = Spawn("GlassJunk", x, y, ONFLOORZ, ALLOW_REPLACE); glass = Spawn("GlassJunk", x, y, ONFLOORZ, ALLOW_REPLACE);
glass->z += 24 * FRACUNIT; glass->SetZ(glass->z + 24 * FRACUNIT);
glass->SetState (glass->SpawnState + (pr_glass() % glass->health)); glass->SetState (glass->SpawnState + (pr_glass() % glass->health));
an = pr_glass() << (32-8); an = pr_glass() << (32-8);
glass->angle = an; glass->angle = an;

View File

@ -52,6 +52,7 @@
#include "p_conversation.h" #include "p_conversation.h"
#include "r_data/r_translate.h" #include "r_data/r_translate.h"
#include "g_level.h" #include "g_level.h"
#include "r_sky.h"
CVAR(Bool, cl_bloodsplats, true, CVAR_ARCHIVE) CVAR(Bool, cl_bloodsplats, true, CVAR_ARCHIVE)
CVAR(Int, sv_smartaim, 0, CVAR_ARCHIVE | CVAR_SERVERINFO) CVAR(Int, sv_smartaim, 0, CVAR_ARCHIVE | CVAR_SERVERINFO)
@ -592,8 +593,8 @@ int P_GetFriction(const AActor *mo, int *frictionfactor)
if (!(rover->flags & FF_EXISTS)) continue; if (!(rover->flags & FF_EXISTS)) continue;
if (!(rover->flags & FF_SWIMMABLE)) continue; if (!(rover->flags & FF_SWIMMABLE)) continue;
if (mo->z > rover->top.plane->ZatPoint(mo->x, mo->y) || if (mo->z > rover->top.plane->ZatPoint(mo) ||
mo->z < rover->bottom.plane->ZatPoint(mo->x, mo->y)) mo->z < rover->bottom.plane->ZatPoint(mo))
continue; continue;
newfriction = secfriction(rover->model, rover->top.isceiling); newfriction = secfriction(rover->model, rover->top.isceiling);
@ -622,13 +623,13 @@ int P_GetFriction(const AActor *mo, int *frictionfactor)
if (rover->flags & FF_SOLID) if (rover->flags & FF_SOLID)
{ {
// Must be standing on a solid floor // Must be standing on a solid floor
if (mo->z != rover->top.plane->ZatPoint(mo->x, mo->y)) continue; if (mo->z != rover->top.plane->ZatPoint(mo)) continue;
} }
else if (rover->flags & FF_SWIMMABLE) else if (rover->flags & FF_SWIMMABLE)
{ {
// Or on or inside a swimmable floor (e.g. in shallow water) // Or on or inside a swimmable floor (e.g. in shallow water)
if (mo->z > rover->top.plane->ZatPoint(mo->x, mo->y) || if (mo->z > rover->top.plane->ZatPoint(mo) ||
(mo->z + mo->height) < rover->bottom.plane->ZatPoint(mo->x, mo->y)) (mo->z + mo->height) < rover->bottom.plane->ZatPoint(mo))
continue; continue;
} }
else else
@ -649,9 +650,9 @@ int P_GetFriction(const AActor *mo, int *frictionfactor)
} }
newfriction = secfriction(sec); newfriction = secfriction(sec);
if ((newfriction < friction || friction == ORIG_FRICTION) && if ((newfriction < friction || friction == ORIG_FRICTION) &&
(mo->z <= sec->floorplane.ZatPoint(mo->x, mo->y) || (mo->z <= sec->floorplane.ZatPoint(mo) ||
(sec->GetHeightSec() != NULL && (sec->GetHeightSec() != NULL &&
mo->z <= sec->heightsec->floorplane.ZatPoint(mo->x, mo->y)))) mo->z <= sec->heightsec->floorplane.ZatPoint(mo))))
{ {
friction = newfriction; friction = newfriction;
movefactor = secmovefac(sec); movefactor = secmovefac(sec);
@ -1797,10 +1798,10 @@ static void CheckForPushSpecial(line_t *line, int side, AActor *mobj, bool windo
if (windowcheck && !(ib_compatflags & BCOMPATF_NOWINDOWCHECK) && line->backsector != NULL) if (windowcheck && !(ib_compatflags & BCOMPATF_NOWINDOWCHECK) && line->backsector != NULL)
{ // Make sure this line actually blocks us and is not a window { // Make sure this line actually blocks us and is not a window
// or similar construct we are standing inside of. // or similar construct we are standing inside of.
fixed_t fzt = line->frontsector->ceilingplane.ZatPoint(mobj->x, mobj->y); fixed_t fzt = line->frontsector->ceilingplane.ZatPoint(mobj);
fixed_t fzb = line->frontsector->floorplane.ZatPoint(mobj->x, mobj->y); fixed_t fzb = line->frontsector->floorplane.ZatPoint(mobj);
fixed_t bzt = line->backsector->ceilingplane.ZatPoint(mobj->x, mobj->y); fixed_t bzt = line->backsector->ceilingplane.ZatPoint(mobj);
fixed_t bzb = line->backsector->floorplane.ZatPoint(mobj->x, mobj->y); fixed_t bzb = line->backsector->floorplane.ZatPoint(mobj);
if (fzt >= mobj->z + mobj->height && bzt >= mobj->z + mobj->height && if (fzt >= mobj->z + mobj->height && bzt >= mobj->z + mobj->height &&
fzb <= mobj->z && bzb <= mobj->z) fzb <= mobj->z && bzb <= mobj->z)
{ {
@ -1811,8 +1812,8 @@ static void CheckForPushSpecial(line_t *line, int side, AActor *mobj, bool windo
if (!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue; if (!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue;
fixed_t ff_bottom = rover->bottom.plane->ZatPoint(mobj->x, mobj->y); fixed_t ff_bottom = rover->bottom.plane->ZatPoint(mobj);
fixed_t ff_top = rover->top.plane->ZatPoint(mobj->x, mobj->y); fixed_t ff_top = rover->top.plane->ZatPoint(mobj);
if (ff_bottom < mobj->z + mobj->height && ff_top > mobj->z) if (ff_bottom < mobj->z + mobj->height && ff_top > mobj->z)
{ {
@ -2082,8 +2083,8 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
{ {
fixed_t eyez = oldz + viewheight; fixed_t eyez = oldz + viewheight;
oldAboveFakeFloor = eyez > oldsec->heightsec->floorplane.ZatPoint(thing->x, thing->y); oldAboveFakeFloor = eyez > oldsec->heightsec->floorplane.ZatPoint(thing);
oldAboveFakeCeiling = eyez > oldsec->heightsec->ceilingplane.ZatPoint(thing->x, thing->y); oldAboveFakeCeiling = eyez > oldsec->heightsec->ceilingplane.ZatPoint(thing);
} }
// Borrowed from MBF: // Borrowed from MBF:
@ -2742,14 +2743,14 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov
} }
const secplane_t *plane = &actor->floorsector->floorplane; const secplane_t *plane = &actor->floorsector->floorplane;
fixed_t planezhere = plane->ZatPoint(actor->x, actor->y); fixed_t planezhere = plane->ZatPoint(actor);
for (unsigned int i = 0; i<actor->floorsector->e->XFloor.ffloors.Size(); i++) for (unsigned int i = 0; i<actor->floorsector->e->XFloor.ffloors.Size(); i++)
{ {
F3DFloor * rover = actor->floorsector->e->XFloor.ffloors[i]; F3DFloor * rover = actor->floorsector->e->XFloor.ffloors[i];
if (!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue; if (!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue;
fixed_t thisplanez = rover->top.plane->ZatPoint(actor->x, actor->y); fixed_t thisplanez = rover->top.plane->ZatPoint(actor);
if (thisplanez>planezhere && thisplanez <= actor->z + actor->MaxStepHeight) if (thisplanez>planezhere && thisplanez <= actor->z + actor->MaxStepHeight)
{ {
@ -2767,7 +2768,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov
F3DFloor * rover = actor->Sector->e->XFloor.ffloors[i]; F3DFloor * rover = actor->Sector->e->XFloor.ffloors[i];
if (!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue; if (!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue;
fixed_t thisplanez = rover->top.plane->ZatPoint(actor->x, actor->y); fixed_t thisplanez = rover->top.plane->ZatPoint(actor);
if (thisplanez>planezhere && thisplanez <= actor->z + actor->MaxStepHeight) if (thisplanez>planezhere && thisplanez <= actor->z + actor->MaxStepHeight)
{ {
@ -4293,6 +4294,8 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
if (puffclass != NULL && puffDefaults->flags3 & MF3_ALWAYSPUFF) if (puffclass != NULL && puffDefaults->flags3 & MF3_ALWAYSPUFF)
{ {
puff = P_SpawnPuff(source, puffclass, trace.X, trace.Y, trace.Z, (source->angle + angleoffset) - ANG90, 1, 0); puff = P_SpawnPuff(source, puffclass, trace.X, trace.Y, trace.Z, (source->angle + angleoffset) - ANG90, 1, 0);
if (puff && (trace.Line != NULL) && (trace.Line->special == Line_Horizon) && !(puff->flags3 & MF3_SKYEXPLODE))
puff->Destroy();
} }
if (puff != NULL && puffDefaults->flags7 & MF7_FORCEDECAL && puff->DecalGenerator) if (puff != NULL && puffDefaults->flags7 & MF7_FORCEDECAL && puff->DecalGenerator)
SpawnShootDecal(puff, trace); SpawnShootDecal(puff, trace);
@ -4306,6 +4309,12 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
if (puffclass != NULL && puffDefaults->flags3 & MF3_ALWAYSPUFF) if (puffclass != NULL && puffDefaults->flags3 & MF3_ALWAYSPUFF)
{ {
puff = P_SpawnPuff(source, puffclass, trace.X, trace.Y, trace.Z, (source->angle + angleoffset) - ANG90, 1, 0); puff = P_SpawnPuff(source, puffclass, trace.X, trace.Y, trace.Z, (source->angle + angleoffset) - ANG90, 1, 0);
if (puff && !(puff->flags3 & MF3_SKYEXPLODE) &&
(((trace.HitType == TRACE_HitFloor) && (puff->floorpic == skyflatnum)) ||
((trace.HitType == TRACE_HitCeiling) && (puff->ceilingpic == skyflatnum))))
{
puff->Destroy();
}
} }
} }
if (thepuff != NULL) if (thepuff != NULL)

View File

@ -585,7 +585,7 @@ sector_t *AActor::LinkToWorldForMapThing ()
return ssec->sector; return ssec->sector;
} }
void AActor::SetOrigin (fixed_t ix, fixed_t iy, fixed_t iz) void AActor::SetOrigin (fixed_t ix, fixed_t iy, fixed_t iz, bool moving)
{ {
UnlinkFromWorld (); UnlinkFromWorld ();
x = ix; x = ix;

View File

@ -2077,7 +2077,7 @@ explode:
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 &&
mo->z >= tm.ceilingline->backsector->ceilingplane.ZatPoint (mo->x, mo->y)) mo->z >= tm.ceilingline->backsector->ceilingplane.ZatPoint(mo))
{ {
// 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.
@ -2161,7 +2161,7 @@ explode:
{ // Don't stop sliding if halfway off a step with some velocity { // Don't stop sliding if halfway off a step with some velocity
if (mo->velx > FRACUNIT/4 || mo->velx < -FRACUNIT/4 || mo->vely > FRACUNIT/4 || mo->vely < -FRACUNIT/4) if (mo->velx > FRACUNIT/4 || mo->velx < -FRACUNIT/4 || mo->vely > FRACUNIT/4 || mo->vely < -FRACUNIT/4)
{ {
if (mo->floorz > mo->Sector->floorplane.ZatPoint (mo->x, mo->y)) if (mo->floorz > mo->Sector->floorplane.ZatPoint(mo))
{ {
if (mo->dropoffz != mo->floorz) // 3DMidtex or other special cases that must be excluded if (mo->dropoffz != mo->floorz) // 3DMidtex or other special cases that must be excluded
{ {
@ -2407,7 +2407,7 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz)
{ // Hit the floor { // Hit the floor
if ((!mo->player || !(mo->player->cheats & CF_PREDICTING)) && if ((!mo->player || !(mo->player->cheats & CF_PREDICTING)) &&
mo->Sector->SecActTarget != NULL && mo->Sector->SecActTarget != NULL &&
mo->Sector->floorplane.ZatPoint (mo->x, mo->y) == mo->floorz) mo->Sector->floorplane.ZatPoint(mo) == mo->floorz)
{ // [RH] Let the sector do something to the actor { // [RH] Let the sector do something to the actor
mo->Sector->SecActTarget->TriggerAction (mo, SECSPAC_HitFloor); mo->Sector->SecActTarget->TriggerAction (mo, SECSPAC_HitFloor);
} }
@ -2509,7 +2509,7 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz)
{ // hit the ceiling { // hit the ceiling
if ((!mo->player || !(mo->player->cheats & CF_PREDICTING)) && if ((!mo->player || !(mo->player->cheats & CF_PREDICTING)) &&
mo->Sector->SecActTarget != NULL && mo->Sector->SecActTarget != NULL &&
mo->Sector->ceilingplane.ZatPoint (mo->x, mo->y) == mo->ceilingz) mo->Sector->ceilingplane.ZatPoint(mo) == mo->ceilingz)
{ // [RH] Let the sector do something to the actor { // [RH] Let the sector do something to the actor
mo->Sector->SecActTarget->TriggerAction (mo, SECSPAC_HitCeiling); mo->Sector->SecActTarget->TriggerAction (mo, SECSPAC_HitCeiling);
} }
@ -2564,7 +2564,7 @@ void P_CheckFakeFloorTriggers (AActor *mo, fixed_t oldz, bool oldz_has_viewheigh
if (sec->heightsec != NULL && sec->SecActTarget != NULL) if (sec->heightsec != NULL && sec->SecActTarget != NULL)
{ {
sector_t *hs = sec->heightsec; sector_t *hs = sec->heightsec;
fixed_t waterz = hs->floorplane.ZatPoint (mo->x, mo->y); fixed_t waterz = hs->floorplane.ZatPoint(mo);
fixed_t newz; fixed_t newz;
fixed_t viewheight; fixed_t viewheight;
@ -2599,7 +2599,7 @@ void P_CheckFakeFloorTriggers (AActor *mo, fixed_t oldz, bool oldz_has_viewheigh
if (!(hs->MoreFlags & SECF_FAKEFLOORONLY)) if (!(hs->MoreFlags & SECF_FAKEFLOORONLY))
{ {
waterz = hs->ceilingplane.ZatPoint (mo->x, mo->y); waterz = hs->ceilingplane.ZatPoint(mo);
if (oldz <= waterz && newz > waterz) if (oldz <= waterz && newz > waterz)
{ // View went above fake ceiling { // View went above fake ceiling
sec->SecActTarget->TriggerAction (mo, SECSPAC_EyesAboveC); sec->SecActTarget->TriggerAction (mo, SECSPAC_EyesAboveC);
@ -5493,7 +5493,7 @@ bool P_HitFloor (AActor *thing)
// don't splash if landing on the edge above water/lava/etc.... // don't splash if landing on the edge above water/lava/etc....
for (m = thing->touching_sectorlist; m; m = m->m_tnext) for (m = thing->touching_sectorlist; m; m = m->m_tnext)
{ {
if (thing->z == m->m_sector->floorplane.ZatPoint (thing->x, thing->y)) if (thing->z == m->m_sector->floorplane.ZatPoint(thing))
{ {
break; break;
} }
@ -5505,7 +5505,7 @@ bool P_HitFloor (AActor *thing)
if (!(rover->flags & FF_EXISTS)) continue; if (!(rover->flags & FF_EXISTS)) continue;
if (rover->flags & (FF_SOLID|FF_SWIMMABLE)) if (rover->flags & (FF_SOLID|FF_SWIMMABLE))
{ {
if (rover->top.plane->ZatPoint(thing->x, thing->y) == thing->z) if (rover->top.plane->ZatPoint(thing) == thing->z)
{ {
return P_HitWater (thing, m->m_sector); return P_HitWater (thing, m->m_sector);
} }

View File

@ -433,7 +433,7 @@ void P_PlayerInSpecialSector (player_t *player, sector_t * sector)
{ {
// Falling, not all the way down yet? // Falling, not all the way down yet?
sector = player->mo->Sector; sector = player->mo->Sector;
if (player->mo->z != sector->floorplane.ZatPoint (player->mo->x, player->mo->y) if (player->mo->z != sector->floorplane.ZatPoint(player->mo)
&& !player->mo->waterlevel) && !player->mo->waterlevel)
{ {
return; return;
@ -510,7 +510,7 @@ static void DoSectorDamage(AActor *actor, sector_t *sec, int amount, FName type,
if (!(flags & DAMAGE_PLAYERS) && actor->player != NULL) if (!(flags & DAMAGE_PLAYERS) && actor->player != NULL)
return; return;
if (!(flags & DAMAGE_IN_AIR) && actor->z != sec->floorplane.ZatPoint(actor->x, actor->y) && !actor->waterlevel) if (!(flags & DAMAGE_IN_AIR) && actor->z != sec->floorplane.ZatPoint(actor) && !actor->waterlevel)
return; return;
if (protectClass != NULL) if (protectClass != NULL)
@ -547,8 +547,8 @@ void P_SectorDamage(int tag, int amount, FName type, const PClass *protectClass,
{ {
next = actor->snext; next = actor->snext;
// Only affect actors touching the 3D floor // Only affect actors touching the 3D floor
fixed_t z1 = sec->floorplane.ZatPoint(actor->x, actor->y); fixed_t z1 = sec->floorplane.ZatPoint(actor);
fixed_t z2 = sec->ceilingplane.ZatPoint(actor->x, actor->y); fixed_t z2 = sec->ceilingplane.ZatPoint(actor);
if (z2 < z1) if (z2 < z1)
{ {
// Account for Vavoom-style 3D floors // Account for Vavoom-style 3D floors
@ -2318,7 +2318,7 @@ void DPusher::Tick ()
} }
else // special water sector else // special water sector
{ {
ht = hsec->floorplane.ZatPoint (thing->x, thing->y); ht = hsec->floorplane.ZatPoint(thing);
if (thing->z > ht) // above ground if (thing->z > ht) // above ground
{ {
xspeed = m_Xmag; // full force xspeed = m_Xmag; // full force
@ -2347,7 +2347,7 @@ void DPusher::Tick ()
{ // special water sector { // special water sector
floor = &hsec->floorplane; floor = &hsec->floorplane;
} }
if (thing->z > floor->ZatPoint (thing->x, thing->y)) if (thing->z > floor->ZatPoint(thing))
{ // above ground { // above ground
xspeed = yspeed = 0; // no force xspeed = yspeed = 0; // no force
} }

View File

@ -82,7 +82,7 @@ bool P_Thing_Spawn (int tid, AActor *source, int type, angle_t angle, bool fog,
} }
while (spot != NULL) while (spot != NULL)
{ {
mobj = Spawn (kind, spot->x, spot->y, spot->z, ALLOW_REPLACE); mobj = Spawn (kind, spot->X(), spot->Y(), spot->Z(), ALLOW_REPLACE);
if (mobj != NULL) if (mobj != NULL)
{ {
@ -94,7 +94,7 @@ bool P_Thing_Spawn (int tid, AActor *source, int type, angle_t angle, bool fog,
mobj->angle = (angle != ANGLE_MAX ? angle : spot->angle); mobj->angle = (angle != ANGLE_MAX ? angle : spot->angle);
if (fog) if (fog)
{ {
P_SpawnTeleportFog(mobj, spot->x, spot->y, spot->z + TELEFOGHEIGHT, false, true); P_SpawnTeleportFog(mobj, spot->X(), spot->Y(), spot->Z() + TELEFOGHEIGHT, false, true);
} }
if (mobj->flags & MF_SPECIAL) if (mobj->flags & MF_SPECIAL)
mobj->flags |= MF_DROPPED; // Don't respawn mobj->flags |= MF_DROPPED; // Don't respawn
@ -165,7 +165,7 @@ bool P_Thing_Move (int tid, AActor *source, int mapspot, bool fog)
if (source != NULL && target != NULL) if (source != NULL && target != NULL)
{ {
return P_MoveThing(source, target->x, target->y, target->z, fog); return P_MoveThing(source, target->X(), target->Y(), target->Z(), fog);
} }
return false; return false;
} }

View File

@ -1238,8 +1238,8 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd)
} }
// [BL] See if we hit below the floor/ceiling of the poly. // [BL] See if we hit below the floor/ceiling of the poly.
else if(!performBlockingThrust && ( else if(!performBlockingThrust && (
mobj->z < ld->sidedef[!side]->sector->GetSecPlane(sector_t::floor).ZatPoint(mobj->x, mobj->y) || mobj->z < ld->sidedef[!side]->sector->GetSecPlane(sector_t::floor).ZatPoint(mobj) ||
mobj->z + mobj->height > ld->sidedef[!side]->sector->GetSecPlane(sector_t::ceiling).ZatPoint(mobj->x, mobj->y) mobj->z + mobj->height > ld->sidedef[!side]->sector->GetSecPlane(sector_t::ceiling).ZatPoint(mobj)
)) ))
{ {
performBlockingThrust = true; performBlockingThrust = true;

View File

@ -338,23 +338,17 @@ int I_FindAttr(findstate_t* const fileinfo)
} }
static NSString* GetPasteboardStringType()
{
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
return NSStringPboardType;
#else // 10.6 or higher
return NSAppKitVersionNumber < AppKit10_6
? NSStringPboardType
: NSPasteboardTypeString;
#endif // before 10.6
}
void I_PutInClipboard(const char* const string) void I_PutInClipboard(const char* const string)
{ {
NSPasteboard* const pasteBoard = [NSPasteboard generalPasteboard]; NSPasteboard* const pasteBoard = [NSPasteboard generalPasteboard];
[pasteBoard clearContents]; NSString* const stringType = NSStringPboardType;
[pasteBoard setString:[NSString stringWithUTF8String:string] NSArray* const types = [NSArray arrayWithObjects:stringType, nil];
forType:GetPasteboardStringType()]; NSString* const content = [NSString stringWithUTF8String:string];
[pasteBoard declareTypes:types
owner:nil];
[pasteBoard setString:content
forType:stringType];
} }
FString I_GetFromClipboard(bool returnNothing) FString I_GetFromClipboard(bool returnNothing)
@ -365,7 +359,7 @@ FString I_GetFromClipboard(bool returnNothing)
} }
NSPasteboard* const pasteBoard = [NSPasteboard generalPasteboard]; NSPasteboard* const pasteBoard = [NSPasteboard generalPasteboard];
NSString* const value = [pasteBoard stringForType:GetPasteboardStringType()]; NSString* const value = [pasteBoard stringForType:NSStringPboardType];
return FString([value UTF8String]); return FString([value UTF8String]);
} }

View File

@ -85,7 +85,6 @@ private:
int m_netMaxPos; int m_netMaxPos;
FConsoleWindow(); FConsoleWindow();
~FConsoleWindow();
void ExpandTextView(float height); void ExpandTextView(float height);

View File

@ -118,11 +118,6 @@ FConsoleWindow::FConsoleWindow()
[m_window makeKeyAndOrderFront:nil]; [m_window makeKeyAndOrderFront:nil];
} }
FConsoleWindow::~FConsoleWindow()
{
[m_window close];
}
static FConsoleWindow* s_instance; static FConsoleWindow* s_instance;

View File

@ -279,6 +279,11 @@ struct secplane_t
return FixedMul (ic, -d - DMulScale16 (a, v->x, b, v->y)); return FixedMul (ic, -d - DMulScale16 (a, v->x, b, v->y));
} }
fixed_t ZatPoint (const AActor *ac) const
{
return FixedMul (ic, -d - DMulScale16 (a, ac->X(), b, ac->Y()));
}
// Returns the value of z at (x,y) if d is equal to dist // Returns the value of z at (x,y) if d is equal to dist
fixed_t ZatPointDist (fixed_t x, fixed_t y, fixed_t dist) const fixed_t ZatPointDist (fixed_t x, fixed_t y, fixed_t dist) const
{ {

View File

@ -961,8 +961,10 @@ void FWadCollection::RenameNerve ()
// //
// FixMacHexen // FixMacHexen
// //
// Rename unused high resolution font lumps because they are incorrectly // Discard all extra lumps in Mac version of Hexen IWAD (demo or full)
// treated as extended characters // to avoid any issues caused by names of these lumps, including:
// * Wrong height of small font
// * Broken life bar of mage class
// //
//========================================================================== //==========================================================================
@ -973,22 +975,51 @@ void FWadCollection::FixMacHexen()
return; return;
} }
for (int i = GetFirstLump(IWAD_FILENUM), last = GetLastLump(IWAD_FILENUM); i <= last; ++i) FileReader* const reader = GetFileReader(IWAD_FILENUM);
const long iwadSize = reader->GetLength();
static const long DEMO_SIZE = 13596228;
static const long FULL_SIZE = 21078584;
if ( DEMO_SIZE != iwadSize
&& FULL_SIZE != iwadSize)
{ {
assert(IWAD_FILENUM == LumpInfo[i].wadnum); return;
FResourceLump* const lump = LumpInfo[i].lump;
char* const name = lump->Name;
// Unwanted lumps are named like FONTA??1
if (8 == strlen(name)
&& MAKE_ID('F', 'O', 'N', 'T') == lump->dwName
&& 'A' == name[4] && '1' == name[7]
&& isdigit(name[5]) && isdigit(name[6]))
{
name[0] = '\0';
} }
reader->Seek(0, SEEK_SET);
BYTE checksum[16];
MD5Context md5;
md5.Update(reader, iwadSize);
md5.Final(checksum);
static const BYTE HEXEN_DEMO_MD5[16] =
{
0x92, 0x5f, 0x9f, 0x50, 0x00, 0xe1, 0x7d, 0xc8,
0x4b, 0x0a, 0x6a, 0x3b, 0xed, 0x3a, 0x6f, 0x31
};
static const BYTE HEXEN_FULL_MD5[16] =
{
0xb6, 0x81, 0x40, 0xa7, 0x96, 0xf6, 0xfd, 0x7f,
0x3a, 0x5d, 0x32, 0x26, 0xa3, 0x2b, 0x93, 0xbe
};
if ( 0 != memcmp(HEXEN_DEMO_MD5, checksum, sizeof checksum)
&& 0 != memcmp(HEXEN_FULL_MD5, checksum, sizeof checksum))
{
return;
}
static const int EXTRA_LUMPS = 299;
const int lastLump = GetLastLump(IWAD_FILENUM);
assert(GetFirstLump(IWAD_FILENUM) + 299 < lastLump);
for (int i = lastLump - EXTRA_LUMPS + 1; i <= lastLump; ++i)
{
LumpInfo[i].lump->Name[0] = '\0';
} }
} }