diff --git a/src/p_mobj.c b/src/p_mobj.c index 29dfecf78..1fe6af87a 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2191,17 +2191,6 @@ boolean P_ZMovement(mobj_t *mo) case MT_BIGTUMBLEWEED: case MT_LITTLETUMBLEWEED: case MT_SHELL: - // SRB2kart stuff that should die in pits - // Shouldn't stop moving along the Z if there's no speed though! - case MT_EGGMANITEM: - case MT_BANANA: - case MT_ORBINAUT: - case MT_JAWZ: - case MT_BALLHOG: - case MT_SSMINE: - case MT_LANDMINE: - case MT_DROPTARGET: - case MT_BUBBLESHIELDTRAP: // Remove stuff from death pits. if (P_CheckDeathPitCollide(mo)) { @@ -2283,6 +2272,17 @@ boolean P_ZMovement(mobj_t *mo) } break; default: + // SRB2kart stuff that should die in pits + // Shouldn't stop moving along the Z if there's no speed though! + if (P_CanDeleteKartItem(mo->type)) + { + // Remove stuff from death pits. + if (P_CheckDeathPitCollide(mo)) + { + P_RemoveMobj(mo); + return false; + } + } break; } @@ -5114,20 +5114,58 @@ cont: } // Kartitem stuff. + +// This item is never attached to a player -- it can DIE +// unconditionally in death sectors. +boolean P_IsKartFieldItem(INT32 type) +{ + switch (type) + { + case MT_BANANA: + case MT_EGGMANITEM: + case MT_ORBINAUT: + case MT_JAWZ: + case MT_SSMINE: + case MT_LANDMINE: + case MT_BALLHOG: + case MT_BUBBLESHIELDTRAP: + case MT_POGOSPRING: + case MT_SINK: + case MT_DROPTARGET: + return true; + + default: + return false; + } +} + boolean P_IsKartItem(INT32 type) { - if (type == MT_EGGMANITEM || type == MT_EGGMANITEM_SHIELD || - type == MT_BANANA || type == MT_BANANA_SHIELD || - type == MT_DROPTARGET || type == MT_DROPTARGET_SHIELD || - type == MT_ORBINAUT || type == MT_ORBINAUT_SHIELD || - type == MT_JAWZ || type == MT_JAWZ_SHIELD || - type == MT_SSMINE || type == MT_SSMINE_SHIELD || - type == MT_SINK || type == MT_SINK_SHIELD || - type == MT_SPB || type == MT_BALLHOG || type == MT_BUBBLESHIELDTRAP || - type == MT_LANDMINE) - return true; - else - return false; + switch (type) + { + case MT_EGGMANITEM_SHIELD: + case MT_BANANA_SHIELD: + case MT_DROPTARGET_SHIELD: + case MT_ORBINAUT_SHIELD: + case MT_JAWZ_SHIELD: + case MT_SSMINE_SHIELD: + case MT_SINK_SHIELD: + case MT_SPB: + case MT_HYUDORO: + return true; + + default: + return P_IsKartFieldItem(type); + } +} + +// This item can die in death sectors. There may be some +// special conditions for items that don't switch types... +// TODO: just make a general function for things that should +// die like this? +boolean P_CanDeleteKartItem(INT32 type) +{ + return P_IsKartFieldItem(type); } // Called when a kart item "thinks" @@ -9453,11 +9491,7 @@ void P_MobjThinker(mobj_t *mobj) return; // Destroy items sector special - if (mobj->type == MT_BANANA || mobj->type == MT_EGGMANITEM - || mobj->type == MT_ORBINAUT || mobj->type == MT_BALLHOG - || mobj->type == MT_JAWZ - || mobj->type == MT_SSMINE || mobj->type == MT_BUBBLESHIELDTRAP - || mobj->type == MT_LANDMINE) + if (P_CanDeleteKartItems(mobj->type)) { if (mobj->health > 0 && P_MobjTouchingSectorSpecial(mobj, 4, 7, true)) { diff --git a/src/p_mobj.h b/src/p_mobj.h index 1755ea81d..19cd1c77a 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -500,7 +500,9 @@ void P_RunCachedActions(void); void P_AddCachedAction(mobj_t *mobj, INT32 statenum); // kartitem stuff: Returns true if the specified 'type' is one of the kart item constants we want in the kitemcap list +boolean P_IsKartFieldItem(INT32 type); boolean P_IsKartItem(INT32 type); +boolean P_CanDeleteKartItem(INT32 type); void P_AddKartItem(mobj_t *thing); // needs to be called in k_kart.c void P_RunKartItems(void);