Sleeping: Difference between revisions

type the actual function. note that "2" in the code is just a setting
(remove start of article line)
(type the actual function. note that "2" in the code is just a setting)
Line 13: Line 13:
}}
}}
'''Sleeping''' is something Mario can do.
'''Sleeping''' is something Mario can do.
== Interactions ==
== Interactions ==
Interestingly, while sleeping, [[Klepto]] cannot steal your hat.<ref>https://github.com/n64decomp/sm64/blob/66018e9f3caaa67399218971d61366cb3f7ba7d7/src/game/behaviors/klepto.inc.c#L244</ref>
Interestingly, while sleeping, [[Klepto]] cannot steal your hat.<ref>https://github.com/n64decomp/sm64/blob/66018e9f3caaa67399218971d61366cb3f7ba7d7/src/game/behaviors/klepto.inc.c#L244</ref>
== Behavior ==
== Behavior ==
The only way to enter the action is through [[Start Sleeping]].
The only way to enter the action is through [[Start Sleeping]].


<code>update_mario_sound_and_camera</code> will increase background noise.<ref>https://github.com/n64decomp/sm64/blob/66018e9f3caaa67399218971d61366cb3f7ba7d7/src/game/mario.c#L727</ref>
When <code>update_mario_sound_and_camera</code> is called, it will <code>raise_background_noise</code>.<ref>https://github.com/n64decomp/sm64/blob/66018e9f3caaa67399218971d61366cb3f7ba7d7/src/game/mario.c#L727</ref>


Before performing the action, [[Idle#Stationary cancels|stationary cancels]] are checked.
Before performing the action, [[Idle#Stationary cancels|stationary cancels]] are checked.
# When INPUT_NONZERO_ANALOG | INPUT_A_PRESSED | INPUT_OFF_FLOOR | INPUT_ABOVE_SLIDE | INPUT_FIRST_PERSON | INPUT_STOMPED | INPUT_B_PRESSED | INPUT_Z_PRESSED, transition to [[Waking Up]]
# When INPUT_NONZERO_ANALOG | INPUT_A_PRESSED | INPUT_OFF_FLOOR | INPUT_ABOVE_SLIDE | INPUT_FIRST_PERSON | INPUT_STOMPED | INPUT_B_PRESSED | INPUT_Z_PRESSED, transition to [[Waking Up]]
# When quicksandDepth > 30, transition to [[Waking Up]]
# When quicksandDepth > 30, transition to [[Waking Up]]
Line 34: Line 29:
## State 0
## State 0
### Set Mario's animation to MARIO_ANIM_SLEEP_IDLE
### Set Mario's animation to MARIO_ANIM_SLEEP_IDLE
### <code>if (animFrame == -1 && !m->actionTimer) lower_background_noise(2);</code>
### <code>if (animFrame == -1 && !m->actionTimer) lower_background_noise</code>
### <code>if (animFrame == 2) play_sound(SOUND_MARIO_SNORING1 ...</code>
### <code>if (animFrame == 2) play_sound(SOUND_MARIO_SNORING1 ...</code>
### <code>if (animFrame == 20) play_sound(SOUND_MARIO_SNORING2 ...</code>
### <code>if (animFrame == 20) play_sound(SOUND_MARIO_SNORING2 ...</code>
Line 47: Line 42:
### (Non JP) Play SOUND_MARIO_SNORING3 if there's no sound flag already playing
### (Non JP) Play SOUND_MARIO_SNORING3 if there's no sound flag already playing
# Return FALSE (exit [[Action#Frame|action loop]])
# Return FALSE (exit [[Action#Frame|action loop]])
{{actions}}
{{actions}}
== References ==
== References ==
246

edits