Merge branch 'floatcvt' of https://github.com/rheit/zdoom into floatcvt

# Conflicts:
#	src/actor.h
This commit is contained in:
Christoph Oelckers 2016-03-22 12:44:40 +01:00
commit 19b85f806e
127 changed files with 1143 additions and 1480 deletions

View file

@ -415,24 +415,12 @@ enum ActorRenderFlag
RF_FORCEXYBILLBOARD = 0x20000, // [BB] OpenGL only: draw with xy axis billboard, i.e. unanchored (overrides gl_billboard_mode setting)
};
#define TRANSLUC25 (FRACUNIT/4)
#define TRANSLUC33 (FRACUNIT/3)
#define TRANSLUC50 (FRACUNIT/2)
#define TRANSLUC66 ((FRACUNIT*2)/3)
#define TRANSLUC75 ((FRACUNIT*3)/4)
// <wingdi.h> also #defines OPAQUE
#ifndef OPAQUE
#define OPAQUE (FRACUNIT)
#endif
// This translucency value produces the closest match to Heretic's TINTTAB.
// ~40% of the value of the overlaid image shows through.
#define HR_SHADOW (0x6800)
const double HR_SHADOW = (0x6800 / 65536.);
// Hexen's TINTTAB is the same as Heretic's, just reversed.
#define HX_SHADOW (0x9800)
#define HX_ALTSHADOW (0x6800)
const double HX_SHADOW = (0x9800 / 65536.);
const double HX_ALTSHADOW = (0x6800 / 65536.);
// This could easily be a bool but then it'd be much harder to find later. ;)
enum replace_t
@ -650,7 +638,7 @@ public:
// Called when an actor is to be reflected by a disc of repulsion.
// Returns true to continue normal blast processing.
virtual bool SpecialBlastHandling (AActor *source, fixed_t strength);
virtual bool SpecialBlastHandling (AActor *source, double strength);
// Called by RoughBlockCheck
bool IsOkayToAttack (AActor *target);
@ -949,6 +937,7 @@ public:
}
}
DVector3 Vec2OffsetZ(double dx, double dy, double atz, bool absolute = false)
{
if (absolute)
@ -973,6 +962,19 @@ public:
else return P_GetOffsetPosition(_f_X(), _f_Y(), FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]));
}
DVector2 Vec2Angle(double length, DAngle angle, bool absolute = false)
{
if (absolute)
{
return{ X() + length * angle.Cos(), Y() + length * angle.Sin() };
}
else
{
fixedvec2 op = P_GetOffsetPosition(_f_X(), _f_Y(), FLOAT2FIXED(length*angle.Cos()), FLOAT2FIXED(length*angle.Sin()));
return{ FIXED2DBL(op.x), FIXED2DBL(op.y) };
}
}
fixedvec3 Vec3Offset(fixed_t dx, fixed_t dy, fixed_t dz, bool absolute = false)
{
if (absolute)
@ -1001,6 +1003,11 @@ public:
}
}
DVector3 Vec3Offset(const DVector3 &ofs, bool absolute = false)
{
return Vec3Offset(ofs.X, ofs.Y, ofs.Z, absolute);
}
fixedvec3 _f_Vec3Angle(fixed_t length, angle_t angle, fixed_t dz, bool absolute = false)
{
if (absolute)
@ -1047,6 +1054,10 @@ public:
SetOrigin(npos.x, npos.y, npos.z, moving);
}
void SetOrigin(double x, double y, double z, bool moving)
{
SetOrigin(FLOAT2FIXED(x), FLOAT2FIXED(y), FLOAT2FIXED(z), moving);
}
void SetOrigin(const DVector3 & npos, bool moving)
{
SetOrigin(FLOAT2FIXED(npos.X), FLOAT2FIXED(npos.Y), FLOAT2FIXED(npos.Z), moving);
@ -1104,7 +1115,7 @@ public:
ActorRenderFlags renderflags; // Different rendering flags
FTextureID picnum; // Draw this instead of sprite if valid
DWORD effects; // [RH] see p_effect.h
fixed_t alpha;
double Alpha; // Since P_CheckSight makes an alpha check this can't be a float. It has to be a double.
DWORD fillcolor; // Color to draw when STYLE_Shaded
// interaction info
@ -1264,13 +1275,19 @@ public:
FSoundIDNoInit WallBounceSound;
FSoundIDNoInit CrushPainSound;
fixed_t MaxDropOffHeight, MaxStepHeight;
fixed_t MaxDropOffHeight;
double MaxStepHeight;
fixed_t _f_MaxStepHeight()
{
return FLOAT2FIXED(MaxStepHeight);
}
SDWORD Mass;
SWORD PainChance;
int PainThreshold;
FNameNoInit DamageType;
FNameNoInit DamageTypeReceived;
fixed_t DamageFactor;
double DamageFactor;
fixed_t DamageMultiply;
FNameNoInit PainType;
@ -1466,6 +1483,16 @@ public:
__pos.x = xx;
__pos.y = yy;
}
void SetXY(const fixedvec2 &npos)
{
__pos.x = npos.x;
__pos.y = npos.y;
}
void SetXY(const DVector2 &npos)
{
__pos.x = FLOAT2FIXED(npos.X);
__pos.y = FLOAT2FIXED(npos.Y);
}
void SetXYZ(fixed_t xx, fixed_t yy, fixed_t zz)
{
__pos.x = xx;
@ -1478,11 +1505,6 @@ public:
__pos.y = FLOAT2FIXED(yy);
__pos.z = FLOAT2FIXED(zz);
}
void SetXY(const fixedvec2 &npos)
{
__pos.x = npos.x;
__pos.y = npos.y;
}
void SetXYZ(const fixedvec3 &npos)
{
__pos.x = npos.x;
@ -1570,6 +1592,8 @@ public:
return MAX(1., Distance2D(dest) / speed);
}
int ApplyDamageFactor(FName damagetype, int damage) const;
// begin of GZDoom specific additions
TArray<TObjPtr<AActor> > dynamiclights;
@ -1650,6 +1674,10 @@ inline AActor *Spawn (PClassActor *type, fixed_t x, fixed_t y, fixed_t z, replac
{
return AActor::StaticSpawn (type, x, y, z, allowreplacement);
}
inline AActor *Spawn(PClassActor *type)
{
return AActor::StaticSpawn(type, 0, 0, 0, NO_REPLACE);
}
inline AActor *Spawn (PClassActor *type, const fixedvec3 &pos, replace_t allowreplacement)
{
return AActor::StaticSpawn (type, pos.x, pos.y, pos.z, allowreplacement);
@ -1666,6 +1694,11 @@ inline AActor *Spawn(PClassActor *type, const DVector3 &pos, replace_t allowrepl
AActor *Spawn (const char *type, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement);
AActor *Spawn (FName classname, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement);
inline AActor *Spawn(FName type)
{
return Spawn(type, 0, 0, 0, NO_REPLACE);
}
inline AActor *Spawn (const char *type, const fixedvec3 &pos, replace_t allowreplacement)
{
return Spawn (type, pos.x, pos.y, pos.z, allowreplacement);
@ -1714,6 +1747,21 @@ inline T *Spawn(const DVector3 &pos, replace_t allowreplacement)
return static_cast<T *>(AActor::StaticSpawn(RUNTIME_TEMPLATE_CLASS(T), FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), zz, allowreplacement));
}
template<class T>
inline T *Spawn(double x, double y, double z, replace_t allowreplacement)
{
fixed_t zz;
if (z != ONFLOORZ && z != ONCEILINGZ && z != FLOATRANDZ) zz = FLOAT2FIXED(z);
else zz = (int)z;
return static_cast<T *>(AActor::StaticSpawn(RUNTIME_TEMPLATE_CLASS(T), FLOAT2FIXED(x), FLOAT2FIXED(y), zz, allowreplacement));
}
template<class T>
inline T *Spawn() // for inventory items we do not need coordinates and replacement info.
{
return static_cast<T *>(AActor::StaticSpawn(RUNTIME_TEMPLATE_CLASS(T), 0, 0, 0, NO_REPLACE));
}
inline fixedvec2 Vec2Angle(fixed_t length, angle_t angle)
{
fixedvec2 ret = { FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]),

View file

@ -802,7 +802,7 @@ static bool stopped = true;
static void AM_calcMinMaxMtoF();
static void DrawMarker (FTexture *tex, fixed_t x, fixed_t y, int yadjust,
INTBOOL flip, fixed_t xscale, fixed_t yscale, int translation, fixed_t alpha, DWORD fillcolor, FRenderStyle renderstyle);
INTBOOL flip, fixed_t xscale, fixed_t yscale, int translation, double alpha, DWORD fillcolor, FRenderStyle renderstyle);
void AM_rotatePoint (fixed_t *x, fixed_t *y);
void AM_rotate (fixed_t *x, fixed_t *y, angle_t an);
@ -2716,7 +2716,7 @@ void AM_drawPlayers ()
continue;
}
if (p->mo->alpha < OPAQUE)
if (p->mo->Alpha < 1.)
{
color = AMColors[AMColors.AlmostBackgroundColor];
}
@ -2848,7 +2848,7 @@ void AM_drawThings ()
const fixed_t spriteYScale = fixed_t(t->Scale.Y * 10 * scale_mtof);
DrawMarker (texture, p.x, p.y, 0, !!(frame->Flip & (1 << rotation)),
spriteXScale, spriteYScale, t->Translation, FRACUNIT, 0, LegacyRenderStyles[STYLE_Normal]);
spriteXScale, spriteYScale, t->Translation, 1., 0, LegacyRenderStyles[STYLE_Normal]);
}
else
{
@ -2936,7 +2936,7 @@ void AM_drawThings ()
//=============================================================================
static void DrawMarker (FTexture *tex, fixed_t x, fixed_t y, int yadjust,
INTBOOL flip, fixed_t xscale, fixed_t yscale, int translation, fixed_t alpha, DWORD fillcolor, FRenderStyle renderstyle)
INTBOOL flip, fixed_t xscale, fixed_t yscale, int translation, double alpha, DWORD fillcolor, FRenderStyle renderstyle)
{
if (tex == NULL || tex->UseType == FTexture::TEX_Null)
{
@ -2955,7 +2955,7 @@ static void DrawMarker (FTexture *tex, fixed_t x, fixed_t y, int yadjust,
DTA_ClipRight, f_x + f_w,
DTA_FlipX, flip,
DTA_Translation, TranslationToTable(translation),
DTA_Alpha, alpha,
DTA_AlphaF, alpha,
DTA_FillColor, fillcolor,
DTA_RenderStyle, DWORD(renderstyle),
TAG_DONE);
@ -3043,7 +3043,7 @@ void AM_drawAuthorMarkers ()
{
DrawMarker (tex, marked->_f_X() >> FRACTOMAPBITS, marked->_f_Y() >> FRACTOMAPBITS, 0,
flip, FLOAT2FIXED(mark->Scale.X), FLOAT2FIXED(mark->Scale.Y), mark->Translation,
mark->alpha, mark->fillcolor, mark->RenderStyle);
mark->Alpha, mark->fillcolor, mark->RenderStyle);
}
marked = mark->args[0] != 0 ? it.Next() : NULL;
}

View file

@ -127,7 +127,7 @@ bool DBot::Check_LOS (AActor *to, angle_t vangle)
if (vangle == 0)
return false; //Looker seems to be blind.
return absangle(player->mo->__f_AngleTo(to) - player->mo->_f_angle()) <= vangle/2;
return absangle(player->mo->AngleTo(to), player->mo->Angles.Yaw) <= ANGLE2FLOAT(vangle/2);
}
//-------------------------------------

View file

@ -269,17 +269,17 @@ bool FCajunMaster::CleanAhead (AActor *thing, fixed_t x, fixed_t y, ticcmd_t *cm
if (!(thing->flags & MF_NOCLIP) )
{
fixed_t maxstep = thing->MaxStepHeight;
if (tm.ceilingz - tm.floorz < thing->Height)
return false; // doesn't fit
double maxmove = FIXED2FLOAT(MAXMOVEHEIGHT);
if (!(thing->flags&MF_MISSILE))
{
if(tm._f_floorz() > (thing->Sector->floorplane.ZatPoint (x, y)+MAXMOVEHEIGHT)) //Too high wall
if(tm.floorz > (thing->Sector->floorplane._f_ZatPointF(x, y)+maxmove)) //Too high wall
return false;
//Jumpable
if(tm._f_floorz()>(thing->Sector->floorplane.ZatPoint (x, y)+thing->MaxStepHeight))
if(tm.floorz > (thing->Sector->floorplane._f_ZatPointF(x, y)+thing->MaxStepHeight))
cmd->ucmd.buttons |= BT_JUMP;
@ -292,7 +292,7 @@ bool FCajunMaster::CleanAhead (AActor *thing, fixed_t x, fixed_t y, ticcmd_t *cm
// maxstep=37*FRACUNIT;
if ( !(thing->flags & MF_TELEPORT) &&
(tm._f_floorz() - thing->_f_Z() > maxstep ) )
(tm.floorz - thing->Z() > thing->MaxStepHeight) )
return false; // too big a step up

View file

@ -896,7 +896,7 @@ static int PatchThing (int thingy)
}
else if (linelen == 12 && stricmp (Line1, "Translucency") == 0)
{
info->alpha = val;
info->Alpha = FIXED2DBL(val);
info->RenderStyle = STYLE_Translucent;
hadTranslucency = true;
hadStyle = true;
@ -923,7 +923,7 @@ static int PatchThing (int thingy)
}
else if (stricmp (Line1, "Alpha") == 0)
{
info->alpha = (fixed_t)(atof (Line2) * FRACUNIT);
info->Alpha = atof (Line2);
hadTranslucency = true;
}
else if (stricmp (Line1, "Scale") == 0)
@ -1226,11 +1226,11 @@ static int PatchThing (int thingy)
{
hadTranslucency = true;
if (value[2] & 1)
info->alpha = TRANSLUC25;
info->Alpha = 0.25;
else if (value[2] & 2)
info->alpha = TRANSLUC50;
info->Alpha = 0.5;
else if (value[2] & 4)
info->alpha = TRANSLUC75;
info->Alpha = 0.75;
info->RenderStyle = STYLE_Translucent;
}
if (value[2] & 8)
@ -1268,7 +1268,7 @@ static int PatchThing (int thingy)
if (!hadStyle)
info->RenderStyle = STYLE_OptFuzzy;
if (!hadTranslucency)
info->alpha = FRACUNIT/5;
info->Alpha = 0.5;
}
else
{ // changed from shadow
@ -1853,7 +1853,7 @@ static int PatchMisc (int dummy)
}
else if (stricmp (Line1, "Rocket Explosion Alpha") == 0)
{
deh.ExplosionAlpha = (fixed_t)(atof (Line2) * FRACUNIT);
deh.ExplosionAlpha = atof (Line2);
}
else if (stricmp (Line1, "Monsters Infight") == 0)
{

View file

@ -404,7 +404,7 @@ public:
float FOV; // current field of vision
fixed_t viewz; // focal origin above r.z
fixed_t viewheight; // base height above floor for viewz
fixed_t deltaviewheight; // squat speed.
double deltaviewheight; // squat speed.
double bob; // bounded/scaled total velocity
// killough 10/98: used for realistic bobbing (i.e. not simply overall speed)
@ -492,7 +492,7 @@ public:
DAngle MaxPitch;
double crouchfactor;
fixed_t crouchoffset;
double crouchoffset;
fixed_t crouchviewdelta;
FWeaponSlots weapons;
@ -502,9 +502,9 @@ public:
DAngle ConversationNPCAngle;
bool ConversationFaceTalker;
fixed_t GetDeltaViewHeight() const
double GetDeltaViewHeight() const
{
return (mo->ViewHeight + crouchviewdelta - viewheight) >> 3;
return FIXED2DBL((mo->ViewHeight + crouchviewdelta - viewheight) >> 3);
}
void Uncrouch()

View file

@ -359,7 +359,7 @@ struct FMapThing
int args[5];
int Conversation;
double Gravity;
fixed_t alpha;
double Alpha;
DWORD fillcolor;
DVector2 Scale;
int health;
@ -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

@ -234,7 +234,7 @@ struct DehInfo
int KFAAC;
char PlayerSprite[5];
BYTE ExplosionStyle;
fixed_t ExplosionAlpha;
double ExplosionAlpha;
int NoAutofreeze;
int BFGCells;
};

View file

@ -275,7 +275,7 @@ static void parseSector(FScanner &sc)
EDSector sec;
memset(&sec, 0, sizeof(sec));
sec.overlayalpha[sector_t::floor] = sec.overlayalpha[sector_t::ceiling] = FRACUNIT;
sec.overlayalpha[sector_t::floor] = sec.overlayalpha[sector_t::ceiling] = OPAQUE;
sec.floorterrain = sec.ceilingterrain = -1;
sc.MustGetStringName("{");

View file

@ -115,7 +115,7 @@ void DHUDPicManager::DoDraw (int linenum, int x, int y, int hudheight, float tra
{
FTexture * tex = TexMan[piclist[i].texturenum];
if (tex) screen->DrawTexture(tex, piclist[i].xpos, piclist[i].ypos, DTA_320x200, true,
DTA_Alpha, (fixed_t)(translucent*basetrans*FRACUNIT), TAG_DONE);
DTA_AlphaF, translucent*basetrans, TAG_DONE);
}
}

View file

@ -1396,15 +1396,12 @@ void FParser::SF_PointToAngle(void)
{
if (CheckArgs(4))
{
fixed_t x1 = fixedvalue(t_argv[0]);
fixed_t y1 = fixedvalue(t_argv[1]);
fixed_t x2 = fixedvalue(t_argv[2]);
fixed_t y2 = fixedvalue(t_argv[3]);
double x1 = floatvalue(t_argv[0]);
double y1 = floatvalue(t_argv[1]);
double x2 = floatvalue(t_argv[2]);
double y2 = floatvalue(t_argv[3]);
angle_t angle = R_PointToAngle2(x1, y1, x2, y2);
t_return.type = svt_fixed;
t_return.value.f = (fixed_t)AngleToFixed(angle);
t_return.setDouble(DVector2(x2 - x1, y2 - y1).Angle().Normalized360().Degrees);
}
}
@ -2575,7 +2572,7 @@ static void FS_GiveInventory (AActor *actor, const char * type, int amount)
AWeapon *savedPendingWeap = actor->player != NULL? actor->player->PendingWeapon : NULL;
bool hadweap = actor->player != NULL ? actor->player->ReadyWeapon != NULL : true;
AInventory *item = static_cast<AInventory *>(Spawn (info, 0,0,0, NO_REPLACE));
AInventory *item = static_cast<AInventory *>(Spawn (info));
// This shouldn't count for the item statistics!
item->ClearCounters();
@ -2783,7 +2780,7 @@ void FParser::SF_MaxPlayerAmmo()
if(amount < 0) amount = 0;
if (!iammo)
{
iammo = static_cast<AAmmo *>(Spawn (ammotype, 0, 0, 0, NO_REPLACE));
iammo = static_cast<AAmmo *>(Spawn (ammotype));
iammo->Amount = 0;
iammo->AttachToOwner (players[playernum].mo);
}
@ -3062,8 +3059,7 @@ void FParser::SF_MoveCamera(void)
fixed_t x, y, z;
fixed_t zdist, xydist, movespeed;
fixed_t xstep, ystep, zstep, targetheight;
angle_t anglespeed, anglestep, angledist, targetangle,
bigangle, smallangle;
angle_t anglespeed, anglestep, angledist, targetangle, bigangle, smallangle;
DAngle mobjangle;
// I have to use floats for the math where angles are divided
@ -3080,21 +3076,27 @@ void FParser::SF_MoveCamera(void)
if (CheckArgs(6))
{
cam = actorvalue(t_argv[0]);
target = actorvalue(t_argv[1]);
if(!cam || !target)
{
script_error("invalid target for camera\n"); return;
}
DVector2 fdist = cam->Vec2To(target);
fixed_t distx = FLOAT2FIXED(fdist.X);
fixed_t disty = FLOAT2FIXED(fdist.Y);
fixed_t camx = FLOAT2FIXED(cam->X());
fixed_t camy = FLOAT2FIXED(cam->Y());
fixed_t camz = FLOAT2FIXED(cam->Z());
targetheight = fixedvalue(t_argv[2]);
movespeed = fixedvalue(t_argv[3]);
targetangle = (angle_t)FixedToAngle(fixedvalue(t_argv[4]));
anglespeed = (angle_t)FixedToAngle(fixedvalue(t_argv[5]));
// figure out how big one step will be
fixedvec2 dist = cam->_f_Vec2To(target);
zdist = targetheight - cam->_f_Z();
zdist = targetheight - camz;
// Angle checking...
// 90
@ -3166,19 +3168,19 @@ void FParser::SF_MoveCamera(void)
else
anglestep = anglespeed;
if(abs(xstep) >= (abs(dist.x) - 1))
x = cam->_f_X() + dist.x;
if(abs(xstep) >= (abs(distx) - 1))
x = camx + distx;
else
{
x = cam->_f_X() + xstep;
x = camx + xstep;
moved = 1;
}
if(abs(ystep) >= (abs(dist.y) - 1))
y = cam->_f_Y() + dist.y;
if(abs(ystep) >= (abs(disty) - 1))
y = camy + disty;
else
{
y = cam->_f_Y() + ystep;
y = camy + ystep;
moved = 1;
}
@ -3186,7 +3188,7 @@ void FParser::SF_MoveCamera(void)
z = targetheight;
else
{
z = cam->_f_Z() + zstep;
z = camz + zstep;
moved = 1;
}
@ -3208,12 +3210,12 @@ void FParser::SF_MoveCamera(void)
cam->radius = 1 / 8192.;
cam->Height = 1 / 8192.;
if ((x != cam->_f_X() || y != cam->_f_Y()) && !P_TryMove(cam, x, y, true))
if ((x != camx || y != camy) && !P_TryMove(cam, FIXED2FLOAT(x), FIXED2FLOAT(y), true))
{
Printf("Illegal camera move to (%f, %f)\n", x/65536.f, y/65536.f);
return;
}
cam->_f_SetZ(z);
cam->SetZ(FIXED2FLOAT(z));
t_return.type = svt_int;
t_return.value.i = moved;
@ -3407,9 +3409,9 @@ void FParser::SF_SetObjPosition()
if (!mobj) return;
mobj->SetOrigin(
fixedvalue(t_argv[1]),
(t_argc >= 3)? fixedvalue(t_argv[2]) : mobj->_f_Y(),
(t_argc >= 4)? fixedvalue(t_argv[3]) : mobj->_f_Z(), false);
floatvalue(t_argv[1]),
(t_argc >= 3)? floatvalue(t_argv[2]) : mobj->Y(),
(t_argc >= 4)? floatvalue(t_argv[3]) : mobj->Z(), false);
}
}
@ -3819,8 +3821,7 @@ void FParser::SF_Sin()
{
if (CheckArgs(1))
{
t_return.type = svt_fixed;
t_return.value.f = FLOAT2FIXED(g_sin(floatvalue(t_argv[0])));
t_return.setDouble(g_sin(floatvalue(t_argv[0])));
}
}
@ -3829,8 +3830,7 @@ void FParser::SF_ASin()
{
if (CheckArgs(1))
{
t_return.type = svt_fixed;
t_return.value.f = FLOAT2FIXED(g_asin(floatvalue(t_argv[0])));
t_return.setDouble(g_asin(floatvalue(t_argv[0])));
}
}
@ -3839,8 +3839,7 @@ void FParser::SF_Cos()
{
if (CheckArgs(1))
{
t_return.type = svt_fixed;
t_return.value.f = FLOAT2FIXED(g_cos(floatvalue(t_argv[0])));
t_return.setDouble(g_cos(floatvalue(t_argv[0])));
}
}
@ -3849,8 +3848,7 @@ void FParser::SF_ACos()
{
if (CheckArgs(1))
{
t_return.type = svt_fixed;
t_return.value.f = FLOAT2FIXED(g_acos(floatvalue(t_argv[0])));
t_return.setDouble(g_acos(floatvalue(t_argv[0])));
}
}
@ -3859,9 +3857,7 @@ 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.setDouble(g_tan(floatvalue(t_argv[0])));
}
}
@ -3870,8 +3866,7 @@ void FParser::SF_ATan()
{
if (CheckArgs(1))
{
t_return.type = svt_fixed;
t_return.value.f = FLOAT2FIXED(g_atan(floatvalue(t_argv[0])));
t_return.setDouble(g_atan(floatvalue(t_argv[0])));
}
}
@ -3880,8 +3875,7 @@ void FParser::SF_Exp()
{
if (CheckArgs(1))
{
t_return.type = svt_fixed;
t_return.value.f = FLOAT2FIXED(g_exp(floatvalue(t_argv[0])));
t_return.setDouble(g_exp(floatvalue(t_argv[0])));
}
}
@ -3889,8 +3883,7 @@ void FParser::SF_Log()
{
if (CheckArgs(1))
{
t_return.type = svt_fixed;
t_return.value.f = FLOAT2FIXED(g_log(floatvalue(t_argv[0])));
t_return.setDouble(g_log(floatvalue(t_argv[0])));
}
}
@ -3899,8 +3892,7 @@ void FParser::SF_Sqrt()
{
if (CheckArgs(1))
{
t_return.type = svt_fixed;
t_return.value.f = FLOAT2FIXED(g_sqrt(floatvalue(t_argv[0])));
t_return.setDouble(g_sqrt(floatvalue(t_argv[0])));
}
}
@ -3910,7 +3902,7 @@ void FParser::SF_Floor()
if (CheckArgs(1))
{
t_return.type = svt_fixed;
t_return.value.f = fixedvalue(t_argv[0]) & 0xffFF0000;
t_return.value.f = fixedvalue(t_argv[0]) & 0xffff0000;
}
}
@ -3919,8 +3911,7 @@ void FParser::SF_Pow()
{
if (CheckArgs(2))
{
t_return.type = svt_fixed;
t_return.value.f = FLOAT2FIXED(pow(floatvalue(t_argv[0]), floatvalue(t_argv[1])));
t_return.setDouble(pow(floatvalue(t_argv[0]), floatvalue(t_argv[1])));
}
}

View file

@ -206,7 +206,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw)
if (armorbonustype != NULL)
{
assert(armorbonustype->IsDescendantOf (RUNTIME_CLASS(ABasicArmorBonus)));
ABasicArmorBonus *armorbonus = static_cast<ABasicArmorBonus *>(Spawn(armorbonustype, 0,0,0, NO_REPLACE));
ABasicArmorBonus *armorbonus = static_cast<ABasicArmorBonus *>(Spawn(armorbonustype));
armorbonus->SaveAmount = int(armorbonus->SaveAmount * actualdamage * lifesteal);
armorbonus->MaxSaveAmount = lifestealmax <= 0 ? armorbonus->MaxSaveAmount : lifestealmax;
armorbonus->flags |= MF_DROPPED;

View file

@ -1288,7 +1288,7 @@ void G_PlayerFinishLevel (int player, EFinishLevelType mode, int flags)
p->mo->flags &= ~MF_SHADOW;
}
p->mo->RenderStyle = p->mo->GetDefault()->RenderStyle;
p->mo->alpha = p->mo->GetDefault()->alpha;
p->mo->Alpha = p->mo->GetDefault()->Alpha;
p->extralight = 0; // cancel gun flashes
p->fixedcolormap = NOFIXEDCOLORMAP; // cancel ir goggles
p->fixedlightlevel = -1;
@ -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

@ -51,7 +51,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_TimeBomb)
self->AddZ(32, false);
self->RenderStyle = STYLE_Add;
self->alpha = FRACUNIT;
self->Alpha = 1.;
P_RadiusAttack (self, self->target, 128, 128, self->DamageType, RADF_HURTSOURCE);
P_CheckSplash(self, 128);
return 0;

View file

@ -172,9 +172,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_VolcanoBlast)
count = 1 + (pr_blast() % 3);
for (i = 0; i < count; i++)
{
blast = Spawn("VolcanoBlast", self->PosPlusZ(44*FRACUNIT), ALLOW_REPLACE);
blast = Spawn("VolcanoBlast", self->PosPlusZ(44.), ALLOW_REPLACE);
blast->target = self;
blast->Angles.Yaw = pr_blast() * (360 / 256.f);
blast->Angles.Yaw = pr_blast() * (360 / 256.);
blast->VelFromAngle(1.);
blast->Vel.Z = 2.5 + pr_blast() / 64.;
S_Sound (blast, CHAN_BODY, "world/volcano/shoot", 1, ATTN_NORM);

View file

@ -1247,7 +1247,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PhoenixPuff)
DAngle angle;
//[RH] Heretic never sets the target for seeking
//P_SeekerMissile (self, ANGLE_1*5, ANGLE_1*10);
//P_SeekerMissile (self, 5, 10);
puff = Spawn("PhoenixPuff", self->Pos(), ALLOW_REPLACE);
angle = self->Angles.Yaw + 90;
puff->Vel = DVector3(angle.ToVector(1.3), 0);

View file

@ -162,7 +162,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_WhirlwindSeek)
{
return 0;
}
P_SeekerMissile(self, ANGLE_1 * 10, ANGLE_1 * 30);
P_SeekerMissile(self, 10, 30);
return 0;
}

View file

@ -53,7 +53,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_WizAtk2)
PARAM_ACTION_PROLOGUE;
A_FaceTarget (self);
self->alpha = HR_SHADOW;
self->Alpha = HR_SHADOW;
self->RenderStyle = STYLE_Translucent;
self->flags3 |= MF3_GHOST;
return 0;

View file

@ -39,7 +39,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BatSpawn)
AActor *mo;
int delta;
angle_t angle;
DAngle angle;
// Countdown until next spawn
if (self->special1-- > 0) return 0;
@ -47,7 +47,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_BatSpawn)
delta = self->args[1];
if (delta==0) delta=1;
angle = self->_f_angle() + (((pr_batspawn()%delta)-(delta>>1))<<24);
angle = self->Angles.Yaw + (((pr_batspawn() % delta) - (delta >> 1)) * (360 / 256.));
mo = P_SpawnMissileAngle (self, PClass::FindActor("Bat"), angle, 0);
if (mo)
{
@ -90,7 +92,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BatMove)
}
// Handle Z movement
self->SetZ(self->target->Z() + 16 * g_sin(BOBTORAD(self->args[0])));
self->SetZ(self->target->Z() + 2 * BobSin(self->args[0]));
self->args[0] = (self->args[0]+3)&63;
return 0;
}

View file

@ -80,7 +80,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopMissileWeave)
{
PARAM_ACTION_PROLOGUE;
A_Weave(self, 2, 2, 2*FRACUNIT, FRACUNIT);
A_Weave(self, 2, 2, 2., 1.);
return 0;
}
@ -174,10 +174,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopChase)
{
PARAM_ACTION_PROLOGUE;
fixed_t newz = self->_f_Z() - finesine[self->special2 << BOBTOFINESHIFT] * 4;
double newz = self->Z() - BobSin(self->special2) / 2.;
self->special2 = (self->special2 + 4) & 63;
newz += finesine[self->special2 << BOBTOFINESHIFT] * 4;
self->_f_SetZ(newz);
newz += BobSin(self->special2) / 2.;
self->SetZ(newz);
return 0;
}
@ -193,7 +193,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopPuff)
AActor *mo;
mo = Spawn ("BishopPuff", self->PosPlusZ(40*FRACUNIT), ALLOW_REPLACE);
mo = Spawn ("BishopPuff", self->PosPlusZ(40.), ALLOW_REPLACE);
if (mo)
{
mo->Vel.Z = -.5;
@ -218,9 +218,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopPainBlur)
self->SetState (self->FindState ("Blur"));
return 0;
}
fixed_t xo = (pr_pain.Random2() << 12);
fixed_t yo = (pr_pain.Random2() << 12);
fixed_t zo = (pr_pain.Random2() << 11);
double xo = pr_pain.Random2() / 16.;
double yo = pr_pain.Random2() / 16.;
double zo = pr_pain.Random2() / 32.;
mo = Spawn ("BishopPainBlur", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
if (mo)
{

View file

@ -9,8 +9,8 @@
*/
/* For reference, the default values:
#define BLAST_RADIUS_DIST 255*FRACUNIT
#define BLAST_SPEED 20*FRACUNIT
#define BLAST_RADIUS_DIST 255*F.RACUNIT
#define BLAST_SPEED 20*F.RACUNIT
#define BLAST_FULLSTRENGTH 255
*/
@ -22,7 +22,7 @@
//
//==========================================================================
void BlastActor (AActor *victim, fixed_t strength, double speed, AActor *Owner, PClassActor *blasteffect, bool dontdamage)
void BlastActor (AActor *victim, double strength, double speed, AActor *Owner, PClassActor *blasteffect, bool dontdamage)
{
DAngle angle;
AActor *mo;
@ -97,7 +97,7 @@ DEFINE_ACTION_FUNCTION_PARAMS (AActor, A_Blast)
{
PARAM_ACTION_PROLOGUE;
PARAM_INT_OPT (blastflags) { blastflags = 0; }
PARAM_FIXED_OPT (strength) { strength = 255*FRACUNIT; }
PARAM_FLOAT_OPT (strength) { strength = 255; }
PARAM_FLOAT_OPT (radius) { radius = 255; }
PARAM_FLOAT_OPT (speed) { speed = 20; }
PARAM_CLASS_OPT (blasteffect, AActor) { blasteffect = PClass::FindActor("BlastEffect"); }

View file

@ -29,7 +29,7 @@ bool AArtiBoostArmor::Use (bool pickup)
for (int i = 0; i < 4; ++i)
{
armor = Spawn<AHexenArmor> (0,0,0, NO_REPLACE);
armor = Spawn<AHexenArmor>();
armor->flags |= MF_DROPPED;
armor->health = i;
armor->Amount = 1;
@ -46,7 +46,7 @@ bool AArtiBoostArmor::Use (bool pickup)
}
else
{
ABasicArmorBonus *armor = Spawn<ABasicArmorBonus> (0,0,0, NO_REPLACE);
ABasicArmorBonus *armor = Spawn<ABasicArmorBonus>();
armor->flags |= MF_DROPPED;
armor->SaveAmount = 50;
armor->MaxSaveAmount = 300;

View file

@ -14,7 +14,6 @@
*/
const double FLAMESPEED = 0.45;
const fixed_t CFLAMERANGE = 12*64*FRACUNIT;
const double FLAMEROTSPEED = 2.;
static FRandom pr_missile ("CFlameMissile");
@ -46,7 +45,7 @@ void ACFlameMissile::Effect ()
if (!--special1)
{
special1 = 4;
double newz = Z()-12;
double newz = Z() - 12;
if (newz < floorz)
{
newz = floorz;
@ -114,7 +113,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CFlameMissile)
int i;
DAngle an;
fixed_t dist;
double dist;
AActor *mo;
self->renderflags &= ~RF_INVISIBLE;
@ -122,13 +121,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_CFlameMissile)
AActor *BlockingMobj = self->BlockingMobj;
if (BlockingMobj && BlockingMobj->flags&MF_SHOOTABLE)
{ // Hit something, so spawn the flame circle around the thing
dist = BlockingMobj->_f_radius()+18*FRACUNIT;
dist = BlockingMobj->radius + 18;
for (i = 0; i < 4; i++)
{
an = i*45.;
mo = Spawn ("CircleFlame", BlockingMobj->Vec3Offset(
xs_CRoundToInt(an.Cos()*dist), xs_CRoundToInt(an.Sin()*dist),
5*FRACUNIT), ALLOW_REPLACE);
mo = Spawn ("CircleFlame", BlockingMobj->Vec3Angle(dist, an, 5), ALLOW_REPLACE);
if (mo)
{
mo->Angles.Yaw = an;
@ -138,9 +135,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CFlameMissile)
mo->specialf2 = mo->Vel.Y;
mo->tics -= pr_missile()&3;
}
mo = Spawn ("CircleFlame", BlockingMobj->Vec3Offset(
-xs_CRoundToInt(an.Cos()*dist), -xs_CRoundToInt(an.Sin()*dist),
5*FRACUNIT), ALLOW_REPLACE);
mo = Spawn("CircleFlame", BlockingMobj->Vec3Angle(dist, an, 5), ALLOW_REPLACE);
if(mo)
{
mo->Angles.Yaw = an + 180.;

View file

@ -63,7 +63,7 @@ IMPLEMENT_CLASS (ACWeapWraithverge)
IMPLEMENT_CLASS (AHolySpirit)
bool AHolySpirit::Slam (AActor *thing)
bool AHolySpirit::Slam(AActor *thing)
{
if (thing->flags&MF_SHOOTABLE && thing != target)
{
@ -91,14 +91,14 @@ bool AHolySpirit::Slam (AActor *thing)
// ghost burns out faster when attacking players/bosses
health -= 6;
}
P_DamageMobj (thing, this, target, dam, NAME_Melee);
P_DamageMobj(thing, this, target, dam, NAME_Melee);
if (pr_spiritslam() < 128)
{
Spawn ("HolyPuff", Pos(), ALLOW_REPLACE);
S_Sound (this, CHAN_WEAPON, "SpiritAttack", 1, ATTN_NORM);
Spawn("HolyPuff", Pos(), ALLOW_REPLACE);
S_Sound(this, CHAN_WEAPON, "SpiritAttack", 1, ATTN_NORM);
if (thing->flags3&MF3_ISMONSTER && pr_spiritslam() < 128)
{
thing->Howl ();
thing->Howl();
}
}
}
@ -110,7 +110,7 @@ bool AHolySpirit::Slam (AActor *thing)
return true;
}
bool AHolySpirit::SpecialBlastHandling (AActor *source, fixed_t strength)
bool AHolySpirit::SpecialBlastHandling (AActor *source, double strength)
{
if (tracer == source)
{
@ -133,7 +133,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_CHolyAttack2)
PARAM_ACTION_PROLOGUE;
int j;
int i;
AActor *mo;
for (j = 0; j < 4; j++)
@ -145,21 +144,22 @@ DEFINE_ACTION_FUNCTION(AActor, A_CHolyAttack2)
}
switch (j)
{ // float bob index
case 0:
mo->special2 = pr_holyatk2(8 << BOBTOFINESHIFT); // upper-left
mo->WeaveIndexZ = pr_holyatk2() & 7; // upper-left
break;
case 1:
mo->special2 = FINEANGLES/2 + pr_holyatk2(8 << BOBTOFINESHIFT); // upper-right
mo->WeaveIndexZ = 32 + (pr_holyatk2() & 7); // upper-right
break;
case 2:
mo->special2 = (FINEANGLES/2 + pr_holyatk2(8 << BOBTOFINESHIFT)) << 16; // lower-left
mo->WeaveIndexXY = 32 + (pr_holyatk2() & 7); // lower-left
break;
case 3:
i = pr_holyatk2(8 << BOBTOFINESHIFT);
mo->special2 = ((FINEANGLES/2 + i) << 16) + FINEANGLES/2 + pr_holyatk2(8 << BOBTOFINESHIFT);
mo->WeaveIndexXY = 32 + (pr_holyatk2() & 7);
mo->WeaveIndexZ = 32 + (pr_holyatk2() & 7);
break;
}
mo->_f_SetZ(self->_f_Z());
mo->SetZ(self->Z());
mo->Angles.Yaw = self->Angles.Yaw + 67.5 - 45.*j;
mo->Thrust();
mo->target = self->target;
@ -263,42 +263,41 @@ DEFINE_ACTION_FUNCTION(AActor, A_CHolyPalette)
//
//============================================================================
static void CHolyTailFollow (AActor *actor, fixed_t dist)
static void CHolyTailFollow(AActor *actor, double dist)
{
AActor *child;
int an;
fixed_t oldDistance, newDistance;
DAngle an;
double oldDistance, newDistance;
while (actor)
{
child = actor->tracer;
if (child)
{
an = actor->__f_AngleTo(child) >> ANGLETOFINESHIFT;
oldDistance = child->AproxDistance (actor);
if (P_TryMove (child, actor->_f_X()+FixedMul(dist, finecosine[an]),
actor->_f_Y()+FixedMul(dist, finesine[an]), true))
an = actor->AngleTo(child);
oldDistance = child->Distance2D(actor);
if (P_TryMove(child, actor->Pos().XY() + an.ToVector(dist), true))
{
newDistance = child->AproxDistance (actor)-FRACUNIT;
if (oldDistance < FRACUNIT)
newDistance = child->Distance2D(actor) - 1;
if (oldDistance < 1)
{
if (child->Z() < actor->Z())
{
child->_f_SetZ(actor->_f_Z()-dist);
child->SetZ(actor->Z() - dist);
}
else
{
child->_f_SetZ(actor->_f_Z()+dist);
child->SetZ(actor->Z() + dist);
}
}
else
{
child->_f_SetZ(actor->_f_Z() + Scale (newDistance, child->_f_Z()-actor->_f_Z(), oldDistance));
child->SetZ(actor->Z() + (newDistance * (child->Z() - actor->Z()) / oldDistance));
}
}
}
actor = child;
dist -= FRACUNIT;
dist -= 1;
}
}
@ -341,13 +340,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_CHolyTail)
}
else
{
if (P_TryMove (self,
parent->_f_X() - 14*finecosine[parent->_f_angle()>>ANGLETOFINESHIFT],
parent->_f_Y() - 14*finesine[parent->_f_angle()>>ANGLETOFINESHIFT], true))
if (P_TryMove(self, parent->Vec2Angle(14., parent->Angles.Yaw, true), true))
{
self->_f_SetZ(parent->_f_Z()-5*FRACUNIT);
self->SetZ(parent->Z() - 5.);
}
CHolyTailFollow (self, 10*FRACUNIT);
CHolyTailFollow(self, 10);
}
return 0;
}
@ -380,24 +377,23 @@ static void CHolyFindTarget (AActor *actor)
static void CHolySeekerMissile (AActor *actor, DAngle thresh, DAngle turnMax)
{
int dir;
int dist;
DAngle delta;
AActor *target;
fixed_t newZ;
fixed_t deltaZ;
double newZ;
double deltaZ;
target = actor->tracer;
if (target == NULL)
{
return;
}
if(!(target->flags&MF_SHOOTABLE)
|| (!(target->flags3&MF3_ISMONSTER) && !target->player))
if (!(target->flags&MF_SHOOTABLE)
|| (!(target->flags3&MF3_ISMONSTER) && !target->player))
{ // Target died/target isn't a player or creature
actor->tracer = NULL;
actor->flags &= ~(MF_NOCLIP|MF_SKULLFLY);
actor->flags &= ~(MF_NOCLIP | MF_SKULLFLY);
actor->flags |= MF_MISSILE;
CHolyFindTarget (actor);
CHolyFindTarget(actor);
return;
}
dir = P_FaceMobj (actor, target, &delta);
@ -423,59 +419,24 @@ static void CHolySeekerMissile (AActor *actor, DAngle thresh, DAngle turnMax)
|| actor->Z() > target->Top()
|| actor->Top() < target->Z())
{
newZ = target->_f_Z()+((pr_holyseeker()*target->_f_height())>>8);
deltaZ = newZ - actor->_f_Z();
if (abs(deltaZ) > 15*FRACUNIT)
newZ = target->Z() + ((pr_holyseeker()*target->Height) / 256.);
deltaZ = newZ - actor->Z();
if (fabs(deltaZ) > 15)
{
if (deltaZ > 0)
{
deltaZ = 15*FRACUNIT;
deltaZ = 15;
}
else
{
deltaZ = -15*FRACUNIT;
deltaZ = -15;
}
}
dist = actor->AproxDistance (target);
dist = dist / actor->_f_speed();
if (dist < 1)
{
dist = 1;
}
actor->Vel.Z = FIXED2DBL(deltaZ / dist);
actor->Vel.Z = deltaZ / actor->DistanceBySpeed(target, actor->Speed);
}
return;
}
//============================================================================
//
// A_CHolyWeave
//
//============================================================================
void CHolyWeave (AActor *actor, FRandom &pr_random)
{
fixed_t newX, newY, newZ;
int weaveXY, weaveZ;
int angle;
weaveXY = actor->special2 >> 16;
weaveZ = actor->special2 & FINEMASK;
angle = (actor->_f_angle() + ANG90) >> ANGLETOFINESHIFT;
newX = actor->_f_X() - FixedMul(finecosine[angle], finesine[weaveXY] * 32);
newY = actor->_f_Y() - FixedMul(finesine[angle], finesine[weaveXY] * 32);
weaveXY = (weaveXY + pr_random(5 << BOBTOFINESHIFT)) & FINEMASK;
newX += FixedMul(finecosine[angle], finesine[weaveXY] * 32);
newY += FixedMul(finesine[angle], finesine[weaveXY] * 32);
P_TryMove(actor, newX, newY, true);
newZ = actor->_f_Z();
newZ -= finesine[weaveZ] * 16;
weaveZ = (weaveZ + pr_random(5 << BOBTOFINESHIFT)) & FINEMASK;
newZ += finesine[weaveZ] * 16;
actor->_f_SetZ(newZ);
actor->special2 = weaveZ + (weaveXY << 16);
}
//============================================================================
//
// A_CHolySeek
@ -504,7 +465,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_CHolySeek)
self->args[0] = 5+(pr_holyseek()/20);
}
}
CHolyWeave (self, pr_holyweave);
int xyspeed = (pr_holyweave() % 5);
int zspeed = (pr_holyweave() % 5);
A_Weave(self, xyspeed, zspeed, 4., 2.);
return 0;
}
@ -543,7 +507,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ClericAttack)
if (!self->target) return 0;
AActor * missile = P_SpawnMissileZ (self, self->_f_Z() + 40*FRACUNIT, self->target, PClass::FindActor ("HolyMissile"));
AActor * missile = P_SpawnMissileZ (self, self->Z() + 40., self->target, PClass::FindActor ("HolyMissile"));
if (missile != NULL) missile->tracer = NULL; // No initial target
S_Sound (self, CHAN_WEAPON, "HolySymbolFire", 1, ATTN_NORM);
return 0;

View file

@ -44,7 +44,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CMaceAttack)
if (t.linetarget != NULL)
{
AdjustPlayerAngle(player->mo, &t);
goto macedone;
return 0;
}
}
}
@ -55,6 +55,5 @@ DEFINE_ACTION_FUNCTION(AActor, A_CMaceAttack)
angle = player->mo->Angles.Yaw;
slope = P_AimLineAttack (player->mo, angle, MELEERANGE);
P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, hammertime);
macedone:
return 0;
}

View file

@ -155,7 +155,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffMissileSlither)
{
PARAM_ACTION_PROLOGUE;
A_Weave(self, 3, 0, FRACUNIT, 0);
A_Weave(self, 3, 0, 1., 0.);
return 0;
}

View file

@ -29,8 +29,8 @@ static void DragonSeek (AActor *actor, DAngle thresh, DAngle turnMax)
DAngle delta;
AActor *target;
int i;
angle_t bestAngle;
angle_t angleToSpot, angleToTarget;
DAngle bestAngle;
DAngle angleToSpot, angleToTarget;
AActor *mo;
target = actor->tracer;
@ -67,7 +67,7 @@ static void DragonSeek (AActor *actor, DAngle thresh, DAngle turnMax)
{ // attack the destination mobj if it's attackable
AActor *oldTarget;
if (absangle(actor->_f_angle() - actor->__f_AngleTo(target)) < ANGLE_45/2)
if (absangle(actor->Angles.Yaw, actor->AngleTo(target)) < 22.5)
{
oldTarget = actor->target;
actor->target = target;
@ -91,8 +91,8 @@ static void DragonSeek (AActor *actor, DAngle thresh, DAngle turnMax)
if (actor->target && pr_dragonseek() < 200)
{
AActor *bestActor = NULL;
bestAngle = ANGLE_MAX;
angleToTarget = actor->__f_AngleTo(actor->target);
bestAngle = 360.;
angleToTarget = actor->AngleTo(actor->target);
for (i = 0; i < 5; i++)
{
if (!target->args[i])
@ -105,10 +105,11 @@ static void DragonSeek (AActor *actor, DAngle thresh, DAngle turnMax)
{
continue;
}
angleToSpot = actor->__f_AngleTo(mo);
if (absangle(angleToSpot-angleToTarget) < bestAngle)
angleToSpot = actor->AngleTo(mo);
DAngle diff = absangle(angleToSpot, angleToTarget);
if (diff < bestAngle)
{
bestAngle = absangle(angleToSpot-angleToTarget);
bestAngle = diff;
bestActor = mo;
}
}
@ -176,7 +177,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DragonFlight)
{
PARAM_ACTION_PROLOGUE;
angle_t angle;
DAngle angle;
DragonSeek (self, 4., 8.);
if (self->target)
@ -186,15 +187,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_DragonFlight)
self->target = NULL;
return 0;
}
angle = self->__f_AngleTo(self->target);
if (absangle(self->_f_angle()-angle) < ANGLE_45/2 && self->CheckMeleeRange())
angle = absangle(self->Angles.Yaw, self->AngleTo(self->target));
if (angle <22.5 && self->CheckMeleeRange())
{
int damage = pr_dragonflight.HitDice (8);
int newdam = P_DamageMobj (self->target, self, self, damage, NAME_Melee);
P_TraceBleed (newdam > 0 ? newdam : damage, self->target, self);
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
}
else if (absangle(self->_f_angle()-angle) <= ANGLE_1*20)
else if (angle <= 20)
{
self->SetState (self->MissileState);
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
@ -260,9 +261,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_DragonFX2)
delay = 16+(pr_dragonfx2()>>3);
for (i = 1+(pr_dragonfx2()&3); i; i--)
{
fixed_t xo = ((pr_dragonfx2() - 128) << 14);
fixed_t yo = ((pr_dragonfx2() - 128) << 14);
fixed_t zo = ((pr_dragonfx2() - 128) << 12);
double xo = (pr_dragonfx2() - 128) / 4.;
double yo = (pr_dragonfx2() - 128) / 4.;
double zo = (pr_dragonfx2() - 128) / 16.;
mo = Spawn ("DragonExplosion", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
if (mo)

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;
}
@ -115,9 +115,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_FSwordFlames)
for (i = 1+(pr_fswordflame()&3); i; i--)
{
fixed_t xo = ((pr_fswordflame() - 128) << 12);
fixed_t yo = ((pr_fswordflame() - 128) << 12);
fixed_t zo = ((pr_fswordflame() - 128) << 11);
double xo = (pr_fswordflame() - 128) / 16.;
double yo = (pr_fswordflame() - 128) / 16.;
double zo = (pr_fswordflame() - 128) / 8.;
Spawn ("FSwordFlame", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
}
return 0;
@ -135,13 +135,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_FighterAttack)
if (!self->target) return 0;
angle_t angle = self->_f_angle();
P_SpawnMissileAngle (self, RUNTIME_CLASS(AFSwordMissile), angle+ANG45/4, 0);
P_SpawnMissileAngle (self, RUNTIME_CLASS(AFSwordMissile), angle+ANG45/8, 0);
P_SpawnMissileAngle (self, RUNTIME_CLASS(AFSwordMissile), angle, 0);
P_SpawnMissileAngle (self, RUNTIME_CLASS(AFSwordMissile), angle-ANG45/8, 0);
P_SpawnMissileAngle (self, RUNTIME_CLASS(AFSwordMissile), angle-ANG45/4, 0);
P_SpawnMissileAngle(self, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw + (45. / 4), 0);
P_SpawnMissileAngle(self, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw + (45. / 8), 0);
P_SpawnMissileAngle(self, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw, 0);
P_SpawnMissileAngle(self, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw - (45. / 8), 0);
P_SpawnMissileAngle(self, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw - (45. / 4), 0);
S_Sound (self, CHAN_WEAPON, "FighterSwordFire", 1, ATTN_NORM);
return 0;
}

View file

@ -9,7 +9,7 @@
#include "thingdef/thingdef.h"
*/
#define FIREDEMON_ATTACK_RANGE 64*8*FRACUNIT
#define FIREDEMON_ATTACK_RANGE (64*8.)
static FRandom pr_firedemonrock ("FireDemonRock");
static FRandom pr_smbounce ("SMBounce");
@ -54,9 +54,9 @@ void A_FiredSpawnRock (AActor *actor)
break;
}
fixed_t xo = ((pr_firedemonrock() - 128) << 12);
fixed_t yo = ((pr_firedemonrock() - 128) << 12);
fixed_t zo = (pr_firedemonrock() << 11);
double xo = (pr_firedemonrock() - 128) / 16.;
double yo = (pr_firedemonrock() - 128) / 16.;
double zo = pr_firedemonrock() / 32.;
mo = Spawn (rtype, actor->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
if (mo)
{
@ -138,13 +138,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_FiredChase)
int weaveindex = self->special1;
AActor *target = self->target;
DAngle ang;
fixed_t dist;
double dist;
if (self->reactiontime) self->reactiontime--;
if (self->threshold) self->threshold--;
// Float up and down
self->_f_AddZ(finesine[weaveindex << BOBTOFINESHIFT] * 8);
self->AddZ(BobSin(weaveindex));
self->special1 = (weaveindex + 2) & 63;
// Ensure it stays above certain height
@ -168,7 +168,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FiredChase)
{
self->special2 = 0;
self->Vel.X = self->Vel.Y = 0;
dist = self->AproxDistance (target);
dist = self->Distance2D(target);
if (dist < FIREDEMON_ATTACK_RANGE)
{
if (pr_firedemonchase() < 30)

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);
@ -67,10 +64,7 @@ IMPLEMENT_CLASS (AArtiPoisonBag2)
bool AArtiPoisonBag2::Use (bool pickup)
{
angle_t angle = Owner->_f_angle() >> ANGLETOFINESHIFT;
AActor *mo;
mo = Spawn("FireBomb", Owner->Vec3Offset(
AActor *mo = Spawn("FireBomb", Owner->Vec3Offset(
16 * Owner->Angles.Yaw.Cos(),
24 * Owner->Angles.Yaw.Sin(),
-Owner->Floorclip + 8), ALLOW_REPLACE);
@ -97,15 +91,15 @@ bool AArtiPoisonBag3::Use (bool pickup)
{
AActor *mo;
mo = Spawn("ThrowingBomb", Owner->PosPlusZ(-Owner->_f_floorclip()+35*FRACUNIT + (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.));
/* 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;
*/
@ -265,7 +259,7 @@ AInventory *AArtiPoisonBag::CreateCopy (AActor *other)
AInventory *copy;
PClassActor *spawntype = GetFlechetteType(other);
copy = static_cast<AInventory *>(Spawn (spawntype, 0, 0, 0, NO_REPLACE));
copy = static_cast<AInventory *>(Spawn (spawntype));
copy->Amount = Amount;
copy->MaxAmount = MaxAmount;
GoAwayAndDie ();
@ -324,7 +318,7 @@ int APoisonCloud::DoSpecialDamage (AActor *victim, int damage, FName damagetype)
}
else
{
dopoison = victim->player->poisoncount < (int)(4.f * level.teamdamage);
dopoison = victim->player->poisoncount < (int)(4. * level.teamdamage);
}
if (dopoison)
@ -332,7 +326,7 @@ int APoisonCloud::DoSpecialDamage (AActor *victim, int damage, FName damagetype)
int damage = 15 + (pr_poisoncloudd()&15);
if (mate)
{
damage = (int)((double)damage * level.teamdamage);
damage = (int)(damage * level.teamdamage);
}
// Handle passive damage modifiers (e.g. PowerProtection)
if (victim->Inventory != NULL)
@ -340,11 +334,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,
@ -376,7 +366,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PoisonBagInit)
AActor *mo;
mo = Spawn<APoisonCloud> (self->PosPlusZ(28*FRACUNIT), ALLOW_REPLACE);
mo = Spawn<APoisonCloud> (self->PosPlusZ(28.), ALLOW_REPLACE);
if (mo)
{
mo->target = self->target;
@ -419,7 +409,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PoisonBagDamage)
P_RadiusAttack (self, self->target, 4, 40, self->DamageType, RADF_HURTSOURCE);
bobIndex = self->special2;
self->_f_AddZ(finesine[bobIndex << BOBTOFINESHIFT] >> 1);
self->AddZ(BobSin(bobIndex) / 16);
self->special2 = (bobIndex + 1) & 63;
return 0;
}
@ -452,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

@ -86,9 +86,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FlyBuzz)
self->Angles.Yaw = self->AngleTo(targ);
self->args[0]++;
angle_t ang = self->__f_AngleTo(targ);
ang >>= ANGLETOFINESHIFT;
if (!P_TryMove(self, self->_f_X() + 6 * finecosine[ang], self->_f_Y() + 6 * finesine[ang], true))
if (!P_TryMove(self, self->Pos().XY() + self->Angles.Yaw.ToVector(6), true))
{
self->SetIdle(true);
return 0;

View file

@ -15,7 +15,7 @@ static FRandom pr_fogspawn ("FogSpawn");
// args[3] Lifetime countdown
// args[4] Boolean: fog moving?
// special1 Internal: Counter for spawn frequency
// special2 Internal: Index into floatbob table
// WeaveIndexZ Internal: Index into floatbob table
//
//==========================================================================
@ -37,7 +37,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FogSpawn)
};
AActor *mo = NULL;
angle_t delta;
int delta;
if (self->special1-- > 0)
{
@ -57,7 +57,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FogSpawn)
mo->args[0] = (pr_fogspawn() % (self->args[0]))+1; // Random speed
mo->args[3] = self->args[3]; // Set lifetime
mo->args[4] = 1; // Set to moving
mo->special2 = pr_fogspawn()&63;
mo->WeaveIndexZ = pr_fogspawn()&63;
}
return 0;
}
@ -72,7 +72,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FogMove)
{
PARAM_ACTION_PROLOGUE;
int speed = self->args[0]<<FRACBITS;
double speed = self->args[0];
int weaveindex;
if (!self->args[4])
@ -88,9 +88,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_FogMove)
if ((self->args[3] % 4) == 0)
{
weaveindex = self->special2;
self->_f_AddZ(finesine[weaveindex << BOBTOFINESHIFT] * 4);
self->special2 = (weaveindex + 1) & 63;
weaveindex = self->WeaveIndexZ;
self->AddZ(BobSin(weaveindex) / 2);
self->WeaveIndexZ = (weaveindex + 1) & 63;
}
self->VelFromAngle(speed);

View file

@ -12,7 +12,7 @@
#include "doomstat.h"
*/
#define HEAL_RADIUS_DIST 255*FRACUNIT
#define HEAL_RADIUS_DIST 255.
static FRandom pr_healradius ("HealRadius");
@ -42,7 +42,7 @@ bool AArtiHealingRadius::Use (bool pickup)
if (playeringame[i] &&
players[i].mo != NULL &&
players[i].mo->health > 0 &&
players[i].mo->AproxDistance (Owner) <= HEAL_RADIUS_DIST)
players[i].mo->Distance2D (Owner) <= HEAL_RADIUS_DIST)
{
// Q: Is it worth it to make this selectable as a player property?
// A: Probably not - but it sure doesn't hurt.
@ -52,7 +52,7 @@ bool AArtiHealingRadius::Use (bool pickup)
case NAME_Armor:
for (int j = 0; j < 4; ++j)
{
AHexenArmor *armor = Spawn<AHexenArmor> (0,0,0, NO_REPLACE);
AHexenArmor *armor = Spawn<AHexenArmor> ();
armor->health = j;
armor->Amount = 1;
if (!armor->CallTryPickup (players[i].mo))

View file

@ -16,7 +16,7 @@
// Sorcerer stuff
//
// Sorcerer Variables
// special1 Angle of ball 1 (all others relative to that)
// specialf1 Angle of ball 1 (all others relative to that)
// StopBall which ball to stop at in stop mode (MT_???)
// args[0] Defense time
// args[1] Number of full rotations since stopping mode
@ -24,7 +24,7 @@
// args[3] Movement mode (see SORC_ macros)
// args[4] Current ball orbit speed
// Sorcerer Ball Variables
// special1 Previous angle of ball (for woosh)
// specialf1 Previous angle of ball (for woosh)
// special2 Countdown of rapid fire (FX4)
//============================================================================
@ -45,9 +45,9 @@
#define SORC_NORMAL 5
#define SORC_FIRING_SPELL 6
#define BALL1_ANGLEOFFSET 0
#define BALL2_ANGLEOFFSET (ANGLE_MAX/3)
#define BALL3_ANGLEOFFSET ((ANGLE_MAX/3)*2)
#define BALL1_ANGLEOFFSET 0.
#define BALL2_ANGLEOFFSET 120.
#define BALL3_ANGLEOFFSET 240.
void A_SlowBalls (AActor *actor);
void A_StopBalls (AActor *actor);
@ -65,6 +65,7 @@ class AHeresiarch : public AActor
DECLARE_CLASS (AHeresiarch, AActor)
public:
const PClass *StopBall;
DAngle BallAngle;
void Serialize (FArchive &arc);
void Die (AActor *source, AActor *inflictor, int dmgflags);
@ -75,7 +76,7 @@ IMPLEMENT_CLASS (AHeresiarch)
void AHeresiarch::Serialize (FArchive &arc)
{
Super::Serialize (arc);
arc << StopBall;
arc << StopBall << BallAngle;
}
void AHeresiarch::Die (AActor *source, AActor *inflictor, int dmgflags)
@ -101,15 +102,16 @@ public:
virtual void DoFireSpell ();
virtual void SorcUpdateBallAngle ();
virtual void CastSorcererSpell ();
angle_t AngleOffset;
DAngle AngleOffset;
DAngle OldAngle;
void Serialize (FArchive &arc)
{
Super::Serialize (arc);
arc << AngleOffset;
arc << AngleOffset << OldAngle;
}
bool SpecialBlastHandling (AActor *source, fixed_t strength)
bool SpecialBlastHandling (AActor *source, double strength)
{ // don't blast sorcerer balls
return false;
}
@ -169,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
@ -231,7 +213,7 @@ void ASorcBall1::DoFireSpell ()
DEFINE_ACTION_FUNCTION(AActor, A_SorcSpinBalls)
{
PARAM_ACTION_PROLOGUE;
PARAM_ACTION_PROLOGUE_TYPE(AHeresiarch);
AActor *mo;
@ -240,7 +222,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcSpinBalls)
self->args[0] = 0; // Currently no defense
self->args[3] = SORC_NORMAL;
self->args[4] = SORCBALL_INITIAL_SPEED; // Initial orbit speed
self->special1 = ANGLE_1;
self->BallAngle = 1.;
DVector3 pos = self->PosPlusZ(-self->Floorclip + self->Height);
@ -262,11 +244,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcSpinBalls)
//
// A_SorcBallOrbit
//
// - actor is ball
//============================================================================
DEFINE_ACTION_FUNCTION(AActor, A_SorcBallOrbit)
{
PARAM_ACTION_PROLOGUE;
PARAM_ACTION_PROLOGUE_TYPE(ASorcBall);
// [RH] If no parent, then die instead of crashing
if (self->target == NULL)
@ -275,78 +258,78 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBallOrbit)
return 0;
}
ASorcBall *actor;
angle_t angle, baseangle;
int mode = self->target->args[3];
AHeresiarch *parent = barrier_cast<AHeresiarch *>(self->target);
int dist = parent->_f_radius() - (self->_f_radius()<<1);
angle_t prevangle = self->special1;
double dist = parent->radius - (self->radius*2);
#if 0
// This cannot happen anymore because this is defined locally in SorcBall
if (!self->IsKindOf (RUNTIME_CLASS(ASorcBall)))
{
I_Error ("Corrupted sorcerer:\nTried to use a %s", self->GetClass()->TypeName.GetChars());
}
actor = static_cast<ASorcBall *> (self);
#endif
if (actor->target->health <= 0)
if (self->target->health <= 0)
{
actor->SetState (actor->FindState(NAME_Pain));
self->SetState (self->FindState(NAME_Pain));
return 0;
}
baseangle = (angle_t)parent->special1;
angle = baseangle + actor->AngleOffset;
actor->Angles.Yaw = ANGLE2FLOAT(angle);
angle >>= ANGLETOFINESHIFT;
DAngle prevangle = self->OldAngle;
DAngle baseangle = parent->BallAngle;
DAngle angle = baseangle + self->AngleOffset;
self->Angles.Yaw = angle;
switch (mode)
{
case SORC_NORMAL: // Balls rotating normally
actor->SorcUpdateBallAngle ();
self->SorcUpdateBallAngle ();
break;
case SORC_DECELERATE: // Balls decelerating
A_DecelBalls(actor);
actor->SorcUpdateBallAngle ();
A_DecelBalls(self);
self->SorcUpdateBallAngle ();
break;
case SORC_ACCELERATE: // Balls accelerating
A_AccelBalls(actor);
actor->SorcUpdateBallAngle ();
A_AccelBalls(self);
self->SorcUpdateBallAngle ();
break;
case SORC_STOPPING: // Balls stopping
if ((parent->StopBall == actor->GetClass()) &&
if ((parent->StopBall == self->GetClass()) &&
(parent->args[1] > SORCBALL_SPEED_ROTATIONS) &&
(absangle(angle - (parent->_f_angle()>>ANGLETOFINESHIFT)) < (30<<5)))
absangle(angle, parent->Angles.Yaw) < 42.1875)
{
// Can stop now
actor->target->args[3] = SORC_FIRESPELL;
actor->target->args[4] = 0;
self->target->args[3] = SORC_FIRESPELL;
self->target->args[4] = 0;
// Set angle so self angle == sorcerer angle
parent->special1 = (int)(parent->_f_angle() - actor->AngleOffset);
parent->BallAngle = parent->Angles.Yaw - self->AngleOffset;
}
else
{
actor->SorcUpdateBallAngle ();
self->SorcUpdateBallAngle ();
}
break;
case SORC_FIRESPELL: // Casting spell
if (parent->StopBall == actor->GetClass())
if (parent->StopBall == self->GetClass())
{
// Put sorcerer into special throw spell anim
if (parent->health > 0)
parent->SetState (parent->FindState("Attack1"));
actor->DoFireSpell ();
self->DoFireSpell ();
}
break;
case SORC_FIRING_SPELL:
if (parent->StopBall == actor->GetClass())
if (parent->StopBall == self->GetClass())
{
if (actor->special2-- <= 0)
if (self->special2-- <= 0)
{
// Done rapid firing
parent->args[3] = SORC_STOPPED;
@ -357,7 +340,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBallOrbit)
else
{
// Do rapid fire spell
A_SorcOffense2(actor);
A_SorcOffense2(self);
}
}
break;
@ -367,21 +350,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBallOrbit)
break;
}
if ((angle < prevangle) && (parent->args[4]==SORCBALL_TERMINAL_SPEED))
if (deltaangle(angle, prevangle) < 0 && (parent->args[4]==SORCBALL_TERMINAL_SPEED))
{
parent->args[1]++; // Bump rotation counter
// Completed full rotation - make woosh sound
S_Sound (actor, CHAN_BODY, "SorcererBallWoosh", 1, ATTN_NORM);
S_Sound (self, CHAN_BODY, "SorcererBallWoosh", 1, ATTN_NORM);
}
actor->special1 = angle; // Set previous angle
self->OldAngle = angle; // Set previous angle
fixedvec3 pos = parent->Vec3Offset(
FixedMul(dist, finecosine[angle]),
FixedMul(dist, finesine[angle]),
-parent->_f_floorclip() + parent->_f_height());
actor->SetOrigin (pos, true);
actor->floorz = parent->floorz;
actor->ceilingz = parent->ceilingz;
DVector3 pos = parent->Vec3Angle(dist, angle, -parent->Floorclip + parent->Height);
self->SetOrigin (pos, true);
self->floorz = parent->floorz;
self->ceilingz = parent->ceilingz;
return 0;
}
@ -411,10 +391,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpeedBalls)
//
//============================================================================
void A_SlowBalls(AActor *actor)
void A_SlowBalls(AActor *self)
{
actor->args[3] = SORC_DECELERATE; // slow mode
actor->args[2] = SORCBALL_INITIAL_SPEED; // target speed
self->args[3] = SORC_DECELERATE; // slow mode
self->args[2] = SORCBALL_INITIAL_SPEED; // target speed
}
//============================================================================
@ -428,23 +408,23 @@ void A_SlowBalls(AActor *actor)
void A_StopBalls(AActor *scary)
{
AHeresiarch *actor = static_cast<AHeresiarch *> (scary);
AHeresiarch *self = static_cast<AHeresiarch *> (scary);
int chance = pr_heresiarch();
actor->args[3] = SORC_STOPPING; // stopping mode
actor->args[1] = 0; // Reset rotation counter
self->args[3] = SORC_STOPPING; // stopping mode
self->args[1] = 0; // Reset rotation counter
if ((actor->args[0] <= 0) && (chance < 200))
if ((self->args[0] <= 0) && (chance < 200))
{
actor->StopBall = RUNTIME_CLASS(ASorcBall2); // Blue
self->StopBall = RUNTIME_CLASS(ASorcBall2); // Blue
}
else if((actor->health < (actor->SpawnHealth() >> 1)) &&
else if((self->health < (self->SpawnHealth() >> 1)) &&
(chance < 200))
{
actor->StopBall = RUNTIME_CLASS(ASorcBall3); // Green
self->StopBall = RUNTIME_CLASS(ASorcBall3); // Green
}
else
{
actor->StopBall = RUNTIME_CLASS(ASorcBall1); // Yellow
self->StopBall = RUNTIME_CLASS(ASorcBall1); // Yellow
}
}
@ -456,9 +436,9 @@ void A_StopBalls(AActor *scary)
//
//============================================================================
void A_AccelBalls(AActor *actor)
void A_AccelBalls(AActor *self)
{
AActor *sorc = actor->target;
AActor *sorc = self->target;
if (sorc->args[4] < sorc->args[2])
{
@ -483,9 +463,9 @@ void A_AccelBalls(AActor *actor)
//
//============================================================================
void A_DecelBalls(AActor *actor)
void A_DecelBalls(AActor *self)
{
AActor *sorc = actor->target;
AActor *sorc = self->target;
if (sorc->args[4] > sorc->args[2])
{
@ -506,7 +486,7 @@ void A_DecelBalls(AActor *actor)
void ASorcBall1::SorcUpdateBallAngle ()
{
target->special1 += ANGLE_1*target->args[4];
barrier_cast<AHeresiarch*>(target)->BallAngle += target->args[4];
}
//============================================================================
@ -551,7 +531,7 @@ void ASorcBall2::CastSorcererSpell ()
AActor *parent = target;
AActor *mo;
mo = Spawn("SorcFX2", PosPlusZ(-parent->_f_floorclip() + SORC_DEFENSE_HEIGHT*FRACUNIT), ALLOW_REPLACE);
mo = Spawn("SorcFX2", PosPlusZ(parent->Floorclip + SORC_DEFENSE_HEIGHT), ALLOW_REPLACE);
parent->flags2 |= MF2_REFLECTIVE|MF2_INVULNERABLE;
parent->args[0] = SORC_DEFENSE_TIME;
if (mo) mo->target = parent;
@ -570,24 +550,24 @@ void ASorcBall3::CastSorcererSpell ()
Super::CastSorcererSpell ();
AActor *mo;
angle_t ang1, ang2;
DAngle ang1, ang2;
AActor *parent = target;
ang1 = FLOAT2ANGLE(Angles.Yaw.Degrees) - ANGLE_45;
ang2 = FLOAT2ANGLE(Angles.Yaw.Degrees) + ANGLE_45;
ang1 = Angles.Yaw.Degrees - 45;
ang2 = Angles.Yaw.Degrees + 45;
PClassActor *cls = PClass::FindActor("SorcFX3");
if (health < (SpawnHealth()/3))
{ // Spawn 2 at a time
mo = P_SpawnMissileAngle(parent, cls, ang1, 4*FRACUNIT);
mo = P_SpawnMissileAngle(parent, cls, ang1, 4.);
if (mo) mo->target = parent;
mo = P_SpawnMissileAngle(parent, cls, ang2, 4*FRACUNIT);
mo = P_SpawnMissileAngle(parent, cls, ang2, 4.);
if (mo) mo->target = parent;
}
else
{
if (pr_heresiarch() < 128)
ang1 = ang2;
mo = P_SpawnMissileAngle(parent, cls, ang1, 4*FRACUNIT);
mo = P_SpawnMissileAngle(parent, cls, ang1, 4.);
if (mo) mo->target = parent;
}
}
@ -596,12 +576,12 @@ void ASorcBall3::CastSorcererSpell ()
/*
void A_SpawnReinforcements(AActor *actor)
{
AActor *parent = actor->target;
AActor *parent = self->target;
AActor *mo;
angle_t ang;
DAngle ang;
ang = ANGLE_1 * P_Random();
mo = P_SpawnMissileAngle(actor, MT_SORCFX3, ang, 5*FRACUNIT);
ang = P_Random();
mo = P_SpawnMissileAngle(actor, MT_SORCFX3, ang, 5.);
if (mo) mo->target = parent;
}
*/
@ -619,11 +599,11 @@ void ASorcBall1::CastSorcererSpell ()
Super::CastSorcererSpell ();
AActor *mo;
angle_t ang1, ang2;
DAngle ang1, ang2;
AActor *parent = target;
ang1 = FLOAT2ANGLE(Angles.Yaw.Degrees) + ANGLE_1*70;
ang2 = FLOAT2ANGLE(Angles.Yaw.Degrees) - ANGLE_1*70;
ang1 = Angles.Yaw.Degrees + 70;
ang2 = Angles.Yaw.Degrees - 70;
PClassActor *cls = PClass::FindActor("SorcFX1");
mo = P_SpawnMissileAngle (parent, cls, ang1, 0);
if (mo)
@ -651,12 +631,13 @@ void ASorcBall1::CastSorcererSpell ()
//
//============================================================================
void A_SorcOffense2(AActor *actor)
void A_SorcOffense2(AActor *self)
{
angle_t ang1;
DAngle ang1;
AActor *mo;
int delta, index;
AActor *parent = actor->target;
double delta;
int index;
AActor *parent = self->target;
AActor *dest = parent->target;
double dist;
@ -666,11 +647,11 @@ void A_SorcOffense2(AActor *actor)
return;
}
index = actor->args[4] << 5;
actor->args[4] = (actor->args[4] + 15) & 255;
delta = (finesine[index])*SORCFX4_SPREAD_ANGLE;
delta = (delta>>FRACBITS)*ANGLE_1;
ang1 = actor->_f_angle() + delta;
index = self->args[4];
self->args[4] = (self->args[4] + 15) & 255;
delta = DAngle(index * (360 / 256.f)).Sin() * SORCFX4_SPREAD_ANGLE;
ang1 = self->Angles.Yaw + delta;
mo = P_SpawnMissileAngle(parent, PClass::FindActor("SorcFX4"), ang1, 0);
if (mo)
{
@ -708,13 +689,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBossAttack)
DEFINE_ACTION_FUNCTION(AActor, A_SpawnFizzle)
{
PARAM_ACTION_PROLOGUE;
fixed_t dist = 5*FRACUNIT;
int speed = (int)self->Speed;
DAngle rangle;
AActor *mo;
int ix;
fixedvec3 pos = self->_f_Vec3Angle(dist, self->_f_angle(), -self->_f_floorclip() + (self->_f_height() >> 1));
DVector3 pos = self->Vec3Angle(5., self->Angles.Yaw, -self->Floorclip + self->Height / 2. );
for (ix=0; ix<5; ix++)
{
mo = Spawn("SorcSpark1", pos, ALLOW_REPLACE);
@ -743,7 +723,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcFX1Seek)
PARAM_ACTION_PROLOGUE;
A_DoBounceCheck (self, "SorcererHeadScream");
P_SeekerMissile (self,ANGLE_1*2,ANGLE_1*6);
P_SeekerMissile(self, 2, 6);
return 0;
}
@ -757,7 +737,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcFX1Seek)
//============================================================================
//
// FX2 Variables
// special1 current angle
// specialf1 current angle
// special2
// args[0] 0 = CW, 1 = CCW
// args[1]
@ -775,7 +755,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcFX2Split)
{
mo->target = self->target;
mo->args[0] = 0; // CW
mo->special1 = self->_f_angle(); // Set angle
mo->specialf1 = self->Angles.Yaw.Degrees; // Set angle
mo->SetState (mo->FindState("Orbit"));
}
mo = Spawn(self->GetClass(), self->Pos(), NO_REPLACE);
@ -783,7 +763,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcFX2Split)
{
mo->target = self->target;
mo->args[0] = 1; // CCW
mo->special1 = self->_f_angle(); // Set angle
mo->specialf1 = self->Angles.Yaw.Degrees; // Set angle
mo->SetState (mo->FindState("Orbit"));
}
self->Destroy ();
@ -802,8 +782,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcFX2Orbit)
{
PARAM_ACTION_PROLOGUE;
angle_t angle;
fixedvec3 pos;
DAngle angle;
DVector3 pos;
AActor *parent = self->target;
// [RH] If no parent, then disappear
@ -813,7 +793,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcFX2Orbit)
return 0;
}
fixed_t dist = parent->_f_radius();
double dist = parent->radius;
if ((parent->health <= 0) || // Sorcerer is dead
(!parent->args[0])) // Time expired
@ -834,25 +814,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcFX2Orbit)
// Move to new position based on angle
if (self->args[0]) // Counter clock-wise
{
self->special1 += ANGLE_1*10;
angle = ((angle_t)self->special1) >> ANGLETOFINESHIFT;
pos = parent->Vec3Offset(
FixedMul(dist, finecosine[angle]),
FixedMul(dist, finesine[angle]),
parent->_f_floorclip() + SORC_DEFENSE_HEIGHT*FRACUNIT);
pos.z += FixedMul(15*FRACUNIT,finecosine[angle]);
self->specialf1 += 10;
angle = self->specialf1;
pos = parent->Vec3Angle(dist, angle, parent->Floorclip + SORC_DEFENSE_HEIGHT);
pos.Z += 15 * angle.Cos();
// Spawn trailer
Spawn("SorcFX2T1", pos, ALLOW_REPLACE);
}
else // Clock wise
{
self->special1 -= ANGLE_1*10;
angle = ((angle_t)self->special1) >> ANGLETOFINESHIFT;
pos = parent->Vec3Offset(
FixedMul(dist, finecosine[angle]),
FixedMul(dist, finesine[angle]),
parent->_f_floorclip() + SORC_DEFENSE_HEIGHT*FRACUNIT);
pos.z += FixedMul(20*FRACUNIT,finesine[angle]);
self->specialf1 -= 10;
pos = parent->Vec3Angle(dist, angle, parent->Floorclip + SORC_DEFENSE_HEIGHT);
pos.Z += 20 * angle.Sin();
// Spawn trailer
Spawn("SorcFX2T1", pos, ALLOW_REPLACE);
}
@ -947,7 +920,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBallPop)
self->Vel.X = ((pr_heresiarch()%10)-5);
self->Vel.Y = ((pr_heresiarch()%10)-5);
self->Vel.Z = (2+(pr_heresiarch()%3));
self->special2 = 4*FRACUNIT; // Initial bounce factor
self->args[4] = BOUNCE_TIME_UNIT; // Bounce time unit
self->args[3] = 5; // Bounce time in seconds
return 0;

View file

@ -10,7 +10,7 @@ class AHolySpirit : public AActor
DECLARE_CLASS (AHolySpirit, AActor)
public:
bool Slam (AActor *thing);
bool SpecialBlastHandling (AActor *source, fixed_t strength);
bool SpecialBlastHandling (AActor *source, double strength);
};
class AFighterWeapon : public AWeapon

View file

@ -117,7 +117,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PotteryCheck)
if (playeringame[i])
{
AActor *pmo = players[i].mo;
if (P_CheckSight (self, pmo) && (absangle(pmo->__f_AngleTo(self) - pmo->_f_angle()) <= ANGLE_45))
if (P_CheckSight (self, pmo) && (absangle(pmo->AngleTo(self), pmo->Angles.Yaw) <= 45))
{ // Previous state (pottery bit waiting state)
self->SetState (self->state - 1);
return 0;
@ -156,7 +156,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CorpseBloodDrip)
if (pr_drip() <= 128)
{
Spawn ("CorpseBloodDrip", self->PosPlusZ(self->_f_height()/2), ALLOW_REPLACE);
Spawn ("CorpseBloodDrip", self->PosPlusZ(self->Height / 2), ALLOW_REPLACE);
}
return 0;
}
@ -186,7 +186,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CorpseExplode)
}
}
// Spawn a skull
mo = Spawn ("CorpseBit", self->_f_Pos(), ALLOW_REPLACE);
mo = Spawn ("CorpseBit", self->Pos(), ALLOW_REPLACE);
if (mo)
{
mo->SetState (mo->SpawnState + 3);
@ -214,9 +214,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_LeafSpawn)
for (i = (pr_leaf()&3)+1; i; i--)
{
fixed_t xo = (pr_leaf.Random2() << 14);
fixed_t yo = (pr_leaf.Random2() << 14);
fixed_t zo = (pr_leaf() << 14);
double xo = pr_leaf.Random2() / 4.;
double yo = pr_leaf.Random2() / 4.;
double zo = pr_leaf() / 4.;
mo = Spawn (pr_leaf()&1 ? PClass::FindActor ("Leaf1") : PClass::FindActor ("Leaf2"),
self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
@ -289,7 +289,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PoisonShroom)
{
PARAM_ACTION_PROLOGUE;
self->tics = 128+(pr_shroom()<<1);
self->tics = 128 + (pr_shroom() << 1);
return 0;
}
@ -308,9 +308,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_SoAExplode)
for (i = 0; i < 10; i++)
{
fixed_t xo = ((pr_soaexplode() - 128) << 12);
fixed_t yo = ((pr_soaexplode() - 128) << 12);
fixed_t zo = (pr_soaexplode()*self->_f_height() / 256);
double xo = (pr_soaexplode() - 128) / 16.;
double yo = (pr_soaexplode() - 128) / 16.;
double zo = pr_soaexplode()*self->Height / 256.;
mo = Spawn ("ZArmorChunk", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
if (mo)
{

View file

@ -28,19 +28,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyLook)
{
PARAM_ACTION_PROLOGUE;
fixed_t dist;
fixed_t an;
double dist;
DAngle an;
CALL_ACTION(A_Look, self);
if (pr_iceguylook() < 64)
{
dist = ((pr_iceguylook()-128)*self->_f_radius())>>7;
an = (self->_f_angle()+ANG90)>>ANGLETOFINESHIFT;
Spawn(WispTypes[pr_iceguylook() & 1], self->Vec3Offset(
FixedMul(dist, finecosine[an]),
FixedMul(dist, finesine[an]),
60 * FRACUNIT), ALLOW_REPLACE);
dist = (pr_iceguylook() - 128) * self->radius / 128.;
an = self->Angles.Yaw + 90;
Spawn(WispTypes[pr_iceguylook() & 1], self->Vec3Angle(dist, an, 60.), ALLOW_REPLACE);
}
return 0;
}
@ -55,20 +51,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyChase)
{
PARAM_ACTION_PROLOGUE;
fixed_t dist;
fixed_t an;
double dist;
DAngle an;
AActor *mo;
A_Chase (stack, self);
A_Chase(stack, self);
if (pr_iceguychase() < 128)
{
dist = ((pr_iceguychase()-128)*self->_f_radius())>>7;
an = (self->_f_angle()+ANG90)>>ANGLETOFINESHIFT;
mo = Spawn(WispTypes[pr_iceguychase() & 1], self->Vec3Offset(
FixedMul(dist, finecosine[an]),
FixedMul(dist, finesine[an]),
60 * FRACUNIT), ALLOW_REPLACE);
dist = (pr_iceguychase() - 128) * self->radius / 128.;
an = self->Angles.Yaw + 90;
mo = Spawn(WispTypes[pr_iceguylook() & 1], self->Vec3Angle(dist, an, 60.), ALLOW_REPLACE);
if (mo)
{
mo->Vel = self->Vel;
@ -92,8 +84,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyAttack)
{
return 0;
}
P_SpawnMissileXYZ(self->_f_Vec3Angle(self->_f_radius()>>1, self->_f_angle()+ANG90, 40*FRACUNIT), self, self->target, PClass::FindActor ("IceGuyFX"));
P_SpawnMissileXYZ(self->_f_Vec3Angle(self->_f_radius()>>1, self->_f_angle()-ANG90, 40*FRACUNIT), self, self->target, PClass::FindActor ("IceGuyFX"));
P_SpawnMissileXYZ(self->Vec3Angle(self->radius / 2, self->Angles.Yaw + 90, 40.), self, self->target, PClass::FindActor("IceGuyFX"));
P_SpawnMissileXYZ(self->Vec3Angle(self->radius / 2, self->Angles.Yaw - 90, 40.), self, self->target, PClass::FindActor("IceGuyFX"));
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
return 0;
}
@ -129,8 +121,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyMissileExplode)
for (i = 0; i < 8; i++)
{
mo = P_SpawnMissileAngleZ (self, self->_f_Z()+3*FRACUNIT,
PClass::FindActor("IceGuyFX2"), i*ANG45, (fixed_t)(-0.3*FRACUNIT));
mo = P_SpawnMissileAngleZ (self, self->Z()+3, PClass::FindActor("IceGuyFX2"), DAngle(i*45.), -0.3);
if (mo)
{
mo->target = self->target;

View file

@ -37,16 +37,16 @@ const int KORAX_TID = 245;
const int KORAX_FIRST_TELEPORT_TID = 248;
const int KORAX_TELEPORT_TID = 249;
const int KORAX_DELTAANGLE = 85*ANGLE_1;
const int KORAX_DELTAANGLE = 85;
const int KORAX_ARM_EXTENSION_SHORT = 40;
const int KORAX_ARM_EXTENSION_LONG = 55;
const int KORAX_ARM1_HEIGHT = 108*FRACUNIT;
const int KORAX_ARM2_HEIGHT = 82*FRACUNIT;
const int KORAX_ARM3_HEIGHT = 54*FRACUNIT;
const int KORAX_ARM4_HEIGHT = 104*FRACUNIT;
const int KORAX_ARM5_HEIGHT = 86*FRACUNIT;
const int KORAX_ARM6_HEIGHT = 53*FRACUNIT;
const int KORAX_ARM1_HEIGHT = 108;
const int KORAX_ARM2_HEIGHT = 82;
const int KORAX_ARM3_HEIGHT = 54;
const int KORAX_ARM4_HEIGHT = 104;
const int KORAX_ARM5_HEIGHT = 86;
const int KORAX_ARM6_HEIGHT = 53;
const double KORAX_BOLT_HEIGHT = 48.;
const int KORAX_BOLT_LIFETIME = 3;
@ -76,8 +76,7 @@ void A_KBoltRaise (AActor *);
void KoraxFire (AActor *actor, PClassActor *type, int arm);
void KSpiritInit (AActor *spirit, AActor *korax);
AActor *P_SpawnKoraxMissile (fixed_t x, fixed_t y, fixed_t z,
AActor *source, AActor *dest, PClassActor *type);
AActor *P_SpawnKoraxMissile (const DVector3 &pos, AActor *source, AActor *dest, PClassActor *type);
extern void SpawnSpiritTail (AActor *spirit);
@ -99,7 +98,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_KoraxChase)
spot = iterator.Next ();
if (spot != NULL)
{
P_Teleport (self, spot->_f_X(), spot->_f_Y(), ONFLOORZ, spot->Angles.Yaw, TELF_SOURCEFOG | TELF_DESTFOG);
P_Teleport (self, spot->PosAtZ(ONFLOORZ), spot->Angles.Yaw, TELF_SOURCEFOG | TELF_DESTFOG);
}
P_StartScript (self, NULL, 249, NULL, NULL, 0, 0);
@ -141,7 +140,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_KoraxChase)
self->tracer = spot;
if (spot)
{
P_Teleport (self, spot->_f_X(), spot->_f_Y(), ONFLOORZ, spot->Angles.Yaw, TELF_SOURCEFOG | TELF_DESTFOG);
P_Teleport (self, spot->PosAtZ(ONFLOORZ), spot->Angles.Yaw, TELF_SOURCEFOG | TELF_DESTFOG);
}
}
}
@ -164,7 +163,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_KoraxBonePop)
// Spawn 6 spirits equalangularly
for (i = 0; i < 6; ++i)
{
mo = P_SpawnMissileAngle (self, PClass::FindActor("KoraxSpirit"), ANGLE_60*i, 5*FRACUNIT);
mo = P_SpawnMissileAngle (self, PClass::FindActor("KoraxSpirit"), DAngle(60.*i), 5.);
if (mo)
{
KSpiritInit (mo, self);
@ -186,7 +185,7 @@ void KSpiritInit (AActor *spirit, AActor *korax)
spirit->health = KORAX_SPIRIT_LIFETIME;
spirit->tracer = korax; // Swarm around korax
spirit->special2 = FINEANGLES/2 + pr_kspiritinit(8 << BOBTOFINESHIFT); // Float bob index
spirit->WeaveIndexZ = 32 + (pr_kspiritinit() & 7); // Float bob index
spirit->args[0] = 10; // initial turn value
spirit->args[1] = 0; // initial look angle
@ -235,23 +234,23 @@ DEFINE_ACTION_FUNCTION(AActor, A_KoraxMissile)
{ "SerpentFX", "CentaurLeaderAttack" }
};
int type = pr_koraxmissile()%6;
int type = pr_koraxmissile() % 6;
int i;
PClassActor *info;
S_Sound (self, CHAN_VOICE, "KoraxAttack", 1, ATTN_NORM);
S_Sound(self, CHAN_VOICE, "KoraxAttack", 1, ATTN_NORM);
info = PClass::FindActor(choices[type].type);
if (info == NULL)
{
I_Error ("Unknown Korax missile: %s\n", choices[type].type);
I_Error("Unknown Korax missile: %s\n", choices[type].type);
}
// Fire all 6 missiles at once
S_Sound (self, CHAN_WEAPON, choices[type].sound, 1, ATTN_NONE);
S_Sound(self, CHAN_WEAPON, choices[type].sound, 1, ATTN_NONE);
for (i = 0; i < 6; ++i)
{
KoraxFire (self, info, i);
KoraxFire(self, info, i);
}
return 0;
}
@ -267,17 +266,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_KoraxMissile)
DEFINE_ACTION_FUNCTION(AActor, A_KoraxCommand)
{
PARAM_ACTION_PROLOGUE;
angle_t ang;
DAngle ang;
int numcommands;
S_Sound (self, CHAN_VOICE, "KoraxCommand", 1, ATTN_NORM);
// Shoot stream of lightning to ceiling
ang = (self->_f_angle() - ANGLE_90) >> ANGLETOFINESHIFT;
fixedvec3 pos = self->Vec3Offset(
KORAX_COMMAND_OFFSET * finecosine[ang],
KORAX_COMMAND_OFFSET * finesine[ang],
KORAX_COMMAND_HEIGHT*FRACUNIT);
ang = self->Angles.Yaw - 90;
DVector3 pos = self->Vec3Angle(KORAX_COMMAND_OFFSET, ang, KORAX_COMMAND_HEIGHT);
Spawn("KoraxBolt", pos, ALLOW_REPLACE);
if (self->health <= (self->SpawnHealth() >> 1))
@ -319,7 +315,7 @@ void KoraxFire (AActor *actor, PClassActor *type, int arm)
KORAX_ARM_EXTENSION_LONG,
KORAX_ARM_EXTENSION_LONG
};
static const fixed_t armheight[6] =
static const int armheight[6] =
{
KORAX_ARM1_HEIGHT,
KORAX_ARM2_HEIGHT,
@ -329,25 +325,11 @@ void KoraxFire (AActor *actor, PClassActor *type, int arm)
KORAX_ARM6_HEIGHT
};
angle_t ang;
ang = (actor->_f_angle() + (arm < 3 ? -KORAX_DELTAANGLE : KORAX_DELTAANGLE)) >> ANGLETOFINESHIFT;
fixedvec3 pos = actor->Vec3Offset(
extension[arm] * finecosine[ang],
extension[arm] * finesine[ang],
-actor->_f_floorclip() + armheight[arm]);
P_SpawnKoraxMissile (pos.x, pos.y, pos.z, actor, actor->target, type);
DAngle ang = actor->Angles.Yaw + (arm < 3 ? -KORAX_DELTAANGLE : KORAX_DELTAANGLE);
DVector3 pos = actor->Vec3Angle(extension[arm], ang, armheight[arm] - actor->Floorclip);
P_SpawnKoraxMissile (pos, actor, actor->target, type);
}
//============================================================================
//
// A_KSpiritWeave
// [BL] Was identical to CHolyWeave so lets just use that
//
//============================================================================
void CHolyWeave (AActor *actor, FRandom &pr_random);
//============================================================================
//
// A_KSpiritSeeker
@ -357,11 +339,10 @@ void CHolyWeave (AActor *actor, FRandom &pr_random);
static void A_KSpiritSeeker (AActor *actor, DAngle thresh, DAngle turnMax)
{
int dir;
int dist;
DAngle delta;
AActor *target;
fixed_t newZ;
fixed_t deltaZ;
double newZ;
double deltaZ;
target = actor->tracer;
if (target == NULL)
@ -388,28 +369,24 @@ static void A_KSpiritSeeker (AActor *actor, DAngle thresh, DAngle turnMax)
actor->VelFromAngle();
if (!(level.time&15)
|| actor->_f_Z() > target->_f_Z()+(target->GetDefault()->_f_height())
|| actor->_f_Top() < target->_f_Z())
|| actor->Z() > target->Z() + target->GetDefault()->Height
|| actor->Top() < target->Z())
{
newZ = target->_f_Z()+((pr_kspiritseek()*target->GetDefault()->_f_height())>>8);
deltaZ = newZ-actor->_f_Z();
if (abs(deltaZ) > 15*FRACUNIT)
newZ = target->Z() + pr_kspiritseek() * target->GetDefault()->Height / 256;
deltaZ = newZ-actor->Z();
if (fabs(deltaZ) > 15)
{
if(deltaZ > 0)
{
deltaZ = 15*FRACUNIT;
deltaZ = 15;
}
else
{
deltaZ = -15*FRACUNIT;
deltaZ = -15;
}
}
dist = actor->AproxDistance (target) / actor->_f_speed();
if (dist < 1)
{
dist = 1;
}
actor->Vel.Z = FIXED2DBL(deltaZ/dist);
actor->Vel.Z = deltaZ + actor->DistanceBySpeed(target, actor->Speed);
}
return;
}
@ -435,7 +412,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_KSpiritRoam)
{
A_KSpiritSeeker(self, (double)self->args[0], self->args[0] * 2.);
}
CHolyWeave(self, pr_kspiritweave);
int xyspeed = (pr_kspiritweave() % 5);
int zspeed = (pr_kspiritweave() % 5);
A_Weave(self, xyspeed, zspeed, 4., 2.);
if (pr_kspiritroam()<50)
{
S_Sound (self, CHAN_VOICE, "SpiritActive", 1, ATTN_NONE);
@ -498,15 +478,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_KBoltRaise)
//
//============================================================================
AActor *P_SpawnKoraxMissile (fixed_t x, fixed_t y, fixed_t z,
AActor *source, AActor *dest, PClassActor *type)
AActor *P_SpawnKoraxMissile (const DVector3 &pos, AActor *source, AActor *dest, PClassActor *type)
{
AActor *th;
DAngle an;
int dist;
double dist;
z -= source->_f_floorclip();
th = Spawn (type, x, y, z, ALLOW_REPLACE);
th = Spawn (type, source->PosPlusZ(-source->Floorclip), ALLOW_REPLACE);
th->target = source; // Originator
an = th->AngleTo(dest);
if (dest->flags & MF_SHADOW)
@ -515,11 +493,7 @@ AActor *P_SpawnKoraxMissile (fixed_t x, fixed_t y, fixed_t z,
}
th->Angles.Yaw = an;
th->VelFromAngle();
dist = dest->AproxDistance (th) / th->_f_speed();
if (dist < 1)
{
dist = 1;
}
th->Vel.Z = FIXED2DBL((dest->_f_Z()-z+(30*FRACUNIT))/dist);
dist = dest->DistanceBySpeed(th, th->Speed);
th->Vel.Z = (dest->Z() - pos.Z + 30) / dist;
return (P_CheckMissileSpawn(th, source->radius) ? th : NULL);
}

View file

@ -128,8 +128,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_ShedShard)
// every so many calls, spawn a new missile in its set directions
if (spawndir & SHARDSPAWN_LEFT)
{
mo = P_SpawnMissileAngleZSpeed (self, self->_f_Z(), RUNTIME_CLASS(AFrostMissile), self->_f_angle()+(ANG45/9),
0, (20+2*spermcount)<<FRACBITS, self->target);
mo = P_SpawnMissileAngleZSpeed(self, self->Z(), RUNTIME_CLASS(AFrostMissile),
self->Angles.Yaw + 5, 0, (20. + 2 * spermcount), self->target);
if (mo)
{
mo->special1 = SHARDSPAWN_LEFT;
@ -140,8 +140,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_ShedShard)
}
if (spawndir & SHARDSPAWN_RIGHT)
{
mo = P_SpawnMissileAngleZSpeed (self, self->_f_Z(), RUNTIME_CLASS(AFrostMissile), self->_f_angle()-(ANG45/9),
0, (20+2*spermcount)<<FRACBITS, self->target);
mo = P_SpawnMissileAngleZSpeed(self, self->Z(), RUNTIME_CLASS(AFrostMissile),
self->Angles.Yaw - 5, 0, (20. + 2 * spermcount), self->target);
if (mo)
{
mo->special1 = SHARDSPAWN_RIGHT;
@ -152,8 +152,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_ShedShard)
}
if (spawndir & SHARDSPAWN_UP)
{
mo = P_SpawnMissileAngleZSpeed (self, self->_f_Z()+8*FRACUNIT, RUNTIME_CLASS(AFrostMissile), self->_f_angle(),
0, (15+2*spermcount)<<FRACBITS, self->target);
mo = P_SpawnMissileAngleZSpeed(self, self->Z() + 8., RUNTIME_CLASS(AFrostMissile),
self->Angles.Yaw, 0, (15. + 2 * spermcount), self->target);
if (mo)
{
mo->Vel.Z = self->Vel.Z;
@ -167,8 +167,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_ShedShard)
}
if (spawndir & SHARDSPAWN_DOWN)
{
mo = P_SpawnMissileAngleZSpeed (self, self->_f_Z()-4*FRACUNIT, RUNTIME_CLASS(AFrostMissile), self->_f_angle(),
0, (15+2*spermcount)<<FRACBITS, self->target);
mo = P_SpawnMissileAngleZSpeed(self, self->Z() - 4., RUNTIME_CLASS(AFrostMissile),
self->Angles.Yaw, 0, (15. + 2 * spermcount), self->target);
if (mo)
{
mo->Vel.Z = self->Vel.Z;

View file

@ -215,7 +215,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningZap)
PClassActor *lightning = PClass::FindActor(self->GetClass()->MissileName);
AActor *mo;
fixed_t deltaZ;
if (lightning == NULL)
{
@ -230,32 +229,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningZap)
self->SetState (self->FindState(NAME_Death));
return 0;
}
if (self->flags3 & MF3_FLOORHUGGER)
{
deltaZ = 10*FRACUNIT;
}
else
{
deltaZ = -10*FRACUNIT;
}
fixed_t xo = ((pr_zap() - 128)*self->_f_radius() / 256);
fixed_t yo = ((pr_zap() - 128)*self->_f_radius() / 256);
double deltaX = (pr_zap() - 128) * self->radius / 256;
double deltaY = (pr_zap() - 128) * self->radius / 256;
double deltaZ = (self->flags3 & MF3_FLOORHUGGER) ? 10 : -10;
mo = Spawn(lightning, self->Vec3Offset(xo, yo, deltaZ), ALLOW_REPLACE);
mo = Spawn(lightning, self->Vec3Offset(deltaX, deltaY, deltaZ), ALLOW_REPLACE);
if (mo)
{
mo->lastenemy = self;
mo->Vel.X = self->Vel.X;
mo->Vel.Y = self->Vel.Y;
mo->Vel.Z = (self->flags3 & MF3_FLOORHUGGER) ? 20 : -20;
mo->target = self->target;
if (self->flags3 & MF3_FLOORHUGGER)
{
mo->Vel.Z = 20;
}
else
{
mo->Vel.Z = -20;
}
}
if ((self->flags3 & MF3_FLOORHUGGER) && pr_zapf() < 160)
{

View file

@ -64,7 +64,7 @@ class AMageStaffFX2 : public AActor
DECLARE_CLASS(AMageStaffFX2, AActor)
public:
int SpecialMissileHit (AActor *victim);
bool SpecialBlastHandling (AActor *source, fixed_t strength);
bool SpecialBlastHandling (AActor *source, double strength);
};
IMPLEMENT_CLASS (AMageStaffFX2)
@ -81,7 +81,7 @@ int AMageStaffFX2::SpecialMissileHit (AActor *victim)
return -1;
}
bool AMageStaffFX2::SpecialBlastHandling (AActor *source, fixed_t strength)
bool AMageStaffFX2::SpecialBlastHandling (AActor *source, double strength)
{
// Reflect to originator
tracer = target;
@ -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;
@ -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);
@ -193,7 +193,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MStaffTrack)
{
self->tracer = P_RoughMonsterSearch (self, 10, true);
}
P_SeekerMissile (self, ANGLE_1*2, ANGLE_1*10);
P_SeekerMissile(self, 2, 10);
return 0;
}
@ -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;
@ -229,12 +229,11 @@ static AActor *FrontBlockCheck (AActor *mo, int index, void *)
//
//============================================================================
void MStaffSpawn2 (AActor *actor, angle_t angle)
void MStaffSpawn2 (AActor *actor, DAngle angle)
{
AActor *mo;
mo = P_SpawnMissileAngleZ (actor, actor->_f_Z()+40*FRACUNIT,
RUNTIME_CLASS(AMageStaffFX2), angle, 0);
mo = P_SpawnMissileAngleZ (actor, actor->Z()+40, RUNTIME_CLASS(AMageStaffFX2), angle, 0.);
if (mo)
{
mo->target = actor;
@ -256,11 +255,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_MageAttack)
{
return 0;
}
angle_t angle;
angle = self->_f_angle();
MStaffSpawn2 (self, angle);
MStaffSpawn2 (self, angle-ANGLE_1*5);
MStaffSpawn2 (self, angle+ANGLE_1*5);
S_Sound (self, CHAN_WEAPON, "MageStaffFire", 1, ATTN_NORM);
DAngle angle = self->Angles.Yaw;
MStaffSpawn2(self, angle);
MStaffSpawn2(self, angle - 5);
MStaffSpawn2(self, angle + 5);
S_Sound(self, CHAN_WEAPON, "MageStaffFire", 1, ATTN_NORM);
return 0;
}

View file

@ -160,8 +160,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_ThrustImpale)
FMultiBlockThingsIterator::CheckResult cres;
while (it.Next(&cres))
{
fixed_t blockdist = self->_f_radius() + cres.thing->_f_radius();
if (abs(cres.thing->_f_X() - cres.position.x) >= blockdist || abs(cres.thing->_f_Y() - cres.position.y) >= blockdist)
double blockdist = self->radius + cres.thing->radius;
if (fabs(cres.thing->X() - cres.Position.X) >= blockdist || fabs(cres.thing->Y() - cres.Position.Y) >= blockdist)
continue;
// Q: Make this z-aware for everything? It never was before.

View file

@ -53,13 +53,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_Summon)
AMinotaurFriend *mo;
mo = Spawn<AMinotaurFriend> (self->Pos(), ALLOW_REPLACE);
mo = Spawn<AMinotaurFriend>(self->Pos(), ALLOW_REPLACE);
if (mo)
{
if (P_TestMobjLocation(mo) == false || !self->tracer)
{ // Didn't fit - change back to artifact
mo->Destroy ();
AActor *arti = Spawn<AArtiDarkServant> (self->_f_Pos(), ALLOW_REPLACE);
mo->Destroy();
AActor *arti = Spawn<AArtiDarkServant>(self->Pos(), ALLOW_REPLACE);
if (arti) arti->flags |= MF_DROPPED;
return 0;
}
@ -72,14 +72,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_Summon)
else
{
mo->tracer = self->tracer; // Pointer to master
AInventory *power = Spawn<APowerMinotaur> (0, 0, 0, NO_REPLACE);
power->CallTryPickup (self->tracer);
AInventory *power = Spawn<APowerMinotaur>();
power->CallTryPickup(self->tracer);
mo->SetFriendPlayer(self->tracer->player);
}
// Make smoke puff
Spawn ("MinotaurSmoke", self->Pos(), ALLOW_REPLACE);
S_Sound (self, CHAN_VOICE, mo->ActiveSound, 1, ATTN_NORM);
Spawn("MinotaurSmoke", self->Pos(), ALLOW_REPLACE);
S_Sound(self, CHAN_VOICE, mo->ActiveSound, 1, ATTN_NORM);
}
return 0;
}

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

@ -15,12 +15,6 @@ static FRandom pr_wraithfx2 ("WraithFX2");
static FRandom pr_wraithfx3 ("WraithFX3");
static FRandom pr_wraithfx4 ("WraithFX4");
//============================================================================
// Wraith Variables
//
// special1 Internal index into floatbob
//============================================================================
//============================================================================
//
// A_WraithInit
@ -39,7 +33,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithInit)
self->SetZ(self->ceilingz - self->Height);
}
self->special1 = 0; // index into floatbob
self->WeaveIndexZ = 0; // index into floatbob
return 0;
}
@ -71,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
@ -156,15 +150,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithFX3)
PARAM_ACTION_PROLOGUE;
AActor *mo;
int numdropped = pr_wraithfx3()%15;
int numdropped = pr_wraithfx3() % 15;
while (numdropped-- > 0)
{
fixed_t xo = (pr_wraithfx3() - 128) << 11;
fixed_t yo = (pr_wraithfx3() - 128) << 11;
fixed_t zo = pr_wraithfx3() << 10;
double xo = (pr_wraithfx3() - 128) / 32.;
double yo = (pr_wraithfx3() - 128) / 32.;
double zo = pr_wraithfx3() / 64.;
mo = Spawn ("WraithFX3", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
mo = Spawn("WraithFX3", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
if (mo)
{
mo->floorz = self->floorz;
@ -212,9 +206,9 @@ void A_WraithFX4 (AActor *self)
if (spawn4)
{
fixed_t xo = (pr_wraithfx4() - 128) << 12;
fixed_t yo = (pr_wraithfx4() - 128) << 12;
fixed_t zo = (pr_wraithfx4() << 10);
double xo = (pr_wraithfx4() - 128) / 16.;
double yo = (pr_wraithfx4() - 128) / 16.;
double zo = (pr_wraithfx4() / 64.);
mo = Spawn ("WraithFX4", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
if (mo)
@ -226,9 +220,9 @@ void A_WraithFX4 (AActor *self)
}
if (spawn5)
{
fixed_t xo = (pr_wraithfx4() - 128) << 11;
fixed_t yo = (pr_wraithfx4() - 128) << 11;
fixed_t zo = (pr_wraithfx4()<<10);
double xo = (pr_wraithfx4() - 128) / 32.;
double yo = (pr_wraithfx4() - 128) / 32.;
double zo = (pr_wraithfx4() / 64.);
mo = Spawn ("WraithFX5", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
if (mo)
@ -250,9 +244,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithChase)
{
PARAM_ACTION_PROLOGUE;
int weaveindex = self->special1;
self->_f_AddZ(finesine[weaveindex << BOBTOFINESHIFT] * 8);
self->special1 = (weaveindex + 2) & 63;
int weaveindex = self->WeaveIndexZ;
self->AddZ(BobSin(weaveindex));
self->WeaveIndexZ = (weaveindex + 2) & 63;
// if (self->Floorclip > 0)
// {
// P_SetMobjState(self, S_WRAITH_RAISE2);

View file

@ -329,7 +329,7 @@ struct level_info_t
FString SoundInfo;
FString SndSeq;
float teamdamage;
double teamdamage;
FOptData optdata;
FMusicMap MusicMap;
@ -444,7 +444,7 @@ struct FLevelLocals
bool FromSnapshot; // The current map was restored from a snapshot
float teamdamage;
double teamdamage;
bool IsJumpingAllowed() const;
bool IsCrouchingAllowed() const;
@ -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

@ -1150,7 +1150,7 @@ DEFINE_MAP_OPTION(teamdamage, true)
{
parse.ParseAssign();
parse.sc.MustGetFloat();
info->teamdamage = float(parse.sc.Float);
info->teamdamage = parse.sc.Float;
}
DEFINE_MAP_OPTION(mapbackground, true)

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

@ -161,7 +161,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk1)
if ((player = self->target->player) != NULL &&
player->mo == self->target)
{ // Squish the player
player->deltaviewheight = -16*FRACUNIT;
player->deltaviewheight = -16;
}
}
return 0;
@ -183,7 +183,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurDecide)
bool friendly = !!(self->flags5 & MF5_SUMMONEDMONSTER);
AActor *target;
int dist;
double dist;
target = self->target;
if (!target)
@ -194,11 +194,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurDecide)
{
S_Sound (self, CHAN_WEAPON, "minotaur/sight", 1, ATTN_NORM);
}
dist = self->AproxDistance (target);
dist = self->Distance2D(target);
if (target->Top() > self->Z()
&& target->Top() < self->Top()
&& dist < (friendly ? 16*64*FRACUNIT : 8*64*FRACUNIT)
&& dist > 1*64*FRACUNIT
&& dist < (friendly ? 16*64. : 8*64.)
&& dist > 1*64.
&& pr_minotaurdecide() < 150)
{ // Charge attack
// Don't call the state function right away
@ -213,7 +213,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurDecide)
self->special1 = TICRATE/2; // Charge duration
}
else if (target->Z() == target->floorz
&& dist < 9*64*FRACUNIT
&& dist < 9*64.
&& pr_minotaurdecide() < (friendly ? 100 : 220))
{ // Floor fire attack
self->SetState (self->FindState ("Hammer"));
@ -282,9 +282,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk2)
PARAM_ACTION_PROLOGUE;
AActor *mo;
angle_t angle;
fixed_t vz;
fixed_t z;
DAngle angle;
double vz;
double z;
bool friendly = !!(self->flags5 & MF5_SUMMONEDMONSTER);
if (self->target == NULL)
@ -300,7 +300,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk2)
P_TraceBleed (newdam > 0 ? newdam : damage, self->target, self);
return 0;
}
z = self->_f_Z() + 40*FRACUNIT;
z = self->Z() + 40;
PClassActor *fx = PClass::FindActor("MinotaurFX1");
if (fx)
{
@ -308,12 +308,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk2)
if (mo != NULL)
{
// S_Sound (mo, CHAN_WEAPON, "minotaur/attack2", 1, ATTN_NORM);
vz = mo->_f_velz();
angle = mo->_f_angle();
P_SpawnMissileAngleZ (self, z, fx, angle-(ANG45/8), vz);
P_SpawnMissileAngleZ (self, z, fx, angle+(ANG45/8), vz);
P_SpawnMissileAngleZ (self, z, fx, angle-(ANG45/16), vz);
P_SpawnMissileAngleZ (self, z, fx, angle+(ANG45/16), vz);
vz = mo->Vel.Z;
angle = mo->Angles.Yaw;
P_SpawnMissileAngleZ (self, z, fx, angle-(45./8), vz);
P_SpawnMissileAngleZ (self, z, fx, angle+(45./8), vz);
P_SpawnMissileAngleZ (self, z, fx, angle-(45./16), vz);
P_SpawnMissileAngleZ (self, z, fx, angle+(45./16), vz);
}
}
return 0;
@ -350,7 +350,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk3)
if ((player = self->target->player) != NULL &&
player->mo == self->target)
{ // Squish the player
player->deltaviewheight = -16*FRACUNIT;
player->deltaviewheight = -16;
}
}
else
@ -486,7 +486,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurRoam)
//
// Look for enemy of player
//----------------------------------------------------------------------------
#define MINOTAUR_LOOK_DIST (16*54*FRACUNIT)
#define MINOTAUR_LOOK_DIST (16*54.)
DEFINE_ACTION_FUNCTION(AActor, A_MinotaurLook)
{
@ -500,7 +500,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurLook)
AActor *mo = NULL;
player_t *player;
fixed_t dist;
double dist;
int i;
AActor *master = self->tracer;
@ -514,7 +514,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurLook)
mo = player->mo;
if (mo == master) continue;
if (mo->health <= 0) continue;
dist = self->AproxDistance(mo);
dist = self->Distance2D(mo);
if (dist > MINOTAUR_LOOK_DIST) continue;
self->target = mo;
break;
@ -539,7 +539,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurLook)
if (!(mo->flags3 & MF3_ISMONSTER)) continue;
if (mo->health <= 0) continue;
if (!(mo->flags & MF_SHOOTABLE)) continue;
dist = self->AproxDistance(mo);
dist = self->Distance2D(mo);
if (dist > MINOTAUR_LOOK_DIST) continue;
if ((mo == master) || (mo == self)) continue;
if ((mo->flags5 & MF5_SUMMONEDMONSTER) && (mo->tracer == master)) continue;

View file

@ -63,7 +63,7 @@ void A_Unblock(AActor *self, bool drop)
// [RH] Andy Baker's stealth monsters
if (self->flags & MF_STEALTH)
{
self->alpha = OPAQUE;
self->Alpha = 1.;
self->visdir = 0;
}
@ -201,7 +201,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeath)
// [RH] Andy Baker's stealth monsters
if (self->flags & MF_STEALTH)
{
self->alpha = OPAQUE;
self->Alpha = 1;
self->visdir = 0;
}
@ -303,7 +303,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks)
mo->Vel.Z = (mo->Z() - self->Z()) / self->Height * 4;
CALL_ACTION(A_IceSetTics, mo); // set a random tic wait
mo->RenderStyle = self->RenderStyle;
mo->alpha = self->alpha;
mo->Alpha = self->Alpha;
}
}
if (self->player)
@ -326,7 +326,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks)
}
head->Angles.Pitch = 0.;
head->RenderStyle = self->RenderStyle;
head->alpha = self->alpha;
head->Alpha = self->Alpha;
if (head->player->camera == self)
{
head->player->camera = head;

View file

@ -249,7 +249,7 @@ bool ABasicArmorPickup::Use (bool pickup)
if (armor == NULL)
{
armor = Spawn<ABasicArmor> (0,0,0, NO_REPLACE);
armor = Spawn<ABasicArmor> ();
armor->BecomeItem ();
Owner->AddInventory (armor);
}
@ -332,7 +332,7 @@ bool ABasicArmorBonus::Use (bool pickup)
if (armor == NULL)
{
armor = Spawn<ABasicArmor> (0,0,0, NO_REPLACE);
armor = Spawn<ABasicArmor> ();
armor->BecomeItem ();
armor->Amount = 0;
armor->MaxAmount = MaxSaveAmount;

View file

@ -66,7 +66,7 @@ bool APowerupGiver::Use (bool pickup)
{
if (PowerupType == NULL) return true; // item is useless
APowerup *power = static_cast<APowerup *> (Spawn (PowerupType, 0, 0, 0, NO_REPLACE));
APowerup *power = static_cast<APowerup *> (Spawn (PowerupType));
if (EffectTics != 0)
{
@ -415,28 +415,28 @@ void APowerInvulnerable::DoEffect ()
// Don't mess with the translucency settings if an
// invisibility powerup is active.
Owner->RenderStyle = STYLE_Translucent;
if (!(level.time & 7) && Owner->alpha > 0 && Owner->alpha < OPAQUE)
if (!(level.time & 7) && Owner->Alpha > 0 && Owner->Alpha < 1)
{
if (Owner->alpha == HX_SHADOW)
if (Owner->Alpha == HX_SHADOW)
{
Owner->alpha = HX_ALTSHADOW;
Owner->Alpha = HX_ALTSHADOW;
}
else
{
Owner->alpha = 0;
Owner->Alpha = 0;
Owner->flags2 |= MF2_NONSHOOTABLE;
}
}
if (!(level.time & 31))
{
if (Owner->alpha == 0)
if (Owner->Alpha == 0)
{
Owner->flags2 &= ~MF2_NONSHOOTABLE;
Owner->alpha = HX_ALTSHADOW;
Owner->Alpha = HX_ALTSHADOW;
}
else
{
Owner->alpha = HX_SHADOW;
Owner->Alpha = HX_SHADOW;
}
}
}
@ -472,7 +472,7 @@ void APowerInvulnerable::EndEffect ()
// Don't mess with the translucency settings if an
// invisibility powerup is active.
Owner->RenderStyle = STYLE_Normal;
Owner->alpha = OPAQUE;
Owner->Alpha = 1.;
}
}
else if (Mode == NAME_Reflective)
@ -499,8 +499,8 @@ int APowerInvulnerable::AlterWeaponSprite (visstyle_t *vis)
{
if (Mode == NAME_Ghost && !(Owner->flags & MF_SHADOW))
{
fixed_t wp_alpha = MIN<fixed_t>(FRACUNIT/4 + Owner->alpha*3/4, FRACUNIT);
if (wp_alpha != FIXED_MAX) vis->alpha = wp_alpha;
double wp_alpha = MIN<double>(0.25 + Owner->Alpha*0.75, 1.);
vis->alpha = FLOAT2FIXED(wp_alpha);
}
}
return changed;
@ -616,8 +616,10 @@ void APowerInvisibility::DoEffect ()
Super::DoEffect();
// Due to potential interference with other PowerInvisibility items
// the effect has to be refreshed each tic.
fixed_t ts = (Strength/100) * (special1 + 1); if (ts > FRACUNIT) ts = FRACUNIT;
Owner->alpha = clamp<fixed_t>((OPAQUE - ts), 0, OPAQUE);
double ts = FIXED2DBL((Strength/100) * (special1 + 1));
if (ts > 1.) ts = 1.;
Owner->Alpha = clamp((1. - ts), 0., 1.);
switch (Mode)
{
case (NAME_Fuzzy):
@ -645,7 +647,7 @@ void APowerInvisibility::DoEffect ()
break;
default: // Something's wrong
Owner->RenderStyle = STYLE_Normal;
Owner->alpha = OPAQUE;
Owner->Alpha = 1.;
break;
}
}
@ -666,7 +668,7 @@ void APowerInvisibility::EndEffect ()
Owner->flags5 &= ~(flags5 & INVISIBILITY_FLAGS5);
Owner->RenderStyle = STYLE_Normal;
Owner->alpha = OPAQUE;
Owner->Alpha = 1.;
// Check whether there are other invisibility items and refresh their effect.
// If this isn't done there will be one incorrectly drawn frame when this
@ -1180,14 +1182,14 @@ IMPLEMENT_CLASS (APlayerSpeedTrail)
void APlayerSpeedTrail::Tick ()
{
const int fade = OPAQUE*6/10/8;
if (alpha <= fade)
const double fade = .6 / 8;
if (Alpha <= fade)
{
Destroy ();
}
else
{
alpha -= fade;
Alpha -= fade;
}
}

View file

@ -65,7 +65,7 @@ IMPLEMENT_CLASS (DImpactDecal)
DBaseDecal::DBaseDecal ()
: DThinker(STAT_DECAL),
WallNext(0), WallPrev(0), LeftDistance(0), Z(0), ScaleX(FRACUNIT), ScaleY(FRACUNIT), Alpha(FRACUNIT),
WallNext(0), WallPrev(0), LeftDistance(0), Z(0), ScaleX(FRACUNIT), ScaleY(FRACUNIT), Alpha(OPAQUE),
AlphaColor(0), Translation(0), RenderFlags(0)
{
RenderStyle = STYLE_None;
@ -74,7 +74,7 @@ DBaseDecal::DBaseDecal ()
DBaseDecal::DBaseDecal (fixed_t z)
: DThinker(STAT_DECAL),
WallNext(0), WallPrev(0), LeftDistance(0), Z(z), ScaleX(FRACUNIT), ScaleY(FRACUNIT), Alpha(FRACUNIT),
WallNext(0), WallPrev(0), LeftDistance(0), Z(z), ScaleX(FRACUNIT), ScaleY(FRACUNIT), Alpha(OPAQUE),
AlphaColor(0), Translation(0), RenderFlags(0)
{
RenderStyle = STYLE_None;
@ -83,7 +83,7 @@ DBaseDecal::DBaseDecal (fixed_t z)
DBaseDecal::DBaseDecal (int statnum, fixed_t z)
: DThinker(statnum),
WallNext(0), WallPrev(0), LeftDistance(0), Z(z), ScaleX(FRACUNIT), ScaleY(FRACUNIT), Alpha(FRACUNIT),
WallNext(0), WallPrev(0), LeftDistance(0), Z(z), ScaleX(FRACUNIT), ScaleY(FRACUNIT), Alpha(OPAQUE),
AlphaColor(0), Translation(0), RenderFlags(0)
{
RenderStyle = STYLE_None;
@ -93,7 +93,7 @@ DBaseDecal::DBaseDecal (int statnum, fixed_t z)
DBaseDecal::DBaseDecal (const AActor *basis)
: DThinker(STAT_DECAL),
WallNext(0), WallPrev(0), LeftDistance(0), Z(basis->_f_Z()), ScaleX(FLOAT2FIXED(basis->Scale.X)), ScaleY(FLOAT2FIXED(basis->Scale.Y)),
Alpha(basis->alpha), AlphaColor(basis->fillcolor), Translation(basis->Translation), PicNum(basis->picnum),
Alpha(FLOAT2FIXED(basis->Alpha)), AlphaColor(basis->fillcolor), Translation(basis->Translation), PicNum(basis->picnum),
RenderFlags(basis->renderflags), RenderStyle(basis->RenderStyle)
{
}

View file

@ -168,7 +168,6 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
AWeapon *beastweap;
APlayerPawn *mo;
APlayerPawn *pmo;
angle_t angle;
pmo = player->mo;
// [MH]
@ -305,11 +304,10 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
}
}
angle = mo->_f_angle() >> ANGLETOFINESHIFT;
AActor *eflash = NULL;
if (exit_flash != NULL)
{
eflash = Spawn(exit_flash, pmo->Vec3Offset(20*finecosine[angle], 20*finesine[angle], TELEFOGHEIGHT), ALLOW_REPLACE);
eflash = Spawn(exit_flash, pmo->Vec3Angle(20., mo->Angles.Yaw, TELEFOGHEIGHT), ALLOW_REPLACE);
if (eflash) eflash->target = mo;
}
mo->SetupWeaponSlots(); // Use original class's weapon slots.
@ -385,7 +383,7 @@ bool P_MorphMonster (AActor *actor, PClassActor *spawntype, int duration, int st
morphed->tid = actor->tid;
morphed->Angles.Yaw = actor->Angles.Yaw;
morphed->UnmorphedMe = actor;
morphed->alpha = actor->alpha;
morphed->Alpha = actor->Alpha;
morphed->RenderStyle = actor->RenderStyle;
morphed->Score = actor->Score;

View file

@ -204,7 +204,7 @@ AInventory *AAmmo::CreateCopy (AActor *other)
Destroy ();
}
copy = static_cast<AInventory *>(Spawn (type, 0, 0, 0, NO_REPLACE));
copy = static_cast<AInventory *>(Spawn (type));
copy->Amount = amount;
copy->BecomeItem ();
}
@ -747,7 +747,7 @@ AInventory *AInventory::CreateCopy (AActor *other)
Amount = MIN(Amount, MaxAmount);
if (GoAway ())
{
copy = static_cast<AInventory *>(Spawn (GetClass(), 0, 0, 0, NO_REPLACE));
copy = static_cast<AInventory *>(Spawn (GetClass()));
copy->Amount = Amount;
copy->MaxAmount = MaxAmount;
}
@ -1861,7 +1861,7 @@ AInventory *ABackpackItem::CreateCopy (AActor *other)
if (amount < 0) amount = 0;
if (ammo == NULL)
{ // The player did not have the ammo. Add it.
ammo = static_cast<AAmmo *>(Spawn(atype, 0, 0, 0, NO_REPLACE));
ammo = static_cast<AAmmo *>(Spawn(atype));
ammo->Amount = bDepleted ? 0 : amount;
if (ammo->BackpackMaxAmount > ammo->MaxAmount)
{

View file

@ -89,7 +89,7 @@ bool AWeaponPiece::TryPickup (AActor *&toucher)
}
if (!hold)
{
hold=static_cast<AWeaponHolder*>(Spawn(RUNTIME_CLASS(AWeaponHolder), 0, 0, 0, NO_REPLACE));
hold=static_cast<AWeaponHolder*>(Spawn(RUNTIME_CLASS(AWeaponHolder)));
hold->BecomeItem();
hold->AttachToOwner(toucher);
hold->PieceMask=0;
@ -129,7 +129,7 @@ bool AWeaponPiece::TryPickup (AActor *&toucher)
{
if (!toucher->FindInventory (WeaponClass))
{
FullWeapon= static_cast<AWeapon*>(Spawn(WeaponClass, 0, 0, 0, NO_REPLACE));
FullWeapon= static_cast<AWeapon*>(Spawn(WeaponClass));
// The weapon itself should not give more ammo to the player!
FullWeapon->AmmoGive1=0;

View file

@ -387,7 +387,7 @@ AAmmo *AWeapon::AddAmmo (AActor *other, PClassActor *ammotype, int amount)
ammo = static_cast<AAmmo *>(other->FindInventory (ammotype));
if (ammo == NULL)
{
ammo = static_cast<AAmmo *>(Spawn (ammotype, 0, 0, 0, NO_REPLACE));
ammo = static_cast<AAmmo *>(Spawn (ammotype));
ammo->Amount = MIN (amount, ammo->MaxAmount);
ammo->AttachToOwner (other);
}
@ -449,7 +449,7 @@ AWeapon *AWeapon::AddWeapon (PClassWeapon *weapontype)
weap = static_cast<AWeapon *>(Owner->FindInventory (weapontype));
if (weap == NULL)
{
weap = static_cast<AWeapon *>(Spawn (weapontype, 0, 0, 0, NO_REPLACE));
weap = static_cast<AWeapon *>(Spawn (weapontype));
weap->AttachToOwner (Owner);
}
return weap;
@ -749,7 +749,7 @@ bool AWeaponGiver::TryPickup(AActor *&toucher)
{
if (master == NULL)
{
master = weap = static_cast<AWeapon*>(Spawn(di->Name, 0, 0, 0, NO_REPLACE));
master = weap = static_cast<AWeapon*>(Spawn(di->Name));
if (weap != NULL)
{
weap->ItemFlags &= ~IF_ALWAYSPICKUP; // use the flag of this item only.

View file

@ -294,7 +294,7 @@ class SBarInfoMainBlock : public SBarInfoCommandFlowControl
{
public:
SBarInfoMainBlock(SBarInfo *script) : SBarInfoCommandFlowControl(script),
alpha(FRACUNIT), currentAlpha(FRACUNIT), forceScaled(false),
alpha(OPAQUE), currentAlpha(OPAQUE), forceScaled(false),
fullScreenOffsets(false)
{
SetTruth(true, NULL, NULL);
@ -309,7 +309,7 @@ class SBarInfoMainBlock : public SBarInfoCommandFlowControl
{
this->xOffset = xOffset;
this->yOffset = yOffset;
this->currentAlpha = fixed_t((((double) this->alpha / (double) FRACUNIT) * ((double) alpha / (double) FRACUNIT)) * FRACUNIT);
this->currentAlpha = FixedMul(this->alpha, alpha);
SBarInfoCommandFlowControl::Draw(this, statusBar);
}
bool ForceScaled() const { return forceScaled; }
@ -334,7 +334,7 @@ class SBarInfoMainBlock : public SBarInfoCommandFlowControl
}
}
sc.MustGetToken(TK_FloatConst);
alpha = fixed_t(FRACUNIT * sc.Float);
alpha = fixed_t(OPAQUE * sc.Float);
}
SBarInfoCommandFlowControl::Parse(sc, this->fullScreenOffsets);
}
@ -870,11 +870,11 @@ void Popup::tick()
if(moving)
{
if(opened)
alpha = clamp(alpha + speed, 0, FRACUNIT);
alpha = clamp<int>(alpha + speed, 0, OPAQUE);
else
alpha = clamp(alpha - speed2, 0, FRACUNIT);
alpha = clamp<int>(alpha - speed2, 0, OPAQUE);
}
if(alpha == 0 || alpha == FRACUNIT)
if(alpha == 0 || alpha == OPAQUE)
moving = false;
else
moving = true;
@ -912,9 +912,7 @@ int Popup::getYOffset()
int Popup::getAlpha(int maxAlpha)
{
double a = (double) alpha / (double) FRACUNIT;
double b = (double) maxAlpha / (double) FRACUNIT;
return fixed_t((a * b) * FRACUNIT);
return FixedMul(alpha, maxAlpha);
}
int Popup::getXDisplacement()
@ -1458,7 +1456,7 @@ public:
}
if(drawshadow)
{
int salpha = fixed_t(((double) alpha / (double) FRACUNIT) * ((double) HR_SHADOW / (double) FRACUNIT) * FRACUNIT);
fixed_t salpha = fixed_t(alpha *HR_SHADOW);
double srx = rx + (shadowX*xScale);
double sry = ry + (shadowY*yScale);
screen->DrawTexture(character, srx, sry,

View file

@ -77,7 +77,7 @@ struct Popup
bool isDoneMoving();
int getXOffset();
int getYOffset();
int getAlpha(int maxAlpha=FRACUNIT);
int getAlpha(int maxAlpha=OPAQUE);
int getXDisplacement();
int getYDisplacement();
};

View file

@ -48,7 +48,7 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
translatable(false), type(NORMAL_IMAGE), image(-1), maxwidth(-1),
maxheight(-1), spawnScaleX(1.0f), spawnScaleY(1.0f), flags(0),
applyscale(false), offset(static_cast<Offset> (TOP|LEFT)),
texture(NULL), alpha(FRACUNIT)
texture(NULL), alpha(OPAQUE)
{
}
@ -63,9 +63,7 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
int w = maxwidth, h = maxheight;
// We must calculate this per frame in order to prevent glitches with cl_capfps true.
fixed_t frameAlpha = block->Alpha();
if(alpha != FRACUNIT)
frameAlpha = fixed_t(((double) block->Alpha() / (double) FRACUNIT) * ((double) alpha / (double) OPAQUE) * FRACUNIT);
fixed_t frameAlpha = FixedMul(block->Alpha(), alpha);
if(flags & DI_DRAWINBOX)
{
@ -236,7 +234,7 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
SBarInfoCommandFlowControl::Tick(block, statusBar, hudChanged);
texture = NULL;
alpha = FRACUNIT;
alpha = OPAQUE;
if (applyscale)
{
spawnScaleX = spawnScaleY = 1.0f;
@ -284,7 +282,7 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
if (harmor->Slots[armorType] > 0 && harmor->SlotsIncrement[armorType] > 0)
{
//combine the alpha values
alpha = fixed_t(((double) alpha / (double) FRACUNIT) * ((double) MIN<fixed_t> (OPAQUE, Scale(harmor->Slots[armorType], OPAQUE, harmor->SlotsIncrement[armorType])) / (double) OPAQUE) * FRACUNIT);
alpha = FixedMul(alpha, MIN<fixed_t> (OPAQUE, Scale(harmor->Slots[armorType], OPAQUE, harmor->SlotsIncrement[armorType])));
texture = statusBar->Images[image];
}
else
@ -1645,7 +1643,7 @@ class CommandDrawSelectedInventory : public CommandDrawImage, private CommandDra
{
if(itemflash && itemflashFade)
{
fixed_t flashAlpha = fixed_t(((double) block->Alpha() / (double) FRACUNIT) * ((double) itemflashFade / (double) OPAQUE) * FRACUNIT);
fixed_t flashAlpha = FixedMul(block->Alpha(), itemflashFade);
statusBar->DrawGraphic(statusBar->Images[statusBar->invBarOffset + imgCURSOR], imgx-4, imgy+2, block->XOffset(), block->YOffset(), flashAlpha, block->FullScreenOffsets(),
translatable, false, offset);
}
@ -2114,7 +2112,7 @@ class CommandDrawInventoryBar : public SBarInfoCommand
int bgalpha = block->Alpha();
if(translucent)
bgalpha = fixed_t((((double) block->Alpha() / (double) FRACUNIT) * ((double) HX_SHADOW / (double) FRACUNIT)) * FRACUNIT);
bgalpha = fixed_t(block->Alpha() * HX_SHADOW);
AInventory *item;
unsigned int i = 0;

View file

@ -767,7 +767,7 @@ static void DrawInventory(player_t * CPlayer, int x,int y)
if (AltIcon.Exists() && (rover->Icon.isValid() || AltIcon.isValid()) )
{
int trans = rover==CPlayer->mo->InvSel ? FRACUNIT : 0x6666;
int trans = rover==CPlayer->mo->InvSel ? OPAQUE : 0x6666;
DrawImageToBox(TexMan[AltIcon.isValid()? AltIcon : rover->Icon], x, y, 19, 25, trans);
if (rover->Amount>1)
@ -934,7 +934,7 @@ static void DrawTime()
const int width = SmallFont->GetCharWidth('0') * characterCount + 2; // small offset from screen's border
const int height = SmallFont->GetHeight();
DrawHudText(SmallFont, hud_timecolor, timeString, hudwidth - width, height, FRACUNIT);
DrawHudText(SmallFont, hud_timecolor, timeString, hudwidth - width, height, OPAQUE);
}
static bool IsAltHUDTextVisible()
@ -992,7 +992,7 @@ static void DrawLatency()
const int width = SmallFont->GetCharWidth('0') * characterCount + 2; // small offset from screen's border
const int height = SmallFont->GetHeight() * (ST_IsTimeVisible() ? 2 : 1);
DrawHudText(SmallFont, color, tempstr, hudwidth - width, height, FRACUNIT);
DrawHudText(SmallFont, color, tempstr, hudwidth - width, height, OPAQUE);
}
bool ST_IsLatencyVisible()
@ -1083,7 +1083,7 @@ void DrawHUD()
{
seconds = Tics2Seconds(level.totaltime);
mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60);
DrawHudText(SmallFont, hudcolor_ttim, printstr, hudwidth-length, bottom, FRACUNIT);
DrawHudText(SmallFont, hudcolor_ttim, printstr, hudwidth-length, bottom, OPAQUE);
bottom -= fonth;
}
@ -1093,14 +1093,14 @@ void DrawHUD()
{
seconds = Tics2Seconds(level.time);
mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60);
DrawHudText(SmallFont, hudcolor_time, printstr, hudwidth-length, bottom, FRACUNIT);
DrawHudText(SmallFont, hudcolor_time, printstr, hudwidth-length, bottom, OPAQUE);
bottom -= fonth;
}
// Single level time for hubs
seconds= Tics2Seconds(level.maptime);
mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60);
DrawHudText(SmallFont, hudcolor_ltim, printstr, hudwidth-length, bottom, FRACUNIT);
DrawHudText(SmallFont, hudcolor_ltim, printstr, hudwidth-length, bottom, OPAQUE);
}
ST_FormatMapName(mapname);

View file

@ -762,7 +762,7 @@ void DBaseStatusBar::DrINumberOuter (signed int val, int x, int y, bool center,
else if (val == 0)
{
screen->DrawTexture (Images[imgINumbers], x + 1, y + 1,
DTA_FillColor, 0, DTA_Alpha, HR_SHADOW,
DTA_FillColor, 0, DTA_AlphaF, HR_SHADOW,
DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE);
screen->DrawTexture (Images[imgINumbers], x, y,
DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE);
@ -776,7 +776,7 @@ void DBaseStatusBar::DrINumberOuter (signed int val, int x, int y, bool center,
while (val != 0)
{
screen->DrawTexture (Images[imgINumbers + val % 10], x + 1, y + 1,
DTA_FillColor, 0, DTA_Alpha, HR_SHADOW,
DTA_FillColor, 0, DTA_AlphaF, HR_SHADOW,
DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE);
x -= w;
val /= 10;
@ -784,7 +784,7 @@ void DBaseStatusBar::DrINumberOuter (signed int val, int x, int y, bool center,
if (negative)
{
screen->DrawTexture (Images[imgNEGATIVE], x + 1, y + 1,
DTA_FillColor, 0, DTA_Alpha, HR_SHADOW,
DTA_FillColor, 0, DTA_AlphaF, HR_SHADOW,
DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE);
}
@ -839,7 +839,7 @@ void DBaseStatusBar::DrBNumberOuter (signed int val, int x, int y, int size) con
{
screen->DrawTexture (pic, xpos - pic->GetWidth()/2 + 2, y + 2,
DTA_HUDRules, HUD_Normal,
DTA_Alpha, HR_SHADOW,
DTA_AlphaF, HR_SHADOW,
DTA_FillColor, 0,
TAG_DONE);
screen->DrawTexture (pic, xpos - pic->GetWidth()/2, y,
@ -865,7 +865,7 @@ void DBaseStatusBar::DrBNumberOuter (signed int val, int x, int y, int size) con
{
screen->DrawTexture (pic, xpos - pic->GetWidth()/2 + 2, y + 2,
DTA_HUDRules, HUD_Normal,
DTA_Alpha, HR_SHADOW,
DTA_AlphaF, HR_SHADOW,
DTA_FillColor, 0,
TAG_DONE);
}
@ -879,7 +879,7 @@ void DBaseStatusBar::DrBNumberOuter (signed int val, int x, int y, int size) con
{
screen->DrawTexture (pic, xpos - pic->GetWidth()/2 + 2, y + 2,
DTA_HUDRules, HUD_Normal,
DTA_Alpha, HR_SHADOW,
DTA_AlphaF, HR_SHADOW,
DTA_FillColor, 0,
TAG_DONE);
}
@ -941,7 +941,7 @@ void DBaseStatusBar::DrBNumberOuterFont (signed int val, int x, int y, int size)
pic = BigFont->GetChar ('0', &v);
screen->DrawTexture (pic, xpos - v/2 + 2, y + 2,
DTA_HUDRules, HUD_Normal,
DTA_Alpha, HR_SHADOW,
DTA_AlphaF, HR_SHADOW,
DTA_FillColor, 0,
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED),
TAG_DONE);
@ -966,7 +966,7 @@ void DBaseStatusBar::DrBNumberOuterFont (signed int val, int x, int y, int size)
pic = BigFont->GetChar ('0' + val % 10, &v);
screen->DrawTexture (pic, xpos - v/2 + 2, y + 2,
DTA_HUDRules, HUD_Normal,
DTA_Alpha, HR_SHADOW,
DTA_AlphaF, HR_SHADOW,
DTA_FillColor, 0,
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED),
TAG_DONE);
@ -980,7 +980,7 @@ void DBaseStatusBar::DrBNumberOuterFont (signed int val, int x, int y, int size)
{
screen->DrawTexture (pic, xpos - v/2 + 2, y + 2,
DTA_HUDRules, HUD_Normal,
DTA_Alpha, HR_SHADOW,
DTA_AlphaF, HR_SHADOW,
DTA_FillColor, 0,
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED),
TAG_DONE);

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

@ -29,7 +29,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_HideDecepticon)
{
PARAM_ACTION_PROLOGUE;
EV_DoDoor (DDoor::doorClose, NULL, self, 999, 8*FRACUNIT, 0, 0, 0);
EV_DoDoor (DDoor::doorClose, NULL, self, 999, 8., 0, 0, 0);
if (self->target != NULL && self->target->player != NULL)
{
P_NoiseAlert (self->target, self);
@ -95,7 +95,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BeShadowyFoe)
PARAM_ACTION_PROLOGUE;
self->RenderStyle = STYLE_Translucent;
self->alpha = HR_SHADOW;
self->Alpha = HR_SHADOW;
self->flags &= ~MF_FRIENDLY;
return 0;
}

View file

@ -22,7 +22,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectreChunkSmall)
{
PARAM_ACTION_PROLOGUE;
AActor *foo = Spawn("AlienChunkSmall", self->PosPlusZ(10*FRACUNIT), ALLOW_REPLACE);
AActor *foo = Spawn("AlienChunkSmall", self->PosPlusZ(10.), ALLOW_REPLACE);
if (foo != NULL)
{
@ -43,7 +43,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectreChunkLarge)
{
PARAM_ACTION_PROLOGUE;
AActor *foo = Spawn("AlienChunkLarge", self->PosPlusZ(10*FRACUNIT), ALLOW_REPLACE);
AActor *foo = Spawn("AlienChunkLarge", self->PosPlusZ(10.), ALLOW_REPLACE);
if (foo != NULL)
{
@ -67,7 +67,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Spectre3Attack)
if (self->target == NULL)
return 0;
AActor *foo = Spawn("SpectralLightningV2", self->PosPlusZ(32*FRACUNIT), ALLOW_REPLACE);
AActor *foo = Spawn("SpectralLightningV2", self->PosPlusZ(32.), ALLOW_REPLACE);
foo->Vel.Z = -12;
foo->target = self;
@ -114,7 +114,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_AlienSpectreDeath)
switch (self->GetClass()->TypeName)
{
case NAME_AlienSpectre1:
EV_DoFloor (DFloor::floorLowerToLowest, NULL, 999, FRACUNIT, 0, -1, 0, false);
EV_DoFloor (DFloor::floorLowerToLowest, NULL, 999, 1., 0., -1, 0, false);
log = 95;
break;
@ -152,7 +152,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_AlienSpectreDeath)
{ // You wield the power of the complete Sigil.
log = 85;
}
EV_DoDoor (DDoor::doorOpen, NULL, NULL, 222, 8*FRACUNIT, 0, 0, 0);
EV_DoDoor (DDoor::doorOpen, NULL, NULL, 222, 8., 0, 0, 0);
break;
}
@ -188,7 +188,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_AlienSpectreDeath)
{ // Another Sigil piece. Woohoo!
log = 83;
}
EV_DoFloor (DFloor::floorLowerToLowest, NULL, 666, FRACUNIT, 0, -1, 0, false);
EV_DoFloor (DFloor::floorLowerToLowest, NULL, 666, 1., 0., -1, 0, false);
break;
default:

View file

@ -54,7 +54,7 @@ AInventory *ACoin::CreateCopy (AActor *other)
{
return Super::CreateCopy (other);
}
AInventory *copy = Spawn<ACoin> (0,0,0, NO_REPLACE);
AInventory *copy = Spawn<ACoin> ();
copy->Amount = Amount;
copy->BecomeItem ();
GoAwayAndDie ();

View file

@ -13,7 +13,7 @@ static bool CrusaderCheckRange (AActor *self)
{
if (self->reactiontime == 0 && P_CheckSight (self, self->target))
{
return self->AproxDistance (self->target) < 264*FRACUNIT;
return self->Distance2D (self->target) < 264.;
}
return false;
}
@ -29,18 +29,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrusaderChoose)
{
A_FaceTarget (self);
self->Angles.Yaw -= 180./16;
P_SpawnMissileZAimed (self, self->_f_Z() + 40*FRACUNIT, self->target, PClass::FindActor("FastFlameMissile"));
P_SpawnMissileZAimed (self, self->Z() + 40, self->target, PClass::FindActor("FastFlameMissile"));
}
else
{
if (P_CheckMissileRange (self))
{
A_FaceTarget (self);
P_SpawnMissileZAimed (self, self->_f_Z() + 56*FRACUNIT, self->target, PClass::FindActor("CrusaderMissile"));
P_SpawnMissileZAimed (self, self->Z() + 56, self->target, PClass::FindActor("CrusaderMissile"));
self->Angles.Yaw -= 45./32;
P_SpawnMissileZAimed (self, self->_f_Z() + 40*FRACUNIT, self->target, PClass::FindActor("CrusaderMissile"));
P_SpawnMissileZAimed (self, self->Z() + 40, self->target, PClass::FindActor("CrusaderMissile"));
self->Angles.Yaw += 45./16;
P_SpawnMissileZAimed (self, self->_f_Z() + 40*FRACUNIT, self->target, PClass::FindActor("CrusaderMissile"));
P_SpawnMissileZAimed (self, self->Z() + 40, self->target, PClass::FindActor("CrusaderMissile"));
self->Angles.Yaw -= 45./16;
self->reactiontime += 15;
}
@ -54,7 +54,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrusaderSweepLeft)
PARAM_ACTION_PROLOGUE;
self->Angles.Yaw += 90./16;
AActor *misl = P_SpawnMissileZAimed (self, self->_f_Z() + 48*FRACUNIT, self->target, PClass::FindActor("FastFlameMissile"));
AActor *misl = P_SpawnMissileZAimed (self, self->Z() + 48, self->target, PClass::FindActor("FastFlameMissile"));
if (misl != NULL)
{
misl->Vel.Z += 1;
@ -67,7 +67,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrusaderSweepRight)
PARAM_ACTION_PROLOGUE;
self->Angles.Yaw -= 90./16;
AActor *misl = P_SpawnMissileZAimed (self, self->_f_Z() + 48*FRACUNIT, self->target, PClass::FindActor("FastFlameMissile"));
AActor *misl = P_SpawnMissileZAimed (self, self->Z() + 48, self->target, PClass::FindActor("FastFlameMissile"));
if (misl != NULL)
{
misl->Vel.Z += 1;
@ -94,7 +94,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrusaderDeath)
if (CheckBossDeath (self))
{
EV_DoFloor (DFloor::floorLowerToLowest, NULL, 667, FRACUNIT, 0, -1, 0, false);
EV_DoFloor (DFloor::floorLowerToLowest, NULL, 667, 1., 0., -1, 0, false);
}
return 0;
}

View file

@ -27,8 +27,7 @@ void A_SpectralMissile (AActor *self, const char *missilename)
{
if (self->target != NULL)
{
AActor *missile = P_SpawnMissileXYZ (self->PosPlusZ(32*FRACUNIT),
self, self->target, PClass::FindActor(missilename), false);
AActor *missile = P_SpawnMissileXYZ (self->PosPlusZ(32.), self, self->target, PClass::FindActor(missilename), false);
if (missile != NULL)
{
missile->tracer = self->target;
@ -78,7 +77,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnEntity)
{
PARAM_ACTION_PROLOGUE;
AActor *entity = Spawn("EntityBoss", self->PosPlusZ(70*FRACUNIT), ALLOW_REPLACE);
AActor *entity = Spawn("EntityBoss", self->PosPlusZ(70), ALLOW_REPLACE);
if (entity != NULL)
{
entity->Angles.Yaw = self->Angles.Yaw;
@ -94,7 +93,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_EntityDeath)
PARAM_ACTION_PROLOGUE;
AActor *second;
double secondRadius = FIXED2DBL(GetDefaultByName("EntitySecond")->_f_radius() * 2);
double secondRadius = GetDefaultByName("EntitySecond")->radius * 2;
static const double turns[3] = { 0, 90, -90 };
const double velmul[3] = { 4.8828125f, secondRadius*4, secondRadius*4 };

View file

@ -23,7 +23,7 @@ bool InquisitorCheckDistance (AActor *self)
{
if (self->reactiontime == 0 && P_CheckSight (self, self->target))
{
return self->AproxDistance (self->target) < 264*FRACUNIT;
return self->Distance2D (self->target) < 264.;
}
return false;
}
@ -61,20 +61,20 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorAttack)
A_FaceTarget (self);
self->_f_AddZ(32*FRACUNIT);
self->AddZ(32);
self->Angles.Yaw -= 45./32;
proj = P_SpawnMissileZAimed (self, self->_f_Z(), self->target, PClass::FindActor("InquisitorShot"));
proj = P_SpawnMissileZAimed (self, self->Z(), self->target, PClass::FindActor("InquisitorShot"));
if (proj != NULL)
{
proj->Vel.Z += 9;
}
self->Angles.Yaw += 45./16;
proj = P_SpawnMissileZAimed (self, self->_f_Z(), self->target, PClass::FindActor("InquisitorShot"));
proj = P_SpawnMissileZAimed (self, self->Z(), self->target, PClass::FindActor("InquisitorShot"));
if (proj != NULL)
{
proj->Vel.Z += 16;
}
self->_f_AddZ(-32*FRACUNIT);
self->AddZ(-32);
return 0;
}
@ -89,7 +89,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorJump)
return 0;
S_Sound (self, CHAN_ITEM|CHAN_LOOP, "inquisitor/jump", 1, ATTN_NORM);
self->_f_AddZ(64*FRACUNIT);
self->AddZ(64);
A_FaceTarget (self);
speed = self->Speed * (2./3);
self->VelFromAngle(speed);
@ -127,7 +127,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_TossArm)
{
PARAM_ACTION_PROLOGUE;
AActor *foo = Spawn("InquisitorArm", self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE);
AActor *foo = Spawn("InquisitorArm", self->PosPlusZ(24), ALLOW_REPLACE);
foo->Angles.Yaw = self->Angles.Yaw - 90. + pr_inq.Random2() * (360./1024.);
foo->VelFromAngle(foo->Speed / 8);
foo->Vel.Z = pr_inq() / 64.;

View file

@ -37,7 +37,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LoremasterChain)
S_Sound (self, CHAN_BODY, "loremaster/active", 1, ATTN_NORM);
Spawn("LoreShot2", self->Pos(), ALLOW_REPLACE);
Spawn("LoreShot2", self->Vec3Offset(-(self->_f_velx() >> 1), -(self->_f_vely() >> 1), -(self->_f_velz() >> 1)), ALLOW_REPLACE);
Spawn("LoreShot2", self->Vec3Offset(-self->_f_velx(), -self->_f_vely(), -self->_f_velz()), ALLOW_REPLACE);
Spawn("LoreShot2", self->Vec3Offset(-self->Vel/2.), ALLOW_REPLACE);
Spawn("LoreShot2", self->Vec3Offset(-self->Vel), ALLOW_REPLACE);
return 0;
}

View file

@ -130,7 +130,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnProgrammerBase)
{
PARAM_ACTION_PROLOGUE;
AActor *foo = Spawn("ProgrammerBase", self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE);
AActor *foo = Spawn("ProgrammerBase", self->PosPlusZ(24), ALLOW_REPLACE);
if (foo != NULL)
{
foo->Angles.Yaw = self->Angles.Yaw + 180. + pr_prog.Random2() * (360. / 1024.);

View file

@ -78,10 +78,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_Beacon)
AActor *owner = self->target;
AActor *rebel;
angle_t an;
rebel = Spawn("Rebel1", self->PosAtZ(self->floorz), ALLOW_REPLACE);
if (!P_TryMove (rebel, rebel->X(), rebel->Y(), true))
if (!P_TryMove (rebel, rebel->Pos(), true))
{
rebel->Destroy ();
return 0;
@ -116,8 +115,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Beacon)
rebel->SetState (rebel->SeeState);
rebel->Angles.Yaw = self->Angles.Yaw;
an = self->_f_angle() >> ANGLETOFINESHIFT;
Spawn<ATeleportFog> (rebel->Vec3Offset(20*finecosine[an], 20*finesine[an], TELEFOGHEIGHT), ALLOW_REPLACE);
Spawn<ATeleportFog> (rebel->Vec3Angle(20., self->Angles.Yaw, TELEFOGHEIGHT), ALLOW_REPLACE);
if (--self->health < 0)
{
self->SetState(self->FindState(NAME_Death));

View file

@ -53,14 +53,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelAttack)
return 0;
}
missile = P_SpawnMissileZAimed (self, self->_f_Z() + 32*FRACUNIT, self->target, PClass::FindActor("SentinelFX2"));
missile = P_SpawnMissileZAimed (self, self->Z() + 32, self->target, PClass::FindActor("SentinelFX2"));
if (missile != NULL && (missile->Vel.X != 0 || missile->Vel.Y != 0))
{
for (int i = 8; i > 1; --i)
{
trail = Spawn("SentinelFX1",
self->_f_Vec3Angle(missile->_f_radius()*i, missile->_f_angle(), (missile->_f_velz() / 4 * i)), ALLOW_REPLACE);
self->Vec3Angle(missile->radius*i, missile->Angles.Yaw, missile->Vel.Z / 4 * i), ALLOW_REPLACE);
if (trail != NULL)
{
trail->target = self;

View file

@ -28,7 +28,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightningTail)
{
PARAM_ACTION_PROLOGUE;
AActor *foo = Spawn("SpectralLightningHTail", self->Vec3Offset(-self->_f_velx(), -self->_f_vely(), 0), ALLOW_REPLACE);
AActor *foo = Spawn("SpectralLightningHTail", self->Vec3Offset(-self->Vel.X, -self->Vel.Y, 0.), ALLOW_REPLACE);
foo->Angles.Yaw = self->Angles.Yaw;
foo->FriendPlayer = self->FriendPlayer;
@ -66,21 +66,20 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightning)
self->Vel.X += pr_zap5.Random2(3);
self->Vel.Y += pr_zap5.Random2(3);
fixedvec2 pos = self->Vec2Offset(
pr_zap5.Random2(3) * FRACUNIT * 50,
pr_zap5.Random2(3) * FRACUNIT * 50);
double xo = pr_zap5.Random2(3) * 50.;
double yo = pr_zap5.Random2(3) * 50.;
flash = Spawn (self->threshold > 25 ? PClass::FindActor(NAME_SpectralLightningV2) :
PClass::FindActor(NAME_SpectralLightningV1), pos.x, pos.y, ONCEILINGZ, ALLOW_REPLACE);
PClass::FindActor(NAME_SpectralLightningV1), self->Vec2OffsetZ(xo, yo, ONCEILINGZ), ALLOW_REPLACE);
flash->target = self->target;
flash->Vel.Z = -18*FRACUNIT;
flash->Vel.Z = -18;
flash->FriendPlayer = self->FriendPlayer;
flash = Spawn(NAME_SpectralLightningV2, self->_f_X(), self->_f_Y(), ONCEILINGZ, ALLOW_REPLACE);
flash = Spawn(NAME_SpectralLightningV2, self->PosAtZ(ONCEILINGZ), ALLOW_REPLACE);
flash->target = self->target;
flash->Vel.Z = -18 * FRACUNIT;
flash->Vel.Z = -18;
flash->FriendPlayer = self->FriendPlayer;
return 0;
}
@ -94,8 +93,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_Tracer2)
PARAM_ACTION_PROLOGUE;
AActor *dest;
fixed_t dist;
fixed_t slope;
double dist;
double slope;
dest = self->tracer;
@ -123,21 +122,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_Tracer2)
if (!(self->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)))
{
// change slope
dist = self->AproxDistance (dest) / self->_f_speed();
if (dist < 1)
dist = self->DistanceBySpeed (dest, self->Speed);
if (dest->Height >= 56)
{
dist = 1;
}
if (dest->_f_height() >= 56*FRACUNIT)
{
slope = (dest->_f_Z()+40*FRACUNIT - self->_f_Z()) / dist;
slope = (dest->Z()+40 - self->Z()) / dist;
}
else
{
slope = (dest->_f_Z() + self->_f_height()*2/3 - self->_f_Z()) / dist;
slope = (dest->Z() + self->Height*(2./3) - self->Z()) / dist;
}
if (slope < self->_f_velz())
if (slope < self->Vel.Z)
{
self->Vel.Z -= 1 / 8.;
}

View file

@ -82,7 +82,7 @@ bool AHealthTraining::TryPickup (AActor *&toucher)
if (Super::TryPickup (toucher))
{
toucher->GiveInventoryType (PClass::FindActor("GunTraining"));
AInventory *coin = Spawn<ACoin> (0,0,0, NO_REPLACE);
AInventory *coin = Spawn<ACoin> ();
if (coin != NULL)
{
coin->Amount = toucher->player->mo->accuracy*5 + 300;
@ -135,7 +135,7 @@ IMPLEMENT_CLASS (APrisonPass)
bool APrisonPass::TryPickup (AActor *&toucher)
{
Super::TryPickup (toucher);
EV_DoDoor (DDoor::doorOpen, NULL, toucher, 223, 2*FRACUNIT, 0, 0, 0);
EV_DoDoor (DDoor::doorOpen, NULL, toucher, 223, 2., 0, 0, 0);
toucher->GiveInventoryType (QuestItemClasses[9]);
return true;
}
@ -152,7 +152,7 @@ bool APrisonPass::TryPickup (AActor *&toucher)
bool APrisonPass::SpecialDropAction (AActor *dropper)
{
EV_DoDoor (DDoor::doorOpen, NULL, dropper, 223, 2*FRACUNIT, 0, 0, 0);
EV_DoDoor (DDoor::doorOpen, NULL, dropper, 223, 2., 0, 0, 0);
Destroy ();
return true;
}
@ -210,7 +210,7 @@ IMPLEMENT_CLASS (AOpenDoor222)
bool AOpenDoor222::TryPickup (AActor *&toucher)
{
EV_DoDoor (DDoor::doorOpen, NULL, toucher, 222, 2*FRACUNIT, 0, 0, 0);
EV_DoDoor (DDoor::doorOpen, NULL, toucher, 222, 2., 0, 0, 0);
GoAwayAndDie ();
return true;
}
@ -229,14 +229,14 @@ IMPLEMENT_CLASS (ACloseDoor222)
bool ACloseDoor222::TryPickup (AActor *&toucher)
{
EV_DoDoor (DDoor::doorClose, NULL, toucher, 222, 2*FRACUNIT, 0, 0, 0);
EV_DoDoor (DDoor::doorClose, NULL, toucher, 222, 2., 0, 0, 0);
GoAwayAndDie ();
return true;
}
bool ACloseDoor222::SpecialDropAction (AActor *dropper)
{
EV_DoDoor (DDoor::doorClose, NULL, dropper, 222, 2*FRACUNIT, 0, 0, 0);
EV_DoDoor (DDoor::doorClose, NULL, dropper, 222, 2., 0, 0, 0);
if (dropper->target->CheckLocalView (consoleplayer))
{
Printf ("You're dead! You set off the alarm.\n");
@ -260,14 +260,14 @@ IMPLEMENT_CLASS (AOpenDoor224)
bool AOpenDoor224::TryPickup (AActor *&toucher)
{
EV_DoDoor (DDoor::doorOpen, NULL, toucher, 224, 2*FRACUNIT, 0, 0, 0);
EV_DoDoor (DDoor::doorOpen, NULL, toucher, 224, 2., 0, 0, 0);
GoAwayAndDie ();
return true;
}
bool AOpenDoor224::SpecialDropAction (AActor *dropper)
{
EV_DoDoor (DDoor::doorOpen, NULL, dropper, 224, 2*FRACUNIT, 0, 0, 0);
EV_DoDoor (DDoor::doorOpen, NULL, dropper, 224, 2., 0, 0, 0);
Destroy ();
return true;
}

View file

@ -58,354 +58,6 @@
// angle += pr_spawnmissile.Random2() << 22
// Note that these numbers are different from those used by all the other Doom engine games.
/* These mobjinfos have been converted:
0 ForceFieldGuard
1 StrifePlayer
2 WeaponSmith
3 BarKeep
4 Armorer
5 Medic
6 Peasant1
7 Peasant2
8 Peasant3
9 Peasant4
10 Peasant5
11 Peasant6
12 Peasant7
13 Peasant8
14 Peasant9
15 Peasant10
16 Peasant11
17 Peasant12
18 Peasant13
19 Peasant14
20 Peasant15
21 Peasant16
22 Peasant17
23 Peasant18
24 Peasant19
25 Peasant20
26 Peasant21
27 Peasant22
28 Zombie
29 AcolyteToBe
30 ZombieSpawner
31 Tank1
32 Tank2
33 Tank3
34 Tank4
35 Tank5
36 Tank6
37 KneelingGuy
38 Beggar1
39 Beggar2
40 Beggar3
41 Beggar4
42 Beggar5
43 Rebel1
44 Rebel2
45 Rebel3
46 Rebel4
47 Rebel5
48 Rebel6
49 Macil1
50 Macil2
51 RocketTrail
52 Reaver
53 AcolyteTan
54 AcolyteRed
55 AcolyteRust
56 AcolyteGray
57 AcolyteDGreen
58 AcolyteGold
59 AcolyteLGreen
60 AcolyteBlue
61 AcolyteShadow
62 Templar
63 Crusader
64 StrifeBishop
65 Oracle
66 Loremaster (aka Priest)
67 AlienSpectre1
68 AlienChunkSmall
69 AlienChunkLarge
70 AlienSpectre2
71 AlienSpectre3
72 AlienSpectre4
73 AlienSpectre5
74 EntityBoss
75 EntitySecond
76 EntityNest
77 EntityPod
78 SpectralLightningH1
79 SpectralLightningH2
80 SpectralLightningBall1
81 SpectralLightningBall2
82 SpectralLightningH3
83 SpectralLightningHTail
84 SpectralLightningBigBall1
85 SpectralLightningBigBall2
86 SpectralLightningV1
87 SpectralLightningV2
88 SpectralLightningSpot
89 SpectralLightningBigV1
90 SpectralLightningBigV2
91 Sentinel
92 Stalker
93 Inquisitor
94 InquisitorArm
95 Programmer
96 ProgrammerBase
97 LoreShot
98 LoreShot2
99 MiniMissile
100 CrusaderMissile
101 BishopMissile
102 ElectricBolt
103 PoisonBolt
104 SentinelFX1
105 SentinelFX2
106 HEGrenade
107 PhosphorousGrenade
108 InquisitorShot
109 PhosphorousFire
110 MaulerTorpedo
111 MaulerTorpedoWave
112 FlameMissile
113 FastFlameMissile
114 MaulerPuff
115 StrifePuff
116 StrifeSpark
117 Blood
118 TeleportFog
119 ItemFog
120 teleport destination
121 KlaxonWarningLight
122 CeilingTurret
123 Piston
124 Computer
125 MedPatch
126 MedicalKit
127 SurgeryKit
128 DegninOre
129 MetalArmor
130 LeatherArmor
131 WaterBottle
132 Mug
133 BaseKey
134 GovsKey
135 Passcard
136 IDBadge
137 PrisonKey
138 SeveredHand
139 Power1Key
140 Power2Key
141 Power3Key
142 GoldKey
143 IDCard
144 SilverKey
145 OracleKey
146 MilitaryID
147 OrderKey
148 WarehouseKey
149 BrassKey
150 RedCrystalKey
151 BlueCrystalKey
152 ChapelKey
153 CatacombKey
154 SecurityKey
155 CoreKey
156 MaulerKey
157 FactoryKey
158 MineKey
159 NewKey5
160 ShadowArmor
161 EnvironmentalSuit
162 GuardUniform
163 OfficersUniform
164 StrifeMap
165 Scanner
166
167 Targeter
168 Coin
169 Gold10
170 Gold25
171 Gold50
172 Gold300
173 BeldinsRing
174 OfferingChalice
175 Ear
176 Communicator
177 HEGrenadeRounds
178 PhosphorusGrenadeRounds
179 ClipOfBullets
180 BoxOfBullets
181 MiniMissiles
182 CrateOfMissiles
183 EnergyPod
184 EnergyPack
185 PoisonBolts
186 ElectricBolts
187 AmmoSatchel
188 AssaultGun
189 AssaultGunStanding
190 FlameThrower
191 FlameThrowerParts
192 MiniMissileLauncher
193 Mauler
194 StrifeCrossbow
195 StrifeGrenadeLauncher
196 Sigil1
197 Sigil2
198 Sigil3
199 Sigil4
200 Sigil5
201 PowerCrystal
202 RatBuddy
203 WoodenBarrel
204 ExplosiveBarrel2
205 TargetPractice
206 LightSilverFluorescent
207 LightBrownFluorescent
208 LightGoldFluorescent
209 LightGlobe
210 PillarTechno
211 PillarAztec
212 PillarAztecDamaged
213 PillarAztecRuined
214 PillarHugeTech
215 PillarAlienPower
216 SStalactiteBig
217 SStalactiteSmall
218 SStalagmiteBig
219 CavePillarTop
220 CavePillarBottom
221 SStalagmiteSmall
222 Candle
223 StrifeCandelabra
224 WaterDropOnFloor
225 WaterfallSplash
226 WaterDrip
227 WaterFountain
228 HeartsInTank
229 TeleportSwirl
230 DeadCrusader
231 DeadStrifePlayer
232 DeadPeasant
233 DeadAcolyte
234 DeadReaver
235 DeadRebel
236 SacrificedGuy
237 PileOfGuts
238 StrifeBurningBarrel
239 BurningBowl
240 BurningBrazier
241 SmallTorchLit
242 SmallTorchUnlit
243 CeilingChain
244 CageLight
245 Statue
246 StatueRuined
247 MediumTorch
248 OutsideLamp
249 PoleLantern
250 SRock1
251 SRock2
252 SRock3
253 SRock4
254 StickInWater
255 Rubble1
256 Rubble2
257 Rubble3
258 Rubble4
259 Rubble5
260 Rubble6
261 Rubble7
262 Rubble8
263 SurgeryCrab
264 LargeTorch
265 HugeTorch
266 PalmTree
267 BigTree2
268 PottedTree
269 TreeStub
270 ShortBush
271 TallBush
272 ChimneyStack
273 BarricadeColumn
274 Pot
275 Pitcher
276 Stool
277 MetalPot
278 Tub
279 Anvil
280 TechLampSilver
281 TechLampBrass
282 Tray
283 AmmoFiller
284 SigilBanner
285 RebelBoots
286 RebelHelmet
287 RebelShirt
288 PowerCoupling
289 BrokenPowerCoupling
290 AlienBubbleColumn
291 AlienFloorBubble
292 AlienCeilingBubble
293 AlienAspClimber
294 AlienSpiderLight
295 Meat
296 Junk
297 FireDroplet
298 AmmoFillup
299 HealthFillup
300 Info
301 RaiseAlarm
302 OpenDoor222
303 CloseDoor222
304 PrisonPass
305 OpenDoor224
306 UpgradeStamina
307 UpgradeAccuracy
308 InterrogatorReport (seems to be unused)
309 HealthTraining
310 GunTraining
311 OraclePass
312 QuestItem1
313 QuestItem2
314 QuestItem3
315 QuestItem4
316 QuestItem5
317 QuestItem6
318 QuestItem7
319 QuestItem8
320 QuestItem9
321 QuestItem10
322 QuestItem11
323 QuestItem12
324 QuestItem13
325 QuestItem14
326 QuestItem15
327 QuestItem16
328 QuestItem17
329 QuestItem18
330 QuestItem19
331 QuestItem20
332 QuestItem21
333 QuestItem22
334 QuestItem23
335 QuestItem24
336 QuestItem25
337 QuestItem26
338 QuestItem27
339 QuestItem28
340 QuestItem29
341 QuestItem30
342 QuestItem31
343 SlideshowStarter
*/
static FRandom pr_gibtosser ("GibTosser");
// Force Field Guard --------------------------------------------------------
@ -438,7 +90,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SetShadow)
self->flags |= MF_STRIFEx8000000|MF_SHADOW;
self->RenderStyle = STYLE_Translucent;
self->alpha = HR_SHADOW;
self->Alpha = HR_SHADOW;
return 0;
}
@ -448,7 +100,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ClearShadow)
self->flags &= ~(MF_STRIFEx8000000|MF_SHADOW);
self->RenderStyle = STYLE_Normal;
self->alpha = OPAQUE;
self->Alpha = 1.;
return 0;
}
@ -564,8 +216,8 @@ void APowerCoupling::Die (AActor *source, AActor *inflictor, int dmgflags)
{
P_NoiseAlert (source, this);
}
EV_DoDoor (DDoor::doorClose, NULL, players[i].mo, 225, 2*FRACUNIT, 0, 0, 0);
EV_DoFloor (DFloor::floorLowerToHighest, NULL, 44, FRACUNIT, 0, -1, 0, false);
EV_DoDoor (DDoor::doorClose, NULL, players[i].mo, 225, 2., 0, 0, 0);
EV_DoFloor (DFloor::floorLowerToHighest, NULL, 44, 1., 0., -1, 0, false);
players[i].mo->GiveInventoryType (QuestItemClasses[5]);
S_Sound (CHAN_VOICE, "svox/voc13", 1, ATTN_NORM);
players[i].SetLogNumber (13);
@ -599,7 +251,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_TossGib)
PARAM_ACTION_PROLOGUE;
const char *gibtype = (self->flags & MF_NOBLOOD) ? "Junk" : "Meat";
AActor *gib = Spawn (gibtype, self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE);
AActor *gib = Spawn (gibtype, self->PosPlusZ(24), ALLOW_REPLACE);
if (gib == NULL)
{
@ -654,7 +306,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CheckTerrain)
sector_t *sec = self->Sector;
if (self->_f_Z() == sec->floorplane.ZatPoint(self) && sec->PortalBlocksMovement(sector_t::floor))
if (self->Z() == sec->floorplane.ZatPointF(self) && sec->PortalBlocksMovement(sector_t::floor))
{
if (sec->special == Damage_InstantDeath)
{
@ -714,8 +366,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_DropFire)
{
PARAM_ACTION_PROLOGUE;
AActor *drop = Spawn("FireDroplet", self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE);
drop->Vel.Z = -FRACUNIT;
AActor *drop = Spawn("FireDroplet", self->PosPlusZ(24.), ALLOW_REPLACE);
drop->Vel.Z = -1.;
P_RadiusAttack (self, self, 64, 64, NAME_Fire, 0);
return 0;
}

View file

@ -147,7 +147,7 @@ enum
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_AlertMonsters)
{
PARAM_ACTION_PROLOGUE;
PARAM_FIXED_OPT(maxdist) { maxdist = 0; }
PARAM_FLOAT_OPT(maxdist) { maxdist = 0; }
PARAM_INT_OPT(Flags) { Flags = 0; }
AActor * target = NULL;
@ -379,8 +379,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_RocketInFlight)
AActor *trail;
S_Sound (self, CHAN_VOICE, "misc/missileinflight", 1, ATTN_NORM);
P_SpawnPuff (self, PClass::FindActor("MiniMissilePuff"), self->_f_Pos(), self->_f_angle() - ANGLE_180, 2, PF_HITTHING);
trail = Spawn("RocketTrail", self->Vec3Offset(-self->_f_velx(), -self->_f_vely(), 0), ALLOW_REPLACE);
P_SpawnPuff (self, PClass::FindActor("MiniMissilePuff"), self->Pos(), self->Angles.Yaw - 180, self->Angles.Yaw - 180, 2, PF_HITTHING);
trail = Spawn("RocketTrail", self->Vec3Offset(-self->Vel.X, -self->Vel.Y, 0.), ALLOW_REPLACE);
if (trail != NULL)
{
trail->Vel.Z = 1;
@ -547,11 +547,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaulerTorpedoWave)
PARAM_ACTION_PROLOGUE;
AActor *wavedef = GetDefaultByName("MaulerTorpedoWave");
fixed_t savedz;
double savedz;
self->Angles.Yaw += 180.;
// If the torpedo hit the ceiling, it should still spawn the wave
savedz = self->_f_Z();
savedz = self->Z();
if (wavedef && self->ceilingz < wavedef->Top())
{
self->SetZ(self->ceilingz - wavedef->Height);
@ -562,13 +562,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaulerTorpedoWave)
self->Angles.Yaw += 4.5;
P_SpawnSubMissile (self, PClass::FindActor("MaulerTorpedoWave"), self->target);
}
self->_f_SetZ(savedz);
self->SetZ(savedz);
return 0;
}
AActor *P_SpawnSubMissile (AActor *source, PClassActor *type, AActor *target)
{
AActor *other = Spawn (type, source->_f_Pos(), ALLOW_REPLACE);
AActor *other = Spawn (type, source->Pos(), ALLOW_REPLACE);
if (other == NULL)
{
@ -594,7 +594,7 @@ AActor *P_SpawnSubMissile (AActor *source, PClassActor *type, AActor *target)
if (P_CheckMissileSpawn (other, source->radius))
{
DAngle pitch = P_AimLineAttack (source, source->Angles.Yaw, 1024.);
other->Vel.Z = -other->Speed * pitch.Cos();
other->Vel.Z = -other->Speed * pitch.Sin();
return other;
}
return NULL;
@ -639,7 +639,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Burnination)
if (!(self->flags & MF_DROPPED))
{
// Original x and y offsets seemed to be like this:
// x + (((pr_phburn() + 12) & 31) << FRACBITS);
// x + (((pr_phburn() + 12) & 31) << F.RACBITS);
//
// But that creates a lop-sided burn because it won't use negative offsets.
int xofs, xrand = pr_phburn();
@ -658,19 +658,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_Burnination)
yofs = -yofs;
}
fixedvec2 pos = self->Vec2Offset(xofs << FRACBITS, yofs << FRACBITS);
sector_t * sector = P_PointInSector(pos.x, pos.y);
DVector2 pos = self->Vec2Offset((double)xofs, (double)yofs);
sector_t * sector = P_PointInSector(pos);
// The sector's floor is too high so spawn the flame elsewhere.
if (sector->floorplane.ZatPoint(pos.x, pos.y) > self->_f_Z() + self->MaxStepHeight)
if (sector->floorplane.ZatPoint(pos) > self->Z() + self->MaxStepHeight)
{
pos.x = self->_f_X();
pos.y = self->_f_Y();
pos = self->Pos();
}
AActor *drop = Spawn<APhosphorousFire> (
pos.x, pos.y,
self->_f_Z() + 4*FRACUNIT, ALLOW_REPLACE);
AActor *drop = Spawn<APhosphorousFire> (pos.X, pos.Y, self->Z() + 4., ALLOW_REPLACE);
if (drop != NULL)
{
drop->Vel.X = self->Vel.X + pr_phburn.Random2 (7);
@ -693,13 +690,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireGrenade)
{
PARAM_ACTION_PROLOGUE;
PARAM_CLASS(grenadetype, AActor);
PARAM_ANGLE(angleofs);
PARAM_DANGLE(angleofs);
PARAM_STATE(flash)
player_t *player = self->player;
AActor *grenade;
angle_t an;
fixed_t tworadii;
DAngle an;
AWeapon *weapon;
if (player == NULL || grenadetype == NULL)
@ -715,9 +711,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireGrenade)
if (grenadetype != NULL)
{
self->_f_AddZ(32*FRACUNIT);
self->AddZ(32);
grenade = P_SpawnSubMissile (self, grenadetype, self);
self->_f_AddZ(-32*FRACUNIT);
self->AddZ(-32);
if (grenade == NULL)
return 0;
@ -728,20 +724,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireGrenade)
grenade->Vel.Z = (-self->Angles.Pitch.TanClamped()) * grenade->Speed + 8;
fixedvec2 offset;
an = self->_f_angle() >> ANGLETOFINESHIFT;
tworadii = self->_f_radius() + grenade->_f_radius();
offset.x = FixedMul (finecosine[an], tworadii);
offset.y = FixedMul (finesine[an], tworadii);
an = self->_f_angle() + angleofs;
an >>= ANGLETOFINESHIFT;
offset.x += FixedMul (finecosine[an], 15*FRACUNIT);
offset.y += FixedMul (finesine[an], 15*FRACUNIT);
fixedvec2 newpos = grenade->Vec2Offset(offset.x, offset.y);
grenade->SetOrigin(newpos.x, newpos.y, grenade->_f_Z(), false);
DVector2 offset = self->Angles.Yaw.ToVector(self->radius + grenade->radius);
DAngle an = self->Angles.Yaw + angleofs;
offset += an.ToVector(15);
grenade->SetOrigin(grenade->Vec3Offset(offset.X, offset.Y, 0.), false);
}
return 0;
}
@ -814,7 +800,7 @@ bool ASigil::HandlePickup (AInventory *item)
AInventory *ASigil::CreateCopy (AActor *other)
{
ASigil *copy = Spawn<ASigil> (0,0,0, NO_REPLACE);
ASigil *copy = Spawn<ASigil> ();
copy->Amount = Amount;
copy->MaxAmount = MaxAmount;
copy->NumPieces = NumPieces;
@ -995,7 +981,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil1)
}
else
{
spot = Spawn("SpectralLightningSpot", self->_f_Pos(), ALLOW_REPLACE);
spot = Spawn("SpectralLightningSpot", self->Pos(), ALLOW_REPLACE);
if (spot != NULL)
{
spot->VelFromAngle(self->Angles.Yaw, 28.);
@ -1058,7 +1044,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil3)
spot = P_SpawnSubMissile (self, PClass::FindActor("SpectralLightningBall1"), self);
if (spot != NULL)
{
spot->_f_SetZ(self->_f_Z() + 32*FRACUNIT);
spot->SetZ(self->Z() + 32);
}
}
self->Angles.Yaw -= 90.;
@ -1167,7 +1153,7 @@ int ASigil::GiveSigilPiece (AActor *receiver)
sigil = receiver->FindInventory<ASigil> ();
if (sigil == NULL)
{
sigil = static_cast<ASigil*>(Spawn("Sigil1", 0,0,0, NO_REPLACE));
sigil = static_cast<ASigil*>(Spawn("Sigil1"));
if (!sigil->CallTryPickup (receiver))
{
sigil->Destroy ();

View file

@ -18,9 +18,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_Bang4Cloud)
{
PARAM_ACTION_PROLOGUE;
fixed_t xo = (pr_bang4cloud.Random2() & 3) * 10240;
fixed_t yo = (pr_bang4cloud.Random2() & 3) * 10240;
Spawn("Bang4Cloud", self->Vec3Offset(xo, yo, 0), ALLOW_REPLACE);
double xo = (pr_bang4cloud.Random2() & 3) * (10. / 64);
double yo = (pr_bang4cloud.Random2() & 3) * (10. / 64);
Spawn("Bang4Cloud", self->Vec3Offset(xo, yo, 0.), ALLOW_REPLACE);
return 0;
}
@ -38,7 +38,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveQuestItem)
{
if (playeringame[i])
{
AInventory *item = static_cast<AInventory *>(Spawn (QuestItemClasses[questitem - 1], 0,0,0, NO_REPLACE));
AInventory *item = static_cast<AInventory *>(Spawn (QuestItemClasses[questitem - 1]));
if (!item->CallTryPickup (players[i].mo))
{
item->Destroy ();

View file

@ -327,7 +327,7 @@ private:
if (ItemFlash > 0)
{
ItemFlash -= FRACUNIT/14;
ItemFlash -= 1/14.;
if (ItemFlash < 0)
{
ItemFlash = 0;
@ -379,7 +379,7 @@ private:
void FlashItem (const PClass *itemtype)
{
ItemFlash = FRACUNIT*3/4;
ItemFlash = 0.75;
}
void DrawMainBar ()
@ -454,7 +454,7 @@ private:
screen->DrawTexture (Images[CursorImage],
42 + 35*i + ST_X, 12 + ST_Y,
DTA_Bottom320x200, Scaled,
DTA_Alpha, FRACUNIT - ItemFlash,
DTA_AlphaF, 1. - ItemFlash,
TAG_DONE);
}
if (item->Icon.isValid())
@ -526,7 +526,7 @@ private:
DTA_HUDRules, HUD_Normal,
DTA_LeftOffset, cursor->GetWidth(),
DTA_TopOffset, cursor->GetHeight(),
DTA_Alpha, ItemFlash,
DTA_AlphaF, ItemFlash,
TAG_DONE);
}
DrINumberOuter (CPlayer->mo->InvSel->Amount, -51, -10, false, 7);
@ -583,7 +583,7 @@ private:
left = screen->GetWidth()/2 - 160*CleanXfac;
top = bottom + height * yscale;
screen->DrawTexture (Images[back], left, top, DTA_CleanNoMove, true, DTA_Alpha, FRACUNIT*3/4, TAG_DONE);
screen->DrawTexture (Images[back], left, top, DTA_CleanNoMove, true, DTA_AlphaF, 0.75, TAG_DONE);
screen->DrawTexture (Images[bars], left, top, DTA_CleanNoMove, true, TAG_DONE);
@ -847,7 +847,7 @@ private:
int CursorImage;
int CurrentPop, PendingPop, PopHeight, PopHeightChange;
int KeyPopPos, KeyPopScroll;
fixed_t ItemFlash;
double ItemFlash;
};
IMPLEMENT_CLASS(DStrifeStatusBar);

View file

@ -133,6 +133,13 @@ const char* GameInfoBorders[] =
gameinfo.key = static_cast<float> (sc.Float); \
}
#define GAMEINFOKEY_DOUBLE(key, variable) \
else if(nextKey.CompareNoCase(variable) == 0) \
{ \
sc.MustGetFloat(); \
gameinfo.key = sc.Float; \
}
#define GAMEINFOKEY_FIXED(key, variable) \
else if(nextKey.CompareNoCase(variable) == 0) \
{ \
@ -310,7 +317,7 @@ void FMapInfoParser::ParseGameInfo()
GAMEINFOKEY_STRING(PauseSign, "pausesign")
GAMEINFOKEY_STRING(quitSound, "quitSound")
GAMEINFOKEY_STRING(BorderFlat, "borderFlat")
GAMEINFOKEY_FIXED(telefogheight, "telefogheight")
GAMEINFOKEY_DOUBLE(telefogheight, "telefogheight")
GAMEINFOKEY_FIXED(gibfactor, "gibfactor")
GAMEINFOKEY_INT(defKickback, "defKickback")
GAMEINFOKEY_STRING(SkyFlatName, "SkyFlatName")

View file

@ -138,7 +138,7 @@ struct gameinfo_t
fixed_t Armor2Percent;
FString quitSound;
gameborder_t Border;
int telefogheight;
double telefogheight;
int defKickback;
FString translator;
DWORD defaultbloodcolor;

View file

@ -627,7 +627,7 @@ void DIntermissionScreenCast::Drawer ()
DTA_DestHeightF, pic->GetScaledHeightDouble() * castscale.Y,
DTA_DestWidthF, pic->GetScaledWidthDouble() * castscale.X,
DTA_RenderStyle, mDefaults->RenderStyle,
DTA_Alpha, mDefaults->alpha,
DTA_AlphaF, mDefaults->Alpha,
DTA_Translation, casttranslation,
TAG_DONE);
}

View file

@ -694,7 +694,7 @@ void cht_Give (player_t *player, const char *name, int amount)
AInventory *ammo = player->mo->FindInventory(atype);
if (ammo == NULL)
{
ammo = static_cast<AInventory *>(Spawn (atype, 0, 0, 0, NO_REPLACE));
ammo = static_cast<AInventory *>(Spawn (atype));
ammo->AttachToOwner (player->mo);
ammo->Amount = ammo->MaxAmount;
}
@ -713,7 +713,7 @@ void cht_Give (player_t *player, const char *name, int amount)
{
if (gameinfo.gametype != GAME_Hexen)
{
ABasicArmorPickup *armor = Spawn<ABasicArmorPickup> (0,0,0, NO_REPLACE);
ABasicArmorPickup *armor = Spawn<ABasicArmorPickup> ();
armor->SaveAmount = 100*deh.BlueAC;
armor->SavePercent = gameinfo.Armor2Percent > 0? gameinfo.Armor2Percent : FRACUNIT/2;
if (!armor->CallTryPickup (player->mo))
@ -725,7 +725,7 @@ void cht_Give (player_t *player, const char *name, int amount)
{
for (i = 0; i < 4; ++i)
{
AHexenArmor *armor = Spawn<AHexenArmor> (0,0,0, NO_REPLACE);
AHexenArmor *armor = Spawn<AHexenArmor> ();
armor->health = i;
armor->Amount = 0;
if (!armor->CallTryPickup (player->mo))
@ -748,7 +748,7 @@ void cht_Give (player_t *player, const char *name, int amount)
AKey *key = (AKey *)GetDefaultByType (PClassActor::AllActorClasses[i]);
if (key->KeyNumber != 0)
{
key = static_cast<AKey *>(Spawn(static_cast<PClassActor *>(PClassActor::AllActorClasses[i]), 0,0,0, NO_REPLACE));
key = static_cast<AKey *>(Spawn(static_cast<PClassActor *>(PClassActor::AllActorClasses[i])));
if (!key->CallTryPickup (player->mo))
{
key->Destroy ();
@ -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

@ -680,12 +680,12 @@ void M_Ticker (void)
}
if (BackbuttonTime > 0)
{
if (BackbuttonAlpha < FRACUNIT) BackbuttonAlpha += FRACUNIT/10;
if (BackbuttonAlpha < OPAQUE) BackbuttonAlpha += OPAQUE/10;
BackbuttonTime--;
}
else
{
if (BackbuttonAlpha > 0) BackbuttonAlpha -= FRACUNIT/10;
if (BackbuttonAlpha > 0) BackbuttonAlpha -= OPAQUE/10;
if (BackbuttonAlpha < 0) BackbuttonAlpha = 0;
}
}

View file

@ -191,7 +191,7 @@ static void P_Add3DFloor(sector_t* sec, sector_t* sec2, line_t* master, int flag
// The engine cannot handle sloped translucent floors. Sorry
if (ffloor->top.plane->a || ffloor->top.plane->b || ffloor->bottom.plane->a || ffloor->bottom.plane->b)
{
ffloor->alpha = FRACUNIT;
ffloor->alpha = OPAQUE;
ffloor->flags &= ~FF_ADDITIVETRANS;
}
@ -813,7 +813,7 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li
highestfloorsec = j == 0 ? linedef->frontsector : linedef->backsector;
highestfloorplanes[j] = rover->top.plane;
}
if(ff_top > lowestfloor[j] && ff_top <= thing->_f_Z() + thing->MaxStepHeight) lowestfloor[j] = ff_top;
if(ff_top > lowestfloor[j] && ff_top <= thing->_f_Z() + thing->_f_MaxStepHeight()) lowestfloor[j] = ff_top;
}
}

View file

@ -299,7 +299,7 @@ bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, FLineOpening &
}
// returns true if it touches the midtexture
return (abs(thing->_f_Z() - tt) <= thing->MaxStepHeight);
return (abs(thing->_f_Z() - tt) <= thing->_f_MaxStepHeight());
}
}
return false;

View file

@ -1150,7 +1150,7 @@ static void DoGiveInv (AActor *actor, PClassActor *info, int amount)
? actor->player->PendingWeapon : NULL;
bool hadweap = actor->player != NULL ? actor->player->ReadyWeapon != NULL : true;
AInventory *item = static_cast<AInventory *>(Spawn (info, 0,0,0, NO_REPLACE));
AInventory *item = static_cast<AInventory *>(Spawn (info));
// This shouldn't count for the item statistics!
item->ClearCounters();
@ -3843,7 +3843,7 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
break;
case APROP_Alpha:
actor->alpha = value;
actor->Alpha = ACSToDouble(value);
break;
case APROP_RenderStyle:
@ -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,9 +4037,9 @@ 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 actor->alpha;
case APROP_Alpha: return DoubleToACS(actor->Alpha);
case APROP_RenderStyle: for (int style = STYLE_None; style < STYLE_Count; ++style)
{ // Check for a legacy render style that matches.
if (LegacyRenderStyles[style] == actor->RenderStyle)
@ -4214,7 +4214,7 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b
if (floor)
{
actor->Sector->NextLowestFloorAt(actor->_f_X(), actor->_f_Y(), actor->_f_Z(), 0, actor->MaxStepHeight, &resultsec, &resffloor);
actor->Sector->NextLowestFloorAt(actor->_f_X(), actor->_f_Y(), actor->_f_Z(), 0, actor->_f_MaxStepHeight(), &resultsec, &resffloor);
secpic = resffloor ? *resffloor->top.texture : resultsec->planes[sector_t::floor].Texture;
}
else
@ -8000,13 +8000,13 @@ scriptwait:
switch (type & 0xFF)
{
default: // normal
alpha = (optstart < sp) ? Stack[optstart] : FRACUNIT;
alpha = (optstart < sp) ? Stack[optstart] : OPAQUE;
msg = new DHUDMessage (activefont, work, x, y, hudwidth, hudheight, color, holdTime);
break;
case 1: // fade out
{
float fadeTime = (optstart < sp) ? ACSToFloat(Stack[optstart]) : 0.5f;
alpha = (optstart < sp-1) ? Stack[optstart+1] : FRACUNIT;
alpha = (optstart < sp-1) ? Stack[optstart+1] : OPAQUE;
msg = new DHUDMessageFadeOut (activefont, work, x, y, hudwidth, hudheight, color, holdTime, fadeTime);
}
break;
@ -8022,7 +8022,7 @@ scriptwait:
{
float inTime = (optstart < sp) ? ACSToFloat(Stack[optstart]) : 0.5f;
float outTime = (optstart < sp-1) ? ACSToFloat(Stack[optstart+1]) : 0.5f;
alpha = (optstart < sp-2) ? Stack[optstart+2] : FRACUNIT;
alpha = (optstart < sp-2) ? Stack[optstart+2] : OPAQUE;
msg = new DHUDMessageFadeInOut (activefont, work, x, y, hudwidth, hudheight, color, holdTime, inTime, outTime);
}
break;

View file

@ -595,11 +595,11 @@ static void LoadWalls (walltype *walls, int numwalls, sectortype *bsec)
{
if (walls[i].cstat & 512)
{
lines[j].Alpha = FRACUNIT/3;
lines[j].Alpha = TRANSLUC33;
}
else
{
lines[j].Alpha = FRACUNIT*2/3;
lines[j].Alpha = TRANSLUC66;
}
}
if (walls[i].cstat & 1)
@ -707,7 +707,7 @@ static int LoadSprites (spritetype *sprites, Xsprite *xsprites, int numsprites,
mapthings[count].special = 0;
mapthings[count].Gravity = 1.;
mapthings[count].RenderStyle = STYLE_Count;
mapthings[count].alpha = -1;
mapthings[count].Alpha = -1;
mapthings[count].health = -1;
mapthings[count].FloatbobPhase = -1;
@ -890,7 +890,7 @@ void ACustomSprite::BeginPlay ()
if (cstat & 2)
{
RenderStyle = STYLE_Translucent;
alpha = (cstat & 512) ? TRANSLUC66 : TRANSLUC33;
Alpha = (cstat & 512) ? 0.6666 : 0.3333;
}
if (cstat & 4)
renderflags |= RF_XFLIP;

View file

@ -989,10 +989,10 @@ public:
mysnprintf (goldstr, countof(goldstr), "%d", coin != NULL ? coin->Amount : 0);
screen->DrawText (SmallFont, CR_GRAY, 21, 191, goldstr, DTA_320x200, true,
DTA_FillColor, 0, DTA_Alpha, HR_SHADOW, TAG_DONE);
DTA_FillColor, 0, DTA_AlphaF, HR_SHADOW, TAG_DONE);
screen->DrawTexture (TexMan(((AInventory *)GetDefaultByType (RUNTIME_CLASS(ACoin)))->Icon),
3, 190, DTA_320x200, true,
DTA_FillColor, 0, DTA_Alpha, HR_SHADOW, TAG_DONE);
DTA_FillColor, 0, DTA_AlphaF, HR_SHADOW, TAG_DONE);
screen->DrawText (SmallFont, CR_GRAY, 20, 190, goldstr, DTA_320x200, true, TAG_DONE);
screen->DrawTexture (TexMan(((AInventory *)GetDefaultByType (RUNTIME_CLASS(ACoin)))->Icon),
2, 189, DTA_320x200, true, TAG_DONE);
@ -1268,7 +1268,7 @@ static void HandleReply(player_t *player, bool isconsole, int nodenum, int reply
if (takestuff)
{
AInventory *item = static_cast<AInventory *>(Spawn(reply->GiveType, 0, 0, 0, NO_REPLACE));
AInventory *item = static_cast<AInventory *>(Spawn(reply->GiveType));
// Items given here should not count as items!
item->ClearCounters();
if (item->GetClass()->TypeName == NAME_FlameThrower)

View file

@ -576,7 +576,7 @@ bool P_Move (AActor *actor)
!((actor->flags & MF_NOGRAVITY) || (actor->flags6 & MF6_CANJUMP))
&& actor->Z() > actor->floorz && !(actor->flags2 & MF2_ONMOBJ))
{
if (actor->_f_Z() <= actor->_f_floorz() + actor->MaxStepHeight)
if (actor->Z() <= actor->floorz + actor->MaxStepHeight)
{
double savedz = actor->Z();
actor->SetZ(actor->floorz);
@ -2708,9 +2708,9 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates)
if (corpsehit->Height == 0)
{
// Make raised corpses look ghostly
if (corpsehit->alpha > TRANSLUC50)
if (corpsehit->Alpha > 0.5)
{
corpsehit->alpha /= 2;
corpsehit->Alpha /= 2;
}
// This will only work if the render style is changed as well.
if (corpsehit->RenderStyle == LegacyRenderStyles[STYLE_Normal])

View file

@ -50,6 +50,11 @@ void P_DaggerAlert (AActor *target, AActor *emitter);
void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soundblocks, AActor *emitter=NULL, fixed_t maxdist=0);
bool P_HitFriend (AActor *self);
void P_NoiseAlert (AActor *target, AActor *emmiter, bool splash=false, fixed_t maxdist=0);
inline void P_NoiseAlert(AActor *target, AActor *emmiter, bool splash, double maxdist)
{
P_NoiseAlert(target, emmiter, splash, FLOAT2FIXED(maxdist));
}
bool P_CheckMeleeRange2 (AActor *actor);
bool P_Move (AActor *actor);
bool P_TryWalk (AActor *actor);
@ -57,7 +62,7 @@ void P_NewChaseDir (AActor *actor);
AInventory *P_DropItem (AActor *source, PClassActor *type, int special, int chance);
void P_TossItem (AActor *item);
bool P_LookForPlayers (AActor *actor, INTBOOL allaround, FLookExParams *params);
void A_Weave(AActor *self, int xyspeed, int zspeed, fixed_t xydist, fixed_t zdist);
void A_Weave(AActor *self, int xyspeed, int zspeed, double xydist, double zdist);
void A_Unblock(AActor *self, bool drop);
DECLARE_ACTION(A_Look)

View file

@ -1024,7 +1024,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
// [RH] Andy Baker's Stealth monsters
if (target->flags & MF_STEALTH)
{
target->alpha = OPAQUE;
target->Alpha = 1.;
target->visdir = -1;
}
if (target->flags & MF_SKULLFLY)
@ -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)
@ -1221,7 +1217,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
//Use the original damage to check for telefrag amount. Don't let the now-amplified damagetypes do it.
if (rawdamage < TELEFRAG_DAMAGE || (target->flags7 & MF7_LAXTELEFRAGDMG))
{ // Still allow telefragging :-(
damage = (int)((float)damage * level.teamdamage);
damage = (int)(damage * level.teamdamage);
if (damage < 0)
{
return damage;
@ -1672,7 +1668,7 @@ bool P_PoisonPlayer (player_t *player, AActor *poisoner, AActor *source, int poi
}
if (source != NULL && source->player != player && player->mo->IsTeammate (source))
{
poison = (int)((float)poison * level.teamdamage);
poison = (int)(poison * level.teamdamage);
}
if (poison > 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

@ -3103,7 +3103,7 @@ FUNC(LS_TranslucentLine)
int linenum;
while ((linenum = itr.Next()) >= 0)
{
lines[linenum].Alpha = Scale(clamp(arg1, 0, 255), FRACUNIT, 255);
lines[linenum].Alpha = Scale(clamp(arg1, 0, 255), OPAQUE, 255);
if (arg2 == 0)
{
lines[linenum].flags &= ~ML_ADDTRANS;

View file

@ -124,7 +124,7 @@ void P_PredictionLerpReset();
APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags=0);
int P_FaceMobj (AActor *source, AActor *target, DAngle *delta);
bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax, bool precise = false, bool usecurspeed=false);
bool P_SeekerMissile (AActor *actor, double thresh, double turnMax, bool precise = false, bool usecurspeed=false);
enum EPuffFlags
{
@ -168,6 +168,10 @@ inline AActor *P_SpawnMissileXYZ(const fixedvec3 &pos, AActor *source, AActor *d
{
return P_SpawnMissileXYZ(pos.x, pos.y, pos.z, source, dest, type, checkspawn, owner);
}
inline AActor *P_SpawnMissileXYZ(const DVector3 &pos, AActor *source, AActor *dest, PClassActor *type, bool checkspawn = true, AActor *owner = NULL)
{
return P_SpawnMissileXYZ(FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), FLOAT2FIXED(pos.Z), source, dest, type, checkspawn, owner);
}
AActor *P_SpawnMissileAngle (AActor *source, PClassActor *type, angle_t angle, fixed_t vz);
inline AActor *P_SpawnMissileAngle(AActor *source, PClassActor *type, DAngle angle, double vz)
{
@ -180,13 +184,23 @@ inline AActor *P_SpawnMissileAngleZ(AActor *source, double z, PClassActor *type,
return P_SpawnMissileAngleZ(source, FLOAT2FIXED(z), type, angle.BAMs(), FLOAT2FIXED(vz));
}
AActor *P_SpawnMissileAngleZSpeed (AActor *source, fixed_t z, PClassActor *type, angle_t angle, fixed_t vz, fixed_t speed, AActor *owner=NULL, bool checkspawn = true);
inline AActor *P_SpawnMissileAngleZSpeed(AActor *source, double z, PClassActor *type, DAngle angle, double vz, double speed, AActor *owner = NULL, bool checkspawn = true)
{
return P_SpawnMissileAngleZSpeed(source, FLOAT2FIXED(z), type, angle.BAMs(), FLOAT2FIXED(vz), FLOAT2FIXED(speed), owner, checkspawn);
}
AActor *P_SpawnMissileZAimed (AActor *source, fixed_t z, AActor *dest, PClassActor *type);
inline AActor *P_SpawnMissileZAimed(AActor *source, double z, AActor *dest, PClassActor *type)
{
return P_SpawnMissileZAimed(source, FLOAT2FIXED(z), dest, type);
}
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
@ -283,6 +297,10 @@ inline bool P_TryMove(AActor* thing, double x, double y, int dropoff, const secp
{
return P_TryMove(thing, FLOAT2FIXED(x), FLOAT2FIXED(y), dropoff, onfloor);
}
inline bool P_TryMove(AActor* thing, const DVector2 &pos, int dropoff, const secplane_t * onfloor = NULL)
{
return P_TryMove(thing, FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), dropoff, onfloor);
}
bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y);
void P_ApplyTorque(AActor *mo);
bool P_TeleportMove (AActor* thing, fixed_t x, fixed_t y, fixed_t z, bool telefrag, bool modifyactor = true); // [RH] Added z and telefrag parameters

View file

@ -292,7 +292,7 @@ void P_GetFloorCeilingZ(FCheckPosition &tmf, int flags)
F3DFloor *ffc, *fff;
tmf.ceilingz = FIXED2DBL(sec->NextHighestCeilingAt(tmf.x, tmf.y, tmf.z, tmf.z + tmf.thing->_f_height(), flags, &tmf.ceilingsector, &ffc));
tmf.dropoffz = sec->NextLowestFloorAt(tmf.x, tmf.y, tmf.z, flags, tmf.thing->MaxStepHeight, &tmf.floorsector, &fff);
tmf.dropoffz = sec->NextLowestFloorAt(tmf.x, tmf.y, tmf.z, flags, tmf.thing->_f_MaxStepHeight(), &tmf.floorsector, &fff);
tmf.floorz = FIXED2DBL(tmf.dropoffz);
if (fff)
@ -1224,7 +1224,7 @@ bool PIT_CheckThing(FMultiBlockThingsIterator &it, FMultiBlockThingsIterator::Ch
{
// [RH] Let monsters walk on actors as well as floors
if ((tm.thing->flags3 & MF3_ISMONSTER) &&
topz >= tm._f_floorz() && topz <= tm.thing->_f_Z() + tm.thing->MaxStepHeight)
topz >= tm._f_floorz() && topz <= tm.thing->_f_Z() + tm.thing->_f_MaxStepHeight())
{
// The commented-out if is an attempt to prevent monsters from walking off a
// thing further than they would walk off a ledge. I can't think of an easy
@ -1549,7 +1549,7 @@ bool PIT_CheckThing(FMultiBlockThingsIterator &it, FMultiBlockThingsIterator::Ch
// [RH] The next condition is to compensate for the extra height
// that gets added by P_CheckPosition() so that you cannot pick
// up things that are above your true height.
&& thing->_f_Z() < tm.thing->_f_Top() - tm.thing->MaxStepHeight)
&& thing->Z() < tm.thing->Top() - tm.thing->MaxStepHeight)
{ // Can be picked up by tmthing
P_TouchSpecialThing(thing, tm.thing); // can remove thing
}
@ -1645,7 +1645,7 @@ bool P_CheckPosition(AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bo
thingblocker = NULL;
if (thing->player)
{ // [RH] Fake taller height to catch stepping up into things.
thing->Height = realHeight + FIXED2DBL(thing->MaxStepHeight);
thing->Height = realHeight + thing->MaxStepHeight;
}
tm.stepthing = NULL;
@ -1671,17 +1671,17 @@ bool P_CheckPosition(AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bo
return false;
}
else if (!BlockingMobj->player && !(thing->flags & (MF_FLOAT | MF_MISSILE | MF_SKULLFLY)) &&
BlockingMobj->_f_Top() - thing->_f_Z() <= thing->MaxStepHeight)
BlockingMobj->Top() - thing->Z() <= thing->MaxStepHeight)
{
if (thingblocker == NULL ||
BlockingMobj->_f_Z() > thingblocker->_f_Z())
BlockingMobj->Z() > thingblocker->Z())
{
thingblocker = BlockingMobj;
}
thing->BlockingMobj = NULL;
}
else if (thing->player &&
thing->_f_Top() - BlockingMobj->_f_Z() <= thing->MaxStepHeight)
thing->Top() - BlockingMobj->Z() <= thing->MaxStepHeight)
{
if (thingblocker)
{ // There is something to step up on. Return this thing as
@ -2054,8 +2054,8 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
{
goto pushline;
}
else if (BlockingMobj->_f_Top() - thing->_f_Z() > thing->MaxStepHeight
|| (BlockingMobj->Sector->ceilingplane.ZatPoint(x, y) - (BlockingMobj->_f_Top()) < thing->_f_height())
else if (BlockingMobj->Top() - thing->Z() > thing->MaxStepHeight
|| (BlockingMobj->Sector->ceilingplane._f_ZatPointF(x, y) - (BlockingMobj->Top()) < thing->Height)
|| (tm.ceilingz - (BlockingMobj->Top()) < thing->Height))
{
goto pushline;
@ -2124,7 +2124,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
{ // [RH] Don't let normal missiles climb steps
goto pushline;
}
if (tm._f_floorz() - thing->_f_Z() > thing->MaxStepHeight)
if (tm.floorz - thing->Z() > thing->MaxStepHeight)
{ // too big a step up
goto pushline;
}
@ -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);
@ -2569,7 +2569,7 @@ bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y)
}
if (!(thing->flags & MF_TELEPORT) && !(thing->flags3 & MF3_FLOORHUGGER))
{
if (tm._f_floorz() - newz > thing->MaxStepHeight)
if (tm._f_floorz() - newz > thing->_f_MaxStepHeight())
{ // too big a step up
return false;
}
@ -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);
@ -3034,7 +3034,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov
fixed_t thisplanez = rover->top.plane->ZatPoint(pos);
if (thisplanez>planezhere && thisplanez <= actor->_f_Z() + actor->MaxStepHeight)
if (thisplanez>planezhere && thisplanez <= actor->_f_Z() + actor->_f_MaxStepHeight())
{
copyplane = *rover->top.plane;
if (copyplane.c<0) copyplane.FlipVert();
@ -3052,7 +3052,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov
fixed_t thisplanez = rover->top.plane->ZatPoint(actor);
if (thisplanez>planezhere && thisplanez <= actor->_f_Z() + actor->MaxStepHeight)
if (thisplanez>planezhere && thisplanez <= actor->_f_Z() + actor->_f_MaxStepHeight())
{
copyplane = *rover->top.plane;
if (copyplane.c<0) copyplane.FlipVert();
@ -3107,7 +3107,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov
pos.x += xmove;
pos.y += ymove;
if (sec->floorplane.ZatPoint(pos) >= actor->_f_Z() - actor->MaxStepHeight)
if (sec->floorplane.ZatPoint(pos) >= actor->_f_Z() - actor->_f_MaxStepHeight())
{
dopush = false;
break;
@ -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;
@ -5086,7 +5086,7 @@ bool P_NoWayTraverse(AActor *usething, fixed_t startx, fixed_t starty, fixed_t e
if (ld->flags&(ML_BLOCKING | ML_BLOCKEVERYTHING | ML_BLOCK_PLAYERS)) return true;
P_LineOpening(open, NULL, ld, it.InterceptPoint(in));
if (open.range <= 0 ||
open.bottom > usething->_f_Z() + usething->MaxStepHeight ||
open.bottom > usething->_f_Z() + usething->_f_MaxStepHeight() ||
open.top < usething->_f_Top()) return true;
}
return false;

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);
@ -1106,6 +1106,9 @@ bool FMultiBlockThingsIterator::Next(FMultiBlockThingsIterator::CheckResult *ite
item->thing = thing;
item->position = checkpoint + Displacements.getOffset(basegroup, thing->Sector->PortalGroup);
item->portalflags = portalflags;
// same as above in floating point. This is here so that this stuff can be converted piece by piece.
item->Position = { FIXED2DBL(item->position.x), FIXED2DBL(item->position.y), FIXED2DBL(item->position.z) };
return true;
}
bool onlast = unsigned(index + 1) >= checklist.Size();
@ -1194,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
@ -1244,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;
@ -1355,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;
@ -1937,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,6 +15,14 @@ struct divline_t
fixed_t dy;
};
struct divline_t
{
double x;
double y;
double dx;
double dy;
};
struct intercept_t
{
fixed_t frac; // along trace line
@ -73,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;
}
//==========================================================================
//
@ -94,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;
@ -336,7 +349,8 @@ public:
struct CheckResult
{
AActor *thing;
fixedvec3 position;
fixedvec3 position; // keep these both until the fixed version can be removed.
DVector3 Position;
int portalflags;
};
@ -357,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;
@ -377,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)
{
@ -418,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

@ -238,6 +238,8 @@ void AActor::Serialize(FArchive &arc)
<< __pos.y
<< __pos.z
<< Angles.Yaw
<< Angles.Pitch
<< Angles.Roll
<< frame
<< Scale
<< RenderStyle
@ -249,10 +251,8 @@ void AActor::Serialize(FArchive &arc)
<< LastLookPlayerNumber
<< LastLookActor
<< effects
<< alpha
<< Alpha
<< fillcolor
<< Angles.Pitch // move these up when savegame compatibility is broken!
<< Angles.Roll // For now they have to remain here.
<< Sector
<< floorz
<< ceilingz
@ -898,7 +898,7 @@ AInventory *AActor::GiveInventoryType (PClassActor *type)
if (type != NULL)
{
item = static_cast<AInventory *>(Spawn (type, 0,0,0, NO_REPLACE));
item = static_cast<AInventory *>(Spawn (type));
if (!item->CallTryPickup (this))
{
item->Destroy ();
@ -920,7 +920,7 @@ bool AActor::GiveAmmo (PClassAmmo *type, int amount)
{
if (type != NULL)
{
AInventory *item = static_cast<AInventory *>(Spawn (type, 0, 0, 0, NO_REPLACE));
AInventory *item = static_cast<AInventory *>(Spawn (type));
if (item)
{
item->Amount = amount;
@ -1272,7 +1272,7 @@ bool AActor::Grind(bool items)
if (gib != NULL)
{
gib->RenderStyle = RenderStyle;
gib->alpha = alpha;
gib->Alpha = Alpha;
gib->Height = 0;
gib->radius = 0;
@ -1469,18 +1469,18 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target)
if (addrocketexplosion)
{
mo->RenderStyle = STYLE_Add;
mo->alpha = FRACUNIT;
mo->Alpha = 1.;
}
else
{
mo->RenderStyle = STYLE_Translucent;
mo->alpha = FRACUNIT*2/3;
mo->Alpha = 0.6666;
}
}
else
{
mo->RenderStyle = ERenderStyle(deh.ExplosionStyle);
mo->alpha = deh.ExplosionAlpha;
mo->Alpha = deh.ExplosionAlpha;
}
}
@ -1666,7 +1666,7 @@ bool AActor::CanSeek(AActor *target) const
if ((flags2 & MF2_DONTSEEKINVISIBLE) &&
((target->flags & MF_SHADOW) ||
(target->renderflags & RF_INVISIBLE) ||
!target->RenderStyle.IsVisible(target->alpha)
!target->RenderStyle.IsVisible(target->Alpha)
)
) return false;
return true;
@ -1681,11 +1681,8 @@ bool AActor::CanSeek(AActor *target) const
//
//----------------------------------------------------------------------------
bool P_SeekerMissile (AActor *actor, angle_t _thresh, angle_t _turnMax, bool precise, bool usecurspeed)
bool P_SeekerMissile (AActor *actor, double thresh, double turnMax, bool precise, bool usecurspeed)
{
DAngle thresh = ANGLE2DBL(_thresh);
DAngle turnMax = ANGLE2DBL(_turnMax);
int dir;
DAngle delta;
AActor *target;
@ -1782,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))
{
@ -2704,7 +2701,7 @@ static void PlayerLandedOnThing (AActor *mo, AActor *onmobj)
if (mo->player->mo == mo)
{
mo->player->deltaviewheight = mo->_f_velz() >> 3;
mo->player->deltaviewheight = mo->Vel.Z / 8.;
}
if (mo->player->cheats & CF_PREDICTING)
@ -2829,7 +2826,7 @@ void P_NightmareRespawn (AActor *mobj)
P_SpawnTeleportFog(mobj, mobj->PosPlusZ(TELEFOGHEIGHT), true, true);
// spawn a teleport fog at the new spot
P_SpawnTeleportFog(mobj, x, y, z + TELEFOGHEIGHT, false, true);
P_SpawnTeleportFog(mobj, FIXED2DBL(x), FIXED2DBL(y), FIXED2DBL(z) + TELEFOGHEIGHT, false, true);
// remove the old monster
mobj->Destroy ();
@ -3068,7 +3065,7 @@ bool AActor::Slam (AActor *thing)
return false; // stop moving
}
bool AActor::SpecialBlastHandling (AActor *source, fixed_t strength)
bool AActor::SpecialBlastHandling (AActor *source, double strength)
{
return true;
}
@ -3086,7 +3083,7 @@ bool AActor::AdjustReflectionAngle (AActor *thing, DAngle &angle)
if (thing->flags4&MF4_SHIELDREFLECT)
{
// Shield reflection (from the Centaur)
if (diffangle(angle, thing->Angles.Yaw) > 45)
if (absangle(angle, thing->Angles.Yaw) > 45)
return true; // Let missile explode
if (thing->IsKindOf (RUNTIME_CLASS(AHolySpirit))) // shouldn't this be handled by another flag???
@ -3500,19 +3497,19 @@ void AActor::Tick ()
{
if (visdir > 0)
{
alpha += 0x800;
if (alpha >= OPAQUE)
Alpha += 1/32.;
if (Alpha >= 1.)
{
alpha = OPAQUE;
Alpha = 1.;
visdir = -1;
}
}
else
{
alpha -= 0x800;
if (alpha <= TRANSLUC25)
Alpha -= 1/32.;
if (Alpha <= 0.25)
{
alpha = TRANSLUC25;
Alpha = 0.25;
visdir = 1;
}
}
@ -3523,19 +3520,19 @@ void AActor::Tick ()
RenderStyle.Flags &= ~STYLEF_Alpha1;
if (visdir > 0)
{
alpha += 2*FRACUNIT/TICRATE;
if (alpha > OPAQUE)
Alpha += 2./TICRATE;
if (Alpha > 1.)
{
alpha = OPAQUE;
Alpha = 1.;
visdir = 0;
}
}
else if (visdir < 0)
{
alpha -= 3*FRACUNIT/TICRATE/2;
if (alpha < 0)
Alpha -= 1.5/TICRATE;
if (Alpha < 0)
{
alpha = 0;
Alpha = 0;
visdir = 0;
}
}
@ -3748,7 +3745,7 @@ void AActor::Tick ()
const sector_t *sec = node->m_sector;
if (sec->floorplane.c >= STEEPSLOPE)
{
if (floorplane.ZatPoint (PosRelative(node->m_sector)) >= _f_Z() - MaxStepHeight)
if (floorplane.ZatPoint (PosRelative(node->m_sector)) >= _f_Z() - _f_MaxStepHeight())
{
dopush = false;
break;
@ -3813,12 +3810,12 @@ void AActor::Tick ()
PlayerLandedOnThing (this, onmo);
}
}
if (onmo->_f_Top() - _f_Z() <= MaxStepHeight)
if (onmo->Top() - Z() <= MaxStepHeight)
{
if (player && player->mo == this)
{
player->viewheight -= onmo->_f_Top() - _f_Z();
fixed_t deltaview = player->GetDeltaViewHeight();
double deltaview = player->GetDeltaViewHeight();
if (deltaview > player->deltaviewheight)
{
player->deltaviewheight = deltaview;
@ -4380,7 +4377,7 @@ void AActor::HandleSpawnFlags ()
{
flags |= MF_SHADOW;
RenderStyle = STYLE_Translucent;
alpha = TRANSLUC25;
Alpha = 0.25;
}
else if (SpawnFlags & MTF_ALTSHADOW)
{
@ -4637,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;
@ -4661,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);
}
@ -4783,8 +4780,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
if (multiplayer)
{
unsigned an = mobj->_f_angle() >> ANGLETOFINESHIFT;
Spawn ("TeleportFog", mobj->Vec3Offset(20*finecosine[an], 20*finesine[an], TELEFOGHEIGHT), ALLOW_REPLACE);
Spawn ("TeleportFog", mobj->Vec3Angle(20, mobj->Angles.Yaw, TELEFOGHEIGHT), ALLOW_REPLACE);
}
// "Fix" for one of the starts on exec.wad MAP01: If you start inside the ceiling,
@ -5174,8 +5170,8 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
}
// Set various UDMF options
if (mthing->alpha != -1)
mobj->alpha = mthing->alpha;
if (mthing->Alpha >= 0)
mobj->Alpha = mthing->Alpha;
if (mthing->RenderStyle != STYLE_Count)
mobj->RenderStyle = (ERenderStyle)mthing->RenderStyle;
if (mthing->Scale.X != 0)
@ -6139,7 +6135,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)
{
@ -6198,23 +6194,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;
@ -6634,6 +6630,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
@ -6691,7 +6698,7 @@ void PrintMiscActorInfo(AActor *query)
if (query->BounceFlags & 1<<flagi) Printf(" %s", flagnamesb[flagi]);*/
Printf("\nRender style = %i:%s, alpha %f\nRender flags: %x",
querystyle, (querystyle < STYLE_Count ? renderstyles[querystyle] : "Unknown"),
FIXED2DBL(query->alpha), query->renderflags.GetValue());
query->Alpha, query->renderflags.GetValue());
/*for (flagi = 0; flagi < 31; flagi++)
if (query->renderflags & 1<<flagi) Printf(" %s", flagnamesr[flagi]);*/
Printf("\nSpecial+args: %s(%i, %i, %i, %i, %i)\nspecial1: %i, special2: %i.",

View file

@ -1527,8 +1527,8 @@ void P_LoadSectors (MapData *map, FMissingTextureTracker &missingtex)
ss->nextsec = -1; //jff 2/26/98 add fields to support locking out
ss->prevsec = -1; // stair retriggering until build completes
ss->SetAlpha(sector_t::floor, FRACUNIT);
ss->SetAlpha(sector_t::ceiling, FRACUNIT);
ss->SetAlpha(sector_t::floor, OPAQUE);
ss->SetAlpha(sector_t::ceiling, OPAQUE);
ss->SetXScale(sector_t::floor, FRACUNIT); // [RH] floor and ceiling scaling
ss->SetYScale(sector_t::floor, FRACUNIT);
ss->SetXScale(sector_t::ceiling, FRACUNIT);
@ -1760,7 +1760,7 @@ void P_LoadThings (MapData * map)
mti[i].SkillFilter = MakeSkill(flags);
mti[i].ClassFilter = 0xffff; // Doom map format doesn't have class flags so spawn for all player classes
mti[i].RenderStyle = STYLE_Count;
mti[i].alpha = -1;
mti[i].Alpha = -1;
mti[i].health = 1;
mti[i].FloatbobPhase = -1;
@ -1856,7 +1856,7 @@ void P_LoadThings2 (MapData * map)
mti[i].Gravity = 1;
mti[i].RenderStyle = STYLE_Count;
mti[i].alpha = -1;
mti[i].Alpha = -1;
mti[i].health = 1;
mti[i].FloatbobPhase = -1;
}
@ -2055,7 +2055,7 @@ void P_FinishLoadingLineDef(line_t *ld, int alpha)
additive = true;
}
alpha = Scale(alpha, FRACUNIT, 255);
alpha = Scale(alpha, OPAQUE, 255);
if (!ld->args[0])
{
ld->Alpha = alpha;
@ -2172,7 +2172,7 @@ void P_LoadLineDefs (MapData * map)
ld = lines;
for (i = 0; i < numlines; i++, mld++, ld++)
{
ld->Alpha = FRACUNIT; // [RH] Opaque by default
ld->Alpha = OPAQUE; // [RH] Opaque by default
ld->portalindex = UINT_MAX;
// [RH] Translate old linedef special and flags to be
@ -2276,7 +2276,7 @@ void P_LoadLineDefs2 (MapData * map)
ld->v1 = &vertexes[LittleShort(mld->v1)];
ld->v2 = &vertexes[LittleShort(mld->v2)];
ld->Alpha = FRACUNIT; // [RH] Opaque by default
ld->Alpha = OPAQUE; // [RH] Opaque by default
P_SetSideNum (&ld->sidedef[0], LittleShort(mld->sidenum[0]));
P_SetSideNum (&ld->sidedef[1], LittleShort(mld->sidenum[1]));

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 ();
//
@ -849,7 +849,7 @@ sightcounts[0]++;
//
// [RH] Andy Baker's stealth monsters:
// Cannot see an invisible object
if ((flags & SF_IGNOREVISIBILITY) == 0 && ((t2->renderflags & RF_INVISIBLE) || !t2->RenderStyle.IsVisible(t2->alpha)))
if ((flags & SF_IGNOREVISIBILITY) == 0 && ((t2->renderflags & RF_INVISIBLE) || !t2->RenderStyle.IsVisible(t2->Alpha)))
{ // small chance of an attack being made anyway
if ((bglobal.m_Thinking ? pr_botchecksight() : pr_checksight()) > 50)
{

Some files were not shown because too many files have changed in this diff Show more