- removed the angle_t type from the VM, now that nothing in the interface requires it anymore.

This commit is contained in:
Christoph Oelckers 2016-03-25 14:55:01 +01:00
parent 8b6b5e7b1c
commit 3a598d672e
9 changed files with 1 additions and 114 deletions

View file

@ -847,11 +847,6 @@ public:
return P_AproxDistance(_f_X() - otherpos.x + xadd, _f_Y() - otherpos.y + yadd); return P_AproxDistance(_f_X() - otherpos.x + xadd, _f_Y() - otherpos.y + yadd);
} }
fixed_t AproxDistance3D(AActor *other, bool absolute = false)
{
return P_AproxDistance(AproxDistance(other), _f_Z() - other->_f_Z());
}
// more precise, but slower version, being used in a few places // more precise, but slower version, being used in a few places
double Distance2D(AActor *other, bool absolute = false) double Distance2D(AActor *other, bool absolute = false)
{ {

View file

@ -80,7 +80,6 @@ PSound *TypeSound;
PColor *TypeColor; PColor *TypeColor;
PStatePointer *TypeState; PStatePointer *TypeState;
PFixed *TypeFixed; PFixed *TypeFixed;
PAngle *TypeAngle;
// PRIVATE DATA DEFINITIONS ------------------------------------------------ // PRIVATE DATA DEFINITIONS ------------------------------------------------
@ -507,7 +506,6 @@ void PType::StaticInit()
RUNTIME_CLASS(PClass)->TypeTableType = RUNTIME_CLASS(PClass); RUNTIME_CLASS(PClass)->TypeTableType = RUNTIME_CLASS(PClass);
RUNTIME_CLASS(PStatePointer)->TypeTableType = RUNTIME_CLASS(PStatePointer); RUNTIME_CLASS(PStatePointer)->TypeTableType = RUNTIME_CLASS(PStatePointer);
RUNTIME_CLASS(PFixed)->TypeTableType = RUNTIME_CLASS(PFixed); RUNTIME_CLASS(PFixed)->TypeTableType = RUNTIME_CLASS(PFixed);
RUNTIME_CLASS(PAngle)->TypeTableType = RUNTIME_CLASS(PAngle);
// Create types and add them type the type table. // Create types and add them type the type table.
TypeTable.AddType(TypeError = new PErrorType); TypeTable.AddType(TypeError = new PErrorType);
@ -527,7 +525,6 @@ void PType::StaticInit()
TypeTable.AddType(TypeColor = new PColor); TypeTable.AddType(TypeColor = new PColor);
TypeTable.AddType(TypeState = new PStatePointer); TypeTable.AddType(TypeState = new PStatePointer);
TypeTable.AddType(TypeFixed = new PFixed); TypeTable.AddType(TypeFixed = new PFixed);
TypeTable.AddType(TypeAngle = new PAngle);
GlobalSymbols.AddSymbol(new PSymbolType(NAME_sByte, TypeSInt8)); GlobalSymbols.AddSymbol(new PSymbolType(NAME_sByte, TypeSInt8));
GlobalSymbols.AddSymbol(new PSymbolType(NAME_Byte, TypeUInt8)); GlobalSymbols.AddSymbol(new PSymbolType(NAME_Byte, TypeUInt8));
@ -546,7 +543,6 @@ void PType::StaticInit()
GlobalSymbols.AddSymbol(new PSymbolType(NAME_Color, TypeColor)); GlobalSymbols.AddSymbol(new PSymbolType(NAME_Color, TypeColor));
GlobalSymbols.AddSymbol(new PSymbolType(NAME_State, TypeState)); GlobalSymbols.AddSymbol(new PSymbolType(NAME_State, TypeState));
GlobalSymbols.AddSymbol(new PSymbolType(NAME_Fixed, TypeFixed)); GlobalSymbols.AddSymbol(new PSymbolType(NAME_Fixed, TypeFixed));
GlobalSymbols.AddSymbol(new PSymbolType(NAME_Angle, TypeAngle));
} }
@ -1146,67 +1142,6 @@ int PFixed::GetLoadOp() const
return OP_LX; return OP_LX;
} }
/* PAngle *****************************************************************/
IMPLEMENT_CLASS(PAngle)
//==========================================================================
//
// PAngle Default Constructor
//
//==========================================================================
PAngle::PAngle()
: PFloat(sizeof(angle_t))
{
}
//==========================================================================
//
// PAngle :: SetValue
//
//==========================================================================
void PAngle::SetValue(void *addr, int val)
{
assert(((intptr_t)addr & (Align - 1)) == 0 && "unaligned address");
*(angle_t *)addr = Scale(val, ANGLE_90, 90);
}
//==========================================================================
//
// PAngle :: GetValueInt
//
//==========================================================================
int PAngle::GetValueInt(void *addr) const
{
assert(((intptr_t)addr & (Align - 1)) == 0 && "unaligned address");
return *(angle_t *)addr / ANGLE_1;
}
//==========================================================================
//
// PAngle :: GetStoreOp
//
//==========================================================================
int PAngle::GetStoreOp() const
{
return OP_SANG;
}
//==========================================================================
//
// PAngle :: GetLoadOp
//
//==========================================================================
int PAngle::GetLoadOp() const
{
return OP_LANG;
}
/* PStatePointer **********************************************************/ /* PStatePointer **********************************************************/
IMPLEMENT_CLASS(PStatePointer) IMPLEMENT_CLASS(PStatePointer)

View file

@ -415,18 +415,6 @@ public:
virtual int GetLoadOp() const; virtual int GetLoadOp() const;
}; };
class PAngle : public PFloat
{
DECLARE_CLASS(PAngle, PFloat);
public:
PAngle();
virtual void SetValue(void *addr, int val);
virtual int GetValueInt(void *addr) const;
virtual int GetStoreOp() const;
virtual int GetLoadOp() const;
};
// Pointers ----------------------------------------------------------------- // Pointers -----------------------------------------------------------------
class PStatePointer : public PBasicType class PStatePointer : public PBasicType
@ -784,7 +772,6 @@ extern PSound *TypeSound;
extern PColor *TypeColor; extern PColor *TypeColor;
extern PStatePointer *TypeState; extern PStatePointer *TypeState;
extern PFixed *TypeFixed; extern PFixed *TypeFixed;
extern PAngle *TypeAngle;
// A constant value --------------------------------------------------------- // A constant value ---------------------------------------------------------

View file

@ -1243,7 +1243,7 @@ void R_DrawSkyBoxes ()
viewx = viewpos.x; viewx = viewpos.x;
viewy = viewpos.y; viewy = viewpos.y;
viewz = viewpos.z; viewz = viewpos.z;
viewangle = savedangle + FLOAT2ANGLE(sky->PrevAngles.Yaw.Degrees) + FixedMul(r_TicFrac, sky->_f_angle() - FLOAT2ANGLE(sky->PrevAngles.Yaw.Degrees)); viewangle = savedangle + (sky->PrevAngles.Yaw + (sky->Angles.Yaw * r_TicFracF) - sky->PrevAngles.Yaw).BAMs();
R_CopyStackedViewParameters(); R_CopyStackedViewParameters();
} }

View file

@ -193,7 +193,6 @@ std2:
/* other DECORATE top level keywords */ /* other DECORATE top level keywords */
'#include' { RET(TK_Include); } '#include' { RET(TK_Include); }
'fixed_t' { RET(TK_Fixed_t); } 'fixed_t' { RET(TK_Fixed_t); }
'angle_t' { RET(TK_Angle_t); }
L (L|D)* { RET(TK_Identifier); } L (L|D)* { RET(TK_Identifier); }

View file

@ -112,7 +112,6 @@ xx(TK_Self, "'self'")
xx(TK_Stop, "'stop'") xx(TK_Stop, "'stop'")
xx(TK_Include, "'include'") xx(TK_Include, "'include'")
xx(TK_Fixed_t, "'fixed_t'") xx(TK_Fixed_t, "'fixed_t'")
xx(TK_Angle_t, "'angle_t'")
xx(TK_Is, "'is'") xx(TK_Is, "'is'")
xx(TK_Replaces, "'replaces'") xx(TK_Replaces, "'replaces'")

View file

@ -486,10 +486,6 @@ static void ParseNativeFunction(FScanner &sc, PClassActor *cls)
rets.Push(TypeFloat64); rets.Push(TypeFloat64);
break; break;
case TK_Angle_t:
rets.Push(TypeAngle);
break;
case TK_Fixed_t: case TK_Fixed_t:
rets.Push(TypeFixed); rets.Push(TypeFixed);
break; break;

View file

@ -220,16 +220,6 @@ begin:
GETADDR(PB,RC,X_READ_NIL); GETADDR(PB,RC,X_READ_NIL);
reg.f[a] = *(VM_SWORD *)ptr / 65536.0; reg.f[a] = *(VM_SWORD *)ptr / 65536.0;
NEXTOP; NEXTOP;
OP(LANG):
ASSERTF(a); ASSERTA(B); ASSERTKD(C);
GETADDR(PB,KC,X_READ_NIL);
reg.f[a] = (*(VM_UWORD *)ptr >> 1) * (180.0 / 0x40000000); // BAM -> deg
NEXTOP;
OP(LANG_R):
ASSERTF(a); ASSERTA(B); ASSERTD(C);
GETADDR(PB,RC,X_READ_NIL);
reg.f[a] = (*(VM_UWORD *)ptr >> 1) * (180.0 / 0x40000000);
NEXTOP;
OP(LBIT): OP(LBIT):
ASSERTD(a); ASSERTA(B); ASSERTD(a); ASSERTA(B);
GETADDR(PB,0,X_READ_NIL); GETADDR(PB,0,X_READ_NIL);
@ -336,16 +326,6 @@ begin:
GETADDR(PA,RC,X_WRITE_NIL); GETADDR(PA,RC,X_WRITE_NIL);
*(VM_SWORD *)ptr = (VM_SWORD)(reg.f[B] * 65536.0); *(VM_SWORD *)ptr = (VM_SWORD)(reg.f[B] * 65536.0);
NEXTOP; NEXTOP;
OP(SANG):
ASSERTA(a); ASSERTF(B); ASSERTKD(C);
GETADDR(PA,KC,X_WRITE_NIL);
*(VM_UWORD *)ptr = (VM_UWORD)(xs_CRoundToInt((reg.f[B]) * (0x40000000/90.))); // deg -> BAM
NEXTOP;
OP(SANG_R):
ASSERTA(a); ASSERTF(B); ASSERTD(C);
GETADDR(PA,RC,X_WRITE_NIL);
*(VM_UWORD *)ptr = (VM_UWORD)(xs_CRoundToInt((reg.f[B]) * (0x40000000/90.)));
NEXTOP;
OP(SBIT): OP(SBIT):
ASSERTA(a); ASSERTD(B); ASSERTA(a); ASSERTD(B);
GETADDR(PA,0,X_WRITE_NIL); GETADDR(PA,0,X_WRITE_NIL);

View file

@ -37,8 +37,6 @@ xx(LV, lv, RVRPKI), // load vector
xx(LV_R, lv, RVRPRI), xx(LV_R, lv, RVRPRI),
xx(LX, lx, RFRPKI), // load fixed point xx(LX, lx, RFRPKI), // load fixed point
xx(LX_R, lx, RFRPRI), xx(LX_R, lx, RFRPRI),
xx(LANG, lang, RFRPKI), // load angle
xx(LANG_R, lang, RFRPRI),
xx(LBIT, lbit, RIRPI8), // rA = !!(*rB & C) -- *rB is a byte xx(LBIT, lbit, RIRPI8), // rA = !!(*rB & C) -- *rB is a byte
@ -61,8 +59,6 @@ xx(SV, sv, RPRVKI), // store vector
xx(SV_R, sv, RPRVRI), xx(SV_R, sv, RPRVRI),
xx(SX, sx, RPRFKI), // store fixed point xx(SX, sx, RPRFKI), // store fixed point
xx(SX_R, sx, RPRFRI), xx(SX_R, sx, RPRFRI),
xx(SANG, sang, RPRFKI), // store angle
xx(SANG_R, sang, RPRFRI),
xx(SBIT, sbit, RPRII8), // *rA |= C if rB is true, *rA &= ~C otherwise xx(SBIT, sbit, RPRII8), // *rA |= C if rB is true, *rA &= ~C otherwise