shithub: pokecrystal

Download patch

ref: 9973e43d5aaffeef9d68994a665d2b0231f56f41
parent: 4e5fd7a521085d10a05ef5e3b9bab623dc28577a
author: Remy Oukaour <[email protected]>
date: Sun Dec 24 10:03:20 EST 2017

Fix issue #345:
- GetMonFrontpic → GetEnemyMonFrontpic
- GetMonBackpic → GetBattleMonBackpic
- FrontpicPredef → GetAnimatedFrontpicPredef
- GetFrontpic → GetMonFrontpic
- GetBackpic → GetMonBackpic
- CutAndPasteMap → PadMapForHDMATransfer

--- a/battle/anim_commands.asm
+++ b/battle/anim_commands.asm
@@ -932,7 +932,7 @@
 	ld hl, BattleMonDVs ; BattleMonDVs
 	predef GetUnownLetter
 	ld de, VTiles0 tile $00
-	predef GetFrontpic
+	predef GetMonFrontpic
 	jr .done
 
 .player
@@ -941,7 +941,7 @@
 	ld hl, EnemyMonDVs ; EnemyMonDVs
 	predef GetUnownLetter
 	ld de, VTiles0 tile $00
-	predef GetBackpic
+	predef GetMonBackpic
 
 .done
 	pop af
@@ -1159,7 +1159,7 @@
 	ld hl, BattleMonDVs
 	predef GetUnownLetter
 	ld de, VTiles2 tile $00
-	predef GetFrontpic
+	predef GetMonFrontpic
 	jr .done
 
 .player
@@ -1166,7 +1166,7 @@
 	ld hl, EnemyMonDVs
 	predef GetUnownLetter
 	ld de, VTiles2 tile $31
-	predef GetBackpic
+	predef GetMonBackpic
 
 .done
 	pop af
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -3689,7 +3689,7 @@
 	ld a, OTPARTYMON
 	ld [MonType], a
 	predef CopyPkmnToTempMon
-	call GetMonFrontpic
+	call GetEnemyMonFrontpic
 
 	xor a
 	ld [wNumHits], a
@@ -4176,7 +4176,7 @@
 	call WaitBGMap
 	xor a
 	ld [hBGMapMode], a
-	call GetMonBackpic
+	call GetBattleMonBackpic
 	xor a
 	ld [hGraphicStartTile], a
 	ld [wBattleMenuCursorBuffer], a
@@ -5185,8 +5185,8 @@
 	call ClearPalettes
 	call DelayFrame
 	call _LoadBattleFontsHPBar
-	call GetMonBackpic
-	call GetMonFrontpic
+	call GetBattleMonBackpic
+	call GetEnemyMonFrontpic
 	call ExitMenu
 	call WaitBGMap
 	call FinishBattleAnim
@@ -5218,10 +5218,10 @@
 	ld a, [BattleType]
 	cp BATTLETYPE_TUTORIAL
 	jr z, .tutorial2
-	call GetMonBackpic
+	call GetBattleMonBackpic
 
 .tutorial2
-	call GetMonFrontpic
+	call GetEnemyMonFrontpic
 	ld a, $1
 	ld [wMenuCursorY], a
 	call ExitMenu
@@ -8269,17 +8269,17 @@
 	ret
 ; 3f43d
 
-GetMonBackpic: ; 3f43d
+GetBattleMonBackpic: ; 3f43d
 	ld a, [PlayerSubStatus4]
 	bit SUBSTATUS_SUBSTITUTE, a
 	ld hl, BattleAnimCmd_RaiseSub
-	jr nz, GetBackpic_DoAnim ; substitute
+	jr nz, GetBattleMonBackpic_DoAnim ; substitute
 
 DropPlayerSub: ; 3f447
 	ld a, [wPlayerMinimized]
 	and a
 	ld hl, BattleAnimCmd_MinimizeOpp
-	jr nz, GetBackpic_DoAnim
+	jr nz, GetBattleMonBackpic_DoAnim
 	ld a, [CurPartySpecies]
 	push af
 	ld a, [BattleMonSpecies]
@@ -8287,13 +8287,13 @@
 	ld hl, BattleMonDVs
 	predef GetUnownLetter
 	ld de, VTiles2 tile $31
-	predef GetBackpic
+	predef GetMonBackpic
 	pop af
 	ld [CurPartySpecies], a
 	ret
 ; 3f46f
 
-GetBackpic_DoAnim: ; 3f46f
+GetBattleMonBackpic_DoAnim: ; 3f46f
 	ld a, [hBattleTurn]
 	push af
 	xor a
@@ -8305,17 +8305,17 @@
 	ret
 ; 3f47c
 
-GetMonFrontpic: ; 3f47c
+GetEnemyMonFrontpic: ; 3f47c
 	ld a, [EnemySubStatus4]
 	bit SUBSTATUS_SUBSTITUTE, a
 	ld hl, BattleAnimCmd_RaiseSub
-	jr nz, GetFrontpic_DoAnim
+	jr nz, GetEnemyMonFrontpic_DoAnim
 
 DropEnemySub: ; 3f486
 	ld a, [wEnemyMinimized]
 	and a
 	ld hl, BattleAnimCmd_MinimizeOpp
-	jr nz, GetFrontpic_DoAnim
+	jr nz, GetEnemyMonFrontpic_DoAnim
 
 	ld a, [CurPartySpecies]
 	push af
@@ -8326,13 +8326,13 @@
 	ld hl, EnemyMonDVs
 	predef GetUnownLetter
 	ld de, VTiles2
-	predef FrontpicPredef
+	predef GetAnimatedFrontpicPredef
 	pop af
 	ld [CurPartySpecies], a
 	ret
 ; 3f4b4
 
-GetFrontpic_DoAnim: ; 3f4b4
+GetEnemyMonFrontpic_DoAnim: ; 3f4b4
 	ld a, [hBattleTurn]
 	push af
 	call SetEnemyTurn
@@ -8532,7 +8532,7 @@
 	ld [wFirstUnownSeen], a
 .skip_unown
 	ld de, VTiles2
-	predef FrontpicPredef
+	predef GetAnimatedFrontpicPredef
 	xor a
 	ld [TrainerClass], a
 	ld [hGraphicStartTile], a
--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -6299,11 +6299,11 @@
 
 
 BattleCommand_RaiseSubNoAnim: ; 365af
-	ld hl, GetMonBackpic
+	ld hl, GetBattleMonBackpic
 	ld a, [hBattleTurn]
 	and a
 	jr z, .PlayerTurn
-	ld hl, GetMonFrontpic
+	ld hl, GetEnemyMonFrontpic
 .PlayerTurn:
 	xor a
 	ld [hBGMapMode], a
--- a/engine/billspc.asm
+++ b/engine/billspc.asm
@@ -1108,7 +1108,7 @@
 	predef GetUnownLetter
 	call GetBaseData
 	ld de, VTiles2 tile $00
-	predef GetFrontpic
+	predef GetMonFrontpic
 	xor a
 	ld [wBillsPC_MonHasMail], a
 	ld a, [CurPartySpecies]
--- a/engine/breeding.asm
+++ b/engine/breeding.asm
@@ -649,7 +649,7 @@
 	ld hl, BattleMonDVs
 	predef GetUnownLetter
 	pop de
-	predef_jump GetFrontpic
+	predef_jump GetMonFrontpic
 
 GetHatchlingFrontpic: ; 1723c (5:723c)
 	push de
@@ -659,7 +659,7 @@
 	ld hl, BattleMonDVs
 	predef GetUnownLetter
 	pop de
-	predef_jump FrontpicPredef
+	predef_jump GetAnimatedFrontpicPredef
 
 Hatch_UpdateFrontpicBGMapCenter: ; 17254 (5:7254)
 	push af
--- a/engine/debug.asm
+++ b/engine/debug.asm
@@ -315,7 +315,7 @@
 	hlcoord 12, 3
 	call _PrepMonFrontpic
 	ld de, VTiles2 tile $31
-	predef GetBackpic
+	predef GetMonBackpic
 	ld a, $31
 	ld [hGraphicStartTile], a
 	hlcoord 2, 4
--- a/engine/dma_transfer.asm
+++ b/engine/dma_transfer.asm
@@ -5,10 +5,10 @@
 .Function:
 	decoord 0, 0, AttrMap
 	ld hl, wScratchAttrMap
-	call CutAndPasteAttrMap
+	call PadAttrMapForHDMATransfer
 	decoord 0, 0
 	ld hl, wScratchTileMap
-	call CutAndPasteTilemap
+	call PadTilemapForHDMATransfer
 	ld a, $0
 	ld [rVBK], a
 	ld hl, wScratchTileMap
@@ -27,7 +27,7 @@
 .Function:
 	decoord 0, 0
 	ld hl, wScratchTileMap
-	call CutAndPasteTilemap
+	call PadTilemapForHDMATransfer
 	ld a, $0
 	ld [rVBK], a
 	ld hl, wScratchTileMap
@@ -42,7 +42,7 @@
 .Function:
 	decoord 0, 0, AttrMap
 	ld hl, wScratchAttrMap
-	call CutAndPasteAttrMap
+	call PadAttrMapForHDMATransfer
 	ld a, $1
 	ld [rVBK], a
 	ld hl, wScratchAttrMap
@@ -57,10 +57,10 @@
 .Function:
 	decoord 0, 0, AttrMap
 	ld hl, wScratchAttrMap
-	call CutAndPasteAttrMap
+	call PadAttrMapForHDMATransfer
 	decoord 0, 0
 	ld hl, wScratchTileMap
-	call CutAndPasteTilemap
+	call PadTilemapForHDMATransfer
 	call DelayFrame
 
 	di
@@ -88,10 +88,10 @@
 .Function:
 	decoord 0, 0, AttrMap
 	ld hl, wScratchAttrMap
-	call CutAndPasteAttrMap
+	call PadAttrMapForHDMATransfer
 	decoord 0, 0
 	ld hl, wScratchTileMap
-	call CutAndPasteTilemap
+	call PadTilemapForHDMATransfer
 	call DelayFrame
 
 	di
@@ -161,10 +161,10 @@
 	; Fill vBGTiles with " "
 	decoord 0, 0, AttrMap
 	ld hl, wScratchAttrMap
-	call CutAndPasteAttrMap
+	call PadAttrMapForHDMATransfer
 	decoord 0, 0
 	ld hl, wScratchTileMap
-	call CutAndPasteTilemap
+	call PadTilemapForHDMATransfer
 	call DelayFrame
 
 	di
@@ -194,11 +194,11 @@
 	; Fill vBGTiles with $ff
 	decoord 0, 0, AttrMap
 	ld hl, wScratchAttrMap
-	call CutAndPasteAttrMap
+	call PadAttrMapForHDMATransfer
 	ld c, $ff
 	decoord 0, 0
 	ld hl, wScratchTileMap
-	call CutAndPasteMap
+	call PadMapForHDMATransfer
 
 	ld a, $1
 	ld [rVBK], a
@@ -422,15 +422,16 @@
 	ld [rHDMA4], a
 	ret
 
-CutAndPasteTilemap: ; 10425f (41:425f)
+PadTilemapForHDMATransfer: ; 10425f (41:425f)
 	ld c, " "
-	jr CutAndPasteMap
+	jr PadMapForHDMATransfer
 
-CutAndPasteAttrMap: ; 104263 (41:4263)
+PadAttrMapForHDMATransfer: ; 104263 (41:4263)
 	ld c, $0
 
-CutAndPasteMap: ; 104265 (41:4265)
-; back up the value of c to hMapObjectIndexBuffer
+PadMapForHDMATransfer: ; 104265 (41:4265)
+; pad a 20x18 map to 32x18 for HDMA transfer
+; back up the padding value in c to hMapObjectIndexBuffer
 	ld a, [hMapObjectIndexBuffer]
 	push af
 	ld a, c
@@ -449,7 +450,7 @@
 	dec b
 	jr nz, .loop2
 
-; load the original value of c into hl 12 times
+; load the original padding value of c into hl for 32 - 20 = 12 rows
 	ld a, [hMapObjectIndexBuffer]
 	ld b, BG_MAP_WIDTH - SCREEN_WIDTH
 .loop3
--- a/engine/evolution_animation.asm
+++ b/engine/evolution_animation.asm
@@ -168,7 +168,7 @@
 	ld a, $1
 	ld [wBoxAlignment], a
 	ld de, VTiles2
-	predef FrontpicPredef
+	predef GetAnimatedFrontpicPredef
 	xor a
 	ld [wBoxAlignment], a
 	ret
--- a/engine/pokedex.asm
+++ b/engine/pokedex.asm
@@ -2403,7 +2403,7 @@
 	ld [CurPartySpecies], a
 	call GetBaseData
 	ld de, VTiles2
-	predef GetFrontpic
+	predef GetMonFrontpic
 	ret
 
 .QuestionMark:
@@ -2556,7 +2556,7 @@
 	ld [CurPartySpecies], a
 	call GetBaseData
 	ld de, VTiles2 tile $00
-	predef GetFrontpic
+	predef GetMonFrontpic
 	pop af
 	ld [UnownLetter], a
 	ret
@@ -2586,7 +2586,7 @@
 	call WaitBGMap
 	call GetBaseData
 	ld de, VTiles2
-	predef GetFrontpic
+	predef GetMonFrontpic
 	ld a, SCGB_POKEDEX
 	call Pokedex_GetSGBLayout
 	ld a, [CurPartySpecies]
--- a/engine/pokepic.asm
+++ b/engine/pokepic.asm
@@ -12,7 +12,7 @@
 	ld [CurSpecies], a
 	call GetBaseData
 	ld de, VTiles1
-	predef GetFrontpic
+	predef GetMonFrontpic
 	ld a, [wMenuBorderTopCoord]
 	inc a
 	ld b, a
--- a/engine/predef.asm
+++ b/engine/predef.asm
@@ -54,8 +54,8 @@
 	add_predef UpdateEnemyHUD
 	add_predef StartBattle
 	add_predef FillInExpBar
-	add_predef GetMonBackpic ; $18
-	add_predef GetMonFrontpic
+	add_predef GetBattleMonBackpic ; $18
+	add_predef GetEnemyMonFrontpic
 	add_predef LearnLevelMoves
 	add_predef FillMoves
 	add_predef EvolveAfterBattle
@@ -90,9 +90,9 @@
 	add_predef Predef39
 	add_predef Predef3A
 	add_predef PartyMonItemName
-	add_predef GetFrontpic
-	add_predef GetBackpic
-	add_predef FrontpicPredef
+	add_predef GetMonFrontpic
+	add_predef GetMonBackpic
+	add_predef GetAnimatedFrontpicPredef
 	add_predef GetTrainerPic
 	add_predef DecompressPredef ; $40
 	add_predef CheckTypeMatchup
--- a/engine/stats_screen.asm
+++ b/engine/stats_screen.asm
@@ -866,7 +866,7 @@
 	ret c
 	call StatsScreen_LoadTextBoxSpaceGFX
 	ld de, VTiles2 tile $00
-	predef FrontpicPredef
+	predef GetAnimatedFrontpicPredef
 	hlcoord 0, 0
 	ld d, $0
 	ld e, ANIM_MON_MENU
@@ -1071,7 +1071,7 @@
 	ld [wBoxAlignment], a
 	call StatsScreen_LoadTextBoxSpaceGFX
 	ld de, VTiles2 tile $00
-	predef FrontpicPredef
+	predef GetAnimatedFrontpicPredef
 	pop de
 	hlcoord 0, 0
 	ld d, $0
--- a/engine/trade_animation.asm
+++ b/engine/trade_animation.asm
@@ -877,7 +877,7 @@
 	ld [CurSpecies], a
 	call GetBaseData
 	pop de
-	predef GetFrontpic
+	predef GetMonFrontpic
 	ret
 
 ; 294a9
--- a/engine/trademon_frontpic.asm
+++ b/engine/trademon_frontpic.asm
@@ -10,7 +10,7 @@
 	ld [CurSpecies], a
 	call GetBaseData
 	pop de
-	predef FrontpicPredef
+	predef GetAnimatedFrontpicPredef
 	ret
 
 AnimateTrademonFrontpic: ; 4d81e
--- a/event/halloffame.asm
+++ b/event/halloffame.asm
@@ -250,7 +250,7 @@
 	ld a, " "
 	call ByteFill
 	ld de, VTiles2 tile $31
-	predef GetBackpic
+	predef GetMonBackpic
 	ld a, $31
 	ld [hGraphicStartTile], a
 	hlcoord 6, 6
--- a/event/print_unown.asm
+++ b/event/print_unown.asm
@@ -140,7 +140,7 @@
 	xor a
 	ld [wBoxAlignment], a
 	ld de, VTiles2
-	predef GetFrontpic
+	predef GetMonFrontpic
 	call .Load2bppToSRAM
 	hlcoord 1, 6
 	xor a
--- a/gfx/load_pics.asm
+++ b/gfx/load_pics.asm
@@ -48,7 +48,7 @@
 	ld [UnownLetter], a
 	ret
 
-GetFrontpic: ; 51077
+GetMonFrontpic: ; 51077
 	ld a, [CurPartySpecies]
 	ld [CurSpecies], a
 	call IsAPokemon
@@ -60,7 +60,7 @@
 	ld [rSVBK], a
 	ret
 
-FrontpicPredef: ; 5108b
+GetAnimatedFrontpicPredef: ; 5108b
 	ld a, [CurPartySpecies]
 	ld [CurSpecies], a
 	call IsAPokemon
@@ -195,7 +195,7 @@
 	jr nz, .loop
 	ret
 
-GetBackpic: ; 5116c
+GetMonBackpic: ; 5116c
 	ld a, [CurPartySpecies]
 	call IsAPokemon
 	ret c
--- a/gfx/pics/animation.asm
+++ b/gfx/pics/animation.asm
@@ -1121,7 +1121,7 @@
 	push bc
 	push hl
 	ld de, VTiles2
-	predef FrontpicPredef
+	predef GetAnimatedFrontpicPredef
 	pop hl
 	pop bc
 	ld d, 0
--- a/home.asm
+++ b/home.asm
@@ -1075,7 +1075,7 @@
 
 	push hl
 	ld de, VTiles2
-	predef GetFrontpic
+	predef GetMonFrontpic
 	pop hl
 	xor a
 	ld [hGraphicStartTile], a
--- a/main.asm
+++ b/main.asm
@@ -197,13 +197,13 @@
 	ld a, [BattleType]
 	cp BATTLETYPE_TUTORIAL
 	jr z, .gettutorialbackpic
-	farcall GetMonBackpic
+	farcall GetBattleMonBackpic
 	jr .continue
 
 .gettutorialbackpic
 	farcall GetTrainerBackpic
 .continue
-	farcall GetMonFrontpic
+	farcall GetEnemyMonFrontpic
 	farcall _LoadBattleFontsHPBar
 	call GetMemSGBLayout
 	call CloseWindow
--- a/mobile/mobile_42.asm
+++ b/mobile/mobile_42.asm
@@ -296,7 +296,7 @@
 	ld [CurSpecies], a
 	call GetBaseData
 	pop de
-	predef GetFrontpic
+	predef GetMonFrontpic
 	ret
 ; 108201
 
@@ -309,7 +309,7 @@
 	ld [CurSpecies], a
 	call GetBaseData
 	pop de
-	predef FrontpicPredef
+	predef GetAnimatedFrontpicPredef
 	ret
 ; 108219