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 UnusedMemoryGame ; unused
add_special ClearBGPalettesBufferScreen ; unused
add_special FadeOutPalettes
add_special BattleTowerFade
add_special FadeBlackQuickly
add_special FadeInPalettes
add_special FadeInQuickly
add_special FadeOutPalettesToWhite
add_special FadeOutPalettesToBlack
add_special FadeInPalettesFromWhite
add_special FadeInPalettesFromBlack
add_special ReloadSpritesNoPalettes ; bank 0
add_special ClearBGPalettes ; bank 0
add_special UpdateTimePals ; bank 0

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -111,45 +111,44 @@ _UpdateTimePals::
call DmgToCgbTimePals
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
call GetTimePalFade
ld b, $4
ld b, $2
call ConvertTimePalsDecHL
call RestoreWhiteColorToBGPals1
ld c, $c
call GetTimePalFade
ld b, $2
call ConvertTimePalsDecHL
ret
FadeOutPalettes::
call FillWhiteBGColor
FadeOutPalettesToWhite::
; fades from normal palettes to white in four steps
; all palettes use white color of Pal0 after step 2
ld c, $9
call GetTimePalFade
ld b, $4
ld b, $2
call ConvertTimePalsIncHL
call FillWhiteBGColor
ld c, $f
call GetTimePalFade
ld b, $2
call ConvertTimePalsIncHL
ret
BattleTowerFade:
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:
FadeInPalettesFromBlack:
ld c, $0
call GetTimePalFade
ld b, $4
call ConvertTimePalsIncHL
ret
FadeBlackQuickly:
FadeOutPalettesToBlack:
ld c, $9
call GetTimePalFade
ld b, $4
@ -157,6 +156,7 @@ FadeBlackQuickly:
ret
FillWhiteBGColor:
; copy white palette of wBGPals1 Pal0 into white palette of wBGPals1 Pal1-Pal6
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals1)
@ -184,6 +184,60 @@ endr
ldh [rSVBK], a
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:
ld a, [wMapTimeOfDay]
bit IN_DARKNESS_F, a

View File

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

View File

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