WorldMgr/zh: Difference between revisions

From ZeldaMods (Breath of the Wild)
Jump to navigation Jump to search
(Created page with "=== 月相 === 月相取決於你在遊戲裡活了幾天 (WM_NumberOfDays)。精確的式子是 <code>(numberOfDays + x + 1) % 8</code><ref>0x71010E8200</ref>,這裡的 x...")
(Created page with "如果有什麼東西直接設定月相的話 (例如 AIDef:Action/EventSetMoonType),那月相就會是設定過的值。")
Line 194: Line 194:
月相取決於你在遊戲裡活了幾天 (WM_NumberOfDays)。精確的式子是 <code>(numberOfDays + x + 1) % 8</code><ref>0x71010E8200</ref>,這裡的 x 在下午的時候是 1,上午的時候是 0。 百分號是模運算(除以八的餘數)。 也就是說,每過一次正午月相就前進一格。 從 0 開始,滿月、十六夜、下弦月、殘月、新月、眉月、上弦月、十三夜。
月相取決於你在遊戲裡活了幾天 (WM_NumberOfDays)。精確的式子是 <code>(numberOfDays + x + 1) % 8</code><ref>0x71010E8200</ref>,這裡的 x 在下午的時候是 1,上午的時候是 0。 百分號是模運算(除以八的餘數)。 也就是說,每過一次正午月相就前進一格。 從 0 開始,滿月、十六夜、下弦月、殘月、新月、眉月、上弦月、十三夜。


If a moon type was set manually (for instance using [[AIDef:Action/EventSetMoonType]]), that value will be used as the moon type.
如果有什麼東西直接設定月相的話 (例如 [[AIDef:Action/EventSetMoonType]]),那月相就會是設定過的值。


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.
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.

Revision as of 16:46, 10 May 2020

Other languages:
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

World Manager (WorldMgr) 是遊戲裡的一個子系統。 它控制時間、血月、氣候、天氣、霧、風、閃電、雲、山林霸主的出現等等。

這個子系統很大/複雜,它的功能被切成九個部分。

WorldMgr

小主管

小主管 (Sub-managers) 由 WorldMgr::init (0x71010F43C0) 生成,and inserted into a pointer array (@WorldMgr+0x5c0). 注意以下名稱不是官方名稱。

Sub-managers by ID
編號 Description
0 TimeMgr: 時間、血月、山林霸主
1 CloudPrMgr: 程序化生成的雲
2 ShootingStarMgr: 流星跟異度神劍流星 (in 1.3.3+)
3 WeatherMgr: Handles "rain splash" and 氣候、天氣
4 TempMgr: 溫度[check].
5 ?
6 SkyMgr: 天空、霧[check]. Holds the configuration for all EnvPalettes, EnvAttributes, WeatherInfluences, Remains palettes, Indoor palettes and dungeon fogs.
7 DofMgr: Handles depth of field[check]. Holds depth of field related parameters.
8 ?

氣候

WorldMgr 本身(而不是小主管)負責處理氣候那一類的事情。 氣候顯然是由玩家所在的位置決定的(在火山很熱、在山上很冷), 有趣的是,它是用攝影機所在的位置而不是林克所在的位置來決定氣候的。

TimeMgr

TimeMgr 管理所有跟時間有關的事情,例如血月何時出現,山林霸主何時出現。

遊戲內時間(小時跟分鐘)是一個 [0.0, 360.0] 範圍內的浮點數。 0.0 代表子夜,180.0 代表中午。

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

這個函數每幀呼叫一次。

  • (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.
模式 Description
0 If Demo103_0 or Demo997_0 have been played, and if there is no active event (cutscene):
  • Add (0.0083333 * elapsed frames) to the Time of Day timer. Effectively, this means that 1 in-game minute = 1 real-life second.
  • If the timer is >= 360.0, which means that a day has passed, the game subtracts 360 from the timer and then performs midnight checks.
  • 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. Effectively, this means that time will not get past 11:00 until the Great Plateau Tower is activated and the Old Man cutscene is triggered.
  • The Blood Moon timer is updated too.
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.
  • 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.

子夜檢查

下面這些是子夜檢查的內容(就是每次時間從 360.0 變成 0.0 的時候做的事情)。

增加 WM_NumberOfDays。

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.

阻止血月的理由

下面任何一件事情都會阻止血月。

  • 不在MainField (main overworld) (在神廟裡之類的地方)
  • IsInHyruleCastleArea is set(在城堡裡之類的地方)
  • LastBossGanonBeastGenerateFlag is set(在打魔獸加儂)
  • BloodyMoonProhibition is set
  • Wind_Relic_BattleStart is set (在打瓦‧梅德)
  • Electric_Relic_Battle is set (在打瓦‧娜波力斯)
  • Water_Relic_BattleTime is set (在打瓦‧露塔)
  • SkyMgr's field_2B4 is set to 15 and field_2B8 >= 1.0

請注意:即使血月被阻止,血月計時器也不會歸零,還是會繼續增加。這些理由也不能阻止 WM_BloodyDay from being set。

Note: Vah Rudania is missing from the list. This is normal and blood moons still cannot happen during the Vah Rudania battle sequence because the BloodyMoonProhibition flag is set during it.

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.

月相

月相取決於你在遊戲裡活了幾天 (WM_NumberOfDays)。精確的式子是 (numberOfDays + x + 1) % 8[1],這裡的 x 在下午的時候是 1,上午的時候是 0。 百分號是模運算(除以八的餘數)。 也就是說,每過一次正午月相就前進一格。 從 0 開始,滿月、十六夜、下弦月、殘月、新月、眉月、上弦月、十三夜。

如果有什麼東西直接設定月相的話 (例如 AIDef:Action/EventSetMoonType),那月相就會是設定過的值。

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

After one hour has elapsed, the current day of the week is stored and the state is set to 3.

State 3

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

The game waits for the moon type to be 5, before going back to state 0.

WeatherMgr

Weather types

Value Name
0 Bluesky
1 Cloudy
2 Rain
3 HeavyRain
4 Snow
5 HeavySnow
6 ThunderStorm
7 ThunderRain
8 BlueskyRain
  1. 0x71010E8200