Split bank1

This commit is contained in:
ElectroDeoxys
2021-09-23 18:37:05 +01:00
parent 8dee6b7a11
commit ca15abf2ff
25 changed files with 702 additions and 649 deletions
+66
View File
@@ -0,0 +1,66 @@
PracticeDuelTextPointerTable:
dw PracticeDuelText_Turn1
dw PracticeDuelText_Turn2
dw PracticeDuelText_Turn3
dw PracticeDuelText_Turn4
dw PracticeDuelText_Turn5
dw PracticeDuelText_Turn6
dw PracticeDuelText_Turn7
dw PracticeDuelText_Turn8
practicetext: MACRO
db \1 ; Y coord to place the point-by-point instruction
tx \2 ; Dr. Mason's instruction
tx \3 ; static point-by-point instruction
ENDM
PracticeDuelText_Turn1:
practicetext 2, Turn1DrMason1PracticeDuelText, Turn1Instr1PracticeDuelText
practicetext 5, Turn1DrMason2PracticeDuelText, Turn1Instr2PracticeDuelText
practicetext 8, Turn1DrMason3PracticeDuelText, Turn1Instr3PracticeDuelText
db $00
PracticeDuelText_Turn2:
practicetext 2, Turn2DrMason1PracticeDuelText, Turn2Instr1PracticeDuelText
practicetext 5, Turn2DrMason2PracticeDuelText, Turn2Instr2PracticeDuelText
practicetext 8, Turn2DrMason3PracticeDuelText, Turn2Instr3PracticeDuelText
db $00
PracticeDuelText_Turn3:
practicetext 2, Turn3DrMason1PracticeDuelText, Turn3Instr1PracticeDuelText
practicetext 5, Turn3DrMason2PracticeDuelText, Turn3Instr2PracticeDuelText
practicetext 8, Turn3DrMason3PracticeDuelText, Turn3Instr3PracticeDuelText
db $00
PracticeDuelText_Turn4:
practicetext 2, Turn4DrMason1PracticeDuelText, Turn4Instr1PracticeDuelText
practicetext 5, Turn4DrMason2PracticeDuelText, Turn4Instr2PracticeDuelText
practicetext 8, Turn4DrMason3PracticeDuelText, Turn4Instr3PracticeDuelText
db $00
PracticeDuelText_Turn5:
practicetext 2, Turn5DrMason1PracticeDuelText, Turn5Instr1PracticeDuelText
practicetext 6, Turn5DrMason2PracticeDuelText, Turn5Instr2PracticeDuelText
db $00
PracticeDuelText_Turn6:
practicetext 2, Turn6DrMason1PracticeDuelText, Turn6Instr1PracticeDuelText
practicetext 5, Turn6DrMason2PracticeDuelText, Turn6Instr2PracticeDuelText
practicetext 8, Turn6DrMason3PracticeDuelText, Turn6Instr3PracticeDuelText
db $00
PracticeDuelText_Turn7:
practicetext 2, Turn7DrMason1PracticeDuelText, Turn7Instr1PracticeDuelText
practicetext 5, Turn7DrMason2PracticeDuelText, Turn7Instr2PracticeDuelText
db $00
PracticeDuelText_Turn8:
practicetext 2, Turn8DrMason1PracticeDuelText, Turn8Instr1PracticeDuelText
practicetext 5, Turn8DrMason2PracticeDuelText, Turn8Instr2PracticeDuelText
db $00
; on player's Seaking knocked out
PracticeDuelText_SamTurn4:
practicetext 2, SamTurn4DrMason1PracticeDuelText, SamTurn4Instr1PracticeDuelText
practicetext 7, SamTurn4DrMason2PracticeDuelText, SamTurn4Instr2PracticeDuelText
db $00
+3 -3
View File
@@ -1,11 +1,11 @@
InitAIDuelVars: ; 15636 (5:5636)
ld a, $10
ld hl, wcda5
ld a, wAIDuelVarsEnd - wAIDuelVars
ld hl, wAIDuelVars
call ClearMemory_Bank5
ld a, 5
ld [wAIPokedexCounter], a
ld a, $ff
ld [wcda5], a
ld [wAIPeekedPrizes], a
ret
; initializes some variables and sets value of wAIBarrierFlagCounter.
+1 -1
View File
@@ -727,7 +727,7 @@ HandleAIPeek: ; 224e6 (8:64e6)
.check_ai_prizes
ld a, DUELVARS_PRIZES
call GetTurnDuelistVariable
ld hl, wcda5
ld hl, wAIPeekedPrizes
and [hl]
ld [hl], a
or a
+1 -1
View File
@@ -1,4 +1,4 @@
INCLUDE "data/ai_trainer_card_logic.asm"
INCLUDE "data/duel/ai_trainer_card_logic.asm"
_AIProcessHandTrainerCards: ; 200e5 (8:40e5)
ld [wAITrainerCardPhase], a
+1 -1
View File
@@ -2225,7 +2225,7 @@ WriteCardListsTerminatorBytes: ; 8ce7 (2:4ce7)
ret
; inits some SRAM addresses
Func_8cf9: ; 8cf9 (2:4cf9)
InitPromotionalCardAndDeckCounterSaveData: ; 8cf9 (2:4cf9)
call EnableSRAM
xor a
ld hl, sHasPromotionalCards
+1 -1
View File
@@ -5127,7 +5127,7 @@ MainMenuFunctionTable: ; 126fc (4:66fc)
MainMenu_NewGame: ; 12704 (4:6704)
farcall Func_c1b1
call DisplayPlayerNamingScreen
farcall Func_1996e
farcall InitSaveData
call EnableSRAM
ld a, [sAnimationsDisabled]
ld [wAnimationsDisabled], a
+36 -23
View File
@@ -1048,8 +1048,7 @@ Func_18661: ; 18661 (6:4661)
ld a, SYM_CURSOR_R
jr .draw_tile
; (6:46f7)
INCLUDE "data/effect_commands.asm"
INCLUDE "data/duel/effect_commands.asm"
; reads the animation commands from PointerTable_AttackAnimation
; of attack in wLoadedAttackAnimation and plays them
@@ -1404,7 +1403,7 @@ UpdateMainSceneHUD: ; 19199 (6:5199)
Func_191a3: ; 191a3 (6:51a3)
ret
INCLUDE "data/attack_animations.asm"
INCLUDE "data/duel/animations/attack_animations.asm"
; if carry flag is set, only delays
; if carry not set:
@@ -1990,7 +1989,7 @@ Func_1991f: ; 1991f (6:591f)
add $02
push hl
ld hl, sDeck1Name
call Func_199e0
call CopyDeckNameAndCards
pop hl
call SwapTurn
ld a, [hli]
@@ -2026,12 +2025,16 @@ Func_1991f: ; 1991f (6:591f)
.data
db $03, $04, $05, $06, $07, $08
Func_1996e: ; 1996e (6:596e)
; clears saved data (card Collection/saved decks/Card Pop! data/etc)
; then adds the starter decks as saved decks
; marks all cards in Collection as not owned
InitSaveData: ; 1996e (6:596e)
; clear card and deck save data
call EnableSRAM
ld a, PLAYER_TURN
ldh [hWhoseTurn], a
ld hl, sCardCollection
ld bc, $1607
ld hl, sCardAndDeckSaveData
ld bc, sCardAndDeckSaveDataEnd - sCardAndDeckSaveData
.loop_clear
xor a
ld [hli], a
@@ -2040,16 +2043,18 @@ Func_1996e: ; 1996e (6:596e)
or b
jr nz, .loop_clear
; add the starter decks
ld a, CHARMANDER_AND_FRIENDS_DECK
ld hl, sSavedDeck1
call Func_199e0
call CopyDeckNameAndCards
ld a, SQUIRTLE_AND_FRIENDS_DECK
ld hl, sSavedDeck2
call Func_199e0
call CopyDeckNameAndCards
ld a, BULBASAUR_AND_FRIENDS_DECK
ld hl, sSavedDeck3
call Func_199e0
call CopyDeckNameAndCards
; marks all cards in Collection to not owned
call EnableSRAM
ld hl, sCardCollection
ld a, CARD_NOT_OWNED
@@ -2061,9 +2066,10 @@ Func_1996e: ; 1996e (6:596e)
ld hl, sCurrentDuel
xor a
ld [hli], a
ld [hli], a
ld [hli], a ; sCurrentDuelChecksum
ld [hl], a
; clears Card Pop! names
ld hl, sCardPopNameList
ld c, CARDPOP_NAME_LIST_MAX_ELEMS
.loop_card_pop_names
@@ -2073,59 +2079,66 @@ Func_1996e: ; 1996e (6:596e)
dec c
jr nz, .loop_card_pop_names
; saved configuration options
ld a, 2
ld [sPrinterContrastLevel], a
ld a, $2
ld [sTextSpeed], a
ld [wTextSpeed], a
; miscellaneous data
xor a
ld [sAnimationsDisabled], a
ld [sSkipDelayAllowed], a
ld [s0a004], a
ld [sTotalCardPopsDone], a
ld [sReceivedLegendaryCards], a
farcall Func_8cf9
farcall InitPromotionalCardAndDeckCounterSaveData
call DisableSRAM
ret
Func_199e0: ; 199e0 (6:59e0)
; input:
; a = Deck ID
; hl = destination to copy
CopyDeckNameAndCards: ; 199e0 (6:59e0)
push de
push bc
push hl
call LoadDeck
jr c, .asm_19a0e
call Func_19a12
jr c, .done
call .CopyDeckName
pop hl
call EnableSRAM
push hl
ld de, wDefaultText
.asm_199f3
.loop_write_name
ld a, [de]
inc de
ld [hli], a
or a
jr nz, .asm_199f3
jr nz, .loop_write_name
pop hl
push hl
ld de, $0018
ld de, DECK_NAME_SIZE
add hl, de
ld de, wPlayerDeck
ld c, $3c
.asm_19a04
ld c, DECK_SIZE
.loop_write_cards
ld a, [de]
inc de
ld [hli], a
dec c
jr nz, .asm_19a04
jr nz, .loop_write_cards
call DisableSRAM
or a
.asm_19a0e
.done
pop hl
pop bc
pop de
ret
Func_19a12: ; 19a12 (6:5a12)
.CopyDeckName
ld hl, wDeckName
ld a, [hli]
ld h, [hl]
+22 -13
View File
@@ -1450,44 +1450,52 @@ Func_1cb18: ; 1cb18 (7:4b18)
push hl
push bc
push de
; if Func_3ba2 is not set as
; wDoFrameFunction, quit and set carry
ld a, [wDoFrameFunction]
cp LOW(Func_3ba2)
jr nz, .asm_1cb5b
jr nz, .carry
ld a, [wDoFrameFunction + 1]
cp HIGH(Func_3ba2)
jr nz, .asm_1cb5b
jr nz, .carry
ld a, $ff
ld [wd4c0], a
ld a, [wd42a]
cp $ff
call nz, Func_1ccd4
call nz, DoScreenAnimationUpdate
; clear all queued animations
; and disable their sprite anims
ld hl, wAnimationQueue
ld c, $07
.asm_1cb3b
ld c, ANIMATION_QUEUE_LENGTH
.loop_queue
push bc
ld a, [hl]
cp $ff
jr z, .asm_1cb4b
jr z, .next_queued
ld [wWhichSprite], a
farcall DisableCurSpriteAnim
ld a, $ff
ld [hl], a
.asm_1cb4b
.next_queued
pop bc
inc hl
dec c
jr nz, .asm_1cb3b
jr nz, .loop_queue
xor a
ld [wDuelAnimBufferCurPos], a
ld [wDuelAnimBufferSize], a
.asm_1cb57
.done
pop de
pop bc
pop hl
ret
.asm_1cb5b
.carry
scf
jr .asm_1cb57
jr .done
Func_1cb5e: ; 1cb5e (7:4b5e)
cp $96
@@ -1740,7 +1748,8 @@ DefaultScreenAnimationUpdate: ; 1ccbc (7:4cbc)
ld [hl], HIGH(DefaultScreenAnimationUpdate)
ret
Func_1ccd4: ; 1ccd4 (7:4cd4)
; runs the screen update function set in wScreenAnimUpdatePtr
DoScreenAnimationUpdate: ; 1ccd4 (7:4cd4)
ld a, 1
ld [wScreenAnimDuration], a
ld hl, wScreenAnimUpdatePtr
@@ -1953,7 +1962,7 @@ Func_1ce03: ; 1ce03 (7:4e03)
dw Func_191a3 ; DUEL_ANIM_156
dw Func_191a3 ; DUEL_ANIM_157
INCLUDE "data/duel_animations.asm"
INCLUDE "data/duel/animations/duel_animations.asm"
; plays the Opening sequence, and handles player selection
; in the Title Screen and Start Menu
File diff suppressed because it is too large Load Diff
+55
View File
@@ -0,0 +1,55 @@
; continuation of Bank0 Start
; meant as the main loop, but the game never returns from _GameLoop anyway
GameLoop:
di
ld sp, $e000
call ResetSerial
call EnableInt_VBlank
call EnableInt_Timer
call EnableSRAM
ld a, [sTextSpeed]
ld [wTextSpeed], a
ld a, [sSkipDelayAllowed]
ld [wSkipDelayAllowed], a
call DisableSRAM
ld a, 1
ld [wUppercaseHalfWidthLetters], a
ei
farcall CommentedOut_1a6cc
ldh a, [hKeysHeld]
cp A_BUTTON | B_BUTTON
jr z, .ask_erase_backup_ram
farcall _GameLoop
jr GameLoop
.ask_erase_backup_ram
call SetupResetBackUpRamScreen
call EmptyScreen
ldtx hl, ResetBackUpRamText
call YesOrNoMenuWithText
jr c, .reset_game
; erase sram
call EnableSRAM
xor a
ld [s0a000], a
call DisableSRAM
.reset_game
jp Reset
InitSaveDataAndSetUppercase:
farcall InitSaveData
ld a, 1
ld [wUppercaseHalfWidthLetters], a
ret
; basic setup to be able to print the ResetBackUpRamText in an empty screen
SetupResetBackUpRamScreen:
xor a ; SYM_SPACE
ld [wTileMapFill], a
call DisableLCD
call LoadSymbolsFont
call SetDefaultPalettes
lb de, $38, $7f
call SetupText
ret
ret ; stray ret
+52
View File
@@ -0,0 +1,52 @@
ReceiveDeckConfiguration:
farcall _ReceiveDeckConfiguration
ret
SendDeckConfiguration:
farcall _SendDeckConfiguration
ret
ReceiveCard:
farcall _ReceiveCard
ret
SendCard:
farcall _SendCard
ret
; handles all the Card Pop! functionality
DoCardPop:
farcall _DoCardPop
ret
Func_7576:
farcall Func_1991f
ret
PreparePrinterConnection:
farcall _PreparePrinterConnection
ret
PrintDeckConfiguration:
farcall _PrintDeckConfiguration
ret
PrintCardList:
farcall _PrintCardList
ret
Func_758a:
farcall Func_19eb4
ret
SetUpAndStartLinkDuel:
farcall _SetUpAndStartLinkDuel
ret
Func_7594:
farcall Func_1a61f
ret
OpenBoosterPack:
farcall _OpenBoosterPack
ret
+4 -4
View File
@@ -1429,13 +1429,13 @@ FightingGfx:: ; a8e12 (2a:4e12)
INCBIN "gfx/titlescreen/energies/fighting.2bpp"
SECTION "Anims 1", ROMX
INCLUDE "data/anims1.asm"
INCLUDE "data/duel/animations/anims1.asm"
SECTION "Anims 2", ROMX
INCLUDE "data/anims2.asm"
INCLUDE "data/duel/animations/anims2.asm"
SECTION "Anims 3", ROMX
INCLUDE "data/anims3.asm"
INCLUDE "data/duel/animations/anims3.asm"
Palette31:: ; b3feb (2c:7feb)
db 1, %11010010
@@ -1456,7 +1456,7 @@ Palette119:: ; b3ff6 (2c:7ff6)
rgb 0, 0, 8
SECTION "Anims 4", ROMX
INCLUDE "data/anims4.asm"
INCLUDE "data/duel/animations/anims4.asm"
SECTION "Palettes1", ROMX
INCLUDE "data/palettes1.asm"
+2 -2
View File
@@ -18,7 +18,7 @@ ValidateSRAM:
jr nz, .check_pattern_loop
call RestartSRAM
scf
call Func_4050
call InitSaveDataAndSetUppercase
call DisableSRAM
ret
.check_sequence
@@ -36,7 +36,7 @@ ValidateSRAM:
.restart_sram
call RestartSRAM
or a
call Func_4050
call InitSaveDataAndSetUppercase
call DisableSRAM
ret
+3 -3
View File
@@ -158,11 +158,11 @@ Func_3b31:
ld a, BANK(Func_1cb18)
call BankswitchROM
call Func_1cb18
jr c, .asm_3b45
jr c, .skip_clear_frame_func
xor a
ld [wDoFrameFunction], a
ld [wDoFrameFunction + 0], a
ld [wDoFrameFunction + 1], a
.asm_3b45
.skip_clear_frame_func
call ZeroObjectPositions
ld a, 1
ld [wVBlankOAMCopyToggle], a
+3 -1
View File
@@ -32,7 +32,9 @@ ROM0
org $3fe0
"Audio Callback"
ROMX $01
"Bank 1"
"Game Loop"
"Duel Core"
"Menus Common"
ROMX $02
"Bank 2"
ROMX $03
+8 -2
View File
@@ -3,8 +3,14 @@ INCLUDE "constants.asm"
INCLUDE "engine/home.asm"
SECTION "Bank 1", ROMX
INCLUDE "engine/bank01.asm"
SECTION "Game Loop", ROMX
INCLUDE "engine/game_loop.asm"
SECTION "Duel Core", ROMX
INCLUDE "engine/duel/core.asm"
SECTION "Menus Common", ROMX
INCLUDE "engine/menus/common.asm"
SECTION "Bank 2", ROMX
INCLUDE "engine/bank02.asm"
+6 -1
View File
@@ -1327,7 +1327,10 @@ wCoinTossNumTossed:: ; cd9f
ds $5
wcda5:: ; cda5
wAIDuelVars::
; saves the prizes that the AI already used Peek on
; each bit corresponds to a Prize card
wAIPeekedPrizes:: ; cda5
ds $1
; this is used by AI in order to determine whether
@@ -1394,6 +1397,8 @@ wAICardListEnergyBonus:: ; cdb2
wcdb4:: ; cdb4
ds $1
wAIDuelVarsEnd::
; information about various properties of
; loaded attack for AI calculations
wTempLoadedAttackEnergyCost:: ; cdb5