henbagle / LE1CommunityPatch

Issue tracker for the Community Patch mod for Mass Effect 1: Legendary Edition
13 stars 0 forks source link

Can't toggle squadmate helmets from Squad Menu using hotkey #63

Closed henbagle closed 2 years ago

henbagle commented 2 years ago

Describe the bug If you enter the Squad menu by pressing the hotkey (defaults to U), you can't toggle squadmate helmets, only your own. If you enter the Squad menu by going to the pause menu and selecting Squad, the button works as intended.

To Reproduce Press the squad hotkey, which defaults to U. Select a squadmate, try to toggle helmet.

Expected behavior Squadmate helmet should toggle.

Issue reported here: https://www.pcgamingwiki.com/wiki/Mass_Effect_Legendary_Edition#Cannot_toggle_squadmate_helmets_in_Mass_Effect

Game file Probably SFXGame.pcc. Something in the ToggleHelmet function of BioSFHandler_CharacterRecord. There seems to be something odd about the squad when the menu is not accessed from the pause menu.

henbagle commented 2 years ago

FIXED. FINALLY.

P-code updated in CharacterRecord and PC_CharacterRecord GFXMovies (Startup_INT.pcc, all localizations) so that the toggleHelmetOnPress function reads as follows:

function toggleHelmetOnPress()
{
   getURL("FSCommand:" add com.UnrealMessages.PlaySound,"InvToggleHelmet");
   getURL("FSCommand:" add (com.UnrealMessages.HandlerEvent + com.UnrealMessages.CharacterRecordHandler + String.fromCharCode(14)),"");
}

The second line of the function (second getURL call) is different from the vanilla method. This calls a "new" UnrealMessage to the CharacterRecordHandler with a key of 14.

In the BioSFHandler_CharacterRecord.HandleEvent function in SFXGame, the end of the function has been updated to read as follows:

        case 13:
            break;
        case 14:
            ToggleHelmet();
            break;
        default:
    }
}

Case 14 has been added, this is what is triggered by the "new" UnrealMessage in the scaleform.

The root of the issue was that the ToggleHelmet() UnrealScript function was being called by scaleform by an alternate method, which was triggering the function on a different instance of a BioSFHandler_CharacterRecord object than the one that was actually being used as the UI, and didn't have the correct state. This caused the toggle helmet button to always toggle the player's helmet, instead of the selected squadmate. I have no idea where this extra instance came from or what it was used for, or why this was only an issue when using the hotkey. Updating the scaleform to call this function via the "usual" method of HandleEvent with a byte code fixed the issue.

These have all been added to the HUDFixes m3m that is shipped in LE1CP, and will be included in the 1.3 update.