User Tools

Site Tools


super:guides:newroom_pjboy

Making new rooms is simple if you know hex, if you don't, then you probably shouldn't be reading the advanced section.

First, here's the structure of a room:

Example room: A98D
0A              Room Index
02              Area
0C              X
0A              Y
08              Width
01              Height
70              Up Scroller
A0              Down Scroller
01              Unknown 4
A9D3            Door Out
E629            Event based state
02              State event condition
A9B9            Alternate state header---
                                        |
E5E6            Default state           |
C79D71          Level Data              |
1B              Graphic Set             |
05              Music1                  |
27              Music2                  |
84D0            FX1                     |
BB0E            Enemy Population        |
8B11            Enemy Set               |Alternate state
0101            Layer 2 Scroll          |header points
A9D7            Scroll                  |to its state
0000            RoomVar                 |
E8CD            FX2                     |
8B9E            PLM                     |
B84D            BG_Data                 |
91F6            Layer1_2                |
                                        |
C79D71          Level Data---------------
1B              Graphic Set
00              Music1
00              Music2
84D0            FX1
BB0E            Enemy Population
8B11            Enemy Set
0101            Layer 2 Scroll
A9D7            Scroll
0000            RoomVar
E8CD            FX2
8B9E            PLM
B858            BG_Data
91F6            Layer 1_2

Most, if not all, of Super Metroid's rooms' Door Out and Scroll pointers point to right after the end of the header. This of course isn't necessary.

First thing is to find free space in bank $8F, should be easy enough to find. Add the pointer to this free space the mdb.txt file that SMILE uses. Of course, the easiest thing to do is just copy another room's header, which again, shouldn't need instructions. The other method is to make it from scratch, although I don't see why you would, that being said, all you need is a valid level data pointer and room size for the room to open in SMILE; ie.

00 00 00 00 01 01 00 00 00 0000 E6E5 CB92CE 00 00 00 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

(reversed values) is valid for SMILE. The only thing you *do* need to handle in hex is states.

There are 9 states coded into the game, and you're free to add more. The 'Event based state' as I've called it is a pointer to ASM, the pre-coded routines use the 'State event condition' as a parameter. eg. The E612 Event based state checks if an event has been done, it takes an 8-bit parameter which is which event it checks. Here are the event state pointers build into the game:

E5E6            Nothing/Default
E5EB dddd       Checks which door you've come through
E5FF            Mother Brain's dead
E612 rr         Checks if an event has been set
E629 bb         Checks if a boss has been slayed
E640            Checks if morphball has been collected
E652            Checks if morphball and missiles have been collected
E669            Checks if power bombs have been collected
E678            Checks if speedbooster has been collected

This by the way, is why SMILE groups specific events together and only allows you to choose from them (the length of the parameter). The order these are put in the room header is the order they're checked in, once a state checks out as true, it's used. So if you have the morphball state, followed by the Mother Brain check, (unless they don't have morphball) the Mother Brain state will never be used. This is why the default state goes last.

All Event based states are followed by a pointer which points to the pointers that are used for the room (should be obvious); the exception is of course, the default state, the pointers follow straight after it.

Last note, remember that all values and pointers are reversed! And some/most hex editors *insert* when you paste data, compromise the insert by deleting however many of the following bytes as you inserted.

super/guides/newroom_pjboy.txt · Last modified: 2015/02/28 22:59 by 127.0.0.1