- float stuff in g_raven.

- fixed some problems in previous commits.
This commit is contained in:
Christoph Oelckers 2016-03-22 02:29:43 +01:00
parent f3d6ca04fc
commit 5a4b974187
4 changed files with 37 additions and 43 deletions

View file

@ -1401,7 +1401,7 @@ void FParser::SF_PointToAngle(void)
double x2 = floatvalue(t_argv[2]);
double y2 = floatvalue(t_argv[3]);
t_return.setDouble(DVector2(x2 - x1, y2 - y1).Angle().BAMs);
t_return.setDouble(DVector2(x2 - x1, y2 - y1).Angle().Normalized360().Degrees);
}
}

View file

@ -183,7 +183,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurDecide)
bool friendly = !!(self->flags5 & MF5_SUMMONEDMONSTER);
AActor *target;
int dist;
double dist;
target = self->target;
if (!target)
@ -194,11 +194,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurDecide)
{
S_Sound (self, CHAN_WEAPON, "minotaur/sight", 1, ATTN_NORM);
}
dist = self->AproxDistance (target);
dist = self->Distance2D(target);
if (target->Top() > self->Z()
&& target->Top() < self->Top()
&& dist < (friendly ? 16*64*FRACUNIT : 8*64*FRACUNIT)
&& dist > 1*64*FRACUNIT
&& dist < (friendly ? 16*64. : 8*64.)
&& dist > 1*64.
&& pr_minotaurdecide() < 150)
{ // Charge attack
// Don't call the state function right away
@ -213,7 +213,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurDecide)
self->special1 = TICRATE/2; // Charge duration
}
else if (target->Z() == target->floorz
&& dist < 9*64*FRACUNIT
&& dist < 9*64.
&& pr_minotaurdecide() < (friendly ? 100 : 220))
{ // Floor fire attack
self->SetState (self->FindState ("Hammer"));
@ -282,9 +282,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk2)
PARAM_ACTION_PROLOGUE;
AActor *mo;
angle_t angle;
fixed_t vz;
fixed_t z;
DAngle angle;
double vz;
double z;
bool friendly = !!(self->flags5 & MF5_SUMMONEDMONSTER);
if (self->target == NULL)
@ -300,7 +300,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk2)
P_TraceBleed (newdam > 0 ? newdam : damage, self->target, self);
return 0;
}
z = self->_f_Z() + 40*FRACUNIT;
z = self->Z() + 40;
PClassActor *fx = PClass::FindActor("MinotaurFX1");
if (fx)
{
@ -308,12 +308,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk2)
if (mo != NULL)
{
// S_Sound (mo, CHAN_WEAPON, "minotaur/attack2", 1, ATTN_NORM);
vz = mo->_f_velz();
angle = mo->_f_angle();
P_SpawnMissileAngleZ (self, z, fx, angle-(ANG45/8), vz);
P_SpawnMissileAngleZ (self, z, fx, angle+(ANG45/8), vz);
P_SpawnMissileAngleZ (self, z, fx, angle-(ANG45/16), vz);
P_SpawnMissileAngleZ (self, z, fx, angle+(ANG45/16), vz);
vz = mo->Vel.Z;
angle = mo->Angles.Yaw;
P_SpawnMissileAngleZ (self, z, fx, angle-(45./8), vz);
P_SpawnMissileAngleZ (self, z, fx, angle+(45./8), vz);
P_SpawnMissileAngleZ (self, z, fx, angle-(45./16), vz);
P_SpawnMissileAngleZ (self, z, fx, angle+(45./16), vz);
}
}
return 0;
@ -486,7 +486,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurRoam)
//
// Look for enemy of player
//----------------------------------------------------------------------------
#define MINOTAUR_LOOK_DIST (16*54*FRACUNIT)
#define MINOTAUR_LOOK_DIST (16*54.)
DEFINE_ACTION_FUNCTION(AActor, A_MinotaurLook)
{
@ -500,7 +500,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurLook)
AActor *mo = NULL;
player_t *player;
fixed_t dist;
double dist;
int i;
AActor *master = self->tracer;
@ -514,7 +514,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurLook)
mo = player->mo;
if (mo == master) continue;
if (mo->health <= 0) continue;
dist = self->AproxDistance(mo);
dist = self->Distance2D(mo);
if (dist > MINOTAUR_LOOK_DIST) continue;
self->target = mo;
break;
@ -539,7 +539,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurLook)
if (!(mo->flags3 & MF3_ISMONSTER)) continue;
if (mo->health <= 0) continue;
if (!(mo->flags & MF_SHOOTABLE)) continue;
dist = self->AproxDistance(mo);
dist = self->Distance2D(mo);
if (dist > MINOTAUR_LOOK_DIST) continue;
if ((mo == master) || (mo == self)) continue;
if ((mo->flags5 & MF5_SUMMONEDMONSTER) && (mo->tracer == master)) continue;

View file

@ -28,7 +28,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightningTail)
{
PARAM_ACTION_PROLOGUE;
AActor *foo = Spawn("SpectralLightningHTail", self->Vec3Offset(-self->_f_velx(), -self->_f_vely(), 0), ALLOW_REPLACE);
AActor *foo = Spawn("SpectralLightningHTail", self->Vec3Offset(-self->Vel.X, -self->Vel.Y, 0.), ALLOW_REPLACE);
foo->Angles.Yaw = self->Angles.Yaw;
foo->FriendPlayer = self->FriendPlayer;
@ -66,21 +66,20 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightning)
self->Vel.X += pr_zap5.Random2(3);
self->Vel.Y += pr_zap5.Random2(3);
fixedvec2 pos = self->Vec2Offset(
pr_zap5.Random2(3) * FRACUNIT * 50,
pr_zap5.Random2(3) * FRACUNIT * 50);
double xo = pr_zap5.Random2(3) * 50.;
double yo = pr_zap5.Random2(3) * 50.;
flash = Spawn (self->threshold > 25 ? PClass::FindActor(NAME_SpectralLightningV2) :
PClass::FindActor(NAME_SpectralLightningV1), pos.x, pos.y, ONCEILINGZ, ALLOW_REPLACE);
PClass::FindActor(NAME_SpectralLightningV1), self->Vec2OffsetZ(xo, yo, ONCEILINGZ), ALLOW_REPLACE);
flash->target = self->target;
flash->Vel.Z = -18*FRACUNIT;
flash->Vel.Z = -18;
flash->FriendPlayer = self->FriendPlayer;
flash = Spawn(NAME_SpectralLightningV2, self->_f_X(), self->_f_Y(), ONCEILINGZ, ALLOW_REPLACE);
flash = Spawn(NAME_SpectralLightningV2, self->PosAtZ(ONCEILINGZ), ALLOW_REPLACE);
flash->target = self->target;
flash->Vel.Z = -18 * FRACUNIT;
flash->Vel.Z = -18;
flash->FriendPlayer = self->FriendPlayer;
return 0;
}
@ -94,8 +93,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_Tracer2)
PARAM_ACTION_PROLOGUE;
AActor *dest;
fixed_t dist;
fixed_t slope;
double dist;
double slope;
dest = self->tracer;
@ -123,21 +122,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_Tracer2)
if (!(self->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)))
{
// change slope
dist = self->AproxDistance (dest) / self->_f_speed();
if (dist < 1)
dist = self->DistanceBySpeed (dest, self->Speed);
if (dest->Height >= 56)
{
dist = 1;
}
if (dest->_f_height() >= 56*FRACUNIT)
{
slope = (dest->_f_Z()+40*FRACUNIT - self->_f_Z()) / dist;
slope = (dest->Z()+40 - self->Z()) / dist;
}
else
{
slope = (dest->_f_Z() + self->_f_height()*2/3 - self->_f_Z()) / dist;
slope = (dest->Z() + self->Height*(2./3) - self->Z()) / dist;
}
if (slope < self->_f_velz())
if (slope < self->Vel.Z)
{
self->Vel.Z -= 1 / 8.;
}

View file

@ -568,7 +568,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaulerTorpedoWave)
AActor *P_SpawnSubMissile (AActor *source, PClassActor *type, AActor *target)
{
AActor *other = Spawn (type, source->_f_Pos(), ALLOW_REPLACE);
AActor *other = Spawn (type, source->Pos(), ALLOW_REPLACE);
if (other == NULL)
{
@ -594,7 +594,7 @@ AActor *P_SpawnSubMissile (AActor *source, PClassActor *type, AActor *target)
if (P_CheckMissileSpawn (other, source->radius))
{
DAngle pitch = P_AimLineAttack (source, source->Angles.Yaw, 1024.);
other->Vel.Z = -other->Speed * pitch.Cos();
other->Vel.Z = -other->Speed * pitch.Sin();
return other;
}
return NULL;
@ -1058,7 +1058,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil3)
spot = P_SpawnSubMissile (self, PClass::FindActor("SpectralLightningBall1"), self);
if (spot != NULL)
{
spot->_f_SetZ(self->_f_Z() + 32*FRACUNIT);
spot->SetZ(self->Z() + 32);
}
}
self->Angles.Yaw -= 90.;