- cleaned up movesprite_ex.

This needed 5 actor flags to handle some really inane special cases!
This commit is contained in:
Christoph Oelckers 2022-12-29 19:12:35 +01:00
parent 83365a9a14
commit 46f7e38e46
15 changed files with 41 additions and 15 deletions

View file

@ -22,3 +22,4 @@ xx(aimoffset)
xx(strength)
xx(autoaimangle)
xx(shootzoffset)
xx(moveclipdist)

View file

@ -183,6 +183,11 @@ static FFlagDef DukeActorFlagDefs[] =
DEFINE_FLAG(SFLAG3, HITRADIUS_NODAMAGE, DDukeActor, flags3),
DEFINE_FLAG(SFLAG3, HITRADIUS_NOEFFECT, DDukeActor, flags3),
DEFINE_FLAG(SFLAG3, HITRADIUS_DONTHURTSPECIES, DDukeActor, flags3),
DEFINE_FLAG(SFLAG3, ST3CONFINED, DDukeActor, flags3),
DEFINE_FLAG(SFLAG3, DONTENTERWATER, DDukeActor, flags3),
DEFINE_FLAG(SFLAG3, DONTENTERWATERONGROUND, DDukeActor, flags3),
DEFINE_FLAG(SFLAG3, RANDOMANGLEONWATER, DDukeActor, flags3),
DEFINE_FLAG(SFLAG3, NORANDOMANGLEWHENBLOCKED, DDukeActor, flags3),
};

View file

@ -902,7 +902,7 @@ void hitradius(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int hp4
}
else if (act2->spr.extra >= 0 && act2 != actor && ((act2->flags1 & SFLAG_HITRADIUS_FORCEEFFECT) || badguy(act2) || (act2->spr.cstat & CSTAT_SPRITE_BLOCK_ALL)))
{
// this is a damage type check, not a projectile type check.
// this should be a damage type check, not a projectile type check.
// It's also quite broken because it doesn't check for being shrunk but tries to guess it from the size.
// Unfortunately, with CON there is no way to retrieve proper shrunk state in any way.
if (actor->GetClass() == DukeShrinkSparkClass && (act2->spr.scale.X < 0.375))

View file

@ -174,13 +174,14 @@ int movesprite_ex_d(DDukeActor* actor, const DVector3& change, unsigned int clip
else
{
// todo: move this mess to the actor definitions once we have them all available.
double clipdist;
if (actor->spr.picnum == DTILE_LIZMAN)
clipdist = 18.25;
else if ((actor->flags1 & SFLAG_BADGUY))
clipdist = actor->clipdist;
else
clipdist = 12;
double clipdist = actor->FloatVar(NAME_moveclipdist);
if (clipdist == 0)
{
if ((actor->flags1 & SFLAG_BADGUY) && !isRR())
clipdist = actor->clipdist;
else
clipdist = 12;
}
clipmove(ppos, &dasectp, change * 0.5, clipdist, 4., 4., cliptype, result);
}
@ -188,15 +189,15 @@ int movesprite_ex_d(DDukeActor* actor, const DVector3& change, unsigned int clip
// conditional code from hell...
if (dasectp == nullptr || (dasectp != nullptr &&
((actor->actorstayput != nullptr && actor->actorstayput != dasectp) ||
((actor->spr.picnum == DTILE_BOSS2) && actor->spr.pal == 0 && dasectp->lotag != ST_3) ||
((actor->spr.picnum == DTILE_BOSS1 || actor->spr.picnum == DTILE_BOSS2) && dasectp->lotag == ST_1_ABOVE_WATER) ||
(dasectp->lotag == ST_1_ABOVE_WATER && (actor->spr.picnum == DTILE_LIZMAN || (actor->spr.picnum == DTILE_LIZTROOP && actor->vel.Z == 0)))
))
((actor->flags3 & SFLAG3_ST3CONFINED) && actor->spr.pal == 0 && dasectp->lotag != ST_3_BOSS2) ||
((actor->flags3 & SFLAG3_DONTENTERWATER) && dasectp->lotag == ST_1_ABOVE_WATER) ||
((actor->flags3 & SFLAG3_DONTENTERWATERONGROUND) && actor->vel.Z == 0 && dasectp->lotag == ST_1_ABOVE_WATER))
)
)
{
if (dasectp && dasectp->lotag == ST_1_ABOVE_WATER && actor->spr.picnum == DTILE_LIZMAN)
if (dasectp && dasectp->lotag == ST_1_ABOVE_WATER && (actor->flags3 & SFLAG3_RANDOMANGLEONWATER))
actor->spr.Angles.Yaw = randomAngle();
else if ((actor->counter&3) == 1 && actor->spr.picnum != DTILE_COMMANDER)
else if ((actor->counter&3) == 1 && !(actor->flags3 & SFLAG3_NORANDOMANGLEWHENBLOCKED))
actor->spr.Angles.Yaw = randomAngle();
SetActor(actor,actor->spr.pos);
if (dasectp == nullptr) dasectp = &sector[0];

View file

@ -115,7 +115,7 @@ enum
ST_0_NO_EFFECT = 0,
ST_1_ABOVE_WATER = 1,
ST_2_UNDERWATER = 2,
ST_3 = 3,
ST_3_BOSS2 = 3,
// ^^^ maybe not complete substitution in code
ST_9_SLIDING_ST_DOOR = 9,
ST_15_WARP_ELEVATOR = 15,
@ -416,6 +416,11 @@ enum sflags3_t
SFLAG3_HITRADIUS_NODAMAGE = 0x00004000, // Hitradius inflicts no damage, only a damage type.
SFLAG3_HITRADIUS_NOEFFECT = 0x00008000, // Completely immune to hitradius
SFLAG3_HITRADIUS_DONTHURTSPECIES = 0x00010000, // don't hurt others of the shooter's species.
SFLAG3_ST3CONFINED = 0x00020000,
SFLAG3_DONTENTERWATER = 0x00040000,
SFLAG3_DONTENTERWATERONGROUND = 0x00080000,
SFLAG3_RANDOMANGLEONWATER = 0x00100000,
SFLAG3_NORANDOMANGLEWHENBLOCKED = 0x00200000,
};

View file

@ -684,6 +684,7 @@ DEFINE_PROPERTY(setgamedefaults, 0, DukeActor)
{
defaults->flags1 |= SFLAG_MOVEFTA_WAKEUPCHECK; // Animals were not supposed to have this, but due to a coding bug the logic was unconditional for everything in the game.
defaults->flags2 |= SFLAG2_NODAMAGEPUSH; // RR does not have this feature, so set the flag for everything, this allows disabling it if wanted later.
defaults->flags3 |= SFLAG3_RANDOMANGLEONWATER; // RR does this for all badguys, Duke only for the LizMan.
}
}

View file

@ -8,6 +8,7 @@ class DukeBoss1 : DukeActor
+NODAMAGEPUSH;
+BOSS;
+ALTHITSCANDIRECTION;
+DONTENTERWATER;
}
override void Initialize()

View file

@ -6,6 +6,8 @@ class DukeBoss2 : DukeBoss1
-ALTHITSCANDIRECTION;
+NONSMOKYROCKET; // If this wasn't needed for a CON defined actor it could be handled better
+SPECIALINIT;
+ST3CONFINED;
+DONTENTERWATER;
}
override void PlayFTASound()

View file

@ -4,6 +4,7 @@ class DukeBoss3 : DukeBoss1
{
pic "BOSS3";
-ALTHITSCANDIRECTION;
-DONTENTERWATER;
}
override void PlayFTASound()

View file

@ -4,6 +4,7 @@ class DukeBoss4 : DukeBoss1
{
pic "BOSS4";
-ALTHITSCANDIRECTION;
-DONTENTERWATER;
}
override void PlayFTASound()

View file

@ -4,6 +4,7 @@ class DukeBoss5 : DukeBoss1
{
pic "BOSS5";
-ALTHITSCANDIRECTION;
-DONTENTERWATER;
}
}

View file

@ -8,6 +8,7 @@ class DukeCommander : DukeActor
+NOWATERDIP;
+FLOATING;
+SHOOTCENTERED;
+NORANDOMANGLEWHENBLOCKED;
gutsoffset -24;
falladjustz 0;
}

View file

@ -7,6 +7,9 @@ class DukeLizMan : DukeActor
+INTERNAL_BADGUY;
+KILLCOUNT;
+GREENSLIMEFOOD;
+DONTENTERWATER;
+RANDOMANGLEONWATER;
moveclipdist 18.25;
}
override void PlayFTASound()

View file

@ -8,6 +8,7 @@ class DukeLizTrooper : DukeActor
+KILLCOUNT;
+GREENSLIMEFOOD;
+TRANSFERPALTOJIBS;
+DONTENTERWATERONGROUND;
}
override void Initialize()

View file

@ -241,6 +241,7 @@ class DukeActor : CoreActor native
meta double sparkoffset;
meta double projectilespread;
meta double shootzoffset;
meta double moveclipdist;
property prefix: none;
property gutsoffset: gutsoffset;
@ -251,6 +252,7 @@ class DukeActor : CoreActor native
property sparkoffset: sparkoffset;
property projectilespread: projectilespread;
property shootzoffset: shootzoffset;
property moveclipdist: moveclipdist;
native void SetSpritesetImage(int index);
native int GetSpritesetSize();