WorldMgr

From ZeldaMods (Breath of the Wild)
Revision as of 11:55, 30 October 2018 by imported>Leoetlino (→‎TimeMgr)
Jump to navigation Jump to search
WorldMgr
Subsystem
Official name Yes
Description Manages world state (time, blood moons, climates, weather, etc.)
Init function Switch 1.5.0: 00000071010F2920
Wii U 1.5.0: ???
Debug only No

The World Manager (WorldMgr) is responsible for managing time, blood moons, climates, weather, fog, wind, lighting, procedural generation of clouds, whether the Lord of the Mountain appears, etc.

Because of the massive amount of state to handle, functionality is split across the main WorldMgr and 9 sub-managers.

WorldMgr

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 by ID
ID Description
0 TimeMgr
1 CloudPr? Handles cloud procedural generation.
2 ???
3 Weather? Handles "rain splash" and climate weathers.
4 TemperatureMgr? (Reasonably sure about this one.)
5 ???
6 Sky and fog? Holds the configuration for all EnvPalettes, EnvAttributes, WeatherInfluences, Remains palettes, Indoor palettes and dungeon fogs.
7 DofMgr? Holds depth of field related parameters.
8 ??? (contains a BaseProcLink, so it might have something to do with actors.)

TimeMgr

TimeMgr handles everything to do with time, including Blood Moons and the Lord of the Mountain's apparition.

Internally, time of day is stored as a float in the [0.0, 360.0] range.

TimeMgr::init

  • Time is set to 78.75 (05:15).
  • Time for TotS environment is set to 78.75 (05:15) as well.
  • "Bloody Moon end reserve timer" is set to 0.

TimeMgr::reset

This is called whenever a stage is unloaded (essentially every time the loading screen is shown).

  • Blood Moon checks are delayed.
  • The AnimalMaster_Appearance flag is cleared, meaning the Lord of the Mountain will not appear.

TimeMgr::calc

This is called every frame.

  • Reload some internal state from GameDataMgr.
  • If both Demo103_0 and Demo997_0 have not been played, time of day is reset to 78.75 (05:15).
  • If AIDef:Action/AdvanceTime or anything else that changes time of day was called, the actual time is updated at this moment.
  • Blood Moon checks.
  • Update time of day.
  • If FindDungeon_Activated is false (if the player hasn't received the The Isolated Plateau quest) and if the current time is >= 165.0 (11:00), the time is forcefully set to 11:00.
  • Update Blood Moon timer.
  • Update Daytime, Night time, is morning, is noon, is evening flags.
  • Update time division.
  • Update "Bloody moon end reverse timer".
  • Update GameDataMgr state (time, number of days, Blood Moon timers).
  • Update Lord of the Mountain flags (in particular, determine if it should appear).

Blood Moon

Time division, IsMorning, IsNoon, etc.

Start End Division Flag
04:00 07:00 0 WM_IsMorningA
07:00 10:00 1 WM_IsMorningB
10:00 13:00 2 WM_IsNoonA
13:00 17:00 3 WM_IsNoonB
17:00 19:00 4 WM_IsEveningA
19:00 21:00 5 WM_IsEveningB
21:00 00:00 6 WM_IsNightA
00:00 04:00 7 WM_IsNightB

Note: all intervals include the start time and exclude the end time.

Lord of the Mountain