- fixed some leftover fixed point remnants in g_hexen.

- made the full-coordinate version of P_SpawnPlayerMissile use float coordinates.
This commit is contained in:
Christoph Oelckers 2016-03-22 00:30:56 +01:00
parent 4155e84a1c
commit cf79e1cb6d
9 changed files with 30 additions and 35 deletions

View file

@ -36,7 +36,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropWeaponPieces)
PClassActor *cls = j == 0 ? p1 : j == 1 ? p2 : p3;
if (cls)
{
AActor *piece = Spawn (cls, self->_f_Pos(), ALLOW_REPLACE);
AActor *piece = Spawn (cls, self->Pos(), ALLOW_REPLACE);
if (piece != NULL)
{
piece->Vel = self->Vel + DAngle(i*120.).ToVector(1);
@ -92,11 +92,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_FSwordAttack)
if (!weapon->DepleteAmmo (weapon->bAltFire))
return 0;
}
P_SpawnPlayerMissile (self, 0, 0, -10*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw + (45./4));
P_SpawnPlayerMissile (self, 0, 0, -5*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw + (45./8));
P_SpawnPlayerMissile (self, 0, 0, 0, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw);
P_SpawnPlayerMissile (self, 0, 0, 5*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw - (45./8));
P_SpawnPlayerMissile (self, 0, 0, 10*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw - (45./4));
P_SpawnPlayerMissile (self, 0, 0, -10, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw + (45./4));
P_SpawnPlayerMissile (self, 0, 0, -5, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw + (45./8));
P_SpawnPlayerMissile (self, 0, 0, 0, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw);
P_SpawnPlayerMissile (self, 0, 0, 5, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw - (45./8));
P_SpawnPlayerMissile (self, 0, 0, 10, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw - (45./4));
S_Sound (self, CHAN_WEAPON, "FighterSwordFire", 1, ATTN_NORM);
return 0;
}

View file

@ -39,10 +39,7 @@ IMPLEMENT_CLASS (AArtiPoisonBag1)
bool AArtiPoisonBag1::Use (bool pickup)
{
angle_t angle = Owner->_f_angle() >> ANGLETOFINESHIFT;
AActor *mo;
mo = Spawn("PoisonBag", Owner->Vec3Offset(
AActor *mo = Spawn("PoisonBag", Owner->Vec3Offset(
16 * Owner->Angles.Yaw.Cos(),
24 * Owner->Angles.Yaw.Sin(),
-Owner->Floorclip + 8), ALLOW_REPLACE);
@ -100,9 +97,9 @@ bool AArtiPoisonBag3::Use (bool pickup)
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));
* mo->z += player->lookdir<<(FRACBITS-4);
* P_ThrustMobj(mo, mo->_f_angle(), mo->info->speed);
* mo->momz = 4*F.RACUNIT+((player->lookdir)<<(F.RACBITS-4));
* mo->z += player->lookdir<<(F.RACBITS-4);
* P_ThrustMobj(mo, mo->angle, mo->info->speed);
* mo->momx += player->mo->momx>>1;
* mo->momy += player->mo->momy>>1;
*/
@ -445,8 +442,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_CheckThrowBomb2)
PARAM_ACTION_PROLOGUE;
// [RH] Check using actual velocity, although the vel.z < 2 check still stands
//if (abs(self->vel.x) < FRACUNIT*3/2 && abs(self->vel.y) < FRACUNIT*3/2
// && self->vel.z < 2*FRACUNIT)
if (self->Vel.Z < 2 && self->Vel.LengthSquared() < (9./4.))
{
self->SetState (self->SpawnState + 6);

View file

@ -37,7 +37,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FogSpawn)
};
AActor *mo = NULL;
angle_t delta;
int delta;
if (self->special1-- > 0)
{

View file

@ -102,7 +102,7 @@ void MStaffSpawn (AActor *pmo, DAngle angle, AActor *alttarget)
AActor *mo;
FTranslatedLineTarget t;
mo = P_SpawnPlayerMissile (pmo, 0, 0, 8*FRACUNIT, RUNTIME_CLASS(AMageStaffFX2), angle, &t);
mo = P_SpawnPlayerMissile (pmo, 0, 0, 8, RUNTIME_CLASS(AMageStaffFX2), angle, &t);
if (mo)
{
mo->target = pmo;

View file

@ -65,7 +65,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithRaise)
{
PARAM_ACTION_PROLOGUE;
if (A_RaiseMobj (self, 2*FRACUNIT))
if (A_RaiseMobj (self, 2))
{
// Reached it's target height
// [RH] Once a buried wraith is fully raised, it should be

View file

@ -192,9 +192,11 @@ AActor *P_SpawnMissileZAimed (AActor *source, fixed_t z, AActor *dest, PClassAct
AActor *P_SpawnPlayerMissile (AActor* source, PClassActor *type);
AActor *P_SpawnPlayerMissile (AActor *source, PClassActor *type, DAngle angle);
AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, PClassActor *type, DAngle angle,
AActor *P_SpawnPlayerMissile (AActor *source, double x, double y, double z, PClassActor *type, DAngle angle,
FTranslatedLineTarget *pLineTarget = NULL, AActor **MissileActor = NULL, bool nofreeaim = false, bool noautoaim = false, int aimflags = 0);
void P_CheckFakeFloorTriggers (AActor *mo, fixed_t oldz, bool oldz_has_viewheight=false);
AActor *P_SpawnSubMissile (AActor *source, PClassActor *type, AActor *target); // Strife uses it

View file

@ -6136,7 +6136,7 @@ AActor *P_SpawnPlayerMissile (AActor *source, PClassActor *type, DAngle angle)
return P_SpawnPlayerMissile (source, 0, 0, 0, type, angle);
}
AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z,
AActor *P_SpawnPlayerMissile (AActor *source, double x, double y, double z,
PClassActor *type, DAngle angle, FTranslatedLineTarget *pLineTarget, AActor **pMissileActor,
bool nofreeaim, bool noautoaim, int aimflags)
{
@ -6195,23 +6195,23 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z,
if (z != ONFLOORZ && z != ONCEILINGZ)
{
// Doom spawns missiles 4 units lower than hitscan attacks for players.
z += source->_f_Z() + (source->_f_height()>>1) - source->_f_floorclip();
z += source->Center() - source->Floorclip;
if (source->player != NULL) // Considering this is for player missiles, it better not be NULL.
{
z += fixed_t ((source->player->mo->AttackZOffset - 4*FRACUNIT) * source->player->crouchfactor);
z += ((FIXED2DBL(source->player->mo->AttackZOffset) - 4) * source->player->crouchfactor);
}
else
{
z += 4*FRACUNIT;
z += 4;
}
// Do not fire beneath the floor.
if (z < source->_f_floorz())
if (z < source->floorz)
{
z = source->_f_floorz();
z = source->floorz;
}
}
fixedvec2 pos = source->Vec2Offset(x, y);
AActor *MissileActor = Spawn (type, pos.x, pos.y, z, ALLOW_REPLACE);
DVector3 pos = source->Vec2OffsetZ(x, y, z);
AActor *MissileActor = Spawn (type, pos, ALLOW_REPLACE);
if (pMissileActor) *pMissileActor = MissileActor;
P_PlaySpawnSound(MissileActor, source);
MissileActor->target = source;

View file

@ -1622,8 +1622,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireCustomMissile)
PARAM_CLASS (ti, AActor);
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_FLOAT_OPT (spawnofs_xy) { spawnofs_xy = 0; }
PARAM_FLOAT_OPT (spawnheight) { spawnheight = 0; }
PARAM_INT_OPT (flags) { flags = 0; }
PARAM_DANGLE_OPT(pitch) { pitch = 0.; }
@ -1643,10 +1643,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireCustomMissile)
if (ti)
{
angle_t ang = (self->_f_angle() - ANGLE_90) >> ANGLETOFINESHIFT;
fixed_t x = spawnofs_xy * finecosine[ang];
fixed_t y = spawnofs_xy * finesine[ang];
fixed_t z = spawnheight;
DAngle ang = self->Angles.Yaw - 90;
DVector3 ofs = self->Vec3Angle(spawnofs_xy, ang, spawnheight);
DAngle shootangle = self->Angles.Yaw;
if (flags & FPF_AIMATANGLE) shootangle += angle;
@ -1654,7 +1652,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireCustomMissile)
// Temporarily adjusts the pitch
DAngle saved_player_pitch = self->Angles.Pitch;
self->Angles.Pitch -= pitch;
AActor * misl=P_SpawnPlayerMissile (self, x, y, z, ti, shootangle, &t, NULL, false, (flags & FPF_NOAUTOAIM) != 0);
AActor * misl=P_SpawnPlayerMissile (self, ofs.X, ofs.Y, ofs.Z, ti, shootangle, &t, NULL, false, (flags & FPF_NOAUTOAIM) != 0);
self->Angles.Pitch = saved_player_pitch;
// automatic handling of seeker missiles

View file

@ -10,7 +10,7 @@ ACTOR Inventory native
action native state A_JumpIfNoAmmo(state label);
action native A_CustomPunch(int damage, bool norandom = false, int flags = CPF_USEAMMO, class<Actor> pufftype = "BulletPuff", float range = 0, float lifesteal = 0, int lifestealmax = 0, class<BasicArmorBonus> armorbonustype = "ArmorBonus", sound MeleeSound = "", sound MissSound = "");
action native A_FireBullets(float/*angle*/ spread_xy, float/*angle*/ spread_z, int numbullets, int damageperbullet, class<Actor> pufftype = "BulletPuff", int flags = 1, float range = 0);
action native A_FireCustomMissile(class<Actor> missiletype, float angle = 0, bool useammo = true, int spawnofs_xy = 0, float spawnheight = 0, int flags = 0, float pitch = 0);
action native A_FireCustomMissile(class<Actor> missiletype, float angle = 0, bool useammo = true, float spawnofs_xy = 0, float spawnheight = 0, int flags = 0, float pitch = 0);
action native A_RailAttack(int damage, int spawnofs_xy = 0, bool useammo = true, color color1 = "", color color2 = "", int flags = 0, float maxdiff = 0, class<Actor> pufftype = "BulletPuff", float/*angle*/ spread_xy = 0, float/*angle*/ spread_z = 0, float range = 0, int duration = 0, float sparsity = 1.0, float driftspeed = 1.0, class<Actor> spawnclass = "none", float spawnofs_z = 0, int spiraloffset = 270);
action native A_Light(int extralight);
action native A_Light0();