Wrong warp (Generation IV)

From Glitch City Wiki
(Redirected from Coordinate warp)
Jump to navigation Jump to search

In Pokémon Diamond and Pearl, wrong warps are warps with unintended destinations. Warps that has the potential to be a wrong warp are those with a dynamic destination, which is usually a location the player was at earlier, with X and Y coordinates stored as unsigned 16-bit integers. If the player triggers the location saving while at coordinates out of the 0 – 65535 range, and/or bypass the intended location saving script altogether, those warps will put the player at "wrong" destinations.

Saving the game and resetting while at coordinates out of the -32768 – 32767 range also cause an effect similar to wrong warping, although the mechanics are a little different because the saved 16-bit coordinates are treated as signed integers.

Coordinate warp

Coordinate warps are warps to the wrong coordinates due to the conversion between 32-bit integers (the "live coordinates") and unsigned 16-bit integers (the saved coordinates).

For example, in the Union Room wrong-warping glitch, the player warps to the Union Room at Y = -1, which is internally represented as the 32-bit number 0xFFFFFFFF. However, when storing the player's coordinate to warp back to when leaving the Union Room, the coordinate is stored as 0xFFFF, which is then converted to 0x0000FFFF, or 65535, when the player actually leaves the Union Room. As a result, the player is put at a fake version of a Pokémon center top floor map, breaking the map script that should be run when the player goes back to the top floor.

The destination coordinates of of a coordinate warp is the original coordinates modulo 65536. In other words, a multiple of 65536 is added or subtracted to force the coordinates into the 0 – 65535 range.

Other examples of pure coordinate warps include:

  • The Spear Pillar wrong warp, caused by using the Retire glitch to run the 4th script in Spear Pillar.
  • The Vista Lighthouse wrong warp, caused by using the Alt-Retire glitch to run the 3rd script in the Observation Deck.

True wrong warp

"True" wrong warps occur when the game fail to save the player's location with the intended script, causing a previously saved player location to be used instead. They may also be coordinate warps if the previously saved coordinates are out of the 0 – 65535 range.

A notable example of a true wrong warp happens when the player resets after setting up a Union Room wrong-warping glitch. The player is still supposed to warp back to the Pokémon center top floor, but this warp destination is stored in a different set of variables in the memory, and when the player triggers the warp into the Union Room in an unexpected location, due to an error check, those variables aren't set. Therefore, after resetting, the player will take a wrong warp to the location determined by those variables.

This particular set of variables are also used for many other warps, including elevators, the Safari Zone, and most usefully, the Explorer Kit. When the message asking whether the player wants to use the Explorer Kit pops up, those variables are changed to the player's current location (including the X and Y coordinates, and the Matrix, which will always be the Sinnoh outdoor region for the Explorer Kit). Therefore, by using the Explorer Kit, the player can easily set up the warp destination.

Notably, by using the Explorer Kit in the void where one or both coordinates are negative but relatively close to 0, the player can coordinate warp to a faraway location close to a fake Sinnoh. This allows the player to access a fake Sinnoh without having to travel tens of thousands of steps in the void.

Another example of a true wrong warp can be set up by using the Retire glitch to set the "Safari mode" flag.

Saving and resetting

Saving and resetting while having out of range coordinates works very similar to coordinate warps. However, here the game treats the saved coordinates as signed 16-bit integers, so the coordinates are instead forced into the -32768 – 32767 range.

A consequence of this is that saving and resetting will never put the player anywhere near a fake Sinnoh. Conversely, saving in a fake Sinnoh and resetting will put the player in the real Sinnoh, which is a convenient way to reach physical locations in Sinnoh outdoor maps through the void.