diff options
| -rw-r--r-- | res/scripts/common.lua | 14 | ||||
| -rw-r--r-- | res/scripts/underwater.lua | 4 | ||||
| -rw-r--r-- | res/scripts/underwater_start.lua | 4 | ||||
| -rw-r--r-- | src/character_system.cpp | 3 | ||||
| -rw-r--r-- | src/script_system.cpp | 3 | ||||
| -rw-r--r-- | src/sprite.h | 1 |
6 files changed, 27 insertions, 2 deletions
| diff --git a/res/scripts/common.lua b/res/scripts/common.lua index e95f6f1..895ad7b 100644 --- a/res/scripts/common.lua +++ b/res/scripts/common.lua | |||
| @@ -315,3 +315,17 @@ function StopClipping() | |||
| 315 | local playerSprite = getSprite(playerId) | 315 | local playerSprite = getSprite(playerId) |
| 316 | playerSprite.clipping = false | 316 | playerSprite.clipping = false |
| 317 | end | 317 | end |
| 318 | |||
| 319 | --- Turns off crouching (and thus running) for the player. | ||
| 320 | function PreventCrouching() | ||
| 321 | local playerId = getPlayerSprite() | ||
| 322 | local playerSprite = getSprite(playerId) | ||
| 323 | playerSprite.cantCrouch = true | ||
| 324 | end | ||
| 325 | |||
| 326 | --- Undoes the effect of PreventCrouching(). | ||
| 327 | function AllowCrouching() | ||
| 328 | local playerId = getPlayerSprite() | ||
| 329 | local playerSprite = getSprite(playerId) | ||
| 330 | playerSprite.cantCrouch = false | ||
| 331 | end | ||
| diff --git a/res/scripts/underwater.lua b/res/scripts/underwater.lua index 602c8d4..4c5d2bb 100644 --- a/res/scripts/underwater.lua +++ b/res/scripts/underwater.lua | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | underwater = {} | 1 | underwater = {} |
| 2 | 2 | ||
| 3 | function underwater.leave() | ||
| 4 | AllowCrouching() | ||
| 5 | end | ||
| 6 | |||
| 3 | function underwater.fish2() | 7 | function underwater.fish2() |
| 4 | StartCutscene() | 8 | StartCutscene() |
| 5 | DisplayMessage("* What are you complaining about?\nYou're so powerful now...\n\fYou owe it all to her.", "Fish", SpeakerType.BOY) | 9 | DisplayMessage("* What are you complaining about?\nYou're so powerful now...\n\fYou owe it all to her.", "Fish", SpeakerType.BOY) |
| diff --git a/res/scripts/underwater_start.lua b/res/scripts/underwater_start.lua index fe582ab..98a6e67 100644 --- a/res/scripts/underwater_start.lua +++ b/res/scripts/underwater_start.lua | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | underwater_start = {} | 1 | underwater_start = {} |
| 2 | 2 | ||
| 3 | function underwater_start.init() | ||
| 4 | PreventCrouching() | ||
| 5 | end | ||
| 6 | |||
| 3 | function underwater_start.talk_to_fish1() | 7 | function underwater_start.talk_to_fish1() |
| 4 | StartCutscene() | 8 | StartCutscene() |
| 5 | DisplayMessage("* You deserved what she did to you.", "Fish", SpeakerType.BOY) | 9 | DisplayMessage("* You deserved what she did to you.", "Fish", SpeakerType.BOY) |
| diff --git a/src/character_system.cpp b/src/character_system.cpp index a24bdcc..87407af 100644 --- a/src/character_system.cpp +++ b/src/character_system.cpp | |||
| @@ -237,7 +237,8 @@ void CharacterSystem::beginCrouch(int spriteId) { | |||
| 237 | stopRunning(spriteId); | 237 | stopRunning(spriteId); |
| 238 | } else { | 238 | } else { |
| 239 | if (sprite.characterMedium == CharacterMedium::Ladder || | 239 | if (sprite.characterMedium == CharacterMedium::Ladder || |
| 240 | sprite.characterMedium == CharacterMedium::Water) { | 240 | sprite.characterMedium == CharacterMedium::Water || |
| 241 | sprite.cantCrouch) { | ||
| 241 | return; | 242 | return; |
| 242 | } | 243 | } |
| 243 | 244 | ||
| diff --git a/src/script_system.cpp b/src/script_system.cpp index 31b8bee..92e6afe 100644 --- a/src/script_system.cpp +++ b/src/script_system.cpp | |||
| @@ -39,7 +39,8 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) { | |||
| 39 | }, | 39 | }, |
| 40 | "persistent", &Sprite::persistent, | 40 | "persistent", &Sprite::persistent, |
| 41 | "paused", &Sprite::paused, | 41 | "paused", &Sprite::paused, |
| 42 | "clipping", &Sprite::clipping); | 42 | "clipping", &Sprite::clipping, |
| 43 | "cantCrouch", &Sprite::cantCrouch); | ||
| 43 | 44 | ||
| 44 | engine_.new_usertype<MessageSystem>( | 45 | engine_.new_usertype<MessageSystem>( |
| 45 | "message", | 46 | "message", |
| diff --git a/src/sprite.h b/src/sprite.h index 32a082c..657a692 100644 --- a/src/sprite.h +++ b/src/sprite.h | |||
| @@ -91,6 +91,7 @@ public: | |||
| 91 | StepType stepType = StepType::none; | 91 | StepType stepType = StepType::none; |
| 92 | int runningSfxChannel = -1; | 92 | int runningSfxChannel = -1; |
| 93 | bool clipping = false; | 93 | bool clipping = false; |
| 94 | bool cantCrouch = false; // Use this to prevent running | ||
| 94 | 95 | ||
| 95 | // Input | 96 | // Input |
| 96 | bool controllable = false; | 97 | bool controllable = false; |
