Merge branch 'fix-water-run-jawz' into 'master'

Let Jawz, Orbinaut and Gachabom water ski

See merge request KartKrew/Kart!1400
This commit is contained in:
Chromatian Keiske 2023-08-17 05:01:48 +00:00
commit 7f89bee3f2
4 changed files with 84 additions and 38 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)
@ -4775,6 +4786,50 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I
th->momy = FixedMul(finalspeed, FINESINE(an>>ANGLETOFINESHIFT));
th->momz = source->momz;
if (source->player != NULL)
{
th->cusval = source->player->itemscale;
}
switch (type)
{
case MT_ORBINAUT:
Obj_OrbinautThrown(th, finalspeed, dir);
break;
case MT_JAWZ:
Obj_JawzThrown(th, finalspeed, dir);
break;
case MT_SPB:
th->movefactor = finalspeed;
break;
case MT_BUBBLESHIELDTRAP:
P_SetScale(th, ((5*th->destscale)>>2)*4);
th->destscale = (5*th->destscale)>>2;
S_StartSound(th, sfx_s3kbfl);
S_StartSound(th, sfx_cdfm35);
break;
case MT_BALLHOG:
// Contra spread shot scale up
th->destscale = th->destscale << 1;
th->scalespeed = abs(th->destscale - th->scale) / (2*TICRATE);
break;
case MT_GARDENTOP:
th->movefactor = finalspeed;
break;
case MT_GACHABOM:
Obj_GachaBomThrown(th, finalspeed, dir);
break;
default:
break;
}
// I'm calling P_SetOrigin to update the floorz if this
// object can run on water. However, P_CanRunOnWater
// requires that the object is already on the ground, so
// floorz needs to be set beforehand too.
th->floorz = source->floorz;
th->ceilingz = source->ceilingz;
// Get floorz and ceilingz
P_SetOrigin(th, x, y, z);
@ -4823,43 +4878,6 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I
}
}
if (source->player != NULL)
{
th->cusval = source->player->itemscale;
}
switch (type)
{
case MT_ORBINAUT:
Obj_OrbinautThrown(th, finalspeed, dir);
break;
case MT_JAWZ:
Obj_JawzThrown(th, finalspeed, dir);
break;
case MT_SPB:
th->movefactor = finalspeed;
break;
case MT_BUBBLESHIELDTRAP:
P_SetScale(th, ((5*th->destscale)>>2)*4);
th->destscale = (5*th->destscale)>>2;
S_StartSound(th, sfx_s3kbfl);
S_StartSound(th, sfx_cdfm35);
break;
case MT_BALLHOG:
// Contra spread shot scale up
th->destscale = th->destscale << 1;
th->scalespeed = abs(th->destscale - th->scale) / (2*TICRATE);
break;
case MT_GARDENTOP:
th->movefactor = finalspeed;
break;
case MT_GACHABOM:
Obj_GachaBomThrown(th, finalspeed, dir);
break;
default:
break;
}
if (type != MT_BUBBLESHIELDTRAP)
{
x = x + P_ReturnThrustX(source, an, source->radius + th->radius);

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

@ -255,12 +255,14 @@ void Obj_JawzThink(mobj_t *th)
void Obj_JawzThrown(mobj_t *th, fixed_t finalSpeed, SINT8 dir)
{
INT32 lastTarg = -1;
player_t *owner = NULL;
if (jawz_owner(th) != NULL && P_MobjWasRemoved(jawz_owner(th)) == false
&& jawz_owner(th)->player != NULL)
{
lastTarg = jawz_owner(th)->player->lastjawztarget;
jawz_retcolor(th) = jawz_owner(th)->player->skincolor;
owner = jawz_owner(th)->player;
}
else
{
@ -297,6 +299,14 @@ void Obj_JawzThrown(mobj_t *th, fixed_t finalSpeed, SINT8 dir)
P_SetTarget(&jawz_chase(th), tryPlayer->mo);
}
}
// Sealed Star: target the UFO immediately. I don't
// wanna fuck with the lastjawztarget stuff, so just
// do this if a target wasn't set.
if (jawz_chase(th) == NULL || P_MobjWasRemoved(jawz_chase(th)) == true)
{
P_SetTarget(&jawz_chase(th), K_FindJawzTarget(th, owner, ANGLE_90));
}
}
S_StartSound(th, th->info->activesound);

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;
}