Bounce Pad stuff

- K_DoBouncePad now uses mobj_t instead of player_t
- Bounce pads can now bump thrown shells
- Bounce pads now give heavier gravity to players
- The suicide command now works in all gamemodes
This commit is contained in:
TehRealSalt 2017-11-19 02:37:28 -05:00
parent f601520199
commit 81c723b9b5
6 changed files with 70 additions and 20 deletions

View File

@ -1976,11 +1976,11 @@ static void Command_Suicide(void)
return;
}
if (!G_PlatformGametype())
/*if (!G_PlatformGametype()) // srb2kart: not necessary, suiciding makes you lose a balloon in battle, so it's not desirable to use as a way to escape a hit
{
CONS_Printf(M_GetText("You may only use this in co-op, race, and competition!\n"));
return;
}
}*/
// Retry is quicker. Probably should force people to use it.
if (!(netgame || multiplayer))
@ -1997,7 +1997,7 @@ static void Got_Suicide(UINT8 **cp, INT32 playernum)
INT32 suicideplayer = READINT32(*cp);
// You can't suicide someone else. Nice try, there.
if (suicideplayer != playernum || (!G_PlatformGametype()))
if (suicideplayer != playernum) // srb2kart: "|| (!G_PlatformGametype())"
{
CONS_Alert(CONS_WARNING, M_GetText("Illegal suicide command received from %s\n"), player_names[playernum]);
if (server)

View File

@ -2506,24 +2506,49 @@ static void K_DoLightning(player_t *player, boolean bluelightning)
player->kartstuff[k_sounds] = 50;
}
void K_DoBouncePad(player_t *player, fixed_t vertispeed)
void K_DoBouncePad(mobj_t *mo, fixed_t vertispeed)
{
if (player->spectator || !player->mo)
if (mo->player && mo->player->spectator)
return;
if (player->mo->eflags & MFE_SPRUNG)
if (mo->eflags & MFE_SPRUNG)
return;
#ifdef ESLOPE
player->mo->standingslope = NULL;
mo->standingslope = NULL;
#endif
player->mo->eflags |= MFE_SPRUNG;
if (player->mo->eflags & MFE_VERTICALFLIP)
mo->eflags |= MFE_SPRUNG;
if (mo->eflags & MFE_VERTICALFLIP)
vertispeed *= -1;
player->mo->momz = FixedMul(vertispeed, player->mo->scale);
S_StartSound(player->mo, sfx_boing);
if (vertispeed == 0)
{
fixed_t thrust;
if (mo->player)
{
thrust = 3*mo->player->speed/2;
if (thrust < 48<<FRACBITS)
thrust = 48<<FRACBITS;
}
else
{
thrust = P_AproxDistance(mo->momx,mo->momy);
if (thrust < 8<<FRACBITS)
thrust = 8<<FRACBITS;
}
if (thrust > 72<<FRACBITS)
thrust = 72<<FRACBITS;
mo->momz = FixedMul(FINESINE(ANGLE_22h>>ANGLETOFINESHIFT), thrust);
}
else
mo->momz = FixedMul(vertispeed, mo->scale);
S_StartSound(mo, sfx_boing);
}
// Returns false if this player being placed here causes them to collide with any other player
@ -3330,7 +3355,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
else if (ATTACK_IS_DOWN && !HOLDING_ITEM && player->kartstuff[k_feather] & 1 && NO_BOO)
{
K_PlayTauntSound(player->mo);
K_DoBouncePad(player, 30<<FRACBITS);
K_DoBouncePad(player->mo, 32<<FRACBITS);
player->pflags |= PF_ATTACKDOWN;
player->kartstuff[k_feather] |= 2;
@ -4470,7 +4495,7 @@ static void K_drawKartSpeedometer(void)
else if (cv_speedometer.value == 3)
{
convSpeed = stplyr->speed/FRACUNIT;
V_DrawKartString(SPDM_X, STRINGY(SPDM_Y), flags, va("%3d Fracunits/s", convSpeed));
V_DrawKartString(SPDM_X, STRINGY(SPDM_Y), flags, va("%3d fu/s", convSpeed));
}
}

View File

@ -26,7 +26,7 @@ void K_StealBalloon(player_t *player, player_t *victim);
void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, angle_t rotangle, boolean spawncenter, boolean ghostit, mobj_t *source);
void K_SpawnDriftTrail(player_t *player);
void K_DoMushroom(player_t *player, boolean doPFlag, boolean startboost);
void K_DoBouncePad(player_t *player, fixed_t vertispeed);
void K_DoBouncePad(mobj_t *mo, fixed_t vertispeed);
boolean K_CheckPlayersRespawnColliding(INT32 playernum, fixed_t x, fixed_t y);
INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue);
void K_MomentumToFacing(player_t *player);

View File

@ -2109,12 +2109,12 @@ static int lib_kDoMushroom(lua_State *L)
static int lib_kDoBouncePad(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t vertispeed = luaL_checkfixed(L, 2);
NOHUD
if (!player)
return LUA_ErrInvalid(L, "player_t");
K_DoBouncePad(player, vertispeed);
if (!mo)
return LUA_ErrInvalid(L, "mobj_t");
K_DoBouncePad(mo, vertispeed);
return 0;
}

View File

@ -7669,6 +7669,7 @@ void P_MobjThinker(mobj_t *mobj)
break;
case MT_GREENITEM:
{
sector_t *sec2;
fixed_t finalspeed = mobj->info->speed;
P_SpawnGhostMobj(mobj);
@ -7696,14 +7697,21 @@ void P_MobjThinker(mobj_t *mobj)
{
P_InstaThrust(mobj, mobj->angle, finalspeed);
}
sec2 = P_ThingOnSpecial3DFloor(mobj);
if ((sec2 && GETSECSPECIAL(sec2->special, 3) == 1) || (P_IsObjectOnGround(mobj) && GETSECSPECIAL(mobj->subsector->sector->special, 3) == 1))
K_DoBouncePad(mobj, 0);
if (mobj->threshold > 0)
mobj->threshold--;
if (leveltime % 6 == 0)
S_StartSound(mobj, mobj->info->activesound);
break;
}
case MT_REDITEM:
{
sector_t *sec2;
fixed_t topspeed = 64*FRACUNIT;
fixed_t distbarrier = 512*FRACUNIT;
fixed_t distaway;
@ -7740,17 +7748,33 @@ void P_MobjThinker(mobj_t *mobj)
}
P_InstaThrust(mobj, R_PointToAngle2(0, 0, mobj->momx, mobj->momy), topspeed);
sec2 = P_ThingOnSpecial3DFloor(mobj);
if ((sec2 && GETSECSPECIAL(sec2->special, 3) == 1) || (P_IsObjectOnGround(mobj) && GETSECSPECIAL(mobj->subsector->sector->special, 3) == 1))
K_DoBouncePad(mobj, 0);
break;
}
case MT_REDITEMDUD:
{
sector_t *sec2;
P_SpawnGhostMobj(mobj);
mobj->angle = R_PointToAngle2(mobj->x, mobj->y, mobj->x+mobj->momx, mobj->y+mobj->momy);
P_InstaThrust(mobj, mobj->angle, mobj->info->speed);
sec2 = P_ThingOnSpecial3DFloor(mobj);
if ((sec2 && GETSECSPECIAL(sec2->special, 3) == 1) || (P_IsObjectOnGround(mobj) && GETSECSPECIAL(mobj->subsector->sector->special, 3) == 1))
K_DoBouncePad(mobj, 0);
if (mobj->threshold > 0)
mobj->threshold--;
if (leveltime % 7 == 0)
S_StartSound(mobj, mobj->info->activesound);
break;
}
case MT_BANANAITEM:
case MT_FAKEITEM:
if (mobj->momx || mobj->momy)

View File

@ -3734,8 +3734,9 @@ DoneSection2:
if (player->speed < K_GetKartSpeed(player, true)/16 && !(player->mo->eflags & MFE_SPRUNG)) // Push forward to prevent getting stuck
P_InstaThrust(player->mo, player->mo->angle, FixedMul(K_GetKartSpeed(player, true)/16, player->mo->scale));
K_DoBouncePad(player, 12<<FRACBITS);
player->kartstuff[k_feather] |= 2;
K_DoBouncePad(player->mo, 0);
break;