- 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)
{
spawned->Angles.Yaw -= angle;
spawned->Angles.Yaw = source->Angles.Yaw - angle;
spawned->tid = tid;
spawned->special = special;
for(i = 0; i < 5; i++) {

View file

@ -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
{

View file

@ -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);

View file

@ -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;

View file

@ -10,8 +10,6 @@
#include "doomstat.h"
*/
DECLARE_ACTION(A_SkullAttack)
enum PA_Flags
{
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);
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));

View file

@ -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;
}

View file

@ -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();

View file

@ -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;
}
}

View file

@ -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;

View file

@ -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))
{

View file

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