shithub: pokecrystal

Download patch

ref: 03f0815679bdd27241d7c212d2667ec30764b820
parent: 8fb01de917b040e4e5d7f392c5b01f33a1341033
author: PikalaxALT <PikalaxALT@gmail.com>
date: Tue Nov 10 15:18:49 EST 2015

found the sliding animation at the start of battle

--- a/battle/core.asm
+++ b/battle/core.asm
@@ -8473,7 +8473,7 @@
 
 	ld a, [TimeOfDayPal]
 	push af
-	call Function3f4dd
+	call BattleIntro
 	call Function3c000
 	call Function3f69e
 	pop af
@@ -8489,7 +8489,7 @@
 ; 3f4dd
 
 
-Function3f4dd: ; 3f4dd
+BattleIntro: ; 3f4dd
 	callba MobileFn_106050 ; mobile
 	call LoadTrainerOrWildMonPic
 	xor a
@@ -8508,7 +8508,7 @@
 	call GetSGBLayout
 	ld hl, rLCDC
 	res 6, [hl]
-	call Function3fb6c
+	call InitBattleDisplay
 	call BattleStartMessage
 	ld hl, rLCDC
 	set 6, [hl]
@@ -9393,8 +9393,8 @@
 	ret
 ; 3fb6c
 
-Function3fb6c: ; 3fb6c
-	call Function3fbf8
+InitBattleDisplay: ; 3fb6c
+	call .InitBackPic
 	hlcoord 0, 12
 	ld b, 4
 	ld c, 18
@@ -9405,7 +9405,7 @@
 	call ClearBox
 	call LoadStandardFont
 	call _LoadBattleFontsHPBar
-	call Function3fbd6
+	call .BlankBGMap
 	xor a
 	ld [hMapAnims], a
 	ld [hSCY], a
@@ -9415,7 +9415,7 @@
 	call WaitBGMap
 	xor a
 	ld [hBGMapMode], a
-	callba Function4e980
+	callba SlideBattlePics
 	ld a, $1
 	ld [hBGMapMode], a
 	ld a, $31
@@ -9438,7 +9438,7 @@
 	ret
 ; 3fbd6
 
-Function3fbd6: ; 3fbd6
+.BlankBGMap: ; 3fbd6
 	ld a, [rSVBK]
 	push af
 	ld a, $6
@@ -9451,7 +9451,7 @@
 
 	ld de, w6_d000
 	ld hl, VBGMap0
-	lb bc, BANK(Function3fbd6), $40
+	lb bc, BANK(.BlankBGMap), $40
 	call Request2bpp
 
 	pop af
@@ -9459,7 +9459,7 @@
 	ret
 ; 3fbf8
 
-Function3fbf8: ; 3fbf8
+.InitBackPic: ; 3fbf8
 	call GetTrainerBackpic
 	call CopyBackpic
 	ret
--- /dev/null
+++ b/battle/sliding_intro.asm
@@ -1,0 +1,107 @@
+SlideBattlePics: ; 4e980
+	ld a, [rSVBK]
+	push af
+	ld a, $5
+	ld [rSVBK], a
+	call .subfunction1
+	ld a, rSCX - $ff00
+	ld [hLCDStatCustom], a
+	call .subfunction2
+	xor a
+	ld [hLCDStatCustom], a
+	pop af
+	ld [rSVBK], a
+	ret
+; 4e998
+
+.subfunction1: ; 4e998
+	call .subfunction4
+	ld a, $90
+	ld [hSCX], a
+	ld a, %11100100
+	call DmgToCgbBGPals
+	lb de, %11100100, %11100100
+	call DmgToCgbObjPals
+	ret
+; 4e9ab
+
+.subfunction2: ; 4e9ab
+	ld d, $90
+	ld e, $72
+	ld a, $48
+	inc a
+.loop1
+	push af
+.loop2
+	ld a, [rLY]
+	cp $60
+	jr c, .loop2
+	ld a, d
+	ld [hSCX], a
+	call .subfunction5
+rept 2
+	inc e
+endr
+rept 2
+	dec d
+endr
+	pop af
+	push af
+	cp $1
+	jr z, .skip1
+	push de
+	call .subfunction3
+	pop de
+
+.skip1
+	call DelayFrame
+	pop af
+	dec a
+	jr nz, .loop1
+	ret
+; 4e9d6
+
+.subfunction3: ; 4e9d6
+	ld hl, Sprites + 1
+	ld c, $12 ; 18
+	ld de, $4
+.loop3
+rept 2
+	dec [hl]
+endr
+	add hl, de
+	dec c
+	jr nz, .loop3
+	ret
+; 4e9e5
+
+.subfunction4: ; 4e9e5
+	ld hl, LYOverrides
+	ld a, $90
+	ld bc, SCREEN_HEIGHT_PX
+	call ByteFill
+	ret
+; 4e9f1
+
+.subfunction5: ; 4e9f1
+	ld hl, LYOverrides
+	ld a, d
+	ld c, $3e ; 62
+.loop4
+	ld [hli], a
+	dec c
+	jr nz, .loop4
+	ld a, e
+	ld c, $22 ; 34
+.loop5
+	ld [hli], a
+	dec c
+	jr nz, .loop5
+	xor a
+	ld c, $30 ; 48
+.loop6
+	ld [hli], a
+	dec c
+	jr nz, .loop6
+	ret
+; 4ea0a
--- a/main.asm
+++ b/main.asm
@@ -37911,114 +37911,7 @@
 ; 4e980
 
 
-Function4e980: ; 4e980
-	ld a, [rSVBK]
-	push af
-	ld a, $5
-	ld [rSVBK], a
-	call Function4e998
-	ld a, rSCX - $ff00
-	ld [hLCDStatCustom], a
-	call Function4e9ab
-	xor a
-	ld [hLCDStatCustom], a
-	pop af
-	ld [rSVBK], a
-	ret
-; 4e998
-
-Function4e998: ; 4e998
-	call Function4e9e5
-	ld a, $90
-	ld [hSCX], a
-	ld a, $e4
-	call DmgToCgbBGPals
-	ld de, $e4e4
-	call DmgToCgbObjPals
-	ret
-; 4e9ab
-
-Function4e9ab: ; 4e9ab
-	ld d, $90
-	ld e, $72
-	ld a, $48
-	inc a
-.asm_4e9b2
-	push af
-.asm_4e9b3
-	ld a, [rLY]
-	cp $60
-	jr c, .asm_4e9b3
-	ld a, d
-	ld [hSCX], a
-	call Function4e9f1
-rept 2
-	inc e
-endr
-rept 2
-	dec d
-endr
-	pop af
-	push af
-	cp $1
-	jr z, .asm_4e9ce
-	push de
-	call Function4e9d6
-	pop de
-
-.asm_4e9ce
-	call DelayFrame
-	pop af
-	dec a
-	jr nz, .asm_4e9b2
-	ret
-; 4e9d6
-
-Function4e9d6: ; 4e9d6
-	ld hl, Sprites + 1
-	ld c, $12
-	ld de, $4
-.asm_4e9de
-rept 2
-	dec [hl]
-endr
-	add hl, de
-	dec c
-	jr nz, .asm_4e9de
-	ret
-; 4e9e5
-
-Function4e9e5: ; 4e9e5
-	ld hl, LYOverrides
-	ld a, $90
-	ld bc, SCREEN_HEIGHT_PX
-	call ByteFill
-	ret
-; 4e9f1
-
-Function4e9f1: ; 4e9f1
-	ld hl, LYOverrides
-	ld a, d
-	ld c, $3e
-.asm_4e9f7
-	ld [hli], a
-	dec c
-	jr nz, .asm_4e9f7
-	ld a, e
-	ld c, $22
-.asm_4e9fe
-	ld [hli], a
-	dec c
-	jr nz, .asm_4e9fe
-	xor a
-	ld c, $30
-.asm_4ea05
-	ld [hli], a
-	dec c
-	jr nz, .asm_4ea05
-	ret
-; 4ea0a
-
+INCLUDE "battle/sliding_intro.asm"
 
 
 Function4ea0a: ; 4ea0a
--- a/misc/mobile_40.asm
+++ b/misc/mobile_40.asm
@@ -4039,7 +4039,7 @@
 	ld [hl], a
 	ld a, $1
 	ld [wc2d7], a
-	callba Function3f4dd
+	callba BattleIntro
 	callba Function3c000
 	callba Function3f759
 	xor a