Mines can be punted

Setting behind leaves a longer startup animation window so that it can be punted more easily
This commit is contained in:
James 2019-02-19 18:38:54 -05:00
parent 4480a1c55a
commit 2f4d3eb087
4 changed files with 91 additions and 12 deletions

View File

@ -2895,7 +2895,8 @@ static mobj_t *K_FindLastTrailMobj(player_t *player)
static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t mapthing, INT32 defaultDir, INT32 altthrow)
{
mobj_t *mo;
INT32 dir, PROJSPEED;
INT32 dir;
fixed_t PROJSPEED;
angle_t newangle;
fixed_t newx, newy, newz;
mobj_t *throwmo;
@ -3012,10 +3013,10 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map
if (mo)
{
angle_t fa = player->mo->angle>>ANGLETOFINESHIFT;
INT32 HEIGHT = (20 + (dir*10))*mapobjectscale + player->mo->momz;
fixed_t HEIGHT = (20 + (dir*10))*mapobjectscale + player->mo->momz;
mo->momx = player->mo->momx + FixedMul(FINECOSINE(fa), (altthrow == 2 ? 2*PROJSPEED/3 : PROJSPEED));
mo->momy = player->mo->momy + FixedMul(FINESINE(fa), (altthrow == 2 ? 2*PROJSPEED/3 : PROJSPEED));
mo->momx = player->mo->momx + FixedMul(FINECOSINE(fa), PROJSPEED);
mo->momy = player->mo->momy + FixedMul(FINESINE(fa), PROJSPEED);
mo->momz = P_MobjFlip(player->mo) * HEIGHT;
if (player->mo->eflags & MFE_VERTICALFLIP)
@ -3082,12 +3083,68 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map
if (player->mo->eflags & MFE_VERTICALFLIP)
mo->eflags |= MFE_VERTICALFLIP;
if (mapthing == MT_SSMINE)
mo->extravalue1 = 14; // Pads the start-up length from 21 frames to a full second
}
}
return mo;
}
void K_PuntMine(mobj_t *thismine, mobj_t *punter)
{
angle_t fa = R_PointToAngle2(0, 0, punter->momx, punter->momy) >> ANGLETOFINESHIFT;
fixed_t z = 30*mapobjectscale + punter->momz;
fixed_t spd;
mobj_t *mine;
if (!thismine || P_MobjWasRemoved(thismine))
return;
if (thismine->type == MT_SSMINE_SHIELD) // Create a new mine
{
mine = P_SpawnMobj(thismine->x, thismine->y, thismine->z, MT_SSMINE);
P_SetTarget(&mine->target, thismine->target);
mine->angle = thismine->angle;
mine->flags2 = thismine->flags2;
mine->floorz = thismine->floorz;
mine->ceilingz = thismine->ceilingz;
P_RemoveMobj(thismine);
}
else
mine = thismine;
if (!mine || P_MobjWasRemoved(mine))
return;
switch (gamespeed)
{
case 0:
spd = 68*mapobjectscale; // Avg Speed is 34
break;
case 2:
spd = 96*mapobjectscale; // Avg Speed is 48
break;
default:
spd = 82*mapobjectscale; // Avg Speed is 41
break;
}
mine->flags |= MF_NOCLIPTHING;
P_SetMobjState(mine, S_SSMINE_AIR1);
mine->threshold = 10;
mine->extravalue1 = 0;
mine->reactiontime = mine->info->reactiontime;
mine->momx = punter->momx + FixedMul(FINECOSINE(fa), spd);
mine->momy = punter->momy + FixedMul(FINESINE(fa), spd);
mine->momz = P_MobjFlip(mine) * z;
mine->flags &= ~MF_NOCLIPTHING;
}
#define THUNDERRADIUS 320
static void K_DoThunderShield(player_t *player)

View File

@ -41,6 +41,7 @@ void K_SpawnBoostTrail(player_t *player);
void K_SpawnSparkleTrail(mobj_t *mo);
void K_SpawnWipeoutTrail(mobj_t *mo, boolean translucent);
void K_DriftDustHandling(mobj_t *spawner);
void K_PuntMine(mobj_t *mine, mobj_t *punter);
void K_DoSneaker(player_t *player, INT32 type);
void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound);
void K_KillBananaChain(mobj_t *banana, mobj_t *inflictor, mobj_t *source);

View File

@ -980,7 +980,12 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (thing->type == MT_PLAYER)
{
P_KillMobj(tmthing, thing, thing);
// Bomb punting
if ((tmthing->state >= &states[S_SSMINE1] && tmthing->state <= &states[S_SSMINE4])
|| (tmthing->state >= &states[S_SSMINE_DEPLOY8] && tmthing->state <= &states[S_SSMINE_DEPLOY13]))
P_KillMobj(tmthing, thing, thing);
else
K_PuntMine(tmthing, thing);
}
else if (thing->type == MT_ORBINAUT || thing->type == MT_JAWZ || thing->type == MT_JAWZ_DUD
|| thing->type == MT_ORBINAUT_SHIELD || thing->type == MT_JAWZ_SHIELD)
@ -1079,7 +1084,12 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (tmthing->health <= 0 || thing->health <= 0)
return true;
P_KillMobj(thing, tmthing, tmthing);
// Bomb punting
if ((thing->state >= &states[S_SSMINE1] && thing->state <= &states[S_SSMINE4])
|| (thing->state >= &states[S_SSMINE_DEPLOY8] && thing->state <= &states[S_SSMINE_DEPLOY13]))
P_KillMobj(thing, tmthing, tmthing);
else
K_PuntMine(thing, tmthing);
}
else if (thing->type == MT_MINEEXPLOSION && tmthing->player)
{

View File

@ -8190,28 +8190,39 @@ void P_MobjThinker(mobj_t *mobj)
mobj->color = mobj->target->player->skincolor;
else
mobj->color = SKINCOLOR_KETCHUP;
if (mobj->momx || mobj->momy)
P_SpawnGhostMobj(mobj);
if (P_IsObjectOnGround(mobj))
{
if (mobj->state == &states[S_SSMINE_AIR1] || mobj->state == &states[S_SSMINE_AIR2])
P_SetMobjState(mobj, S_SSMINE_DEPLOY1);
if (mobj->reactiontime >= mobj->info->reactiontime)
if (mobj->extravalue1 > 0)
mobj->extravalue1--;
else
{
mobj->momx = mobj->momy = 0;
S_StartSound(mobj, mobj->info->activesound);
mobj->reactiontime--;
if (mobj->state == &states[S_SSMINE_AIR1] || mobj->state == &states[S_SSMINE_AIR2])
P_SetMobjState(mobj, S_SSMINE_DEPLOY1);
if (mobj->reactiontime >= mobj->info->reactiontime)
{
mobj->momx = mobj->momy = 0;
S_StartSound(mobj, mobj->info->activesound);
mobj->reactiontime--;
}
}
}
if (mobj->reactiontime && mobj->reactiontime < mobj->info->reactiontime)
{
mobj->reactiontime--;
if (!mobj->reactiontime)
P_KillMobj(mobj, NULL, NULL);
}
if ((mobj->state >= &states[S_SSMINE1] && mobj->state <= &states[S_SSMINE4])
|| (mobj->state >= &states[S_SSMINE_DEPLOY8] && mobj->state <= &states[S_SSMINE_DEPLOY13]))
A_GrenadeRing(mobj);
if (mobj->threshold > 0)
mobj->threshold--;
break;