diff options
author | xCrystal <rgr.crystal@gmail.com> | 2016-01-17 01:38:16 +0100 |
---|---|---|
committer | xCrystal <rgr.crystal@gmail.com> | 2016-01-17 01:38:16 +0100 |
commit | 95c6b2390120a95c77e4bf582452ec77f426976a (patch) | |
tree | f2c1ffae2ae4eae82617cba3b1a16b891738b782 /src | |
parent | 2adaf3c8373de59f8557a48683386f7729bb49ae (diff) |
disassemble GetCardPointer (0:2f7c)
Diffstat (limited to 'src')
-rwxr-xr-x | src/constants/card_constants.asm | 2 | ||||
-rw-r--r-- | src/data/move_card_effects.asm | 4 | ||||
-rwxr-xr-x | src/engine/home.asm | 33 | ||||
-rwxr-xr-x | src/wram.asm | 4 |
4 files changed, 40 insertions, 3 deletions
diff --git a/src/constants/card_constants.asm b/src/constants/card_constants.asm index bef5f3f..5b10ccb 100755 --- a/src/constants/card_constants.asm +++ b/src/constants/card_constants.asm @@ -226,3 +226,5 @@ MAINTENANCE EQU $E1 POKEMON_FLUTE EQU $E2 GAMBLER EQU $E3 RECYCLE EQU $E4 + +NUM_CARDS EQUS "RECYCLE" diff --git a/src/data/move_card_effects.asm b/src/data/move_card_effects.asm index 1dab5a8..04b5a00 100644 --- a/src/data/move_card_effects.asm +++ b/src/data/move_card_effects.asm @@ -11,6 +11,10 @@ MoveEffectAndTrainerCardCommands: ; 186f7 (6:46f7) ; with an argument identifying the command Id. If said command Id is found in the
; current move effect's array, its assigned function is immediately executed.
+; Similar move effects of different Pokemon cards all point to a different command list,
+; even though in some cases their commands and function pointers match.
+; xxx use <TrainerCardName>FunctionCommands or <EnergyCardName>FunctionCommands for these types of cards.
+
EkansSpitPoisonEffectCommands:
dbw $03, $46F8
dbw $09, $46F0
diff --git a/src/engine/home.asm b/src/engine/home.asm index e3b7192..ea26bc8 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -992,6 +992,7 @@ BankpushHome: ; 0745 (0:0745) ret ; 0x76f +Unknown_076f: ; 076f (0:076f) INCBIN "baserom.gbc",$076f,$078e - $076f ; restore rombank from top-of-stack @@ -3733,7 +3734,37 @@ Func_2e89: ; 2e89 (0:2e89) jp Func_1c7d ; 0x2ea9 -INCBIN "baserom.gbc",$2ea9,$2fa0 - $2ea9 +INCBIN "baserom.gbc",$2ea9,$2f7c - $2ea9 + +GetCardPointer: ; 2f7c (0:2f7c) +; return at hl the pointer to the data of the card with id at e + push de + push bc + ld l, e + ld h, $0 + add hl, hl + ld bc, CardPointers + add hl, bc + ld a, h + cp a, (CardPointers + 2 + (2 * NUM_CARDS)) / $100 + jr nz, .nz + ld a, l + cp a, (CardPointers + 2 + (2 * NUM_CARDS)) % $100 +.nz + ccf + jr c, .outOfBounds + ld a, $c + call Unknown_076f + ld a, [hli] + ld h, [hl] + ld l,a + call BankpopHome + or a +.outOfBounds + pop bc + pop de + ret +; 0x2fa0 LoadCardGfx: ; 2fa0 (0:2fa0) ld a, [hBankROM] diff --git a/src/wram.asm b/src/wram.asm index f33c488..ad91ab2 100755 --- a/src/wram.asm +++ b/src/wram.asm @@ -138,8 +138,8 @@ wDuelTheme:: ; cc1a ds $9 ; wCardBuffer1 and wCardBuffer2 hold the data of a player's or opponent's card. -; can be data from a card on either side of the field, or from a card in the bench, depending on the duel state. -; sometimes the two buffers even hold the same card's data. +; 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:: ; c224 ds CARD_DATA_LENGTH |