Orbinaut and Gachabom water run if player was water running when it was thrown

This commit is contained in:
James R 2023-08-15 00:43:58 -07:00
parent b46bfc8766
commit 72a58cee3c
3 changed files with 30 additions and 1 deletions

View file

@ -2842,6 +2842,17 @@ boolean K_WaterRun(mobj_t *mobj)
{
switch (mobj->type)
{
case MT_ORBINAUT:
case MT_GACHABOM:
{
if (Obj_OrbinautCanRunOnWater(mobj))
{
return true;
}
return false;
}
case MT_JAWZ:
{
if (mobj->tracer != NULL && P_MobjWasRemoved(mobj->tracer) == false)

View file

@ -56,6 +56,7 @@ void Obj_GachaBomThrown(mobj_t *th, fixed_t finalSpeed, SINT8 dir);
void Obj_OrbinautJawzMoveHeld(player_t *player);
boolean Obj_GachaBomWasTossed(mobj_t *th);
void Obj_OrbinautDrop(mobj_t *th);
boolean Obj_OrbinautCanRunOnWater(mobj_t *th);
/* Jawz */
void Obj_JawzThink(mobj_t *th);

View file

@ -43,6 +43,7 @@ enum {
ORBI_TOSSED = 0x02, // Gacha Bom tossed forward
ORBI_TRAIL = 0x04, // spawn afterimages
ORBI_SPIN = 0x08, // animate facing angle
ORBI_WATERSKI = 0x10, // this orbinaut can waterski
};
#define orbinaut_flags(o) ((o)->movedir)
@ -303,10 +304,21 @@ boolean Obj_OrbinautJawzCollide(mobj_t *t1, mobj_t *t2)
void Obj_OrbinautThrown(mobj_t *th, fixed_t finalSpeed, SINT8 dir)
{
orbinaut_flags(th) = 0;
if (orbinaut_owner(th) != NULL && P_MobjWasRemoved(orbinaut_owner(th)) == false
&& orbinaut_owner(th)->player != NULL)
{
th->color = orbinaut_owner(th)->player->skincolor;
const mobj_t *owner = orbinaut_owner(th);
const ffloor_t *rover = P_IsObjectFlipped(owner) ? owner->ceilingrover : owner->floorrover;
if (dir != -1 && rover && (rover->fofflags & FOF_SWIMMABLE))
{
// The owner can run on water, so we should too!
orbinaut_flags(th) |= ORBI_WATERSKI;
}
}
else
{
@ -316,7 +328,7 @@ void Obj_OrbinautThrown(mobj_t *th, fixed_t finalSpeed, SINT8 dir)
th->fuse = RR_PROJECTILE_FUSE;
orbinaut_speed(th) = finalSpeed;
orbinaut_flags(th) = ORBI_TRAIL;
orbinaut_flags(th) |= ORBI_TRAIL;
if (dir == -1)
{
@ -457,3 +469,8 @@ void Obj_OrbinautDrop(mobj_t *th)
{
orbinaut_flags(th) |= ORBI_DROPPED;
}
boolean Obj_OrbinautCanRunOnWater(mobj_t *th)
{
return (orbinaut_flags(th) & ORBI_WATERSKI) == ORBI_WATERSKI;
}