diff options
author | Sven Gothel <[email protected]> | 2022-03-28 04:15:56 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2022-03-28 04:15:56 +0200 |
commit | ab6919fabb414af73e66198eaa6a30e227c01f0e (patch) | |
tree | fc8e6c4ae306668249c37eb4da0c401b8704cded /src | |
parent | 9e094c32f784c07bdef2c1d2096fd49ca25a8987 (diff) |
Level starts at 1; Complete to_string(tile_t tile); ORANGE -> PEACH; Add level -> fruit mapping;
Diffstat (limited to 'src')
-rw-r--r-- | src/game.cpp | 24 | ||||
-rw-r--r-- | src/maze.cpp | 12 |
2 files changed, 31 insertions, 5 deletions
diff --git a/src/game.cpp b/src/game.cpp index 71f293f..a753eb9 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -40,10 +40,10 @@ int win_pixel_width = 0; int win_pixel_scale = 1; -static int frames_per_sec=0; +static int frames_per_sec = 0; int get_frames_per_sec() { return frames_per_sec; } -static int current_level=-1; +static int current_level = 1; int get_current_level() { return current_level; } std::unique_ptr<maze_t> global_maze; @@ -78,7 +78,7 @@ score_t tile_to_score(const tile_t tile) noexcept { case tile_t::PELLET_POWER: return score_t::PELLET_POWER; case tile_t::CHERRY: return score_t::CHERRY; case tile_t::STRAWBERRY: return score_t::STRAWBERRY; - case tile_t::ORANGE: return score_t::ORANGE; + case tile_t::PEACH: return score_t::PEACH; case tile_t::APPLE: return score_t::APPLE; case tile_t::MELON: return score_t::MELON; case tile_t::GALAXIAN: return score_t::GALAXIAN; @@ -88,6 +88,24 @@ score_t tile_to_score(const tile_t tile) noexcept { } } +tile_t level_to_fruit(const int level) noexcept { + switch( level ) { + case 1: return tile_t::CHERRY; + case 2: return tile_t::STRAWBERRY; + case 3: [[fallthrough]]; + case 4: return tile_t::PEACH; + case 5: [[fallthrough]]; + case 6: return tile_t::APPLE; + case 7: [[fallthrough]]; + case 8: return tile_t::MELON; + case 9: [[fallthrough]]; + case 10: return tile_t::GALAXIAN; + case 11: [[fallthrough]]; + case 12: return tile_t::BELL; + default: return tile_t::KEY; + } +} + // // global_tex_t // diff --git a/src/maze.cpp b/src/maze.cpp index d361175..944d295 100644 --- a/src/maze.cpp +++ b/src/maze.cpp @@ -35,10 +35,18 @@ std::string to_string(tile_t tile) noexcept { switch(tile) { case tile_t::EMPTY: return " "; - case tile_t::PELLET: return "."; - case tile_t::PELLET_POWER: return "*"; case tile_t::WALL: return "X"; case tile_t::GATE: return "-"; + case tile_t::PELLET: return "."; + case tile_t::PELLET_POWER: return "*"; + case tile_t::CHERRY: return "C"; + case tile_t::STRAWBERRY: return "S"; + case tile_t::PEACH: return "P"; + case tile_t::APPLE: return "A"; + case tile_t::MELON: return "M"; + case tile_t::GALAXIAN: return "G"; + case tile_t::BELL: return "B"; + case tile_t::KEY: return "K"; default: return "?"; } } |