Skip to content

Commit

Permalink
Added PRESERVE_MOMENTUM PROJECTILE_SPECIAL flag
Browse files Browse the repository at this point in the history
  • Loading branch information
dashodanger committed Sep 4, 2023
1 parent 29b9da2 commit 8c9dddc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions source_files/ddf/thing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1675,6 +1675,7 @@ static const specflags_t normal_specials[] =
{"DROPPED", MF_DROPPED, 0},
{"CORPSE", MF_CORPSE, 0},
{"STEALTH", MF_STEALTH, 0},
{"PRESERVE_MOMENTUM", MF_PRESERVEMOMENTUM, 0},
{"DEATHMATCH", MF_NOTDMATCH, 1},
{"TOUCHY", MF_TOUCHY, 0},
{NULL, 0, 0}
Expand Down
3 changes: 2 additions & 1 deletion source_files/ddf/thing.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ typedef enum
// Monster grows (in)visible at certain times.
MF_STEALTH = (1 << 26),

// NO LONGER USED (1 << 27), // was: JUSTPICKEDUP
// For projectiles: keep momentum of projectile source
MF_PRESERVEMOMENTUM = (1 << 27),

// Object reacts to being touched (often violently :->)
MF_TOUCHY = (1 << 28),
Expand Down
6 changes: 6 additions & 0 deletions source_files/edge/p_action.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,12 @@ static mobj_t *DoLaunchProjectile(mobj_t * source, float tx, float ty, float tz,
}

P_SetMobjDirAndSpeed(projectile, angle, slope, projectile->speed);
if (projectile->flags & MF_PRESERVEMOMENTUM)
{
projectile->mom.x += source->mom.x;
projectile->mom.y += source->mom.y;
projectile->mom.z += source->mom.z;
}
CheckMissileSpawn(projectile);

return projectile;
Expand Down

0 comments on commit 8c9dddc

Please sign in to comment.