diff --git a/src/k_collide.c b/src/k_collide.c index 963ec4e64..48b20c8a1 100644 --- a/src/k_collide.c +++ b/src/k_collide.c @@ -404,3 +404,32 @@ boolean K_SMKIceBlockCollide(mobj_t *t1, mobj_t *t2) K_KartBouncing(t2, t1, false, true); return false; } + +boolean K_FloatingItemCollide(mobj_t *t1, mobj_t *t2) +{ + player_t * player = t2->player; + + if (! player) + return true; + + if (!P_CanPickupItem(player, 3) || (player->kartstuff[k_itemamount] && player->kartstuff[k_itemtype] != t1->threshold)) + return true; + + if ((gametyperules & GTR_BUMPERS) && player->bumpers <= 0) + return true; + + player->kartstuff[k_itemtype] = t2->threshold; + player->kartstuff[k_itemamount] += t2->movecount; + if (player->kartstuff[k_itemamount] > 255) + player->kartstuff[k_itemamount] = 255; + + S_StartSound(t1, t1->info->deathsound); + + P_SetTarget(&t1->tracer, t2); + t1->flags2 |= MF2_NIGHTSPULL; + t1->destscale = mapobjectscale>>4; + t1->scalespeed <<= 1; + + t1->flags &= ~MF_SPECIAL; + return false; +} diff --git a/src/k_collide.h b/src/k_collide.h index 86f643b3f..fed8969d6 100644 --- a/src/k_collide.h +++ b/src/k_collide.h @@ -12,5 +12,6 @@ boolean K_MineExplosionCollide(mobj_t *t1, mobj_t *t2); boolean K_KitchenSinkCollide(mobj_t *t1, mobj_t *t2); boolean K_FallingRockCollide(mobj_t *t1, mobj_t *t2); boolean K_SMKIceBlockCollide(mobj_t *t1, mobj_t *t2); +boolean K_FloatingItemCollide(mobj_t *t1, mobj_t *t2); #endif diff --git a/src/p_inter.c b/src/p_inter.c index e190e1274..08bd29fdf 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -231,27 +231,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) P_SetObjectMomZ(player->mo, 12<mo, player->mo->angle, 20<kartstuff[k_itemamount] && player->kartstuff[k_itemtype] != special->threshold)) - return; - - if ((gametyperules & GTR_BUMPERS) && player->bumpers <= 0) - return; - - player->kartstuff[k_itemtype] = special->threshold; - player->kartstuff[k_itemamount] += special->movecount; - if (player->kartstuff[k_itemamount] > 255) - player->kartstuff[k_itemamount] = 255; - - S_StartSound(special, special->info->deathsound); - - P_SetTarget(&special->tracer, toucher); - special->flags2 |= MF2_NIGHTSPULL; - special->destscale = mapobjectscale>>4; - special->scalespeed <<= 1; - - special->flags &= ~MF_SPECIAL; - return; case MT_RANDOMITEM: // SRB2kart if (!P_CanPickupItem(player, 1)) return; diff --git a/src/p_map.c b/src/p_map.c index 7a0958f7f..bea4849dd 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -970,6 +970,27 @@ static boolean PIT_CheckThing(mobj_t *thing) return K_FallingRockCollide(thing, tmthing); } + if (tmthing->type == MT_FLOATINGITEM) + { + // see if it went over / under + if (tmthing->z > thing->z + thing->height) + return true; // overhead + if (tmthing->z + tmthing->height < thing->z - thing->height) // extended hitbox + return true; // underneath + + return K_FloatingItemCollide(tmthing, thing); + } + else if (thing->type == MT_FLOATINGITEM) + { + // see if it went over / under + if (tmthing->z > thing->z + thing->height) + return true; // overhead + if (tmthing->z + tmthing->height < thing->z - thing->height) // extended hitbox + return true; // underneath + + return K_FloatingItemCollide(thing, tmthing); + } + //} if ((thing->type == MT_SPRINGSHELL || thing->type == MT_YELLOWSHELL) && thing->health > 0