diff options
author | anmart <andrewrmartinek@gmail.com> | 2016-02-22 20:04:09 -0500 |
---|---|---|
committer | anmart <andrewrmartinek@gmail.com> | 2016-02-22 20:04:09 -0500 |
commit | d85f56c95c716fc53451d220ee299b02bfe0e4ba (patch) | |
tree | e95fae2abefacf0bd86cd03d74df4995e42dbf82 /src | |
parent | 5797eff9a179e6ed01945e4153b709640d6fae4a (diff) |
disassembled some more attack menu code
disassembled another attack menu function and gave names to some
ambiguous labels
Diffstat (limited to 'src')
-rw-r--r-- | src/constants/duel_constants.asm | 3 | ||||
-rwxr-xr-x | src/engine/bank1.asm | 60 | ||||
-rwxr-xr-x | src/wram.asm | 8 |
3 files changed, 52 insertions, 19 deletions
diff --git a/src/constants/duel_constants.asm b/src/constants/duel_constants.asm index 95bbe8d..cfa27d2 100644 --- a/src/constants/duel_constants.asm +++ b/src/constants/duel_constants.asm @@ -27,7 +27,6 @@ DUELVARS_DUELIST_TYPE EQUS "wPlayerDuelistType & $ff" ; status condition constants CARD_NOSTATUS EQU $00 -;TODO - ??? EQU $01 +CARD_CONFUSED EQU $01 CARD_ASLEEP EQU $02 CARD_PARALYZED EQU $03 -;TODO - beyond diff --git a/src/engine/bank1.asm b/src/engine/bank1.asm index 57905c3..8692cf9 100755 --- a/src/engine/bank1.asm +++ b/src/engine/bank1.asm @@ -50,7 +50,7 @@ StartDuel: ; 409f (1:409f) ld a, PLAYER_TURN ldh [hWhoseTurn], a ld a, $0 - ld [$c2f1], a + ld [wPlayerDuelistType], a ld a, [$cc19] ld [wOpponentDeckId], a call LoadPlayerDeck @@ -491,7 +491,7 @@ OpenBattleAttackMenu: ; 46fc (1:46fc) ld [wSelectedDuelSubMenuItem], a .tryOpenAttackMenu - call $4823 + call LoadPokemonAttacksToDuelPointerTable or a jr nz, .asm_471f ld hl, $003c @@ -532,7 +532,7 @@ OpenBattleAttackMenu: ; 46fc (1:46fc) add a ld e, a ld d, $00 - ld hl, $c510 + ld hl, DuelAttackPointerTable add hl, de ld d, [hl] inc hl @@ -558,20 +558,20 @@ OpenBattleAttackMenu: ; 46fc (1:46fc) INCBIN "baserom.gbc",$478b, $4823 - $478b -Func_4823: ; 4823 (1:4823) +LoadPokemonAttacksToDuelPointerTable: ; 4823 (1:4823) call DrawWideTextBox ld a, DUELVARS_ARENA_CARD call GetTurnDuelistVariable ldh [$ff98], a - call $1376 + call Func_1376 ld c, $00 ld b, $0d - ld hl, $c510 + ld hl, DuelAttackPointerTable xor a ld [$cbc7], a - ld de, $cc34 - call $4872 - jr c, .asm_4856 + ld de, wCardBuffer1 + $10 + call CheckIfMoveExists + jr c, .checkForSecondAttackSlot ldh a, [$ff98] ld [hli], a xor a @@ -580,17 +580,17 @@ Func_4823: ; 4823 (1:4823) push hl push bc ld e, b - ld hl, $cc34 + ld hl, wCardBuffer1 + $10 call $5c33 pop bc pop hl inc b inc b -.asm_4856 - ld de, $cc47 - call $4872 - jr c, .asm_4870 +.checkForSecondAttackSlot + ld de, wCardBuffer1 + $23 + call CheckIfMoveExists + jr c, .finishLoadingAttacks ldh a, [$ff98] ld [hli], a ld a, $01 @@ -604,11 +604,39 @@ Func_4823: ; 4823 (1:4823) pop bc pop hl -.asm_4870 +.finishLoadingAttacks ld a, c ret -INCBIN "baserom.gbc",$4872, $4918 - $4872 +CheckIfMoveExists: + push hl + push de + push bc + ld a, [de] + ld c, a + inc de + ld a, [de] + or c + jr z, .returnNoMoveFound + ld hl, $0006 + add hl, de + ld a, [hl] + and $FF - RESIDUAL + cp POKEMON_POWER + jr z, .returnNoMoveFound + or a + +.return + pop bc + pop de + pop hl + ret + +.returnNoMoveFound + scf + jr .return + +INCBIN "baserom.gbc",$488f, $4918 - $488f CheckIfActiveCardParalyzedOrAsleep: ; 4918 (1:4918) ld a, DUELVARS_ARENA_CARD_STATUS diff --git a/src/wram.asm b/src/wram.asm index db424fe..ddee677 100755 --- a/src/wram.asm +++ b/src/wram.asm @@ -167,7 +167,13 @@ wPlayerDeck:: ; c400 wOpponentDeck:: ; c480 ds $80 - ds $500 + ds $10 + +; when the attack menu opens, it stores +; each move in the order of +; cardNumber, moveNumber, ... +DuelAttackPointerTable:: ; c510 + ds $4f0 ;--- Engine ----------------------------------------------- |