mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 23:11:58 +00:00
- several fixes.
This commit is contained in:
parent
29a7fe33f3
commit
b140d71c49
26 changed files with 97 additions and 83 deletions
|
@ -875,13 +875,13 @@ public:
|
|||
DAngle _f_AngleTo(AActor *other, bool absolute = false)
|
||||
{
|
||||
fixedvec3 otherpos = absolute ? other->Pos() : other->PosRelative(this);
|
||||
return g_atan2(otherpos.y - Y(), otherpos.x - X());
|
||||
return vectoyaw(otherpos.x - X(), otherpos.y - Y());
|
||||
}
|
||||
|
||||
DAngle _f_AngleTo(AActor *other, fixed_t oxofs, fixed_t oyofs, bool absolute = false) const
|
||||
{
|
||||
fixedvec3 otherpos = absolute ? other->Pos() : other->PosRelative(this);
|
||||
return g_atan2(otherpos.y + oxofs - Y(), otherpos.x + oyofs - X());
|
||||
return vectoyaw(otherpos.y + oxofs - Y(), otherpos.x + oyofs - X());
|
||||
}
|
||||
|
||||
fixedvec2 Vec2To(AActor *other) const
|
||||
|
@ -1321,7 +1321,7 @@ public:
|
|||
|
||||
void AngleFromVel()
|
||||
{
|
||||
Angles.Yaw = vectoyaw(DVector2(vel.x, vel.y));
|
||||
Angles.Yaw = vectoyaw(vel.x, vel.y);
|
||||
}
|
||||
|
||||
void VelFromAngle()
|
||||
|
|
|
@ -2656,8 +2656,8 @@ void Net_DoCommand (int type, BYTE **stream, int player)
|
|||
break;
|
||||
|
||||
case DEM_SETPITCHLIMIT:
|
||||
players[player].MinPitch = ReadByte(stream); // up
|
||||
players[player].MaxPitch = ReadByte(stream); // down
|
||||
players[player].MinPitch = -(double)ReadByte(stream); // up
|
||||
players[player].MaxPitch = (double)ReadByte(stream); // down
|
||||
break;
|
||||
|
||||
case DEM_ADVANCEINTER:
|
||||
|
|
|
@ -864,7 +864,7 @@ void FParser::SF_Spawn(void)
|
|||
{
|
||||
int x, y, z;
|
||||
PClassActor *pclass;
|
||||
DAngle angle = 0;
|
||||
DAngle angle = 0.;
|
||||
|
||||
if (CheckArgs(3))
|
||||
{
|
||||
|
@ -1470,7 +1470,7 @@ void FParser::SF_SetCamera(void)
|
|||
newcamera->special2=newcamera->Z();
|
||||
newcamera->SetZ(t_argc < 3 ? (newcamera->Z() + (41 << FRACBITS)) : (intvalue(t_argv[2]) << FRACBITS));
|
||||
newcamera->Angles.Yaw = angle;
|
||||
if (t_argc < 4) newcamera->Angles.Pitch = 0;
|
||||
if (t_argc < 4) newcamera->Angles.Pitch = 0.;
|
||||
else newcamera->Angles.Pitch = clamp(floatvalue(t_argv[3]), -50., 50.) * (20. / 32.);
|
||||
player->camera=newcamera;
|
||||
}
|
||||
|
@ -3865,7 +3865,8 @@ void FParser::SF_Tan()
|
|||
if (CheckArgs(1))
|
||||
{
|
||||
t_return.type = svt_fixed;
|
||||
t_return.value.f = FLOAT2FIXED(g_tan(floatvalue(t_argv[0])));
|
||||
t_return.value.f = FLOAT2FIXED(
|
||||
g_tan(floatvalue(t_argv[0])));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
void A_SkullAttack(AActor *self, fixed_t speed)
|
||||
{
|
||||
AActor *dest;
|
||||
angle_t an;
|
||||
int dist;
|
||||
|
||||
if (!self->target)
|
||||
|
|
|
@ -403,7 +403,7 @@ void FireMacePL1B (AActor *actor)
|
|||
return;
|
||||
}
|
||||
ball = Spawn("MaceFX2", actor->PosPlusZ(28*FRACUNIT - actor->floorclip), ALLOW_REPLACE);
|
||||
ball->vel.z = FLOAT2FIXED(2 + g_tan(-actor->Angles.Pitch.Degrees));
|
||||
ball->vel.z = FLOAT2FIXED(2 - actor->Angles.Pitch.Tan());
|
||||
ball->target = actor;
|
||||
ball->Angles.Yaw = actor->Angles.Yaw;
|
||||
ball->AddZ(ball->vel.z);
|
||||
|
@ -631,7 +631,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DeathBallImpact)
|
|||
|
||||
int i;
|
||||
AActor *target;
|
||||
DAngle angle = 0;
|
||||
DAngle angle = 0.;
|
||||
bool newAngle;
|
||||
FTranslatedLineTarget t;
|
||||
|
||||
|
@ -664,7 +664,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DeathBallImpact)
|
|||
}
|
||||
else
|
||||
{ // Find new target
|
||||
angle = 0;
|
||||
angle = 0.;
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
P_AimLineAttack (self, FLOAT2ANGLE(angle.Degrees), 10*64*FRACUNIT, &t, 0, ALF_NOFRIENDS|ALF_PORTALRESTRICT, NULL, self->target);
|
||||
|
@ -1337,7 +1337,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL2)
|
|||
return 0;
|
||||
}
|
||||
|
||||
slope = FLOAT2FIXED(g_tan(-self->Angles.Pitch.Degrees));
|
||||
slope = FLOAT2FIXED(-self->Angles.Pitch.Tan());
|
||||
fixed_t xo = (pr_fp2.Random2() << 9);
|
||||
fixed_t yo = (pr_fp2.Random2() << 9);
|
||||
fixedvec3 pos = self->Vec3Offset(xo, yo,
|
||||
|
|
|
@ -498,7 +498,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CHolySeek)
|
|||
}
|
||||
if (self->tracer)
|
||||
{
|
||||
CHolySeekerMissile (self, self->args[0], self->args[0]*2);
|
||||
CHolySeekerMissile (self, (double)self->args[0], self->args[0]*2.);
|
||||
if (!((level.time+7)&15))
|
||||
{
|
||||
self->args[0] = 5+(pr_holyseek()/20);
|
||||
|
|
|
@ -182,7 +182,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DragonFlight)
|
|||
|
||||
angle_t angle;
|
||||
|
||||
DragonSeek (self, 4, 8);
|
||||
DragonSeek (self, 4., 8.);
|
||||
if (self->target)
|
||||
{
|
||||
if(!(self->target->flags&MF_SHOOTABLE))
|
||||
|
|
|
@ -73,7 +73,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_FogMove)
|
|||
PARAM_ACTION_PROLOGUE;
|
||||
|
||||
int speed = self->args[0]<<FRACBITS;
|
||||
angle_t angle;
|
||||
int weaveindex;
|
||||
|
||||
if (!self->args[4])
|
||||
|
|
|
@ -433,7 +433,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_KSpiritRoam)
|
|||
{
|
||||
if (self->tracer)
|
||||
{
|
||||
A_KSpiritSeeker(self, self->args[0], self->args[0] * 2);
|
||||
A_KSpiritSeeker(self, (double)self->args[0], self->args[0] * 2.);
|
||||
}
|
||||
CHolyWeave(self, pr_kspiritweave);
|
||||
if (pr_kspiritroam()<50)
|
||||
|
@ -509,7 +509,7 @@ AActor *P_SpawnKoraxMissile (fixed_t x, fixed_t y, fixed_t z,
|
|||
z -= source->floorclip;
|
||||
th = Spawn (type, x, y, z, ALLOW_REPLACE);
|
||||
th->target = source; // Originator
|
||||
an = th->AngleTo(dest);
|
||||
an = th->_f_AngleTo(dest);
|
||||
if (dest->flags & MF_SHADOW)
|
||||
{ // Invisible target
|
||||
an += pr_kmissile.Random2() * (45/256.);
|
||||
|
|
|
@ -171,7 +171,7 @@ void P_TeleportToPlayerStarts (AActor *victim)
|
|||
FPlayerStart *start = G_PickPlayerStart(0, PPS_FORCERANDOM | PPS_NOBLOCKINGCHECK);
|
||||
destX = start->x;
|
||||
destY = start->y;
|
||||
P_Teleport (victim, destX, destY, ONFLOORZ, start->angle, TELF_SOURCEFOG | TELF_DESTFOG);
|
||||
P_Teleport (victim, destX, destY, ONFLOORZ, (double)start->angle, TELF_SOURCEFOG | TELF_DESTFOG);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -191,7 +191,7 @@ void P_TeleportToDeathmatchStarts (AActor *victim)
|
|||
i = pr_teledm() % selections;
|
||||
destX = deathmatchstarts[i].x;
|
||||
destY = deathmatchstarts[i].y;
|
||||
P_Teleport (victim, destX, destY, ONFLOORZ, deathmatchstarts[i].angle, TELF_SOURCEFOG | TELF_DESTFOG);
|
||||
P_Teleport (victim, destX, destY, ONFLOORZ, (double)deathmatchstarts[i].angle, TELF_SOURCEFOG | TELF_DESTFOG);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -46,7 +46,7 @@ bool AArtiTeleport::Use (bool pickup)
|
|||
destY = start->y;
|
||||
destAngle = start->angle;
|
||||
}
|
||||
P_Teleport (Owner, destX, destY, ONFLOORZ, destAngle, TELF_SOURCEFOG | TELF_DESTFOG);
|
||||
P_Teleport (Owner, destX, destY, ONFLOORZ, (double)destAngle, TELF_SOURCEFOG | TELF_DESTFOG);
|
||||
bool canlaugh = true;
|
||||
if (Owner->player->morphTics && (Owner->player->MorphStyle & MORPH_UNDOBYCHAOSDEVICE))
|
||||
{ // Teleporting away will undo any morph effects (pig)
|
||||
|
|
|
@ -323,7 +323,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks)
|
|||
self->player = NULL;
|
||||
head->ObtainInventory (self);
|
||||
}
|
||||
head->Angles.Pitch = 0;
|
||||
head->Angles.Pitch = 0.;
|
||||
head->RenderStyle = self->RenderStyle;
|
||||
head->alpha = self->alpha;
|
||||
if (head->player->camera == self)
|
||||
|
|
|
@ -78,12 +78,12 @@ void ASecurityCamera::PostBeginPlay ()
|
|||
if (args[2])
|
||||
Delta = 360. / (args[2] * TICRATE / 8);
|
||||
else
|
||||
Delta = 0;
|
||||
Delta = 0.;
|
||||
if (args[1])
|
||||
Delta /= 2;
|
||||
Acc = 0;
|
||||
Angles.Pitch = clamp<int>((signed int)((signed char)args[0]), -89, 89);
|
||||
Range = args[1];
|
||||
Acc = 0.;
|
||||
Angles.Pitch = (double)clamp<int>((signed char)args[0], -89, 89);
|
||||
Range = (double)args[1];
|
||||
}
|
||||
|
||||
void ASecurityCamera::Tick ()
|
||||
|
@ -133,7 +133,7 @@ void AAimingCamera::PostBeginPlay ()
|
|||
|
||||
args[2] = 0;
|
||||
Super::PostBeginPlay ();
|
||||
MaxPitchChange = changepitch / TICRATE;
|
||||
MaxPitchChange = double(changepitch / TICRATE);
|
||||
Range /= TICRATE;
|
||||
|
||||
TActorIterator<AActor> iterator (args[3]);
|
||||
|
@ -177,8 +177,7 @@ void AAimingCamera::Tick ()
|
|||
DVector2 vect(fv3.x, fv3.y);
|
||||
double dz = Z() - tracer->Z() - tracer->height/2;
|
||||
double dist = vect.Length();
|
||||
double ang = dist != 0.f ? g_atan2 (dz, dist) : 0;
|
||||
DAngle desiredPitch = ToDegrees(ang);
|
||||
DAngle desiredPitch = dist != 0.f ? vectoyaw(dist, dz) : 0.;
|
||||
DAngle diff = deltaangle(Angles.Pitch, desiredPitch);
|
||||
if (fabs (diff) < MaxPitchChange)
|
||||
{
|
||||
|
|
|
@ -102,7 +102,7 @@ void AInterpolationPoint::FormChain ()
|
|||
if (Next == NULL && (args[3] | args[4]))
|
||||
Printf ("Can't find target for camera node %d\n", tid);
|
||||
|
||||
Angles.Pitch = clamp<int>((signed char)args[0], -89, 89);
|
||||
Angles.Pitch = (double)clamp<int>((signed char)args[0], -89, 89);
|
||||
|
||||
if (Next != NULL)
|
||||
Next->FormChain ();
|
||||
|
@ -422,7 +422,7 @@ bool APathFollower::Interpolate ()
|
|||
}
|
||||
if (args[2] & 2)
|
||||
{ // adjust yaw
|
||||
Angles.Yaw = vectoyaw(DVector2(dx, dy));
|
||||
Angles.Yaw = vectoyaw(dx, dy);
|
||||
}
|
||||
if (args[2] & 4)
|
||||
{ // adjust pitch; use floats for precision
|
||||
|
@ -430,8 +430,7 @@ bool APathFollower::Interpolate ()
|
|||
double fdy = FIXED2DBL(dy);
|
||||
double fdz = FIXED2DBL(-dz);
|
||||
double dist = g_sqrt (fdx*fdx + fdy*fdy);
|
||||
double ang = dist != 0.f ? g_atan2 (fdz, dist) : 0;
|
||||
Angles.Pitch = ToDegrees(ang);
|
||||
Angles.Pitch = dist != 0.f ? vectoyaw(dist, fdz) : 0.;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -642,8 +641,7 @@ bool AMovingCamera::Interpolate ()
|
|||
double dy = FIXED2DBL(Y() - tracer->Y());
|
||||
double dz = FIXED2DBL(Z() - tracer->Z() - tracer->height/2);
|
||||
double dist = g_sqrt (dx*dx + dy*dy);
|
||||
double ang = dist != 0.f ? g_atan2 (dz, dist) : 0;
|
||||
Angles.Pitch = ToDegrees(ang);
|
||||
Angles.Pitch = dist != 0.f ? vectoyaw(dist, dz) : 0.;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -251,7 +251,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireArrow)
|
|||
PARAM_ACTION_PROLOGUE;
|
||||
PARAM_CLASS(ti, AActor);
|
||||
|
||||
angle_t savedangle;
|
||||
DAngle savedangle;
|
||||
|
||||
if (self->player == NULL)
|
||||
return 0;
|
||||
|
@ -265,7 +265,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireArrow)
|
|||
|
||||
if (ti)
|
||||
{
|
||||
savedangle = self->_f_angle();
|
||||
savedangle = self->Angles.Yaw;
|
||||
self->Angles.Yaw += ANGLE2DBL(pr_electric.Random2() << (18 - self->player->mo->accuracy * 5 / 100));
|
||||
self->player->mo->PlayAttacking2 ();
|
||||
P_SpawnPlayerMissile (self, ti);
|
||||
|
@ -346,7 +346,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireMiniMissile)
|
|||
PARAM_ACTION_PROLOGUE;
|
||||
|
||||
player_t *player = self->player;
|
||||
angle_t savedangle;
|
||||
DAngle savedangle;
|
||||
|
||||
if (self->player == NULL)
|
||||
return 0;
|
||||
|
@ -358,7 +358,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireMiniMissile)
|
|||
return 0;
|
||||
}
|
||||
|
||||
savedangle = self->_f_angle();
|
||||
savedangle = self->Angles.Yaw;
|
||||
self->Angles.Yaw += ANGLE2DBL(pr_minimissile.Random2() << (19 - player->mo->accuracy * 5 / 100));
|
||||
player->mo->PlayAttacking2 ();
|
||||
P_SpawnPlayerMissile (self, PClass::FindActor("MiniMissile"));
|
||||
|
|
|
@ -1382,7 +1382,7 @@ static void HandleReply(player_t *player, bool isconsole, int nodenum, int reply
|
|||
player->ConversationFaceTalker = false;
|
||||
player->ConversationNPC = NULL;
|
||||
player->ConversationPC = NULL;
|
||||
player->ConversationNPCAngle = 0;
|
||||
player->ConversationNPCAngle = 0.;
|
||||
}
|
||||
|
||||
if (isconsole)
|
||||
|
@ -1429,7 +1429,7 @@ void P_ConversationCommand (int netcode, int pnum, BYTE **stream)
|
|||
player->ConversationFaceTalker = false;
|
||||
player->ConversationNPC = NULL;
|
||||
player->ConversationPC = NULL;
|
||||
player->ConversationNPCAngle = 0;
|
||||
player->ConversationNPCAngle = 0.;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -744,7 +744,7 @@ void P_DrawRailTrail(AActor *source, const DVector3 &start, const DVector3 &end,
|
|||
|
||||
color1 = color1 == 0 ? -1 : ParticleColor(color1);
|
||||
pos = start;
|
||||
deg = TAngle<double>(SpiralOffset);
|
||||
deg = (double)SpiralOffset;
|
||||
for (i = spiral_steps; i; i--)
|
||||
{
|
||||
particle_t *p = NewParticle ();
|
||||
|
@ -770,7 +770,7 @@ void P_DrawRailTrail(AActor *source, const DVector3 &start, const DVector3 &end,
|
|||
p->y = FLOAT2FIXED(tempvec.Y);
|
||||
p->z = FLOAT2FIXED(tempvec.Z);
|
||||
pos += spiral_step;
|
||||
deg += TAngle<double>(r_rail_spiralsparsity * 14);
|
||||
deg += double(r_rail_spiralsparsity * 14);
|
||||
|
||||
if (color1 == -1)
|
||||
{
|
||||
|
|
|
@ -3002,7 +3002,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail)
|
|||
fixedvec2 pos = self->Vec2To(self->target);
|
||||
DVector2 xydiff(pos.x, pos.y);
|
||||
double zdiff = (self->target->Z() + (self->target->height>>1)) - (self->Z() + (self->height>>1) - self->floorclip);
|
||||
self->Angles.Pitch = -ToDegrees(g_atan2(zdiff, xydiff.Length()));
|
||||
self->Angles.Pitch = -vectoyaw(xydiff.Length(), zdiff);
|
||||
}
|
||||
|
||||
// Let the aim trail behind the player
|
||||
|
|
|
@ -1635,13 +1635,13 @@ FUNC(LS_Thing_Hate)
|
|||
FUNC(LS_Thing_ProjectileAimed)
|
||||
// Thing_ProjectileAimed (tid, type, speed, target, newtid)
|
||||
{
|
||||
return P_Thing_Projectile (arg0, it, arg1, NULL, 0, arg2<<(FRACBITS-3), 0, arg3, it, 0, arg4, false);
|
||||
return P_Thing_Projectile (arg0, it, arg1, NULL, 0., arg2<<(FRACBITS-3), 0, arg3, it, 0, arg4, false);
|
||||
}
|
||||
|
||||
FUNC(LS_Thing_ProjectileIntercept)
|
||||
// Thing_ProjectileIntercept (tid, type, speed, target, newtid)
|
||||
{
|
||||
return P_Thing_Projectile (arg0, it, arg1, NULL, 0, arg2<<(FRACBITS-3), 0, arg3, it, 0, arg4, true);
|
||||
return P_Thing_Projectile (arg0, it, arg1, NULL, 0., arg2<<(FRACBITS-3), 0, arg3, it, 0, arg4, true);
|
||||
}
|
||||
|
||||
// [BC] added newtid for next two
|
||||
|
|
|
@ -2359,7 +2359,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
|||
if (thing == players[consoleplayer].camera)
|
||||
{
|
||||
divline_t dl1 = { besthit.oldrefpos.x,besthit. oldrefpos.y, besthit.refpos.x - besthit.oldrefpos.x, besthit.refpos.y - besthit.oldrefpos.y };
|
||||
fixedvec3a hit = { dl1.x + FixedMul(dl1.dx, bestfrac), dl1.y + FixedMul(dl1.dy, bestfrac), 0, 0 };
|
||||
fixedvec3a hit = { dl1.x + FixedMul(dl1.dx, bestfrac), dl1.y + FixedMul(dl1.dy, bestfrac), 0, 0. };
|
||||
|
||||
R_AddInterpolationPoint(hit);
|
||||
if (port->mType == PORTT_LINKED)
|
||||
|
@ -3531,7 +3531,7 @@ struct aim_t
|
|||
{
|
||||
res.linetarget = th;
|
||||
res.pitch = pitch;
|
||||
res.angleFromSource = vectoyaw(DVector2(th->X() - startpos.x, th->Y() - startpos.y));
|
||||
res.angleFromSource = vectoyaw(th->X() - startpos.x, th->Y() - startpos.y);
|
||||
res.unlinked = unlinked;
|
||||
res.frac = frac;
|
||||
}
|
||||
|
|
|
@ -840,7 +840,7 @@ AInventory *AActor::DropInventory (AInventory *item)
|
|||
}
|
||||
drop->SetOrigin(PosPlusZ(10*FRACUNIT), false);
|
||||
drop->Angles.Yaw = Angles.Yaw;
|
||||
drop->VelFromAngle(5);
|
||||
drop->VelFromAngle(5*FRACUNIT);
|
||||
drop->vel.z = FRACUNIT;
|
||||
drop->vel += vel;
|
||||
drop->flags &= ~MF_NOGRAVITY; // Don't float
|
||||
|
@ -1760,7 +1760,7 @@ bool P_SeekerMissile (AActor *actor, angle_t _thresh, angle_t _turnMax, bool pre
|
|||
}
|
||||
else
|
||||
{
|
||||
DAngle pitch = 0;
|
||||
DAngle pitch = 0.;
|
||||
if (!(actor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)))
|
||||
{ // Need to seek vertically
|
||||
fixed_t dist = MAX(1, actor->Distance2D(target));
|
||||
|
@ -2824,7 +2824,7 @@ void P_NightmareRespawn (AActor *mobj)
|
|||
mo->SpawnPoint[2] = mobj->SpawnPoint[2];
|
||||
mo->SpawnAngle = mobj->SpawnAngle;
|
||||
mo->SpawnFlags = mobj->SpawnFlags & ~MTF_DORMANT; // It wasn't dormant when it died, so it's not dormant now, either.
|
||||
mo->Angles.Yaw = mobj->SpawnAngle;
|
||||
mo->Angles.Yaw = (double)mobj->SpawnAngle;
|
||||
|
||||
mo->HandleSpawnFlags ();
|
||||
mo->reactiontime = 18;
|
||||
|
@ -4649,7 +4649,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
|
|||
spawn_y = mthing->y;
|
||||
|
||||
// Allow full angular precision
|
||||
SpawnAngle = mthing->angle;
|
||||
SpawnAngle = (double)mthing->angle;
|
||||
if (i_compatflags2 & COMPATF2_BADANGLES)
|
||||
{
|
||||
SpawnAngle += 0.01;
|
||||
|
@ -4704,7 +4704,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
|
|||
}
|
||||
|
||||
mobj->Angles.Yaw = SpawnAngle;
|
||||
mobj->Angles.Pitch = mobj->Angles.Roll = 0;
|
||||
mobj->Angles.Pitch = mobj->Angles.Roll = 0.;
|
||||
mobj->health = p->health;
|
||||
|
||||
// [RH] Set player sprite based on skin
|
||||
|
@ -4735,7 +4735,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
|
|||
p->BlendR = p->BlendG = p->BlendB = p->BlendA = 0.f;
|
||||
p->mo->ResetAirSupply(false);
|
||||
p->Uncrouch();
|
||||
p->MinPitch = p->MaxPitch = 0; // will be filled in by PostBeginPlay()/netcode
|
||||
p->MinPitch = p->MaxPitch = 0.; // will be filled in by PostBeginPlay()/netcode
|
||||
p->MUSINFOactor = NULL;
|
||||
p->MUSINFOtics = -1;
|
||||
|
||||
|
@ -5167,7 +5167,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
|
|||
mobj->tid = mthing->thingid;
|
||||
mobj->AddToHash ();
|
||||
|
||||
mobj->PrevAngles.Yaw = mobj->Angles.Yaw = mthing->angle;
|
||||
mobj->PrevAngles.Yaw = mobj->Angles.Yaw = (double)mthing->angle;
|
||||
|
||||
// Check if this actor's mapthing has a conversation defined
|
||||
if (mthing->Conversation > 0)
|
||||
|
@ -5191,9 +5191,9 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
|
|||
if (mthing->scaleY)
|
||||
mobj->scaleY = FixedMul(mthing->scaleY, mobj->scaleY);
|
||||
if (mthing->pitch)
|
||||
mobj->Angles.Pitch = mthing->pitch;
|
||||
mobj->Angles.Pitch = (double)mthing->pitch;
|
||||
if (mthing->roll)
|
||||
mobj->Angles.Roll = mthing->roll;
|
||||
mobj->Angles.Roll = (double)mthing->roll;
|
||||
if (mthing->score)
|
||||
mobj->Score = mthing->score;
|
||||
if (mthing->fillcolor)
|
||||
|
|
|
@ -171,7 +171,7 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, DAngle angle, i
|
|||
player->viewz = thing->Z() + player->viewheight;
|
||||
if (resetpitch)
|
||||
{
|
||||
player->mo->Angles.Pitch = 0;
|
||||
player->mo->Angles.Pitch = 0.;
|
||||
}
|
||||
}
|
||||
if (!(flags & TELF_KEEPORIENTATION))
|
||||
|
@ -326,10 +326,10 @@ bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, int f
|
|||
{
|
||||
AActor *searcher;
|
||||
fixed_t z;
|
||||
DAngle angle = 0;
|
||||
DAngle angle = 0.;
|
||||
fixed_t s = 0, c = 0;
|
||||
fixed_t vx = 0, vy = 0;
|
||||
DAngle badangle = 0;
|
||||
DAngle badangle = 0.;
|
||||
|
||||
if (thing == NULL)
|
||||
{ // Teleport function called with an invalid actor
|
||||
|
@ -356,7 +356,7 @@ bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, int f
|
|||
// Rotate 90 degrees, so that walking perpendicularly across
|
||||
// teleporter linedef causes thing to exit in the direction
|
||||
// indicated by the exit thing.
|
||||
angle = vectoyaw(DVector2(line->dx, line->dy)) - searcher->Angles.Yaw + 90;
|
||||
angle = vectoyaw(line->dx, line->dy) - searcher->Angles.Yaw + 90;
|
||||
|
||||
// Sine, cosine of angle adjustment
|
||||
s = FLOAT2FIXED(angle.Sin());
|
||||
|
@ -619,7 +619,7 @@ static bool DoGroupForOne (AActor *victim, AActor *source, AActor *dest, bool fl
|
|||
P_Teleport (victim, dest->X() + newX,
|
||||
dest->Y() + newY,
|
||||
floorz ? ONFLOORZ : dest->Z() + victim->Z() - source->Z(),
|
||||
0, fog ? (TELF_DESTFOG | TELF_SOURCEFOG) : TELF_KEEPORIENTATION);
|
||||
0., fog ? (TELF_DESTFOG | TELF_SOURCEFOG) : TELF_KEEPORIENTATION);
|
||||
// P_Teleport only changes angle if fog is true
|
||||
victim->Angles.Yaw = (dest->Angles.Yaw + victim->Angles.Yaw - source->Angles.Yaw).Normalized360();
|
||||
|
||||
|
@ -687,7 +687,7 @@ bool EV_TeleportGroup (int group_tid, AActor *victim, int source_tid, int dest_t
|
|||
{
|
||||
didSomething |=
|
||||
P_Teleport (sourceOrigin, destOrigin->X(), destOrigin->Y(),
|
||||
floorz ? ONFLOORZ : destOrigin->Z(), 0, TELF_KEEPORIENTATION);
|
||||
floorz ? ONFLOORZ : destOrigin->Z(), 0., TELF_KEEPORIENTATION);
|
||||
sourceOrigin->Angles.Yaw = destOrigin->Angles.Yaw;
|
||||
}
|
||||
|
||||
|
|
|
@ -313,7 +313,7 @@ player_t::player_t()
|
|||
crouchviewdelta(0),
|
||||
ConversationNPC(0),
|
||||
ConversationPC(0),
|
||||
ConversationNPCAngle(0),
|
||||
ConversationNPCAngle(0.),
|
||||
ConversationFaceTalker(0)
|
||||
{
|
||||
memset (&cmd, 0, sizeof(cmd));
|
||||
|
@ -2186,7 +2186,7 @@ void P_DeathThink (player_t *player)
|
|||
}
|
||||
if (fabs(player->mo->Angles.Pitch) < 3)
|
||||
{
|
||||
player->mo->Angles.Pitch = 0;
|
||||
player->mo->Angles.Pitch = 0.;
|
||||
}
|
||||
}
|
||||
P_CalcHeight (player);
|
||||
|
@ -2206,9 +2206,9 @@ void P_DeathThink (player_t *player)
|
|||
}
|
||||
}
|
||||
delta /= 8;
|
||||
if (delta > 5)
|
||||
if (delta > 5.)
|
||||
{
|
||||
delta = 5;
|
||||
delta = 5.;
|
||||
}
|
||||
if (dir)
|
||||
{ // Turn clockwise
|
||||
|
@ -2492,7 +2492,7 @@ void P_PlayerThink (player_t *player)
|
|||
// [RH] Look up/down stuff
|
||||
if (!level.IsFreelookAllowed())
|
||||
{
|
||||
player->mo->Angles.Pitch = 0;
|
||||
player->mo->Angles.Pitch = 0.;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2523,7 +2523,7 @@ void P_PlayerThink (player_t *player)
|
|||
}
|
||||
else
|
||||
{
|
||||
player->mo->Angles.Pitch = 0;
|
||||
player->mo->Angles.Pitch = 0.;
|
||||
player->centering = false;
|
||||
if (player - players == consoleplayer)
|
||||
{
|
||||
|
|
|
@ -608,8 +608,8 @@ void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *ivi
|
|||
angle_t totaladiff = 0;
|
||||
fixed_t oviewz = iview->oviewz;
|
||||
fixed_t nviewz = iview->nviewz;
|
||||
fixedvec3a oldpos = { iview->oviewx, iview->oviewy, 0, 0 };
|
||||
fixedvec3a newpos = { iview->nviewx, iview->nviewy, 0, 0 };
|
||||
fixedvec3a oldpos = { iview->oviewx, iview->oviewy, 0, 0. };
|
||||
fixedvec3a newpos = { iview->nviewx, iview->nviewy, 0, 0. };
|
||||
InterpolationPath.Push(newpos); // add this to the array to simplify the loops below
|
||||
|
||||
for (unsigned i = 0; i < InterpolationPath.Size(); i += 2)
|
||||
|
|
|
@ -1203,9 +1203,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile)
|
|||
PARAM_CLASS (ti, AActor);
|
||||
PARAM_FIXED_OPT (spawnheight) { spawnheight = 32*FRACUNIT; }
|
||||
PARAM_INT_OPT (spawnofs_xy) { spawnofs_xy = 0; }
|
||||
PARAM_DANGLE_OPT(Angle) { Angle = 0; }
|
||||
PARAM_DANGLE_OPT(Angle) { Angle = 0.; }
|
||||
PARAM_INT_OPT (flags) { flags = 0; }
|
||||
PARAM_DANGLE_OPT(Pitch) { Pitch = 0; }
|
||||
PARAM_DANGLE_OPT(Pitch) { Pitch = 0.; }
|
||||
PARAM_INT_OPT (ptr) { ptr = AAPTR_TARGET; }
|
||||
|
||||
AActor *ref = COPY_AAPTR(self, ptr);
|
||||
|
@ -1262,7 +1262,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile)
|
|||
if (CMF_OFFSETPITCH & flags)
|
||||
{
|
||||
DVector2 velocity (missile->vel.x, missile->vel.y);
|
||||
Pitch += vectoyaw(DVector2(velocity.Length(), (double)missile->vel.z));
|
||||
Pitch += vectoyaw(velocity.Length(), missile->vel.z);
|
||||
}
|
||||
missilespeed = abs(fixed_t(Pitch.Cos() * missile->Speed));
|
||||
missile->vel.z = fixed_t(Pitch.Sin() * missile->Speed);
|
||||
|
@ -1627,12 +1627,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireCustomMissile)
|
|||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
PARAM_CLASS (ti, AActor);
|
||||
PARAM_DANGLE_OPT(angle) { angle = 0; }
|
||||
PARAM_DANGLE_OPT(angle) { angle = 0.; }
|
||||
PARAM_BOOL_OPT (useammo) { useammo = true; }
|
||||
PARAM_INT_OPT (spawnofs_xy) { spawnofs_xy = 0; }
|
||||
PARAM_FIXED_OPT (spawnheight) { spawnheight = 0; }
|
||||
PARAM_INT_OPT (flags) { flags = 0; }
|
||||
PARAM_DANGLE_OPT(pitch) { pitch = 0; }
|
||||
PARAM_DANGLE_OPT(pitch) { pitch = 0.; }
|
||||
|
||||
if (!self->player)
|
||||
return 0;
|
||||
|
@ -1931,7 +1931,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
|
|||
DVector2 xydiff(pos.x, pos.y);
|
||||
double zdiff = (self->target->Z() + (self->target->height>>1)) -
|
||||
(self->Z() + (self->height>>1) - self->floorclip);
|
||||
self->Angles.Pitch = vectoyaw(DVector2(xydiff.Length(), zdiff));
|
||||
self->Angles.Pitch = vectoyaw(xydiff.Length(), zdiff);
|
||||
}
|
||||
// Let the aim trail behind the player
|
||||
if (aim)
|
||||
|
@ -2452,7 +2452,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItemEx)
|
|||
PARAM_FIXED_OPT (xvel) { xvel = 0; }
|
||||
PARAM_FIXED_OPT (yvel) { yvel = 0; }
|
||||
PARAM_FIXED_OPT (zvel) { zvel = 0; }
|
||||
PARAM_DANGLE_OPT(angle) { angle = 0; }
|
||||
PARAM_DANGLE_OPT(angle) { angle = 0.; }
|
||||
PARAM_INT_OPT (flags) { flags = 0; }
|
||||
PARAM_INT_OPT (chance) { chance = 0; }
|
||||
PARAM_INT_OPT (tid) { tid = 0; }
|
||||
|
|
|
@ -263,11 +263,11 @@ struct TVector2
|
|||
return g_atan2 (X, Y);
|
||||
}
|
||||
|
||||
// Returns a rotated vector. angle is in radians.
|
||||
// Returns a rotated vector. angle is in degrees.
|
||||
TVector2 Rotated (double angle)
|
||||
{
|
||||
double cosval = g_cos (angle);
|
||||
double sinval = g_sin (angle);
|
||||
double cosval = g_cosdeg (angle);
|
||||
double sinval = g_sindeg (angle);
|
||||
return TVector2(X*cosval - Y*sinval, Y*cosval + X*sinval);
|
||||
}
|
||||
|
||||
|
@ -758,6 +758,17 @@ struct TAngle
|
|||
{
|
||||
vec_t Degrees;
|
||||
|
||||
|
||||
// This is to catch any accidental attempt to assign an angle_t to this type. Any explicit exception will require a type cast.
|
||||
TAngle(int) = delete;
|
||||
TAngle(unsigned int) = delete;
|
||||
TAngle(long) = delete;
|
||||
TAngle(unsigned long) = delete;
|
||||
TAngle &operator= (int other) = delete;
|
||||
TAngle &operator= (unsigned other) = delete;
|
||||
TAngle &operator= (long other) = delete;
|
||||
TAngle &operator= (unsigned long other) = delete;
|
||||
|
||||
TAngle ()
|
||||
{
|
||||
}
|
||||
|
@ -767,10 +778,12 @@ struct TAngle
|
|||
{
|
||||
}
|
||||
|
||||
/*
|
||||
TAngle (int amt)
|
||||
: Degrees(vec_t(amt))
|
||||
{
|
||||
}
|
||||
*/
|
||||
|
||||
TAngle (const TAngle &other)
|
||||
: Degrees(other.Degrees)
|
||||
|
@ -999,7 +1012,7 @@ struct TAngle
|
|||
return FLOAT2ANGLE(Degrees);
|
||||
}
|
||||
|
||||
TVector2<vec_t> ToDirection(vec_t length) const
|
||||
TVector2<vec_t> ToVector(vec_t length) const
|
||||
{
|
||||
return TVector2(length * Cos(), length * Sin());
|
||||
}
|
||||
|
@ -1021,7 +1034,7 @@ struct TAngle
|
|||
|
||||
double Tan() const
|
||||
{
|
||||
return g_tan(Degrees);
|
||||
return g_tan(Degrees * (M_PI / 180.));
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -1074,6 +1087,11 @@ inline TAngle<T> diffangle(const TAngle<T> &a1, double a2)
|
|||
return fabs((a1 - a2).Normalize180());
|
||||
}
|
||||
|
||||
inline TAngle<double> vectoyaw(double x, double y)
|
||||
{
|
||||
return g_atan2(y, x) * (180.0 / M_PI);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline TAngle<T> vectoyaw (const TVector2<T> &vec)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue