- fixed new A_Facetarget pitch code which made some incorrect assumptions about variables' signedness.

- fixed a few compiler warnings.


SVN r3535 (trunk)
This commit is contained in:
Christoph Oelckers 2012-04-07 20:44:28 +00:00
parent 7443c3d167
commit 40c906f10d
2 changed files with 8 additions and 20 deletions

View file

@ -2784,34 +2784,22 @@ void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch)
double dist_z = self->target->z - self->z;
double dist = sqrt(dist_x*dist_x + dist_y*dist_y + dist_z*dist_z);
angle_t other_pitch = rad2bam(asin(dist_z / dist));
int other_pitch = (int)rad2bam(asin(dist_z / dist));
if (max_pitch && (max_pitch < (angle_t)abs(self->pitch - other_pitch)))
if (max_pitch != 0)
{
if (self->pitch > other_pitch)
{
if (self->pitch - other_pitch < ANGLE_180)
{
max_pitch = MIN(max_pitch, unsigned(self->pitch - other_pitch));
self->pitch -= max_pitch;
}
else
{
max_pitch = MIN(max_pitch, unsigned(other_pitch - self->pitch));
self->pitch += max_pitch;
}
}
else
{
if (other_pitch - self->pitch < ANGLE_180)
{
self->pitch += max_pitch;
}
else
{
self->pitch -= max_pitch;
}
}
}
else
{
self->pitch = other_pitch;
}

View file

@ -1428,7 +1428,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RailAttack)
slope = pr_crailgun.Random2() * (Spread_Z / 255);
}
P_RailAttack (self, Damage, Spawnofs_XY, Color1, Color2, MaxDiff, (Flags & RAF_SILENT), PuffType, (!(Flags & RAF_NOPIERCE)), angle, slope, Range, (Flags & RAF_FULLBRIGHT), Duration, Sparsity, DriftSpeed, SpawnClass);
P_RailAttack (self, Damage, Spawnofs_XY, Color1, Color2, MaxDiff, !!(Flags & RAF_SILENT), PuffType, (!(Flags & RAF_NOPIERCE)), angle, slope, Range, !!(Flags & RAF_FULLBRIGHT), Duration, Sparsity, DriftSpeed, SpawnClass);
}
//==========================================================================
@ -1546,7 +1546,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
slopeoffset = pr_crailgun.Random2() * (Spread_Z / 255);
}
P_RailAttack (self, Damage, Spawnofs_XY, Color1, Color2, MaxDiff, (Flags & RAF_SILENT), PuffType, (!(Flags & RAF_NOPIERCE)), angleoffset, slopeoffset, Range, (Flags & RAF_FULLBRIGHT), Duration, Sparsity, DriftSpeed, SpawnClass);
P_RailAttack (self, Damage, Spawnofs_XY, Color1, Color2, MaxDiff, !!(Flags & RAF_SILENT), PuffType, (!(Flags & RAF_NOPIERCE)), angleoffset, slopeoffset, Range, !!(Flags & RAF_FULLBRIGHT), Duration, Sparsity, DriftSpeed, SpawnClass);
self->x = saved_x;
self->y = saved_y;