Glitch City Laboratories Archives

Glitch City Laboratories closed on 1 September 2020 (announcement). This is an archived copy of a thread from Glitch City Laboratories Forums.

You can join Glitch City Research Institute to ask questions or discuss current developments.

You may also download the archive of this forum in .tar.gz, .sql.gz, or .sqlite.gz formats.

Generation I Glitch Discussion

WTW mechanics discussions - Page 1

WTW mechanics discussions

Posted by: SatoMew
Date: 2015-02-18 23:10:57
On an unrelated note, 01xx38CD can be set to 00 to revert the behavior of "walking through walls". I don't know if this was already known since people always mention 010138CD but this is far more practical than disabling the code and entering another map from a warp in order to restore the normal behavior.

Re: WTW mechanics discussions

Posted by: Torchickens
Date: 2015-02-18 23:28:40

On an unrelated note, 01xx38CD can be set to 00 to revert the behavior of "walking through walls". I don't know if this was already known since people always mention 010138CD but this is far more practical than disabling the code and entering another map from a warp in order to restore the normal behavior.


Yes. I usually go to CD38 in memory viewer, set it to 01 when I need to and set it to 00 when I want it off (e.g. when I want to use an exit) but people may not be aware you can disable WTW like that.

I don't know if you know, but CD38 is actually set to 01 when you jump off a ledge. If you use 010038CD and try to jump off a ledge, you won't go two tiles below for some reason and you will end up on top of the ledge.

It is also used when a guide takes you somewhere; where it counts down from a value (29h for the person who brings you to the Pewter Gym, 11h for Professor Oak) each step until it becomes 00h, after which:

For Professor Oak - he disappears interestingly, the game locks up (if you set CD38 to 00 early) and the guide music still plays. In at least Yellow you enter the door while CD38 is 01 so this behaviour is not seen.
For the Pewter Gym guy - the music goes back to normal, the guide stops and says "If you have the right stuff, go take on BROCK!" and he starts walking back.

Re: WTW mechanics discussions

Posted by: SatoMew
Date: 2015-02-18 23:37:04

I don't know if you know, but CD38 is actually set to 01 when you jump off a ledge. If you use 010038CD and try to jump off a ledge, you won't go two tiles below for some reason and you will end up on top of the ledge.

It is also used when a guide takes you somewhere; where it counts down from a value (29h for the person who brings you to the Pewter Gym, 11h for Professor Oak) each step until it becomes 00h, after which:

For Professor Oak - he disappears interestingly, the game locks up (if you set CD38 to 00 early) and the guide music still plays. In at least Yellow you enter the door while CD38 is 01 so this behaviour is not seen.
For the Pewter Gym guy - the music goes back to normal, the guide stops and says "If you have the right stuff, go take on BROCK!" and he starts walking back.


I didn't know that, interesting. I noticed that guides and guards (like the one in the Safari Zone's gate) were affected by CD38 being set to 00 since the game appeared to loop their scripts until I disabled the code.

…And I just found this: https://sourceforge.net/p/vbam/bugs/116/
I had completely forgotten about it. There are some save files there, in case anyone wants to check them out.

Re: WTW mechanics discussions

Posted by: pigdevil2010
Date: 2015-02-22 03:26:44


On an unrelated note, 01xx38CD can be set to 00 to revert the behavior of "walking through walls". I don't know if this was already known since people always mention 010138CD but this is far more practical than disabling the code and entering another map from a warp in order to restore the normal behavior.


Yes. I usually go to CD38 in memory viewer, set it to 01 when I need to and set it to 00 when I want it off (e.g. when I want to use an exit) but people may not be aware you can disable WTW like that.

I don't know if you know, but CD38 is actually set to 01 when you jump off a ledge. If you use 010038CD and try to jump off a ledge, you won't go two tiles below for some reason and you will end up on top of the ledge.

It is also used when a guide takes you somewhere; where it counts down from a value (29h for the person who brings you to the Pewter Gym, 11h for Professor Oak) each step until it becomes 00h, after which:

For Professor Oak - he disappears interestingly, the game locks up (if you set CD38 to 00 early) and the guide music still plays. In at least Yellow you enter the door while CD38 is 01 so this behaviour is not seen.
For the Pewter Gym guy - the music goes back to normal, the guide stops and says "If you have the right stuff, go take on BROCK!" and he starts walking back.


CD38 tells the game if it's simulating joypad states. This feature is used to make the game controls the player in some scripts. When the game is simulating joypad states, it will completely ignore any collision just like how the game do it with NPC. This means that setting CD38 to 01 will fools the game out that it's simulating joypad states and won't check the collision data. Hence why you can walk through walls.

Re: WTW mechanics discussions

Posted by: SatoMew
Date: 2015-02-22 07:03:29

CD38 tells the game if it's simulating joypad states. This feature is used to make the game controls the player in some scripts. When the game is simulating joypad states, it will completely ignore any collision just like how the game do it with NPC. This means that setting CD38 to 01 will fools the game out that it's simulating joypad states and won't check the collision data. Hence why you can walk through walls.


pokechu022 once said that CD38 is a step counter. Which one is correct?

In the Generation II games, there are 4 addresses manipulated by the various codes, with each allowing the player to "walk through walls" in one of the four directions (north, south, east, west–not by this order). Is there an address in these games like CD38 of the Generation I games?

Re: WTW mechanics discussions

Posted by: Torchickens
Date: 2015-02-22 12:32:44


CD38 tells the game if it's simulating joypad states. This feature is used to make the game controls the player in some scripts. When the game is simulating joypad states, it will completely ignore any collision just like how the game do it with NPC. This means that setting CD38 to 01 will fools the game out that it's simulating joypad states and won't check the collision data. Hence why you can walk through walls.


pokechu022 once said that CD38 is a step counter. Which one is correct?


It could be both/at least CD38 double serves as letting you walk through walls and as a steps left counter. CD38 can act as a value that decreases every step a guide takes. When you follow guide routes from Professor Oak, the Pewter Gum guy or the Pewter Museum guy, it starts at a value and counts down for every step they take (normally until 00 but Oak is an exception) until the guide takes you to your destination. For the Pewter Gym and Pewter Museum guys CD38 becomes 00, causing you to get a message and they start walking back.

For Oak taking you to his lab, CD38 also serves as a steps left counter, but in Red (Blue?) and Yellow it never gets to 00. If you hack it to 00 when Oak is taking you to his lab then Oak disappears, the music still plays and the game locks up.

CD38 is not a steps left counter for certain other things. I will note for reference that there are different addresses for Repel steps left (I think that address can be found in the diassembly) or steps left until you take poison damage/whether you will black out (that is controlled by D13B).

But I don't know anything about what determines the all fainted Pokémon steps left in Yellow (in Yellow, unlike Red/Blue the game will have it so you can only make one step until you black out if you have all fainted Pokémon even if you save and reset (and in Red/Blue you can increase the amount of extra steps you can take by saving and resetting or using the glitch item "il" (hex:6D)).


In the Generation II games, there are 4 addresses manipulated by the various codes, with each allowing the player to "walk through walls" in one of the four directions (north, south, east, west–not by this order). Is there an address in these games like CD38 of the Generation I games?


I don't know off the top of my head, I'm afraid.

Re: WTW mechanics discussions

Posted by: SatoMew
Date: 2015-02-22 12:53:13
Thanks for the input :)

Re: WTW mechanics discussions

Posted by: Torchickens
Date: 2015-02-22 13:07:34

Thanks for the input :)


You're welcome.

My description is not exactly accurate. CD38 briefly becomes 02, then 01, then 00 when jumping down off a ledge in Red and there is no guide there. I tried setting it to FF when it become 02 and something weird happened; I jumped up instead and the start menu popped up with the controls locked (and I note that FFF9 is still 00 meaning the game is still reading buttons from the 'joypad' but they still have no effect).

[img]http://i7.minus.com/iHB8DJDzizKmM.png[/img]

Pigdevil2010's explanation explains the start menu thing partly because the game is in the position for simulating button presses and up, down, left, right aren't the only buttons.

Re: WTW mechanics discussions

Posted by: SatoMew
Date: 2015-02-22 13:20:18

My description is not exactly accurate. CD38 briefly becomes 02, then 01, then 00 when jumping down off a ledge in Red and there is no guide there. I tried setting it to FF when it become 02 and something weird happened; I jumped up instead and the start menu popped up with the controls locked (and I note that FFF9 is still 00 meaning the game is still reading buttons from the 'joypad' but they still have no effect).

[img]http://i7.minus.com/iHB8DJDzizKmM.png[/img]


Interesting. I tried the same (FF the moment it became 02) in Japanese Red; it became FB after jumping down the ledge and I can "walk through walls". I did this with the ledge right next to the Pokémon Center in Cerulean City and playing on BGB.

[img width=825]http://i.imgur.com/EdlVW4Z.png[/img]

Re: WTW mechanics discussions

Posted by: Torchickens
Date: 2015-02-22 14:02:07
I forgot to mention something related to the unexpected ledge behaviour.

If after the game does a route (e.g. changing CD38 to someting like 29h and making it count down) you change CD38 to a high value greater than the maxium CD38 value (like what we did for the ledge 02 value) then the game may make 'joypad' inputs not included in the route like going up unexpectedly or opening the start menu.

It turns out that an individual CD38 value may represent one of the button presses or combination of button presses in the route. For example, for talking to the Pewter Gym guy from the left, when CD38 is 15 the game simulates an up press.

So if you kept writing 15 to CD38 during this route you (but not the guide) would keep walking up, and another example would be if you kept writing 07 you would keep walking down.

[img]http://i2.minus.com/iUTdsZRzNfodE.png[/img]

I think the source of the excessive 'glitch' CD38 value inputs may be extrapolated from the route as it appears in the ROM. Though that is a theory. When I get my own laptop back I will test this theory.

As we have learned from "Brock Through Walls" to make a route the game looks for coordinates that match your coordinates from where you activated the route, at an address ending in 2, 6, A or E. It then reads a pointer directly following those coordinates that represents what the route is and executes it (so in the format: y, x, path pointer byte 1, path pointer byte 2).

I do not know the data structure of a route, but say it included 50 joypad inputs. If you forced the game to load input 255, maybe the input would be located past where the route is located in the ROM (so it would be unrelated data executed as a button).

Re: WTW mechanics discussions

Posted by: SatoMew
Date: 2015-02-22 14:15:02
That would explain the different results we got, correct? Actually, isn't the menu open automatically when you perform the Mew glitch as soon as you arrive at the exact tile on Route 24? I'm not sure of that behavior right now (may be a false memory) but perhaps it happens due to CD38 changing?

Re: WTW mechanics discussions

Posted by: Torchickens
Date: 2015-02-22 14:56:01
Maybe. To grasp at straws it could be a memory related thing too though.


That would explain the different results we got, correct? Actually, isn't the menu open automatically when you perform the Mew glitch as soon as you arrive at the exact tile on Route 24? I'm not sure of that behavior right now (may be a false memory) but perhaps it happens due to CD38 changing?


I don't think that's related to CD38 personally.

While the start menu often pops up when you return to the place you escaped from after beating a Trainer on another route, what pops up is determined by which text box you viewed last.

The game stores the index number of the last text box in CF13. If you opened the start menu it is 00 and the game seems to bring up the start menu for 00 values for every applicable Trainer-Fly place.

However, you can do things like talk to people and view signs to get different CF13 values. Different maps have different text boxes, so you can get unexpected messages. For example, one of the signs in Lavender Town is "May the Souls of POKéMON Rest Easy"(…) and has an ID of 09. On Route 8 (west of Lavender Town and where you can set up a Trainer-Fly), ID 09 belongs to the text of a Lass.

This means if you Trainer-Flied from Route 8, beat a Trainer from another route, viewed that sign in Lavender Town then returned to Route 8 the game would bring up her text (I confirmed it bringing up her text from after battle and I previously beat her, maybe the game would bring up her text before battle if you didn't beat her?)

Is it OK if I split the talk about CD38 from this thread Sato? It's getting deep and not related to the glitch Pikachu eye states.

Re: WTW mechanics discussions

Posted by: SatoMew
Date: 2015-02-22 14:59:46
I see, thanks for clarifying.


Is it OK if I split the talk about CD38 from this thread Sato? It's getting deep and not related to the glitch Pikachu eye states.


Sure, go ahead and split it ;)

Re: WTW mechanics discussions

Posted by: Torchickens
Date: 2015-02-22 15:07:43
You're welcome.

Cool. Split.

Re: WTW mechanics discussions

Posted by: pigdevil2010
Date: 2015-02-22 18:49:55


CD38 tells the game if it's simulating joypad states. This feature is used to make the game controls the player in some scripts. When the game is simulating joypad states, it will completely ignore any collision just like how the game do it with NPC. This means that setting CD38 to 01 will fools the game out that it's simulating joypad states and won't check the collision data. Hence why you can walk through walls.


pokechu022 once said that CD38 is a step counter. Which one is correct?

In the Generation II games, there are 4 addresses manipulated by the various codes, with each allowing the player to "walk through walls" in one of the four directions (north, south, east, west–not by this order). Is there an address in these games like CD38 of the Generation I games?


Because it is an array index of CCD3. If you execute this code in Red/Blue:
call $3486
while CD38 is set to 4 and CCD3-CCD6 are filled with 08 (start button joypad constant). You can see that the game starts to act like you pressed start button 4 times and the value at CD38 will decrease. Since the script mostly load direction buttons to CCD3, one may mistake that it's a step counter.