Skip to content

Fix incorrect logic in ACT1Q2_Callback03_ChangedLevel#228

Open
devtejasx wants to merge 1 commit into
ThePhrozenKeep:masterfrom
devtejasx:fix/a1q2-changedlevel-227
Open

Fix incorrect logic in ACT1Q2_Callback03_ChangedLevel#228
devtejasx wants to merge 1 commit into
ThePhrozenKeep:masterfrom
devtejasx:fix/a1q2-changedlevel-227

Conversation

@devtejasx

Copy link
Copy Markdown

Summary

Fixes #227.

In ACT1Q2_Callback03_ChangedLevel, the second pQuestData->fState < 3 check could never trigger: the first check calls QUESTS_StateDebug(pQuestData, 3, ...), which assigns fState = 3, so by the time the second check runs the condition is always false.

As noted in the issue, vanilla handles this with a boolean stored on the stack that is set by the first check on pQuestData->fState (verified against the 1.13c assembly at D2Game.0x64EE9). This PR restores that behavior by capturing the comparison in a local const bool bStateUpdated before QUESTS_StateDebug mutates fState, and using it for both branches.

Changes

  • source/D2Game/src/QUESTS/ACT1/A1Q2.cpp: hoist the fState < 3 comparison into a stack boolean and reuse it in the second branch, matching vanilla behavior.

🤖 Generated with Claude Code

The second fState < 3 check could never trigger because the first check
calls QUESTS_StateDebug, which sets fState to 3. Vanilla keeps the
result of the first comparison in a stack boolean (verified against the
1.13c assembly at D2Game.0x64EE9 per issue ThePhrozenKeep#227), so do the same here.

Fixes ThePhrozenKeep#227
@devtejasx
devtejasx force-pushed the fix/a1q2-changedlevel-227 branch from 58279e6 to e3e6075 Compare July 8, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect logic in ACT1Q2_Callback03_ChangedLevel

1 participant