shithub: pokecrystal

Download patch

ref: ad299b16358b5d73e24e0c12d2746936aad7f2ce
parent: d6db0104294aa5f449dac69e1965f552d95440fa
author: mid-kid <esteve.varela@gmail.com>
date: Sun Jun 9 21:52:46 EDT 2019

Apply suggested changes

--- a/docs/bugs_and_glitches.md
+++ b/docs/bugs_and_glitches.md
@@ -1337,31 +1337,11 @@
 
 ## Move selection menu doesn't handle joypad properly
 
-This is an oversight, where `hInMenu` isn't set properly in the menu that handles selecting moves in a battle. Because of this, your cursor is rendered unable to keep scrolling when one of the directional keys is being held.
+([Video](https://www.youtube.com/watch?v=vjFUo6Jr4po&t=438))
 
-**Fix:** Edit `BattleTurn` in [engine/battle/core.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/core.asm):
+`hInMenu` isn't defined in the menu that handles selecting moves in a battle. Because of this, your cursor is usually rendered unable to keep scrolling when one of the directional keys is being held. It's up for debate whether this behavior was intentional or not, but this value should be defined when in the move selection menu. A value of 1 will allow it to keep scrolling, though it's usually 0 by default.
+There exists one way in which this behaviour would be temporarily changed in-game, and that's when the credits sequence is triggered, `hInMenu` will be set but never unset. This can be fixed with the following:
 
-```diff
- BattleTurn:
-+	ldh a, [hInMenu]
-+	push af
-+	ld a, 1
-+	ldh [hInMenu], a
-+
- .loop
-
- 	...
-
- 	jp .loop
- 
- .quit
-+	pop af
-+	ldh [hInMenu], a
- 	ret
-```
-
-There existed one way in which this bug would be temporarily "fixed" in-game, and that's when the credits sequence is triggered, `hInMenu` will be set but never unset. This has no bad effect upon the rest of the game, but you might want to fix it regardless.
-
 **Fix:** Edit `Credits` in [engine/movie/credits.asm](https://github.com/pret/pokecrystal/blob/master/engine/movie/credits.asm):
 
 ```diff
@@ -1384,6 +1364,30 @@
  	ldh [hVBlank], a
  	pop af
  	ldh [rSVBK], a
+```
+
+
+If you want to make sure `hInMenu` always has a defined value in the move selection menu, the following code will set it to 1:
+
+**Fix:** Edit `BattleTurn` in [engine/battle/core.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/core.asm):
+
+```diff
+ BattleTurn:
++	ldh a, [hInMenu]
++	push af
++	ld a, 1
++	ldh [hInMenu], a
++
+ .loop
+
+ 	...
+
+ 	jp .loop
+ 
+ .quit
++	pop af
++	ldh [hInMenu], a
+ 	ret
 ```
 
 
--- a/engine/pokedex/pokedex_2.asm
+++ b/engine/pokedex/pokedex_2.asm
@@ -124,7 +124,7 @@
 	jr z, .skip_height
 	push hl
 	push de
-; Print the height with two of the four digits will be in front of the decimal point
+; Print the height, with two of the four digits in front of the decimal point
 	ld hl, sp+$0
 	ld d, h
 	ld e, l
@@ -150,7 +150,7 @@
 	or d
 	jr z, .skip_weight
 	push de
-; Print the height with four of the five digits will be in front of the decimal point
+; Print the weight, with four of the five digits in front of the decimal point
 	ld hl, sp+$0
 	ld d, h
 	ld e, l
--- a/engine/pokegear/pokegear.asm
+++ b/engine/pokegear/pokegear.asm
@@ -335,7 +335,7 @@
 .ok
 	farcall PokegearMap
 	ld a, $07
-	ld bc, $12
+	ld bc, SCREEN_WIDTH - 2
 	hlcoord 1, 2
 	call ByteFill
 	hlcoord 0, 2
@@ -2165,7 +2165,7 @@
 	hlcoord 1, 1
 
 ; Middle row
-	ld bc, 18
+	ld bc, SCREEN_WIDTH - 2
 	ld a, " "
 	call ByteFill
 
@@ -2481,10 +2481,10 @@
 	ld a, " "
 	call ByteFill
 	hlcoord 0, 1
-	ld a, $6
+	ld a, $06
 	ld [hli], a
 	ld bc, SCREEN_WIDTH - 2
-	ld a, $7
+	ld a, $07
 	call ByteFill
 	ld [hl], $17
 	call GetPokemonName