This commit is contained in:
dannye
2016-02-24 08:52:11 -06:00
5 changed files with 204 additions and 34 deletions
+1 -2
View File
@@ -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
+151 -25
View File
@@ -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,17 +491,17 @@ OpenBattleAttackMenu: ; 46fc (1:46fc)
ld [wSelectedDuelSubMenuItem], a
.tryOpenAttackMenu
call $4823
call LoadPokemonAttacksToDuelPointerTable
or a
jr nz, .asm_471f
jr nz, .openAttackMenu
text_hl Text003c ; no selectable attack
call DrawWideTextBox_WaitForInput
jp Func_4295
.asm_471f
.openAttackMenu
push af
ld a, [wSelectedDuelSubMenuItem]
ld hl, $47e4
ld hl, AttackMenuCursorProperties
call InitializeCursorParameters
pop af
ld [wNumMenuItems], a
@@ -514,11 +514,11 @@ OpenBattleAttackMenu: ; 46fc (1:46fc)
.asm_4736
call DoFrame
ldh a, [hButtonsPressed]
and a, $08
jr nz, .asm_4782
and $08
jr nz, .displaySelectedMoveInfo
call Func_264b
jr nc, .asm_4736
cp a, $ff
cp $ff
jp z, Func_4295
ld [wSelectedDuelSubMenuItem], a
call $488f
@@ -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
@@ -551,27 +551,125 @@ OpenBattleAttackMenu: ; 46fc (1:46fc)
call DrawWideTextBox_WaitForInput
jr .tryOpenAttackMenu
.asm_4782 ; 4782 (1:4782)
call $478b
.displaySelectedMoveInfo ; 4782 (1:4782)
call Func_478b
call $4f9d
jp .tryOpenAttackMenu
INCBIN "baserom.gbc",$478b, $4823 - $478b
Func_478b: ; 478b (1:478b)
ld a, $01
ld [wCardPageNumber], a
xor a
ld [$cbc9], a
call Func_04a2
call Func_3b31
ld de, $8a00
call $59ca
call $5a0e
call $59f5
call $5a34
ld de, $3830
call $5999
ld de, $0604
call $5a56
ldh a, [hCurrentMenuItem]
ld [wSelectedDuelSubMenuItem], a
add a
ld e, a
ld d, $00
ld hl, $c511
add hl, de
ld a, [hl]
or a
jr nz, .asm_47c9
xor a
jr .asm_47cb
Func_4823: ; 4823 (1:4823)
.asm_47c9
ld a, $02
.asm_47cb
ld [$cc04], a
.asm_47ce
call Func_47ec
call EnableLCD
.asm_47d4
call DoFrame
ldh a, [hButtonsPressed2]
and a, $30
jr nz, .asm_47ce
ldh a, [hButtonsPressed]
and a, $03
jr z, .asm_47d4
ret
AttackMenuCursorProperties:
db $01
db $0d
db $02
db $02
db $0f
db $00
db $00
db $00
Func_47ec: ; $47ec (1:47ec)
ld a, [$cc04]
ld hl, $47f5
jp JumpToFunctionInTable
PtrTable_47f5: ; $47f5 (1:47f5)
dw Func_47fd
dw Func_4802
dw Func_480d
dw Func_4812
Func_47fd: ; $47fd (1:47fd)
call $5d1f
jr Func_481b
Func_4802: ; $4802 (1:4802)
ld hl, $cc38
ld a, [hli]
or [hl]
ret z
call $5d27
jr Func_481b
Func_480d: ; $480d (1:480d)
call $5d2f
jr Func_481b
Func_4812: ; $4812 (1:4812)
ld hl, $cc4b
ld a, [hli]
or [hl]
ret z
call $5d37
Func_481b: ; $481b (1:481b)
ld hl, $cc04
ld a, $01
xor [hl]
ld [hl], a
ret
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, wCardBuffer1Move1Name
call CheckIfMoveExists
jr c, .checkForSecondAttackSlot
ldh a, [$ff98]
ld [hli], a
xor a
@@ -580,17 +678,17 @@ Func_4823: ; 4823 (1:4823)
push hl
push bc
ld e, b
ld hl, $cc34
ld hl, wCardBuffer1Move1Name
call $5c33
pop bc
pop hl
inc b
inc b
.asm_4856
ld de, $cc47
call $4872
jr c, .asm_4870
.checkForSecondAttackSlot
ld de, wCardBuffer1Move2Name
call CheckIfMoveExists
jr c, .finishLoadingAttacks
ldh a, [$ff98]
ld [hli], a
ld a, $01
@@ -604,11 +702,39 @@ Func_4823: ; 4823 (1:4823)
pop bc
pop hl
.asm_4870
.finishLoadingAttacks
ld a, c
ret
INCBIN "baserom.gbc",$4872, $4918 - $4872
CheckIfMoveExists: ; 4872 (1:4872)
push hl
push de
push bc
ld a, [de]
ld c, a
inc de
ld a, [de]
or c
jr z, .returnNoMoveFound
ld hl, wCardBuffer1Move1Category - (wCardBuffer1Move1Name + 1)
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
+4 -4
View File
@@ -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
+38
View File
@@ -315,3 +315,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
+10 -3
View File
@@ -1,4 +1,5 @@
INCLUDE "constants.asm"
INCLUDE "macros.asm"
;----------------------------------------------------------
;--- Bank 0: $Cxxx ----------------------------------------
@@ -167,7 +168,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 -----------------------------------------------
@@ -407,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