diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2022-03-21 13:21:00 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2022-03-21 13:21:00 -0400 |
commit | 5c934bd482e5d230141fc2fdb7552214baa1d674 (patch) | |
tree | 2ab626835238ed3c85820181c85e702e1ece4816 /src | |
parent | 61aa4f941e67cf45833f1e12fe25428b3f283f74 (diff) | |
download | ether-5c934bd482e5d230141fc2fdb7552214baa1d674.tar.gz ether-5c934bd482e5d230141fc2fdb7552214baa1d674.tar.bz2 ether-5c934bd482e5d230141fc2fdb7552214baa1d674.zip |
finishing reading the story clears out all signs
and a sound effect plays
Diffstat (limited to 'src')
-rw-r--r-- | src/game.cpp | 27 | ||||
-rw-r--r-- | src/game.h | 2 |
2 files changed, 24 insertions, 5 deletions
diff --git a/src/game.cpp b/src/game.cpp index d63c208..edc1605 100644 --- a/src/game.cpp +++ b/src/game.cpp | |||
@@ -353,7 +353,7 @@ void Game::recalculateRender() { | |||
353 | map.at(x,y).dirtyRender = false; | 353 | map.at(x,y).dirtyRender = false; |
354 | 354 | ||
355 | if (map.tile(x,y) == Tile::Floor && (!map.at(x,y).lit || !map.at(x,y).wasLit)) { | 355 | if (map.tile(x,y) == Tile::Floor && (!map.at(x,y).lit || !map.at(x,y).wasLit)) { |
356 | int renderDesc = 0; | 356 | /*int renderDesc = 0; |
357 | if (isTileSetOrNotLit(map, x-1, y-1)) renderDesc |= (1 << 7); | 357 | if (isTileSetOrNotLit(map, x-1, y-1)) renderDesc |= (1 << 7); |
358 | if (isTileSetOrNotLit(map, x , y-1)) renderDesc |= (1 << 6); | 358 | if (isTileSetOrNotLit(map, x , y-1)) renderDesc |= (1 << 6); |
359 | if (isTileSetOrNotLit(map, x+1, y-1)) renderDesc |= (1 << 5); | 359 | if (isTileSetOrNotLit(map, x+1, y-1)) renderDesc |= (1 << 5); |
@@ -361,9 +361,9 @@ void Game::recalculateRender() { | |||
361 | if (isTileSetOrNotLit(map, x+1, y+1)) renderDesc |= (1 << 3); | 361 | if (isTileSetOrNotLit(map, x+1, y+1)) renderDesc |= (1 << 3); |
362 | if (isTileSetOrNotLit(map, x , y+1)) renderDesc |= (1 << 2); | 362 | if (isTileSetOrNotLit(map, x , y+1)) renderDesc |= (1 << 2); |
363 | if (isTileSetOrNotLit(map, x-1, y+1)) renderDesc |= (1 << 1); | 363 | if (isTileSetOrNotLit(map, x-1, y+1)) renderDesc |= (1 << 1); |
364 | if (isTileSetOrNotLit(map, x-1, y )) renderDesc |= (1 << 0); | 364 | if (isTileSetOrNotLit(map, x-1, y )) renderDesc |= (1 << 0);*/ |
365 | 365 | ||
366 | if (/*renderDesc == 0 && */map.at(x,y).sign) { | 366 | if (/*renderDesc == 0 && */map.at(x,y).sign && !storyDone) { |
367 | map.at(x,y).renderId = TilesetIndex(24, 13); | 367 | map.at(x,y).renderId = TilesetIndex(24, 13); |
368 | } else if (std::bernoulli_distribution(0.05)(rng)) { | 368 | } else if (std::bernoulli_distribution(0.05)(rng)) { |
369 | static const std::vector<int> furnishings { | 369 | static const std::vector<int> furnishings { |
@@ -373,7 +373,7 @@ void Game::recalculateRender() { | |||
373 | TilesetIndex(21, 3), | 373 | TilesetIndex(21, 3), |
374 | TilesetIndex(22, 3)}; | 374 | TilesetIndex(22, 3)}; |
375 | 375 | ||
376 | if (/*renderDesc == 0 &&*/ !(x == player_x && y == player_y) && std::bernoulli_distribution(0.005)(rng)) { | 376 | if (/*renderDesc == 0 &&*/ !storyDone && !(x == player_x && y == player_y) && std::bernoulli_distribution(0.005)(rng)) { |
377 | map.at(x,y).renderId = TilesetIndex(24, 13); | 377 | map.at(x,y).renderId = TilesetIndex(24, 13); |
378 | map.at(x,y).sign = true; | 378 | map.at(x,y).sign = true; |
379 | } else { | 379 | } else { |
@@ -385,6 +385,8 @@ void Game::recalculateRender() { | |||
385 | map.at(x,y).renderId = -1; | 385 | map.at(x,y).renderId = -1; |
386 | } | 386 | } |
387 | } else if (map.tile(x,y) == Tile::Wall) { | 387 | } else if (map.tile(x,y) == Tile::Wall) { |
388 | map.at(x,y).sign = false; | ||
389 | |||
388 | static bool initWalls = false; | 390 | static bool initWalls = false; |
389 | static std::vector<int> wallRenders(256, TilesetIndex(21, 12)); | 391 | static std::vector<int> wallRenders(256, TilesetIndex(21, 12)); |
390 | if (!initWalls) { | 392 | if (!initWalls) { |
@@ -477,6 +479,7 @@ void Game::recalculateRender() { | |||
477 | } | 479 | } |
478 | } else { | 480 | } else { |
479 | map.at(x,y).renderId = -1; | 481 | map.at(x,y).renderId = -1; |
482 | map.at(x,y).sign = false; | ||
480 | } | 483 | } |
481 | } | 484 | } |
482 | } | 485 | } |
@@ -783,7 +786,7 @@ void Game::updatePlaying(size_t frameTime) { | |||
783 | if (lookTile.text.empty()) { | 786 | if (lookTile.text.empty()) { |
784 | int lineToRead = nextSignIndex++; | 787 | int lineToRead = nextSignIndex++; |
785 | if (nextSignIndex >= signTexts.size()) { | 788 | if (nextSignIndex >= signTexts.size()) { |
786 | nextSignIndex = 0; | 789 | storyDone = true; |
787 | } | 790 | } |
788 | lookTile.text = signTexts[lineToRead]; | 791 | lookTile.text = signTexts[lineToRead]; |
789 | } | 792 | } |
@@ -1098,6 +1101,20 @@ void Game::update(size_t frameTime) { | |||
1098 | menu.update(frameTime, *this); | 1101 | menu.update(frameTime, *this); |
1099 | } else if (sign.signDisplayState != SignInstructionState::Hidden) { | 1102 | } else if (sign.signDisplayState != SignInstructionState::Hidden) { |
1100 | sign.update(frameTime, *this); | 1103 | sign.update(frameTime, *this); |
1104 | |||
1105 | if (!clearedSigns && storyDone && sign.signDisplayState == SignInstructionState::FadingOut) { | ||
1106 | for (int y = map.getTop(); y < map.getBottom(); y++) { | ||
1107 | for (int x = map.getLeft(); x < map.getRight(); x++) { | ||
1108 | if (map.at(x,y).sign) { | ||
1109 | map.at(x,y).sign = false; | ||
1110 | map.at(x,y).renderId = -1; | ||
1111 | } | ||
1112 | } | ||
1113 | } | ||
1114 | |||
1115 | muxer.playSound("dash"); | ||
1116 | clearedSigns = true; | ||
1117 | } | ||
1101 | } else { | 1118 | } else { |
1102 | updatePlaying(frameTime); | 1119 | updatePlaying(frameTime); |
1103 | } | 1120 | } |
diff --git a/src/game.h b/src/game.h index 5bdc245..ae5f157 100644 --- a/src/game.h +++ b/src/game.h | |||
@@ -125,9 +125,11 @@ public: | |||
125 | 125 | ||
126 | std::vector<std::string> signTexts; | 126 | std::vector<std::string> signTexts; |
127 | int nextSignIndex = 0; | 127 | int nextSignIndex = 0; |
128 | bool storyDone = false; | ||
128 | SignInstructionState signInstructionState = SignInstructionState::Hidden; | 129 | SignInstructionState signInstructionState = SignInstructionState::Hidden; |
129 | Interpolation signFade; | 130 | Interpolation signFade; |
130 | Sign sign; | 131 | Sign sign; |
132 | bool clearedSigns = false; | ||
131 | 133 | ||
132 | Menu menu; | 134 | Menu menu; |
133 | 135 | ||