Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always draw the scope (same as cod4) & hide theater mode ui completely #150

Open
wants to merge 2 commits into
base: iw5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions iw5/src/Hooks/HUD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ namespace IWXMVM::IW5::Hooks::HUD
void R_AddCmdDrawStretchPic_Hook(float a1, float a2, float a3, float a4, float a5, float a6, float a7, float a8,
int a9, Structures::Material *material)
{
// always draw the scope overlay
bool isScopeTexture = std::string_view(material->info.name).starts_with("scope_overlay");
if (isScopeTexture)
{
R_AddCmdDrawStretchPic_Trampoline(a1, a2, a3, a4, a5, a6, a7, a8, a9, material);
}

bool isBloodOverlay = std::string_view(material->info.name).compare("splatter_alt") == 0;
if (isBloodOverlay)
{
Expand Down
5 changes: 5 additions & 0 deletions iw5/src/IW5Interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,11 @@ namespace IWXMVM::IW5
else
Patches::GetGamePatches().Item_GameMsgWindow_Paint.Apply();

if (hudInfo.showIconsAndText)
Patches::GetGamePatches().CG_DrawRotatedPic.Revert();
else
Patches::GetGamePatches().CG_DrawRotatedPic.Apply();

for (int i = 0; i < 3; i++)
Functions::FindDvar("cg_TeamColor_Allies")->current.color[i] = static_cast<uint8_t>(hudInfo.killfeedTeam1Color[i] * 255.0f);
for (int i = 0; i < 3; i++)
Expand Down
3 changes: 3 additions & 0 deletions iw5/src/Patches.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ namespace IWXMVM::IW5::Patches
// disable red tint of screen when damaged
NopPatch<8> CG_PainVisionUpdate{GetGameAddresses().CG_PainVisionUpdate_Location(),
PatchApplySetting::Deferred};

// disable theater mode ui when showIconsAndText is false
ReturnPatch CG_DrawRotatedPic{GetGameAddresses().CG_DrawRotatedPic(), PatchApplySetting::Immediately};
};

inline IW5Patches& GetGamePatches()
Expand Down
1 change: 1 addition & 0 deletions iw5/src/Signatures.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ namespace IWXMVM::IW5::Signatures
Sig("74 0E 83 3D ?? ?? ?? ?? ?? 0F 95 C0", GAType::Code, -7) > CG_DrawShellshockBlend;
Sig("50 E8 ?? ?? ?? ?? 83 C4 04 85 C0 0F 84 E9 00 00 00", GAType::Code, -5) > Item_GameMsgWindow_Paint;
Sig("0F 84 32 01 00 00 8D 50 01", GAType::Code, -7) > R_AddCmdDrawText;
Sig("52 8D 44 24 20 50 8D 4C 24 20 51 8D 54 24 20 52 56", GAType::Code, -18) > CG_DrawRotatedPic;
Sig("85 F6 75 06 8B 35 ?? ?? ?? ?? 8B 46 54 8B 40 08 83 78 30 00 75 06 83 78 20 00 74 21", GAType::Code,
-5) > R_AddCmdDrawTextWithEffects;
Sig("83 C4 28 3B 35", GAType::Code, -5, Lambda::FollowCodeFlow) > R_AddCmdDrawStretchPic;
Expand Down