Skip to content

Commit

Permalink
Patch out infinite doublejumps.
Browse files Browse the repository at this point in the history
  • Loading branch information
HolyBlackCat committed Apr 4, 2022
1 parent 6b85c09 commit fc9bf2e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build_number.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1
2
2 changes: 1 addition & 1 deletion project.mk
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ src/icon.ico: $(wildcard src/icon_*.png)

# --- Libraries ---

DIST_DEPS_ARCHIVE := https://github.com/HolyBlackCat/imp-re/releases/download/deps-sources/deps_v1.zip
DIST_DEPS_ARCHIVE := https://github.com/HolyBlackCat/LD50-flameline/releases/download/v1.0/deps_v1.zip

_win_is_x32 :=
_win_sdl2_arch := $(if $(_win_is_x32),i686-w64-mingw32,x86_64-w64-mingw32)
Expand Down
7 changes: 6 additions & 1 deletion src/game/state_world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ struct Player
bool ground = false;
bool prev_ground = false;

bool doublejump_recharged = false;

bool facing_left = false;

bool is_walking = false;
Expand Down Expand Up @@ -596,6 +598,8 @@ namespace States
}
}
}
if (p.ground)
p.doublejump_recharged = true;

{ // Prison controls.
if (p.in_prison)
Expand Down Expand Up @@ -650,7 +654,7 @@ namespace States
bool using_doublejump = false;

// Try to doublejump off of a ghost.
if (!can_jump && have_doublejump_ability)
if (!can_jump && have_doublejump_ability && p.doublejump_recharged)
{
const Ghost *newest_ghost = time.FindNewestGhost();
auto it = std::find_if(time.ghosts.begin(), time.ghosts.end(), [&](const Ghost &ghost)
Expand All @@ -675,6 +679,7 @@ namespace States

can_jump = true;
using_doublejump = true;
p.doublejump_recharged = false;
}
}

Expand Down

0 comments on commit fc9bf2e

Please sign in to comment.