Commit 80ded3fe authored by Shockfire's avatar Shockfire

Fixed problems with some HUD mods crashing

The UI aspect ratio code was assuming that the visor bottom UI widget exists at index 26 in the chdt tag. Better to search for it by stringID and only apply changes if it's found.

(cherry picked from commit c7288518)
parent fb16f2b5
......@@ -250,9 +250,16 @@ namespace Patches
globals->HudGlobals[0].HudAttributes[0].MotionSensorOffsetX = 122.0f;
globals->HudGlobals[0].HudAttributes[0].MotionSensorOffsetY = (float)(globals->HudGlobals[0].HudAttributes[0].ResolutionHeight - 84);
// Fix the bottom of the visor
// Search for the visor bottom and fix it if found
Blam::Tags::ChudDefinition* chud = Blam::Tags::GetTag<Blam::Tags::ChudDefinition>(0x0C1E);
chud->HudWidgets[26].PlacementData[0].OffsetY = (((float)globals->HudGlobals[0].HudAttributes[0].ResolutionHeight - 1080) / 2) + 12;
for (auto &widget : chud->HudWidgets)
{
if (widget.NameStringID == 0x2ABD) // in_helmet_bottom_new
{
widget.PlacementData[0].OffsetY = (((float)globals->HudGlobals[0].HudAttributes[0].ResolutionHeight - 1080) / 2) + 12;
break;
}
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment