- made player_t::crouchoffset and FPlayerStart's coordinates doubles and added a float version of divline_t so that I could complete the conversion of Hexen's game code.

- consolidated the actor based damage factor code which was repeated multiple times in various damage inflicting functions.
This commit is contained in:
Christoph Oelckers 2016-03-22 00:06:58 +01:00
parent c830801da3
commit 4155e84a1c
24 changed files with 133 additions and 121 deletions

View File

@ -1272,7 +1272,7 @@ public:
int PainThreshold;
FNameNoInit DamageType;
FNameNoInit DamageTypeReceived;
fixed_t DamageFactor;
double DamageFactor;
fixed_t DamageMultiply;
FNameNoInit PainType;
@ -1577,6 +1577,8 @@ public:
return MAX(1., Distance2D(dest) / speed);
}
int ApplyDamageFactor(FName damagetype, int damage) const;
};
class FActorIterator

View File

@ -492,7 +492,7 @@ public:
DAngle MaxPitch;
double crouchfactor;
fixed_t crouchoffset;
double crouchoffset;
fixed_t crouchviewdelta;
FWeaponSlots weapons;

View File

@ -428,15 +428,19 @@ enum EMapThingFlags
// A simplified mapthing for player starts
struct FPlayerStart
{
fixed_t x, y, z;
DVector3 pos;
short angle, type;
FPlayerStart() { }
FPlayerStart(const FMapThing *mthing, int pnum)
: x(mthing->x), y(mthing->y), z(mthing->z),
: pos(FIXED2DBL(mthing->x), FIXED2DBL(mthing->y), FIXED2DBL(mthing->z)),
angle(mthing->angle),
type(pnum)
{ }
fixed_t _f_X() { return FLOAT2FIXED(pos.X); }
fixed_t _f_Y() { return FLOAT2FIXED(pos.Y); }
fixed_t _f_Z() { return FLOAT2FIXED(pos.Z); }
};
// Player spawn spots for deathmatch.
extern TArray<FPlayerStart> deathmatchstarts;

View File

@ -1430,9 +1430,9 @@ bool G_CheckSpot (int playernum, FPlayerStart *mthing)
if (mthing->type == 0) return false;
x = mthing->x;
y = mthing->y;
z = mthing->z;
x = mthing->_f_X();
y = mthing->_f_Y();
z = mthing->_f_Z();
if (!(level.flags & LEVEL_USEPLAYERSTARTZ))
{
@ -1476,10 +1476,10 @@ bool G_CheckSpot (int playernum, FPlayerStart *mthing)
//
// [RH] Returns the distance of the closest player to the given mapthing
static fixed_t PlayersRangeFromSpot (FPlayerStart *spot)
static double PlayersRangeFromSpot (FPlayerStart *spot)
{
fixed_t closest = INT_MAX;
fixed_t distance;
double closest = INT_MAX;
double distance;
int i;
for (i = 0; i < MAXPLAYERS; i++)
@ -1487,7 +1487,7 @@ static fixed_t PlayersRangeFromSpot (FPlayerStart *spot)
if (!playeringame[i] || !players[i].mo || players[i].health <= 0)
continue;
distance = players[i].mo->AproxDistance (spot->x, spot->y);
distance = players[i].mo->Distance2D(spot->pos.X, spot->pos.Y);
if (distance < closest)
closest = distance;
@ -1499,13 +1499,13 @@ static fixed_t PlayersRangeFromSpot (FPlayerStart *spot)
// [RH] Select the deathmatch spawn spot farthest from everyone.
static FPlayerStart *SelectFarthestDeathmatchSpot (size_t selections)
{
fixed_t bestdistance = 0;
double bestdistance = 0;
FPlayerStart *bestspot = NULL;
unsigned int i;
for (i = 0; i < selections; i++)
{
fixed_t distance = PlayersRangeFromSpot (&deathmatchstarts[i]);
double distance = PlayersRangeFromSpot (&deathmatchstarts[i]);
if (distance > bestdistance)
{

View File

@ -94,7 +94,7 @@ bool AArtiPoisonBag3::Use (bool pickup)
{
AActor *mo;
mo = Spawn("ThrowingBomb", Owner->PosPlusZ(-Owner->Floorclip+35. + FIXED2FLOAT(Owner->player? Owner->player->crouchoffset : 0)), ALLOW_REPLACE);
mo = Spawn("ThrowingBomb", Owner->PosPlusZ(35. - Owner->Floorclip + (Owner->player? Owner->player->crouchoffset : 0)), ALLOW_REPLACE);
if (mo)
{
mo->Angles.Yaw = Owner->Angles.Yaw + (((pr_poisonbag() & 7) - 4) * (360./256.));
@ -337,11 +337,7 @@ int APoisonCloud::DoSpecialDamage (AActor *victim, int damage, FName damagetype)
victim->Inventory->ModifyDamage(damage, damagetype, damage, true);
}
// Modify with damage factors
damage = FixedMul(damage, victim->DamageFactor);
if (damage > 0)
{
damage = DamageTypeDefinition::ApplyMobjDamageFactor(damage, damagetype, victim->GetClass()->DamageFactors);
}
damage = victim->ApplyDamageFactor(damagetype, damage);
if (damage > 0)
{
P_PoisonDamage (victim->player, this,

View File

@ -171,26 +171,6 @@ IMPLEMENT_CLASS (ASorcBall3)
// Sorcerer spell 1 (The burning, bouncing head thing) ----------------------
/*
class ASorcFX1 : public AActor
{
DECLARE_CLASS (ASorcFX1, AActor)
public:
bool FloorBounceMissile (secplane_t &plane)
{
fixed_t orgvelz = vel.z;
if (!Super::FloorBounceMissile (plane))
{
vel.z = -orgvelz; // no energy absorbed
return false;
}
return true;
}
};
IMPLEMENT_CLASS (ASorcFX1)
*/
//============================================================================
//
// SorcBall::DoFireSpell

View File

@ -144,10 +144,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_MStaffAttack)
P_AimLineAttack (self, angle, PLAYERMISSILERANGE, &t, 32.);
if (t.linetarget == NULL)
{
BlockCheckLine.x = self->_f_X();
BlockCheckLine.y = self->_f_Y();
BlockCheckLine.dx = FLOAT2FIXED(-angle.Sin());
BlockCheckLine.dy = FLOAT2FIXED(-angle.Cos());
BlockCheckLine.x = self->X();
BlockCheckLine.y = self->Y();
BlockCheckLine.dx = -angle.Sin();
BlockCheckLine.dy = -angle.Cos();
t.linetarget = P_BlockmapSearch (self, 10, FrontBlockCheck);
}
MStaffSpawn (self, angle, t.linetarget);
@ -213,7 +213,7 @@ static AActor *FrontBlockCheck (AActor *mo, int index, void *)
{
if (link->Me != mo)
{
if (P_PointOnDivlineSide (link->Me->_f_X(), link->Me->_f_Y(), &BlockCheckLine) == 0 &&
if (P_PointOnDivlineSidePrecise(link->Me->X(), link->Me->Y(), &BlockCheckLine) == 0 &&
mo->IsOkayToAttack (link->Me))
{
return link->Me;

View File

@ -164,12 +164,12 @@ int ATelOtherFX1::DoSpecialDamage (AActor *target, int damage, FName damagetype)
void P_TeleportToPlayerStarts (AActor *victim)
{
fixed_t destX,destY;
DVector3 dest;
FPlayerStart *start = G_PickPlayerStart(0, PPS_FORCERANDOM | PPS_NOBLOCKINGCHECK);
destX = start->x;
destY = start->y;
P_Teleport (victim, destX, destY, ONFLOORZ, (double)start->angle, TELF_SOURCEFOG | TELF_DESTFOG);
dest = start->pos;
dest.Z = ONFLOORZ;
P_Teleport (victim, dest, (double)start->angle, TELF_SOURCEFOG | TELF_DESTFOG);
}
//===========================================================================
@ -181,15 +181,15 @@ void P_TeleportToPlayerStarts (AActor *victim)
void P_TeleportToDeathmatchStarts (AActor *victim)
{
unsigned int i, selections;
fixed_t destX,destY;
DVector3 dest;
selections = deathmatchstarts.Size ();
if (selections > 0)
{
i = pr_teledm() % selections;
destX = deathmatchstarts[i].x;
destY = deathmatchstarts[i].y;
P_Teleport (victim, destX, destY, ONFLOORZ, (double)deathmatchstarts[i].angle, TELF_SOURCEFOG | TELF_DESTFOG);
dest = deathmatchstarts[i].pos;
dest.Z = ONFLOORZ;
P_Teleport (victim, dest, (double)deathmatchstarts[i].angle, TELF_SOURCEFOG | TELF_DESTFOG);
}
else
{

View File

@ -547,7 +547,6 @@ enum ESkillProperty
{
SKILLP_AmmoFactor,
SKILLP_DropAmmoFactor,
SKILLP_DamageFactor,
SKILLP_FastMonsters,
SKILLP_Respawn,
SKILLP_RespawnLimit,
@ -566,7 +565,12 @@ enum ESkillProperty
SKILLP_SlowMonsters,
SKILLP_Infight,
};
enum EFSkillProperty // floating point properties
{
SKILLP_DamageFactor,
};
int G_SkillProperty(ESkillProperty prop);
double G_SkillProperty(EFSkillProperty prop);
const char * G_SkillName();
typedef TMap<FName, FString> SkillMenuNames;
@ -577,7 +581,7 @@ struct FSkillInfo
{
FName Name;
fixed_t AmmoFactor, DoubleAmmoFactor, DropAmmoFactor;
fixed_t DamageFactor;
double DamageFactor;
bool FastMonsters;
bool SlowMonsters;
bool DisableCheats;

View File

@ -27,26 +27,24 @@ IMPLEMENT_CLASS (AArtiTeleport)
bool AArtiTeleport::Use (bool pickup)
{
fixed_t destX;
fixed_t destY;
DVector3 dest;
int destAngle;
if (deathmatch)
{
unsigned int selections = deathmatchstarts.Size ();
unsigned int i = pr_tele() % selections;
destX = deathmatchstarts[i].x;
destY = deathmatchstarts[i].y;
dest = deathmatchstarts[i].pos;
destAngle = deathmatchstarts[i].angle;
}
else
{
FPlayerStart *start = G_PickPlayerStart(int(Owner->player - players));
destX = start->x;
destY = start->y;
dest = start->pos;
destAngle = start->angle;
}
P_Teleport (Owner, destX, destY, ONFLOORZ, (double)destAngle, TELF_SOURCEFOG | TELF_DESTFOG);
dest.Z = ONFLOORZ;
P_Teleport (Owner, dest, (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)

View File

@ -62,7 +62,7 @@ void FMapInfoParser::ParseSkill ()
skill.AmmoFactor = FRACUNIT;
skill.DoubleAmmoFactor = 2*FRACUNIT;
skill.DropAmmoFactor = -1;
skill.DamageFactor = FRACUNIT;
skill.DamageFactor = 1.;
skill.FastMonsters = false;
skill.SlowMonsters = false;
skill.DisableCheats = false;
@ -115,7 +115,7 @@ void FMapInfoParser::ParseSkill ()
{
ParseAssign();
sc.MustGetFloat ();
skill.DamageFactor = FLOAT2FIXED(sc.Float);
skill.DamageFactor = sc.Float;
}
else if (sc.Compare ("fastmonsters"))
{
@ -351,9 +351,6 @@ int G_SkillProperty(ESkillProperty prop)
case SKILLP_DropAmmoFactor:
return AllSkills[gameskill].DropAmmoFactor;
case SKILLP_DamageFactor:
return AllSkills[gameskill].DamageFactor;
case SKILLP_FastMonsters:
return AllSkills[gameskill].FastMonsters || (dmflags & DF_FAST_MONSTERS);
@ -416,6 +413,28 @@ int G_SkillProperty(ESkillProperty prop)
return 0;
}
//==========================================================================
//
//
//
//==========================================================================
double G_SkillProperty(EFSkillProperty prop)
{
if (AllSkills.Size() > 0)
{
switch (prop)
{
case SKILLP_DamageFactor:
return AllSkills[gameskill].DamageFactor;
break;
}
}
return 0;
}
//==========================================================================
//
//

View File

@ -1071,8 +1071,8 @@ public:
Pawn->flags |= MF_SHOOTABLE;
Pawn->flags2 &= ~MF2_INVULNERABLE;
// Store the player's current damage factor, to restore it later.
fixed_t plyrdmgfact = Pawn->DamageFactor;
Pawn->DamageFactor = 65536;
double plyrdmgfact = Pawn->DamageFactor;
Pawn->DamageFactor = 1.;
P_DamageMobj (Pawn, Pawn, Pawn, TELEFRAG_DAMAGE, NAME_Suicide);
Pawn->DamageFactor = plyrdmgfact;
if (Pawn->health <= 0)

View File

@ -3954,7 +3954,7 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
break;
case APROP_DamageFactor:
actor->DamageFactor = value;
actor->DamageFactor = ACSToDouble(value);
break;
case APROP_DamageMultiplier:
@ -4037,7 +4037,7 @@ int DLevelScript::GetActorProperty (int tid, int property)
case APROP_Health: return actor->health;
case APROP_Speed: return DoubleToACS(actor->Speed);
case APROP_Damage: return actor->GetMissileDamage(0,1);
case APROP_DamageFactor:return actor->DamageFactor;
case APROP_DamageFactor:return DoubleToACS(actor->DamageFactor);
case APROP_DamageMultiplier: return actor->DamageMultiply;
case APROP_Alpha: return DoubleToACS(actor->Alpha);
case APROP_RenderStyle: for (int style = STYLE_None; style < STYLE_Count; ++style)

View File

@ -1046,7 +1046,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
if (player && damage > 1)
{
// Take half damage in trainer mode
damage = FixedMul(damage, G_SkillProperty(SKILLP_DamageFactor));
damage = int(damage * G_SkillProperty(SKILLP_DamageFactor));
}
// Special damage types
if (inflictor)
@ -1091,11 +1091,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
}
if (damage > 0 && !(flags & DMG_NO_FACTOR))
{
damage = FixedMul(damage, target->DamageFactor);
if (damage > 0)
{
damage = DamageTypeDefinition::ApplyMobjDamageFactor(damage, mod, target->GetClass()->DamageFactors);
}
damage = target->ApplyDamageFactor(mod, damage);
}
if (damage >= 0)
@ -1721,18 +1717,15 @@ void P_PoisonDamage (player_t *player, AActor *source, int damage,
return;
}
// Take half damage in trainer mode
damage = FixedMul(damage, G_SkillProperty(SKILLP_DamageFactor));
damage = int(damage * G_SkillProperty(SKILLP_DamageFactor));
// Handle passive damage modifiers (e.g. PowerProtection)
if (target->Inventory != NULL)
{
target->Inventory->ModifyDamage(damage, player->poisontype, damage, true);
}
// Modify with damage factors
damage = FixedMul(damage, target->DamageFactor);
if (damage > 0)
{
damage = DamageTypeDefinition::ApplyMobjDamageFactor(damage, player->poisontype, target->GetClass()->DamageFactors);
}
damage = target->ApplyDamageFactor(player->poisontype, damage);
if (damage <= 0)
{ // Damage was reduced to 0, so don't bother further.
return;

View File

@ -2281,8 +2281,8 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
side = P_PointOnLineSide(spec.refpos.x, spec.refpos.y, ld);
if (oldside == 0 && side == 1)
{
divline_t dl2 = { ld->v1->x, ld->v1->y, ld->dx, ld->dy };
divline_t dl1 = { spec.oldrefpos.x, spec.oldrefpos.y, spec.refpos.x - spec.oldrefpos.x, spec.refpos.y - spec.oldrefpos.y };
fdivline_t dl2 = { ld->v1->x, ld->v1->y, ld->dx, ld->dy };
fdivline_t dl1 = { spec.oldrefpos.x, spec.oldrefpos.y, spec.refpos.x - spec.oldrefpos.x, spec.refpos.y - spec.oldrefpos.y };
fixed_t frac = P_InterceptVector(&dl1, &dl2);
if (frac < bestfrac)
{
@ -2337,7 +2337,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
// so that the renderer can properly calculate an interpolated position along the movement path.
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 };
fdivline_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. };
R_AddInterpolationPoint(hit);
@ -2749,7 +2749,7 @@ void FSlide::HitSlideLine(line_t* ld)
}
else
{
divline_t dll, dlv;
fdivline_t dll, dlv;
fixed_t inter1, inter2, inter3;
P_MakeDivline(ld, &dll);
@ -3554,7 +3554,7 @@ struct aim_t
//
//============================================================================
bool AimTraverse3DFloors(const divline_t &trace, intercept_t * in, int frontflag, int *planestocheck)
bool AimTraverse3DFloors(const fdivline_t &trace, intercept_t * in, int frontflag, int *planestocheck)
{
sector_t * nextsector;
secplane_t * nexttopplane, *nextbottomplane;

View File

@ -73,7 +73,7 @@ fixed_t P_AproxDistance (fixed_t dx, fixed_t dy)
//
//==========================================================================
fixed_t P_InterceptVector (const divline_t *v2, const divline_t *v1)
fixed_t P_InterceptVector (const fdivline_t *v2, const fdivline_t *v1)
{
#if 0 // [RH] Use 64 bit ints, so long divlines don't overflow
@ -387,7 +387,7 @@ bool AActor::FixMapthingPos()
continue;
// Get the exact distance to the line
divline_t dll, dlv;
fdivline_t dll, dlv;
fixed_t linelen = (fixed_t)g_sqrt((double)ldef->dx*ldef->dx + (double)ldef->dy*ldef->dy);
P_MakeDivline(ldef, &dll);
@ -1197,7 +1197,7 @@ void FPathTraverse::AddLineIntercepts(int bx, int by)
int s1;
int s2;
fixed_t frac;
divline_t dl;
fdivline_t dl;
// avoid precision problems with two routines
if ( trace.dx > FRACUNIT*16
@ -1247,7 +1247,7 @@ void FPathTraverse::AddThingIntercepts (int bx, int by, FBlockThingsIterator &it
while ((thing = it.Next(compatible)))
{
int numfronts = 0;
divline_t line;
fdivline_t line;
int i;
@ -1358,7 +1358,7 @@ void FPathTraverse::AddThingIntercepts (int bx, int by, FBlockThingsIterator &it
// Old code for compatibility purposes
fixed_t x1, y1, x2, y2;
int s1, s2;
divline_t dl;
fdivline_t dl;
fixed_t frac;
bool tracepositive = (trace.dx ^ trace.dy)>0;
@ -1940,7 +1940,7 @@ int P_VanillaPointOnLineSide(fixed_t x, fixed_t y, const line_t* line)
//
//===========================================================================
int P_VanillaPointOnDivlineSide(fixed_t x, fixed_t y, const divline_t* line)
int P_VanillaPointOnDivlineSide(fixed_t x, fixed_t y, const fdivline_t* line)
{
fixed_t dx;
fixed_t dy;

View File

@ -7,7 +7,7 @@
extern int validcount;
struct divline_t
struct fdivline_t
{
fixed_t x;
fixed_t y;
@ -15,12 +15,12 @@ struct divline_t
fixed_t dy;
};
struct fdivline_t
struct divline_t
{
fixed_t x;
fixed_t y;
fixed_t dx;
fixed_t dy;
double x;
double y;
double dx;
double dy;
};
struct intercept_t
@ -81,20 +81,25 @@ inline int P_PointOnLineSidePrecise(const DVector3 &pt, const line_t *line)
//
//==========================================================================
inline int P_PointOnDivlineSide (fixed_t x, fixed_t y, const divline_t *line)
inline int P_PointOnDivlineSide (fixed_t x, fixed_t y, const fdivline_t *line)
{
extern int P_VanillaPointOnDivlineSide(fixed_t x, fixed_t y, const divline_t* line);
extern int P_VanillaPointOnDivlineSide(fixed_t x, fixed_t y, const fdivline_t* line);
return (i_compatflags2 & COMPATF2_POINTONLINE)
? P_VanillaPointOnDivlineSide(x, y, line)
: (DMulScale32 (y-line->y, line->dx, line->x-x, line->dy) > 0);
}
inline int P_PointOnDivlineSidePrecise (fixed_t x, fixed_t y, const divline_t *line)
inline int P_PointOnDivlineSidePrecise (fixed_t x, fixed_t y, const fdivline_t *line)
{
return DMulScale32 (y-line->y, line->dx, line->x-x, line->dy) > 0;
}
inline int P_PointOnDivlineSidePrecise(double x, double y, const divline_t *line)
{
return (y - line->y) * line->dx + (line->x - x) * line->dy > 0;
}
//==========================================================================
//
@ -102,7 +107,7 @@ inline int P_PointOnDivlineSidePrecise (fixed_t x, fixed_t y, const divline_t *l
//
//==========================================================================
inline void P_MakeDivline (const line_t *li, divline_t *dl)
inline void P_MakeDivline (const line_t *li, fdivline_t *dl)
{
dl->x = li->v1->x;
dl->y = li->v1->y;
@ -366,7 +371,7 @@ class FPathTraverse
protected:
static TArray<intercept_t> intercepts;
divline_t trace;
fdivline_t trace;
fixed_t startfrac;
unsigned int intercept_index;
unsigned int intercept_count;
@ -386,7 +391,7 @@ public:
void init(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int flags, fixed_t startfrac = 0);
int PortalRelocate(intercept_t *in, int flags, fixedvec3 *optpos = NULL);
virtual ~FPathTraverse();
const divline_t &Trace() const { return trace; }
const fdivline_t &Trace() const { return trace; }
inline fixedvec2 InterceptPoint(const intercept_t *in)
{
@ -427,7 +432,7 @@ typedef bool(*traverser_t) (intercept_t *in);
fixed_t P_AproxDistance (fixed_t dx, fixed_t dy);
fixed_t P_InterceptVector (const divline_t *v2, const divline_t *v1);
fixed_t P_InterceptVector (const fdivline_t *v2, const fdivline_t *v1);
#define PT_ADDLINES 1
#define PT_ADDTHINGS 2

View File

@ -1779,7 +1779,7 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
fixed_t oldz = mo->_f_Z();
double maxmove = (mo->waterlevel < 1) || (mo->flags & MF_MISSILE) ||
(mo->player && mo->player->crouchoffset<-10*FRACUNIT) ? MAXMOVE : MAXMOVE/4;
(mo->player && mo->player->crouchoffset<-10) ? MAXMOVE : MAXMOVE/4;
if (mo->flags2 & MF2_WINDTHRUST && mo->waterlevel < 2 && !(mo->flags & MF_NOCLIP))
{
@ -4634,8 +4634,8 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
}
else
{
spawn_x = mthing->x;
spawn_y = mthing->y;
spawn_x = mthing->_f_X();
spawn_y = mthing->_f_Y();
// Allow full angular precision
SpawnAngle = (double)mthing->angle;
@ -4658,9 +4658,9 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
if (level.flags & LEVEL_USEPLAYERSTARTZ)
{
if (spawn_z == ONFLOORZ)
mobj->_f_AddZ(mthing->z);
mobj->AddZ(mthing->pos.Z);
else if (spawn_z == ONCEILINGZ)
mobj->_f_AddZ(-mthing->z);
mobj->AddZ(-mthing->pos.Z);
P_FindFloorCeiling(mobj, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT);
}
@ -6631,6 +6631,17 @@ void AActor::ClearCounters()
}
int AActor::ApplyDamageFactor(FName damagetype, int damage) const
{
damage = int(damage * DamageFactor);
if (damage > 0)
{
damage = DamageTypeDefinition::ApplyMobjDamageFactor(damage, damagetype, GetClass()->DamageFactors);
}
return damage;
}
//----------------------------------------------------------------------------
//
// DropItem handling

View File

@ -95,7 +95,7 @@ class SightCheck
sector_t * lastsector; // last sector being entered by trace
fixed_t topslope, bottomslope; // slopes to top and bottom of target
int Flags;
divline_t trace;
fdivline_t trace;
int portaldir;
int portalgroup;
bool portalfound;
@ -372,7 +372,7 @@ bool SightCheck::PTR_SightTraverse (intercept_t *in)
bool SightCheck::P_SightCheckLine (line_t *ld)
{
divline_t dl;
fdivline_t dl;
if (ld->validcount == validcount)
{
@ -508,7 +508,7 @@ bool SightCheck::P_SightTraverseIntercepts ()
fixed_t dist;
intercept_t *scan, *in;
unsigned scanpos;
divline_t dl;
fdivline_t dl;
count = intercepts.Size ();
//

View File

@ -135,7 +135,7 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno, fixedvec3 *optpo
return true;
// calculate the point where the user would touch the wall.
divline_t dll, dlu;
fdivline_t dll, dlu;
fixed_t inter, checkx, checky;
P_MakeDivline (line, &dll);

View File

@ -2430,7 +2430,7 @@ void P_PlayerThink (player_t *player)
player->Uncrouch();
}
player->crouchoffset = -fixed_t(player->mo->ViewHeight * (1 - player->crouchfactor));
player->crouchoffset = -(FIXED2DBL(player->mo->ViewHeight) * (1 - player->crouchfactor));
// MUSINFO stuff
if (player->MUSINFOtics >= 0 && player->MUSINFOactor != NULL)

View File

@ -162,7 +162,7 @@ void FLinePortalTraverse::AddLineIntercepts(int bx, int by)
{
line_t *ld = block.portallines[i];
fixed_t frac;
divline_t dl;
fdivline_t dl;
if (ld->validcount == validcount) continue; // already processed

View File

@ -1218,7 +1218,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile)
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 + self->GetBobOffset() - 32*FRACUNIT + (self->player? self->player->crouchoffset : 0);
fixed_t z = spawnheight + self->GetBobOffset() - 32*FRACUNIT + (self->player? FLOAT2FIXED(self->player->crouchoffset) : 0);
fixedvec3 pos = self->_f_Pos();
switch (aimmode)
@ -2544,7 +2544,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? self->player->crouchoffset : 0)),
self->PosPlusZ(-self->_f_floorclip() + self->GetBobOffset() + zheight + 35*FRACUNIT + (self->player? FLOAT2FIXED(self->player->crouchoffset) : 0)),
ALLOW_REPLACE);
if (bo)
{

View File

@ -1217,7 +1217,7 @@ DEFINE_PROPERTY(deathtype, S, Actor)
DEFINE_PROPERTY(damagefactor, ZF, Actor)
{
PROP_STRING_PARM(str, 0);
PROP_FIXED_PARM(id, 1);
PROP_DOUBLE_PARM(id, 1);
if (str == NULL)
{
@ -1229,7 +1229,7 @@ DEFINE_PROPERTY(damagefactor, ZF, Actor)
if (!stricmp(str, "Normal")) dmgType = NAME_None;
else dmgType=str;
info->SetDamageFactor(dmgType, id);
info->SetDamageFactor(dmgType, FLOAT2FIXED(id));
}
}