Add another file to handle Kart item collision functions, now items can damage anything with MF_SHOOTABLE

Now this code won't make me pull out my hair. Could possibly be enhanced by using a function or define to handle the big copy-pasted tmthing/thing switch blocks in p_map, but for now I'm way happier.

As a result, Battle capsules are now destructible.
This commit is contained in:
TehRealSalt 2019-09-15 17:25:33 -04:00
parent b39482d721
commit cd65381abc
7 changed files with 418 additions and 383 deletions

View file

@ -489,6 +489,7 @@ OBJS:=$(i_main_o) \
$(OBJDIR)/y_inter.o \
$(OBJDIR)/st_stuff.o \
$(OBJDIR)/k_kart.o \
$(OBJDIR)/k_collide.o\
$(OBJDIR)/m_aatree.o \
$(OBJDIR)/m_anigif.o \
$(OBJDIR)/m_argv.o \

View file

@ -20159,7 +20159,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
{ // MT_BATTLECAPSULE
2333, // doomednum
S_INVISIBLE, // spawnstate
1000, // spawnhealth
1, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
8, // reactiontime

319
src/k_collide.c Normal file
View file

@ -0,0 +1,319 @@
/// \file k_collide.c
/// \brief SRB2Kart item collision hooks
#include "k_collide.h"
#include "doomtype.h"
#include "p_mobj.h"
#include "k_kart.h"
#include "p_local.h"
#include "s_sound.h"
#include "r_main.h" // R_PointToAngle2, R_PointToDist2
#include "hu_stuff.h" // Sink snipe print
#include "doomdef.h" // Sink snipe print
#include "g_game.h" // Sink snipe print
boolean K_OrbinautJawzCollide(mobj_t *t1, mobj_t *t2)
{
boolean damageitem = false;
if (((t1->target == t2) || (t1->target == t2->target)) && (t1->threshold > 0 || (t2->type != MT_PLAYER && t2->threshold > 0)))
return true;
if (t1->health <= 0 || t2->health <= 0)
return true;
if ((t1->type == MT_ORBINAUT_SHIELD || t1->type == MT_JAWZ_SHIELD) && t1->lastlook
&& (t2->type == MT_ORBINAUT_SHIELD || t2->type == MT_JAWZ_SHIELD) && t2->lastlook
&& (t1->target == t2->target)) // Don't hit each other if you have the same target
return true;
if (t2->player)
{
if (t2->player->powers[pw_flashing]
&& !(t1->type == MT_ORBINAUT || t1->type == MT_JAWZ || t1->type == MT_JAWZ_DUD))
return true;
if (t2->player->kartstuff[k_hyudorotimer])
return true; // no interaction
// Player Damage
P_DamageMobj(t2, t1, t1->target, 1);
K_KartBouncing(t2, t1, false, false);
S_StartSound(t2, sfx_s3k7b);
damageitem = true;
}
else if (t2->type == MT_ORBINAUT || t2->type == MT_JAWZ || t2->type == MT_JAWZ_DUD
|| t2->type == MT_ORBINAUT_SHIELD || t2->type == MT_JAWZ_SHIELD
|| t2->type == MT_BANANA || t2->type == MT_BANANA_SHIELD
|| t2->type == MT_BALLHOG)
{
// Other Item Damage
if (t2->eflags & MFE_VERTICALFLIP)
t2->z -= t2->height;
else
t2->z += t2->height;
S_StartSound(t2, t2->info->deathsound);
P_KillMobj(t2, t1, t1);
P_SetObjectMomZ(t2, 8*FRACUNIT, false);
P_InstaThrust(t2, R_PointToAngle2(t1->x, t1->y, t2->x, t2->y)+ANGLE_90, 16*FRACUNIT);
P_SpawnMobj(t2->x/2 + t1->x/2, t2->y/2 + t1->y/2, t2->z/2 + t1->z/2, MT_ITEMCLASH);
damageitem = true;
}
else if (t2->type == MT_SSMINE_SHIELD || t2->type == MT_SSMINE)
{
damageitem = true;
// Bomb death
P_KillMobj(t2, t1, t1);
}
else if (t2->flags & MF_SPRING && (t1->type != MT_ORBINAUT_SHIELD && t1->type != MT_JAWZ_SHIELD))
{
// Let thrown items hit springs!
P_DoSpring(t2, t1);
}
else if (t2->flags & MF_SHOOTABLE)
{
// Shootable damage
P_DamageMobj(t2, t2, t1->target, 1);
damageitem = true;
}
if (damageitem)
{
// This Item Damage
if (t1->eflags & MFE_VERTICALFLIP)
t1->z -= t1->height;
else
t1->z += t1->height;
S_StartSound(t1, t1->info->deathsound);
P_KillMobj(t1, t2, t2);
P_SetObjectMomZ(t1, 8*FRACUNIT, false);
P_InstaThrust(t1, R_PointToAngle2(t2->x, t2->y, t1->x, t1->y)+ANGLE_90, 16*FRACUNIT);
}
return true;
}
boolean K_BananaBallhogCollide(mobj_t *t1, mobj_t *t2)
{
boolean damageitem = false;
if (((t1->target == t2) || (t1->target == t2->target)) && (t1->threshold > 0 || (t2->type != MT_PLAYER && t2->threshold > 0)))
return true;
if (t1->health <= 0 || t2->health <= 0)
return true;
if (((t1->type == MT_BANANA_SHIELD) && (t2->type == MT_BANANA_SHIELD))
&& (t1->target == t2->target)) // Don't hit each other if you have the same target
return true;
if (t1->type == MT_BALLHOG && t2->type == MT_BALLHOG)
return true; // Ballhogs don't collide with eachother
if (t2->player)
{
if (t2->player->powers[pw_flashing])
return true;
// Banana snipe!
if (t1->type == MT_BANANA && t1->health > 1)
S_StartSound(t2, sfx_bsnipe);
// Player Damage
K_SpinPlayer(t2->player, t1->target, 0, t1, (t1->type == MT_BANANA || t1->type == MT_BANANA_SHIELD));
damageitem = true;
}
else if (t2->type == MT_BANANA || t2->type == MT_BANANA_SHIELD
|| t2->type == MT_ORBINAUT || t2->type == MT_ORBINAUT_SHIELD
|| t2->type == MT_JAWZ || t2->type == MT_JAWZ_DUD || t2->type == MT_JAWZ_SHIELD
|| t2->type == MT_BALLHOG)
{
// Other Item Damage
if (t2->eflags & MFE_VERTICALFLIP)
t2->z -= t2->height;
else
t2->z += t2->height;
S_StartSound(t2, t2->info->deathsound);
P_KillMobj(t2, t1, t1);
P_SetObjectMomZ(t2, 8*FRACUNIT, false);
P_InstaThrust(t2, R_PointToAngle2(t1->x, t1->y, t2->x, t2->y)+ANGLE_90, 16*FRACUNIT);
P_SpawnMobj(t2->x/2 + t1->x/2, t2->y/2 + t1->y/2, t2->z/2 + t1->z/2, MT_ITEMCLASH);
damageitem = true;
}
else if (t2->flags & MF_SHOOTABLE)
{
// Shootable damage
P_DamageMobj(t2, t2, t1->target, 1);
damageitem = true;
}
if (damageitem)
{
// This Item Damage
if (t1->eflags & MFE_VERTICALFLIP)
t1->z -= t1->height;
else
t1->z += t1->height;
S_StartSound(t1, t1->info->deathsound);
P_KillMobj(t1, t2, t2);
P_SetObjectMomZ(t1, 8*FRACUNIT, false);
P_InstaThrust(t1, R_PointToAngle2(t2->x, t2->y, t1->x, t1->y)+ANGLE_90, 16*FRACUNIT);
}
return true;
}
boolean K_EggItemCollide(mobj_t *t1, mobj_t *t2)
{
// Push fakes out of other item boxes
if (t2->type == MT_RANDOMITEM || t2->type == MT_EGGMANITEM)
P_InstaThrust(t1, R_PointToAngle2(t2->x, t2->y, t1->x, t1->y), t2->radius/4);
// Player collision is handled by TouchSpecial
return true;
}
boolean K_MineCollide(mobj_t *t1, mobj_t *t2)
{
if (((t1->target == t2) || (t1->target == t2->target)) && (t1->threshold > 0 || (t2->type != MT_PLAYER && t2->threshold > 0)))
return true;
if (t1->health <= 0 || t2->health <= 0)
return true;
if (t2->player)
{
if (t2->player->powers[pw_flashing])
return true;
// Bomb punting
if ((t1->state >= &states[S_SSMINE1] && t1->state <= &states[S_SSMINE4])
|| (t1->state >= &states[S_SSMINE_DEPLOY8] && t1->state <= &states[S_SSMINE_DEPLOY13]))
P_KillMobj(t1, t2, t2);
else
K_PuntMine(t1, t2);
}
else if (t2->type == MT_ORBINAUT || t2->type == MT_JAWZ || t2->type == MT_JAWZ_DUD
|| t2->type == MT_ORBINAUT_SHIELD || t2->type == MT_JAWZ_SHIELD)
{
// Bomb death
P_KillMobj(t1, t2, t2);
// Other Item Damage
if (t2->eflags & MFE_VERTICALFLIP)
t2->z -= t2->height;
else
t2->z += t2->height;
S_StartSound(t2, t2->info->deathsound);
P_KillMobj(t2, t1, t1);
P_SetObjectMomZ(t2, 8*FRACUNIT, false);
P_InstaThrust(t2, R_PointToAngle2(t1->x, t1->y, t2->x, t2->y)+ANGLE_90, 16*FRACUNIT);
}
else if (t2->flags & MF_SHOOTABLE)
{
// Bomb death
P_KillMobj(t1, t2, t2);
// Shootable damage
P_DamageMobj(t2, t2, t1->target, 1);
}
return true;
}
boolean K_MineExplosionCollide(mobj_t *t1, mobj_t *t2)
{
if (t2->player)
{
if (t2->player->powers[pw_flashing])
return true;
if (t1->state == &states[S_MINEEXPLOSION1])
K_ExplodePlayer(t2->player, t1->target, t1);
else
K_SpinPlayer(t2->player, t1->target, 0, t1, false);
}
else if (t2->flags & MF_SHOOTABLE)
{
// Shootable damage
P_DamageMobj(t2, t2, t1->target, 1);
}
return true;
}
boolean K_KitchenSinkCollide(mobj_t *t1, mobj_t *t2)
{
if (((t1->target == t2) || (t1->target == t2->target)) && (t1->threshold > 0 || (t2->type != MT_PLAYER && t2->threshold > 0)))
return true;
if (t2->player)
{
if (t2->player->powers[pw_flashing])
return true;
S_StartSound(NULL, sfx_bsnipe); // let all players hear it.
HU_SetCEchoFlags(0);
HU_SetCEchoDuration(5);
HU_DoCEcho(va("%s\\was hit by a kitchen sink.\\\\\\\\", player_names[t2->player-players]));
I_OutputMsg("%s was hit by a kitchen sink.\n", player_names[t2->player-players]);
P_DamageMobj(t2, t1, t1->target, 10000);
P_KillMobj(t1, t2, t2);
}
else if (t2->flags & MF_SHOOTABLE)
{
// Shootable damage
P_KillMobj(t2, t2, t1->target);
// This item damage
P_KillMobj(t1, t2, t2);
}
return true;
}
boolean K_FallingRockCollide(mobj_t *t1, mobj_t *t2)
{
if (t2->player || t2->type == MT_FALLINGROCK)
K_KartBouncing(t2, t1, false, false);
return true;
}
boolean K_SMKIceBlockCollide(mobj_t *t1, mobj_t *t2)
{
if (!(t2->flags & MF_SOLID || t2->flags & MF_SHOOTABLE || t2->flags & MF_BOUNCE))
return true;
if (!(t2->health))
return true;
if (t2->type == MT_BANANA || t2->type == MT_BANANA_SHIELD
|| t2->type == MT_EGGMANITEM || t2->type == MT_EGGMANITEM_SHIELD
|| t2->type == MT_SSMINE || t2->type == MT_SSMINE_SHIELD
|| t2->type == MT_ORBINAUT_SHIELD || t2->type == MT_JAWZ_SHIELD)
return false;
if (t1->health)
P_KillMobj(t1, t2, t2);
/*if (t2->player && (t2->player->kartstuff[k_invincibilitytimer] > 0
|| t2->player->kartstuff[k_growshrinktimer] > 0))
return true;*/
K_KartBouncing(t2, t1, false, true);
return false;
}

16
src/k_collide.h Normal file
View file

@ -0,0 +1,16 @@
#ifndef __K_COLLIDE__
#define __K_COLLIDE__
#include "doomtype.h"
#include "p_mobj.h"
boolean K_OrbinautJawzCollide(mobj_t *t1, mobj_t *t2);
boolean K_BananaBallhogCollide(mobj_t *t1, mobj_t *t2);
boolean K_EggItemCollide(mobj_t *t1, mobj_t *t2);
boolean K_MineCollide(mobj_t *t1, mobj_t *t2);
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);
#endif

View file

@ -2546,7 +2546,8 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
cur->momz = 8 * target->scale * P_MobjFlip(target);
cur->flags &= ~MF_NOGRAVITY;
cur->fuse = 24;
cur->tics = TICRATE;
cur->frame &= ~FF_ANIMATE; // Stop animating the propellers
cur = cur->hnext;
}

View file

@ -25,6 +25,7 @@
#include "s_sound.h"
#include "w_wad.h"
#include "k_kart.h" // SRB2kart 011617
#include "k_collide.h"
#include "hu_stuff.h" // SRB2kart
#include "i_system.h" // SRB2kart
@ -665,7 +666,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
// SRB2kart 011617 - Colission[sic] code for kart items //{
if (thing->type == MT_SMK_ICEBLOCK)
if (tmthing->type == MT_SMK_ICEBLOCK)
{
// see if it went over / under
if (tmthing->z > thing->z + thing->height)
@ -673,31 +674,20 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (tmthing->z + tmthing->height < thing->z)
return true; // underneath
if (!(tmthing->flags & MF_SOLID || tmthing->flags & MF_SHOOTABLE || tmthing->flags & MF_BOUNCE))
return true;
return K_SMKIceBlockCollide(tmthing, thing);
}
else if (thing->type == MT_SMK_ICEBLOCK)
{
// see if it went over / under
if (tmthing->z > thing->z + thing->height)
return true; // overhead
if (tmthing->z + tmthing->height < thing->z)
return true; // underneath
if (!(tmthing->health))
return true;
if (tmthing->type == MT_BANANA || tmthing->type == MT_BANANA_SHIELD
|| tmthing->type == MT_EGGMANITEM || tmthing->type == MT_EGGMANITEM_SHIELD
|| tmthing->type == MT_SSMINE || tmthing->type == MT_SSMINE_SHIELD
|| tmthing->type == MT_ORBINAUT_SHIELD || tmthing->type == MT_JAWZ_SHIELD)
return false;
if (thing->health)
P_KillMobj(thing, tmthing, tmthing);
/*if (tmthing->player && (tmthing->player->kartstuff[k_invincibilitytimer] > 0
|| tmthing->player->kartstuff[k_growshrinktimer] > 0))
return true;*/
K_KartBouncing(tmthing, thing, false, true);
return false;
return K_SMKIceBlockCollide(thing, tmthing);
}
// Push fakes out of other items
if (tmthing->type == MT_EGGMANITEM && (thing->type == MT_RANDOMITEM || thing->type == MT_EGGMANITEM))
if (tmthing->type == MT_EGGMANITEM)
{
// see if it went over / under
if (tmthing->z > thing->z + thing->height)
@ -705,10 +695,10 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (tmthing->z + tmthing->height < thing->z)
return true; // underneath
P_InstaThrust(tmthing, R_PointToAngle2(thing->x, thing->y, tmthing->x, tmthing->y), thing->radius/4);
K_EggItemCollide(tmthing, thing);
return true;
}
else if (thing->type == MT_EGGMANITEM && (tmthing->type == MT_RANDOMITEM || tmthing->type == MT_EGGMANITEM))
else if (thing->type == MT_EGGMANITEM)
{
// see if it went over / under
if (tmthing->z > thing->z + thing->height)
@ -716,7 +706,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (tmthing->z + tmthing->height < thing->z)
return true; // underneath
P_InstaThrust(thing, R_PointToAngle2(tmthing->x, tmthing->y, thing->x, thing->y), tmthing->radius/4);
K_EggItemCollide(thing, tmthing);
return true;
}
@ -732,97 +722,10 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (tmthing->z + tmthing->height < thing->z)
return true; // underneath
if (((tmthing->target == thing) || (tmthing->target == thing->target)) && (tmthing->threshold > 0 || (thing->type != MT_PLAYER && thing->threshold > 0)))
return true;
if (tmthing->health <= 0 || thing->health <= 0)
return true;
if ((tmthing->type == MT_ORBINAUT_SHIELD || tmthing->type == MT_JAWZ_SHIELD) && tmthing->lastlook
&& (thing->type == MT_ORBINAUT_SHIELD || thing->type == MT_JAWZ_SHIELD) && thing->lastlook
&& (tmthing->target == thing->target)) // Don't hit each other if you have the same target
return true;
if (thing->player && thing->player->powers[pw_flashing]
&& !(tmthing->type == MT_ORBINAUT || tmthing->type == MT_JAWZ || tmthing->type == MT_JAWZ_DUD))
return true;
if (thing->player && thing->player->kartstuff[k_hyudorotimer])
return true; // no interaction
if (thing->type == MT_PLAYER)
{
// Player Damage
P_DamageMobj(thing, tmthing, tmthing->target, 1);
K_KartBouncing(thing, tmthing, false, false);
S_StartSound(thing, sfx_s3k7b);
// This Item Damage
if (tmthing->eflags & MFE_VERTICALFLIP)
tmthing->z -= tmthing->height;
else
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);
}
else if (thing->type == MT_ORBINAUT || thing->type == MT_JAWZ || thing->type == MT_JAWZ_DUD
|| thing->type == MT_ORBINAUT_SHIELD || thing->type == MT_JAWZ_SHIELD
|| thing->type == MT_BANANA || thing->type == MT_BANANA_SHIELD
|| thing->type == MT_BALLHOG)
{
// Other Item Damage
if (thing->eflags & MFE_VERTICALFLIP)
thing->z -= thing->height;
else
thing->z += thing->height;
S_StartSound(thing, thing->info->deathsound);
P_KillMobj(thing, tmthing, tmthing);
P_SetObjectMomZ(thing, 8*FRACUNIT, false);
P_InstaThrust(thing, R_PointToAngle2(tmthing->x, tmthing->y, thing->x, thing->y)+ANGLE_90, 16*FRACUNIT);
P_SpawnMobj(thing->x/2 + tmthing->x/2, thing->y/2 + tmthing->y/2, thing->z/2 + tmthing->z/2, MT_ITEMCLASH);
// This Item Damage
if (tmthing->eflags & MFE_VERTICALFLIP)
tmthing->z -= tmthing->height;
else
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);
}
else if (thing->type == MT_SSMINE_SHIELD || thing->type == MT_SSMINE)
{
// This Item Damage
if (tmthing->eflags & MFE_VERTICALFLIP)
tmthing->z -= tmthing->height;
else
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);
// Bomb death
P_KillMobj(thing, tmthing, tmthing);
}
else if (thing->flags & MF_SPRING && (tmthing->type == MT_JAWZ || tmthing->type == MT_JAWZ_DUD || tmthing->type == MT_ORBINAUT))
P_DoSpring(thing, tmthing);
return true;
return K_OrbinautJawzCollide(tmthing, thing);
}
else if (tmthing->flags & MF_SPRING && (thing->type == MT_JAWZ || thing->type == MT_JAWZ_DUD || thing->type == MT_ORBINAUT))
else if (thing->type == MT_ORBINAUT || thing->type == MT_JAWZ || thing->type == MT_JAWZ_DUD
|| thing->type == MT_ORBINAUT_SHIELD || thing->type == MT_JAWZ_SHIELD)
{
// see if it went over / under
if (tmthing->z > thing->z + thing->height)
@ -830,14 +733,10 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (tmthing->z + tmthing->height < thing->z)
return true; // underneath
if (thing->health <= 0)
return true;
P_DoSpring(tmthing, thing);
return true;
return K_OrbinautJawzCollide(thing, tmthing);
}
else if (tmthing->type == MT_SINK)
if (tmthing->type == MT_BANANA || tmthing->type == MT_BANANA_SHIELD || tmthing->type == MT_BALLHOG)
{
// see if it went over / under
if (tmthing->z > thing->z + thing->height)
@ -845,26 +744,9 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (tmthing->z + tmthing->height < thing->z)
return true; // underneath
if (((tmthing->target == thing) || (tmthing->target == thing->target)) && (tmthing->threshold > 0 || (thing->type != MT_PLAYER && thing->threshold > 0)))
return true;
if (thing->player && thing->player->powers[pw_flashing])
return true;
if (thing->type == MT_PLAYER)
{
S_StartSound(NULL, sfx_bsnipe); //let all players hear it.
HU_SetCEchoFlags(0);
HU_SetCEchoDuration(5);
HU_DoCEcho(va("%s\\was hit by a kitchen sink.\\\\\\\\", player_names[thing->player-players]));
I_OutputMsg("%s was hit by a kitchen sink.\n", player_names[thing->player-players]);
P_DamageMobj(thing, tmthing, tmthing->target, 10000);
P_KillMobj(tmthing, thing, thing);
}
return true;
return K_BananaBallhogCollide(tmthing, thing);
}
else if (tmthing->type == MT_MINEEXPLOSION)
else if (thing->type == MT_BANANA || thing->type == MT_BANANA_SHIELD || thing->type == MT_BALLHOG)
{
// see if it went over / under
if (tmthing->z > thing->z + thing->height)
@ -872,24 +754,10 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (tmthing->z + tmthing->height < thing->z)
return true; // underneath
if (!(thing->type == MT_PLAYER))
return true;
if (thing->player && thing->player->powers[pw_flashing])
return true;
if (thing->type == MT_PLAYER && thing->player)
{
if (tmthing->state == &states[S_MINEEXPLOSION1])
K_ExplodePlayer(thing->player, tmthing->target, tmthing);
else
K_SpinPlayer(thing->player, tmthing->target, 0, tmthing, false);
}
return true; // This doesn't collide with anything, but we want it to effect the player anyway.
return K_BananaBallhogCollide(thing, tmthing);
}
else if (tmthing->type == MT_BANANA_SHIELD || tmthing->type == MT_BANANA
|| tmthing->type == MT_BALLHOG)
if (tmthing->type == MT_SSMINE || tmthing->type == MT_SSMINE_SHIELD)
{
// see if it went over / under
if (tmthing->z > thing->z + thing->height)
@ -897,78 +765,9 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (tmthing->z + tmthing->height < thing->z)
return true; // underneath
if (((tmthing->target == thing) || (tmthing->target == thing->target)) && (tmthing->threshold > 0 || (thing->type != MT_PLAYER && thing->threshold > 0)))
return true;
if (tmthing->health <= 0 || thing->health <= 0)
return true;
if (((tmthing->type == MT_BANANA_SHIELD) && (thing->type == MT_BANANA_SHIELD))
&& (tmthing->target == thing->target)) // Don't hit each other if you have the same target
return true;
if (tmthing->type == MT_BALLHOG && thing->type == MT_BALLHOG)
return true; // Ballhogs don't collide with eachother
if (thing->player && thing->player->powers[pw_flashing])
return true;
if (thing->type == MT_PLAYER)
{
// Banana snipe!
if (tmthing->type == MT_BANANA && tmthing->health > 1)
S_StartSound(thing, sfx_bsnipe);
// Player Damage
K_SpinPlayer(thing->player, tmthing->target, 0, tmthing, (tmthing->type == MT_BANANA || tmthing->type == MT_BANANA_SHIELD));
// This Item Damage
if (tmthing->eflags & MFE_VERTICALFLIP)
tmthing->z -= tmthing->height;
else
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);
}
else if (thing->type == MT_BANANA || thing->type == MT_BANANA_SHIELD
|| thing->type == MT_ORBINAUT || thing->type == MT_ORBINAUT_SHIELD
|| thing->type == MT_JAWZ || thing->type == MT_JAWZ_DUD || thing->type == MT_JAWZ_SHIELD
|| thing->type == MT_BALLHOG)
{
// Other Item Damage
if (thing->eflags & MFE_VERTICALFLIP)
thing->z -= thing->height;
else
thing->z += thing->height;
S_StartSound(thing, thing->info->deathsound);
P_KillMobj(thing, tmthing, tmthing);
P_SetObjectMomZ(thing, 8*FRACUNIT, false);
P_InstaThrust(thing, R_PointToAngle2(tmthing->x, tmthing->y, thing->x, thing->y)+ANGLE_90, 16*FRACUNIT);
P_SpawnMobj(thing->x/2 + tmthing->x/2, thing->y/2 + tmthing->y/2, thing->z/2 + tmthing->z/2, MT_ITEMCLASH);
// This Item Damage
if (tmthing->eflags & MFE_VERTICALFLIP)
tmthing->z -= tmthing->height;
else
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);
}
return true;
return K_MineCollide(tmthing, thing);
}
else if (tmthing->type == MT_SSMINE_SHIELD || tmthing->type == MT_SSMINE)
else if (thing->type == MT_SSMINE || thing->type == MT_SSMINE_SHIELD)
{
// see if it went over / under
if (tmthing->z > thing->z + thing->height)
@ -976,52 +775,10 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (tmthing->z + tmthing->height < thing->z)
return true; // underneath
if (((tmthing->target == thing) || (tmthing->target == thing->target)) && (tmthing->threshold > 0 || (thing->type != MT_PLAYER && thing->threshold > 0)))
return true;
if (tmthing->health <= 0 || thing->health <= 0)
return true;
if (thing->player && thing->player->powers[pw_flashing])
return true;
if (thing->type == MT_PLAYER)
{
// Bomb punting
if ((tmthing->state >= &states[S_SSMINE1] && tmthing->state <= &states[S_SSMINE4])
|| (tmthing->state >= &states[S_SSMINE_DEPLOY8] && tmthing->state <= &states[S_SSMINE_DEPLOY13]))
P_KillMobj(tmthing, thing, thing);
else
K_PuntMine(tmthing, thing);
}
else if (thing->type == MT_ORBINAUT || thing->type == MT_JAWZ || thing->type == MT_JAWZ_DUD
|| thing->type == MT_ORBINAUT_SHIELD || thing->type == MT_JAWZ_SHIELD)
{
P_KillMobj(tmthing, thing, thing);
// Other Item Damage
if (thing->eflags & MFE_VERTICALFLIP)
thing->z -= thing->height;
else
thing->z += thing->height;
S_StartSound(thing, thing->info->deathsound);
P_KillMobj(thing, tmthing, tmthing);
P_SetObjectMomZ(thing, 8*FRACUNIT, false);
P_InstaThrust(thing, R_PointToAngle2(tmthing->x, tmthing->y, thing->x, thing->y)+ANGLE_90, 16*FRACUNIT);
}
return true;
return K_MineCollide(thing, tmthing);
}
else if (tmthing->type == MT_PLAYER &&
(thing->type == MT_ORBINAUT_SHIELD || thing->type == MT_ORBINAUT
|| thing->type == MT_JAWZ_SHIELD || thing->type == MT_JAWZ || thing->type == MT_JAWZ_DUD
|| thing->type == MT_BANANA_SHIELD || thing->type == MT_BANANA
|| thing->type == MT_SSMINE_SHIELD || thing->type == MT_SSMINE
|| thing->type == MT_MINEEXPLOSION
|| thing->type == MT_SINK || thing->type == MT_BALLHOG
))
if (tmthing->type == MT_MINEEXPLOSION)
{
// see if it went over / under
if (tmthing->z > thing->z + thing->height)
@ -1029,122 +786,63 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (tmthing->z + tmthing->height < thing->z)
return true; // underneath
if (tmthing->player && tmthing->player->powers[pw_flashing]
&& !(thing->type == MT_ORBINAUT || thing->type == MT_JAWZ || thing->type == MT_JAWZ_DUD))
return true;
return K_MineExplosionCollide(tmthing, thing);
}
else if (thing->type == MT_MINEEXPLOSION)
{
// see if it went over / under
if (tmthing->z > thing->z + thing->height)
return true; // overhead
if (tmthing->z + tmthing->height < thing->z)
return true; // underneath
if (tmthing->player && tmthing->player->kartstuff[k_hyudorotimer]) // I thought about doing this for just the objects below but figured it should apply to everything.
return true; // no interaction
return K_MineExplosionCollide(thing, tmthing);
}
if (thing->type == MT_ORBINAUT_SHIELD || thing->type == MT_JAWZ_SHIELD
|| thing->type == MT_ORBINAUT || thing->type == MT_JAWZ || thing->type == MT_JAWZ_DUD)
{
if ((thing->target == tmthing) && (thing->threshold > 0))
return true;
if (tmthing->type == MT_SINK)
{
// see if it went over / under
if (tmthing->z > thing->z + thing->height)
return true; // overhead
if (tmthing->z + tmthing->height < thing->z)
return true; // underneath
if (tmthing->health <= 0 || thing->health <= 0)
return true;
return K_KitchenSinkCollide(tmthing, thing);
}
else if (thing->type == MT_SINK)
{
// see if it went over / under
if (tmthing->z > thing->z + thing->height)
return true; // overhead
if (tmthing->z + tmthing->height < thing->z)
return true; // underneath
// Player Damage
P_DamageMobj(tmthing, thing, thing->target, 1);
K_KartBouncing(tmthing, thing, false, false);
S_StartSound(tmthing, sfx_s3k7b);
return K_KitchenSinkCollide(thing, tmthing);
}
// Other Item Damage
if (thing->eflags & MFE_VERTICALFLIP)
thing->z -= thing->height;
else
thing->z += thing->height;
if (tmthing->type == MT_FALLINGROCK)
{
// see if it went over / under
if (tmthing->z > thing->z + thing->height)
return true; // overhead
if (tmthing->z + tmthing->height < thing->z)
return true; // underneath
S_StartSound(thing, thing->info->deathsound);
P_KillMobj(thing, tmthing, tmthing);
return K_FallingRockCollide(tmthing, thing);
}
else if (thing->type == MT_FALLINGROCK)
{
// see if it went over / under
if (tmthing->z > thing->z + thing->height)
return true; // overhead
if (tmthing->z + tmthing->height < thing->z)
return true; // underneath
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_BANANA_SHIELD || thing->type == MT_BANANA
|| thing->type == MT_BALLHOG)
{
if ((thing->target == tmthing) && (thing->threshold > 0))
return true;
if (tmthing->health <= 0 || thing->health <= 0)
return true;
// Banana snipe!
if (thing->type == MT_BANANA && thing->health > 1)
S_StartSound(tmthing, sfx_bsnipe);
// Player Damage
K_SpinPlayer(tmthing->player, thing->target, 0, thing, (thing->type == MT_BANANA || thing->type == MT_BANANA_SHIELD));
// Other Item Damage
if (thing->eflags & MFE_VERTICALFLIP)
thing->z -= thing->height;
else
thing->z += thing->height;
S_StartSound(thing, thing->info->deathsound);
P_KillMobj(thing, tmthing, tmthing);
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_SSMINE_SHIELD || thing->type == MT_SSMINE)
{
if ((thing->target == tmthing) && (thing->threshold > 0))
return true;
if (tmthing->health <= 0 || thing->health <= 0)
return true;
// Bomb punting
if ((thing->state >= &states[S_SSMINE1] && thing->state <= &states[S_SSMINE4])
|| (thing->state >= &states[S_SSMINE_DEPLOY8] && thing->state <= &states[S_SSMINE_DEPLOY13]))
P_KillMobj(thing, tmthing, tmthing);
else
K_PuntMine(thing, tmthing);
}
else if (thing->type == MT_MINEEXPLOSION && tmthing->player)
{
// Player Damage
if (thing->state == &states[S_MINEEXPLOSION1])
K_ExplodePlayer(tmthing->player, thing->target, thing);
else
K_SpinPlayer(tmthing->player, thing->target, 0, thing, false);
return true;
}
else if (thing->type == MT_SINK)
{
if ((thing->target == tmthing) && (thing->threshold > 0))
return true;
S_StartSound(NULL, sfx_cgot); //let all players hear it.
HU_SetCEchoFlags(0);
HU_SetCEchoDuration(5);
HU_DoCEcho(va("%s\\was hit by a kitchen sink.\\\\\\\\", player_names[tmthing->player-players]));
I_OutputMsg("%s was hit by a kitchen sink.\n", player_names[tmthing->player-players]);
P_DamageMobj(tmthing, thing, thing->target, 10000);
P_KillMobj(thing, tmthing, tmthing);
}
return true;
return K_FallingRockCollide(thing, tmthing);
}
//}
if ((thing->type == MT_FALLINGROCK && (tmthing->player || tmthing->type == MT_FALLINGROCK))
|| (tmthing->type == MT_FALLINGROCK && (thing->player || thing->type == MT_FALLINGROCK)))
{
// see if it went over / under
if (tmthing->z > thing->z + thing->height)
return true; // overhead
if (tmthing->z + tmthing->height < thing->z)
return true; // underneath
K_KartBouncing(thing, tmthing, false, false);
}
if ((thing->type == MT_SPRINGSHELL || thing->type == MT_YELLOWSHELL) && thing->health > 0
&& (tmthing->player || (tmthing->flags & MF_PUSHABLE)) && tmthing->health > 0)
{

View file

@ -6965,7 +6965,7 @@ void P_MobjThinker(mobj_t *mobj)
if (mobj->flags2 & MF2_OBJECTFLIP)
mobj->eflags |= MFE_VERTICALFLIP;
if (mobj->fuse)
if (mobj->tics > 0)
mobj->flags2 ^= MF2_DONTDRAW;
break;
//}