[Game] Fix structure changes

This commit is contained in:
momo5502 2018-05-09 12:04:20 +02:00
parent a6efda1e97
commit 7ca3b49f1e
18 changed files with 33 additions and 35 deletions

View File

@ -519,7 +519,7 @@ namespace Components
if (ZoneBuilder::IsEnabled())
{
Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_MAP_ENTS, 10);
Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_XMODELSURFS, 8192);
Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_XMODEL_SURFS, 8192);
Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_TECHNIQUE_SET, 0x2000);
Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_FONT, 32);
Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_RAWFILE, 2048);

View File

@ -186,7 +186,7 @@ namespace Assets
}
void IFxWorld::load(Game::XAssetHeader* /*header*/, std::string name, Components::ZoneBuilder::Zone* /*builder*/)
{
Game::FxWorld* map = Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_FX_MAP, name.data()).fxWorld;
Game::FxWorld* map = Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_FXWORLD, name.data()).fxWorld;
if (map) return;
Components::Logger::Error("Missing fx_map %s... you can't make them yet you idiot.", name.data());

View File

@ -5,7 +5,7 @@ namespace Assets
class IFxWorld : public Components::AssetHandler::IAsset
{
public:
virtual Game::XAssetType getType() override { return Game::XAssetType::ASSET_TYPE_FX_MAP; };
virtual Game::XAssetType getType() override { return Game::XAssetType::ASSET_TYPE_FXWORLD; };
virtual void save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
virtual void mark(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;

View File

@ -5,7 +5,7 @@ namespace Assets
class IPhysCollmap : public Components::AssetHandler::IAsset
{
public:
virtual Game::XAssetType getType() override { return Game::XAssetType::ASSET_TYPE_PHYS_COLLMAP; };
virtual Game::XAssetType getType() override { return Game::XAssetType::ASSET_TYPE_PHYSCOLLMAP; };
virtual void save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;

View File

@ -5,7 +5,7 @@ namespace Assets
class IStructuredDataDefSet : public Components::AssetHandler::IAsset
{
public:
virtual Game::XAssetType getType() override { return Game::XAssetType::ASSET_TYPE_STRUCTUREDDATADEF; };
virtual Game::XAssetType getType() override { return Game::XAssetType::ASSET_TYPE_STRUCTURED_DATA_DEF; };
virtual void save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;

View File

@ -166,7 +166,7 @@ namespace Assets
{
asset->lodInfo[i].modelSurfs = reader.readObject<Game::XModelSurfs>();
this->loadXModelSurfs(asset->lodInfo[i].modelSurfs, &reader);
Components::AssetHandler::StoreTemporaryAsset(Game::XAssetType::ASSET_TYPE_XMODELSURFS, { asset->lodInfo[i].modelSurfs });
Components::AssetHandler::StoreTemporaryAsset(Game::XAssetType::ASSET_TYPE_XMODEL_SURFS, { asset->lodInfo[i].modelSurfs });
asset->lodInfo[i].surfs = asset->lodInfo[i].modelSurfs->surfaces;
@ -292,7 +292,7 @@ namespace Assets
}
}
Components::AssetHandler::StoreTemporaryAsset(Game::XAssetType::ASSET_TYPE_PHYS_COLLMAP, { asset->physCollmap });
Components::AssetHandler::StoreTemporaryAsset(Game::XAssetType::ASSET_TYPE_PHYSCOLLMAP, { asset->physCollmap });
//asset->physCollmap = nullptr;
}
}
@ -333,7 +333,7 @@ namespace Assets
{
if (asset->lodInfo[i].modelSurfs)
{
builder->loadAsset(Game::XAssetType::ASSET_TYPE_XMODELSURFS, asset->lodInfo[i].modelSurfs);
builder->loadAsset(Game::XAssetType::ASSET_TYPE_XMODEL_SURFS, asset->lodInfo[i].modelSurfs);
}
}
@ -344,7 +344,7 @@ namespace Assets
if (asset->physCollmap)
{
builder->loadAsset(Game::XAssetType::ASSET_TYPE_PHYS_COLLMAP, asset->physCollmap);
builder->loadAsset(Game::XAssetType::ASSET_TYPE_PHYSCOLLMAP, asset->physCollmap);
}
}
@ -441,7 +441,7 @@ namespace Assets
{
if (asset->lodInfo[i].modelSurfs)
{
dest->lodInfo[i].modelSurfs = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_XMODELSURFS, asset->lodInfo[i].modelSurfs).surfaces;
dest->lodInfo[i].modelSurfs = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_XMODEL_SURFS, asset->lodInfo[i].modelSurfs).surfaces;
}
}
}
@ -490,7 +490,7 @@ namespace Assets
if (asset->physCollmap)
{
dest->physCollmap = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_PHYS_COLLMAP, asset->physCollmap).physCollmap;
dest->physCollmap = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_PHYSCOLLMAP, asset->physCollmap).physCollmap;
}
buffer->popBlock();

View File

@ -5,7 +5,7 @@ namespace Assets
class IXModelSurfs : public Components::AssetHandler::IAsset
{
public:
virtual Game::XAssetType getType() override { return Game::XAssetType::ASSET_TYPE_XMODELSURFS; };
virtual Game::XAssetType getType() override { return Game::XAssetType::ASSET_TYPE_XMODEL_SURFS; };
virtual void save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;

View File

@ -585,7 +585,7 @@ namespace Assets
}
Game::clipMap_t* orgClipMap = nullptr;
Game::DB_EnumXAssets(Game::XAssetType::ASSET_TYPE_CLIPMAP_PVS, [](Game::XAssetHeader header, void* clipMap)
Game::DB_EnumXAssets(Game::XAssetType::ASSET_TYPE_CLIPMAP_MP, [](Game::XAssetHeader header, void* clipMap)
{
if (!*reinterpret_cast<void**>(clipMap))
{

View File

@ -5,7 +5,7 @@ namespace Assets
class IclipMap_t : public Components::AssetHandler::IAsset
{
public:
virtual Game::XAssetType getType() override { return Game::XAssetType::ASSET_TYPE_CLIPMAP_PVS; };
virtual Game::XAssetType getType() override { return Game::XAssetType::ASSET_TYPE_CLIPMAP_MP; };
virtual void save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
virtual void mark(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;

View File

@ -24,7 +24,7 @@ namespace Components
{
if (this->dvar && this->dvar->type == Game::dvar_type::DVAR_TYPE_STRING && this->dvar->current.string)
{
return this->dvar->current.string;
return const_cast<char*>(this->dvar->current.string);
}
return "";
@ -61,7 +61,7 @@ namespace Components
if (this->dvar && (this->dvar->type == Game::dvar_type::DVAR_TYPE_FLOAT_2 || this->dvar->type == Game::dvar_type::DVAR_TYPE_FLOAT_3 || this->dvar->type == Game::dvar_type::DVAR_TYPE_FLOAT_4))
{
return this->dvar->current.vec4;
return this->dvar->current.vector;
}
return val;
@ -70,7 +70,7 @@ namespace Components
{
if (this->dvar && this->dvar->type == Game::dvar_type::DVAR_TYPE_BOOL)
{
return this->dvar->current.boolean;
return this->dvar->current.enabled;
}
return false;

View File

@ -197,8 +197,8 @@ namespace Components
};
// Internal doesn't lock the thread, as locking is impossible, due to executing this in the thread that holds the current lock
Game::DB_EnumXAssets_Internal(Game::XAssetType::ASSET_TYPE_CLIPMAP_PVS, callback, ents, true);
Game::DB_EnumXAssets_Internal(Game::XAssetType::ASSET_TYPE_CLIPMAP, callback, ents, true);
Game::DB_EnumXAssets_Internal(Game::XAssetType::ASSET_TYPE_CLIPMAP_MP, callback, ents, true);
Game::DB_EnumXAssets_Internal(Game::XAssetType::ASSET_TYPE_CLIPMAP_SP, callback, ents, true);
}
void Maps::LoadAssetRestrict(Game::XAssetType type, Game::XAssetHeader asset, std::string name, bool* restrict)
@ -206,7 +206,7 @@ namespace Components
if (std::find(Maps::CurrentDependencies.begin(), Maps::CurrentDependencies.end(), FastFiles::Current()) != Maps::CurrentDependencies.end()
&& (FastFiles::Current() != "mp_shipment_long" || Maps::CurrentMainZone != "mp_shipment")) // Shipment is a special case
{
if (type == Game::XAssetType::ASSET_TYPE_CLIPMAP_PVS || type == Game::XAssetType::ASSET_TYPE_CLIPMAP || type == Game::XAssetType::ASSET_TYPE_GAMEWORLD_SP || type == Game::XAssetType::ASSET_TYPE_GAMEWORLD_MP || type == Game::XAssetType::ASSET_TYPE_GFXWORLD || type == Game::XAssetType::ASSET_TYPE_MAP_ENTS || type == Game::XAssetType::ASSET_TYPE_COMWORLD || type == Game::XAssetType::ASSET_TYPE_FX_MAP)
if (type == Game::XAssetType::ASSET_TYPE_CLIPMAP_MP || type == Game::XAssetType::ASSET_TYPE_CLIPMAP_SP || type == Game::XAssetType::ASSET_TYPE_GAMEWORLD_SP || type == Game::XAssetType::ASSET_TYPE_GAMEWORLD_MP || type == Game::XAssetType::ASSET_TYPE_GFXWORLD || type == Game::XAssetType::ASSET_TYPE_MAP_ENTS || type == Game::XAssetType::ASSET_TYPE_COMWORLD || type == Game::XAssetType::ASSET_TYPE_FXWORLD)
{
*restrict = true;
return;

View File

@ -235,7 +235,7 @@ namespace Components
void ModelSurfs::EndRecover()
{
Game::DB_EnumXAssets_Internal(Game::XAssetType::ASSET_TYPE_XMODELSURFS, [](Game::XAssetHeader header, void* /*userdata*/)
Game::DB_EnumXAssets_Internal(Game::XAssetType::ASSET_TYPE_XMODEL_SURFS, [](Game::XAssetHeader header, void* /*userdata*/)
{
ModelSurfs::CreateBuffers(header.surfaces);
}, nullptr, false);
@ -329,7 +329,7 @@ namespace Components
ModelSurfs::BufferMap.clear();
// Install release handler
Game::DB_ReleaseXAssetHandlers[Game::XAssetType::ASSET_TYPE_XMODELSURFS] = ModelSurfs::ReleaseModelSurf;
Game::DB_ReleaseXAssetHandlers[Game::XAssetType::ASSET_TYPE_XMODEL_SURFS] = ModelSurfs::ReleaseModelSurf;
// Install device recovery handlers
Renderer::OnDeviceRecoveryBegin(ModelSurfs::BeginRecover);

View File

@ -132,7 +132,7 @@ namespace Components
else return;
Dvar::Var("cl_updateversion").get<Game::dvar_t*>()->current.integer = revisionNumber;
Dvar::Var("cl_updateavailable").get<Game::dvar_t*>()->current.boolean = (revisionNumber > REVISION);
Dvar::Var("cl_updateavailable").get<Game::dvar_t*>()->current.enabled = (revisionNumber > REVISION);
// if there is an update then show the toast, but only once
static bool showToast = true;
@ -231,7 +231,7 @@ namespace Components
Command::Add("getautoupdate", [](Command::Params*)
{
if (!Dvar::Var("cl_updateavailable").get<Game::dvar_t*>()->current.boolean) return;
if (!Dvar::Var("cl_updateavailable").get<Game::dvar_t*>()->current.enabled) return;
News::LaunchUpdater("-update -c");
});

View File

@ -674,7 +674,7 @@ namespace Components
int source = netSource.get<int>();
if (++source > netSource.get<Game::dvar_t*>()->max.i)
if (++source > netSource.get<Game::dvar_t*>()->domain.integer.max)
{
source = 0;
}

View File

@ -174,7 +174,7 @@ namespace Components
AssetHandler::OnLoad([](Game::XAssetType type, Game::XAssetHeader asset, std::string filename, bool* /*restrict*/)
{
// Only intercept playerdatadef loading
if (type != Game::XAssetType::ASSET_TYPE_STRUCTUREDDATADEF || filename != "mp/playerdata.def") return;
if (type != Game::XAssetType::ASSET_TYPE_STRUCTURED_DATA_DEF || filename != "mp/playerdata.def") return;
// Store asset
Game::StructuredDataDefSet* data = asset.structuredData;

View File

@ -1060,9 +1060,9 @@ namespace Components
Utils::Hook::Set<DWORD>(0x64A057, 0x38400000);
// change fs_game domain func
Utils::Hook::Set<int(*)(Game::dvar_t*, Game::dvar_value_t)>(0x643203, [](Game::dvar_t* dvar, Game::dvar_value_t value)
Utils::Hook::Set<int(*)(Game::dvar_t*, Game::DvarValue)>(0x643203, [](Game::dvar_t* dvar, Game::DvarValue value)
{
int result = Utils::Hook::Call<int(Game::dvar_t*, Game::dvar_value_t)>(0x642FC0)(dvar, value);
int result = Utils::Hook::Call<int(Game::dvar_t*, Game::DvarValue)>(0x642FC0)(dvar, value);
if(result)
{

View File

@ -458,9 +458,9 @@ namespace Game
if (!_stricmp(DB_GetXAssetTypeName(type), name))
{
// Col map workaround!
if (type == Game::XAssetType::ASSET_TYPE_CLIPMAP)
if (type == Game::XAssetType::ASSET_TYPE_CLIPMAP_SP)
{
return Game::XAssetType::ASSET_TYPE_CLIPMAP_PVS;
return Game::XAssetType::ASSET_TYPE_CLIPMAP_MP;
}
return type;

View File

@ -21,9 +21,7 @@ namespace Game
typedef unsigned int scr_entref_t;
typedef void(__cdecl * scr_function_t)(scr_entref_t);
typedef enum
{
enum XAssetType
enum XAssetType
{
ASSET_TYPE_PHYSPRESET = 0x0,
ASSET_TYPE_PHYSCOLLMAP = 0x1,
@ -72,7 +70,7 @@ namespace Game
ASSET_TYPE_STRING = 0x2B,
ASSET_TYPE_ASSETLIST = 0x2C,
ASSET_TYPE_INVALID = -1,
} XAssetType;
};
typedef enum
{
@ -158,7 +156,7 @@ namespace Game
FloatLimit vector;
};
typedef struct dvar_t
struct dvar_t
{
const char *name;
const char *description;