diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/constants/deck_constants.asm | 114 | ||||
-rw-r--r-- | src/engine/bank3.asm | 6 | ||||
-rw-r--r-- | src/engine/home.asm | 8 | ||||
-rw-r--r-- | src/macros.asm | 1 | ||||
-rw-r--r-- | src/macros/code.asm | 32 | ||||
-rw-r--r-- | src/macros/constants.asm | 19 | ||||
-rw-r--r-- | src/macros/data.asm | 19 | ||||
-rw-r--r-- | src/wram.asm | 5 |
8 files changed, 107 insertions, 97 deletions
diff --git a/src/constants/deck_constants.asm b/src/constants/deck_constants.asm index d6e5b1a..6b16d63 100644 --- a/src/constants/deck_constants.asm +++ b/src/constants/deck_constants.asm @@ -1,57 +1,61 @@ +; Both *_DECK and *_DECK_ID constants are defined here. +; *_DECK constants are to be used with LoadDeck and related routines. +; *_DECK_ID constants are specific to be loaded into wOpponentDeckID. +; Always, *_DECK_ID = *_DECK - 2. UNNAMED_DECK_ID and UNNAMED_2_DECK_ID do not exist. const_def - const UNNAMED_DECK ; $00 - const UNNAMED_DECK_2 ; $01 - const SAMS_PRACTICE_DECK ; $02 - const PRACTICE_PLAYER_DECK ; $03 - const SAMS_NORMAL_DECK ; $04 - const CHARMANDER_AND_FRIENDS_DECK ; $05 - const CHARMANDER_EXTRA_DECK ; $06 - const SQUIRTLE_AND_FRIENDS_DECK ; $07 - const SQUIRTLE_EXTRA_DECK ; $08 - const BULBASAUR_AND_FRIENDS_DECK ; $09 - const BULBASAUR_EXTRA_DECK ; $0A - const LIGHTNING_AND_FIRE_DECK ; $0B - const WATER_AND_FIGHTING_DECK ; $0C - const GRASS_AND_PSYCHIC_DECK ; $0D - const LEGENDARY_MOLTRES_DECK ; $0E - const LEGENDARY_ZAPDOS_DECK ; $0F - const LEGENDARY_ARTICUNO_DECK ; $10 - const LEGENDARY_DRAGONITE_DECK ; $11 - const FIRST_STRIKE_DECK ; $12 - const ROCK_CRUSHER_DECK ; $13 - const GO_GO_RAIN_DANCE_DECK ; $14 - const ZAPPING_SELFDESTRUCT_DECK ; $15 - const FLOWER_POWER_DECK ; $16 - const STRANGE_PSYSHOCK_DECK ; $17 - const WONDERS_OF_SCIENCE_DECK ; $18 - const FIRE_CHARGE_DECK ; $19 - const IM_RONALD_DECK ; $1A - const POWERFUL_RONALD_DECK ; $1B - const INVINCIBLE_RONALD_DECK ; $1C - const LEGENDARY_RONALD_DECK ; $1D - const MUSCLES_FOR_BRAINS_DECK ; $1E - const HEATED_BATTLE_DECK ; $1F - const LOVE_TO_BATTLE_DECK ; $20 - const EXCAVATION_DECK ; $21 - const BLISTERING_POKEMON_DECK ; $22 - const HARD_POKEMON_DECK ; $23 - const WATERFRONT_POKEMON_DECK ; $24 - const LONELY_FRIENDS_DECK ; $25 - const SOUND_OF_THE_WAVES_DECK ; $26 - const PIKACHU_DECK ; $27 - const BOOM_BOOM_SELFDESTRUCT_DECK ; $28 - const POWER_GENERATOR_DECK ; $29 - const ETCETERA_DECK ; $2A - const FLOWER_GARDEN_DECK ; $2B - const KALEIDOSCOPE_DECK ; $2C - const GHOST_DECK ; $2D - const NAP_TIME_DECK ; $2E - const STRANGE_POWER_DECK ; $2F - const FLYIN_POKEMON_DECK ; $30 - const LOVELY_NIDORAN_DECK ; $31 - const POISON_DECK ; $32 - const ANGER_DECK ; $33 - const FLAMETHROWER_DECK ; $34 - const RESHUFFLE_DECK ; $35 - const IMAKUNI_DECK ; $36 + deck_const UNNAMED_DECK ; $00 + deck_const UNNAMED_2_DECK ; $01 + deck_const SAMS_PRACTICE_DECK ; $02 + deck_const PRACTICE_PLAYER_DECK ; $03 + deck_const SAMS_NORMAL_DECK ; $04 + deck_const CHARMANDER_AND_FRIENDS_DECK ; $05 + deck_const CHARMANDER_EXTRA_DECK ; $06 + deck_const SQUIRTLE_AND_FRIENDS_DECK ; $07 + deck_const SQUIRTLE_EXTRA_DECK ; $08 + deck_const BULBASAUR_AND_FRIENDS_DECK ; $09 + deck_const BULBASAUR_EXTRA_DECK ; $0A + deck_const LIGHTNING_AND_FIRE_DECK ; $0B + deck_const WATER_AND_FIGHTING_DECK ; $0C + deck_const GRASS_AND_PSYCHIC_DECK ; $0D + deck_const LEGENDARY_MOLTRES_DECK ; $0E + deck_const LEGENDARY_ZAPDOS_DECK ; $0F + deck_const LEGENDARY_ARTICUNO_DECK ; $10 + deck_const LEGENDARY_DRAGONITE_DECK ; $11 + deck_const FIRST_STRIKE_DECK ; $12 + deck_const ROCK_CRUSHER_DECK ; $13 + deck_const GO_GO_RAIN_DANCE_DECK ; $14 + deck_const ZAPPING_SELFDESTRUCT_DECK ; $15 + deck_const FLOWER_POWER_DECK ; $16 + deck_const STRANGE_PSYSHOCK_DECK ; $17 + deck_const WONDERS_OF_SCIENCE_DECK ; $18 + deck_const FIRE_CHARGE_DECK ; $19 + deck_const IM_RONALD_DECK ; $1A + deck_const POWERFUL_RONALD_DECK ; $1B + deck_const INVINCIBLE_RONALD_DECK ; $1C + deck_const LEGENDARY_RONALD_DECK ; $1D + deck_const MUSCLES_FOR_BRAINS_DECK ; $1E + deck_const HEATED_BATTLE_DECK ; $1F + deck_const LOVE_TO_BATTLE_DECK ; $20 + deck_const EXCAVATION_DECK ; $21 + deck_const BLISTERING_POKEMON_DECK ; $22 + deck_const HARD_POKEMON_DECK ; $23 + deck_const WATERFRONT_POKEMON_DECK ; $24 + deck_const LONELY_FRIENDS_DECK ; $25 + deck_const SOUND_OF_THE_WAVES_DECK ; $26 + deck_const PIKACHU_DECK ; $27 + deck_const BOOM_BOOM_SELFDESTRUCT_DECK ; $28 + deck_const POWER_GENERATOR_DECK ; $29 + deck_const ETCETERA_DECK ; $2A + deck_const FLOWER_GARDEN_DECK ; $2B + deck_const KALEIDOSCOPE_DECK ; $2C + deck_const GHOST_DECK ; $2D + deck_const NAP_TIME_DECK ; $2E + deck_const STRANGE_POWER_DECK ; $2F + deck_const FLYIN_POKEMON_DECK ; $30 + deck_const LOVELY_NIDORAN_DECK ; $31 + deck_const POISON_DECK ; $32 + deck_const ANGER_DECK ; $33 + deck_const FLAMETHROWER_DECK ; $34 + deck_const RESHUFFLE_DECK ; $35 + deck_const IMAKUNI_DECK ; $36 DECKS_END EQU const_value + -1 diff --git a/src/engine/bank3.asm b/src/engine/bank3.asm index 1df0b19..e53fc38 100644 --- a/src/engine/bank3.asm +++ b/src/engine/bank3.asm @@ -1733,7 +1733,7 @@ OWScript_AskQuestionJump: ; cce9 (3:4ce9) .asm_ccfe jp IncreaseOWScriptPointerBy5 -; args - prize cards, deck index - 2, duel theme index +; args - prize cards, deck id, duel theme index ; sets a battle up, doesn't start until we break out of the script system. OWScript_StartBattle: ; cd01 (3:4d01) call Func_cd66 @@ -3018,7 +3018,7 @@ OWSequence_Sara: ; e177 (3:6177) tx Text042f run_script OWScript_StartBattle db 2 - db WATERFRONT_POKEMON_DECK - 2 ; 6189 + db WATERFRONT_POKEMON_DECK_ID ; 6189 db MUSIC_DUEL_THEME_1 run_script OWScript_EndScriptCloseText @@ -3056,7 +3056,7 @@ OWSequence_Amanda: ; e19e (03:619e) tx Text0436 run_script OWScript_StartBattle db 03 - db LONELY_FRIENDS_DECK - 2 + db LONELY_FRIENDS_DECK_ID db MUSIC_DUEL_THEME_1 run_script OWScript_EndScriptCloseText diff --git a/src/engine/home.asm b/src/engine/home.asm index c416abe..240d016 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -7206,9 +7206,9 @@ LoadOpponentDeck: ; 2b78 (0:2b78) xor a ld [wIsPracticeDuel], a ld a, [wOpponentDeckID] - cp SAMS_NORMAL_DECK - 2 + cp SAMS_NORMAL_DECK_ID jr z, .normal_sam_duel - or a ; cp SAMS_PRACTICE_DECK - 2 + or a ; cp SAMS_PRACTICE_DECK_ID jr nz, .not_practice_duel ; only practice duels will display help messages, but @@ -7233,12 +7233,12 @@ LoadOpponentDeck: ; 2b78 (0:2b78) .not_practice_duel inc a - inc a + inc a ; convert from *_DECK_ID constant read from wOpponentDeckID to *_DECK constant call LoadDeck ld a, [wOpponentDeckID] cp DECKS_END jr c, .valid_deck - ld a, PRACTICE_PLAYER_DECK - 2 + ld a, PRACTICE_PLAYER_DECK_ID ld [wOpponentDeckID], a .valid_deck diff --git a/src/macros.asm b/src/macros.asm index 837bfb2..7425977 100644 --- a/src/macros.asm +++ b/src/macros.asm @@ -1,5 +1,6 @@ INCLUDE "macros/audio.asm" INCLUDE "macros/code.asm" +INCLUDE "macros/constants.asm" INCLUDE "macros/data.asm" INCLUDE "macros/scripts.asm" INCLUDE "macros/wram.asm" diff --git a/src/macros/code.asm b/src/macros/code.asm index 276bd6a..9e8a4ce 100644 --- a/src/macros/code.asm +++ b/src/macros/code.asm @@ -1,20 +1,3 @@ -INCROM: MACRO -INCBIN "baserom.gbc", \1, \2 - \1 -ENDM - -const_def: MACRO -if _NARG > 0 -const_value = \1 -else -const_value = 0 -endc -ENDM - -const: MACRO -\1 EQU const_value -const_value = const_value + 1 -ENDM - lb: MACRO ; r, hi, lo ld \1, (\2) << 8 + ((\3) & $ff) ENDM @@ -39,19 +22,6 @@ else endc ENDM -; the rst $38 handler is a single ret +; the rst $38 handler is a single ret instruction ; probably used for testing purposes during development debug_ret EQUS "rst $38" - -emptybank: MACRO - rept $4000 - db $ff - endr -ENDM - -textpointer: MACRO - dw ((\1 + ($4000 * (BANK(\1) - 1))) - (TextOffsets + ($4000 * (BANK(TextOffsets) - 1)))) & $ffff - db ((\1 + ($4000 * (BANK(\1) - 1))) - (TextOffsets + ($4000 * (BANK(TextOffsets) - 1)))) >> 16 - const \1_ -GLOBAL \1_ -ENDM diff --git a/src/macros/constants.asm b/src/macros/constants.asm new file mode 100644 index 0000000..3fffd10 --- /dev/null +++ b/src/macros/constants.asm @@ -0,0 +1,19 @@ +const_def: MACRO +if _NARG > 0 +const_value = \1 +else +const_value = 0 +endc +ENDM + +const: MACRO +\1 EQU const_value +const_value = const_value + 1 +ENDM + +deck_const: MACRO +if const_value > 1 +\1_ID EQU const_value + -2 +endc + const \1 +ENDM diff --git a/src/macros/data.asm b/src/macros/data.asm index 2fd4b7d..80978b7 100644 --- a/src/macros/data.asm +++ b/src/macros/data.asm @@ -1,3 +1,7 @@ +INCROM: MACRO +INCBIN "baserom.gbc", \1, \2 - \1 +ENDM + dn: MACRO db \1 << 4 | \2 ENDM @@ -40,7 +44,20 @@ rgb: MACRO dw (\3 << 10 | \2 << 5 | \1) ENDM -; macros used in data/cards.asm, but might be useful elsewhere eventually +emptybank: MACRO + rept $4000 + db $ff + endr +ENDM + +; poketcg specific macros below + +textpointer: MACRO + dw ((\1 + ($4000 * (BANK(\1) - 1))) - (TextOffsets + ($4000 * (BANK(TextOffsets) - 1)))) & $ffff + db ((\1 + ($4000 * (BANK(\1) - 1))) - (TextOffsets + ($4000 * (BANK(TextOffsets) - 1)))) >> 16 + const \1_ +GLOBAL \1_ +ENDM energy: MACRO en = 0 diff --git a/src/wram.asm b/src/wram.asm index d957273..84cd374 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -732,9 +732,8 @@ wcc0c:: ; cc0c wDuelistType:: ; cc0d ds $1 -; this seems to hold the current opponent's deck id - 2, -; perhaps to account for the two unused pointers at the -; beginning of DeckPointers +; this holds the current opponent's deck minus 2 (that is, a *_DECK_ID constant), +; perhaps to account for the two unused pointers at the beginning of DeckPointers. wOpponentDeckID:: ; cc0e ds $1 |