diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2022-03-23 12:11:43 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2022-03-23 12:11:43 -0400 |
commit | 6cfb7817bf4786326fddeaf4f13675ce22ecec24 (patch) | |
tree | 3c459f87cd2ae0f2d5f3c5ceea3a98b8138bab0e | |
parent | cd805338649b04cd9cff9185f0e229946fbadba7 (diff) | |
download | ether-6cfb7817bf4786326fddeaf4f13675ce22ecec24.tar.gz ether-6cfb7817bf4786326fddeaf4f13675ce22ecec24.tar.bz2 ether-6cfb7817bf4786326fddeaf4f13675ce22ecec24.zip |
changed how signs are generated
the algorithm should be more generous with signs now, depending on the story progression and how many lit spots there are. reading a sign also clears all unread signs. the special sound is still only played after the story is complete.
-rw-r--r-- | res/childoflight.txt | 2 | ||||
-rw-r--r-- | src/game.cpp | 27 |
2 files changed, 23 insertions, 6 deletions
diff --git a/res/childoflight.txt b/res/childoflight.txt index b435487..19ee73c 100644 --- a/res/childoflight.txt +++ b/res/childoflight.txt | |||
@@ -1,7 +1,7 @@ | |||
1 | "Your life, and the lives of those who believe in you. Are you willing to put it all on the line?"\nThose words echoed in the child's head more than any other as he put his hands on the lamp. Through it, he could feel the sun's enormous presence far below him. Its power was palpable; a gentle thrumming that tickled his fingers. It was strong -- stronger and nearer than it had been with the other lamps.\nUp close, it felt like all there was. | 1 | "Your life, and the lives of those who believe in you. Are you willing to put it all on the line?"\nThose words echoed in the child's head more than any other as he put his hands on the lamp. Through it, he could feel the sun's enormous presence far below him. Its power was palpable; a gentle thrumming that tickled his fingers. It was strong -- stronger and nearer than it had been with the other lamps.\nUp close, it felt like all there was. |
2 | The lamp was light in his hands. Without a word he pulled, and light poured out. He closed his eyes and all he saw was light. | 2 | The lamp was light in his hands. Without a word he pulled, and light poured out. He closed his eyes and all he saw was light. |
3 | The child was nowhere when he awoke. Bright, white emptiness stretched out in all directions. He gulped as he looked around, and felt that emptiness resonate in his chest.\n"Hello?" he called out. No one answered. | 3 | The child was nowhere when he awoke. Bright, white emptiness stretched out in all directions. He gulped as he looked around, and felt that emptiness resonate in his chest.\n"Hello?" he called out. No one answered. |
4 | Trembling, the child pushed himself to his feet. He'd been through countless battles, been spat on by people he used to trust, and even took down the immortal ruler of the world. He told himself he could handle whatever this was.\nThe only difference was that now he had to do them alone. | 4 | Trembling, the child pushed himself to his feet. He'd been through countless battles to get here, seen and done things no child should ever have to see and do, all because he was the only one who could save the world. He told himself he could handle whatever this was.\nThe only difference was that he hadn't been alone then. |
5 | The child took a step. His bare foot thudded against an invisible ground. When nothing further happened, he kept going. "Choose a direction and just walk," he thought. There was nothing else to do.\n"Is anyone out there?" | 5 | The child took a step. His bare foot thudded against an invisible ground. When nothing further happened, he kept going. "Choose a direction and just walk," he thought. There was nothing else to do.\n"Is anyone out there?" |
6 | The child's steps turned inside out. The ground flipped over and curved in on itself. He felt a headache start to come on, and it only grew when something finally did appear.\nA black spiral, twisting out from beneath him. He climbed and climbed, and his feet hurt and his chest ached and his arms curled. Yet he still continued. Somehow he felt like nothing would ever be able to stop him again.\nOne foot after another he climbed and watched the matter splay out before him. This thing he'd found, it was immense. It was infinite.\nIt was the Sun. | 6 | The child's steps turned inside out. The ground flipped over and curved in on itself. He felt a headache start to come on, and it only grew when something finally did appear.\nA black spiral, twisting out from beneath him. He climbed and climbed, and his feet hurt and his chest ached and his arms curled. Yet he still continued. Somehow he felt like nothing would ever be able to stop him again.\nOne foot after another he climbed and watched the matter splay out before him. This thing he'd found, it was immense. It was infinite.\nIt was the Sun. |
7 | "Pure hearted one," the Sun said without saying, not a roaring voice but a subtle understanding planted in the child's mind. "We meet at last."\nThe child gulped. Throughout all that time searching for and lighting the lamps, he hadn't considered what would actually happen if he won. But now here he was, facing infinity itself, and it dawned on him the Sun had probably been sealed away for a good reason.\nWould saving the world be worth the consequences? | 7 | "Pure hearted one," the Sun said without saying, not a roaring voice but a subtle understanding planted in the child's mind. "We meet at last."\nThe child gulped. Throughout all that time searching for and lighting the lamps, he hadn't considered what would actually happen if he won. But now here he was, facing infinity itself, and it dawned on him the Sun had probably been sealed away for a good reason.\nWould saving the world be worth the consequences? |
diff --git a/src/game.cpp b/src/game.cpp index 66b488c..7c82a38 100644 --- a/src/game.cpp +++ b/src/game.cpp | |||
@@ -229,7 +229,7 @@ bool Game::movePlayer(int x, int y) | |||
229 | moveProgress.start(1000/6); | 229 | moveProgress.start(1000/6); |
230 | dirtyLighting = true; | 230 | dirtyLighting = true; |
231 | 231 | ||
232 | std::cout << player_x << "," << player_y << std::endl; | 232 | //std::cout << player_x << "," << player_y << std::endl; |
233 | 233 | ||
234 | int chunkX, chunkY, old_chunkX, old_chunkY; | 234 | int chunkX, chunkY, old_chunkX, old_chunkY; |
235 | toChunkPos(player_x, player_y, chunkX, chunkY); | 235 | toChunkPos(player_x, player_y, chunkX, chunkY); |
@@ -345,6 +345,7 @@ void Game::recalculateLighting() | |||
345 | } | 345 | } |
346 | 346 | ||
347 | void Game::recalculateRender() { | 347 | void Game::recalculateRender() { |
348 | bool placedSignNear = false; | ||
348 | for (int y = map.getTop(); y < map.getBottom(); y++) | 349 | for (int y = map.getTop(); y < map.getBottom(); y++) |
349 | { | 350 | { |
350 | for (int x = map.getLeft(); x < map.getRight(); x++) | 351 | for (int x = map.getLeft(); x < map.getRight(); x++) |
@@ -373,9 +374,22 @@ void Game::recalculateRender() { | |||
373 | TilesetIndex(21, 3), | 374 | TilesetIndex(21, 3), |
374 | TilesetIndex(22, 3)}; | 375 | TilesetIndex(22, 3)}; |
375 | 376 | ||
376 | if (/*renderDesc == 0 &&*/ !storyDone && !(x == player_x && y == player_y) && std::bernoulli_distribution(0.005)(rng)) { | 377 | double likelihood = 0.005; |
378 | bool tryNear = false; | ||
379 | if (nextSignIndex < (litSpots / 1000 + 1) && std::sqrt(std::pow(x-player_x, 2)+std::pow(y-player_y, 2)) < 30) { | ||
380 | if (placedSignNear) { | ||
381 | likelihood = 0.05; | ||
382 | } else { | ||
383 | likelihood = 0.1; | ||
384 | tryNear = true; | ||
385 | } | ||
386 | } | ||
387 | if (/*renderDesc == 0 &&*/ !storyDone && !(x == player_x && y == player_y) && map.at(x,y).text.empty() && std::bernoulli_distribution(likelihood)(rng)) { | ||
377 | map.at(x,y).renderId = TilesetIndex(24, 13); | 388 | map.at(x,y).renderId = TilesetIndex(24, 13); |
378 | map.at(x,y).sign = true; | 389 | map.at(x,y).sign = true; |
390 | if (tryNear) { | ||
391 | placedSignNear = true; | ||
392 | } | ||
379 | } else { | 393 | } else { |
380 | map.at(x,y).renderId = furnishings.at(std::uniform_int_distribution<int>(0, furnishings.size()-1)(rng)); | 394 | map.at(x,y).renderId = furnishings.at(std::uniform_int_distribution<int>(0, furnishings.size()-1)(rng)); |
381 | map.at(x,y).sign = false; | 395 | map.at(x,y).sign = false; |
@@ -792,6 +806,7 @@ void Game::updatePlaying(size_t frameTime) { | |||
792 | } | 806 | } |
793 | 807 | ||
794 | sign.displayMessage(lookTile.text); | 808 | sign.displayMessage(lookTile.text); |
809 | clearedSigns = false; | ||
795 | } else { | 810 | } else { |
796 | performDash(); | 811 | performDash(); |
797 | } | 812 | } |
@@ -1106,17 +1121,19 @@ void Game::update(size_t frameTime) { | |||
1106 | } else if (sign.signDisplayState != SignInstructionState::Hidden) { | 1121 | } else if (sign.signDisplayState != SignInstructionState::Hidden) { |
1107 | sign.update(frameTime, *this); | 1122 | sign.update(frameTime, *this); |
1108 | 1123 | ||
1109 | if (!clearedSigns && storyDone && sign.signDisplayState == SignInstructionState::FadingOut) { | 1124 | if (!clearedSigns && sign.signDisplayState == SignInstructionState::FadingOut) { |
1110 | for (int y = map.getTop(); y < map.getBottom(); y++) { | 1125 | for (int y = map.getTop(); y < map.getBottom(); y++) { |
1111 | for (int x = map.getLeft(); x < map.getRight(); x++) { | 1126 | for (int x = map.getLeft(); x < map.getRight(); x++) { |
1112 | if (map.at(x,y).sign) { | 1127 | if (map.at(x,y).sign && (storyDone || map.at(x,y).text.empty())) { |
1113 | map.at(x,y).sign = false; | 1128 | map.at(x,y).sign = false; |
1114 | map.at(x,y).renderId = -1; | 1129 | map.at(x,y).renderId = -1; |
1115 | } | 1130 | } |
1116 | } | 1131 | } |
1117 | } | 1132 | } |
1118 | 1133 | ||
1119 | muxer.playSound("dash"); | 1134 | if (storyDone) { |
1135 | muxer.playSound("dash"); | ||
1136 | } | ||
1120 | clearedSigns = true; | 1137 | clearedSigns = true; |
1121 | } | 1138 | } |
1122 | } else { | 1139 | } else { |