Merge pull request #753 from diamante0018/develop
[General]: Improve code style
This commit is contained in:
commit
4ac1987051
@ -21,7 +21,7 @@ namespace Assets
|
|||||||
{
|
{
|
||||||
if (visuals->model)
|
if (visuals->model)
|
||||||
{
|
{
|
||||||
visuals->model = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_XMODEL, reader->readString().data(), builder).model;
|
visuals->model = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_XMODEL, reader->readString(), builder).model;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -44,7 +44,7 @@ namespace Assets
|
|||||||
{
|
{
|
||||||
if (visuals->effectDef.handle)
|
if (visuals->effectDef.handle)
|
||||||
{
|
{
|
||||||
visuals->effectDef.handle = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_FX, reader->readString().data(), builder).fx;
|
visuals->effectDef.handle = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_FX, reader->readString(), builder).fx;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -54,7 +54,7 @@ namespace Assets
|
|||||||
{
|
{
|
||||||
if (visuals->material)
|
if (visuals->material)
|
||||||
{
|
{
|
||||||
visuals->material = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_MATERIAL, reader->readString().data(), builder).material;
|
visuals->material = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_MATERIAL, reader->readString(), builder).material;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -120,12 +120,12 @@ namespace Assets
|
|||||||
{
|
{
|
||||||
if (elemDef->visuals.markArray[j].materials[0])
|
if (elemDef->visuals.markArray[j].materials[0])
|
||||||
{
|
{
|
||||||
elemDef->visuals.markArray[j].materials[0] = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_MATERIAL, buffer.readString().data(), builder).material;
|
elemDef->visuals.markArray[j].materials[0] = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_MATERIAL, buffer.readString(), builder).material;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elemDef->visuals.markArray[j].materials[1])
|
if (elemDef->visuals.markArray[j].materials[1])
|
||||||
{
|
{
|
||||||
elemDef->visuals.markArray[j].materials[1] = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_MATERIAL, buffer.readString().data(), builder).material;
|
elemDef->visuals.markArray[j].materials[1] = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_MATERIAL, buffer.readString(), builder).material;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -150,17 +150,17 @@ namespace Assets
|
|||||||
|
|
||||||
if (elemDef->effectOnImpact.handle)
|
if (elemDef->effectOnImpact.handle)
|
||||||
{
|
{
|
||||||
elemDef->effectOnImpact.handle = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_FX, buffer.readString().data(), builder).fx;
|
elemDef->effectOnImpact.handle = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_FX, buffer.readString(), builder).fx;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elemDef->effectOnDeath.handle)
|
if (elemDef->effectOnDeath.handle)
|
||||||
{
|
{
|
||||||
elemDef->effectOnDeath.handle = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_FX, buffer.readString().data(), builder).fx;
|
elemDef->effectOnDeath.handle = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_FX, buffer.readString(), builder).fx;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elemDef->effectEmitted.handle)
|
if (elemDef->effectEmitted.handle)
|
||||||
{
|
{
|
||||||
elemDef->effectEmitted.handle = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_FX, buffer.readString().data(), builder).fx;
|
elemDef->effectEmitted.handle = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_FX, buffer.readString(), builder).fx;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save_FxElemExtendedDefPtr
|
// Save_FxElemExtendedDefPtr
|
||||||
|
@ -67,7 +67,7 @@ namespace Assets
|
|||||||
}
|
}
|
||||||
else if (name[0] != '*')
|
else if (name[0] != '*')
|
||||||
{
|
{
|
||||||
char nameBuffer[MAX_PATH] = { 0 };
|
char nameBuffer[MAX_PATH]{};
|
||||||
Components::Materials::FormatImagePath(nameBuffer, sizeof(nameBuffer), 0, 0, name.data());
|
Components::Materials::FormatImagePath(nameBuffer, sizeof(nameBuffer), 0, 0, name.data());
|
||||||
Components::FileSystem::File iwi(nameBuffer);
|
Components::FileSystem::File iwi(nameBuffer);
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ namespace Assets
|
|||||||
|
|
||||||
if (asset->attenuation.image)
|
if (asset->attenuation.image)
|
||||||
{
|
{
|
||||||
asset->attenuation.image = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader.readString().data(), builder).image;
|
asset->attenuation.image = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader.readString(), builder).image;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ namespace Assets
|
|||||||
|
|
||||||
if (surface->material)
|
if (surface->material)
|
||||||
{
|
{
|
||||||
world->dpvs.surfaces[i].material = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_MATERIAL, reader->readString().data(), builder).material;
|
world->dpvs.surfaces[i].material = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_MATERIAL, reader->readString(), builder).material;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@ namespace Assets
|
|||||||
{
|
{
|
||||||
auto name = reader->readString();
|
auto name = reader->readString();
|
||||||
|
|
||||||
model->model = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_XMODEL, name.data(), builder).model;
|
model->model = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_XMODEL, name, builder).model;
|
||||||
|
|
||||||
assert(model->model);
|
assert(model->model);
|
||||||
}
|
}
|
||||||
@ -86,7 +86,7 @@ namespace Assets
|
|||||||
|
|
||||||
for (unsigned int i = 0; i < asset->reflectionProbeCount; ++i)
|
for (unsigned int i = 0; i < asset->reflectionProbeCount; ++i)
|
||||||
{
|
{
|
||||||
asset->reflectionProbes[i] = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader->readString().data(), builder).image;
|
asset->reflectionProbes[i] = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader->readString(), builder).image;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,24 +105,24 @@ namespace Assets
|
|||||||
|
|
||||||
if (lightmapArray->primary)
|
if (lightmapArray->primary)
|
||||||
{
|
{
|
||||||
lightmapArray->primary = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader->readString().data(), builder).image;
|
lightmapArray->primary = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader->readString(), builder).image;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lightmapArray->secondary)
|
if (lightmapArray->secondary)
|
||||||
{
|
{
|
||||||
lightmapArray->secondary = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader->readString().data(), builder).image;
|
lightmapArray->secondary = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader->readString(), builder).image;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->lightmapOverridePrimary)
|
if (asset->lightmapOverridePrimary)
|
||||||
{
|
{
|
||||||
asset->lightmapOverridePrimary = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader->readString().data(), builder).image;
|
asset->lightmapOverridePrimary = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader->readString(), builder).image;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->lightmapOverrideSecondary)
|
if (asset->lightmapOverrideSecondary)
|
||||||
{
|
{
|
||||||
asset->lightmapOverrideSecondary = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader->readString().data(), builder).image;
|
asset->lightmapOverrideSecondary = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader->readString(), builder).image;
|
||||||
}
|
}
|
||||||
|
|
||||||
// saveGfxWorldVertexData
|
// saveGfxWorldVertexData
|
||||||
@ -200,7 +200,7 @@ namespace Assets
|
|||||||
|
|
||||||
if (sky->skyImage)
|
if (sky->skyImage)
|
||||||
{
|
{
|
||||||
sky->skyImage = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader.readString().data(), builder).image;
|
sky->skyImage = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader.readString(), builder).image;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -348,24 +348,24 @@ namespace Assets
|
|||||||
|
|
||||||
if (materialMemory->material)
|
if (materialMemory->material)
|
||||||
{
|
{
|
||||||
materialMemory->material = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_MATERIAL, reader.readString().data(), builder).material;
|
materialMemory->material = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_MATERIAL, reader.readString(), builder).material;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->sun.spriteMaterial)
|
if (asset->sun.spriteMaterial)
|
||||||
{
|
{
|
||||||
asset->sun.spriteMaterial = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_MATERIAL, reader.readString().data(), builder).material;
|
asset->sun.spriteMaterial = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_MATERIAL, reader.readString(), builder).material;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->sun.flareMaterial)
|
if (asset->sun.flareMaterial)
|
||||||
{
|
{
|
||||||
asset->sun.flareMaterial = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_MATERIAL, reader.readString().data(), builder).material;
|
asset->sun.flareMaterial = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_MATERIAL, reader.readString(), builder).material;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->outdoorImage)
|
if (asset->outdoorImage)
|
||||||
{
|
{
|
||||||
asset->outdoorImage = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader.readString().data(), builder).image;
|
asset->outdoorImage = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader.readString(), builder).image;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset->primaryLightCount > 0)
|
if (asset->primaryLightCount > 0)
|
||||||
|
@ -94,7 +94,7 @@ namespace Assets
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sound->name = builder->getAllocator()->duplicateString(name.data());
|
sound->name = builder->getAllocator()->duplicateString(name);
|
||||||
header->loadSnd = sound;
|
header->loadSnd = sound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ namespace Assets
|
|||||||
{
|
{
|
||||||
auto imageName = waterJson["image"].get<std::string>();
|
auto imageName = waterJson["image"].get<std::string>();
|
||||||
|
|
||||||
water->image = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, imageName.data(), builder).image;
|
water->image = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, imageName, builder).image;
|
||||||
}
|
}
|
||||||
|
|
||||||
water->amplitude = waterJson["amplitude"].get<float>();
|
water->amplitude = waterJson["amplitude"].get<float>();
|
||||||
@ -426,7 +426,7 @@ namespace Assets
|
|||||||
Game::MaterialTechniqueSet* techset;
|
Game::MaterialTechniqueSet* techset;
|
||||||
|
|
||||||
// Pass 1: Identical techset (1:1)
|
// Pass 1: Identical techset (1:1)
|
||||||
techset = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_TECHNIQUE_SET, techsetName.data(), builder).techniqueSet;
|
techset = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_TECHNIQUE_SET, techsetName, builder).techniqueSet;
|
||||||
if (techset != nullptr)
|
if (techset != nullptr)
|
||||||
{
|
{
|
||||||
return techset;
|
return techset;
|
||||||
@ -485,7 +485,7 @@ namespace Assets
|
|||||||
{
|
{
|
||||||
std::string techsetName = reader.readString();
|
std::string techsetName = reader.readString();
|
||||||
if (!techsetName.empty() && techsetName.front() == ',') techsetName.erase(techsetName.begin());
|
if (!techsetName.empty() && techsetName.front() == ',') techsetName.erase(techsetName.begin());
|
||||||
asset->techniqueSet = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_TECHNIQUE_SET, techsetName.data(), builder).techniqueSet;
|
asset->techniqueSet = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_TECHNIQUE_SET, techsetName, builder).techniqueSet;
|
||||||
|
|
||||||
if (!asset->techniqueSet)
|
if (!asset->techniqueSet)
|
||||||
{
|
{
|
||||||
@ -499,7 +499,7 @@ namespace Assets
|
|||||||
|
|
||||||
for (int i = 0; i < ARRAYSIZE(techsetSuffix); ++i)
|
for (int i = 0; i < ARRAYSIZE(techsetSuffix); ++i)
|
||||||
{
|
{
|
||||||
Game::MaterialTechniqueSet* techsetPtr = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_TECHNIQUE_SET, (techsetName + techsetSuffix[i] + suffix).data(), builder).techniqueSet;
|
Game::MaterialTechniqueSet* techsetPtr = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_TECHNIQUE_SET, (techsetName + techsetSuffix[i] + suffix), builder).techniqueSet;
|
||||||
|
|
||||||
if (techsetPtr)
|
if (techsetPtr)
|
||||||
{
|
{
|
||||||
@ -550,13 +550,13 @@ namespace Assets
|
|||||||
|
|
||||||
if (water->image)
|
if (water->image)
|
||||||
{
|
{
|
||||||
water->image = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader.readString().data(), builder).image;
|
water->image = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader.readString(), builder).image;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (textureDef->u.image)
|
else if (textureDef->u.image)
|
||||||
{
|
{
|
||||||
textureDef->u.image = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader.readString().data(), builder).image;
|
textureDef->u.image = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_IMAGE, reader.readString(), builder).image;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -242,6 +242,12 @@ namespace Components
|
|||||||
|
|
||||||
void Debug::CG_DrawDebugOverlays_Hk(const int localClientNum)
|
void Debug::CG_DrawDebugOverlays_Hk(const int localClientNum)
|
||||||
{
|
{
|
||||||
|
assert(DebugOverlay);
|
||||||
|
if (!DebugOverlay)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (DebugOverlay->current.integer)
|
switch (DebugOverlay->current.integer)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -80,11 +80,12 @@ namespace Components
|
|||||||
|
|
||||||
void Logger::ErrorInternal(const Game::errorParm_t error, const std::string_view& fmt, std::format_args&& args)
|
void Logger::ErrorInternal(const Game::errorParm_t error, const std::string_view& fmt, std::format_args&& args)
|
||||||
{
|
{
|
||||||
|
const auto msg = std::vformat(fmt, args);
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
if (IsDebuggerPresent()) __debugbreak();
|
if (IsDebuggerPresent()) __debugbreak();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const auto msg = std::vformat(fmt, args);
|
|
||||||
Game::Com_Error(error, "%s", msg.data());
|
Game::Com_Error(error, "%s", msg.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2497,24 +2497,121 @@ namespace Game
|
|||||||
SAT_COUNT = 0x4,
|
SAT_COUNT = 0x4,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SoundFile
|
struct snd_volume_info_t
|
||||||
{
|
{
|
||||||
char type;
|
float volume;
|
||||||
char exists;
|
float goalvolume;
|
||||||
SoundFileRef u;
|
float goalrate;
|
||||||
};
|
};
|
||||||
|
|
||||||
union $C8D87EB0090687D323381DFB7A82089C
|
struct snd_channelvolgroup
|
||||||
{
|
{
|
||||||
float slavePercentage;
|
snd_volume_info_t channelvol[64];
|
||||||
float masterPercentage;
|
bool active;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SndCurve
|
struct snd_background_info_t
|
||||||
{
|
{
|
||||||
const char* filename;
|
float goalvolume;
|
||||||
unsigned __int16 knotCount;
|
float goalrate;
|
||||||
float knots[16][2];
|
};
|
||||||
|
|
||||||
|
struct snd_enveffect
|
||||||
|
{
|
||||||
|
int roomtype;
|
||||||
|
float drylevel;
|
||||||
|
float drygoal;
|
||||||
|
float dryrate;
|
||||||
|
float wetlevel;
|
||||||
|
float wetgoal;
|
||||||
|
float wetrate;
|
||||||
|
bool active;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct orientation_t
|
||||||
|
{
|
||||||
|
float origin[3];
|
||||||
|
float axis[3][3];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct snd_listener
|
||||||
|
{
|
||||||
|
orientation_t orient;
|
||||||
|
float velocity;
|
||||||
|
int clientNum;
|
||||||
|
bool active;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct snd_amplifier
|
||||||
|
{
|
||||||
|
snd_listener* listener;
|
||||||
|
int minRadius;
|
||||||
|
int maxRadius;
|
||||||
|
float falloffExp;
|
||||||
|
float minVol;
|
||||||
|
float maxVol;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct snd_entchannel_info_t
|
||||||
|
{
|
||||||
|
char name[64];
|
||||||
|
int priority;
|
||||||
|
bool is3d;
|
||||||
|
bool isRestricted;
|
||||||
|
bool isPausable;
|
||||||
|
int maxVoices;
|
||||||
|
int voiceCount;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct snd_entchan_overrides_t
|
||||||
|
{
|
||||||
|
unsigned int isPausable[2];
|
||||||
|
float timescaleLerp[64];
|
||||||
|
};
|
||||||
|
|
||||||
|
enum SndFileLoadingState
|
||||||
|
{
|
||||||
|
SFLS_UNLOADED = 0x0,
|
||||||
|
SFLS_LOADING = 0x1,
|
||||||
|
SFLS_LOADED = 0x2,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SndFileSpecificChannelInfo
|
||||||
|
{
|
||||||
|
SndFileLoadingState loadingState;
|
||||||
|
int srcChannelCount;
|
||||||
|
int baserate;
|
||||||
|
};
|
||||||
|
|
||||||
|
union SndEntHandle
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
unsigned int entIndex;
|
||||||
|
} field;
|
||||||
|
int handle;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum SndLengthId
|
||||||
|
{
|
||||||
|
SndLengthNotify_Subtitle = 0x0,
|
||||||
|
SndLengthNotify_EntityCustom = 0x1,
|
||||||
|
SndLengthNotifyCount = 0x2,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sndLengthNotifyInfo
|
||||||
|
{
|
||||||
|
SndLengthId id[4];
|
||||||
|
void* data[4];
|
||||||
|
int count;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum snd_alias_system_t
|
||||||
|
{
|
||||||
|
SASYS_UI = 0x0,
|
||||||
|
SASYS_CGAME = 0x1,
|
||||||
|
SASYS_GAME = 0x2,
|
||||||
|
SASYS_COUNT = 0x3,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MSSSpeakerLevels
|
struct MSSSpeakerLevels
|
||||||
@ -2537,7 +2634,21 @@ namespace Game
|
|||||||
MSSChannelMap channelMaps[2][2];
|
MSSChannelMap channelMaps[2][2];
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct snd_alias_t
|
struct SoundFile
|
||||||
|
{
|
||||||
|
char type;
|
||||||
|
char exists;
|
||||||
|
SoundFileRef u;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SndCurve
|
||||||
|
{
|
||||||
|
const char* filename;
|
||||||
|
unsigned __int16 knotCount;
|
||||||
|
float knots[16][2];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct snd_alias_t
|
||||||
{
|
{
|
||||||
const char* aliasName;
|
const char* aliasName;
|
||||||
const char* subtitle;
|
const char* subtitle;
|
||||||
@ -2554,7 +2665,11 @@ namespace Game
|
|||||||
float distMax;
|
float distMax;
|
||||||
float velocityMin;
|
float velocityMin;
|
||||||
int flags;
|
int flags;
|
||||||
$C8D87EB0090687D323381DFB7A82089C ___u15;
|
union
|
||||||
|
{
|
||||||
|
float slavePercentage;
|
||||||
|
float masterPercentage;
|
||||||
|
} ___u15;
|
||||||
float probability;
|
float probability;
|
||||||
float lfePercentage;
|
float lfePercentage;
|
||||||
float centerPercentage;
|
float centerPercentage;
|
||||||
@ -2566,6 +2681,71 @@ namespace Game
|
|||||||
SpeakerMap* speakerMap;
|
SpeakerMap* speakerMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct snd_channel_info_t
|
||||||
|
{
|
||||||
|
SndFileSpecificChannelInfo soundFileInfo;
|
||||||
|
SndEntHandle sndEnt;
|
||||||
|
int entchannel;
|
||||||
|
int startDelay;
|
||||||
|
int looptime;
|
||||||
|
int totalMsec;
|
||||||
|
int playbackId;
|
||||||
|
sndLengthNotifyInfo lengthNotifyInfo;
|
||||||
|
float basevolume;
|
||||||
|
float pitch;
|
||||||
|
snd_alias_t* alias0;
|
||||||
|
snd_alias_t* alias1;
|
||||||
|
int saveIndex0;
|
||||||
|
int saveIndex1;
|
||||||
|
float lerp;
|
||||||
|
float org[3];
|
||||||
|
float offset[3];
|
||||||
|
bool paused;
|
||||||
|
bool master;
|
||||||
|
float timescaleLerp;
|
||||||
|
snd_alias_system_t system;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct snd_local_t
|
||||||
|
{
|
||||||
|
bool Initialized2d;
|
||||||
|
bool Initialized3d;
|
||||||
|
bool paused;
|
||||||
|
int playbackIdCounter;
|
||||||
|
unsigned int playback_rate;
|
||||||
|
int playback_channels;
|
||||||
|
float timescale;
|
||||||
|
int pausetime;
|
||||||
|
int cpu;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
char buffer[16384];
|
||||||
|
volatile int size;
|
||||||
|
bool compress;
|
||||||
|
} restore;
|
||||||
|
float volume;
|
||||||
|
snd_volume_info_t mastervol;
|
||||||
|
snd_channelvolgroup channelVolGroups[4];
|
||||||
|
snd_channelvolgroup* channelvol;
|
||||||
|
snd_background_info_t background[4];
|
||||||
|
int ambient_track;
|
||||||
|
float slaveLerp;
|
||||||
|
float masterPercentage;
|
||||||
|
snd_enveffect envEffects[5];
|
||||||
|
snd_enveffect* effect;
|
||||||
|
snd_listener listeners[2];
|
||||||
|
int time;
|
||||||
|
int looptime;
|
||||||
|
snd_amplifier amplifier;
|
||||||
|
snd_entchannel_info_t entchaninfo[64];
|
||||||
|
snd_entchan_overrides_t entchanOverrides;
|
||||||
|
int entchannel_count;
|
||||||
|
snd_channel_info_t chaninfo[52];
|
||||||
|
int max_2D_channels;
|
||||||
|
int max_3D_channels;
|
||||||
|
int max_stream_channels;
|
||||||
|
};
|
||||||
|
|
||||||
struct Poly
|
struct Poly
|
||||||
{
|
{
|
||||||
float(*pts)[3];
|
float(*pts)[3];
|
||||||
|
@ -16,14 +16,14 @@ namespace Utils
|
|||||||
|
|
||||||
const char* Stream::Reader::readCString()
|
const char* Stream::Reader::readCString()
|
||||||
{
|
{
|
||||||
return this->allocator->duplicateString(this->readString());
|
return this->allocator_->duplicateString(this->readString());
|
||||||
}
|
}
|
||||||
|
|
||||||
char Stream::Reader::readByte()
|
char Stream::Reader::readByte()
|
||||||
{
|
{
|
||||||
if ((this->position + 1) <= this->buffer.size())
|
if ((this->position_ + 1) <= this->buffer_.size())
|
||||||
{
|
{
|
||||||
return this->buffer[this->position++];
|
return this->buffer_[this->position_++];
|
||||||
}
|
}
|
||||||
|
|
||||||
throw std::runtime_error("Reading past the buffer");
|
throw std::runtime_error("Reading past the buffer");
|
||||||
@ -33,43 +33,43 @@ namespace Utils
|
|||||||
{
|
{
|
||||||
size_t bytes = size * count;
|
size_t bytes = size * count;
|
||||||
|
|
||||||
if ((this->position + bytes) <= this->buffer.size())
|
if ((this->position_ + bytes) <= this->buffer_.size())
|
||||||
{
|
{
|
||||||
void* _buffer = this->allocator->allocate(bytes);
|
void* buffer = this->allocator_->allocate(bytes);
|
||||||
|
|
||||||
std::memcpy(_buffer, this->buffer.data() + this->position, bytes);
|
std::memcpy(buffer, this->buffer_.data() + this->position_, bytes);
|
||||||
this->position += bytes;
|
this->position_ += bytes;
|
||||||
|
|
||||||
return _buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw std::runtime_error("Reading past the buffer");
|
throw std::runtime_error("Reading past the buffer");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Stream::Reader::end()
|
bool Stream::Reader::end() const
|
||||||
{
|
{
|
||||||
return (this->buffer.size() == this->position);
|
return (this->buffer_.size() == this->position_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stream::Reader::seek(unsigned int _position)
|
void Stream::Reader::seek(unsigned int position)
|
||||||
{
|
{
|
||||||
if (this->buffer.size() >= _position)
|
if (this->buffer_.size() >= position)
|
||||||
{
|
{
|
||||||
this->position = _position;
|
this->position_ = position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stream::Reader::seekRelative(unsigned int _position)
|
void Stream::Reader::seekRelative(unsigned int position)
|
||||||
{
|
{
|
||||||
return this->seek(_position + this->position);
|
return this->seek(position + this->position_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* Stream::Reader::readPointer()
|
void* Stream::Reader::readPointer()
|
||||||
{
|
{
|
||||||
void* pointer = this->read<void*>();
|
auto* pointer = this->read<void*>();
|
||||||
if (!this->hasPointer(pointer))
|
if (!this->hasPointer(pointer))
|
||||||
{
|
{
|
||||||
this->pointerMap[pointer] = nullptr;
|
this->pointerMap_[pointer] = nullptr;
|
||||||
}
|
}
|
||||||
return pointer;
|
return pointer;
|
||||||
}
|
}
|
||||||
@ -78,18 +78,18 @@ namespace Utils
|
|||||||
{
|
{
|
||||||
if (this->hasPointer(oldPointer))
|
if (this->hasPointer(oldPointer))
|
||||||
{
|
{
|
||||||
this->pointerMap[oldPointer] = newPointer;
|
this->pointerMap_[oldPointer] = newPointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Stream::Reader::hasPointer(void* pointer)
|
bool Stream::Reader::hasPointer(void* pointer) const
|
||||||
{
|
{
|
||||||
return this->pointerMap.find(pointer) != this->pointerMap.end();
|
return this->pointerMap_.find(pointer) != this->pointerMap_.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream::Stream() : ptrAssertion(false), criticalSectionState(0)
|
Stream::Stream() : ptrAssertion(false), criticalSectionState(0)
|
||||||
{
|
{
|
||||||
memset(this->blockSize, 0, sizeof(this->blockSize));
|
std::memset(this->blockSize, 0, sizeof(this->blockSize));
|
||||||
|
|
||||||
#ifdef WRITE_LOGS
|
#ifdef WRITE_LOGS
|
||||||
this->structLevel = 0;
|
this->structLevel = 0;
|
||||||
@ -99,12 +99,12 @@ namespace Utils
|
|||||||
|
|
||||||
Stream::Stream(size_t size) : Stream()
|
Stream::Stream(size_t size) : Stream()
|
||||||
{
|
{
|
||||||
this->buffer.reserve(size);
|
this->buffer_.reserve(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream::~Stream()
|
Stream::~Stream()
|
||||||
{
|
{
|
||||||
this->buffer.clear();
|
this->buffer_.clear();
|
||||||
|
|
||||||
if (this->criticalSectionState != 0)
|
if (this->criticalSectionState != 0)
|
||||||
{
|
{
|
||||||
@ -114,12 +114,12 @@ namespace Utils
|
|||||||
|
|
||||||
std::size_t Stream::length() const
|
std::size_t Stream::length() const
|
||||||
{
|
{
|
||||||
return this->buffer.length();
|
return this->buffer_.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t Stream::capacity() const
|
std::size_t Stream::capacity() const
|
||||||
{
|
{
|
||||||
return this->buffer.capacity();
|
return this->buffer_.capacity();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stream::assertPointer(const void* pointer, std::size_t length)
|
void Stream::assertPointer(const void* pointer, std::size_t length)
|
||||||
@ -143,12 +143,12 @@ namespace Utils
|
|||||||
this->ptrList.push_back({ pointer, length });
|
this->ptrList.push_back({ pointer, length });
|
||||||
}
|
}
|
||||||
|
|
||||||
char* Stream::save(const void* _str, std::size_t size, std::size_t count)
|
char* Stream::save(const void* str, std::size_t size, std::size_t count)
|
||||||
{
|
{
|
||||||
return this->save(this->getCurrentBlock(), _str, size, count);
|
return this->save(this->getCurrentBlock(), str, size, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
char* Stream::save(Game::XFILE_BLOCK_TYPES stream, const void * _str, std::size_t size, std::size_t count)
|
char* Stream::save(Game::XFILE_BLOCK_TYPES stream, const void * str, std::size_t size, std::size_t count)
|
||||||
{
|
{
|
||||||
// Only those seem to actually write data.
|
// Only those seem to actually write data.
|
||||||
// everything else is allocated at runtime but XFILE_BLOCK_RUNTIME is the only one that actually allocates anything
|
// everything else is allocated at runtime but XFILE_BLOCK_RUNTIME is the only one that actually allocates anything
|
||||||
@ -167,7 +167,7 @@ namespace Utils
|
|||||||
__debugbreak();
|
__debugbreak();
|
||||||
}
|
}
|
||||||
|
|
||||||
this->buffer.append(static_cast<const char*>(_str), size * count);
|
this->buffer_.append(static_cast<const char*>(str), size * count);
|
||||||
|
|
||||||
if (this->data() != data && this->isCriticalSection())
|
if (this->data() != data && this->isCriticalSection())
|
||||||
{
|
{
|
||||||
@ -176,7 +176,7 @@ namespace Utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
this->increaseBlockSize(stream, size * count);
|
this->increaseBlockSize(stream, size * count);
|
||||||
this->assertPointer(_str, size * count);
|
this->assertPointer(str, size * count);
|
||||||
|
|
||||||
return this->at() - (size * count);
|
return this->at() - (size * count);
|
||||||
}
|
}
|
||||||
@ -319,7 +319,7 @@ namespace Utils
|
|||||||
|
|
||||||
char* Stream::data()
|
char* Stream::data()
|
||||||
{
|
{
|
||||||
return const_cast<char*>(this->buffer.data());
|
return const_cast<char*>(this->buffer_.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int Stream::getBlockSize(Game::XFILE_BLOCK_TYPES stream)
|
unsigned int Stream::getBlockSize(Game::XFILE_BLOCK_TYPES stream)
|
||||||
@ -350,9 +350,9 @@ namespace Utils
|
|||||||
|
|
||||||
std::string Stream::toBuffer()
|
std::string Stream::toBuffer()
|
||||||
{
|
{
|
||||||
std::string _buffer;
|
std::string buffer;
|
||||||
this->toBuffer(_buffer);
|
this->toBuffer(buffer);
|
||||||
return _buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stream::enterCriticalSection()
|
void Stream::enterCriticalSection()
|
||||||
|
@ -21,13 +21,13 @@ namespace Utils
|
|||||||
int criticalSectionState;
|
int criticalSectionState;
|
||||||
unsigned int blockSize[Game::MAX_XFILE_COUNT];
|
unsigned int blockSize[Game::MAX_XFILE_COUNT];
|
||||||
std::vector<Game::XFILE_BLOCK_TYPES> streamStack;
|
std::vector<Game::XFILE_BLOCK_TYPES> streamStack;
|
||||||
std::string buffer;
|
std::string buffer_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class Reader
|
class Reader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Reader(Memory::Allocator* _allocator, const std::string& _buffer) : position(0), buffer(_buffer), allocator(_allocator) {}
|
Reader(Memory::Allocator* allocator, std::string buffer) : position_(0), buffer_(std::move(buffer)), allocator_(allocator) {}
|
||||||
|
|
||||||
std::string readString();
|
std::string readString();
|
||||||
const char* readCString();
|
const char* readCString();
|
||||||
@ -53,18 +53,18 @@ namespace Utils
|
|||||||
auto ptr = read<int>();
|
auto ptr = read<int>();
|
||||||
auto* voidPtr = reinterpret_cast<void*>(ptr);
|
auto* voidPtr = reinterpret_cast<void*>(ptr);
|
||||||
|
|
||||||
if (allocator->isPointerMapped(voidPtr))
|
if (allocator_->isPointerMapped(voidPtr))
|
||||||
{
|
{
|
||||||
return allocator->getPointer<T>(voidPtr);
|
return allocator_->getPointer<T>(voidPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw std::runtime_error("Bad data: missing ptr");
|
throw std::runtime_error("Bad data: missing ptr");
|
||||||
}
|
}
|
||||||
case FOLLOWING:
|
case FOLLOWING:
|
||||||
{
|
{
|
||||||
auto filePosition = position;
|
auto filePosition = position_;
|
||||||
auto data = readArray<T>(count);
|
auto data = readArray<T>(count);
|
||||||
allocator->mapPointer(reinterpret_cast<void*>(filePosition), data);
|
allocator_->mapPointer(reinterpret_cast<void*>(filePosition), data);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -89,19 +89,19 @@ namespace Utils
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool end();
|
bool end() const;
|
||||||
void seek(unsigned int position);
|
void seek(unsigned int position);
|
||||||
void seekRelative(unsigned int position);
|
void seekRelative(unsigned int position);
|
||||||
|
|
||||||
void* readPointer();
|
void* readPointer();
|
||||||
void mapPointer(void* oldPointer, void* newPointer);
|
void mapPointer(void* oldPointer, void* newPointer);
|
||||||
bool hasPointer(void* pointer);
|
bool hasPointer(void* pointer) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned int position;
|
unsigned int position_;
|
||||||
std::string buffer;
|
std::string buffer_;
|
||||||
std::map<void*, void*> pointerMap;
|
std::map<void*, void*> pointerMap_;
|
||||||
Memory::Allocator* allocator;
|
Memory::Allocator* allocator_;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Alignment
|
enum Alignment
|
||||||
|
Loading…
Reference in New Issue
Block a user