summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoranmart <andrewrmartinek@gmail.com>2016-02-23 11:26:15 -0500
committeranmart <andrewrmartinek@gmail.com>2016-02-23 11:26:15 -0500
commit798a5c1a7d7cc8e02cd649241b357f00871d1290 (patch)
tree2ebf76024c58cb5d4b0e7c3f1cd7b6b6b62aaa6f /src
parentdeed2bb89f992404c1e63c9a75e9a3d99d9aec51 (diff)
Created wCardBuffer label macro
created macro for wCardBuffer labels and updated references
Diffstat (limited to 'src')
-rwxr-xr-xsrc/engine/bank1.asm10
-rwxr-xr-xsrc/engine/home.asm8
-rwxr-xr-xsrc/macros.asm38
-rwxr-xr-xsrc/wram.asm5
4 files changed, 50 insertions, 11 deletions
diff --git a/src/engine/bank1.asm b/src/engine/bank1.asm
index 3736930..2f965fb 100755
--- a/src/engine/bank1.asm
+++ b/src/engine/bank1.asm
@@ -667,7 +667,7 @@ LoadPokemonAttacksToDuelPointerTable: ; 4823 (1:4823)
ld hl, DuelAttackPointerTable
xor a
ld [$cbc7], a
- ld de, wCardBuffer1 + $10
+ ld de, wCardBuffer1Move1Name
call CheckIfMoveExists
jr c, .checkForSecondAttackSlot
ldh a, [$ff98]
@@ -678,7 +678,7 @@ LoadPokemonAttacksToDuelPointerTable: ; 4823 (1:4823)
push hl
push bc
ld e, b
- ld hl, wCardBuffer1 + $10
+ ld hl, wCardBuffer1Move1Name
call $5c33
pop bc
pop hl
@@ -686,7 +686,7 @@ LoadPokemonAttacksToDuelPointerTable: ; 4823 (1:4823)
inc b
.checkForSecondAttackSlot
- ld de, wCardBuffer1 + $23
+ ld de, wCardBuffer1Move2Name
call CheckIfMoveExists
jr c, .finishLoadingAttacks
ldh a, [$ff98]
@@ -716,10 +716,10 @@ CheckIfMoveExists: ; 4872 (1:4872)
ld a, [de]
or c
jr z, .returnNoMoveFound
- ld hl, $0006
+ ld hl, wCardBuffer1Move1Category - (wCardBuffer1Move1Name + 1)
add hl, de
ld a, [hl]
- and $FF - RESIDUAL
+ and $ff - RESIDUAL
cp POKEMON_POWER
jr z, .returnNoMoveFound
or a
diff --git a/src/engine/home.asm b/src/engine/home.asm
index 148da07..71d70c5 100755
--- a/src/engine/home.asm
+++ b/src/engine/home.asm
@@ -2996,7 +2996,7 @@ Func_1aac: ; 1aac (0:1aac)
add DUELVARS_ARENA_CARD
call GetTurnDuelistVariable
call Func_1376
- ld a, [wCardBuffer1 + $7]
+ ld a, [wCardBuffer1ID]
ld [wccc4], a
call Func_1ad3
pop af
@@ -5987,7 +5987,7 @@ Func_3432: ; 3432 (0:3432)
ld e, a
ld d, $0
call Func_2f0a
- ld a, [wCardBuffer2 + $9]
+ ld a, [wCardBuffer2Stage]
or a
ret z
ld e, $5
@@ -6252,7 +6252,7 @@ Func_3730: ; 3730 (0:3730)
ld a, DUELVARS_ARENA_CARD
call GetTurnDuelistVariable
call Func_138c
- ld a, [wCardBuffer2 + $33]
+ ld a, [wCardBuffer2Weakness]
ret
; 0x3743
@@ -6266,7 +6266,7 @@ Func_374a: ; 374a (0:374a)
ld a, DUELVARS_ARENA_CARD
call GetTurnDuelistVariable
call Func_138c
- ld a, [wCardBuffer2 + $34]
+ ld a, [wCardBuffer2Resistance]
ret
; 0x375d
diff --git a/src/macros.asm b/src/macros.asm
index f1a850d..1405c8a 100755
--- a/src/macros.asm
+++ b/src/macros.asm
@@ -311,3 +311,41 @@ ENDM
tx: MACRO
dw \1_
ENDM
+
+card_data_struct: MACRO
+\1Type:: db
+\1Gfx:: dw
+\1Name:: dw
+\1Rarity:: db
+\1Set:: db
+\1ID:: db
+\1HP:: db
+\1Stage:: db
+\1PreEvoName:: dw
+\1Move1:: move_data_struct \1Move1
+\1Move2:: move_data_struct \1Move2
+\1RetreatCost:: db
+\1Weakness:: db
+\1Resistance:: db
+\1Kind:: dw
+\1PokedexNumber:: db
+\1Unknown1:: db
+\1Level:: db
+\1Length:: dw
+\1Weight:: dw
+\1Description:: dw
+\1Unknown2:: db
+ENDM
+
+move_data_struct: MACRO
+\1Energy:: ds $4
+\1Name:: dw
+\1Description:: ds $4
+\1Damage:: db
+\1Category:: db
+\1EffectCommands:: dw
+\1Flag1:: db
+\1Flag2:: db
+\1Flag3:: db
+\1Unknown:: ds $2
+ENDM
diff --git a/src/wram.asm b/src/wram.asm
index ddee677..7c7c774 100755
--- a/src/wram.asm
+++ b/src/wram.asm
@@ -1,4 +1,5 @@
INCLUDE "constants.asm"
+INCLUDE "macros.asm"
;----------------------------------------------------------
;--- Bank 0: $Cxxx ----------------------------------------
@@ -413,10 +414,10 @@ wDuelTheme:: ; cc1a
; Can be data from a card on either side of the field or hand, or from a card in the bench, depending on the duel state.
; Sometimes the two buffers even hold the same card's data.
wCardBuffer1:: ; cc24
- ds CARD_DATA_LENGTH
+ card_data_struct wCardBuffer1
wCardBuffer2:: ; cc65
- ds CARD_DATA_LENGTH
+ card_data_struct wCardBuffer2
ds $4