Give explosion particle mobjs the target of who spawned it (bomb thrower, blue lightning user)

So that explosion particles can trigger voice lines (and not crash) and add points for players in battle
Also don't play voice lines when you hit yourself
This commit is contained in:
Sryder13 2017-11-05 17:15:19 +00:00
parent 10818f254b
commit 351670513d
4 changed files with 8 additions and 5 deletions

View File

@ -1613,7 +1613,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source)
|| player->kartstuff[k_startimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_bootaketimer] > 0)
return;
if (source && source->player && !source->player->kartstuff[k_sounds])
if (source && source != player->mo && source->player && !source->player->kartstuff[k_sounds])
{
S_StartSound(source, sfx_hitem);
source->player->kartstuff[k_sounds] = 50;
@ -1715,7 +1715,8 @@ void K_ExplodePlayer(player_t *player, mobj_t *source) // A bit of a hack, we ju
return;
}
void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, angle_t rotangle, boolean spawncenter, boolean ghostit)
// source is the mobj that originally threw the bomb that exploded etc.
void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, angle_t rotangle, boolean spawncenter, boolean ghostit, mobj_t *source)
{
mobj_t *mobj;
mobj_t *ghost = NULL;
@ -1795,6 +1796,7 @@ void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32
mobj->flags |= MF_NOCLIPTHING;
mobj->flags &= ~MF_SPECIAL;
P_SetTarget(&mobj->target, source);
}
}

View File

@ -21,7 +21,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd);
void K_SpinPlayer(player_t *player, mobj_t *source);
void K_SquishPlayer(player_t *player, mobj_t *source);
void K_ExplodePlayer(player_t *player, mobj_t *source);
void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, angle_t rotangle, boolean spawncenter, boolean ghostit);
void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, angle_t rotangle, boolean spawncenter, boolean ghostit, mobj_t *source);
void K_SpawnDriftTrail(player_t *player);
void K_DoMushroom(player_t *player, boolean doPFlag, boolean startboost);
INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue);

View File

@ -8253,7 +8253,7 @@ void A_BobombExplode(mobj_t *actor)
type = (mobjtype_t)locvar1;
for (d = 0; d < 16; d++)
K_SpawnKartExplosion(actor->x, actor->y, actor->z, actor->info->painchance + 32*FRACUNIT, 32, type, d*(ANGLE_45/4), false, false); // 32 <-> 64
K_SpawnKartExplosion(actor->x, actor->y, actor->z, actor->info->painchance + 32*FRACUNIT, 32, type, d*(ANGLE_45/4), false, false, actor->target); // 32 <-> 64
P_SpawnMobj(actor->x, actor->y, actor->z, MT_BOMBEXPLOSIONSOUND);

View File

@ -3092,7 +3092,8 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
{
// Just need to do this now! Being thrown upwards is done by the explosion.
P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BLUELIGHTNING);
P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BLUEEXPLOSION);
mobj_t *blueexplode = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BLUEEXPLOSION);
P_SetTarget(&blueexplode->target, source);
return true;
}
else if (damage == 65 && player->kartstuff[k_position] > 1)