Sleeping

Sleeping is something Mario can do.

Sleeping
Properties
Hex 0x0C000203
Action Flags Stationary, Allow First Person, Pause Exit
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), 0x87 (sleep lying)

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