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 ret
HPBarAnim_PaletteUpdate: HPBarAnim_PaletteUpdate:
ldh a, [hCGB]
and a
ret z
ld hl, wCurHPAnimPal ld hl, wCurHPAnimPal
call SetHPPal call SetHPPal
ld a, [wCurHPAnimPal] ld a, [wCurHPAnimPal]
@ -284,14 +281,6 @@ HPBarAnim_PaletteUpdate:
ret ret
HPBarAnim_BGMapUpdate: HPBarAnim_BGMapUpdate:
ldh a, [hCGB]
and a
jr nz, .cgb
call DelayFrame
call DelayFrame
ret
.cgb
ld a, [wWhichHPBar] ld a, [wWhichHPBar]
and a and a
jr z, .load_0 jr z, .load_0

View File

@ -69,7 +69,7 @@ DoBattleTransition:
call UpdateSprites call UpdateSprites
call DelayFrame call DelayFrame
call .LoadPokeballTiles call .LoadPokeballTiles
call BattleStart_CopyTilemapAtOnce call CopyTilemapAtOnce
ld a, SCREEN_HEIGHT_PX ld a, SCREEN_HEIGHT_PX
ldh [hWY], a ldh [hWY], a
call DelayFrame call DelayFrame
@ -636,16 +636,6 @@ StartTrainerBattle_LoadPokeBallGraphics:
dec b dec b
jr nz, .tile_loop 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 hl, .pals
ld a, [wTimeOfDayPal] ld a, [wTimeOfDayPal]
maskbits NUM_DAYTIMES maskbits NUM_DAYTIMES
@ -671,7 +661,7 @@ StartTrainerBattle_LoadPokeBallGraphics:
ld a, TRUE ld a, TRUE
ldh [hCGBPalUpdate], a ldh [hCGBPalUpdate], a
call DelayFrame call DelayFrame
call BattleStart_CopyTilemapAtOnce call CopyTilemapAtOnce
.nextscene .nextscene
call StartTrainerBattle_NextScene call StartTrainerBattle_NextScene

View File

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

View File

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

View File

@ -281,14 +281,7 @@ BattleBGEffect_AlternateHues:
db -2 db -2
BattleBGEffect_CycleOBPalsGrayAndYellow: BattleBGEffect_CycleOBPalsGrayAndYellow:
call BattleBGEffects_CheckSGB
jr nz, .sgb
ld de, .PalsCGB ld de, .PalsCGB
jr .okay
.sgb
ld de, .PalsSGB
.okay
call BattleBGEffect_GetNthDMGPal call BattleBGEffect_GetNthDMGPal
ld [wOBP0], a ld [wOBP0], a
ret ret
@ -304,14 +297,7 @@ BattleBGEffect_CycleOBPalsGrayAndYellow:
db -2 db -2
BattleBGEffect_CycleMidOBPalsGrayAndYellow: BattleBGEffect_CycleMidOBPalsGrayAndYellow:
call BattleBGEffects_CheckSGB
jr nz, .sgb
ld de, .PalsCGB ld de, .PalsCGB
jr .okay
.sgb
ld de, .PalsSGB
.okay
call BattleBGEffect_GetNthDMGPal call BattleBGEffect_GetNthDMGPal
ld [wOBP0], a ld [wOBP0], a
ret ret
@ -1955,90 +1941,6 @@ BattleBGEffect_BetaSendOutMon2: ; unused
ret ret
BattleBGEffect_FadeMonsToBlackRepeating: 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 ld de, .Jumptable
call BatttleBGEffects_GetNamedJumptablePointer call BatttleBGEffects_GetNamedJumptablePointer
jp hl jp hl
@ -2397,71 +2299,6 @@ BattleBGEffect_GetNthDMGPal:
BGEffect_RapidCyclePals: BGEffect_RapidCyclePals:
; Last index in DE: $fe signals a loop, $ff signals end ; 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 push de
ld de, .Jumptable_CGB ld de, .Jumptable_CGB
call BatttleBGEffects_GetNamedJumptablePointer call BatttleBGEffects_GetNamedJumptablePointer
@ -2919,11 +2756,6 @@ BGEffect_CheckFlyDigStatus:
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
ret ret
BattleBGEffects_CheckSGB:
ldh a, [hSGB]
and a
ret
BattleBGEffects_Sine: BattleBGEffects_Sine:
ld e, a ld e, a
callfar BattleAnim_Sine_e callfar BattleAnim_Sine_e

View File

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

View File

@ -34,14 +34,6 @@
DebugColorPicker: ; unreferenced DebugColorPicker: ; unreferenced
; A debug menu to test monster and trainer palettes at runtime. ; 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] ldh a, [hInMenu]
push af push af
ld a, TRUE ld a, TRUE
@ -180,10 +172,6 @@ DebugColor_LoadGFX:
ret ret
DebugColor_InitPalettes: DebugColor_InitPalettes:
ldh a, [hCGB]
and a
ret z
ldh a, [rSVBK] ldh a, [rSVBK]
push af push af
ld a, BANK(wBGPals2) ld a, BANK(wBGPals2)
@ -439,17 +427,11 @@ DebugColor_SetRGBMeter:
ret ret
DebugColor_UpdateScreen: DebugColor_UpdateScreen:
ldh a, [hCGB]
and a
jr z, .sgb
ld a, 2 ld a, 2
ldh [hBGMapMode], a ldh [hBGMapMode], a
call DelayFrame call DelayFrame
call DelayFrame call DelayFrame
call DelayFrame call DelayFrame
.sgb
call WaitBGMap call WaitBGMap
ld a, DEBUGCOLORMAIN_UPDATEPALETTES ld a, DEBUGCOLORMAIN_UPDATEPALETTES
@ -457,11 +439,6 @@ DebugColor_UpdateScreen:
ret ret
DebugColor_UpdatePalettes: DebugColor_UpdatePalettes:
ldh a, [hCGB]
and a
jr z, .sgb
; cgb
ldh a, [rSVBK] ldh a, [rSVBK]
push af push af
ld a, BANK(wBGPals2) ld a, BANK(wBGPals2)
@ -489,41 +466,6 @@ DebugColor_UpdatePalettes:
ldh [rSVBK], a ldh [rSVBK], a
ret 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: DebugColor_PrintHexColor:
inc hl inc hl
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 dbsprite 11, 7, 5, 1, $7d, PAL_OW_TREE | OBP_NUM
.LoadPalettes: .LoadPalettes:
call IsCGB
jr nz, .cgb
ld a, %11100000
ldh [rOBP1], a
ret
.cgb
ld hl, .palettes ld hl, .palettes
ld de, wOBPals2 palette PAL_OW_TREE ld de, wOBPals2 palette PAL_OW_TREE
ld bc, 1 palettes ld bc, 1 palettes
@ -187,14 +180,6 @@ INCLUDE "gfx/overworld/heal_machine.pal"
ret ret
.FlashPalettes: .FlashPalettes:
call IsCGB
jr nz, .go
ldh a, [rOBP1]
xor %00101000
ldh [rOBP1], a
ret
.go
ldh a, [rSVBK] ldh a, [rSVBK]
push af push af
ld a, BANK(wOBPals2) ld a, BANK(wOBPals2)

View File

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

View File

@ -1,30 +1,8 @@
LoadPoisonBGPals: LoadPoisonBGPals:
call .LoadPals call .LoadPals
ldh a, [hCGB]
and a
ret nz
; code was probably dummied out here
ret ret
.LoadPals: .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] ldh a, [rSVBK]
push af push af
ld a, BANK(wBGPals2) ld a, BANK(wBGPals2)

View File

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

View File

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

View File

@ -161,77 +161,6 @@ INCLUDE "gfx/intro/gs_magikarp_bg.pal"
.MagikarpOBPal: .MagikarpOBPal:
INCLUDE "gfx/intro/gs_magikarp_ob.pal" 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: LoadTrainerClassPaletteAsNthBGPal:
ld a, [wTrainerClass] ld a, [wTrainerClass]
call GetTrainerPalettePointer call GetTrainerPalettePointer
@ -269,13 +198,6 @@ LoadNthMiddleBGPal:
ret ret
LoadBetaPokerPalettes: ; unreferenced LoadBetaPokerPalettes: ; unreferenced
ldh a, [hCGB]
and a
jr nz, .cgb
ld hl, wBetaPokerSGBPals
jp PushSGBPals
.cgb
ld a, [wBetaPokerSGBCol] ld a, [wBetaPokerSGBCol]
ld c, a ld c, a
ld a, [wBetaPokerSGBRow] ld a, [wBetaPokerSGBRow]

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -298,82 +298,11 @@ ConvertTimePalsDecHL:
ret ret
GetTimePalFade: 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 hl, .cgbfade
ld b, 0 ld b, 0
add hl, bc add hl, bc
ret 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 .cgbfade
dc 3,3,3,3, 3,3,3,3, 3,3,3,3 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,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. ; Functions to fade the screen in and out.
RotateFourPalettesRight:: RotateFourPalettesRight::
ldh a, [hCGB]
and a
jr z, .dmg
ld hl, IncGradGBPalTable_00 ld hl, IncGradGBPalTable_00
ld b, 4 ld b, 4
jr RotatePalettesRight jr RotatePalettesRight
.dmg
ld hl, IncGradGBPalTable_08
ld b, 4
jr RotatePalettesRight
RotateThreePalettesRight:: RotateThreePalettesRight::
ldh a, [hCGB]
and a
jr z, .dmg
ld hl, IncGradGBPalTable_05 ld hl, IncGradGBPalTable_05
ld b, 3 ld b, 3
jr RotatePalettesRight
.dmg
ld hl, IncGradGBPalTable_13
ld b, 3
RotatePalettesRight:: RotatePalettesRight::
; Rotate palettes to the right and fill with loaded colors from the left ; 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 ; If we're already at the leftmost color, fill with the leftmost color
@ -43,29 +27,13 @@ RotatePalettesRight::
ret ret
RotateFourPalettesLeft:: RotateFourPalettesLeft::
ldh a, [hCGB]
and a
jr z, .dmg
ld hl, IncGradGBPalTable_04 - 1 ld hl, IncGradGBPalTable_04 - 1
ld b, 4 ld b, 4
jr RotatePalettesLeft jr RotatePalettesLeft
.dmg
ld hl, IncGradGBPalTable_12 - 1
ld b, 4
jr RotatePalettesLeft
RotateThreePalettesLeft:: RotateThreePalettesLeft::
ldh a, [hCGB]
and a
jr z, .dmg
ld hl, IncGradGBPalTable_07 - 1 ld hl, IncGradGBPalTable_07 - 1
ld b, 3 ld b, 3
jr RotatePalettesLeft
.dmg
ld hl, IncGradGBPalTable_15 - 1
ld b, 3
RotatePalettesLeft:: RotatePalettesLeft::
; Rotate palettes to the left and fill with loaded colors from the right ; 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 ; 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_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 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 ldh [rBGP], a
push af push af
; Don't need to be here if DMG
ldh a, [hCGB]
and a
jr z, .end
push hl push hl
push de push de
push bc push bc
@ -108,7 +102,6 @@ DmgToCgbBGPals::
pop bc pop bc
pop de pop de
pop hl pop hl
.end
pop af pop af
ret ret
@ -123,10 +116,6 @@ DmgToCgbObjPals::
ld a, d ld a, d
ldh [rOBP1], a ldh [rOBP1], a
ldh a, [hCGB]
and a
ret z
push hl push hl
push de push de
push bc push bc
@ -161,12 +150,6 @@ DmgToCgbObjPals::
DmgToCgbObjPal0:: DmgToCgbObjPal0::
ldh [rOBP0], a ldh [rOBP0], a
push af push af
; Don't need to be here if not CGB
ldh a, [hCGB]
and a
jr z, .dmg
push hl push hl
push de push de
push bc push bc
@ -191,19 +174,12 @@ DmgToCgbObjPal0::
pop bc pop bc
pop de pop de
pop hl pop hl
.dmg
pop af pop af
ret ret
DmgToCgbObjPal1:: DmgToCgbObjPal1::
ldh [rOBP1], a ldh [rOBP1], a
push af push af
ldh a, [hCGB]
and a
jr z, .dmg
push hl push hl
push de push de
push bc push bc
@ -228,8 +204,6 @@ DmgToCgbObjPal1::
pop bc pop bc
pop de pop de
pop hl pop hl
.dmg
pop af pop af
ret ret
@ -286,10 +260,6 @@ endr
ret ret
ClearVBank1:: ClearVBank1::
ldh a, [hCGB]
and a
ret z
ld a, 1 ld a, 1
ldh [rVBK], a ldh [rVBK], a
@ -306,9 +276,6 @@ GSReloadPalettes:: ; dummied out
ret ret
ReloadSpritesNoPalettes:: ReloadSpritesNoPalettes::
ldh a, [hCGB]
and a
ret z
ldh a, [rSVBK] ldh a, [rSVBK]
push af push af
ld a, BANK(wBGPals2) ld a, BANK(wBGPals2)

View File

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

View File

@ -177,7 +177,7 @@ VBlank1::
ldh a, [hSCY] ldh a, [hSCY]
ldh [rSCY], a ldh [rSCY], a
call UpdatePals call UpdateCGBPals
jr c, .done jr c, .done
call UpdateBGMap call UpdateBGMap
@ -227,24 +227,6 @@ VBlank1::
ldh [rIF], a ldh [rIF], a
ret 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:: VBlank3::
; scx, scy ; scx, scy
; palettes ; palettes

View File

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