Sleeping: Difference between revisions

From Ukikipedia
Jump to navigation Jump to search
(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 ==

Revision as of 01:45, 9 July 2023

Sleeping
Properties
Hex 0x0C000203
Action Flags STATIONARY
Action Group Stationary
ID 0x003
Transitions
Into stationary cancels: Water Plunge, Squished, Standing Death (theoretically), Quicksand Death, non cancel: Waking Up
Out of Start Sleeping
Other
Animation 0x85 (sleep idle), 0x86 (sleep start lying), (sleep lying)

Sleeping is something Mario can do.

Interactions

Interestingly, while sleeping, Klepto cannot steal your hat.[1]

Behavior

The only way to enter the action is through Start Sleeping.

When update_mario_sound_and_camera is called, it will raise_background_noise.[2]

Before performing the action, stationary cancels are checked.

  1. 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
  2. When quicksandDepth > 30, transition to Waking Up
  3. Take Mario's facing angle and subtract 0x8000, and consider the point 60 units in that direction (from Mario). If the floor there is more than 24 units below Mario, transition to Waking Up. (Note that finding a floor starts at the position 100 units above Mario's y position.)
  4. Set Mario's eyeState to closed.
  5. stationary ground step.
  6. This action has three states:
    1. State 0
      1. Set Mario's animation to MARIO_ANIM_SLEEP_IDLE
      2. if (animFrame == -1 && !m->actionTimer) lower_background_noise
      3. if (animFrame == 2) play_sound(SOUND_MARIO_SNORING1 ...
      4. if (animFrame == 20) play_sound(SOUND_MARIO_SNORING2 ...
      5. When the animation has ended, increment the action timer until it becomes greater than 45, at which point set actionState to 1
    2. State 1
      1. Set Mario's animation to MARIO_ANIM_SLEEP_START_LYING
      2. Once Mario's animation frame is 18, play SOUND_ACTION_TERRAIN_BODY_HIT_GROUND
      3. When the animation has ended, set actionState to 2
    3. State 2
      1. Set Mario's animation to MARIO_ANIM_SLEEP_LYING
      2. (JP only) Play SOUND_MARIO_SNORING2 on animation frame 2, then SOUND_MARIO_SNORING1 on animation frame 25
      3. (Non JP) Play SOUND_MARIO_SNORING3 if there's no sound flag already playing
  7. Return FALSE (exit action loop)

References