PP copier glitch: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
No edit summary |
|||
Line 28: | Line 28: | ||
*Manipulate wCurMapTileset (D367; item 37 quantity) to a value that allows leaving the map with Escape Rope (e.g. 03). Though the animation might be glitched and lag, this can be used to escape the map. If Fly flags were corrupted, attempting to Fly away may be impossible due to the [[unterminated Fly destinations]] glitch. |
*Manipulate wCurMapTileset (D367; item 37 quantity) to a value that allows leaving the map with Escape Rope (e.g. 03). Though the animation might be glitched and lag, this can be used to escape the map. If Fly flags were corrupted, attempting to Fly away may be impossible due to the [[unterminated Fly destinations]] glitch. |
||
==Explanation== |
==Explanation== |
||
[https://github.com/pret/pokered/blob/2954013da1f10e11db4ec96f9586b7c01706ae1a/engine/pokemon/status_screen.asm The relevant |
[https://github.com/pret/pokered/blob/2954013da1f10e11db4ec96f9586b7c01706ae1a/engine/pokemon/status_screen.asm The relevant subroutines in the Pokémon Red disassembly can be found here]. |
||
<pre> |
|||
ldh a, [hTileAnimations] |
|||
push af |
|||
xor a |
|||
ldh [hTileAnimations], a |
|||
ldh [hAutoBGTransferEnabled], a |
|||
ld bc, NUM_MOVES + 1 |
|||
ld hl, wMoves |
|||
call FillMemory |
|||
ld hl, wLoadedMonMoves |
|||
ld de, wMoves |
|||
ld bc, NUM_MOVES |
|||
call CopyData |
|||
callfar FormatMovesString |
|||
hlcoord 9, 2 |
|||
lb bc, 5, 10 |
|||
call ClearScreenArea ; Clear under name |
|||
hlcoord 19, 3 |
|||
ld [hl], $78 |
|||
hlcoord 0, 8 |
|||
ld b, 8 |
|||
ld c, 18 |
|||
call TextBoxBorder ; Draw move container |
|||
hlcoord 2, 9 |
|||
ld de, wMovesString |
|||
call PlaceString ; Print moves |
|||
ld a, [wNumMovesMinusOne] |
|||
inc a |
|||
ld c, a |
|||
ld a, $4 |
|||
sub c |
|||
ld b, a ; Number of moves ? |
|||
hlcoord 11, 10 |
|||
ld de, SCREEN_WIDTH * 2 |
|||
ld a, "<BOLD_P>" |
|||
call StatusScreen_PrintPP ; Print "PP" |
|||
ld a, b |
|||
and a |
|||
jr z, .InitPP |
|||
ld c, a |
|||
ld a, "-" |
|||
call StatusScreen_PrintPP ; Fill the rest with -- |
|||
.InitPP |
|||
ld hl, wLoadedMonMoves |
|||
decoord 14, 10 |
|||
ld b, 0 |
|||
.PrintPP |
|||
ld a, [hli] |
|||
and a |
|||
jr z, .PPDone |
|||
push bc |
|||
push hl |
|||
push de |
|||
ld hl, wCurrentMenuItem |
|||
ld a, [hl] |
|||
push af |
|||
ld a, b |
|||
ld [hl], a |
|||
push hl |
|||
callfar GetMaxPP |
|||
pop hl |
|||
pop af |
|||
ld [hl], a |
|||
pop de |
|||
pop hl |
|||
push hl |
|||
ld bc, wPartyMon1PP - wPartyMon1Moves - 1 |
|||
add hl, bc |
|||
ld a, [hl] |
|||
and $3f |
|||
ld [wStatusScreenCurrentPP], a |
|||
ld h, d |
|||
ld l, e |
|||
push hl |
|||
ld de, wStatusScreenCurrentPP |
|||
lb bc, 1, 2 |
|||
call PrintNumber |
|||
ld a, "/" |
|||
ld [hli], a |
|||
ld de, wMaxPP |
|||
lb bc, 1, 2 |
|||
call PrintNumber |
|||
pop hl |
|||
ld de, SCREEN_WIDTH * 2 |
|||
add hl, de |
|||
ld d, h |
|||
ld e, l |
|||
pop hl |
|||
pop bc |
|||
inc b |
|||
ld a, b |
|||
cp $4 |
|||
jr nz, .PrintPP |
|||
</pre> |
|||
==YouTube video== |
==YouTube video== |