Skip to content

Commit

Permalink
Added option for wind to not affect player (decorative wind) (SuperTu…
Browse files Browse the repository at this point in the history
…x#1503)

Co-authored-by: Semphris <invalid@example.com>
  • Loading branch information
2 people authored and mbernard2 committed Aug 18, 2020
1 parent 6ce825e commit 3f5cdae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/object/wind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Wind::Wind(const ReaderMapping& reader) :
new_size(),
dt_sec(0),
affects_badguys(),
affects_player(),
fancy_wind()
{
float w,h;
Expand All @@ -54,6 +55,7 @@ Wind::Wind(const ReaderMapping& reader) :
reader.get("acceleration", acceleration, 100.0f);

reader.get("affects-badguys", affects_badguys, false);
reader.get("affects-player", affects_player, true);

reader.get("fancy-wind", fancy_wind, false);

Expand All @@ -75,9 +77,10 @@ Wind::get_settings()
result.add_float(_("Acceleration"), &acceleration, "acceleration");
result.add_bool(_("Blowing"), &blowing, "blowing", true);
result.add_bool(_("Affects Badguys"), &affects_badguys, "affects-badguys", false);
result.add_bool(_("Affects Player"), &affects_player, "affects-player");
result.add_bool(_("Fancy Particles"), &fancy_wind, "fancy-wind", false);

result.reorder({"blowing", "speed-x", "speed-y", "acceleration", "affects-badguys", "fancy-wind", "region", "name", "x", "y"});
result.reorder({"blowing", "speed-x", "speed-y", "acceleration", "affects-badguys", "affects-player", "fancy-wind", "region", "name", "x", "y"});

return result;
}
Expand Down Expand Up @@ -122,6 +125,7 @@ HitResponse
Wind::collision(GameObject& other, const CollisionHit& )
{
if (!blowing) return ABORT_MOVE;
if (!affects_player) return ABORT_MOVE;

auto player = dynamic_cast<Player*> (&other);
if (player)
Expand Down
1 change: 1 addition & 0 deletions src/object/wind.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class Wind final :
float dt_sec; /**< stores last dt_sec gotten at update() */

bool affects_badguys; /**< whether the wind can affect badguys */
bool affects_player; /**< whether the wind can affect the player: useful for cinematic wind */
bool fancy_wind;

private:
Expand Down

0 comments on commit 3f5cdae

Please sign in to comment.