diff options
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 4b13051..25da94f 100644 --- a/src/main.cpp +++ b/src/main.cpp | |||
@@ -13,6 +13,10 @@ void incrementIfSet(Game& game, int& count, int x, int y, Tile val = Tile::Wall) | |||
13 | } | 13 | } |
14 | } | 14 | } |
15 | 15 | ||
16 | int getZoomLevel(const Game& game) { | ||
17 | return (game.curZoom - INIT_ZOOM) / 2; | ||
18 | } | ||
19 | |||
16 | void tick( | 20 | void tick( |
17 | Game& game, | 21 | Game& game, |
18 | int x1, | 22 | int x1, |
@@ -96,11 +100,14 @@ bool movePlayer(Game& game, int x, int y) | |||
96 | 100 | ||
97 | game.player_x = x; | 101 | game.player_x = x; |
98 | game.player_y = y; | 102 | game.player_y = y; |
103 | game.muxer.setPlayerLoc(x, y); | ||
99 | 104 | ||
100 | game.dirtyLighting = true; | 105 | game.dirtyLighting = true; |
101 | 106 | ||
102 | return true; | 107 | return true; |
103 | } else { | 108 | } else { |
109 | //game.muxer.playSoundAtPosition("bump", game.player_x, game.player_y); | ||
110 | |||
104 | return false; | 111 | return false; |
105 | } | 112 | } |
106 | } | 113 | } |
@@ -241,6 +248,8 @@ void kickUpDust(Game& game, int x, int y, size_t chain) | |||
241 | 248 | ||
242 | void popLamp(Game& game, int x, int y, size_t chain) | 249 | void popLamp(Game& game, int x, int y, size_t chain) |
243 | { | 250 | { |
251 | game.muxer.playSoundAtPosition("pop", x, y); | ||
252 | |||
244 | if (game.map.at(x,y).tile == Tile::Lamp) | 253 | if (game.map.at(x,y).tile == Tile::Lamp) |
245 | { | 254 | { |
246 | game.numLamps--; | 255 | game.numLamps--; |
@@ -400,6 +409,15 @@ void setZoom(Game& game, size_t zoom) | |||
400 | { | 409 | { |
401 | game.curBoundY = game.map.getBottom() - zoom * ZOOM_Y_FACTOR; | 410 | game.curBoundY = game.map.getBottom() - zoom * ZOOM_Y_FACTOR; |
402 | } | 411 | } |
412 | |||
413 | int zoomLevel = getZoomLevel(game); | ||
414 | if (zoomLevel == 0) { | ||
415 | game.muxer.setMusicLevel(0); | ||
416 | } else if (zoomLevel < 3) { | ||
417 | game.muxer.setMusicLevel(1); | ||
418 | } else { | ||
419 | game.muxer.setMusicLevel(2); | ||
420 | } | ||
403 | } | 421 | } |
404 | 422 | ||
405 | int main(int, char**) | 423 | int main(int, char**) |
@@ -731,6 +749,7 @@ int main(int, char**) | |||
731 | zoomAcc -= zoomDt; | 749 | zoomAcc -= zoomDt; |
732 | } | 750 | } |
733 | 751 | ||
752 | game.muxer.update(); | ||
734 | renderer.render(game, true); | 753 | renderer.render(game, true); |
735 | } | 754 | } |
736 | } catch (const sdl_error& ex) | 755 | } catch (const sdl_error& ex) |