diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-10 20:09:42 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-10 20:09:42 -0500 |
commit | c25ab2537cb201dc46b7c1d375dd1c12411fe85c (patch) | |
tree | 1b96b9054585390abbc99277572a77a3248f2cde /src | |
parent | 05ee221cd31a782b699cc6d62e0d275364cfd7cc (diff) | |
download | tanetane-c25ab2537cb201dc46b7c1d375dd1c12411fe85c.tar.gz tanetane-c25ab2537cb201dc46b7c1d375dd1c12411fe85c.tar.bz2 tanetane-c25ab2537cb201dc46b7c1d375dd1c12411fe85c.zip |
Player movement/input is halted during cutscenes
Diffstat (limited to 'src')
-rw-r--r-- | src/character_system.cpp | 12 | ||||
-rw-r--r-- | src/character_system.h | 2 | ||||
-rw-r--r-- | src/script_system.cpp | 3 |
3 files changed, 16 insertions, 1 deletions
diff --git a/src/character_system.cpp b/src/character_system.cpp index 781b50d..aad8c1b 100644 --- a/src/character_system.cpp +++ b/src/character_system.cpp | |||
@@ -248,6 +248,18 @@ void CharacterSystem::stopRunningSound(Sprite& sprite) { | |||
248 | } | 248 | } |
249 | } | 249 | } |
250 | 250 | ||
251 | void CharacterSystem::halt(int spriteId) { | ||
252 | // Because special stuff happens when we stop running, we have to handle the | ||
253 | // running case here. | ||
254 | Sprite& sprite = game_.getSprite(spriteId); | ||
255 | if (sprite.characterState == CharacterState::Running) { | ||
256 | stopRunning(spriteId); | ||
257 | } else { | ||
258 | // Other than that, it is simple to go to Still from Walking or Crouching. | ||
259 | setPartyState(spriteId, CharacterState::Still); | ||
260 | } | ||
261 | } | ||
262 | |||
251 | void CharacterSystem::clearSpriteCache() { | 263 | void CharacterSystem::clearSpriteCache() { |
252 | for (Sprite& sprite : game_.getSprites() | game_.spriteView()) { | 264 | for (Sprite& sprite : game_.getSprites() | game_.spriteView()) { |
253 | if (sprite.runningSfxChannel != -1) { | 265 | if (sprite.runningSfxChannel != -1) { |
diff --git a/src/character_system.h b/src/character_system.h index 3933e1b..c6d4e6d 100644 --- a/src/character_system.h +++ b/src/character_system.h | |||
@@ -33,6 +33,8 @@ public: | |||
33 | 33 | ||
34 | void startRunning(int spriteId); | 34 | void startRunning(int spriteId); |
35 | 35 | ||
36 | void halt(int spriteId); | ||
37 | |||
36 | void clearSpriteCache() override; | 38 | void clearSpriteCache() override; |
37 | 39 | ||
38 | private: | 40 | private: |
diff --git a/src/script_system.cpp b/src/script_system.cpp index 8fd5028..0fa0c1b 100644 --- a/src/script_system.cpp +++ b/src/script_system.cpp | |||
@@ -31,7 +31,8 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) { | |||
31 | 31 | ||
32 | engine_.new_usertype<CharacterSystem>( | 32 | engine_.new_usertype<CharacterSystem>( |
33 | "character", | 33 | "character", |
34 | "startRunning", &CharacterSystem::startRunning); | 34 | "startRunning", &CharacterSystem::startRunning, |
35 | "halt", &CharacterSystem::halt); | ||
35 | 36 | ||
36 | engine_.new_usertype<Mixer>( | 37 | engine_.new_usertype<Mixer>( |
37 | "mixer", | 38 | "mixer", |