mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Add special behavior for SPB item capsules
This commit is contained in:
parent
6477176c31
commit
05749b9773
5 changed files with 54 additions and 3 deletions
34
src/k_kart.c
34
src/k_kart.c
|
|
@ -4470,7 +4470,7 @@ static mobj_t *K_FindLastTrailMobj(player_t *player)
|
|||
return trail;
|
||||
}
|
||||
|
||||
static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t mapthing, INT32 defaultDir, INT32 altthrow)
|
||||
mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t mapthing, INT32 defaultDir, INT32 altthrow)
|
||||
{
|
||||
mobj_t *mo;
|
||||
INT32 dir;
|
||||
|
|
@ -9419,4 +9419,36 @@ UINT8 K_GetOrbinautItemFrame(UINT8 count)
|
|||
return min(count - 1, 3);
|
||||
}
|
||||
|
||||
boolean K_IsSPBInGame(void)
|
||||
{
|
||||
UINT8 i;
|
||||
thinker_t *think;
|
||||
|
||||
// is there an SPB chasing anyone?
|
||||
if (spbplace != -1)
|
||||
return true;
|
||||
|
||||
// do any players have an SPB in their item slot?
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator)
|
||||
continue;
|
||||
|
||||
if (players[i].itemtype == KITEM_SPB)
|
||||
return true;
|
||||
}
|
||||
|
||||
// spbplace is still -1 until a fired SPB finds a target, so look for an in-map SPB just in case
|
||||
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
if (((mobj_t *)think)->type == MT_SPB)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//}
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ void K_SpawnSparkleTrail(mobj_t *mo);
|
|||
void K_SpawnWipeoutTrail(mobj_t *mo, boolean offroad);
|
||||
void K_SpawnDraftDust(mobj_t *mo);
|
||||
void K_DriftDustHandling(mobj_t *spawner);
|
||||
mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t mapthing, INT32 defaultDir, INT32 altthrow);
|
||||
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);
|
||||
|
|
@ -120,6 +121,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground);
|
|||
void K_CheckSpectateStatus(void);
|
||||
UINT8 K_GetInvincibilityItemFrame(void);
|
||||
UINT8 K_GetOrbinautItemFrame(UINT8 count);
|
||||
boolean K_IsSPBInGame(void);
|
||||
|
||||
// sound stuff for lua
|
||||
void K_PlayAttackTaunt(mobj_t *source);
|
||||
|
|
|
|||
|
|
@ -14687,6 +14687,8 @@ void P_RefreshItemCapsuleParts(mobj_t *mobj)
|
|||
}
|
||||
else if (mobj->spawnpoint && (mobj->spawnpoint->options & MTF_EXTRA))
|
||||
color = SKINCOLOR_SAPPHIRE;
|
||||
else if (itemType == KITEM_SPB)
|
||||
color = SKINCOLOR_JET;
|
||||
else
|
||||
color = SKINCOLOR_NONE;
|
||||
|
||||
|
|
@ -14743,6 +14745,7 @@ void P_RefreshItemCapsuleParts(mobj_t *mobj)
|
|||
count = mobj->movecount * 5;
|
||||
break;
|
||||
case KITEM_SAD: // never display the number
|
||||
case KITEM_SPB:
|
||||
break;
|
||||
default:
|
||||
if (mobj->movecount > 1)
|
||||
|
|
|
|||
|
|
@ -278,8 +278,10 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
P_KillMobj(special, toucher, toucher, DMG_NORMAL);
|
||||
break;
|
||||
case MT_ITEMCAPSULE:
|
||||
if (special->threshold != KITEM_SUPERRING && !P_CanPickupItem(player, 1))
|
||||
return;
|
||||
if (special->threshold != KITEM_SUPERRING
|
||||
&& special->threshold != KITEM_SPB
|
||||
&& !P_CanPickupItem(player, 1))
|
||||
return;
|
||||
|
||||
if ((gametyperules & GTR_BUMPERS) && player->bumpers <= 0)
|
||||
return;
|
||||
|
|
@ -287,6 +289,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
if (special->scale < special->extravalue1) // don't break it while it's respawning
|
||||
return;
|
||||
|
||||
if (special->threshold == KITEM_SPB && K_IsSPBInGame()) // don't spawn a second SPB
|
||||
return;
|
||||
|
||||
S_StartSound(toucher, special->info->deathsound);
|
||||
P_KillMobj(special, toucher, toucher, DMG_NORMAL);
|
||||
return;
|
||||
|
|
@ -1376,6 +1381,13 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
|
|||
break;
|
||||
}
|
||||
|
||||
// special behavior for SPB capsules
|
||||
if (target->threshold == KITEM_SPB)
|
||||
{
|
||||
K_ThrowKartItem(player, true, MT_SPB, 1, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
if (target->threshold < 1 || target->threshold >= NUMKARTITEMS) // bruh moment prevention
|
||||
{
|
||||
player->itemtype = KITEM_SAD;
|
||||
|
|
|
|||
|
|
@ -9439,6 +9439,8 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
|||
#if 0 // set to 1 to test capsules with random items, e.g. with objectplace
|
||||
if (P_RandomChance(FRACUNIT/3))
|
||||
mobj->threshold = KITEM_SUPERRING;
|
||||
else if (P_RandomChance(FRACUNIT/3))
|
||||
mobj->threshold = KITEM_SPB;
|
||||
else if (P_RandomChance(FRACUNIT/3))
|
||||
mobj->threshold = KITEM_ORBINAUT;
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue