DSprtn / GTFO_VR_Plugin

A plugin to add full roomscale Virtual Reality support to your favorite game!
MIT License
143 stars 13 forks source link

Fixed watch objectives, include progressions #36

Closed Nordskog closed 2 years ago

Nordskog commented 2 years ago

What?

This PR fixes the objectives displayed on the watch.

Previously the watch would display the mainObjectiveand mainSubObjective. As of writing these ultimately get added to progressions, along with any other progression objectives, so we just display all the progressions.

All the information normally visible in the upper-left corner of the screen should now be visible on the watch, including things like key names and uplink IP addresses.

https://i.imgur.com/Zm4Hrxx.jpg https://i.imgur.com/K2OkJJv.jpg https://i.imgur.com/64GOnmB.jpg

How?

Ultimately we just iterate through PUI_GameObjectives.m_progressionObjectives. The problem lies in getting the correct instance of PUI_GameObjectives, and knowing when to check it for changes.

As before, PlayerGuiLayer.UpdateObjectives() is patched to intercept when the main objective changes. Unfortunately, its other objective-updated functions are not called when you would expect them to be, and most notably PlayerGuiLayer.SetProgressionObjective() is never called.

Since PlayerGuiLayer.SetProgressionObjective() is never called we are kind of stuck with patching PUI_GameObjectives.SetProgressionObjective() and its brother PUI_GameObjectives.RemoveProgressionObjective() instead, but there are multiple instances of PUI_GameObjectives, and some are either empty or don't list the same set of objectives.

We store an reference to the relevant instance of PUI_GameObjectives() before PlayerGuiLayer.UpdateObjectives(), and only execute the above patches if they are called by the same instance.

Details

The text was made slightly transparent, as otherwise it glows brightly and all the colors appear pure white. \<Indent> is removed from the text as it breaks the formatting.

There are 3 "layers" of objectives, presumably corresponding to main, secondary, and overload. I'm fairly sure the objectives are just swapped out wholesale for different layers, so secondary and overload objectives shouldn't break anything.