Consolidate behavior of fading to/from white in overworld (#2), Fix naming screen tiles (#3) (bug fix to 6e3c5fd008)

This commit is contained in:
xCrystal 2023-08-04 23:54:53 +02:00
parent 55a38ff2de
commit f64bbf700d
12 changed files with 112 additions and 67 deletions

View File

@ -53,11 +53,10 @@ SpecialsPointers::
add_special CardFlip add_special CardFlip
add_special UnusedMemoryGame ; unused add_special UnusedMemoryGame ; unused
add_special ClearBGPalettesBufferScreen ; unused add_special ClearBGPalettesBufferScreen ; unused
add_special FadeOutPalettes add_special FadeOutPalettesToWhite
add_special BattleTowerFade add_special FadeOutPalettesToBlack
add_special FadeBlackQuickly add_special FadeInPalettesFromWhite
add_special FadeInPalettes add_special FadeInPalettesFromBlack
add_special FadeInQuickly
add_special ReloadSpritesNoPalettes ; bank 0 add_special ReloadSpritesNoPalettes ; bank 0
add_special ClearBGPalettes ; bank 0 add_special ClearBGPalettes ; bank 0
add_special UpdateTimePals ; bank 0 add_special UpdateTimePals ; bank 0

View File

@ -33,8 +33,8 @@ MapSetupCommands:
add_mapsetup LoadMapAttributes ; 1a add_mapsetup LoadMapAttributes ; 1a
add_mapsetup LoadMapAttributes_SkipObjects ; 1b add_mapsetup LoadMapAttributes_SkipObjects ; 1b
add_mapsetup ClearBGPalettes ; 1c add_mapsetup ClearBGPalettes ; 1c
add_mapsetup FadeOutPalettes ; 1d add_mapsetup FadeOutPalettesToWhite ; 1d
add_mapsetup FadeInPalettes ; 1e add_mapsetup FadeInPalettesFromWhite ; 1e
add_mapsetup GetMapScreenCoords ; 1f add_mapsetup GetMapScreenCoords ; 1f
add_mapsetup GetWarpDestCoords ; 20 add_mapsetup GetWarpDestCoords ; 20
add_mapsetup SpawnInFacingDown ; 21 add_mapsetup SpawnInFacingDown ; 21

View File

@ -23,7 +23,7 @@ ENDM
MapSetupScript_Teleport: MapSetupScript_Teleport:
mapsetup ResetPlayerObjectAction mapsetup ResetPlayerObjectAction
MapSetupScript_Fly: MapSetupScript_Fly:
mapsetup FadeOutPalettes mapsetup FadeOutPalettesToWhite
mapsetup JumpRoamMons mapsetup JumpRoamMons
MapSetupScript_Warp: MapSetupScript_Warp:
mapsetup DisableLCD mapsetup DisableLCD
@ -45,7 +45,7 @@ MapSetupScript_Warp:
mapsetup RefreshMapSprites mapsetup RefreshMapSprites
mapsetup PlayMapMusicBike mapsetup PlayMapMusicBike
mapsetup FadeInToMusic mapsetup FadeInToMusic
mapsetup FadeInPalettes mapsetup FadeInPalettesFromWhite
mapsetup ActivateMapAnims mapsetup ActivateMapAnims
mapsetup LoadWildMonData mapsetup LoadWildMonData
db -1 ; end db -1 ; end
@ -69,7 +69,7 @@ MapSetupScript_BadWarp:
mapsetup SpawnInFacingDown mapsetup SpawnInFacingDown
mapsetup RefreshMapSprites mapsetup RefreshMapSprites
mapsetup FadeToMapMusic mapsetup FadeToMapMusic
mapsetup FadeInPalettes mapsetup FadeInPalettesFromWhite
mapsetup ActivateMapAnims mapsetup ActivateMapAnims
mapsetup LoadWildMonData mapsetup LoadWildMonData
db -1 ; end db -1 ; end
@ -95,7 +95,7 @@ MapSetupScript_Connection:
MapSetupScript_Fall: MapSetupScript_Fall:
mapsetup ResetPlayerObjectAction mapsetup ResetPlayerObjectAction
MapSetupScript_Door: MapSetupScript_Door:
mapsetup FadeOutPalettes mapsetup FadeOutPalettesToWhite
MapSetupScript_Train: MapSetupScript_Train:
mapsetup EnterMapWarp mapsetup EnterMapWarp
mapsetup LoadMapAttributes mapsetup LoadMapAttributes
@ -113,7 +113,7 @@ MapSetupScript_Train:
mapsetup LoadMapPalettes mapsetup LoadMapPalettes
mapsetup RefreshMapSprites mapsetup RefreshMapSprites
mapsetup FadeToMapMusic mapsetup FadeToMapMusic
mapsetup FadeInPalettes mapsetup FadeInPalettesFromWhite
mapsetup ActivateMapAnims mapsetup ActivateMapAnims
mapsetup LoadWildMonData mapsetup LoadWildMonData
mapsetup UpdateRoamMons mapsetup UpdateRoamMons
@ -132,7 +132,7 @@ MapSetupScript_ReloadMap:
mapsetup LoadMapPalettes mapsetup LoadMapPalettes
mapsetup RefreshMapSprites mapsetup RefreshMapSprites
mapsetup ForceMapMusic mapsetup ForceMapMusic
mapsetup FadeInPalettes mapsetup FadeInPalettesFromWhite
mapsetup ActivateMapAnims mapsetup ActivateMapAnims
mapsetup LoadWildMonData mapsetup LoadWildMonData
db -1 ; end db -1 ; end
@ -150,7 +150,7 @@ MapSetupScript_LinkReturn:
mapsetup LoadMapPalettes mapsetup LoadMapPalettes
mapsetup RefreshMapSprites mapsetup RefreshMapSprites
mapsetup PlayMapMusicBike mapsetup PlayMapMusicBike
mapsetup FadeInPalettes mapsetup FadeInPalettesFromWhite
mapsetup ActivateMapAnims mapsetup ActivateMapAnims
mapsetup LoadWildMonData mapsetup LoadWildMonData
mapsetup EnableTextAcceleration mapsetup EnableTextAcceleration
@ -171,7 +171,7 @@ MapSetupScript_Continue:
mapsetup LoadMapPalettes mapsetup LoadMapPalettes
mapsetup RefreshMapSprites mapsetup RefreshMapSprites
mapsetup PlayMapMusicBike mapsetup PlayMapMusicBike
mapsetup FadeInPalettes mapsetup FadeInPalettesFromWhite
mapsetup ActivateMapAnims mapsetup ActivateMapAnims
mapsetup LoadWildMonData mapsetup LoadWildMonData
db -1 ; end db -1 ; end

View File

@ -10,14 +10,14 @@ PlayWhirlpoolSound:
ret ret
BlindingFlash: BlindingFlash:
farcall FadeOutPalettes farcall FadeOutPalettesToWhite
ld hl, wStatusFlags ld hl, wStatusFlags
set STATUSFLAGS_FLASH_F, [hl] set STATUSFLAGS_FLASH_F, [hl]
farcall ReplaceTimeOfDayPals farcall ReplaceTimeOfDayPals
farcall UpdateTimeOfDayPal farcall UpdateTimeOfDayPal
ld b, CGB_MAPPALS ld b, CGB_MAPPALS
call GetCGBLayout call GetCGBLayout
farcall FadeInPalettes farcall FadeInPalettesFromWhite
ret ret
ShakeHeadbuttTree: ShakeHeadbuttTree:

View File

@ -41,7 +41,7 @@ RedCredits::
ld [wMusicFadeID + 1], a ld [wMusicFadeID + 1], a
ld a, 10 ld a, 10
ld [wMusicFade], a ld [wMusicFade], a
farcall FadeOutPalettes farcall FadeOutPalettesToWhite
xor a xor a
ld [wVramState], a ld [wVramState], a
ldh [hMapAnims], a ldh [hMapAnims], a
@ -63,7 +63,7 @@ HallOfFame_FadeOutMusic:
ld [wMusicFadeID + 1], a ld [wMusicFadeID + 1], a
ld a, 10 ld a, 10
ld [wMusicFade], a ld [wMusicFade], a
farcall FadeOutPalettes farcall FadeOutPalettesToWhite
xor a xor a
ld [wVramState], a ld [wVramState], a
ldh [hMapAnims], a ldh [hMapAnims], a

View File

@ -49,12 +49,12 @@ SacredAshScript:
special HealParty special HealParty
reloadmappart reloadmappart
playsound SFX_WARP_TO playsound SFX_WARP_TO
special FadeOutPalettes special FadeOutPalettesToWhite
special FadeInPalettes special FadeInPalettesFromWhite
special FadeOutPalettes special FadeOutPalettesToWhite
special FadeInPalettes special FadeInPalettesFromWhite
special FadeOutPalettes special FadeOutPalettesToWhite
special FadeInPalettes special FadeInPalettesFromWhite
waitsfx waitsfx
writetext .UseSacredAshText writetext .UseSacredAshText
playsound SFX_CAUGHT_MON playsound SFX_CAUGHT_MON

View File

@ -9,7 +9,7 @@ OverworldWhiteoutScript::
Script_Whiteout: Script_Whiteout:
writetext .WhitedOutText writetext .WhitedOutText
waitbutton waitbutton
special FadeOutPalettes special FadeOutPalettesToWhite
pause 40 pause 40
special HealParty special HealParty
checkflag ENGINE_BUG_CONTEST_TIMER checkflag ENGINE_BUG_CONTEST_TIMER

View File

@ -670,15 +670,6 @@ NamePlayer:
.Kris: .Kris:
db "KRIS@@@@@@@" db "KRIS@@@@@@@"
GSShowPlayerNamingChoices: ; unreferenced
call LoadMenuHeader
call VerticalMenu
ld a, [wMenuCursorY]
dec a
call CopyNameFromMenu
call CloseWindow
ret
StorePlayerName: StorePlayerName:
ld a, "@" ld a, "@"
ld bc, NAME_LENGTH ld bc, NAME_LENGTH

View File

@ -1,8 +1,8 @@
DEF NAMINGSCREEN_CURSOR EQU $7e DEF NAMINGSCREEN_CURSOR EQU $7e
DEF NAMINGSCREEN_BORDER EQU "■" ; $60 DEF NAMINGSCREEN_BORDER EQU "■" ; $ba
DEF NAMINGSCREEN_MIDDLELINE EQU "→" ; $eb DEF NAMINGSCREEN_MIDDLELINE EQU "▲" ; $bb
DEF NAMINGSCREEN_UNDERLINE EQU "." ; $e8 DEF NAMINGSCREEN_UNDERLINE EQU "☎" ; $bc
_NamingScreen: _NamingScreen:
call DisableSpriteUpdates call DisableSpriteUpdates
@ -832,7 +832,7 @@ LoadNamingScreenGFX:
lb bc, BANK(NamingScreenGFX_UnderLine), 1 lb bc, BANK(NamingScreenGFX_UnderLine), 1
call Get1bpp call Get1bpp
ld de, vTiles2 tile NAMINGSCREEN_BORDER ld de, vTiles0 tile NAMINGSCREEN_BORDER
ld hl, NamingScreenGFX_Border ld hl, NamingScreenGFX_Border
ld bc, 1 tiles ld bc, 1 tiles
ld a, BANK(NamingScreenGFX_Border) ld a, BANK(NamingScreenGFX_Border)

View File

@ -111,45 +111,44 @@ _UpdateTimePals::
call DmgToCgbTimePals call DmgToCgbTimePals
ret ret
FadeInPalettes:: FadeInPalettesFromWhite::
; fades from white to normal palettes in four steps
; all palettes use white color of Pal0 before step 3
call BackupWhiteColorFromBGPals1
call FillWhiteBGColor
ld c, $12 ld c, $12
call GetTimePalFade call GetTimePalFade
ld b, $4 ld b, $2
call ConvertTimePalsDecHL
call RestoreWhiteColorToBGPals1
ld c, $c
call GetTimePalFade
ld b, $2
call ConvertTimePalsDecHL call ConvertTimePalsDecHL
ret ret
FadeOutPalettes:: FadeOutPalettesToWhite::
call FillWhiteBGColor ; fades from normal palettes to white in four steps
; all palettes use white color of Pal0 after step 2
ld c, $9 ld c, $9
call GetTimePalFade call GetTimePalFade
ld b, $4 ld b, $2
call ConvertTimePalsIncHL
call FillWhiteBGColor
ld c, $f
call GetTimePalFade
ld b, $2
call ConvertTimePalsIncHL call ConvertTimePalsIncHL
ret ret
BattleTowerFade: FadeInPalettesFromBlack:
call FillWhiteBGColor
ld c, $9
call GetTimePalFade
ld b, $4
.loop
call DmgToCgbTimePals
inc hl
inc hl
inc hl
ld c, $7
call DelayFrames
dec b
jr nz, .loop
ret
FadeInQuickly:
ld c, $0 ld c, $0
call GetTimePalFade call GetTimePalFade
ld b, $4 ld b, $4
call ConvertTimePalsIncHL call ConvertTimePalsIncHL
ret ret
FadeBlackQuickly: FadeOutPalettesToBlack:
ld c, $9 ld c, $9
call GetTimePalFade call GetTimePalFade
ld b, $4 ld b, $4
@ -157,6 +156,7 @@ FadeBlackQuickly:
ret ret
FillWhiteBGColor: FillWhiteBGColor:
; copy white palette of wBGPals1 Pal0 into white palette of wBGPals1 Pal1-Pal6
ldh a, [rSVBK] ldh a, [rSVBK]
push af push af
ld a, BANK(wBGPals1) ld a, BANK(wBGPals1)
@ -184,6 +184,60 @@ endr
ldh [rSVBK], a ldh [rSVBK], a
ret ret
BackupWhiteColorFromBGPals1:
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals1)
ldh [rSVBK], a
ld hl, wBGPals1
ld de, wBGPalsRegularWhiteColors
ld c, 8
.loop
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
rept PALETTE_SIZE - 1 * PAL_COLOR_SIZE
inc hl
endr
dec c
jr nz, .loop
pop af
ldh [rSVBK], a
ret
RestoreWhiteColorToBGPals1:
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals1)
ldh [rSVBK], a
ld hl, wBGPalsRegularWhiteColors
ld de, wBGPals1
ld c, 8
.loop
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
rept PALETTE_SIZE - 1 * PAL_COLOR_SIZE
inc de
endr
dec c
jr nz, .loop
pop af
ldh [rSVBK], a
ret
ReplaceTimeOfDayPals: ReplaceTimeOfDayPals:
ld a, [wMapTimeOfDay] ld a, [wMapTimeOfDay]
bit IN_DARKNESS_F, a bit IN_DARKNESS_F, a

View File

@ -1890,7 +1890,7 @@ FadeToMenu::
xor a xor a
ldh [hBGMapMode], a ldh [hBGMapMode], a
call LoadStandardMenuHeader call LoadStandardMenuHeader
farcall FadeOutPalettes farcall FadeOutPalettesToWhite
call ClearSprites call ClearSprites
call DisableSpriteUpdates call DisableSpriteUpdates
ret ret
@ -1913,7 +1913,7 @@ FinishExitMenu::
ld b, CGB_MAPPALS ld b, CGB_MAPPALS
call GetCGBLayout call GetCGBLayout
call WaitBGMap2 call WaitBGMap2
farcall FadeInPalettes farcall FadeInPalettesFromWhite
call EnableSpriteUpdates call EnableSpriteUpdates
ret ret

View File

@ -2621,8 +2621,6 @@ wOBPals2:: ds 8 palettes
wLYOverrides:: ds SCREEN_HEIGHT_PX wLYOverrides:: ds SCREEN_HEIGHT_PX
wLYOverridesEnd:: wLYOverridesEnd::
ds 1
wMagnetTrain:: ; used only for BANK(wMagnetTrain) wMagnetTrain:: ; used only for BANK(wMagnetTrain)
wMagnetTrainDirection:: db wMagnetTrainDirection:: db
wMagnetTrainInitPosition:: db wMagnetTrainInitPosition:: db
@ -2630,7 +2628,10 @@ wMagnetTrainHoldPosition:: db
wMagnetTrainFinalPosition:: db wMagnetTrainFinalPosition:: db
wMagnetTrainPlayerSpriteInitX:: db wMagnetTrainPlayerSpriteInitX:: db
ds 106 ; Used by FadeInPalettesFromWhite
wBGPalsRegularWhiteColors:: ds 8 * PAL_COLOR_SIZE
ds 91
align 8 align 8
wLYOverridesBackup:: ds SCREEN_HEIGHT_PX wLYOverridesBackup:: ds SCREEN_HEIGHT_PX