Merge branch 'master' into scripting

Conflicts:
	src/actor.h
	src/fragglescript/t_func.cpp
	src/g_doom/a_bossbrain.cpp
	src/g_doom/a_revenant.cpp
	src/g_heretic/a_hereticartifacts.cpp
	src/g_heretic/a_hereticweaps.cpp
	src/g_heretic/a_knight.cpp
	src/g_hexen/a_bishop.cpp
	src/g_hexen/a_clericholy.cpp
	src/g_hexen/a_dragon.cpp
	src/g_hexen/a_firedemon.cpp
	src/g_hexen/a_flechette.cpp
	src/g_hexen/a_heresiarch.cpp
	src/g_hexen/a_hexenspecialdecs.cpp
	src/g_hexen/a_iceguy.cpp
	src/g_hexen/a_korax.cpp
	src/g_hexen/a_magelightning.cpp
	src/g_hexen/a_serpent.cpp
	src/g_hexen/a_spike.cpp
	src/g_hexen/a_wraith.cpp
	src/g_raven/a_minotaur.cpp
	src/g_shared/a_bridge.cpp
	src/g_shared/a_pickups.cpp
	src/g_shared/a_randomspawner.cpp
	src/g_strife/a_alienspectres.cpp
	src/g_strife/a_crusader.cpp
	src/g_strife/a_entityboss.cpp
	src/g_strife/a_inquisitor.cpp
	src/g_strife/a_loremaster.cpp
	src/g_strife/a_programmer.cpp
	src/g_strife/a_sentinel.cpp
	src/g_strife/a_spectral.cpp
	src/g_strife/a_strifestuff.cpp
	src/g_strife/a_strifeweapons.cpp
	src/g_strife/a_thingstoblowup.cpp
	src/p_local.h
	src/r_utility.cpp
This commit is contained in:
Christoph Oelckers 2016-01-19 13:43:11 +01:00
commit bc63b70d88
93 changed files with 877 additions and 765 deletions

View file

@ -243,9 +243,9 @@ bool AActor::CheckMeleeRange ()
// [RH] Don't melee things too far above or below actor.
if (!(flags5 & MF5_NOVERTICALMELEERANGE))
{
if (pl->Z() > z + height)
if (pl->Z() > Top())
return false;
if (pl->Z() + pl->height < z)
if (pl->Top() < Z())
return false;
}
@ -280,11 +280,11 @@ bool P_CheckMeleeRange2 (AActor *actor)
{
return false;
}
if (mo->Z() > actor->Z()+actor->height)
if (mo->Z() > actor->Top())
{ // Target is higher than the attacker
return false;
}
else if (actor->Z() > mo->Z()+mo->height)
else if (actor->Z() > mo->Top())
{ // Attacker is higher
return false;
}
@ -473,8 +473,8 @@ bool P_Move (AActor *actor)
}
}
tryx = (origx = actor->x) + (deltax = FixedMul (speed, xspeed[actor->movedir]));
tryy = (origy = actor->y) + (deltay = FixedMul (speed, yspeed[actor->movedir]));
tryx = (origx = actor->X()) + (deltax = FixedMul (speed, xspeed[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
@ -519,15 +519,14 @@ bool P_Move (AActor *actor)
// so make it switchable
if (nomonsterinterpolation)
{
actor->PrevX = actor->x;
actor->PrevY = actor->y;
actor->PrevZ = actor->z;
actor->PrevX = actor->X();
actor->PrevY = actor->Y();
actor->PrevZ = actor->Z();
}
if (try_ok && friction > ORIG_FRICTION)
{
actor->x = origx;
actor->y = origy;
actor->SetOrigin(origx, origy, actor->Z(), false);
movefactor *= FRACUNIT / ORIG_FRICTION_FACTOR / 4;
actor->velx += FixedMul (deltax, movefactor);
actor->vely += FixedMul (deltay, movefactor);
@ -543,12 +542,12 @@ bool P_Move (AActor *actor)
if (actor->Y() <= actor->floorz + actor->MaxStepHeight)
{
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
// the floor we could get stuck in. The old code did not do this.
if (!P_TestMobjZ(actor))
{
actor->z = savedz;
actor->SetZ(savedz);
}
else
{ // The monster just hit the floor, so trigger any actions.
@ -568,10 +567,10 @@ bool P_Move (AActor *actor)
{ // must adjust height
fixed_t savedz = actor->Z();
if (actor->z < tm.floorz)
actor->z += actor->FloatSpeed;
if (actor->Z() < tm.floorz)
actor->AddZ(actor->FloatSpeed);
else
actor->z -= actor->FloatSpeed;
actor->AddZ(-actor->FloatSpeed);
// [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;
return true;
}
actor->z = savedz;
actor->SetZ(savedz);
}
if (!spechit.Size ())
@ -812,28 +811,25 @@ void P_DoNewChaseDir (AActor *actor, fixed_t deltax, fixed_t deltay)
void P_NewChaseDir(AActor * actor)
{
fixed_t deltax;
fixed_t deltay;
fixedvec2 delta;
actor->strafecount = 0;
if ((actor->flags5&MF5_CHASEGOAL || actor->goal == actor->target) && actor->goal!=NULL)
{
deltax = actor->goal->x - actor->x;
deltay = actor->goal->y - actor->y;
delta = actor->Vec2To(actor->goal);
}
else if (actor->target != NULL)
{
deltax = actor->target->x - actor->x;
deltay = actor->target->y - actor->y;
delta = actor->Vec2To(actor->target);
if (!(actor->flags6 & MF6_NOFEAR))
{
if ((actor->target->player != NULL && (actor->target->player->cheats & CF_FRIGHTENING)) ||
(actor->flags4 & MF4_FRIGHTENED))
{
deltax = -deltax;
deltay = -deltay;
delta.x = -delta.x;
delta.y = -delta.y;
}
}
}
@ -877,7 +873,7 @@ void P_NewChaseDir(AActor * actor)
{
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
}
@ -946,12 +942,12 @@ void P_NewChaseDir(AActor * actor)
if (ismeleeattacker)
{
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
// logic still works the same, except in the strafing part
@ -983,7 +979,7 @@ void P_RandomChaseDir (AActor *actor)
if (actor->flags & MF_FRIENDLY)
{
AActor *player;
fixed_t deltax, deltay;
fixedvec2 delta;
dirtype_t d[3];
if (actor->FriendPlayer != 0)
@ -1005,19 +1001,18 @@ void P_RandomChaseDir (AActor *actor)
{
if (pr_newchasedir() & 1 || !P_CheckSight (actor, player))
{
deltax = player->x - actor->x;
deltay = player->y - actor->y;
delta = actor->Vec2To(player);
if (deltax>128*FRACUNIT)
if (delta.x>128*FRACUNIT)
d[1]= DI_EAST;
else if (deltax<-128*FRACUNIT)
else if (delta.x<-128*FRACUNIT)
d[1]= DI_WEST;
else
d[1]=DI_NODIR;
if (deltay<-128*FRACUNIT)
if (delta.y<-128*FRACUNIT)
d[2]= DI_SOUTH;
else if (deltay>128*FRACUNIT)
else if (delta.y>128*FRACUNIT)
d[2]= DI_NORTH;
else
d[2]=DI_NODIR;
@ -1025,13 +1020,13 @@ void P_RandomChaseDir (AActor *actor)
// try direct route
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))
return;
}
// 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]);
}
@ -2488,8 +2483,8 @@ void A_DoChase (VMFrameStack *stack, AActor *actor, bool fastchase, FState *mele
if ((!fastchase || !actor->FastChaseStrafeCount) && !dontmove)
{
// CANTLEAVEFLOORPIC handling was completely missing in the non-serpent functions.
fixed_t oldX = actor->x;
fixed_t oldY = actor->y;
fixed_t oldX = actor->X();
fixed_t oldY = actor->Y();
FTextureID oldFloor = actor->floorpic;
// chase towards player
@ -2540,11 +2535,12 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates)
if (self->movedir != DI_NODIR)
{
const fixed_t absSpeed = abs (self->Speed);
fixed_t viletryx = self->x + FixedMul (absSpeed, xspeed[self->movedir]);
fixed_t viletryy = self->y + FixedMul (absSpeed, yspeed[self->movedir]);
fixedvec2 viletry = self->Vec2Offset(
FixedMul (absSpeed, xspeed[self->movedir]),
FixedMul (absSpeed, yspeed[self->movedir]), true);
AActor *corpsehit;
FBlockThingsIterator it(FBoundingBox(viletryx, viletryy, 32*FRACUNIT));
FBlockThingsIterator it(FBoundingBox(viletry.x, viletry.y, 32*FRACUNIT));
while ((corpsehit = it.Next()))
{
FState *raisestate = corpsehit->GetRaiseState();
@ -2553,8 +2549,8 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates)
// use the current actor's radius instead of the Arch Vile's default.
fixed_t maxdist = corpsehit->GetDefault()->radius + self->radius;
if (abs(corpsehit->x - viletryx) > maxdist ||
abs(corpsehit->y - viletryy) > maxdist)
if (abs(corpsehit->X() - viletry.x) > maxdist ||
abs(corpsehit->Y() - viletry.y) > maxdist)
continue; // not actually touching
// Let's check if there are floors in between the archvile and its target
sector_t *vilesec = self->Sector;
@ -2565,8 +2561,8 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates)
if (testsec)
{
fixed_t zdist1, zdist2;
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))
if (P_Find3DFloor(testsec, corpsehit->Pos(), false, true, zdist1)
!= P_Find3DFloor(testsec, self->Pos(), false, true, zdist2))
{
// Not on same floor
if (vilesec == corpsec || abs(zdist1 - self->Z()) > self->height)
@ -2583,7 +2579,7 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates)
corpsehit->flags |= MF_SOLID;
corpsehit->height = corpsehit->GetDefault()->height;
bool check = P_CheckPosition(corpsehit, corpsehit->X(), corpsehit->Y());
bool check = P_CheckPosition(corpsehit, corpsehit->Pos());
corpsehit->flags = oldflags;
corpsehit->radius = oldradius;
corpsehit->height = oldheight;
@ -2804,18 +2800,15 @@ void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch, a
// disabled and is so by default.
if (max_pitch <= ANGLE_180)
{
// [DH] Don't need to do proper fixed->double conversion, since the
// result is only used in a ratio.
double dist_x = other->x - self->x;
double dist_y = other->y - self->y;
TVector2<double> dist = self->Vec2To(other);
// Positioning ala missile spawning, 32 units above foot level
fixed_t source_z = self->z + 32*FRACUNIT + self->GetBobOffset();
fixed_t target_z = other->z + 32*FRACUNIT + other->GetBobOffset();
fixed_t source_z = self->Z() + 32*FRACUNIT + self->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
// its body.
if (target_z >= other->Z() + other->height)
if (target_z >= other->Top())
{
target_z = other->Z() + (other->height / 2);
}
@ -2831,9 +2824,9 @@ void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch, a
if (!(flags & FAF_NODISTFACTOR))
target_z += pitch_offset;
double dist_z = target_z - source_z;
double dist = sqrt(dist_x*dist_x + dist_y*dist_y + dist_z*dist_z);
int other_pitch = (int)rad2bam(asin(dist_z / dist));
double dist_z = FIXED2DBL(target_z - source_z);
double ddist = sqrt(dist.X*dist.X + dist.Y*dist.Y + dist_z*dist_z);
int other_pitch = (int)rad2bam(asin(dist_z / ddist));
if (max_pitch != 0)
{
@ -2950,9 +2943,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail)
if (linetarget == NULL)
{
// 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);
double zdiff = (self->target->z + (self->target->height>>1)) -
(self->z + (self->height>>1) - self->floorclip);
TVector2<double> xydiff = self->Vec2To(self->target);
double zdiff = FIXED2DBL((self->target->Z() + (self->target->height>>1)) - (self->Z() + (self->height>>1) - self->floorclip));
self->pitch = int(atan2(zdiff, xydiff.Length()) * ANGLE_180 / -M_PI);
}