- fixed some minor issues found during reviewing the code.

This commit is contained in:
Christoph Oelckers 2016-03-16 14:10:13 +01:00
parent 671291227e
commit 29a7fe33f3
12 changed files with 51 additions and 32 deletions

View file

@ -2348,7 +2348,7 @@ void Net_DoCommand (int type, BYTE **stream, int player)
} }
if (type >= DEM_SUMMON2 && type <= DEM_SUMMONFOE2) if (type >= DEM_SUMMON2 && type <= DEM_SUMMONFOE2)
{ {
spawned->Angles.Yaw -= angle; spawned->Angles.Yaw = source->Angles.Yaw - angle;
spawned->tid = tid; spawned->tid = tid;
spawned->special = special; spawned->special = special;
for(i = 0; i < 5; i++) { for(i = 0; i < 5; i++) {

View file

@ -1053,8 +1053,7 @@ void FParser::SF_ObjAngle(void)
mo = Script->trigger; mo = Script->trigger;
} }
t_return.type = svt_fixed; // haleyjd: fixed-point -- SoM again :) t_return.setDouble(mo ? mo->Angles.Yaw.Degrees : 0.);
t_return.value.f = mo ? (fixed_t)AngleToFixed(mo->_f_angle()) : 0; // null ptr check
} }
@ -3118,7 +3117,7 @@ void FParser::SF_MoveCamera(void)
quad1 == quad2) quad1 == quad2)
{ {
angledist = bigangle - smallangle; angledist = bigangle - smallangle;
angledir = targetangle > cam->_f_angle() ? 1 : -1; angledir = targetangle > camangle ? 1 : -1;
} }
else else
{ {

View file

@ -106,6 +106,24 @@ struct svalue_t
string = other.string; string = other.string;
value = other.value; 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); int intvalue(const svalue_t & v);

View file

@ -33,9 +33,7 @@ void A_SkullAttack(AActor *self, fixed_t speed)
S_Sound (self, CHAN_VOICE, self->AttackSound, 1, ATTN_NORM); S_Sound (self, CHAN_VOICE, self->AttackSound, 1, ATTN_NORM);
A_FaceTarget (self); A_FaceTarget (self);
an = self->_f_angle() >> ANGLETOFINESHIFT; self->VelFromAngle(speed);
self->vel.x = FixedMul (speed, finecosine[an]);
self->vel.y = FixedMul (speed, finesine[an]);
dist = self->AproxDistance (dest); dist = self->AproxDistance (dest);
dist = dist / speed; dist = dist / speed;

View file

@ -10,8 +10,6 @@
#include "doomstat.h" #include "doomstat.h"
*/ */
DECLARE_ACTION(A_SkullAttack)
enum PA_Flags enum PA_Flags
{ {
PAF_NOSKULLATTACK = 1, PAF_NOSKULLATTACK = 1,

View file

@ -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); mo = Spawn("ThrowingBomb", Owner->PosPlusZ(-Owner->floorclip+35*FRACUNIT + (Owner->player? Owner->player->crouchoffset : 0)), ALLOW_REPLACE);
if (mo) 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 /* Original flight code from Hexen
* mo->momz = 4*FRACUNIT+((player->lookdir)<<(FRACBITS-4)); * mo->momz = 4*FRACUNIT+((player->lookdir)<<(FRACBITS-4));

View file

@ -94,9 +94,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FogMove)
self->special2 = (weaveindex + 1) & 63; self->special2 = (weaveindex + 1) & 63;
} }
angle = self->_f_angle()>>ANGLETOFINESHIFT; self->VelFromAngle(speed);
self->vel.x = FixedMul(speed, finecosine[angle]);
self->vel.y = FixedMul(speed, finesine[angle]);
return 0; return 0;
} }

View file

@ -512,7 +512,7 @@ AActor *P_SpawnKoraxMissile (fixed_t x, fixed_t y, fixed_t z,
an = th->AngleTo(dest); an = th->AngleTo(dest);
if (dest->flags & MF_SHADOW) if (dest->flags & MF_SHADOW)
{ // Invisible target { // Invisible target
an += pr_missile.Random2() * (45/256.); an += pr_kmissile.Random2() * (45/256.);
} }
th->Angles.Yaw = an; th->Angles.Yaw = an;
th->VelFromAngle(); th->VelFromAngle();

View file

@ -43,6 +43,7 @@ class AHateTarget : public AActor
DECLARE_CLASS(AHateTarget, AActor) DECLARE_CLASS(AHateTarget, AActor)
public: public:
void BeginPlay(); void BeginPlay();
int TakeSpecialDamage(AActor *inflictor, AActor *source, int damage, FName damagetype);
}; };
IMPLEMENT_CLASS(AHateTarget) IMPLEMENT_CLASS(AHateTarget)
@ -56,8 +57,20 @@ void AHateTarget::BeginPlay ()
} }
else else
{ {
flags5 |= MF5_NODAMAGE; special2 = 1;
health = 1000001; health = 1000001;
} }
} }
int AHateTarget::TakeSpecialDamage(AActor *inflictor, AActor *source, int damage, FName damagetype)
{
if (special2 != 0)
{
return 0;
}
else
{
return damage;
}
}

View file

@ -266,7 +266,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireArrow)
if (ti) if (ti)
{ {
savedangle = self->_f_angle(); 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 (); self->player->mo->PlayAttacking2 ();
P_SpawnPlayerMissile (self, ti); P_SpawnPlayerMissile (self, ti);
self->Angles.Yaw = savedangle; self->Angles.Yaw = savedangle;

View file

@ -3006,7 +3006,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail)
} }
// Let the aim trail behind the player // 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)) if (self->target->flags & MF_SHADOW && !(self->flags6 & MF6_SEEINVISIBLE))
{ {

View file

@ -80,9 +80,6 @@ struct TVector2
{ {
} }
TVector2(const TRotator<vec_t> &rot);
void Zero() void Zero()
{ {
Y = X = 0; Y = X = 0;
@ -1002,6 +999,11 @@ struct TAngle
return FLOAT2ANGLE(Degrees); return FLOAT2ANGLE(Degrees);
} }
TVector2<vec_t> 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. 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; return FLOAT2ANGLE(Degrees) >> 16;
@ -1258,13 +1260,6 @@ inline TVector3<T>::TVector3 (const TRotator<T> &rot)
Z = rot.Pitch.Sin(); Z = rot.Pitch.Sin();
} }
template<class T>
inline TVector2<T>::TVector2(const TRotator<T> &rot)
: X(rot.Yaw.Cos()), Y(rot.Yaw.Sin())
{
}
template<class T> template<class T>
inline TMatrix3x3<T>::TMatrix3x3(const TVector3<T> &axis, TAngle<T> degrees) inline TMatrix3x3<T>::TMatrix3x3(const TVector3<T> &axis, TAngle<T> degrees)
{ {