Skip to content

Commit

Permalink
Merge pull request #359 from lethal-guitar/bug-fixes
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
lethal-guitar authored May 4, 2019
2 parents e77d812 + 8cb1a5e commit 67f1ff7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
11 changes: 10 additions & 1 deletion src/game_logic/destruction_effect_specs.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,17 @@ const effects::EffectSpec SKELETON_KILL_EFFECT_SPEC[] = {

const effects::EffectSpec RIGELATIN_KILL_EFFECT_SPEC[] = {
{effects::SpriteCascade{1}, 0},
{effects::Particles{{1, 0}}, 0},
{effects::RandomExplosionSound{}, 0},
{effects::Particles{{1, 0}}, 0}
{effects::RandomExplosionSound{}, 1},
{effects::RandomExplosionSound{}, 3},
{effects::RandomExplosionSound{}, 5},
{effects::RandomExplosionSound{}, 7},
{effects::RandomExplosionSound{}, 9},
{effects::RandomExplosionSound{}, 11},
{effects::RandomExplosionSound{}, 13},
{effects::RandomExplosionSound{}, 15},
{effects::RandomExplosionSound{}, 17},
};


Expand Down
19 changes: 17 additions & 2 deletions src/game_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,23 @@ bool GameRunner::handleMenuEnterEvent(const SDL_Event& event) {
};

auto quitConfirmEventHook = [this](const SDL_Event& ev) {
if (isNonRepeatKeyDown(ev) && ev.key.keysym.sym == SDLK_y) {
mGameWasQuit = true;
// The user needs to press Y in order to confirm quitting the game, but we
// want the confirmation to happen when the key is released, not when it's
// pressed. This is because the "a new high score" screen may appear after
// quitting the game, and if we were to quit on key down, it's very likely
// for the key to still be pressed while the new screen appears. This in
// turn would lead to an undesired letter Y being entered into the high
// score name entry field, because the text input system would see the key
// being released and treated as an input.
//
// Therefore, we quit on key up. Nevertheless, we still need to prevent the
// key down event from reaching the script runner, as it would cancel out
// the quit confirmation dialog otherwise.
if (ev.type == SDL_KEYDOWN && ev.key.keysym.sym == SDLK_y) {
return true;
}
if (ev.type == SDL_KEYUP && ev.key.keysym.sym == SDLK_y) {
mGameWasQuit = ev.type == SDL_KEYUP;
return true;
}

Expand Down

0 comments on commit 67f1ff7

Please sign in to comment.