diff options
-rw-r--r-- | Make-evening-the-fourth-time-of-day.md | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/Make-evening-the-fourth-time-of-day.md b/Make-evening-the-fourth-time-of-day.md index ac4076f..5445e6a 100644 --- a/Make-evening-the-fourth-time-of-day.md +++ b/Make-evening-the-fourth-time-of-day.md @@ -77,20 +77,6 @@ And edit [constants/misc_constants.asm](../blob/master/constants/misc_constants. ## 2. Handle the new time boundaries in the code -Edit [engine/events/checktime.asm](../blob/master/engine/events/checktime.asm): - -```diff - .TimeOfDayTable: - db MORN_F, MORN - db DAY_F, DAY -- db NITE_F, NITE -+ db EVE_F, EVE - db NITE_F, NITE - db -1 -``` - -This will make the `checktime` script command work for `EVE`. - Edit [engine/rtc/rtc.asm](../blob/master/engine/rtc/rtc.asm): ```diff @@ -109,6 +95,20 @@ Edit [engine/rtc/rtc.asm](../blob/master/engine/rtc/rtc.asm): This will make the `GetTimeOfDay` routine return `EVE_F` for evening hours. +Edit [engine/events/checktime.asm](../blob/master/engine/events/checktime.asm): + +```diff + .TimeOfDayTable: + db MORN_F, MORN + db DAY_F, DAY +- db NITE_F, NITE ++ db EVE_F, EVE + db NITE_F, NITE + db -1 +``` + +This will make the `checktime` script command work for `EVE`. + Edit [home/map_objects.asm](../blob/master/home/map_objects.asm): ```diff @@ -150,7 +150,7 @@ Edit [gfx/tilesets/bg_tiles.pal](../blob/master/gfx/tilesets/bg_tiles.pal): + RGB 31,31,16, 31,31,16, 14,09,00, 00,00,00 ; text ``` -``` +```diff ; overworld water - RGB 23,23,31, 18,19,31, 13,12,31, 07,07,07 ; morn/day + RGB 23,23,31, 18,19,31, 13,12,31, 07,07,07 ; morn @@ -371,7 +371,12 @@ IN_DARKNESS_F EQU 3 IN_DARKNESS EQU 1 << IN_DARKNESS_F ; masked with a PALETTE_* constant ``` -Then edit [data/maps/maps.asm](../blob/master/data/maps/maps.asm): replace *all 13* uses of `PALETTE_DARK` with `PALETTE_NITE | IN_DARKNESS`. (Those are for the Whirl Islands, Silver Cave room 1, Dark Cave, and Rock Tunnel.) +Then edit [data/maps/maps.asm](../blob/master/data/maps/maps.asm): replace *all 13* uses of `PALETTE_DARK` with `PALETTE_NITE | IN_DARKNESS`. The maps affected are: + +- All 8 `WhirlIsland*` maps +- `SilverCaveRoom1` +- `DarkCaveVioletEntrance` and `DarkCaveBlackthornEntrance` +- `RockTunnel1F` and `RockTunnelB1F` Next, edit [constants/wram_constants.asm](../blob/master/constants/wram_constants.asm) again: @@ -478,7 +483,7 @@ Then edit [engine/tilesets/timeofday_pals.asm](../blob/master/engine/tilesets/ti So here's how the above code works. We have four times of day, and four brightness levels, but they have to be related by the map palette according to the data in `ReplaceTimeOfDayPals.BrightnessLevels`. For example, if the current map palette is `PALETTE_AUTO` and the current time is `NITE_F`, then the `NITE_F` column in the `PALETTE_AUTO` has the value `NITE_F`. (These relations are all pretty obvious—`PALETTE_AUTO` pairs every time of day with itself, and the other `PALETTE_`s always use the same time of day—so the whole system could probably be simplified; but it's easier to stick with what already works.) -Anyway, it used to check for `PALETTE_DARK`, and use a palette set for that which had all `DARKNESS_F` values (`DARKNESS_PALSET`). Instead, we check for the `IN_DARKNESS` mask on the `PALETTE_` value (`IN_DARKNESS_F` is bit 3, which doesn't collide with the palette bits 0–2), and use a palette set that's a sentinel value (the actual value doesn't matter, it just has to not be a real entry in the `.BrightnessLevels` table). +Anyway, it used to check for `PALETTE_DARK`, and use a palette set for that which had all `DARKNESS_F` values (`DARKNESS_PALSET`). Instead, we check for the `IN_DARKNESS` mask on the `PALETTE_` value (`IN_DARKNESS_F` is bit 3, which doesn't collide with the palette bits 0–2), and use a palette set that's a sentinel value (the actual value doesn't matter, it just has to not be a real entry in the `.BrightnessLevels` table). Also, when Flash *is* used, we're not hard-coding an all-`NITE_F` palette set; instead, it will use whatever is in the `map`. So if a map's palette is `PALETTE_DAY | IN_DARKNESS`, using Flash will make it have the day palette. There are a couple more pieces of code that check for Flash darkness, so let's fix them too. @@ -1075,6 +1080,8 @@ Edit [engine/battle/start_battle.asm](../blob/master/engine/battle/start_battle. jr .done ``` +Just like the previous step, if you skip this one, evening will use the regular wild battle music. + ## 12. The player's Mom watches TV in the evening |