Add more constants for battle anim structs

Any access of the wram arrays for battle anim objects and background
effects use appropriate macros and constants, now.
This commit is contained in:
mid-kid 2019-02-16 01:33:40 +01:00
parent ee86b36766
commit 7e93916c8a
4 changed files with 22 additions and 16 deletions

View File

@ -25,6 +25,7 @@
const BATTLEANIMSTRUCT_16 const BATTLEANIMSTRUCT_16
const BATTLEANIMSTRUCT_17 const BATTLEANIMSTRUCT_17
BATTLEANIMSTRUCT_LENGTH EQU const_value BATTLEANIMSTRUCT_LENGTH EQU const_value
NUM_ANIM_OBJECTS EQUS "(wActiveAnimObjectsEnd - wActiveAnimObjects) / BATTLEANIMSTRUCT_LENGTH"
; Start tile for battle animation graphics ; Start tile for battle animation graphics
BATTLEANIM_BASE_TILE EQU 7 * 7 ; Maximum size of a pokemon picture BATTLEANIM_BASE_TILE EQU 7 * 7 ; Maximum size of a pokemon picture
@ -816,6 +817,8 @@ BATTLEANIM_BASE_TILE EQU 7 * 7 ; Maximum size of a pokemon picture
const BG_EFFECT_STRUCT_JT_INDEX const BG_EFFECT_STRUCT_JT_INDEX
const BG_EFFECT_STRUCT_BATTLE_TURN const BG_EFFECT_STRUCT_BATTLE_TURN
const BG_EFFECT_STRUCT_03 const BG_EFFECT_STRUCT_03
BG_EFFECT_STRUCT_LENGTH EQU const_value
NUM_BG_EFFECTS EQUS "(wActiveBGEffectsEnd - wActiveBGEffects) / BG_EFFECT_STRUCT_LENGTH"
; battle palettes ; battle palettes
const_def const_def

View File

@ -112,10 +112,10 @@ RunBattleAnimScript:
cp ROLLOUT cp ROLLOUT
jr nz, .not_rollout jr nz, .not_rollout
ld a, $2e ld a, ANIM_BG_2E
ld b, 5 ld b, NUM_BG_EFFECTS
ld de, 4 ld de, BG_EFFECT_STRUCT_LENGTH
ld hl, wActiveBGEffects ld hl, wBGEffect1Function
.find .find
cp [hl] cp [hl]
jr z, .done jr z, .done
@ -643,10 +643,13 @@ BattleAnimCmd_ResetObp0:
ret ret
BattleAnimCmd_ClearObjs: BattleAnimCmd_ClearObjs:
; BUG: This function only clears the first 6+(2/3) objects
ld hl, wActiveAnimObjects ld hl, wActiveAnimObjects
ld a, $a0 ld a, $a0
; ld a, wActiveAnimObjectsEnd - wActiveAnimObjects
.loop .loop
ld [hl], $0 ld [hl], 0
inc hl inc hl
dec a dec a
jr nz, .loop jr nz, .loop
@ -693,7 +696,7 @@ endr
BattleAnimCmd_IncObj: BattleAnimCmd_IncObj:
call GetBattleAnimByte call GetBattleAnimByte
ld e, 10 ld e, NUM_ANIM_OBJECTS
ld bc, wActiveAnimObjects ld bc, wActiveAnimObjects
.loop .loop
ld hl, BATTLEANIMSTRUCT_INDEX ld hl, BATTLEANIMSTRUCT_INDEX
@ -718,8 +721,8 @@ BattleAnimCmd_IncObj:
BattleAnimCmd_IncBGEffect: BattleAnimCmd_IncBGEffect:
call GetBattleAnimByte call GetBattleAnimByte
ld e, 5 ld e, NUM_BG_EFFECTS
ld bc, wActiveBGEffects ld bc, wBGEffect1Function
.loop .loop
ld hl, $0 ld hl, $0
add hl, bc add hl, bc
@ -743,7 +746,7 @@ BattleAnimCmd_IncBGEffect:
BattleAnimCmd_SetObj: BattleAnimCmd_SetObj:
call GetBattleAnimByte call GetBattleAnimByte
ld e, 10 ld e, NUM_ANIM_OBJECTS
ld bc, wActiveAnimObjects ld bc, wActiveAnimObjects
.loop .loop
ld hl, BATTLEANIMSTRUCT_INDEX ld hl, BATTLEANIMSTRUCT_INDEX
@ -1430,10 +1433,10 @@ BattleAnim_SetOBPals:
ret ret
BattleAnim_UpdateOAM_All: BattleAnim_UpdateOAM_All:
ld a, $0 ld a, 0
ld [wBattleAnimOAMPointerLo], a ld [wBattleAnimOAMPointerLo], a
ld hl, wActiveAnimObjects ld hl, wActiveAnimObjects
ld e, 10 ld e, NUM_ANIM_OBJECTS
.loop .loop
ld a, [hl] ld a, [hl]
and a and a

View File

@ -10,7 +10,7 @@
ExecuteBGEffects: ExecuteBGEffects:
ld hl, wActiveBGEffects ld hl, wActiveBGEffects
ld e, 5 ld e, NUM_BG_EFFECTS
.loop .loop
ld a, [hl] ld a, [hl]
and a and a
@ -23,7 +23,7 @@ ExecuteBGEffects:
pop de pop de
pop hl pop hl
.next .next
ld bc, 4 ld bc, BG_EFFECT_STRUCT_LENGTH
add hl, bc add hl, bc
dec e dec e
jr nz, .loop jr nz, .loop
@ -31,12 +31,12 @@ ExecuteBGEffects:
QueueBGEffect: QueueBGEffect:
ld hl, wActiveBGEffects ld hl, wActiveBGEffects
ld e, 5 ld e, NUM_BG_EFFECTS
.loop .loop
ld a, [hl] ld a, [hl]
and a and a
jr z, .load jr z, .load
ld bc, 4 ld bc, BG_EFFECT_STRUCT_LENGTH
add hl, bc add hl, bc
dec e dec e
jr nz, .loop jr nz, .loop

View File

@ -1,6 +1,6 @@
QueueBattleAnimation: QueueBattleAnimation:
ld hl, wActiveAnimObjects ld hl, wActiveAnimObjects
ld e, 10 ld e, NUM_ANIM_OBJECTS
.loop .loop
ld a, [hl] ld a, [hl]
and a and a