WorldMgr
Le Gestionnaire du monde (WorldMgr) gère l'écoulement du temps, les lunes de sang, les climats, la météo, brouillard, vent, éclairage, la génération procédurale des nuages, l'apparition ou non du "Lord of the Mountain" (ou Alpha), etc.
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 |
En raison de la quantité massive d'états à gérer, les différentes fonctionnalités sont réparties entre le gestionnaire principal WorldMgr et 9 sous-gestionnaires.
WorldMgr
Sous-gestionnaires
Les sous-gestionnaires sont créés dans WorldMgr::init (0x71010F43C0) et insérés dans un tableau de pointeurs (@WorldMgr+0x5c0). Tous les noms ci-dessous sont non officiels.
ID | Description |
---|---|
0 | TimeMgr: Gère le temps, les Lunes de sang, et le "Lord of the Mountain" (ou Alpha). |
1 | CloudPrMgr: Gère la génération procédurale des nuages. |
2 | ShootingStarMgr: Gère les étoiles filantes et (dans la version 1.3.3 et plus) les étoiles filantes spéciales pour la quête de Xenoblade Chronicles 2. |
3 | WeatherMgr: Gère les "éclaboussures de pluie" et la météo. |
4 | TempMgr: Gère la température du monde[check]. |
5 | ? |
6 | SkyMgr: Gère le ciel et le brouillard[check]. Contient la configuration pour tous les EnvPalettes, EnvAttributes, WeatherInfluences, les palettes de Remains, les palettes d'Indoor et les brouillards des donjons. |
7 | DofMgr: Gère la profondeur de champ[check]. Contient les paramètres liés à la profondeur de champ. |
8 | ? |
Climat
La class WorldMgr principale s'occupe de garder les paramètres liés au climat et de déterminer quel ensemble de paramètres de climat utiliser. Étrangement, WorldMgr utilise la position de l'acteur Camera pour déterminer dans quelle zone de la carte le joueur se situe (et donc quel climat utiliser), au lieu de l'acteur Joueur.
TimeMgr
TimeMgr gère tout ce qui a un rapport avec le temps, notamment les lunes de sang et les apparitions du "Lord of the Mountain" (l'Alpha)
Dans le fonctionnement interne du jeu, le temps de la journée est stocké sous la forme d'un flottant compris entre 0.0 et 360.0. 0.0 et 360.0 correspondant à minuit, 90.0 correspondant à la matinée, 180.0 correspondant à midi; etc.
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 when loading a different kind of stage -- e.g. shrine → overworld, but not shrine → shrine or overworld → overworld).
- 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.
- (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 Demo103_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.
- The game then performs #Midnight checks.
- Update time of day: there are several possible update modes. In most cases, the update mode is 0.
Mode | Description |
---|---|
0 | If Demo103_0 or Demo997_0 have been played, and if there is no active event (cutscene):
|
1, 13, 35 | Freeze time to 04:00 |
2, 14 | Freeze time to 05:00 |
3, 16, 36 | Freeze time to 07:00 |
4, 19, 37 | Freeze time to 10:00 |
5, 26, 39 | Freeze time to 17:00 |
6, 28, 40 | Freeze time to 19:00 |
7, 30, 41 | Freeze time to 21:00 |
8, 11 | Freeze time to 02:00 |
9, 42 | Freeze time to 00:00 |
10 | Freeze time to 01:00 |
12 | Freeze time to 03:00 |
15 | Freeze time to 06:00 |
17 | Freeze time to 08:00 |
18 | Freeze time to 09:00 |
20 | Freeze time to 11:00 |
21 | Freeze time to 12:00 |
22, 38 | Freeze time to 13:00 |
23 | Freeze time to 14:00 |
24 | Freeze time to 15:00 |
25 | Freeze time to 16:00 |
27 | Freeze time to 18:00 |
29 | Freeze time to 20:00 |
31 | Freeze time to 22:00 |
32 | Freeze time to 23:00 |
34 | * Add (0.0083333 * elapsed frames) to the Time of Day timer.
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.
- If the "Bloody Moon end reserve timer" is non zero, decrement it. If the new value is zero, the WM_BloodyDay flag is cleared.
- Update #Lord of the Mountain flags.
Midnight checks
The following actions happen every time the timer reaches 360.0 (midnight).
WM_NumberOfDays is incremented.
If a Blood Moon is scheduled (WM_BloodyDay is true):
- If Blood Moons are prohibited (see conditions below), set the Blood Moon timer to 2880.0.
- If they are allowed to happen, call Demo011_0 and set the Blood Moon timer to 0.0.
Scheduling new Blood Moons:
- If the FirstTouchdown flag is set (i.e. if the player has left the Great Plateau), and if the Blood Moon timer is > 2520.0 (7 in-game days):
- WM_BloodyDay is set to true, which means that a Blood Moon is scheduled for the next night.
- The Blood Moon timer is reset to 0.0.
- Otherwise, the "Bloody end reserve timer" is set to 150. This ensures that the WM_BloodyDay flag is cleared 5 in-game minutes (= 5 seconds in real life) after a Blood Moon occurs.
Blood Moon inhibitors
If any of the following conditions are true, the Blood Moon cutscene will not be triggered.
- Not on MainField (main overworld)
- IsInHyruleCastleArea is set
- LastBossGanonBeastGenerateFlag is set (fighting Dark Beast Ganon)
- BloodyMoonProhibition is set
- Wind_Relic_BattleStart is set (Vah Medoh battle)
- Electric_Relic_Battle is set (Vah Naboris battle)
- Water_Relic_BattleTime is set (Vah Ruta battle)
- SkyMgr's field_2B4 is set to 15 and field_2B8 >= 1.0
However, these do not prevent the Blood Moon timer from advancing, or the WM_BloodyDay flag from being set.
Note: Vah Rudania is missing from the list. This is normal: blood moons cannot happen during the Vah Rudania battle sequence because the BloodyMoonProhibition flag is not set.
Day/night time flag
From 00:00 to 06:00 (closed interval) and from 18:00 to 00:00 (closed interval), WM_DaytimeFlag is set to false and WM_NighttimeFlag is true.
In any other case, WM_DaytimeFlag is set to true and WM_NighttimeFlag to false.
Time division, IsMorning, IsNoon, etc.
Start | End | Division | Time type (1) | Time type (2) |
---|---|---|---|---|
04:00 | 05:00 | 0 | MorningA | Morning_A1 |
05:00 | 07:00 | 0 | MorningA | Morning_A2 |
07:00 | 10:00 | 1 | MorningB | Morning_B |
10:00 | 13:00 | 2 | NoonA | Noon_A |
13:00 | 17:00 | 3 | NoonB | Noon_B |
17:00 | 19:00 | 4 | EveningA | Evening_A |
19:00 | 21:00 | 5 | EveningB | Evening_B |
21:00 | 00:00 | 6 | NightA | Night_A |
00:00 | 04:00 | 7 | NightB | Night_B |
Note: all intervals include the start time and exclude the end time.
Moon type
The moon type is calculated based on the number of in-game days (WM_NumberOfDays). The exact formula is (numberOfDays + x + 1) % 8
[1], where x is equal to 1 if the current time is > 180.0 (noon) and % is the modulo operator.
If a moon type was set manually (for instance using AIDef:Action/EventSetMoonType), that value will be used as the moon type.
The moon type is returned by AIDef:Query/WhatMoonName, which some NPC event flows use to check the current moon phase. However, the moon schedule has nothing to do with the blood moon schedule.
Lord of the Mountain
The Lord of the Mountain appears whenever the AnimalMaster_Appearance flag is set. Its value is managed by a simple state machine.
Note that whenever a stage is unloaded, the AnimalMaster_Appearance flag is reset to false.
State 0 - Wait for conditions
If the following three conditions are true:
- The #Moon type is 5 (waxing crescent)
- The AnimalMaster_Existence flag is false (the LotM must not already be spawned)
- The current map area number is not 64 ("HyruleHill", presumably the Satori Mountain area)
then the game generates a random "appearance hour" in the [0 .. 22] interval and goes into state 1.
State 1 - Wait for the appearance time
If the player is in map area 64, the state is reset back to 0.
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 - Satori Mountain is glowing
After one hour has elapsed, the current day of the week is stored and the state is set to 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.
State 4 - Despawned
The game waits for the moon type to be 5, before going back to state 0.
WeatherMgr
This section needs expansion. You can help by adding to it. |
Weather types
Value | Name |
---|---|
0 | Bluesky |
1 | Cloudy |
2 | Rain |
3 | HeavyRain |
4 | Snow |
5 | HeavySnow |
6 | ThunderStorm |
7 | ThunderRain |
8 | BlueskyRain |
- ↑ 0x71010E8200