shithub: pokecrystal

Download patch

ref: 7111ae8e582996f2b6ef36427cf54e0c168593ae
parent: 29deef86f810c00cc28b3afd9821b26febcde1d5
author: mid-kid <esteve.varela@gmail.com>
date: Mon Sep 23 11:09:49 EDT 2019

Fix some mobile script and map sign things

--- a/audio/engine.asm
+++ b/audio/engine.asm
@@ -1364,7 +1364,7 @@
 	jp hl
 
 MusicCommands:
-; entries correspond to macros/sound.asm enumeration
+; entries correspond to macros/scripts/audio.asm enumeration
 	dw Music_Octave8 ; octave 8
 	dw Music_Octave7 ; octave 7
 	dw Music_Octave6 ; octave 6
--- a/engine/events/map_name_sign.asm
+++ b/engine/events/map_name_sign.asm
@@ -15,13 +15,13 @@
 	call GetWorldMapLocation
 	ld [wCurLandmark], a
 	call .CheckNationalParkGate
-	jr z, .nationalparkgate
+	jr z, .gate
 
 	call GetMapEnvironment
 	cp GATE
 	jr nz, .not_gate
 
-.nationalparkgate
+.gate
 	ld a, -1
 	ld [wCurLandmark], a
 
@@ -70,7 +70,7 @@
 ; These landmarks do not get pop-up signs.
 	cp -1
 	ret z
-	cp SPECIAL_MAP
+	cp SPECIAL_MAP ; redundant check
 	ret z
 	cp RADIO_TOWER
 	ret z
@@ -105,11 +105,11 @@
 	cp 60
 	ret z
 	cp 59
-	jr nz, .skip2
+	jr nz, .already_initialized
 	call InitMapNameFrame
 	call PlaceMapNameCenterAlign
 	farcall HDMATransfer_OnlyTopFourRows
-.skip2
+.already_initialized
 	ld a, $80
 	ld a, $70
 	ldh [rWY], a
--- a/engine/overworld/warp_connection.asm
+++ b/engine/overworld/warp_connection.asm
@@ -1,4 +1,3 @@
-
 HandleNewMap:
 	call ClearUnusedMapBuffer
 	call ResetMapBufferEventFlags
--- a/home/map.asm
+++ b/home/map.asm
@@ -330,7 +330,7 @@
 	ld bc, 2 ; warp number
 	add hl, bc
 	ld a, [hli]
-	cp $ff
+	cp -1
 	jr nz, .skip
 	ld hl, wBackupWarpNumber
 	ld a, [hli]
@@ -679,7 +679,7 @@
 	ld [wXCoord], a
 	; destination warp number
 	ld a, [hli]
-	cp $ff
+	cp -1
 	jr nz, .skip
 	call .backup
 
--- a/mobile/mobile_5f.asm
+++ b/mobile/mobile_5f.asm
@@ -3615,8 +3615,8 @@
 	dw Function17f220 ; 5
 	dw Function17f27b ; 6
 	dw Function17f2cb ; 7
-	dw Function17f2ff ; 8
-	dw Function17f334 ; 9
+	dw MobileScript_PlayerName ; 8
+	dw MobileScript_Prefecture ; 9
 	dw Function17f382 ; a
 	dw Function17f3c9 ; b
 	dw Function17f3f0 ; c
@@ -4068,7 +4068,7 @@
 	and a
 	ret
 
-Function17f2ff:
+MobileScript_PlayerName:
 	pop hl
 	push bc
 	ld a, [hli]
@@ -4080,7 +4080,7 @@
 	ldh [rSVBK], a
 	ld hl, wPlayerName
 	ld de, wc608
-	ld bc, $6
+	ld bc, NAME_LENGTH_JAPANESE
 	call CopyBytes
 	ld a, $4
 	ldh [rSVBK], a
@@ -4097,7 +4097,7 @@
 	and a
 	ret
 
-Function17f334:
+MobileScript_Prefecture:
 	pop hl
 	push bc
 	ld a, [hli]
@@ -4118,9 +4118,9 @@
 	jr .asm_17f35d
 
 .asm_17f355
-	ld a, $5
+	ld a, BANK(s5_b2f3)
 	call GetSRAMBank
-	ld a, [$b2f3]
+	ld a, [s5_b2f3]
 
 .asm_17f35d
 	ld c, a
@@ -4161,9 +4161,9 @@
 	jr .asm_17f3ab
 
 .asm_17f3a3
-	ld a, $5
+	ld a, BANK(s5_b2f4)
 	call GetSRAMBank
-	ld de, $b2f4
+	ld de, s5_b2f4
 
 .asm_17f3ab
 	ld a, PRINTNUM_LEADINGZEROS | 2
@@ -4195,7 +4195,7 @@
 	push hl
 	ld hl, wc708
 	ld de, wcd36
-	ld bc, $c
+	ld bc, 12
 	call CopyBytes
 	pop bc
 	pop de
--- a/sram.asm
+++ b/sram.asm
@@ -348,7 +348,12 @@
 s5_b023:: ds 105 ; b023
 s5_b08c:: ds 4 ; b08c
 
-	ds $269
+	ds $263
+
+s5_b2f3:: db ; b2f3
+s5_b2f4:: db ; b2f4
+
+	ds 4
 
 s5_b2f9:: db ; b2f9
 s5_b2fa:: db ; b2fa