Merge commit 'fb9231a38d' into scripting

Conflicts:
	src/info.cpp
	src/thingdef/thingdef_expression.cpp
	wadsrc/static/actors/constants.txt

(Scripting branch update part 2)
This commit is contained in:
Christoph Oelckers 2015-04-28 09:57:01 +02:00
commit d6e3fc0567
76 changed files with 562 additions and 312 deletions

View file

@ -670,33 +670,39 @@ bool P_TryWalk (AActor *actor)
void P_DoNewChaseDir (AActor *actor, fixed_t deltax, fixed_t deltay)
{
dirtype_t d[3];
dirtype_t d[2];
int tdir;
dirtype_t olddir, turnaround;
bool attempts[NUMDIRS-1]; // We don't need to attempt DI_NODIR.
memset(&attempts, false, sizeof(attempts));
olddir = (dirtype_t)actor->movedir;
turnaround = opposite[olddir];
if (deltax>10*FRACUNIT)
d[1]= DI_EAST;
d[0]= DI_EAST;
else if (deltax<-10*FRACUNIT)
d[1]= DI_WEST;
d[0]= DI_WEST;
else
d[0]=DI_NODIR;
if (deltay<-10*FRACUNIT)
d[1]= DI_SOUTH;
else if (deltay>10*FRACUNIT)
d[1]= DI_NORTH;
else
d[1]=DI_NODIR;
if (deltay<-10*FRACUNIT)
d[2]= DI_SOUTH;
else if (deltay>10*FRACUNIT)
d[2]= DI_NORTH;
else
d[2]=DI_NODIR;
// try direct route
if (d[1] != DI_NODIR && d[2] != DI_NODIR)
if (d[0] != DI_NODIR && d[1] != DI_NODIR)
{
actor->movedir = diags[((deltay<0)<<1) + (deltax>0)];
if (actor->movedir != turnaround && P_TryWalk(actor))
return;
if (actor->movedir != turnaround)
{
attempts[actor->movedir] = true;
if (P_TryWalk(actor))
return;
}
}
// try other directions
@ -704,18 +710,19 @@ void P_DoNewChaseDir (AActor *actor, fixed_t deltax, fixed_t deltay)
{
if ((pr_newchasedir() > 200 || abs(deltay) > abs(deltax)))
{
swapvalues (d[1], d[2]);
swapvalues (d[0], d[1]);
}
if (d[0] == turnaround)
d[0] = DI_NODIR;
if (d[1] == turnaround)
d[1] = DI_NODIR;
if (d[2] == turnaround)
d[2] = DI_NODIR;
}
if (d[1] != DI_NODIR)
if (d[0] != DI_NODIR && attempts[d[0]] == false)
{
actor->movedir = d[1];
actor->movedir = d[0];
attempts[d[0]] = true;
if (P_TryWalk (actor))
{
// either moved forward or attacked
@ -723,9 +730,10 @@ void P_DoNewChaseDir (AActor *actor, fixed_t deltax, fixed_t deltay)
}
}
if (d[2] != DI_NODIR)
if (d[1] != DI_NODIR && attempts[d[1]] == false)
{
actor->movedir = d[2];
actor->movedir = d[1];
attempts[d[1]] = true;
if (P_TryWalk (actor))
return;
}
@ -733,9 +741,10 @@ void P_DoNewChaseDir (AActor *actor, fixed_t deltax, fixed_t deltay)
if (!(actor->flags5 & MF5_AVOIDINGDROPOFF))
{
// there is no direct path to the player, so pick another direction.
if (olddir != DI_NODIR)
if (olddir != DI_NODIR && attempts[olddir] == false)
{
actor->movedir = olddir;
attempts[olddir] = true;
if (P_TryWalk (actor))
return;
}
@ -746,9 +755,10 @@ void P_DoNewChaseDir (AActor *actor, fixed_t deltax, fixed_t deltay)
{
for (tdir = DI_EAST; tdir <= DI_SOUTHEAST; tdir++)
{
if (tdir != turnaround)
if (tdir != turnaround && attempts[tdir] == false)
{
actor->movedir = tdir;
attempts[tdir] = true;
if ( P_TryWalk(actor) )
return;
}
@ -758,16 +768,17 @@ void P_DoNewChaseDir (AActor *actor, fixed_t deltax, fixed_t deltay)
{
for (tdir = DI_SOUTHEAST; tdir != (DI_EAST-1); tdir--)
{
if (tdir != turnaround)
if (tdir != turnaround && attempts[tdir] == false)
{
actor->movedir = tdir;
attempts[tdir] = true;
if ( P_TryWalk(actor) )
return;
}
}
}
if (turnaround != DI_NODIR)
if (turnaround != DI_NODIR && attempts[turnaround] == false)
{
actor->movedir =turnaround;
if ( P_TryWalk(actor) )
@ -2545,8 +2556,6 @@ 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;
maxdist = corpsehit->GetDefault()->radius + self->radius;
if (abs(corpsehit->x - viletryx) > maxdist ||
abs(corpsehit->y - viletryy) > maxdist)
continue; // not actually touching
@ -2824,7 +2833,7 @@ void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch, a
target_z = other->z + (other->height / 2) + other->GetBobOffset();
if (flags & FAF_TOP)
target_z = other->z + (other->height) + other->GetBobOffset();
if (!flags & FAF_NODISTFACTOR)
if (!(flags & FAF_NODISTFACTOR))
target_z += pitch_offset;
double dist_z = target_z - source_z;