Paper item hitbox extends just as far below

This commit is contained in:
James R 2020-10-28 23:48:16 -07:00
parent 4d8447dc1c
commit cb941050e2
4 changed files with 51 additions and 21 deletions

View file

@ -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;
}

View file

@ -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

View file

@ -231,27 +231,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
P_SetObjectMomZ(player->mo, 12<<FRACBITS, false);
P_InstaThrust(player->mo, player->mo->angle, 20<<FRACBITS);
return;
case MT_FLOATINGITEM: // SRB2kart
if (!P_CanPickupItem(player, 3) || (player->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;

View file

@ -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