- trimmed down the AActor Spawn interface and removed all non-float variants.

This still needs some cleanup in a few calling functions.
This commit is contained in:
Christoph Oelckers 2016-03-23 10:42:41 +01:00
commit f8cf4bcf3d
29 changed files with 214 additions and 277 deletions

View file

@ -616,7 +616,7 @@ static void DoAttack (AActor *self, bool domelee, bool domissile,
// This seemingly senseless code is needed for proper aiming.
double add = MissileHeight + FIXED2FLOAT(self->GetBobOffset()) - 32;
self->AddZ(add);
AActor *missile = P_SpawnMissileXYZ (self->PosPlusZ(32*FRACUNIT), self, self->target, MissileType, false);
AActor *missile = P_SpawnMissileXYZ (self->PosPlusZ(32.), self, self->target, MissileType, false);
self->AddZ(-add);
if (missile)
@ -1227,7 +1227,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile)
default:
// same adjustment as above (in all 3 directions this time) - for better aiming!
self->SetXYZ(self->Vec3Offset(x, y, z));
missile = P_SpawnMissileXYZ(self->PosPlusZ(32*FRACUNIT), self, ref, ti, false);
missile = P_SpawnMissileXYZ(self->PosPlusZ(32.), self, ref, ti, false);
self->SetXYZ(pos);
break;
@ -1467,7 +1467,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomComboAttack)
{
// This seemingly senseless code is needed for proper aiming.
self->_f_AddZ(spawnheight + self->GetBobOffset() - 32*FRACUNIT);
AActor *missile = P_SpawnMissileXYZ (self->PosPlusZ(32*FRACUNIT), self, self->target, ti, false);
AActor *missile = P_SpawnMissileXYZ (self->PosPlusZ(32.), self, self->target, ti, false);
self->_f_AddZ(-(spawnheight + self->GetBobOffset() - 32*FRACUNIT));
if (missile)
@ -2378,7 +2378,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItem)
PARAM_ACTION_PROLOGUE;
PARAM_CLASS_OPT (missile, AActor) { missile = PClass::FindActor("Unknown"); }
PARAM_FIXED_OPT (distance) { distance = 0; }
PARAM_FIXED_OPT (zheight) { zheight = 0; }
PARAM_FLOAT_OPT (zheight) { zheight = 0; }
PARAM_BOOL_OPT (useammo) { useammo = true; }
PARAM_BOOL_OPT (transfer_translation) { transfer_translation = false; }
@ -2414,7 +2414,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItem)
}
}
AActor *mo = Spawn( missile, self->_f_Vec3Angle(distance, self->_f_angle(), -self->_f_floorclip() + self->GetBobOffset() + zheight), ALLOW_REPLACE);
AActor *mo = Spawn( missile, self->Vec3Angle(distance, self->Angles.Yaw, -self->Floorclip + self->GetBobOffset() + zheight), ALLOW_REPLACE);
int flags = (transfer_translation ? SIXF_TRANSFERTRANSLATION : 0) + (useammo ? SIXF_SETMASTER : 0);
ACTION_RETURN_BOOL(InitSpawnedItem(self, mo, flags)); // for an inventory item's use state
@ -2431,9 +2431,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItemEx)
{
PARAM_ACTION_PROLOGUE;
PARAM_CLASS (missile, AActor);
PARAM_FIXED_OPT (xofs) { xofs = 0; }
PARAM_FIXED_OPT (yofs) { yofs = 0; }
PARAM_FIXED_OPT (zofs) { zofs = 0; }
PARAM_FLOAT_OPT (xofs) { xofs = 0; }
PARAM_FLOAT_OPT (yofs) { yofs = 0; }
PARAM_FLOAT_OPT (zofs) { zofs = 0; }
PARAM_FLOAT_OPT (xvel) { xvel = 0; }
PARAM_FLOAT_OPT (yvel) { yvel = 0; }
PARAM_FLOAT_OPT (zvel) { zvel = 0; }
@ -2456,7 +2456,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItemEx)
ACTION_RETURN_BOOL(true);
}
fixedvec2 pos;
DVector2 pos;
if (!(flags & SIXF_ABSOLUTEANGLE))
{
@ -2473,7 +2473,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItemEx)
{
// in relative mode negative y values mean 'left' and positive ones mean 'right'
// This is the inverse orientation of the absolute mode!
pos = self->Vec2Offset(fixed_t(xofs * c + yofs * s), fixed_t(xofs * s - yofs*c));
pos = self->Vec2Offset(xofs * c + yofs * s, xofs * s - yofs*c);
}
if (!(flags & SIXF_ABSOLUTEVELOCITY))
@ -2484,7 +2484,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItemEx)
xvel = newxvel;
}
AActor *mo = Spawn(missile, pos.x, pos.y, self->_f_Z() - self->_f_floorclip() + self->GetBobOffset() + zofs, ALLOW_REPLACE);
AActor *mo = Spawn(missile, DVector3(pos, self->Z() - self->Floorclip + self->GetBobOffset() + zofs), ALLOW_REPLACE);
bool res = InitSpawnedItem(self, mo, flags);
if (res)
{
@ -2542,7 +2542,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ThrowGrenade)
AActor *bo;
bo = Spawn(missile,
self->PosPlusZ(-self->_f_floorclip() + self->GetBobOffset() + zheight + 35*FRACUNIT + (self->player? FLOAT2FIXED(self->player->crouchoffset) : 0)),
self->PosPlusZ(-self->Floorclip + self->GetBobOffset() + zheight + 35 + (self->player? self->player->crouchoffset : 0.)),
ALLOW_REPLACE);
if (bo)
{
@ -2936,9 +2936,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnDebris)
for (i = 0; i < GetDefaultByType(debris)->health; i++)
{
fixed_t xo = ((pr_spawndebris() - 128) << 12);
fixed_t yo = ((pr_spawndebris() - 128) << 12);
fixed_t zo = (pr_spawndebris()*self->_f_height() / 256 + self->GetBobOffset());
double xo = (pr_spawndebris() - 128) / 16.;
double yo = (pr_spawndebris() - 128) / 16.;
double zo = pr_spawndebris()*self->Height / 256 + self->GetBobOffset();
mo = Spawn(debris, self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
if (mo)
{
@ -3435,7 +3435,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Respawn)
PARAM_INT_OPT(flags) { flags = RSF_FOG; }
bool oktorespawn = false;
fixedvec3 pos = self->_f_Pos();
DVector3 pos = self->Pos();
self->flags |= MF_SOLID;
self->Height = self->GetDefault()->Height;
@ -3445,11 +3445,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Respawn)
if (flags & RSF_TELEFRAG)
{
// [KS] DIE DIE DIE DIE erm *ahem* =)
oktorespawn = P_TeleportMove(self, self->_f_Pos(), true, false);
oktorespawn = P_TeleportMove(self, self->Pos(), true, false);
}
else
{
oktorespawn = P_CheckPosition(self, self->_f_X(), self->_f_Y(), true);
oktorespawn = P_CheckPosition(self, self->Pos(), true);
}
if (oktorespawn)
@ -3487,7 +3487,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Respawn)
if (flags & RSF_FOG)
{
P_SpawnTeleportFog(self, pos, true, true);
P_SpawnTeleportFog(self, self->_f_Pos(), false, true);
P_SpawnTeleportFog(self, self->Pos(), false, true);
}
if (self->CountsAsKill())
{