Remove unnecessary DMG and SGB checking (#7)

This commit is contained in:
xCrystal 2023-07-26 14:29:16 +02:00
parent 15f452ff26
commit acd022d765
30 changed files with 10 additions and 713 deletions

View File

@ -273,9 +273,6 @@ HPBarAnim_UpdateHPRemaining:
ret
HPBarAnim_PaletteUpdate:
ldh a, [hCGB]
and a
ret z
ld hl, wCurHPAnimPal
call SetHPPal
ld a, [wCurHPAnimPal]
@ -284,14 +281,6 @@ HPBarAnim_PaletteUpdate:
ret
HPBarAnim_BGMapUpdate:
ldh a, [hCGB]
and a
jr nz, .cgb
call DelayFrame
call DelayFrame
ret
.cgb
ld a, [wWhichHPBar]
and a
jr z, .load_0

View File

@ -69,7 +69,7 @@ DoBattleTransition:
call UpdateSprites
call DelayFrame
call .LoadPokeballTiles
call BattleStart_CopyTilemapAtOnce
call CopyTilemapAtOnce
ld a, SCREEN_HEIGHT_PX
ldh [hWY], a
call DelayFrame
@ -636,16 +636,6 @@ StartTrainerBattle_LoadPokeBallGraphics:
dec b
jr nz, .tile_loop
ldh a, [hCGB]
and a
jr nz, .cgb
ld a, 1
ldh [hBGMapMode], a
call DelayFrame
call DelayFrame
jr .nextscene
.cgb
ld hl, .pals
ld a, [wTimeOfDayPal]
maskbits NUM_DAYTIMES
@ -671,7 +661,7 @@ StartTrainerBattle_LoadPokeBallGraphics:
ld a, TRUE
ldh [hCGBPalUpdate], a
call DelayFrame
call BattleStart_CopyTilemapAtOnce
call CopyTilemapAtOnce
.nextscene
call StartTrainerBattle_NextScene

View File

@ -1,3 +0,0 @@
BattleStart_CopyTilemapAtOnce:
call CGBOnly_CopyTilemapAtOnce
ret

View File

@ -176,10 +176,6 @@ BattleAnimRestoreHuds:
ret
BattleAnimRequestPals:
ldh a, [hCGB]
and a
ret z
ldh a, [rBGP]
ld b, a
ld a, [wBGP]
@ -643,12 +639,7 @@ BattleAnimCmd_OBP1:
ret
BattleAnimCmd_ResetObp0:
ldh a, [hSGB]
and a
ld a, $e0
jr z, .not_sgb
ld a, $f0
.not_sgb
ld [wOBP0], a
ret
@ -1336,23 +1327,6 @@ PlayHitSound:
ret
BattleAnimAssignPals:
ldh a, [hCGB]
and a
jr nz, .cgb
ldh a, [hSGB]
and a
ld a, %11100000
jr z, .sgb
ld a, %11110000
.sgb
ld [wOBP0], a
ld a, %11100100
ld [wBGP], a
ld [wOBP1], a
ret
.cgb
ld a, %11100100
ld [wBGP], a
ld [wOBP0], a
@ -1405,9 +1379,6 @@ BattleAnim_RevertPals:
BattleAnim_SetBGPals:
ldh [rBGP], a
ldh a, [hCGB]
and a
ret z
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals1)
@ -1432,9 +1403,6 @@ BattleAnim_SetBGPals:
BattleAnim_SetOBPals:
ldh [rOBP0], a
ldh a, [hCGB]
and a
ret z
ldh a, [rSVBK]
push af
ld a, BANK(wOBPals1)

View File

@ -281,14 +281,7 @@ BattleBGEffect_AlternateHues:
db -2
BattleBGEffect_CycleOBPalsGrayAndYellow:
call BattleBGEffects_CheckSGB
jr nz, .sgb
ld de, .PalsCGB
jr .okay
.sgb
ld de, .PalsSGB
.okay
call BattleBGEffect_GetNthDMGPal
ld [wOBP0], a
ret
@ -304,14 +297,7 @@ BattleBGEffect_CycleOBPalsGrayAndYellow:
db -2
BattleBGEffect_CycleMidOBPalsGrayAndYellow:
call BattleBGEffects_CheckSGB
jr nz, .sgb
ld de, .PalsCGB
jr .okay
.sgb
ld de, .PalsSGB
.okay
call BattleBGEffect_GetNthDMGPal
ld [wOBP0], a
ret
@ -1955,90 +1941,6 @@ BattleBGEffect_BetaSendOutMon2: ; unused
ret
BattleBGEffect_FadeMonsToBlackRepeating:
ldh a, [hCGB]
and a
jr nz, .cgb
call BattleBGEffects_AnonJumptable
.anon_dw
dw .zero
dw .one
dw .two
.zero
call BattleBGEffects_IncAnonJumptableIndex
ld a, $e4
call BattleBGEffects_SetLYOverrides
ld a, LOW(rBGP)
ldh [hLCDCPointer], a
xor a
ldh [hLYOverrideStart], a
ld a, $60
ldh [hLYOverrideEnd], a
ret
.one
ld hl, BG_EFFECT_STRUCT_PARAM
add hl, bc
ld a, [hl]
inc [hl]
ld e, a
and $7
ret nz
ld a, e
and $18
sla a
swap a
sla a
ld e, a
ld d, 0
push bc
call BGEffect_CheckBattleTurn
jr nz, .player
ld hl, .CGB_DMGEnemyData
add hl, de
ld a, [hli]
ld [wOBP1], a
ld d, a
ld e, [hl]
lb bc, $2f, $30
jr .okay
.player
ld hl, .DMG_PlayerData
add hl, de
ld d, [hl]
inc hl
ld a, [hl]
ld [wOBP1], a
ld e, a
lb bc, $37, $28
.okay
call .DMG_LYOverrideLoads
pop bc
ret
.two
call BattleBGEffects_ResetVideoHRAM
ld a, $e4
ld [wBGP], a
ld [wOBP1], a
ret
.DMG_LYOverrideLoads:
ld hl, wLYOverridesBackup
.loop1
ld [hl], d
inc hl
dec b
jr nz, .loop1
.loop2
ld [hl], e
inc hl
dec c
jr nz, .loop2
ret
.cgb
ld de, .Jumptable
call BatttleBGEffects_GetNamedJumptablePointer
jp hl
@ -2397,71 +2299,6 @@ BattleBGEffect_GetNthDMGPal:
BGEffect_RapidCyclePals:
; Last index in DE: $fe signals a loop, $ff signals end
ldh a, [hCGB]
and a
jr nz, .cgb
push de
ld de, .Jumptable_DMG
call BatttleBGEffects_GetNamedJumptablePointer
pop de
jp hl
.Jumptable_DMG:
dw .zero_dmg
dw .one_dmg
dw .two_dmg
.zero_dmg
call BattleBGEffects_IncAnonJumptableIndex
ld a, $e4
call BattleBGEffects_SetLYOverrides
ld a, $47
call BattleBGEffect_SetLCDStatCustoms1
ldh a, [hLYOverrideEnd]
inc a
ldh [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_PARAM
add hl, bc
ld a, [hl]
ld [hl], $0
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], a
ret
.one_dmg
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld a, [hl]
and $f
jr z, .okay_1_dmg
dec [hl]
ret
.okay_1_dmg
ld a, [hl]
swap a
or [hl]
ld [hl], a
call BattleBGEffect_GetFirstDMGPal
jr c, .okay_2_dmg
call BGEffect_FillLYOverridesBackup
ret
.okay_2_dmg
ld hl, BG_EFFECT_STRUCT_PARAM
add hl, bc
dec [hl]
ret
.two_dmg
call BattleBGEffects_ResetVideoHRAM
ld a, %11100100
ldh [rBGP], a
call EndBattleBGEffect
ret
.cgb
push de
ld de, .Jumptable_CGB
call BatttleBGEffects_GetNamedJumptablePointer
@ -2919,11 +2756,6 @@ BGEffect_CheckFlyDigStatus:
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
ret
BattleBGEffects_CheckSGB:
ldh a, [hSGB]
and a
ret
BattleBGEffects_Sine:
ld e, a
callfar BattleAnim_Sine_e

View File

@ -3399,15 +3399,7 @@ BattleAnimFunction_SkyAttack:
srl a
ld e, a
ld d, 0
ldh a, [hSGB]
and a
jr nz, .sgb
ld hl, .GBCPals
jr .got_pals
.sgb
ld hl, .SGBPals
.got_pals
add hl, de
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_VAR1

View File

@ -34,14 +34,6 @@
DebugColorPicker: ; unreferenced
; A debug menu to test monster and trainer palettes at runtime.
ldh a, [hCGB]
and a
jr nz, .cgb
ldh a, [hSGB]
and a
ret z
.cgb
ldh a, [hInMenu]
push af
ld a, TRUE
@ -180,10 +172,6 @@ DebugColor_LoadGFX:
ret
DebugColor_InitPalettes:
ldh a, [hCGB]
and a
ret z
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals2)
@ -439,17 +427,11 @@ DebugColor_SetRGBMeter:
ret
DebugColor_UpdateScreen:
ldh a, [hCGB]
and a
jr z, .sgb
ld a, 2
ldh [hBGMapMode], a
call DelayFrame
call DelayFrame
call DelayFrame
.sgb
call WaitBGMap
ld a, DEBUGCOLORMAIN_UPDATEPALETTES
@ -457,11 +439,6 @@ DebugColor_UpdateScreen:
ret
DebugColor_UpdatePalettes:
ldh a, [hCGB]
and a
jr z, .sgb
; cgb
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals2)
@ -489,41 +466,6 @@ DebugColor_UpdatePalettes:
ldh [rSVBK], a
ret
.sgb
ld hl, wSGBPals
ld a, 1
ld [hli], a
ld a, LOW(PALRGB_WHITE)
ld [hli], a
ld a, HIGH(PALRGB_WHITE)
ld [hli], a
ld a, [wDebugLightColor + 0]
ld [hli], a
ld a, [wDebugLightColor + 1]
ld [hli], a
ld a, [wDebugDarkColor + 0]
ld [hli], a
ld a, [wDebugDarkColor + 1]
ld [hli], a
xor a
ld [hli], a
ld [hli], a
ld [hl], a
ld hl, wSGBPals
call DebugColor_PushSGBPals
hlcoord 10, 2
ld de, wDebugLightColor
call DebugColor_PrintHexColor
hlcoord 15, 2
ld de, wDebugDarkColor
call DebugColor_PrintHexColor
ld a, DEBUGCOLORMAIN_JOYPAD
ld [wJumptableIndex], a
ret
DebugColor_PrintHexColor:
inc hl
inc hl

View File

@ -155,13 +155,6 @@ INCBIN "gfx/overworld/heal_machine.2bpp"
dbsprite 11, 7, 5, 1, $7d, PAL_OW_TREE | OBP_NUM
.LoadPalettes:
call IsCGB
jr nz, .cgb
ld a, %11100000
ldh [rOBP1], a
ret
.cgb
ld hl, .palettes
ld de, wOBPals2 palette PAL_OW_TREE
ld bc, 1 palettes
@ -187,14 +180,6 @@ INCLUDE "gfx/overworld/heal_machine.pal"
ret
.FlashPalettes:
call IsCGB
jr nz, .go
ldh a, [rOBP1]
xor %00101000
ldh [rOBP1], a
ret
.go
ldh a, [rSVBK]
push af
ld a, BANK(wOBPals2)

View File

@ -438,7 +438,7 @@ Mom_ContinueMenuSetup:
lb bc, PRINTNUM_MONEY | PRINTNUM_LEADINGZEROS | 3, 6
call PrintNum
call UpdateSprites
call CGBOnly_CopyTilemapAtOnce
call CopyTilemapAtOnce
ret
Mom_Wait10Frames:

View File

@ -1,30 +1,8 @@
LoadPoisonBGPals:
call .LoadPals
ldh a, [hCGB]
and a
ret nz
; code was probably dummied out here
ret
.LoadPals:
ldh a, [hCGB]
and a
jr nz, .cgb
ld a, [wTimeOfDayPal]
maskbits NUM_DAYTIMES
cp DARKNESS_F
ld a, %00000000
jr z, .convert_pals
ld a, %10101010
.convert_pals
call DmgToCgbBGPals
ld c, 4
call DelayFrames
farcall _UpdateTimePals
ret
.cgb
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals2)

View File

@ -443,11 +443,6 @@ CardFlip_DisplayCardFaceUp:
jr nz, .row
pop hl
; Pointless CGB check
ldh a, [hCGB]
and a
ret z
; Set the attributes
ld de, wAttrmap - wTilemap
add hl, de
@ -1313,14 +1308,6 @@ ChooseCard_HandleJoypad:
CardFlip_UpdateCursorOAM:
call ClearSprites
ldh a, [hCGB]
and a
jr nz, .skip
ldh a, [hVBlankCounter]
and $4
ret nz
.skip
call CollapseCursorPosition
add hl, hl
add hl, hl
@ -1546,10 +1533,6 @@ ENDM
dbsprite 1, 1, 0, 0, $00, 0 | X_FLIP | Y_FLIP | PRIORITY
CardFlip_InitAttrPals:
ldh a, [hCGB]
and a
ret z
hlcoord 0, 0, wAttrmap
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
xor a

View File

@ -172,11 +172,6 @@ Slots_GetPals:
ld a, %11100100
call DmgToCgbBGPals
lb de, %11100100, %11100100
ldh a, [hCGB]
and a
jr nz, .cgb
lb de, %11000000, %11100100
.cgb
call DmgToCgbObjPals
ret

View File

@ -161,77 +161,6 @@ INCLUDE "gfx/intro/gs_magikarp_bg.pal"
.MagikarpOBPal:
INCLUDE "gfx/intro/gs_magikarp_ob.pal"
Intro_LoadAllPal0: ; unreferenced
call CheckCGB
ret nz
ldh a, [hSGB]
and a
ret z
ld hl, BlkPacket_AllPal0
jp PushSGBPals
Intro_LoadBetaIntroVenusaurPalettes: ; unreferenced
call CheckCGB
jr nz, .cgb
ldh a, [hSGB]
and a
ret z
ld hl, PalPacket_BetaIntroVenusaur
jp PushSGBPals
.cgb
ld de, wOBPals1
ld a, PREDEFPAL_BETA_INTRO_VENUSAUR
call GetPredefPal
jp LoadHLPaletteIntoDE
Intro_LoadPackPalettes: ; unreferenced
call CheckCGB
jr nz, .cgb
ldh a, [hSGB]
and a
ret z
ld hl, PalPacket_Pack
jp PushSGBPals
.cgb
ld de, wOBPals1
ld a, PREDEFPAL_PACK
call GetPredefPal
jp LoadHLPaletteIntoDE
GSIntro_LoadMonPalette: ; unreferenced
call CheckCGB
jr nz, .cgb
ldh a, [hSGB]
and a
ret z
ld a, c
push af
ld hl, PalPacket_Pal01
ld de, wSGBPals
ld bc, PALPACKET_LENGTH
call CopyBytes
pop af
call GetMonPalettePointer
ld a, [hli]
ld [wSGBPals + 3], a
ld a, [hli]
ld [wSGBPals + 4], a
ld a, [hli]
ld [wSGBPals + 5], a
ld a, [hl]
ld [wSGBPals + 6], a
ld hl, wSGBPals
jp PushSGBPals
.cgb
ld de, wOBPals1
ld a, c
call GetMonPalettePointer
call LoadPalette_White_Col1_Col2_Black
ret
LoadTrainerClassPaletteAsNthBGPal:
ld a, [wTrainerClass]
call GetTrainerPalettePointer
@ -269,13 +198,6 @@ LoadNthMiddleBGPal:
ret
LoadBetaPokerPalettes: ; unreferenced
ldh a, [hCGB]
and a
jr nz, .cgb
ld hl, wBetaPokerSGBPals
jp PushSGBPals
.cgb
ld a, [wBetaPokerSGBCol]
ld c, a
ld a, [wBetaPokerSGBRow]

View File

@ -545,13 +545,7 @@ Sprites_Sine:
calc_sine_wave
AnimateEndOfExpBar:
ldh a, [hSGB]
ld de, EndOfExpBarGFX
and a
jr z, .load
ld de, SGBEndOfExpBarGFX
.load
ld hl, vTiles0 tile $00
lb bc, BANK(EndOfExpBarGFX), 1
call Request2bpp
@ -609,8 +603,6 @@ AnimateEndOfExpBar:
EndOfExpBarGFX:
INCBIN "gfx/battle/expbarend.2bpp"
SGBEndOfExpBarGFX:
INCBIN "gfx/battle/expbarend_sgb.2bpp"
ClearSpriteAnims2:
push hl

View File

@ -1,8 +1,4 @@
SaveMenu_CopyTilemapAtOnce:
ldh a, [hCGB]
and a
jp z, WaitBGMap
; The following is a modified version of _CopyTilemapAtOnce
; that waits for [rLY] to be $60 instead of $80 - 1.
ldh a, [hBGMapMode]

View File

@ -162,9 +162,7 @@ RunTradeAnimScript:
call DisableLCD
call LoadFontsBattleExtra
callfar ClearSpriteAnims
ldh a, [hCGB]
and a
jr z, .NotCGB
ld a, $1
ldh [rVBK], a
ld hl, vTiles0
@ -174,7 +172,6 @@ RunTradeAnimScript:
ld a, $0
ldh [rVBK], a
.NotCGB:
hlbgcoord 0, 0
ld bc, VRAM_End - vBGMap0
ld a, " "
@ -1302,13 +1299,7 @@ TradeAnim_CopyBoxFromDEtoHL:
ret
TradeAnim_NormalPals:
ldh a, [hSGB]
and a
ld a, %11100100 ; 3,2,1,0
jr z, .not_sgb
ld a, $f0
.not_sgb
call DmgToCgbObjPal0
ld a, %11100100 ; 3,2,1,0
call DmgToCgbBGPals

View File

@ -255,10 +255,6 @@ LoadMapTimeOfDay:
.PushAttrmap:
decoord 0, 0
call .copy
ldh a, [hCGB]
and a
ret z
decoord 0, 0, wAttrmap
ld a, $1
ldh [rVBK], a

View File

@ -1,7 +1,4 @@
PhoneRing_CopyTilemapAtOnce:
ldh a, [hCGB]
and a
jp z, WaitBGMap
ld a, [wSpriteUpdatesEnabled]
cp $0
jp z, WaitBGMap

View File

@ -218,7 +218,7 @@ Pokedex_InitMainScreen:
ld a, 7
ld [wDexListingHeight], a
call Pokedex_PrintListing
call Pokedex_SetBGMapMode_3ifDMG_4ifCGB
call Pokedex_SetBGMapMode4
call Pokedex_ResetBGMapMode
call Pokedex_DrawMainScreenBG
ld a, POKEDEX_SCX
@ -814,12 +814,6 @@ Pokedex_UpdateUnownMode:
ld a, DEXSTATE_OPTION_SCR
ld [wJumptableIndex], a
call DelayFrame
call Pokedex_CheckSGB
jr nz, .decompress
farcall LoadSGBPokedexGFX2
jr .done
.decompress
ld hl, PokedexLZ
ld de, vTiles2 tile $31
lb bc, BANK(PokedexLZ), 58
@ -2420,12 +2414,6 @@ Pokedex_LoadGFX:
ld hl, vTiles2 tile $60
ld bc, $20 tiles
call Pokedex_InvertTiles
call Pokedex_CheckSGB
jr nz, .LoadPokedexLZ
farcall LoadSGBPokedexGFX
jr .LoadPokedexSlowpokeLZ
.LoadPokedexLZ:
ld hl, PokedexLZ
ld de, vTiles2 tile $31
call Decompress
@ -2461,14 +2449,6 @@ INCBIN "gfx/pokedex/pokedex.2bpp.lz"
PokedexSlowpokeLZ:
INCBIN "gfx/pokedex/slowpoke.2bpp.lz"
Pokedex_CheckSGB:
ldh a, [hCGB]
or a
ret nz
ldh a, [hSGB]
dec a
ret
Pokedex_LoadUnownFont:
ld a, BANK(sScratch)
call OpenSRAM
@ -2553,15 +2533,6 @@ Pokedex_SetBGMapMode4:
call DelayFrames
ret
Pokedex_SetBGMapMode_3ifDMG_4ifCGB:
ldh a, [hCGB]
and a
jr z, .DMG
call Pokedex_SetBGMapMode4
.DMG:
call Pokedex_SetBGMapMode3
ret
Pokedex_ResetBGMapMode:
xor a
ldh [hBGMapMode], a

View File

@ -104,9 +104,6 @@ PokeGear:
ld b, SCGB_POKEGEAR_PALS
call GetSGBLayout
call SetPalettes
ldh a, [hCGB]
and a
ret z
ld a, %11100100
call DmgToCgbObjPal0
ret
@ -256,14 +253,10 @@ InitPokegearTilemap:
ret
.UpdateBGMap:
ldh a, [hCGB]
and a
jr z, .dmg
ld a, $2
ldh [hBGMapMode], a
ld c, 3
call DelayFrames
.dmg
call WaitBGMap
ret
@ -1676,14 +1669,9 @@ _TownMap:
ld b, SCGB_POKEGEAR_PALS
call GetSGBLayout
call SetPalettes
ldh a, [hCGB]
and a
jr z, .dmg
ld a, %11100100
call DmgToCgbObjPal0
call DelayFrame
.dmg
ld d, 0
ld e, 1
call .loop
@ -2387,19 +2375,14 @@ TownMapBGUpdate:
ldh [hBGMapAddress], a
ld a, h
ldh [hBGMapAddress + 1], a
; Only update palettes on CGB
ldh a, [hCGB]
and a
jr z, .tiles
; BG Map mode 2 (palettes)
ld a, 2
ldh [hBGMapMode], a
; The BG Map is updated in thirds, so we wait
; 3 frames to update the whole screen's palettes.
ld c, 3
call DelayFrames
.tiles
; Update BG Map tiles
call WaitBGMap
; Turn off BG Map update

View File

@ -670,12 +670,7 @@ AnimateFlowerTile:
; A cycle of 2 frames, updating every other tick
ld a, [wTileAnimationTimer]
and %10
; CGB has different tile graphics for flowers
ld e, a
ldh a, [hCGB]
and 1
add e
srl a
; hl = .FlowerTileFrames + a * 16
swap a
@ -690,9 +685,7 @@ AnimateFlowerTile:
jp WriteTile
.FlowerTileFrames:
INCBIN "gfx/tilesets/flower/dmg_1.2bpp"
INCBIN "gfx/tilesets/flower/cgb_1.2bpp"
INCBIN "gfx/tilesets/flower/dmg_2.2bpp"
INCBIN "gfx/tilesets/flower/cgb_2.2bpp"
AnimateLavaBubbleTile1:
@ -905,11 +898,6 @@ endr
AnimateWaterPalette:
; Transition between color values 0-2 for color 0 in palette 3.
; Don't update the palette on DMG
ldh a, [hCGB]
and a
ret z
; Don't update a non-standard palette order
ldh a, [rBGP]
cp %11100100
@ -968,11 +956,6 @@ AnimateWaterPalette:
ret
FlickeringCaveEntrancePalette:
; Don't update the palette on DMG
ldh a, [hCGB]
and a
ret z
; Don't update a non-standard palette order
ldh a, [rBGP]
cp %11100100

View File

@ -298,82 +298,11 @@ ConvertTimePalsDecHL:
ret
GetTimePalFade:
; check cgb
ldh a, [hCGB]
and a
jr nz, .cgb
; else: dmg
; index
ld a, [wTimeOfDayPal]
and %11
; get fade table
push bc
ld c, a
ld b, 0
ld hl, .dmgfades
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
pop bc
; get place in fade table
ld b, 0
add hl, bc
ret
.cgb
ld hl, .cgbfade
ld b, 0
add hl, bc
ret
.dmgfades
dw .morn
dw .day
dw .nite
dw .darkness
.morn
dc 3,3,3,3, 3,3,3,3, 3,3,3,3
dc 3,3,3,2, 3,3,3,2, 3,3,3,2
dc 3,3,2,1, 3,2,1,0, 3,2,1,0
dc 3,2,1,0, 3,1,0,0, 3,1,0,0
dc 2,1,0,0, 2,0,0,0, 2,0,0,0
dc 1,0,0,0, 1,0,0,0, 1,0,0,0
dc 0,0,0,0, 0,0,0,0, 0,0,0,0
.day
dc 3,3,3,3, 3,3,3,3, 3,3,3,3
dc 3,3,3,2, 3,3,3,2, 3,3,3,2
dc 3,3,2,1, 3,2,1,0, 3,2,1,0
dc 3,2,1,0, 3,1,0,0, 3,1,0,0
dc 2,1,0,0, 2,0,0,0, 2,0,0,0
dc 1,0,0,0, 1,0,0,0, 1,0,0,0
dc 0,0,0,0, 0,0,0,0, 0,0,0,0
.nite
dc 3,3,3,3, 3,3,3,3, 3,3,3,3
dc 3,3,3,2, 3,3,3,2, 3,3,3,2
dc 3,3,2,1, 3,2,1,0, 3,2,1,0
dc 3,2,2,1, 3,1,0,0, 3,1,0,0
dc 2,1,0,0, 2,0,0,0, 2,0,0,0
dc 1,0,0,0, 1,0,0,0, 1,0,0,0
dc 0,0,0,0, 0,0,0,0, 0,0,0,0
.darkness
dc 3,3,3,3, 3,3,3,3, 3,3,3,3
dc 3,3,3,2, 3,3,3,2, 3,3,3,3
dc 3,3,3,2, 3,2,1,0, 3,3,3,3
dc 3,3,3,1, 3,1,0,0, 3,3,3,3
dc 3,3,3,1, 2,0,0,0, 3,3,3,3
dc 0,0,0,0, 1,0,0,0, 0,0,0,0
dc 0,0,0,0, 0,0,0,0, 0,0,0,0
.cgbfade
dc 3,3,3,3, 3,3,3,3, 3,3,3,3
dc 3,3,3,2, 3,3,3,2, 3,3,3,2

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

View File

@ -1,29 +1,13 @@
; Functions to fade the screen in and out.
RotateFourPalettesRight::
ldh a, [hCGB]
and a
jr z, .dmg
ld hl, IncGradGBPalTable_00
ld b, 4
jr RotatePalettesRight
.dmg
ld hl, IncGradGBPalTable_08
ld b, 4
jr RotatePalettesRight
RotateThreePalettesRight::
ldh a, [hCGB]
and a
jr z, .dmg
ld hl, IncGradGBPalTable_05
ld b, 3
jr RotatePalettesRight
.dmg
ld hl, IncGradGBPalTable_13
ld b, 3
RotatePalettesRight::
; Rotate palettes to the right and fill with loaded colors from the left
; If we're already at the leftmost color, fill with the leftmost color
@ -43,29 +27,13 @@ RotatePalettesRight::
ret
RotateFourPalettesLeft::
ldh a, [hCGB]
and a
jr z, .dmg
ld hl, IncGradGBPalTable_04 - 1
ld b, 4
jr RotatePalettesLeft
.dmg
ld hl, IncGradGBPalTable_12 - 1
ld b, 4
jr RotatePalettesLeft
RotateThreePalettesLeft::
ldh a, [hCGB]
and a
jr z, .dmg
ld hl, IncGradGBPalTable_07 - 1
ld b, 3
jr RotatePalettesLeft
.dmg
ld hl, IncGradGBPalTable_15 - 1
ld b, 3
RotatePalettesLeft::
; Rotate palettes to the left and fill with loaded colors from the right
; If we're already at the rightmost color, fill with the rightmost color
@ -94,14 +62,3 @@ IncGradGBPalTable_05:: dc 2,1,0,0, 2,1,0,0, 2,1,0,0
IncGradGBPalTable_06:: dc 1,0,0,0, 1,0,0,0, 1,0,0,0
IncGradGBPalTable_07:: dc 0,0,0,0, 0,0,0,0, 0,0,0,0
; bgp obp1 obp2
IncGradGBPalTable_08:: dc 3,3,3,3, 3,3,3,3, 3,3,3,3
IncGradGBPalTable_09:: dc 3,3,3,2, 3,3,3,2, 3,3,2,0
IncGradGBPalTable_10:: dc 3,3,2,1, 3,2,1,0, 3,2,1,0
IncGradGBPalTable_11:: dc 3,2,1,0, 3,1,0,0, 3,2,0,0
IncGradGBPalTable_12:: dc 3,2,1,0, 3,1,0,0, 3,2,0,0
IncGradGBPalTable_13:: dc 2,1,0,0, 2,0,0,0, 2,1,0,0
IncGradGBPalTable_14:: dc 1,0,0,0, 1,0,0,0, 1,0,0,0
IncGradGBPalTable_15:: dc 0,0,0,0, 0,0,0,0, 0,0,0,0

View File

@ -73,12 +73,6 @@ DmgToCgbBGPals::
ldh [rBGP], a
push af
; Don't need to be here if DMG
ldh a, [hCGB]
and a
jr z, .end
push hl
push de
push bc
@ -108,7 +102,6 @@ DmgToCgbBGPals::
pop bc
pop de
pop hl
.end
pop af
ret
@ -123,10 +116,6 @@ DmgToCgbObjPals::
ld a, d
ldh [rOBP1], a
ldh a, [hCGB]
and a
ret z
push hl
push de
push bc
@ -161,12 +150,6 @@ DmgToCgbObjPals::
DmgToCgbObjPal0::
ldh [rOBP0], a
push af
; Don't need to be here if not CGB
ldh a, [hCGB]
and a
jr z, .dmg
push hl
push de
push bc
@ -191,19 +174,12 @@ DmgToCgbObjPal0::
pop bc
pop de
pop hl
.dmg
pop af
ret
DmgToCgbObjPal1::
ldh [rOBP1], a
push af
ldh a, [hCGB]
and a
jr z, .dmg
push hl
push de
push bc
@ -228,8 +204,6 @@ DmgToCgbObjPal1::
pop bc
pop de
pop hl
.dmg
pop af
ret
@ -286,10 +260,6 @@ endr
ret
ClearVBank1::
ldh a, [hCGB]
and a
ret z
ld a, 1
ldh [rVBK], a
@ -306,9 +276,6 @@ GSReloadPalettes:: ; dummied out
ret
ReloadSpritesNoPalettes::
ldh a, [hCGB]
and a
ret z
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals2)

View File

@ -10,41 +10,27 @@ WaitBGMap::
ret
WaitBGMap2::
ldh a, [hCGB]
and a
jr z, .bg0
ld a, 2
ldh [hBGMapMode], a
ld c, 4
call DelayFrames
.bg0
ld a, 1
ldh [hBGMapMode], a
ld c, 4
call DelayFrames
ret
IsCGB::
ldh a, [hCGB]
and a
ret
ApplyTilemap::
ldh a, [hCGB]
and a
jr z, .dmg
ld a, [wSpriteUpdatesEnabled]
cp 0
jr z, .dmg
jr z, .wait_bg_map
ld a, 1
ldh [hBGMapMode], a
jr CopyTilemapAtOnce
.dmg
.wait_bg_map
; WaitBGMap
ld a, 1
ldh [hBGMapMode], a
@ -52,11 +38,6 @@ ApplyTilemap::
call DelayFrames
ret
CGBOnly_CopyTilemapAtOnce::
ldh a, [hCGB]
and a
jr z, WaitBGMap
CopyTilemapAtOnce::
jr _CopyTilemapAtOnce

View File

@ -177,7 +177,7 @@ VBlank1::
ldh a, [hSCY]
ldh [rSCY], a
call UpdatePals
call UpdateCGBPals
jr c, .done
call UpdateBGMap
@ -227,24 +227,6 @@ VBlank1::
ldh [rIF], a
ret
UpdatePals::
; update pals for either dmg or cgb
ldh a, [hCGB]
and a
jp nz, UpdateCGBPals
; update gb pals
ld a, [wBGP]
ldh [rBGP], a
ld a, [wOBP0]
ldh [rOBP0], a
ld a, [wOBP1]
ldh [rOBP1], a
and a
ret
VBlank3::
; scx, scy
; palettes

View File

@ -273,7 +273,6 @@ INCLUDE "engine/tilesets/timeofday_pals.asm"
INCLUDE "engine/battle/battle_transition.asm"
INCLUDE "engine/events/field_moves.asm"
INCLUDE "engine/events/magnet_train.asm"
INCLUDE "engine/battle/battlestart_copytilemapatonce.asm"
INCLUDE "engine/gfx/sprites.asm"
INCLUDE "engine/gfx/mon_icons.asm"