diff --git a/src/k_kart.c b/src/k_kart.c index 7278f815e..750e9d747 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6349,15 +6349,15 @@ void K_KartUpdatePosition(player_t *player) player->kartstuff[k_position] = position; } -static mobj_t *K_SpawnOrMoveMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, mobj_t *source, int id) +mobj_t *K_SpawnOrMoveMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, mobj_t **ref) { - mobj_t *mobj = source->watertrail[id]; + mobj_t *mobj = *ref; if (!mobj || P_MobjWasRemoved(mobj)) { mobj = P_SpawnMobj(x, y, z, type); - P_SetTarget(&source->watertrail[id], mobj); + P_SetTarget(ref, mobj); } else { @@ -6475,7 +6475,7 @@ void K_SpawnWaterRunParticles(mobj_t *mobj) // underlay water = K_SpawnOrMoveMobj(x1, y1, ((mobj->eflags & MFE_VERTICALFLIP) ? mobj->waterbottom - FixedMul(mobjinfo[watertrailunderlay].height, mobj->scale) : mobj->watertop), watertrailunderlay, - mobj, 0); + &mobj->vfx[VFX_WATERTRAIL_LEFT_UNDERLAY]); water->angle = forwardangle - ANGLE_180 - ANGLE_22h; water->destscale = trailScale; water->momx = mobj->momx; @@ -6488,7 +6488,7 @@ void K_SpawnWaterRunParticles(mobj_t *mobj) // overlay water = K_SpawnOrMoveMobj(x1, y1, ((mobj->eflags & MFE_VERTICALFLIP) ? mobj->waterbottom - FixedMul(mobjinfo[watertrail].height, mobj->scale) : mobj->watertop), watertrail, - mobj, 1); + &mobj->vfx[VFX_WATERTRAIL_LEFT_OVERLAY]); water->angle = forwardangle - ANGLE_180 - ANGLE_22h; water->destscale = trailScale; water->momx = mobj->momx; @@ -6502,7 +6502,7 @@ void K_SpawnWaterRunParticles(mobj_t *mobj) // Underlay water = K_SpawnOrMoveMobj(x2, y2, ((mobj->eflags & MFE_VERTICALFLIP) ? mobj->waterbottom - FixedMul(mobjinfo[watertrailunderlay].height, mobj->scale) : mobj->watertop), watertrailunderlay, - mobj, 2); + &mobj->vfx[VFX_WATERTRAIL_RIGHT_UNDERLAY]); water->angle = forwardangle - ANGLE_180 + ANGLE_22h; water->destscale = trailScale; water->momx = mobj->momx; @@ -6515,7 +6515,7 @@ void K_SpawnWaterRunParticles(mobj_t *mobj) // Overlay water = K_SpawnOrMoveMobj(x2, y2, ((mobj->eflags & MFE_VERTICALFLIP) ? mobj->waterbottom - FixedMul(mobjinfo[watertrail].height, mobj->scale) : mobj->watertop), watertrail, - mobj, 3); + &mobj->vfx[VFX_WATERTRAIL_RIGHT_OVERLAY]); water->angle = forwardangle - ANGLE_180 + ANGLE_22h; water->destscale = trailScale; water->momx = mobj->momx; diff --git a/src/k_kart.h b/src/k_kart.h index 24e1f7020..eb94d3c9e 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -95,6 +95,7 @@ void K_CalculateBattleWanted(void); void K_CheckBumpers(void); void K_CheckSpectateStatus(void); void K_UpdateSpectateGrief(void); +mobj_t *K_SpawnOrMoveMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, mobj_t **ref); void K_SpawnWaterRunParticles(mobj_t *mobj); // sound stuff for lua diff --git a/src/p_mobj.h b/src/p_mobj.h index 133af34ee..b5e2a23b1 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -262,6 +262,15 @@ typedef enum { PCF_THUNK = 1<<5, // Ran the thinker this tic. } precipflag_t; +typedef enum { + VFX_WATERTRAIL_LEFT_UNDERLAY = 0, + VFX_WATERTRAIL_LEFT_OVERLAY, + VFX_WATERTRAIL_RIGHT_UNDERLAY, + VFX_WATERTRAIL_RIGHT_OVERLAY, + + NUMMOBJVFX, +} mobjvfx_t; + // Map Object definition. typedef struct mobj_s { @@ -409,7 +418,7 @@ typedef struct mobj_s boolean init_salty; // WARNING: New fields must be added separately to savegame and Lua. - struct mobj_s *watertrail[4]; + struct mobj_s *vfx[NUMMOBJVFX]; } mobj_t; //