Load tracerdef, allow checking for reallocated gmodelindex
This commit is contained in:
parent
cdb8a9b9c4
commit
a54337af9b
@ -12,6 +12,7 @@
|
||||
#include "Modules/Changelog.hpp"
|
||||
#include "Modules/Chat.hpp"
|
||||
#include "Modules/ClanTags.hpp"
|
||||
#include "Modules/Weapon.hpp" // Load before for G_ModelIndex
|
||||
#include "Modules/ClientCommand.hpp"
|
||||
#include "Modules/ConnectProtocol.hpp"
|
||||
#include "Modules/Console.hpp"
|
||||
@ -62,7 +63,6 @@
|
||||
#include "Modules/VisionFile.hpp"
|
||||
#include "Modules/Voice.hpp"
|
||||
#include "Modules/Vote.hpp"
|
||||
#include "Modules/Weapon.hpp"
|
||||
#include "Modules/Window.hpp"
|
||||
|
||||
#include "Modules/BotLib/lPrecomp.hpp"
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
void ITracerDef::load(Game::XAssetHeader* /*header*/, const std::string& /*name*/, Components::ZoneBuilder::Zone* /*builder*/)
|
||||
void ITracerDef::load(Game::XAssetHeader* header, const std::string& name, Components::ZoneBuilder::Zone* builder)
|
||||
{
|
||||
// don't load from filesystem right now
|
||||
header->tracerDef = builder->getIW4OfApi()->read<Game::TracerDef>(Game::XAssetType::ASSET_TYPE_TRACER, name);
|
||||
}
|
||||
|
||||
void ITracerDef::mark(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder)
|
||||
|
@ -129,7 +129,10 @@ namespace Assets
|
||||
if (asset->weapDef->projIgnitionEffect) builder->loadAsset(Game::XAssetType::ASSET_TYPE_FX, asset->weapDef->projIgnitionEffect);
|
||||
if (asset->weapDef->turretOverheatEffect) builder->loadAsset(Game::XAssetType::ASSET_TYPE_FX, asset->weapDef->turretOverheatEffect);
|
||||
|
||||
#define LoadWeapSound(sound) if (asset->weapDef->##sound##) builder->loadAsset(Game::XAssetType::ASSET_TYPE_SOUND, asset->weapDef->##sound##)
|
||||
|
||||
|
||||
// They are not subassets, because they don't get loaded automatically
|
||||
#define LoadWeapSound(sound) if (asset->weapDef->##sound##) builder->loadAsset(Game::XAssetType::ASSET_TYPE_SOUND, asset->weapDef->##sound##, false)
|
||||
|
||||
LoadWeapSound(pickupSound);
|
||||
LoadWeapSound(pickupSoundPlayer);
|
||||
|
@ -14,7 +14,7 @@ namespace Assets
|
||||
|
||||
if (asset->names)
|
||||
{
|
||||
for (char i = 0; i < asset->boneCount[Game::PART_TYPE_ALL]; ++i)
|
||||
for (unsigned char i = 0; i < asset->boneCount[Game::PART_TYPE_ALL]; ++i)
|
||||
{
|
||||
builder->addScriptString(asset->names[i]);
|
||||
}
|
||||
@ -22,7 +22,7 @@ namespace Assets
|
||||
|
||||
if (asset->notify)
|
||||
{
|
||||
for (char i = 0; i < asset->notifyCount; ++i)
|
||||
for (unsigned char i = 0; i < asset->notifyCount; ++i)
|
||||
{
|
||||
builder->addScriptString(asset->notify[i].name);
|
||||
}
|
||||
@ -165,7 +165,7 @@ namespace Assets
|
||||
unsigned short* destTagnames = buffer->dest<unsigned short>();
|
||||
buffer->saveArray(asset->names, asset->boneCount[Game::PART_TYPE_ALL]);
|
||||
|
||||
for (char i = 0; i < asset->boneCount[Game::PART_TYPE_ALL]; ++i)
|
||||
for (unsigned char i = 0; i < asset->boneCount[Game::PART_TYPE_ALL]; ++i)
|
||||
{
|
||||
builder->mapScriptString(destTagnames[i]);
|
||||
}
|
||||
@ -181,7 +181,7 @@ namespace Assets
|
||||
Game::XAnimNotifyInfo* destNotetracks = buffer->dest<Game::XAnimNotifyInfo>();
|
||||
buffer->saveArray(asset->notify, asset->notifyCount);
|
||||
|
||||
for (char i = 0; i < asset->notifyCount; ++i)
|
||||
for (unsigned char i = 0; i < asset->notifyCount; ++i)
|
||||
{
|
||||
builder->mapScriptString(destNotetracks[i].name);
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include <STDInclude.hpp>
|
||||
#include "ClientCommand.hpp"
|
||||
|
||||
#include "Weapon.hpp"
|
||||
|
||||
#include "GSC/Script.hpp"
|
||||
|
||||
using namespace Utils::String;
|
||||
@ -381,9 +383,16 @@ namespace Components
|
||||
|
||||
Game::XModel* model = nullptr;
|
||||
if (ent->model)
|
||||
{
|
||||
if (Components::Weapon::GModelIndexHasBeenReallocated)
|
||||
{
|
||||
model = Components::Weapon::G_ModelIndexReallocated[ent->model];
|
||||
}
|
||||
else
|
||||
{
|
||||
model = Game::G_GetModel(ent->model);
|
||||
}
|
||||
}
|
||||
|
||||
Game::vec3_t point, angles;
|
||||
|
||||
|
@ -7,6 +7,7 @@ namespace Components
|
||||
{
|
||||
const Game::dvar_t* Weapon::BGWeaponOffHandFix;
|
||||
Game::XModel* Weapon::G_ModelIndexReallocated[G_MODELINDEX_LIMIT];
|
||||
bool Weapon::GModelIndexHasBeenReallocated;
|
||||
|
||||
Game::WeaponCompleteDef* Weapon::LoadWeaponCompleteDef(const char* name)
|
||||
{
|
||||
@ -448,6 +449,7 @@ namespace Components
|
||||
Utils::Hook::Set(0x5FC7BE + 3, G_ModelIndexReallocated);
|
||||
Utils::Hook::Set<DWORD>(0x44F256 + 2, G_MODELINDEX_LIMIT);
|
||||
|
||||
GModelIndexHasBeenReallocated = true;
|
||||
}
|
||||
|
||||
void* Weapon::LoadNoneWeaponHook()
|
||||
|
@ -6,8 +6,6 @@
|
||||
#define MAX_CONFIGSTRINGS (4139 - 1200 + WEAPON_LIMIT)
|
||||
#define G_MODELINDEX_LIMIT (526 + WEAPON_LIMIT - 1200)
|
||||
|
||||
#define G_MODELINDEX_HAS_BEEN_REALLOCATED
|
||||
|
||||
namespace Components
|
||||
{
|
||||
class Weapon : public Component
|
||||
@ -16,6 +14,8 @@ namespace Components
|
||||
Weapon();
|
||||
static Game::XModel* G_ModelIndexReallocated[G_MODELINDEX_LIMIT];
|
||||
|
||||
static bool GModelIndexHasBeenReallocated;
|
||||
|
||||
private:
|
||||
static const Game::dvar_t* BGWeaponOffHandFix;
|
||||
|
||||
|
@ -1044,8 +1044,8 @@ namespace Game
|
||||
unsigned __int16 randomDataIntCount;
|
||||
unsigned __int16 numframes;
|
||||
char flags;
|
||||
char boneCount[10];
|
||||
char notifyCount;
|
||||
unsigned char boneCount[10];
|
||||
unsigned char notifyCount;
|
||||
char assetType;
|
||||
bool isDefault;
|
||||
unsigned int randomDataShortCount;
|
||||
|
Loading…
Reference in New Issue
Block a user