shithub: pokecrystal

Download patch

ref: 0c6f94effd1cb4278b0c0a2f02117055a69537e1
parent: f599e477fc3306dbca9cad4aeadfe7a66b84c7bc
author: PikalaxALT <PikalaxALT@gmail.com>
date: Wed Nov 25 05:26:30 EST 2015

Final relabeling before merge

--- a/engine/link.asm
+++ b/engine/link.asm
@@ -1378,7 +1378,7 @@
 	hlcoord 0, 15
 	ld b, $1
 	ld c, $12
-	call Function28eef
+	call Predef_LinkTextbox
 	hlcoord 2, 16
 	ld de, String28ab4
 	call PlaceString
@@ -1487,7 +1487,7 @@
 	hlcoord 0, 12
 	ld b, $4
 	ld c, $12
-	call Function28eef
+	call Predef_LinkTextbox
 	callba Function4d354
 	ld hl, UnknownText_0x28aaf
 	bccoord 1, 14
@@ -1509,7 +1509,7 @@
 	hlcoord 0, 12
 	ld b, $4
 	ld c, $12
-	call Function28eef
+	call Predef_LinkTextbox
 	callba Function4d354
 	ld hl, UnknownText_0x28ac4
 	bccoord 1, 14
@@ -1519,7 +1519,7 @@
 	hlcoord 0, 12
 	ld b, $4
 	ld c, $12
-	call Function28eef
+	call Predef_LinkTextbox
 	hlcoord 1, 14
 	ld de, String28ece
 	call PlaceString
@@ -1666,7 +1666,7 @@
 	hlcoord 0, 12
 	ld b, $4
 	ld c, $12
-	call Function28eef
+	call Predef_LinkTextbox
 	callba Function4d354
 	ld a, [wd002]
 	ld hl, PartySpecies
@@ -1695,7 +1695,7 @@
 	hlcoord 10, 7
 	ld b, $3
 	ld c, $7
-	call Function28eef
+	call Predef_LinkTextbox
 	ld de, String28eab
 	hlcoord 12, 8
 	call PlaceString
@@ -1735,7 +1735,7 @@
 	hlcoord 0, 12
 	ld b, 4
 	ld c, 18
-	call Function28eef
+	call Predef_LinkTextbox
 	hlcoord 1, 14
 	ld de, String28ece
 	call PlaceString
@@ -1752,7 +1752,7 @@
 	hlcoord 0, 12
 	ld b, 4
 	ld c, 18
-	call Function28eef
+	call Predef_LinkTextbox
 	hlcoord 1, 14
 	ld de, String28ece
 	call PlaceString
@@ -1982,7 +1982,7 @@
 	hlcoord 0, 12
 	ld b, 4
 	ld c, 18
-	call Function28eef
+	call Predef_LinkTextbox
 	hlcoord 1, 14
 	ld de, String28ebd
 	call PlaceString
@@ -2019,10 +2019,10 @@
 	next "was canceled!@"
 
 
-Function28eef: ; 28eef
+Predef_LinkTextbox: ; 28eef
 	ld d, h
 	ld e, l
-	callba Function16d6ca
+	callba LinkTextbox
 	ret
 ; 28ef8
 
@@ -2041,11 +2041,11 @@
 	hlcoord 0, 0
 	ld b, 6
 	ld c, 18
-	call Function28eef
+	call Predef_LinkTextbox
 	hlcoord 0, 8
 	ld b, 6
 	ld c, 18
-	call Function28eef
+	call Predef_LinkTextbox
 	callba Functionfb60d
 	ret
 ; 28f24
--- a/engine/map_objects.asm
+++ b/engine/map_objects.asm
@@ -2736,7 +2736,7 @@
 	ld a, PLAYER
 	call Function5629 ; respawn player
 
-	ld a, [wd459]
+	ld a, [wBattleScriptFlags]
 	bit 7, a
 	jr z, .ok
 
--- a/engine/menu.asm
+++ b/engine/menu.asm
@@ -4,7 +4,7 @@
 	rst FarCall
 	call Function24085
 	call UpdateSprites
-	call Function321c
+	call ApplyTilemap
 	call Function2408f
 	ret
 ; 24022
@@ -16,7 +16,7 @@
 	call Function24085
 	callba MobileTextBorder
 	call UpdateSprites
-	call Function321c
+	call ApplyTilemap
 	call Function2408f
 	ret
 ; 2403c
@@ -28,7 +28,7 @@
 	call Function24085
 	callba MobileTextBorder
 	call UpdateSprites
-	call Function321c
+	call ApplyTilemap
 	call Function2411a
 	ld hl, wcfa5
 	set 7, [hl]
--- a/engine/pokecenter_pc.asm
+++ b/engine/pokecenter_pc.asm
@@ -188,7 +188,7 @@
 	and a
 	jr nz, .asm_156f9
 	call OverworldTextModeSwitch
-	call Function321c
+	call ApplyTilemap
 	call UpdateSprites
 	call PC_PlayShutdownSound
 	ld c, $0
@@ -466,16 +466,16 @@
 
 
 Function158cc: ; 0x158cc
-	ld a, [wc2ce]
+	ld a, [wSpriteUpdatesEnabled]
 	push af
 	ld a, $0
-	ld [wc2ce], a
+	ld [wSpriteUpdatesEnabled], a
 	callba CheckItemMenu
 	ld a, [wItemAttributeParamBuffer]
 	ld hl, .jumptable
 	rst JumpTable
 	pop af
-	ld [wc2ce], a
+	ld [wSpriteUpdatesEnabled], a
 	ret
 ; 0x158e7
 
@@ -577,10 +577,10 @@
 	xor a
 	ld [wd0e3], a
 .asm_15989
-	ld a, [wc2ce]
+	ld a, [wSpriteUpdatesEnabled]
 	push af
 	ld a, $0
-	ld [wc2ce], a
+	ld [wSpriteUpdatesEnabled], a
 	ld hl, MenuData15a08
 	call CopyMenuDataHeader
 	hlcoord 0, 0
@@ -597,7 +597,7 @@
 	ld a, [MenuSelection2]
 	ld [wd0d7], a
 	pop af
-	ld [wc2ce], a
+	ld [wSpriteUpdatesEnabled], a
 	ld a, [wd0e3]
 	and a
 	jr nz, .asm_159d8
--- a/engine/predef.asm
+++ b/engine/predef.asm
@@ -46,7 +46,7 @@
 	add_predef CalcPkmnStatC
 	add_predef CanLearnTMHMMove
 	add_predef GetTMHMMove
-	add_predef Function28eef ; $ 10
+	add_predef Predef_LinkTextbox ; $ 10
 	add_predef PrintMoveDesc
 	add_predef UpdatePlayerHUD
 	add_predef FillBox
--- a/engine/scripting.asm
+++ b/engine/scripting.asm
@@ -929,7 +929,7 @@
 Script_talkaftercancel: ; 97163
 ; script command 0x66
 
-	ld a, [wd04d]
+	ld a, [wRunningTrainerBattleScript]
 	and a
 	ret z
 	jp Script_end
@@ -940,7 +940,7 @@
 
 	ld a, 1
 	ld [ScriptVar], a
-	ld a, [wd04d]
+	ld a, [wRunningTrainerBattleScript]
 	and a
 	ret nz
 	xor a
@@ -1485,7 +1485,7 @@
 ; script command 0x5b
 
 	xor a
-	ld [wd459], a
+	ld [wBattleScriptFlags], a
 	ret
 ; 97400
 
@@ -1493,7 +1493,7 @@
 ; script command 0x5c
 
 	ld a, (1 << 7) | 1
-	ld [wd459], a
+	ld [wBattleScriptFlags], a
 	ld a, [WalkingDirection]
 	ld [OtherTrainerClass], a
 	ld a, [FacingDirection]
@@ -1508,7 +1508,7 @@
 ;     level (DecimalParam)
 
 	ld a, (1 << 7)
-	ld [wd459], a
+	ld [wBattleScriptFlags], a
 	call GetScriptByte
 	ld [TempWildMonSpecies], a
 	call GetScriptByte
@@ -1523,7 +1523,7 @@
 ;     trainer_id (TrainerIdParam)
 
 	ld a, (1 << 7) | 1
-	ld [wd459], a
+	ld [wBattleScriptFlags], a
 	call GetScriptByte
 	ld [OtherTrainerClass], a
 	call GetScriptByte
@@ -1557,7 +1557,7 @@
 Script_returnafterbattle: ; 97459
 ; script command 0x60
 
-	ld hl, wd459
+	ld hl, wBattleScriptFlags
 	ld d, [hl]
 	ld [hl], $0
 	ld a, [wBattleResult]
@@ -1589,7 +1589,7 @@
 ; script command 0x7b
 
 	xor a
-	ld [wd459], a
+	ld [wBattleScriptFlags], a
 	ld a, MAPSETUP_RELOADMAP
 	ld [hMapEntryMethod], a
 	ld a, $1
--- a/engine/timeset.asm
+++ b/engine/timeset.asm
@@ -6,7 +6,7 @@
 	ld [hInMenu], a
 
 	ld a, $0
-	ld [wc2ce], a
+	ld [wSpriteUpdatesEnabled], a
 	ld a, $10
 	ld [MusicFade], a
 	ld a, MUSIC_NONE % $100
@@ -436,7 +436,7 @@
 	ld [hl], $f5
 	hlcoord 10, 5
 	call Function909de
-	call Function321c
+	call ApplyTilemap
 	ld c, 10
 	call DelayFrames
 .asm_9096a
--- a/event/kurt.asm
+++ b/event/kurt.asm
@@ -139,7 +139,7 @@
 	call UpdateSprites
 	call .PlaceApricornName
 	call PlaceApricornQuantity
-	call Function321c
+	call ApplyTilemap
 	callba Function27a28
 	jr nc, .loop
 
--- a/event/unown.asm
+++ b/event/unown.asm
@@ -124,7 +124,7 @@
 	ld [hBGMapMode], a
 	call MenuBox
 	call UpdateSprites
-	call Function321c
+	call ApplyTilemap
 	call MenuBoxCoord2Tile
 	inc hl
 	ld d, $0
--- a/home.asm
+++ b/home.asm
@@ -104,13 +104,13 @@
 	res 0, a
 	ld [VramState], a
 	ld a, $0
-	ld [wc2ce], a
+	ld [wSpriteUpdatesEnabled], a
 	ret
 ; 0x2ee4
 
 EnableSpriteUpdates:: ; 2ee4
 	ld a, $1
-	ld [wc2ce], a
+	ld [wSpriteUpdatesEnabled], a
 	ld a, [VramState]
 	set 0, a
 	ld [VramState], a
@@ -568,12 +568,12 @@
 ; 321c
 
 
-Function321c:: ; 321c
+ApplyTilemap:: ; 321c
 	ld a, [hCGB]
 	and a
 	jr z, .dmg
 
-	ld a, [wc2ce]
+	ld a, [wSpriteUpdatesEnabled]
 	cp 0
 	jr z, .dmg
 
@@ -1488,7 +1488,7 @@
 	ld a, [EngineBuffer1]
 	call FarCopyBytes
 	xor a
-	ld [wd04d], a
+	ld [wRunningTrainerBattleScript], a
 	scf
 	ret
 ; 36a5
--- a/home/battle.asm
+++ b/home/battle.asm
@@ -285,7 +285,7 @@
 	call SpeechTextBox
 	call MobileTextBorder
 	call UpdateSprites
-	call Function321c
+	call ApplyTilemap
 	pop hl
 	call PrintTextBoxText
 	ret
--- a/home/map.asm
+++ b/home/map.asm
@@ -1091,7 +1091,7 @@
 	call Function2e31
 	ld a, 1
 	ld [hOAMUpdate], a
-	call Function321c
+	call ApplyTilemap
 	pop hl
 	call PrintTextBoxText
 	xor a
@@ -2043,7 +2043,7 @@
 Function2b74:: ; 0x2b74
 	push af
 	ld a, $1
-	ld [wc2ce], a
+	ld [wSpriteUpdatesEnabled], a
 	call ClearBGPalettes
 	call ClearSprites
 	call Function2bae
--- a/home/menu.asm
+++ b/home/menu.asm
@@ -77,7 +77,7 @@
 	call MenuBox
 	call UpdateSprites
 	call Function1c89
-	call Function321c
+	call ApplyTilemap
 	call CopyMenuData2
 	ld a, [wMenuData2Flags]
 	bit 7, a
@@ -262,7 +262,7 @@
 	push af
 	ld a, $1
 	ld [hOAMUpdate], a
-	call Function321c
+	call ApplyTilemap
 	pop af
 	ld [hOAMUpdate], a
 	ret
--- a/home/rtc.asm
+++ b/home/rtc.asm
@@ -2,7 +2,7 @@
 ; update time and time-sensitive palettes
 
 ; rtc enabled?
-	ld a, [wc2ce]
+	ld a, [wSpriteUpdatesEnabled]
 	cp 0
 	ret z
 	
--- a/home/text.asm
+++ b/home/text.asm
@@ -192,7 +192,7 @@
 	push hl
 	call SpeechTextBox
 	call UpdateSprites
-	call Function321c
+	call ApplyTilemap
 	pop hl
 	ret
 ; 1078
--- a/home/tilemap.asm
+++ b/home/tilemap.asm
@@ -16,7 +16,7 @@
 WriteBackup:: ; 0x1c17
 	push af
 	call ExitMenu
-	call Function321c
+	call ApplyTilemap
 	call UpdateSprites
 	pop af
 	ret
--- a/main.asm
+++ b/main.asm
@@ -17,7 +17,7 @@
 	jr .proceed
 
 .notinbattle
-	predef Function28eef
+	predef Predef_LinkTextbox
 
 .proceed
 	hlcoord 4, 11
@@ -9921,7 +9921,7 @@
 	call CopyMenuDataHeader
 	call MenuBox
 	call UpdateSprites
-	call Function321c
+	call ApplyTilemap
 	ld b, SCGB_12
 	call GetSGBLayout
 	xor a
@@ -9955,7 +9955,7 @@
 	xor a
 	ld [hBGMapMode], a
 	call OverworldTextModeSwitch
-	call Function321c
+	call ApplyTilemap
 	call UpdateSprites
 	call LoadStandardFont
 	ret
@@ -10051,7 +10051,7 @@
 	call Function24764
 	call Function247dd
 	call Function245f1
-	call Function321c
+	call ApplyTilemap
 	xor a
 	ld [hBGMapMode], a
 	ret
@@ -17539,7 +17539,7 @@
 	call DelayFrame
 	ld a, $1
 	ld [hOAMUpdate], a
-	call Function321c
+	call ApplyTilemap
 	pop af
 	ld [hOAMUpdate], a
 	ret
@@ -17856,7 +17856,7 @@
 	ld a, [hCGB]
 	and a
 	jp z, WaitBGMap
-	ld a, [wc2ce]
+	ld a, [wSpriteUpdatesEnabled]
 	cp $0
 	jp z, WaitBGMap
 
@@ -22713,7 +22713,7 @@
 	startbattle
 	returnafterbattle
 	trainerstatus SET_FLAG
-	loadvar wd04d, -1
+	loadvar wRunningTrainerBattleScript, -1
 
 AlreadyBeatenTrainerScript:
 	scripttalkafter
@@ -24096,7 +24096,7 @@
 	ld hl, VramState
 	res 6, [hl]
 	ld a, $1
-	ld [wc2ce], a
+	ld [wSpriteUpdatesEnabled], a
 	callba Function8c0e5
 	callba Function8c001
 	call OverworldTextModeSwitch
--- a/misc/mobile_22.asm
+++ b/misc/mobile_22.asm
@@ -150,13 +150,13 @@
 
 Function89209: ; 89209
 	ld a, 1
-	ld [wc2ce], a
+	ld [wSpriteUpdatesEnabled], a
 	ret
 ; 8920f
 
 Function8920f: ; 8920f
 	ld a, 0
-	ld [wc2ce], a
+	ld [wSpriteUpdatesEnabled], a
 	ret
 ; 89215
 
--- a/misc/mobile_40.asm
+++ b/misc/mobile_40.asm
@@ -838,7 +838,7 @@
 Function100534: ; 100534
 	call Function100513
 	call UpdateSprites
-	call Function321c
+	call ApplyTilemap
 	ld a, [wcd28]
 	inc a
 	ld [wcd28], a
@@ -1847,7 +1847,7 @@
 	callba Function24085
 	callba MobileTextBorder
 	call UpdateSprites
-	call Function321c
+	call ApplyTilemap
 	callba Function2411a
 	ld hl, wcfa5
 	set 7, [hl]
--- a/misc/mobile_46.asm
+++ b/misc/mobile_46.asm
@@ -1290,7 +1290,7 @@
 	call LoadMenuDataHeader
 	call MenuBox
 	call MenuBoxCoord2Tile
-	call Function321c
+	call ApplyTilemap
 	hlcoord 16, 8, AttrMap
 	ld a, $40
 	or [hl]
@@ -4745,7 +4745,7 @@
 	call LoadMenuDataHeader
 	call MenuBox
 	call MenuBoxCoord2Tile
-	call Function321c
+	call ApplyTilemap
 	hlcoord 16, 8
 	ld de, String_11a2cf
 	call PlaceString
--- a/misc/mobile_5b.asm
+++ b/misc/mobile_5b.asm
@@ -1028,7 +1028,7 @@
 	ret
 ; 16d6ca
 
-Function16d6ca: ; 16d6ca
+LinkTextbox: ; 16d6ca
 	call Function16d61d
 	ret
 ; 16d6ce
@@ -1046,7 +1046,7 @@
 	hlcoord 4, 10
 	ld b, 1
 	ld c, 10
-	predef Function28eef
+	predef Predef_LinkTextbox
 	hlcoord 5, 11
 	ld de, .Waiting
 	call PlaceString
--- a/wram.asm
+++ b/wram.asm
@@ -311,7 +311,7 @@
 
 wc2cc:: ds 1
 wc2cd:: ds 1
-wc2ce:: ds 1
+wSpriteUpdatesEnabled:: ds 1
 wc2cf:: ds 1
 wc2d0:: ds 4
 wc2d4:: ds 1
@@ -1679,7 +1679,7 @@
 wLossTextPointer:: ds 2
 wScriptAfterPointer::
 wd04b:: ds 2
-wd04d:: ds 1
+wRunningTrainerBattleScript:: ds 1
 MenuItemsListEnd::
 wTempTrainerHeaderEnd::
 wd04e:: ds 2
@@ -2221,7 +2221,7 @@
 wd454:: ds 1
 	ds 4
 
-wd459:: ds 2
+wBattleScriptFlags:: ds 2
 wPlayerSpriteSetupFlags:: ds 1
 wMapReentryScriptQueueFlag:: ds 1 ; MemScriptFlag
 wMapReentryScriptBank:: ds 1 ; MemScriptBank