summary refs log tree commit diff stats
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp index 25da94f..cd1a8c2 100644 --- a/src/main.cpp +++ b/src/main.cpp
@@ -106,7 +106,11 @@ bool movePlayer(Game& game, int x, int y)
106 106
107 return true; 107 return true;
108 } else { 108 } else {
109 //game.muxer.playSoundAtPosition("bump", game.player_x, game.player_y); 109 if (!game.alreadyBumped) {
110 game.muxer.playSoundAtPosition("bump", x, y);
111 game.alreadyBumped = true;
112 game.bumpCooldown.reset();
113 }
110 114
111 return false; 115 return false;
112 } 116 }
@@ -409,7 +413,7 @@ void setZoom(Game& game, size_t zoom)
409 { 413 {
410 game.curBoundY = game.map.getBottom() - zoom * ZOOM_Y_FACTOR; 414 game.curBoundY = game.map.getBottom() - zoom * ZOOM_Y_FACTOR;
411 } 415 }
412 416
413 int zoomLevel = getZoomLevel(game); 417 int zoomLevel = getZoomLevel(game);
414 if (zoomLevel == 0) { 418 if (zoomLevel == 0) {
415 game.muxer.setMusicLevel(0); 419 game.muxer.setMusicLevel(0);
@@ -538,6 +542,7 @@ int main(int, char**)
538 game.numLamps++; 542 game.numLamps++;
539 game.dirtyLighting = true; 543 game.dirtyLighting = true;
540 kickUpDust(game, game.player_x, game.player_y, 0); 544 kickUpDust(game, game.player_x, game.player_y, 0);
545 game.muxer.playSoundAtPosition("drop", game.player_x, game.player_y);
541 546
542 if (game.firstInput) 547 if (game.firstInput)
543 { 548 {
@@ -576,6 +581,8 @@ int main(int, char**)
576 std::get<0>(moveTo), 581 std::get<0>(moveTo),
577 std::get<1>(moveTo)); 582 std::get<1>(moveTo));
578 } 583 }
584
585 //game.muxer.playSoundAtPosition("dash", game.player_x, game.player_y);
579 } 586 }
580 } 587 }
581 } 588 }
@@ -592,6 +599,11 @@ int main(int, char**)
592 keystate.up = state[SDL_SCANCODE_UP]; 599 keystate.up = state[SDL_SCANCODE_UP];
593 keystate.down = state[SDL_SCANCODE_DOWN]; 600 keystate.down = state[SDL_SCANCODE_DOWN];
594 601
602 game.bumpCooldown.accumulate(frameTime);
603 if (game.alreadyBumped && keystate != game.lastInput && game.bumpCooldown.step()) {
604 game.alreadyBumped = false;
605 }
606
595 if (keystate.left || keystate.right || keystate.up || keystate.down) 607 if (keystate.left || keystate.right || keystate.up || keystate.down)
596 { 608 {
597 game.firstInput = true; 609 game.firstInput = true;