826
edits
(Updating to match new version of source page) |
(Updating to match new version of source page) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<languages/> | <languages/> | ||
<!--T:1--> | |||
{{Subsystem infobox|name=WorldMgr|init_addr_switch150=00000071010F2920|is_name_official=1|description=Manages world state (time, blood moons, climates, weather, etc.)}} | {{Subsystem infobox|name=WorldMgr|init_addr_switch150=00000071010F2920|is_name_official=1|description=Manages world state (time, blood moons, climates, weather, etc.)}} | ||
Line 7: | Line 8: | ||
== WorldMgr == | == WorldMgr == | ||
=== Sub-managers === | === Sub-managers === | ||
Sub-managers are created in WorldMgr::init (0x71010F43C0) and inserted into a pointer array (@WorldMgr+0x5c0). All names below are unofficial. | Sub-managers are created in WorldMgr::init (0x71010F43C0) and inserted into a pointer array (@WorldMgr+0x5c0). All names below are unofficial. | ||
<!--T:5--> | |||
{|class="wikitable" | {|class="wikitable" | ||
|+ Sub-managers by ID | |+ Sub-managers by ID | ||
Line 40: | Line 43: | ||
Internally, time of day is stored as a float in the [0.0, 360.0] range. | Internally, time of day is stored as a float in the [0.0, 360.0] range. | ||
0.0 = midnight = 360.0; 90 ≈ morning; 180.0 = noon; and so on. | |||
=== TimeMgr::init === | === TimeMgr::init === | ||
Line 47: | Line 51: | ||
=== TimeMgr::reset === | === TimeMgr::reset === | ||
This is called whenever a stage is unloaded (essentially every time the loading screen is shown). | This is called whenever a stage is unloaded (essentially every time the loading screen is shown when loading a different kind of stage -- e.g. shrine → overworld, but not shrine → shrine or overworld → overworld). | ||
* Blood Moon checks are delayed. | * Blood Moon checks are delayed. | ||
* The AnimalMaster_Appearance flag is cleared, meaning the Lord of the Mountain will not appear. | * The AnimalMaster_Appearance flag is cleared, meaning the Lord of the Mountain will not appear. | ||
Line 56: | Line 60: | ||
* (If field 0x14A is set to 99, WM_BloodyDay is set to true. [[AIDef:Action/SetBloodyMoonEnv]] uses this to force a Blood Moon to be scheduled. This feature appears to be unused.) | * (If field 0x14A is set to 99, WM_BloodyDay is set to true. [[AIDef:Action/SetBloodyMoonEnv]] uses this to force a Blood Moon to be scheduled. This feature appears to be unused.) | ||
* If both [[Demo]]103_0 and Demo997_0 have not been played, time of day is reset to 78.75 (05:15). | * If both [[Demo]]103_0 and Demo997_0 have not been played, time of day is reset to 78.75 (05:15). | ||
** Demo103_0 is the "leaving Shrine of Resurrection" cutscene, and Demo997_0 is a cutscene that doesn't exist anymore. | |||
* If [[AIDef:Action/AdvanceTime]] or anything else that changes time of day was called, the actual time is updated at this moment. | * If [[AIDef:Action/AdvanceTime]] or anything else that changes time of day was called, the actual time is updated at this moment. | ||
* [[#Midnight checks]]. | * The game then performs [[#Midnight checks]]. | ||
* '''Update time of day''': there are several possible update modes. In most cases, the update mode is 0. | * '''Update time of day''': there are several possible update modes. In most cases, the update mode is 0. | ||
Line 117: | Line 122: | ||
| 32 || Freeze time to 23:00 | | 32 || Freeze time to 23:00 | ||
|- | |- | ||
| 34 || | | 34 ||* Add (0.0083333 * elapsed frames) to the Time of Day timer. | ||
* Add (0.0083333 * elapsed frames) to the Time of Day timer. | |||
* If the timer is >= 360.0, which means that a day has passed, the game subtracts 360 from the timer. | * If the timer is >= 360.0, which means that a day has passed, the game subtracts 360 from the timer. | ||
'''Note''': In this state, the blood moon timer is never updated and its value is never checked either. | '''Note''': In this state, the blood moon timer is never updated and its value is never checked either. | ||
|} | |} | ||
* Update the [[#Day/night time flag]], the [[#Time division, IsMorning, IsNoon, etc.]] | * Update the [[#Day/night time flag]], the [[#Time division, IsMorning, IsNoon, etc.]] | ||
* If the "Bloody Moon end reserve timer" is non zero, decrement it. If the new value is zero, the WM_BloodyDay flag is cleared. | * If the "Bloody Moon end reserve timer" is non zero, decrement it. If the new value is zero, the WM_BloodyDay flag is cleared. | ||
Line 164: | Line 167: | ||
In any other case, WM_DaytimeFlag is set to true and WM_NighttimeFlag to false. | In any other case, WM_DaytimeFlag is set to true and WM_NighttimeFlag to false. | ||
=== Time division, IsMorning, IsNoon, etc. === | === Time division, IsMorning, IsNoon, etc. === <!--T:26--> | ||
{|class="wikitable" | {|class="wikitable" | ||
! Start !! End !! Division !! Time type (1) !! Time type (2) | ! Start !! End !! Division !! Time type (1) !! Time type (2) | ||
Line 186: | Line 189: | ||
| 00:00 || 04:00 || 7 || NightB || Night_B | | 00:00 || 04:00 || 7 || NightB || Night_B | ||
|} | |} | ||
Note: all intervals include the start time and exclude the end time. | Note: all intervals include the start time and exclude the end time. | ||
Line 213: | Line 217: | ||
Otherwise, the game does nothing until the current hour matches the previously generated appearance hour, at which point it sets AnimalMaster_Appearance to true (which allows the LotM to spawn) and goes into state 2. | Otherwise, the game does nothing until the current hour matches the previously generated appearance hour, at which point it sets AnimalMaster_Appearance to true (which allows the LotM to spawn) and goes into state 2. | ||
====State 2==== | ====State 2 - Satori Mountain is glowing==== | ||
After one hour has elapsed, the current day of the week is stored and the state is set to 3. | After one hour has elapsed, the current day of the week is stored and the state is set to 3. | ||
====State 3==== | ====State 3 - Prepare to despawn==== | ||
After two week day changes, ''or'' [after the in-game day of the week changes and the current hour is >= the generated appearance hour], the LotM will disappear and the state will be set to 4. | After two week day changes, ''or'' [after the in-game day of the week changes and the current hour is >= the generated appearance hour], the LotM will disappear and the state will be set to 4. | ||
====State 4==== | ====State 4 - Despawned==== | ||
The game waits for the moon type to be 5, before going back to state 0. | The game waits for the moon type to be 5, before going back to state 0. | ||
Line 247: | Line 251: | ||
|} | |} | ||
[[Category:Internals]] | <!--T:40--> | ||
[[Category:Subsystems (BotW)]] | [[Category:Internals{{#translation:}}]] | ||
[[Category:Subsystems (BotW){{#translation:}}]] |