diff --git a/src/d_net.cpp b/src/d_net.cpp index 1e8906e86..a4af9bd6f 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -2348,7 +2348,7 @@ void Net_DoCommand (int type, BYTE **stream, int player) } if (type >= DEM_SUMMON2 && type <= DEM_SUMMONFOE2) { - spawned->Angles.Yaw -= angle; + spawned->Angles.Yaw = source->Angles.Yaw - angle; spawned->tid = tid; spawned->special = special; for(i = 0; i < 5; i++) { diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index a3c2274b0..66832459a 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -1053,8 +1053,7 @@ void FParser::SF_ObjAngle(void) mo = Script->trigger; } - t_return.type = svt_fixed; // haleyjd: fixed-point -- SoM again :) - t_return.value.f = mo ? (fixed_t)AngleToFixed(mo->_f_angle()) : 0; // null ptr check + t_return.setDouble(mo ? mo->Angles.Yaw.Degrees : 0.); } @@ -3118,7 +3117,7 @@ void FParser::SF_MoveCamera(void) quad1 == quad2) { angledist = bigangle - smallangle; - angledir = targetangle > cam->_f_angle() ? 1 : -1; + angledir = targetangle > camangle ? 1 : -1; } else { diff --git a/src/fragglescript/t_script.h b/src/fragglescript/t_script.h index a5159d038..0cbeb446f 100644 --- a/src/fragglescript/t_script.h +++ b/src/fragglescript/t_script.h @@ -106,6 +106,24 @@ struct svalue_t string = other.string; value = other.value; } + + void setInt(int ip) + { + value.i = ip; + type = svt_int; + } + + void setFixed(fixed_t fp) + { + value.f = fp; + type = svt_fixed; + } + + void setDouble(double dp) + { + value.f = FLOAT2FIXED(dp); + type = svt_fixed; + } }; int intvalue(const svalue_t & v); diff --git a/src/g_doom/a_lostsoul.cpp b/src/g_doom/a_lostsoul.cpp index 90f54038f..529802210 100644 --- a/src/g_doom/a_lostsoul.cpp +++ b/src/g_doom/a_lostsoul.cpp @@ -33,9 +33,7 @@ void A_SkullAttack(AActor *self, fixed_t speed) S_Sound (self, CHAN_VOICE, self->AttackSound, 1, ATTN_NORM); A_FaceTarget (self); - an = self->_f_angle() >> ANGLETOFINESHIFT; - self->vel.x = FixedMul (speed, finecosine[an]); - self->vel.y = FixedMul (speed, finesine[an]); + self->VelFromAngle(speed); dist = self->AproxDistance (dest); dist = dist / speed; diff --git a/src/g_doom/a_painelemental.cpp b/src/g_doom/a_painelemental.cpp index 7477812db..e06a159ec 100644 --- a/src/g_doom/a_painelemental.cpp +++ b/src/g_doom/a_painelemental.cpp @@ -10,8 +10,6 @@ #include "doomstat.h" */ -DECLARE_ACTION(A_SkullAttack) - enum PA_Flags { PAF_NOSKULLATTACK = 1, diff --git a/src/g_hexen/a_flechette.cpp b/src/g_hexen/a_flechette.cpp index 195e77514..0a691a64e 100644 --- a/src/g_hexen/a_flechette.cpp +++ b/src/g_hexen/a_flechette.cpp @@ -100,7 +100,7 @@ bool AArtiPoisonBag3::Use (bool pickup) mo = Spawn("ThrowingBomb", Owner->PosPlusZ(-Owner->floorclip+35*FRACUNIT + (Owner->player? Owner->player->crouchoffset : 0)), ALLOW_REPLACE); if (mo) { - mo->Angles.Yaw = Owner->Angles.Yaw + (((pr_poisonbag() & 7) - 4) * 22.5f); + mo->Angles.Yaw = Owner->Angles.Yaw + (((pr_poisonbag() & 7) - 4) * (360./256.)); /* Original flight code from Hexen * mo->momz = 4*FRACUNIT+((player->lookdir)<<(FRACBITS-4)); diff --git a/src/g_hexen/a_fog.cpp b/src/g_hexen/a_fog.cpp index a1cd099b3..c33a6ab1f 100644 --- a/src/g_hexen/a_fog.cpp +++ b/src/g_hexen/a_fog.cpp @@ -94,9 +94,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FogMove) self->special2 = (weaveindex + 1) & 63; } - angle = self->_f_angle()>>ANGLETOFINESHIFT; - self->vel.x = FixedMul(speed, finecosine[angle]); - self->vel.y = FixedMul(speed, finesine[angle]); + self->VelFromAngle(speed); return 0; } diff --git a/src/g_hexen/a_korax.cpp b/src/g_hexen/a_korax.cpp index ba0917ce1..b8f685313 100644 --- a/src/g_hexen/a_korax.cpp +++ b/src/g_hexen/a_korax.cpp @@ -512,7 +512,7 @@ AActor *P_SpawnKoraxMissile (fixed_t x, fixed_t y, fixed_t z, an = th->AngleTo(dest); if (dest->flags & MF_SHADOW) { // Invisible target - an += pr_missile.Random2() * (45/256.); + an += pr_kmissile.Random2() * (45/256.); } th->Angles.Yaw = an; th->VelFromAngle(); diff --git a/src/g_shared/a_hatetarget.cpp b/src/g_shared/a_hatetarget.cpp index 78c9ee259..4d0d9a8e7 100644 --- a/src/g_shared/a_hatetarget.cpp +++ b/src/g_shared/a_hatetarget.cpp @@ -40,24 +40,37 @@ class AHateTarget : public AActor { - DECLARE_CLASS (AHateTarget, AActor) + DECLARE_CLASS(AHateTarget, AActor) public: - void BeginPlay (); + void BeginPlay(); + int TakeSpecialDamage(AActor *inflictor, AActor *source, int damage, FName damagetype); }; -IMPLEMENT_CLASS (AHateTarget) +IMPLEMENT_CLASS(AHateTarget) -void AHateTarget::BeginPlay () +void AHateTarget::BeginPlay() { - Super::BeginPlay (); + Super::BeginPlay(); if (SpawnAngle != 0) { // Each degree translates into 10 units of health health = SpawnAngle * 10; } else { - flags5 |= MF5_NODAMAGE; + special2 = 1; health = 1000001; } } +int AHateTarget::TakeSpecialDamage(AActor *inflictor, AActor *source, int damage, FName damagetype) +{ + if (special2 != 0) + { + return 0; + } + else + { + return damage; + } +} + diff --git a/src/g_strife/a_strifeweapons.cpp b/src/g_strife/a_strifeweapons.cpp index 91331ef83..5a3e1a3f4 100644 --- a/src/g_strife/a_strifeweapons.cpp +++ b/src/g_strife/a_strifeweapons.cpp @@ -266,7 +266,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireArrow) if (ti) { savedangle = self->_f_angle(); - self->Angles.Yaw += ANGLE2DBL(pr_electric.Random2() * (1 << (18 - self->player->mo->accuracy * 5 / 100))); + self->Angles.Yaw += ANGLE2DBL(pr_electric.Random2() << (18 - self->player->mo->accuracy * 5 / 100)); self->player->mo->PlayAttacking2 (); P_SpawnPlayerMissile (self, ti); self->Angles.Yaw = savedangle; diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 8a34d44e8..da881b03c 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -3006,7 +3006,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail) } // Let the aim trail behind the player - self->Angles.Yaw = ANGLE2DBL(self->AngleTo(self->target, -self->target->vel.x * 3, -self->target->vel.y * 3)); + self->Angles.Yaw = self->_f_AngleTo(self->target, -self->target->vel.x * 3, -self->target->vel.y * 3); if (self->target->flags & MF_SHADOW && !(self->flags6 & MF6_SEEINVISIBLE)) { diff --git a/src/vectors.h b/src/vectors.h index 0f196c676..d9723d43f 100644 --- a/src/vectors.h +++ b/src/vectors.h @@ -80,9 +80,6 @@ struct TVector2 { } - TVector2(const TRotator &rot); - - void Zero() { Y = X = 0; @@ -1002,6 +999,11 @@ struct TAngle return FLOAT2ANGLE(Degrees); } + TVector2 ToDirection(vec_t length) const + { + return TVector2(length * Cos(), length * Sin()); + } + int FixedAngle() // for ACS. This must be normalized so it just converts to BAM first and then shifts 16 bits right. { return FLOAT2ANGLE(Degrees) >> 16; @@ -1258,13 +1260,6 @@ inline TVector3::TVector3 (const TRotator &rot) Z = rot.Pitch.Sin(); } -template -inline TVector2::TVector2(const TRotator &rot) - : X(rot.Yaw.Cos()), Y(rot.Yaw.Sin()) -{ -} - - template inline TMatrix3x3::TMatrix3x3(const TVector3 &axis, TAngle degrees) {