summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorxCrystal <rgr.crystal@gmail.com>2018-02-17 19:55:51 +0100
committerxCrystal <rgr.crystal@gmail.com>2018-02-17 19:55:51 +0100
commit1e411d212d8bb47ee134afc872be9a9303c52820 (patch)
tree854a1e43d2f98cce7251ea9df5bc8af9b2c4754a /src
parentccb7c0c359dd1aa4475c9f51b37f7b5faabc1e34 (diff)
SPRITE_ANIM_ constants (for the sprite anim buffer
Diffstat (limited to 'src')
-rw-r--r--src/constants/gfx_constants.asm24
-rw-r--r--src/constants/misc_constants.asm2
-rw-r--r--src/engine/bank3.asm12
-rw-r--r--src/engine/bank4.asm14
-rw-r--r--src/engine/home.asm10
-rw-r--r--src/macros/wram.asm17
-rw-r--r--src/wram.asm36
7 files changed, 67 insertions, 48 deletions
diff --git a/src/constants/gfx_constants.asm b/src/constants/gfx_constants.asm
index fbcbdda..1cf3770 100644
--- a/src/constants/gfx_constants.asm
+++ b/src/constants/gfx_constants.asm
@@ -12,6 +12,24 @@ CGB_PAL_SIZE EQU 8 ; bytes
; tile size
TILE_SIZE EQU 16 ; bytes
-; wram sprite buffer
-SPRITE_BUFFER_CAPACITY EQU 16 ; sprites
-SPRITE_DATA_LENGTH EQU 16 ; bytes of data per sprite
+; wSpriteAnimBuffer
+SPRITE_ANIM_BUFFER_CAPACITY EQU 16 ; sprites
+
+; sprite_anim_struct constants
+ const_def
+ const SPRITE_ANIM_PROPERTY_1
+ const SPRITE_ANIM_PROPERTY_2
+ const SPRITE_ANIM_COORD_X
+ const SPRITE_ANIM_COORD_Y
+ const SPRITE_ANIM_TILE_ID
+ const SPRITE_ANIM_PROPERTY_6
+ const SPRITE_ANIM_PROPERTY_7
+ const SPRITE_ANIM_PROPERTY_8
+ const SPRITE_ANIM_PROPERTY_9
+ const SPRITE_ANIM_PROPERTY_10
+ const SPRITE_ANIM_PROPERTY_11
+ const SPRITE_ANIM_PROPERTY_12
+ const SPRITE_ANIM_PROPERTY_13
+ const SPRITE_ANIM_PROPERTY_14
+ const SPRITE_ANIM_MOVEMENT_COUNTER
+ const SPRITE_ANIM_PROPERTY_16
diff --git a/src/constants/misc_constants.asm b/src/constants/misc_constants.asm
index 11693b4..1cfffb4 100644
--- a/src/constants/misc_constants.asm
+++ b/src/constants/misc_constants.asm
@@ -1,4 +1,4 @@
-; console types (for wConsole)
+; console types (wConsole)
CONSOLE_DMG EQU $00
CONSOLE_SGB EQU $01
CONSOLE_CGB EQU $02
diff --git a/src/engine/bank3.asm b/src/engine/bank3.asm
index b7038eb..2859382 100644
--- a/src/engine/bank3.asm
+++ b/src/engine/bank3.asm
@@ -656,7 +656,7 @@ Func_c554: ; c554 (3:4554)
ld d, a
ld a, [wSCYBuffer]
ld e, a
- ld c, $2
+ ld c, SPRITE_ANIM_COORD_X
call GetSpriteBufferProperty
ld a, [wd332]
sub d
@@ -680,7 +680,7 @@ Func_c58b: ; c58b (3:458b)
call GetFloorObjectFromPos
and $10
push af
- ld c, $f
+ ld c, SPRITE_ANIM_PROPERTY_16
call GetSpriteBufferProperty
pop af
ld a, [hl]
@@ -788,10 +788,10 @@ AttemptScriptedMovement: ; c619 (3:4619)
ld [wd335], a
ld a, $10
ld [wd338], a
- ld c, $f
+ ld c, SPRITE_ANIM_PROPERTY_16
call GetSpriteBufferProperty
set 2, [hl]
- ld c, $e
+ ld c, SPRITE_ANIM_MOVEMENT_COUNTER
call GetSpriteBufferProperty
ld a, $4
ld [hl], a
@@ -918,10 +918,10 @@ Func_c6dc: ; c6dc (3:46dc)
Func_c6f7: ; c6f7 (3:46f7)
ld a, [wd336]
ld [wWhichSprite], a
- ld c, $f
+ ld c, SPRITE_ANIM_PROPERTY_16
call GetSpriteBufferProperty
res 2, [hl]
- ld c, $e
+ ld c, SPRITE_ANIM_MOVEMENT_COUNTER
call GetSpriteBufferProperty
ld a, $ff
ld [hl], a
diff --git a/src/engine/bank4.asm b/src/engine/bank4.asm
index b2facda..9d2e86a 100644
--- a/src/engine/bank4.asm
+++ b/src/engine/bank4.asm
@@ -495,7 +495,7 @@ INCLUDE "data/overworld_indexes.asm"
Func_10fbc: ; 10fbc (4:4fbc)
ld a, $25
farcall Func_1299f
- ld c, $2
+ ld c, SPRITE_ANIM_COORD_X
call GetSpriteBufferProperty
ld a, $80
ld [hli], a
@@ -503,7 +503,7 @@ Func_10fbc: ; 10fbc (4:4fbc)
ld [hl], a
ld b, $34
ld a, [wConsole]
- cp $2
+ cp CONSOLE_CGB
jr nz, .asm_10fd8
ld b, $37
.asm_10fd8
@@ -533,7 +533,7 @@ Func_10fde: ; 10fde (4:4fde)
farcall CheckIfEventFlagSet
or a
jr nz, .asm_11015
- ld c, $f
+ ld c, SPRITE_ANIM_PROPERTY_16
call GetSpriteBufferProperty
set 7, [hl]
.asm_11015
@@ -552,7 +552,7 @@ Func_11024: ; 11024 (4:5024)
call PlaySFX
ld a, [wd336]
ld [wWhichSprite], a
- ld c, $f
+ ld c, SPRITE_ANIM_PROPERTY_16
call GetSpriteBufferProperty
set 2, [hl]
ld hl, Unknown_1229f
@@ -625,7 +625,7 @@ Func_11060: ; 11060 (4:5060)
Func_110a6: ; 110a6 (4:50a6)
push hl
push bc
- ld c, $2
+ ld c, SPRITE_ANIM_COORD_X
call GetSpriteBufferProperty
pop bc
ld a, b
@@ -765,7 +765,7 @@ Func_11184: ; 11184 (4:5184)
ld d, a
ld a, [wd348]
ld e, a
- ld c, $2
+ ld c, SPRITE_ANIM_COORD_X
call GetSpriteBufferProperty
ld a, [wd343]
add d
@@ -1253,7 +1253,7 @@ Func_12a21: ; 12a21 (4:6a21)
Func_12ab5: ; 12ab5 (4:6ab5)
push hl
push af
- ld c, $5
+ ld c, SPRITE_ANIM_PROPERTY_6
call GetSpriteBufferProperty
pop af
cp [hl]
diff --git a/src/engine/home.asm b/src/engine/home.asm
index d11c4c0..c1c4e07 100644
--- a/src/engine/home.asm
+++ b/src/engine/home.asm
@@ -8037,18 +8037,18 @@ Func_3d72: ; 3d72 (0:3d72)
Func_3db7: ; 3db7 (0:3db7)
push bc
- ld c, $0
+ ld c, SPRITE_ANIM_PROPERTY_1
call GetSpriteBufferProperty
pop bc
ret
-; read property (byte) c from a sprite in wSpriteBuffer identified by wWhichSprite
+; read property (byte) c from a sprite in wSpriteAnimBuffer identified by wWhichSprite
GetSpriteBufferProperty: ; 3dbf (0:3dbf)
ld a, [wWhichSprite]
- cp SPRITE_BUFFER_CAPACITY
+ cp SPRITE_ANIM_BUFFER_CAPACITY
jr c, .got_sprite
rst $38
- ld a, SPRITE_BUFFER_CAPACITY - 1 ; default to last sprite
+ ld a, SPRITE_ANIM_BUFFER_CAPACITY - 1 ; default to last sprite
.got_sprite
push bc
swap a
@@ -8059,7 +8059,7 @@ GetSpriteBufferProperty: ; 3dbf (0:3dbf)
and $f0
or c
ld c, a
- ld hl, wSpriteBuffer
+ ld hl, wSpriteAnimBuffer
add hl, bc
pop bc
ret
diff --git a/src/macros/wram.asm b/src/macros/wram.asm
index 8b3f306..55d32ad 100644
--- a/src/macros/wram.asm
+++ b/src/macros/wram.asm
@@ -28,9 +28,9 @@ card_data_struct: MACRO
ENDM
move_data_struct: MACRO
-\1Energy:: ds $4
+\1Energy:: ds NUM_TYPES / 2
\1Name:: dw
-\1Description:: ds $4
+\1Description:: ds 4
\1Damage:: db
\1Category:: db
\1EffectCommands:: dw
@@ -41,12 +41,13 @@ move_data_struct: MACRO
\1Animation:: db
ENDM
-sprite_buffer_struct: MACRO
+; TODO: Figure out what the rest are for
+sprite_anim_struct: MACRO
\1Property1:: ds 1
-\1Property2:: ds 1
-\1Property3:: ds 1
-\1Property4:: ds 1
-\1Property5:: ds 1
+\1Property2:: ds 1 ; movement handling / palette
+\1CoordX:: db
+\1CoordY:: db
+\1TileID:: db
\1Property6:: ds 1
\1Property7:: ds 1
\1Property8:: ds 1
@@ -56,6 +57,6 @@ sprite_buffer_struct: MACRO
\1Property12:: ds 1
\1Property13:: ds 1
\1Property14:: ds 1
-\1Property15:: ds 1
+\1MovementCounter:: ds 1
\1Property16:: ds 1
ENDM \ No newline at end of file
diff --git a/src/wram.asm b/src/wram.asm
index 70ac991..a8f1e10 100644
--- a/src/wram.asm
+++ b/src/wram.asm
@@ -1175,28 +1175,28 @@ wd4cb:: ; d4cb
ds $4
-; used as an index to manipulate a sprite from wSpriteBuffer
+; used as an index to manipulate a sprite from wSpriteAnimBuffer
wWhichSprite:: ; d4cf
ds $1
; 16-byte data for up to 16 sprites
-wSpriteBuffer:: ; d4d0
- sprite_buffer_struct wSprite1
- sprite_buffer_struct wSprite2
- sprite_buffer_struct wSprite3
- sprite_buffer_struct wSprite4
- sprite_buffer_struct wSprite5
- sprite_buffer_struct wSprite6
- sprite_buffer_struct wSprite7
- sprite_buffer_struct wSprite8
- sprite_buffer_struct wSprite9
- sprite_buffer_struct wSprite10
- sprite_buffer_struct wSprite11
- sprite_buffer_struct wSprite12
- sprite_buffer_struct wSprite13
- sprite_buffer_struct wSprite14
- sprite_buffer_struct wSprite15
- sprite_buffer_struct wSprite16
+wSpriteAnimBuffer:: ; d4d0
+ sprite_anim_struct wSprite1
+ sprite_anim_struct wSprite2
+ sprite_anim_struct wSprite3
+ sprite_anim_struct wSprite4
+ sprite_anim_struct wSprite5
+ sprite_anim_struct wSprite6
+ sprite_anim_struct wSprite7
+ sprite_anim_struct wSprite8
+ sprite_anim_struct wSprite9
+ sprite_anim_struct wSprite10
+ sprite_anim_struct wSprite11
+ sprite_anim_struct wSprite12
+ sprite_anim_struct wSprite13
+ sprite_anim_struct wSprite14
+ sprite_anim_struct wSprite15
+ sprite_anim_struct wSprite16
ds $3