shithub: pokecrystal

Download patch

ref: 4a323cf591f27c928acc295f0044ff1608ebada1
parent: 9b0002161be17ff7369a987a3de3c8776992d3a7
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Fri Oct 30 13:32:09 EDT 2020

UnusedSpriteAnimGFX was to sprite anims as AnimObjGFX is to battle anims

--- a/constants/battle_anim_constants.asm
+++ b/constants/battle_anim_constants.asm
@@ -764,6 +764,7 @@
 	const ANIM_BG_WOBBLE_PLAYER
 	const ANIM_BG_WOBBLE_SCREEN
 
+; wBattleAnimTileDict keys (see wram.asm)
 ; AnimObjGFX indexes (see data/battle_anims/object_gfx.asm)
 	const_def 1
 	const ANIM_GFX_HIT
--- a/constants/sprite_anim_constants.asm
+++ b/constants/sprite_anim_constants.asm
@@ -20,6 +20,7 @@
 NUM_SPRITE_ANIM_STRUCTS EQU 10 ; see wSpriteAnimationStructs
 
 ; wSpriteAnimDict keys (see wram.asm)
+; UnusedSpriteAnimGFX indexes (see data/sprite_anims/unused_gfx.asm)
 	const_def
 	const SPRITE_ANIM_DICT_DEFAULT      ; 0
 	const_skip 4                        ; unused
--- a/data/battle_anims/object_gfx.asm
+++ b/data/battle_anims/object_gfx.asm
@@ -1,5 +1,5 @@
 anim_obj_gfx: MACRO
-; # tiles, label
+; # tiles, gfx pointer
 	db \1
 	dba \2
 ENDM
--- /dev/null
+++ b/data/sprite_anims/unused_gfx.asm
@@ -1,0 +1,15 @@
+UnusedSpriteAnimGFX:
+; entries correspond to SPRITE_ANIM_DICT_* constants
+	; # tiles, gfx bank, gfx pointer
+	; (all pointers were dummied out to .DeletedGFX)
+	dbbw 128, $01, .DeletedGFX ; SPRITE_ANIM_DICT_DEFAULT
+	dbbw 128, $01, .DeletedGFX ; unused
+	dbbw 128, $01, .DeletedGFX ; unused
+	dbbw 128, $01, .DeletedGFX ; unused
+	dbbw  16, $37, .DeletedGFX ; unused
+	dbbw  16, $11, .DeletedGFX ; SPRITE_ANIM_DICT_TEXT_CURSOR
+	dbbw  16, $39, .DeletedGFX ; SPRITE_ANIM_DICT_GS_SPLASH (the bank includes engine/movie/splash.asm)
+	dbbw  16, $24, .DeletedGFX ; SPRITE_ANIM_DICT_SLOTS (the bank includes engine/games/slot_machine.asm)
+	dbbw  16, $21, .DeletedGFX ; SPRITE_ANIM_DICT_ARROW_CURSOR
+
+.DeletedGFX
--- a/engine/battle_anims/core.asm
+++ b/engine/battle_anims/core.asm
@@ -313,3 +313,5 @@
 _QueueBGEffect:
 	callfar QueueBGEffect
 	ret
+
+INCLUDE "data/battle_anims/objects.asm"
--- a/engine/battle_anims/helpers.asm
+++ b/engine/battle_anims/helpers.asm
@@ -67,6 +67,7 @@
 	ld hl, BATTLEANIMSTRUCT_DURATION
 	add hl, bc
 	ld [hl], a
+
 	dec a
 	ld hl, BATTLEANIMSTRUCT_FRAME
 	add hl, bc
@@ -87,7 +88,7 @@
 	ld hl, BATTLEANIMSTRUCT_FRAME
 	add hl, bc
 	ld l, [hl]
-	ld h, $0
+	ld h, 0
 	add hl, hl
 	add hl, de
 	ret
@@ -121,3 +122,9 @@
 	call DecompressRequest2bpp
 	pop bc
 	ret
+
+INCLUDE "data/battle_anims/framesets.asm"
+
+INCLUDE "data/battle_anims/oam.asm"
+
+INCLUDE "data/battle_anims/object_gfx.asm"
--- a/engine/gfx/sprites.asm
+++ b/engine/gfx/sprites.asm
@@ -415,9 +415,9 @@
 	add hl, bc
 	ld a, [hl]
 	and a
-	jr z, .next_frame ; finished the current sequence
+	jr z, .next_frame
 	dec [hl]
-	call .GetPointer ; load pointer from SpriteAnimFrameData
+	call .GetPointer
 	ld a, [hli]
 	push af
 	jr .okay
@@ -426,7 +426,7 @@
 	ld hl, SPRITEANIMSTRUCT_FRAME
 	add hl, bc
 	inc [hl]
-	call .GetPointer ; load pointer from SpriteAnimFrameData
+	call .GetPointer
 	ld a, [hli]
 	cp dorestart_command
 	jr z, .restart
@@ -477,9 +477,6 @@
 	jr .loop
 
 .GetPointer:
-	; Get the data for the current frame for the current animation sequence
-
-	; SpriteAnimFrameData[SpriteAnim[SPRITEANIMSTRUCT_FRAMESET_ID]][SpriteAnim[SPRITEANIMSTRUCT_FRAME]]
 	ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
 	add hl, bc
 	ld e, [hl]
@@ -499,7 +496,6 @@
 	ret
 
 GetFrameOAMPointer:
-; Load OAM data pointer
 	ld e, a
 	ld d, 0
 	ld hl, SpriteAnimOAMData
@@ -508,13 +504,13 @@
 	add hl, de
 	ret
 
-BrokenGetStdGraphics: ; unreferenced
+UnusedLoadSpriteAnimGFX: ; unreferenced
 	push hl
 	ld l, a
 	ld h, 0
 	add hl, hl
 	add hl, hl
-	ld de, BrokenStdGFXPointers ; broken 2bpp pointers
+	ld de, UnusedSpriteAnimGFX
 	add hl, de
 	ld c, [hl]
 	inc hl
@@ -537,20 +533,7 @@
 
 INCLUDE "data/sprite_anims/oam.asm"
 
-BrokenStdGFXPointers:
-	; tile count, bank, pointer
-	; (all pointers were dummied out to .deleted)
-	dbbw 128, $01, .deleted
-	dbbw 128, $01, .deleted
-	dbbw 128, $01, .deleted
-	dbbw 128, $01, .deleted
-	dbbw 16, $37, .deleted
-	dbbw 16, $11, .deleted
-	dbbw 16, $39, .deleted
-	dbbw 16, $24, .deleted
-	dbbw 16, $21, .deleted
-
-.deleted
+INCLUDE "data/sprite_anims/unused_gfx.asm"
 
 Sprites_Cosine:
 ; a = d * cos(a * pi/32)
--- a/main.asm
+++ b/main.asm
@@ -434,12 +434,8 @@
 INCLUDE "engine/events/bug_contest/display_stats.asm"
 INCLUDE "engine/battle_anims/anim_commands.asm"
 INCLUDE "engine/battle_anims/core.asm"
-INCLUDE "data/battle_anims/objects.asm"
 INCLUDE "engine/battle_anims/functions.asm"
 INCLUDE "engine/battle_anims/helpers.asm"
-INCLUDE "data/battle_anims/framesets.asm"
-INCLUDE "data/battle_anims/oam.asm"
-INCLUDE "data/battle_anims/object_gfx.asm"
 
 
 SECTION "Pic Animations 1", ROMX