台地結界

Revision as of 20:02, 12 May 2020 by Simple (talk | contribs) (Created page with "這個霧的原理跟遊戲裡其他的霧一樣,都是儲存在 map unit 裡的同一種物件(碰到就會觸發事情的物件)。如果 IsGet_PlayerStole2 是 fa...")
Other languages:

The Great Plateau barrier 台地結界是遊戲裡阻止林克在拿到滑翔傘前就離開初始台地的機制。

實作

台地結界一共有兩層:第一層是圍繞台地的霧,林克只要碰到霧就會被抓回來。第二層是林克的角色模組裡埋了一個檢查林克位置的機關,只要檢查失敗就抓回來。

林克拿到滑翔傘後,這兩層結界會同時消失。這是因為 IsGet_PlayerStole2 這個 flag 被設成 true 了

這個霧的原理跟遊戲裡其他的霧一樣,都是儲存在 map unit 裡的同一種物件(碰到就會觸發事情的物件)。如果 IsGet_PlayerStole2 是 false,那遊戲就會生成霧,否則不生成。

Actor code

Even if the fog is removed or if the player manages to avoid the fog (by stasis launching for example), Link will still void out when he gets too far away from the Plateau.

It turns out that IsGet_PlayerStole2 is also checked by the executable. More precisely, its value is queried by 5 functions in the entire program. One of them is the AIDef:AI/PlayerNormal code which is responsible for handling events for the GameROMPlayer (Link) actor.

In that large AI function, the following piece of code can be seen:

if ( !sForceEnableGlidingAndSurfingAndGiveRupees && !sIsDungeon )
{
  if ( !getFlag_IsGet_PlayerStole2(false) &&
       (x < -1600.0 || x > -350.0 || z < 1400.0 || z > 2400.0) )
  {
    player->respawn_pos.x = -1021.7286376953125;
    player->respawn_pos.y = 253.31527709960938;
    player->respawn_pos.z = 1792.6009521484375;
    AI_AIBase::changeState(this, "奈落開始待ち", 0);
    return;
  }
  ...
}

A few notes:

  • 奈落開始待ち means (roughly) 'wait for abyss start'. It is the name of the AIDef:Action/PlayerHellStartWait action for the Player_Link aiprog.
  • sIsDungeon is set when GameScene generates a stage. It is false if and only if:
    • the map type isn't any of the following type: MarioClubTestDungeon, CDungeon, MainFieldDungeon
    • and (the map type isn't GameTestDungeon) or the map name is ActorViewer or in debug mode[check].
  • Essentially, what this piece of code does is force Link to void out if (a) debug flags aren't set, (b) he doesn't have the paraglider, (c) Link is not within the bounds of the following rectangle:

On the MainField (Hyrule) and AocField (Trial of the Sword) maps, Link is effectively surrounded by an infinitely high box that he is not allowed to leave until he has the paraglider.

It is a simple, hardcoded, coordinate-based check, and it is embedded in the core Player actor code, so glitching past it is impossible barring major bugs that would likely leave the game broken and unplayable.

Given that events can be delayed and that the actual voidout is done by a demo/cutscene, it is possible to get Link stuck in the PlayerHellStartWait state indefinitely and technically leave the authorized area without being voided out immediately. However, doing any kind of useful action (walking, gliding, riding a horse, etc.) is still impossible, as the paraglider check is done before handling any other regular state. As soon as Link leaves the waiting state, he will be voided out.