[Weapon] This might fix the fucked anims.

This commit is contained in:
RektInator 2017-05-30 15:58:39 +02:00
parent 150790a279
commit 652d7ff4fc
3 changed files with 22 additions and 2 deletions

View File

@ -63,12 +63,12 @@ namespace Components
}
}
void ServerCommands::OnServerCommandFailPrint(int type, const char *trash, ...)
void ServerCommands::OnServerCommandFailPrint(int type, const char *, ...)
{
Command::ClientParams params(*Game::cmd_id);
const char *cmd = "";
for (int i = 1; i < params.length(); i++)
for (std::size_t i = 1; i < params.length(); i++)
cmd = Utils::String::VA("%s %s", cmd, params.get(i));
Game::Com_Printf(type, "Unknown client game command: %i %s\n", lastServerCommand, cmd);

View File

@ -420,6 +420,22 @@ namespace Components
Utils::Hook::Set<DWORD>(0x4F7630, 0x12DC + (sizeof(bg_sharedAmmoCaps) - (1200 * 4)));
}
void* Weapon::LoadNoneWeaponHook()
{
// load anim scripts now, rather than a bit later on
((void(*)())0x4E46A0)();
Utils::Hook::Nop(0x4B3670, 5);
return Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_WEAPON, "none").data;
}
void __declspec(naked) Weapon::LoadNoneWeaponHookStub()
{
__asm
{
jmp LoadNoneWeaponHook
}
}
Weapon::Weapon()
{
Weapon::PatchLimit();
@ -436,6 +452,8 @@ namespace Components
// Skip double loading for fs_game
Utils::Hook::Set<BYTE>(0x4081FD, 0xEB);
Utils::Hook(0x57B4F0, LoadNoneWeaponHookStub).install()->quick();
// Don't load bounce sounds for now, it causes crashes
// TODO: Actually check the weaponfiles and/or reset the soundtable correctly!
//Utils::Hook::Nop(0x57A360, 5);

View File

@ -19,6 +19,8 @@ namespace Components
private:
static Game::XAssetHeader WeaponFileLoad(Game::XAssetType type, std::string filename);
static void PatchLimit();
static void* LoadNoneWeaponHook();
static void LoadNoneWeaponHookStub();
static void PatchConfigStrings();
static const char* GetWeaponConfigString(int index);