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/Changelog.hpp"
|
||||||
#include "Modules/Chat.hpp"
|
#include "Modules/Chat.hpp"
|
||||||
#include "Modules/ClanTags.hpp"
|
#include "Modules/ClanTags.hpp"
|
||||||
|
#include "Modules/Weapon.hpp" // Load before for G_ModelIndex
|
||||||
#include "Modules/ClientCommand.hpp"
|
#include "Modules/ClientCommand.hpp"
|
||||||
#include "Modules/ConnectProtocol.hpp"
|
#include "Modules/ConnectProtocol.hpp"
|
||||||
#include "Modules/Console.hpp"
|
#include "Modules/Console.hpp"
|
||||||
@ -62,7 +63,6 @@
|
|||||||
#include "Modules/VisionFile.hpp"
|
#include "Modules/VisionFile.hpp"
|
||||||
#include "Modules/Voice.hpp"
|
#include "Modules/Voice.hpp"
|
||||||
#include "Modules/Vote.hpp"
|
#include "Modules/Vote.hpp"
|
||||||
#include "Modules/Weapon.hpp"
|
|
||||||
#include "Modules/Window.hpp"
|
#include "Modules/Window.hpp"
|
||||||
|
|
||||||
#include "Modules/BotLib/lPrecomp.hpp"
|
#include "Modules/BotLib/lPrecomp.hpp"
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
namespace Assets
|
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)
|
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->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);
|
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(pickupSound);
|
||||||
LoadWeapSound(pickupSoundPlayer);
|
LoadWeapSound(pickupSoundPlayer);
|
||||||
|
@ -14,7 +14,7 @@ namespace Assets
|
|||||||
|
|
||||||
if (asset->names)
|
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]);
|
builder->addScriptString(asset->names[i]);
|
||||||
}
|
}
|
||||||
@ -22,7 +22,7 @@ namespace Assets
|
|||||||
|
|
||||||
if (asset->notify)
|
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);
|
builder->addScriptString(asset->notify[i].name);
|
||||||
}
|
}
|
||||||
@ -165,7 +165,7 @@ namespace Assets
|
|||||||
unsigned short* destTagnames = buffer->dest<unsigned short>();
|
unsigned short* destTagnames = buffer->dest<unsigned short>();
|
||||||
buffer->saveArray(asset->names, asset->boneCount[Game::PART_TYPE_ALL]);
|
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]);
|
builder->mapScriptString(destTagnames[i]);
|
||||||
}
|
}
|
||||||
@ -181,7 +181,7 @@ namespace Assets
|
|||||||
Game::XAnimNotifyInfo* destNotetracks = buffer->dest<Game::XAnimNotifyInfo>();
|
Game::XAnimNotifyInfo* destNotetracks = buffer->dest<Game::XAnimNotifyInfo>();
|
||||||
buffer->saveArray(asset->notify, asset->notifyCount);
|
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);
|
builder->mapScriptString(destNotetracks[i].name);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include <STDInclude.hpp>
|
#include <STDInclude.hpp>
|
||||||
#include "ClientCommand.hpp"
|
#include "ClientCommand.hpp"
|
||||||
|
|
||||||
|
#include "Weapon.hpp"
|
||||||
|
|
||||||
#include "GSC/Script.hpp"
|
#include "GSC/Script.hpp"
|
||||||
|
|
||||||
using namespace Utils::String;
|
using namespace Utils::String;
|
||||||
@ -382,7 +384,14 @@ namespace Components
|
|||||||
Game::XModel* model = nullptr;
|
Game::XModel* model = nullptr;
|
||||||
if (ent->model)
|
if (ent->model)
|
||||||
{
|
{
|
||||||
model = Game::G_GetModel(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;
|
Game::vec3_t point, angles;
|
||||||
|
@ -7,6 +7,7 @@ namespace Components
|
|||||||
{
|
{
|
||||||
const Game::dvar_t* Weapon::BGWeaponOffHandFix;
|
const Game::dvar_t* Weapon::BGWeaponOffHandFix;
|
||||||
Game::XModel* Weapon::G_ModelIndexReallocated[G_MODELINDEX_LIMIT];
|
Game::XModel* Weapon::G_ModelIndexReallocated[G_MODELINDEX_LIMIT];
|
||||||
|
bool Weapon::GModelIndexHasBeenReallocated;
|
||||||
|
|
||||||
Game::WeaponCompleteDef* Weapon::LoadWeaponCompleteDef(const char* name)
|
Game::WeaponCompleteDef* Weapon::LoadWeaponCompleteDef(const char* name)
|
||||||
{
|
{
|
||||||
@ -447,7 +448,8 @@ namespace Components
|
|||||||
Utils::Hook::Set(0x5FC762 + 3, G_ModelIndexReallocated);
|
Utils::Hook::Set(0x5FC762 + 3, G_ModelIndexReallocated);
|
||||||
Utils::Hook::Set(0x5FC7BE + 3, G_ModelIndexReallocated);
|
Utils::Hook::Set(0x5FC7BE + 3, G_ModelIndexReallocated);
|
||||||
Utils::Hook::Set<DWORD>(0x44F256 + 2, G_MODELINDEX_LIMIT);
|
Utils::Hook::Set<DWORD>(0x44F256 + 2, G_MODELINDEX_LIMIT);
|
||||||
|
|
||||||
|
GModelIndexHasBeenReallocated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* Weapon::LoadNoneWeaponHook()
|
void* Weapon::LoadNoneWeaponHook()
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
#define MAX_CONFIGSTRINGS (4139 - 1200 + WEAPON_LIMIT)
|
#define MAX_CONFIGSTRINGS (4139 - 1200 + WEAPON_LIMIT)
|
||||||
#define G_MODELINDEX_LIMIT (526 + WEAPON_LIMIT - 1200)
|
#define G_MODELINDEX_LIMIT (526 + WEAPON_LIMIT - 1200)
|
||||||
|
|
||||||
#define G_MODELINDEX_HAS_BEEN_REALLOCATED
|
|
||||||
|
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
class Weapon : public Component
|
class Weapon : public Component
|
||||||
@ -16,6 +14,8 @@ namespace Components
|
|||||||
Weapon();
|
Weapon();
|
||||||
static Game::XModel* G_ModelIndexReallocated[G_MODELINDEX_LIMIT];
|
static Game::XModel* G_ModelIndexReallocated[G_MODELINDEX_LIMIT];
|
||||||
|
|
||||||
|
static bool GModelIndexHasBeenReallocated;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const Game::dvar_t* BGWeaponOffHandFix;
|
static const Game::dvar_t* BGWeaponOffHandFix;
|
||||||
|
|
||||||
|
@ -1044,8 +1044,8 @@ namespace Game
|
|||||||
unsigned __int16 randomDataIntCount;
|
unsigned __int16 randomDataIntCount;
|
||||||
unsigned __int16 numframes;
|
unsigned __int16 numframes;
|
||||||
char flags;
|
char flags;
|
||||||
char boneCount[10];
|
unsigned char boneCount[10];
|
||||||
char notifyCount;
|
unsigned char notifyCount;
|
||||||
char assetType;
|
char assetType;
|
||||||
bool isDefault;
|
bool isDefault;
|
||||||
unsigned int randomDataShortCount;
|
unsigned int randomDataShortCount;
|
||||||
|
Loading…
Reference in New Issue
Block a user