shithub: pokecrystal

Download patch

ref: 040aa7cb171a990a7d4076282e8a12a7b189096b
parent: 0a1fef45fd4806de0f1c1439314971d5f46c8aa2
author: Remy Oukaour <[email protected]>
date: Sun Dec 24 13:11:17 EST 2017

LoadEDTile → CopyTilemapAtOnce (fix #345)

--- a/engine/battle_transition.asm
+++ b/engine/battle_transition.asm
@@ -60,7 +60,7 @@
 	call UpdateSprites
 	call DelayFrame
 	call .NonMobile_LoadPokeballTiles
-	call BattleStart_LoadEDTile
+	call BattleStart_CopyTilemapAtOnce
 	jr .resume
 
 .mobile
@@ -663,7 +663,7 @@
 	ld a, $1
 	ld [hCGBPalUpdate], a
 	call DelayFrame
-	call BattleStart_LoadEDTile
+	call BattleStart_CopyTilemapAtOnce
 
 .nextscene ; 8c673 (23:4673)
 	call StartTrainerBattle_NextScene
--- a/engine/color.asm
+++ b/engine/color.asm
@@ -307,7 +307,7 @@
 	ld a, [EnemySafeguardCount] ; value
 	and $3
 	call FillBoxCGB
-	call LoadEDTile
+	call CopyTilemapAtOnce
 	ret
 
 ApplyMonOrTrainerPals:
--- a/engine/phone/phone.asm
+++ b/engine/phone/phone.asm
@@ -599,7 +599,7 @@
 	call PlaySFX
 	call Phone_CallerTextbox
 	call UpdateSprites
-	farcall PhoneRing_LoadEDTile
+	farcall PhoneRing_CopyTilemapAtOnce
 	ret
 ; 90355
 
@@ -609,7 +609,7 @@
 Phone_Wait20Frames
 	ld c, 20
 	call DelayFrames
-	farcall PhoneRing_LoadEDTile
+	farcall PhoneRing_CopyTilemapAtOnce
 	ret
 ; 90363
 
--- a/engine/save.asm
+++ b/engine/save.asm
@@ -3,7 +3,7 @@
 	farcall DisplaySaveInfoOnSave
 	call SpeechTextBox
 	call UpdateSprites
-	farcall SaveMenu_LoadEDTile
+	farcall SaveMenu_CopyTilemapAtOnce
 	ld hl, Text_WouldYouLikeToSaveTheGame
 	call SaveTheGame_yesorno
 	jr nz, .refused
@@ -19,7 +19,7 @@
 .refused
 	call ExitMenu
 	call ret_d90
-	farcall SaveMenu_LoadEDTile
+	farcall SaveMenu_CopyTilemapAtOnce
 	scf
 	ret
 
--- a/event/mom.asm
+++ b/event/mom.asm
@@ -476,7 +476,7 @@
 	lb bc, PRINTNUM_MONEY | PRINTNUM_LEADINGZEROS | 3, 6
 	call PrintNum
 	call UpdateSprites
-	call CGBOnly_LoadEDTile
+	call CGBOnly_CopyTilemapAtOnce
 	ret
 ; 1656b
 
--- a/home.asm
+++ b/home.asm
@@ -532,7 +532,7 @@
 
 	ld a, 1
 	ld [hBGMapMode], a
-	jr LoadEDTile
+	jr CopyTilemapAtOnce
 
 .dmg
 ; WaitBGMap
@@ -543,13 +543,13 @@
 	ret
 ; 3238
 
-CGBOnly_LoadEDTile:: ; 3238
+CGBOnly_CopyTilemapAtOnce:: ; 3238
 	ld a, [hCGB]
 	and a
 	jr z, WaitBGMap
 
-LoadEDTile:: ; 323d
-	jr .LoadEDTile
+CopyTilemapAtOnce:: ; 323d
+	jr .CopyTilemapAtOnce
 ; 323f
 
 ; XXX
@@ -557,7 +557,7 @@
 	ret
 ; 3246
 
-.LoadEDTile: ; 3246
+.CopyTilemapAtOnce: ; 3246
 	ld a, [hBGMapMode]
 	push af
 	xor a
@@ -574,11 +574,11 @@
 	jr c, .wait
 
 	di
-	ld a, 1 ; BANK(VTiles3)
+	ld a, BANK(VTiles3)
 	ld [rVBK], a
 	hlcoord 0, 0, AttrMap
 	call .StackPointerMagic
-	ld a, 0 ; BANK(VTiles0)
+	ld a, BANK(VTiles0)
 	ld [rVBK], a
 	hlcoord 0, 0
 	call .StackPointerMagic
@@ -623,7 +623,7 @@
 	inc l
 endr
 
-	ld de, $20 - SCREEN_WIDTH
+	ld de, BG_MAP_WIDTH - SCREEN_WIDTH
 	add hl, de
 	ld a, [hTilesPerCycle]
 	dec a
--- a/main.asm
+++ b/main.asm
@@ -309,12 +309,12 @@
 INCLUDE "data/collision_permissions.asm"
 INCLUDE "engine/empty_sram.asm"
 
-SaveMenu_LoadEDTile: ; 4cf45 (13:4f45)
+SaveMenu_CopyTilemapAtOnce: ; 4cf45 (13:4f45)
 	ld a, [hCGB]
 	and a
 	jp z, WaitBGMap
 
-; The following is a modified version of LoadEDTile.
+; The following is a modified version of CopyTilemapAtOnce.
 	ld a, [hBGMapMode]
 	push af
 	xor a
@@ -329,14 +329,14 @@
 	jr c, .WaitLY
 
 	di
-	ld a, 1 ; BANK(VBGMap2)
+	ld a, BANK(VBGMap2)
 	ld [rVBK], a
 	hlcoord 0, 0, AttrMap
-	call .LoadEDTile
-	ld a, 0 ; BANK(VBGMap0)
+	call .CopyTilemapAtOnce
+	ld a, BANK(VBGMap0)
 	ld [rVBK], a
 	hlcoord 0, 0
-	call .LoadEDTile
+	call .CopyTilemapAtOnce
 .WaitLY2:
 	ld a, [rLY]
 	cp $60
@@ -349,7 +349,7 @@
 	ld [hBGMapMode], a
 	ret
 
-.LoadEDTile: ; 4cf80 (13:4f80)
+.CopyTilemapAtOnce: ; 4cf80 (13:4f80)
 	ld [hSPBuffer], sp ; $ffd9
 	ld sp, hl
 	ld a, [hBGMapAddress + 1]
@@ -373,7 +373,7 @@
 	inc l
 endr
 
-	ld de, $20 - SCREEN_WIDTH
+	ld de, BG_MAP_WIDTH - SCREEN_WIDTH
 	add hl, de
 	ld a, [hTilesPerCycle]
 	dec a
@@ -447,7 +447,7 @@
 	jr nz, .loop
 	ret
 
-PhoneRing_LoadEDTile: ; 4d188
+PhoneRing_CopyTilemapAtOnce: ; 4d188
 	ld a, [hCGB]
 	and a
 	jp z, WaitBGMap
@@ -455,7 +455,7 @@
 	cp $0
 	jp z, WaitBGMap
 
-; What follows is a modified version of LoadEDTile.
+; What follows is a modified version of CopyTilemapAtOnce.
 	ld a, [hBGMapMode]
 	push af
 	xor a
@@ -470,14 +470,14 @@
 	jr c, .wait
 
 	di
-	ld a, 1 ; BANK(VBGMap2)
+	ld a, BANK(VBGMap2)
 	ld [rVBK], a
 	hlcoord 0, 0, AttrMap
-	call .LoadEDTile
-	ld a, 0 ; BANK(VBGMap0)
+	call .CopyTilemapAtOnce
+	ld a, BANK(VBGMap0)
 	ld [rVBK], a
 	hlcoord 0, 0
-	call .LoadEDTile
+	call .CopyTilemapAtOnce
 .wait2
 	ld a, [rLY]
 	cp $8f
@@ -490,7 +490,7 @@
 	ld [hBGMapMode], a
 	ret
 
-.LoadEDTile: ; 4d1cb
+.CopyTilemapAtOnce: ; 4d1cb
 	ld [hSPBuffer], sp
 	ld sp, hl
 	ld a, [hBGMapAddress + 1]
@@ -514,7 +514,7 @@
 	inc l
 endr
 
-	ld de, $20 - SCREEN_WIDTH
+	ld de, BG_MAP_WIDTH - SCREEN_WIDTH
 	add hl, de
 	ld a, [hTilesPerCycle]
 	dec a
@@ -752,8 +752,8 @@
 INCLUDE "event/field_moves.asm"
 INCLUDE "event/magnet_train.asm"
 
-BattleStart_LoadEDTile: ; 8cf4f
-	call CGBOnly_LoadEDTile
+BattleStart_CopyTilemapAtOnce: ; 8cf4f
+	call CGBOnly_CopyTilemapAtOnce
 	ret
 
 INCLUDE "engine/sprites.asm"
--- a/mobile/mobile_22.asm
+++ b/mobile/mobile_22.asm
@@ -2226,7 +2226,7 @@
 	push hl
 	call Mobile22_SetBGMapMode0
 	call _hl_
-	call CGBOnly_LoadEDTile
+	call CGBOnly_CopyTilemapAtOnce
 	pop hl
 
 asm_89d90: ; 89d90 (22:5d90)
@@ -2670,7 +2670,7 @@
 	inc hl
 	ld a, $6
 	call Function8a5a3
-	call CGBOnly_LoadEDTile
+	call CGBOnly_CopyTilemapAtOnce
 	pop bc
 	ld a, c
 	cp $b
@@ -2685,7 +2685,7 @@
 	ld a, $6
 	hlcoord 15, 4, AttrMap
 	call Function8a5a3
-	call CGBOnly_LoadEDTile
+	call CGBOnly_CopyTilemapAtOnce
 	jp Function89e36
 
 Function8a0a1: ; 8a0a1 (22:60a1)
--- a/mobile/mobile_22_2.asm
+++ b/mobile/mobile_22_2.asm
@@ -411,7 +411,7 @@
 	call Function8b4fd
 	ld e, $0
 	call Function89c44
-	call CGBOnly_LoadEDTile
+	call CGBOnly_CopyTilemapAtOnce
 	ret
 
 Function8b555: ; 8b555 (22:7555)
--- a/mobile/mobile_40.asm
+++ b/mobile/mobile_40.asm
@@ -3089,7 +3089,7 @@
 ; 1013dd
 
 Function1013dd: ; 1013dd
-	call CGBOnly_LoadEDTile
+	call CGBOnly_CopyTilemapAtOnce
 	ret
 ; 1013e1