Act 5 quest objects can't be clicked: altar, Ancients' stairs, frozen Anya, Baal's portals, last portal (OperateFns 65-72 not in quest_object)

Open
#690 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
20/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp
Domain
game-dev

Research direction

Start with World::quest_object in components/game/world.hpp, which decides whether a click reaches act5_operate in components/game/world/quests/act5.cpp, then check the mode setup in components/game/gamedata/gamedata.cpp that sets which objects start selectable and named. Work through the OperateFn values the issue lists (65-72) and the object IDs (546-569), tracing each against the game.exe InitFn notes. Done when the altar, stairs, frozen Anya and portals respond to a mouse click and show their hover names in a headless save.

Written by the indexing model from the issue text.

Description

Version: v0.12.3 (macOS arm64). World::quest_object and operable in main at c5c3edda83 (2026-11-22) are the same. Follow-up to #684 (same family).

What happens

Act 5's quest objects can't be used with the mouse:

  • the Ancients' altar on Arreat Summit (546; Rite of Passage can't start);
  • the stairs to the Worldstone Keep (547);
  • frozen Anya (558);
  • the Ancients' farewell (561);
  • Baal's portals (563 / 569);
  • the last portal home (565).

act5_operate has code for all of them, but a click never reaches it. Several of them also get no hover name.

Causes

  1. Not operable. commands.cpp sets interact_npc, and tick.cpp calls operate, only for operable(...) / quest_object(...) OperateFns. Neither list has 65, 66, 67, 69, 70 or 72 (73, Tyrael's portal, is there).
  2. The altar starts unselectable. Its row has Lit2 19, so add_object starts it ON, but only Selectable0 is 1. game.exe's InitFn 72 (0x58d240, table 0x731bc0) sets its mode from the a5q5 record +0x4c, which is 0 in a new game.
  3. The portals start in mode 0, where they can't be selected. 563 / 569 (InitFn 75, 0x58e670) and 565 (InitFn 77, 0x58e710) set their mode from the a5q6 record +0x94 / +0x9c, then write 2. The quest's init (0x58e5e0) sets both fields to 1, so the first portal starts in mode 1 and later ones in mode 2. Both modes are selectable (Selectable1/2 = 1); Selectable0 is 0.
  4. 569 does nothing. act5_operate checks object_id == kChamberPortal (563) only, although 569 is OperateFn 70 too.

Fix that worked here

The diff is against v0.12.3 and sits on top of the #684 one, which is why its context shows those lines. It:

  • adds those OperateFns to quest_object;
  • leaves the altar out of the lit start;
  • starts InitFn 75/77 objects ON. This is my choice: the first portal's opening frames are skipped, where game.exe plays mode 1;
  • names OperateFn 70/72 like the hellgate in #684;
  • accepts 569 in the portal branch.

Checked headless on a real save:

  • release build: the altar has no name, and cmd interact does nothing;
  • patched: hover shows "Altar of the Heavens", and a click logs "Rite of Passage: the Ancients speak";
  • the stairs answer "the stairs stay shut", which is correct while the Rite isn't won;
  • Baal's portal in the Throne shows "The Worldstone Chamber".

Not checked by click in play: frozen Anya, Baal's portals and the last portal.

diff
--- a/components/game/gamedata/gamedata.cpp
+++ b/components/game/gamedata/gamedata.cpp
@@ -658,7 +658,12 @@
                  && oid != d2d::rules::object_ids::kHellgate   // the hellgate: a3q6's mode, 0 till Mephisto's dead (InitFn 44)
                  && npc.operate_fn != d2d::rules::operate_fn::kHellforge   // the Hellforge: a4q3's mode, 0 till the soulstone's set (InitFn 48)
                  && npc.operate_fn != d2d::rules::operate_fn::kSeal && npc.operate_fn != d2d::rules::operate_fn::kSealInfector   // the seals: shut (InitFn 56)
-                 && npc.operate_fn != d2d::rules::operate_fn::kSealDeSeis && npc.operate_fn != d2d::rules::operate_fn::kSealVizier);
+                 && npc.operate_fn != d2d::rules::operate_fn::kSealDeSeis && npc.operate_fn != d2d::rules::operate_fn::kSealVizier
+                 && npc.operate_fn != 65);   // LOCAL PATCH (act5 objects): the Ancients' altar (546): a5q5's mode, record +0x4c, 0 at a new game (InitFn 72, 0x58d240); ON had it unselectable
+    // LOCAL PATCH (act5 objects): Baal's portals (563 / 569, InitFn 75 0x58e670) and the last portal (565, InitFn 77 0x58e710)
+    // take a5q6's record +0x94 / +0x9c, which its init sets to 1 (0x58e5e0), then 2: mode 1 or 2, both selectable. Mode 0 had
+    // them unselectable and nameless. Mode 2 here (the open loop; the first one's opening frames are skipped).
+    if (objects.get(row, "InitFn") == "75" || objects.get(row, "InitFn") == "77") init_mode = "ON";
     npc.mode   = init_mode && !npc.preoperated ? init_mode : lit_mode ? "ON" : "NU";
     // Hover name when selectable in its start mode (Selectable0 = NU,
     // 2 = ON): objects.txt Name through the string tables.
@@ -678,7 +683,8 @@
     // Its own Name for then (ingame.cpp hides it while it is shut).
     // LOCAL PATCH (last portal): Tyrael's portal to Harrogath (566, OperateFn 73) the same: Selectable0 0, its InitFn 78
     // (0x5b5840) puts it in mode 1 or 2 (act4.cpp sets that), so it shows as "Harrogath".
-    if (npc.name.empty() && (npc.operate_fn == d2d::rules::operate_fn::kHellgate || npc.operate_fn == 73)) {
+    if (npc.name.empty() && (npc.operate_fn == d2d::rules::operate_fn::kHellgate || npc.operate_fn == 73
+                             || npc.operate_fn == 70 || npc.operate_fn == 72)) {   // LOCAL PATCH (act5 objects): 563 / 569, 565
         bool selectable_later = false;
         for (int mode = 1; mode < 8; ++mode) selectable_later |= objects.get(row, "Selectable" + std::to_string(mode)) == "1";
         if (selectable_later) {
--- a/components/game/world/quests/act5.cpp
+++ b/components/game/world/quests/act5.cpp
@@ -567,7 +567,7 @@
         // The Throne's portal (563, OperateFn 70, FUN_0058e6a0): with Baal gone
         // in, to the Chamber (FUN_0053aec0(0x84, 11): its town-portal tile);
         // elsewhere back to the Throne.
-        if (object.object_id == d2d::rules::EveQuest::kChamberPortal) {
+        if (object.object_id == d2d::rules::EveQuest::kChamberPortal || object.object_id == 569) {   // LOCAL PATCH (act5 objects): 569 is OperateFn 70 too
             const bool on_throne = level->id == d2d::rules::EveQuest::kThrone;
             if (on_throne && !eve.baal_in) return true;
             const Level* dest = game_data->level(on_throne ? d2d::rules::EveQuest::kChamber : d2d::rules::EveQuest::kThrone);
--- a/components/game/world.hpp
+++ b/components/game/world.hpp
@@ (quest_object) @@
     static bool quest_object(int operate_fn) {
         using namespace d2d::rules::operate_fn;
-        return std::ranges::contains(std::array{ kCairnStone, kGibbet, kInifussTree, kSunAltar, kOrifice, kJournal, kSanctuaryPortal }, operate_fn);
+        return std::ranges::contains(std::array{ kCairnStone, kGibbet, kInifussTree, kSunAltar, kOrifice, kJournal, kSanctuaryPortal }, operate_fn)
+            // Act 5's quest objects act5_operate handles: the Ancients' altar (65), their stairs (66), frozen Anya (67),
+            // the Ancients' farewell (69), Baal's portals (70), the last portal (72).
+            || operate_fn == 65 || operate_fn == 66 || operate_fn == 67 || operate_fn == 69 || operate_fn == 70 || operate_fn == 72;
     }
Dominant language
C++
Stars
17
Forks
6
Avg merge
6h 14m
Merged PRs (30d)
570

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from psi29a/d2decomped

All issues in psi29a/d2decomped

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.