mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-11-28 23:37:47 +00:00
chore: update all logging to use centralized logging component
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "Game/IW5/IW5.h"
|
||||
#include "Image/ImageCommon.h"
|
||||
#include "Image/IwiLoader.h"
|
||||
#include "Utils/Logging/Log.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <format>
|
||||
@@ -39,7 +40,7 @@ namespace
|
||||
const auto texture = iwi::LoadIwi(ss);
|
||||
if (!texture)
|
||||
{
|
||||
std::cerr << std::format("Failed to load texture from: {}\n", fileName);
|
||||
con::error("Failed to load texture from: {}", fileName);
|
||||
return AssetCreationResult::Failure();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "InfoStringToStructConverter.h"
|
||||
|
||||
#include "Utils/Logging/Log.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <format>
|
||||
#include <iostream>
|
||||
@@ -63,7 +65,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
|
||||
|
||||
if (fx == nullptr)
|
||||
{
|
||||
std::cerr << std::format("Failed to load fx asset \"{}\"\n", value);
|
||||
con::error("Failed to load fx asset \"{}\"", value);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -85,7 +87,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
|
||||
|
||||
if (xmodel == nullptr)
|
||||
{
|
||||
std::cerr << std::format("Failed to load xmodel asset \"{}\"\n", value);
|
||||
con::error("Failed to load xmodel asset \"{}\"", value);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -107,7 +109,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
|
||||
|
||||
if (material == nullptr)
|
||||
{
|
||||
std::cerr << std::format("Failed to load material asset \"{}\"\n", value);
|
||||
con::error("Failed to load material asset \"{}\"", value);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -129,7 +131,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
|
||||
|
||||
if (tracer == nullptr)
|
||||
{
|
||||
std::cerr << std::format("Failed to load tracer asset \"{}\"\n", value);
|
||||
con::error("Failed to load tracer asset \"{}\"", value);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -146,7 +148,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
|
||||
|
||||
if (endPtr != &value[value.size()])
|
||||
{
|
||||
std::cout << "Failed to parse value \"" << value << "\" as mph\n";
|
||||
con::error("Failed to parse value \"{}\" as mph", value);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -165,7 +167,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
|
||||
|
||||
if (collmap == nullptr)
|
||||
{
|
||||
std::cerr << std::format("Failed to load collmap asset \"{}\"\n", value);
|
||||
con::error("Failed to load collmap asset \"{}\"", value);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "Game/IW5/IW5.h"
|
||||
#include "Game/IW5/Leaderboard/JsonLeaderboardDef.h"
|
||||
#include "Leaderboard/LeaderboardCommon.h"
|
||||
#include "Utils/Logging/Log.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <format>
|
||||
@@ -36,7 +37,7 @@ namespace
|
||||
|
||||
if (type != "leaderboard" || version != 1u)
|
||||
{
|
||||
std::cerr << std::format("Tried to load leaderboard \"{}\" but did not find expected type leaderboard of version 1\n", leaderboardDef.name);
|
||||
con::error("Tried to load leaderboard \"{}\" but did not find expected type leaderboard of version 1", leaderboardDef.name);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -45,7 +46,7 @@ namespace
|
||||
}
|
||||
catch (const json::exception& e)
|
||||
{
|
||||
std::cerr << std::format("Failed to parse json of leaderboard: {}\n", e.what());
|
||||
con::error("Failed to parse json of leaderboard: {}", e.what());
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -142,7 +143,7 @@ namespace
|
||||
const JsonLoader loader(*file.m_stream, m_memory);
|
||||
if (!loader.Load(*leaderboardDef))
|
||||
{
|
||||
std::cerr << std::format("Failed to load leaderboard \"{}\"\n", assetName);
|
||||
con::error("Failed to load leaderboard \"{}\"", assetName);
|
||||
return AssetCreationResult::Failure();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "Game/IW5/IW5.h"
|
||||
#include "Game/IW5/Material/JsonMaterialLoaderIW5.h"
|
||||
#include "Material/MaterialCommon.h"
|
||||
#include "Utils/Logging/Log.h"
|
||||
|
||||
#include <format>
|
||||
#include <iostream>
|
||||
@@ -32,7 +33,7 @@ namespace
|
||||
AssetRegistration<AssetMaterial> registration(assetName, material);
|
||||
if (!LoadMaterialAsJson(*file.m_stream, *material, m_memory, context, registration))
|
||||
{
|
||||
std::cerr << std::format("Failed to load material \"{}\"\n", assetName);
|
||||
con::error("Failed to load material \"{}\"", assetName);
|
||||
return AssetCreationResult::Failure();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "Game/IW5/Menu/MenuConverterIW5.h"
|
||||
#include "ObjLoading.h"
|
||||
#include "Parsing/Menu/MenuFileReader.h"
|
||||
#include "Utils/Logging/Log.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <format>
|
||||
@@ -88,7 +89,7 @@ namespace
|
||||
const auto alreadyLoadedMenuFile = conversionState.m_menus_by_filename.find(menuFilePath);
|
||||
if (alreadyLoadedMenuFile != conversionState.m_menus_by_filename.end())
|
||||
{
|
||||
std::cout << std::format("Already loaded \"{}\", skipping\n", menuFilePath);
|
||||
con::debug("Already loaded \"{}\", skipping", menuFilePath);
|
||||
for (auto* menu : alreadyLoadedMenuFile->second)
|
||||
{
|
||||
menus.emplace_back(menu->Asset());
|
||||
@@ -100,7 +101,7 @@ namespace
|
||||
const auto file = m_search_path.Open(menuFilePath);
|
||||
if (!file.IsOpen())
|
||||
{
|
||||
std::cerr << std::format("Could not open menu file \"{}\"\n", menuFilePath);
|
||||
con::error("Could not open menu file \"{}\"", menuFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -109,12 +110,12 @@ namespace
|
||||
{
|
||||
ProcessParsedResults(menuFilePath, context, *menuFileResult, zoneState, conversionState, menus, registration);
|
||||
if (!menuFileResult->m_menus_to_load.empty())
|
||||
std::cout << std::format("WARNING: Menu file has menus to load even though it is not a menu list, ignoring: \"{}\"\n", menuFilePath);
|
||||
con::warn("Menu file has menus to load even though it is not a menu list, ignoring: \"{}\"", menuFilePath);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
std::cerr << std::format("Could not read menu file \"{}\"\n", menuFilePath);
|
||||
con::error("Could not read menu file \"{}\"", menuFilePath);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -134,12 +135,12 @@ namespace
|
||||
for (const auto& menu : parsingResult.m_menus)
|
||||
totalItemCount += static_cast<unsigned>(menu->m_items.size());
|
||||
|
||||
std::cout << std::format("Successfully read menu file \"{}\" ({} loads, {} menus, {} functions, {} items)\n",
|
||||
fileName,
|
||||
menuLoadCount,
|
||||
menuCount,
|
||||
functionCount,
|
||||
totalItemCount);
|
||||
con::info("Successfully read menu file \"{}\" ({} loads, {} menus, {} functions, {} items)",
|
||||
fileName,
|
||||
menuLoadCount,
|
||||
menuCount,
|
||||
functionCount,
|
||||
totalItemCount);
|
||||
|
||||
// Add all functions to the zone state to make them available for all menus to be converted
|
||||
for (auto& function : parsingResult.m_functions)
|
||||
@@ -160,7 +161,7 @@ namespace
|
||||
converter->ConvertMenu(*commonMenu, *menuAsset, menuRegistration);
|
||||
if (menuAsset == nullptr)
|
||||
{
|
||||
std::cerr << std::format("Failed to convert menu file \"{}\"\n", commonMenu->m_name);
|
||||
con::error("Failed to convert menu file \"{}\"", commonMenu->m_name);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "Game/IW5/IW5.h"
|
||||
#include "Pool/GlobalAssetPool.h"
|
||||
#include "Utils/Logging/Log.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <filesystem>
|
||||
@@ -57,7 +58,7 @@ namespace
|
||||
|
||||
if (ret != Z_STREAM_END)
|
||||
{
|
||||
std::cerr << std::format("Deflate failed for loading rawfile \"{}\"\n", assetName);
|
||||
con::error("Deflate failed for loading rawfile \"{}\"", assetName);
|
||||
deflateEnd(&zs);
|
||||
return AssetCreationResult::Failure();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "Game/IW5/IW5.h"
|
||||
#include "Pool/GlobalAssetPool.h"
|
||||
#include "Utils/Logging/Log.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <filesystem>
|
||||
@@ -53,13 +54,13 @@ namespace
|
||||
|
||||
if (scriptFile->compressedLen <= 0 || scriptFile->bytecodeLen <= 0)
|
||||
{
|
||||
std::cerr << std::format("Error: Invalid length of the buffers in {} specified\n", assetName);
|
||||
con::error("Invalid length of the buffers in {} specified", assetName);
|
||||
return AssetCreationResult::Failure();
|
||||
}
|
||||
|
||||
if (offset + static_cast<size_t>(scriptFile->compressedLen + scriptFile->bytecodeLen) > static_cast<size_t>(file.m_length))
|
||||
{
|
||||
std::cerr << std::format("Error: Specified length in {} GSC BIN structure exceeds the actual file size\n", assetName);
|
||||
con::error("Specified length in {} GSC BIN structure exceeds the actual file size", assetName);
|
||||
return AssetCreationResult::Failure();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "Game/IW5/ObjConstantsIW5.h"
|
||||
#include "InfoString/InfoString.h"
|
||||
#include "InfoStringLoaderWeaponIW5.h"
|
||||
#include "Utils/Logging/Log.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <format>
|
||||
@@ -31,7 +32,7 @@ namespace
|
||||
InfoString infoString;
|
||||
if (!infoString.FromGdtProperties(*gdtEntry))
|
||||
{
|
||||
std::cerr << std::format("Failed to read weapon gdt entry: \"{}\"\n", assetName);
|
||||
con::error("Failed to read weapon gdt entry: \"{}\"", assetName);
|
||||
return AssetCreationResult::Failure();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "Game/IW5/IW5.h"
|
||||
#include "Game/IW5/InfoString/InfoStringToStructConverter.h"
|
||||
#include "Game/IW5/Weapon/WeaponFields.h"
|
||||
#include "Utils/Logging/Log.h"
|
||||
#include "Weapon/AccuracyGraphLoader.h"
|
||||
|
||||
#include <cassert>
|
||||
@@ -22,13 +23,13 @@ namespace
|
||||
std::vector<std::string> valueArray;
|
||||
if (!ParseAsArray(value, valueArray))
|
||||
{
|
||||
std::cerr << "Failed to parse hide tags as array\n";
|
||||
con::error("Failed to parse hide tags as array");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (valueArray.size() > std::extent_v<decltype(WeaponFullDef::hideTags)>)
|
||||
{
|
||||
std::cerr << std::format("Cannot have more than {} hide tags!\n", std::extent_v<decltype(WeaponFullDef::hideTags)>);
|
||||
con::error("Cannot have more than {} hide tags!", std::extent_v<decltype(WeaponFullDef::hideTags)>);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -83,14 +84,13 @@ namespace
|
||||
std::vector<std::array<std::string, 2>> pairs;
|
||||
if (!ParseAsArray(value, pairs))
|
||||
{
|
||||
std::cerr << std::format("Failed to parse notetrack{}map as pairs\n", mapName);
|
||||
con::error("Failed to parse notetrack{}map as pairs", mapName);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pairs.size() > std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)>)
|
||||
{
|
||||
std::cerr << std::format(
|
||||
"Cannot have more than {} notetrack{}map entries!\n", std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)>, mapName);
|
||||
con::error("Cannot have more than {} notetrack{}map entries!", std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)>, mapName);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace
|
||||
std::vector<std::string> valueArray;
|
||||
if (!ParseAsArray(value, valueArray))
|
||||
{
|
||||
std::cerr << "Failed to parse attachments as array\n";
|
||||
con::error("Failed to parse attachments as array");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace
|
||||
{
|
||||
if (currentScope >= std::extent_v<decltype(WeaponFullDef::scopes)>)
|
||||
{
|
||||
std::cerr << std::format("Cannot have more than {} scopes\n", std::extent_v<decltype(WeaponFullDef::scopes)>);
|
||||
con::error("Cannot have more than {} scopes", std::extent_v<decltype(WeaponFullDef::scopes)>);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ namespace
|
||||
{
|
||||
if (currentUnderBarrel >= std::extent_v<decltype(WeaponFullDef::underBarrels)>)
|
||||
{
|
||||
std::cerr << std::format("Cannot have more than {} under barrels\n", std::extent_v<decltype(WeaponFullDef::underBarrels)>);
|
||||
con::error("Cannot have more than {} under barrels", std::extent_v<decltype(WeaponFullDef::underBarrels)>);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace
|
||||
{
|
||||
if (currentOther >= std::extent_v<decltype(WeaponFullDef::others)>)
|
||||
{
|
||||
std::cerr << std::format("Cannot have more than {} other attachments\n", std::extent_v<decltype(WeaponFullDef::others)>);
|
||||
con::error("Cannot have more than {} other attachments", std::extent_v<decltype(WeaponFullDef::others)>);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace
|
||||
std::vector<std::array<std::string, 7>> valueArray;
|
||||
if (!ParseAsArray(value, valueArray))
|
||||
{
|
||||
std::cerr << "Failed to parse anim overrides as array\n";
|
||||
con::error("Failed to parse anim overrides as array");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ namespace
|
||||
std::vector<std::array<std::string, 5>> valueArray;
|
||||
if (!ParseAsArray(value, valueArray))
|
||||
{
|
||||
std::cerr << "Failed to parse sound overrides as array\n";
|
||||
con::error("Failed to parse sound overrides as array");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ namespace
|
||||
std::vector<std::array<std::string, 5>> valueArray;
|
||||
if (!ParseAsArray(value, valueArray))
|
||||
{
|
||||
std::cerr << "Failed to parse attachments as array\n";
|
||||
con::error("Failed to parse attachments as array");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ namespace
|
||||
std::vector<std::array<std::string, 3>> valueArray;
|
||||
if (!ParseAsArray(value, valueArray))
|
||||
{
|
||||
std::cerr << "Failed to parse reload overrides as array\n";
|
||||
con::error("Failed to parse reload overrides as array");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ namespace
|
||||
std::vector<std::array<std::string, 3>> valueArray;
|
||||
if (!ParseAsArray(value, valueArray))
|
||||
{
|
||||
std::cerr << "Failed to parse note track overrides as array\n";
|
||||
con::error("Failed to parse note track overrides as array");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ namespace
|
||||
|
||||
if (currentOverrideKeyOffset >= 24u)
|
||||
{
|
||||
std::cerr << std::format("Cannot have more than {} note track overrides per attachment\n", 24u);
|
||||
con::error("Cannot have more than {} note track overrides per attachment", 24u);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -433,7 +433,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << std::format("Weapon does not have attachment \"{}\"\n", value);
|
||||
con::error("Weapon does not have attachment \"{}\"", value);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -473,7 +473,7 @@ namespace
|
||||
auto* fxInfo = m_context.LoadDependency<AssetFx>(value);
|
||||
if (!fxInfo)
|
||||
{
|
||||
std::cerr << std::format("Failed to load fx for override \"{}\"\n", value);
|
||||
con::error("Failed to load fx for override \"{}\"", value);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -494,7 +494,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << std::format("Unknown anim file \"{}\"\n", value);
|
||||
con::error("Unknown anim file \"{}\"", value);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -509,7 +509,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << std::format("Unknown sound type \"{}\"\n", value);
|
||||
con::error("Unknown sound type \"{}\"", value);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -524,7 +524,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << std::format("Unknown fx type \"{}\"\n", value);
|
||||
con::error("Unknown fx type \"{}\"", value);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -535,7 +535,7 @@ namespace
|
||||
|
||||
if (size != value.size())
|
||||
{
|
||||
std::cerr << std::format("Invalid int value: \"{}\"\n", value);
|
||||
con::error("Invalid int value: \"{}\"", value);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -697,28 +697,27 @@ namespace
|
||||
void CheckProjectileValues(const WeaponCompleteDef& weaponCompleteDef, const WeaponDef& weaponDef)
|
||||
{
|
||||
if (weaponDef.iProjectileSpeed <= 0)
|
||||
std::cerr << std::format("Projectile speed for WeapType {} must be greater than 0.0", weaponCompleteDef.szDisplayName);
|
||||
con::error("Projectile speed for WeapType {} must be greater than 0.0", weaponCompleteDef.szDisplayName);
|
||||
if (weaponDef.destabilizationCurvatureMax >= 1000000000.0f || weaponDef.destabilizationCurvatureMax < 0.0f)
|
||||
std::cerr << std::format("Destabilization angle for for WeapType {} must be between 0 and 45 degrees", weaponCompleteDef.szDisplayName);
|
||||
con::error("Destabilization angle for for WeapType {} must be between 0 and 45 degrees", weaponCompleteDef.szDisplayName);
|
||||
if (weaponDef.destabilizationRateTime < 0.0f)
|
||||
std::cerr << std::format("Destabilization rate time for for WeapType {} must be non-negative", weaponCompleteDef.szDisplayName);
|
||||
con::error("Destabilization rate time for for WeapType {} must be non-negative", weaponCompleteDef.szDisplayName);
|
||||
}
|
||||
|
||||
void CheckTurretBarrelSpin(const WeaponCompleteDef& weaponCompleteDef, const WeaponDef& weaponDef)
|
||||
{
|
||||
if (weaponDef.weapClass != WEAPCLASS_TURRET)
|
||||
std::cerr << std::format("Rotating barrel set for non-turret weapon {}.", weaponCompleteDef.szInternalName);
|
||||
con::error("Rotating barrel set for non-turret weapon {}.", weaponCompleteDef.szInternalName);
|
||||
|
||||
if (0.0f == weaponDef.turretBarrelSpinSpeed)
|
||||
{
|
||||
std::cerr << std::format(
|
||||
"Rotating barrel spin speed '{}' is invalid for weapon {}.", weaponDef.turretBarrelSpinSpeed, weaponCompleteDef.szInternalName);
|
||||
con::error("Rotating barrel spin speed '{}' is invalid for weapon {}.", weaponDef.turretBarrelSpinSpeed, weaponCompleteDef.szInternalName);
|
||||
}
|
||||
if (0.0f < weaponDef.turretOverheatUpRate && 0.0f >= weaponDef.turretOverheatDownRate)
|
||||
{
|
||||
std::cerr << std::format("Turret overheat Up rate is set, but the down rate '{}' is invalid for weapon {}.",
|
||||
weaponDef.turretOverheatDownRate,
|
||||
weaponCompleteDef.szInternalName);
|
||||
con::error("Turret overheat Up rate is set, but the down rate '{}' is invalid for weapon {}.",
|
||||
weaponDef.turretOverheatDownRate,
|
||||
weaponCompleteDef.szInternalName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -726,18 +725,18 @@ namespace
|
||||
{
|
||||
if (0.0f != weaponDef.fAdsZoomInFrac)
|
||||
{
|
||||
std::cerr << std::format("Weapon {} ({}) has thermal scope set. ADS Zoom In frac should be 0 to prevent zoom-in blur ({}).\n",
|
||||
weaponCompleteDef.szInternalName,
|
||||
weaponCompleteDef.szDisplayName,
|
||||
weaponDef.fAdsZoomInFrac);
|
||||
con::error("Weapon {} ({}) has thermal scope set. ADS Zoom In frac should be 0 to prevent zoom-in blur ({}).",
|
||||
weaponCompleteDef.szInternalName,
|
||||
weaponCompleteDef.szDisplayName,
|
||||
weaponDef.fAdsZoomInFrac);
|
||||
}
|
||||
|
||||
if (0.0f != weaponDef.fAdsZoomOutFrac)
|
||||
{
|
||||
std::cerr << std::format("Weapon {} ({}) has thermal scope set. ADS Zoom Out frac should be 0 to prevent zoom-out blur ({}).\n",
|
||||
weaponCompleteDef.szInternalName,
|
||||
weaponCompleteDef.szDisplayName,
|
||||
weaponDef.fAdsZoomOutFrac);
|
||||
con::error("Weapon {} ({}) has thermal scope set. ADS Zoom Out frac should be 0 to prevent zoom-out blur ({}).",
|
||||
weaponCompleteDef.szInternalName,
|
||||
weaponCompleteDef.szDisplayName,
|
||||
weaponDef.fAdsZoomOutFrac);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -767,7 +766,7 @@ namespace
|
||||
weaponDef.fMinDamageRange = 999999.12f;
|
||||
|
||||
if (weaponDef.enemyCrosshairRange > 15000.0f)
|
||||
std::cerr << std::format("Enemy crosshair ranges should be less than {}\n", 15000.0f);
|
||||
con::error("Enemy crosshair ranges should be less than {}", 15000.0f);
|
||||
|
||||
if (weaponDef.weapType == WEAPTYPE_PROJECTILE)
|
||||
CheckProjectileValues(weaponCompleteDef, weaponDef);
|
||||
@@ -780,22 +779,21 @@ namespace
|
||||
|
||||
if (weaponDef.offhandClass && !weaponDef.bClipOnly)
|
||||
{
|
||||
std::cerr << std::format(
|
||||
"Weapon {} ({}) is an offhand weapon but is not set to clip only, which is not supported since we can't reload the offhand slot.\n",
|
||||
weaponCompleteDef.szInternalName,
|
||||
weaponCompleteDef.szDisplayName);
|
||||
con::error("Weapon {} ({}) is an offhand weapon but is not set to clip only, which is not supported since we can't reload the offhand slot.",
|
||||
weaponCompleteDef.szInternalName,
|
||||
weaponCompleteDef.szDisplayName);
|
||||
}
|
||||
|
||||
if (weaponDef.weapType == WEAPTYPE_BULLET)
|
||||
{
|
||||
if (weaponDef.bulletExplDmgMult <= 0.0f)
|
||||
std::cerr << std::format("Detected invalid bulletExplDmgMult of '{}' for weapon '{}'; please update weapon settings.\n",
|
||||
weaponDef.bulletExplDmgMult,
|
||||
weaponCompleteDef.szInternalName);
|
||||
con::error("Detected invalid bulletExplDmgMult of '{}' for weapon '{}'; please update weapon settings.",
|
||||
weaponDef.bulletExplDmgMult,
|
||||
weaponCompleteDef.szInternalName);
|
||||
if (weaponDef.bulletExplRadiusMult <= 0.0f)
|
||||
std::cerr << std::format("Detected invalid bulletExplRadiusMult of '{}' for weapon '{}'; please update weapon settings.\n",
|
||||
weaponDef.bulletExplRadiusMult,
|
||||
weaponCompleteDef.szInternalName);
|
||||
con::error("Detected invalid bulletExplRadiusMult of '{}' for weapon '{}'; please update weapon settings.",
|
||||
weaponDef.bulletExplRadiusMult,
|
||||
weaponCompleteDef.szInternalName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -878,7 +876,7 @@ namespace weapon
|
||||
infoString, *weaponFullDef, m_zone.m_script_strings, m_memory, context, registration, weapon_fields, std::extent_v<decltype(weapon_fields)>);
|
||||
if (!converter.Convert())
|
||||
{
|
||||
std::cerr << std::format("Failed to parse weapon: \"{}\"\n", assetName);
|
||||
con::error("Failed to parse weapon: \"{}\"", assetName);
|
||||
return AssetCreationResult::Failure();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "Game/IW5/IW5.h"
|
||||
#include "Game/IW5/Weapon/JsonWeaponAttachment.h"
|
||||
#include "Utils/Logging/Log.h"
|
||||
#include "Weapon/AttachmentCommon.h"
|
||||
|
||||
#include <cstring>
|
||||
@@ -39,7 +40,7 @@ namespace
|
||||
|
||||
if (type != "attachment" || version != 1u)
|
||||
{
|
||||
std::cerr << "Tried to load attachment \"" << attachment.szInternalName << "\" but did not find expected type attachment of version 1\n";
|
||||
con::error("Tried to load attachment \"{}\" but did not find expected type attachment of version 1", attachment.szInternalName);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -48,7 +49,7 @@ namespace
|
||||
}
|
||||
catch (const json::exception& e)
|
||||
{
|
||||
std::cerr << std::format("Failed to parse json of attachment: {}\n", e.what());
|
||||
con::error("Failed to parse json of attachment: {}", e.what());
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -57,7 +58,7 @@ namespace
|
||||
private:
|
||||
static void PrintError(const WeaponAttachment& attachment, const std::string& message)
|
||||
{
|
||||
std::cerr << "Cannot load attachment \"" << attachment.szInternalName << "\": " << message << "\n";
|
||||
con::error("Cannot load attachment \"{}\": {}", attachment.szInternalName, message);
|
||||
}
|
||||
|
||||
bool CreateWeaponAttachmentFromJson(const JsonWeaponAttachment& jAttachment, WeaponAttachment& attachment) const
|
||||
@@ -653,7 +654,7 @@ namespace
|
||||
const JsonLoader loader(*file.m_stream, m_memory, context, registration);
|
||||
if (!loader.Load(*attachment))
|
||||
{
|
||||
std::cerr << std::format("Failed to load attachment \"{}\"\n", assetName);
|
||||
con::error("Failed to load attachment \"{}\"", assetName);
|
||||
return AssetCreationResult::Failure();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "Game/IW5/ObjConstantsIW5.h"
|
||||
#include "InfoString/InfoString.h"
|
||||
#include "InfoStringLoaderWeaponIW5.h"
|
||||
#include "Utils/Logging/Log.h"
|
||||
#include "Weapon/WeaponCommon.h"
|
||||
|
||||
#include <cstring>
|
||||
@@ -34,7 +35,7 @@ namespace
|
||||
InfoString infoString;
|
||||
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_WEAPON, *file.m_stream))
|
||||
{
|
||||
std::cerr << std::format("Could not parse as info string file: \"{}\"\n", fileName);
|
||||
con::error("Could not parse as info string file: \"{}\"", fileName);
|
||||
return AssetCreationResult::Failure();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user