diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/bank1.asm | 22 | ||||
-rw-r--r-- | src/engine/bank5.asm | 8 | ||||
-rw-r--r-- | src/engine/bank8.asm | 4 | ||||
-rw-r--r-- | src/engine/home.asm | 78 | ||||
-rw-r--r-- | src/hram.asm | 6 | ||||
-rw-r--r-- | src/wram.asm | 11 |
6 files changed, 68 insertions, 61 deletions
diff --git a/src/engine/bank1.asm b/src/engine/bank1.asm index 1c4fd43..91629a6 100644 --- a/src/engine/bank1.asm +++ b/src/engine/bank1.asm @@ -300,7 +300,7 @@ HandleTurn: ; 4225 (1:4225) ret .deck_not_empty - ldh [hTempCardNumber_ff98], a + ldh [hTempCardIndex_ff98], a call AddCardToHand ld a, [wcc0d] cp DUELIST_TYPE_PLAYER @@ -539,7 +539,7 @@ PlayerUseEnergyCard: ; 4477 (1:4477) ldh a, [hTempPlayAreaLocationOffset_ff9d] ldh [hTempPlayAreaLocationOffset_ffa1], a ld e, a - ldh a, [hTempCardNumber_ff98] + ldh a, [hTempCardIndex_ff98] ld [$ffa0], a call $14d2 call $61b8 @@ -763,7 +763,7 @@ LoadPokemonMovesToDuelCardOrAttackList: ; 4823 (1:4823) call DrawWideTextBox ld a, DUELVARS_ARENA_CARD call GetTurnDuelistVariable - ldh [hTempCardNumber_ff98], a + ldh [hTempCardIndex_ff98], a call LoadDeckCardToBuffer1 ld c, $00 ld b, $0d @@ -773,7 +773,7 @@ LoadPokemonMovesToDuelCardOrAttackList: ; 4823 (1:4823) ld de, wLoadedCard1Move1Name call CheckIfMoveExists jr c, .check_for_second_attack_slot - ldh a, [hTempCardNumber_ff98] + ldh a, [hTempCardIndex_ff98] ld [hli], a xor a ld [hli], a @@ -792,7 +792,7 @@ LoadPokemonMovesToDuelCardOrAttackList: ; 4823 (1:4823) ld de, wLoadedCard1Move2Name call CheckIfMoveExists jr c, .finish_loading_attacks - ldh a, [hTempCardNumber_ff98] + ldh a, [hTempCardIndex_ff98] ld [hli], a ld a, $01 ld [hli], a @@ -1158,14 +1158,14 @@ Func_4cd5: ; 4cd5 (1:4cd5) ld hl, $006e call $5502 jr c, .asm_4d28 - ldh a, [hTempCardNumber_ff98] + ldh a, [hTempCardIndex_ff98] call LoadDeckCardToBuffer1 ld a, $2 call $51e7 jr c, .asm_4d28 - ldh a, [hTempCardNumber_ff98] + ldh a, [hTempCardIndex_ff98] call Func_1485 - ldh a, [hTempCardNumber_ff98] + ldh a, [hTempCardIndex_ff98] ld hl, $0062 call $4b31 jr .asm_4d4c @@ -1187,9 +1187,9 @@ Func_4cd5: ; 4cd5 (1:4cd5) call GetTurnDuelistVariable cp MAX_POKEMON_IN_PLAY jr nc, .asm_4d86 - ldh a, [hTempCardNumber_ff98] + ldh a, [hTempCardIndex_ff98] call Func_1485 - ldh a, [hTempCardNumber_ff98] + ldh a, [hTempCardIndex_ff98] ld hl, $0061 call $4b31 ld a, $5 @@ -1322,7 +1322,7 @@ AIUseEnergyCard: ; 69a5 (1:69a5) ldh [hTempPlayAreaLocationOffset_ff9d], a ld e, a ld a, [$ffa0] - ldh [hTempCardNumber_ff98], a + ldh [hTempCardIndex_ff98], a call $14d2 ld a, [$ffa0] call LoadDeckCardToBuffer1 diff --git a/src/engine/bank5.asm b/src/engine/bank5.asm index 4e21b6b..6892ec2 100644 --- a/src/engine/bank5.asm +++ b/src/engine/bank5.asm @@ -61,7 +61,7 @@ Func_14226: ; 14226 (5:4226) ld hl, wDuelCardOrAttackList .check_for_next_pokemon ld a, [hli] - ldh [hTempCardNumber_ff98], a + ldh [hTempCardIndex_ff98], a cp $ff ret z call LoadDeckCardToBuffer1 @@ -72,7 +72,7 @@ Func_14226: ; 14226 (5:4226) or a jr nz, .check_for_next_pokemon push hl - ldh a, [hTempCardNumber_ff98] + ldh a, [hTempCardIndex_ff98] call Func_1485 pop hl jr .check_for_next_pokemon @@ -252,7 +252,7 @@ Func_15649: ; 15649 (5:5649) cp $ff jr z, .asm_156b1 call SwapTurn - call GetCardInDeckPosition + call GetCardIDFromDeckIndex call SwapTurn ld a, e cp MEWTWO1 ; I believe this is a check for Mewtwo1's Barrier move @@ -267,7 +267,7 @@ Func_15649: ; 15649 (5:5649) ld a, (wPlayerArenaCard & $FF) call GetNonTurnDuelistVariable call SwapTurn - call GetCardInDeckPosition + call GetCardIDFromDeckIndex call SwapTurn ld a, e cp MEWTWO1 diff --git a/src/engine/bank8.asm b/src/engine/bank8.asm index 0dbe211..dd3026f 100644 --- a/src/engine/bank8.asm +++ b/src/engine/bank8.asm @@ -45,7 +45,7 @@ Func_200e5: ; 200e5 (8:40e5) push hl push de ld a, [$ce16] - ldh [hTempCardNumber_ff9f], a + ldh [hTempCardIndex_ff9f], a bank1call $35a9 jp c, $41a8 call Func_1944 @@ -66,7 +66,7 @@ Func_200e5: ; 200e5 (8:40e5) push de push hl ld a, [$ce16] - ldh [hTempCardNumber_ff9f], a + ldh [hTempCardIndex_ff9f], a ld a, $6 bank1call $67be pop hl diff --git a/src/engine/home.asm b/src/engine/home.asm index 7257af3..bc1349c 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -2626,13 +2626,13 @@ Func_100b: ; 100b (0:100b) push hl ld a, DUELVARS_ARENA_CARD call GetTurnDuelistVariable - call GetCardInDeckPosition + call GetCardIDFromDeckIndex ld a, e ld [wTempTurnDuelistCardId], a call SwapTurn ld a, DUELVARS_ARENA_CARD call GetTurnDuelistVariable - call GetCardInDeckPosition + call GetCardIDFromDeckIndex ld a, e ld [wTempNonTurnDuelistCardId], a call SwapTurn @@ -2733,7 +2733,7 @@ ShuffleDeck: ; 10bc (0:10bc) ld b, a ld a, DUELVARS_DECK_CARDS add [hl] - ld l, a ; hl = position of the first (top) deck card in the wPlayerDeckCards or wOpponentDeckCards array + ld l, a ; hl = DUELVARS_DECK_CARDS + [DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK] ld a, b ; a = number of cards in the deck call ShuffleCards ret @@ -3143,7 +3143,7 @@ FindLastCardInHand: ; 1271 (0:1271) ; shuffles the deck by swapping the position of each card with the position of another random card ; input: ; - a = how many cards to shuffle -; - hl = position of the first card within the wPlayerDeckCards or wOpponentDeckCards array +; - hl = DUELVARS_DECK_CARDS + [DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK] ShuffleCards: ; 127f (0:127f) or a ret z ; return if deck is empty @@ -3182,18 +3182,18 @@ ShuffleCards: ; 127f (0:127f) INCROM $12a3, $12fa -; returns, in register bc, the id of the card in the deck position specified in register a +; returns, in register bc, the id of the card with the deck index specified in register a ; preserves hl -GetCardInDeckPosition_bc: ; 12fa (0:12fa) +GetCardIDFromDeckIndex_bc: ; 12fa (0:12fa) push hl - call _GetCardInDeckPosition + call _GetCardIDFromDeckIndex ld c, a ld b, $0 pop hl ret ; 0x1303 -; return [wDuelCardOrAttackList + a] in a and in hTempCardNumber_ff98 +; return [wDuelCardOrAttackList + a] in a and in hTempCardIndex_ff98 Func_1303: ; 1303 (0:1303) push hl push de @@ -3202,15 +3202,15 @@ Func_1303: ; 1303 (0:1303) ld hl, wDuelCardOrAttackList add hl, de ld a, [hl] - ldh [hTempCardNumber_ff98], a + ldh [hTempCardIndex_ff98], a pop de pop hl ret ; 0x1312 -; given the deck position (0-59) of a card in [wDuelCardOrAttackList + a], return: -; - the id of the card located in that deck position in register de -; - [wDuelCardOrAttackList + a] in hTempCardNumber_ff98 and in register a +; given the deck index (0-59) of a card in [wDuelCardOrAttackList + a], return: +; - the id of the card with that deck index in register de +; - [wDuelCardOrAttackList + a] in hTempCardIndex_ff98 and in register a GetCardInList: ; 1312 (0:1312) push hl ld e, a @@ -3218,19 +3218,19 @@ GetCardInList: ; 1312 (0:1312) ld hl, wDuelCardOrAttackList add hl, de ld a, [hl] - ldh [hTempCardNumber_ff98], a - call GetCardInDeckPosition + ldh [hTempCardIndex_ff98], a + call GetCardIDFromDeckIndex pop hl - ldh a, [hTempCardNumber_ff98] + ldh a, [hTempCardIndex_ff98] ret ; 0x1324 -; returns, in register de, the id of the card in the deck position (0-59) specified by register a +; returns, in register de, the id of the card with the deck index (0-59) specified by register a ; preserves af and hl -GetCardInDeckPosition: ; 1324 (0:1324) +GetCardIDFromDeckIndex: ; 1324 (0:1324) push af push hl - call _GetCardInDeckPosition + call _GetCardIDFromDeckIndex ld e, a ld d, $0 pop hl @@ -3240,8 +3240,8 @@ GetCardInDeckPosition: ; 1324 (0:1324) INCROM $132f, $1362 -; returns, in register a, the id of the card in the deck position (0-59) specified in register a -_GetCardInDeckPosition: ; 1362 (0:1362) +; returns, in register a, the id of the card with the deck index (0-59) specified in register a +_GetCardIDFromDeckIndex: ; 1362 (0:1362) push de ld e, a ld d, $0 @@ -3256,13 +3256,13 @@ _GetCardInDeckPosition: ; 1362 (0:1362) pop de ret -; load data of card in deck position a (0-59) to wLoadedCard1 +; load data of card with deck index a (0-59) to wLoadedCard1 LoadDeckCardToBuffer1: ; 1376 (0:1376) push hl push de push bc push af - call GetCardInDeckPosition + call GetCardIDFromDeckIndex call LoadCardDataToBuffer1 pop af ld hl, wLoadedCard1 @@ -3273,13 +3273,13 @@ LoadDeckCardToBuffer1: ; 1376 (0:1376) pop hl ret -; load data of card in deck position a (0-59) to wLoadedCard2 +; load data of card with deck index a (0-59) to wLoadedCard2 LoadDeckCardToBuffer2: ; 138c (0:138c) push hl push de push bc push af - call GetCardInDeckPosition + call GetCardIDFromDeckIndex call LoadCardDataToBuffer2 pop af ld hl, wLoadedCard2 @@ -3435,7 +3435,7 @@ CountCardIDInLocation: ; 15ef (0:15ef) jr nz, .unmatching_card_location_orID ld a, l push hl - call _GetCardInDeckPosition + call _GetCardIDFromDeckIndex cp e pop hl jr nz, .unmatching_card_location_orID @@ -3481,7 +3481,7 @@ CopyMoveDataAndDamage: ; 16c0 (0:16c0) ld a, e ld [wSelectedMoveIndex], a ld a, d - ldh [hTempCardNumber_ff9f], a + ldh [hTempCardIndex_ff9f], a call LoadDeckCardToBuffer1 ld a, [wLoadedCard1ID] ld [wTempCardId], a @@ -3512,14 +3512,14 @@ CopyMoveDataAndDamage: ; 16c0 (0:16c0) Func_16f6: ; 16f6 (0:16f6) ld a, DUELVARS_ARENA_CARD call GetTurnDuelistVariable - ldh [hTempCardNumber_ff9f], a - call GetCardInDeckPosition + ldh [hTempCardIndex_ff9f], a + call GetCardIDFromDeckIndex ld a, e ld [wTempTurnDuelistCardId], a call SwapTurn ld a, DUELVARS_ARENA_CARD call GetTurnDuelistVariable - call GetCardInDeckPosition + call GetCardIDFromDeckIndex ld a, e ld [wTempNonTurnDuelistCardId], a call SwapTurn @@ -3537,7 +3537,7 @@ Func_16f6: ; 16f6 (0:16f6) Func_1730: ; 1730 (0:1730) ld a, [wSelectedMoveIndex] ld [wcc10], a - ldh a, [hTempCardNumber_ff9f] + ldh a, [hTempCardIndex_ff9f] ld [wcc11], a ld a, [wTempCardId] ld [wcc12], a @@ -3698,19 +3698,19 @@ Func_1874: ; 1874 (0:1874) ret nz ld a, [$ffa0] push af - ldh a, [hTempCardNumber_ff9f] + ldh a, [hTempCardIndex_ff9f] push af ld a, $1 ld [wccec], a ld a, [wcc11] - ldh [hTempCardNumber_ff9f], a + ldh [hTempCardIndex_ff9f], a ld a, [wcc10] ld [$ffa0], a ld a, $8 call SetDuelAIAction call Func_0f58 pop af - ldh [hTempCardNumber_ff9f], a + ldh [hTempCardIndex_ff9f], a pop af ld [$ffa0], a ret @@ -3774,10 +3774,10 @@ CheckSelfConfusionDamage: ; 18d7 (0:18d7) INCROM $18f9, $1944 -; this loads HP and Stage (1 byte each) of the card with deck index (0-59) at hTempCardNumber_ff9f +; this loads HP and Stage (1 byte each) of the card with deck index (0-59) at hTempCardIndex_ff9f ; into wLoadedMoveEffectCommands Func_1944: ; 1944 (0:1944) - ldh a, [hTempCardNumber_ff9f] + ldh a, [hTempCardIndex_ff9f] call LoadDeckCardToBuffer1 ld hl, wLoadedCard1HP ld de, wLoadedMoveEffectCommands @@ -7565,7 +7565,7 @@ Func_3525: ; 3525 (0:3525) call GetTurnDuelistVariable cp $ff jr z, .asm_3549 - call GetCardInDeckPosition + call GetCardIDFromDeckIndex ld a, [wce7c] cp e jr nz, .asm_3549 @@ -7581,7 +7581,7 @@ Func_3525: ; 3525 (0:3525) ld a, [hli] cp $ff jr z, .asm_3560 - call GetCardInDeckPosition + call GetCardIDFromDeckIndex ld a, [wce7c] cp e jr nz, .asm_355d @@ -7752,7 +7752,7 @@ Func_36f7: ; 36f7 (0:36f7) ld a, e add DUELVARS_ARENA_CARD call GetTurnDuelistVariable - call GetCardInDeckPosition + call GetCardIDFromDeckIndex call Func_2f32 cp $10 jr nz, .asm_3715 @@ -7807,7 +7807,7 @@ Func_374a: ; 374a (0:374a) HandleEnergyBurn: ; 375d (0:375d) ld a, DUELVARS_ARENA_CARD call GetTurnDuelistVariable - call GetCardInDeckPosition + call GetCardIDFromDeckIndex ld a, e cp CHARIZARD ret nz diff --git a/src/hram.asm b/src/hram.asm index 56837e7..e4ac7bc 100644 --- a/src/hram.asm +++ b/src/hram.asm @@ -45,8 +45,8 @@ hWY:: ; ff95 hWhoseTurn:: ; ff97 ds 1 -; deck position (index) of a card (0-59) -hTempCardNumber_ff98:: ; ff98 +; deck index of a card (0-59) +hTempCardIndex_ff98:: ; ff98 ds 1 ds 4 @@ -58,7 +58,7 @@ hTempPlayAreaLocationOffset_ff9d:: ; ff9d hAIActionTableIndex:: ; ff9e ds 1 -hTempCardNumber_ff9f:: ; ff9f +hTempCardIndex_ff9f:: ; ff9f ds 1 ds 1 diff --git a/src/wram.asm b/src/wram.asm index 82f4ab8..c97e1a8 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -13,8 +13,15 @@ wTempCardCollection:: ; c000 SECTION "WRAM Duels 1", WRAM0 ; In order to be identified during a duel, the 60 cards of each duelist are given an index between 0 and 59. -; These indexes are assigned following the internal order (id) of the cards that make up the deck. -; This temporary index identifies the card during the current duel and within the duelist's deck. +; These indexes are assigned following the order of the card list in wPlayerDeck or wOpponentDeck, +; which, in turn, follows the internal order of the cards. +; This temporary index of a card identifies the card within the duelist's deck during an ongoing duel. + +; Terminology used in labels and comments: +; - The deck index, or the index within the deck of a card refers to the identifier mentioned just above, +; that is, its temporary position in the wPlayerDeck or wOpponentDeck during the current duel. +; - The card ID is its actual internal identifier, that is, its number from card_constants.asm. + wPlayerDuelVariables:: ; c200 ; 60-byte array that indicates where each of the 60 cards is. |