Skip to content
This repository has been archived by the owner on Sep 28, 2024. It is now read-only.

Level Settings (height, x y, camera)

Matt Greer edited this page Jun 9, 2021 · 1 revision

There are various bytes in the level settings related to Mario's initial position, level height, camera, screen initial position, etc.

=== Level Settings ===
SSSS CCCC VVVV Cm CM YY XX AA BB OOOO MMMM G1 G2 G3 G4 G5 G6 ???? ???? ?? ?? ?? ?? ?? ??
SSSS = Screen Y Boundary
CCCC = Fixed Screen Center Y (Signed)
VVVV = Player Y Screen Center (Signed)
Cm = Camera Min Distance from Mario
CM = Camera Max Distance from Mario
     (dDDDDDDD: d=0=Down; d=1=Up; D=Pixels)
YY = Player Y Start
XX = Player X Start
AA = Screen Y Start
BB = Screen X Start

Screen Y Boundary

This seems to just be the height of the level, in pixels.

classic 1-2 has this set to 0x1bf which is 447 in decimal, and 27.9375 tiles. This matches what you see when messing with the level. So far smaghetti levels just copied classic 1-2's level settings, and smaghetti levels do work out to be 27 tiles tall and are just shy of 28.

entity y values

entity y values are based on Screen Y Boundary. In classic 1-2, the maximum y value an entity can take is 0x1b, and mario is set to start at y=0x19. This matches up with 27 tiles, where y=27 is the most bottom y coordinate an entity can have. Keep in mind Mario's y position is based on him being super mario, so it is one higher than he appears if he starts as regular mario.

I actually expected 26 to be the maximum value, not 27. Makes me think since there are 27.9375 tiles, the game rounded up to a total height of 28.