Parallel Worlds cave staircase exit Y-coordinate

View previous topic View next topic Go down

Parallel Worlds cave staircase exit Y-coordinate

Post by qwertymodo on Sat 21 May 2016 - 19:01

Sorry for the constant deluge of PW bug request threads.  I thought about consolidating them into the main progress thread, but then I thought that these are potentially issues people might run into in their own hacks, so for future reference it's probably easier to create separate threads.

Anywho, in PW, when you exit from a cave through one of the "hole in the ground staircases," it looks like the player sprite is on top of the ground.  Initially, I thought it was a similar layering bug to the indoor staircases that I just managed to fix, but it turns out, it's probably much simpler.  It seems that the Y-coordinate of the exit is just placed a bit too high.

(Click to view animation)

LoZ3 (correct)
[You must be registered and logged in to see this image.]

PW (incorrect)
[You must be registered and logged in to see this image.]

I swear I've seen a reference to this issue, probably in the Compendium doc, but I can't for the life of me find it now.  I feel pretty confident that this is a simple data fix, and not a code fix like the stairs... at least I reeeeally hope so...
avatar
qwertymodo
    
    

Since : 2014-10-21

Back to top Go down

Re: Parallel Worlds cave staircase exit Y-coordinate

Post by SunGodPortal on Sat 21 May 2016 - 19:35

I swear I've seen a reference to this issue, probably in the Compendium doc, but I can't for the life of me find it now.  I feel pretty confident that this is a simple data fix, and not a code fix like the stairs... at least I reeeeally hope so...

If the overworld can still be accessed via Hyrule Magic then you should be able to fix this by moving the entrance marker slightly (select "Entrance" and then drag it to where you need it). If you have this problem with a "dungeon" then the best way would be to select "Exit", double-click on the exit marker in question and then type in new coordinates in the "door" category. It's been a while since I've messed with this but I think I remember these coordinates being something like +2 for every 32x32 block. I believe the odd numbered coordinates set on top of the lines if you have the grid turned on in the editor.

If this has to be done via hex (due to HM not wanting to cooperate with this highly edited ROM) then someone like Puzzledude could answer your question better than I could.

PS: It looks like Link is also a pixel or two to the left.
avatar
SunGodPortal
                             
                             

Since : 2015-01-26

Back to top Go down

Re: Parallel Worlds cave staircase exit Y-coordinate

Post by qwertymodo on Sat 21 May 2016 - 19:51

Ok, I think I can edit in HM if I delete all of the dungeon objects/sprites/etc so HM stops complaining about them, then doing a before/after save comparison, then manually hex editing the original ROM.  Unfortunately, not all of those staircases have exits, so I'm not sure how to fix those.

LoZ3 (Correct)
[You must be registered and logged in to see this image.]

ZPW (Incorrect)
[You must be registered and logged in to see this image.]
avatar
qwertymodo
    
    

Since : 2014-10-21

Back to top Go down

Re: Parallel Worlds cave staircase exit Y-coordinate

Post by SunGodPortal on Sat 21 May 2016 - 20:04

If they don't have a white exit marker then that usually means that they belong to the rooms above 255. Most of those don't have exit markers (is Link's house the only one that does?) so all of it is handled via the yellow entrance markers in those cases. So, if there is no exit marker then you just need to move the entrance marker and that should take care of it.
avatar
SunGodPortal
                             
                             

Since : 2015-01-26

Back to top Go down

Re: Parallel Worlds cave staircase exit Y-coordinate

Post by Euclid on Sat 21 May 2016 - 23:13

Sad

didn't know i put the exit on the wrong tile.

PS for the 256+ rooms try looking through the entrance properties in HM - pretty sure the two "unknown" values are related to the exit
avatar
Euclid
                        
                        

Since : 2012-06-21

Back to top Go down

Re: Parallel Worlds cave staircase exit Y-coordinate

Post by SunGodPortal on Sat 21 May 2016 - 23:26

PS for the 256+ rooms try looking through the entrance properties in HM - pretty sure the two "unknown" values are related to the exit

Having fiddled with it a little again I noticed that if you double-click one of the entrances that does not have a corresponding exit marker and then click "More" within the dungeon editor the exit coordinates can be input there (very much out of the way) at the bottom. Kinda strange to put them there since they correspond to the overworld, not the dungeon. But whatever. LOL That's HM for you.
Very Happy

EDIT: I just realized that using this method is (probably entirely) pointless since it's only the dedicated exit markers that must be edited in this fashion. I'm pretty sure the yellow markers take care of this automatically (at least the ones that support these parameters) while the exit markers in HM were not programmed to be as user-friendly.
avatar
SunGodPortal
                             
                             

Since : 2015-01-26

Back to top Go down

Re: Parallel Worlds cave staircase exit Y-coordinate

Post by Puzzledude on Sun 22 May 2016 - 6:45

I swear I've seen a reference to this issue, probably in the Compendium doc, but I can't for the life of me find it now.  I feel pretty confident that this is a simple data fix, and not a code fix like the stairs... at least I reeeeally hope so...
This is otherwise a simple positioning of the white dot (overworld editing), which in this case is not really "incorrect", it is just placed a little to the left and up from Alttp.
But if there is no white dot (ie the yellow dot handles the esit automatically) then I believe there is nothing you can do, since in the More button you can edit the X and Y if the exit needs a special overlay-door (like house doors). In this case you have no such layer and with such automatic exits you are auto-positioned much higher than usual (to give player the feeling as if you would actual come from the indoors of the house, but obviously using such exit on the small staircase would seem to exit to high).

Puzzledude
   
   

Since : 2012-06-20

Back to top Go down

Re: Parallel Worlds cave staircase exit Y-coordinate

Post by qwertymodo on Sun 22 May 2016 - 16:48

Is there any good explanation of the interaction between the X/Y Position, X/Y Center, and X/Y Scroll parameters? When I move the white point with the mouse, it updates all 3, but I'm having trouble getting it to the exact correct point that I want it to be, so I'd like to be able to calculate them manually if possible.
avatar
qwertymodo
    
    

Since : 2014-10-21

Back to top Go down

Re: Parallel Worlds cave staircase exit Y-coordinate

Post by SunGodPortal on Sun 22 May 2016 - 18:38

I'd turn on the grid in the overworld editor and then compare a couple of the markers to get an idea of what is normal and how much each 32x32 block is worth within these parameters. I think in this case it may just be counting pixels.

Other than that I'd just say that practice makes perfect. I had a bit of trouble with this stuff when I first started editing these things but eventually got pretty good at it. No more doors in the middle of someone's yard.
Very Happy
avatar
SunGodPortal
                             
                             

Since : 2015-01-26

Back to top Go down

Re: Parallel Worlds cave staircase exit Y-coordinate

Post by qwertymodo on Sun 22 May 2016 - 23:02

Ok, so the staircases with exits, I'm able to reposition just fine, but the entrance markers seem to only be placeable on a 16x16 grid, and the ones in PW match up to the same placement as aLttP (i.e. the top-left quadrant of the stair graphics), so I'll have to figure out how that works.

Puzzledude wrote:But if there is no white dot (ie the yellow dot handles the exit automatically) then I believe there is nothing you can do

You had to go and say it, didn't you...

avatar
qwertymodo
    
    

Since : 2014-10-21

Back to top Go down

Re: Parallel Worlds cave staircase exit Y-coordinate

Post by Puzzledude on Mon 23 May 2016 - 7:01

Maybe I should refrase it then. I couldn't fix/change that and sometimes with those entrances, which are also auto exits, Link will start bellow facing up and auto walk up and auto turn down, instead of just exiting from above (ie when such an entrance/exit gets bugged).
You should also know that original authors have put the spot on where to exit on such an automated entrance/exit at the exact optimal spot (at least that's how they have seen it). But someone can argue that this location is to high though. Which basically means they were specifically meant for houses.

Puzzledude
   
   

Since : 2012-06-20

Back to top Go down

Re: Parallel Worlds cave staircase exit Y-coordinate

Post by Euclid on Mon 23 May 2016 - 7:37

qwertymodo wrote:Is there any good explanation of the interaction between the X/Y Position, X/Y Center, and X/Y Scroll parameters? When I move the white point with the mouse, it updates all 3, but I'm having trouble getting it to the exact correct point that I want it to be, so I'd like to be able to calculate them manually if possible.

In terms of exit - from memory of over 10 years ago:
X/Y position is where the link physical X/Y location would be (think $20-$23 registers location)
X/Y scroll value is the top left point of the screen when link exits a dungeon - by moving this value it effects how far link walks close to the edges before it moves the screen in the overworlds.
X/Y center is usually a relative point to the X/Y coordinate - as much as the description of this variable say "center" it's not really "center" you're thinking of. This affects the center of the "circle exit" effect when link exits the house/cave (you know the one where an oval expands from the exit? that one!)
Now Unk1 and Unk2 - at one stage I had a good crack at these two but I never managed to document what they do.

For Starting location (or entrances as people like to call them) - the story is similar.
X/Y is link's physical location.
X/Y scroll is the top left point of the visible screen when you enter.
CY/CX is the center X/Y respectively for the black circle effect, Note CY = Center X, CX = Center Y (it's labelled the wrong way around in HM).
Starting locations are also quite dumb, they don't detect room layouts of the initial room entered, so they rely on HU/FU/HL/FL/HD/FD/HR/FR to detect scrolling (HM usually do them right so you don't have to worry there)

When starting location corrupts, the Y/X scroll value goes berserk (4mil) - this causes the game to put -1 in the top left point, thus causing all sort of trouble in game with the entrances (infinite scrolling doors anyone? that's a side effect of the game trying to scroll from 65535 down to 256 or whatever the value should be. A corrupted CY/CX values do less damage, but still sometimes causes some bad numbers to be written in the ram.
avatar
Euclid
                        
                        

Since : 2012-06-21

Back to top Go down

Re: Parallel Worlds cave staircase exit Y-coordinate

Post by qwertymodo on Tue 24 May 2016 - 19:46

Ok, so it looks like the code for exiting a dungeon includes a hardcoded check that essentially says if Room # <= 292, move the exit Y coordinate up #$10 pixels.  When you walk into an entrance, it stores the player's current coordinates $20-$23 to $7EC148-4B.  Then when you exit, it loads $7EC148 and stores it back to $20.  However, it then loads $A0 (room index), compares it to #$124, and if it's less than that, it loads $20, subtracts #$10, then stores it back.  So, essentially the game is hardcoded to only have normal door exits for rooms < 292, and for those, it always bumps the player up by 16 pixels (to put you "inside" the doorway).  Here's the exit subroutine, with the relevant section commented (note that the code locations are FastROM, by default the subroutine would be at $02e4a3 instead):

Code:
82e4a3 phb          
82e4a4 phk          
82e4a5 plb          
82e4a6 stz $1b      
82e4a8 stz $0458    
82e4ab rep #$20      
82e4ad lda #$0000    
82e4b0 sta $7ec017  
82e4b4 lda #$00ff    
82e4b7 sta $040c    
82e4ba stz $04ac    
82e4bd lda $a0      
82e4bf cmp #$0104    
82e4c2 beq $e4d4    
82e4c4 cmp #$0180    
82e4c7 bcs $e4d4    
82e4c9 cmp #$0100    
82e4cc bcc $e4d4    
82e4ce jsr $e5d4    
82e5d4 rep #$20      
82e5d6 lda $7ec140  
82e5da sta $040a    
82e5dd lda $7ec142  
82e5e1 sta $1c      
82e5e3 lda $7ec144  
82e5e7 sta $e8      
82e5e9 sta $0122    
82e5ec sta $e6      
82e5ee sta $0124    
82e5f1 lda $7ec146  
82e5f5 sta $e2      
82e5f7 sta $011e    
82e5fa sta $e0      
82e5fc sta $0120    
82e5ff lda $7ec14a   // Get stored X-coord
82e603 sta $22       // Set active X-coord
82e605 lda $7ec148   // Get stored Y-coord
82e609 sta $20       // Set active Y-coord
82e60b lda $a0       // Get room index
82e60d cmp #$0124    // Check index < 292
82e610 bcs $e61a     // If index < 292:
82e612 lda $20       //   Get active Y-coord
82e614 sec           //  
82e615 sbc #$0010    //   Subtract 16 pixels
82e618 sta $20       //   Set active Y-coord
82e61a lda #$0002    // Else:
82e61d sta $2f      
82e61f lda $0696    
82e622 cmp #$ffff    
82e625 bne $e631    
82e631 lda $7ec14c  
82e635 sta $8a      
82e637 lda $7ec14e  
82e63b sta $84      
82e63d sec          
82e63e sbc #$0400    
82e641 and #$0f80    
82e644 asl a        
82e645 xba          
82e646 sta $88      
82e648 lda $84      
82e64a sec          
82e64b sbc #$0010    
82e64e and #$003e    
82e651 lsr a        
82e652 sta $86      
82e654 lda $7ec150  
82e658 sta $0618    
82e65b dec          
82e65c dec          
82e65d sta $061a    
82e660 lda $7ec152  
82e664 sta $061c    
82e667 dec          
82e668 dec          
82e669 sta $061e    
82e66c lda $7ec154  
82e670 sta $0600    
82e673 lda $7ec156  
82e677 sta $0602    
82e67a lda $7ec158  
82e67e sta $0604    
82e681 lda $7ec15a  
82e685 sta $0606    
82e688 lda $7ec15c  
82e68c sta $0610    
82e68f lda $7ec15e  
82e693 sta $0612    
82e696 lda $7ec160  
82e69a sta $0614    
82e69d lda $7ec162  
82e6a1 sta $0616    
82e6a4 lda $7ec16a  
82e6a8 sta $0624    
82e6ab lda $7ec16c  
82e6af sta $0626    
82e6b2 lda $7ec16e  
82e6b6 sta $0628    
82e6b9 lda $7ec170  
82e6bd sta $062a    
82e6c0 sep #$20      
82e6c2 lda $7ec164  
82e6c6 sta $0aa0    
82e6c9 lda $7ec165  
82e6cd sta $0aa1    
82e6d0 lda $7ec166  
82e6d4 sta $0aa2    
82e6d7 lda $7ec167  
82e6db sta $0aa3    
82e6de rep #$20      
82e6e0 rts          

So, it looks like it's time for a quick-and-dirty hack, but for people developing new hacks, be sure that your staircase-style entrances only go to rooms >= 292, unless it has an explicit separate exit marker.
avatar
qwertymodo
    
    

Since : 2014-10-21

Back to top Go down

Re: Parallel Worlds cave staircase exit Y-coordinate

Post by qwertymodo on Tue 24 May 2016 - 20:49

Quick-and-dirty hack complete.

Code:
seek($02E60B)
    jsl stair_entrance_check
    nop

seek($2480C0)
stair_entrance_check:
    lda $A0
    cmp #$00DF // Lava Isles - Tunnel
    beq +
    cmp #$0105 // Lake Ruins - Tower Key House
    beq +
    cmp #$0112 // Lava Isles - Merchant Store
    beq +
    cmp #$0116 // Lake Ruins - Fat Fairy Pond
    beq +
    cmp #$0122 // Kakariko Village - Fortune Teller
    beq +
    clc
    rtl
+;  sec
    rtl

I still need to fix the handful of other staircase entrances that have separate exits, but that should handle the ones that don't.


Last edited by qwertymodo on Wed 25 May 2016 - 12:53; edited 1 time in total
avatar
qwertymodo
    
    

Since : 2014-10-21

Back to top Go down

Re: Parallel Worlds cave staircase exit Y-coordinate

Post by SePH on Tue 24 May 2016 - 22:47

Euclid wrote:Sad

didn't know i put the exit on the wrong tile.
It wasn't you, I made the overworlds, remember? Razz

Anyhow, here's another overworld glitch that could be fixed while on topic of fixing glitches!



Jump to 10:55 in that video.

I seriously didn't knew about that one! Smile

SePH
    
    

Since : 2012-06-19

Back to top Go down

Re: Parallel Worlds cave staircase exit Y-coordinate

Post by qwertymodo on Tue 24 May 2016 - 23:09

Şëph wrote:Anyhow, here's another overworld glitch that could be fixed while on topic of fixing glitches!

I'll think about it, but that one's actually pretty funny Razz
avatar
qwertymodo
    
    

Since : 2014-10-21

Back to top Go down

Re: Parallel Worlds cave staircase exit Y-coordinate

Post by Puzzledude on Wed 25 May 2016 - 6:08

I seriously didn't knew about that one!
Me neither. Nice find, whoever found it. However editing overworlds with hex only is not always possible.

Puzzledude
   
   

Since : 2012-06-20

Back to top Go down

Re: Parallel Worlds cave staircase exit Y-coordinate

Post by qwertymodo on Wed 25 May 2016 - 13:38

Woo, I just finished fixing and testing the last of the overworld staircase entrances. They're all good now. Further overworld edits probably aren't going to happen unless there's a really compelling reason to do so. The bug Seph posted, I'll probably leave... call it an easter egg Razz
avatar
qwertymodo
    
    

Since : 2014-10-21

Back to top Go down

Re: Parallel Worlds cave staircase exit Y-coordinate

Post by Conn on Wed 25 May 2016 - 20:19

mh, if you'd ask me, I had this bug hundreds of time with my fairy flippers... no fun at all. If you run into it, the only way to reverse it is a reset. So if you have the possibility to edit the overworld (make barriers or whatever), I definitively would do that Wink

At least my approach was always to get the patches as perfect as possible without any glitches left.
avatar
Conn
                        
                        

Since : 2013-06-30

Back to top Go down

Re: Parallel Worlds cave staircase exit Y-coordinate

Post by SunGodPortal on Thu 26 May 2016 - 0:18

From the video it looked like the only way to get this bug was to do one of those pixel perfect bomb jumps. I wouldn't worry about it. If people run into it's probably because they were asking for it.
avatar
SunGodPortal
                             
                             

Since : 2015-01-26

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum