diff options
author | xCrystal <rgr.crystal@gmail.com> | 2018-02-23 18:23:30 +0100 |
---|---|---|
committer | xCrystal <rgr.crystal@gmail.com> | 2018-02-23 18:23:30 +0100 |
commit | 4ab687caf426041e6e5b79093eff9f1b805bf4d5 (patch) | |
tree | 34650a4a31a27a460984b4303c4a28f24b6ab95d | |
parent | 0e0e574c821606bee1014329852b2f4eea150103 (diff) |
more duel home disassembly
-rw-r--r-- | src/constants/duel_constants.asm | 14 | ||||
-rw-r--r-- | src/engine/bank1.asm | 6 | ||||
-rw-r--r-- | src/engine/effect_functions.asm | 4 | ||||
-rw-r--r-- | src/engine/home.asm | 327 | ||||
-rw-r--r-- | src/hram.asm | 2 | ||||
-rw-r--r-- | src/macros/wram.asm | 68 | ||||
-rw-r--r-- | src/text/text1.asm | 6 | ||||
-rw-r--r-- | src/text/text_offsets.asm | 6 | ||||
-rw-r--r-- | src/wram.asm | 39 |
9 files changed, 376 insertions, 96 deletions
diff --git a/src/constants/duel_constants.asm b/src/constants/duel_constants.asm index ebbb4c9..3b4b4e7 100644 --- a/src/constants/duel_constants.asm +++ b/src/constants/duel_constants.asm @@ -35,6 +35,12 @@ DUELVARS_BENCH2_CARD_HP EQUS "LOW(wPlayerBench2CardHP)" DUELVARS_BENCH3_CARD_HP EQUS "LOW(wPlayerBench3CardHP)" ; cb DUELVARS_BENCH4_CARD_HP EQUS "LOW(wPlayerBench4CardHP)" ; cc DUELVARS_BENCH5_CARD_HP EQUS "LOW(wPlayerBench5CardHP)" ; cd +DUELVARS_ARENA_CARD_STAGE EQUS "LOW(wPlayerArenaCardStage)" ; ce +DUELVARS_BENCH1_CARD_STAGE EQUS "LOW(wPlayerBench1CardStage)" ; cf +DUELVARS_BENCH2_CARD_STAGE EQUS "LOW(wPlayerBench2CardStage)" ; d0 +DUELVARS_BENCH3_CARD_STAGE EQUS "LOW(wPlayerBench3CardStage)" ; d1 +DUELVARS_BENCH4_CARD_STAGE EQUS "LOW(wPlayerBench4CardStage)" ; d2 +DUELVARS_BENCH5_CARD_STAGE EQUS "LOW(wPlayerBench5CardStage)" ; d3 DUELVARS_ARENA_CARD_CHANGED_TYPE EQUS "LOW(wPlayerArenaCardChangedType)" ; d4 DUELVARS_BENCH1_CARD_CHANGED_TYPE EQUS "LOW(wPlayerBench1CardChangedType)" ; d5 DUELVARS_BENCH2_CARD_CHANGED_TYPE EQUS "LOW(wPlayerBench2CardChangedType)" ; d6 @@ -72,6 +78,14 @@ CARD_LOCATION_PLAY_AREA EQU 1 << CARD_LOCATION_PLAY_AREA_F CARD_LOCATION_JUST_DRAWN_F EQU 6 CARD_LOCATION_JUST_DRAWN EQU 1 << CARD_LOCATION_JUST_DRAWN_F +; play area location offsets (CARD_LOCATION_* - CARD_LOCATION_PLAY_AREA) +PLAY_AREA_ARENA EQU $0 +PLAY_AREA_BENCH_1 EQU $1 +PLAY_AREA_BENCH_2 EQU $2 +PLAY_AREA_BENCH_3 EQU $3 +PLAY_AREA_BENCH_4 EQU $4 +PLAY_AREA_BENCH_5 EQU $5 + ; duelist types (DUELVARS_DUELIST_TYPE) DUELIST_TYPE_PLAYER EQU $00 DUELIST_TYPE_LINK_OPP EQU $01 diff --git a/src/engine/bank1.asm b/src/engine/bank1.asm index 76113d8..79a242d 100644 --- a/src/engine/bank1.asm +++ b/src/engine/bank1.asm @@ -87,7 +87,7 @@ StartDuel: ; 409f (1:409f) ld a, DUELIST_TYPE_PLAYER ld [wPlayerDuelistType], a ld a, [wcc19] - ld [wOpponentDeckId], a + ld [wOpponentDeckID], a call LoadPlayerDeck call SwapTurn call LoadOpponentDeck @@ -1512,14 +1512,14 @@ _TossCoin: ; 71ad (1:71ad) ld de, $010e ld a, $13 call Func_22a6 - ld hl, wCoinTossScreenTextId + ld hl, wCoinTossScreenTextID ld a, [hli] ld h, [hl] ld l, a call PrintText .asm_71ec - ld hl, wCoinTossScreenTextId + ld hl, wCoinTossScreenTextID xor a ld [hli], a ld [hl], a diff --git a/src/engine/effect_functions.asm b/src/engine/effect_functions.asm index 45aad3b..aeb35a8 100644 --- a/src/engine/effect_functions.asm +++ b/src/engine/effect_functions.asm @@ -39,7 +39,7 @@ ApplyStatusEffect: ld hl, wcc05 cp [hl] jr nz, .can_induce_status - ld a, [wTempNonTurnDuelistCardId] + ld a, [wTempNonTurnDuelistCardID] cp CLEFAIRY_DOLL jr z, .cant_induce_status cp MYSTERIOUS_FOSSIL @@ -296,7 +296,7 @@ KakunaPoisonPowder_AIEffect: ; 2c7b4 (b:47b4) INCROM $2c7bc, $2c7d0 SwordsDanceEffect: ; 2c7d0 (b:47d0) - ld a, [wTempTurnDuelistCardId] + ld a, [wTempTurnDuelistCardID] cp SCYTHER ret nz ld a, SUBSTATUS1_NEXT_TURN_DOUBLE_DAMAGE diff --git a/src/engine/home.asm b/src/engine/home.asm index efacd4c..2365c52 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -2629,22 +2629,22 @@ Func_100b: ; 100b (0:100b) call GetTurnDuelistVariable call GetCardIDFromDeckIndex ld a, e - ld [wTempTurnDuelistCardId], a + ld [wTempTurnDuelistCardID], a call SwapTurn ld a, DUELVARS_ARENA_CARD call GetTurnDuelistVariable call GetCardIDFromDeckIndex ld a, e - ld [wTempNonTurnDuelistCardId], a + ld [wTempNonTurnDuelistCardID], a call SwapTurn pop hl push hl call EnableSRAM ld a, [wDuelTurns] ld [hli], a - ld a, [wTempNonTurnDuelistCardId] + ld a, [wTempNonTurnDuelistCardID] ld [hli], a - ld a, [wTempTurnDuelistCardId] + ld a, [wTempTurnDuelistCardID] ld [hli], a pop hl ld de, $0010 @@ -2896,6 +2896,10 @@ MoveHandCardToDiscardPile: ; 1160 (0:1160) ret nz ; return if card not in hand ld a, l call RemoveCardFromHand +; fallthrough + +; puts the card with the deck index (0-59) given in a into the discard pile +PutCardInDiscardPile: ; 116a (0:116a) push af push hl push de @@ -3370,11 +3374,11 @@ PutHandPokemonCardInPlayArea: ; 1485 (0:1485) add e ld l, a ld [hl], $0 - ld a, $ce + ld a, DUELVARS_ARENA_CARD_STAGE add e ld l, a ld a, [wLoadedCard2Stage] - ld [hl], a + ld [hl], a ; set card's evolution stage ld a, e or a call z, ResetStatusConditions ; only call if Pokemon is being place in the arena @@ -3392,7 +3396,7 @@ PutHandPokemonCardInPlayArea: ; 1485 (0:1485) ; DUELVARS_ARENA_CARD or DUELVARS_BENCH aren't affected, this function is meant for energy and trainer cards. ; input: ; - a = deck index of the card -; - e = play area location offset +; - e = play area location offset (PLAY_AREA_*) ; returns ; - a = CARD_LOCATION_PLAY_AREA + e PutHandCardInPlayArea: ; 14d2 (0:14d2) @@ -3404,7 +3408,161 @@ PutHandCardInPlayArea: ; 14d2 (0:14d2) ret ; 0x14dd - INCROM $14dd, $159f +; move the play area Pokemon card of the turn holder at CARD_LOCATION_PLAY_AREA + a +; to the discard pile +MovePlayAreaCardToDiscardPile: ; 14dd (0:14dd) + call EmptyPlayAreaSlot + ld l, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY + dec [hl] + ld l, LOW(DUELVARS_CARD_LOCATIONS) +.next_card + ld a, e + or CARD_LOCATION_PLAY_AREA + cp [hl] + jr nz, .not_in_location + push de + ld a, l + call PutCardInDiscardPile + pop de +.not_in_location + inc l + ld a, l + cp DECK_SIZE + jr c, .next_card + ret +; 0x14f8 + +; init a turn holder's play area slot to empty +; which slot (arena or benchx) is determined by the play area location offset (PLAY_AREA_*) in e +EmptyPlayAreaSlot: ; 14f8 (0:14f8) + ldh a, [hWhoseTurn] + ld h, a + ld d, -1 + ld a, DUELVARS_ARENA_CARD + call .init_duelvar + ld d, 0 + ld a, DUELVARS_ARENA_CARD_HP + call .init_duelvar + ld a, DUELVARS_ARENA_CARD_STAGE + call .init_duelvar + ld a, DUELVARS_ARENA_CARD_CHANGED_TYPE + call .init_duelvar + ld a, $da + call .init_duelvar + ld a, $e0 +.init_duelvar + add e + ld l, a + ld [hl], d + ret +; 0x151e + +; shift play area Pokemon of both players to the first available play area (arena + benchx) slots +ShiftAllPokemonToFirstPlayAreaSlots: ; 151e (0:151e) + call ShiftTurnPokemonToFirstPlayAreaSlots + call SwapTurn + call ShiftTurnPokemonToFirstPlayAreaSlots + call SwapTurn + ret +; 0x152b + +; shift play area Pokemon of the turn holder to the first available play area (arena + benchx) slots +ShiftTurnPokemonToFirstPlayAreaSlots: ; 152b (0:152b) + ld a, DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + lb de, PLAY_AREA_ARENA, PLAY_AREA_ARENA +.next_play_area_slot + bit 7, [hl] + jr nz, .empty_slot + call SwapPlayAreaPokemon + inc e +.empty_slot + inc hl + inc d + ld a, d + cp MAX_PLAY_AREA_POKEMON + jr nz, .next_play_area_slot + ret +; 0x1543 + +; swap the data of the turn holder's arena Pokemon card with the +; data of the turn holder's Pokemon card in play area e. +; reset the status and all substatuses of the arena Pokemon before swapping. +; e is the play area location offset of the bench Pokemon (PLAY_AREA_*). +SwapArenaWithBenchPokemon: ; 1543 (0:1543) + call ResetStatusConditions + ld d, PLAY_AREA_ARENA +; fallthrough + +; swap the data of the turn holder's Pokemon card in play area d with the +; data of the turn holder's Pokemon card in play area e. +; d and e are play area location offsets (PLAY_AREA_*). +SwapPlayAreaPokemon: ; 1548 (0:1548) + push bc + push de + push hl + ld a, e + cp d + jr z, .done + ldh a, [hWhoseTurn] + ld h, a + ld b, a + ld a, DUELVARS_ARENA_CARD + call .swap_duelvar + ld a, DUELVARS_ARENA_CARD_HP + call .swap_duelvar + ld a, $c2 + call .swap_duelvar + ld a, DUELVARS_ARENA_CARD_STAGE + call .swap_duelvar + ld a, DUELVARS_ARENA_CARD_CHANGED_TYPE + call .swap_duelvar + ld a, $e0 + call .swap_duelvar + ld a, $da + call .swap_duelvar + set CARD_LOCATION_PLAY_AREA_F, d + set CARD_LOCATION_PLAY_AREA_F, e + ld l, DUELVARS_CARD_LOCATIONS +.update_card_locations_loop + ; update card locations of the two swapped cards + ld a, [hl] + cp e + jr nz, .next1 + ld a, d + jr .update_location +.next1 + cp d + jr nz, .next2 + ld a, e +.update_location + ld [hl], a +.next2 + inc l + ld a, l + cp DECK_SIZE + jr c, .update_card_locations_loop +.done + pop hl + pop de + pop bc + ret + +.swap_duelvar + ld c, a + add e ; play area location offset of card 1 + ld l, a + ld a, c + add d ; play area location offset of card 2 + ld c, a + ld a, [bc] + push af + ld a, [hl] + ld [bc], a + pop af + ld [hl], a + ret +; 0x159f ; Find which and how many energy cards are attached to the Pokemon card in the arena, ; or to a Pokemon card in the bench, depending on the value of register e. @@ -3482,7 +3640,7 @@ GetAttachedEnergies: ; 159f (0:159f) ; h = PLAYER_TURN or OPPONENT_TURN CountCardIDInLocation: ; 15ef (0:15ef) push bc - ld l, $0 + ld l, LOW(DUELVARS_CARD_LOCATIONS) ld c, $0 .next_card ld a, [hl] @@ -3527,7 +3685,91 @@ GetNonTurnDuelistVariable: ; 1611 (0:1611) ret ; 0x161e - INCROM $161e, $16c0 +Func_161e: ; 161e (0:161e) + ldh a, [hTempCardIndex_ff98] + call ClearChangedTypesIfMuk + ldh a, [hTempCardIndex_ff98] + ld d, a + ld e, $00 + call CopyMoveDataAndDamage + call Func_16f6 + ldh a, [hTempCardIndex_ff98] + ldh [hTempCardIndex_ff9f], a + call GetCardIDFromDeckIndex + ld a, e + ld [wTempTurnDuelistCardID], a + ld a, [wLoadedMoveCategory] + cp POKEMON_POWER + ret nz + call $6510 + ldh a, [hTempCardIndex_ff98] + call LoadDeckCardToBuffer1 + ld hl, wLoadedCard1Name + ld a, [hli] + ld h, [hl] + ld l, a + call Func_2ebb + ldtx hl, HavePokemonPowerText + call DrawWideTextBox_WaitForInput + call Func_0f58 + ld a, [wLoadedCard1ID] + cp MUK + jr z, .use_pokemon_power + ld a, $01 ; check only Muk + call CheckIfUnderAnyCannotUseStatus2 + jr nc, .use_pokemon_power + call $6510 + ldtx hl, UnableToUsePkmnPowerDueToToxicGasText + call DrawWideTextBox_WaitForInput + call Func_0f58 + ret + +.use_pokemon_power + ld hl, wLoadedMoveEffectCommands + ld a, [hli] + ld h, [hl] + ld l, a + ld a, $07 + call CheckMatchingCommand + ret c ; return if command not found + bank1call $4f9d + ldh a, [hTempCardIndex_ff9f] + call LoadDeckCardToBuffer1 + ld de, wLoadedCard1Name + ld hl, wce3f + ld a, [de] + inc de + ld [hli], a + ld a, [de] + ld [hli], a + ld de, wLoadedMoveName + ld a, [de] + inc de + ld [hli], a + ld a, [de] + ld [hl], a + ldtx hl, WillUseThePokemonPowerText + call DrawWideTextBox_WaitForInput + call Func_0f58 + call $7415 + ld a, $07 + call TryExecuteEffectCommandFunction + ret +; 0x16ad + +Func_16ad: ; 16ad (0:16ad) + push de + push af + ld a, e + ld [wSelectedMoveIndex], a + ld a, d + ldh [hTempCardIndex_ff9f], a + pop af + ld e, a + ld d, $00 + call LoadCardDataToBuffer1 + pop de + jr CopyMoveDataAndDamage.card_loaded ; copies from card identified by register d (0-59 deck index): ; - Move1 (if e == 0) or Move2 (if e == 1) data into wLoadedMove @@ -3538,8 +3780,9 @@ CopyMoveDataAndDamage: ; 16c0 (0:16c0) ld a, d ldh [hTempCardIndex_ff9f], a call LoadDeckCardToBuffer1 +.card_loaded ld a, [wLoadedCard1ID] - ld [wTempCardId], a + ld [wTempCardID_ccc2], a ld hl, wLoadedCard1Move1 dec e jr nz, .got_move @@ -3570,13 +3813,13 @@ Func_16f6: ; 16f6 (0:16f6) ldh [hTempCardIndex_ff9f], a call GetCardIDFromDeckIndex ld a, e - ld [wTempTurnDuelistCardId], a + ld [wTempTurnDuelistCardID], a call SwapTurn ld a, DUELVARS_ARENA_CARD call GetTurnDuelistVariable call GetCardIDFromDeckIndex ld a, e - ld [wTempNonTurnDuelistCardId], a + ld [wTempNonTurnDuelistCardID], a call SwapTurn xor a ld [wccec], a @@ -3594,7 +3837,7 @@ Func_1730: ; 1730 (0:1730) ld [wcc10], a ldh a, [hTempCardIndex_ff9f] ld [wcc11], a - ld a, [wTempCardId] + ld a, [wTempCardID_ccc2] ld [wcc12], a ld a, [wLoadedMoveCategory] cp POKEMON_POWER @@ -3681,12 +3924,12 @@ Func_17ed: ; 17ed (0:17ed) ld a, NO_DAMAGE_OR_EFFECT_AGILITY ld [wNoDamageOrEffect], a Func_17fb: ; 17fb (0:17fb) - ld a, [wTempNonTurnDuelistCardId] + ld a, [wTempNonTurnDuelistCardID] push af ld a, $4 call TryExecuteEffectCommandFunction pop af - ld [wTempNonTurnDuelistCardId], a + ld [wTempNonTurnDuelistCardID], a call HandleStrikesBack bank1call $6df1 call Func_1bb4 @@ -3859,10 +4102,10 @@ Func_195c: ; 195c (0:195c) xor a ld [wNoDamageOrEffect], a bank1call $7415 - ld a, [wTempNonTurnDuelistCardId] + ld a, [wTempNonTurnDuelistCardID] push af - ld a, [wTempTurnDuelistCardId] - ld [wTempNonTurnDuelistCardId], a + ld a, [wTempTurnDuelistCardID] + ld [wTempNonTurnDuelistCardID], a bank1call Func_1a22 ; switch to bank 1, but call a home func ld a, [wccc1] ld c, a @@ -3872,7 +4115,7 @@ Func_195c: ; 195c (0:195c) bank1call $7469 call Func_1ad0 pop af - ld [wTempNonTurnDuelistCardId], a + ld [wTempNonTurnDuelistCardID], a pop af ld [wNoDamageOrEffect], a ret @@ -4062,17 +4305,17 @@ Func_1aac: ; 1aac (0:1aac) call GetTurnDuelistVariable or a ret nz - ld a, [wTempNonTurnDuelistCardId] + ld a, [wTempNonTurnDuelistCardID] push af ld a, e add DUELVARS_ARENA_CARD call GetTurnDuelistVariable call LoadDeckCardToBuffer1 ld a, [wLoadedCard1ID] - ld [wTempNonTurnDuelistCardId], a + ld [wTempNonTurnDuelistCardID], a call Func_1ad3 pop af - ld [wTempNonTurnDuelistCardId], a + ld [wTempNonTurnDuelistCardID], a scf ret @@ -4081,7 +4324,7 @@ Func_1ad0: ; 1ad0 (0:1ad0) or a ret nz Func_1ad3: ; 1ad3 (0:1ad3) - ld a, [wTempNonTurnDuelistCardId] + ld a, [wTempNonTurnDuelistCardID] ld e, a call LoadCardDataToBuffer1 ld hl, $cc27 @@ -4346,7 +4589,7 @@ AddDeckCardsToTempCardCollection: ; 1d59 (0:1d59) add hl, de ld e, l ld d, h - ld h, wTempCardCollection >> 8 + ld h, HIGH(wTempCardCollection) ld c, DECK_SIZE .asm_1d66 ld a, [de] @@ -6088,7 +6331,7 @@ PrintYesOrNoItems: ; 2b66 (0:2b66) LoadOpponentDeck: ; 2b78 (0:2b78) xor a ld [wIsPracticeDuel], a - ld a, [wOpponentDeckId] + ld a, [wOpponentDeckID] cp SAMS_NORMAL_DECK - 2 jr z, .normal_sam_duel or a ; cp SAMS_PRACTICE_DECK - 2 @@ -6102,7 +6345,7 @@ LoadOpponentDeck: ; 2b78 (0:2b78) .normal_sam_duel xor a - ld [wOpponentDeckId], a + ld [wOpponentDeckID], a call SwapTurn ld a, PRACTICE_PLAYER_DECK call LoadDeck @@ -6118,17 +6361,17 @@ LoadOpponentDeck: ; 2b78 (0:2b78) inc a inc a call LoadDeck - ld a, [wOpponentDeckId] + ld a, [wOpponentDeckID] cp DECKS_END jr c, .valid_deck ld a, PRACTICE_PLAYER_DECK - 2 - ld [wOpponentDeckId], a + ld [wOpponentDeckID], a .valid_deck ; set opponent as controlled by AI ld a, DUELVARS_DUELIST_TYPE call GetTurnDuelistVariable - ld a, [wOpponentDeckId] + ld a, [wOpponentDeckID] or DUELIST_TYPE_AI_OPP ld [hl], a ret @@ -6163,7 +6406,7 @@ Func_2bdb: ; 2bdb (0:2bdb) push af ld a, $5 call BankswitchHome - ld a, [wOpponentDeckId] + ld a, [wOpponentDeckID] ld l, a ld h, $0 add hl, hl @@ -6928,7 +7171,7 @@ Func_3061: ; 3061 (0:3061) ; returns: the number of heads in a and in $cd9d, and carry if at least one heads TossCoinATimes: ; 3071 (0:3071) push hl - ld hl, wCoinTossScreenTextId + ld hl, wCoinTossScreenTextID ld [hl], e inc hl ld [hl], d @@ -6942,7 +7185,7 @@ TossCoinATimes: ; 3071 (0:3071) ; - nc, and 0 in a and in $cd9d if tails TossCoin: ; 307d (0:307d) push hl - ld hl, wCoinTossScreenTextId + ld hl, wCoinTossScreenTextID ld [hl], e inc hl ld [hl], d @@ -7316,7 +7559,7 @@ HandleDamageReductionExceptSubstatus2: ; 3269 (0:3269) ld a, [wLoadedMoveCategory] cp POKEMON_POWER ret z - ld a, [wTempNonTurnDuelistCardId] + ld a, [wTempNonTurnDuelistCardID] cp MR_MIME jr z, .prevent_less_than_30_damage ; invisible wall cp KABUTO @@ -7404,7 +7647,7 @@ Func_3317: ; 3317 (0:3317) ld a, [wcce6] or a ret nz - ld a, [wTempNonTurnDuelistCardId] + ld a, [wTempNonTurnDuelistCardID] cp MACHAMP ret nz ld a, MUK @@ -7432,7 +7675,7 @@ Func_3317: ; 3317 (0:3317) ld de, 10 call SubstractHP ld a, [wLoadedCard2ID] - ld [wTempNonTurnDuelistCardId], a + ld [wTempNonTurnDuelistCardID], a ld hl, $a call Func_2ec4 ld hl, wLoadedCard2Name @@ -7602,7 +7845,7 @@ HandleNoDamageOrEffectSubstatus: ; 3432 (0:3432) ccf ret nc .pkmn_power - ld a, [wTempNonTurnDuelistCardId] + ld a, [wTempNonTurnDuelistCardID] cp MEW1 jr z, .neutralizing_shield or a @@ -7617,7 +7860,7 @@ HandleNoDamageOrEffectSubstatus: ; 3432 (0:3432) or a ret nz ; prevent damage if attacked by a non-basic Pokemon - ld a, [wTempTurnDuelistCardId] + ld a, [wTempTurnDuelistCardID] ld e, a ld d, $0 call LoadCardDataToBuffer2 @@ -7632,7 +7875,7 @@ HandleNoDamageOrEffectSubstatus: ; 3432 (0:3432) ; there is a 50% chance that any damage or effect is prevented ; return carry if damage is prevented HandleTransparency: ; 348a (0:348a) - ld a, [wTempNonTurnDuelistCardId] + ld a, [wTempNonTurnDuelistCardID] cp HAUNTER1 jr z, .transparency .done @@ -8001,7 +8244,7 @@ HandleDestinyBondSubstatus: ; 363b (0:363b) ; when Machamp is damaged, if its Strikes Back is active, ; the attacking Pokemon takes 10 damage HandleStrikesBack: ; 367b (0:367b) - ld a, [wTempNonTurnDuelistCardId] + ld a, [wTempNonTurnDuelistCardID] cp MACHAMP jr z, .strikes_back ret @@ -8024,7 +8267,7 @@ HandleStrikesBack: ; 367b (0:367b) ApplyStrikesBack: ; 36a2 (0:36a2) push hl call Func_2ec4 - ld a, [wTempTurnDuelistCardId] + ld a, [wTempTurnDuelistCardID] ld e, a ld d, $0 call LoadCardDataToBuffer2 @@ -8080,7 +8323,7 @@ GetArenaCardColor: ; 36f6 (0:36f6) xor a ; fallthrough -; input: a = play area location offset of the desired card +; input: a = play area location offset (PLAY_AREA_*) of the desired card ; return the card's color in a, accounting for Venomoth's Shift Pokemon Power if active GetPlayAreaCardColor: ; 36f7 (0:36f7) push hl diff --git a/src/hram.asm b/src/hram.asm index 8f4adbb..dc90bd1 100644 --- a/src/hram.asm +++ b/src/hram.asm @@ -52,7 +52,7 @@ hTempCardIndex_ff98:: ; ff98 ds 4 -; 0: arena card ; 1-5: bench card +; a PLAY_AREA_ARENA constant (0: arena card, 1-5: bench card) hTempPlayAreaLocationOffset_ff9d:: ; ff9d ds 1 diff --git a/src/macros/wram.asm b/src/macros/wram.asm index 9825a36..a984255 100644 --- a/src/macros/wram.asm +++ b/src/macros/wram.asm @@ -1,51 +1,51 @@ card_data_struct: MACRO -\1Type:: db -\1Gfx:: dw -\1Name:: dw -\1Rarity:: db -\1Set:: db -\1ID:: db -\1EffectCommands:: ; dw -\1HP:: db -\1Stage:: db -\1NonPokemonDescription:: ; dw -\1PreEvoName:: dw +\1Type:: ds 1 +\1Gfx:: ds 2 +\1Name:: ds 2 +\1Rarity:: ds 1 +\1Set:: ds 1 +\1ID:: ds 1 +\1EffectCommands:: ; ds 2 +\1HP:: ds 1 +\1Stage:: ds 1 +\1NonPokemonDescription:: ; ds 2 +\1PreEvoName:: ds 2 \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 +\1RetreatCost:: ds 1 +\1Weakness:: ds 1 +\1Resistance:: ds 1 +\1Kind:: ds 2 +\1PokedexNumber:: ds 1 +\1Unknown1:: ds 1 +\1Level:: ds 1 +\1Length:: ds 2 +\1Weight:: ds 2 +\1Description:: ds 2 +\1Unknown2:: ds 1 ENDM move_data_struct: MACRO \1Energy:: ds NUM_TYPES / 2 -\1Name:: dw +\1Name:: ds 2 \1Description:: ds 4 -\1Damage:: db -\1Category:: db -\1EffectCommands:: dw -\1Flag1:: db -\1Flag2:: db -\1Flag3:: db -\1Unknown1:: db -\1Animation:: db +\1Damage:: ds 1 +\1Category:: ds 1 +\1EffectCommands:: ds 2 +\1Flag1:: ds 1 +\1Flag2:: ds 1 +\1Flag3:: ds 1 +\1Unknown1:: ds 1 +\1Animation:: ds 1 ENDM ; TODO: Figure out what the rest are for sprite_anim_struct: MACRO \1Field0x00:: ds 1 \1Field0x01:: ds 1 ; movement handling / palette -\1CoordX:: db -\1CoordY:: db -\1TileID:: db +\1CoordX:: ds 1 +\1CoordY:: ds 1 +\1TileID:: ds 1 \1Field0x05:: ds 1 \1Field0x06:: ds 1 \1Field0x07:: ds 1 diff --git a/src/text/text1.asm b/src/text/text1.asm index f21f081..3de6280 100644 --- a/src/text/text1.asm +++ b/src/text/text1.asm @@ -396,7 +396,7 @@ Text005b: ; 36a34 (d:6a34) line "Retreat was unsuccessful." done -Text005c: ; 36a53 (d:6a53) +WillUseThePokemonPowerText: ; 36a53 (d:6a53) text TX_RAM2, " will use the" line "Pok`mon Power ", TX_RAM2, "." done @@ -576,12 +576,12 @@ WasKnockedOutText: ; 36eaa (d:6eaa) line "Knocked Out!" done -Text0082: ; 36ebe (d:6ebe) +HavePokemonPowerText: ; 36ebe (d:6ebe) text TX_RAM2, " have" line "Pok`mon Power." done -Text0083: ; 36ed5 (d:6ed5) +UnableToUsePkmnPowerDueToToxicGasText: ; 36ed5 (d:6ed5) text "Unable to us Pok`mon Power due to" line "the effect of Toxic Gas." done diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index 8afb421..66c7a64 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -93,7 +93,7 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text0059 ; 0x0059 textpointer Text005a ; 0x005a textpointer Text005b ; 0x005b - textpointer Text005c ; 0x005c + textpointer WillUseThePokemonPowerText ; 0x005c textpointer Text005d ; 0x005d textpointer Text005e ; 0x005e textpointer Text005f ; 0x005f @@ -131,8 +131,8 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text007f ; 0x007f textpointer Text0080 ; 0x0080 textpointer WasKnockedOutText ; 0x0081 - textpointer Text0082 ; 0x0082 - textpointer Text0083 ; 0x0083 + textpointer HavePokemonPowerText ; 0x0082 + textpointer UnableToUsePkmnPowerDueToToxicGasText ; 0x0083 textpointer Text0084 ; 0x0084 textpointer Text0085 ; 0x0085 textpointer Text0086 ; 0x0086 diff --git a/src/wram.asm b/src/wram.asm index c55fab3..99dbd6d 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -77,7 +77,18 @@ wPlayerBench4CardHP:: ; c2cc wPlayerBench5CardHP:: ; c2cd ds $1 - ds $6 +wPlayerArenaCardStage:: ; c2ce + ds $1 +wPlayerBench1CardStage:: ; c2cf + ds $1 +wPlayerBench2CardStage:: ; c2d0 + ds $1 +wPlayerBench3CardStage:: ; c2d1 + ds $1 +wPlayerBench4CardStage:: ; c2d2 + ds $1 +wPlayerBench5CardStage:: ; c2d3 + ds $1 ; changed type from Venomoth's Shift Pokemon Power ; if bit 7 == 1, then bits 0-3 override the Pokemon's actual type @@ -179,7 +190,18 @@ wOpponentBench4CardHP:: ; c3cc wOpponentBench5CardHP:: ; c3cd ds $1 - ds $6 +wOpponentArenaCardStage:: ; c3ce + ds $1 +wOpponentBench1CardStage:: ; c3cf + ds $1 +wOpponentBench2CardStage:: ; c3d0 + ds $1 +wOpponentBench3CardStage:: ; c3d1 + ds $1 +wOpponentBench4CardStage:: ; c3d2 + ds $1 +wOpponentBench5CardStage:: ; c3d3 + ds $1 wOpponentArenaCardChangedType:: ; c2d4 ds $1 @@ -477,7 +499,7 @@ wCardPageNumber:: ; cbc7 wcbc9:: ; cbc9 ds $2 -; selected bench slot (1-5) +; selected bench slot (1-5, that is, a PLAY_AREA_BENCH_* constant) wBenchSelectedPokemon:: ; cbcb ds $1 @@ -550,7 +572,7 @@ wDuelistType:: ; cc0d ; this seems to hold the current opponent's deck id - 2, ; perhaps to account for the two unused pointers at the ; beginning of DeckPointers -wOpponentDeckId:: ; cc0e +wOpponentDeckID:: ; cc0e ds $1 ds $1 @@ -622,13 +644,14 @@ wccbf:: ; ccbf wccc1:: ; ccc1 ds $1 -wTempCardId:: ; ccc2 +; used in damage related functions +wTempCardID_ccc2:: ; ccc2 ds $1 -wTempTurnDuelistCardId:: ; ccc3 +wTempTurnDuelistCardID:: ; ccc3 ds $1 -wTempNonTurnDuelistCardId:: ; ccc4 +wTempNonTurnDuelistCardID:: ; ccc4 ds $1 ds $1 @@ -804,7 +827,7 @@ wce4a:: ; ce4a wce4b:: ; ce4b ds $3 -wCoinTossScreenTextId:: ; ce4e +wCoinTossScreenTextID:: ; ce4e ds $2 wce50:: ; ce50 |