summaryrefslogtreecommitdiff
path: root/engine/bank3d
diff options
context:
space:
mode:
Diffstat (limited to 'engine/bank3d')
-rw-r--r--engine/bank3d/bank3d_battle.asm291
-rw-r--r--engine/bank3d/link_menu.asm910
-rw-r--r--engine/bank3d/main.asm693
-rw-r--r--engine/bank3d/random.asm13
4 files changed, 0 insertions, 1907 deletions
diff --git a/engine/bank3d/bank3d_battle.asm b/engine/bank3d/bank3d_battle.asm
deleted file mode 100644
index b9713cec..00000000
--- a/engine/bank3d/bank3d_battle.asm
+++ /dev/null
@@ -1,291 +0,0 @@
-InitBattle: ; f5ff2 (3d:5ff2)
- ld a, [wCurOpponent]
- and a
- jr z, asm_f6003
-
-InitOpponent: ; f5ff8 (3d:5ff8)
- ld a, [wCurOpponent]
- ld [wcf91], a
- ld [wEnemyMonSpecies2], a
- jr asm_f601d
-asm_f6003: ; f6003 (3d:6003)
- ld a, [wd732]
- bit 1, a
- jr z, .asm_f600f
- ld a, [hJoyHeld]
- bit 1, a ; B button pressed?
- ret nz
-.asm_f600f
- ld a, [wNumberOfNoRandomBattleStepsLeft]
- and a
- ret nz
- callab TryDoWildEncounter
- ret nz
-asm_f601d: ; f601d (f:601d)
- ld a, [wMapPalOffset]
- push af
- ld hl, wLetterPrintingDelayFlags
- ld a, [hl]
- push af
- res 1, [hl]
- call InitBattleVariables ; 3d:6236
- ld a, [wEnemyMonSpecies2]
- sub $c8
- jp c, InitWildBattle
- ld [wTrainerClass], a
- call GetTrainerInformation
- callab ReadTrainer
- callab DoBattleTransitionAndInitBattleVariables
- call _LoadTrainerPic ; 3d:615a
- xor a
- ld [wEnemyMonSpecies2], a
- ld [$ffe1], a
- dec a
- ld [wAICount], a
- coord hl, 12, 0
- predef CopyUncompressedPicToTilemap
- ld a, $ff
- ld [wEnemyMonPartyPos], a
- ld a, $2
- ld [wIsInBattle], a
-
- ; Is this a major story battle?
- ld a,[wLoneAttackNo]
- and a
- jp z,InitBattle_Common
- callabd_ModifyPikachuHappiness PIKAHAPPY_GYMLEADER ; useless since already in bank3d
- jp InitBattle_Common
-
-InitWildBattle: ; f607c (3d:607c)
- ld a, $1
- ld [wIsInBattle], a
- callab LoadEnemyMonData
- callab DoBattleTransitionAndInitBattleVariables
- ld a, [wCurOpponent]
- cp MAROWAK
- jr z, .isGhost
- callab IsGhostBattle
- jr nz, .isNoGhost
-.isGhost
- ld hl, wMonHSpriteDim
- ld a, $66
- ld [hli], a ; write sprite dimensions
- ld bc, GhostPic
- ld a, c
- ld [hli], a ; write front sprite pointer
- ld [hl], b
- ld hl, wEnemyMonNick ; set name to "GHOST"
- ld a, "G"
- ld [hli], a
- ld a, "H"
- ld [hli], a
- ld a, "O"
- ld [hli], a
- ld a, "S"
- ld [hli], a
- ld a, "T"
- ld [hli], a
- ld [hl], "@"
- ld a, [wcf91]
- push af
- ld a, MON_GHOST
- ld [wcf91], a
- ld de, vFrontPic
- call LoadMonFrontSprite ; load ghost sprite
- pop af
- ld [wcf91], a
- jr .spriteLoaded
-.isNoGhost
- ld de, vFrontPic
- call LoadMonFrontSprite ; load mon sprite
-.spriteLoaded
- xor a
- ld [wTrainerClass], a
- ld [$ffe1], a
- coord hl, 12, 0
- predef CopyUncompressedPicToTilemap
-
-; common code that executes after init battle code specific to trainer or wild battles
-InitBattle_Common: ; f60eb (3d:60eb)
- ld b, $0
- call RunPaletteCommand
- callab SlidePlayerAndEnemySilhouettesOnScreen
- xor a
- ld [H_AUTOBGTRANSFERENABLED], a
- ld hl, .emptyString
- call PrintText
- call SaveScreenTilesToBuffer1
- call ClearScreen
- ld a, $98
- ld [$ffbd], a
- ld a, $1
- ld [H_AUTOBGTRANSFERENABLED], a
- call Delay3
- ld a, $9c
- ld [$ffbd], a
- call LoadScreenTilesFromBuffer1
- coord hl, 9, 7
- ld bc, $50a
- call ClearScreenArea
- coord hl, 1, 0
- ld bc, $40a
- call ClearScreenArea
- call ClearSprites
- ld a, [wIsInBattle]
- dec a ; is it a wild battle?
- ld hl, DrawEnemyHUDAndHPBar
- ld b,BANK(DrawEnemyHUDAndHPBar)
- call z, Bankswitch ; draw enemy HUD and HP bar if it's a wild battle
- callab StartBattle
- callab EndOfBattle
- pop af
- ld [wLetterPrintingDelayFlags], a
- pop af
- ld [wMapPalOffset], a
- ld a, [wSavedTilesetType]
- ld [hTilesetType], a
- scf
- ret
-.emptyString
- db "@"
-
-_LoadTrainerPic: ; f615a (3d:615a)
-; wd033-wd034 contain pointer to pic
- ld a, [wTrainerPicPointer] ; wd033
- ld e, a
- ld a, [wTrainerPicPointer + 1] ; wd034
- ld d, a ; de contains pointer to trainer pic
- ld a, [wLinkState]
- and a
- ld a, Bank(TrainerPics) ; this is where all the trainer pics are (not counting Red's)
- jr z, .loadSprite
- ld a, Bank(RedPicFront)
-.loadSprite
- call UncompressSpriteFromDE
- ld de, vFrontPic
- ld a, $77
- ld c, a
- jp LoadUncompressedSpriteData
-
-LoadMonBackPic: ; f6178 (3d:6178)
-; Assumes the monster's attributes have
-; been loaded with GetMonHeader.
- ld a, [wBattleMonSpecies2]
- ld [wcf91], a
- coord hl, 1, 5
- ld bc,$708
- call ClearScreenArea
- ld hl, wMonHBackSprite - wMonHeader
- call UncompressMonSprite
- predef ScaleSpriteByTwo
- ld de, vBackPic
- call InterlaceMergeSpriteBuffers ; combine the two buffers to a single 2bpp sprite
- ld hl, vSprites
- ld de, vBackPic
- ld c, (2*SPRITEBUFFERSIZE)/16 ; count of 16-byte chunks to be copied
- ld a, [H_LOADEDROMBANK]
- ld b, a
- jp CopyVideoData
-
-Func_f61a6: ; f61a6 (3d:f61a6)
- ld a, [wPredefRegisters]
- ld h, a
- ld a, [wPredefRegisters + 1]
- ld l, a
- ld a, [$ffe1]
- ld [H_DOWNARROWBLINKCNT1], a
- ld b, $4c
- ld a, [wIsInBattle]
- and a
- jr z, .asm_f61ef
- add b
- ld [hl], a
- call Delay3
- ld bc, -41
- add hl, bc
- ld a, $1
- ld [wNumMovesMinusOne], a
- ld bc, $303
- predef CopyDownscaledMonTiles
- ld c, $4
- call DelayFrames
- ld bc, -41
- add hl, bc
- xor a
- ld [wNumMovesMinusOne], a
- ld bc, $505
- predef CopyDownscaledMonTiles
- ld c, $5
- call DelayFrames
- ld bc, -41
- jr .asm_f61f2
-.asm_f61ef
- ld bc, -123
-.asm_f61f2
- add hl, bc
- ld a, [H_DOWNARROWBLINKCNT1]
- add $31
- jr CopyUncompressedPicToHL
-
-Func_f61f9: ; f61f9 (3d:61f9)
- ld a, [wPredefRegisters]
- ld h, a
- ld a, [wPredefRegisters + 1]
- ld l, a
- ld a, [$ffe1]
-CopyUncompressedPicToHL: ; f6203 (3d:6203)
- ld bc, $707
- ld de, $14
- push af
- ld a, [W_SPRITEFLIPPED]
- and a
- jr nz, .asm_f6220
- pop af
-.asm_f6211
- push bc
- push hl
-.asm_f6213
- ld [hl], a
- add hl, de
- inc a
- dec c
- jr nz, .asm_f6213
- pop hl
- inc hl
- pop bc
- dec b
- jr nz, .asm_f6211
- ret
-
-.asm_f6220
- push bc
- ld b, $0
- dec c
- add hl, bc
- pop bc
- pop af
-.asm_f6227
- push bc
- push hl
-.asm_f6229
- ld [hl], a
- add hl, de
- inc a
- dec c
- jr nz, .asm_f6229
- pop hl
- dec hl
- pop bc
- dec b
- jr nz, .asm_f6227
- ret
-
-INCLUDE "engine/battle/init_battle_variables.asm"
-INCLUDE "engine/battle/moveEffects/focus_energy_effect.asm"
-INCLUDE "engine/battle/moveEffects/heal_effect.asm"
-INCLUDE "engine/battle/moveEffects/transform_effect.asm"
-INCLUDE "engine/battle/moveEffects/reflect_light_screen_effect.asm"
-INCLUDE "engine/battle/moveEffects/mist_effect.asm"
-INCLUDE "engine/battle/moveEffects/one_hit_ko_effect.asm"
-INCLUDE "engine/battle/moveEffects/pay_day_effect.asm"
-INCLUDE "engine/battle/moveEffects/paralyze_effect.asm" \ No newline at end of file
diff --git a/engine/bank3d/link_menu.asm b/engine/bank3d/link_menu.asm
deleted file mode 100644
index a7b4ea9e..00000000
--- a/engine/bank3d/link_menu.asm
+++ /dev/null
@@ -1,910 +0,0 @@
-Func_f531b:: ; f531b (3d:531b)
- ld c,$14
- call DelayFrames
- ld a,$1
- ld [wBuffer],a
- xor a
- ld [wUnknownSerialFlag_d499],a
- coord hl, 0,0
- ld bc,$405
- call TextBoxBorder
- ld de,Text_f5791
- coord hl, 1,2
- call PlaceString
- coord hl, 8,0
- ld bc,$80a
- call TextBoxBorder
- coord hl, 10,2
- ld de,Text_f579c
- call PlaceString
- coord hl, 0,10
- ld bc,$612
- call TextBoxBorder
- call UpdateSprites
- xor a
- ld [wUnusedCD37],a
- ld [wd72d],a
- ld [wd11e],a
- ld hl,wTopMenuItemY
- ld a,$2
- ld [hli],a
- ld a,$9
- ld [hli],a
- xor a
- ld [hli],a
- inc hl
- ld a,$3
- ld [hli],a
- ld a,$3
- ld [hli],a
- xor a
- ld [hl],a
-.asm_f5377
- call Func_f56bd
- call HandleMenuInput
- and $3
- add a
- add a
- ld b,a
- ld a,[wCurrentMenuItem]
- cp $3
- jr nz,.asm_f5390
- bit 2,b
- jr z,.asm_f5390
- dec a
- ld b,$8
-.asm_f5390
- add b
- add $c0
- ld [wLinkMenuSelectionSendBuffer],a
- ld [wLinkMenuSelectionSendBuffer+1],a
-.asm_f5399
- ld hl,wLinkMenuSelectionSendBuffer
- ld a,[hl]
- ld [hSerialSendData],a
- call Serial_ExchangeByte
- push af
- ld hl,wLinkMenuSelectionSendBuffer
- ld a,[hl]
- ld [hSerialSendData],a
- call Serial_ExchangeByte
- pop bc
- cp b
- jr nz,.asm_f5399
- and $f0
- cp $c0
- jr nz,.asm_f5399
- ld a,b
- and $c
- jr nz,.asm_f53c4
- ld a,[wLinkMenuSelectionSendBuffer]
- and $c
- jr z,.asm_f5377
- jr .asm_f53df
-.asm_f53c4
- ld a,[wLinkMenuSelectionSendBuffer]
- and $c
- jr z,.asm_f53d1
- ld a,[hSerialConnectionStatus]
- cp $2
- jr z,.asm_f53df
-.asm_f53d1
- ld a,$1
- ld [wd11e],a
- ld a,b
- ld [wLinkMenuSelectionSendBuffer],a
- and $3
- ld [wCurrentMenuItem],a
-.asm_f53df
- call DelayFrame
- call DelayFrame
- ld hl,wLinkMenuSelectionSendBuffer
- ld a,[hl]
- ld [hSerialSendData],a
- call Serial_ExchangeByte
- call Serial_ExchangeByte
- ld b,$14
-.loop
- call DelayFrame
- call Serial_SendZeroByte
- dec b
- jr nz,.loop
- ld b,$7f
- ld c,$7f
- ld d,$7f
- ld e,$ec
- ld a,[wLinkMenuSelectionSendBuffer]
- bit 3,a
- jr nz,.asm_f541a
- ld b,e
- ld e,c
- ld a,[wCurrentMenuItem]
- and a
- jr z,.asm_f541a
- ld c,b
- ld b,d
- dec a
- jr z,.asm_f541a
- ld d,c
- ld c,b
-.asm_f541a
- ld a,b
- Coorda 9,2
- ld a,c
- Coorda 9,4
- ld a,d
- Coorda 9,6
- ld a,e
- Coorda 9,8
- ld c,40
- call DelayFrames
- ld a,[wLinkMenuSelectionSendBuffer]
- bit 3,a
- jr nz,asm_f547f
- ld a,[wCurrentMenuItem]
- cp $3
- jr z,asm_f547f
- inc a
- ld [wUnknownSerialFlag_d499],a
- ld a,[wCurrentMenuItem]
- ld hl,PointerTable_f5488
- ld c,a
- ld b,$0
- add hl,bc
- add hl,bc
- ld a,[hli]
- ld h,[hl]
- ld l,a
- ld de,.returnaddress
- push de
- jp hl
-.returnaddress
- ld [wLinkMenuSelectionSendBuffer],a
- xor a
- ld [wUnknownSerialCounter],a
- ld [wUnknownSerialCounter+1],a
- call Serial_SyncAndExchangeNybble
- ld a,[wLinkMenuSelectionSendBuffer]
- and a
- jr nz,asm_f547c
- ld a, [wLinkMenuSelectionReceiveBuffer]
- and a
- jr nz, Func_f5476
- xor a
- ld [wUnknownSerialCounter],a
- ld [wUnknownSerialCounter+1],a
- and a
- ret
-
-Func_f5476:: ; f5476 (3d:5476)
- ld hl,ColosseumIneligibleText
- call PrintText
-asm_f547c:: ; f547c (3d:574c)
- jp Func_f531b
-
-asm_f547f:: ; f547f (3d:547f)
- xor a
- ld [wUnknownSerialCounter],a
- ld [wUnknownSerialCounter+1],a
- scf
- ret
-
-PointerTable_f5488:: ; f5488 (3d:5488)
- dw PokeCup
- dw PikaCup
- dw PetitCup
-
-PokeCup:: ; f548e (3d:548e)
- ld hl,wPartyCount
- ld a,[hli]
- cp $3
- jp nz,NotThreeMonsInParty
- ld b,$3
-.loop
- ld a,[hli]
- cp MEW
- jp z,MewInParty
- dec b
- jr nz,.loop
- dec hl
- dec hl
- cp [hl] ; is third mon second mon?
- jp z,DuplicateSpecies
- dec hl ; wPartySpecies
- cp [hl] ; is third mon first mon?
- jp z,DuplicateSpecies
- ld a,[hli]
- cp [hl] ; is first mon second mon?
- jp z,DuplicateSpecies
- ld a,[wPartyMon1Level]
- cp 56
- jp nc,LevelAbove55
- cp 50
- jp c,LevelUnder50
- ld b,a
- ld a,[wPartyMon2Level]
- cp 56
- jp nc,LevelAbove55
- cp 50
- jp c,LevelUnder50
- ld c,a
- ld a,[wPartyMon3Level]
- cp 56
- jp nc,LevelAbove55
- cp 50
- jp c,LevelUnder50
- add b
- add c
- cp 156
- jp nc,CombinedLevelsGreaterThan155
- xor a
- ret
-
-PikaCup:: ; f54e4 (3d:54e4)
- ld hl,wPartyCount
- ld a,[hli]
- cp $3
- jp nz,NotThreeMonsInParty
- ld b,$3
-.loop
- ld a,[hli] ; wPartySpecies
- cp MEW
- jp z,MewInParty
- dec b
- jr nz,.loop
- dec hl
- dec hl
- cp [hl] ; is third mon second mon?
- jp z,DuplicateSpecies
- dec hl ; wPartySpecies
- cp [hl] ; is third mon first mon?
- jp z,DuplicateSpecies
- ld a,[hli]
- cp [hl] ; is first mon second mon?
- jp z,DuplicateSpecies
- ld a,[wPartyMon1Level]
- cp 21
- jp nc,LevelAbove20
- cp 15
- jp c,LevelUnder15
- ld b,a
- ld a,[wPartyMon2Level]
- cp 21
- jp nc,LevelAbove20
- cp 15
- jp c,LevelUnder15
- ld c,a
- ld a,[wPartyMon3Level]
- cp 21
- jp nc,LevelAbove20
- cp 15
- jp c,LevelUnder15
- add b
- add c
- cp 51
- jp nc,CombinedLevelsAbove50
- xor a
- ret
-
-PetitCup:: ; f553a (3d:553a)
- ld hl,wPartyCount
- ld a,[hli]
- cp $3
- jp nz,NotThreeMonsInParty
- ld b,$3
-.loop
- ld a,[hli]
- cp MEW
- jp z,MewInParty
- dec b
- jr nz,.loop
- dec hl
- dec hl
- cp [hl] ; is third mon second mon?
- jp z,DuplicateSpecies
- dec hl ; wPartySpecies
- cp [hl] ; is third mon first mon?
- jp z,DuplicateSpecies
- ld a,[hli]
- cp [hl] ; is first mon second mon?
- jp z,DuplicateSpecies
- dec hl
- ld a,[hl]
- ld [wcf91],a
- push hl
- callab Func_3b10f
- pop hl
- jp c,asm_f56ad
- inc hl
- ld a,[hl]
- ld [wcf91],a
- push hl
- callab Func_3b10f
- pop hl
- jp c,asm_f56ad
- inc hl
- ld a,[hl]
- ld [wcf91],a
- push hl
- callab Func_3b10f
- pop hl
- jp c,asm_f56ad
- dec hl
- dec hl
- ld b,$3
-.bigloop
- ld a,[hli]
- push hl
- push bc
- push af
- dec a
- ld c,a
- ld b,$0
- ld hl,PokedexEntryPointers
- add hl,bc
- add hl,bc
- ld de,wcd6d
- ld bc,$2
- ld a,BANK(PokedexEntryPointers)
- call FarCopyData
- ld hl,wcd6d
- ld a,[hli]
- ld h,[hl]
- ld l,a
- ld de,wcd6d
- ld bc,$14
- ld a,BANK(PokedexEntryPointers)
- call FarCopyData
- ld hl,wcd6d
-.loop2
- ld a,[hli]
- cp "@"
- jr nz,.loop2
- ld a,[hli]
- cp $7
- jp nc,asm_f5689
- add a
- add a
- ld b,a
- add a
- add b
- ld b,a
- ld a,[hli]
- add b
- cp $51
- jp nc,asm_f5689
- ld a,[hli]
- sub $b9
- ld a,[hl]
- sbc $1
- jp nc,asm_f569b
- pop af
- pop bc
- pop hl
- dec b
- jr nz,.bigloop
- ld a,[wPartyMon1Level]
- cp 31
- jp nc,LevelAbove30
- cp 25
- jp c,LevelUnder25
- ld b,a
- ld a,[wPartyMon2Level]
- cp 31
- jp nc,LevelAbove30
- cp 25
- jp c,LevelUnder25
- ld c,a
- ld a,[wPartyMon3Level]
- cp 31
- jp nc,LevelAbove30
- cp 25
- jp c,LevelUnder25
- add b
- add c
- cp 81
- jp nc,CombinedLevelsAbove80
- xor a
- ret
-
-NotThreeMonsInParty:: ; f561d (3d:516d)
- ld hl,Colosseum3MonsText
- call PrintText
- ld a,$1
- ret
-
-MewInParty:: ; f5626 (3d:f5626)
- ld hl,ColosseumMewText
- call PrintText
- ld a,$2
- ret
-
-DuplicateSpecies:: ; f562f (3d:f562f)
- ld hl,ColosseumDifferentMonsText
- call PrintText
- ld a,$3
- ret
-
-LevelAbove55:: ; f5638 (3d:5638)
- ld hl,ColosseumMaxL55Text
- call PrintText
- ld a,$4
- ret
-
-LevelUnder50:: ; f5641 (3d:5641)
- ld hl,ColosseumMinL50Text
- call PrintText
- ld a,$5
- ret
-
-CombinedLevelsGreaterThan155:: ; f5641 (3d:564a)
- ld hl,ColosseumTotalL155Text
- call PrintText
- ld a,$6
- ret
-
-LevelAbove30:: ; f5653 (3d:5653)
- ld hl,ColosseumMaxL30Text
- call PrintText
- ld a,$7
- ret
-
-LevelUnder25:: ; f565c (3d:565c)
- ld hl,ColosseumMinL25Text
- call PrintText
- ld a,$8
- ret
-
-CombinedLevelsAbove80:: ; f5665 (3d:5665)
- ld hl,ColosseumTotalL80Text
- call PrintText
- ld a,$9
- ret
-
-LevelAbove20:: ; f566e (3d:566e)
- ld hl,ColosseumMaxL20Text
- call PrintText
- ld a,$a
- ret
-
-LevelUnder15:: ; f5677 (3d:5677)
- ld hl,ColosseumMinL15Text
- call PrintText
- ld a,$b
- ret
-
-CombinedLevelsAbove50:: ; f5680 (3d:5680)
- ld hl,ColosseumTotalL50Text
- call PrintText
- ld a,$c
- ret
-
-asm_f5689:: ; f5689 (3d:5689)
- pop af
- pop bc
- pop hl
- ld [wd11e],a
- call GetMonName
- ld hl,ColosseumHeightText
- call PrintText
- ld a,$d
- ret
-
-asm_f569b:: ; f569b (3d:569b)
- pop af
- pop bc
- pop hl
- ld [wd11e],a
- call GetMonName
- ld hl,ColosseumWeightText
- call PrintText
- ld a,$e
- ret
-
-asm_f56ad:: ; f56ad (3d:56ad)
- ld a,[hl]
- ld [wd11e],a
- call GetMonName
- ld hl,ColosseumEvolvedText
- call PrintText
- ld a,$f
- ret
-
-Func_f56bd:: ; f56bd (3d:56bd)
- xor a
- ld [H_AUTOBGTRANSFERENABLED],a
- coord hl, 1,11
- ld bc,$612
- call ClearScreenArea
- ld a,[wCurrentMenuItem]
- cp $3
- jr nc,.asm_f56e6
- ld hl,PointerTable_f56ee
- ld a,[wCurrentMenuItem]
- ld c,a
- ld b,$0
- add hl,bc
- add hl,bc
- ld a,[hli]
- ld h,[hl]
- ld l,a
- ld d,h
- ld e,l
- coord hl, 1,12
- call PlaceString
-.asm_f56e6
- call Delay3
- ld a,$1
- ld [H_AUTOBGTRANSFERENABLED],a
- ret
-
-PointerTable_f56ee:: ; f56ee (3d:56ee)
- dw Text_f56f4
- dw Text_f5728
- dw Text_f575b
-
-Text_f56f4:: ; f56f4 (3d:56f4)
- db "LVs of 3<pkmn>:50-55"
- next "Sum of LVs:155 MAX"
- next "MEW can't attend.@"
-
-Text_f5728:: ; f5728 (3d:5728)
- db "LVs of 3<pkmn>:15-20"
- next "Sum of LVs:50 MAX"
- next "MEW can't attend.@"
-
-Text_f575b:: ; f575b (3d:575b)
- db "3 Basic <pkmn>.LV25-30"
- next "Sum of LVs:80 MAX"
- next "6′8″ and 44lb MAX@"
-
-Text_f5791:: ; f5791 (3d:5791)
- db "View"
- next "Rules@"
-
-Text_f579c:: ; f579c (3d:579c)
- db "# Cup"
- next "Pika Cup"
- next "Petit Cup"
- next "CANCEL@"
-
-Colosseum3MonsText:: ; f57bc (3d:57bc)
- TX_FAR _Colosseum3MonsText ; a0a2b
- db "@"
-
-ColosseumMewText:: ; f57c1 (3d:57c1)
- TX_FAR _ColosseumMewText ; a0a46
- db "@"
-
-ColosseumDifferentMonsText:: ; f57c6 (3d:57c6)
- TX_FAR _ColosseumDifferentMonsText ; a0a5f
- db "@"
-
-ColosseumMaxL55Text:: ; f57cb (3d:57cb)
- TX_FAR _ColosseumMaxL55Text ; a0a81
- db "@"
-
-ColosseumMinL50Text:: ; f57d0 (3d:57d0)
- TX_FAR _ColosseumMinL50Text ; a0a9a
- db "@"
-
-ColosseumTotalL155Text:: ; f57d5 (3d:57d5)
- TX_FAR _ColosseumTotalL155Text ; a0aba
- db "@"
-
-ColosseumMaxL30Text:: ; f57da (3d:57da)
- TX_FAR _ColosseumMaxL30Text ; a0ad9
- db "@"
-
-ColosseumMinL25Text:: ; f57df (3d:57df)
- TX_FAR _ColosseumMinL25Text ; a0af2
- db "@"
-
-ColosseumTotalL80Text:: ; f57e4 (3d:57e4)
- TX_FAR _ColosseumTotalL80Text ; a0b12
- db "@"
-
-ColosseumMaxL20Text:: ; f57e9 (3d:57e9)
- TX_FAR _ColosseumMaxL20Text ; a0b30
- db "@"
-
-ColosseumMinL15Text:: ; f57ee (3d:57ee)
- TX_FAR _ColosseumMinL15Text ; a0b49
- db "@"
-
-ColosseumTotalL50Text:: ; f57f3 (3d:57f3)
- TX_FAR _ColosseumTotalL50Text ; a0b69
- db "@"
-
-ColosseumHeightText:: ; f57f8 (3d:57f8)
- TX_FAR _ColosseumHeightText ; a0b87
- db "@"
-
-ColosseumWeightText:: ; f57fd (3d:57fd)
- TX_FAR _ColosseumWeightText ; a0b9f
- db "@"
-
-ColosseumEvolvedText:: ; f5802 (3d:5802)
- TX_FAR _ColosseumEvolvedText ; a0bbb
- db "@"
-
-ColosseumIneligibleText:: ; f5807 (3d:5807)
- TX_FAR _ColosseumIneligibleText ; a0bd4
- db "@"
-
-LinkMenu: ; f580c (3d:580c)
- xor a
- ld [wLetterPrintingDelayFlags], a
- ld hl, wd72e
- set 6, [hl]
- ld hl, TextTerminator_f5a16
- call PrintText
- call SaveScreenTilesToBuffer1
- ld hl, ColosseumWhereToText
- call PrintText
- coord hl, 5, 3
- ld bc, $80d
- call TextBoxBorder
- call UpdateSprites
- coord hl, 7, 5
- ld de, TradeCenterText
- call PlaceString
- xor a
- ld [wUnusedCD37], a
- ld [wd72d], a
- ld [wd11e], a
- ld hl, wTopMenuItemY
- ld a, $5
- ld [hli], a
- ld a, $6
- ld [hli], a
- xor a
- ld [hli], a
- inc hl
- ld a, $3
- ld [hli], a
- ld [hli], a
- xor a
- ld [hl], a
-.waitForInputLoop
- call HandleMenuInput
- and A_BUTTON | B_BUTTON
- add a
- add a
- ld b, a
- ld a, [wCurrentMenuItem]
- cp $3
- jr nz,.asm_f586b
- bit 2,b
- jr z,.asm_f586b
- dec a
- ld b,$8
-.asm_f586b
- add b
- add $d0
- ld [wLinkMenuSelectionSendBuffer], a
- ld [wLinkMenuSelectionSendBuffer + 1], a
-.exchangeMenuSelectionLoop
- call Serial_ExchangeLinkMenuSelection
- ld a, [wLinkMenuSelectionReceiveBuffer]
- ld b, a
- and $f0
- cp $d0
- jr z, .asm_5c7d
- ld a, [wLinkMenuSelectionReceiveBuffer + 1]
- ld b, a
- and $f0
- cp $d0
- jr nz, .exchangeMenuSelectionLoop
-.asm_5c7d
- ld a, b
- and $c ; did the enemy press A or B?
- jr nz, .enemyPressedAOrB
-; the enemy didn't press A or B
- ld a, [wLinkMenuSelectionSendBuffer]
- and $c ; did the player press A or B?
- jr z, .waitForInputLoop ; if neither the player nor the enemy pressed A or B, try again
- jr .doneChoosingMenuSelection ; if the player pressed A or B but the enemy didn't, use the player's selection
-.enemyPressedAOrB
- ld a, [wLinkMenuSelectionSendBuffer]
- and $c ; did the player press A or B?
- jr z, .useEnemyMenuSelection ; if the enemy pressed A or B but the player didn't, use the enemy's selection
-; the enemy and the player both pressed A or B
-; The gameboy that is clocking the connection wins.
- ld a, [hSerialConnectionStatus]
- cp USING_INTERNAL_CLOCK
- jr z, .doneChoosingMenuSelection
-.useEnemyMenuSelection
- ld a, $1
- ld [wd11e], a
- ld a, b
- ld [wLinkMenuSelectionSendBuffer], a
- and $3
- ld [wCurrentMenuItem], a ; wCurrentMenuItem
-.doneChoosingMenuSelection
- ld a, [hSerialConnectionStatus]
- cp USING_INTERNAL_CLOCK
- jr nz, .skipStartingTransfer
- call DelayFrame
- call DelayFrame
- ld a, START_TRANSFER_INTERNAL_CLOCK
- ld [rSC], a
-.skipStartingTransfer
- ld b, $7f
- ld c, $7f
- ld d, $7f
- ld e, $ec
- ld a, [wLinkMenuSelectionSendBuffer]
- and (B_BUTTON << 2) ; was B button pressed?
- jr nz, .updateCursorPosition
-; A button was pressed
- ld a, [wCurrentMenuItem]
- cp $2
- jp z, .asm_f5963
- ld b, e
- ld e, c
- ld a, [wCurrentMenuItem]
- and a
- jr z, .updateCursorPosition
- ld c, b
- ld b, d
- dec a
- jr z, .updateCursorPosition
- ld d, c
- ld c, b
-.updateCursorPosition
- call Func_f59ec
- call LoadScreenTilesFromBuffer1
- ld a, [wLinkMenuSelectionSendBuffer]
- and (B_BUTTON << 2) ; was B button pressed?
- jr nz, .choseCancel ; cancel if B pressed
- ld a, [wCurrentMenuItem]
- cp $2
- jr z, .choseCancel
- xor a
- ld [wWalkBikeSurfState], a ; start walking
- ld a, [wCurrentMenuItem]
- and a
- ld a, COLOSSEUM
- jr nz, .next
- ld a, TRADE_CENTER
-.next
- ld [wd72d], a
- ld hl, ColosseumPleaseWaitText
- call PrintText
- ld c, $32
- call DelayFrames
- ld hl, wd732
- res 1, [hl]
- ld a, [wAnimationID]
- ld [wDestinationMap], a
- callab SpecialWarpIn
- ld c, $14
- call DelayFrames
- xor a
- ld [wMenuJoypadPollCount], a
- ld [wSerialExchangeNybbleSendData], a
- inc a ; LINK_STATE_IN_CABLE_CLUB
- ld [wLinkState], a
- ld [wEnteringCableClub], a
- jpab SpecialEnterMap
-.choseCancel
- xor a
- ld [wMenuJoypadPollCount], a
- call Delay3
- callab CloseLinkConnection
- ld hl, ColosseumCanceledText
- call PrintText
- ld hl, wd72e
- res 6, [hl]
- ret
-
-.asm_f5963
- ld a,[wd11e]
- and a
- jr nz,.asm_f5974
- ld b,$7f
- ld c,$7f
- ld d,$ec
- ld e,$7f
- call Func_f59ec
-.asm_f5974
- xor a
- ld [wBuffer], a
- ld a,$ff
- ld [wSerialExchangeNybbleReceiveData],a
- ld a, $b
- ld [wLinkMenuSelectionSendBuffer], a
- ld b,$78
-.loop
- ld a,[hSerialConnectionStatus]
- cp $2
- call z,DelayFrame
- dec b
- jr z,.asm_f59b2
- call Serial_ExchangeNybble
- call DelayFrame
- ld a,[wSerialExchangeNybbleReceiveData]
- inc a
- jr z,.loop
- ld b,$f
-.loop2
- call DelayFrame
- call Serial_ExchangeNybble
- dec b
- jr nz,.loop2
- ld b,$f
-.loop3
- call DelayFrame
- call Serial_SendZeroByte
- dec b
- jr nz,.loop3
- jr .asm_f59d6
-
-.asm_f59b2
- xor a
- ld [wUnknownSerialCounter],a
- ld [wUnknownSerialCounter+1],a
- ld a,[wd11e]
- and a
- jr z,.asm_f59cd
- ld b,$7f
- ld c,$7f
- ld d,$7f
- ld e,$ec
- call Func_f59ec
- jp .choseCancel
-
-.asm_f59cd
- ld hl,ColosseumVersionText
- call PrintText
- jp .choseCancel
-
-.asm_f59d6
- ld b,$7f
- ld c,$7f
- ld d,$ec
- ld e,$7f
- call Func_f59ec
- call Func_f531b
- jp c,.choseCancel
- ld a,$f0
- jp .next
-
-Func_f59ec:: ; f59ec (3d:59ec)
- ld a, b
- Coorda 6, 5
- ld a, c
- Coorda 6, 7
- ld a, d
- Coorda 6, 9
- ld a, e
- Coorda 6, 11
- ld c, 40
- call DelayFrames
- ret
-
-ColosseumWhereToText: ; f5a02 (3d:5a02)
- TX_FAR _ColosseumWhereToText
- db "@"
-
-ColosseumPleaseWaitText: ; f5a07 (3d:5a07)
- TX_FAR _ColosseumPleaseWaitText
- db "@"
-
-ColosseumCanceledText: ; f5a0c (3d:5a0c)
- TX_FAR _ColosseumCanceledText
- db "@"
-
-ColosseumVersionText: ; f5a11 (3d:5a11)
- TX_FAR _ColosseumVersionText ; 28:4c47
- db "@"
-
-TextTerminator_f5a16: ; f5a16 (3d:5a16)
- db "@"
-
-TradeCenterText: ; f5a17 (3d:5a17)
- db "TRADE CENTER"
- next "COLOSSEUM"
- next "COLOSSEUM2"
- next "CANCEL@" \ No newline at end of file
diff --git a/engine/bank3d/main.asm b/engine/bank3d/main.asm
deleted file mode 100644
index cc78a114..00000000
--- a/engine/bank3d/main.asm
+++ /dev/null
@@ -1,693 +0,0 @@
-INCLUDE "engine/battle/common_text.asm"
-INCLUDE "engine/battle/link_battle_versus_text.asm"
-INCLUDE "engine/battle/unused_stats_functions.asm"
-INCLUDE "engine/battle/scroll_draw_trainer_pic.asm"
-
-Func_f429f:: ; f429f (3d:429f)
- coord hl, 0,5
- ld c,$0
-.asm_f42a4
- inc c
- ld a,c
- cp $9
- ret z
- ld d,$5b
- push bc
- push hl
-.asm_f42ad
- call Func_f42c2
- dec hl
- ld a,d
- sub $7
- ld d,a
- dec c
- jr nz,.asm_f42ad
- ld c,$2
- call DelayFrames
- pop hl
- pop bc
- inc hl
- jr .asm_f42a4
-
-Func_f42c2:: ; f42c2 (3d:f42c2)
- push hl
- push de
- push bc
- ld e,$7
-.loop
- ld a,d
- cp $31
- jr nc,.asm_f42ce
- ld a,$7f
-.asm_f42ce
- ld [hl],a
- ld bc,$14
- add hl,bc
- inc d
- dec e
- jr nz,.loop
- pop bc
- pop de
- pop hl
- ret
-
-INCLUDE "engine/battle/decrement_pp.asm"
-
-ModifyPikachuHappiness:: ; f430a (3d:430a)
- ld a, d
- cp PIKAHAPPY_GYMLEADER
- jr z, .checkanywhereinparty
- cp PIKAHAPPY_WALKING
- jr z, .checkanywhereinparty
- push de
- callab IsThisPartymonStarterPikachu_Party
- pop de
- ret nc
- jr .proceed
-
-.checkanywhereinparty
- push de
- callab IsStarterPikachuInOurParty
- pop de
- ret nc
-
-.proceed
- push de
- ; Divide [wPikachuHappiness] by 100. Hold the integer part in e.
- ld e, $0
- ld a, [wPikachuHappiness]
- cp 100
- jr c, .wPikachuHappiness_div_100
- inc e
- cp 200
- jr c, .wPikachuHappiness_div_100
- inc e
-.wPikachuHappiness_div_100
- ; Get the (d, e) entry from .HappinessChangeTable.
- ld c, d
- dec c
- ld b, $0
- ld hl, .HappinessChangeTable
- add hl, bc
- add hl, bc
- add hl, bc
- ld d, $0
- add hl, de
- ld a, [hl]
- ; If [hl] is positive, take min(0xff, [hl] + [wPikachuHappiness]).
- ; If [hl] is negative, take max(0x00, [hl] + [wPikachuHappiness]).
- ; Inexplicably, we're using 100 as the threshold for comparison.
- cp 100
- ld a, [wPikachuHappiness]
- jr nc, .negative
- add [hl]
- jr nc, .okay
- ld a, -1
- jr .okay
-
-.negative
- add [hl]
- jr c, .okay
- xor a
-.okay
- ld [wPikachuHappiness], a
-
- ; Restore d and get the d'th entry in .Moods.
- pop de
- dec d
- ld hl, .Moods
- ld e, d
- ld d, $0
- add hl, de
- ld a, [hl]
- ld b, a
- ; Modify Pikachu's mood
- cp $80
- jr z, .done
- ld a, [wPikachuMood]
- jr c, .decreased
- cp b
- jr nc, .done
- ld a, [wd49c]
- and a
- jr nz, .done
- jr .update_mood
-
-.decreased
- cp b
- jr c, .done
-.update_mood
- ld a, b
- ld [wPikachuMood], a
-.done
- ret
-
-.HappinessChangeTable: ; f4385 (3d:4385)
- ; Increase
- db 5, 3, 2 ; Gained a level
- db 5, 3, 2 ; HP restore
- db 1, 1, 0 ; Used X item
- db 3, 2, 1 ; Challenged Gym Leader
- db 1, 1, 0 ; Teach TM/HM
- db 2, 1, 1 ; Walking around
- ; Decrease
- db -3, -3, -5 ; Deposited
- db -1, -1, -1 ; Fainted in battle
- db -5, -5, -10 ; Fainted due to Poison outside of battle
- db -5, -5, -10 ; Unknown (d = 10)
- db -10, -10, -20 ; Unknown (d = 11)
-
-.Moods: ; f43a6 (3d:43a6)
- ; Increase
- db $8a ; Gained a level
- db $83 ; HP restore
- db $80 ; Teach TM/HM
- db $80 ; Challenged Gym Leader
- db $94 ; Unknown (d = 5)
- db $80 ; Unknown (d = 6)
- ; Decrease
- db $62 ; Deposited
- db $6c ; Fainted
- db $62 ; Unknown (d = 9)
- db $6c ; Unknown (d = 10)
- db $00 ; Unknown (d = 11)
-
-; f43b1 (3d:43b1)
-RedPicBack:: INCBIN "pic/trainer/redb.pic"
-OldManPic:: INCBIN "pic/trainer/oldman.pic"
-OakPicBack:: INCBIN "pic/ytrainer/prof.oakb.pic"
-
-;SECTION "bank3d Yellow Intro",ROMX[$453f],BANK[$3D]
-
-Func_f453f:: ; f453f (3d:453f)
- ld hl,PokemonLogoGraphics
- ld de,vChars2
- ld bc,$730
- ld a,BANK(PokemonLogoGraphics) ; redundant because this function is in bank3d
- call FarCopyData
- ld hl,YellowLogoGraphics+$230
- ld de,vChars0+$fd0
- ld bc,$30
- ld a,BANK(YellowLogoGraphics)
- call FarCopyData
- ld hl,YellowLogoGraphics+$260
- ld de,vChars1
- ld bc,$400
- ld a,BANK(YellowLogoGraphics)
- call FarCopyData
- ld hl,YellowLogoGraphics+$660
- ld de,vChars0+$f00
- ld bc,$c0
- ld a,BANK(YellowLogoGraphics)
- call FarCopyData
- ret
-
-Func_f4578:: ; f4578 (3d:4578)
- coord hl, 2,1
- ld de,Pointer_f45f9
- ld bc,7 << 8 | 16 ; 16x7 (xy)
- call CopyScreenArea
- ret
-
-Func_f4585:: ; f4585 (3d:4585)
- coord hl, 6,4
- ld de,Pointer_f4673
- ld bc,4 << 8 | 7 ; 7x4 (xy)
- call CopyScreenArea
- coord hl, 9,8
- ld [hl],$64
- inc hl
- ld [hl],$65
- ret
-
-Func_f459a:: ; f459a (3d:459a)
- coord hl, 4,8
- ld de,Pointer_f468f
- ld bc,9 << 8 | 12 ; 12x9 (xy)
- call CopyScreenArea
- coord hl, 16,10
- ld [hl],$96
- coord hl, 16,11
- ld [hl],$9d
- coord hl, 16,12
- ld [hl],$a7
- coord hl, 16,13
- ld [hl],$b1
- ld hl,Pointer_f45c7
- ld de,wOAMBuffer
- ld bc,$20
- call CopyData
- ret
-
-Pointer_f45c7: ; f45c7 (3d:45c7)
- db $60,$40,$f1,$22
- db $60,$48,$f0,$22
- db $68,$40,$f3,$22
- db $68,$48,$f2,$22
- db $60,$60,$f0,$02
- db $60,$68,$f1,$02
- db $68,$60,$f2,$02
- db $68,$68,$f3,$02
-
-CopyScreenArea:: ; f45e7 (3d:45e7)
-; copy cxb (xy) screen area from de to hl
- push bc
- push hl
-.loop
- ld a,[de]
- inc de
- ld [hli],a
- dec c
- jr nz,.loop
- pop hl
- ld bc,$14
- add hl,bc
- pop bc
- dec b
- jr nz,CopyScreenArea
- ret
-
-Pointer_f45f9: ; f45f9 (3d:45f9)
-; 16x7 (xy)
- db $f4,$f4,$f4,$f4,$f4,$f4,$49,$f4,$72,$30,$f4,$f4,$f4,$f4,$f4,$f4
- db $fd,$01,$02,$03,$04,$05,$06,$07,$08,$09,$0a,$0b,$f4,$0d,$0e,$0f
- db $10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$1a,$1b,$1c,$1d,$1e,$1f
- db $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2a,$2b,$2c,$2d,$2e,$2f
- db $f4,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3a,$3b,$3c,$3d,$3e,$3f
- db $f4,$41,$42,$43,$44,$45,$46,$47,$48,$f4,$4a,$4b,$4c,$4d,$4e,$4f
- db $f4,$6a,$6b,$6c,$6d,$f4,$f4,$f4,$f4,$f4,$f4,$6e,$6f,$70,$71,$f4
-
-Pointer_f4669:: ; f4669 (3d:4669)
- db $47,$48,$49,$4a,$4b,$4c,$4d,$4e,$4f,$5f
-
-Pointer_f4673:: ; f4673 (3d:4673)
-; 7x4 (xy)
- db $24,$25,$66,$67,$68,$69,$2a
- db $50,$51,$52,$53,$54,$55,$56
- db $57,$58,$59,$5a,$5b,$5c,$5d
- db $6d,$5e,$5f,$60,$61,$62,$63
-
-Pointer_f468f:: ; f468f (3d:468f)
-; 12x9 (xy)
- db $80,$81,$82,$83,$00,$00,$00,$00,$84,$85,$86,$87
- db $88,$89,$8a,$8b,$8c,$8d,$8d,$8e,$8f,$8a,$90,$91
- db $00,$92,$93,$8a,$8a,$8a,$8a,$8a,$8a,$94,$95,$00
- db $00,$00,$97,$8a,$8a,$98,$99,$8a,$8a,$9a,$9b,$9c
- db $00,$00,$9e,$9f,$a0,$a1,$a2,$a3,$a4,$a5,$a6,$8a
- db $00,$a8,$a9,$aa,$8a,$ab,$ac,$8a,$ad,$ae,$af,$b0
- db $00,$b2,$b3,$b4,$8a,$8a,$8a,$8a,$b5,$b6,$b7,$b8
- db $00,$b9,$ba,$8a,$8a,$8a,$8a,$8a,$8a,$bb,$bc,$00
- db $00,$00,$bd,$8a,$8a,$8a,$8a,$8a,$8a,$be,$bf,$00
-
-; f46f9 (3d:46f9)
-PokemonLogoGraphics: INCBIN "gfx/pokemon_logo.2bpp"
-YellowLogoGraphics: INCBIN "gfx/yellow_titlescreen.2bpp"
-
-INCLUDE "engine/bank3d/link_menu.asm"
-
-HandleMenuInputDouble:: ; f5a40 (3d:5a40)
- xor a
- ld [wPartyMenuAnimMonEnabled],a
-
-HandleMenuInputPokemonSelectionDouble:: ; f5a44 (3d:5a44)
- ld a,[H_DOWNARROWBLINKCNT1]
- push af
- ld a,[H_DOWNARROWBLINKCNT2]
- push af ; save existing values on stack
- xor a
- ld [H_DOWNARROWBLINKCNT1],a ; blinking down arrow timing value 1
- ld a,$06
- ld [H_DOWNARROWBLINKCNT2],a ; blinking down arrow timing value 2
-.loop1
- xor a
- ld [wAnimCounter],a ; counter for pokemon shaking animation
- call Func_f5ab0
- call JoypadLowSensitivity
- ld a,[hJoy5]
- and a ; was a key pressed?
- jr nz,.keyPressed
- pop af
- ld [H_DOWNARROWBLINKCNT2],a
- pop af
- ld [H_DOWNARROWBLINKCNT1],a ; restore previous values
- xor a
- ld [wMenuWrappingEnabled],a ; disable menu wrapping
- ret
-.keyPressed
- xor a
- ld [wCheckFor180DegreeTurn],a
- ld a,[hJoy5]
- ld b,a
- bit 6,a ; pressed Up key?
- jr z,.checkIfDownPressed
-.upPressed
- ld a,[wCurrentMenuItem] ; selected menu item
- and a ; already at the top of the menu?
- jr z,.checkOtherKeys
-.notAtTop
- dec a
- ld [wCurrentMenuItem],a ; move selected menu item up one space
- jr .checkOtherKeys
-.checkIfDownPressed
- bit 7,a
- jr z,.checkOtherKeys
-.downPressed
- ld a,[wCurrentMenuItem]
- inc a
- ld c,a
- ld a,[wMaxMenuItem]
- cp c
- jr c,.checkOtherKeys
- ld a,c
- ld [wCurrentMenuItem],a
-.checkOtherKeys
- ld a,[wMenuWatchedKeys]
- and b ; does the menu care about any of the pressed keys?
- jp z,.loop1
-.checkIfAButtonOrBButtonPressed
- ld a,[hJoy5]
- and A_BUTTON | B_BUTTON
- jr z,.skipPlayingSound
-.AButtonOrBButtonPressed
- ld a, $90 ; (SFX_02_40 - SFX_Headers_02) / 3
- call PlaySound ; play sound
-.skipPlayingSound
- pop af
- ld [H_DOWNARROWBLINKCNT2],a
- pop af
- ld [H_DOWNARROWBLINKCNT1],a ; restore previous values
- ld a,[hJoy5]
- ret
-
-Func_f5ab0:: ; f5ab0 (3d:5ab0)
- ld a,[wTopMenuItemY]
- and a
- jr z,.asm_f5ac0
- coord hl, 0,0
- ld bc,$14
-.loop
- add hl,bc
- dec a
- jr nz,.loop
-.asm_f5ac0
- ld a,[wTopMenuItemX]
- ld b,$0
- ld c,a
- add hl,bc
- push hl
- ld a,[wLastMenuItem]
- and a
- jr z,.asm_f5ad5
- ld bc,$28
-.loop2
- add hl,bc
- dec a
- jr nz,.loop2
-.asm_f5ad5
- ld a,[hl]
- cp "▶"
- jr nz,.asm_f5ade
- ld a,[wTileBehindCursor]
- ld [hl],a
-.asm_f5ade
- pop hl
- ld a,[wCurrentMenuItem]
- and a
- jr z,.asm_f5aec
- ld bc,$28
-.loop3
- add hl,bc
- dec a
- jr nz,.loop3
-.asm_f5aec
- ld a,[hl]
- cp "▶"
- jr z,.asm_f5af4
- ld [wTileBehindCursor],a
-.asm_f5af4
- ld a,"▶"
- ld [hl],a
- ld a,l
- ld [wMenuCursorLocation],a
- ld a,h
- ld [wMenuCursorLocation+1],a
- ld a,[wCurrentMenuItem]
- ld [wLastMenuItem],a
- ret
-
-Func_f5b06:: ; f5b06 (3d:5b06)
- ld hl,wd728
- set 0,[hl]
- ld hl,Text_f5b17
- call PrintText
- ld hl,Text_f5b28
- jp PrintText
-
-Text_f5b17:: ; f5b17 (3d:5b17)
- TX_FAR _UsedStrengthText ; 2d:417e
- db $08 ; asm
- ld a,[wcf91]
- call PlayCry
- call Delay3
- jp TextScriptEnd
-
-Text_f5b28:: ; f5b28 (3d:5b28)
- TX_FAR _CanMoveBouldersText ; 2d:4193
- db "@"
-
-CheckForForcedBikeSurf:: ; f5b2d (3d:5b2d)
- ld hl,wd728
- set 1,[hl]
- ld a,[wd732]
- bit 5,a
- jr nz,.asm_f5b59
- ld a,[wCurMap]
- cp SEAFOAM_ISLANDS_5
- ret nz
- CheckBothEventsSet EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE
- ret z
- ld hl,CoordsData_f5b64
- call ArePlayerCoordsInArray
- ret nc
- ld hl,wd728
- res 1,[hl]
- ld hl,CurrentTooFastText
- jp PrintText
-.asm_f5b59
- ld hl,wd728
- res 1,[hl]
- ld hl,CyclingIsFunText
- jp PrintText
-
-CoordsData_f5b64:: ; f5b64 (3d:5b64)
- db 11,07
- db $ff
-
-CurrentTooFastText:: ; f5b67 (3d:5b67)
- TX_FAR _CurrentTooFastText ; 2d:41ab
- db "@"
-
-CyclingIsFunText:: ; f5b6c (3d:5b6c)
- TX_FAR _CyclingIsFunText ; 2d:41ca
- db "@"
-
-AddItemToInventory_:: ; f5b70 (3d:5b70)
- ld a,[wItemQuantity] ; a = item quantity
- push af
- push bc
- push de
- push hl
- push hl
- ld d,50 ; PC box can hold 50 items
- ld a,wNumBagItems & $FF
- cp l
- jr nz,.checkIfInventoryFull
- ld a,wNumBagItems >> 8
- cp h
- jr nz,.checkIfInventoryFull
-; if the destination is the bag
- ld d,20 ; bag can hold 20 items
-.checkIfInventoryFull
- ld a,[hl]
- sub d
- ld d,a
- ld a,[hli]
- and a
- jr z,.addNewItem
-.notAtEndOfInventory
- ld a,[hli]
- ld b,a ; b = ID of current item in table
- ld a,[wcf91] ; a = ID of item being added
- cp b ; does the current item in the table match the item being added?
- jp z,.increaseItemQuantity ; if so, increase the item's quantity
- inc hl
-.loop
- ld a,[hl]
- cp a,$ff ; is it the end of the table?
- jr nz, .notAtEndOfInventory
-.addNewItem ; add an item not yet in the inventory
- pop hl
- ld a,d
- and a ; is there room for a new item slot?
- jr z,.done
-; if there is room
- inc [hl] ; increment the number of items in the inventory
- ld a,[hl] ; the number of items will be the index of the new item
- add a
- dec a
- ld c,a
- ld b,0
- add hl,bc ; hl = address to store the item
- ld a,[wcf91]
- ld [hli],a ; store item ID
- ld a,[wItemQuantity]
- ld [hli],a ; store item quantity
- ld [hl],$ff ; store terminator
- jp .success
-.increaseItemQuantity ; increase the quantity of an item already in the inventory
- ld a,[wItemQuantity]
- ld b,a ; b = quantity to add
- ld a,[hl] ; a = existing item quantity
- add b ; a = new item quantity
- cp a,100
- jp c,.storeNewQuantity ; if the new quantity is less than 100, store it
-; if the new quantity is greater than or equal to 100,
-; try to max out the current slot and add the rest in a new slot
- sub a,99
- ld [wItemQuantity],a ; a = amount left over (to put in the new slot)
- ld a,d
- and a ; is there room for a new item slot?
- jr z,.increaseItemQuantityFailed
-; if so, store 99 in the current slot and store the rest in a new slot
- ld a,99
- ld [hli],a
- jp .loop
-.increaseItemQuantityFailed
- pop hl
- and a
- jr .done
-.storeNewQuantity
- ld [hl],a
- pop hl
-.success
- scf
-.done
- pop hl
- pop de
- pop bc
- pop bc
- ld a,b
- ld [wItemQuantity],a ; restore the initial value from when the function was called
- ret
-
-; function to remove an item (in varying quantities) from the player's bag or PC box
-; INPUT:
-; hl = address of inventory (either wNumBagItems or wNumBoxItems)
-; [wWhichPokemon] = index (within the inventory) of the item to remove
-; [wItemQuantity] = quantity to remove
-RemoveItemFromInventory_: ; f5be1 (3d:5be1)
- push hl
- inc hl
- ld a,[wWhichPokemon] ; index (within the inventory) of the item being removed
- add a
- add l
- ld l,a
- jr nc,.noCarry
- inc h
-.noCarry
- inc hl
- ld a,[wItemQuantity] ; quantity being removed
- ld e,a
- ld a,[hl] ; a = current quantity
- sub e
- ld [hld],a ; store new quantity
- ld [wMaxItemQuantity],a
- and a
- jr nz,.skipMovingUpSlots
-; if the remaining quantity is 0,
-; remove the emptied item slot and move up all the following item slots
-.moveSlotsUp
- ld e,l
- ld d,h
- inc de
- inc de ; de = address of the slot following the emptied one
-.loop ; loop to move up the following slots
- ld a,[de]
- inc de
- ld [hli],a
- cp a,$ff
- jr nz,.loop
-; update menu info
- xor a
- ld [wListScrollOffset],a
- ld [wCurrentMenuItem],a
- ld [wBagSavedMenuItem],a
- ld [wSavedListScrollOffset],a
- pop hl
- ld a,[hl] ; a = number of items in inventory
- dec a ; decrement the number of items
- ld [hl],a ; store new number of items
- ld [wListCount],a
- cp a,2
- jr c,.done
- ld [wMaxMenuItem],a
- jr .done
-.skipMovingUpSlots
- pop hl
-.done
- ret
-
-TrainerInfoTextBoxTileGraphics: INCBIN "gfx/trainer_info.2bpp"
-TrainerInfoTextBoxTileGraphicsEnd:
-BlankLeaderNames: INCBIN "gfx/blank_leader_names.2bpp"
-CircleTile: INCBIN "gfx/circle_tile.2bpp"
-BadgeNumbersTileGraphics: INCBIN "gfx/badge_numbers.2bpp"
-
-ReadSuperRodData:: ; f5ea4 (3d:5ea4)
- ld a,[wCurMap]
- ld c,a
- ld hl,FishingSlots
-.loop
- ld a,[hli]
- cp $ff
- jr z,.notfound
- cp c
- jr z,.found
- ld de,$8
- add hl,de
- jr .loop
-.found
- call GenerateRandomFishingEncounter
- ret
-.notfound
- ld de,$0
- ret
-
-GenerateRandomFishingEncounter: ; f5ec1 (3d:5ec1)
- call Random
- cp $66
- jr c,.asm_f5ed6
- inc hl
- inc hl
- cp $b2
- jr c,.asm_f5ed6
- inc hl
- inc hl
- cp $e5
- jr c,.asm_f5ed6
- inc hl
- inc hl
-.asm_f5ed6
- ld e,[hl]
- inc hl
- ld d,[hl]
- ret
-
-INCLUDE "data/super_rod.asm"
-INCLUDE "engine/bank3d/bank3d_battle.asm"
-INCLUDE "engine/items/tm_prices.asm"
-INCLUDE "engine/multiply_divide.asm"
-INCLUDE "engine/give_pokemon.asm"
-INCLUDE "engine/battle/get_trainer_name.asm"
-INCLUDE "engine/bank3d/random.asm"
-INCLUDE "engine/predefs.asm" \ No newline at end of file
diff --git a/engine/bank3d/random.asm b/engine/bank3d/random.asm
deleted file mode 100644
index ddf042df..00000000
--- a/engine/bank3d/random.asm
+++ /dev/null
@@ -1,13 +0,0 @@
-Random_:: ; f67dc (3d:67dc)
-; Generate a random 16-bit value.
- ld a, [rDIV]
- ld b, a
- ld a, [hRandomAdd]
- adc b
- ld [hRandomAdd], a
- ld a, [rDIV]
- ld b, a
- ld a, [hRandomSub]
- sbc b
- ld [hRandomSub], a
- ret