- handle more of move's special cases with flags and properties.

This commit is contained in:
Christoph Oelckers 2022-12-30 10:21:31 +01:00
parent 2d4eee4153
commit c4c035a527
9 changed files with 110 additions and 118 deletions

View file

@ -22,4 +22,10 @@ xx(aimoffset)
xx(strength) xx(strength)
xx(autoaimangle) xx(autoaimangle)
xx(shootzoffset) xx(shootzoffset)
xx(moveclipdist) xx(moveclipdist)
xx(jumptoplayer_factor)
xx(justjump1_factor)
xx(justjump2_factor)
xx(windang_factor)
xx(floating_floordist)
xx(floating_ceilingdist)

View file

@ -191,6 +191,8 @@ static FFlagDef DukeActorFlagDefs[] =
DEFINE_FLAG(SFLAG3, QUICKALTERANG, DDukeActor, flags3), DEFINE_FLAG(SFLAG3, QUICKALTERANG, DDukeActor, flags3),
DEFINE_FLAG(SFLAG3, SPAWNWEAPONDEBRIS, DDukeActor, flags3), DEFINE_FLAG(SFLAG3, SPAWNWEAPONDEBRIS, DDukeActor, flags3),
DEFINE_FLAG(SFLAG3, NOJIBS, DDukeActor, flags3), DEFINE_FLAG(SFLAG3, NOJIBS, DDukeActor, flags3),
DEFINE_FLAG(SFLAG3, NOVERTICALMOVE, DDukeActor, flags3),
DEFINE_FLAG(SFLAG3, MOVE_NOPLAYERINTERACT, DDukeActor, flags3),
}; };

View file

@ -944,51 +944,30 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
if (actor->vel.X != 0 || actor->vel.Z != 0) if (actor->vel.X != 0 || actor->vel.Z != 0)
{ {
if (a && actor->spr.picnum != DTILE_ROTATEGUN) if (a && !(actor->flags3 & SFLAG3_NOVERTICALMOVE))
{ {
if ((actor->spr.picnum == DTILE_DRONE || actor->spr.picnum == DTILE_COMMANDER) && actor->spr.extra > 0) if ((actor->flags2 & SFLAG2_FLOATING) && actor->spr.extra > 0)
{ {
if (actor->spr.picnum == DTILE_COMMANDER) double fdist = actor->FloatVar(NAME_floating_floordist);
double cdist = actor->FloatVar(NAME_floating_ceilingdist);
double c, f;
calcSlope(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, &c, &f);
actor->floorz = f;
actor->ceilingz = c;
if (actor->spr.pos.Z > f - fdist)
{ {
double c, f; actor->spr.pos.Z = f - fdist;
calcSlope(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, &c, &f); actor->vel.Z = 0;
actor->floorz = f;
actor->ceilingz = c;
if (actor->spr.pos.Z > f - 8)
{
actor->spr.pos.Z = f - 8;
actor->vel.Z = 0;
}
if (actor->spr.pos.Z < c + 80)
{
actor->spr.pos.Z = c + 80;
actor->vel.Z = 0;
}
} }
else
if (actor->spr.pos.Z < c + cdist)
{ {
if (actor->vel.Z > 0) actor->spr.pos.Z = c + cdist;
{ actor->vel.Z = 0;
double f = getflorzofslopeptr(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y);
actor->floorz = f;
if (actor->spr.pos.Z > f - 30)
actor->spr.pos.Z = f - 30;
}
else
{
double c = getceilzofslopeptr(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y);
actor->ceilingz = c;
if (actor->spr.pos.Z < c + 50)
{
actor->spr.pos.Z = c + 50;
actor->vel.Z = 0;
}
}
} }
} }
else if (actor->spr.picnum != DTILE_ORGANTIC) else
{ {
if (actor->vel.Z > 0 && actor->floorz < actor->spr.pos.Z) if (actor->vel.Z > 0 && actor->floorz < actor->spr.pos.Z)
actor->spr.pos.Z = actor->floorz; actor->spr.pos.Z = actor->floorz;
@ -1007,7 +986,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
daxvel = actor->vel.X; daxvel = actor->vel.X;
angdif = actor->spr.Angles.Yaw; angdif = actor->spr.Angles.Yaw;
if (a && actor->spr.picnum != DTILE_ROTATEGUN) if (a && !(actor->flags3 & SFLAG3_MOVE_NOPLAYERINTERACT))
{ {
if (xvel < 960 && actor->spr.scale.X > 0.25 ) if (xvel < 960 && actor->spr.scale.X > 0.25 )
{ {

View file

@ -1035,66 +1035,35 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
actor->spr.Angles.Yaw += angdif; actor->spr.Angles.Yaw += angdif;
} }
if (isRRRA()) if (a & antifaceplayerslow)
{ {
if (a & antifaceplayerslow) if (ps[pnum].newOwner != nullptr)
{ goalang = ((ps[pnum].GetActor()->opos.XY() - actor->spr.pos.XY()).Angle() + DAngle180);
if (ps[pnum].newOwner != nullptr) else goalang = ((ps[pnum].GetActor()->spr.pos.XY() - actor->spr.pos.XY()).Angle() + DAngle180);
goalang = ((ps[pnum].GetActor()->opos.XY() - actor->spr.pos.XY()).Angle() + DAngle180); angdif = DAngle22_5 * 0.25 * Sgn(deltaangle(actor->spr.Angles.Yaw, goalang).Degrees()); // this looks very wrong...
else goalang = ((ps[pnum].GetActor()->spr.pos.XY() - actor->spr.pos.XY()).Angle() + DAngle180); actor->spr.Angles.Yaw += angdif;
angdif = DAngle22_5 * 0.25 * Sgn(deltaangle(actor->spr.Angles.Yaw, goalang).Degrees()); // this looks very wrong...
actor->spr.Angles.Yaw += angdif;
}
if ((a & jumptoplayer) == jumptoplayer)
{
if (actor->spr.picnum == RTILE_CHEER)
{
if (actor->counter < 16)
actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * 1.6;
}
else
{
if (actor->counter < 16)
actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * 2;
}
}
if (a & justjump1)
{
if (actor->spr.picnum == RTILE_RABBIT)
{
if (actor->counter < 8)
actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * 2.133;
}
else if (actor->spr.picnum == RTILE_MAMA)
{
if (actor->counter < 8)
actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * 1.83;
}
}
if (a & justjump2)
{
if (actor->spr.picnum == RTILE_RABBIT)
{
if (actor->counter < 8)
actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * 2.667;
}
else if (actor->spr.picnum == RTILE_MAMA)
{
if (actor->counter < 8)
actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * 2.286;
}
}
if (a & windang)
{
if (actor->counter < 8)
actor->vel.Z -= BobVal(512 + (actor->counter << 4) * 2.667);
}
} }
else if ((a & jumptoplayer) == jumptoplayer)
if ((a & jumptoplayer) == jumptoplayer)
{ {
if (actor->counter < 16) if (actor->counter < 16)
actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * 2; actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * actor->FloatVar(NAME_jumptoplayer_factor);
}
if (a & justjump1)
{
if (actor->counter < 8)
actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * actor->FloatVar(NAME_justjump1_factor);
}
if (a & justjump2)
{
if (actor->counter < 8)
actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * actor->FloatVar(NAME_justjump2_factor);
}
if (a & windang)
{
if (actor->counter < 8)
actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * actor->FloatVar(NAME_windang_factor);
actor->vel.Z -= BobVal(512 + (actor->counter << 4) * 2.667);
} }
@ -1152,36 +1121,39 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
{ {
if (a) if (a)
{ {
if (actor->spr.picnum == RTILE_DRONE && actor->spr.extra > 0) if ((actor->flags2 & SFLAG2_FLOATING) && actor->spr.extra > 0)
{ {
if (actor->vel.Z > 0) double fdist = actor->FloatVar(NAME_floating_floordist);
double cdist = actor->FloatVar(NAME_floating_ceilingdist);
double c, f;
calcSlope(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, &c, &f);
actor->floorz = f;
actor->ceilingz = c;
if (actor->spr.pos.Z > f - fdist)
{ {
double dist = isRRRA() ? 28 : 30; actor->spr.pos.Z = f - fdist;
double f = getflorzofslopeptr(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y); actor->vel.Z = 0;
actor->floorz = f;
if (actor->spr.pos.Z > f - dist)
actor->spr.pos.Z = f - dist;
} }
else
if (actor->spr.pos.Z < c + cdist)
{ {
double c = getceilzofslopeptr(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y); actor->spr.pos.Z = c + cdist;
actor->ceilingz = c; actor->vel.Z = 0;
if (actor->spr.pos.Z < c + 50)
{
actor->spr.pos.Z = c + 50;
actor->vel.Z = 0;
}
} }
} }
if (actor->vel.Z > 0 && actor->floorz < actor->spr.pos.Z) else
actor->spr.pos.Z = actor->floorz;
if (actor->vel.Z < 0)
{ {
double c = getceilzofslopeptr(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y); if (actor->vel.Z > 0 && actor->floorz < actor->spr.pos.Z)
if (actor->spr.pos.Z < c + 66) actor->spr.pos.Z = actor->floorz;
if (actor->vel.Z < 0)
{ {
actor->spr.pos.Z = c + 66; double c = getceilzofslopeptr(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y);
actor->vel.Z *= 0.5; if (actor->spr.pos.Z < c + 66)
{
actor->spr.pos.Z = c + 66;
actor->vel.Z *= 0.5;
}
} }
} }
} }

View file

@ -424,6 +424,8 @@ enum sflags3_t
SFLAG3_QUICKALTERANG = 0x00400000, SFLAG3_QUICKALTERANG = 0x00400000,
SFLAG3_SPAWNWEAPONDEBRIS = 0x00800000, SFLAG3_SPAWNWEAPONDEBRIS = 0x00800000,
SFLAG3_NOJIBS = 0x01000000, SFLAG3_NOJIBS = 0x01000000,
SFLAG3_NOVERTICALMOVE = 0x02000000,
SFLAG3_MOVE_NOPLAYERINTERACT = 0x04000000,
}; };

View file

@ -11,6 +11,8 @@ class DukeCommander : DukeActor
+NORANDOMANGLEWHENBLOCKED; +NORANDOMANGLEWHENBLOCKED;
gutsoffset -24; gutsoffset -24;
falladjustz 0; falladjustz 0;
floating_floordist 8;
floating_ceilingdist 80;
} }
override void PlayFTASound() override void PlayFTASound()

View file

@ -10,6 +10,8 @@ class DukeDrone : DukeActor
+QUICKALTERANG; +QUICKALTERANG;
+NOJIBS; +NOJIBS;
falladjustz 0; falladjustz 0;
floating_floordist 30;
floating_ceilingdist 50;
} }
override void PlayFTASound() override void PlayFTASound()
@ -25,6 +27,7 @@ class DukeTurret : DukeActor
pic "ORGANTIC"; pic "ORGANTIC";
+INTERNAL_BADGUY; +INTERNAL_BADGUY;
+KILLCOUNT; +KILLCOUNT;
+NOVERTICALMOVE;
aimoffset 32; aimoffset 32;
} }
@ -49,6 +52,8 @@ class DukeRotateGun : DukeActor
+NODAMAGEPUSH; +NODAMAGEPUSH;
+NORADIUSPUSH; +NORADIUSPUSH;
+SHOOTCENTERED; +SHOOTCENTERED;
+NOVERTICALMOVE;
+MOVE_NOPLAYERINTERACT;
sparkoffset -8; sparkoffset -8;
aimoffset 32; aimoffset 32;
shootzoffset 0; shootzoffset 0;

View file

@ -88,6 +88,7 @@ class RedneckCheerleader : DukeActor
+KILLCOUNT; +KILLCOUNT;
+LOOKALLAROUND; +LOOKALLAROUND;
+ALTPROJECTILESPRITE; // owed to CON's shittiness. Todo: Think of something better. +ALTPROJECTILESPRITE; // owed to CON's shittiness. Todo: Think of something better.
jumptoplayer_factor 1.6;
} }
override void Initialize() override void Initialize()
{ {
@ -233,6 +234,8 @@ class RedneckMama : DukeActor
+LOOKALLAROUND; +LOOKALLAROUND;
+NORADIUSPUSH; +NORADIUSPUSH;
+SPAWNRABBITGUTS; // owed to CON's shittiness. Todo: Think of something better. +SPAWNRABBITGUTS; // owed to CON's shittiness. Todo: Think of something better.
justjump1_factor 1.83;
justjump2_factor 2.286;
} }
override void Initialize() override void Initialize()
@ -284,6 +287,7 @@ class RedneckCheerStayput : RedneckCheerleader
default default
{ {
pic "CHEERSTAYPUT"; pic "CHEERSTAYPUT";
jumptoplayer_factor 2.0;
} }
override void initialize() override void initialize()
@ -443,6 +447,8 @@ class RedneckMosquito : DukeActor
+QUICKALTERANG; +QUICKALTERANG;
+NOJIBS; +NOJIBS;
falladjustz 0; falladjustz 0;
floating_floordist 30;
floating_ceilingdist 50;
} }
override void Initialize() override void Initialize()
{ {

View file

@ -116,6 +116,12 @@ class DukeActor : CoreActor native
falladjustz 24; falladjustz 24;
autoaimangle 8.4375; autoaimangle 8.4375;
projectilespread 5.625; projectilespread 5.625;
jumptoplayer_factor 2.0;
justjump1_factor 2.133;
justjump2_factor 2.667;
windang_factor 2.667;
floating_floordist 0;
floating_ceilingdist 66;
} }
enum EStatnums enum EStatnums
{ {
@ -242,6 +248,12 @@ class DukeActor : CoreActor native
meta double projectilespread; meta double projectilespread;
meta double shootzoffset; meta double shootzoffset;
meta double moveclipdist; meta double moveclipdist;
meta double jumptoplayer_factor;
meta double justjump1_factor;
meta double justjump2_factor;
meta double windang_factor;
meta double floating_floordist;
meta double floating_ceilingdist;
property prefix: none; property prefix: none;
property gutsoffset: gutsoffset; property gutsoffset: gutsoffset;
@ -253,6 +265,12 @@ class DukeActor : CoreActor native
property projectilespread: projectilespread; property projectilespread: projectilespread;
property shootzoffset: shootzoffset; property shootzoffset: shootzoffset;
property moveclipdist: moveclipdist; property moveclipdist: moveclipdist;
property jumptoplayer_factor: jumptoplayer_factor;
property justjump1_factor: justjump1_factor;
property justjump2_factor: justjump2_factor;
property windang_factor: windang_factor;
property floating_floordist: floating_floordist;
property floating_ceilingdist: floating_ceilingdist;
native void SetSpritesetImage(int index); native void SetSpritesetImage(int index);
native int GetSpritesetSize(); native int GetSpritesetSize();