iw4x-client/src/Components/Modules/Weapon.cpp

29 lines
705 B
C++
Raw Normal View History

2016-01-12 08:27:48 -05:00
#include "STDInclude.hpp"
namespace Components
{
Game::XAssetHeader Weapon::WeaponFileLoad(Game::XAssetType type, std::string filename)
2016-01-12 08:27:48 -05:00
{
2016-01-12 13:08:26 -05:00
Game::XAssetHeader header = { 0 };
2016-01-12 08:27:48 -05:00
// Try loading raw weapon
if (FileSystem::File(Utils::VA("weapons/mp/%s", filename.data())).Exists())
2016-01-12 08:27:48 -05:00
{
header.data = Game::BG_LoadWeaponDef_LoadObj(filename.data());
2016-01-12 08:27:48 -05:00
}
return header;
}
Weapon::Weapon()
{
// Intercept weapon loading
AssetHandler::OnFind(Game::XAssetType::ASSET_TYPE_WEAPON, Weapon::WeaponFileLoad);
// weapon asset existence check
Utils::Hook::Nop(0x408228, 5); // find asset header
Utils::Hook::Nop(0x408230, 5); // is asset default
Utils::Hook::Nop(0x40823A, 2); // jump
}
}