shithub: pokecrystal

Download patch

ref: dba7f59d83c0850c86dd3009d63b2bdeeb0fed68
parent: 33ad00f1abfd791734dcbe33e79f0a49af32958d
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Sun Jul 15 07:58:01 EDT 2018

More OAM coordinate consistency

--- a/engine/events/celebi.asm
+++ b/engine/events/celebi.asm
@@ -31,7 +31,7 @@
 	call GetCelebiSpriteTile
 	inc d
 	push de
-	ld a, $90
+	ld a, 36 * SPRITEOAMSTRUCT_LENGTH
 	ld [wCurrSpriteOAMAddr], a
 	farcall DoNextFrameForAllSprites
 	call CelebiEvent_CountDown
--- a/engine/events/field_moves.asm
+++ b/engine/events/field_moves.asm
@@ -1,3 +1,7 @@
+FIELDMOVE_GRASS EQU $80
+FIELDMOVE_TREE EQU $84
+FIELDMOVE_FLY EQU $84
+
 PlayWhirlpoolSound:
 	call WaitSFX
 	ld de, SFX_SURF
@@ -20,11 +24,11 @@
 ShakeHeadbuttTree:
 	farcall ClearSpriteAnims
 	ld de, CutGrassGFX
-	ld hl, vTiles1 tile $00
+	ld hl, vTiles0 tile FIELDMOVE_GRASS
 	lb bc, BANK(CutGrassGFX), 4
 	call Request2bpp
 	ld de, HeadbuttTreeGFX
-	ld hl, vTiles1 tile $04
+	ld hl, vTiles0 tile FIELDMOVE_TREE
 	lb bc, BANK(HeadbuttTreeGFX), 8
 	call Request2bpp
 	call Cut_Headbutt_GetPixelFacing
@@ -32,8 +36,8 @@
 	call _InitSpriteAnimStruct
 	ld hl, SPRITEANIMSTRUCT_TILE_ID
 	add hl, bc
-	ld [hl], $84
-	ld a, 36 * 4
+	ld [hl], FIELDMOVE_TREE
+	ld a, 36 * SPRITEOAMSTRUCT_LENGTH
 	ld [wCurrSpriteOAMAddr], a
 	farcall DoNextFrameForAllSprites
 	call HideHeadbuttTree
@@ -48,7 +52,7 @@
 	and a
 	jr z, .done
 	dec [hl]
-	ld a, 36 * 4
+	ld a, 36 * SPRITEOAMSTRUCT_LENGTH
 	ld [wCurrSpriteOAMAddr], a
 	farcall DoNextFrameForAllSprites
 	call DelayFrame
@@ -111,7 +115,7 @@
 	; 0: Split tree in half
 	; 1: Mow the lawn
 	ld a, e
-	and $1
+	and 1
 	ld [wJumptableIndex], a
 	call .LoadCutGFX
 	call WaitSFX
@@ -121,7 +125,7 @@
 	ld a, [wJumptableIndex]
 	bit 7, a
 	jr nz, .finish
-	ld a, 36 * 4
+	ld a, 36 * SPRITEOAMSTRUCT_LENGTH
 	ld [wCurrSpriteOAMAddr], a
 	callfar DoNextFrameForAllSprites
 	call OWCutJumptable
@@ -134,11 +138,11 @@
 .LoadCutGFX:
 	callfar ClearSpriteAnims ; pointless to farcall
 	ld de, CutGrassGFX
-	ld hl, vTiles1 tile $00
+	ld hl, vTiles0 tile FIELDMOVE_GRASS
 	lb bc, BANK(CutGrassGFX), 4
 	call Request2bpp
 	ld de, CutTreeGFX
-	ld hl, vTiles1 tile $04
+	ld hl, vTiles0 tile FIELDMOVE_TREE
 	lb bc, BANK(CutTreeGFX), 4
 	call Request2bpp
 	ret
@@ -173,7 +177,7 @@
 	call _InitSpriteAnimStruct
 	ld hl, SPRITEANIMSTRUCT_TILE_ID
 	add hl, bc
-	ld [hl], $84
+	ld [hl], FIELDMOVE_TREE
 	ld a, 32
 	ld [wFrameCounter], a
 ; Cut_StartWaiting
@@ -226,7 +230,7 @@
 	call _InitSpriteAnimStruct
 	ld hl, SPRITEANIMSTRUCT_TILE_ID
 	add hl, bc
-	ld [hl], $80
+	ld [hl], FIELDMOVE_GRASS
 	ld hl, SPRITEANIMSTRUCT_0E
 	add hl, bc
 	ld [hl], $4
@@ -313,7 +317,7 @@
 	call _InitSpriteAnimStruct
 	ld hl, SPRITEANIMSTRUCT_TILE_ID
 	add hl, bc
-	ld [hl], $84
+	ld [hl], FIELDMOVE_FLY
 	ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
 	add hl, bc
 	ld [hl], SPRITE_ANIM_SEQ_FLY_FROM
@@ -323,7 +327,7 @@
 	ld a, [wJumptableIndex]
 	bit 7, a
 	jr nz, .exit
-	ld a, 0 * 4
+	ld a, 0 * SPRITEOAMSTRUCT_LENGTH
 	ld [wCurrSpriteOAMAddr], a
 	callfar DoNextFrameForAllSprites
 	call FlyFunction_FrameTimer
@@ -347,7 +351,7 @@
 	call _InitSpriteAnimStruct
 	ld hl, SPRITEANIMSTRUCT_TILE_ID
 	add hl, bc
-	ld [hl], $84
+	ld [hl], FIELDMOVE_FLY
 	ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
 	add hl, bc
 	ld [hl], SPRITE_ANIM_SEQ_FLY_TO
@@ -360,7 +364,7 @@
 	ld a, [wJumptableIndex]
 	bit 7, a
 	jr nz, .exit
-	ld a, 0 * 4
+	ld a, 0 * SPRITEOAMSTRUCT_LENGTH
 	ld [wCurrSpriteOAMAddr], a
 	callfar DoNextFrameForAllSprites
 	call FlyFunction_FrameTimer
@@ -394,7 +398,7 @@
 FlyFunction_InitGFX:
 	callfar ClearSpriteAnims
 	ld de, CutGrassGFX
-	ld hl, vTiles1 tile $00
+	ld hl, vTiles0 tile FIELDMOVE_GRASS
 	lb bc, BANK(CutGrassGFX), 4
 	call Request2bpp
 	ld a, [wCurPartyMon]
@@ -404,7 +408,7 @@
 	add hl, de
 	ld a, [hl]
 	ld [wd265], a
-	ld e, $84
+	ld e, FIELDMOVE_FLY
 	farcall FlyFunction_GetMonIcon
 	xor a
 	ld [wJumptableIndex], a
@@ -446,5 +450,5 @@
 	call _InitSpriteAnimStruct
 	ld hl, SPRITEANIMSTRUCT_TILE_ID
 	add hl, bc
-	ld [hl], $80
+	ld [hl], FIELDMOVE_GRASS
 	ret
--- a/engine/events/fishing_gfx.asm
+++ b/engine/events/fishing_gfx.asm
@@ -17,7 +17,7 @@
 	call .LoadGFX
 	ld hl, vTiles0 tile $0a
 	call .LoadGFX
-	ld hl, vTiles1 tile $7c
+	ld hl, vTiles0 tile $fc
 	call .LoadGFX
 
 	pop af
--- a/engine/games/unown_puzzle.asm
+++ b/engine/games/unown_puzzle.asm
@@ -19,11 +19,11 @@
 	xor a
 	call ByteFill
 	ld hl, UnownPuzzleCursorGFX
-	ld de, vTiles1 tile $60
+	ld de, vTiles0 tile $e0
 	ld bc, 4 tiles
 	call CopyBytes
 	ld hl, UnownPuzzleStartCancelLZ
-	ld de, vTiles1 tile $6d
+	ld de, vTiles0 tile $ed
 	call Decompress
 	call LoadUnownPuzzlePiecesGFX
 	hlcoord 0, 0
--- a/engine/movie/title.asm
+++ b/engine/movie/title.asm
@@ -246,8 +246,8 @@
 	ret
 
 .Frames:
-	db $80 ; vTiles4 tile $00
-	db $88 ; vTiles4 tile $08
+	db $80 ; vTiles3 tile $80
+	db $88 ; vTiles3 tile $88
 	db $00 ; vTiles5 tile $00
 	db $08 ; vTiles5 tile $08
 
--- a/mobile/mobile_22_2.asm
+++ b/mobile/mobile_22_2.asm
@@ -586,7 +586,7 @@
 	ld a, BANK(GFX_17afa5)
 	call FarCopyBytes
 	ld hl, GFX_17afa5 + $514 + $160
-	ld de, vTiles1 tile $6e
+	ld de, vTiles0 tile $ee
 	ld bc, $10
 	ld a, BANK(GFX_17afa5)
 	call FarCopyBytes
--- a/mobile/mobile_46.asm
+++ b/mobile/mobile_46.asm
@@ -5543,7 +5543,7 @@
 	call Function11b314
 	call Function11acb7
 	call Function11ad6e
-	ld a, 30 * 4
+	ld a, 30 * SPRITEOAMSTRUCT_LENGTH
 	ld [wCurrSpriteOAMAddr], a
 	farcall DoNextFrameForAllSprites
 	farcall ReloadMapPart
--- a/mobile/mobile_5c.asm
+++ b/mobile/mobile_5c.asm
@@ -279,7 +279,7 @@
 	ld a, $1
 	ld [rVBK], a
 	ld de, GFX_171848
-	ld hl, vTiles1 tile $41
+	ld hl, vTiles0 tile $c1
 	lb bc, BANK(GFX_171848), 24
 	call Get2bpp
 	xor a
--- a/mobile/mobile_5f.asm
+++ b/mobile/mobile_5f.asm
@@ -605,7 +605,7 @@
 	call ClearScreen
 	farcall ReloadMapPart
 	call DisableLCD
-	ld hl, vTiles1 tile $6e
+	ld hl, vTiles0 tile $ee
 	ld de, $c608
 	ld bc, 1 tiles
 	call CopyBytes
@@ -620,7 +620,7 @@
 	ld bc, 1 tiles
 	call ByteFill
 	ld hl, $c608
-	ld de, vTiles1 tile $6e
+	ld de, vTiles0 tile $ee
 	ld bc, 1 tiles
 	call CopyBytes
 	xor a
@@ -652,7 +652,7 @@
 
 Function17d405:
 	call DisableLCD
-	ld hl, vTiles1 tile $6e
+	ld hl, vTiles0 tile $ee
 	ld de, $c608
 	ld bc, 1 tiles
 	call CopyBytes
@@ -667,7 +667,7 @@
 	ld bc, 1 tiles
 	call ByteFill
 	ld hl, $c608
-	ld de, vTiles1 tile $6e
+	ld de, vTiles0 tile $ee
 	ld bc, 1 tiles
 	call CopyBytes
 	xor a