trigger-segfault / OpenLRR

An open source re-implementation of LEGO Rock Raiders 🪨⛏
66 stars 5 forks source link

Defence Tutorial halts after Rock Monster leaves #48

Closed trigger-segfault closed 2 years ago

trigger-segfault commented 2 years ago

Describe the issue Playing the tutorial Defending Rock Raider H.Q. halts once the first Rock Monster has departed into the wall. After tracing the NERP script, it was found that NERPFunc__GetMonstersOnLevel was returning 1 when the value should have been 0.

Expected behaviour The tutorial should be able to continue once bullying the Rock Monster enough (with the Pusher Beam) for them to leave. Instead, the script stays on this state and never enables the continue arrow.

NERPFunc__GetMonstersOnLevel is expected to return the current amount of Rock/Lava/Ice monsters in the level, but instead returns a higher count.

Steps to reproduce

  1. Start Defending Rock Raider H.Q..
  2. Play through the tutorial like normal.

Additional information


Solution

The issue was discovered to be the objectGlobs.objectPrevLevels array, which had a value of -1 for Rock Monster (Lv0) counts. This was because LegoObject_Remove incorrectly decrements objectGlobs.objectPrevLevels instead of incrementing the value.