Merge branch 'sonicitems' into encore

This commit is contained in:
toaster 2018-08-12 01:55:07 +01:00
commit 8256739052
7 changed files with 120 additions and 31 deletions

View file

@ -319,6 +319,8 @@ typedef enum
k_invincibilitytimer, // Invincibility timer
k_deathsentence, // 30 seconds to live... (SPB murder timer (not actually 30 sec, I just couldn't help the FF reference :p))
k_eggmanheld, // Eggman monitor held, separate from k_itemheld so it doesn't stop you from getting items
k_eggmanexplode, // Fake item recieved, explode in a few seconds
k_eggmanblame, // Fake item recieved, who set this fake
k_bananadrag, // After a second of holding a banana behind you, you start to slow down
k_spinouttimer, // Spin-out from a banana peel or oil slick (was "pw_bananacam")
k_wipeoutslow, // Timer before you slowdown when getting wiped out

View file

@ -7684,12 +7684,10 @@ static const char *const KARTSTUFF_LIST[] = {
"ITEMROULETTE",
"ROULETTETYPE",
// Item held stuff
"ITEMTYPE",
"ITEMAMOUNT",
"ITEMHELD",
// Some items use timers for their duration or effects
//"THUNDERANIM",
"CURSHIELD",
"HYUDOROTIMER",
@ -7702,6 +7700,8 @@ static const char *const KARTSTUFF_LIST[] = {
"INVINCIBILITYTIMER",
"DEATHSENTENCE",
"EGGMANHELD",
"EGGMANEXPLODE",
"EGGMANBLAME",
"BANANADRAG",
"SPINOUTTIMER",
"WIPEOUTSLOW",
@ -7709,7 +7709,6 @@ static const char *const KARTSTUFF_LIST[] = {
"COMEBACKTIMER",
"SADTIMER",
// Battle Mode vars
"BUMPER",
"COMEBACKPOINTS",
"COMEBACKMODE",

View file

@ -784,11 +784,24 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
if (cmd->buttons & BT_ATTACK)
player->pflags |= PF_ATTACKDOWN;
if (player->kartstuff[k_roulettetype] == 2) // Fake items
{
player->kartstuff[k_eggmanexplode] = 4*TICRATE;
player->kartstuff[k_itemroulette] = 0;
player->kartstuff[k_roulettetype] = 0;
if (P_IsLocalPlayer(player))
S_StartSound(NULL, sfx_mkitmF);
return;
}
if (cv_kartdebugitem.value != 0)
{
K_KartGetItemResult(player, cv_kartdebugitem.value);
player->kartstuff[k_itemamount] = cv_kartdebugamount.value;
player->kartstuff[k_itemroulette] = 0;
player->kartstuff[k_roulettetype] = 0;
if (P_IsLocalPlayer(player))
S_StartSound(NULL, sfx_mkitmF);
return;
}
@ -3162,6 +3175,19 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->kartstuff[k_instashield])
player->kartstuff[k_instashield]--;
if (player->kartstuff[k_eggmanexplode])
{
player->kartstuff[k_eggmanexplode]--;
if (player->kartstuff[k_eggmanexplode] <= 0)
{
mobj_t *eggsexplode;
player->powers[pw_flashing] = 0;
eggsexplode = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BLUEEXPLOSION);
if (&players[player->kartstuff[k_eggmanblame]] && players[player->kartstuff[k_eggmanblame]].mo)
P_SetTarget(&eggsexplode->target, players[player->kartstuff[k_eggmanblame]].mo);
}
}
// ???
/*
if (player->kartstuff[k_jmp] > 1 && onground)
@ -3575,6 +3601,8 @@ void K_StripItems(player_t *player)
player->kartstuff[k_growshrinktimer] = 0;
player->kartstuff[k_eggmanheld] = 0;
player->kartstuff[k_eggmanexplode] = 0;
player->kartstuff[k_eggmanblame] = 0;
player->kartstuff[k_hyudorotimer] = 0;
player->kartstuff[k_stealingtimer] = 0;
@ -3638,6 +3666,12 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
newitem->fuse = 15*TICRATE; // selected randomly.
newitem->threshold = 69; // selected "randomly".
}
// Eggman Monitor exploding
else if (player->kartstuff[k_eggmanexplode])
{
if (ATTACK_IS_DOWN && player->kartstuff[k_eggmanexplode] <= 3*TICRATE && player->kartstuff[k_eggmanexplode] > 1)
player->kartstuff[k_eggmanexplode] = 1;
}
// Eggman Monitor throwing
else if (ATTACK_IS_DOWN && player->kartstuff[k_eggmanheld])
{
@ -4893,6 +4927,13 @@ static void K_drawKartItem(void)
{
localpatch = kp_hyudoro[offset];
}
else if (stplyr->kartstuff[k_eggmanexplode] > 1)
{
if (leveltime & 1)
localpatch = kp_eggman[offset];
else if (!(leveltime & 1))
localpatch = kp_nodraw;
}
else if (stplyr->kartstuff[k_rocketsneakertimer] > 1)
{
if (leveltime & 1)
@ -4963,6 +5004,15 @@ static void K_drawKartItem(void)
}
else
V_DrawScaledPatch(ITEM_X, ITEM_Y, V_HUDTRANS|splitflags, localpatch);
// Quick hack
if (stplyr->kartstuff[k_eggmanexplode] > 1)
{
if (splitscreen > 1)
V_DrawString(ITEM_X+12, ITEM_Y+12, V_HUDTRANS|splitflags, va("%d", G_TicsToSeconds(stplyr->kartstuff[k_eggmanexplode])));
else
V_DrawKartString(ITEM_X+18, ITEM_Y+18, V_HUDTRANS|splitflags, va("%d", G_TicsToSeconds(stplyr->kartstuff[k_eggmanexplode])));
}
}
static void K_drawKartTimestamp(void)

View file

@ -1315,7 +1315,7 @@ static int lib_pPlayLivesJingle(lua_State *L)
static int lib_pCanPickupItem(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
boolean weapon = lua_optboolean(L, 2);
UINT8 weapon = (UINT8)luaL_optinteger(L, 2, 0);
//HUDSAFE
if (!player)
return LUA_ErrInvalid(L, "player_t");

View file

@ -150,7 +150,7 @@ void P_ResetStarposts(void)
//
// Returns true if the player is in a state where they can pick up items.
//
boolean P_CanPickupItem(player_t *player, boolean weapon)
boolean P_CanPickupItem(player_t *player, UINT8 weapon)
{
if (player->exiting || mapreset)
return false;
@ -161,10 +161,12 @@ boolean P_CanPickupItem(player_t *player, boolean weapon)
if (weapon)
{
if (player->kartstuff[k_stealingtimer] || player->kartstuff[k_stolentimer]
|| player->kartstuff[k_growshrinktimer] != 0 || player->kartstuff[k_rocketsneakertimer]) // Item-specific timer going off
|| player->kartstuff[k_growshrinktimer] != 0 || player->kartstuff[k_rocketsneakertimer]
|| player->kartstuff[k_eggmanexplode]) // Item-specific timer going off
return false;
if (player->kartstuff[k_itemroulette]
if ((player->kartstuff[k_itemroulette] && weapon != 2)
|| (player->kartstuff[k_roulettetype] == 2 && weapon == 2)
|| player->kartstuff[k_itemamount]
|| player->kartstuff[k_itemheld]) // Item slot already taken up
return false;
@ -407,7 +409,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
switch (special->type)
{
case MT_RANDOMITEM: // SRB2kart
if (!P_CanPickupItem(player, true))
if (!P_CanPickupItem(player, 1))
return;
if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0)
@ -465,7 +467,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
K_ExplodePlayer(player, special->target);
}
}
else if (special->target->player->kartstuff[k_comebackmode] == 1 && P_CanPickupItem(player, true))
else if (special->target->player->kartstuff[k_comebackmode] == 1 && P_CanPickupItem(player, 1))
{
mobj_t *poof = P_SpawnMobj(tmthing->x, tmthing->y, tmthing->z, MT_EXPLODE);
S_StartSound(poof, special->info->seesound);
@ -496,7 +498,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
/* FALLTHRU */
case MT_RING:
case MT_FLINGRING:
if (!(P_CanPickupItem(player, false)))
if (!(P_CanPickupItem(player, 0)))
return;
special->momx = special->momy = special->momz = 0;
@ -508,7 +510,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
case MT_COIN:
case MT_FLINGCOIN:
if (!(P_CanPickupItem(player, false)))
if (!(P_CanPickupItem(player, 0)))
return;
special->momx = special->momy = 0;
@ -518,7 +520,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
P_DoNightsScore(player);
break;
case MT_BLUEBALL:
if (!(P_CanPickupItem(player, false)))
if (!(P_CanPickupItem(player, 0)))
return;
P_GivePlayerRings(player, 1);
@ -539,7 +541,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
case MT_GRENADEPICKUP:
case MT_EXPLODEPICKUP:
case MT_RAILPICKUP:
if (!(P_CanPickupItem(player, true)))
if (!(P_CanPickupItem(player, 1)))
return;
// Give the power and ringweapon
@ -563,7 +565,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
case MT_GRENADERING:
case MT_EXPLOSIONRING:
case MT_RAILRING:
if (!(P_CanPickupItem(player, true)))
if (!(P_CanPickupItem(player, 1)))
return;
if (special->info->mass >= pw_infinityring && special->info->mass <= pw_railring)
@ -651,7 +653,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
// Power stones / Match emeralds
case MT_FLINGEMERALD:
if (!(P_CanPickupItem(player, true)) || player->tossdelay)
if (!(P_CanPickupItem(player, 1)) || player->tossdelay)
return;
player->powers[pw_emeralds] |= special->threshold;
@ -3326,16 +3328,13 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
{
if (inflictor && (inflictor->type == MT_ORBINAUT || inflictor->type == MT_ORBINAUT_SHIELD
|| inflictor->type == MT_JAWZ || inflictor->type == MT_JAWZ_SHIELD || inflictor->type == MT_JAWZ_DUD
|| inflictor->type == MT_FAKEITEM || inflictor->type == MT_FAKESHIELD
|| inflictor->player))
{
player->kartstuff[k_sneakertimer] = 0;
K_SpinPlayer(player, source, 1, (inflictor->type == MT_FAKEITEM || inflictor->type == MT_FAKESHIELD));
K_SpinPlayer(player, source, 1, false);
damage = player->mo->health - 1;
P_RingDamage(player, inflictor, source, damage);
P_PlayerRingBurst(player, 5);
if (inflictor->type == MT_FAKEITEM || inflictor->type == MT_FAKESHIELD)
player->mo->momx = player->mo->momy = 0;
if (P_IsLocalPlayer(player))
{
quake.intensity = 32*FRACUNIT;

View file

@ -409,7 +409,7 @@ boolean P_CheckRacers(void);
void P_ClearStarPost(INT32 postnum);
void P_ResetStarposts(void);
boolean P_CanPickupItem(player_t *player, boolean weapon);
boolean P_CanPickupItem(player_t *player, UINT8 weapon);
void P_DoNightsScore(player_t *player);
//

View file

@ -1036,7 +1036,19 @@ static boolean PIT_CheckThing(mobj_t *thing)
else if (thing->type == MT_PLAYER)
{
// Player Damage
P_DamageMobj(thing, tmthing, tmthing->target, 1);
{
mobj_t *poof = P_SpawnMobj(tmthing->x, tmthing->y, tmthing->z, MT_EXPLODE);
S_StartSound(poof, sfx_kc2e);
}
if (P_CanPickupItem(thing->player, 2))
{
if (thing->player->kartstuff[k_itemroulette] <= 0)
thing->player->kartstuff[k_itemroulette] = 1;
thing->player->kartstuff[k_roulettetype] = 2;
if (tmthing->target && tmthing->target->player)
thing->player->kartstuff[k_eggmanblame] = tmthing->target->player-players;
}
// This Item Damage
if (tmthing->eflags & MFE_VERTICALFLIP)
@ -1045,10 +1057,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
tmthing->z += tmthing->height;
S_StartSound(tmthing, tmthing->info->deathsound);
P_KillMobj(tmthing, thing, thing);
P_SetObjectMomZ(tmthing, 8*FRACUNIT, false);
P_InstaThrust(tmthing, R_PointToAngle2(thing->x, thing->y, tmthing->x, tmthing->y)+ANGLE_90, 16*FRACUNIT);
P_RemoveMobj(tmthing);
}
return true;
@ -1111,12 +1120,12 @@ static boolean PIT_CheckThing(mobj_t *thing)
return true; // underneath
if (tmthing->player && tmthing->player->powers[pw_flashing]
&& !(thing->type == MT_ORBINAUT || thing->type == MT_JAWZ || thing->type == MT_JAWZ_DUD))
&& !(thing->type == MT_ORBINAUT || thing->type == MT_JAWZ || thing->type == MT_JAWZ_DUD
|| thing->type == MT_FAKESHIELD || thing->type == MT_FAKEITEM))
return true;
if (thing->type == MT_ORBINAUT_SHIELD || thing->type == MT_JAWZ_SHIELD
|| thing->type == MT_ORBINAUT || thing->type == MT_JAWZ || thing->type == MT_JAWZ_DUD
|| thing->type == MT_FAKESHIELD || thing->type == MT_FAKEITEM)
|| thing->type == MT_ORBINAUT || thing->type == MT_JAWZ || thing->type == MT_JAWZ_DUD)
{
if ((thing->target == tmthing) && (thing->threshold > 0))
return true;
@ -1126,9 +1135,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
// Player Damage
P_DamageMobj(tmthing, thing, thing->target, 1);
if (thing->type != MT_FAKESHIELD && thing->type != MT_FAKEITEM)
K_KartBouncing(tmthing, thing, false, false);
K_KartBouncing(tmthing, thing, false, false);
if (thing->type == MT_ORBINAUT || thing->type == MT_JAWZ || thing->type == MT_JAWZ_DUD)
S_StartSound(tmthing, sfx_shelit);
@ -1145,6 +1152,38 @@ static boolean PIT_CheckThing(mobj_t *thing)
P_SetObjectMomZ(thing, 8*FRACUNIT, false);
P_InstaThrust(thing, R_PointToAngle2(tmthing->x, tmthing->y, thing->x, thing->y)+ANGLE_90, 16*FRACUNIT);
}
else if (thing->type == MT_FAKESHIELD || thing->type == MT_FAKEITEM)
{
if ((thing->target == tmthing) && (thing->threshold > 0))
return true;
if (tmthing->health <= 0 || thing->health <= 0)
return true;
// Player Damage
{
mobj_t *poof = P_SpawnMobj(thing->x, thing->y, thing->z, MT_EXPLODE);
S_StartSound(poof, sfx_kc2e);
}
if (P_CanPickupItem(tmthing->player, 2))
{
if (tmthing->player->kartstuff[k_itemroulette] <= 0)
tmthing->player->kartstuff[k_itemroulette] = 1;
tmthing->player->kartstuff[k_roulettetype] = 2;
if (thing->target && thing->target->player)
tmthing->player->kartstuff[k_eggmanblame] = thing->target->player-players;
}
// Other Item Damage
if (thing->eflags & MFE_VERTICALFLIP)
thing->z -= thing->height;
else
thing->z += thing->height;
S_StartSound(thing, thing->info->deathsound);
P_RemoveMobj(thing);
}
else if (thing->type == MT_BANANA_SHIELD || thing->type == MT_BANANA
|| thing->type == MT_BALLHOG)
{