mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-12 07:48:16 -05:00
Fix more gcc compilation issues
This commit is contained in:
@ -16,24 +16,24 @@ std::string AssetDumperLoadedSound::GetFileNameForAsset(Zone* zone, XAssetInfo<L
|
||||
|
||||
void AssetDumperLoadedSound::DumpWavPcm(Zone* zone, const LoadedSound* asset, std::ostream& stream)
|
||||
{
|
||||
const auto riffMasterChunkSize = sizeof WAV_CHUNK_ID_RIFF
|
||||
+ sizeof uint32_t
|
||||
+ sizeof WAV_WAVE_ID
|
||||
+ sizeof WavChunkHeader
|
||||
+ sizeof WavFormatChunkPcm
|
||||
+ sizeof WavChunkHeader
|
||||
+ sizeof asset->sound.info.data_len;
|
||||
const auto riffMasterChunkSize = sizeof(WAV_CHUNK_ID_RIFF)
|
||||
+ sizeof(uint32_t)
|
||||
+ sizeof(WAV_WAVE_ID)
|
||||
+ sizeof(WavChunkHeader)
|
||||
+ sizeof(WavFormatChunkPcm)
|
||||
+ sizeof(WavChunkHeader)
|
||||
+ sizeof(asset->sound.info.data_len);
|
||||
|
||||
stream.write(reinterpret_cast<const char*>(&WAV_CHUNK_ID_RIFF), sizeof WAV_CHUNK_ID_RIFF);
|
||||
stream.write(reinterpret_cast<const char*>(&riffMasterChunkSize), sizeof riffMasterChunkSize);
|
||||
stream.write(reinterpret_cast<const char*>(&WAV_WAVE_ID), sizeof WAV_WAVE_ID);
|
||||
stream.write(reinterpret_cast<const char*>(&WAV_CHUNK_ID_RIFF), sizeof(WAV_CHUNK_ID_RIFF));
|
||||
stream.write(reinterpret_cast<const char*>(&riffMasterChunkSize), sizeof(riffMasterChunkSize));
|
||||
stream.write(reinterpret_cast<const char*>(&WAV_WAVE_ID), sizeof(WAV_WAVE_ID));
|
||||
|
||||
const WavChunkHeader formatChunkHeader
|
||||
{
|
||||
WAV_CHUNK_ID_FMT,
|
||||
sizeof WavFormatChunkPcm
|
||||
sizeof(WavFormatChunkPcm)
|
||||
};
|
||||
stream.write(reinterpret_cast<const char*>(&formatChunkHeader), sizeof formatChunkHeader);
|
||||
stream.write(reinterpret_cast<const char*>(&formatChunkHeader), sizeof(formatChunkHeader));
|
||||
|
||||
WavFormatChunkPcm formatChunk
|
||||
{
|
||||
@ -44,14 +44,14 @@ void AssetDumperLoadedSound::DumpWavPcm(Zone* zone, const LoadedSound* asset, st
|
||||
static_cast<uint16_t>(asset->sound.info.block_size),
|
||||
static_cast<uint16_t>(asset->sound.info.bits)
|
||||
};
|
||||
stream.write(reinterpret_cast<const char*>(&formatChunk), sizeof formatChunk);
|
||||
stream.write(reinterpret_cast<const char*>(&formatChunk), sizeof(formatChunk));
|
||||
|
||||
const WavChunkHeader dataChunkHeader
|
||||
{
|
||||
WAV_CHUNK_ID_DATA,
|
||||
asset->sound.info.data_len
|
||||
};
|
||||
stream.write(reinterpret_cast<const char*>(&dataChunkHeader), sizeof dataChunkHeader);
|
||||
stream.write(reinterpret_cast<const char*>(&dataChunkHeader), sizeof(dataChunkHeader));
|
||||
stream.write(asset->sound.data, asset->sound.info.data_len);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "AssetDumperRawFile.h"
|
||||
|
||||
#include <zlib.h>
|
||||
#include <stdexcept>
|
||||
|
||||
using namespace IW4;
|
||||
|
||||
@ -31,7 +32,7 @@ void AssetDumperRawFile::DumpAsset(Zone* zone, XAssetInfo<RawFile>* asset, std::
|
||||
|
||||
if (ret != Z_OK)
|
||||
{
|
||||
throw std::exception("Initializing inflate failed");
|
||||
throw std::runtime_error("Initializing inflate failed");
|
||||
}
|
||||
|
||||
zs.next_in = reinterpret_cast<const Bytef*>(rawFile->data.compressedBuffer);
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
#include <type_traits>
|
||||
|
||||
#include "Game/IW4/InfoStringIW4.h"
|
||||
|
||||
@ -182,13 +183,13 @@ namespace IW4
|
||||
switch (static_cast<VehicleFieldType>(field.iFieldType))
|
||||
{
|
||||
case VFT_TYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, s_vehicleClassNames, _countof(s_vehicleClassNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, s_vehicleClassNames, std::extent<decltype(s_vehicleClassNames)>::value);
|
||||
break;
|
||||
|
||||
case VFT_AXLE_STEERING:
|
||||
case VFT_AXLE_POWER:
|
||||
case VFT_AXLE_BRAKING:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, s_vehicleAxleTypeNames, _countof(s_vehicleAxleTypeNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, s_vehicleAxleTypeNames, std::extent<decltype(s_vehicleAxleTypeNames)>::value);
|
||||
break;
|
||||
|
||||
case VFT_TROPHY_TAGS:
|
||||
@ -197,7 +198,7 @@ namespace IW4
|
||||
std::stringstream ss;
|
||||
bool first = true;
|
||||
|
||||
for (auto i = 0u; i < _countof(VehicleDef::trophyTags); i++)
|
||||
for (auto i = 0u; i < std::extent<decltype(VehicleDef::trophyTags)>::value; i++)
|
||||
{
|
||||
const auto& str = m_get_scr_string(trophyTags[i]);
|
||||
if (!str.empty())
|
||||
@ -242,7 +243,7 @@ std::string AssetDumperVehicle::GetFileNameForAsset(Zone* zone, XAssetInfo<Vehic
|
||||
|
||||
void AssetDumperVehicle::DumpAsset(Zone* zone, XAssetInfo<VehicleDef>* asset, std::ostream& stream)
|
||||
{
|
||||
InfoStringFromVehicleConverter converter(asset->Asset(), vehicle_fields, _countof(vehicle_fields), [asset](const scr_string_t scrStr) -> std::string
|
||||
InfoStringFromVehicleConverter converter(asset->Asset(), vehicle_fields, std::extent<decltype(vehicle_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
|
||||
{
|
||||
assert(scrStr < asset->m_zone->m_script_strings.size());
|
||||
if (scrStr >= asset->m_zone->m_script_strings.size())
|
||||
|
@ -1,7 +1,9 @@
|
||||
#include "AssetDumperWeapon.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <type_traits>
|
||||
|
||||
#include "Game/IW4/InfoStringIW4.h"
|
||||
|
||||
@ -866,47 +868,47 @@ namespace IW4
|
||||
switch (static_cast<weapFieldType_t>(field.iFieldType))
|
||||
{
|
||||
case WFT_WEAPONTYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapTypeNames, _countof(szWeapTypeNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapTypeNames, std::extent<decltype(szWeapTypeNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_WEAPONCLASS:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapClassNames, _countof(szWeapClassNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapClassNames, std::extent<decltype(szWeapClassNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_OVERLAYRETICLE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapOverlayReticleNames, _countof(szWeapOverlayReticleNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapOverlayReticleNames, std::extent<decltype(szWeapOverlayReticleNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_PENETRATE_TYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, penetrateTypeNames, _countof(penetrateTypeNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, penetrateTypeNames, std::extent<decltype(penetrateTypeNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_IMPACT_TYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, impactTypeNames, _countof(impactTypeNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, impactTypeNames, std::extent<decltype(impactTypeNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_STANCE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapStanceNames, _countof(szWeapStanceNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapStanceNames, std::extent<decltype(szWeapStanceNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_PROJ_EXPLOSION:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szProjectileExplosionNames, _countof(szProjectileExplosionNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szProjectileExplosionNames, std::extent<decltype(szProjectileExplosionNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_OFFHAND_CLASS:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, offhandClassNames, _countof(offhandClassNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, offhandClassNames, std::extent<decltype(offhandClassNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_ANIMTYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, playerAnimTypeNames, _countof(playerAnimTypeNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, playerAnimTypeNames, std::extent<decltype(playerAnimTypeNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_ACTIVE_RETICLE_TYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, activeReticleNames, _countof(activeReticleNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, activeReticleNames, std::extent<decltype(activeReticleNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_GUIDED_MISSILE_TYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, guidedMissileNames, _countof(guidedMissileNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, guidedMissileNames, std::extent<decltype(guidedMissileNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_BOUNCE_SOUND:
|
||||
@ -934,23 +936,23 @@ namespace IW4
|
||||
}
|
||||
|
||||
case WFT_STICKINESS:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, stickinessNames, _countof(stickinessNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, stickinessNames, std::extent<decltype(stickinessNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_OVERLAYINTERFACE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, overlayInterfaceNames, _countof(overlayInterfaceNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, overlayInterfaceNames, std::extent<decltype(overlayInterfaceNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_INVENTORYTYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapInventoryTypeNames, _countof(szWeapInventoryTypeNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapInventoryTypeNames, std::extent<decltype(szWeapInventoryTypeNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_FIRETYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapFireTypeNames, _countof(szWeapFireTypeNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapFireTypeNames, std::extent<decltype(szWeapFireTypeNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_AMMOCOUNTER_CLIPTYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, ammoCounterClipNames, _countof(ammoCounterClipNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, ammoCounterClipNames, std::extent<decltype(ammoCounterClipNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_ICONRATIO_HUD:
|
||||
@ -958,7 +960,7 @@ namespace IW4
|
||||
case WFT_ICONRATIO_AMMOCOUNTER:
|
||||
case WFT_ICONRATIO_KILL:
|
||||
case WFT_ICONRATIO_DPAD:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, weapIconRatioNames, _countof(weapIconRatioNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, weapIconRatioNames, std::extent<decltype(weapIconRatioNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_HIDETAGS:
|
||||
@ -967,7 +969,7 @@ namespace IW4
|
||||
std::stringstream ss;
|
||||
bool first = true;
|
||||
|
||||
for (auto i = 0u; i < _countof(WeaponFullDef::hideTags); i++)
|
||||
for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::hideTags)>::value; i++)
|
||||
{
|
||||
const auto& str = m_get_scr_string(hideTags[i]);
|
||||
if (!str.empty())
|
||||
@ -988,11 +990,11 @@ namespace IW4
|
||||
case WFT_NOTETRACKSOUNDMAP:
|
||||
{
|
||||
const auto* keys = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
|
||||
const auto* values = &keys[_countof(WeaponFullDef::notetrackSoundMapKeys)];
|
||||
const auto* values = &keys[std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value];
|
||||
std::stringstream ss;
|
||||
bool first = true;
|
||||
|
||||
for (auto i = 0u; i < _countof(WeaponFullDef::notetrackSoundMapKeys); i++)
|
||||
for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value; i++)
|
||||
{
|
||||
const auto& key = m_get_scr_string(keys[i]);
|
||||
const auto& value = m_get_scr_string(values[i]);
|
||||
@ -1017,11 +1019,11 @@ namespace IW4
|
||||
case WFT_NOTETRACKRUMBLEMAP:
|
||||
{
|
||||
const auto* keys = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
|
||||
const auto* values = &keys[_countof(WeaponFullDef::notetrackRumbleMapKeys)];
|
||||
const auto* values = &keys[std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value];
|
||||
std::stringstream ss;
|
||||
bool first = true;
|
||||
|
||||
for (auto i = 0u; i < _countof(WeaponFullDef::notetrackRumbleMapKeys); i++)
|
||||
for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value; i++)
|
||||
{
|
||||
const auto& key = m_get_scr_string(keys[i]);
|
||||
const auto& value = m_get_scr_string(values[i]);
|
||||
@ -1070,84 +1072,92 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponCompleteDef* weapon, WeaponFul
|
||||
|
||||
if (weapon->hideTags)
|
||||
{
|
||||
memcpy_s(fullDef->hideTags, sizeof WeaponFullDef::hideTags, weapon->hideTags, sizeof(scr_string_t) * _countof(WeaponFullDef::hideTags));
|
||||
assert(sizeof(WeaponFullDef::hideTags) >= sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::hideTags)>::value);
|
||||
memcpy(fullDef->hideTags, weapon->hideTags, sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::hideTags)>::value);
|
||||
fullDef->weapCompleteDef.hideTags = fullDef->hideTags;
|
||||
}
|
||||
|
||||
if (weapon->szXAnims)
|
||||
{
|
||||
memcpy_s(fullDef->szXAnims, sizeof WeaponFullDef::szXAnims, weapon->szXAnims, sizeof(void*) * NUM_WEAP_ANIMS);
|
||||
assert(sizeof(WeaponFullDef::szXAnims) >= sizeof(void*) * NUM_WEAP_ANIMS);
|
||||
memcpy(fullDef->szXAnims, weapon->szXAnims, sizeof(void*) * NUM_WEAP_ANIMS);
|
||||
fullDef->weapCompleteDef.szXAnims = fullDef->szXAnims;
|
||||
}
|
||||
|
||||
if (fullDef->weapDef.gunXModel)
|
||||
{
|
||||
memcpy_s(fullDef->gunXModel, sizeof WeaponFullDef::gunXModel, fullDef->weapDef.gunXModel, sizeof(void*) * _countof(WeaponFullDef::gunXModel));
|
||||
assert(sizeof(WeaponFullDef::gunXModel) >= sizeof(void*) * std::extent<decltype(WeaponFullDef::gunXModel)>::value);
|
||||
memcpy(fullDef->gunXModel, fullDef->weapDef.gunXModel, sizeof(void*) * std::extent<decltype(WeaponFullDef::gunXModel)>::value);
|
||||
fullDef->weapDef.gunXModel = fullDef->gunXModel;
|
||||
}
|
||||
|
||||
if (fullDef->weapDef.szXAnimsRightHanded)
|
||||
{
|
||||
memcpy_s(fullDef->szXAnimsRightHanded, sizeof WeaponFullDef::szXAnimsRightHanded, fullDef->weapDef.szXAnimsRightHanded, sizeof(void*) * NUM_WEAP_ANIMS);
|
||||
assert(sizeof(WeaponFullDef::szXAnimsRightHanded) >= sizeof(void*) * NUM_WEAP_ANIMS);
|
||||
memcpy(fullDef->szXAnimsRightHanded, fullDef->weapDef.szXAnimsRightHanded, sizeof(void*) * NUM_WEAP_ANIMS);
|
||||
fullDef->weapDef.szXAnimsRightHanded = fullDef->szXAnimsRightHanded;
|
||||
}
|
||||
|
||||
if (fullDef->weapDef.szXAnimsLeftHanded)
|
||||
{
|
||||
memcpy_s(fullDef->szXAnimsLeftHanded, sizeof WeaponFullDef::szXAnimsLeftHanded, fullDef->weapDef.szXAnimsLeftHanded, sizeof(void*) * NUM_WEAP_ANIMS);
|
||||
assert(sizeof(WeaponFullDef::szXAnimsLeftHanded) >= sizeof(void*) * NUM_WEAP_ANIMS);
|
||||
memcpy(fullDef->szXAnimsLeftHanded, fullDef->weapDef.szXAnimsLeftHanded, sizeof(void*) * NUM_WEAP_ANIMS);
|
||||
fullDef->weapDef.szXAnimsLeftHanded = fullDef->szXAnimsLeftHanded;
|
||||
}
|
||||
|
||||
if (fullDef->weapDef.notetrackSoundMapKeys)
|
||||
{
|
||||
memcpy_s(fullDef->notetrackSoundMapKeys, sizeof WeaponFullDef::notetrackSoundMapKeys, fullDef->weapDef.notetrackSoundMapKeys,
|
||||
sizeof(scr_string_t) * _countof(WeaponFullDef::notetrackSoundMapKeys));
|
||||
assert(sizeof(WeaponFullDef::notetrackSoundMapKeys) >= sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value);
|
||||
memcpy(fullDef->notetrackSoundMapKeys, fullDef->weapDef.notetrackSoundMapKeys, sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value);
|
||||
fullDef->weapDef.notetrackSoundMapKeys = fullDef->notetrackSoundMapKeys;
|
||||
}
|
||||
|
||||
if (fullDef->weapDef.notetrackSoundMapValues)
|
||||
{
|
||||
memcpy_s(fullDef->notetrackSoundMapValues, sizeof WeaponFullDef::notetrackSoundMapValues, fullDef->weapDef.notetrackSoundMapValues,
|
||||
sizeof(scr_string_t) * _countof(WeaponFullDef::notetrackSoundMapKeys));
|
||||
assert(sizeof(WeaponFullDef::notetrackSoundMapValues) >= sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value);
|
||||
memcpy(fullDef->notetrackSoundMapValues, fullDef->weapDef.notetrackSoundMapValues, sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value);
|
||||
fullDef->weapDef.notetrackSoundMapValues = fullDef->notetrackSoundMapValues;
|
||||
}
|
||||
|
||||
if (fullDef->weapDef.notetrackRumbleMapKeys)
|
||||
{
|
||||
memcpy_s(fullDef->notetrackRumbleMapKeys, sizeof WeaponFullDef::notetrackRumbleMapKeys, fullDef->weapDef.notetrackRumbleMapKeys,
|
||||
sizeof(scr_string_t) * _countof(WeaponFullDef::notetrackRumbleMapKeys));
|
||||
assert(sizeof(WeaponFullDef::notetrackRumbleMapKeys) >= sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value);
|
||||
memcpy(fullDef->notetrackRumbleMapKeys, fullDef->weapDef.notetrackRumbleMapKeys, sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value);
|
||||
fullDef->weapDef.notetrackRumbleMapKeys = fullDef->notetrackRumbleMapKeys;
|
||||
}
|
||||
|
||||
if (fullDef->weapDef.notetrackRumbleMapValues)
|
||||
{
|
||||
memcpy_s(fullDef->notetrackRumbleMapValues, sizeof WeaponFullDef::notetrackRumbleMapValues, fullDef->weapDef.notetrackRumbleMapValues,
|
||||
sizeof(scr_string_t) * _countof(WeaponFullDef::notetrackRumbleMapKeys));
|
||||
assert(sizeof(WeaponFullDef::notetrackRumbleMapValues) >= sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value);
|
||||
memcpy(fullDef->notetrackRumbleMapValues, fullDef->weapDef.notetrackRumbleMapValues, sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value);
|
||||
fullDef->weapDef.notetrackRumbleMapValues = fullDef->notetrackRumbleMapValues;
|
||||
}
|
||||
|
||||
if (fullDef->weapDef.worldModel)
|
||||
{
|
||||
memcpy_s(fullDef->worldModel, sizeof WeaponFullDef::worldModel, fullDef->weapDef.worldModel, sizeof(void*) * _countof(WeaponFullDef::worldModel));
|
||||
assert(sizeof(WeaponFullDef::worldModel) >= sizeof(void*) * std::extent<decltype(WeaponFullDef::worldModel)>::value);
|
||||
memcpy(fullDef->worldModel, fullDef->weapDef.worldModel, sizeof(void*) * std::extent<decltype(WeaponFullDef::worldModel)>::value);
|
||||
fullDef->weapDef.worldModel = fullDef->worldModel;
|
||||
}
|
||||
|
||||
if (fullDef->weapDef.parallelBounce)
|
||||
{
|
||||
memcpy_s(fullDef->parallelBounce, sizeof WeaponFullDef::parallelBounce, fullDef->weapDef.parallelBounce, sizeof(float) * _countof(WeaponFullDef::parallelBounce));
|
||||
assert(sizeof(WeaponFullDef::parallelBounce) >= sizeof(float) * std::extent<decltype(WeaponFullDef::parallelBounce)>::value);
|
||||
memcpy(fullDef->parallelBounce, fullDef->weapDef.parallelBounce, sizeof(float) * std::extent<decltype(WeaponFullDef::parallelBounce)>::value);
|
||||
fullDef->weapDef.parallelBounce = fullDef->parallelBounce;
|
||||
}
|
||||
|
||||
if (fullDef->weapDef.perpendicularBounce)
|
||||
{
|
||||
memcpy_s(fullDef->perpendicularBounce, sizeof WeaponFullDef::perpendicularBounce, fullDef->weapDef.perpendicularBounce, sizeof(float) * _countof(WeaponFullDef::perpendicularBounce));
|
||||
assert(sizeof(WeaponFullDef::perpendicularBounce) >= sizeof(float) * std::extent<decltype(WeaponFullDef::perpendicularBounce)>::value);
|
||||
memcpy(fullDef->perpendicularBounce, fullDef->weapDef.perpendicularBounce, sizeof(float) * std::extent<decltype(WeaponFullDef::perpendicularBounce)>::value);
|
||||
fullDef->weapDef.perpendicularBounce = fullDef->perpendicularBounce;
|
||||
}
|
||||
|
||||
if (fullDef->weapDef.locationDamageMultipliers)
|
||||
{
|
||||
memcpy_s(fullDef->locationDamageMultipliers, sizeof WeaponFullDef::locationDamageMultipliers, fullDef->weapDef.locationDamageMultipliers,
|
||||
sizeof(float) * _countof(WeaponFullDef::locationDamageMultipliers));
|
||||
assert(sizeof(WeaponFullDef::locationDamageMultipliers) >= sizeof(float) * std::extent<decltype(WeaponFullDef::locationDamageMultipliers)>::value);
|
||||
memcpy(fullDef->locationDamageMultipliers, fullDef->weapDef.locationDamageMultipliers, sizeof(float) * std::extent<decltype(WeaponFullDef::locationDamageMultipliers)>::value);
|
||||
fullDef->weapDef.locationDamageMultipliers = fullDef->locationDamageMultipliers;
|
||||
}
|
||||
}
|
||||
@ -1165,10 +1175,10 @@ std::string AssetDumperWeapon::GetFileNameForAsset(Zone* zone, XAssetInfo<Weapon
|
||||
void AssetDumperWeapon::DumpAsset(Zone* zone, XAssetInfo<WeaponCompleteDef>* asset, std::ostream& stream)
|
||||
{
|
||||
auto* fullDef = new WeaponFullDef;
|
||||
memset(fullDef, 0, sizeof WeaponFullDef);
|
||||
memset(fullDef, 0, sizeof(WeaponFullDef));
|
||||
CopyToFullDef(asset->Asset(), fullDef);
|
||||
|
||||
InfoStringFromWeaponConverter converter(fullDef, weapon_fields, _countof(weapon_fields), [asset](const scr_string_t scrStr) -> std::string
|
||||
InfoStringFromWeaponConverter converter(fullDef, weapon_fields, std::extent<decltype(weapon_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
|
||||
{
|
||||
assert(scrStr < asset->m_zone->m_script_strings.size());
|
||||
if (scrStr >= asset->m_zone->m_script_strings.size())
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "AssetDumperPhysConstraints.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <type_traits>
|
||||
|
||||
#include "Game/T6/InfoStringT6.h"
|
||||
|
||||
@ -110,7 +111,7 @@ namespace T6
|
||||
switch (static_cast<constraintsFieldType_t>(field.iFieldType))
|
||||
{
|
||||
case CFT_TYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, s_constraintTypeNames, _countof(s_constraintTypeNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, s_constraintTypeNames, std::extent<decltype(s_constraintTypeNames)>::value);
|
||||
break;
|
||||
|
||||
case CFT_NUM:
|
||||
@ -142,7 +143,7 @@ void AssetDumperPhysConstraints::DumpAsset(Zone* zone, XAssetInfo<PhysConstraint
|
||||
{
|
||||
assert(asset->Asset()->count <= 4);
|
||||
|
||||
InfoStringFromPhysConstraintsConverter converter(asset->Asset(), phys_constraints_fields, _countof(phys_constraints_fields), [asset](const scr_string_t scrStr) -> std::string
|
||||
InfoStringFromPhysConstraintsConverter converter(asset->Asset(), phys_constraints_fields, std::extent<decltype(phys_constraints_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
|
||||
{
|
||||
assert(scrStr < asset->m_zone->m_script_strings.size());
|
||||
if (scrStr >= asset->m_zone->m_script_strings.size())
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <type_traits>
|
||||
|
||||
#include "Game/T6/InfoStringT6.h"
|
||||
|
||||
@ -54,7 +55,7 @@ void AssetDumperPhysPreset::CopyToPhysPresetInfo(const PhysPreset* physPreset, P
|
||||
physPresetInfo->mass = std::clamp(physPreset->mass * 1000.0f, 1.0f, 2000.0f);
|
||||
physPresetInfo->bounce = physPreset->bounce;
|
||||
|
||||
if(isinf(physPreset->friction))
|
||||
if(std::isinf(physPreset->friction))
|
||||
{
|
||||
physPresetInfo->isFrictionInfinity = 1;
|
||||
physPresetInfo->friction = 0;
|
||||
@ -91,7 +92,7 @@ void AssetDumperPhysPreset::DumpAsset(Zone* zone, XAssetInfo<PhysPreset>* asset,
|
||||
auto* physPresetInfo = new PhysPresetInfo;
|
||||
CopyToPhysPresetInfo(asset->Asset(), physPresetInfo);
|
||||
|
||||
InfoStringFromPhysPresetConverter converter(physPresetInfo, physpreset_fields, _countof(physpreset_fields), [asset](const scr_string_t scrStr) -> std::string
|
||||
InfoStringFromPhysPresetConverter converter(physPresetInfo, physpreset_fields, std::extent<decltype(physpreset_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
|
||||
{
|
||||
assert(scrStr < asset->m_zone->m_script_strings.size());
|
||||
if (scrStr >= asset->m_zone->m_script_strings.size())
|
||||
@ -109,9 +110,9 @@ void AssetDumperPhysPreset::DumpAsset(Zone* zone, XAssetInfo<PhysPreset>* asset,
|
||||
|
||||
//void AssetDumperPhysPreset::CheckFields()
|
||||
//{
|
||||
// assert(_countof(physpreset_fields) == _countof(fields222));
|
||||
// assert(std::extent<decltype(physpreset_fields)>::value == std::extent<decltype(fields222)>::value);
|
||||
//
|
||||
// for(auto i = 0u; i < _countof(physpreset_fields); i++)
|
||||
// for(auto i = 0u; i < std::extent<decltype(physpreset_fields)>::value; i++)
|
||||
// {
|
||||
// if(physpreset_fields[i].iOffset != fields222[i].iOffset)
|
||||
// {
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "AssetDumperTracer.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <type_traits>
|
||||
|
||||
#include "Game/T6/InfoStringT6.h"
|
||||
|
||||
@ -57,7 +58,7 @@ namespace T6
|
||||
switch (static_cast<tracerFieldType_t>(field.iFieldType))
|
||||
{
|
||||
case TFT_TRACERTYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, tracerTypeNames, _countof(tracerTypeNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, tracerTypeNames, std::extent<decltype(tracerTypeNames)>::value);
|
||||
break;
|
||||
|
||||
case TFT_NUM_FIELD_TYPES:
|
||||
@ -87,7 +88,7 @@ std::string AssetDumperTracer::GetFileNameForAsset(Zone* zone, XAssetInfo<Tracer
|
||||
|
||||
void AssetDumperTracer::DumpAsset(Zone* zone, XAssetInfo<TracerDef>* asset, std::ostream& stream)
|
||||
{
|
||||
InfoStringFromTracerConverter converter(asset->Asset(), tracer_fields, _countof(tracer_fields), [asset](const scr_string_t scrStr) -> std::string
|
||||
InfoStringFromTracerConverter converter(asset->Asset(), tracer_fields, std::extent<decltype(tracer_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
|
||||
{
|
||||
assert(scrStr < asset->m_zone->m_script_strings.size());
|
||||
if (scrStr >= asset->m_zone->m_script_strings.size())
|
||||
@ -99,22 +100,4 @@ void AssetDumperTracer::DumpAsset(Zone* zone, XAssetInfo<TracerDef>* asset, std:
|
||||
const auto infoString = converter.Convert();
|
||||
const auto stringValue = infoString.ToString("TRACER");
|
||||
stream.write(stringValue.c_str(), stringValue.size());
|
||||
}
|
||||
|
||||
//void AssetDumperTracer::CheckFields()
|
||||
//{
|
||||
// assert(_countof(tracer_fields) == _countof(fields222));
|
||||
//
|
||||
// for(auto i = 0u; i < _countof(tracer_fields); i++)
|
||||
// {
|
||||
// if(tracer_fields[i].iOffset != fields222[i].iOffset)
|
||||
// {
|
||||
// std::string error = "Error in field: " + std::string(tracer_fields[i].szName);
|
||||
// MessageBoxA(NULL, error.c_str(), "", 0);
|
||||
// exit(0);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// MessageBoxA(NULL, "No error", "", 0);
|
||||
// exit(0);
|
||||
//}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
#include "AssetDumperVehicle.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <type_traits>
|
||||
|
||||
#include "Game/T6/InfoStringT6.h"
|
||||
|
||||
@ -606,15 +607,15 @@ namespace T6
|
||||
switch (static_cast<VehicleFieldType>(field.iFieldType))
|
||||
{
|
||||
case VFT_TYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, s_vehicleClassNames, _countof(s_vehicleClassNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, s_vehicleClassNames, std::extent<decltype(s_vehicleClassNames)>::value);
|
||||
break;
|
||||
|
||||
case VFT_CAMERAMODE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, s_vehicleCameraModes, _countof(s_vehicleCameraModes));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, s_vehicleCameraModes, std::extent<decltype(s_vehicleCameraModes)>::value);
|
||||
break;
|
||||
|
||||
case VFT_TRACTION_TYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, s_tractionTypeNames, _countof(s_tractionTypeNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, s_tractionTypeNames, std::extent<decltype(s_tractionTypeNames)>::value);
|
||||
break;
|
||||
|
||||
case VFT_MPH_TO_INCHES_PER_SECOND:
|
||||
@ -682,7 +683,7 @@ std::string AssetDumperVehicle::GetFileNameForAsset(Zone* zone, XAssetInfo<Vehic
|
||||
|
||||
void AssetDumperVehicle::DumpAsset(Zone* zone, XAssetInfo<VehicleDef>* asset, std::ostream& stream)
|
||||
{
|
||||
InfoStringFromVehicleConverter converter(asset->Asset(), vehicle_fields, _countof(vehicle_fields), [asset](const scr_string_t scrStr) -> std::string
|
||||
InfoStringFromVehicleConverter converter(asset->Asset(), vehicle_fields, std::extent<decltype(vehicle_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
|
||||
{
|
||||
assert(scrStr < asset->m_zone->m_script_strings.size());
|
||||
if (scrStr >= asset->m_zone->m_script_strings.size())
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
#include <type_traits>
|
||||
#include <cstring>
|
||||
|
||||
#include "Game/T6/InfoStringT6.h"
|
||||
|
||||
@ -1293,58 +1295,56 @@ namespace T6
|
||||
switch (static_cast<weapFieldType_t>(field.iFieldType))
|
||||
{
|
||||
case WFT_WEAPONTYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapTypeNames, _countof(szWeapTypeNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapTypeNames, std::extent<decltype(szWeapTypeNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_WEAPONCLASS:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapClassNames, _countof(szWeapClassNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapClassNames, std::extent<decltype(szWeapClassNames)>::value);
|
||||
break;
|
||||
case WFT_OVERLAYRETICLE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapOverlayReticleNames,
|
||||
_countof(szWeapOverlayReticleNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapOverlayReticleNames, std::extent<decltype(szWeapOverlayReticleNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_PENETRATE_TYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, penetrateTypeNames,
|
||||
_countof(penetrateTypeNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, penetrateTypeNames, std::extent<decltype(penetrateTypeNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_IMPACT_TYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, impactTypeNames, _countof(impactTypeNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, impactTypeNames, std::extent<decltype(impactTypeNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_STANCE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapStanceNames,
|
||||
_countof(szWeapStanceNames));
|
||||
std::extent<decltype(szWeapStanceNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_PROJ_EXPLOSION:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szProjectileExplosionNames,
|
||||
_countof(szProjectileExplosionNames));
|
||||
std::extent<decltype(szProjectileExplosionNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_OFFHAND_CLASS:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, offhandClassNames,
|
||||
_countof(offhandClassNames));
|
||||
std::extent<decltype(offhandClassNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_OFFHAND_SLOT:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, offhandSlotNames, _countof(offhandSlotNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, offhandSlotNames, std::extent<decltype(offhandSlotNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_ANIMTYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, playerAnimTypeNames,
|
||||
_countof(playerAnimTypeNames));
|
||||
std::extent<decltype(playerAnimTypeNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_ACTIVE_RETICLE_TYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, activeReticleNames,
|
||||
_countof(activeReticleNames));
|
||||
std::extent<decltype(activeReticleNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_GUIDED_MISSILE_TYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, guidedMissileNames,
|
||||
_countof(guidedMissileNames));
|
||||
std::extent<decltype(guidedMissileNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_BOUNCE_SOUND:
|
||||
@ -1373,36 +1373,36 @@ namespace T6
|
||||
}
|
||||
|
||||
case WFT_STICKINESS:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, stickinessNames, _countof(stickinessNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, stickinessNames, std::extent<decltype(stickinessNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_ROTATETYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, rotateTypeNames, _countof(rotateTypeNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, rotateTypeNames, std::extent<decltype(rotateTypeNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_OVERLAYINTERFACE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, overlayInterfaceNames,
|
||||
_countof(overlayInterfaceNames));
|
||||
std::extent<decltype(overlayInterfaceNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_INVENTORYTYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapInventoryTypeNames,
|
||||
_countof(szWeapInventoryTypeNames));
|
||||
std::extent<decltype(szWeapInventoryTypeNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_FIRETYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapFireTypeNames,
|
||||
_countof(szWeapFireTypeNames));
|
||||
std::extent<decltype(szWeapFireTypeNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_CLIPTYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapClipTypeNames,
|
||||
_countof(szWeapClipTypeNames));
|
||||
std::extent<decltype(szWeapClipTypeNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_AMMOCOUNTER_CLIPTYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, ammoCounterClipNames,
|
||||
_countof(ammoCounterClipNames));
|
||||
std::extent<decltype(ammoCounterClipNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_ICONRATIO_HUD:
|
||||
@ -1411,11 +1411,11 @@ namespace T6
|
||||
case WFT_ICONRATIO_DPAD:
|
||||
case WFT_ICONRATIO_INDICATOR:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, weapIconRatioNames,
|
||||
_countof(weapIconRatioNames));
|
||||
std::extent<decltype(weapIconRatioNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_BARRELTYPE:
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, barrelTypeNames, _countof(barrelTypeNames));
|
||||
FillFromEnumInt(std::string(field.szName), field.iOffset, barrelTypeNames, std::extent<decltype(barrelTypeNames)>::value);
|
||||
break;
|
||||
|
||||
case WFT_HIDETAGS:
|
||||
@ -1424,7 +1424,7 @@ namespace T6
|
||||
std::stringstream ss;
|
||||
bool first = true;
|
||||
|
||||
for (auto i = 0u; i < _countof(WeaponFullDef::hideTags); i++)
|
||||
for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::hideTags)>::value; i++)
|
||||
{
|
||||
const auto& str = m_get_scr_string(hideTags[i]);
|
||||
if (!str.empty())
|
||||
@ -1449,11 +1449,11 @@ namespace T6
|
||||
case WFT_NOTETRACKSOUNDMAP:
|
||||
{
|
||||
const auto* keys = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
|
||||
const auto* values = &keys[_countof(WeaponFullDef::notetrackSoundMapKeys)];
|
||||
const auto* values = &keys[std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value];
|
||||
std::stringstream ss;
|
||||
bool first = true;
|
||||
|
||||
for (auto i = 0u; i < _countof(WeaponFullDef::notetrackSoundMapKeys); i++)
|
||||
for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value; i++)
|
||||
{
|
||||
const auto& key = m_get_scr_string(keys[i]);
|
||||
const auto& value = m_get_scr_string(values[i]);
|
||||
@ -1514,99 +1514,112 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponVariantDef* weapon, WeaponFull
|
||||
|
||||
if (weapon->attachments)
|
||||
{
|
||||
memcpy_s(fullDef->attachments, sizeof WeaponFullDef::attachments, weapon->attachments, sizeof(void*) * _countof(WeaponFullDef::attachments));
|
||||
assert(sizeof(WeaponFullDef::attachments) >= sizeof(void*) * std::extent<decltype(WeaponFullDef::attachments)>::value);
|
||||
memcpy(fullDef->attachments, weapon->attachments, sizeof(void*) * std::extent<decltype(WeaponFullDef::attachments)>::value);
|
||||
fullDef->weapVariantDef.attachments = fullDef->attachments;
|
||||
}
|
||||
|
||||
if (weapon->attachmentUniques)
|
||||
{
|
||||
memcpy_s(fullDef->attachmentUniques, sizeof WeaponFullDef::attachmentUniques, weapon->attachmentUniques, sizeof(void*) * _countof(WeaponFullDef::attachmentUniques));
|
||||
assert(sizeof(WeaponFullDef::attachmentUniques) >= sizeof(void*) * std::extent<decltype(WeaponFullDef::attachmentUniques)>::value);
|
||||
memcpy(fullDef->attachmentUniques, weapon->attachmentUniques, sizeof(void*) * std::extent<decltype(WeaponFullDef::attachmentUniques)>::value);
|
||||
fullDef->weapVariantDef.attachmentUniques = fullDef->attachmentUniques;
|
||||
}
|
||||
|
||||
if (fullDef->weapDef.gunXModel)
|
||||
{
|
||||
memcpy_s(fullDef->gunXModel, sizeof WeaponFullDef::gunXModel, fullDef->weapDef.gunXModel, sizeof(void*) * _countof(WeaponFullDef::gunXModel));
|
||||
assert(sizeof(WeaponFullDef::gunXModel) >= sizeof(void*) * std::extent<decltype(WeaponFullDef::gunXModel)>::value);
|
||||
memcpy(fullDef->gunXModel, fullDef->weapDef.gunXModel, sizeof(void*) * std::extent<decltype(WeaponFullDef::gunXModel)>::value);
|
||||
fullDef->weapDef.gunXModel = fullDef->gunXModel;
|
||||
}
|
||||
|
||||
if (weapon->szXAnims)
|
||||
{
|
||||
memcpy_s(fullDef->szXAnims, sizeof WeaponFullDef::szXAnims, weapon->szXAnims, sizeof(void*) * NUM_WEAP_ANIMS);
|
||||
assert(sizeof(WeaponFullDef::szXAnims) >= sizeof(void*) * NUM_WEAP_ANIMS);
|
||||
memcpy(fullDef->szXAnims, weapon->szXAnims, sizeof(void*) * NUM_WEAP_ANIMS);
|
||||
fullDef->weapVariantDef.szXAnims = fullDef->szXAnims;
|
||||
}
|
||||
|
||||
if (weapon->hideTags)
|
||||
{
|
||||
memcpy_s(fullDef->hideTags, sizeof WeaponFullDef::hideTags, weapon->hideTags, sizeof(scr_string_t) * _countof(WeaponFullDef::hideTags));
|
||||
assert(sizeof(WeaponFullDef::hideTags) >= sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::hideTags)>::value);
|
||||
memcpy(fullDef->hideTags, weapon->hideTags, sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::hideTags)>::value);
|
||||
fullDef->weapVariantDef.hideTags = fullDef->hideTags;
|
||||
}
|
||||
|
||||
if (fullDef->weapDef.notetrackSoundMapKeys)
|
||||
{
|
||||
memcpy_s(fullDef->notetrackSoundMapKeys, sizeof WeaponFullDef::notetrackSoundMapKeys, fullDef->weapDef.notetrackSoundMapKeys,
|
||||
sizeof(scr_string_t) * _countof(WeaponFullDef::notetrackSoundMapKeys));
|
||||
assert(sizeof(WeaponFullDef::notetrackSoundMapKeys) >= sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value);
|
||||
memcpy(fullDef->notetrackSoundMapKeys, fullDef->weapDef.notetrackSoundMapKeys, sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value);
|
||||
fullDef->weapDef.notetrackSoundMapKeys = fullDef->notetrackSoundMapKeys;
|
||||
}
|
||||
|
||||
if (fullDef->weapDef.notetrackSoundMapValues)
|
||||
{
|
||||
memcpy_s(fullDef->notetrackSoundMapValues, sizeof WeaponFullDef::notetrackSoundMapValues, fullDef->weapDef.notetrackSoundMapValues,
|
||||
sizeof(scr_string_t) * _countof(WeaponFullDef::notetrackSoundMapValues));
|
||||
assert(sizeof(WeaponFullDef::notetrackSoundMapValues) >= sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackSoundMapValues)>::value);
|
||||
memcpy(fullDef->notetrackSoundMapValues, fullDef->weapDef.notetrackSoundMapValues, sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackSoundMapValues)>::value);
|
||||
fullDef->weapDef.notetrackSoundMapValues = fullDef->notetrackSoundMapValues;
|
||||
}
|
||||
|
||||
if (fullDef->weapDef.worldModel)
|
||||
{
|
||||
memcpy_s(fullDef->worldModel, sizeof WeaponFullDef::worldModel, fullDef->weapDef.worldModel, sizeof(void*) * _countof(WeaponFullDef::worldModel));
|
||||
assert(sizeof(WeaponFullDef::worldModel) >= sizeof(void*) * std::extent<decltype(WeaponFullDef::worldModel)>::value);
|
||||
memcpy(fullDef->worldModel, fullDef->weapDef.worldModel, sizeof(void*) * std::extent<decltype(WeaponFullDef::worldModel)>::value);
|
||||
fullDef->weapDef.worldModel = fullDef->worldModel;
|
||||
}
|
||||
|
||||
if (weapon->attachViewModel)
|
||||
{
|
||||
memcpy_s(fullDef->attachViewModel, sizeof WeaponFullDef::attachViewModel, weapon->attachViewModel, sizeof(void*) * _countof(WeaponFullDef::attachViewModel));
|
||||
assert(sizeof(WeaponFullDef::attachViewModel) >= sizeof(void*) * std::extent<decltype(WeaponFullDef::attachViewModel)>::value);
|
||||
memcpy(fullDef->attachViewModel, weapon->attachViewModel, sizeof(void*) * std::extent<decltype(WeaponFullDef::attachViewModel)>::value);
|
||||
fullDef->weapVariantDef.attachViewModel = fullDef->attachViewModel;
|
||||
}
|
||||
|
||||
if (weapon->attachWorldModel)
|
||||
{
|
||||
memcpy_s(fullDef->attachWorldModel, sizeof WeaponFullDef::attachWorldModel, weapon->attachWorldModel, sizeof(void*) * _countof(WeaponFullDef::attachWorldModel));
|
||||
assert(sizeof(WeaponFullDef::attachWorldModel) >= sizeof(void*) * std::extent<decltype(WeaponFullDef::attachWorldModel)>::value);
|
||||
memcpy(fullDef->attachWorldModel, weapon->attachWorldModel, sizeof(void*) * std::extent<decltype(WeaponFullDef::attachWorldModel)>::value);
|
||||
fullDef->weapVariantDef.attachWorldModel = fullDef->attachWorldModel;
|
||||
}
|
||||
|
||||
if (weapon->attachViewModelTag)
|
||||
{
|
||||
memcpy_s(fullDef->attachViewModelTag, sizeof WeaponFullDef::attachViewModelTag, weapon->attachViewModelTag, sizeof(void*) * _countof(WeaponFullDef::attachViewModelTag));
|
||||
assert(sizeof(WeaponFullDef::attachViewModelTag) >= sizeof(void*) * std::extent<decltype(WeaponFullDef::attachViewModelTag)>::value);
|
||||
memcpy(fullDef->attachViewModelTag, weapon->attachViewModelTag, sizeof(void*) * std::extent<decltype(WeaponFullDef::attachViewModelTag)>::value);
|
||||
fullDef->weapVariantDef.attachViewModelTag = fullDef->attachViewModelTag;
|
||||
}
|
||||
|
||||
if (weapon->attachWorldModelTag)
|
||||
{
|
||||
memcpy_s(fullDef->attachWorldModelTag, sizeof WeaponFullDef::attachWorldModelTag, weapon->attachWorldModelTag, sizeof(void*) * _countof(WeaponFullDef::attachWorldModelTag));
|
||||
assert(sizeof(WeaponFullDef::attachWorldModelTag) >= sizeof(void*) * std::extent<decltype(WeaponFullDef::attachWorldModelTag)>::value);
|
||||
memcpy(fullDef->attachWorldModelTag, weapon->attachWorldModelTag, sizeof(void*) * std::extent<decltype(WeaponFullDef::attachWorldModelTag)>::value);
|
||||
fullDef->weapVariantDef.attachWorldModelTag = fullDef->attachWorldModelTag;
|
||||
}
|
||||
|
||||
if (fullDef->weapDef.parallelBounce)
|
||||
{
|
||||
memcpy_s(fullDef->parallelBounce, sizeof WeaponFullDef::parallelBounce, fullDef->weapDef.parallelBounce, sizeof(float) * SURF_TYPE_NUM);
|
||||
assert(sizeof(WeaponFullDef::parallelBounce) >= sizeof(float) * SURF_TYPE_NUM);
|
||||
memcpy(fullDef->parallelBounce, fullDef->weapDef.parallelBounce, sizeof(float) * SURF_TYPE_NUM);
|
||||
fullDef->weapDef.parallelBounce = fullDef->parallelBounce;
|
||||
}
|
||||
|
||||
if (fullDef->weapDef.perpendicularBounce)
|
||||
{
|
||||
memcpy_s(fullDef->perpendicularBounce, sizeof WeaponFullDef::perpendicularBounce, fullDef->weapDef.perpendicularBounce, sizeof(float) * SURF_TYPE_NUM);
|
||||
assert(sizeof(WeaponFullDef::perpendicularBounce) >= sizeof(float) * SURF_TYPE_NUM);
|
||||
memcpy(fullDef->perpendicularBounce, fullDef->weapDef.perpendicularBounce, sizeof(float) * SURF_TYPE_NUM);
|
||||
fullDef->weapDef.perpendicularBounce = fullDef->perpendicularBounce;
|
||||
}
|
||||
|
||||
if (fullDef->weapDef.locationDamageMultipliers)
|
||||
{
|
||||
memcpy_s(fullDef->locationDamageMultipliers, sizeof WeaponFullDef::locationDamageMultipliers, fullDef->weapDef.locationDamageMultipliers, sizeof(float) * HITLOC_NUM);
|
||||
assert(sizeof(WeaponFullDef::locationDamageMultipliers) >= sizeof(float) * HITLOC_NUM);
|
||||
memcpy(fullDef->locationDamageMultipliers, fullDef->weapDef.locationDamageMultipliers, sizeof(float) * HITLOC_NUM);
|
||||
fullDef->weapDef.locationDamageMultipliers = fullDef->locationDamageMultipliers;
|
||||
}
|
||||
|
||||
if (fullDef->weapDef.weaponCamo && fullDef->weapDef.weaponCamo->name)
|
||||
{
|
||||
strcpy_s(fullDef->weaponCamo, fullDef->weapDef.weaponCamo->name);
|
||||
strncpy(fullDef->weaponCamo, fullDef->weapDef.weaponCamo->name, std::extent<decltype(WeaponFullDef::weaponCamo)>::value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1623,10 +1636,10 @@ std::string AssetDumperWeapon::GetFileNameForAsset(Zone* zone, XAssetInfo<Weapon
|
||||
void AssetDumperWeapon::DumpAsset(Zone* zone, XAssetInfo<WeaponVariantDef>* asset, std::ostream& stream)
|
||||
{
|
||||
auto* fullDef = new WeaponFullDef;
|
||||
memset(fullDef, 0, sizeof WeaponFullDef);
|
||||
memset(fullDef, 0, sizeof(WeaponFullDef));
|
||||
CopyToFullDef(asset->Asset(), fullDef);
|
||||
|
||||
InfoStringFromWeaponConverter converter(fullDef, weapon_fields, _countof(weapon_fields), [asset](const scr_string_t scrStr) -> std::string
|
||||
InfoStringFromWeaponConverter converter(fullDef, weapon_fields, std::extent<decltype(weapon_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
|
||||
{
|
||||
assert(scrStr < asset->m_zone->m_script_strings.size());
|
||||
if (scrStr >= asset->m_zone->m_script_strings.size())
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "AssetDumperZBarrier.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <type_traits>
|
||||
|
||||
#include "Game/T6/InfoStringT6.h"
|
||||
|
||||
@ -185,7 +186,7 @@ std::string AssetDumperZBarrier::GetFileNameForAsset(Zone* zone, XAssetInfo<ZBar
|
||||
|
||||
void AssetDumperZBarrier::DumpAsset(Zone* zone, XAssetInfo<ZBarrierDef>* asset, std::ostream& stream)
|
||||
{
|
||||
InfoStringFromZBarrierConverter converter(asset->Asset(), zbarrier_fields, _countof(zbarrier_fields), [asset](const scr_string_t scrStr) -> std::string
|
||||
InfoStringFromZBarrierConverter converter(asset->Asset(), zbarrier_fields, std::extent<decltype(zbarrier_fields)>::value, [asset](const scr_string_t scrStr) -> std::string
|
||||
{
|
||||
assert(scrStr < asset->m_zone->m_script_strings.size());
|
||||
if (scrStr >= asset->m_zone->m_script_strings.size())
|
||||
@ -201,9 +202,9 @@ void AssetDumperZBarrier::DumpAsset(Zone* zone, XAssetInfo<ZBarrierDef>* asset,
|
||||
|
||||
//void AssetDumperZBarrier::CheckFields()
|
||||
//{
|
||||
// assert(_countof(zbarrier_fields) == _countof(fields222));
|
||||
// assert(std::extent<decltype(zbarrier_fields)>::value == std::extent<decltype(fields222)>::value);
|
||||
//
|
||||
// for(auto i = 0u; i < _countof(zbarrier_fields); i++)
|
||||
// for(auto i = 0u; i < std::extent<decltype(zbarrier_fields)>::value; i++)
|
||||
// {
|
||||
// if(zbarrier_fields[i].iOffset != fields222[i].iOffset)
|
||||
// {
|
||||
|
@ -61,7 +61,7 @@ void IwiWriter::WriteVersion(std::ostream& stream)
|
||||
version.tag[2] = 'i';
|
||||
version.version = 27;
|
||||
|
||||
stream.write(reinterpret_cast<char*>(&version), sizeof IwiVersion);
|
||||
stream.write(reinterpret_cast<char*>(&version), sizeof(IwiVersion));
|
||||
}
|
||||
|
||||
void IwiWriter::FillHeader2D(IwiHeader* header, Texture2D* texture)
|
||||
@ -105,7 +105,7 @@ void IwiWriter::DumpImage(std::ostream& stream, Texture* texture)
|
||||
for (auto& i : header.maxGlossForMip)
|
||||
i = 0;
|
||||
|
||||
auto currentFileSize = sizeof IwiVersion + sizeof IwiHeader;
|
||||
auto currentFileSize = sizeof(IwiVersion) + sizeof(IwiHeader);
|
||||
|
||||
const auto textureMipCount = texture->HasMipMaps() ? texture->GetMipMapCount() : 1;
|
||||
for (auto currentMipLevel = textureMipCount - 1; currentMipLevel >= 0; currentMipLevel--)
|
||||
@ -113,7 +113,7 @@ void IwiWriter::DumpImage(std::ostream& stream, Texture* texture)
|
||||
const auto mipLevelSize = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount();
|
||||
currentFileSize += mipLevelSize;
|
||||
|
||||
if (currentMipLevel < static_cast<int>(_countof(iwi27::IwiHeader::fileSizeForPicmip)))
|
||||
if (currentMipLevel < static_cast<int>(std::extent<decltype(iwi27::IwiHeader::fileSizeForPicmip)>::value))
|
||||
header.fileSizeForPicmip[currentMipLevel] = currentFileSize;
|
||||
}
|
||||
|
||||
@ -135,7 +135,7 @@ void IwiWriter::DumpImage(std::ostream& stream, Texture* texture)
|
||||
return;
|
||||
}
|
||||
|
||||
stream.write(reinterpret_cast<char*>(&header), sizeof IwiHeader);
|
||||
stream.write(reinterpret_cast<char*>(&header), sizeof(IwiHeader));
|
||||
|
||||
for (auto currentMipLevel = textureMipCount - 1; currentMipLevel >= 0; currentMipLevel--)
|
||||
{
|
||||
|
@ -48,21 +48,21 @@ void IwiWriter::WriteVersion(std::ostream& stream)
|
||||
version.tag[2] = 'i';
|
||||
version.version = 8;
|
||||
|
||||
stream.write(reinterpret_cast<char*>(&version), sizeof IwiVersion);
|
||||
stream.write(reinterpret_cast<char*>(&version), sizeof(IwiVersion));
|
||||
}
|
||||
|
||||
void IwiWriter::FillHeader2D(IwiHeader* header, Texture2D* texture)
|
||||
{
|
||||
header->dimensions[0] = static_cast<uint16_t>(texture->GetWidth());
|
||||
header->dimensions[1] = static_cast<uint16_t>(texture->GetHeight());
|
||||
header->dimensions[2] = 1ui16;
|
||||
header->dimensions[2] = 1u;
|
||||
}
|
||||
|
||||
void IwiWriter::FillHeaderCube(IwiHeader* header, TextureCube* texture)
|
||||
{
|
||||
header->dimensions[0] = static_cast<uint16_t>(texture->GetWidth());
|
||||
header->dimensions[1] = static_cast<uint16_t>(texture->GetHeight());
|
||||
header->dimensions[2] = 1ui16;
|
||||
header->dimensions[2] = 1u;
|
||||
header->flags |= IMG_FLAG_MAPTYPE_CUBE;
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ void IwiWriter::DumpImage(std::ostream& stream, Texture* texture)
|
||||
if (!texture->HasMipMaps())
|
||||
header.flags |= IMG_FLAG_NOMIPMAPS;
|
||||
|
||||
auto currentFileSize = sizeof IwiVersion + sizeof IwiHeader;
|
||||
auto currentFileSize = sizeof(IwiVersion) + sizeof(IwiHeader);
|
||||
|
||||
const auto textureMipCount = texture->HasMipMaps() ? texture->GetMipMapCount() : 1;
|
||||
for (auto currentMipLevel = textureMipCount - 1; currentMipLevel >= 0; currentMipLevel--)
|
||||
@ -106,7 +106,7 @@ void IwiWriter::DumpImage(std::ostream& stream, Texture* texture)
|
||||
const auto mipLevelSize = texture->GetSizeOfMipLevel(currentMipLevel) * texture->GetFaceCount();
|
||||
currentFileSize += mipLevelSize;
|
||||
|
||||
if (currentMipLevel < static_cast<int>(_countof(iwi27::IwiHeader::fileSizeForPicmip)))
|
||||
if (currentMipLevel < static_cast<int>(std::extent<decltype(iwi27::IwiHeader::fileSizeForPicmip)>::value))
|
||||
header.fileSizeForPicmip[currentMipLevel] = currentFileSize;
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ void IwiWriter::DumpImage(std::ostream& stream, Texture* texture)
|
||||
return;
|
||||
}
|
||||
|
||||
stream.write(reinterpret_cast<char*>(&header), sizeof IwiHeader);
|
||||
stream.write(reinterpret_cast<char*>(&header), sizeof(IwiHeader));
|
||||
|
||||
for (auto currentMipLevel = textureMipCount - 1; currentMipLevel >= 0; currentMipLevel--)
|
||||
{
|
||||
|
Reference in New Issue
Block a user