Further remove unnecessary DMG/SGB checking (#7) and remove SGB layouts and palette data (#1)

This commit is contained in:
xCrystal 2023-07-26 17:01:20 +02:00
parent acd022d765
commit d30b9dd60f
68 changed files with 284 additions and 1826 deletions

View File

@ -1,40 +1,39 @@
; CGBLayoutJumptable indexes (see engine/gfx/cgb_layouts.asm)
; SGBLayoutJumptable indexes (see engine/gfx/sgb_layouts.asm)
const_def
const SCGB_BATTLE_GRAYSCALE
const SCGB_BATTLE_COLORS
const SCGB_POKEGEAR_PALS
const SCGB_STATS_SCREEN_HP_PALS
const SCGB_POKEDEX
const SCGB_SLOT_MACHINE
const SCGB_BETA_TITLE_SCREEN
const SCGB_GS_INTRO
const SCGB_DIPLOMA
const SCGB_MAPPALS
const SCGB_PARTY_MENU
const SCGB_EVOLUTION
const SCGB_GS_TITLE_SCREEN
const SCGB_0D
const SCGB_MOVE_LIST
const SCGB_BETA_PIKACHU_MINIGAME
const SCGB_POKEDEX_SEARCH_OPTION
const SCGB_BETA_POKER
const SCGB_POKEPIC
const SCGB_MAGNET_TRAIN
const SCGB_PACKPALS
const SCGB_TRAINER_CARD
const SCGB_POKEDEX_UNOWN_MODE
const SCGB_BILLS_PC
const SCGB_UNOWN_PUZZLE
const SCGB_GAMEFREAK_LOGO
const SCGB_PLAYER_OR_MON_FRONTPIC_PALS
const SCGB_TRADE_TUBE
const SCGB_TRAINER_OR_MON_FRONTPIC_PALS
const SCGB_1D
DEF NUM_SCGB_LAYOUTS EQU const_value
const CGB_BATTLE_GRAYSCALE
const CGB_BATTLE_COLORS
const CGB_POKEGEAR_PALS
const CGB_STATS_SCREEN_HP_PALS
const CGB_POKEDEX
const CGB_SLOT_MACHINE
const CGB_BETA_TITLE_SCREEN
const CGB_GS_INTRO
const CGB_DIPLOMA
const CGB_MAPPALS
const CGB_PARTY_MENU
const CGB_EVOLUTION
const CGB_GS_TITLE_SCREEN
const CGB_0D
const CGB_MOVE_LIST
const CGB_BETA_PIKACHU_MINIGAME
const CGB_POKEDEX_SEARCH_OPTION
const CGB_BETA_POKER
const CGB_POKEPIC
const CGB_MAGNET_TRAIN
const CGB_PACKPALS
const CGB_TRAINER_CARD
const CGB_POKEDEX_UNOWN_MODE
const CGB_BILLS_PC
const CGB_UNOWN_PUZZLE
const CGB_GAMEFREAK_LOGO
const CGB_PLAYER_OR_MON_FRONTPIC_PALS
const CGB_TRADE_TUBE
const CGB_TRAINER_OR_MON_FRONTPIC_PALS
const CGB_1D
DEF NUM_CGB_LAYOUTS EQU const_value
DEF SCGB_PARTY_MENU_HP_BARS EQU $fc
DEF SCGB_DEFAULT EQU $ff
DEF CGB_PARTY_MENU_HP_BARS EQU $fc
DEF CGB_DEFAULT EQU $ff
; GetCrystalCGBLayout arguments (see engine/gfx/crystal_layouts.asm)
const_def
@ -42,7 +41,7 @@ DEF SCGB_DEFAULT EQU $ff
const CRYSTAL_CGB_MOBILE_1
const CRYSTAL_CGB_NAME_CARD
; PredefPals indexes (see gfx/sgb/predef.pal)
; PredefPals indexes (see gfx/predef/predef.pal)
; GetPredefPal arguments (see engine/gfx/color.asm)
const_def
const PREDEFPAL_ROUTES
@ -125,34 +124,3 @@ DEF SCGB_DEFAULT EQU $ff
const PREDEFPAL_GAMEFREAK_LOGO_OB
const PREDEFPAL_GAMEFREAK_LOGO_BG
DEF NUM_PREDEF_PALS EQU const_value
; SGB system command codes
; http://gbdev.gg8.se/wiki/articles/SGB_Functions#SGB_System_Command_Table
const_def
const SGB_PAL01
const SGB_PAL23
const SGB_PAL03
const SGB_PAL12
const SGB_ATTR_BLK
const SGB_ATTR_LIN
const SGB_ATTR_DIV
const SGB_ATTR_CHR
const SGB_SOUND
const SGB_SOU_TRN
const SGB_PAL_SET
const SGB_PAL_TRN
const SGB_ATRC_EN
const SGB_TEST_EN
const SGB_ICON_EN
const SGB_DATA_SND
const SGB_DATA_TRN
const SGB_MLT_REQ
const SGB_JUMP
const SGB_CHR_TRN
const SGB_PCT_TRN
const SGB_ATTR_TRN
const SGB_ATTR_SET
const SGB_MASK_EN
const SGB_OBJ_TRN
DEF PALPACKET_LENGTH EQU $10

View File

@ -1,8 +0,0 @@
; Crystal does not support SGB, so this is unused.
MapGroupRoofSGBPalInds:
; entries correspond to map groups
table_width 1, MapGroupRoofSGBPalInds
db PREDEFPAL_ROUTES
db PREDEFPAL_OLIVINE
assert_table_length NUM_MAP_GROUPS + 1

View File

@ -55,8 +55,7 @@ PredefPointers::
add_predef GetUnownLetter
add_predef LoadPoisonBGPals
add_predef DummyPredef2F
add_predef InitSGBBorder
add_predef LoadSGBLayout
add_predef LoadCGBLayout
add_predef Pokedex_GetArea
add_predef Unused_CheckShininess
add_predef DoBattleTransition

View File

@ -1,133 +0,0 @@
; macros taken from pokered's data/sgb_packets.asm
; names taken from pandocs
; http://gbdev.gg8.se/wiki/articles/SGB_Functions#SGB_Palette_Commands
MACRO sgb_pal_trn
db (SGB_PAL_TRN << 3) + 1
ds 15
ENDM
MACRO sgb_mlt_req
db (SGB_MLT_REQ << 3) + 1
db \1 - 1
ds 14
ENDM
MACRO sgb_chr_trn
db (SGB_CHR_TRN << 3) + 1
db \1 + (\2 << 1)
ds 14
ENDM
MACRO sgb_pct_trn
db (SGB_PCT_TRN << 3) + 1
ds 15
ENDM
MACRO sgb_mask_en
db (SGB_MASK_EN << 3) + 1
db \1
ds 14
ENDM
MACRO sgb_data_snd
db (SGB_DATA_SND << 3) + 1
dw \1 ; address
db \2 ; bank
db \3 ; length (1-11)
ENDM
; Crystal does not support SGB, so this is unused.
PalTrnPacket: sgb_pal_trn
MltReq1Packet: sgb_mlt_req 1
MltReq2Packet: sgb_mlt_req 2
ChrTrnPacket: sgb_chr_trn 0, 0
PctTrnPacket: sgb_pct_trn
MaskEnFreezePacket: sgb_mask_en 1
MaskEnCancelPacket: sgb_mask_en 0
; These are packets containing SNES code.
; This set of packets is found in several Japanese SGB-compatible titles.
; It appears to be part of NCL's SGB devkit.
DataSndPacket1:
sgb_data_snd $085d, $0, 11
db $8c ; cpx #$8c (2)
db $d0, $f4 ; bne -$0c
db $60 ; rts
ds 7
DataSndPacket2:
sgb_data_snd $0852, $0, 11
db $a9, $e7 ; lda #$e7
db $9f, $01, $c0, $7e ; sta $7ec001, x
db $e8 ; inx
db $e8 ; inx
db $e8 ; inx
db $e8 ; inx
db $e0 ; cpx #$8c (1)
DataSndPacket3:
sgb_data_snd $0847, $0, 11
db $c4 ; cmp #$c4 (2)
db $d0, $16 ; bne +$16
db $a5 ; lda dp
db $cb ; wai
db $c9, $05 ; cmp #$05
db $d0, $10 ; bne +$10
db $a2, $28 ; ldx #$28
DataSndPacket4:
sgb_data_snd $083c, $0, 11
db $f0, $12 ; beq +$12
db $a5 ; lda dp
db $c9, $c9 ; cmp #$c9
db $c8 ; iny
db $d0, $1c ; bne +$1c
db $a5 ; lda dp
db $ca ; dex
db $c9 ; cmp #$c4 (1)
DataSndPacket5:
sgb_data_snd $0831, $0, 11
dbw $0c, $caa5 ; tsb $caa5
db $c9, $7e ; cmp #$7e
db $d0, $06 ; bne +$06
db $a5 ; lda dp
db $cb ; wai
db $c9, $7e ; cmp #$7e
DataSndPacket6:
sgb_data_snd $0826, $0, 11
db $39 ; bne +$39 (2)
dbw $cd, $0c48 ; cmp $0c48
db $d0, $34 ; bne +$34
db $a5 ; lda dp
db $c9, $c9 ; cmp #$c9
db $80, $d0 ; bra -$30
DataSndPacket7:
sgb_data_snd $081b, $0, 11
db $ea ; nop
db $ea ; nop
db $ea ; nop
db $ea ; nop
db $ea ; nop
; $0820:
db $a9, $01 ; lda #01
dbw $cd, $0c4f ; cmp $c4f
db $d0 ; bne +$39 (1)
DataSndPacket8:
sgb_data_snd $0810, $0, 11
dbw $4c, $0820 ; jmp $0820
db $ea ; nop
db $ea ; nop
db $ea ; nop
db $ea ; nop
db $ea ; nop
db $60 ; rts
db $ea ; nop
db $ea ; nop

View File

@ -2654,7 +2654,7 @@ ForcePlayerMonChoice:
call ExitMenu
call LoadTilemapToTempTilemap
call WaitBGMap
call GetMemSGBLayout
call GetMemCGBLayout
call SetPalettes
xor a
ld c, a
@ -2673,7 +2673,7 @@ ForcePlayerMonChoice:
call DelayFrame
call _LoadHPBar
call CloseWindow
call GetMemSGBLayout
call GetMemCGBLayout
call SetPalettes
call SendOutMonText
call NewBattleMonStatus
@ -2815,8 +2815,8 @@ LostBattle:
jr nz, .LostLinkBattle
; Grayscale
ld b, SCGB_BATTLE_GRAYSCALE
call GetSGBLayout
ld b, CGB_BATTLE_GRAYSCALE
call GetCGBLayout
call SetPalettes
jr .end
@ -4890,7 +4890,7 @@ BattleMenuPKMN_Loop:
call _LoadHPBar
call CloseWindow
call LoadTilemapToTempTilemap
call GetMemSGBLayout
call GetMemCGBLayout
call SetPalettes
jp BattleMenu
@ -4970,7 +4970,7 @@ TryPlayerSwitch:
call ClearSprites
call _LoadHPBar
call CloseWindow
call GetMemSGBLayout
call GetMemCGBLayout
call SetPalettes
ld a, [wCurPartyMon]
ld [wCurBattleMon], a
@ -6795,8 +6795,8 @@ FinishBattleAnim:
push bc
push de
push hl
ld b, SCGB_BATTLE_COLORS
call GetSGBLayout
ld b, CGB_BATTLE_COLORS
call GetCGBLayout
call SetPalettes
call DelayFrame
pop hl
@ -7880,8 +7880,8 @@ BattleIntro:
farcall ClearBattleRAM
call InitEnemy
call BackUpBGMap2
ld b, SCGB_BATTLE_GRAYSCALE
call GetSGBLayout
ld b, CGB_BATTLE_GRAYSCALE
call GetCGBLayout
ld hl, rLCDC
res rLCDC_WINDOW_TILEMAP, [hl] ; select vBGMap0/vBGMap2
call InitBattleDisplay
@ -8236,8 +8236,8 @@ _DisplayLinkRecord:
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call ByteFill
call WaitBGMap2
ld b, SCGB_DIPLOMA
call GetSGBLayout
ld b, CGB_DIPLOMA
call GetCGBLayout
call SetPalettes
ld c, 8
call DelayFrames
@ -8716,8 +8716,8 @@ InitBattleDisplay:
ldh [rWY], a
call WaitBGMap
call HideSprites
ld b, SCGB_BATTLE_COLORS
call GetSGBLayout
ld b, CGB_BATTLE_COLORS
call GetCGBLayout
call SetPalettes
ld a, $90
ldh [hWY], a

View File

@ -27,8 +27,8 @@ BattleCommand_BatonPass:
hlcoord 1, 0
lb bc, 4, 10
call ClearBox
ld b, SCGB_BATTLE_COLORS
call GetSGBLayout
ld b, CGB_BATTLE_COLORS
call GetCGBLayout
call SetPalettes
call BatonPass_LinkPlayerSwitch

View File

@ -12,7 +12,7 @@ _ReturnToBattle_UseBall:
.continue
farcall GetEnemyMonFrontpic
farcall _LoadBattleFontsHPBar
call GetMemSGBLayout
call GetMemCGBLayout
call CloseWindow
call LoadStandardMenuHeader
call WaitBGMap

View File

@ -250,8 +250,8 @@ _ShowLinkBattleParticipants:
ld [hli], a
ld [hl], "<BOLD_S>"
farcall LinkBattle_TrainerHuds ; no need to farcall
ld b, SCGB_DIPLOMA
call GetSGBLayout
ld b, CGB_DIPLOMA
call GetCGBLayout
call SetPalettes
ld a, $e4
ldh [rOBP0], a

View File

@ -1148,8 +1148,8 @@ BattleAnimCmd_BeatUp:
.done
pop af
ld [wCurPartySpecies], a
ld b, SCGB_BATTLE_COLORS
call GetSGBLayout
ld b, CGB_BATTLE_COLORS
call GetCGBLayout
pop af
ldh [rSVBK], a

View File

@ -291,11 +291,6 @@ BattleBGEffect_CycleOBPalsGrayAndYellow:
dc 2, 1, 0, 0
db -2
.PalsSGB:
dc 3, 3, 0, 0
dc 3, 0, 0, 0
db -2
BattleBGEffect_CycleMidOBPalsGrayAndYellow:
ld de, .PalsCGB
call BattleBGEffect_GetNthDMGPal
@ -307,11 +302,6 @@ BattleBGEffect_CycleMidOBPalsGrayAndYellow:
dc 3, 1, 2, 0
db -2
.PalsSGB:
dc 3, 3, 0, 0
dc 3, 0, 3, 0
db -2
BattleBGEffect_CycleBGPals_Inverted:
ld de, .Pals
call BattleBGEffect_GetNthDMGPal

View File

@ -3410,8 +3410,6 @@ BattleAnimFunction_SkyAttack:
.GBCPals:
db $ff, $aa, $55, $aa
.SGBPals:
db $ff, $ff, $00, $00
BattleAnimFunction_GrowthSwordsDance:
; Moves object in a circle where the height is 1/8 the width, while also moving upward 2 pixels per frame

View File

@ -600,8 +600,8 @@ DebugRoom_EditPagedValues:
inc a
ldh [hBGMapMode], a
call WaitBGMap
ld b, SCGB_DIPLOMA
call GetSGBLayout
ld b, CGB_DIPLOMA
call GetCGBLayout
call SetPalettes
.resume
call DelayFrame

View File

@ -74,8 +74,8 @@ DisplayCaughtContestMonStats:
ld [wOptions], a
call WaitBGMap
ld b, SCGB_DIPLOMA
call GetSGBLayout
ld b, CGB_DIPLOMA
call GetCGBLayout
call SetPalettes
ret

View File

@ -29,8 +29,8 @@ PlaceDiplomaOnScreen:
call PlaceString
call EnableLCD
call WaitBGMap
ld b, SCGB_DIPLOMA
call GetSGBLayout
ld b, CGB_DIPLOMA
call GetCGBLayout
call SetPalettes
call DelayFrame
ret

View File

@ -15,8 +15,8 @@ BlindingFlash:
set STATUSFLAGS_FLASH_F, [hl]
farcall ReplaceTimeOfDayPals
farcall UpdateTimeOfDayPal
ld b, SCGB_MAPPALS
call GetSGBLayout
ld b, CGB_MAPPALS
call GetCGBLayout
farcall LoadOW_BGPal7
farcall FadeInPalettes
ret

View File

@ -254,8 +254,8 @@ AnimateHOFMonEntrance:
call WaitBGMap
xor a
ldh [hBGMapMode], a
ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
ld b, CGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetCGBLayout
call SetPalettes
call HOF_SlideBackpic
xor a
@ -387,8 +387,8 @@ _HallOfFamePC:
ld de, .EmptyString
call PlaceString
call WaitBGMap
ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
ld b, CGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetCGBLayout
call SetPalettes
decoord 6, 5
ld c, ANIM_MON_HOF
@ -541,8 +541,8 @@ HOF_AnimatePlayerPic:
xor a
ldh [hBGMapMode], a
ld [wCurPartySpecies], a
ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
ld b, CGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetCGBLayout
call SetPalettes
call HOF_SlideBackpic
xor a

View File

@ -406,8 +406,8 @@ MagnetTrain_Jumptable_FirstRunThrough:
ld [wTimeOfDayPal], a
ld a, TOWN
ld [wEnvironment], a
ld b, SCGB_MAPPALS
call GetSGBLayout
ld b, CGB_MAPPALS
call GetCGBLayout
call UpdateTimePals
ldh a, [rBGP]

View File

@ -3,8 +3,8 @@ MoveTutor:
call ClearBGPalettes
call ClearScreen
call DelayFrame
ld b, SCGB_PACKPALS
call GetSGBLayout
ld b, CGB_PACKPALS
call GetCGBLayout
xor a
ld [wItemAttributeValue], a
call .GetMoveTutorMove

View File

@ -4,8 +4,8 @@ Pokepic::
call MenuBox
call UpdateSprites
call ApplyTilemap
ld b, SCGB_POKEPIC
call GetSGBLayout
ld b, CGB_POKEPIC
call GetCGBLayout
xor a
ldh [hBGMapMode], a
ld a, [wCurPartySpecies]
@ -32,7 +32,7 @@ ClosePokepic::
call CopyMenuHeader
call ClearMenuBoxInterior
call WaitBGMap
call GetMemSGBLayout
call GetMemCGBLayout
xor a
ldh [hBGMapMode], a
call OverworldTextModeSwitch

View File

@ -62,8 +62,8 @@ _UnownPrinter:
ld [wTempMonDVs], a
ld [wTempMonDVs + 1], a
ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
ld b, CGB_TRAINER_OR_MON_FRONTPIC_PALS
call GetCGBLayout
call SetPalettes
.joy_loop

Some files were not shown because too many files have changed in this diff Show More