News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

Changing a door's "exit to" location while playing, via room states

Started by Moehr, June 12, 2017, 09:09:14 PM

Previous topic - Next topic

Moehr

Hello! I've been searching all over for the answer to a question about whether or not it's possible to change a room's door pointers based on an event state of the room. Based on the room data explanation in the mod manual it seems to me like the room's door pointers are listed outside of the event state info - or in other words, the standard 1, events 1 pointers change a lot of room info, but never info for the room's doors:

[spoiler]01        <-- Room index
00        <-- Room area
12        <-- X on map
02        <-- Y on map
05        <-- Width of room
01        <-- Height of room
70        <-- Up scroller value
A0        <-- Down scroller value
00        <-- Special Graphics Bitflag
F9 92     <-- Door Out pointer

12 E6     <-- Events 1 pointer
00        <-- Event value to trigger Events 1 room state
DF 92     <-- Pointer to Events 1's room pointers

E6 E5     <-- Standard 1 pointer
E8 D6 C2  <-- Level data pointer for Standard 1 room state
00        <-- Tileset
00        <-- Song Set
00        <-- Play Index
E0 80     <-- FX pointer
7A 84     <-- Enemy Set pointer
A1 80     <-- Enemy GFX pointer
C1 C1     <-- Background X/Y scrolling
00 00     <-- Room Scrolls pointer
00 00     <-- Unused pointer
00 00     <-- Main ASM pointer
58 80     <-- PLM Set pointer
99 B8     <-- Background pointer
D3 91     <-- Setup ASM pointer

E8 D6 C2  <-- Level data pointer for Events 1 room state.
00        <-- Tileset
09        <-- Song Set
05        <-- Play Index
E0 80     <-- FX pointer
7A 84     <-- Enemy Set pointer
A1 80     <-- Enemy GFX pointer
C1 C1     <-- Background X/Y scrolling
00 00     <-- Room Scrolls pointer
00 00     <-- Unused pointer
00 00     <-- Main ASM pointer
58 80     <-- PLM Set pointer
99 B8     <-- Background pointer
D3 91     <-- Setup ASM pointer

46 89     <-- Pointer to door data in bank $83 (door $00).
52 89     <-- Pointer to door data in bank $83 (door $01).[/spoiler]

What I am wondering is whether or not it is possible to use an event to change the door pointer for a single door in a room so that the following is possible:
enter the room from, say, crateria
do a thing to change the room state, changing where the exit leads
exit the room via the same door, but end up in norfair instead of crateria

If this has been already covered someplace, links to the info will do just fine. The Mod Manual and SMILE have been super easy to understand so far, so thanks to everyone who's done all this work over the years!

Quote58

If door pointers aren't included in room state info (which makes sense since that never happens in game), then the easiest way to make it work is to have room specific code (like layer1_2) that runs, checks which state the room is in, and then swaps the door pointers accordingly.

Scyzer

Easiest way to do this is to have an extra door set up in the room, so the door in question actually has 2 entries. In the second roomstate, change the level data so that the second door is used, not the first. This is obviously very space intensive as you need 2 copies of the level data. This could also be the more aesthetic route, as you could then alter the room slightly to give some indication that something is changing, rather than having the players confused about why the door has suddenly started leading somewhere else.

The second option is to hijack the door setup code to check for this situation, then manually change the door pointer if required.

Moehr

Cool! Thanks so much. I will mess around with both maybe and see what works best. There will definitely be some kind of explanation of how to change the room's state to get the door going where it needs to go.

I have a workaround which is less appealing visually but doesn't require room state changes; instead it would just use a bunch of doors that, one at a time, will go from grey to blue as the areas they lead to become accessible, which would also have some sort of associated graphic nearby as a visual reminder of where you would be headed.

The original idea was to be able to move Samus' ship to different map locations. Going through the mod manual I quickly realized that was super beyond me, so instead, I'll just be making one of the maps a small spacecraft with a door (or doors, if I can't get the roomstate method working) that lead to different landing sites.