Subpixels

From ALttP Speedrunning Wiki
Revision as of 18:27, 11 January 2018 by Pinkus (talk | contribs) (Created page with "This is not 100% verified in code, but it describes what we see when frame advancing in emulator: * When the subpixel wraps, your movement speed gets a -1. * On normal groun...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This is not 100% verified in code, but it describes what we see when frame advancing in emulator:

  • When the subpixel wraps, your movement speed gets a -1.
  • On normal ground, the default movement speed is 2.
  • On stairs, the default movement speed is 1.
  • Walking upwards increments subpixels, walking downwards decrements subpixels.

Example: Walking on ground (movement speed is 2), upwards

  • frame 1: Subpixel = 0x00 + 0x80 = 0x80. Doesn't wrap, so you get 2.
  • frame 2: Subpixel = 0x80 + 0x80 = 0x00. Wraps, so you get 2 - 1 = 1.
  • Repeats

Example: Walking on ground (movement speed is 2), downwards

  • frame 1: Subpixel = 0x00 - 0x80 = 0x80. Wraps, so you get 1.
  • frame 2: Subpixel = 0x80 - 0x80 = 0x00. Doesn't wrap, so you get 2.
  • Repeats

Example: Walking on stairs (movement speed is 1), upwards

  • frame 1: Subpixel = 0x00 + 0x50 = 0x50. Doesn't wrap, so you get 1.
  • frame 2: Subpixel = 0x50 + 0x50 = 0xA0. Doesn't wrap, so you get 1.
  • frame 3: Subpixel = 0xA0 + 0x50 = 0xF0. Doesn't wrap, so you get 1.
  • frame 4: Subpixel = 0xF0 + 0x50 = 0x40. Wraps, so you get 1 - 1 = 0.

Example: Walking on stairs (movement speed is 1), downwards

  • frame 1: Subpixel = 0x00 - 0x50 = 0xB0. Wraps, so you get 1 - 1 = 0.
  • frame 2: Subpixel = 0xB0 - 0x50 = 0x60. Doesn't wrap, so you get 1.
  • frame 3: Subpixel = 0x60 - 0x50 = 0x10. Doesn't wrap, so you get 1.
  • frame 4: Subpixel = 0x10 - 0x50 = 0xC0. Wraps, so you get 1 - 1 = 0.