From 5b1ee097179b3f9ffcf1e518b0f513ad036f60bd Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 9 Jan 2018 19:15:33 +0100 Subject: CARD_LOCATION_JUST_DRAWN constant --- src/engine/bank1.asm | 2 +- src/engine/home.asm | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'src/engine') diff --git a/src/engine/bank1.asm b/src/engine/bank1.asm index 1008822..3a3c6d6 100755 --- a/src/engine/bank1.asm +++ b/src/engine/bank1.asm @@ -245,7 +245,7 @@ HandleTurn: ; 4225 (1:4225) .asm_4237 call $70e6 call $4933 - call _DrawCardFromDeck + call DrawCardFromDeck jr nc, .deckNotEmpty ld a, DUEL_LOST ld [wDuelFinished], a diff --git a/src/engine/home.asm b/src/engine/home.asm index c47a7a2..e293c96 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -2323,15 +2323,14 @@ ShuffleDeck: ; 10bc (0:10bc) ld b, a 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 l, a ; hl = position of the first (top) deck card in the wPlayerDeckCards or wOpponentDeckCards array ld a, b ; a = number of cards in the deck call ShuffleCards ret ; draw a card from the deck, saving its location as $40 ; returns c if deck is empty, nc if a card was succesfully drawn -_DrawCardFromDeck: ; 10cf (0:10cf) +DrawCardFromDeck: ; 10cf (0:10cf) push hl ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK call GetTurnDuelistVariable @@ -2343,7 +2342,7 @@ _DrawCardFromDeck: ; 10cf (0:10cf) ld l, a ld a, [hl] ; grab card number (0-59) from wPlayerDeckCards or wOpponentDeckCards array ld l, a - ld [hl], $40 ; temporarily write $40 to corresponding card location variable + ld [hl], CARD_LOCATION_JUST_DRAWN ; temporarily write $40 to corresponding card location variable pop hl or a ret @@ -2366,8 +2365,8 @@ AddCardToHand: ; 1123 (0:1123) ld l, a ldh a, [hWhoseTurn] ld h, a - ; write $1 (hand) into the location of this card - ld [hl], $1 + ; write $1 (CARD_LOCATION_HAND) into the location of this card + ld [hl], CARD_LOCATION_HAND ; increment number of cards in hand ld l, DUELVARS_NUMBER_OF_CARDS_IN_HAND inc [hl] -- cgit v1.2.3 From 866f59ee7186488770d2f712212437645a9a16c1 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 9 Jan 2018 21:30:19 +0100 Subject: Uppercase booster constants --- src/engine/bank3.asm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/engine') diff --git a/src/engine/bank3.asm b/src/engine/bank3.asm index 6fb124e..d1b27f8 100755 --- a/src/engine/bank3.asm +++ b/src/engine/bank3.asm @@ -3029,8 +3029,8 @@ OWSequence_BeatSara: ; e18c (3:618c) run_script OWScript_PrintTextString tx Text0430 run_script OWScript_GiveBoosterPacks - db BOOSTER_ColoWater - db BOOSTER_ColoWater + db BOOSTER_COLOSSEUM_WATER + db BOOSTER_COLOSSEUM_WATER db NO_BOOSTER run_script OWScript_PrintTextString tx Text0431 @@ -3067,8 +3067,8 @@ OWSequence_BeatAmanda: ; e1b3 (03:61b3) run_script OWScript_PrintTextString tx Text0437 run_script OWScript_GiveBoosterPacks - db BOOSTER_LightningColorless - db BOOSTER_LightningColorless + db BOOSTER_MYSTERY_LIGHTNING_COLORLESS + db BOOSTER_MYSTERY_LIGHTNING_COLORLESS db NO_BOOSTER run_script OWScript_PrintTextString tx Text0438 -- cgit v1.2.3 From 58c79f38fbce8736dd584853a6e3ad41a6c55c14 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 6 Feb 2018 19:50:40 +0100 Subject: Fix redundant file names in src/data/ --- src/engine/bank4.asm | 2 +- src/engine/bank7.asm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/engine') diff --git a/src/engine/bank4.asm b/src/engine/bank4.asm index 394804f..a69f96e 100755 --- a/src/engine/bank4.asm +++ b/src/engine/bank4.asm @@ -958,7 +958,7 @@ Func_118d3: ; 118d3 (4:58d3) pop hl ret -INCLUDE "data/unknownNPCData.asm" +INCLUDE "data/npcs.asm" INCBIN "baserom.gbc",$11f4e,$1217b - $11f4e diff --git a/src/engine/bank7.asm b/src/engine/bank7.asm index 160092d..c54b16f 100755 --- a/src/engine/bank7.asm +++ b/src/engine/bank7.asm @@ -48,7 +48,7 @@ Func_1c056: ; 1c056 (7:4056) pop hl ret -INCLUDE "data/warp_data.asm" +INCLUDE "data/warps.asm" Func_1c33b: ; 1c33b (7:433b) push hl -- cgit v1.2.3 From 3ac88bbc0fa60934bdba66cd8d802d3f40a5dcc7 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 6 Feb 2018 20:31:34 +0100 Subject: Some home.asm disassembling --- src/engine/bank20.asm | 4 +-- src/engine/home.asm | 81 ++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 75 insertions(+), 10 deletions(-) (limited to 'src/engine') diff --git a/src/engine/bank20.asm b/src/engine/bank20.asm index 0142e93..66d2e63 100755 --- a/src/engine/bank20.asm +++ b/src/engine/bank20.asm @@ -73,7 +73,7 @@ Func_801a1: ; 801a1 (20:41a1) push hl push de ld b, $20 - call $06fc + call SafeCopyData ld a, [wConsole] cp $2 jr nz, .asm_801d6 @@ -85,7 +85,7 @@ Func_801a1: ; 801a1 (20:41a1) add hl, bc call BankswitchVRAM_1 ld b, $20 - call $06fc + call SafeCopyData call BankswitchVRAM_0 .asm_801d6 diff --git a/src/engine/home.asm b/src/engine/home.asm index e293c96..4f3d671 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -825,7 +825,44 @@ CallHL: ; 05c1 (0:05c1) jp hl ; 0x5c2 -INCBIN "baserom.gbc",$05c2,$0663 - $05c2 +Func_5c2: ; 5c2 (0:5c2) + push hl + push bc + push de + ld hl, wcaa0 + push hl + push bc + call Func_0614 + pop bc + call Func_04cf + pop hl + ld b, $02 + call JumpToHblankCopyData + pop de + pop bc + pop hl + ret +; 0x5db + +INCBIN "baserom.gbc",$05db,$0614 - $05db + +Func_0614: ; 614 (0:614) + push af + swap a + call Func_061b + pop af +Func_061b: + and $0f + add $30 + cp $3a + jr c, .asm_625 + add $07 +.asm_625 + ld [hli], a + ret +; 0x627 + +INCBIN "baserom.gbc",$0627,$0663 - $0627 Func_0663: ; 0663 (0:0663) push bc @@ -891,17 +928,31 @@ Func_06c3: ; 06c3 (0:06c3) call Func_04cf pop hl ld b, $1 - call MemcpyHLDE_hblank + call HblankCopyData pop bc pop de pop hl ret ; 0x6ee -INCBIN "baserom.gbc",$06ee,$0709 - $06ee +INCBIN "baserom.gbc",$06ee,$06fc - $06ee -Func_0709: ; 0709 (0:0709) - jp MemcpyHLDE_hblank +; copies b bytes from hl to de +; if LCD on, copy during h-blank only +SafeCopyData: ; 6fc (0:6fc) + ld a, [wLCDC] + rla + jr c, JumpToHblankCopyData +.lcd_off_copy_loop + ld a, [hli] + ld [de], a + inc de + dec b + jr nz, .lcd_off_copy_loop + ret +JumpToHblankCopyData: ; 0709 (0:0709) + jp HblankCopyData +; 0x70c CopyGfxData: ; 070c (0:070c) ld a, [wLCDC] @@ -912,7 +963,7 @@ CopyGfxData: ; 070c (0:070c) push hl push de ld b, c - call Func_0709 + call JumpToHblankCopyData ld b, $0 pop hl add hl, bc @@ -1680,7 +1731,7 @@ Wait: ; 0c08 (0:0c08) ret ; memcpy(DE, HL, B), but only during hblank -MemcpyHLDE_hblank: ; 0c19 (0:0c19) +HblankCopyData: ; 0c19 (0:0c19) push bc .loop ei @@ -2309,7 +2360,21 @@ CopyDeckData: ; 1072 (0:1072) ret ; 0x10aa -INCBIN "baserom.gbc",$10aa,$10bc - $10aa +Func_10aa: ; 10aa (0:10aa) + push hl + ld a, DUELVARS_PRIZES + call GetTurnDuelistVariable + ld l, a + xor a +.asm_10b2 + rr l + adc $00 + inc l + dec l + jr nz, .asm_10b2 + pop hl + ret +; 0x10bc ; shuffles the deck specified by hWhoseTurn ; if less than 60 cards remain in the deck, make sure the rest are ignored -- cgit v1.2.3 From 8bba15573bdc7cbab5e465a4195ea8924514a737 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 6 Feb 2018 20:39:01 +0100 Subject: Consistent CopyData* labels --- src/engine/bank20.asm | 4 ++-- src/engine/bank3.asm | 4 ++-- src/engine/boosters.asm | 2 +- src/engine/home.asm | 51 +++++++++++++++++++++++++------------------------ 4 files changed, 31 insertions(+), 30 deletions(-) (limited to 'src/engine') diff --git a/src/engine/bank20.asm b/src/engine/bank20.asm index 66d2e63..1b0bd9d 100755 --- a/src/engine/bank20.asm +++ b/src/engine/bank20.asm @@ -73,7 +73,7 @@ Func_801a1: ; 801a1 (20:41a1) push hl push de ld b, $20 - call SafeCopyData + call SafeCopyDataHLtoDE ld a, [wConsole] cp $2 jr nz, .asm_801d6 @@ -85,7 +85,7 @@ Func_801a1: ; 801a1 (20:41a1) add hl, bc call BankswitchVRAM_1 ld b, $20 - call SafeCopyData + call SafeCopyDataHLtoDE call BankswitchVRAM_0 .asm_801d6 diff --git a/src/engine/bank3.asm b/src/engine/bank3.asm index d1b27f8..f8fb28d 100755 --- a/src/engine/bank3.asm +++ b/src/engine/bank3.asm @@ -440,7 +440,7 @@ Func_c335: ; c335 (3:4335) ld hl, $cb30 ld de, $d0cc ld bc, $0040 - call CopyData_SaveRegisters + call CopyDataHLtoDE_SaveRegisters ret Func_c34e: ; c34e (3:434e) @@ -451,7 +451,7 @@ Func_c34e: ; c34e (3:434e) ld hl, $d0cc ld de, $cb30 ld bc, $0040 - call CopyData_SaveRegisters + call CopyDataHLtoDE_SaveRegisters call Func_0404 ret diff --git a/src/engine/boosters.asm b/src/engine/boosters.asm index 7537897..10866c2 100755 --- a/src/engine/boosters.asm +++ b/src/engine/boosters.asm @@ -466,7 +466,7 @@ InitBoosterData: ; 1e430 (7:6430) call FindBoosterDataPointer ld de, wBoosterDataCurrSet ld bc, $c - call CopyData + call CopyDataHLtoDE call LoadRarityAmountsToWram ld bc, $0 ld d, BOOSTER_CARD_TYPE_AMOUNT diff --git a/src/engine/home.asm b/src/engine/home.asm index 4f3d671..3ce079c 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -837,7 +837,7 @@ Func_5c2: ; 5c2 (0:5c2) call Func_04cf pop hl ld b, $02 - call JumpToHblankCopyData + call JumpToHblankCopyDataHLtoDE pop de pop bc pop hl @@ -928,7 +928,7 @@ Func_06c3: ; 06c3 (0:06c3) call Func_04cf pop hl ld b, $1 - call HblankCopyData + call HblankCopyDataHLtoDE pop bc pop de pop hl @@ -937,12 +937,12 @@ Func_06c3: ; 06c3 (0:06c3) INCBIN "baserom.gbc",$06ee,$06fc - $06ee -; copies b bytes from hl to de +; memcpy(DE, HL, B) ; if LCD on, copy during h-blank only -SafeCopyData: ; 6fc (0:6fc) +SafeCopyDataHLtoDE: ; 6fc (0:6fc) ld a, [wLCDC] rla - jr c, JumpToHblankCopyData + jr c, JumpToHblankCopyDataHLtoDE .lcd_off_copy_loop ld a, [hli] ld [de], a @@ -950,9 +950,9 @@ SafeCopyData: ; 6fc (0:6fc) dec b jr nz, .lcd_off_copy_loop ret -JumpToHblankCopyData: ; 0709 (0:0709) - jp HblankCopyData -; 0x70c +JumpToHblankCopyDataHLtoDE: ; 0709 (0:0709) + jp HblankCopyDataHLtoDE +; 0x70c CopyGfxData: ; 070c (0:070c) ld a, [wLCDC] @@ -963,7 +963,7 @@ CopyGfxData: ; 070c (0:070c) push hl push de ld b, c - call JumpToHblankCopyData + call JumpToHblankCopyDataHLtoDE ld b, $0 pop hl add hl, bc @@ -988,25 +988,25 @@ CopyGfxData: ; 070c (0:070c) jr nz, .asm_726 ret -CopyData_SaveRegisters: ; 0732 (0:0732) +CopyDataHLtoDE_SaveRegisters: ; 0732 (0:0732) push hl push de push bc - call CopyData + call CopyDataHLtoDE pop bc pop de pop hl ret ; copies bc bytes from hl to de -CopyData: ; 073c (0:073c) +CopyDataHLtoDE: ; 073c (0:073c) ld a, [hli] ld [de], a inc de dec bc ld a, c or b - jr nz, CopyData + jr nz, CopyDataHLtoDE ret ; switch to rombank (A + top2 of H shifted down), @@ -1731,7 +1731,7 @@ Wait: ; 0c08 (0:0c08) ret ; memcpy(DE, HL, B), but only during hblank -HblankCopyData: ; 0c19 (0:0c19) +HblankCopyDataHLtoDE: ; 0c19 (0:0c19) push bc .loop ei @@ -1752,8 +1752,8 @@ HblankCopyData: ; 0c19 (0:0c19) pop bc ret -; memcpy(HL, DE, B), but only during hblank -MemcpyDEHL_hblank: ; 0c32 (0:0c32) +; memcpy(HL, DE, C), but only during hblank +HblankCopyDataDEtoHL: ; 0c32 (0:0c32) push bc .asm_c33 ei @@ -3572,7 +3572,7 @@ CreateTempCardCollection: ; 1d2e (0:1d2e) ld hl, sCardCollection ld de, wTempCardCollection ld bc, CARD_COLLECTION_SIZE - call CopyData + call CopyDataHLtoDE ld de, sDeck1Name call AddDeckCardsToTempCardCollection ld de, sDeck2Name @@ -3650,7 +3650,8 @@ Func_1d91: ; 1d91 (0:1d91) INCBIN "baserom.gbc",$1da4,$1dca - $1da4 ; memcpy(HL, DE, C) -Memcpy: ; 1dca (0:1dca) +; if LCD on, copy during h-blank only +SafeCopyDataDEtoHL: ; 1dca (0:1dca) ld a, [wLCDC] ; bit 7, a ; jr nz, .asm_1dd8 ; assert that LCD is on @@ -3662,7 +3663,7 @@ Memcpy: ; 1dca (0:1dca) jr nz, .asm_1dd1 ret .asm_1dd8 - jp MemcpyDEHL_hblank + jp HblankCopyDataDEtoHL ; calculates $9800 + SCREEN_WIDTH * e + d to map the screen coordinates at de ; to the corresponding BG Map 0 address in VRAM. @@ -3852,7 +3853,7 @@ CopyLine: ; 1ea5 (0:1ea5) push bc ld c, b ld b, $0 - call Memcpy + call SafeCopyDataDEtoHL pop bc pop de ; advance pointer SCREEN_WIDTH positions and restore stack pointer @@ -3985,7 +3986,7 @@ Func_1f5f: ; 1f5f (0:1f5f) push bc ld c, b ld b, $0 - call Memcpy + call SafeCopyDataDEtoHL ld hl, sp+$24 ld a, [hl] ld hl, sp+$27 @@ -4310,7 +4311,7 @@ Func_22f2: ; 22f2 (0:22f2) ld h, d ld de, $cd05 ld c, $1 - call Memcpy + call SafeCopyDataDEtoHL ld hl, $ffac inc [hl] ret @@ -4568,7 +4569,7 @@ Func_24ac: ; 24ac (0:24ac) or a jr nz, .asm_24bf call Func_2510 - call Memcpy + call SafeCopyDataDEtoHL .asm_24bb pop bc pop de @@ -4577,7 +4578,7 @@ Func_24ac: ; 24ac (0:24ac) .asm_24bf call Func_24ca call Func_2518 - call Memcpy + call SafeCopyDataDEtoHL jr .asm_24bb Func_24ca: ; 24ca (0:24ca) @@ -7540,7 +7541,7 @@ Func_3bf5: ; 3bf5 (0:3bf5) ld l, a ld a, [wd4c5] ld h, a - call CopyData_SaveRegisters + call CopyDataHLtoDE_SaveRegisters pop hl pop af call BankswitchHome -- cgit v1.2.3 From c014f8413580e1549b4dc9dde939e852f5bb1b31 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 6 Feb 2018 20:49:30 +0100 Subject: Convenient INCROM macro --- src/engine/bank1.asm | 50 +++++++------- src/engine/bank1c.asm | 16 ++--- src/engine/bank2.asm | 46 ++++++------- src/engine/bank20.asm | 24 +++---- src/engine/bank3.asm | 66 +++++++++--------- src/engine/bank4.asm | 84 +++++++++++------------ src/engine/bank5.asm | 10 +-- src/engine/bank6.asm | 12 ++-- src/engine/bank7.asm | 38 +++++------ src/engine/bank8.asm | 6 +- src/engine/boosters.asm | 2 +- src/engine/effect_functions.asm | 16 ++--- src/engine/home.asm | 144 ++++++++++++++++++++-------------------- 13 files changed, 257 insertions(+), 257 deletions(-) (limited to 'src/engine') diff --git a/src/engine/bank1.asm b/src/engine/bank1.asm index 3a3c6d6..a524905 100755 --- a/src/engine/bank1.asm +++ b/src/engine/bank1.asm @@ -39,10 +39,10 @@ Func_4050: ; 4050 (1:4050) ret Func_405a: ; 405a (1:405a) -INCBIN "baserom.gbc",$405a,$406f - $405a + INCROM $405a, $406f Func_406f: ; 406f (1:406f) -INCBIN "baserom.gbc",$406f,$409f - $406f + INCROM $406f, $409f ; this function begins the duel after the opponent's ; graphics, name and deck have been introduced @@ -231,7 +231,7 @@ StartDuel: ; 409f (1:409f) ret ; 0x420b -INCBIN "baserom.gbc",$420b,$4225 - $420b + INCROM $420b, $4225 HandleTurn: ; 4225 (1:4225) ld a, DUELVARS_DUELIST_TYPE @@ -344,7 +344,7 @@ BattleMenuFunctionTable: ; 42f1 (1:42f1) dw PlayerRetreat dw PlayerEndTurn -INCBIN "baserom.gbc",$42fd, $430b - $42fd + INCROM $42fd, $430b Func_430b: ; 430b (1:430b) call Func_4329 @@ -382,7 +382,7 @@ Func_4339: ; 4339 (1:4339) Func_4342: ; 4342 (1:4342) jp $5550 -INCBIN "baserom.gbc",$4345, $438e - $4345 + INCROM $4345, $438e OpenPokemonPowerMenu: ; 438e (1:438e) call $6431 @@ -467,7 +467,7 @@ OpenHandMenu: ; 4425 (1:4425) jp PrintDuelMenu Func_4436: ; 4436 (1:4436) -INCBIN "baserom.gbc",$4436, $4477 - $4436 + INCROM $4436, $4477 ; c contains the energy card being played PlayerUseEnergyCard: ; 4477 (1:4477) @@ -521,14 +521,14 @@ PlayerUseEnergyCard: ; 4477 (1:4477) jp $4447 ; 0x44db -INCBIN "baserom.gbc",$44db, $4585 - $44db + INCROM $44db, $4585 OpenBattleCheckMenu: ; 4585 (1:4585) call Func_3b31 call Func_3096 jp Func_426d -INCBIN "baserom.gbc",$458e, $46fc - $458e + INCROM $458e, $46fc OpenBattleAttackMenu: ; 46fc (1:46fc) call HandleCantAttackSubstatus @@ -929,7 +929,7 @@ CheckIfActiveCardParalyzedOrAsleep: ; 4918 (1:4918) scf ret -INCBIN "baserom.gbc",$4933, $4b60 - $4933 + INCROM $4933, $4b60 Func_4b60: ; 4b60 (1:4b60) call $7107 @@ -1058,7 +1058,7 @@ Func_4b60: ; 4b60 (1:4b60) ; 0x4c77 -INCBIN "baserom.gbc",$4c77, $4cd5 - $4c77 + INCROM $4c77, $4cd5 ; Select Basic Pokemon From Hand Func_4cd5: ; 4cd5 (1:4cd5) @@ -1163,13 +1163,13 @@ Func_4cd5: ; 4cd5 (1:4cd5) ; 0x4d97 -INCBIN "baserom.gbc",$4d97, $5aeb - $4d97 + INCROM $4d97, $5aeb Func_5aeb: ; 5aeb (1:5aeb) -INCBIN "baserom.gbc",$5aeb,$6785 - $5aeb + INCROM $5aeb, $6785 Func_6785: ; 6785 (1:6785) -INCBIN "baserom.gbc",$6785,$6793 - $6785 + INCROM $6785, $6793 ; loads player deck from SRAM to wPlayerDeck LoadPlayerDeck: ; 6793 (1:6793) @@ -1192,7 +1192,7 @@ LoadPlayerDeck: ; 6793 (1:6793) ret ; 0x67b2 -INCBIN "baserom.gbc",$67b2,$67be - $67b2 + INCROM $67b2, $67be ; related to ai taking their turn in a duel ; called multiple times during one ai turn @@ -1233,7 +1233,7 @@ AIMakeDecision: ; 67be (1:67be) ret ; 0x67fb -INCBIN "baserom.gbc",$67fb,$695e - $67fb + INCROM $67fb, $695e AIMoveTable: ; 695e (1:695e) dw Func_0f35 @@ -1260,7 +1260,7 @@ AIMoveTable: ; 695e (1:695e) dw $6b15 dw $6b20 -INCBIN "baserom.gbc",$698c,$69a5 - $698c + INCROM $698c, $69a5 AIUseEnergyCard: ; 69a5 (1:69a5) ld a, [$ffa1] @@ -1279,7 +1279,7 @@ AIUseEnergyCard: ; 69a5 (1:69a5) ret ; 0x69c5 -INCBIN "baserom.gbc",$69c5,$6d84 - $69c5 + INCROM $69c5, $6d84 ; converts clefairy doll/mysterious fossil at specified wLoadedCard to pokemon card ConvertTrainerCardToPokemon: @@ -1336,7 +1336,7 @@ ConvertTrainerCardToPokemon: db UNABLE_RETREAT ; retreat cost ds $0d ; PKMN_CARD_DATA_LENGTH - (wLoadedCard1RetreatCost + 1 - wLoadedCard1) -INCBIN "baserom.gbc",$6df1,$7107 - $6df1 + INCROM $6df1, $7107 ; initializes duel variables such as cards in deck and in hand, or Pokemon in play area ; player turn: [c200, c2ff] @@ -1381,7 +1381,7 @@ InitializeDuelVariables: ; 7107 (1:7107) ret ; 0x7133 -INCBIN "baserom.gbc",$7133,$71ad - $7133 + INCROM $7133, $71ad _TossCoin: ; 71ad (1:71ad) ld [wcd9c], a @@ -1577,29 +1577,29 @@ _TossCoin: ; 71ad (1:71ad) ret ; 0x72ff -INCBIN "baserom.gbc",$72ff,$7354 - $72ff + INCROM $72ff, $7354 BuildVersion: ; 7354 (1:7354) db "VER 12/20 09:36",TX_END -INCBIN "baserom.gbc",$7364,$7571 - $7364 + INCROM $7364, $7571 Func_7571: ; 7571 (1:7571) -INCBIN "baserom.gbc",$7571,$7576 - $7571 + INCROM $7571, $7576 Func_7576: ; 7576 (1:7576) farcallx $6, $591f ret ; 0x757b -INCBIN "baserom.gbc",$757b,$758f - $757b + INCROM $757b, $758f Func_758f: ; 758f (1:758f) -INCBIN "baserom.gbc",$758f,$7594 - $758f + INCROM $758f, $7594 Func_7594: ; 7594 (1:7594) farcallx $6, $661f ret ; 0x7599 -INCBIN "baserom.gbc",$7599,$8000 - $7599 \ No newline at end of file + INCROM $7599, $8000 \ No newline at end of file diff --git a/src/engine/bank1c.asm b/src/engine/bank1c.asm index 9abadde..7ceb0dc 100755 --- a/src/engine/bank1c.asm +++ b/src/engine/bank1c.asm @@ -22,7 +22,7 @@ Func_70018: ; 70018 (1c:4018) ret ; 0x70024 -INCBIN "baserom.gbc",$70024,$70044 - $70024 + INCROM $70024, $70044 Func_70044: ; 70044 (1c:4044) push hl @@ -41,7 +41,7 @@ Func_70044: ; 70044 (1c:4044) ret Unknown_70057: ; 70057 (1c:4057) -INCBIN "baserom.gbc",$70057,$70082 - $70057 + INCROM $70057, $70082 Func_70082: ; 70082 (1c:4082) ld a, [wConsole] @@ -108,11 +108,11 @@ Func_700a3: ; 700a3 (1c:40a3) ; CHR_TRN: tiles $00-$7F, BG (border) tiles (from SNES $000-$FFF) SGB_700de: ; 700de (1c:40de) -INCBIN "baserom.gbc",$700de,$700ee - $700de + INCROM $700de, $700ee ; CHR_TRN: tiles $80-$FF, BG (border) tiles (from SNES $000-$FFF) SGB_700ee: ; 700ee (1c:40ee) -INCBIN "baserom.gbc",$700ee,$700fe - $700ee + INCROM $700ee, $700fe Func_700fe: ; 700fe (1c:40fe) push hl @@ -140,7 +140,7 @@ Func_700fe: ; 700fe (1c:40fe) ; PCT_TRN: read tile map & palette data into VRAM (from SNES $000-$87F) SGB_70126: ; 70126 (1c:4126) -INCBIN "baserom.gbc",$70126,$70136 - $70126 + INCROM $70126, $70136 Func_70136: ; 70136 (1c:4136) push hl @@ -200,11 +200,11 @@ Func_70177: ; 70177 (1c:4177) ; MASK_EN on SGB_MASK_EN_ON_701a0: ; 701a0 (1c:41a0) -INCBIN "baserom.gbc",$701a0,$701b0 - $701a0 + INCROM $701a0, $701b0 ; MASK_EN off SGB_MASK_EN_OFF_701b0: ; 701b0 (1c:41b0) -INCBIN "baserom.gbc",$701b0,$701c0 - $701b0 + INCROM $701b0, $701c0 Func_701c0: ; 701c0 (1c:41c0) push hl @@ -311,4 +311,4 @@ Func_70214: ; 70214 (1c:4214) ret Unknown_7024a: ; 7024a (1c:424a) -INCBIN "baserom.gbc",$7024a,$74000 - $7024a + INCROM $7024a, $74000 diff --git a/src/engine/bank2.asm b/src/engine/bank2.asm index a721a74..a62d1ce 100755 --- a/src/engine/bank2.asm +++ b/src/engine/bank2.asm @@ -1,4 +1,4 @@ -INCBIN "baserom.gbc",$8000,$8cd4 - $8000 + INCROM $8000, $8cd4 Func_8cd4: ; 8cd4 (2:4cd4) push bc @@ -17,7 +17,7 @@ Func_8cd4: ; 8cd4 (2:4cd4) ret ; 0x8ce7 -INCBIN "baserom.gbc",$8ce7,$8cf9 - $8ce7 + INCROM $8ce7, $8cf9 Func_8cf9: ; 8cf9 (2:4cf9) call EnableExtRAM @@ -37,7 +37,7 @@ Func_8d0b: ; 8d0b (2:4d0b) ret Unknown_8d15: ; 8d15 (2:4d15) -INCBIN "baserom.gbc",$8d15,$8d56 - $8d15 + INCROM $8d15, $8d56 Func_8d56: ; 8d56 (2:4d56) xor a @@ -55,7 +55,7 @@ Func_8d56: ; 8d56 (2:4d56) ret ; 0x8d78 -INCBIN "baserom.gbc",$8d78,$8d9d - $8d78 + INCROM $8d78, $8d9d Func_8d9d: ; 8d9d (2:4d9d) ld de, $cfd1 @@ -69,7 +69,7 @@ Func_8d9d: ; 8d9d (2:4d9d) ret Unknown_8da9: ; 8da9 (2:4da9) -INCBIN "baserom.gbc",$8da9,$8db0 - $8da9 + INCROM $8da9, $8db0 Func_8db0: ; 8db0 (2:4db0) ld hl, Unknown_8da9 @@ -97,7 +97,7 @@ Func_8dbc: ; 8dbc (2:4dbc) jp Func_8e42 Unknown_8de2: ; 8de2 (2:4de2) -INCBIN "baserom.gbc",$8de2,$8dea - $8de2 + INCROM $8de2, $8dea Func_8dea: ; 8dea (2:4dea) ldh a, [hButtonsPressed2] @@ -372,13 +372,13 @@ Func_8ff2: ; 8ff2 (2:4ff2) ret ; 0x9001 -INCBIN "baserom.gbc",$9001,$9026 - $9001 + INCROM $9001, $9026 Func_9026: ; 9026 (2:5026) ret Unknown_9027: ; 9027 (2:5027) -INCBIN "baserom.gbc",$9027,$9038 - $9027 + INCROM $9027, $9038 Func_9038: ; 9038 (2:5038) ld a, [wceb1] @@ -540,7 +540,7 @@ Func_910a: ; 910a (2:510a) ret ; 0x9120 -INCBIN "baserom.gbc",$9120,$9152 - $9120 + INCROM $9120, $9152 Func_9152: ; 9152 (2:5152) push hl @@ -662,7 +662,7 @@ Func_9168: ; 9168 (2:5168) ret Unknown_9242: ; 9242 (2:5242) -INCBIN "baserom.gbc",$9242,$9253 - $9242 + INCROM $9242, $9253 Func_9253: ; 9253 (2:5253) ld de, wc590 @@ -709,7 +709,7 @@ Func_926e: ; 926e (2:526e) ret Unknown_92a7: ; 92a7 (2:52a7) -INCBIN "baserom.gbc",$92a7,$92ad - $92a7 + INCROM $92a7, $92ad Func_92ad: ; 92ad (2:52ad) ld a, [hli] @@ -726,7 +726,7 @@ Func_92b4: ; 92b4 (2:52b4) ret ; 0x92be -INCBIN "baserom.gbc",$92be,$9314 - $92be + INCROM $92be, $9314 Func_9314: ; 9314 (2:5314) ld bc, $0018 @@ -759,31 +759,31 @@ Func_9326: ; 9326 (2:5326) ret Func_9345: ; 9345 (2:5345) -INCBIN "baserom.gbc",$9345,$9843 - $9345 + INCROM $9345, $9843 Func_9843: ; 9843 (2:5843) -INCBIN "baserom.gbc",$9843,$9e41 - $9843 + INCROM $9843, $9e41 Func_9e41: ; 9e41 (2:5e41) -INCBIN "baserom.gbc",$9e41,$a288 - $9e41 + INCROM $9e41, $a288 Func_a288: ; a288 (2:6288) -INCBIN "baserom.gbc",$a288,$a763 - $a288 + INCROM $a288, $a763 Unknown_a763: ; a763 (2:6763) -INCBIN "baserom.gbc",$a763,$a76c - $a763 + INCROM $a763, $a76c Unknown_a76c: ; a76c (2:676c) -INCBIN "baserom.gbc",$a76c,$a775 - $a76c + INCROM $a76c, $a775 Unknown_a775: ; a775 (2:6775) -INCBIN "baserom.gbc",$a775,$a77e - $a775 + INCROM $a775, $a77e Unknown_a77e: ; a77e (2:677e) -INCBIN "baserom.gbc",$a77e,$b177 - $a77e + INCROM $a77e, $b177 Func_b177: ; b177 (2:7177) -INCBIN "baserom.gbc",$b177,$b19d - $b177 + INCROM $b177, $b19d Func_b19d: ; b19d (2:719d) xor a @@ -888,7 +888,7 @@ Func_b19d: ; b19d (2:719d) ret ; 0xb274 -INCBIN "baserom.gbc",$b274,$ba04 - $b274 + INCROM $b274, $ba04 Func_ba04: ; ba04 (2:7a04) ld a, [wd0a9] @@ -1071,4 +1071,4 @@ Func_ba04: ; ba04 (2:7a04) jp $7a25 ; 0xbb6e -INCBIN "baserom.gbc",$bb6e,$c000 - $bb6e + INCROM $bb6e, $c000 diff --git a/src/engine/bank20.asm b/src/engine/bank20.asm index 1b0bd9d..8405cbd 100755 --- a/src/engine/bank20.asm +++ b/src/engine/bank20.asm @@ -1,5 +1,5 @@ Func_80000: ; 80000 (20:4000) -INCBIN "baserom.gbc",$80000,$80028 - $80000 + INCROM $80000, $80028 Func_80028: ; 80028 (20:4028) call Func_801f1 @@ -11,7 +11,7 @@ Func_80028: ; 80028 (20:4028) ret ; 0x8003d -INCBIN "baserom.gbc",$8003d,$80077 - $8003d + INCROM $8003d, $80077 Func_80077: ; 80077 (20:4077) ld a, $1 @@ -55,7 +55,7 @@ Func_80077: ; 80077 (20:4077) ret ; 0x800bd -INCBIN "baserom.gbc",$800bd,$801a1 - $800bd + INCROM $800bd, $801a1 Func_801a1: ; 801a1 (20:41a1) push hl @@ -157,7 +157,7 @@ Func_80229: ; 80229 (20:4229) ret ; 0x80238 -INCBIN "baserom.gbc",$80238,$8025b - $80238 + INCROM $80238, $8025b Func_8025b: ; 8025b (20:425b) push hl @@ -234,19 +234,19 @@ Func_802bb: ; 802bb (20:42bb) ret ; 0x802d4 -INCBIN "baserom.gbc",$802d4,$80418 - $802d4 + INCROM $802d4, $80418 Func_80418: ; 80418 (20:4418) -INCBIN "baserom.gbc",$80418,$80480 - $80418 + INCROM $80418, $80480 Func_80480: ; 80480 (20:4480) -INCBIN "baserom.gbc",$80480,$804d8 - $80480 + INCROM $80480, $804d8 Func_804d8: ; 804d8 (20:44d8) -INCBIN "baserom.gbc",$804d8,$80b7a - $804d8 + INCROM $804d8, $80b7a Func_80b7a: ; 80b7a (20:4b7a) -INCBIN "baserom.gbc",$80b7a,$80ba4 - $80b7a + INCROM $80b7a, $80ba4 Func_80ba4: ; 80ba4 (20:4ba4) push af @@ -327,10 +327,10 @@ Func_80ba4: ; 80ba4 (20:4ba4) ret ; 0x80c21 -INCBIN "baserom.gbc",$80c21,$80e5a - $80c21 + INCROM $80c21, $80e5a Unknown_80e5a: ; 80e5a (20:4e5a) -INCBIN "baserom.gbc",$80e5a,$80e5d - $80e5a + INCROM $80e5a, $80e5d MapDataPointers: ; 80e5d (20:4e5d) -INCBIN "baserom.gbc",$80e5d,$84000 - $80e5d + INCROM $80e5d, $84000 diff --git a/src/engine/bank3.asm b/src/engine/bank3.asm index f8fb28d..ab9999b 100755 --- a/src/engine/bank3.asm +++ b/src/engine/bank3.asm @@ -336,7 +336,7 @@ Func_c268: ; c268 (3:4268) ret Unknown_c27c: ; c27c (3:427c) -INCBIN "baserom.gbc",$c27c,$c280 - $c27c + INCROM $c27c, $c280 Func_c280: ; c280 (3:4280) call Func_c228 @@ -467,7 +467,7 @@ Func_c36a: ; c36a (3:436a) ret ; 0xc37a -INCBIN "baserom.gbc",$c37a,$c41c - $c37a + INCROM $c37a, $c41c Func_c41c: ; c41c (3:441c) ld a, [wd332] @@ -1098,7 +1098,7 @@ PC_c7ea: ; c7ea (3:47ea) ret ; 0xc846 -INCBIN "baserom.gbc",$c846,$c891 - $c846 + INCROM $c846, $c891 Func_c891: ; c891 (3:4891) push hl @@ -1351,7 +1351,7 @@ Func_c9e8: ; c9e8 (3:49e8) ret Unknown_ca0a: ; ca0a (3:4a04) -INCBIN "baserom.gbc",$ca0a,$ca0e - $ca0a + INCROM $ca0a, $ca0e Func_ca0e: ; ca0e (3:4a0e) ld a, [wd32e] @@ -1430,7 +1430,7 @@ CheckIfEventFlagSet: ; ca6c (3:4a6c) ret ; 0xca84 -INCBIN "baserom.gbc",$ca84,$ca8f - $ca84 + INCROM $ca84, $ca8f Func_ca8f: ; ca8f (3:4a8f) call Func_cab3 @@ -1477,7 +1477,7 @@ Func_cab3: ; cab3 (3:4ab3) ret ; 0xcac2 -INCBIN "baserom.gbc",$cac2,$cac5 - $cac2 + INCROM $cac2, $cac5 SetEventFlags: ; cac5 (3:4ac5) push bc @@ -1487,7 +1487,7 @@ SetEventFlags: ; cac5 (3:4ac5) ret ; 0xcacd -INCBIN "baserom.gbc",$cacd,$cad0 - $cacd + INCROM $cacd, $cad0 Func_cad0: ; cad0 (3:4ad0) push bc @@ -1541,7 +1541,7 @@ Func_cad8: ; cad8 (3:4ad8) ret ; 0xcb15 -INCBIN "baserom.gbc",$cb15,$cb1d - $cb15 + INCROM $cb15, $cb1d GetEventFlagMod: ; cb1d (3:4b1d) push bc @@ -1563,7 +1563,7 @@ GetEventFlagMod: ; cb1d (3:4b1d) ; offset - bytes to set or reset EventFlagMods: ; cb37 (3:4b37) -INCBIN "baserom.gbc",$cb37,$cc32 - $cb37 + INCROM $cb37, $cc32 Func_cc32: ; cc32 (3:4c32) push hl @@ -1576,7 +1576,7 @@ Func_cc32: ; cc32 (3:4c32) ret ; 0xcc3e -INCBIN "baserom.gbc",$cc3e,$cc42 - $cc3e + INCROM $cc3e, $cc42 ; called when pressing a in front of an object. creates a pointer to the data right after an RST20 ; was called, then runs RunOverworldScript to handle that data @@ -1639,7 +1639,7 @@ SetOWScriptPointer: ; cc8b (3:4c8b) ret ; 0xcc92 -INCBIN "baserom.gbc",$cc92,$cc96 - $cc92 + INCROM $cc92, $cc96 GetOWSArgs1AfterPointer: ; cc96 (3:4c96) ld a, $1 @@ -1781,7 +1781,7 @@ Func_cd4f: ; cd4f (3:4d4f) jr asm_cd2f Unknown_dd63: ; cd4f (3:4d4f) -INCBIN "baserom.gbc",$cd63,$cd66 - $cd63 + INCROM $cd63, $cd66 Func_cd66: ; cd66 (3:4d66) ld a, c @@ -1999,7 +1999,7 @@ Func_ceba: ; ceba (3:4eba) jp IncreaseOWScriptPointerBy1 ; 0xcedd -INCBIN "baserom.gbc",$cedd,$cee2 - $cedd + INCROM $cedd, $cee2 Func_cee2: ; cee2 (3:4ee2) call Func_c2a3 @@ -2207,7 +2207,7 @@ Func_cfd4: ; cfd4 (3:4fd4) dec hl jp IncreaseOWScriptPointerBy1 -INCBIN "baserom.gbc",$d006,$d00b - $d006 + INCROM $d006, $d00b Func_d00b: ; d00b (3:500b) sla c @@ -2405,7 +2405,7 @@ Func_d135: ; d135 (3:5135) ld [hl], d jp IncreaseOWScriptPointerBy2 -INCBIN "baserom.gbc",$d153,$d16b - $d153 + INCROM $d153, $d16b Func_d16b: ; d16b (3:516b) ld hl, wd0c8 @@ -2477,7 +2477,7 @@ asm_d1c6 ld [wce40], a jp IncreaseOWScriptPointerBy1 -INCBIN "baserom.gbc",$d1dc,$d209 - $d1dc + INCROM $d1dc, $d209 Func_d209: ; d209 (3:5209) call Func_ca69 @@ -2510,7 +2510,7 @@ Func_d209: ; d209 (3:5209) ld a, c jr asm_d1c6 -INCBIN "baserom.gbc",$d234,$d244 - $d234 + INCROM $d234, $d244 Func_d244: ; d244 (3:5244) ld a, c @@ -2527,7 +2527,7 @@ Func_d24c: ; d24c (3:524c) halt jp IncreaseOWScriptPointerBy1 -INCBIN "baserom.gbc",$d25e,$d271 - $d25e + INCROM $d25e, $d271 Func_d271: ; d271 (3:5271) ld hl, $527b @@ -2536,7 +2536,7 @@ Func_d271: ; d271 (3:5271) jp IncreaseOWScriptPointerBy1 ; 0xd27b -INCBIN "baserom.gbc",$d27b,$d28c - $d27b + INCROM $d27b, $d28c Func_d28c: ; d28c (3:528c) ld [$d416], a @@ -2627,7 +2627,7 @@ Func_d2f6: ; d2f6 (3:52f6) jp IncreaseOWScriptPointerBy1 ; 0xd30c -INCBIN "baserom.gbc",$d30c,$d317 - $d30c + INCROM $d30c, $d317 Func_d317: ; d317 (3:5317) ld hl, $532b @@ -2640,7 +2640,7 @@ Func_d317: ; d317 (3:5317) jp IncreaseOWScriptPointerBy1 -INCBIN "baserom.gbc",$d32b,$d336 - $d32b + INCROM $d32b, $d336 DeckMachine_d336: ; d336 (3:5336) push bc @@ -2736,7 +2736,7 @@ Func_d3d4: ; d3d4 (3:53d4) bank1call Func_7576 jp IncreaseOWScriptPointerBy1 -INCBIN "baserom.gbc",$d3dd,$d3e0 - $d3dd + INCROM $d3dd, $d3e0 Func_d3e0: ; d3e0 (3:53e0) ld a, $1 @@ -2916,7 +2916,7 @@ asm_d4e6 jp IncreaseOWScriptPointerBy4 ; 0xd4ec -INCBIN "baserom.gbc",$d4ec,$d753 - $d4ec + INCROM $d4ec, $d753 OWSequence_d753: ; d753 (3:5753) start_script @@ -2965,7 +2965,7 @@ OWSequence_d753: ; d753 (3:5753) ; there's more to this script but it hasn't been disassembled yet -INCBIN "baserom.gbc",$d77e,$e13f - $d77e + INCROM $d77e, $e13f WaterClubMovePlayer: ; e13f (3:613f) ld a, [wPlayerYCoord] @@ -3080,7 +3080,7 @@ OWSequence_LostToAmanda: ; e1c1 (03:61c1) tx Text0439 OWSequence_NotReadyToSeeAmy: -INCBIN "baserom.gbc",$e1c5,$e21c - $e1c5 + INCROM $e1c5, $e21c OWSequence_Joshua: start_script @@ -3114,7 +3114,7 @@ OWSequence_Joshua: db $33 db $01 -INCBIN "baserom.gbc",$e23f,$e52c - $e23f + INCROM $e23f, $e52c FindEndOfBattleScript: ; e52c (3:652c) ld c, $0 @@ -3147,7 +3147,7 @@ FindEndOfBattleScript: ; e52c (3:652c) jp Func_c926 ; 0xe553 -INCBIN "baserom.gbc",$e553,$f580 - $e553 + INCROM $e553, $f580 Func_f580: ; f580 (3:7580) call Func_ca69 @@ -3183,7 +3183,7 @@ Func_f580: ; f580 (3:7580) ret ; 0xf5b3 -INCBIN "baserom.gbc",$f5b3,$fc2b - $f5b3 + INCROM $f5b3, $fc2b Func_fc2b: ; fc2b (3:7c2b) ld a, [wd0c3] @@ -3210,16 +3210,16 @@ PointerTable_fc4c: ; fc4c (3:7c4c) dw Unknown_fc68 dw Unknown_fc60 -INCBIN "baserom.gbc",$fc52,$fc60 - $fc52 + INCROM $fc52, $fc60 Unknown_fc60: ; fc60 (3:7c60) -INCBIN "baserom.gbc",$fc60,$fc64 - $fc60 + INCROM $fc60, $fc64 Unknown_fc64: ; fc64 (3:7c64) -INCBIN "baserom.gbc",$fc64,$fc68 - $fc64 + INCROM $fc64, $fc68 Unknown_fc68: ; fc68 (3:7c68) -INCBIN "baserom.gbc",$fc68,$fcad - $fc68 + INCROM $fc68, $fcad Func_fcad: ; fcad (3:7cad) -INCBIN "baserom.gbc",$fcad,$10000 - $fcad + INCROM $fcad, $10000 diff --git a/src/engine/bank4.asm b/src/engine/bank4.asm index a69f96e..29fd949 100755 --- a/src/engine/bank4.asm +++ b/src/engine/bank4.asm @@ -42,10 +42,10 @@ Func_10031: ; 10031 (4:4031) ret Func_10059: ; 10059 (4:4059) -INCBIN "baserom.gbc",$10059,$100a2 - $10059 + INCROM $10059, $100a2 Func_100a2: ; 100a2 (4:40a2) -INCBIN "baserom.gbc",$100a2,$1029e - $100a2 + INCROM $100a2, $1029e Medal_1029e: ; 1029e (4:429e) sub $8 @@ -99,7 +99,7 @@ Medal_1029e: ; 1029e (4:429e) ret Unknown_1030b: ; 1030b (4:430b) -INCBIN "baserom.gbc",$1030b,$1031b - $1030b + INCROM $1030b, $1031b BoosterPack_1031b: ; 1031b (4:431b) ld c, a @@ -168,10 +168,10 @@ BoosterPack_1031b: ; 1031b (4:431b) ret ; 0x103a5 -INCBIN "baserom.gbc",$103a5,$103d2 - $103a5 + INCROM $103a5, $103d2 Func_103d2: ; 103d2 (4:43d2) -INCBIN "baserom.gbc",$103d2,$103d3 - $103d2 + INCROM $103d2, $103d3 Duel_Init: ; 103d3 (4:43d3) ld a, [wd291] @@ -231,13 +231,13 @@ Duel_Init: ; 103d3 (4:43d3) ret ; 0x10451 -INCBIN "baserom.gbc",$10451,$10548 - $10451 + INCROM $10451, $10548 Func_10548: ; 10548 (4:4548) -INCBIN "baserom.gbc",$10548,$10756 - $10548 + INCROM $10548, $10756 Func_10756: ; 10756 (4:4756) -INCBIN "baserom.gbc",$10756,$10a70 - $10756 + INCROM $10756, $10a70 Func_10a70: ; 10a70 (4:4a70) push hl @@ -277,13 +277,13 @@ Func_10a70: ; 10a70 (4:4a70) ret Func_10a9b: ; 10a9b (4:4a9b) -INCBIN "baserom.gbc",$10a9b,$10ab4 - $10a9b + INCROM $10a9b, $10ab4 Func_10ab4: ; 10ab4 (4:4ab4) -INCBIN "baserom.gbc",$10ab4,$10af9 - $10ab4 + INCROM $10ab4, $10af9 Func_10af9: ; 10af9 (4:4af9) -INCBIN "baserom.gbc",$10af9,$10c96 - $10af9 + INCROM $10af9, $10c96 Func_10c96: ; 10c96 (4:4c96) ld a, [$ff81] @@ -308,7 +308,7 @@ Func_10c96: ; 10c96 (4:4c96) ret ; 0x10cbb -INCBIN "baserom.gbc",$10cbb,$10dba - $10cbb + INCROM $10cbb, $10dba Func_10dba: ; 10dba (4:4dba) ld a, $1 @@ -338,10 +338,10 @@ Func_10dba: ; 10dba (4:4dba) ret ; 0x10df0 -INCBIN "baserom.gbc",$10df0,$10e28 - $10df0 + INCROM $10df0, $10e28 Func_10e28: ; 10e28 (4:4e28) -INCBIN "baserom.gbc",$10e28,$10e55 - $10e28 + INCROM $10e28, $10e55 Func_10e55: ; 10e55 (4:4e55) ld a, [wd336] @@ -406,7 +406,7 @@ Func_10e97: ; 10e97 (4:4e97) ret Unknown_10ebc: ; 10ebc (4:4ebc) -INCBIN "baserom.gbc",$10ebc,$10efd - $10ebc + INCROM $10ebc, $10efd Func_10efd: ; 10efd (4:4efd) push hl @@ -429,7 +429,7 @@ Func_10efd: ; 10efd (4:4efd) ret Unknown_10f14: ; 10f14 (4:4f14) -INCBIN "baserom.gbc",$10f14,$10f2e - $10f14 + INCROM $10f14, $10f2e Func_10f2e: ; 10f2e (4:4f2e) push hl @@ -789,22 +789,22 @@ Func_11184: ; 11184 (4:5184) ret ; 0x111b3 -INCBIN "baserom.gbc",$111b3,$111e9 - $111b3 + INCROM $111b3, $111e9 Func_111e9: ; 111e9 (4:51e9) -INCBIN "baserom.gbc",$111e9,$1124d - $111e9 + INCROM $111e9, $1124d Func_1124d: ; 1124d (4:524d) -INCBIN "baserom.gbc",$1124d,$11320 - $1124d + INCROM $1124d, $11320 Func_11320: ; 11320 (4:5320) -INCBIN "baserom.gbc",$11320,$11416 - $11320 + INCROM $11320, $11416 Func_11416: ; 11416 (4:5416) -INCBIN "baserom.gbc",$11416,$11430 - $11416 + INCROM $11416, $11430 Func_11430: ; 11430 (4:5430) -INCBIN "baserom.gbc",$11430,$1157c - $11430 + INCROM $11430, $1157c Func_1157c: ; 1157c (4:557c) ld a, c @@ -831,7 +831,7 @@ Func_1157c: ; 1157c (4:557c) ; 0x115a3 -INCBIN "baserom.gbc",$115a3,$1162a - $115a3 + INCROM $115a3, $1162a INCLUDE "data/map_scripts.asm" @@ -960,7 +960,7 @@ Func_118d3: ; 118d3 (4:58d3) INCLUDE "data/npcs.asm" -INCBIN "baserom.gbc",$11f4e,$1217b - $11f4e + INCROM $11f4e, $1217b OverworldScriptTable: ; 1217b (4:617b) dw OWScript_EndScriptLoop1 @@ -1068,10 +1068,10 @@ OverworldScriptTable: ; 1217b (4:617b) dw OWScript_EndScriptLoop9 dw OWScript_EndScriptLoop10 -INCBIN "baserom.gbc",$1224b,$1229f - $1224b + INCROM $1224b, $1229f Unknown_1229f: ; 1229f (4:629f) -INCBIN "baserom.gbc",$1229f,$126d1 - $1229f + INCROM $1229f, $126d1 Func_126d1: ; 126d1 (4:66d1) call Func_099c @@ -1164,19 +1164,19 @@ Func_1277e: ; 1277e (4:677e) ret ; 0x1279a -INCBIN "baserom.gbc",$1279a,$12871 - $1279a + INCROM $1279a, $12871 Func_12871: ; 12871 (4:6871) -INCBIN "baserom.gbc",$12871,$1288c - $12871 + INCROM $12871, $1288c Func_1288c: ; 1288c (4:688c) -INCBIN "baserom.gbc",$1288c,$128a9 - $1288c + INCROM $1288c, $128a9 Func_128a9: ; 128a9 (4:68a9) -INCBIN "baserom.gbc",$128a9,$1296e - $128a9 + INCROM $128a9, $1296e Func_1296e: ; 1296e (4:696e) -INCBIN "baserom.gbc",$1296e,$1299f - $1296e + INCROM $1296e, $1299f Func_1299f: ; 1299f (4:699f) push af @@ -1245,10 +1245,10 @@ Func_129d9: ; 129d9 (4:69d9) ret ; 0x129fa -INCBIN "baserom.gbc",$129fa,$12a21 - $129fa + INCROM $129fa, $12a21 Func_12a21: ; 12a21 (4:6a21) -INCBIN "baserom.gbc",$12a21,$12ab5 - $12a21 + INCROM $12a21, $12ab5 Func_12ab5: ; 12ab5 (4:6ab5) push hl @@ -1266,7 +1266,7 @@ Func_12ab5: ; 12ab5 (4:6ab5) ret ; 0x12ac9 -INCBIN "baserom.gbc",$12ac9,$12ae2 - $12ac9 + INCROM $12ac9, $12ae2 Func_12ae2: ; 12ae2 (4:6ae2) push bc @@ -1409,10 +1409,10 @@ Func_12b89: ; 12b89 (4:6b89) ret Func_12ba7: ; 12ba7 (4:6ba7) -INCBIN "baserom.gbc",$12ba7,$12bcd - $12ba7 + INCROM $12ba7, $12bcd Func_12bcd: ; 12bcd (4:6bcd) -INCBIN "baserom.gbc",$12bcd,$12c05 - $12bcd + INCROM $12bcd, $12c05 Func_12c05: ; 12c05 (4:6c05) push hl @@ -1487,16 +1487,16 @@ Func_12c4f: ; 12c4f (4:6c4f) ret Func_12c5e: ; 12c5e (4:6c5e) -INCBIN "baserom.gbc",$12c5e,$12c7f - $12c5e + INCROM $12c5e, $12c7f Func_12c7f: ; 12c7f (4:6c7f) -INCBIN "baserom.gbc",$12c7f,$131b3 - $12c7f + INCROM $12c7f, $131b3 Func_131b3: ; 131b3 (4:71b3) -INCBIN "baserom.gbc",$131b3,$131d3 - $131b3 + INCROM $131b3, $131d3 Func_131d3: ; 131d3 (4:71d3) -INCBIN "baserom.gbc",$131d3,$1344d - $131d3 + INCROM $131d3, $1344d Func_1344d: ; 1344d (4:744d) call Func_379b @@ -1509,7 +1509,7 @@ Func_1344d: ; 1344d (4:744d) ret ; 0x13462 -INCBIN "baserom.gbc",$13462,$13485 - $13462 + INCROM $13462, $13485 Func_13485: ; 13485 (4:7485) call EnableExtRAM @@ -1531,4 +1531,4 @@ Func_13485: ; 13485 (4:7485) ret ; 0x134b1 -INCBIN "baserom.gbc",$134b1,$14000 - $134b1 + INCROM $134b1, $14000 diff --git a/src/engine/bank5.asm b/src/engine/bank5.asm index d65c21b..d713f8f 100755 --- a/src/engine/bank5.asm +++ b/src/engine/bank5.asm @@ -54,7 +54,7 @@ PointerTable_14000: ; 14000 (05:4000) dw $48dc ; IMAKUNI_DECK ; 1406a -INCBIN "baserom.gbc",$1406a,$14226 - $1406a + INCROM $1406a, $14226 Func_14226: ; 14226 (5:4226) call CreateHandCardBuffer @@ -78,7 +78,7 @@ Func_14226: ; 14226 (5:4226) jr .checkForNextPokemon ; 0x1424b -INCBIN "baserom.gbc",$1424b,$14663 - $1424b + INCROM $1424b, $14663 Func_14663: ; 14663 (5:4663) farcall Func_200e5 @@ -223,7 +223,7 @@ Func_1468b: ; 1468b (5:468b) ; 0x14786 -INCBIN "baserom.gbc",$14786,$15636 - $14786 + INCROM $14786, $15636 Func_15636: ; 15636 (5:5636) ld a, $10 ld hl, $cda5 @@ -301,7 +301,7 @@ Func_15649: ; 15649 (5:5649) ret ; 0x156c3 -INCBIN "baserom.gbc",$156c3,$1575e - $156c3 + INCROM $156c3, $1575e ; zeroes a bytes starting at hl ZeroData: ; 1575e (5:575e) @@ -320,4 +320,4 @@ ZeroData: ; 1575e (5:575e) ret ; 0x1576b -INCBIN "baserom.gbc",$1576b,$18000 - $1576b + INCROM $1576b, $18000 diff --git a/src/engine/bank6.asm b/src/engine/bank6.asm index c66e669..82fb589 100755 --- a/src/engine/bank6.asm +++ b/src/engine/bank6.asm @@ -1,8 +1,8 @@ -INCBIN "baserom.gbc",$18000,$186f7 - $18000 + INCROM $18000, $186f7 INCLUDE "data/effect_commands.asm" -INCBIN "baserom.gbc",$18f9c,$1996e - $18f9c + INCROM $18f9c, $1996e Func_1996e: ; 1996e (6:596e) call EnableExtRAM @@ -108,7 +108,7 @@ Func_19a12: ; 19a12 (6:5a12) ret ; 0x19a1f -INCBIN "baserom.gbc",$19a1f,$1a61f - $19a1f + INCROM $19a1f, $1a61f Func_1a61f: ; 1a61f (6:661f) push af @@ -167,13 +167,13 @@ Func_1a61f: ; 1a61f (6:661f) ret ; 0x1a68d -INCBIN "baserom.gbc",$1a68d,$1a6cc - $1a68d + INCROM $1a68d, $1a6cc Func_1a6cc: ; 1a6cc (6:66cc) ret ; 0x1a6cd -INCBIN "baserom.gbc",$1a6cd,$1ad89 - $1a6cd + INCROM $1a6cd, $1ad89 Func_1ad89: ; 1ad89 (6:6d89) -INCBIN "baserom.gbc",$1ad89,$1c000 - $1ad89 + INCROM $1ad89, $1c000 diff --git a/src/engine/bank7.asm b/src/engine/bank7.asm index c54b16f..6dd7fe7 100755 --- a/src/engine/bank7.asm +++ b/src/engine/bank7.asm @@ -1,4 +1,4 @@ -INCBIN "baserom.gbc",$1c000,$1c056 - $1c000 + INCROM $1c000, $1c056 Func_1c056: ; 1c056 (7:4056) push hl @@ -91,7 +91,7 @@ Func_1c33b: ; 1c33b (7:433b) INCLUDE "data/map_songs.asm" Func_1c440: ; 1c440 (7:4440) -INCBIN "baserom.gbc",$1c440,$1c455 - $1c440 + INCROM $1c440, $1c455 Func_1c455: ; 1c455 (7:4455) push hl @@ -129,7 +129,7 @@ Func_1c477: ; 1c477 (7:4477) ret Func_1c485: ; 1c485 (7:4485) -INCBIN "baserom.gbc",$1c485,$1c50a - $1c485 + INCROM $1c485, $1c50a Func_1c50a: ; 1c50a (7:450a) push hl @@ -224,16 +224,16 @@ Func_1c57b: ; 1c57b (7:457b) ret Func_1c58e: ; 1c58e (7:458e) -INCBIN "baserom.gbc",$1c58e,$1c5e9 - $1c58e + INCROM $1c58e, $1c5e9 Func_1c5e9: ; 1c5e9 (7:45e9) -INCBIN "baserom.gbc",$1c5e9,$1c610 - $1c5e9 + INCROM $1c5e9, $1c610 Func_1c610: ; 1c610 (7:4610) -INCBIN "baserom.gbc",$1c610,$1c6f8 - $1c610 + INCROM $1c610, $1c6f8 Func_1c6f8: ; 1c6f8 (7:46f8) -INCBIN "baserom.gbc",$1c6f8,$1c719 - $1c6f8 + INCROM $1c6f8, $1c719 Func_1c719: ; 1c719 (7:4719) push hl @@ -251,7 +251,7 @@ Func_1c719: ; 1c719 (7:4719) ret Func_1c72e: ; 1c72e (7:472e) -INCBIN "baserom.gbc",$1c72e,$1c768 - $1c72e + INCROM $1c72e, $1c768 Func_1c768: ; 1c768 (7:4768) push hl @@ -334,10 +334,10 @@ Func_1c7de: ; 1c7de (7:47de) ret ; 0x1c7e4 -INCBIN "baserom.gbc",$1c7e4,$1c82e - $1c7e4 + INCROM $1c7e4, $1c82e Func_1c82e: ; 1c82e (7:482e) -INCBIN "baserom.gbc",$1c82e,$1c83d - $1c82e + INCROM $1c82e, $1c83d Func_1c83d: ; 1c83d (7:483d) push hl @@ -367,7 +367,7 @@ Func_1c83d: ; 1c83d (7:483d) ret ; 0x1c858 -INCBIN "baserom.gbc",$1c858,$1d078 - $1c858 + INCROM $1c858, $1d078 Func_1d078: ; 1d078 (7:5078) ld a, [wd627] @@ -436,7 +436,7 @@ Func_1d078: ; 1d078 (7:5078) ret ; 0x1d0fa -INCBIN "baserom.gbc",$1d0fa,$1d11c - $1d0fa + INCROM $1d0fa, $1d11c Func_1d11c: ; 1d11c (7:511c) ld a, MUSIC_PCMAINMENU @@ -486,10 +486,10 @@ Func_1d11c: ; 1d11c (7:511c) ret ; 0x1d17f -INCBIN "baserom.gbc",$1d17f,$1d306 - $1d17f + INCROM $1d17f, $1d306 Func_1d306: ; 1d306 (7:5306) -INCBIN "baserom.gbc",$1d306,$1d386 - $1d306 + INCROM $1d306, $1d386 Titlescreen_1d386: ; 1d386 (7:5386) call Func_378a @@ -509,10 +509,10 @@ Titlescreen_1d386: ; 1d386 (7:5386) ret Func_1d3a9: ; 1d3a9 (7:53a9) -INCBIN "baserom.gbc",$1d3a9,$1d42e - $1d3a9 + INCROM $1d3a9, $1d42e Func_1d42e: ; 1d42e (7:542e) -INCBIN "baserom.gbc",$1d42e,$1d519 - $1d42e + INCROM $1d42e, $1d519 Titlescreen_1d519: ; 1d519 (7:5519) ld a, MUSIC_TITLESCREEN @@ -522,10 +522,10 @@ Titlescreen_1d519: ; 1d519 (7:5519) ret ; 0x1d523 -INCBIN "baserom.gbc",$1d523,$1d59c - $1d523 + INCROM $1d523, $1d59c Func_1d59c: ; 1d59c (7:559c) -INCBIN "baserom.gbc",$1d59c,$1d6ad - $1d59c + INCROM $1d59c, $1d6ad Credits_1d6ad: ; 1d6ad (7:56ad) ld a, MUSIC_STOP @@ -563,4 +563,4 @@ Credits_1d6ad: ; 1d6ad (7:56ad) ret ; 0x1d705 -INCBIN "baserom.gbc",$1d705,$1e1c4 - $1d705 + INCROM $1d705, $1e1c4 diff --git a/src/engine/bank8.asm b/src/engine/bank8.asm index fca29ba..d052c43 100755 --- a/src/engine/bank8.asm +++ b/src/engine/bank8.asm @@ -1,4 +1,4 @@ -INCBIN "baserom.gbc",$20000,$200e5 - $20000 + INCROM $20000, $200e5 ; 0 - e4 is a big set of data, seems to be one entry for each card @@ -117,7 +117,7 @@ Func_200e5: ; 200e5 (8:40e5) jp .asm_4106 ; 0x201b1 -INCBIN "baserom.gbc",$201b1,$2297b - $201b1 + INCROM $201b1, $2297b ; copies $ff terminated buffer from hl to de CopyBuffer: ; 2297b (8:697b) @@ -129,4 +129,4 @@ CopyBuffer: ; 2297b (8:697b) jr CopyBuffer ; 0x22983 -INCBIN "baserom.gbc",$22983,$24000 - $22983 + INCROM $22983, $24000 diff --git a/src/engine/boosters.asm b/src/engine/boosters.asm index 10866c2..d0c4ebc 100755 --- a/src/engine/boosters.asm +++ b/src/engine/boosters.asm @@ -990,4 +990,4 @@ PackRandomEnergies:: ; 1e634 (7:6634) db $00 ; Trainer Card Chance db $00 ; Energy Card Chance -INCBIN "baserom.gbc",$1e640,$20000 - $1e640 + INCROM $1e640, $20000 diff --git a/src/engine/effect_functions.asm b/src/engine/effect_functions.asm index 9a4b63e..82198a2 100644 --- a/src/engine/effect_functions.asm +++ b/src/engine/effect_functions.asm @@ -128,7 +128,7 @@ Func_2c0a2: ; 2c0a2 (b:40a2) ret ; 0x2c0a8 -INCBIN "baserom.gbc",$2c0a8,$2c0d4 - $2c0a8 + INCROM $2c0a8, $2c0d4 ; Sets some flags for AI use ; if target double poisoned @@ -181,7 +181,7 @@ Func_2c0fb: ; 2c0fb (b:40fb) ret ; 0x2c10b -INCBIN "baserom.gbc",$2c10b,$2c140 - $2c10b + INCROM $2c10b, $2c140 ; apply a status condition of type 1 identified by register a to the target ApplySubstatus1ToDefendingCard: ; 2c140 (b:4140) @@ -218,7 +218,7 @@ ApplySubstatus2ToDefendingCard: ; 2c149 (b:4149) ret ; 0x2c166 -INCBIN "baserom.gbc",$2c166,$2c6f0 - $2c166 + INCROM $2c166, $2c6f0 SpitPoison_AIEffect: ; 2c6f0 (b:46f0) ld a, $5 @@ -236,7 +236,7 @@ SpitPoison_Poison50PercentEffect: ; 2c6f8 (b:46f8) ret ; 0x2c70a -INCBIN "baserom.gbc",$2c70a,$2c730 - $2c70a + INCROM $2c70a, $2c730 PoisonFang_AIEffect: ; 2c730 (b:4730) ld a, $a @@ -250,7 +250,7 @@ WeepinbellPoisonPowder_AIEffect: ; 2c738 (b:4738) jp Func_2c0d4 ; 0x2c740 -INCBIN "baserom.gbc",$2c740,$2c77e - $2c740 + INCROM $2c740, $2c77e AcidEffect: ; 2c77e (b:477e) text_de AcidCheckText @@ -293,7 +293,7 @@ KakunaPoisonPowder_AIEffect: ; 2c7b4 (b:47b4) jp Func_2c0d4 ; 0x2c7bc -INCBIN "baserom.gbc",$2c7bc,$2c7d0 - $2c7bc + INCROM $2c7bc, $2c7d0 SwordsDanceEffect: ; 2c7d0 (b:47d0) ld a, [wTempTurnDuelistCardId] @@ -310,7 +310,7 @@ ZubatSupersonicEffect: ; 2c7dc (b:47dc) ret ; 0x2c7e3 -INCBIN "baserom.gbc",$2c7e3,$2c836 - $2c7e3 + INCROM $2c7e3, $2c836 ; an exact copy of KakunaStiffenEffect MetapodStiffenEffect: ; 2c836 (b:4836) @@ -324,4 +324,4 @@ MetapodStiffenEffect: ; 2c836 (b:4836) ret ; 0x2c84a -INCBIN "baserom.gbc",$2c84a,$30000 - $2c84a + INCROM $2c84a, $30000 diff --git a/src/engine/home.asm b/src/engine/home.asm index 3ce079c..1b2ee82 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -844,7 +844,7 @@ Func_5c2: ; 5c2 (0:5c2) ret ; 0x5db -INCBIN "baserom.gbc",$05db,$0614 - $05db + INCROM $05db, $0614 Func_0614: ; 614 (0:614) push af @@ -862,7 +862,7 @@ Func_061b: ret ; 0x627 -INCBIN "baserom.gbc",$0627,$0663 - $0627 + INCROM $0627, $0663 Func_0663: ; 0663 (0:0663) push bc @@ -898,7 +898,7 @@ Func_0686: ; 0686 (0:0686) ret ; 0x695 -INCBIN "baserom.gbc",$0695,$06c3 - $0695 + INCROM $0695, $06c3 Func_06c3: ; 06c3 (0:06c3) push af @@ -935,7 +935,7 @@ Func_06c3: ; 06c3 (0:06c3) ret ; 0x6ee -INCBIN "baserom.gbc",$06ee,$06fc - $06ee + INCROM $06ee, $06fc ; memcpy(DE, HL, B) ; if LCD on, copy during h-blank only @@ -943,12 +943,12 @@ SafeCopyDataHLtoDE: ; 6fc (0:6fc) ld a, [wLCDC] rla jr c, JumpToHblankCopyDataHLtoDE -.lcd_off_copy_loop +.lcd_off_loop ld a, [hli] ld [de], a inc de dec b - jr nz, .lcd_off_copy_loop + jr nz, .lcd_off_loop ret JumpToHblankCopyDataHLtoDE: ; 0709 (0:0709) jp HblankCopyDataHLtoDE @@ -1157,7 +1157,7 @@ BankswitchVRAM: ; 07d6 (0:07d6) ret ; 0x7db -INCBIN "baserom.gbc",$07db,$07e7 - $07db + INCROM $07db, $07e7 Func_07e7: ; 07e7 (0:07e7) call CheckForCGB @@ -1442,7 +1442,7 @@ Func_08ef: ; 08ef (0:08ef) jr .asm_93c ; 0x950 -INCBIN "baserom.gbc",$0950,$099c - $0950 + INCROM $0950, $099c Func_099c: ; 099c (0:099c) xor a @@ -1504,7 +1504,7 @@ Func_09ce: ; 09ce (0:09ce) ret ; 0x9dc -INCBIN "baserom.gbc",$09dc,$09e9 - $09dc + INCROM $09dc, $09e9 ; this function affects the stack so that it returns ; to the three byte pointer following the rst call @@ -1711,7 +1711,7 @@ SGB_MLT_REQ_2: ; 0bbb (0:0bbb) sgb MLT_REQ, 1 ; sgb_command, length db $01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 -INCBIN "baserom.gbc",$0bcb,$0c08 - $0bcb + INCROM $0bcb, $0c08 ; loops 63000 * bc cycles (~15 * bc ms) Wait: ; 0c08 (0:0c08) @@ -1755,27 +1755,27 @@ HblankCopyDataHLtoDE: ; 0c19 (0:0c19) ; memcpy(HL, DE, C), but only during hblank HblankCopyDataDEtoHL: ; 0c32 (0:0c32) push bc -.asm_c33 +.loop ei di ld a, [rSTAT] and $3 - jr nz, .asm_c33 + jr nz, .loop ld a, [de] ld [hl], a ld a, [rSTAT] and $3 - jr nz, .asm_c33 + jr nz, .loop ei inc hl inc de dec c - jr nz, .asm_c33 + jr nz, .loop pop bc ret ; 0xc4b -INCBIN "baserom.gbc",$0c4b,$0c91 - $0c4b + INCROM $0c4b, $0c91 ; called at roughly 240Hz by TimerHandler SerialTimerHandler: ; 0c91 (0:0c91) @@ -1815,7 +1815,7 @@ SerialTimerHandler: ; 0c91 (0:0c91) ret ; 0xcc5 -INCBIN "baserom.gbc",$0cc5,$0d26 - $0cc5 + INCROM $0cc5, $0d26 SerialHandler: ; 0d26 (0:0d26) push af @@ -2144,7 +2144,7 @@ Func_0ebf: ; 0ebf (0:0ebf) ret ; 0xed5 -INCBIN "baserom.gbc",$0ed5,$0f35 - $0ed5 + INCROM $0ed5, $0f35 Func_0f35: ; 0f35 (0:0f35) ld a, [wSerialFlags] @@ -2205,7 +2205,7 @@ Func_0f7f: ; 0f7f (0:0f7f) ret ; 0xf9b -INCBIN "baserom.gbc",$0f9b,$0fac - $0f9b + INCROM $0f9b, $0fac Func_0fac: ; 0fac (0:0fac) push hl @@ -2258,7 +2258,7 @@ Func_0fac: ; 0fac (0:0fac) ret ; 0xfe9 -INCBIN "baserom.gbc",$0fe9,$100b - $0fe9 + INCROM $0fe9, $100b Func_100b: ; 100b (0:100b) ld a, $2 @@ -2418,7 +2418,7 @@ DrawCardFromDeck: ; 10cf (0:10cf) ret ; 0x10e8 -INCBIN "baserom.gbc",$10e8,$1123 - $10e8 + INCROM $10e8, $1123 ; adds a card to the hand and increments the number of cards in the hand ; the card is identified by register a, which contains the card number within the deck (0-59) @@ -2446,7 +2446,7 @@ AddCardToHand: ; 1123 (0:1123) ret ; 0x1139 -INCBIN "baserom.gbc",$1139,$123b - $1139 + INCROM $1139, $123b CreateHandCardBuffer: ; 123b (0:123b) call FindLastCardInHand @@ -2476,7 +2476,7 @@ CreateHandCardBuffer: ; 123b (0:123b) ret ; 0x1258 -INCBIN "baserom.gbc",$1258,$1271 - $1258 + INCROM $1258, $1271 ; puts an index to the last (newest) card in current player's hand into hl. FindLastCardInHand: ; 1271 (0:1271) @@ -2530,7 +2530,7 @@ ShuffleCards: ; 127f (0:127f) ret ; 0x12a3 -INCBIN "baserom.gbc",$12a3,$1312 - $12a3 + INCROM $12a3, $1312 ; given a position in wDuelCardOrAttackList (c510), return: @@ -2563,7 +2563,7 @@ GetCardInDeckPosition: ; 1324 (0:1324) ret ; 0x132f -INCBIN "baserom.gbc",$132f,$1362 - $132f + INCROM $132f, $1362 ; returns, in register a, the id of the card in the deck position specified in register a _GetCardInDeckPosition: ; 1362 (0:1362) @@ -2614,7 +2614,7 @@ LoadDeckCardToBuffer2: ; 138c (0:138c) ret ; 0x13a2 -INCBIN "baserom.gbc",$13a2,$1485 - $13a2 + INCROM $13a2, $1485 Func_1485: ; 1485 (0:1485) push af @@ -2672,7 +2672,7 @@ Func_1485: ; 1485 (0:1485) ret ; 0x14d2 -INCBIN "baserom.gbc",$14d2,$159f - $14d2 + INCROM $14d2, $159f ; This function iterates through the card locations array to find out which and how many ; energy cards are in arena (i.e. attached to the active pokemon). @@ -2796,7 +2796,7 @@ GetNonTurnDuelistVariable: ; 1611 (0:1611) ret ; 0x161e -INCBIN "baserom.gbc",$161e,$16c0 - $161e + INCROM $161e, $16c0 CopyMoveDataAndDamageToBuffer: ; 16c0 (0:16c0) ld a, e @@ -3093,7 +3093,7 @@ CheckSelfConfusionDamage: ; 18d7 (0:18d7) ret ; 0x18f9 -INCBIN "baserom.gbc",$18f9,$195c - $18f9 + INCROM $18f9, $195c ; this function appears to apply several damage modifiers Func_195c: ; 195c (0:195c) @@ -3201,7 +3201,7 @@ Func_1a0e: ; 1a0e (0:1a0e) ret ; 0x1a1a -INCBIN "baserom.gbc",$1a1a,$1a22 - $1a1a + INCROM $1a1a, $1a22 Func_1a22: ; 1a22 (0:1a22) xor a @@ -3346,7 +3346,7 @@ Func_1ad3: ; 1ad3 (0:1ad3) ret ; 0x1af3 -INCBIN "baserom.gbc",$1af3,$1b8d - $1af3 + INCROM $1af3, $1b8d Func_1b8d: ; 1b8d (0:1b8d) bank1call $4f9d @@ -3412,7 +3412,7 @@ Func_1bca: ; 1bca (0:1bca) ret ; 0x1c05 -INCBIN "baserom.gbc",$1c05,$1c72 - $1c05 + INCROM $1c05, $1c72 ; returns [hWhoseTurn] <-- ([hWhoseTurn] ^ $1) ; As a side effect, this also returns a duelist variable in a similar manner to @@ -3647,22 +3647,22 @@ Func_1d91: ; 1d91 (0:1d91) ret ; 0x1da4 -INCBIN "baserom.gbc",$1da4,$1dca - $1da4 + INCROM $1da4, $1dca ; memcpy(HL, DE, C) ; if LCD on, copy during h-blank only SafeCopyDataDEtoHL: ; 1dca (0:1dca) ld a, [wLCDC] ; bit 7, a ; - jr nz, .asm_1dd8 ; assert that LCD is on -.asm_1dd1 + jr nz, .lcd_on ; assert that LCD is on +.lcd_off_loop ld a, [de] inc de ld [hli], a dec c - jr nz, .asm_1dd1 + jr nz, .lcd_off_loop ret -.asm_1dd8 +.lcd_on jp HblankCopyDataDEtoHL ; calculates $9800 + SCREEN_WIDTH * e + d to map the screen coordinates at de @@ -4003,7 +4003,7 @@ Func_1f5f: ; 1f5f (0:1f5f) ret ; 0x1f96 -INCBIN "baserom.gbc",$1f96,$20b0 - $1f96 + INCROM $1f96, $20b0 Func_20b0: ; 20b0 (0:20b0) ld hl, $2fe8 @@ -4077,7 +4077,7 @@ asm_2121 ret ; 0x212f -INCBIN "baserom.gbc",$212f,$2167 - $212f + INCROM $212f, $2167 Func_2167: ; 2167 (0:2167) ld l, a @@ -4097,7 +4097,7 @@ Func_2167: ; 2167 (0:2167) jp Func_1f5f ; 0x2189 -INCBIN "baserom.gbc",$2189,$21c5 - $2189 + INCROM $2189, $21c5 Func_21c5: ; 21c5 (0:21c5) push de @@ -4504,7 +4504,7 @@ Func_23d3: ; 23d3 (0:23d3) ret ; 0x23fd -INCBIN "baserom.gbc",$23fd,$245d - $23fd + INCROM $23fd, $245d Func_245d: ; 245d (0:245d) push de @@ -4724,7 +4724,7 @@ Func_256d: ; 256d (0:256d) ret ; 0x2589 -INCBIN "baserom.gbc",$2589,$2636 - $2589 + INCROM $2589, $2636 ; initializes cursor parameters given the 8 bytes starting at hl, ; which represent the following: @@ -4955,14 +4955,14 @@ Func_271a: ; 271a (0:271a) ret ; 0x278d -INCBIN "baserom.gbc",$278d,$29f5 - $278d + INCROM $278d, $29f5 Func_29f5: ; 29f5 (0:29f5) farcallx $6, $4000 ret ; 0x29fa -INCBIN "baserom.gbc",$29fa,$2a00 - $29fa + INCROM $29fa, $2a00 Func_2a00: ; 2a00 (0:2a00) call DoFrame @@ -4999,7 +4999,7 @@ Func_2a1a: ; 2a1a (0:2a1a) ret ; 0x2a30 -INCBIN "baserom.gbc",$2a30,$2a36 - $2a30 + INCROM $2a30, $2a36 Func_2a36: ; 2a36 (0:2a36) push hl @@ -5086,7 +5086,7 @@ WaitForWideTextBoxInput: ; 2aae (0:2aae) WideTextBoxPromptCursorData: ; 2ac8 (0:2ac8) db $12, $11, $1, $1, $2f, $1d, $0, $0 -INCBIN "baserom.gbc",$2ad0,$2af0 - $2ad0 + INCROM $2ad0, $2af0 Func_2af0: ; 2af0 (0:2af0) call DrawWideTextBox_PrintText @@ -5155,7 +5155,7 @@ Func_2b66: ; 2b66 (0:2b66) ret ; 0x2b70 -INCBIN "baserom.gbc",$2b70,$2b78 - $2b70 + INCROM $2b70, $2b78 ; loads opponent deck to wOpponentDeck LoadOpponentDeck: ; 2b78 (0:2b78) @@ -5300,7 +5300,7 @@ Func_2c29: ; 2c29 (0:2c29) ret ; 0x2c37 -INCBIN "baserom.gbc",$2c37,$2c73 - $2c37 + INCROM $2c37, $2c73 Func_2c73: ; 2c73 (0:2c73) xor a @@ -5668,7 +5668,7 @@ PrintTextBoxBorderLabel: ; 2e89 (0:2e89) jp PrintPlayerName ; 0x2ea9 -INCBIN "baserom.gbc",$2ea9,$2ebb - $2ea9 + INCROM $2ea9, $2ebb Func_2ebb: ; 2ebb (0:2ebb) ld a, l @@ -5685,7 +5685,7 @@ Func_2ec4: ; 2ec4 (0:2ec4) ret ; 0x2ecd -INCBIN "baserom.gbc",$2ecd,$2f0a - $2ecd + INCROM $2ecd, $2f0a ; load data of card with id at e to wLoadedCard1 or wLoadedCard2 LoadCardDataToBuffer2: ; 2f0a (0:2f0a) @@ -6434,7 +6434,7 @@ HandleDamageReductionExceptSubstatus2: ; 3269 (0:3269) ret ; 0x32f7 -INCBIN "baserom.gbc",$32f7,$33c1 - $32f7 + INCROM $32f7, $33c1 ; return carry if card is under a condition that makes it unable to attack ; also return in hl the text id to be displayed @@ -6726,7 +6726,7 @@ Func_3525: ; 3525 (0:3525) ret ; 0x356a -INCBIN "baserom.gbc",$356a,$35e6 - $356a + INCROM $356a, $35e6 ; if swords dance or focus energy was used this turn, ; mark that the base power of the next turn's attack has to be doubled @@ -6762,7 +6762,7 @@ UpdateSubstatusConditions: ; 35fa (0:35fa) ret ; 0x3615 -INCBIN "baserom.gbc",$3615,$363b - $3615 + INCROM $3615, $363b ; if the target card's HP is 0 and the attacking card's HP is not, ; the attacking card faints if it was affected by destiny bond @@ -6859,7 +6859,7 @@ ApplyStrikesBack: ; 36a2 (0:36a2) ret ; 0x36d9 -INCBIN "baserom.gbc",$36d9,$36f6 - $36d9 + INCROM $36d9, $36f6 Func_36f6: ; 36f6 (0:36f6) xor a @@ -6898,7 +6898,7 @@ Func_36f7: ; 36f7 (0:36f7) ret ; 0x3729 -INCBIN "baserom.gbc",$3729,$3730 - $3729 + INCROM $3729, $3730 Func_3730: ; 3730 (0:3730) ld a, DUELVARS_ARENA_CARD_SUBSTATUS3 @@ -6912,7 +6912,7 @@ Func_3730: ; 3730 (0:3730) ret ; 0x3743 -INCBIN "baserom.gbc",$3743,$374a - $3743 + INCROM $3743, $374a Func_374a: ; 374a (0:374a) ld a, DUELVARS_ARENA_CARD_SUBSTATUS4 @@ -6983,7 +6983,7 @@ Func_37a0: ; 37a0 (0:37a0) ret ; 0x37a5 -INCBIN "baserom.gbc",$37a5,$380e - $37a5 + INCROM $37a5, $380e Func_380e: ; 380e (0:380e) ld a, [wd0c1] @@ -7144,7 +7144,7 @@ GetFloorObjectFromPos: ; 3927 (0:3927) ret ; 0x392e -INCBIN "baserom.gbc",$392e,$3946 - $392e + INCROM $392e, $3946 ; puts a floor tile in hc given coords in bc (x,y. measured in tiles) FindFloorTileFromPos: ; 3946 (0:3946) @@ -7173,7 +7173,7 @@ Func_395a: ; 395a (0:395a) ret Unknown_396b: ; 396b (0:396b) -INCBIN "baserom.gbc",$396b,$3973 - $396b + INCROM $396b, $3973 ; Movement offsets for scripted movements ScriptedMovementOffsetTable: ; 3973 (0:3973) @@ -7183,7 +7183,7 @@ ScriptedMovementOffsetTable: ; 3973 (0:3973) db -$02, $00 ; move 2 tiles left Unknown_397b: ; 397b (0:397b) -INCBIN "baserom.gbc",$397b,$3997 - $397b + INCROM $397b, $3997 Func_3997: ; 3997 (0:3997) ldh a, [hBankROM] @@ -7251,7 +7251,7 @@ Func_39c3: ; 39c3 (0:39c3) ret ; 0x39ea -INCBIN "baserom.gbc",$39ea,$39fc - $39ea + INCROM $39ea, $39fc Func_39fc: ; 39fc (0:39fc) push hl @@ -7304,7 +7304,7 @@ Func_3a40: ; 3a40 (0:3a40) ret ; 0x3a45 -INCBIN "baserom.gbc",$3a45,$3a5e - $3a45 + INCROM $3a45, $3a5e Func_3a5e: ; 3a5e (0:3a5e) ldh a, [hBankROM] @@ -7398,7 +7398,7 @@ Func_3abd: ; 3abd (0:3abd) ret ; 0x3ae8 -INCBIN "baserom.gbc",$3ae8,$3aed - $3ae8 + INCROM $3ae8, $3aed ; finds an OWScript from the first byte and puts the next two bytes (usually arguments?) into cb RunOverworldScript: ; 3aed (0:3aed) @@ -7429,7 +7429,7 @@ RunOverworldScript: ; 3aed (0:3aed) jp hl ; 0x3b11 -INCBIN "baserom.gbc",$3b11,$3b21 - $3b11 + INCROM $3b11, $3b21 Func_3b21: ; 3b21 (0:3b21) ldh a, [hBankROM] @@ -7511,7 +7511,7 @@ Func_3b6a: ; 3b6a (0:3b6a) ret ; 0x3ba2 -INCBIN "baserom.gbc",$3ba2,$3bd2 - $3ba2 + INCROM $3ba2, $3bd2 ; writes from hl the pointer to the function to be called by DoFrame SetDoFrameFunction: ; 3bd2 (0:3bd2) @@ -7529,7 +7529,7 @@ ResetDoFrameFunction: ; 3bdb (0:3bdb) ret ; 0x3be4 -INCBIN "baserom.gbc",$3be4,$3bf5 - $3be4 + INCROM $3be4, $3bf5 Func_3bf5: ; 3bf5 (0:3bf5) ldh a, [hBankROM] @@ -7548,13 +7548,13 @@ Func_3bf5: ; 3bf5 (0:3bf5) ret ; 0x3c10 -INCBIN "baserom.gbc",$3c10,$3c45 - $3c10 + INCROM $3c10, $3c45 Func_3c45: ; 3c45 (0:3c45) jp hl ; 0x3c46 -INCBIN "baserom.gbc",$3c46,$3c48 - $3c46 + INCROM $3c46, $3c48 DoFrameIfLCDEnabled: ; 3c48 (0:3c48) push af @@ -7609,7 +7609,7 @@ Func_3c83: ; 3c83 (0:3c83) ret ; 0x3c87 -INCBIN "baserom.gbc",$3c87,$3c96 - $3c87 + INCROM $3c87, $3c96 Func_3c96: ; 3c96 (0:3c96) call DoFrameIfLCDEnabled @@ -7643,7 +7643,7 @@ Func_3cb4: ; 3cb4 (0:3cb4) ret ; 0x3cc4 -INCBIN "baserom.gbc",$3cc4,$3d72 - $3cc4 + INCROM $3cc4, $3d72 Func_3d72: ; 3d72 (0:3d72) ldh a, [hBankROM] @@ -7722,7 +7722,7 @@ ModifyUnknownOAMBufferProperty: ; 3dbf (0:3dbf) ret ; 0x3ddb -INCBIN "baserom.gbc",$3ddb,$3df3 - $3ddb + INCROM $3ddb, $3df3 Func_3df3: ; 3df3 (0:3df3) push af @@ -7743,7 +7743,7 @@ Func_3df3: ; 3df3 (0:3df3) ret ; 0x3e10 -INCBIN "baserom.gbc",$3e10,$3e17 - $3e10 + INCROM $3e10, $3e17 Func_3e17: ; 3e17 (0:3e17) ld [wd131], a @@ -7762,7 +7762,7 @@ Func_3e2a: ; 3e2a (0:3e2a) jr Func_3e17 ; 0x3e31 -INCBIN "baserom.gbc",$3e31,$3fe0 - $3e31 + INCROM $3e31, $3fe0 ; jumps to 3f:hl Bankswitch3dTo3f:: ; 3fe0 (0:3fe0) -- cgit v1.2.3 From ce3a715fd4f4e1e28e76f2625fa618a95fb3308e Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 6 Feb 2018 21:29:11 +0100 Subject: Clarify CoordToBGMap0Address functions --- src/engine/bank20.asm | 2 +- src/engine/home.asm | 51 ++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 37 insertions(+), 16 deletions(-) (limited to 'src/engine') diff --git a/src/engine/bank20.asm b/src/engine/bank20.asm index 8405cbd..1630e3b 100755 --- a/src/engine/bank20.asm +++ b/src/engine/bank20.asm @@ -25,7 +25,7 @@ Func_80077: ; 80077 (20:4077) push hl push bc push de - call Func_04cf + call BCCoordToBGMap0Address ld hl, wd4c2 ld [hl], e inc hl diff --git a/src/engine/home.asm b/src/engine/home.asm index 1b2ee82..3d993f9 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -601,7 +601,7 @@ Func_0492: ; 0492 (0:0492) ld b, a ld a, [hli] ld c, a - call Func_04cf + call BCCoordToBGMap0Address jr .asm_49d .asm_49b ld [de], a @@ -630,7 +630,9 @@ SGB_ATTR_BLK_04bf: ; 04bf (0:04bf) sgb ATTR_BLK, 1 ; sgb_command, length db $01,$03,$00,$00,$00,$13,$11,$00,$00,$00,$00,$00,$00,$00,$00 -Func_04cf: ; 04cf (0:04cf) +; returns $9800 + 32 * c + b in de. +; used to map coordinates at bc to a BGMap0 address. +BCCoordToBGMap0Address: ; 04cf (0:04cf) ld l, c ld h, $0 add hl, hl @@ -834,7 +836,7 @@ Func_5c2: ; 5c2 (0:5c2) push bc call Func_0614 pop bc - call Func_04cf + call BCCoordToBGMap0Address pop hl ld b, $02 call JumpToHblankCopyDataHLtoDE @@ -844,7 +846,26 @@ Func_5c2: ; 5c2 (0:5c2) ret ; 0x5db - INCROM $05db, $0614 +Func_5db: ; 5db (0:5db) + push hl + push bc + push de + ld hl, wcaa0 + push hl + push bc + call Func_061b + pop bc + call BCCoordToBGMap0Address + pop hl + ld b, $01 + call JumpToHblankCopyDataHLtoDE + pop de + pop bc + pop hl + ret +; 0x5f4 + + INCROM $05f4, $0614 Func_0614: ; 614 (0:614) push af @@ -910,7 +931,7 @@ Func_06c3: ; 06c3 (0:06c3) push de push bc push af - call Func_04cf + call BCCoordToBGMap0Address pop af ld [de], a pop bc @@ -925,7 +946,7 @@ Func_06c3: ; 06c3 (0:06c3) ld hl, $cac1 push hl ld [hl], a - call Func_04cf + call BCCoordToBGMap0Address pop hl ld b, $1 call HblankCopyDataHLtoDE @@ -3665,9 +3686,9 @@ SafeCopyDataDEtoHL: ; 1dca (0:1dca) .lcd_on jp HblankCopyDataDEtoHL -; calculates $9800 + SCREEN_WIDTH * e + d to map the screen coordinates at de -; to the corresponding BG Map 0 address in VRAM. -CalculateBGMap0Address: ; 1ddb (0:1ddb) +; returns $9800 + 32 * e + d in hl. +; used to map coordinates at de to a BGMap0 address. +DECoordToBGMap0Address: ; 1ddb (0:1ddb) ld l, e ld h, $0 add hl, hl @@ -3783,12 +3804,12 @@ DrawLabeledTextBox: ; 1e00 (0:1e00) jr z, .cgb ; DMG or SGB inc e - call CalculateBGMap0Address + call DECoordToBGMap0Address ; top border done, draw the rest of the text box jr ContinueDrawingTextBoxDMGorSGB .cgb - call CalculateBGMap0Address + call DECoordToBGMap0Address push de call CopyCurrentLineAttrCGB ; BG Map attributes for current line, which is the top border pop de @@ -3807,7 +3828,7 @@ DrawRegularTextBox: ; 1e7c (0:1e7c) jp z, DrawRegularTextBoxSGB ; fallthrough DrawRegularTextBoxDMG: ; 1e88 (0:1e88) - call CalculateBGMap0Address + call DECoordToBGMap0Address ; top line (border) of the text box ld a, $1c ld de, $1819 @@ -3863,7 +3884,7 @@ CopyLine: ; 1ea5 (0:1ea5) ret DrawRegularTextBoxCGB: - call CalculateBGMap0Address + call DECoordToBGMap0Address ; top line (border) of the text box ld a, $1c ld de, $1819 @@ -3964,7 +3985,7 @@ Func_1f5f: ; 1f5f (0:1f5f) push af push hl add sp, $e0 - call CalculateBGMap0Address + call DECoordToBGMap0Address .asm_1f67 push hl push bc @@ -4258,7 +4279,7 @@ Func_22ae: ; 22ae (0:22ae) xor a ldh [$ffae], a ld [wcd09], a - call CalculateBGMap0Address + call DECoordToBGMap0Address ld a, l ldh [$ffaa], a ld a, h -- cgit v1.2.3 From f0b0d33d2e66c8a0e52051eb5e57dec9389ac859 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 6 Feb 2018 21:59:31 +0100 Subject: More bank 0 disassembling --- src/engine/home.asm | 55 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 48 insertions(+), 7 deletions(-) (limited to 'src/engine') diff --git a/src/engine/home.asm b/src/engine/home.asm index 3d993f9..a71fdf1 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -374,7 +374,7 @@ DetectConsole: ; 0349 (0:0349) ret nz ld a, CONSOLE_SGB ld [rSVBK], a - call Func_07e7 + call SwitchToCGBDoubleSpeed ret ; initialize the palettes (both monochrome and color) @@ -827,7 +827,7 @@ CallHL: ; 05c1 (0:05c1) jp hl ; 0x5c2 -Func_5c2: ; 5c2 (0:5c2) +Func_05c2: ; 5c2 (0:5c2) push hl push bc push de @@ -846,7 +846,7 @@ Func_5c2: ; 5c2 (0:5c2) ret ; 0x5db -Func_5db: ; 5db (0:5db) +Func_05db: ; 5db (0:5db) push hl push bc push de @@ -865,7 +865,29 @@ Func_5db: ; 5db (0:5db) ret ; 0x5f4 - INCROM $05f4, $0614 +Func_05f4: ; 5f4 (0:5f4) + push hl + push bc + push de + ld e, l + ld d, h + ld hl, wcaa0 + push hl + push bc + ld a, d + call Func_0614 + ld a, e + call Func_0614 + pop bc + call BCCoordToBGMap0Address + pop hl + ld b, $04 + call JumpToHblankCopyDataHLtoDE + pop de + pop bc + pop hl + ret +; 0x614 Func_0614: ; 614 (0:614) push af @@ -1178,14 +1200,22 @@ BankswitchVRAM: ; 07d6 (0:07d6) ret ; 0x7db - INCROM $07db, $07e7 +SwitchToCGBNormalSpeed: ; 7db (0:7db) + call CheckForCGB + ret c + ld hl, rKEY1 + bit 7, [hl] + ret z + jr CGBSpeedSwitch -Func_07e7: ; 07e7 (0:07e7) +SwitchToCGBDoubleSpeed: ; 07e7 (0:07e7) call CheckForCGB ret c ld hl, rKEY1 bit 7, [hl] ret nz +; fallthrough +CGBSpeedSwitch: ; 07f1 (0:07f1) ld a, [rIE] push af xor a @@ -1525,7 +1555,18 @@ Func_09ce: ; 09ce (0:09ce) ret ; 0x9dc - INCROM $09dc, $09e9 +SwitchToBankAtSP: ; 9dc (0:9dc) + push af + push hl + ld hl, sp+$04 + ld a, [hl] + call BankswitchHome + pop hl + pop af + inc sp + inc sp + ret +; 0x9e9 ; this function affects the stack so that it returns ; to the three byte pointer following the rst call -- cgit v1.2.3 From 2601b21a3846742483b79fbd5e543ab469034534 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 6 Feb 2018 23:14:50 +0100 Subject: Create vram.asm and use generic vram labels --- src/engine/bank1c.asm | 12 ++++++------ src/engine/bank20.asm | 8 ++++---- src/engine/home.asm | 16 ++++++++-------- 3 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src/engine') diff --git a/src/engine/bank1c.asm b/src/engine/bank1c.asm index 7ceb0dc..c7ae122 100755 --- a/src/engine/bank1c.asm +++ b/src/engine/bank1c.asm @@ -80,7 +80,7 @@ Func_700a3: ; 700a3 (1c:40a3) ld a, [hli] ld h, [hl] ld l, a - ld de, $8800 + ld de, vTiles1 call Func_701e9 call Func_701fe ld hl, SGB_700de @@ -96,7 +96,7 @@ Func_700a3: ; 700a3 (1c:40a3) jr z, .asm_700da call Func_70136 dec hl - ld de, $8800 + ld de, vTiles1 call Func_701e9 ld hl, SGB_700ee call Func_70177 @@ -123,10 +123,10 @@ Func_700fe: ; 700fe (1c:40fe) push hl call Func_70136 pop hl - ld de, $8800 + ld de, vTiles1 call Func_701e9 pop hl - ld de, $9000 + ld de, vTiles2 call Func_701e9 call Func_701fe pop hl @@ -212,7 +212,7 @@ Func_701c0: ; 701c0 (1c:41c0) call DisableLCD xor a ld c, $10 - ld hl, $9000 + ld hl, vTiles2 .asm_701cb ld [hli], a dec c @@ -251,7 +251,7 @@ Func_701e9: ; 701e9 (1c:41e9) ret Func_701fe: ; 701fe (1c:41fe) - ld hl, $9800 + ld hl, vBGMapTiles ld de, $000c ld a, $80 ld c, $d diff --git a/src/engine/bank20.asm b/src/engine/bank20.asm index 1630e3b..b551e73 100755 --- a/src/engine/bank20.asm +++ b/src/engine/bank20.asm @@ -65,8 +65,8 @@ Func_801a1: ; 801a1 (20:41a1) push af ld a, $1 call BankswitchRAM - ld hl, $a000 - ld de, $9800 + ld hl, vEnd + ld de, vBGMapTiles ld c, $20 .asm_801b4 push bc @@ -75,7 +75,7 @@ Func_801a1: ; 801a1 (20:41a1) ld b, $20 call SafeCopyDataHLtoDE ld a, [wConsole] - cp $2 + cp CONSOLE_CGB jr nz, .asm_801d6 pop de pop hl @@ -288,7 +288,7 @@ Func_80ba4: ; 80ba4 (20:4ba4) ld c, [hl] inc hl ld a, [wConsole] - cp $2 + cp CONSOLE_CGB jr nz, .asm_80be7 inc hl diff --git a/src/engine/home.asm b/src/engine/home.asm index a71fdf1..4639853 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -422,8 +422,8 @@ SetupVRAM: ; 03a1 (0:03a1) call .asm_3b2 call BankswitchVRAM_0 .asm_3b2 - ld hl, $8000 - ld bc, $1800 + ld hl, vTiles0 + ld bc, vBGMapTiles - vTiles0 .asm_3b8 xor a ld [hli], a @@ -436,8 +436,8 @@ SetupVRAM: ; 03a1 (0:03a1) ; fill VARM tile map banks with [wTileMapFill] FillTileMap: ; 03c0 (0:03c0) call BankswitchVRAM_0 - ld hl, $9800 - ld bc, $0400 + ld hl, vBGMapTiles + ld bc, vBGMapAttrs - vBGMapTiles .asm_3c9 ld a, [wTileMapFill] ld [hli], a @@ -449,8 +449,8 @@ FillTileMap: ; 03c0 (0:03c0) cp CONSOLE_CGB ret nz call BankswitchVRAM_1 - ld hl, $9800 - ld bc, $0400 + ld hl, vBGMapTiles + ld bc, vBGMapAttrs - vBGMapTiles .asm_3e1 xor a ld [hli], a @@ -630,7 +630,7 @@ SGB_ATTR_BLK_04bf: ; 04bf (0:04bf) sgb ATTR_BLK, 1 ; sgb_command, length db $01,$03,$00,$00,$00,$13,$11,$00,$00,$00,$00,$00,$00,$00,$00 -; returns $9800 + 32 * c + b in de. +; returns vBGMapTiles + 32 * c + b in de. ; used to map coordinates at bc to a BGMap0 address. BCCoordToBGMap0Address: ; 04cf (0:04cf) ld l, c @@ -3727,7 +3727,7 @@ SafeCopyDataDEtoHL: ; 1dca (0:1dca) .lcd_on jp HblankCopyDataDEtoHL -; returns $9800 + 32 * e + d in hl. +; returns vBGMapTiles + 32 * e + d in hl. ; used to map coordinates at de to a BGMap0 address. DECoordToBGMap0Address: ; 1ddb (0:1ddb) ld l, e -- cgit v1.2.3 From d62f9ca545f2f62e4e028fc65d8dcc73403a7513 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 6 Feb 2018 23:22:27 +0100 Subject: More VRAM labels --- src/engine/home.asm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/engine') diff --git a/src/engine/home.asm b/src/engine/home.asm index 4639853..96fda66 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -4074,7 +4074,7 @@ Func_20b0: ; 20b0 (0:20b0) jr nz, .asm_20bd ld hl, $37f8 .asm_20bd - ld de, $8d00 + ld de, vTiles1 + $500 ld b, $30 jr asm_2121 @@ -4085,7 +4085,7 @@ Func_20c4: ; 20c4 (0:20c4) jr nz, .asm_20d1 ld hl, $3838 .asm_20d1 - ld de, $8d40 + ld de, vTiles1 + $540 ld b, $c jr asm_2121 @@ -4102,12 +4102,12 @@ asm_20de jr nz, .asm_20eb ld hl, $3af8 .asm_20eb - ld de, $8d00 + ld de, vTiles1 + $500 jr asm_2121 Func_20f0: ; 20f0 (0:20f0) ld hl, $4008 - ld de, $8a00 + ld de, vTiles1 + $200 ld b, $d call asm_2121 ld hl, $3528 @@ -4116,19 +4116,19 @@ Func_20f0: ; 20f0 (0:20f0) jr nz, .asm_2108 ld hl, $3d38 .asm_2108 - ld de, $8d00 + ld de, vTiles1 + $500 ld b, $30 jr asm_2121 Func_210f: ; 210f (0:210f) ld hl, $40d8 - ld de, $9300 + ld de, vTiles2 + $300 ld b, $8 jr asm_2121 Func_2119: ; 2119 (0:2119) ld hl, DuelGraphics - Fonts - ld de, $9000 ; destination + ld de, vTiles2 ; destination ld b, $38 ; number of tiles asm_2121 ld a, BANK(Fonts) -- cgit v1.2.3 From 97214b5a1c961c8d4560ed5cb5cccb0cc4610709 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 6 Feb 2018 23:25:55 +0100 Subject: No need for these GLOBALs, since they're already exported --- src/engine/home.asm | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/engine') diff --git a/src/engine/home.asm b/src/engine/home.asm index 96fda66..e8a115b 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -1,6 +1,3 @@ -GLOBAL CardGraphics -GLOBAL TextOffsets - ; rst vectors SECTION "rst00",ROM0[0] ret -- cgit v1.2.3 From c9882cfbb4456339e36a953dd1212bfa5c164e0e Mon Sep 17 00:00:00 2001 From: xCrystal Date: Wed, 7 Feb 2018 12:09:00 +0100 Subject: more home disassembly --- src/engine/home.asm | 106 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 100 insertions(+), 6 deletions(-) (limited to 'src/engine') diff --git a/src/engine/home.asm b/src/engine/home.asm index e8a115b..2724a66 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -938,13 +938,54 @@ Func_0686: ; 0686 (0:0686) ret ; 0x695 - INCROM $0695, $06c3 +Func_0695: ; 0695 (0:0695) + call Func_069d + bit 7, [hl] + jr z, Func_0695 + ret +; 0x69d + +Func_069d: ; 069d (0:069d) + ld b, [hl] + inc hl + ld c, [hl] + inc hl + push hl + push bc + ld b, $ff +.asm_6a5 + inc b + ld a, [hli] + or a + jr nz, .asm_6a5 + ld a, b + pop bc + push af + call BCCoordToBGMap0Address + pop af + ld b, a + pop hl + or a + jr z, .asm_6bd + push bc + push hl + call SafeCopyDataHLtoDE + pop hl + pop bc + +.asm_6bd + inc b + ld c, b + ld b, $0 + add hl, bc + ret +; 0x6c3 Func_06c3: ; 06c3 (0:06c3) push af ld a, [wLCDC] rla - jr c, .asm_6d8 + jr c, .lcd_on pop af push hl push de @@ -957,12 +998,12 @@ Func_06c3: ; 06c3 (0:06c3) pop de pop hl ret -.asm_6d8 +.lcd_on pop af push hl push de push bc - ld hl, $cac1 + ld hl, wcac1 push hl ld [hl], a call BCCoordToBGMap0Address @@ -975,7 +1016,19 @@ Func_06c3: ; 06c3 (0:06c3) ret ; 0x6ee - INCROM $06ee, $06fc +; copy a bytes of data from hl to vBGMap0 address pointed to by coord at bc +Func_06ee: ; 06ee (0:06ee) + push bc + push hl + push af + call BCCoordToBGMap0Address + pop af + ld b, a + pop hl + call SafeCopyDataHLtoDE + pop bc + ret +; 0x6fc ; memcpy(DE, HL, B) ; if LCD on, copy during h-blank only @@ -1770,7 +1823,48 @@ SGB_MLT_REQ_2: ; 0bbb (0:0bbb) sgb MLT_REQ, 1 ; sgb_command, length db $01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 - INCROM $0bcb, $0c08 +Func_0bcb: ; 0bcb (0:0bcb) + di + push de +.wait_vbalnk + ld a, [rLY] + cp LY_VBLANK + 3 + jr nz, .wait_vbalnk + ld a, $43 + ld [rLCDC], a + ld a, $e4 + ld [rBGP], a + ld de, vTiles1 + ld bc, vBGMapTiles - vTiles1 +.loop + ld a, [hli] + ld [de], a + inc de + dec bc + ld a, b + or c + jr nz, .loop + ld hl, vBGMapTiles + ld de, $000c + ld a, $80 + ld c, $d +.asm_bf3 + ld b, $14 +.asm_bf5 + ld [hli], a + inc a + dec b + jr nz, .asm_bf5 + add hl, de + dec c + jr nz, .asm_bf3 + ld a, $c3 + ld [rLCDC], a + pop hl + call SendSGB + ei + ret +; 0xc08 ; loops 63000 * bc cycles (~15 * bc ms) Wait: ; 0c08 (0:0c08) -- cgit v1.2.3 From 36b4e13058b2e88a499cc88cc56763ce90d01bf6 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Wed, 7 Feb 2018 12:53:22 +0100 Subject: Create linkerscript --- src/engine/home.asm | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/engine') diff --git a/src/engine/home.asm b/src/engine/home.asm index 2724a66..b3d89f1 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -1,39 +1,39 @@ ; rst vectors -SECTION "rst00",ROM0[0] +SECTION "rst00", ROM0 ret -SECTION "rst08",ROM0[8] +SECTION "rst08", ROM0 ret -SECTION "rst10",ROM0[$10] +SECTION "rst10", ROM0 ret -SECTION "rst18",ROM0[$18] +SECTION "rst18", ROM0 jp RST18 -SECTION "rst20",ROM0[$20] +SECTION "rst20", ROM0 jp RST20 -SECTION "rst28",ROM0[$28] +SECTION "rst28", ROM0 jp RST28 -SECTION "rst30",ROM0[$30] +SECTION "rst30", ROM0 ret -SECTION "rst38",ROM0[$38] +SECTION "rst38", ROM0 ret ; interrupts -SECTION "vblank",ROM0[$40] +SECTION "vblank", ROM0 jp VBlankHandler -SECTION "lcdc",ROM0[$48] +SECTION "lcdc", ROM0 call wLCDCFunctiontrampoline reti -SECTION "timer",ROM0[$50] +SECTION "timer", ROM0 jp TimerHandler -SECTION "serial",ROM0[$58] +SECTION "serial", ROM0 jp SerialHandler -SECTION "joypad",ROM0[$60] +SECTION "joypad", ROM0 reti -SECTION "romheader",ROM0[$100] +SECTION "romheader", ROM0 nop jp Start -SECTION "start",ROM0[$150] +SECTION "start", ROM0 Start: ; 0150 (0:0150) di ld sp, $fffe -- cgit v1.2.3 From 716d5c5e521be2310e62e5d6a01f751428b7c190 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Wed, 7 Feb 2018 13:54:19 +0100 Subject: More home disassembly --- src/engine/home.asm | 87 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 75 insertions(+), 12 deletions(-) (limited to 'src/engine') diff --git a/src/engine/home.asm b/src/engine/home.asm index b3d89f1..738f84a 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -210,7 +210,7 @@ CheckForCGB: ; 025c (0:025c) WaitForVBlank: ; 0264 (0:0264) push hl ld a, [wLCDC] - bit 7, a + bit rLCDC_ENABLE, a jr z, .asm_275 ld hl, wVBlankCtr ld a, [hl] @@ -226,9 +226,9 @@ WaitForVBlank: ; 0264 (0:0264) ; turn LCD on EnableLCD: ; 0277 (0:0277) ld a, [wLCDC] ; - bit 7, a ; + bit rLCDC_ENABLE, a ; ret nz ; assert that LCD is off - or $80 ; + or rLCDC_ENABLE_MASK ; ld [wLCDC], a ; ld [rLCDC], a ; turn LCD on ld a, $c0 @@ -238,7 +238,7 @@ EnableLCD: ; 0277 (0:0277) ; wait for vblank, then turn LCD off DisableLCD: ; 028a (0:028a) ld a, [rLCDC] ; - bit 7, a ; + bit rLCDC_ENABLE, a ; ret z ; assert that LCD is on ld a, [rIE] ld [wIE], a @@ -2297,7 +2297,33 @@ Func_0ebf: ; 0ebf (0:0ebf) ret ; 0xed5 - INCROM $0ed5, $0f35 +Func_0ed5: ; 0ed5 (0:0ed5) + push bc +.asm_ed6 + call Func_0e39 + jr nc, .asm_edf + halt + nop + jr .asm_ed6 +.asm_edf + ld [hli], a + ld a, [wSerialFlags] + or a + jr nz, .asm_eee + dec bc + ld a, c + or b + jr nz, .asm_ed6 + pop bc + or a + ret +.asm_eee + pop bc + scf + ret +; 0xef1 + + INCROM $0ef1, $0f35 Func_0f35: ; 0f35 (0:0f35) ld a, [wSerialFlags] @@ -2358,7 +2384,17 @@ Func_0f7f: ; 0f7f (0:0f7f) ret ; 0xf9b - INCROM $0f9b, $0fac +Func_0f9b: ; 0f9b (0:0f9b) + push hl + push bc + ld hl, $ff9e + ld bc, $000a + call Func_0ed5 + call Func_0f58 + pop bc + pop hl + ret +; 0xfac Func_0fac: ; 0fac (0:0fac) push hl @@ -2381,7 +2417,7 @@ Func_0fac: ; 0fac (0:0fac) push de push hl push af - ld hl, $cbed + ld hl, wcbed pop de ld [hl], e inc hl @@ -2400,7 +2436,7 @@ Func_0fac: ; 0fac (0:0fac) ld [hl], c inc hl ld [hl], b - ld hl, $cbed + ld hl, wcbed ld bc, $0008 call Func_0ebf jp c, Func_0f35 @@ -2411,7 +2447,34 @@ Func_0fac: ; 0fac (0:0fac) ret ; 0xfe9 - INCROM $0fe9, $100b +Func_0fe9: ; 0fe9 (0:0fe9) + ld hl, wcbed + ld bc, $0008 + push hl + call Func_0ed5 + jp c, Func_0f35 + pop hl + ld e, [hl] + inc hl + ld d, [hl] + inc hl + push de + ld e, [hl] + inc hl + ld d, [hl] + inc hl + push de + ld e, [hl] + inc hl + ld d, [hl] + inc hl + ld c, [hl] + inc hl + ld b, [hl] + pop hl + pop af + ret +; 0x100b Func_100b: ; 100b (0:100b) ld a, $2 @@ -3806,8 +3869,8 @@ Func_1d91: ; 1d91 (0:1d91) ; if LCD on, copy during h-blank only SafeCopyDataDEtoHL: ; 1dca (0:1dca) ld a, [wLCDC] ; - bit 7, a ; - jr nz, .lcd_on ; assert that LCD is on + bit rLCDC_ENABLE, a ; + jr nz, .lcd_on ; assert that LCD is on .lcd_off_loop ld a, [de] inc de @@ -7712,7 +7775,7 @@ Func_3c45: ; 3c45 (0:3c45) DoFrameIfLCDEnabled: ; 3c48 (0:3c48) push af ld a, [rLCDC] - bit 7, a + bit rLCDC_ENABLE, a jr z, .done push bc push de -- cgit v1.2.3 From 3eae724c07856e96c36539eb7fc0288bae0265c4 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Wed, 7 Feb 2018 16:40:39 +0100 Subject: Prefer snake_case for local labels (home.asm) --- src/engine/home.asm | 352 ++++++++++++++++++++++++++-------------------------- 1 file changed, 176 insertions(+), 176 deletions(-) (limited to 'src/engine') diff --git a/src/engine/home.asm b/src/engine/home.asm index 738f84a..072e5dd 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -734,13 +734,13 @@ DoFrame: ; 053f (0:053f) ldh a, [hButtonsPressed] and SELECT jr z, .done -.gamePausedLoop +.game_paused_loop call WaitForVBlank call ReadJoypad call HandleDPadRepeat ldh a, [hButtonsPressed] and SELECT - jr z, .gamePausedLoop + jr z, .game_paused_loop .done pop bc pop de @@ -2373,12 +2373,12 @@ Func_0f7f: ; 0f7f (0:0f7f) ld a, DUELVARS_DUELIST_TYPE call GetNonTurnDuelistVariable cp DUELIST_TYPE_LINK_OPP - jr nz, .notLink + jr nz, .not_link ld hl, $ff9e ld bc, $000a call Func_0ebf call Func_0f58 -.notLink +.not_link pop bc pop hl ret @@ -2533,9 +2533,9 @@ CopyDeckData: ; 1072 (0:1072) ld hl, wPlayerDeck ldh a, [hWhoseTurn] cp PLAYER_TURN - jr z, .copyDeckData + jr z, .copy_deck_data ld hl, wOpponentDeck -.copyDeckData +.copy_deck_data ; start by putting a terminator at the end of the deck push hl ld bc, DECK_SIZE - 1 @@ -2543,7 +2543,7 @@ CopyDeckData: ; 1072 (0:1072) ld [hl], $0 pop hl push hl -.nextCard +.next_card ld a, [de] inc de ld b, a @@ -2552,12 +2552,12 @@ CopyDeckData: ; 1072 (0:1072) ld a, [de] inc de ld c, a -.cardQuantityLoop +.card_quantity_loop ld [hl], c inc hl dec b - jr nz, .cardQuantityLoop - jr .nextCard + jr nz, .card_quantity_loop + jr .next_card .done ld hl, $cce9 ld a, [de] @@ -2616,7 +2616,7 @@ DrawCardFromDeck: ; 10cf (0:10cf) ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK call GetTurnDuelistVariable cp DECK_SIZE - jr nc, .emptyDeck + jr nc, .empty_deck inc a ld [hl], a ; increment number of cards not in deck add DUELVARS_DECK_CARDS - 1 ; point to top card in the deck @@ -2628,7 +2628,7 @@ DrawCardFromDeck: ; 10cf (0:10cf) or a ret -.emptyDeck +.empty_deck pop hl scf ret @@ -2667,21 +2667,21 @@ AddCardToHand: ; 1123 (0:1123) CreateHandCardBuffer: ; 123b (0:123b) call FindLastCardInHand inc b - jr .skipCard + jr .skip_card -.checkNextCardLoop +.check_next_card_loop ld a, [hld] push hl ld l, a bit 6, [hl] pop hl - jr nz, .skipCard + jr nz, .skip_card ld [de], a inc de -.skipCard +.skip_card dec b - jr nz, .checkNextCardLoop + jr nz, .check_next_card_loop ld a, $ff ld [de], a ld l, (wPlayerNumberOfCardsInHand & $ff) @@ -2720,7 +2720,7 @@ ShuffleCards: ; 127f (0:127f) ld b, a ld e, l ld d, h -.shuffleNextCardLoop +.shuffle_next_card_loop push bc push de ld a, c @@ -2739,7 +2739,7 @@ ShuffleCards: ; 127f (0:127f) pop bc inc hl dec b - jr nz, .shuffleNextCardLoop + jr nz, .shuffle_next_card_loop pop bc pop de pop hl @@ -2789,9 +2789,9 @@ _GetCardInDeckPosition: ; 1362 (0:1362) ld hl, wPlayerDeck ldh a, [hWhoseTurn] cp PLAYER_TURN - jr z, .loadCardFromDeck + jr z, .load_card_from_deck ld hl, wOpponentDeck -.loadCardFromDeck +.load_card_from_deck add hl, de ld a, [hl] pop de @@ -2837,7 +2837,7 @@ Func_1485: ; 1485 (0:1485) ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY call GetTurnDuelistVariable cp MAX_POKEMON_IN_PLAY - jr nc, .tooManyPokemonInPlay + jr nc, .too_many_pokemon_in_play inc [hl] ld e, a pop af @@ -2882,7 +2882,7 @@ Func_1485: ; 1485 (0:1485) or a ret -.tooManyPokemonInPlay +.too_many_pokemon_in_play pop af scf ret @@ -2902,10 +2902,10 @@ GetAttachedEnergies: ; 159f (0:159f) xor a ld c, NUM_TYPES ld hl, wAttachedEnergies -.zeroEnergiesLoop +.zero_energies_loop ld [hli], a dec c - jr nz, .zeroEnergiesLoop + jr nz, .zero_energies_loop ld a, CARD_LOCATION_ARENA or e ; if e is non-0, arena is not the only location that counts ld e, a @@ -2913,10 +2913,10 @@ GetAttachedEnergies: ; 159f (0:159f) ld h, a ld l, DUELVARS_CARD_LOCATIONS ld c, DECK_SIZE -.nextCard +.next_card ld a, [hl] cp e - jr nz, .notInRequestedLocation + jr nz, .not_in_requested_location push hl push de @@ -2925,7 +2925,7 @@ GetAttachedEnergies: ; 159f (0:159f) call LoadDeckCardToBuffer2 ld a, [wLoadedCard2Type] bit ENERGY_CARD_F, a - jr z, .notAnEnergyCard + jr z, .not_an_energy_card and $7 ; zero bit 3 to extract the type ld e, a ld d, $0 @@ -2933,18 +2933,18 @@ GetAttachedEnergies: ; 159f (0:159f) add hl, de inc [hl] ; increment the number of energy cards of this type cp COLORLESS - jr nz, .notColorless + jr nz, .not_colorless inc [hl] ; each colorless energy counts as two -.notAnEnergyCard -.notColorless +.not_an_energy_card +.not_colorless pop bc pop de pop hl -.notInRequestedLocation +.not_in_requested_location inc l dec c - jr nz, .nextCard + jr nz, .next_card ; all 60 cards checked ld hl, wAttachedEnergies ld c, NUM_TYPES @@ -2969,22 +2969,22 @@ CountCardIDInLocation: ; 15ef (0:15ef) push bc ld l, $0 ld c, $0 -.nextCard +.next_card ld a, [hl] cp b - jr nz, .unmatchingCardLocationOrID + jr nz, .unmatching_card_location_orID ld a, l push hl call _GetCardInDeckPosition cp e pop hl - jr nz, .unmatchingCardLocationOrID + jr nz, .unmatching_card_location_orID inc c -.unmatchingCardLocationOrID +.unmatching_card_location_orID inc l ld a, l cp DECK_SIZE - jr c, .nextCard + jr c, .next_card ld a, c pop bc ret @@ -3024,17 +3024,17 @@ CopyMoveDataAndDamageToBuffer: ; 16c0 (0:16c0) ld [wTempCardId], a ld hl, wLoadedCard1Move1 dec e - jr nz, .gotMove + jr nz, .got_move ld hl, wLoadedCard1Move2 -.gotMove +.got_move ld de, wLoadedMove ld c, wLoadedCard1Move2 - wLoadedCard1Move1 -.copyLoop +.copy_loop ld a, [hli] ld [de], a inc de dec c - jr nz, .copyLoop + jr nz, .copy_loop ld a, [wLoadedMoveDamage] ld hl, wDamage ld [hli], a @@ -3299,12 +3299,12 @@ CheckSelfConfusionDamage: ; 18d7 (0:18d7) .confused text_de ConfusionCheckDamageText call TossCoin - jr c, .noConfusionDamage + jr c, .no_confusion_damage ld a, $1 ld [wccc9], a scf ret -.noConfusionDamage +.no_confusion_damage or a ret ; 0x18f9 @@ -3345,10 +3345,10 @@ Func_1994: ; 1994 (0:1994) ld hl, wDamage ld a, [hli] or [hl] - jr nz, .nonZeroDamage + jr nz, .non_zero_damage ld de, $0000 ret -.nonZeroDamage +.non_zero_damage xor a ld [$ff9d], a ld d, [hl] @@ -3360,7 +3360,7 @@ Func_1994: ; 1994 (0:1994) xor a ld [wccc1], a call HandleDoubleDamageSubstatus - jr .checkPluspowerAndDefender + jr .check_pluspower_and_defender .safe call HandleDoubleDamageSubstatus ld a, e @@ -3384,14 +3384,14 @@ Func_1994: ; 1994 (0:1994) call Func_374a call SwapTurn and b - jr z, .checkPluspowerAndDefender + jr z, .check_pluspower_and_defender ld hl, $ffe2 add hl, de ld e, l ld d, h ld hl, $ccc1 set 2, [hl] -.checkPluspowerAndDefender +.check_pluspower_and_defender ld b, CARD_LOCATION_ARENA call ApplyAttachedPluspower call SwapTurn @@ -3399,9 +3399,9 @@ Func_1994: ; 1994 (0:1994) call ApplyAttachedDefender call HandleDamageReduction bit 7, d - jr z, .noUnderflow + jr z, .no_underflow ld de, $0000 -.noUnderflow +.no_underflow call SwapTurn ret @@ -3426,7 +3426,7 @@ Func_1a22: ; 1a22 (0:1a22) ld a, [hli] or [hl] or a - jr z, .noDamage + jr z, .no_damage ld d, [hl] dec hl ld e, [hl] @@ -3457,7 +3457,7 @@ Func_1a22: ; 1a22 (0:1a22) call ApplyAttachedDefender bit 7, d ; test for underflow ret z -.noDamage +.no_damage ld de, $0000 ret @@ -3506,9 +3506,9 @@ SubstractHP: ; 1a96 (0:1a96) ld a, $0 sbc d and $80 - jr z, .noUnderflow + jr z, .no_underflow ld [hl], $0 -.noUnderflow +.no_underflow ld a, [hl] or a jr z, .zero @@ -3661,18 +3661,18 @@ PrintOpponentName: ; 1c8e (0:1c8e) ld hl, $cc16 ld a, [hli] or [hl] - jr z, .specialName + jr z, .special_name ld a, [hld] ld l, [hl] ld h, a jp PrintTextBoxBorderLabel -.specialName +.special_name ld hl, $c500 ld a, [hl] or a - jr z, .printPlayer2 + jr z, .print_player2 jr printNameLoop -.printPlayer2 +.print_player2 text_hl Player2 jp PrintTextBoxBorderLabel @@ -3925,20 +3925,20 @@ AdjustCoordinatesForWindow: ; 1deb (0:1deb) DrawLabeledTextBox: ; 1e00 (0:1e00) ld a, [wConsole] cp CONSOLE_SGB - jr nz, .drawTopBorder + jr nz, .draw_top_border ld a, [wFrameType] or a - jr z, .drawTopBorder + jr z, .draw_top_border ; Console is SGB and frame type is != 0. ; The text box will be colorized so a SGB command needs to be transferred push de push bc - call .drawTopBorder ; this falls through to drawing the whole box + call .draw_top_border ; this falls through to drawing the whole box pop bc pop de jp ColorizeTextBoxSGB -.drawTopBorder +.draw_top_border push de push bc push hl @@ -3969,17 +3969,17 @@ DrawLabeledTextBox: ; 1e00 (0:1e00) ld a, d sub b sub $4 - jr z, .drawTopBorderRightTile + jr z, .draw_top_border_right_tile ld b, a -.drawTopBorderLineLoop +.draw_top_border_line_loop ld a, $5 ld [hli], a ld a, $1c ld [hli], a dec b - jr nz, .drawTopBorderLineLoop + jr nz, .draw_top_border_line_loop -.drawTopBorderRightTile +.draw_top_border_right_tile ld a, $5 ld [hli], a ld a, $19 @@ -4031,12 +4031,12 @@ DrawRegularTextBoxDMG: ; 1e88 (0:1e88) ContinueDrawingTextBoxDMGorSGB dec c dec c -.drawTextBoxBodyLoop +.draw_text_box_body_loop ld a, $0 ld de, $1e1f call CopyLine dec c - jr nz, .drawTextBoxBodyLoop + jr nz, .draw_text_box_body_loop ; bottom line (border) of the text box ld a, $1d ld de, $1a1b @@ -4087,7 +4087,7 @@ DrawRegularTextBoxCGB: ContinueDrawingTextBoxCGB dec c dec c -.drawTextBoxBodyLoop +.draw_text_box_body_loop ld a, $0 ld de, $1e1f push hl @@ -4101,7 +4101,7 @@ ContinueDrawingTextBoxCGB call CopyLine call BankswitchVRAM_0 dec c - jr nz, .drawTextBoxBodyLoop + jr nz, .draw_text_box_body_loop ; bottom line (border) of the text box ld a, $1d ld de, $1a1b @@ -4140,12 +4140,12 @@ ColorizeTextBoxSGB ld hl, $cae0 ld de, SGB_ATTR_BLK_1f4f ld c, $10 -.copySGBCommandLoop +.copy_sgb_command_loop ld a, [de] inc de ld [hli], a dec c - jr nz, .copySGBCommandLoop + jr nz, .copy_sgb_command_loop pop de pop bc ld hl, $cae4 @@ -5263,12 +5263,12 @@ DrawNarrowTextBox_WaitForInput: ; 2a7c (0:2a7c) ld hl, NarrowTextBoxPromptCursorData call InitializeCursorParameters call EnableLCD -.waitAorBLoop +.wait_aorBLoop call DoFrame call HandleTextBoxInput ldh a, [hButtonsPressed] and A_BUTTON | B_BUTTON - jr z, .waitAorBLoop + jr z, .wait_aorBLoop ret NarrowTextBoxPromptCursorData: ; 2a96 (0:2a96) @@ -5290,12 +5290,12 @@ WaitForWideTextBoxInput: ; 2aae (0:2aae) ld hl, WideTextBoxPromptCursorData call InitializeCursorParameters call EnableLCD -.waitAorBLoop +.wait_aorBLoop call DoFrame call HandleTextBoxInput ldh a, [hButtonsPressed] and A_BUTTON | B_BUTTON - jr z, .waitAorBLoop + jr z, .wait_aorBLoop call EraseCursor ret @@ -5379,17 +5379,17 @@ LoadOpponentDeck: ; 2b78 (0:2b78) ld [wIsPracticeDuel], a ld a, [wOpponentDeckId] cp SAMS_NORMAL_DECK - 2 - jr z, .normalSamDuel + jr z, .normal_sam_duel or a ; cp SAMS_PRACTICE_DECK - 2 - jr nz, .notPracticeDuel + jr nz, .not_practice_duel ; only practice duels will display help messages, but ; any duel with Sam will force the PRACTICE_PLAYER_DECK -;.practiceSamDuel +;.practice_sam_duel inc a ld [wIsPracticeDuel], a -.normalSamDuel +.normal_sam_duel xor a ld [wOpponentDeckId], a call SwapTurn @@ -5403,17 +5403,17 @@ LoadOpponentDeck: ; 2b78 (0:2b78) ld [hl], a xor a -.notPracticeDuel +.not_practice_duel inc a inc a call LoadDeck ld a, [wOpponentDeckId] cp NUMBER_OF_DECKS - jr c, .validDeck + jr c, .valid_deck ld a, PRACTICE_PLAYER_DECK - 2 ld [wOpponentDeckId], a -.validDeck +.valid_deck ; set opponent as controlled by AI ld a, DUELVARS_DUELIST_TYPE call GetTurnDuelistVariable @@ -5796,11 +5796,11 @@ Func_2e2c: ; 2e2c (0:2e2c) push de ldh a, [hWhoseTurn] cp OPPONENT_TURN - jp z, .opponentTurn + jp z, .opponent_turn call PrintPlayerName pop hl ret -.opponentTurn +.opponent_turn call PrintOpponentName pop hl ret @@ -5809,38 +5809,38 @@ Func_2e2c: ; 2e2c (0:2e2c) PrintText: ; 2e41 (0:2e41) ld a, l or h - jr z, .fromRAM + jr z, .from_ram ldh a, [hBankROM] push af call ReadTextOffset - call .printText + call .print_text pop af call BankswitchHome ret -.fromRAM +.from_ram ld hl, wc590 -.printText +.print_text call Func_2cc8 -.nextTileLoop +.next_tile_loop ldh a, [hButtonsHeld] ld b, a ld a, [wTextSpeed] inc a cp $3 - jr nc, .applyDelay + jr nc, .apply_delay ; if text speed is 1, pressing b ignores it bit B_BUTTON_F, b - jr nz, .skipDelay - jr .applyDelay -.textDelayLoop + jr nz, .skip_delay + jr .apply_delay +.text_delay_loop ; wait a number of frames equal to wTextSpeed between printing each text tile call DoFrame -.applyDelay +.apply_delay dec a - jr nz, .textDelayLoop -.skipDelay + jr nz, .text_delay_loop +.skip_delay call Func_2d43 - jr nc, .nextTileLoop + jr nc, .next_tile_loop ret ; prints text with id at hl without letter delay in a textbox area @@ -5849,9 +5849,9 @@ PrintTextNoDelay: ; 2e76 (0:2e76) push af call ReadTextOffset call Func_2cc8 -.nextTileLoop +.next_tile_loop call Func_2d43 - jr nc, .nextTileLoop + jr nc, .next_tile_loop pop af call BankswitchHome ret @@ -5867,12 +5867,12 @@ PrintTextBoxBorderLabel: ; 2e89 (0:2e89) ldh a, [hBankROM] push af call ReadTextOffset -.nextTileLoop +.next_tile_loop ld a, [hli] ld [de], a inc de or a - jr nz, .nextTileLoop + jr nz, .next_tile_loop pop af call BankswitchHome dec de @@ -5923,12 +5923,12 @@ LoadCardDataToRAM: ; 2f14 (0:2f14) ld a, BANK(CardPointers) call BankpushHome2 ld b, PKMN_CARD_DATA_LENGTH -.copyCardDataLoop +.copy_card_data_loop ld a, [hli] ld [de], a inc de dec b - jr nz, .copyCardDataLoop + jr nz, .copy_card_data_loop call BankpopHome or a @@ -5977,7 +5977,7 @@ GetCardHeader: ; 2f5d (0:2f5d) ld d, $00 ld e, a call GetCardPointer - jr c, .cardNotFound + jr c, .card_not_found ld a, $0c call BankpushHome2 ld e, [hl] @@ -5989,7 +5989,7 @@ GetCardHeader: ; 2f5d (0:2f5d) call BankpopHome ld a, e or a -.cardNotFound +.card_not_found pop de pop hl ret @@ -6011,7 +6011,7 @@ GetCardPointer: ; 2f7c (0:2f7c) cp a, (CardPointers + 2 + (2 * NUM_CARDS)) % $100 .nz ccf - jr c, .outOfBounds + jr c, .out_of_bounds ld a, BANK(CardPointers) call BankpushHome2 ld a, [hli] @@ -6019,7 +6019,7 @@ GetCardPointer: ; 2f7c (0:2f7c) ld l,a call BankpopHome or a -.outOfBounds +.out_of_bounds pop bc pop de ret @@ -6043,12 +6043,12 @@ LoadCardGfx: ; 2fa0 (0:2fa0) call CopyGfxData ld b, $8 ; length of palette ld de, $ce23 -.copyCardPalette +.copy_card_palette ld a, [hli] ld [de], a inc de dec b - jr nz, .copyCardPalette + jr nz, .copy_card_palette pop af call BankswitchHome ret @@ -6075,12 +6075,12 @@ TryExecuteEffectCommandFunction: ; 2fd9 (0:2fd9) ld l, a pop af call CheckMatchingCommand - jr nc, .executeFunction + jr nc, .execute_function ; return if no matching command was found or a ret -.executeFunction +.execute_function ; executes the function at [wce22]:hl ldh a, [hBankROM] push af @@ -6105,12 +6105,12 @@ CheckMatchingCommand: ; 2ffe (0:2ffe) ld c, a ld a, l or h - jr nz, .notNullPointer + jr nz, .not_null_pointer ; return c if pointer is $0000 scf ret -.notNullPointer +.not_null_pointer ldh a, [hBankROM] push af ld a, BANK(EffectCommands) @@ -6118,18 +6118,18 @@ CheckMatchingCommand: ; 2ffe (0:2ffe) ; store the bank number of command functions ($b) in wce22 ld a, $b ld [wce22],a -.checkCommandLoop +.check_command_loop ld a, [hli] or a - jr z, .noMoreCommands + jr z, .no_more_commands cp c - jr z, .matchingCommandFound + jr z, .matching_command_found ; skip function pointer for this command and move to the next one inc hl inc hl - jr .checkCommandLoop + jr .check_command_loop -.matchingCommandFound +.matching_command_found ; load function pointer for this command ld a, [hli] ld h, [hl] @@ -6140,7 +6140,7 @@ CheckMatchingCommand: ; 2ffe (0:2ffe) or a ret ; restore bank and return c -.noMoreCommands +.no_more_commands pop af call BankswitchHome scf @@ -6164,14 +6164,14 @@ LoadDeck: ; 302c (0:302c) ld d, [hl] ld a, d or e - jr z, .nullPointer + jr z, .null_pointer call CopyDeckData pop af call BankswitchHome pop hl or a ret -.nullPointer +.null_pointer pop af call BankswitchHome pop hl @@ -6543,19 +6543,19 @@ HandleDamageReduction: ; 3244 (0:3244) or a ret z cp SUBSTATUS2_REDUCE_BY_20 - jr z, .reduceDamageBy20 + jr z, .reduce_damage_by_20 cp SUBSTATUS2_POUNCE - jr z, .reduceDamageBy10 + jr z, .reduce_damage_by_10 cp SUBSTATUS2_GROWL - jr z, .reduceDamageBy10 + jr z, .reduce_damage_by_10 ret -.reduceDamageBy20 +.reduce_damage_by_20 ld hl, -20 add hl, de ld e, l ld d, h ret -.reduceDamageBy10 +.reduce_damage_by_10 ld hl, -10 add hl, de ld e, l @@ -6565,28 +6565,28 @@ HandleDamageReduction: ; 3244 (0:3244) HandleDamageReductionExceptSubstatus2: ; 3269 (0:3269) ld a, [wNoDamageOrEffect] or a - jr nz, .noDamage + jr nz, .no_damage ld a, DUELVARS_ARENA_CARD_SUBSTATUS1 call GetTurnDuelistVariable or a - jr z, .notAffectedBySubstatus1 + jr z, .not_affected_by_substatus1 cp SUBSTATUS1_NO_DAMAGE_STIFFEN - jr z, .noDamage + jr z, .no_damage cp SUBSTATUS1_NO_DAMAGE_10 - jr z, .noDamage + jr z, .no_damage cp SUBSTATUS1_NO_DAMAGE_11 - jr z, .noDamage + jr z, .no_damage cp SUBSTATUS1_NO_DAMAGE_17 - jr z, .noDamage + jr z, .no_damage cp SUBSTATUS1_REDUCE_BY_10 - jr z, .reduceDamageBy10 + jr z, .reduce_damage_by_10 cp SUBSTATUS1_REDUCE_BY_20 - jr z, .reduceDamageBy20 + jr z, .reduce_damage_by_20 cp SUBSTATUS1_HARDEN - jr z, .preventLessThan40Damage + jr z, .prevent_less_than_40_damage cp SUBSTATUS1_HALVE_DAMAGE - jr z, .halveDamage -.notAffectedBySubstatus1 + jr z, .halve_damage +.not_affected_by_substatus1 call CheckIfUnderAnyCannotUseStatus ret c ld a, [wLoadedMoveCategory] @@ -6594,32 +6594,32 @@ HandleDamageReductionExceptSubstatus2: ; 3269 (0:3269) ret z ld a, [wTempNonTurnDuelistCardId] cp MR_MIME - jr z, .preventLessThan30Damage ; invisible wall + jr z, .prevent_less_than_30_damage ; invisible wall cp KABUTO - jr z, .halveDamage2 ; kabuto armor + jr z, .halve_damage2 ; kabuto armor ret -.noDamage +.no_damage ld de, 0 ret -.reduceDamageBy10 +.reduce_damage_by_10 ld hl, -10 add hl, de ld e, l ld d, h ret -.reduceDamageBy20 +.reduce_damage_by_20 ld hl, -20 add hl, de ld e, l ld d, h ret -.preventLessThan40Damage +.prevent_less_than_40_damage ld bc, 40 call CompareDEtoBC ret nc ld de, 0 ret -.halveDamage +.halve_damage sla d rr e bit 0, e @@ -6629,7 +6629,7 @@ HandleDamageReductionExceptSubstatus2: ; 3269 (0:3269) ld e, l ld d, h ret -.preventLessThan30Damage +.prevent_less_than_30_damage ld a, [wLoadedMoveCategory] cp POKEMON_POWER ret z @@ -6638,7 +6638,7 @@ HandleDamageReductionExceptSubstatus2: ; 3269 (0:3269) ret c ld de, 0 ret -.halveDamage2 +.halve_damage2 sla d rr e bit 0, e @@ -6661,16 +6661,16 @@ HandleCantAttackSubstatus: ; 33c1 (0:33c1) ret z text_hl UnableToAttackDueToTailWagText cp SUBSTATUS2_TAIL_WAG - jr z, .returnWithCantAttack + jr z, .return_with_cant_attack text_hl UnableToAttackDueToLeerText cp SUBSTATUS2_LEER - jr z, .returnWithCantAttack + jr z, .return_with_cant_attack text_hl UnableToAttackDueToBoneAttackText cp SUBSTATUS2_BONE_ATTACK - jr z, .returnWithCantAttack + jr z, .return_with_cant_attack or a ret -.returnWithCantAttack +.return_with_cant_attack scf ret @@ -6679,12 +6679,12 @@ HandleAmnesiaSubstatus: ; 33e1 (0:33e1) ld a, DUELVARS_ARENA_CARD_SUBSTATUS2 call GetTurnDuelistVariable or a - jr nz, .checkAmnesia + jr nz, .check_amnesia ret -.checkAmnesia +.check_amnesia cp SUBSTATUS2_AMNESIA jr z, .affectedByAmnesia -.notTheMoveDisabledByAmnesia +.not_the_disabled_move or a ret .affectedByAmnesia @@ -6692,7 +6692,7 @@ HandleAmnesiaSubstatus: ; 33e1 (0:33e1) call GetTurnDuelistVariable ld a, [wSelectedMoveIndex] cp [hl] - jr nz, .notTheMoveDisabledByAmnesia + jr nz, .not_the_disabled_move text_hl UnableToUseAttackDueToAmnesiaText scf ret @@ -6718,13 +6718,13 @@ CheckSandAttackOrSmokescreenSubstatus: ; 3414 (0:3414) ret z text_de SandAttackCheckText cp SUBSTATUS2_SAND_ATTACK - jr z, .cardIsAffected + jr z, .card_is_affected text_de SmokescreenCheckText cp SUBSTATUS2_SMOKESCREEN - jr z, .cardIsAffected + jr z, .card_is_affected or a ret -.cardIsAffected +.card_is_affected ld a, [wcc0a] or a ret nz @@ -6745,29 +6745,29 @@ HandleNoDamageOrEffectSubstatus: ; 3432 (0:3432) ld e, NO_DAMAGE_OR_EFFECT_FLY text_hl NoDamageOrEffectDueToFlyText cp SUBSTATUS1_FLY - jr z, .noDamageOrEffect + jr z, .no_damage_or_effect ld e, NO_DAMAGE_OR_EFFECT_BARRIER text_hl NoDamageOrEffectDueToBarrierText cp SUBSTATUS1_BARRIER - jr z, .noDamageOrEffect + jr z, .no_damage_or_effect ld e, NO_DAMAGE_OR_EFFECT_AGILITY text_hl NoDamageOrEffectDueToAgilityText cp SUBSTATUS1_AGILITY - jr z, .noDamageOrEffect + jr z, .no_damage_or_effect call CheckIfUnderAnyCannotUseStatus ccf ret nc ld a, [wTempNonTurnDuelistCardId] cp MEW1 - jr z, .neutralizingShield + jr z, .neutralizing_shield or a ret -.noDamageOrEffect +.no_damage_or_effect ld a, e ld [wNoDamageOrEffect], a scf ret -.neutralizingShield +.neutralizing_shield ld a, [wcce6] or a ret nz @@ -6780,7 +6780,7 @@ HandleNoDamageOrEffectSubstatus: ; 3432 (0:3432) ret z ld e, NO_DAMAGE_OR_EFFECT_NSHIELD text_hl NoDamageOrEffectDueToNShieldText - jr .noDamageOrEffect + jr .no_damage_or_effect ; if the Pokemon being attacked is Haunter1, and its Transparency is active, ; there is a 50% chance that any damage or effect is prevented @@ -6817,7 +6817,7 @@ CheckNoDamageOrEffect: ; 34b7 (0:34b7) or a ret z bit 7, a - jr nz, .dontPrintText ; already been here so don't repeat the text + jr nz, .dont_print_text ; already been here so don't repeat the text ld hl, wNoDamageOrEffect set 7, [hl] dec a @@ -6832,7 +6832,7 @@ CheckNoDamageOrEffect: ; 34b7 (0:34b7) scf ret -.dontPrintText +.dont_print_text ld hl, $0000 scf ret @@ -6863,14 +6863,14 @@ CheckIfUnderAnyCannotUseStatus: ; 34ef (0:34ef) ; same as above, but if a is non-0, only toxic gas is checked CheckIfUnderAnyCannotUseStatus2: ; 34f0 (0:34f0) or a - jr nz, .checkToxicGas + jr nz, .check_toxic_gas ld a, DUELVARS_ARENA_CARD_STATUS call GetTurnDuelistVariable and PASSIVE_STATUS_MASK text_hl CannotUseDueToStatusText scf jr nz, .done ; return carry -.checkToxicGas +.check_toxic_gas ld a, MUK call Func_3509 text_hl UnableDueToToxicGasText @@ -6986,10 +6986,10 @@ HandleDestinyBondSubstatus: ; 363b (0:363b) ld a, DUELVARS_ARENA_CARD_SUBSTATUS1 call GetNonTurnDuelistVariable cp SUBSTATUS1_DESTINY_BOND - jr z, .checkHP + jr z, .check_hp ret -.checkHP +.check_hp ld a, DUELVARS_ARENA_CARD call GetNonTurnDuelistVariable cp $ff @@ -7025,9 +7025,9 @@ HandleDestinyBondSubstatus: ; 363b (0:363b) HandleStrikesBack: ; 367b (0:367b) ld a, [wTempNonTurnDuelistCardId] cp MACHAMP - jr z, .strikesBack + jr z, .strikes_back ret -.strikesBack +.strikes_back ld a, [wLoadedMoveCategory] and RESIDUAL ret nz @@ -7157,10 +7157,10 @@ HandleEnergyBurn: ; 375d (0:375d) ld hl, wAttachedEnergies ld c, COLORLESS - FIRE xor a -.zeroNextEnergy +.zero_next_energy ld [hli], a dec c - jr nz, .zeroNextEnergy + jr nz, .zero_next_energy ld a, [wTotalAttachedEnergies] ld [wAttachedEnergies], a ret -- cgit v1.2.3 From 96f75517a52b30cc1f9e02ad4584aee7a76751c7 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Wed, 7 Feb 2018 16:57:12 +0100 Subject: Consolidate line endings to LF --- src/engine/bank5.asm | 646 +++++++++++++++++++++++++-------------------------- src/engine/bank8.asm | 264 ++++++++++----------- src/engine/home.asm | 6 +- 3 files changed, 459 insertions(+), 457 deletions(-) (limited to 'src/engine') diff --git a/src/engine/bank5.asm b/src/engine/bank5.asm index d713f8f..1104b86 100755 --- a/src/engine/bank5.asm +++ b/src/engine/bank5.asm @@ -1,323 +1,323 @@ -PointerTable_14000: ; 14000 (05:4000) - dw $47bd ; SAMS_PRACTICE_DECK - dw PointerTable_14668 ; PRACTICE_PLAYER_DECK - dw PointerTable_14668 ; SAMS_NORMAL_DECK - dw PointerTable_14668 ; CHARMANDER_AND_FRIENDS_DECK - dw PointerTable_14668 ; CHARMANDER_EXTRA_DECK - dw PointerTable_14668 ; SQUIRTLE_AND_FRIENDS_DECK - dw PointerTable_14668 ; SQUIRTLE_EXTRA_DECK - dw PointerTable_14668 ; BULBASAUR_AND_FRIENDS_DECK - dw PointerTable_14668 ; BULBASAUR_EXTRA_DECK - dw PointerTable_14668 ; LIGHTNING_AND_FIRE_DECK - dw PointerTable_14668 ; WATER_AND_FIGHTING_DECK - dw PointerTable_14668 ; GRASS_AND_PSYCHIC_DECK - dw $49e8 ; LEGENDARY_MOLTRES_DECK - dw $4b0f ; LEGENDARY_ZAPDOS_DECK - dw $4c0b ; LEGENDARY_ARTICUNO_DECK - dw $4d60 ; LEGENDARY_DRAGONITE_DECK - dw $4e89 ; FIRST_STRIKE_DECK - dw $4f0e ; ROCK_CRUSHER_DECK - dw $4f8f ; GO_GO_RAIN_DANCE_DECK - dw $5019 ; ZAPPING_SELFDESTRUCT_DECK - dw $509b ; FLOWER_POWER_DECK - dw $5122 ; STRANGE_PSYSHOCK_DECK - dw $51ad ; WONDERS_OF_SCIENCE_DECK - dw $5232 ; FIRE_CHARGE_DECK - dw $52bd ; IM_RONALD_DECK - dw $534b ; POWERFUL_RONALD_DECK - dw $53e8 ; INVINCIBLE_RONALD_DECK - dw $546f ; LEGENDARY_RONALD_DECK - dw $48dc ; MUSCLES_FOR_BRAINS_DECK - dw PointerTable_14668 ; HEATED_BATTLE_DECK - dw PointerTable_14668 ; LOVE_TO_BATTLE_DECK - dw PointerTable_14668 ; EXCAVATION_DECK - dw PointerTable_14668 ; BLISTERING_POKEMON_DECK - dw PointerTable_14668 ; HARD_POKEMON_DECK - dw PointerTable_14668 ; WATERFRONT_POKEMON_DECK - dw PointerTable_14668 ; LONELY_FRIENDS_DECK - dw PointerTable_14668 ; SOUND_OF_THE_WAVES_DECK - dw PointerTable_14668 ; PIKACHU_DECK - dw PointerTable_14668 ; BOOM_BOOM_SELFDESTRUCT_DECK - dw PointerTable_14668 ; POWER_GENERATOR_DECK - dw PointerTable_14668 ; ETCETERA_DECK - dw PointerTable_14668 ; FLOWER_GARDEN_DECK - dw PointerTable_14668 ; KALEIDOSCOPE_DECK - dw PointerTable_14668 ; GHOST_DECK - dw PointerTable_14668 ; NAP_TIME_DECK - dw PointerTable_14668 ; STRANGE_POWER_DECK - dw PointerTable_14668 ; FLYIN_POKEMON_DECK - dw PointerTable_14668 ; LOVELY_NIDORAN_DECK - dw PointerTable_14668 ; POISON_DECK - dw PointerTable_14668 ; ANGER_DECK - dw PointerTable_14668 ; FLAMETHROWER_DECK - dw PointerTable_14668 ; RESHUFFLE_DECK - dw $48dc ; IMAKUNI_DECK -; 1406a - - INCROM $1406a, $14226 - -Func_14226: ; 14226 (5:4226) - call CreateHandCardBuffer - ld hl, wDuelCardOrAttackList -.checkForNextPokemon - ld a, [hli] - ld [$ff98], a - cp $ff - ret z - call LoadDeckCardToBuffer1 - ld a, [wLoadedCard1Type] - cp FIRE_ENERGY_CARD - jr nc, .checkForNextPokemon - ld a, [wLoadedCard1Stage] - or a - jr nz, .checkForNextPokemon - push hl - ld a, [$ff98] - call $1485 - pop hl - jr .checkForNextPokemon -; 0x1424b - - INCROM $1424b, $14663 - -Func_14663: ; 14663 (5:4663) - farcall Func_200e5 - ret - -; GENERAL DECK POINTER LIST - Not sure on all of these. -; This is an example of an AI pointer table, there's one for each AI type. -PointerTable_14668: ; 14668 (05:4668) - dw Func_14674 ; not used - dw Func_14674 ; general AI for battles - dw Func_14678 ; basic pokemon placement / cheater shuffling on better AI - dw Func_1467f - dw Func_14683 - dw Func_14687 - -; when battle AI gets called -Func_14674: ; 14674 (5:4674) - call Func_1468b - ret - -Func_14678: ; 14678 (5:4678) - call Func_15636 - call $4226 - ret - -Func_1467f: ; 1467f (5:467f) - call $5b72 - ret - -Func_14683: ; 14683 (5:4683) - call $5b72 - ret - -Func_14687: ; 14687 (5:4687) - call $41e5 - ret - -; AI for general decks i think -Func_1468b: ; 1468b (5:468b) - call Func_15649 - ld a, $1 - call Func_14663 - farcallx $8, $67d3 - jp nc, $4776 - farcallx $8, $6790 - farcallx $8, $66a3 - farcallx $8, $637f - ret c - farcallx $8, $662d - ld a, $2 - call Func_14663 - ld a, $3 - call Func_14663 - ld a, $4 - call Func_14663 - call $5eae - ret c - ld a, $5 - call Func_14663 - ld a, $6 - call Func_14663 - ld a, $7 - call Func_14663 - ld a, $8 - call Func_14663 - call $4786 - ld a, $a - call Func_14663 - ld a, $b - call Func_14663 - ld a, $c - call Func_14663 - ld a, [wAlreadyPlayedEnergy] - or a - jr nz, .asm_146ed - call $64e8 - -.asm_146ed - call $5eae - farcallx $8, $66a3 - farcallx $8, $637f - ret c - farcallx $8, $6790 - ld a, $d - farcallx $8, $619b - ld a, $d - call Func_14663 - ld a, $f - call Func_14663 - ld a, [$ce20] - and $4 - jr z, .asm_14776 - ld a, $1 - call Func_14663 - ld a, $2 - call Func_14663 - ld a, $3 - call Func_14663 - ld a, $4 - call Func_14663 - call $5eae - ret c - ld a, $5 - call Func_14663 - ld a, $6 - call Func_14663 - ld a, $7 - call Func_14663 - ld a, $8 - call Func_14663 - call $4786 - ld a, $a - call Func_14663 - ld a, $b - call Func_14663 - ld a, $c - call Func_14663 - ld a, [wAlreadyPlayedEnergy] - or a - jr nz, .asm_1475b - call $64e8 - -.asm_1475b - call $5eae - farcallx $8, $66a3 - farcallx $8, $637f - ret c - farcallx $8, $6790 - ld a, $d - farcallx $8, $619b - ld a, $d - call Func_14663 - -.asm_14776 - ld a, $e - farcallx $8, $619b - call $69f8 - ret c - ld a, $5 - bank1call $67be - ret -; 0x14786 - - - INCROM $14786, $15636 -Func_15636: ; 15636 (5:5636) - ld a, $10 - ld hl, $cda5 - call ZeroData - ld a, $5 - ld [$cda6], a - ld a, $ff - ld [$cda5], a - ret - -Func_15649: ; 15649 (5:5649) - ld a, [$cda6] - inc a - ld [$cda6], a - xor a - ld [$ce20], a - ld [$cddb], a - ld [$cddc], a - ld [$ce03], a - ld a, [wcc10] - cp $ff - jr z, .asm_156b1 - or a - jr z, .asm_156b1 - ld a, [wcc11] - cp $ff - jr z, .asm_156b1 - call SwapTurn - call GetCardInDeckPosition - call SwapTurn - ld a, e - cp MEWTWO1 ; I believe this is a check for Mewtwo1's Barrier move - jr nz, .asm_156b1 - ld a, [$cda7] - bit 7, a - jr nz, .asm_156aa - inc a - ld [$cda7], a - cp $3 - jr c, .asm_156c2 - ld a, (wPlayerArenaCard & $FF) - call GetNonTurnDuelistVariable - call SwapTurn - call GetCardInDeckPosition - call SwapTurn - ld a, e - cp MEWTWO1 - jr nz, .asm_156a4 - farcallx $8, $67a9 - jr nc, .asm_156aa - -.asm_156a4 - xor a - ld [$cda7], a - jr .asm_156c2 - -.asm_156aa - ld a, $80 - ld [$cda7], a - jr .asm_156c2 - -.asm_156b1 - ld a, [$cda7] - bit 7, a - jr z, .asm_156be - inc a - ld [$cda7], a - jr .asm_156c2 - -.asm_156be - xor a - ld [$cda7], a - -.asm_156c2 - ret -; 0x156c3 - - INCROM $156c3, $1575e - -; zeroes a bytes starting at hl -ZeroData: ; 1575e (5:575e) - push af - push bc - push hl - ld b, a - xor a -.clearLoop - ld [hli], a - dec b - jr nz, .clearLoop - pop hl - pop bc - pop af - ret -; 0x1576b - - INCROM $1576b, $18000 +PointerTable_14000: ; 14000 (05:4000) + dw $47bd ; SAMS_PRACTICE_DECK + dw PointerTable_14668 ; PRACTICE_PLAYER_DECK + dw PointerTable_14668 ; SAMS_NORMAL_DECK + dw PointerTable_14668 ; CHARMANDER_AND_FRIENDS_DECK + dw PointerTable_14668 ; CHARMANDER_EXTRA_DECK + dw PointerTable_14668 ; SQUIRTLE_AND_FRIENDS_DECK + dw PointerTable_14668 ; SQUIRTLE_EXTRA_DECK + dw PointerTable_14668 ; BULBASAUR_AND_FRIENDS_DECK + dw PointerTable_14668 ; BULBASAUR_EXTRA_DECK + dw PointerTable_14668 ; LIGHTNING_AND_FIRE_DECK + dw PointerTable_14668 ; WATER_AND_FIGHTING_DECK + dw PointerTable_14668 ; GRASS_AND_PSYCHIC_DECK + dw $49e8 ; LEGENDARY_MOLTRES_DECK + dw $4b0f ; LEGENDARY_ZAPDOS_DECK + dw $4c0b ; LEGENDARY_ARTICUNO_DECK + dw $4d60 ; LEGENDARY_DRAGONITE_DECK + dw $4e89 ; FIRST_STRIKE_DECK + dw $4f0e ; ROCK_CRUSHER_DECK + dw $4f8f ; GO_GO_RAIN_DANCE_DECK + dw $5019 ; ZAPPING_SELFDESTRUCT_DECK + dw $509b ; FLOWER_POWER_DECK + dw $5122 ; STRANGE_PSYSHOCK_DECK + dw $51ad ; WONDERS_OF_SCIENCE_DECK + dw $5232 ; FIRE_CHARGE_DECK + dw $52bd ; IM_RONALD_DECK + dw $534b ; POWERFUL_RONALD_DECK + dw $53e8 ; INVINCIBLE_RONALD_DECK + dw $546f ; LEGENDARY_RONALD_DECK + dw $48dc ; MUSCLES_FOR_BRAINS_DECK + dw PointerTable_14668 ; HEATED_BATTLE_DECK + dw PointerTable_14668 ; LOVE_TO_BATTLE_DECK + dw PointerTable_14668 ; EXCAVATION_DECK + dw PointerTable_14668 ; BLISTERING_POKEMON_DECK + dw PointerTable_14668 ; HARD_POKEMON_DECK + dw PointerTable_14668 ; WATERFRONT_POKEMON_DECK + dw PointerTable_14668 ; LONELY_FRIENDS_DECK + dw PointerTable_14668 ; SOUND_OF_THE_WAVES_DECK + dw PointerTable_14668 ; PIKACHU_DECK + dw PointerTable_14668 ; BOOM_BOOM_SELFDESTRUCT_DECK + dw PointerTable_14668 ; POWER_GENERATOR_DECK + dw PointerTable_14668 ; ETCETERA_DECK + dw PointerTable_14668 ; FLOWER_GARDEN_DECK + dw PointerTable_14668 ; KALEIDOSCOPE_DECK + dw PointerTable_14668 ; GHOST_DECK + dw PointerTable_14668 ; NAP_TIME_DECK + dw PointerTable_14668 ; STRANGE_POWER_DECK + dw PointerTable_14668 ; FLYIN_POKEMON_DECK + dw PointerTable_14668 ; LOVELY_NIDORAN_DECK + dw PointerTable_14668 ; POISON_DECK + dw PointerTable_14668 ; ANGER_DECK + dw PointerTable_14668 ; FLAMETHROWER_DECK + dw PointerTable_14668 ; RESHUFFLE_DECK + dw $48dc ; IMAKUNI_DECK +; 1406a + + INCROM $1406a, $14226 + +Func_14226: ; 14226 (5:4226) + call CreateHandCardBuffer + ld hl, wDuelCardOrAttackList +.checkForNextPokemon + ld a, [hli] + ld [$ff98], a + cp $ff + ret z + call LoadDeckCardToBuffer1 + ld a, [wLoadedCard1Type] + cp FIRE_ENERGY_CARD + jr nc, .checkForNextPokemon + ld a, [wLoadedCard1Stage] + or a + jr nz, .checkForNextPokemon + push hl + ld a, [$ff98] + call $1485 + pop hl + jr .checkForNextPokemon +; 0x1424b + + INCROM $1424b, $14663 + +Func_14663: ; 14663 (5:4663) + farcall Func_200e5 + ret + +; GENERAL DECK POINTER LIST - Not sure on all of these. +; This is an example of an AI pointer table, there's one for each AI type. +PointerTable_14668: ; 14668 (05:4668) + dw Func_14674 ; not used + dw Func_14674 ; general AI for battles + dw Func_14678 ; basic pokemon placement / cheater shuffling on better AI + dw Func_1467f + dw Func_14683 + dw Func_14687 + +; when battle AI gets called +Func_14674: ; 14674 (5:4674) + call Func_1468b + ret + +Func_14678: ; 14678 (5:4678) + call Func_15636 + call $4226 + ret + +Func_1467f: ; 1467f (5:467f) + call $5b72 + ret + +Func_14683: ; 14683 (5:4683) + call $5b72 + ret + +Func_14687: ; 14687 (5:4687) + call $41e5 + ret + +; AI for general decks i think +Func_1468b: ; 1468b (5:468b) + call Func_15649 + ld a, $1 + call Func_14663 + farcallx $8, $67d3 + jp nc, $4776 + farcallx $8, $6790 + farcallx $8, $66a3 + farcallx $8, $637f + ret c + farcallx $8, $662d + ld a, $2 + call Func_14663 + ld a, $3 + call Func_14663 + ld a, $4 + call Func_14663 + call $5eae + ret c + ld a, $5 + call Func_14663 + ld a, $6 + call Func_14663 + ld a, $7 + call Func_14663 + ld a, $8 + call Func_14663 + call $4786 + ld a, $a + call Func_14663 + ld a, $b + call Func_14663 + ld a, $c + call Func_14663 + ld a, [wAlreadyPlayedEnergy] + or a + jr nz, .asm_146ed + call $64e8 + +.asm_146ed + call $5eae + farcallx $8, $66a3 + farcallx $8, $637f + ret c + farcallx $8, $6790 + ld a, $d + farcallx $8, $619b + ld a, $d + call Func_14663 + ld a, $f + call Func_14663 + ld a, [$ce20] + and $4 + jr z, .asm_14776 + ld a, $1 + call Func_14663 + ld a, $2 + call Func_14663 + ld a, $3 + call Func_14663 + ld a, $4 + call Func_14663 + call $5eae + ret c + ld a, $5 + call Func_14663 + ld a, $6 + call Func_14663 + ld a, $7 + call Func_14663 + ld a, $8 + call Func_14663 + call $4786 + ld a, $a + call Func_14663 + ld a, $b + call Func_14663 + ld a, $c + call Func_14663 + ld a, [wAlreadyPlayedEnergy] + or a + jr nz, .asm_1475b + call $64e8 + +.asm_1475b + call $5eae + farcallx $8, $66a3 + farcallx $8, $637f + ret c + farcallx $8, $6790 + ld a, $d + farcallx $8, $619b + ld a, $d + call Func_14663 + +.asm_14776 + ld a, $e + farcallx $8, $619b + call $69f8 + ret c + ld a, $5 + bank1call $67be + ret +; 0x14786 + + + INCROM $14786, $15636 +Func_15636: ; 15636 (5:5636) + ld a, $10 + ld hl, $cda5 + call ZeroData + ld a, $5 + ld [$cda6], a + ld a, $ff + ld [$cda5], a + ret + +Func_15649: ; 15649 (5:5649) + ld a, [$cda6] + inc a + ld [$cda6], a + xor a + ld [$ce20], a + ld [$cddb], a + ld [$cddc], a + ld [$ce03], a + ld a, [wcc10] + cp $ff + jr z, .asm_156b1 + or a + jr z, .asm_156b1 + ld a, [wcc11] + cp $ff + jr z, .asm_156b1 + call SwapTurn + call GetCardInDeckPosition + call SwapTurn + ld a, e + cp MEWTWO1 ; I believe this is a check for Mewtwo1's Barrier move + jr nz, .asm_156b1 + ld a, [$cda7] + bit 7, a + jr nz, .asm_156aa + inc a + ld [$cda7], a + cp $3 + jr c, .asm_156c2 + ld a, (wPlayerArenaCard & $FF) + call GetNonTurnDuelistVariable + call SwapTurn + call GetCardInDeckPosition + call SwapTurn + ld a, e + cp MEWTWO1 + jr nz, .asm_156a4 + farcallx $8, $67a9 + jr nc, .asm_156aa + +.asm_156a4 + xor a + ld [$cda7], a + jr .asm_156c2 + +.asm_156aa + ld a, $80 + ld [$cda7], a + jr .asm_156c2 + +.asm_156b1 + ld a, [$cda7] + bit 7, a + jr z, .asm_156be + inc a + ld [$cda7], a + jr .asm_156c2 + +.asm_156be + xor a + ld [$cda7], a + +.asm_156c2 + ret +; 0x156c3 + + INCROM $156c3, $1575e + +; zeroes a bytes starting at hl +ZeroData: ; 1575e (5:575e) + push af + push bc + push hl + ld b, a + xor a +.clearLoop + ld [hli], a + dec b + jr nz, .clearLoop + pop hl + pop bc + pop af + ret +; 0x1576b + + INCROM $1576b, $18000 diff --git a/src/engine/bank8.asm b/src/engine/bank8.asm index d052c43..478714b 100755 --- a/src/engine/bank8.asm +++ b/src/engine/bank8.asm @@ -1,132 +1,132 @@ - INCROM $20000, $200e5 - -; 0 - e4 is a big set of data, seems to be one entry for each card - -Func_200e5: ; 200e5 (8:40e5) - ld [$ce18], a - call CreateHandCardBuffer - ld hl, wDuelCardOrAttackList - ld de, wHandCardBuffer - call CopyBuffer - ld hl, wHandCardBuffer - ld a, [hli] - ld [$ce16], a - cp $ff - ret z - push hl - ld a, [$ce18] - ld d, a - ld hl, $4000 -.asm_4106 - xor a - ld [$ce21], a - ld a, [hli] - cp $ff - jp z, $41b1 - cp d - jp nz, .incHL5 - ld a, [hli] - ld [$ce17], a - ld a, [$ce16] - call LoadDeckCardToBuffer1 - cp $d2 - jr nz, .asm_2012b - ld b, a - ld a, [$ce20] - and $2 - jr nz, .incHL4 - ld a, b - -.asm_2012b - ld b, a - ld a, [$ce17] - cp b - jr nz, .incHL4 - push hl - push de - ld a, [$ce16] - ld [$ff9f], a - bank1call $35a9 - jp c, $41a8 - call $1944 - ld a, $1 - call TryExecuteEffectCommandFunction - jp c, $41a8 - farcallx $5, $743b - jr c, .asm_201a8 - pop de - pop hl - push hl - call CallIndirect - pop hl - jr nc, .incHL4 - inc hl - inc hl - ld [$ce19], a - push de - push hl - ld a, [$ce16] - ld [$ff9f], a - ld a, $6 - bank1call $67be - pop hl - pop de - jr c, .incHL2 - push hl - call CallIndirect - pop hl - inc hl - inc hl - ld a, [$ce20] - ld b, a - ld a, [$ce21] - or b - ld [$ce20], a - pop hl - and $8 - jp z, $40f7 - call $123b - ld hl, wDuelCardOrAttackList - ld de, $cf68 - call $697b - ld hl, $cf68 - ld a, [$ce20] - and $f7 - ld [$ce20], a - jp $40f7 - -.incHL5 - inc hl - -.incHL4 - inc hl - inc hl - -.incHL2 - inc hl - inc hl - jp .asm_4106 - -.asm_201a8 - pop de - pop hl - inc hl - inc hl - inc hl - inc hl - jp .asm_4106 -; 0x201b1 - - INCROM $201b1, $2297b - -; copies $ff terminated buffer from hl to de -CopyBuffer: ; 2297b (8:697b) - ld a, [hli] - ld [de], a - cp $ff - ret z - inc de - jr CopyBuffer -; 0x22983 - - INCROM $22983, $24000 + INCROM $20000, $200e5 + +; 0 - e4 is a big set of data, seems to be one entry for each card + +Func_200e5: ; 200e5 (8:40e5) + ld [$ce18], a + call CreateHandCardBuffer + ld hl, wDuelCardOrAttackList + ld de, wHandCardBuffer + call CopyBuffer + ld hl, wHandCardBuffer + ld a, [hli] + ld [$ce16], a + cp $ff + ret z + push hl + ld a, [$ce18] + ld d, a + ld hl, $4000 +.asm_4106 + xor a + ld [$ce21], a + ld a, [hli] + cp $ff + jp z, $41b1 + cp d + jp nz, .incHL5 + ld a, [hli] + ld [$ce17], a + ld a, [$ce16] + call LoadDeckCardToBuffer1 + cp $d2 + jr nz, .asm_2012b + ld b, a + ld a, [$ce20] + and $2 + jr nz, .incHL4 + ld a, b + +.asm_2012b + ld b, a + ld a, [$ce17] + cp b + jr nz, .incHL4 + push hl + push de + ld a, [$ce16] + ld [$ff9f], a + bank1call $35a9 + jp c, $41a8 + call $1944 + ld a, $1 + call TryExecuteEffectCommandFunction + jp c, $41a8 + farcallx $5, $743b + jr c, .asm_201a8 + pop de + pop hl + push hl + call CallIndirect + pop hl + jr nc, .incHL4 + inc hl + inc hl + ld [$ce19], a + push de + push hl + ld a, [$ce16] + ld [$ff9f], a + ld a, $6 + bank1call $67be + pop hl + pop de + jr c, .incHL2 + push hl + call CallIndirect + pop hl + inc hl + inc hl + ld a, [$ce20] + ld b, a + ld a, [$ce21] + or b + ld [$ce20], a + pop hl + and $8 + jp z, $40f7 + call $123b + ld hl, wDuelCardOrAttackList + ld de, $cf68 + call $697b + ld hl, $cf68 + ld a, [$ce20] + and $f7 + ld [$ce20], a + jp $40f7 + +.incHL5 + inc hl + +.incHL4 + inc hl + inc hl + +.incHL2 + inc hl + inc hl + jp .asm_4106 + +.asm_201a8 + pop de + pop hl + inc hl + inc hl + inc hl + inc hl + jp .asm_4106 +; 0x201b1 + + INCROM $201b1, $2297b + +; copies $ff terminated buffer from hl to de +CopyBuffer: ; 2297b (8:697b) + ld a, [hli] + ld [de], a + cp $ff + ret z + inc de + jr CopyBuffer +; 0x22983 + + INCROM $22983, $24000 diff --git a/src/engine/home.asm b/src/engine/home.asm index 072e5dd..b70afec 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -7959,8 +7959,10 @@ Func_3df3: ; 3df3 (0:3df3) ret ; 0x3e10 - INCROM $3e10, $3e17 - +Func_3e10: ; 3e10 (0:3e10) + ld a, $1 + ld [wd61e], a + ld a, $62 Func_3e17: ; 3e17 (0:3e17) ld [wd131], a ldh a, [hBankROM] -- cgit v1.2.3 From acc23e78e00b131efcddac17b55dceed9a199ff2 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Wed, 7 Feb 2018 17:28:14 +0100 Subject: More home disasm and misc --- src/engine/home.asm | 48 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 13 deletions(-) (limited to 'src/engine') diff --git a/src/engine/home.asm b/src/engine/home.asm index b70afec..d2ed134 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -2796,7 +2796,8 @@ _GetCardInDeckPosition: ; 1362 (0:1362) ld a, [hl] pop de ret - + +; load data of card in position a to wLoadedCard1 LoadDeckCardToBuffer1: ; 1376 (0:1376) push hl push de @@ -2812,7 +2813,8 @@ LoadDeckCardToBuffer1: ; 1376 (0:1376) pop de pop hl ret - + +; load data of card in position a to wLoadedCard2 LoadDeckCardToBuffer2: ; 138c (0:138c) push hl push de @@ -3309,8 +3311,27 @@ CheckSelfConfusionDamage: ; 18d7 (0:18d7) ret ; 0x18f9 - INCROM $18f9, $195c - + INCROM $18f9, $1944 + +; this loads HP and Stage (1 byte each) of card with id at $ff9f into wLoadedMoveEffectCommands +Func_1944: ; 1944 (0:1944) + ld a, [$ff9f] + call LoadDeckCardToBuffer1 + ld hl, wLoadedCard1HP + ld de, wLoadedMoveEffectCommands + ld a, [hli] + ld [de], a + inc de + ld a, [hl] + ld [de], a + ret +; 0x1955 + +Func_1955: ; 1955 (0:1955) + push af + ld a, $7a + ld [wLoadedMoveAnimation], a + pop af ; this function appears to apply several damage modifiers Func_195c: ; 195c (0:195c) ld hl, wDamage @@ -5178,8 +5199,9 @@ Func_29f5: ; 29f5 (0:29f5) ret ; 0x29fa - INCROM $29fa, $2a00 - +Func_29fa: ; 29fa (0:29fa) + ld bc, $0f00 + call Func_2a1a Func_2a00: ; 2a00 (0:2a00) call DoFrame call HandleTextBoxInput @@ -5200,17 +5222,17 @@ Func_2a1a: ; 2a1a (0:2a1a) xor a ld hl, wCurMenuItem ld [hli], a - ld [hl], d + ld [hl], d ; wCursorXPosition inc hl - ld [hl], e + ld [hl], e ; wCursorYPosition inc hl - ld [hl], $0 + ld [hl], $0 ; wYDisplacementBetweenMenuItems inc hl - ld [hl], $1 + ld [hl], $1 ; wNumMenuItems inc hl - ld [hl], b + ld [hl], b ; wCursorTileNumber inc hl - ld [hl], c + ld [hl], c ; wTileBehindCursor ld [wCursorBlinkCounter], a ret ; 0x2a30 @@ -8000,5 +8022,5 @@ Bankswitch3d: ; 3fe0 (0:3fe0) ret rept $a -db $ff + db $ff endr -- cgit v1.2.3 From b633a7a18c8bc2f0de043902d793bfc038fd6276 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Wed, 7 Feb 2018 17:39:42 +0100 Subject: Label some hardcoded home function calls --- src/engine/bank1.asm | 10 +++++----- src/engine/bank3.asm | 14 +++++++------- src/engine/bank5.asm | 2 +- src/engine/bank7.asm | 4 ++-- src/engine/bank8.asm | 4 ++-- src/engine/home.asm | 3 ++- 6 files changed, 19 insertions(+), 18 deletions(-) (limited to 'src/engine') diff --git a/src/engine/bank1.asm b/src/engine/bank1.asm index a524905..a48f0d7 100755 --- a/src/engine/bank1.asm +++ b/src/engine/bank1.asm @@ -516,7 +516,7 @@ PlayerUseEnergyCard: ; 4477 (1:4477) .alreadyPlayedEnergy text_hl OnlyOneEnergyCardText call DrawWideTextBox_WaitForInput - call $123b + call CreateHandCardBuffer call $55be jp $4447 ; 0x44db @@ -994,7 +994,7 @@ Func_4b60: ; 4b60 (1:4b60) call Func_4cd5 call SwapTurn jp c, $4c77 - call $311d + call Func_311d ld hl, $0072 call DrawWideTextBox_WaitForInput call Func_0f58 @@ -1117,7 +1117,7 @@ Func_4cd5: ; 4cd5 (1:4cd5) call $51e7 jr c, .asm_4d28 ld a, [$ff98] - call $1485 + call Func_1485 ld a, [$ff98] ld hl, $0062 call $4b31 @@ -1141,7 +1141,7 @@ Func_4cd5: ; 4cd5 (1:4cd5) cp $6 jr nc, .asm_4d86 ld a, [$ff98] - call $1485 + call Func_1485 ld a, [$ff98] ld hl, $0061 call $4b31 @@ -1391,7 +1391,7 @@ _TossCoin: ; 71ad (1:71ad) xor a ld [wcd9f], a call Func_04a2 - call $210f + call Func_210f .asm_71c1 ld a, [wcd9f] diff --git a/src/engine/bank3.asm b/src/engine/bank3.asm index ab9999b..535da18 100755 --- a/src/engine/bank3.asm +++ b/src/engine/bank3.asm @@ -1181,7 +1181,7 @@ Func_c8ed: ; c8ed (3:c8ed) jr .asm_c911 .asm_c90e - call $2af3 + call Func_2af3 .asm_c911 pop de @@ -1590,7 +1590,7 @@ RST20: ; cc42 (3:4c42) ld [wBreakOWScriptLoop], a .asm_cc4f call RunOverworldScript - ld a, [wBreakOWScriptLoop] ; if you break out, it jumps + ld a, [wBreakOWScriptLoop] ; if you break out, it jumps or a jr z, .asm_cc4f ld hl, wOWScriptPointer @@ -2032,7 +2032,7 @@ Func_cf0c: ; cf0c (3:4f0c) Func_cf12: ; cf12 (3:4f12) ld a, c - call $1d1d + call Func_1d1d asm_cf16 or a @@ -2236,7 +2236,7 @@ Func_d025: ; d025 (3:5025) Func_d032: ; d032 (3:5032) call Func_ca69 dec hl - call $1d1d + call Func_1d1d jp c, Func_cf67 jp Func_cf6d @@ -2876,7 +2876,7 @@ Func_d4ae: ; d4ae (3:54ae) cp c jr c, Func_d490 ; 0xd4b2 $dc jr Func_d48a ; 0xd4b4 $d4 - + Func_d4b6: ; d4b6 (3:54b6) ld a, c ld c, b @@ -2962,7 +2962,7 @@ OWSequence_d753: ; d753 (3:5753) db $80 db $58 db $02 - + ; there's more to this script but it hasn't been disassembled yet INCROM $d77e, $e13f @@ -3113,7 +3113,7 @@ OWSequence_Joshua: run_script Func_d484 db $33 db $01 - + INCROM $e23f, $e52c FindEndOfBattleScript: ; e52c (3:652c) diff --git a/src/engine/bank5.asm b/src/engine/bank5.asm index 1104b86..0b373d3 100755 --- a/src/engine/bank5.asm +++ b/src/engine/bank5.asm @@ -73,7 +73,7 @@ Func_14226: ; 14226 (5:4226) jr nz, .checkForNextPokemon push hl ld a, [$ff98] - call $1485 + call Func_1485 pop hl jr .checkForNextPokemon ; 0x1424b diff --git a/src/engine/bank7.asm b/src/engine/bank7.asm index 6dd7fe7..6e91991 100755 --- a/src/engine/bank7.asm +++ b/src/engine/bank7.asm @@ -135,7 +135,7 @@ Func_1c50a: ; 1c50a (7:450a) push hl call Func_1c719 ld a, [wd3aa] - call $39a7 + call Func_39a7 ld a, [hl] or a jr z, .asm_1c52c @@ -265,7 +265,7 @@ Func_1c768: ; 1c768 (7:4768) ld a, $02 farcall Func_c29b ld a, [wd3aa] - call $39a7 + call Func_39a7 ld a, [hl] farcall Func_1187d pop hl diff --git a/src/engine/bank8.asm b/src/engine/bank8.asm index 478714b..aa47756 100755 --- a/src/engine/bank8.asm +++ b/src/engine/bank8.asm @@ -48,7 +48,7 @@ Func_200e5: ; 200e5 (8:40e5) ld [$ff9f], a bank1call $35a9 jp c, $41a8 - call $1944 + call Func_1944 ld a, $1 call TryExecuteEffectCommandFunction jp c, $41a8 @@ -85,7 +85,7 @@ Func_200e5: ; 200e5 (8:40e5) pop hl and $8 jp z, $40f7 - call $123b + call CreateHandCardBuffer ld hl, wDuelCardOrAttackList ld de, $cf68 call $697b diff --git a/src/engine/home.asm b/src/engine/home.asm index d2ed134..dbef4ae 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -5327,7 +5327,8 @@ WideTextBoxPromptCursorData: ; 2ac8 (0:2ac8) INCROM $2ad0, $2af0 Func_2af0: ; 2af0 (0:2af0) - call DrawWideTextBox_PrintText + call DrawWideTextBox_PrintText +Func_2af3: ; 2af3 (0:2af3) ld de, $0710 call Func_2b66 ld de, $0610 -- cgit v1.2.3 From 15a837c3a8a3f15bd0901de17582755f75437852 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Wed, 7 Feb 2018 18:01:08 +0100 Subject: Clean up booster pack names and constants --- src/engine/bank3.asm | 2 +- src/engine/boosters.asm | 90 ++++++++++++++++++++++++------------------------- src/engine/home.asm | 4 +-- 3 files changed, 48 insertions(+), 48 deletions(-) (limited to 'src/engine') diff --git a/src/engine/bank3.asm b/src/engine/bank3.asm index 535da18..5fcf216 100755 --- a/src/engine/bank3.asm +++ b/src/engine/bank3.asm @@ -1701,7 +1701,7 @@ OWScript_EndScriptCloseText: ; cccc (3:4ccc) pop hl ret -;args: 2-Text String Index +; args: 2-Text String Index OWScript_PrintTextString: ; ccd4 (3:4cd4) ld l, c ld h, b diff --git a/src/engine/boosters.asm b/src/engine/boosters.asm index d0c4ebc..2e61e66 100755 --- a/src/engine/boosters.asm +++ b/src/engine/boosters.asm @@ -265,7 +265,7 @@ FindBoosterCard: ; 1e31d (7:631d) scf ret -;lowers the chance of getting the same type multiple times +; lowers the chance of getting the same type multiple times UpdateBoosterCardTypesChanceByte: ; 1e350 (7:6350) push hl push bc @@ -446,8 +446,8 @@ CheckByteInWramZeroed: ; 1e423 (7:6423) ccf ret -;clears wPlayerDeck and wTempCardCollection -;copies rarity amounts to ram and averages them into wBoosterDataAveragedChance +; clears wPlayerDeck and wTempCardCollection +; copies rarity amounts to ram and averages them into wBoosterDataAveragedChance InitBoosterData: ; 1e430 (7:6430) ld c, $16 ld hl, wPlayerDeck @@ -493,7 +493,7 @@ FindBoosterDataPointer: ; 1e46f (7:646f) add a ld c, a ld b, $0 - ld hl, BoosterData_PtrTbl + ld hl, BoosterDataJumptable add hl, bc ld a, [hli] ld h, [hl] @@ -501,32 +501,32 @@ FindBoosterDataPointer: ; 1e46f (7:646f) pop bc ret -BoosterData_PtrTbl: ; 1e480 (7:6480) - dw PackColoNeutral - dw PackColoGrass - dw PackColoFire - dw PackColoWater - dw PackColoLightning - dw PackColoFighting - dw PackColoTrainer - dw PackEvoNeutral - dw PackEvoGrass - dw PackEvoNeutralFireEnergy - dw PackEvoWater - dw PackEvoFighting - dw PackEvoPsychic - dw PackEvoTrainer +BoosterDataJumptable: ; 1e480 (7:6480) + dw PackColosseumNeutral + dw PackColosseumGrass + dw PackColosseumFire + dw PackColosseumWater + dw PackColosseumLightning + dw PackColosseumFighting + dw PackColosseumTrainer + dw PackEvolutionNeutral + dw PackEvolutionGrass + dw PackEvolutionNeutralFireEnergy + dw PackEvolutionWater + dw PackEvolutionFighting + dw PackEvolutionPsychic + dw PackEvolutionTrainer dw PackMysteryNeutral dw PackMysteryGrassColorless dw PackMysteryWaterColorless - dw PackLightningColorless + dw PackMysteryLightningColorless dw PackMysteryFightingColorless dw PackMysteryTrainerColorless - dw PackLabTrainerLessFighting - dw PackLabGrass - dw PackLabWater - dw PackLabPsychic - dw PackLabTrainer + dw PackLaboratoryMostlyNeutral + dw PackLaboratoryGrass + dw PackLaboratoryWater + dw PackLaboratoryPsychic + dw PackLaboratoryTrainer dw PackEnergyLightningFire dw PackEnergyWaterFighting dw PackEnergyGrassPsychic @@ -555,7 +555,7 @@ BoosterSetRarityAmountTable: ; 1e4d4 (7::64d4) db $00, $06, $03, $01 ; other, commons, uncommons, rares db $00, $06, $03, $01 ; other, commons, uncommons, rares -PackColoNeutral:: ; 1e4e4 (7:64e4) +PackColosseumNeutral:: ; 1e4e4 (7:64e4) db COLOSSEUM >> 4 ; booster pack set dw GenerateEndingEnergy ; energy or energy generation function @@ -570,7 +570,7 @@ PackColoNeutral:: ; 1e4e4 (7:64e4) db $14 ; Trainer Card Chance db $00 ; Energy Card Chance -PackColoGrass:: ; 1e4f0 (7:64f0) +PackColosseumGrass:: ; 1e4f0 (7:64f0) db COLOSSEUM >> 4 ; booster pack set dw GRASS_ENERGY ; energy or energy generation function @@ -585,7 +585,7 @@ PackColoGrass:: ; 1e4f0 (7:64f0) db $10 ; Trainer Card Chance db $00 ; Energy Card Chance -PackColoFire:: ; 1e4fc (7:64fc) +PackColosseumFire:: ; 1e4fc (7:64fc) db COLOSSEUM >> 4 ; booster pack set dw FIRE_ENERGY ; energy or energy generation function @@ -600,7 +600,7 @@ PackColoFire:: ; 1e4fc (7:64fc) db $10 ; Trainer Card Chance db $00 ; Energy Card Chance -PackColoWater:: ; 1e508 (7:6508) +PackColosseumWater:: ; 1e508 (7:6508) db COLOSSEUM >> 4 ; booster pack set dw WATER_ENERGY ; energy or energy generation function @@ -615,7 +615,7 @@ PackColoWater:: ; 1e508 (7:6508) db $10 ; Trainer Card Chance db $00 ; Energy Card Chance -PackColoLightning:: ; 1e514 (7:6514) +PackColosseumLightning:: ; 1e514 (7:6514) db COLOSSEUM >> 4 ; booster pack set dw LIGHTNING_ENERGY ; energy or energy generation function @@ -630,7 +630,7 @@ PackColoLightning:: ; 1e514 (7:6514) db $10 ; Trainer Card Chance db $00 ; Energy Card Chance -PackColoFighting:: ; 1e520 (7:6520) +PackColosseumFighting:: ; 1e520 (7:6520) db COLOSSEUM >> 4 ; booster pack set dw FIGHTING_ENERGY ; energy or energy generation function @@ -645,7 +645,7 @@ PackColoFighting:: ; 1e520 (7:6520) db $10 ; Trainer Card Chance db $00 ; Energy Card Chance -PackColoTrainer:: ; 1e52c (7:652c) +PackColosseumTrainer:: ; 1e52c (7:652c) db COLOSSEUM >> 4 ; booster pack set dw GenerateEndingEnergy ; energy or energy generation function @@ -660,7 +660,7 @@ PackColoTrainer:: ; 1e52c (7:652c) db $30 ; Trainer Card Chance db $00 ; Energy Card Chance -PackEvoNeutral:: ; 1e538 (7:6538) +PackEvolutionNeutral:: ; 1e538 (7:6538) db EVOLUTION >> 4 ; booster pack set dw GenerateEndingEnergy ; energy or energy generation function @@ -675,7 +675,7 @@ PackEvoNeutral:: ; 1e538 (7:6538) db $14 ; Trainer Card Chance db $00 ; Energy Card Chance -PackEvoGrass:: ; 1e544 (7:6544) +PackEvolutionGrass:: ; 1e544 (7:6544) db EVOLUTION >> 4 ; booster pack set dw GRASS_ENERGY ; energy or energy generation function @@ -690,7 +690,7 @@ PackEvoGrass:: ; 1e544 (7:6544) db $10 ; Trainer Card Chance db $00 ; Energy Card Chance -PackEvoNeutralFireEnergy:: ; 1e550 (7:6550) +PackEvolutionNeutralFireEnergy:: ; 1e550 (7:6550) db EVOLUTION >> 4 ; booster pack set dw FIRE_ENERGY ; energy or energy generation function @@ -705,7 +705,7 @@ PackEvoNeutralFireEnergy:: ; 1e550 (7:6550) db $14 ; Trainer Card Chance db $00 ; Energy Card Chance -PackEvoWater:: ; 1e55c (7:655c) +PackEvolutionWater:: ; 1e55c (7:655c) db EVOLUTION >> 4 ; booster pack set dw WATER_ENERGY ; energy or energy generation function @@ -720,7 +720,7 @@ PackEvoWater:: ; 1e55c (7:655c) db $10 ; Trainer Card Chance db $00 ; Energy Card Chance -PackEvoFighting:: ; 1e568 (7:6568) +PackEvolutionFighting:: ; 1e568 (7:6568) db EVOLUTION >> 4 ; booster pack set dw FIGHTING_ENERGY ; energy or energy generation function @@ -735,7 +735,7 @@ PackEvoFighting:: ; 1e568 (7:6568) db $10 ; Trainer Card Chance db $00 ; Energy Card Chance -PackEvoPsychic:: ; 1e574 (7:6574) +PackEvolutionPsychic:: ; 1e574 (7:6574) db EVOLUTION >> 4 ; booster pack set dw PSYCHIC_ENERGY ; energy or energy generation function @@ -750,7 +750,7 @@ PackEvoPsychic:: ; 1e574 (7:6574) db $10 ; Trainer Card Chance db $00 ; Energy Card Chance -PackEvoTrainer:: ; 1e580 (7:6580) +PackEvolutionTrainer:: ; 1e580 (7:6580) db EVOLUTION >> 4 ; booster pack set dw GenerateEndingEnergy ; energy or energy generation function @@ -810,7 +810,7 @@ PackMysteryWaterColorless:: ; 1e5a4 (7:65a4) db $0C ; Trainer Card Chance db $0C ; Energy Card Chance -PackLightningColorless:: ; 1e5b0 (7:65b0) +PackMysteryLightningColorless:: ; 1e5b0 (7:65b0) db MYSTERY >> 4 ; booster pack set dw $0000 ; energy or energy generation function @@ -855,7 +855,7 @@ PackMysteryTrainerColorless:: ; 1e5c8 (7:65c8) db $30 ; Trainer Card Chance db $0C ; Energy Card Chance -PackLabTrainerLessFighting:: ; 1e5d4 (7:65d4) +PackLaboratoryMostlyNeutral:: ; 1e5d4 (7:65d4) db LABORATORY >> 4 ; booster pack set dw $0000 ; energy or energy generation function @@ -870,7 +870,7 @@ PackLabTrainerLessFighting:: ; 1e5d4 (7:65d4) db $18 ; Trainer Card Chance db $00 ; Energy Card Chance -PackLabGrass:: ; 1e5e0 (7:65e0) +PackLaboratoryGrass:: ; 1e5e0 (7:65e0) db LABORATORY >> 4 ; booster pack set dw $0000 ; energy or energy generation function @@ -885,7 +885,7 @@ PackLabGrass:: ; 1e5e0 (7:65e0) db $10 ; Trainer Card Chance db $00 ; Energy Card Chance -PackLabWater:: ; 1e5ec (7:65ec) +PackLaboratoryWater:: ; 1e5ec (7:65ec) db LABORATORY >> 4 ; booster pack set dw $0000 ; energy or energy generation function @@ -900,7 +900,7 @@ PackLabWater:: ; 1e5ec (7:65ec) db $10 ; Trainer Card Chance db $00 ; Energy Card Chance -PackLabPsychic:: ; 1e5f8 (7:65f8) +PackLaboratoryPsychic:: ; 1e5f8 (7:65f8) db LABORATORY >> 4 ; booster pack set dw $0000 ; energy or energy generation function @@ -915,7 +915,7 @@ PackLabPsychic:: ; 1e5f8 (7:65f8) db $10 ; Trainer Card Chance db $00 ; Energy Card Chance -PackLabTrainer:: ; 1e604 (7:6604) +PackLaboratoryTrainer:: ; 1e604 (7:6604) db LABORATORY >> 4 ; booster pack set dw $0000 ; energy or energy generation function diff --git a/src/engine/home.asm b/src/engine/home.asm index dbef4ae..2946235 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -3803,7 +3803,7 @@ Func_1d1d: ; 1d1d (0:1d1d) scf ret -;creates a list at $c000 of every card the player owns and how many +; creates a list at $c000 of every card the player owns and how many CreateTempCardCollection: ; 1d2e (0:1d2e) call EnableExtRAM ld hl, sCardCollection @@ -3840,7 +3840,7 @@ AddDeckCardsToTempCardCollection: ; 1d59 (0:1d59) jr nz, .asm_1d66 ret -;adds card a to collection, provided the player has less than 99 of them +; adds card a to collection, provided the player has less than 99 of them AddCardToCollection: ; 1d6e (0:1d6e) push hl push de -- cgit v1.2.3 From b9f2f4ee8e9218436b7ce36804bf404901f87d0f Mon Sep 17 00:00:00 2001 From: xCrystal Date: Wed, 7 Feb 2018 20:18:24 +0100 Subject: Use const to enumerate constants --- src/engine/boosters.asm | 8 ++++---- src/engine/home.asm | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/engine') diff --git a/src/engine/boosters.asm b/src/engine/boosters.asm index 2e61e66..d292183 100755 --- a/src/engine/boosters.asm +++ b/src/engine/boosters.asm @@ -59,7 +59,7 @@ FindCurrRarityChance: ; 1e219 (7:6219) ret FindCardsInSetAndRarity: ; 1e226 (7:6226) - ld c, BOOSTER_CARD_TYPE_AMOUNT + ld c, NUM_BOOSTER_CARD_TYPES ld hl, wBoosterAmountOfCardTypeTable xor a .deleteTypeTableLoop @@ -171,7 +171,7 @@ CardTypeTable: ; 1e2b1 (7:62b1) db BOOSTER_CARD_TYPE_TRAINER FindTotalTypeChances: ; 1e2c2 (7:62c2) - ld c, BOOSTER_CARD_TYPE_AMOUNT + ld c, NUM_BOOSTER_CARD_TYPES xor a ld hl, wBoosterTempTypeChanceTable .deleteTempTypeChanceTableLoop @@ -223,7 +223,7 @@ DetermineBoosterCardType: ; 1e2fa (7:62fa) inc hl inc c ld a, c - cp a, BOOSTER_CARD_TYPE_AMOUNT + cp a, NUM_BOOSTER_CARD_TYPES jr c, .loopThroughCardTypes ld a, $08 .foundCardType @@ -469,7 +469,7 @@ InitBoosterData: ; 1e430 (7:6430) call CopyDataHLtoDE call LoadRarityAmountsToWram ld bc, $0 - ld d, BOOSTER_CARD_TYPE_AMOUNT + ld d, NUM_BOOSTER_CARD_TYPES ld e, $0 ld hl, wBoosterDataTypeChanceData .addChanceBytesLoop diff --git a/src/engine/home.asm b/src/engine/home.asm index 2946235..01a66d0 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -5431,7 +5431,7 @@ LoadOpponentDeck: ; 2b78 (0:2b78) inc a call LoadDeck ld a, [wOpponentDeckId] - cp NUMBER_OF_DECKS + cp DECKS_END jr c, .valid_deck ld a, PRACTICE_PLAYER_DECK - 2 ld [wOpponentDeckId], a -- cgit v1.2.3 From bfeeb34666e8a9d91317f285e078c73d498351f7 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Wed, 7 Feb 2018 21:13:52 +0100 Subject: More accurate card type constants --- src/engine/bank1.asm | 6 +++--- src/engine/bank5.asm | 2 +- src/engine/boosters.asm | 29 +++++++++++++++-------------- src/engine/home.asm | 2 +- 4 files changed, 20 insertions(+), 19 deletions(-) (limited to 'src/engine') diff --git a/src/engine/bank1.asm b/src/engine/bank1.asm index a48f0d7..b1a879d 100755 --- a/src/engine/bank1.asm +++ b/src/engine/bank1.asm @@ -472,7 +472,7 @@ Func_4436: ; 4436 (1:4436) ; c contains the energy card being played PlayerUseEnergyCard: ; 4477 (1:4477) ld a, c - cp WATER_ENERGY_CARD ; XXX why treat water energy card differently? + cp TYPE_ENERGY_WATER ; XXX why treat water energy card differently? jr nz, .notWaterEnergy call $3615 jr c, .waterEnergy @@ -1285,14 +1285,14 @@ AIUseEnergyCard: ; 69a5 (1:69a5) ConvertTrainerCardToPokemon: ld c, a ld a, [hl] - cp TRAINER_CARD + cp TYPE_TRAINER ret nz push hl ldh a, [hWhoseTurn] ld h, a ld l, c ld a, [hl] - and TRAINER_CARD + and TYPE_TRAINER pop hl ret z ld a, e diff --git a/src/engine/bank5.asm b/src/engine/bank5.asm index 0b373d3..3f0e5a2 100755 --- a/src/engine/bank5.asm +++ b/src/engine/bank5.asm @@ -66,7 +66,7 @@ Func_14226: ; 14226 (5:4226) ret z call LoadDeckCardToBuffer1 ld a, [wLoadedCard1Type] - cp FIRE_ENERGY_CARD + cp TYPE_ENERGY_FIRE jr nc, .checkForNextPokemon ld a, [wLoadedCard1Stage] or a diff --git a/src/engine/boosters.asm b/src/engine/boosters.asm index d292183..a0968c6 100755 --- a/src/engine/boosters.asm +++ b/src/engine/boosters.asm @@ -17,9 +17,9 @@ GenerateBoosterPack: ; 1e1c4 (7:61c4) GenerateBoosterCard: ; 1e1df (7:61df) ld a, STAR - ld [wBoosterCurrRarity], a + ld [wBoosterCurRarity], a .generateCardLoop - call FindCurrRarityChance + call FindCurRarityChance ld a, [hl] or a jr z, .noMoreOfCurrentRarity @@ -32,14 +32,14 @@ GenerateBoosterCard: ; 1e1df (7:61df) call FindBoosterCard call UpdateBoosterCardTypesChanceByte call AddCardToBoosterList - call FindCurrRarityChance + call FindCurRarityChance dec [hl] jr .generateCardLoop .noMoreOfCurrentRarity - ld a, [wBoosterCurrRarity] + ld a, [wBoosterCurRarity] dec a - ld [wBoosterCurrRarity], a - bit 7, a + ld [wBoosterCurRarity], a + bit 7, a ; any rarity left to check? jr z, .generateCardLoop or a ret @@ -48,10 +48,10 @@ GenerateBoosterCard: ; 1e1df (7:61df) scf ret -FindCurrRarityChance: ; 1e219 (7:6219) +FindCurRarityChance: ; 1e219 (7:6219) push bc ld hl, wBoosterDataCommonAmount - ld a, [wBoosterCurrRarity] + ld a, [wBoosterCurRarity] ld c, a ld b, $0 add hl, bc @@ -113,7 +113,7 @@ CheckCardViable: ; 1e268 (7:6268) ld [wBoosterCurrentCardSet], a ld a, [wBoosterCurrentCardRarity] ld c, a - ld a, [wBoosterCurrRarity] + ld a, [wBoosterCurRarity] cp c jr nz, .invalidCard ld a, [wBoosterCurrentCardType] @@ -124,7 +124,7 @@ CheckCardViable: ; 1e268 (7:6268) swap a and $0f ld c, a - ld a, [wBoosterDataCurrSet] + ld a, [wBoosterDataCurSet] cp c jr nz, .invalidCard .returnValidCard @@ -136,16 +136,17 @@ CheckCardViable: ; 1e268 (7:6268) pop bc ret +; Map a card's TYPE_* constant given in a to its BOOSTER_CARD_TYPE_* constant GetCardType: ; 1e2a0 (7:62a0) push hl push bc ld hl, CardTypeTable cp $11 - jr nc, .skipToTypeLoad + jr nc, .loadType ld c, a ld b, $00 add hl, bc -.skipToTypeLoad +.loadType ld a, [hl] pop bc pop hl @@ -464,7 +465,7 @@ InitBoosterData: ; 1e430 (7:6430) dec c jr nz, .clearTempCardCollectionLoop call FindBoosterDataPointer - ld de, wBoosterDataCurrSet + ld de, wBoosterDataCurSet ld bc, $c call CopyDataHLtoDE call LoadRarityAmountsToWram @@ -533,7 +534,7 @@ BoosterDataJumptable: ; 1e480 (7:6480) dw PackRandomEnergies LoadRarityAmountsToWram: ; 1e4ba (7:64ba) - ld a, [wBoosterDataCurrSet] + ld a, [wBoosterDataCurSet] add a add a ld c, a diff --git a/src/engine/home.asm b/src/engine/home.asm index 01a66d0..16927de 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -2926,7 +2926,7 @@ GetAttachedEnergies: ; 159f (0:159f) ld a, l call LoadDeckCardToBuffer2 ld a, [wLoadedCard2Type] - bit ENERGY_CARD_F, a + bit TYPE_ENERGY_F, a jr z, .not_an_energy_card and $7 ; zero bit 3 to extract the type ld e, a -- cgit v1.2.3 From 4532673f5d538dfe4509f66150d8f584e486a6f9 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Wed, 7 Feb 2018 21:26:27 +0100 Subject: Enumerate card type constants --- src/engine/boosters.asm | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/engine') diff --git a/src/engine/boosters.asm b/src/engine/boosters.asm index a0968c6..16063e5 100755 --- a/src/engine/boosters.asm +++ b/src/engine/boosters.asm @@ -141,7 +141,7 @@ GetCardType: ; 1e2a0 (7:62a0) push hl push bc ld hl, CardTypeTable - cp $11 + cp NUM_CARD_TYPES jr nc, .loadType ld c, a ld b, $00 @@ -153,23 +153,23 @@ GetCardType: ; 1e2a0 (7:62a0) ret CardTypeTable: ; 1e2b1 (7:62b1) - db BOOSTER_CARD_TYPE_FIRE - db BOOSTER_CARD_TYPE_GRASS - db BOOSTER_CARD_TYPE_LIGHTNING - db BOOSTER_CARD_TYPE_WATER - db BOOSTER_CARD_TYPE_FIGHTING - db BOOSTER_CARD_TYPE_PSYCHIC - db BOOSTER_CARD_TYPE_COLORLESS - db BOOSTER_CARD_TYPE_TRAINER - db BOOSTER_CARD_TYPE_ENERGY - db BOOSTER_CARD_TYPE_ENERGY - db BOOSTER_CARD_TYPE_ENERGY - db BOOSTER_CARD_TYPE_ENERGY - db BOOSTER_CARD_TYPE_ENERGY - db BOOSTER_CARD_TYPE_ENERGY - db BOOSTER_CARD_TYPE_ENERGY - db BOOSTER_CARD_TYPE_TRAINER - db BOOSTER_CARD_TYPE_TRAINER + db BOOSTER_CARD_TYPE_FIRE ; TYPE_PKMN_FIRE + db BOOSTER_CARD_TYPE_GRASS ; TYPE_PKMN_GRASS + db BOOSTER_CARD_TYPE_LIGHTNING ; TYPE_PKMN_LIGHTNING + db BOOSTER_CARD_TYPE_WATER ; TYPE_PKMN_WATER + db BOOSTER_CARD_TYPE_FIGHTING ; TYPE_PKMN_FIGHTING + db BOOSTER_CARD_TYPE_PSYCHIC ; TYPE_PKMN_PSYCHIC + db BOOSTER_CARD_TYPE_COLORLESS ; TYPE_PKMN_COLORLESS + db BOOSTER_CARD_TYPE_TRAINER ; TYPE_PKMN_UNUSED + db BOOSTER_CARD_TYPE_ENERGY ; TYPE_ENERGY_FIRE + db BOOSTER_CARD_TYPE_ENERGY ; TYPE_ENERGY_GRASS + db BOOSTER_CARD_TYPE_ENERGY ; TYPE_ENERGY_LIGHTNING + db BOOSTER_CARD_TYPE_ENERGY ; TYPE_ENERGY_WATER + db BOOSTER_CARD_TYPE_ENERGY ; TYPE_ENERGY_FIGHTING + db BOOSTER_CARD_TYPE_ENERGY ; TYPE_ENERGY_PSYCHIC + db BOOSTER_CARD_TYPE_ENERGY ; TYPE_ENERGY_COLORLESS + db BOOSTER_CARD_TYPE_TRAINER ; TYPE_ENERGY_UNUSED + db BOOSTER_CARD_TYPE_TRAINER ; TYPE_TRAINER FindTotalTypeChances: ; 1e2c2 (7:62c2) ld c, NUM_BOOSTER_CARD_TYPES -- cgit v1.2.3 From ccfd3796e200fa21317e6c97bf2726ce140afd1e Mon Sep 17 00:00:00 2001 From: xCrystal Date: Thu, 8 Feb 2018 00:12:15 +0100 Subject: More booster pack constants and labels --- src/engine/boosters.asm | 145 +++++++++++++++++++++++++++--------------------- src/engine/home.asm | 2 +- 2 files changed, 83 insertions(+), 64 deletions(-) (limited to 'src/engine') diff --git a/src/engine/boosters.asm b/src/engine/boosters.asm index 16063e5..3b633a0 100755 --- a/src/engine/boosters.asm +++ b/src/engine/boosters.asm @@ -2,20 +2,21 @@ GenerateBoosterPack: ; 1e1c4 (7:61c4) push hl push bc push de - ld [wBoosterDataIndex], a + ld [wBoosterIndex], a .noCardsFoundLoop call InitBoosterData - call GenerateBoosterEnergy - call GenerateBoosterCard + call GenerateBoosterEnergies + call GenerateBoosterNonEnergies jr c, .noCardsFoundLoop - call CopyBoosterEnergiesToBooster + call PutEnergiesAndNonEnergiesTogether call AddBoosterCardsToCollection pop de pop bc pop hl ret -GenerateBoosterCard: ; 1e1df (7:61df) +; generate all Pokemon or Trainer cards (if any) for the current booster pack +GenerateBoosterNonEnergies: ; 1e1df (7:61df) ld a, STAR ld [wBoosterCurRarity], a .generateCardLoop @@ -31,7 +32,7 @@ GenerateBoosterCard: ; 1e1df (7:61df) call DetermineBoosterCardType call FindBoosterCard call UpdateBoosterCardTypesChanceByte - call AddCardToBoosterList + call AddBoosterCardToDrawnNonEnergies call FindCurRarityChance dec [hl] jr .generateCardLoop @@ -48,6 +49,7 @@ GenerateBoosterCard: ; 1e1df (7:61df) scf ret +; return hl pointing to wBoosterDataAmount[wBoosterCurRarity] FindCurRarityChance: ; 1e219 (7:6219) push bc ld hl, wBoosterDataCommonAmount @@ -73,8 +75,8 @@ FindCardsInSetAndRarity: ; 1e226 (7:6226) .checkCardViableLoop push de ld a, e - ld [wBoosterTempData], a - call CheckByteInWramZeroed + ld [wBoosterTempCard], a + call IsByteInTempCardCollectionZero jr c, .finishedWithCurrentCard call CheckCardViable jr c, .finishedWithCurrentCard @@ -88,7 +90,7 @@ FindCardsInSetAndRarity: ; 1e226 (7:6226) add hl, bc inc [hl] pop hl - ld a, [wBoosterTempData] + ld a, [wBoosterTempCard] ld [hli], a pop af ld [hli], a @@ -124,7 +126,7 @@ CheckCardViable: ; 1e268 (7:6268) swap a and $0f ld c, a - ld a, [wBoosterDataCurSet] + ld a, [wBoosterDataSet] cp c jr nz, .invalidCard .returnValidCard @@ -188,7 +190,7 @@ FindTotalTypeChances: ; 1e2c2 (7:62c2) ld a, [hl] or a jr z, .amountOfTypeOrChanceZero - ld hl, wBoosterDataTypeChanceData + ld hl, wBoosterDataTypeChances add hl, bc ld a, [hl] or a @@ -203,7 +205,7 @@ FindTotalTypeChances: ; 1e2c2 (7:62c2) pop bc inc c ld a, c - cp $09 + cp NUM_BOOSTER_CARD_TYPES jr c, .checkIfTypeIsValid ld a, [wd4ca] ret @@ -226,7 +228,7 @@ DetermineBoosterCardType: ; 1e2fa (7:62fa) ld a, c cp a, NUM_BOOSTER_CARD_TYPES jr c, .loopThroughCardTypes - ld a, $08 + ld a, BOOSTER_CARD_TYPE_ENERGY .foundCardType ld a, c ld [wBoosterSelectedCardType], a @@ -246,7 +248,7 @@ FindBoosterCard: ; 1e31d (7:631d) ld a, [hli] or a jr z, .noValidCardFound - ld [wBoosterTempData], a + ld [wBoosterTempCard], a ld a, [wBoosterSelectedCardType] cp [hl] jr nz, .cardIncorrectType @@ -266,16 +268,18 @@ FindBoosterCard: ; 1e31d (7:631d) scf ret -; lowers the chance of getting the same type multiple times +; lowers the chance of getting the same type multiple times. +; more specifically, when a card of type T is drawn, T's new chances become +; min (1, wBoosterDataTypeChances[T] - wBoosterAveragedTypeChances). UpdateBoosterCardTypesChanceByte: ; 1e350 (7:6350) push hl push bc ld a, [wBoosterSelectedCardType] ld c, a ld b, $00 - ld hl, wBoosterDataTypeChanceData + ld hl, wBoosterDataTypeChances add hl, bc - ld a,[wBoosterDataAveragedChance] + ld a,[wBoosterAveragedTypeChances] ld c, a ld a, [hl] sub c @@ -290,7 +294,9 @@ UpdateBoosterCardTypesChanceByte: ; 1e350 (7:6350) pop hl ret -GenerateBoosterEnergy: ; 1e3db (7:63db) +; generates between 0 and 10 energy cards for the current booster. +; the amount of energies and their probabilities vary with each booster. +GenerateBoosterEnergies: ; 1e3db (7:63db) ld hl, wBoosterDataEnergyFunctionPointer + 1 ld a, [hld] or a @@ -301,25 +307,27 @@ GenerateBoosterEnergy: ; 1e3db (7:63db) .noFunctionPointer ld a, [hl] or a - ret z + ret z ; return if no hardcoded energy either push af - call AddBoosterEnergyToWram + call AddBoosterEnergyToDrawnEnergies pop af ret -AddBoosterEnergyToWram: ; 1e380 (7:6380) - ld [wBoosterTempData], a - call AddCardToBoosterEnergies +AddBoosterEnergyToDrawnEnergies: ; 1e380 (7:6380) + ld [wBoosterTempCard], a + call AddBoosterCardToDrawnEnergies ret +; generates a random energy card GenerateEndingEnergy: ; 1e387 (7:6387) - ld a, $06 + ld a, COLORLESS - FIRE call Random add a, $01 - jr AddBoosterEnergyToWram + jr AddBoosterEnergyToDrawnEnergies -GenerateRandomEnergyBoosterPack: ; 1e390 (7:6390) - ld a, $0a +; generates a booster with 10 random energies +GenerateRandomEnergyBooster: ; 1e390 (7:6390) + ld a, NUM_CARDS_IN_BOOSTER .generateEnergyLoop push af call GenerateEndingEnergy @@ -330,25 +338,26 @@ GenerateRandomEnergyBoosterPack: ; 1e390 (7:6390) GenerateEnergyBoosterLightningFire: ; 1e39c (7:639c) ld hl, EnergyBoosterLightningFireData - jr CreateEnergyBooster + jr GenerateTwoTypesEnergyBooster GenerateEnergyBoosterWaterFighting: ; 1e3a1 (7:63a1) ld hl, EnergyBoosterWaterFightingData - jr CreateEnergyBooster + jr GenerateTwoTypesEnergyBooster GenerateEnergyBoosterGrassPsychic: ; 1e3a6 (7:63a6) ld hl, EnergyBoosterGrassPsychicData - jr CreateEnergyBooster + jr GenerateTwoTypesEnergyBooster -CreateEnergyBooster: ; 1e3ab (7:63ab) +; generates a booster with 5 energies of 2 different types each +GenerateTwoTypesEnergyBooster: ; 1e3ab (7:63ab) ld b, $02 .addTwoEnergiesToBoosterLoop - ld c, $05 + ld c, NUM_CARDS_IN_BOOSTER / 2 .addEnergyToBoosterLoop push hl push bc ld a, [hl] - call AddBoosterEnergyToWram + call AddBoosterEnergyToDrawnEnergies pop bc pop hl dec c @@ -370,17 +379,17 @@ EnergyBoosterWaterFightingData: EnergyBoosterGrassPsychicData: db GRASS_ENERGY, PSYCHIC_ENERGY -AddCardToBoosterEnergies: ; 1e3cf (7:63cf) +AddBoosterCardToDrawnEnergies: ; 1e3cf (7:63cf) push hl - ld hl, wPlayerDeck + $b + ld hl, wBoosterTempEnergiesDrawn call CopyToFirstEmptyByte call AddBoosterCardToTempCardCollection pop hl ret -AddCardToBoosterList: ; 1e3db (7:63db) +AddBoosterCardToDrawnNonEnergies: ; 1e3db (7:63db) push hl - ld hl, wPlayerDeck + ld hl, wBoosterTempNonEnergiesDrawn call CopyToFirstEmptyByte call AddBoosterCardToTempCardCollection pop hl @@ -391,22 +400,23 @@ CopyToFirstEmptyByte: ; 1e3e7 (7:63e7) or a jr nz, CopyToFirstEmptyByte dec hl - ld a, [wBoosterTempData] + ld a, [wBoosterTempCard] ld [hli], a xor a ld [hl], a ret -CopyBoosterEnergiesToBooster: ; 1e3f3 (7:63f3) +; trim empty slots in wBoosterCardsDrawn between regular cards and energies +PutEnergiesAndNonEnergiesTogether: ; 1e3f3 (7:63f3) push hl - ld hl, wPlayerDeck + $b + ld hl, wBoosterTempEnergiesDrawn .loopThroughExtraCards ld a, [hli] or a jr z, .endOfCards - ld [wBoosterTempData], a + ld [wBoosterTempCard], a push hl - ld hl, wPlayerDeck + ld hl, wBoosterTempNonEnergiesDrawn call CopyToFirstEmptyByte pop hl jr .loopThroughExtraCards @@ -416,7 +426,7 @@ CopyBoosterEnergiesToBooster: ; 1e3f3 (7:63f3) AddBoosterCardsToCollection:; 1e40a (7:640a) push hl - ld hl, wPlayerDeck + ld hl, wBoosterCardsDrawn .addCardsLoop ld a, [hli] or a @@ -430,16 +440,16 @@ AddBoosterCardsToCollection:; 1e40a (7:640a) AddBoosterCardToTempCardCollection: ; 1e419 (7:6419) push hl ld h, wTempCardCollection >> 8 - ld a, [wBoosterTempData] + ld a, [wBoosterTempCard] ld l, a inc [hl] pop hl ret -CheckByteInWramZeroed: ; 1e423 (7:6423) +IsByteInTempCardCollectionZero: ; 1e423 (7:6423) push hl ld h, wTempCardCollection >> 8 - ld a, [wBoosterTempData] + ld a, [wBoosterTempCard] ld l, a ld a, [hl] pop hl @@ -447,17 +457,18 @@ CheckByteInWramZeroed: ; 1e423 (7:6423) ccf ret -; clears wPlayerDeck and wTempCardCollection -; copies rarity amounts to ram and averages them into wBoosterDataAveragedChance +; clears wBoosterCardsDrawn and wTempCardCollection +; copies booster data to wBoosterData* *CurSet, *EnergyFunctionPointer, and *TypeChances +; copies rarity amounts to wBoosterData*Amount and averages them into wBoosterAveragedTypeChances InitBoosterData: ; 1e430 (7:6430) - ld c, $16 - ld hl, wPlayerDeck + ld c, wBoosterCardsDrawnEnd - wBoosterCardsDrawn + ld hl, wBoosterCardsDrawn xor a .clearPlayerDeckLoop ld [hli], a dec c jr nz, .clearPlayerDeckLoop - ld c, $00 + ld c, $00 ; $100 ld hl, wTempCardCollection xor a .clearTempCardCollectionLoop @@ -465,14 +476,14 @@ InitBoosterData: ; 1e430 (7:6430) dec c jr nz, .clearTempCardCollectionLoop call FindBoosterDataPointer - ld de, wBoosterDataCurSet - ld bc, $c - call CopyDataHLtoDE + ld de, wBoosterDataSet + ld bc, wBoosterDataTypeChances - wBoosterDataSet + NUM_BOOSTER_CARD_TYPES ; Pack2 - Pack1 + call CopyDataHLtoDE ; load booster pack data to wram call LoadRarityAmountsToWram ld bc, $0 ld d, NUM_BOOSTER_CARD_TYPES ld e, $0 - ld hl, wBoosterDataTypeChanceData + ld hl, wBoosterDataTypeChances .addChanceBytesLoop ld a, [hli] or a @@ -485,12 +496,12 @@ InitBoosterData: ; 1e430 (7:6430) jr nz, .addChanceBytesLoop call DivideBCbyDE ld a, c - ld [wBoosterDataAveragedChance], a + ld [wBoosterAveragedTypeChances], a ret FindBoosterDataPointer: ; 1e46f (7:646f) push bc - ld a, [wBoosterDataIndex] + ld a, [wBoosterIndex] add a ld c, a ld b, $0 @@ -534,7 +545,7 @@ BoosterDataJumptable: ; 1e480 (7:6480) dw PackRandomEnergies LoadRarityAmountsToWram: ; 1e4ba (7:64ba) - ld a, [wBoosterDataCurSet] + ld a, [wBoosterDataSet] add a add a ld c, a @@ -551,10 +562,18 @@ LoadRarityAmountsToWram: ; 1e4ba (7:64ba) ret BoosterSetRarityAmountTable: ; 1e4d4 (7::64d4) - db $01, $05, $03, $01 ; other, commons, uncommons, rares - db $01, $05, $03, $01 ; other, commons, uncommons, rares - db $00, $06, $03, $01 ; other, commons, uncommons, rares - db $00, $06, $03, $01 ; other, commons, uncommons, rares +; energies, commons, uncommons, rares +; commons + uncommons + rares needs to be equal to 10 minus the number of energy cards +; defined in the pack's data below; otherwise, the number of cards in the pack won't be 10. + db $01, $05, $03, $01 ; COLOSSEUM >> 4 + db $01, $05, $03, $01 ; EVOLUTION >> 4 + db $00, $06, $03, $01 ; MYSTERY >> 4 + db $00, $06, $03, $01 ; LABORATORY >> 4 + +; For the energy or energy generation function, there are three options: +; - Ponter to a function that generates energies (some generate one, some generate a full pack) +; - A single energy of a specific type +; - $0000 if no card in the pack is an energy PackColosseumNeutral:: ; 1e4e4 (7:64e4) db COLOSSEUM >> 4 ; booster pack set @@ -978,7 +997,7 @@ PackEnergyGrassPsychic:: ; 1e628 (7:6628) PackRandomEnergies:: ; 1e634 (7:6634) db COLOSSEUM >> 4 ; booster pack set - dw GenerateRandomEnergyBoosterPack ; energy or energy generation function + dw GenerateRandomEnergyBooster ; energy or energy generation function ; Card Type Chances db $00 ; Grass Type Chance diff --git a/src/engine/home.asm b/src/engine/home.asm index 16927de..b1fa021 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -1375,7 +1375,7 @@ HtimesL: ; 0879 (0:0879) ret ; 0x88f -; return a random number between 0 and a in a +; return a random number between 0 and a (exclusive) in a Random: ; 088f (0:088f) push hl ld h, a -- cgit v1.2.3 From ba9075ff6e0537ab27e40a233aa28a976b0731d1 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Thu, 8 Feb 2018 00:20:20 +0100 Subject: Move booster pack data to data/ --- src/engine/booster_packs.asm | 566 +++++++++++++++++++++++ src/engine/boosters.asm | 1013 ------------------------------------------ 2 files changed, 566 insertions(+), 1013 deletions(-) create mode 100644 src/engine/booster_packs.asm delete mode 100755 src/engine/boosters.asm (limited to 'src/engine') diff --git a/src/engine/booster_packs.asm b/src/engine/booster_packs.asm new file mode 100644 index 0000000..e3180fe --- /dev/null +++ b/src/engine/booster_packs.asm @@ -0,0 +1,566 @@ +GenerateBoosterPack: ; 1e1c4 (7:61c4) + push hl + push bc + push de + ld [wBoosterIndex], a +.noCardsFoundLoop + call InitBoosterData + call GenerateBoosterEnergies + call GenerateBoosterNonEnergies + jr c, .noCardsFoundLoop + call PutEnergiesAndNonEnergiesTogether + call AddBoosterCardsToCollection + pop de + pop bc + pop hl + ret + +; generate all Pokemon or Trainer cards (if any) for the current booster pack +GenerateBoosterNonEnergies: ; 1e1df (7:61df) + ld a, STAR + ld [wBoosterCurRarity], a +.generateCardLoop + call FindCurRarityChance + ld a, [hl] + or a + jr z, .noMoreOfCurrentRarity + call FindCardsInSetAndRarity + call FindTotalTypeChances + or a + jr z, .noValidCards + call Random + call DetermineBoosterCardType + call FindBoosterCard + call UpdateBoosterCardTypesChanceByte + call AddBoosterCardToDrawnNonEnergies + call FindCurRarityChance + dec [hl] + jr .generateCardLoop +.noMoreOfCurrentRarity + ld a, [wBoosterCurRarity] + dec a + ld [wBoosterCurRarity], a + bit 7, a ; any rarity left to check? + jr z, .generateCardLoop + or a + ret +.noValidCards + rst $38 + scf + ret + +; return hl pointing to wBoosterDataAmount[wBoosterCurRarity] +FindCurRarityChance: ; 1e219 (7:6219) + push bc + ld hl, wBoosterDataCommonAmount + ld a, [wBoosterCurRarity] + ld c, a + ld b, $0 + add hl, bc + pop bc + ret + +FindCardsInSetAndRarity: ; 1e226 (7:6226) + ld c, NUM_BOOSTER_CARD_TYPES + ld hl, wBoosterAmountOfCardTypeTable + xor a +.deleteTypeTableLoop + ld [hli], a + dec c + jr nz, .deleteTypeTableLoop + xor a + ld hl, wBoosterViableCardList + ld [hl], a + ld de, $1 +.checkCardViableLoop + push de + ld a, e + ld [wBoosterTempCard], a + call IsByteInTempCardCollectionZero + jr c, .finishedWithCurrentCard + call CheckCardViable + jr c, .finishedWithCurrentCard + ld a, [wBoosterCurrentCardType] + call GetCardType + push af + push hl + ld c, a + ld b, $00 + ld hl, wBoosterAmountOfCardTypeTable + add hl, bc + inc [hl] + pop hl + ld a, [wBoosterTempCard] + ld [hli], a + pop af + ld [hli], a + xor a + ld [hl], a +.finishedWithCurrentCard + pop de + inc e + ld a, e + cp NUM_CARDS + 1 + jr c, .checkCardViableLoop + ret + +CheckCardViable: ; 1e268 (7:6268) + push bc + ld a, e + call GetCardHeader + ld [wBoosterCurrentCardType], a + ld a, b + ld [wBoosterCurrentCardRarity], a + ld a, c + ld [wBoosterCurrentCardSet], a + ld a, [wBoosterCurrentCardRarity] + ld c, a + ld a, [wBoosterCurRarity] + cp c + jr nz, .invalidCard + ld a, [wBoosterCurrentCardType] + call GetCardType + cp BOOSTER_CARD_TYPE_ENERGY + jr z, .returnValidCard + ld a, [wBoosterCurrentCardSet] + swap a + and $0f + ld c, a + ld a, [wBoosterDataSet] + cp c + jr nz, .invalidCard +.returnValidCard + or a + jr .return +.invalidCard + scf +.return + pop bc + ret + +; Map a card's TYPE_* constant given in a to its BOOSTER_CARD_TYPE_* constant +GetCardType: ; 1e2a0 (7:62a0) + push hl + push bc + ld hl, CardTypeTable + cp NUM_CARD_TYPES + jr nc, .loadType + ld c, a + ld b, $00 + add hl, bc +.loadType + ld a, [hl] + pop bc + pop hl + ret + +CardTypeTable: ; 1e2b1 (7:62b1) + db BOOSTER_CARD_TYPE_FIRE ; TYPE_PKMN_FIRE + db BOOSTER_CARD_TYPE_GRASS ; TYPE_PKMN_GRASS + db BOOSTER_CARD_TYPE_LIGHTNING ; TYPE_PKMN_LIGHTNING + db BOOSTER_CARD_TYPE_WATER ; TYPE_PKMN_WATER + db BOOSTER_CARD_TYPE_FIGHTING ; TYPE_PKMN_FIGHTING + db BOOSTER_CARD_TYPE_PSYCHIC ; TYPE_PKMN_PSYCHIC + db BOOSTER_CARD_TYPE_COLORLESS ; TYPE_PKMN_COLORLESS + db BOOSTER_CARD_TYPE_TRAINER ; TYPE_PKMN_UNUSED + db BOOSTER_CARD_TYPE_ENERGY ; TYPE_ENERGY_FIRE + db BOOSTER_CARD_TYPE_ENERGY ; TYPE_ENERGY_GRASS + db BOOSTER_CARD_TYPE_ENERGY ; TYPE_ENERGY_LIGHTNING + db BOOSTER_CARD_TYPE_ENERGY ; TYPE_ENERGY_WATER + db BOOSTER_CARD_TYPE_ENERGY ; TYPE_ENERGY_FIGHTING + db BOOSTER_CARD_TYPE_ENERGY ; TYPE_ENERGY_PSYCHIC + db BOOSTER_CARD_TYPE_ENERGY ; TYPE_ENERGY_COLORLESS + db BOOSTER_CARD_TYPE_TRAINER ; TYPE_ENERGY_UNUSED + db BOOSTER_CARD_TYPE_TRAINER ; TYPE_TRAINER + +FindTotalTypeChances: ; 1e2c2 (7:62c2) + ld c, NUM_BOOSTER_CARD_TYPES + xor a + ld hl, wBoosterTempTypeChanceTable +.deleteTempTypeChanceTableLoop + ld [hli], a + dec c + jr nz, .deleteTempTypeChanceTableLoop + ld [wd4ca], a + ld bc, $00 +.checkIfTypeIsValid + push bc + ld hl, wBoosterAmountOfCardTypeTable + add hl, bc + ld a, [hl] + or a + jr z, .amountOfTypeOrChanceZero + ld hl, wBoosterDataTypeChances + add hl, bc + ld a, [hl] + or a + jr z, .amountOfTypeOrChanceZero + ld hl, wBoosterTempTypeChanceTable + add hl, bc + ld [hl], a + ld a, [wd4ca] + add [hl] + ld [wd4ca], a +.amountOfTypeOrChanceZero + pop bc + inc c + ld a, c + cp NUM_BOOSTER_CARD_TYPES + jr c, .checkIfTypeIsValid + ld a, [wd4ca] + ret + +DetermineBoosterCardType: ; 1e2fa (7:62fa) + ld [wd4ca], a + ld c, $00 + ld hl, wBoosterTempTypeChanceTable +.loopThroughCardTypes + ld a, [hl] + or a + jr z, .skipNoChanceType + ld a, [wd4ca] + sub [hl] + ld [wd4ca], a + jr c, .foundCardType +.skipNoChanceType + inc hl + inc c + ld a, c + cp a, NUM_BOOSTER_CARD_TYPES + jr c, .loopThroughCardTypes + ld a, BOOSTER_CARD_TYPE_ENERGY +.foundCardType + ld a, c + ld [wBoosterSelectedCardType], a + ret + +FindBoosterCard: ; 1e31d (7:631d) + ld a, [wBoosterSelectedCardType] + ld c, a + ld b, $00 + ld hl, wBoosterAmountOfCardTypeTable + add hl, bc + ld a, [hl] + call Random + ld [wd4ca], a + ld hl, wBoosterViableCardList +.findMatchingCardLoop + ld a, [hli] + or a + jr z, .noValidCardFound + ld [wBoosterTempCard], a + ld a, [wBoosterSelectedCardType] + cp [hl] + jr nz, .cardIncorrectType + ld a, [wd4ca] + or a + jr z, .returnWithCurrentCard + dec a + ld [wd4ca], a +.cardIncorrectType + inc hl + jr .findMatchingCardLoop +.returnWithCurrentCard + or a + ret +.noValidCardFound + rst $38 + scf + ret + +; lowers the chance of getting the same type multiple times. +; more specifically, when a card of type T is drawn, T's new chances become +; min (1, wBoosterDataTypeChances[T] - wBoosterAveragedTypeChances). +UpdateBoosterCardTypesChanceByte: ; 1e350 (7:6350) + push hl + push bc + ld a, [wBoosterSelectedCardType] + ld c, a + ld b, $00 + ld hl, wBoosterDataTypeChances + add hl, bc + ld a,[wBoosterAveragedTypeChances] + ld c, a + ld a, [hl] + sub c + ld [hl], a + jr z, .chanceLessThanOne + jr nc, .stillSomeChanceLeft +.chanceLessThanOne + ld a, $01 + ld [hl], a +.stillSomeChanceLeft + pop bc + pop hl + ret + +; generates between 0 and 10 energy cards for the current booster. +; the amount of energies and their probabilities vary with each booster. +GenerateBoosterEnergies: ; 1e3db (7:63db) + ld hl, wBoosterDataEnergyFunctionPointer + 1 + ld a, [hld] + or a + jr z, .noFunctionPointer + ld l, [hl] + ld h, a + jp hl +.noFunctionPointer + ld a, [hl] + or a + ret z ; return if no hardcoded energy either + push af + call AddBoosterEnergyToDrawnEnergies + pop af + ret + +AddBoosterEnergyToDrawnEnergies: ; 1e380 (7:6380) + ld [wBoosterTempCard], a + call AddBoosterCardToDrawnEnergies + ret + +; generates a random energy card +GenerateEndingEnergy: ; 1e387 (7:6387) + ld a, COLORLESS - FIRE + call Random + add a, $01 + jr AddBoosterEnergyToDrawnEnergies + +; generates a booster with 10 random energies +GenerateRandomEnergyBooster: ; 1e390 (7:6390) + ld a, NUM_CARDS_IN_BOOSTER +.generateEnergyLoop + push af + call GenerateEndingEnergy + pop af + dec a + jr nz, .generateEnergyLoop + jr ZeroBoosterRarityData + +GenerateEnergyBoosterLightningFire: ; 1e39c (7:639c) + ld hl, EnergyBoosterLightningFireData + jr GenerateTwoTypesEnergyBooster + +GenerateEnergyBoosterWaterFighting: ; 1e3a1 (7:63a1) + ld hl, EnergyBoosterWaterFightingData + jr GenerateTwoTypesEnergyBooster + +GenerateEnergyBoosterGrassPsychic: ; 1e3a6 (7:63a6) + ld hl, EnergyBoosterGrassPsychicData + jr GenerateTwoTypesEnergyBooster + +; generates a booster with 5 energies of 2 different types each +GenerateTwoTypesEnergyBooster: ; 1e3ab (7:63ab) + ld b, $02 +.addTwoEnergiesToBoosterLoop + ld c, NUM_CARDS_IN_BOOSTER / 2 +.addEnergyToBoosterLoop + push hl + push bc + ld a, [hl] + call AddBoosterEnergyToDrawnEnergies + pop bc + pop hl + dec c + jr nz, .addEnergyToBoosterLoop + inc hl + dec b + jr nz, .addTwoEnergiesToBoosterLoop +ZeroBoosterRarityData: + xor a + ld [wBoosterDataCommonAmount], a + ld [wBoosterDataUncommonAmount], a + ld [wBoosterDataRareAmount], a + ret + +EnergyBoosterLightningFireData: + db LIGHTNING_ENERGY, FIRE_ENERGY +EnergyBoosterWaterFightingData: + db WATER_ENERGY, FIGHTING_ENERGY +EnergyBoosterGrassPsychicData: + db GRASS_ENERGY, PSYCHIC_ENERGY + +AddBoosterCardToDrawnEnergies: ; 1e3cf (7:63cf) + push hl + ld hl, wBoosterTempEnergiesDrawn + call CopyToFirstEmptyByte + call AddBoosterCardToTempCardCollection + pop hl + ret + +AddBoosterCardToDrawnNonEnergies: ; 1e3db (7:63db) + push hl + ld hl, wBoosterTempNonEnergiesDrawn + call CopyToFirstEmptyByte + call AddBoosterCardToTempCardCollection + pop hl + ret + +CopyToFirstEmptyByte: ; 1e3e7 (7:63e7) + ld a, [hli] + or a + jr nz, CopyToFirstEmptyByte + dec hl + ld a, [wBoosterTempCard] + ld [hli], a + xor a + ld [hl], a + ret + +; trim empty slots in wBoosterCardsDrawn between regular cards and energies +PutEnergiesAndNonEnergiesTogether: ; 1e3f3 (7:63f3) + push hl + ld hl, wBoosterTempEnergiesDrawn +.loopThroughExtraCards + ld a, [hli] + or a + jr z, .endOfCards + ld [wBoosterTempCard], a + push hl + ld hl, wBoosterTempNonEnergiesDrawn + call CopyToFirstEmptyByte + pop hl + jr .loopThroughExtraCards +.endOfCards + pop hl + ret + +AddBoosterCardsToCollection:; 1e40a (7:640a) + push hl + ld hl, wBoosterCardsDrawn +.addCardsLoop + ld a, [hli] + or a + jr z, .noCardsLeft + call AddCardToCollection + jr .addCardsLoop +.noCardsLeft + pop hl + ret + +AddBoosterCardToTempCardCollection: ; 1e419 (7:6419) + push hl + ld h, wTempCardCollection >> 8 + ld a, [wBoosterTempCard] + ld l, a + inc [hl] + pop hl + ret + +IsByteInTempCardCollectionZero: ; 1e423 (7:6423) + push hl + ld h, wTempCardCollection >> 8 + ld a, [wBoosterTempCard] + ld l, a + ld a, [hl] + pop hl + cp $01 + ccf + ret + +; clears wBoosterCardsDrawn and wTempCardCollection +; copies booster data to wBoosterData* *CurSet, *EnergyFunctionPointer, and *TypeChances +; copies rarity amounts to wBoosterData*Amount and averages them into wBoosterAveragedTypeChances +InitBoosterData: ; 1e430 (7:6430) + ld c, wBoosterCardsDrawnEnd - wBoosterCardsDrawn + ld hl, wBoosterCardsDrawn + xor a +.clearPlayerDeckLoop + ld [hli], a + dec c + jr nz, .clearPlayerDeckLoop + ld c, $00 ; $100 + ld hl, wTempCardCollection + xor a +.clearTempCardCollectionLoop + ld [hli], a + dec c + jr nz, .clearTempCardCollectionLoop + call FindBoosterDataPointer + ld de, wBoosterDataSet + ld bc, wBoosterDataTypeChances - wBoosterDataSet + NUM_BOOSTER_CARD_TYPES ; Pack2 - Pack1 + call CopyDataHLtoDE ; load booster pack data to wram + call LoadRarityAmountsToWram + ld bc, $0 + ld d, NUM_BOOSTER_CARD_TYPES + ld e, $0 + ld hl, wBoosterDataTypeChances +.addChanceBytesLoop + ld a, [hli] + or a + jr z, .skipChanceByte + add c + ld c, a + inc e +.skipChanceByte + dec d + jr nz, .addChanceBytesLoop + call DivideBCbyDE + ld a, c + ld [wBoosterAveragedTypeChances], a + ret + +FindBoosterDataPointer: ; 1e46f (7:646f) + push bc + ld a, [wBoosterIndex] + add a + ld c, a + ld b, $0 + ld hl, BoosterDataJumptable + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a + pop bc + ret + +BoosterDataJumptable: ; 1e480 (7:6480) + dw PackColosseumNeutral + dw PackColosseumGrass + dw PackColosseumFire + dw PackColosseumWater + dw PackColosseumLightning + dw PackColosseumFighting + dw PackColosseumTrainer + dw PackEvolutionNeutral + dw PackEvolutionGrass + dw PackEvolutionNeutralFireEnergy + dw PackEvolutionWater + dw PackEvolutionFighting + dw PackEvolutionPsychic + dw PackEvolutionTrainer + dw PackMysteryNeutral + dw PackMysteryGrassColorless + dw PackMysteryWaterColorless + dw PackMysteryLightningColorless + dw PackMysteryFightingColorless + dw PackMysteryTrainerColorless + dw PackLaboratoryMostlyNeutral + dw PackLaboratoryGrass + dw PackLaboratoryWater + dw PackLaboratoryPsychic + dw PackLaboratoryTrainer + dw PackEnergyLightningFire + dw PackEnergyWaterFighting + dw PackEnergyGrassPsychic + dw PackRandomEnergies + +LoadRarityAmountsToWram: ; 1e4ba (7:64ba) + ld a, [wBoosterDataSet] + add a + add a + ld c, a + ld b, $00 + ld hl, BoosterSetRarityAmountTable + add hl, bc + inc hl + ld a, [hli] + ld [wBoosterDataCommonAmount], a + ld a, [hli] + ld [wBoosterDataUncommonAmount], a + ld a, [hli] + ld [wBoosterDataRareAmount], a + ret + +INCLUDE "data/booster_packs.asm" + + INCROM $1e640, $20000 \ No newline at end of file diff --git a/src/engine/boosters.asm b/src/engine/boosters.asm deleted file mode 100755 index 3b633a0..0000000 --- a/src/engine/boosters.asm +++ /dev/null @@ -1,1013 +0,0 @@ -GenerateBoosterPack: ; 1e1c4 (7:61c4) - push hl - push bc - push de - ld [wBoosterIndex], a -.noCardsFoundLoop - call InitBoosterData - call GenerateBoosterEnergies - call GenerateBoosterNonEnergies - jr c, .noCardsFoundLoop - call PutEnergiesAndNonEnergiesTogether - call AddBoosterCardsToCollection - pop de - pop bc - pop hl - ret - -; generate all Pokemon or Trainer cards (if any) for the current booster pack -GenerateBoosterNonEnergies: ; 1e1df (7:61df) - ld a, STAR - ld [wBoosterCurRarity], a -.generateCardLoop - call FindCurRarityChance - ld a, [hl] - or a - jr z, .noMoreOfCurrentRarity - call FindCardsInSetAndRarity - call FindTotalTypeChances - or a - jr z, .noValidCards - call Random - call DetermineBoosterCardType - call FindBoosterCard - call UpdateBoosterCardTypesChanceByte - call AddBoosterCardToDrawnNonEnergies - call FindCurRarityChance - dec [hl] - jr .generateCardLoop -.noMoreOfCurrentRarity - ld a, [wBoosterCurRarity] - dec a - ld [wBoosterCurRarity], a - bit 7, a ; any rarity left to check? - jr z, .generateCardLoop - or a - ret -.noValidCards - rst $38 - scf - ret - -; return hl pointing to wBoosterDataAmount[wBoosterCurRarity] -FindCurRarityChance: ; 1e219 (7:6219) - push bc - ld hl, wBoosterDataCommonAmount - ld a, [wBoosterCurRarity] - ld c, a - ld b, $0 - add hl, bc - pop bc - ret - -FindCardsInSetAndRarity: ; 1e226 (7:6226) - ld c, NUM_BOOSTER_CARD_TYPES - ld hl, wBoosterAmountOfCardTypeTable - xor a -.deleteTypeTableLoop - ld [hli], a - dec c - jr nz, .deleteTypeTableLoop - xor a - ld hl, wBoosterViableCardList - ld [hl], a - ld de, $1 -.checkCardViableLoop - push de - ld a, e - ld [wBoosterTempCard], a - call IsByteInTempCardCollectionZero - jr c, .finishedWithCurrentCard - call CheckCardViable - jr c, .finishedWithCurrentCard - ld a, [wBoosterCurrentCardType] - call GetCardType - push af - push hl - ld c, a - ld b, $00 - ld hl, wBoosterAmountOfCardTypeTable - add hl, bc - inc [hl] - pop hl - ld a, [wBoosterTempCard] - ld [hli], a - pop af - ld [hli], a - xor a - ld [hl], a -.finishedWithCurrentCard - pop de - inc e - ld a, e - cp NUM_CARDS + 1 - jr c, .checkCardViableLoop - ret - -CheckCardViable: ; 1e268 (7:6268) - push bc - ld a, e - call GetCardHeader - ld [wBoosterCurrentCardType], a - ld a, b - ld [wBoosterCurrentCardRarity], a - ld a, c - ld [wBoosterCurrentCardSet], a - ld a, [wBoosterCurrentCardRarity] - ld c, a - ld a, [wBoosterCurRarity] - cp c - jr nz, .invalidCard - ld a, [wBoosterCurrentCardType] - call GetCardType - cp BOOSTER_CARD_TYPE_ENERGY - jr z, .returnValidCard - ld a, [wBoosterCurrentCardSet] - swap a - and $0f - ld c, a - ld a, [wBoosterDataSet] - cp c - jr nz, .invalidCard -.returnValidCard - or a - jr .return -.invalidCard - scf -.return - pop bc - ret - -; Map a card's TYPE_* constant given in a to its BOOSTER_CARD_TYPE_* constant -GetCardType: ; 1e2a0 (7:62a0) - push hl - push bc - ld hl, CardTypeTable - cp NUM_CARD_TYPES - jr nc, .loadType - ld c, a - ld b, $00 - add hl, bc -.loadType - ld a, [hl] - pop bc - pop hl - ret - -CardTypeTable: ; 1e2b1 (7:62b1) - db BOOSTER_CARD_TYPE_FIRE ; TYPE_PKMN_FIRE - db BOOSTER_CARD_TYPE_GRASS ; TYPE_PKMN_GRASS - db BOOSTER_CARD_TYPE_LIGHTNING ; TYPE_PKMN_LIGHTNING - db BOOSTER_CARD_TYPE_WATER ; TYPE_PKMN_WATER - db BOOSTER_CARD_TYPE_FIGHTING ; TYPE_PKMN_FIGHTING - db BOOSTER_CARD_TYPE_PSYCHIC ; TYPE_PKMN_PSYCHIC - db BOOSTER_CARD_TYPE_COLORLESS ; TYPE_PKMN_COLORLESS - db BOOSTER_CARD_TYPE_TRAINER ; TYPE_PKMN_UNUSED - db BOOSTER_CARD_TYPE_ENERGY ; TYPE_ENERGY_FIRE - db BOOSTER_CARD_TYPE_ENERGY ; TYPE_ENERGY_GRASS - db BOOSTER_CARD_TYPE_ENERGY ; TYPE_ENERGY_LIGHTNING - db BOOSTER_CARD_TYPE_ENERGY ; TYPE_ENERGY_WATER - db BOOSTER_CARD_TYPE_ENERGY ; TYPE_ENERGY_FIGHTING - db BOOSTER_CARD_TYPE_ENERGY ; TYPE_ENERGY_PSYCHIC - db BOOSTER_CARD_TYPE_ENERGY ; TYPE_ENERGY_COLORLESS - db BOOSTER_CARD_TYPE_TRAINER ; TYPE_ENERGY_UNUSED - db BOOSTER_CARD_TYPE_TRAINER ; TYPE_TRAINER - -FindTotalTypeChances: ; 1e2c2 (7:62c2) - ld c, NUM_BOOSTER_CARD_TYPES - xor a - ld hl, wBoosterTempTypeChanceTable -.deleteTempTypeChanceTableLoop - ld [hli], a - dec c - jr nz, .deleteTempTypeChanceTableLoop - ld [wd4ca], a - ld bc, $00 -.checkIfTypeIsValid - push bc - ld hl, wBoosterAmountOfCardTypeTable - add hl, bc - ld a, [hl] - or a - jr z, .amountOfTypeOrChanceZero - ld hl, wBoosterDataTypeChances - add hl, bc - ld a, [hl] - or a - jr z, .amountOfTypeOrChanceZero - ld hl, wBoosterTempTypeChanceTable - add hl, bc - ld [hl], a - ld a, [wd4ca] - add [hl] - ld [wd4ca], a -.amountOfTypeOrChanceZero - pop bc - inc c - ld a, c - cp NUM_BOOSTER_CARD_TYPES - jr c, .checkIfTypeIsValid - ld a, [wd4ca] - ret - -DetermineBoosterCardType: ; 1e2fa (7:62fa) - ld [wd4ca], a - ld c, $00 - ld hl, wBoosterTempTypeChanceTable -.loopThroughCardTypes - ld a, [hl] - or a - jr z, .skipNoChanceType - ld a, [wd4ca] - sub [hl] - ld [wd4ca], a - jr c, .foundCardType -.skipNoChanceType - inc hl - inc c - ld a, c - cp a, NUM_BOOSTER_CARD_TYPES - jr c, .loopThroughCardTypes - ld a, BOOSTER_CARD_TYPE_ENERGY -.foundCardType - ld a, c - ld [wBoosterSelectedCardType], a - ret - -FindBoosterCard: ; 1e31d (7:631d) - ld a, [wBoosterSelectedCardType] - ld c, a - ld b, $00 - ld hl, wBoosterAmountOfCardTypeTable - add hl, bc - ld a, [hl] - call Random - ld [wd4ca], a - ld hl, wBoosterViableCardList -.findMatchingCardLoop - ld a, [hli] - or a - jr z, .noValidCardFound - ld [wBoosterTempCard], a - ld a, [wBoosterSelectedCardType] - cp [hl] - jr nz, .cardIncorrectType - ld a, [wd4ca] - or a - jr z, .returnWithCurrentCard - dec a - ld [wd4ca], a -.cardIncorrectType - inc hl - jr .findMatchingCardLoop -.returnWithCurrentCard - or a - ret -.noValidCardFound - rst $38 - scf - ret - -; lowers the chance of getting the same type multiple times. -; more specifically, when a card of type T is drawn, T's new chances become -; min (1, wBoosterDataTypeChances[T] - wBoosterAveragedTypeChances). -UpdateBoosterCardTypesChanceByte: ; 1e350 (7:6350) - push hl - push bc - ld a, [wBoosterSelectedCardType] - ld c, a - ld b, $00 - ld hl, wBoosterDataTypeChances - add hl, bc - ld a,[wBoosterAveragedTypeChances] - ld c, a - ld a, [hl] - sub c - ld [hl], a - jr z, .chanceLessThanOne - jr nc, .stillSomeChanceLeft -.chanceLessThanOne - ld a, $01 - ld [hl], a -.stillSomeChanceLeft - pop bc - pop hl - ret - -; generates between 0 and 10 energy cards for the current booster. -; the amount of energies and their probabilities vary with each booster. -GenerateBoosterEnergies: ; 1e3db (7:63db) - ld hl, wBoosterDataEnergyFunctionPointer + 1 - ld a, [hld] - or a - jr z, .noFunctionPointer - ld l, [hl] - ld h, a - jp hl -.noFunctionPointer - ld a, [hl] - or a - ret z ; return if no hardcoded energy either - push af - call AddBoosterEnergyToDrawnEnergies - pop af - ret - -AddBoosterEnergyToDrawnEnergies: ; 1e380 (7:6380) - ld [wBoosterTempCard], a - call AddBoosterCardToDrawnEnergies - ret - -; generates a random energy card -GenerateEndingEnergy: ; 1e387 (7:6387) - ld a, COLORLESS - FIRE - call Random - add a, $01 - jr AddBoosterEnergyToDrawnEnergies - -; generates a booster with 10 random energies -GenerateRandomEnergyBooster: ; 1e390 (7:6390) - ld a, NUM_CARDS_IN_BOOSTER -.generateEnergyLoop - push af - call GenerateEndingEnergy - pop af - dec a - jr nz, .generateEnergyLoop - jr ZeroBoosterRarityData - -GenerateEnergyBoosterLightningFire: ; 1e39c (7:639c) - ld hl, EnergyBoosterLightningFireData - jr GenerateTwoTypesEnergyBooster - -GenerateEnergyBoosterWaterFighting: ; 1e3a1 (7:63a1) - ld hl, EnergyBoosterWaterFightingData - jr GenerateTwoTypesEnergyBooster - -GenerateEnergyBoosterGrassPsychic: ; 1e3a6 (7:63a6) - ld hl, EnergyBoosterGrassPsychicData - jr GenerateTwoTypesEnergyBooster - -; generates a booster with 5 energies of 2 different types each -GenerateTwoTypesEnergyBooster: ; 1e3ab (7:63ab) - ld b, $02 -.addTwoEnergiesToBoosterLoop - ld c, NUM_CARDS_IN_BOOSTER / 2 -.addEnergyToBoosterLoop - push hl - push bc - ld a, [hl] - call AddBoosterEnergyToDrawnEnergies - pop bc - pop hl - dec c - jr nz, .addEnergyToBoosterLoop - inc hl - dec b - jr nz, .addTwoEnergiesToBoosterLoop -ZeroBoosterRarityData: - xor a - ld [wBoosterDataCommonAmount], a - ld [wBoosterDataUncommonAmount], a - ld [wBoosterDataRareAmount], a - ret - -EnergyBoosterLightningFireData: - db LIGHTNING_ENERGY, FIRE_ENERGY -EnergyBoosterWaterFightingData: - db WATER_ENERGY, FIGHTING_ENERGY -EnergyBoosterGrassPsychicData: - db GRASS_ENERGY, PSYCHIC_ENERGY - -AddBoosterCardToDrawnEnergies: ; 1e3cf (7:63cf) - push hl - ld hl, wBoosterTempEnergiesDrawn - call CopyToFirstEmptyByte - call AddBoosterCardToTempCardCollection - pop hl - ret - -AddBoosterCardToDrawnNonEnergies: ; 1e3db (7:63db) - push hl - ld hl, wBoosterTempNonEnergiesDrawn - call CopyToFirstEmptyByte - call AddBoosterCardToTempCardCollection - pop hl - ret - -CopyToFirstEmptyByte: ; 1e3e7 (7:63e7) - ld a, [hli] - or a - jr nz, CopyToFirstEmptyByte - dec hl - ld a, [wBoosterTempCard] - ld [hli], a - xor a - ld [hl], a - ret - -; trim empty slots in wBoosterCardsDrawn between regular cards and energies -PutEnergiesAndNonEnergiesTogether: ; 1e3f3 (7:63f3) - push hl - ld hl, wBoosterTempEnergiesDrawn -.loopThroughExtraCards - ld a, [hli] - or a - jr z, .endOfCards - ld [wBoosterTempCard], a - push hl - ld hl, wBoosterTempNonEnergiesDrawn - call CopyToFirstEmptyByte - pop hl - jr .loopThroughExtraCards -.endOfCards - pop hl - ret - -AddBoosterCardsToCollection:; 1e40a (7:640a) - push hl - ld hl, wBoosterCardsDrawn -.addCardsLoop - ld a, [hli] - or a - jr z, .noCardsLeft - call AddCardToCollection - jr .addCardsLoop -.noCardsLeft - pop hl - ret - -AddBoosterCardToTempCardCollection: ; 1e419 (7:6419) - push hl - ld h, wTempCardCollection >> 8 - ld a, [wBoosterTempCard] - ld l, a - inc [hl] - pop hl - ret - -IsByteInTempCardCollectionZero: ; 1e423 (7:6423) - push hl - ld h, wTempCardCollection >> 8 - ld a, [wBoosterTempCard] - ld l, a - ld a, [hl] - pop hl - cp $01 - ccf - ret - -; clears wBoosterCardsDrawn and wTempCardCollection -; copies booster data to wBoosterData* *CurSet, *EnergyFunctionPointer, and *TypeChances -; copies rarity amounts to wBoosterData*Amount and averages them into wBoosterAveragedTypeChances -InitBoosterData: ; 1e430 (7:6430) - ld c, wBoosterCardsDrawnEnd - wBoosterCardsDrawn - ld hl, wBoosterCardsDrawn - xor a -.clearPlayerDeckLoop - ld [hli], a - dec c - jr nz, .clearPlayerDeckLoop - ld c, $00 ; $100 - ld hl, wTempCardCollection - xor a -.clearTempCardCollectionLoop - ld [hli], a - dec c - jr nz, .clearTempCardCollectionLoop - call FindBoosterDataPointer - ld de, wBoosterDataSet - ld bc, wBoosterDataTypeChances - wBoosterDataSet + NUM_BOOSTER_CARD_TYPES ; Pack2 - Pack1 - call CopyDataHLtoDE ; load booster pack data to wram - call LoadRarityAmountsToWram - ld bc, $0 - ld d, NUM_BOOSTER_CARD_TYPES - ld e, $0 - ld hl, wBoosterDataTypeChances -.addChanceBytesLoop - ld a, [hli] - or a - jr z, .skipChanceByte - add c - ld c, a - inc e -.skipChanceByte - dec d - jr nz, .addChanceBytesLoop - call DivideBCbyDE - ld a, c - ld [wBoosterAveragedTypeChances], a - ret - -FindBoosterDataPointer: ; 1e46f (7:646f) - push bc - ld a, [wBoosterIndex] - add a - ld c, a - ld b, $0 - ld hl, BoosterDataJumptable - add hl, bc - ld a, [hli] - ld h, [hl] - ld l, a - pop bc - ret - -BoosterDataJumptable: ; 1e480 (7:6480) - dw PackColosseumNeutral - dw PackColosseumGrass - dw PackColosseumFire - dw PackColosseumWater - dw PackColosseumLightning - dw PackColosseumFighting - dw PackColosseumTrainer - dw PackEvolutionNeutral - dw PackEvolutionGrass - dw PackEvolutionNeutralFireEnergy - dw PackEvolutionWater - dw PackEvolutionFighting - dw PackEvolutionPsychic - dw PackEvolutionTrainer - dw PackMysteryNeutral - dw PackMysteryGrassColorless - dw PackMysteryWaterColorless - dw PackMysteryLightningColorless - dw PackMysteryFightingColorless - dw PackMysteryTrainerColorless - dw PackLaboratoryMostlyNeutral - dw PackLaboratoryGrass - dw PackLaboratoryWater - dw PackLaboratoryPsychic - dw PackLaboratoryTrainer - dw PackEnergyLightningFire - dw PackEnergyWaterFighting - dw PackEnergyGrassPsychic - dw PackRandomEnergies - -LoadRarityAmountsToWram: ; 1e4ba (7:64ba) - ld a, [wBoosterDataSet] - add a - add a - ld c, a - ld b, $00 - ld hl, BoosterSetRarityAmountTable - add hl, bc - inc hl - ld a, [hli] - ld [wBoosterDataCommonAmount], a - ld a, [hli] - ld [wBoosterDataUncommonAmount], a - ld a, [hli] - ld [wBoosterDataRareAmount], a - ret - -BoosterSetRarityAmountTable: ; 1e4d4 (7::64d4) -; energies, commons, uncommons, rares -; commons + uncommons + rares needs to be equal to 10 minus the number of energy cards -; defined in the pack's data below; otherwise, the number of cards in the pack won't be 10. - db $01, $05, $03, $01 ; COLOSSEUM >> 4 - db $01, $05, $03, $01 ; EVOLUTION >> 4 - db $00, $06, $03, $01 ; MYSTERY >> 4 - db $00, $06, $03, $01 ; LABORATORY >> 4 - -; For the energy or energy generation function, there are three options: -; - Ponter to a function that generates energies (some generate one, some generate a full pack) -; - A single energy of a specific type -; - $0000 if no card in the pack is an energy - -PackColosseumNeutral:: ; 1e4e4 (7:64e4) - db COLOSSEUM >> 4 ; booster pack set - dw GenerateEndingEnergy ; energy or energy generation function - -; Card Type Chances - db $14 ; Grass Type Chance - db $14 ; Fire Type Chance - db $14 ; Water Type Chance - db $14 ; Lightning Type Chance - db $14 ; Fighting Type Chance - db $14 ; Psychic Type Chance - db $14 ; Colorless Type Chance - db $14 ; Trainer Card Chance - db $00 ; Energy Card Chance - -PackColosseumGrass:: ; 1e4f0 (7:64f0) - db COLOSSEUM >> 4 ; booster pack set - dw GRASS_ENERGY ; energy or energy generation function - -; Card Type Chances - db $30 ; Grass Type Chance - db $10 ; Fire Type Chance - db $10 ; Water Type Chance - db $10 ; Lightning Type Chance - db $10 ; Fighting Type Chance - db $10 ; Psychic Type Chance - db $10 ; Colorless Type Chance - db $10 ; Trainer Card Chance - db $00 ; Energy Card Chance - -PackColosseumFire:: ; 1e4fc (7:64fc) - db COLOSSEUM >> 4 ; booster pack set - dw FIRE_ENERGY ; energy or energy generation function - -; Card Type Chances - db $10 ; Grass Type Chance - db $30 ; Fire Type Chance - db $10 ; Water Type Chance - db $10 ; Lightning Type Chance - db $10 ; Fighting Type Chance - db $10 ; Psychic Type Chance - db $10 ; Colorless Type Chance - db $10 ; Trainer Card Chance - db $00 ; Energy Card Chance - -PackColosseumWater:: ; 1e508 (7:6508) - db COLOSSEUM >> 4 ; booster pack set - dw WATER_ENERGY ; energy or energy generation function - -; Card Type Chances - db $10 ; Grass Type Chance - db $10 ; Fire Type Chance - db $30 ; Water Type Chance - db $10 ; Lightning Type Chance - db $10 ; Fighting Type Chance - db $10 ; Psychic Type Chance - db $10 ; Colorless Type Chance - db $10 ; Trainer Card Chance - db $00 ; Energy Card Chance - -PackColosseumLightning:: ; 1e514 (7:6514) - db COLOSSEUM >> 4 ; booster pack set - dw LIGHTNING_ENERGY ; energy or energy generation function - -; Card Type Chances - db $10 ; Grass Type Chance - db $10 ; Fire Type Chance - db $10 ; Water Type Chance - db $30 ; Lightning Type Chance - db $10 ; Fighting Type Chance - db $10 ; Psychic Type Chance - db $10 ; Colorless Type Chance - db $10 ; Trainer Card Chance - db $00 ; Energy Card Chance - -PackColosseumFighting:: ; 1e520 (7:6520) - db COLOSSEUM >> 4 ; booster pack set - dw FIGHTING_ENERGY ; energy or energy generation function - -; Card Type Chances - db $10 ; Grass Type Chance - db $10 ; Fire Type Chance - db $10 ; Water Type Chance - db $10 ; Lightning Type Chance - db $30 ; Fighting Type Chance - db $10 ; Psychic Type Chance - db $10 ; Colorless Type Chance - db $10 ; Trainer Card Chance - db $00 ; Energy Card Chance - -PackColosseumTrainer:: ; 1e52c (7:652c) - db COLOSSEUM >> 4 ; booster pack set - dw GenerateEndingEnergy ; energy or energy generation function - -; Card Type Chances - db $10 ; Grass Type Chance - db $10 ; Fire Type Chance - db $10 ; Water Type Chance - db $10 ; Lightning Type Chance - db $10 ; Fighting Type Chance - db $10 ; Psychic Type Chance - db $10 ; Colorless Type Chance - db $30 ; Trainer Card Chance - db $00 ; Energy Card Chance - -PackEvolutionNeutral:: ; 1e538 (7:6538) - db EVOLUTION >> 4 ; booster pack set - dw GenerateEndingEnergy ; energy or energy generation function - -; Card Type Chances - db $14 ; Grass Type Chance - db $14 ; Fire Type Chance - db $14 ; Water Type Chance - db $14 ; Lightning Type Chance - db $14 ; Fighting Type Chance - db $14 ; Psychic Type Chance - db $14 ; Colorless Type Chance - db $14 ; Trainer Card Chance - db $00 ; Energy Card Chance - -PackEvolutionGrass:: ; 1e544 (7:6544) - db EVOLUTION >> 4 ; booster pack set - dw GRASS_ENERGY ; energy or energy generation function - -; Card Type Chances - db $30 ; Grass Type Chance - db $10 ; Fire Type Chance - db $10 ; Water Type Chance - db $10 ; Lightning Type Chance - db $10 ; Fighting Type Chance - db $10 ; Psychic Type Chance - db $10 ; Colorless Type Chance - db $10 ; Trainer Card Chance - db $00 ; Energy Card Chance - -PackEvolutionNeutralFireEnergy:: ; 1e550 (7:6550) - db EVOLUTION >> 4 ; booster pack set - dw FIRE_ENERGY ; energy or energy generation function - -; Card Type Chances - db $14 ; Grass Type Chance - db $14 ; Fire Type Chance - db $14 ; Water Type Chance - db $14 ; Lightning Type Chance - db $14 ; Fighting Type Chance - db $14 ; Psychic Type Chance - db $14 ; Colorless Type Chance - db $14 ; Trainer Card Chance - db $00 ; Energy Card Chance - -PackEvolutionWater:: ; 1e55c (7:655c) - db EVOLUTION >> 4 ; booster pack set - dw WATER_ENERGY ; energy or energy generation function - -; Card Type Chances - db $10 ; Grass Type Chance - db $10 ; Fire Type Chance - db $30 ; Water Type Chance - db $10 ; Lightning Type Chance - db $10 ; Fighting Type Chance - db $10 ; Psychic Type Chance - db $10 ; Colorless Type Chance - db $10 ; Trainer Card Chance - db $00 ; Energy Card Chance - -PackEvolutionFighting:: ; 1e568 (7:6568) - db EVOLUTION >> 4 ; booster pack set - dw FIGHTING_ENERGY ; energy or energy generation function - -; Card Type Chances - db $10 ; Grass Type Chance - db $10 ; Fire Type Chance - db $10 ; Water Type Chance - db $10 ; Lightning Type Chance - db $30 ; Fighting Type Chance - db $10 ; Psychic Type Chance - db $10 ; Colorless Type Chance - db $10 ; Trainer Card Chance - db $00 ; Energy Card Chance - -PackEvolutionPsychic:: ; 1e574 (7:6574) - db EVOLUTION >> 4 ; booster pack set - dw PSYCHIC_ENERGY ; energy or energy generation function - -; Card Type Chances - db $10 ; Grass Type Chance - db $10 ; Fire Type Chance - db $10 ; Water Type Chance - db $10 ; Lightning Type Chance - db $10 ; Fighting Type Chance - db $30 ; Psychic Type Chance - db $10 ; Colorless Type Chance - db $10 ; Trainer Card Chance - db $00 ; Energy Card Chance - -PackEvolutionTrainer:: ; 1e580 (7:6580) - db EVOLUTION >> 4 ; booster pack set - dw GenerateEndingEnergy ; energy or energy generation function - -; Card Type Chances - db $10 ; Grass Type Chance - db $10 ; Fire Type Chance - db $10 ; Water Type Chance - db $10 ; Lightning Type Chance - db $10 ; Fighting Type Chance - db $10 ; Psychic Type Chance - db $10 ; Colorless Type Chance - db $30 ; Trainer Card Chance - db $00 ; Energy Card Chance - -PackMysteryNeutral:: ; 1e58c (7:658c) - db MYSTERY >> 4 ; booster pack set - dw $0000 ; energy or energy generation function - -; Card Type Chances - db $11 ; Grass Type Chance - db $11 ; Fire Type Chance - db $11 ; Water Type Chance - db $11 ; Lightning Type Chance - db $11 ; Fighting Type Chance - db $11 ; Psychic Type Chance - db $11 ; Colorless Type Chance - db $11 ; Trainer Card Chance - db $11 ; Energy Card Chance - -PackMysteryGrassColorless:: ; 1e598 (7:6598) - db MYSTERY >> 4 ; booster pack set - dw $0000 ; energy or energy generation function - -; Card Type Chances - db $30 ; Grass Type Chance - db $0C ; Fire Type Chance - db $0C ; Water Type Chance - db $0C ; Lightning Type Chance - db $0C ; Fighting Type Chance - db $0C ; Psychic Type Chance - db $16 ; Colorless Type Chance - db $0C ; Trainer Card Chance - db $0C ; Energy Card Chance - -PackMysteryWaterColorless:: ; 1e5a4 (7:65a4) - db MYSTERY >> 4 ; booster pack set - dw $0000 ; energy or energy generation function - -; Card Type Chances - db $0C ; Grass Type Chance - db $0C ; Fire Type Chance - db $30 ; Water Type Chance - db $0C ; Lightning Type Chance - db $0C ; Fighting Type Chance - db $0C ; Psychic Type Chance - db $16 ; Colorless Type Chance - db $0C ; Trainer Card Chance - db $0C ; Energy Card Chance - -PackMysteryLightningColorless:: ; 1e5b0 (7:65b0) - db MYSTERY >> 4 ; booster pack set - dw $0000 ; energy or energy generation function - -; Card Type Chances - db $0C ; Grass Type Chance - db $0C ; Fire Type Chance - db $0C ; Water Type Chance - db $30 ; Lightning Type Chance - db $0C ; Fighting Type Chance - db $0C ; Psychic Type Chance - db $16 ; Colorless Type Chance - db $0C ; Trainer Card Chance - db $0C ; Energy Card Chance - -PackMysteryFightingColorless:: ; 1e5bc (7:65bc) - db MYSTERY >> 4 ; booster pack set - dw $0000 ; energy or energy generation function - -; Card Type Chances - db $0C ; Grass Type Chance - db $0C ; Fire Type Chance - db $0C ; Water Type Chance - db $0C ; Lightning Type Chance - db $30 ; Fighting Type Chance - db $0C ; Psychic Type Chance - db $16 ; Colorless Type Chance - db $0C ; Trainer Card Chance - db $0C ; Energy Card Chance - -PackMysteryTrainerColorless:: ; 1e5c8 (7:65c8) - db MYSTERY >> 4 ; booster pack set - dw $0000 ; energy or energy generation function - -; Card Type Chances - db $0C ; Grass Type Chance - db $0C ; Fire Type Chance - db $0C ; Water Type Chance - db $0C ; Lightning Type Chance - db $0C ; Fighting Type Chance - db $0C ; Psychic Type Chance - db $16 ; Colorless Type Chance - db $30 ; Trainer Card Chance - db $0C ; Energy Card Chance - -PackLaboratoryMostlyNeutral:: ; 1e5d4 (7:65d4) - db LABORATORY >> 4 ; booster pack set - dw $0000 ; energy or energy generation function - -; Card Type Chances - db $14 ; Grass Type Chance - db $14 ; Fire Type Chance - db $14 ; Water Type Chance - db $14 ; Lightning Type Chance - db $10 ; Fighting Type Chance - db $14 ; Psychic Type Chance - db $14 ; Colorless Type Chance - db $18 ; Trainer Card Chance - db $00 ; Energy Card Chance - -PackLaboratoryGrass:: ; 1e5e0 (7:65e0) - db LABORATORY >> 4 ; booster pack set - dw $0000 ; energy or energy generation function - -; Card Type Chances - db $30 ; Grass Type Chance - db $10 ; Fire Type Chance - db $10 ; Water Type Chance - db $10 ; Lightning Type Chance - db $10 ; Fighting Type Chance - db $10 ; Psychic Type Chance - db $10 ; Colorless Type Chance - db $10 ; Trainer Card Chance - db $00 ; Energy Card Chance - -PackLaboratoryWater:: ; 1e5ec (7:65ec) - db LABORATORY >> 4 ; booster pack set - dw $0000 ; energy or energy generation function - -; Card Type Chances - db $10 ; Grass Type Chance - db $10 ; Fire Type Chance - db $30 ; Water Type Chance - db $10 ; Lightning Type Chance - db $10 ; Fighting Type Chance - db $10 ; Psychic Type Chance - db $10 ; Colorless Type Chance - db $10 ; Trainer Card Chance - db $00 ; Energy Card Chance - -PackLaboratoryPsychic:: ; 1e5f8 (7:65f8) - db LABORATORY >> 4 ; booster pack set - dw $0000 ; energy or energy generation function - -; Card Type Chances - db $10 ; Grass Type Chance - db $10 ; Fire Type Chance - db $10 ; Water Type Chance - db $10 ; Lightning Type Chance - db $10 ; Fighting Type Chance - db $30 ; Psychic Type Chance - db $10 ; Colorless Type Chance - db $10 ; Trainer Card Chance - db $00 ; Energy Card Chance - -PackLaboratoryTrainer:: ; 1e604 (7:6604) - db LABORATORY >> 4 ; booster pack set - dw $0000 ; energy or energy generation function - -; Card Type Chances - db $10 ; Grass Type Chance - db $10 ; Fire Type Chance - db $10 ; Water Type Chance - db $10 ; Lightning Type Chance - db $10 ; Fighting Type Chance - db $10 ; Psychic Type Chance - db $10 ; Colorless Type Chance - db $30 ; Trainer Card Chance - db $00 ; Energy Card Chance - -PackEnergyLightningFire:: ; 1e610 (7:6610) - db COLOSSEUM >> 4 ; booster pack set - dw GenerateEnergyBoosterLightningFire ; energy or energy generation function - -; Card Type Chances - db $00 ; Grass Type Chance - db $00 ; Fire Type Chance - db $00 ; Water Type Chance - db $00 ; Lightning Type Chance - db $00 ; Fighting Type Chance - db $00 ; Psychic Type Chance - db $00 ; Colorless Type Chance - db $00 ; Trainer Card Chance - db $00 ; Energy Card Chance - -PackEnergyWaterFighting:: ; 1e61c (7:661c) - db COLOSSEUM >> 4 ; booster pack set - dw GenerateEnergyBoosterWaterFighting ; energy or energy generation function - -; Card Type Chances - db $00 ; Grass Type Chance - db $00 ; Fire Type Chance - db $00 ; Water Type Chance - db $00 ; Lightning Type Chance - db $00 ; Fighting Type Chance - db $00 ; Psychic Type Chance - db $00 ; Colorless Type Chance - db $00 ; Trainer Card Chance - db $00 ; Energy Card Chance - -PackEnergyGrassPsychic:: ; 1e628 (7:6628) - db COLOSSEUM >> 4 ; booster pack set - dw GenerateEnergyBoosterGrassPsychic ; energy or energy generation function - -; Card Type Chances - db $00 ; Grass Type Chance - db $00 ; Fire Type Chance - db $00 ; Water Type Chance - db $00 ; Lightning Type Chance - db $00 ; Fighting Type Chance - db $00 ; Psychic Type Chance - db $00 ; Colorless Type Chance - db $00 ; Trainer Card Chance - db $00 ; Energy Card Chance - -PackRandomEnergies:: ; 1e634 (7:6634) - db COLOSSEUM >> 4 ; booster pack set - dw GenerateRandomEnergyBooster ; energy or energy generation function - -; Card Type Chances - db $00 ; Grass Type Chance - db $00 ; Fire Type Chance - db $00 ; Water Type Chance - db $00 ; Lightning Type Chance - db $00 ; Fighting Type Chance - db $00 ; Psychic Type Chance - db $00 ; Colorless Type Chance - db $00 ; Trainer Card Chance - db $00 ; Energy Card Chance - - INCROM $1e640, $20000 -- cgit v1.2.3 From 1e2c95d35bb4c6fc66182e873caf415862c7da08 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Thu, 8 Feb 2018 13:16:13 +0100 Subject: Misc formatting and labeling --- src/engine/bank1.asm | 52 ++++++++++----------- src/engine/home.asm | 130 +++++++++++++++++++++++++++------------------------ 2 files changed, 96 insertions(+), 86 deletions(-) (limited to 'src/engine') diff --git a/src/engine/bank1.asm b/src/engine/bank1.asm index b1a879d..7a3f72a 100755 --- a/src/engine/bank1.asm +++ b/src/engine/bank1.asm @@ -16,20 +16,21 @@ Func_4000: ; 4000 (1:4000) farcall Func_1a6cc ldh a, [hButtonsHeld] cp A_BUTTON | B_BUTTON - jr z, .asm_4035 + jr z, .ask_erase_backup_ram farcall Func_126d1 jr Func_4000 -.asm_4035 +.ask_erase_backup_ram call Func_405a call Func_04a2 text_hl ResetBackUpRamText call Func_2af0 - jr c, .asm_404d + jr c, .reset_game +; erase sram call EnableExtRAM xor a ld [$a000], a call DisableExtRAM -.asm_404d +.reset_game jp Reset Func_4050: ; 4050 (1:4050) @@ -333,16 +334,16 @@ Func_42ac: ld [wCurrentDuelMenuItem], a jr nc, Func_42ac ldh a, [hCurrentMenuItem] - ld hl, BattleMenuFunctionTable + ld hl, DuelMenuFunctionTable jp JumpToFunctionInTable -BattleMenuFunctionTable: ; 42f1 (1:42f1) - dw OpenHandMenu - dw OpenBattleAttackMenu - dw OpenBattleCheckMenu - dw OpenPokemonPowerMenu - dw PlayerRetreat - dw PlayerEndTurn +DuelMenuFunctionTable: ; 42f1 (1:42f1) + dw DuelMenu_Hand + dw DuelMenu_Attack + dw DuelMenu_Check + dw DuelMenu_PkmnPower + dw DuelMenu_Retreat + dw DuelMenu_Done INCROM $42fd, $430b @@ -384,13 +385,13 @@ Func_4342: ; 4342 (1:4342) INCROM $4345, $438e -OpenPokemonPowerMenu: ; 438e (1:438e) +DuelMenu_PkmnPower: ; 438e (1:438e) call $6431 jp c, Func_426d call Func_1730 jp Func_426d -PlayerEndTurn: ; 439a (1:439a) +DuelMenu_Done: ; 439a (1:439a) ld a, $08 call $51e7 jp c, Func_4268 @@ -399,7 +400,7 @@ PlayerEndTurn: ; 439a (1:439a) call $717a ret -PlayerRetreat: ; 43ab (1:43ab) +DuelMenu_Retreat: ; 43ab (1:43ab) ld a, DUELVARS_ARENA_CARD_STATUS call GetTurnDuelistVariable and a,PASSIVE_STATUS_MASK @@ -457,7 +458,7 @@ Func_441f: ; 441f (1:441f) call DrawWideTextBox_WaitForInput jp PrintDuelMenu -OpenHandMenu: ; 4425 (1:4425) +DuelMenu_Hand: ; 4425 (1:4425) ld a, DUELVARS_NUMBER_OF_CARDS_IN_HAND call GetTurnDuelistVariable or a @@ -523,14 +524,14 @@ PlayerUseEnergyCard: ; 4477 (1:4477) INCROM $44db, $4585 -OpenBattleCheckMenu: ; 4585 (1:4585) +DuelMenu_Check: ; 4585 (1:4585) call Func_3b31 call Func_3096 jp Func_426d INCROM $458e, $46fc -OpenBattleAttackMenu: ; 46fc (1:46fc) +DuelMenu_Attack: ; 46fc (1:46fc) call HandleCantAttackSubstatus jr c, .alertCantAttackAndCancelMenu call CheckIfActiveCardParalyzedOrAsleep @@ -660,14 +661,13 @@ Func_478b: ; 478b (1:478b) ret AttackMenuCursorData: - db $01 - db $0d - db $02 - db $02 - db $0f - db $00 - db $00 - db $00 + db 1, 13 ; x, y + db 2 ; y displacement between items + db 2 ; number of items + db $0f ; cursor tile number + db $00 ; tile behind cursor + db $00 ; ??? + db $00 ; ??? Func_47ec: ; $47ec (1:47ec) ld a, [wcc04] diff --git a/src/engine/home.asm b/src/engine/home.asm index b1fa021..60f1739 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -231,7 +231,7 @@ EnableLCD: ; 0277 (0:0277) or rLCDC_ENABLE_MASK ; ld [wLCDC], a ; ld [rLCDC], a ; turn LCD on - ld a, $c0 + ld a, %11000000 ld [wFlushPaletteFlags], a ret @@ -246,7 +246,7 @@ DisableLCD: ; 028a (0:028a) ld [rIE], a ; disable vblank interrupt .asm_298 ld a, [rLY] ; - cp $91 ; + cp LY_VBLANK ; jr nz, .asm_298 ; wait for vblank ld a, [rLCDC] ; and $7f ; @@ -350,7 +350,7 @@ SetupLCD: ; 030b (0:030b) ld [wLCDC], a ld a, $1 ld [MBC3LatchClock], a - ld a, $a + ld a, SRAM_ENABLE ld [MBC3SRamEnable], a NopF: ; 0348 (0:0348) ret @@ -377,7 +377,7 @@ DetectConsole: ; 0349 (0:0349) ; initialize the palettes (both monochrome and color) SetupPalettes: ; 036a (0:036a) ld hl, wBGP - ld a, $e4 + ld a, %11100100 ld [rBGP], a ld [hli], a ld [rOBP0], a @@ -460,23 +460,23 @@ FillTileMap: ; 03c0 (0:03c0) ; zero work RAM, stack area & high RAM ($C000-$DFFF, $FF80-$FFEF) ZeroRAM: ; 03ec (0:03ec) - ld hl, wTempCardCollection - ld bc, $2000 -.asm_3f2 + ld hl, $c000 + ld bc, $e000 - $c000 +.zero_wram_loop xor a ld [hli], a dec bc ld a, c or b - jr nz, .asm_3f2 - ld c, $80 - ld b, $70 + jr nz, .zero_wram_loop + ld c, LOW($ff80) + ld b, $fff0 - $ff80 xor a -.asm_3fe +.zero_hram_loop ld [$ff00+c], a inc c dec b - jr nz, .asm_3fe + jr nz, .zero_hram_loop ret Func_0404: ; 0404 (0:0404) @@ -627,7 +627,7 @@ SGB_ATTR_BLK_04bf: ; 04bf (0:04bf) sgb ATTR_BLK, 1 ; sgb_command, length db $01,$03,$00,$00,$00,$13,$11,$00,$00,$00,$00,$00,$00,$00,$00 -; returns vBGMapTiles + 32 * c + b in de. +; returns vBGMapTiles + BG_MAP_WIDTH * c + b in de. ; used to map coordinates at bc to a BGMap0 address. BCCoordToBGMap0Address: ; 04cf (0:04cf) ld l, c @@ -638,7 +638,7 @@ BCCoordToBGMap0Address: ; 04cf (0:04cf) add hl, hl add hl, hl ld c, b - ld b, $98 + ld b, HIGH(vBGMapTiles) add hl, bc ld e, l ld d, h @@ -1203,7 +1203,7 @@ BankswitchRAM: ; 07a9 (0:07a9) push af ldh [hBankRAM], a ld [MBC3SRamBank], a - ld a, $a + ld a, SRAM_ENABLE ld [MBC3SRamEnable], a pop af ret @@ -1211,7 +1211,7 @@ BankswitchRAM: ; 07a9 (0:07a9) ; enable external RAM EnableExtRAM: ; 07b6 (0:07b6) push af - ld a, $a + ld a, SRAM_ENABLE ld [MBC3SRamEnable], a pop af ret @@ -1219,7 +1219,7 @@ EnableExtRAM: ; 07b6 (0:07b6) ; disable external RAM DisableExtRAM: ; 07be (0:07be) push af - xor a + xor a ; SRAM_DISABLE ld [MBC3SRamEnable], a pop af ret @@ -1832,7 +1832,7 @@ Func_0bcb: ; 0bcb (0:0bcb) jr nz, .wait_vbalnk ld a, $43 ld [rLCDC], a - ld a, $e4 + ld a, %11100100 ld [rBGP], a ld de, vTiles1 ld bc, vBGMapTiles - vTiles1 @@ -2796,7 +2796,7 @@ _GetCardInDeckPosition: ; 1362 (0:1362) ld a, [hl] pop de ret - + ; load data of card in position a to wLoadedCard1 LoadDeckCardToBuffer1: ; 1376 (0:1376) push hl @@ -2813,7 +2813,7 @@ LoadDeckCardToBuffer1: ; 1376 (0:1376) pop de pop hl ret - + ; load data of card in position a to wLoadedCard2 LoadDeckCardToBuffer2: ; 138c (0:138c) push hl @@ -3312,25 +3312,25 @@ CheckSelfConfusionDamage: ; 18d7 (0:18d7) ; 0x18f9 INCROM $18f9, $1944 - -; this loads HP and Stage (1 byte each) of card with id at $ff9f into wLoadedMoveEffectCommands -Func_1944: ; 1944 (0:1944) - ld a, [$ff9f] - call LoadDeckCardToBuffer1 - ld hl, wLoadedCard1HP - ld de, wLoadedMoveEffectCommands - ld a, [hli] - ld [de], a - inc de - ld a, [hl] - ld [de], a - ret -; 0x1955 - -Func_1955: ; 1955 (0:1955) - push af - ld a, $7a - ld [wLoadedMoveAnimation], a + +; this loads HP and Stage (1 byte each) of card with id at $ff9f into wLoadedMoveEffectCommands +Func_1944: ; 1944 (0:1944) + ld a, [$ff9f] + call LoadDeckCardToBuffer1 + ld hl, wLoadedCard1HP + ld de, wLoadedMoveEffectCommands + ld a, [hli] + ld [de], a + inc de + ld a, [hl] + ld [de], a + ret +; 0x1955 + +Func_1955: ; 1955 (0:1955) + push af + ld a, $7a + ld [wLoadedMoveAnimation], a pop af ; this function appears to apply several damage modifiers Func_195c: ; 195c (0:195c) @@ -3902,7 +3902,7 @@ SafeCopyDataDEtoHL: ; 1dca (0:1dca) .lcd_on jp HblankCopyDataDEtoHL -; returns vBGMapTiles + 32 * e + d in hl. +; returns vBGMapTiles + BG_MAP_WIDTH * e + d in hl. ; used to map coordinates at de to a BGMap0 address. DECoordToBGMap0Address: ; 1ddb (0:1ddb) ld l, e @@ -3916,7 +3916,7 @@ DECoordToBGMap0Address: ; 1ddb (0:1ddb) add d ld l, a ld a, h - adc $98 + adc HIGH(vBGMapTiles) ld h, a ret @@ -4047,29 +4047,29 @@ DrawRegularTextBoxDMG: ; 1e88 (0:1e88) call DECoordToBGMap0Address ; top line (border) of the text box ld a, $1c - ld de, $1819 + lb de, $18, $19 call CopyLine ContinueDrawingTextBoxDMGorSGB dec c dec c .draw_text_box_body_loop ld a, $0 - ld de, $1e1f + lb de, $1e, $1f call CopyLine dec c jr nz, .draw_text_box_body_loop ; bottom line (border) of the text box ld a, $1d - ld de, $1a1b + lb de, $1a, $1b ; fallthrough -; copies b bytes of data to sp+$1c and to hl, and returns hl += SCREEN_WIDTH +; copies b bytes of data to sp+$1c and to hl, and returns hl += BG_MAP_WIDTH ; d = value of byte 0 ; e = value of byte b ; a = value of bytes [1, b-1] -; b is supposed to be SCREEN_WIDTH or smaller, else the stack would get corrupted +; b is supposed to be BG_MAP_WIDTH or smaller, else the stack would get corrupted CopyLine: ; 1ea5 (0:1ea5) - add sp, -$20 + add sp, -BG_MAP_WIDTH push hl push bc ld hl, sp+$4 @@ -4093,24 +4093,24 @@ CopyLine: ; 1ea5 (0:1ea5) call SafeCopyDataDEtoHL pop bc pop de - ; advance pointer SCREEN_WIDTH positions and restore stack pointer - ld hl, $0020 + ; advance pointer BG_MAP_WIDTH positions and restore stack pointer + ld hl, BG_MAP_WIDTH add hl, de - add sp, $20 + add sp, BG_MAP_WIDTH ret DrawRegularTextBoxCGB: call DECoordToBGMap0Address ; top line (border) of the text box ld a, $1c - ld de, $1819 + lb de, $18, $19 call CopyCurrentLineTilesAndAttrCGB ContinueDrawingTextBoxCGB dec c dec c .draw_text_box_body_loop ld a, $0 - ld de, $1e1f + lb de, $1e, $1f push hl call CopyLine pop hl @@ -4125,7 +4125,7 @@ ContinueDrawingTextBoxCGB jr nz, .draw_text_box_body_loop ; bottom line (border) of the text box ld a, $1d - ld de, $1a1b + lb de, $1a, $1b call CopyCurrentLineTilesAndAttrCGB ret @@ -4972,12 +4972,12 @@ InitializeCursorParameters: ; 2636 (0:2636) ldh [hCurrentMenuItem], a ld de, wCursorXPosition ld b, $8 -.asm_2640 +.loop ld a, [hli] ld [de], a inc de dec b - jr nz, .asm_2640 + jr nz, .loop xor a ld [wCursorBlinkCounter], a ret @@ -5199,8 +5199,8 @@ Func_29f5: ; 29f5 (0:29f5) ret ; 0x29fa -Func_29fa: ; 29fa (0:29fa) - ld bc, $0f00 +Func_29fa: ; 29fa (0:29fa) + ld bc, $0f00 call Func_2a1a Func_2a00: ; 2a00 (0:2a00) call DoFrame @@ -5294,7 +5294,12 @@ DrawNarrowTextBox_WaitForInput: ; 2a7c (0:2a7c) ret NarrowTextBoxPromptCursorData: ; 2a96 (0:2a96) - db $a, $11, $1, $1, $2f, $1d, $0, $0 + db 10, 17 ; x, y + db 1 ; y displacement between items + db 1 ; number of items + db $2f ; cursor tile number + db $1d ; tile behind cursor + db $0, $0 ; ???, ??? ; draws a 20x6 text box aligned to the bottom of the screen DrawWideTextBox: ; 2a9e (0:2a9e) @@ -5322,12 +5327,17 @@ WaitForWideTextBoxInput: ; 2aae (0:2aae) ret WideTextBoxPromptCursorData: ; 2ac8 (0:2ac8) - db $12, $11, $1, $1, $2f, $1d, $0, $0 + db 18, 17 ; x, y + db 1 ; y displacement between items + db 1 ; number of items + db $2f ; cursor tile number + db $1d ; tile behind cursor + db $0, $0 ; ???, ??? INCROM $2ad0, $2af0 Func_2af0: ; 2af0 (0:2af0) - call DrawWideTextBox_PrintText + call DrawWideTextBox_PrintText Func_2af3: ; 2af3 (0:2af3) ld de, $0710 call Func_2b66 -- cgit v1.2.3 From 64a724dce584670ea25f63e3307c81031d9e4adb Mon Sep 17 00:00:00 2001 From: xCrystal Date: Thu, 8 Feb 2018 14:35:39 +0100 Subject: More formatting and labeling related to menu handling --- src/engine/bank1.asm | 2 +- src/engine/bank2.asm | 2 +- src/engine/bank3.asm | 4 +- src/engine/bank4.asm | 8 ++-- src/engine/home.asm | 102 +++++++++++++++++++++++++++------------------------ 5 files changed, 63 insertions(+), 55 deletions(-) (limited to 'src/engine') diff --git a/src/engine/bank1.asm b/src/engine/bank1.asm index 7a3f72a..35ad954 100755 --- a/src/engine/bank1.asm +++ b/src/engine/bank1.asm @@ -23,7 +23,7 @@ Func_4000: ; 4000 (1:4000) call Func_405a call Func_04a2 text_hl ResetBackUpRamText - call Func_2af0 + call YesOrNoMenuWithText jr c, .reset_game ; erase sram call EnableExtRAM diff --git a/src/engine/bank2.asm b/src/engine/bank2.asm index a62d1ce..c42f2a5 100755 --- a/src/engine/bank2.asm +++ b/src/engine/bank2.asm @@ -842,7 +842,7 @@ Func_b19d: ; b19d (2:719d) .asm_b216 ld hl, $0272 - call Func_2af0 + call YesOrNoMenuWithText ld a, [$d086] jr c, .asm_b1b3 call $7592 diff --git a/src/engine/bank3.asm b/src/engine/bank3.asm index 5fcf216..4c3feab 100755 --- a/src/engine/bank3.asm +++ b/src/engine/bank3.asm @@ -1177,11 +1177,11 @@ Func_c8ed: ; c8ed (3:c8ed) ld [hli], a ld [hl], a pop hl - call Func_2af0 + call YesOrNoMenuWithText jr .asm_c911 .asm_c90e - call Func_2af3 + call YesOrNoMenu .asm_c911 pop de diff --git a/src/engine/bank4.asm b/src/engine/bank4.asm index 29fd949..c4c8962 100755 --- a/src/engine/bank4.asm +++ b/src/engine/bank4.asm @@ -220,10 +220,10 @@ Duel_Init: ; 103d3 (4:43d3) call PlaySong call $4031 call DoFrameIfLCDEnabled - ld bc, $2f1d - ld de, $1211 - call Func_2a1a - call Func_2a00 ; wait for the user to press a or b + lb bc, $2f, $1d ; cursor tile, tile behind cursor + lb de, 18, 17 ; x, y + call SetCursorParametersForTextBox + call WaitForButtonAorB ; wait for the user to press a or b call Func_3c96 call Func_10ab4 ; fade out pop af diff --git a/src/engine/home.asm b/src/engine/home.asm index 60f1739..fad3156 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -4746,7 +4746,7 @@ Func_23d3: ; 23d3 (0:23d3) Func_245d: ; 245d (0:245d) push de push bc - ld de, $caa0 + ld de, wcaa0 push de ld bc, $d8f0 call Func_2499 @@ -5200,25 +5200,25 @@ Func_29f5: ; 29f5 (0:29f5) ; 0x29fa Func_29fa: ; 29fa (0:29fa) - ld bc, $0f00 - call Func_2a1a -Func_2a00: ; 2a00 (0:2a00) + lb bc, $0f, $00 ; cursor tile, tile behind cursor + call SetCursorParametersForTextBox +WaitForButtonAorB: ; 2a00 (0:2a00) call DoFrame call HandleTextBoxInput ldh a, [hButtonsPressed] bit A_BUTTON_F, a - jr nz, .asm_2a15 + jr nz, .a_pressed bit B_BUTTON_F, a - jr z, Func_2a00 + jr z, WaitForButtonAorB call EraseCursor scf ret -.asm_2a15 +.a_pressed call EraseCursor or a ret -Func_2a1a: ; 2a1a (0:2a1a) +SetCursorParametersForTextBox: ; 2a1a (0:2a1a) xor a ld hl, wCurMenuItem ld [hli], a @@ -5226,9 +5226,9 @@ Func_2a1a: ; 2a1a (0:2a1a) inc hl ld [hl], e ; wCursorYPosition inc hl - ld [hl], $0 ; wYDisplacementBetweenMenuItems + ld [hl], 0 ; wYDisplacementBetweenMenuItems inc hl - ld [hl], $1 ; wNumMenuItems + ld [hl], 1 ; wNumMenuItems inc hl ld [hl], b ; wCursorTileNumber inc hl @@ -5250,7 +5250,7 @@ DrawNarrowTextBox_PrintText: ; 2a3e (0:2a3e) call DrawNarrowTextBox ld a, $b Func_2a44: ; 2a44 (0:2a44) - ld de, $010e + lb de, 1, 14 call AdjustCoordinatesForWindow call Func_22a6 pop hl @@ -5264,7 +5264,7 @@ DrawWideTextBox_PrintText: ; 2a59 (0:2a59) push hl call DrawWideTextBox ld a, $13 - ld de, $010e + lb de, 1, 14 call AdjustCoordinatesForWindow call Func_22a6 call EnableLCD @@ -5273,8 +5273,8 @@ DrawWideTextBox_PrintText: ; 2a59 (0:2a59) ; draws a 12x6 text box aligned to the bottom left of the screen DrawNarrowTextBox: ; 2a6f (0:2a6f) - ld de, $000c - ld bc, $0c06 + lb de, 0, 12 + lb bc, 12, 6 call AdjustCoordinatesForWindow call DrawRegularTextBox ret @@ -5303,8 +5303,8 @@ NarrowTextBoxPromptCursorData: ; 2a96 (0:2a96) ; draws a 20x6 text box aligned to the bottom of the screen DrawWideTextBox: ; 2a9e (0:2a9e) - ld de, $000c - ld bc, $1406 + lb de, 0, 12 + lb bc, 20, 6 call AdjustCoordinatesForWindow call DrawRegularTextBox ret @@ -5336,39 +5336,45 @@ WideTextBoxPromptCursorData: ; 2ac8 (0:2ac8) INCROM $2ad0, $2af0 -Func_2af0: ; 2af0 (0:2af0) +; handle a yes / no menu with custom text provided in hl +; returns carry if "no" selected +YesOrNoMenuWithText: ; 2af0 (0:2af0) call DrawWideTextBox_PrintText -Func_2af3: ; 2af3 (0:2af3) - ld de, $0710 - call Func_2b66 - ld de, $0610 - jr .asm_2b0a + +YesOrNoMenu: ; 2af3 (0:2af3) + lb de, 7, 16 ; x, y + call PrintYesOrNoItems + lb de, 6, 16 ; x, y + jr handleYesOrNoMenu + +YesOrNoMenuWithText_LeftAligned: ; 2afe (0:2afe) call DrawNarrowTextBox_PrintText - ld de, $0310 - call Func_2b66 - ld de, $0210 -.asm_2b0a + lb de, 3, 16 ; x, y + call PrintYesOrNoItems + lb de, 2, 16 ; x, y + +handleYesOrNoMenu ld a, d ld [wcd98], a - ld bc, $0f00 - call Func_2a1a + lb bc, $0f, $00 ; cursor tile, tile behind cursor + call SetCursorParametersForTextBox ld a, [wcd9a] ld [wCurMenuItem], a call EnableLCD - jr .asm_2b39 -.asm_2b1f + jr .init_menu +.wait_button_loop call DoFrame call HandleTextBoxInput ldh a, [hButtonsPressed] bit A_BUTTON_F, a - jr nz, .asm_2b50 + jr nz, .a_pressed ldh a, [hButtonsPressed2] and D_RIGHT | D_LEFT - jr z, .asm_2b1f + jr z, .wait_button_loop ld a, $1 call Func_3796 call EraseCursor -.asm_2b39 +.init_menu ld a, [wcd98] ld c, a ld hl, wCurMenuItem @@ -5381,15 +5387,16 @@ Func_2af3: ; 2af3 (0:2af3) ld [wCursorXPosition], a xor a ld [wCursorBlinkCounter], a - jr .asm_2b1f -.asm_2b50 + jr .wait_button_loop +.a_pressed ld a, [wCurMenuItem] ldh [hCurrentMenuItem], a or a - jr nz, .asm_2b5c + jr nz, .no +;.yes ld [wcd9a], a ret -.asm_2b5c +.no xor a ld [wcd9a], a ld a, $1 @@ -5397,7 +5404,8 @@ Func_2af3: ; 2af3 (0:2af3) scf ret -Func_2b66: ; 2b66 (0:2b66) +; prints YES NO at de +PrintYesOrNoItems: ; 2b66 (0:2b66) call AdjustCoordinatesForWindow text_hl YesOrNoText call Func_2c1b @@ -5556,10 +5564,10 @@ Func_2c73: ; 2c73 (0:2c73) call Func_2c84 Func_2c77: ; 2c77 (0:2c77) - ld bc, $2f1d - ld de, $1211 - call Func_2a1a - call Func_2a00 + lb bc, $2f, $1d ; cursor tile, tile behind cursor + lb de, 18, 17 ; x, y + call SetCursorParametersForTextBox + call WaitForButtonAorB ret Func_2c84: ; 2c84 (0:2c84) @@ -5657,8 +5665,8 @@ Func_2d06: ; 2d06 (0:2d06) Func_2d15: ; 2d15 (0:2d15) push hl - ld de, $000c - ld bc, $1406 + lb de, 0, 12 + lb bc, 20, 6 call AdjustCoordinatesForWindow ld a, [wce4b] or a @@ -5673,7 +5681,7 @@ Func_2d15: ; 2d15 (0:2d15) ld l, a call DrawLabeledTextBox .asm_2d36 - ld de, $010e + lb de, 1, 14 call AdjustCoordinatesForWindow ld a, $13 call Func_22a6 @@ -5810,7 +5818,7 @@ Func_2e12: ; 2e12 (0:2e12) ld a, [wcd0a] or a jp z, Func_245d - ld de, $caa0 + ld de, wcaa0 push de call Func_0663 pop hl @@ -5825,7 +5833,7 @@ Func_2e12: ; 2e12 (0:2e12) ret Func_2e2c: ; 2e2c (0:2e2c) - ld de, $caa0 + ld de, wcaa0 push de ldh a, [hWhoseTurn] cp OPPONENT_TURN -- cgit v1.2.3 From 91b7ddeb1aa01c115e5f5a6cbbea8c4b1b60612c Mon Sep 17 00:00:00 2001 From: xCrystal Date: Fri, 9 Feb 2018 14:15:31 +0100 Subject: Consistent Music/SFX label names and more Home disasm --- src/engine/bank1.asm | 2 +- src/engine/bank2.asm | 4 ++-- src/engine/bank3.asm | 4 ++-- src/engine/bank4.asm | 6 +++--- src/engine/bank7.asm | 2 +- src/engine/home.asm | 50 +++++++++++++++++++++++++++++++++----------------- 6 files changed, 42 insertions(+), 26 deletions(-) (limited to 'src/engine') diff --git a/src/engine/bank1.asm b/src/engine/bank1.asm index 35ad954..845d7c0 100755 --- a/src/engine/bank1.asm +++ b/src/engine/bank1.asm @@ -1515,7 +1515,7 @@ _TossCoin: ; 71ad (1:71ad) .asm_7292 ld a, d - call Func_3796 + call PlaySFX ld a, [wcd9c] dec a jr z, .asm_72b9 diff --git a/src/engine/bank2.asm b/src/engine/bank2.asm index c42f2a5..8752ad5 100755 --- a/src/engine/bank2.asm +++ b/src/engine/bank2.asm @@ -471,7 +471,7 @@ Func_9065: ; 9065 (2:5065) ld a, [wcfe3] or a jr z, .asm_90ca - call Func_3796 + call PlaySFX .asm_90ca ld hl, $cea3 ld a, [hl] @@ -515,7 +515,7 @@ Func_90fb: ; 90fb (2:50fb) .asm_9103 ld a, $3 .asm_9105 - call Func_3796 + call PlaySFX pop af ret diff --git a/src/engine/bank3.asm b/src/engine/bank3.asm index 4c3feab..aff3057 100755 --- a/src/engine/bank3.asm +++ b/src/engine/bank3.asm @@ -65,7 +65,7 @@ LoadMap: ; c000 (3:4000) bit 4, [hl] jr z, .asm_c0b6 ld a, $c - call Func_3796 + call PlaySFX jp .asm_c037 .asm_c0b6 farcall Func_10ab4 @@ -2769,7 +2769,7 @@ Func_d40f: ; d40f (3:540f) Func_d416: ; d416 (3:5416) ld a, c - call Func_3796 + call PlaySFX jp IncreaseOWScriptPointerBy2 Func_d41d: ; d41d (3:541d) diff --git a/src/engine/bank4.asm b/src/engine/bank4.asm index c4c8962..ea53cb4 100755 --- a/src/engine/bank4.asm +++ b/src/engine/bank4.asm @@ -373,7 +373,7 @@ Func_10e71: ; 10e71 (4:4e71) and A_BUTTON jr z, .asm_10e96 ld a, $2 - call Func_3796 + call PlaySFX call Func_11016 call Func_11024 jr .asm_10e96 @@ -399,7 +399,7 @@ Func_10e97: ; 10e97 (4:4e97) ld [wd32e], a call Func_10f2e ld a, $1 - call Func_3796 + call PlaySFX .asm_10eb9 pop bc pop hl @@ -549,7 +549,7 @@ Func_11016: ; 11016 (4:5016) Func_11024: ; 11024 (4:5024) ld a, $57 - call Func_3796 + call PlaySFX ld a, [wd336] ld [wd4cf], a ld c, $f diff --git a/src/engine/bank7.asm b/src/engine/bank7.asm index 6e91991..af60340 100755 --- a/src/engine/bank7.asm +++ b/src/engine/bank7.asm @@ -406,7 +406,7 @@ Func_1d078: ; 1d078 (7:5078) and A_BUTTON | START jr z, .asm_1d095 ld a, $2 - call Func_3796 + call PlaySFX farcall Func_10ab4 .asm_1d0c7 diff --git a/src/engine/home.asm b/src/engine/home.asm index fad3156..b649ca2 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -56,7 +56,7 @@ Start: ; 0150 (0:0150) call SetupVRAM call SetupLCD call SetupPalettes - call SetupSound_T + call SetupSound call SetupTimer call ResetSerial call CopyDMAFunction @@ -134,9 +134,9 @@ TimerHandler: ; 01e6 (0:01e6) set 1, [hl] ldh a, [hBankROM] push af - ld a, BANK(SoundTimerHandler_Ext) + ld a, BANK(SoundTimerHandler) call BankswitchHome - call SoundTimerHandler_Ext + call SoundTimerHandler pop af call BankswitchHome ; clear in-timer flag @@ -5065,7 +5065,7 @@ Func_26c0: ; 26c0 (0:26c0) .asm_26ca ld a, $3 .asm_26cc - call Func_3796 + call PlaySFX pop af ret @@ -5073,7 +5073,7 @@ HandleMenuInput: ; 26d1 (0:26d1) ld a, [wcd99] or a jr z, HandleTextBoxInput - call Func_3796 + call PlaySFX ; fallthrough HandleTextBoxInput: ; 26da (0:26da) ld hl, wCursorBlinkCounter @@ -5150,7 +5150,7 @@ Func_271a: ; 271a (0:271a) .asm_2748 push af ld a, $1 - call Func_3796 + call PlaySFX call .asm_2772 pop af ld [wCurMenuItem], a @@ -5334,26 +5334,42 @@ WideTextBoxPromptCursorData: ; 2ac8 (0:2ac8) db $1d ; tile behind cursor db $0, $0 ; ???, ??? - INCROM $2ad0, $2af0 +Func_2ad0: ; 2ad0 (0:2ad0) + call DrawWideTextBox_PrintText + lb de, 6, 16 ; x, y + ld a, d + ld [wcd98], a + lb bc, $0f, $00 ; cursor tile, tile behind cursor + call SetCursorParametersForTextBox + ld a, 1 + ld [wCurMenuItem], a + call EnableLCD + jp HandleYesOrNoMenu.init_menu +; 0x2aeb + +Func_2aeb: ; 2aeb (0:2aeb) + ld a, $01 + ld [wcd9a], a +; fallthrough ; handle a yes / no menu with custom text provided in hl ; returns carry if "no" selected YesOrNoMenuWithText: ; 2af0 (0:2af0) call DrawWideTextBox_PrintText - +; fallthrough YesOrNoMenu: ; 2af3 (0:2af3) lb de, 7, 16 ; x, y call PrintYesOrNoItems lb de, 6, 16 ; x, y - jr handleYesOrNoMenu + jr HandleYesOrNoMenu YesOrNoMenuWithText_LeftAligned: ; 2afe (0:2afe) call DrawNarrowTextBox_PrintText lb de, 3, 16 ; x, y call PrintYesOrNoItems lb de, 2, 16 ; x, y - -handleYesOrNoMenu +; fallthrough +HandleYesOrNoMenu: ld a, d ld [wcd98], a lb bc, $0f, $00 ; cursor tile, tile behind cursor @@ -5372,7 +5388,7 @@ handleYesOrNoMenu and D_RIGHT | D_LEFT jr z, .wait_button_loop ld a, $1 - call Func_3796 + call PlaySFX call EraseCursor .init_menu ld a, [wcd98] @@ -7207,14 +7223,14 @@ HandleEnergyBurn: ; 375d (0:375d) ret ; 0x377f -SetupSound_T: ; 377f (0:377f) - farcall SetupSound_Ext +SetupSound: ; 377f (0:377f) + farcall _SetupSound ret Func_3784: ; 3784 (0:3784) xor a PlaySong: ; 3785 (0:3785) - farcall Func_f4006 + farcall _PlaySong ret Func_378a: ; 378a (0:378a) @@ -7227,8 +7243,8 @@ Func_378f: ; 378f (0:378f) Func_3794: ; 3794 (0:3794) ld a, $04 -Func_3796: ; 3796 (0:3796) - farcall Func_f4009 +PlaySFX: ; 3796 (0:3796) + farcall _PlaySFX ret Func_379b: ; 379b (0:379b) -- cgit v1.2.3 From c20afa450103d40f5f4d52e4ecf763a01a16cae3 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Sat, 10 Feb 2018 00:40:27 +0100 Subject: More menu engine labeling and documenting --- src/engine/bank1.asm | 7 ++- src/engine/bank2.asm | 6 +-- src/engine/bank3.asm | 6 +-- src/engine/bank4.asm | 2 +- src/engine/bank7.asm | 2 +- src/engine/home.asm | 127 +++++++++++++++++++++++++++------------------------ 6 files changed, 78 insertions(+), 72 deletions(-) (limited to 'src/engine') diff --git a/src/engine/bank1.asm b/src/engine/bank1.asm index 845d7c0..4af5978 100755 --- a/src/engine/bank1.asm +++ b/src/engine/bank1.asm @@ -300,7 +300,7 @@ PrintDuelMenu: or a ret nz ld a, [wCurrentDuelMenuItem] - call Func_2710 + call SetMenuItem Func_42ac: call DoFrame @@ -571,7 +571,7 @@ DuelMenu_Attack: ; 46fc (1:46fc) ldh a, [hButtonsPressed] and START jr nz, .displaySelectedMoveInfo - call MenuCursorAcceptInput + call HandleMenuInput jr nc, .waitForInput cp $ff ; was B pressed? jp z, PrintDuelMenu @@ -666,8 +666,7 @@ AttackMenuCursorData: db 2 ; number of items db $0f ; cursor tile number db $00 ; tile behind cursor - db $00 ; ??? - db $00 ; ??? + dw $0000 ; unknown function pointer if non-0 Func_47ec: ; $47ec (1:47ec) ld a, [wcc04] diff --git a/src/engine/bank2.asm b/src/engine/bank2.asm index 8752ad5..d9685a1 100755 --- a/src/engine/bank2.asm +++ b/src/engine/bank2.asm @@ -88,7 +88,7 @@ Func_8dbc: ; 8dbc (2:4dbc) jr c, Func_8dbc call Func_8dea jr c, Func_8dbc - call MenuCursorAcceptInput + call HandleMenuInput jr nc, .asm_8dc8 ldh a, [hCurrentMenuItem] cp $ff @@ -923,7 +923,7 @@ Func_ba04: ; ba04 (2:7a04) ld [hl], d .asm_ba40 call DoFrame - call MenuCursorAcceptInput + call HandleMenuInput jr c, .asm_baa3 ld a, [$ff8f] and $c0 @@ -973,7 +973,7 @@ Func_ba04: ; ba04 (2:7a04) jp $7a25 .asm_baa3 - call Func_270b + call DrawCursor2 ld a, [$cea1] ld [$d087], a ld a, [wCurMenuItem] diff --git a/src/engine/bank3.asm b/src/engine/bank3.asm index aff3057..7317f32 100755 --- a/src/engine/bank3.asm +++ b/src/engine/bank3.asm @@ -986,7 +986,7 @@ MainMenu_c75a: ; c75a (3:475a) call Func_c29b .asm_c76a call DoFrameIfLCDEnabled - call MenuCursorAcceptInput + call HandleMenuInput jr nc, .asm_c76a ld a, e ld [wd0b8], a @@ -1070,7 +1070,7 @@ PC_c7ea: ; c7ea (3:47ea) call Func_c29b .asm_c806 call DoFrameIfLCDEnabled - call MenuCursorAcceptInput + call HandleMenuInput jr nc, .asm_c806 ld a, e ld [wd0b9], a @@ -2576,7 +2576,7 @@ Func_d28c: ; d28c (3:528c) .asm_d2c1 call DoFrameIfLCDEnabled - call MenuCursorAcceptInput + call HandleMenuInput jr nc, .asm_d2c1 ld a, [hCurrentMenuItem] cp e diff --git a/src/engine/bank4.asm b/src/engine/bank4.asm index ea53cb4..cdb767f 100755 --- a/src/engine/bank4.asm +++ b/src/engine/bank4.asm @@ -318,7 +318,7 @@ Func_10dba: ; 10dba (4:4dba) farcall Func_111e9 .asm_10dca call DoFrameIfLCDEnabled - call MenuCursorAcceptInput + call HandleMenuInput jr nc, .asm_10dca ld a, e ld [wd0ba], a diff --git a/src/engine/bank7.asm b/src/engine/bank7.asm index af60340..9d2d603 100755 --- a/src/engine/bank7.asm +++ b/src/engine/bank7.asm @@ -466,7 +466,7 @@ Func_1d11c: ; 1d11c (7:511c) .asm_1d15a call DoFrameIfLCDEnabled call UpdateRNGSources - call MenuCursorAcceptInput + call HandleMenuInput push af call $51e9 pop af diff --git a/src/engine/home.asm b/src/engine/home.asm index b649ca2..8248752 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -4966,7 +4966,8 @@ Func_256d: ; 256d (0:256d) ; initializes cursor parameters given the 8 bytes starting at hl, ; which represent the following: ; x position, y position, y displacement between items, number of items, -; cursor tile number, tile behind cursor, ??, ?? +; cursor tile number, tile behind cursor, ???? (unknown function pointer if non-0) +; also sets the current menu item to the one specified in register a InitializeCursorParameters: ; 2636 (0:2636) ld [wCurMenuItem], a ldh [hCurrentMenuItem], a @@ -4984,98 +4985,100 @@ InitializeCursorParameters: ; 2636 (0:2636) ; returns with the carry flag set if A or B were pressed ; returns a = 0 if A was pressed, a = -1 if B was pressed -MenuCursorAcceptInput: ; 264b (0:264b) +HandleMenuInput: ; 264b (0:264b) xor a - ld [wcd99], a + ld [wRefreshMenuCursorSFX], a ldh a, [hButtonsPressed2] or a - jr z, .asm_2685 + jr z, .up_down_done ld b, a ld a, [wNumMenuItems] ld c, a ld a, [wCurMenuItem] bit D_UP_F, b - jr z, .asm_266b + jr z, .not_up dec a bit 7, a - jr z, .asm_2674 + jr z, .handle_up_or_down ld a, [wNumMenuItems] - dec a - jr .asm_2674 -.asm_266b + dec a ; wrapping around, so load the bottommost item + jr .handle_up_or_down +.not_up bit D_DOWN_F, b - jr z, .asm_2685 + jr z, .up_down_done inc a cp c - jr c, .asm_2674 - xor a -.asm_2674 + jr c, .handle_up_or_down + xor a ; wrapping around, so load the topmost item +.handle_up_or_down push af ld a, $1 - ld [wcd99], a + ld [wRefreshMenuCursorSFX], a ; buffer sound for up/down call EraseCursor pop af ld [wCurMenuItem], a xor a ld [wCursorBlinkCounter], a -.asm_2685 +.up_down_done ld a, [wCurMenuItem] ldh [hCurrentMenuItem], a - ld hl, $cd17 + ld hl, wcd17 ld a, [hli] or [hl] - jr z, asm_26a9 + jr z, .check_A_or_B ld a, [hld] ld l, [hl] ld h, a ldh a, [hCurrentMenuItem] call CallHL - jr nc, HandleMenuInput -asm_269b: - call Func_270b - -Func_269e: ; 269e (0:269e) - call Func_26c0 + jr nc, RefreshMenuCursor_CheckPlaySFX +.A_pressed_draw_cursor + call DrawCursor2 +.A_pressed + call PlayOpenOrExitScreenSFX ld a, [wCurMenuItem] ld e, a ldh a, [hCurrentMenuItem] scf ret -asm_26a9: +.check_A_or_B ldh a, [hButtonsPressed] and A_BUTTON | B_BUTTON - jr z, HandleMenuInput + jr z, RefreshMenuCursor_CheckPlaySFX and A_BUTTON - jr nz, asm_269b + jr nz, HandleMenuInput.A_pressed_draw_cursor + ; b button pressed ld a, [wCurMenuItem] ld e, a ld a, $ff ldh [hCurrentMenuItem], a - call Func_26c0 + call PlayOpenOrExitScreenSFX scf ret -Func_26c0: ; 26c0 (0:26c0) +; plays an "open screen" sound if [hCurrentMenuItem] != 0xff +; plays a "exit screen" sound if [hCurrentMenuItem] == 0xff +PlayOpenOrExitScreenSFX: ; 26c0 (0:26c0) push af ldh a, [hCurrentMenuItem] inc a - jr z, .asm_26ca + jr z, .play_exit_sfx ld a, $2 - jr .asm_26cc -.asm_26ca + jr .play_sfx +.play_exit_sfx ld a, $3 -.asm_26cc +.play_sfx call PlaySFX pop af ret -HandleMenuInput: ; 26d1 (0:26d1) - ld a, [wcd99] +RefreshMenuCursor_CheckPlaySFX: ; 26d1 (0:26d1) + ld a, [wRefreshMenuCursorSFX] or a - jr z, HandleTextBoxInput + jr z, RefreshMenuCursor call PlaySFX ; fallthrough -HandleTextBoxInput: ; 26da (0:26da) +RefreshMenuCursor: ; 26da (0:26da) ld hl, wCursorBlinkCounter ld a, [hl] inc [hl] @@ -5108,11 +5111,12 @@ DrawCursor: or a ret -Func_270b: ; 270b (0:270b) +; unlike DrawCursor, read cursor tile from wCursorTileNumber instead of register a +DrawCursor2: ; 270b (0:270b) ld a, [wCursorTileNumber] jr DrawCursor -Func_2710: ; 2710 (0:2710) +SetMenuItem: ; 2710 (0:2710) ld [wCurMenuItem], a ldh [hCurrentMenuItem], a xor a @@ -5131,7 +5135,7 @@ Func_271a: ; 271a (0:271a) xor $1 jr .asm_2748 .asm_272c - bit 5, b + bit D_LEFT_F, b jr z, .asm_273b ld a, [hl] sub $2 @@ -5140,7 +5144,7 @@ Func_271a: ; 271a (0:271a) add $4 jr .asm_2748 .asm_273b - bit 4, b + bit D_RIGHT_F, b jr z, .asm_275d ld a, [hl] add $2 @@ -5161,7 +5165,7 @@ Func_271a: ; 271a (0:271a) .asm_275d ldh a, [hButtonsPressed2] and A_BUTTON - jp nz, Func_269e + jp nz, HandleMenuInput.A_pressed .asm_2764 ld hl, wCursorBlinkCounter ld a, [hl] @@ -5204,7 +5208,7 @@ Func_29fa: ; 29fa (0:29fa) call SetCursorParametersForTextBox WaitForButtonAorB: ; 2a00 (0:2a00) call DoFrame - call HandleTextBoxInput + call RefreshMenuCursor ldh a, [hButtonsPressed] bit A_BUTTON_F, a jr nz, .a_pressed @@ -5285,12 +5289,12 @@ DrawNarrowTextBox_WaitForInput: ; 2a7c (0:2a7c) ld hl, NarrowTextBoxPromptCursorData call InitializeCursorParameters call EnableLCD -.wait_aorBLoop +.wait_A_or_B_loop call DoFrame - call HandleTextBoxInput + call RefreshMenuCursor ldh a, [hButtonsPressed] and A_BUTTON | B_BUTTON - jr z, .wait_aorBLoop + jr z, .wait_A_or_B_loop ret NarrowTextBoxPromptCursorData: ; 2a96 (0:2a96) @@ -5299,7 +5303,7 @@ NarrowTextBoxPromptCursorData: ; 2a96 (0:2a96) db 1 ; number of items db $2f ; cursor tile number db $1d ; tile behind cursor - db $0, $0 ; ???, ??? + dw $0000 ; unknown function pointer if non-0 ; draws a 20x6 text box aligned to the bottom of the screen DrawWideTextBox: ; 2a9e (0:2a9e) @@ -5317,12 +5321,12 @@ WaitForWideTextBoxInput: ; 2aae (0:2aae) ld hl, WideTextBoxPromptCursorData call InitializeCursorParameters call EnableLCD -.wait_aorBLoop +.wait_A_or_B_loop call DoFrame - call HandleTextBoxInput + call RefreshMenuCursor ldh a, [hButtonsPressed] and A_BUTTON | B_BUTTON - jr z, .wait_aorBLoop + jr z, .wait_A_or_B_loop call EraseCursor ret @@ -5332,19 +5336,19 @@ WideTextBoxPromptCursorData: ; 2ac8 (0:2ac8) db 1 ; number of items db $2f ; cursor tile number db $1d ; tile behind cursor - db $0, $0 ; ???, ??? + dw $0000 ; unknown function pointer if non-0 -Func_2ad0: ; 2ad0 (0:2ad0) +TwoItemHorizontalMenu: ; 2ad0 (0:2ad0) call DrawWideTextBox_PrintText lb de, 6, 16 ; x, y ld a, d - ld [wcd98], a + ld [wLeftmostItemCursorX], a lb bc, $0f, $00 ; cursor tile, tile behind cursor call SetCursorParametersForTextBox ld a, 1 ld [wCurMenuItem], a call EnableLCD - jp HandleYesOrNoMenu.init_menu + jp HandleYesOrNoMenu.refresh_menu ; 0x2aeb Func_2aeb: ; 2aeb (0:2aeb) @@ -5371,32 +5375,35 @@ YesOrNoMenuWithText_LeftAligned: ; 2afe (0:2afe) ; fallthrough HandleYesOrNoMenu: ld a, d - ld [wcd98], a + ld [wLeftmostItemCursorX], a lb bc, $0f, $00 ; cursor tile, tile behind cursor call SetCursorParametersForTextBox ld a, [wcd9a] ld [wCurMenuItem], a call EnableLCD - jr .init_menu + jr .refresh_menu .wait_button_loop call DoFrame - call HandleTextBoxInput + call RefreshMenuCursor ldh a, [hButtonsPressed] bit A_BUTTON_F, a jr nz, .a_pressed ldh a, [hButtonsPressed2] and D_RIGHT | D_LEFT jr z, .wait_button_loop + ; left or right pressed, so switch to the other menu item ld a, $1 call PlaySFX call EraseCursor -.init_menu - ld a, [wcd98] +.refresh_menu + ld a, [wLeftmostItemCursorX] ld c, a + ; default to the second option (NO) ld hl, wCurMenuItem ld a, [hl] xor $1 ld [hl], a + ; x separation between left and right items is 4 tiles add a add a add c @@ -5410,11 +5417,11 @@ HandleYesOrNoMenu: or a jr nz, .no ;.yes - ld [wcd9a], a + ld [wcd9a], a ; 0 ret .no xor a - ld [wcd9a], a + ld [wcd9a], a ; 0 ld a, $1 ldh [hCurrentMenuItem], a scf -- cgit v1.2.3 From 4d594f0e320b5eda3a6bc503392c88131358d3ce Mon Sep 17 00:00:00 2001 From: xCrystal Date: Sat, 10 Feb 2018 01:07:57 +0100 Subject: Correct some textbox labels --- src/engine/bank1.asm | 4 ++-- src/engine/home.asm | 15 ++++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'src/engine') diff --git a/src/engine/bank1.asm b/src/engine/bank1.asm index 4af5978..5adf436 100755 --- a/src/engine/bank1.asm +++ b/src/engine/bank1.asm @@ -284,7 +284,7 @@ Func_426d: ld [wVBlankCtr], a ld [wcbf9], a text_hl DuelistIsThinkingText - call Func_2a36 + call DrawWideTextBox_PrintTextNoDelay call Func_2bbf ld a, $ff ld [wcc11], a @@ -1223,7 +1223,7 @@ AIMakeDecision: ; 67be (1:67be) ret nz ld [wVBlankCtr], a ld hl, $0088 - call Func_2a36 + call DrawWideTextBox_PrintTextNoDelay or a ret diff --git a/src/engine/home.asm b/src/engine/home.asm index 8248752..1bc9a47 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -5241,18 +5241,23 @@ SetCursorParametersForTextBox: ; 2a1a (0:2a1a) ret ; 0x2a30 - INCROM $2a30, $2a36 +Func_2a30: ; 2a30 (0:2a30) + call DrawWideTextBox_PrintTextNoDelay + jp WaitForWideTextBoxInput +; 0x2a36 -Func_2a36: ; 2a36 (0:2a36) +DrawWideTextBox_PrintTextNoDelay: ; 2a36 (0:2a36) push hl call DrawWideTextBox ld a, $13 jr Func_2a44 -DrawNarrowTextBox_PrintText: ; 2a3e (0:2a3e) +DrawNarrowTextBox_PrintTextNoDelay: ; 2a3e (0:2a3e) push hl call DrawNarrowTextBox ld a, $b +; fallthrough + Func_2a44: ; 2a44 (0:2a44) lb de, 1, 14 call AdjustCoordinatesForWindow @@ -5284,7 +5289,7 @@ DrawNarrowTextBox: ; 2a6f (0:2a6f) ret DrawNarrowTextBox_WaitForInput: ; 2a7c (0:2a7c) - call DrawNarrowTextBox_PrintText + call DrawNarrowTextBox_PrintTextNoDelay xor a ld hl, NarrowTextBoxPromptCursorData call InitializeCursorParameters @@ -5368,7 +5373,7 @@ YesOrNoMenu: ; 2af3 (0:2af3) jr HandleYesOrNoMenu YesOrNoMenuWithText_LeftAligned: ; 2afe (0:2afe) - call DrawNarrowTextBox_PrintText + call DrawNarrowTextBox_PrintTextNoDelay lb de, 3, 16 ; x, y call PrintYesOrNoItems lb de, 2, 16 ; x, y -- cgit v1.2.3 From f541f5e03adadf0b9315cc642da9a5b377b52c12 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Sat, 10 Feb 2018 14:11:36 +0100 Subject: Refractor/rearrange some macros --- src/engine/bank1.asm | 36 +++++++++++++-------------- src/engine/bank2.asm | 8 +++--- src/engine/bank3.asm | 4 +-- src/engine/bank4.asm | 12 ++++----- src/engine/bank6.asm | 10 ++++---- src/engine/effect_functions.asm | 16 ++++++------ src/engine/home.asm | 54 ++++++++++++++++++++--------------------- 7 files changed, 70 insertions(+), 70 deletions(-) (limited to 'src/engine') diff --git a/src/engine/bank1.asm b/src/engine/bank1.asm index 5adf436..b5894d2 100755 --- a/src/engine/bank1.asm +++ b/src/engine/bank1.asm @@ -22,7 +22,7 @@ Func_4000: ; 4000 (1:4000) .ask_erase_backup_ram call Func_405a call Func_04a2 - text_hl ResetBackUpRamText + ldtx hl, ResetBackUpRamText call YesOrNoMenuWithText jr c, .reset_game ; erase sram @@ -129,7 +129,7 @@ StartDuel: ; 409f (1:409f) call Func_04a2 ld a, $3 call Func_2167 - text_hl DecisionText + ldtx hl, DecisionText call DrawWideTextBox_WaitForInput call Func_04a2 ldh a, [hWhoseTurn] @@ -148,7 +148,7 @@ StartDuel: ; 409f (1:409f) jr z, .activeDuelistLostBattle ld a, $5f ld c, MUSIC_DARKDIDDLY - text_hl DuelWasDrawText + ldtx hl, DuelWasDrawText jr .handleDuelFinished .activeDuelistWonBattle @@ -160,7 +160,7 @@ StartDuel: ; 409f (1:409f) ld [wd0c3], a ld a, $5d ld c, MUSIC_MATCHVICTORY - text_hl WonDuelText + ldtx hl, WonDuelText jr .handleDuelFinished .activeDuelistLostBattle @@ -172,7 +172,7 @@ StartDuel: ; 409f (1:409f) ld [wd0c3], a ld a, $5e ld c, MUSIC_MATCHLOSS - text_hl LostDuelText + ldtx hl, LostDuelText .handleDuelFinished call Func_3b6a @@ -203,7 +203,7 @@ StartDuel: ; 409f (1:409f) call Func_3b31 ld a, [wDuelTheme] call PlaySong - text_hl StartSuddenDeathMatchText + ldtx hl, StartSuddenDeathMatchText call DrawWideTextBox_WaitForInput ld a, $1 ld [wcc08], a @@ -283,7 +283,7 @@ Func_426d: xor a ld [wVBlankCtr], a ld [wcbf9], a - text_hl DuelistIsThinkingText + ldtx hl, DuelistIsThinkingText call DrawWideTextBox_PrintTextNoDelay call Func_2bbf ld a, $ff @@ -414,7 +414,7 @@ DuelMenu_Retreat: ; 43ab (1:43ab) jr c, Func_441f call $4611 jr c, Func_441c - text_hl SelectMonOnBenchToSwitchWithActiveText + ldtx hl, SelectMonOnBenchToSwitchWithActiveText call DrawWideTextBox_WaitForInput call $600c jr c, Func_441c @@ -428,7 +428,7 @@ DuelMenu_Retreat: ; 43ab (1:43ab) call $4f9d Func_43e8: ; 43e8 - text_hl UnableToRetreatText + ldtx hl, UnableToRetreatText call DrawWideTextBox_WaitForInput jp PrintDuelMenu @@ -438,7 +438,7 @@ Func_43f1: ; 43f1 (1:43f1) call $4611 jr c, Func_441c call $6558 - text_hl SelectMonOnBenchToSwitchWithActiveText + ldtx hl, SelectMonOnBenchToSwitchWithActiveText call DrawWideTextBox_WaitForInput call $600c ld [wBenchSelectedPokemon], a @@ -463,14 +463,14 @@ DuelMenu_Hand: ; 4425 (1:4425) call GetTurnDuelistVariable or a jr nz, Func_4436 - text_hl NoCardsInHandText + ldtx hl, NoCardsInHandText call DrawWideTextBox_WaitForInput jp PrintDuelMenu Func_4436: ; 4436 (1:4436) INCROM $4436, $4477 -; c contains the energy card being played +; c contains the type of energy card being played PlayerUseEnergyCard: ; 4477 (1:4477) ld a, c cp TYPE_ENERGY_WATER ; XXX why treat water energy card differently? @@ -510,12 +510,12 @@ PlayerUseEnergyCard: ; 4477 (1:4477) ld a, [wAlreadyPlayedEnergy] or a jr z, .asm_4490 - text_hl OnlyOneEnergyCardText + ldtx hl, OnlyOneEnergyCardText call DrawWideTextBox_WaitForInput jp Func_4436 .alreadyPlayedEnergy - text_hl OnlyOneEnergyCardText + ldtx hl, OnlyOneEnergyCardText call DrawWideTextBox_WaitForInput call CreateHandCardBuffer call $55be @@ -549,7 +549,7 @@ DuelMenu_Attack: ; 46fc (1:46fc) call LoadPokemonMovesToDuelCardOrAttackList or a jr nz, .openAttackMenu - text_hl NoSelectableAttackText + ldtx hl, NoSelectableAttackText call DrawWideTextBox_WaitForInput jp PrintDuelMenu @@ -578,7 +578,7 @@ DuelMenu_Attack: ; 46fc (1:46fc) ld [wSelectedDuelSubMenuItem], a call CheckIfEnoughEnergies jr nc, .enoughEnergy - text_hl NotEnoughEnergyCardsText + ldtx hl, NotEnoughEnergyCardsText call DrawWideTextBox_WaitForInput jr .tryOpenAttackMenu @@ -918,11 +918,11 @@ CheckIfActiveCardParalyzedOrAsleep: ; 4918 (1:4918) ret .paralyzed - text_hl UnableDueToParalysisText + ldtx hl, UnableDueToParalysisText jr .returnWithStatusCondition .asleep - text_hl UnableDueToSleepText + ldtx hl, UnableDueToSleepText .returnWithStatusCondition: scf diff --git a/src/engine/bank2.asm b/src/engine/bank2.asm index d9685a1..fea3d9b 100755 --- a/src/engine/bank2.asm +++ b/src/engine/bank2.asm @@ -81,7 +81,7 @@ Func_8db0: ; 8db0 (2:4db0) Func_8dbc: ; 8dbc (2:4dbc) ld hl, Unknown_8de2 call InitializeCursorParameters - text_hl PleaseSelectDeckText + ldtx hl, PleaseSelectDeckText call DrawWideTextBox_PrintText .asm_8dc8 call DoFrame @@ -348,13 +348,13 @@ Func_8f9d: ; 8f9d (2:4f9d) xor a ld [wce3f], a ld [wce40], a - text_hl ChosenAsDuelingDeckText + ldtx hl, ChosenAsDuelingDeckText call DrawWideTextBox_WaitForInput ld a, [wceb1] jp Func_8dbc Func_8fe8: ; 8fe8 (2:4fe8) - text_hl ThereIsNoDeckHereText + ldtx hl, ThereIsNoDeckHereText call DrawWideTextBox_WaitForInput ld a, [wceb1] ret @@ -703,7 +703,7 @@ Func_926e: ; 926e (2:526e) ret .asm_929c call Func_22ae - text_hl NewDeckText + ldtx hl, NewDeckText call Func_2c29 scf ret diff --git a/src/engine/bank3.asm b/src/engine/bank3.asm index 7317f32..563a667 100755 --- a/src/engine/bank3.asm +++ b/src/engine/bank3.asm @@ -1062,7 +1062,7 @@ PC_c7ea: ; c7ea (3:47ea) call Func_c241 call $4915 call DoFrameIfLCDEnabled - text_hl TurnedPCOnText + ldtx hl, TurnedPCOnText call Func_2c73 call $484e .asm_c801 @@ -1089,7 +1089,7 @@ PC_c7ea: ; c7ea (3:47ea) .asm_c82f call Func_c135 call DoFrameIfLCDEnabled - text_hl TurnedPCOffText + ldtx hl, TurnedPCOffText call Func_c891 call CloseDialogueBox xor a diff --git a/src/engine/bank4.asm b/src/engine/bank4.asm index cdb767f..29d96fc 100755 --- a/src/engine/bank4.asm +++ b/src/engine/bank4.asm @@ -90,7 +90,7 @@ Medal_1029e: ; 1029e (4:429e) ld a, [wd116] cp $e0 jr nz, .asm_102e2 - text_hl WonTheMedalText + ldtx hl, WonTheMedalText call Func_2c73 call Func_3c96 call Func_37a0 @@ -142,16 +142,16 @@ BoosterPack_1031b: ; 1031b (4:431b) pop bc ld a, c farcall GenerateBoosterPack - text_hl ReceivedBoosterPackText + ldtx hl, ReceivedBoosterPackText ld a, [wd117] cp $1 jr nz, .asm_10373 - text_hl AndAnotherBoosterPackText + ldtx hl, AndAnotherBoosterPackText .asm_10373 call Func_2c73 call Func_3c96 call Func_37a0 - text_hl CheckedCardsInBoosterPackText + ldtx hl, CheckedCardsInBoosterPackText call Func_2c73 call DisableLCD call Func_1288c @@ -1502,7 +1502,7 @@ Func_1344d: ; 1344d (4:744d) call Func_379b ld a, MUSIC_MEDAL call PlaySong - text_hl DefeatedFiveOpponentsText + ldtx hl, DefeatedFiveOpponentsText call Func_2c73 call Func_3c96 call Func_37a0 @@ -1524,7 +1524,7 @@ Func_13485: ; 13485 (4:7485) call Func_379b ld a, MUSIC_MEDAL call PlaySong - text_hl ConsecutiveWinRecordIncreasedText + ldtx hl, ConsecutiveWinRecordIncreasedText call Func_2c73 call Func_3c96 call Func_37a0 diff --git a/src/engine/bank6.asm b/src/engine/bank6.asm index 82fb589..6428c3f 100755 --- a/src/engine/bank6.asm +++ b/src/engine/bank6.asm @@ -124,23 +124,23 @@ Func_1a61f: ; 1a61f (6:661f) ld a, $76 call $663b ld a, $c1 - text_hl ReceivedLegendaryCardText + ldtx hl, ReceivedLegendaryCardText jr .asm_1a660 .asm_1a640 - text_hl ReceivedCardText + ldtx hl, ReceivedCardText cp $1e jr z, .asm_1a660 cp $43 jr z, .asm_1a660 - text_hl ReceivedPromotionalFlyingPikachuText + ldtx hl, ReceivedPromotionalFlyingPikachuText cp $64 jr z, .asm_1a660 - text_hl ReceivedPromotionalSurfingPikachuText + ldtx hl, ReceivedPromotionalSurfingPikachuText cp $65 jr z, .asm_1a660 cp $66 jr z, .asm_1a660 - text_hl ReceivedPromotionalCardText + ldtx hl, ReceivedPromotionalCardText .asm_1a660 push hl ld e, a diff --git a/src/engine/effect_functions.asm b/src/engine/effect_functions.asm index 82198a2..dc05043 100644 --- a/src/engine/effect_functions.asm +++ b/src/engine/effect_functions.asm @@ -1,5 +1,5 @@ Poison50PercentEffect: ; 2c000 (b:4000) - text_de PoisonCheckText + ldtx de, PoisonCheckText call TossCoin_BankB ret nc @@ -11,14 +11,14 @@ PoisonEffect: ; 2c007 (b:4007) jr applyEffect Paralysis50PercentEffect: ; 2c011 (b:4011) - text_de ParalysisCheckText + ldtx de, ParalysisCheckText call TossCoin_BankB ret nc lb bc, $f0, PARALYZED jr applyEffect Confusion50PercentEffect: ; 2c01d (b:401d) - text_de ConfusionCheckText + ldtx de, ConfusionCheckText call TossCoin_BankB ret nc @@ -26,7 +26,7 @@ ConfusionEffect: ; 2c024 (b:4024) lb bc, $f0, CONFUSED jr applyEffect - text_de SleepCheckText + ldtx de, SleepCheckText call TossCoin_BankB ret nc @@ -227,7 +227,7 @@ SpitPoison_AIEffect: ; 2c6f0 (b:46f0) ; 0x2c6f8 SpitPoison_Poison50PercentEffect: ; 2c6f8 (b:46f8) - text_de PoisonCheckText + ldtx de, PoisonCheckText call TossCoin_BankB jp c, PoisonEffect ld a, $8c @@ -253,7 +253,7 @@ WeepinbellPoisonPowder_AIEffect: ; 2c738 (b:4738) INCROM $2c740, $2c77e AcidEffect: ; 2c77e (b:477e) - text_de AcidCheckText + ldtx de, AcidCheckText call TossCoin_BankB ret nc ld a, SUBSTATUS2_UNABLE_RETREAT @@ -277,7 +277,7 @@ FoulOdorEffect: ; 2c793 (b:4793) ; 0x2c7a0 KakunaStiffenEffect: ; 2c7a0 (b:47a0) - text_de IfHeadsNoDamageNextTurnText + ldtx de, IfHeadsNoDamageNextTurnText call TossCoin_BankB jp nc, Func_2c0a2 ld a, $4f @@ -314,7 +314,7 @@ ZubatSupersonicEffect: ; 2c7dc (b:47dc) ; an exact copy of KakunaStiffenEffect MetapodStiffenEffect: ; 2c836 (b:4836) - text_de IfHeadsNoDamageNextTurnText + ldtx de, IfHeadsNoDamageNextTurnText call TossCoin_BankB jp nc, Func_2c0a2 ld a, $4f diff --git a/src/engine/home.asm b/src/engine/home.asm index 1bc9a47..2f57dce 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -2330,7 +2330,7 @@ Func_0f35: ; 0f35 (0:0f35) ld l, a ld h, $0 call Func_2ec4 - text_hl TransmissionErrorText + ldtx hl, TransmissionErrorText call DrawWideTextBox_WaitForInput ld a, $ff ld [wd0c3], a @@ -2609,7 +2609,7 @@ ShuffleDeck: ; 10bc (0:10bc) call ShuffleCards ret -; draw a card from the deck, saving its location as $40 +; draw a card from the deck, saving its location as CARD_LOCATION_JUST_DRAWN ; returns c if deck is empty, nc if a card was succesfully drawn DrawCardFromDeck: ; 10cf (0:10cf) push hl @@ -2623,7 +2623,7 @@ DrawCardFromDeck: ; 10cf (0:10cf) ld l, a ld a, [hl] ; grab card number (0-59) from wPlayerDeckCards or wOpponentDeckCards array ld l, a - ld [hl], CARD_LOCATION_JUST_DRAWN ; temporarily write $40 to corresponding card location variable + ld [hl], CARD_LOCATION_JUST_DRAWN ; temporarily write to corresponding card location variable pop hl or a ret @@ -3200,7 +3200,7 @@ DealConfusionDamageToSelf: ; 1828 (0:1828) bank1call $4f9d ld a, $1 ld [wcce6], a - text_hl DamageToSelfDueToConfusionText + ldtx hl, DamageToSelfDueToConfusionText call DrawWideTextBox_PrintText ld a, $75 ld [wLoadedMoveAnimation], a @@ -3299,7 +3299,7 @@ CheckSelfConfusionDamage: ; 18d7 (0:18d7) or a ret .confused - text_de ConfusionCheckDamageText + ldtx de, ConfusionCheckDamageText call TossCoin jr c, .no_confusion_damage ld a, $1 @@ -3572,7 +3572,7 @@ Func_1ad3: ; 1ad3 (0:1ad3) ld h, [hl] ld l, a call Func_2ebb - text_hl WasKnockedOutText + ldtx hl, WasKnockedOutText call DrawWideTextBox_PrintText ld a, $28 .asm_1aeb @@ -3601,7 +3601,7 @@ Func_1b8d: ; 1b8d (0:1b8d) ld [hli], a ld a, [wLoadedMoveName + 1] ld [hli], a - text_hl PokemonsAttackText ; text when using an attack + ldtx hl, PokemonsAttackText ; text when using an attack call DrawWideTextBox_PrintText ret @@ -3638,7 +3638,7 @@ Func_1bca: ; 1bca (0:1bca) inc de ld a, [hli] ld [de], a - text_hl WasUnsuccessfulText + ldtx hl, WasUnsuccessfulText call DrawWideTextBox_PrintText scf ret @@ -3694,7 +3694,7 @@ PrintOpponentName: ; 1c8e (0:1c8e) jr z, .print_player2 jr printNameLoop .print_player2 - text_hl Player2 + ldtx hl, Player2Text jp PrintTextBoxBorderLabel Func_1caa: ; 1caa (0:1caa) @@ -5435,7 +5435,7 @@ HandleYesOrNoMenu: ; prints YES NO at de PrintYesOrNoItems: ; 2b66 (0:2b66) call AdjustCoordinatesForWindow - text_hl YesOrNoText + ldtx hl, YesOrNoText call Func_2c1b ret ; 0x2b70 @@ -6728,13 +6728,13 @@ HandleCantAttackSubstatus: ; 33c1 (0:33c1) call GetTurnDuelistVariable or a ret z - text_hl UnableToAttackDueToTailWagText + ldtx hl, UnableToAttackDueToTailWagText cp SUBSTATUS2_TAIL_WAG jr z, .return_with_cant_attack - text_hl UnableToAttackDueToLeerText + ldtx hl, UnableToAttackDueToLeerText cp SUBSTATUS2_LEER jr z, .return_with_cant_attack - text_hl UnableToAttackDueToBoneAttackText + ldtx hl, UnableToAttackDueToBoneAttackText cp SUBSTATUS2_BONE_ATTACK jr z, .return_with_cant_attack or a @@ -6762,7 +6762,7 @@ HandleAmnesiaSubstatus: ; 33e1 (0:33e1) ld a, [wSelectedMoveIndex] cp [hl] jr nz, .not_the_disabled_move - text_hl UnableToUseAttackDueToAmnesiaText + ldtx hl, UnableToUseAttackDueToAmnesiaText scf ret @@ -6774,7 +6774,7 @@ HandleSandAttackOrSmokescreenSubstatus: ; 3400 (0:3400) ld [wcc0a], a ccf ret nc - text_hl AttackUnsuccessfulText + ldtx hl, AttackUnsuccessfulText call DrawWideTextBox_WaitForInput scf ret @@ -6785,10 +6785,10 @@ CheckSandAttackOrSmokescreenSubstatus: ; 3414 (0:3414) call GetTurnDuelistVariable or a ret z - text_de SandAttackCheckText + ldtx de, SandAttackCheckText cp SUBSTATUS2_SAND_ATTACK jr z, .card_is_affected - text_de SmokescreenCheckText + ldtx de, SmokescreenCheckText cp SUBSTATUS2_SMOKESCREEN jr z, .card_is_affected or a @@ -6812,15 +6812,15 @@ HandleNoDamageOrEffectSubstatus: ; 3432 (0:3432) ld a, DUELVARS_ARENA_CARD_SUBSTATUS1 call GetTurnDuelistVariable ld e, NO_DAMAGE_OR_EFFECT_FLY - text_hl NoDamageOrEffectDueToFlyText + ldtx hl, NoDamageOrEffectDueToFlyText cp SUBSTATUS1_FLY jr z, .no_damage_or_effect ld e, NO_DAMAGE_OR_EFFECT_BARRIER - text_hl NoDamageOrEffectDueToBarrierText + ldtx hl, NoDamageOrEffectDueToBarrierText cp SUBSTATUS1_BARRIER jr z, .no_damage_or_effect ld e, NO_DAMAGE_OR_EFFECT_AGILITY - text_hl NoDamageOrEffectDueToAgilityText + ldtx hl, NoDamageOrEffectDueToAgilityText cp SUBSTATUS1_AGILITY jr z, .no_damage_or_effect call CheckIfUnderAnyCannotUseStatus @@ -6848,7 +6848,7 @@ HandleNoDamageOrEffectSubstatus: ; 3432 (0:3432) or a ret z ld e, NO_DAMAGE_OR_EFFECT_NSHIELD - text_hl NoDamageOrEffectDueToNShieldText + ldtx hl, NoDamageOrEffectDueToNShieldText jr .no_damage_or_effect ; if the Pokemon being attacked is Haunter1, and its Transparency is active, @@ -6869,12 +6869,12 @@ HandleTransparency: ; 348a (0:348a) jr c, .asm_3491 xor a ld [wcac2], a - text_de TransparencyCheckText + ldtx de, TransparencyCheckText call TossCoin ret nc ld a, NO_DAMAGE_OR_EFFECT_TRANSPARENCY ld [wNoDamageOrEffect], a - text_hl NoDamageOrEffectDueToTransparencyText + ldtx hl, NoDamageOrEffectDueToTransparencyText scf ret ; 0x34b7 @@ -6936,13 +6936,13 @@ CheckIfUnderAnyCannotUseStatus2: ; 34f0 (0:34f0) ld a, DUELVARS_ARENA_CARD_STATUS call GetTurnDuelistVariable and PASSIVE_STATUS_MASK - text_hl CannotUseDueToStatusText + ldtx hl, CannotUseDueToStatusText scf jr nz, .done ; return carry .check_toxic_gas ld a, MUK call Func_3509 - text_hl UnableDueToToxicGasText + ldtx hl, UnableDueToToxicGasText .done ret @@ -7084,7 +7084,7 @@ HandleDestinyBondSubstatus: ; 363b (0:363b) ld h, [hl] ld l, a call Func_2ebb - text_hl KnockedOutDueToDestinyBondText + ldtx hl, KnockedOutDueToDestinyBondText call DrawWideTextBox_WaitForInput ret ; 0x367b @@ -7130,7 +7130,7 @@ ApplyStrikesBack: ; 36a2 (0:36a2) push af push hl call SubstractHP - text_hl ReceivesDamageDueToStrikesBackText + ldtx hl, ReceivesDamageDueToStrikesBackText call DrawWideTextBox_PrintText pop hl pop af -- cgit v1.2.3