Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace hardcoded banks & addresses in non-mobile code #460

Merged
merged 15 commits into from
Jan 22, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions engine/battle/battle_transition.asm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Predef_StartBattle: ; 8c20f
.done
ld a, [rSVBK]
push af
ld a, $5
ld a, BANK(wBGPals1)
ld [rSVBK], a

ld hl, wBGPals1
Expand All @@ -44,7 +44,7 @@ Predef_StartBattle: ; 8c20f
ld [hLYOverrideEnd], a
ld [hSCY], a

ld a, $1
ld a, 1 ; unnecessary bankswitch?
ld [rSVBK], a
pop af
ld [hVBlank], a
Expand Down Expand Up @@ -116,7 +116,7 @@ LoadTrainerBattlePokeballTiles:
ConvertTrainerBattlePokeballTilesTo2bpp: ; 8c2cf
ld a, [rSVBK]
push af
ld a, $6
ld a, BANK(wDecompressScratch)
ld [rSVBK], a
push hl
ld hl, wDecompressScratch
Expand Down Expand Up @@ -647,7 +647,7 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc)
.daytime
ld a, [rSVBK]
push af
ld a, $5 ; WRAM5 = palettes
ld a, BANK(wBGPals1)
ld [rSVBK], a
call .copypals
push hl
Expand Down Expand Up @@ -729,7 +729,7 @@ PokeBallTransition:
WipeLYOverrides: ; 8c6d8
ld a, [rSVBK]
push af
ld a, $5
ld a, BANK(LYOverrides)
ld [rSVBK], a

ld hl, LYOverrides
Expand Down
4 changes: 2 additions & 2 deletions engine/battle/core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -9320,7 +9320,7 @@ InitBattleDisplay: ; 3fb6c
.BlankBGMap: ; 3fbd6
ld a, [rSVBK]
push af
ld a, $6
ld a, BANK(wDecompressScratch)
ld [rSVBK], a

ld hl, wDecompressScratch
Expand Down Expand Up @@ -9381,7 +9381,7 @@ GetTrainerBackpic: ; 3fbff
CopyBackpic: ; 3fc30
ld a, [rSVBK]
push af
ld a, $6
ld a, BANK(wDecompressScratch)
ld [rSVBK], a
ld hl, vTiles0
ld de, vTiles2 tile $31
Expand Down
2 changes: 1 addition & 1 deletion engine/battle/sliding_intro.asm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
BattleIntroSlidingPics: ; 4e980
ld a, [rSVBK]
push af
ld a, $5
ld a, BANK(LYOverrides)
ld [rSVBK], a
call .subfunction1
ld a, rSCX - $ff00
Expand Down
30 changes: 15 additions & 15 deletions engine/battle_anims/anim_commands.asm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PlayBattleAnim: ; cc0d6
ld a, [rSVBK]
push af

ld a, 5
ld a, BANK(ActiveAnimObjects)
ld [rSVBK], a

call _PlayBattleAnim
Expand Down Expand Up @@ -163,7 +163,7 @@ BattleAnimRestoreHuds: ; cc1bb

ld a, [rSVBK]
push af
ld a, $1
ld a, BANK(CurBattleMon) ; alternatively: BANK(TempMon), BANK(PartyMon1), several others
ld [rSVBK], a

ld hl, UpdateBattleHuds
Expand Down Expand Up @@ -917,7 +917,7 @@ BattleAnimCmd_E7: ; cc5db (33:45db)
BattleAnimCmd_Transform: ; cc5dc (33:45dc)
ld a, [rSVBK]
push af
ld a, 1
ld a, BANK(CurPartySpecies)
ld [rSVBK], a
ld a, [CurPartySpecies] ; CurPartySpecies
push af
Expand Down Expand Up @@ -973,7 +973,7 @@ BattleAnimCmd_RaiseSub: ; cc640 (33:4640)

ld a, [rSVBK]
push af
ld a, 1
ld a, 1 ; unnecessary bankswitch?
ld [rSVBK], a
xor a
call GetSRAMBank
Expand Down Expand Up @@ -1047,7 +1047,7 @@ GetSubstitutePic: ; cc64c
BattleAnimCmd_MinimizeOpp: ; cc6cf (33:46cf)
ld a, [rSVBK]
push af
ld a, $1
ld a, 1 ; unnecessary bankswitch?
ld [rSVBK], a
xor a
call GetSRAMBank
Expand Down Expand Up @@ -1103,7 +1103,7 @@ INCBIN "gfx/battle/minimize.2bpp"
BattleAnimCmd_Minimize: ; cc735 (33:4735)
ld a, [rSVBK]
push af
ld a, $1
ld a, 1 ; unnecessary bankswitch?
ld [rSVBK], a
xor a
call GetSRAMBank
Expand All @@ -1118,7 +1118,7 @@ BattleAnimCmd_Minimize: ; cc735 (33:4735)
BattleAnimCmd_DropSub: ; cc750 (33:4750)
ld a, [rSVBK]
push af
ld a, $1
ld a, BANK(CurPartySpecies)
ld [rSVBK], a

ld a, [CurPartySpecies] ; CurPartySpecies
Expand All @@ -1143,7 +1143,7 @@ BattleAnimCmd_DropSub: ; cc750 (33:4750)
BattleAnimCmd_BeatUp: ; cc776 (33:4776)
ld a, [rSVBK]
push af
ld a, $1
ld a, BANK(CurPartySpecies)
ld [rSVBK], a
ld a, [CurPartySpecies] ; CurPartySpecies
push af
Expand Down Expand Up @@ -1254,22 +1254,22 @@ endr

ld a, [rSVBK]
push af
ld a, 1
ld a, BANK(EnemyMon) ; BattleMon is in WRAM0, but EnemyMon is in WRAMX
ld [rSVBK], a

ld a, [hBattleTurn]
and a
jr nz, .enemy

ld a, $f0
ld [CryTracks], a ; CryTracks
ld a, [BattleMonSpecies] ; BattleMonSpecies
ld [CryTracks], a
ld a, [BattleMonSpecies]
jr .done_cry_tracks

.enemy
ld a, $0f
ld [CryTracks], a ; CryTracks
ld a, [EnemyMonSpecies] ; EnemyMon
ld [CryTracks], a
ld a, [EnemyMonSpecies]

.done_cry_tracks
push hl
Expand Down Expand Up @@ -1431,7 +1431,7 @@ BattleAnim_SetBGPals: ; cc91a
ret z
ld a, [rSVBK]
push af
ld a, $5
ld a, BANK(wBGPals1)
ld [rSVBK], a
ld hl, wBGPals2
ld de, wBGPals1
Expand Down Expand Up @@ -1459,7 +1459,7 @@ BattleAnim_SetOBPals: ; cc94b
ret z
ld a, [rSVBK]
push af
ld a, $5
ld a, BANK(wOBPals1)
ld [rSVBK], a
ld hl, wOBPals2 palette PAL_BATTLE_OB_GRAY
ld de, wOBPals1 palette PAL_BATTLE_OB_GRAY
Expand Down
4 changes: 2 additions & 2 deletions engine/battle_anims/bg_effects.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2578,7 +2578,7 @@ BGEffects_LoadBGPal0_OBPal1: ; c8e52 (32:4e52)
ld h, a
ld a, [rSVBK]
push af
ld a, $5
ld a, BANK(wBGPals1)
ld [rSVBK], a
ld a, h
push bc
Expand All @@ -2605,7 +2605,7 @@ BGEffects_LoadBGPal1_OBPal0: ; c8e7f (32:4e7f)
ld h, a
ld a, [rSVBK]
push af
ld a, $5
ld a, BANK(wBGPals1)
ld [rSVBK], a
ld a, h
push bc
Expand Down
4 changes: 2 additions & 2 deletions engine/battle_anims/functions.asm
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,9 @@ GetBallAnimPal: ; cd249 (33:5249)
ld hl, BallColors
ld a, [rSVBK]
push af
ld a, $1
ld a, BANK(CurItem)
ld [rSVBK], a
ld a, [CurItem] ; CurItem
ld a, [CurItem]
ld e, a
pop af
ld [rSVBK], a
Expand Down
2 changes: 1 addition & 1 deletion engine/card_flip.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,7 @@ CardFlip_InitAttrPals: ; e0c37 (38:4c37)

ld a, [rSVBK]
push af
ld a, $5
ld a, BANK(wBGPals1)
ld [rSVBK], a
ld hl, .palettes
ld de, wBGPals1
Expand Down
12 changes: 6 additions & 6 deletions engine/color.asm
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ LoadStatsScreenPals:
add hl, bc
ld a, [rSVBK]
push af
ld a, $5
ld a, BANK(wBGPals1)
ld [rSVBK], a
ld a, [hli]
ld [wBGPals1 palette 0], a
Expand Down Expand Up @@ -504,7 +504,7 @@ GetPredefPal:
LoadHLPaletteIntoDE:
ld a, [rSVBK]
push af
ld a, $5
ld a, BANK(wOBPals1)
ld [rSVBK], a
ld c, $8
.loop
Expand All @@ -520,7 +520,7 @@ LoadHLPaletteIntoDE:
LoadPalette_White_Col1_Col2_Black:
ld a, [rSVBK]
push af
ld a, $5
ld a, BANK(wBGPals1)
ld [rSVBK], a

ld a, LOW(palred 31 + palgreen 31 + palblue 31)
Expand Down Expand Up @@ -572,7 +572,7 @@ ResetBGPals:

ld a, [rSVBK]
push af
ld a, $5
ld a, BANK(wBGPals1)
ld [rSVBK], a

ld hl, wBGPals1
Expand Down Expand Up @@ -930,7 +930,7 @@ InitCGBPals::
jr nz, .obpals_loop
ld a, [rSVBK]
push af
ld a, $5
ld a, BANK(wBGPals1)
ld [rSVBK], a
ld hl, wBGPals1
call .LoadWhitePals
Expand Down Expand Up @@ -1251,7 +1251,7 @@ LoadMapPals:
; Switch to palettes WRAM bank
ld a, [rSVBK]
push af
ld a, $5
ld a, BANK(wBGPals1)
ld [rSVBK], a
ld hl, wBGPals1
ld b, 8
Expand Down
2 changes: 1 addition & 1 deletion engine/credits.asm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Credits:: ; 109847

ld a, [rSVBK]
push af
ld a, $5
ld a, BANK(wPals)
ld [rSVBK], a

call ClearBGPalettes
Expand Down
Loading