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

@@ -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