Skip to content

Commit

Permalink
Merge branch 'develop' into updategithub
Browse files Browse the repository at this point in the history
  • Loading branch information
Rackover authored Oct 13, 2024
2 parents 4cd79f4 + 5dbc504 commit de5baac
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 22 deletions.
16 changes: 9 additions & 7 deletions src/Components/Modules/AssetHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,17 +224,19 @@ namespace Components

void AssetHandler::ModifyAsset(Game::XAssetType type, Game::XAssetHeader asset, const std::string& name)
{
#ifdef DEBUG
if (type == Game::XAssetType::ASSET_TYPE_IMAGE && name[0] != ',')

if (*Game::com_developer && (*Game::com_developer)->current.enabled)
{
const auto image = asset.image;
const auto cat = static_cast<Game::ImageCategory>(image->category);
if (cat == Game::ImageCategory::IMG_CATEGORY_UNKNOWN)
if (type == Game::XAssetType::ASSET_TYPE_IMAGE && name[0] != ',')
{
Logger::Warning(Game::CON_CHANNEL_GFX, "Image {} has wrong category IMG_CATEGORY_UNKNOWN, this is an IMPORTANT ISSUE that should be fixed!\n", name);
const auto image = asset.image;
const auto cat = static_cast<Game::ImageCategory>(image->category);
if (cat == Game::ImageCategory::IMG_CATEGORY_UNKNOWN)
{
Logger::Warning(Game::CON_CHANNEL_GFX, "Image {} has wrong category IMG_CATEGORY_UNKNOWN, this is an IMPORTANT ISSUE that should be fixed!\n", name);
}
}
}
#endif

if (type == Game::ASSET_TYPE_MATERIAL && (name == "gfx_distortion_knife_trail" || name == "gfx_distortion_heat_far" || name == "gfx_distortion_ring_light" || name == "gfx_distortion_heat") && asset.material->info.sortKey >= 43)
{
Expand Down
13 changes: 11 additions & 2 deletions src/Components/Modules/AssetInterfaces/IWeapon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ namespace Assets
for (char i = 0; i < 16; ++i)
{
if (asset->weapDef->notetrackSoundMapValues[i] == NULL) break; // no more strings
builder->addScriptString(asset->weapDef->notetrackSoundMapValues[i]);

const auto soundName = Game::SL_ConvertToString(asset->weapDef->notetrackSoundMapValues[i]);

builder->loadAssetByName(Game::XAssetType::ASSET_TYPE_SOUND, soundName, false);

builder->addScriptString(soundName);
}
}

Expand All @@ -73,7 +78,11 @@ namespace Assets
for (char i = 0; i < 16; ++i)
{
if (asset->weapDef->notetrackRumbleMapValues[i] == NULL) break; // no more strings
builder->addScriptString(asset->weapDef->notetrackRumbleMapValues[i]);
const auto rumbleName = Game::SL_ConvertToString(asset->weapDef->notetrackRumbleMapValues[i]);

builder->loadAssetByName(Game::XAssetType::ASSET_TYPE_RAWFILE, std::format("rumble/{}", rumbleName), false);

builder->addScriptString(rumbleName);
}
}

Expand Down
14 changes: 7 additions & 7 deletions src/Components/Modules/PlayerMovement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,26 +321,26 @@ namespace Components
"The speed at which noclip camera moves");

BGDisableLandingSlowdown = Game::Dvar_RegisterBool("bg_disableLandingSlowdown",
false, Game::DVAR_CHEAT, "Toggle landing slowdown");
false, Game::DVAR_CODINFO, "Toggle landing slowdown");

BGBunnyHopAuto = Game::Dvar_RegisterBool("bg_bunnyHopAuto",
false, Game::DVAR_CHEAT, "Constantly jump when holding space");
false, Game::DVAR_CODINFO, "Constantly jump when holding space");

BGRocketJump = Game::Dvar_RegisterBool("bg_rocketJump",
false, Game::DVAR_CHEAT, "Enable CoD4 rocket jumps");
false, Game::DVAR_CODINFO, "Enable CoD4 rocket jumps");

BGRocketJumpScale = Game::Dvar_RegisterFloat("bg_rocketJumpScale",
64.0f, 1.0f, std::numeric_limits<float>::max(), Game::DVAR_CHEAT,
64.0f, 1.0f, std::numeric_limits<float>::max(), Game::DVAR_CODINFO,
"The scale applied to the pushback force of a rocket");

BGPlayerEjection = Game::Dvar_RegisterBool("bg_playerEjection",
true, Game::DVAR_CHEAT, "Push intersecting players away from each other");
true, Game::DVAR_CODINFO, "Push intersecting players away from each other");

BGPlayerCollision = Game::Dvar_RegisterBool("bg_playerCollision",
true, Game::DVAR_CHEAT, "Push intersecting players away from each other");
true, Game::DVAR_CODINFO, "Push intersecting players away from each other");

BGClimbAnything = Game::Dvar_RegisterBool("bg_climbAnything",
false, Game::DVAR_CHEAT, "Treat any surface as a ladder");
false, Game::DVAR_CODINFO, "Treat any surface as a ladder");

BGRecoilMultiplier = Game::Dvar_RegisterFloat("bg_recoilMultiplier",
1.0f, 0.0f, 1000.0f, Game::DVAR_CHEAT,
Expand Down
25 changes: 19 additions & 6 deletions src/Components/Modules/RawMouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ namespace Components

if (GetForegroundWindow() == Window::GetWindow())
{
if (r_fullscreen.get<bool>())
{
IN_ClampMouseMove();
}

static auto oldX = 0, oldY = 0;

auto dx = MouseRawX - oldX;
Expand All @@ -103,11 +98,14 @@ namespace Components
ScreenToClient(Window::GetWindow(), &curPos);

Gamepad::OnMouseMove(curPos.x, curPos.y, dx, dy);

auto recenterMouse = Game::CL_MouseEvent(curPos.x, curPos.y, dx, dy);

ClipCursor(NULL);

if (recenterMouse)
{
Game::IN_RecenterMouse();
RawMouse::IN_RecenterMouse();
}
}
}
Expand All @@ -134,6 +132,18 @@ namespace Components
IN_RawMouse_Init();
}

BOOL RawMouse::IN_RecenterMouse()
{
RECT clientRect;

GetClientRect(Window::GetWindow(), &clientRect);

ClientToScreen(Window::GetWindow(), std::bit_cast<POINT*>(&clientRect.left));
ClientToScreen(Window::GetWindow(), std::bit_cast<POINT*>(&clientRect.right));

return ClipCursor(&clientRect);
}

void RawMouse::IN_MouseMove()
{
if (M_RawInput.get<bool>())
Expand All @@ -154,6 +164,9 @@ namespace Components
Utils::Hook(0x467C03, IN_Init, HOOK_CALL).install()->quick();
Utils::Hook(0x64D095, IN_Init, HOOK_JUMP).install()->quick();

Utils::Hook(0x473517, IN_RecenterMouse, HOOK_CALL).install()->quick();
Utils::Hook(0x64C520, IN_RecenterMouse, HOOK_CALL).install()->quick();

M_RawInput = Dvar::Register<bool>("m_rawinput", true, Game::DVAR_ARCHIVE, "Use raw mouse input, Improves accuracy & has better support for higher polling rates");

Window::OnWndMessage(WM_INPUT, OnRawInput);
Expand Down
1 change: 1 addition & 0 deletions src/Components/Modules/RawMouse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ namespace Components
static void IN_RawMouseMove();
static void IN_RawMouse_Init();
static void IN_Init();
static BOOL IN_RecenterMouse();
};
}

0 comments on commit de5baac

Please sign in to comment.