Identify some time-related data

This commit is contained in:
Rangi 2020-08-11 14:12:59 -04:00
parent 64e2cff5c4
commit ed3e70b97c
8 changed files with 36 additions and 30 deletions

View File

@ -32,6 +32,7 @@ MAP_NONE EQU 0
const PALETTE_NITE const PALETTE_NITE
const PALETTE_MORN const PALETTE_MORN
const PALETTE_DARK const PALETTE_DARK
NUM_MAP_PALETTES EQU const_value
; FishGroups indexes (see data/wild/fish.asm) ; FishGroups indexes (see data/wild/fish.asm)
const_def const_def

View File

@ -123,6 +123,9 @@ DARKNESS EQU 1 << DARKNESS_F
ANYTIME EQU MORN | DAY | NITE ANYTIME EQU MORN | DAY | NITE
; wTimeOfDayPalset::
DARKNESS_PALSET EQU (DARKNESS_F << 6) | (DARKNESS_F << 4) | (DARKNESS_F << 2) | DARKNESS_F
; wBattleAnimFlags:: ; wBattleAnimFlags::
const_def const_def
const BATTLEANIM_STOP_F ; 0 const BATTLEANIM_STOP_F ; 0

View File

@ -270,7 +270,7 @@ StartTrainerBattle_Flash:
.DoFlashAnimation: .DoFlashAnimation:
ld a, [wTimeOfDayPalset] ld a, [wTimeOfDayPalset]
cp %11111111 ; dark cave cp DARKNESS_PALSET
jr z, .done jr z, .done
ld hl, wcf64 ld hl, wcf64
ld a, [hl] ld a, [hl]
@ -651,13 +651,13 @@ StartTrainerBattle_LoadPokeBallGraphics:
jr .nextscene jr .nextscene
.cgb .cgb
ld hl, .daypals ld hl, .pals
ld a, [wTimeOfDayPal] ld a, [wTimeOfDayPal]
maskbits NUM_DAYTIMES maskbits NUM_DAYTIMES
cp DARKNESS_F cp DARKNESS_F
jr nz, .daytime jr nz, .not_dark
ld hl, .nightpals ld hl, .darkpals
.daytime .not_dark
ldh a, [rSVBK] ldh a, [rSVBK]
push af push af
ld a, BANK(wBGPals1) ld a, BANK(wBGPals1)
@ -702,11 +702,11 @@ StartTrainerBattle_LoadPokeBallGraphics:
pop hl pop hl
ret ret
.daypals .pals
INCLUDE "gfx/overworld/trainer_battle_day.pal" INCLUDE "gfx/overworld/trainer_battle.pal"
.nightpals .darkpals
INCLUDE "gfx/overworld/trainer_battle_nite.pal" INCLUDE "gfx/overworld/trainer_battle_dark.pal"
.loadpokeballgfx .loadpokeballgfx
ld a, [wOtherTrainerClass] ld a, [wOtherTrainerClass]

View File

@ -289,7 +289,7 @@ FlashFunction:
pop hl pop hl
jr c, .useflash jr c, .useflash
ld a, [wTimeOfDayPalset] ld a, [wTimeOfDayPalset]
cp %11111111 ; 3, 3, 3, 3 cp DARKNESS_PALSET
jr nz, .notadarkcave jr nz, .notadarkcave
.useflash .useflash
call UseFlash call UseFlash

View File

@ -925,7 +925,7 @@ FlickeringCaveEntrancePalette:
ret nz ret nz
; We only want to be here if we're in a dark cave. ; We only want to be here if we're in a dark cave.
ld a, [wTimeOfDayPalset] ld a, [wTimeOfDayPalset]
cp %11111111 ; 3,3,3,3 cp DARKNESS_PALSET
ret nz ret nz
ldh a, [rSVBK] ldh a, [rSVBK]

View File

@ -190,7 +190,7 @@ ReplaceTimeOfDayPals:
ld a, [wMapTimeOfDay] ld a, [wMapTimeOfDay]
cp PALETTE_DARK cp PALETTE_DARK
jr z, .NeedsFlash jr z, .NeedsFlash
and $7 maskbits NUM_MAP_PALETTES
add l add l
ld l, a ld l, a
ld a, 0 ld a, 0
@ -204,55 +204,57 @@ ReplaceTimeOfDayPals:
ld a, [wStatusFlags] ld a, [wStatusFlags]
bit STATUSFLAGS_FLASH_F, a bit STATUSFLAGS_FLASH_F, a
jr nz, .UsedFlash jr nz, .UsedFlash
ld a, %11111111 ; 3, 3, 3, 3 ld a, DARKNESS_PALSET
ld [wTimeOfDayPalset], a ld [wTimeOfDayPalset], a
ret ret
.UsedFlash: .UsedFlash:
ld a, %10101010 ; 2, 2, 2, 2 ld a, (NITE_F << 6) | (NITE_F << 4) | (NITE_F << 2) | NITE_F
ld [wTimeOfDayPalset], a ld [wTimeOfDayPalset], a
ret ret
.BrightnessLevels: .BrightnessLevels:
dc 3, 2, 1, 0 ; actual palettes used when time is
dc 1, 1, 1, 1 ; DARKNESS_F, NITE_F, DAY_F, MORN_F
dc 2, 2, 2, 2 dc DARKNESS_F, NITE_F, DAY_F, MORN_F ; PALETTE_AUTO
dc 0, 0, 0, 0 dc DAY_F, DAY_F, DAY_F, DAY_F ; PALETTE_DAY
dc 3, 3, 3, 3 dc NITE_F, NITE_F, NITE_F, NITE_F ; PALETTE_NITE
dc 3, 2, 1, 0 dc MORN_F, MORN_F, MORN_F, MORN_F ; PALETTE_MORN
dc 3, 2, 1, 0 dc DARKNESS_F, DARKNESS_F, DARKNESS_F, DARKNESS_F ; PALETTE_DARK
dc 3, 2, 1, 0 dc DARKNESS_F, NITE_F, DAY_F, MORN_F
dc DARKNESS_F, NITE_F, DAY_F, MORN_F
dc DARKNESS_F, NITE_F, DAY_F, MORN_F
GetTimePalette: GetTimePalette:
jumptable .TimePalettes, wTimeOfDay jumptable .TimePalettes, wTimeOfDay
.TimePalettes: .TimePalettes:
dw .MorningPalette dw .MorningPalette ; MORN_F
dw .DayPalette dw .DayPalette ; DAY_F
dw .NitePalette dw .NitePalette ; NITE_F
dw .DarknessPalette dw .DarknessPalette ; DARKNESS_F
.MorningPalette: .MorningPalette:
ld a, [wTimeOfDayPalset] ld a, [wTimeOfDayPalset]
and %00000011 ; 0 and %00000011
ret ret
.DayPalette: .DayPalette:
ld a, [wTimeOfDayPalset] ld a, [wTimeOfDayPalset]
and %00001100 ; 1 and %00001100
srl a srl a
srl a srl a
ret ret
.NitePalette: .NitePalette:
ld a, [wTimeOfDayPalset] ld a, [wTimeOfDayPalset]
and %00110000 ; 2 and %00110000
swap a swap a
ret ret
.DarknessPalette: .DarknessPalette:
ld a, [wTimeOfDayPalset] ld a, [wTimeOfDayPalset]
and %11000000 ; 3 and %11000000
rlca rlca
rlca rlca
ret ret