3.6 Adding and removing extra room states (alternative variants).
You can actually create room in Brinstar (for example) that will change itself when:
1. you got Morphing Ball item
2. you got Missiles
3. after defeating Spore Spawn
4. after defeating Kraid
5. after obtaining Power Bombs.
6. Maridia tube's explosion can also affect your room if you want to (raise water level, for example).
7. after defeating Mother Brain (when Zebes going to explode)
Limitations.
Any room can handle more that 4 alternative variants. You are limited only by free space in bank $8F. Every alternative state will take 31 ($1F) bytes.
Warning!
Adding more alternative states will overwrite data after the room you edit! If you need next room, then make new room in bank $8F (See 3.2)
Small note.
When I say "write on paper" or "read from paper" you can use temporary text file in your computer if you want to.
Let's start from removing (the easiest part).
For example, we need to remove all states from landing site room to free space for other rooms. In that case, in will raining forever. Or not raining if you change FX data.
1. Open room 791F8 in SMILE. Choose Edit > Pointers to call pointers window.
Write on a paper pointers for Door Data, Level Data and Scroll. If scroll is 0000 or 0001, don't write it. In this case, there is no scrolling data for each screen in mdb. All screens are blue or green. In our case, Door Out pointer is 927B, Scroll pointer is 9283 and Level Data pointer is С2C2BB.
2. Also, remember, how many doors in there. Move cursor to any door and press "D" to call Door Editor. In right part will be several doors listed as Door $00, Door $01 etc. Look at the last door. It's the Door $03. Add 1 in mind to count Door $00 and you'll get 4 doors in the room. Write on paper: "4 doors".
If there are just a pair of doors, then you can easy count them by yourself.
3. Repeat process for all alternative variants of this room. Click ComboBox with E5E6 in it. It's just right from ComboBox with level mdb in it (791F8). Door Out pointer is always the same but Scroll pointer and Level Data pointer sometimes may be different. In our case, the values are the same.
4. Close pointer window. Choose Edit > Room Properties in SMILE. Write on paper room's size. Quit SMILE
5. Let's open room 791F8 in hex.
791F8: ?? ?? ?? ?? ?? ?? ?? ?? 00 00 17 00 09 05 70 A0
79200: 00 7B 92 12 E6 0E 61 92 69 E6 47 92 12 E6 00 2D
79210: 92 E6 E5 BB C2 C2 01 06 05 C0 80 3D 88 93 81 81
79220: 01 83 92 00 00 16 C1 00 80 6A B7 C9 91 BB C2 C2
79230: 00 06 06 C0 80 3D 88 93 81 81 01 83 92 00 00 16
79240: C1 00 80 6A B7 C9 91 BB C2 C2 00 0C 05 D0 80 3D
79250: 88 93 81 81 01 83 92 00 00 16 C1 00 80 6A B7 C9
79260: 91 BB C2 C2 00 00 00 00 80 0D 8C 83 82 81 01 83
79270: 92 00 00 20 C1 26 80 6A B7 BD 91 16 89 22 89 2E
79280: 89 3A 89 00 00 02 02 02 02 02 02 02 00 00 02 02
79290: 02 02 02 02 02 01 00 02 02 02 02 02 02 02 00 00
792A0: 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01 01
792B0: 13 01 80
Let's color it a bit.
See the values on a paper. Door Out pointer is 927B and Scroll pointer is 9283. Door Out pointer is always located at 9 bytes from begining of mdb data. Everything is written backwards in hex. 9EE5 is written as E5 9E.
There is a small door array at 9EE5. Each door pointer have size of 2 bytes. How many doors are in that room? 4 doors. So door array have size of 2*4 bytes, starts at 79EE5 and ends at 79EEC.
791F0: ?? ?? ?? ?? ?? ?? ?? ?? 00 00 17 00 09 05 70 A0
79200: 00 7B 92 12 E6 0E 61 92 69 E6 47 92 12 E6 00 2D
79210: 92 E6 E5 BB C2 C2 01 06 05 C0 80 3D 88 93 81 81
79220: 01 83 92 00 00 16 C1 00 80 6A B7 C9 91 BB C2 C2
79230: 00 06 06 C0 80 3D 88 93 81 81 01 83 92 00 00 16
79240: C1 00 80 6A B7 C9 91 BB C2 C2 00 0C 05 D0 80 3D
79250: 88 93 81 81 01 83 92 00 00 16 C1 00 80 6A B7 C9
79260: 91 BB C2 C2 00 00 00 00 80 0D 8C 83 82 81 01 83
79270: 92 00 00 20 C1 26 80 6A B7 BD 91 16 89 22 89 2E
79280: 89 3A 89 00 00 02 02 02 02 02 02 02 00 00 02 02
79290: 02 02 02 02 02 01 00 02 02 02 02 02 02 02 00 00
792A0: 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01 01
792B0: 13 01 80
Legend.
Green: offset from start of ROM
Pink: Door Out pointer. Colored pink to differs it from pointers for pointers (colored yellow).
Blue: door array pointer.
??: data from other place. Don't touch it.
Let's color Scroll data. See at paper, Scroll data starts from 79283 but where it ends? See room dimensions on paper. Each screen in scroll data takes 1 byte. In our case, Width is 8, Height is 5. 9*5=45 screens in total. Convert 45 in hex. You'll get 2D. Add 2D to 79283. You'll get 792B0. Other data will starts there. But next room's mdb starts from 792B3. What's the data is located after Scroll Data? Special scrolling data. Scrolling PLMs are points to this. Let's color these bytes in brown.
If scroll data ends right before next room's mdb, then there is no Special scrolling data for this room.
791F0: ?? ?? ?? ?? ?? ?? ?? ?? 00 00 17 00 09 05 70 A0
79200: 00 7B 92 12 E6 0E 61 92 69 E6 47 92 12 E6 00 2D
79210: 92 E6 E5 BB C2 C2 01 06 05 C0 80 3D 88 93 81 81
79220: 01 83 92 00 00 16 C1 00 80 6A B7 C9 91 BB C2 C2
79230: 00 06 06 C0 80 3D 88 93 81 81 01 83 92 00 00 16
79240: C1 00 80 6A B7 C9 91 BB C2 C2 00 0C 05 D0 80 3D
79250: 88 93 81 81 01 83 92 00 00 16 C1 00 80 6A B7 C9
79260: 91 BB C2 C2 00 00 00 00 80 0D 8C 83 82 81 01 83
79270: 92 00 00 20 C1 26 80 6A B7 BD 91 16 89 22 89 2E
79280: 89 3A 89 00 00 02 02 02 02 02 02 02 00 00 02 02
79290: 02 02 02 02 02 01 00 02 02 02 02 02 02 02 00 00
792A0: 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01 01
792B0: 13 01 80
Legend.
Green: offset from start of ROM
Pink: Door Out pointer. Colored pink to differs it from pointers for pointers (colored yellow).
Orange: scroll array. 1 byte for every screen of room. It starts from upper-left corner of room.
Blue: door array pointer
Brown: special scrolling data. Scrolling PLMs are points to this.
??: data from other place. Don't touch it.
Now, let's color Level Data in red. See at paper. C2C2BB. Write it backwards. You'll get BB C2 C2. Search these bytes in your mdb. They are at 79213, 7922D, 79247 and 79261. Write them on paper or remember if you want.
Original state will always be after "E6 E5" bytes. Alternative states will always have a pointer. All bytes after pink ones and before red ones are used for alternative states.
Level Data for alternative state is at 7922D, 79247 and 79261. Everything in hex is stored backwards. Only last 4 digits used in pointers. So, search for "2D 92", "47 92" and "61 92" between pink bytes and first red bytes. Color it in yellow.
2 or 3 bytes before yellow-colored are used to determine what event should happen to load alternative state for this room after that.
12 E6 means E612 -- Events. 0E is a number of event. "Zebes is exploding" is stored under number 0E.
69 E6 means E669 -- item related event "Samus got Power Bombs". No third byte here.
12 E6 means E612 -- Events. 00 is a number of event. "Zebes is awake" is stored under number 00.
Let's color them too.
791F0: ?? ?? ?? ?? ?? ?? ?? ?? 00 00 17 00 09 05 70 A0
79200: 00 7B 92 12 E6 0E 61 92 69 E6 47 92 12 E6 00 2D
79210: 92 E6 E5 BB C2 C2 01 06 05 C0 80 3D 88 93 81 81
79220: 01 83 92 00 00 16 C1 00 80 6A B7 C9 91 BB C2 C2
79230: 00 06 06 C0 80 3D 88 93 81 81 01 83 92 00 00 16
79240: C1 00 80 6A B7 C9 91 BB C2 C2 00 0C 05 D0 80 3D
79250: 88 93 81 81 01 83 92 00 00 16 C1 00 80 6A B7 C9
79260: 91 BB C2 C2 00 00 00 00 80 0D 8C 83 82 81 01 83
79270: 92 00 00 20 C1 26 80 6A B7 BD 91 16 89 22 89 2E
79280: 89 3A 89 00 00 02 02 02 02 02 02 02 00 00 02 02
79290: 02 02 02 02 02 01 00 02 02 02 02 02 02 02 00 00
792A0: 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01 01
792B0: 13 01 80
Legend.
Green: offset from start of ROM
Red: pointer for level data
Yellow: pointer for pointer in bank 8F for level data
Aqua: alternative state. It shows what should happen for room to change.
Purple: extra value for alternative state.
Pink: Door Out pointer. Colored pink to differs it from pointers for pointers (colored yellow).
Orange: scroll array. 1 byte for every screen of room. It starts from upper-left corner of room.
Blue: door array pointer.
Brown: special scrolling data. Scrolling PLMs are points to this.
??: data from other place. Don't touch it.
79203: 61 92 is a pointer to pointer to 3rd alternative room ($8F 92 61)
7E208: 47 92 is a pointer to pointer to 2nd alternative room ($8F 92 47)
7E20C: 2D 92 is a pointer to pointer to 1st alternative room ($8F 92 2D)
Same thing, in more explaining form...
79203 => 79261 => C2C2BB (3rd alt. room)
7E208 => 79247 => C2C2BB (2nd alt. room)
7E20C => 7922D => C2C2BB (1st alt. room)
Original state's mdb will always be stored first.
If you want to remove...
6. Open ROM in hex at 791F8.
We'll need to:
7. Remove the pointer to alternative state.
Get rid of data between 7E203 and 7E207.
Result:
791F0: ?? ?? ?? ?? ?? ?? ?? ?? [00 00 17 00 09 05 70 A0
79200: 00 7B 92 xx xx xx xx xx 69 E6 47 92 12 E6 00 2D
79210: 92 E6 E5 BB C2 C2 01 06 05 C0 80 3D 88 93 81 81
79220: 01 83 92 00 00 16 C1 00 80 6A B7 C9 91 BB C2 C2
79230: 00 06 06 C0 80 3D 88 93 81 81 01 83 92 00 00 16
79240: C1 00 80 6A B7 C9 91 BB C2 C2 00 0C 05 D0 80 3D
79250: 88 93 81 81 01 83 92 00 00 16 C1 00 80 6A B7 C9
79260: 91 BB C2 C2 00 00 00 00 80 0D 8C 83 82 81 01 83
79270: 92 00 00 20 C1 26 80 6A B7 BD 91 16 89 22 89 2E
79280: 89 3A 89 00 00 02 02 02 02 02 02 02 00 00 02 02
79290: 02 02 02 02 02 01 00 02 02 02 02 02 02 02 00 00
792A0: 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01 01
792B0: 13 01 80]
xx: Data there is we no longer need.
8. Shift all data from 7E209 to 7E204. Stop right before last red bytes.
9. Fill 5 bytes before red bytes with FF's as we are shifted everything by 5 bytes.
Result:
791F0: ?? ?? ?? ?? ?? ?? ?? ?? 00 00 17 00 09 05 70 A0
79200: 00 7B 92 69 E6 47 92 12 E6 00 2D 92 E6 E5 BB C2
79210: C2 01 06 05 C0 80 3D 88 93 81 81 01 83 92 00 00
79220: 16 C1 00 80 6A B7 C9 91 BB C2 C2 00 06 06 C0 80
79230: 3D 88 93 81 81 01 83 92 00 00 16 C1 00 80 6A B7
79240: C9 91 BB C2 C2 00 0C 05 D0 80 3D 88 93 81 81 01
79250: 83 92 00 00 16 C1 00 80 6A B7 C9 91 FF FF FF FF
79260: FF BB C2 C2 00 00 00 00 80 0D 8C 83 82 81 01 83
79270: 92 00 00 20 C1 26 80 6A B7 BD 91 16 89 22 89 2E
79280: 89 3A 89 00 00 02 02 02 02 02 02 02 00 00 02 02
79290: 02 02 02 02 02 01 00 02 02 02 02 02 02 02 00 00
792A0: 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01 01
792B0: 13 01 80
A. Write on a paper address of first FF. It's 7925C. Close hex editor.
B. Open SMILE. Choose Edit > Pointers.
Write value "925C" in the "Door Out" field. Don't press buttons below yet.
C. If your scroll value is 0000 or 0001, then skip this step.
Look at paper. How many doors are there?
4 doors in our case. Every door will take 2 bytes. 4*2=8.
Value in "Scroll" field will be 925C+8=9265
And don't enter everything backwards!!! Remember: backwards in hex, normally in SMILE.
D. Save new values. Click on button "SAVE" below
When SMILE ask you "Copy data or leave it?" choose "YES".
When SMILE ask you again "Also move the pointer data?" choose "YES" as we are want to do it too.
E. Repeat the steps C-D for every alternative state. "Door Out" pointer is common for all states. It's value is correct now. Don't change it. Close SMILE.
F. Open ROM at offset 791F8 in hex.
791F0: ?? ?? ?? ?? ?? ?? ?? ?? 00 00 17 00 09 05 70 A0
79200: 00 7B 92 69 E6 47 92 12 E6 00 2D 92 E6 E5 BB C2
79210: C2 01 06 05 C0 80 3D 88 93 81 81 01 83 92 00 00
79220: 16 C1 00 80 6A B7 C9 91 BB C2 C2 00 06 06 C0 80
79230: 3D 88 93 81 81 01 83 92 00 00 16 C1 00 80 6A B7
79240: C9 91 BB C2 C2 00 0C 05 D0 80 3D 88 93 81 81 01
79250: 83 92 00 00 16 C1 00 80 6A B7 C9 91 16 89 22 89
79260: 2E 89 3A 89 00 00 02 02 02 02 02 02 02 00 00 02
79270: 02 02 02 02 02 02 01 00 02 02 02 02 02 02 02 00
79280: 00 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01
79290: 01 02 02 02 02 01 00 02 02 02 02 02 02 02 00 00
792A0: 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01 01
792B0: 13 01 80
Scroll data starts from 79264 but where it ends? See how many screens are in that room? See at paper. 9*5=45 screens. You've already converted it to hex. See step 5. It's 2D. Add 2D to 79264. You'll get 79291. What we get in final?
791F0: ?? ?? ?? ?? ?? ?? ?? ?? 00 00 17 00 09 05 70 A0
79200: 00 7B 92 69 E6 47 92 12 E6 00 2D 92 E6 E5 BB C2
79210: C2 01 06 05 C0 80 3D 88 93 81 81 01 83 92 00 00
79220: 16 C1 00 80 6A B7 C9 91 BB C2 C2 00 06 06 C0 80
79230: 3D 88 93 81 81 01 83 92 00 00 16 C1 00 80 6A B7
79240: C9 91 BB C2 C2 00 0C 05 D0 80 3D 88 93 81 81 01
79250: 83 92 00 00 16 C1 00 80 6A B7 C9 91 16 89 22 89
79260: 2E 89 3A 89 00 00 02 02 02 02 02 02 02 00 00 02
79270: 02 02 02 02 02 02 01 00 02 02 02 02 02 02 02 00
79280: 00 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01
79290: 01 02 02 02 02 01 00 02 02 02 02 02 02 02 00 00
792A0: 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01 01
792B0: 13 01 80
10. Now you can use data between orange bytes and brown bytes to something else. I recomend to write FF's there.
Final result.
791F0: ?? ?? ?? ?? ?? ?? ?? ?? 00 00 17 00 09 05 70 A0
79200: 00 7B 92 69 E6 47 92 12 E6 00 2D 92 E6 E5 BB C2
79210: C2 01 06 05 C0 80 3D 88 93 81 81 01 83 92 00 00
79220: 16 C1 00 80 6A B7 C9 91 BB C2 C2 00 06 06 C0 80
79230: 3D 88 93 81 81 01 83 92 00 00 16 C1 00 80 6A B7
79240: C9 91 BB C2 C2 00 0C 05 D0 80 3D 88 93 81 81 01
79250: 83 92 00 00 16 C1 00 80 6A B7 C9 91 16 89 22 89
79260: 2E 89 3A 89 00 00 02 02 02 02 02 02 02 00 00 02
79270: 02 02 02 02 02 02 01 00 02 02 02 02 02 02 02 00
79280: 00 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01
79290: 01 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
792A0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
792B0: 13 01 80
Store there a few door arrays, scrolling data or PLMs. Just don't overwrite brown bytes. If you'll remove 2 alternative states, there'll even be a place for new room.
6. Open ROM in hex at 791F8.
We'll need to:
7. Remove the pointer to alternative state.
Get rid of data between 7E203 and 7E210.
Result:
791F0: ?? ?? ?? ?? ?? ?? ?? ?? [00 00 17 00 09 05 70 A0
79200: 00 7B 92 xx xx xx xx xx xx xx xx xx xx xx xx xx
79210: xx E6 E5 BB C2 C2 01 06 05 C0 80 3D 88 93 81 81
79220: 01 83 92 00 00 16 C1 00 80 6A B7 C9 91 BB C2 C2
79230: 00 06 06 C0 80 3D 88 93 81 81 01 83 92 00 00 16
79240: C1 00 80 6A B7 C9 91 BB C2 C2 00 0C 05 D0 80 3D
79250: 88 93 81 81 01 83 92 00 00 16 C1 00 80 6A B7 C9
79260: 91 BB C2 C2 00 00 00 00 80 0D 8C 83 82 81 01 83
79270: 92 00 00 20 C1 26 80 6A B7 BD 91 16 89 22 89 2E
79280: 89 3A 89 00 00 02 02 02 02 02 02 02 00 00 02 02
79290: 02 02 02 02 02 01 00 02 02 02 02 02 02 02 00 00
792A0: 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01 01
792B0: 13 01 80]
xx: Data there is we no longer need.
8. Shift all data from 7E211 to 7E204. Stop right before next red bytes.
9. Fill 14 (dec) bytes before second red bytes with FF's as we are shifted everything by 14 (dec) bytes.
Result:
791F0: ?? ?? ?? ?? ?? ?? ?? ?? [00 00 17 00 09 05 70 A0
79200: 00 7B 92 E6 E5 BB C2 C2 01 06 05 C0 80 3D 88 93
79210: 81 81 01 83 92 00 00 16 C1 00 80 6A B7 C9 91 FF
79220: FF FF FF FF FF FF FF FF FF FF FF FF FF BB C2 C2
79230: 00 06 06 C0 80 3D 88 93 81 81 01 83 92 00 00 16
79240: C1 00 80 6A B7 C9 91 BB C2 C2 00 0C 05 D0 80 3D
79250: 88 93 81 81 01 83 92 00 00 16 C1 00 80 6A B7 C9
79260: 91 BB C2 C2 00 00 00 00 80 0D 8C 83 82 81 01 83
79270: 92 00 00 20 C1 26 80 6A B7 BD 91 16 89 22 89 2E
79280: 89 3A 89 00 00 02 02 02 02 02 02 02 00 00 02 02
79290: 02 02 02 02 02 01 00 02 02 02 02 02 02 02 00 00
792A0: 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01 01
792B0: 13 01 80]
A. Write on a paper address of first FF. It's 7921F. Close hex editor.
B. Open SMILE. Choose Edit > Pointers.
Write value "921F" in the "Door Out" field. Don't press buttons below yet.
C. If your scroll value is 0000 or 0001, then skip this step.
Look at paper. How many doors are there?
4 doors in our case. Every door will take 2 bytes. 4*2=8.
Value in "Scroll" field will be 921F+8=9227
And don't enter everything backwards!!! Remember: backwards in hex, normally in SMILE.
D. Save new values. Click on button "SAVE" below
When SMILE ask you "Copy data or leave it?" choose "YES".
When SMILE ask you again "Also move the pointer data?" choose "YES" as we are want to do it too.
E. Repeat the steps C-D for every alternative state. "Door Out" pointer is common for all states. It's value is correct now. Don't change it. Close SMILE.
F. Open ROM at offset 791F8 in hex.
Result:
791F0: ?? ?? ?? ?? ?? ?? ?? ??[00 00 17 00 09 05 70 A0
79200: 00 1F 92 E6 E5 00 80 E0 01 06 05 C0 80 3D 88 93
79210: 81 81 01 27 92 00 00 16 C1 00 80 6A B7 C9 91 16
79220: 89 22 89 2E 89 3A 89 00 00 02 02 02 02 02 02 02
79230: 00 00 02 02 02 02 02 02 02 01 00 02 02 02 02 02
79240: 02 02 00 00 02 02 02 02 02 02 02 01 01 01 01 01
79250: 01 01 01 01 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
79260: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
79270: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
79280: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
79290: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
792A0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
792B0: 13 01 80]
Free space of FF's can be used for doors, scrolling data, special scrolling data (PLM linking to that) or PLM's. In this case you can even write 2 more rooms at free space at 79254!
You can actually create room in Brinstar (for example) that will change itself when:
1. you got Morphing Ball item
2. you got Missiles
3. after defeating Spore Spawn
4. after defeating Kraid
5. after obtaining Power Bombs.
6. Maridia tube's explosion can also affect your room if you want to (raise water level, for example).
7. after defeating Mother Brain (when Zebes going to explode)
Limitations.
Any room can handle more that 4 alternative variants. You are limited only by free space in bank $8F. Every alternative state will take 31 ($1F) bytes.
Warning!
Adding more alternative states will overwrite data after the room you edit! If you need next room, then make new room in bank $8F (See 3.2)
Small note.
When I say "write on paper" or "read from paper" you can use temporary text file in your computer if you want to.
Let's start from removing (the easiest part).
For example, we need to remove all states from landing site room to free space for other rooms. In that case, in will raining forever. Or not raining if you change FX data.
1. Open room 791F8 in SMILE. Choose Edit > Pointers to call pointers window.
Write on a paper pointers for Door Data, Level Data and Scroll. If scroll is 0000 or 0001, don't write it. In this case, there is no scrolling data for each screen in mdb. All screens are blue or green. In our case, Door Out pointer is 927B, Scroll pointer is 9283 and Level Data pointer is С2C2BB.
2. Also, remember, how many doors in there. Move cursor to any door and press "D" to call Door Editor. In right part will be several doors listed as Door $00, Door $01 etc. Look at the last door. It's the Door $03. Add 1 in mind to count Door $00 and you'll get 4 doors in the room. Write on paper: "4 doors".
If there are just a pair of doors, then you can easy count them by yourself.
3. Repeat process for all alternative variants of this room. Click ComboBox with E5E6 in it. It's just right from ComboBox with level mdb in it (791F8). Door Out pointer is always the same but Scroll pointer and Level Data pointer sometimes may be different. In our case, the values are the same.
4. Close pointer window. Choose Edit > Room Properties in SMILE. Write on paper room's size. Quit SMILE
5. Let's open room 791F8 in hex.
791F8: ?? ?? ?? ?? ?? ?? ?? ?? 00 00 17 00 09 05 70 A0
79200: 00 7B 92 12 E6 0E 61 92 69 E6 47 92 12 E6 00 2D
79210: 92 E6 E5 BB C2 C2 01 06 05 C0 80 3D 88 93 81 81
79220: 01 83 92 00 00 16 C1 00 80 6A B7 C9 91 BB C2 C2
79230: 00 06 06 C0 80 3D 88 93 81 81 01 83 92 00 00 16
79240: C1 00 80 6A B7 C9 91 BB C2 C2 00 0C 05 D0 80 3D
79250: 88 93 81 81 01 83 92 00 00 16 C1 00 80 6A B7 C9
79260: 91 BB C2 C2 00 00 00 00 80 0D 8C 83 82 81 01 83
79270: 92 00 00 20 C1 26 80 6A B7 BD 91 16 89 22 89 2E
79280: 89 3A 89 00 00 02 02 02 02 02 02 02 00 00 02 02
79290: 02 02 02 02 02 01 00 02 02 02 02 02 02 02 00 00
792A0: 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01 01
792B0: 13 01 80
Let's color it a bit.
See the values on a paper. Door Out pointer is 927B and Scroll pointer is 9283. Door Out pointer is always located at 9 bytes from begining of mdb data. Everything is written backwards in hex. 9EE5 is written as E5 9E.
There is a small door array at 9EE5. Each door pointer have size of 2 bytes. How many doors are in that room? 4 doors. So door array have size of 2*4 bytes, starts at 79EE5 and ends at 79EEC.
791F0: ?? ?? ?? ?? ?? ?? ?? ?? 00 00 17 00 09 05 70 A0
79200: 00 7B 92 12 E6 0E 61 92 69 E6 47 92 12 E6 00 2D
79210: 92 E6 E5 BB C2 C2 01 06 05 C0 80 3D 88 93 81 81
79220: 01 83 92 00 00 16 C1 00 80 6A B7 C9 91 BB C2 C2
79230: 00 06 06 C0 80 3D 88 93 81 81 01 83 92 00 00 16
79240: C1 00 80 6A B7 C9 91 BB C2 C2 00 0C 05 D0 80 3D
79250: 88 93 81 81 01 83 92 00 00 16 C1 00 80 6A B7 C9
79260: 91 BB C2 C2 00 00 00 00 80 0D 8C 83 82 81 01 83
79270: 92 00 00 20 C1 26 80 6A B7 BD 91 16 89 22 89 2E
79280: 89 3A 89 00 00 02 02 02 02 02 02 02 00 00 02 02
79290: 02 02 02 02 02 01 00 02 02 02 02 02 02 02 00 00
792A0: 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01 01
792B0: 13 01 80
Legend.
Green: offset from start of ROM
Pink: Door Out pointer. Colored pink to differs it from pointers for pointers (colored yellow).
Blue: door array pointer.
??: data from other place. Don't touch it.
Let's color Scroll data. See at paper, Scroll data starts from 79283 but where it ends? See room dimensions on paper. Each screen in scroll data takes 1 byte. In our case, Width is 8, Height is 5. 9*5=45 screens in total. Convert 45 in hex. You'll get 2D. Add 2D to 79283. You'll get 792B0. Other data will starts there. But next room's mdb starts from 792B3. What's the data is located after Scroll Data? Special scrolling data. Scrolling PLMs are points to this. Let's color these bytes in brown.
If scroll data ends right before next room's mdb, then there is no Special scrolling data for this room.
791F0: ?? ?? ?? ?? ?? ?? ?? ?? 00 00 17 00 09 05 70 A0
79200: 00 7B 92 12 E6 0E 61 92 69 E6 47 92 12 E6 00 2D
79210: 92 E6 E5 BB C2 C2 01 06 05 C0 80 3D 88 93 81 81
79220: 01 83 92 00 00 16 C1 00 80 6A B7 C9 91 BB C2 C2
79230: 00 06 06 C0 80 3D 88 93 81 81 01 83 92 00 00 16
79240: C1 00 80 6A B7 C9 91 BB C2 C2 00 0C 05 D0 80 3D
79250: 88 93 81 81 01 83 92 00 00 16 C1 00 80 6A B7 C9
79260: 91 BB C2 C2 00 00 00 00 80 0D 8C 83 82 81 01 83
79270: 92 00 00 20 C1 26 80 6A B7 BD 91 16 89 22 89 2E
79280: 89 3A 89 00 00 02 02 02 02 02 02 02 00 00 02 02
79290: 02 02 02 02 02 01 00 02 02 02 02 02 02 02 00 00
792A0: 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01 01
792B0: 13 01 80
Legend.
Green: offset from start of ROM
Pink: Door Out pointer. Colored pink to differs it from pointers for pointers (colored yellow).
Orange: scroll array. 1 byte for every screen of room. It starts from upper-left corner of room.
Blue: door array pointer
Brown: special scrolling data. Scrolling PLMs are points to this.
??: data from other place. Don't touch it.
Now, let's color Level Data in red. See at paper. C2C2BB. Write it backwards. You'll get BB C2 C2. Search these bytes in your mdb. They are at 79213, 7922D, 79247 and 79261. Write them on paper or remember if you want.
Original state will always be after "E6 E5" bytes. Alternative states will always have a pointer. All bytes after pink ones and before red ones are used for alternative states.
Level Data for alternative state is at 7922D, 79247 and 79261. Everything in hex is stored backwards. Only last 4 digits used in pointers. So, search for "2D 92", "47 92" and "61 92" between pink bytes and first red bytes. Color it in yellow.
2 or 3 bytes before yellow-colored are used to determine what event should happen to load alternative state for this room after that.
12 E6 means E612 -- Events. 0E is a number of event. "Zebes is exploding" is stored under number 0E.
69 E6 means E669 -- item related event "Samus got Power Bombs". No third byte here.
12 E6 means E612 -- Events. 00 is a number of event. "Zebes is awake" is stored under number 00.
Let's color them too.
791F0: ?? ?? ?? ?? ?? ?? ?? ?? 00 00 17 00 09 05 70 A0
79200: 00 7B 92 12 E6 0E 61 92 69 E6 47 92 12 E6 00 2D
79210: 92 E6 E5 BB C2 C2 01 06 05 C0 80 3D 88 93 81 81
79220: 01 83 92 00 00 16 C1 00 80 6A B7 C9 91 BB C2 C2
79230: 00 06 06 C0 80 3D 88 93 81 81 01 83 92 00 00 16
79240: C1 00 80 6A B7 C9 91 BB C2 C2 00 0C 05 D0 80 3D
79250: 88 93 81 81 01 83 92 00 00 16 C1 00 80 6A B7 C9
79260: 91 BB C2 C2 00 00 00 00 80 0D 8C 83 82 81 01 83
79270: 92 00 00 20 C1 26 80 6A B7 BD 91 16 89 22 89 2E
79280: 89 3A 89 00 00 02 02 02 02 02 02 02 00 00 02 02
79290: 02 02 02 02 02 01 00 02 02 02 02 02 02 02 00 00
792A0: 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01 01
792B0: 13 01 80
Legend.
Green: offset from start of ROM
Red: pointer for level data
Yellow: pointer for pointer in bank 8F for level data
Aqua: alternative state. It shows what should happen for room to change.
Purple: extra value for alternative state.
Pink: Door Out pointer. Colored pink to differs it from pointers for pointers (colored yellow).
Orange: scroll array. 1 byte for every screen of room. It starts from upper-left corner of room.
Blue: door array pointer.
Brown: special scrolling data. Scrolling PLMs are points to this.
??: data from other place. Don't touch it.
79203: 61 92 is a pointer to pointer to 3rd alternative room ($8F 92 61)
7E208: 47 92 is a pointer to pointer to 2nd alternative room ($8F 92 47)
7E20C: 2D 92 is a pointer to pointer to 1st alternative room ($8F 92 2D)
Same thing, in more explaining form...
79203 => 79261 => C2C2BB (3rd alt. room)
7E208 => 79247 => C2C2BB (2nd alt. room)
7E20C => 7922D => C2C2BB (1st alt. room)
Original state's mdb will always be stored first.
If you want to remove...
6. Open ROM in hex at 791F8.
We'll need to:
7. Remove the pointer to alternative state.
Get rid of data between 7E203 and 7E207.
Result:
791F0: ?? ?? ?? ?? ?? ?? ?? ?? [00 00 17 00 09 05 70 A0
79200: 00 7B 92 xx xx xx xx xx 69 E6 47 92 12 E6 00 2D
79210: 92 E6 E5 BB C2 C2 01 06 05 C0 80 3D 88 93 81 81
79220: 01 83 92 00 00 16 C1 00 80 6A B7 C9 91 BB C2 C2
79230: 00 06 06 C0 80 3D 88 93 81 81 01 83 92 00 00 16
79240: C1 00 80 6A B7 C9 91 BB C2 C2 00 0C 05 D0 80 3D
79250: 88 93 81 81 01 83 92 00 00 16 C1 00 80 6A B7 C9
79260: 91 BB C2 C2 00 00 00 00 80 0D 8C 83 82 81 01 83
79270: 92 00 00 20 C1 26 80 6A B7 BD 91 16 89 22 89 2E
79280: 89 3A 89 00 00 02 02 02 02 02 02 02 00 00 02 02
79290: 02 02 02 02 02 01 00 02 02 02 02 02 02 02 00 00
792A0: 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01 01
792B0: 13 01 80]
xx: Data there is we no longer need.
8. Shift all data from 7E209 to 7E204. Stop right before last red bytes.
9. Fill 5 bytes before red bytes with FF's as we are shifted everything by 5 bytes.
Result:
791F0: ?? ?? ?? ?? ?? ?? ?? ?? 00 00 17 00 09 05 70 A0
79200: 00 7B 92 69 E6 47 92 12 E6 00 2D 92 E6 E5 BB C2
79210: C2 01 06 05 C0 80 3D 88 93 81 81 01 83 92 00 00
79220: 16 C1 00 80 6A B7 C9 91 BB C2 C2 00 06 06 C0 80
79230: 3D 88 93 81 81 01 83 92 00 00 16 C1 00 80 6A B7
79240: C9 91 BB C2 C2 00 0C 05 D0 80 3D 88 93 81 81 01
79250: 83 92 00 00 16 C1 00 80 6A B7 C9 91 FF FF FF FF
79260: FF BB C2 C2 00 00 00 00 80 0D 8C 83 82 81 01 83
79270: 92 00 00 20 C1 26 80 6A B7 BD 91 16 89 22 89 2E
79280: 89 3A 89 00 00 02 02 02 02 02 02 02 00 00 02 02
79290: 02 02 02 02 02 01 00 02 02 02 02 02 02 02 00 00
792A0: 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01 01
792B0: 13 01 80
A. Write on a paper address of first FF. It's 7925C. Close hex editor.
B. Open SMILE. Choose Edit > Pointers.
Write value "925C" in the "Door Out" field. Don't press buttons below yet.
C. If your scroll value is 0000 or 0001, then skip this step.
Look at paper. How many doors are there?
4 doors in our case. Every door will take 2 bytes. 4*2=8.
Value in "Scroll" field will be 925C+8=9265
And don't enter everything backwards!!! Remember: backwards in hex, normally in SMILE.
D. Save new values. Click on button "SAVE" below
When SMILE ask you "Copy data or leave it?" choose "YES".
When SMILE ask you again "Also move the pointer data?" choose "YES" as we are want to do it too.
E. Repeat the steps C-D for every alternative state. "Door Out" pointer is common for all states. It's value is correct now. Don't change it. Close SMILE.
F. Open ROM at offset 791F8 in hex.
791F0: ?? ?? ?? ?? ?? ?? ?? ?? 00 00 17 00 09 05 70 A0
79200: 00 7B 92 69 E6 47 92 12 E6 00 2D 92 E6 E5 BB C2
79210: C2 01 06 05 C0 80 3D 88 93 81 81 01 83 92 00 00
79220: 16 C1 00 80 6A B7 C9 91 BB C2 C2 00 06 06 C0 80
79230: 3D 88 93 81 81 01 83 92 00 00 16 C1 00 80 6A B7
79240: C9 91 BB C2 C2 00 0C 05 D0 80 3D 88 93 81 81 01
79250: 83 92 00 00 16 C1 00 80 6A B7 C9 91 16 89 22 89
79260: 2E 89 3A 89 00 00 02 02 02 02 02 02 02 00 00 02
79270: 02 02 02 02 02 02 01 00 02 02 02 02 02 02 02 00
79280: 00 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01
79290: 01 02 02 02 02 01 00 02 02 02 02 02 02 02 00 00
792A0: 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01 01
792B0: 13 01 80
Scroll data starts from 79264 but where it ends? See how many screens are in that room? See at paper. 9*5=45 screens. You've already converted it to hex. See step 5. It's 2D. Add 2D to 79264. You'll get 79291. What we get in final?
791F0: ?? ?? ?? ?? ?? ?? ?? ?? 00 00 17 00 09 05 70 A0
79200: 00 7B 92 69 E6 47 92 12 E6 00 2D 92 E6 E5 BB C2
79210: C2 01 06 05 C0 80 3D 88 93 81 81 01 83 92 00 00
79220: 16 C1 00 80 6A B7 C9 91 BB C2 C2 00 06 06 C0 80
79230: 3D 88 93 81 81 01 83 92 00 00 16 C1 00 80 6A B7
79240: C9 91 BB C2 C2 00 0C 05 D0 80 3D 88 93 81 81 01
79250: 83 92 00 00 16 C1 00 80 6A B7 C9 91 16 89 22 89
79260: 2E 89 3A 89 00 00 02 02 02 02 02 02 02 00 00 02
79270: 02 02 02 02 02 02 01 00 02 02 02 02 02 02 02 00
79280: 00 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01
79290: 01 02 02 02 02 01 00 02 02 02 02 02 02 02 00 00
792A0: 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01 01
792B0: 13 01 80
10. Now you can use data between orange bytes and brown bytes to something else. I recomend to write FF's there.
Final result.
791F0: ?? ?? ?? ?? ?? ?? ?? ?? 00 00 17 00 09 05 70 A0
79200: 00 7B 92 69 E6 47 92 12 E6 00 2D 92 E6 E5 BB C2
79210: C2 01 06 05 C0 80 3D 88 93 81 81 01 83 92 00 00
79220: 16 C1 00 80 6A B7 C9 91 BB C2 C2 00 06 06 C0 80
79230: 3D 88 93 81 81 01 83 92 00 00 16 C1 00 80 6A B7
79240: C9 91 BB C2 C2 00 0C 05 D0 80 3D 88 93 81 81 01
79250: 83 92 00 00 16 C1 00 80 6A B7 C9 91 16 89 22 89
79260: 2E 89 3A 89 00 00 02 02 02 02 02 02 02 00 00 02
79270: 02 02 02 02 02 02 01 00 02 02 02 02 02 02 02 00
79280: 00 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01
79290: 01 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
792A0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
792B0: 13 01 80
Store there a few door arrays, scrolling data or PLMs. Just don't overwrite brown bytes. If you'll remove 2 alternative states, there'll even be a place for new room.
6. Open ROM in hex at 791F8.
We'll need to:
7. Remove the pointer to alternative state.
Get rid of data between 7E203 and 7E210.
Result:
791F0: ?? ?? ?? ?? ?? ?? ?? ?? [00 00 17 00 09 05 70 A0
79200: 00 7B 92 xx xx xx xx xx xx xx xx xx xx xx xx xx
79210: xx E6 E5 BB C2 C2 01 06 05 C0 80 3D 88 93 81 81
79220: 01 83 92 00 00 16 C1 00 80 6A B7 C9 91 BB C2 C2
79230: 00 06 06 C0 80 3D 88 93 81 81 01 83 92 00 00 16
79240: C1 00 80 6A B7 C9 91 BB C2 C2 00 0C 05 D0 80 3D
79250: 88 93 81 81 01 83 92 00 00 16 C1 00 80 6A B7 C9
79260: 91 BB C2 C2 00 00 00 00 80 0D 8C 83 82 81 01 83
79270: 92 00 00 20 C1 26 80 6A B7 BD 91 16 89 22 89 2E
79280: 89 3A 89 00 00 02 02 02 02 02 02 02 00 00 02 02
79290: 02 02 02 02 02 01 00 02 02 02 02 02 02 02 00 00
792A0: 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01 01
792B0: 13 01 80]
xx: Data there is we no longer need.
8. Shift all data from 7E211 to 7E204. Stop right before next red bytes.
9. Fill 14 (dec) bytes before second red bytes with FF's as we are shifted everything by 14 (dec) bytes.
Result:
791F0: ?? ?? ?? ?? ?? ?? ?? ?? [00 00 17 00 09 05 70 A0
79200: 00 7B 92 E6 E5 BB C2 C2 01 06 05 C0 80 3D 88 93
79210: 81 81 01 83 92 00 00 16 C1 00 80 6A B7 C9 91 FF
79220: FF FF FF FF FF FF FF FF FF FF FF FF FF BB C2 C2
79230: 00 06 06 C0 80 3D 88 93 81 81 01 83 92 00 00 16
79240: C1 00 80 6A B7 C9 91 BB C2 C2 00 0C 05 D0 80 3D
79250: 88 93 81 81 01 83 92 00 00 16 C1 00 80 6A B7 C9
79260: 91 BB C2 C2 00 00 00 00 80 0D 8C 83 82 81 01 83
79270: 92 00 00 20 C1 26 80 6A B7 BD 91 16 89 22 89 2E
79280: 89 3A 89 00 00 02 02 02 02 02 02 02 00 00 02 02
79290: 02 02 02 02 02 01 00 02 02 02 02 02 02 02 00 00
792A0: 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01 01
792B0: 13 01 80]
A. Write on a paper address of first FF. It's 7921F. Close hex editor.
B. Open SMILE. Choose Edit > Pointers.
Write value "921F" in the "Door Out" field. Don't press buttons below yet.
C. If your scroll value is 0000 or 0001, then skip this step.
Look at paper. How many doors are there?
4 doors in our case. Every door will take 2 bytes. 4*2=8.
Value in "Scroll" field will be 921F+8=9227
And don't enter everything backwards!!! Remember: backwards in hex, normally in SMILE.
D. Save new values. Click on button "SAVE" below
When SMILE ask you "Copy data or leave it?" choose "YES".
When SMILE ask you again "Also move the pointer data?" choose "YES" as we are want to do it too.
E. Repeat the steps C-D for every alternative state. "Door Out" pointer is common for all states. It's value is correct now. Don't change it. Close SMILE.
F. Open ROM at offset 791F8 in hex.
Result:
791F0: ?? ?? ?? ?? ?? ?? ?? ??[00 00 17 00 09 05 70 A0
79200: 00 1F 92 E6 E5 00 80 E0 01 06 05 C0 80 3D 88 93
79210: 81 81 01 27 92 00 00 16 C1 00 80 6A B7 C9 91 16
79220: 89 22 89 2E 89 3A 89 00 00 02 02 02 02 02 02 02
79230: 00 00 02 02 02 02 02 02 02 01 00 02 02 02 02 02
79240: 02 02 00 00 02 02 02 02 02 02 02 01 01 01 01 01
79250: 01 01 01 01 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
79260: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
79270: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
79280: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
79290: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
792A0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
792B0: 13 01 80]
Free space of FF's can be used for doors, scrolling data, special scrolling data (PLM linking to that) or PLM's. In this case you can even write 2 more rooms at free space at 79254!