diff options
-rw-r--r-- | src/constants/duel_constants.asm | 40 | ||||
-rwxr-xr-x | src/engine/bank1.asm | 34 | ||||
-rwxr-xr-x | src/engine/home.asm | 14 | ||||
-rwxr-xr-x | src/wram.asm | 3 |
4 files changed, 46 insertions, 45 deletions
diff --git a/src/constants/duel_constants.asm b/src/constants/duel_constants.asm index 7eb8b27..8d8453f 100644 --- a/src/constants/duel_constants.asm +++ b/src/constants/duel_constants.asm @@ -1,21 +1,25 @@ PLAYER_TURN EQUS "wPlayerDuelVariables >> $8" OPPONENT_TURN EQUS "wOpponentDuelVariables >> $8" -DUELVAR_CARD_LOCATIONS EQUS "wPlayerCardLocations & $ff" -DUELVAR_HAND EQUS "wPlayerHand & $ff" -DUELVAR_DECK_CARDS EQUS "wPlayerDeckCards & $ff" -DUELVAR_NUMBER_OF_CARDS_NOT_IN_DECK EQUS "wPlayerNumberOfCardsNotInDeck & $ff" -DUELVAR_ARENA_CARD EQUS "wPlayerArenaCard & $ff" -DUELVAR_BENCH EQUS "wPlayerBench & $ff" -DUELVAR_ARENA_CARD_HP EQUS "wPlayerArenaCardHP & $ff" -DUELVAR_BENCH1_CARD_HP EQUS "wPlayerBench1CardHP & $ff" -DUELVAR_BENCH2_CARD_HP EQUS "wPlayerBench2CardHP & $ff" -DUELVAR_BENCH3_CARD_HP EQUS "wPlayerBench3CardHP & $ff" -DUELVAR_BENCH4_CARD_HP EQUS "wPlayerBench4CardHP & $ff" -DUELVAR_BENCH5_CARD_HP EQUS "wPlayerBench5CardHP & $ff" -DUELVAR_PRIZES EQUS "wPlayerPrizes & $ff" -DUELVAR_NUMBER_OF_CARDS_IN_DISCARD_PILE EQUS "wPlayerNumberOfCardsInDiscardPile & $ff" -DUELVAR_NUMBER_OF_CARDS_IN_HAND EQUS "wPlayerNumberOfCardsInHand & $ff" -DUELVAR_NUMBER_OF_POKEMON_IN_PLAY EQUS "wPlayerNumberOfPokemonInPlay & $ff" -DUELVAR_ARENA_CARD_STATUS EQUS "wPlayerArenaCardStatus & $ff" -DUELVAR_DUELIST_TYPE EQUS "wPlayerDuelistType & $ff" +DUEL_WON EQU $1 +DUEL_LOST EQU $2 +DUEL_DRAW EQU $3 + +DUELVARS_CARD_LOCATIONS EQUS "wPlayerCardLocations & $ff" +DUELVARS_HAND EQUS "wPlayerHand & $ff" +DUELVARS_DECK_CARDS EQUS "wPlayerDeckCards & $ff" +DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK EQUS "wPlayerNumberOfCardsNotInDeck & $ff" +DUELVARS_ARENA_CARD EQUS "wPlayerArenaCard & $ff" +DUELVARS_BENCH EQUS "wPlayerBench & $ff" +DUELVARS_ARENA_CARD_HP EQUS "wPlayerArenaCardHP & $ff" +DUELVARS_BENCH1_CARD_HP EQUS "wPlayerBench1CardHP & $ff" +DUELVARS_BENCH2_CARD_HP EQUS "wPlayerBench2CardHP & $ff" +DUELVARS_BENCH3_CARD_HP EQUS "wPlayerBench3CardHP & $ff" +DUELVARS_BENCH4_CARD_HP EQUS "wPlayerBench4CardHP & $ff" +DUELVARS_BENCH5_CARD_HP EQUS "wPlayerBench5CardHP & $ff" +DUELVARS_PRIZES EQUS "wPlayerPrizes & $ff" +DUELVARS_NUMBER_OF_CARDS_IN_DISCARD_PILE EQUS "wPlayerNumberOfCardsInDiscardPile & $ff" +DUELVARS_NUMBER_OF_CARDS_IN_HAND EQUS "wPlayerNumberOfCardsInHand & $ff" +DUELVARS_NUMBER_OF_POKEMON_IN_PLAY EQUS "wPlayerNumberOfPokemonInPlay & $ff" +DUELVARS_ARENA_CARD_STATUS EQUS "wPlayerArenaCardStatus & $ff" +DUELVARS_DUELIST_TYPE EQUS "wPlayerDuelistType & $ff" diff --git a/src/engine/bank1.asm b/src/engine/bank1.asm index 41cc9f7..c211fa5 100755 --- a/src/engine/bank1.asm +++ b/src/engine/bank1.asm @@ -94,14 +94,14 @@ StartDuel: ; 409f (1:409f) call $0f58 ld a, [wDuelFinished] or a - jr nz, .asm_4136 + jr nz, .duelIsOver call $35fa call $6baf call $3b31 call $0f58 ld a, [wDuelFinished] or a - jr nz, .asm_4136 + jr nz, .duelIsOver ld hl, $cc06 inc [hl] ld a, [$cc09] @@ -123,7 +123,7 @@ StartDuel: ; 409f (1:409f) ld [$d0c3], a ret -.asm_4136 +.duelIsOver call $5990 call Func_04a2 ld a, $3 @@ -141,9 +141,9 @@ StartDuel: ; 409f (1:409f) ldh [hWhoseTurn], a call $3b21 ld a, [wDuelFinished] - cp $1 + cp DUEL_WON jr z, .activeDuelistWonBattle - cp $2 + cp DUEL_LOST jr z, .activeDuelistLostBattle ld a, $5f ld c, $1a @@ -188,7 +188,7 @@ StartDuel: ; 409f (1:409f) or a jr nz, .asm_41a7 ld a, [wDuelFinished] - cp $3 + cp DUEL_DRAW jr z, .tiedBattle call Func_39fc call WaitForWideTextBoxInput @@ -235,7 +235,7 @@ StartDuel: ; 409f (1:409f) INCBIN "baserom.gbc",$420b,$4225 - $420b Func_4225: ; 4225 (1:4225) - ld a, DUELVAR_DUELIST_TYPE + ld a, DUELVARS_DUELIST_TYPE call GetTurnDuelistVariable ld [$cc0d], a ld a, [$cc06] @@ -248,7 +248,7 @@ Func_4225: ; 4225 (1:4225) call $4933 call $10cf jr nc, .asm_4248 - ld a, $02 + ld a, DUEL_LOST ld [wDuelFinished], a ret @@ -382,12 +382,8 @@ Func_4339: ; 4339 (1:4339) Func_4342: ; 4342 (1:4342) jp $5550 - INCBIN "baserom.gbc",$4345, $438e - $4345 - - - OpenPokemonPowerMenu: ; 438e (1:438e) call $6431 jp c, Func_426d @@ -404,7 +400,7 @@ PlayerEndTurn: ; 439a (1:439a) ret PlayerRetreat: ; 43ab (1:43ab) - ld a, DUELVAR_ARENA_CARD_STATUS + ld a, DUELVARS_ARENA_CARD_STATUS call GetTurnDuelistVariable and a,$0f cp a, $01 @@ -462,7 +458,7 @@ Func_441f: ; 441f (1:441f) jp Func_4295 OpenHandMenu: ; 4425 (1:4425) - ld a, DUELVAR_NUMBER_OF_CARDS_IN_HAND + ld a, DUELVARS_NUMBER_OF_CARDS_IN_HAND call GetTurnDuelistVariable or a jr nz, Func_4436 @@ -512,7 +508,7 @@ Func_471f: ; 471f (1:471f) ld [wNumMenuItems], a ldh a, [hWhoseTurn] ld h, a - ld l, DUELVAR_ARENA_CARD + ld l, DUELVARS_ARENA_CARD ld a, [hl] call $1376 .asm_4736 @@ -599,7 +595,7 @@ INCBIN "baserom.gbc",$67b2,$7107 - $67b2 InitializeDuelVariables: ; 7107 (1:7107) ldh a, [hWhoseTurn] ld h, a - ld l, DUELVAR_DUELIST_TYPE + ld l, DUELVARS_DUELIST_TYPE ld a, [hl] push hl push af @@ -612,8 +608,8 @@ InitializeDuelVariables: ; 7107 (1:7107) pop af pop hl ld [hl], a - ld bc, DECK_SIZE ; lb bc, DUELVAR_CARD_LOCATIONS, DECK_SIZE - ld l, DUELVAR_DECK_CARDS + ld bc, DECK_SIZE ; lb bc, DUELVARS_CARD_LOCATIONS, DECK_SIZE + ld l, DUELVARS_DECK_CARDS .initDuelVariablesLoop ; zero card locations and cards in hand, and init order of cards in deck push hl @@ -625,7 +621,7 @@ InitializeDuelVariables: ; 7107 (1:7107) inc b dec c jr nz, .initDuelVariablesLoop - ld l, DUELVAR_ARENA_CARD + ld l, DUELVARS_ARENA_CARD ld c, 1 + BENCH_SIZE + 1 .initPlayArea ; initialize to $ff card in arena as well as cards in bench (plus a terminator?) diff --git a/src/engine/home.asm b/src/engine/home.asm index aa6e9a8..afdea5c 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -2131,10 +2131,10 @@ ShuffleDeck: ; 10bc (0:10bc) ld h, a ld d, a ld a, DECK_SIZE - ld l, DUELVAR_NUMBER_OF_CARDS_NOT_IN_DECK + ld l, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK sub [hl] ld b, a - ld a, DUELVAR_DECK_CARDS + ld a, DUELVARS_DECK_CARDS add [hl] ld l, a ; hl = position in the wPlayerDeckCards or wOpponentDeckCards array of the first (top) card in the deck ld a, b ; a = number of cards in the deck @@ -2146,7 +2146,7 @@ ShuffleDeck: ; 10bc (0:10bc) ; returns c if deck is empty, nc if a card was succesfully drawn DrawCardFromDeck: ; 10cf (0:10cf) push hl - ld a, DUELVAR_NUMBER_OF_CARDS_NOT_IN_DECK + ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK call GetTurnDuelistVariable cp DECK_SIZE jr nc, .emptyDeck @@ -2154,7 +2154,7 @@ DrawCardFromDeck: ; 10cf (0:10cf) inc a ld [hl], a ; point to top card in the deck - add DUELVAR_DECK_CARDS - 1 + add DUELVARS_DECK_CARDS - 1 ld l, a ; grab card number (0-59) from wPlayerDeckCards or wOpponentDeckCards array ld a, [hl] @@ -2186,10 +2186,10 @@ AddCardToHand: ; 1123 (0:1123) ; write $1 (hand) into the location of this card ld [hl], $1 ; increment number of cards in hand - ld l, DUELVAR_NUMBER_OF_CARDS_IN_HAND + ld l, DUELVARS_NUMBER_OF_CARDS_IN_HAND inc [hl] ; add card to hand - ld a, DUELVAR_HAND - 1 + ld a, DUELVARS_HAND - 1 add [hl] ld l, a ld [hl], e @@ -3732,7 +3732,7 @@ LoadOpponentDeck: ; 2b78 (0:2b78) .validDeck ; set opponent as controlled by AI - ld a, DUELVAR_DUELIST_TYPE + ld a, DUELVARS_DUELIST_TYPE call GetTurnDuelistVariable ld a, [wOpponentDeckId] or $80 diff --git a/src/wram.asm b/src/wram.asm index 9dff601..3f9d4e2 100755 --- a/src/wram.asm +++ b/src/wram.asm @@ -64,7 +64,7 @@ wPlayerBench5CardHP:: ; c2cd ds $1 ds $1e -; Each of the lower four bits represent a prize +; Each bit represents a prize (1 = not taken ; 0 = taken) wPlayerPrizes:: ; c2ec ds $1 @@ -319,6 +319,7 @@ wSelectedDuelSubMenuScrollOffset:: ; $cbd0 ; 0 = no one has won duel yet ; 1 = player whose turn it is has won the duel ; 2 = player whose turn it is has lost the duel +; 3 = duel ended in a draw wDuelFinished:: ; $cc07 ds $1 ds $6 |