From 9197b537d777c928f7322851a32da699607500e1 Mon Sep 17 00:00:00 2001 From: Jan Date: Mon, 2 Oct 2023 23:01:54 +0200 Subject: [PATCH 01/13] Add code formatting configuration with clang-format --- .clang-format | 5 +++++ scripts/reformat-all.sh | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 .clang-format create mode 100755 scripts/reformat-all.sh diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..298a0837f --- /dev/null +++ b/.clang-format @@ -0,0 +1,5 @@ +--- +Language: Cpp +BasedOnStyle: LLVM +AlignArrayOfStructures: Left +ColumnLimit: 160 diff --git a/scripts/reformat-all.sh b/scripts/reformat-all.sh new file mode 100755 index 000000000..4717e1b7f --- /dev/null +++ b/scripts/reformat-all.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# Go to repository root +cd "$(dirname "$0")/.." || exit 2 + +find ./src ./test -iname '*.h' -o -iname '*.cpp' | xargs clang-format -i \ No newline at end of file From cc31a4a4b0b6ff4968502ccb675bd0c7ffce356f Mon Sep 17 00:00:00 2001 From: Jan Date: Mon, 2 Oct 2023 23:12:42 +0200 Subject: [PATCH 02/13] Add Github workflow checking formatting --- .github/workflows/ensure-formatting.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/ensure-formatting.yaml diff --git a/.github/workflows/ensure-formatting.yaml b/.github/workflows/ensure-formatting.yaml new file mode 100644 index 000000000..8d306d1cf --- /dev/null +++ b/.github/workflows/ensure-formatting.yaml @@ -0,0 +1,19 @@ +name: ensure-formatting + +on: + pull_request: + +jobs: + ensure-formatting: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Test formatting for all files + working-directory: ${{ github.workspace }} + run: | + ./scripts/reformat-all.sh + [[ $(git status --porcelain | wc -l) == 0 ]] \ No newline at end of file From 616f39a31eaa85f795dc0dd0ae11a5bb85fe1b36 Mon Sep 17 00:00:00 2001 From: Jan Date: Mon, 2 Oct 2023 23:23:56 +0200 Subject: [PATCH 03/13] Use dry-run to check for clang-format errors instead of inplace editing --- .github/workflows/ensure-formatting.yaml | 3 +-- scripts/check-format.sh | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100755 scripts/check-format.sh diff --git a/.github/workflows/ensure-formatting.yaml b/.github/workflows/ensure-formatting.yaml index 8d306d1cf..b85b89d04 100644 --- a/.github/workflows/ensure-formatting.yaml +++ b/.github/workflows/ensure-formatting.yaml @@ -15,5 +15,4 @@ jobs: - name: Test formatting for all files working-directory: ${{ github.workspace }} run: | - ./scripts/reformat-all.sh - [[ $(git status --porcelain | wc -l) == 0 ]] \ No newline at end of file + ./scripts/check-format.sh \ No newline at end of file diff --git a/scripts/check-format.sh b/scripts/check-format.sh new file mode 100755 index 000000000..e704e7e68 --- /dev/null +++ b/scripts/check-format.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# Go to repository root +cd "$(dirname "$0")/.." || exit 2 + +find ./src ./test -iname '*.h' -o -iname '*.cpp' | xargs clang-format -Werror -ferror-limit=1 --dry-run \ No newline at end of file From 30052461da54d580872dbe7119790abbfcf867d9 Mon Sep 17 00:00:00 2001 From: Jan Date: Mon, 2 Oct 2023 23:46:35 +0200 Subject: [PATCH 04/13] Use clang-format 15 --- .github/workflows/ensure-formatting.yaml | 1 + scripts/check-format.sh | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ensure-formatting.yaml b/.github/workflows/ensure-formatting.yaml index b85b89d04..4a9da6c8b 100644 --- a/.github/workflows/ensure-formatting.yaml +++ b/.github/workflows/ensure-formatting.yaml @@ -15,4 +15,5 @@ jobs: - name: Test formatting for all files working-directory: ${{ github.workspace }} run: | + export CLANG_FORMAT_BIN='clang-format-15' ./scripts/check-format.sh \ No newline at end of file diff --git a/scripts/check-format.sh b/scripts/check-format.sh index e704e7e68..74289eb3a 100755 --- a/scripts/check-format.sh +++ b/scripts/check-format.sh @@ -3,4 +3,6 @@ # Go to repository root cd "$(dirname "$0")/.." || exit 2 -find ./src ./test -iname '*.h' -o -iname '*.cpp' | xargs clang-format -Werror -ferror-limit=1 --dry-run \ No newline at end of file +CLANG_FORMAT_BIN="${CLANG_FORMAT_BIN:-clang-format}" + +find ./src ./test -iname '*.h' -o -iname '*.cpp' | xargs $CLANG_FORMAT_BIN -Werror -ferror-limit=1 --dry-run \ No newline at end of file From 8fe5ac2a69f1b421717b2aadd9ad386c517848c5 Mon Sep 17 00:00:00 2001 From: Jan Date: Sun, 19 Nov 2023 12:17:11 +0100 Subject: [PATCH 05/13] Rename to check-formatting --- .../{ensure-formatting.yaml => check-formatting.yaml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{ensure-formatting.yaml => check-formatting.yaml} (89%) diff --git a/.github/workflows/ensure-formatting.yaml b/.github/workflows/check-formatting.yaml similarity index 89% rename from .github/workflows/ensure-formatting.yaml rename to .github/workflows/check-formatting.yaml index 4a9da6c8b..7a1e8f061 100644 --- a/.github/workflows/ensure-formatting.yaml +++ b/.github/workflows/check-formatting.yaml @@ -1,10 +1,10 @@ -name: ensure-formatting +name: check-formatting on: pull_request: jobs: - ensure-formatting: + check-formatting: runs-on: ubuntu-latest steps: - name: Checkout repository From 22e17272fd26b66282eed3bb31300d86e09b1a41 Mon Sep 17 00:00:00 2001 From: Jan Date: Sun, 19 Nov 2023 14:15:02 +0100 Subject: [PATCH 06/13] Update clang-format to mimic previously code formatting --- .clang-format | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.clang-format b/.clang-format index 298a0837f..db524b9f2 100644 --- a/.clang-format +++ b/.clang-format @@ -1,5 +1,25 @@ --- Language: Cpp BasedOnStyle: LLVM +AccessModifierOffset: -4 AlignArrayOfStructures: Left +AllowShortBlocksOnASingleLine: Empty +AllowShortEnumsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Empty +AllowShortLambdasOnASingleLine: Empty +BinPackArguments: false +BinPackParameters: false +BreakBeforeBinaryOperators: NonAssignment +BreakBeforeBraces: Allman ColumnLimit: 160 +IncludeBlocks: Regroup +IndentWidth: 4 +IndentWrappedFunctionNames: true +InsertNewlineAtEOF: true +NamespaceIndentation: All +PackConstructorInitializers: CurrentLine +PointerAlignment: Left +SeparateDefinitionBlocks: Always +SortUsingDeclarations: Lexicographic +SpaceAfterTemplateKeyword: false +SpaceBeforeCpp11BracedList: true From 6b4f5d94a8210288c7f851b7afb14bd06b0befd2 Mon Sep 17 00:00:00 2001 From: Clang Format Date: Sun, 19 Nov 2023 15:28:38 +0100 Subject: [PATCH 07/13] Reformat code with clang format --- .clang-format | 3 +- scripts/reformat-all.sh | 2 +- src/Common/Game/IGame.h | 5 +- src/Common/Game/IW3/CommonIW3.h | 4 +- src/Common/Game/IW3/GameIW3.cpp | 4 +- src/Common/Game/IW3/GameIW3.h | 2 +- src/Common/Game/IW3/IW3.h | 8 +- src/Common/Game/IW3/IW3_Assets.h | 106 +- src/Common/Game/IW4/CommonIW4.h | 4 +- src/Common/Game/IW4/GameIW4.cpp | 4 +- src/Common/Game/IW4/GameIW4.h | 2 +- src/Common/Game/IW4/IW4.h | 18 +- src/Common/Game/IW4/IW4_Assets.h | 82 +- src/Common/Game/IW5/CommonIW5.cpp | 6 +- src/Common/Game/IW5/CommonIW5.h | 2 +- src/Common/Game/IW5/GameIW5.cpp | 4 +- src/Common/Game/IW5/GameIW5.h | 2 +- src/Common/Game/IW5/IW5.h | 18 +- src/Common/Game/IW5/IW5_Assets.h | 22 +- src/Common/Game/T5/CommonT5.cpp | 4 +- src/Common/Game/T5/CommonT5.h | 2 +- src/Common/Game/T5/GameT5.cpp | 4 +- src/Common/Game/T5/GameT5.h | 2 +- src/Common/Game/T5/T5.h | 8 +- src/Common/Game/T5/T5_Assets.h | 111 +- src/Common/Game/T6/CommonT6.cpp | 16 +- src/Common/Game/T6/CommonT6.h | 2 +- src/Common/Game/T6/GameT6.cpp | 4 +- src/Common/Game/T6/GameT6.h | 2 +- src/Common/Game/T6/T6.h | 8 +- src/Common/Game/T6/T6_Assets.h | 435 +--- src/Common/Image/D3DFormat.h | 6 +- src/Common/Image/DdsTypes.h | 5 +- src/Common/Image/DxgiFormat.h | 242 +- src/Common/Image/ImageFormat.cpp | 42 +- src/Common/Image/ImageFormat.h | 22 +- src/Common/Image/IwiTypes.h | 8 +- src/Common/Image/Texture.cpp | 3 +- src/Common/Image/Texture.h | 3 +- src/Common/Image/TextureConverter.cpp | 27 +- src/Common/Image/TextureConverter.h | 7 +- src/Common/StateMap/StateMapLayout.cpp | 12 +- src/Common/StateMap/StateMapLayout.h | 2 +- src/Common/Utils/HalfFloat.cpp | 3 +- src/Common/Utils/HalfFloat.h | 2 +- src/Common/Utils/Pack.cpp | 19 +- src/Common/Utils/Pack.h | 2 +- src/Common/Utils/QuatInt16.h | 2 +- src/Common/Utils/TypeAlignment.h | 2 +- src/Common/Zone/ZoneTypes.h | 2 +- src/Crypto/Crypto.cpp | 5 +- src/Crypto/Crypto.h | 9 +- src/Crypto/IPublicKeyAlgorithm.h | 2 +- src/Crypto/IStreamCipher.h | 2 +- src/Crypto/Impl/AlgorithmRSA.cpp | 11 +- src/Crypto/Impl/AlgorithmRSA.h | 3 +- src/Crypto/Impl/AlgorithmSHA1.cpp | 3 +- src/Crypto/Impl/AlgorithmSHA256.cpp | 3 +- src/Crypto/Impl/AlgorithmSalsa20.cpp | 4 +- src/Crypto/Impl/CryptoLibrary.cpp | 3 +- src/Crypto/Impl/CryptoLibrary.h | 2 +- src/Linker/Game/IW3/ZoneCreatorIW3.cpp | 8 +- src/Linker/Game/IW3/ZoneCreatorIW3.h | 8 +- src/Linker/Game/IW4/ZoneCreatorIW4.cpp | 8 +- src/Linker/Game/IW4/ZoneCreatorIW4.h | 8 +- src/Linker/Game/IW5/ZoneCreatorIW5.cpp | 8 +- src/Linker/Game/IW5/ZoneCreatorIW5.h | 8 +- src/Linker/Game/T5/ZoneCreatorT5.cpp | 8 +- src/Linker/Game/T5/ZoneCreatorT5.h | 8 +- src/Linker/Game/T6/ZoneCreatorT6.cpp | 17 +- src/Linker/Game/T6/ZoneCreatorT6.h | 8 +- src/Linker/Linker.cpp | 84 +- src/Linker/LinkerArgs.cpp | 27 +- src/Linker/LinkerArgs.h | 17 +- src/Linker/LinkerSearchPaths.cpp | 9 +- src/Linker/LinkerSearchPaths.h | 3 +- src/Linker/ZoneCreation/IZoneCreator.h | 6 +- src/Linker/ZoneCreation/ZoneCreationContext.h | 10 +- src/ObjCommon/Csv/CsvStream.cpp | 10 +- src/ObjCommon/Csv/CsvStream.h | 2 +- src/ObjCommon/Game/IW3/MaterialConstantsIW3.h | 43 +- src/ObjCommon/Game/IW3/TechsetConstantsIW3.h | 86 +- .../Game/IW4/InfoString/EnumStrings.h | 59 +- .../Game/IW4/InfoString/PhysPresetFields.h | 27 +- .../Game/IW4/InfoString/TracerFields.h | 57 +- .../Game/IW4/InfoString/VehicleFields.h | 289 ++- .../Game/IW4/InfoString/WeaponFields.h | 1347 ++++++----- src/ObjCommon/Game/IW4/MaterialConstantsIW4.h | 362 ++- src/ObjCommon/Game/IW4/MenuConstantsIW4.h | 40 +- src/ObjCommon/Game/IW4/ObjConstantsIW4.h | 2 +- src/ObjCommon/Game/IW4/TechsetConstantsIW4.h | 979 ++++---- src/ObjCommon/Game/IW5/MenuConstantsIW5.h | 40 +- src/ObjCommon/Game/IW5/ObjConstantsIW5.h | 2 +- .../Game/T6/InfoString/EnumStrings.h | 228 +- .../T6/InfoString/PhysConstraintsFields.h | 157 +- .../Game/T6/InfoString/PhysPresetFields.h | 43 +- .../Game/T6/InfoString/TracerFields.h | 67 +- .../Game/T6/InfoString/VehicleFields.h | 1117 +++++---- .../T6/InfoString/WeaponAttachmentFields.h | 157 +- .../InfoString/WeaponAttachmentUniqueFields.h | 407 ++-- .../Game/T6/InfoString/WeaponFields.h | 2061 ++++++++--------- .../Game/T6/InfoString/ZBarrierFields.h | 295 ++- src/ObjCommon/Game/T6/ObjConstantsT6.h | 2 +- src/ObjCommon/InfoString/InfoString.cpp | 8 +- src/ObjCommon/InfoString/InfoString.h | 10 +- src/ObjCommon/Localize/LocalizeCommon.h | 4 +- src/ObjCommon/Localize/LocalizeFile.cpp | 3 +- src/ObjCommon/Model/Obj/ObjCommon.cpp | 11 +- src/ObjCommon/Model/Obj/ObjCommon.h | 2 +- src/ObjCommon/Model/XModel/XModelCommon.cpp | 4 +- src/ObjCommon/Model/XModel/XModelCommon.h | 18 +- src/ObjCommon/Obj/Gdt/Gdt.cpp | 3 +- src/ObjCommon/Obj/Gdt/Gdt.h | 6 +- src/ObjCommon/Obj/Gdt/GdtStream.cpp | 25 +- src/ObjCommon/Obj/Gdt/GdtStream.h | 4 +- src/ObjCommon/Obj/Gdt/GdtVersion.h | 2 +- src/ObjCommon/ObjContainer/IObjContainer.h | 2 +- src/ObjCommon/ObjContainer/IPak/IPakTypes.h | 6 +- src/ObjCommon/Shader/D3D9ShaderAnalyser.cpp | 21 +- src/ObjCommon/Shader/D3D9ShaderAnalyser.h | 2 +- src/ObjCommon/Sound/WavTypes.h | 6 +- .../CommonStructuredDataDef.h | 8 +- .../CommonStructuredDataEnum.cpp | 24 +- .../CommonStructuredDataEnum.h | 4 +- .../CommonStructuredDataStruct.cpp | 38 +- .../CommonStructuredDataStruct.h | 7 +- .../CommonStructuredDataTypes.cpp | 23 +- .../CommonStructuredDataTypes.h | 5 +- src/ObjCommon/Utils/DistinctMapper.h | 7 +- src/ObjCommon/Utils/FileToZlibWrapper.cpp | 40 +- src/ObjCommon/Utils/FileToZlibWrapper.h | 4 +- src/ObjCommon/Utils/ObjFileStream.h | 2 +- src/ObjCommon/Utils/ObjStream.h | 22 +- .../AssetLoading/AbstractGdtEntryReader.h | 6 +- .../AssetLoading/AssetLoadingContext.h | 13 +- .../AssetLoading/AssetLoadingManager.cpp | 51 +- .../AssetLoading/AssetLoadingManager.h | 17 +- .../AssetLoading/BasicAssetLoader.h | 6 +- src/ObjLoading/AssetLoading/IAssetLoader.h | 8 +- .../AssetLoading/IAssetLoadingManager.h | 14 +- src/ObjLoading/AssetLoading/IGdtQueryable.h | 4 +- .../AssetLoading/SndCurve/SndCurveReader.cpp | 69 +- .../AssetLoading/SndCurve/SndCurveReader.h | 8 +- .../IW3/AssetLoaders/AssetLoaderGfxImage.cpp | 11 +- .../IW3/AssetLoaders/AssetLoaderGfxImage.h | 7 +- .../IW3/AssetLoaders/AssetLoaderRawFile.cpp | 7 +- .../IW3/AssetLoaders/AssetLoaderRawFile.h | 7 +- src/ObjLoading/Game/IW3/ObjLoaderIW3.cpp | 32 +- src/ObjLoading/Game/IW3/ObjLoaderIW3.h | 12 +- .../AssetLoaders/AssetLoaderAddonMapEnts.cpp | 6 +- .../AssetLoaders/AssetLoaderAddonMapEnts.h | 4 +- .../IW4/AssetLoaders/AssetLoaderClipMap.cpp | 6 +- .../IW4/AssetLoaders/AssetLoaderClipMap.h | 4 +- .../IW4/AssetLoaders/AssetLoaderComWorld.cpp | 6 +- .../IW4/AssetLoaders/AssetLoaderComWorld.h | 4 +- .../Game/IW4/AssetLoaders/AssetLoaderFont.cpp | 6 +- .../Game/IW4/AssetLoaders/AssetLoaderFont.h | 4 +- .../Game/IW4/AssetLoaders/AssetLoaderFx.cpp | 6 +- .../Game/IW4/AssetLoaders/AssetLoaderFx.h | 4 +- .../AssetLoaders/AssetLoaderFxImpactTable.cpp | 6 +- .../AssetLoaders/AssetLoaderFxImpactTable.h | 4 +- .../IW4/AssetLoaders/AssetLoaderFxWorld.cpp | 6 +- .../IW4/AssetLoaders/AssetLoaderFxWorld.h | 4 +- .../AssetLoaders/AssetLoaderGameWorldMp.cpp | 6 +- .../IW4/AssetLoaders/AssetLoaderGameWorldMp.h | 4 +- .../AssetLoaders/AssetLoaderGameWorldSp.cpp | 6 +- .../IW4/AssetLoaders/AssetLoaderGameWorldSp.h | 4 +- .../IW4/AssetLoaders/AssetLoaderGfxImage.cpp | 6 +- .../IW4/AssetLoaders/AssetLoaderGfxImage.h | 4 +- .../AssetLoaders/AssetLoaderGfxLightDef.cpp | 13 +- .../IW4/AssetLoaders/AssetLoaderGfxLightDef.h | 7 +- .../IW4/AssetLoaders/AssetLoaderGfxWorld.cpp | 6 +- .../IW4/AssetLoaders/AssetLoaderGfxWorld.h | 4 +- .../AssetLoaders/AssetLoaderLeaderboard.cpp | 6 +- .../IW4/AssetLoaders/AssetLoaderLeaderboard.h | 4 +- .../AssetLoaders/AssetLoaderLoadedSound.cpp | 6 +- .../IW4/AssetLoaders/AssetLoaderLoadedSound.h | 4 +- .../AssetLoaders/AssetLoaderLocalizeEntry.cpp | 7 +- .../AssetLoaders/AssetLoaderLocalizeEntry.h | 7 +- .../IW4/AssetLoaders/AssetLoaderMapEnts.cpp | 6 +- .../IW4/AssetLoaders/AssetLoaderMapEnts.h | 4 +- .../IW4/AssetLoaders/AssetLoaderMaterial.cpp | 126 +- .../IW4/AssetLoaders/AssetLoaderMaterial.h | 7 +- .../IW4/AssetLoaders/AssetLoaderMenuDef.cpp | 6 +- .../IW4/AssetLoaders/AssetLoaderMenuDef.h | 4 +- .../IW4/AssetLoaders/AssetLoaderMenuList.cpp | 79 +- .../IW4/AssetLoaders/AssetLoaderMenuList.h | 7 +- .../AssetLoaders/AssetLoaderPhysCollmap.cpp | 6 +- .../IW4/AssetLoaders/AssetLoaderPhysCollmap.h | 4 +- .../AssetLoaders/AssetLoaderPhysPreset.cpp | 36 +- .../IW4/AssetLoaders/AssetLoaderPhysPreset.h | 13 +- .../AssetLoaders/AssetLoaderPixelShader.cpp | 13 +- .../IW4/AssetLoaders/AssetLoaderPixelShader.h | 11 +- .../IW4/AssetLoaders/AssetLoaderRawFile.cpp | 7 +- .../IW4/AssetLoaders/AssetLoaderRawFile.h | 7 +- .../IW4/AssetLoaders/AssetLoaderSndCurve.cpp | 19 +- .../IW4/AssetLoaders/AssetLoaderSndCurve.h | 7 +- .../AssetLoaderSoundAliasList.cpp | 6 +- .../AssetLoaders/AssetLoaderSoundAliasList.h | 4 +- .../AssetLoaders/AssetLoaderStringTable.cpp | 9 +- .../IW4/AssetLoaders/AssetLoaderStringTable.h | 7 +- .../AssetLoaderStructuredDataDefSet.cpp | 45 +- .../AssetLoaderStructuredDataDefSet.h | 19 +- .../AssetLoaders/AssetLoaderTechniqueSet.cpp | 270 ++- .../AssetLoaders/AssetLoaderTechniqueSet.h | 18 +- .../IW4/AssetLoaders/AssetLoaderTracer.cpp | 6 +- .../Game/IW4/AssetLoaders/AssetLoaderTracer.h | 4 +- .../IW4/AssetLoaders/AssetLoaderVehicle.cpp | 6 +- .../IW4/AssetLoaders/AssetLoaderVehicle.h | 4 +- .../AssetLoaders/AssetLoaderVertexDecl.cpp | 22 +- .../IW4/AssetLoaders/AssetLoaderVertexDecl.h | 7 +- .../AssetLoaders/AssetLoaderVertexShader.cpp | 11 +- .../AssetLoaders/AssetLoaderVertexShader.h | 7 +- .../IW4/AssetLoaders/AssetLoaderWeapon.cpp | 6 +- .../Game/IW4/AssetLoaders/AssetLoaderWeapon.h | 4 +- .../IW4/AssetLoaders/AssetLoaderXAnim.cpp | 6 +- .../Game/IW4/AssetLoaders/AssetLoaderXAnim.h | 4 +- .../IW4/AssetLoaders/AssetLoaderXModel.cpp | 6 +- .../Game/IW4/AssetLoaders/AssetLoaderXModel.h | 4 +- .../AssetLoaders/AssetLoaderXModelSurfs.cpp | 6 +- .../IW4/AssetLoaders/AssetLoaderXModelSurfs.h | 4 +- .../InfoStringToStructConverter.cpp | 209 +- .../InfoString/InfoStringToStructConverter.h | 13 +- .../IW4/Menu/MenuConversionZoneStateIW4.h | 6 +- .../Game/IW4/Menu/MenuConverterIW4.cpp | 206 +- .../Game/IW4/Menu/MenuConverterIW4.h | 6 +- src/ObjLoading/Game/IW4/ObjLoaderIW4.cpp | 32 +- src/ObjLoading/Game/IW4/ObjLoaderIW4.h | 12 +- .../AssetLoaders/AssetLoaderLocalizeEntry.cpp | 7 +- .../AssetLoaders/AssetLoaderLocalizeEntry.h | 7 +- .../IW5/AssetLoaders/AssetLoaderMaterial.cpp | 6 +- .../IW5/AssetLoaders/AssetLoaderMaterial.h | 4 +- .../IW5/AssetLoaders/AssetLoaderMenuDef.cpp | 6 +- .../IW5/AssetLoaders/AssetLoaderMenuDef.h | 4 +- .../IW5/AssetLoaders/AssetLoaderMenuList.cpp | 79 +- .../IW5/AssetLoaders/AssetLoaderMenuList.h | 7 +- .../IW5/AssetLoaders/AssetLoaderRawFile.cpp | 9 +- .../IW5/AssetLoaders/AssetLoaderRawFile.h | 7 +- .../AssetLoaders/AssetLoaderStringTable.cpp | 9 +- .../IW5/AssetLoaders/AssetLoaderStringTable.h | 7 +- .../InfoStringToStructConverter.cpp | 1 - .../InfoString/InfoStringToStructConverter.h | 13 +- .../IW5/Menu/MenuConversionZoneStateIW5.h | 6 +- .../Game/IW5/Menu/MenuConverterIW5.cpp | 198 +- .../Game/IW5/Menu/MenuConverterIW5.h | 6 +- src/ObjLoading/Game/IW5/ObjLoaderIW5.cpp | 30 +- src/ObjLoading/Game/IW5/ObjLoaderIW5.h | 12 +- .../AssetLoaders/AssetLoaderLocalizeEntry.cpp | 7 +- .../AssetLoaders/AssetLoaderLocalizeEntry.h | 7 +- .../T5/AssetLoaders/AssetLoaderRawFile.cpp | 19 +- .../Game/T5/AssetLoaders/AssetLoaderRawFile.h | 13 +- .../AssetLoaders/AssetLoaderStringTable.cpp | 24 +- .../T5/AssetLoaders/AssetLoaderStringTable.h | 7 +- src/ObjLoading/Game/T5/ObjLoaderT5.cpp | 32 +- src/ObjLoading/Game/T5/ObjLoaderT5.h | 12 +- .../T6/AssetLoaders/AssetLoaderFontIcon.cpp | 41 +- .../T6/AssetLoaders/AssetLoaderFontIcon.h | 29 +- .../T6/AssetLoaders/AssetLoaderGfxImage.cpp | 15 +- .../T6/AssetLoaders/AssetLoaderGfxImage.h | 7 +- .../AssetLoaders/AssetLoaderLocalizeEntry.cpp | 10 +- .../AssetLoaders/AssetLoaderLocalizeEntry.h | 7 +- .../AssetLoaderPhysConstraints.cpp | 37 +- .../AssetLoaders/AssetLoaderPhysConstraints.h | 13 +- .../T6/AssetLoaders/AssetLoaderPhysPreset.cpp | 37 +- .../T6/AssetLoaders/AssetLoaderPhysPreset.h | 13 +- .../Game/T6/AssetLoaders/AssetLoaderQdb.cpp | 4 +- .../Game/T6/AssetLoaders/AssetLoaderQdb.h | 7 +- .../T6/AssetLoaders/AssetLoaderRawFile.cpp | 7 +- .../Game/T6/AssetLoaders/AssetLoaderRawFile.h | 7 +- .../AssetLoaderScriptParseTree.cpp | 7 +- .../AssetLoaders/AssetLoaderScriptParseTree.h | 7 +- .../Game/T6/AssetLoaders/AssetLoaderSlug.cpp | 4 +- .../Game/T6/AssetLoaders/AssetLoaderSlug.h | 7 +- .../AssetLoaders/AssetLoaderStringTable.cpp | 23 +- .../T6/AssetLoaders/AssetLoaderStringTable.h | 7 +- .../T6/AssetLoaders/AssetLoaderTracer.cpp | 35 +- .../Game/T6/AssetLoaders/AssetLoaderTracer.h | 13 +- .../T6/AssetLoaders/AssetLoaderVehicle.cpp | 111 +- .../Game/T6/AssetLoaders/AssetLoaderVehicle.h | 13 +- .../T6/AssetLoaders/AssetLoaderWeapon.cpp | 95 +- .../Game/T6/AssetLoaders/AssetLoaderWeapon.h | 19 +- .../AssetLoaderWeaponAttachment.cpp | 100 +- .../AssetLoaderWeaponAttachment.h | 13 +- .../AssetLoaderWeaponAttachmentUnique.cpp | 65 +- .../AssetLoaderWeaponAttachmentUnique.h | 13 +- .../T6/AssetLoaders/AssetLoaderZBarrier.cpp | 35 +- .../T6/AssetLoaders/AssetLoaderZBarrier.h | 13 +- .../InfoStringToStructConverter.cpp | 181 +- .../InfoString/InfoStringToStructConverter.h | 11 +- src/ObjLoading/Game/T6/ObjLoaderT6.cpp | 38 +- src/ObjLoading/Game/T6/ObjLoaderT6.h | 24 +- src/ObjLoading/IObjLoader.h | 6 +- src/ObjLoading/Image/DdsLoader.cpp | 20 +- src/ObjLoading/Image/DdsLoader.h | 5 +- src/ObjLoading/Image/Dx12TextureLoader.cpp | 12 +- src/ObjLoading/Image/Dx12TextureLoader.h | 8 +- src/ObjLoading/Image/Dx9TextureLoader.h | 8 +- src/ObjLoading/Image/IwiLoader.cpp | 14 +- src/ObjLoading/Image/IwiLoader.h | 5 +- .../InfoStringToStructConverterBase.cpp | 19 +- .../InfoStringToStructConverterBase.h | 12 +- src/ObjLoading/Menu/AbstractMenuConverter.h | 6 +- src/ObjLoading/Menu/MenuConversionException.h | 2 +- .../IPak/Exception/IPakLoadException.cpp | 2 +- src/ObjLoading/ObjContainer/IPak/IPak.cpp | 23 +- src/ObjLoading/ObjContainer/IPak/IPak.h | 6 +- .../ObjContainer/IPak/IPakEntryReadStream.cpp | 37 +- .../ObjContainer/IPak/IPakEntryReadStream.h | 16 +- .../ObjContainer/IPak/IPakStreamManager.cpp | 26 +- .../ObjContainer/IPak/IPakStreamManager.h | 10 +- src/ObjLoading/ObjContainer/IWD/IWD.cpp | 6 +- src/ObjLoading/ObjContainer/IWD/IWD.h | 10 +- .../ObjContainer/ObjContainerRepository.h | 41 +- .../ObjContainer/SoundBank/SoundBank.cpp | 21 +- .../ObjContainer/SoundBank/SoundBank.h | 6 +- .../ObjContainer/SoundBank/SoundBankTypes.h | 26 +- src/ObjLoading/ObjLoading.cpp | 44 +- src/ObjLoading/ObjLoading.h | 6 +- .../LocalizeFile/LocalizeFileParser.cpp | 20 +- .../Parsing/LocalizeFile/LocalizeFileParser.h | 4 +- .../LocalizeFile/LocalizeFileParserState.h | 6 +- .../Parsing/LocalizeFile/LocalizeFileReader.h | 8 +- .../Sequence/SequenceLocalizeFileConfig.cpp | 6 +- .../SequenceLocalizeFileConsumeEmptyLines.cpp | 6 +- .../SequenceLocalizeFileEndMarker.cpp | 2 +- .../SequenceLocalizeFileLanguageValue.cpp | 10 +- .../Sequence/SequenceLocalizeFileNotes.cpp | 6 +- .../SequenceLocalizeFileReference.cpp | 7 +- .../Sequence/SequenceLocalizeFileVersion.cpp | 4 +- .../Parsing/Menu/Domain/CommonFunctionDef.h | 6 +- .../Parsing/Menu/Domain/CommonItemDef.h | 8 +- .../Parsing/Menu/Domain/CommonMenuDef.h | 12 +- .../Parsing/Menu/Domain/CommonMenuTypes.cpp | 8 +- .../Parsing/Menu/Domain/CommonMenuTypes.h | 3 +- .../CommonEventHandlerCondition.cpp | 6 +- .../CommonEventHandlerCondition.h | 9 +- .../EventHandler/CommonEventHandlerScript.cpp | 3 +- .../EventHandler/CommonEventHandlerScript.h | 6 +- .../EventHandler/CommonEventHandlerSet.cpp | 3 +- .../EventHandler/CommonEventHandlerSet.h | 6 +- .../CommonEventHandlerSetLocalVar.h | 8 +- .../EventHandler/ICommonEventHandlerElement.h | 2 +- .../CommonExpressionBaseFunctionCall.cpp | 4 +- .../CommonExpressionBaseFunctionCall.h | 6 +- .../CommonExpressionCustomFunctionCall.h | 2 +- .../Parsing/Menu/Domain/MenuFeatureLevel.h | 2 +- .../Parsing/Menu/Domain/MenuParsingResult.h | 8 +- .../Menu/Matcher/MenuExpressionMatchers.cpp | 47 +- .../Menu/Matcher/MenuExpressionMatchers.h | 6 +- .../Menu/Matcher/MenuMatcherFactory.cpp | 65 +- .../Parsing/Menu/Matcher/MenuMatcherFactory.h | 4 +- .../Menu/Matcher/MenuMatcherScriptInt.cpp | 3 +- .../Menu/Matcher/MenuMatcherScriptInt.h | 2 +- .../Menu/Matcher/MenuMatcherScriptNumeric.cpp | 5 +- .../Menu/Matcher/MenuMatcherScriptNumeric.h | 2 +- .../Parsing/Menu/MenuAssetZoneState.h | 8 +- .../Parsing/Menu/MenuFileCommonOperations.cpp | 2 +- .../Parsing/Menu/MenuFileCommonOperations.h | 4 +- src/ObjLoading/Parsing/Menu/MenuFileParser.h | 6 +- .../Parsing/Menu/MenuFileParserState.h | 20 +- .../Parsing/Menu/MenuFileReader.cpp | 4 +- src/ObjLoading/Parsing/Menu/MenuFileReader.h | 14 +- .../EventHandlerSetScopeSequences.cpp | 882 ++++--- .../Sequence/EventHandlerSetScopeSequences.h | 5 +- .../Menu/Sequence/FunctionScopeSequences.cpp | 127 +- .../Menu/Sequence/FunctionScopeSequences.h | 5 +- .../Generic/GenericBoolPropertySequence.cpp | 9 +- .../Generic/GenericBoolPropertySequence.h | 8 +- .../Generic/GenericColorPropertySequence.cpp | 8 +- .../Generic/GenericColorPropertySequence.h | 10 +- .../GenericExpressionPropertySequence.cpp | 33 +- .../GenericExpressionPropertySequence.h | 8 +- .../GenericFloatingPointPropertySequence.cpp | 9 +- .../GenericFloatingPointPropertySequence.h | 8 +- .../Generic/GenericIntPropertySequence.cpp | 4 +- .../Generic/GenericIntPropertySequence.h | 8 +- .../GenericKeywordPropertySequence.cpp | 4 +- .../Generic/GenericKeywordPropertySequence.h | 8 +- ...ricMenuEventHandlerSetPropertySequence.cpp | 11 +- ...nericMenuEventHandlerSetPropertySequence.h | 12 +- .../Generic/GenericStringPropertySequence.cpp | 9 +- .../Generic/GenericStringPropertySequence.h | 8 +- .../Menu/Sequence/GlobalScopeSequences.cpp | 9 +- .../Menu/Sequence/GlobalScopeSequences.h | 2 +- .../Menu/Sequence/ItemScopeSequences.cpp | 1158 ++++----- .../Menu/Sequence/ItemScopeSequences.h | 2 +- .../Menu/Sequence/MenuScopeSequences.cpp | 472 ++-- .../Menu/Sequence/MenuScopeSequences.h | 2 +- .../Menu/Sequence/NoScopeSequences.cpp | 9 +- .../Parsing/Menu/Sequence/NoScopeSequences.h | 2 +- src/ObjLoading/SearchPath/ISearchPath.h | 8 +- .../SearchPath/SearchPathFilesystem.cpp | 4 +- .../SearchPath/SearchPathFilesystem.h | 6 +- .../SearchPath/SearchPathSearchOptions.cpp | 2 +- .../SearchPath/SearchPathSearchOptions.h | 2 +- src/ObjLoading/SearchPath/SearchPaths.cpp | 10 +- src/ObjLoading/SearchPath/SearchPaths.h | 8 +- .../Matcher/StateMapExpressionMatchers.h | 6 +- .../StateMap/Parsing/StateMapParser.cpp | 80 +- .../StateMap/Parsing/StateMapParser.h | 10 +- .../StateMap/Parsing/StateMapParserState.h | 10 +- src/ObjLoading/StateMap/StateMapDefinition.h | 6 +- .../StateMapFromTechniqueExtractor.cpp | 24 +- .../StateMap/StateMapFromTechniqueExtractor.h | 26 +- src/ObjLoading/StateMap/StateMapHandler.cpp | 34 +- src/ObjLoading/StateMap/StateMapHandler.h | 10 +- src/ObjLoading/StateMap/StateMapReader.cpp | 6 +- src/ObjLoading/StateMap/StateMapReader.h | 14 +- .../StructuredDataDefScopeSequences.cpp | 54 +- .../StructuredDataDefScopeSequences.h | 5 +- .../StructuredDataEnumScopeSequences.cpp | 24 +- .../StructuredDataEnumScopeSequences.h | 5 +- .../StructuredDataNoScopeSequences.cpp | 10 +- .../Sequence/StructuredDataNoScopeSequences.h | 5 +- .../StructuredDataStructScopeSequences.cpp | 107 +- .../StructuredDataStructScopeSequences.h | 5 +- .../Parsing/StructuredDataDefParser.h | 12 +- .../Parsing/StructuredDataDefParserState.cpp | 3 +- .../Parsing/StructuredDataDefParserState.h | 12 +- .../StructuredDataDefSizeCalculator.cpp | 6 +- .../Parsing/StructuredDataDefSizeCalculator.h | 10 +- .../StructuredDataDefReader.cpp | 2 +- .../StructuredDataDefReader.h | 6 +- .../Sequence/TechniqueNoScopeSequences.cpp | 14 +- .../Sequence/TechniqueNoScopeSequences.h | 6 +- .../Sequence/TechniquePassScopeSequences.cpp | 92 +- .../Sequence/TechniquePassScopeSequences.h | 6 +- .../TechniqueShaderScopeSequences.cpp | 111 +- .../Sequence/TechniqueShaderScopeSequences.h | 6 +- .../Techset/Parsing/TechniqueFileParser.h | 6 +- .../Parsing/TechniqueFileParserState.h | 4 +- .../Techset/Parsing/TechsetFileParser.cpp | 29 +- .../Techset/Parsing/TechsetFileParser.h | 10 +- .../Techset/Parsing/TechsetFileParserState.h | 6 +- .../Techset/TechniqueDefinitionAcceptor.cpp | 2 +- .../Techset/TechniqueDefinitionAcceptor.h | 19 +- .../Techset/TechniqueFileReader.cpp | 6 +- src/ObjLoading/Techset/TechniqueFileReader.h | 10 +- .../Techset/TechniqueStateMapCache.h | 10 +- src/ObjLoading/Techset/TechsetDefinition.h | 2 +- .../Techset/TechsetDefinitionCache.h | 14 +- src/ObjLoading/Techset/TechsetFileReader.cpp | 6 +- src/ObjLoading/Techset/TechsetFileReader.h | 10 +- src/ObjWriting/Dumping/AbstractAssetDumper.h | 3 +- src/ObjWriting/Dumping/AbstractTextDumper.cpp | 5 +- src/ObjWriting/Dumping/AbstractTextDumper.h | 2 +- src/ObjWriting/Dumping/AssetDumpingContext.h | 15 +- src/ObjWriting/Dumping/IAssetDumper.h | 5 +- src/ObjWriting/Dumping/IZoneDumper.h | 2 +- .../Dumping/Localize/StringFileDumper.cpp | 6 +- .../Dumping/MapFile/MapFileDumper.cpp | 19 +- .../Dumping/MapFile/MapFileDumper.h | 4 +- .../Dumping/SndCurve/SndCurveDumper.h | 4 +- .../IW3/AssetDumpers/AssetDumperGfxImage.cpp | 8 +- .../IW3/AssetDumpers/AssetDumperGfxImage.h | 6 +- .../AssetDumpers/AssetDumperLoadedSound.cpp | 36 +- .../IW3/AssetDumpers/AssetDumperLoadedSound.h | 2 +- .../AssetDumpers/AssetDumperLocalizeEntry.cpp | 8 +- .../AssetDumpers/AssetDumperLocalizeEntry.h | 2 +- .../IW3/AssetDumpers/AssetDumperMapEnts.h | 2 +- .../IW3/AssetDumpers/AssetDumperMaterial.cpp | 208 +- .../IW3/AssetDumpers/AssetDumperMaterial.h | 2 +- .../IW3/AssetDumpers/AssetDumperRawFile.h | 2 +- .../IW3/AssetDumpers/AssetDumperStringTable.h | 2 +- .../IW3/AssetDumpers/AssetDumperXModel.cpp | 111 +- .../Game/IW3/AssetDumpers/AssetDumperXModel.h | 9 +- src/ObjWriting/Game/IW3/ZoneDumperIW3.cpp | 17 +- src/ObjWriting/Game/IW3/ZoneDumperIW3.h | 2 +- .../AssetDumpers/AssetDumperAddonMapEnts.h | 2 +- .../IW4/AssetDumpers/AssetDumperGfxImage.cpp | 8 +- .../IW4/AssetDumpers/AssetDumperGfxImage.h | 6 +- .../IW4/AssetDumpers/AssetDumperGfxLightDef.h | 2 +- .../AssetDumpers/AssetDumperLoadedSound.cpp | 5 +- .../IW4/AssetDumpers/AssetDumperLoadedSound.h | 3 +- .../AssetDumpers/AssetDumperLocalizeEntry.cpp | 8 +- .../AssetDumpers/AssetDumperLocalizeEntry.h | 2 +- .../IW4/AssetDumpers/AssetDumperMaterial.cpp | 335 ++- .../IW4/AssetDumpers/AssetDumperMaterial.h | 2 +- .../IW4/AssetDumpers/AssetDumperMenuDef.cpp | 10 +- .../IW4/AssetDumpers/AssetDumperMenuDef.h | 2 +- .../IW4/AssetDumpers/AssetDumperMenuList.cpp | 36 +- .../IW4/AssetDumpers/AssetDumperMenuList.h | 2 +- .../AssetDumpers/AssetDumperPhysCollmap.cpp | 12 +- .../IW4/AssetDumpers/AssetDumperPhysCollmap.h | 2 +- .../AssetDumpers/AssetDumperPhysPreset.cpp | 34 +- .../IW4/AssetDumpers/AssetDumperPhysPreset.h | 2 +- .../AssetDumpers/AssetDumperPixelShader.cpp | 3 +- .../IW4/AssetDumpers/AssetDumperPixelShader.h | 2 +- .../IW4/AssetDumpers/AssetDumperRawFile.cpp | 2 +- .../IW4/AssetDumpers/AssetDumperRawFile.h | 2 +- .../IW4/AssetDumpers/AssetDumperSndCurve.cpp | 4 +- .../IW4/AssetDumpers/AssetDumperSndCurve.h | 2 +- .../AssetDumpers/AssetDumperStringTable.cpp | 2 +- .../IW4/AssetDumpers/AssetDumperStringTable.h | 2 +- .../AssetDumperStructuredDataDefSet.cpp | 22 +- .../AssetDumperStructuredDataDefSet.h | 12 +- .../AssetDumpers/AssetDumperTechniqueSet.cpp | 92 +- .../AssetDumpers/AssetDumperTechniqueSet.h | 2 +- .../IW4/AssetDumpers/AssetDumperTracer.cpp | 34 +- .../Game/IW4/AssetDumpers/AssetDumperTracer.h | 2 +- .../IW4/AssetDumpers/AssetDumperVehicle.cpp | 74 +- .../IW4/AssetDumpers/AssetDumperVehicle.h | 2 +- .../AssetDumpers/AssetDumperVertexShader.cpp | 3 +- .../AssetDumpers/AssetDumperVertexShader.h | 2 +- .../IW4/AssetDumpers/AssetDumperWeapon.cpp | 219 +- .../Game/IW4/AssetDumpers/AssetDumperWeapon.h | 2 +- .../IW4/AssetDumpers/AssetDumperXModel.cpp | 114 +- .../Game/IW4/AssetDumpers/AssetDumperXModel.h | 9 +- .../InfoStringFromStructConverter.cpp | 29 +- .../InfoStringFromStructConverter.h | 9 +- .../Game/IW4/Menu/MenuDumperIW4.cpp | 36 +- src/ObjWriting/Game/IW4/Menu/MenuDumperIW4.h | 8 +- src/ObjWriting/Game/IW4/ZoneDumperIW4.cpp | 17 +- src/ObjWriting/Game/IW4/ZoneDumperIW4.h | 2 +- .../AssetDumpers/AssetDumperAddonMapEnts.h | 2 +- .../IW5/AssetDumpers/AssetDumperGfxImage.cpp | 8 +- .../IW5/AssetDumpers/AssetDumperGfxImage.h | 6 +- .../AssetDumpers/AssetDumperLoadedSound.cpp | 36 +- .../IW5/AssetDumpers/AssetDumperLoadedSound.h | 2 +- .../AssetDumpers/AssetDumperLocalizeEntry.cpp | 8 +- .../AssetDumpers/AssetDumperLocalizeEntry.h | 2 +- .../IW5/AssetDumpers/AssetDumperMenuDef.cpp | 10 +- .../IW5/AssetDumpers/AssetDumperMenuDef.h | 2 +- .../IW5/AssetDumpers/AssetDumperMenuList.cpp | 24 +- .../IW5/AssetDumpers/AssetDumperMenuList.h | 2 +- .../IW5/AssetDumpers/AssetDumperRawFile.cpp | 2 +- .../IW5/AssetDumpers/AssetDumperRawFile.h | 2 +- .../IW5/AssetDumpers/AssetDumperStringTable.h | 2 +- .../IW5/AssetDumpers/AssetDumperXModel.cpp | 114 +- .../Game/IW5/AssetDumpers/AssetDumperXModel.h | 9 +- .../InfoStringFromStructConverter.cpp | 26 +- .../InfoStringFromStructConverter.h | 9 +- .../Game/IW5/Menu/MenuDumperIW5.cpp | 34 +- src/ObjWriting/Game/IW5/Menu/MenuDumperIW5.h | 8 +- src/ObjWriting/Game/IW5/ZoneDumperIW5.cpp | 17 +- src/ObjWriting/Game/IW5/ZoneDumperIW5.h | 2 +- .../T5/AssetDumpers/AssetDumperGfxImage.cpp | 8 +- .../T5/AssetDumpers/AssetDumperGfxImage.h | 6 +- .../AssetDumpers/AssetDumperLocalizeEntry.cpp | 8 +- .../AssetDumpers/AssetDumperLocalizeEntry.h | 2 +- .../T5/AssetDumpers/AssetDumperRawFile.cpp | 8 +- .../Game/T5/AssetDumpers/AssetDumperRawFile.h | 2 +- .../AssetDumpers/AssetDumperStringTable.cpp | 2 +- .../T5/AssetDumpers/AssetDumperStringTable.h | 2 +- .../T5/AssetDumpers/AssetDumperXModel.cpp | 115 +- .../Game/T5/AssetDumpers/AssetDumperXModel.h | 9 +- src/ObjWriting/Game/T5/ZoneDumperT5.cpp | 23 +- src/ObjWriting/Game/T5/ZoneDumperT5.h | 2 +- .../T6/AssetDumpers/AssetDumperFontIcon.cpp | 212 +- .../T6/AssetDumpers/AssetDumperFontIcon.h | 2 +- .../T6/AssetDumpers/AssetDumperGfxImage.cpp | 8 +- .../T6/AssetDumpers/AssetDumperGfxImage.h | 6 +- .../AssetDumpers/AssetDumperLocalizeEntry.cpp | 10 +- .../AssetDumpers/AssetDumperLocalizeEntry.h | 2 +- .../AssetDumperPhysConstraints.cpp | 36 +- .../AssetDumpers/AssetDumperPhysConstraints.h | 2 +- .../T6/AssetDumpers/AssetDumperPhysPreset.cpp | 36 +- .../T6/AssetDumpers/AssetDumperPhysPreset.h | 2 +- .../Game/T6/AssetDumpers/AssetDumperQdb.cpp | 2 +- .../Game/T6/AssetDumpers/AssetDumperQdb.h | 2 +- .../T6/AssetDumpers/AssetDumperRawFile.cpp | 2 +- .../Game/T6/AssetDumpers/AssetDumperRawFile.h | 2 +- .../AssetDumperScriptParseTree.cpp | 2 +- .../AssetDumpers/AssetDumperScriptParseTree.h | 2 +- .../Game/T6/AssetDumpers/AssetDumperSlug.cpp | 2 +- .../Game/T6/AssetDumpers/AssetDumperSlug.h | 2 +- .../T6/AssetDumpers/AssetDumperSndBank.cpp | 37 +- .../Game/T6/AssetDumpers/AssetDumperSndBank.h | 2 +- .../AssetDumpers/AssetDumperStringTable.cpp | 2 +- .../T6/AssetDumpers/AssetDumperStringTable.h | 2 +- .../T6/AssetDumpers/AssetDumperTracer.cpp | 32 +- .../Game/T6/AssetDumpers/AssetDumperTracer.h | 2 +- .../T6/AssetDumpers/AssetDumperVehicle.cpp | 94 +- .../Game/T6/AssetDumpers/AssetDumperVehicle.h | 2 +- .../T6/AssetDumpers/AssetDumperWeapon.cpp | 275 ++- .../Game/T6/AssetDumpers/AssetDumperWeapon.h | 2 +- .../AssetDumperWeaponAttachment.cpp | 32 +- .../AssetDumperWeaponAttachment.h | 2 +- .../AssetDumperWeaponAttachmentUnique.cpp | 94 +- .../AssetDumperWeaponAttachmentUnique.h | 2 +- .../T6/AssetDumpers/AssetDumperXModel.cpp | 119 +- .../Game/T6/AssetDumpers/AssetDumperXModel.h | 9 +- .../T6/AssetDumpers/AssetDumperZBarrier.cpp | 32 +- .../T6/AssetDumpers/AssetDumperZBarrier.h | 2 +- .../InfoStringFromStructConverter.cpp | 23 +- .../InfoStringFromStructConverter.h | 9 +- src/ObjWriting/Game/T6/ZoneDumperT6.cpp | 31 +- src/ObjWriting/Game/T6/ZoneDumperT6.h | 2 +- src/ObjWriting/Image/DdsWriter.cpp | 21 +- src/ObjWriting/Image/DdsWriter.h | 2 +- src/ObjWriting/Image/IImageWriter.h | 6 +- src/ObjWriting/Image/IwiWriter27.cpp | 7 +- src/ObjWriting/Image/IwiWriter27.h | 2 +- src/ObjWriting/Image/IwiWriter6.cpp | 20 +- src/ObjWriting/Image/IwiWriter6.h | 2 +- src/ObjWriting/Image/IwiWriter8.cpp | 6 +- src/ObjWriting/Image/IwiWriter8.h | 2 +- .../InfoStringFromStructConverterBase.cpp | 17 +- .../InfoStringFromStructConverterBase.h | 6 +- src/ObjWriting/Menu/AbstractMenuDumper.cpp | 28 +- src/ObjWriting/Menu/AbstractMenuDumper.h | 10 +- src/ObjWriting/Menu/MenuDumpingZoneState.h | 6 +- src/ObjWriting/Model/Obj/ObjWriter.cpp | 44 +- src/ObjWriting/Model/Obj/ObjWriter.h | 6 +- .../Model/XModel/AbstractXModelWriter.cpp | 3 +- .../Model/XModel/AbstractXModelWriter.h | 4 +- .../Model/XModel/XModelExportWriter.cpp | 134 +- .../Model/XModel/XModelExportWriter.h | 6 +- .../ObjContainer/IPak/IPakWriter.cpp | 68 +- src/ObjWriting/ObjContainer/IPak/IPakWriter.h | 4 +- src/ObjWriting/ObjWriting.cpp | 10 +- src/ObjWriting/ObjWriting.h | 4 +- src/ObjWriting/Sound/WavWriter.cpp | 36 +- .../StructuredDataDefDumper.cpp | 32 +- .../StructuredDataDefDumper.h | 6 +- src/Parser/Parsing/ILexer.h | 3 +- src/Parser/Parsing/IPackValueSupplier.h | 2 +- src/Parser/Parsing/IParserLineStream.h | 6 +- src/Parser/Parsing/IParserValue.h | 2 +- .../Impl/AbstractDirectiveStreamProxy.cpp | 12 +- src/Parser/Parsing/Impl/AbstractLexer.h | 46 +- src/Parser/Parsing/Impl/AbstractParser.h | 18 +- .../Impl/CommentRemovingStreamProxy.cpp | 10 +- .../Parsing/Impl/DefinesStreamProxy.cpp | 42 +- src/Parser/Parsing/Impl/DefinesStreamProxy.h | 11 +- .../Parsing/Impl/IncludingStreamProxy.cpp | 20 +- .../Parsing/Impl/IncludingStreamProxy.h | 9 +- .../Parsing/Impl/PackDefinitionStreamProxy.h | 6 +- .../Parsing/Impl/ParserFilesystemStream.cpp | 16 +- .../Parsing/Impl/ParserFilesystemStream.h | 7 +- .../Parsing/Impl/ParserMultiInputStream.h | 10 +- .../Parsing/Impl/ParserSingleInputStream.cpp | 4 +- .../Parsing/Impl/ParserSingleInputStream.h | 6 +- src/Parser/Parsing/Matcher/AbstractMatcher.h | 11 +- .../Parsing/Matcher/AbstractMatcherFactory.h | 16 +- src/Parser/Parsing/Matcher/MatcherAnd.h | 13 +- src/Parser/Parsing/Matcher/MatcherFalse.h | 12 +- src/Parser/Parsing/Matcher/MatcherLabel.h | 14 +- src/Parser/Parsing/Matcher/MatcherLoop.h | 13 +- src/Parser/Parsing/Matcher/MatcherOptional.h | 9 +- src/Parser/Parsing/Matcher/MatcherOr.h | 9 +- src/Parser/Parsing/Matcher/MatcherResult.h | 9 +- src/Parser/Parsing/Matcher/MatcherTrue.h | 12 +- src/Parser/Parsing/ParsingException.h | 6 +- .../Sequence/AbstractScopeSequenceHolder.h | 6 +- .../Parsing/Sequence/AbstractSequence.h | 16 +- src/Parser/Parsing/Sequence/SequenceResult.h | 13 +- .../Simple/Expression/ISimpleExpression.h | 9 +- .../SimpleExpressionBinaryOperation.cpp | 112 +- .../SimpleExpressionBinaryOperation.h | 17 +- .../SimpleExpressionConditionalOperator.cpp | 17 +- .../SimpleExpressionConditionalOperator.h | 4 +- .../Expression/SimpleExpressionMatchers.cpp | 181 +- .../Expression/SimpleExpressionMatchers.h | 20 +- .../Expression/SimpleExpressionScopeValue.h | 4 +- .../SimpleExpressionUnaryOperation.cpp | 83 +- .../SimpleExpressionUnaryOperation.h | 8 +- .../Simple/Expression/SimpleExpressionValue.h | 8 +- .../SimpleMatcherAnyCharacterBesides.h | 6 +- .../Simple/Matcher/SimpleMatcherCharacter.cpp | 5 +- .../Simple/Matcher/SimpleMatcherCharacter.h | 2 +- .../Simple/Matcher/SimpleMatcherFactory.h | 8 +- .../Simple/Matcher/SimpleMatcherKeyword.cpp | 4 +- .../Simple/Matcher/SimpleMatcherKeyword.h | 6 +- .../SimpleMatcherKeywordIgnoreCase.cpp | 12 +- .../Matcher/SimpleMatcherKeywordIgnoreCase.h | 6 +- .../Matcher/SimpleMatcherKeywordPrefix.cpp | 4 +- .../Matcher/SimpleMatcherKeywordPrefix.h | 6 +- .../Matcher/SimpleMatcherMultiCharacter.h | 2 +- .../Simple/Matcher/SimpleMatcherValueType.cpp | 4 +- .../Simple/Matcher/SimpleMatcherValueType.h | 2 +- .../SimpleMatcherValueTypeAndHasPrefix.cpp | 5 +- .../SimpleMatcherValueTypeAndHasSignPrefix.h | 2 +- .../Simple/SimpleExpressionInterpreter.cpp | 7 +- src/Parser/Parsing/Simple/SimpleLexer.cpp | 8 +- src/Parser/Parsing/Simple/SimpleLexer.h | 8 +- src/Parser/Parsing/Simple/SimpleParserValue.h | 7 +- src/Parser/Parsing/TokenPos.h | 2 +- src/RawTemplater/RawTemplater.cpp | 8 +- src/RawTemplater/RawTemplaterArguments.cpp | 49 +- src/RawTemplater/RawTemplaterArguments.h | 6 +- .../Templating/DirectiveEscapeStreamProxy.h | 2 +- .../Templating/SetDefineStreamProxy.h | 4 +- src/RawTemplater/Templating/Templater.cpp | 22 +- src/RawTemplater/Templating/Templater.h | 8 +- .../Templating/TemplatingStreamProxy.cpp | 10 +- .../Templating/TemplatingStreamProxy.h | 4 +- src/Unlinker/ContentLister/ContentPrinter.cpp | 2 +- src/Unlinker/ContentLister/ContentPrinter.h | 2 +- src/Unlinker/ContentLister/ZoneDefWriter.cpp | 4 +- src/Unlinker/ContentLister/ZoneDefWriter.h | 6 +- src/Unlinker/Game/IW3/ZoneDefWriterIW3.cpp | 10 +- src/Unlinker/Game/IW3/ZoneDefWriterIW3.h | 2 +- src/Unlinker/Game/IW4/ZoneDefWriterIW4.cpp | 10 +- src/Unlinker/Game/IW4/ZoneDefWriterIW4.h | 2 +- src/Unlinker/Game/IW5/ZoneDefWriterIW5.cpp | 10 +- src/Unlinker/Game/IW5/ZoneDefWriterIW5.h | 2 +- src/Unlinker/Game/T5/ZoneDefWriterT5.cpp | 10 +- src/Unlinker/Game/T5/ZoneDefWriterT5.h | 2 +- src/Unlinker/Game/T6/ZoneDefWriterT6.cpp | 14 +- src/Unlinker/Game/T6/ZoneDefWriterT6.h | 2 +- src/Unlinker/Unlinker.cpp | 36 +- src/Unlinker/Unlinker.h | 2 +- src/Unlinker/UnlinkerArgs.cpp | 180 +- src/Unlinker/UnlinkerArgs.h | 8 +- src/Utils/Math/Matrix.h | 20 +- src/Utils/Math/Quaternion.h | 12 +- src/Utils/Math/Vector.h | 216 +- src/Utils/Utils/Alignment.h | 8 +- src/Utils/Utils/Arguments/ArgumentParser.cpp | 39 +- src/Utils/Utils/Arguments/ArgumentParser.h | 5 +- src/Utils/Utils/Arguments/CommandLineOption.h | 2 +- .../Utils/Arguments/UsageInformation.cpp | 16 +- src/Utils/Utils/Arguments/UsageInformation.h | 7 +- src/Utils/Utils/ClassUtils.h | 5 +- src/Utils/Utils/Endianness.cpp | 31 +- src/Utils/Utils/Endianness.h | 145 +- src/Utils/Utils/FileUtils.h | 5 +- src/Utils/Utils/MemoryManager.cpp | 3 +- src/Utils/Utils/MemoryManager.h | 10 +- src/Utils/Utils/StringUtils.cpp | 2 +- src/Utils/Utils/StringUtils.h | 2 +- src/Utils/Utils/TransformIterator.h | 23 +- src/ZoneCode/Game/Common.h | 30 +- src/ZoneCode/Game/IW3/IW3.h | 4 +- src/ZoneCode/Game/IW4/IW4.h | 4 +- src/ZoneCode/Game/IW5/IW5.h | 4 +- src/ZoneCode/Game/T5/T5.h | 4 +- src/ZoneCode/Game/T6/T6.h | 4 +- .../Computations/MemberComputations.cpp | 47 +- .../MemberDeclarationModifierComputations.cpp | 57 +- .../MemberDeclarationModifierComputations.h | 4 +- .../Computations/StructureComputations.cpp | 6 +- .../Definition/ArrayDeclarationModifier.h | 6 +- .../Domain/Definition/BaseTypeDefinition.cpp | 21 +- .../Domain/Definition/DataDefinition.cpp | 3 +- .../Domain/Definition/DataDefinition.h | 6 +- .../Domain/Definition/DeclarationModifier.h | 2 +- .../Definition/DefinitionWithMembers.cpp | 36 +- .../Domain/Definition/DefinitionWithMembers.h | 8 +- .../Domain/Definition/EnumDefinition.h | 6 +- .../Domain/Definition/EnumMember.h | 2 +- .../Definition/PointerDeclarationModifier.cpp | 4 +- .../Definition/PointerDeclarationModifier.h | 6 +- .../Domain/Definition/TypeDeclaration.cpp | 4 +- .../Domain/Definition/TypeDeclaration.h | 8 +- .../Domain/Definition/UnionDefinition.h | 4 +- .../Domain/Definition/Variable.h | 6 +- .../Domain/Environment/Architecture.h | 2 +- .../Domain/Evaluation/IEvaluation.h | 2 +- .../Domain/Evaluation/OperandDynamic.cpp | 4 +- .../Domain/Evaluation/OperandDynamic.h | 12 +- .../Domain/Evaluation/OperandStatic.h | 2 +- .../Domain/Evaluation/Operation.cpp | 4 +- .../Domain/Evaluation/Operation.h | 6 +- .../Domain/Evaluation/OperationType.cpp | 274 +-- .../Domain/Evaluation/OperationType.h | 2 +- .../Domain/Extension/CustomAction.h | 4 +- .../Domain/FastFile/FastFileBlock.h | 2 +- .../Domain/Information/MemberInformation.h | 11 +- .../Domain/Information/StructureInformation.h | 5 +- .../Generating/CodeGenerator.cpp | 18 +- .../Generating/CodeGenerator.h | 4 +- .../Generating/ICodeTemplate.h | 6 +- .../Generating/RenderingContext.cpp | 26 +- .../Generating/RenderingContext.h | 6 +- .../Templates/AssetStructTestsTemplate.cpp | 22 +- .../Templates/Internal/BaseTemplate.cpp | 17 +- .../Templates/Internal/BaseTemplate.h | 33 +- .../Generating/Templates/ZoneLoadTemplate.cpp | 255 +- .../Templates/ZoneWriteTemplate.cpp | 183 +- .../Parsing/Commands/CommandsFileReader.cpp | 22 +- .../Parsing/Commands/CommandsFileReader.h | 6 +- .../Parsing/Commands/Impl/CommandsParser.cpp | 36 +- .../Commands/Impl/CommandsParserState.cpp | 18 +- .../Commands/Impl/CommandsParserState.h | 11 +- .../Commands/Impl/CommandsParserValue.h | 9 +- .../Matcher/CommandsCommonMatchers.cpp | 369 ++- .../Commands/Matcher/CommandsCommonMatchers.h | 14 +- .../Matcher/CommandsMatcherCharacter.cpp | 5 +- .../Commands/Matcher/CommandsMatcherFactory.h | 4 +- .../Matcher/CommandsMatcherKeyword.cpp | 4 +- .../Commands/Matcher/CommandsMatcherKeyword.h | 4 +- .../Matcher/CommandsMatcherValueType.cpp | 4 +- .../Commands/Sequence/SequenceAction.cpp | 41 +- .../Commands/Sequence/SequenceAllocAlign.cpp | 16 +- .../Sequence/SequenceArchitecture.cpp | 10 +- .../Commands/Sequence/SequenceArrayCount.cpp | 17 +- .../Commands/Sequence/SequenceArraySize.cpp | 15 +- .../Commands/Sequence/SequenceAsset.cpp | 12 +- .../Commands/Sequence/SequenceBlock.cpp | 14 +- .../Parsing/Commands/Sequence/SequenceBlock.h | 6 +- .../Commands/Sequence/SequenceCondition.cpp | 22 +- .../Commands/Sequence/SequenceCount.cpp | 27 +- .../Parsing/Commands/Sequence/SequenceCount.h | 5 +- .../Commands/Sequence/SequenceGame.cpp | 8 +- .../Commands/Sequence/SequenceName.cpp | 9 +- .../Commands/Sequence/SequenceReorder.cpp | 34 +- .../Commands/Sequence/SequenceReusable.cpp | 10 +- .../Sequence/SequenceScriptString.cpp | 10 +- .../Commands/Sequence/SequenceSetBlock.cpp | 20 +- .../Commands/Sequence/SequenceString.cpp | 25 +- .../Parsing/Commands/Sequence/SequenceUse.cpp | 8 +- .../Parsing/Header/Block/HeaderBlockEnum.cpp | 9 +- .../Parsing/Header/Block/HeaderBlockEnum.h | 6 +- .../Header/Block/HeaderBlockNamespace.cpp | 20 +- .../Parsing/Header/Block/HeaderBlockNone.cpp | 24 +- .../Header/Block/HeaderBlockStruct.cpp | 14 +- .../Parsing/Header/Block/HeaderBlockStruct.h | 8 +- .../Parsing/Header/Block/HeaderBlockUnion.cpp | 12 +- .../Parsing/Header/Block/HeaderBlockUnion.h | 2 +- .../Parsing/Header/Block/IHeaderBlock.h | 9 +- .../Block/IHeaderBlockVariableDefining.h | 4 +- .../Header/Block/IHeaderBlockVariableHolder.h | 4 +- .../Parsing/Header/HeaderFileReader.cpp | 20 +- .../Parsing/Header/HeaderFileReader.h | 6 +- .../Parsing/Header/Impl/HeaderLexer.cpp | 184 +- .../Parsing/Header/Impl/HeaderLexer.h | 4 +- .../Parsing/Header/Impl/HeaderParserState.cpp | 9 +- .../Parsing/Header/Impl/HeaderParserState.h | 14 +- .../Parsing/Header/Impl/HeaderParserValue.h | 9 +- .../Header/Matcher/HeaderCommonMatchers.cpp | 153 +- .../Header/Matcher/HeaderCommonMatchers.h | 6 +- .../Header/Matcher/HeaderMatcherCharacter.cpp | 5 +- .../Header/Matcher/HeaderMatcherValueType.cpp | 4 +- .../Header/Sequence/SequenceCloseBlock.cpp | 11 +- .../Header/Sequence/SequenceCloseBlock.h | 2 +- .../Parsing/Header/Sequence/SequenceEnum.cpp | 19 +- .../Parsing/Header/Sequence/SequenceEnum.h | 2 +- .../Header/Sequence/SequenceEnumMember.cpp | 20 +- .../Header/Sequence/SequenceEnumMember.h | 2 +- .../Header/Sequence/SequenceForwardDecl.cpp | 20 +- .../Header/Sequence/SequenceForwardDecl.h | 2 +- .../Header/Sequence/SequenceNamespace.cpp | 7 +- .../Header/Sequence/SequenceNamespace.h | 2 +- .../Header/Sequence/SequenceStruct.cpp | 27 +- .../Parsing/Header/Sequence/SequenceStruct.h | 2 +- .../Header/Sequence/SequenceTypedef.cpp | 56 +- .../Parsing/Header/Sequence/SequenceTypedef.h | 2 +- .../Parsing/Header/Sequence/SequenceUnion.cpp | 21 +- .../Parsing/Header/Sequence/SequenceUnion.h | 2 +- .../Header/Sequence/SequenceVariable.cpp | 54 +- .../Header/Sequence/SequenceVariable.h | 2 +- .../CalculateSizeAndAlignPostProcessor.cpp | 26 +- .../CreateMemberInformationPostProcessor.cpp | 16 +- ...reateStructureInformationPostProcessor.cpp | 8 +- .../PostProcessing/LeafsPostProcessor.cpp | 4 +- .../MemberLeafsPostProcessor.cpp | 2 +- .../PostProcessing/UnionsPostProcessor.cpp | 18 +- .../PostProcessing/UsagesPostProcessor.cpp | 26 +- .../Persistence/IDataRepository.h | 8 +- .../Persistence/InMemory/InMemoryRepository.h | 4 +- .../Printing/PrettyPrinter.cpp | 34 +- .../Printing/PrettyPrinter.h | 4 +- .../Utils/AlignmentUtils.h | 5 +- .../Utils/NamespaceBuilder.cpp | 2 +- .../Utils/NamespaceBuilder.h | 1 + .../ZoneCodeGenerator.cpp | 16 +- src/ZoneCodeGeneratorLib/ZoneCodeGenerator.h | 2 +- .../ZoneCodeGeneratorArguments.cpp | 111 +- .../ZoneCodeGeneratorArguments.h | 2 +- src/ZoneCommon/Game/IW3/GameAssetPoolIW3.cpp | 105 +- src/ZoneCommon/Game/IW3/GameAssetPoolIW3.h | 15 +- src/ZoneCommon/Game/IW3/ZoneConstantsIW3.h | 10 +- src/ZoneCommon/Game/IW4/GameAssetPoolIW4.cpp | 405 ++-- src/ZoneCommon/Game/IW4/GameAssetPoolIW4.h | 17 +- src/ZoneCommon/Game/IW4/ZoneConstantsIW4.h | 58 +- src/ZoneCommon/Game/IW5/GameAssetPoolIW5.cpp | 160 +- src/ZoneCommon/Game/IW5/GameAssetPoolIW5.h | 15 +- src/ZoneCommon/Game/IW5/ZoneConstantsIW5.h | 58 +- src/ZoneCommon/Game/T5/GameAssetPoolT5.cpp | 120 +- src/ZoneCommon/Game/T5/GameAssetPoolT5.h | 15 +- src/ZoneCommon/Game/T5/ZoneConstantsT5.h | 10 +- src/ZoneCommon/Game/T6/GameAssetPoolT6.cpp | 579 +++-- src/ZoneCommon/Game/T6/GameAssetPoolT6.h | 15 +- src/ZoneCommon/Game/T6/ZoneConstantsT6.h | 73 +- .../ZoneDefinitionMatcherCharacter.cpp | 5 +- .../Matcher/ZoneDefinitionMatcherFactory.h | 6 +- .../Matcher/ZoneDefinitionMatcherKeyword.cpp | 4 +- .../Matcher/ZoneDefinitionMatcherKeyword.h | 6 +- .../ZoneDefinitionMatcherValueType.cpp | 5 +- .../Matcher/ZoneDefinitionMatcherValueType.h | 2 +- .../SequenceZoneDefinitionAssetList.cpp | 6 +- .../Sequence/SequenceZoneDefinitionBuild.cpp | 6 +- .../Sequence/SequenceZoneDefinitionEntry.cpp | 20 +- .../Sequence/SequenceZoneDefinitionIgnore.cpp | 6 +- .../SequenceZoneDefinitionInclude.cpp | 6 +- .../SequenceZoneDefinitionMetaData.cpp | 7 +- .../ZoneDefinition/ZoneDefinitionLexer.h | 2 +- .../ZoneDefinition/ZoneDefinitionParser.cpp | 14 +- .../ZoneDefinition/ZoneDefinitionParser.h | 4 +- .../ZoneDefinitionParserValue.cpp | 12 +- .../ZoneDefinitionParserValue.h | 9 +- src/ZoneCommon/Pool/AssetPool.h | 16 +- src/ZoneCommon/Pool/AssetPoolDynamic.h | 16 +- src/ZoneCommon/Pool/AssetPoolStatic.h | 28 +- src/ZoneCommon/Pool/GlobalAssetPool.h | 33 +- src/ZoneCommon/Pool/XAssetInfo.h | 9 +- src/ZoneCommon/Pool/ZoneAssetPools.cpp | 10 +- src/ZoneCommon/Pool/ZoneAssetPools.h | 26 +- src/ZoneCommon/Zone/AssetList/AssetList.h | 2 +- .../Zone/AssetList/AssetListStream.h | 6 +- .../Zone/Definition/ZoneDefinition.cpp | 3 +- .../Zone/Definition/ZoneDefinition.h | 8 +- .../Zone/Definition/ZoneDefinitionStream.cpp | 12 +- .../Zone/Definition/ZoneDefinitionStream.h | 8 +- src/ZoneCommon/Zone/Stream/IZoneStream.h | 2 +- src/ZoneCommon/Zone/XBlock.cpp | 5 +- .../Zone/XChunk/AbstractSalsa20Processor.h | 8 +- src/ZoneCommon/Zone/XChunk/IXChunkProcessor.h | 2 +- src/ZoneCommon/Zone/XChunk/XChunkException.h | 4 +- .../Zone/XChunk/XChunkProcessorDeflate.cpp | 5 +- .../Zone/XChunk/XChunkProcessorInflate.cpp | 4 +- .../XChunkProcessorSalsa20Decryption.cpp | 14 +- .../XChunk/XChunkProcessorSalsa20Decryption.h | 6 +- .../XChunkProcessorSalsa20Encryption.cpp | 8 +- .../XChunk/XChunkProcessorSalsa20Encryption.h | 4 +- src/ZoneCommon/Zone/Zone.h | 12 +- src/ZoneCommon/Zone/ZoneMemory.cpp | 3 +- src/ZoneCommon/Zone/ZoneMemory.h | 6 +- src/ZoneCommon/Zone/ZoneScriptStrings.cpp | 2 +- src/ZoneCommon/Zone/ZoneScriptStrings.h | 8 +- src/ZoneLoading/Game/IW3/ContentLoaderIW3.cpp | 86 +- src/ZoneLoading/Game/IW3/ContentLoaderIW3.h | 4 +- .../IW3/XAssets/gfximage/gfximage_actions.h | 4 +- .../XAssets/loadedsound/loadedsound_actions.h | 4 +- .../Game/IW3/ZoneLoaderFactoryIW3.cpp | 20 +- .../Game/IW3/ZoneLoaderFactoryIW3.h | 3 +- src/ZoneLoading/Game/IW4/ContentLoaderIW4.cpp | 106 +- src/ZoneLoading/Game/IW4/ContentLoaderIW4.h | 4 +- .../IW4/XAssets/gfximage/gfximage_actions.h | 4 +- .../XAssets/loadedsound/loadedsound_actions.h | 4 +- .../IW4/XAssets/xmodel/xmodel_actions.cpp | 2 +- .../Game/IW4/XAssets/xmodel/xmodel_actions.h | 4 +- .../Game/IW4/ZoneLoaderFactoryIW4.cpp | 52 +- .../Game/IW4/ZoneLoaderFactoryIW4.h | 3 +- src/ZoneLoading/Game/IW5/ContentLoaderIW5.cpp | 114 +- src/ZoneLoading/Game/IW5/ContentLoaderIW5.h | 4 +- .../IW5/XAssets/gfximage/gfximage_actions.h | 4 +- .../XAssets/loadedsound/loadedsound_actions.h | 4 +- .../IW5/XAssets/xmodel/xmodel_actions.cpp | 2 +- .../Game/IW5/XAssets/xmodel/xmodel_actions.h | 4 +- .../Game/IW5/ZoneLoaderFactoryIW5.cpp | 48 +- .../Game/IW5/ZoneLoaderFactoryIW5.h | 3 +- src/ZoneLoading/Game/T5/ContentLoaderT5.cpp | 98 +- src/ZoneLoading/Game/T5/ContentLoaderT5.h | 4 +- .../T5/XAssets/gfximage/gfximage_actions.h | 4 +- .../Game/T5/ZoneLoaderFactoryT5.cpp | 20 +- src/ZoneLoading/Game/T5/ZoneLoaderFactoryT5.h | 3 +- src/ZoneLoading/Game/T6/ContentLoaderT6.cpp | 126 +- src/ZoneLoading/Game/T6/ContentLoaderT6.h | 4 +- .../T6/XAssets/gfximage/gfximage_actions.h | 4 +- .../Game/T6/ZoneLoaderFactoryT6.cpp | 38 +- src/ZoneLoading/Game/T6/ZoneLoaderFactoryT6.h | 3 +- src/ZoneLoading/Loading/AssetLoader.cpp | 2 +- src/ZoneLoading/Loading/AssetLoader.h | 12 +- src/ZoneLoading/Loading/AssetLoadingActions.h | 2 +- src/ZoneLoading/Loading/ContentLoaderBase.cpp | 1 + src/ZoneLoading/Loading/ContentLoaderBase.h | 2 +- .../Exception/BlockOverflowException.cpp | 2 +- .../Exception/InvalidChunkSizeException.cpp | 4 +- .../Exception/InvalidFileNameException.cpp | 2 +- .../Exception/InvalidHashException.cpp | 2 +- .../Exception/InvalidMagicException.cpp | 4 +- .../Exception/InvalidOffsetBlockException.cpp | 2 +- .../InvalidOffsetBlockOffsetException.cpp | 6 +- .../Exception/InvalidSignatureException.cpp | 2 +- .../Exception/InvalidVersionException.cpp | 2 +- .../Exception/InvalidXBlockSizeException.cpp | 2 +- .../Exception/InvalidXBlockSizeException.h | 3 +- .../Exception/OutOfBlockBoundsException.cpp | 2 +- .../TooManyAuthedGroupsException.cpp | 2 +- .../UnexpectedEndOfFileException.cpp | 4 +- .../UnsupportedAssetTypeException.cpp | 2 +- .../Loading/IContentLoadingEntryPoint.h | 4 +- src/ZoneLoading/Loading/ILoadingStep.h | 2 +- src/ZoneLoading/Loading/ILoadingStream.h | 4 +- src/ZoneLoading/Loading/IZoneLoaderFactory.h | 2 +- src/ZoneLoading/Loading/LoadingFileStream.cpp | 2 +- src/ZoneLoading/Loading/LoadingFileStream.h | 4 +- .../Processor/ProcessorAuthedBlocks.cpp | 24 +- .../Loading/Processor/ProcessorAuthedBlocks.h | 13 +- .../Processor/ProcessorCaptureData.cpp | 5 +- .../Loading/Processor/ProcessorCaptureData.h | 4 +- .../Processor/ProcessorIW4xDecryption.cpp | 2 +- .../Loading/Processor/ProcessorInflate.cpp | 8 +- .../Processor/ProcessorStreamCipher.cpp | 7 +- .../Loading/Processor/ProcessorStreamCipher.h | 2 +- .../Loading/Processor/ProcessorXChunks.cpp | 25 +- .../Loading/Processor/ProcessorXChunks.h | 4 +- .../Loading/Steps/StepAddProcessor.cpp | 3 +- .../Loading/Steps/StepAddProcessor.h | 4 +- .../Loading/Steps/StepAllocXBlocks.cpp | 9 +- .../Loading/Steps/StepDumpData.cpp | 2 +- src/ZoneLoading/Loading/Steps/StepDumpData.h | 2 +- .../Loading/Steps/StepLoadHash.cpp | 7 +- src/ZoneLoading/Loading/Steps/StepLoadHash.h | 8 +- .../Loading/Steps/StepLoadSignature.cpp | 8 +- .../Loading/Steps/StepLoadZoneContent.cpp | 7 +- .../Loading/Steps/StepLoadZoneContent.h | 6 +- .../Loading/Steps/StepLoadZoneSizes.h | 6 +- .../Loading/Steps/StepRemoveProcessor.cpp | 1 + .../Loading/Steps/StepSkipBytes.cpp | 6 +- src/ZoneLoading/Loading/Steps/StepSkipBytes.h | 2 +- .../Loading/Steps/StepVerifyFileName.cpp | 16 +- .../Loading/Steps/StepVerifyFileName.h | 2 +- .../Loading/Steps/StepVerifyHash.cpp | 17 +- .../Loading/Steps/StepVerifyHash.h | 6 +- .../Loading/Steps/StepVerifyMagic.cpp | 10 +- .../Loading/Steps/StepVerifyMagic.h | 2 +- .../Loading/Steps/StepVerifySignature.cpp | 6 +- .../Loading/Steps/StepVerifySignature.h | 8 +- src/ZoneLoading/Loading/StreamProcessor.cpp | 2 +- src/ZoneLoading/Loading/ZoneLoader.cpp | 14 +- src/ZoneLoading/Loading/ZoneLoader.h | 6 +- .../Zone/Stream/IZoneInputStream.h | 30 +- .../Zone/Stream/Impl/XBlockInputStream.cpp | 16 +- .../Zone/Stream/Impl/XBlockInputStream.h | 5 +- src/ZoneLoading/ZoneLoading.cpp | 30 +- src/ZoneLoading/ZoneLoading.h | 4 +- src/ZoneWriting/Game/IW3/ContentWriterIW3.cpp | 89 +- src/ZoneWriting/Game/IW3/ContentWriterIW3.h | 4 +- .../Game/IW3/ZoneWriterFactoryIW3.cpp | 11 +- .../Game/IW3/ZoneWriterFactoryIW3.h | 6 +- src/ZoneWriting/Game/IW4/ContentWriterIW4.cpp | 109 +- src/ZoneWriting/Game/IW4/ContentWriterIW4.h | 4 +- .../Game/IW4/ZoneWriterFactoryIW4.cpp | 9 +- .../Game/IW4/ZoneWriterFactoryIW4.h | 6 +- src/ZoneWriting/Game/IW5/ContentWriterIW5.cpp | 115 +- src/ZoneWriting/Game/IW5/ContentWriterIW5.h | 4 +- .../Game/IW5/ZoneWriterFactoryIW5.cpp | 11 +- .../Game/IW5/ZoneWriterFactoryIW5.h | 6 +- src/ZoneWriting/Game/T5/ContentWriterT5.cpp | 101 +- src/ZoneWriting/Game/T5/ContentWriterT5.h | 4 +- .../Game/T5/ZoneWriterFactoryT5.cpp | 11 +- src/ZoneWriting/Game/T5/ZoneWriterFactoryT5.h | 6 +- src/ZoneWriting/Game/T6/ContentWriterT6.cpp | 129 +- src/ZoneWriting/Game/T6/ContentWriterT6.h | 4 +- .../Game/T6/ZoneWriterFactoryT6.cpp | 29 +- src/ZoneWriting/Game/T6/ZoneWriterFactoryT6.h | 6 +- src/ZoneWriting/Writing/AssetWriter.h | 4 +- src/ZoneWriting/Writing/ContentWriterBase.h | 2 +- .../Writing/IContentWritingEntryPoint.h | 4 +- src/ZoneWriting/Writing/IWritingStep.h | 2 +- src/ZoneWriting/Writing/IWritingStream.h | 4 +- src/ZoneWriting/Writing/IZoneWriterFactory.h | 4 +- src/ZoneWriting/Writing/InMemoryZoneData.cpp | 2 +- src/ZoneWriting/Writing/InMemoryZoneData.h | 4 +- .../Writing/OutputStreamProcessor.cpp | 2 +- .../Processor/OutputProcessorDeflate.cpp | 14 +- .../Processor/OutputProcessorDeflate.h | 8 +- .../Processor/OutputProcessorXChunks.cpp | 8 +- .../Processor/OutputProcessorXChunks.h | 10 +- .../Writing/Steps/StepAddOutputProcessor.cpp | 3 +- .../Writing/Steps/StepAddOutputProcessor.h | 6 +- src/ZoneWriting/Writing/Steps/StepAlign.cpp | 2 +- src/ZoneWriting/Writing/Steps/StepAlign.h | 4 +- .../Writing/Steps/StepRemoveOutputProcessor.h | 2 +- .../Writing/Steps/StepWriteTimestamp.cpp | 4 +- .../Writing/Steps/StepWriteXBlockSizes.cpp | 2 +- .../Writing/Steps/StepWriteZero.cpp | 2 +- .../Steps/StepWriteZoneContentToFile.cpp | 2 +- .../Steps/StepWriteZoneContentToMemory.cpp | 5 +- .../Steps/StepWriteZoneContentToMemory.h | 6 +- src/ZoneWriting/Writing/WritingException.h | 6 +- src/ZoneWriting/Writing/WritingFileStream.h | 4 +- src/ZoneWriting/Writing/ZoneWriter.cpp | 6 +- src/ZoneWriting/Writing/ZoneWriter.h | 6 +- .../Zone/Stream/IZoneOutputStream.h | 25 +- .../Stream/Impl/InMemoryZoneOutputStream.cpp | 9 +- .../Stream/Impl/InMemoryZoneOutputStream.h | 8 +- src/ZoneWriting/ZoneWriting.cpp | 10 +- src/ZoneWriting/ZoneWriting.h | 8 +- .../ObjCommonTests/Image/ImageFormatTests.cpp | 25 +- test/ObjCommonTests/Obj/Gdt/GdtTests.cpp | 669 +++--- .../Game/IW4/Menu/MenuParsingIW4IT.cpp | 509 ++-- .../Mock/MockAssetLoadingManager.cpp | 53 +- .../Mock/MockAssetLoadingManager.h | 32 +- test/ObjLoadingTests/Mock/MockSearchPath.cpp | 16 +- test/ObjLoadingTests/Mock/MockSearchPath.h | 14 +- .../EventHandlerSetScopeSequencesTests.cpp | 698 +++--- .../Menu/Sequence/ItemScopeSequencesTests.cpp | 38 +- test/ParserTestUtils/Parsing/Mock/MockLexer.h | 19 +- .../Parsing/Mock/MockPackValueSupplier.h | 2 +- .../Parsing/Mock/MockParserLineStream.cpp | 10 +- .../Parsing/Mock/MockParserLineStream.h | 8 +- .../Parsing/Mock/MockSequence.h | 7 +- .../Impl/CommentRemovingStreamProxyTests.cpp | 56 +- .../Parsing/Impl/DefinesStreamProxyTests.cpp | 257 +- .../Impl/IncludingStreamProxyTests.cpp | 58 +- .../Impl/PackDefinitionStreamProxyTests.cpp | 17 +- .../Parsing/Simple/SimpleExpressionTests.cpp | 373 ++- .../Commands/Impl/CommandsLexerTests.cpp | 13 +- .../Commands/Sequence/SequenceActionTests.cpp | 272 +-- .../Sequence/SequenceArchitectureTests.cpp | 44 +- .../Commands/Sequence/SequenceGameTests.cpp | 20 +- .../Parsing/Header/Impl/HeaderLexerTests.cpp | 175 +- .../Sequence/SequenceNamespaceTests.cpp | 19 +- .../Parsing/Matcher/MatcherTests.cpp | 1034 ++++----- 1099 files changed, 16853 insertions(+), 18166 deletions(-) diff --git a/.clang-format b/.clang-format index db524b9f2..c54d15f42 100644 --- a/.clang-format +++ b/.clang-format @@ -17,9 +17,8 @@ IndentWidth: 4 IndentWrappedFunctionNames: true InsertNewlineAtEOF: true NamespaceIndentation: All -PackConstructorInitializers: CurrentLine +PackConstructorInitializers: Never PointerAlignment: Left SeparateDefinitionBlocks: Always SortUsingDeclarations: Lexicographic SpaceAfterTemplateKeyword: false -SpaceBeforeCpp11BracedList: true diff --git a/scripts/reformat-all.sh b/scripts/reformat-all.sh index 4717e1b7f..1ee9f1694 100755 --- a/scripts/reformat-all.sh +++ b/scripts/reformat-all.sh @@ -3,4 +3,4 @@ # Go to repository root cd "$(dirname "$0")/.." || exit 2 -find ./src ./test -iname '*.h' -o -iname '*.cpp' | xargs clang-format -i \ No newline at end of file +find ./src ./test -iname '*.h' -o -iname '*.cpp' | xargs clang-format --verbose -i \ No newline at end of file diff --git a/src/Common/Game/IGame.h b/src/Common/Game/IGame.h index eae862f7b..89251a794 100644 --- a/src/Common/Game/IGame.h +++ b/src/Common/Game/IGame.h @@ -1,7 +1,8 @@ #pragma once -#include #include "GameLanguage.h" +#include + class Zone; class IGame @@ -20,4 +21,4 @@ class IGame virtual void RemoveZone(Zone* zone) = 0; virtual std::vector GetZones() = 0; virtual std::vector GetLanguagePrefixes() = 0; -}; \ No newline at end of file +}; diff --git a/src/Common/Game/IW3/CommonIW3.h b/src/Common/Game/IW3/CommonIW3.h index 26e019f5b..068c1c6f6 100644 --- a/src/Common/Game/IW3/CommonIW3.h +++ b/src/Common/Game/IW3/CommonIW3.h @@ -10,7 +10,7 @@ namespace IW3 static constexpr uint32_t R_HashString(const char* string, const uint32_t hash) { const char* v2 = string; // edx@1 - char v3 = *string; // cl@1 + char v3 = *string; // cl@1 uint32_t result = hash; for (; *v2; v3 = *v2) @@ -28,4 +28,4 @@ namespace IW3 static void Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out); static void Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out); }; -} \ No newline at end of file +} // namespace IW3 diff --git a/src/Common/Game/IW3/GameIW3.cpp b/src/Common/Game/IW3/GameIW3.cpp index c9b69fe5f..295aada2e 100644 --- a/src/Common/Game/IW3/GameIW3.cpp +++ b/src/Common/Game/IW3/GameIW3.cpp @@ -1,9 +1,9 @@ #include "GameIW3.h" -#include - #include "IW3.h" +#include + using namespace IW3; GameIW3 g_GameIW3; diff --git a/src/Common/Game/IW3/GameIW3.h b/src/Common/Game/IW3/GameIW3.h index ec06f8c73..025533b93 100644 --- a/src/Common/Game/IW3/GameIW3.h +++ b/src/Common/Game/IW3/GameIW3.h @@ -14,4 +14,4 @@ class GameIW3 : public IGame std::vector GetLanguagePrefixes() override; }; -extern GameIW3 g_GameIW3; \ No newline at end of file +extern GameIW3 g_GameIW3; diff --git a/src/Common/Game/IW3/IW3.h b/src/Common/Game/IW3/IW3.h index 25ca8d08a..54f4bf724 100644 --- a/src/Common/Game/IW3/IW3.h +++ b/src/Common/Game/IW3/IW3.h @@ -1,10 +1,14 @@ #pragma once -//#include +// clang-format off: Order of includes matters here + +// #include #include "Image/Texture.h" #include "IW3_Assets.h" +// clang-format on + namespace IW3 { struct ScriptStringList @@ -79,4 +83,4 @@ namespace IW3 WFT_NUM_FIELD_TYPES }; -} \ No newline at end of file +} // namespace IW3 diff --git a/src/Common/Game/IW3/IW3_Assets.h b/src/Common/Game/IW3/IW3_Assets.h index a77230008..37fec0444 100644 --- a/src/Common/Game/IW3/IW3_Assets.h +++ b/src/Common/Game/IW3/IW3_Assets.h @@ -45,7 +45,7 @@ namespace IW3 ASSET_TYPE_RAWFILE = 0x1F, ASSET_TYPE_STRINGTABLE = 0x20, ASSET_TYPE_COUNT, - + ASSET_TYPE_STRING = ASSET_TYPE_COUNT, ASSET_TYPE_ASSETLIST, @@ -100,35 +100,35 @@ namespace IW3 union XAssetHeader { // XModelPieces *xmodelPieces; // NOT AN ASSET - PhysPreset *physPreset; - XAnimParts *parts; - XModel *model; - Material *material; - MaterialPixelShader *pixelShader; - MaterialVertexShader *vertexShader; - MaterialTechniqueSet *techniqueSet; - GfxImage *image; - snd_alias_list_t *sound; - SndCurve *sndCurve; - LoadedSound *loadSnd; - clipMap_t *clipMap; - ComWorld *comWorld; - GameWorldSp *gameWorldSp; - GameWorldMp *gameWorldMp; - MapEnts *mapEnts; - GfxWorld *gfxWorld; - GfxLightDef *lightDef; - Font_s *font; - MenuList *menuList; - menuDef_t *menu; - LocalizeEntry *localize; - WeaponDef *weapon; - SndDriverGlobals *sndDriverGlobals; - FxEffectDef *fx; - FxImpactTable *impactFx; - RawFile *rawfile; - StringTable *stringTable; - void *data; + PhysPreset* physPreset; + XAnimParts* parts; + XModel* model; + Material* material; + MaterialPixelShader* pixelShader; + MaterialVertexShader* vertexShader; + MaterialTechniqueSet* techniqueSet; + GfxImage* image; + snd_alias_list_t* sound; + SndCurve* sndCurve; + LoadedSound* loadSnd; + clipMap_t* clipMap; + ComWorld* comWorld; + GameWorldSp* gameWorldSp; + GameWorldMp* gameWorldMp; + MapEnts* mapEnts; + GfxWorld* gfxWorld; + GfxLightDef* lightDef; + Font_s* font; + MenuList* menuList; + menuDef_t* menu; + LocalizeEntry* localize; + WeaponDef* weapon; + SndDriverGlobals* sndDriverGlobals; + FxEffectDef* fx; + FxImpactTable* impactFx; + RawFile* rawfile; + StringTable* stringTable; + void* data; }; typedef char cbrushedge_t; @@ -142,7 +142,7 @@ namespace IW3 XModel* model; float offset[3]; }; - + struct XModelPieces { const char* name; @@ -152,14 +152,14 @@ namespace IW3 struct PhysPreset { - const char *name; + const char* name; int type; float mass; float bounce; float friction; float bulletForceScale; float explosiveForceScale; - const char *sndAliasPrefix; + const char* sndAliasPrefix; float piecesSpreadFraction; float piecesUpwardVelocity; bool tempDefaultToCylinder; @@ -224,7 +224,7 @@ namespace IW3 struct XAnimDeltaPartQuatDataFrames { - XQuat *frames; + XQuat* frames; XAnimDynamicIndicesQuat indices; }; @@ -371,7 +371,7 @@ namespace IW3 char zoneHandle; uint16_t baseTriIndex; uint16_t baseVertIndex; - r_index16_t(*triIndices)[3]; + r_index16_t (*triIndices)[3]; XSurfaceVertexInfo vertInfo; GfxPackedVertex* verts0; unsigned int vertListCount; @@ -485,8 +485,8 @@ namespace IW3 char lodRampType; uint16_t* boneNames; char* parentList; - int16_t(*quats)[4]; - float(*trans)[4]; + int16_t (*quats)[4]; + float (*trans)[4]; char* partClassification; DObjAnimMat* baseMat; XSurface* surfs; @@ -705,7 +705,7 @@ namespace IW3 char nameStart; char nameEnd; unsigned char samplerState; // SamplerStateBits_e - unsigned char semantic; // TextureSemantic + unsigned char semantic; // TextureSemantic MaterialTextureDefInfo u; }; @@ -820,7 +820,7 @@ namespace IW3 union MaterialArgumentDef { - const float(*literalConst)[4]; + const float (*literalConst)[4]; MaterialArgumentCodeConst codeConst; unsigned int codeSampler; unsigned int nameHash; @@ -1156,7 +1156,7 @@ namespace IW3 struct MaterialVertexStreamRouting { MaterialStreamRouting data[16]; - void/*IDirect3DVertexDeclaration9*/* decl[16]; + void /*IDirect3DVertexDeclaration9*/* decl[16]; }; struct MaterialVertexDeclaration @@ -1176,7 +1176,7 @@ namespace IW3 struct MaterialVertexShaderProgram { - void/*IDirect3DVertexShader9*/* vs; + void /*IDirect3DVertexShader9*/* vs; GfxVertexShaderLoadDef loadDef; }; @@ -1195,7 +1195,7 @@ namespace IW3 struct MaterialPixelShaderProgram { - void/*IDirect3DPixelShader9*/* ps; + void /*IDirect3DPixelShader9*/* ps; GfxPixelShaderLoadDef loadDef; }; @@ -1304,10 +1304,10 @@ namespace IW3 union GfxTexture { - //void/*IDirect3DBaseTexture9*/* basemap; - //void/*IDirect3DTexture9*/* map; - //void/*IDirect3DVolumeTexture9*/* volmap; - //void/*IDirect3DCubeTexture9*/* cubemap; + // void/*IDirect3DBaseTexture9*/* basemap; + // void/*IDirect3DTexture9*/* map; + // void/*IDirect3DVolumeTexture9*/* volmap; + // void/*IDirect3DCubeTexture9*/* cubemap; Texture* texture; GfxImageLoadDef* loadDef; }; @@ -1681,7 +1681,7 @@ namespace IW3 unsigned int numLeafSurfaces; unsigned int* leafsurfaces; unsigned int vertCount; - vec3_t *verts; + vec3_t* verts; int triCount; uint16_t* triIndices; char* triEdgeIsWalkable; @@ -1898,13 +1898,13 @@ namespace IW3 struct GfxWorldVertexData { GfxWorldVertex* vertices; - void/*IDirect3DVertexBuffer9*/* worldVb; + void /*IDirect3DVertexBuffer9*/* worldVb; }; struct GfxWorldVertexLayerData { char* data; - void/*IDirect3DVertexBuffer9*/* layerVb; + void /*IDirect3DVertexBuffer9*/* layerVb; }; struct SunLightParseParams @@ -1979,7 +1979,7 @@ namespace IW3 bool isAncestor; char recursionDepth; char hullPointCount; - float(*hullPoints)[2]; + float (*hullPoints)[2]; GfxPortal* queuedParent; }; @@ -3076,13 +3076,13 @@ namespace IW3 // TODO: Order is accuracyGraphName[0] -> originalAccuracyGraphKnots[0] -> accuracyGraphName[1] -> ... // Which is currently not possible to do in code generation. Afaik this is the only place where this is the case. // So might be something to fix but on the other hand it might be too much work for this little inconvenience. - //const char* accuracyGraphName[2]; + // const char* accuracyGraphName[2]; const char* accuracyGraphName0; const char* accuracyGraphName1; - //float(*accuracyGraphKnots[2])[2]; + // float(*accuracyGraphKnots[2])[2]; vec2_t* accuracyGraphKnots0; vec2_t* accuracyGraphKnots1; - //float(*originalAccuracyGraphKnots[2])[2]; + // float(*originalAccuracyGraphKnots[2])[2]; vec2_t* originalAccuracyGraphKnots0; vec2_t* originalAccuracyGraphKnots1; int accuracyGraphKnotCount[2]; diff --git a/src/Common/Game/IW4/CommonIW4.h b/src/Common/Game/IW4/CommonIW4.h index 9e8ceabaf..052875026 100644 --- a/src/Common/Game/IW4/CommonIW4.h +++ b/src/Common/Game/IW4/CommonIW4.h @@ -10,7 +10,7 @@ namespace IW4 static constexpr uint32_t R_HashString(const char* string, const uint32_t hash) { const char* v2 = string; // edx@1 - char v3 = *string; // cl@1 + char v3 = *string; // cl@1 uint32_t result = hash; for (; *v2; v3 = *v2) @@ -35,4 +35,4 @@ namespace IW4 static void Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out); static void Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out); }; -} +} // namespace IW4 diff --git a/src/Common/Game/IW4/GameIW4.cpp b/src/Common/Game/IW4/GameIW4.cpp index 76d225217..4ff26b6d8 100644 --- a/src/Common/Game/IW4/GameIW4.cpp +++ b/src/Common/Game/IW4/GameIW4.cpp @@ -1,9 +1,9 @@ #include "GameIW4.h" -#include - #include "IW4.h" +#include + using namespace IW4; GameIW4 g_GameIW4; diff --git a/src/Common/Game/IW4/GameIW4.h b/src/Common/Game/IW4/GameIW4.h index 26a9b79e2..5e70acd59 100644 --- a/src/Common/Game/IW4/GameIW4.h +++ b/src/Common/Game/IW4/GameIW4.h @@ -14,4 +14,4 @@ class GameIW4 : public IGame std::vector GetLanguagePrefixes() override; }; -extern GameIW4 g_GameIW4; \ No newline at end of file +extern GameIW4 g_GameIW4; diff --git a/src/Common/Game/IW4/IW4.h b/src/Common/Game/IW4/IW4.h index eaf14151f..3e9130ef4 100644 --- a/src/Common/Game/IW4/IW4.h +++ b/src/Common/Game/IW4/IW4.h @@ -1,10 +1,14 @@ #pragma once -//#include +// clang-format off: Order of includes matters here + +// #include #include "Image/Texture.h" #include "IW4_Assets.h" +// clang-format on + namespace IW4 { struct DB_AuthHash @@ -26,11 +30,11 @@ namespace IW4 struct DB_AuthHeader { - char magic[8]; // + 0 - unsigned int reserved; // + 8 - DB_AuthHash subheaderHash; // + 12 - DB_AuthSignature signedSubheaderHash; // + 44 - DB_AuthSubHeader subheader; // + 300 + char magic[8]; // + 0 + unsigned int reserved; // + 8 + DB_AuthHash subheaderHash; // + 12 + DB_AuthSignature signedSubheaderHash; // + 44 + DB_AuthSubHeader subheader; // + 300 }; struct ScriptStringList @@ -122,4 +126,4 @@ namespace IW4 VFT_NUM, }; -} \ No newline at end of file +} // namespace IW4 diff --git a/src/Common/Game/IW4/IW4_Assets.h b/src/Common/Game/IW4/IW4_Assets.h index aa8243c28..7714dd0af 100644 --- a/src/Common/Game/IW4/IW4_Assets.h +++ b/src/Common/Game/IW4/IW4_Assets.h @@ -571,8 +571,8 @@ namespace IW4 unsigned int noScalePartBits[6]; uint16_t* boneNames; unsigned char* parentList; - int16_t(*quats)[4]; - float(*trans)[3]; + int16_t (*quats)[4]; + float (*trans)[3]; unsigned char* partClassification; DObjAnimMat* baseMat; Material** materialHandles; @@ -669,7 +669,7 @@ namespace IW4 char nameStart; char nameEnd; unsigned char samplerState; // SamplerStateBits_e - unsigned char semantic; // TextureSemantic + unsigned char semantic; // TextureSemantic MaterialTextureDefInfo u; }; @@ -878,13 +878,13 @@ namespace IW4 SORTKEY_TRANS_START = 6, - SORTKEY_DECAL_BOTTOM_1 = 6, // prob decal - bottom 1 - SORTKEY_DECAL_BOTTOM_2 = 7, // prob decal - bottom 2 - SORTKEY_DECAL_BOTTOM_3 = 8, // prob decal - bottom 3 - SORTKEY_DECAL_STATIC_DECAL = 9, // prob decal - static decal - SORTKEY_DECAL_MIDDLE_1 = 10, // prob decal - middle 1 - SORTKEY_DECAL_MIDDLE_2 = 11, // prob decal - middle 2 - SORTKEY_DECAL_MIDDLE_3 = 12, // prob decal - middle 3 + SORTKEY_DECAL_BOTTOM_1 = 6, // prob decal - bottom 1 + SORTKEY_DECAL_BOTTOM_2 = 7, // prob decal - bottom 2 + SORTKEY_DECAL_BOTTOM_3 = 8, // prob decal - bottom 3 + SORTKEY_DECAL_STATIC_DECAL = 9, // prob decal - static decal + SORTKEY_DECAL_MIDDLE_1 = 10, // prob decal - middle 1 + SORTKEY_DECAL_MIDDLE_2 = 11, // prob decal - middle 2 + SORTKEY_DECAL_MIDDLE_3 = 12, // prob decal - middle 3 SORTKEY_DECAL_WEAPON_IMPACT = 13, // prob decal - weapon impact // ? = 14, // prob decal - top 1 // some decal = 15, // prob decal - top 2 or decal - top 3 @@ -896,7 +896,7 @@ namespace IW4 // ? = 21, // - = 22, // - = 23, - SORTKEY_WINDOW_INSIDE = 24, // prob window inside + SORTKEY_WINDOW_INSIDE = 24, // prob window inside SORTKEY_WINDOW_OUTSIDE = 25, // prob window outside // ? = 26, // includes motiontracker3d, impact fx, atmos // ? = 27, @@ -919,11 +919,11 @@ namespace IW4 // ? = 44, // ? = 45, // - = 46, - SORTKEY_BLEND_ADDITIVE = 47, // most likely blend / additive + SORTKEY_BLEND_ADDITIVE = 47, // most likely blend / additive SORTKEY_EFFECT_AUTO_SORT = 48, // most likely effect - auto sort SORTKEY_AFTER_EFFECTS_BOTTOM = 49, SORTKEY_AFTER_EFFECTS_MIDDLE = 50, // prob after effects - middle - SORTKEY_AFTER_EFFECTS_TOP = 51, // prob after effects - top + SORTKEY_AFTER_EFFECTS_TOP = 51, // prob after effects - top // - = 52, SORTKEY_VIEWMODEL_EFFECT = 53, // maybe viewmodel effect @@ -1087,7 +1087,7 @@ namespace IW4 STREAM_SRC_COUNT }; - + enum MaterialStreamDestination_e { STREAM_DST_POSITION = 0x0, @@ -1116,7 +1116,7 @@ namespace IW4 struct MaterialVertexStreamRouting { MaterialStreamRouting data[13]; - void/*IDirect3DVertexDeclaration9*/* decl[16]; + void /*IDirect3DVertexDeclaration9*/* decl[16]; }; struct MaterialVertexDeclaration @@ -1129,7 +1129,7 @@ namespace IW4 struct MaterialVertexShaderProgram { - void/*IDirect3DVertexShader9*/* vs; + void /*IDirect3DVertexShader9*/* vs; GfxVertexShaderLoadDef loadDef; }; @@ -1141,7 +1141,7 @@ namespace IW4 struct MaterialPixelShaderProgram { - void/*IDirect3DPixelShader9*/* ps; + void /*IDirect3DPixelShader9*/* ps; GfxPixelShaderLoadDef loadDef; }; @@ -1205,11 +1205,11 @@ namespace IW4 enum MaterialType { MTL_TYPE_DEFAULT = 0x0, - MTL_TYPE_MODEL = 0x1, // m_ - MTL_TYPE_MODEL_VERTCOL = 0x2, // mc_ + MTL_TYPE_MODEL = 0x1, // m_ + MTL_TYPE_MODEL_VERTCOL = 0x2, // mc_ MTL_TYPE_MODEL_VERTCOL_GREY = 0x3, // mg_ - MTL_TYPE_WORLD = 0x4, // w_ - MTL_TYPE_WORLD_VERTCOL = 0x5, // wc_ + MTL_TYPE_WORLD = 0x4, // w_ + MTL_TYPE_WORLD_VERTCOL = 0x5, // wc_ MTL_TYPE_COUNT, }; @@ -1409,20 +1409,20 @@ namespace IW4 enum MaterialShaderArgumentType { - MTL_ARG_MATERIAL_VERTEX_CONST = 0x0, // stable - MTL_ARG_LITERAL_VERTEX_CONST = 0x1, // stable + MTL_ARG_MATERIAL_VERTEX_CONST = 0x0, // stable + MTL_ARG_LITERAL_VERTEX_CONST = 0x1, // stable MTL_ARG_MATERIAL_PIXEL_SAMPLER = 0x2, // stable MTL_ARG_CODE_PRIM_BEGIN = 0x3, - MTL_ARG_CODE_VERTEX_CONST = 0x3, // stable object prim + MTL_ARG_CODE_VERTEX_CONST = 0x3, // stable object prim MTL_ARG_CODE_PIXEL_SAMPLER = 0x4, // stable object - MTL_ARG_CODE_PIXEL_CONST = 0x5, // stable + MTL_ARG_CODE_PIXEL_CONST = 0x5, // stable MTL_ARG_CODE_PRIM_END = 0x6, MTL_ARG_MATERIAL_PIXEL_CONST = 0x6, // stable - MTL_ARG_LITERAL_PIXEL_CONST = 0x7, // stable + MTL_ARG_LITERAL_PIXEL_CONST = 0x7, // stable MTL_ARG_COUNT }; @@ -1457,14 +1457,15 @@ namespace IW4 enum TechniqueFlags { // Guesses purely based on data analysis: - TECHNIQUE_FLAG_1 = 0x1, // uses resolvedPostSun code sampler // MTL_TECHFLAG_NEEDS_RESOLVED_POST_SUN - TECHNIQUE_FLAG_2 = 0x2, // uses resolvedScene code sampler MTL_TECHFLAG_NEEDS_RESOLVED_SCENE - TECHNIQUE_FLAG_4 = 0x4, // zprepass only - TECHNIQUE_FLAG_8 = 0x8, // build_floatz only + TECHNIQUE_FLAG_1 = 0x1, // uses resolvedPostSun code sampler // MTL_TECHFLAG_NEEDS_RESOLVED_POST_SUN + TECHNIQUE_FLAG_2 = 0x2, // uses resolvedScene code sampler MTL_TECHFLAG_NEEDS_RESOLVED_SCENE + TECHNIQUE_FLAG_4 = 0x4, // zprepass only + TECHNIQUE_FLAG_8 = 0x8, // build_floatz only TECHNIQUE_FLAG_10 = 0x10, // build_shadowmap_depth + build_shadowmap_model only - TECHNIQUE_FLAG_20 = 0x20, // techniques with _i_ in its name (all use texcoord[1] in decl -> other optional stream sources are not used at all so might be any optional) - TECHNIQUE_FLAG_40 = 0x40, // uses code constant light.spotDir or light.spotFactors - TECHNIQUE_FLAG_80 = 0x80, // uses floatZ sampler and does not have 0x100 flag + TECHNIQUE_FLAG_20 = + 0x20, // techniques with _i_ in its name (all use texcoord[1] in decl -> other optional stream sources are not used at all so might be any optional) + TECHNIQUE_FLAG_40 = 0x40, // uses code constant light.spotDir or light.spotFactors + TECHNIQUE_FLAG_80 = 0x80, // uses floatZ sampler and does not have 0x100 flag TECHNIQUE_FLAG_100 = 0x100, // distortion_scale_zfeather_dtex + distortion_scale_ua_zfeather + distortion_scale_zfeather TECHNIQUE_FLAG_200 = 0x200, // ? }; @@ -1758,7 +1759,7 @@ namespace IW4 DvarValue latched; DvarValue reset; DvarLimits domain; - //bool (__cdecl* domainFunc)(dvar_t*, DvarValue); + // bool (__cdecl* domainFunc)(dvar_t*, DvarValue); void* domainFunc; dvar_t* hashNext; }; @@ -3065,11 +3066,13 @@ namespace IW4 float fAngle; float forward[2]; float fRadius; + union { float minUseDistSq; PathNodeErrorCode error; }; + int16_t wOverlapNode[2]; uint16_t totalLinkCount; pathlink_s* Links; @@ -3097,6 +3100,7 @@ namespace IW4 pathnode_t* pParent; float fCost; float fHeuristic; + union { float nodeCost; @@ -3259,6 +3263,7 @@ namespace IW4 FxSpatialFrame frame; float radius; }; + unsigned int nextFree; }; @@ -3417,7 +3422,7 @@ namespace IW4 bool isAncestor; char recursionDepth; char hullPointCount; - float(*hullPoints)[2]; + float (*hullPoints)[2]; GfxPortal* queuedParent; }; @@ -3470,13 +3475,13 @@ namespace IW4 struct GfxWorldVertexData { GfxWorldVertex* vertices; - void/*IDirect3DVertexBuffer9*/* worldVb; + void /*IDirect3DVertexBuffer9*/* worldVb; }; struct GfxWorldVertexLayerData { char* data; - void/*IDirect3DVertexBuffer9*/* layerVb; + void /*IDirect3DVertexBuffer9*/* layerVb; }; struct GfxWorldDraw @@ -3757,7 +3762,7 @@ namespace IW4 unsigned int sortKeyEffectAuto; unsigned int sortKeyDistortion; GfxWorldDpvsPlanes dpvsPlanes; - int/*GfxCellTreeCount*/* aabbTreeCounts; + int /*GfxCellTreeCount*/* aabbTreeCounts; GfxCellTree128* aabbTrees; GfxCell* cells; GfxWorldDraw draw; @@ -4639,7 +4644,6 @@ namespace IW4 VEH_TYPE_COUNT = 0x7, }; - struct VehicleDef { const char* name; diff --git a/src/Common/Game/IW5/CommonIW5.cpp b/src/Common/Game/IW5/CommonIW5.cpp index de2fc41e6..ee552be2c 100644 --- a/src/Common/Game/IW5/CommonIW5.cpp +++ b/src/Common/Game/IW5/CommonIW5.cpp @@ -22,17 +22,17 @@ int Common::StringTable_HashString(const char* str) PackedTexCoords Common::Vec2PackTexCoords(const vec2_t* in) { - return PackedTexCoords{ Pack32::Vec2PackTexCoords(reinterpret_cast(in)) }; + return PackedTexCoords{Pack32::Vec2PackTexCoords(reinterpret_cast(in))}; } PackedUnitVec Common::Vec3PackUnitVec(const vec3_t* in) { - return PackedUnitVec{ Pack32::Vec3PackUnitVec(reinterpret_cast(in)) }; + return PackedUnitVec{Pack32::Vec3PackUnitVec(reinterpret_cast(in))}; } GfxColor Common::Vec4PackGfxColor(const vec4_t* in) { - return GfxColor{ Pack32::Vec4PackGfxColor(reinterpret_cast(in)) }; + return GfxColor{Pack32::Vec4PackGfxColor(reinterpret_cast(in))}; } void Common::Vec2UnpackTexCoords(const PackedTexCoords& in, vec2_t* out) diff --git a/src/Common/Game/IW5/CommonIW5.h b/src/Common/Game/IW5/CommonIW5.h index 818c50662..7e12cc389 100644 --- a/src/Common/Game/IW5/CommonIW5.h +++ b/src/Common/Game/IW5/CommonIW5.h @@ -16,4 +16,4 @@ namespace IW5 static void Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out); static void Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out); }; -} +} // namespace IW5 diff --git a/src/Common/Game/IW5/GameIW5.cpp b/src/Common/Game/IW5/GameIW5.cpp index 5ff784906..a73a1b8c4 100644 --- a/src/Common/Game/IW5/GameIW5.cpp +++ b/src/Common/Game/IW5/GameIW5.cpp @@ -1,9 +1,9 @@ #include "GameIW5.h" -#include - #include "IW5.h" +#include + using namespace IW5; GameIW5 g_GameIW5; diff --git a/src/Common/Game/IW5/GameIW5.h b/src/Common/Game/IW5/GameIW5.h index 57b942fa0..bebf3bbd8 100644 --- a/src/Common/Game/IW5/GameIW5.h +++ b/src/Common/Game/IW5/GameIW5.h @@ -14,4 +14,4 @@ class GameIW5 : public IGame std::vector GetLanguagePrefixes() override; }; -extern GameIW5 g_GameIW5; \ No newline at end of file +extern GameIW5 g_GameIW5; diff --git a/src/Common/Game/IW5/IW5.h b/src/Common/Game/IW5/IW5.h index 727ea2a04..c6ef6e71c 100644 --- a/src/Common/Game/IW5/IW5.h +++ b/src/Common/Game/IW5/IW5.h @@ -1,10 +1,14 @@ #pragma once -//#include +// clang-format off: Order of includes matters here + +// #include #include "Image/Texture.h" #include "IW5_Assets.h" +// clang-format on + namespace IW5 { struct DB_AuthHash @@ -26,11 +30,11 @@ namespace IW5 struct DB_AuthHeader { - char magic[8]; // + 0 - unsigned int reserved; // + 8 - DB_AuthHash subheaderHash; // + 12 - DB_AuthSignature signedSubheaderHash; // + 44 - DB_AuthSubHeader subheader; // + 300 + char magic[8]; // + 0 + unsigned int reserved; // + 8 + DB_AuthHash subheaderHash; // + 12 + DB_AuthSignature signedSubheaderHash; // + 44 + DB_AuthSubHeader subheader; // + 300 }; struct ScriptStringList @@ -79,4 +83,4 @@ namespace IW5 CSPFT_NUM_BASE_FIELD_TYPES, }; -} \ No newline at end of file +} // namespace IW5 diff --git a/src/Common/Game/IW5/IW5_Assets.h b/src/Common/Game/IW5/IW5_Assets.h index 9b073b0d2..6c5bbdec3 100644 --- a/src/Common/Game/IW5/IW5_Assets.h +++ b/src/Common/Game/IW5/IW5_Assets.h @@ -536,7 +536,7 @@ namespace IW5 uint16_t baseTriIndex; uint16_t baseVertIndex; float quantizeScale; - r_index16_t(*triIndices)[3]; + r_index16_t (*triIndices)[3]; XSurfaceVertexInfo vertInfo; GfxVertexUnion0 verts0; unsigned int vertListCount; @@ -606,8 +606,8 @@ namespace IW5 unsigned int noScalePartBits[6]; ScriptString* boneNames; unsigned char* parentList; - short(*quats)[4]; - float(*trans)[3]; + short (*quats)[4]; + float (*trans)[3]; unsigned char* partClassification; DObjAnimMat* baseMat; Material** materialHandles; @@ -802,13 +802,13 @@ namespace IW5 char source; char dest; }; - + struct MaterialVertexStreamRouting { MaterialStreamRouting data[13]; void* decl[16]; }; - + struct MaterialVertexDeclaration { const char* name; @@ -843,7 +843,7 @@ namespace IW5 union MaterialArgumentDef { - const float(*literalConst)[4]; + const float (*literalConst)[4]; MaterialArgumentCodeConst codeConst; unsigned int codeSampler; unsigned int nameHash; @@ -1507,6 +1507,7 @@ namespace IW5 pathnode_t* pParent; float fCost; float fHeuristic; + union { float nodeCost; @@ -1659,6 +1660,7 @@ namespace IW5 FxSpatialFrame frame; float radius; }; + unsigned int nextFree; }; @@ -1817,7 +1819,7 @@ namespace IW5 bool isAncestor; unsigned char recursionDepth; unsigned char hullPointCount; - float(*hullPoints)[2]; + float (*hullPoints)[2]; GfxPortal* queuedParent; }; @@ -2173,7 +2175,7 @@ namespace IW5 unsigned int sortKeyEffectAuto; unsigned int sortKeyDistortion; GfxWorldDpvsPlanes dpvsPlanes; - int/*GfxCellTreeCount*/* aabbTreeCounts; + int /*GfxCellTreeCount*/* aabbTreeCounts; GfxCellTree128* aabbTrees; GfxCell* cells; GfxWorldDraw draw; @@ -2569,8 +2571,8 @@ namespace IW5 WINDOW_FLAG_POPUP = 0x1000000, WINDOW_FLAG_LEGACY_SPLIT_SCREEN_SCALE = 0x4000000, WINDOW_FLAG_HIDDEN_DURING_FLASH_BANG = 0x10000000, // confirmed - WINDOW_FLAG_HIDDEN_DURING_SCOPE = 0x20000000, // confirmed - WINDOW_FLAG_HIDDEN_DURING_UI = 0x40000000, // confirmed + WINDOW_FLAG_HIDDEN_DURING_SCOPE = 0x20000000, // confirmed + WINDOW_FLAG_HIDDEN_DURING_UI = 0x40000000, // confirmed WINDOW_FLAG_TEXT_ONLY_FOCUS = 0x80000000, }; diff --git a/src/Common/Game/T5/CommonT5.cpp b/src/Common/Game/T5/CommonT5.cpp index 48e76a1b8..313843f20 100644 --- a/src/Common/Game/T5/CommonT5.cpp +++ b/src/Common/Game/T5/CommonT5.cpp @@ -1,9 +1,9 @@ #include "CommonT5.h" -#include - #include "Utils/Pack.h" +#include + using namespace T5; int Common::Com_HashKey(const char* str, const int maxLen) diff --git a/src/Common/Game/T5/CommonT5.h b/src/Common/Game/T5/CommonT5.h index 2f431858e..1be8add54 100644 --- a/src/Common/Game/T5/CommonT5.h +++ b/src/Common/Game/T5/CommonT5.h @@ -18,4 +18,4 @@ namespace T5 static void Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out); static void Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out); }; -} \ No newline at end of file +} // namespace T5 diff --git a/src/Common/Game/T5/GameT5.cpp b/src/Common/Game/T5/GameT5.cpp index a0c6edcc8..cf3639277 100644 --- a/src/Common/Game/T5/GameT5.cpp +++ b/src/Common/Game/T5/GameT5.cpp @@ -1,9 +1,9 @@ #include "GameT5.h" -#include - #include "T5.h" +#include + using namespace T5; GameT5 g_GameT5; diff --git a/src/Common/Game/T5/GameT5.h b/src/Common/Game/T5/GameT5.h index 4efd025dd..890e7c81a 100644 --- a/src/Common/Game/T5/GameT5.h +++ b/src/Common/Game/T5/GameT5.h @@ -14,4 +14,4 @@ class GameT5 : public IGame std::vector GetLanguagePrefixes() override; }; -extern GameT5 g_GameT5; \ No newline at end of file +extern GameT5 g_GameT5; diff --git a/src/Common/Game/T5/T5.h b/src/Common/Game/T5/T5.h index 512458e35..a6d7328b4 100644 --- a/src/Common/Game/T5/T5.h +++ b/src/Common/Game/T5/T5.h @@ -1,10 +1,14 @@ #pragma once -//#include +// clang-format off: Order of includes matters here + +// #include #include "Image/Texture.h" #include "T5_Assets.h" +// clang-format on + namespace T5 { struct ScriptStringList @@ -110,4 +114,4 @@ namespace T5 CFT_NUM_FIELD_TYPES }; -} +} // namespace T5 diff --git a/src/Common/Game/T5/T5_Assets.h b/src/Common/Game/T5/T5_Assets.h index 35c9eba80..42166cea4 100644 --- a/src/Common/Game/T5/T5_Assets.h +++ b/src/Common/Game/T5/T5_Assets.h @@ -114,43 +114,43 @@ namespace T5 union XAssetHeader { - //XModelPieces *xmodelPieces; // Not an asset - PhysPreset *physPreset; - PhysConstraints *physConstraints; - DestructibleDef *destructibleDef; - XAnimParts *parts; - XModel *model; - Material *material; - //MaterialPixelShader *pixelShader; // Not an asset - //MaterialVertexShader *vertexShader; // Not an asset - MaterialTechniqueSet *techniqueSet; - GfxImage *image; - SndBank *sound; - SndPatch *soundPatch; - clipMap_t *clipMap; - ComWorld *comWorld; - GameWorldSp *gameWorldSp; - GameWorldMp *gameWorldMp; - MapEnts *mapEnts; - GfxWorld *gfxWorld; - GfxLightDef *lightDef; - Font_s *font; - MenuList *menuList; - menuDef_t *menu; - LocalizeEntry *localize; - WeaponVariantDef *weapon; - SndDriverGlobals *sndDriverGlobals; - FxEffectDef *fx; - FxImpactTable *impactFx; - RawFile *rawfile; - StringTable *stringTable; - PackIndex *packIndex; - XGlobals *xGlobals; - ddlRoot_t *ddlRoot; - Glasses *glasses; - //TextureList *textureList; // Not an asset - EmblemSet *emblemSet; - void *data; + // XModelPieces *xmodelPieces; // Not an asset + PhysPreset* physPreset; + PhysConstraints* physConstraints; + DestructibleDef* destructibleDef; + XAnimParts* parts; + XModel* model; + Material* material; + // MaterialPixelShader *pixelShader; // Not an asset + // MaterialVertexShader *vertexShader; // Not an asset + MaterialTechniqueSet* techniqueSet; + GfxImage* image; + SndBank* sound; + SndPatch* soundPatch; + clipMap_t* clipMap; + ComWorld* comWorld; + GameWorldSp* gameWorldSp; + GameWorldMp* gameWorldMp; + MapEnts* mapEnts; + GfxWorld* gfxWorld; + GfxLightDef* lightDef; + Font_s* font; + MenuList* menuList; + menuDef_t* menu; + LocalizeEntry* localize; + WeaponVariantDef* weapon; + SndDriverGlobals* sndDriverGlobals; + FxEffectDef* fx; + FxImpactTable* impactFx; + RawFile* rawfile; + StringTable* stringTable; + PackIndex* packIndex; + XGlobals* xGlobals; + ddlRoot_t* ddlRoot; + Glasses* glasses; + // TextureList *textureList; // Not an asset + EmblemSet* emblemSet; + void* data; }; typedef tdef_align(16) char char16; @@ -508,12 +508,12 @@ namespace T5 uint16_t triCount; uint16_t baseTriIndex; uint16_t baseVertIndex; - r_index16_t(*triIndices)[3]; + r_index16_t (*triIndices)[3]; XSurfaceVertexInfo vertInfo; GfxPackedVertex* verts0; - void/*IDirect3DVertexBuffer9*/* vb0; + void /*IDirect3DVertexBuffer9*/* vb0; XRigidVertList* vertList; - void/*IDirect3DIndexBuffer9*/* indexBuffer; + void /*IDirect3DIndexBuffer9*/* indexBuffer; int partBits[5]; }; @@ -628,8 +628,8 @@ namespace T5 char lodRampType; uint16_t* boneNames; char* parentList; - int16_t(*quats)[4]; - float(*trans)[4]; + int16_t (*quats)[4]; + float (*trans)[4]; char* partClassification; DObjAnimMat* baseMat; XSurface* surfs; @@ -837,7 +837,7 @@ namespace T5 struct MaterialVertexStreamRouting { MaterialStreamRouting data[16]; - void/*IDirect3DVertexDeclaration9*/* decl[18]; + void /*IDirect3DVertexDeclaration9*/* decl[18]; }; struct MaterialVertexDeclaration @@ -856,7 +856,7 @@ namespace T5 struct MaterialVertexShaderProgram { - void/*IDirect3DVertexShader9*/* vs; + void /*IDirect3DVertexShader9*/* vs; GfxVertexShaderLoadDef loadDef; }; @@ -874,7 +874,7 @@ namespace T5 struct MaterialPixelShaderProgram { - void/*IDirect3DPixelShader9*/* ps; + void /*IDirect3DPixelShader9*/* ps; GfxPixelShaderLoadDef loadDef; }; @@ -893,7 +893,7 @@ namespace T5 union MaterialArgumentDef { - const float(*literalConst)[4]; + const float (*literalConst)[4]; MaterialArgumentCodeConst codeConst; unsigned int codeSampler; unsigned int nameHash; @@ -1963,7 +1963,7 @@ namespace T5 bool isAncestor; char recursionDepth; char hullPointCount; - float(*hullPoints)[2]; + float (*hullPoints)[2]; GfxPortal* queuedParent; }; @@ -2040,17 +2040,17 @@ namespace T5 PackedUnitVec normal; PackedUnitVec tangent; }; - + struct GfxWorldVertexData { GfxWorldVertex* vertices; - void/*IDirect3DVertexBuffer9*/* worldVb; + void /*IDirect3DVertexBuffer9*/* worldVb; }; struct GfxWorldVertexLayerData { char* data; - void/*IDirect3DVertexBuffer9*/* layerVb; + void /*IDirect3DVertexBuffer9*/* layerVb; }; struct GfxWorldDraw @@ -3861,15 +3861,16 @@ namespace T5 float fHipViewScatterMax; float fightDist; float maxDist; - //const char *accuracyGraphName[2]; // TODO: Order is accuracyGraphName[0] -> accuracyGraphKnots[0] -> originalAccuracyGraphKnots[0] -> accuracyGraphName[1] -> ... - // Which is currently not possible to do in code generation. Afaik this is the only place where this is the case. - // So might be something to fix but on the other hand it might be too much work for this little inconvenience. + // const char *accuracyGraphName[2]; // TODO: Order is accuracyGraphName[0] -> accuracyGraphKnots[0] -> originalAccuracyGraphKnots[0] -> + // accuracyGraphName[1] -> ... + // Which is currently not possible to do in code generation. Afaik this is the only place where this is the case. + // So might be something to fix but on the other hand it might be too much work for this little inconvenience. const char* accuracyGraphName0; const char* accuracyGraphName1; - //vec2_t *accuracyGraphKnots[2]; + // vec2_t *accuracyGraphKnots[2]; vec2_t* accuracyGraphKnots0; vec2_t* accuracyGraphKnots1; - //vec2_t *originalAccuracyGraphKnots[2]; + // vec2_t *originalAccuracyGraphKnots[2]; vec2_t* originalAccuracyGraphKnots0; vec2_t* originalAccuracyGraphKnots1; int accuracyGraphKnotCount[2]; diff --git a/src/Common/Game/T6/CommonT6.cpp b/src/Common/Game/T6/CommonT6.cpp index d2ea35779..31d0d6566 100644 --- a/src/Common/Game/T6/CommonT6.cpp +++ b/src/Common/Game/T6/CommonT6.cpp @@ -1,9 +1,9 @@ #include "CommonT6.h" -#include - #include "Utils/Pack.h" +#include + using namespace T6; int Common::Com_HashKey(const char* str, const int maxLen) @@ -30,7 +30,7 @@ int Common::Com_HashString(const char* str) auto result = 0x1505; auto offset = 0; - while(str[offset]) + while (str[offset]) { const auto c = tolower(str[offset++]); result = c + 33 * result; @@ -46,7 +46,7 @@ int Common::Com_HashString(const char* str, const int len) int result = 0x1505; int offset = 0; - while(str[offset]) + while (str[offset]) { if (len > 0 && offset >= len) break; @@ -70,17 +70,17 @@ uint32_t Common::R_HashString(const char* str, uint32_t hash) PackedTexCoords Common::Vec2PackTexCoords(const vec2_t* in) { - return PackedTexCoords{ Pack32::Vec2PackTexCoords(in->v) }; + return PackedTexCoords{Pack32::Vec2PackTexCoords(in->v)}; } PackedUnitVec Common::Vec3PackUnitVec(const vec3_t* in) { - return PackedUnitVec{ Pack32::Vec3PackUnitVec(in->v) }; + return PackedUnitVec{Pack32::Vec3PackUnitVec(in->v)}; } GfxColor Common::Vec4PackGfxColor(const vec4_t* in) { - return GfxColor{ Pack32::Vec4PackGfxColor(in->v) }; + return GfxColor{Pack32::Vec4PackGfxColor(in->v)}; } void Common::Vec2UnpackTexCoords(const PackedTexCoords& in, vec2_t* out) @@ -96,4 +96,4 @@ void Common::Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out) void Common::Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out) { Pack32::Vec4UnpackGfxColor(in.packed, out->v); -} \ No newline at end of file +} diff --git a/src/Common/Game/T6/CommonT6.h b/src/Common/Game/T6/CommonT6.h index 2c63c62e0..78ac76f6d 100644 --- a/src/Common/Game/T6/CommonT6.h +++ b/src/Common/Game/T6/CommonT6.h @@ -19,4 +19,4 @@ namespace T6 static void Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out); static void Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out); }; -} \ No newline at end of file +} // namespace T6 diff --git a/src/Common/Game/T6/GameT6.cpp b/src/Common/Game/T6/GameT6.cpp index e81f1552f..42c66b9a1 100644 --- a/src/Common/Game/T6/GameT6.cpp +++ b/src/Common/Game/T6/GameT6.cpp @@ -1,9 +1,9 @@ #include "GameT6.h" -#include - #include "T6.h" +#include + using namespace T6; GameT6 g_GameT6; diff --git a/src/Common/Game/T6/GameT6.h b/src/Common/Game/T6/GameT6.h index 60ce25d10..56bdf23bd 100644 --- a/src/Common/Game/T6/GameT6.h +++ b/src/Common/Game/T6/GameT6.h @@ -14,4 +14,4 @@ class GameT6 : public IGame std::vector GetLanguagePrefixes() override; }; -extern GameT6 g_GameT6; \ No newline at end of file +extern GameT6 g_GameT6; diff --git a/src/Common/Game/T6/T6.h b/src/Common/Game/T6/T6.h index 38cc82623..24e55e2a6 100644 --- a/src/Common/Game/T6/T6.h +++ b/src/Common/Game/T6/T6.h @@ -1,10 +1,14 @@ #pragma once -//#include +// clang-format off: Order of includes matters here + +// #include #include "Image/Texture.h" #include "T6_Assets.h" +// clang-format on + namespace T6 { struct ScriptStringList @@ -149,4 +153,4 @@ namespace T6 AUFT_NUM_FIELD_TYPES, }; -} +} // namespace T6 diff --git a/src/Common/Game/T6/T6_Assets.h b/src/Common/Game/T6/T6_Assets.h index 0f839ca8a..410d12d2c 100644 --- a/src/Common/Game/T6/T6_Assets.h +++ b/src/Common/Game/T6/T6_Assets.h @@ -317,18 +317,17 @@ namespace T6 MAX_XFILE_COUNT, }; - union XAssetHeader { - //XModelPieces *xmodelPieces; // Not an asset + // XModelPieces *xmodelPieces; // Not an asset PhysPreset* physPreset; PhysConstraints* physConstraints; DestructibleDef* destructibleDef; XAnimParts* parts; XModel* model; Material* material; - //MaterialPixelShader *pixelShader; // Not an asset - //MaterialVertexShader *vertexShader; // Not an asset + // MaterialPixelShader *pixelShader; // Not an asset + // MaterialVertexShader *vertexShader; // Not an asset MaterialTechniqueSet* techniqueSet; GfxImage* image; SndBank* sound; @@ -358,7 +357,7 @@ namespace T6 XGlobals* xGlobals; ddlRoot_t* ddlRoot; Glasses* glasses; - //TextureList *textureList; // Does not exist in this game + // TextureList *textureList; // Does not exist in this game EmblemSet* emblemSet; ScriptParseTree* scriptParseTree; KeyValuePairs* keyValuePairs; @@ -462,7 +461,6 @@ namespace T6 vec3_t buoyancyBoxMax; }; - enum ConstraintType { CONSTRAINT_NONE = 0x0, @@ -478,7 +476,6 @@ namespace T6 NUM_CONSTRAINT_TYPES = 0xA, }; - enum AttachPointType { ATTACH_POINT_WORLD = 0x0, @@ -487,7 +484,6 @@ namespace T6 ATTACH_POINT_BONE = 0x3, }; - struct PhysConstraint { uint16_t targetname; @@ -521,7 +517,6 @@ namespace T6 int centity_num[4]; }; - struct PhysConstraints { const char* name; @@ -529,7 +524,6 @@ namespace T6 PhysConstraint data[16]; }; - struct DestructibleDef { const char* name; @@ -540,7 +534,6 @@ namespace T6 int clientOnly; }; - union XAnimIndices { char* _1; @@ -548,7 +541,6 @@ namespace T6 void* data; }; - struct XAnimParts { const char* name; @@ -599,7 +591,6 @@ namespace T6 int partBits[5]; }; - struct XModel { const char* name; @@ -637,7 +628,6 @@ namespace T6 float lightingOriginRange; }; - struct gcc_align(8) GfxDrawSurfFields { uint64_t objectId : 16; @@ -651,14 +641,12 @@ namespace T6 uint64_t primarySortKey : 6; }; - union GfxDrawSurf { gcc_align(8) GfxDrawSurfFields fields; gcc_align(8) uint64_t packed; }; - struct type_align(8) MaterialInfo { const char* name; @@ -677,7 +665,6 @@ namespace T6 typedef tdef_align(8) GfxStateBits GfxStateBitsTable; - struct Material { MaterialInfo info; @@ -695,49 +682,42 @@ namespace T6 Material* thermalMaterial; }; - struct GfxPixelShaderLoadDef { char* program; unsigned int programSize; }; - struct MaterialPixelShaderProgram { - void/*ID3D11PixelShader*/* ps; + void /*ID3D11PixelShader*/* ps; GfxPixelShaderLoadDef loadDef; }; - struct MaterialPixelShader { const char* name; MaterialPixelShaderProgram prog; }; - struct GfxVertexShaderLoadDef { char* program; unsigned int programSize; }; - struct MaterialVertexShaderProgram { - void/*ID3D11VertexShader*/* vs; + void /*ID3D11VertexShader*/* vs; GfxVertexShaderLoadDef loadDef; }; - struct MaterialVertexShader { const char* name; MaterialVertexShaderProgram prog; }; - struct MaterialTechniqueSet { const char* name; @@ -745,21 +725,18 @@ namespace T6 MaterialTechnique* techniques[36]; }; - union GfxTexture { - void/*ID3D11ShaderResourceView*/* basemap; + void /*ID3D11ShaderResourceView*/* basemap; Texture* texture; GfxImageLoadDef* loadDef; }; - struct Picmip { char platform[2]; }; - struct CardMemory { int platform[2]; @@ -871,6 +848,7 @@ namespace T6 }; #pragma pack(push, 1) + struct type_align(2) SndRuntimeAssetBank { const char* zone; @@ -883,11 +861,11 @@ namespace T6 bool indicesLoaded; bool indicesAllocated; }; + #pragma pack(pop) typedef tdef_align(2048) char SndChar2048; - struct SndLoadedAssets { const char* zone; @@ -899,7 +877,6 @@ namespace T6 SndChar2048* data; }; - enum SndBankState { SND_BANK_STATE_NEW = 0x0, @@ -913,7 +890,6 @@ namespace T6 SND_BANK_STATE_ERROR = 0x8, }; - struct SndBank { const char* name; @@ -936,7 +912,6 @@ namespace T6 bool runtimeAssetLoad; }; - struct SndPatch { const char* name; @@ -948,7 +923,6 @@ namespace T6 typedef tdef_align(128) cbrush_t cbrush_array_t; typedef tdef_align(128) Bounds BoundsArray; - struct ClipInfo { int planeCount; @@ -971,7 +945,6 @@ namespace T6 int* brushContents; }; - struct type_align(4) cLeaf_s { uint16_t firstCollAabbIndex; @@ -984,7 +957,6 @@ namespace T6 int16_t cluster; }; - struct cmodel_t { vec3_t mins; @@ -994,7 +966,6 @@ namespace T6 cLeaf_s leaf; }; - struct clipMap_t { const char* name; @@ -1039,7 +1010,6 @@ namespace T6 unsigned int checksum; }; - struct ComWorld { const char* name; @@ -1048,7 +1018,6 @@ namespace T6 ComPrimaryLight* primaryLights; }; - struct PathData { unsigned int nodeCount; @@ -1063,21 +1032,18 @@ namespace T6 pathnode_tree_t* nodeTree; }; - struct GameWorldSp { const char* name; PathData path; }; - struct GameWorldMp { const char* name; PathData path; }; - struct MapTriggers { unsigned int count; @@ -1088,7 +1054,6 @@ namespace T6 TriggerSlab* slabs; }; - struct MapEnts { const char* name; @@ -1097,7 +1062,6 @@ namespace T6 MapTriggers trigger; }; - struct GfxWorldStreamInfo { int aabbTreeCount; @@ -1117,7 +1081,6 @@ namespace T6 float exposure; }; - struct GfxWorldFog { float baseDist; @@ -1134,7 +1097,6 @@ namespace T6 float sunFogOpacity; }; - struct SunLightParseParams { char name[64]; @@ -1143,7 +1105,6 @@ namespace T6 GfxWorldFog initWorldFog[1]; }; - struct GfxSkyDynamicIntensity { float angle0; @@ -1152,7 +1113,6 @@ namespace T6 float factor1; }; - struct GfxWorldDpvsPlanes { int cellCount; @@ -1161,21 +1121,18 @@ namespace T6 unsigned int* sceneEntCellBits; }; - struct GfxWorldVertexData0 { byte128* data; - void/*ID3D11Buffer*/* vb; + void /*ID3D11Buffer*/* vb; }; - struct GfxWorldVertexData1 { byte128* data; - void/*ID3D11Buffer*/* vb; + void /*ID3D11Buffer*/* vb; }; - struct GfxWorldDraw { unsigned int reflectionProbeCount; @@ -1192,7 +1149,7 @@ namespace T6 GfxWorldVertexData1 vd1; int indexCount; uint16_t* indices; - void/*ID3D11Buffer*/* indexBuffer; + void /*ID3D11Buffer*/* indexBuffer; }; typedef tdef_align(4) char aligned_byte_pointer; @@ -1219,7 +1176,6 @@ namespace T6 GfxSkyGridVolume* skyGridVolumes; }; - struct sunflare_t { bool hasValidData; @@ -1248,7 +1204,6 @@ namespace T6 typedef tdef_align(4) GfxDrawSurf GfxDrawSurf_align4; - struct GfxWorldDpvsStatic { unsigned int smodelCount; @@ -1278,7 +1233,6 @@ namespace T6 volatile int usageCount; }; - struct GfxWorldDpvsDynamic { unsigned int dynEntClientWordCount[2]; @@ -1288,14 +1242,12 @@ namespace T6 volatile int usageCount; }; - struct GfxWaterBuffer { unsigned int bufferSize; vec4_t* buffer; }; - struct GfxWorld { const char* name; @@ -1376,14 +1328,12 @@ namespace T6 int lightingQuality; }; - struct type_align(4) GfxLightImage { GfxImage* image; char samplerState; }; - struct GfxLightDef { const char* name; @@ -1391,7 +1341,6 @@ namespace T6 int lmapLookupStart; }; - struct Font_s { const char* fontName; @@ -1405,7 +1354,6 @@ namespace T6 KerningPairs* kerningPairs; }; - struct FontIcon { const char* name; @@ -1415,7 +1363,6 @@ namespace T6 FontIconAlias* fontIconAlias; }; - struct MenuList { const char* name; @@ -1423,7 +1370,6 @@ namespace T6 menuDef_t** menus; }; - struct rectDef_s { float x; @@ -1434,7 +1380,6 @@ namespace T6 int vertAlign; }; - struct windowDef_t { const char* name; @@ -1461,7 +1406,6 @@ namespace T6 Material* background; }; - struct ExpressionStatement { char* filename; @@ -1470,7 +1414,6 @@ namespace T6 expressionRpn* rpn; }; - struct type_align(8) menuDef_t { windowDef_t window; @@ -1511,14 +1454,12 @@ namespace T6 itemDef_s** items; }; - struct LocalizeEntry { const char* value; const char* name; }; - enum weaponIconRatioType_t { WEAPON_ICON_RATIO_1TO1 = 0x0, @@ -1563,7 +1504,6 @@ namespace T6 ATTACHMENT_INVALID = 0x1E, }; - enum eAttachmentPoint { ATTACHMENT_POINT_NONE = 0x0, @@ -1577,7 +1517,6 @@ namespace T6 ATTACHMENT_POINT_INVALID = 0x6, }; - enum PenetrateType { PENETRATE_TYPE_NONE = 0x0, @@ -1587,7 +1526,6 @@ namespace T6 PENETRATE_TYPE_COUNT = 0x4, }; - enum weapFireType_t { WEAPON_FIRETYPE_FULLAUTO = 0x0, @@ -1708,7 +1646,6 @@ namespace T6 int customBool2; }; - enum weapOverlayReticle_t { WEAPOVERLAYRETICLE_NONE = 0x0, @@ -1716,7 +1653,6 @@ namespace T6 WEAPOVERLAYRETICLE_NUM = 0x2, }; - struct WeaponAttachmentUnique { const char* szInternalName; @@ -1819,7 +1755,6 @@ namespace T6 unsigned int numCamoMaterials; }; - struct SndDriverGlobals { const char* name; @@ -1841,14 +1776,12 @@ namespace T6 SndFutz* futzes; }; - struct FxFloatRange { float base; float amplitude; }; - struct FxEffectDef { const char* name; @@ -1869,14 +1802,12 @@ namespace T6 FxFloatRange occlusionQueryScaleRange; }; - struct FxImpactTable { const char* name; FxImpactEntry* table; }; - struct RawFile { const char* name; @@ -1884,7 +1815,6 @@ namespace T6 const char16* buffer; }; - struct StringTable { const char* name; @@ -1894,7 +1824,6 @@ namespace T6 int16_t* cellIndex; }; - enum LbUpdateType { LBUPDATE_TYPE_NORMAL = 0x0, @@ -1903,7 +1832,6 @@ namespace T6 LBUPDATE_TYPE_COUNT = 0x3, }; - struct LeaderboardDef { const char* name; @@ -1917,21 +1845,18 @@ namespace T6 int trackTypes; }; - struct gump_info_t { char* name; int size; }; - struct overlay_info_t { char* name; int size; }; - struct XGlobals { const char* name; @@ -1948,14 +1873,12 @@ namespace T6 overlay_info_t overlays[32]; }; - struct ddlRoot_t { const char* name; ddlDef_t* ddlDef; }; - struct Glasses { const char* name; @@ -1974,7 +1897,6 @@ namespace T6 unsigned int numIndices; }; - struct EmblemLayer { int cost; @@ -1982,28 +1904,24 @@ namespace T6 int unlockPLevel; }; - struct EmblemCategory { const char* name; const char* description; }; - struct EmblemIconType { const char* name; const char* description; }; - struct EmblemBGCategory { const char* name; const char* description; }; - struct EmblemIcon { GfxImage* image; @@ -2018,7 +1936,6 @@ namespace T6 uint16_t category; }; - struct EmblemBackground { Material* material; @@ -2032,7 +1949,6 @@ namespace T6 int mtxIndex; }; - struct EmblemSet { int colorCount; @@ -2052,7 +1968,6 @@ namespace T6 int16_t* backgroundLookup; }; - struct ScriptParseTree { const char* name; @@ -2060,7 +1975,6 @@ namespace T6 byte32* buffer; }; - struct KeyValuePairs { const char* name; @@ -2068,7 +1982,6 @@ namespace T6 KeyValuePair* keyValuePairs; }; - struct view_limits_t { float horizSpanLeft; @@ -2089,7 +2002,6 @@ namespace T6 NUM_TRACTION_TYPES = 0x3, }; - struct VehicleParameter { float m_speed_max; @@ -2145,7 +2057,6 @@ namespace T6 float m_angular_drag_scale; }; - struct VehicleDriveBySound { int apex; @@ -2153,7 +2064,6 @@ namespace T6 unsigned int alias; }; - struct VehicleEngineSound { const char* name; @@ -2161,7 +2071,6 @@ namespace T6 float params[5]; }; - struct VehicleGearData { float minRPM; @@ -2169,7 +2078,6 @@ namespace T6 float ratio; }; - struct VehicleEngine { float idleRpms; @@ -2188,7 +2096,6 @@ namespace T6 VehicleGearData gears[10]; }; - struct VehicleAntenna { float springK; @@ -2524,7 +2431,6 @@ namespace T6 cLeaf_s leaf; }; - struct AddonMapEnts { const char* name; @@ -2537,7 +2443,6 @@ namespace T6 GfxBrushModel* models; }; - enum tracerType_t { TRACERTYPE_LASER = 0x0, @@ -2545,7 +2450,6 @@ namespace T6 TRACERTYPE_NUM = 0x2, }; - struct TracerDef { const char* name; @@ -2563,14 +2467,12 @@ namespace T6 vec4_t colors[5]; }; - struct SkinnedVertsDef { const char* name; unsigned int maxSkinnedVerts; }; - struct Qdb { const char* name; @@ -2578,7 +2480,6 @@ namespace T6 byte32* buffer; }; - struct Slug { const char* name; @@ -2586,21 +2487,18 @@ namespace T6 byte32* buffer; }; - struct FootstepTableDef { const char* name; unsigned int sndAliasTable[32][7]; }; - struct FootstepFXTableDef { const char* name; FxEffectDef* footstepFX[32]; }; - struct ZBarrierBoard { XModel* pBoardModel; @@ -2622,7 +2520,6 @@ namespace T6 unsigned int numRepsToPullProBoard; }; - struct ZBarrierDef { const char* name; @@ -2649,14 +2546,12 @@ namespace T6 ZBarrierBoard boards[6]; }; - struct XModelPiece { XModel* model; vec3_t offset; }; - struct DestructibleStage { uint16_t showBone; @@ -2671,7 +2566,6 @@ namespace T6 PhysPreset* physPreset; }; - struct DestructiblePiece { DestructibleStage stages[5]; @@ -2691,14 +2585,12 @@ namespace T6 int hideBones[5]; }; - struct XAnimNotifyInfo { uint16_t name; float time; }; - struct XAnimDeltaPart { XAnimPartTrans* trans; @@ -2706,7 +2598,6 @@ namespace T6 XAnimDeltaPartQuat* quat; }; - struct DObjAnimMat { vec4_t quat; @@ -2714,7 +2605,6 @@ namespace T6 float transWeight; }; - struct XSurfaceVertexInfo { int16_t vertCount[4]; @@ -2724,7 +2614,6 @@ namespace T6 typedef tdef_align(16) unsigned short r_index16_t; - struct type_align(16) XSurface { char tileMode; @@ -2733,16 +2622,15 @@ namespace T6 uint16_t vertCount; uint16_t triCount; uint16_t baseVertIndex; - r_index16_t (*triIndices)[3]; + r_index16_t(*triIndices)[3]; XSurfaceVertexInfo vertInfo; GfxPackedVertex* verts0; - void/*ID3D11Buffer*/* vb0; + void /*ID3D11Buffer*/* vb0; XRigidVertList* vertList; - void/*ID3D11Buffer*/* indexBuffer; + void /*ID3D11Buffer*/* indexBuffer; int partBits[5]; }; - struct XModelCollSurf_s { XModelCollTri_s* collTris; @@ -2754,7 +2642,6 @@ namespace T6 int surfFlags; }; - struct type_align(4) XBoneInfo { vec3_t bounds[2]; @@ -2763,13 +2650,11 @@ namespace T6 char collmap; }; - struct Collmap { PhysGeomList* geomList; }; - struct MaterialTextureDef { unsigned int nameHash; @@ -2782,7 +2667,6 @@ namespace T6 GfxImage* image; }; - struct type_align(16) MaterialConstantDef { unsigned int nameHash; @@ -2855,9 +2739,9 @@ namespace T6 struct GfxStateBits { unsigned int loadBits[2]; - void/*ID3D11BlendState*/* blendState; - void/*ID3D11DepthStencilState*/* depthStencilState; - void/*ID3D11RasterizerState*/* rasterizerState; + void /*ID3D11BlendState*/* blendState; + void /*ID3D11DepthStencilState*/* depthStencilState; + void /*ID3D11RasterizerState*/* rasterizerState; }; /* struct IUnknown @@ -2877,7 +2761,6 @@ namespace T6 { };*/ - struct MaterialPass { MaterialVertexDeclaration* vertexDecl; @@ -2892,7 +2775,6 @@ namespace T6 MaterialShaderArgument* args; }; - struct MaterialTechnique { const char* name; @@ -2909,7 +2791,6 @@ namespace T6 { };*/ - struct type_align(4) GfxImageLoadDef { char levelCount; @@ -2919,7 +2800,6 @@ namespace T6 char data[1]; }; - struct SndAliasList { const char* name; @@ -2929,14 +2809,12 @@ namespace T6 int sequence; }; - struct type_align(4) SndIndexEntry { uint16_t value; uint16_t next; }; - struct SndRadverb { char name[32]; @@ -2961,7 +2839,6 @@ namespace T6 typedef tdef_align(16) float SndFloatAlign16; - struct SndDuck { char name[32]; @@ -3007,14 +2884,12 @@ namespace T6 char format; }; - struct SndDialogScriptIdLookup { unsigned int scriptId; unsigned int aliasId; }; - struct cplane_s { vec3_t normal; @@ -3024,7 +2899,6 @@ namespace T6 char pad[2]; }; - struct ClipMaterial { const char* name; @@ -3032,7 +2906,6 @@ namespace T6 int contentFlags; }; - struct cbrushside_t { cplane_s* plane; @@ -3040,13 +2913,11 @@ namespace T6 int sflags; }; - struct cLeafBrushNodeLeaf_t { LeafBrush* brushes; }; - struct cLeafBrushNodeChildren_t { float dist; @@ -3054,14 +2925,12 @@ namespace T6 uint16_t childOffset[2]; }; - union cLeafBrushNodeData_t { cLeafBrushNodeLeaf_t leaf; cLeafBrushNodeChildren_t children; }; - struct cLeafBrushNode_s { char axis; @@ -3070,7 +2939,6 @@ namespace T6 cLeafBrushNodeData_t data; }; - struct type_align(16) cbrush_t { vec3_t mins; @@ -3084,20 +2952,17 @@ namespace T6 vec3_t* verts; }; - struct Bounds { vec3_t midPoint; vec3_t halfSize; }; - struct cStaticModelWritable { uint16_t nextModelInWorldSector; }; - struct cStaticModel_s { cStaticModelWritable writable; @@ -3109,14 +2974,12 @@ namespace T6 vec3_t absmax; }; - struct cNode_t { cplane_s* plane; int16_t children[2]; }; - struct CollisionPartition { char triCount; @@ -3125,14 +2988,12 @@ namespace T6 int fuind; }; - union CollisionAabbTreeIndex { int firstChildIndex; int partitionIndex; }; - struct type_align(16) CollisionAabbTree { vec3_t origin; @@ -3142,7 +3003,6 @@ namespace T6 CollisionAabbTreeIndex u; }; - enum DynEntityType { DYNENT_TYPE_INVALID = 0x0, @@ -3151,14 +3011,12 @@ namespace T6 DYNENT_TYPE_COUNT = 0x3, }; - struct GfxPlacement { vec4_t quat; vec3_t origin; }; - struct DynEntityDef { DynEntityType type; @@ -3179,14 +3037,12 @@ namespace T6 uint16_t target; }; - struct DynEntityPose { GfxPlacement pose; float radius; }; - struct DynEntityClient { int physObjId; @@ -3198,14 +3054,12 @@ namespace T6 int physicsStartTime; }; - struct DynEntityServer { uint16_t flags; int health; }; - struct DynEntityColl { uint16_t sector; @@ -3215,7 +3069,6 @@ namespace T6 int contents; }; - struct par_t { vec3_t p; @@ -3224,7 +3077,6 @@ namespace T6 int flags; }; - enum rope_constraint_e { ROPE_PAIR_CONSTRAINT = 0x0, @@ -3233,7 +3085,6 @@ namespace T6 ROPE_CENTITY_CONSTRAINT = 0x3, }; - struct type_align(4) constraint_t { vec3_t p; @@ -3244,21 +3095,18 @@ namespace T6 char pi2; }; - struct rope_frame_verts_t { int num_verts; vec3_t v[50]; }; - struct rope_client_verts_t { rope_frame_verts_t frame_verts[2]; unsigned int frame_index; }; - struct type_align(4) rope_t { par_t m_particles[25]; @@ -3290,7 +3138,6 @@ namespace T6 uint16_t m_lightingHandle; }; - struct ComPrimaryLight { char type; @@ -3322,7 +3169,6 @@ namespace T6 const char* defName; }; - enum nodeType { NODE_BADNODE = 0x0, @@ -3350,7 +3196,6 @@ namespace T6 NODE_DONTLINK = 0x15, }; - struct pathnode_constant_t { nodeType type; @@ -3371,14 +3216,12 @@ namespace T6 pathlink_s* Links; }; - struct SentientHandle { uint16_t number; uint16_t infoIndex; }; - struct type_align(4) pathnode_dynamic_t { SentientHandle pOwner; @@ -3393,7 +3236,6 @@ namespace T6 bool hasBadPlaceLink; }; - struct pathnode_transient_t { int iSearchFrame; @@ -3410,7 +3252,6 @@ namespace T6 }; }; - struct pathnode_t { pathnode_constant_t constant; @@ -3418,28 +3259,24 @@ namespace T6 pathnode_transient_t transient; }; - struct type_align(16) pathbasenode_t { vec3_t vOrigin; unsigned int type; }; - struct pathnode_tree_nodes_t { int nodeCount; uint16_t* nodes; }; - union pathnode_tree_info_t { pathnode_tree_t* child[2]; pathnode_tree_nodes_t s; }; - struct pathnode_tree_t { int axis; @@ -3447,7 +3284,6 @@ namespace T6 pathnode_tree_info_t u; }; - struct TriggerModel { int contents; @@ -3455,7 +3291,6 @@ namespace T6 uint16_t firstHull; }; - struct TriggerHull { Bounds bounds; @@ -3464,7 +3299,6 @@ namespace T6 uint16_t firstSlab; }; - struct TriggerSlab { vec3_t dir; @@ -3472,7 +3306,6 @@ namespace T6 float halfSize; }; - struct type_align(16) GfxStreamingAabbTree { vec4_t mins; @@ -3486,7 +3319,6 @@ namespace T6 uint16_t surfaceCount; }; - struct type_align(16) float44 { union @@ -3496,7 +3328,6 @@ namespace T6 }; }; - struct type_align(16) GfxLight { char type; @@ -3527,7 +3358,6 @@ namespace T6 GfxLightDef* def; }; - struct GfxLightCorona { vec3_t origin; @@ -3536,7 +3366,6 @@ namespace T6 float intensity; }; - struct GfxShadowMapVolume { unsigned int control; @@ -3545,13 +3374,11 @@ namespace T6 unsigned int padding3; }; - struct GfxVolumePlane { vec4_t plane; }; - struct GfxExposureVolume { unsigned int control; @@ -3562,7 +3389,6 @@ namespace T6 float featherAdjust; }; - struct GfxWorldFogVolume { vec3_t mins; @@ -3573,7 +3399,6 @@ namespace T6 GfxWorldFog volumeWorldFog[1]; }; - struct GfxWorldFogModifierVolume { unsigned int control; @@ -3590,7 +3415,6 @@ namespace T6 vec4_t colorAdjust; }; - struct GfxLutVolume { vec3_t mins; @@ -3600,7 +3424,6 @@ namespace T6 unsigned int lutIndex; }; - struct GfxCell { vec3_t mins; @@ -3613,7 +3436,6 @@ namespace T6 char* reflectionProbes; }; - struct GfxLightingSH { vec4_t V0; @@ -3621,7 +3443,6 @@ namespace T6 vec4_t V2; }; - struct GfxReflectionProbe { vec3_t origin; @@ -3632,7 +3453,6 @@ namespace T6 float mipLodBias; }; - struct GfxLightmapArray { GfxImage* primary; @@ -3647,7 +3467,6 @@ namespace T6 { };*/ - struct type_align(4) GfxLightGridEntry { uint16_t colorsIndex; @@ -3655,19 +3474,16 @@ namespace T6 char visibility; }; - struct type_align(4) GfxCompressedLightGridColors { char rgb[56][3]; }; - struct GfxCompressedLightGridCoeffs { uint16_t coeffs[9][3]; }; - struct GfxSkyGridVolume { vec3_t mins; @@ -3678,7 +3494,6 @@ namespace T6 char visibility; }; - struct GfxBrushModelWritable { vec3_t mins; @@ -3687,7 +3502,6 @@ namespace T6 float padding2; }; - struct type_align(16) GfxBrushModel { GfxBrushModelWritable writable; @@ -3696,14 +3510,12 @@ namespace T6 unsigned int startSurfIndex; }; - struct MaterialMemory { Material* material; int memory; }; - union XModelDrawInfo { struct @@ -3716,7 +3528,6 @@ namespace T6 unsigned int packed; }; - struct GfxSceneDynModel { XModelDrawInfo info; @@ -3725,20 +3536,17 @@ namespace T6 char reflectionProbeIndex; }; - struct BModelDrawInfo { uint16_t surfId; }; - struct type_align(4) GfxSceneDynBrush { BModelDrawInfo info; uint16_t dynEntId; }; - union gcc_align(8) __m128 { float m128_f32[4]; @@ -3767,7 +3575,6 @@ namespace T6 __m128 w; }; - struct type_align(16) SSkinInstance { union @@ -3786,7 +3593,6 @@ namespace T6 int pad3; }; - struct GfxShadowGeometry { uint16_t surfaceCount; @@ -3795,14 +3601,12 @@ namespace T6 uint16_t* smodelIndex; }; - struct GfxLightRegion { unsigned int hullCount; GfxLightRegionHull* hulls; }; - struct GfxStaticModelInst { vec3_t mins; @@ -3810,7 +3614,6 @@ namespace T6 vec3_t lightingOrigin; }; - struct srfTriangles_t { vec3_t mins; @@ -3824,7 +3627,6 @@ namespace T6 int baseIndex; }; - struct type_align(16) GfxSurface { srfTriangles_t tris; @@ -3836,7 +3638,6 @@ namespace T6 vec3_t bounds[2]; }; - struct GfxPackedPlacement { vec3_t origin; @@ -3844,7 +3645,6 @@ namespace T6 float scale; }; - struct GfxLightingSHQuantized { uint16_t V0[4]; @@ -3852,15 +3652,13 @@ namespace T6 uint16_t V2[4]; }; - struct type_align(4) GfxStaticModelLmapVertexInfo { unsigned int* lmapVertexColors; - void/*ID3D11Buffer*/* lmapVertexColorsVB; + void /*ID3D11Buffer*/* lmapVertexColorsVB; uint16_t numLmapVertexColors; }; - struct GfxStaticModelDrawInst { float cullDist; @@ -3878,7 +3676,6 @@ namespace T6 GfxStaticModelLmapVertexInfo lmapVertexInfo[4]; }; - struct Occluder { unsigned int flags; @@ -3886,13 +3683,11 @@ namespace T6 vec3_t points[4]; }; - struct GfxOutdoorBounds { vec3_t bounds[2]; }; - struct GfxHeroLight { char type; @@ -3906,7 +3701,6 @@ namespace T6 int exponent; }; - struct GfxHeroLightTree { vec3_t mins; @@ -3915,7 +3709,6 @@ namespace T6 int rightNode; }; - struct Glyph { uint16_t letter; @@ -3930,7 +3723,6 @@ namespace T6 float t1; }; - struct KerningPairs { uint16_t wFirst; @@ -3938,14 +3730,12 @@ namespace T6 int iKernAmount; }; - struct FontIconName { const char* string; int hash; }; - struct FontIconEntry { FontIconName fontIconName; @@ -3955,14 +3745,12 @@ namespace T6 float yScale; }; - struct FontIconAlias { int aliasHash; int buttonHash; }; - struct GenericEventHandler { const char* name; @@ -3970,7 +3758,6 @@ namespace T6 GenericEventHandler* next; }; - struct ItemKeyHandler { int key; @@ -3978,7 +3765,6 @@ namespace T6 ItemKeyHandler* next; }; - enum expDataType { VAL_INT = 0x0, @@ -3988,7 +3774,6 @@ namespace T6 VAL_DVAR = 0x4, }; - union operandInternalDataUnion { int intVal; @@ -3997,14 +3782,12 @@ namespace T6 dvar_t* dvar; }; - struct Operand { expDataType dataType; operandInternalDataUnion internals; }; - union expressionRpnDataUnion { Operand constant; @@ -4020,7 +3803,6 @@ namespace T6 RPN_END = 0x3, }; - struct expressionRpn { int type; @@ -4061,7 +3843,6 @@ namespace T6 ITEM_TYPE_MENUMODEL = 0x27 }; - union itemDefData_t { textDef_s* textDef; @@ -4071,7 +3852,6 @@ namespace T6 void* data; }; - struct type_align(8) itemDef_s { windowDef_t window; @@ -4095,7 +3875,6 @@ namespace T6 UIAnimInfo* animInfo; }; - enum weapType_t { WEAPTYPE_BULLET = 0x0, @@ -4110,7 +3889,6 @@ namespace T6 WEAPTYPE_NUM = 0x9, }; - enum weapClass_t { WEAPCLASS_RIFLE = 0x0, @@ -4130,7 +3908,6 @@ namespace T6 WEAPCLASS_NUM = 0xE, }; - enum ImpactType { IMPACT_TYPE_NONE = 0x0, @@ -4152,7 +3929,6 @@ namespace T6 IMPACT_TYPE_COUNT = 0x10, }; - enum weapInventoryType_t { WEAPINVENTORY_PRIMARY = 0x0, @@ -4164,7 +3940,6 @@ namespace T6 WEAPINVENTORYCOUNT = 0x6, }; - enum weapClipType_t { WEAPON_CLIPTYPE_BOTTOM = 0x0, @@ -4176,7 +3951,6 @@ namespace T6 WEAPON_CLIPTYPECOUNT = 0x6, }; - enum barrelType_t { BARREL_TYPE_SINGLE = 0x0, @@ -4188,7 +3962,6 @@ namespace T6 BARREL_TYPE_COUNT = 0x6, }; - enum OffhandClass { OFFHAND_CLASS_NONE = 0x0, @@ -4200,7 +3973,6 @@ namespace T6 OFFHAND_CLASS_COUNT = 0x6, }; - enum OffhandSlot { OFFHAND_SLOT_NONE = 0x0, @@ -4211,7 +3983,6 @@ namespace T6 OFFHAND_SLOT_COUNT = 0x5, }; - enum weapStance_t { WEAPSTANCE_STAND = 0x0, @@ -4220,7 +3991,6 @@ namespace T6 WEAPSTANCE_NUM = 0x3, }; - enum activeReticleType_t { VEH_ACTIVE_RETICLE_NONE = 0x0, @@ -4230,7 +4000,6 @@ namespace T6 VEH_ACTIVE_RETICLE_COUNT = 0x4, }; - enum ammoCounterClipType_t { AMMO_COUNTER_CLIP_NONE = 0x0, @@ -4243,7 +4012,6 @@ namespace T6 AMMO_COUNTER_CLIP_COUNT = 0x7, }; - enum WeapOverlayInteface_t { WEAPOVERLAYINTERFACE_NONE = 0x0, @@ -4252,7 +4020,6 @@ namespace T6 WEAPOVERLAYINTERFACECOUNT = 0x3, }; - enum weapProjExposion_t { WEAPPROJEXP_GRENADE = 0x0, @@ -4269,7 +4036,6 @@ namespace T6 WEAPPROJEXP_NUM = 0xB, }; - enum WeapStickinessType { WEAPSTICKINESS_NONE = 0x0, @@ -4281,7 +4047,6 @@ namespace T6 WEAPSTICKINESS_COUNT = 0x6, }; - enum WeapRotateType { WEAPROTATE_GRENADE_ROTATE = 0x0, @@ -4290,7 +4055,6 @@ namespace T6 WEAPROTATE_COUNT = 0x3, }; - enum guidedMissileType_t { MISSILE_GUIDANCE_NONE = 0x0, @@ -4334,13 +4098,13 @@ namespace T6 struct WeaponDef { - const char* szOverlayName; // covered - XModel** gunXModel; // covered - XModel* handXModel; // covered - const char* szModeName; // covered - uint16_t* notetrackSoundMapKeys; // covered + const char* szOverlayName; // covered + XModel** gunXModel; // covered + XModel* handXModel; // covered + const char* szModeName; // covered + uint16_t* notetrackSoundMapKeys; // covered uint16_t* notetrackSoundMapValues; // covered - int playerAnimType; // covered + int playerAnimType; // covered weapType_t weapType; weapClass_t weapClass; PenetrateType penetrateTWeaponAttachmentype; @@ -4838,15 +4602,16 @@ namespace T6 float fAntiQuickScopeSwayFactor; float fightDist; float maxDist; - //const char *accuracyGraphName[2]; // TODO: Order is accuracyGraphName[0] -> accuracyGraphKnots[0] -> originalAccuracyGraphKnots[0] -> accuracyGraphName[1] -> ... - // Which is currently not possible to do in code generation. Afaik this is the only place where this is the case. - // So might be something to fix but on the other hand it might be too much work for this little inconvenience. + // const char *accuracyGraphName[2]; // TODO: Order is accuracyGraphName[0] -> accuracyGraphKnots[0] -> originalAccuracyGraphKnots[0] -> + // accuracyGraphName[1] -> ... + // Which is currently not possible to do in code generation. Afaik this is the only place where this is the case. + // So might be something to fix but on the other hand it might be too much work for this little inconvenience. const char* accuracyGraphName0; const char* accuracyGraphName1; - //vec2_t *accuracyGraphKnots[2]; + // vec2_t *accuracyGraphKnots[2]; vec2_t* accuracyGraphKnots0; vec2_t* accuracyGraphKnots1; - //vec2_t *originalAccuracyGraphKnots[2]; + // vec2_t *originalAccuracyGraphKnots[2]; vec2_t* originalAccuracyGraphKnots0; vec2_t* originalAccuracyGraphKnots1; int accuracyGraphKnotCount[2]; @@ -5151,7 +4916,6 @@ namespace T6 char weaponCamo[64]; }; - struct WeaponCamoSet { GfxImage* solidCamoImage; @@ -5160,14 +4924,12 @@ namespace T6 float patternScale; }; - struct WeaponCamoMaterialSet { unsigned int numMaterials; WeaponCamoMaterial* materials; }; - enum SndMenuCategory { SND_CATEGORY_SFX = 0x0, @@ -5178,7 +4940,6 @@ namespace T6 SND_CATEGORY_COUNT = 0x5, }; - struct SndVolumeGroup { char name[32]; @@ -5190,7 +4951,6 @@ namespace T6 uint16_t attenuationMp; }; - struct SndCurve { char name[32]; @@ -5198,7 +4958,6 @@ namespace T6 vec2_t points[8]; }; - struct SndPan { char name[32]; @@ -5211,21 +4970,18 @@ namespace T6 float right; }; - struct SndDuckGroup { char name[32]; unsigned int id; }; - struct SndContext { unsigned int type; unsigned int values[8]; }; - struct SndMaster { char name[32]; @@ -5283,7 +5039,6 @@ namespace T6 int voiceCompE; }; - struct SndSidechainDuck { char name[32]; @@ -5296,7 +5051,6 @@ namespace T6 float tf; }; - struct SndFutz { char name[32]; @@ -5319,34 +5073,29 @@ namespace T6 unsigned int loopAliasId; }; - struct FxSpawnDefLooping { int intervalMsec; int count; }; - struct FxIntRange { int base; int amplitude; }; - struct FxSpawnDefOneShot { FxIntRange count; }; - union FxSpawnDef { FxSpawnDefLooping looping; FxSpawnDefOneShot oneShot; }; - struct FxElemAtlas { char behavior; @@ -5358,14 +5107,12 @@ namespace T6 uint16_t entryCountAndIndexRange; }; - union FxEffectDefRef { FxEffectDef* handle; const char* name; }; - union FxElemVisuals { void* anonymous; @@ -5376,7 +5123,6 @@ namespace T6 GfxLightDef* lightDef; }; - union FxElemDefVisuals { FxElemMarkVisuals* markArray; @@ -5384,7 +5130,6 @@ namespace T6 FxElemVisuals instance; }; - union FxElemExtendedDefPtr { FxTrailDef* trailDef; @@ -5392,21 +5137,18 @@ namespace T6 char* unknownDef; }; - struct FxBillboardTrim { float topWidth; float bottomWidth; }; - union FxElemDefUnion { FxBillboardTrim billboard; FxIntRange cloudDensityRange; }; - struct FxElemSpawnSound { const char* spawnSound; @@ -5432,7 +5174,6 @@ namespace T6 FX_ELEM_TYPE_LAST_DRAWN = 0x9, }; - struct FxElemDef { int flags; @@ -5482,21 +5223,18 @@ namespace T6 vec2_t billboardPivot; }; - struct FxImpactEntry { FxEffectDef* nonflesh[32]; FxEffectDef* flesh[4]; }; - struct StringTableCell { const char* string; int hash; }; - enum LbColType { LBCOL_TYPE_NUMBER = 0x0, @@ -5509,7 +5247,6 @@ namespace T6 LBCOL_TYPE_COUNT = 0x7, }; - enum LbAggType { LBAGG_TYPE_MIN = 0x0, @@ -5519,7 +5256,6 @@ namespace T6 LBAGG_TYPE_COUNT = 0x4, }; - struct LbColumnDef { const char* name; @@ -5535,7 +5271,6 @@ namespace T6 int uiCalColY; }; - struct ddlDef_t { int version; @@ -5547,7 +5282,6 @@ namespace T6 ddlDef_t* next; }; - struct Glass { unsigned int numCellIndices; @@ -5569,7 +5303,6 @@ namespace T6 float thickness; }; - struct KeyValuePair { int keyHash; @@ -5577,7 +5310,6 @@ namespace T6 const char* value; }; - enum DevEventType { EVENT_ACTIVATE = 0x0, @@ -5588,7 +5320,6 @@ namespace T6 EVENT_SAVE = 0x5, }; - enum LocalClientNum_t { INVALID_LOCAL_CLIENT = 0xFFFFFFFF, @@ -5598,20 +5329,18 @@ namespace T6 LOCAL_CLIENT_COUNT = 0x1, }; - struct type_align(4) DevGraph { vec2_t* knots; int* knotCount; int knotCountMax; int selectedKnot; - void* eventCallback; //void (__cdecl *eventCallback)(DevGraph *, DevEventType, LocalClientNum_t); - void* textCallback; //void (__cdecl *textCallback)(DevGraph *, const float, const float, char *, const int); + void* eventCallback; // void (__cdecl *eventCallback)(DevGraph *, DevEventType, LocalClientNum_t); + void* textCallback; // void (__cdecl *textCallback)(DevGraph *, const float, const float, char *, const int); void* data; bool disableEditingEndPoints; }; - struct GraphFloat { char name[64]; @@ -5626,18 +5355,16 @@ namespace T6 union XAnimDynamicFrames { - ByteVec *_1; - UShortVec *_2; + ByteVec* _1; + UShortVec* _2; }; - union XAnimDynamicIndicesTrans { char _1[1]; uint16_t _2[1]; }; - struct type_align(4) XAnimPartTransFrames { vec3_t mins; @@ -5646,14 +5373,12 @@ namespace T6 XAnimDynamicIndicesTrans indices; }; - union XAnimPartTransData { XAnimPartTransFrames frames; vec3_t frame0; }; - struct XAnimPartTrans { uint16_t size; @@ -5671,18 +5396,16 @@ namespace T6 struct type_align(4) XAnimDeltaPartQuatDataFrames2 { - XQuat2 *frames; + XQuat2* frames; XAnimDynamicIndicesDeltaQuat2 indices; }; - union XAnimDeltaPartQuatData2 { XAnimDeltaPartQuatDataFrames2 frames; XQuat2 frame0; }; - struct XAnimDeltaPartQuat2 { uint16_t size; @@ -5695,48 +5418,42 @@ namespace T6 uint16_t _2[1]; }; - typedef tdef_align(4) int16_t XQuat[4]; + typedef tdef_align(4) int16_t XQuat[4]; struct type_align(4) XAnimDeltaPartQuatDataFrames { - XQuat *frames; + XQuat* frames; XAnimDynamicIndicesDeltaQuat indices; }; - union XAnimDeltaPartQuatData { XAnimDeltaPartQuatDataFrames frames; XQuat frame0; }; - struct XAnimDeltaPartQuat { uint16_t size; XAnimDeltaPartQuatData u; }; - union GfxColor { unsigned int packed; char array[4]; }; - union PackedTexCoords { unsigned int packed; }; - union PackedUnitVec { unsigned int packed; }; - struct type_align(16) GfxPackedVertex { vec3_t xyz; @@ -5747,7 +5464,6 @@ namespace T6 PackedUnitVec tangent; }; - struct XRigidVertList { uint16_t boneOffset; @@ -5757,7 +5473,6 @@ namespace T6 XSurfaceCollisionTree* collisionTree; }; - struct XModelCollTri_s { vec4_t plane; @@ -5767,7 +5482,6 @@ namespace T6 typedef tdef_align(16) PhysGeomInfo PhysGeomInfo16; - struct PhysGeomList { unsigned int count; @@ -5794,21 +5508,18 @@ namespace T6 unsigned int (__stdcall *Release)(IUnknown *this); };*/ - struct MaterialStreamRouting { char source; char dest; }; - struct MaterialVertexStreamRouting { MaterialStreamRouting data[16]; - void/*ID3D11InputLayout*/* decl[20]; + void /*ID3D11InputLayout*/* decl[20]; }; - struct MaterialVertexDeclaration { char streamCount; @@ -5817,7 +5528,6 @@ namespace T6 MaterialVertexStreamRouting routing; }; - union MaterialArgumentLocation { uint16_t offset; @@ -5829,7 +5539,6 @@ namespace T6 }; }; - struct MaterialArgumentCodeConst { uint16_t index; @@ -5837,7 +5546,6 @@ namespace T6 char rowCount; }; - union MaterialArgumentDef { const float (*literalConst)[4]; @@ -5861,7 +5569,6 @@ namespace T6 MLT_ARG_COUNT = 0x8, }; - struct MaterialShaderArgument { uint16_t type; @@ -5888,7 +5595,7 @@ namespace T6 const char* secondaryname; unsigned int assetId; const char* assetFileName; - unsigned int flags0; // Bits 15/16 are SndAliasType + unsigned int flags0; // Bits 15/16 are SndAliasType unsigned int flags1; unsigned int duck; unsigned int contextType; @@ -5924,7 +5631,6 @@ namespace T6 char duckGroup; }; - struct type_align(4) pathlink_s { float fDist; @@ -5935,7 +5641,6 @@ namespace T6 char ubBadPlaceCount[5]; }; - struct GfxAabbTree { vec3_t mins; @@ -5948,7 +5653,6 @@ namespace T6 int childrenOffset; }; - struct GfxPortalWritable { bool isQueued; @@ -5959,7 +5663,6 @@ namespace T6 GfxPortal* queuedParent; }; - struct DpvsPlane { vec4_t coeffs; @@ -5967,7 +5670,6 @@ namespace T6 char pad; }; - struct GfxPortal { GfxPortalWritable writable; @@ -5979,13 +5681,11 @@ namespace T6 vec3_t bounds[2]; }; - struct GfxReflectionProbeVolumeData { vec4_t volumePlanes[6]; }; - struct SSkinShaders { char_align128* pixelShaderAlign; @@ -5995,7 +5695,6 @@ namespace T6 int vertexShaderSize; }; - struct SSkinModel { int numVerts; @@ -6004,7 +5703,6 @@ namespace T6 uint16_t* tris; }; - struct SSkinAnim { int bones; @@ -6013,13 +5711,11 @@ namespace T6 float_align128* data; }; - struct half { uint16_t v; }; - union half4 { struct @@ -6033,7 +5729,6 @@ namespace T6 // uint64_t v; }; - union half2 { struct @@ -6045,7 +5740,6 @@ namespace T6 unsigned int v; }; - struct type_align(4) SSkinVert { half4 pos_bone; @@ -6053,7 +5747,6 @@ namespace T6 half2 uv; }; - struct GfxLightRegionHull { float kdopMidPoint[9]; @@ -6062,7 +5755,6 @@ namespace T6 GfxLightRegionAxis* axis; }; - struct GenericEventScript { ScriptCondition* prerequisites; @@ -6075,7 +5767,6 @@ namespace T6 GenericEventScript* next; }; - enum dvarType_t { DVAR_TYPE_INVALID = 0x0, @@ -6094,7 +5785,6 @@ namespace T6 DVAR_TYPE_COUNT = 0xD, }; - union DvarValue { bool enabled; @@ -6108,7 +5798,6 @@ namespace T6 char color[4]; }; - union DvarLimits { struct @@ -6142,7 +5831,6 @@ namespace T6 } vector; }; - struct type_align(8) dvar_t { const char* name; @@ -6158,7 +5846,6 @@ namespace T6 dvar_t* hashNext; }; - union textDefData_t { focusItemDef_s* focusItemDef; @@ -6166,7 +5853,6 @@ namespace T6 void* data; }; - struct textDef_s { rectDef_s textRect[1]; @@ -6191,13 +5877,11 @@ namespace T6 textDefData_t textTypeData; }; - struct imageDef_s { ExpressionStatement materialExp; }; - union focusDefData_t { listBoxDef_s* listBox; @@ -6208,7 +5892,6 @@ namespace T6 void* data; }; - struct focusItemDef_s { const char* mouseEnterText; @@ -6219,13 +5902,11 @@ namespace T6 focusDefData_t focusTypeData; }; - struct ownerDrawDef_s { ExpressionStatement dataExp; }; - struct rectData_s { ExpressionStatement rectXExp; @@ -6234,7 +5915,6 @@ namespace T6 ExpressionStatement rectHExp; }; - struct animParamsDef_t { const char* name; @@ -6249,7 +5929,6 @@ namespace T6 GenericEventHandler* onEvent; }; - struct UIAnimInfo { int animStateCount; @@ -6261,7 +5940,6 @@ namespace T6 int animDuration; }; - struct flameTable { float flameVar_streamChunkGravityStart; @@ -6387,7 +6065,6 @@ namespace T6 const char* flameCooldownSound; }; - struct WeaponCamoMaterial { uint16_t replaceFlags; @@ -6397,28 +6074,24 @@ namespace T6 float shaderConsts[8]; }; - struct FxElemVec3Range { vec3_t base; vec3_t amplitude; }; - struct FxElemVelStateInFrame { FxElemVec3Range velocity; FxElemVec3Range totalDelta; }; - struct FxElemVelStateSample { FxElemVelStateInFrame local; FxElemVelStateInFrame world; }; - struct FxElemVisualState { char color[4]; @@ -6428,20 +6101,17 @@ namespace T6 float scale; }; - struct FxElemVisStateSample { FxElemVisualState base; FxElemVisualState amplitude; }; - struct FxElemMarkVisuals { Material* materials[2]; }; - struct FxTrailDef { int scrollTimeMsec; @@ -6453,7 +6123,6 @@ namespace T6 uint16_t* inds; }; - struct FxSpotLightDef { float fovInnerFraction; @@ -6461,7 +6130,6 @@ namespace T6 float endRadius; }; - struct ddlStructDef_t { const char* name; @@ -6471,7 +6139,6 @@ namespace T6 ddlHash_t* hashTable; }; - struct ddlEnumDef_t { const char* name; @@ -6480,7 +6147,6 @@ namespace T6 ddlHash_t* hashTable; }; - struct GlassDef { const char* name; @@ -6500,7 +6166,6 @@ namespace T6 FxEffectDef* shatterEffect; }; - struct XSurfaceCollisionTree { vec3_t trans; @@ -6511,7 +6176,6 @@ namespace T6 XSurfaceCollisionLeaf* leafs; }; - struct PhysGeomInfo { BrushWrapper* brush; @@ -6525,7 +6189,6 @@ namespace T6 { };*/ - struct GfxLightRegionAxis { vec3_t dir; @@ -6533,7 +6196,6 @@ namespace T6 float halfSize; }; - struct ScriptCondition { bool fireOnTrue; @@ -6542,20 +6204,17 @@ namespace T6 ScriptCondition* next; }; - struct textExp_s { ExpressionStatement textExp; }; - struct gameMsgDef_s { int gameMsgWindowIndex; int gameMsgWindowMode; }; - struct columnInfo_s { int elementStyle; @@ -6563,7 +6222,6 @@ namespace T6 rectDef_s rect; }; - struct listBoxDef_s { int mousePos; @@ -6593,7 +6251,6 @@ namespace T6 int rowCount; }; - struct multiDef_s { const char* dvarList[32]; @@ -6604,7 +6261,6 @@ namespace T6 int strDef; }; - struct profileMultiDef_s { const char* profileVarList[32]; @@ -6615,7 +6271,6 @@ namespace T6 int strDef; }; - struct editFieldDef_s { int cursorPos[1]; @@ -6629,13 +6284,11 @@ namespace T6 int paintOffset; }; - struct enumDvarDef_s { const char* enumDvarName; }; - struct FxTrailVertex { vec2_t pos; @@ -6643,7 +6296,6 @@ namespace T6 float texCoord; }; - struct ddlMemberDef_t { const char* name; @@ -6659,21 +6311,18 @@ namespace T6 int permission; }; - struct ddlHash_t { int hash; int index; }; - struct XSurfaceCollisionAabb { uint16_t mins[3]; uint16_t maxs[3]; }; - struct type_align(16) XSurfaceCollisionNode { XSurfaceCollisionAabb aabb; @@ -6681,13 +6330,11 @@ namespace T6 uint16_t childCount; }; - struct XSurfaceCollisionLeaf { uint16_t triangleBeginIndex; }; - struct type_align(16) BrushWrapper { vec3_t mins; @@ -6702,7 +6349,6 @@ namespace T6 cplane_s* planes; }; - struct MenuRow { MenuCell* cells; @@ -6713,7 +6359,6 @@ namespace T6 int name; }; - struct MenuCell { int type; diff --git a/src/Common/Image/D3DFormat.h b/src/Common/Image/D3DFormat.h index 0aba3ce71..cf03fb746 100644 --- a/src/Common/Image/D3DFormat.h +++ b/src/Common/Image/D3DFormat.h @@ -99,12 +99,10 @@ enum D3DFORMAT // 2.8 biased fixed point D3DFMT_A2B10G10R10_XR_BIAS = 119, - // Binary format indicating that the data has no inherent type D3DFMT_BINARYBUFFER = 199, - - /* -- D3D9Ex only */ + /* -- D3D9Ex only */ D3DFMT_FORCE_DWORD = 0x7fffffff -}; \ No newline at end of file +}; diff --git a/src/Common/Image/DdsTypes.h b/src/Common/Image/DdsTypes.h index 320381f91..d20f46767 100644 --- a/src/Common/Image/DdsTypes.h +++ b/src/Common/Image/DdsTypes.h @@ -4,10 +4,7 @@ constexpr uint32_t MakeFourCc(const char ch0, const char ch1, const char ch2, const char ch3) { - return static_cast(ch0) - | static_cast(ch1) << 8 - | static_cast(ch2) << 16 - | static_cast(ch3) << 24; + return static_cast(ch0) | static_cast(ch1) << 8 | static_cast(ch2) << 16 | static_cast(ch3) << 24; } enum DDP_FLAGS diff --git a/src/Common/Image/DxgiFormat.h b/src/Common/Image/DxgiFormat.h index 4f410b5d2..3e17a2047 100644 --- a/src/Common/Image/DxgiFormat.h +++ b/src/Common/Image/DxgiFormat.h @@ -22,126 +22,126 @@ const unsigned int DXGI_FORMAT_DEFINED = 1; enum DXGI_FORMAT { - DXGI_FORMAT_UNKNOWN = 0x00, - DXGI_FORMAT_R32G32B32A32_TYPELESS = 0x01, - DXGI_FORMAT_R32G32B32A32_FLOAT = 0x02, - DXGI_FORMAT_R32G32B32A32_UINT = 0x03, - DXGI_FORMAT_R32G32B32A32_SINT = 0x04, - DXGI_FORMAT_R32G32B32_TYPELESS = 0x05, - DXGI_FORMAT_R32G32B32_FLOAT = 0x06, - DXGI_FORMAT_R32G32B32_UINT = 0x07, - DXGI_FORMAT_R32G32B32_SINT = 0x08, - DXGI_FORMAT_R16G16B16A16_TYPELESS = 0x09, - DXGI_FORMAT_R16G16B16A16_FLOAT = 0x0a, - DXGI_FORMAT_R16G16B16A16_UNORM = 0x0b, - DXGI_FORMAT_R16G16B16A16_UINT = 0x0c, - DXGI_FORMAT_R16G16B16A16_SNORM = 0x0d, - DXGI_FORMAT_R16G16B16A16_SINT = 0x0e, - DXGI_FORMAT_R32G32_TYPELESS = 0x0f, - DXGI_FORMAT_R32G32_FLOAT = 0x10, - DXGI_FORMAT_R32G32_UINT = 0x11, - DXGI_FORMAT_R32G32_SINT = 0x12, - DXGI_FORMAT_R32G8X24_TYPELESS = 0x13, - DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 0x14, - DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 0x15, - DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 0x16, - DXGI_FORMAT_R10G10B10A2_TYPELESS = 0x17, - DXGI_FORMAT_R10G10B10A2_UNORM = 0x18, - DXGI_FORMAT_R10G10B10A2_UINT = 0x19, - DXGI_FORMAT_R11G11B10_FLOAT = 0x1a, - DXGI_FORMAT_R8G8B8A8_TYPELESS = 0x1b, - DXGI_FORMAT_R8G8B8A8_UNORM = 0x1c, - DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 0x1d, - DXGI_FORMAT_R8G8B8A8_UINT = 0x1e, - DXGI_FORMAT_R8G8B8A8_SNORM = 0x1f, - DXGI_FORMAT_R8G8B8A8_SINT = 0x20, - DXGI_FORMAT_R16G16_TYPELESS = 0x21, - DXGI_FORMAT_R16G16_FLOAT = 0x22, - DXGI_FORMAT_R16G16_UNORM = 0x23, - DXGI_FORMAT_R16G16_UINT = 0x24, - DXGI_FORMAT_R16G16_SNORM = 0x25, - DXGI_FORMAT_R16G16_SINT = 0x26, - DXGI_FORMAT_R32_TYPELESS = 0x27, - DXGI_FORMAT_D32_FLOAT = 0x28, - DXGI_FORMAT_R32_FLOAT = 0x29, - DXGI_FORMAT_R32_UINT = 0x2a, - DXGI_FORMAT_R32_SINT = 0x2b, - DXGI_FORMAT_R24G8_TYPELESS = 0x2c, - DXGI_FORMAT_D24_UNORM_S8_UINT = 0x2d, - DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 0x2e, - DXGI_FORMAT_X24_TYPELESS_G8_UINT = 0x2f, - DXGI_FORMAT_R8G8_TYPELESS = 0x30, - DXGI_FORMAT_R8G8_UNORM = 0x31, - DXGI_FORMAT_R8G8_UINT = 0x32, - DXGI_FORMAT_R8G8_SNORM = 0x33, - DXGI_FORMAT_R8G8_SINT = 0x34, - DXGI_FORMAT_R16_TYPELESS = 0x35, - DXGI_FORMAT_R16_FLOAT = 0x36, - DXGI_FORMAT_D16_UNORM = 0x37, - DXGI_FORMAT_R16_UNORM = 0x38, - DXGI_FORMAT_R16_UINT = 0x39, - DXGI_FORMAT_R16_SNORM = 0x3a, - DXGI_FORMAT_R16_SINT = 0x3b, - DXGI_FORMAT_R8_TYPELESS = 0x3c, - DXGI_FORMAT_R8_UNORM = 0x3d, - DXGI_FORMAT_R8_UINT = 0x3e, - DXGI_FORMAT_R8_SNORM = 0x3f, - DXGI_FORMAT_R8_SINT = 0x40, - DXGI_FORMAT_A8_UNORM = 0x41, - DXGI_FORMAT_R1_UNORM = 0x42, - DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 0x43, - DXGI_FORMAT_R8G8_B8G8_UNORM = 0x44, - DXGI_FORMAT_G8R8_G8B8_UNORM = 0x45, - DXGI_FORMAT_BC1_TYPELESS = 0x46, - DXGI_FORMAT_BC1_UNORM = 0x47, - DXGI_FORMAT_BC1_UNORM_SRGB = 0x48, - DXGI_FORMAT_BC2_TYPELESS = 0x49, - DXGI_FORMAT_BC2_UNORM = 0x4a, - DXGI_FORMAT_BC2_UNORM_SRGB = 0x4b, - DXGI_FORMAT_BC3_TYPELESS = 0x4c, - DXGI_FORMAT_BC3_UNORM = 0x4d, - DXGI_FORMAT_BC3_UNORM_SRGB = 0x4e, - DXGI_FORMAT_BC4_TYPELESS = 0x4f, - DXGI_FORMAT_BC4_UNORM = 0x50, - DXGI_FORMAT_BC4_SNORM = 0x51, - DXGI_FORMAT_BC5_TYPELESS = 0x52, - DXGI_FORMAT_BC5_UNORM = 0x53, - DXGI_FORMAT_BC5_SNORM = 0x54, - DXGI_FORMAT_B5G6R5_UNORM = 0x55, - DXGI_FORMAT_B5G5R5A1_UNORM = 0x56, - DXGI_FORMAT_B8G8R8A8_UNORM = 0x57, - DXGI_FORMAT_B8G8R8X8_UNORM = 0x58, - DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 0x59, - DXGI_FORMAT_B8G8R8A8_TYPELESS = 0x5a, - DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 0x5b, - DXGI_FORMAT_B8G8R8X8_TYPELESS = 0x5c, - DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 0x5d, - DXGI_FORMAT_BC6H_TYPELESS = 0x5e, - DXGI_FORMAT_BC6H_UF16 = 0x5f, - DXGI_FORMAT_BC6H_SF16 = 0x60, - DXGI_FORMAT_BC7_TYPELESS = 0x61, - DXGI_FORMAT_BC7_UNORM = 0x62, - DXGI_FORMAT_BC7_UNORM_SRGB = 0x63, - DXGI_FORMAT_AYUV = 0x64, - DXGI_FORMAT_Y410 = 0x65, - DXGI_FORMAT_Y416 = 0x66, - DXGI_FORMAT_NV12 = 0x67, - DXGI_FORMAT_P010 = 0x68, - DXGI_FORMAT_P016 = 0x69, - DXGI_FORMAT_420_OPAQUE = 0x6a, - DXGI_FORMAT_YUY2 = 0x6b, - DXGI_FORMAT_Y210 = 0x6c, - DXGI_FORMAT_Y216 = 0x6d, - DXGI_FORMAT_NV11 = 0x6e, - DXGI_FORMAT_AI44 = 0x6f, - DXGI_FORMAT_IA44 = 0x70, - DXGI_FORMAT_P8 = 0x71, - DXGI_FORMAT_A8P8 = 0x72, - DXGI_FORMAT_B4G4R4A4_UNORM = 0x73, + DXGI_FORMAT_UNKNOWN = 0x00, + DXGI_FORMAT_R32G32B32A32_TYPELESS = 0x01, + DXGI_FORMAT_R32G32B32A32_FLOAT = 0x02, + DXGI_FORMAT_R32G32B32A32_UINT = 0x03, + DXGI_FORMAT_R32G32B32A32_SINT = 0x04, + DXGI_FORMAT_R32G32B32_TYPELESS = 0x05, + DXGI_FORMAT_R32G32B32_FLOAT = 0x06, + DXGI_FORMAT_R32G32B32_UINT = 0x07, + DXGI_FORMAT_R32G32B32_SINT = 0x08, + DXGI_FORMAT_R16G16B16A16_TYPELESS = 0x09, + DXGI_FORMAT_R16G16B16A16_FLOAT = 0x0a, + DXGI_FORMAT_R16G16B16A16_UNORM = 0x0b, + DXGI_FORMAT_R16G16B16A16_UINT = 0x0c, + DXGI_FORMAT_R16G16B16A16_SNORM = 0x0d, + DXGI_FORMAT_R16G16B16A16_SINT = 0x0e, + DXGI_FORMAT_R32G32_TYPELESS = 0x0f, + DXGI_FORMAT_R32G32_FLOAT = 0x10, + DXGI_FORMAT_R32G32_UINT = 0x11, + DXGI_FORMAT_R32G32_SINT = 0x12, + DXGI_FORMAT_R32G8X24_TYPELESS = 0x13, + DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 0x14, + DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 0x15, + DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 0x16, + DXGI_FORMAT_R10G10B10A2_TYPELESS = 0x17, + DXGI_FORMAT_R10G10B10A2_UNORM = 0x18, + DXGI_FORMAT_R10G10B10A2_UINT = 0x19, + DXGI_FORMAT_R11G11B10_FLOAT = 0x1a, + DXGI_FORMAT_R8G8B8A8_TYPELESS = 0x1b, + DXGI_FORMAT_R8G8B8A8_UNORM = 0x1c, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 0x1d, + DXGI_FORMAT_R8G8B8A8_UINT = 0x1e, + DXGI_FORMAT_R8G8B8A8_SNORM = 0x1f, + DXGI_FORMAT_R8G8B8A8_SINT = 0x20, + DXGI_FORMAT_R16G16_TYPELESS = 0x21, + DXGI_FORMAT_R16G16_FLOAT = 0x22, + DXGI_FORMAT_R16G16_UNORM = 0x23, + DXGI_FORMAT_R16G16_UINT = 0x24, + DXGI_FORMAT_R16G16_SNORM = 0x25, + DXGI_FORMAT_R16G16_SINT = 0x26, + DXGI_FORMAT_R32_TYPELESS = 0x27, + DXGI_FORMAT_D32_FLOAT = 0x28, + DXGI_FORMAT_R32_FLOAT = 0x29, + DXGI_FORMAT_R32_UINT = 0x2a, + DXGI_FORMAT_R32_SINT = 0x2b, + DXGI_FORMAT_R24G8_TYPELESS = 0x2c, + DXGI_FORMAT_D24_UNORM_S8_UINT = 0x2d, + DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 0x2e, + DXGI_FORMAT_X24_TYPELESS_G8_UINT = 0x2f, + DXGI_FORMAT_R8G8_TYPELESS = 0x30, + DXGI_FORMAT_R8G8_UNORM = 0x31, + DXGI_FORMAT_R8G8_UINT = 0x32, + DXGI_FORMAT_R8G8_SNORM = 0x33, + DXGI_FORMAT_R8G8_SINT = 0x34, + DXGI_FORMAT_R16_TYPELESS = 0x35, + DXGI_FORMAT_R16_FLOAT = 0x36, + DXGI_FORMAT_D16_UNORM = 0x37, + DXGI_FORMAT_R16_UNORM = 0x38, + DXGI_FORMAT_R16_UINT = 0x39, + DXGI_FORMAT_R16_SNORM = 0x3a, + DXGI_FORMAT_R16_SINT = 0x3b, + DXGI_FORMAT_R8_TYPELESS = 0x3c, + DXGI_FORMAT_R8_UNORM = 0x3d, + DXGI_FORMAT_R8_UINT = 0x3e, + DXGI_FORMAT_R8_SNORM = 0x3f, + DXGI_FORMAT_R8_SINT = 0x40, + DXGI_FORMAT_A8_UNORM = 0x41, + DXGI_FORMAT_R1_UNORM = 0x42, + DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 0x43, + DXGI_FORMAT_R8G8_B8G8_UNORM = 0x44, + DXGI_FORMAT_G8R8_G8B8_UNORM = 0x45, + DXGI_FORMAT_BC1_TYPELESS = 0x46, + DXGI_FORMAT_BC1_UNORM = 0x47, + DXGI_FORMAT_BC1_UNORM_SRGB = 0x48, + DXGI_FORMAT_BC2_TYPELESS = 0x49, + DXGI_FORMAT_BC2_UNORM = 0x4a, + DXGI_FORMAT_BC2_UNORM_SRGB = 0x4b, + DXGI_FORMAT_BC3_TYPELESS = 0x4c, + DXGI_FORMAT_BC3_UNORM = 0x4d, + DXGI_FORMAT_BC3_UNORM_SRGB = 0x4e, + DXGI_FORMAT_BC4_TYPELESS = 0x4f, + DXGI_FORMAT_BC4_UNORM = 0x50, + DXGI_FORMAT_BC4_SNORM = 0x51, + DXGI_FORMAT_BC5_TYPELESS = 0x52, + DXGI_FORMAT_BC5_UNORM = 0x53, + DXGI_FORMAT_BC5_SNORM = 0x54, + DXGI_FORMAT_B5G6R5_UNORM = 0x55, + DXGI_FORMAT_B5G5R5A1_UNORM = 0x56, + DXGI_FORMAT_B8G8R8A8_UNORM = 0x57, + DXGI_FORMAT_B8G8R8X8_UNORM = 0x58, + DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 0x59, + DXGI_FORMAT_B8G8R8A8_TYPELESS = 0x5a, + DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 0x5b, + DXGI_FORMAT_B8G8R8X8_TYPELESS = 0x5c, + DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 0x5d, + DXGI_FORMAT_BC6H_TYPELESS = 0x5e, + DXGI_FORMAT_BC6H_UF16 = 0x5f, + DXGI_FORMAT_BC6H_SF16 = 0x60, + DXGI_FORMAT_BC7_TYPELESS = 0x61, + DXGI_FORMAT_BC7_UNORM = 0x62, + DXGI_FORMAT_BC7_UNORM_SRGB = 0x63, + DXGI_FORMAT_AYUV = 0x64, + DXGI_FORMAT_Y410 = 0x65, + DXGI_FORMAT_Y416 = 0x66, + DXGI_FORMAT_NV12 = 0x67, + DXGI_FORMAT_P010 = 0x68, + DXGI_FORMAT_P016 = 0x69, + DXGI_FORMAT_420_OPAQUE = 0x6a, + DXGI_FORMAT_YUY2 = 0x6b, + DXGI_FORMAT_Y210 = 0x6c, + DXGI_FORMAT_Y216 = 0x6d, + DXGI_FORMAT_NV11 = 0x6e, + DXGI_FORMAT_AI44 = 0x6f, + DXGI_FORMAT_IA44 = 0x70, + DXGI_FORMAT_P8 = 0x71, + DXGI_FORMAT_A8P8 = 0x72, + DXGI_FORMAT_B4G4R4A4_UNORM = 0x73, - DXGI_FORMAT_P208 = 0x82, - DXGI_FORMAT_V208 = 0x83, - DXGI_FORMAT_V408 = 0x84, + DXGI_FORMAT_P208 = 0x82, + DXGI_FORMAT_V208 = 0x83, + DXGI_FORMAT_V408 = 0x84, - DXGI_FORMAT_FORCE_UINT = 0xffffffff, -}; \ No newline at end of file + DXGI_FORMAT_FORCE_UINT = 0xffffffff, +}; diff --git a/src/Common/Image/ImageFormat.cpp b/src/Common/Image/ImageFormat.cpp index f13918a84..ed043cbea 100644 --- a/src/Common/Image/ImageFormat.cpp +++ b/src/Common/Image/ImageFormat.cpp @@ -22,10 +22,18 @@ DXGI_FORMAT ImageFormat::GetDxgiFormat() const return m_dxgi_format; } -ImageFormatUnsigned::ImageFormatUnsigned(const ImageFormatId id, const D3DFORMAT d3dFormat, const DXGI_FORMAT dxgiFormat, - const unsigned bitsPerPixel, const unsigned rOffset, const unsigned rSize, - const unsigned gOffset, const unsigned gSize, const unsigned bOffset, - const unsigned bSize, const unsigned aOffset, const unsigned aSize) +ImageFormatUnsigned::ImageFormatUnsigned(const ImageFormatId id, + const D3DFORMAT d3dFormat, + const DXGI_FORMAT dxgiFormat, + const unsigned bitsPerPixel, + const unsigned rOffset, + const unsigned rSize, + const unsigned gOffset, + const unsigned gSize, + const unsigned bOffset, + const unsigned bSize, + const unsigned aOffset, + const unsigned aSize) : ImageFormat(id, d3dFormat, dxgiFormat), m_bits_per_pixel(bitsPerPixel), m_r_offset(rOffset), @@ -53,8 +61,7 @@ size_t ImageFormatUnsigned::GetPitch(const unsigned mipLevel, const unsigned wid return mipWidth * m_bits_per_pixel / 8; } -size_t ImageFormatUnsigned::GetSizeOfMipLevel(const unsigned mipLevel, const unsigned width, const unsigned height, - const unsigned depth) const +size_t ImageFormatUnsigned::GetSizeOfMipLevel(const unsigned mipLevel, const unsigned width, const unsigned height, const unsigned depth) const { unsigned mipWidth = width >> mipLevel; unsigned mipHeight = height >> mipLevel; @@ -70,8 +77,8 @@ size_t ImageFormatUnsigned::GetSizeOfMipLevel(const unsigned mipLevel, const uns return mipWidth * mipHeight * mipDepth * m_bits_per_pixel / 8; } -ImageFormatBlockCompressed::ImageFormatBlockCompressed(const ImageFormatId id, const D3DFORMAT d3dFormat, const DXGI_FORMAT dxgiFormat, - const unsigned blockSize, const unsigned bitsPerBlock) +ImageFormatBlockCompressed::ImageFormatBlockCompressed( + const ImageFormatId id, const D3DFORMAT d3dFormat, const DXGI_FORMAT dxgiFormat, const unsigned blockSize, const unsigned bitsPerBlock) : ImageFormat(id, d3dFormat, dxgiFormat), m_block_size(blockSize), m_bits_per_block(bitsPerBlock) @@ -95,8 +102,7 @@ size_t ImageFormatBlockCompressed::GetPitch(const unsigned mipLevel, const unsig return blockCount * m_bits_per_block / 8; } -size_t ImageFormatBlockCompressed::GetSizeOfMipLevel(const unsigned mipLevel, const unsigned width, - const unsigned height, const unsigned depth) const +size_t ImageFormatBlockCompressed::GetSizeOfMipLevel(const unsigned mipLevel, const unsigned width, const unsigned height, const unsigned depth) const { unsigned mipWidth = width >> mipLevel; unsigned mipHeight = height >> mipLevel; @@ -109,9 +115,7 @@ size_t ImageFormatBlockCompressed::GetSizeOfMipLevel(const unsigned mipLevel, co if (mipDepth == 0) mipDepth = 1; - const unsigned blockCount = ((mipWidth + m_block_size - 1) / m_block_size) - * ((mipHeight + m_block_size - 1) / m_block_size) - * mipDepth; + const unsigned blockCount = ((mipWidth + m_block_size - 1) / m_block_size) * ((mipHeight + m_block_size - 1) / m_block_size) * mipDepth; return blockCount * m_bits_per_block / 8; } @@ -138,10 +142,13 @@ bool ImageFormatUnsigned::HasA() const const ImageFormatUnsigned ImageFormat::FORMAT_R8_G8_B8(ImageFormatId::R8_G8_B8, D3DFMT_R8G8B8, DXGI_FORMAT_UNKNOWN, 24, 0, 8, 8, 8, 16, 8, 0, 0); const ImageFormatUnsigned ImageFormat::FORMAT_B8_G8_R8_X8(ImageFormatId::B8_G8_R8_X8, D3DFMT_X8R8G8B8, DXGI_FORMAT_B8G8R8X8_UNORM, 32, 16, 8, 8, 8, 0, 8, 0, 0); -const ImageFormatUnsigned ImageFormat::FORMAT_R8_G8_B8_A8(ImageFormatId::R8_G8_B8_A8, D3DFMT_A8B8G8R8, DXGI_FORMAT_R8G8B8A8_UNORM, 32, 0, 8, 8, 8, 16, 8, 24, 8); -const ImageFormatUnsigned ImageFormat::FORMAT_B8_G8_R8_A8(ImageFormatId::B8_G8_R8_A8, D3DFMT_A8R8G8B8, DXGI_FORMAT_B8G8R8A8_UNORM, 32, 16, 8, 8, 8, 0, 8, 24, 8); +const ImageFormatUnsigned + ImageFormat::FORMAT_R8_G8_B8_A8(ImageFormatId::R8_G8_B8_A8, D3DFMT_A8B8G8R8, DXGI_FORMAT_R8G8B8A8_UNORM, 32, 0, 8, 8, 8, 16, 8, 24, 8); +const ImageFormatUnsigned + ImageFormat::FORMAT_B8_G8_R8_A8(ImageFormatId::B8_G8_R8_A8, D3DFMT_A8R8G8B8, DXGI_FORMAT_B8G8R8A8_UNORM, 32, 16, 8, 8, 8, 0, 8, 24, 8); const ImageFormatUnsigned ImageFormat::FORMAT_A8(ImageFormatId::A8, D3DFMT_A8, DXGI_FORMAT_A8_UNORM, 8, 0, 0, 0, 0, 0, 0, 0, 8); -const ImageFormatUnsigned ImageFormat::FORMAT_R16_G16_B16_A16_FLOAT(ImageFormatId::R16_G16_B16_A16_FLOAT, D3DFMT_A16B16G16R16F, DXGI_FORMAT_R16G16B16A16_FLOAT, 128, 0, 0, 0, 0, 0, 0, 0, 8); +const ImageFormatUnsigned ImageFormat::FORMAT_R16_G16_B16_A16_FLOAT( + ImageFormatId::R16_G16_B16_A16_FLOAT, D3DFMT_A16B16G16R16F, DXGI_FORMAT_R16G16B16A16_FLOAT, 128, 0, 0, 0, 0, 0, 0, 0, 8); const ImageFormatUnsigned ImageFormat::FORMAT_R8(ImageFormatId::R8, D3DFMT_L8, DXGI_FORMAT_R8_UNORM, 8, 0, 8, 0, 0, 0, 0, 0, 0); const ImageFormatUnsigned ImageFormat::FORMAT_R8_A8(ImageFormatId::R8_A8, D3DFMT_A8L8, DXGI_FORMAT_UNKNOWN, 16, 0, 8, 0, 0, 0, 0, 8, 8); const ImageFormatBlockCompressed ImageFormat::FORMAT_BC1(ImageFormatId::BC1, D3DFMT_DXT1, DXGI_FORMAT_BC1_UNORM, 4, 64); @@ -150,8 +157,7 @@ const ImageFormatBlockCompressed ImageFormat::FORMAT_BC3(ImageFormatId::BC3, D3D const ImageFormatBlockCompressed ImageFormat::FORMAT_BC4(ImageFormatId::BC4, D3DFMT_UNKNOWN, DXGI_FORMAT_BC4_UNORM, 4, 64); const ImageFormatBlockCompressed ImageFormat::FORMAT_BC5(ImageFormatId::BC5, D3DFMT_UNKNOWN, DXGI_FORMAT_BC5_UNORM, 4, 128); -const ImageFormat* const ImageFormat::ALL_FORMATS[static_cast(ImageFormatId::MAX)] -{ +const ImageFormat* const ImageFormat::ALL_FORMATS[static_cast(ImageFormatId::MAX)]{ &FORMAT_R8_G8_B8, &FORMAT_B8_G8_R8_X8, &FORMAT_R8_G8_B8_A8, diff --git a/src/Common/Image/ImageFormat.h b/src/Common/Image/ImageFormat.h index 70b559af6..66b0435a4 100644 --- a/src/Common/Image/ImageFormat.h +++ b/src/Common/Image/ImageFormat.h @@ -1,10 +1,11 @@ #pragma once -#include -#include #include "D3DFormat.h" #include "DxgiFormat.h" +#include +#include + enum class ImageFormatId { UNKNOWN = -1, @@ -60,7 +61,7 @@ class ImageFormat static const ImageFormatUnsigned FORMAT_R8_G8_B8_A8; static const ImageFormatUnsigned FORMAT_B8_G8_R8_A8; static const ImageFormatUnsigned FORMAT_A8; - static const ImageFormatUnsigned FORMAT_R16_G16_B16_A16_FLOAT; //TODO: Float not unsigned + static const ImageFormatUnsigned FORMAT_R16_G16_B16_A16_FLOAT; // TODO: Float not unsigned static const ImageFormatUnsigned FORMAT_R8; static const ImageFormatUnsigned FORMAT_R8_A8; static const ImageFormatBlockCompressed FORMAT_BC1; @@ -84,9 +85,18 @@ class ImageFormatUnsigned final : public ImageFormat unsigned m_a_offset; unsigned m_a_size; - ImageFormatUnsigned(ImageFormatId id, D3DFORMAT d3dFormat, DXGI_FORMAT dxgiFormat, unsigned bitsPerPixel, unsigned rOffset, - unsigned rSize, unsigned gOffset, unsigned gSize, unsigned bOffset, unsigned bSize, - unsigned aOffset, unsigned aSize); + ImageFormatUnsigned(ImageFormatId id, + D3DFORMAT d3dFormat, + DXGI_FORMAT dxgiFormat, + unsigned bitsPerPixel, + unsigned rOffset, + unsigned rSize, + unsigned gOffset, + unsigned gSize, + unsigned bOffset, + unsigned bSize, + unsigned aOffset, + unsigned aSize); ImageFormatType GetType() const override; size_t GetPitch(unsigned mipLevel, unsigned width) const override; diff --git a/src/Common/Image/IwiTypes.h b/src/Common/Image/IwiTypes.h index f0f0794e9..545861cae 100644 --- a/src/Common/Image/IwiTypes.h +++ b/src/Common/Image/IwiTypes.h @@ -54,7 +54,7 @@ namespace iwi6 IMG_FLAG_RENDER_TARGET = 1 << 17, IMG_FLAG_SYSTEMMEM = 1 << 18 }; -} +} // namespace iwi6 // IW4 namespace iwi8 @@ -122,7 +122,7 @@ namespace iwi8 IMG_FLAG_RENDER_TARGET = 1 << 25, IMG_FLAG_SYSTEMMEM = 1 << 26 }; -} +} // namespace iwi8 // T5 namespace iwi13 @@ -177,7 +177,7 @@ namespace iwi13 IMG_FLAG_SYSTEMMEM = 1 << 18, }; -} +} // namespace iwi13 // T6 namespace iwi27 @@ -232,4 +232,4 @@ namespace iwi27 IMG_FLAG_MULTISAMPLE = 1 << 18, }; -} +} // namespace iwi27 diff --git a/src/Common/Image/Texture.cpp b/src/Common/Image/Texture.cpp index 79de68116..393942947 100644 --- a/src/Common/Image/Texture.cpp +++ b/src/Common/Image/Texture.cpp @@ -260,8 +260,7 @@ Texture3D::Texture3D(const ImageFormat* format, const unsigned width, const unsi { } -Texture3D::Texture3D(const ImageFormat* format, const unsigned width, const unsigned height, const unsigned depth, - const bool mipMaps) +Texture3D::Texture3D(const ImageFormat* format, const unsigned width, const unsigned height, const unsigned depth, const bool mipMaps) : Texture(format, mipMaps) { m_width = width; diff --git a/src/Common/Image/Texture.h b/src/Common/Image/Texture.h index 8df7cf45b..519041a49 100644 --- a/src/Common/Image/Texture.h +++ b/src/Common/Image/Texture.h @@ -1,5 +1,6 @@ #pragma once #include "ImageFormat.h" + #include enum class TextureType @@ -123,4 +124,4 @@ class Texture3D final : public Texture uint8_t* GetBufferForMipLevel(int mipLevel, int face) override; int GetMipMapCount() const override; -}; \ No newline at end of file +}; diff --git a/src/Common/Image/TextureConverter.cpp b/src/Common/Image/TextureConverter.cpp index 7a9cf0e15..a2ab8545a 100644 --- a/src/Common/Image/TextureConverter.cpp +++ b/src/Common/Image/TextureConverter.cpp @@ -44,8 +44,7 @@ void TextureConverter::SetPixelFunctions(const unsigned inBitCount, const unsign for (auto pixelOffset = 0u; pixelOffset < bitCount; pixelOffset += 8) { - result |= (static_cast(*(static_cast(offset) + (pixelOffset / 8))) << - pixelOffset); + result |= (static_cast(*(static_cast(offset) + (pixelOffset / 8))) << pixelOffset); } return result; @@ -99,9 +98,7 @@ void TextureConverter::SetPixelFunctions(const unsigned inBitCount, const unsign else { assert(false); - m_write_pixel_func = [](void* offset, uint64_t pixel, unsigned bitCount) - { - }; + m_write_pixel_func = [](void* offset, uint64_t pixel, unsigned bitCount) {}; } break; } @@ -120,18 +117,16 @@ void TextureConverter::CreateOutputTexture() switch (m_input_texture->GetTextureType()) { case TextureType::T_2D: - m_output_texture = new Texture2D(m_output_format, m_input_texture->GetWidth(), m_input_texture->GetHeight(), - m_input_texture->HasMipMaps()); + m_output_texture = new Texture2D(m_output_format, m_input_texture->GetWidth(), m_input_texture->GetHeight(), m_input_texture->HasMipMaps()); break; case TextureType::T_CUBE: - m_output_texture = new TextureCube(m_output_format, m_input_texture->GetWidth(), m_input_texture->GetHeight(), - m_input_texture->HasMipMaps()); + m_output_texture = new TextureCube(m_output_format, m_input_texture->GetWidth(), m_input_texture->GetHeight(), m_input_texture->HasMipMaps()); break; case TextureType::T_3D: - m_output_texture = new Texture3D(m_output_format, m_input_texture->GetWidth(), m_input_texture->GetHeight(), - m_input_texture->GetDepth(), m_input_texture->HasMipMaps()); + m_output_texture = new Texture3D( + m_output_format, m_input_texture->GetWidth(), m_input_texture->GetHeight(), m_input_texture->GetDepth(), m_input_texture->HasMipMaps()); break; default: assert(false); @@ -166,8 +161,7 @@ void TextureConverter::ReorderUnsignedToUnsigned() const const auto outputBytePerPixel = outputFormat->m_bits_per_pixel / 8; auto outputOffset = 0u; - for (auto inputOffset = 0u; inputOffset < mipLevelSize; inputOffset += inputBytePerPixel, outputOffset += - outputBytePerPixel) + for (auto inputOffset = 0u; inputOffset < mipLevelSize; inputOffset += inputBytePerPixel, outputOffset += outputBytePerPixel) { uint64_t outPixel = 0; const auto inPixel = m_read_pixel_func(&inputBuffer[inputOffset], inputFormat->m_bits_per_pixel); @@ -196,9 +190,7 @@ void TextureConverter::ConvertUnsignedToUnsigned() SetPixelFunctions(inputFormat->m_bits_per_pixel, outputFormat->m_bits_per_pixel); - if (inputFormat->m_r_size == outputFormat->m_r_size - && inputFormat->m_g_size == outputFormat->m_g_size - && inputFormat->m_b_size == outputFormat->m_b_size + if (inputFormat->m_r_size == outputFormat->m_r_size && inputFormat->m_g_size == outputFormat->m_g_size && inputFormat->m_b_size == outputFormat->m_b_size && inputFormat->m_a_size == outputFormat->m_a_size) { ReorderUnsignedToUnsigned(); @@ -214,8 +206,7 @@ Texture* TextureConverter::Convert() { CreateOutputTexture(); - if (m_input_format->GetType() == ImageFormatType::UNSIGNED - && m_output_format->GetType() == ImageFormatType::UNSIGNED) + if (m_input_format->GetType() == ImageFormatType::UNSIGNED && m_output_format->GetType() == ImageFormatType::UNSIGNED) { ConvertUnsignedToUnsigned(); } diff --git a/src/Common/Image/TextureConverter.h b/src/Common/Image/TextureConverter.h index b1cacfb92..f499549f6 100644 --- a/src/Common/Image/TextureConverter.h +++ b/src/Common/Image/TextureConverter.h @@ -1,9 +1,9 @@ #pragma once -#include - #include "Texture.h" +#include + class TextureConverter { Texture* m_input_texture; @@ -23,8 +23,7 @@ class TextureConverter void ConvertUnsignedToUnsigned(); public: - TextureConverter(Texture* inputTexture, const ImageFormat* targetFormat); Texture* Convert(); -}; \ No newline at end of file +}; diff --git a/src/Common/StateMap/StateMapLayout.cpp b/src/Common/StateMap/StateMapLayout.cpp index fc07b265f..058d3ea41 100644 --- a/src/Common/StateMap/StateMapLayout.cpp +++ b/src/Common/StateMap/StateMapLayout.cpp @@ -37,10 +37,12 @@ namespace state_map for (auto& resultVar : entry.m_result_vars) { - const auto correspondingVar = std::find_if(layout.m_var_layout.m_vars.begin(), layout.m_var_layout.m_vars.end(), [&resultVar](const StateMapLayoutVar& var) - { - return var.m_name == resultVar; - }); + const auto correspondingVar = std::find_if(layout.m_var_layout.m_vars.begin(), + layout.m_var_layout.m_vars.end(), + [&resultVar](const StateMapLayoutVar& var) + { + return var.m_name == resultVar; + }); // Has to have a corresponding var assert(correspondingVar != layout.m_var_layout.m_vars.end()); @@ -48,7 +50,7 @@ namespace state_map } } #endif -} +} // namespace state_map StateMapLayoutEntry::StateMapLayoutEntry(std::string name, const size_t stateBitsIndex, const size_t stateBitsMask, std::vector resultVars) : m_name(std::move(name)), diff --git a/src/Common/StateMap/StateMapLayout.h b/src/Common/StateMap/StateMapLayout.h index e68c1492e..9bcb6166b 100644 --- a/src/Common/StateMap/StateMapLayout.h +++ b/src/Common/StateMap/StateMapLayout.h @@ -60,4 +60,4 @@ namespace state_map const StateMapLayoutEntries& m_entry_layout; const StateMapLayoutVars& m_var_layout; }; -} +} // namespace state_map diff --git a/src/Common/Utils/HalfFloat.cpp b/src/Common/Utils/HalfFloat.cpp index 1261b4a61..663fefa1c 100644 --- a/src/Common/Utils/HalfFloat.cpp +++ b/src/Common/Utils/HalfFloat.cpp @@ -10,8 +10,7 @@ float HalfFloat::ToFloat(const half_float_t half) float f; } result{}; - result.u = ((half << 16) & 0x80000000) | (((((half << 14) & 0xFFFC000) - - (~(half << 14) & 0x10000000)) ^ 0x80000000) >> 1); + result.u = ((half << 16) & 0x80000000) | (((((half << 14) & 0xFFFC000) - (~(half << 14) & 0x10000000)) ^ 0x80000000) >> 1); return result.f; } diff --git a/src/Common/Utils/HalfFloat.h b/src/Common/Utils/HalfFloat.h index 1729228f8..60827e0d9 100644 --- a/src/Common/Utils/HalfFloat.h +++ b/src/Common/Utils/HalfFloat.h @@ -11,4 +11,4 @@ class HalfFloat public: static float ToFloat(half_float_t half); static half_float_t ToHalf(float f); -}; \ No newline at end of file +}; diff --git a/src/Common/Utils/Pack.cpp b/src/Common/Utils/Pack.cpp index 42f61ca3c..fbee907eb 100644 --- a/src/Common/Utils/Pack.cpp +++ b/src/Common/Utils/Pack.cpp @@ -1,10 +1,10 @@ #include "Pack.h" +#include "HalfFloat.h" + #include #include -#include "HalfFloat.h" - union PackUtil32 { uint32_t u; @@ -16,8 +16,7 @@ union PackUtil32 uint32_t Pack32::Vec2PackTexCoords(const float* in) { - return static_cast(HalfFloat::ToHalf(in[0])) << 16 - | HalfFloat::ToHalf(in[1]); + return static_cast(HalfFloat::ToHalf(in[0])) << 16 | HalfFloat::ToHalf(in[1]); } uint32_t Pack32::Vec3PackUnitVec(const float* in) @@ -28,10 +27,8 @@ uint32_t Pack32::Vec3PackUnitVec(const float* in) uint32_t Pack32::Vec4PackGfxColor(const float* in) { - return static_cast(std::clamp(in[0], 0.0f, 1.0f) * 255.0f) - | static_cast(std::clamp(in[1], 0.0f, 1.0f) * 255.0f) << 8 - | static_cast(std::clamp(in[2], 0.0f, 1.0f) * 255.0f) << 16 - | static_cast(std::clamp(in[3], 0.0f, 1.0f) * 255.0f) << 24; + return static_cast(std::clamp(in[0], 0.0f, 1.0f) * 255.0f) | static_cast(std::clamp(in[1], 0.0f, 1.0f) * 255.0f) << 8 + | static_cast(std::clamp(in[2], 0.0f, 1.0f) * 255.0f) << 16 | static_cast(std::clamp(in[3], 0.0f, 1.0f) * 255.0f) << 24; } void Pack32::Vec2UnpackTexCoordsUV(const uint32_t in, float* out) @@ -65,9 +62,9 @@ void Pack32::Vec3UnpackUnitVecScaleBased(const uint32_t in, float* out) void Pack32::Vec3UnpackUnitVecThirdBased(const uint32_t in, float* out) { - PackUtil32 v0{ (in >> 0) & 0x3FF }; - PackUtil32 v1{ (in >> 10) & 0x3FF }; - PackUtil32 v2{ (in >> 20) & 0x3FF }; + PackUtil32 v0{(in >> 0) & 0x3FF}; + PackUtil32 v1{(in >> 10) & 0x3FF}; + PackUtil32 v2{(in >> 20) & 0x3FF}; v0.u = v0.u - 2 * (v0.u & 0x200) + 0x40400000; v1.u = v1.u - 2 * (v1.u & 0x200) + 0x40400000; diff --git a/src/Common/Utils/Pack.h b/src/Common/Utils/Pack.h index 7dc1fdcb3..7ef679d7d 100644 --- a/src/Common/Utils/Pack.h +++ b/src/Common/Utils/Pack.h @@ -15,4 +15,4 @@ class Pack32 static void Vec3UnpackUnitVecScaleBased(uint32_t in, float* out); static void Vec3UnpackUnitVecThirdBased(uint32_t in, float* out); static void Vec4UnpackGfxColor(uint32_t in, float* out); -}; \ No newline at end of file +}; diff --git a/src/Common/Utils/QuatInt16.h b/src/Common/Utils/QuatInt16.h index b2f660fdf..ad53e1bc5 100644 --- a/src/Common/Utils/QuatInt16.h +++ b/src/Common/Utils/QuatInt16.h @@ -11,4 +11,4 @@ class QuatInt16 public: static quat_int_16 ToInt16(float quat); static float ToFloat(quat_int_16 quat); -}; \ No newline at end of file +}; diff --git a/src/Common/Utils/TypeAlignment.h b/src/Common/Utils/TypeAlignment.h index 15192f08f..58733124d 100644 --- a/src/Common/Utils/TypeAlignment.h +++ b/src/Common/Utils/TypeAlignment.h @@ -38,4 +38,4 @@ #define gcc_align(x) __attribute__((__aligned__(x))) #endif #endif -#endif \ No newline at end of file +#endif diff --git a/src/Common/Zone/ZoneTypes.h b/src/Common/Zone/ZoneTypes.h index a52d0f392..3b922260f 100644 --- a/src/Common/Zone/ZoneTypes.h +++ b/src/Common/Zone/ZoneTypes.h @@ -25,4 +25,4 @@ constexpr uint16_t SCR_STRING_MAX = UINT16_MAX; typedef int block_t; typedef int asset_type_t; -typedef unsigned int zone_priority_t; \ No newline at end of file +typedef unsigned int zone_priority_t; diff --git a/src/Crypto/Crypto.cpp b/src/Crypto/Crypto.cpp index 94a3cfb4a..4ee69ce40 100644 --- a/src/Crypto/Crypto.cpp +++ b/src/Crypto/Crypto.cpp @@ -1,8 +1,9 @@ #include "Crypto.h" + #include "Impl/AlgorithmRSA.h" #include "Impl/AlgorithmSHA1.h" -#include "Impl/AlgorithmSalsa20.h" #include "Impl/AlgorithmSHA256.h" +#include "Impl/AlgorithmSalsa20.h" std::unique_ptr Crypto::CreateSHA1() { @@ -22,4 +23,4 @@ std::unique_ptr Crypto::CreateSalsa20(const uint8_t* keyBytes, co std::unique_ptr Crypto::CreateRSA(const IPublicKeyAlgorithm::HashingAlgorithm hashingAlgorithm, const RSAPaddingMode paddingMode) { return std::make_unique(hashingAlgorithm, paddingMode); -} \ No newline at end of file +} diff --git a/src/Crypto/Crypto.h b/src/Crypto/Crypto.h index 910f49464..40f997528 100644 --- a/src/Crypto/Crypto.h +++ b/src/Crypto/Crypto.h @@ -1,12 +1,11 @@ #pragma once -#include -#include - - #include "IHashFunction.h" -#include "IStreamCipher.h" #include "IPublicKeyAlgorithm.h" +#include "IStreamCipher.h" + +#include +#include class Crypto { diff --git a/src/Crypto/IPublicKeyAlgorithm.h b/src/Crypto/IPublicKeyAlgorithm.h index 039697518..9764e0a0d 100644 --- a/src/Crypto/IPublicKeyAlgorithm.h +++ b/src/Crypto/IPublicKeyAlgorithm.h @@ -1,7 +1,7 @@ #pragma once -#include #include +#include class IPublicKeyAlgorithm { diff --git a/src/Crypto/IStreamCipher.h b/src/Crypto/IStreamCipher.h index 75ad103c6..076f549cd 100644 --- a/src/Crypto/IStreamCipher.h +++ b/src/Crypto/IStreamCipher.h @@ -1,7 +1,7 @@ #pragma once -#include #include +#include class IStreamCipher { diff --git a/src/Crypto/Impl/AlgorithmRSA.cpp b/src/Crypto/Impl/AlgorithmRSA.cpp index c0e84cf12..ac65adb9a 100644 --- a/src/Crypto/Impl/AlgorithmRSA.cpp +++ b/src/Crypto/Impl/AlgorithmRSA.cpp @@ -1,8 +1,9 @@ #include "AlgorithmRSA.h" -#include #include "CryptoLibrary.h" +#include + class AlgorithmRSA::AlgorithmRSAImpl { rsa_key m_key{}; @@ -11,7 +12,7 @@ class AlgorithmRSA::AlgorithmRSAImpl const ltc_hash_descriptor* GetHashDescriptor() const { - switch(m_hash) + switch (m_hash) { case HashingAlgorithm::RSA_HASH_SHA256: return &sha256_desc; @@ -24,7 +25,7 @@ class AlgorithmRSA::AlgorithmRSAImpl int GetPaddingMode() const { - switch(m_padding) + switch (m_padding) { case Crypto::RSAPaddingMode::RSA_PADDING_PKS1: return LTC_PKCS_1_V1_5; @@ -56,7 +57,7 @@ class AlgorithmRSA::AlgorithmRSAImpl { return rsa_import(keyData, keySize, &m_key) == CRYPT_OK; } - + bool Verify(const uint8_t* signedData, const size_t signedDataSize, const uint8_t* signature, const size_t signatureSize) { const ltc_hash_descriptor* hashDesc = GetHashDescriptor(); @@ -115,4 +116,4 @@ bool AlgorithmRSA::SetKey(const uint8_t* keyData, size_t keySize) bool AlgorithmRSA::Verify(const uint8_t* signedData, const size_t signedDataSize, const uint8_t* signature, const size_t signatureSize) { return m_impl->Verify(signedData, signedDataSize, signature, signatureSize); -} \ No newline at end of file +} diff --git a/src/Crypto/Impl/AlgorithmRSA.h b/src/Crypto/Impl/AlgorithmRSA.h index eb3c7d86d..f84cee0e3 100644 --- a/src/Crypto/Impl/AlgorithmRSA.h +++ b/src/Crypto/Impl/AlgorithmRSA.h @@ -1,6 +1,7 @@ #pragma once -#include "IPublicKeyAlgorithm.h" #include "Crypto.h" +#include "IPublicKeyAlgorithm.h" + #include class AlgorithmRSA final : public IPublicKeyAlgorithm diff --git a/src/Crypto/Impl/AlgorithmSHA1.cpp b/src/Crypto/Impl/AlgorithmSHA1.cpp index 881345fd9..215583839 100644 --- a/src/Crypto/Impl/AlgorithmSHA1.cpp +++ b/src/Crypto/Impl/AlgorithmSHA1.cpp @@ -1,6 +1,7 @@ #include "AlgorithmSHA1.h" #include "CryptoLibrary.h" + #include class AlgorithmSHA1::AlgorithmSHA1Impl @@ -60,4 +61,4 @@ void AlgorithmSHA1::Process(const void* input, const size_t inputSize) void AlgorithmSHA1::Finish(void* hashBuffer) { m_impl->Finish(hashBuffer); -} \ No newline at end of file +} diff --git a/src/Crypto/Impl/AlgorithmSHA256.cpp b/src/Crypto/Impl/AlgorithmSHA256.cpp index 7de8948b2..a1bf1964b 100644 --- a/src/Crypto/Impl/AlgorithmSHA256.cpp +++ b/src/Crypto/Impl/AlgorithmSHA256.cpp @@ -1,6 +1,7 @@ #include "AlgorithmSHA256.h" #include "CryptoLibrary.h" + #include class AlgorithmSHA256::Impl @@ -60,4 +61,4 @@ void AlgorithmSHA256::Process(const void* input, const size_t inputSize) void AlgorithmSHA256::Finish(void* hashBuffer) { m_impl->Finish(hashBuffer); -} \ No newline at end of file +} diff --git a/src/Crypto/Impl/AlgorithmSalsa20.cpp b/src/Crypto/Impl/AlgorithmSalsa20.cpp index 4b2869b78..2c5459d69 100644 --- a/src/Crypto/Impl/AlgorithmSalsa20.cpp +++ b/src/Crypto/Impl/AlgorithmSalsa20.cpp @@ -1,5 +1,7 @@ #include "AlgorithmSalsa20.h" + #include "salsa20.h" + #include #include @@ -25,7 +27,7 @@ class AlgorithmSalsa20::AlgorithmSalsa20Impl { assert(ivSize == 8); - if(ivSize != 8) + if (ivSize != 8) { throw std::invalid_argument("Salsa20 IV size must be 8"); } diff --git a/src/Crypto/Impl/CryptoLibrary.cpp b/src/Crypto/Impl/CryptoLibrary.cpp index 698467dab..3db797997 100644 --- a/src/Crypto/Impl/CryptoLibrary.cpp +++ b/src/Crypto/Impl/CryptoLibrary.cpp @@ -1,4 +1,5 @@ #include "CryptoLibrary.h" + #include "tommath.h" void CryptoLibrary::Init() @@ -11,4 +12,4 @@ void CryptoLibrary::Init() ltc_mp = ltm_desc; } -} \ No newline at end of file +} diff --git a/src/Crypto/Impl/CryptoLibrary.h b/src/Crypto/Impl/CryptoLibrary.h index c1d0da627..68829c418 100644 --- a/src/Crypto/Impl/CryptoLibrary.h +++ b/src/Crypto/Impl/CryptoLibrary.h @@ -7,4 +7,4 @@ class CryptoLibrary { public: static void Init(); -}; \ No newline at end of file +}; diff --git a/src/Linker/Game/IW3/ZoneCreatorIW3.cpp b/src/Linker/Game/IW3/ZoneCreatorIW3.cpp index 9c6f50128..11640bb75 100644 --- a/src/Linker/Game/IW3/ZoneCreatorIW3.cpp +++ b/src/Linker/Game/IW3/ZoneCreatorIW3.cpp @@ -1,11 +1,11 @@ #include "ZoneCreatorIW3.h" -#include - -#include "ObjLoading.h" #include "AssetLoading/AssetLoadingContext.h" -#include "Game/IW3/GameIW3.h" #include "Game/IW3/GameAssetPoolIW3.h" +#include "Game/IW3/GameIW3.h" +#include "ObjLoading.h" + +#include using namespace IW3; diff --git a/src/Linker/Game/IW3/ZoneCreatorIW3.h b/src/Linker/Game/IW3/ZoneCreatorIW3.h index b1ae2b3df..4f2590991 100644 --- a/src/Linker/Game/IW3/ZoneCreatorIW3.h +++ b/src/Linker/Game/IW3/ZoneCreatorIW3.h @@ -1,10 +1,10 @@ #pragma once -#include -#include - #include "Zone/ZoneTypes.h" #include "ZoneCreation/IZoneCreator.h" +#include +#include + namespace IW3 { class ZoneCreator final : public IZoneCreator @@ -22,4 +22,4 @@ namespace IW3 _NODISCARD bool SupportsGame(const std::string& gameName) const override; _NODISCARD std::unique_ptr CreateZoneForDefinition(ZoneCreationContext& context) const override; }; -} +} // namespace IW3 diff --git a/src/Linker/Game/IW4/ZoneCreatorIW4.cpp b/src/Linker/Game/IW4/ZoneCreatorIW4.cpp index f09468261..e9e66e799 100644 --- a/src/Linker/Game/IW4/ZoneCreatorIW4.cpp +++ b/src/Linker/Game/IW4/ZoneCreatorIW4.cpp @@ -1,10 +1,10 @@ #include "ZoneCreatorIW4.h" -#include - -#include "ObjLoading.h" -#include "Game/IW4/GameIW4.h" #include "Game/IW4/GameAssetPoolIW4.h" +#include "Game/IW4/GameIW4.h" +#include "ObjLoading.h" + +#include using namespace IW4; diff --git a/src/Linker/Game/IW4/ZoneCreatorIW4.h b/src/Linker/Game/IW4/ZoneCreatorIW4.h index ef0cbc54b..27139f68b 100644 --- a/src/Linker/Game/IW4/ZoneCreatorIW4.h +++ b/src/Linker/Game/IW4/ZoneCreatorIW4.h @@ -1,10 +1,10 @@ #pragma once -#include -#include - #include "Zone/ZoneTypes.h" #include "ZoneCreation/IZoneCreator.h" +#include +#include + namespace IW4 { class ZoneCreator final : public IZoneCreator @@ -22,4 +22,4 @@ namespace IW4 _NODISCARD bool SupportsGame(const std::string& gameName) const override; _NODISCARD std::unique_ptr CreateZoneForDefinition(ZoneCreationContext& context) const override; }; -} +} // namespace IW4 diff --git a/src/Linker/Game/IW5/ZoneCreatorIW5.cpp b/src/Linker/Game/IW5/ZoneCreatorIW5.cpp index 27d2dfb1d..b15f37a3c 100644 --- a/src/Linker/Game/IW5/ZoneCreatorIW5.cpp +++ b/src/Linker/Game/IW5/ZoneCreatorIW5.cpp @@ -1,10 +1,10 @@ #include "ZoneCreatorIW5.h" -#include - -#include "ObjLoading.h" -#include "Game/IW5/GameIW5.h" #include "Game/IW5/GameAssetPoolIW5.h" +#include "Game/IW5/GameIW5.h" +#include "ObjLoading.h" + +#include using namespace IW5; diff --git a/src/Linker/Game/IW5/ZoneCreatorIW5.h b/src/Linker/Game/IW5/ZoneCreatorIW5.h index 61f8475df..a018ecf1c 100644 --- a/src/Linker/Game/IW5/ZoneCreatorIW5.h +++ b/src/Linker/Game/IW5/ZoneCreatorIW5.h @@ -1,10 +1,10 @@ #pragma once -#include -#include - #include "Zone/ZoneTypes.h" #include "ZoneCreation/IZoneCreator.h" +#include +#include + namespace IW5 { class ZoneCreator final : public IZoneCreator @@ -22,4 +22,4 @@ namespace IW5 _NODISCARD bool SupportsGame(const std::string& gameName) const override; _NODISCARD std::unique_ptr CreateZoneForDefinition(ZoneCreationContext& context) const override; }; -} +} // namespace IW5 diff --git a/src/Linker/Game/T5/ZoneCreatorT5.cpp b/src/Linker/Game/T5/ZoneCreatorT5.cpp index 72e682e8d..e3f3d9945 100644 --- a/src/Linker/Game/T5/ZoneCreatorT5.cpp +++ b/src/Linker/Game/T5/ZoneCreatorT5.cpp @@ -1,11 +1,11 @@ #include "ZoneCreatorT5.h" -#include - -#include "ObjLoading.h" #include "AssetLoading/AssetLoadingContext.h" -#include "Game/T5/GameT5.h" #include "Game/T5/GameAssetPoolT5.h" +#include "Game/T5/GameT5.h" +#include "ObjLoading.h" + +#include using namespace T5; diff --git a/src/Linker/Game/T5/ZoneCreatorT5.h b/src/Linker/Game/T5/ZoneCreatorT5.h index 986ab8552..bbc60d3e5 100644 --- a/src/Linker/Game/T5/ZoneCreatorT5.h +++ b/src/Linker/Game/T5/ZoneCreatorT5.h @@ -1,10 +1,10 @@ #pragma once -#include -#include - #include "Zone/ZoneTypes.h" #include "ZoneCreation/IZoneCreator.h" +#include +#include + namespace T5 { class ZoneCreator final : public IZoneCreator @@ -22,4 +22,4 @@ namespace T5 _NODISCARD bool SupportsGame(const std::string& gameName) const override; _NODISCARD std::unique_ptr CreateZoneForDefinition(ZoneCreationContext& context) const override; }; -} +} // namespace T5 diff --git a/src/Linker/Game/T6/ZoneCreatorT6.cpp b/src/Linker/Game/T6/ZoneCreatorT6.cpp index a2885949e..9b70c5f75 100644 --- a/src/Linker/Game/T6/ZoneCreatorT6.cpp +++ b/src/Linker/Game/T6/ZoneCreatorT6.cpp @@ -1,12 +1,12 @@ #include "ZoneCreatorT6.h" -#include - -#include "ObjLoading.h" #include "Game/T6/CommonT6.h" -#include "Game/T6/T6.h" -#include "Game/T6/GameT6.h" #include "Game/T6/GameAssetPoolT6.h" +#include "Game/T6/GameT6.h" +#include "Game/T6/T6.h" +#include "ObjLoading.h" + +#include using namespace T6; @@ -87,12 +87,7 @@ void ZoneCreator::HandleMetadata(Zone* zone, const ZoneCreationContext& context) keyHash = Common::Com_HashKey(strValue.c_str(), 64); } - KeyValuePair kvp - { - keyHash, - Common::Com_HashKey(zone->m_name.c_str(), 64), - zone->GetMemory()->Dup(metaData->m_value.c_str()) - }; + KeyValuePair kvp{keyHash, Common::Com_HashKey(zone->m_name.c_str(), 64), zone->GetMemory()->Dup(metaData->m_value.c_str())}; kvpList.push_back(kvp); } } diff --git a/src/Linker/Game/T6/ZoneCreatorT6.h b/src/Linker/Game/T6/ZoneCreatorT6.h index 8e04d4483..20028d60c 100644 --- a/src/Linker/Game/T6/ZoneCreatorT6.h +++ b/src/Linker/Game/T6/ZoneCreatorT6.h @@ -1,10 +1,10 @@ #pragma once -#include -#include - #include "Zone/ZoneTypes.h" #include "ZoneCreation/IZoneCreator.h" +#include +#include + namespace T6 { class ZoneCreator final : public IZoneCreator @@ -23,4 +23,4 @@ namespace T6 _NODISCARD bool SupportsGame(const std::string& gameName) const override; _NODISCARD std::unique_ptr CreateZoneForDefinition(ZoneCreationContext& context) const override; }; -} +} // namespace T6 diff --git a/src/Linker/Linker.cpp b/src/Linker/Linker.cpp index 1f7df57ed..c6d2940e9 100644 --- a/src/Linker/Linker.cpp +++ b/src/Linker/Linker.cpp @@ -1,45 +1,43 @@ #include "Linker.h" -#include -#include -#include -#include -#include - -#include "Utils/ClassUtils.h" -#include "Utils/Arguments/ArgumentParser.h" -#include "ZoneLoading.h" -#include "ObjWriting.h" -#include "ObjLoading.h" -#include "SearchPath/SearchPaths.h" -#include "ObjContainer/IWD/IWD.h" -#include "LinkerArgs.h" -#include "LinkerSearchPaths.h" -#include "ZoneWriting.h" #include "Game/IW3/ZoneCreatorIW3.h" -#include "ZoneCreation/ZoneCreationContext.h" -#include "ZoneCreation/IZoneCreator.h" #include "Game/IW4/ZoneCreatorIW4.h" #include "Game/IW5/ZoneCreatorIW5.h" #include "Game/T5/ZoneCreatorT5.h" #include "Game/T6/ZoneCreatorT6.h" +#include "LinkerArgs.h" +#include "LinkerSearchPaths.h" #include "ObjContainer/IPak/IPakWriter.h" - +#include "ObjContainer/IWD/IWD.h" +#include "ObjLoading.h" +#include "ObjWriting.h" +#include "SearchPath/SearchPaths.h" +#include "Utils/Arguments/ArgumentParser.h" +#include "Utils/ClassUtils.h" #include "Utils/ObjFileStream.h" #include "Utils/StringUtils.h" #include "Zone/AssetList/AssetList.h" #include "Zone/AssetList/AssetListStream.h" #include "Zone/Definition/ZoneDefinitionStream.h" +#include "ZoneCreation/IZoneCreator.h" +#include "ZoneCreation/ZoneCreationContext.h" +#include "ZoneLoading.h" +#include "ZoneWriting.h" + +#include +#include +#include +#include +#include namespace fs = std::filesystem; -const IZoneCreator* const ZONE_CREATORS[] -{ +const IZoneCreator* const ZONE_CREATORS[]{ new IW3::ZoneCreator(), new IW4::ZoneCreator(), new IW5::ZoneCreator(), new T5::ZoneCreator(), - new T6::ZoneCreator() + new T6::ZoneCreator(), }; enum class ProjectType @@ -51,11 +49,10 @@ enum class ProjectType MAX }; -constexpr const char* PROJECT_TYPE_NAMES[static_cast(ProjectType::MAX)] -{ +constexpr const char* PROJECT_TYPE_NAMES[static_cast(ProjectType::MAX)]{ "none", "fastfile", - "ipak" + "ipak", }; class LinkerImpl final : public Linker @@ -294,7 +291,7 @@ class LinkerImpl final : public Linker if (projectType != parsedProjectType) { std::cerr << "Conflicting types in target \"" << targetName << "\": " << PROJECT_TYPE_NAMES[static_cast(projectType)] - << " != " << PROJECT_TYPE_NAMES[static_cast(parsedProjectType)] << std::endl; + << " != " << PROJECT_TYPE_NAMES[static_cast(parsedProjectType)] << std::endl; return false; } } @@ -367,7 +364,10 @@ class LinkerImpl final : public Linker return true; } - std::unique_ptr CreateZoneForDefinition(const std::string& targetName, ZoneDefinition& zoneDefinition, ISearchPath* assetSearchPath, ISearchPath* gdtSearchPath, + std::unique_ptr CreateZoneForDefinition(const std::string& targetName, + ZoneDefinition& zoneDefinition, + ISearchPath* assetSearchPath, + ISearchPath* gdtSearchPath, ISearchPath* sourceSearchPath) const { const auto context = std::make_unique(assetSearchPath, &zoneDefinition); @@ -412,7 +412,11 @@ class LinkerImpl final : public Linker return true; } - bool BuildFastFile(const std::string& projectName, const std::string& targetName, ZoneDefinition& zoneDefinition, SearchPaths& assetSearchPaths, SearchPaths& gdtSearchPaths, + bool BuildFastFile(const std::string& projectName, + const std::string& targetName, + ZoneDefinition& zoneDefinition, + SearchPaths& assetSearchPaths, + SearchPaths& gdtSearchPaths, SearchPaths& sourceSearchPaths) const { const auto zone = CreateZoneForDefinition(targetName, zoneDefinition, &assetSearchPaths, &gdtSearchPaths, &sourceSearchPaths); @@ -460,17 +464,19 @@ class LinkerImpl final : public Linker bool BuildReferencedTargets(const std::string& projectName, const std::string& targetName, const ZoneDefinition& zoneDefinition) { - return std::all_of(zoneDefinition.m_targets_to_build.begin(), zoneDefinition.m_targets_to_build.end(), [this, &projectName, &targetName](const std::string& buildTargetName) - { - if (buildTargetName == targetName) - { - std::cerr << "Cannot build target with same name: \"" << targetName << "\"\n"; - return false; - } - - std::cout << "Building referenced target \"" << buildTargetName << "\"\n"; - return BuildProject(projectName, buildTargetName); - }); + return std::all_of(zoneDefinition.m_targets_to_build.begin(), + zoneDefinition.m_targets_to_build.end(), + [this, &projectName, &targetName](const std::string& buildTargetName) + { + if (buildTargetName == targetName) + { + std::cerr << "Cannot build target with same name: \"" << targetName << "\"\n"; + return false; + } + + std::cout << "Building referenced target \"" << buildTargetName << "\"\n"; + return BuildProject(projectName, buildTargetName); + }); } bool BuildProject(const std::string& projectName, const std::string& targetName) diff --git a/src/Linker/LinkerArgs.cpp b/src/Linker/LinkerArgs.cpp index 9d19383f5..a9b2d318b 100644 --- a/src/Linker/LinkerArgs.cpp +++ b/src/Linker/LinkerArgs.cpp @@ -1,16 +1,17 @@ #include "LinkerArgs.h" -#include -#include -#include - -#include "Utils/Arguments/UsageInformation.h" #include "ObjLoading.h" #include "ObjWriting.h" +#include "Utils/Arguments/UsageInformation.h" #include "Utils/FileUtils.h" +#include +#include +#include + namespace fs = std::filesystem; +// clang-format off const CommandLineOption* const OPTION_HELP = CommandLineOption::Builder::Create() .WithShortName("?") @@ -79,11 +80,13 @@ const CommandLineOption* const OPTION_MENU_PERMISSIVE = const CommandLineOption* const OPTION_MENU_NO_OPTIMIZATION = CommandLineOption::Builder::Create() .WithLongName("menu-no-optimization") - .WithDescription("Refrain from applying optimizations to parsed menus. (Optimizations increase menu performance and size. May result in less source information when dumped though.)") + .WithDescription("Refrain from applying optimizations to parsed menus. (Optimizations increase menu performance and size. May result in less source " + "information when dumped though.)") .Build(); -const CommandLineOption* const COMMAND_LINE_OPTIONS[] -{ +// clang-format on + +const CommandLineOption* const COMMAND_LINE_OPTIONS[]{ OPTION_HELP, OPTION_VERBOSE, OPTION_BASE_FOLDER, @@ -93,7 +96,7 @@ const CommandLineOption* const COMMAND_LINE_OPTIONS[] OPTION_SOURCE_SEARCH_PATH, OPTION_LOAD, OPTION_MENU_PERMISSIVE, - OPTION_MENU_NO_OPTIMIZATION + OPTION_MENU_NO_OPTIMIZATION, }; LinkerArgs::LinkerArgs() @@ -182,14 +185,14 @@ std::set LinkerArgs::GetSearchPathsForProject(const std::set -#include -#include - -#include "Utils/ClassUtils.h" #include "Utils/Arguments/ArgumentParser.h" +#include "Utils/ClassUtils.h" #include "Zone/Zone.h" +#include +#include +#include + class LinkerArgs { public: @@ -37,12 +37,13 @@ class LinkerArgs _NODISCARD std::string GetBasePathForProject(const std::string& projectName) const; void SetDefaultBasePath(); _NODISCARD std::set GetProjectIndependentSearchPaths(const std::set& set) const; - _NODISCARD std::set GetSearchPathsForProject(const std::set& set, const std::string& gameName, const std::string& projectName) const; + _NODISCARD std::set + GetSearchPathsForProject(const std::set& set, const std::string& gameName, const std::string& projectName) const; public: std::vector m_zones_to_load; std::vector m_project_specifiers_to_build; - + std::string m_base_folder; std::string m_out_folder; bool m_base_folder_depends_on_project; @@ -67,7 +68,7 @@ class LinkerArgs _NODISCARD std::set GetProjectIndependentAssetSearchPaths() const; _NODISCARD std::set GetProjectIndependentGdtSearchPaths() const; _NODISCARD std::set GetProjectIndependentSourceSearchPaths() const; - + _NODISCARD std::set GetAssetSearchPathsForProject(const std::string& gameName, const std::string& projectName) const; _NODISCARD std::set GetGdtSearchPathsForProject(const std::string& gameName, const std::string& projectName) const; _NODISCARD std::set GetSourceSearchPathsForProject(const std::string& projectName) const; diff --git a/src/Linker/LinkerSearchPaths.cpp b/src/Linker/LinkerSearchPaths.cpp index 48ce337d6..9ae4b15c1 100644 --- a/src/Linker/LinkerSearchPaths.cpp +++ b/src/Linker/LinkerSearchPaths.cpp @@ -1,12 +1,12 @@ #include "LinkerSearchPaths.h" -#include -#include - -#include "ObjLoading.h" #include "ObjContainer/IWD/IWD.h" +#include "ObjLoading.h" #include "SearchPath/SearchPathFilesystem.h" +#include +#include + namespace fs = std::filesystem; LinkerSearchPaths::LinkerSearchPaths(const LinkerArgs& args) @@ -178,7 +178,6 @@ bool LinkerSearchPaths::BuildProjectIndependentSearchPaths() return true; } - void LinkerSearchPaths::UnloadProjectSpecificSearchPaths() { for (const auto& loadedSearchPath : m_loaded_project_search_paths) diff --git a/src/Linker/LinkerSearchPaths.h b/src/Linker/LinkerSearchPaths.h index ea5825d2c..e56f7a113 100644 --- a/src/Linker/LinkerSearchPaths.h +++ b/src/Linker/LinkerSearchPaths.h @@ -1,11 +1,10 @@ #pragma once +#include "LinkerArgs.h" #include "SearchPath/SearchPaths.h" #include #include -#include "LinkerArgs.h" - class LinkerSearchPaths { public: diff --git a/src/Linker/ZoneCreation/IZoneCreator.h b/src/Linker/ZoneCreation/IZoneCreator.h index 52e2d2007..974361e58 100644 --- a/src/Linker/ZoneCreation/IZoneCreator.h +++ b/src/Linker/ZoneCreation/IZoneCreator.h @@ -1,9 +1,9 @@ #pragma once -#include - #include "Utils/ClassUtils.h" -#include "ZoneCreationContext.h" #include "Zone/Zone.h" +#include "ZoneCreationContext.h" + +#include class IZoneCreator { diff --git a/src/Linker/ZoneCreation/ZoneCreationContext.h b/src/Linker/ZoneCreation/ZoneCreationContext.h index a1c7800c1..efccbdb78 100644 --- a/src/Linker/ZoneCreation/ZoneCreationContext.h +++ b/src/Linker/ZoneCreation/ZoneCreationContext.h @@ -1,13 +1,13 @@ #pragma once -#include -#include -#include - -#include "SearchPath/ISearchPath.h" #include "Obj/Gdt/Gdt.h" +#include "SearchPath/ISearchPath.h" #include "Zone/AssetList/AssetList.h" #include "Zone/Definition/ZoneDefinition.h" +#include +#include +#include + class ZoneCreationContext { public: diff --git a/src/ObjCommon/Csv/CsvStream.cpp b/src/ObjCommon/Csv/CsvStream.cpp index bf3747b02..9acc1c762 100644 --- a/src/ObjCommon/Csv/CsvStream.cpp +++ b/src/ObjCommon/Csv/CsvStream.cpp @@ -17,22 +17,22 @@ bool CsvInputStream::NextRow(std::vector& out) const auto c = m_stream.get(); const auto isEof = c == EOF; std::ostringstream col; - while(c != EOF) + while (c != EOF) { - if(c == CSV_SEPARATOR) + if (c == CSV_SEPARATOR) { out.emplace_back(col.str()); col.clear(); col.str(std::string()); } - else if(c == '\r') + else if (c == '\r') { c = m_stream.get(); if (c == '\n') break; col << '\r'; } - else if(c == '\n') + else if (c == '\n') { break; } @@ -44,7 +44,7 @@ bool CsvInputStream::NextRow(std::vector& out) const c = m_stream.get(); } - if(!isEof) + if (!isEof) { out.emplace_back(col.str()); } diff --git a/src/ObjCommon/Csv/CsvStream.h b/src/ObjCommon/Csv/CsvStream.h index 1e039d2e6..29bfb4404 100644 --- a/src/ObjCommon/Csv/CsvStream.h +++ b/src/ObjCommon/Csv/CsvStream.h @@ -25,4 +25,4 @@ class CsvOutputStream void WriteColumn(const std::string& value); void NextRow(); -}; \ No newline at end of file +}; diff --git a/src/ObjCommon/Game/IW3/MaterialConstantsIW3.h b/src/ObjCommon/Game/IW3/MaterialConstantsIW3.h index 0c22c5c49..d381b6f05 100644 --- a/src/ObjCommon/Game/IW3/MaterialConstantsIW3.h +++ b/src/ObjCommon/Game/IW3/MaterialConstantsIW3.h @@ -1,43 +1,16 @@ #pragma once -#include -#include - #include "Game/IW3/IW3.h" +#include +#include + namespace IW3 { - inline const char* surfaceTypeNames[] - { - "default", - "bark", - "brick", - "carpet", - "cloth", - "concrete", - "dirt", - "flesh", - "foliage", - "glass", - "grass", - "gravel", - "ice", - "metal", - "mud", - "paper", - "plaster", - "rock", - "sand", - "snow", - "water", - "wood", - "asphalt", - "ceramic", - "plastic", - "rubber", - "cushion", - "fruit", - "paintedmetal" + inline const char* surfaceTypeNames[]{ + "default", "bark", "brick", "carpet", "cloth", "concrete", "dirt", "flesh", "foliage", "glass", + "grass", "gravel", "ice", "metal", "mud", "paper", "plaster", "rock", "sand", "snow", + "water", "wood", "asphalt", "ceramic", "plastic", "rubber", "cushion", "fruit", "paintedmetal", }; static_assert(std::extent_v == SURF_TYPE_NUM); -} +} // namespace IW3 diff --git a/src/ObjCommon/Game/IW3/TechsetConstantsIW3.h b/src/ObjCommon/Game/IW3/TechsetConstantsIW3.h index 44a7878a2..145606061 100644 --- a/src/ObjCommon/Game/IW3/TechsetConstantsIW3.h +++ b/src/ObjCommon/Game/IW3/TechsetConstantsIW3.h @@ -1,15 +1,14 @@ #pragma once -#include -#include - #include "Game/IW3/CommonIW3.h" #include "Game/IW3/IW3.h" +#include +#include + namespace IW3 { - inline const char* techniqueTypeNames[] - { + inline const char* techniqueTypeNames[]{ "depth prepass", "build floatz", "build shadowmap depth", @@ -47,8 +46,7 @@ namespace IW3 }; static_assert(std::extent_v == TECHNIQUE_COUNT); - static const char* materialStreamDestinationNames[] - { + static const char* materialStreamDestinationNames[]{ "position", "normal", "color[0]", @@ -64,8 +62,7 @@ namespace IW3 }; static_assert(std::extent_v == STREAM_DST_COUNT); - static const char* materialStreamSourceNames[] - { + static const char* materialStreamSourceNames[]{ "position", "color", "texcoord[0]", @@ -74,7 +71,7 @@ namespace IW3 "texcoord[1]", "texcoord[2]", "normalTransform[0]", - "normalTransform[1]" + "normalTransform[1]", }; static_assert(std::extent_v == STREAM_SRC_COUNT); @@ -83,56 +80,23 @@ namespace IW3 return std::make_pair(Common::R_HashString(name, 0u), name); } - inline std::unordered_map knownMaterialSourceNames - { - KnownMaterialSource("colorMap"), - KnownMaterialSource("colorMap0"), - KnownMaterialSource("colorMap1"), - KnownMaterialSource("colorMap2"), - KnownMaterialSource("colorMap3"), - KnownMaterialSource("colorMap4"), - KnownMaterialSource("colorMap5"), - KnownMaterialSource("colorMap6"), - KnownMaterialSource("colorMap7"), - KnownMaterialSource("normalMap"), - KnownMaterialSource("normalMap0"), - KnownMaterialSource("normalMap1"), - KnownMaterialSource("normalMap2"), - KnownMaterialSource("normalMap3"), - KnownMaterialSource("normalMap4"), - KnownMaterialSource("normalMap5"), - KnownMaterialSource("normalMap6"), - KnownMaterialSource("normalMap7"), - KnownMaterialSource("specularMap"), - KnownMaterialSource("specularMap0"), - KnownMaterialSource("specularMap1"), - KnownMaterialSource("specularMap2"), - KnownMaterialSource("specularMap3"), - KnownMaterialSource("specularMap4"), - KnownMaterialSource("specularMap5"), - KnownMaterialSource("specularMap6"), - KnownMaterialSource("specularMap7"), - KnownMaterialSource("detailMap"), - KnownMaterialSource("detailMap0"), - KnownMaterialSource("detailMap1"), - KnownMaterialSource("detailMap2"), - KnownMaterialSource("detailMap3"), - KnownMaterialSource("detailMap4"), - KnownMaterialSource("detailMap5"), - KnownMaterialSource("detailMap6"), - KnownMaterialSource("detailMap7"), - KnownMaterialSource("attenuationMap"), - KnownMaterialSource("attenuationMap0"), - KnownMaterialSource("attenuationMap1"), - KnownMaterialSource("attenuationMap2"), - KnownMaterialSource("attenuationMap3"), - KnownMaterialSource("attenuationMap4"), - KnownMaterialSource("attenuationMap5"), - KnownMaterialSource("attenuationMap6"), - KnownMaterialSource("attenuationMap7"), - KnownMaterialSource("distortionScale"), - KnownMaterialSource("eyeOffsetParms"), - KnownMaterialSource("falloffBeginColor"), + inline std::unordered_map knownMaterialSourceNames{ + KnownMaterialSource("colorMap"), KnownMaterialSource("colorMap0"), KnownMaterialSource("colorMap1"), + KnownMaterialSource("colorMap2"), KnownMaterialSource("colorMap3"), KnownMaterialSource("colorMap4"), + KnownMaterialSource("colorMap5"), KnownMaterialSource("colorMap6"), KnownMaterialSource("colorMap7"), + KnownMaterialSource("normalMap"), KnownMaterialSource("normalMap0"), KnownMaterialSource("normalMap1"), + KnownMaterialSource("normalMap2"), KnownMaterialSource("normalMap3"), KnownMaterialSource("normalMap4"), + KnownMaterialSource("normalMap5"), KnownMaterialSource("normalMap6"), KnownMaterialSource("normalMap7"), + KnownMaterialSource("specularMap"), KnownMaterialSource("specularMap0"), KnownMaterialSource("specularMap1"), + KnownMaterialSource("specularMap2"), KnownMaterialSource("specularMap3"), KnownMaterialSource("specularMap4"), + KnownMaterialSource("specularMap5"), KnownMaterialSource("specularMap6"), KnownMaterialSource("specularMap7"), + KnownMaterialSource("detailMap"), KnownMaterialSource("detailMap0"), KnownMaterialSource("detailMap1"), + KnownMaterialSource("detailMap2"), KnownMaterialSource("detailMap3"), KnownMaterialSource("detailMap4"), + KnownMaterialSource("detailMap5"), KnownMaterialSource("detailMap6"), KnownMaterialSource("detailMap7"), + KnownMaterialSource("attenuationMap"), KnownMaterialSource("attenuationMap0"), KnownMaterialSource("attenuationMap1"), + KnownMaterialSource("attenuationMap2"), KnownMaterialSource("attenuationMap3"), KnownMaterialSource("attenuationMap4"), + KnownMaterialSource("attenuationMap5"), KnownMaterialSource("attenuationMap6"), KnownMaterialSource("attenuationMap7"), + KnownMaterialSource("distortionScale"), KnownMaterialSource("eyeOffsetParms"), KnownMaterialSource("falloffBeginColor"), KnownMaterialSource("falloffEndColor"), }; -} +} // namespace IW3 diff --git a/src/ObjCommon/Game/IW4/InfoString/EnumStrings.h b/src/ObjCommon/Game/IW4/InfoString/EnumStrings.h index fce1bdc9d..0b39203ad 100644 --- a/src/ObjCommon/Game/IW4/InfoString/EnumStrings.h +++ b/src/ObjCommon/Game/IW4/InfoString/EnumStrings.h @@ -2,16 +2,14 @@ namespace IW4 { - inline const char* szWeapTypeNames[] - { + inline const char* szWeapTypeNames[]{ "bullet", "grenade", "projectile", "riotshield", }; - inline const char* szWeapClassNames[] - { + inline const char* szWeapClassNames[]{ "rifle", "sniper", "mg", @@ -26,14 +24,12 @@ namespace IW4 "item", }; - inline const char* szWeapOverlayReticleNames[] - { + inline const char* szWeapOverlayReticleNames[]{ "none", "crosshair", }; - inline const char* szWeapInventoryTypeNames[] - { + inline const char* szWeapInventoryTypeNames[]{ "primary", "offhand", "item", @@ -42,8 +38,7 @@ namespace IW4 "scavenger", }; - inline const char* szWeapFireTypeNames[] - { + inline const char* szWeapFireTypeNames[]{ "Full Auto", "Single Shot", "2-Round Burst", @@ -52,16 +47,14 @@ namespace IW4 "Double Barrel", }; - inline const char* penetrateTypeNames[] - { + inline const char* penetrateTypeNames[]{ "none", "small", "medium", "large", }; - inline const char* impactTypeNames[] - { + inline const char* impactTypeNames[]{ "none", "bullet_small", "bullet_large", @@ -75,15 +68,13 @@ namespace IW4 "projectile_dud", }; - inline const char* szWeapStanceNames[] - { + inline const char* szWeapStanceNames[]{ "stand", "duck", "prone", }; - inline const char* szProjectileExplosionNames[] - { + inline const char* szProjectileExplosionNames[]{ "grenade", "rocket", "flashbang", @@ -93,8 +84,7 @@ namespace IW4 "heavy explosive", }; - inline const char* offhandClassNames[] - { + inline const char* offhandClassNames[]{ "None", "Frag Grenade", "Smoke Grenade", @@ -103,8 +93,7 @@ namespace IW4 "Other", }; - inline const char* playerAnimTypeNames[] - { + inline const char* playerAnimTypeNames[]{ "none", "other", "pistol", @@ -125,23 +114,20 @@ namespace IW4 "throwingknife", }; - inline const char* activeReticleNames[] - { + inline const char* activeReticleNames[]{ "None", "Pip-On-A-Stick", "Bouncing diamond", }; - inline const char* guidedMissileNames[] - { + inline const char* guidedMissileNames[]{ "None", "Sidewinder", "Hellfire", "Javelin", }; - inline const char* stickinessNames[] - { + inline const char* stickinessNames[]{ "Don't stick", "Stick to all", "Stick to all, orient to surface", @@ -150,15 +136,13 @@ namespace IW4 "Knife", }; - inline const char* overlayInterfaceNames[] - { + inline const char* overlayInterfaceNames[]{ "None", "Javelin", "Turret Scope", }; - inline const char* ammoCounterClipNames[] - { + inline const char* ammoCounterClipNames[]{ "None", "Magazine", "ShortMagazine", @@ -168,15 +152,13 @@ namespace IW4 "AltWeapon", }; - inline const char* weapIconRatioNames[] - { + inline const char* weapIconRatioNames[]{ "1:1", "2:1", "4:1", }; - inline const char* s_vehicleClassNames[] - { + inline const char* s_vehicleClassNames[]{ "4 wheel", "tank", "plane", @@ -186,10 +168,9 @@ namespace IW4 "snowmobile", }; - inline const char* s_vehicleAxleTypeNames[] - { + inline const char* s_vehicleAxleTypeNames[]{ "front", "rear", "all", }; -} +} // namespace IW4 diff --git a/src/ObjCommon/Game/IW4/InfoString/PhysPresetFields.h b/src/ObjCommon/Game/IW4/InfoString/PhysPresetFields.h index be5a6f7bc..bc3ab22e1 100644 --- a/src/ObjCommon/Game/IW4/InfoString/PhysPresetFields.h +++ b/src/ObjCommon/Game/IW4/InfoString/PhysPresetFields.h @@ -3,18 +3,17 @@ namespace IW4 { - inline cspField_t phys_preset_fields[] - { - { "mass", offsetof(PhysPresetInfo, mass), CSPFT_FLOAT }, - { "bounce", offsetof(PhysPresetInfo, bounce), CSPFT_FLOAT }, - { "friction", offsetof(PhysPresetInfo, friction), CSPFT_FLOAT }, - { "isFrictionInfinity", offsetof(PhysPresetInfo, isFrictionInfinity), CSPFT_QBOOLEAN }, - { "bulletForceScale", offsetof(PhysPresetInfo, bulletForceScale), CSPFT_FLOAT }, - { "explosiveForceScale", offsetof(PhysPresetInfo, explosiveForceScale), CSPFT_FLOAT }, - { "sndAliasPrefix", offsetof(PhysPresetInfo, sndAliasPrefix), CSPFT_STRING }, - { "piecesSpreadFraction", offsetof(PhysPresetInfo, piecesSpreadFraction), CSPFT_FLOAT }, - { "piecesUpwardVelocity", offsetof(PhysPresetInfo, piecesUpwardVelocity), CSPFT_FLOAT }, - { "tempDefaultToCylinder", offsetof(PhysPresetInfo, tempDefaultToCylinder), CSPFT_QBOOLEAN }, - { "perSurfaceSndAlias", offsetof(PhysPresetInfo, perSurfaceSndAlias), CSPFT_QBOOLEAN }, + inline cspField_t phys_preset_fields[]{ + {"mass", offsetof(PhysPresetInfo, mass), CSPFT_FLOAT }, + {"bounce", offsetof(PhysPresetInfo, bounce), CSPFT_FLOAT }, + {"friction", offsetof(PhysPresetInfo, friction), CSPFT_FLOAT }, + {"isFrictionInfinity", offsetof(PhysPresetInfo, isFrictionInfinity), CSPFT_QBOOLEAN}, + {"bulletForceScale", offsetof(PhysPresetInfo, bulletForceScale), CSPFT_FLOAT }, + {"explosiveForceScale", offsetof(PhysPresetInfo, explosiveForceScale), CSPFT_FLOAT }, + {"sndAliasPrefix", offsetof(PhysPresetInfo, sndAliasPrefix), CSPFT_STRING }, + {"piecesSpreadFraction", offsetof(PhysPresetInfo, piecesSpreadFraction), CSPFT_FLOAT }, + {"piecesUpwardVelocity", offsetof(PhysPresetInfo, piecesUpwardVelocity), CSPFT_FLOAT }, + {"tempDefaultToCylinder", offsetof(PhysPresetInfo, tempDefaultToCylinder), CSPFT_QBOOLEAN}, + {"perSurfaceSndAlias", offsetof(PhysPresetInfo, perSurfaceSndAlias), CSPFT_QBOOLEAN}, }; -} \ No newline at end of file +} diff --git a/src/ObjCommon/Game/IW4/InfoString/TracerFields.h b/src/ObjCommon/Game/IW4/InfoString/TracerFields.h index bba335658..82a858c4c 100644 --- a/src/ObjCommon/Game/IW4/InfoString/TracerFields.h +++ b/src/ObjCommon/Game/IW4/InfoString/TracerFields.h @@ -3,34 +3,33 @@ namespace IW4 { - inline cspField_t tracer_fields[] - { - { "material", offsetof(TracerDef, material), CSPFT_MATERIAL }, - { "drawInterval", offsetof(TracerDef, drawInterval), CSPFT_INT }, - { "speed", offsetof(TracerDef, speed), CSPFT_FLOAT }, - { "beamLength", offsetof(TracerDef, beamLength), CSPFT_FLOAT }, - { "beamWidth", offsetof(TracerDef, beamWidth), CSPFT_FLOAT }, - { "screwRadius", offsetof(TracerDef, screwRadius), CSPFT_FLOAT }, - { "screwDist", offsetof(TracerDef, screwDist), CSPFT_FLOAT }, - { "colorR0", offsetof(TracerDef, colors[0][0]), CSPFT_FLOAT}, - { "colorG0", offsetof(TracerDef, colors[0][1]), CSPFT_FLOAT }, - { "colorB0", offsetof(TracerDef, colors[0][2]), CSPFT_FLOAT }, - { "colorA0", offsetof(TracerDef, colors[0][3]), CSPFT_FLOAT }, - { "colorR1", offsetof(TracerDef, colors[1][0]), CSPFT_FLOAT }, - { "colorG1", offsetof(TracerDef, colors[1][1]), CSPFT_FLOAT }, - { "colorB1", offsetof(TracerDef, colors[1][2]), CSPFT_FLOAT }, - { "colorA1", offsetof(TracerDef, colors[1][3]), CSPFT_FLOAT }, - { "colorR2", offsetof(TracerDef, colors[2][0]), CSPFT_FLOAT }, - { "colorG2", offsetof(TracerDef, colors[2][1]), CSPFT_FLOAT }, - { "colorB2", offsetof(TracerDef, colors[2][2]), CSPFT_FLOAT }, - { "colorA2", offsetof(TracerDef, colors[2][3]), CSPFT_FLOAT }, - { "colorR3", offsetof(TracerDef, colors[3][0]), CSPFT_FLOAT }, - { "colorG3", offsetof(TracerDef, colors[3][1]), CSPFT_FLOAT }, - { "colorB3", offsetof(TracerDef, colors[3][2]), CSPFT_FLOAT }, - { "colorA3", offsetof(TracerDef, colors[3][3]), CSPFT_FLOAT }, - { "colorR4", offsetof(TracerDef, colors[4][0]), CSPFT_FLOAT }, - { "colorG4", offsetof(TracerDef, colors[4][1]), CSPFT_FLOAT }, - { "colorB4", offsetof(TracerDef, colors[4][2]), CSPFT_FLOAT }, - { "colorA4", offsetof(TracerDef, colors[4][3]), CSPFT_FLOAT }, + inline cspField_t tracer_fields[]{ + {"material", offsetof(TracerDef, material), CSPFT_MATERIAL}, + {"drawInterval", offsetof(TracerDef, drawInterval), CSPFT_INT }, + {"speed", offsetof(TracerDef, speed), CSPFT_FLOAT }, + {"beamLength", offsetof(TracerDef, beamLength), CSPFT_FLOAT }, + {"beamWidth", offsetof(TracerDef, beamWidth), CSPFT_FLOAT }, + {"screwRadius", offsetof(TracerDef, screwRadius), CSPFT_FLOAT }, + {"screwDist", offsetof(TracerDef, screwDist), CSPFT_FLOAT }, + {"colorR0", offsetof(TracerDef, colors[0][0]), CSPFT_FLOAT }, + {"colorG0", offsetof(TracerDef, colors[0][1]), CSPFT_FLOAT }, + {"colorB0", offsetof(TracerDef, colors[0][2]), CSPFT_FLOAT }, + {"colorA0", offsetof(TracerDef, colors[0][3]), CSPFT_FLOAT }, + {"colorR1", offsetof(TracerDef, colors[1][0]), CSPFT_FLOAT }, + {"colorG1", offsetof(TracerDef, colors[1][1]), CSPFT_FLOAT }, + {"colorB1", offsetof(TracerDef, colors[1][2]), CSPFT_FLOAT }, + {"colorA1", offsetof(TracerDef, colors[1][3]), CSPFT_FLOAT }, + {"colorR2", offsetof(TracerDef, colors[2][0]), CSPFT_FLOAT }, + {"colorG2", offsetof(TracerDef, colors[2][1]), CSPFT_FLOAT }, + {"colorB2", offsetof(TracerDef, colors[2][2]), CSPFT_FLOAT }, + {"colorA2", offsetof(TracerDef, colors[2][3]), CSPFT_FLOAT }, + {"colorR3", offsetof(TracerDef, colors[3][0]), CSPFT_FLOAT }, + {"colorG3", offsetof(TracerDef, colors[3][1]), CSPFT_FLOAT }, + {"colorB3", offsetof(TracerDef, colors[3][2]), CSPFT_FLOAT }, + {"colorA3", offsetof(TracerDef, colors[3][3]), CSPFT_FLOAT }, + {"colorR4", offsetof(TracerDef, colors[4][0]), CSPFT_FLOAT }, + {"colorG4", offsetof(TracerDef, colors[4][1]), CSPFT_FLOAT }, + {"colorB4", offsetof(TracerDef, colors[4][2]), CSPFT_FLOAT }, + {"colorA4", offsetof(TracerDef, colors[4][3]), CSPFT_FLOAT }, }; } diff --git a/src/ObjCommon/Game/IW4/InfoString/VehicleFields.h b/src/ObjCommon/Game/IW4/InfoString/VehicleFields.h index 94f54078c..7e472a6ab 100644 --- a/src/ObjCommon/Game/IW4/InfoString/VehicleFields.h +++ b/src/ObjCommon/Game/IW4/InfoString/VehicleFields.h @@ -3,150 +3,149 @@ namespace IW4 { - inline cspField_t vehicle_fields[] - { - {"type", offsetof(VehicleDef, type), VFT_TYPE}, - {"useHintString", offsetof(VehicleDef, useHintString), CSPFT_STRING}, - {"health", offsetof(VehicleDef, health), CSPFT_INT}, - {"quadBarrel", offsetof(VehicleDef, quadBarrel), CSPFT_QBOOLEAN}, - {"texureScrollScale", offsetof(VehicleDef, texScrollScale), CSPFT_FLOAT}, - {"topSpeed", offsetof(VehicleDef, topSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"accel", offsetof(VehicleDef, accel), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"rotRate", offsetof(VehicleDef, rotRate), CSPFT_FLOAT}, - {"rotAccel", offsetof(VehicleDef, rotAccel), CSPFT_FLOAT}, - {"maxBodyPitch", offsetof(VehicleDef, maxBodyPitch), CSPFT_FLOAT}, - {"maxBodyRoll", offsetof(VehicleDef, maxBodyRoll), CSPFT_FLOAT}, - {"fakeBodyAccelPitch", offsetof(VehicleDef, fakeBodyAccelPitch), CSPFT_FLOAT}, - {"fakeBodyAccelRoll", offsetof(VehicleDef, fakeBodyAccelRoll), CSPFT_FLOAT}, - {"fakeBodyVelPitch", offsetof(VehicleDef, fakeBodyVelPitch), CSPFT_FLOAT}, - {"fakeBodyVelRoll", offsetof(VehicleDef, fakeBodyVelRoll), CSPFT_FLOAT}, - {"fakeBodySideVelPitch", offsetof(VehicleDef, fakeBodySideVelPitch), CSPFT_FLOAT}, - {"fakeBodyPitchStrength", offsetof(VehicleDef, fakeBodyPitchStrength), CSPFT_FLOAT}, - {"fakeBodyRollStrength", offsetof(VehicleDef, fakeBodyRollStrength), CSPFT_FLOAT}, - {"fakeBodyPitchDampening", offsetof(VehicleDef, fakeBodyPitchDampening), CSPFT_FLOAT}, - {"fakeBodyRollDampening", offsetof(VehicleDef, fakeBodyRollDampening), CSPFT_FLOAT}, - {"fakeBodyBoatRockingAmplitude", offsetof(VehicleDef, fakeBodyBoatRockingAmplitude), CSPFT_FLOAT}, - {"fakeBodyBoatRockingPeriod", offsetof(VehicleDef, fakeBodyBoatRockingPeriod), CSPFT_FLOAT}, - {"fakeBodyBoatRockingRotationPeriod", offsetof(VehicleDef, fakeBodyBoatRockingRotationPeriod), CSPFT_FLOAT}, - {"fakeBodyBoatRockingFadeoutSpeed", offsetof(VehicleDef, fakeBodyBoatRockingFadeoutSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"boatBouncingMinForce", offsetof(VehicleDef, boatBouncingMinForce), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"boatBouncingMaxForce", offsetof(VehicleDef, boatBouncingMaxForce), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"boatBouncingRate", offsetof(VehicleDef, boatBouncingRate), CSPFT_FLOAT}, - {"boatBouncingFadeinSpeed", offsetof(VehicleDef, boatBouncingFadeinSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"boatBouncingFadeoutSteeringAngle", offsetof(VehicleDef, boatBouncingFadeoutSteeringAngle), CSPFT_FLOAT}, - {"collisionDamage", offsetof(VehicleDef, collisionDamage), CSPFT_FLOAT}, - {"collisionSpeed", offsetof(VehicleDef, collisionSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"killcamZDist", offsetof(VehicleDef, killcamOffset[0]), CSPFT_FLOAT}, - {"killcamBackDist", offsetof(VehicleDef, killcamOffset[1]), CSPFT_FLOAT}, - {"killcamUpDist", offsetof(VehicleDef, killcamOffset[2]), CSPFT_FLOAT}, - {"playerProtected", offsetof(VehicleDef, playerProtected), CSPFT_QBOOLEAN}, - {"bulletDamage", offsetof(VehicleDef, bulletDamage), CSPFT_QBOOLEAN}, - {"armorPiercingDamage", offsetof(VehicleDef, armorPiercingDamage), CSPFT_QBOOLEAN}, - {"grenadeDamage", offsetof(VehicleDef, grenadeDamage), CSPFT_QBOOLEAN}, - {"projectileDamage", offsetof(VehicleDef, projectileDamage), CSPFT_QBOOLEAN}, - {"projectileSplashDamage", offsetof(VehicleDef, projectileSplashDamage), CSPFT_QBOOLEAN}, - {"heavyExplosiveDamage", offsetof(VehicleDef, heavyExplosiveDamage), CSPFT_QBOOLEAN}, - {"physicsEnabled", offsetof(VehicleDef, vehPhysDef.physicsEnabled), CSPFT_QBOOLEAN}, - {"physicsPreset", offsetof(VehicleDef, vehPhysDef.physPresetName), CSPFT_STRING}, - {"accelerationGraph", offsetof(VehicleDef, vehPhysDef.accelGraphName), CSPFT_STRING}, - {"steeringAxle", offsetof(VehicleDef, vehPhysDef.steeringAxle), VFT_AXLE_STEERING}, - {"powerAxle", offsetof(VehicleDef, vehPhysDef.powerAxle), VFT_AXLE_POWER}, - {"brakingAxle", offsetof(VehicleDef, vehPhysDef.brakingAxle), VFT_AXLE_BRAKING}, - {"reverseSpeed", offsetof(VehicleDef, vehPhysDef.reverseSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"maxVelocity", offsetof(VehicleDef, vehPhysDef.maxVelocity), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"maxPitch", offsetof(VehicleDef, vehPhysDef.maxPitch), CSPFT_FLOAT}, - {"maxRoll", offsetof(VehicleDef, vehPhysDef.maxRoll), CSPFT_FLOAT}, - {"suspensionTravelRear", offsetof(VehicleDef, vehPhysDef.suspensionTravelRear), CSPFT_FLOAT}, - {"suspensionStrengthFront", offsetof(VehicleDef, vehPhysDef.suspensionStrengthFront), CSPFT_FLOAT}, - {"suspensionDampingFront", offsetof(VehicleDef, vehPhysDef.suspensionDampingFront), CSPFT_FLOAT}, - {"suspensionStrengthRear", offsetof(VehicleDef, vehPhysDef.suspensionStrengthRear), CSPFT_FLOAT}, - {"suspensionDampingRear", offsetof(VehicleDef, vehPhysDef.suspensionDampingRear), CSPFT_FLOAT}, - {"frictionBraking", offsetof(VehicleDef, vehPhysDef.frictionBraking), CSPFT_FLOAT}, - {"frictionCoasting", offsetof(VehicleDef, vehPhysDef.frictionCoasting), CSPFT_FLOAT}, - {"frictionTopSpeed", offsetof(VehicleDef, vehPhysDef.frictionTopSpeed), CSPFT_FLOAT}, - {"frictionSide", offsetof(VehicleDef, vehPhysDef.frictionSide), CSPFT_FLOAT}, - {"frictionSideRear", offsetof(VehicleDef, vehPhysDef.frictionSideRear), CSPFT_FLOAT}, - {"velocityDependentSlip", offsetof(VehicleDef, vehPhysDef.velocityDependentSlip), CSPFT_FLOAT}, - {"rollStability", offsetof(VehicleDef, vehPhysDef.rollStability), CSPFT_FLOAT}, - {"rollResistance", offsetof(VehicleDef, vehPhysDef.rollResistance), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"pitchResistance", offsetof(VehicleDef, vehPhysDef.pitchResistance), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"yawResistance", offsetof(VehicleDef, vehPhysDef.yawResistance), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"uprightStrengthPitch", offsetof(VehicleDef, vehPhysDef.uprightStrengthPitch), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"uprightStrengthRoll", offsetof(VehicleDef, vehPhysDef.uprightStrengthRoll), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"targetAirPitch", offsetof(VehicleDef, vehPhysDef.targetAirPitch), CSPFT_FLOAT}, - {"airYawTorque", offsetof(VehicleDef, vehPhysDef.airYawTorque), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"airPitchTorque", offsetof(VehicleDef, vehPhysDef.airPitchTorque), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"minimumMomentumForCollision", offsetof(VehicleDef, vehPhysDef.minimumMomentumForCollision), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"collisionLaunchForceScale", offsetof(VehicleDef, vehPhysDef.collisionLaunchForceScale), CSPFT_FLOAT}, - {"wreckedMassScale", offsetof(VehicleDef, vehPhysDef.wreckedMassScale), CSPFT_FLOAT}, - {"wreckedBodyFriction", offsetof(VehicleDef, vehPhysDef.wreckedBodyFriction), CSPFT_FLOAT}, - {"minimumJoltForNotify", offsetof(VehicleDef, vehPhysDef.minimumJoltForNotify), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"slipThresholdFront", offsetof(VehicleDef, vehPhysDef.slipThresholdFront), CSPFT_FLOAT}, - {"slipThresholdRear", offsetof(VehicleDef, vehPhysDef.slipThresholdRear), CSPFT_FLOAT}, - {"slipFricScaleFront", offsetof(VehicleDef, vehPhysDef.slipFricScaleFront), CSPFT_FLOAT}, - {"slipFricScaleRear", offsetof(VehicleDef, vehPhysDef.slipFricScaleRear), CSPFT_FLOAT}, - {"slipFricRateFront", offsetof(VehicleDef, vehPhysDef.slipFricRateFront), CSPFT_FLOAT}, - {"slipFricRateRear", offsetof(VehicleDef, vehPhysDef.slipFricRateRear), CSPFT_FLOAT}, - {"slipYawTorque", offsetof(VehicleDef, vehPhysDef.slipYawTorque), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"boostDuration", offsetof(VehicleDef, boostDuration), CSPFT_FLOAT}, - {"boostRechargeTime", offsetof(VehicleDef, boostRechargeTime), CSPFT_FLOAT}, - {"boostAcceleration", offsetof(VehicleDef, boostAcceleration), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"suspensionTravel", offsetof(VehicleDef, suspensionTravel), CSPFT_FLOAT}, - {"maxSteeringAngle", offsetof(VehicleDef, maxSteeringAngle), CSPFT_FLOAT}, - {"steeringLerp", offsetof(VehicleDef, steeringLerp), CSPFT_FLOAT}, - {"minSteeringScale", offsetof(VehicleDef, minSteeringScale), CSPFT_FLOAT}, - {"minSteeringSpeed", offsetof(VehicleDef, minSteeringSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"camLookEnabled", offsetof(VehicleDef, camLookEnabled), CSPFT_QBOOLEAN}, - {"camLerp", offsetof(VehicleDef, camLerp), CSPFT_FLOAT}, - {"camPitchInfluence", offsetof(VehicleDef, camPitchInfluence), CSPFT_FLOAT}, - {"camRollInfluence", offsetof(VehicleDef, camRollInfluence), CSPFT_FLOAT}, - {"camFovIncrease", offsetof(VehicleDef, camFovIncrease), CSPFT_FLOAT}, - {"camFovOffset", offsetof(VehicleDef, camFovOffset), CSPFT_FLOAT}, - {"camFovSpeed", offsetof(VehicleDef, camFovSpeed), CSPFT_FLOAT}, - {"turretWeaponName", offsetof(VehicleDef, turretWeaponName), CSPFT_STRING}, - {"turretHorizSpanLeft", offsetof(VehicleDef, turretHorizSpanLeft), CSPFT_FLOAT}, - {"turretHorizSpanRight", offsetof(VehicleDef, turretHorizSpanRight), CSPFT_FLOAT}, - {"turretVertSpanUp", offsetof(VehicleDef, turretVertSpanUp), CSPFT_FLOAT}, - {"turretVertSpanDown", offsetof(VehicleDef, turretVertSpanDown), CSPFT_FLOAT}, - {"turretRotRate", offsetof(VehicleDef, turretRotRate), CSPFT_FLOAT}, - {"turretSpinSnd", offsetof(VehicleDef, turretSpinSnd), CSPFT_SOUND}, - {"turretStopSnd", offsetof(VehicleDef, turretStopSnd), CSPFT_SOUND}, - {"trophyEnabled", offsetof(VehicleDef, trophyEnabled), CSPFT_QBOOLEAN}, - {"trophyRadius", offsetof(VehicleDef, trophyRadius), CSPFT_FLOAT}, - {"trophyInactiveRadius", offsetof(VehicleDef, trophyInactiveRadius), CSPFT_FLOAT}, - {"trophyAmmoCount", offsetof(VehicleDef, trophyAmmoCount), CSPFT_INT}, - {"trophyReloadTime", offsetof(VehicleDef, trophyReloadTime), CSPFT_FLOAT}, - {"trophyTags", offsetof(VehicleDef, trophyTags), VFT_TROPHY_TAGS}, - {"compassFriendlyIcon", offsetof(VehicleDef, compassFriendlyIcon), CSPFT_MATERIAL}, - {"compassEnemyIcon", offsetof(VehicleDef, compassEnemyIcon), CSPFT_MATERIAL}, - {"compassIconWidth", offsetof(VehicleDef, compassIconWidth), CSPFT_INT}, - {"compassIconHeight", offsetof(VehicleDef, compassIconHeight), CSPFT_INT}, - {"lowIdleSnd", offsetof(VehicleDef, idleLowSnd), CSPFT_SOUND}, - {"highIdleSnd", offsetof(VehicleDef, idleHighSnd), CSPFT_SOUND}, - {"lowEngineSnd", offsetof(VehicleDef, engineLowSnd), CSPFT_SOUND}, - {"highEngineSnd", offsetof(VehicleDef, engineHighSnd), CSPFT_SOUND}, - {"engineSndSpeed", offsetof(VehicleDef, engineSndSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"engineStartUpSnd", offsetof(VehicleDef, engineStartUpSnd), CSPFT_SOUND}, - {"engineStartUpLength", offsetof(VehicleDef, engineStartUpLength), CSPFT_MILLISECONDS}, - {"engineShutdownSnd", offsetof(VehicleDef, engineShutdownSnd), CSPFT_SOUND}, - {"engineIdleSnd", offsetof(VehicleDef, engineIdleSnd), CSPFT_SOUND}, - {"engineSustainSnd", offsetof(VehicleDef, engineSustainSnd), CSPFT_SOUND}, - {"engineRampUpSnd", offsetof(VehicleDef, engineRampUpSnd), CSPFT_SOUND}, - {"engineRampUpLength", offsetof(VehicleDef, engineRampUpLength), CSPFT_MILLISECONDS}, - {"engineRampDownSnd", offsetof(VehicleDef, engineRampDownSnd), CSPFT_SOUND}, - {"engineRampDownLength", offsetof(VehicleDef, engineRampDownLength), CSPFT_MILLISECONDS}, - {"suspensionSoftSnd", offsetof(VehicleDef, suspensionSoftSnd), CSPFT_SOUND}, - {"suspensionSoftCompression", offsetof(VehicleDef, suspensionSoftCompression), CSPFT_FLOAT}, - {"suspensionHardSnd", offsetof(VehicleDef, suspensionHardSnd), CSPFT_SOUND}, - {"suspensionHardCompression", offsetof(VehicleDef, suspensionHardCompression), CSPFT_FLOAT}, - {"collisionSnd", offsetof(VehicleDef, collisionSnd), CSPFT_SOUND}, - {"collisionBlendSpeed", offsetof(VehicleDef, collisionBlendSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"speedSnd", offsetof(VehicleDef, speedSnd), CSPFT_SOUND}, - {"speedSndBlendSpeed", offsetof(VehicleDef, speedSndBlendSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"surfaceSndPrefix", offsetof(VehicleDef, surfaceSndPrefix), CSPFT_STRING}, - {"surfaceSndBlendSpeed", offsetof(VehicleDef, surfaceSndBlendSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"slideVolume", offsetof(VehicleDef, slideVolume), CSPFT_FLOAT}, - {"slideBlendSpeed", offsetof(VehicleDef, slideBlendSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, - {"inAirPitch", offsetof(VehicleDef, inAirPitch), CSPFT_FLOAT}, + inline cspField_t vehicle_fields[]{ + {"type", offsetof(VehicleDef, type), VFT_TYPE }, + {"useHintString", offsetof(VehicleDef, useHintString), CSPFT_STRING }, + {"health", offsetof(VehicleDef, health), CSPFT_INT }, + {"quadBarrel", offsetof(VehicleDef, quadBarrel), CSPFT_QBOOLEAN }, + {"texureScrollScale", offsetof(VehicleDef, texScrollScale), CSPFT_FLOAT }, + {"topSpeed", offsetof(VehicleDef, topSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"accel", offsetof(VehicleDef, accel), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"rotRate", offsetof(VehicleDef, rotRate), CSPFT_FLOAT }, + {"rotAccel", offsetof(VehicleDef, rotAccel), CSPFT_FLOAT }, + {"maxBodyPitch", offsetof(VehicleDef, maxBodyPitch), CSPFT_FLOAT }, + {"maxBodyRoll", offsetof(VehicleDef, maxBodyRoll), CSPFT_FLOAT }, + {"fakeBodyAccelPitch", offsetof(VehicleDef, fakeBodyAccelPitch), CSPFT_FLOAT }, + {"fakeBodyAccelRoll", offsetof(VehicleDef, fakeBodyAccelRoll), CSPFT_FLOAT }, + {"fakeBodyVelPitch", offsetof(VehicleDef, fakeBodyVelPitch), CSPFT_FLOAT }, + {"fakeBodyVelRoll", offsetof(VehicleDef, fakeBodyVelRoll), CSPFT_FLOAT }, + {"fakeBodySideVelPitch", offsetof(VehicleDef, fakeBodySideVelPitch), CSPFT_FLOAT }, + {"fakeBodyPitchStrength", offsetof(VehicleDef, fakeBodyPitchStrength), CSPFT_FLOAT }, + {"fakeBodyRollStrength", offsetof(VehicleDef, fakeBodyRollStrength), CSPFT_FLOAT }, + {"fakeBodyPitchDampening", offsetof(VehicleDef, fakeBodyPitchDampening), CSPFT_FLOAT }, + {"fakeBodyRollDampening", offsetof(VehicleDef, fakeBodyRollDampening), CSPFT_FLOAT }, + {"fakeBodyBoatRockingAmplitude", offsetof(VehicleDef, fakeBodyBoatRockingAmplitude), CSPFT_FLOAT }, + {"fakeBodyBoatRockingPeriod", offsetof(VehicleDef, fakeBodyBoatRockingPeriod), CSPFT_FLOAT }, + {"fakeBodyBoatRockingRotationPeriod", offsetof(VehicleDef, fakeBodyBoatRockingRotationPeriod), CSPFT_FLOAT }, + {"fakeBodyBoatRockingFadeoutSpeed", offsetof(VehicleDef, fakeBodyBoatRockingFadeoutSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"boatBouncingMinForce", offsetof(VehicleDef, boatBouncingMinForce), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"boatBouncingMaxForce", offsetof(VehicleDef, boatBouncingMaxForce), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"boatBouncingRate", offsetof(VehicleDef, boatBouncingRate), CSPFT_FLOAT }, + {"boatBouncingFadeinSpeed", offsetof(VehicleDef, boatBouncingFadeinSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"boatBouncingFadeoutSteeringAngle", offsetof(VehicleDef, boatBouncingFadeoutSteeringAngle), CSPFT_FLOAT }, + {"collisionDamage", offsetof(VehicleDef, collisionDamage), CSPFT_FLOAT }, + {"collisionSpeed", offsetof(VehicleDef, collisionSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"killcamZDist", offsetof(VehicleDef, killcamOffset[0]), CSPFT_FLOAT }, + {"killcamBackDist", offsetof(VehicleDef, killcamOffset[1]), CSPFT_FLOAT }, + {"killcamUpDist", offsetof(VehicleDef, killcamOffset[2]), CSPFT_FLOAT }, + {"playerProtected", offsetof(VehicleDef, playerProtected), CSPFT_QBOOLEAN }, + {"bulletDamage", offsetof(VehicleDef, bulletDamage), CSPFT_QBOOLEAN }, + {"armorPiercingDamage", offsetof(VehicleDef, armorPiercingDamage), CSPFT_QBOOLEAN }, + {"grenadeDamage", offsetof(VehicleDef, grenadeDamage), CSPFT_QBOOLEAN }, + {"projectileDamage", offsetof(VehicleDef, projectileDamage), CSPFT_QBOOLEAN }, + {"projectileSplashDamage", offsetof(VehicleDef, projectileSplashDamage), CSPFT_QBOOLEAN }, + {"heavyExplosiveDamage", offsetof(VehicleDef, heavyExplosiveDamage), CSPFT_QBOOLEAN }, + {"physicsEnabled", offsetof(VehicleDef, vehPhysDef.physicsEnabled), CSPFT_QBOOLEAN }, + {"physicsPreset", offsetof(VehicleDef, vehPhysDef.physPresetName), CSPFT_STRING }, + {"accelerationGraph", offsetof(VehicleDef, vehPhysDef.accelGraphName), CSPFT_STRING }, + {"steeringAxle", offsetof(VehicleDef, vehPhysDef.steeringAxle), VFT_AXLE_STEERING }, + {"powerAxle", offsetof(VehicleDef, vehPhysDef.powerAxle), VFT_AXLE_POWER }, + {"brakingAxle", offsetof(VehicleDef, vehPhysDef.brakingAxle), VFT_AXLE_BRAKING }, + {"reverseSpeed", offsetof(VehicleDef, vehPhysDef.reverseSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"maxVelocity", offsetof(VehicleDef, vehPhysDef.maxVelocity), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"maxPitch", offsetof(VehicleDef, vehPhysDef.maxPitch), CSPFT_FLOAT }, + {"maxRoll", offsetof(VehicleDef, vehPhysDef.maxRoll), CSPFT_FLOAT }, + {"suspensionTravelRear", offsetof(VehicleDef, vehPhysDef.suspensionTravelRear), CSPFT_FLOAT }, + {"suspensionStrengthFront", offsetof(VehicleDef, vehPhysDef.suspensionStrengthFront), CSPFT_FLOAT }, + {"suspensionDampingFront", offsetof(VehicleDef, vehPhysDef.suspensionDampingFront), CSPFT_FLOAT }, + {"suspensionStrengthRear", offsetof(VehicleDef, vehPhysDef.suspensionStrengthRear), CSPFT_FLOAT }, + {"suspensionDampingRear", offsetof(VehicleDef, vehPhysDef.suspensionDampingRear), CSPFT_FLOAT }, + {"frictionBraking", offsetof(VehicleDef, vehPhysDef.frictionBraking), CSPFT_FLOAT }, + {"frictionCoasting", offsetof(VehicleDef, vehPhysDef.frictionCoasting), CSPFT_FLOAT }, + {"frictionTopSpeed", offsetof(VehicleDef, vehPhysDef.frictionTopSpeed), CSPFT_FLOAT }, + {"frictionSide", offsetof(VehicleDef, vehPhysDef.frictionSide), CSPFT_FLOAT }, + {"frictionSideRear", offsetof(VehicleDef, vehPhysDef.frictionSideRear), CSPFT_FLOAT }, + {"velocityDependentSlip", offsetof(VehicleDef, vehPhysDef.velocityDependentSlip), CSPFT_FLOAT }, + {"rollStability", offsetof(VehicleDef, vehPhysDef.rollStability), CSPFT_FLOAT }, + {"rollResistance", offsetof(VehicleDef, vehPhysDef.rollResistance), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"pitchResistance", offsetof(VehicleDef, vehPhysDef.pitchResistance), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"yawResistance", offsetof(VehicleDef, vehPhysDef.yawResistance), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"uprightStrengthPitch", offsetof(VehicleDef, vehPhysDef.uprightStrengthPitch), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"uprightStrengthRoll", offsetof(VehicleDef, vehPhysDef.uprightStrengthRoll), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"targetAirPitch", offsetof(VehicleDef, vehPhysDef.targetAirPitch), CSPFT_FLOAT }, + {"airYawTorque", offsetof(VehicleDef, vehPhysDef.airYawTorque), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"airPitchTorque", offsetof(VehicleDef, vehPhysDef.airPitchTorque), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"minimumMomentumForCollision", offsetof(VehicleDef, vehPhysDef.minimumMomentumForCollision), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"collisionLaunchForceScale", offsetof(VehicleDef, vehPhysDef.collisionLaunchForceScale), CSPFT_FLOAT }, + {"wreckedMassScale", offsetof(VehicleDef, vehPhysDef.wreckedMassScale), CSPFT_FLOAT }, + {"wreckedBodyFriction", offsetof(VehicleDef, vehPhysDef.wreckedBodyFriction), CSPFT_FLOAT }, + {"minimumJoltForNotify", offsetof(VehicleDef, vehPhysDef.minimumJoltForNotify), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"slipThresholdFront", offsetof(VehicleDef, vehPhysDef.slipThresholdFront), CSPFT_FLOAT }, + {"slipThresholdRear", offsetof(VehicleDef, vehPhysDef.slipThresholdRear), CSPFT_FLOAT }, + {"slipFricScaleFront", offsetof(VehicleDef, vehPhysDef.slipFricScaleFront), CSPFT_FLOAT }, + {"slipFricScaleRear", offsetof(VehicleDef, vehPhysDef.slipFricScaleRear), CSPFT_FLOAT }, + {"slipFricRateFront", offsetof(VehicleDef, vehPhysDef.slipFricRateFront), CSPFT_FLOAT }, + {"slipFricRateRear", offsetof(VehicleDef, vehPhysDef.slipFricRateRear), CSPFT_FLOAT }, + {"slipYawTorque", offsetof(VehicleDef, vehPhysDef.slipYawTorque), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"boostDuration", offsetof(VehicleDef, boostDuration), CSPFT_FLOAT }, + {"boostRechargeTime", offsetof(VehicleDef, boostRechargeTime), CSPFT_FLOAT }, + {"boostAcceleration", offsetof(VehicleDef, boostAcceleration), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"suspensionTravel", offsetof(VehicleDef, suspensionTravel), CSPFT_FLOAT }, + {"maxSteeringAngle", offsetof(VehicleDef, maxSteeringAngle), CSPFT_FLOAT }, + {"steeringLerp", offsetof(VehicleDef, steeringLerp), CSPFT_FLOAT }, + {"minSteeringScale", offsetof(VehicleDef, minSteeringScale), CSPFT_FLOAT }, + {"minSteeringSpeed", offsetof(VehicleDef, minSteeringSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"camLookEnabled", offsetof(VehicleDef, camLookEnabled), CSPFT_QBOOLEAN }, + {"camLerp", offsetof(VehicleDef, camLerp), CSPFT_FLOAT }, + {"camPitchInfluence", offsetof(VehicleDef, camPitchInfluence), CSPFT_FLOAT }, + {"camRollInfluence", offsetof(VehicleDef, camRollInfluence), CSPFT_FLOAT }, + {"camFovIncrease", offsetof(VehicleDef, camFovIncrease), CSPFT_FLOAT }, + {"camFovOffset", offsetof(VehicleDef, camFovOffset), CSPFT_FLOAT }, + {"camFovSpeed", offsetof(VehicleDef, camFovSpeed), CSPFT_FLOAT }, + {"turretWeaponName", offsetof(VehicleDef, turretWeaponName), CSPFT_STRING }, + {"turretHorizSpanLeft", offsetof(VehicleDef, turretHorizSpanLeft), CSPFT_FLOAT }, + {"turretHorizSpanRight", offsetof(VehicleDef, turretHorizSpanRight), CSPFT_FLOAT }, + {"turretVertSpanUp", offsetof(VehicleDef, turretVertSpanUp), CSPFT_FLOAT }, + {"turretVertSpanDown", offsetof(VehicleDef, turretVertSpanDown), CSPFT_FLOAT }, + {"turretRotRate", offsetof(VehicleDef, turretRotRate), CSPFT_FLOAT }, + {"turretSpinSnd", offsetof(VehicleDef, turretSpinSnd), CSPFT_SOUND }, + {"turretStopSnd", offsetof(VehicleDef, turretStopSnd), CSPFT_SOUND }, + {"trophyEnabled", offsetof(VehicleDef, trophyEnabled), CSPFT_QBOOLEAN }, + {"trophyRadius", offsetof(VehicleDef, trophyRadius), CSPFT_FLOAT }, + {"trophyInactiveRadius", offsetof(VehicleDef, trophyInactiveRadius), CSPFT_FLOAT }, + {"trophyAmmoCount", offsetof(VehicleDef, trophyAmmoCount), CSPFT_INT }, + {"trophyReloadTime", offsetof(VehicleDef, trophyReloadTime), CSPFT_FLOAT }, + {"trophyTags", offsetof(VehicleDef, trophyTags), VFT_TROPHY_TAGS }, + {"compassFriendlyIcon", offsetof(VehicleDef, compassFriendlyIcon), CSPFT_MATERIAL }, + {"compassEnemyIcon", offsetof(VehicleDef, compassEnemyIcon), CSPFT_MATERIAL }, + {"compassIconWidth", offsetof(VehicleDef, compassIconWidth), CSPFT_INT }, + {"compassIconHeight", offsetof(VehicleDef, compassIconHeight), CSPFT_INT }, + {"lowIdleSnd", offsetof(VehicleDef, idleLowSnd), CSPFT_SOUND }, + {"highIdleSnd", offsetof(VehicleDef, idleHighSnd), CSPFT_SOUND }, + {"lowEngineSnd", offsetof(VehicleDef, engineLowSnd), CSPFT_SOUND }, + {"highEngineSnd", offsetof(VehicleDef, engineHighSnd), CSPFT_SOUND }, + {"engineSndSpeed", offsetof(VehicleDef, engineSndSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"engineStartUpSnd", offsetof(VehicleDef, engineStartUpSnd), CSPFT_SOUND }, + {"engineStartUpLength", offsetof(VehicleDef, engineStartUpLength), CSPFT_MILLISECONDS }, + {"engineShutdownSnd", offsetof(VehicleDef, engineShutdownSnd), CSPFT_SOUND }, + {"engineIdleSnd", offsetof(VehicleDef, engineIdleSnd), CSPFT_SOUND }, + {"engineSustainSnd", offsetof(VehicleDef, engineSustainSnd), CSPFT_SOUND }, + {"engineRampUpSnd", offsetof(VehicleDef, engineRampUpSnd), CSPFT_SOUND }, + {"engineRampUpLength", offsetof(VehicleDef, engineRampUpLength), CSPFT_MILLISECONDS }, + {"engineRampDownSnd", offsetof(VehicleDef, engineRampDownSnd), CSPFT_SOUND }, + {"engineRampDownLength", offsetof(VehicleDef, engineRampDownLength), CSPFT_MILLISECONDS }, + {"suspensionSoftSnd", offsetof(VehicleDef, suspensionSoftSnd), CSPFT_SOUND }, + {"suspensionSoftCompression", offsetof(VehicleDef, suspensionSoftCompression), CSPFT_FLOAT }, + {"suspensionHardSnd", offsetof(VehicleDef, suspensionHardSnd), CSPFT_SOUND }, + {"suspensionHardCompression", offsetof(VehicleDef, suspensionHardCompression), CSPFT_FLOAT }, + {"collisionSnd", offsetof(VehicleDef, collisionSnd), CSPFT_SOUND }, + {"collisionBlendSpeed", offsetof(VehicleDef, collisionBlendSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"speedSnd", offsetof(VehicleDef, speedSnd), CSPFT_SOUND }, + {"speedSndBlendSpeed", offsetof(VehicleDef, speedSndBlendSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"surfaceSndPrefix", offsetof(VehicleDef, surfaceSndPrefix), CSPFT_STRING }, + {"surfaceSndBlendSpeed", offsetof(VehicleDef, surfaceSndBlendSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"slideVolume", offsetof(VehicleDef, slideVolume), CSPFT_FLOAT }, + {"slideBlendSpeed", offsetof(VehicleDef, slideBlendSpeed), CSPFT_MPH_TO_INCHES_PER_SEC}, + {"inAirPitch", offsetof(VehicleDef, inAirPitch), CSPFT_FLOAT }, }; } diff --git a/src/ObjCommon/Game/IW4/InfoString/WeaponFields.h b/src/ObjCommon/Game/IW4/InfoString/WeaponFields.h index 7d79731ba..0f979cbde 100644 --- a/src/ObjCommon/Game/IW4/InfoString/WeaponFields.h +++ b/src/ObjCommon/Game/IW4/InfoString/WeaponFields.h @@ -3,679 +3,678 @@ namespace IW4 { - inline cspField_t weapon_fields[] - { - {"displayName", offsetof(WeaponFullDef, weapCompleteDef.szDisplayName), CSPFT_STRING}, - {"AIOverlayDescription", offsetof(WeaponFullDef, weapDef.szOverlayName), CSPFT_STRING}, - {"modeName", offsetof(WeaponFullDef, weapDef.szModeName), CSPFT_STRING}, - {"playerAnimType", offsetof(WeaponFullDef, weapDef.playerAnimType), WFT_ANIMTYPE}, - {"gunModel", offsetof(WeaponFullDef, gunXModel[0]), CSPFT_XMODEL}, - {"gunModel2", offsetof(WeaponFullDef, gunXModel[1]), CSPFT_XMODEL}, - {"gunModel3", offsetof(WeaponFullDef, gunXModel[2]), CSPFT_XMODEL}, - {"gunModel4", offsetof(WeaponFullDef, gunXModel[3]), CSPFT_XMODEL}, - {"gunModel5", offsetof(WeaponFullDef, gunXModel[4]), CSPFT_XMODEL}, - {"gunModel6", offsetof(WeaponFullDef, gunXModel[5]), CSPFT_XMODEL}, - {"gunModel7", offsetof(WeaponFullDef, gunXModel[6]), CSPFT_XMODEL}, - {"gunModel8", offsetof(WeaponFullDef, gunXModel[7]), CSPFT_XMODEL}, - {"gunModel9", offsetof(WeaponFullDef, gunXModel[8]), CSPFT_XMODEL}, - {"gunModel10", offsetof(WeaponFullDef, gunXModel[9]), CSPFT_XMODEL}, - {"gunModel11", offsetof(WeaponFullDef, gunXModel[10]), CSPFT_XMODEL}, - {"gunModel12", offsetof(WeaponFullDef, gunXModel[11]), CSPFT_XMODEL}, - {"gunModel13", offsetof(WeaponFullDef, gunXModel[12]), CSPFT_XMODEL}, - {"gunModel14", offsetof(WeaponFullDef, gunXModel[13]), CSPFT_XMODEL}, - {"gunModel15", offsetof(WeaponFullDef, gunXModel[14]), CSPFT_XMODEL}, - {"gunModel16", offsetof(WeaponFullDef, gunXModel[15]), CSPFT_XMODEL}, - {"handModel", offsetof(WeaponFullDef, weapDef.handXModel), CSPFT_XMODEL}, - {"hideTags", offsetof(WeaponFullDef, hideTags), WFT_HIDETAGS}, - {"notetrackSoundMap", offsetof(WeaponFullDef, notetrackSoundMapKeys), WFT_NOTETRACKSOUNDMAP}, - {"notetrackRumbleMap", offsetof(WeaponFullDef, notetrackRumbleMapKeys), WFT_NOTETRACKRUMBLEMAP}, - {"idleAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_IDLE]), CSPFT_STRING}, - {"emptyIdleAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_EMPTY_IDLE]), CSPFT_STRING}, - {"fireAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_FIRE]), CSPFT_STRING}, - {"holdFireAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_HOLD_FIRE]), CSPFT_STRING}, - {"lastShotAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_LASTSHOT]), CSPFT_STRING}, - {"detonateAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_DETONATE]), CSPFT_STRING}, - {"rechamberAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RECHAMBER]), CSPFT_STRING}, - {"meleeAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_MELEE]), CSPFT_STRING}, - {"meleeChargeAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_MELEE_CHARGE]), CSPFT_STRING}, - {"reloadAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD]), CSPFT_STRING}, - {"reloadEmptyAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD_EMPTY]), CSPFT_STRING}, - {"reloadStartAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD_START]), CSPFT_STRING}, - {"reloadEndAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD_END]), CSPFT_STRING}, - {"raiseAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RAISE]), CSPFT_STRING}, - {"dropAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_DROP]), CSPFT_STRING}, - {"firstRaiseAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_FIRST_RAISE]), CSPFT_STRING}, - {"breachRaiseAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_BREACH_RAISE]), CSPFT_STRING}, - {"altRaiseAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ALT_RAISE]), CSPFT_STRING}, - {"altDropAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ALT_DROP]), CSPFT_STRING}, - {"quickRaiseAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_QUICK_RAISE]), CSPFT_STRING}, - {"quickDropAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_QUICK_DROP]), CSPFT_STRING}, - {"emptyRaiseAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_EMPTY_RAISE]), CSPFT_STRING}, - {"emptyDropAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_EMPTY_DROP]), CSPFT_STRING}, - {"sprintInAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_SPRINT_IN]), CSPFT_STRING}, - {"sprintLoopAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_SPRINT_LOOP]), CSPFT_STRING}, - {"sprintOutAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_SPRINT_OUT]), CSPFT_STRING}, - {"stunnedAnimStart", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_STUNNED_START]), CSPFT_STRING}, - {"stunnedAnimLoop", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_STUNNED_LOOP]), CSPFT_STRING}, - {"stunnedAnimEnd", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_STUNNED_END]), CSPFT_STRING}, - {"nightVisionWearAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_NIGHTVISION_WEAR]), CSPFT_STRING}, - {"nightVisionRemoveAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_NIGHTVISION_REMOVE]), CSPFT_STRING}, - {"adsFireAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ADS_FIRE]), CSPFT_STRING}, - {"adsLastShotAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ADS_LASTSHOT]), CSPFT_STRING}, - {"adsRechamberAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ADS_RECHAMBER]), CSPFT_STRING}, - {"adsUpAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ADS_UP]), CSPFT_STRING}, - {"adsDownAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ADS_DOWN]), CSPFT_STRING}, - {"idleAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_IDLE]), CSPFT_STRING}, - {"emptyIdleAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_EMPTY_IDLE]), CSPFT_STRING}, - {"fireAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_FIRE]), CSPFT_STRING}, - {"holdFireAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_HOLD_FIRE]), CSPFT_STRING}, - {"lastShotAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_LASTSHOT]), CSPFT_STRING}, - {"detonateAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_DETONATE]), CSPFT_STRING}, - {"rechamberAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_RECHAMBER]), CSPFT_STRING}, - {"meleeAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_MELEE]), CSPFT_STRING}, - {"meleeChargeAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_MELEE_CHARGE]), CSPFT_STRING}, - {"reloadAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_RELOAD]), CSPFT_STRING}, - {"reloadEmptyAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_RELOAD_EMPTY]), CSPFT_STRING}, - {"reloadStartAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_RELOAD_START]), CSPFT_STRING}, - {"reloadEndAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_RELOAD_END]), CSPFT_STRING}, - {"raiseAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_RAISE]), CSPFT_STRING}, - {"dropAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_DROP]), CSPFT_STRING}, - {"firstRaiseAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_FIRST_RAISE]), CSPFT_STRING}, - {"breachRaiseAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_BREACH_RAISE]), CSPFT_STRING}, - {"altRaiseAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_ALT_RAISE]), CSPFT_STRING}, - {"altDropAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_ALT_DROP]), CSPFT_STRING}, - {"quickRaiseAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_QUICK_RAISE]), CSPFT_STRING}, - {"quickDropAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_QUICK_DROP]), CSPFT_STRING}, - {"emptyRaiseAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_EMPTY_RAISE]), CSPFT_STRING}, - {"emptyDropAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_EMPTY_DROP]), CSPFT_STRING}, - {"sprintInAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_SPRINT_IN]), CSPFT_STRING}, - {"sprintLoopAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_SPRINT_LOOP]), CSPFT_STRING}, - {"sprintOutAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_SPRINT_OUT]), CSPFT_STRING}, - {"stunnedAnimStartR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_STUNNED_START]), CSPFT_STRING}, - {"stunnedAnimLoopR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_STUNNED_LOOP]), CSPFT_STRING}, - {"stunnedAnimEndR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_STUNNED_END]), CSPFT_STRING}, - {"nightVisionWearAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_NIGHTVISION_WEAR]), CSPFT_STRING}, - {"nightVisionRemoveAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_NIGHTVISION_REMOVE]), CSPFT_STRING}, - {"adsFireAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_ADS_FIRE]), CSPFT_STRING}, - {"adsLastShotAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_ADS_LASTSHOT]), CSPFT_STRING}, - {"adsRechamberAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_ADS_RECHAMBER]), CSPFT_STRING}, - {"adsUpAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_ADS_UP]), CSPFT_STRING}, - {"adsDownAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_ADS_DOWN]), CSPFT_STRING}, - {"idleAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_IDLE]), CSPFT_STRING}, - {"emptyIdleAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_EMPTY_IDLE]), CSPFT_STRING}, - {"fireAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_FIRE]), CSPFT_STRING}, - {"holdFireAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_HOLD_FIRE]), CSPFT_STRING}, - {"lastShotAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_LASTSHOT]), CSPFT_STRING}, - {"detonateAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_DETONATE]), CSPFT_STRING}, - {"rechamberAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_RECHAMBER]), CSPFT_STRING}, - {"meleeAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_MELEE]), CSPFT_STRING}, - {"meleeChargeAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_MELEE_CHARGE]), CSPFT_STRING}, - {"reloadAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_RELOAD]), CSPFT_STRING}, - {"reloadEmptyAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_RELOAD_EMPTY]), CSPFT_STRING}, - {"reloadStartAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_RELOAD_START]), CSPFT_STRING}, - {"reloadEndAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_RELOAD_END]), CSPFT_STRING}, - {"raiseAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_RAISE]), CSPFT_STRING}, - {"dropAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_DROP]), CSPFT_STRING}, - {"firstRaiseAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_FIRST_RAISE]), CSPFT_STRING}, - {"breachRaiseAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_BREACH_RAISE]), CSPFT_STRING}, - {"altRaiseAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_ALT_RAISE]), CSPFT_STRING}, - {"altDropAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_ALT_DROP]), CSPFT_STRING}, - {"quickRaiseAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_QUICK_RAISE]), CSPFT_STRING}, - {"quickDropAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_QUICK_DROP]), CSPFT_STRING}, - {"emptyRaiseAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_EMPTY_RAISE]), CSPFT_STRING}, - {"emptyDropAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_EMPTY_DROP]), CSPFT_STRING}, - {"sprintInAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_SPRINT_IN]), CSPFT_STRING}, - {"sprintLoopAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_SPRINT_LOOP]), CSPFT_STRING}, - {"sprintOutAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_SPRINT_OUT]), CSPFT_STRING}, - {"stunnedAnimStartL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_STUNNED_START]), CSPFT_STRING}, - {"stunnedAnimLoopL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_STUNNED_LOOP]), CSPFT_STRING}, - {"stunnedAnimEndL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_STUNNED_END]), CSPFT_STRING}, - {"nightVisionWearAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_NIGHTVISION_WEAR]), CSPFT_STRING}, - {"nightVisionRemoveAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_NIGHTVISION_REMOVE]), CSPFT_STRING}, - {"adsFireAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_ADS_FIRE]), CSPFT_STRING}, - {"adsLastShotAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_ADS_LASTSHOT]), CSPFT_STRING}, - {"adsRechamberAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_ADS_RECHAMBER]), CSPFT_STRING}, - {"adsUpAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_ADS_UP]), CSPFT_STRING}, - {"adsDownAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_ADS_DOWN]), CSPFT_STRING}, - {"script", offsetof(WeaponFullDef, weapDef.szScript), CSPFT_STRING}, - {"weaponType", offsetof(WeaponFullDef, weapDef.weapType), WFT_WEAPONTYPE}, - {"weaponClass", offsetof(WeaponFullDef, weapDef.weapClass), WFT_WEAPONCLASS}, - {"penetrateType", offsetof(WeaponFullDef, weapDef.penetrateType), WFT_PENETRATE_TYPE}, - {"penetrateMultiplier", offsetof(WeaponFullDef, weapCompleteDef.penetrateMultiplier), CSPFT_FLOAT}, - {"impactType", offsetof(WeaponFullDef, weapCompleteDef.impactType), WFT_IMPACT_TYPE}, - {"inventoryType", offsetof(WeaponFullDef, weapDef.inventoryType), WFT_INVENTORYTYPE}, - {"fireType", offsetof(WeaponFullDef, weapDef.fireType), WFT_FIRETYPE}, - {"offhandClass", offsetof(WeaponFullDef, weapDef.offhandClass), WFT_OFFHAND_CLASS}, - {"viewFlashEffect", offsetof(WeaponFullDef, weapDef.viewFlashEffect), CSPFT_FX}, - {"worldFlashEffect", offsetof(WeaponFullDef, weapDef.worldFlashEffect), CSPFT_FX}, - {"pickupSound", offsetof(WeaponFullDef, weapDef.pickupSound), CSPFT_SOUND}, - {"pickupSoundPlayer", offsetof(WeaponFullDef, weapDef.pickupSoundPlayer), CSPFT_SOUND}, - {"ammoPickupSound", offsetof(WeaponFullDef, weapDef.ammoPickupSound), CSPFT_SOUND}, - {"ammoPickupSoundPlayer", offsetof(WeaponFullDef, weapDef.ammoPickupSoundPlayer), CSPFT_SOUND}, - {"projectileSound", offsetof(WeaponFullDef, weapDef.projectileSound), CSPFT_SOUND}, - {"pullbackSound", offsetof(WeaponFullDef, weapDef.pullbackSound), CSPFT_SOUND}, - {"pullbackSoundPlayer", offsetof(WeaponFullDef, weapDef.pullbackSoundPlayer), CSPFT_SOUND}, - {"fireSound", offsetof(WeaponFullDef, weapDef.fireSound), CSPFT_SOUND}, - {"fireSoundPlayer", offsetof(WeaponFullDef, weapDef.fireSoundPlayer), CSPFT_SOUND}, - {"fireSoundPlayerAkimbo", offsetof(WeaponFullDef, weapDef.fireSoundPlayerAkimbo), CSPFT_SOUND}, - {"loopFireSound", offsetof(WeaponFullDef, weapDef.fireLoopSound), CSPFT_SOUND}, - {"loopFireSoundPlayer", offsetof(WeaponFullDef, weapDef.fireLoopSoundPlayer), CSPFT_SOUND}, - {"stopFireSound", offsetof(WeaponFullDef, weapDef.fireStopSound), CSPFT_SOUND}, - {"stopFireSoundPlayer", offsetof(WeaponFullDef, weapDef.fireStopSoundPlayer), CSPFT_SOUND}, - {"lastShotSound", offsetof(WeaponFullDef, weapDef.fireLastSound), CSPFT_SOUND}, - {"lastShotSoundPlayer", offsetof(WeaponFullDef, weapDef.fireLastSoundPlayer), CSPFT_SOUND}, - {"emptyFireSound", offsetof(WeaponFullDef, weapDef.emptyFireSound), CSPFT_SOUND}, - {"emptyFireSoundPlayer", offsetof(WeaponFullDef, weapDef.emptyFireSoundPlayer), CSPFT_SOUND}, - {"meleeSwipeSound", offsetof(WeaponFullDef, weapDef.meleeSwipeSound), CSPFT_SOUND}, - {"meleeSwipeSoundPlayer", offsetof(WeaponFullDef, weapDef.meleeSwipeSoundPlayer), CSPFT_SOUND}, - {"meleeHitSound", offsetof(WeaponFullDef, weapDef.meleeHitSound), CSPFT_SOUND}, - {"meleeMissSound", offsetof(WeaponFullDef, weapDef.meleeMissSound), CSPFT_SOUND}, - {"rechamberSound", offsetof(WeaponFullDef, weapDef.rechamberSound), CSPFT_SOUND}, - {"rechamberSoundPlayer", offsetof(WeaponFullDef, weapDef.rechamberSoundPlayer), CSPFT_SOUND}, - {"reloadSound", offsetof(WeaponFullDef, weapDef.reloadSound), CSPFT_SOUND}, - {"reloadSoundPlayer", offsetof(WeaponFullDef, weapDef.reloadSoundPlayer), CSPFT_SOUND}, - {"reloadEmptySound", offsetof(WeaponFullDef, weapDef.reloadEmptySound), CSPFT_SOUND}, - {"reloadEmptySoundPlayer", offsetof(WeaponFullDef, weapDef.reloadEmptySoundPlayer), CSPFT_SOUND}, - {"reloadStartSound", offsetof(WeaponFullDef, weapDef.reloadStartSound), CSPFT_SOUND}, - {"reloadStartSoundPlayer", offsetof(WeaponFullDef, weapDef.reloadStartSoundPlayer), CSPFT_SOUND}, - {"reloadEndSound", offsetof(WeaponFullDef, weapDef.reloadEndSound), CSPFT_SOUND}, - {"reloadEndSoundPlayer", offsetof(WeaponFullDef, weapDef.reloadEndSoundPlayer), CSPFT_SOUND}, - {"detonateSound", offsetof(WeaponFullDef, weapDef.detonateSound), CSPFT_SOUND}, - {"detonateSoundPlayer", offsetof(WeaponFullDef, weapDef.detonateSoundPlayer), CSPFT_SOUND}, - {"nightVisionWearSound", offsetof(WeaponFullDef, weapDef.nightVisionWearSound), CSPFT_SOUND}, - {"nightVisionWearSoundPlayer", offsetof(WeaponFullDef, weapDef.nightVisionWearSoundPlayer), CSPFT_SOUND}, - {"nightVisionRemoveSound", offsetof(WeaponFullDef, weapDef.nightVisionRemoveSound), CSPFT_SOUND}, - {"nightVisionRemoveSoundPlayer", offsetof(WeaponFullDef, weapDef.nightVisionRemoveSoundPlayer), CSPFT_SOUND}, - {"raiseSound", offsetof(WeaponFullDef, weapDef.raiseSound), CSPFT_SOUND}, - {"raiseSoundPlayer", offsetof(WeaponFullDef, weapDef.raiseSoundPlayer), CSPFT_SOUND}, - {"firstRaiseSound", offsetof(WeaponFullDef, weapDef.firstRaiseSound), CSPFT_SOUND}, - {"firstRaiseSoundPlayer", offsetof(WeaponFullDef, weapDef.firstRaiseSoundPlayer), CSPFT_SOUND}, - {"altSwitchSound", offsetof(WeaponFullDef, weapDef.altSwitchSound), CSPFT_SOUND}, - {"altSwitchSoundPlayer", offsetof(WeaponFullDef, weapDef.altSwitchSoundPlayer), CSPFT_SOUND}, - {"putawaySound", offsetof(WeaponFullDef, weapDef.putawaySound), CSPFT_SOUND}, - {"putawaySoundPlayer", offsetof(WeaponFullDef, weapDef.putawaySoundPlayer), CSPFT_SOUND}, - {"scanSound", offsetof(WeaponFullDef, weapDef.scanSound), CSPFT_SOUND}, - {"bounceSound", offsetof(WeaponFullDef, weapDef.bounceSound), WFT_BOUNCE_SOUND}, - {"viewShellEjectEffect", offsetof(WeaponFullDef, weapDef.viewShellEjectEffect), CSPFT_FX}, - {"worldShellEjectEffect", offsetof(WeaponFullDef, weapDef.worldShellEjectEffect), CSPFT_FX}, - {"viewLastShotEjectEffect", offsetof(WeaponFullDef, weapDef.viewLastShotEjectEffect), CSPFT_FX}, - {"worldLastShotEjectEffect", offsetof(WeaponFullDef, weapDef.worldLastShotEjectEffect), CSPFT_FX}, - {"reticleCenter", offsetof(WeaponFullDef, weapDef.reticleCenter), CSPFT_MATERIAL}, - {"reticleSide", offsetof(WeaponFullDef, weapDef.reticleSide), CSPFT_MATERIAL}, - {"reticleCenterSize", offsetof(WeaponFullDef, weapDef.iReticleCenterSize), CSPFT_INT}, - {"reticleSideSize", offsetof(WeaponFullDef, weapDef.iReticleSideSize), CSPFT_INT}, - {"reticleMinOfs", offsetof(WeaponFullDef, weapDef.iReticleMinOfs), CSPFT_INT}, - {"activeReticleType", offsetof(WeaponFullDef, weapDef.activeReticleType), WFT_ACTIVE_RETICLE_TYPE}, - {"standMoveF", offsetof(WeaponFullDef, weapDef.vStandMove[0]), CSPFT_FLOAT}, - {"standMoveR", offsetof(WeaponFullDef, weapDef.vStandMove[1]), CSPFT_FLOAT}, - {"standMoveU", offsetof(WeaponFullDef, weapDef.vStandMove[2]), CSPFT_FLOAT}, - {"standRotP", offsetof(WeaponFullDef, weapDef.vStandRot[0]), CSPFT_FLOAT}, - {"standRotY", offsetof(WeaponFullDef, weapDef.vStandRot[1]), CSPFT_FLOAT}, - {"standRotR", offsetof(WeaponFullDef, weapDef.vStandRot[2]), CSPFT_FLOAT}, - {"strafeMoveF", offsetof(WeaponFullDef, weapDef.strafeMove[0]), CSPFT_FLOAT}, - {"strafeMoveR", offsetof(WeaponFullDef, weapDef.strafeMove[1]), CSPFT_FLOAT}, - {"strafeMoveU", offsetof(WeaponFullDef, weapDef.strafeMove[2]), CSPFT_FLOAT}, - {"strafeRotP", offsetof(WeaponFullDef, weapDef.strafeRot[0]), CSPFT_FLOAT}, - {"strafeRotY", offsetof(WeaponFullDef, weapDef.strafeRot[1]), CSPFT_FLOAT}, - {"strafeRotR", offsetof(WeaponFullDef, weapDef.strafeRot[2]), CSPFT_FLOAT}, - {"duckedOfsF", offsetof(WeaponFullDef, weapDef.vDuckedOfs[0]), CSPFT_FLOAT}, - {"duckedOfsR", offsetof(WeaponFullDef, weapDef.vDuckedOfs[1]), CSPFT_FLOAT}, - {"duckedOfsU", offsetof(WeaponFullDef, weapDef.vDuckedOfs[2]), CSPFT_FLOAT}, - {"duckedMoveF", offsetof(WeaponFullDef, weapDef.vDuckedMove[0]), CSPFT_FLOAT}, - {"duckedMoveR", offsetof(WeaponFullDef, weapDef.vDuckedMove[1]), CSPFT_FLOAT}, - {"duckedMoveU", offsetof(WeaponFullDef, weapDef.vDuckedMove[2]), CSPFT_FLOAT}, - {"duckedRotP", offsetof(WeaponFullDef, weapDef.vDuckedRot[0]), CSPFT_FLOAT}, - {"duckedRotY", offsetof(WeaponFullDef, weapDef.vDuckedRot[1]), CSPFT_FLOAT}, - {"duckedRotR", offsetof(WeaponFullDef, weapDef.vDuckedRot[2]), CSPFT_FLOAT}, - {"proneOfsF", offsetof(WeaponFullDef, weapDef.vProneOfs[0]), CSPFT_FLOAT}, - {"proneOfsR", offsetof(WeaponFullDef, weapDef.vProneOfs[1]), CSPFT_FLOAT}, - {"proneOfsU", offsetof(WeaponFullDef, weapDef.vProneOfs[2]), CSPFT_FLOAT}, - {"proneMoveF", offsetof(WeaponFullDef, weapDef.vProneMove[0]), CSPFT_FLOAT}, - {"proneMoveR", offsetof(WeaponFullDef, weapDef.vProneMove[1]), CSPFT_FLOAT}, - {"proneMoveU", offsetof(WeaponFullDef, weapDef.vProneMove[2]), CSPFT_FLOAT}, - {"proneRotP", offsetof(WeaponFullDef, weapDef.vProneRot[0]), CSPFT_FLOAT}, - {"proneRotY", offsetof(WeaponFullDef, weapDef.vProneRot[1]), CSPFT_FLOAT}, - {"proneRotR", offsetof(WeaponFullDef, weapDef.vProneRot[2]), CSPFT_FLOAT}, - {"posMoveRate", offsetof(WeaponFullDef, weapDef.fPosMoveRate), CSPFT_FLOAT}, - {"posProneMoveRate", offsetof(WeaponFullDef, weapDef.fPosProneMoveRate), CSPFT_FLOAT}, - {"standMoveMinSpeed", offsetof(WeaponFullDef, weapDef.fStandMoveMinSpeed), CSPFT_FLOAT}, - {"duckedMoveMinSpeed", offsetof(WeaponFullDef, weapDef.fDuckedMoveMinSpeed), CSPFT_FLOAT}, - {"proneMoveMinSpeed", offsetof(WeaponFullDef, weapDef.fProneMoveMinSpeed), CSPFT_FLOAT}, - {"posRotRate", offsetof(WeaponFullDef, weapDef.fPosRotRate), CSPFT_FLOAT}, - {"posProneRotRate", offsetof(WeaponFullDef, weapDef.fPosProneRotRate), CSPFT_FLOAT}, - {"standRotMinSpeed", offsetof(WeaponFullDef, weapDef.fStandRotMinSpeed), CSPFT_FLOAT}, - {"duckedRotMinSpeed", offsetof(WeaponFullDef, weapDef.fDuckedRotMinSpeed), CSPFT_FLOAT}, - {"proneRotMinSpeed", offsetof(WeaponFullDef, weapDef.fProneRotMinSpeed), CSPFT_FLOAT}, - {"worldModel", offsetof(WeaponFullDef, worldModel[0]), CSPFT_XMODEL}, - {"worldModel2", offsetof(WeaponFullDef, worldModel[1]), CSPFT_XMODEL}, - {"worldModel3", offsetof(WeaponFullDef, worldModel[2]), CSPFT_XMODEL}, - {"worldModel4", offsetof(WeaponFullDef, worldModel[3]), CSPFT_XMODEL}, - {"worldModel5", offsetof(WeaponFullDef, worldModel[4]), CSPFT_XMODEL}, - {"worldModel6", offsetof(WeaponFullDef, worldModel[5]), CSPFT_XMODEL}, - {"worldModel7", offsetof(WeaponFullDef, worldModel[6]), CSPFT_XMODEL}, - {"worldModel8", offsetof(WeaponFullDef, worldModel[7]), CSPFT_XMODEL}, - {"worldModel9", offsetof(WeaponFullDef, worldModel[8]), CSPFT_XMODEL}, - {"worldModel10", offsetof(WeaponFullDef, worldModel[9]), CSPFT_XMODEL}, - {"worldModel11", offsetof(WeaponFullDef, worldModel[10]), CSPFT_XMODEL}, - {"worldModel12", offsetof(WeaponFullDef, worldModel[11]), CSPFT_XMODEL}, - {"worldModel13", offsetof(WeaponFullDef, worldModel[12]), CSPFT_XMODEL}, - {"worldModel14", offsetof(WeaponFullDef, worldModel[13]), CSPFT_XMODEL}, - {"worldModel15", offsetof(WeaponFullDef, worldModel[14]), CSPFT_XMODEL}, - {"worldModel16", offsetof(WeaponFullDef, worldModel[15]), CSPFT_XMODEL}, - {"worldClipModel", offsetof(WeaponFullDef, weapDef.worldClipModel), CSPFT_XMODEL}, - {"rocketModel", offsetof(WeaponFullDef, weapDef.rocketModel), CSPFT_XMODEL}, - {"knifeModel", offsetof(WeaponFullDef, weapDef.knifeModel), CSPFT_XMODEL}, - {"worldKnifeModel", offsetof(WeaponFullDef, weapDef.worldKnifeModel), CSPFT_XMODEL}, - {"hudIcon", offsetof(WeaponFullDef, weapDef.hudIcon), CSPFT_MATERIAL}, - {"hudIconRatio", offsetof(WeaponFullDef, weapDef.hudIconRatio), WFT_ICONRATIO_HUD}, - {"pickupIcon", offsetof(WeaponFullDef, weapDef.pickupIcon), CSPFT_MATERIAL}, - {"pickupIconRatio", offsetof(WeaponFullDef, weapDef.pickupIconRatio), WFT_ICONRATIO_PICKUP}, - {"ammoCounterIcon", offsetof(WeaponFullDef, weapDef.ammoCounterIcon), CSPFT_MATERIAL}, - {"ammoCounterIconRatio", offsetof(WeaponFullDef, weapDef.ammoCounterIconRatio), WFT_ICONRATIO_AMMOCOUNTER}, - {"ammoCounterClip", offsetof(WeaponFullDef, weapDef.ammoCounterClip), WFT_AMMOCOUNTER_CLIPTYPE}, - {"startAmmo", offsetof(WeaponFullDef, weapDef.iStartAmmo), CSPFT_INT}, - {"shareAmmo", offsetof(WeaponFullDef, weapDef.sharedAmmo), CSPFT_BOOL}, - {"ammoName", offsetof(WeaponFullDef, weapDef.szAmmoName), CSPFT_STRING}, - {"clipName", offsetof(WeaponFullDef, weapDef.szClipName), CSPFT_STRING}, - {"maxAmmo", offsetof(WeaponFullDef, weapDef.iMaxAmmo), CSPFT_INT}, - {"clipSize", offsetof(WeaponFullDef, weapCompleteDef.iClipSize), CSPFT_INT}, - {"shotCount", offsetof(WeaponFullDef, weapDef.shotCount), CSPFT_INT}, - {"sharedAmmoCapName", offsetof(WeaponFullDef, weapDef.szSharedAmmoCapName), CSPFT_STRING}, - {"sharedAmmoCap", offsetof(WeaponFullDef, weapDef.iSharedAmmoCap), CSPFT_INT}, - {"damage", offsetof(WeaponFullDef, weapDef.damage), CSPFT_INT}, - {"playerDamage", offsetof(WeaponFullDef, weapDef.playerDamage), CSPFT_INT}, - {"meleeDamage", offsetof(WeaponFullDef, weapDef.iMeleeDamage), CSPFT_INT}, - {"minDamage", offsetof(WeaponFullDef, weapDef.minDamage), CSPFT_INT}, - {"minPlayerDamage", offsetof(WeaponFullDef, weapDef.minPlayerDamage), CSPFT_INT}, - {"maxDamageRange", offsetof(WeaponFullDef, weapDef.fMaxDamageRange), CSPFT_FLOAT}, - {"minDamageRange", offsetof(WeaponFullDef, weapDef.fMinDamageRange), CSPFT_FLOAT}, - {"destabilizationRateTime", offsetof(WeaponFullDef, weapDef.destabilizationRateTime), CSPFT_FLOAT}, - {"destabilizationCurvatureMax", offsetof(WeaponFullDef, weapDef.destabilizationCurvatureMax), CSPFT_FLOAT}, - {"destabilizeDistance", offsetof(WeaponFullDef, weapDef.destabilizeDistance), CSPFT_INT}, - {"fireDelay", offsetof(WeaponFullDef, weapDef.iFireDelay), CSPFT_MILLISECONDS}, - {"meleeDelay", offsetof(WeaponFullDef, weapDef.iMeleeDelay), CSPFT_MILLISECONDS}, - {"meleeChargeDelay", offsetof(WeaponFullDef, weapDef.meleeChargeDelay), CSPFT_MILLISECONDS}, - {"fireTime", offsetof(WeaponFullDef, weapCompleteDef.iFireTime), CSPFT_MILLISECONDS}, - {"rechamberTime", offsetof(WeaponFullDef, weapDef.iRechamberTime), CSPFT_MILLISECONDS}, - {"rechamberTimeOneHanded", offsetof(WeaponFullDef, weapDef.rechamberTimeOneHanded), CSPFT_MILLISECONDS}, - {"rechamberBoltTime", offsetof(WeaponFullDef, weapDef.iRechamberBoltTime), CSPFT_MILLISECONDS}, - {"holdFireTime", offsetof(WeaponFullDef, weapDef.iHoldFireTime), CSPFT_MILLISECONDS}, - {"detonateTime", offsetof(WeaponFullDef, weapDef.iDetonateTime), CSPFT_MILLISECONDS}, - {"detonateDelay", offsetof(WeaponFullDef, weapDef.iDetonateDelay), CSPFT_MILLISECONDS}, - {"meleeTime", offsetof(WeaponFullDef, weapDef.iMeleeTime), CSPFT_MILLISECONDS}, - {"meleeChargeTime", offsetof(WeaponFullDef, weapDef.meleeChargeTime), CSPFT_MILLISECONDS}, - {"reloadTime", offsetof(WeaponFullDef, weapDef.iReloadTime), CSPFT_MILLISECONDS}, - {"reloadShowRocketTime", offsetof(WeaponFullDef, weapDef.reloadShowRocketTime), CSPFT_MILLISECONDS}, - {"reloadEmptyTime", offsetof(WeaponFullDef, weapDef.iReloadEmptyTime), CSPFT_MILLISECONDS}, - {"reloadAddTime", offsetof(WeaponFullDef, weapDef.iReloadAddTime), CSPFT_MILLISECONDS}, - {"reloadStartTime", offsetof(WeaponFullDef, weapDef.iReloadStartTime), CSPFT_MILLISECONDS}, - {"reloadStartAddTime", offsetof(WeaponFullDef, weapDef.iReloadStartAddTime), CSPFT_MILLISECONDS}, - {"reloadEndTime", offsetof(WeaponFullDef, weapDef.iReloadEndTime), CSPFT_MILLISECONDS}, - {"dropTime", offsetof(WeaponFullDef, weapDef.iDropTime), CSPFT_MILLISECONDS}, - {"raiseTime", offsetof(WeaponFullDef, weapDef.iRaiseTime), CSPFT_MILLISECONDS}, - {"altDropTime", offsetof(WeaponFullDef, weapDef.iAltDropTime), CSPFT_MILLISECONDS}, - {"altRaiseTime", offsetof(WeaponFullDef, weapCompleteDef.iAltRaiseTime), CSPFT_MILLISECONDS}, - {"quickDropTime", offsetof(WeaponFullDef, weapDef.quickDropTime), CSPFT_MILLISECONDS}, - {"quickRaiseTime", offsetof(WeaponFullDef, weapDef.quickRaiseTime), CSPFT_MILLISECONDS}, - {"firstRaiseTime", offsetof(WeaponFullDef, weapCompleteDef.iFirstRaiseTime), CSPFT_MILLISECONDS}, - {"breachRaiseTime", offsetof(WeaponFullDef, weapDef.iBreachRaiseTime), CSPFT_MILLISECONDS}, - {"emptyRaiseTime", offsetof(WeaponFullDef, weapDef.iEmptyRaiseTime), CSPFT_MILLISECONDS}, - {"emptyDropTime", offsetof(WeaponFullDef, weapDef.iEmptyDropTime), CSPFT_MILLISECONDS}, - {"sprintInTime", offsetof(WeaponFullDef, weapDef.sprintInTime), CSPFT_MILLISECONDS}, - {"sprintLoopTime", offsetof(WeaponFullDef, weapDef.sprintLoopTime), CSPFT_MILLISECONDS}, - {"sprintOutTime", offsetof(WeaponFullDef, weapDef.sprintOutTime), CSPFT_MILLISECONDS}, - {"stunnedTimeBegin", offsetof(WeaponFullDef, weapDef.stunnedTimeBegin), CSPFT_MILLISECONDS}, - {"stunnedTimeLoop", offsetof(WeaponFullDef, weapDef.stunnedTimeLoop), CSPFT_MILLISECONDS}, - {"stunnedTimeEnd", offsetof(WeaponFullDef, weapDef.stunnedTimeEnd), CSPFT_MILLISECONDS}, - {"nightVisionWearTime", offsetof(WeaponFullDef, weapDef.nightVisionWearTime), CSPFT_MILLISECONDS}, - {"nightVisionWearTimeFadeOutEnd", offsetof(WeaponFullDef, weapDef.nightVisionWearTimeFadeOutEnd), CSPFT_MILLISECONDS}, - {"nightVisionWearTimePowerUp", offsetof(WeaponFullDef, weapDef.nightVisionWearTimePowerUp), CSPFT_MILLISECONDS}, - {"nightVisionRemoveTime", offsetof(WeaponFullDef, weapDef.nightVisionRemoveTime), CSPFT_MILLISECONDS}, - {"nightVisionRemoveTimePowerDown", offsetof(WeaponFullDef, weapDef.nightVisionRemoveTimePowerDown), CSPFT_MILLISECONDS}, - {"nightVisionRemoveTimeFadeInStart", offsetof(WeaponFullDef, weapDef.nightVisionRemoveTimeFadeInStart), CSPFT_MILLISECONDS}, - {"fuseTime", offsetof(WeaponFullDef, weapDef.fuseTime), CSPFT_MILLISECONDS}, - {"aifuseTime", offsetof(WeaponFullDef, weapDef.aiFuseTime), CSPFT_MILLISECONDS}, - {"lockonSupported", offsetof(WeaponFullDef, weapDef.lockonSupported), CSPFT_BOOL}, - {"requireLockonToFire", offsetof(WeaponFullDef, weapDef.requireLockonToFire), CSPFT_BOOL}, - {"bigExplosion", offsetof(WeaponFullDef, weapDef.bigExplosion), CSPFT_BOOL}, - {"noAdsWhenMagEmpty", offsetof(WeaponFullDef, weapDef.noAdsWhenMagEmpty), CSPFT_BOOL}, - {"inheritsPerks", offsetof(WeaponFullDef, weapDef.inheritsPerks), CSPFT_BOOL}, - {"avoidDropCleanup", offsetof(WeaponFullDef, weapDef.avoidDropCleanup), CSPFT_BOOL}, - {"autoAimRange", offsetof(WeaponFullDef, weapDef.autoAimRange), CSPFT_FLOAT}, - {"aimAssistRange", offsetof(WeaponFullDef, weapDef.aimAssistRange), CSPFT_FLOAT}, - {"aimAssistRangeAds", offsetof(WeaponFullDef, weapDef.aimAssistRangeAds), CSPFT_FLOAT}, - {"aimPadding", offsetof(WeaponFullDef, weapDef.aimPadding), CSPFT_FLOAT}, - {"enemyCrosshairRange", offsetof(WeaponFullDef, weapDef.enemyCrosshairRange), CSPFT_FLOAT}, - {"crosshairColorChange", offsetof(WeaponFullDef, weapDef.crosshairColorChange), CSPFT_BOOL}, - {"moveSpeedScale", offsetof(WeaponFullDef, weapDef.moveSpeedScale), CSPFT_FLOAT}, - {"adsMoveSpeedScale", offsetof(WeaponFullDef, weapDef.adsMoveSpeedScale), CSPFT_FLOAT}, - {"sprintDurationScale", offsetof(WeaponFullDef, weapDef.sprintDurationScale), CSPFT_FLOAT}, - {"idleCrouchFactor", offsetof(WeaponFullDef, weapDef.fIdleCrouchFactor), CSPFT_FLOAT}, - {"idleProneFactor", offsetof(WeaponFullDef, weapDef.fIdleProneFactor), CSPFT_FLOAT}, - {"gunMaxPitch", offsetof(WeaponFullDef, weapDef.fGunMaxPitch), CSPFT_FLOAT}, - {"gunMaxYaw", offsetof(WeaponFullDef, weapDef.fGunMaxYaw), CSPFT_FLOAT}, - {"swayMaxAngle", offsetof(WeaponFullDef, weapDef.swayMaxAngle), CSPFT_FLOAT}, - {"swayLerpSpeed", offsetof(WeaponFullDef, weapDef.swayLerpSpeed), CSPFT_FLOAT}, - {"swayPitchScale", offsetof(WeaponFullDef, weapDef.swayPitchScale), CSPFT_FLOAT}, - {"swayYawScale", offsetof(WeaponFullDef, weapDef.swayYawScale), CSPFT_FLOAT}, - {"swayHorizScale", offsetof(WeaponFullDef, weapDef.swayHorizScale), CSPFT_FLOAT}, - {"swayVertScale", offsetof(WeaponFullDef, weapDef.swayVertScale), CSPFT_FLOAT}, - {"swayShellShockScale", offsetof(WeaponFullDef, weapDef.swayShellShockScale), CSPFT_FLOAT}, - {"adsSwayMaxAngle", offsetof(WeaponFullDef, weapDef.adsSwayMaxAngle), CSPFT_FLOAT}, - {"adsSwayLerpSpeed", offsetof(WeaponFullDef, weapDef.adsSwayLerpSpeed), CSPFT_FLOAT}, - {"adsSwayPitchScale", offsetof(WeaponFullDef, weapDef.adsSwayPitchScale), CSPFT_FLOAT}, - {"adsSwayYawScale", offsetof(WeaponFullDef, weapDef.adsSwayYawScale), CSPFT_FLOAT}, - {"adsSwayHorizScale", offsetof(WeaponFullDef, weapDef.adsSwayHorizScale), CSPFT_FLOAT}, - {"adsSwayVertScale", offsetof(WeaponFullDef, weapDef.adsSwayVertScale), CSPFT_FLOAT}, - {"rifleBullet", offsetof(WeaponFullDef, weapDef.bRifleBullet), CSPFT_BOOL}, - {"armorPiercing", offsetof(WeaponFullDef, weapDef.armorPiercing), CSPFT_BOOL}, - {"boltAction", offsetof(WeaponFullDef, weapDef.bBoltAction), CSPFT_BOOL}, - {"aimDownSight", offsetof(WeaponFullDef, weapDef.aimDownSight), CSPFT_BOOL}, - {"rechamberWhileAds", offsetof(WeaponFullDef, weapDef.bRechamberWhileAds), CSPFT_BOOL}, - {"bBulletExplosiveDamage", offsetof(WeaponFullDef, weapDef.bBulletExplosiveDamage), CSPFT_BOOL}, - {"adsViewErrorMin", offsetof(WeaponFullDef, weapDef.adsViewErrorMin), CSPFT_FLOAT}, - {"adsViewErrorMax", offsetof(WeaponFullDef, weapDef.adsViewErrorMax), CSPFT_FLOAT}, - {"clipOnly", offsetof(WeaponFullDef, weapDef.bClipOnly), CSPFT_BOOL}, - {"noAmmoPickup", offsetof(WeaponFullDef, weapDef.noAmmoPickup), CSPFT_BOOL}, - {"cookOffHold", offsetof(WeaponFullDef, weapDef.bCookOffHold), CSPFT_BOOL}, - {"adsFire", offsetof(WeaponFullDef, weapDef.adsFireOnly), CSPFT_BOOL}, - {"cancelAutoHolsterWhenEmpty", offsetof(WeaponFullDef, weapDef.cancelAutoHolsterWhenEmpty), CSPFT_BOOL}, - {"disableSwitchToWhenEmpty", offsetof(WeaponFullDef, weapDef.disableSwitchToWhenEmpty), CSPFT_BOOL}, - {"suppressAmmoReserveDisplay", offsetof(WeaponFullDef, weapDef.suppressAmmoReserveDisplay), CSPFT_BOOL}, - {"enhanced", offsetof(WeaponFullDef, weapCompleteDef.enhanced), CSPFT_BOOL}, - {"motionTracker", offsetof(WeaponFullDef, weapCompleteDef.motionTracker), CSPFT_BOOL}, - {"laserSightDuringNightvision", offsetof(WeaponFullDef, weapDef.laserSightDuringNightvision), CSPFT_BOOL}, - {"markableViewmodel", offsetof(WeaponFullDef, weapDef.markableViewmodel), CSPFT_BOOL}, - {"physCollmap", offsetof(WeaponFullDef, weapDef.physCollmap), CSPFT_PHYS_COLLMAP}, - {"noDualWield", offsetof(WeaponFullDef, weapDef.noDualWield), CSPFT_BOOL}, - {"dualWieldViewModelOffset", offsetof(WeaponFullDef, weapDef.dualWieldViewModelOffset), CSPFT_FLOAT}, - {"killIcon", offsetof(WeaponFullDef, weapCompleteDef.killIcon), CSPFT_MATERIAL}, - {"killIconRatio", offsetof(WeaponFullDef, weapDef.killIconRatio), WFT_ICONRATIO_KILL}, - {"flipKillIcon", offsetof(WeaponFullDef, weapDef.flipKillIcon), CSPFT_BOOL}, - {"dpadIcon", offsetof(WeaponFullDef, weapCompleteDef.dpadIcon), CSPFT_MATERIAL}, - {"dpadIconRatio", offsetof(WeaponFullDef, weapCompleteDef.dpadIconRatio), WFT_ICONRATIO_DPAD}, - {"dpadIconShowsAmmo", offsetof(WeaponFullDef, weapCompleteDef.dpadIconShowsAmmo), CSPFT_BOOL}, - {"noPartialReload", offsetof(WeaponFullDef, weapDef.bNoPartialReload), CSPFT_BOOL}, - {"segmentedReload", offsetof(WeaponFullDef, weapDef.bSegmentedReload), CSPFT_BOOL}, - {"reloadAmmoAdd", offsetof(WeaponFullDef, weapDef.iReloadAmmoAdd), CSPFT_INT}, - {"reloadStartAdd", offsetof(WeaponFullDef, weapDef.iReloadStartAdd), CSPFT_INT}, - {"altWeapon", offsetof(WeaponFullDef, weapCompleteDef.szAltWeaponName), CSPFT_STRING}, - {"dropAmmoMin", offsetof(WeaponFullDef, weapDef.ammoDropStockMin), CSPFT_INT}, - {"dropAmmoMax", offsetof(WeaponFullDef, weapCompleteDef.ammoDropStockMax), CSPFT_INT}, - {"ammoDropClipPercentMin", offsetof(WeaponFullDef, weapDef.ammoDropClipPercentMin), CSPFT_INT}, - {"ammoDropClipPercentMax", offsetof(WeaponFullDef, weapDef.ammoDropClipPercentMax), CSPFT_INT}, - {"blocksProne", offsetof(WeaponFullDef, weapDef.blocksProne), CSPFT_BOOL}, - {"silenced", offsetof(WeaponFullDef, weapDef.silenced), CSPFT_BOOL}, - {"isRollingGrenade", offsetof(WeaponFullDef, weapDef.isRollingGrenade), CSPFT_BOOL}, - {"explosionRadius", offsetof(WeaponFullDef, weapDef.iExplosionRadius), CSPFT_INT}, - {"explosionRadiusMin", offsetof(WeaponFullDef, weapDef.iExplosionRadiusMin), CSPFT_INT}, - {"explosionInnerDamage", offsetof(WeaponFullDef, weapDef.iExplosionInnerDamage), CSPFT_INT}, - {"explosionOuterDamage", offsetof(WeaponFullDef, weapDef.iExplosionOuterDamage), CSPFT_INT}, - {"damageConeAngle", offsetof(WeaponFullDef, weapDef.damageConeAngle), CSPFT_FLOAT}, - {"bulletExplDmgMult", offsetof(WeaponFullDef, weapDef.bulletExplDmgMult), CSPFT_FLOAT}, - {"bulletExplRadiusMult", offsetof(WeaponFullDef, weapDef.bulletExplRadiusMult), CSPFT_FLOAT}, - {"projectileSpeed", offsetof(WeaponFullDef, weapDef.iProjectileSpeed), CSPFT_INT}, - {"projectileSpeedUp", offsetof(WeaponFullDef, weapDef.iProjectileSpeedUp), CSPFT_INT}, - {"projectileSpeedForward", offsetof(WeaponFullDef, weapDef.iProjectileSpeedForward), CSPFT_INT}, - {"projectileActivateDist", offsetof(WeaponFullDef, weapDef.iProjectileActivateDist), CSPFT_INT}, - {"projectileLifetime", offsetof(WeaponFullDef, weapDef.projLifetime), CSPFT_FLOAT}, - {"timeToAccelerate", offsetof(WeaponFullDef, weapDef.timeToAccelerate), CSPFT_FLOAT}, - {"projectileCurvature", offsetof(WeaponFullDef, weapDef.projectileCurvature), CSPFT_FLOAT}, - {"projectileModel", offsetof(WeaponFullDef, weapDef.projectileModel), CSPFT_XMODEL}, - {"projExplosionType", offsetof(WeaponFullDef, weapDef.projExplosion), WFT_PROJ_EXPLOSION}, - {"projExplosionEffect", offsetof(WeaponFullDef, weapDef.projExplosionEffect), CSPFT_FX}, - {"projExplosionEffectForceNormalUp", offsetof(WeaponFullDef, weapDef.projExplosionEffectForceNormalUp), CSPFT_BOOL}, - {"projExplosionSound", offsetof(WeaponFullDef, weapDef.projExplosionSound), CSPFT_SOUND}, - {"projDudEffect", offsetof(WeaponFullDef, weapDef.projDudEffect), CSPFT_FX}, - {"projDudSound", offsetof(WeaponFullDef, weapDef.projDudSound), CSPFT_SOUND}, - {"projImpactExplode", offsetof(WeaponFullDef, weapDef.bProjImpactExplode), CSPFT_BOOL}, - {"stickiness", offsetof(WeaponFullDef, weapDef.stickiness), WFT_STICKINESS}, - {"stickToPlayers", offsetof(WeaponFullDef, weapDef.stickToPlayers), CSPFT_BOOL}, - {"hasDetonator", offsetof(WeaponFullDef, weapDef.hasDetonator), CSPFT_BOOL}, - {"disableFiring", offsetof(WeaponFullDef, weapDef.disableFiring), CSPFT_BOOL}, - {"timedDetonation", offsetof(WeaponFullDef, weapDef.timedDetonation), CSPFT_BOOL}, - {"rotate", offsetof(WeaponFullDef, weapDef.rotate), CSPFT_BOOL}, - {"holdButtonToThrow", offsetof(WeaponFullDef, weapDef.holdButtonToThrow), CSPFT_BOOL}, - {"freezeMovementWhenFiring", offsetof(WeaponFullDef, weapDef.freezeMovementWhenFiring), CSPFT_BOOL}, - {"lowAmmoWarningThreshold", offsetof(WeaponFullDef, weapDef.lowAmmoWarningThreshold), CSPFT_FLOAT}, - {"ricochetChance", offsetof(WeaponFullDef, weapDef.ricochetChance), CSPFT_FLOAT}, - {"offhandHoldIsCancelable", offsetof(WeaponFullDef, weapDef.offhandHoldIsCancelable), CSPFT_BOOL}, - {"parallelDefaultBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_DEFAULT]), CSPFT_FLOAT}, - {"parallelBarkBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_BARK]), CSPFT_FLOAT}, - {"parallelBrickBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_BRICK]), CSPFT_FLOAT}, - {"parallelCarpetBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_CARPET]), CSPFT_FLOAT}, - {"parallelClothBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_CLOTH]), CSPFT_FLOAT}, - {"parallelConcreteBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_CONCRETE]), CSPFT_FLOAT}, - {"parallelDirtBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_DIRT]), CSPFT_FLOAT}, - {"parallelFleshBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_FLESH]), CSPFT_FLOAT}, - {"parallelFoliageBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_FOLIAGE]), CSPFT_FLOAT}, - {"parallelGlassBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_GLASS]), CSPFT_FLOAT}, - {"parallelGrassBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_GRASS]), CSPFT_FLOAT}, - {"parallelGravelBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_GRAVEL]), CSPFT_FLOAT}, - {"parallelIceBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_ICE]), CSPFT_FLOAT}, - {"parallelMetalBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_METAL]), CSPFT_FLOAT}, - {"parallelMudBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_MUD]), CSPFT_FLOAT}, - {"parallelPaperBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_PAPER]), CSPFT_FLOAT}, - {"parallelPlasterBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_PLASTER]), CSPFT_FLOAT}, - {"parallelRockBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_ROCK]), CSPFT_FLOAT}, - {"parallelSandBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_SAND]), CSPFT_FLOAT}, - {"parallelSnowBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_SNOW]), CSPFT_FLOAT}, - {"parallelWaterBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_WATER]), CSPFT_FLOAT}, - {"parallelWoodBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_WOOD]), CSPFT_FLOAT}, - {"parallelAsphaltBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_ASPHALT]), CSPFT_FLOAT}, - {"parallelCeramicBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_CERAMIC]), CSPFT_FLOAT}, - {"parallelPlasticBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_PLASTIC]), CSPFT_FLOAT}, - {"parallelRubberBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_RUBBER]), CSPFT_FLOAT}, - {"parallelCushionBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_CUSHION]), CSPFT_FLOAT}, - {"parallelFruitBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_FRUIT]), CSPFT_FLOAT}, - {"parallelPaintedMetalBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_PAINTED_METAL]), CSPFT_FLOAT}, - {"parallelRiotShieldBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_RIOT_SHIELD]), CSPFT_FLOAT}, - {"parallelSlushBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_SLUSH]), CSPFT_FLOAT}, - {"perpendicularDefaultBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_DEFAULT]), CSPFT_FLOAT}, - {"perpendicularBarkBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_BARK]), CSPFT_FLOAT}, - {"perpendicularBrickBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_BRICK]), CSPFT_FLOAT}, - {"perpendicularCarpetBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_CARPET]), CSPFT_FLOAT}, - {"perpendicularClothBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_CLOTH]), CSPFT_FLOAT}, - {"perpendicularConcreteBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_CONCRETE]), CSPFT_FLOAT}, - {"perpendicularDirtBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_DIRT]), CSPFT_FLOAT}, - {"perpendicularFleshBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_FLESH]), CSPFT_FLOAT}, - {"perpendicularFoliageBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_FOLIAGE]), CSPFT_FLOAT}, - {"perpendicularGlassBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_GLASS]), CSPFT_FLOAT}, - {"perpendicularGrassBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_GRASS]), CSPFT_FLOAT}, - {"perpendicularGravelBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_GRAVEL]), CSPFT_FLOAT}, - {"perpendicularIceBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_ICE]), CSPFT_FLOAT}, - {"perpendicularMetalBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_METAL]), CSPFT_FLOAT}, - {"perpendicularMudBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_MUD]), CSPFT_FLOAT}, - {"perpendicularPaperBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_PAPER]), CSPFT_FLOAT}, - {"perpendicularPlasterBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_PLASTER]), CSPFT_FLOAT}, - {"perpendicularRockBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_ROCK]), CSPFT_FLOAT}, - {"perpendicularSandBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_SAND]), CSPFT_FLOAT}, - {"perpendicularSnowBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_SNOW]), CSPFT_FLOAT}, - {"perpendicularWaterBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_WATER]), CSPFT_FLOAT}, - {"perpendicularWoodBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_WOOD]), CSPFT_FLOAT}, - {"perpendicularAsphaltBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_ASPHALT]), CSPFT_FLOAT}, - {"perpendicularCeramicBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_CERAMIC]), CSPFT_FLOAT}, - {"perpendicularPlasticBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_PLASTIC]), CSPFT_FLOAT}, - {"perpendicularRubberBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_RUBBER]), CSPFT_FLOAT}, - {"perpendicularCushionBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_CUSHION]), CSPFT_FLOAT}, - {"perpendicularFruitBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_FRUIT]), CSPFT_FLOAT}, - {"perpendicularPaintedMetalBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_PAINTED_METAL]), CSPFT_FLOAT}, - {"perpendicularRiotShieldBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_RIOT_SHIELD]), CSPFT_FLOAT}, - {"perpendicularSlushBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_SLUSH]), CSPFT_FLOAT}, - {"projTrailEffect", offsetof(WeaponFullDef, weapDef.projTrailEffect), CSPFT_FX}, - {"projBeaconEffect", offsetof(WeaponFullDef, weapDef.projBeaconEffect), CSPFT_FX}, - {"projectileRed", offsetof(WeaponFullDef, weapDef.vProjectileColor[0]), CSPFT_FLOAT}, - {"projectileGreen", offsetof(WeaponFullDef, weapDef.vProjectileColor[1]), CSPFT_FLOAT}, - {"projectileBlue", offsetof(WeaponFullDef, weapDef.vProjectileColor[2]), CSPFT_FLOAT}, - {"guidedMissileType", offsetof(WeaponFullDef, weapDef.guidedMissileType), WFT_GUIDED_MISSILE_TYPE}, - {"maxSteeringAccel", offsetof(WeaponFullDef, weapDef.maxSteeringAccel), CSPFT_FLOAT}, - {"projIgnitionDelay", offsetof(WeaponFullDef, weapDef.projIgnitionDelay), CSPFT_INT}, - {"projIgnitionEffect", offsetof(WeaponFullDef, weapDef.projIgnitionEffect), CSPFT_FX}, - {"projIgnitionSound", offsetof(WeaponFullDef, weapDef.projIgnitionSound), CSPFT_SOUND}, - {"adsTransInTime", offsetof(WeaponFullDef, weapCompleteDef.iAdsTransInTime), CSPFT_MILLISECONDS}, - {"adsTransOutTime", offsetof(WeaponFullDef, weapCompleteDef.iAdsTransOutTime), CSPFT_MILLISECONDS}, - {"adsIdleAmount", offsetof(WeaponFullDef, weapDef.fAdsIdleAmount), CSPFT_FLOAT}, - {"adsIdleSpeed", offsetof(WeaponFullDef, weapDef.adsIdleSpeed), CSPFT_FLOAT}, - {"adsZoomFov", offsetof(WeaponFullDef, weapCompleteDef.fAdsZoomFov), CSPFT_FLOAT}, - {"adsZoomInFrac", offsetof(WeaponFullDef, weapDef.fAdsZoomInFrac), CSPFT_FLOAT}, - {"adsZoomOutFrac", offsetof(WeaponFullDef, weapDef.fAdsZoomOutFrac), CSPFT_FLOAT}, - {"adsOverlayShader", offsetof(WeaponFullDef, weapDef.overlayMaterial), CSPFT_MATERIAL}, - {"adsOverlayShaderLowRes", offsetof(WeaponFullDef, weapDef.overlayMaterialLowRes), CSPFT_MATERIAL}, - {"adsOverlayShaderEMP", offsetof(WeaponFullDef, weapDef.overlayMaterialEMP), CSPFT_MATERIAL}, - {"adsOverlayShaderEMPLowRes", offsetof(WeaponFullDef, weapDef.overlayMaterialEMPLowRes), CSPFT_MATERIAL}, - {"adsOverlayReticle", offsetof(WeaponFullDef, weapDef.overlayReticle), WFT_OVERLAYRETICLE}, - {"adsOverlayInterface", offsetof(WeaponFullDef, weapDef.overlayInterface), WFT_OVERLAYINTERFACE}, - {"adsOverlayWidth", offsetof(WeaponFullDef, weapDef.overlayWidth), CSPFT_FLOAT}, - {"adsOverlayHeight", offsetof(WeaponFullDef, weapDef.overlayHeight), CSPFT_FLOAT}, - {"adsOverlayWidthSplitscreen", offsetof(WeaponFullDef, weapDef.overlayWidthSplitscreen), CSPFT_FLOAT}, - {"adsOverlayHeightSplitscreen", offsetof(WeaponFullDef, weapDef.overlayHeightSplitscreen), CSPFT_FLOAT}, - {"adsBobFactor", offsetof(WeaponFullDef, weapDef.fAdsBobFactor), CSPFT_FLOAT}, - {"adsViewBobMult", offsetof(WeaponFullDef, weapDef.fAdsViewBobMult), CSPFT_FLOAT}, - {"adsAimPitch", offsetof(WeaponFullDef, weapDef.fAdsAimPitch), CSPFT_FLOAT}, - {"adsCrosshairInFrac", offsetof(WeaponFullDef, weapDef.fAdsCrosshairInFrac), CSPFT_FLOAT}, - {"adsCrosshairOutFrac", offsetof(WeaponFullDef, weapDef.fAdsCrosshairOutFrac), CSPFT_FLOAT}, - {"adsReloadTransTime", offsetof(WeaponFullDef, weapDef.iPositionReloadTransTime), CSPFT_MILLISECONDS}, - {"adsGunKickReducedKickBullets", offsetof(WeaponFullDef, weapDef.adsGunKickReducedKickBullets), CSPFT_INT}, - {"adsGunKickReducedKickPercent", offsetof(WeaponFullDef, weapDef.adsGunKickReducedKickPercent), CSPFT_FLOAT}, - {"adsGunKickPitchMin", offsetof(WeaponFullDef, weapDef.fAdsGunKickPitchMin), CSPFT_FLOAT}, - {"adsGunKickPitchMax", offsetof(WeaponFullDef, weapDef.fAdsGunKickPitchMax), CSPFT_FLOAT}, - {"adsGunKickYawMin", offsetof(WeaponFullDef, weapDef.fAdsGunKickYawMin), CSPFT_FLOAT}, - {"adsGunKickYawMax", offsetof(WeaponFullDef, weapDef.fAdsGunKickYawMax), CSPFT_FLOAT}, - {"adsGunKickAccel", offsetof(WeaponFullDef, weapDef.fAdsGunKickAccel), CSPFT_FLOAT}, - {"adsGunKickSpeedMax", offsetof(WeaponFullDef, weapDef.fAdsGunKickSpeedMax), CSPFT_FLOAT}, - {"adsGunKickSpeedDecay", offsetof(WeaponFullDef, weapDef.fAdsGunKickSpeedDecay), CSPFT_FLOAT}, - {"adsGunKickStaticDecay", offsetof(WeaponFullDef, weapDef.fAdsGunKickStaticDecay), CSPFT_FLOAT}, - {"adsViewKickPitchMin", offsetof(WeaponFullDef, weapDef.fAdsViewKickPitchMin), CSPFT_FLOAT}, - {"adsViewKickPitchMax", offsetof(WeaponFullDef, weapDef.fAdsViewKickPitchMax), CSPFT_FLOAT}, - {"adsViewKickYawMin", offsetof(WeaponFullDef, weapDef.fAdsViewKickYawMin), CSPFT_FLOAT}, - {"adsViewKickYawMax", offsetof(WeaponFullDef, weapDef.fAdsViewKickYawMax), CSPFT_FLOAT}, - {"adsViewKickCenterSpeed", offsetof(WeaponFullDef, weapCompleteDef.fAdsViewKickCenterSpeed), CSPFT_FLOAT}, - {"adsSpread", offsetof(WeaponFullDef, weapDef.fAdsSpread), CSPFT_FLOAT}, - {"guidedMissileType", offsetof(WeaponFullDef, weapDef.guidedMissileType), WFT_GUIDED_MISSILE_TYPE}, - {"hipSpreadStandMin", offsetof(WeaponFullDef, weapDef.fHipSpreadStandMin), CSPFT_FLOAT}, - {"hipSpreadDuckedMin", offsetof(WeaponFullDef, weapDef.fHipSpreadDuckedMin), CSPFT_FLOAT}, - {"hipSpreadProneMin", offsetof(WeaponFullDef, weapDef.fHipSpreadProneMin), CSPFT_FLOAT}, - {"hipSpreadMax", offsetof(WeaponFullDef, weapDef.hipSpreadStandMax), CSPFT_FLOAT}, - {"hipSpreadDuckedMax", offsetof(WeaponFullDef, weapDef.hipSpreadDuckedMax), CSPFT_FLOAT}, - {"hipSpreadProneMax", offsetof(WeaponFullDef, weapDef.hipSpreadProneMax), CSPFT_FLOAT}, - {"hipSpreadDecayRate", offsetof(WeaponFullDef, weapDef.fHipSpreadDecayRate), CSPFT_FLOAT}, - {"hipSpreadFireAdd", offsetof(WeaponFullDef, weapDef.fHipSpreadFireAdd), CSPFT_FLOAT}, - {"hipSpreadTurnAdd", offsetof(WeaponFullDef, weapDef.fHipSpreadTurnAdd), CSPFT_FLOAT}, - {"hipSpreadMoveAdd", offsetof(WeaponFullDef, weapDef.fHipSpreadMoveAdd), CSPFT_FLOAT}, - {"hipSpreadDuckedDecay", offsetof(WeaponFullDef, weapDef.fHipSpreadDuckedDecay), CSPFT_FLOAT}, - {"hipSpreadProneDecay", offsetof(WeaponFullDef, weapDef.fHipSpreadProneDecay), CSPFT_FLOAT}, - {"hipReticleSidePos", offsetof(WeaponFullDef, weapDef.fHipReticleSidePos), CSPFT_FLOAT}, - {"hipIdleAmount", offsetof(WeaponFullDef, weapDef.fHipIdleAmount), CSPFT_FLOAT}, - {"hipIdleSpeed", offsetof(WeaponFullDef, weapDef.hipIdleSpeed), CSPFT_FLOAT}, - {"hipGunKickReducedKickBullets", offsetof(WeaponFullDef, weapDef.hipGunKickReducedKickBullets), CSPFT_INT}, - {"hipGunKickReducedKickPercent", offsetof(WeaponFullDef, weapDef.hipGunKickReducedKickPercent), CSPFT_FLOAT}, - {"hipGunKickPitchMin", offsetof(WeaponFullDef, weapDef.fHipGunKickPitchMin), CSPFT_FLOAT}, - {"hipGunKickPitchMax", offsetof(WeaponFullDef, weapDef.fHipGunKickPitchMax), CSPFT_FLOAT}, - {"hipGunKickYawMin", offsetof(WeaponFullDef, weapDef.fHipGunKickYawMin), CSPFT_FLOAT}, - {"hipGunKickYawMax", offsetof(WeaponFullDef, weapDef.fHipGunKickYawMax), CSPFT_FLOAT}, - {"hipGunKickAccel", offsetof(WeaponFullDef, weapDef.fHipGunKickAccel), CSPFT_FLOAT}, - {"hipGunKickSpeedMax", offsetof(WeaponFullDef, weapDef.fHipGunKickSpeedMax), CSPFT_FLOAT}, - {"hipGunKickSpeedDecay", offsetof(WeaponFullDef, weapDef.fHipGunKickSpeedDecay), CSPFT_FLOAT}, - {"hipGunKickStaticDecay", offsetof(WeaponFullDef, weapDef.fHipGunKickStaticDecay), CSPFT_FLOAT}, - {"hipViewKickPitchMin", offsetof(WeaponFullDef, weapDef.fHipViewKickPitchMin), CSPFT_FLOAT}, - {"hipViewKickPitchMax", offsetof(WeaponFullDef, weapDef.fHipViewKickPitchMax), CSPFT_FLOAT}, - {"hipViewKickYawMin", offsetof(WeaponFullDef, weapDef.fHipViewKickYawMin), CSPFT_FLOAT}, - {"hipViewKickYawMax", offsetof(WeaponFullDef, weapDef.fHipViewKickYawMax), CSPFT_FLOAT}, - {"hipViewKickCenterSpeed", offsetof(WeaponFullDef, weapCompleteDef.fHipViewKickCenterSpeed), CSPFT_FLOAT}, - {"leftArc", offsetof(WeaponFullDef, weapDef.leftArc), CSPFT_FLOAT}, - {"rightArc", offsetof(WeaponFullDef, weapDef.rightArc), CSPFT_FLOAT}, - {"topArc", offsetof(WeaponFullDef, weapDef.topArc), CSPFT_FLOAT}, - {"bottomArc", offsetof(WeaponFullDef, weapDef.bottomArc), CSPFT_FLOAT}, - {"accuracy", offsetof(WeaponFullDef, weapDef.accuracy), CSPFT_FLOAT}, - {"aiSpread", offsetof(WeaponFullDef, weapDef.aiSpread), CSPFT_FLOAT}, - {"playerSpread", offsetof(WeaponFullDef, weapDef.playerSpread), CSPFT_FLOAT}, - {"maxVertTurnSpeed", offsetof(WeaponFullDef, weapDef.maxTurnSpeed[0]), CSPFT_FLOAT}, - {"maxHorTurnSpeed", offsetof(WeaponFullDef, weapDef.maxTurnSpeed[1]), CSPFT_FLOAT}, - {"minVertTurnSpeed", offsetof(WeaponFullDef, weapDef.minTurnSpeed[0]), CSPFT_FLOAT}, - {"minHorTurnSpeed", offsetof(WeaponFullDef, weapDef.minTurnSpeed[1]), CSPFT_FLOAT}, - {"pitchConvergenceTime", offsetof(WeaponFullDef, weapDef.pitchConvergenceTime), CSPFT_FLOAT}, - {"yawConvergenceTime", offsetof(WeaponFullDef, weapDef.yawConvergenceTime), CSPFT_FLOAT}, - {"suppressionTime", offsetof(WeaponFullDef, weapDef.suppressTime), CSPFT_FLOAT}, - {"maxRange", offsetof(WeaponFullDef, weapDef.maxRange), CSPFT_FLOAT}, - {"animHorRotateInc", offsetof(WeaponFullDef, weapDef.fAnimHorRotateInc), CSPFT_FLOAT}, - {"playerPositionDist", offsetof(WeaponFullDef, weapDef.fPlayerPositionDist), CSPFT_FLOAT}, - {"stance", offsetof(WeaponFullDef, weapDef.stance), WFT_STANCE}, - {"useHintString", offsetof(WeaponFullDef, weapDef.szUseHintString), CSPFT_STRING}, - {"dropHintString", offsetof(WeaponFullDef, weapDef.dropHintString), CSPFT_STRING}, - {"horizViewJitter", offsetof(WeaponFullDef, weapDef.horizViewJitter), CSPFT_FLOAT}, - {"vertViewJitter", offsetof(WeaponFullDef, weapDef.vertViewJitter), CSPFT_FLOAT}, - {"scanSpeed", offsetof(WeaponFullDef, weapDef.scanSpeed), CSPFT_FLOAT}, - {"scanAccel", offsetof(WeaponFullDef, weapDef.scanAccel), CSPFT_FLOAT}, - {"scanPauseTime", offsetof(WeaponFullDef, weapDef.scanPauseTime), CSPFT_MILLISECONDS}, - {"fightDist", offsetof(WeaponFullDef, weapDef.fightDist), CSPFT_FLOAT}, - {"maxDist", offsetof(WeaponFullDef, weapDef.maxDist), CSPFT_FLOAT}, - {"aiVsAiAccuracyGraph", offsetof(WeaponFullDef, weapDef.accuracyGraphName0), CSPFT_STRING}, - {"aiVsPlayerAccuracyGraph", offsetof(WeaponFullDef, weapDef.accuracyGraphName1), CSPFT_STRING}, - {"locNone", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_NONE]), CSPFT_FLOAT}, - {"locHelmet", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_HELMET]), CSPFT_FLOAT}, - {"locHead", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_HEAD]), CSPFT_FLOAT}, - {"locNeck", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_NECK]), CSPFT_FLOAT}, - {"locTorsoUpper", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_TORSO_UPR]), CSPFT_FLOAT}, - {"locTorsoLower", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_TORSO_LWR]), CSPFT_FLOAT}, - {"locRightArmUpper", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_R_ARM_UPR]), CSPFT_FLOAT}, - {"locRightArmLower", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_R_ARM_LWR]), CSPFT_FLOAT}, - {"locRightHand", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_R_HAND]), CSPFT_FLOAT}, - {"locLeftArmUpper", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_L_ARM_UPR]), CSPFT_FLOAT}, - {"locLeftArmLower", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_L_ARM_LWR]), CSPFT_FLOAT}, - {"locLeftHand", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_L_HAND]), CSPFT_FLOAT}, - {"locRightLegUpper", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_R_LEG_UPR]), CSPFT_FLOAT}, - {"locRightLegLower", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_R_LEG_LWR]), CSPFT_FLOAT}, - {"locRightFoot", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_R_FOOT]), CSPFT_FLOAT}, - {"locLeftLegUpper", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_L_LEG_UPR]), CSPFT_FLOAT}, - {"locLeftLegLower", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_L_LEG_LWR]), CSPFT_FLOAT}, - {"locLeftFoot", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_L_FOOT]), CSPFT_FLOAT}, - {"locGun", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_GUN]), CSPFT_FLOAT}, - {"fireRumble", offsetof(WeaponFullDef, weapDef.fireRumble), CSPFT_STRING}, - {"meleeImpactRumble", offsetof(WeaponFullDef, weapDef.meleeImpactRumble), CSPFT_STRING}, - {"tracerType", offsetof(WeaponFullDef, weapDef.tracerType), CSPFT_TRACER}, - {"adsDofStart", offsetof(WeaponFullDef, weapCompleteDef.adsDofStart), CSPFT_FLOAT}, - {"adsDofEnd", offsetof(WeaponFullDef, weapCompleteDef.adsDofEnd), CSPFT_FLOAT}, - {"turretScopeZoomRate", offsetof(WeaponFullDef, weapDef.turretScopeZoomRate), CSPFT_FLOAT}, - {"turretScopeZoomMin", offsetof(WeaponFullDef, weapDef.turretScopeZoomMin), CSPFT_FLOAT}, - {"turretScopeZoomMax", offsetof(WeaponFullDef, weapDef.turretScopeZoomMax), CSPFT_FLOAT}, - {"thermalScope", offsetof(WeaponFullDef, weapDef.thermalScope), CSPFT_BOOL}, - {"altModeSameWeapon", offsetof(WeaponFullDef, weapDef.altModeSameWeapon), CSPFT_BOOL}, - {"turretOverheatUpRate", offsetof(WeaponFullDef, weapDef.turretOverheatUpRate), CSPFT_FLOAT}, - {"turretOverheatDownRate", offsetof(WeaponFullDef, weapDef.turretOverheatDownRate), CSPFT_FLOAT}, - {"turretOverheatPenalty", offsetof(WeaponFullDef, weapDef.turretOverheatPenalty), CSPFT_FLOAT}, - {"turretOverheatSound", offsetof(WeaponFullDef, weapDef.turretOverheatSound), CSPFT_SOUND}, - {"turretOverheatEffect", offsetof(WeaponFullDef, weapDef.turretOverheatEffect), CSPFT_FX}, - {"turretBarrelSpinEnabled", offsetof(WeaponFullDef, weapDef.turretBarrelSpinEnabled), CSPFT_BOOL}, - {"turretBarrelSpinUpTime", offsetof(WeaponFullDef, weapDef.turretBarrelSpinUpTime), CSPFT_FLOAT}, - {"turretBarrelSpinDownTime", offsetof(WeaponFullDef, weapDef.turretBarrelSpinDownTime), CSPFT_FLOAT}, - {"turretBarrelSpinRumble", offsetof(WeaponFullDef, weapDef.turretBarrelSpinRumble), CSPFT_STRING}, - {"turretBarrelSpinSpeed", offsetof(WeaponFullDef, weapDef.turretBarrelSpinSpeed), CSPFT_FLOAT}, - {"turretBarrelSpinMaxSnd", offsetof(WeaponFullDef, weapDef.turretBarrelSpinMaxSnd), CSPFT_SOUND}, - {"turretBarrelSpinUpSnd1", offsetof(WeaponFullDef, weapDef.turretBarrelSpinUpSnd[0]), CSPFT_SOUND}, - {"turretBarrelSpinUpSnd2", offsetof(WeaponFullDef, weapDef.turretBarrelSpinUpSnd[1]), CSPFT_SOUND}, - {"turretBarrelSpinUpSnd3", offsetof(WeaponFullDef, weapDef.turretBarrelSpinUpSnd[2]), CSPFT_SOUND}, - {"turretBarrelSpinUpSnd4", offsetof(WeaponFullDef, weapDef.turretBarrelSpinUpSnd[3]), CSPFT_SOUND}, - {"turretBarrelSpinDownSnd1", offsetof(WeaponFullDef, weapDef.turretBarrelSpinDownSnd[0]), CSPFT_SOUND}, - {"turretBarrelSpinDownSnd2", offsetof(WeaponFullDef, weapDef.turretBarrelSpinDownSnd[1]), CSPFT_SOUND}, - {"turretBarrelSpinDownSnd3", offsetof(WeaponFullDef, weapDef.turretBarrelSpinDownSnd[2]), CSPFT_SOUND}, - {"turretBarrelSpinDownSnd4", offsetof(WeaponFullDef, weapDef.turretBarrelSpinDownSnd[3]), CSPFT_SOUND}, - {"missileConeSoundEnabled", offsetof(WeaponFullDef, weapDef.missileConeSoundEnabled), CSPFT_BOOL}, - {"missileConeSoundAlias", offsetof(WeaponFullDef, weapDef.missileConeSoundAlias), CSPFT_SOUND}, - {"missileConeSoundAliasAtBase", offsetof(WeaponFullDef, weapDef.missileConeSoundAliasAtBase), CSPFT_SOUND}, - {"missileConeSoundRadiusAtTop", offsetof(WeaponFullDef, weapDef.missileConeSoundRadiusAtTop), CSPFT_FLOAT}, - {"missileConeSoundRadiusAtBase", offsetof(WeaponFullDef, weapDef.missileConeSoundRadiusAtBase), CSPFT_FLOAT}, - {"missileConeSoundHeight", offsetof(WeaponFullDef, weapDef.missileConeSoundHeight), CSPFT_FLOAT}, - {"missileConeSoundOriginOffset", offsetof(WeaponFullDef, weapDef.missileConeSoundOriginOffset), CSPFT_FLOAT}, - {"missileConeSoundVolumescaleAtCore", offsetof(WeaponFullDef, weapDef.missileConeSoundVolumescaleAtCore), CSPFT_FLOAT}, - {"missileConeSoundVolumescaleAtEdge", offsetof(WeaponFullDef, weapDef.missileConeSoundVolumescaleAtEdge), CSPFT_FLOAT}, - {"missileConeSoundVolumescaleCoreSize", offsetof(WeaponFullDef, weapDef.missileConeSoundVolumescaleCoreSize), CSPFT_FLOAT}, - {"missileConeSoundPitchshiftEnabled", offsetof(WeaponFullDef, weapDef.missileConeSoundPitchshiftEnabled), CSPFT_BOOL}, - {"missileConeSoundPitchAtTop", offsetof(WeaponFullDef, weapDef.missileConeSoundPitchAtTop), CSPFT_FLOAT}, - {"missileConeSoundPitchAtBottom", offsetof(WeaponFullDef, weapDef.missileConeSoundPitchAtBottom), CSPFT_FLOAT}, - {"missileConeSoundPitchTopSize", offsetof(WeaponFullDef, weapDef.missileConeSoundPitchTopSize), CSPFT_FLOAT}, - {"missileConeSoundPitchBottomSize", offsetof(WeaponFullDef, weapDef.missileConeSoundPitchBottomSize), CSPFT_FLOAT}, - {"missileConeSoundCrossfadeEnabled", offsetof(WeaponFullDef, weapDef.missileConeSoundCrossfadeEnabled), CSPFT_BOOL}, - {"missileConeSoundCrossfadeTopSize", offsetof(WeaponFullDef, weapDef.missileConeSoundCrossfadeTopSize), CSPFT_FLOAT}, - {"missileConeSoundCrossfadeBottomSize", offsetof(WeaponFullDef, weapDef.missileConeSoundCrossfadeBottomSize), CSPFT_FLOAT}, + inline cspField_t weapon_fields[]{ + {"displayName", offsetof(WeaponFullDef, weapCompleteDef.szDisplayName), CSPFT_STRING }, + {"AIOverlayDescription", offsetof(WeaponFullDef, weapDef.szOverlayName), CSPFT_STRING }, + {"modeName", offsetof(WeaponFullDef, weapDef.szModeName), CSPFT_STRING }, + {"playerAnimType", offsetof(WeaponFullDef, weapDef.playerAnimType), WFT_ANIMTYPE }, + {"gunModel", offsetof(WeaponFullDef, gunXModel[0]), CSPFT_XMODEL }, + {"gunModel2", offsetof(WeaponFullDef, gunXModel[1]), CSPFT_XMODEL }, + {"gunModel3", offsetof(WeaponFullDef, gunXModel[2]), CSPFT_XMODEL }, + {"gunModel4", offsetof(WeaponFullDef, gunXModel[3]), CSPFT_XMODEL }, + {"gunModel5", offsetof(WeaponFullDef, gunXModel[4]), CSPFT_XMODEL }, + {"gunModel6", offsetof(WeaponFullDef, gunXModel[5]), CSPFT_XMODEL }, + {"gunModel7", offsetof(WeaponFullDef, gunXModel[6]), CSPFT_XMODEL }, + {"gunModel8", offsetof(WeaponFullDef, gunXModel[7]), CSPFT_XMODEL }, + {"gunModel9", offsetof(WeaponFullDef, gunXModel[8]), CSPFT_XMODEL }, + {"gunModel10", offsetof(WeaponFullDef, gunXModel[9]), CSPFT_XMODEL }, + {"gunModel11", offsetof(WeaponFullDef, gunXModel[10]), CSPFT_XMODEL }, + {"gunModel12", offsetof(WeaponFullDef, gunXModel[11]), CSPFT_XMODEL }, + {"gunModel13", offsetof(WeaponFullDef, gunXModel[12]), CSPFT_XMODEL }, + {"gunModel14", offsetof(WeaponFullDef, gunXModel[13]), CSPFT_XMODEL }, + {"gunModel15", offsetof(WeaponFullDef, gunXModel[14]), CSPFT_XMODEL }, + {"gunModel16", offsetof(WeaponFullDef, gunXModel[15]), CSPFT_XMODEL }, + {"handModel", offsetof(WeaponFullDef, weapDef.handXModel), CSPFT_XMODEL }, + {"hideTags", offsetof(WeaponFullDef, hideTags), WFT_HIDETAGS }, + {"notetrackSoundMap", offsetof(WeaponFullDef, notetrackSoundMapKeys), WFT_NOTETRACKSOUNDMAP }, + {"notetrackRumbleMap", offsetof(WeaponFullDef, notetrackRumbleMapKeys), WFT_NOTETRACKRUMBLEMAP }, + {"idleAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_IDLE]), CSPFT_STRING }, + {"emptyIdleAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_EMPTY_IDLE]), CSPFT_STRING }, + {"fireAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_FIRE]), CSPFT_STRING }, + {"holdFireAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_HOLD_FIRE]), CSPFT_STRING }, + {"lastShotAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_LASTSHOT]), CSPFT_STRING }, + {"detonateAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_DETONATE]), CSPFT_STRING }, + {"rechamberAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RECHAMBER]), CSPFT_STRING }, + {"meleeAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_MELEE]), CSPFT_STRING }, + {"meleeChargeAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_MELEE_CHARGE]), CSPFT_STRING }, + {"reloadAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD]), CSPFT_STRING }, + {"reloadEmptyAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD_EMPTY]), CSPFT_STRING }, + {"reloadStartAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD_START]), CSPFT_STRING }, + {"reloadEndAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD_END]), CSPFT_STRING }, + {"raiseAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RAISE]), CSPFT_STRING }, + {"dropAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_DROP]), CSPFT_STRING }, + {"firstRaiseAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_FIRST_RAISE]), CSPFT_STRING }, + {"breachRaiseAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_BREACH_RAISE]), CSPFT_STRING }, + {"altRaiseAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ALT_RAISE]), CSPFT_STRING }, + {"altDropAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ALT_DROP]), CSPFT_STRING }, + {"quickRaiseAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_QUICK_RAISE]), CSPFT_STRING }, + {"quickDropAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_QUICK_DROP]), CSPFT_STRING }, + {"emptyRaiseAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_EMPTY_RAISE]), CSPFT_STRING }, + {"emptyDropAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_EMPTY_DROP]), CSPFT_STRING }, + {"sprintInAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_SPRINT_IN]), CSPFT_STRING }, + {"sprintLoopAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_SPRINT_LOOP]), CSPFT_STRING }, + {"sprintOutAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_SPRINT_OUT]), CSPFT_STRING }, + {"stunnedAnimStart", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_STUNNED_START]), CSPFT_STRING }, + {"stunnedAnimLoop", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_STUNNED_LOOP]), CSPFT_STRING }, + {"stunnedAnimEnd", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_STUNNED_END]), CSPFT_STRING }, + {"nightVisionWearAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_NIGHTVISION_WEAR]), CSPFT_STRING }, + {"nightVisionRemoveAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_NIGHTVISION_REMOVE]), CSPFT_STRING }, + {"adsFireAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ADS_FIRE]), CSPFT_STRING }, + {"adsLastShotAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ADS_LASTSHOT]), CSPFT_STRING }, + {"adsRechamberAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ADS_RECHAMBER]), CSPFT_STRING }, + {"adsUpAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ADS_UP]), CSPFT_STRING }, + {"adsDownAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ADS_DOWN]), CSPFT_STRING }, + {"idleAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_IDLE]), CSPFT_STRING }, + {"emptyIdleAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_EMPTY_IDLE]), CSPFT_STRING }, + {"fireAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_FIRE]), CSPFT_STRING }, + {"holdFireAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_HOLD_FIRE]), CSPFT_STRING }, + {"lastShotAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_LASTSHOT]), CSPFT_STRING }, + {"detonateAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_DETONATE]), CSPFT_STRING }, + {"rechamberAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_RECHAMBER]), CSPFT_STRING }, + {"meleeAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_MELEE]), CSPFT_STRING }, + {"meleeChargeAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_MELEE_CHARGE]), CSPFT_STRING }, + {"reloadAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_RELOAD]), CSPFT_STRING }, + {"reloadEmptyAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_RELOAD_EMPTY]), CSPFT_STRING }, + {"reloadStartAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_RELOAD_START]), CSPFT_STRING }, + {"reloadEndAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_RELOAD_END]), CSPFT_STRING }, + {"raiseAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_RAISE]), CSPFT_STRING }, + {"dropAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_DROP]), CSPFT_STRING }, + {"firstRaiseAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_FIRST_RAISE]), CSPFT_STRING }, + {"breachRaiseAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_BREACH_RAISE]), CSPFT_STRING }, + {"altRaiseAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_ALT_RAISE]), CSPFT_STRING }, + {"altDropAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_ALT_DROP]), CSPFT_STRING }, + {"quickRaiseAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_QUICK_RAISE]), CSPFT_STRING }, + {"quickDropAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_QUICK_DROP]), CSPFT_STRING }, + {"emptyRaiseAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_EMPTY_RAISE]), CSPFT_STRING }, + {"emptyDropAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_EMPTY_DROP]), CSPFT_STRING }, + {"sprintInAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_SPRINT_IN]), CSPFT_STRING }, + {"sprintLoopAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_SPRINT_LOOP]), CSPFT_STRING }, + {"sprintOutAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_SPRINT_OUT]), CSPFT_STRING }, + {"stunnedAnimStartR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_STUNNED_START]), CSPFT_STRING }, + {"stunnedAnimLoopR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_STUNNED_LOOP]), CSPFT_STRING }, + {"stunnedAnimEndR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_STUNNED_END]), CSPFT_STRING }, + {"nightVisionWearAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_NIGHTVISION_WEAR]), CSPFT_STRING }, + {"nightVisionRemoveAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_NIGHTVISION_REMOVE]), CSPFT_STRING }, + {"adsFireAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_ADS_FIRE]), CSPFT_STRING }, + {"adsLastShotAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_ADS_LASTSHOT]), CSPFT_STRING }, + {"adsRechamberAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_ADS_RECHAMBER]), CSPFT_STRING }, + {"adsUpAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_ADS_UP]), CSPFT_STRING }, + {"adsDownAnimR", offsetof(WeaponFullDef, szXAnimsRightHanded[WEAP_ANIM_ADS_DOWN]), CSPFT_STRING }, + {"idleAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_IDLE]), CSPFT_STRING }, + {"emptyIdleAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_EMPTY_IDLE]), CSPFT_STRING }, + {"fireAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_FIRE]), CSPFT_STRING }, + {"holdFireAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_HOLD_FIRE]), CSPFT_STRING }, + {"lastShotAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_LASTSHOT]), CSPFT_STRING }, + {"detonateAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_DETONATE]), CSPFT_STRING }, + {"rechamberAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_RECHAMBER]), CSPFT_STRING }, + {"meleeAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_MELEE]), CSPFT_STRING }, + {"meleeChargeAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_MELEE_CHARGE]), CSPFT_STRING }, + {"reloadAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_RELOAD]), CSPFT_STRING }, + {"reloadEmptyAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_RELOAD_EMPTY]), CSPFT_STRING }, + {"reloadStartAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_RELOAD_START]), CSPFT_STRING }, + {"reloadEndAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_RELOAD_END]), CSPFT_STRING }, + {"raiseAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_RAISE]), CSPFT_STRING }, + {"dropAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_DROP]), CSPFT_STRING }, + {"firstRaiseAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_FIRST_RAISE]), CSPFT_STRING }, + {"breachRaiseAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_BREACH_RAISE]), CSPFT_STRING }, + {"altRaiseAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_ALT_RAISE]), CSPFT_STRING }, + {"altDropAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_ALT_DROP]), CSPFT_STRING }, + {"quickRaiseAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_QUICK_RAISE]), CSPFT_STRING }, + {"quickDropAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_QUICK_DROP]), CSPFT_STRING }, + {"emptyRaiseAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_EMPTY_RAISE]), CSPFT_STRING }, + {"emptyDropAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_EMPTY_DROP]), CSPFT_STRING }, + {"sprintInAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_SPRINT_IN]), CSPFT_STRING }, + {"sprintLoopAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_SPRINT_LOOP]), CSPFT_STRING }, + {"sprintOutAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_SPRINT_OUT]), CSPFT_STRING }, + {"stunnedAnimStartL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_STUNNED_START]), CSPFT_STRING }, + {"stunnedAnimLoopL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_STUNNED_LOOP]), CSPFT_STRING }, + {"stunnedAnimEndL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_STUNNED_END]), CSPFT_STRING }, + {"nightVisionWearAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_NIGHTVISION_WEAR]), CSPFT_STRING }, + {"nightVisionRemoveAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_NIGHTVISION_REMOVE]), CSPFT_STRING }, + {"adsFireAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_ADS_FIRE]), CSPFT_STRING }, + {"adsLastShotAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_ADS_LASTSHOT]), CSPFT_STRING }, + {"adsRechamberAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_ADS_RECHAMBER]), CSPFT_STRING }, + {"adsUpAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_ADS_UP]), CSPFT_STRING }, + {"adsDownAnimL", offsetof(WeaponFullDef, szXAnimsLeftHanded[WEAP_ANIM_ADS_DOWN]), CSPFT_STRING }, + {"script", offsetof(WeaponFullDef, weapDef.szScript), CSPFT_STRING }, + {"weaponType", offsetof(WeaponFullDef, weapDef.weapType), WFT_WEAPONTYPE }, + {"weaponClass", offsetof(WeaponFullDef, weapDef.weapClass), WFT_WEAPONCLASS }, + {"penetrateType", offsetof(WeaponFullDef, weapDef.penetrateType), WFT_PENETRATE_TYPE }, + {"penetrateMultiplier", offsetof(WeaponFullDef, weapCompleteDef.penetrateMultiplier), CSPFT_FLOAT }, + {"impactType", offsetof(WeaponFullDef, weapCompleteDef.impactType), WFT_IMPACT_TYPE }, + {"inventoryType", offsetof(WeaponFullDef, weapDef.inventoryType), WFT_INVENTORYTYPE }, + {"fireType", offsetof(WeaponFullDef, weapDef.fireType), WFT_FIRETYPE }, + {"offhandClass", offsetof(WeaponFullDef, weapDef.offhandClass), WFT_OFFHAND_CLASS }, + {"viewFlashEffect", offsetof(WeaponFullDef, weapDef.viewFlashEffect), CSPFT_FX }, + {"worldFlashEffect", offsetof(WeaponFullDef, weapDef.worldFlashEffect), CSPFT_FX }, + {"pickupSound", offsetof(WeaponFullDef, weapDef.pickupSound), CSPFT_SOUND }, + {"pickupSoundPlayer", offsetof(WeaponFullDef, weapDef.pickupSoundPlayer), CSPFT_SOUND }, + {"ammoPickupSound", offsetof(WeaponFullDef, weapDef.ammoPickupSound), CSPFT_SOUND }, + {"ammoPickupSoundPlayer", offsetof(WeaponFullDef, weapDef.ammoPickupSoundPlayer), CSPFT_SOUND }, + {"projectileSound", offsetof(WeaponFullDef, weapDef.projectileSound), CSPFT_SOUND }, + {"pullbackSound", offsetof(WeaponFullDef, weapDef.pullbackSound), CSPFT_SOUND }, + {"pullbackSoundPlayer", offsetof(WeaponFullDef, weapDef.pullbackSoundPlayer), CSPFT_SOUND }, + {"fireSound", offsetof(WeaponFullDef, weapDef.fireSound), CSPFT_SOUND }, + {"fireSoundPlayer", offsetof(WeaponFullDef, weapDef.fireSoundPlayer), CSPFT_SOUND }, + {"fireSoundPlayerAkimbo", offsetof(WeaponFullDef, weapDef.fireSoundPlayerAkimbo), CSPFT_SOUND }, + {"loopFireSound", offsetof(WeaponFullDef, weapDef.fireLoopSound), CSPFT_SOUND }, + {"loopFireSoundPlayer", offsetof(WeaponFullDef, weapDef.fireLoopSoundPlayer), CSPFT_SOUND }, + {"stopFireSound", offsetof(WeaponFullDef, weapDef.fireStopSound), CSPFT_SOUND }, + {"stopFireSoundPlayer", offsetof(WeaponFullDef, weapDef.fireStopSoundPlayer), CSPFT_SOUND }, + {"lastShotSound", offsetof(WeaponFullDef, weapDef.fireLastSound), CSPFT_SOUND }, + {"lastShotSoundPlayer", offsetof(WeaponFullDef, weapDef.fireLastSoundPlayer), CSPFT_SOUND }, + {"emptyFireSound", offsetof(WeaponFullDef, weapDef.emptyFireSound), CSPFT_SOUND }, + {"emptyFireSoundPlayer", offsetof(WeaponFullDef, weapDef.emptyFireSoundPlayer), CSPFT_SOUND }, + {"meleeSwipeSound", offsetof(WeaponFullDef, weapDef.meleeSwipeSound), CSPFT_SOUND }, + {"meleeSwipeSoundPlayer", offsetof(WeaponFullDef, weapDef.meleeSwipeSoundPlayer), CSPFT_SOUND }, + {"meleeHitSound", offsetof(WeaponFullDef, weapDef.meleeHitSound), CSPFT_SOUND }, + {"meleeMissSound", offsetof(WeaponFullDef, weapDef.meleeMissSound), CSPFT_SOUND }, + {"rechamberSound", offsetof(WeaponFullDef, weapDef.rechamberSound), CSPFT_SOUND }, + {"rechamberSoundPlayer", offsetof(WeaponFullDef, weapDef.rechamberSoundPlayer), CSPFT_SOUND }, + {"reloadSound", offsetof(WeaponFullDef, weapDef.reloadSound), CSPFT_SOUND }, + {"reloadSoundPlayer", offsetof(WeaponFullDef, weapDef.reloadSoundPlayer), CSPFT_SOUND }, + {"reloadEmptySound", offsetof(WeaponFullDef, weapDef.reloadEmptySound), CSPFT_SOUND }, + {"reloadEmptySoundPlayer", offsetof(WeaponFullDef, weapDef.reloadEmptySoundPlayer), CSPFT_SOUND }, + {"reloadStartSound", offsetof(WeaponFullDef, weapDef.reloadStartSound), CSPFT_SOUND }, + {"reloadStartSoundPlayer", offsetof(WeaponFullDef, weapDef.reloadStartSoundPlayer), CSPFT_SOUND }, + {"reloadEndSound", offsetof(WeaponFullDef, weapDef.reloadEndSound), CSPFT_SOUND }, + {"reloadEndSoundPlayer", offsetof(WeaponFullDef, weapDef.reloadEndSoundPlayer), CSPFT_SOUND }, + {"detonateSound", offsetof(WeaponFullDef, weapDef.detonateSound), CSPFT_SOUND }, + {"detonateSoundPlayer", offsetof(WeaponFullDef, weapDef.detonateSoundPlayer), CSPFT_SOUND }, + {"nightVisionWearSound", offsetof(WeaponFullDef, weapDef.nightVisionWearSound), CSPFT_SOUND }, + {"nightVisionWearSoundPlayer", offsetof(WeaponFullDef, weapDef.nightVisionWearSoundPlayer), CSPFT_SOUND }, + {"nightVisionRemoveSound", offsetof(WeaponFullDef, weapDef.nightVisionRemoveSound), CSPFT_SOUND }, + {"nightVisionRemoveSoundPlayer", offsetof(WeaponFullDef, weapDef.nightVisionRemoveSoundPlayer), CSPFT_SOUND }, + {"raiseSound", offsetof(WeaponFullDef, weapDef.raiseSound), CSPFT_SOUND }, + {"raiseSoundPlayer", offsetof(WeaponFullDef, weapDef.raiseSoundPlayer), CSPFT_SOUND }, + {"firstRaiseSound", offsetof(WeaponFullDef, weapDef.firstRaiseSound), CSPFT_SOUND }, + {"firstRaiseSoundPlayer", offsetof(WeaponFullDef, weapDef.firstRaiseSoundPlayer), CSPFT_SOUND }, + {"altSwitchSound", offsetof(WeaponFullDef, weapDef.altSwitchSound), CSPFT_SOUND }, + {"altSwitchSoundPlayer", offsetof(WeaponFullDef, weapDef.altSwitchSoundPlayer), CSPFT_SOUND }, + {"putawaySound", offsetof(WeaponFullDef, weapDef.putawaySound), CSPFT_SOUND }, + {"putawaySoundPlayer", offsetof(WeaponFullDef, weapDef.putawaySoundPlayer), CSPFT_SOUND }, + {"scanSound", offsetof(WeaponFullDef, weapDef.scanSound), CSPFT_SOUND }, + {"bounceSound", offsetof(WeaponFullDef, weapDef.bounceSound), WFT_BOUNCE_SOUND }, + {"viewShellEjectEffect", offsetof(WeaponFullDef, weapDef.viewShellEjectEffect), CSPFT_FX }, + {"worldShellEjectEffect", offsetof(WeaponFullDef, weapDef.worldShellEjectEffect), CSPFT_FX }, + {"viewLastShotEjectEffect", offsetof(WeaponFullDef, weapDef.viewLastShotEjectEffect), CSPFT_FX }, + {"worldLastShotEjectEffect", offsetof(WeaponFullDef, weapDef.worldLastShotEjectEffect), CSPFT_FX }, + {"reticleCenter", offsetof(WeaponFullDef, weapDef.reticleCenter), CSPFT_MATERIAL }, + {"reticleSide", offsetof(WeaponFullDef, weapDef.reticleSide), CSPFT_MATERIAL }, + {"reticleCenterSize", offsetof(WeaponFullDef, weapDef.iReticleCenterSize), CSPFT_INT }, + {"reticleSideSize", offsetof(WeaponFullDef, weapDef.iReticleSideSize), CSPFT_INT }, + {"reticleMinOfs", offsetof(WeaponFullDef, weapDef.iReticleMinOfs), CSPFT_INT }, + {"activeReticleType", offsetof(WeaponFullDef, weapDef.activeReticleType), WFT_ACTIVE_RETICLE_TYPE }, + {"standMoveF", offsetof(WeaponFullDef, weapDef.vStandMove[0]), CSPFT_FLOAT }, + {"standMoveR", offsetof(WeaponFullDef, weapDef.vStandMove[1]), CSPFT_FLOAT }, + {"standMoveU", offsetof(WeaponFullDef, weapDef.vStandMove[2]), CSPFT_FLOAT }, + {"standRotP", offsetof(WeaponFullDef, weapDef.vStandRot[0]), CSPFT_FLOAT }, + {"standRotY", offsetof(WeaponFullDef, weapDef.vStandRot[1]), CSPFT_FLOAT }, + {"standRotR", offsetof(WeaponFullDef, weapDef.vStandRot[2]), CSPFT_FLOAT }, + {"strafeMoveF", offsetof(WeaponFullDef, weapDef.strafeMove[0]), CSPFT_FLOAT }, + {"strafeMoveR", offsetof(WeaponFullDef, weapDef.strafeMove[1]), CSPFT_FLOAT }, + {"strafeMoveU", offsetof(WeaponFullDef, weapDef.strafeMove[2]), CSPFT_FLOAT }, + {"strafeRotP", offsetof(WeaponFullDef, weapDef.strafeRot[0]), CSPFT_FLOAT }, + {"strafeRotY", offsetof(WeaponFullDef, weapDef.strafeRot[1]), CSPFT_FLOAT }, + {"strafeRotR", offsetof(WeaponFullDef, weapDef.strafeRot[2]), CSPFT_FLOAT }, + {"duckedOfsF", offsetof(WeaponFullDef, weapDef.vDuckedOfs[0]), CSPFT_FLOAT }, + {"duckedOfsR", offsetof(WeaponFullDef, weapDef.vDuckedOfs[1]), CSPFT_FLOAT }, + {"duckedOfsU", offsetof(WeaponFullDef, weapDef.vDuckedOfs[2]), CSPFT_FLOAT }, + {"duckedMoveF", offsetof(WeaponFullDef, weapDef.vDuckedMove[0]), CSPFT_FLOAT }, + {"duckedMoveR", offsetof(WeaponFullDef, weapDef.vDuckedMove[1]), CSPFT_FLOAT }, + {"duckedMoveU", offsetof(WeaponFullDef, weapDef.vDuckedMove[2]), CSPFT_FLOAT }, + {"duckedRotP", offsetof(WeaponFullDef, weapDef.vDuckedRot[0]), CSPFT_FLOAT }, + {"duckedRotY", offsetof(WeaponFullDef, weapDef.vDuckedRot[1]), CSPFT_FLOAT }, + {"duckedRotR", offsetof(WeaponFullDef, weapDef.vDuckedRot[2]), CSPFT_FLOAT }, + {"proneOfsF", offsetof(WeaponFullDef, weapDef.vProneOfs[0]), CSPFT_FLOAT }, + {"proneOfsR", offsetof(WeaponFullDef, weapDef.vProneOfs[1]), CSPFT_FLOAT }, + {"proneOfsU", offsetof(WeaponFullDef, weapDef.vProneOfs[2]), CSPFT_FLOAT }, + {"proneMoveF", offsetof(WeaponFullDef, weapDef.vProneMove[0]), CSPFT_FLOAT }, + {"proneMoveR", offsetof(WeaponFullDef, weapDef.vProneMove[1]), CSPFT_FLOAT }, + {"proneMoveU", offsetof(WeaponFullDef, weapDef.vProneMove[2]), CSPFT_FLOAT }, + {"proneRotP", offsetof(WeaponFullDef, weapDef.vProneRot[0]), CSPFT_FLOAT }, + {"proneRotY", offsetof(WeaponFullDef, weapDef.vProneRot[1]), CSPFT_FLOAT }, + {"proneRotR", offsetof(WeaponFullDef, weapDef.vProneRot[2]), CSPFT_FLOAT }, + {"posMoveRate", offsetof(WeaponFullDef, weapDef.fPosMoveRate), CSPFT_FLOAT }, + {"posProneMoveRate", offsetof(WeaponFullDef, weapDef.fPosProneMoveRate), CSPFT_FLOAT }, + {"standMoveMinSpeed", offsetof(WeaponFullDef, weapDef.fStandMoveMinSpeed), CSPFT_FLOAT }, + {"duckedMoveMinSpeed", offsetof(WeaponFullDef, weapDef.fDuckedMoveMinSpeed), CSPFT_FLOAT }, + {"proneMoveMinSpeed", offsetof(WeaponFullDef, weapDef.fProneMoveMinSpeed), CSPFT_FLOAT }, + {"posRotRate", offsetof(WeaponFullDef, weapDef.fPosRotRate), CSPFT_FLOAT }, + {"posProneRotRate", offsetof(WeaponFullDef, weapDef.fPosProneRotRate), CSPFT_FLOAT }, + {"standRotMinSpeed", offsetof(WeaponFullDef, weapDef.fStandRotMinSpeed), CSPFT_FLOAT }, + {"duckedRotMinSpeed", offsetof(WeaponFullDef, weapDef.fDuckedRotMinSpeed), CSPFT_FLOAT }, + {"proneRotMinSpeed", offsetof(WeaponFullDef, weapDef.fProneRotMinSpeed), CSPFT_FLOAT }, + {"worldModel", offsetof(WeaponFullDef, worldModel[0]), CSPFT_XMODEL }, + {"worldModel2", offsetof(WeaponFullDef, worldModel[1]), CSPFT_XMODEL }, + {"worldModel3", offsetof(WeaponFullDef, worldModel[2]), CSPFT_XMODEL }, + {"worldModel4", offsetof(WeaponFullDef, worldModel[3]), CSPFT_XMODEL }, + {"worldModel5", offsetof(WeaponFullDef, worldModel[4]), CSPFT_XMODEL }, + {"worldModel6", offsetof(WeaponFullDef, worldModel[5]), CSPFT_XMODEL }, + {"worldModel7", offsetof(WeaponFullDef, worldModel[6]), CSPFT_XMODEL }, + {"worldModel8", offsetof(WeaponFullDef, worldModel[7]), CSPFT_XMODEL }, + {"worldModel9", offsetof(WeaponFullDef, worldModel[8]), CSPFT_XMODEL }, + {"worldModel10", offsetof(WeaponFullDef, worldModel[9]), CSPFT_XMODEL }, + {"worldModel11", offsetof(WeaponFullDef, worldModel[10]), CSPFT_XMODEL }, + {"worldModel12", offsetof(WeaponFullDef, worldModel[11]), CSPFT_XMODEL }, + {"worldModel13", offsetof(WeaponFullDef, worldModel[12]), CSPFT_XMODEL }, + {"worldModel14", offsetof(WeaponFullDef, worldModel[13]), CSPFT_XMODEL }, + {"worldModel15", offsetof(WeaponFullDef, worldModel[14]), CSPFT_XMODEL }, + {"worldModel16", offsetof(WeaponFullDef, worldModel[15]), CSPFT_XMODEL }, + {"worldClipModel", offsetof(WeaponFullDef, weapDef.worldClipModel), CSPFT_XMODEL }, + {"rocketModel", offsetof(WeaponFullDef, weapDef.rocketModel), CSPFT_XMODEL }, + {"knifeModel", offsetof(WeaponFullDef, weapDef.knifeModel), CSPFT_XMODEL }, + {"worldKnifeModel", offsetof(WeaponFullDef, weapDef.worldKnifeModel), CSPFT_XMODEL }, + {"hudIcon", offsetof(WeaponFullDef, weapDef.hudIcon), CSPFT_MATERIAL }, + {"hudIconRatio", offsetof(WeaponFullDef, weapDef.hudIconRatio), WFT_ICONRATIO_HUD }, + {"pickupIcon", offsetof(WeaponFullDef, weapDef.pickupIcon), CSPFT_MATERIAL }, + {"pickupIconRatio", offsetof(WeaponFullDef, weapDef.pickupIconRatio), WFT_ICONRATIO_PICKUP }, + {"ammoCounterIcon", offsetof(WeaponFullDef, weapDef.ammoCounterIcon), CSPFT_MATERIAL }, + {"ammoCounterIconRatio", offsetof(WeaponFullDef, weapDef.ammoCounterIconRatio), WFT_ICONRATIO_AMMOCOUNTER}, + {"ammoCounterClip", offsetof(WeaponFullDef, weapDef.ammoCounterClip), WFT_AMMOCOUNTER_CLIPTYPE }, + {"startAmmo", offsetof(WeaponFullDef, weapDef.iStartAmmo), CSPFT_INT }, + {"shareAmmo", offsetof(WeaponFullDef, weapDef.sharedAmmo), CSPFT_BOOL }, + {"ammoName", offsetof(WeaponFullDef, weapDef.szAmmoName), CSPFT_STRING }, + {"clipName", offsetof(WeaponFullDef, weapDef.szClipName), CSPFT_STRING }, + {"maxAmmo", offsetof(WeaponFullDef, weapDef.iMaxAmmo), CSPFT_INT }, + {"clipSize", offsetof(WeaponFullDef, weapCompleteDef.iClipSize), CSPFT_INT }, + {"shotCount", offsetof(WeaponFullDef, weapDef.shotCount), CSPFT_INT }, + {"sharedAmmoCapName", offsetof(WeaponFullDef, weapDef.szSharedAmmoCapName), CSPFT_STRING }, + {"sharedAmmoCap", offsetof(WeaponFullDef, weapDef.iSharedAmmoCap), CSPFT_INT }, + {"damage", offsetof(WeaponFullDef, weapDef.damage), CSPFT_INT }, + {"playerDamage", offsetof(WeaponFullDef, weapDef.playerDamage), CSPFT_INT }, + {"meleeDamage", offsetof(WeaponFullDef, weapDef.iMeleeDamage), CSPFT_INT }, + {"minDamage", offsetof(WeaponFullDef, weapDef.minDamage), CSPFT_INT }, + {"minPlayerDamage", offsetof(WeaponFullDef, weapDef.minPlayerDamage), CSPFT_INT }, + {"maxDamageRange", offsetof(WeaponFullDef, weapDef.fMaxDamageRange), CSPFT_FLOAT }, + {"minDamageRange", offsetof(WeaponFullDef, weapDef.fMinDamageRange), CSPFT_FLOAT }, + {"destabilizationRateTime", offsetof(WeaponFullDef, weapDef.destabilizationRateTime), CSPFT_FLOAT }, + {"destabilizationCurvatureMax", offsetof(WeaponFullDef, weapDef.destabilizationCurvatureMax), CSPFT_FLOAT }, + {"destabilizeDistance", offsetof(WeaponFullDef, weapDef.destabilizeDistance), CSPFT_INT }, + {"fireDelay", offsetof(WeaponFullDef, weapDef.iFireDelay), CSPFT_MILLISECONDS }, + {"meleeDelay", offsetof(WeaponFullDef, weapDef.iMeleeDelay), CSPFT_MILLISECONDS }, + {"meleeChargeDelay", offsetof(WeaponFullDef, weapDef.meleeChargeDelay), CSPFT_MILLISECONDS }, + {"fireTime", offsetof(WeaponFullDef, weapCompleteDef.iFireTime), CSPFT_MILLISECONDS }, + {"rechamberTime", offsetof(WeaponFullDef, weapDef.iRechamberTime), CSPFT_MILLISECONDS }, + {"rechamberTimeOneHanded", offsetof(WeaponFullDef, weapDef.rechamberTimeOneHanded), CSPFT_MILLISECONDS }, + {"rechamberBoltTime", offsetof(WeaponFullDef, weapDef.iRechamberBoltTime), CSPFT_MILLISECONDS }, + {"holdFireTime", offsetof(WeaponFullDef, weapDef.iHoldFireTime), CSPFT_MILLISECONDS }, + {"detonateTime", offsetof(WeaponFullDef, weapDef.iDetonateTime), CSPFT_MILLISECONDS }, + {"detonateDelay", offsetof(WeaponFullDef, weapDef.iDetonateDelay), CSPFT_MILLISECONDS }, + {"meleeTime", offsetof(WeaponFullDef, weapDef.iMeleeTime), CSPFT_MILLISECONDS }, + {"meleeChargeTime", offsetof(WeaponFullDef, weapDef.meleeChargeTime), CSPFT_MILLISECONDS }, + {"reloadTime", offsetof(WeaponFullDef, weapDef.iReloadTime), CSPFT_MILLISECONDS }, + {"reloadShowRocketTime", offsetof(WeaponFullDef, weapDef.reloadShowRocketTime), CSPFT_MILLISECONDS }, + {"reloadEmptyTime", offsetof(WeaponFullDef, weapDef.iReloadEmptyTime), CSPFT_MILLISECONDS }, + {"reloadAddTime", offsetof(WeaponFullDef, weapDef.iReloadAddTime), CSPFT_MILLISECONDS }, + {"reloadStartTime", offsetof(WeaponFullDef, weapDef.iReloadStartTime), CSPFT_MILLISECONDS }, + {"reloadStartAddTime", offsetof(WeaponFullDef, weapDef.iReloadStartAddTime), CSPFT_MILLISECONDS }, + {"reloadEndTime", offsetof(WeaponFullDef, weapDef.iReloadEndTime), CSPFT_MILLISECONDS }, + {"dropTime", offsetof(WeaponFullDef, weapDef.iDropTime), CSPFT_MILLISECONDS }, + {"raiseTime", offsetof(WeaponFullDef, weapDef.iRaiseTime), CSPFT_MILLISECONDS }, + {"altDropTime", offsetof(WeaponFullDef, weapDef.iAltDropTime), CSPFT_MILLISECONDS }, + {"altRaiseTime", offsetof(WeaponFullDef, weapCompleteDef.iAltRaiseTime), CSPFT_MILLISECONDS }, + {"quickDropTime", offsetof(WeaponFullDef, weapDef.quickDropTime), CSPFT_MILLISECONDS }, + {"quickRaiseTime", offsetof(WeaponFullDef, weapDef.quickRaiseTime), CSPFT_MILLISECONDS }, + {"firstRaiseTime", offsetof(WeaponFullDef, weapCompleteDef.iFirstRaiseTime), CSPFT_MILLISECONDS }, + {"breachRaiseTime", offsetof(WeaponFullDef, weapDef.iBreachRaiseTime), CSPFT_MILLISECONDS }, + {"emptyRaiseTime", offsetof(WeaponFullDef, weapDef.iEmptyRaiseTime), CSPFT_MILLISECONDS }, + {"emptyDropTime", offsetof(WeaponFullDef, weapDef.iEmptyDropTime), CSPFT_MILLISECONDS }, + {"sprintInTime", offsetof(WeaponFullDef, weapDef.sprintInTime), CSPFT_MILLISECONDS }, + {"sprintLoopTime", offsetof(WeaponFullDef, weapDef.sprintLoopTime), CSPFT_MILLISECONDS }, + {"sprintOutTime", offsetof(WeaponFullDef, weapDef.sprintOutTime), CSPFT_MILLISECONDS }, + {"stunnedTimeBegin", offsetof(WeaponFullDef, weapDef.stunnedTimeBegin), CSPFT_MILLISECONDS }, + {"stunnedTimeLoop", offsetof(WeaponFullDef, weapDef.stunnedTimeLoop), CSPFT_MILLISECONDS }, + {"stunnedTimeEnd", offsetof(WeaponFullDef, weapDef.stunnedTimeEnd), CSPFT_MILLISECONDS }, + {"nightVisionWearTime", offsetof(WeaponFullDef, weapDef.nightVisionWearTime), CSPFT_MILLISECONDS }, + {"nightVisionWearTimeFadeOutEnd", offsetof(WeaponFullDef, weapDef.nightVisionWearTimeFadeOutEnd), CSPFT_MILLISECONDS }, + {"nightVisionWearTimePowerUp", offsetof(WeaponFullDef, weapDef.nightVisionWearTimePowerUp), CSPFT_MILLISECONDS }, + {"nightVisionRemoveTime", offsetof(WeaponFullDef, weapDef.nightVisionRemoveTime), CSPFT_MILLISECONDS }, + {"nightVisionRemoveTimePowerDown", offsetof(WeaponFullDef, weapDef.nightVisionRemoveTimePowerDown), CSPFT_MILLISECONDS }, + {"nightVisionRemoveTimeFadeInStart", offsetof(WeaponFullDef, weapDef.nightVisionRemoveTimeFadeInStart), CSPFT_MILLISECONDS }, + {"fuseTime", offsetof(WeaponFullDef, weapDef.fuseTime), CSPFT_MILLISECONDS }, + {"aifuseTime", offsetof(WeaponFullDef, weapDef.aiFuseTime), CSPFT_MILLISECONDS }, + {"lockonSupported", offsetof(WeaponFullDef, weapDef.lockonSupported), CSPFT_BOOL }, + {"requireLockonToFire", offsetof(WeaponFullDef, weapDef.requireLockonToFire), CSPFT_BOOL }, + {"bigExplosion", offsetof(WeaponFullDef, weapDef.bigExplosion), CSPFT_BOOL }, + {"noAdsWhenMagEmpty", offsetof(WeaponFullDef, weapDef.noAdsWhenMagEmpty), CSPFT_BOOL }, + {"inheritsPerks", offsetof(WeaponFullDef, weapDef.inheritsPerks), CSPFT_BOOL }, + {"avoidDropCleanup", offsetof(WeaponFullDef, weapDef.avoidDropCleanup), CSPFT_BOOL }, + {"autoAimRange", offsetof(WeaponFullDef, weapDef.autoAimRange), CSPFT_FLOAT }, + {"aimAssistRange", offsetof(WeaponFullDef, weapDef.aimAssistRange), CSPFT_FLOAT }, + {"aimAssistRangeAds", offsetof(WeaponFullDef, weapDef.aimAssistRangeAds), CSPFT_FLOAT }, + {"aimPadding", offsetof(WeaponFullDef, weapDef.aimPadding), CSPFT_FLOAT }, + {"enemyCrosshairRange", offsetof(WeaponFullDef, weapDef.enemyCrosshairRange), CSPFT_FLOAT }, + {"crosshairColorChange", offsetof(WeaponFullDef, weapDef.crosshairColorChange), CSPFT_BOOL }, + {"moveSpeedScale", offsetof(WeaponFullDef, weapDef.moveSpeedScale), CSPFT_FLOAT }, + {"adsMoveSpeedScale", offsetof(WeaponFullDef, weapDef.adsMoveSpeedScale), CSPFT_FLOAT }, + {"sprintDurationScale", offsetof(WeaponFullDef, weapDef.sprintDurationScale), CSPFT_FLOAT }, + {"idleCrouchFactor", offsetof(WeaponFullDef, weapDef.fIdleCrouchFactor), CSPFT_FLOAT }, + {"idleProneFactor", offsetof(WeaponFullDef, weapDef.fIdleProneFactor), CSPFT_FLOAT }, + {"gunMaxPitch", offsetof(WeaponFullDef, weapDef.fGunMaxPitch), CSPFT_FLOAT }, + {"gunMaxYaw", offsetof(WeaponFullDef, weapDef.fGunMaxYaw), CSPFT_FLOAT }, + {"swayMaxAngle", offsetof(WeaponFullDef, weapDef.swayMaxAngle), CSPFT_FLOAT }, + {"swayLerpSpeed", offsetof(WeaponFullDef, weapDef.swayLerpSpeed), CSPFT_FLOAT }, + {"swayPitchScale", offsetof(WeaponFullDef, weapDef.swayPitchScale), CSPFT_FLOAT }, + {"swayYawScale", offsetof(WeaponFullDef, weapDef.swayYawScale), CSPFT_FLOAT }, + {"swayHorizScale", offsetof(WeaponFullDef, weapDef.swayHorizScale), CSPFT_FLOAT }, + {"swayVertScale", offsetof(WeaponFullDef, weapDef.swayVertScale), CSPFT_FLOAT }, + {"swayShellShockScale", offsetof(WeaponFullDef, weapDef.swayShellShockScale), CSPFT_FLOAT }, + {"adsSwayMaxAngle", offsetof(WeaponFullDef, weapDef.adsSwayMaxAngle), CSPFT_FLOAT }, + {"adsSwayLerpSpeed", offsetof(WeaponFullDef, weapDef.adsSwayLerpSpeed), CSPFT_FLOAT }, + {"adsSwayPitchScale", offsetof(WeaponFullDef, weapDef.adsSwayPitchScale), CSPFT_FLOAT }, + {"adsSwayYawScale", offsetof(WeaponFullDef, weapDef.adsSwayYawScale), CSPFT_FLOAT }, + {"adsSwayHorizScale", offsetof(WeaponFullDef, weapDef.adsSwayHorizScale), CSPFT_FLOAT }, + {"adsSwayVertScale", offsetof(WeaponFullDef, weapDef.adsSwayVertScale), CSPFT_FLOAT }, + {"rifleBullet", offsetof(WeaponFullDef, weapDef.bRifleBullet), CSPFT_BOOL }, + {"armorPiercing", offsetof(WeaponFullDef, weapDef.armorPiercing), CSPFT_BOOL }, + {"boltAction", offsetof(WeaponFullDef, weapDef.bBoltAction), CSPFT_BOOL }, + {"aimDownSight", offsetof(WeaponFullDef, weapDef.aimDownSight), CSPFT_BOOL }, + {"rechamberWhileAds", offsetof(WeaponFullDef, weapDef.bRechamberWhileAds), CSPFT_BOOL }, + {"bBulletExplosiveDamage", offsetof(WeaponFullDef, weapDef.bBulletExplosiveDamage), CSPFT_BOOL }, + {"adsViewErrorMin", offsetof(WeaponFullDef, weapDef.adsViewErrorMin), CSPFT_FLOAT }, + {"adsViewErrorMax", offsetof(WeaponFullDef, weapDef.adsViewErrorMax), CSPFT_FLOAT }, + {"clipOnly", offsetof(WeaponFullDef, weapDef.bClipOnly), CSPFT_BOOL }, + {"noAmmoPickup", offsetof(WeaponFullDef, weapDef.noAmmoPickup), CSPFT_BOOL }, + {"cookOffHold", offsetof(WeaponFullDef, weapDef.bCookOffHold), CSPFT_BOOL }, + {"adsFire", offsetof(WeaponFullDef, weapDef.adsFireOnly), CSPFT_BOOL }, + {"cancelAutoHolsterWhenEmpty", offsetof(WeaponFullDef, weapDef.cancelAutoHolsterWhenEmpty), CSPFT_BOOL }, + {"disableSwitchToWhenEmpty", offsetof(WeaponFullDef, weapDef.disableSwitchToWhenEmpty), CSPFT_BOOL }, + {"suppressAmmoReserveDisplay", offsetof(WeaponFullDef, weapDef.suppressAmmoReserveDisplay), CSPFT_BOOL }, + {"enhanced", offsetof(WeaponFullDef, weapCompleteDef.enhanced), CSPFT_BOOL }, + {"motionTracker", offsetof(WeaponFullDef, weapCompleteDef.motionTracker), CSPFT_BOOL }, + {"laserSightDuringNightvision", offsetof(WeaponFullDef, weapDef.laserSightDuringNightvision), CSPFT_BOOL }, + {"markableViewmodel", offsetof(WeaponFullDef, weapDef.markableViewmodel), CSPFT_BOOL }, + {"physCollmap", offsetof(WeaponFullDef, weapDef.physCollmap), CSPFT_PHYS_COLLMAP }, + {"noDualWield", offsetof(WeaponFullDef, weapDef.noDualWield), CSPFT_BOOL }, + {"dualWieldViewModelOffset", offsetof(WeaponFullDef, weapDef.dualWieldViewModelOffset), CSPFT_FLOAT }, + {"killIcon", offsetof(WeaponFullDef, weapCompleteDef.killIcon), CSPFT_MATERIAL }, + {"killIconRatio", offsetof(WeaponFullDef, weapDef.killIconRatio), WFT_ICONRATIO_KILL }, + {"flipKillIcon", offsetof(WeaponFullDef, weapDef.flipKillIcon), CSPFT_BOOL }, + {"dpadIcon", offsetof(WeaponFullDef, weapCompleteDef.dpadIcon), CSPFT_MATERIAL }, + {"dpadIconRatio", offsetof(WeaponFullDef, weapCompleteDef.dpadIconRatio), WFT_ICONRATIO_DPAD }, + {"dpadIconShowsAmmo", offsetof(WeaponFullDef, weapCompleteDef.dpadIconShowsAmmo), CSPFT_BOOL }, + {"noPartialReload", offsetof(WeaponFullDef, weapDef.bNoPartialReload), CSPFT_BOOL }, + {"segmentedReload", offsetof(WeaponFullDef, weapDef.bSegmentedReload), CSPFT_BOOL }, + {"reloadAmmoAdd", offsetof(WeaponFullDef, weapDef.iReloadAmmoAdd), CSPFT_INT }, + {"reloadStartAdd", offsetof(WeaponFullDef, weapDef.iReloadStartAdd), CSPFT_INT }, + {"altWeapon", offsetof(WeaponFullDef, weapCompleteDef.szAltWeaponName), CSPFT_STRING }, + {"dropAmmoMin", offsetof(WeaponFullDef, weapDef.ammoDropStockMin), CSPFT_INT }, + {"dropAmmoMax", offsetof(WeaponFullDef, weapCompleteDef.ammoDropStockMax), CSPFT_INT }, + {"ammoDropClipPercentMin", offsetof(WeaponFullDef, weapDef.ammoDropClipPercentMin), CSPFT_INT }, + {"ammoDropClipPercentMax", offsetof(WeaponFullDef, weapDef.ammoDropClipPercentMax), CSPFT_INT }, + {"blocksProne", offsetof(WeaponFullDef, weapDef.blocksProne), CSPFT_BOOL }, + {"silenced", offsetof(WeaponFullDef, weapDef.silenced), CSPFT_BOOL }, + {"isRollingGrenade", offsetof(WeaponFullDef, weapDef.isRollingGrenade), CSPFT_BOOL }, + {"explosionRadius", offsetof(WeaponFullDef, weapDef.iExplosionRadius), CSPFT_INT }, + {"explosionRadiusMin", offsetof(WeaponFullDef, weapDef.iExplosionRadiusMin), CSPFT_INT }, + {"explosionInnerDamage", offsetof(WeaponFullDef, weapDef.iExplosionInnerDamage), CSPFT_INT }, + {"explosionOuterDamage", offsetof(WeaponFullDef, weapDef.iExplosionOuterDamage), CSPFT_INT }, + {"damageConeAngle", offsetof(WeaponFullDef, weapDef.damageConeAngle), CSPFT_FLOAT }, + {"bulletExplDmgMult", offsetof(WeaponFullDef, weapDef.bulletExplDmgMult), CSPFT_FLOAT }, + {"bulletExplRadiusMult", offsetof(WeaponFullDef, weapDef.bulletExplRadiusMult), CSPFT_FLOAT }, + {"projectileSpeed", offsetof(WeaponFullDef, weapDef.iProjectileSpeed), CSPFT_INT }, + {"projectileSpeedUp", offsetof(WeaponFullDef, weapDef.iProjectileSpeedUp), CSPFT_INT }, + {"projectileSpeedForward", offsetof(WeaponFullDef, weapDef.iProjectileSpeedForward), CSPFT_INT }, + {"projectileActivateDist", offsetof(WeaponFullDef, weapDef.iProjectileActivateDist), CSPFT_INT }, + {"projectileLifetime", offsetof(WeaponFullDef, weapDef.projLifetime), CSPFT_FLOAT }, + {"timeToAccelerate", offsetof(WeaponFullDef, weapDef.timeToAccelerate), CSPFT_FLOAT }, + {"projectileCurvature", offsetof(WeaponFullDef, weapDef.projectileCurvature), CSPFT_FLOAT }, + {"projectileModel", offsetof(WeaponFullDef, weapDef.projectileModel), CSPFT_XMODEL }, + {"projExplosionType", offsetof(WeaponFullDef, weapDef.projExplosion), WFT_PROJ_EXPLOSION }, + {"projExplosionEffect", offsetof(WeaponFullDef, weapDef.projExplosionEffect), CSPFT_FX }, + {"projExplosionEffectForceNormalUp", offsetof(WeaponFullDef, weapDef.projExplosionEffectForceNormalUp), CSPFT_BOOL }, + {"projExplosionSound", offsetof(WeaponFullDef, weapDef.projExplosionSound), CSPFT_SOUND }, + {"projDudEffect", offsetof(WeaponFullDef, weapDef.projDudEffect), CSPFT_FX }, + {"projDudSound", offsetof(WeaponFullDef, weapDef.projDudSound), CSPFT_SOUND }, + {"projImpactExplode", offsetof(WeaponFullDef, weapDef.bProjImpactExplode), CSPFT_BOOL }, + {"stickiness", offsetof(WeaponFullDef, weapDef.stickiness), WFT_STICKINESS }, + {"stickToPlayers", offsetof(WeaponFullDef, weapDef.stickToPlayers), CSPFT_BOOL }, + {"hasDetonator", offsetof(WeaponFullDef, weapDef.hasDetonator), CSPFT_BOOL }, + {"disableFiring", offsetof(WeaponFullDef, weapDef.disableFiring), CSPFT_BOOL }, + {"timedDetonation", offsetof(WeaponFullDef, weapDef.timedDetonation), CSPFT_BOOL }, + {"rotate", offsetof(WeaponFullDef, weapDef.rotate), CSPFT_BOOL }, + {"holdButtonToThrow", offsetof(WeaponFullDef, weapDef.holdButtonToThrow), CSPFT_BOOL }, + {"freezeMovementWhenFiring", offsetof(WeaponFullDef, weapDef.freezeMovementWhenFiring), CSPFT_BOOL }, + {"lowAmmoWarningThreshold", offsetof(WeaponFullDef, weapDef.lowAmmoWarningThreshold), CSPFT_FLOAT }, + {"ricochetChance", offsetof(WeaponFullDef, weapDef.ricochetChance), CSPFT_FLOAT }, + {"offhandHoldIsCancelable", offsetof(WeaponFullDef, weapDef.offhandHoldIsCancelable), CSPFT_BOOL }, + {"parallelDefaultBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_DEFAULT]), CSPFT_FLOAT }, + {"parallelBarkBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_BARK]), CSPFT_FLOAT }, + {"parallelBrickBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_BRICK]), CSPFT_FLOAT }, + {"parallelCarpetBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_CARPET]), CSPFT_FLOAT }, + {"parallelClothBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_CLOTH]), CSPFT_FLOAT }, + {"parallelConcreteBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_CONCRETE]), CSPFT_FLOAT }, + {"parallelDirtBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_DIRT]), CSPFT_FLOAT }, + {"parallelFleshBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_FLESH]), CSPFT_FLOAT }, + {"parallelFoliageBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_FOLIAGE]), CSPFT_FLOAT }, + {"parallelGlassBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_GLASS]), CSPFT_FLOAT }, + {"parallelGrassBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_GRASS]), CSPFT_FLOAT }, + {"parallelGravelBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_GRAVEL]), CSPFT_FLOAT }, + {"parallelIceBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_ICE]), CSPFT_FLOAT }, + {"parallelMetalBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_METAL]), CSPFT_FLOAT }, + {"parallelMudBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_MUD]), CSPFT_FLOAT }, + {"parallelPaperBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_PAPER]), CSPFT_FLOAT }, + {"parallelPlasterBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_PLASTER]), CSPFT_FLOAT }, + {"parallelRockBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_ROCK]), CSPFT_FLOAT }, + {"parallelSandBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_SAND]), CSPFT_FLOAT }, + {"parallelSnowBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_SNOW]), CSPFT_FLOAT }, + {"parallelWaterBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_WATER]), CSPFT_FLOAT }, + {"parallelWoodBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_WOOD]), CSPFT_FLOAT }, + {"parallelAsphaltBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_ASPHALT]), CSPFT_FLOAT }, + {"parallelCeramicBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_CERAMIC]), CSPFT_FLOAT }, + {"parallelPlasticBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_PLASTIC]), CSPFT_FLOAT }, + {"parallelRubberBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_RUBBER]), CSPFT_FLOAT }, + {"parallelCushionBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_CUSHION]), CSPFT_FLOAT }, + {"parallelFruitBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_FRUIT]), CSPFT_FLOAT }, + {"parallelPaintedMetalBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_PAINTED_METAL]), CSPFT_FLOAT }, + {"parallelRiotShieldBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_RIOT_SHIELD]), CSPFT_FLOAT }, + {"parallelSlushBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_SLUSH]), CSPFT_FLOAT }, + {"perpendicularDefaultBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_DEFAULT]), CSPFT_FLOAT }, + {"perpendicularBarkBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_BARK]), CSPFT_FLOAT }, + {"perpendicularBrickBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_BRICK]), CSPFT_FLOAT }, + {"perpendicularCarpetBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_CARPET]), CSPFT_FLOAT }, + {"perpendicularClothBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_CLOTH]), CSPFT_FLOAT }, + {"perpendicularConcreteBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_CONCRETE]), CSPFT_FLOAT }, + {"perpendicularDirtBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_DIRT]), CSPFT_FLOAT }, + {"perpendicularFleshBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_FLESH]), CSPFT_FLOAT }, + {"perpendicularFoliageBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_FOLIAGE]), CSPFT_FLOAT }, + {"perpendicularGlassBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_GLASS]), CSPFT_FLOAT }, + {"perpendicularGrassBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_GRASS]), CSPFT_FLOAT }, + {"perpendicularGravelBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_GRAVEL]), CSPFT_FLOAT }, + {"perpendicularIceBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_ICE]), CSPFT_FLOAT }, + {"perpendicularMetalBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_METAL]), CSPFT_FLOAT }, + {"perpendicularMudBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_MUD]), CSPFT_FLOAT }, + {"perpendicularPaperBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_PAPER]), CSPFT_FLOAT }, + {"perpendicularPlasterBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_PLASTER]), CSPFT_FLOAT }, + {"perpendicularRockBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_ROCK]), CSPFT_FLOAT }, + {"perpendicularSandBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_SAND]), CSPFT_FLOAT }, + {"perpendicularSnowBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_SNOW]), CSPFT_FLOAT }, + {"perpendicularWaterBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_WATER]), CSPFT_FLOAT }, + {"perpendicularWoodBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_WOOD]), CSPFT_FLOAT }, + {"perpendicularAsphaltBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_ASPHALT]), CSPFT_FLOAT }, + {"perpendicularCeramicBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_CERAMIC]), CSPFT_FLOAT }, + {"perpendicularPlasticBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_PLASTIC]), CSPFT_FLOAT }, + {"perpendicularRubberBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_RUBBER]), CSPFT_FLOAT }, + {"perpendicularCushionBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_CUSHION]), CSPFT_FLOAT }, + {"perpendicularFruitBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_FRUIT]), CSPFT_FLOAT }, + {"perpendicularPaintedMetalBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_PAINTED_METAL]), CSPFT_FLOAT }, + {"perpendicularRiotShieldBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_RIOT_SHIELD]), CSPFT_FLOAT }, + {"perpendicularSlushBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_SLUSH]), CSPFT_FLOAT }, + {"projTrailEffect", offsetof(WeaponFullDef, weapDef.projTrailEffect), CSPFT_FX }, + {"projBeaconEffect", offsetof(WeaponFullDef, weapDef.projBeaconEffect), CSPFT_FX }, + {"projectileRed", offsetof(WeaponFullDef, weapDef.vProjectileColor[0]), CSPFT_FLOAT }, + {"projectileGreen", offsetof(WeaponFullDef, weapDef.vProjectileColor[1]), CSPFT_FLOAT }, + {"projectileBlue", offsetof(WeaponFullDef, weapDef.vProjectileColor[2]), CSPFT_FLOAT }, + {"guidedMissileType", offsetof(WeaponFullDef, weapDef.guidedMissileType), WFT_GUIDED_MISSILE_TYPE }, + {"maxSteeringAccel", offsetof(WeaponFullDef, weapDef.maxSteeringAccel), CSPFT_FLOAT }, + {"projIgnitionDelay", offsetof(WeaponFullDef, weapDef.projIgnitionDelay), CSPFT_INT }, + {"projIgnitionEffect", offsetof(WeaponFullDef, weapDef.projIgnitionEffect), CSPFT_FX }, + {"projIgnitionSound", offsetof(WeaponFullDef, weapDef.projIgnitionSound), CSPFT_SOUND }, + {"adsTransInTime", offsetof(WeaponFullDef, weapCompleteDef.iAdsTransInTime), CSPFT_MILLISECONDS }, + {"adsTransOutTime", offsetof(WeaponFullDef, weapCompleteDef.iAdsTransOutTime), CSPFT_MILLISECONDS }, + {"adsIdleAmount", offsetof(WeaponFullDef, weapDef.fAdsIdleAmount), CSPFT_FLOAT }, + {"adsIdleSpeed", offsetof(WeaponFullDef, weapDef.adsIdleSpeed), CSPFT_FLOAT }, + {"adsZoomFov", offsetof(WeaponFullDef, weapCompleteDef.fAdsZoomFov), CSPFT_FLOAT }, + {"adsZoomInFrac", offsetof(WeaponFullDef, weapDef.fAdsZoomInFrac), CSPFT_FLOAT }, + {"adsZoomOutFrac", offsetof(WeaponFullDef, weapDef.fAdsZoomOutFrac), CSPFT_FLOAT }, + {"adsOverlayShader", offsetof(WeaponFullDef, weapDef.overlayMaterial), CSPFT_MATERIAL }, + {"adsOverlayShaderLowRes", offsetof(WeaponFullDef, weapDef.overlayMaterialLowRes), CSPFT_MATERIAL }, + {"adsOverlayShaderEMP", offsetof(WeaponFullDef, weapDef.overlayMaterialEMP), CSPFT_MATERIAL }, + {"adsOverlayShaderEMPLowRes", offsetof(WeaponFullDef, weapDef.overlayMaterialEMPLowRes), CSPFT_MATERIAL }, + {"adsOverlayReticle", offsetof(WeaponFullDef, weapDef.overlayReticle), WFT_OVERLAYRETICLE }, + {"adsOverlayInterface", offsetof(WeaponFullDef, weapDef.overlayInterface), WFT_OVERLAYINTERFACE }, + {"adsOverlayWidth", offsetof(WeaponFullDef, weapDef.overlayWidth), CSPFT_FLOAT }, + {"adsOverlayHeight", offsetof(WeaponFullDef, weapDef.overlayHeight), CSPFT_FLOAT }, + {"adsOverlayWidthSplitscreen", offsetof(WeaponFullDef, weapDef.overlayWidthSplitscreen), CSPFT_FLOAT }, + {"adsOverlayHeightSplitscreen", offsetof(WeaponFullDef, weapDef.overlayHeightSplitscreen), CSPFT_FLOAT }, + {"adsBobFactor", offsetof(WeaponFullDef, weapDef.fAdsBobFactor), CSPFT_FLOAT }, + {"adsViewBobMult", offsetof(WeaponFullDef, weapDef.fAdsViewBobMult), CSPFT_FLOAT }, + {"adsAimPitch", offsetof(WeaponFullDef, weapDef.fAdsAimPitch), CSPFT_FLOAT }, + {"adsCrosshairInFrac", offsetof(WeaponFullDef, weapDef.fAdsCrosshairInFrac), CSPFT_FLOAT }, + {"adsCrosshairOutFrac", offsetof(WeaponFullDef, weapDef.fAdsCrosshairOutFrac), CSPFT_FLOAT }, + {"adsReloadTransTime", offsetof(WeaponFullDef, weapDef.iPositionReloadTransTime), CSPFT_MILLISECONDS }, + {"adsGunKickReducedKickBullets", offsetof(WeaponFullDef, weapDef.adsGunKickReducedKickBullets), CSPFT_INT }, + {"adsGunKickReducedKickPercent", offsetof(WeaponFullDef, weapDef.adsGunKickReducedKickPercent), CSPFT_FLOAT }, + {"adsGunKickPitchMin", offsetof(WeaponFullDef, weapDef.fAdsGunKickPitchMin), CSPFT_FLOAT }, + {"adsGunKickPitchMax", offsetof(WeaponFullDef, weapDef.fAdsGunKickPitchMax), CSPFT_FLOAT }, + {"adsGunKickYawMin", offsetof(WeaponFullDef, weapDef.fAdsGunKickYawMin), CSPFT_FLOAT }, + {"adsGunKickYawMax", offsetof(WeaponFullDef, weapDef.fAdsGunKickYawMax), CSPFT_FLOAT }, + {"adsGunKickAccel", offsetof(WeaponFullDef, weapDef.fAdsGunKickAccel), CSPFT_FLOAT }, + {"adsGunKickSpeedMax", offsetof(WeaponFullDef, weapDef.fAdsGunKickSpeedMax), CSPFT_FLOAT }, + {"adsGunKickSpeedDecay", offsetof(WeaponFullDef, weapDef.fAdsGunKickSpeedDecay), CSPFT_FLOAT }, + {"adsGunKickStaticDecay", offsetof(WeaponFullDef, weapDef.fAdsGunKickStaticDecay), CSPFT_FLOAT }, + {"adsViewKickPitchMin", offsetof(WeaponFullDef, weapDef.fAdsViewKickPitchMin), CSPFT_FLOAT }, + {"adsViewKickPitchMax", offsetof(WeaponFullDef, weapDef.fAdsViewKickPitchMax), CSPFT_FLOAT }, + {"adsViewKickYawMin", offsetof(WeaponFullDef, weapDef.fAdsViewKickYawMin), CSPFT_FLOAT }, + {"adsViewKickYawMax", offsetof(WeaponFullDef, weapDef.fAdsViewKickYawMax), CSPFT_FLOAT }, + {"adsViewKickCenterSpeed", offsetof(WeaponFullDef, weapCompleteDef.fAdsViewKickCenterSpeed), CSPFT_FLOAT }, + {"adsSpread", offsetof(WeaponFullDef, weapDef.fAdsSpread), CSPFT_FLOAT }, + {"guidedMissileType", offsetof(WeaponFullDef, weapDef.guidedMissileType), WFT_GUIDED_MISSILE_TYPE }, + {"hipSpreadStandMin", offsetof(WeaponFullDef, weapDef.fHipSpreadStandMin), CSPFT_FLOAT }, + {"hipSpreadDuckedMin", offsetof(WeaponFullDef, weapDef.fHipSpreadDuckedMin), CSPFT_FLOAT }, + {"hipSpreadProneMin", offsetof(WeaponFullDef, weapDef.fHipSpreadProneMin), CSPFT_FLOAT }, + {"hipSpreadMax", offsetof(WeaponFullDef, weapDef.hipSpreadStandMax), CSPFT_FLOAT }, + {"hipSpreadDuckedMax", offsetof(WeaponFullDef, weapDef.hipSpreadDuckedMax), CSPFT_FLOAT }, + {"hipSpreadProneMax", offsetof(WeaponFullDef, weapDef.hipSpreadProneMax), CSPFT_FLOAT }, + {"hipSpreadDecayRate", offsetof(WeaponFullDef, weapDef.fHipSpreadDecayRate), CSPFT_FLOAT }, + {"hipSpreadFireAdd", offsetof(WeaponFullDef, weapDef.fHipSpreadFireAdd), CSPFT_FLOAT }, + {"hipSpreadTurnAdd", offsetof(WeaponFullDef, weapDef.fHipSpreadTurnAdd), CSPFT_FLOAT }, + {"hipSpreadMoveAdd", offsetof(WeaponFullDef, weapDef.fHipSpreadMoveAdd), CSPFT_FLOAT }, + {"hipSpreadDuckedDecay", offsetof(WeaponFullDef, weapDef.fHipSpreadDuckedDecay), CSPFT_FLOAT }, + {"hipSpreadProneDecay", offsetof(WeaponFullDef, weapDef.fHipSpreadProneDecay), CSPFT_FLOAT }, + {"hipReticleSidePos", offsetof(WeaponFullDef, weapDef.fHipReticleSidePos), CSPFT_FLOAT }, + {"hipIdleAmount", offsetof(WeaponFullDef, weapDef.fHipIdleAmount), CSPFT_FLOAT }, + {"hipIdleSpeed", offsetof(WeaponFullDef, weapDef.hipIdleSpeed), CSPFT_FLOAT }, + {"hipGunKickReducedKickBullets", offsetof(WeaponFullDef, weapDef.hipGunKickReducedKickBullets), CSPFT_INT }, + {"hipGunKickReducedKickPercent", offsetof(WeaponFullDef, weapDef.hipGunKickReducedKickPercent), CSPFT_FLOAT }, + {"hipGunKickPitchMin", offsetof(WeaponFullDef, weapDef.fHipGunKickPitchMin), CSPFT_FLOAT }, + {"hipGunKickPitchMax", offsetof(WeaponFullDef, weapDef.fHipGunKickPitchMax), CSPFT_FLOAT }, + {"hipGunKickYawMin", offsetof(WeaponFullDef, weapDef.fHipGunKickYawMin), CSPFT_FLOAT }, + {"hipGunKickYawMax", offsetof(WeaponFullDef, weapDef.fHipGunKickYawMax), CSPFT_FLOAT }, + {"hipGunKickAccel", offsetof(WeaponFullDef, weapDef.fHipGunKickAccel), CSPFT_FLOAT }, + {"hipGunKickSpeedMax", offsetof(WeaponFullDef, weapDef.fHipGunKickSpeedMax), CSPFT_FLOAT }, + {"hipGunKickSpeedDecay", offsetof(WeaponFullDef, weapDef.fHipGunKickSpeedDecay), CSPFT_FLOAT }, + {"hipGunKickStaticDecay", offsetof(WeaponFullDef, weapDef.fHipGunKickStaticDecay), CSPFT_FLOAT }, + {"hipViewKickPitchMin", offsetof(WeaponFullDef, weapDef.fHipViewKickPitchMin), CSPFT_FLOAT }, + {"hipViewKickPitchMax", offsetof(WeaponFullDef, weapDef.fHipViewKickPitchMax), CSPFT_FLOAT }, + {"hipViewKickYawMin", offsetof(WeaponFullDef, weapDef.fHipViewKickYawMin), CSPFT_FLOAT }, + {"hipViewKickYawMax", offsetof(WeaponFullDef, weapDef.fHipViewKickYawMax), CSPFT_FLOAT }, + {"hipViewKickCenterSpeed", offsetof(WeaponFullDef, weapCompleteDef.fHipViewKickCenterSpeed), CSPFT_FLOAT }, + {"leftArc", offsetof(WeaponFullDef, weapDef.leftArc), CSPFT_FLOAT }, + {"rightArc", offsetof(WeaponFullDef, weapDef.rightArc), CSPFT_FLOAT }, + {"topArc", offsetof(WeaponFullDef, weapDef.topArc), CSPFT_FLOAT }, + {"bottomArc", offsetof(WeaponFullDef, weapDef.bottomArc), CSPFT_FLOAT }, + {"accuracy", offsetof(WeaponFullDef, weapDef.accuracy), CSPFT_FLOAT }, + {"aiSpread", offsetof(WeaponFullDef, weapDef.aiSpread), CSPFT_FLOAT }, + {"playerSpread", offsetof(WeaponFullDef, weapDef.playerSpread), CSPFT_FLOAT }, + {"maxVertTurnSpeed", offsetof(WeaponFullDef, weapDef.maxTurnSpeed[0]), CSPFT_FLOAT }, + {"maxHorTurnSpeed", offsetof(WeaponFullDef, weapDef.maxTurnSpeed[1]), CSPFT_FLOAT }, + {"minVertTurnSpeed", offsetof(WeaponFullDef, weapDef.minTurnSpeed[0]), CSPFT_FLOAT }, + {"minHorTurnSpeed", offsetof(WeaponFullDef, weapDef.minTurnSpeed[1]), CSPFT_FLOAT }, + {"pitchConvergenceTime", offsetof(WeaponFullDef, weapDef.pitchConvergenceTime), CSPFT_FLOAT }, + {"yawConvergenceTime", offsetof(WeaponFullDef, weapDef.yawConvergenceTime), CSPFT_FLOAT }, + {"suppressionTime", offsetof(WeaponFullDef, weapDef.suppressTime), CSPFT_FLOAT }, + {"maxRange", offsetof(WeaponFullDef, weapDef.maxRange), CSPFT_FLOAT }, + {"animHorRotateInc", offsetof(WeaponFullDef, weapDef.fAnimHorRotateInc), CSPFT_FLOAT }, + {"playerPositionDist", offsetof(WeaponFullDef, weapDef.fPlayerPositionDist), CSPFT_FLOAT }, + {"stance", offsetof(WeaponFullDef, weapDef.stance), WFT_STANCE }, + {"useHintString", offsetof(WeaponFullDef, weapDef.szUseHintString), CSPFT_STRING }, + {"dropHintString", offsetof(WeaponFullDef, weapDef.dropHintString), CSPFT_STRING }, + {"horizViewJitter", offsetof(WeaponFullDef, weapDef.horizViewJitter), CSPFT_FLOAT }, + {"vertViewJitter", offsetof(WeaponFullDef, weapDef.vertViewJitter), CSPFT_FLOAT }, + {"scanSpeed", offsetof(WeaponFullDef, weapDef.scanSpeed), CSPFT_FLOAT }, + {"scanAccel", offsetof(WeaponFullDef, weapDef.scanAccel), CSPFT_FLOAT }, + {"scanPauseTime", offsetof(WeaponFullDef, weapDef.scanPauseTime), CSPFT_MILLISECONDS }, + {"fightDist", offsetof(WeaponFullDef, weapDef.fightDist), CSPFT_FLOAT }, + {"maxDist", offsetof(WeaponFullDef, weapDef.maxDist), CSPFT_FLOAT }, + {"aiVsAiAccuracyGraph", offsetof(WeaponFullDef, weapDef.accuracyGraphName0), CSPFT_STRING }, + {"aiVsPlayerAccuracyGraph", offsetof(WeaponFullDef, weapDef.accuracyGraphName1), CSPFT_STRING }, + {"locNone", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_NONE]), CSPFT_FLOAT }, + {"locHelmet", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_HELMET]), CSPFT_FLOAT }, + {"locHead", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_HEAD]), CSPFT_FLOAT }, + {"locNeck", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_NECK]), CSPFT_FLOAT }, + {"locTorsoUpper", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_TORSO_UPR]), CSPFT_FLOAT }, + {"locTorsoLower", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_TORSO_LWR]), CSPFT_FLOAT }, + {"locRightArmUpper", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_R_ARM_UPR]), CSPFT_FLOAT }, + {"locRightArmLower", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_R_ARM_LWR]), CSPFT_FLOAT }, + {"locRightHand", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_R_HAND]), CSPFT_FLOAT }, + {"locLeftArmUpper", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_L_ARM_UPR]), CSPFT_FLOAT }, + {"locLeftArmLower", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_L_ARM_LWR]), CSPFT_FLOAT }, + {"locLeftHand", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_L_HAND]), CSPFT_FLOAT }, + {"locRightLegUpper", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_R_LEG_UPR]), CSPFT_FLOAT }, + {"locRightLegLower", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_R_LEG_LWR]), CSPFT_FLOAT }, + {"locRightFoot", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_R_FOOT]), CSPFT_FLOAT }, + {"locLeftLegUpper", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_L_LEG_UPR]), CSPFT_FLOAT }, + {"locLeftLegLower", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_L_LEG_LWR]), CSPFT_FLOAT }, + {"locLeftFoot", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_L_FOOT]), CSPFT_FLOAT }, + {"locGun", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_GUN]), CSPFT_FLOAT }, + {"fireRumble", offsetof(WeaponFullDef, weapDef.fireRumble), CSPFT_STRING }, + {"meleeImpactRumble", offsetof(WeaponFullDef, weapDef.meleeImpactRumble), CSPFT_STRING }, + {"tracerType", offsetof(WeaponFullDef, weapDef.tracerType), CSPFT_TRACER }, + {"adsDofStart", offsetof(WeaponFullDef, weapCompleteDef.adsDofStart), CSPFT_FLOAT }, + {"adsDofEnd", offsetof(WeaponFullDef, weapCompleteDef.adsDofEnd), CSPFT_FLOAT }, + {"turretScopeZoomRate", offsetof(WeaponFullDef, weapDef.turretScopeZoomRate), CSPFT_FLOAT }, + {"turretScopeZoomMin", offsetof(WeaponFullDef, weapDef.turretScopeZoomMin), CSPFT_FLOAT }, + {"turretScopeZoomMax", offsetof(WeaponFullDef, weapDef.turretScopeZoomMax), CSPFT_FLOAT }, + {"thermalScope", offsetof(WeaponFullDef, weapDef.thermalScope), CSPFT_BOOL }, + {"altModeSameWeapon", offsetof(WeaponFullDef, weapDef.altModeSameWeapon), CSPFT_BOOL }, + {"turretOverheatUpRate", offsetof(WeaponFullDef, weapDef.turretOverheatUpRate), CSPFT_FLOAT }, + {"turretOverheatDownRate", offsetof(WeaponFullDef, weapDef.turretOverheatDownRate), CSPFT_FLOAT }, + {"turretOverheatPenalty", offsetof(WeaponFullDef, weapDef.turretOverheatPenalty), CSPFT_FLOAT }, + {"turretOverheatSound", offsetof(WeaponFullDef, weapDef.turretOverheatSound), CSPFT_SOUND }, + {"turretOverheatEffect", offsetof(WeaponFullDef, weapDef.turretOverheatEffect), CSPFT_FX }, + {"turretBarrelSpinEnabled", offsetof(WeaponFullDef, weapDef.turretBarrelSpinEnabled), CSPFT_BOOL }, + {"turretBarrelSpinUpTime", offsetof(WeaponFullDef, weapDef.turretBarrelSpinUpTime), CSPFT_FLOAT }, + {"turretBarrelSpinDownTime", offsetof(WeaponFullDef, weapDef.turretBarrelSpinDownTime), CSPFT_FLOAT }, + {"turretBarrelSpinRumble", offsetof(WeaponFullDef, weapDef.turretBarrelSpinRumble), CSPFT_STRING }, + {"turretBarrelSpinSpeed", offsetof(WeaponFullDef, weapDef.turretBarrelSpinSpeed), CSPFT_FLOAT }, + {"turretBarrelSpinMaxSnd", offsetof(WeaponFullDef, weapDef.turretBarrelSpinMaxSnd), CSPFT_SOUND }, + {"turretBarrelSpinUpSnd1", offsetof(WeaponFullDef, weapDef.turretBarrelSpinUpSnd[0]), CSPFT_SOUND }, + {"turretBarrelSpinUpSnd2", offsetof(WeaponFullDef, weapDef.turretBarrelSpinUpSnd[1]), CSPFT_SOUND }, + {"turretBarrelSpinUpSnd3", offsetof(WeaponFullDef, weapDef.turretBarrelSpinUpSnd[2]), CSPFT_SOUND }, + {"turretBarrelSpinUpSnd4", offsetof(WeaponFullDef, weapDef.turretBarrelSpinUpSnd[3]), CSPFT_SOUND }, + {"turretBarrelSpinDownSnd1", offsetof(WeaponFullDef, weapDef.turretBarrelSpinDownSnd[0]), CSPFT_SOUND }, + {"turretBarrelSpinDownSnd2", offsetof(WeaponFullDef, weapDef.turretBarrelSpinDownSnd[1]), CSPFT_SOUND }, + {"turretBarrelSpinDownSnd3", offsetof(WeaponFullDef, weapDef.turretBarrelSpinDownSnd[2]), CSPFT_SOUND }, + {"turretBarrelSpinDownSnd4", offsetof(WeaponFullDef, weapDef.turretBarrelSpinDownSnd[3]), CSPFT_SOUND }, + {"missileConeSoundEnabled", offsetof(WeaponFullDef, weapDef.missileConeSoundEnabled), CSPFT_BOOL }, + {"missileConeSoundAlias", offsetof(WeaponFullDef, weapDef.missileConeSoundAlias), CSPFT_SOUND }, + {"missileConeSoundAliasAtBase", offsetof(WeaponFullDef, weapDef.missileConeSoundAliasAtBase), CSPFT_SOUND }, + {"missileConeSoundRadiusAtTop", offsetof(WeaponFullDef, weapDef.missileConeSoundRadiusAtTop), CSPFT_FLOAT }, + {"missileConeSoundRadiusAtBase", offsetof(WeaponFullDef, weapDef.missileConeSoundRadiusAtBase), CSPFT_FLOAT }, + {"missileConeSoundHeight", offsetof(WeaponFullDef, weapDef.missileConeSoundHeight), CSPFT_FLOAT }, + {"missileConeSoundOriginOffset", offsetof(WeaponFullDef, weapDef.missileConeSoundOriginOffset), CSPFT_FLOAT }, + {"missileConeSoundVolumescaleAtCore", offsetof(WeaponFullDef, weapDef.missileConeSoundVolumescaleAtCore), CSPFT_FLOAT }, + {"missileConeSoundVolumescaleAtEdge", offsetof(WeaponFullDef, weapDef.missileConeSoundVolumescaleAtEdge), CSPFT_FLOAT }, + {"missileConeSoundVolumescaleCoreSize", offsetof(WeaponFullDef, weapDef.missileConeSoundVolumescaleCoreSize), CSPFT_FLOAT }, + {"missileConeSoundPitchshiftEnabled", offsetof(WeaponFullDef, weapDef.missileConeSoundPitchshiftEnabled), CSPFT_BOOL }, + {"missileConeSoundPitchAtTop", offsetof(WeaponFullDef, weapDef.missileConeSoundPitchAtTop), CSPFT_FLOAT }, + {"missileConeSoundPitchAtBottom", offsetof(WeaponFullDef, weapDef.missileConeSoundPitchAtBottom), CSPFT_FLOAT }, + {"missileConeSoundPitchTopSize", offsetof(WeaponFullDef, weapDef.missileConeSoundPitchTopSize), CSPFT_FLOAT }, + {"missileConeSoundPitchBottomSize", offsetof(WeaponFullDef, weapDef.missileConeSoundPitchBottomSize), CSPFT_FLOAT }, + {"missileConeSoundCrossfadeEnabled", offsetof(WeaponFullDef, weapDef.missileConeSoundCrossfadeEnabled), CSPFT_BOOL }, + {"missileConeSoundCrossfadeTopSize", offsetof(WeaponFullDef, weapDef.missileConeSoundCrossfadeTopSize), CSPFT_FLOAT }, + {"missileConeSoundCrossfadeBottomSize", offsetof(WeaponFullDef, weapDef.missileConeSoundCrossfadeBottomSize), CSPFT_FLOAT }, }; } diff --git a/src/ObjCommon/Game/IW4/MaterialConstantsIW4.h b/src/ObjCommon/Game/IW4/MaterialConstantsIW4.h index 3f198b2c5..9923faffa 100644 --- a/src/ObjCommon/Game/IW4/MaterialConstantsIW4.h +++ b/src/ObjCommon/Game/IW4/MaterialConstantsIW4.h @@ -4,112 +4,81 @@ namespace IW4 { - inline infoParm_t infoParms[] - { - {"bark", 0x0, 0x100000, 0x0, 0x0}, - {"brick", 0x0, 0x200000, 0x0, 0x0}, - {"carpet", 0x0, 0x300000, 0x0, 0x0}, - {"cloth", 0x0, 0x400000, 0x0, 0x0}, - {"concrete", 0x0, 0x500000, 0x0, 0x0}, - {"dirt", 0x0, 0x600000, 0x0, 0x0}, - {"flesh", 0x0, 0x700000, 0x0, 0x0}, - {"foliage", 0x1, 0x800000, 0x2, 0x0}, - {"glass", 0x1, 0x900000, 0x10, 0x0}, - {"grass", 0x0, 0xa00000, 0x0, 0x0}, - {"gravel", 0x0, 0xb00000, 0x0, 0x0}, - {"ice", 0x0, 0xc00000, 0x0, 0x0}, - {"metal", 0x0, 0xd00000, 0x0, 0x0}, - {"mud", 0x0, 0xe00000, 0x0, 0x0}, - {"paper", 0x0, 0xf00000, 0x0, 0x0}, - {"plaster", 0x0, 0x1000000, 0x0, 0x0}, - {"rock", 0x0, 0x1100000, 0x0, 0x0}, - {"sand", 0x0, 0x1200000, 0x0, 0x0}, - {"snow", 0x0, 0x1300000, 0x0, 0x0}, - {"water", 0x1, 0x1400000, 0x20, 0x0}, - {"wood", 0x0, 0x1500000, 0x0, 0x0}, - {"asphalt", 0x0, 0x1600000, 0x0, 0x0}, - {"ceramic", 0x0, 0x1700000, 0x0, 0x0}, - {"plastic", 0x0, 0x1800000, 0x0, 0x0}, - {"rubber", 0x0, 0x1900000, 0x0, 0x0}, - {"cushion", 0x0, 0x1a00000, 0x0, 0x0}, - {"fruit", 0x0, 0x1b00000, 0x0, 0x0}, - {"paintedmetal", 0x0, 0x1c00000, 0x0, 0x0}, - {"riotshield", 0x0, 0x1d00000, 0x0, 0x0}, - {"slush", 0x0, 0x1e00000, 0x0, 0x0}, - {"opaqueglass", 0x0, 0x900000, 0x0, 0x0}, - {"clipmissile", 0x1, 0x0, 0x80, 0x0}, - {"ai_nosight", 0x1, 0x0, 0x1000, 0x0}, - {"clipshot", 0x1, 0x0, 0x2000, 0x0}, - {"playerclip", 0x1, 0x0, 0x10000, 0x0}, - {"monsterclip", 0x1, 0x0, 0x20000, 0x0}, - {"aiclipallowdeath", 0x1, 0x0, 0x4, 0x0}, - {"vehicleclip", 0x1, 0x0, 0x200, 0x0}, - {"itemclip", 0x1, 0x0, 0x400, 0x0}, - {"nodrop", 0x1, 0x0, 0x80000000, 0x0}, - {"nonsolid", 0x1, 0x4000, 0x0, 0x0}, - {"detail", 0x0, 0x0, 0x8000000, 0x0}, - {"structural", 0x0, 0x0, 0x10000000, 0x0}, - {"portal", 0x1, 0x80000000, 0x0, 0x0}, - {"canshootclip", 0x0, 0x0, 0x40, 0x0}, - {"origin", 0x1, 0x0, 0x0, 0x4}, - {"sky", 0x0, 0x4, 0x800, 0x0}, - {"nocastshadow", 0x0, 0x40000, 0x0, 0x0}, - {"physicsGeom", 0x0, 0x0, 0x0, 0x400}, - {"lightPortal", 0x0, 0x0, 0x0, 0x2000}, - {"outdoorBounds", 0x0, 0x0, 0x0, 0x8000}, - {"slick", 0x0, 0x2, 0x0, 0x0}, - {"noimpact", 0x0, 0x10, 0x0, 0x0}, - {"nomarks", 0x0, 0x20, 0x0, 0x0}, - {"nopenetrate", 0x0, 0x100, 0x0, 0x0}, - {"ladder", 0x0, 0x8, 0x0, 0x0}, - {"nodamage", 0x0, 0x1, 0x0, 0x0}, - {"mantleOn", 0x0, 0x2000000, 0x1000000, 0x0}, - {"mantleOver", 0x0, 0x4000000, 0x1000000, 0x0}, - {"stairs", 0x0, 0x200, 0x0, 0x0}, - {"soft", 0x0, 0x1000, 0x0, 0x0}, - {"nosteps", 0x0, 0x2000, 0x0, 0x0}, - {"nodraw", 0x0, 0x80, 0x0, 0x0}, - {"nolightmap", 0x0, 0x400, 0x0, 0x0}, - {"nodlight", 0x0, 0x20000, 0x0, 0x0} - }; - - inline const char* surfaceTypeNames[] - { - "default", - "bark", - "brick", - "carpet", - "cloth", - "concrete", - "dirt", - "flesh", - "foliage", - "glass", - "grass", - "gravel", - "ice", - "metal", - "mud", - "paper", - "plaster", - "rock", - "sand", - "snow", - "water", - "wood", - "asphalt", - "ceramic", - "plastic", - "rubber", - "cushion", - "fruit", - "paintedmetal", - "riotshield", - "slush" + inline infoParm_t infoParms[]{ + {"bark", 0x0, 0x100000, 0x0, 0x0 }, + {"brick", 0x0, 0x200000, 0x0, 0x0 }, + {"carpet", 0x0, 0x300000, 0x0, 0x0 }, + {"cloth", 0x0, 0x400000, 0x0, 0x0 }, + {"concrete", 0x0, 0x500000, 0x0, 0x0 }, + {"dirt", 0x0, 0x600000, 0x0, 0x0 }, + {"flesh", 0x0, 0x700000, 0x0, 0x0 }, + {"foliage", 0x1, 0x800000, 0x2, 0x0 }, + {"glass", 0x1, 0x900000, 0x10, 0x0 }, + {"grass", 0x0, 0xa00000, 0x0, 0x0 }, + {"gravel", 0x0, 0xb00000, 0x0, 0x0 }, + {"ice", 0x0, 0xc00000, 0x0, 0x0 }, + {"metal", 0x0, 0xd00000, 0x0, 0x0 }, + {"mud", 0x0, 0xe00000, 0x0, 0x0 }, + {"paper", 0x0, 0xf00000, 0x0, 0x0 }, + {"plaster", 0x0, 0x1000000, 0x0, 0x0 }, + {"rock", 0x0, 0x1100000, 0x0, 0x0 }, + {"sand", 0x0, 0x1200000, 0x0, 0x0 }, + {"snow", 0x0, 0x1300000, 0x0, 0x0 }, + {"water", 0x1, 0x1400000, 0x20, 0x0 }, + {"wood", 0x0, 0x1500000, 0x0, 0x0 }, + {"asphalt", 0x0, 0x1600000, 0x0, 0x0 }, + {"ceramic", 0x0, 0x1700000, 0x0, 0x0 }, + {"plastic", 0x0, 0x1800000, 0x0, 0x0 }, + {"rubber", 0x0, 0x1900000, 0x0, 0x0 }, + {"cushion", 0x0, 0x1a00000, 0x0, 0x0 }, + {"fruit", 0x0, 0x1b00000, 0x0, 0x0 }, + {"paintedmetal", 0x0, 0x1c00000, 0x0, 0x0 }, + {"riotshield", 0x0, 0x1d00000, 0x0, 0x0 }, + {"slush", 0x0, 0x1e00000, 0x0, 0x0 }, + {"opaqueglass", 0x0, 0x900000, 0x0, 0x0 }, + {"clipmissile", 0x1, 0x0, 0x80, 0x0 }, + {"ai_nosight", 0x1, 0x0, 0x1000, 0x0 }, + {"clipshot", 0x1, 0x0, 0x2000, 0x0 }, + {"playerclip", 0x1, 0x0, 0x10000, 0x0 }, + {"monsterclip", 0x1, 0x0, 0x20000, 0x0 }, + {"aiclipallowdeath", 0x1, 0x0, 0x4, 0x0 }, + {"vehicleclip", 0x1, 0x0, 0x200, 0x0 }, + {"itemclip", 0x1, 0x0, 0x400, 0x0 }, + {"nodrop", 0x1, 0x0, 0x80000000, 0x0 }, + {"nonsolid", 0x1, 0x4000, 0x0, 0x0 }, + {"detail", 0x0, 0x0, 0x8000000, 0x0 }, + {"structural", 0x0, 0x0, 0x10000000, 0x0 }, + {"portal", 0x1, 0x80000000, 0x0, 0x0 }, + {"canshootclip", 0x0, 0x0, 0x40, 0x0 }, + {"origin", 0x1, 0x0, 0x0, 0x4 }, + {"sky", 0x0, 0x4, 0x800, 0x0 }, + {"nocastshadow", 0x0, 0x40000, 0x0, 0x0 }, + {"physicsGeom", 0x0, 0x0, 0x0, 0x400 }, + {"lightPortal", 0x0, 0x0, 0x0, 0x2000}, + {"outdoorBounds", 0x0, 0x0, 0x0, 0x8000}, + {"slick", 0x0, 0x2, 0x0, 0x0 }, + {"noimpact", 0x0, 0x10, 0x0, 0x0 }, + {"nomarks", 0x0, 0x20, 0x0, 0x0 }, + {"nopenetrate", 0x0, 0x100, 0x0, 0x0 }, + {"ladder", 0x0, 0x8, 0x0, 0x0 }, + {"nodamage", 0x0, 0x1, 0x0, 0x0 }, + {"mantleOn", 0x0, 0x2000000, 0x1000000, 0x0 }, + {"mantleOver", 0x0, 0x4000000, 0x1000000, 0x0 }, + {"stairs", 0x0, 0x200, 0x0, 0x0 }, + {"soft", 0x0, 0x1000, 0x0, 0x0 }, + {"nosteps", 0x0, 0x2000, 0x0, 0x0 }, + {"nodraw", 0x0, 0x80, 0x0, 0x0 }, + {"nolightmap", 0x0, 0x400, 0x0, 0x0 }, + {"nodlight", 0x0, 0x20000, 0x0, 0x0 }, + }; + + inline const char* surfaceTypeNames[]{ + "default", "bark", "brick", "carpet", "cloth", "concrete", "dirt", "flesh", "foliage", "glass", "grass", + "gravel", "ice", "metal", "mud", "paper", "plaster", "rock", "sand", "snow", "water", "wood", + "asphalt", "ceramic", "plastic", "rubber", "cushion", "fruit", "paintedmetal", "riotshield", "slush", }; static_assert(std::extent_v == SURF_TYPE_NUM); - enum class BlendFunc_e { UNKNOWN, @@ -131,15 +100,14 @@ namespace IW4 constexpr auto GDT_BLEND_FUNC_MULTIPLY = "Multiply"; constexpr auto GDT_BLEND_FUNC_SCREEN_ADD = "Screen Add"; - inline const char* GdtBlendFuncNames[] - { + inline const char* GdtBlendFuncNames[]{ GDT_BLEND_FUNC_UNKNOWN, GDT_BLEND_FUNC_CUSTOM, GDT_BLEND_FUNC_REPLACE, GDT_BLEND_FUNC_BLEND, GDT_BLEND_FUNC_ADD, GDT_BLEND_FUNC_MULTIPLY, - GDT_BLEND_FUNC_SCREEN_ADD + GDT_BLEND_FUNC_SCREEN_ADD, }; static_assert(std::extent_v == static_cast(BlendFunc_e::COUNT)); @@ -164,15 +132,14 @@ namespace IW4 constexpr auto GDT_BLEND_OP_MIN = "Min"; constexpr auto GDT_BLEND_OP_MAX = "Max"; - inline const char* GdtBlendOpNames[] - { + inline const char* GdtBlendOpNames[]{ GDT_BLEND_OP_UNKNOWN, GDT_BLEND_OP_DISABLE, GDT_BLEND_OP_ADD, GDT_BLEND_OP_SUBTRACT, GDT_BLEND_OP_REV_SUBTRACT, GDT_BLEND_OP_MIN, - GDT_BLEND_OP_MAX + GDT_BLEND_OP_MAX, }; static_assert(std::extent_v == static_cast(BlendOp_e::COUNT)); @@ -194,8 +161,7 @@ namespace IW4 COUNT }; - inline const char* GdtCustomBlendFuncNames[] - { + inline const char* GdtCustomBlendFuncNames[]{ "", "Disable", "Zero", @@ -207,7 +173,7 @@ namespace IW4 "DestAlpha", "InvDestAlpha", "DestColor", - "InvDestColor" + "InvDestColor", }; static_assert(std::extent_v == static_cast(CustomBlendFunc_e::COUNT)); @@ -228,13 +194,12 @@ namespace IW4 constexpr auto GDT_ALPHA_TEST_LT128 = "LT128"; constexpr auto GDT_ALPHA_TEST_GE128 = "GE128"; - inline const char* GdtAlphaTestNames[] - { + inline const char* GdtAlphaTestNames[]{ GDT_ALPHA_TEST_UNKNOWN, GDT_ALPHA_TEST_ALWAYS, GDT_ALPHA_TEST_GT0, GDT_ALPHA_TEST_LT128, - GDT_ALPHA_TEST_GE128 + GDT_ALPHA_TEST_GE128, }; static_assert(std::extent_v == static_cast(AlphaTest_e::COUNT)); @@ -250,14 +215,13 @@ namespace IW4 COUNT }; - inline const char* GdtDepthTestNames[] - { + inline const char* GdtDepthTestNames[]{ "", "LessEqual*", "Less", "Equal", "Always", - "Disable" + "Disable", }; static_assert(std::extent_v == static_cast(DepthTest_e::COUNT)); @@ -270,19 +234,17 @@ namespace IW4 COUNT }; - inline const char* GdtStateBitsEnabledStatusNames[] - { + inline const char* GdtStateBitsEnabledStatusNames[]{ "", "Enable", - "Disable" + "Disable", }; static_assert(std::extent_v == static_cast(StateBitsEnabledStatus_e::COUNT)); - inline const char* GdtStateBitsOnOffStatusNames[] - { + inline const char* GdtStateBitsOnOffStatusNames[]{ "", "On", - "Off" + "Off", }; static_assert(std::extent_v == static_cast(StateBitsEnabledStatus_e::COUNT)); @@ -296,12 +258,11 @@ namespace IW4 COUNT }; - inline const char* GdtCullFaceNames[] - { + inline const char* GdtCullFaceNames[]{ "", "None", "Back*", - "Front" + "Front", }; static_assert(std::extent_v == static_cast(CullFace_e::COUNT)); @@ -316,13 +277,12 @@ namespace IW4 COUNT }; - inline const char* GdtPolygonOffsetNames[] - { + inline const char* GdtPolygonOffsetNames[]{ "", "0", "1", "2", - "shadowMap" + "shadowMap", }; static_assert(std::extent_v == static_cast(PolygonOffset_e::COUNT)); @@ -342,12 +302,11 @@ namespace IW4 COUNT }; - inline const char* GdtStencilModeNames[] - { + inline const char* GdtStencilModeNames[]{ "", "Disable", "One-sided", - "Two-sided" + "Two-sided", }; static_assert(std::extent_v == static_cast(StencilMode_e::COUNT)); @@ -366,8 +325,7 @@ namespace IW4 COUNT }; - inline const char* GdtStencilFuncNames[] - { + inline const char* GdtStencilFuncNames[]{ "", "Never", "Less", @@ -376,7 +334,7 @@ namespace IW4 "Greater", "NotEqual", "GreaterEqual", - "Always" + "Always", }; static_assert(std::extent_v == static_cast(StencilFunc_e::COUNT)); @@ -395,8 +353,7 @@ namespace IW4 COUNT }; - inline const char* GdtStencilOpNames[] - { + inline const char* GdtStencilOpNames[]{ "", "Keep", "Zero", @@ -405,7 +362,7 @@ namespace IW4 "DecrSat", "Invert", "Incr", - "Decr" + "Decr", }; static_assert(std::extent_v == static_cast(StencilOp_e::COUNT)); @@ -420,13 +377,12 @@ namespace IW4 COUNT }; - inline const char* GdtTileModeNames[] - { + inline const char* GdtTileModeNames[]{ "", "tile both*", "tile horizontal", "tile vertical", - "no tile" + "no tile", }; static_assert(std::extent_v == static_cast(TileMode_e::COUNT)); @@ -443,15 +399,14 @@ namespace IW4 COUNT }; - static const char* GdtSamplerFilterNames[] - { + static const char* GdtSamplerFilterNames[]{ "", "mip standard (2x bilinear)*", "mip expensive (4x bilinear)", "mip more expensive (2x trilinear)", "mip most expensive (4x trilinear)", "nomip nearest", - "nomip bilinear" + "nomip bilinear", }; static_assert(std::extent_v == static_cast(GdtFilter_e::COUNT)); @@ -496,8 +451,7 @@ namespace IW4 constexpr auto GDT_MATERIAL_TYPE_WORLD_PHONG = "world phong"; constexpr auto GDT_MATERIAL_TYPE_WORLD_UNLIT = "world unlit"; - inline const char* GdtMaterialTypeNames[] - { + inline const char* GdtMaterialTypeNames[]{ GDT_MATERIAL_TYPE_UNKNOWN, GDT_MATERIAL_TYPE_2D, GDT_MATERIAL_TYPE_CUSTOM, @@ -514,7 +468,7 @@ namespace IW4 GDT_MATERIAL_TYPE_UNLIT, GDT_MATERIAL_TYPE_WATER, GDT_MATERIAL_TYPE_WORLD_PHONG, - GDT_MATERIAL_TYPE_WORLD_UNLIT + GDT_MATERIAL_TYPE_WORLD_UNLIT, }; static_assert(std::extent_v == static_cast(MATERIAL_TYPE_COUNT)); @@ -541,62 +495,61 @@ namespace IW4 constexpr auto GDT_SORTKEY_AFTER_EFFECT_TOP = "after effects - top"; constexpr auto GDT_SORTKEY_VIEWMODEL_EFFECT = "viewmodel effect"; - inline const char* SortKeyNames[] - { - GDT_SORTKEY_OPAQUE_AMBIENT, // 0 - GDT_SORTKEY_OPAQUE, // 1 - GDT_SORTKEY_SKY, // 2 - GDT_SORTKEY_SKYBOX, // 3 - nullptr, // ? 4 - nullptr, // ? 5 - GDT_SORTKEY_DECAL_BOTTOM_1, // 6 - GDT_SORTKEY_DECAL_BOTTOM_2, // 7 - GDT_SORTKEY_DECAL_BOTTOM_3, // 8 - GDT_SORTKEY_DECAL_STATIC, // 9 - GDT_SORTKEY_DECAL_MIDDLE_1, // 10 - GDT_SORTKEY_DECAL_MIDDLE_2, // 11 - GDT_SORTKEY_DECAL_MIDDLE_3, // 12 + inline const char* SortKeyNames[]{ + GDT_SORTKEY_OPAQUE_AMBIENT, // 0 + GDT_SORTKEY_OPAQUE, // 1 + GDT_SORTKEY_SKY, // 2 + GDT_SORTKEY_SKYBOX, // 3 + nullptr, // ? 4 + nullptr, // ? 5 + GDT_SORTKEY_DECAL_BOTTOM_1, // 6 + GDT_SORTKEY_DECAL_BOTTOM_2, // 7 + GDT_SORTKEY_DECAL_BOTTOM_3, // 8 + GDT_SORTKEY_DECAL_STATIC, // 9 + GDT_SORTKEY_DECAL_MIDDLE_1, // 10 + GDT_SORTKEY_DECAL_MIDDLE_2, // 11 + GDT_SORTKEY_DECAL_MIDDLE_3, // 12 GDT_SORTKEY_DECAL_WEAPON_IMPACT, // 13 - nullptr, // ? 14 - nullptr, // ? 15 - nullptr, // ? 16 - nullptr, // ? 17 - nullptr, // ? 18 - nullptr, // ? 19 - nullptr, // ? 20 - nullptr, // ? 21 - nullptr, // - 22 - nullptr, // - 23 - GDT_SORTKEY_WINDOW_INSIDE, // 24 - GDT_SORTKEY_WINDOW_OUTSIDE, // 25 - nullptr, // ? 26 - nullptr, // ? 27 - nullptr, // ? 28 - nullptr, // ? 29 - nullptr, // ? 30 - nullptr, // ? 31 - nullptr, // ? 32 - nullptr, // ? 33 - nullptr, // ? 34 - nullptr, // ? 35 - nullptr, // ? 36 - nullptr, // ? 37 - nullptr, // ? 38 - nullptr, // ? 39 - nullptr, // ? 40 - nullptr, // ? 41 - nullptr, // ? 42 - GDT_SORTKEY_DISTORTION, // 43 - nullptr, // ? 44 - nullptr, // ? 45 - nullptr, // - 46 - GDT_SORTKEY_BLEND_ADDITIVE, // 47 - GDT_SORTKEY_EFFECT_AUTO_SORT, // 48 + nullptr, // ? 14 + nullptr, // ? 15 + nullptr, // ? 16 + nullptr, // ? 17 + nullptr, // ? 18 + nullptr, // ? 19 + nullptr, // ? 20 + nullptr, // ? 21 + nullptr, // - 22 + nullptr, // - 23 + GDT_SORTKEY_WINDOW_INSIDE, // 24 + GDT_SORTKEY_WINDOW_OUTSIDE, // 25 + nullptr, // ? 26 + nullptr, // ? 27 + nullptr, // ? 28 + nullptr, // ? 29 + nullptr, // ? 30 + nullptr, // ? 31 + nullptr, // ? 32 + nullptr, // ? 33 + nullptr, // ? 34 + nullptr, // ? 35 + nullptr, // ? 36 + nullptr, // ? 37 + nullptr, // ? 38 + nullptr, // ? 39 + nullptr, // ? 40 + nullptr, // ? 41 + nullptr, // ? 42 + GDT_SORTKEY_DISTORTION, // 43 + nullptr, // ? 44 + nullptr, // ? 45 + nullptr, // - 46 + GDT_SORTKEY_BLEND_ADDITIVE, // 47 + GDT_SORTKEY_EFFECT_AUTO_SORT, // 48 GDT_SORTKEY_AFTER_EFFECT_BOTTOM, // 49 GDT_SORTKEY_AFTER_EFFECT_MIDDLE, // 50 - GDT_SORTKEY_AFTER_EFFECT_TOP, // 51 - nullptr, // - 52 - GDT_SORTKEY_VIEWMODEL_EFFECT, // 53 + GDT_SORTKEY_AFTER_EFFECT_TOP, // 51 + nullptr, // - 52 + GDT_SORTKEY_VIEWMODEL_EFFECT, // 53 }; static_assert(std::extent_v == static_cast(SORTKEY_MAX)); @@ -628,8 +581,7 @@ namespace IW4 constexpr auto GDT_CUSTOM_MATERIAL_TYPE_SHADOWOVERLAY = "mtl_shadowoverlay"; constexpr auto GDT_CUSTOM_MATERIAL_TYPE_SPLATTER = "mtl_splatter"; - inline const char* GdtCustomMaterialTypeNames[] - { + inline const char* GdtCustomMaterialTypeNames[]{ GDT_CUSTOM_MATERIAL_TYPE_NONE, GDT_CUSTOM_MATERIAL_TYPE_CUSTOM, GDT_CUSTOM_MATERIAL_TYPE_PHONG_FLAG, @@ -638,7 +590,7 @@ namespace IW4 GDT_CUSTOM_MATERIAL_TYPE_REFLEXSIGHT, GDT_CUSTOM_MATERIAL_TYPE_SHADOWCLEAR, GDT_CUSTOM_MATERIAL_TYPE_SHADOWOVERLAY, - GDT_CUSTOM_MATERIAL_TYPE_SPLATTER + GDT_CUSTOM_MATERIAL_TYPE_SPLATTER, }; static_assert(std::extent_v == static_cast(CUSTOM_MATERIAL_TYPE_COUNT)); -} +} // namespace IW4 diff --git a/src/ObjCommon/Game/IW4/MenuConstantsIW4.h b/src/ObjCommon/Game/IW4/MenuConstantsIW4.h index 744fbf08a..7e1eb8b44 100644 --- a/src/ObjCommon/Game/IW4/MenuConstantsIW4.h +++ b/src/ObjCommon/Game/IW4/MenuConstantsIW4.h @@ -4,8 +4,7 @@ namespace IW4 { - inline const char* g_expFunctionNames[] - { + inline const char* g_expFunctionNames[]{ "NOOP", ")", "*", @@ -194,26 +193,25 @@ namespace IW4 "coopready", }; - inline const ItemExpressionTargetBinding floatExpressionTargetBindings[ITEM_FLOATEXP_TGT_COUNT] - { - {ITEM_FLOATEXP_TGT_RECT_X, "rect", "x"}, - {ITEM_FLOATEXP_TGT_RECT_Y, "rect", "y"}, - {ITEM_FLOATEXP_TGT_RECT_W, "rect", "w"}, - {ITEM_FLOATEXP_TGT_RECT_H, "rect", "h"}, - {ITEM_FLOATEXP_TGT_FORECOLOR_R, "forecolor", "r"}, - {ITEM_FLOATEXP_TGT_FORECOLOR_G, "forecolor", "g"}, - {ITEM_FLOATEXP_TGT_FORECOLOR_B, "forecolor", "b"}, + inline const ItemExpressionTargetBinding floatExpressionTargetBindings[ITEM_FLOATEXP_TGT_COUNT]{ + {ITEM_FLOATEXP_TGT_RECT_X, "rect", "x" }, + {ITEM_FLOATEXP_TGT_RECT_Y, "rect", "y" }, + {ITEM_FLOATEXP_TGT_RECT_W, "rect", "w" }, + {ITEM_FLOATEXP_TGT_RECT_H, "rect", "h" }, + {ITEM_FLOATEXP_TGT_FORECOLOR_R, "forecolor", "r" }, + {ITEM_FLOATEXP_TGT_FORECOLOR_G, "forecolor", "g" }, + {ITEM_FLOATEXP_TGT_FORECOLOR_B, "forecolor", "b" }, {ITEM_FLOATEXP_TGT_FORECOLOR_RGB, "forecolor", "rgb"}, - {ITEM_FLOATEXP_TGT_FORECOLOR_A, "forecolor", "a"}, - {ITEM_FLOATEXP_TGT_GLOWCOLOR_R, "glowcolor", "r"}, - {ITEM_FLOATEXP_TGT_GLOWCOLOR_G, "glowcolor", "g"}, - {ITEM_FLOATEXP_TGT_GLOWCOLOR_B, "glowcolor", "b"}, + {ITEM_FLOATEXP_TGT_FORECOLOR_A, "forecolor", "a" }, + {ITEM_FLOATEXP_TGT_GLOWCOLOR_R, "glowcolor", "r" }, + {ITEM_FLOATEXP_TGT_GLOWCOLOR_G, "glowcolor", "g" }, + {ITEM_FLOATEXP_TGT_GLOWCOLOR_B, "glowcolor", "b" }, {ITEM_FLOATEXP_TGT_GLOWCOLOR_RGB, "glowcolor", "rgb"}, - {ITEM_FLOATEXP_TGT_GLOWCOLOR_A, "glowcolor", "a"}, - {ITEM_FLOATEXP_TGT_BACKCOLOR_R, "backcolor", "r"}, - {ITEM_FLOATEXP_TGT_BACKCOLOR_G, "backcolor", "g"}, - {ITEM_FLOATEXP_TGT_BACKCOLOR_B, "backcolor", "b"}, + {ITEM_FLOATEXP_TGT_GLOWCOLOR_A, "glowcolor", "a" }, + {ITEM_FLOATEXP_TGT_BACKCOLOR_R, "backcolor", "r" }, + {ITEM_FLOATEXP_TGT_BACKCOLOR_G, "backcolor", "g" }, + {ITEM_FLOATEXP_TGT_BACKCOLOR_B, "backcolor", "b" }, {ITEM_FLOATEXP_TGT_BACKCOLOR_RGB, "backcolor", "rgb"}, - {ITEM_FLOATEXP_TGT_BACKCOLOR_A, "backcolor", "a"}, + {ITEM_FLOATEXP_TGT_BACKCOLOR_A, "backcolor", "a" }, }; -} \ No newline at end of file +} // namespace IW4 diff --git a/src/ObjCommon/Game/IW4/ObjConstantsIW4.h b/src/ObjCommon/Game/IW4/ObjConstantsIW4.h index 3f43d9d09..5819d7d06 100644 --- a/src/ObjCommon/Game/IW4/ObjConstantsIW4.h +++ b/src/ObjCommon/Game/IW4/ObjConstantsIW4.h @@ -18,4 +18,4 @@ namespace IW4 static constexpr const char* GDF_FILENAME_VEHICLE = "vehicle.gdf"; static constexpr const char* GDF_FILENAME_WEAPON = "weapon.gdf"; }; -} \ No newline at end of file +} // namespace IW4 diff --git a/src/ObjCommon/Game/IW4/TechsetConstantsIW4.h b/src/ObjCommon/Game/IW4/TechsetConstantsIW4.h index fa40a1cf6..e2b55319e 100644 --- a/src/ObjCommon/Game/IW4/TechsetConstantsIW4.h +++ b/src/ObjCommon/Game/IW4/TechsetConstantsIW4.h @@ -1,16 +1,15 @@ #pragma once -#include -#include - #include "Game/IW4/CommonIW4.h" #include "Game/IW4/IW4.h" #include "StateMap/StateMapLayout.h" +#include +#include + namespace IW4 { - inline const char* techniqueTypeNames[] - { + inline const char* techniqueTypeNames[]{ "depth prepass", "build floatz", "build shadowmap depth", @@ -62,8 +61,7 @@ namespace IW4 }; static_assert(std::extent_v == TECHNIQUE_COUNT); - static const char* materialStreamDestinationNames[] - { + static const char* materialStreamDestinationNames[]{ "position", "normal", "color[0]", @@ -79,8 +77,7 @@ namespace IW4 "texcoord[7]", }; static_assert(std::extent_v == STREAM_DST_COUNT); - static const char* materialStreamDestinationAbbreviation[] - { + static const char* materialStreamDestinationAbbreviation[]{ "p", "n", "c0", @@ -97,8 +94,7 @@ namespace IW4 }; static_assert(std::extent_v == STREAM_DST_COUNT); - static const char* materialStreamSourceNames[] - { + static const char* materialStreamSourceNames[]{ "position", "color", "texcoord[0]", @@ -107,11 +103,10 @@ namespace IW4 "texcoord[1]", "texcoord[2]", "normalTransform[0]", - "normalTransform[1]" + "normalTransform[1]", }; static_assert(std::extent_v == STREAM_SRC_COUNT); - static const char* materialStreamSourceAbbreviation[] - { + static const char* materialStreamSourceAbbreviation[]{ "p", "c", "t0", @@ -120,25 +115,22 @@ namespace IW4 "t1", "t2", "n0", - "n1" + "n1", }; static_assert(std::extent_v == STREAM_SRC_COUNT); - inline CodeSamplerSource s_lightmapSamplers[] - { + inline CodeSamplerSource s_lightmapSamplers[]{ {"primary", TEXTURE_SRC_CODE_LIGHTMAP_PRIMARY, nullptr, 0, 0}, {"secondary", TEXTURE_SRC_CODE_LIGHTMAP_SECONDARY, nullptr, 0, 0}, - {} + {}, }; - inline CodeSamplerSource s_lightSamplers[] - { + inline CodeSamplerSource s_lightSamplers[]{ {"attenuation", TEXTURE_SRC_CODE_LIGHT_ATTENUATION, nullptr, 0, 0}, - {} + {}, }; - inline CodeSamplerSource s_codeSamplers[] - { + inline CodeSamplerSource s_codeSamplers[]{ {"white", TEXTURE_SRC_CODE_WHITE, nullptr, 0, 0}, {"black", TEXTURE_SRC_CODE_BLACK, nullptr, 0, 0}, {"identityNormalMap", TEXTURE_SRC_CODE_IDENTITY_NORMAL_MAP, nullptr, 0, 0}, @@ -158,11 +150,10 @@ namespace IW4 {"halfParticleColorSampler", TEXTURE_SRC_CODE_HALF_PARTICLES, nullptr, 0, 0}, {"halfParticleDepthSampler", TEXTURE_SRC_CODE_HALF_PARTICLES_Z, nullptr, 0, 0}, {"alternateScene", TEXTURE_SRC_CODE_ALTERNATE_SCENE, nullptr, 0, 0}, - {} + {}, }; - inline CodeSamplerSource s_defaultCodeSamplers[] - { + inline CodeSamplerSource s_defaultCodeSamplers[]{ {"shadowmapSamplerSun", TEXTURE_SRC_CODE_SHADOWMAP_SUN, nullptr, 0, 0}, {"shadowmapSamplerSpot", TEXTURE_SRC_CODE_SHADOWMAP_SPOT, nullptr, 0, 0}, {"feedbackSampler", TEXTURE_SRC_CODE_FEEDBACK, nullptr, 0, 0}, @@ -181,30 +172,27 @@ namespace IW4 {"cinematicASampler", TEXTURE_SRC_CODE_CINEMATIC_A, nullptr, 0, 0}, {"reflectionProbeSampler", TEXTURE_SRC_CODE_REFLECTION_PROBE, nullptr, 0, 0}, {"alternateSceneSampler", TEXTURE_SRC_CODE_ALTERNATE_SCENE, nullptr, 0, 0}, - {} + {}, }; - inline CodeConstantSource s_sunConsts[] - { + inline CodeConstantSource s_sunConsts[]{ {"position", CONST_SRC_CODE_LIGHT_POSITION, nullptr, 0, 0}, {"diffuse", CONST_SRC_CODE_LIGHT_DIFFUSE, nullptr, 0, 0}, {"specular", CONST_SRC_CODE_LIGHT_SPECULAR, nullptr, 0, 0}, {"spotDir", CONST_SRC_CODE_LIGHT_SPOTDIR, nullptr, 0, 0}, {"spotFactors", CONST_SRC_CODE_LIGHT_SPOTFACTORS, nullptr, 0, 0}, {"falloffPlacement", CONST_SRC_CODE_LIGHT_FALLOFF_PLACEMENT, nullptr, 0, 0}, - {} + {}, }; - inline CodeConstantSource s_nearPlaneConsts[] - { + inline CodeConstantSource s_nearPlaneConsts[]{ {"org", CONST_SRC_CODE_NEARPLANE_ORG, nullptr, 0, 0}, {"dx", CONST_SRC_CODE_NEARPLANE_DX, nullptr, 0, 0}, {"dy", CONST_SRC_CODE_NEARPLANE_DY, nullptr, 0, 0}, - {} + {}, }; - inline CodeConstantSource s_codeConsts[] - { + inline CodeConstantSource s_codeConsts[]{ {"nearPlane", CONST_SRC_NONE, s_nearPlaneConsts, 0, 0}, {"light", CONST_SRC_NONE, s_sunConsts, 0, 0}, {"baseLightingCoords", CONST_SRC_CODE_BASE_LIGHTING_COORDS, nullptr, 0, 0}, @@ -320,11 +308,10 @@ namespace IW4 {"inverseWorldViewProjectionMatrix2", CONST_SRC_CODE_INVERSE_WORLD_VIEW_PROJECTION_MATRIX2, nullptr, 0, 0}, {"transposeWorldViewProjectionMatrix2", CONST_SRC_CODE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX2, nullptr, 0, 0}, {"inverseTransposeWorldViewProjectionMatrix2", CONST_SRC_CODE_INVERSE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX2, nullptr, 0, 0}, - {} + {}, }; - inline CodeConstantSource s_defaultCodeConsts[] - { + inline CodeConstantSource s_defaultCodeConsts[]{ {"nearPlaneOrg", CONST_SRC_CODE_NEARPLANE_ORG, nullptr, 0, 0}, {"nearPlaneDx", CONST_SRC_CODE_NEARPLANE_DX, nullptr, 0, 0}, {"nearPlaneDy", CONST_SRC_CODE_NEARPLANE_DY, nullptr, 0, 0}, @@ -336,194 +323,190 @@ namespace IW4 {"lightFalloffPlacement", CONST_SRC_CODE_LIGHT_FALLOFF_PLACEMENT, nullptr, 0, 0}, {"sunShadowmapPixelAdjust", CONST_SRC_CODE_SUN_SHADOWMAP_PIXEL_ADJUST, nullptr, 0, 0}, {"spotShadowmapPixelAdjust", CONST_SRC_CODE_SPOT_SHADOWMAP_PIXEL_ADJUST, nullptr, 0, 0}, - {} + {}, }; - inline MaterialUpdateFrequency s_codeConstUpdateFreq[] - { - MTL_UPDATE_RARELY, // LIGHT_POSITION - MTL_UPDATE_RARELY, // LIGHT_DIFFUSE - MTL_UPDATE_RARELY, // LIGHT_SPECULAR - MTL_UPDATE_RARELY, // LIGHT_SPOTDIR - MTL_UPDATE_RARELY, // LIGHT_SPOTFACTORS - MTL_UPDATE_RARELY, // LIGHT_FALLOFF_PLACEMENT - MTL_UPDATE_RARELY, // PARTICLE_CLOUD_COLOR - MTL_UPDATE_RARELY, // GAMETIME - MTL_UPDATE_RARELY, // PIXEL_COST_FRACS - MTL_UPDATE_RARELY, // PIXEL_COST_DECODE - MTL_UPDATE_RARELY, // FILTER_TAP_0 - MTL_UPDATE_RARELY, // FILTER_TAP_1 - MTL_UPDATE_RARELY, // FILTER_TAP_2 - MTL_UPDATE_RARELY, // FILTER_TAP_3 - MTL_UPDATE_RARELY, // FILTER_TAP_4 - MTL_UPDATE_RARELY, // FILTER_TAP_5 - MTL_UPDATE_RARELY, // FILTER_TAP_6 - MTL_UPDATE_RARELY, // FILTER_TAP_7 - MTL_UPDATE_RARELY, // COLOR_MATRIX_R - MTL_UPDATE_RARELY, // COLOR_MATRIX_G - MTL_UPDATE_RARELY, // COLOR_MATRIX_B - MTL_UPDATE_RARELY, // SHADOWMAP_POLYGON_OFFSET - MTL_UPDATE_RARELY, // RENDER_TARGET_SIZE - MTL_UPDATE_RARELY, // DOF_EQUATION_VIEWMODEL_AND_FAR_BLUR - MTL_UPDATE_RARELY, // DOF_EQUATION_SCENE - MTL_UPDATE_RARELY, // DOF_LERP_SCALE - MTL_UPDATE_RARELY, // DOF_LERP_BIAS - MTL_UPDATE_RARELY, // DOF_ROW_DELTA - MTL_UPDATE_RARELY, // MOTION_MATRIX_X - MTL_UPDATE_RARELY, // MOTION_MATRIX_Y - MTL_UPDATE_RARELY, // MOTION_MATRIX_W - MTL_UPDATE_RARELY, // SHADOWMAP_SWITCH_PARTITION - MTL_UPDATE_RARELY, // SHADOWMAP_SCALE - MTL_UPDATE_RARELY, // ZNEAR - MTL_UPDATE_RARELY, // LIGHTING_LOOKUP_SCALE - MTL_UPDATE_RARELY, // DEBUG_BUMPMAP - MTL_UPDATE_RARELY, // MATERIAL_COLOR - MTL_UPDATE_RARELY, // FOG - MTL_UPDATE_RARELY, // FOG_COLOR_LINEAR - MTL_UPDATE_RARELY, // FOG_COLOR_GAMMA - MTL_UPDATE_RARELY, // FOG_SUN_CONSTS - MTL_UPDATE_RARELY, // FOG_SUN_COLOR_LINEAR - MTL_UPDATE_RARELY, // FOG_SUN_COLOR_GAMMA - MTL_UPDATE_RARELY, // FOG_SUN_DIR - MTL_UPDATE_RARELY, // GLOW_SETUP - MTL_UPDATE_RARELY, // GLOW_APPLY - MTL_UPDATE_RARELY, // COLOR_BIAS - MTL_UPDATE_RARELY, // COLOR_TINT_BASE - MTL_UPDATE_RARELY, // COLOR_TINT_DELTA - MTL_UPDATE_RARELY, // COLOR_TINT_QUADRATIC_DELTA - MTL_UPDATE_RARELY, // OUTDOOR_FEATHER_PARMS - MTL_UPDATE_RARELY, // ENVMAP_PARMS - MTL_UPDATE_RARELY, // SUN_SHADOWMAP_PIXEL_ADJUST - MTL_UPDATE_RARELY, // SPOT_SHADOWMAP_PIXEL_ADJUST - MTL_UPDATE_RARELY, // COMPOSITE_FX_DISTORTION - MTL_UPDATE_RARELY, // POSTFX_FADE_EFFECT - MTL_UPDATE_RARELY, // VIEWPORT_DIMENSIONS - MTL_UPDATE_RARELY, // FRAMEBUFFER_READ - MTL_UPDATE_PER_PRIM, // BASE_LIGHTING_COORDS - MTL_UPDATE_PER_PRIM, // LIGHT_PROBE_AMBIENT - MTL_UPDATE_RARELY, // NEARPLANE_ORG - MTL_UPDATE_RARELY, // NEARPLANE_DX - MTL_UPDATE_RARELY, // NEARPLANE_DY - MTL_UPDATE_RARELY, // CLIP_SPACE_LOOKUP_SCALE - MTL_UPDATE_RARELY, // CLIP_SPACE_LOOKUP_OFFSET - MTL_UPDATE_PER_OBJECT, // PARTICLE_CLOUD_MATRIX0 - MTL_UPDATE_PER_OBJECT, // PARTICLE_CLOUD_MATRIX1 - MTL_UPDATE_PER_OBJECT, // PARTICLE_CLOUD_MATRIX2 - MTL_UPDATE_PER_OBJECT, // PARTICLE_CLOUD_SPARK_COLOR0 - MTL_UPDATE_PER_OBJECT, // PARTICLE_CLOUD_SPARK_COLOR1 - MTL_UPDATE_PER_OBJECT, // PARTICLE_CLOUD_SPARK_COLOR2 - MTL_UPDATE_PER_OBJECT, // PARTICLE_FOUNTAIN_PARM0 - MTL_UPDATE_PER_OBJECT, // PARTICLE_FOUNTAIN_PARM1 - MTL_UPDATE_PER_OBJECT, // DEPTH_FROM_CLIP - MTL_UPDATE_PER_OBJECT, // CODE_MESH_ARG_0 - MTL_UPDATE_PER_OBJECT, // CODE_MESH_ARG_1 - MTL_UPDATE_PER_OBJECT, // VIEW_MATRIX - MTL_UPDATE_PER_OBJECT, // INVERSE_VIEW_MATRIX - MTL_UPDATE_PER_OBJECT, // TRANSPOSE_VIEW_MATRIX - MTL_UPDATE_PER_OBJECT, // INVERSE_TRANSPOSE_VIEW_MATRIX - MTL_UPDATE_PER_OBJECT, // PROJECTION_MATRIX - MTL_UPDATE_PER_OBJECT, // INVERSE_PROJECTION_MATRIX - MTL_UPDATE_PER_OBJECT, // TRANSPOSE_PROJECTION_MATRIX - MTL_UPDATE_PER_OBJECT, // INVERSE_TRANSPOSE_PROJECTION_MATRIX - MTL_UPDATE_PER_OBJECT, // VIEW_PROJECTION_MATRIX - MTL_UPDATE_PER_OBJECT, // INVERSE_VIEW_PROJECTION_MATRIX - MTL_UPDATE_PER_OBJECT, // TRANSPOSE_VIEW_PROJECTION_MATRIX - MTL_UPDATE_PER_OBJECT, // INVERSE_TRANSPOSE_VIEW_PROJECTION_MATRIX - MTL_UPDATE_PER_OBJECT, // SHADOW_LOOKUP_MATRIX - MTL_UPDATE_PER_OBJECT, // INVERSE_SHADOW_LOOKUP_MATRIX - MTL_UPDATE_PER_OBJECT, // TRANSPOSE_SHADOW_LOOKUP_MATRIX - MTL_UPDATE_PER_OBJECT, // INVERSE_TRANSPOSE_SHADOW_LOOKUP_MATRIX - MTL_UPDATE_PER_PRIM, // WORLD_OUTDOOR_LOOKUP_MATRIX - MTL_UPDATE_PER_PRIM, // INVERSE_WORLD_OUTDOOR_LOOKUP_MATRIX - MTL_UPDATE_PER_PRIM, // TRANSPOSE_WORLD_OUTDOOR_LOOKUP_MATRIX - MTL_UPDATE_PER_PRIM, // INVERSE_TRANSPOSE_WORLD_OUTDOOR_LOOKUP_MATRIX - MTL_UPDATE_PER_PRIM, // WORLD_MATRIX0 - MTL_UPDATE_PER_PRIM, // INVERSE_WORLD_MATRIX0 - MTL_UPDATE_PER_PRIM, // TRANSPOSE_WORLD_MATRIX0 - MTL_UPDATE_PER_PRIM, // INVERSE_TRANSPOSE_WORLD_MATRIX0 - MTL_UPDATE_PER_PRIM, // WORLD_VIEW_MATRIX0 - MTL_UPDATE_PER_PRIM, // INVERSE_WORLD_VIEW_MATRIX0 - MTL_UPDATE_PER_PRIM, // TRANSPOSE_WORLD_VIEW_MATRIX0 - MTL_UPDATE_PER_PRIM, // INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX0 - MTL_UPDATE_PER_PRIM, // WORLD_VIEW_PROJECTION_MATRIX0 - MTL_UPDATE_PER_PRIM, // INVERSE_WORLD_VIEW_PROJECTION_MATRIX0 - MTL_UPDATE_PER_PRIM, // TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX0 - MTL_UPDATE_PER_PRIM, // INVERSE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX0 - MTL_UPDATE_PER_PRIM, // WORLD_MATRIX1 - MTL_UPDATE_PER_PRIM, // INVERSE_WORLD_MATRIX1 - MTL_UPDATE_PER_PRIM, // TRANSPOSE_WORLD_MATRIX1 - MTL_UPDATE_PER_PRIM, // INVERSE_TRANSPOSE_WORLD_MATRIX1 - MTL_UPDATE_PER_PRIM, // WORLD_VIEW_MATRIX1 - MTL_UPDATE_PER_PRIM, // INVERSE_WORLD_VIEW_MATRIX1 - MTL_UPDATE_PER_PRIM, // TRANSPOSE_WORLD_VIEW_MATRIX1 - MTL_UPDATE_PER_PRIM, // INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX1 - MTL_UPDATE_PER_PRIM, // WORLD_VIEW_PROJECTION_MATRIX1 - MTL_UPDATE_PER_PRIM, // INVERSE_WORLD_VIEW_PROJECTION_MATRIX1 - MTL_UPDATE_PER_PRIM, // TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX1 - MTL_UPDATE_PER_PRIM, // INVERSE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX1 - MTL_UPDATE_PER_PRIM, // WORLD_MATRIX2 - MTL_UPDATE_PER_PRIM, // INVERSE_WORLD_MATRIX2 - MTL_UPDATE_PER_PRIM, // TRANSPOSE_WORLD_MATRIX2 - MTL_UPDATE_PER_PRIM, // INVERSE_TRANSPOSE_WORLD_MATRIX2 - MTL_UPDATE_PER_PRIM, // WORLD_VIEW_MATRIX2 - MTL_UPDATE_PER_PRIM, // INVERSE_WORLD_VIEW_MATRIX2 - MTL_UPDATE_PER_PRIM, // TRANSPOSE_WORLD_VIEW_MATRIX2 - MTL_UPDATE_PER_PRIM, // INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX2 - MTL_UPDATE_PER_PRIM, // WORLD_VIEW_PROJECTION_MATRIX2 - MTL_UPDATE_PER_PRIM, // INVERSE_WORLD_VIEW_PROJECTION_MATRIX2 - MTL_UPDATE_PER_PRIM, // TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX2 - MTL_UPDATE_PER_PRIM, // INVERSE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX2 + inline MaterialUpdateFrequency s_codeConstUpdateFreq[]{ + MTL_UPDATE_RARELY, // LIGHT_POSITION + MTL_UPDATE_RARELY, // LIGHT_DIFFUSE + MTL_UPDATE_RARELY, // LIGHT_SPECULAR + MTL_UPDATE_RARELY, // LIGHT_SPOTDIR + MTL_UPDATE_RARELY, // LIGHT_SPOTFACTORS + MTL_UPDATE_RARELY, // LIGHT_FALLOFF_PLACEMENT + MTL_UPDATE_RARELY, // PARTICLE_CLOUD_COLOR + MTL_UPDATE_RARELY, // GAMETIME + MTL_UPDATE_RARELY, // PIXEL_COST_FRACS + MTL_UPDATE_RARELY, // PIXEL_COST_DECODE + MTL_UPDATE_RARELY, // FILTER_TAP_0 + MTL_UPDATE_RARELY, // FILTER_TAP_1 + MTL_UPDATE_RARELY, // FILTER_TAP_2 + MTL_UPDATE_RARELY, // FILTER_TAP_3 + MTL_UPDATE_RARELY, // FILTER_TAP_4 + MTL_UPDATE_RARELY, // FILTER_TAP_5 + MTL_UPDATE_RARELY, // FILTER_TAP_6 + MTL_UPDATE_RARELY, // FILTER_TAP_7 + MTL_UPDATE_RARELY, // COLOR_MATRIX_R + MTL_UPDATE_RARELY, // COLOR_MATRIX_G + MTL_UPDATE_RARELY, // COLOR_MATRIX_B + MTL_UPDATE_RARELY, // SHADOWMAP_POLYGON_OFFSET + MTL_UPDATE_RARELY, // RENDER_TARGET_SIZE + MTL_UPDATE_RARELY, // DOF_EQUATION_VIEWMODEL_AND_FAR_BLUR + MTL_UPDATE_RARELY, // DOF_EQUATION_SCENE + MTL_UPDATE_RARELY, // DOF_LERP_SCALE + MTL_UPDATE_RARELY, // DOF_LERP_BIAS + MTL_UPDATE_RARELY, // DOF_ROW_DELTA + MTL_UPDATE_RARELY, // MOTION_MATRIX_X + MTL_UPDATE_RARELY, // MOTION_MATRIX_Y + MTL_UPDATE_RARELY, // MOTION_MATRIX_W + MTL_UPDATE_RARELY, // SHADOWMAP_SWITCH_PARTITION + MTL_UPDATE_RARELY, // SHADOWMAP_SCALE + MTL_UPDATE_RARELY, // ZNEAR + MTL_UPDATE_RARELY, // LIGHTING_LOOKUP_SCALE + MTL_UPDATE_RARELY, // DEBUG_BUMPMAP + MTL_UPDATE_RARELY, // MATERIAL_COLOR + MTL_UPDATE_RARELY, // FOG + MTL_UPDATE_RARELY, // FOG_COLOR_LINEAR + MTL_UPDATE_RARELY, // FOG_COLOR_GAMMA + MTL_UPDATE_RARELY, // FOG_SUN_CONSTS + MTL_UPDATE_RARELY, // FOG_SUN_COLOR_LINEAR + MTL_UPDATE_RARELY, // FOG_SUN_COLOR_GAMMA + MTL_UPDATE_RARELY, // FOG_SUN_DIR + MTL_UPDATE_RARELY, // GLOW_SETUP + MTL_UPDATE_RARELY, // GLOW_APPLY + MTL_UPDATE_RARELY, // COLOR_BIAS + MTL_UPDATE_RARELY, // COLOR_TINT_BASE + MTL_UPDATE_RARELY, // COLOR_TINT_DELTA + MTL_UPDATE_RARELY, // COLOR_TINT_QUADRATIC_DELTA + MTL_UPDATE_RARELY, // OUTDOOR_FEATHER_PARMS + MTL_UPDATE_RARELY, // ENVMAP_PARMS + MTL_UPDATE_RARELY, // SUN_SHADOWMAP_PIXEL_ADJUST + MTL_UPDATE_RARELY, // SPOT_SHADOWMAP_PIXEL_ADJUST + MTL_UPDATE_RARELY, // COMPOSITE_FX_DISTORTION + MTL_UPDATE_RARELY, // POSTFX_FADE_EFFECT + MTL_UPDATE_RARELY, // VIEWPORT_DIMENSIONS + MTL_UPDATE_RARELY, // FRAMEBUFFER_READ + MTL_UPDATE_PER_PRIM, // BASE_LIGHTING_COORDS + MTL_UPDATE_PER_PRIM, // LIGHT_PROBE_AMBIENT + MTL_UPDATE_RARELY, // NEARPLANE_ORG + MTL_UPDATE_RARELY, // NEARPLANE_DX + MTL_UPDATE_RARELY, // NEARPLANE_DY + MTL_UPDATE_RARELY, // CLIP_SPACE_LOOKUP_SCALE + MTL_UPDATE_RARELY, // CLIP_SPACE_LOOKUP_OFFSET + MTL_UPDATE_PER_OBJECT, // PARTICLE_CLOUD_MATRIX0 + MTL_UPDATE_PER_OBJECT, // PARTICLE_CLOUD_MATRIX1 + MTL_UPDATE_PER_OBJECT, // PARTICLE_CLOUD_MATRIX2 + MTL_UPDATE_PER_OBJECT, // PARTICLE_CLOUD_SPARK_COLOR0 + MTL_UPDATE_PER_OBJECT, // PARTICLE_CLOUD_SPARK_COLOR1 + MTL_UPDATE_PER_OBJECT, // PARTICLE_CLOUD_SPARK_COLOR2 + MTL_UPDATE_PER_OBJECT, // PARTICLE_FOUNTAIN_PARM0 + MTL_UPDATE_PER_OBJECT, // PARTICLE_FOUNTAIN_PARM1 + MTL_UPDATE_PER_OBJECT, // DEPTH_FROM_CLIP + MTL_UPDATE_PER_OBJECT, // CODE_MESH_ARG_0 + MTL_UPDATE_PER_OBJECT, // CODE_MESH_ARG_1 + MTL_UPDATE_PER_OBJECT, // VIEW_MATRIX + MTL_UPDATE_PER_OBJECT, // INVERSE_VIEW_MATRIX + MTL_UPDATE_PER_OBJECT, // TRANSPOSE_VIEW_MATRIX + MTL_UPDATE_PER_OBJECT, // INVERSE_TRANSPOSE_VIEW_MATRIX + MTL_UPDATE_PER_OBJECT, // PROJECTION_MATRIX + MTL_UPDATE_PER_OBJECT, // INVERSE_PROJECTION_MATRIX + MTL_UPDATE_PER_OBJECT, // TRANSPOSE_PROJECTION_MATRIX + MTL_UPDATE_PER_OBJECT, // INVERSE_TRANSPOSE_PROJECTION_MATRIX + MTL_UPDATE_PER_OBJECT, // VIEW_PROJECTION_MATRIX + MTL_UPDATE_PER_OBJECT, // INVERSE_VIEW_PROJECTION_MATRIX + MTL_UPDATE_PER_OBJECT, // TRANSPOSE_VIEW_PROJECTION_MATRIX + MTL_UPDATE_PER_OBJECT, // INVERSE_TRANSPOSE_VIEW_PROJECTION_MATRIX + MTL_UPDATE_PER_OBJECT, // SHADOW_LOOKUP_MATRIX + MTL_UPDATE_PER_OBJECT, // INVERSE_SHADOW_LOOKUP_MATRIX + MTL_UPDATE_PER_OBJECT, // TRANSPOSE_SHADOW_LOOKUP_MATRIX + MTL_UPDATE_PER_OBJECT, // INVERSE_TRANSPOSE_SHADOW_LOOKUP_MATRIX + MTL_UPDATE_PER_PRIM, // WORLD_OUTDOOR_LOOKUP_MATRIX + MTL_UPDATE_PER_PRIM, // INVERSE_WORLD_OUTDOOR_LOOKUP_MATRIX + MTL_UPDATE_PER_PRIM, // TRANSPOSE_WORLD_OUTDOOR_LOOKUP_MATRIX + MTL_UPDATE_PER_PRIM, // INVERSE_TRANSPOSE_WORLD_OUTDOOR_LOOKUP_MATRIX + MTL_UPDATE_PER_PRIM, // WORLD_MATRIX0 + MTL_UPDATE_PER_PRIM, // INVERSE_WORLD_MATRIX0 + MTL_UPDATE_PER_PRIM, // TRANSPOSE_WORLD_MATRIX0 + MTL_UPDATE_PER_PRIM, // INVERSE_TRANSPOSE_WORLD_MATRIX0 + MTL_UPDATE_PER_PRIM, // WORLD_VIEW_MATRIX0 + MTL_UPDATE_PER_PRIM, // INVERSE_WORLD_VIEW_MATRIX0 + MTL_UPDATE_PER_PRIM, // TRANSPOSE_WORLD_VIEW_MATRIX0 + MTL_UPDATE_PER_PRIM, // INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX0 + MTL_UPDATE_PER_PRIM, // WORLD_VIEW_PROJECTION_MATRIX0 + MTL_UPDATE_PER_PRIM, // INVERSE_WORLD_VIEW_PROJECTION_MATRIX0 + MTL_UPDATE_PER_PRIM, // TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX0 + MTL_UPDATE_PER_PRIM, // INVERSE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX0 + MTL_UPDATE_PER_PRIM, // WORLD_MATRIX1 + MTL_UPDATE_PER_PRIM, // INVERSE_WORLD_MATRIX1 + MTL_UPDATE_PER_PRIM, // TRANSPOSE_WORLD_MATRIX1 + MTL_UPDATE_PER_PRIM, // INVERSE_TRANSPOSE_WORLD_MATRIX1 + MTL_UPDATE_PER_PRIM, // WORLD_VIEW_MATRIX1 + MTL_UPDATE_PER_PRIM, // INVERSE_WORLD_VIEW_MATRIX1 + MTL_UPDATE_PER_PRIM, // TRANSPOSE_WORLD_VIEW_MATRIX1 + MTL_UPDATE_PER_PRIM, // INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX1 + MTL_UPDATE_PER_PRIM, // WORLD_VIEW_PROJECTION_MATRIX1 + MTL_UPDATE_PER_PRIM, // INVERSE_WORLD_VIEW_PROJECTION_MATRIX1 + MTL_UPDATE_PER_PRIM, // TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX1 + MTL_UPDATE_PER_PRIM, // INVERSE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX1 + MTL_UPDATE_PER_PRIM, // WORLD_MATRIX2 + MTL_UPDATE_PER_PRIM, // INVERSE_WORLD_MATRIX2 + MTL_UPDATE_PER_PRIM, // TRANSPOSE_WORLD_MATRIX2 + MTL_UPDATE_PER_PRIM, // INVERSE_TRANSPOSE_WORLD_MATRIX2 + MTL_UPDATE_PER_PRIM, // WORLD_VIEW_MATRIX2 + MTL_UPDATE_PER_PRIM, // INVERSE_WORLD_VIEW_MATRIX2 + MTL_UPDATE_PER_PRIM, // TRANSPOSE_WORLD_VIEW_MATRIX2 + MTL_UPDATE_PER_PRIM, // INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX2 + MTL_UPDATE_PER_PRIM, // WORLD_VIEW_PROJECTION_MATRIX2 + MTL_UPDATE_PER_PRIM, // INVERSE_WORLD_VIEW_PROJECTION_MATRIX2 + MTL_UPDATE_PER_PRIM, // TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX2 + MTL_UPDATE_PER_PRIM, // INVERSE_TRANSPOSE_WORLD_VIEW_PROJECTION_MATRIX2 }; static_assert(std::extent_v == CONST_SRC_TOTAL_COUNT); - inline MaterialUpdateFrequency s_codeSamplerUpdateFreq[] - { - MTL_UPDATE_RARELY, // BLACK - MTL_UPDATE_RARELY, // WHITE - MTL_UPDATE_RARELY, // IDENTITY_NORMAL_MAP - MTL_UPDATE_RARELY, // MODEL_LIGHTING - MTL_UPDATE_CUSTOM, // LIGHTMAP_PRIMARY - MTL_UPDATE_CUSTOM, // LIGHTMAP_SECONDARY - MTL_UPDATE_RARELY, // SHADOWMAP_SUN - MTL_UPDATE_RARELY, // SHADOWMAP_SPOT - MTL_UPDATE_PER_OBJECT, // FEEDBACK - MTL_UPDATE_RARELY, // RESOLVED_POST_SUN - MTL_UPDATE_RARELY, // RESOLVED_SCENE - MTL_UPDATE_RARELY, // POST_EFFECT_0 - MTL_UPDATE_RARELY, // POST_EFFECT_1 - MTL_UPDATE_PER_OBJECT, // LIGHT_ATTENUATION - MTL_UPDATE_RARELY, // OUTDOOR - MTL_UPDATE_RARELY, // FLOATZ - MTL_UPDATE_RARELY, // PROCESSED_FLOATZ - MTL_UPDATE_RARELY, // RAW_FLOATZ - MTL_UPDATE_RARELY, // HALF_PARTICLES - MTL_UPDATE_RARELY, // HALF_PARTICLES_Z - MTL_UPDATE_PER_OBJECT, // CASE_TEXTURE - MTL_UPDATE_PER_OBJECT, // CINEMATIC_Y - MTL_UPDATE_PER_OBJECT, // CINEMATIC_CR - MTL_UPDATE_PER_OBJECT, // CINEMATIC_CB - MTL_UPDATE_PER_OBJECT, // CINEMATIC_A - MTL_UPDATE_CUSTOM, // REFLECTION_PROBE - MTL_UPDATE_RARELY, // ALTERNATE_SCENE + inline MaterialUpdateFrequency s_codeSamplerUpdateFreq[]{ + MTL_UPDATE_RARELY, // BLACK + MTL_UPDATE_RARELY, // WHITE + MTL_UPDATE_RARELY, // IDENTITY_NORMAL_MAP + MTL_UPDATE_RARELY, // MODEL_LIGHTING + MTL_UPDATE_CUSTOM, // LIGHTMAP_PRIMARY + MTL_UPDATE_CUSTOM, // LIGHTMAP_SECONDARY + MTL_UPDATE_RARELY, // SHADOWMAP_SUN + MTL_UPDATE_RARELY, // SHADOWMAP_SPOT + MTL_UPDATE_PER_OBJECT, // FEEDBACK + MTL_UPDATE_RARELY, // RESOLVED_POST_SUN + MTL_UPDATE_RARELY, // RESOLVED_SCENE + MTL_UPDATE_RARELY, // POST_EFFECT_0 + MTL_UPDATE_RARELY, // POST_EFFECT_1 + MTL_UPDATE_PER_OBJECT, // LIGHT_ATTENUATION + MTL_UPDATE_RARELY, // OUTDOOR + MTL_UPDATE_RARELY, // FLOATZ + MTL_UPDATE_RARELY, // PROCESSED_FLOATZ + MTL_UPDATE_RARELY, // RAW_FLOATZ + MTL_UPDATE_RARELY, // HALF_PARTICLES + MTL_UPDATE_RARELY, // HALF_PARTICLES_Z + MTL_UPDATE_PER_OBJECT, // CASE_TEXTURE + MTL_UPDATE_PER_OBJECT, // CINEMATIC_Y + MTL_UPDATE_PER_OBJECT, // CINEMATIC_CR + MTL_UPDATE_PER_OBJECT, // CINEMATIC_CB + MTL_UPDATE_PER_OBJECT, // CINEMATIC_A + MTL_UPDATE_CUSTOM, // REFLECTION_PROBE + MTL_UPDATE_RARELY, // ALTERNATE_SCENE }; static_assert(std::extent_v == TEXTURE_SRC_CODE_COUNT); - inline MaterialTextureSource g_customSamplerSrc[] - { - TEXTURE_SRC_CODE_REFLECTION_PROBE, // CUSTOM_SAMPLER_REFLECTION_PROBE - TEXTURE_SRC_CODE_LIGHTMAP_PRIMARY, // CUSTOM_SAMPLER_LIGHTMAP_PRIMARY - TEXTURE_SRC_CODE_LIGHTMAP_SECONDARY // CUSTOM_SAMPLER_LIGHTMAP_SECONDARY + inline MaterialTextureSource g_customSamplerSrc[]{ + TEXTURE_SRC_CODE_REFLECTION_PROBE, // CUSTOM_SAMPLER_REFLECTION_PROBE + TEXTURE_SRC_CODE_LIGHTMAP_PRIMARY, // CUSTOM_SAMPLER_LIGHTMAP_PRIMARY + TEXTURE_SRC_CODE_LIGHTMAP_SECONDARY, // CUSTOM_SAMPLER_LIGHTMAP_SECONDARY }; static_assert(std::extent_v == CUSTOM_SAMPLER_COUNT); - inline MaterialTypeInfo g_materialTypeInfo[] - { - {"", ""}, - {"m/", "m_"}, + inline MaterialTypeInfo g_materialTypeInfo[]{ + {"", "" }, + {"m/", "m_" }, {"mc/", "mc_"}, {"mg/", "mg_"}, - {"w/", "w_"}, - {"wc/", "wc_"} + {"w/", "w_" }, + {"wc/", "wc_"}, }; static_assert(std::extent_v == MTL_TYPE_COUNT); @@ -538,8 +521,7 @@ namespace IW4 return std::make_pair(Common::R_HashString(name, 0u), KnownMaterialTextureMap{name, additionalPropertySuffix}); } - inline std::unordered_map knownTextureMaps - { + inline std::unordered_map knownTextureMaps{ MakeKnownTextureMap("colorMap", "Color"), MakeKnownTextureMap("colorMap0", "Color00"), MakeKnownTextureMap("colorMap1", "Color01"), @@ -554,8 +536,7 @@ namespace IW4 return std::make_pair(Common::R_HashString(name, 0u), name); } - inline std::unordered_map knownConstantNames - { + inline std::unordered_map knownConstantNames{ MakeKnownConstantName("distortionScale"), MakeKnownConstantName("eyeOffsetParms"), MakeKnownConstantName("falloffBeginColor"), @@ -577,321 +558,263 @@ namespace IW4 WIREFRAME }; - inline state_map::StateMapLayoutEntries stateMapEntryLayout({ - { - "alphaTest", 0, GFXS0_ATEST_MASK | GFXS0_ATEST_DISABLE, { - "mtlAlphaTest" - } - }, - { - "blendFunc", 0, GFXS0_BLEND_RGB_MASK, { - "mtlBlendOp", - "mtlSrcBlend", - "mtlDestBlend" - } - }, - { - "separateAlphaBlendFunc", 0, GFXS0_BLEND_ALPHA_MASK, { - "mtlBlendOpAlpha", - "mtlSrcBlendAlpha", - "mtlDestBlendAlpha" - } - }, - { - "cullFace", 0, GFXS0_CULL_MASK, { - "mtlCullFace" - } - }, - { - "depthTest", 1, GFXS1_DEPTHTEST_MASK | GFXS1_DEPTHTEST_DISABLE, { - "mtlDepthTest" - } - }, - { - "depthWrite", 1, GFXS1_DEPTHWRITE, { - "mtlDepthWrite" - } - }, - { - "colorWrite", 0, GFXS0_COLORWRITE_MASK, { - "mtlColorWriteRgb", - "mtlColorWriteAlpha" - } - }, - { - "gammaWrite", 0, GFXS0_GAMMAWRITE, { - "mtlGammaWrite", - } - }, - { - "polygonOffset", 1, GFXS1_POLYGON_OFFSET_MASK, { - "mtlPolygonOffset", - } - }, - { - "stencil", 1, GFXS1_STENCILFUNC_FRONTBACK_MASK | GFXS1_STENCILOP_FRONTBACK_MASK, { - "mtlStencil", - "mtlStencilFuncFront", - "mtlStencilOpFrontPass", - "mtlStencilOpFrontFail", - "mtlStencilOpFrontZFail", - "mtlStencilFuncBack", - "mtlStencilOpBackPass", - "mtlStencilOpBackFail", - "mtlStencilOpBackZFail", - } - }, - { - "wireframe", 0, GFXS0_POLYMODE_LINE, { - "mtlWireframe", - } - } + {"alphaTest", 0, GFXS0_ATEST_MASK | GFXS0_ATEST_DISABLE, {"mtlAlphaTest"} }, + {"blendFunc", 0, GFXS0_BLEND_RGB_MASK, {"mtlBlendOp", "mtlSrcBlend", "mtlDestBlend"} }, + {"separateAlphaBlendFunc", 0, GFXS0_BLEND_ALPHA_MASK, {"mtlBlendOpAlpha", "mtlSrcBlendAlpha", "mtlDestBlendAlpha"}}, + {"cullFace", 0, GFXS0_CULL_MASK, {"mtlCullFace"} }, + {"depthTest", 1, GFXS1_DEPTHTEST_MASK | GFXS1_DEPTHTEST_DISABLE, {"mtlDepthTest"} }, + {"depthWrite", 1, GFXS1_DEPTHWRITE, {"mtlDepthWrite"} }, + {"colorWrite", 0, GFXS0_COLORWRITE_MASK, {"mtlColorWriteRgb", "mtlColorWriteAlpha"} }, + {"gammaWrite", + 0, GFXS0_GAMMAWRITE, + { + "mtlGammaWrite", + } }, + {"polygonOffset", + 1, GFXS1_POLYGON_OFFSET_MASK, + { + "mtlPolygonOffset", + } }, + {"stencil", + 1, GFXS1_STENCILFUNC_FRONTBACK_MASK | GFXS1_STENCILOP_FRONTBACK_MASK, + { + "mtlStencil", + "mtlStencilFuncFront", + "mtlStencilOpFrontPass", + "mtlStencilOpFrontFail", + "mtlStencilOpFrontZFail", + "mtlStencilFuncBack", + "mtlStencilOpBackPass", + "mtlStencilOpBackFail", + "mtlStencilOpBackZFail", + } }, + {"wireframe", + 0, GFXS0_POLYMODE_LINE, + { + "mtlWireframe", + } } }); inline state_map::StateMapLayoutVars stateMapVarLayout({ - { - "mtlAlphaTest", 0, { - {"Always", GFXS0_ATEST_DISABLE}, - {"GE128", GFXS0_ATEST_GE_128}, - {"GT0", GFXS0_ATEST_GT_0}, - {"LT128", GFXS0_ATEST_LT_128}, - } - }, - { - "mtlBlendOp", 0, { - {"Add", GFXS_BLENDOP_ADD << GFXS0_BLENDOP_RGB_SHIFT}, - {"Subtract", GFXS_BLENDOP_SUBTRACT << GFXS0_BLENDOP_RGB_SHIFT}, - {"RevSubtract", GFXS_BLENDOP_REVSUBTRACT << GFXS0_BLENDOP_RGB_SHIFT}, - {"Min", GFXS_BLENDOP_MIN << GFXS0_BLENDOP_RGB_SHIFT}, - {"Max", GFXS_BLENDOP_MAX << GFXS0_BLENDOP_RGB_SHIFT}, - {"Disable", GFXS_BLENDOP_DISABLED << GFXS0_BLENDOP_RGB_SHIFT}, - } - }, - { - "mtlSrcBlend", 0, { - {"Zero", GFXS_BLEND_ZERO << GFXS0_SRCBLEND_RGB_SHIFT}, - {"One", GFXS_BLEND_ONE << GFXS0_SRCBLEND_RGB_SHIFT}, - {"SrcColor", GFXS_BLEND_SRCCOLOR << GFXS0_SRCBLEND_RGB_SHIFT}, - {"InvSrcColor", GFXS_BLEND_INVSRCCOLOR << GFXS0_SRCBLEND_RGB_SHIFT}, - {"SrcAlpha", GFXS_BLEND_SRCALPHA << GFXS0_SRCBLEND_RGB_SHIFT}, - {"InvSrcAlpha", GFXS_BLEND_INVSRCALPHA << GFXS0_SRCBLEND_RGB_SHIFT}, - {"DestAlpha", GFXS_BLEND_DESTALPHA << GFXS0_SRCBLEND_RGB_SHIFT}, - {"InvDestAlpha", GFXS_BLEND_INVDESTALPHA << GFXS0_SRCBLEND_RGB_SHIFT}, - {"DestColor", GFXS_BLEND_DESTCOLOR << GFXS0_SRCBLEND_RGB_SHIFT}, - {"InvDestColor", GFXS_BLEND_INVDESTCOLOR << GFXS0_SRCBLEND_RGB_SHIFT}, - } - }, - { - "mtlDestBlend", 0, { - {"Zero", GFXS_BLEND_ZERO << GFXS0_DSTBLEND_RGB_SHIFT}, - {"One", GFXS_BLEND_ONE << GFXS0_DSTBLEND_RGB_SHIFT}, - {"SrcColor", GFXS_BLEND_SRCCOLOR << GFXS0_DSTBLEND_RGB_SHIFT}, - {"InvSrcColor", GFXS_BLEND_INVSRCCOLOR << GFXS0_DSTBLEND_RGB_SHIFT}, - {"SrcAlpha", GFXS_BLEND_SRCALPHA << GFXS0_DSTBLEND_RGB_SHIFT}, - {"InvSrcAlpha", GFXS_BLEND_INVSRCALPHA << GFXS0_DSTBLEND_RGB_SHIFT}, - {"DestAlpha", GFXS_BLEND_DESTALPHA << GFXS0_DSTBLEND_RGB_SHIFT}, - {"InvDestAlpha", GFXS_BLEND_INVDESTALPHA << GFXS0_DSTBLEND_RGB_SHIFT}, - {"DestColor", GFXS_BLEND_DESTCOLOR << GFXS0_DSTBLEND_RGB_SHIFT}, - {"InvDestColor", GFXS_BLEND_INVDESTCOLOR << GFXS0_DSTBLEND_RGB_SHIFT}, - } - }, - { - "mtlBlendOpAlpha", 0, { - {"Add", GFXS_BLENDOP_ADD << GFXS0_BLENDOP_ALPHA_SHIFT}, - {"Subtract", GFXS_BLENDOP_SUBTRACT << GFXS0_BLENDOP_ALPHA_SHIFT}, - {"RevSubtract", GFXS_BLENDOP_REVSUBTRACT << GFXS0_BLENDOP_ALPHA_SHIFT}, - {"Min", GFXS_BLENDOP_MIN << GFXS0_BLENDOP_ALPHA_SHIFT}, - {"Max", GFXS_BLENDOP_MAX << GFXS0_BLENDOP_ALPHA_SHIFT}, - {"Disable", GFXS_BLENDOP_DISABLED << GFXS0_BLENDOP_ALPHA_SHIFT}, - } - }, - { - "mtlSrcBlendAlpha", 0, { - {"Zero", GFXS_BLEND_ZERO << GFXS0_SRCBLEND_ALPHA_SHIFT}, - {"One", GFXS_BLEND_ONE << GFXS0_SRCBLEND_ALPHA_SHIFT}, - {"SrcColor", GFXS_BLEND_SRCCOLOR << GFXS0_SRCBLEND_ALPHA_SHIFT}, - {"InvSrcColor", GFXS_BLEND_INVSRCCOLOR << GFXS0_SRCBLEND_ALPHA_SHIFT}, - {"SrcAlpha", GFXS_BLEND_SRCALPHA << GFXS0_SRCBLEND_ALPHA_SHIFT}, - {"InvSrcAlpha", GFXS_BLEND_INVSRCALPHA << GFXS0_SRCBLEND_ALPHA_SHIFT}, - {"DestAlpha", GFXS_BLEND_DESTALPHA << GFXS0_SRCBLEND_ALPHA_SHIFT}, - {"InvDestAlpha", GFXS_BLEND_INVDESTALPHA << GFXS0_SRCBLEND_ALPHA_SHIFT}, - {"DestColor", GFXS_BLEND_DESTCOLOR << GFXS0_SRCBLEND_ALPHA_SHIFT}, - {"InvDestColor", GFXS_BLEND_INVDESTCOLOR << GFXS0_SRCBLEND_ALPHA_SHIFT}, - } - }, - { - "mtlDestBlendAlpha", 0, { - {"Zero", GFXS_BLEND_ZERO << GFXS0_DSTBLEND_ALPHA_SHIFT}, - {"One", GFXS_BLEND_ONE << GFXS0_DSTBLEND_ALPHA_SHIFT}, - {"SrcColor", GFXS_BLEND_SRCCOLOR << GFXS0_DSTBLEND_ALPHA_SHIFT}, - {"InvSrcColor", GFXS_BLEND_INVSRCCOLOR << GFXS0_DSTBLEND_ALPHA_SHIFT}, - {"SrcAlpha", GFXS_BLEND_SRCALPHA << GFXS0_DSTBLEND_ALPHA_SHIFT}, - {"InvSrcAlpha", GFXS_BLEND_INVSRCALPHA << GFXS0_DSTBLEND_ALPHA_SHIFT}, - {"DestAlpha", GFXS_BLEND_DESTALPHA << GFXS0_DSTBLEND_ALPHA_SHIFT}, - {"InvDestAlpha", GFXS_BLEND_INVDESTALPHA << GFXS0_DSTBLEND_ALPHA_SHIFT}, - {"DestColor", GFXS_BLEND_DESTCOLOR << GFXS0_DSTBLEND_ALPHA_SHIFT}, - {"InvDestColor", GFXS_BLEND_INVDESTCOLOR << GFXS0_DSTBLEND_ALPHA_SHIFT}, - } - }, - { - "mtlCullFace", 0, { - {"None", GFXS0_CULL_NONE}, - {"Back", GFXS0_CULL_BACK}, - {"Front", GFXS0_CULL_FRONT}, - } - }, - { - "mtlColorWriteRgb", 0, { - {"Enable", GFXS0_COLORWRITE_RGB}, - {"Disable", 0}, - } - }, - { - "mtlColorWriteAlpha", 0, { - {"Enable", GFXS0_COLORWRITE_ALPHA}, - {"Disable", 0}, - } - }, - { - "mtlGammaWrite", 0, { - {"Enable", GFXS0_GAMMAWRITE}, - {"Disable", 0}, - } - }, - { - "mtlWireframe", 0, { - {"Enable", GFXS0_POLYMODE_LINE}, - {"Disable", 0}, - } - }, - { - "mtlDepthTest", 1, { - {"Disable", GFXS1_DEPTHTEST_DISABLE}, - {"Less", GFXS1_DEPTHTEST_LESS}, - {"LessEqual", GFXS1_DEPTHTEST_LESSEQUAL}, - {"Equal", GFXS1_DEPTHTEST_EQUAL}, - {"Always", GFXS1_DEPTHTEST_ALWAYS}, - } - }, - { - "mtlDepthWrite", 1, { - {"Enable", GFXS1_DEPTHWRITE}, - {"Disable", 0}, - } - }, - { - "mtlPolygonOffset", 1, { - {"1", GFXS1_POLYGON_OFFSET_1}, - {"2", GFXS1_POLYGON_OFFSET_2}, - {"shadowmap", GFXS1_POLYGON_OFFSET_SHADOWMAP}, - {"0", GFXS1_POLYGON_OFFSET_0}, - } - }, - { - "mtlStencil", 1, { - {"OneSided", GFXS1_STENCIL_FRONT_ENABLE}, - {"TwoSided", GFXS1_STENCIL_FRONT_ENABLE | GFXS1_STENCIL_BACK_ENABLE}, - {"Disable", 0}, - } - }, - { - "mtlStencilFuncFront", 1, { - {"Less", GFXS_STENCILFUNC_LESS << GFXS1_STENCIL_FRONT_FUNC_SHIFT}, - {"Equal", GFXS_STENCILFUNC_EQUAL << GFXS1_STENCIL_FRONT_FUNC_SHIFT}, - {"LessEqual", GFXS_STENCILFUNC_LESSEQUAL << GFXS1_STENCIL_FRONT_FUNC_SHIFT}, - {"Greater", GFXS_STENCILFUNC_GREATER << GFXS1_STENCIL_FRONT_FUNC_SHIFT}, - {"NotEqual", GFXS_STENCILFUNC_NOTEQUAL << GFXS1_STENCIL_FRONT_FUNC_SHIFT}, - {"GreaterEqual", GFXS_STENCILFUNC_GREATEREQUAL << GFXS1_STENCIL_FRONT_FUNC_SHIFT}, - {"Always", GFXS_STENCILFUNC_ALWAYS << GFXS1_STENCIL_FRONT_FUNC_SHIFT}, - {"Never", GFXS_STENCILFUNC_NEVER << GFXS1_STENCIL_FRONT_FUNC_SHIFT}, - } - }, - { - "mtlStencilOpFrontPass", 1, { - {"Zero", GFXS_STENCILOP_ZERO << GFXS1_STENCIL_FRONT_PASS_SHIFT}, - {"Replace", GFXS_STENCILOP_REPLACE << GFXS1_STENCIL_FRONT_PASS_SHIFT}, - {"IncrSat", GFXS_STENCILOP_INCRSAT << GFXS1_STENCIL_FRONT_PASS_SHIFT}, - {"DecrSat", GFXS_STENCILOP_DECRSAT << GFXS1_STENCIL_FRONT_PASS_SHIFT}, - {"Invert", GFXS_STENCILOP_INVERT << GFXS1_STENCIL_FRONT_PASS_SHIFT}, - {"Incr", GFXS_STENCILOP_INCR << GFXS1_STENCIL_FRONT_PASS_SHIFT}, - {"Decr", GFXS_STENCILOP_DECR << GFXS1_STENCIL_FRONT_PASS_SHIFT}, - {"Keep", GFXS_STENCILOP_KEEP << GFXS1_STENCIL_FRONT_PASS_SHIFT}, - } - }, - { - "mtlStencilOpFrontFail", 1, { - {"Zero", GFXS_STENCILOP_ZERO << GFXS1_STENCIL_FRONT_FAIL_SHIFT}, - {"Replace", GFXS_STENCILOP_REPLACE << GFXS1_STENCIL_FRONT_FAIL_SHIFT}, - {"IncrSat", GFXS_STENCILOP_INCRSAT << GFXS1_STENCIL_FRONT_FAIL_SHIFT}, - {"DecrSat", GFXS_STENCILOP_DECRSAT << GFXS1_STENCIL_FRONT_FAIL_SHIFT}, - {"Invert", GFXS_STENCILOP_INVERT << GFXS1_STENCIL_FRONT_FAIL_SHIFT}, - {"Incr", GFXS_STENCILOP_INCR << GFXS1_STENCIL_FRONT_FAIL_SHIFT}, - {"Decr", GFXS_STENCILOP_DECR << GFXS1_STENCIL_FRONT_FAIL_SHIFT}, - {"Keep", GFXS_STENCILOP_KEEP << GFXS1_STENCIL_FRONT_FAIL_SHIFT}, - } - }, - { - "mtlStencilOpFrontZFail", 1, { - {"Zero", GFXS_STENCILOP_ZERO << GFXS1_STENCIL_FRONT_ZFAIL_SHIFT}, - {"Replace", GFXS_STENCILOP_REPLACE << GFXS1_STENCIL_FRONT_ZFAIL_SHIFT}, - {"IncrSat", GFXS_STENCILOP_INCRSAT << GFXS1_STENCIL_FRONT_ZFAIL_SHIFT}, - {"DecrSat", GFXS_STENCILOP_DECRSAT << GFXS1_STENCIL_FRONT_ZFAIL_SHIFT}, - {"Invert", GFXS_STENCILOP_INVERT << GFXS1_STENCIL_FRONT_ZFAIL_SHIFT}, - {"Incr", GFXS_STENCILOP_INCR << GFXS1_STENCIL_FRONT_ZFAIL_SHIFT}, - {"Decr", GFXS_STENCILOP_DECR << GFXS1_STENCIL_FRONT_ZFAIL_SHIFT}, - {"Keep", GFXS_STENCILOP_KEEP << GFXS1_STENCIL_FRONT_ZFAIL_SHIFT}, - } - }, - { - "mtlStencilFuncBack", 1, { - {"Less", GFXS_STENCILFUNC_LESS << GFXS1_STENCIL_BACK_FUNC_SHIFT}, - {"Equal", GFXS_STENCILFUNC_EQUAL << GFXS1_STENCIL_BACK_FUNC_SHIFT}, - {"LessEqual", GFXS_STENCILFUNC_LESSEQUAL << GFXS1_STENCIL_BACK_FUNC_SHIFT}, - {"Greater", GFXS_STENCILFUNC_GREATER << GFXS1_STENCIL_BACK_FUNC_SHIFT}, - {"NotEqual", GFXS_STENCILFUNC_NOTEQUAL << GFXS1_STENCIL_BACK_FUNC_SHIFT}, - {"GreaterEqual", GFXS_STENCILFUNC_GREATEREQUAL << GFXS1_STENCIL_BACK_FUNC_SHIFT}, - {"Always", GFXS_STENCILFUNC_ALWAYS << GFXS1_STENCIL_BACK_FUNC_SHIFT}, - {"Never", GFXS_STENCILFUNC_NEVER << GFXS1_STENCIL_BACK_FUNC_SHIFT}, - } - }, - { - "mtlStencilOpBackPass", 1, { - {"Zero", GFXS_STENCILOP_ZERO << GFXS1_STENCIL_BACK_PASS_SHIFT}, - {"Replace", GFXS_STENCILOP_REPLACE << GFXS1_STENCIL_BACK_PASS_SHIFT}, - {"IncrSat", GFXS_STENCILOP_INCRSAT << GFXS1_STENCIL_BACK_PASS_SHIFT}, - {"DecrSat", GFXS_STENCILOP_DECRSAT << GFXS1_STENCIL_BACK_PASS_SHIFT}, - {"Invert", GFXS_STENCILOP_INVERT << GFXS1_STENCIL_BACK_PASS_SHIFT}, - {"Incr", GFXS_STENCILOP_INCR << GFXS1_STENCIL_BACK_PASS_SHIFT}, - {"Decr", GFXS_STENCILOP_DECR << GFXS1_STENCIL_BACK_PASS_SHIFT}, - {"Keep", GFXS_STENCILOP_KEEP << GFXS1_STENCIL_BACK_PASS_SHIFT}, - } - }, - { - "mtlStencilOpBackFail", 1, { - {"Zero", GFXS_STENCILOP_ZERO << GFXS1_STENCIL_BACK_FAIL_SHIFT}, - {"Replace", GFXS_STENCILOP_REPLACE << GFXS1_STENCIL_BACK_FAIL_SHIFT}, - {"IncrSat", GFXS_STENCILOP_INCRSAT << GFXS1_STENCIL_BACK_FAIL_SHIFT}, - {"DecrSat", GFXS_STENCILOP_DECRSAT << GFXS1_STENCIL_BACK_FAIL_SHIFT}, - {"Invert", GFXS_STENCILOP_INVERT << GFXS1_STENCIL_BACK_FAIL_SHIFT}, - {"Incr", GFXS_STENCILOP_INCR << GFXS1_STENCIL_BACK_FAIL_SHIFT}, - {"Decr", GFXS_STENCILOP_DECR << GFXS1_STENCIL_BACK_FAIL_SHIFT}, - {"Keep", GFXS_STENCILOP_KEEP << GFXS1_STENCIL_BACK_FAIL_SHIFT}, - } - }, - { - "mtlStencilOpBackZFail", 1, { - {"Zero", GFXS_STENCILOP_ZERO << GFXS1_STENCIL_BACK_ZFAIL_SHIFT}, - {"Replace", GFXS_STENCILOP_REPLACE << GFXS1_STENCIL_BACK_ZFAIL_SHIFT}, - {"IncrSat", GFXS_STENCILOP_INCRSAT << GFXS1_STENCIL_BACK_ZFAIL_SHIFT}, - {"DecrSat", GFXS_STENCILOP_DECRSAT << GFXS1_STENCIL_BACK_ZFAIL_SHIFT}, - {"Invert", GFXS_STENCILOP_INVERT << GFXS1_STENCIL_BACK_ZFAIL_SHIFT}, - {"Incr", GFXS_STENCILOP_INCR << GFXS1_STENCIL_BACK_ZFAIL_SHIFT}, - {"Decr", GFXS_STENCILOP_DECR << GFXS1_STENCIL_BACK_ZFAIL_SHIFT}, - {"Keep", GFXS_STENCILOP_KEEP << GFXS1_STENCIL_BACK_ZFAIL_SHIFT}, - } - }, + {"mtlAlphaTest", + 0, { + {"Always", GFXS0_ATEST_DISABLE}, + {"GE128", GFXS0_ATEST_GE_128}, + {"GT0", GFXS0_ATEST_GT_0}, + {"LT128", GFXS0_ATEST_LT_128}, + }}, + {"mtlBlendOp", + 0, { + {"Add", GFXS_BLENDOP_ADD << GFXS0_BLENDOP_RGB_SHIFT}, + {"Subtract", GFXS_BLENDOP_SUBTRACT << GFXS0_BLENDOP_RGB_SHIFT}, + {"RevSubtract", GFXS_BLENDOP_REVSUBTRACT << GFXS0_BLENDOP_RGB_SHIFT}, + {"Min", GFXS_BLENDOP_MIN << GFXS0_BLENDOP_RGB_SHIFT}, + {"Max", GFXS_BLENDOP_MAX << GFXS0_BLENDOP_RGB_SHIFT}, + {"Disable", GFXS_BLENDOP_DISABLED << GFXS0_BLENDOP_RGB_SHIFT}, + }}, + {"mtlSrcBlend", + 0, { + {"Zero", GFXS_BLEND_ZERO << GFXS0_SRCBLEND_RGB_SHIFT}, + {"One", GFXS_BLEND_ONE << GFXS0_SRCBLEND_RGB_SHIFT}, + {"SrcColor", GFXS_BLEND_SRCCOLOR << GFXS0_SRCBLEND_RGB_SHIFT}, + {"InvSrcColor", GFXS_BLEND_INVSRCCOLOR << GFXS0_SRCBLEND_RGB_SHIFT}, + {"SrcAlpha", GFXS_BLEND_SRCALPHA << GFXS0_SRCBLEND_RGB_SHIFT}, + {"InvSrcAlpha", GFXS_BLEND_INVSRCALPHA << GFXS0_SRCBLEND_RGB_SHIFT}, + {"DestAlpha", GFXS_BLEND_DESTALPHA << GFXS0_SRCBLEND_RGB_SHIFT}, + {"InvDestAlpha", GFXS_BLEND_INVDESTALPHA << GFXS0_SRCBLEND_RGB_SHIFT}, + {"DestColor", GFXS_BLEND_DESTCOLOR << GFXS0_SRCBLEND_RGB_SHIFT}, + {"InvDestColor", GFXS_BLEND_INVDESTCOLOR << GFXS0_SRCBLEND_RGB_SHIFT}, + }}, + {"mtlDestBlend", + 0, { + {"Zero", GFXS_BLEND_ZERO << GFXS0_DSTBLEND_RGB_SHIFT}, + {"One", GFXS_BLEND_ONE << GFXS0_DSTBLEND_RGB_SHIFT}, + {"SrcColor", GFXS_BLEND_SRCCOLOR << GFXS0_DSTBLEND_RGB_SHIFT}, + {"InvSrcColor", GFXS_BLEND_INVSRCCOLOR << GFXS0_DSTBLEND_RGB_SHIFT}, + {"SrcAlpha", GFXS_BLEND_SRCALPHA << GFXS0_DSTBLEND_RGB_SHIFT}, + {"InvSrcAlpha", GFXS_BLEND_INVSRCALPHA << GFXS0_DSTBLEND_RGB_SHIFT}, + {"DestAlpha", GFXS_BLEND_DESTALPHA << GFXS0_DSTBLEND_RGB_SHIFT}, + {"InvDestAlpha", GFXS_BLEND_INVDESTALPHA << GFXS0_DSTBLEND_RGB_SHIFT}, + {"DestColor", GFXS_BLEND_DESTCOLOR << GFXS0_DSTBLEND_RGB_SHIFT}, + {"InvDestColor", GFXS_BLEND_INVDESTCOLOR << GFXS0_DSTBLEND_RGB_SHIFT}, + }}, + {"mtlBlendOpAlpha", + 0, { + {"Add", GFXS_BLENDOP_ADD << GFXS0_BLENDOP_ALPHA_SHIFT}, + {"Subtract", GFXS_BLENDOP_SUBTRACT << GFXS0_BLENDOP_ALPHA_SHIFT}, + {"RevSubtract", GFXS_BLENDOP_REVSUBTRACT << GFXS0_BLENDOP_ALPHA_SHIFT}, + {"Min", GFXS_BLENDOP_MIN << GFXS0_BLENDOP_ALPHA_SHIFT}, + {"Max", GFXS_BLENDOP_MAX << GFXS0_BLENDOP_ALPHA_SHIFT}, + {"Disable", GFXS_BLENDOP_DISABLED << GFXS0_BLENDOP_ALPHA_SHIFT}, + }}, + {"mtlSrcBlendAlpha", + 0, { + {"Zero", GFXS_BLEND_ZERO << GFXS0_SRCBLEND_ALPHA_SHIFT}, + {"One", GFXS_BLEND_ONE << GFXS0_SRCBLEND_ALPHA_SHIFT}, + {"SrcColor", GFXS_BLEND_SRCCOLOR << GFXS0_SRCBLEND_ALPHA_SHIFT}, + {"InvSrcColor", GFXS_BLEND_INVSRCCOLOR << GFXS0_SRCBLEND_ALPHA_SHIFT}, + {"SrcAlpha", GFXS_BLEND_SRCALPHA << GFXS0_SRCBLEND_ALPHA_SHIFT}, + {"InvSrcAlpha", GFXS_BLEND_INVSRCALPHA << GFXS0_SRCBLEND_ALPHA_SHIFT}, + {"DestAlpha", GFXS_BLEND_DESTALPHA << GFXS0_SRCBLEND_ALPHA_SHIFT}, + {"InvDestAlpha", GFXS_BLEND_INVDESTALPHA << GFXS0_SRCBLEND_ALPHA_SHIFT}, + {"DestColor", GFXS_BLEND_DESTCOLOR << GFXS0_SRCBLEND_ALPHA_SHIFT}, + {"InvDestColor", GFXS_BLEND_INVDESTCOLOR << GFXS0_SRCBLEND_ALPHA_SHIFT}, + }}, + {"mtlDestBlendAlpha", + 0, { + {"Zero", GFXS_BLEND_ZERO << GFXS0_DSTBLEND_ALPHA_SHIFT}, + {"One", GFXS_BLEND_ONE << GFXS0_DSTBLEND_ALPHA_SHIFT}, + {"SrcColor", GFXS_BLEND_SRCCOLOR << GFXS0_DSTBLEND_ALPHA_SHIFT}, + {"InvSrcColor", GFXS_BLEND_INVSRCCOLOR << GFXS0_DSTBLEND_ALPHA_SHIFT}, + {"SrcAlpha", GFXS_BLEND_SRCALPHA << GFXS0_DSTBLEND_ALPHA_SHIFT}, + {"InvSrcAlpha", GFXS_BLEND_INVSRCALPHA << GFXS0_DSTBLEND_ALPHA_SHIFT}, + {"DestAlpha", GFXS_BLEND_DESTALPHA << GFXS0_DSTBLEND_ALPHA_SHIFT}, + {"InvDestAlpha", GFXS_BLEND_INVDESTALPHA << GFXS0_DSTBLEND_ALPHA_SHIFT}, + {"DestColor", GFXS_BLEND_DESTCOLOR << GFXS0_DSTBLEND_ALPHA_SHIFT}, + {"InvDestColor", GFXS_BLEND_INVDESTCOLOR << GFXS0_DSTBLEND_ALPHA_SHIFT}, + }}, + {"mtlCullFace", + 0, { + {"None", GFXS0_CULL_NONE}, + {"Back", GFXS0_CULL_BACK}, + {"Front", GFXS0_CULL_FRONT}, + }}, + {"mtlColorWriteRgb", + 0, { + {"Enable", GFXS0_COLORWRITE_RGB}, + {"Disable", 0}, + }}, + {"mtlColorWriteAlpha", + 0, { + {"Enable", GFXS0_COLORWRITE_ALPHA}, + {"Disable", 0}, + }}, + {"mtlGammaWrite", + 0, { + {"Enable", GFXS0_GAMMAWRITE}, + {"Disable", 0}, + }}, + {"mtlWireframe", + 0, { + {"Enable", GFXS0_POLYMODE_LINE}, + {"Disable", 0}, + }}, + {"mtlDepthTest", + 1, { + {"Disable", GFXS1_DEPTHTEST_DISABLE}, + {"Less", GFXS1_DEPTHTEST_LESS}, + {"LessEqual", GFXS1_DEPTHTEST_LESSEQUAL}, + {"Equal", GFXS1_DEPTHTEST_EQUAL}, + {"Always", GFXS1_DEPTHTEST_ALWAYS}, + }}, + {"mtlDepthWrite", + 1, { + {"Enable", GFXS1_DEPTHWRITE}, + {"Disable", 0}, + }}, + {"mtlPolygonOffset", + 1, { + {"1", GFXS1_POLYGON_OFFSET_1}, + {"2", GFXS1_POLYGON_OFFSET_2}, + {"shadowmap", GFXS1_POLYGON_OFFSET_SHADOWMAP}, + {"0", GFXS1_POLYGON_OFFSET_0}, + }}, + {"mtlStencil", + 1, { + {"OneSided", GFXS1_STENCIL_FRONT_ENABLE}, + {"TwoSided", GFXS1_STENCIL_FRONT_ENABLE | GFXS1_STENCIL_BACK_ENABLE}, + {"Disable", 0}, + }}, + {"mtlStencilFuncFront", + 1, { + {"Less", GFXS_STENCILFUNC_LESS << GFXS1_STENCIL_FRONT_FUNC_SHIFT}, + {"Equal", GFXS_STENCILFUNC_EQUAL << GFXS1_STENCIL_FRONT_FUNC_SHIFT}, + {"LessEqual", GFXS_STENCILFUNC_LESSEQUAL << GFXS1_STENCIL_FRONT_FUNC_SHIFT}, + {"Greater", GFXS_STENCILFUNC_GREATER << GFXS1_STENCIL_FRONT_FUNC_SHIFT}, + {"NotEqual", GFXS_STENCILFUNC_NOTEQUAL << GFXS1_STENCIL_FRONT_FUNC_SHIFT}, + {"GreaterEqual", GFXS_STENCILFUNC_GREATEREQUAL << GFXS1_STENCIL_FRONT_FUNC_SHIFT}, + {"Always", GFXS_STENCILFUNC_ALWAYS << GFXS1_STENCIL_FRONT_FUNC_SHIFT}, + {"Never", GFXS_STENCILFUNC_NEVER << GFXS1_STENCIL_FRONT_FUNC_SHIFT}, + }}, + {"mtlStencilOpFrontPass", + 1, { + {"Zero", GFXS_STENCILOP_ZERO << GFXS1_STENCIL_FRONT_PASS_SHIFT}, + {"Replace", GFXS_STENCILOP_REPLACE << GFXS1_STENCIL_FRONT_PASS_SHIFT}, + {"IncrSat", GFXS_STENCILOP_INCRSAT << GFXS1_STENCIL_FRONT_PASS_SHIFT}, + {"DecrSat", GFXS_STENCILOP_DECRSAT << GFXS1_STENCIL_FRONT_PASS_SHIFT}, + {"Invert", GFXS_STENCILOP_INVERT << GFXS1_STENCIL_FRONT_PASS_SHIFT}, + {"Incr", GFXS_STENCILOP_INCR << GFXS1_STENCIL_FRONT_PASS_SHIFT}, + {"Decr", GFXS_STENCILOP_DECR << GFXS1_STENCIL_FRONT_PASS_SHIFT}, + {"Keep", GFXS_STENCILOP_KEEP << GFXS1_STENCIL_FRONT_PASS_SHIFT}, + }}, + {"mtlStencilOpFrontFail", + 1, { + {"Zero", GFXS_STENCILOP_ZERO << GFXS1_STENCIL_FRONT_FAIL_SHIFT}, + {"Replace", GFXS_STENCILOP_REPLACE << GFXS1_STENCIL_FRONT_FAIL_SHIFT}, + {"IncrSat", GFXS_STENCILOP_INCRSAT << GFXS1_STENCIL_FRONT_FAIL_SHIFT}, + {"DecrSat", GFXS_STENCILOP_DECRSAT << GFXS1_STENCIL_FRONT_FAIL_SHIFT}, + {"Invert", GFXS_STENCILOP_INVERT << GFXS1_STENCIL_FRONT_FAIL_SHIFT}, + {"Incr", GFXS_STENCILOP_INCR << GFXS1_STENCIL_FRONT_FAIL_SHIFT}, + {"Decr", GFXS_STENCILOP_DECR << GFXS1_STENCIL_FRONT_FAIL_SHIFT}, + {"Keep", GFXS_STENCILOP_KEEP << GFXS1_STENCIL_FRONT_FAIL_SHIFT}, + }}, + {"mtlStencilOpFrontZFail", + 1, { + {"Zero", GFXS_STENCILOP_ZERO << GFXS1_STENCIL_FRONT_ZFAIL_SHIFT}, + {"Replace", GFXS_STENCILOP_REPLACE << GFXS1_STENCIL_FRONT_ZFAIL_SHIFT}, + {"IncrSat", GFXS_STENCILOP_INCRSAT << GFXS1_STENCIL_FRONT_ZFAIL_SHIFT}, + {"DecrSat", GFXS_STENCILOP_DECRSAT << GFXS1_STENCIL_FRONT_ZFAIL_SHIFT}, + {"Invert", GFXS_STENCILOP_INVERT << GFXS1_STENCIL_FRONT_ZFAIL_SHIFT}, + {"Incr", GFXS_STENCILOP_INCR << GFXS1_STENCIL_FRONT_ZFAIL_SHIFT}, + {"Decr", GFXS_STENCILOP_DECR << GFXS1_STENCIL_FRONT_ZFAIL_SHIFT}, + {"Keep", GFXS_STENCILOP_KEEP << GFXS1_STENCIL_FRONT_ZFAIL_SHIFT}, + }}, + {"mtlStencilFuncBack", + 1, { + {"Less", GFXS_STENCILFUNC_LESS << GFXS1_STENCIL_BACK_FUNC_SHIFT}, + {"Equal", GFXS_STENCILFUNC_EQUAL << GFXS1_STENCIL_BACK_FUNC_SHIFT}, + {"LessEqual", GFXS_STENCILFUNC_LESSEQUAL << GFXS1_STENCIL_BACK_FUNC_SHIFT}, + {"Greater", GFXS_STENCILFUNC_GREATER << GFXS1_STENCIL_BACK_FUNC_SHIFT}, + {"NotEqual", GFXS_STENCILFUNC_NOTEQUAL << GFXS1_STENCIL_BACK_FUNC_SHIFT}, + {"GreaterEqual", GFXS_STENCILFUNC_GREATEREQUAL << GFXS1_STENCIL_BACK_FUNC_SHIFT}, + {"Always", GFXS_STENCILFUNC_ALWAYS << GFXS1_STENCIL_BACK_FUNC_SHIFT}, + {"Never", GFXS_STENCILFUNC_NEVER << GFXS1_STENCIL_BACK_FUNC_SHIFT}, + }}, + {"mtlStencilOpBackPass", + 1, { + {"Zero", GFXS_STENCILOP_ZERO << GFXS1_STENCIL_BACK_PASS_SHIFT}, + {"Replace", GFXS_STENCILOP_REPLACE << GFXS1_STENCIL_BACK_PASS_SHIFT}, + {"IncrSat", GFXS_STENCILOP_INCRSAT << GFXS1_STENCIL_BACK_PASS_SHIFT}, + {"DecrSat", GFXS_STENCILOP_DECRSAT << GFXS1_STENCIL_BACK_PASS_SHIFT}, + {"Invert", GFXS_STENCILOP_INVERT << GFXS1_STENCIL_BACK_PASS_SHIFT}, + {"Incr", GFXS_STENCILOP_INCR << GFXS1_STENCIL_BACK_PASS_SHIFT}, + {"Decr", GFXS_STENCILOP_DECR << GFXS1_STENCIL_BACK_PASS_SHIFT}, + {"Keep", GFXS_STENCILOP_KEEP << GFXS1_STENCIL_BACK_PASS_SHIFT}, + }}, + {"mtlStencilOpBackFail", + 1, { + {"Zero", GFXS_STENCILOP_ZERO << GFXS1_STENCIL_BACK_FAIL_SHIFT}, + {"Replace", GFXS_STENCILOP_REPLACE << GFXS1_STENCIL_BACK_FAIL_SHIFT}, + {"IncrSat", GFXS_STENCILOP_INCRSAT << GFXS1_STENCIL_BACK_FAIL_SHIFT}, + {"DecrSat", GFXS_STENCILOP_DECRSAT << GFXS1_STENCIL_BACK_FAIL_SHIFT}, + {"Invert", GFXS_STENCILOP_INVERT << GFXS1_STENCIL_BACK_FAIL_SHIFT}, + {"Incr", GFXS_STENCILOP_INCR << GFXS1_STENCIL_BACK_FAIL_SHIFT}, + {"Decr", GFXS_STENCILOP_DECR << GFXS1_STENCIL_BACK_FAIL_SHIFT}, + {"Keep", GFXS_STENCILOP_KEEP << GFXS1_STENCIL_BACK_FAIL_SHIFT}, + }}, + {"mtlStencilOpBackZFail", + 1, { + {"Zero", GFXS_STENCILOP_ZERO << GFXS1_STENCIL_BACK_ZFAIL_SHIFT}, + {"Replace", GFXS_STENCILOP_REPLACE << GFXS1_STENCIL_BACK_ZFAIL_SHIFT}, + {"IncrSat", GFXS_STENCILOP_INCRSAT << GFXS1_STENCIL_BACK_ZFAIL_SHIFT}, + {"DecrSat", GFXS_STENCILOP_DECRSAT << GFXS1_STENCIL_BACK_ZFAIL_SHIFT}, + {"Invert", GFXS_STENCILOP_INVERT << GFXS1_STENCIL_BACK_ZFAIL_SHIFT}, + {"Incr", GFXS_STENCILOP_INCR << GFXS1_STENCIL_BACK_ZFAIL_SHIFT}, + {"Decr", GFXS_STENCILOP_DECR << GFXS1_STENCIL_BACK_ZFAIL_SHIFT}, + {"Keep", GFXS_STENCILOP_KEEP << GFXS1_STENCIL_BACK_ZFAIL_SHIFT}, + }}, }); inline state_map::StateMapLayout stateMapLayout(std::extent_v, stateMapEntryLayout, stateMapVarLayout); -} +} // namespace IW4 diff --git a/src/ObjCommon/Game/IW5/MenuConstantsIW5.h b/src/ObjCommon/Game/IW5/MenuConstantsIW5.h index 390d47c93..2ee62beb3 100644 --- a/src/ObjCommon/Game/IW5/MenuConstantsIW5.h +++ b/src/ObjCommon/Game/IW5/MenuConstantsIW5.h @@ -4,8 +4,7 @@ namespace IW5 { - inline const char* g_expFunctionNames[] - { + inline const char* g_expFunctionNames[]{ "NOOP", ")", "*", @@ -361,26 +360,25 @@ namespace IW5 "doWeHaveMissingOwnedContent", }; - inline const ItemExpressionTargetBinding floatExpressionTargetBindings[ITEM_FLOATEXP_TGT_COUNT] - { - {ITEM_FLOATEXP_TGT_RECT_X, "rect", "x"}, - {ITEM_FLOATEXP_TGT_RECT_Y, "rect", "y"}, - {ITEM_FLOATEXP_TGT_RECT_W, "rect", "w"}, - {ITEM_FLOATEXP_TGT_RECT_H, "rect", "h"}, - {ITEM_FLOATEXP_TGT_FORECOLOR_R, "forecolor", "r"}, - {ITEM_FLOATEXP_TGT_FORECOLOR_G, "forecolor", "g"}, - {ITEM_FLOATEXP_TGT_FORECOLOR_B, "forecolor", "b"}, + inline const ItemExpressionTargetBinding floatExpressionTargetBindings[ITEM_FLOATEXP_TGT_COUNT]{ + {ITEM_FLOATEXP_TGT_RECT_X, "rect", "x" }, + {ITEM_FLOATEXP_TGT_RECT_Y, "rect", "y" }, + {ITEM_FLOATEXP_TGT_RECT_W, "rect", "w" }, + {ITEM_FLOATEXP_TGT_RECT_H, "rect", "h" }, + {ITEM_FLOATEXP_TGT_FORECOLOR_R, "forecolor", "r" }, + {ITEM_FLOATEXP_TGT_FORECOLOR_G, "forecolor", "g" }, + {ITEM_FLOATEXP_TGT_FORECOLOR_B, "forecolor", "b" }, {ITEM_FLOATEXP_TGT_FORECOLOR_RGB, "forecolor", "rgb"}, - {ITEM_FLOATEXP_TGT_FORECOLOR_A, "forecolor", "a"}, - {ITEM_FLOATEXP_TGT_GLOWCOLOR_R, "glowcolor", "r"}, - {ITEM_FLOATEXP_TGT_GLOWCOLOR_G, "glowcolor", "g"}, - {ITEM_FLOATEXP_TGT_GLOWCOLOR_B, "glowcolor", "b"}, + {ITEM_FLOATEXP_TGT_FORECOLOR_A, "forecolor", "a" }, + {ITEM_FLOATEXP_TGT_GLOWCOLOR_R, "glowcolor", "r" }, + {ITEM_FLOATEXP_TGT_GLOWCOLOR_G, "glowcolor", "g" }, + {ITEM_FLOATEXP_TGT_GLOWCOLOR_B, "glowcolor", "b" }, {ITEM_FLOATEXP_TGT_GLOWCOLOR_RGB, "glowcolor", "rgb"}, - {ITEM_FLOATEXP_TGT_GLOWCOLOR_A, "glowcolor", "a"}, - {ITEM_FLOATEXP_TGT_BACKCOLOR_R, "backcolor", "r"}, - {ITEM_FLOATEXP_TGT_BACKCOLOR_G, "backcolor", "g"}, - {ITEM_FLOATEXP_TGT_BACKCOLOR_B, "backcolor", "b"}, + {ITEM_FLOATEXP_TGT_GLOWCOLOR_A, "glowcolor", "a" }, + {ITEM_FLOATEXP_TGT_BACKCOLOR_R, "backcolor", "r" }, + {ITEM_FLOATEXP_TGT_BACKCOLOR_G, "backcolor", "g" }, + {ITEM_FLOATEXP_TGT_BACKCOLOR_B, "backcolor", "b" }, {ITEM_FLOATEXP_TGT_BACKCOLOR_RGB, "backcolor", "rgb"}, - {ITEM_FLOATEXP_TGT_BACKCOLOR_A, "backcolor", "a"}, + {ITEM_FLOATEXP_TGT_BACKCOLOR_A, "backcolor", "a" }, }; -} +} // namespace IW5 diff --git a/src/ObjCommon/Game/IW5/ObjConstantsIW5.h b/src/ObjCommon/Game/IW5/ObjConstantsIW5.h index d6aa36452..d71421bd3 100644 --- a/src/ObjCommon/Game/IW5/ObjConstantsIW5.h +++ b/src/ObjCommon/Game/IW5/ObjConstantsIW5.h @@ -17,4 +17,4 @@ namespace IW5 static constexpr const char* GDF_FILENAME_VEHICLE = "vehicle.gdf"; static constexpr const char* GDF_FILENAME_WEAPON = "weapon.gdf"; }; -} \ No newline at end of file +} // namespace IW5 diff --git a/src/ObjCommon/Game/T6/InfoString/EnumStrings.h b/src/ObjCommon/Game/T6/InfoString/EnumStrings.h index 219482d24..756db3e19 100644 --- a/src/ObjCommon/Game/T6/InfoString/EnumStrings.h +++ b/src/ObjCommon/Game/T6/InfoString/EnumStrings.h @@ -2,8 +2,7 @@ namespace T6 { - inline const char* szWeapTypeNames[] - { + inline const char* szWeapTypeNames[]{ "bullet", "grenade", "projectile", @@ -12,11 +11,10 @@ namespace T6 "bomb", "mine", "melee", - "riotshield" + "riotshield", }; - inline const char* szWeapClassNames[] - { + inline const char* szWeapClassNames[]{ "rifle", "mg", "smg", @@ -30,47 +28,42 @@ namespace T6 "item", "melee", "Killstreak Alt Stored Weapon", - "pistol spread" + "pistol spread", }; - inline const char* szWeapOverlayReticleNames[] - { + inline const char* szWeapOverlayReticleNames[]{ "none", - "crosshair" + "crosshair", }; - inline const char* szWeapInventoryTypeNames[] - { + inline const char* szWeapInventoryTypeNames[]{ "primary", "offhand", "item", "altmode", "melee", - "dwlefthand" + "dwlefthand", }; - inline const char* szWeapClipTypeNames[] - { + inline const char* szWeapClipTypeNames[]{ "bottom", "top", "left", "dp28", "ptrs", - "lmg" + "lmg", }; - inline const char* barrelTypeNames[] - { + inline const char* barrelTypeNames[]{ "Single", "Dual Barrel", "Dual Barrel Alternate", "Quad Barrel", "Quad Barrel Alternate", - "Quad Barrel Double Alternate" + "Quad Barrel Double Alternate", }; - inline const char* impactTypeNames[] - { + inline const char* impactTypeNames[]{ "none", "bullet_small", "bullet_large", @@ -86,18 +79,16 @@ namespace T6 "mortar_shell", "tank_shell", "bolt", - "blade" + "blade", }; - inline const char* szWeapStanceNames[] - { + inline const char* szWeapStanceNames[]{ "stand", "duck", - "prone" + "prone", }; - inline const char* szProjectileExplosionNames[] - { + inline const char* szProjectileExplosionNames[]{ "grenade", "rocket", "flashbang", @@ -108,71 +99,40 @@ namespace T6 "fire", "napalmblob", "bolt", - "shrapnel span" + "shrapnel span", }; - inline const char* offhandClassNames[] - { + inline const char* offhandClassNames[]{ "None", "Frag Grenade", "Smoke Grenade", "Flash Grenade", "Gear", - "Supply Drop Marker" + "Supply Drop Marker", }; - inline const char* offhandSlotNames[] - { + inline const char* offhandSlotNames[]{ "None", "Lethal grenade", "Tactical grenade", "Equipment", - "Specific use" + "Specific use", }; - inline const char* playerAnimTypeNames[] - { - "none", - "default", - "other", - "sniper", - "m203", - "hold", - "briefcase", - "reviver", - "radio", - "dualwield", - "remotecontrol", - "crossbow", - "minigun", - "beltfed", - "g11", - "rearclip", - "handleclip", - "rearclipsniper", - "ballisticknife", - "singleknife", - "nopump", - "hatchet", - "grimreaper", - "zipline", - "riotshield", - "tablet", - "turned", - "screecher", - "staff" + inline const char* playerAnimTypeNames[]{ + "none", "default", "other", "sniper", "m203", "hold", "briefcase", "reviver", "radio", "dualwield", + "remotecontrol", "crossbow", "minigun", "beltfed", "g11", "rearclip", "handleclip", "rearclipsniper", "ballisticknife", "singleknife", + "nopump", "hatchet", "grimreaper", "zipline", "riotshield", "tablet", "turned", "screecher", "staff", }; - inline const char* activeReticleNames[] - { + inline const char* activeReticleNames[]{ "None", "Pip-On-A-Stick", "Bouncing Diamond", - "Missile Lock" + "Missile Lock", }; - inline const char* guidedMissileNames[] - { + inline const char* guidedMissileNames[]{ "None", "Sidewinder", "Hellfire", @@ -181,87 +141,53 @@ namespace T6 "WireGuided", "TVGuided", "Drone", - "HeatSeeking" + "HeatSeeking", }; - inline const char* stickinessNames[] - { + inline const char* stickinessNames[]{ "Don't stick", "Stick to all", "Stick to all, except ai and clients", "Stick to ground", "Stick to ground, maintain yaw", - "Stick to flesh" + "Stick to flesh", }; - inline const char* rotateTypeNames[] - { + inline const char* rotateTypeNames[]{ "Rotate both axis, grenade style", "Rotate one axis, blade style", - "Rotate like a cylinder" + "Rotate like a cylinder", }; - inline const char* overlayInterfaceNames[] - { + inline const char* overlayInterfaceNames[]{ "None", "Javelin", - "Turret Scope" + "Turret Scope", }; - inline const char* ammoCounterClipNames[] - { + inline const char* ammoCounterClipNames[]{ "None", "Magazine", "ShortMagazine", "Shotgun", "Rocket", "Beltfed", - "AltWeapon" + "AltWeapon", }; - inline const char* weapIconRatioNames[] - { + inline const char* weapIconRatioNames[]{ "1:1", "2:1", - "4:1" + "4:1", }; - inline const char* szAttachmentTypeNames[] - { - "none", - "acog", - "dualclip", - "dualoptic", - "dw", - "extbarrel", - "extclip", - "extramags", - "fastads", - "fastreload", - "fmj", - "gl", - "grip", - "holo", - "ir", - "is", - "longbreath", - "mk", - "mms", - "rangefinder", - "reflex", - "rf", - "sf", - "silencer", - "stackfire", - "stalker", - "steadyaim", - "swayreduc", - "tacknife", - "vzoom" + inline const char* szAttachmentTypeNames[]{ + "none", "acog", "dualclip", "dualoptic", "dw", "extbarrel", "extclip", "extramags", "fastads", "fastreload", + "fmj", "gl", "grip", "holo", "ir", "is", "longbreath", "mk", "mms", "rangefinder", + "reflex", "rf", "sf", "silencer", "stackfire", "stalker", "steadyaim", "swayreduc", "tacknife", "vzoom", }; - inline const char* szWeapFireTypeNames[] - { + inline const char* szWeapFireTypeNames[]{ "Full Auto", "Single Shot", "2-Round Burst", @@ -271,19 +197,17 @@ namespace T6 "Stacked Fire", "Minigun", "Charge Shot", - "Jetgun" + "Jetgun", }; - inline const char* penetrateTypeNames[] - { + inline const char* penetrateTypeNames[]{ "none", "small", "medium", - "large" + "large", }; - inline const char* s_constraintTypeNames[] - { + inline const char* s_constraintTypeNames[]{ "none", "point", "distance", @@ -296,8 +220,7 @@ namespace T6 "light", }; - inline const char* s_vehicleClassNames[] - { + inline const char* s_vehicleClassNames[]{ "4 wheel", "motorcycle", "tank", @@ -307,8 +230,7 @@ namespace T6 "helicopter", }; - inline const char* s_vehicleCameraModes[] - { + inline const char* s_vehicleCameraModes[]{ "first", "chase", "view", @@ -319,52 +241,20 @@ namespace T6 "vtol", }; - inline const char* s_tractionTypeNames[] - { + inline const char* s_tractionTypeNames[]{ "TRACTION_TYPE_FRONT", "TRACTION_TYPE_BACK", "TRACTION_TYPE_ALL_WD", }; - inline const char* tracerTypeNames[] - { + inline const char* tracerTypeNames[]{ "Laser", - "Smoke" + "Smoke", }; - inline const char* bounceSoundSuffixes[] - { - "_default", - "_bark", - "_brick", - "_carpet", - "_cloth", - "_concrete", - "_dirt", - "_flesh", - "_foliage", - "_glass", - "_grass", - "_gravel", - "_ice", - "_metal", - "_mud", - "_paper", - "_plaster", - "_rock", - "_sand", - "_snow", - "_water", - "_wood", - "_asphalt", - "_ceramic", - "_plastic", - "_rubber", - "_cushion", - "_fruit", - "_paintedmetal", - "_player", - "_tallgrass", - "_riotshield" + inline const char* bounceSoundSuffixes[]{ + "_default", "_bark", "_brick", "_carpet", "_cloth", "_concrete", "_dirt", "_flesh", "_foliage", "_glass", "_grass", + "_gravel", "_ice", "_metal", "_mud", "_paper", "_plaster", "_rock", "_sand", "_snow", "_water", "_wood", + "_asphalt", "_ceramic", "_plastic", "_rubber", "_cushion", "_fruit", "_paintedmetal", "_player", "_tallgrass", "_riotshield", }; -} +} // namespace T6 diff --git a/src/ObjCommon/Game/T6/InfoString/PhysConstraintsFields.h b/src/ObjCommon/Game/T6/InfoString/PhysConstraintsFields.h index bce6e3970..39d1eaee7 100644 --- a/src/ObjCommon/Game/T6/InfoString/PhysConstraintsFields.h +++ b/src/ObjCommon/Game/T6/InfoString/PhysConstraintsFields.h @@ -3,83 +3,82 @@ namespace T6 { - inline cspField_t phys_constraints_fields[] - { - {"c1_type", offsetof(PhysConstraints, data[0].type), CFT_TYPE}, - {"c1_bone1_name", offsetof(PhysConstraints, data[0].target_bone1), CSPFT_STRING}, - {"c1_bone2_name", offsetof(PhysConstraints, data[0].target_bone2), CSPFT_STRING}, - {"c1_offsetX", offsetof(PhysConstraints, data[0].offset.x), CSPFT_FLOAT}, - {"c1_offsetY", offsetof(PhysConstraints, data[0].offset.y), CSPFT_FLOAT}, - {"c1_offsetZ", offsetof(PhysConstraints, data[0].offset.z), CSPFT_FLOAT}, - {"c1_timeout", offsetof(PhysConstraints, data[0].timeout), CSPFT_INT}, - {"c1_min_health", offsetof(PhysConstraints, data[0].min_health), CSPFT_INT}, - {"c1_max_health", offsetof(PhysConstraints, data[0].max_health), CSPFT_INT}, - {"c1_damp", offsetof(PhysConstraints, data[0].damp), CSPFT_FLOAT}, - {"c1_power", offsetof(PhysConstraints, data[0].power), CSPFT_FLOAT}, - {"c1_spin_scale", offsetof(PhysConstraints, data[0].spin_scale), CSPFT_FLOAT}, - {"c1_shakescalex", offsetof(PhysConstraints, data[0].scale.x), CSPFT_FLOAT}, - {"c1_shakescaley", offsetof(PhysConstraints, data[0].scale.y), CSPFT_FLOAT}, - {"c1_shakescalez", offsetof(PhysConstraints, data[0].scale.z), CSPFT_FLOAT}, - {"c1_min_angle", offsetof(PhysConstraints, data[0].minAngle), CSPFT_FLOAT}, - {"c1_max_angle", offsetof(PhysConstraints, data[0].maxAngle), CSPFT_FLOAT}, - {"c1_yaw", offsetof(PhysConstraints, data[0].scale.y), CSPFT_FLOAT}, - {"c1_pitch", offsetof(PhysConstraints, data[0].scale.x), CSPFT_FLOAT}, - {"c2_type", offsetof(PhysConstraints, data[1].type), CFT_TYPE}, - {"c2_bone1_name", offsetof(PhysConstraints, data[1].target_bone1), CSPFT_STRING}, - {"c2_bone2_name", offsetof(PhysConstraints, data[1].target_bone2), CSPFT_STRING}, - {"c2_offsetX", offsetof(PhysConstraints, data[1].offset.x), CSPFT_FLOAT}, - {"c2_offsetY", offsetof(PhysConstraints, data[1].offset.y), CSPFT_FLOAT}, - {"c2_offsetZ", offsetof(PhysConstraints, data[1].offset.z), CSPFT_FLOAT}, - {"c2_timeout", offsetof(PhysConstraints, data[1].timeout), CSPFT_INT}, - {"c2_min_health", offsetof(PhysConstraints, data[1].min_health), CSPFT_INT}, - {"c2_max_health", offsetof(PhysConstraints, data[1].max_health), CSPFT_INT}, - {"c2_damp", offsetof(PhysConstraints, data[1].damp), CSPFT_FLOAT}, - {"c2_power", offsetof(PhysConstraints, data[1].power), CSPFT_FLOAT}, - {"c2_spin_scale", offsetof(PhysConstraints, data[1].spin_scale), CSPFT_FLOAT}, - {"c2_shakescalex", offsetof(PhysConstraints, data[1].scale.x), CSPFT_FLOAT}, - {"c2_shakescaley", offsetof(PhysConstraints, data[1].scale.y), CSPFT_FLOAT}, - {"c2_shakescalez", offsetof(PhysConstraints, data[1].scale.z), CSPFT_FLOAT}, - {"c2_min_angle", offsetof(PhysConstraints, data[1].minAngle), CSPFT_FLOAT}, - {"c2_max_angle", offsetof(PhysConstraints, data[1].maxAngle), CSPFT_FLOAT}, - {"c2_yaw", offsetof(PhysConstraints, data[1].scale.y), CSPFT_FLOAT}, - {"c2_pitch", offsetof(PhysConstraints, data[1].scale.x), CSPFT_FLOAT}, - {"c3_type", offsetof(PhysConstraints, data[2].type), CFT_TYPE}, - {"c3_bone1_name", offsetof(PhysConstraints, data[2].target_bone1), CSPFT_STRING}, - {"c3_bone2_name", offsetof(PhysConstraints, data[2].target_bone2), CSPFT_STRING}, - {"c3_offsetX", offsetof(PhysConstraints, data[2].offset.x), CSPFT_FLOAT}, - {"c3_offsetY", offsetof(PhysConstraints, data[2].offset.y), CSPFT_FLOAT}, - {"c3_offsetZ", offsetof(PhysConstraints, data[2].offset.z), CSPFT_FLOAT}, - {"c3_timeout", offsetof(PhysConstraints, data[2].timeout), CSPFT_INT}, - {"c3_min_health", offsetof(PhysConstraints, data[2].min_health), CSPFT_INT}, - {"c3_max_health", offsetof(PhysConstraints, data[2].max_health), CSPFT_INT}, - {"c3_damp", offsetof(PhysConstraints, data[2].damp), CSPFT_FLOAT}, - {"c3_power", offsetof(PhysConstraints, data[2].power), CSPFT_FLOAT}, - {"c3_spin_scale", offsetof(PhysConstraints, data[2].spin_scale), CSPFT_FLOAT}, - {"c3_shakescalex", offsetof(PhysConstraints, data[2].scale.x), CSPFT_FLOAT}, - {"c3_shakescaley", offsetof(PhysConstraints, data[2].scale.y), CSPFT_FLOAT}, - {"c3_shakescalez", offsetof(PhysConstraints, data[2].scale.z), CSPFT_FLOAT}, - {"c3_min_angle", offsetof(PhysConstraints, data[2].minAngle), CSPFT_FLOAT}, - {"c3_max_angle", offsetof(PhysConstraints, data[2].maxAngle), CSPFT_FLOAT}, - {"c3_yaw", offsetof(PhysConstraints, data[2].scale.y), CSPFT_FLOAT}, - {"c3_pitch", offsetof(PhysConstraints, data[2].scale.x), CSPFT_FLOAT}, - {"c4_type", offsetof(PhysConstraints, data[3].type), CFT_TYPE}, - {"c4_bone1_name", offsetof(PhysConstraints, data[3].target_bone1), CSPFT_STRING}, - {"c4_bone2_name", offsetof(PhysConstraints, data[3].target_bone2), CSPFT_STRING}, - {"c4_offsetX", offsetof(PhysConstraints, data[3].offset.x), CSPFT_FLOAT}, - {"c4_offsetY", offsetof(PhysConstraints, data[3].offset.y), CSPFT_FLOAT}, - {"c4_offsetZ", offsetof(PhysConstraints, data[3].offset.z), CSPFT_FLOAT}, - {"c4_timeout", offsetof(PhysConstraints, data[3].timeout), CSPFT_INT}, - {"c4_min_health", offsetof(PhysConstraints, data[3].min_health), CSPFT_INT}, - {"c4_max_health", offsetof(PhysConstraints, data[3].max_health), CSPFT_INT}, - {"c4_damp", offsetof(PhysConstraints, data[3].damp), CSPFT_FLOAT}, - {"c4_power", offsetof(PhysConstraints, data[3].power), CSPFT_FLOAT}, - {"c4_spin_scale", offsetof(PhysConstraints, data[3].spin_scale), CSPFT_FLOAT}, - {"c4_shakescalex", offsetof(PhysConstraints, data[3].scale.x), CSPFT_FLOAT}, - {"c4_shakescaley", offsetof(PhysConstraints, data[3].scale.y), CSPFT_FLOAT}, - {"c4_shakescalez", offsetof(PhysConstraints, data[3].scale.z), CSPFT_FLOAT}, - {"c4_min_angle", offsetof(PhysConstraints, data[3].minAngle), CSPFT_FLOAT}, - {"c4_max_angle", offsetof(PhysConstraints, data[3].maxAngle), CSPFT_FLOAT}, - {"c4_yaw", offsetof(PhysConstraints, data[3].scale.y), CSPFT_FLOAT}, - {"c4_pitch", offsetof(PhysConstraints, data[3].scale.x), CSPFT_FLOAT}, + inline cspField_t phys_constraints_fields[]{ + {"c1_type", offsetof(PhysConstraints, data[0].type), CFT_TYPE }, + {"c1_bone1_name", offsetof(PhysConstraints, data[0].target_bone1), CSPFT_STRING}, + {"c1_bone2_name", offsetof(PhysConstraints, data[0].target_bone2), CSPFT_STRING}, + {"c1_offsetX", offsetof(PhysConstraints, data[0].offset.x), CSPFT_FLOAT }, + {"c1_offsetY", offsetof(PhysConstraints, data[0].offset.y), CSPFT_FLOAT }, + {"c1_offsetZ", offsetof(PhysConstraints, data[0].offset.z), CSPFT_FLOAT }, + {"c1_timeout", offsetof(PhysConstraints, data[0].timeout), CSPFT_INT }, + {"c1_min_health", offsetof(PhysConstraints, data[0].min_health), CSPFT_INT }, + {"c1_max_health", offsetof(PhysConstraints, data[0].max_health), CSPFT_INT }, + {"c1_damp", offsetof(PhysConstraints, data[0].damp), CSPFT_FLOAT }, + {"c1_power", offsetof(PhysConstraints, data[0].power), CSPFT_FLOAT }, + {"c1_spin_scale", offsetof(PhysConstraints, data[0].spin_scale), CSPFT_FLOAT }, + {"c1_shakescalex", offsetof(PhysConstraints, data[0].scale.x), CSPFT_FLOAT }, + {"c1_shakescaley", offsetof(PhysConstraints, data[0].scale.y), CSPFT_FLOAT }, + {"c1_shakescalez", offsetof(PhysConstraints, data[0].scale.z), CSPFT_FLOAT }, + {"c1_min_angle", offsetof(PhysConstraints, data[0].minAngle), CSPFT_FLOAT }, + {"c1_max_angle", offsetof(PhysConstraints, data[0].maxAngle), CSPFT_FLOAT }, + {"c1_yaw", offsetof(PhysConstraints, data[0].scale.y), CSPFT_FLOAT }, + {"c1_pitch", offsetof(PhysConstraints, data[0].scale.x), CSPFT_FLOAT }, + {"c2_type", offsetof(PhysConstraints, data[1].type), CFT_TYPE }, + {"c2_bone1_name", offsetof(PhysConstraints, data[1].target_bone1), CSPFT_STRING}, + {"c2_bone2_name", offsetof(PhysConstraints, data[1].target_bone2), CSPFT_STRING}, + {"c2_offsetX", offsetof(PhysConstraints, data[1].offset.x), CSPFT_FLOAT }, + {"c2_offsetY", offsetof(PhysConstraints, data[1].offset.y), CSPFT_FLOAT }, + {"c2_offsetZ", offsetof(PhysConstraints, data[1].offset.z), CSPFT_FLOAT }, + {"c2_timeout", offsetof(PhysConstraints, data[1].timeout), CSPFT_INT }, + {"c2_min_health", offsetof(PhysConstraints, data[1].min_health), CSPFT_INT }, + {"c2_max_health", offsetof(PhysConstraints, data[1].max_health), CSPFT_INT }, + {"c2_damp", offsetof(PhysConstraints, data[1].damp), CSPFT_FLOAT }, + {"c2_power", offsetof(PhysConstraints, data[1].power), CSPFT_FLOAT }, + {"c2_spin_scale", offsetof(PhysConstraints, data[1].spin_scale), CSPFT_FLOAT }, + {"c2_shakescalex", offsetof(PhysConstraints, data[1].scale.x), CSPFT_FLOAT }, + {"c2_shakescaley", offsetof(PhysConstraints, data[1].scale.y), CSPFT_FLOAT }, + {"c2_shakescalez", offsetof(PhysConstraints, data[1].scale.z), CSPFT_FLOAT }, + {"c2_min_angle", offsetof(PhysConstraints, data[1].minAngle), CSPFT_FLOAT }, + {"c2_max_angle", offsetof(PhysConstraints, data[1].maxAngle), CSPFT_FLOAT }, + {"c2_yaw", offsetof(PhysConstraints, data[1].scale.y), CSPFT_FLOAT }, + {"c2_pitch", offsetof(PhysConstraints, data[1].scale.x), CSPFT_FLOAT }, + {"c3_type", offsetof(PhysConstraints, data[2].type), CFT_TYPE }, + {"c3_bone1_name", offsetof(PhysConstraints, data[2].target_bone1), CSPFT_STRING}, + {"c3_bone2_name", offsetof(PhysConstraints, data[2].target_bone2), CSPFT_STRING}, + {"c3_offsetX", offsetof(PhysConstraints, data[2].offset.x), CSPFT_FLOAT }, + {"c3_offsetY", offsetof(PhysConstraints, data[2].offset.y), CSPFT_FLOAT }, + {"c3_offsetZ", offsetof(PhysConstraints, data[2].offset.z), CSPFT_FLOAT }, + {"c3_timeout", offsetof(PhysConstraints, data[2].timeout), CSPFT_INT }, + {"c3_min_health", offsetof(PhysConstraints, data[2].min_health), CSPFT_INT }, + {"c3_max_health", offsetof(PhysConstraints, data[2].max_health), CSPFT_INT }, + {"c3_damp", offsetof(PhysConstraints, data[2].damp), CSPFT_FLOAT }, + {"c3_power", offsetof(PhysConstraints, data[2].power), CSPFT_FLOAT }, + {"c3_spin_scale", offsetof(PhysConstraints, data[2].spin_scale), CSPFT_FLOAT }, + {"c3_shakescalex", offsetof(PhysConstraints, data[2].scale.x), CSPFT_FLOAT }, + {"c3_shakescaley", offsetof(PhysConstraints, data[2].scale.y), CSPFT_FLOAT }, + {"c3_shakescalez", offsetof(PhysConstraints, data[2].scale.z), CSPFT_FLOAT }, + {"c3_min_angle", offsetof(PhysConstraints, data[2].minAngle), CSPFT_FLOAT }, + {"c3_max_angle", offsetof(PhysConstraints, data[2].maxAngle), CSPFT_FLOAT }, + {"c3_yaw", offsetof(PhysConstraints, data[2].scale.y), CSPFT_FLOAT }, + {"c3_pitch", offsetof(PhysConstraints, data[2].scale.x), CSPFT_FLOAT }, + {"c4_type", offsetof(PhysConstraints, data[3].type), CFT_TYPE }, + {"c4_bone1_name", offsetof(PhysConstraints, data[3].target_bone1), CSPFT_STRING}, + {"c4_bone2_name", offsetof(PhysConstraints, data[3].target_bone2), CSPFT_STRING}, + {"c4_offsetX", offsetof(PhysConstraints, data[3].offset.x), CSPFT_FLOAT }, + {"c4_offsetY", offsetof(PhysConstraints, data[3].offset.y), CSPFT_FLOAT }, + {"c4_offsetZ", offsetof(PhysConstraints, data[3].offset.z), CSPFT_FLOAT }, + {"c4_timeout", offsetof(PhysConstraints, data[3].timeout), CSPFT_INT }, + {"c4_min_health", offsetof(PhysConstraints, data[3].min_health), CSPFT_INT }, + {"c4_max_health", offsetof(PhysConstraints, data[3].max_health), CSPFT_INT }, + {"c4_damp", offsetof(PhysConstraints, data[3].damp), CSPFT_FLOAT }, + {"c4_power", offsetof(PhysConstraints, data[3].power), CSPFT_FLOAT }, + {"c4_spin_scale", offsetof(PhysConstraints, data[3].spin_scale), CSPFT_FLOAT }, + {"c4_shakescalex", offsetof(PhysConstraints, data[3].scale.x), CSPFT_FLOAT }, + {"c4_shakescaley", offsetof(PhysConstraints, data[3].scale.y), CSPFT_FLOAT }, + {"c4_shakescalez", offsetof(PhysConstraints, data[3].scale.z), CSPFT_FLOAT }, + {"c4_min_angle", offsetof(PhysConstraints, data[3].minAngle), CSPFT_FLOAT }, + {"c4_max_angle", offsetof(PhysConstraints, data[3].maxAngle), CSPFT_FLOAT }, + {"c4_yaw", offsetof(PhysConstraints, data[3].scale.y), CSPFT_FLOAT }, + {"c4_pitch", offsetof(PhysConstraints, data[3].scale.x), CSPFT_FLOAT }, }; -} \ No newline at end of file +} diff --git a/src/ObjCommon/Game/T6/InfoString/PhysPresetFields.h b/src/ObjCommon/Game/T6/InfoString/PhysPresetFields.h index ffda5859f..65fc14cb8 100644 --- a/src/ObjCommon/Game/T6/InfoString/PhysPresetFields.h +++ b/src/ObjCommon/Game/T6/InfoString/PhysPresetFields.h @@ -3,26 +3,25 @@ namespace T6 { - inline cspField_t phys_preset_fields[] - { - { "mass", offsetof(PhysPresetInfo, mass), CSPFT_FLOAT }, - { "bounce", offsetof(PhysPresetInfo, bounce), CSPFT_FLOAT }, - { "friction", offsetof(PhysPresetInfo, friction), CSPFT_FLOAT }, - { "isFrictionInfinity", offsetof(PhysPresetInfo, isFrictionInfinity), CSPFT_QBOOLEAN }, - { "bulletForceScale", offsetof(PhysPresetInfo, bulletForceScale), CSPFT_FLOAT }, - { "explosiveForceScale", offsetof(PhysPresetInfo, explosiveForceScale), CSPFT_FLOAT }, - { "piecesSpreadFraction", offsetof(PhysPresetInfo, piecesSpreadFraction), CSPFT_FLOAT }, - { "piecesUpwardVelocity", offsetof(PhysPresetInfo, piecesUpwardVelocity), CSPFT_FLOAT }, - { "canFloat", offsetof(PhysPresetInfo, canFloat), CSPFT_INT }, - { "gravityScale", offsetof(PhysPresetInfo, gravityScale), CSPFT_FLOAT }, - { "massOffsetX", offsetof(PhysPresetInfo, centerOfMassOffset.x), CSPFT_FLOAT }, - { "massOffsetY", offsetof(PhysPresetInfo, centerOfMassOffset.y), CSPFT_FLOAT }, - { "massOffsetZ", offsetof(PhysPresetInfo, centerOfMassOffset.z), CSPFT_FLOAT }, - { "buoyancyMinX", offsetof(PhysPresetInfo, buoyancyBoxMin.x), CSPFT_FLOAT }, - { "buoyancyMinY", offsetof(PhysPresetInfo, buoyancyBoxMin.y), CSPFT_FLOAT }, - { "buoyancyMinZ", offsetof(PhysPresetInfo, buoyancyBoxMin.z), CSPFT_FLOAT }, - { "buoyancyMaxX", offsetof(PhysPresetInfo, buoyancyBoxMax.x), CSPFT_FLOAT }, - { "buoyancyMaxY", offsetof(PhysPresetInfo, buoyancyBoxMax.y), CSPFT_FLOAT }, - { "buoyancyMaxZ", offsetof(PhysPresetInfo, buoyancyBoxMax.z), CSPFT_FLOAT }, + inline cspField_t phys_preset_fields[]{ + {"mass", offsetof(PhysPresetInfo, mass), CSPFT_FLOAT }, + {"bounce", offsetof(PhysPresetInfo, bounce), CSPFT_FLOAT }, + {"friction", offsetof(PhysPresetInfo, friction), CSPFT_FLOAT }, + {"isFrictionInfinity", offsetof(PhysPresetInfo, isFrictionInfinity), CSPFT_QBOOLEAN}, + {"bulletForceScale", offsetof(PhysPresetInfo, bulletForceScale), CSPFT_FLOAT }, + {"explosiveForceScale", offsetof(PhysPresetInfo, explosiveForceScale), CSPFT_FLOAT }, + {"piecesSpreadFraction", offsetof(PhysPresetInfo, piecesSpreadFraction), CSPFT_FLOAT }, + {"piecesUpwardVelocity", offsetof(PhysPresetInfo, piecesUpwardVelocity), CSPFT_FLOAT }, + {"canFloat", offsetof(PhysPresetInfo, canFloat), CSPFT_INT }, + {"gravityScale", offsetof(PhysPresetInfo, gravityScale), CSPFT_FLOAT }, + {"massOffsetX", offsetof(PhysPresetInfo, centerOfMassOffset.x), CSPFT_FLOAT }, + {"massOffsetY", offsetof(PhysPresetInfo, centerOfMassOffset.y), CSPFT_FLOAT }, + {"massOffsetZ", offsetof(PhysPresetInfo, centerOfMassOffset.z), CSPFT_FLOAT }, + {"buoyancyMinX", offsetof(PhysPresetInfo, buoyancyBoxMin.x), CSPFT_FLOAT }, + {"buoyancyMinY", offsetof(PhysPresetInfo, buoyancyBoxMin.y), CSPFT_FLOAT }, + {"buoyancyMinZ", offsetof(PhysPresetInfo, buoyancyBoxMin.z), CSPFT_FLOAT }, + {"buoyancyMaxX", offsetof(PhysPresetInfo, buoyancyBoxMax.x), CSPFT_FLOAT }, + {"buoyancyMaxY", offsetof(PhysPresetInfo, buoyancyBoxMax.y), CSPFT_FLOAT }, + {"buoyancyMaxZ", offsetof(PhysPresetInfo, buoyancyBoxMax.z), CSPFT_FLOAT }, }; -} \ No newline at end of file +} diff --git a/src/ObjCommon/Game/T6/InfoString/TracerFields.h b/src/ObjCommon/Game/T6/InfoString/TracerFields.h index 5390e86c2..80b2e3e72 100644 --- a/src/ObjCommon/Game/T6/InfoString/TracerFields.h +++ b/src/ObjCommon/Game/T6/InfoString/TracerFields.h @@ -3,38 +3,37 @@ namespace T6 { - inline cspField_t tracer_fields[] - { - {"type", offsetof(TracerDef, type), TFT_TRACERTYPE}, - {"material", offsetof(TracerDef, material), CSPFT_MATERIAL}, - {"drawInterval", offsetof(TracerDef, drawInterval), CSPFT_INT}, - {"speed", offsetof(TracerDef, speed), CSPFT_FLOAT}, - {"beamLength", offsetof(TracerDef, beamLength), CSPFT_FLOAT}, - {"beamWidth", offsetof(TracerDef, beamWidth), CSPFT_FLOAT}, - {"screwRadius", offsetof(TracerDef, screwRadius), CSPFT_FLOAT}, - {"screwDist", offsetof(TracerDef, screwDist), CSPFT_FLOAT}, - {"fadeTime", offsetof(TracerDef, fadeTime), CSPFT_FLOAT}, - {"fadeScale", offsetof(TracerDef, fadeScale), CSPFT_FLOAT}, - {"texRepeatRate", offsetof(TracerDef, texRepeatRate), CSPFT_FLOAT}, - {"colorR0", offsetof(TracerDef, colors[0].r), CSPFT_FLOAT}, - {"colorG0", offsetof(TracerDef, colors[0].g), CSPFT_FLOAT}, - {"colorB0", offsetof(TracerDef, colors[0].b), CSPFT_FLOAT}, - {"colorA0", offsetof(TracerDef, colors[0].a), CSPFT_FLOAT}, - {"colorR1", offsetof(TracerDef, colors[1].r), CSPFT_FLOAT}, - {"colorG1", offsetof(TracerDef, colors[1].g), CSPFT_FLOAT}, - {"colorB1", offsetof(TracerDef, colors[1].b), CSPFT_FLOAT}, - {"colorA1", offsetof(TracerDef, colors[1].a), CSPFT_FLOAT}, - {"colorR2", offsetof(TracerDef, colors[2].r), CSPFT_FLOAT}, - {"colorG2", offsetof(TracerDef, colors[2].g), CSPFT_FLOAT}, - {"colorB2", offsetof(TracerDef, colors[2].b), CSPFT_FLOAT}, - {"colorA2", offsetof(TracerDef, colors[2].a), CSPFT_FLOAT}, - {"colorR3", offsetof(TracerDef, colors[3].r), CSPFT_FLOAT}, - {"colorG3", offsetof(TracerDef, colors[3].g), CSPFT_FLOAT}, - {"colorB3", offsetof(TracerDef, colors[3].b), CSPFT_FLOAT}, - {"colorA3", offsetof(TracerDef, colors[3].a), CSPFT_FLOAT}, - {"colorR4", offsetof(TracerDef, colors[4].r), CSPFT_FLOAT}, - {"colorG4", offsetof(TracerDef, colors[4].g), CSPFT_FLOAT}, - {"colorB4", offsetof(TracerDef, colors[4].b), CSPFT_FLOAT}, - {"colorA4", offsetof(TracerDef, colors[4].a), CSPFT_FLOAT} + inline cspField_t tracer_fields[]{ + {"type", offsetof(TracerDef, type), TFT_TRACERTYPE}, + {"material", offsetof(TracerDef, material), CSPFT_MATERIAL}, + {"drawInterval", offsetof(TracerDef, drawInterval), CSPFT_INT }, + {"speed", offsetof(TracerDef, speed), CSPFT_FLOAT }, + {"beamLength", offsetof(TracerDef, beamLength), CSPFT_FLOAT }, + {"beamWidth", offsetof(TracerDef, beamWidth), CSPFT_FLOAT }, + {"screwRadius", offsetof(TracerDef, screwRadius), CSPFT_FLOAT }, + {"screwDist", offsetof(TracerDef, screwDist), CSPFT_FLOAT }, + {"fadeTime", offsetof(TracerDef, fadeTime), CSPFT_FLOAT }, + {"fadeScale", offsetof(TracerDef, fadeScale), CSPFT_FLOAT }, + {"texRepeatRate", offsetof(TracerDef, texRepeatRate), CSPFT_FLOAT }, + {"colorR0", offsetof(TracerDef, colors[0].r), CSPFT_FLOAT }, + {"colorG0", offsetof(TracerDef, colors[0].g), CSPFT_FLOAT }, + {"colorB0", offsetof(TracerDef, colors[0].b), CSPFT_FLOAT }, + {"colorA0", offsetof(TracerDef, colors[0].a), CSPFT_FLOAT }, + {"colorR1", offsetof(TracerDef, colors[1].r), CSPFT_FLOAT }, + {"colorG1", offsetof(TracerDef, colors[1].g), CSPFT_FLOAT }, + {"colorB1", offsetof(TracerDef, colors[1].b), CSPFT_FLOAT }, + {"colorA1", offsetof(TracerDef, colors[1].a), CSPFT_FLOAT }, + {"colorR2", offsetof(TracerDef, colors[2].r), CSPFT_FLOAT }, + {"colorG2", offsetof(TracerDef, colors[2].g), CSPFT_FLOAT }, + {"colorB2", offsetof(TracerDef, colors[2].b), CSPFT_FLOAT }, + {"colorA2", offsetof(TracerDef, colors[2].a), CSPFT_FLOAT }, + {"colorR3", offsetof(TracerDef, colors[3].r), CSPFT_FLOAT }, + {"colorG3", offsetof(TracerDef, colors[3].g), CSPFT_FLOAT }, + {"colorB3", offsetof(TracerDef, colors[3].b), CSPFT_FLOAT }, + {"colorA3", offsetof(TracerDef, colors[3].a), CSPFT_FLOAT }, + {"colorR4", offsetof(TracerDef, colors[4].r), CSPFT_FLOAT }, + {"colorG4", offsetof(TracerDef, colors[4].g), CSPFT_FLOAT }, + {"colorB4", offsetof(TracerDef, colors[4].b), CSPFT_FLOAT }, + {"colorA4", offsetof(TracerDef, colors[4].a), CSPFT_FLOAT }, }; -} \ No newline at end of file +} diff --git a/src/ObjCommon/Game/T6/InfoString/VehicleFields.h b/src/ObjCommon/Game/T6/InfoString/VehicleFields.h index 86b83bd7e..3cfe0dcc9 100644 --- a/src/ObjCommon/Game/T6/InfoString/VehicleFields.h +++ b/src/ObjCommon/Game/T6/InfoString/VehicleFields.h @@ -3,563 +3,562 @@ namespace T6 { - inline cspField_t vehicle_fields[] - { - {"type", offsetof(VehicleDef, type), VFT_TYPE}, - {"remoteControl", offsetof(VehicleDef, remoteControl), CSPFT_QBOOLEAN}, - {"bulletDamage", offsetof(VehicleDef, bulletDamage), CSPFT_QBOOLEAN}, - {"armorPiercingDamage", offsetof(VehicleDef, armorPiercingDamage), CSPFT_QBOOLEAN}, - {"grenadeDamage", offsetof(VehicleDef, grenadeDamage), CSPFT_QBOOLEAN}, - {"projectileDamage", offsetof(VehicleDef, projectileDamage), CSPFT_QBOOLEAN}, - {"projectileSplashDamage", offsetof(VehicleDef, projectileSplashDamage), CSPFT_QBOOLEAN}, - {"heavyExplosiveDamage", offsetof(VehicleDef, heavyExplosiveDamage), CSPFT_QBOOLEAN}, - {"cameraMode", offsetof(VehicleDef, cameraMode), VFT_CAMERAMODE}, - {"autoRecenterOnAccel", offsetof(VehicleDef, autoRecenterOnAccel), CSPFT_QBOOLEAN}, - {"thirdPersonDriver", offsetof(VehicleDef, thirdPersonDriver), CSPFT_QBOOLEAN}, - {"thirdPersonUseVehicleRoll", offsetof(VehicleDef, thirdPersonUseVehicleRoll), CSPFT_QBOOLEAN}, - {"thirdPersonCameraPitchVehicleRelative", offsetof(VehicleDef, thirdPersonCameraPitchVehicleRelative), CSPFT_QBOOLEAN}, - {"thirdPersonCameraHeightWorldRelative", offsetof(VehicleDef, thirdPersonCameraHeightWorldRelative), CSPFT_QBOOLEAN}, - {"thirdPersonCameraHeightMin", offsetof(VehicleDef, thirdPersonCameraHeight[0]), CSPFT_FLOAT}, - {"thirdPersonCameraPitchMin", offsetof(VehicleDef, thirdPersonCameraPitch[0]), CSPFT_FLOAT}, - {"thirdPersonCameraRange", offsetof(VehicleDef, thirdPersonCameraRange), CSPFT_FLOAT}, - {"thirdPersonCameraHeight", offsetof(VehicleDef, thirdPersonCameraHeight[1]), CSPFT_FLOAT}, - {"thirdPersonCameraPitch", offsetof(VehicleDef, thirdPersonCameraPitch[1]), CSPFT_FLOAT}, - {"thirdPersonCameraMinPitchClamp", offsetof(VehicleDef, thirdPersonCameraMinPitchClamp), CSPFT_FLOAT}, - {"thirdPersonCameraMaxPitchClamp", offsetof(VehicleDef, thirdPersonCameraMaxPitchClamp), CSPFT_FLOAT}, - {"cameraAlwaysAutoCenter", offsetof(VehicleDef, cameraAlwaysAutoCenter), CSPFT_QBOOLEAN}, - {"cameraAutoCenterLerpRate", offsetof(VehicleDef, cameraAutoCenterLerpRate), CSPFT_FLOAT}, - {"cameraAutoCenterMaxLerpRate", offsetof(VehicleDef, cameraAutoCenterMaxLerpRate), CSPFT_FLOAT}, - {"thirdPersonCameraSpringDistance", offsetof(VehicleDef, thirdPersonCameraSpringDistance), CSPFT_FLOAT}, - {"thirdPersonCameraSpringTime", offsetof(VehicleDef, thirdPersonCameraSpringTime), CSPFT_FLOAT}, - {"thirdPersonCameraHandbrakeTurnRateInc", offsetof(VehicleDef, thirdPersonCameraHandbrakeTurnRateInc), CSPFT_FLOAT}, - {"cameraRollFraction", offsetof(VehicleDef, cameraRollFraction), CSPFT_FLOAT}, - {"cameraFOV", offsetof(VehicleDef, cameraFOV), CSPFT_FLOAT}, - {"viewInfluence", offsetof(VehicleDef, viewInfluence), CSPFT_FLOAT}, - {"tagPlayerOffsetX", offsetof(VehicleDef, tagPlayerOffset.x), CSPFT_FLOAT}, - {"tagPlayerOffsetY", offsetof(VehicleDef, tagPlayerOffset.y), CSPFT_FLOAT}, - {"tagPlayerOffsetZ", offsetof(VehicleDef, tagPlayerOffset.z), CSPFT_FLOAT}, - {"killcamCollision", offsetof(VehicleDef, killcamCollision), CSPFT_QBOOLEAN}, - {"killcamDist", offsetof(VehicleDef, killcamDist), CSPFT_FLOAT}, - {"killcamZDist", offsetof(VehicleDef, killcamZDist), CSPFT_FLOAT}, - {"killcamMinDist", offsetof(VehicleDef, killcamMinDist), CSPFT_FLOAT}, - {"killcamZTargetOffset", offsetof(VehicleDef, killcamZTargetOffset), CSPFT_FLOAT}, - {"killcamFOV", offsetof(VehicleDef, killcamFOV), CSPFT_FLOAT}, - {"killcamNearBlur", offsetof(VehicleDef, killcamNearBlur), CSPFT_FLOAT}, - {"killcamNearBlurStart", offsetof(VehicleDef, killcamNearBlurStart), CSPFT_FLOAT}, - {"killcamNearBlurEnd", offsetof(VehicleDef, killcamNearBlurEnd), CSPFT_FLOAT}, - {"killcamFarBlur", offsetof(VehicleDef, killcamFarBlur), CSPFT_FLOAT}, - {"killcamFarBlurStart", offsetof(VehicleDef, killcamFarBlurStart), CSPFT_FLOAT}, - {"killcamFarBlurEnd", offsetof(VehicleDef, killcamFarBlurEnd), CSPFT_FLOAT}, - {"isDrivable", offsetof(VehicleDef, isDrivable), CSPFT_QBOOLEAN}, - {"numberOfSeats", offsetof(VehicleDef, numberOfSeats), CSPFT_INT}, - {"numberOfGunners", offsetof(VehicleDef, numberOfGunners), CSPFT_INT}, - {"driverControlledGunPos", offsetof(VehicleDef, driverControlledGunPos), CSPFT_INT}, - {"seatSwitchOrder1", offsetof(VehicleDef, seatSwitchOrder[0]), CSPFT_INT}, - {"seatSwitchOrder2", offsetof(VehicleDef, seatSwitchOrder[1]), CSPFT_INT}, - {"seatSwitchOrder3", offsetof(VehicleDef, seatSwitchOrder[2]), CSPFT_INT}, - {"seatSwitchOrder4", offsetof(VehicleDef, seatSwitchOrder[3]), CSPFT_INT}, - {"seatSwitchOrder5", offsetof(VehicleDef, seatSwitchOrder[4]), CSPFT_INT}, - {"seatSwitchOrder6", offsetof(VehicleDef, seatSwitchOrder[5]), CSPFT_INT}, - {"seatSwitchOrder7", offsetof(VehicleDef, seatSwitchOrder[6]), CSPFT_INT}, - {"seatSwitchOrder8", offsetof(VehicleDef, seatSwitchOrder[7]), CSPFT_INT}, - {"seatSwitchOrder9", offsetof(VehicleDef, seatSwitchOrder[8]), CSPFT_INT}, - {"seatSwitchOrder10", offsetof(VehicleDef, seatSwitchOrder[9]), CSPFT_INT}, - {"seatSwitchOrder11", offsetof(VehicleDef, seatSwitchOrder[10]), CSPFT_INT}, - {"texureScrollScale", offsetof(VehicleDef, texScrollScale), CSPFT_FLOAT}, - {"wheelRotRate", offsetof(VehicleDef, wheelRotRate), CSPFT_FLOAT}, - {"extraWheelRotScale", offsetof(VehicleDef, extraWheelRotScale), CSPFT_FLOAT}, - {"wheelChildTakesSteerYaw", offsetof(VehicleDef, wheelChildTakesSteerYaw), CSPFT_QBOOLEAN}, - {"enterRadiusDriver", offsetof(VehicleDef, entryPointRadius[VEH_POS_DRIVER]), CSPFT_FLOAT}, - {"enterRadiusGunner1", offsetof(VehicleDef, entryPointRadius[VEH_POS_GUNNER_1]), CSPFT_FLOAT}, - {"enterRadiusGunner2", offsetof(VehicleDef, entryPointRadius[VEH_POS_GUNNER_2]), CSPFT_FLOAT}, - {"enterRadiusGunner3", offsetof(VehicleDef, entryPointRadius[VEH_POS_GUNNER_3]), CSPFT_FLOAT}, - {"enterRadiusGunner4", offsetof(VehicleDef, entryPointRadius[VEH_POS_GUNNER_4]), CSPFT_FLOAT}, - {"maxSpeed", offsetof(VehicleDef, maxSpeed), VFT_MPH_TO_INCHES_PER_SECOND}, - {"maxSpeedVertical", offsetof(VehicleDef, maxSpeedVertical), VFT_MPH_TO_INCHES_PER_SECOND}, - {"accel", offsetof(VehicleDef, accel), VFT_MPH_TO_INCHES_PER_SECOND}, - {"accelVertical", offsetof(VehicleDef, accelVertical), VFT_MPH_TO_INCHES_PER_SECOND}, - {"rotRate", offsetof(VehicleDef, rotRate), CSPFT_FLOAT}, - {"rotAccel", offsetof(VehicleDef, rotAccel), CSPFT_FLOAT}, - {"collisionDamage", offsetof(VehicleDef, collisionDamage), CSPFT_FLOAT}, - {"collisionSpeed", offsetof(VehicleDef, collisionSpeed), VFT_MPH_TO_INCHES_PER_SECOND}, - {"suspensionTravel", offsetof(VehicleDef, suspensionTravel), CSPFT_FLOAT}, - {"maxBodyPitch", offsetof(VehicleDef, maxBodyPitch), CSPFT_FLOAT}, - {"maxBodyRoll", offsetof(VehicleDef, maxBodyRoll), CSPFT_FLOAT}, - {"heliCollisionScalar", offsetof(VehicleDef, heliCollisionScalar), CSPFT_FLOAT}, - {"viewPitchOffset", offsetof(VehicleDef, viewPitchOffset), CSPFT_FLOAT}, - {"tiltFromAccelerationPitch", offsetof(VehicleDef, tiltFromAcceleration[0]), CSPFT_FLOAT}, - {"tiltFromAccelerationRoll", offsetof(VehicleDef, tiltFromAcceleration[1]), CSPFT_FLOAT}, - {"tiltFromDecelerationPitch", offsetof(VehicleDef, tiltFromDeceleration[0]), CSPFT_FLOAT}, - {"tiltFromDecelerationRoll", offsetof(VehicleDef, tiltFromDeceleration[1]), CSPFT_FLOAT}, - {"tiltFromVelocityPitch", offsetof(VehicleDef, tiltFromVelocity[0]), CSPFT_FLOAT}, - {"tiltFromVelocityRoll", offsetof(VehicleDef, tiltFromVelocity[1]), CSPFT_FLOAT}, - {"tiltSpeedPitch", offsetof(VehicleDef, tiltSpeed[0]), CSPFT_FLOAT}, - {"tiltSpeedRoll", offsetof(VehicleDef, tiltSpeed[1]), CSPFT_FLOAT}, - {"tracerOffsetForward", offsetof(VehicleDef, tracerOffset[0]), CSPFT_FLOAT}, - {"tracerOffsetUp", offsetof(VehicleDef, tracerOffset[1]), CSPFT_FLOAT}, - {"turretWeapon", offsetof(VehicleDef, turretWeapon), CSPFT_STRING}, - {"turretHorizSpanLeft", offsetof(VehicleDef, turretViewLimits.horizSpanLeft), CSPFT_FLOAT}, - {"turretHorizSpanRight", offsetof(VehicleDef, turretViewLimits.horizSpanRight), CSPFT_FLOAT}, - {"turretVertSpanUp", offsetof(VehicleDef, turretViewLimits.vertSpanUp), CSPFT_FLOAT}, - {"turretVertSpanDown", offsetof(VehicleDef, turretViewLimits.vertSpanDown), CSPFT_FLOAT}, - {"turretHorizResistLeft", offsetof(VehicleDef, turretViewLimits.horizResistLeft), CSPFT_FLOAT}, - {"turretHorizResistRight", offsetof(VehicleDef, turretViewLimits.horizResistRight), CSPFT_FLOAT}, - {"turretVertResistUp", offsetof(VehicleDef, turretViewLimits.vertResistUp), CSPFT_FLOAT}, - {"turretVertResistDown", offsetof(VehicleDef, turretViewLimits.vertResistDown), CSPFT_FLOAT}, - {"turretRotRate", offsetof(VehicleDef, turretRotRate), CSPFT_FLOAT}, - {"turretClampPlayerView", offsetof(VehicleDef, turretClampPlayerView), CSPFT_QBOOLEAN}, - {"turretLockTurretToPlayerView", offsetof(VehicleDef, turretLockTurretToPlayerView), CSPFT_QBOOLEAN}, - {"gunnerWeapon", offsetof(VehicleDef, gunnerWeapon[0]), CSPFT_STRING}, - {"gunnerWeapon1", offsetof(VehicleDef, gunnerWeapon[1]), CSPFT_STRING}, - {"gunnerWeapon2", offsetof(VehicleDef, gunnerWeapon[2]), CSPFT_STRING}, - {"gunnerWeapon3", offsetof(VehicleDef, gunnerWeapon[3]), CSPFT_STRING}, - {"gunnerRotRate", offsetof(VehicleDef, gunnerRotRate), CSPFT_FLOAT}, - {"passenger1HorizSpanLeft", offsetof(VehicleDef, passengerViewLimits[0].horizSpanLeft), CSPFT_FLOAT}, - {"passenger1HorizSpanRight", offsetof(VehicleDef, passengerViewLimits[0].horizSpanRight), CSPFT_FLOAT}, - {"passenger1VertSpanUp", offsetof(VehicleDef, passengerViewLimits[0].vertSpanUp), CSPFT_FLOAT}, - {"passenger1VertSpanDown", offsetof(VehicleDef, passengerViewLimits[0].vertSpanDown), CSPFT_FLOAT}, - {"passenger2HorizSpanLeft", offsetof(VehicleDef, passengerViewLimits[1].horizSpanLeft), CSPFT_FLOAT}, - {"passenger2HorizSpanRight", offsetof(VehicleDef, passengerViewLimits[1].horizSpanRight), CSPFT_FLOAT}, - {"passenger2VertSpanUp", offsetof(VehicleDef, passengerViewLimits[1].vertSpanUp), CSPFT_FLOAT}, - {"passenger2VertSpanDown", offsetof(VehicleDef, passengerViewLimits[1].vertSpanDown), CSPFT_FLOAT}, - {"passenger3HorizSpanLeft", offsetof(VehicleDef, passengerViewLimits[2].horizSpanLeft), CSPFT_FLOAT}, - {"passenger3HorizSpanRight", offsetof(VehicleDef, passengerViewLimits[2].horizSpanRight), CSPFT_FLOAT}, - {"passenger3VertSpanUp", offsetof(VehicleDef, passengerViewLimits[2].vertSpanUp), CSPFT_FLOAT}, - {"passenger3VertSpanDown", offsetof(VehicleDef, passengerViewLimits[2].vertSpanDown), CSPFT_FLOAT}, - {"passenger4HorizSpanLeft", offsetof(VehicleDef, passengerViewLimits[3].horizSpanLeft), CSPFT_FLOAT}, - {"passenger4HorizSpanRight", offsetof(VehicleDef, passengerViewLimits[3].horizSpanRight), CSPFT_FLOAT}, - {"passenger4VertSpanUp", offsetof(VehicleDef, passengerViewLimits[3].vertSpanUp), CSPFT_FLOAT}, - {"passenger4VertSpanDown", offsetof(VehicleDef, passengerViewLimits[3].vertSpanDown), CSPFT_FLOAT}, - {"passenger5HorizSpanLeft", offsetof(VehicleDef, passengerViewLimits[4].horizSpanLeft), CSPFT_FLOAT}, - {"passenger5HorizSpanRight", offsetof(VehicleDef, passengerViewLimits[4].horizSpanRight), CSPFT_FLOAT}, - {"passenger5VertSpanUp", offsetof(VehicleDef, passengerViewLimits[4].vertSpanUp), CSPFT_FLOAT}, - {"passenger5VertSpanDown", offsetof(VehicleDef, passengerViewLimits[4].vertSpanDown), CSPFT_FLOAT}, - {"passenger6HorizSpanLeft", offsetof(VehicleDef, passengerViewLimits[5].horizSpanLeft), CSPFT_FLOAT}, - {"passenger6HorizSpanRight", offsetof(VehicleDef, passengerViewLimits[5].horizSpanRight), CSPFT_FLOAT}, - {"passenger6VertSpanUp", offsetof(VehicleDef, passengerViewLimits[5].vertSpanUp), CSPFT_FLOAT}, - {"passenger6VertSpanDown", offsetof(VehicleDef, passengerViewLimits[5].vertSpanDown), CSPFT_FLOAT}, - {"turretSpinSnd", offsetof(VehicleDef, sndNames[VEH_TURRET_SPIN_SND]), CSPFT_STRING}, - {"turretStopSnd", offsetof(VehicleDef, sndNames[VEH_TURRET_STOP_SND]), CSPFT_STRING}, - {"wheelRoadNoiseSnd", offsetof(VehicleDef, sndMaterialNames[VEH_WHEEL_ROAD_NOISE]), CSPFT_STRING}, - {"wheelSlidingSnd", offsetof(VehicleDef, sndMaterialNames[VEH_WHEEL_SLIDING]), CSPFT_STRING}, - {"wheelPeelingOutSnd", offsetof(VehicleDef, sndMaterialNames[VEH_WHEEL_PEELING_OUT]), CSPFT_STRING}, - {"futzSnd", offsetof(VehicleDef, futzName), CSPFT_STRING}, - {"futzBlend", offsetof(VehicleDef, futzBlend), CSPFT_FLOAT}, - {"skidSpeedMin", offsetof(VehicleDef, skidSpeedMin), CSPFT_FLOAT}, - {"skidSpeedMax", offsetof(VehicleDef, skidSpeedMax), CSPFT_FLOAT}, - {"animType", offsetof(VehicleDef, animType), CSPFT_INT}, - {"animSet", offsetof(VehicleDef, animSet), CSPFT_STRING}, - {"scriptedAnimationEntry", offsetof(VehicleDef, scriptedAnimationEntry), CSPFT_QBOOLEAN}, - {"mantleAngleFront", offsetof(VehicleDef, mantleAngles[MANTLE_ANGLE_FRONT]), CSPFT_FLOAT}, - {"mantleAngleBack", offsetof(VehicleDef, mantleAngles[MANTLE_ANGLE_BACK]), CSPFT_FLOAT}, - {"mantleAngleLeft", offsetof(VehicleDef, mantleAngles[MANTLE_ANGLE_LEFT]), CSPFT_FLOAT}, - {"mantleAngleRight", offsetof(VehicleDef, mantleAngles[MANTLE_ANGLE_RIGHT]), CSPFT_FLOAT}, - {"driverHideTag1", offsetof(VehicleDef, driverHideTag), CSPFT_SCRIPT_STRING}, - {"extraWheelLeft1", offsetof(VehicleDef, extraWheelTags[FL_WHEEL]), CSPFT_SCRIPT_STRING}, - {"extraWheelRight1", offsetof(VehicleDef, extraWheelTags[FR_WHEEL]), CSPFT_SCRIPT_STRING}, - {"extraWheelLeft2", offsetof(VehicleDef, extraWheelTags[BL_WHEEL]), CSPFT_SCRIPT_STRING}, - {"extraWheelRight2", offsetof(VehicleDef, extraWheelTags[BR_WHEEL]), CSPFT_SCRIPT_STRING}, - {"mod0", offsetof(VehicleDef, attachmentModels[0]), CSPFT_XMODEL}, - {"tag0", offsetof(VehicleDef, attachmentTags[0]), CSPFT_SCRIPT_STRING}, - {"mod1", offsetof(VehicleDef, attachmentModels[1]), CSPFT_XMODEL}, - {"tag1", offsetof(VehicleDef, attachmentTags[1]), CSPFT_SCRIPT_STRING}, - {"mod2", offsetof(VehicleDef, attachmentModels[2]), CSPFT_XMODEL}, - {"tag2", offsetof(VehicleDef, attachmentTags[2]), CSPFT_SCRIPT_STRING}, - {"mod3", offsetof(VehicleDef, attachmentModels[3]), CSPFT_XMODEL}, - {"tag3", offsetof(VehicleDef, attachmentTags[3]), CSPFT_SCRIPT_STRING}, - {"dmod0", offsetof(VehicleDef, deathAttachmentModels[0]), CSPFT_XMODEL}, - {"dtag0", offsetof(VehicleDef, deathAttachmentTags[0]), CSPFT_SCRIPT_STRING}, - {"dmod1", offsetof(VehicleDef, deathAttachmentModels[1]), CSPFT_XMODEL}, - {"dtag1", offsetof(VehicleDef, deathAttachmentTags[1]), CSPFT_SCRIPT_STRING}, - {"dmod2", offsetof(VehicleDef, deathAttachmentModels[2]), CSPFT_XMODEL}, - {"dtag2", offsetof(VehicleDef, deathAttachmentTags[2]), CSPFT_SCRIPT_STRING}, - {"dmod3", offsetof(VehicleDef, deathAttachmentModels[3]), CSPFT_XMODEL}, - {"dtag3", offsetof(VehicleDef, deathAttachmentTags[3]), CSPFT_SCRIPT_STRING}, - {"worldModel", offsetof(VehicleDef, model), CSPFT_XMODEL}, - {"viewModel", offsetof(VehicleDef, viewModel), CSPFT_XMODEL}, - {"deathModel", offsetof(VehicleDef, deathModel), CSPFT_XMODEL}, - {"enemyModel", offsetof(VehicleDef, enemyModel), CSPFT_XMODEL}, - {"modelSwapDelay", offsetof(VehicleDef, modelSwapDelay), CSPFT_FLOAT}, - {"exhaustFx", offsetof(VehicleDef, exhaustFx), CSPFT_FX}, - {"oneExhaust", offsetof(VehicleDef, oneExhaust), CSPFT_QBOOLEAN}, - {"treadFxAsphalt", offsetof(VehicleDef, treadFx[SURF_TYPE_ASPHALT]), CSPFT_FX}, - {"treadFxBark", offsetof(VehicleDef, treadFx[SURF_TYPE_BARK]), CSPFT_FX}, - {"treadFxBrick", offsetof(VehicleDef, treadFx[SURF_TYPE_BRICK]), CSPFT_FX}, - {"treadFxCarpet", offsetof(VehicleDef, treadFx[SURF_TYPE_CARPET]), CSPFT_FX}, - {"treadFxCeramic", offsetof(VehicleDef, treadFx[SURF_TYPE_CERAMIC]), CSPFT_FX}, - {"treadFxCloth", offsetof(VehicleDef, treadFx[SURF_TYPE_CLOTH]), CSPFT_FX}, - {"treadFxConcrete", offsetof(VehicleDef, treadFx[SURF_TYPE_CONCRETE]), CSPFT_FX}, - {"treadFxCushion", offsetof(VehicleDef, treadFx[SURF_TYPE_CUSHION]), CSPFT_FX}, - {"treadFxDefault", offsetof(VehicleDef, treadFx[SURF_TYPE_DEFAULT]), CSPFT_FX}, - {"treadFxDirt", offsetof(VehicleDef, treadFx[SURF_TYPE_DIRT]), CSPFT_FX}, - {"treadFxFlesh", offsetof(VehicleDef, treadFx[SURF_TYPE_FLESH]), CSPFT_FX}, - {"treadFxFoliage", offsetof(VehicleDef, treadFx[SURF_TYPE_FOLIAGE]), CSPFT_FX}, - {"treadFxFruit", offsetof(VehicleDef, treadFx[SURF_TYPE_FRUIT]), CSPFT_FX}, - {"treadFxGlass", offsetof(VehicleDef, treadFx[SURF_TYPE_GLASS]), CSPFT_FX}, - {"treadFxGrass", offsetof(VehicleDef, treadFx[SURF_TYPE_GRASS]), CSPFT_FX}, - {"treadFxGravel", offsetof(VehicleDef, treadFx[SURF_TYPE_GRAVEL]), CSPFT_FX}, - {"treadFxIce", offsetof(VehicleDef, treadFx[SURF_TYPE_ICE]), CSPFT_FX}, - {"treadFxMetal", offsetof(VehicleDef, treadFx[SURF_TYPE_METAL]), CSPFT_FX}, - {"treadFxMud", offsetof(VehicleDef, treadFx[SURF_TYPE_MUD]), CSPFT_FX}, - {"treadFxPaintedMetal", offsetof(VehicleDef, treadFx[SURF_TYPE_PAINTED_METAL]), CSPFT_FX}, - {"treadFxPaper", offsetof(VehicleDef, treadFx[SURF_TYPE_PAPER]), CSPFT_FX}, - {"treadFxPlaster", offsetof(VehicleDef, treadFx[SURF_TYPE_PLASTER]), CSPFT_FX}, - {"treadFxPlastic", offsetof(VehicleDef, treadFx[SURF_TYPE_PLASTIC]), CSPFT_FX}, - {"treadFxRock", offsetof(VehicleDef, treadFx[SURF_TYPE_ROCK]), CSPFT_FX}, - {"treadFxRubber", offsetof(VehicleDef, treadFx[SURF_TYPE_RUBBER]), CSPFT_FX}, - {"treadFxSand", offsetof(VehicleDef, treadFx[SURF_TYPE_SAND]), CSPFT_FX}, - {"treadFxSnow", offsetof(VehicleDef, treadFx[SURF_TYPE_SNOW]), CSPFT_FX}, - {"treadFxWater", offsetof(VehicleDef, treadFx[SURF_TYPE_WATER]), CSPFT_FX}, - {"treadFxWood", offsetof(VehicleDef, treadFx[SURF_TYPE_WOOD]), CSPFT_FX}, - {"deathFxName", offsetof(VehicleDef, deathFx), CSPFT_FX}, - {"deathFxTag", offsetof(VehicleDef, deathFxTag), CSPFT_SCRIPT_STRING}, - {"deathFxSound", offsetof(VehicleDef, deathFxSound), CSPFT_STRING}, - {"lightFxName1", offsetof(VehicleDef, lightFx[0]), CSPFT_FX}, - {"lightFxTag1", offsetof(VehicleDef, lightFxTag[0]), CSPFT_SCRIPT_STRING}, - {"lightFxName2", offsetof(VehicleDef, lightFx[1]), CSPFT_FX}, - {"lightFxTag2", offsetof(VehicleDef, lightFxTag[1]), CSPFT_SCRIPT_STRING}, - {"lightFxName3", offsetof(VehicleDef, lightFx[2]), CSPFT_FX}, - {"lightFxTag3", offsetof(VehicleDef, lightFxTag[2]), CSPFT_SCRIPT_STRING}, - {"lightFxName4", offsetof(VehicleDef, lightFx[3]), CSPFT_FX}, - {"lightFxTag4", offsetof(VehicleDef, lightFxTag[3]), CSPFT_SCRIPT_STRING}, - {"FriendlyLightFxName", offsetof(VehicleDef, friendlyLightFx), CSPFT_FX}, - {"FriendlyLightFxTag", offsetof(VehicleDef, friendlyLightFxTag), CSPFT_SCRIPT_STRING}, - {"EnemyLightFxName", offsetof(VehicleDef, enemyLightFx), CSPFT_FX}, - {"EnemyLightFxTag", offsetof(VehicleDef, enemyLightFxTag), CSPFT_SCRIPT_STRING}, - {"radiusDamageMin", offsetof(VehicleDef, radiusDamageMin), CSPFT_FLOAT}, - {"radiusDamageMax", offsetof(VehicleDef, radiusDamageMax), CSPFT_FLOAT}, - {"radiusDamageRadius", offsetof(VehicleDef, radiusDamageRadius), CSPFT_FLOAT}, - {"shootShock", offsetof(VehicleDef, shootShock), CSPFT_STRING}, - {"shootRumble", offsetof(VehicleDef, shootRumble), CSPFT_STRING}, - {"deathQuakeScale", offsetof(VehicleDef, deathQuakeScale), CSPFT_FLOAT}, - {"deathQuakeDuration", offsetof(VehicleDef, deathQuakeDuration), CSPFT_FLOAT}, - {"deathQuakeRadius", offsetof(VehicleDef, deathQuakeRadius), CSPFT_FLOAT}, - {"rumbleType", offsetof(VehicleDef, rumbleType), CSPFT_STRING}, - {"rumbleScale", offsetof(VehicleDef, rumbleScale), CSPFT_FLOAT}, - {"rumbleDuration", offsetof(VehicleDef, rumbleDuration), CSPFT_FLOAT}, - {"rumbleRadius", offsetof(VehicleDef, rumbleRadius), CSPFT_FLOAT}, - {"rumbleBaseTime", offsetof(VehicleDef, rumbleBaseTime), CSPFT_FLOAT}, - {"rumbleAdditionalTime", offsetof(VehicleDef, rumbleAdditionalTime), CSPFT_FLOAT}, - {"healthDefault", offsetof(VehicleDef, healthDefault), CSPFT_INT}, - {"healthMin", offsetof(VehicleDef, healthMin), CSPFT_INT}, - {"healthMax", offsetof(VehicleDef, healthMax), CSPFT_INT}, - {"team", offsetof(VehicleDef, eTeam), VFT_TEAM}, - {"boostAccelMultiplier", offsetof(VehicleDef, boostAccelMultiplier), CSPFT_INT}, - {"boostDuration", offsetof(VehicleDef, boostDuration), CSPFT_FLOAT}, - {"boostSpeedIncrease", offsetof(VehicleDef, boostSpeedIncrease), CSPFT_FLOAT}, - {"addToCompass", offsetof(VehicleDef, addToCompass), CSPFT_QBOOLEAN}, - {"addToCompassEnemy", offsetof(VehicleDef, addToCompassEnemy), CSPFT_QBOOLEAN}, - {"compassIcon", offsetof(VehicleDef, compassIcon), CSPFT_STRING}, - {"gasButton", offsetof(VehicleDef, gasButtonName), CSPFT_STRING}, - {"reverseBrakeButton", offsetof(VehicleDef, reverseBrakeButtonName), CSPFT_STRING}, - {"handBrakeButton", offsetof(VehicleDef, handBrakeButtonName), CSPFT_STRING}, - {"attackButton", offsetof(VehicleDef, attackButtonName), CSPFT_STRING}, - {"attackSecondaryButton", offsetof(VehicleDef, attackSecondaryButtonName), CSPFT_STRING}, - {"moveUpButton", offsetof(VehicleDef, moveUpButtonName), CSPFT_STRING}, - {"moveDownButton", offsetof(VehicleDef, moveDownButtonName), CSPFT_STRING}, - {"switchSeatButton", offsetof(VehicleDef, switchSeatButtonName), CSPFT_STRING}, - {"boostButton", offsetof(VehicleDef, boostButtonName), CSPFT_STRING}, - {"steerGraph", offsetof(VehicleDef, steerGraphName), CSPFT_STRING}, - {"accelGraph", offsetof(VehicleDef, accelGraphName), CSPFT_STRING}, - {"isNitrous", offsetof(VehicleDef, isNitrous), CSPFT_QBOOLEAN}, - {"isFourWheelSteering", offsetof(VehicleDef, isFourWheelSteering), CSPFT_QBOOLEAN}, - {"useCollmap", offsetof(VehicleDef, useCollmap), CSPFT_QBOOLEAN}, - {"radius", offsetof(VehicleDef, radius), CSPFT_FLOAT}, - {"minHeight", offsetof(VehicleDef, minHeight), CSPFT_FLOAT}, - {"maxHeight", offsetof(VehicleDef, maxHeight), CSPFT_FLOAT}, - {"noDirectionalDamage", offsetof(VehicleDef, noDirectionalDamage), CSPFT_QBOOLEAN}, - {"max_fric_tilt_angle", offsetof(VehicleDef, max_fric_tilt_angle), CSPFT_FLOAT}, - {"max_fric_tilt", offsetof(VehicleDef, max_fric_tilt), CSPFT_FLOAT}, - {"fakeBodyStabilizer", offsetof(VehicleDef, fakeBodyStabilizer), CSPFT_QBOOLEAN}, - {"vehHelicopterBoundsRadius", offsetof(VehicleDef, vehHelicopterBoundsRadius), CSPFT_FLOAT}, - {"vehHelicopterDecelerationFwd", offsetof(VehicleDef, vehHelicopterDecelerationFwd), CSPFT_FLOAT}, - {"vehHelicopterDecelerationSide", offsetof(VehicleDef, vehHelicopterDecelerationSide), CSPFT_FLOAT}, - {"vehHelicopterDecelerationUp", offsetof(VehicleDef, vehHelicopterDecelerationUp), CSPFT_FLOAT}, - {"vehHelicopterTiltFromControllerAxes", offsetof(VehicleDef, vehHelicopterTiltFromControllerAxes), CSPFT_FLOAT}, - {"vehHelicopterTiltFromFwdAndYaw", offsetof(VehicleDef, vehHelicopterTiltFromFwdAndYaw), CSPFT_FLOAT}, - {"vehHelicopterTiltFromFwdAndYaw_VelAtMaxTilt", offsetof(VehicleDef, vehHelicopterTiltFromFwdAndYaw_VelAtMaxTilt), CSPFT_FLOAT}, - {"vehHelicopterTiltMomentum", offsetof(VehicleDef, vehHelicopterTiltMomentum), CSPFT_FLOAT}, - {"vehHelicopterQuadRotor", offsetof(VehicleDef, vehHelicopterQuadRotor), CSPFT_QBOOLEAN}, - {"vehHelicopterAccelTwardsView", offsetof(VehicleDef, vehHelicopterAccelTwardsView), CSPFT_QBOOLEAN}, - {"maxRotorArmMovementAngle", offsetof(VehicleDef, maxRotorArmMovementAngle), CSPFT_FLOAT}, - {"maxRotorArmRotationAngle", offsetof(VehicleDef, maxRotorArmRotationAngle), CSPFT_FLOAT}, - {"vehHelicopterMaintainHeight", offsetof(VehicleDef, vehHelicopterMaintainHeight), CSPFT_QBOOLEAN}, - {"vehHelicopterMaintainMaxHeight", offsetof(VehicleDef, vehHelicopterMaintainMaxHeight), CSPFT_QBOOLEAN}, - {"vehHelicopterMaintainHeightLimit", offsetof(VehicleDef, vehHelicopterMaintainHeightLimit), CSPFT_FLOAT}, - {"vehHelicopterMaintainHeightAccel", offsetof(VehicleDef, vehHelicopterMaintainHeightAccel), CSPFT_FLOAT}, - {"vehHelicopterMaintainHeightMinimum", offsetof(VehicleDef, vehHelicopterMaintainHeightMinimum), CSPFT_FLOAT}, - {"vehHelicopterMaintainHeightMaximum", offsetof(VehicleDef, vehHelicopterMaintainHeightMaximum), CSPFT_FLOAT}, - {"vehHelicopterMaintainCeilingMinimum", offsetof(VehicleDef, vehHelicopterMaintainCeilingMinimum), CSPFT_FLOAT}, - {"joltVehicle", offsetof(VehicleDef, joltVehicle), CSPFT_QBOOLEAN}, - {"joltVehicleDriver", offsetof(VehicleDef, joltVehicleDriver), CSPFT_QBOOLEAN}, - {"joltMaxTime", offsetof(VehicleDef, joltMaxTime), CSPFT_FLOAT}, - {"joltTime", offsetof(VehicleDef, joltTime), CSPFT_FLOAT}, - {"joltWaves", offsetof(VehicleDef, joltWaves), CSPFT_FLOAT}, - {"joltIntensity", offsetof(VehicleDef, joltIntensity), CSPFT_FLOAT}, - {"nitrous_max_speed", offsetof(VehicleDef, nitrousVehParams.m_speed_max), VFT_MPH_TO_INCHES_PER_SECOND}, - {"nitrous_accel", offsetof(VehicleDef, nitrousVehParams.m_accel_max), VFT_MPH_TO_INCHES_PER_SECOND}, - {"nitrous_auto_handbrake_min_speed", offsetof(VehicleDef, nitrousVehParams.m_auto_hand_brake_min_speed), VFT_MPH_TO_INCHES_PER_SECOND}, - {"nitrous_steer_angle_max", offsetof(VehicleDef, nitrousVehParams.m_steer_angle_max), CSPFT_FLOAT}, - {"nitrous_steer_angle_speed_scale", offsetof(VehicleDef, nitrousVehParams.m_steer_angle_speed_scale), CSPFT_FLOAT}, - {"nitrous_steer_speed", offsetof(VehicleDef, nitrousVehParams.m_steer_speed), CSPFT_FLOAT}, - {"nitrous_body_mass", offsetof(VehicleDef, nitrousVehParams.m_body_mass), VFT_POUNDS_TO_GAME_MASS}, - {"nitrous_wheel_radius", offsetof(VehicleDef, nitrousVehParams.m_wheel_radius), CSPFT_FLOAT}, - {"nitrous_susp_adj", offsetof(VehicleDef, nitrousVehParams.m_susp_adj), CSPFT_FLOAT}, - {"nitrous_susp_spring_k", offsetof(VehicleDef, nitrousVehParams.m_susp_spring_k), CSPFT_FLOAT}, - {"nitrous_susp_damp_k", offsetof(VehicleDef, nitrousVehParams.m_susp_damp_k), CSPFT_FLOAT}, - {"nitrous_susp_hard_limit", offsetof(VehicleDef, nitrousVehParams.m_susp_hard_limit), CSPFT_FLOAT}, - {"nitrous_susp_min_height", offsetof(VehicleDef, nitrousVehParams.m_susp_min_height), CSPFT_FLOAT}, - {"nitrous_tire_damp_hand", offsetof(VehicleDef, nitrousVehParams.m_tire_damp_hand), CSPFT_FLOAT}, - {"nitrous_tire_damp_brake", offsetof(VehicleDef, nitrousVehParams.m_tire_damp_brake), CSPFT_FLOAT}, - {"nitrous_tire_damp_coast", offsetof(VehicleDef, nitrousVehParams.m_tire_damp_coast), CSPFT_FLOAT}, - {"nitrous_tire_fric_brake", offsetof(VehicleDef, nitrousVehParams.m_tire_fric_brake), CSPFT_FLOAT}, - {"nitrous_tire_fric_hand_brake", offsetof(VehicleDef, nitrousVehParams.m_tire_fric_hand_brake), CSPFT_FLOAT}, - {"nitrous_tire_fric_fwd", offsetof(VehicleDef, nitrousVehParams.m_tire_fric_fwd), CSPFT_FLOAT}, - {"nitrous_tire_fric_side", offsetof(VehicleDef, nitrousVehParams.m_tire_fric_side), CSPFT_FLOAT}, - {"nitrous_roll_stability", offsetof(VehicleDef, nitrousVehParams.m_roll_stability), CSPFT_FLOAT}, - {"nitrous_pitch_stability", offsetof(VehicleDef, nitrousVehParams.m_pitch_stability), CSPFT_FLOAT}, - {"nitrous_roll_resistance", offsetof(VehicleDef, nitrousVehParams.m_pitch_roll_resistance), CSPFT_FLOAT}, - {"nitrous_yaw_resistance", offsetof(VehicleDef, nitrousVehParams.m_yaw_resistance), CSPFT_FLOAT}, - {"nitrous_upright_strength", offsetof(VehicleDef, nitrousVehParams.m_upright_strength), CSPFT_FLOAT}, - {"nitrous_tilt_fakey", offsetof(VehicleDef, nitrousVehParams.m_tilt_fakey), CSPFT_FLOAT}, - {"nitrous_traction_type", offsetof(VehicleDef, nitrousVehParams.m_traction_type), VFT_TRACTION_TYPE}, - {"nitrous_peel_out_max_speed", offsetof(VehicleDef, nitrousVehParams.m_peel_out_max_speed), CSPFT_FLOAT}, - {"nitrous_tire_fric_side_max", offsetof(VehicleDef, nitrousVehParams.m_tire_fric_side_max), CSPFT_FLOAT}, - {"nitrous_reverse_scale", offsetof(VehicleDef, nitrousVehParams.m_reverse_scale), CSPFT_FLOAT}, - {"nitrous_water_speed_max", offsetof(VehicleDef, nitrousVehParams.m_water_speed_max), VFT_MPH_TO_INCHES_PER_SECOND}, - {"nitrous_water_accel_max", offsetof(VehicleDef, nitrousVehParams.m_water_accel_max), CSPFT_FLOAT}, - {"nitrous_water_turn_accel", offsetof(VehicleDef, nitrousVehParams.m_water_turn_accel), CSPFT_FLOAT}, - {"nitrous_water_turn_speed_max", offsetof(VehicleDef, nitrousVehParams.m_water_turn_speed_max), CSPFT_FLOAT}, - {"nitrous_boat_ebrake_power", offsetof(VehicleDef, nitrousVehParams.m_water_ebrake_power), CSPFT_FLOAT}, - {"nitrous_bbox_min_x", offsetof(VehicleDef, nitrousVehParams.m_bbox_min.x), CSPFT_FLOAT}, - {"nitrous_bbox_min_y", offsetof(VehicleDef, nitrousVehParams.m_bbox_min.y), CSPFT_FLOAT}, - {"nitrous_bbox_min_z", offsetof(VehicleDef, nitrousVehParams.m_bbox_min.z), CSPFT_FLOAT}, - {"nitrous_bbox_max_x", offsetof(VehicleDef, nitrousVehParams.m_bbox_max.x), CSPFT_FLOAT}, - {"nitrous_bbox_max_y", offsetof(VehicleDef, nitrousVehParams.m_bbox_max.y), CSPFT_FLOAT}, - {"nitrous_bbox_max_z", offsetof(VehicleDef, nitrousVehParams.m_bbox_max.z), CSPFT_FLOAT}, - {"nitrous_mass_center_offset_x", offsetof(VehicleDef, nitrousVehParams.m_mass_center_offset.x), CSPFT_FLOAT}, - {"nitrous_mass_center_offset_y", offsetof(VehicleDef, nitrousVehParams.m_mass_center_offset.y), CSPFT_FLOAT}, - {"nitrous_mass_center_offset_z", offsetof(VehicleDef, nitrousVehParams.m_mass_center_offset.z), CSPFT_FLOAT}, - {"nitrous_buoyancybox_min_x", offsetof(VehicleDef, nitrousVehParams.m_buoyancybox_min.x), CSPFT_FLOAT}, - {"nitrous_buoyancybox_min_y", offsetof(VehicleDef, nitrousVehParams.m_buoyancybox_min.y), CSPFT_FLOAT}, - {"nitrous_buoyancybox_min_z", offsetof(VehicleDef, nitrousVehParams.m_buoyancybox_min.z), CSPFT_FLOAT}, - {"nitrous_buoyancybox_max_x", offsetof(VehicleDef, nitrousVehParams.m_buoyancybox_max.x), CSPFT_FLOAT}, - {"nitrous_buoyancybox_max_y", offsetof(VehicleDef, nitrousVehParams.m_buoyancybox_max.y), CSPFT_FLOAT}, - {"nitrous_buoyancybox_max_z", offsetof(VehicleDef, nitrousVehParams.m_buoyancybox_max.z), CSPFT_FLOAT}, - {"nitrous_boat_speed_rise", offsetof(VehicleDef, nitrousVehParams.m_boat_speed_rise), CSPFT_FLOAT}, - {"nitrous_boat_speed_tilt", offsetof(VehicleDef, nitrousVehParams.m_boat_speed_tilt), CSPFT_FLOAT}, - {"nitrous_boat_motor_offset_x", offsetof(VehicleDef, nitrousVehParams.m_boat_motor_offset.x), CSPFT_FLOAT}, - {"nitrous_boat_motor_offset_y", offsetof(VehicleDef, nitrousVehParams.m_boat_motor_offset.y), CSPFT_FLOAT}, - {"nitrous_boat_motor_offset_z", offsetof(VehicleDef, nitrousVehParams.m_boat_motor_offset.z), CSPFT_FLOAT}, - {"nitrous_boat_side_fric", offsetof(VehicleDef, nitrousVehParams.m_boat_side_fric_scale), CSPFT_FLOAT}, - {"nitrous_boat_forward_fric", offsetof(VehicleDef, nitrousVehParams.m_boat_forward_fric_scale), CSPFT_FLOAT}, - {"nitrous_boat_vertical_fric", offsetof(VehicleDef, nitrousVehParams.m_boat_vertical_fric_scale), CSPFT_FLOAT}, - {"nitrous_drive_on_walls", offsetof(VehicleDef, nitrousVehParams.m_drive_on_walls), CSPFT_BOOL}, - {"nitrous_linear_drag_scale", offsetof(VehicleDef, nitrousVehParams.m_linear_drag_scale), CSPFT_FLOAT}, - {"nitrous_angular_drag_scale", offsetof(VehicleDef, nitrousVehParams.m_angular_drag_scale), CSPFT_FLOAT}, - {"nitrous_jump_force", offsetof(VehicleDef, nitrousVehParams.m_jump_force), CSPFT_FLOAT}, - {"p_driveby_sound_radius", offsetof(VehicleDef, driveBySoundRadius[0]), CSPFT_FLOAT}, - {"s_driveby_sound_radius", offsetof(VehicleDef, driveBySoundRadius[1]), CSPFT_FLOAT}, - {"p_drive_by_sound_apex0", offsetof(VehicleDef, driveBySounds[0].apex), CSPFT_INT}, - {"p_drive_by_sound_name0", offsetof(VehicleDef, driveBySounds[0].name), CSPFT_STRING}, - {"p_drive_by_sound_apex1", offsetof(VehicleDef, driveBySounds[1].apex), CSPFT_INT}, - {"p_drive_by_sound_name1", offsetof(VehicleDef, driveBySounds[1].name), CSPFT_STRING}, - {"p_drive_by_sound_apex2", offsetof(VehicleDef, driveBySounds[2].apex), CSPFT_INT}, - {"p_drive_by_sound_name2", offsetof(VehicleDef, driveBySounds[2].name), CSPFT_STRING}, - {"p_drive_by_sound_apex3", offsetof(VehicleDef, driveBySounds[3].apex), CSPFT_INT}, - {"p_drive_by_sound_name3", offsetof(VehicleDef, driveBySounds[3].name), CSPFT_STRING}, - {"p_drive_by_sound_apex4", offsetof(VehicleDef, driveBySounds[4].apex), CSPFT_INT}, - {"p_drive_by_sound_name4", offsetof(VehicleDef, driveBySounds[4].name), CSPFT_STRING}, - {"p_drive_by_sound_apex5", offsetof(VehicleDef, driveBySounds[5].apex), CSPFT_INT}, - {"p_drive_by_sound_name5", offsetof(VehicleDef, driveBySounds[5].name), CSPFT_STRING}, - {"p_drive_by_sound_apex6", offsetof(VehicleDef, driveBySounds[6].apex), CSPFT_INT}, - {"p_drive_by_sound_name6", offsetof(VehicleDef, driveBySounds[6].name), CSPFT_STRING}, - {"p_drive_by_sound_apex7", offsetof(VehicleDef, driveBySounds[7].apex), CSPFT_INT}, - {"p_drive_by_sound_name7", offsetof(VehicleDef, driveBySounds[7].name), CSPFT_STRING}, - {"p_drive_by_sound_apex8", offsetof(VehicleDef, driveBySounds[8].apex), CSPFT_INT}, - {"p_drive_by_sound_name8", offsetof(VehicleDef, driveBySounds[8].name), CSPFT_STRING}, - {"p_drive_by_sound_apex9", offsetof(VehicleDef, driveBySounds[9].apex), CSPFT_INT}, - {"p_drive_by_sound_name9", offsetof(VehicleDef, driveBySounds[9].name), CSPFT_STRING}, - {"p_drive_by_sound_apex10", offsetof(VehicleDef, driveBySounds[10].apex), CSPFT_INT}, - {"p_drive_by_sound_name10", offsetof(VehicleDef, driveBySounds[10].name), CSPFT_STRING}, - {"p_drive_by_sound_apex11", offsetof(VehicleDef, driveBySounds[11].apex), CSPFT_INT}, - {"p_drive_by_sound_name11", offsetof(VehicleDef, driveBySounds[11].name), CSPFT_STRING}, - {"p_drive_by_sound_apex12", offsetof(VehicleDef, driveBySounds[12].apex), CSPFT_INT}, - {"p_drive_by_sound_name12", offsetof(VehicleDef, driveBySounds[12].name), CSPFT_STRING}, - {"p_drive_by_sound_apex13", offsetof(VehicleDef, driveBySounds[13].apex), CSPFT_INT}, - {"p_drive_by_sound_name13", offsetof(VehicleDef, driveBySounds[13].name), CSPFT_STRING}, - {"p_drive_by_sound_apex14", offsetof(VehicleDef, driveBySounds[14].apex), CSPFT_INT}, - {"p_drive_by_sound_name14", offsetof(VehicleDef, driveBySounds[14].name), CSPFT_STRING}, - {"p_drive_by_sound_apex15", offsetof(VehicleDef, driveBySounds[15].apex), CSPFT_INT}, - {"p_drive_by_sound_name15", offsetof(VehicleDef, driveBySounds[15].name), CSPFT_STRING}, - {"p_drive_by_sound_apex16", offsetof(VehicleDef, driveBySounds[16].apex), CSPFT_INT}, - {"p_drive_by_sound_name16", offsetof(VehicleDef, driveBySounds[16].name), CSPFT_STRING}, - {"p_drive_by_sound_apex17", offsetof(VehicleDef, driveBySounds[17].apex), CSPFT_INT}, - {"p_drive_by_sound_name17", offsetof(VehicleDef, driveBySounds[17].name), CSPFT_STRING}, - {"p_drive_by_sound_apex18", offsetof(VehicleDef, driveBySounds[18].apex), CSPFT_INT}, - {"p_drive_by_sound_name18", offsetof(VehicleDef, driveBySounds[18].name), CSPFT_STRING}, - {"p_drive_by_sound_apex19", offsetof(VehicleDef, driveBySounds[19].apex), CSPFT_INT}, - {"p_drive_by_sound_name19", offsetof(VehicleDef, driveBySounds[19].name), CSPFT_STRING}, - {"s_drive_by_sound_apex0", offsetof(VehicleDef, driveBySounds[20].apex), CSPFT_INT}, - {"s_drive_by_sound_name0", offsetof(VehicleDef, driveBySounds[20].name), CSPFT_STRING}, - {"s_drive_by_sound_apex1", offsetof(VehicleDef, driveBySounds[21].apex), CSPFT_INT}, - {"s_drive_by_sound_name1", offsetof(VehicleDef, driveBySounds[21].name), CSPFT_STRING}, - {"s_drive_by_sound_apex2", offsetof(VehicleDef, driveBySounds[22].apex), CSPFT_INT}, - {"s_drive_by_sound_name2", offsetof(VehicleDef, driveBySounds[22].name), CSPFT_STRING}, - {"s_drive_by_sound_apex3", offsetof(VehicleDef, driveBySounds[23].apex), CSPFT_INT}, - {"s_drive_by_sound_name3", offsetof(VehicleDef, driveBySounds[23].name), CSPFT_STRING}, - {"s_drive_by_sound_apex4", offsetof(VehicleDef, driveBySounds[24].apex), CSPFT_INT}, - {"s_drive_by_sound_name4", offsetof(VehicleDef, driveBySounds[24].name), CSPFT_STRING}, - {"s_drive_by_sound_apex5", offsetof(VehicleDef, driveBySounds[25].apex), CSPFT_INT}, - {"s_drive_by_sound_name5", offsetof(VehicleDef, driveBySounds[25].name), CSPFT_STRING}, - {"s_drive_by_sound_apex6", offsetof(VehicleDef, driveBySounds[26].apex), CSPFT_INT}, - {"s_drive_by_sound_name6", offsetof(VehicleDef, driveBySounds[26].name), CSPFT_STRING}, - {"s_drive_by_sound_apex7", offsetof(VehicleDef, driveBySounds[27].apex), CSPFT_INT}, - {"s_drive_by_sound_name7", offsetof(VehicleDef, driveBySounds[27].name), CSPFT_STRING}, - {"s_drive_by_sound_apex8", offsetof(VehicleDef, driveBySounds[28].apex), CSPFT_INT}, - {"s_drive_by_sound_name8", offsetof(VehicleDef, driveBySounds[28].name), CSPFT_STRING}, - {"s_drive_by_sound_apex9", offsetof(VehicleDef, driveBySounds[29].apex), CSPFT_INT}, - {"s_drive_by_sound_name9", offsetof(VehicleDef, driveBySounds[29].name), CSPFT_STRING}, - {"s_drive_by_sound_apex10", offsetof(VehicleDef, driveBySounds[30].apex), CSPFT_INT}, - {"s_drive_by_sound_name10", offsetof(VehicleDef, driveBySounds[30].name), CSPFT_STRING}, - {"s_drive_by_sound_apex11", offsetof(VehicleDef, driveBySounds[31].apex), CSPFT_INT}, - {"s_drive_by_sound_name11", offsetof(VehicleDef, driveBySounds[31].name), CSPFT_STRING}, - {"s_drive_by_sound_apex12", offsetof(VehicleDef, driveBySounds[32].apex), CSPFT_INT}, - {"s_drive_by_sound_name12", offsetof(VehicleDef, driveBySounds[32].name), CSPFT_STRING}, - {"s_drive_by_sound_apex13", offsetof(VehicleDef, driveBySounds[33].apex), CSPFT_INT}, - {"s_drive_by_sound_name13", offsetof(VehicleDef, driveBySounds[33].name), CSPFT_STRING}, - {"s_drive_by_sound_apex14", offsetof(VehicleDef, driveBySounds[34].apex), CSPFT_INT}, - {"s_drive_by_sound_name14", offsetof(VehicleDef, driveBySounds[34].name), CSPFT_STRING}, - {"s_drive_by_sound_apex15", offsetof(VehicleDef, driveBySounds[35].apex), CSPFT_INT}, - {"s_drive_by_sound_name15", offsetof(VehicleDef, driveBySounds[35].name), CSPFT_STRING}, - {"s_drive_by_sound_apex16", offsetof(VehicleDef, driveBySounds[36].apex), CSPFT_INT}, - {"s_drive_by_sound_name16", offsetof(VehicleDef, driveBySounds[36].name), CSPFT_STRING}, - {"s_drive_by_sound_apex17", offsetof(VehicleDef, driveBySounds[37].apex), CSPFT_INT}, - {"s_drive_by_sound_name17", offsetof(VehicleDef, driveBySounds[37].name), CSPFT_STRING}, - {"s_drive_by_sound_apex18", offsetof(VehicleDef, driveBySounds[38].apex), CSPFT_INT}, - {"s_drive_by_sound_name18", offsetof(VehicleDef, driveBySounds[38].name), CSPFT_STRING}, - {"s_drive_by_sound_apex19", offsetof(VehicleDef, driveBySounds[39].apex), CSPFT_INT}, - {"s_drive_by_sound_name19", offsetof(VehicleDef, driveBySounds[39].name), CSPFT_STRING}, - {"doFootSteps", offsetof(VehicleDef, doFootSteps), CSPFT_BOOL}, - {"isSentient", offsetof(VehicleDef, isSentient), CSPFT_BOOL}, - {"idleRpms", offsetof(VehicleDef, engine.idleRpms), CSPFT_FLOAT}, - {"maxRpms", offsetof(VehicleDef, engine.maxRpms), CSPFT_FLOAT}, - {"maxTorque", offsetof(VehicleDef, engine.maxTorque), CSPFT_FLOAT}, - {"brakingCoeff", offsetof(VehicleDef, engine.brakingCoeff), CSPFT_FLOAT}, - {"onLoadFadeInStart", offsetof(VehicleDef, engine.loadFadeParams.x), CSPFT_FLOAT}, - {"onLoadFadeInEnd", offsetof(VehicleDef, engine.loadFadeParams.y), CSPFT_FLOAT}, - {"offLoadFadeOutStart", offsetof(VehicleDef, engine.loadFadeParams.z), CSPFT_FLOAT}, - {"offLoadFadeOutEnd", offsetof(VehicleDef, engine.loadFadeParams.w), CSPFT_FLOAT}, - {"loadScale", offsetof(VehicleDef, engine.loadScale), CSPFT_FLOAT}, - {"loadSmooting", offsetof(VehicleDef, engine.loadSmoothing), CSPFT_FLOAT}, - {"throttleLag", offsetof(VehicleDef, engine.throttleLag), CSPFT_FLOAT}, - {"pitchScale", offsetof(VehicleDef, engine.pitchScale), CSPFT_FLOAT}, - {"on_engsnd_name0", offsetof(VehicleDef, engine.onload[0].name), CSPFT_STRING}, - {"on_engsnd_fade_in_start0", offsetof(VehicleDef, engine.onload[0].params[VEH_ENGINESND_FADE_IN_START]), CSPFT_FLOAT}, - {"on_engsnd_fade_in_end0", offsetof(VehicleDef, engine.onload[0].params[VEH_ENGINESND_FADE_IN_END]), CSPFT_FLOAT}, - {"on_engsnd_fade_out_start0", offsetof(VehicleDef, engine.onload[0].params[VEH_ENGINESND_FADE_OUT_START]), CSPFT_FLOAT}, - {"on_engsnd_fade_out_end0", offsetof(VehicleDef, engine.onload[0].params[VEH_ENGINESND_FADE_OUT_END]), CSPFT_FLOAT}, - {"on_engsnd_pitch_ref0", offsetof(VehicleDef, engine.onload[0].params[VEH_ENGINESND_PITCH_REF]), CSPFT_FLOAT}, - {"on_engsnd_name1", offsetof(VehicleDef, engine.onload[1].name), CSPFT_STRING}, - {"on_engsnd_fade_in_start1", offsetof(VehicleDef, engine.onload[1].params[VEH_ENGINESND_FADE_IN_START]), CSPFT_FLOAT}, - {"on_engsnd_fade_in_end1", offsetof(VehicleDef, engine.onload[1].params[VEH_ENGINESND_FADE_IN_END]), CSPFT_FLOAT}, - {"on_engsnd_fade_out_start1", offsetof(VehicleDef, engine.onload[1].params[VEH_ENGINESND_FADE_OUT_START]), CSPFT_FLOAT}, - {"on_engsnd_fade_out_end1", offsetof(VehicleDef, engine.onload[1].params[VEH_ENGINESND_FADE_OUT_END]), CSPFT_FLOAT}, - {"on_engsnd_pitch_ref1", offsetof(VehicleDef, engine.onload[1].params[VEH_ENGINESND_PITCH_REF]), CSPFT_FLOAT}, - {"on_engsnd_name2", offsetof(VehicleDef, engine.onload[2].name), CSPFT_STRING}, - {"on_engsnd_fade_in_start2", offsetof(VehicleDef, engine.onload[2].params[VEH_ENGINESND_FADE_IN_START]), CSPFT_FLOAT}, - {"on_engsnd_fade_in_end2", offsetof(VehicleDef, engine.onload[2].params[VEH_ENGINESND_FADE_IN_END]), CSPFT_FLOAT}, - {"on_engsnd_fade_out_start2", offsetof(VehicleDef, engine.onload[2].params[VEH_ENGINESND_FADE_OUT_START]), CSPFT_FLOAT}, - {"on_engsnd_fade_out_end2", offsetof(VehicleDef, engine.onload[2].params[VEH_ENGINESND_FADE_OUT_END]), CSPFT_FLOAT}, - {"on_engsnd_pitch_ref2", offsetof(VehicleDef, engine.onload[2].params[VEH_ENGINESND_PITCH_REF]), CSPFT_FLOAT}, - {"on_engsnd_name3", offsetof(VehicleDef, engine.onload[3].name), CSPFT_STRING}, - {"on_engsnd_fade_in_start3", offsetof(VehicleDef, engine.onload[3].params[VEH_ENGINESND_FADE_IN_START]), CSPFT_FLOAT}, - {"on_engsnd_fade_in_end3", offsetof(VehicleDef, engine.onload[3].params[VEH_ENGINESND_FADE_IN_END]), CSPFT_FLOAT}, - {"on_engsnd_fade_out_start3", offsetof(VehicleDef, engine.onload[3].params[VEH_ENGINESND_FADE_OUT_START]), CSPFT_FLOAT}, - {"on_engsnd_fade_out_end3", offsetof(VehicleDef, engine.onload[3].params[VEH_ENGINESND_FADE_OUT_END]), CSPFT_FLOAT}, - {"on_engsnd_pitch_ref3", offsetof(VehicleDef, engine.onload[3].params[VEH_ENGINESND_PITCH_REF]), CSPFT_FLOAT}, - {"on_engsnd_name4", offsetof(VehicleDef, engine.onload[4].name), CSPFT_STRING}, - {"on_engsnd_fade_in_start4", offsetof(VehicleDef, engine.onload[4].params[VEH_ENGINESND_FADE_IN_START]), CSPFT_FLOAT}, - {"on_engsnd_fade_in_end4", offsetof(VehicleDef, engine.onload[4].params[VEH_ENGINESND_FADE_IN_END]), CSPFT_FLOAT}, - {"on_engsnd_fade_out_start4", offsetof(VehicleDef, engine.onload[4].params[VEH_ENGINESND_FADE_OUT_START]), CSPFT_FLOAT}, - {"on_engsnd_fade_out_end4", offsetof(VehicleDef, engine.onload[4].params[VEH_ENGINESND_FADE_OUT_END]), CSPFT_FLOAT}, - {"on_engsnd_pitch_ref4", offsetof(VehicleDef, engine.onload[4].params[VEH_ENGINESND_PITCH_REF]), CSPFT_FLOAT}, - {"off_engsnd_name0", offsetof(VehicleDef, engine.offload[0].name), CSPFT_STRING}, - {"off_engsnd_fade_in_start0", offsetof(VehicleDef, engine.offload[0].params[VEH_ENGINESND_FADE_IN_START]), CSPFT_FLOAT}, - {"off_engsnd_fade_in_end0", offsetof(VehicleDef, engine.offload[0].params[VEH_ENGINESND_FADE_IN_END]), CSPFT_FLOAT}, - {"off_engsnd_fade_out_start0", offsetof(VehicleDef, engine.offload[0].params[VEH_ENGINESND_FADE_OUT_START]), CSPFT_FLOAT}, - {"off_engsnd_fade_out_end0", offsetof(VehicleDef, engine.offload[0].params[VEH_ENGINESND_FADE_OUT_END]), CSPFT_FLOAT}, - {"off_engsnd_pitch_ref0", offsetof(VehicleDef, engine.offload[0].params[VEH_ENGINESND_PITCH_REF]), CSPFT_FLOAT}, - {"off_engsnd_name1", offsetof(VehicleDef, engine.offload[1].name), CSPFT_STRING}, - {"off_engsnd_fade_in_start1", offsetof(VehicleDef, engine.offload[1].params[VEH_ENGINESND_FADE_IN_START]), CSPFT_FLOAT}, - {"off_engsnd_fade_in_end1", offsetof(VehicleDef, engine.offload[1].params[VEH_ENGINESND_FADE_IN_END]), CSPFT_FLOAT}, - {"off_engsnd_fade_out_start1", offsetof(VehicleDef, engine.offload[1].params[VEH_ENGINESND_FADE_OUT_START]), CSPFT_FLOAT}, - {"off_engsnd_fade_out_end1", offsetof(VehicleDef, engine.offload[1].params[VEH_ENGINESND_FADE_OUT_END]), CSPFT_FLOAT}, - {"off_engsnd_pitch_ref1", offsetof(VehicleDef, engine.offload[1].params[VEH_ENGINESND_PITCH_REF]), CSPFT_FLOAT}, - {"off_engsnd_name2", offsetof(VehicleDef, engine.offload[2].name), CSPFT_STRING}, - {"off_engsnd_fade_in_start2", offsetof(VehicleDef, engine.offload[2].params[VEH_ENGINESND_FADE_IN_START]), CSPFT_FLOAT}, - {"off_engsnd_fade_in_end2", offsetof(VehicleDef, engine.offload[2].params[VEH_ENGINESND_FADE_IN_END]), CSPFT_FLOAT}, - {"off_engsnd_fade_out_start2", offsetof(VehicleDef, engine.offload[2].params[VEH_ENGINESND_FADE_OUT_START]), CSPFT_FLOAT}, - {"off_engsnd_fade_out_end2", offsetof(VehicleDef, engine.offload[2].params[VEH_ENGINESND_FADE_OUT_END]), CSPFT_FLOAT}, - {"off_engsnd_pitch_ref2", offsetof(VehicleDef, engine.offload[2].params[VEH_ENGINESND_PITCH_REF]), CSPFT_FLOAT}, - {"off_engsnd_name3", offsetof(VehicleDef, engine.offload[3].name), CSPFT_STRING}, - {"off_engsnd_fade_in_start3", offsetof(VehicleDef, engine.offload[3].params[VEH_ENGINESND_FADE_IN_START]), CSPFT_FLOAT}, - {"off_engsnd_fade_in_end3", offsetof(VehicleDef, engine.offload[3].params[VEH_ENGINESND_FADE_IN_END]), CSPFT_FLOAT}, - {"off_engsnd_fade_out_start3", offsetof(VehicleDef, engine.offload[3].params[VEH_ENGINESND_FADE_OUT_START]), CSPFT_FLOAT}, - {"off_engsnd_fade_out_end3", offsetof(VehicleDef, engine.offload[3].params[VEH_ENGINESND_FADE_OUT_END]), CSPFT_FLOAT}, - {"off_engsnd_pitch_ref3", offsetof(VehicleDef, engine.offload[3].params[VEH_ENGINESND_PITCH_REF]), CSPFT_FLOAT}, - {"off_engsnd_name4", offsetof(VehicleDef, engine.offload[4].name), CSPFT_STRING}, - {"off_engsnd_fade_in_start4", offsetof(VehicleDef, engine.offload[4].params[VEH_ENGINESND_FADE_IN_START]), CSPFT_FLOAT}, - {"off_engsnd_fade_in_end4", offsetof(VehicleDef, engine.offload[4].params[VEH_ENGINESND_FADE_IN_END]), CSPFT_FLOAT}, - {"off_engsnd_fade_out_start4", offsetof(VehicleDef, engine.offload[4].params[VEH_ENGINESND_FADE_OUT_START]), CSPFT_FLOAT}, - {"off_engsnd_fade_out_end4", offsetof(VehicleDef, engine.offload[4].params[VEH_ENGINESND_FADE_OUT_END]), CSPFT_FLOAT}, - {"off_engsnd_pitch_ref4", offsetof(VehicleDef, engine.offload[4].params[VEH_ENGINESND_PITCH_REF]), CSPFT_FLOAT}, - {"numGears", offsetof(VehicleDef, engine.numGears), CSPFT_INT}, - {"loopLastGear", offsetof(VehicleDef, engine.loopLastGear), CSPFT_BOOL}, - {"gear_min_rpm0", offsetof(VehicleDef, engine.gears[0].minRPM), CSPFT_FLOAT}, - {"gear_max_rpm0", offsetof(VehicleDef, engine.gears[0].maxRPM), CSPFT_FLOAT}, - {"gear_ratio0", offsetof(VehicleDef, engine.gears[0].ratio), CSPFT_FLOAT}, - {"gear_min_rpm1", offsetof(VehicleDef, engine.gears[1].minRPM), CSPFT_FLOAT}, - {"gear_max_rpm1", offsetof(VehicleDef, engine.gears[1].maxRPM), CSPFT_FLOAT}, - {"gear_ratio1", offsetof(VehicleDef, engine.gears[1].ratio), CSPFT_FLOAT}, - {"gear_min_rpm2", offsetof(VehicleDef, engine.gears[2].minRPM), CSPFT_FLOAT}, - {"gear_max_rpm2", offsetof(VehicleDef, engine.gears[2].maxRPM), CSPFT_FLOAT}, - {"gear_ratio2", offsetof(VehicleDef, engine.gears[2].ratio), CSPFT_FLOAT}, - {"gear_min_rpm3", offsetof(VehicleDef, engine.gears[3].minRPM), CSPFT_FLOAT}, - {"gear_max_rpm3", offsetof(VehicleDef, engine.gears[3].maxRPM), CSPFT_FLOAT}, - {"gear_ratio3", offsetof(VehicleDef, engine.gears[3].ratio), CSPFT_FLOAT}, - {"gear_min_rpm4", offsetof(VehicleDef, engine.gears[4].minRPM), CSPFT_FLOAT}, - {"gear_max_rpm4", offsetof(VehicleDef, engine.gears[4].maxRPM), CSPFT_FLOAT}, - {"gear_ratio4", offsetof(VehicleDef, engine.gears[4].ratio), CSPFT_FLOAT}, - {"gear_min_rpm5", offsetof(VehicleDef, engine.gears[5].minRPM), CSPFT_FLOAT}, - {"gear_max_rpm5", offsetof(VehicleDef, engine.gears[5].maxRPM), CSPFT_FLOAT}, - {"gear_ratio5", offsetof(VehicleDef, engine.gears[5].ratio), CSPFT_FLOAT}, - {"gear_min_rpm6", offsetof(VehicleDef, engine.gears[6].minRPM), CSPFT_FLOAT}, - {"gear_max_rpm6", offsetof(VehicleDef, engine.gears[6].maxRPM), CSPFT_FLOAT}, - {"gear_ratio6", offsetof(VehicleDef, engine.gears[6].ratio), CSPFT_FLOAT}, - {"gear_min_rpm7", offsetof(VehicleDef, engine.gears[7].minRPM), CSPFT_FLOAT}, - {"gear_max_rpm7", offsetof(VehicleDef, engine.gears[7].maxRPM), CSPFT_FLOAT}, - {"gear_ratio7", offsetof(VehicleDef, engine.gears[7].ratio), CSPFT_FLOAT}, - {"gear_min_rpm8", offsetof(VehicleDef, engine.gears[8].minRPM), CSPFT_FLOAT}, - {"gear_max_rpm8", offsetof(VehicleDef, engine.gears[8].maxRPM), CSPFT_FLOAT}, - {"gear_ratio8", offsetof(VehicleDef, engine.gears[8].ratio), CSPFT_FLOAT}, - {"gear_min_rpm9", offsetof(VehicleDef, engine.gears[9].minRPM), CSPFT_FLOAT}, - {"gear_max_rpm9", offsetof(VehicleDef, engine.gears[9].maxRPM), CSPFT_FLOAT}, - {"gear_ratio9", offsetof(VehicleDef, engine.gears[9].ratio), CSPFT_FLOAT}, - {"csvInclude", offsetof(VehicleDef, csvInclude), CSPFT_STRING}, - {"antenna1SpringK", offsetof(VehicleDef, antenna[0].springK), CSPFT_FLOAT}, - {"antenna1Damp", offsetof(VehicleDef, antenna[0].damp), CSPFT_FLOAT}, - {"antenna1Length", offsetof(VehicleDef, antenna[0].length), CSPFT_FLOAT}, - {"antenna1Gravity", offsetof(VehicleDef, antenna[0].gravity), CSPFT_FLOAT}, - {"antenna2SpringK", offsetof(VehicleDef, antenna[1].springK), CSPFT_FLOAT}, - {"antenna2Damp", offsetof(VehicleDef, antenna[1].damp), CSPFT_FLOAT}, - {"antenna2Length", offsetof(VehicleDef, antenna[1].length), CSPFT_FLOAT}, - {"antenna2Gravity", offsetof(VehicleDef, antenna[1].gravity), CSPFT_FLOAT}, - {"customFloat0", offsetof(VehicleDef, customFloat0), CSPFT_FLOAT}, - {"customFloat1", offsetof(VehicleDef, customFloat1), CSPFT_FLOAT}, - {"customFloat2", offsetof(VehicleDef, customFloat2), CSPFT_FLOAT}, - {"customBool0", offsetof(VehicleDef, customBool0), CSPFT_BOOL}, - {"customBool1", offsetof(VehicleDef, customBool1), CSPFT_BOOL}, - {"customBool2", offsetof(VehicleDef, customBool2), CSPFT_BOOL}, + inline cspField_t vehicle_fields[]{ + {"type", offsetof(VehicleDef, type), VFT_TYPE }, + {"remoteControl", offsetof(VehicleDef, remoteControl), CSPFT_QBOOLEAN }, + {"bulletDamage", offsetof(VehicleDef, bulletDamage), CSPFT_QBOOLEAN }, + {"armorPiercingDamage", offsetof(VehicleDef, armorPiercingDamage), CSPFT_QBOOLEAN }, + {"grenadeDamage", offsetof(VehicleDef, grenadeDamage), CSPFT_QBOOLEAN }, + {"projectileDamage", offsetof(VehicleDef, projectileDamage), CSPFT_QBOOLEAN }, + {"projectileSplashDamage", offsetof(VehicleDef, projectileSplashDamage), CSPFT_QBOOLEAN }, + {"heavyExplosiveDamage", offsetof(VehicleDef, heavyExplosiveDamage), CSPFT_QBOOLEAN }, + {"cameraMode", offsetof(VehicleDef, cameraMode), VFT_CAMERAMODE }, + {"autoRecenterOnAccel", offsetof(VehicleDef, autoRecenterOnAccel), CSPFT_QBOOLEAN }, + {"thirdPersonDriver", offsetof(VehicleDef, thirdPersonDriver), CSPFT_QBOOLEAN }, + {"thirdPersonUseVehicleRoll", offsetof(VehicleDef, thirdPersonUseVehicleRoll), CSPFT_QBOOLEAN }, + {"thirdPersonCameraPitchVehicleRelative", offsetof(VehicleDef, thirdPersonCameraPitchVehicleRelative), CSPFT_QBOOLEAN }, + {"thirdPersonCameraHeightWorldRelative", offsetof(VehicleDef, thirdPersonCameraHeightWorldRelative), CSPFT_QBOOLEAN }, + {"thirdPersonCameraHeightMin", offsetof(VehicleDef, thirdPersonCameraHeight[0]), CSPFT_FLOAT }, + {"thirdPersonCameraPitchMin", offsetof(VehicleDef, thirdPersonCameraPitch[0]), CSPFT_FLOAT }, + {"thirdPersonCameraRange", offsetof(VehicleDef, thirdPersonCameraRange), CSPFT_FLOAT }, + {"thirdPersonCameraHeight", offsetof(VehicleDef, thirdPersonCameraHeight[1]), CSPFT_FLOAT }, + {"thirdPersonCameraPitch", offsetof(VehicleDef, thirdPersonCameraPitch[1]), CSPFT_FLOAT }, + {"thirdPersonCameraMinPitchClamp", offsetof(VehicleDef, thirdPersonCameraMinPitchClamp), CSPFT_FLOAT }, + {"thirdPersonCameraMaxPitchClamp", offsetof(VehicleDef, thirdPersonCameraMaxPitchClamp), CSPFT_FLOAT }, + {"cameraAlwaysAutoCenter", offsetof(VehicleDef, cameraAlwaysAutoCenter), CSPFT_QBOOLEAN }, + {"cameraAutoCenterLerpRate", offsetof(VehicleDef, cameraAutoCenterLerpRate), CSPFT_FLOAT }, + {"cameraAutoCenterMaxLerpRate", offsetof(VehicleDef, cameraAutoCenterMaxLerpRate), CSPFT_FLOAT }, + {"thirdPersonCameraSpringDistance", offsetof(VehicleDef, thirdPersonCameraSpringDistance), CSPFT_FLOAT }, + {"thirdPersonCameraSpringTime", offsetof(VehicleDef, thirdPersonCameraSpringTime), CSPFT_FLOAT }, + {"thirdPersonCameraHandbrakeTurnRateInc", offsetof(VehicleDef, thirdPersonCameraHandbrakeTurnRateInc), CSPFT_FLOAT }, + {"cameraRollFraction", offsetof(VehicleDef, cameraRollFraction), CSPFT_FLOAT }, + {"cameraFOV", offsetof(VehicleDef, cameraFOV), CSPFT_FLOAT }, + {"viewInfluence", offsetof(VehicleDef, viewInfluence), CSPFT_FLOAT }, + {"tagPlayerOffsetX", offsetof(VehicleDef, tagPlayerOffset.x), CSPFT_FLOAT }, + {"tagPlayerOffsetY", offsetof(VehicleDef, tagPlayerOffset.y), CSPFT_FLOAT }, + {"tagPlayerOffsetZ", offsetof(VehicleDef, tagPlayerOffset.z), CSPFT_FLOAT }, + {"killcamCollision", offsetof(VehicleDef, killcamCollision), CSPFT_QBOOLEAN }, + {"killcamDist", offsetof(VehicleDef, killcamDist), CSPFT_FLOAT }, + {"killcamZDist", offsetof(VehicleDef, killcamZDist), CSPFT_FLOAT }, + {"killcamMinDist", offsetof(VehicleDef, killcamMinDist), CSPFT_FLOAT }, + {"killcamZTargetOffset", offsetof(VehicleDef, killcamZTargetOffset), CSPFT_FLOAT }, + {"killcamFOV", offsetof(VehicleDef, killcamFOV), CSPFT_FLOAT }, + {"killcamNearBlur", offsetof(VehicleDef, killcamNearBlur), CSPFT_FLOAT }, + {"killcamNearBlurStart", offsetof(VehicleDef, killcamNearBlurStart), CSPFT_FLOAT }, + {"killcamNearBlurEnd", offsetof(VehicleDef, killcamNearBlurEnd), CSPFT_FLOAT }, + {"killcamFarBlur", offsetof(VehicleDef, killcamFarBlur), CSPFT_FLOAT }, + {"killcamFarBlurStart", offsetof(VehicleDef, killcamFarBlurStart), CSPFT_FLOAT }, + {"killcamFarBlurEnd", offsetof(VehicleDef, killcamFarBlurEnd), CSPFT_FLOAT }, + {"isDrivable", offsetof(VehicleDef, isDrivable), CSPFT_QBOOLEAN }, + {"numberOfSeats", offsetof(VehicleDef, numberOfSeats), CSPFT_INT }, + {"numberOfGunners", offsetof(VehicleDef, numberOfGunners), CSPFT_INT }, + {"driverControlledGunPos", offsetof(VehicleDef, driverControlledGunPos), CSPFT_INT }, + {"seatSwitchOrder1", offsetof(VehicleDef, seatSwitchOrder[0]), CSPFT_INT }, + {"seatSwitchOrder2", offsetof(VehicleDef, seatSwitchOrder[1]), CSPFT_INT }, + {"seatSwitchOrder3", offsetof(VehicleDef, seatSwitchOrder[2]), CSPFT_INT }, + {"seatSwitchOrder4", offsetof(VehicleDef, seatSwitchOrder[3]), CSPFT_INT }, + {"seatSwitchOrder5", offsetof(VehicleDef, seatSwitchOrder[4]), CSPFT_INT }, + {"seatSwitchOrder6", offsetof(VehicleDef, seatSwitchOrder[5]), CSPFT_INT }, + {"seatSwitchOrder7", offsetof(VehicleDef, seatSwitchOrder[6]), CSPFT_INT }, + {"seatSwitchOrder8", offsetof(VehicleDef, seatSwitchOrder[7]), CSPFT_INT }, + {"seatSwitchOrder9", offsetof(VehicleDef, seatSwitchOrder[8]), CSPFT_INT }, + {"seatSwitchOrder10", offsetof(VehicleDef, seatSwitchOrder[9]), CSPFT_INT }, + {"seatSwitchOrder11", offsetof(VehicleDef, seatSwitchOrder[10]), CSPFT_INT }, + {"texureScrollScale", offsetof(VehicleDef, texScrollScale), CSPFT_FLOAT }, + {"wheelRotRate", offsetof(VehicleDef, wheelRotRate), CSPFT_FLOAT }, + {"extraWheelRotScale", offsetof(VehicleDef, extraWheelRotScale), CSPFT_FLOAT }, + {"wheelChildTakesSteerYaw", offsetof(VehicleDef, wheelChildTakesSteerYaw), CSPFT_QBOOLEAN }, + {"enterRadiusDriver", offsetof(VehicleDef, entryPointRadius[VEH_POS_DRIVER]), CSPFT_FLOAT }, + {"enterRadiusGunner1", offsetof(VehicleDef, entryPointRadius[VEH_POS_GUNNER_1]), CSPFT_FLOAT }, + {"enterRadiusGunner2", offsetof(VehicleDef, entryPointRadius[VEH_POS_GUNNER_2]), CSPFT_FLOAT }, + {"enterRadiusGunner3", offsetof(VehicleDef, entryPointRadius[VEH_POS_GUNNER_3]), CSPFT_FLOAT }, + {"enterRadiusGunner4", offsetof(VehicleDef, entryPointRadius[VEH_POS_GUNNER_4]), CSPFT_FLOAT }, + {"maxSpeed", offsetof(VehicleDef, maxSpeed), VFT_MPH_TO_INCHES_PER_SECOND}, + {"maxSpeedVertical", offsetof(VehicleDef, maxSpeedVertical), VFT_MPH_TO_INCHES_PER_SECOND}, + {"accel", offsetof(VehicleDef, accel), VFT_MPH_TO_INCHES_PER_SECOND}, + {"accelVertical", offsetof(VehicleDef, accelVertical), VFT_MPH_TO_INCHES_PER_SECOND}, + {"rotRate", offsetof(VehicleDef, rotRate), CSPFT_FLOAT }, + {"rotAccel", offsetof(VehicleDef, rotAccel), CSPFT_FLOAT }, + {"collisionDamage", offsetof(VehicleDef, collisionDamage), CSPFT_FLOAT }, + {"collisionSpeed", offsetof(VehicleDef, collisionSpeed), VFT_MPH_TO_INCHES_PER_SECOND}, + {"suspensionTravel", offsetof(VehicleDef, suspensionTravel), CSPFT_FLOAT }, + {"maxBodyPitch", offsetof(VehicleDef, maxBodyPitch), CSPFT_FLOAT }, + {"maxBodyRoll", offsetof(VehicleDef, maxBodyRoll), CSPFT_FLOAT }, + {"heliCollisionScalar", offsetof(VehicleDef, heliCollisionScalar), CSPFT_FLOAT }, + {"viewPitchOffset", offsetof(VehicleDef, viewPitchOffset), CSPFT_FLOAT }, + {"tiltFromAccelerationPitch", offsetof(VehicleDef, tiltFromAcceleration[0]), CSPFT_FLOAT }, + {"tiltFromAccelerationRoll", offsetof(VehicleDef, tiltFromAcceleration[1]), CSPFT_FLOAT }, + {"tiltFromDecelerationPitch", offsetof(VehicleDef, tiltFromDeceleration[0]), CSPFT_FLOAT }, + {"tiltFromDecelerationRoll", offsetof(VehicleDef, tiltFromDeceleration[1]), CSPFT_FLOAT }, + {"tiltFromVelocityPitch", offsetof(VehicleDef, tiltFromVelocity[0]), CSPFT_FLOAT }, + {"tiltFromVelocityRoll", offsetof(VehicleDef, tiltFromVelocity[1]), CSPFT_FLOAT }, + {"tiltSpeedPitch", offsetof(VehicleDef, tiltSpeed[0]), CSPFT_FLOAT }, + {"tiltSpeedRoll", offsetof(VehicleDef, tiltSpeed[1]), CSPFT_FLOAT }, + {"tracerOffsetForward", offsetof(VehicleDef, tracerOffset[0]), CSPFT_FLOAT }, + {"tracerOffsetUp", offsetof(VehicleDef, tracerOffset[1]), CSPFT_FLOAT }, + {"turretWeapon", offsetof(VehicleDef, turretWeapon), CSPFT_STRING }, + {"turretHorizSpanLeft", offsetof(VehicleDef, turretViewLimits.horizSpanLeft), CSPFT_FLOAT }, + {"turretHorizSpanRight", offsetof(VehicleDef, turretViewLimits.horizSpanRight), CSPFT_FLOAT }, + {"turretVertSpanUp", offsetof(VehicleDef, turretViewLimits.vertSpanUp), CSPFT_FLOAT }, + {"turretVertSpanDown", offsetof(VehicleDef, turretViewLimits.vertSpanDown), CSPFT_FLOAT }, + {"turretHorizResistLeft", offsetof(VehicleDef, turretViewLimits.horizResistLeft), CSPFT_FLOAT }, + {"turretHorizResistRight", offsetof(VehicleDef, turretViewLimits.horizResistRight), CSPFT_FLOAT }, + {"turretVertResistUp", offsetof(VehicleDef, turretViewLimits.vertResistUp), CSPFT_FLOAT }, + {"turretVertResistDown", offsetof(VehicleDef, turretViewLimits.vertResistDown), CSPFT_FLOAT }, + {"turretRotRate", offsetof(VehicleDef, turretRotRate), CSPFT_FLOAT }, + {"turretClampPlayerView", offsetof(VehicleDef, turretClampPlayerView), CSPFT_QBOOLEAN }, + {"turretLockTurretToPlayerView", offsetof(VehicleDef, turretLockTurretToPlayerView), CSPFT_QBOOLEAN }, + {"gunnerWeapon", offsetof(VehicleDef, gunnerWeapon[0]), CSPFT_STRING }, + {"gunnerWeapon1", offsetof(VehicleDef, gunnerWeapon[1]), CSPFT_STRING }, + {"gunnerWeapon2", offsetof(VehicleDef, gunnerWeapon[2]), CSPFT_STRING }, + {"gunnerWeapon3", offsetof(VehicleDef, gunnerWeapon[3]), CSPFT_STRING }, + {"gunnerRotRate", offsetof(VehicleDef, gunnerRotRate), CSPFT_FLOAT }, + {"passenger1HorizSpanLeft", offsetof(VehicleDef, passengerViewLimits[0].horizSpanLeft), CSPFT_FLOAT }, + {"passenger1HorizSpanRight", offsetof(VehicleDef, passengerViewLimits[0].horizSpanRight), CSPFT_FLOAT }, + {"passenger1VertSpanUp", offsetof(VehicleDef, passengerViewLimits[0].vertSpanUp), CSPFT_FLOAT }, + {"passenger1VertSpanDown", offsetof(VehicleDef, passengerViewLimits[0].vertSpanDown), CSPFT_FLOAT }, + {"passenger2HorizSpanLeft", offsetof(VehicleDef, passengerViewLimits[1].horizSpanLeft), CSPFT_FLOAT }, + {"passenger2HorizSpanRight", offsetof(VehicleDef, passengerViewLimits[1].horizSpanRight), CSPFT_FLOAT }, + {"passenger2VertSpanUp", offsetof(VehicleDef, passengerViewLimits[1].vertSpanUp), CSPFT_FLOAT }, + {"passenger2VertSpanDown", offsetof(VehicleDef, passengerViewLimits[1].vertSpanDown), CSPFT_FLOAT }, + {"passenger3HorizSpanLeft", offsetof(VehicleDef, passengerViewLimits[2].horizSpanLeft), CSPFT_FLOAT }, + {"passenger3HorizSpanRight", offsetof(VehicleDef, passengerViewLimits[2].horizSpanRight), CSPFT_FLOAT }, + {"passenger3VertSpanUp", offsetof(VehicleDef, passengerViewLimits[2].vertSpanUp), CSPFT_FLOAT }, + {"passenger3VertSpanDown", offsetof(VehicleDef, passengerViewLimits[2].vertSpanDown), CSPFT_FLOAT }, + {"passenger4HorizSpanLeft", offsetof(VehicleDef, passengerViewLimits[3].horizSpanLeft), CSPFT_FLOAT }, + {"passenger4HorizSpanRight", offsetof(VehicleDef, passengerViewLimits[3].horizSpanRight), CSPFT_FLOAT }, + {"passenger4VertSpanUp", offsetof(VehicleDef, passengerViewLimits[3].vertSpanUp), CSPFT_FLOAT }, + {"passenger4VertSpanDown", offsetof(VehicleDef, passengerViewLimits[3].vertSpanDown), CSPFT_FLOAT }, + {"passenger5HorizSpanLeft", offsetof(VehicleDef, passengerViewLimits[4].horizSpanLeft), CSPFT_FLOAT }, + {"passenger5HorizSpanRight", offsetof(VehicleDef, passengerViewLimits[4].horizSpanRight), CSPFT_FLOAT }, + {"passenger5VertSpanUp", offsetof(VehicleDef, passengerViewLimits[4].vertSpanUp), CSPFT_FLOAT }, + {"passenger5VertSpanDown", offsetof(VehicleDef, passengerViewLimits[4].vertSpanDown), CSPFT_FLOAT }, + {"passenger6HorizSpanLeft", offsetof(VehicleDef, passengerViewLimits[5].horizSpanLeft), CSPFT_FLOAT }, + {"passenger6HorizSpanRight", offsetof(VehicleDef, passengerViewLimits[5].horizSpanRight), CSPFT_FLOAT }, + {"passenger6VertSpanUp", offsetof(VehicleDef, passengerViewLimits[5].vertSpanUp), CSPFT_FLOAT }, + {"passenger6VertSpanDown", offsetof(VehicleDef, passengerViewLimits[5].vertSpanDown), CSPFT_FLOAT }, + {"turretSpinSnd", offsetof(VehicleDef, sndNames[VEH_TURRET_SPIN_SND]), CSPFT_STRING }, + {"turretStopSnd", offsetof(VehicleDef, sndNames[VEH_TURRET_STOP_SND]), CSPFT_STRING }, + {"wheelRoadNoiseSnd", offsetof(VehicleDef, sndMaterialNames[VEH_WHEEL_ROAD_NOISE]), CSPFT_STRING }, + {"wheelSlidingSnd", offsetof(VehicleDef, sndMaterialNames[VEH_WHEEL_SLIDING]), CSPFT_STRING }, + {"wheelPeelingOutSnd", offsetof(VehicleDef, sndMaterialNames[VEH_WHEEL_PEELING_OUT]), CSPFT_STRING }, + {"futzSnd", offsetof(VehicleDef, futzName), CSPFT_STRING }, + {"futzBlend", offsetof(VehicleDef, futzBlend), CSPFT_FLOAT }, + {"skidSpeedMin", offsetof(VehicleDef, skidSpeedMin), CSPFT_FLOAT }, + {"skidSpeedMax", offsetof(VehicleDef, skidSpeedMax), CSPFT_FLOAT }, + {"animType", offsetof(VehicleDef, animType), CSPFT_INT }, + {"animSet", offsetof(VehicleDef, animSet), CSPFT_STRING }, + {"scriptedAnimationEntry", offsetof(VehicleDef, scriptedAnimationEntry), CSPFT_QBOOLEAN }, + {"mantleAngleFront", offsetof(VehicleDef, mantleAngles[MANTLE_ANGLE_FRONT]), CSPFT_FLOAT }, + {"mantleAngleBack", offsetof(VehicleDef, mantleAngles[MANTLE_ANGLE_BACK]), CSPFT_FLOAT }, + {"mantleAngleLeft", offsetof(VehicleDef, mantleAngles[MANTLE_ANGLE_LEFT]), CSPFT_FLOAT }, + {"mantleAngleRight", offsetof(VehicleDef, mantleAngles[MANTLE_ANGLE_RIGHT]), CSPFT_FLOAT }, + {"driverHideTag1", offsetof(VehicleDef, driverHideTag), CSPFT_SCRIPT_STRING }, + {"extraWheelLeft1", offsetof(VehicleDef, extraWheelTags[FL_WHEEL]), CSPFT_SCRIPT_STRING }, + {"extraWheelRight1", offsetof(VehicleDef, extraWheelTags[FR_WHEEL]), CSPFT_SCRIPT_STRING }, + {"extraWheelLeft2", offsetof(VehicleDef, extraWheelTags[BL_WHEEL]), CSPFT_SCRIPT_STRING }, + {"extraWheelRight2", offsetof(VehicleDef, extraWheelTags[BR_WHEEL]), CSPFT_SCRIPT_STRING }, + {"mod0", offsetof(VehicleDef, attachmentModels[0]), CSPFT_XMODEL }, + {"tag0", offsetof(VehicleDef, attachmentTags[0]), CSPFT_SCRIPT_STRING }, + {"mod1", offsetof(VehicleDef, attachmentModels[1]), CSPFT_XMODEL }, + {"tag1", offsetof(VehicleDef, attachmentTags[1]), CSPFT_SCRIPT_STRING }, + {"mod2", offsetof(VehicleDef, attachmentModels[2]), CSPFT_XMODEL }, + {"tag2", offsetof(VehicleDef, attachmentTags[2]), CSPFT_SCRIPT_STRING }, + {"mod3", offsetof(VehicleDef, attachmentModels[3]), CSPFT_XMODEL }, + {"tag3", offsetof(VehicleDef, attachmentTags[3]), CSPFT_SCRIPT_STRING }, + {"dmod0", offsetof(VehicleDef, deathAttachmentModels[0]), CSPFT_XMODEL }, + {"dtag0", offsetof(VehicleDef, deathAttachmentTags[0]), CSPFT_SCRIPT_STRING }, + {"dmod1", offsetof(VehicleDef, deathAttachmentModels[1]), CSPFT_XMODEL }, + {"dtag1", offsetof(VehicleDef, deathAttachmentTags[1]), CSPFT_SCRIPT_STRING }, + {"dmod2", offsetof(VehicleDef, deathAttachmentModels[2]), CSPFT_XMODEL }, + {"dtag2", offsetof(VehicleDef, deathAttachmentTags[2]), CSPFT_SCRIPT_STRING }, + {"dmod3", offsetof(VehicleDef, deathAttachmentModels[3]), CSPFT_XMODEL }, + {"dtag3", offsetof(VehicleDef, deathAttachmentTags[3]), CSPFT_SCRIPT_STRING }, + {"worldModel", offsetof(VehicleDef, model), CSPFT_XMODEL }, + {"viewModel", offsetof(VehicleDef, viewModel), CSPFT_XMODEL }, + {"deathModel", offsetof(VehicleDef, deathModel), CSPFT_XMODEL }, + {"enemyModel", offsetof(VehicleDef, enemyModel), CSPFT_XMODEL }, + {"modelSwapDelay", offsetof(VehicleDef, modelSwapDelay), CSPFT_FLOAT }, + {"exhaustFx", offsetof(VehicleDef, exhaustFx), CSPFT_FX }, + {"oneExhaust", offsetof(VehicleDef, oneExhaust), CSPFT_QBOOLEAN }, + {"treadFxAsphalt", offsetof(VehicleDef, treadFx[SURF_TYPE_ASPHALT]), CSPFT_FX }, + {"treadFxBark", offsetof(VehicleDef, treadFx[SURF_TYPE_BARK]), CSPFT_FX }, + {"treadFxBrick", offsetof(VehicleDef, treadFx[SURF_TYPE_BRICK]), CSPFT_FX }, + {"treadFxCarpet", offsetof(VehicleDef, treadFx[SURF_TYPE_CARPET]), CSPFT_FX }, + {"treadFxCeramic", offsetof(VehicleDef, treadFx[SURF_TYPE_CERAMIC]), CSPFT_FX }, + {"treadFxCloth", offsetof(VehicleDef, treadFx[SURF_TYPE_CLOTH]), CSPFT_FX }, + {"treadFxConcrete", offsetof(VehicleDef, treadFx[SURF_TYPE_CONCRETE]), CSPFT_FX }, + {"treadFxCushion", offsetof(VehicleDef, treadFx[SURF_TYPE_CUSHION]), CSPFT_FX }, + {"treadFxDefault", offsetof(VehicleDef, treadFx[SURF_TYPE_DEFAULT]), CSPFT_FX }, + {"treadFxDirt", offsetof(VehicleDef, treadFx[SURF_TYPE_DIRT]), CSPFT_FX }, + {"treadFxFlesh", offsetof(VehicleDef, treadFx[SURF_TYPE_FLESH]), CSPFT_FX }, + {"treadFxFoliage", offsetof(VehicleDef, treadFx[SURF_TYPE_FOLIAGE]), CSPFT_FX }, + {"treadFxFruit", offsetof(VehicleDef, treadFx[SURF_TYPE_FRUIT]), CSPFT_FX }, + {"treadFxGlass", offsetof(VehicleDef, treadFx[SURF_TYPE_GLASS]), CSPFT_FX }, + {"treadFxGrass", offsetof(VehicleDef, treadFx[SURF_TYPE_GRASS]), CSPFT_FX }, + {"treadFxGravel", offsetof(VehicleDef, treadFx[SURF_TYPE_GRAVEL]), CSPFT_FX }, + {"treadFxIce", offsetof(VehicleDef, treadFx[SURF_TYPE_ICE]), CSPFT_FX }, + {"treadFxMetal", offsetof(VehicleDef, treadFx[SURF_TYPE_METAL]), CSPFT_FX }, + {"treadFxMud", offsetof(VehicleDef, treadFx[SURF_TYPE_MUD]), CSPFT_FX }, + {"treadFxPaintedMetal", offsetof(VehicleDef, treadFx[SURF_TYPE_PAINTED_METAL]), CSPFT_FX }, + {"treadFxPaper", offsetof(VehicleDef, treadFx[SURF_TYPE_PAPER]), CSPFT_FX }, + {"treadFxPlaster", offsetof(VehicleDef, treadFx[SURF_TYPE_PLASTER]), CSPFT_FX }, + {"treadFxPlastic", offsetof(VehicleDef, treadFx[SURF_TYPE_PLASTIC]), CSPFT_FX }, + {"treadFxRock", offsetof(VehicleDef, treadFx[SURF_TYPE_ROCK]), CSPFT_FX }, + {"treadFxRubber", offsetof(VehicleDef, treadFx[SURF_TYPE_RUBBER]), CSPFT_FX }, + {"treadFxSand", offsetof(VehicleDef, treadFx[SURF_TYPE_SAND]), CSPFT_FX }, + {"treadFxSnow", offsetof(VehicleDef, treadFx[SURF_TYPE_SNOW]), CSPFT_FX }, + {"treadFxWater", offsetof(VehicleDef, treadFx[SURF_TYPE_WATER]), CSPFT_FX }, + {"treadFxWood", offsetof(VehicleDef, treadFx[SURF_TYPE_WOOD]), CSPFT_FX }, + {"deathFxName", offsetof(VehicleDef, deathFx), CSPFT_FX }, + {"deathFxTag", offsetof(VehicleDef, deathFxTag), CSPFT_SCRIPT_STRING }, + {"deathFxSound", offsetof(VehicleDef, deathFxSound), CSPFT_STRING }, + {"lightFxName1", offsetof(VehicleDef, lightFx[0]), CSPFT_FX }, + {"lightFxTag1", offsetof(VehicleDef, lightFxTag[0]), CSPFT_SCRIPT_STRING }, + {"lightFxName2", offsetof(VehicleDef, lightFx[1]), CSPFT_FX }, + {"lightFxTag2", offsetof(VehicleDef, lightFxTag[1]), CSPFT_SCRIPT_STRING }, + {"lightFxName3", offsetof(VehicleDef, lightFx[2]), CSPFT_FX }, + {"lightFxTag3", offsetof(VehicleDef, lightFxTag[2]), CSPFT_SCRIPT_STRING }, + {"lightFxName4", offsetof(VehicleDef, lightFx[3]), CSPFT_FX }, + {"lightFxTag4", offsetof(VehicleDef, lightFxTag[3]), CSPFT_SCRIPT_STRING }, + {"FriendlyLightFxName", offsetof(VehicleDef, friendlyLightFx), CSPFT_FX }, + {"FriendlyLightFxTag", offsetof(VehicleDef, friendlyLightFxTag), CSPFT_SCRIPT_STRING }, + {"EnemyLightFxName", offsetof(VehicleDef, enemyLightFx), CSPFT_FX }, + {"EnemyLightFxTag", offsetof(VehicleDef, enemyLightFxTag), CSPFT_SCRIPT_STRING }, + {"radiusDamageMin", offsetof(VehicleDef, radiusDamageMin), CSPFT_FLOAT }, + {"radiusDamageMax", offsetof(VehicleDef, radiusDamageMax), CSPFT_FLOAT }, + {"radiusDamageRadius", offsetof(VehicleDef, radiusDamageRadius), CSPFT_FLOAT }, + {"shootShock", offsetof(VehicleDef, shootShock), CSPFT_STRING }, + {"shootRumble", offsetof(VehicleDef, shootRumble), CSPFT_STRING }, + {"deathQuakeScale", offsetof(VehicleDef, deathQuakeScale), CSPFT_FLOAT }, + {"deathQuakeDuration", offsetof(VehicleDef, deathQuakeDuration), CSPFT_FLOAT }, + {"deathQuakeRadius", offsetof(VehicleDef, deathQuakeRadius), CSPFT_FLOAT }, + {"rumbleType", offsetof(VehicleDef, rumbleType), CSPFT_STRING }, + {"rumbleScale", offsetof(VehicleDef, rumbleScale), CSPFT_FLOAT }, + {"rumbleDuration", offsetof(VehicleDef, rumbleDuration), CSPFT_FLOAT }, + {"rumbleRadius", offsetof(VehicleDef, rumbleRadius), CSPFT_FLOAT }, + {"rumbleBaseTime", offsetof(VehicleDef, rumbleBaseTime), CSPFT_FLOAT }, + {"rumbleAdditionalTime", offsetof(VehicleDef, rumbleAdditionalTime), CSPFT_FLOAT }, + {"healthDefault", offsetof(VehicleDef, healthDefault), CSPFT_INT }, + {"healthMin", offsetof(VehicleDef, healthMin), CSPFT_INT }, + {"healthMax", offsetof(VehicleDef, healthMax), CSPFT_INT }, + {"team", offsetof(VehicleDef, eTeam), VFT_TEAM }, + {"boostAccelMultiplier", offsetof(VehicleDef, boostAccelMultiplier), CSPFT_INT }, + {"boostDuration", offsetof(VehicleDef, boostDuration), CSPFT_FLOAT }, + {"boostSpeedIncrease", offsetof(VehicleDef, boostSpeedIncrease), CSPFT_FLOAT }, + {"addToCompass", offsetof(VehicleDef, addToCompass), CSPFT_QBOOLEAN }, + {"addToCompassEnemy", offsetof(VehicleDef, addToCompassEnemy), CSPFT_QBOOLEAN }, + {"compassIcon", offsetof(VehicleDef, compassIcon), CSPFT_STRING }, + {"gasButton", offsetof(VehicleDef, gasButtonName), CSPFT_STRING }, + {"reverseBrakeButton", offsetof(VehicleDef, reverseBrakeButtonName), CSPFT_STRING }, + {"handBrakeButton", offsetof(VehicleDef, handBrakeButtonName), CSPFT_STRING }, + {"attackButton", offsetof(VehicleDef, attackButtonName), CSPFT_STRING }, + {"attackSecondaryButton", offsetof(VehicleDef, attackSecondaryButtonName), CSPFT_STRING }, + {"moveUpButton", offsetof(VehicleDef, moveUpButtonName), CSPFT_STRING }, + {"moveDownButton", offsetof(VehicleDef, moveDownButtonName), CSPFT_STRING }, + {"switchSeatButton", offsetof(VehicleDef, switchSeatButtonName), CSPFT_STRING }, + {"boostButton", offsetof(VehicleDef, boostButtonName), CSPFT_STRING }, + {"steerGraph", offsetof(VehicleDef, steerGraphName), CSPFT_STRING }, + {"accelGraph", offsetof(VehicleDef, accelGraphName), CSPFT_STRING }, + {"isNitrous", offsetof(VehicleDef, isNitrous), CSPFT_QBOOLEAN }, + {"isFourWheelSteering", offsetof(VehicleDef, isFourWheelSteering), CSPFT_QBOOLEAN }, + {"useCollmap", offsetof(VehicleDef, useCollmap), CSPFT_QBOOLEAN }, + {"radius", offsetof(VehicleDef, radius), CSPFT_FLOAT }, + {"minHeight", offsetof(VehicleDef, minHeight), CSPFT_FLOAT }, + {"maxHeight", offsetof(VehicleDef, maxHeight), CSPFT_FLOAT }, + {"noDirectionalDamage", offsetof(VehicleDef, noDirectionalDamage), CSPFT_QBOOLEAN }, + {"max_fric_tilt_angle", offsetof(VehicleDef, max_fric_tilt_angle), CSPFT_FLOAT }, + {"max_fric_tilt", offsetof(VehicleDef, max_fric_tilt), CSPFT_FLOAT }, + {"fakeBodyStabilizer", offsetof(VehicleDef, fakeBodyStabilizer), CSPFT_QBOOLEAN }, + {"vehHelicopterBoundsRadius", offsetof(VehicleDef, vehHelicopterBoundsRadius), CSPFT_FLOAT }, + {"vehHelicopterDecelerationFwd", offsetof(VehicleDef, vehHelicopterDecelerationFwd), CSPFT_FLOAT }, + {"vehHelicopterDecelerationSide", offsetof(VehicleDef, vehHelicopterDecelerationSide), CSPFT_FLOAT }, + {"vehHelicopterDecelerationUp", offsetof(VehicleDef, vehHelicopterDecelerationUp), CSPFT_FLOAT }, + {"vehHelicopterTiltFromControllerAxes", offsetof(VehicleDef, vehHelicopterTiltFromControllerAxes), CSPFT_FLOAT }, + {"vehHelicopterTiltFromFwdAndYaw", offsetof(VehicleDef, vehHelicopterTiltFromFwdAndYaw), CSPFT_FLOAT }, + {"vehHelicopterTiltFromFwdAndYaw_VelAtMaxTilt", offsetof(VehicleDef, vehHelicopterTiltFromFwdAndYaw_VelAtMaxTilt), CSPFT_FLOAT }, + {"vehHelicopterTiltMomentum", offsetof(VehicleDef, vehHelicopterTiltMomentum), CSPFT_FLOAT }, + {"vehHelicopterQuadRotor", offsetof(VehicleDef, vehHelicopterQuadRotor), CSPFT_QBOOLEAN }, + {"vehHelicopterAccelTwardsView", offsetof(VehicleDef, vehHelicopterAccelTwardsView), CSPFT_QBOOLEAN }, + {"maxRotorArmMovementAngle", offsetof(VehicleDef, maxRotorArmMovementAngle), CSPFT_FLOAT }, + {"maxRotorArmRotationAngle", offsetof(VehicleDef, maxRotorArmRotationAngle), CSPFT_FLOAT }, + {"vehHelicopterMaintainHeight", offsetof(VehicleDef, vehHelicopterMaintainHeight), CSPFT_QBOOLEAN }, + {"vehHelicopterMaintainMaxHeight", offsetof(VehicleDef, vehHelicopterMaintainMaxHeight), CSPFT_QBOOLEAN }, + {"vehHelicopterMaintainHeightLimit", offsetof(VehicleDef, vehHelicopterMaintainHeightLimit), CSPFT_FLOAT }, + {"vehHelicopterMaintainHeightAccel", offsetof(VehicleDef, vehHelicopterMaintainHeightAccel), CSPFT_FLOAT }, + {"vehHelicopterMaintainHeightMinimum", offsetof(VehicleDef, vehHelicopterMaintainHeightMinimum), CSPFT_FLOAT }, + {"vehHelicopterMaintainHeightMaximum", offsetof(VehicleDef, vehHelicopterMaintainHeightMaximum), CSPFT_FLOAT }, + {"vehHelicopterMaintainCeilingMinimum", offsetof(VehicleDef, vehHelicopterMaintainCeilingMinimum), CSPFT_FLOAT }, + {"joltVehicle", offsetof(VehicleDef, joltVehicle), CSPFT_QBOOLEAN }, + {"joltVehicleDriver", offsetof(VehicleDef, joltVehicleDriver), CSPFT_QBOOLEAN }, + {"joltMaxTime", offsetof(VehicleDef, joltMaxTime), CSPFT_FLOAT }, + {"joltTime", offsetof(VehicleDef, joltTime), CSPFT_FLOAT }, + {"joltWaves", offsetof(VehicleDef, joltWaves), CSPFT_FLOAT }, + {"joltIntensity", offsetof(VehicleDef, joltIntensity), CSPFT_FLOAT }, + {"nitrous_max_speed", offsetof(VehicleDef, nitrousVehParams.m_speed_max), VFT_MPH_TO_INCHES_PER_SECOND}, + {"nitrous_accel", offsetof(VehicleDef, nitrousVehParams.m_accel_max), VFT_MPH_TO_INCHES_PER_SECOND}, + {"nitrous_auto_handbrake_min_speed", offsetof(VehicleDef, nitrousVehParams.m_auto_hand_brake_min_speed), VFT_MPH_TO_INCHES_PER_SECOND}, + {"nitrous_steer_angle_max", offsetof(VehicleDef, nitrousVehParams.m_steer_angle_max), CSPFT_FLOAT }, + {"nitrous_steer_angle_speed_scale", offsetof(VehicleDef, nitrousVehParams.m_steer_angle_speed_scale), CSPFT_FLOAT }, + {"nitrous_steer_speed", offsetof(VehicleDef, nitrousVehParams.m_steer_speed), CSPFT_FLOAT }, + {"nitrous_body_mass", offsetof(VehicleDef, nitrousVehParams.m_body_mass), VFT_POUNDS_TO_GAME_MASS }, + {"nitrous_wheel_radius", offsetof(VehicleDef, nitrousVehParams.m_wheel_radius), CSPFT_FLOAT }, + {"nitrous_susp_adj", offsetof(VehicleDef, nitrousVehParams.m_susp_adj), CSPFT_FLOAT }, + {"nitrous_susp_spring_k", offsetof(VehicleDef, nitrousVehParams.m_susp_spring_k), CSPFT_FLOAT }, + {"nitrous_susp_damp_k", offsetof(VehicleDef, nitrousVehParams.m_susp_damp_k), CSPFT_FLOAT }, + {"nitrous_susp_hard_limit", offsetof(VehicleDef, nitrousVehParams.m_susp_hard_limit), CSPFT_FLOAT }, + {"nitrous_susp_min_height", offsetof(VehicleDef, nitrousVehParams.m_susp_min_height), CSPFT_FLOAT }, + {"nitrous_tire_damp_hand", offsetof(VehicleDef, nitrousVehParams.m_tire_damp_hand), CSPFT_FLOAT }, + {"nitrous_tire_damp_brake", offsetof(VehicleDef, nitrousVehParams.m_tire_damp_brake), CSPFT_FLOAT }, + {"nitrous_tire_damp_coast", offsetof(VehicleDef, nitrousVehParams.m_tire_damp_coast), CSPFT_FLOAT }, + {"nitrous_tire_fric_brake", offsetof(VehicleDef, nitrousVehParams.m_tire_fric_brake), CSPFT_FLOAT }, + {"nitrous_tire_fric_hand_brake", offsetof(VehicleDef, nitrousVehParams.m_tire_fric_hand_brake), CSPFT_FLOAT }, + {"nitrous_tire_fric_fwd", offsetof(VehicleDef, nitrousVehParams.m_tire_fric_fwd), CSPFT_FLOAT }, + {"nitrous_tire_fric_side", offsetof(VehicleDef, nitrousVehParams.m_tire_fric_side), CSPFT_FLOAT }, + {"nitrous_roll_stability", offsetof(VehicleDef, nitrousVehParams.m_roll_stability), CSPFT_FLOAT }, + {"nitrous_pitch_stability", offsetof(VehicleDef, nitrousVehParams.m_pitch_stability), CSPFT_FLOAT }, + {"nitrous_roll_resistance", offsetof(VehicleDef, nitrousVehParams.m_pitch_roll_resistance), CSPFT_FLOAT }, + {"nitrous_yaw_resistance", offsetof(VehicleDef, nitrousVehParams.m_yaw_resistance), CSPFT_FLOAT }, + {"nitrous_upright_strength", offsetof(VehicleDef, nitrousVehParams.m_upright_strength), CSPFT_FLOAT }, + {"nitrous_tilt_fakey", offsetof(VehicleDef, nitrousVehParams.m_tilt_fakey), CSPFT_FLOAT }, + {"nitrous_traction_type", offsetof(VehicleDef, nitrousVehParams.m_traction_type), VFT_TRACTION_TYPE }, + {"nitrous_peel_out_max_speed", offsetof(VehicleDef, nitrousVehParams.m_peel_out_max_speed), CSPFT_FLOAT }, + {"nitrous_tire_fric_side_max", offsetof(VehicleDef, nitrousVehParams.m_tire_fric_side_max), CSPFT_FLOAT }, + {"nitrous_reverse_scale", offsetof(VehicleDef, nitrousVehParams.m_reverse_scale), CSPFT_FLOAT }, + {"nitrous_water_speed_max", offsetof(VehicleDef, nitrousVehParams.m_water_speed_max), VFT_MPH_TO_INCHES_PER_SECOND}, + {"nitrous_water_accel_max", offsetof(VehicleDef, nitrousVehParams.m_water_accel_max), CSPFT_FLOAT }, + {"nitrous_water_turn_accel", offsetof(VehicleDef, nitrousVehParams.m_water_turn_accel), CSPFT_FLOAT }, + {"nitrous_water_turn_speed_max", offsetof(VehicleDef, nitrousVehParams.m_water_turn_speed_max), CSPFT_FLOAT }, + {"nitrous_boat_ebrake_power", offsetof(VehicleDef, nitrousVehParams.m_water_ebrake_power), CSPFT_FLOAT }, + {"nitrous_bbox_min_x", offsetof(VehicleDef, nitrousVehParams.m_bbox_min.x), CSPFT_FLOAT }, + {"nitrous_bbox_min_y", offsetof(VehicleDef, nitrousVehParams.m_bbox_min.y), CSPFT_FLOAT }, + {"nitrous_bbox_min_z", offsetof(VehicleDef, nitrousVehParams.m_bbox_min.z), CSPFT_FLOAT }, + {"nitrous_bbox_max_x", offsetof(VehicleDef, nitrousVehParams.m_bbox_max.x), CSPFT_FLOAT }, + {"nitrous_bbox_max_y", offsetof(VehicleDef, nitrousVehParams.m_bbox_max.y), CSPFT_FLOAT }, + {"nitrous_bbox_max_z", offsetof(VehicleDef, nitrousVehParams.m_bbox_max.z), CSPFT_FLOAT }, + {"nitrous_mass_center_offset_x", offsetof(VehicleDef, nitrousVehParams.m_mass_center_offset.x), CSPFT_FLOAT }, + {"nitrous_mass_center_offset_y", offsetof(VehicleDef, nitrousVehParams.m_mass_center_offset.y), CSPFT_FLOAT }, + {"nitrous_mass_center_offset_z", offsetof(VehicleDef, nitrousVehParams.m_mass_center_offset.z), CSPFT_FLOAT }, + {"nitrous_buoyancybox_min_x", offsetof(VehicleDef, nitrousVehParams.m_buoyancybox_min.x), CSPFT_FLOAT }, + {"nitrous_buoyancybox_min_y", offsetof(VehicleDef, nitrousVehParams.m_buoyancybox_min.y), CSPFT_FLOAT }, + {"nitrous_buoyancybox_min_z", offsetof(VehicleDef, nitrousVehParams.m_buoyancybox_min.z), CSPFT_FLOAT }, + {"nitrous_buoyancybox_max_x", offsetof(VehicleDef, nitrousVehParams.m_buoyancybox_max.x), CSPFT_FLOAT }, + {"nitrous_buoyancybox_max_y", offsetof(VehicleDef, nitrousVehParams.m_buoyancybox_max.y), CSPFT_FLOAT }, + {"nitrous_buoyancybox_max_z", offsetof(VehicleDef, nitrousVehParams.m_buoyancybox_max.z), CSPFT_FLOAT }, + {"nitrous_boat_speed_rise", offsetof(VehicleDef, nitrousVehParams.m_boat_speed_rise), CSPFT_FLOAT }, + {"nitrous_boat_speed_tilt", offsetof(VehicleDef, nitrousVehParams.m_boat_speed_tilt), CSPFT_FLOAT }, + {"nitrous_boat_motor_offset_x", offsetof(VehicleDef, nitrousVehParams.m_boat_motor_offset.x), CSPFT_FLOAT }, + {"nitrous_boat_motor_offset_y", offsetof(VehicleDef, nitrousVehParams.m_boat_motor_offset.y), CSPFT_FLOAT }, + {"nitrous_boat_motor_offset_z", offsetof(VehicleDef, nitrousVehParams.m_boat_motor_offset.z), CSPFT_FLOAT }, + {"nitrous_boat_side_fric", offsetof(VehicleDef, nitrousVehParams.m_boat_side_fric_scale), CSPFT_FLOAT }, + {"nitrous_boat_forward_fric", offsetof(VehicleDef, nitrousVehParams.m_boat_forward_fric_scale), CSPFT_FLOAT }, + {"nitrous_boat_vertical_fric", offsetof(VehicleDef, nitrousVehParams.m_boat_vertical_fric_scale), CSPFT_FLOAT }, + {"nitrous_drive_on_walls", offsetof(VehicleDef, nitrousVehParams.m_drive_on_walls), CSPFT_BOOL }, + {"nitrous_linear_drag_scale", offsetof(VehicleDef, nitrousVehParams.m_linear_drag_scale), CSPFT_FLOAT }, + {"nitrous_angular_drag_scale", offsetof(VehicleDef, nitrousVehParams.m_angular_drag_scale), CSPFT_FLOAT }, + {"nitrous_jump_force", offsetof(VehicleDef, nitrousVehParams.m_jump_force), CSPFT_FLOAT }, + {"p_driveby_sound_radius", offsetof(VehicleDef, driveBySoundRadius[0]), CSPFT_FLOAT }, + {"s_driveby_sound_radius", offsetof(VehicleDef, driveBySoundRadius[1]), CSPFT_FLOAT }, + {"p_drive_by_sound_apex0", offsetof(VehicleDef, driveBySounds[0].apex), CSPFT_INT }, + {"p_drive_by_sound_name0", offsetof(VehicleDef, driveBySounds[0].name), CSPFT_STRING }, + {"p_drive_by_sound_apex1", offsetof(VehicleDef, driveBySounds[1].apex), CSPFT_INT }, + {"p_drive_by_sound_name1", offsetof(VehicleDef, driveBySounds[1].name), CSPFT_STRING }, + {"p_drive_by_sound_apex2", offsetof(VehicleDef, driveBySounds[2].apex), CSPFT_INT }, + {"p_drive_by_sound_name2", offsetof(VehicleDef, driveBySounds[2].name), CSPFT_STRING }, + {"p_drive_by_sound_apex3", offsetof(VehicleDef, driveBySounds[3].apex), CSPFT_INT }, + {"p_drive_by_sound_name3", offsetof(VehicleDef, driveBySounds[3].name), CSPFT_STRING }, + {"p_drive_by_sound_apex4", offsetof(VehicleDef, driveBySounds[4].apex), CSPFT_INT }, + {"p_drive_by_sound_name4", offsetof(VehicleDef, driveBySounds[4].name), CSPFT_STRING }, + {"p_drive_by_sound_apex5", offsetof(VehicleDef, driveBySounds[5].apex), CSPFT_INT }, + {"p_drive_by_sound_name5", offsetof(VehicleDef, driveBySounds[5].name), CSPFT_STRING }, + {"p_drive_by_sound_apex6", offsetof(VehicleDef, driveBySounds[6].apex), CSPFT_INT }, + {"p_drive_by_sound_name6", offsetof(VehicleDef, driveBySounds[6].name), CSPFT_STRING }, + {"p_drive_by_sound_apex7", offsetof(VehicleDef, driveBySounds[7].apex), CSPFT_INT }, + {"p_drive_by_sound_name7", offsetof(VehicleDef, driveBySounds[7].name), CSPFT_STRING }, + {"p_drive_by_sound_apex8", offsetof(VehicleDef, driveBySounds[8].apex), CSPFT_INT }, + {"p_drive_by_sound_name8", offsetof(VehicleDef, driveBySounds[8].name), CSPFT_STRING }, + {"p_drive_by_sound_apex9", offsetof(VehicleDef, driveBySounds[9].apex), CSPFT_INT }, + {"p_drive_by_sound_name9", offsetof(VehicleDef, driveBySounds[9].name), CSPFT_STRING }, + {"p_drive_by_sound_apex10", offsetof(VehicleDef, driveBySounds[10].apex), CSPFT_INT }, + {"p_drive_by_sound_name10", offsetof(VehicleDef, driveBySounds[10].name), CSPFT_STRING }, + {"p_drive_by_sound_apex11", offsetof(VehicleDef, driveBySounds[11].apex), CSPFT_INT }, + {"p_drive_by_sound_name11", offsetof(VehicleDef, driveBySounds[11].name), CSPFT_STRING }, + {"p_drive_by_sound_apex12", offsetof(VehicleDef, driveBySounds[12].apex), CSPFT_INT }, + {"p_drive_by_sound_name12", offsetof(VehicleDef, driveBySounds[12].name), CSPFT_STRING }, + {"p_drive_by_sound_apex13", offsetof(VehicleDef, driveBySounds[13].apex), CSPFT_INT }, + {"p_drive_by_sound_name13", offsetof(VehicleDef, driveBySounds[13].name), CSPFT_STRING }, + {"p_drive_by_sound_apex14", offsetof(VehicleDef, driveBySounds[14].apex), CSPFT_INT }, + {"p_drive_by_sound_name14", offsetof(VehicleDef, driveBySounds[14].name), CSPFT_STRING }, + {"p_drive_by_sound_apex15", offsetof(VehicleDef, driveBySounds[15].apex), CSPFT_INT }, + {"p_drive_by_sound_name15", offsetof(VehicleDef, driveBySounds[15].name), CSPFT_STRING }, + {"p_drive_by_sound_apex16", offsetof(VehicleDef, driveBySounds[16].apex), CSPFT_INT }, + {"p_drive_by_sound_name16", offsetof(VehicleDef, driveBySounds[16].name), CSPFT_STRING }, + {"p_drive_by_sound_apex17", offsetof(VehicleDef, driveBySounds[17].apex), CSPFT_INT }, + {"p_drive_by_sound_name17", offsetof(VehicleDef, driveBySounds[17].name), CSPFT_STRING }, + {"p_drive_by_sound_apex18", offsetof(VehicleDef, driveBySounds[18].apex), CSPFT_INT }, + {"p_drive_by_sound_name18", offsetof(VehicleDef, driveBySounds[18].name), CSPFT_STRING }, + {"p_drive_by_sound_apex19", offsetof(VehicleDef, driveBySounds[19].apex), CSPFT_INT }, + {"p_drive_by_sound_name19", offsetof(VehicleDef, driveBySounds[19].name), CSPFT_STRING }, + {"s_drive_by_sound_apex0", offsetof(VehicleDef, driveBySounds[20].apex), CSPFT_INT }, + {"s_drive_by_sound_name0", offsetof(VehicleDef, driveBySounds[20].name), CSPFT_STRING }, + {"s_drive_by_sound_apex1", offsetof(VehicleDef, driveBySounds[21].apex), CSPFT_INT }, + {"s_drive_by_sound_name1", offsetof(VehicleDef, driveBySounds[21].name), CSPFT_STRING }, + {"s_drive_by_sound_apex2", offsetof(VehicleDef, driveBySounds[22].apex), CSPFT_INT }, + {"s_drive_by_sound_name2", offsetof(VehicleDef, driveBySounds[22].name), CSPFT_STRING }, + {"s_drive_by_sound_apex3", offsetof(VehicleDef, driveBySounds[23].apex), CSPFT_INT }, + {"s_drive_by_sound_name3", offsetof(VehicleDef, driveBySounds[23].name), CSPFT_STRING }, + {"s_drive_by_sound_apex4", offsetof(VehicleDef, driveBySounds[24].apex), CSPFT_INT }, + {"s_drive_by_sound_name4", offsetof(VehicleDef, driveBySounds[24].name), CSPFT_STRING }, + {"s_drive_by_sound_apex5", offsetof(VehicleDef, driveBySounds[25].apex), CSPFT_INT }, + {"s_drive_by_sound_name5", offsetof(VehicleDef, driveBySounds[25].name), CSPFT_STRING }, + {"s_drive_by_sound_apex6", offsetof(VehicleDef, driveBySounds[26].apex), CSPFT_INT }, + {"s_drive_by_sound_name6", offsetof(VehicleDef, driveBySounds[26].name), CSPFT_STRING }, + {"s_drive_by_sound_apex7", offsetof(VehicleDef, driveBySounds[27].apex), CSPFT_INT }, + {"s_drive_by_sound_name7", offsetof(VehicleDef, driveBySounds[27].name), CSPFT_STRING }, + {"s_drive_by_sound_apex8", offsetof(VehicleDef, driveBySounds[28].apex), CSPFT_INT }, + {"s_drive_by_sound_name8", offsetof(VehicleDef, driveBySounds[28].name), CSPFT_STRING }, + {"s_drive_by_sound_apex9", offsetof(VehicleDef, driveBySounds[29].apex), CSPFT_INT }, + {"s_drive_by_sound_name9", offsetof(VehicleDef, driveBySounds[29].name), CSPFT_STRING }, + {"s_drive_by_sound_apex10", offsetof(VehicleDef, driveBySounds[30].apex), CSPFT_INT }, + {"s_drive_by_sound_name10", offsetof(VehicleDef, driveBySounds[30].name), CSPFT_STRING }, + {"s_drive_by_sound_apex11", offsetof(VehicleDef, driveBySounds[31].apex), CSPFT_INT }, + {"s_drive_by_sound_name11", offsetof(VehicleDef, driveBySounds[31].name), CSPFT_STRING }, + {"s_drive_by_sound_apex12", offsetof(VehicleDef, driveBySounds[32].apex), CSPFT_INT }, + {"s_drive_by_sound_name12", offsetof(VehicleDef, driveBySounds[32].name), CSPFT_STRING }, + {"s_drive_by_sound_apex13", offsetof(VehicleDef, driveBySounds[33].apex), CSPFT_INT }, + {"s_drive_by_sound_name13", offsetof(VehicleDef, driveBySounds[33].name), CSPFT_STRING }, + {"s_drive_by_sound_apex14", offsetof(VehicleDef, driveBySounds[34].apex), CSPFT_INT }, + {"s_drive_by_sound_name14", offsetof(VehicleDef, driveBySounds[34].name), CSPFT_STRING }, + {"s_drive_by_sound_apex15", offsetof(VehicleDef, driveBySounds[35].apex), CSPFT_INT }, + {"s_drive_by_sound_name15", offsetof(VehicleDef, driveBySounds[35].name), CSPFT_STRING }, + {"s_drive_by_sound_apex16", offsetof(VehicleDef, driveBySounds[36].apex), CSPFT_INT }, + {"s_drive_by_sound_name16", offsetof(VehicleDef, driveBySounds[36].name), CSPFT_STRING }, + {"s_drive_by_sound_apex17", offsetof(VehicleDef, driveBySounds[37].apex), CSPFT_INT }, + {"s_drive_by_sound_name17", offsetof(VehicleDef, driveBySounds[37].name), CSPFT_STRING }, + {"s_drive_by_sound_apex18", offsetof(VehicleDef, driveBySounds[38].apex), CSPFT_INT }, + {"s_drive_by_sound_name18", offsetof(VehicleDef, driveBySounds[38].name), CSPFT_STRING }, + {"s_drive_by_sound_apex19", offsetof(VehicleDef, driveBySounds[39].apex), CSPFT_INT }, + {"s_drive_by_sound_name19", offsetof(VehicleDef, driveBySounds[39].name), CSPFT_STRING }, + {"doFootSteps", offsetof(VehicleDef, doFootSteps), CSPFT_BOOL }, + {"isSentient", offsetof(VehicleDef, isSentient), CSPFT_BOOL }, + {"idleRpms", offsetof(VehicleDef, engine.idleRpms), CSPFT_FLOAT }, + {"maxRpms", offsetof(VehicleDef, engine.maxRpms), CSPFT_FLOAT }, + {"maxTorque", offsetof(VehicleDef, engine.maxTorque), CSPFT_FLOAT }, + {"brakingCoeff", offsetof(VehicleDef, engine.brakingCoeff), CSPFT_FLOAT }, + {"onLoadFadeInStart", offsetof(VehicleDef, engine.loadFadeParams.x), CSPFT_FLOAT }, + {"onLoadFadeInEnd", offsetof(VehicleDef, engine.loadFadeParams.y), CSPFT_FLOAT }, + {"offLoadFadeOutStart", offsetof(VehicleDef, engine.loadFadeParams.z), CSPFT_FLOAT }, + {"offLoadFadeOutEnd", offsetof(VehicleDef, engine.loadFadeParams.w), CSPFT_FLOAT }, + {"loadScale", offsetof(VehicleDef, engine.loadScale), CSPFT_FLOAT }, + {"loadSmooting", offsetof(VehicleDef, engine.loadSmoothing), CSPFT_FLOAT }, + {"throttleLag", offsetof(VehicleDef, engine.throttleLag), CSPFT_FLOAT }, + {"pitchScale", offsetof(VehicleDef, engine.pitchScale), CSPFT_FLOAT }, + {"on_engsnd_name0", offsetof(VehicleDef, engine.onload[0].name), CSPFT_STRING }, + {"on_engsnd_fade_in_start0", offsetof(VehicleDef, engine.onload[0].params[VEH_ENGINESND_FADE_IN_START]), CSPFT_FLOAT }, + {"on_engsnd_fade_in_end0", offsetof(VehicleDef, engine.onload[0].params[VEH_ENGINESND_FADE_IN_END]), CSPFT_FLOAT }, + {"on_engsnd_fade_out_start0", offsetof(VehicleDef, engine.onload[0].params[VEH_ENGINESND_FADE_OUT_START]), CSPFT_FLOAT }, + {"on_engsnd_fade_out_end0", offsetof(VehicleDef, engine.onload[0].params[VEH_ENGINESND_FADE_OUT_END]), CSPFT_FLOAT }, + {"on_engsnd_pitch_ref0", offsetof(VehicleDef, engine.onload[0].params[VEH_ENGINESND_PITCH_REF]), CSPFT_FLOAT }, + {"on_engsnd_name1", offsetof(VehicleDef, engine.onload[1].name), CSPFT_STRING }, + {"on_engsnd_fade_in_start1", offsetof(VehicleDef, engine.onload[1].params[VEH_ENGINESND_FADE_IN_START]), CSPFT_FLOAT }, + {"on_engsnd_fade_in_end1", offsetof(VehicleDef, engine.onload[1].params[VEH_ENGINESND_FADE_IN_END]), CSPFT_FLOAT }, + {"on_engsnd_fade_out_start1", offsetof(VehicleDef, engine.onload[1].params[VEH_ENGINESND_FADE_OUT_START]), CSPFT_FLOAT }, + {"on_engsnd_fade_out_end1", offsetof(VehicleDef, engine.onload[1].params[VEH_ENGINESND_FADE_OUT_END]), CSPFT_FLOAT }, + {"on_engsnd_pitch_ref1", offsetof(VehicleDef, engine.onload[1].params[VEH_ENGINESND_PITCH_REF]), CSPFT_FLOAT }, + {"on_engsnd_name2", offsetof(VehicleDef, engine.onload[2].name), CSPFT_STRING }, + {"on_engsnd_fade_in_start2", offsetof(VehicleDef, engine.onload[2].params[VEH_ENGINESND_FADE_IN_START]), CSPFT_FLOAT }, + {"on_engsnd_fade_in_end2", offsetof(VehicleDef, engine.onload[2].params[VEH_ENGINESND_FADE_IN_END]), CSPFT_FLOAT }, + {"on_engsnd_fade_out_start2", offsetof(VehicleDef, engine.onload[2].params[VEH_ENGINESND_FADE_OUT_START]), CSPFT_FLOAT }, + {"on_engsnd_fade_out_end2", offsetof(VehicleDef, engine.onload[2].params[VEH_ENGINESND_FADE_OUT_END]), CSPFT_FLOAT }, + {"on_engsnd_pitch_ref2", offsetof(VehicleDef, engine.onload[2].params[VEH_ENGINESND_PITCH_REF]), CSPFT_FLOAT }, + {"on_engsnd_name3", offsetof(VehicleDef, engine.onload[3].name), CSPFT_STRING }, + {"on_engsnd_fade_in_start3", offsetof(VehicleDef, engine.onload[3].params[VEH_ENGINESND_FADE_IN_START]), CSPFT_FLOAT }, + {"on_engsnd_fade_in_end3", offsetof(VehicleDef, engine.onload[3].params[VEH_ENGINESND_FADE_IN_END]), CSPFT_FLOAT }, + {"on_engsnd_fade_out_start3", offsetof(VehicleDef, engine.onload[3].params[VEH_ENGINESND_FADE_OUT_START]), CSPFT_FLOAT }, + {"on_engsnd_fade_out_end3", offsetof(VehicleDef, engine.onload[3].params[VEH_ENGINESND_FADE_OUT_END]), CSPFT_FLOAT }, + {"on_engsnd_pitch_ref3", offsetof(VehicleDef, engine.onload[3].params[VEH_ENGINESND_PITCH_REF]), CSPFT_FLOAT }, + {"on_engsnd_name4", offsetof(VehicleDef, engine.onload[4].name), CSPFT_STRING }, + {"on_engsnd_fade_in_start4", offsetof(VehicleDef, engine.onload[4].params[VEH_ENGINESND_FADE_IN_START]), CSPFT_FLOAT }, + {"on_engsnd_fade_in_end4", offsetof(VehicleDef, engine.onload[4].params[VEH_ENGINESND_FADE_IN_END]), CSPFT_FLOAT }, + {"on_engsnd_fade_out_start4", offsetof(VehicleDef, engine.onload[4].params[VEH_ENGINESND_FADE_OUT_START]), CSPFT_FLOAT }, + {"on_engsnd_fade_out_end4", offsetof(VehicleDef, engine.onload[4].params[VEH_ENGINESND_FADE_OUT_END]), CSPFT_FLOAT }, + {"on_engsnd_pitch_ref4", offsetof(VehicleDef, engine.onload[4].params[VEH_ENGINESND_PITCH_REF]), CSPFT_FLOAT }, + {"off_engsnd_name0", offsetof(VehicleDef, engine.offload[0].name), CSPFT_STRING }, + {"off_engsnd_fade_in_start0", offsetof(VehicleDef, engine.offload[0].params[VEH_ENGINESND_FADE_IN_START]), CSPFT_FLOAT }, + {"off_engsnd_fade_in_end0", offsetof(VehicleDef, engine.offload[0].params[VEH_ENGINESND_FADE_IN_END]), CSPFT_FLOAT }, + {"off_engsnd_fade_out_start0", offsetof(VehicleDef, engine.offload[0].params[VEH_ENGINESND_FADE_OUT_START]), CSPFT_FLOAT }, + {"off_engsnd_fade_out_end0", offsetof(VehicleDef, engine.offload[0].params[VEH_ENGINESND_FADE_OUT_END]), CSPFT_FLOAT }, + {"off_engsnd_pitch_ref0", offsetof(VehicleDef, engine.offload[0].params[VEH_ENGINESND_PITCH_REF]), CSPFT_FLOAT }, + {"off_engsnd_name1", offsetof(VehicleDef, engine.offload[1].name), CSPFT_STRING }, + {"off_engsnd_fade_in_start1", offsetof(VehicleDef, engine.offload[1].params[VEH_ENGINESND_FADE_IN_START]), CSPFT_FLOAT }, + {"off_engsnd_fade_in_end1", offsetof(VehicleDef, engine.offload[1].params[VEH_ENGINESND_FADE_IN_END]), CSPFT_FLOAT }, + {"off_engsnd_fade_out_start1", offsetof(VehicleDef, engine.offload[1].params[VEH_ENGINESND_FADE_OUT_START]), CSPFT_FLOAT }, + {"off_engsnd_fade_out_end1", offsetof(VehicleDef, engine.offload[1].params[VEH_ENGINESND_FADE_OUT_END]), CSPFT_FLOAT }, + {"off_engsnd_pitch_ref1", offsetof(VehicleDef, engine.offload[1].params[VEH_ENGINESND_PITCH_REF]), CSPFT_FLOAT }, + {"off_engsnd_name2", offsetof(VehicleDef, engine.offload[2].name), CSPFT_STRING }, + {"off_engsnd_fade_in_start2", offsetof(VehicleDef, engine.offload[2].params[VEH_ENGINESND_FADE_IN_START]), CSPFT_FLOAT }, + {"off_engsnd_fade_in_end2", offsetof(VehicleDef, engine.offload[2].params[VEH_ENGINESND_FADE_IN_END]), CSPFT_FLOAT }, + {"off_engsnd_fade_out_start2", offsetof(VehicleDef, engine.offload[2].params[VEH_ENGINESND_FADE_OUT_START]), CSPFT_FLOAT }, + {"off_engsnd_fade_out_end2", offsetof(VehicleDef, engine.offload[2].params[VEH_ENGINESND_FADE_OUT_END]), CSPFT_FLOAT }, + {"off_engsnd_pitch_ref2", offsetof(VehicleDef, engine.offload[2].params[VEH_ENGINESND_PITCH_REF]), CSPFT_FLOAT }, + {"off_engsnd_name3", offsetof(VehicleDef, engine.offload[3].name), CSPFT_STRING }, + {"off_engsnd_fade_in_start3", offsetof(VehicleDef, engine.offload[3].params[VEH_ENGINESND_FADE_IN_START]), CSPFT_FLOAT }, + {"off_engsnd_fade_in_end3", offsetof(VehicleDef, engine.offload[3].params[VEH_ENGINESND_FADE_IN_END]), CSPFT_FLOAT }, + {"off_engsnd_fade_out_start3", offsetof(VehicleDef, engine.offload[3].params[VEH_ENGINESND_FADE_OUT_START]), CSPFT_FLOAT }, + {"off_engsnd_fade_out_end3", offsetof(VehicleDef, engine.offload[3].params[VEH_ENGINESND_FADE_OUT_END]), CSPFT_FLOAT }, + {"off_engsnd_pitch_ref3", offsetof(VehicleDef, engine.offload[3].params[VEH_ENGINESND_PITCH_REF]), CSPFT_FLOAT }, + {"off_engsnd_name4", offsetof(VehicleDef, engine.offload[4].name), CSPFT_STRING }, + {"off_engsnd_fade_in_start4", offsetof(VehicleDef, engine.offload[4].params[VEH_ENGINESND_FADE_IN_START]), CSPFT_FLOAT }, + {"off_engsnd_fade_in_end4", offsetof(VehicleDef, engine.offload[4].params[VEH_ENGINESND_FADE_IN_END]), CSPFT_FLOAT }, + {"off_engsnd_fade_out_start4", offsetof(VehicleDef, engine.offload[4].params[VEH_ENGINESND_FADE_OUT_START]), CSPFT_FLOAT }, + {"off_engsnd_fade_out_end4", offsetof(VehicleDef, engine.offload[4].params[VEH_ENGINESND_FADE_OUT_END]), CSPFT_FLOAT }, + {"off_engsnd_pitch_ref4", offsetof(VehicleDef, engine.offload[4].params[VEH_ENGINESND_PITCH_REF]), CSPFT_FLOAT }, + {"numGears", offsetof(VehicleDef, engine.numGears), CSPFT_INT }, + {"loopLastGear", offsetof(VehicleDef, engine.loopLastGear), CSPFT_BOOL }, + {"gear_min_rpm0", offsetof(VehicleDef, engine.gears[0].minRPM), CSPFT_FLOAT }, + {"gear_max_rpm0", offsetof(VehicleDef, engine.gears[0].maxRPM), CSPFT_FLOAT }, + {"gear_ratio0", offsetof(VehicleDef, engine.gears[0].ratio), CSPFT_FLOAT }, + {"gear_min_rpm1", offsetof(VehicleDef, engine.gears[1].minRPM), CSPFT_FLOAT }, + {"gear_max_rpm1", offsetof(VehicleDef, engine.gears[1].maxRPM), CSPFT_FLOAT }, + {"gear_ratio1", offsetof(VehicleDef, engine.gears[1].ratio), CSPFT_FLOAT }, + {"gear_min_rpm2", offsetof(VehicleDef, engine.gears[2].minRPM), CSPFT_FLOAT }, + {"gear_max_rpm2", offsetof(VehicleDef, engine.gears[2].maxRPM), CSPFT_FLOAT }, + {"gear_ratio2", offsetof(VehicleDef, engine.gears[2].ratio), CSPFT_FLOAT }, + {"gear_min_rpm3", offsetof(VehicleDef, engine.gears[3].minRPM), CSPFT_FLOAT }, + {"gear_max_rpm3", offsetof(VehicleDef, engine.gears[3].maxRPM), CSPFT_FLOAT }, + {"gear_ratio3", offsetof(VehicleDef, engine.gears[3].ratio), CSPFT_FLOAT }, + {"gear_min_rpm4", offsetof(VehicleDef, engine.gears[4].minRPM), CSPFT_FLOAT }, + {"gear_max_rpm4", offsetof(VehicleDef, engine.gears[4].maxRPM), CSPFT_FLOAT }, + {"gear_ratio4", offsetof(VehicleDef, engine.gears[4].ratio), CSPFT_FLOAT }, + {"gear_min_rpm5", offsetof(VehicleDef, engine.gears[5].minRPM), CSPFT_FLOAT }, + {"gear_max_rpm5", offsetof(VehicleDef, engine.gears[5].maxRPM), CSPFT_FLOAT }, + {"gear_ratio5", offsetof(VehicleDef, engine.gears[5].ratio), CSPFT_FLOAT }, + {"gear_min_rpm6", offsetof(VehicleDef, engine.gears[6].minRPM), CSPFT_FLOAT }, + {"gear_max_rpm6", offsetof(VehicleDef, engine.gears[6].maxRPM), CSPFT_FLOAT }, + {"gear_ratio6", offsetof(VehicleDef, engine.gears[6].ratio), CSPFT_FLOAT }, + {"gear_min_rpm7", offsetof(VehicleDef, engine.gears[7].minRPM), CSPFT_FLOAT }, + {"gear_max_rpm7", offsetof(VehicleDef, engine.gears[7].maxRPM), CSPFT_FLOAT }, + {"gear_ratio7", offsetof(VehicleDef, engine.gears[7].ratio), CSPFT_FLOAT }, + {"gear_min_rpm8", offsetof(VehicleDef, engine.gears[8].minRPM), CSPFT_FLOAT }, + {"gear_max_rpm8", offsetof(VehicleDef, engine.gears[8].maxRPM), CSPFT_FLOAT }, + {"gear_ratio8", offsetof(VehicleDef, engine.gears[8].ratio), CSPFT_FLOAT }, + {"gear_min_rpm9", offsetof(VehicleDef, engine.gears[9].minRPM), CSPFT_FLOAT }, + {"gear_max_rpm9", offsetof(VehicleDef, engine.gears[9].maxRPM), CSPFT_FLOAT }, + {"gear_ratio9", offsetof(VehicleDef, engine.gears[9].ratio), CSPFT_FLOAT }, + {"csvInclude", offsetof(VehicleDef, csvInclude), CSPFT_STRING }, + {"antenna1SpringK", offsetof(VehicleDef, antenna[0].springK), CSPFT_FLOAT }, + {"antenna1Damp", offsetof(VehicleDef, antenna[0].damp), CSPFT_FLOAT }, + {"antenna1Length", offsetof(VehicleDef, antenna[0].length), CSPFT_FLOAT }, + {"antenna1Gravity", offsetof(VehicleDef, antenna[0].gravity), CSPFT_FLOAT }, + {"antenna2SpringK", offsetof(VehicleDef, antenna[1].springK), CSPFT_FLOAT }, + {"antenna2Damp", offsetof(VehicleDef, antenna[1].damp), CSPFT_FLOAT }, + {"antenna2Length", offsetof(VehicleDef, antenna[1].length), CSPFT_FLOAT }, + {"antenna2Gravity", offsetof(VehicleDef, antenna[1].gravity), CSPFT_FLOAT }, + {"customFloat0", offsetof(VehicleDef, customFloat0), CSPFT_FLOAT }, + {"customFloat1", offsetof(VehicleDef, customFloat1), CSPFT_FLOAT }, + {"customFloat2", offsetof(VehicleDef, customFloat2), CSPFT_FLOAT }, + {"customBool0", offsetof(VehicleDef, customBool0), CSPFT_BOOL }, + {"customBool1", offsetof(VehicleDef, customBool1), CSPFT_BOOL }, + {"customBool2", offsetof(VehicleDef, customBool2), CSPFT_BOOL }, }; -} \ No newline at end of file +} diff --git a/src/ObjCommon/Game/T6/InfoString/WeaponAttachmentFields.h b/src/ObjCommon/Game/T6/InfoString/WeaponAttachmentFields.h index 923774479..eff3387c3 100644 --- a/src/ObjCommon/Game/T6/InfoString/WeaponAttachmentFields.h +++ b/src/ObjCommon/Game/T6/InfoString/WeaponAttachmentFields.h @@ -3,83 +3,82 @@ namespace T6 { - inline cspField_t attachment_fields[] - { - {"displayName", offsetof(WeaponAttachment, szDisplayName), CSPFT_STRING}, - {"attachmentType", offsetof(WeaponAttachment, attachmentType), AFT_ATTACHMENTTYPE}, - {"penetrateType", offsetof(WeaponAttachment, penetrateType), AFT_PENETRATE_TYPE}, - {"firstRaisePriority", offsetof(WeaponAttachment, firstRaisePriority), CSPFT_INT}, - {"hipIdleAmount", offsetof(WeaponAttachment, fHipIdleAmount), CSPFT_FLOAT}, - {"fireType", offsetof(WeaponAttachment, fireType), AFT_FIRETYPE}, - {"damageRangeScale", offsetof(WeaponAttachment, fDamageRangeScale), CSPFT_FLOAT}, - {"adsZoomFov1", offsetof(WeaponAttachment, fAdsZoomFov1), CSPFT_FLOAT}, - {"adsZoomFov2", offsetof(WeaponAttachment, fAdsZoomFov2), CSPFT_FLOAT}, - {"adsZoomFov3", offsetof(WeaponAttachment, fAdsZoomFov3), CSPFT_FLOAT}, - {"adsZoomInFrac", offsetof(WeaponAttachment, fAdsZoomInFrac), CSPFT_FLOAT}, - {"adsZoomOutFrac", offsetof(WeaponAttachment, fAdsZoomOutFrac), CSPFT_FLOAT}, - {"adsTransInTimeScale", offsetof(WeaponAttachment, fAdsTransInTimeScale), CSPFT_FLOAT}, - {"adsTransOutTimeScale", offsetof(WeaponAttachment, fAdsTransOutTimeScale), CSPFT_FLOAT}, - {"adsRecoilReductionRate", offsetof(WeaponAttachment, fAdsRecoilReductionRate), CSPFT_FLOAT}, - {"adsRecoilReductionLimit", offsetof(WeaponAttachment, fAdsRecoilReductionLimit), CSPFT_FLOAT}, - {"adsViewKickCenterSpeedScale", offsetof(WeaponAttachment, fAdsViewKickCenterSpeedScale), CSPFT_FLOAT}, - {"adsIdleAmountScale", offsetof(WeaponAttachment, fAdsIdleAmountScale), CSPFT_FLOAT}, - {"swayOverride", offsetof(WeaponAttachment, swayOverride), CSPFT_BOOL}, - {"swayMaxAngle", offsetof(WeaponAttachment, swayMaxAngle), CSPFT_FLOAT}, - {"swayLerpSpeed", offsetof(WeaponAttachment, swayLerpSpeed), CSPFT_FLOAT}, - {"swayPitchScale", offsetof(WeaponAttachment, swayPitchScale), CSPFT_FLOAT}, - {"swayYawScale", offsetof(WeaponAttachment, swayYawScale), CSPFT_FLOAT}, - {"swayHorizScale", offsetof(WeaponAttachment, swayHorizScale), CSPFT_FLOAT}, - {"swayVertScale", offsetof(WeaponAttachment, swayVertScale), CSPFT_FLOAT}, - {"adsSwayOverride", offsetof(WeaponAttachment, adsSwayOverride), CSPFT_BOOL}, - {"adsSwayMaxAngle", offsetof(WeaponAttachment, adsSwayMaxAngle), CSPFT_FLOAT}, - {"adsSwayLerpSpeed", offsetof(WeaponAttachment, adsSwayLerpSpeed), CSPFT_FLOAT}, - {"adsSwayPitchScale", offsetof(WeaponAttachment, adsSwayPitchScale), CSPFT_FLOAT}, - {"adsSwayYawScale", offsetof(WeaponAttachment, adsSwayYawScale), CSPFT_FLOAT}, - {"adsSwayHorizScale", offsetof(WeaponAttachment, fAdsSwayHorizScale), CSPFT_FLOAT}, - {"adsSwayVertScale", offsetof(WeaponAttachment, fAdsSwayVertScale), CSPFT_FLOAT}, - {"adsMoveSpeedScale", offsetof(WeaponAttachment, adsMoveSpeedScale), CSPFT_FLOAT}, - {"hipSpreadMinScale", offsetof(WeaponAttachment, fHipSpreadMinScale), CSPFT_FLOAT}, - {"hipSpreadMaxScale", offsetof(WeaponAttachment, fHipSpreadMaxScale), CSPFT_FLOAT}, - {"strafeRotR", offsetof(WeaponAttachment, strafeRotR), CSPFT_FLOAT}, - {"standMoveF", offsetof(WeaponAttachment, standMoveF), CSPFT_FLOAT}, - {"standRotP", offsetof(WeaponAttachment, vStandRot.x), CSPFT_FLOAT}, - {"standRotY", offsetof(WeaponAttachment, vStandRot.y), CSPFT_FLOAT}, - {"standRotR", offsetof(WeaponAttachment, vStandRot.z), CSPFT_FLOAT}, - {"fireTimeScale", offsetof(WeaponAttachment, fFireTimeScale), CSPFT_FLOAT}, - {"reloadTimeScale", offsetof(WeaponAttachment, fReloadTimeScale), CSPFT_FLOAT}, - {"reloadEmptyTimeScale", offsetof(WeaponAttachment, fReloadEmptyTimeScale), CSPFT_FLOAT}, - {"reloadAddTimeScale", offsetof(WeaponAttachment, fReloadAddTimeScale), CSPFT_FLOAT}, - {"reloadQuickTimeScale", offsetof(WeaponAttachment, fReloadQuickTimeScale), CSPFT_FLOAT}, - {"reloadQuickEmptyTimeScale", offsetof(WeaponAttachment, fReloadQuickEmptyTimeScale), CSPFT_FLOAT}, - {"reloadQuickAddTimeScale", offsetof(WeaponAttachment, fReloadQuickAddTimeScale), CSPFT_FLOAT}, - {"perks1", offsetof(WeaponAttachment, perks[0]), CSPFT_UINT}, - {"perks0", offsetof(WeaponAttachment, perks[1]), CSPFT_UINT}, - {"altWeaponAdsOnly", offsetof(WeaponAttachment, bAltWeaponAdsOnly), CSPFT_BOOL}, - {"altWeaponDisableSwitching", offsetof(WeaponAttachment, bAltWeaponDisableSwitching), CSPFT_BOOL}, - {"altScopeADSTransInTime", offsetof(WeaponAttachment, altScopeADSTransInTime), CSPFT_FLOAT}, - {"altScopeADSTransOutTime", offsetof(WeaponAttachment, altScopeADSTransOutTime), CSPFT_FLOAT}, - {"silenced", offsetof(WeaponAttachment, bSilenced), CSPFT_BOOL}, - {"dualMag", offsetof(WeaponAttachment, bDualMag), CSPFT_BOOL}, - {"laserSight", offsetof(WeaponAttachment, laserSight), CSPFT_BOOL}, - {"infrared", offsetof(WeaponAttachment, bInfraRed), CSPFT_BOOL}, - {"useAsMelee", offsetof(WeaponAttachment, bUseAsMelee), CSPFT_BOOL}, - {"dualWield", offsetof(WeaponAttachment, bDualWield), CSPFT_BOOL}, - {"sharedAmmo", offsetof(WeaponAttachment, sharedAmmo), CSPFT_BOOL}, - {"mmsWeapon", offsetof(WeaponAttachment, mmsWeapon), CSPFT_BOOL}, - {"mmsInScope", offsetof(WeaponAttachment, mmsInScope), CSPFT_BOOL}, - {"mmsFOV", offsetof(WeaponAttachment, mmsFOV), CSPFT_FLOAT}, - {"mmsAspect", offsetof(WeaponAttachment, mmsAspect), CSPFT_FLOAT}, - {"mmsMaxDist", offsetof(WeaponAttachment, mmsMaxDist), CSPFT_FLOAT}, - {"clipSizeScale", offsetof(WeaponAttachment, clipSizeScale), CSPFT_FLOAT}, - {"clipSize", offsetof(WeaponAttachment, iClipSize), CSPFT_INT}, - {"stackFire", offsetof(WeaponAttachment, stackFire), CSPFT_FLOAT}, - {"stackFireSpread", offsetof(WeaponAttachment, stackFireSpread), CSPFT_FLOAT}, - {"stackFireAccuracyDecay", offsetof(WeaponAttachment, stackFireAccuracyDecay), CSPFT_FLOAT}, - {"customFloat0", offsetof(WeaponAttachment, customFloat0), CSPFT_FLOAT}, - {"customFloat1", offsetof(WeaponAttachment, customFloat1), CSPFT_FLOAT}, - {"customFloat2", offsetof(WeaponAttachment, customFloat2), CSPFT_FLOAT}, - {"customBool0", offsetof(WeaponAttachment, customBool0), CSPFT_BOOL}, - {"customBool1", offsetof(WeaponAttachment, customBool1), CSPFT_BOOL}, - {"customBool2", offsetof(WeaponAttachment, customBool2), CSPFT_BOOL}, + inline cspField_t attachment_fields[]{ + {"displayName", offsetof(WeaponAttachment, szDisplayName), CSPFT_STRING }, + {"attachmentType", offsetof(WeaponAttachment, attachmentType), AFT_ATTACHMENTTYPE}, + {"penetrateType", offsetof(WeaponAttachment, penetrateType), AFT_PENETRATE_TYPE}, + {"firstRaisePriority", offsetof(WeaponAttachment, firstRaisePriority), CSPFT_INT }, + {"hipIdleAmount", offsetof(WeaponAttachment, fHipIdleAmount), CSPFT_FLOAT }, + {"fireType", offsetof(WeaponAttachment, fireType), AFT_FIRETYPE }, + {"damageRangeScale", offsetof(WeaponAttachment, fDamageRangeScale), CSPFT_FLOAT }, + {"adsZoomFov1", offsetof(WeaponAttachment, fAdsZoomFov1), CSPFT_FLOAT }, + {"adsZoomFov2", offsetof(WeaponAttachment, fAdsZoomFov2), CSPFT_FLOAT }, + {"adsZoomFov3", offsetof(WeaponAttachment, fAdsZoomFov3), CSPFT_FLOAT }, + {"adsZoomInFrac", offsetof(WeaponAttachment, fAdsZoomInFrac), CSPFT_FLOAT }, + {"adsZoomOutFrac", offsetof(WeaponAttachment, fAdsZoomOutFrac), CSPFT_FLOAT }, + {"adsTransInTimeScale", offsetof(WeaponAttachment, fAdsTransInTimeScale), CSPFT_FLOAT }, + {"adsTransOutTimeScale", offsetof(WeaponAttachment, fAdsTransOutTimeScale), CSPFT_FLOAT }, + {"adsRecoilReductionRate", offsetof(WeaponAttachment, fAdsRecoilReductionRate), CSPFT_FLOAT }, + {"adsRecoilReductionLimit", offsetof(WeaponAttachment, fAdsRecoilReductionLimit), CSPFT_FLOAT }, + {"adsViewKickCenterSpeedScale", offsetof(WeaponAttachment, fAdsViewKickCenterSpeedScale), CSPFT_FLOAT }, + {"adsIdleAmountScale", offsetof(WeaponAttachment, fAdsIdleAmountScale), CSPFT_FLOAT }, + {"swayOverride", offsetof(WeaponAttachment, swayOverride), CSPFT_BOOL }, + {"swayMaxAngle", offsetof(WeaponAttachment, swayMaxAngle), CSPFT_FLOAT }, + {"swayLerpSpeed", offsetof(WeaponAttachment, swayLerpSpeed), CSPFT_FLOAT }, + {"swayPitchScale", offsetof(WeaponAttachment, swayPitchScale), CSPFT_FLOAT }, + {"swayYawScale", offsetof(WeaponAttachment, swayYawScale), CSPFT_FLOAT }, + {"swayHorizScale", offsetof(WeaponAttachment, swayHorizScale), CSPFT_FLOAT }, + {"swayVertScale", offsetof(WeaponAttachment, swayVertScale), CSPFT_FLOAT }, + {"adsSwayOverride", offsetof(WeaponAttachment, adsSwayOverride), CSPFT_BOOL }, + {"adsSwayMaxAngle", offsetof(WeaponAttachment, adsSwayMaxAngle), CSPFT_FLOAT }, + {"adsSwayLerpSpeed", offsetof(WeaponAttachment, adsSwayLerpSpeed), CSPFT_FLOAT }, + {"adsSwayPitchScale", offsetof(WeaponAttachment, adsSwayPitchScale), CSPFT_FLOAT }, + {"adsSwayYawScale", offsetof(WeaponAttachment, adsSwayYawScale), CSPFT_FLOAT }, + {"adsSwayHorizScale", offsetof(WeaponAttachment, fAdsSwayHorizScale), CSPFT_FLOAT }, + {"adsSwayVertScale", offsetof(WeaponAttachment, fAdsSwayVertScale), CSPFT_FLOAT }, + {"adsMoveSpeedScale", offsetof(WeaponAttachment, adsMoveSpeedScale), CSPFT_FLOAT }, + {"hipSpreadMinScale", offsetof(WeaponAttachment, fHipSpreadMinScale), CSPFT_FLOAT }, + {"hipSpreadMaxScale", offsetof(WeaponAttachment, fHipSpreadMaxScale), CSPFT_FLOAT }, + {"strafeRotR", offsetof(WeaponAttachment, strafeRotR), CSPFT_FLOAT }, + {"standMoveF", offsetof(WeaponAttachment, standMoveF), CSPFT_FLOAT }, + {"standRotP", offsetof(WeaponAttachment, vStandRot.x), CSPFT_FLOAT }, + {"standRotY", offsetof(WeaponAttachment, vStandRot.y), CSPFT_FLOAT }, + {"standRotR", offsetof(WeaponAttachment, vStandRot.z), CSPFT_FLOAT }, + {"fireTimeScale", offsetof(WeaponAttachment, fFireTimeScale), CSPFT_FLOAT }, + {"reloadTimeScale", offsetof(WeaponAttachment, fReloadTimeScale), CSPFT_FLOAT }, + {"reloadEmptyTimeScale", offsetof(WeaponAttachment, fReloadEmptyTimeScale), CSPFT_FLOAT }, + {"reloadAddTimeScale", offsetof(WeaponAttachment, fReloadAddTimeScale), CSPFT_FLOAT }, + {"reloadQuickTimeScale", offsetof(WeaponAttachment, fReloadQuickTimeScale), CSPFT_FLOAT }, + {"reloadQuickEmptyTimeScale", offsetof(WeaponAttachment, fReloadQuickEmptyTimeScale), CSPFT_FLOAT }, + {"reloadQuickAddTimeScale", offsetof(WeaponAttachment, fReloadQuickAddTimeScale), CSPFT_FLOAT }, + {"perks1", offsetof(WeaponAttachment, perks[0]), CSPFT_UINT }, + {"perks0", offsetof(WeaponAttachment, perks[1]), CSPFT_UINT }, + {"altWeaponAdsOnly", offsetof(WeaponAttachment, bAltWeaponAdsOnly), CSPFT_BOOL }, + {"altWeaponDisableSwitching", offsetof(WeaponAttachment, bAltWeaponDisableSwitching), CSPFT_BOOL }, + {"altScopeADSTransInTime", offsetof(WeaponAttachment, altScopeADSTransInTime), CSPFT_FLOAT }, + {"altScopeADSTransOutTime", offsetof(WeaponAttachment, altScopeADSTransOutTime), CSPFT_FLOAT }, + {"silenced", offsetof(WeaponAttachment, bSilenced), CSPFT_BOOL }, + {"dualMag", offsetof(WeaponAttachment, bDualMag), CSPFT_BOOL }, + {"laserSight", offsetof(WeaponAttachment, laserSight), CSPFT_BOOL }, + {"infrared", offsetof(WeaponAttachment, bInfraRed), CSPFT_BOOL }, + {"useAsMelee", offsetof(WeaponAttachment, bUseAsMelee), CSPFT_BOOL }, + {"dualWield", offsetof(WeaponAttachment, bDualWield), CSPFT_BOOL }, + {"sharedAmmo", offsetof(WeaponAttachment, sharedAmmo), CSPFT_BOOL }, + {"mmsWeapon", offsetof(WeaponAttachment, mmsWeapon), CSPFT_BOOL }, + {"mmsInScope", offsetof(WeaponAttachment, mmsInScope), CSPFT_BOOL }, + {"mmsFOV", offsetof(WeaponAttachment, mmsFOV), CSPFT_FLOAT }, + {"mmsAspect", offsetof(WeaponAttachment, mmsAspect), CSPFT_FLOAT }, + {"mmsMaxDist", offsetof(WeaponAttachment, mmsMaxDist), CSPFT_FLOAT }, + {"clipSizeScale", offsetof(WeaponAttachment, clipSizeScale), CSPFT_FLOAT }, + {"clipSize", offsetof(WeaponAttachment, iClipSize), CSPFT_INT }, + {"stackFire", offsetof(WeaponAttachment, stackFire), CSPFT_FLOAT }, + {"stackFireSpread", offsetof(WeaponAttachment, stackFireSpread), CSPFT_FLOAT }, + {"stackFireAccuracyDecay", offsetof(WeaponAttachment, stackFireAccuracyDecay), CSPFT_FLOAT }, + {"customFloat0", offsetof(WeaponAttachment, customFloat0), CSPFT_FLOAT }, + {"customFloat1", offsetof(WeaponAttachment, customFloat1), CSPFT_FLOAT }, + {"customFloat2", offsetof(WeaponAttachment, customFloat2), CSPFT_FLOAT }, + {"customBool0", offsetof(WeaponAttachment, customBool0), CSPFT_BOOL }, + {"customBool1", offsetof(WeaponAttachment, customBool1), CSPFT_BOOL }, + {"customBool2", offsetof(WeaponAttachment, customBool2), CSPFT_BOOL }, }; -} \ No newline at end of file +} diff --git a/src/ObjCommon/Game/T6/InfoString/WeaponAttachmentUniqueFields.h b/src/ObjCommon/Game/T6/InfoString/WeaponAttachmentUniqueFields.h index 27dc77792..654a66279 100644 --- a/src/ObjCommon/Game/T6/InfoString/WeaponAttachmentUniqueFields.h +++ b/src/ObjCommon/Game/T6/InfoString/WeaponAttachmentUniqueFields.h @@ -3,208 +3,207 @@ namespace T6 { - inline cspField_t attachment_unique_fields[] - { - {"attachmentType", offsetof(WeaponAttachmentUniqueFull, attachment.attachmentType), AUFT_ATTACHMENTTYPE}, - {"locNone", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_NONE]), CSPFT_FLOAT}, - {"locHelmet", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_HELMET]), CSPFT_FLOAT}, - {"locHead", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_HEAD]), CSPFT_FLOAT}, - {"locNeck", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_NECK]), CSPFT_FLOAT}, - {"locTorsoUpper", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_TORSO_UPR]), CSPFT_FLOAT}, - {"locTorsoMid", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_TORSO_MID]), CSPFT_FLOAT}, - {"locTorsoLower", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_TORSO_LWR]), CSPFT_FLOAT}, - {"locRightArmUpper", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_R_ARM_UPR]), CSPFT_FLOAT}, - {"locRightArmLower", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_R_ARM_LWR]), CSPFT_FLOAT}, - {"locRightHand", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_R_HAND]), CSPFT_FLOAT}, - {"locLeftArmUpper", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_L_ARM_UPR]), CSPFT_FLOAT}, - {"locLeftArmLower", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_L_ARM_LWR]), CSPFT_FLOAT}, - {"locLeftHand", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_L_HAND]), CSPFT_FLOAT}, - {"locRightLegUpper", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_R_LEG_UPR]), CSPFT_FLOAT}, - {"locRightLegLower", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_R_LEG_LWR]), CSPFT_FLOAT}, - {"locRightFoot", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_R_FOOT]), CSPFT_FLOAT}, - {"locLeftLegUpper", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_L_LEG_UPR]), CSPFT_FLOAT}, - {"locLeftLegLower", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_L_LEG_LWR]), CSPFT_FLOAT}, - {"locLeftFoot", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_L_FOOT]), CSPFT_FLOAT}, - {"locGun", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_GUN]), CSPFT_FLOAT}, - {"viewModel", offsetof(WeaponAttachmentUniqueFull, attachment.viewModel), CSPFT_XMODEL}, - {"viewModelAdditional", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelAdditional), CSPFT_XMODEL}, - {"viewModelADS", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelADS), CSPFT_XMODEL}, - {"worldModel", offsetof(WeaponAttachmentUniqueFull, attachment.worldModel), CSPFT_XMODEL}, - {"worldModelAdditional", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelAdditional), CSPFT_XMODEL}, - {"viewModelTag", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelTag), CSPFT_STRING}, - {"worldModelTag", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelTag), CSPFT_STRING}, - {"viewModelOffsetX", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelOffsets.x), CSPFT_FLOAT}, - {"viewModelOffsetY", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelOffsets.y), CSPFT_FLOAT}, - {"viewModelOffsetZ", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelOffsets.z), CSPFT_FLOAT}, - {"viewModelOffsetPitch", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelRotations.x), CSPFT_FLOAT}, - {"viewModelOffsetYaw", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelRotations.y), CSPFT_FLOAT}, - {"viewModelOffsetRoll", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelRotations.z), CSPFT_FLOAT}, - {"worldModelOffsetX", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelOffsets.x), CSPFT_FLOAT}, - {"worldModelOffsetY", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelOffsets.y), CSPFT_FLOAT}, - {"worldModelOffsetZ", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelOffsets.z), CSPFT_FLOAT}, - {"worldModelOffsetPitch", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelRotations.x), CSPFT_FLOAT}, - {"worldModelOffsetYaw", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelRotations.y), CSPFT_FLOAT}, - {"worldModelOffsetRoll", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelRotations.z), CSPFT_FLOAT}, - {"viewModelAddOffsetX", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelAddOffsets.x), CSPFT_FLOAT}, - {"viewModelAddOffsetY", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelAddOffsets.y), CSPFT_FLOAT}, - {"viewModelAddOffsetZ", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelAddOffsets.z), CSPFT_FLOAT}, - {"viewModelAddOffsetPitch", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelAddRotations.x), CSPFT_FLOAT}, - {"viewModelAddOffsetYaw", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelAddRotations.y), CSPFT_FLOAT}, - {"viewModelAddOffsetRoll", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelAddRotations.z), CSPFT_FLOAT}, - {"worldModelAddOffsetX", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelAddOffsets.x), CSPFT_FLOAT}, - {"worldModelAddOffsetY", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelAddOffsets.y), CSPFT_FLOAT}, - {"worldModelAddOffsetZ", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelAddOffsets.z), CSPFT_FLOAT}, - {"worldModelAddOffsetPitch", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelAddRotations.x), CSPFT_FLOAT}, - {"worldModelAddOffsetYaw", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelAddRotations.y), CSPFT_FLOAT}, - {"worldModelAddOffsetRoll", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelAddRotations.z), CSPFT_FLOAT}, - {"hideTags", offsetof(WeaponAttachmentUniqueFull, hideTags), AUFT_HIDETAGS}, - {"camo", offsetof(WeaponAttachmentUniqueFull, attachment.weaponCamo), AUFT_CAMO}, - {"disableBaseWeaponAttachment", offsetof(WeaponAttachmentUniqueFull, attachment.disableBaseWeaponAttachment), CSPFT_BOOL}, - {"disableBaseWeaponClip", offsetof(WeaponAttachmentUniqueFull, attachment.disableBaseWeaponClip), CSPFT_BOOL}, - {"overrideBaseWeaponAttachmentOffsets", offsetof(WeaponAttachmentUniqueFull, attachment.overrideBaseWeaponAttachmentOffsets), CSPFT_BOOL}, - {"viewModelOffsetBaseAttachmentX", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelOffsetBaseAttachment.x), CSPFT_FLOAT}, - {"viewModelOffsetBaseAttachmentY", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelOffsetBaseAttachment.y), CSPFT_FLOAT}, - {"viewModelOffsetBaseAttachmentZ", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelOffsetBaseAttachment.z), CSPFT_FLOAT}, - {"worldModelOffsetBaseAttachmentX", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelOffsetBaseAttachment.x), CSPFT_FLOAT}, - {"worldModelOffsetBaseAttachmentY", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelOffsetBaseAttachment.y), CSPFT_FLOAT}, - {"worldModelOffsetBaseAttachmentZ", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelOffsetBaseAttachment.z), CSPFT_FLOAT}, - {"altWeapon", offsetof(WeaponAttachmentUniqueFull, attachment.szAltWeaponName), CSPFT_STRING}, - {"DualWieldWeapon", offsetof(WeaponAttachmentUniqueFull, attachment.szDualWieldWeaponName), CSPFT_STRING}, - {"adsOverlayShader", offsetof(WeaponAttachmentUniqueFull, attachment.overlayMaterial), CSPFT_MATERIAL_STREAM}, - {"adsOverlayShaderLowRes", offsetof(WeaponAttachmentUniqueFull, attachment.overlayMaterialLowRes), CSPFT_MATERIAL_STREAM}, - {"adsOverlayReticle", offsetof(WeaponAttachmentUniqueFull, attachment.overlayReticle), AUFT_OVERLAYRETICLE}, - {"firstRaiseTime", offsetof(WeaponAttachmentUniqueFull, attachment.iFirstRaiseTime), CSPFT_MILLISECONDS}, - {"altRaiseTime", offsetof(WeaponAttachmentUniqueFull, attachment.iAltRaiseTime), CSPFT_MILLISECONDS}, - {"altDropTime", offsetof(WeaponAttachmentUniqueFull, attachment.iAltDropTime), CSPFT_MILLISECONDS}, - {"reloadAmmoAdd", offsetof(WeaponAttachmentUniqueFull, attachment.iReloadAmmoAdd), CSPFT_INT}, - {"reloadStartAdd", offsetof(WeaponAttachmentUniqueFull, attachment.iReloadStartAdd), CSPFT_INT}, - {"segmentedReload", offsetof(WeaponAttachmentUniqueFull, attachment.bSegmentedReload), CSPFT_BOOL}, - {"idleAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_IDLE]), CSPFT_STRING}, - {"idleAnimLeft", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_IDLE_LEFT]), CSPFT_STRING}, - {"emptyIdleAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_EMPTY_IDLE]), CSPFT_STRING}, - {"emptyIdleAnimLeft", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_EMPTY_IDLE_LEFT]), CSPFT_STRING}, - {"fireIntroAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_FIRE_INTRO]), CSPFT_STRING}, - {"fireAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_FIRE]), CSPFT_STRING}, - {"fireAnimLeft", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_FIRE_LEFT]), CSPFT_STRING}, - {"holdFireAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_HOLD_FIRE]), CSPFT_STRING}, - {"lastShotAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_LASTSHOT]), CSPFT_STRING}, - {"lastShotAnimLeft", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_LASTSHOT_LEFT]), CSPFT_STRING}, - {"flourishAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_FINALSHOT]), CSPFT_STRING}, - {"flourishAnimLeft", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_FINALSHOT_LEFT]), CSPFT_STRING}, - {"detonateAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_DETONATE]), CSPFT_STRING}, - {"rechamberAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_RECHAMBER]), CSPFT_STRING}, - {"meleeAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_MELEE]), CSPFT_STRING}, - {"meleeAnimEmpty", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_MELEE_EMPTY]), CSPFT_STRING}, - {"meleeAnim1", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_MELEE1]), CSPFT_STRING}, - {"meleeAnim2", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_MELEE2]), CSPFT_STRING}, - {"meleeAnim3", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_MELEE3]), CSPFT_STRING}, - {"meleeChargeAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_MELEE_CHARGE]), CSPFT_STRING}, - {"meleeChargeAnimEmpty", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_MELEE_CHARGE_EMPTY]), CSPFT_STRING}, - {"reloadAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_RELOAD]), CSPFT_STRING}, - {"reloadAnimRight", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_RELOAD_RIGHT]), CSPFT_STRING}, - {"reloadAnimLeft", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_RELOAD_LEFT]), CSPFT_STRING}, - {"reloadEmptyAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_RELOAD_EMPTY]), CSPFT_STRING}, - {"reloadEmptyAnimLeft", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_RELOAD_EMPTY_LEFT]), CSPFT_STRING}, - {"reloadStartAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_RELOAD_START]), CSPFT_STRING}, - {"reloadEndAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_RELOAD_END]), CSPFT_STRING}, - {"reloadQuickAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_RELOAD_QUICK]), CSPFT_STRING}, - {"reloadQuickEmptyAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_RELOAD_QUICK_EMPTY]), CSPFT_STRING}, - {"raiseAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_RAISE]), CSPFT_STRING}, - {"dropAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_DROP]), CSPFT_STRING}, - {"firstRaiseAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_FIRST_RAISE]), CSPFT_STRING}, - {"altRaiseAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_ALT_RAISE]), CSPFT_STRING}, - {"altDropAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_ALT_DROP]), CSPFT_STRING}, - {"quickRaiseAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_QUICK_RAISE]), CSPFT_STRING}, - {"quickDropAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_QUICK_DROP]), CSPFT_STRING}, - {"emptyRaiseAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_EMPTY_RAISE]), CSPFT_STRING}, - {"emptyDropAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_EMPTY_DROP]), CSPFT_STRING}, - {"sprintInAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_SPRINT_IN]), CSPFT_STRING}, - {"sprintLoopAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_SPRINT_LOOP]), CSPFT_STRING}, - {"sprintOutAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_SPRINT_OUT]), CSPFT_STRING}, - {"sprintInEmptyAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_SPRINT_EMPTY_IN]), CSPFT_STRING}, - {"sprintLoopEmptyAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_SPRINT_EMPTY_LOOP]), CSPFT_STRING}, - {"sprintOutEmptyAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_SPRINT_EMPTY_OUT]), CSPFT_STRING}, - {"lowReadyInAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_LOWREADY_IN]), CSPFT_STRING}, - {"lowReadyLoopAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_LOWREADY_LOOP]), CSPFT_STRING}, - {"lowReadyOutAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_LOWREADY_OUT]), CSPFT_STRING}, - {"contFireInAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CONT_FIRE_IN]), CSPFT_STRING}, - {"contFireLoopAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CONT_FIRE_LOOP]), CSPFT_STRING}, - {"contFireOutAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CONT_FIRE_OUT]), CSPFT_STRING}, - {"crawlInAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CRAWL_IN]), CSPFT_STRING}, - {"crawlForwardAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CRAWL_FORWARD]), CSPFT_STRING}, - {"crawlBackAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CRAWL_BACK]), CSPFT_STRING}, - {"crawlRightAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CRAWL_RIGHT]), CSPFT_STRING}, - {"crawlLeftAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CRAWL_LEFT]), CSPFT_STRING}, - {"crawlOutAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CRAWL_OUT]), CSPFT_STRING}, - {"crawlEmptyInAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CRAWL_EMPTY_IN]), CSPFT_STRING}, - {"crawlEmptyForwardAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CRAWL_EMPTY_FORWARD]), CSPFT_STRING}, - {"crawlEmptyBackAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CRAWL_EMPTY_BACK]), CSPFT_STRING}, - {"crawlEmptyRightAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CRAWL_EMPTY_RIGHT]), CSPFT_STRING}, - {"crawlEmptyLeftAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CRAWL_EMPTY_LEFT]), CSPFT_STRING}, - {"crawlEmptyOutAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CRAWL_EMPTY_OUT]), CSPFT_STRING}, - {"deployAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_DEPLOY]), CSPFT_STRING}, - {"breakdownAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_BREAKDOWN]), CSPFT_STRING}, - {"nightVisionWearAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_NIGHTVISION_WEAR]), CSPFT_STRING}, - {"nightVisionRemoveAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_NIGHTVISION_REMOVE]), CSPFT_STRING}, - {"adsFireAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_ADS_FIRE]), CSPFT_STRING}, - {"adsLastShotAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_ADS_LASTSHOT]), CSPFT_STRING}, - {"adsRechamberAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_ADS_RECHAMBER]), CSPFT_STRING}, - {"adsUpAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_ADS_UP]), CSPFT_STRING}, - {"adsDownAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_ADS_DOWN]), CSPFT_STRING}, - {"adsUpOtherScopeAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_ADS_UP_OTHER_SCOPE]), CSPFT_STRING}, - {"adsFireIntroAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_ADS_FIRE_INTRO]), CSPFT_STRING}, - {"dtp_in", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_DTP_IN]), CSPFT_STRING}, - {"dtp_loop", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_DTP_LOOP]), CSPFT_STRING}, - {"dtp_out", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_DTP_OUT]), CSPFT_STRING}, - {"dtp_empty_in", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_DTP_EMPTY_IN]), CSPFT_STRING}, - {"dtp_empty_loop", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_DTP_EMPTY_LOOP]), CSPFT_STRING}, - {"dtp_empty_out", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_DTP_EMPTY_OUT]), CSPFT_STRING}, - {"slide_in", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_SLIDE_IN]), CSPFT_STRING}, - {"mantleAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_MANTLE]), CSPFT_STRING}, - {"sprintCameraAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CAMERA_SPRINT_LOOP]), CSPFT_STRING}, - {"dtpInCameraAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CAMERA_DTP_IN]), CSPFT_STRING}, - {"dtpLoopCameraAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CAMERA_DTP_LOOP]), CSPFT_STRING}, - {"dtpOutCameraAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CAMERA_DTP_OUT]), CSPFT_STRING}, - {"mantleCameraAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CAMERA_MANTLE]), CSPFT_STRING}, - {"fireSound", offsetof(WeaponAttachmentUniqueFull, attachment.fireSound), CSPFT_STRING}, - {"fireSoundPlayer", offsetof(WeaponAttachmentUniqueFull, attachment.fireSoundPlayer), CSPFT_STRING}, - {"loopFireSound", offsetof(WeaponAttachmentUniqueFull, attachment.fireLoopSound), CSPFT_STRING}, - {"loopFireSoundPlayer", offsetof(WeaponAttachmentUniqueFull, attachment.fireLoopSoundPlayer), CSPFT_STRING}, - {"loopFireEndSound", offsetof(WeaponAttachmentUniqueFull, attachment.fireLoopEndSound), CSPFT_STRING}, - {"loopFireEndSoundPlayer", offsetof(WeaponAttachmentUniqueFull, attachment.fireLoopEndSoundPlayer), CSPFT_STRING}, - {"startFireSound", offsetof(WeaponAttachmentUniqueFull, attachment.fireStartSound), CSPFT_STRING}, - {"stopFireSound", offsetof(WeaponAttachmentUniqueFull, attachment.fireStopSound), CSPFT_STRING}, - {"startFireSoundPlayer", offsetof(WeaponAttachmentUniqueFull, attachment.fireStartSoundPlayer), CSPFT_STRING}, - {"stopFireSoundPlayer", offsetof(WeaponAttachmentUniqueFull, attachment.fireStopSoundPlayer), CSPFT_STRING}, - {"lastShotSound", offsetof(WeaponAttachmentUniqueFull, attachment.fireLastSound), CSPFT_STRING}, - {"lastShotSoundPlayer", offsetof(WeaponAttachmentUniqueFull, attachment.fireLastSoundPlayer), CSPFT_STRING}, - {"killcamStartFireSound", offsetof(WeaponAttachmentUniqueFull, attachment.fireKillcamSound), CSPFT_STRING}, - {"killcamStartFireSoundPlayer", offsetof(WeaponAttachmentUniqueFull, attachment.fireKillcamSoundPlayer), CSPFT_STRING}, - {"viewFlashEffect", offsetof(WeaponAttachmentUniqueFull, attachment.viewFlashEffect), CSPFT_FX}, - {"worldFlashEffect", offsetof(WeaponAttachmentUniqueFull, attachment.worldFlashEffect), CSPFT_FX}, - {"tracerType", offsetof(WeaponAttachmentUniqueFull, attachment.tracerType), CSPFT_TRACER}, - {"enemyTracerType", offsetof(WeaponAttachmentUniqueFull, attachment.enemyTracerType), CSPFT_TRACER}, - {"adsDofStart", offsetof(WeaponAttachmentUniqueFull, attachment.adsDofStart), CSPFT_FLOAT}, - {"adsDofEnd", offsetof(WeaponAttachmentUniqueFull, attachment.adsDofEnd), CSPFT_FLOAT}, - {"overrideLeftHandIK", offsetof(WeaponAttachmentUniqueFull, attachment.bOverrideLeftHandIK), CSPFT_BOOL}, - {"overrideLeftHandProneIK", offsetof(WeaponAttachmentUniqueFull, attachment.bOverrideLeftHandProneIK), CSPFT_BOOL}, - {"ikLeftHandOffsetF", offsetof(WeaponAttachmentUniqueFull, attachment.ikLeftHandOffset.x), CSPFT_FLOAT}, - {"ikLeftHandOffsetR", offsetof(WeaponAttachmentUniqueFull, attachment.ikLeftHandOffset.y), CSPFT_FLOAT}, - {"ikLeftHandOffsetU", offsetof(WeaponAttachmentUniqueFull, attachment.ikLeftHandOffset.z), CSPFT_FLOAT}, - {"ikLeftHandRotationP", offsetof(WeaponAttachmentUniqueFull, attachment.ikLeftHandRotation.x), CSPFT_FLOAT}, - {"ikLeftHandRotationY", offsetof(WeaponAttachmentUniqueFull, attachment.ikLeftHandRotation.y), CSPFT_FLOAT}, - {"ikLeftHandRotationR", offsetof(WeaponAttachmentUniqueFull, attachment.ikLeftHandRotation.z), CSPFT_FLOAT}, - {"ikLeftHandProneOffsetF", offsetof(WeaponAttachmentUniqueFull, attachment.ikLeftHandProneOffset.x), CSPFT_FLOAT}, - {"ikLeftHandProneOffsetR", offsetof(WeaponAttachmentUniqueFull, attachment.ikLeftHandProneOffset.y), CSPFT_FLOAT}, - {"ikLeftHandProneOffsetU", offsetof(WeaponAttachmentUniqueFull, attachment.ikLeftHandProneOffset.z), CSPFT_FLOAT}, - {"ikLeftHandProneRotationP", offsetof(WeaponAttachmentUniqueFull, attachment.ikLeftHandProneRotation.x), CSPFT_FLOAT}, - {"ikLeftHandProneRotationY", offsetof(WeaponAttachmentUniqueFull, attachment.ikLeftHandProneRotation.y), CSPFT_FLOAT}, - {"ikLeftHandProneRotationR", offsetof(WeaponAttachmentUniqueFull, attachment.ikLeftHandProneRotation.z), CSPFT_FLOAT}, - {"customFloat0", offsetof(WeaponAttachmentUniqueFull, attachment.customFloat0), CSPFT_FLOAT}, - {"customFloat1", offsetof(WeaponAttachmentUniqueFull, attachment.customFloat1), CSPFT_FLOAT}, - {"customFloat2", offsetof(WeaponAttachmentUniqueFull, attachment.customFloat2), CSPFT_FLOAT}, - {"customBool0", offsetof(WeaponAttachmentUniqueFull, attachment.customBool0), CSPFT_BOOL}, - {"customBool1", offsetof(WeaponAttachmentUniqueFull, attachment.customBool1), CSPFT_BOOL}, - {"customBool2", offsetof(WeaponAttachmentUniqueFull, attachment.customBool2), CSPFT_BOOL} + inline cspField_t attachment_unique_fields[]{ + {"attachmentType", offsetof(WeaponAttachmentUniqueFull, attachment.attachmentType), AUFT_ATTACHMENTTYPE }, + {"locNone", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_NONE]), CSPFT_FLOAT }, + {"locHelmet", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_HELMET]), CSPFT_FLOAT }, + {"locHead", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_HEAD]), CSPFT_FLOAT }, + {"locNeck", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_NECK]), CSPFT_FLOAT }, + {"locTorsoUpper", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_TORSO_UPR]), CSPFT_FLOAT }, + {"locTorsoMid", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_TORSO_MID]), CSPFT_FLOAT }, + {"locTorsoLower", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_TORSO_LWR]), CSPFT_FLOAT }, + {"locRightArmUpper", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_R_ARM_UPR]), CSPFT_FLOAT }, + {"locRightArmLower", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_R_ARM_LWR]), CSPFT_FLOAT }, + {"locRightHand", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_R_HAND]), CSPFT_FLOAT }, + {"locLeftArmUpper", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_L_ARM_UPR]), CSPFT_FLOAT }, + {"locLeftArmLower", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_L_ARM_LWR]), CSPFT_FLOAT }, + {"locLeftHand", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_L_HAND]), CSPFT_FLOAT }, + {"locRightLegUpper", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_R_LEG_UPR]), CSPFT_FLOAT }, + {"locRightLegLower", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_R_LEG_LWR]), CSPFT_FLOAT }, + {"locRightFoot", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_R_FOOT]), CSPFT_FLOAT }, + {"locLeftLegUpper", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_L_LEG_UPR]), CSPFT_FLOAT }, + {"locLeftLegLower", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_L_LEG_LWR]), CSPFT_FLOAT }, + {"locLeftFoot", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_L_FOOT]), CSPFT_FLOAT }, + {"locGun", offsetof(WeaponAttachmentUniqueFull, locationDamageMultipliers[HITLOC_GUN]), CSPFT_FLOAT }, + {"viewModel", offsetof(WeaponAttachmentUniqueFull, attachment.viewModel), CSPFT_XMODEL }, + {"viewModelAdditional", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelAdditional), CSPFT_XMODEL }, + {"viewModelADS", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelADS), CSPFT_XMODEL }, + {"worldModel", offsetof(WeaponAttachmentUniqueFull, attachment.worldModel), CSPFT_XMODEL }, + {"worldModelAdditional", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelAdditional), CSPFT_XMODEL }, + {"viewModelTag", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelTag), CSPFT_STRING }, + {"worldModelTag", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelTag), CSPFT_STRING }, + {"viewModelOffsetX", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelOffsets.x), CSPFT_FLOAT }, + {"viewModelOffsetY", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelOffsets.y), CSPFT_FLOAT }, + {"viewModelOffsetZ", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelOffsets.z), CSPFT_FLOAT }, + {"viewModelOffsetPitch", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelRotations.x), CSPFT_FLOAT }, + {"viewModelOffsetYaw", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelRotations.y), CSPFT_FLOAT }, + {"viewModelOffsetRoll", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelRotations.z), CSPFT_FLOAT }, + {"worldModelOffsetX", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelOffsets.x), CSPFT_FLOAT }, + {"worldModelOffsetY", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelOffsets.y), CSPFT_FLOAT }, + {"worldModelOffsetZ", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelOffsets.z), CSPFT_FLOAT }, + {"worldModelOffsetPitch", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelRotations.x), CSPFT_FLOAT }, + {"worldModelOffsetYaw", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelRotations.y), CSPFT_FLOAT }, + {"worldModelOffsetRoll", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelRotations.z), CSPFT_FLOAT }, + {"viewModelAddOffsetX", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelAddOffsets.x), CSPFT_FLOAT }, + {"viewModelAddOffsetY", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelAddOffsets.y), CSPFT_FLOAT }, + {"viewModelAddOffsetZ", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelAddOffsets.z), CSPFT_FLOAT }, + {"viewModelAddOffsetPitch", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelAddRotations.x), CSPFT_FLOAT }, + {"viewModelAddOffsetYaw", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelAddRotations.y), CSPFT_FLOAT }, + {"viewModelAddOffsetRoll", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelAddRotations.z), CSPFT_FLOAT }, + {"worldModelAddOffsetX", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelAddOffsets.x), CSPFT_FLOAT }, + {"worldModelAddOffsetY", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelAddOffsets.y), CSPFT_FLOAT }, + {"worldModelAddOffsetZ", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelAddOffsets.z), CSPFT_FLOAT }, + {"worldModelAddOffsetPitch", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelAddRotations.x), CSPFT_FLOAT }, + {"worldModelAddOffsetYaw", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelAddRotations.y), CSPFT_FLOAT }, + {"worldModelAddOffsetRoll", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelAddRotations.z), CSPFT_FLOAT }, + {"hideTags", offsetof(WeaponAttachmentUniqueFull, hideTags), AUFT_HIDETAGS }, + {"camo", offsetof(WeaponAttachmentUniqueFull, attachment.weaponCamo), AUFT_CAMO }, + {"disableBaseWeaponAttachment", offsetof(WeaponAttachmentUniqueFull, attachment.disableBaseWeaponAttachment), CSPFT_BOOL }, + {"disableBaseWeaponClip", offsetof(WeaponAttachmentUniqueFull, attachment.disableBaseWeaponClip), CSPFT_BOOL }, + {"overrideBaseWeaponAttachmentOffsets", offsetof(WeaponAttachmentUniqueFull, attachment.overrideBaseWeaponAttachmentOffsets), CSPFT_BOOL }, + {"viewModelOffsetBaseAttachmentX", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelOffsetBaseAttachment.x), CSPFT_FLOAT }, + {"viewModelOffsetBaseAttachmentY", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelOffsetBaseAttachment.y), CSPFT_FLOAT }, + {"viewModelOffsetBaseAttachmentZ", offsetof(WeaponAttachmentUniqueFull, attachment.viewModelOffsetBaseAttachment.z), CSPFT_FLOAT }, + {"worldModelOffsetBaseAttachmentX", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelOffsetBaseAttachment.x), CSPFT_FLOAT }, + {"worldModelOffsetBaseAttachmentY", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelOffsetBaseAttachment.y), CSPFT_FLOAT }, + {"worldModelOffsetBaseAttachmentZ", offsetof(WeaponAttachmentUniqueFull, attachment.worldModelOffsetBaseAttachment.z), CSPFT_FLOAT }, + {"altWeapon", offsetof(WeaponAttachmentUniqueFull, attachment.szAltWeaponName), CSPFT_STRING }, + {"DualWieldWeapon", offsetof(WeaponAttachmentUniqueFull, attachment.szDualWieldWeaponName), CSPFT_STRING }, + {"adsOverlayShader", offsetof(WeaponAttachmentUniqueFull, attachment.overlayMaterial), CSPFT_MATERIAL_STREAM}, + {"adsOverlayShaderLowRes", offsetof(WeaponAttachmentUniqueFull, attachment.overlayMaterialLowRes), CSPFT_MATERIAL_STREAM}, + {"adsOverlayReticle", offsetof(WeaponAttachmentUniqueFull, attachment.overlayReticle), AUFT_OVERLAYRETICLE }, + {"firstRaiseTime", offsetof(WeaponAttachmentUniqueFull, attachment.iFirstRaiseTime), CSPFT_MILLISECONDS }, + {"altRaiseTime", offsetof(WeaponAttachmentUniqueFull, attachment.iAltRaiseTime), CSPFT_MILLISECONDS }, + {"altDropTime", offsetof(WeaponAttachmentUniqueFull, attachment.iAltDropTime), CSPFT_MILLISECONDS }, + {"reloadAmmoAdd", offsetof(WeaponAttachmentUniqueFull, attachment.iReloadAmmoAdd), CSPFT_INT }, + {"reloadStartAdd", offsetof(WeaponAttachmentUniqueFull, attachment.iReloadStartAdd), CSPFT_INT }, + {"segmentedReload", offsetof(WeaponAttachmentUniqueFull, attachment.bSegmentedReload), CSPFT_BOOL }, + {"idleAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_IDLE]), CSPFT_STRING }, + {"idleAnimLeft", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_IDLE_LEFT]), CSPFT_STRING }, + {"emptyIdleAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_EMPTY_IDLE]), CSPFT_STRING }, + {"emptyIdleAnimLeft", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_EMPTY_IDLE_LEFT]), CSPFT_STRING }, + {"fireIntroAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_FIRE_INTRO]), CSPFT_STRING }, + {"fireAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_FIRE]), CSPFT_STRING }, + {"fireAnimLeft", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_FIRE_LEFT]), CSPFT_STRING }, + {"holdFireAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_HOLD_FIRE]), CSPFT_STRING }, + {"lastShotAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_LASTSHOT]), CSPFT_STRING }, + {"lastShotAnimLeft", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_LASTSHOT_LEFT]), CSPFT_STRING }, + {"flourishAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_FINALSHOT]), CSPFT_STRING }, + {"flourishAnimLeft", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_FINALSHOT_LEFT]), CSPFT_STRING }, + {"detonateAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_DETONATE]), CSPFT_STRING }, + {"rechamberAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_RECHAMBER]), CSPFT_STRING }, + {"meleeAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_MELEE]), CSPFT_STRING }, + {"meleeAnimEmpty", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_MELEE_EMPTY]), CSPFT_STRING }, + {"meleeAnim1", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_MELEE1]), CSPFT_STRING }, + {"meleeAnim2", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_MELEE2]), CSPFT_STRING }, + {"meleeAnim3", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_MELEE3]), CSPFT_STRING }, + {"meleeChargeAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_MELEE_CHARGE]), CSPFT_STRING }, + {"meleeChargeAnimEmpty", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_MELEE_CHARGE_EMPTY]), CSPFT_STRING }, + {"reloadAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_RELOAD]), CSPFT_STRING }, + {"reloadAnimRight", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_RELOAD_RIGHT]), CSPFT_STRING }, + {"reloadAnimLeft", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_RELOAD_LEFT]), CSPFT_STRING }, + {"reloadEmptyAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_RELOAD_EMPTY]), CSPFT_STRING }, + {"reloadEmptyAnimLeft", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_RELOAD_EMPTY_LEFT]), CSPFT_STRING }, + {"reloadStartAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_RELOAD_START]), CSPFT_STRING }, + {"reloadEndAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_RELOAD_END]), CSPFT_STRING }, + {"reloadQuickAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_RELOAD_QUICK]), CSPFT_STRING }, + {"reloadQuickEmptyAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_RELOAD_QUICK_EMPTY]), CSPFT_STRING }, + {"raiseAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_RAISE]), CSPFT_STRING }, + {"dropAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_DROP]), CSPFT_STRING }, + {"firstRaiseAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_FIRST_RAISE]), CSPFT_STRING }, + {"altRaiseAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_ALT_RAISE]), CSPFT_STRING }, + {"altDropAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_ALT_DROP]), CSPFT_STRING }, + {"quickRaiseAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_QUICK_RAISE]), CSPFT_STRING }, + {"quickDropAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_QUICK_DROP]), CSPFT_STRING }, + {"emptyRaiseAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_EMPTY_RAISE]), CSPFT_STRING }, + {"emptyDropAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_EMPTY_DROP]), CSPFT_STRING }, + {"sprintInAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_SPRINT_IN]), CSPFT_STRING }, + {"sprintLoopAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_SPRINT_LOOP]), CSPFT_STRING }, + {"sprintOutAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_SPRINT_OUT]), CSPFT_STRING }, + {"sprintInEmptyAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_SPRINT_EMPTY_IN]), CSPFT_STRING }, + {"sprintLoopEmptyAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_SPRINT_EMPTY_LOOP]), CSPFT_STRING }, + {"sprintOutEmptyAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_SPRINT_EMPTY_OUT]), CSPFT_STRING }, + {"lowReadyInAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_LOWREADY_IN]), CSPFT_STRING }, + {"lowReadyLoopAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_LOWREADY_LOOP]), CSPFT_STRING }, + {"lowReadyOutAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_LOWREADY_OUT]), CSPFT_STRING }, + {"contFireInAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CONT_FIRE_IN]), CSPFT_STRING }, + {"contFireLoopAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CONT_FIRE_LOOP]), CSPFT_STRING }, + {"contFireOutAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CONT_FIRE_OUT]), CSPFT_STRING }, + {"crawlInAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CRAWL_IN]), CSPFT_STRING }, + {"crawlForwardAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CRAWL_FORWARD]), CSPFT_STRING }, + {"crawlBackAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CRAWL_BACK]), CSPFT_STRING }, + {"crawlRightAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CRAWL_RIGHT]), CSPFT_STRING }, + {"crawlLeftAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CRAWL_LEFT]), CSPFT_STRING }, + {"crawlOutAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CRAWL_OUT]), CSPFT_STRING }, + {"crawlEmptyInAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CRAWL_EMPTY_IN]), CSPFT_STRING }, + {"crawlEmptyForwardAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CRAWL_EMPTY_FORWARD]), CSPFT_STRING }, + {"crawlEmptyBackAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CRAWL_EMPTY_BACK]), CSPFT_STRING }, + {"crawlEmptyRightAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CRAWL_EMPTY_RIGHT]), CSPFT_STRING }, + {"crawlEmptyLeftAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CRAWL_EMPTY_LEFT]), CSPFT_STRING }, + {"crawlEmptyOutAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CRAWL_EMPTY_OUT]), CSPFT_STRING }, + {"deployAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_DEPLOY]), CSPFT_STRING }, + {"breakdownAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_BREAKDOWN]), CSPFT_STRING }, + {"nightVisionWearAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_NIGHTVISION_WEAR]), CSPFT_STRING }, + {"nightVisionRemoveAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_NIGHTVISION_REMOVE]), CSPFT_STRING }, + {"adsFireAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_ADS_FIRE]), CSPFT_STRING }, + {"adsLastShotAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_ADS_LASTSHOT]), CSPFT_STRING }, + {"adsRechamberAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_ADS_RECHAMBER]), CSPFT_STRING }, + {"adsUpAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_ADS_UP]), CSPFT_STRING }, + {"adsDownAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_ADS_DOWN]), CSPFT_STRING }, + {"adsUpOtherScopeAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_ADS_UP_OTHER_SCOPE]), CSPFT_STRING }, + {"adsFireIntroAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_ADS_FIRE_INTRO]), CSPFT_STRING }, + {"dtp_in", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_DTP_IN]), CSPFT_STRING }, + {"dtp_loop", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_DTP_LOOP]), CSPFT_STRING }, + {"dtp_out", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_DTP_OUT]), CSPFT_STRING }, + {"dtp_empty_in", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_DTP_EMPTY_IN]), CSPFT_STRING }, + {"dtp_empty_loop", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_DTP_EMPTY_LOOP]), CSPFT_STRING }, + {"dtp_empty_out", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_DTP_EMPTY_OUT]), CSPFT_STRING }, + {"slide_in", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_SLIDE_IN]), CSPFT_STRING }, + {"mantleAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_MANTLE]), CSPFT_STRING }, + {"sprintCameraAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CAMERA_SPRINT_LOOP]), CSPFT_STRING }, + {"dtpInCameraAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CAMERA_DTP_IN]), CSPFT_STRING }, + {"dtpLoopCameraAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CAMERA_DTP_LOOP]), CSPFT_STRING }, + {"dtpOutCameraAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CAMERA_DTP_OUT]), CSPFT_STRING }, + {"mantleCameraAnim", offsetof(WeaponAttachmentUniqueFull, szXAnims[WEAP_ANIM_CAMERA_MANTLE]), CSPFT_STRING }, + {"fireSound", offsetof(WeaponAttachmentUniqueFull, attachment.fireSound), CSPFT_STRING }, + {"fireSoundPlayer", offsetof(WeaponAttachmentUniqueFull, attachment.fireSoundPlayer), CSPFT_STRING }, + {"loopFireSound", offsetof(WeaponAttachmentUniqueFull, attachment.fireLoopSound), CSPFT_STRING }, + {"loopFireSoundPlayer", offsetof(WeaponAttachmentUniqueFull, attachment.fireLoopSoundPlayer), CSPFT_STRING }, + {"loopFireEndSound", offsetof(WeaponAttachmentUniqueFull, attachment.fireLoopEndSound), CSPFT_STRING }, + {"loopFireEndSoundPlayer", offsetof(WeaponAttachmentUniqueFull, attachment.fireLoopEndSoundPlayer), CSPFT_STRING }, + {"startFireSound", offsetof(WeaponAttachmentUniqueFull, attachment.fireStartSound), CSPFT_STRING }, + {"stopFireSound", offsetof(WeaponAttachmentUniqueFull, attachment.fireStopSound), CSPFT_STRING }, + {"startFireSoundPlayer", offsetof(WeaponAttachmentUniqueFull, attachment.fireStartSoundPlayer), CSPFT_STRING }, + {"stopFireSoundPlayer", offsetof(WeaponAttachmentUniqueFull, attachment.fireStopSoundPlayer), CSPFT_STRING }, + {"lastShotSound", offsetof(WeaponAttachmentUniqueFull, attachment.fireLastSound), CSPFT_STRING }, + {"lastShotSoundPlayer", offsetof(WeaponAttachmentUniqueFull, attachment.fireLastSoundPlayer), CSPFT_STRING }, + {"killcamStartFireSound", offsetof(WeaponAttachmentUniqueFull, attachment.fireKillcamSound), CSPFT_STRING }, + {"killcamStartFireSoundPlayer", offsetof(WeaponAttachmentUniqueFull, attachment.fireKillcamSoundPlayer), CSPFT_STRING }, + {"viewFlashEffect", offsetof(WeaponAttachmentUniqueFull, attachment.viewFlashEffect), CSPFT_FX }, + {"worldFlashEffect", offsetof(WeaponAttachmentUniqueFull, attachment.worldFlashEffect), CSPFT_FX }, + {"tracerType", offsetof(WeaponAttachmentUniqueFull, attachment.tracerType), CSPFT_TRACER }, + {"enemyTracerType", offsetof(WeaponAttachmentUniqueFull, attachment.enemyTracerType), CSPFT_TRACER }, + {"adsDofStart", offsetof(WeaponAttachmentUniqueFull, attachment.adsDofStart), CSPFT_FLOAT }, + {"adsDofEnd", offsetof(WeaponAttachmentUniqueFull, attachment.adsDofEnd), CSPFT_FLOAT }, + {"overrideLeftHandIK", offsetof(WeaponAttachmentUniqueFull, attachment.bOverrideLeftHandIK), CSPFT_BOOL }, + {"overrideLeftHandProneIK", offsetof(WeaponAttachmentUniqueFull, attachment.bOverrideLeftHandProneIK), CSPFT_BOOL }, + {"ikLeftHandOffsetF", offsetof(WeaponAttachmentUniqueFull, attachment.ikLeftHandOffset.x), CSPFT_FLOAT }, + {"ikLeftHandOffsetR", offsetof(WeaponAttachmentUniqueFull, attachment.ikLeftHandOffset.y), CSPFT_FLOAT }, + {"ikLeftHandOffsetU", offsetof(WeaponAttachmentUniqueFull, attachment.ikLeftHandOffset.z), CSPFT_FLOAT }, + {"ikLeftHandRotationP", offsetof(WeaponAttachmentUniqueFull, attachment.ikLeftHandRotation.x), CSPFT_FLOAT }, + {"ikLeftHandRotationY", offsetof(WeaponAttachmentUniqueFull, attachment.ikLeftHandRotation.y), CSPFT_FLOAT }, + {"ikLeftHandRotationR", offsetof(WeaponAttachmentUniqueFull, attachment.ikLeftHandRotation.z), CSPFT_FLOAT }, + {"ikLeftHandProneOffsetF", offsetof(WeaponAttachmentUniqueFull, attachment.ikLeftHandProneOffset.x), CSPFT_FLOAT }, + {"ikLeftHandProneOffsetR", offsetof(WeaponAttachmentUniqueFull, attachment.ikLeftHandProneOffset.y), CSPFT_FLOAT }, + {"ikLeftHandProneOffsetU", offsetof(WeaponAttachmentUniqueFull, attachment.ikLeftHandProneOffset.z), CSPFT_FLOAT }, + {"ikLeftHandProneRotationP", offsetof(WeaponAttachmentUniqueFull, attachment.ikLeftHandProneRotation.x), CSPFT_FLOAT }, + {"ikLeftHandProneRotationY", offsetof(WeaponAttachmentUniqueFull, attachment.ikLeftHandProneRotation.y), CSPFT_FLOAT }, + {"ikLeftHandProneRotationR", offsetof(WeaponAttachmentUniqueFull, attachment.ikLeftHandProneRotation.z), CSPFT_FLOAT }, + {"customFloat0", offsetof(WeaponAttachmentUniqueFull, attachment.customFloat0), CSPFT_FLOAT }, + {"customFloat1", offsetof(WeaponAttachmentUniqueFull, attachment.customFloat1), CSPFT_FLOAT }, + {"customFloat2", offsetof(WeaponAttachmentUniqueFull, attachment.customFloat2), CSPFT_FLOAT }, + {"customBool0", offsetof(WeaponAttachmentUniqueFull, attachment.customBool0), CSPFT_BOOL }, + {"customBool1", offsetof(WeaponAttachmentUniqueFull, attachment.customBool1), CSPFT_BOOL }, + {"customBool2", offsetof(WeaponAttachmentUniqueFull, attachment.customBool2), CSPFT_BOOL }, }; -} \ No newline at end of file +} diff --git a/src/ObjCommon/Game/T6/InfoString/WeaponFields.h b/src/ObjCommon/Game/T6/InfoString/WeaponFields.h index 4bff9ac37..0ae5b90d3 100644 --- a/src/ObjCommon/Game/T6/InfoString/WeaponFields.h +++ b/src/ObjCommon/Game/T6/InfoString/WeaponFields.h @@ -3,1035 +3,1034 @@ namespace T6 { - inline cspField_t weapon_fields[] - { - {"displayName", offsetof(WeaponFullDef, weapVariantDef.szDisplayName), CSPFT_STRING}, - {"AIOverlayDescription", offsetof(WeaponFullDef, weapDef.szOverlayName), CSPFT_STRING}, - {"modeName", offsetof(WeaponFullDef, weapDef.szModeName), CSPFT_STRING}, - {"playerAnimType", offsetof(WeaponFullDef, weapDef.playerAnimType), WFT_ANIMTYPE}, - {"gunModel", offsetof(WeaponFullDef, gunXModel[0]), CSPFT_XMODEL}, - {"gunModel2", offsetof(WeaponFullDef, gunXModel[1]), CSPFT_XMODEL}, - {"gunModel3", offsetof(WeaponFullDef, gunXModel[2]), CSPFT_XMODEL}, - {"gunModel4", offsetof(WeaponFullDef, gunXModel[3]), CSPFT_XMODEL}, - {"gunModel5", offsetof(WeaponFullDef, gunXModel[4]), CSPFT_XMODEL}, - {"gunModel6", offsetof(WeaponFullDef, gunXModel[5]), CSPFT_XMODEL}, - {"gunModel7", offsetof(WeaponFullDef, gunXModel[6]), CSPFT_XMODEL}, - {"gunModel8", offsetof(WeaponFullDef, gunXModel[7]), CSPFT_XMODEL}, - {"gunModel9", offsetof(WeaponFullDef, gunXModel[8]), CSPFT_XMODEL}, - {"gunModel10", offsetof(WeaponFullDef, gunXModel[9]), CSPFT_XMODEL}, - {"gunModel11", offsetof(WeaponFullDef, gunXModel[10]), CSPFT_XMODEL}, - {"gunModel12", offsetof(WeaponFullDef, gunXModel[11]), CSPFT_XMODEL}, - {"gunModel13", offsetof(WeaponFullDef, gunXModel[12]), CSPFT_XMODEL}, - {"gunModel14", offsetof(WeaponFullDef, gunXModel[13]), CSPFT_XMODEL}, - {"gunModel15", offsetof(WeaponFullDef, gunXModel[14]), CSPFT_XMODEL}, - {"gunModel16", offsetof(WeaponFullDef, gunXModel[15]), CSPFT_XMODEL}, - {"handModel", offsetof(WeaponFullDef, weapDef.handXModel), CSPFT_XMODEL}, - {"hideTags", offsetof(WeaponFullDef, hideTags), WFT_HIDETAGS}, - {"notetrackSoundMap", offsetof(WeaponFullDef, notetrackSoundMapKeys), WFT_NOTETRACKSOUNDMAP}, - {"idleAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_IDLE]), CSPFT_STRING}, - {"idleAnimLeft", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_IDLE_LEFT]), CSPFT_STRING}, - {"emptyIdleAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_EMPTY_IDLE]), CSPFT_STRING}, - {"emptyIdleAnimLeft", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_EMPTY_IDLE_LEFT]), CSPFT_STRING}, - {"fireIntroAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_FIRE_INTRO]), CSPFT_STRING}, - {"fireAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_FIRE]), CSPFT_STRING}, - {"fireAnimLeft", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_FIRE_LEFT]), CSPFT_STRING}, - {"holdFireAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_HOLD_FIRE]), CSPFT_STRING}, - {"lastShotAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_LASTSHOT]), CSPFT_STRING}, - {"lastShotAnimLeft", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_LASTSHOT_LEFT]), CSPFT_STRING}, - {"flourishAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_FINALSHOT]), CSPFT_STRING}, - {"flourishAnimLeft", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_FINALSHOT_LEFT]), CSPFT_STRING}, - {"detonateAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_DETONATE]), CSPFT_STRING}, - {"rechamberAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RECHAMBER]), CSPFT_STRING}, - {"meleeAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_MELEE]), CSPFT_STRING}, - {"meleeAnimEmpty", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_MELEE_EMPTY]), CSPFT_STRING}, - {"meleeAnim1", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_MELEE1]), CSPFT_STRING}, - {"meleeAnim2", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_MELEE2]), CSPFT_STRING}, - {"meleeAnim3", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_MELEE3]), CSPFT_STRING}, - {"meleeChargeAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_MELEE_CHARGE]), CSPFT_STRING}, - {"meleeChargeAnimEmpty", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_MELEE_CHARGE_EMPTY]), CSPFT_STRING}, - {"reloadAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD]), CSPFT_STRING}, - {"reloadAnimRight", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD_RIGHT]), CSPFT_STRING}, - {"reloadAnimLeft", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD_LEFT]), CSPFT_STRING}, - {"reloadEmptyAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD_EMPTY]), CSPFT_STRING}, - {"reloadEmptyAnimLeft", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD_EMPTY_LEFT]), CSPFT_STRING}, - {"reloadStartAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD_START]), CSPFT_STRING}, - {"reloadEndAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD_END]), CSPFT_STRING}, - {"reloadQuickAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD_QUICK]), CSPFT_STRING}, - {"reloadQuickEmptyAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD_QUICK_EMPTY]), CSPFT_STRING}, - {"raiseAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RAISE]), CSPFT_STRING}, - {"dropAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_DROP]), CSPFT_STRING}, - {"firstRaiseAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_FIRST_RAISE]), CSPFT_STRING}, - {"altRaiseAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ALT_RAISE]), CSPFT_STRING}, - {"altDropAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ALT_DROP]), CSPFT_STRING}, - {"quickRaiseAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_QUICK_RAISE]), CSPFT_STRING}, - {"quickDropAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_QUICK_DROP]), CSPFT_STRING}, - {"emptyRaiseAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_EMPTY_RAISE]), CSPFT_STRING}, - {"emptyDropAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_EMPTY_DROP]), CSPFT_STRING}, - {"sprintInAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_SPRINT_IN]), CSPFT_STRING}, - {"sprintLoopAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_SPRINT_LOOP]), CSPFT_STRING}, - {"sprintOutAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_SPRINT_OUT]), CSPFT_STRING}, - {"sprintInEmptyAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_SPRINT_EMPTY_IN]), CSPFT_STRING}, - {"sprintLoopEmptyAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_SPRINT_EMPTY_LOOP]), CSPFT_STRING}, - {"sprintOutEmptyAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_SPRINT_EMPTY_OUT]), CSPFT_STRING}, - {"lowReadyInAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_LOWREADY_IN]), CSPFT_STRING}, - {"lowReadyLoopAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_LOWREADY_LOOP]), CSPFT_STRING}, - {"lowReadyOutAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_LOWREADY_OUT]), CSPFT_STRING}, - {"contFireInAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CONT_FIRE_IN]), CSPFT_STRING}, - {"contFireLoopAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CONT_FIRE_LOOP]), CSPFT_STRING}, - {"contFireOutAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CONT_FIRE_OUT]), CSPFT_STRING}, - {"crawlInAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CRAWL_IN]), CSPFT_STRING}, - {"crawlForwardAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CRAWL_FORWARD]), CSPFT_STRING}, - {"crawlBackAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CRAWL_BACK]), CSPFT_STRING}, - {"crawlRightAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CRAWL_RIGHT]), CSPFT_STRING}, - {"crawlLeftAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CRAWL_LEFT]), CSPFT_STRING}, - {"crawlOutAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CRAWL_OUT]), CSPFT_STRING}, - {"crawlEmptyInAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CRAWL_EMPTY_IN]), CSPFT_STRING}, - {"crawlEmptyForwardAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CRAWL_EMPTY_FORWARD]), CSPFT_STRING}, - {"crawlEmptyBackAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CRAWL_EMPTY_BACK]), CSPFT_STRING}, - {"crawlEmptyRightAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CRAWL_EMPTY_RIGHT]), CSPFT_STRING}, - {"crawlEmptyLeftAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CRAWL_EMPTY_LEFT]), CSPFT_STRING}, - {"crawlEmptyOutAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CRAWL_EMPTY_OUT]), CSPFT_STRING}, - {"deployAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_DEPLOY]), CSPFT_STRING}, - {"nightVisionWearAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_NIGHTVISION_WEAR]), CSPFT_STRING}, - {"nightVisionRemoveAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_NIGHTVISION_REMOVE]), CSPFT_STRING}, - {"adsFireAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ADS_FIRE]), CSPFT_STRING}, - {"adsLastShotAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ADS_LASTSHOT]), CSPFT_STRING}, - {"adsRechamberAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ADS_RECHAMBER]), CSPFT_STRING}, - {"adsUpAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ADS_UP]), CSPFT_STRING}, - {"adsDownAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ADS_DOWN]), CSPFT_STRING}, - {"adsUpOtherScopeAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ADS_UP_OTHER_SCOPE]), CSPFT_STRING}, - {"adsFireIntroAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ADS_FIRE_INTRO]), CSPFT_STRING}, - {"breakdownAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_BREAKDOWN]), CSPFT_STRING}, - {"dtp_in", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_DTP_IN]), CSPFT_STRING}, - {"dtp_loop", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_DTP_LOOP]), CSPFT_STRING}, - {"dtp_out", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_DTP_OUT]), CSPFT_STRING}, - {"dtp_empty_in", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_DTP_EMPTY_IN]), CSPFT_STRING}, - {"dtp_empty_loop", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_DTP_EMPTY_LOOP]), CSPFT_STRING}, - {"dtp_empty_out", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_DTP_EMPTY_OUT]), CSPFT_STRING}, - {"slide_in", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_SLIDE_IN]), CSPFT_STRING}, - {"mantleAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_MANTLE]), CSPFT_STRING}, - {"sprintCameraAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CAMERA_SPRINT_LOOP]), CSPFT_STRING}, - {"dtpInCameraAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CAMERA_DTP_IN]), CSPFT_STRING}, - {"dtpLoopCameraAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CAMERA_DTP_LOOP]), CSPFT_STRING}, - {"dtpOutCameraAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CAMERA_DTP_OUT]), CSPFT_STRING}, - {"mantleCameraAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CAMERA_MANTLE]), CSPFT_STRING}, - {"script", offsetof(WeaponFullDef, weapDef.szScript), CSPFT_STRING}, - {"weaponType", offsetof(WeaponFullDef, weapDef.weapType), WFT_WEAPONTYPE}, - {"weaponClass", offsetof(WeaponFullDef, weapDef.weapClass), WFT_WEAPONCLASS}, - {"penetrateType", offsetof(WeaponFullDef, weapDef.penetrateTWeaponAttachmentype), WFT_PENETRATE_TYPE}, - {"impactType", offsetof(WeaponFullDef, weapDef.impactType), WFT_IMPACT_TYPE}, - {"inventoryType", offsetof(WeaponFullDef, weapDef.inventoryType), WFT_INVENTORYTYPE}, - {"fireType", offsetof(WeaponFullDef, weapDef.fireType), WFT_FIRETYPE}, - {"clipType", offsetof(WeaponFullDef, weapDef.clipType), WFT_CLIPTYPE}, - {"barrelType", offsetof(WeaponFullDef, weapDef.barrelType), WFT_BARRELTYPE}, - {"offhandClass", offsetof(WeaponFullDef, weapDef.offhandClass), WFT_OFFHAND_CLASS}, - {"offhandSlot", offsetof(WeaponFullDef, weapDef.offhandSlot), WFT_OFFHAND_SLOT}, - {"viewFlashEffect", offsetof(WeaponFullDef, weapDef.viewFlashEffect), CSPFT_FX}, - {"worldFlashEffect", offsetof(WeaponFullDef, weapDef.worldFlashEffect), CSPFT_FX}, - {"barrelCooldownEffect", offsetof(WeaponFullDef, weapDef.barrelCooldownEffect), CSPFT_FX}, - {"barrelCooldownMinCount", offsetof(WeaponFullDef, weapDef.barrelCooldownMinCount), CSPFT_INT}, - {"viewFlashOffsetF", offsetof(WeaponFullDef, weapDef.vViewFlashOffset.x), CSPFT_FLOAT}, - {"viewFlashOffsetR", offsetof(WeaponFullDef, weapDef.vViewFlashOffset.y), CSPFT_FLOAT}, - {"viewFlashOffsetU", offsetof(WeaponFullDef, weapDef.vViewFlashOffset.z), CSPFT_FLOAT}, - {"worldFlashOffsetF", offsetof(WeaponFullDef, weapDef.vWorldFlashOffset.x), CSPFT_FLOAT}, - {"worldFlashOffsetR", offsetof(WeaponFullDef, weapDef.vWorldFlashOffset.y), CSPFT_FLOAT}, - {"worldFlashOffsetU", offsetof(WeaponFullDef, weapDef.vWorldFlashOffset.z), CSPFT_FLOAT}, - {"pickupSound", offsetof(WeaponFullDef, weapDef.pickupSound), CSPFT_STRING}, - {"pickupSoundPlayer", offsetof(WeaponFullDef, weapDef.pickupSoundPlayer), CSPFT_STRING}, - {"ammoPickupSound", offsetof(WeaponFullDef, weapDef.ammoPickupSound), CSPFT_STRING}, - {"ammoPickupSoundPlayer", offsetof(WeaponFullDef, weapDef.ammoPickupSoundPlayer), CSPFT_STRING}, - {"projectileSound", offsetof(WeaponFullDef, weapDef.projectileSound), CSPFT_STRING}, - {"pullbackSound", offsetof(WeaponFullDef, weapDef.pullbackSound), CSPFT_STRING}, - {"pullbackSoundPlayer", offsetof(WeaponFullDef, weapDef.pullbackSoundPlayer), CSPFT_STRING}, - {"fireSound", offsetof(WeaponFullDef, weapDef.fireSound), CSPFT_STRING}, - {"crackSound", offsetof(WeaponFullDef, weapDef.crackSound), CSPFT_STRING}, - {"whizbySound", offsetof(WeaponFullDef, weapDef.whizbySound), CSPFT_STRING}, - {"fireSoundPlayer", offsetof(WeaponFullDef, weapDef.fireSoundPlayer), CSPFT_STRING}, - {"loopFireSound", offsetof(WeaponFullDef, weapDef.fireLoopSound), CSPFT_STRING}, - {"loopFireSoundPlayer", offsetof(WeaponFullDef, weapDef.fireLoopSoundPlayer), CSPFT_STRING}, - {"loopFireEndSound", offsetof(WeaponFullDef, weapDef.fireLoopEndSound), CSPFT_STRING}, - {"loopFireEndSoundPlayer", offsetof(WeaponFullDef, weapDef.fireLoopEndSoundPlayer), CSPFT_STRING}, - {"startFireSound", offsetof(WeaponFullDef, weapDef.fireStartSound), CSPFT_STRING}, - {"stopFireSound", offsetof(WeaponFullDef, weapDef.fireStopSound), CSPFT_STRING}, - {"killcamStartFireSound", offsetof(WeaponFullDef, weapDef.fireKillcamSound), CSPFT_STRING}, - {"startFireSoundPlayer", offsetof(WeaponFullDef, weapDef.fireStartSoundPlayer), CSPFT_STRING}, - {"stopFireSoundPlayer", offsetof(WeaponFullDef, weapDef.fireStopSoundPlayer), CSPFT_STRING}, - {"killcamStartFireSoundPlayer", offsetof(WeaponFullDef, weapDef.fireKillcamSoundPlayer), CSPFT_STRING}, - {"lastShotSound", offsetof(WeaponFullDef, weapDef.fireLastSound), CSPFT_STRING}, - {"lastShotSoundPlayer", offsetof(WeaponFullDef, weapDef.fireLastSoundPlayer), CSPFT_STRING}, - {"emptyFireSound", offsetof(WeaponFullDef, weapDef.emptyFireSound), CSPFT_STRING}, - {"emptyFireSoundPlayer", offsetof(WeaponFullDef, weapDef.emptyFireSoundPlayer), CSPFT_STRING}, - {"meleeSwipeSound", offsetof(WeaponFullDef, weapDef.meleeSwipeSound), CSPFT_STRING}, - {"meleeSwipeSoundPlayer", offsetof(WeaponFullDef, weapDef.meleeSwipeSoundPlayer), CSPFT_STRING}, - {"meleeHitSound", offsetof(WeaponFullDef, weapDef.meleeHitSound), CSPFT_STRING}, - {"meleeMissSound", offsetof(WeaponFullDef, weapDef.meleeMissSound), CSPFT_STRING}, - {"rechamberSound", offsetof(WeaponFullDef, weapDef.rechamberSound), CSPFT_STRING}, - {"rechamberSoundPlayer", offsetof(WeaponFullDef, weapDef.rechamberSoundPlayer), CSPFT_STRING}, - {"reloadSound", offsetof(WeaponFullDef, weapDef.reloadSound), CSPFT_STRING}, - {"reloadSoundPlayer", offsetof(WeaponFullDef, weapDef.reloadSoundPlayer), CSPFT_STRING}, - {"reloadEmptySound", offsetof(WeaponFullDef, weapDef.reloadEmptySound), CSPFT_STRING}, - {"reloadEmptySoundPlayer", offsetof(WeaponFullDef, weapDef.reloadEmptySoundPlayer), CSPFT_STRING}, - {"reloadStartSound", offsetof(WeaponFullDef, weapDef.reloadStartSound), CSPFT_STRING}, - {"reloadStartSoundPlayer", offsetof(WeaponFullDef, weapDef.reloadStartSoundPlayer), CSPFT_STRING}, - {"reloadEndSound", offsetof(WeaponFullDef, weapDef.reloadEndSound), CSPFT_STRING}, - {"reloadEndSoundPlayer", offsetof(WeaponFullDef, weapDef.reloadEndSoundPlayer), CSPFT_STRING}, - {"rotateLoopSound", offsetof(WeaponFullDef, weapDef.rotateLoopSound), CSPFT_STRING}, - {"rotateLoopSoundPlayer", offsetof(WeaponFullDef, weapDef.rotateLoopSoundPlayer), CSPFT_STRING}, - {"rotateStopSound", offsetof(WeaponFullDef, weapDef.rotateStopSound), CSPFT_STRING}, - {"rotateStopSoundPlayer", offsetof(WeaponFullDef, weapDef.rotateStopSoundPlayer), CSPFT_STRING}, - {"deploySound", offsetof(WeaponFullDef, weapDef.deploySound), CSPFT_STRING}, - {"deploySoundPlayer", offsetof(WeaponFullDef, weapDef.deploySoundPlayer), CSPFT_STRING}, - {"finishDeploySound", offsetof(WeaponFullDef, weapDef.finishDeploySound), CSPFT_STRING}, - {"finishDeploySoundPlayer", offsetof(WeaponFullDef, weapDef.finishDeploySoundPlayer), CSPFT_STRING}, - {"breakdownSound", offsetof(WeaponFullDef, weapDef.breakdownSound), CSPFT_STRING}, - {"breakdownSoundPlayer", offsetof(WeaponFullDef, weapDef.breakdownSoundPlayer), CSPFT_STRING}, - {"finishBreakdownSound", offsetof(WeaponFullDef, weapDef.finishBreakdownSound), CSPFT_STRING}, - {"finishBreakdownSoundPlayer", offsetof(WeaponFullDef, weapDef.finishBreakdownSoundPlayer), CSPFT_STRING}, - {"detonateSound", offsetof(WeaponFullDef, weapDef.detonateSound), CSPFT_STRING}, - {"detonateSoundPlayer", offsetof(WeaponFullDef, weapDef.detonateSoundPlayer), CSPFT_STRING}, - {"nightVisionWearSound", offsetof(WeaponFullDef, weapDef.nightVisionWearSound), CSPFT_STRING}, - {"nightVisionWearSoundPlayer", offsetof(WeaponFullDef, weapDef.nightVisionWearSoundPlayer), CSPFT_STRING}, - {"nightVisionRemoveSound", offsetof(WeaponFullDef, weapDef.nightVisionRemoveSound), CSPFT_STRING}, - {"nightVisionRemoveSoundPlayer", offsetof(WeaponFullDef, weapDef.nightVisionRemoveSoundPlayer), CSPFT_STRING}, - {"raiseSound", offsetof(WeaponFullDef, weapDef.raiseSound), CSPFT_STRING}, - {"raiseSoundPlayer", offsetof(WeaponFullDef, weapDef.raiseSoundPlayer), CSPFT_STRING}, - {"firstRaiseSound", offsetof(WeaponFullDef, weapDef.firstRaiseSound), CSPFT_STRING}, - {"firstRaiseSoundPlayer", offsetof(WeaponFullDef, weapDef.firstRaiseSoundPlayer), CSPFT_STRING}, - {"altSwitchSound", offsetof(WeaponFullDef, weapDef.altSwitchSound), CSPFT_STRING}, - {"altSwitchSoundPlayer", offsetof(WeaponFullDef, weapDef.altSwitchSoundPlayer), CSPFT_STRING}, - {"adsRaiseSoundPlayer", offsetof(WeaponFullDef, weapDef.adsRaiseSoundPlayer), CSPFT_STRING}, - {"adsLowerSoundPlayer", offsetof(WeaponFullDef, weapDef.adsLowerSoundPlayer), CSPFT_STRING}, - {"putawaySound", offsetof(WeaponFullDef, weapDef.putawaySound), CSPFT_STRING}, - {"putawaySoundPlayer", offsetof(WeaponFullDef, weapDef.putawaySoundPlayer), CSPFT_STRING}, - {"overheatSound", offsetof(WeaponFullDef, weapDef.overheatSound), CSPFT_STRING}, - {"overheatSoundPlayer", offsetof(WeaponFullDef, weapDef.overheatSoundPlayer), CSPFT_STRING}, - {"adsZoomSound", offsetof(WeaponFullDef, weapDef.adsZoomSound), CSPFT_STRING}, - {"shellCasing", offsetof(WeaponFullDef, weapDef.shellCasing), CSPFT_STRING}, - {"shellCasingPlayer", offsetof(WeaponFullDef, weapDef.shellCasingPlayer), CSPFT_STRING}, - {"bounceSound", offsetof(WeaponFullDef, weapDef.bounceSound), WFT_BOUNCE_SOUND}, - {"standMountedWeapdef", offsetof(WeaponFullDef, weapDef.standMountedWeapdef), CSPFT_STRING}, - {"crouchMountedWeapdef", offsetof(WeaponFullDef, weapDef.crouchMountedWeapdef), CSPFT_STRING}, - {"proneMountedWeapdef", offsetof(WeaponFullDef, weapDef.proneMountedWeapdef), CSPFT_STRING}, - {"viewShellEjectEffect", offsetof(WeaponFullDef, weapDef.viewShellEjectEffect), CSPFT_FX}, - {"worldShellEjectEffect", offsetof(WeaponFullDef, weapDef.worldShellEjectEffect), CSPFT_FX}, - {"viewLastShotEjectEffect", offsetof(WeaponFullDef, weapDef.viewLastShotEjectEffect), CSPFT_FX}, - {"worldLastShotEjectEffect", offsetof(WeaponFullDef, weapDef.worldLastShotEjectEffect), CSPFT_FX}, - {"viewShellEjectOffsetF", offsetof(WeaponFullDef, weapDef.vViewShellEjectOffset.x), CSPFT_FLOAT}, - {"viewShellEjectOffsetR", offsetof(WeaponFullDef, weapDef.vViewShellEjectOffset.y), CSPFT_FLOAT}, - {"viewShellEjectOffsetU", offsetof(WeaponFullDef, weapDef.vViewShellEjectOffset.z), CSPFT_FLOAT}, - {"worldShellEjectOffsetF", offsetof(WeaponFullDef, weapDef.vWorldShellEjectOffset.x), CSPFT_FLOAT}, - {"worldShellEjectOffsetR", offsetof(WeaponFullDef, weapDef.vWorldShellEjectOffset.y), CSPFT_FLOAT}, - {"worldShellEjectOffsetU", offsetof(WeaponFullDef, weapDef.vWorldShellEjectOffset.z), CSPFT_FLOAT}, - {"viewShellEjectRotationP", offsetof(WeaponFullDef, weapDef.vViewShellEjectRotation.x), CSPFT_FLOAT}, - {"viewShellEjectRotationY", offsetof(WeaponFullDef, weapDef.vViewShellEjectRotation.y), CSPFT_FLOAT}, - {"viewShellEjectRotationR", offsetof(WeaponFullDef, weapDef.vViewShellEjectRotation.z), CSPFT_FLOAT}, - {"worldShellEjectRotationP", offsetof(WeaponFullDef, weapDef.vWorldShellEjectRotation.x), CSPFT_FLOAT}, - {"worldShellEjectRotationY", offsetof(WeaponFullDef, weapDef.vWorldShellEjectRotation.y), CSPFT_FLOAT}, - {"worldShellEjectRotationR", offsetof(WeaponFullDef, weapDef.vWorldShellEjectRotation.z), CSPFT_FLOAT}, - {"reticleCenter", offsetof(WeaponFullDef, weapDef.reticleCenter), CSPFT_MATERIAL}, - {"reticleSide", offsetof(WeaponFullDef, weapDef.reticleSide), CSPFT_MATERIAL}, - {"reticleCenterSize", offsetof(WeaponFullDef, weapDef.iReticleCenterSize), CSPFT_INT}, - {"reticleSideSize", offsetof(WeaponFullDef, weapDef.iReticleSideSize), CSPFT_INT}, - {"reticleMinOfs", offsetof(WeaponFullDef, weapDef.iReticleMinOfs), CSPFT_INT}, - {"activeReticleType", offsetof(WeaponFullDef, weapDef.activeReticleType), WFT_ACTIVE_RETICLE_TYPE}, - {"standMoveF", offsetof(WeaponFullDef, weapDef.vStandMove.x), CSPFT_FLOAT}, - {"standMoveR", offsetof(WeaponFullDef, weapDef.vStandMove.y), CSPFT_FLOAT}, - {"standMoveU", offsetof(WeaponFullDef, weapDef.vStandMove.z), CSPFT_FLOAT}, - {"standRotP", offsetof(WeaponFullDef, weapDef.vStandRot.x), CSPFT_FLOAT}, - {"standRotY", offsetof(WeaponFullDef, weapDef.vStandRot.y), CSPFT_FLOAT}, - {"standRotR", offsetof(WeaponFullDef, weapDef.vStandRot.z), CSPFT_FLOAT}, - {"duckedOfsF", offsetof(WeaponFullDef, weapDef.vDuckedOfs.x), CSPFT_FLOAT}, - {"duckedOfsR", offsetof(WeaponFullDef, weapDef.vDuckedOfs.y), CSPFT_FLOAT}, - {"duckedOfsU", offsetof(WeaponFullDef, weapDef.vDuckedOfs.z), CSPFT_FLOAT}, - {"duckedMoveF", offsetof(WeaponFullDef, weapDef.vDuckedMove.x), CSPFT_FLOAT}, - {"duckedMoveR", offsetof(WeaponFullDef, weapDef.vDuckedMove.y), CSPFT_FLOAT}, - {"duckedMoveU", offsetof(WeaponFullDef, weapDef.vDuckedMove.z), CSPFT_FLOAT}, - {"duckedSprintOfsF", offsetof(WeaponFullDef, weapDef.vDuckedSprintOfs.x), CSPFT_FLOAT}, - {"duckedSprintOfsR", offsetof(WeaponFullDef, weapDef.vDuckedSprintOfs.y), CSPFT_FLOAT}, - {"duckedSprintOfsU", offsetof(WeaponFullDef, weapDef.vDuckedSprintOfs.z), CSPFT_FLOAT}, - {"duckedSprintRotP", offsetof(WeaponFullDef, weapDef.vDuckedSprintRot.x), CSPFT_FLOAT}, - {"duckedSprintRotY", offsetof(WeaponFullDef, weapDef.vDuckedSprintRot.y), CSPFT_FLOAT}, - {"duckedSprintRotR", offsetof(WeaponFullDef, weapDef.vDuckedSprintRot.z), CSPFT_FLOAT}, - {"duckedSprintBobH", offsetof(WeaponFullDef, weapDef.vDuckedSprintBob.x), CSPFT_FLOAT}, - {"duckedSprintBobV", offsetof(WeaponFullDef, weapDef.vDuckedSprintBob.y), CSPFT_FLOAT}, - {"duckedSprintScale", offsetof(WeaponFullDef, weapDef.fDuckedSprintCycleScale), CSPFT_FLOAT}, - {"sprintOfsF", offsetof(WeaponFullDef, weapDef.vSprintOfs.x), CSPFT_FLOAT}, - {"sprintOfsR", offsetof(WeaponFullDef, weapDef.vSprintOfs.y), CSPFT_FLOAT}, - {"sprintOfsU", offsetof(WeaponFullDef, weapDef.vSprintOfs.z), CSPFT_FLOAT}, - {"sprintRotP", offsetof(WeaponFullDef, weapDef.vSprintRot.x), CSPFT_FLOAT}, - {"sprintRotY", offsetof(WeaponFullDef, weapDef.vSprintRot.y), CSPFT_FLOAT}, - {"sprintRotR", offsetof(WeaponFullDef, weapDef.vSprintRot.z), CSPFT_FLOAT}, - {"sprintBobH", offsetof(WeaponFullDef, weapDef.vSprintBob.x), CSPFT_FLOAT}, - {"sprintBobV", offsetof(WeaponFullDef, weapDef.vSprintBob.y), CSPFT_FLOAT}, - {"sprintScale", offsetof(WeaponFullDef, weapDef.fSprintCycleScale), CSPFT_FLOAT}, - {"lowReadyOfsF", offsetof(WeaponFullDef, weapDef.vLowReadyOfs.x), CSPFT_FLOAT}, - {"lowReadyOfsR", offsetof(WeaponFullDef, weapDef.vLowReadyOfs.y), CSPFT_FLOAT}, - {"lowReadyOfsU", offsetof(WeaponFullDef, weapDef.vLowReadyOfs.z), CSPFT_FLOAT}, - {"lowReadyRotP", offsetof(WeaponFullDef, weapDef.vLowReadyRot.x), CSPFT_FLOAT}, - {"lowReadyRotY", offsetof(WeaponFullDef, weapDef.vLowReadyRot.y), CSPFT_FLOAT}, - {"lowReadyRotR", offsetof(WeaponFullDef, weapDef.vLowReadyRot.z), CSPFT_FLOAT}, - {"rideOfsF", offsetof(WeaponFullDef, weapDef.vRideOfs.x), CSPFT_FLOAT}, - {"rideOfsR", offsetof(WeaponFullDef, weapDef.vRideOfs.y), CSPFT_FLOAT}, - {"rideOfsU", offsetof(WeaponFullDef, weapDef.vRideOfs.z), CSPFT_FLOAT}, - {"rideRotP", offsetof(WeaponFullDef, weapDef.vRideRot.x), CSPFT_FLOAT}, - {"rideRotY", offsetof(WeaponFullDef, weapDef.vRideRot.y), CSPFT_FLOAT}, - {"rideRotR", offsetof(WeaponFullDef, weapDef.vRideRot.z), CSPFT_FLOAT}, - {"dtpOfsF", offsetof(WeaponFullDef, weapDef.vDtpOfs.x), CSPFT_FLOAT}, - {"dtpOfsR", offsetof(WeaponFullDef, weapDef.vDtpOfs.y), CSPFT_FLOAT}, - {"dtpOfsU", offsetof(WeaponFullDef, weapDef.vDtpOfs.z), CSPFT_FLOAT}, - {"dtpRotP", offsetof(WeaponFullDef, weapDef.vDtpRot.x), CSPFT_FLOAT}, - {"dtpRotY", offsetof(WeaponFullDef, weapDef.vDtpRot.y), CSPFT_FLOAT}, - {"dtpRotR", offsetof(WeaponFullDef, weapDef.vDtpRot.z), CSPFT_FLOAT}, - {"dtpBobH", offsetof(WeaponFullDef, weapDef.vDtpBob.x), CSPFT_FLOAT}, - {"dtpBobV", offsetof(WeaponFullDef, weapDef.vDtpBob.y), CSPFT_FLOAT}, - {"dtpScale", offsetof(WeaponFullDef, weapDef.fDtpCycleScale), CSPFT_FLOAT}, - {"mantleOfsF", offsetof(WeaponFullDef, weapDef.vMantleOfs.x), CSPFT_FLOAT}, - {"mantleOfsR", offsetof(WeaponFullDef, weapDef.vMantleOfs.y), CSPFT_FLOAT}, - {"mantleOfsU", offsetof(WeaponFullDef, weapDef.vMantleOfs.z), CSPFT_FLOAT}, - {"mantleRotP", offsetof(WeaponFullDef, weapDef.vMantleRot.x), CSPFT_FLOAT}, - {"mantleRotY", offsetof(WeaponFullDef, weapDef.vMantleRot.y), CSPFT_FLOAT}, - {"mantleRotR", offsetof(WeaponFullDef, weapDef.vMantleRot.z), CSPFT_FLOAT}, - {"slideOfsF", offsetof(WeaponFullDef, weapDef.vSlideOfs.x), CSPFT_FLOAT}, - {"slideOfsR", offsetof(WeaponFullDef, weapDef.vSlideOfs.y), CSPFT_FLOAT}, - {"slideOfsU", offsetof(WeaponFullDef, weapDef.vSlideOfs.z), CSPFT_FLOAT}, - {"slideRotP", offsetof(WeaponFullDef, weapDef.vSlideRot.x), CSPFT_FLOAT}, - {"slideRotY", offsetof(WeaponFullDef, weapDef.vSlideRot.y), CSPFT_FLOAT}, - {"slideRotR", offsetof(WeaponFullDef, weapDef.vSlideRot.z), CSPFT_FLOAT}, - {"duckedRotP", offsetof(WeaponFullDef, weapDef.vDuckedRot.x), CSPFT_FLOAT}, - {"duckedRotY", offsetof(WeaponFullDef, weapDef.vDuckedRot.y), CSPFT_FLOAT}, - {"duckedRotR", offsetof(WeaponFullDef, weapDef.vDuckedRot.z), CSPFT_FLOAT}, - {"proneOfsF", offsetof(WeaponFullDef, weapDef.vProneOfs.x), CSPFT_FLOAT}, - {"proneOfsR", offsetof(WeaponFullDef, weapDef.vProneOfs.y), CSPFT_FLOAT}, - {"proneOfsU", offsetof(WeaponFullDef, weapDef.vProneOfs.z), CSPFT_FLOAT}, - {"proneMoveF", offsetof(WeaponFullDef, weapDef.vProneMove.x), CSPFT_FLOAT}, - {"proneMoveR", offsetof(WeaponFullDef, weapDef.vProneMove.y), CSPFT_FLOAT}, - {"proneMoveU", offsetof(WeaponFullDef, weapDef.vProneMove.z), CSPFT_FLOAT}, - {"proneRotP", offsetof(WeaponFullDef, weapDef.vProneRot.x), CSPFT_FLOAT}, - {"proneRotY", offsetof(WeaponFullDef, weapDef.vProneRot.y), CSPFT_FLOAT}, - {"proneRotR", offsetof(WeaponFullDef, weapDef.vProneRot.z), CSPFT_FLOAT}, - {"strafeMoveF", offsetof(WeaponFullDef, weapDef.vStrafeMove.x), CSPFT_FLOAT}, - {"strafeMoveR", offsetof(WeaponFullDef, weapDef.vStrafeMove.y), CSPFT_FLOAT}, - {"strafeMoveU", offsetof(WeaponFullDef, weapDef.vStrafeMove.z), CSPFT_FLOAT}, - {"strafeRotP", offsetof(WeaponFullDef, weapDef.vStrafeRot.x), CSPFT_FLOAT}, - {"strafeRotY", offsetof(WeaponFullDef, weapDef.vStrafeRot.y), CSPFT_FLOAT}, - {"strafeRotR", offsetof(WeaponFullDef, weapDef.vStrafeRot.z), CSPFT_FLOAT}, - {"posMoveRate", offsetof(WeaponFullDef, weapDef.fPosMoveRate), CSPFT_FLOAT}, - {"posProneMoveRate", offsetof(WeaponFullDef, weapDef.fPosProneMoveRate), CSPFT_FLOAT}, - {"standMoveMinSpeed", offsetof(WeaponFullDef, weapDef.fStandMoveMinSpeed), CSPFT_FLOAT}, - {"duckedMoveMinSpeed", offsetof(WeaponFullDef, weapDef.fDuckedMoveMinSpeed), CSPFT_FLOAT}, - {"proneMoveMinSpeed", offsetof(WeaponFullDef, weapDef.fProneMoveMinSpeed), CSPFT_FLOAT}, - {"posRotRate", offsetof(WeaponFullDef, weapDef.fPosRotRate), CSPFT_FLOAT}, - {"posProneRotRate", offsetof(WeaponFullDef, weapDef.fPosProneRotRate), CSPFT_FLOAT}, - {"standRotMinSpeed", offsetof(WeaponFullDef, weapDef.fStandRotMinSpeed), CSPFT_FLOAT}, - {"duckedRotMinSpeed", offsetof(WeaponFullDef, weapDef.fDuckedRotMinSpeed), CSPFT_FLOAT}, - {"proneRotMinSpeed", offsetof(WeaponFullDef, weapDef.fProneRotMinSpeed), CSPFT_FLOAT}, - {"worldModel", offsetof(WeaponFullDef, worldModel[0]), CSPFT_XMODEL}, - {"worldModel2", offsetof(WeaponFullDef, worldModel[1]), CSPFT_XMODEL}, - {"worldModel3", offsetof(WeaponFullDef, worldModel[2]), CSPFT_XMODEL}, - {"worldModel4", offsetof(WeaponFullDef, worldModel[3]), CSPFT_XMODEL}, - {"worldModel5", offsetof(WeaponFullDef, worldModel[4]), CSPFT_XMODEL}, - {"worldModel6", offsetof(WeaponFullDef, worldModel[5]), CSPFT_XMODEL}, - {"worldModel7", offsetof(WeaponFullDef, worldModel[6]), CSPFT_XMODEL}, - {"worldModel8", offsetof(WeaponFullDef, worldModel[7]), CSPFT_XMODEL}, - {"worldModel9", offsetof(WeaponFullDef, worldModel[8]), CSPFT_XMODEL}, - {"worldModel10", offsetof(WeaponFullDef, worldModel[9]), CSPFT_XMODEL}, - {"worldModel11", offsetof(WeaponFullDef, worldModel[10]), CSPFT_XMODEL}, - {"worldModel12", offsetof(WeaponFullDef, worldModel[11]), CSPFT_XMODEL}, - {"worldModel13", offsetof(WeaponFullDef, worldModel[12]), CSPFT_XMODEL}, - {"worldModel14", offsetof(WeaponFullDef, worldModel[13]), CSPFT_XMODEL}, - {"worldModel15", offsetof(WeaponFullDef, worldModel[14]), CSPFT_XMODEL}, - {"worldModel16", offsetof(WeaponFullDef, worldModel[15]), CSPFT_XMODEL}, - {"attachViewModel1", offsetof(WeaponFullDef, attachViewModel[0]), CSPFT_XMODEL}, - {"attachViewModel2", offsetof(WeaponFullDef, attachViewModel[1]), CSPFT_XMODEL}, - {"attachViewModel3", offsetof(WeaponFullDef, attachViewModel[2]), CSPFT_XMODEL}, - {"attachViewModel4", offsetof(WeaponFullDef, attachViewModel[3]), CSPFT_XMODEL}, - {"attachViewModel5", offsetof(WeaponFullDef, attachViewModel[4]), CSPFT_XMODEL}, - {"attachViewModel6", offsetof(WeaponFullDef, attachViewModel[5]), CSPFT_XMODEL}, - {"attachViewModel7", offsetof(WeaponFullDef, attachViewModel[6]), CSPFT_XMODEL}, - {"attachViewModel8", offsetof(WeaponFullDef, attachViewModel[7]), CSPFT_XMODEL}, - {"attachWorldModel1", offsetof(WeaponFullDef, attachWorldModel[0]), CSPFT_XMODEL}, - {"attachWorldModel2", offsetof(WeaponFullDef, attachWorldModel[1]), CSPFT_XMODEL}, - {"attachWorldModel3", offsetof(WeaponFullDef, attachWorldModel[2]), CSPFT_XMODEL}, - {"attachWorldModel4", offsetof(WeaponFullDef, attachWorldModel[3]), CSPFT_XMODEL}, - {"attachWorldModel5", offsetof(WeaponFullDef, attachWorldModel[4]), CSPFT_XMODEL}, - {"attachWorldModel6", offsetof(WeaponFullDef, attachWorldModel[5]), CSPFT_XMODEL}, - {"attachWorldModel7", offsetof(WeaponFullDef, attachWorldModel[6]), CSPFT_XMODEL}, - {"attachWorldModel8", offsetof(WeaponFullDef, attachWorldModel[7]), CSPFT_XMODEL}, - {"attachViewModelTag1", offsetof(WeaponFullDef, attachViewModelTag[0]), CSPFT_STRING}, - {"attachViewModelTag2", offsetof(WeaponFullDef, attachViewModelTag[1]), CSPFT_STRING}, - {"attachViewModelTag3", offsetof(WeaponFullDef, attachViewModelTag[2]), CSPFT_STRING}, - {"attachViewModelTag4", offsetof(WeaponFullDef, attachViewModelTag[3]), CSPFT_STRING}, - {"attachViewModelTag5", offsetof(WeaponFullDef, attachViewModelTag[4]), CSPFT_STRING}, - {"attachViewModelTag6", offsetof(WeaponFullDef, attachViewModelTag[5]), CSPFT_STRING}, - {"attachViewModelTag7", offsetof(WeaponFullDef, attachViewModelTag[6]), CSPFT_STRING}, - {"attachViewModelTag8", offsetof(WeaponFullDef, attachViewModelTag[7]), CSPFT_STRING}, - {"attachWorldModelTag1", offsetof(WeaponFullDef, attachWorldModelTag[0]), CSPFT_STRING}, - {"attachWorldModelTag2", offsetof(WeaponFullDef, attachWorldModelTag[1]), CSPFT_STRING}, - {"attachWorldModelTag3", offsetof(WeaponFullDef, attachWorldModelTag[2]), CSPFT_STRING}, - {"attachWorldModelTag4", offsetof(WeaponFullDef, attachWorldModelTag[3]), CSPFT_STRING}, - {"attachWorldModelTag5", offsetof(WeaponFullDef, attachWorldModelTag[4]), CSPFT_STRING}, - {"attachWorldModelTag6", offsetof(WeaponFullDef, attachWorldModelTag[5]), CSPFT_STRING}, - {"attachWorldModelTag7", offsetof(WeaponFullDef, attachWorldModelTag[6]), CSPFT_STRING}, - {"attachWorldModelTag8", offsetof(WeaponFullDef, attachWorldModelTag[7]), CSPFT_STRING}, - {"attachViewModelOffsetX1", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[0]), CSPFT_FLOAT}, - {"attachViewModelOffsetY1", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[1]), CSPFT_FLOAT}, - {"attachViewModelOffsetZ1", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[2]), CSPFT_FLOAT}, - {"attachViewModelOffsetX2", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[3]), CSPFT_FLOAT}, - {"attachViewModelOffsetY2", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[4]), CSPFT_FLOAT}, - {"attachViewModelOffsetZ2", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[5]), CSPFT_FLOAT}, - {"attachViewModelOffsetX3", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[6]), CSPFT_FLOAT}, - {"attachViewModelOffsetY3", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[7]), CSPFT_FLOAT}, - {"attachViewModelOffsetZ3", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[8]), CSPFT_FLOAT}, - {"attachViewModelOffsetX4", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[9]), CSPFT_FLOAT}, - {"attachViewModelOffsetY4", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[10]), CSPFT_FLOAT}, - {"attachViewModelOffsetZ4", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[11]), CSPFT_FLOAT}, - {"attachViewModelOffsetX5", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[12]), CSPFT_FLOAT}, - {"attachViewModelOffsetY5", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[13]), CSPFT_FLOAT}, - {"attachViewModelOffsetZ5", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[14]), CSPFT_FLOAT}, - {"attachViewModelOffsetX6", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[15]), CSPFT_FLOAT}, - {"attachViewModelOffsetY6", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[16]), CSPFT_FLOAT}, - {"attachViewModelOffsetZ6", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[17]), CSPFT_FLOAT}, - {"attachViewModelOffsetX7", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[18]), CSPFT_FLOAT}, - {"attachViewModelOffsetY7", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[19]), CSPFT_FLOAT}, - {"attachViewModelOffsetZ7", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[20]), CSPFT_FLOAT}, - {"attachViewModelOffsetX8", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[21]), CSPFT_FLOAT}, - {"attachViewModelOffsetY8", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[22]), CSPFT_FLOAT}, - {"attachViewModelOffsetZ8", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[23]), CSPFT_FLOAT}, - {"attachWorldModelOffsetX1", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[0]), CSPFT_FLOAT}, - {"attachWorldModelOffsetY1", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[1]), CSPFT_FLOAT}, - {"attachWorldModelOffsetZ1", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[2]), CSPFT_FLOAT}, - {"attachWorldModelOffsetX2", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[3]), CSPFT_FLOAT}, - {"attachWorldModelOffsetY2", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[4]), CSPFT_FLOAT}, - {"attachWorldModelOffsetZ2", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[5]), CSPFT_FLOAT}, - {"attachWorldModelOffsetX3", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[6]), CSPFT_FLOAT}, - {"attachWorldModelOffsetY3", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[7]), CSPFT_FLOAT}, - {"attachWorldModelOffsetZ3", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[8]), CSPFT_FLOAT}, - {"attachWorldModelOffsetX4", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[9]), CSPFT_FLOAT}, - {"attachWorldModelOffsetY4", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[10]), CSPFT_FLOAT}, - {"attachWorldModelOffsetZ4", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[11]), CSPFT_FLOAT}, - {"attachWorldModelOffsetX5", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[12]), CSPFT_FLOAT}, - {"attachWorldModelOffsetY5", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[13]), CSPFT_FLOAT}, - {"attachWorldModelOffsetZ5", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[14]), CSPFT_FLOAT}, - {"attachWorldModelOffsetX6", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[15]), CSPFT_FLOAT}, - {"attachWorldModelOffsetY6", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[16]), CSPFT_FLOAT}, - {"attachWorldModelOffsetZ6", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[17]), CSPFT_FLOAT}, - {"attachWorldModelOffsetX7", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[18]), CSPFT_FLOAT}, - {"attachWorldModelOffsetY7", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[19]), CSPFT_FLOAT}, - {"attachWorldModelOffsetZ7", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[20]), CSPFT_FLOAT}, - {"attachWorldModelOffsetX8", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[21]), CSPFT_FLOAT}, - {"attachWorldModelOffsetY8", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[22]), CSPFT_FLOAT}, - {"attachWorldModelOffsetZ8", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[23]), CSPFT_FLOAT}, - {"attachViewModelOffsetPitch1", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[0]), CSPFT_FLOAT}, - {"attachViewModelOffsetYaw1", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[1]), CSPFT_FLOAT}, - {"attachViewModelOffsetRoll1", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[2]), CSPFT_FLOAT}, - {"attachViewModelOffsetPitch2", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[3]), CSPFT_FLOAT}, - {"attachViewModelOffsetYaw2", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[4]), CSPFT_FLOAT}, - {"attachViewModelOffsetRoll2", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[5]), CSPFT_FLOAT}, - {"attachViewModelOffsetPitch3", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[6]), CSPFT_FLOAT}, - {"attachViewModelOffsetYaw3", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[7]), CSPFT_FLOAT}, - {"attachViewModelOffsetRoll3", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[8]), CSPFT_FLOAT}, - {"attachViewModelOffsetPitch4", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[9]), CSPFT_FLOAT}, - {"attachViewModelOffsetYaw4", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[10]), CSPFT_FLOAT}, - {"attachViewModelOffsetRoll4", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[11]), CSPFT_FLOAT}, - {"attachViewModelOffsetPitch5", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[12]), CSPFT_FLOAT}, - {"attachViewModelOffsetYaw5", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[13]), CSPFT_FLOAT}, - {"attachViewModelOffsetRoll5", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[14]), CSPFT_FLOAT}, - {"attachViewModelOffsetPitch6", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[15]), CSPFT_FLOAT}, - {"attachViewModelOffsetYaw6", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[16]), CSPFT_FLOAT}, - {"attachViewModelOffsetRoll6", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[17]), CSPFT_FLOAT}, - {"attachViewModelOffsetPitch7", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[18]), CSPFT_FLOAT}, - {"attachViewModelOffsetYaw7", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[19]), CSPFT_FLOAT}, - {"attachViewModelOffsetRoll7", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[20]), CSPFT_FLOAT}, - {"attachViewModelOffsetPitch8", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[21]), CSPFT_FLOAT}, - {"attachViewModelOffsetYaw8", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[22]), CSPFT_FLOAT}, - {"attachViewModelOffsetRoll8", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[23]), CSPFT_FLOAT}, - {"attachWorldModelOffsetPitch1", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[0]), CSPFT_FLOAT}, - {"attachWorldModelOffsetYaw1", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[1]), CSPFT_FLOAT}, - {"attachWorldModelOffsetRoll1", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[2]), CSPFT_FLOAT}, - {"attachWorldModelOffsetPitch2", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[3]), CSPFT_FLOAT}, - {"attachWorldModelOffsetYaw2", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[4]), CSPFT_FLOAT}, - {"attachWorldModelOffsetRoll2", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[5]), CSPFT_FLOAT}, - {"attachWorldModelOffsetPitch3", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[6]), CSPFT_FLOAT}, - {"attachWorldModelOffsetYaw3", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[7]), CSPFT_FLOAT}, - {"attachWorldModelOffsetRoll3", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[8]), CSPFT_FLOAT}, - {"attachWorldModelOffsetPitch4", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[9]), CSPFT_FLOAT}, - {"attachWorldModelOffsetYaw4", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[10]), CSPFT_FLOAT}, - {"attachWorldModelOffsetRoll4", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[11]), CSPFT_FLOAT}, - {"attachWorldModelOffsetPitch5", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[12]), CSPFT_FLOAT}, - {"attachWorldModelOffsetYaw5", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[13]), CSPFT_FLOAT}, - {"attachWorldModelOffsetRoll5", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[14]), CSPFT_FLOAT}, - {"attachWorldModelOffsetPitch6", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[15]), CSPFT_FLOAT}, - {"attachWorldModelOffsetYaw6", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[16]), CSPFT_FLOAT}, - {"attachWorldModelOffsetRoll6", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[17]), CSPFT_FLOAT}, - {"attachWorldModelOffsetPitch7", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[18]), CSPFT_FLOAT}, - {"attachWorldModelOffsetYaw7", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[19]), CSPFT_FLOAT}, - {"attachWorldModelOffsetRoll7", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[20]), CSPFT_FLOAT}, - {"attachWorldModelOffsetPitch8", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[21]), CSPFT_FLOAT}, - {"attachWorldModelOffsetYaw8", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[22]), CSPFT_FLOAT}, - {"attachWorldModelOffsetRoll8", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[23]), CSPFT_FLOAT}, - {"ignoreAttachments", offsetof(WeaponFullDef, weapVariantDef.bIgnoreAttachments), CSPFT_BOOL}, - {"stowedModelOffsetsF", offsetof(WeaponFullDef, weapVariantDef.stowedModelOffsets.x), CSPFT_FLOAT}, - {"stowedModelOffsetsR", offsetof(WeaponFullDef, weapVariantDef.stowedModelOffsets.y), CSPFT_FLOAT}, - {"stowedModelOffsetsU", offsetof(WeaponFullDef, weapVariantDef.stowedModelOffsets.z), CSPFT_FLOAT}, - {"stowedModelOffsetsPitch", offsetof(WeaponFullDef, weapVariantDef.stowedModelRotations.x), CSPFT_FLOAT}, - {"stowedModelOffsetsYaw", offsetof(WeaponFullDef, weapVariantDef.stowedModelRotations.y), CSPFT_FLOAT}, - {"stowedModelOffsetsRoll", offsetof(WeaponFullDef, weapVariantDef.stowedModelRotations.z), CSPFT_FLOAT}, - {"worldClipModel", offsetof(WeaponFullDef, weapDef.worldClipModel), CSPFT_XMODEL}, - {"rocketModel", offsetof(WeaponFullDef, weapDef.rocketModel), CSPFT_XMODEL}, - {"mountedModel", offsetof(WeaponFullDef, weapDef.mountedModel), CSPFT_XMODEL}, - {"AdditionalMeleeModel", offsetof(WeaponFullDef, weapDef.additionalMeleeModel), CSPFT_XMODEL}, - {"fireTypeIcon", offsetof(WeaponFullDef, weapDef.fireTypeIcon), CSPFT_MATERIAL}, - {"hudIcon", offsetof(WeaponFullDef, weapDef.hudIcon), CSPFT_MATERIAL}, - {"hudIconRatio", offsetof(WeaponFullDef, weapDef.hudIconRatio), WFT_ICONRATIO_HUD}, - {"indicatorIcon", offsetof(WeaponFullDef, weapDef.indicatorIcon), CSPFT_MATERIAL}, - {"indicatorIconRatio", offsetof(WeaponFullDef, weapDef.indicatorIconRatio), WFT_ICONRATIO_INDICATOR}, - {"ammoCounterIcon", offsetof(WeaponFullDef, weapDef.ammoCounterIcon), CSPFT_MATERIAL}, - {"ammoCounterIconRatio", offsetof(WeaponFullDef, weapDef.ammoCounterIconRatio), WFT_ICONRATIO_AMMOCOUNTER}, - {"ammoCounterClip", offsetof(WeaponFullDef, weapDef.ammoCounterClip), WFT_AMMOCOUNTER_CLIPTYPE}, - {"startAmmo", offsetof(WeaponFullDef, weapDef.iStartAmmo), CSPFT_INT}, - {"ammoDisplayName", offsetof(WeaponFullDef, weapVariantDef.szAmmoDisplayName), CSPFT_STRING}, - {"ammoName", offsetof(WeaponFullDef, weapVariantDef.szAmmoName), CSPFT_STRING}, - {"clipName", offsetof(WeaponFullDef, weapVariantDef.szClipName), CSPFT_STRING}, - {"maxAmmo", offsetof(WeaponFullDef, weapDef.iMaxAmmo), CSPFT_INT}, - {"clipSize", offsetof(WeaponFullDef, weapVariantDef.iClipSize), CSPFT_INT}, - {"shotCount", offsetof(WeaponFullDef, weapDef.shotCount), CSPFT_INT}, - {"sharedAmmoCapName", offsetof(WeaponFullDef, weapDef.szSharedAmmoCapName), CSPFT_STRING}, - {"sharedAmmoCap", offsetof(WeaponFullDef, weapDef.iSharedAmmoCap), CSPFT_INT}, - {"unlimitedAmmo", offsetof(WeaponFullDef, weapDef.unlimitedAmmo), CSPFT_BOOL}, - {"ammoCountClipRelative", offsetof(WeaponFullDef, weapDef.ammoCountClipRelative), CSPFT_BOOL}, - {"sharedAmmo", offsetof(WeaponFullDef, weapDef.sharedAmmo), CSPFT_BOOL}, - {"jamFireTime", offsetof(WeaponFullDef, weapDef.iJamFireTime), CSPFT_MILLISECONDS}, - {"overheatWeapon", offsetof(WeaponFullDef, weapDef.overheatWeapon), CSPFT_INT}, - {"overheatRate", offsetof(WeaponFullDef, weapDef.overheatRate), CSPFT_FLOAT}, - {"cooldownRate", offsetof(WeaponFullDef, weapDef.cooldownRate), CSPFT_FLOAT}, - {"overheatEndVal", offsetof(WeaponFullDef, weapDef.overheatEndVal), CSPFT_FLOAT}, - {"coolWhileFiring", offsetof(WeaponFullDef, weapDef.coolWhileFiring), CSPFT_INT}, - {"fuelTankWeapon", offsetof(WeaponFullDef, weapDef.fuelTankWeapon), CSPFT_INT}, - {"tankLifeTime", offsetof(WeaponFullDef, weapDef.iTankLifeTime), CSPFT_MILLISECONDS}, - {"damage", offsetof(WeaponFullDef, weapDef.damage[0]), CSPFT_INT}, - {"minDamage", offsetof(WeaponFullDef, weapDef.damage[5]), CSPFT_INT}, - {"maxDamageRange", offsetof(WeaponFullDef, weapDef.damageRange[0]), CSPFT_FLOAT}, - {"minDamageRange", offsetof(WeaponFullDef, weapDef.damageRange[5]), CSPFT_FLOAT}, - {"damage2", offsetof(WeaponFullDef, weapDef.damage[1]), CSPFT_INT}, - {"damage3", offsetof(WeaponFullDef, weapDef.damage[2]), CSPFT_INT}, - {"damage4", offsetof(WeaponFullDef, weapDef.damage[3]), CSPFT_INT}, - {"damage5", offsetof(WeaponFullDef, weapDef.damage[4]), CSPFT_INT}, - {"damageRange2", offsetof(WeaponFullDef, weapDef.damageRange[1]), CSPFT_FLOAT}, - {"damageRange3", offsetof(WeaponFullDef, weapDef.damageRange[2]), CSPFT_FLOAT}, - {"damageRange4", offsetof(WeaponFullDef, weapDef.damageRange[3]), CSPFT_FLOAT}, - {"damageRange5", offsetof(WeaponFullDef, weapDef.damageRange[4]), CSPFT_FLOAT}, - {"damageDuration", offsetof(WeaponFullDef, weapDef.damageDuration), CSPFT_FLOAT}, - {"damageInterval", offsetof(WeaponFullDef, weapDef.damageInterval), CSPFT_FLOAT}, - {"playerDamage", offsetof(WeaponFullDef, weapDef.playerDamage), CSPFT_INT}, - {"meleeDamage", offsetof(WeaponFullDef, weapDef.iMeleeDamage), CSPFT_INT}, - {"minPlayerDamage", offsetof(WeaponFullDef, weapDef.minPlayerDamage), CSPFT_INT}, - {"destabilizationRateTime", offsetof(WeaponFullDef, weapDef.destabilizationRateTime), CSPFT_FLOAT}, - {"destabilizationCurvatureMax", offsetof(WeaponFullDef, weapDef.destabilizationCurvatureMax), CSPFT_FLOAT}, - {"destabilizeDistance", offsetof(WeaponFullDef, weapDef.destabilizeDistance), CSPFT_INT}, - {"fireDelay", offsetof(WeaponFullDef, weapDef.iFireDelay), CSPFT_MILLISECONDS}, - {"meleeDelay", offsetof(WeaponFullDef, weapDef.iMeleeDelay), CSPFT_MILLISECONDS}, - {"meleeChargeDelay", offsetof(WeaponFullDef, weapDef.meleeChargeDelay), CSPFT_MILLISECONDS}, - {"spinUpTime", offsetof(WeaponFullDef, weapDef.iSpinUpTime), CSPFT_MILLISECONDS}, - {"spinDownTime", offsetof(WeaponFullDef, weapDef.iSpinDownTime), CSPFT_MILLISECONDS}, - {"spinRate", offsetof(WeaponFullDef, weapDef.spinRate), CSPFT_FLOAT}, - {"spinLoopSound", offsetof(WeaponFullDef, weapDef.spinLoopSound), CSPFT_STRING}, - {"spinLoopSoundPlayer", offsetof(WeaponFullDef, weapDef.spinLoopSoundPlayer), CSPFT_STRING}, - {"startSpinSound", offsetof(WeaponFullDef, weapDef.startSpinSound), CSPFT_STRING}, - {"startSpinSoundPlayer", offsetof(WeaponFullDef, weapDef.startSpinSoundPlayer), CSPFT_STRING}, - {"stopSpinSound", offsetof(WeaponFullDef, weapDef.stopSpinSound), CSPFT_STRING}, - {"stopSpinSoundPlayer", offsetof(WeaponFullDef, weapDef.stopSpinSoundPlayer), CSPFT_STRING}, - {"applySpinPitch", offsetof(WeaponFullDef, weapDef.applySpinPitch), CSPFT_BOOL}, - {"introFireTime", offsetof(WeaponFullDef, weapDef.iIntroFireTime), CSPFT_MILLISECONDS}, - {"introFireLength", offsetof(WeaponFullDef, weapDef.iIntroFireLength), CSPFT_INT}, - {"fireTime", offsetof(WeaponFullDef, weapDef.iFireTime), CSPFT_MILLISECONDS}, - {"flourishTime", offsetof(WeaponFullDef, weapDef.iFlourishTime), CSPFT_MILLISECONDS}, - {"lastFireTime", offsetof(WeaponFullDef, weapDef.iLastFireTime), CSPFT_MILLISECONDS}, - {"rechamberTime", offsetof(WeaponFullDef, weapDef.iRechamberTime), CSPFT_MILLISECONDS}, - {"rechamberBoltTime", offsetof(WeaponFullDef, weapDef.iRechamberBoltTime), CSPFT_MILLISECONDS}, - {"holdFireTime", offsetof(WeaponFullDef, weapDef.iHoldFireTime), CSPFT_MILLISECONDS}, - {"burstFireDelay", offsetof(WeaponFullDef, weapDef.iBurstDelayTime), CSPFT_MILLISECONDS}, - {"detonateTime", offsetof(WeaponFullDef, weapDef.iDetonateTime), CSPFT_MILLISECONDS}, - {"detonateDelay", offsetof(WeaponFullDef, weapDef.iDetonateDelay), CSPFT_MILLISECONDS}, - {"meleeTime", offsetof(WeaponFullDef, weapDef.iMeleeTime), CSPFT_MILLISECONDS}, - {"meleeChargeTime", offsetof(WeaponFullDef, weapDef.meleeChargeTime), CSPFT_MILLISECONDS}, - {"reloadTime", offsetof(WeaponFullDef, weapVariantDef.iReloadTime), CSPFT_MILLISECONDS}, - {"reloadShowRocketTime", offsetof(WeaponFullDef, weapDef.reloadShowRocketTime), CSPFT_MILLISECONDS}, - {"reloadEmptyTime", offsetof(WeaponFullDef, weapVariantDef.iReloadEmptyTime), CSPFT_MILLISECONDS}, - {"reloadAddTime", offsetof(WeaponFullDef, weapDef.iReloadAddTime), CSPFT_MILLISECONDS}, - {"reloadEmptyAddTime", offsetof(WeaponFullDef, weapDef.iReloadEmptyAddTime), CSPFT_MILLISECONDS}, - {"reloadQuickAddTime", offsetof(WeaponFullDef, weapDef.iReloadQuickAddTime), CSPFT_MILLISECONDS}, - {"reloadQuickEmptyAddTime", offsetof(WeaponFullDef, weapDef.iReloadQuickEmptyAddTime), CSPFT_MILLISECONDS}, - {"reloadStartTime", offsetof(WeaponFullDef, weapDef.iReloadStartTime), CSPFT_MILLISECONDS}, - {"reloadStartAddTime", offsetof(WeaponFullDef, weapDef.iReloadStartAddTime), CSPFT_MILLISECONDS}, - {"reloadEndTime", offsetof(WeaponFullDef, weapDef.iReloadEndTime), CSPFT_MILLISECONDS}, - {"reloadQuickTime", offsetof(WeaponFullDef, weapVariantDef.iReloadQuickTime), CSPFT_MILLISECONDS}, - {"reloadQuickEmptyTime", offsetof(WeaponFullDef, weapVariantDef.iReloadQuickEmptyTime), CSPFT_MILLISECONDS}, - {"dropTime", offsetof(WeaponFullDef, weapDef.iDropTime), CSPFT_MILLISECONDS}, - {"raiseTime", offsetof(WeaponFullDef, weapDef.iRaiseTime), CSPFT_MILLISECONDS}, - {"altDropTime", offsetof(WeaponFullDef, weapDef.iAltDropTime), CSPFT_MILLISECONDS}, - {"altRaiseTime", offsetof(WeaponFullDef, weapVariantDef.iAltRaiseTime), CSPFT_MILLISECONDS}, - {"quickDropTime", offsetof(WeaponFullDef, weapDef.quickDropTime), CSPFT_MILLISECONDS}, - {"quickRaiseTime", offsetof(WeaponFullDef, weapDef.quickRaiseTime), CSPFT_MILLISECONDS}, - {"firstRaiseTime", offsetof(WeaponFullDef, weapDef.iFirstRaiseTime), CSPFT_MILLISECONDS}, - {"emptyRaiseTime", offsetof(WeaponFullDef, weapDef.iEmptyRaiseTime), CSPFT_MILLISECONDS}, - {"emptyDropTime", offsetof(WeaponFullDef, weapDef.iEmptyDropTime), CSPFT_MILLISECONDS}, - {"sprintInTime", offsetof(WeaponFullDef, weapDef.sprintInTime), CSPFT_MILLISECONDS}, - {"sprintLoopTime", offsetof(WeaponFullDef, weapDef.sprintLoopTime), CSPFT_MILLISECONDS}, - {"sprintOutTime", offsetof(WeaponFullDef, weapDef.sprintOutTime), CSPFT_MILLISECONDS}, - {"lowReadyInTime", offsetof(WeaponFullDef, weapDef.lowReadyInTime), CSPFT_MILLISECONDS}, - {"lowReadyLoopTime", offsetof(WeaponFullDef, weapDef.lowReadyLoopTime), CSPFT_MILLISECONDS}, - {"lowReadyOutTime", offsetof(WeaponFullDef, weapDef.lowReadyOutTime), CSPFT_MILLISECONDS}, - {"contFireInTime", offsetof(WeaponFullDef, weapDef.contFireInTime), CSPFT_MILLISECONDS}, - {"contFireLoopTime", offsetof(WeaponFullDef, weapDef.contFireLoopTime), CSPFT_MILLISECONDS}, - {"contFireOutTime", offsetof(WeaponFullDef, weapDef.contFireOutTime), CSPFT_MILLISECONDS}, - {"dtpInTime", offsetof(WeaponFullDef, weapDef.dtpInTime), CSPFT_MILLISECONDS}, - {"dtpLoopTime", offsetof(WeaponFullDef, weapDef.dtpLoopTime), CSPFT_MILLISECONDS}, - {"dtpOutTime", offsetof(WeaponFullDef, weapDef.dtpOutTime), CSPFT_MILLISECONDS}, - {"crawlInTime", offsetof(WeaponFullDef, weapDef.crawlInTime), CSPFT_MILLISECONDS}, - {"crawlForwardTime", offsetof(WeaponFullDef, weapDef.crawlForwardTime), CSPFT_MILLISECONDS}, - {"crawlBackTime", offsetof(WeaponFullDef, weapDef.crawlBackTime), CSPFT_MILLISECONDS}, - {"crawlRightTime", offsetof(WeaponFullDef, weapDef.crawlRightTime), CSPFT_MILLISECONDS}, - {"crawlLeftTime", offsetof(WeaponFullDef, weapDef.crawlLeftTime), CSPFT_MILLISECONDS}, - {"crawlOutFireTime", offsetof(WeaponFullDef, weapDef.crawlOutFireTime), CSPFT_MILLISECONDS}, - {"crawlOutTime", offsetof(WeaponFullDef, weapDef.crawlOutTime), CSPFT_MILLISECONDS}, - {"slideInTime", offsetof(WeaponFullDef, weapDef.slideInTime), CSPFT_MILLISECONDS}, - {"deployTime", offsetof(WeaponFullDef, weapDef.deployTime), CSPFT_MILLISECONDS}, - {"breakdownTime", offsetof(WeaponFullDef, weapDef.breakdownTime), CSPFT_MILLISECONDS}, - {"nightVisionWearTime", offsetof(WeaponFullDef, weapDef.nightVisionWearTime), CSPFT_MILLISECONDS}, - {"nightVisionWearTimeFadeOutEnd", offsetof(WeaponFullDef, weapDef.nightVisionWearTimeFadeOutEnd), CSPFT_MILLISECONDS}, - {"nightVisionWearTimePowerUp", offsetof(WeaponFullDef, weapDef.nightVisionWearTimePowerUp), CSPFT_MILLISECONDS}, - {"nightVisionRemoveTime", offsetof(WeaponFullDef, weapDef.nightVisionRemoveTime), CSPFT_MILLISECONDS}, - {"nightVisionRemoveTimePowerDown", offsetof(WeaponFullDef, weapDef.nightVisionRemoveTimePowerDown), CSPFT_MILLISECONDS}, - {"nightVisionRemoveTimeFadeInStart", offsetof(WeaponFullDef, weapDef.nightVisionRemoveTimeFadeInStart), CSPFT_MILLISECONDS}, - {"fuseTime", offsetof(WeaponFullDef, weapDef.fuseTime), CSPFT_MILLISECONDS}, - {"aifuseTime", offsetof(WeaponFullDef, weapDef.aiFuseTime), CSPFT_MILLISECONDS}, - {"lockOnRadius", offsetof(WeaponFullDef, weapDef.lockOnRadius), CSPFT_INT}, - {"lockOnSpeed", offsetof(WeaponFullDef, weapDef.lockOnSpeed), CSPFT_INT}, - {"requireLockonToFire", offsetof(WeaponFullDef, weapDef.requireLockonToFire), CSPFT_BOOL}, - {"noAdsWhenMagEmpty", offsetof(WeaponFullDef, weapDef.noAdsWhenMagEmpty), CSPFT_BOOL}, - {"avoidDropCleanup", offsetof(WeaponFullDef, weapDef.avoidDropCleanup), CSPFT_BOOL}, - {"stackFire", offsetof(WeaponFullDef, weapDef.stackFire), CSPFT_INT}, - {"stackFireSpread", offsetof(WeaponFullDef, weapDef.stackFireSpread), CSPFT_FLOAT}, - {"stackFireAccuracyDecay", offsetof(WeaponFullDef, weapDef.stackFireAccuracyDecay), CSPFT_FLOAT}, - {"stackSound", offsetof(WeaponFullDef, weapDef.stackSound), CSPFT_STRING}, - {"autoAimRange", offsetof(WeaponFullDef, weapDef.autoAimRange), CSPFT_FLOAT}, - {"aimAssistRange", offsetof(WeaponFullDef, weapDef.aimAssistRange), CSPFT_FLOAT}, - {"aimAssistRangeAds", offsetof(WeaponFullDef, weapVariantDef.fAimAssistRangeAds), CSPFT_FLOAT}, - {"mountableWeapon", offsetof(WeaponFullDef, weapDef.mountableWeapon), CSPFT_BOOL}, - {"aimPadding", offsetof(WeaponFullDef, weapDef.aimPadding), CSPFT_FLOAT}, - {"enemyCrosshairRange", offsetof(WeaponFullDef, weapDef.enemyCrosshairRange), CSPFT_FLOAT}, - {"crosshairColorChange", offsetof(WeaponFullDef, weapDef.crosshairColorChange), CSPFT_BOOL}, - {"moveSpeedScale", offsetof(WeaponFullDef, weapDef.moveSpeedScale), CSPFT_FLOAT}, - {"adsMoveSpeedScale", offsetof(WeaponFullDef, weapDef.adsMoveSpeedScale), CSPFT_FLOAT}, - {"sprintDurationScale", offsetof(WeaponFullDef, weapDef.sprintDurationScale), CSPFT_FLOAT}, - {"idleCrouchFactor", offsetof(WeaponFullDef, weapDef.fIdleCrouchFactor), CSPFT_FLOAT}, - {"idleProneFactor", offsetof(WeaponFullDef, weapDef.fIdleProneFactor), CSPFT_FLOAT}, - {"gunMaxPitch", offsetof(WeaponFullDef, weapDef.fGunMaxPitch), CSPFT_FLOAT}, - {"gunMaxYaw", offsetof(WeaponFullDef, weapDef.fGunMaxYaw), CSPFT_FLOAT}, - {"swayMaxAngle", offsetof(WeaponFullDef, weapDef.swayMaxAngle), CSPFT_FLOAT}, - {"swayLerpSpeed", offsetof(WeaponFullDef, weapDef.swayLerpSpeed), CSPFT_FLOAT}, - {"swayPitchScale", offsetof(WeaponFullDef, weapDef.swayPitchScale), CSPFT_FLOAT}, - {"swayYawScale", offsetof(WeaponFullDef, weapDef.swayYawScale), CSPFT_FLOAT}, - {"swayHorizScale", offsetof(WeaponFullDef, weapDef.swayHorizScale), CSPFT_FLOAT}, - {"swayVertScale", offsetof(WeaponFullDef, weapDef.swayVertScale), CSPFT_FLOAT}, - {"swayShellShockScale", offsetof(WeaponFullDef, weapDef.swayShellShockScale), CSPFT_FLOAT}, - {"adsSwayMaxAngle", offsetof(WeaponFullDef, weapDef.adsSwayMaxAngle), CSPFT_FLOAT}, - {"adsSwayLerpSpeed", offsetof(WeaponFullDef, weapDef.adsSwayLerpSpeed), CSPFT_FLOAT}, - {"adsSwayPitchScale", offsetof(WeaponFullDef, weapDef.adsSwayPitchScale), CSPFT_FLOAT}, - {"adsSwayYawScale", offsetof(WeaponFullDef, weapDef.adsSwayYawScale), CSPFT_FLOAT}, - {"adsSwayHorizScale", offsetof(WeaponFullDef, weapVariantDef.fAdsSwayHorizScale), CSPFT_FLOAT}, - {"adsSwayVertScale", offsetof(WeaponFullDef, weapVariantDef.fAdsSwayVertScale), CSPFT_FLOAT}, - {"meleeChargeRange", offsetof(WeaponFullDef, weapDef.meleeChargeRange), CSPFT_FLOAT}, - {"rifleBullet", offsetof(WeaponFullDef, weapDef.bRifleBullet), CSPFT_BOOL}, - {"armorPiercing", offsetof(WeaponFullDef, weapDef.armorPiercing), CSPFT_BOOL}, - {"boltAction", offsetof(WeaponFullDef, weapDef.bBoltAction), CSPFT_BOOL}, - {"shotsBeforeRechamber", offsetof(WeaponFullDef, weapDef.iShotsBeforeRechamber), CSPFT_INT}, - {"useAltTagFlash", offsetof(WeaponFullDef, weapDef.bUseAltTagFlash), CSPFT_BOOL}, - {"useAntiLagRewind", offsetof(WeaponFullDef, weapDef.bUseAntiLagRewind), CSPFT_BOOL}, - {"isCarriedKillstreakWeapon", offsetof(WeaponFullDef, weapDef.bIsCarriedKillstreakWeapon), CSPFT_BOOL}, - {"aimDownSight", offsetof(WeaponFullDef, weapDef.aimDownSight), CSPFT_BOOL}, - {"rechamberWhileAds", offsetof(WeaponFullDef, weapDef.bRechamberWhileAds), CSPFT_BOOL}, - {"reloadWhileAds", offsetof(WeaponFullDef, weapDef.bReloadWhileAds), CSPFT_BOOL}, - {"adsViewErrorMin", offsetof(WeaponFullDef, weapDef.adsViewErrorMin), CSPFT_FLOAT}, - {"adsViewErrorMax", offsetof(WeaponFullDef, weapDef.adsViewErrorMax), CSPFT_FLOAT}, - {"clipOnly", offsetof(WeaponFullDef, weapDef.bClipOnly), CSPFT_BOOL}, - {"canUseInVehicle", offsetof(WeaponFullDef, weapDef.bCanUseInVehicle), CSPFT_BOOL}, - {"noDropsOrRaises", offsetof(WeaponFullDef, weapDef.bNoDropsOrRaises), CSPFT_BOOL}, - {"cookOffHold", offsetof(WeaponFullDef, weapDef.bCookOffHold), CSPFT_BOOL}, - {"adsFire", offsetof(WeaponFullDef, weapDef.adsFireOnly), CSPFT_BOOL}, - {"cancelAutoHolsterWhenEmpty", offsetof(WeaponFullDef, weapDef.cancelAutoHolsterWhenEmpty), CSPFT_BOOL}, - {"suppressAmmoReserveDisplay", offsetof(WeaponFullDef, weapDef.suppressAmmoReserveDisplay), CSPFT_BOOL}, - {"laserSight", offsetof(WeaponFullDef, weapDef.laserSight), CSPFT_BOOL}, - {"laserSightDuringNightvision", offsetof(WeaponFullDef, weapDef.laserSightDuringNightvision), CSPFT_BOOL}, - {"bayonet", offsetof(WeaponFullDef, weapDef.bHasBayonet), CSPFT_BOOL}, - {"dualWield", offsetof(WeaponFullDef, weapDef.bDualWield), CSPFT_BOOL}, - {"hideThirdPerson", offsetof(WeaponFullDef, weapDef.bHideThirdPerson), CSPFT_BOOL}, - {"explodeOnGround", offsetof(WeaponFullDef, weapDef.bExplodeOnGround), CSPFT_BOOL}, - {"throwBack", offsetof(WeaponFullDef, weapDef.bThrowBack), CSPFT_BOOL}, - {"retrievable", offsetof(WeaponFullDef, weapDef.bRetrievable), CSPFT_BOOL}, - {"dieOnRespawn", offsetof(WeaponFullDef, weapDef.bDieOnRespawn), CSPFT_BOOL}, - {"noThirdPersonDropsOrRaises", offsetof(WeaponFullDef, weapDef.bNoThirdPersonDropsOrRaises), CSPFT_BOOL}, - {"continuousFire", offsetof(WeaponFullDef, weapDef.bContinuousFire), CSPFT_BOOL}, - {"useAsMelee", offsetof(WeaponFullDef, weapDef.bUseAsMelee), CSPFT_BOOL}, - {"antiQuickScope", offsetof(WeaponFullDef, weapVariantDef.bAntiQuickScope), CSPFT_BOOL}, - {"noPing", offsetof(WeaponFullDef, weapDef.bNoPing), CSPFT_BOOL}, - {"forceBounce", offsetof(WeaponFullDef, weapDef.bForceBounce), CSPFT_BOOL}, - {"useDroppedModelAsStowed", offsetof(WeaponFullDef, weapDef.bUseDroppedModelAsStowed), CSPFT_BOOL}, - {"noQuickDropWhenEmpty", offsetof(WeaponFullDef, weapDef.bNoQuickDropWhenEmpty), CSPFT_BOOL}, - {"keepCrosshairWhenADS", offsetof(WeaponFullDef, weapDef.bKeepCrosshairWhenADS), CSPFT_BOOL}, - {"useOnlyAltWeaoponHideTagsInAltMode", offsetof(WeaponFullDef, weapDef.bUseOnlyAltWeaoponHideTagsInAltMode), CSPFT_BOOL}, - {"altWeaponAdsOnly", offsetof(WeaponFullDef, weapDef.bAltWeaponAdsOnly), CSPFT_BOOL}, - {"altWeaponDisableSwitching", offsetof(WeaponFullDef, weapDef.bAltWeaponDisableSwitching), CSPFT_BOOL}, - {"killIcon", offsetof(WeaponFullDef, weapDef.killIcon), CSPFT_MATERIAL}, - {"killIconRatio", offsetof(WeaponFullDef, weapDef.killIconRatio), WFT_ICONRATIO_KILL}, - {"flipKillIcon", offsetof(WeaponFullDef, weapDef.flipKillIcon), CSPFT_BOOL}, - {"dpadIcon", offsetof(WeaponFullDef, weapVariantDef.dpadIcon), CSPFT_MATERIAL}, - {"dpadIconRatio", offsetof(WeaponFullDef, weapVariantDef.dpadIconRatio), WFT_ICONRATIO_DPAD}, - {"noAmmoOnDpadIcon", offsetof(WeaponFullDef, weapVariantDef.noAmmoOnDpadIcon), CSPFT_BOOL}, - {"noPartialReload", offsetof(WeaponFullDef, weapDef.bNoPartialReload), CSPFT_BOOL}, - {"segmentedReload", offsetof(WeaponFullDef, weapDef.bSegmentedReload), CSPFT_BOOL}, - {"noADSAutoReload", offsetof(WeaponFullDef, weapDef.bNoADSAutoReload), CSPFT_BOOL}, - {"reloadAmmoAdd", offsetof(WeaponFullDef, weapDef.iReloadAmmoAdd), CSPFT_INT}, - {"reloadStartAdd", offsetof(WeaponFullDef, weapDef.iReloadStartAdd), CSPFT_INT}, - {"attachmentUnique", offsetof(WeaponFullDef, weapVariantDef.szAttachmentUnique), CSPFT_STRING}, - {"altWeapon", offsetof(WeaponFullDef, weapVariantDef.szAltWeaponName), CSPFT_STRING}, - {"DualWieldWeapon", offsetof(WeaponFullDef, weapDef.szDualWieldWeaponName), CSPFT_STRING}, - {"grenadeWeapon", offsetof(WeaponFullDef, weapDef.szSpawnedGrenadeWeaponName), CSPFT_STRING}, - {"dropAmmoMin", offsetof(WeaponFullDef, weapDef.iDropAmmoMin), CSPFT_INT}, - {"dropAmmoMax", offsetof(WeaponFullDef, weapDef.iDropAmmoMax), CSPFT_INT}, - {"dropClipAmmoMin", offsetof(WeaponFullDef, weapDef.iDropClipAmmoMin), CSPFT_INT}, - {"dropClipAmmoMax", offsetof(WeaponFullDef, weapDef.iDropClipAmmoMax), CSPFT_INT}, - {"blocksProne", offsetof(WeaponFullDef, weapDef.blocksProne), CSPFT_BOOL}, - {"silenced", offsetof(WeaponFullDef, weapVariantDef.bSilenced), CSPFT_BOOL}, - {"dualMag", offsetof(WeaponFullDef, weapVariantDef.bDualMag), CSPFT_BOOL}, - {"infrared", offsetof(WeaponFullDef, weapVariantDef.bInfraRed), CSPFT_BOOL}, - {"tvguided", offsetof(WeaponFullDef, weapVariantDef.bTVGuided), CSPFT_BOOL}, - {"airburstWeapon", offsetof(WeaponFullDef, weapDef.bAirburstWeapon), CSPFT_BOOL}, - {"perks1", offsetof(WeaponFullDef, weapVariantDef.perks[0]), CSPFT_UINT}, - {"perks0", offsetof(WeaponFullDef, weapVariantDef.perks[1]), CSPFT_UINT}, - {"isRollingGrenade", offsetof(WeaponFullDef, weapDef.isRollingGrenade), CSPFT_QBOOLEAN}, - {"useBallisticPrediction", offsetof(WeaponFullDef, weapDef.useBallisticPrediction), CSPFT_QBOOLEAN}, - {"isValuable", offsetof(WeaponFullDef, weapDef.isValuable), CSPFT_QBOOLEAN}, - {"isTacticalInsertion", offsetof(WeaponFullDef, weapDef.isTacticalInsertion), CSPFT_QBOOLEAN}, - {"isReviveWeapon", offsetof(WeaponFullDef, weapDef.isReviveWeapon), CSPFT_BOOL}, - {"bUseRigidBodyOnVehicle", offsetof(WeaponFullDef, weapDef.bUseRigidBodyOnVehicle), CSPFT_BOOL}, - {"showIndicator", offsetof(WeaponFullDef, weapDef.bShowIndicator), CSPFT_BOOL}, - {"explosionRadius", offsetof(WeaponFullDef, weapDef.iExplosionRadius), CSPFT_INT}, - {"explosionRadiusMin", offsetof(WeaponFullDef, weapDef.iExplosionRadiusMin), CSPFT_INT}, - {"indicatorRadius", offsetof(WeaponFullDef, weapDef.iIndicatorRadius), CSPFT_INT}, - {"explosionInnerDamage", offsetof(WeaponFullDef, weapDef.iExplosionInnerDamage), CSPFT_INT}, - {"explosionOuterDamage", offsetof(WeaponFullDef, weapDef.iExplosionOuterDamage), CSPFT_INT}, - {"damageConeAngle", offsetof(WeaponFullDef, weapDef.damageConeAngle), CSPFT_FLOAT}, - {"projectileSpeed", offsetof(WeaponFullDef, weapDef.iProjectileSpeed), CSPFT_INT}, - {"projectileSpeedRelativeUp", offsetof(WeaponFullDef, weapDef.iProjectileSpeedRelativeUp), CSPFT_INT}, - {"projectileSpeedUp", offsetof(WeaponFullDef, weapDef.iProjectileSpeedUp), CSPFT_INT}, - {"projectileSpeedForward", offsetof(WeaponFullDef, weapDef.iProjectileSpeedForward), CSPFT_INT}, - {"projectileTakeParentVel", offsetof(WeaponFullDef, weapDef.fProjectileTakeParentVelocity), CSPFT_FLOAT}, - {"projectileActivateDist", offsetof(WeaponFullDef, weapDef.iProjectileActivateDist), CSPFT_INT}, - {"projectileLifetime", offsetof(WeaponFullDef, weapDef.projLifetime), CSPFT_FLOAT}, - {"timeToAccelerate", offsetof(WeaponFullDef, weapDef.timeToAccelerate), CSPFT_FLOAT}, - {"projectileCurvature", offsetof(WeaponFullDef, weapDef.projectileCurvature), CSPFT_FLOAT}, - {"projectileModel", offsetof(WeaponFullDef, weapDef.projectileModel), CSPFT_XMODEL}, - {"projExplosionType", offsetof(WeaponFullDef, weapDef.projExplosion), WFT_PROJ_EXPLOSION}, - {"projExplosionEffect", offsetof(WeaponFullDef, weapDef.projExplosionEffect), CSPFT_FX}, - {"projExplosionEffectForceNormalUp", offsetof(WeaponFullDef, weapDef.projExplosionEffectForceNormalUp), CSPFT_BOOL}, - {"projExplosionEffect2", offsetof(WeaponFullDef, weapDef.projExplosionEffect2), CSPFT_FX}, - {"projExplosionEffect2ForceNormalUp", offsetof(WeaponFullDef, weapDef.projExplosionEffect2ForceNormalUp), CSPFT_BOOL}, - {"projExplosionEffect3", offsetof(WeaponFullDef, weapDef.projExplosionEffect3), CSPFT_FX}, - {"projExplosionEffect3ForceNormalUp", offsetof(WeaponFullDef, weapDef.projExplosionEffect3ForceNormalUp), CSPFT_BOOL}, - {"projExplosionEffect4", offsetof(WeaponFullDef, weapDef.projExplosionEffect4), CSPFT_FX}, - {"projExplosionEffect4ForceNormalUp", offsetof(WeaponFullDef, weapDef.projExplosionEffect4ForceNormalUp), CSPFT_BOOL}, - {"projExplosionEffect5", offsetof(WeaponFullDef, weapDef.projExplosionEffect5), CSPFT_FX}, - {"projExplosionEffect5ForceNormalUp", offsetof(WeaponFullDef, weapDef.projExplosionEffect5ForceNormalUp), CSPFT_BOOL}, - {"projExplosionSound", offsetof(WeaponFullDef, weapDef.projExplosionSound), CSPFT_STRING}, - {"projDudEffect", offsetof(WeaponFullDef, weapDef.projDudEffect), CSPFT_FX}, - {"projDudSound", offsetof(WeaponFullDef, weapDef.projDudSound), CSPFT_STRING}, - {"projImpactExplode", offsetof(WeaponFullDef, weapDef.bProjImpactExplode), CSPFT_BOOL}, - {"sentientImpactExplode", offsetof(WeaponFullDef, weapDef.bProjSentientImpactExplode), CSPFT_BOOL}, - {"explodeWhenStationary", offsetof(WeaponFullDef, weapDef.bProjExplodeWhenStationary), CSPFT_BOOL}, - {"bulletImpactExplode", offsetof(WeaponFullDef, weapDef.bBulletImpactExplode), CSPFT_BOOL}, - {"mortarShellSound", offsetof(WeaponFullDef, weapDef.mortarShellSound), CSPFT_STRING}, - {"tankShellSound", offsetof(WeaponFullDef, weapDef.tankShellSound), CSPFT_STRING}, - {"stickiness", offsetof(WeaponFullDef, weapDef.stickiness), WFT_STICKINESS}, - {"rotateType", offsetof(WeaponFullDef, weapDef.rotateType), WFT_ROTATETYPE}, - {"hasDetonator", offsetof(WeaponFullDef, weapDef.hasDetonator), CSPFT_BOOL}, - {"plantable", offsetof(WeaponFullDef, weapDef.plantable), CSPFT_BOOL}, - {"timedDetonation", offsetof(WeaponFullDef, weapDef.timedDetonation), CSPFT_BOOL}, - {"noCrumpleMissile", offsetof(WeaponFullDef, weapDef.bNoCrumpleMissile), CSPFT_BOOL}, - {"rotate", offsetof(WeaponFullDef, weapDef.rotate), CSPFT_BOOL}, - {"keepRolling", offsetof(WeaponFullDef, weapDef.bKeepRolling), CSPFT_BOOL}, - {"holdButtonToThrow", offsetof(WeaponFullDef, weapDef.holdButtonToThrow), CSPFT_BOOL}, - {"offhandHoldIsCancelable", offsetof(WeaponFullDef, weapDef.offhandHoldIsCancelable), CSPFT_BOOL}, - {"freezeMovementWhenFiring", offsetof(WeaponFullDef, weapDef.freezeMovementWhenFiring), CSPFT_BOOL}, - {"lowAmmoWarningThreshold", offsetof(WeaponFullDef, weapDef.lowAmmoWarningThreshold), CSPFT_FLOAT}, - {"explosionTag", offsetof(WeaponFullDef, weapDef.explosionTag), WFT_EXPLOSION_TAG}, - {"bDisallowAtMatchStart", offsetof(WeaponFullDef, weapDef.bDisallowAtMatchStart), CSPFT_BOOL}, - {"isCameraSensor", offsetof(WeaponFullDef, weapDef.isCameraSensor), CSPFT_BOOL}, - {"isAcousticSensor", offsetof(WeaponFullDef, weapDef.isAcousticSensor), CSPFT_BOOL}, - {"isLaserSensor", offsetof(WeaponFullDef, weapDef.isLaserSensor), CSPFT_BOOL}, - {"isHoldUseGrenade", offsetof(WeaponFullDef, weapDef.isHoldUseGrenade), CSPFT_BOOL}, - {"parallelDefaultBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_DEFAULT]), CSPFT_FLOAT}, - {"parallelAsphaltBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_ASPHALT]), CSPFT_FLOAT}, - {"parallelBarkBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_BARK]), CSPFT_FLOAT}, - {"parallelBrickBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_BRICK]), CSPFT_FLOAT}, - {"parallelCarpetBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_CARPET]), CSPFT_FLOAT}, - {"parallelCeramicBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_CERAMIC]), CSPFT_FLOAT}, - {"parallelClothBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_CLOTH]), CSPFT_FLOAT}, - {"parallelConcreteBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_CONCRETE]), CSPFT_FLOAT}, - {"parallelCushionBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_CUSHION]), CSPFT_FLOAT}, - {"parallelDirtBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_DIRT]), CSPFT_FLOAT}, - {"parallelFleshBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_FLESH]), CSPFT_FLOAT}, - {"parallelFoliageBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_FOLIAGE]), CSPFT_FLOAT}, - {"parallelFruitBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_FRUIT]), CSPFT_FLOAT}, - {"parallelGlassBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_GLASS]), CSPFT_FLOAT}, - {"parallelGrassBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_GRASS]), CSPFT_FLOAT}, - {"parallelGravelBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_GRAVEL]), CSPFT_FLOAT}, - {"parallelIceBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_ICE]), CSPFT_FLOAT}, - {"parallelMetalBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_METAL]), CSPFT_FLOAT}, - {"parallelMudBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_MUD]), CSPFT_FLOAT}, - {"parallelPaintedMetalBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_PAINTED_METAL]), CSPFT_FLOAT}, - {"parallelPaperBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_PAPER]), CSPFT_FLOAT}, - {"parallelPlasterBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_PLASTER]), CSPFT_FLOAT}, - {"parallelPlasticBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_PLASTIC]), CSPFT_FLOAT}, - {"parallelRockBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_ROCK]), CSPFT_FLOAT}, - {"parallelRubberBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_RUBBER]), CSPFT_FLOAT}, - {"parallelSandBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_SAND]), CSPFT_FLOAT}, - {"parallelSnowBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_SNOW]), CSPFT_FLOAT}, - {"parallelWaterBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_WATER]), CSPFT_FLOAT}, - {"parallelWoodBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_WOOD]), CSPFT_FLOAT}, - {"parallelRiotShieldBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_RIOT_SHIELD]), CSPFT_FLOAT}, - {"perpendicularDefaultBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_DEFAULT]), CSPFT_FLOAT}, - {"perpendicularAsphaltBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_ASPHALT]), CSPFT_FLOAT}, - {"perpendicularBarkBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_BARK]), CSPFT_FLOAT}, - {"perpendicularBrickBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_BRICK]), CSPFT_FLOAT}, - {"perpendicularCarpetBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_CARPET]), CSPFT_FLOAT}, - {"perpendicularCeramicBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_CERAMIC]), CSPFT_FLOAT}, - {"perpendicularClothBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_CLOTH]), CSPFT_FLOAT}, - {"perpendicularConcreteBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_CONCRETE]), CSPFT_FLOAT}, - {"perpendicularCushionBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_CUSHION]), CSPFT_FLOAT}, - {"perpendicularDirtBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_DIRT]), CSPFT_FLOAT}, - {"perpendicularFleshBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_FLESH]), CSPFT_FLOAT}, - {"perpendicularFoliageBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_FOLIAGE]), CSPFT_FLOAT}, - {"perpendicularFruitBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_FRUIT]), CSPFT_FLOAT}, - {"perpendicularGlassBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_GLASS]), CSPFT_FLOAT}, - {"perpendicularGrassBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_GRASS]), CSPFT_FLOAT}, - {"perpendicularGravelBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_GRAVEL]), CSPFT_FLOAT}, - {"perpendicularIceBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_ICE]), CSPFT_FLOAT}, - {"perpendicularMetalBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_METAL]), CSPFT_FLOAT}, - {"perpendicularMudBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_MUD]), CSPFT_FLOAT}, - {"perpendicularPaintedMetalBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_PAINTED_METAL]), CSPFT_FLOAT}, - {"perpendicularPaperBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_PAPER]), CSPFT_FLOAT}, - {"perpendicularPlasterBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_PLASTER]), CSPFT_FLOAT}, - {"perpendicularPlasticBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_PLASTIC]), CSPFT_FLOAT}, - {"perpendicularRockBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_ROCK]), CSPFT_FLOAT}, - {"perpendicularRubberBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_RUBBER]), CSPFT_FLOAT}, - {"perpendicularSandBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_SAND]), CSPFT_FLOAT}, - {"perpendicularSnowBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_SNOW]), CSPFT_FLOAT}, - {"perpendicularWaterBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_WATER]), CSPFT_FLOAT}, - {"perpendicularWoodBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_WOOD]), CSPFT_FLOAT}, - {"perpendicularRiotShieldBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_RIOT_SHIELD]), CSPFT_FLOAT}, - {"projTrailEffect", offsetof(WeaponFullDef, weapDef.projTrailEffect), CSPFT_FX}, - {"projectileRed", offsetof(WeaponFullDef, weapDef.vProjectileColor.x), CSPFT_FLOAT}, - {"projectileGreen", offsetof(WeaponFullDef, weapDef.vProjectileColor.y), CSPFT_FLOAT}, - {"projectileBlue", offsetof(WeaponFullDef, weapDef.vProjectileColor.z), CSPFT_FLOAT}, - {"guidedMissileType", offsetof(WeaponFullDef, weapDef.guidedMissileType), WFT_GUIDED_MISSILE_TYPE}, - {"maxSteeringAccel", offsetof(WeaponFullDef, weapDef.maxSteeringAccel), CSPFT_FLOAT}, - {"projIgnitionDelay", offsetof(WeaponFullDef, weapDef.projIgnitionDelay), CSPFT_INT}, - {"projIgnitionEffect", offsetof(WeaponFullDef, weapDef.projIgnitionEffect), CSPFT_FX}, - {"projIgnitionSound", offsetof(WeaponFullDef, weapDef.projIgnitionSound), CSPFT_STRING}, - {"tagFx_preparationEffect", offsetof(WeaponFullDef, weapDef.tagFx_preparationEffect), CSPFT_FX}, - {"tagFlash_preparationEffect", offsetof(WeaponFullDef, weapDef.tagFlash_preparationEffect), CSPFT_FX}, - {"adsTransInTime", offsetof(WeaponFullDef, weapVariantDef.iAdsTransInTime), CSPFT_MILLISECONDS}, - {"adsTransOutTime", offsetof(WeaponFullDef, weapVariantDef.iAdsTransOutTime), CSPFT_MILLISECONDS}, - {"adsIdleAmount", offsetof(WeaponFullDef, weapDef.fAdsIdleAmount), CSPFT_FLOAT}, - {"adsIdleSpeed", offsetof(WeaponFullDef, weapDef.adsIdleSpeed), CSPFT_FLOAT}, - {"adsZoomFov1", offsetof(WeaponFullDef, weapVariantDef.fAdsZoomFov1), CSPFT_FLOAT}, - {"adsZoomFov2", offsetof(WeaponFullDef, weapVariantDef.fAdsZoomFov2), CSPFT_FLOAT}, - {"adsZoomFov3", offsetof(WeaponFullDef, weapVariantDef.fAdsZoomFov3), CSPFT_FLOAT}, - {"adsZoomInFrac", offsetof(WeaponFullDef, weapVariantDef.fAdsZoomInFrac), CSPFT_FLOAT}, - {"adsZoomOutFrac", offsetof(WeaponFullDef, weapVariantDef.fAdsZoomOutFrac), CSPFT_FLOAT}, - {"adsOverlayShader", offsetof(WeaponFullDef, weapVariantDef.overlayMaterial), CSPFT_MATERIAL_STREAM}, - {"adsOverlayShaderLowRes", offsetof(WeaponFullDef, weapVariantDef.overlayMaterialLowRes), CSPFT_MATERIAL_STREAM}, - {"adsOverlayReticle", offsetof(WeaponFullDef, weapDef.overlayReticle), WFT_OVERLAYRETICLE}, - {"adsOverlayInterface", offsetof(WeaponFullDef, weapDef.overlayInterface), WFT_OVERLAYINTERFACE}, - {"adsOverlayWidth", offsetof(WeaponFullDef, weapDef.overlayWidth), CSPFT_FLOAT}, - {"adsOverlayHeight", offsetof(WeaponFullDef, weapDef.overlayHeight), CSPFT_FLOAT}, - {"adsOverlayAlphaScale", offsetof(WeaponFullDef, weapVariantDef.fOverlayAlphaScale), CSPFT_FLOAT}, - {"adsBobFactor", offsetof(WeaponFullDef, weapDef.fAdsBobFactor), CSPFT_FLOAT}, - {"adsViewBobMult", offsetof(WeaponFullDef, weapDef.fAdsViewBobMult), CSPFT_FLOAT}, - {"holdBreathToSteady", offsetof(WeaponFullDef, weapDef.bHoldBreathToSteady), CSPFT_BOOL}, - {"adsAimPitch", offsetof(WeaponFullDef, weapDef.fAdsAimPitch), CSPFT_FLOAT}, - {"adsCrosshairInFrac", offsetof(WeaponFullDef, weapDef.fAdsCrosshairInFrac), CSPFT_FLOAT}, - {"adsCrosshairOutFrac", offsetof(WeaponFullDef, weapDef.fAdsCrosshairOutFrac), CSPFT_FLOAT}, - {"adsReloadTransTime", offsetof(WeaponFullDef, weapDef.iPositionReloadTransTime), CSPFT_MILLISECONDS}, - {"adsGunKickReducedKickBullets", offsetof(WeaponFullDef, weapDef.adsGunKickReducedKickBullets), CSPFT_INT}, - {"adsGunKickReducedKickPercent", offsetof(WeaponFullDef, weapDef.adsGunKickReducedKickPercent), CSPFT_FLOAT}, - {"adsGunKickPitchMin", offsetof(WeaponFullDef, weapDef.fAdsGunKickPitchMin), CSPFT_FLOAT}, - {"adsGunKickPitchMax", offsetof(WeaponFullDef, weapDef.fAdsGunKickPitchMax), CSPFT_FLOAT}, - {"adsGunKickYawMin", offsetof(WeaponFullDef, weapDef.fAdsGunKickYawMin), CSPFT_FLOAT}, - {"adsGunKickYawMax", offsetof(WeaponFullDef, weapDef.fAdsGunKickYawMax), CSPFT_FLOAT}, - {"adsGunKickAccel", offsetof(WeaponFullDef, weapDef.fAdsGunKickAccel), CSPFT_FLOAT}, - {"adsGunKickSpeedMax", offsetof(WeaponFullDef, weapDef.fAdsGunKickSpeedMax), CSPFT_FLOAT}, - {"adsGunKickSpeedDecay", offsetof(WeaponFullDef, weapDef.fAdsGunKickSpeedDecay), CSPFT_FLOAT}, - {"adsGunKickStaticDecay", offsetof(WeaponFullDef, weapDef.fAdsGunKickStaticDecay), CSPFT_FLOAT}, - {"adsViewKickPitchMin", offsetof(WeaponFullDef, weapDef.fAdsViewKickPitchMin), CSPFT_FLOAT}, - {"adsViewKickPitchMax", offsetof(WeaponFullDef, weapDef.fAdsViewKickPitchMax), CSPFT_FLOAT}, - {"adsViewKickMinMagnitude", offsetof(WeaponFullDef, weapDef.fAdsViewKickMinMagnitude), CSPFT_FLOAT}, - {"adsViewKickYawMin", offsetof(WeaponFullDef, weapDef.fAdsViewKickYawMin), CSPFT_FLOAT}, - {"adsViewKickYawMax", offsetof(WeaponFullDef, weapDef.fAdsViewKickYawMax), CSPFT_FLOAT}, - {"adsRecoilReductionRate", offsetof(WeaponFullDef, weapDef.fAdsRecoilReductionRate), CSPFT_FLOAT}, - {"adsRecoilReductionLimit", offsetof(WeaponFullDef, weapDef.fAdsRecoilReductionLimit), CSPFT_FLOAT}, - {"adsRecoilReturnRate", offsetof(WeaponFullDef, weapDef.fAdsRecoilReturnRate), CSPFT_FLOAT}, - {"adsViewKickCenterSpeed", offsetof(WeaponFullDef, weapVariantDef.fAdsViewKickCenterSpeed), CSPFT_FLOAT}, - {"adsViewKickCenterDuckedScale", offsetof(WeaponFullDef, weapDef.fAdsViewKickCenterDuckedScale), CSPFT_FLOAT}, - {"adsViewKickCenterProneScale", offsetof(WeaponFullDef, weapDef.fAdsViewKickCenterProneScale), CSPFT_FLOAT}, - {"adsSpread", offsetof(WeaponFullDef, weapDef.fAdsSpread), CSPFT_FLOAT}, - {"guidedMissileType", offsetof(WeaponFullDef, weapDef.guidedMissileType), WFT_GUIDED_MISSILE_TYPE}, - {"antiQuickScopeTime", offsetof(WeaponFullDef, weapDef.fAntiQuickScopeTime), CSPFT_FLOAT}, - {"antiQuickScopeScale", offsetof(WeaponFullDef, weapDef.fAntiQuickScopeScale), CSPFT_FLOAT}, - {"antiQuickScopeSpreadMultiplier", offsetof(WeaponFullDef, weapDef.fAntiQuickScopeSpreadMultiplier), CSPFT_FLOAT}, - {"antiQuickScopeSpreadMax", offsetof(WeaponFullDef, weapDef.fAntiQuickScopeSpreadMax), CSPFT_FLOAT}, - {"antiQuickScopeSwayFactor", offsetof(WeaponFullDef, weapDef.fAntiQuickScopeSwayFactor), CSPFT_FLOAT}, - {"hipSpreadStandMin", offsetof(WeaponFullDef, weapDef.fHipSpreadStandMin), CSPFT_FLOAT}, - {"hipSpreadDuckedMin", offsetof(WeaponFullDef, weapDef.fHipSpreadDuckedMin), CSPFT_FLOAT}, - {"hipSpreadProneMin", offsetof(WeaponFullDef, weapDef.fHipSpreadProneMin), CSPFT_FLOAT}, - {"hipSpreadMax", offsetof(WeaponFullDef, weapDef.hipSpreadStandMax), CSPFT_FLOAT}, - {"hipSpreadDuckedMax", offsetof(WeaponFullDef, weapDef.hipSpreadDuckedMax), CSPFT_FLOAT}, - {"hipSpreadProneMax", offsetof(WeaponFullDef, weapDef.hipSpreadProneMax), CSPFT_FLOAT}, - {"hipSpreadDecayRate", offsetof(WeaponFullDef, weapDef.fHipSpreadDecayRate), CSPFT_FLOAT}, - {"hipSpreadFireAdd", offsetof(WeaponFullDef, weapDef.fHipSpreadFireAdd), CSPFT_FLOAT}, - {"hipSpreadTurnAdd", offsetof(WeaponFullDef, weapDef.fHipSpreadTurnAdd), CSPFT_FLOAT}, - {"hipSpreadMoveAdd", offsetof(WeaponFullDef, weapDef.fHipSpreadMoveAdd), CSPFT_FLOAT}, - {"hipSpreadDuckedDecay", offsetof(WeaponFullDef, weapDef.fHipSpreadDuckedDecay), CSPFT_FLOAT}, - {"hipSpreadProneDecay", offsetof(WeaponFullDef, weapDef.fHipSpreadProneDecay), CSPFT_FLOAT}, - {"hipReticleSidePos", offsetof(WeaponFullDef, weapDef.fHipReticleSidePos), CSPFT_FLOAT}, - {"hipIdleAmount", offsetof(WeaponFullDef, weapDef.fHipIdleAmount), CSPFT_FLOAT}, - {"hipIdleSpeed", offsetof(WeaponFullDef, weapDef.hipIdleSpeed), CSPFT_FLOAT}, - {"hipGunKickReducedKickBullets", offsetof(WeaponFullDef, weapDef.hipGunKickReducedKickBullets), CSPFT_INT}, - {"hipGunKickReducedKickPercent", offsetof(WeaponFullDef, weapDef.hipGunKickReducedKickPercent), CSPFT_FLOAT}, - {"hipGunKickPitchMin", offsetof(WeaponFullDef, weapDef.fHipGunKickPitchMin), CSPFT_FLOAT}, - {"hipGunKickPitchMax", offsetof(WeaponFullDef, weapDef.fHipGunKickPitchMax), CSPFT_FLOAT}, - {"hipGunKickYawMin", offsetof(WeaponFullDef, weapDef.fHipGunKickYawMin), CSPFT_FLOAT}, - {"hipGunKickYawMax", offsetof(WeaponFullDef, weapDef.fHipGunKickYawMax), CSPFT_FLOAT}, - {"hipGunKickAccel", offsetof(WeaponFullDef, weapDef.fHipGunKickAccel), CSPFT_FLOAT}, - {"hipGunKickSpeedMax", offsetof(WeaponFullDef, weapDef.fHipGunKickSpeedMax), CSPFT_FLOAT}, - {"hipGunKickSpeedDecay", offsetof(WeaponFullDef, weapDef.fHipGunKickSpeedDecay), CSPFT_FLOAT}, - {"hipGunKickStaticDecay", offsetof(WeaponFullDef, weapDef.fHipGunKickStaticDecay), CSPFT_FLOAT}, - {"hipViewKickPitchMin", offsetof(WeaponFullDef, weapDef.fHipViewKickPitchMin), CSPFT_FLOAT}, - {"hipViewKickPitchMax", offsetof(WeaponFullDef, weapDef.fHipViewKickPitchMax), CSPFT_FLOAT}, - {"hipViewKickMinMagnitude", offsetof(WeaponFullDef, weapDef.fHipViewKickMinMagnitude), CSPFT_FLOAT}, - {"hipViewKickYawMin", offsetof(WeaponFullDef, weapDef.fHipViewKickYawMin), CSPFT_FLOAT}, - {"hipViewKickYawMax", offsetof(WeaponFullDef, weapDef.fHipViewKickYawMax), CSPFT_FLOAT}, - {"hipViewKickCenterSpeed", offsetof(WeaponFullDef, weapVariantDef.fHipViewKickCenterSpeed), CSPFT_FLOAT}, - {"leftArc", offsetof(WeaponFullDef, weapDef.leftArc), CSPFT_FLOAT}, - {"rightArc", offsetof(WeaponFullDef, weapDef.rightArc), CSPFT_FLOAT}, - {"topArc", offsetof(WeaponFullDef, weapDef.topArc), CSPFT_FLOAT}, - {"bottomArc", offsetof(WeaponFullDef, weapDef.bottomArc), CSPFT_FLOAT}, - {"accuracy", offsetof(WeaponFullDef, weapDef.accuracy), CSPFT_FLOAT}, - {"aiSpread", offsetof(WeaponFullDef, weapDef.aiSpread), CSPFT_FLOAT}, - {"playerSpread", offsetof(WeaponFullDef, weapDef.playerSpread), CSPFT_FLOAT}, - {"maxVertTurnSpeed", offsetof(WeaponFullDef, weapDef.maxTurnSpeed[0]), CSPFT_FLOAT}, - {"maxHorTurnSpeed", offsetof(WeaponFullDef, weapDef.maxTurnSpeed[1]), CSPFT_FLOAT}, - {"minVertTurnSpeed", offsetof(WeaponFullDef, weapDef.minTurnSpeed[0]), CSPFT_FLOAT}, - {"minHorTurnSpeed", offsetof(WeaponFullDef, weapDef.minTurnSpeed[1]), CSPFT_FLOAT}, - {"pitchConvergenceTime", offsetof(WeaponFullDef, weapDef.pitchConvergenceTime), CSPFT_FLOAT}, - {"yawConvergenceTime", offsetof(WeaponFullDef, weapDef.yawConvergenceTime), CSPFT_FLOAT}, - {"suppressionTime", offsetof(WeaponFullDef, weapDef.suppressTime), CSPFT_FLOAT}, - {"maxRange", offsetof(WeaponFullDef, weapDef.maxRange), CSPFT_FLOAT}, - {"animHorRotateInc", offsetof(WeaponFullDef, weapDef.fAnimHorRotateInc), CSPFT_FLOAT}, - {"playerPositionDist", offsetof(WeaponFullDef, weapDef.fPlayerPositionDist), CSPFT_FLOAT}, - {"stance", offsetof(WeaponFullDef, weapDef.stance), WFT_STANCE}, - {"useHintString", offsetof(WeaponFullDef, weapDef.szUseHintString), CSPFT_STRING}, - {"dropHintString", offsetof(WeaponFullDef, weapDef.dropHintString), CSPFT_STRING}, - {"horizViewJitter", offsetof(WeaponFullDef, weapDef.horizViewJitter), CSPFT_FLOAT}, - {"vertViewJitter", offsetof(WeaponFullDef, weapDef.vertViewJitter), CSPFT_FLOAT}, - {"cameraShakeScale", offsetof(WeaponFullDef, weapDef.cameraShakeScale), CSPFT_FLOAT}, - {"cameraShakeDuration", offsetof(WeaponFullDef, weapDef.cameraShakeDuration), CSPFT_INT}, - {"cameraShakeRadius", offsetof(WeaponFullDef, weapDef.cameraShakeRadius), CSPFT_INT}, - {"explosionCameraShakeScale", offsetof(WeaponFullDef, weapDef.explosionCameraShakeScale), CSPFT_FLOAT}, - {"explosionCameraShakeDuration", offsetof(WeaponFullDef, weapDef.explosionCameraShakeDuration), CSPFT_INT}, - {"explosionCameraShakeRadius", offsetof(WeaponFullDef, weapDef.explosionCameraShakeRadius), CSPFT_INT}, - {"fightDist", offsetof(WeaponFullDef, weapDef.fightDist), CSPFT_FLOAT}, - {"maxDist", offsetof(WeaponFullDef, weapDef.maxDist), CSPFT_FLOAT}, - {"aiVsAiAccuracyGraph", offsetof(WeaponFullDef, weapDef.accuracyGraphName0), CSPFT_STRING}, - {"aiVsPlayerAccuracyGraph", offsetof(WeaponFullDef, weapDef.accuracyGraphName1), CSPFT_STRING}, - {"locNone", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_NONE]), CSPFT_FLOAT}, - {"locHelmet", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_HELMET]), CSPFT_FLOAT}, - {"locHead", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_HEAD]), CSPFT_FLOAT}, - {"locNeck", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_NECK]), CSPFT_FLOAT}, - {"locTorsoUpper", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_TORSO_UPR]), CSPFT_FLOAT}, - {"locTorsoMid", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_TORSO_MID]), CSPFT_FLOAT}, - {"locTorsoLower", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_TORSO_LWR]), CSPFT_FLOAT}, - {"locRightArmUpper", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_R_ARM_UPR]), CSPFT_FLOAT}, - {"locRightArmLower", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_R_ARM_LWR]), CSPFT_FLOAT}, - {"locRightHand", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_R_HAND]), CSPFT_FLOAT}, - {"locLeftArmUpper", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_L_ARM_UPR]), CSPFT_FLOAT}, - {"locLeftArmLower", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_L_ARM_LWR]), CSPFT_FLOAT}, - {"locLeftHand", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_L_HAND]), CSPFT_FLOAT}, - {"locRightLegUpper", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_R_LEG_UPR]), CSPFT_FLOAT}, - {"locRightLegLower", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_R_LEG_LWR]), CSPFT_FLOAT}, - {"locRightFoot", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_R_FOOT]), CSPFT_FLOAT}, - {"locLeftLegUpper", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_L_LEG_UPR]), CSPFT_FLOAT}, - {"locLeftLegLower", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_L_LEG_LWR]), CSPFT_FLOAT}, - {"locLeftFoot", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_L_FOOT]), CSPFT_FLOAT}, - {"locGun", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_GUN]), CSPFT_FLOAT}, - {"fireRumble", offsetof(WeaponFullDef, weapDef.fireRumble), CSPFT_STRING}, - {"meleeImpactRumble", offsetof(WeaponFullDef, weapDef.meleeImpactRumble), CSPFT_STRING}, - {"reloadRumble", offsetof(WeaponFullDef, weapDef.reloadRumble), CSPFT_STRING}, - {"explosionRumble", offsetof(WeaponFullDef, weapDef.explosionRumble), CSPFT_STRING}, - {"tracerType", offsetof(WeaponFullDef, weapDef.tracerType), CSPFT_TRACER}, - {"enemyTracerType", offsetof(WeaponFullDef, weapDef.enemyTracerType), CSPFT_TRACER}, - {"adsDofStart", offsetof(WeaponFullDef, weapDef.adsDofStart), CSPFT_FLOAT}, - {"adsDofEnd", offsetof(WeaponFullDef, weapDef.adsDofEnd), CSPFT_FLOAT}, - {"scanSpeed", offsetof(WeaponFullDef, weapDef.scanSpeed), CSPFT_FLOAT}, - {"scanAccel", offsetof(WeaponFullDef, weapDef.scanAccel), CSPFT_FLOAT}, - {"scanPauseTime", offsetof(WeaponFullDef, weapDef.scanPauseTime), CSPFT_MILLISECONDS}, - {"flameTableFirstPerson", offsetof(WeaponFullDef, weapDef.flameTableFirstPerson), CSPFT_STRING}, - {"flameTableThirdPerson", offsetof(WeaponFullDef, weapDef.flameTableThirdPerson), CSPFT_STRING}, - {"mmsWeapon", offsetof(WeaponFullDef, weapVariantDef.mmsWeapon), CSPFT_BOOL}, - {"mmsInScope", offsetof(WeaponFullDef, weapVariantDef.mmsInScope), CSPFT_BOOL}, - {"mmsFOV", offsetof(WeaponFullDef, weapVariantDef.mmsFOV), CSPFT_FLOAT}, - {"mmsAspect", offsetof(WeaponFullDef, weapVariantDef.mmsAspect), CSPFT_FLOAT}, - {"mmsMaxDist", offsetof(WeaponFullDef, weapVariantDef.mmsMaxDist), CSPFT_FLOAT}, - {"ikLeftHandIdlePosF", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandIdlePos.x), CSPFT_FLOAT}, - {"ikLeftHandIdlePosR", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandIdlePos.y), CSPFT_FLOAT}, - {"ikLeftHandIdlePosU", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandIdlePos.z), CSPFT_FLOAT}, - {"ikLeftHandOffsetF", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandOffset.x), CSPFT_FLOAT}, - {"ikLeftHandOffsetR", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandOffset.y), CSPFT_FLOAT}, - {"ikLeftHandOffsetU", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandOffset.z), CSPFT_FLOAT}, - {"ikLeftHandRotationP", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandRotation.x), CSPFT_FLOAT}, - {"ikLeftHandRotationY", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandRotation.y), CSPFT_FLOAT}, - {"ikLeftHandRotationR", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandRotation.z), CSPFT_FLOAT}, - {"usingLeftHandProneIK", offsetof(WeaponFullDef, weapVariantDef.bUsingLeftHandProneIK), CSPFT_BOOL}, - {"ikLeftHandProneOffsetF", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandProneOffset.x), CSPFT_FLOAT}, - {"ikLeftHandProneOffsetR", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandProneOffset.y), CSPFT_FLOAT}, - {"ikLeftHandProneOffsetU", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandProneOffset.z), CSPFT_FLOAT}, - {"ikLeftHandProneRotationP", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandProneRotation.x), CSPFT_FLOAT}, - {"ikLeftHandProneRotationY", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandProneRotation.y), CSPFT_FLOAT}, - {"ikLeftHandProneRotationR", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandProneRotation.z), CSPFT_FLOAT}, - {"ikLeftHandUiViewerOffsetF", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandUiViewerOffset.x), CSPFT_FLOAT}, - {"ikLeftHandUiViewerOffsetR", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandUiViewerOffset.y), CSPFT_FLOAT}, - {"ikLeftHandUiViewerOffsetU", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandUiViewerOffset.z), CSPFT_FLOAT}, - {"ikLeftHandUiViewerRotationP", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandUiViewerRotation.x), CSPFT_FLOAT}, - {"ikLeftHandUiViewerRotationY", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandUiViewerRotation.y), CSPFT_FLOAT}, - {"ikLeftHandUiViewerRotationR", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandUiViewerRotation.z), CSPFT_FLOAT}, - {"parentWeaponName", offsetof(WeaponFullDef, weapDef.parentWeaponName), CSPFT_STRING}, - {"doGibbing", offsetof(WeaponFullDef, weapDef.doGibbing), CSPFT_BOOL}, - {"maxGibDistance", offsetof(WeaponFullDef, weapDef.maxGibDistance), CSPFT_FLOAT}, - {"altScopeADSTransInTime", offsetof(WeaponFullDef, weapDef.altScopeADSTransInTime), CSPFT_FLOAT}, - {"altScopeADSTransOutTime", offsetof(WeaponFullDef, weapDef.altScopeADSTransOutTime), CSPFT_FLOAT}, - {"meleeSwipeEffect", offsetof(WeaponFullDef, weapDef.meleeSwipeEffect), CSPFT_FX}, - {"meleeImpactEffect", offsetof(WeaponFullDef, weapDef.meleeImpactEffect), CSPFT_FX}, - {"meleeImpactNoBloodEffect", offsetof(WeaponFullDef, weapDef.meleeImpactNoBloodEffect), CSPFT_FX}, - {"throwBackType", offsetof(WeaponFullDef, weapDef.throwBackType), CSPFT_STRING}, - {"camo", offsetof(WeaponFullDef, weapDef.weaponCamo), WFT_WEAPON_CAMO}, - {"customFloat0", offsetof(WeaponFullDef, weapDef.customFloat0), CSPFT_FLOAT}, - {"customFloat1", offsetof(WeaponFullDef, weapDef.customFloat1), CSPFT_FLOAT}, - {"customFloat2", offsetof(WeaponFullDef, weapDef.customFloat2), CSPFT_FLOAT}, - {"customBool0", offsetof(WeaponFullDef, weapDef.customBool0), CSPFT_BOOL}, - {"customBool1", offsetof(WeaponFullDef, weapDef.customBool1), CSPFT_BOOL}, - {"customBool2", offsetof(WeaponFullDef, weapDef.customBool2), CSPFT_BOOL}, - {"attachments", offsetof(WeaponFullDef, attachments), WFT_ATTACHMENTS}, - {"attachmentUniques", offsetof(WeaponFullDef, attachmentUniques), WFT_ATTACHMENT_UNIQUES} + inline cspField_t weapon_fields[]{ + {"displayName", offsetof(WeaponFullDef, weapVariantDef.szDisplayName), CSPFT_STRING }, + {"AIOverlayDescription", offsetof(WeaponFullDef, weapDef.szOverlayName), CSPFT_STRING }, + {"modeName", offsetof(WeaponFullDef, weapDef.szModeName), CSPFT_STRING }, + {"playerAnimType", offsetof(WeaponFullDef, weapDef.playerAnimType), WFT_ANIMTYPE }, + {"gunModel", offsetof(WeaponFullDef, gunXModel[0]), CSPFT_XMODEL }, + {"gunModel2", offsetof(WeaponFullDef, gunXModel[1]), CSPFT_XMODEL }, + {"gunModel3", offsetof(WeaponFullDef, gunXModel[2]), CSPFT_XMODEL }, + {"gunModel4", offsetof(WeaponFullDef, gunXModel[3]), CSPFT_XMODEL }, + {"gunModel5", offsetof(WeaponFullDef, gunXModel[4]), CSPFT_XMODEL }, + {"gunModel6", offsetof(WeaponFullDef, gunXModel[5]), CSPFT_XMODEL }, + {"gunModel7", offsetof(WeaponFullDef, gunXModel[6]), CSPFT_XMODEL }, + {"gunModel8", offsetof(WeaponFullDef, gunXModel[7]), CSPFT_XMODEL }, + {"gunModel9", offsetof(WeaponFullDef, gunXModel[8]), CSPFT_XMODEL }, + {"gunModel10", offsetof(WeaponFullDef, gunXModel[9]), CSPFT_XMODEL }, + {"gunModel11", offsetof(WeaponFullDef, gunXModel[10]), CSPFT_XMODEL }, + {"gunModel12", offsetof(WeaponFullDef, gunXModel[11]), CSPFT_XMODEL }, + {"gunModel13", offsetof(WeaponFullDef, gunXModel[12]), CSPFT_XMODEL }, + {"gunModel14", offsetof(WeaponFullDef, gunXModel[13]), CSPFT_XMODEL }, + {"gunModel15", offsetof(WeaponFullDef, gunXModel[14]), CSPFT_XMODEL }, + {"gunModel16", offsetof(WeaponFullDef, gunXModel[15]), CSPFT_XMODEL }, + {"handModel", offsetof(WeaponFullDef, weapDef.handXModel), CSPFT_XMODEL }, + {"hideTags", offsetof(WeaponFullDef, hideTags), WFT_HIDETAGS }, + {"notetrackSoundMap", offsetof(WeaponFullDef, notetrackSoundMapKeys), WFT_NOTETRACKSOUNDMAP }, + {"idleAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_IDLE]), CSPFT_STRING }, + {"idleAnimLeft", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_IDLE_LEFT]), CSPFT_STRING }, + {"emptyIdleAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_EMPTY_IDLE]), CSPFT_STRING }, + {"emptyIdleAnimLeft", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_EMPTY_IDLE_LEFT]), CSPFT_STRING }, + {"fireIntroAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_FIRE_INTRO]), CSPFT_STRING }, + {"fireAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_FIRE]), CSPFT_STRING }, + {"fireAnimLeft", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_FIRE_LEFT]), CSPFT_STRING }, + {"holdFireAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_HOLD_FIRE]), CSPFT_STRING }, + {"lastShotAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_LASTSHOT]), CSPFT_STRING }, + {"lastShotAnimLeft", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_LASTSHOT_LEFT]), CSPFT_STRING }, + {"flourishAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_FINALSHOT]), CSPFT_STRING }, + {"flourishAnimLeft", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_FINALSHOT_LEFT]), CSPFT_STRING }, + {"detonateAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_DETONATE]), CSPFT_STRING }, + {"rechamberAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RECHAMBER]), CSPFT_STRING }, + {"meleeAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_MELEE]), CSPFT_STRING }, + {"meleeAnimEmpty", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_MELEE_EMPTY]), CSPFT_STRING }, + {"meleeAnim1", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_MELEE1]), CSPFT_STRING }, + {"meleeAnim2", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_MELEE2]), CSPFT_STRING }, + {"meleeAnim3", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_MELEE3]), CSPFT_STRING }, + {"meleeChargeAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_MELEE_CHARGE]), CSPFT_STRING }, + {"meleeChargeAnimEmpty", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_MELEE_CHARGE_EMPTY]), CSPFT_STRING }, + {"reloadAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD]), CSPFT_STRING }, + {"reloadAnimRight", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD_RIGHT]), CSPFT_STRING }, + {"reloadAnimLeft", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD_LEFT]), CSPFT_STRING }, + {"reloadEmptyAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD_EMPTY]), CSPFT_STRING }, + {"reloadEmptyAnimLeft", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD_EMPTY_LEFT]), CSPFT_STRING }, + {"reloadStartAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD_START]), CSPFT_STRING }, + {"reloadEndAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD_END]), CSPFT_STRING }, + {"reloadQuickAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD_QUICK]), CSPFT_STRING }, + {"reloadQuickEmptyAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RELOAD_QUICK_EMPTY]), CSPFT_STRING }, + {"raiseAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_RAISE]), CSPFT_STRING }, + {"dropAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_DROP]), CSPFT_STRING }, + {"firstRaiseAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_FIRST_RAISE]), CSPFT_STRING }, + {"altRaiseAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ALT_RAISE]), CSPFT_STRING }, + {"altDropAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ALT_DROP]), CSPFT_STRING }, + {"quickRaiseAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_QUICK_RAISE]), CSPFT_STRING }, + {"quickDropAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_QUICK_DROP]), CSPFT_STRING }, + {"emptyRaiseAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_EMPTY_RAISE]), CSPFT_STRING }, + {"emptyDropAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_EMPTY_DROP]), CSPFT_STRING }, + {"sprintInAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_SPRINT_IN]), CSPFT_STRING }, + {"sprintLoopAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_SPRINT_LOOP]), CSPFT_STRING }, + {"sprintOutAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_SPRINT_OUT]), CSPFT_STRING }, + {"sprintInEmptyAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_SPRINT_EMPTY_IN]), CSPFT_STRING }, + {"sprintLoopEmptyAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_SPRINT_EMPTY_LOOP]), CSPFT_STRING }, + {"sprintOutEmptyAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_SPRINT_EMPTY_OUT]), CSPFT_STRING }, + {"lowReadyInAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_LOWREADY_IN]), CSPFT_STRING }, + {"lowReadyLoopAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_LOWREADY_LOOP]), CSPFT_STRING }, + {"lowReadyOutAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_LOWREADY_OUT]), CSPFT_STRING }, + {"contFireInAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CONT_FIRE_IN]), CSPFT_STRING }, + {"contFireLoopAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CONT_FIRE_LOOP]), CSPFT_STRING }, + {"contFireOutAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CONT_FIRE_OUT]), CSPFT_STRING }, + {"crawlInAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CRAWL_IN]), CSPFT_STRING }, + {"crawlForwardAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CRAWL_FORWARD]), CSPFT_STRING }, + {"crawlBackAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CRAWL_BACK]), CSPFT_STRING }, + {"crawlRightAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CRAWL_RIGHT]), CSPFT_STRING }, + {"crawlLeftAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CRAWL_LEFT]), CSPFT_STRING }, + {"crawlOutAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CRAWL_OUT]), CSPFT_STRING }, + {"crawlEmptyInAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CRAWL_EMPTY_IN]), CSPFT_STRING }, + {"crawlEmptyForwardAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CRAWL_EMPTY_FORWARD]), CSPFT_STRING }, + {"crawlEmptyBackAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CRAWL_EMPTY_BACK]), CSPFT_STRING }, + {"crawlEmptyRightAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CRAWL_EMPTY_RIGHT]), CSPFT_STRING }, + {"crawlEmptyLeftAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CRAWL_EMPTY_LEFT]), CSPFT_STRING }, + {"crawlEmptyOutAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CRAWL_EMPTY_OUT]), CSPFT_STRING }, + {"deployAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_DEPLOY]), CSPFT_STRING }, + {"nightVisionWearAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_NIGHTVISION_WEAR]), CSPFT_STRING }, + {"nightVisionRemoveAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_NIGHTVISION_REMOVE]), CSPFT_STRING }, + {"adsFireAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ADS_FIRE]), CSPFT_STRING }, + {"adsLastShotAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ADS_LASTSHOT]), CSPFT_STRING }, + {"adsRechamberAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ADS_RECHAMBER]), CSPFT_STRING }, + {"adsUpAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ADS_UP]), CSPFT_STRING }, + {"adsDownAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ADS_DOWN]), CSPFT_STRING }, + {"adsUpOtherScopeAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ADS_UP_OTHER_SCOPE]), CSPFT_STRING }, + {"adsFireIntroAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_ADS_FIRE_INTRO]), CSPFT_STRING }, + {"breakdownAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_BREAKDOWN]), CSPFT_STRING }, + {"dtp_in", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_DTP_IN]), CSPFT_STRING }, + {"dtp_loop", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_DTP_LOOP]), CSPFT_STRING }, + {"dtp_out", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_DTP_OUT]), CSPFT_STRING }, + {"dtp_empty_in", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_DTP_EMPTY_IN]), CSPFT_STRING }, + {"dtp_empty_loop", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_DTP_EMPTY_LOOP]), CSPFT_STRING }, + {"dtp_empty_out", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_DTP_EMPTY_OUT]), CSPFT_STRING }, + {"slide_in", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_SLIDE_IN]), CSPFT_STRING }, + {"mantleAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_MANTLE]), CSPFT_STRING }, + {"sprintCameraAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CAMERA_SPRINT_LOOP]), CSPFT_STRING }, + {"dtpInCameraAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CAMERA_DTP_IN]), CSPFT_STRING }, + {"dtpLoopCameraAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CAMERA_DTP_LOOP]), CSPFT_STRING }, + {"dtpOutCameraAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CAMERA_DTP_OUT]), CSPFT_STRING }, + {"mantleCameraAnim", offsetof(WeaponFullDef, szXAnims[WEAP_ANIM_CAMERA_MANTLE]), CSPFT_STRING }, + {"script", offsetof(WeaponFullDef, weapDef.szScript), CSPFT_STRING }, + {"weaponType", offsetof(WeaponFullDef, weapDef.weapType), WFT_WEAPONTYPE }, + {"weaponClass", offsetof(WeaponFullDef, weapDef.weapClass), WFT_WEAPONCLASS }, + {"penetrateType", offsetof(WeaponFullDef, weapDef.penetrateTWeaponAttachmentype), WFT_PENETRATE_TYPE }, + {"impactType", offsetof(WeaponFullDef, weapDef.impactType), WFT_IMPACT_TYPE }, + {"inventoryType", offsetof(WeaponFullDef, weapDef.inventoryType), WFT_INVENTORYTYPE }, + {"fireType", offsetof(WeaponFullDef, weapDef.fireType), WFT_FIRETYPE }, + {"clipType", offsetof(WeaponFullDef, weapDef.clipType), WFT_CLIPTYPE }, + {"barrelType", offsetof(WeaponFullDef, weapDef.barrelType), WFT_BARRELTYPE }, + {"offhandClass", offsetof(WeaponFullDef, weapDef.offhandClass), WFT_OFFHAND_CLASS }, + {"offhandSlot", offsetof(WeaponFullDef, weapDef.offhandSlot), WFT_OFFHAND_SLOT }, + {"viewFlashEffect", offsetof(WeaponFullDef, weapDef.viewFlashEffect), CSPFT_FX }, + {"worldFlashEffect", offsetof(WeaponFullDef, weapDef.worldFlashEffect), CSPFT_FX }, + {"barrelCooldownEffect", offsetof(WeaponFullDef, weapDef.barrelCooldownEffect), CSPFT_FX }, + {"barrelCooldownMinCount", offsetof(WeaponFullDef, weapDef.barrelCooldownMinCount), CSPFT_INT }, + {"viewFlashOffsetF", offsetof(WeaponFullDef, weapDef.vViewFlashOffset.x), CSPFT_FLOAT }, + {"viewFlashOffsetR", offsetof(WeaponFullDef, weapDef.vViewFlashOffset.y), CSPFT_FLOAT }, + {"viewFlashOffsetU", offsetof(WeaponFullDef, weapDef.vViewFlashOffset.z), CSPFT_FLOAT }, + {"worldFlashOffsetF", offsetof(WeaponFullDef, weapDef.vWorldFlashOffset.x), CSPFT_FLOAT }, + {"worldFlashOffsetR", offsetof(WeaponFullDef, weapDef.vWorldFlashOffset.y), CSPFT_FLOAT }, + {"worldFlashOffsetU", offsetof(WeaponFullDef, weapDef.vWorldFlashOffset.z), CSPFT_FLOAT }, + {"pickupSound", offsetof(WeaponFullDef, weapDef.pickupSound), CSPFT_STRING }, + {"pickupSoundPlayer", offsetof(WeaponFullDef, weapDef.pickupSoundPlayer), CSPFT_STRING }, + {"ammoPickupSound", offsetof(WeaponFullDef, weapDef.ammoPickupSound), CSPFT_STRING }, + {"ammoPickupSoundPlayer", offsetof(WeaponFullDef, weapDef.ammoPickupSoundPlayer), CSPFT_STRING }, + {"projectileSound", offsetof(WeaponFullDef, weapDef.projectileSound), CSPFT_STRING }, + {"pullbackSound", offsetof(WeaponFullDef, weapDef.pullbackSound), CSPFT_STRING }, + {"pullbackSoundPlayer", offsetof(WeaponFullDef, weapDef.pullbackSoundPlayer), CSPFT_STRING }, + {"fireSound", offsetof(WeaponFullDef, weapDef.fireSound), CSPFT_STRING }, + {"crackSound", offsetof(WeaponFullDef, weapDef.crackSound), CSPFT_STRING }, + {"whizbySound", offsetof(WeaponFullDef, weapDef.whizbySound), CSPFT_STRING }, + {"fireSoundPlayer", offsetof(WeaponFullDef, weapDef.fireSoundPlayer), CSPFT_STRING }, + {"loopFireSound", offsetof(WeaponFullDef, weapDef.fireLoopSound), CSPFT_STRING }, + {"loopFireSoundPlayer", offsetof(WeaponFullDef, weapDef.fireLoopSoundPlayer), CSPFT_STRING }, + {"loopFireEndSound", offsetof(WeaponFullDef, weapDef.fireLoopEndSound), CSPFT_STRING }, + {"loopFireEndSoundPlayer", offsetof(WeaponFullDef, weapDef.fireLoopEndSoundPlayer), CSPFT_STRING }, + {"startFireSound", offsetof(WeaponFullDef, weapDef.fireStartSound), CSPFT_STRING }, + {"stopFireSound", offsetof(WeaponFullDef, weapDef.fireStopSound), CSPFT_STRING }, + {"killcamStartFireSound", offsetof(WeaponFullDef, weapDef.fireKillcamSound), CSPFT_STRING }, + {"startFireSoundPlayer", offsetof(WeaponFullDef, weapDef.fireStartSoundPlayer), CSPFT_STRING }, + {"stopFireSoundPlayer", offsetof(WeaponFullDef, weapDef.fireStopSoundPlayer), CSPFT_STRING }, + {"killcamStartFireSoundPlayer", offsetof(WeaponFullDef, weapDef.fireKillcamSoundPlayer), CSPFT_STRING }, + {"lastShotSound", offsetof(WeaponFullDef, weapDef.fireLastSound), CSPFT_STRING }, + {"lastShotSoundPlayer", offsetof(WeaponFullDef, weapDef.fireLastSoundPlayer), CSPFT_STRING }, + {"emptyFireSound", offsetof(WeaponFullDef, weapDef.emptyFireSound), CSPFT_STRING }, + {"emptyFireSoundPlayer", offsetof(WeaponFullDef, weapDef.emptyFireSoundPlayer), CSPFT_STRING }, + {"meleeSwipeSound", offsetof(WeaponFullDef, weapDef.meleeSwipeSound), CSPFT_STRING }, + {"meleeSwipeSoundPlayer", offsetof(WeaponFullDef, weapDef.meleeSwipeSoundPlayer), CSPFT_STRING }, + {"meleeHitSound", offsetof(WeaponFullDef, weapDef.meleeHitSound), CSPFT_STRING }, + {"meleeMissSound", offsetof(WeaponFullDef, weapDef.meleeMissSound), CSPFT_STRING }, + {"rechamberSound", offsetof(WeaponFullDef, weapDef.rechamberSound), CSPFT_STRING }, + {"rechamberSoundPlayer", offsetof(WeaponFullDef, weapDef.rechamberSoundPlayer), CSPFT_STRING }, + {"reloadSound", offsetof(WeaponFullDef, weapDef.reloadSound), CSPFT_STRING }, + {"reloadSoundPlayer", offsetof(WeaponFullDef, weapDef.reloadSoundPlayer), CSPFT_STRING }, + {"reloadEmptySound", offsetof(WeaponFullDef, weapDef.reloadEmptySound), CSPFT_STRING }, + {"reloadEmptySoundPlayer", offsetof(WeaponFullDef, weapDef.reloadEmptySoundPlayer), CSPFT_STRING }, + {"reloadStartSound", offsetof(WeaponFullDef, weapDef.reloadStartSound), CSPFT_STRING }, + {"reloadStartSoundPlayer", offsetof(WeaponFullDef, weapDef.reloadStartSoundPlayer), CSPFT_STRING }, + {"reloadEndSound", offsetof(WeaponFullDef, weapDef.reloadEndSound), CSPFT_STRING }, + {"reloadEndSoundPlayer", offsetof(WeaponFullDef, weapDef.reloadEndSoundPlayer), CSPFT_STRING }, + {"rotateLoopSound", offsetof(WeaponFullDef, weapDef.rotateLoopSound), CSPFT_STRING }, + {"rotateLoopSoundPlayer", offsetof(WeaponFullDef, weapDef.rotateLoopSoundPlayer), CSPFT_STRING }, + {"rotateStopSound", offsetof(WeaponFullDef, weapDef.rotateStopSound), CSPFT_STRING }, + {"rotateStopSoundPlayer", offsetof(WeaponFullDef, weapDef.rotateStopSoundPlayer), CSPFT_STRING }, + {"deploySound", offsetof(WeaponFullDef, weapDef.deploySound), CSPFT_STRING }, + {"deploySoundPlayer", offsetof(WeaponFullDef, weapDef.deploySoundPlayer), CSPFT_STRING }, + {"finishDeploySound", offsetof(WeaponFullDef, weapDef.finishDeploySound), CSPFT_STRING }, + {"finishDeploySoundPlayer", offsetof(WeaponFullDef, weapDef.finishDeploySoundPlayer), CSPFT_STRING }, + {"breakdownSound", offsetof(WeaponFullDef, weapDef.breakdownSound), CSPFT_STRING }, + {"breakdownSoundPlayer", offsetof(WeaponFullDef, weapDef.breakdownSoundPlayer), CSPFT_STRING }, + {"finishBreakdownSound", offsetof(WeaponFullDef, weapDef.finishBreakdownSound), CSPFT_STRING }, + {"finishBreakdownSoundPlayer", offsetof(WeaponFullDef, weapDef.finishBreakdownSoundPlayer), CSPFT_STRING }, + {"detonateSound", offsetof(WeaponFullDef, weapDef.detonateSound), CSPFT_STRING }, + {"detonateSoundPlayer", offsetof(WeaponFullDef, weapDef.detonateSoundPlayer), CSPFT_STRING }, + {"nightVisionWearSound", offsetof(WeaponFullDef, weapDef.nightVisionWearSound), CSPFT_STRING }, + {"nightVisionWearSoundPlayer", offsetof(WeaponFullDef, weapDef.nightVisionWearSoundPlayer), CSPFT_STRING }, + {"nightVisionRemoveSound", offsetof(WeaponFullDef, weapDef.nightVisionRemoveSound), CSPFT_STRING }, + {"nightVisionRemoveSoundPlayer", offsetof(WeaponFullDef, weapDef.nightVisionRemoveSoundPlayer), CSPFT_STRING }, + {"raiseSound", offsetof(WeaponFullDef, weapDef.raiseSound), CSPFT_STRING }, + {"raiseSoundPlayer", offsetof(WeaponFullDef, weapDef.raiseSoundPlayer), CSPFT_STRING }, + {"firstRaiseSound", offsetof(WeaponFullDef, weapDef.firstRaiseSound), CSPFT_STRING }, + {"firstRaiseSoundPlayer", offsetof(WeaponFullDef, weapDef.firstRaiseSoundPlayer), CSPFT_STRING }, + {"altSwitchSound", offsetof(WeaponFullDef, weapDef.altSwitchSound), CSPFT_STRING }, + {"altSwitchSoundPlayer", offsetof(WeaponFullDef, weapDef.altSwitchSoundPlayer), CSPFT_STRING }, + {"adsRaiseSoundPlayer", offsetof(WeaponFullDef, weapDef.adsRaiseSoundPlayer), CSPFT_STRING }, + {"adsLowerSoundPlayer", offsetof(WeaponFullDef, weapDef.adsLowerSoundPlayer), CSPFT_STRING }, + {"putawaySound", offsetof(WeaponFullDef, weapDef.putawaySound), CSPFT_STRING }, + {"putawaySoundPlayer", offsetof(WeaponFullDef, weapDef.putawaySoundPlayer), CSPFT_STRING }, + {"overheatSound", offsetof(WeaponFullDef, weapDef.overheatSound), CSPFT_STRING }, + {"overheatSoundPlayer", offsetof(WeaponFullDef, weapDef.overheatSoundPlayer), CSPFT_STRING }, + {"adsZoomSound", offsetof(WeaponFullDef, weapDef.adsZoomSound), CSPFT_STRING }, + {"shellCasing", offsetof(WeaponFullDef, weapDef.shellCasing), CSPFT_STRING }, + {"shellCasingPlayer", offsetof(WeaponFullDef, weapDef.shellCasingPlayer), CSPFT_STRING }, + {"bounceSound", offsetof(WeaponFullDef, weapDef.bounceSound), WFT_BOUNCE_SOUND }, + {"standMountedWeapdef", offsetof(WeaponFullDef, weapDef.standMountedWeapdef), CSPFT_STRING }, + {"crouchMountedWeapdef", offsetof(WeaponFullDef, weapDef.crouchMountedWeapdef), CSPFT_STRING }, + {"proneMountedWeapdef", offsetof(WeaponFullDef, weapDef.proneMountedWeapdef), CSPFT_STRING }, + {"viewShellEjectEffect", offsetof(WeaponFullDef, weapDef.viewShellEjectEffect), CSPFT_FX }, + {"worldShellEjectEffect", offsetof(WeaponFullDef, weapDef.worldShellEjectEffect), CSPFT_FX }, + {"viewLastShotEjectEffect", offsetof(WeaponFullDef, weapDef.viewLastShotEjectEffect), CSPFT_FX }, + {"worldLastShotEjectEffect", offsetof(WeaponFullDef, weapDef.worldLastShotEjectEffect), CSPFT_FX }, + {"viewShellEjectOffsetF", offsetof(WeaponFullDef, weapDef.vViewShellEjectOffset.x), CSPFT_FLOAT }, + {"viewShellEjectOffsetR", offsetof(WeaponFullDef, weapDef.vViewShellEjectOffset.y), CSPFT_FLOAT }, + {"viewShellEjectOffsetU", offsetof(WeaponFullDef, weapDef.vViewShellEjectOffset.z), CSPFT_FLOAT }, + {"worldShellEjectOffsetF", offsetof(WeaponFullDef, weapDef.vWorldShellEjectOffset.x), CSPFT_FLOAT }, + {"worldShellEjectOffsetR", offsetof(WeaponFullDef, weapDef.vWorldShellEjectOffset.y), CSPFT_FLOAT }, + {"worldShellEjectOffsetU", offsetof(WeaponFullDef, weapDef.vWorldShellEjectOffset.z), CSPFT_FLOAT }, + {"viewShellEjectRotationP", offsetof(WeaponFullDef, weapDef.vViewShellEjectRotation.x), CSPFT_FLOAT }, + {"viewShellEjectRotationY", offsetof(WeaponFullDef, weapDef.vViewShellEjectRotation.y), CSPFT_FLOAT }, + {"viewShellEjectRotationR", offsetof(WeaponFullDef, weapDef.vViewShellEjectRotation.z), CSPFT_FLOAT }, + {"worldShellEjectRotationP", offsetof(WeaponFullDef, weapDef.vWorldShellEjectRotation.x), CSPFT_FLOAT }, + {"worldShellEjectRotationY", offsetof(WeaponFullDef, weapDef.vWorldShellEjectRotation.y), CSPFT_FLOAT }, + {"worldShellEjectRotationR", offsetof(WeaponFullDef, weapDef.vWorldShellEjectRotation.z), CSPFT_FLOAT }, + {"reticleCenter", offsetof(WeaponFullDef, weapDef.reticleCenter), CSPFT_MATERIAL }, + {"reticleSide", offsetof(WeaponFullDef, weapDef.reticleSide), CSPFT_MATERIAL }, + {"reticleCenterSize", offsetof(WeaponFullDef, weapDef.iReticleCenterSize), CSPFT_INT }, + {"reticleSideSize", offsetof(WeaponFullDef, weapDef.iReticleSideSize), CSPFT_INT }, + {"reticleMinOfs", offsetof(WeaponFullDef, weapDef.iReticleMinOfs), CSPFT_INT }, + {"activeReticleType", offsetof(WeaponFullDef, weapDef.activeReticleType), WFT_ACTIVE_RETICLE_TYPE }, + {"standMoveF", offsetof(WeaponFullDef, weapDef.vStandMove.x), CSPFT_FLOAT }, + {"standMoveR", offsetof(WeaponFullDef, weapDef.vStandMove.y), CSPFT_FLOAT }, + {"standMoveU", offsetof(WeaponFullDef, weapDef.vStandMove.z), CSPFT_FLOAT }, + {"standRotP", offsetof(WeaponFullDef, weapDef.vStandRot.x), CSPFT_FLOAT }, + {"standRotY", offsetof(WeaponFullDef, weapDef.vStandRot.y), CSPFT_FLOAT }, + {"standRotR", offsetof(WeaponFullDef, weapDef.vStandRot.z), CSPFT_FLOAT }, + {"duckedOfsF", offsetof(WeaponFullDef, weapDef.vDuckedOfs.x), CSPFT_FLOAT }, + {"duckedOfsR", offsetof(WeaponFullDef, weapDef.vDuckedOfs.y), CSPFT_FLOAT }, + {"duckedOfsU", offsetof(WeaponFullDef, weapDef.vDuckedOfs.z), CSPFT_FLOAT }, + {"duckedMoveF", offsetof(WeaponFullDef, weapDef.vDuckedMove.x), CSPFT_FLOAT }, + {"duckedMoveR", offsetof(WeaponFullDef, weapDef.vDuckedMove.y), CSPFT_FLOAT }, + {"duckedMoveU", offsetof(WeaponFullDef, weapDef.vDuckedMove.z), CSPFT_FLOAT }, + {"duckedSprintOfsF", offsetof(WeaponFullDef, weapDef.vDuckedSprintOfs.x), CSPFT_FLOAT }, + {"duckedSprintOfsR", offsetof(WeaponFullDef, weapDef.vDuckedSprintOfs.y), CSPFT_FLOAT }, + {"duckedSprintOfsU", offsetof(WeaponFullDef, weapDef.vDuckedSprintOfs.z), CSPFT_FLOAT }, + {"duckedSprintRotP", offsetof(WeaponFullDef, weapDef.vDuckedSprintRot.x), CSPFT_FLOAT }, + {"duckedSprintRotY", offsetof(WeaponFullDef, weapDef.vDuckedSprintRot.y), CSPFT_FLOAT }, + {"duckedSprintRotR", offsetof(WeaponFullDef, weapDef.vDuckedSprintRot.z), CSPFT_FLOAT }, + {"duckedSprintBobH", offsetof(WeaponFullDef, weapDef.vDuckedSprintBob.x), CSPFT_FLOAT }, + {"duckedSprintBobV", offsetof(WeaponFullDef, weapDef.vDuckedSprintBob.y), CSPFT_FLOAT }, + {"duckedSprintScale", offsetof(WeaponFullDef, weapDef.fDuckedSprintCycleScale), CSPFT_FLOAT }, + {"sprintOfsF", offsetof(WeaponFullDef, weapDef.vSprintOfs.x), CSPFT_FLOAT }, + {"sprintOfsR", offsetof(WeaponFullDef, weapDef.vSprintOfs.y), CSPFT_FLOAT }, + {"sprintOfsU", offsetof(WeaponFullDef, weapDef.vSprintOfs.z), CSPFT_FLOAT }, + {"sprintRotP", offsetof(WeaponFullDef, weapDef.vSprintRot.x), CSPFT_FLOAT }, + {"sprintRotY", offsetof(WeaponFullDef, weapDef.vSprintRot.y), CSPFT_FLOAT }, + {"sprintRotR", offsetof(WeaponFullDef, weapDef.vSprintRot.z), CSPFT_FLOAT }, + {"sprintBobH", offsetof(WeaponFullDef, weapDef.vSprintBob.x), CSPFT_FLOAT }, + {"sprintBobV", offsetof(WeaponFullDef, weapDef.vSprintBob.y), CSPFT_FLOAT }, + {"sprintScale", offsetof(WeaponFullDef, weapDef.fSprintCycleScale), CSPFT_FLOAT }, + {"lowReadyOfsF", offsetof(WeaponFullDef, weapDef.vLowReadyOfs.x), CSPFT_FLOAT }, + {"lowReadyOfsR", offsetof(WeaponFullDef, weapDef.vLowReadyOfs.y), CSPFT_FLOAT }, + {"lowReadyOfsU", offsetof(WeaponFullDef, weapDef.vLowReadyOfs.z), CSPFT_FLOAT }, + {"lowReadyRotP", offsetof(WeaponFullDef, weapDef.vLowReadyRot.x), CSPFT_FLOAT }, + {"lowReadyRotY", offsetof(WeaponFullDef, weapDef.vLowReadyRot.y), CSPFT_FLOAT }, + {"lowReadyRotR", offsetof(WeaponFullDef, weapDef.vLowReadyRot.z), CSPFT_FLOAT }, + {"rideOfsF", offsetof(WeaponFullDef, weapDef.vRideOfs.x), CSPFT_FLOAT }, + {"rideOfsR", offsetof(WeaponFullDef, weapDef.vRideOfs.y), CSPFT_FLOAT }, + {"rideOfsU", offsetof(WeaponFullDef, weapDef.vRideOfs.z), CSPFT_FLOAT }, + {"rideRotP", offsetof(WeaponFullDef, weapDef.vRideRot.x), CSPFT_FLOAT }, + {"rideRotY", offsetof(WeaponFullDef, weapDef.vRideRot.y), CSPFT_FLOAT }, + {"rideRotR", offsetof(WeaponFullDef, weapDef.vRideRot.z), CSPFT_FLOAT }, + {"dtpOfsF", offsetof(WeaponFullDef, weapDef.vDtpOfs.x), CSPFT_FLOAT }, + {"dtpOfsR", offsetof(WeaponFullDef, weapDef.vDtpOfs.y), CSPFT_FLOAT }, + {"dtpOfsU", offsetof(WeaponFullDef, weapDef.vDtpOfs.z), CSPFT_FLOAT }, + {"dtpRotP", offsetof(WeaponFullDef, weapDef.vDtpRot.x), CSPFT_FLOAT }, + {"dtpRotY", offsetof(WeaponFullDef, weapDef.vDtpRot.y), CSPFT_FLOAT }, + {"dtpRotR", offsetof(WeaponFullDef, weapDef.vDtpRot.z), CSPFT_FLOAT }, + {"dtpBobH", offsetof(WeaponFullDef, weapDef.vDtpBob.x), CSPFT_FLOAT }, + {"dtpBobV", offsetof(WeaponFullDef, weapDef.vDtpBob.y), CSPFT_FLOAT }, + {"dtpScale", offsetof(WeaponFullDef, weapDef.fDtpCycleScale), CSPFT_FLOAT }, + {"mantleOfsF", offsetof(WeaponFullDef, weapDef.vMantleOfs.x), CSPFT_FLOAT }, + {"mantleOfsR", offsetof(WeaponFullDef, weapDef.vMantleOfs.y), CSPFT_FLOAT }, + {"mantleOfsU", offsetof(WeaponFullDef, weapDef.vMantleOfs.z), CSPFT_FLOAT }, + {"mantleRotP", offsetof(WeaponFullDef, weapDef.vMantleRot.x), CSPFT_FLOAT }, + {"mantleRotY", offsetof(WeaponFullDef, weapDef.vMantleRot.y), CSPFT_FLOAT }, + {"mantleRotR", offsetof(WeaponFullDef, weapDef.vMantleRot.z), CSPFT_FLOAT }, + {"slideOfsF", offsetof(WeaponFullDef, weapDef.vSlideOfs.x), CSPFT_FLOAT }, + {"slideOfsR", offsetof(WeaponFullDef, weapDef.vSlideOfs.y), CSPFT_FLOAT }, + {"slideOfsU", offsetof(WeaponFullDef, weapDef.vSlideOfs.z), CSPFT_FLOAT }, + {"slideRotP", offsetof(WeaponFullDef, weapDef.vSlideRot.x), CSPFT_FLOAT }, + {"slideRotY", offsetof(WeaponFullDef, weapDef.vSlideRot.y), CSPFT_FLOAT }, + {"slideRotR", offsetof(WeaponFullDef, weapDef.vSlideRot.z), CSPFT_FLOAT }, + {"duckedRotP", offsetof(WeaponFullDef, weapDef.vDuckedRot.x), CSPFT_FLOAT }, + {"duckedRotY", offsetof(WeaponFullDef, weapDef.vDuckedRot.y), CSPFT_FLOAT }, + {"duckedRotR", offsetof(WeaponFullDef, weapDef.vDuckedRot.z), CSPFT_FLOAT }, + {"proneOfsF", offsetof(WeaponFullDef, weapDef.vProneOfs.x), CSPFT_FLOAT }, + {"proneOfsR", offsetof(WeaponFullDef, weapDef.vProneOfs.y), CSPFT_FLOAT }, + {"proneOfsU", offsetof(WeaponFullDef, weapDef.vProneOfs.z), CSPFT_FLOAT }, + {"proneMoveF", offsetof(WeaponFullDef, weapDef.vProneMove.x), CSPFT_FLOAT }, + {"proneMoveR", offsetof(WeaponFullDef, weapDef.vProneMove.y), CSPFT_FLOAT }, + {"proneMoveU", offsetof(WeaponFullDef, weapDef.vProneMove.z), CSPFT_FLOAT }, + {"proneRotP", offsetof(WeaponFullDef, weapDef.vProneRot.x), CSPFT_FLOAT }, + {"proneRotY", offsetof(WeaponFullDef, weapDef.vProneRot.y), CSPFT_FLOAT }, + {"proneRotR", offsetof(WeaponFullDef, weapDef.vProneRot.z), CSPFT_FLOAT }, + {"strafeMoveF", offsetof(WeaponFullDef, weapDef.vStrafeMove.x), CSPFT_FLOAT }, + {"strafeMoveR", offsetof(WeaponFullDef, weapDef.vStrafeMove.y), CSPFT_FLOAT }, + {"strafeMoveU", offsetof(WeaponFullDef, weapDef.vStrafeMove.z), CSPFT_FLOAT }, + {"strafeRotP", offsetof(WeaponFullDef, weapDef.vStrafeRot.x), CSPFT_FLOAT }, + {"strafeRotY", offsetof(WeaponFullDef, weapDef.vStrafeRot.y), CSPFT_FLOAT }, + {"strafeRotR", offsetof(WeaponFullDef, weapDef.vStrafeRot.z), CSPFT_FLOAT }, + {"posMoveRate", offsetof(WeaponFullDef, weapDef.fPosMoveRate), CSPFT_FLOAT }, + {"posProneMoveRate", offsetof(WeaponFullDef, weapDef.fPosProneMoveRate), CSPFT_FLOAT }, + {"standMoveMinSpeed", offsetof(WeaponFullDef, weapDef.fStandMoveMinSpeed), CSPFT_FLOAT }, + {"duckedMoveMinSpeed", offsetof(WeaponFullDef, weapDef.fDuckedMoveMinSpeed), CSPFT_FLOAT }, + {"proneMoveMinSpeed", offsetof(WeaponFullDef, weapDef.fProneMoveMinSpeed), CSPFT_FLOAT }, + {"posRotRate", offsetof(WeaponFullDef, weapDef.fPosRotRate), CSPFT_FLOAT }, + {"posProneRotRate", offsetof(WeaponFullDef, weapDef.fPosProneRotRate), CSPFT_FLOAT }, + {"standRotMinSpeed", offsetof(WeaponFullDef, weapDef.fStandRotMinSpeed), CSPFT_FLOAT }, + {"duckedRotMinSpeed", offsetof(WeaponFullDef, weapDef.fDuckedRotMinSpeed), CSPFT_FLOAT }, + {"proneRotMinSpeed", offsetof(WeaponFullDef, weapDef.fProneRotMinSpeed), CSPFT_FLOAT }, + {"worldModel", offsetof(WeaponFullDef, worldModel[0]), CSPFT_XMODEL }, + {"worldModel2", offsetof(WeaponFullDef, worldModel[1]), CSPFT_XMODEL }, + {"worldModel3", offsetof(WeaponFullDef, worldModel[2]), CSPFT_XMODEL }, + {"worldModel4", offsetof(WeaponFullDef, worldModel[3]), CSPFT_XMODEL }, + {"worldModel5", offsetof(WeaponFullDef, worldModel[4]), CSPFT_XMODEL }, + {"worldModel6", offsetof(WeaponFullDef, worldModel[5]), CSPFT_XMODEL }, + {"worldModel7", offsetof(WeaponFullDef, worldModel[6]), CSPFT_XMODEL }, + {"worldModel8", offsetof(WeaponFullDef, worldModel[7]), CSPFT_XMODEL }, + {"worldModel9", offsetof(WeaponFullDef, worldModel[8]), CSPFT_XMODEL }, + {"worldModel10", offsetof(WeaponFullDef, worldModel[9]), CSPFT_XMODEL }, + {"worldModel11", offsetof(WeaponFullDef, worldModel[10]), CSPFT_XMODEL }, + {"worldModel12", offsetof(WeaponFullDef, worldModel[11]), CSPFT_XMODEL }, + {"worldModel13", offsetof(WeaponFullDef, worldModel[12]), CSPFT_XMODEL }, + {"worldModel14", offsetof(WeaponFullDef, worldModel[13]), CSPFT_XMODEL }, + {"worldModel15", offsetof(WeaponFullDef, worldModel[14]), CSPFT_XMODEL }, + {"worldModel16", offsetof(WeaponFullDef, worldModel[15]), CSPFT_XMODEL }, + {"attachViewModel1", offsetof(WeaponFullDef, attachViewModel[0]), CSPFT_XMODEL }, + {"attachViewModel2", offsetof(WeaponFullDef, attachViewModel[1]), CSPFT_XMODEL }, + {"attachViewModel3", offsetof(WeaponFullDef, attachViewModel[2]), CSPFT_XMODEL }, + {"attachViewModel4", offsetof(WeaponFullDef, attachViewModel[3]), CSPFT_XMODEL }, + {"attachViewModel5", offsetof(WeaponFullDef, attachViewModel[4]), CSPFT_XMODEL }, + {"attachViewModel6", offsetof(WeaponFullDef, attachViewModel[5]), CSPFT_XMODEL }, + {"attachViewModel7", offsetof(WeaponFullDef, attachViewModel[6]), CSPFT_XMODEL }, + {"attachViewModel8", offsetof(WeaponFullDef, attachViewModel[7]), CSPFT_XMODEL }, + {"attachWorldModel1", offsetof(WeaponFullDef, attachWorldModel[0]), CSPFT_XMODEL }, + {"attachWorldModel2", offsetof(WeaponFullDef, attachWorldModel[1]), CSPFT_XMODEL }, + {"attachWorldModel3", offsetof(WeaponFullDef, attachWorldModel[2]), CSPFT_XMODEL }, + {"attachWorldModel4", offsetof(WeaponFullDef, attachWorldModel[3]), CSPFT_XMODEL }, + {"attachWorldModel5", offsetof(WeaponFullDef, attachWorldModel[4]), CSPFT_XMODEL }, + {"attachWorldModel6", offsetof(WeaponFullDef, attachWorldModel[5]), CSPFT_XMODEL }, + {"attachWorldModel7", offsetof(WeaponFullDef, attachWorldModel[6]), CSPFT_XMODEL }, + {"attachWorldModel8", offsetof(WeaponFullDef, attachWorldModel[7]), CSPFT_XMODEL }, + {"attachViewModelTag1", offsetof(WeaponFullDef, attachViewModelTag[0]), CSPFT_STRING }, + {"attachViewModelTag2", offsetof(WeaponFullDef, attachViewModelTag[1]), CSPFT_STRING }, + {"attachViewModelTag3", offsetof(WeaponFullDef, attachViewModelTag[2]), CSPFT_STRING }, + {"attachViewModelTag4", offsetof(WeaponFullDef, attachViewModelTag[3]), CSPFT_STRING }, + {"attachViewModelTag5", offsetof(WeaponFullDef, attachViewModelTag[4]), CSPFT_STRING }, + {"attachViewModelTag6", offsetof(WeaponFullDef, attachViewModelTag[5]), CSPFT_STRING }, + {"attachViewModelTag7", offsetof(WeaponFullDef, attachViewModelTag[6]), CSPFT_STRING }, + {"attachViewModelTag8", offsetof(WeaponFullDef, attachViewModelTag[7]), CSPFT_STRING }, + {"attachWorldModelTag1", offsetof(WeaponFullDef, attachWorldModelTag[0]), CSPFT_STRING }, + {"attachWorldModelTag2", offsetof(WeaponFullDef, attachWorldModelTag[1]), CSPFT_STRING }, + {"attachWorldModelTag3", offsetof(WeaponFullDef, attachWorldModelTag[2]), CSPFT_STRING }, + {"attachWorldModelTag4", offsetof(WeaponFullDef, attachWorldModelTag[3]), CSPFT_STRING }, + {"attachWorldModelTag5", offsetof(WeaponFullDef, attachWorldModelTag[4]), CSPFT_STRING }, + {"attachWorldModelTag6", offsetof(WeaponFullDef, attachWorldModelTag[5]), CSPFT_STRING }, + {"attachWorldModelTag7", offsetof(WeaponFullDef, attachWorldModelTag[6]), CSPFT_STRING }, + {"attachWorldModelTag8", offsetof(WeaponFullDef, attachWorldModelTag[7]), CSPFT_STRING }, + {"attachViewModelOffsetX1", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[0]), CSPFT_FLOAT }, + {"attachViewModelOffsetY1", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[1]), CSPFT_FLOAT }, + {"attachViewModelOffsetZ1", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[2]), CSPFT_FLOAT }, + {"attachViewModelOffsetX2", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[3]), CSPFT_FLOAT }, + {"attachViewModelOffsetY2", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[4]), CSPFT_FLOAT }, + {"attachViewModelOffsetZ2", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[5]), CSPFT_FLOAT }, + {"attachViewModelOffsetX3", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[6]), CSPFT_FLOAT }, + {"attachViewModelOffsetY3", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[7]), CSPFT_FLOAT }, + {"attachViewModelOffsetZ3", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[8]), CSPFT_FLOAT }, + {"attachViewModelOffsetX4", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[9]), CSPFT_FLOAT }, + {"attachViewModelOffsetY4", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[10]), CSPFT_FLOAT }, + {"attachViewModelOffsetZ4", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[11]), CSPFT_FLOAT }, + {"attachViewModelOffsetX5", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[12]), CSPFT_FLOAT }, + {"attachViewModelOffsetY5", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[13]), CSPFT_FLOAT }, + {"attachViewModelOffsetZ5", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[14]), CSPFT_FLOAT }, + {"attachViewModelOffsetX6", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[15]), CSPFT_FLOAT }, + {"attachViewModelOffsetY6", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[16]), CSPFT_FLOAT }, + {"attachViewModelOffsetZ6", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[17]), CSPFT_FLOAT }, + {"attachViewModelOffsetX7", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[18]), CSPFT_FLOAT }, + {"attachViewModelOffsetY7", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[19]), CSPFT_FLOAT }, + {"attachViewModelOffsetZ7", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[20]), CSPFT_FLOAT }, + {"attachViewModelOffsetX8", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[21]), CSPFT_FLOAT }, + {"attachViewModelOffsetY8", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[22]), CSPFT_FLOAT }, + {"attachViewModelOffsetZ8", offsetof(WeaponFullDef, weapVariantDef.attachViewModelOffsets[23]), CSPFT_FLOAT }, + {"attachWorldModelOffsetX1", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[0]), CSPFT_FLOAT }, + {"attachWorldModelOffsetY1", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[1]), CSPFT_FLOAT }, + {"attachWorldModelOffsetZ1", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[2]), CSPFT_FLOAT }, + {"attachWorldModelOffsetX2", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[3]), CSPFT_FLOAT }, + {"attachWorldModelOffsetY2", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[4]), CSPFT_FLOAT }, + {"attachWorldModelOffsetZ2", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[5]), CSPFT_FLOAT }, + {"attachWorldModelOffsetX3", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[6]), CSPFT_FLOAT }, + {"attachWorldModelOffsetY3", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[7]), CSPFT_FLOAT }, + {"attachWorldModelOffsetZ3", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[8]), CSPFT_FLOAT }, + {"attachWorldModelOffsetX4", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[9]), CSPFT_FLOAT }, + {"attachWorldModelOffsetY4", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[10]), CSPFT_FLOAT }, + {"attachWorldModelOffsetZ4", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[11]), CSPFT_FLOAT }, + {"attachWorldModelOffsetX5", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[12]), CSPFT_FLOAT }, + {"attachWorldModelOffsetY5", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[13]), CSPFT_FLOAT }, + {"attachWorldModelOffsetZ5", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[14]), CSPFT_FLOAT }, + {"attachWorldModelOffsetX6", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[15]), CSPFT_FLOAT }, + {"attachWorldModelOffsetY6", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[16]), CSPFT_FLOAT }, + {"attachWorldModelOffsetZ6", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[17]), CSPFT_FLOAT }, + {"attachWorldModelOffsetX7", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[18]), CSPFT_FLOAT }, + {"attachWorldModelOffsetY7", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[19]), CSPFT_FLOAT }, + {"attachWorldModelOffsetZ7", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[20]), CSPFT_FLOAT }, + {"attachWorldModelOffsetX8", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[21]), CSPFT_FLOAT }, + {"attachWorldModelOffsetY8", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[22]), CSPFT_FLOAT }, + {"attachWorldModelOffsetZ8", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelOffsets[23]), CSPFT_FLOAT }, + {"attachViewModelOffsetPitch1", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[0]), CSPFT_FLOAT }, + {"attachViewModelOffsetYaw1", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[1]), CSPFT_FLOAT }, + {"attachViewModelOffsetRoll1", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[2]), CSPFT_FLOAT }, + {"attachViewModelOffsetPitch2", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[3]), CSPFT_FLOAT }, + {"attachViewModelOffsetYaw2", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[4]), CSPFT_FLOAT }, + {"attachViewModelOffsetRoll2", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[5]), CSPFT_FLOAT }, + {"attachViewModelOffsetPitch3", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[6]), CSPFT_FLOAT }, + {"attachViewModelOffsetYaw3", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[7]), CSPFT_FLOAT }, + {"attachViewModelOffsetRoll3", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[8]), CSPFT_FLOAT }, + {"attachViewModelOffsetPitch4", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[9]), CSPFT_FLOAT }, + {"attachViewModelOffsetYaw4", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[10]), CSPFT_FLOAT }, + {"attachViewModelOffsetRoll4", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[11]), CSPFT_FLOAT }, + {"attachViewModelOffsetPitch5", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[12]), CSPFT_FLOAT }, + {"attachViewModelOffsetYaw5", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[13]), CSPFT_FLOAT }, + {"attachViewModelOffsetRoll5", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[14]), CSPFT_FLOAT }, + {"attachViewModelOffsetPitch6", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[15]), CSPFT_FLOAT }, + {"attachViewModelOffsetYaw6", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[16]), CSPFT_FLOAT }, + {"attachViewModelOffsetRoll6", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[17]), CSPFT_FLOAT }, + {"attachViewModelOffsetPitch7", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[18]), CSPFT_FLOAT }, + {"attachViewModelOffsetYaw7", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[19]), CSPFT_FLOAT }, + {"attachViewModelOffsetRoll7", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[20]), CSPFT_FLOAT }, + {"attachViewModelOffsetPitch8", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[21]), CSPFT_FLOAT }, + {"attachViewModelOffsetYaw8", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[22]), CSPFT_FLOAT }, + {"attachViewModelOffsetRoll8", offsetof(WeaponFullDef, weapVariantDef.attachViewModelRotations[23]), CSPFT_FLOAT }, + {"attachWorldModelOffsetPitch1", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[0]), CSPFT_FLOAT }, + {"attachWorldModelOffsetYaw1", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[1]), CSPFT_FLOAT }, + {"attachWorldModelOffsetRoll1", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[2]), CSPFT_FLOAT }, + {"attachWorldModelOffsetPitch2", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[3]), CSPFT_FLOAT }, + {"attachWorldModelOffsetYaw2", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[4]), CSPFT_FLOAT }, + {"attachWorldModelOffsetRoll2", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[5]), CSPFT_FLOAT }, + {"attachWorldModelOffsetPitch3", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[6]), CSPFT_FLOAT }, + {"attachWorldModelOffsetYaw3", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[7]), CSPFT_FLOAT }, + {"attachWorldModelOffsetRoll3", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[8]), CSPFT_FLOAT }, + {"attachWorldModelOffsetPitch4", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[9]), CSPFT_FLOAT }, + {"attachWorldModelOffsetYaw4", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[10]), CSPFT_FLOAT }, + {"attachWorldModelOffsetRoll4", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[11]), CSPFT_FLOAT }, + {"attachWorldModelOffsetPitch5", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[12]), CSPFT_FLOAT }, + {"attachWorldModelOffsetYaw5", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[13]), CSPFT_FLOAT }, + {"attachWorldModelOffsetRoll5", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[14]), CSPFT_FLOAT }, + {"attachWorldModelOffsetPitch6", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[15]), CSPFT_FLOAT }, + {"attachWorldModelOffsetYaw6", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[16]), CSPFT_FLOAT }, + {"attachWorldModelOffsetRoll6", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[17]), CSPFT_FLOAT }, + {"attachWorldModelOffsetPitch7", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[18]), CSPFT_FLOAT }, + {"attachWorldModelOffsetYaw7", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[19]), CSPFT_FLOAT }, + {"attachWorldModelOffsetRoll7", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[20]), CSPFT_FLOAT }, + {"attachWorldModelOffsetPitch8", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[21]), CSPFT_FLOAT }, + {"attachWorldModelOffsetYaw8", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[22]), CSPFT_FLOAT }, + {"attachWorldModelOffsetRoll8", offsetof(WeaponFullDef, weapVariantDef.attachWorldModelRotations[23]), CSPFT_FLOAT }, + {"ignoreAttachments", offsetof(WeaponFullDef, weapVariantDef.bIgnoreAttachments), CSPFT_BOOL }, + {"stowedModelOffsetsF", offsetof(WeaponFullDef, weapVariantDef.stowedModelOffsets.x), CSPFT_FLOAT }, + {"stowedModelOffsetsR", offsetof(WeaponFullDef, weapVariantDef.stowedModelOffsets.y), CSPFT_FLOAT }, + {"stowedModelOffsetsU", offsetof(WeaponFullDef, weapVariantDef.stowedModelOffsets.z), CSPFT_FLOAT }, + {"stowedModelOffsetsPitch", offsetof(WeaponFullDef, weapVariantDef.stowedModelRotations.x), CSPFT_FLOAT }, + {"stowedModelOffsetsYaw", offsetof(WeaponFullDef, weapVariantDef.stowedModelRotations.y), CSPFT_FLOAT }, + {"stowedModelOffsetsRoll", offsetof(WeaponFullDef, weapVariantDef.stowedModelRotations.z), CSPFT_FLOAT }, + {"worldClipModel", offsetof(WeaponFullDef, weapDef.worldClipModel), CSPFT_XMODEL }, + {"rocketModel", offsetof(WeaponFullDef, weapDef.rocketModel), CSPFT_XMODEL }, + {"mountedModel", offsetof(WeaponFullDef, weapDef.mountedModel), CSPFT_XMODEL }, + {"AdditionalMeleeModel", offsetof(WeaponFullDef, weapDef.additionalMeleeModel), CSPFT_XMODEL }, + {"fireTypeIcon", offsetof(WeaponFullDef, weapDef.fireTypeIcon), CSPFT_MATERIAL }, + {"hudIcon", offsetof(WeaponFullDef, weapDef.hudIcon), CSPFT_MATERIAL }, + {"hudIconRatio", offsetof(WeaponFullDef, weapDef.hudIconRatio), WFT_ICONRATIO_HUD }, + {"indicatorIcon", offsetof(WeaponFullDef, weapDef.indicatorIcon), CSPFT_MATERIAL }, + {"indicatorIconRatio", offsetof(WeaponFullDef, weapDef.indicatorIconRatio), WFT_ICONRATIO_INDICATOR }, + {"ammoCounterIcon", offsetof(WeaponFullDef, weapDef.ammoCounterIcon), CSPFT_MATERIAL }, + {"ammoCounterIconRatio", offsetof(WeaponFullDef, weapDef.ammoCounterIconRatio), WFT_ICONRATIO_AMMOCOUNTER}, + {"ammoCounterClip", offsetof(WeaponFullDef, weapDef.ammoCounterClip), WFT_AMMOCOUNTER_CLIPTYPE }, + {"startAmmo", offsetof(WeaponFullDef, weapDef.iStartAmmo), CSPFT_INT }, + {"ammoDisplayName", offsetof(WeaponFullDef, weapVariantDef.szAmmoDisplayName), CSPFT_STRING }, + {"ammoName", offsetof(WeaponFullDef, weapVariantDef.szAmmoName), CSPFT_STRING }, + {"clipName", offsetof(WeaponFullDef, weapVariantDef.szClipName), CSPFT_STRING }, + {"maxAmmo", offsetof(WeaponFullDef, weapDef.iMaxAmmo), CSPFT_INT }, + {"clipSize", offsetof(WeaponFullDef, weapVariantDef.iClipSize), CSPFT_INT }, + {"shotCount", offsetof(WeaponFullDef, weapDef.shotCount), CSPFT_INT }, + {"sharedAmmoCapName", offsetof(WeaponFullDef, weapDef.szSharedAmmoCapName), CSPFT_STRING }, + {"sharedAmmoCap", offsetof(WeaponFullDef, weapDef.iSharedAmmoCap), CSPFT_INT }, + {"unlimitedAmmo", offsetof(WeaponFullDef, weapDef.unlimitedAmmo), CSPFT_BOOL }, + {"ammoCountClipRelative", offsetof(WeaponFullDef, weapDef.ammoCountClipRelative), CSPFT_BOOL }, + {"sharedAmmo", offsetof(WeaponFullDef, weapDef.sharedAmmo), CSPFT_BOOL }, + {"jamFireTime", offsetof(WeaponFullDef, weapDef.iJamFireTime), CSPFT_MILLISECONDS }, + {"overheatWeapon", offsetof(WeaponFullDef, weapDef.overheatWeapon), CSPFT_INT }, + {"overheatRate", offsetof(WeaponFullDef, weapDef.overheatRate), CSPFT_FLOAT }, + {"cooldownRate", offsetof(WeaponFullDef, weapDef.cooldownRate), CSPFT_FLOAT }, + {"overheatEndVal", offsetof(WeaponFullDef, weapDef.overheatEndVal), CSPFT_FLOAT }, + {"coolWhileFiring", offsetof(WeaponFullDef, weapDef.coolWhileFiring), CSPFT_INT }, + {"fuelTankWeapon", offsetof(WeaponFullDef, weapDef.fuelTankWeapon), CSPFT_INT }, + {"tankLifeTime", offsetof(WeaponFullDef, weapDef.iTankLifeTime), CSPFT_MILLISECONDS }, + {"damage", offsetof(WeaponFullDef, weapDef.damage[0]), CSPFT_INT }, + {"minDamage", offsetof(WeaponFullDef, weapDef.damage[5]), CSPFT_INT }, + {"maxDamageRange", offsetof(WeaponFullDef, weapDef.damageRange[0]), CSPFT_FLOAT }, + {"minDamageRange", offsetof(WeaponFullDef, weapDef.damageRange[5]), CSPFT_FLOAT }, + {"damage2", offsetof(WeaponFullDef, weapDef.damage[1]), CSPFT_INT }, + {"damage3", offsetof(WeaponFullDef, weapDef.damage[2]), CSPFT_INT }, + {"damage4", offsetof(WeaponFullDef, weapDef.damage[3]), CSPFT_INT }, + {"damage5", offsetof(WeaponFullDef, weapDef.damage[4]), CSPFT_INT }, + {"damageRange2", offsetof(WeaponFullDef, weapDef.damageRange[1]), CSPFT_FLOAT }, + {"damageRange3", offsetof(WeaponFullDef, weapDef.damageRange[2]), CSPFT_FLOAT }, + {"damageRange4", offsetof(WeaponFullDef, weapDef.damageRange[3]), CSPFT_FLOAT }, + {"damageRange5", offsetof(WeaponFullDef, weapDef.damageRange[4]), CSPFT_FLOAT }, + {"damageDuration", offsetof(WeaponFullDef, weapDef.damageDuration), CSPFT_FLOAT }, + {"damageInterval", offsetof(WeaponFullDef, weapDef.damageInterval), CSPFT_FLOAT }, + {"playerDamage", offsetof(WeaponFullDef, weapDef.playerDamage), CSPFT_INT }, + {"meleeDamage", offsetof(WeaponFullDef, weapDef.iMeleeDamage), CSPFT_INT }, + {"minPlayerDamage", offsetof(WeaponFullDef, weapDef.minPlayerDamage), CSPFT_INT }, + {"destabilizationRateTime", offsetof(WeaponFullDef, weapDef.destabilizationRateTime), CSPFT_FLOAT }, + {"destabilizationCurvatureMax", offsetof(WeaponFullDef, weapDef.destabilizationCurvatureMax), CSPFT_FLOAT }, + {"destabilizeDistance", offsetof(WeaponFullDef, weapDef.destabilizeDistance), CSPFT_INT }, + {"fireDelay", offsetof(WeaponFullDef, weapDef.iFireDelay), CSPFT_MILLISECONDS }, + {"meleeDelay", offsetof(WeaponFullDef, weapDef.iMeleeDelay), CSPFT_MILLISECONDS }, + {"meleeChargeDelay", offsetof(WeaponFullDef, weapDef.meleeChargeDelay), CSPFT_MILLISECONDS }, + {"spinUpTime", offsetof(WeaponFullDef, weapDef.iSpinUpTime), CSPFT_MILLISECONDS }, + {"spinDownTime", offsetof(WeaponFullDef, weapDef.iSpinDownTime), CSPFT_MILLISECONDS }, + {"spinRate", offsetof(WeaponFullDef, weapDef.spinRate), CSPFT_FLOAT }, + {"spinLoopSound", offsetof(WeaponFullDef, weapDef.spinLoopSound), CSPFT_STRING }, + {"spinLoopSoundPlayer", offsetof(WeaponFullDef, weapDef.spinLoopSoundPlayer), CSPFT_STRING }, + {"startSpinSound", offsetof(WeaponFullDef, weapDef.startSpinSound), CSPFT_STRING }, + {"startSpinSoundPlayer", offsetof(WeaponFullDef, weapDef.startSpinSoundPlayer), CSPFT_STRING }, + {"stopSpinSound", offsetof(WeaponFullDef, weapDef.stopSpinSound), CSPFT_STRING }, + {"stopSpinSoundPlayer", offsetof(WeaponFullDef, weapDef.stopSpinSoundPlayer), CSPFT_STRING }, + {"applySpinPitch", offsetof(WeaponFullDef, weapDef.applySpinPitch), CSPFT_BOOL }, + {"introFireTime", offsetof(WeaponFullDef, weapDef.iIntroFireTime), CSPFT_MILLISECONDS }, + {"introFireLength", offsetof(WeaponFullDef, weapDef.iIntroFireLength), CSPFT_INT }, + {"fireTime", offsetof(WeaponFullDef, weapDef.iFireTime), CSPFT_MILLISECONDS }, + {"flourishTime", offsetof(WeaponFullDef, weapDef.iFlourishTime), CSPFT_MILLISECONDS }, + {"lastFireTime", offsetof(WeaponFullDef, weapDef.iLastFireTime), CSPFT_MILLISECONDS }, + {"rechamberTime", offsetof(WeaponFullDef, weapDef.iRechamberTime), CSPFT_MILLISECONDS }, + {"rechamberBoltTime", offsetof(WeaponFullDef, weapDef.iRechamberBoltTime), CSPFT_MILLISECONDS }, + {"holdFireTime", offsetof(WeaponFullDef, weapDef.iHoldFireTime), CSPFT_MILLISECONDS }, + {"burstFireDelay", offsetof(WeaponFullDef, weapDef.iBurstDelayTime), CSPFT_MILLISECONDS }, + {"detonateTime", offsetof(WeaponFullDef, weapDef.iDetonateTime), CSPFT_MILLISECONDS }, + {"detonateDelay", offsetof(WeaponFullDef, weapDef.iDetonateDelay), CSPFT_MILLISECONDS }, + {"meleeTime", offsetof(WeaponFullDef, weapDef.iMeleeTime), CSPFT_MILLISECONDS }, + {"meleeChargeTime", offsetof(WeaponFullDef, weapDef.meleeChargeTime), CSPFT_MILLISECONDS }, + {"reloadTime", offsetof(WeaponFullDef, weapVariantDef.iReloadTime), CSPFT_MILLISECONDS }, + {"reloadShowRocketTime", offsetof(WeaponFullDef, weapDef.reloadShowRocketTime), CSPFT_MILLISECONDS }, + {"reloadEmptyTime", offsetof(WeaponFullDef, weapVariantDef.iReloadEmptyTime), CSPFT_MILLISECONDS }, + {"reloadAddTime", offsetof(WeaponFullDef, weapDef.iReloadAddTime), CSPFT_MILLISECONDS }, + {"reloadEmptyAddTime", offsetof(WeaponFullDef, weapDef.iReloadEmptyAddTime), CSPFT_MILLISECONDS }, + {"reloadQuickAddTime", offsetof(WeaponFullDef, weapDef.iReloadQuickAddTime), CSPFT_MILLISECONDS }, + {"reloadQuickEmptyAddTime", offsetof(WeaponFullDef, weapDef.iReloadQuickEmptyAddTime), CSPFT_MILLISECONDS }, + {"reloadStartTime", offsetof(WeaponFullDef, weapDef.iReloadStartTime), CSPFT_MILLISECONDS }, + {"reloadStartAddTime", offsetof(WeaponFullDef, weapDef.iReloadStartAddTime), CSPFT_MILLISECONDS }, + {"reloadEndTime", offsetof(WeaponFullDef, weapDef.iReloadEndTime), CSPFT_MILLISECONDS }, + {"reloadQuickTime", offsetof(WeaponFullDef, weapVariantDef.iReloadQuickTime), CSPFT_MILLISECONDS }, + {"reloadQuickEmptyTime", offsetof(WeaponFullDef, weapVariantDef.iReloadQuickEmptyTime), CSPFT_MILLISECONDS }, + {"dropTime", offsetof(WeaponFullDef, weapDef.iDropTime), CSPFT_MILLISECONDS }, + {"raiseTime", offsetof(WeaponFullDef, weapDef.iRaiseTime), CSPFT_MILLISECONDS }, + {"altDropTime", offsetof(WeaponFullDef, weapDef.iAltDropTime), CSPFT_MILLISECONDS }, + {"altRaiseTime", offsetof(WeaponFullDef, weapVariantDef.iAltRaiseTime), CSPFT_MILLISECONDS }, + {"quickDropTime", offsetof(WeaponFullDef, weapDef.quickDropTime), CSPFT_MILLISECONDS }, + {"quickRaiseTime", offsetof(WeaponFullDef, weapDef.quickRaiseTime), CSPFT_MILLISECONDS }, + {"firstRaiseTime", offsetof(WeaponFullDef, weapDef.iFirstRaiseTime), CSPFT_MILLISECONDS }, + {"emptyRaiseTime", offsetof(WeaponFullDef, weapDef.iEmptyRaiseTime), CSPFT_MILLISECONDS }, + {"emptyDropTime", offsetof(WeaponFullDef, weapDef.iEmptyDropTime), CSPFT_MILLISECONDS }, + {"sprintInTime", offsetof(WeaponFullDef, weapDef.sprintInTime), CSPFT_MILLISECONDS }, + {"sprintLoopTime", offsetof(WeaponFullDef, weapDef.sprintLoopTime), CSPFT_MILLISECONDS }, + {"sprintOutTime", offsetof(WeaponFullDef, weapDef.sprintOutTime), CSPFT_MILLISECONDS }, + {"lowReadyInTime", offsetof(WeaponFullDef, weapDef.lowReadyInTime), CSPFT_MILLISECONDS }, + {"lowReadyLoopTime", offsetof(WeaponFullDef, weapDef.lowReadyLoopTime), CSPFT_MILLISECONDS }, + {"lowReadyOutTime", offsetof(WeaponFullDef, weapDef.lowReadyOutTime), CSPFT_MILLISECONDS }, + {"contFireInTime", offsetof(WeaponFullDef, weapDef.contFireInTime), CSPFT_MILLISECONDS }, + {"contFireLoopTime", offsetof(WeaponFullDef, weapDef.contFireLoopTime), CSPFT_MILLISECONDS }, + {"contFireOutTime", offsetof(WeaponFullDef, weapDef.contFireOutTime), CSPFT_MILLISECONDS }, + {"dtpInTime", offsetof(WeaponFullDef, weapDef.dtpInTime), CSPFT_MILLISECONDS }, + {"dtpLoopTime", offsetof(WeaponFullDef, weapDef.dtpLoopTime), CSPFT_MILLISECONDS }, + {"dtpOutTime", offsetof(WeaponFullDef, weapDef.dtpOutTime), CSPFT_MILLISECONDS }, + {"crawlInTime", offsetof(WeaponFullDef, weapDef.crawlInTime), CSPFT_MILLISECONDS }, + {"crawlForwardTime", offsetof(WeaponFullDef, weapDef.crawlForwardTime), CSPFT_MILLISECONDS }, + {"crawlBackTime", offsetof(WeaponFullDef, weapDef.crawlBackTime), CSPFT_MILLISECONDS }, + {"crawlRightTime", offsetof(WeaponFullDef, weapDef.crawlRightTime), CSPFT_MILLISECONDS }, + {"crawlLeftTime", offsetof(WeaponFullDef, weapDef.crawlLeftTime), CSPFT_MILLISECONDS }, + {"crawlOutFireTime", offsetof(WeaponFullDef, weapDef.crawlOutFireTime), CSPFT_MILLISECONDS }, + {"crawlOutTime", offsetof(WeaponFullDef, weapDef.crawlOutTime), CSPFT_MILLISECONDS }, + {"slideInTime", offsetof(WeaponFullDef, weapDef.slideInTime), CSPFT_MILLISECONDS }, + {"deployTime", offsetof(WeaponFullDef, weapDef.deployTime), CSPFT_MILLISECONDS }, + {"breakdownTime", offsetof(WeaponFullDef, weapDef.breakdownTime), CSPFT_MILLISECONDS }, + {"nightVisionWearTime", offsetof(WeaponFullDef, weapDef.nightVisionWearTime), CSPFT_MILLISECONDS }, + {"nightVisionWearTimeFadeOutEnd", offsetof(WeaponFullDef, weapDef.nightVisionWearTimeFadeOutEnd), CSPFT_MILLISECONDS }, + {"nightVisionWearTimePowerUp", offsetof(WeaponFullDef, weapDef.nightVisionWearTimePowerUp), CSPFT_MILLISECONDS }, + {"nightVisionRemoveTime", offsetof(WeaponFullDef, weapDef.nightVisionRemoveTime), CSPFT_MILLISECONDS }, + {"nightVisionRemoveTimePowerDown", offsetof(WeaponFullDef, weapDef.nightVisionRemoveTimePowerDown), CSPFT_MILLISECONDS }, + {"nightVisionRemoveTimeFadeInStart", offsetof(WeaponFullDef, weapDef.nightVisionRemoveTimeFadeInStart), CSPFT_MILLISECONDS }, + {"fuseTime", offsetof(WeaponFullDef, weapDef.fuseTime), CSPFT_MILLISECONDS }, + {"aifuseTime", offsetof(WeaponFullDef, weapDef.aiFuseTime), CSPFT_MILLISECONDS }, + {"lockOnRadius", offsetof(WeaponFullDef, weapDef.lockOnRadius), CSPFT_INT }, + {"lockOnSpeed", offsetof(WeaponFullDef, weapDef.lockOnSpeed), CSPFT_INT }, + {"requireLockonToFire", offsetof(WeaponFullDef, weapDef.requireLockonToFire), CSPFT_BOOL }, + {"noAdsWhenMagEmpty", offsetof(WeaponFullDef, weapDef.noAdsWhenMagEmpty), CSPFT_BOOL }, + {"avoidDropCleanup", offsetof(WeaponFullDef, weapDef.avoidDropCleanup), CSPFT_BOOL }, + {"stackFire", offsetof(WeaponFullDef, weapDef.stackFire), CSPFT_INT }, + {"stackFireSpread", offsetof(WeaponFullDef, weapDef.stackFireSpread), CSPFT_FLOAT }, + {"stackFireAccuracyDecay", offsetof(WeaponFullDef, weapDef.stackFireAccuracyDecay), CSPFT_FLOAT }, + {"stackSound", offsetof(WeaponFullDef, weapDef.stackSound), CSPFT_STRING }, + {"autoAimRange", offsetof(WeaponFullDef, weapDef.autoAimRange), CSPFT_FLOAT }, + {"aimAssistRange", offsetof(WeaponFullDef, weapDef.aimAssistRange), CSPFT_FLOAT }, + {"aimAssistRangeAds", offsetof(WeaponFullDef, weapVariantDef.fAimAssistRangeAds), CSPFT_FLOAT }, + {"mountableWeapon", offsetof(WeaponFullDef, weapDef.mountableWeapon), CSPFT_BOOL }, + {"aimPadding", offsetof(WeaponFullDef, weapDef.aimPadding), CSPFT_FLOAT }, + {"enemyCrosshairRange", offsetof(WeaponFullDef, weapDef.enemyCrosshairRange), CSPFT_FLOAT }, + {"crosshairColorChange", offsetof(WeaponFullDef, weapDef.crosshairColorChange), CSPFT_BOOL }, + {"moveSpeedScale", offsetof(WeaponFullDef, weapDef.moveSpeedScale), CSPFT_FLOAT }, + {"adsMoveSpeedScale", offsetof(WeaponFullDef, weapDef.adsMoveSpeedScale), CSPFT_FLOAT }, + {"sprintDurationScale", offsetof(WeaponFullDef, weapDef.sprintDurationScale), CSPFT_FLOAT }, + {"idleCrouchFactor", offsetof(WeaponFullDef, weapDef.fIdleCrouchFactor), CSPFT_FLOAT }, + {"idleProneFactor", offsetof(WeaponFullDef, weapDef.fIdleProneFactor), CSPFT_FLOAT }, + {"gunMaxPitch", offsetof(WeaponFullDef, weapDef.fGunMaxPitch), CSPFT_FLOAT }, + {"gunMaxYaw", offsetof(WeaponFullDef, weapDef.fGunMaxYaw), CSPFT_FLOAT }, + {"swayMaxAngle", offsetof(WeaponFullDef, weapDef.swayMaxAngle), CSPFT_FLOAT }, + {"swayLerpSpeed", offsetof(WeaponFullDef, weapDef.swayLerpSpeed), CSPFT_FLOAT }, + {"swayPitchScale", offsetof(WeaponFullDef, weapDef.swayPitchScale), CSPFT_FLOAT }, + {"swayYawScale", offsetof(WeaponFullDef, weapDef.swayYawScale), CSPFT_FLOAT }, + {"swayHorizScale", offsetof(WeaponFullDef, weapDef.swayHorizScale), CSPFT_FLOAT }, + {"swayVertScale", offsetof(WeaponFullDef, weapDef.swayVertScale), CSPFT_FLOAT }, + {"swayShellShockScale", offsetof(WeaponFullDef, weapDef.swayShellShockScale), CSPFT_FLOAT }, + {"adsSwayMaxAngle", offsetof(WeaponFullDef, weapDef.adsSwayMaxAngle), CSPFT_FLOAT }, + {"adsSwayLerpSpeed", offsetof(WeaponFullDef, weapDef.adsSwayLerpSpeed), CSPFT_FLOAT }, + {"adsSwayPitchScale", offsetof(WeaponFullDef, weapDef.adsSwayPitchScale), CSPFT_FLOAT }, + {"adsSwayYawScale", offsetof(WeaponFullDef, weapDef.adsSwayYawScale), CSPFT_FLOAT }, + {"adsSwayHorizScale", offsetof(WeaponFullDef, weapVariantDef.fAdsSwayHorizScale), CSPFT_FLOAT }, + {"adsSwayVertScale", offsetof(WeaponFullDef, weapVariantDef.fAdsSwayVertScale), CSPFT_FLOAT }, + {"meleeChargeRange", offsetof(WeaponFullDef, weapDef.meleeChargeRange), CSPFT_FLOAT }, + {"rifleBullet", offsetof(WeaponFullDef, weapDef.bRifleBullet), CSPFT_BOOL }, + {"armorPiercing", offsetof(WeaponFullDef, weapDef.armorPiercing), CSPFT_BOOL }, + {"boltAction", offsetof(WeaponFullDef, weapDef.bBoltAction), CSPFT_BOOL }, + {"shotsBeforeRechamber", offsetof(WeaponFullDef, weapDef.iShotsBeforeRechamber), CSPFT_INT }, + {"useAltTagFlash", offsetof(WeaponFullDef, weapDef.bUseAltTagFlash), CSPFT_BOOL }, + {"useAntiLagRewind", offsetof(WeaponFullDef, weapDef.bUseAntiLagRewind), CSPFT_BOOL }, + {"isCarriedKillstreakWeapon", offsetof(WeaponFullDef, weapDef.bIsCarriedKillstreakWeapon), CSPFT_BOOL }, + {"aimDownSight", offsetof(WeaponFullDef, weapDef.aimDownSight), CSPFT_BOOL }, + {"rechamberWhileAds", offsetof(WeaponFullDef, weapDef.bRechamberWhileAds), CSPFT_BOOL }, + {"reloadWhileAds", offsetof(WeaponFullDef, weapDef.bReloadWhileAds), CSPFT_BOOL }, + {"adsViewErrorMin", offsetof(WeaponFullDef, weapDef.adsViewErrorMin), CSPFT_FLOAT }, + {"adsViewErrorMax", offsetof(WeaponFullDef, weapDef.adsViewErrorMax), CSPFT_FLOAT }, + {"clipOnly", offsetof(WeaponFullDef, weapDef.bClipOnly), CSPFT_BOOL }, + {"canUseInVehicle", offsetof(WeaponFullDef, weapDef.bCanUseInVehicle), CSPFT_BOOL }, + {"noDropsOrRaises", offsetof(WeaponFullDef, weapDef.bNoDropsOrRaises), CSPFT_BOOL }, + {"cookOffHold", offsetof(WeaponFullDef, weapDef.bCookOffHold), CSPFT_BOOL }, + {"adsFire", offsetof(WeaponFullDef, weapDef.adsFireOnly), CSPFT_BOOL }, + {"cancelAutoHolsterWhenEmpty", offsetof(WeaponFullDef, weapDef.cancelAutoHolsterWhenEmpty), CSPFT_BOOL }, + {"suppressAmmoReserveDisplay", offsetof(WeaponFullDef, weapDef.suppressAmmoReserveDisplay), CSPFT_BOOL }, + {"laserSight", offsetof(WeaponFullDef, weapDef.laserSight), CSPFT_BOOL }, + {"laserSightDuringNightvision", offsetof(WeaponFullDef, weapDef.laserSightDuringNightvision), CSPFT_BOOL }, + {"bayonet", offsetof(WeaponFullDef, weapDef.bHasBayonet), CSPFT_BOOL }, + {"dualWield", offsetof(WeaponFullDef, weapDef.bDualWield), CSPFT_BOOL }, + {"hideThirdPerson", offsetof(WeaponFullDef, weapDef.bHideThirdPerson), CSPFT_BOOL }, + {"explodeOnGround", offsetof(WeaponFullDef, weapDef.bExplodeOnGround), CSPFT_BOOL }, + {"throwBack", offsetof(WeaponFullDef, weapDef.bThrowBack), CSPFT_BOOL }, + {"retrievable", offsetof(WeaponFullDef, weapDef.bRetrievable), CSPFT_BOOL }, + {"dieOnRespawn", offsetof(WeaponFullDef, weapDef.bDieOnRespawn), CSPFT_BOOL }, + {"noThirdPersonDropsOrRaises", offsetof(WeaponFullDef, weapDef.bNoThirdPersonDropsOrRaises), CSPFT_BOOL }, + {"continuousFire", offsetof(WeaponFullDef, weapDef.bContinuousFire), CSPFT_BOOL }, + {"useAsMelee", offsetof(WeaponFullDef, weapDef.bUseAsMelee), CSPFT_BOOL }, + {"antiQuickScope", offsetof(WeaponFullDef, weapVariantDef.bAntiQuickScope), CSPFT_BOOL }, + {"noPing", offsetof(WeaponFullDef, weapDef.bNoPing), CSPFT_BOOL }, + {"forceBounce", offsetof(WeaponFullDef, weapDef.bForceBounce), CSPFT_BOOL }, + {"useDroppedModelAsStowed", offsetof(WeaponFullDef, weapDef.bUseDroppedModelAsStowed), CSPFT_BOOL }, + {"noQuickDropWhenEmpty", offsetof(WeaponFullDef, weapDef.bNoQuickDropWhenEmpty), CSPFT_BOOL }, + {"keepCrosshairWhenADS", offsetof(WeaponFullDef, weapDef.bKeepCrosshairWhenADS), CSPFT_BOOL }, + {"useOnlyAltWeaoponHideTagsInAltMode", offsetof(WeaponFullDef, weapDef.bUseOnlyAltWeaoponHideTagsInAltMode), CSPFT_BOOL }, + {"altWeaponAdsOnly", offsetof(WeaponFullDef, weapDef.bAltWeaponAdsOnly), CSPFT_BOOL }, + {"altWeaponDisableSwitching", offsetof(WeaponFullDef, weapDef.bAltWeaponDisableSwitching), CSPFT_BOOL }, + {"killIcon", offsetof(WeaponFullDef, weapDef.killIcon), CSPFT_MATERIAL }, + {"killIconRatio", offsetof(WeaponFullDef, weapDef.killIconRatio), WFT_ICONRATIO_KILL }, + {"flipKillIcon", offsetof(WeaponFullDef, weapDef.flipKillIcon), CSPFT_BOOL }, + {"dpadIcon", offsetof(WeaponFullDef, weapVariantDef.dpadIcon), CSPFT_MATERIAL }, + {"dpadIconRatio", offsetof(WeaponFullDef, weapVariantDef.dpadIconRatio), WFT_ICONRATIO_DPAD }, + {"noAmmoOnDpadIcon", offsetof(WeaponFullDef, weapVariantDef.noAmmoOnDpadIcon), CSPFT_BOOL }, + {"noPartialReload", offsetof(WeaponFullDef, weapDef.bNoPartialReload), CSPFT_BOOL }, + {"segmentedReload", offsetof(WeaponFullDef, weapDef.bSegmentedReload), CSPFT_BOOL }, + {"noADSAutoReload", offsetof(WeaponFullDef, weapDef.bNoADSAutoReload), CSPFT_BOOL }, + {"reloadAmmoAdd", offsetof(WeaponFullDef, weapDef.iReloadAmmoAdd), CSPFT_INT }, + {"reloadStartAdd", offsetof(WeaponFullDef, weapDef.iReloadStartAdd), CSPFT_INT }, + {"attachmentUnique", offsetof(WeaponFullDef, weapVariantDef.szAttachmentUnique), CSPFT_STRING }, + {"altWeapon", offsetof(WeaponFullDef, weapVariantDef.szAltWeaponName), CSPFT_STRING }, + {"DualWieldWeapon", offsetof(WeaponFullDef, weapDef.szDualWieldWeaponName), CSPFT_STRING }, + {"grenadeWeapon", offsetof(WeaponFullDef, weapDef.szSpawnedGrenadeWeaponName), CSPFT_STRING }, + {"dropAmmoMin", offsetof(WeaponFullDef, weapDef.iDropAmmoMin), CSPFT_INT }, + {"dropAmmoMax", offsetof(WeaponFullDef, weapDef.iDropAmmoMax), CSPFT_INT }, + {"dropClipAmmoMin", offsetof(WeaponFullDef, weapDef.iDropClipAmmoMin), CSPFT_INT }, + {"dropClipAmmoMax", offsetof(WeaponFullDef, weapDef.iDropClipAmmoMax), CSPFT_INT }, + {"blocksProne", offsetof(WeaponFullDef, weapDef.blocksProne), CSPFT_BOOL }, + {"silenced", offsetof(WeaponFullDef, weapVariantDef.bSilenced), CSPFT_BOOL }, + {"dualMag", offsetof(WeaponFullDef, weapVariantDef.bDualMag), CSPFT_BOOL }, + {"infrared", offsetof(WeaponFullDef, weapVariantDef.bInfraRed), CSPFT_BOOL }, + {"tvguided", offsetof(WeaponFullDef, weapVariantDef.bTVGuided), CSPFT_BOOL }, + {"airburstWeapon", offsetof(WeaponFullDef, weapDef.bAirburstWeapon), CSPFT_BOOL }, + {"perks1", offsetof(WeaponFullDef, weapVariantDef.perks[0]), CSPFT_UINT }, + {"perks0", offsetof(WeaponFullDef, weapVariantDef.perks[1]), CSPFT_UINT }, + {"isRollingGrenade", offsetof(WeaponFullDef, weapDef.isRollingGrenade), CSPFT_QBOOLEAN }, + {"useBallisticPrediction", offsetof(WeaponFullDef, weapDef.useBallisticPrediction), CSPFT_QBOOLEAN }, + {"isValuable", offsetof(WeaponFullDef, weapDef.isValuable), CSPFT_QBOOLEAN }, + {"isTacticalInsertion", offsetof(WeaponFullDef, weapDef.isTacticalInsertion), CSPFT_QBOOLEAN }, + {"isReviveWeapon", offsetof(WeaponFullDef, weapDef.isReviveWeapon), CSPFT_BOOL }, + {"bUseRigidBodyOnVehicle", offsetof(WeaponFullDef, weapDef.bUseRigidBodyOnVehicle), CSPFT_BOOL }, + {"showIndicator", offsetof(WeaponFullDef, weapDef.bShowIndicator), CSPFT_BOOL }, + {"explosionRadius", offsetof(WeaponFullDef, weapDef.iExplosionRadius), CSPFT_INT }, + {"explosionRadiusMin", offsetof(WeaponFullDef, weapDef.iExplosionRadiusMin), CSPFT_INT }, + {"indicatorRadius", offsetof(WeaponFullDef, weapDef.iIndicatorRadius), CSPFT_INT }, + {"explosionInnerDamage", offsetof(WeaponFullDef, weapDef.iExplosionInnerDamage), CSPFT_INT }, + {"explosionOuterDamage", offsetof(WeaponFullDef, weapDef.iExplosionOuterDamage), CSPFT_INT }, + {"damageConeAngle", offsetof(WeaponFullDef, weapDef.damageConeAngle), CSPFT_FLOAT }, + {"projectileSpeed", offsetof(WeaponFullDef, weapDef.iProjectileSpeed), CSPFT_INT }, + {"projectileSpeedRelativeUp", offsetof(WeaponFullDef, weapDef.iProjectileSpeedRelativeUp), CSPFT_INT }, + {"projectileSpeedUp", offsetof(WeaponFullDef, weapDef.iProjectileSpeedUp), CSPFT_INT }, + {"projectileSpeedForward", offsetof(WeaponFullDef, weapDef.iProjectileSpeedForward), CSPFT_INT }, + {"projectileTakeParentVel", offsetof(WeaponFullDef, weapDef.fProjectileTakeParentVelocity), CSPFT_FLOAT }, + {"projectileActivateDist", offsetof(WeaponFullDef, weapDef.iProjectileActivateDist), CSPFT_INT }, + {"projectileLifetime", offsetof(WeaponFullDef, weapDef.projLifetime), CSPFT_FLOAT }, + {"timeToAccelerate", offsetof(WeaponFullDef, weapDef.timeToAccelerate), CSPFT_FLOAT }, + {"projectileCurvature", offsetof(WeaponFullDef, weapDef.projectileCurvature), CSPFT_FLOAT }, + {"projectileModel", offsetof(WeaponFullDef, weapDef.projectileModel), CSPFT_XMODEL }, + {"projExplosionType", offsetof(WeaponFullDef, weapDef.projExplosion), WFT_PROJ_EXPLOSION }, + {"projExplosionEffect", offsetof(WeaponFullDef, weapDef.projExplosionEffect), CSPFT_FX }, + {"projExplosionEffectForceNormalUp", offsetof(WeaponFullDef, weapDef.projExplosionEffectForceNormalUp), CSPFT_BOOL }, + {"projExplosionEffect2", offsetof(WeaponFullDef, weapDef.projExplosionEffect2), CSPFT_FX }, + {"projExplosionEffect2ForceNormalUp", offsetof(WeaponFullDef, weapDef.projExplosionEffect2ForceNormalUp), CSPFT_BOOL }, + {"projExplosionEffect3", offsetof(WeaponFullDef, weapDef.projExplosionEffect3), CSPFT_FX }, + {"projExplosionEffect3ForceNormalUp", offsetof(WeaponFullDef, weapDef.projExplosionEffect3ForceNormalUp), CSPFT_BOOL }, + {"projExplosionEffect4", offsetof(WeaponFullDef, weapDef.projExplosionEffect4), CSPFT_FX }, + {"projExplosionEffect4ForceNormalUp", offsetof(WeaponFullDef, weapDef.projExplosionEffect4ForceNormalUp), CSPFT_BOOL }, + {"projExplosionEffect5", offsetof(WeaponFullDef, weapDef.projExplosionEffect5), CSPFT_FX }, + {"projExplosionEffect5ForceNormalUp", offsetof(WeaponFullDef, weapDef.projExplosionEffect5ForceNormalUp), CSPFT_BOOL }, + {"projExplosionSound", offsetof(WeaponFullDef, weapDef.projExplosionSound), CSPFT_STRING }, + {"projDudEffect", offsetof(WeaponFullDef, weapDef.projDudEffect), CSPFT_FX }, + {"projDudSound", offsetof(WeaponFullDef, weapDef.projDudSound), CSPFT_STRING }, + {"projImpactExplode", offsetof(WeaponFullDef, weapDef.bProjImpactExplode), CSPFT_BOOL }, + {"sentientImpactExplode", offsetof(WeaponFullDef, weapDef.bProjSentientImpactExplode), CSPFT_BOOL }, + {"explodeWhenStationary", offsetof(WeaponFullDef, weapDef.bProjExplodeWhenStationary), CSPFT_BOOL }, + {"bulletImpactExplode", offsetof(WeaponFullDef, weapDef.bBulletImpactExplode), CSPFT_BOOL }, + {"mortarShellSound", offsetof(WeaponFullDef, weapDef.mortarShellSound), CSPFT_STRING }, + {"tankShellSound", offsetof(WeaponFullDef, weapDef.tankShellSound), CSPFT_STRING }, + {"stickiness", offsetof(WeaponFullDef, weapDef.stickiness), WFT_STICKINESS }, + {"rotateType", offsetof(WeaponFullDef, weapDef.rotateType), WFT_ROTATETYPE }, + {"hasDetonator", offsetof(WeaponFullDef, weapDef.hasDetonator), CSPFT_BOOL }, + {"plantable", offsetof(WeaponFullDef, weapDef.plantable), CSPFT_BOOL }, + {"timedDetonation", offsetof(WeaponFullDef, weapDef.timedDetonation), CSPFT_BOOL }, + {"noCrumpleMissile", offsetof(WeaponFullDef, weapDef.bNoCrumpleMissile), CSPFT_BOOL }, + {"rotate", offsetof(WeaponFullDef, weapDef.rotate), CSPFT_BOOL }, + {"keepRolling", offsetof(WeaponFullDef, weapDef.bKeepRolling), CSPFT_BOOL }, + {"holdButtonToThrow", offsetof(WeaponFullDef, weapDef.holdButtonToThrow), CSPFT_BOOL }, + {"offhandHoldIsCancelable", offsetof(WeaponFullDef, weapDef.offhandHoldIsCancelable), CSPFT_BOOL }, + {"freezeMovementWhenFiring", offsetof(WeaponFullDef, weapDef.freezeMovementWhenFiring), CSPFT_BOOL }, + {"lowAmmoWarningThreshold", offsetof(WeaponFullDef, weapDef.lowAmmoWarningThreshold), CSPFT_FLOAT }, + {"explosionTag", offsetof(WeaponFullDef, weapDef.explosionTag), WFT_EXPLOSION_TAG }, + {"bDisallowAtMatchStart", offsetof(WeaponFullDef, weapDef.bDisallowAtMatchStart), CSPFT_BOOL }, + {"isCameraSensor", offsetof(WeaponFullDef, weapDef.isCameraSensor), CSPFT_BOOL }, + {"isAcousticSensor", offsetof(WeaponFullDef, weapDef.isAcousticSensor), CSPFT_BOOL }, + {"isLaserSensor", offsetof(WeaponFullDef, weapDef.isLaserSensor), CSPFT_BOOL }, + {"isHoldUseGrenade", offsetof(WeaponFullDef, weapDef.isHoldUseGrenade), CSPFT_BOOL }, + {"parallelDefaultBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_DEFAULT]), CSPFT_FLOAT }, + {"parallelAsphaltBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_ASPHALT]), CSPFT_FLOAT }, + {"parallelBarkBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_BARK]), CSPFT_FLOAT }, + {"parallelBrickBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_BRICK]), CSPFT_FLOAT }, + {"parallelCarpetBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_CARPET]), CSPFT_FLOAT }, + {"parallelCeramicBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_CERAMIC]), CSPFT_FLOAT }, + {"parallelClothBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_CLOTH]), CSPFT_FLOAT }, + {"parallelConcreteBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_CONCRETE]), CSPFT_FLOAT }, + {"parallelCushionBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_CUSHION]), CSPFT_FLOAT }, + {"parallelDirtBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_DIRT]), CSPFT_FLOAT }, + {"parallelFleshBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_FLESH]), CSPFT_FLOAT }, + {"parallelFoliageBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_FOLIAGE]), CSPFT_FLOAT }, + {"parallelFruitBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_FRUIT]), CSPFT_FLOAT }, + {"parallelGlassBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_GLASS]), CSPFT_FLOAT }, + {"parallelGrassBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_GRASS]), CSPFT_FLOAT }, + {"parallelGravelBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_GRAVEL]), CSPFT_FLOAT }, + {"parallelIceBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_ICE]), CSPFT_FLOAT }, + {"parallelMetalBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_METAL]), CSPFT_FLOAT }, + {"parallelMudBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_MUD]), CSPFT_FLOAT }, + {"parallelPaintedMetalBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_PAINTED_METAL]), CSPFT_FLOAT }, + {"parallelPaperBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_PAPER]), CSPFT_FLOAT }, + {"parallelPlasterBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_PLASTER]), CSPFT_FLOAT }, + {"parallelPlasticBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_PLASTIC]), CSPFT_FLOAT }, + {"parallelRockBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_ROCK]), CSPFT_FLOAT }, + {"parallelRubberBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_RUBBER]), CSPFT_FLOAT }, + {"parallelSandBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_SAND]), CSPFT_FLOAT }, + {"parallelSnowBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_SNOW]), CSPFT_FLOAT }, + {"parallelWaterBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_WATER]), CSPFT_FLOAT }, + {"parallelWoodBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_WOOD]), CSPFT_FLOAT }, + {"parallelRiotShieldBounce", offsetof(WeaponFullDef, parallelBounce[SURF_TYPE_RIOT_SHIELD]), CSPFT_FLOAT }, + {"perpendicularDefaultBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_DEFAULT]), CSPFT_FLOAT }, + {"perpendicularAsphaltBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_ASPHALT]), CSPFT_FLOAT }, + {"perpendicularBarkBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_BARK]), CSPFT_FLOAT }, + {"perpendicularBrickBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_BRICK]), CSPFT_FLOAT }, + {"perpendicularCarpetBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_CARPET]), CSPFT_FLOAT }, + {"perpendicularCeramicBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_CERAMIC]), CSPFT_FLOAT }, + {"perpendicularClothBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_CLOTH]), CSPFT_FLOAT }, + {"perpendicularConcreteBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_CONCRETE]), CSPFT_FLOAT }, + {"perpendicularCushionBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_CUSHION]), CSPFT_FLOAT }, + {"perpendicularDirtBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_DIRT]), CSPFT_FLOAT }, + {"perpendicularFleshBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_FLESH]), CSPFT_FLOAT }, + {"perpendicularFoliageBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_FOLIAGE]), CSPFT_FLOAT }, + {"perpendicularFruitBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_FRUIT]), CSPFT_FLOAT }, + {"perpendicularGlassBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_GLASS]), CSPFT_FLOAT }, + {"perpendicularGrassBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_GRASS]), CSPFT_FLOAT }, + {"perpendicularGravelBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_GRAVEL]), CSPFT_FLOAT }, + {"perpendicularIceBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_ICE]), CSPFT_FLOAT }, + {"perpendicularMetalBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_METAL]), CSPFT_FLOAT }, + {"perpendicularMudBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_MUD]), CSPFT_FLOAT }, + {"perpendicularPaintedMetalBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_PAINTED_METAL]), CSPFT_FLOAT }, + {"perpendicularPaperBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_PAPER]), CSPFT_FLOAT }, + {"perpendicularPlasterBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_PLASTER]), CSPFT_FLOAT }, + {"perpendicularPlasticBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_PLASTIC]), CSPFT_FLOAT }, + {"perpendicularRockBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_ROCK]), CSPFT_FLOAT }, + {"perpendicularRubberBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_RUBBER]), CSPFT_FLOAT }, + {"perpendicularSandBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_SAND]), CSPFT_FLOAT }, + {"perpendicularSnowBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_SNOW]), CSPFT_FLOAT }, + {"perpendicularWaterBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_WATER]), CSPFT_FLOAT }, + {"perpendicularWoodBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_WOOD]), CSPFT_FLOAT }, + {"perpendicularRiotShieldBounce", offsetof(WeaponFullDef, perpendicularBounce[SURF_TYPE_RIOT_SHIELD]), CSPFT_FLOAT }, + {"projTrailEffect", offsetof(WeaponFullDef, weapDef.projTrailEffect), CSPFT_FX }, + {"projectileRed", offsetof(WeaponFullDef, weapDef.vProjectileColor.x), CSPFT_FLOAT }, + {"projectileGreen", offsetof(WeaponFullDef, weapDef.vProjectileColor.y), CSPFT_FLOAT }, + {"projectileBlue", offsetof(WeaponFullDef, weapDef.vProjectileColor.z), CSPFT_FLOAT }, + {"guidedMissileType", offsetof(WeaponFullDef, weapDef.guidedMissileType), WFT_GUIDED_MISSILE_TYPE }, + {"maxSteeringAccel", offsetof(WeaponFullDef, weapDef.maxSteeringAccel), CSPFT_FLOAT }, + {"projIgnitionDelay", offsetof(WeaponFullDef, weapDef.projIgnitionDelay), CSPFT_INT }, + {"projIgnitionEffect", offsetof(WeaponFullDef, weapDef.projIgnitionEffect), CSPFT_FX }, + {"projIgnitionSound", offsetof(WeaponFullDef, weapDef.projIgnitionSound), CSPFT_STRING }, + {"tagFx_preparationEffect", offsetof(WeaponFullDef, weapDef.tagFx_preparationEffect), CSPFT_FX }, + {"tagFlash_preparationEffect", offsetof(WeaponFullDef, weapDef.tagFlash_preparationEffect), CSPFT_FX }, + {"adsTransInTime", offsetof(WeaponFullDef, weapVariantDef.iAdsTransInTime), CSPFT_MILLISECONDS }, + {"adsTransOutTime", offsetof(WeaponFullDef, weapVariantDef.iAdsTransOutTime), CSPFT_MILLISECONDS }, + {"adsIdleAmount", offsetof(WeaponFullDef, weapDef.fAdsIdleAmount), CSPFT_FLOAT }, + {"adsIdleSpeed", offsetof(WeaponFullDef, weapDef.adsIdleSpeed), CSPFT_FLOAT }, + {"adsZoomFov1", offsetof(WeaponFullDef, weapVariantDef.fAdsZoomFov1), CSPFT_FLOAT }, + {"adsZoomFov2", offsetof(WeaponFullDef, weapVariantDef.fAdsZoomFov2), CSPFT_FLOAT }, + {"adsZoomFov3", offsetof(WeaponFullDef, weapVariantDef.fAdsZoomFov3), CSPFT_FLOAT }, + {"adsZoomInFrac", offsetof(WeaponFullDef, weapVariantDef.fAdsZoomInFrac), CSPFT_FLOAT }, + {"adsZoomOutFrac", offsetof(WeaponFullDef, weapVariantDef.fAdsZoomOutFrac), CSPFT_FLOAT }, + {"adsOverlayShader", offsetof(WeaponFullDef, weapVariantDef.overlayMaterial), CSPFT_MATERIAL_STREAM }, + {"adsOverlayShaderLowRes", offsetof(WeaponFullDef, weapVariantDef.overlayMaterialLowRes), CSPFT_MATERIAL_STREAM }, + {"adsOverlayReticle", offsetof(WeaponFullDef, weapDef.overlayReticle), WFT_OVERLAYRETICLE }, + {"adsOverlayInterface", offsetof(WeaponFullDef, weapDef.overlayInterface), WFT_OVERLAYINTERFACE }, + {"adsOverlayWidth", offsetof(WeaponFullDef, weapDef.overlayWidth), CSPFT_FLOAT }, + {"adsOverlayHeight", offsetof(WeaponFullDef, weapDef.overlayHeight), CSPFT_FLOAT }, + {"adsOverlayAlphaScale", offsetof(WeaponFullDef, weapVariantDef.fOverlayAlphaScale), CSPFT_FLOAT }, + {"adsBobFactor", offsetof(WeaponFullDef, weapDef.fAdsBobFactor), CSPFT_FLOAT }, + {"adsViewBobMult", offsetof(WeaponFullDef, weapDef.fAdsViewBobMult), CSPFT_FLOAT }, + {"holdBreathToSteady", offsetof(WeaponFullDef, weapDef.bHoldBreathToSteady), CSPFT_BOOL }, + {"adsAimPitch", offsetof(WeaponFullDef, weapDef.fAdsAimPitch), CSPFT_FLOAT }, + {"adsCrosshairInFrac", offsetof(WeaponFullDef, weapDef.fAdsCrosshairInFrac), CSPFT_FLOAT }, + {"adsCrosshairOutFrac", offsetof(WeaponFullDef, weapDef.fAdsCrosshairOutFrac), CSPFT_FLOAT }, + {"adsReloadTransTime", offsetof(WeaponFullDef, weapDef.iPositionReloadTransTime), CSPFT_MILLISECONDS }, + {"adsGunKickReducedKickBullets", offsetof(WeaponFullDef, weapDef.adsGunKickReducedKickBullets), CSPFT_INT }, + {"adsGunKickReducedKickPercent", offsetof(WeaponFullDef, weapDef.adsGunKickReducedKickPercent), CSPFT_FLOAT }, + {"adsGunKickPitchMin", offsetof(WeaponFullDef, weapDef.fAdsGunKickPitchMin), CSPFT_FLOAT }, + {"adsGunKickPitchMax", offsetof(WeaponFullDef, weapDef.fAdsGunKickPitchMax), CSPFT_FLOAT }, + {"adsGunKickYawMin", offsetof(WeaponFullDef, weapDef.fAdsGunKickYawMin), CSPFT_FLOAT }, + {"adsGunKickYawMax", offsetof(WeaponFullDef, weapDef.fAdsGunKickYawMax), CSPFT_FLOAT }, + {"adsGunKickAccel", offsetof(WeaponFullDef, weapDef.fAdsGunKickAccel), CSPFT_FLOAT }, + {"adsGunKickSpeedMax", offsetof(WeaponFullDef, weapDef.fAdsGunKickSpeedMax), CSPFT_FLOAT }, + {"adsGunKickSpeedDecay", offsetof(WeaponFullDef, weapDef.fAdsGunKickSpeedDecay), CSPFT_FLOAT }, + {"adsGunKickStaticDecay", offsetof(WeaponFullDef, weapDef.fAdsGunKickStaticDecay), CSPFT_FLOAT }, + {"adsViewKickPitchMin", offsetof(WeaponFullDef, weapDef.fAdsViewKickPitchMin), CSPFT_FLOAT }, + {"adsViewKickPitchMax", offsetof(WeaponFullDef, weapDef.fAdsViewKickPitchMax), CSPFT_FLOAT }, + {"adsViewKickMinMagnitude", offsetof(WeaponFullDef, weapDef.fAdsViewKickMinMagnitude), CSPFT_FLOAT }, + {"adsViewKickYawMin", offsetof(WeaponFullDef, weapDef.fAdsViewKickYawMin), CSPFT_FLOAT }, + {"adsViewKickYawMax", offsetof(WeaponFullDef, weapDef.fAdsViewKickYawMax), CSPFT_FLOAT }, + {"adsRecoilReductionRate", offsetof(WeaponFullDef, weapDef.fAdsRecoilReductionRate), CSPFT_FLOAT }, + {"adsRecoilReductionLimit", offsetof(WeaponFullDef, weapDef.fAdsRecoilReductionLimit), CSPFT_FLOAT }, + {"adsRecoilReturnRate", offsetof(WeaponFullDef, weapDef.fAdsRecoilReturnRate), CSPFT_FLOAT }, + {"adsViewKickCenterSpeed", offsetof(WeaponFullDef, weapVariantDef.fAdsViewKickCenterSpeed), CSPFT_FLOAT }, + {"adsViewKickCenterDuckedScale", offsetof(WeaponFullDef, weapDef.fAdsViewKickCenterDuckedScale), CSPFT_FLOAT }, + {"adsViewKickCenterProneScale", offsetof(WeaponFullDef, weapDef.fAdsViewKickCenterProneScale), CSPFT_FLOAT }, + {"adsSpread", offsetof(WeaponFullDef, weapDef.fAdsSpread), CSPFT_FLOAT }, + {"guidedMissileType", offsetof(WeaponFullDef, weapDef.guidedMissileType), WFT_GUIDED_MISSILE_TYPE }, + {"antiQuickScopeTime", offsetof(WeaponFullDef, weapDef.fAntiQuickScopeTime), CSPFT_FLOAT }, + {"antiQuickScopeScale", offsetof(WeaponFullDef, weapDef.fAntiQuickScopeScale), CSPFT_FLOAT }, + {"antiQuickScopeSpreadMultiplier", offsetof(WeaponFullDef, weapDef.fAntiQuickScopeSpreadMultiplier), CSPFT_FLOAT }, + {"antiQuickScopeSpreadMax", offsetof(WeaponFullDef, weapDef.fAntiQuickScopeSpreadMax), CSPFT_FLOAT }, + {"antiQuickScopeSwayFactor", offsetof(WeaponFullDef, weapDef.fAntiQuickScopeSwayFactor), CSPFT_FLOAT }, + {"hipSpreadStandMin", offsetof(WeaponFullDef, weapDef.fHipSpreadStandMin), CSPFT_FLOAT }, + {"hipSpreadDuckedMin", offsetof(WeaponFullDef, weapDef.fHipSpreadDuckedMin), CSPFT_FLOAT }, + {"hipSpreadProneMin", offsetof(WeaponFullDef, weapDef.fHipSpreadProneMin), CSPFT_FLOAT }, + {"hipSpreadMax", offsetof(WeaponFullDef, weapDef.hipSpreadStandMax), CSPFT_FLOAT }, + {"hipSpreadDuckedMax", offsetof(WeaponFullDef, weapDef.hipSpreadDuckedMax), CSPFT_FLOAT }, + {"hipSpreadProneMax", offsetof(WeaponFullDef, weapDef.hipSpreadProneMax), CSPFT_FLOAT }, + {"hipSpreadDecayRate", offsetof(WeaponFullDef, weapDef.fHipSpreadDecayRate), CSPFT_FLOAT }, + {"hipSpreadFireAdd", offsetof(WeaponFullDef, weapDef.fHipSpreadFireAdd), CSPFT_FLOAT }, + {"hipSpreadTurnAdd", offsetof(WeaponFullDef, weapDef.fHipSpreadTurnAdd), CSPFT_FLOAT }, + {"hipSpreadMoveAdd", offsetof(WeaponFullDef, weapDef.fHipSpreadMoveAdd), CSPFT_FLOAT }, + {"hipSpreadDuckedDecay", offsetof(WeaponFullDef, weapDef.fHipSpreadDuckedDecay), CSPFT_FLOAT }, + {"hipSpreadProneDecay", offsetof(WeaponFullDef, weapDef.fHipSpreadProneDecay), CSPFT_FLOAT }, + {"hipReticleSidePos", offsetof(WeaponFullDef, weapDef.fHipReticleSidePos), CSPFT_FLOAT }, + {"hipIdleAmount", offsetof(WeaponFullDef, weapDef.fHipIdleAmount), CSPFT_FLOAT }, + {"hipIdleSpeed", offsetof(WeaponFullDef, weapDef.hipIdleSpeed), CSPFT_FLOAT }, + {"hipGunKickReducedKickBullets", offsetof(WeaponFullDef, weapDef.hipGunKickReducedKickBullets), CSPFT_INT }, + {"hipGunKickReducedKickPercent", offsetof(WeaponFullDef, weapDef.hipGunKickReducedKickPercent), CSPFT_FLOAT }, + {"hipGunKickPitchMin", offsetof(WeaponFullDef, weapDef.fHipGunKickPitchMin), CSPFT_FLOAT }, + {"hipGunKickPitchMax", offsetof(WeaponFullDef, weapDef.fHipGunKickPitchMax), CSPFT_FLOAT }, + {"hipGunKickYawMin", offsetof(WeaponFullDef, weapDef.fHipGunKickYawMin), CSPFT_FLOAT }, + {"hipGunKickYawMax", offsetof(WeaponFullDef, weapDef.fHipGunKickYawMax), CSPFT_FLOAT }, + {"hipGunKickAccel", offsetof(WeaponFullDef, weapDef.fHipGunKickAccel), CSPFT_FLOAT }, + {"hipGunKickSpeedMax", offsetof(WeaponFullDef, weapDef.fHipGunKickSpeedMax), CSPFT_FLOAT }, + {"hipGunKickSpeedDecay", offsetof(WeaponFullDef, weapDef.fHipGunKickSpeedDecay), CSPFT_FLOAT }, + {"hipGunKickStaticDecay", offsetof(WeaponFullDef, weapDef.fHipGunKickStaticDecay), CSPFT_FLOAT }, + {"hipViewKickPitchMin", offsetof(WeaponFullDef, weapDef.fHipViewKickPitchMin), CSPFT_FLOAT }, + {"hipViewKickPitchMax", offsetof(WeaponFullDef, weapDef.fHipViewKickPitchMax), CSPFT_FLOAT }, + {"hipViewKickMinMagnitude", offsetof(WeaponFullDef, weapDef.fHipViewKickMinMagnitude), CSPFT_FLOAT }, + {"hipViewKickYawMin", offsetof(WeaponFullDef, weapDef.fHipViewKickYawMin), CSPFT_FLOAT }, + {"hipViewKickYawMax", offsetof(WeaponFullDef, weapDef.fHipViewKickYawMax), CSPFT_FLOAT }, + {"hipViewKickCenterSpeed", offsetof(WeaponFullDef, weapVariantDef.fHipViewKickCenterSpeed), CSPFT_FLOAT }, + {"leftArc", offsetof(WeaponFullDef, weapDef.leftArc), CSPFT_FLOAT }, + {"rightArc", offsetof(WeaponFullDef, weapDef.rightArc), CSPFT_FLOAT }, + {"topArc", offsetof(WeaponFullDef, weapDef.topArc), CSPFT_FLOAT }, + {"bottomArc", offsetof(WeaponFullDef, weapDef.bottomArc), CSPFT_FLOAT }, + {"accuracy", offsetof(WeaponFullDef, weapDef.accuracy), CSPFT_FLOAT }, + {"aiSpread", offsetof(WeaponFullDef, weapDef.aiSpread), CSPFT_FLOAT }, + {"playerSpread", offsetof(WeaponFullDef, weapDef.playerSpread), CSPFT_FLOAT }, + {"maxVertTurnSpeed", offsetof(WeaponFullDef, weapDef.maxTurnSpeed[0]), CSPFT_FLOAT }, + {"maxHorTurnSpeed", offsetof(WeaponFullDef, weapDef.maxTurnSpeed[1]), CSPFT_FLOAT }, + {"minVertTurnSpeed", offsetof(WeaponFullDef, weapDef.minTurnSpeed[0]), CSPFT_FLOAT }, + {"minHorTurnSpeed", offsetof(WeaponFullDef, weapDef.minTurnSpeed[1]), CSPFT_FLOAT }, + {"pitchConvergenceTime", offsetof(WeaponFullDef, weapDef.pitchConvergenceTime), CSPFT_FLOAT }, + {"yawConvergenceTime", offsetof(WeaponFullDef, weapDef.yawConvergenceTime), CSPFT_FLOAT }, + {"suppressionTime", offsetof(WeaponFullDef, weapDef.suppressTime), CSPFT_FLOAT }, + {"maxRange", offsetof(WeaponFullDef, weapDef.maxRange), CSPFT_FLOAT }, + {"animHorRotateInc", offsetof(WeaponFullDef, weapDef.fAnimHorRotateInc), CSPFT_FLOAT }, + {"playerPositionDist", offsetof(WeaponFullDef, weapDef.fPlayerPositionDist), CSPFT_FLOAT }, + {"stance", offsetof(WeaponFullDef, weapDef.stance), WFT_STANCE }, + {"useHintString", offsetof(WeaponFullDef, weapDef.szUseHintString), CSPFT_STRING }, + {"dropHintString", offsetof(WeaponFullDef, weapDef.dropHintString), CSPFT_STRING }, + {"horizViewJitter", offsetof(WeaponFullDef, weapDef.horizViewJitter), CSPFT_FLOAT }, + {"vertViewJitter", offsetof(WeaponFullDef, weapDef.vertViewJitter), CSPFT_FLOAT }, + {"cameraShakeScale", offsetof(WeaponFullDef, weapDef.cameraShakeScale), CSPFT_FLOAT }, + {"cameraShakeDuration", offsetof(WeaponFullDef, weapDef.cameraShakeDuration), CSPFT_INT }, + {"cameraShakeRadius", offsetof(WeaponFullDef, weapDef.cameraShakeRadius), CSPFT_INT }, + {"explosionCameraShakeScale", offsetof(WeaponFullDef, weapDef.explosionCameraShakeScale), CSPFT_FLOAT }, + {"explosionCameraShakeDuration", offsetof(WeaponFullDef, weapDef.explosionCameraShakeDuration), CSPFT_INT }, + {"explosionCameraShakeRadius", offsetof(WeaponFullDef, weapDef.explosionCameraShakeRadius), CSPFT_INT }, + {"fightDist", offsetof(WeaponFullDef, weapDef.fightDist), CSPFT_FLOAT }, + {"maxDist", offsetof(WeaponFullDef, weapDef.maxDist), CSPFT_FLOAT }, + {"aiVsAiAccuracyGraph", offsetof(WeaponFullDef, weapDef.accuracyGraphName0), CSPFT_STRING }, + {"aiVsPlayerAccuracyGraph", offsetof(WeaponFullDef, weapDef.accuracyGraphName1), CSPFT_STRING }, + {"locNone", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_NONE]), CSPFT_FLOAT }, + {"locHelmet", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_HELMET]), CSPFT_FLOAT }, + {"locHead", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_HEAD]), CSPFT_FLOAT }, + {"locNeck", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_NECK]), CSPFT_FLOAT }, + {"locTorsoUpper", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_TORSO_UPR]), CSPFT_FLOAT }, + {"locTorsoMid", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_TORSO_MID]), CSPFT_FLOAT }, + {"locTorsoLower", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_TORSO_LWR]), CSPFT_FLOAT }, + {"locRightArmUpper", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_R_ARM_UPR]), CSPFT_FLOAT }, + {"locRightArmLower", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_R_ARM_LWR]), CSPFT_FLOAT }, + {"locRightHand", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_R_HAND]), CSPFT_FLOAT }, + {"locLeftArmUpper", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_L_ARM_UPR]), CSPFT_FLOAT }, + {"locLeftArmLower", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_L_ARM_LWR]), CSPFT_FLOAT }, + {"locLeftHand", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_L_HAND]), CSPFT_FLOAT }, + {"locRightLegUpper", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_R_LEG_UPR]), CSPFT_FLOAT }, + {"locRightLegLower", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_R_LEG_LWR]), CSPFT_FLOAT }, + {"locRightFoot", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_R_FOOT]), CSPFT_FLOAT }, + {"locLeftLegUpper", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_L_LEG_UPR]), CSPFT_FLOAT }, + {"locLeftLegLower", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_L_LEG_LWR]), CSPFT_FLOAT }, + {"locLeftFoot", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_L_FOOT]), CSPFT_FLOAT }, + {"locGun", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_GUN]), CSPFT_FLOAT }, + {"fireRumble", offsetof(WeaponFullDef, weapDef.fireRumble), CSPFT_STRING }, + {"meleeImpactRumble", offsetof(WeaponFullDef, weapDef.meleeImpactRumble), CSPFT_STRING }, + {"reloadRumble", offsetof(WeaponFullDef, weapDef.reloadRumble), CSPFT_STRING }, + {"explosionRumble", offsetof(WeaponFullDef, weapDef.explosionRumble), CSPFT_STRING }, + {"tracerType", offsetof(WeaponFullDef, weapDef.tracerType), CSPFT_TRACER }, + {"enemyTracerType", offsetof(WeaponFullDef, weapDef.enemyTracerType), CSPFT_TRACER }, + {"adsDofStart", offsetof(WeaponFullDef, weapDef.adsDofStart), CSPFT_FLOAT }, + {"adsDofEnd", offsetof(WeaponFullDef, weapDef.adsDofEnd), CSPFT_FLOAT }, + {"scanSpeed", offsetof(WeaponFullDef, weapDef.scanSpeed), CSPFT_FLOAT }, + {"scanAccel", offsetof(WeaponFullDef, weapDef.scanAccel), CSPFT_FLOAT }, + {"scanPauseTime", offsetof(WeaponFullDef, weapDef.scanPauseTime), CSPFT_MILLISECONDS }, + {"flameTableFirstPerson", offsetof(WeaponFullDef, weapDef.flameTableFirstPerson), CSPFT_STRING }, + {"flameTableThirdPerson", offsetof(WeaponFullDef, weapDef.flameTableThirdPerson), CSPFT_STRING }, + {"mmsWeapon", offsetof(WeaponFullDef, weapVariantDef.mmsWeapon), CSPFT_BOOL }, + {"mmsInScope", offsetof(WeaponFullDef, weapVariantDef.mmsInScope), CSPFT_BOOL }, + {"mmsFOV", offsetof(WeaponFullDef, weapVariantDef.mmsFOV), CSPFT_FLOAT }, + {"mmsAspect", offsetof(WeaponFullDef, weapVariantDef.mmsAspect), CSPFT_FLOAT }, + {"mmsMaxDist", offsetof(WeaponFullDef, weapVariantDef.mmsMaxDist), CSPFT_FLOAT }, + {"ikLeftHandIdlePosF", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandIdlePos.x), CSPFT_FLOAT }, + {"ikLeftHandIdlePosR", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandIdlePos.y), CSPFT_FLOAT }, + {"ikLeftHandIdlePosU", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandIdlePos.z), CSPFT_FLOAT }, + {"ikLeftHandOffsetF", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandOffset.x), CSPFT_FLOAT }, + {"ikLeftHandOffsetR", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandOffset.y), CSPFT_FLOAT }, + {"ikLeftHandOffsetU", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandOffset.z), CSPFT_FLOAT }, + {"ikLeftHandRotationP", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandRotation.x), CSPFT_FLOAT }, + {"ikLeftHandRotationY", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandRotation.y), CSPFT_FLOAT }, + {"ikLeftHandRotationR", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandRotation.z), CSPFT_FLOAT }, + {"usingLeftHandProneIK", offsetof(WeaponFullDef, weapVariantDef.bUsingLeftHandProneIK), CSPFT_BOOL }, + {"ikLeftHandProneOffsetF", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandProneOffset.x), CSPFT_FLOAT }, + {"ikLeftHandProneOffsetR", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandProneOffset.y), CSPFT_FLOAT }, + {"ikLeftHandProneOffsetU", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandProneOffset.z), CSPFT_FLOAT }, + {"ikLeftHandProneRotationP", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandProneRotation.x), CSPFT_FLOAT }, + {"ikLeftHandProneRotationY", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandProneRotation.y), CSPFT_FLOAT }, + {"ikLeftHandProneRotationR", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandProneRotation.z), CSPFT_FLOAT }, + {"ikLeftHandUiViewerOffsetF", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandUiViewerOffset.x), CSPFT_FLOAT }, + {"ikLeftHandUiViewerOffsetR", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandUiViewerOffset.y), CSPFT_FLOAT }, + {"ikLeftHandUiViewerOffsetU", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandUiViewerOffset.z), CSPFT_FLOAT }, + {"ikLeftHandUiViewerRotationP", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandUiViewerRotation.x), CSPFT_FLOAT }, + {"ikLeftHandUiViewerRotationY", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandUiViewerRotation.y), CSPFT_FLOAT }, + {"ikLeftHandUiViewerRotationR", offsetof(WeaponFullDef, weapVariantDef.ikLeftHandUiViewerRotation.z), CSPFT_FLOAT }, + {"parentWeaponName", offsetof(WeaponFullDef, weapDef.parentWeaponName), CSPFT_STRING }, + {"doGibbing", offsetof(WeaponFullDef, weapDef.doGibbing), CSPFT_BOOL }, + {"maxGibDistance", offsetof(WeaponFullDef, weapDef.maxGibDistance), CSPFT_FLOAT }, + {"altScopeADSTransInTime", offsetof(WeaponFullDef, weapDef.altScopeADSTransInTime), CSPFT_FLOAT }, + {"altScopeADSTransOutTime", offsetof(WeaponFullDef, weapDef.altScopeADSTransOutTime), CSPFT_FLOAT }, + {"meleeSwipeEffect", offsetof(WeaponFullDef, weapDef.meleeSwipeEffect), CSPFT_FX }, + {"meleeImpactEffect", offsetof(WeaponFullDef, weapDef.meleeImpactEffect), CSPFT_FX }, + {"meleeImpactNoBloodEffect", offsetof(WeaponFullDef, weapDef.meleeImpactNoBloodEffect), CSPFT_FX }, + {"throwBackType", offsetof(WeaponFullDef, weapDef.throwBackType), CSPFT_STRING }, + {"camo", offsetof(WeaponFullDef, weapDef.weaponCamo), WFT_WEAPON_CAMO }, + {"customFloat0", offsetof(WeaponFullDef, weapDef.customFloat0), CSPFT_FLOAT }, + {"customFloat1", offsetof(WeaponFullDef, weapDef.customFloat1), CSPFT_FLOAT }, + {"customFloat2", offsetof(WeaponFullDef, weapDef.customFloat2), CSPFT_FLOAT }, + {"customBool0", offsetof(WeaponFullDef, weapDef.customBool0), CSPFT_BOOL }, + {"customBool1", offsetof(WeaponFullDef, weapDef.customBool1), CSPFT_BOOL }, + {"customBool2", offsetof(WeaponFullDef, weapDef.customBool2), CSPFT_BOOL }, + {"attachments", offsetof(WeaponFullDef, attachments), WFT_ATTACHMENTS }, + {"attachmentUniques", offsetof(WeaponFullDef, attachmentUniques), WFT_ATTACHMENT_UNIQUES }, }; -} \ No newline at end of file +} diff --git a/src/ObjCommon/Game/T6/InfoString/ZBarrierFields.h b/src/ObjCommon/Game/T6/InfoString/ZBarrierFields.h index 2d7e3d8f7..302f99f82 100644 --- a/src/ObjCommon/Game/T6/InfoString/ZBarrierFields.h +++ b/src/ObjCommon/Game/T6/InfoString/ZBarrierFields.h @@ -3,152 +3,151 @@ namespace T6 { - inline cspField_t zbarrier_fields[] - { - {"delayBetweenGeneralRepSounds", offsetof(ZBarrierDef, delayBetweenRepSoundsDuration), CSPFT_FLOAT}, - {"earthquakeMaxDuration", offsetof(ZBarrierDef, earthquakeMaxDuration), CSPFT_FLOAT}, - {"earthquakeMaxScale", offsetof(ZBarrierDef, earthquakeMaxScale), CSPFT_FLOAT}, - {"earthquakeMinDuration", offsetof(ZBarrierDef, earthquakeMinDuration), CSPFT_FLOAT}, - {"earthquakeMinScale", offsetof(ZBarrierDef, earthquakeMinScale), CSPFT_FLOAT}, - {"earthquakeOnRepair", offsetof(ZBarrierDef, earthquakeOnRepair), CSPFT_UINT}, - {"earthquakeRadius", offsetof(ZBarrierDef, earthquakeRadius), CSPFT_FLOAT}, - {"generalRepairSound0", offsetof(ZBarrierDef, generalRepairSound1), CSPFT_SOUND_ALIAS_ID}, - {"generalRepairSound1", offsetof(ZBarrierDef, generalRepairSound2), CSPFT_SOUND_ALIAS_ID}, - {"upgradedGeneralRepairSound0", offsetof(ZBarrierDef, upgradedGeneralRepairSound1), CSPFT_SOUND_ALIAS_ID}, - {"upgradedGeneralRepairSound1", offsetof(ZBarrierDef, upgradedGeneralRepairSound2), CSPFT_SOUND_ALIAS_ID}, - {"useDelayBetweenGeneralRepSounds", offsetof(ZBarrierDef, delayBetweenRepSounds), CSPFT_UINT}, - {"taunts", offsetof(ZBarrierDef, taunts), CSPFT_UINT}, - {"reachThroughAttacks", offsetof(ZBarrierDef, reachThroughAttacks), CSPFT_UINT}, - {"zombieTauntAnimState", offsetof(ZBarrierDef, zombieTauntAnimState), CSPFT_SCRIPT_STRING}, - {"zombieReachThroughAnimState", offsetof(ZBarrierDef, zombieReachThroughAnimState), CSPFT_SCRIPT_STRING}, - {"numAttackSlots", offsetof(ZBarrierDef, numAttackSlots), CSPFT_UINT}, - {"attackSpotHorzOffset", offsetof(ZBarrierDef, attackSpotHorzOffset), CSPFT_FLOAT}, - {"autoHideOpenPieces", offsetof(ZBarrierDef, autoHideOpenPieces), CSPFT_UINT}, - {"alternateBoardModel1", offsetof(ZBarrierDef, boards[0].pAlternateBoardModel), CSPFT_XMODEL}, - {"boardAnim1", offsetof(ZBarrierDef, boards[0].pBoardAnim), CSPFT_STRING}, - {"boardModel1", offsetof(ZBarrierDef, boards[0].pBoardModel), CSPFT_XMODEL}, - {"boardRepairSound1", offsetof(ZBarrierDef, boards[0].boardRepairSound), CSPFT_SOUND_ALIAS_ID}, - {"boardRepairHoverSound1", offsetof(ZBarrierDef, boards[0].boardRepairHoverSound), CSPFT_SOUND_ALIAS_ID}, - {"OffsetRepairFxX10", offsetof(ZBarrierDef, boards[0].repairEffect1Offset.x), CSPFT_FLOAT}, - {"OffsetRepairFxX11", offsetof(ZBarrierDef, boards[0].repairEffect2Offset.x), CSPFT_FLOAT}, - {"OffsetRepairFxY10", offsetof(ZBarrierDef, boards[0].repairEffect1Offset.y), CSPFT_FLOAT}, - {"OffsetRepairFxY11", offsetof(ZBarrierDef, boards[0].repairEffect2Offset.y), CSPFT_FLOAT}, - {"OffsetRepairFxZ10", offsetof(ZBarrierDef, boards[0].repairEffect1Offset.z), CSPFT_FLOAT}, - {"OffsetRepairFxZ11", offsetof(ZBarrierDef, boards[0].repairEffect2Offset.z), CSPFT_FLOAT}, - {"pauseAndRepeatBoardRepairSound1", offsetof(ZBarrierDef, boards[0].pauseAndRepeatRepSound), CSPFT_UINT}, - {"pauseBetweenRepSoundsMax1", offsetof(ZBarrierDef, boards[0].maxPause), CSPFT_FLOAT}, - {"pauseBetweenRepSoundsMin1", offsetof(ZBarrierDef, boards[0].minPause), CSPFT_FLOAT}, - {"proBoardNumRepsToTear1", offsetof(ZBarrierDef, boards[0].numRepsToPullProBoard), CSPFT_UINT}, - {"repairFx10", offsetof(ZBarrierDef, boards[0].repairEffect1), CSPFT_FX}, - {"repairFx11", offsetof(ZBarrierDef, boards[0].repairEffect2), CSPFT_FX}, - {"tearAnim1", offsetof(ZBarrierDef, boards[0].pTearAnim), CSPFT_STRING}, - {"upgradedBoardModel1", offsetof(ZBarrierDef, boards[0].pUpgradedBoardModel), CSPFT_XMODEL}, - {"zombieBoardTearAnimState1", offsetof(ZBarrierDef, boards[0].zombieBoardTearStateName), CSPFT_SCRIPT_STRING}, - {"zombieBoardTearAnimSubState1", offsetof(ZBarrierDef, boards[0].zombieBoardTearSubStateName), CSPFT_SCRIPT_STRING}, - {"alternateBoardModel2", offsetof(ZBarrierDef, boards[1].pAlternateBoardModel), CSPFT_XMODEL}, - {"boardAnim2", offsetof(ZBarrierDef, boards[1].pBoardAnim), CSPFT_STRING}, - {"boardModel2", offsetof(ZBarrierDef, boards[1].pBoardModel), CSPFT_XMODEL}, - {"boardRepairSound2", offsetof(ZBarrierDef, boards[1].boardRepairSound), CSPFT_SOUND_ALIAS_ID}, - {"boardRepairHoverSound2", offsetof(ZBarrierDef, boards[1].boardRepairHoverSound), CSPFT_SOUND_ALIAS_ID}, - {"OffsetRepairFxX20", offsetof(ZBarrierDef, boards[1].repairEffect1Offset.x), CSPFT_FLOAT}, - {"OffsetRepairFxX21", offsetof(ZBarrierDef, boards[1].repairEffect2Offset.x), CSPFT_FLOAT}, - {"OffsetRepairFxY20", offsetof(ZBarrierDef, boards[1].repairEffect1Offset.y), CSPFT_FLOAT}, - {"OffsetRepairFxY21", offsetof(ZBarrierDef, boards[1].repairEffect2Offset.y), CSPFT_FLOAT}, - {"OffsetRepairFxZ20", offsetof(ZBarrierDef, boards[1].repairEffect1Offset.z), CSPFT_FLOAT}, - {"OffsetRepairFxZ21", offsetof(ZBarrierDef, boards[1].repairEffect2Offset.z), CSPFT_FLOAT}, - {"pauseAndRepeatBoardRepairSound2", offsetof(ZBarrierDef, boards[1].pauseAndRepeatRepSound), CSPFT_UINT}, - {"pauseBetweenRepSoundsMax2", offsetof(ZBarrierDef, boards[1].maxPause), CSPFT_FLOAT}, - {"pauseBetweenRepSoundsMin2", offsetof(ZBarrierDef, boards[1].minPause), CSPFT_FLOAT}, - {"proBoardNumRepsToTear2", offsetof(ZBarrierDef, boards[1].numRepsToPullProBoard), CSPFT_UINT}, - {"repairFx20", offsetof(ZBarrierDef, boards[1].repairEffect1), CSPFT_FX}, - {"repairFx21", offsetof(ZBarrierDef, boards[1].repairEffect2), CSPFT_FX}, - {"tearAnim2", offsetof(ZBarrierDef, boards[1].pTearAnim), CSPFT_STRING}, - {"upgradedBoardModel2", offsetof(ZBarrierDef, boards[1].pUpgradedBoardModel), CSPFT_XMODEL}, - {"zombieBoardTearAnimState2", offsetof(ZBarrierDef, boards[1].zombieBoardTearStateName), CSPFT_SCRIPT_STRING}, - {"zombieBoardTearAnimSubState2", offsetof(ZBarrierDef, boards[1].zombieBoardTearSubStateName), CSPFT_SCRIPT_STRING}, - {"alternateBoardModel3", offsetof(ZBarrierDef, boards[2].pAlternateBoardModel), CSPFT_XMODEL}, - {"boardAnim3", offsetof(ZBarrierDef, boards[2].pBoardAnim), CSPFT_STRING}, - {"boardModel3", offsetof(ZBarrierDef, boards[2].pBoardModel), CSPFT_XMODEL}, - {"boardRepairSound3", offsetof(ZBarrierDef, boards[2].boardRepairSound), CSPFT_SOUND_ALIAS_ID}, - {"boardRepairHoverSound3", offsetof(ZBarrierDef, boards[2].boardRepairHoverSound), CSPFT_SOUND_ALIAS_ID}, - {"OffsetRepairFxX30", offsetof(ZBarrierDef, boards[2].repairEffect1Offset.x), CSPFT_FLOAT}, - {"OffsetRepairFxX31", offsetof(ZBarrierDef, boards[2].repairEffect2Offset.x), CSPFT_FLOAT}, - {"OffsetRepairFxY30", offsetof(ZBarrierDef, boards[2].repairEffect1Offset.y), CSPFT_FLOAT}, - {"OffsetRepairFxY31", offsetof(ZBarrierDef, boards[2].repairEffect2Offset.y), CSPFT_FLOAT}, - {"OffsetRepairFxZ30", offsetof(ZBarrierDef, boards[2].repairEffect1Offset.z), CSPFT_FLOAT}, - {"OffsetRepairFxZ31", offsetof(ZBarrierDef, boards[2].repairEffect2Offset.z), CSPFT_FLOAT}, - {"pauseAndRepeatBoardRepairSound3", offsetof(ZBarrierDef, boards[2].pauseAndRepeatRepSound), CSPFT_UINT}, - {"pauseBetweenRepSoundsMax3", offsetof(ZBarrierDef, boards[2].maxPause), CSPFT_FLOAT}, - {"pauseBetweenRepSoundsMin3", offsetof(ZBarrierDef, boards[2].minPause), CSPFT_FLOAT}, - {"proBoardNumRepsToTear3", offsetof(ZBarrierDef, boards[2].numRepsToPullProBoard), CSPFT_UINT}, - {"repairFx30", offsetof(ZBarrierDef, boards[2].repairEffect1), CSPFT_FX}, - {"repairFx31", offsetof(ZBarrierDef, boards[2].repairEffect2), CSPFT_FX}, - {"tearAnim3", offsetof(ZBarrierDef, boards[2].pTearAnim), CSPFT_STRING}, - {"upgradedBoardModel3", offsetof(ZBarrierDef, boards[2].pUpgradedBoardModel), CSPFT_XMODEL}, - {"zombieBoardTearAnimState3", offsetof(ZBarrierDef, boards[2].zombieBoardTearStateName), CSPFT_SCRIPT_STRING}, - {"zombieBoardTearAnimSubState3", offsetof(ZBarrierDef, boards[2].zombieBoardTearSubStateName), CSPFT_SCRIPT_STRING}, - {"alternateBoardModel4", offsetof(ZBarrierDef, boards[3].pAlternateBoardModel), CSPFT_XMODEL}, - {"boardAnim4", offsetof(ZBarrierDef, boards[3].pBoardAnim), CSPFT_STRING}, - {"boardModel4", offsetof(ZBarrierDef, boards[3].pBoardModel), CSPFT_XMODEL}, - {"boardRepairSound4", offsetof(ZBarrierDef, boards[3].boardRepairSound), CSPFT_SOUND_ALIAS_ID}, - {"boardRepairHoverSound4", offsetof(ZBarrierDef, boards[3].boardRepairHoverSound), CSPFT_SOUND_ALIAS_ID}, - {"OffsetRepairFxX40", offsetof(ZBarrierDef, boards[3].repairEffect1Offset.x), CSPFT_FLOAT}, - {"OffsetRepairFxX41", offsetof(ZBarrierDef, boards[3].repairEffect2Offset.x), CSPFT_FLOAT}, - {"OffsetRepairFxY40", offsetof(ZBarrierDef, boards[3].repairEffect1Offset.y), CSPFT_FLOAT}, - {"OffsetRepairFxY41", offsetof(ZBarrierDef, boards[3].repairEffect2Offset.y), CSPFT_FLOAT}, - {"OffsetRepairFxZ40", offsetof(ZBarrierDef, boards[3].repairEffect1Offset.z), CSPFT_FLOAT}, - {"OffsetRepairFxZ41", offsetof(ZBarrierDef, boards[3].repairEffect2Offset.z), CSPFT_FLOAT}, - {"pauseAndRepeatBoardRepairSound4", offsetof(ZBarrierDef, boards[3].pauseAndRepeatRepSound), CSPFT_UINT}, - {"pauseBetweenRepSoundsMax4", offsetof(ZBarrierDef, boards[3].maxPause), CSPFT_FLOAT}, - {"pauseBetweenRepSoundsMin4", offsetof(ZBarrierDef, boards[3].minPause), CSPFT_FLOAT}, - {"proBoardNumRepsToTear4", offsetof(ZBarrierDef, boards[3].numRepsToPullProBoard), CSPFT_UINT}, - {"repairFx40", offsetof(ZBarrierDef, boards[3].repairEffect1), CSPFT_FX}, - {"repairFx41", offsetof(ZBarrierDef, boards[3].repairEffect2), CSPFT_FX}, - {"tearAnim4", offsetof(ZBarrierDef, boards[3].pTearAnim), CSPFT_STRING}, - {"upgradedBoardModel4", offsetof(ZBarrierDef, boards[3].pUpgradedBoardModel), CSPFT_XMODEL}, - {"zombieBoardTearAnimState4", offsetof(ZBarrierDef, boards[3].zombieBoardTearStateName), CSPFT_SCRIPT_STRING}, - {"zombieBoardTearAnimSubState4", offsetof(ZBarrierDef, boards[3].zombieBoardTearSubStateName), CSPFT_SCRIPT_STRING}, - {"alternateBoardModel5", offsetof(ZBarrierDef, boards[4].pAlternateBoardModel), CSPFT_XMODEL}, - {"boardAnim5", offsetof(ZBarrierDef, boards[4].pBoardAnim), CSPFT_STRING}, - {"boardModel5", offsetof(ZBarrierDef, boards[4].pBoardModel), CSPFT_XMODEL}, - {"boardRepairSound5", offsetof(ZBarrierDef, boards[4].boardRepairSound), CSPFT_SOUND_ALIAS_ID}, - {"boardRepairHoverSound5", offsetof(ZBarrierDef, boards[4].boardRepairHoverSound), CSPFT_SOUND_ALIAS_ID}, - {"OffsetRepairFxX50", offsetof(ZBarrierDef, boards[4].repairEffect1Offset.x), CSPFT_FLOAT}, - {"OffsetRepairFxX51", offsetof(ZBarrierDef, boards[4].repairEffect2Offset.x), CSPFT_FLOAT}, - {"OffsetRepairFxY50", offsetof(ZBarrierDef, boards[4].repairEffect1Offset.y), CSPFT_FLOAT}, - {"OffsetRepairFxY51", offsetof(ZBarrierDef, boards[4].repairEffect2Offset.y), CSPFT_FLOAT}, - {"OffsetRepairFxZ50", offsetof(ZBarrierDef, boards[4].repairEffect1Offset.z), CSPFT_FLOAT}, - {"OffsetRepairFxZ51", offsetof(ZBarrierDef, boards[4].repairEffect2Offset.z), CSPFT_FLOAT}, - {"pauseAndRepeatBoardRepairSound5", offsetof(ZBarrierDef, boards[4].pauseAndRepeatRepSound), CSPFT_UINT}, - {"pauseBetweenRepSoundsMax5", offsetof(ZBarrierDef, boards[4].maxPause), CSPFT_FLOAT}, - {"pauseBetweenRepSoundsMin5", offsetof(ZBarrierDef, boards[4].minPause), CSPFT_FLOAT}, - {"proBoardNumRepsToTear5", offsetof(ZBarrierDef, boards[4].numRepsToPullProBoard), CSPFT_UINT}, - {"repairFx50", offsetof(ZBarrierDef, boards[4].repairEffect1), CSPFT_FX}, - {"repairFx51", offsetof(ZBarrierDef, boards[4].repairEffect2), CSPFT_FX}, - {"tearAnim5", offsetof(ZBarrierDef, boards[4].pTearAnim), CSPFT_STRING}, - {"upgradedBoardModel5", offsetof(ZBarrierDef, boards[4].pUpgradedBoardModel), CSPFT_XMODEL}, - {"zombieBoardTearAnimState5", offsetof(ZBarrierDef, boards[4].zombieBoardTearStateName), CSPFT_SCRIPT_STRING}, - {"zombieBoardTearAnimSubState5", offsetof(ZBarrierDef, boards[4].zombieBoardTearSubStateName), CSPFT_SCRIPT_STRING}, - {"alternateBoardModel6", offsetof(ZBarrierDef, boards[5].pAlternateBoardModel), CSPFT_XMODEL}, - {"boardAnim6", offsetof(ZBarrierDef, boards[5].pBoardAnim), CSPFT_STRING}, - {"boardModel6", offsetof(ZBarrierDef, boards[5].pBoardModel), CSPFT_XMODEL}, - {"boardRepairSound6", offsetof(ZBarrierDef, boards[5].boardRepairSound), CSPFT_SOUND_ALIAS_ID}, - {"boardRepairHoverSound6", offsetof(ZBarrierDef, boards[5].boardRepairHoverSound), CSPFT_SOUND_ALIAS_ID}, - {"OffsetRepairFxX60", offsetof(ZBarrierDef, boards[5].repairEffect1Offset.x), CSPFT_FLOAT}, - {"OffsetRepairFxX61", offsetof(ZBarrierDef, boards[5].repairEffect2Offset.x), CSPFT_FLOAT}, - {"OffsetRepairFxY60", offsetof(ZBarrierDef, boards[5].repairEffect1Offset.y), CSPFT_FLOAT}, - {"OffsetRepairFxY61", offsetof(ZBarrierDef, boards[5].repairEffect2Offset.y), CSPFT_FLOAT}, - {"OffsetRepairFxZ60", offsetof(ZBarrierDef, boards[5].repairEffect1Offset.z), CSPFT_FLOAT}, - {"OffsetRepairFxZ61", offsetof(ZBarrierDef, boards[5].repairEffect2Offset.z), CSPFT_FLOAT}, - {"pauseAndRepeatBoardRepairSound6", offsetof(ZBarrierDef, boards[5].pauseAndRepeatRepSound), CSPFT_UINT}, - {"pauseBetweenRepSoundsMax6", offsetof(ZBarrierDef, boards[5].maxPause), CSPFT_FLOAT}, - {"pauseBetweenRepSoundsMin6", offsetof(ZBarrierDef, boards[5].minPause), CSPFT_FLOAT}, - {"proBoardNumRepsToTear6", offsetof(ZBarrierDef, boards[5].numRepsToPullProBoard), CSPFT_UINT}, - {"repairFx60", offsetof(ZBarrierDef, boards[5].repairEffect1), CSPFT_FX}, - {"repairFx61", offsetof(ZBarrierDef, boards[5].repairEffect2), CSPFT_FX}, - {"tearAnim6", offsetof(ZBarrierDef, boards[5].pTearAnim), CSPFT_STRING}, - {"upgradedBoardModel6", offsetof(ZBarrierDef, boards[5].pUpgradedBoardModel), CSPFT_XMODEL}, - {"zombieBoardTearAnimState6", offsetof(ZBarrierDef, boards[5].zombieBoardTearStateName), CSPFT_SCRIPT_STRING}, - {"zombieBoardTearAnimSubState6", offsetof(ZBarrierDef, boards[5].zombieBoardTearSubStateName), CSPFT_SCRIPT_STRING}, + inline cspField_t zbarrier_fields[]{ + {"delayBetweenGeneralRepSounds", offsetof(ZBarrierDef, delayBetweenRepSoundsDuration), CSPFT_FLOAT }, + {"earthquakeMaxDuration", offsetof(ZBarrierDef, earthquakeMaxDuration), CSPFT_FLOAT }, + {"earthquakeMaxScale", offsetof(ZBarrierDef, earthquakeMaxScale), CSPFT_FLOAT }, + {"earthquakeMinDuration", offsetof(ZBarrierDef, earthquakeMinDuration), CSPFT_FLOAT }, + {"earthquakeMinScale", offsetof(ZBarrierDef, earthquakeMinScale), CSPFT_FLOAT }, + {"earthquakeOnRepair", offsetof(ZBarrierDef, earthquakeOnRepair), CSPFT_UINT }, + {"earthquakeRadius", offsetof(ZBarrierDef, earthquakeRadius), CSPFT_FLOAT }, + {"generalRepairSound0", offsetof(ZBarrierDef, generalRepairSound1), CSPFT_SOUND_ALIAS_ID}, + {"generalRepairSound1", offsetof(ZBarrierDef, generalRepairSound2), CSPFT_SOUND_ALIAS_ID}, + {"upgradedGeneralRepairSound0", offsetof(ZBarrierDef, upgradedGeneralRepairSound1), CSPFT_SOUND_ALIAS_ID}, + {"upgradedGeneralRepairSound1", offsetof(ZBarrierDef, upgradedGeneralRepairSound2), CSPFT_SOUND_ALIAS_ID}, + {"useDelayBetweenGeneralRepSounds", offsetof(ZBarrierDef, delayBetweenRepSounds), CSPFT_UINT }, + {"taunts", offsetof(ZBarrierDef, taunts), CSPFT_UINT }, + {"reachThroughAttacks", offsetof(ZBarrierDef, reachThroughAttacks), CSPFT_UINT }, + {"zombieTauntAnimState", offsetof(ZBarrierDef, zombieTauntAnimState), CSPFT_SCRIPT_STRING }, + {"zombieReachThroughAnimState", offsetof(ZBarrierDef, zombieReachThroughAnimState), CSPFT_SCRIPT_STRING }, + {"numAttackSlots", offsetof(ZBarrierDef, numAttackSlots), CSPFT_UINT }, + {"attackSpotHorzOffset", offsetof(ZBarrierDef, attackSpotHorzOffset), CSPFT_FLOAT }, + {"autoHideOpenPieces", offsetof(ZBarrierDef, autoHideOpenPieces), CSPFT_UINT }, + {"alternateBoardModel1", offsetof(ZBarrierDef, boards[0].pAlternateBoardModel), CSPFT_XMODEL }, + {"boardAnim1", offsetof(ZBarrierDef, boards[0].pBoardAnim), CSPFT_STRING }, + {"boardModel1", offsetof(ZBarrierDef, boards[0].pBoardModel), CSPFT_XMODEL }, + {"boardRepairSound1", offsetof(ZBarrierDef, boards[0].boardRepairSound), CSPFT_SOUND_ALIAS_ID}, + {"boardRepairHoverSound1", offsetof(ZBarrierDef, boards[0].boardRepairHoverSound), CSPFT_SOUND_ALIAS_ID}, + {"OffsetRepairFxX10", offsetof(ZBarrierDef, boards[0].repairEffect1Offset.x), CSPFT_FLOAT }, + {"OffsetRepairFxX11", offsetof(ZBarrierDef, boards[0].repairEffect2Offset.x), CSPFT_FLOAT }, + {"OffsetRepairFxY10", offsetof(ZBarrierDef, boards[0].repairEffect1Offset.y), CSPFT_FLOAT }, + {"OffsetRepairFxY11", offsetof(ZBarrierDef, boards[0].repairEffect2Offset.y), CSPFT_FLOAT }, + {"OffsetRepairFxZ10", offsetof(ZBarrierDef, boards[0].repairEffect1Offset.z), CSPFT_FLOAT }, + {"OffsetRepairFxZ11", offsetof(ZBarrierDef, boards[0].repairEffect2Offset.z), CSPFT_FLOAT }, + {"pauseAndRepeatBoardRepairSound1", offsetof(ZBarrierDef, boards[0].pauseAndRepeatRepSound), CSPFT_UINT }, + {"pauseBetweenRepSoundsMax1", offsetof(ZBarrierDef, boards[0].maxPause), CSPFT_FLOAT }, + {"pauseBetweenRepSoundsMin1", offsetof(ZBarrierDef, boards[0].minPause), CSPFT_FLOAT }, + {"proBoardNumRepsToTear1", offsetof(ZBarrierDef, boards[0].numRepsToPullProBoard), CSPFT_UINT }, + {"repairFx10", offsetof(ZBarrierDef, boards[0].repairEffect1), CSPFT_FX }, + {"repairFx11", offsetof(ZBarrierDef, boards[0].repairEffect2), CSPFT_FX }, + {"tearAnim1", offsetof(ZBarrierDef, boards[0].pTearAnim), CSPFT_STRING }, + {"upgradedBoardModel1", offsetof(ZBarrierDef, boards[0].pUpgradedBoardModel), CSPFT_XMODEL }, + {"zombieBoardTearAnimState1", offsetof(ZBarrierDef, boards[0].zombieBoardTearStateName), CSPFT_SCRIPT_STRING }, + {"zombieBoardTearAnimSubState1", offsetof(ZBarrierDef, boards[0].zombieBoardTearSubStateName), CSPFT_SCRIPT_STRING }, + {"alternateBoardModel2", offsetof(ZBarrierDef, boards[1].pAlternateBoardModel), CSPFT_XMODEL }, + {"boardAnim2", offsetof(ZBarrierDef, boards[1].pBoardAnim), CSPFT_STRING }, + {"boardModel2", offsetof(ZBarrierDef, boards[1].pBoardModel), CSPFT_XMODEL }, + {"boardRepairSound2", offsetof(ZBarrierDef, boards[1].boardRepairSound), CSPFT_SOUND_ALIAS_ID}, + {"boardRepairHoverSound2", offsetof(ZBarrierDef, boards[1].boardRepairHoverSound), CSPFT_SOUND_ALIAS_ID}, + {"OffsetRepairFxX20", offsetof(ZBarrierDef, boards[1].repairEffect1Offset.x), CSPFT_FLOAT }, + {"OffsetRepairFxX21", offsetof(ZBarrierDef, boards[1].repairEffect2Offset.x), CSPFT_FLOAT }, + {"OffsetRepairFxY20", offsetof(ZBarrierDef, boards[1].repairEffect1Offset.y), CSPFT_FLOAT }, + {"OffsetRepairFxY21", offsetof(ZBarrierDef, boards[1].repairEffect2Offset.y), CSPFT_FLOAT }, + {"OffsetRepairFxZ20", offsetof(ZBarrierDef, boards[1].repairEffect1Offset.z), CSPFT_FLOAT }, + {"OffsetRepairFxZ21", offsetof(ZBarrierDef, boards[1].repairEffect2Offset.z), CSPFT_FLOAT }, + {"pauseAndRepeatBoardRepairSound2", offsetof(ZBarrierDef, boards[1].pauseAndRepeatRepSound), CSPFT_UINT }, + {"pauseBetweenRepSoundsMax2", offsetof(ZBarrierDef, boards[1].maxPause), CSPFT_FLOAT }, + {"pauseBetweenRepSoundsMin2", offsetof(ZBarrierDef, boards[1].minPause), CSPFT_FLOAT }, + {"proBoardNumRepsToTear2", offsetof(ZBarrierDef, boards[1].numRepsToPullProBoard), CSPFT_UINT }, + {"repairFx20", offsetof(ZBarrierDef, boards[1].repairEffect1), CSPFT_FX }, + {"repairFx21", offsetof(ZBarrierDef, boards[1].repairEffect2), CSPFT_FX }, + {"tearAnim2", offsetof(ZBarrierDef, boards[1].pTearAnim), CSPFT_STRING }, + {"upgradedBoardModel2", offsetof(ZBarrierDef, boards[1].pUpgradedBoardModel), CSPFT_XMODEL }, + {"zombieBoardTearAnimState2", offsetof(ZBarrierDef, boards[1].zombieBoardTearStateName), CSPFT_SCRIPT_STRING }, + {"zombieBoardTearAnimSubState2", offsetof(ZBarrierDef, boards[1].zombieBoardTearSubStateName), CSPFT_SCRIPT_STRING }, + {"alternateBoardModel3", offsetof(ZBarrierDef, boards[2].pAlternateBoardModel), CSPFT_XMODEL }, + {"boardAnim3", offsetof(ZBarrierDef, boards[2].pBoardAnim), CSPFT_STRING }, + {"boardModel3", offsetof(ZBarrierDef, boards[2].pBoardModel), CSPFT_XMODEL }, + {"boardRepairSound3", offsetof(ZBarrierDef, boards[2].boardRepairSound), CSPFT_SOUND_ALIAS_ID}, + {"boardRepairHoverSound3", offsetof(ZBarrierDef, boards[2].boardRepairHoverSound), CSPFT_SOUND_ALIAS_ID}, + {"OffsetRepairFxX30", offsetof(ZBarrierDef, boards[2].repairEffect1Offset.x), CSPFT_FLOAT }, + {"OffsetRepairFxX31", offsetof(ZBarrierDef, boards[2].repairEffect2Offset.x), CSPFT_FLOAT }, + {"OffsetRepairFxY30", offsetof(ZBarrierDef, boards[2].repairEffect1Offset.y), CSPFT_FLOAT }, + {"OffsetRepairFxY31", offsetof(ZBarrierDef, boards[2].repairEffect2Offset.y), CSPFT_FLOAT }, + {"OffsetRepairFxZ30", offsetof(ZBarrierDef, boards[2].repairEffect1Offset.z), CSPFT_FLOAT }, + {"OffsetRepairFxZ31", offsetof(ZBarrierDef, boards[2].repairEffect2Offset.z), CSPFT_FLOAT }, + {"pauseAndRepeatBoardRepairSound3", offsetof(ZBarrierDef, boards[2].pauseAndRepeatRepSound), CSPFT_UINT }, + {"pauseBetweenRepSoundsMax3", offsetof(ZBarrierDef, boards[2].maxPause), CSPFT_FLOAT }, + {"pauseBetweenRepSoundsMin3", offsetof(ZBarrierDef, boards[2].minPause), CSPFT_FLOAT }, + {"proBoardNumRepsToTear3", offsetof(ZBarrierDef, boards[2].numRepsToPullProBoard), CSPFT_UINT }, + {"repairFx30", offsetof(ZBarrierDef, boards[2].repairEffect1), CSPFT_FX }, + {"repairFx31", offsetof(ZBarrierDef, boards[2].repairEffect2), CSPFT_FX }, + {"tearAnim3", offsetof(ZBarrierDef, boards[2].pTearAnim), CSPFT_STRING }, + {"upgradedBoardModel3", offsetof(ZBarrierDef, boards[2].pUpgradedBoardModel), CSPFT_XMODEL }, + {"zombieBoardTearAnimState3", offsetof(ZBarrierDef, boards[2].zombieBoardTearStateName), CSPFT_SCRIPT_STRING }, + {"zombieBoardTearAnimSubState3", offsetof(ZBarrierDef, boards[2].zombieBoardTearSubStateName), CSPFT_SCRIPT_STRING }, + {"alternateBoardModel4", offsetof(ZBarrierDef, boards[3].pAlternateBoardModel), CSPFT_XMODEL }, + {"boardAnim4", offsetof(ZBarrierDef, boards[3].pBoardAnim), CSPFT_STRING }, + {"boardModel4", offsetof(ZBarrierDef, boards[3].pBoardModel), CSPFT_XMODEL }, + {"boardRepairSound4", offsetof(ZBarrierDef, boards[3].boardRepairSound), CSPFT_SOUND_ALIAS_ID}, + {"boardRepairHoverSound4", offsetof(ZBarrierDef, boards[3].boardRepairHoverSound), CSPFT_SOUND_ALIAS_ID}, + {"OffsetRepairFxX40", offsetof(ZBarrierDef, boards[3].repairEffect1Offset.x), CSPFT_FLOAT }, + {"OffsetRepairFxX41", offsetof(ZBarrierDef, boards[3].repairEffect2Offset.x), CSPFT_FLOAT }, + {"OffsetRepairFxY40", offsetof(ZBarrierDef, boards[3].repairEffect1Offset.y), CSPFT_FLOAT }, + {"OffsetRepairFxY41", offsetof(ZBarrierDef, boards[3].repairEffect2Offset.y), CSPFT_FLOAT }, + {"OffsetRepairFxZ40", offsetof(ZBarrierDef, boards[3].repairEffect1Offset.z), CSPFT_FLOAT }, + {"OffsetRepairFxZ41", offsetof(ZBarrierDef, boards[3].repairEffect2Offset.z), CSPFT_FLOAT }, + {"pauseAndRepeatBoardRepairSound4", offsetof(ZBarrierDef, boards[3].pauseAndRepeatRepSound), CSPFT_UINT }, + {"pauseBetweenRepSoundsMax4", offsetof(ZBarrierDef, boards[3].maxPause), CSPFT_FLOAT }, + {"pauseBetweenRepSoundsMin4", offsetof(ZBarrierDef, boards[3].minPause), CSPFT_FLOAT }, + {"proBoardNumRepsToTear4", offsetof(ZBarrierDef, boards[3].numRepsToPullProBoard), CSPFT_UINT }, + {"repairFx40", offsetof(ZBarrierDef, boards[3].repairEffect1), CSPFT_FX }, + {"repairFx41", offsetof(ZBarrierDef, boards[3].repairEffect2), CSPFT_FX }, + {"tearAnim4", offsetof(ZBarrierDef, boards[3].pTearAnim), CSPFT_STRING }, + {"upgradedBoardModel4", offsetof(ZBarrierDef, boards[3].pUpgradedBoardModel), CSPFT_XMODEL }, + {"zombieBoardTearAnimState4", offsetof(ZBarrierDef, boards[3].zombieBoardTearStateName), CSPFT_SCRIPT_STRING }, + {"zombieBoardTearAnimSubState4", offsetof(ZBarrierDef, boards[3].zombieBoardTearSubStateName), CSPFT_SCRIPT_STRING }, + {"alternateBoardModel5", offsetof(ZBarrierDef, boards[4].pAlternateBoardModel), CSPFT_XMODEL }, + {"boardAnim5", offsetof(ZBarrierDef, boards[4].pBoardAnim), CSPFT_STRING }, + {"boardModel5", offsetof(ZBarrierDef, boards[4].pBoardModel), CSPFT_XMODEL }, + {"boardRepairSound5", offsetof(ZBarrierDef, boards[4].boardRepairSound), CSPFT_SOUND_ALIAS_ID}, + {"boardRepairHoverSound5", offsetof(ZBarrierDef, boards[4].boardRepairHoverSound), CSPFT_SOUND_ALIAS_ID}, + {"OffsetRepairFxX50", offsetof(ZBarrierDef, boards[4].repairEffect1Offset.x), CSPFT_FLOAT }, + {"OffsetRepairFxX51", offsetof(ZBarrierDef, boards[4].repairEffect2Offset.x), CSPFT_FLOAT }, + {"OffsetRepairFxY50", offsetof(ZBarrierDef, boards[4].repairEffect1Offset.y), CSPFT_FLOAT }, + {"OffsetRepairFxY51", offsetof(ZBarrierDef, boards[4].repairEffect2Offset.y), CSPFT_FLOAT }, + {"OffsetRepairFxZ50", offsetof(ZBarrierDef, boards[4].repairEffect1Offset.z), CSPFT_FLOAT }, + {"OffsetRepairFxZ51", offsetof(ZBarrierDef, boards[4].repairEffect2Offset.z), CSPFT_FLOAT }, + {"pauseAndRepeatBoardRepairSound5", offsetof(ZBarrierDef, boards[4].pauseAndRepeatRepSound), CSPFT_UINT }, + {"pauseBetweenRepSoundsMax5", offsetof(ZBarrierDef, boards[4].maxPause), CSPFT_FLOAT }, + {"pauseBetweenRepSoundsMin5", offsetof(ZBarrierDef, boards[4].minPause), CSPFT_FLOAT }, + {"proBoardNumRepsToTear5", offsetof(ZBarrierDef, boards[4].numRepsToPullProBoard), CSPFT_UINT }, + {"repairFx50", offsetof(ZBarrierDef, boards[4].repairEffect1), CSPFT_FX }, + {"repairFx51", offsetof(ZBarrierDef, boards[4].repairEffect2), CSPFT_FX }, + {"tearAnim5", offsetof(ZBarrierDef, boards[4].pTearAnim), CSPFT_STRING }, + {"upgradedBoardModel5", offsetof(ZBarrierDef, boards[4].pUpgradedBoardModel), CSPFT_XMODEL }, + {"zombieBoardTearAnimState5", offsetof(ZBarrierDef, boards[4].zombieBoardTearStateName), CSPFT_SCRIPT_STRING }, + {"zombieBoardTearAnimSubState5", offsetof(ZBarrierDef, boards[4].zombieBoardTearSubStateName), CSPFT_SCRIPT_STRING }, + {"alternateBoardModel6", offsetof(ZBarrierDef, boards[5].pAlternateBoardModel), CSPFT_XMODEL }, + {"boardAnim6", offsetof(ZBarrierDef, boards[5].pBoardAnim), CSPFT_STRING }, + {"boardModel6", offsetof(ZBarrierDef, boards[5].pBoardModel), CSPFT_XMODEL }, + {"boardRepairSound6", offsetof(ZBarrierDef, boards[5].boardRepairSound), CSPFT_SOUND_ALIAS_ID}, + {"boardRepairHoverSound6", offsetof(ZBarrierDef, boards[5].boardRepairHoverSound), CSPFT_SOUND_ALIAS_ID}, + {"OffsetRepairFxX60", offsetof(ZBarrierDef, boards[5].repairEffect1Offset.x), CSPFT_FLOAT }, + {"OffsetRepairFxX61", offsetof(ZBarrierDef, boards[5].repairEffect2Offset.x), CSPFT_FLOAT }, + {"OffsetRepairFxY60", offsetof(ZBarrierDef, boards[5].repairEffect1Offset.y), CSPFT_FLOAT }, + {"OffsetRepairFxY61", offsetof(ZBarrierDef, boards[5].repairEffect2Offset.y), CSPFT_FLOAT }, + {"OffsetRepairFxZ60", offsetof(ZBarrierDef, boards[5].repairEffect1Offset.z), CSPFT_FLOAT }, + {"OffsetRepairFxZ61", offsetof(ZBarrierDef, boards[5].repairEffect2Offset.z), CSPFT_FLOAT }, + {"pauseAndRepeatBoardRepairSound6", offsetof(ZBarrierDef, boards[5].pauseAndRepeatRepSound), CSPFT_UINT }, + {"pauseBetweenRepSoundsMax6", offsetof(ZBarrierDef, boards[5].maxPause), CSPFT_FLOAT }, + {"pauseBetweenRepSoundsMin6", offsetof(ZBarrierDef, boards[5].minPause), CSPFT_FLOAT }, + {"proBoardNumRepsToTear6", offsetof(ZBarrierDef, boards[5].numRepsToPullProBoard), CSPFT_UINT }, + {"repairFx60", offsetof(ZBarrierDef, boards[5].repairEffect1), CSPFT_FX }, + {"repairFx61", offsetof(ZBarrierDef, boards[5].repairEffect2), CSPFT_FX }, + {"tearAnim6", offsetof(ZBarrierDef, boards[5].pTearAnim), CSPFT_STRING }, + {"upgradedBoardModel6", offsetof(ZBarrierDef, boards[5].pUpgradedBoardModel), CSPFT_XMODEL }, + {"zombieBoardTearAnimState6", offsetof(ZBarrierDef, boards[5].zombieBoardTearStateName), CSPFT_SCRIPT_STRING }, + {"zombieBoardTearAnimSubState6", offsetof(ZBarrierDef, boards[5].zombieBoardTearSubStateName), CSPFT_SCRIPT_STRING }, }; -} \ No newline at end of file +} diff --git a/src/ObjCommon/Game/T6/ObjConstantsT6.h b/src/ObjCommon/Game/T6/ObjConstantsT6.h index a39de7af3..73f1cad30 100644 --- a/src/ObjCommon/Game/T6/ObjConstantsT6.h +++ b/src/ObjCommon/Game/T6/ObjConstantsT6.h @@ -25,4 +25,4 @@ namespace T6 static constexpr const char* GDF_FILENAME_WEAPON_ATTACHMENT_UNIQUE = "attachmentunique.gdf"; static constexpr const char* GDF_FILENAME_ZBARRIER = "zbarrier.gdf"; }; -} \ No newline at end of file +} // namespace T6 diff --git a/src/ObjCommon/InfoString/InfoString.cpp b/src/ObjCommon/InfoString/InfoString.cpp index 489fbc206..5a731e0e0 100644 --- a/src/ObjCommon/InfoString/InfoString.cpp +++ b/src/ObjCommon/InfoString/InfoString.cpp @@ -1,7 +1,7 @@ #include "InfoString.h" -#include #include +#include #include const std::string InfoString::EMPTY_VALUE; @@ -116,7 +116,7 @@ class InfoStringInputStream auto c = m_stream.get(); if (c == EOF) { - if(m_last_separator != EOF) + if (m_last_separator != EOF) { m_last_separator = EOF; value = std::string(); @@ -210,7 +210,7 @@ bool InfoString::FromGdtProperties(const GdtEntry& gdtEntry) } } - while(!entryStack.empty()) + while (!entryStack.empty()) { const auto* currentEntry = entryStack.top(); entryStack.pop(); @@ -218,7 +218,7 @@ bool InfoString::FromGdtProperties(const GdtEntry& gdtEntry) for (const auto& [key, value] : currentEntry->m_properties) { auto existingEntry = m_values.find(key); - if(existingEntry == m_values.end()) + if (existingEntry == m_values.end()) { m_keys_by_insertion.push_back(key); m_values.emplace(std::make_pair(key, value)); diff --git a/src/ObjCommon/InfoString/InfoString.h b/src/ObjCommon/InfoString/InfoString.h index 096a30885..84054b6d9 100644 --- a/src/ObjCommon/InfoString/InfoString.h +++ b/src/ObjCommon/InfoString/InfoString.h @@ -1,12 +1,12 @@ #pragma once +#include "Obj/Gdt/GdtEntry.h" +#include "Utils/ClassUtils.h" + #include -#include #include +#include #include -#include "Utils/ClassUtils.h" -#include "Obj/Gdt/GdtEntry.h" - class InfoString { static constexpr const char* GDT_PREFIX_FIELD = "configstringFileType"; @@ -29,4 +29,4 @@ class InfoString bool FromStream(std::istream& stream); bool FromStream(const std::string& prefix, std::istream& stream); bool FromGdtProperties(const GdtEntry& gdtEntry); -}; \ No newline at end of file +}; diff --git a/src/ObjCommon/Localize/LocalizeCommon.h b/src/ObjCommon/Localize/LocalizeCommon.h index d5ee88fda..6dec1697f 100644 --- a/src/ObjCommon/Localize/LocalizeCommon.h +++ b/src/ObjCommon/Localize/LocalizeCommon.h @@ -1,9 +1,9 @@ #pragma once -#include - #include "Game/GameLanguage.h" +#include + class LocalizeCommon { public: diff --git a/src/ObjCommon/Localize/LocalizeFile.cpp b/src/ObjCommon/Localize/LocalizeFile.cpp index 4617d5d04..3cd6e3d0d 100644 --- a/src/ObjCommon/Localize/LocalizeFile.cpp +++ b/src/ObjCommon/Localize/LocalizeFile.cpp @@ -1,7 +1,6 @@ #include "LocalizeFile.h" -LocalizeFileEntry::LocalizeFileEntry() -= default; +LocalizeFileEntry::LocalizeFileEntry() = default; LocalizeFileEntry::LocalizeFileEntry(std::string key, std::string value) : m_key(std::move(key)), diff --git a/src/ObjCommon/Model/Obj/ObjCommon.cpp b/src/ObjCommon/Model/Obj/ObjCommon.cpp index f6ec8b39b..0d4cf6999 100644 --- a/src/ObjCommon/Model/Obj/ObjCommon.cpp +++ b/src/ObjCommon/Model/Obj/ObjCommon.cpp @@ -7,8 +7,8 @@ bool operator==(const ObjVertex& lhs, const ObjVertex& rhs) { return std::fabs(lhs.coordinates[0] - rhs.coordinates[0]) < std::numeric_limits::epsilon() - && std::fabs(lhs.coordinates[1] - rhs.coordinates[1]) < std::numeric_limits::epsilon() - && std::fabs(lhs.coordinates[2] - rhs.coordinates[2]) < std::numeric_limits::epsilon(); + && std::fabs(lhs.coordinates[1] - rhs.coordinates[1]) < std::numeric_limits::epsilon() + && std::fabs(lhs.coordinates[2] - rhs.coordinates[2]) < std::numeric_limits::epsilon(); } bool operator!=(const ObjVertex& lhs, const ObjVertex& rhs) @@ -24,8 +24,8 @@ bool operator<(const ObjVertex& lhs, const ObjVertex& rhs) bool operator==(const ObjNormal& lhs, const ObjNormal& rhs) { return std::fabs(lhs.normal[0] - rhs.normal[0]) < std::numeric_limits::epsilon() - && std::fabs(lhs.normal[1] - rhs.normal[1]) < std::numeric_limits::epsilon() - && std::fabs(lhs.normal[2] - rhs.normal[2]) < std::numeric_limits::epsilon(); + && std::fabs(lhs.normal[1] - rhs.normal[1]) < std::numeric_limits::epsilon() + && std::fabs(lhs.normal[2] - rhs.normal[2]) < std::numeric_limits::epsilon(); } bool operator!=(const ObjNormal& lhs, const ObjNormal& rhs) @@ -40,8 +40,7 @@ bool operator<(const ObjNormal& lhs, const ObjNormal& rhs) bool operator==(const ObjUv& lhs, const ObjUv& rhs) { - return std::fabs(lhs.uv[0] - rhs.uv[0]) < std::numeric_limits::epsilon() - && std::fabs(lhs.uv[1] - rhs.uv[1]) < std::numeric_limits::epsilon(); + return std::fabs(lhs.uv[0] - rhs.uv[0]) < std::numeric_limits::epsilon() && std::fabs(lhs.uv[1] - rhs.uv[1]) < std::numeric_limits::epsilon(); } bool operator!=(const ObjUv& lhs, const ObjUv& rhs) diff --git a/src/ObjCommon/Model/Obj/ObjCommon.h b/src/ObjCommon/Model/Obj/ObjCommon.h index 911b9e9e3..d79398f76 100644 --- a/src/ObjCommon/Model/Obj/ObjCommon.h +++ b/src/ObjCommon/Model/Obj/ObjCommon.h @@ -48,4 +48,4 @@ struct MtlMaterial std::string colorMapName; std::string normalMapName; std::string specularMapName; -}; \ No newline at end of file +}; diff --git a/src/ObjCommon/Model/XModel/XModelCommon.cpp b/src/ObjCommon/Model/XModel/XModelCommon.cpp index 4e0c68443..a3cfb586a 100644 --- a/src/ObjCommon/Model/XModel/XModelCommon.cpp +++ b/src/ObjCommon/Model/XModel/XModelCommon.cpp @@ -50,8 +50,8 @@ void XModelMaterial::ApplyDefaults() bool operator==(const VertexMergerPos& lhs, const VertexMergerPos& rhs) { const auto coordinatesMatch = std::fabs(lhs.x - rhs.x) < std::numeric_limits::epsilon() - && std::fabs(lhs.y - rhs.y) < std::numeric_limits::epsilon() - && std::fabs(lhs.z - rhs.z) < std::numeric_limits::epsilon(); + && std::fabs(lhs.y - rhs.y) < std::numeric_limits::epsilon() + && std::fabs(lhs.z - rhs.z) < std::numeric_limits::epsilon(); if (!coordinatesMatch || lhs.weightCount != rhs.weightCount) return false; diff --git a/src/ObjCommon/Model/XModel/XModelCommon.h b/src/ObjCommon/Model/XModel/XModelCommon.h index 158a69db0..41f50f1be 100644 --- a/src/ObjCommon/Model/XModel/XModelCommon.h +++ b/src/ObjCommon/Model/XModel/XModelCommon.h @@ -1,10 +1,10 @@ #pragma once -#include -#include - -#include "Utils/DistinctMapper.h" #include "Math/Quaternion.h" +#include "Utils/DistinctMapper.h" + +#include +#include struct XModelObject { @@ -64,22 +64,28 @@ struct XModelMaterial float ambientColor[4]; float incandescence[4]; float coeffs[2]; - struct { + + struct + { float x; int y; } glow; + struct { int x; float y; } refractive; + float specularColor[4]; float reflectiveColor[4]; + struct { int x; float y; } reflective; + float blinn[2]; float phong; std::string colorMapName; @@ -100,4 +106,4 @@ struct VertexMergerPos friend bool operator<(const VertexMergerPos& lhs, const VertexMergerPos& rhs); }; -typedef DistinctMapper VertexMerger; \ No newline at end of file +typedef DistinctMapper VertexMerger; diff --git a/src/ObjCommon/Obj/Gdt/Gdt.cpp b/src/ObjCommon/Obj/Gdt/Gdt.cpp index 081ea81e7..7cd56badf 100644 --- a/src/ObjCommon/Obj/Gdt/Gdt.cpp +++ b/src/ObjCommon/Obj/Gdt/Gdt.cpp @@ -1,7 +1,6 @@ #include "Gdt.h" -Gdt::Gdt() -= default; +Gdt::Gdt() = default; Gdt::Gdt(GdtVersion version) : m_version(std::move(version)) diff --git a/src/ObjCommon/Obj/Gdt/Gdt.h b/src/ObjCommon/Obj/Gdt/Gdt.h index da8800890..f0acff900 100644 --- a/src/ObjCommon/Obj/Gdt/Gdt.h +++ b/src/ObjCommon/Obj/Gdt/Gdt.h @@ -1,11 +1,11 @@ #pragma once -#include -#include - #include "GdtEntry.h" #include "GdtVersion.h" +#include +#include + class Gdt { public: diff --git a/src/ObjCommon/Obj/Gdt/GdtStream.cpp b/src/ObjCommon/Obj/Gdt/GdtStream.cpp index 4355c3473..1416a6de8 100644 --- a/src/ObjCommon/Obj/Gdt/GdtStream.cpp +++ b/src/ObjCommon/Obj/Gdt/GdtStream.cpp @@ -26,8 +26,7 @@ int GdtReader::PeekChar() do { c = m_stream.get(); - } - while (isspace(c)); + } while (isspace(c)); m_peeked = true; m_char = c; @@ -46,8 +45,7 @@ int GdtReader::NextChar() do { c = m_stream.get(); - } - while (isspace(c)); + } while (isspace(c)); return c; } @@ -85,7 +83,7 @@ bool GdtReader::ReadStringContent(std::string& str) } escaped = false; } - else if(c == '\\') + else if (c == '\\') { escaped = true; } @@ -135,7 +133,6 @@ bool GdtReader::ReadProperties(GdtEntry& entry) entry.m_properties.emplace(std::move(propertyKey), std::move(propertyValue)); } - if (NextChar() != '}') { PrintError("Expected closing tags"); @@ -147,8 +144,7 @@ bool GdtReader::ReadProperties(GdtEntry& entry) bool GdtReader::AddEntry(Gdt& gdt, GdtEntry& entry) const { - if (entry.m_name == GdtConst::VERSION_ENTRY_NAME - && entry.m_gdf_name == GdtConst::VERSION_ENTRY_GDF) + if (entry.m_name == GdtConst::VERSION_ENTRY_NAME && entry.m_gdf_name == GdtConst::VERSION_ENTRY_GDF) { auto foundEntry = entry.m_properties.find(GdtConst::VERSION_KEY_GAME); if (foundEntry == entry.m_properties.end()) @@ -258,7 +254,6 @@ bool GdtReader::Read(Gdt& gdt) return false; } - if (NextChar() != '}') { PrintError("Expected closing tags"); @@ -305,11 +300,11 @@ void GdtOutputStream::WriteVersion(const GdtVersion& gdtVersion) void GdtOutputStream::WriteEscaped(const std::string& str) const { auto wroteBefore = false; - for(auto i = 0u; i < str.size(); i++) + for (auto i = 0u; i < str.size(); i++) { auto needsEscape = false; auto c = str[i]; - switch(c) + switch (c) { case '\r': needsEscape = true; @@ -329,9 +324,9 @@ void GdtOutputStream::WriteEscaped(const std::string& str) const break; } - if(needsEscape) + if (needsEscape) { - if(!wroteBefore) + if (!wroteBefore) { wroteBefore = true; m_stream << std::string(str, 0, i); @@ -339,13 +334,13 @@ void GdtOutputStream::WriteEscaped(const std::string& str) const m_stream << '\\' << c; } - else if(wroteBefore) + else if (wroteBefore) { m_stream << c; } } - if(!wroteBefore) + if (!wroteBefore) { m_stream << str; } diff --git a/src/ObjCommon/Obj/Gdt/GdtStream.h b/src/ObjCommon/Obj/Gdt/GdtStream.h index 3eb046813..f09e08f3b 100644 --- a/src/ObjCommon/Obj/Gdt/GdtStream.h +++ b/src/ObjCommon/Obj/Gdt/GdtStream.h @@ -1,8 +1,8 @@ #pragma once -#include - #include "Gdt.h" +#include + class GdtReader { std::istream& m_stream; diff --git a/src/ObjCommon/Obj/Gdt/GdtVersion.h b/src/ObjCommon/Obj/Gdt/GdtVersion.h index 02adf3fea..85ef7d846 100644 --- a/src/ObjCommon/Obj/Gdt/GdtVersion.h +++ b/src/ObjCommon/Obj/Gdt/GdtVersion.h @@ -10,4 +10,4 @@ class GdtVersion GdtVersion(); GdtVersion(std::string game, int version); -}; \ No newline at end of file +}; diff --git a/src/ObjCommon/ObjContainer/IObjContainer.h b/src/ObjCommon/ObjContainer/IObjContainer.h index 1c4aa6a53..133ee757a 100644 --- a/src/ObjCommon/ObjContainer/IObjContainer.h +++ b/src/ObjCommon/ObjContainer/IObjContainer.h @@ -8,4 +8,4 @@ class IObjContainer virtual ~IObjContainer() = default; virtual std::string GetName() = 0; -}; \ No newline at end of file +}; diff --git a/src/ObjCommon/ObjContainer/IPak/IPakTypes.h b/src/ObjCommon/ObjContainer/IPak/IPakTypes.h index 3d516821a..bc3232bf2 100644 --- a/src/ObjCommon/ObjContainer/IPak/IPakTypes.h +++ b/src/ObjCommon/ObjContainer/IPak/IPakTypes.h @@ -1,9 +1,9 @@ #pragma once -#include - #include "Utils/FileUtils.h" +#include + namespace ipak_consts { static constexpr uint32_t IPAK_MAGIC = FileUtils::MakeMagic32('K', 'A', 'P', 'I'); @@ -22,7 +22,7 @@ namespace ipak_consts static constexpr uint32_t IPAK_COMMAND_SKIP = 0xCF; static_assert(IPAK_COMMAND_DEFAULT_SIZE <= IPAK_CHUNK_SIZE); -} +} // namespace ipak_consts typedef uint32_t IPakHash; diff --git a/src/ObjCommon/Shader/D3D9ShaderAnalyser.cpp b/src/ObjCommon/Shader/D3D9ShaderAnalyser.cpp index 67f6498c9..918d3c16f 100644 --- a/src/ObjCommon/Shader/D3D9ShaderAnalyser.cpp +++ b/src/ObjCommon/Shader/D3D9ShaderAnalyser.cpp @@ -1,10 +1,10 @@ #include "D3D9ShaderAnalyser.h" +#include "Utils/FileUtils.h" + #include #include -#include "Utils/FileUtils.h" - using namespace d3d9; namespace d3d9 @@ -72,10 +72,10 @@ namespace d3d9 switch ((version & 0xFFFF0000) >> 16) { - case 0x4658: // FX - case 0x5458: // TX - case 0x7ffe: // ? - case 0x7fff: // ? + case 0x4658: // FX + case 0x5458: // TX + case 0x7ffe: // ? + case 0x7fff: // ? shaderInfo.m_type = ShaderType::UNKNOWN; // Valid according to wine return true; case 0xfffe: @@ -131,7 +131,10 @@ namespace d3d9 return str[strLen] == '\0'; } - bool PopulateShaderConstantFromConstantInfo(ShaderConstant& shaderConstant, const char* commentStart, const size_t commentSize, const ConstantInfo& constantInfo) + bool PopulateShaderConstantFromConstantInfo(ShaderConstant& shaderConstant, + const char* commentStart, + const size_t commentSize, + const ConstantInfo& constantInfo) { if (constantInfo.Name) { @@ -148,7 +151,7 @@ namespace d3d9 shaderConstant.m_register_index = constantInfo.RegisterIndex; shaderConstant.m_register_count = constantInfo.RegisterCount; - if(constantInfo.TypeInfo) + if (constantInfo.TypeInfo) { assert(commentStart + constantInfo.TypeInfo + sizeof(TypeInfo) <= commentStart + commentSize); if (commentStart + constantInfo.TypeInfo + sizeof(TypeInfo) > commentStart + commentSize) @@ -231,7 +234,7 @@ namespace d3d9 return true; } -} +} // namespace d3d9 std::unique_ptr ShaderAnalyser::GetShaderInfo(const uint32_t* shaderByteCode, const size_t shaderByteCodeSize) { diff --git a/src/ObjCommon/Shader/D3D9ShaderAnalyser.h b/src/ObjCommon/Shader/D3D9ShaderAnalyser.h index 7e02ebd24..e58f1202e 100644 --- a/src/ObjCommon/Shader/D3D9ShaderAnalyser.h +++ b/src/ObjCommon/Shader/D3D9ShaderAnalyser.h @@ -97,4 +97,4 @@ namespace d3d9 public: static std::unique_ptr GetShaderInfo(const uint32_t* shaderByteCode, size_t shaderByteCodeSize); }; -} \ No newline at end of file +} // namespace d3d9 diff --git a/src/ObjCommon/Sound/WavTypes.h b/src/ObjCommon/Sound/WavTypes.h index e5cd145d4..18dc14b9b 100644 --- a/src/ObjCommon/Sound/WavTypes.h +++ b/src/ObjCommon/Sound/WavTypes.h @@ -1,8 +1,8 @@ #pragma once -#include - #include "Utils/FileUtils.h" +#include + constexpr uint32_t WAV_WAVE_ID = FileUtils::MakeMagic32('W', 'A', 'V', 'E'); constexpr uint32_t WAV_CHUNK_ID_RIFF = FileUtils::MakeMagic32('R', 'I', 'F', 'F'); constexpr uint32_t WAV_CHUNK_ID_FMT = FileUtils::MakeMagic32('f', 'm', 't', ' '); @@ -27,4 +27,4 @@ struct WavFormatChunkPcm uint32_t nAvgBytesPerSec; uint16_t nBlockAlign; uint16_t wBitsPerSample; -}; \ No newline at end of file +}; diff --git a/src/ObjCommon/StructuredDataDef/CommonStructuredDataDef.h b/src/ObjCommon/StructuredDataDef/CommonStructuredDataDef.h index ff16ef805..1b607d1de 100644 --- a/src/ObjCommon/StructuredDataDef/CommonStructuredDataDef.h +++ b/src/ObjCommon/StructuredDataDef/CommonStructuredDataDef.h @@ -1,11 +1,11 @@ #pragma once -#include -#include - -#include "Utils/ClassUtils.h" #include "CommonStructuredDataEnum.h" #include "CommonStructuredDataStruct.h" +#include "Utils/ClassUtils.h" + +#include +#include class CommonStructuredDataDef { diff --git a/src/ObjCommon/StructuredDataDef/CommonStructuredDataEnum.cpp b/src/ObjCommon/StructuredDataDef/CommonStructuredDataEnum.cpp index 1eaee34f3..4a7a7eadf 100644 --- a/src/ObjCommon/StructuredDataDef/CommonStructuredDataEnum.cpp +++ b/src/ObjCommon/StructuredDataDef/CommonStructuredDataEnum.cpp @@ -1,10 +1,10 @@ #include "CommonStructuredDataEnum.h" +#include "Utils/Endianness.h" + #include #include -#include "Utils/Endianness.h" - CommonStructuredDataEnumEntry::CommonStructuredDataEnumEntry() : m_value(0u) { @@ -60,16 +60,20 @@ uint32_t CommonStructuredDataEnum::CalculateChecksum(const uint32_t initialValue void CommonStructuredDataEnum::SortEntriesByOffset() { - std::sort(m_entries.begin(), m_entries.end(), [](const CommonStructuredDataEnumEntry& e1, const CommonStructuredDataEnumEntry& e2) - { - return e1.m_value < e2.m_value; - }); + std::sort(m_entries.begin(), + m_entries.end(), + [](const CommonStructuredDataEnumEntry& e1, const CommonStructuredDataEnumEntry& e2) + { + return e1.m_value < e2.m_value; + }); } void CommonStructuredDataEnum::SortEntriesByName() { - std::sort(m_entries.begin(), m_entries.end(), [](const CommonStructuredDataEnumEntry& e1, const CommonStructuredDataEnumEntry& e2) - { - return e1.m_name < e2.m_name; - }); + std::sort(m_entries.begin(), + m_entries.end(), + [](const CommonStructuredDataEnumEntry& e1, const CommonStructuredDataEnumEntry& e2) + { + return e1.m_name < e2.m_name; + }); } diff --git a/src/ObjCommon/StructuredDataDef/CommonStructuredDataEnum.h b/src/ObjCommon/StructuredDataDef/CommonStructuredDataEnum.h index 86b1fd697..407b7436d 100644 --- a/src/ObjCommon/StructuredDataDef/CommonStructuredDataEnum.h +++ b/src/ObjCommon/StructuredDataDef/CommonStructuredDataEnum.h @@ -1,11 +1,11 @@ #pragma once +#include "Utils/ClassUtils.h" + #include #include #include #include -#include "Utils/ClassUtils.h" - struct CommonStructuredDataEnumEntry { std::string m_name; diff --git a/src/ObjCommon/StructuredDataDef/CommonStructuredDataStruct.cpp b/src/ObjCommon/StructuredDataDef/CommonStructuredDataStruct.cpp index 5e0e32d61..5f98b0101 100644 --- a/src/ObjCommon/StructuredDataDef/CommonStructuredDataStruct.cpp +++ b/src/ObjCommon/StructuredDataDef/CommonStructuredDataStruct.cpp @@ -1,11 +1,11 @@ #include "CommonStructuredDataStruct.h" -#include -#include - #include "CommonStructuredDataDef.h" #include "Utils/Endianness.h" +#include +#include + CommonStructuredDataStructProperty::CommonStructuredDataStructProperty() : m_offset_in_bits(0u) { @@ -58,12 +58,12 @@ uint32_t CommonStructuredDataStruct::CalculateChecksum(const CommonStructuredDat switch (currentType.m_category) { case CommonStructuredDataTypeCategory::STRING: - { - const auto littleEndianStringLength = endianness::ToLittleEndian(currentType.m_info.string_length); - checksum = crc32(checksum, reinterpret_cast(&littleEndianStringLength), sizeof(littleEndianStringLength)); - currentType = CommonStructuredDataType(CommonStructuredDataTypeCategory::UNKNOWN); - } - break; + { + const auto littleEndianStringLength = endianness::ToLittleEndian(currentType.m_info.string_length); + checksum = crc32(checksum, reinterpret_cast(&littleEndianStringLength), sizeof(littleEndianStringLength)); + currentType = CommonStructuredDataType(CommonStructuredDataTypeCategory::UNKNOWN); + } + break; case CommonStructuredDataTypeCategory::ENUM: if (currentType.m_info.type_index < def.m_enums.size()) { @@ -118,16 +118,20 @@ uint32_t CommonStructuredDataStruct::CalculateChecksum(const CommonStructuredDat void CommonStructuredDataStruct::SortPropertiesByOffset() { - std::sort(m_properties.begin(), m_properties.end(), [](const CommonStructuredDataStructProperty& e1, const CommonStructuredDataStructProperty& e2) - { - return e1.m_offset_in_bits < e2.m_offset_in_bits; - }); + std::sort(m_properties.begin(), + m_properties.end(), + [](const CommonStructuredDataStructProperty& e1, const CommonStructuredDataStructProperty& e2) + { + return e1.m_offset_in_bits < e2.m_offset_in_bits; + }); } void CommonStructuredDataStruct::SortPropertiesByName() { - std::sort(m_properties.begin(), m_properties.end(), [](const CommonStructuredDataStructProperty& e1, const CommonStructuredDataStructProperty& e2) - { - return e1.m_name < e2.m_name; - }); + std::sort(m_properties.begin(), + m_properties.end(), + [](const CommonStructuredDataStructProperty& e1, const CommonStructuredDataStructProperty& e2) + { + return e1.m_name < e2.m_name; + }); } diff --git a/src/ObjCommon/StructuredDataDef/CommonStructuredDataStruct.h b/src/ObjCommon/StructuredDataDef/CommonStructuredDataStruct.h index 3dbf02a6d..698be8cc9 100644 --- a/src/ObjCommon/StructuredDataDef/CommonStructuredDataStruct.h +++ b/src/ObjCommon/StructuredDataDef/CommonStructuredDataStruct.h @@ -1,11 +1,11 @@ #pragma once +#include "CommonStructuredDataTypes.h" +#include "Utils/ClassUtils.h" + #include #include #include -#include "Utils/ClassUtils.h" -#include "CommonStructuredDataTypes.h" - struct CommonStructuredDataStructProperty { std::string m_name; @@ -18,6 +18,7 @@ struct CommonStructuredDataStructProperty }; class CommonStructuredDataDef; + struct CommonStructuredDataStruct { std::string m_name; diff --git a/src/ObjCommon/StructuredDataDef/CommonStructuredDataTypes.cpp b/src/ObjCommon/StructuredDataDef/CommonStructuredDataTypes.cpp index 276d51752..2c3234af6 100644 --- a/src/ObjCommon/StructuredDataDef/CommonStructuredDataTypes.cpp +++ b/src/ObjCommon/StructuredDataDef/CommonStructuredDataTypes.cpp @@ -1,10 +1,10 @@ #include "CommonStructuredDataTypes.h" -#include - #include "CommonStructuredDataDef.h" #include "Utils/Alignment.h" +#include + CommonStructuredDataType::CommonStructuredDataType() : m_category(CommonStructuredDataTypeCategory::UNKNOWN), m_info({0}) @@ -52,15 +52,15 @@ size_t CommonStructuredDataType::GetSizeInBits(const CommonStructuredDataDef& de } return def.m_structs[m_info.type_index]->m_size_in_byte * 8u; case CommonStructuredDataTypeCategory::INDEXED_ARRAY: + { + if (m_info.type_index >= def.m_indexed_arrays.size()) { - if (m_info.type_index >= def.m_indexed_arrays.size()) - { - assert(false); - return 0u; - } - const auto& indexedArray = def.m_indexed_arrays[m_info.type_index]; - return utils::Align(indexedArray.m_element_size_in_bits * indexedArray.m_element_count, 8u); + assert(false); + return 0u; } + const auto& indexedArray = def.m_indexed_arrays[m_info.type_index]; + return utils::Align(indexedArray.m_element_size_in_bits * indexedArray.m_element_count, 8u); + } case CommonStructuredDataTypeCategory::ENUM_ARRAY: { if (m_info.type_index >= def.m_enumed_arrays.size()) @@ -154,7 +154,10 @@ CommonStructuredDataEnumedArray::CommonStructuredDataEnumedArray(const CommonStr { } -CommonStructuredDataEnumedArray::CommonStructuredDataEnumedArray(const CommonStructuredDataType type, const size_t enumIndex, const size_t elementCount, const size_t elementSizeInBits) +CommonStructuredDataEnumedArray::CommonStructuredDataEnumedArray(const CommonStructuredDataType type, + const size_t enumIndex, + const size_t elementCount, + const size_t elementSizeInBits) : m_array_type(type), m_enum_index(enumIndex), m_element_count(elementCount), diff --git a/src/ObjCommon/StructuredDataDef/CommonStructuredDataTypes.h b/src/ObjCommon/StructuredDataDef/CommonStructuredDataTypes.h index 9352b0e4b..e502a166a 100644 --- a/src/ObjCommon/StructuredDataDef/CommonStructuredDataTypes.h +++ b/src/ObjCommon/StructuredDataDef/CommonStructuredDataTypes.h @@ -1,9 +1,9 @@ #pragma once -#include - #include "Utils/ClassUtils.h" +#include + enum class CommonStructuredDataTypeCategory { UNKNOWN, @@ -26,6 +26,7 @@ union CommonStructuredDataTypeExtraInfo }; class CommonStructuredDataDef; + struct CommonStructuredDataType { CommonStructuredDataTypeCategory m_category; diff --git a/src/ObjCommon/Utils/DistinctMapper.h b/src/ObjCommon/Utils/DistinctMapper.h index c34b1370e..46d616c45 100644 --- a/src/ObjCommon/Utils/DistinctMapper.h +++ b/src/ObjCommon/Utils/DistinctMapper.h @@ -1,12 +1,11 @@ #pragma once +#include "Utils/ClassUtils.h" + #include #include -#include "Utils/ClassUtils.h" - -template -class DistinctMapper +template class DistinctMapper { public: DistinctMapper() diff --git a/src/ObjCommon/Utils/FileToZlibWrapper.cpp b/src/ObjCommon/Utils/FileToZlibWrapper.cpp index 60bf8525a..160262539 100644 --- a/src/ObjCommon/Utils/FileToZlibWrapper.cpp +++ b/src/ObjCommon/Utils/FileToZlibWrapper.cpp @@ -8,8 +8,7 @@ voidpf Wrapper_Zlib_FileOpen(voidpf opaque, const char*, int) return opaque; } -template -uLong Wrapper_Zlib_FileRead(voidpf opaque, voidpf stream, void* buf, const uLong size) +template uLong Wrapper_Zlib_FileRead(voidpf opaque, voidpf stream, void* buf, const uLong size) { auto* file = static_cast(stream); @@ -23,8 +22,7 @@ uLong Wrapper_Zlib_NoFileRead(voidpf opaque, voidpf stream, void* buf, const uLo return 0; } -template -uLong Wrapper_Zlib_FileWrite(voidpf opaque, voidpf stream, const void* buf, const uLong size) +template uLong Wrapper_Zlib_FileWrite(voidpf opaque, voidpf stream, const void* buf, const uLong size) { auto* file = static_cast(stream); file->write(static_cast(buf), size); @@ -36,24 +34,21 @@ uLong Wrapper_Zlib_NoFileWrite(voidpf opaque, voidpf stream, const void* buf, co return 0; } -template -long Wrapper_Zlib_FileTellRead(voidpf opaque, voidpf stream) +template long Wrapper_Zlib_FileTellRead(voidpf opaque, voidpf stream) { auto* file = static_cast(stream); - + return static_cast(file->tellg()); } -template -long Wrapper_Zlib_FileTellWrite(voidpf opaque, voidpf stream) +template long Wrapper_Zlib_FileTellWrite(voidpf opaque, voidpf stream) { auto* file = static_cast(stream); - + return static_cast(file->tellp()); } -template -long Wrapper_Zlib_FileSeekRead(voidpf opaque, voidpf stream, const uLong offset, const int origin) +template long Wrapper_Zlib_FileSeekRead(voidpf opaque, voidpf stream, const uLong offset, const int origin) { auto* file = static_cast(stream); @@ -78,8 +73,7 @@ long Wrapper_Zlib_FileSeekRead(voidpf opaque, voidpf stream, const uLong offset, return 0; } -template -long Wrapper_Zlib_FileSeekWrite(voidpf opaque, voidpf stream, const uLong offset, const int origin) +template long Wrapper_Zlib_FileSeekWrite(voidpf opaque, voidpf stream, const uLong offset, const int origin) { auto* file = static_cast(stream); @@ -104,8 +98,7 @@ long Wrapper_Zlib_FileSeekWrite(voidpf opaque, voidpf stream, const uLong offset return 0; } -template -int Wrapper_Zlib_FileClose(voidpf opaque, voidpf stream) +template int Wrapper_Zlib_FileClose(voidpf opaque, voidpf stream) { return 0; // auto* file = static_cast(stream); @@ -126,8 +119,7 @@ int Wrapper_Zlib_FileError(voidpf opaque, voidpf stream) zlib_filefunc_def FileToZlibWrapper::CreateFunctions32ForFile(std::iostream* stream) { - return zlib_filefunc_def_s - { + return zlib_filefunc_def_s{ Wrapper_Zlib_FileOpen, Wrapper_Zlib_FileRead, Wrapper_Zlib_FileWrite, @@ -135,14 +127,13 @@ zlib_filefunc_def FileToZlibWrapper::CreateFunctions32ForFile(std::iostream* str Wrapper_Zlib_FileSeekRead, Wrapper_Zlib_FileClose, Wrapper_Zlib_FileError, - stream + stream, }; } zlib_filefunc_def FileToZlibWrapper::CreateFunctions32ForFile(std::istream* stream) { - return zlib_filefunc_def_s - { + return zlib_filefunc_def_s{ Wrapper_Zlib_FileOpen, Wrapper_Zlib_FileRead, Wrapper_Zlib_NoFileWrite, @@ -150,14 +141,13 @@ zlib_filefunc_def FileToZlibWrapper::CreateFunctions32ForFile(std::istream* stre Wrapper_Zlib_FileSeekRead, Wrapper_Zlib_FileClose, Wrapper_Zlib_FileError, - stream + stream, }; } zlib_filefunc_def FileToZlibWrapper::CreateFunctions32ForFile(std::ostream* stream) { - return zlib_filefunc_def_s - { + return zlib_filefunc_def_s{ Wrapper_Zlib_FileOpen, Wrapper_Zlib_NoFileRead, Wrapper_Zlib_FileWrite, @@ -165,6 +155,6 @@ zlib_filefunc_def FileToZlibWrapper::CreateFunctions32ForFile(std::ostream* stre Wrapper_Zlib_FileSeekWrite, Wrapper_Zlib_FileClose, Wrapper_Zlib_FileError, - stream + stream, }; } diff --git a/src/ObjCommon/Utils/FileToZlibWrapper.h b/src/ObjCommon/Utils/FileToZlibWrapper.h index b5fc4251d..f0f5b735f 100644 --- a/src/ObjCommon/Utils/FileToZlibWrapper.h +++ b/src/ObjCommon/Utils/FileToZlibWrapper.h @@ -1,12 +1,12 @@ #pragma once +#include "ObjStream.h" + #include #include #include #include -#include "ObjStream.h" - class FileToZlibWrapper { public: diff --git a/src/ObjCommon/Utils/ObjFileStream.h b/src/ObjCommon/Utils/ObjFileStream.h index 993609fc3..094448cb7 100644 --- a/src/ObjCommon/Utils/ObjFileStream.h +++ b/src/ObjCommon/Utils/ObjFileStream.h @@ -100,4 +100,4 @@ // using fobjbuf = basic_fobjbuf>; // using fobjstream = basic_fobjstream>; // using ifobjstream = basic_ifobjstream>; -// using ofobjstream = basic_ofobjstream>; \ No newline at end of file +// using ofobjstream = basic_ofobjstream>; diff --git a/src/ObjCommon/Utils/ObjStream.h b/src/ObjCommon/Utils/ObjStream.h index acb672aba..e67d7319a 100644 --- a/src/ObjCommon/Utils/ObjStream.h +++ b/src/ObjCommon/Utils/ObjStream.h @@ -2,23 +2,21 @@ // ReSharper disable IdentifierTypo #pragma once +#include "Utils/ClassUtils.h" + #include -#include #include #include +#include -#include "Utils/ClassUtils.h" - -template -class basic_objbuf : public std::basic_streambuf +template class basic_objbuf : public std::basic_streambuf { public: _NODISCARD virtual bool is_open() const = 0; virtual bool close() = 0; }; -template -class basic_objstream : public std::basic_iostream +template class basic_objstream : public std::basic_iostream { public: using mybase = std::basic_iostream; @@ -44,7 +42,7 @@ class basic_objstream : public std::basic_iostream ~basic_objstream() override { - if(m_ob) + if (m_ob) m_ob->close(); } @@ -86,8 +84,7 @@ class basic_objstream : public std::basic_iostream std::unique_ptr m_ob; }; -template -class basic_iobjstream : public std::basic_istream +template class basic_iobjstream : public std::basic_istream { public: using mybase = std::basic_istream; @@ -151,8 +148,7 @@ class basic_iobjstream : public std::basic_istream std::unique_ptr m_ob; }; -template -class basic_oobjstream : public std::basic_ostream +template class basic_oobjstream : public std::basic_ostream { public: using mybase = std::basic_ostream; @@ -192,7 +188,7 @@ class basic_oobjstream : public std::basic_ostream swap(other); return *this; } - + // ReSharper disable once CppHidingFunction _NODISCARD myob* rdbuf() const { diff --git a/src/ObjLoading/AssetLoading/AbstractGdtEntryReader.h b/src/ObjLoading/AssetLoading/AbstractGdtEntryReader.h index df45dcf70..a373570be 100644 --- a/src/ObjLoading/AssetLoading/AbstractGdtEntryReader.h +++ b/src/ObjLoading/AssetLoading/AbstractGdtEntryReader.h @@ -1,10 +1,10 @@ #pragma once -#include - #include "Math/Vector.h" -#include "Utils/ClassUtils.h" #include "Obj/Gdt/GdtEntry.h" +#include "Utils/ClassUtils.h" + +#include class GdtReadingException : public std::exception { diff --git a/src/ObjLoading/AssetLoading/AssetLoadingContext.h b/src/ObjLoading/AssetLoading/AssetLoadingContext.h index aeb9377dd..b1744bb16 100644 --- a/src/ObjLoading/AssetLoading/AssetLoadingContext.h +++ b/src/ObjLoading/AssetLoading/AssetLoadingContext.h @@ -1,15 +1,15 @@ #pragma once -#include -#include -#include - #include "IGdtQueryable.h" #include "IZoneAssetLoaderState.h" #include "Obj/Gdt/Gdt.h" #include "SearchPath/ISearchPath.h" #include "Zone/Zone.h" +#include +#include +#include + class AssetLoadingContext final : public IGdtQueryable { std::unordered_map> m_entries_by_gdf_and_by_name; @@ -26,14 +26,13 @@ class AssetLoadingContext final : public IGdtQueryable AssetLoadingContext(Zone* zone, ISearchPath* rawSearchPath, std::vector gdtFiles); GdtEntry* GetGdtEntryByGdfAndName(const std::string& gdfName, const std::string& entryName) override; - template - T* GetZoneAssetLoaderState() + template T* GetZoneAssetLoaderState() { static_assert(std::is_base_of_v, "T must inherit IZoneAssetLoaderState"); // T must also have a public default constructor const auto foundEntry = m_zone_asset_loader_states.find(typeid(T)); - if(foundEntry != m_zone_asset_loader_states.end()) + if (foundEntry != m_zone_asset_loader_states.end()) return dynamic_cast(foundEntry->second.get()); auto newState = std::make_unique(); diff --git a/src/ObjLoading/AssetLoading/AssetLoadingManager.cpp b/src/ObjLoading/AssetLoading/AssetLoadingManager.cpp index e4fee2eef..371239e90 100644 --- a/src/ObjLoading/AssetLoading/AssetLoadingManager.cpp +++ b/src/ObjLoading/AssetLoading/AssetLoadingManager.cpp @@ -1,10 +1,11 @@ #include "AssetLoadingManager.h" + #include -AssetLoadingManager::AssetLoadingManager(const std::map>& assetLoadersByType, AssetLoadingContext& context): - m_asset_loaders_by_type(assetLoadersByType), - m_context(context), - m_last_dependency_loaded(nullptr) +AssetLoadingManager::AssetLoadingManager(const std::map>& assetLoadersByType, AssetLoadingContext& context) + : m_asset_loaders_by_type(assetLoadersByType), + m_context(context), + m_last_dependency_loaded(nullptr) { } @@ -18,20 +19,30 @@ AssetLoadingContext* AssetLoadingManager::GetAssetLoadingContext() const return &m_context; } -XAssetInfoGeneric* AssetLoadingManager::AddAsset(const asset_type_t assetType, const std::string& assetName, void* asset, std::vector dependencies, std::vector usedScriptStrings, - Zone* zone) +XAssetInfoGeneric* AssetLoadingManager::AddAsset(const asset_type_t assetType, + const std::string& assetName, + void* asset, + std::vector dependencies, + std::vector usedScriptStrings, + Zone* zone) { m_last_dependency_loaded = m_context.m_zone->m_pools->AddAsset(assetType, assetName, asset, std::move(dependencies), std::move(usedScriptStrings), zone); if (m_last_dependency_loaded == nullptr) - std::cout << "Failed to add asset of type \"" << m_context.m_zone->m_pools->GetAssetTypeName(assetType) << "\" to pool: \"" << assetName << "\"" << std::endl; + std::cout << "Failed to add asset of type \"" << m_context.m_zone->m_pools->GetAssetTypeName(assetType) << "\" to pool: \"" << assetName << "\"" + << std::endl; return m_last_dependency_loaded; } -XAssetInfoGeneric* AssetLoadingManager::AddAsset(const asset_type_t assetType, const std::string& assetName, void* asset, std::vector dependencies, std::vector usedScriptStrings) +XAssetInfoGeneric* AssetLoadingManager::AddAsset(const asset_type_t assetType, + const std::string& assetName, + void* asset, + std::vector dependencies, + std::vector usedScriptStrings) { m_last_dependency_loaded = m_context.m_zone->m_pools->AddAsset(assetType, assetName, asset, std::move(dependencies), std::move(usedScriptStrings)); if (m_last_dependency_loaded == nullptr) - std::cout << "Failed to add asset of type \"" << m_context.m_zone->m_pools->GetAssetTypeName(assetType) << "\" to pool: \"" << assetName << "\"" << std::endl; + std::cout << "Failed to add asset of type \"" << m_context.m_zone->m_pools->GetAssetTypeName(assetType) << "\" to pool: \"" << assetName << "\"" + << std::endl; return m_last_dependency_loaded; } @@ -54,19 +65,26 @@ XAssetInfoGeneric* AssetLoadingManager::LoadIgnoredDependency(const asset_type_t if (existingAsset) { std::vector dependencies; - AddAsset(existingAsset->m_type, existingAsset->m_name, existingAsset->m_ptr, std::vector(), std::vector(), existingAsset->m_zone); + AddAsset(existingAsset->m_type, + existingAsset->m_name, + existingAsset->m_ptr, + std::vector(), + std::vector(), + existingAsset->m_zone); auto* lastDependency = m_last_dependency_loaded; m_last_dependency_loaded = nullptr; return lastDependency; } - std::cout << "Failed to create empty asset \"" << assetName << "\" for type \"" << m_context.m_zone->m_pools->GetAssetTypeName(assetType) << "\"" << std::endl; + std::cout << "Failed to create empty asset \"" << assetName << "\" for type \"" << m_context.m_zone->m_pools->GetAssetTypeName(assetType) << "\"" + << std::endl; return nullptr; } XAssetInfoGeneric* AssetLoadingManager::LoadAssetDependency(const asset_type_t assetType, const std::string& assetName, IAssetLoader* loader) { - if (loader->CanLoadFromGdt() && !m_context.m_gdt_files.empty() && loader->LoadFromGdt(assetName, &m_context, m_context.m_zone->GetMemory(), this, m_context.m_zone)) + if (loader->CanLoadFromGdt() && !m_context.m_gdt_files.empty() + && loader->LoadFromGdt(assetName, &m_context, m_context.m_zone->GetMemory(), this, m_context.m_zone)) { auto* lastDependency = m_last_dependency_loaded; m_last_dependency_loaded = nullptr; @@ -98,10 +116,15 @@ XAssetInfoGeneric* AssetLoadingManager::LoadAssetDependency(const asset_type_t a // Make sure any used script string is available in the created zone // The replacement of the scr_string_t values will be done upon writing - for(const auto scrString : existingAsset->m_used_script_strings) + for (const auto scrString : existingAsset->m_used_script_strings) m_context.m_zone->m_script_strings.AddOrGetScriptString(existingAsset->m_zone->m_script_strings.CValue(scrString)); - AddAsset(existingAsset->m_type, existingAsset->m_name, existingAsset->m_ptr, std::move(dependencies), existingAsset->m_used_script_strings, existingAsset->m_zone); + AddAsset(existingAsset->m_type, + existingAsset->m_name, + existingAsset->m_ptr, + std::move(dependencies), + existingAsset->m_used_script_strings, + existingAsset->m_zone); auto* lastDependency = m_last_dependency_loaded; m_last_dependency_loaded = nullptr; return lastDependency; diff --git a/src/ObjLoading/AssetLoading/AssetLoadingManager.h b/src/ObjLoading/AssetLoading/AssetLoadingManager.h index 62a3007d3..aaa1380e9 100644 --- a/src/ObjLoading/AssetLoading/AssetLoadingManager.h +++ b/src/ObjLoading/AssetLoading/AssetLoadingManager.h @@ -1,10 +1,10 @@ #pragma once -#include - #include "AssetLoadingContext.h" #include "IAssetLoader.h" #include "IAssetLoadingManager.h" +#include + class AssetLoadingManager final : public IAssetLoadingManager { const std::map>& m_asset_loaders_by_type; @@ -14,7 +14,12 @@ class AssetLoadingManager final : public IAssetLoadingManager XAssetInfoGeneric* LoadIgnoredDependency(asset_type_t assetType, const std::string& assetName, IAssetLoader* loader); XAssetInfoGeneric* LoadAssetDependency(asset_type_t assetType, const std::string& assetName, IAssetLoader* loader); - XAssetInfoGeneric* AddAsset(asset_type_t assetType, const std::string& assetName, void* asset, std::vector dependencies, std::vector usedScriptStrings, Zone* zone); + XAssetInfoGeneric* AddAsset(asset_type_t assetType, + const std::string& assetName, + void* asset, + std::vector dependencies, + std::vector usedScriptStrings, + Zone* zone); public: AssetLoadingManager(const std::map>& assetLoadersByType, AssetLoadingContext& context); @@ -23,6 +28,10 @@ class AssetLoadingManager final : public IAssetLoadingManager _NODISCARD AssetLoadingContext* GetAssetLoadingContext() const override; - XAssetInfoGeneric* AddAsset(asset_type_t assetType, const std::string& assetName, void* asset, std::vector dependencies, std::vector usedScriptStrings) override; + XAssetInfoGeneric* AddAsset(asset_type_t assetType, + const std::string& assetName, + void* asset, + std::vector dependencies, + std::vector usedScriptStrings) override; XAssetInfoGeneric* LoadDependency(asset_type_t assetType, const std::string& assetName) override; }; diff --git a/src/ObjLoading/AssetLoading/BasicAssetLoader.h b/src/ObjLoading/AssetLoading/BasicAssetLoader.h index 0f74428da..0b27f9b0b 100644 --- a/src/ObjLoading/AssetLoading/BasicAssetLoader.h +++ b/src/ObjLoading/AssetLoading/BasicAssetLoader.h @@ -2,8 +2,7 @@ #include "IAssetLoader.h" #include "Pool/GlobalAssetPool.h" -template -class BasicAssetLoaderWithoutType : public IAssetLoader +template class BasicAssetLoaderWithoutType : public IAssetLoader { public: _NODISCARD XAssetInfoGeneric* LoadFromGlobalAssetPools(const std::string& assetName) const override @@ -12,8 +11,7 @@ class BasicAssetLoaderWithoutType : public IAssetLoader } }; -template -class BasicAssetLoader : public BasicAssetLoaderWithoutType +template class BasicAssetLoader : public BasicAssetLoaderWithoutType { public: _NODISCARD asset_type_t GetHandlingAssetType() const override diff --git a/src/ObjLoading/AssetLoading/IAssetLoader.h b/src/ObjLoading/AssetLoading/IAssetLoader.h index 7ecde3246..060ec4260 100644 --- a/src/ObjLoading/AssetLoading/IAssetLoader.h +++ b/src/ObjLoading/AssetLoading/IAssetLoader.h @@ -1,12 +1,12 @@ #pragma once -#include - -#include "Utils/ClassUtils.h" -#include "SearchPath/ISearchPath.h" #include "IAssetLoadingManager.h" #include "IGdtQueryable.h" +#include "SearchPath/ISearchPath.h" +#include "Utils/ClassUtils.h" #include "Zone/ZoneTypes.h" +#include + class IAssetLoader { public: diff --git a/src/ObjLoading/AssetLoading/IAssetLoadingManager.h b/src/ObjLoading/AssetLoading/IAssetLoadingManager.h index e92aa9207..65d0bc70c 100644 --- a/src/ObjLoading/AssetLoading/IAssetLoadingManager.h +++ b/src/ObjLoading/AssetLoading/IAssetLoadingManager.h @@ -1,10 +1,10 @@ #pragma once -#include - #include "AssetLoadingContext.h" #include "Pool/XAssetInfo.h" -#include "Zone/ZoneTypes.h" #include "Utils/ClassUtils.h" +#include "Zone/ZoneTypes.h" + +#include class IAssetLoadingManager { @@ -18,10 +18,16 @@ class IAssetLoadingManager _NODISCARD virtual AssetLoadingContext* GetAssetLoadingContext() const = 0; - virtual XAssetInfoGeneric* AddAsset(asset_type_t assetType, const std::string& assetName, void* asset, std::vector dependencies, std::vector usedScriptStrings) = 0; + virtual XAssetInfoGeneric* AddAsset(asset_type_t assetType, + const std::string& assetName, + void* asset, + std::vector dependencies, + std::vector usedScriptStrings) = 0; + XAssetInfoGeneric* AddAsset(const asset_type_t assetType, const std::string& assetName, void* asset) { return AddAsset(assetType, assetName, asset, std::vector(), std::vector()); } + virtual XAssetInfoGeneric* LoadDependency(asset_type_t assetType, const std::string& assetName) = 0; }; diff --git a/src/ObjLoading/AssetLoading/IGdtQueryable.h b/src/ObjLoading/AssetLoading/IGdtQueryable.h index 79ff4ff8d..09b034e57 100644 --- a/src/ObjLoading/AssetLoading/IGdtQueryable.h +++ b/src/ObjLoading/AssetLoading/IGdtQueryable.h @@ -1,8 +1,8 @@ #pragma once -#include - #include "Obj/Gdt/GdtEntry.h" +#include + class IGdtQueryable { public: diff --git a/src/ObjLoading/AssetLoading/SndCurve/SndCurveReader.cpp b/src/ObjLoading/AssetLoading/SndCurve/SndCurveReader.cpp index 5649a25ef..36d52b56f 100644 --- a/src/ObjLoading/AssetLoading/SndCurve/SndCurveReader.cpp +++ b/src/ObjLoading/AssetLoading/SndCurve/SndCurveReader.cpp @@ -2,9 +2,9 @@ #include "Parsing/Impl/AbstractParser.h" #include "Parsing/Impl/ParserSingleInputStream.h" +#include "Parsing/Simple/Matcher/SimpleMatcherFactory.h" #include "Parsing/Simple/SimpleLexer.h" #include "Parsing/Simple/SimpleParserValue.h" -#include "Parsing/Simple/Matcher/SimpleMatcherFactory.h" enum class SndCurveParserStatus { @@ -36,7 +36,7 @@ class SndCurveMagicSequence final : public snd_sequence_t { const SimpleMatcherFactory create(this); AddMatchers({ - create.Keyword("SNDCURVE") + create.Keyword("SNDCURVE"), }); } @@ -56,7 +56,7 @@ class SndCurveKnotCountSequence final : public snd_sequence_t { const SimpleMatcherFactory create(this); AddMatchers({ - create.Integer().Capture(CAPTURE_KNOT_COUNT) + create.Integer().Capture(CAPTURE_KNOT_COUNT), }); } @@ -84,15 +84,19 @@ class SndCurveKnotSequence final : public snd_sequence_t { const SimpleMatcherFactory create(this); AddMatchers({ - create.Or({ - create.FloatingPoint(), - create.Integer() - }).Capture(CAPTURE_X), - - create.Or({ - create.FloatingPoint(), - create.Integer() - }).Capture(CAPTURE_Y), + create + .Or({ + create.FloatingPoint(), + create.Integer(), + }) + .Capture(CAPTURE_X), + + create + .Or({ + create.FloatingPoint(), + create.Integer(), + }) + .Capture(CAPTURE_Y), }); } @@ -135,31 +139,28 @@ class SndCurveParser final : public AbstractParserm_status) { case SndCurveParserStatus::EXPECT_MAGIC: - { - static std::vector expectMagicSequences - { - new SndCurveMagicSequence() - }; - return expectMagicSequences; - } + { + static std::vector expectMagicSequences{ + new SndCurveMagicSequence(), + }; + return expectMagicSequences; + } case SndCurveParserStatus::EXPECT_KNOT_COUNT: - { - static std::vector expectKnotCountSequences - { - new SndCurveKnotCountSequence() - }; - return expectKnotCountSequences; - } + { + static std::vector expectKnotCountSequences{ + new SndCurveKnotCountSequence(), + }; + return expectKnotCountSequences; + } case SndCurveParserStatus::KNOTS: - { - static std::vector knotsSequences - { - new SndCurveKnotSequence() - }; - return knotsSequences; - } + { + static std::vector knotsSequences{ + new SndCurveKnotSequence(), + }; + return knotsSequences; + } } assert(false); @@ -203,7 +204,7 @@ std::unique_ptr SndCurveReader::Read() const return nullptr; } - if(!parser.HasExpectedKnotCount()) + if (!parser.HasExpectedKnotCount()) { std::cerr << "Failed to load SndCurve: Actual knot count differs from expected: \"" << m_filename << "\"\n"; return nullptr; diff --git a/src/ObjLoading/AssetLoading/SndCurve/SndCurveReader.h b/src/ObjLoading/AssetLoading/SndCurve/SndCurveReader.h index 58ecec889..c80679279 100644 --- a/src/ObjLoading/AssetLoading/SndCurve/SndCurveReader.h +++ b/src/ObjLoading/AssetLoading/SndCurve/SndCurveReader.h @@ -1,10 +1,10 @@ #pragma once +#include "Utils/ClassUtils.h" + #include -#include #include - -#include "Utils/ClassUtils.h" +#include class SndCurveReader { @@ -17,7 +17,7 @@ class SndCurveReader double m_x; double m_y; }; - + std::vector m_knots; }; diff --git a/src/ObjLoading/Game/IW3/AssetLoaders/AssetLoaderGfxImage.cpp b/src/ObjLoading/Game/IW3/AssetLoaders/AssetLoaderGfxImage.cpp index afe24bdea..4bfc75060 100644 --- a/src/ObjLoading/Game/IW3/AssetLoaders/AssetLoaderGfxImage.cpp +++ b/src/ObjLoading/Game/IW3/AssetLoaders/AssetLoaderGfxImage.cpp @@ -1,12 +1,12 @@ #include "AssetLoaderGfxImage.h" -#include -#include - #include "Game/IW3/IW3.h" #include "Image/DdsLoader.h" -#include "Pool/GlobalAssetPool.h" #include "Image/IwiTypes.h" +#include "Pool/GlobalAssetPool.h" + +#include +#include using namespace IW3; @@ -23,7 +23,8 @@ bool AssetLoaderGfxImage::CanLoadFromRaw() const return true; } -bool AssetLoaderGfxImage::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderGfxImage::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { // Do not load any GfxImages from raw for now that are not loaded // TODO: Load iwis and add streaming info to asset diff --git a/src/ObjLoading/Game/IW3/AssetLoaders/AssetLoaderGfxImage.h b/src/ObjLoading/Game/IW3/AssetLoaders/AssetLoaderGfxImage.h index c9541a61a..1e8f2b50f 100644 --- a/src/ObjLoading/Game/IW3/AssetLoaders/AssetLoaderGfxImage.h +++ b/src/ObjLoading/Game/IW3/AssetLoaders/AssetLoaderGfxImage.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW3/IW3.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/IW3/IW3.h" #include "SearchPath/ISearchPath.h" namespace IW3 @@ -11,6 +11,7 @@ namespace IW3 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace IW3 diff --git a/src/ObjLoading/Game/IW3/AssetLoaders/AssetLoaderRawFile.cpp b/src/ObjLoading/Game/IW3/AssetLoaders/AssetLoaderRawFile.cpp index 259c00eb1..e7a8607f1 100644 --- a/src/ObjLoading/Game/IW3/AssetLoaders/AssetLoaderRawFile.cpp +++ b/src/ObjLoading/Game/IW3/AssetLoaders/AssetLoaderRawFile.cpp @@ -1,10 +1,10 @@ #include "AssetLoaderRawFile.h" -#include - #include "Game/IW3/IW3.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW3; void* AssetLoaderRawFile::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) @@ -20,7 +20,8 @@ bool AssetLoaderRawFile::CanLoadFromRaw() const return true; } -bool AssetLoaderRawFile::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderRawFile::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto file = searchPath->Open(assetName); if (!file.IsOpen()) diff --git a/src/ObjLoading/Game/IW3/AssetLoaders/AssetLoaderRawFile.h b/src/ObjLoading/Game/IW3/AssetLoaders/AssetLoaderRawFile.h index 290fa77c0..3a2ac7611 100644 --- a/src/ObjLoading/Game/IW3/AssetLoaders/AssetLoaderRawFile.h +++ b/src/ObjLoading/Game/IW3/AssetLoaders/AssetLoaderRawFile.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW3/IW3.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/IW3/IW3.h" #include "SearchPath/ISearchPath.h" namespace IW3 @@ -11,6 +11,7 @@ namespace IW3 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace IW3 diff --git a/src/ObjLoading/Game/IW3/ObjLoaderIW3.cpp b/src/ObjLoading/Game/IW3/ObjLoaderIW3.cpp index 8320b26e0..4cafb0faa 100644 --- a/src/ObjLoading/Game/IW3/ObjLoaderIW3.cpp +++ b/src/ObjLoading/Game/IW3/ObjLoaderIW3.cpp @@ -1,22 +1,26 @@ #include "ObjLoaderIW3.h" -#include "Game/IW3/GameIW3.h" -#include "Game/IW3/GameAssetPoolIW3.h" -#include "ObjContainer/IPak/IPak.h" -#include "ObjLoading.h" #include "AssetLoaders/AssetLoaderGfxImage.h" #include "AssetLoaders/AssetLoaderRawFile.h" #include "AssetLoading/AssetLoadingManager.h" +#include "Game/IW3/GameAssetPoolIW3.h" +#include "Game/IW3/GameIW3.h" #include "Image/Dx9TextureLoader.h" -#include "Image/Texture.h" #include "Image/IwiLoader.h" #include "Image/IwiTypes.h" +#include "Image/Texture.h" +#include "ObjContainer/IPak/IPak.h" +#include "ObjLoading.h" using namespace IW3; ObjLoader::ObjLoader() { -#define REGISTER_ASSET_LOADER(t) {auto l = std::make_unique(); m_asset_loaders_by_type[l->GetHandlingAssetType()] = std::move(l);} +#define REGISTER_ASSET_LOADER(t) \ + { \ + auto l = std::make_unique(); \ + m_asset_loaders_by_type[l->GetHandlingAssetType()] = std::move(l); \ + } #define BASIC_LOADER(assetType, assetClass) BasicAssetLoader REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_PHYSPRESET, PhysPreset)) @@ -58,23 +62,17 @@ bool ObjLoader::SupportsZone(Zone* zone) const bool ObjLoader::IsMpZone(Zone* zone) { - return zone->m_name.compare(0, 3, "mp_") == 0 - || zone->m_name.compare(zone->m_name.length() - 3, 3, "_mp") == 0; + return zone->m_name.compare(0, 3, "mp_") == 0 || zone->m_name.compare(zone->m_name.length() - 3, 3, "_mp") == 0; } bool ObjLoader::IsZmZone(Zone* zone) { - return zone->m_name.compare(0, 3, "zm_") == 0 - || zone->m_name.compare(zone->m_name.length() - 3, 3, "_zm") == 0; + return zone->m_name.compare(0, 3, "zm_") == 0 || zone->m_name.compare(zone->m_name.length() - 3, 3, "_zm") == 0; } -void ObjLoader::LoadReferencedContainersForZone(ISearchPath* searchPath, Zone* zone) const -{ -} +void ObjLoader::LoadReferencedContainersForZone(ISearchPath* searchPath, Zone* zone) const {} -void ObjLoader::UnloadContainersOfZone(Zone* zone) const -{ -} +void ObjLoader::UnloadContainersOfZone(Zone* zone) const {} void ObjLoader::LoadImageFromLoadDef(GfxImage* image, Zone* zone) { @@ -183,4 +181,4 @@ void ObjLoader::FinalizeAssetsForZone(AssetLoadingContext* context) const { for (const auto& [type, loader] : m_asset_loaders_by_type) loader->FinalizeAssetsForZone(context); -} \ No newline at end of file +} diff --git a/src/ObjLoading/Game/IW3/ObjLoaderIW3.h b/src/ObjLoading/Game/IW3/ObjLoaderIW3.h index 1e65e614f..3c44b98d4 100644 --- a/src/ObjLoading/Game/IW3/ObjLoaderIW3.h +++ b/src/ObjLoading/Game/IW3/ObjLoaderIW3.h @@ -1,12 +1,12 @@ #pragma once -#include -#include - -#include "IObjLoader.h" #include "AssetLoading/IAssetLoader.h" -#include "SearchPath/ISearchPath.h" #include "Game/IW3/IW3.h" +#include "IObjLoader.h" +#include "SearchPath/ISearchPath.h" + +#include +#include namespace IW3 { @@ -34,4 +34,4 @@ namespace IW3 bool LoadAssetForZone(AssetLoadingContext* context, asset_type_t assetType, const std::string& assetName) const override; void FinalizeAssetsForZone(AssetLoadingContext* context) const override; }; -} +} // namespace IW3 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderAddonMapEnts.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderAddonMapEnts.cpp index 6c0c2ea65..bc1efe016 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderAddonMapEnts.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderAddonMapEnts.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderAddonMapEnts.h" -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderAddonMapEnts::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderAddonMapEnts.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderAddonMapEnts.h index 20c1be55d..43894c7f6 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderAddonMapEnts.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderAddonMapEnts.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,4 +11,4 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderClipMap.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderClipMap.cpp index 84730867f..874a6ffe8 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderClipMap.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderClipMap.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderClipMap.h" -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderClipMap::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderClipMap.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderClipMap.h index 4e730971f..dabf4c803 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderClipMap.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderClipMap.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -22,4 +22,4 @@ namespace IW4 public: _NODISCARD asset_type_t GetHandlingAssetType() const override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderComWorld.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderComWorld.cpp index 931b72e46..bb373c783 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderComWorld.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderComWorld.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderComWorld.h" -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderComWorld::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderComWorld.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderComWorld.h index 3490a46a6..3ae752f6c 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderComWorld.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderComWorld.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,4 +11,4 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFont.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFont.cpp index 8accee5dc..4afef3a49 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFont.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFont.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderFont.h" -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderFont::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFont.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFont.h index 4ed08beea..5917ac150 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFont.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFont.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,4 +11,4 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFx.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFx.cpp index 5c12e978a..4bed0ab55 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFx.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFx.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderFx.h" -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderFx::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFx.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFx.h index b76aa0eb3..aa3ea20c2 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFx.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFx.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,4 +11,4 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFxImpactTable.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFxImpactTable.cpp index 59b282e5f..148e69e09 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFxImpactTable.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFxImpactTable.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderFxImpactTable.h" -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderFxImpactTable::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFxImpactTable.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFxImpactTable.h index 5ab9bb86b..30b39ab7c 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFxImpactTable.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFxImpactTable.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,4 +11,4 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFxWorld.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFxWorld.cpp index 945a84cc7..70c880dba 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFxWorld.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFxWorld.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderFxWorld.h" -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderFxWorld::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFxWorld.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFxWorld.h index e914e7419..801a4e338 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFxWorld.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderFxWorld.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,4 +11,4 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGameWorldMp.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGameWorldMp.cpp index b2100227b..93bf930bf 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGameWorldMp.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGameWorldMp.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderGameWorldMp.h" -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderGameWorldMp::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGameWorldMp.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGameWorldMp.h index 3fafb2253..d03a8c005 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGameWorldMp.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGameWorldMp.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,4 +11,4 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGameWorldSp.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGameWorldSp.cpp index 82788b635..331e7c030 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGameWorldSp.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGameWorldSp.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderGameWorldSp.h" -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderGameWorldSp::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGameWorldSp.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGameWorldSp.h index e0d03d16d..1fb572600 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGameWorldSp.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGameWorldSp.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,4 +11,4 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGfxImage.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGfxImage.cpp index 86d1ac258..10d6697c4 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGfxImage.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGfxImage.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderGfxImage.h" -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderGfxImage::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGfxImage.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGfxImage.h index 911fe22d5..87c0e8754 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGfxImage.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGfxImage.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,4 +11,4 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGfxLightDef.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGfxLightDef.cpp index aedfd2d90..816766f34 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGfxLightDef.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGfxLightDef.cpp @@ -1,13 +1,13 @@ #include "AssetLoaderGfxLightDef.h" +#include "Game/IW4/IW4.h" +#include "ObjLoading.h" +#include "Pool/GlobalAssetPool.h" + #include #include #include -#include "ObjLoading.h" -#include "Game/IW4/IW4.h" -#include "Pool/GlobalAssetPool.h" - using namespace IW4; std::string AssetLoaderGfxLightDef::GetAssetFilename(const std::string& assetName) @@ -32,7 +32,8 @@ bool AssetLoaderGfxLightDef::CanLoadFromRaw() const return true; } -bool AssetLoaderGfxLightDef::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderGfxLightDef::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto filename = GetAssetFilename(assetName); const auto file = searchPath->Open(filename); @@ -53,7 +54,7 @@ bool AssetLoaderGfxLightDef::LoadFromRaw(const std::string& assetName, ISearchPa auto* imageDependency = reinterpret_cast*>(manager->LoadDependency(ASSET_TYPE_IMAGE, imageName)); - if(!imageDependency) + if (!imageDependency) { std::cerr << "Could not load GfxLightDef \"" << assetName << "\" due to missing image \"" << imageName << "\"\n"; return false; diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGfxLightDef.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGfxLightDef.h index e593fc3e7..f4adfadac 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGfxLightDef.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGfxLightDef.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -15,6 +15,7 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGfxWorld.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGfxWorld.cpp index 8676b1d7e..b31d51123 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGfxWorld.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGfxWorld.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderGfxWorld.h" -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderGfxWorld::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGfxWorld.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGfxWorld.h index ae6ec95f7..d3b47fc71 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGfxWorld.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderGfxWorld.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,4 +11,4 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderLeaderboard.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderLeaderboard.cpp index 49e965be6..e87e30424 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderLeaderboard.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderLeaderboard.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderLeaderboard.h" -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderLeaderboard::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderLeaderboard.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderLeaderboard.h index f10497e4f..5578aa7c2 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderLeaderboard.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderLeaderboard.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,4 +11,4 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderLoadedSound.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderLoadedSound.cpp index e0d509478..b94bc60eb 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderLoadedSound.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderLoadedSound.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderLoadedSound.h" -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderLoadedSound::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderLoadedSound.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderLoadedSound.h index 14a0e2bd1..284bbfb75 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderLoadedSound.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderLoadedSound.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,4 +11,4 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderLocalizeEntry.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderLocalizeEntry.cpp index fee16bf76..d4d89ff38 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderLocalizeEntry.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderLocalizeEntry.cpp @@ -1,10 +1,10 @@ #include "AssetLoaderLocalizeEntry.h" -#include - #include "Localize/LocalizeCommon.h" #include "Parsing/LocalizeFile/LocalizeFileReader.h" +#include + using namespace IW4; XAssetInfoGeneric* AssetLoaderLocalizeEntry::LoadFromGlobalAssetPools(const std::string& assetName) const @@ -22,7 +22,8 @@ bool AssetLoaderLocalizeEntry::CanLoadFromRaw() const return true; } -bool AssetLoaderLocalizeEntry::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderLocalizeEntry::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { std::string fileName; { diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderLocalizeEntry.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderLocalizeEntry.h index 55f8c35a9..9833c10bc 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderLocalizeEntry.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderLocalizeEntry.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -12,6 +12,7 @@ namespace IW4 _NODISCARD XAssetInfoGeneric* LoadFromGlobalAssetPools(const std::string& assetName) const override; _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMapEnts.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMapEnts.cpp index 627e66b2f..012cb0f8e 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMapEnts.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMapEnts.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderMapEnts.h" -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderMapEnts::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMapEnts.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMapEnts.h index 28adc57c3..8819c1ae5 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMapEnts.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMapEnts.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,4 +11,4 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMaterial.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMaterial.cpp index a17e7ef70..2d75deafd 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMaterial.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMaterial.cpp @@ -1,12 +1,6 @@ #include "AssetLoaderMaterial.h" -#include -#include -#include -#include - #include "AssetLoaderTechniqueSet.h" -#include "ObjLoading.h" #include "AssetLoading/AbstractGdtEntryReader.h" #include "Game/IW4/CommonIW4.h" #include "Game/IW4/IW4.h" @@ -14,11 +8,17 @@ #include "Game/IW4/ObjConstantsIW4.h" #include "Game/IW4/TechsetConstantsIW4.h" #include "Math/Vector.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" #include "StateMap/StateMapFromTechniqueExtractor.h" #include "StateMap/StateMapHandler.h" #include "Techset/TechniqueFileReader.h" +#include +#include +#include +#include + using namespace IW4; namespace IW4 @@ -68,9 +68,7 @@ namespace IW4 { const auto materialType = ReadStringProperty("materialType"); - if (materialType == GDT_MATERIAL_TYPE_MODEL_PHONG - || materialType == GDT_MATERIAL_TYPE_WORLD_PHONG - || materialType == GDT_MATERIAL_TYPE_IMPACT_MARK) + if (materialType == GDT_MATERIAL_TYPE_MODEL_PHONG || materialType == GDT_MATERIAL_TYPE_WORLD_PHONG || materialType == GDT_MATERIAL_TYPE_IMPACT_MARK) { mtl_phong_template(); } @@ -82,8 +80,7 @@ namespace IW4 { mtl_2d_template(); } - else if (materialType == GDT_MATERIAL_TYPE_MODEL_UNLIT - || materialType == GDT_MATERIAL_TYPE_WORLD_UNLIT) + else if (materialType == GDT_MATERIAL_TYPE_MODEL_UNLIT || materialType == GDT_MATERIAL_TYPE_WORLD_UNLIT) { mtl_unlit_template(); } @@ -557,11 +554,10 @@ namespace IW4 sortKey = GDT_SORTKEY_DECAL_WEAPON_IMPACT; else if (materialType == GDT_MATERIAL_TYPE_EFFECT) sortKey = GDT_SORTKEY_EFFECT_AUTO_SORT; - else if (materialType == GDT_MATERIAL_TYPE_OBJECTIVE - || blendFunc == "Blend" || blendFunc == "Add" || blendFunc == "Screen Add") + else if (materialType == GDT_MATERIAL_TYPE_OBJECTIVE || blendFunc == "Blend" || blendFunc == "Add" || blendFunc == "Screen Add") sortKey = GDT_SORTKEY_BLEND_ADDITIVE; - // else if (blendFunc == "Multiply") // TODO - // sortKey = GDT_SORTKEY_MULTIPLICATIVE; + // else if (blendFunc == "Multiply") // TODO + // sortKey = GDT_SORTKEY_MULTIPLICATIVE; else if (materialType == GDT_MATERIAL_TYPE_SKY) sortKey = GDT_SORTKEY_SKY; else if (materialType == GDT_MATERIAL_TYPE_MODEL_AMBIENT) @@ -599,9 +595,7 @@ namespace IW4 } } - void clamp_template() - { - } + void clamp_template() {} void textureAtlas_template() { @@ -674,11 +668,15 @@ namespace IW4 else if (blendFunc == GDT_BLEND_FUNC_CUSTOM) { const auto customBlendOpRgb = ReadEnumProperty("customBlendOpRgb", GdtBlendOpNames, std::extent_v); - const auto srcCustomBlendFunc = ReadEnumProperty("srcCustomBlendFunc", GdtCustomBlendFuncNames, std::extent_v); - const auto destCustomBlendFunc = ReadEnumProperty("destCustomBlendFunc", GdtCustomBlendFuncNames, std::extent_v); + const auto srcCustomBlendFunc = + ReadEnumProperty("srcCustomBlendFunc", GdtCustomBlendFuncNames, std::extent_v); + const auto destCustomBlendFunc = + ReadEnumProperty("destCustomBlendFunc", GdtCustomBlendFuncNames, std::extent_v); const auto customBlendOpAlpha = ReadEnumProperty("customBlendOpAlpha", GdtBlendOpNames, std::extent_v); - const auto srcCustomBlendFuncAlpha = ReadEnumProperty("srcCustomBlendFuncAlpha", GdtCustomBlendFuncNames, std::extent_v); - const auto destCustomBlendFuncAlpha = ReadEnumProperty("destCustomBlendFuncAlpha", GdtCustomBlendFuncNames, std::extent_v); + const auto srcCustomBlendFuncAlpha = + ReadEnumProperty("srcCustomBlendFuncAlpha", GdtCustomBlendFuncNames, std::extent_v); + const auto destCustomBlendFuncAlpha = + ReadEnumProperty("destCustomBlendFuncAlpha", GdtCustomBlendFuncNames, std::extent_v); SetBlendFunc(customBlendOpRgb, srcCustomBlendFunc, destCustomBlendFunc); SetSeparateAlphaBlendFunc(customBlendOpAlpha, srcCustomBlendFuncAlpha, destCustomBlendFuncAlpha); @@ -693,10 +691,14 @@ namespace IW4 void colorwrite_template() { - const auto colorWriteRed = ReadEnumProperty("colorWriteRed", GdtStateBitsEnabledStatusNames, std::extent_v); - const auto colorWriteGreen = ReadEnumProperty("colorWriteGreen", GdtStateBitsEnabledStatusNames, std::extent_v); - const auto colorWriteBlue = ReadEnumProperty("colorWriteBlue", GdtStateBitsEnabledStatusNames, std::extent_v); - const auto colorWriteAlpha = ReadEnumProperty("colorWriteAlpha", GdtStateBitsEnabledStatusNames, std::extent_v); + const auto colorWriteRed = ReadEnumProperty( + "colorWriteRed", GdtStateBitsEnabledStatusNames, std::extent_v); + const auto colorWriteGreen = ReadEnumProperty( + "colorWriteGreen", GdtStateBitsEnabledStatusNames, std::extent_v); + const auto colorWriteBlue = ReadEnumProperty( + "colorWriteBlue", GdtStateBitsEnabledStatusNames, std::extent_v); + const auto colorWriteAlpha = ReadEnumProperty( + "colorWriteAlpha", GdtStateBitsEnabledStatusNames, std::extent_v); SetColorWrite(colorWriteRed, colorWriteGreen, colorWriteBlue, colorWriteAlpha); } @@ -717,7 +719,8 @@ namespace IW4 void depthwrite_template() { - const auto depthWrite = ReadEnumProperty("depthWrite", GdtStateBitsOnOffStatusNames, std::extent_v); + const auto depthWrite = + ReadEnumProperty("depthWrite", GdtStateBitsOnOffStatusNames, std::extent_v); const auto blendFunc = ReadStringProperty("blendFunc"); if (depthWrite == StateBitsEnabledStatus_e::ENABLED) @@ -746,7 +749,8 @@ namespace IW4 void gammawrite_template() { - const auto gammaWrite = ReadEnumProperty("gammaWrite", GdtStateBitsOnOffStatusNames, std::extent_v); + const auto gammaWrite = + ReadEnumProperty("gammaWrite", GdtStateBitsOnOffStatusNames, std::extent_v); if (gammaWrite == StateBitsEnabledStatus_e::UNKNOWN) { @@ -760,7 +764,8 @@ namespace IW4 void polygonoffset_template() { - const auto polygonOffset = ReadEnumProperty("polygonOffset", GdtPolygonOffsetNames, std::extent_v); + const auto polygonOffset = + ReadEnumProperty("polygonOffset", GdtPolygonOffsetNames, std::extent_v); SetPolygonOffset(polygonOffset); } @@ -778,17 +783,23 @@ namespace IW4 { if (stencilMode == StencilMode_e::TWO_SIDED) { - const auto stencilBackFunc = ReadEnumProperty("stencilFunc2", GdtStencilFuncNames, std::extent_v); - const auto stencilBackOpFail = ReadEnumProperty("stencilOpFail2", GdtStencilOpNames, std::extent_v); - const auto stencilBackOpZFail = ReadEnumProperty("stencilOpZFail2", GdtStencilOpNames, std::extent_v); - const auto stencilBackOpPass = ReadEnumProperty("stencilOpPass2", GdtStencilOpNames, std::extent_v); + const auto stencilBackFunc = + ReadEnumProperty("stencilFunc2", GdtStencilFuncNames, std::extent_v); + const auto stencilBackOpFail = + ReadEnumProperty("stencilOpFail2", GdtStencilOpNames, std::extent_v); + const auto stencilBackOpZFail = + ReadEnumProperty("stencilOpZFail2", GdtStencilOpNames, std::extent_v); + const auto stencilBackOpPass = + ReadEnumProperty("stencilOpPass2", GdtStencilOpNames, std::extent_v); EnableStencil(StencilIndex::BACK, stencilBackFunc, stencilBackOpFail, stencilBackOpZFail, stencilBackOpPass); } - const auto stencilFrontFunc = ReadEnumProperty("stencilFunc1", GdtStencilFuncNames, std::extent_v); + const auto stencilFrontFunc = + ReadEnumProperty("stencilFunc1", GdtStencilFuncNames, std::extent_v); const auto stencilFrontOpFail = ReadEnumProperty("stencilOpFail1", GdtStencilOpNames, std::extent_v); - const auto stencilFrontOpZFail = ReadEnumProperty("stencilOpZFail1", GdtStencilOpNames, std::extent_v); + const auto stencilFrontOpZFail = + ReadEnumProperty("stencilOpZFail1", GdtStencilOpNames, std::extent_v); const auto stencilFrontOpPass = ReadEnumProperty("stencilOpPass1", GdtStencilOpNames, std::extent_v); EnableStencil(StencilIndex::FRONT, stencilFrontFunc, stencilFrontOpFail, stencilFrontOpZFail, stencilFrontOpPass); @@ -833,11 +844,13 @@ namespace IW4 if (techsetDefinition->GetTechniqueByIndex(i, techniqueName)) { const auto stateBitsForTechnique = GetStateBitsForTechnique(techniqueName); - const auto foundStateBits = std::find_if(m_state_bits.begin(), m_state_bits.end(), - [stateBitsForTechnique](const GfxStateBits& s1) - { - return s1.loadBits[0] == stateBitsForTechnique.loadBits[0] && s1.loadBits[1] == stateBitsForTechnique.loadBits[1]; - }); + const auto foundStateBits = + std::find_if(m_state_bits.begin(), + m_state_bits.end(), + [stateBitsForTechnique](const GfxStateBits& s1) + { + return s1.loadBits[0] == stateBitsForTechnique.loadBits[0] && s1.loadBits[1] == stateBitsForTechnique.loadBits[1]; + }); if (foundStateBits != m_state_bits.end()) { @@ -928,7 +941,8 @@ namespace IW4 } } - void AddMapTexture(const std::string& typeName, const TileMode_e tileMode, GdtFilter_e filterMode, const TextureSemantic semantic, const std::string& textureName) + void AddMapTexture( + const std::string& typeName, const TileMode_e tileMode, GdtFilter_e filterMode, const TextureSemantic semantic, const std::string& textureName) { MaterialTextureDef textureDef{}; textureDef.nameHash = Common::R_HashString(typeName.c_str()); @@ -1086,7 +1100,9 @@ namespace IW4 m_base_state_bits.loadBits[0] |= ((static_cast(destFunc) - 1) << GFXS0_DSTBLEND_ALPHA_SHIFT) & GFXS0_DSTBLEND_ALPHA_MASK; } - void SetColorWrite(const StateBitsEnabledStatus_e colorWriteRed, const StateBitsEnabledStatus_e colorWriteGreen, const StateBitsEnabledStatus_e colorWriteBlue, + void SetColorWrite(const StateBitsEnabledStatus_e colorWriteRed, + const StateBitsEnabledStatus_e colorWriteGreen, + const StateBitsEnabledStatus_e colorWriteBlue, const StateBitsEnabledStatus_e colorWriteAlpha) { if (colorWriteRed == StateBitsEnabledStatus_e::UNKNOWN || colorWriteGreen == StateBitsEnabledStatus_e::UNKNOWN @@ -1200,8 +1216,16 @@ namespace IW4 m_base_state_bits.loadBits[1] |= ((static_cast(polygonOffset) - 1) << GFXS1_POLYGON_OFFSET_SHIFT) & GFXS1_POLYGON_OFFSET_MASK; } - static void GetStencilMasksForIndex(const StencilIndex stencil, unsigned& enabledMask, unsigned& funcShift, unsigned& funcMask, unsigned& opFailShift, unsigned& opFailMask, - unsigned& opZFailShift, unsigned& opZFailMask, unsigned& opPassShift, unsigned& opPassMask) + static void GetStencilMasksForIndex(const StencilIndex stencil, + unsigned& enabledMask, + unsigned& funcShift, + unsigned& funcMask, + unsigned& opFailShift, + unsigned& opFailMask, + unsigned& opZFailShift, + unsigned& opZFailMask, + unsigned& opPassShift, + unsigned& opPassMask) { if (stencil == StencilIndex::FRONT) { @@ -1239,7 +1263,8 @@ namespace IW4 m_base_state_bits.loadBits[1] &= ~(enabledMask | funcMask | opFailMask | opZFailMask | opPassMask); } - void EnableStencil(const StencilIndex stencil, StencilFunc_e stencilFunc, StencilOp_e stencilOpFail, StencilOp_e stencilOpZFail, StencilOp_e stencilOpPass) + void EnableStencil( + const StencilIndex stencil, StencilFunc_e stencilFunc, StencilOp_e stencilOpFail, StencilOp_e stencilOpZFail, StencilOp_e stencilOpPass) { unsigned enabledMask, funcShift, funcMask, opFailShift, opFailMask, opZFailShift, opZFailMask, opPassShift, opPassMask; GetStencilMasksForIndex(stencil, enabledMask, funcShift, funcMask, opFailShift, opFailMask, opZFailShift, opZFailMask, opPassShift, opPassMask); @@ -1298,7 +1323,8 @@ namespace IW4 } } - static size_t GetIndexForString(const std::string& propertyName, const std::string& value, const char** validValuesArray, const size_t validValuesArraySize) + static size_t + GetIndexForString(const std::string& propertyName, const std::string& value, const char** validValuesArray, const size_t validValuesArraySize) { for (auto i = 0u; i < validValuesArraySize; i++) { @@ -1311,8 +1337,7 @@ namespace IW4 throw GdtReadingException(ss.str()); } - template - T ReadEnumProperty(const std::string& propertyName, const char** validValuesArray, const size_t validValuesArraySize) const + template T ReadEnumProperty(const std::string& propertyName, const char** validValuesArray, const size_t validValuesArraySize) const { return static_cast(GetIndexForString(propertyName, ReadStringProperty(propertyName), validValuesArray, validValuesArraySize)); } @@ -1330,7 +1355,7 @@ namespace IW4 std::vector m_textures; std::vector m_constants; }; -} +} // namespace IW4 void* AssetLoaderMaterial::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) { @@ -1345,7 +1370,8 @@ bool AssetLoaderMaterial::CanLoadFromGdt() const return true; } -bool AssetLoaderMaterial::LoadFromGdt(const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderMaterial::LoadFromGdt( + const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto* entry = gdtQueryable->GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_MATERIAL, assetName); if (!entry) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMaterial.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMaterial.h index 26c363332..d45fa6d90 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMaterial.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMaterial.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,6 +11,7 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromGdt() const override; - bool LoadFromGdt(const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool LoadFromGdt( + const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMenuDef.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMenuDef.cpp index a3dfabbf4..b2fe05008 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMenuDef.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMenuDef.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderMenuDef.h" -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderMenuDef::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMenuDef.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMenuDef.h index 1c264b991..983b2e985 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMenuDef.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMenuDef.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,4 +11,4 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMenuList.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMenuList.cpp index 16fa7bad5..b9745dc71 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMenuList.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMenuList.cpp @@ -1,15 +1,15 @@ #include "AssetLoaderMenuList.h" -#include -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" #include "Game/IW4/Menu/MenuConversionZoneStateIW4.h" #include "Game/IW4/Menu/MenuConverterIW4.h" +#include "ObjLoading.h" #include "Parsing/Menu/MenuFileReader.h" #include "Pool/GlobalAssetPool.h" +#include +#include + using namespace IW4; namespace IW4 @@ -17,8 +17,14 @@ namespace IW4 class MenuLoader { public: - static bool ProcessParsedResults(const std::string& fileName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, menu::ParsingResult* parsingResult, - menu::MenuAssetZoneState* zoneState, MenuConversionZoneState* conversionState, std::vector& menus, + static bool ProcessParsedResults(const std::string& fileName, + ISearchPath* searchPath, + MemoryManager* memory, + IAssetLoadingManager* manager, + menu::ParsingResult* parsingResult, + menu::MenuAssetZoneState* zoneState, + MenuConversionZoneState* conversionState, + std::vector& menus, std::vector& menuListDependencies) { const auto menuCount = parsingResult->m_menus.size(); @@ -28,8 +34,8 @@ namespace IW4 for (const auto& menu : parsingResult->m_menus) totalItemCount += menu->m_items.size(); - std::cout << "Successfully read menu file \"" << fileName << "\" (" << menuLoadCount << " loads, " << menuCount << " menus, " << functionCount << " functions, " << totalItemCount << - " items)\n"; + std::cout << "Successfully read menu file \"" << fileName << "\" (" << menuLoadCount << " loads, " << menuCount << " menus, " << functionCount + << " functions, " << totalItemCount << " items)\n"; // Add all functions to the zone state to make them available for all menus to be converted for (auto& function : parsingResult->m_functions) @@ -51,7 +57,8 @@ namespace IW4 } menus.push_back(menuAsset); - auto* menuAssetInfo = manager->AddAsset(ASSET_TYPE_MENU, menu->m_name, menuAsset, std::move(converter.GetDependencies()), std::vector()); + auto* menuAssetInfo = + manager->AddAsset(ASSET_TYPE_MENU, menu->m_name, menuAsset, std::move(converter.GetDependencies()), std::vector()); if (menuAssetInfo) { @@ -86,20 +93,24 @@ namespace IW4 return menuListAsset; } - static std::unique_ptr ParseMenuFile(const std::string& menuFileName, ISearchPath* searchPath, const menu::MenuAssetZoneState* zoneState) + static std::unique_ptr + ParseMenuFile(const std::string& menuFileName, ISearchPath* searchPath, const menu::MenuAssetZoneState* zoneState) { const auto file = searchPath->Open(menuFileName); if (!file.IsOpen()) return nullptr; - menu::MenuFileReader reader(*file.m_stream, menuFileName, menu::FeatureLevel::IW4, [searchPath](const std::string& filename, const std::string& sourceFile) -> std::unique_ptr - { - auto foundFileToInclude = searchPath->Open(filename); - if (!foundFileToInclude.IsOpen() || !foundFileToInclude.m_stream) - return nullptr; + menu::MenuFileReader reader(*file.m_stream, + menuFileName, + menu::FeatureLevel::IW4, + [searchPath](const std::string& filename, const std::string& sourceFile) -> std::unique_ptr + { + auto foundFileToInclude = searchPath->Open(filename); + if (!foundFileToInclude.IsOpen() || !foundFileToInclude.m_stream) + return nullptr; - return std::move(foundFileToInclude.m_stream); - }); + return std::move(foundFileToInclude.m_stream); + }); reader.IncludeZoneState(zoneState); reader.SetPermissiveMode(ObjLoading::Configuration.MenuPermissiveParsing); @@ -107,7 +118,7 @@ namespace IW4 return reader.ReadMenuFile(); } }; -} +} // namespace IW4 void* AssetLoaderMenuList::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) { @@ -122,8 +133,15 @@ bool AssetLoaderMenuList::CanLoadFromRaw() const return true; } -bool BuildMenuFileQueue(std::deque& menuLoadQueue, const std::string& menuListAssetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, menu::MenuAssetZoneState* zoneState, - MenuConversionZoneState* conversionState, std::vector& menus, std::vector& menuListDependencies) +bool BuildMenuFileQueue(std::deque& menuLoadQueue, + const std::string& menuListAssetName, + ISearchPath* searchPath, + MemoryManager* memory, + IAssetLoadingManager* manager, + menu::MenuAssetZoneState* zoneState, + MenuConversionZoneState* conversionState, + std::vector& menus, + std::vector& menuListDependencies) { const auto alreadyLoadedMenuListFileMenus = conversionState->m_menus_by_filename.find(menuListAssetName); @@ -132,7 +150,8 @@ bool BuildMenuFileQueue(std::deque& menuLoadQueue, const std::strin const auto menuListResult = MenuLoader::ParseMenuFile(menuListAssetName, searchPath, zoneState); if (menuListResult) { - MenuLoader::ProcessParsedResults(menuListAssetName, searchPath, memory, manager, menuListResult.get(), zoneState, conversionState, menus, menuListDependencies); + MenuLoader::ProcessParsedResults( + menuListAssetName, searchPath, memory, manager, menuListResult.get(), zoneState, conversionState, menus, menuListDependencies); for (const auto& menuToLoad : menuListResult->m_menus_to_load) menuLoadQueue.push_back(menuToLoad); @@ -146,8 +165,14 @@ bool BuildMenuFileQueue(std::deque& menuLoadQueue, const std::strin return true; } -void LoadMenuFileFromQueue(const std::string& menuFilePath, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, menu::MenuAssetZoneState* zoneState, - MenuConversionZoneState* conversionState, std::vector& menus, std::vector& menuListDependencies) +void LoadMenuFileFromQueue(const std::string& menuFilePath, + ISearchPath* searchPath, + MemoryManager* memory, + IAssetLoadingManager* manager, + menu::MenuAssetZoneState* zoneState, + MenuConversionZoneState* conversionState, + std::vector& menus, + std::vector& menuListDependencies) { const auto alreadyLoadedMenuFile = conversionState->m_menus_by_filename.find(menuFilePath); if (alreadyLoadedMenuFile != conversionState->m_menus_by_filename.end()) @@ -164,7 +189,8 @@ void LoadMenuFileFromQueue(const std::string& menuFilePath, ISearchPath* searchP const auto menuFileResult = MenuLoader::ParseMenuFile(menuFilePath, searchPath, zoneState); if (menuFileResult) { - MenuLoader::ProcessParsedResults(menuFilePath, searchPath, memory, manager, menuFileResult.get(), zoneState, conversionState, menus, menuListDependencies); + MenuLoader::ProcessParsedResults( + menuFilePath, searchPath, memory, manager, menuFileResult.get(), zoneState, conversionState, menus, menuListDependencies); if (!menuFileResult->m_menus_to_load.empty()) std::cout << "WARNING: Menu file has menus to load even though it is not a menu list, ignoring: \"" << menuFilePath << "\"\n"; } @@ -172,7 +198,8 @@ void LoadMenuFileFromQueue(const std::string& menuFilePath, ISearchPath* searchP std::cerr << "Could not read menu file \"" << menuFilePath << "\"\n"; } -bool AssetLoaderMenuList::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderMenuList::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { std::vector menus; std::vector menuListDependencies; @@ -184,7 +211,7 @@ bool AssetLoaderMenuList::LoadFromRaw(const std::string& assetName, ISearchPath* if (!BuildMenuFileQueue(menuLoadQueue, assetName, searchPath, memory, manager, zoneState, conversionState, menus, menuListDependencies)) return false; - while(!menuLoadQueue.empty()) + while (!menuLoadQueue.empty()) { const auto& menuFileToLoad = menuLoadQueue.front(); diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMenuList.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMenuList.h index d7d0209cd..520d2d2b0 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMenuList.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMenuList.h @@ -1,8 +1,8 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -12,7 +12,8 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; void FinalizeAssetsForZone(AssetLoadingContext* context) const override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPhysCollmap.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPhysCollmap.cpp index c838edbf3..805e14aaa 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPhysCollmap.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPhysCollmap.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderPhysCollmap.h" -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderPhysCollmap::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPhysCollmap.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPhysCollmap.h index 3464be721..f2195585c 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPhysCollmap.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPhysCollmap.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,4 +11,4 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPhysPreset.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPhysPreset.cpp index 39c41fd40..c934afcb1 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPhysPreset.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPhysPreset.cpp @@ -1,16 +1,16 @@ #include "AssetLoaderPhysPreset.h" -#include -#include -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" -#include "Game/IW4/ObjConstantsIW4.h" #include "Game/IW4/InfoString/InfoStringToStructConverter.h" #include "Game/IW4/InfoString/PhysPresetFields.h" +#include "Game/IW4/ObjConstantsIW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include +#include +#include + using namespace IW4; namespace IW4 @@ -25,13 +25,18 @@ namespace IW4 } public: - InfoStringToPhysPresetConverter(const InfoString& infoString, PhysPresetInfo* physPreset, ZoneScriptStrings& zoneScriptStrings, MemoryManager* memory, IAssetLoadingManager* manager, - const cspField_t* fields, const size_t fieldCount) + InfoStringToPhysPresetConverter(const InfoString& infoString, + PhysPresetInfo* physPreset, + ZoneScriptStrings& zoneScriptStrings, + MemoryManager* memory, + IAssetLoadingManager* manager, + const cspField_t* fields, + const size_t fieldCount) : InfoStringToStructConverter(infoString, physPreset, zoneScriptStrings, memory, manager, fields, fieldCount) { } }; -} +} // namespace IW4 void AssetLoaderPhysPreset::CopyFromPhysPresetInfo(const PhysPresetInfo* physPresetInfo, PhysPreset* physPreset) { @@ -52,11 +57,13 @@ void AssetLoaderPhysPreset::CopyFromPhysPresetInfo(const PhysPresetInfo* physPre physPreset->perSurfaceSndAlias = physPresetInfo->perSurfaceSndAlias != 0; } -bool AssetLoaderPhysPreset::LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) +bool AssetLoaderPhysPreset::LoadFromInfoString( + const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) { const auto presetInfo = std::make_unique(); memset(presetInfo.get(), 0, sizeof(PhysPresetInfo)); - InfoStringToPhysPresetConverter converter(infoString, presetInfo.get(), zone->m_script_strings, memory, manager, phys_preset_fields, std::extent::value); + InfoStringToPhysPresetConverter converter( + infoString, presetInfo.get(), zone->m_script_strings, memory, manager, phys_preset_fields, std::extent::value); if (!converter.Convert()) { std::cout << "Failed to parse phys preset: \"" << assetName << "\"" << std::endl; @@ -86,7 +93,8 @@ bool AssetLoaderPhysPreset::CanLoadFromGdt() const return true; } -bool AssetLoaderPhysPreset::LoadFromGdt(const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderPhysPreset::LoadFromGdt( + const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { auto* gdtEntry = gdtQueryable->GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_PHYS_PRESET, assetName); if (gdtEntry == nullptr) @@ -107,7 +115,8 @@ bool AssetLoaderPhysPreset::CanLoadFromRaw() const return true; } -bool AssetLoaderPhysPreset::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderPhysPreset::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto fileName = "physic/" + assetName; const auto file = searchPath->Open(fileName); @@ -123,4 +132,3 @@ bool AssetLoaderPhysPreset::LoadFromRaw(const std::string& assetName, ISearchPat return LoadFromInfoString(infoString, assetName, memory, manager, zone); } - diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPhysPreset.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPhysPreset.h index ec73fb700..906ffaae7 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPhysPreset.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPhysPreset.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "InfoString/InfoString.h" #include "SearchPath/ISearchPath.h" @@ -11,13 +11,16 @@ namespace IW4 { static void CopyFromPhysPresetInfo(const PhysPresetInfo* physPresetInfo, PhysPreset* physPreset); - static bool LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone); + static bool + LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone); public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromGdt() const override; - bool LoadFromGdt(const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool LoadFromGdt( + const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPixelShader.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPixelShader.cpp index df5e5128d..d76fce9a6 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPixelShader.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPixelShader.cpp @@ -1,14 +1,14 @@ #include "AssetLoaderPixelShader.h" +#include "Game/IW4/IW4.h" +#include "ObjLoading.h" +#include "Pool/GlobalAssetPool.h" + #include #include #include #include -#include "ObjLoading.h" -#include "Game/IW4/IW4.h" -#include "Pool/GlobalAssetPool.h" - using namespace IW4; void* AssetLoaderPixelShader::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) @@ -31,14 +31,15 @@ std::string AssetLoaderPixelShader::GetFileNameForAsset(const std::string& asset return ss.str(); } -bool AssetLoaderPixelShader::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderPixelShader::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto fileName = GetFileNameForAsset(assetName); const auto file = searchPath->Open(fileName); if (!file.IsOpen()) return false; - if(file.m_length % sizeof(uint32_t) != 0) + if (file.m_length % sizeof(uint32_t) != 0) { std::cerr << "Invalid pixel shader \"" << assetName << "\": Size must be dividable by " << sizeof(uint32_t) << "\n"; return false; diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPixelShader.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPixelShader.h index 4a96e825e..a062bc9c2 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPixelShader.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderPixelShader.h @@ -1,11 +1,11 @@ #pragma once -#include - -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" +#include + namespace IW4 { class AssetLoaderPixelShader final : public BasicAssetLoader @@ -15,6 +15,7 @@ namespace IW4 _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderRawFile.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderRawFile.cpp index aaea2db6e..f94fdf657 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderRawFile.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderRawFile.cpp @@ -1,10 +1,10 @@ #include "AssetLoaderRawFile.h" -#include - #include "Game/IW4/IW4.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderRawFile::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) @@ -20,7 +20,8 @@ bool AssetLoaderRawFile::CanLoadFromRaw() const return true; } -bool AssetLoaderRawFile::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderRawFile::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto file = searchPath->Open(assetName); if (!file.IsOpen()) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderRawFile.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderRawFile.h index 3e5ac6d0d..2eab62fd0 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderRawFile.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderRawFile.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,6 +11,7 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderSndCurve.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderSndCurve.cpp index e26108409..c657d8c75 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderSndCurve.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderSndCurve.cpp @@ -1,14 +1,14 @@ #include "AssetLoaderSndCurve.h" -#include -#include -#include - -#include "ObjLoading.h" #include "AssetLoading/SndCurve/SndCurveReader.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include +#include +#include + using namespace IW4; std::string AssetLoaderSndCurve::GetAssetFilename(const std::string& assetName) @@ -33,7 +33,8 @@ bool AssetLoaderSndCurve::CanLoadFromRaw() const return true; } -bool AssetLoaderSndCurve::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderSndCurve::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto filename = GetAssetFilename(assetName); const auto file = searchPath->Open(filename); @@ -47,7 +48,7 @@ bool AssetLoaderSndCurve::LoadFromRaw(const std::string& assetName, ISearchPath* if (!sndCurveData) return false; - if(sndCurveData->m_knots.size() > std::extent_v) + if (sndCurveData->m_knots.size() > std::extent_v) { std::cerr << "Failed to load SndCurve \"" << assetName << "\": Too many knots (" << sndCurveData->m_knots.size() << ")\n"; return false; @@ -57,9 +58,9 @@ bool AssetLoaderSndCurve::LoadFromRaw(const std::string& assetName, ISearchPath* sndCurve->filename = memory->Dup(assetName.c_str()); sndCurve->knotCount = static_cast(sndCurveData->m_knots.size()); - for(auto i = 0u; i < std::extent_v; i++) + for (auto i = 0u; i < std::extent_v; i++) { - if(i < sndCurveData->m_knots.size()) + if (i < sndCurveData->m_knots.size()) { const auto& [x, y] = sndCurveData->m_knots[i]; sndCurve->knots[i][0] = static_cast(x); diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderSndCurve.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderSndCurve.h index 4a55f9ca2..e261327cc 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderSndCurve.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderSndCurve.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -13,6 +13,7 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderSoundAliasList.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderSoundAliasList.cpp index 7ec9e48c1..290ba1c91 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderSoundAliasList.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderSoundAliasList.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderSoundAliasList.h" -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderSoundAliasList::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderSoundAliasList.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderSoundAliasList.h index 42b2d6bf7..3abc1af4f 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderSoundAliasList.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderSoundAliasList.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,4 +11,4 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderStringTable.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderStringTable.cpp index 2b5b4b17a..642a60a8a 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderStringTable.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderStringTable.cpp @@ -1,13 +1,13 @@ #include "AssetLoaderStringTable.h" -#include - -#include "ObjLoading.h" #include "Csv/CsvStream.h" #include "Game/IW4/CommonIW4.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderStringTable::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) @@ -23,7 +23,8 @@ bool AssetLoaderStringTable::CanLoadFromRaw() const return true; } -bool AssetLoaderStringTable::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderStringTable::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto file = searchPath->Open(assetName); if (!file.IsOpen()) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderStringTable.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderStringTable.h index 79fee191d..2ef3af3e6 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderStringTable.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderStringTable.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,6 +11,7 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderStructuredDataDefSet.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderStructuredDataDefSet.cpp index aae3fc269..1c95b7625 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderStructuredDataDefSet.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderStructuredDataDefSet.cpp @@ -1,13 +1,13 @@ #include "AssetLoaderStructuredDataDefSet.h" -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" -#include "StructuredDataDef/StructuredDataDefReader.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include "StructuredDataDef/StructuredDataDefReader.h" #include "Utils/Alignment.h" +#include + using namespace IW4; void* AssetLoaderStructuredDataDefSet::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) @@ -88,7 +88,8 @@ void AssetLoaderStructuredDataDefSet::ConvertStruct(StructuredDataStruct* output inputStruct->SortPropertiesByName(); if (!inputStruct->m_properties.empty()) { - outputStruct->properties = static_cast(memory->Alloc(sizeof(StructuredDataStructProperty) * inputStruct->m_properties.size())); + outputStruct->properties = + static_cast(memory->Alloc(sizeof(StructuredDataStructProperty) * inputStruct->m_properties.size())); for (auto propertyIndex = 0u; propertyIndex < inputStruct->m_properties.size(); propertyIndex++) { auto& outputProperty = outputStruct->properties[propertyIndex]; @@ -110,14 +111,18 @@ void AssetLoaderStructuredDataDefSet::ConvertStruct(StructuredDataStruct* output outputStruct->properties = nullptr; } -void AssetLoaderStructuredDataDefSet::ConvertIndexedArray(StructuredDataIndexedArray* outputIndexedArray, const CommonStructuredDataIndexedArray* inputIndexedArray, MemoryManager* memory) +void AssetLoaderStructuredDataDefSet::ConvertIndexedArray(StructuredDataIndexedArray* outputIndexedArray, + const CommonStructuredDataIndexedArray* inputIndexedArray, + MemoryManager* memory) { outputIndexedArray->arraySize = static_cast(inputIndexedArray->m_element_count); outputIndexedArray->elementType = ConvertType(inputIndexedArray->m_array_type); outputIndexedArray->elementSize = utils::Align(inputIndexedArray->m_element_size_in_bits, 8u) / 8u; } -void AssetLoaderStructuredDataDefSet::ConvertEnumedArray(StructuredDataEnumedArray* outputEnumedArray, const CommonStructuredDataEnumedArray* inputEnumedArray, MemoryManager* memory) +void AssetLoaderStructuredDataDefSet::ConvertEnumedArray(StructuredDataEnumedArray* outputEnumedArray, + const CommonStructuredDataEnumedArray* inputEnumedArray, + MemoryManager* memory) { outputEnumedArray->enumIndex = static_cast(inputEnumedArray->m_enum_index); outputEnumedArray->elementType = ConvertType(inputEnumedArray->m_array_type); @@ -152,7 +157,8 @@ void AssetLoaderStructuredDataDefSet::ConvertDef(StructuredDataDef* outputDef, c outputDef->indexedArrayCount = static_cast(inputDef->m_indexed_arrays.size()); if (!inputDef->m_indexed_arrays.empty()) { - outputDef->indexedArrays = static_cast(memory->Alloc(sizeof(StructuredDataIndexedArray) * inputDef->m_indexed_arrays.size())); + outputDef->indexedArrays = + static_cast(memory->Alloc(sizeof(StructuredDataIndexedArray) * inputDef->m_indexed_arrays.size())); for (auto indexedArrayIndex = 0u; indexedArrayIndex < inputDef->m_indexed_arrays.size(); indexedArrayIndex++) ConvertIndexedArray(&outputDef->indexedArrays[indexedArrayIndex], &inputDef->m_indexed_arrays[indexedArrayIndex], memory); } @@ -173,7 +179,9 @@ void AssetLoaderStructuredDataDefSet::ConvertDef(StructuredDataDef* outputDef, c outputDef->size = inputDef->m_size_in_byte; } -StructuredDataDefSet* AssetLoaderStructuredDataDefSet::ConvertSet(const std::string& assetName, const std::vector>& defs, MemoryManager* memory) +StructuredDataDefSet* AssetLoaderStructuredDataDefSet::ConvertSet(const std::string& assetName, + const std::vector>& defs, + MemoryManager* memory) { auto* set = memory->Create(); set->name = memory->Dup(assetName.c_str()); @@ -186,20 +194,23 @@ StructuredDataDefSet* AssetLoaderStructuredDataDefSet::ConvertSet(const std::str return set; } -bool AssetLoaderStructuredDataDefSet::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderStructuredDataDefSet::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto file = searchPath->Open(assetName); if (!file.IsOpen()) return false; - StructuredDataDefReader reader(*file.m_stream, assetName, [searchPath](const std::string& filename, const std::string& sourceFile) -> std::unique_ptr - { - auto foundFileToInclude = searchPath->Open(filename); - if (!foundFileToInclude.IsOpen() || !foundFileToInclude.m_stream) - return nullptr; + StructuredDataDefReader reader(*file.m_stream, + assetName, + [searchPath](const std::string& filename, const std::string& sourceFile) -> std::unique_ptr + { + auto foundFileToInclude = searchPath->Open(filename); + if (!foundFileToInclude.IsOpen() || !foundFileToInclude.m_stream) + return nullptr; - return std::move(foundFileToInclude.m_stream); - }); + return std::move(foundFileToInclude.m_stream); + }); bool readingDefsSuccessful; const auto defs = reader.ReadStructureDataDefs(readingDefsSuccessful); diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderStructuredDataDefSet.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderStructuredDataDefSet.h index 9a72d9d4f..d867b8eaa 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderStructuredDataDefSet.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderStructuredDataDefSet.h @@ -1,9 +1,9 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" -#include "StructuredDataDef/CommonStructuredDataDef.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" +#include "StructuredDataDef/CommonStructuredDataDef.h" namespace IW4 { @@ -15,10 +15,15 @@ namespace IW4 static StructuredDataType ConvertType(CommonStructuredDataType inputType); static void ConvertEnum(StructuredDataEnum* outputEnum, CommonStructuredDataEnum* inputEnum, MemoryManager* memory); static void ConvertStruct(StructuredDataStruct* outputStruct, CommonStructuredDataStruct* inputStruct, MemoryManager* memory); - static void ConvertIndexedArray(StructuredDataIndexedArray* outputIndexedArray, const CommonStructuredDataIndexedArray* inputIndexedArray, MemoryManager* memory); - static void ConvertEnumedArray(StructuredDataEnumedArray* outputEnumedArray, const CommonStructuredDataEnumedArray* inputEnumedArray, MemoryManager* memory); + static void ConvertIndexedArray(StructuredDataIndexedArray* outputIndexedArray, + const CommonStructuredDataIndexedArray* inputIndexedArray, + MemoryManager* memory); + static void + ConvertEnumedArray(StructuredDataEnumedArray* outputEnumedArray, const CommonStructuredDataEnumedArray* inputEnumedArray, MemoryManager* memory); static void ConvertDef(StructuredDataDef* outputDef, const CommonStructuredDataDef* inputDef, MemoryManager* memory); - static StructuredDataDefSet* ConvertSet(const std::string& assetName, const std::vector>& defs, MemoryManager* memory); - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + static StructuredDataDefSet* + ConvertSet(const std::string& assetName, const std::vector>& defs, MemoryManager* memory); + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderTechniqueSet.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderTechniqueSet.cpp index 74cb73844..abbd5b46e 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderTechniqueSet.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderTechniqueSet.cpp @@ -1,26 +1,26 @@ #include "AssetLoaderTechniqueSet.h" -#include -#include -#include -#include -#include -#include - #include "AssetLoaderPixelShader.h" #include "AssetLoaderVertexShader.h" -#include "Utils/ClassUtils.h" -#include "ObjLoading.h" #include "Game/IW4/IW4.h" #include "Game/IW4/TechsetConstantsIW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" -#include "Techset/TechniqueFileReader.h" -#include "Techset/TechsetFileReader.h" #include "Shader/D3D9ShaderAnalyser.h" #include "StateMap/StateMapReader.h" +#include "Techset/TechniqueFileReader.h" #include "Techset/TechniqueStateMapCache.h" #include "Techset/TechsetDefinitionCache.h" +#include "Techset/TechsetFileReader.h" #include "Utils/Alignment.h" +#include "Utils/ClassUtils.h" + +#include +#include +#include +#include +#include +#include using namespace IW4; using namespace std::string_literals; @@ -61,7 +61,8 @@ namespace IW4 const LoadedTechnique* AddLoadedTechnique(std::string techniqueName, MaterialTechnique* technique, std::vector dependencies) { - return m_loaded_techniques.emplace(std::make_pair(std::move(techniqueName), std::make_unique(technique, std::move(dependencies)))).first->second.get(); + return m_loaded_techniques.emplace(std::make_pair(std::move(techniqueName), std::make_unique(technique, std::move(dependencies)))) + .first->second.get(); } literal_t GetAllocatedLiteral(MemoryManager* memory, techset::ShaderArgumentLiteralSource source) @@ -205,7 +206,11 @@ namespace IW4 std::vector m_passes; std::vector m_dependencies; - TechniqueCreator(const std::string& techniqueName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, TechniqueZoneLoadingState* zoneState, + TechniqueCreator(const std::string& techniqueName, + ISearchPath* searchPath, + MemoryManager* memory, + IAssetLoadingManager* manager, + TechniqueZoneLoadingState* zoneState, ShaderInfoFromFileSystemCacheState* shaderInfoCache, techset::TechniqueStateMapCache* stateMapCache) : m_technique_name(techniqueName), @@ -225,20 +230,22 @@ namespace IW4 static size_t RegisterCountPerElement(const d3d9::ShaderConstant& constant) { - const auto valuesPerRegister = constant.m_register_set == d3d9::RegisterSet::BOOL || constant.m_register_set == d3d9::RegisterSet::SAMPLER ? 1u : 4u; + const auto valuesPerRegister = + constant.m_register_set == d3d9::RegisterSet::BOOL || constant.m_register_set == d3d9::RegisterSet::SAMPLER ? 1u : 4u; return utils::Align(constant.m_type_columns * constant.m_type_rows, valuesPerRegister) / valuesPerRegister; } static bool IsSamplerArgument(const d3d9::ShaderConstant& constant) { - return constant.m_type == d3d9::ParameterType::SAMPLER - || constant.m_type == d3d9::ParameterType::SAMPLER_1D - || constant.m_type == d3d9::ParameterType::SAMPLER_2D - || constant.m_type == d3d9::ParameterType::SAMPLER_3D - || constant.m_type == d3d9::ParameterType::SAMPLER_CUBE; + return constant.m_type == d3d9::ParameterType::SAMPLER || constant.m_type == d3d9::ParameterType::SAMPLER_1D + || constant.m_type == d3d9::ParameterType::SAMPLER_2D || constant.m_type == d3d9::ParameterType::SAMPLER_3D + || constant.m_type == d3d9::ParameterType::SAMPLER_CUBE; } - bool AutoCreateShaderArgument(const techset::ShaderSelector shaderType, const d3d9::ShaderConstant& shaderArgument, const size_t elementOffset, const size_t registerOffset) + bool AutoCreateShaderArgument(const techset::ShaderSelector shaderType, + const d3d9::ShaderConstant& shaderArgument, + const size_t elementOffset, + const size_t registerOffset) { assert(!m_passes.empty()); auto& pass = m_passes.at(m_passes.size() - 1); @@ -367,7 +374,8 @@ namespace IW4 assert(!m_passes.empty()); auto& pass = m_passes.at(m_passes.size() - 1); - std::sort(std::begin(pass.m_vertex_decl.routing.data), std::begin(pass.m_vertex_decl.routing.data) + pass.m_vertex_decl.streamCount, + std::sort(std::begin(pass.m_vertex_decl.routing.data), + std::begin(pass.m_vertex_decl.routing.data) + pass.m_vertex_decl.streamCount, [](const MaterialStreamRouting& r1, const MaterialStreamRouting& r2) { return r1.source < r2.source; @@ -395,19 +403,22 @@ namespace IW4 return false; // Sort args by their update frequency - std::sort(pass.m_arguments.begin(), pass.m_arguments.end(), [](const PassShaderArgument& arg1, const PassShaderArgument& arg2) - { - if (arg1.m_update_frequency != arg2.m_update_frequency) - return arg1.m_update_frequency < arg2.m_update_frequency; + std::sort(pass.m_arguments.begin(), + pass.m_arguments.end(), + [](const PassShaderArgument& arg1, const PassShaderArgument& arg2) + { + if (arg1.m_update_frequency != arg2.m_update_frequency) + return arg1.m_update_frequency < arg2.m_update_frequency; - if (arg1.m_arg.type != arg2.m_arg.type) - return arg1.m_arg.type < arg2.m_arg.type; + if (arg1.m_arg.type != arg2.m_arg.type) + return arg1.m_arg.type < arg2.m_arg.type; - if (arg1.m_arg.type == MTL_ARG_MATERIAL_VERTEX_CONST || arg1.m_arg.type == MTL_ARG_MATERIAL_PIXEL_CONST || arg1.m_arg.type == MTL_ARG_MATERIAL_PIXEL_SAMPLER) - return arg1.m_arg.u.codeSampler < arg2.m_arg.u.codeSampler; + if (arg1.m_arg.type == MTL_ARG_MATERIAL_VERTEX_CONST || arg1.m_arg.type == MTL_ARG_MATERIAL_PIXEL_CONST + || arg1.m_arg.type == MTL_ARG_MATERIAL_PIXEL_SAMPLER) + return arg1.m_arg.u.codeSampler < arg2.m_arg.u.codeSampler; - return arg1.m_arg.dest < arg2.m_arg.dest; - }); + return arg1.m_arg.dest < arg2.m_arg.dest; + }); AllocateVertexDecl(); @@ -430,7 +441,9 @@ namespace IW4 return true; } - static void InitializeArgumentState(const d3d9::ShaderInfo& shaderInfo, std::vector& argumentHandledOffsetVector, std::vector& argumentHandledVector) + static void InitializeArgumentState(const d3d9::ShaderInfo& shaderInfo, + std::vector& argumentHandledOffsetVector, + std::vector& argumentHandledVector) { auto vertexShaderArgumentSlotCount = 0u; auto argIndex = 0u; @@ -464,7 +477,8 @@ namespace IW4 if (pass.m_vertex_shader->Asset()->name && pass.m_vertex_shader->Asset()->name[0] == ',') { - pass.m_vertex_shader_info = m_shader_info_cache->LoadShaderInfoFromDisk(m_search_path, AssetLoaderVertexShader::GetFileNameForAsset(vertexShaderName)); + pass.m_vertex_shader_info = + m_shader_info_cache->LoadShaderInfoFromDisk(m_search_path, AssetLoaderVertexShader::GetFileNameForAsset(vertexShaderName)); } else { @@ -503,7 +517,8 @@ namespace IW4 if (pass.m_pixel_shader->Asset()->name && pass.m_pixel_shader->Asset()->name[0] == ',') { - pass.m_pixel_shader_info = m_shader_info_cache->LoadShaderInfoFromDisk(m_search_path, AssetLoaderPixelShader::GetFileNameForAsset(pixelShaderName)); + pass.m_pixel_shader_info = + m_shader_info_cache->LoadShaderInfoFromDisk(m_search_path, AssetLoaderPixelShader::GetFileNameForAsset(pixelShaderName)); } else { @@ -579,12 +594,18 @@ namespace IW4 return foundSource; } - bool FindShaderArgument(const d3d9::ShaderInfo& shaderInfo, const techset::ShaderArgument& argument, size_t& constantIndex, size_t& registerOffset, std::string& errorMessage) const + bool FindShaderArgument(const d3d9::ShaderInfo& shaderInfo, + const techset::ShaderArgument& argument, + size_t& constantIndex, + size_t& registerOffset, + std::string& errorMessage) const { - const auto matchingShaderConstant = std::find_if(shaderInfo.m_constants.begin(), shaderInfo.m_constants.end(), [argument](const d3d9::ShaderConstant& constant) - { - return constant.m_name == argument.m_argument_name; - }); + const auto matchingShaderConstant = std::find_if(shaderInfo.m_constants.begin(), + shaderInfo.m_constants.end(), + [argument](const d3d9::ShaderConstant& constant) + { + return constant.m_name == argument.m_argument_name; + }); if (matchingShaderConstant == shaderInfo.m_constants.end()) { @@ -623,8 +644,12 @@ namespace IW4 return true; } - static bool SetArgumentCodeConst(MaterialShaderArgument& argument, const techset::ShaderArgumentCodeSource& source, const d3d9::ShaderConstant& shaderConstant, const unsigned sourceIndex, - const unsigned arrayCount, std::string& errorMessage) + static bool SetArgumentCodeConst(MaterialShaderArgument& argument, + const techset::ShaderArgumentCodeSource& source, + const d3d9::ShaderConstant& shaderConstant, + const unsigned sourceIndex, + const unsigned arrayCount, + std::string& errorMessage) { if (arrayCount > 0u) { @@ -657,8 +682,12 @@ namespace IW4 return true; } - static bool SetArgumentCodeSampler(MaterialShaderArgument& argument, const techset::ShaderArgumentCodeSource& source, const d3d9::ShaderConstant& shaderConstant, const unsigned sourceIndex, - const unsigned arrayCount, std::string& errorMessage) + static bool SetArgumentCodeSampler(MaterialShaderArgument& argument, + const techset::ShaderArgumentCodeSource& source, + const d3d9::ShaderConstant& shaderConstant, + const unsigned sourceIndex, + const unsigned arrayCount, + std::string& errorMessage) { if (arrayCount > 0u) { @@ -689,7 +718,9 @@ namespace IW4 return true; } - bool AcceptVertexShaderConstantArgument(const techset::ShaderArgument& shaderArgument, const techset::ShaderArgumentCodeSource& source, std::string& errorMessage) + bool AcceptVertexShaderConstantArgument(const techset::ShaderArgument& shaderArgument, + const techset::ShaderArgumentCodeSource& source, + std::string& errorMessage) { assert(!m_passes.empty()); auto& pass = m_passes.at(m_passes.size() - 1); @@ -737,7 +768,10 @@ namespace IW4 return true; } - bool AcceptPixelShaderCodeArgument(const techset::ShaderArgument& shaderArgument, const techset::ShaderArgumentCodeSource& source, std::string& errorMessage, const bool isSampler) + bool AcceptPixelShaderCodeArgument(const techset::ShaderArgument& shaderArgument, + const techset::ShaderArgumentCodeSource& source, + std::string& errorMessage, + const bool isSampler) { assert(!m_passes.empty()); auto& pass = m_passes.at(m_passes.size() - 1); @@ -809,14 +843,15 @@ namespace IW4 return false; } - pass.m_arguments.emplace_back(argument); pass.m_handled_pixel_shader_arguments[pass.m_pixel_shader_argument_handled_offset[shaderConstantIndex] + elementOffset] = true; return true; } - bool AcceptShaderConstantArgument(const techset::ShaderSelector shader, const techset::ShaderArgument shaderArgument, const techset::ShaderArgumentCodeSource source, + bool AcceptShaderConstantArgument(const techset::ShaderSelector shader, + const techset::ShaderArgument shaderArgument, + const techset::ShaderArgumentCodeSource source, std::string& errorMessage) override { if (shader == techset::ShaderSelector::VERTEX_SHADER) @@ -826,7 +861,9 @@ namespace IW4 return AcceptPixelShaderCodeArgument(shaderArgument, source, errorMessage, false); } - bool AcceptShaderSamplerArgument(const techset::ShaderSelector shader, const techset::ShaderArgument shaderArgument, const techset::ShaderArgumentCodeSource source, + bool AcceptShaderSamplerArgument(const techset::ShaderSelector shader, + const techset::ShaderArgument shaderArgument, + const techset::ShaderArgumentCodeSource source, std::string& errorMessage) override { if (shader == techset::ShaderSelector::VERTEX_SHADER) @@ -839,7 +876,10 @@ namespace IW4 return AcceptPixelShaderCodeArgument(shaderArgument, source, errorMessage, true); } - bool AcceptShaderLiteralArgument(const techset::ShaderSelector shader, techset::ShaderArgument shaderArgument, techset::ShaderArgumentLiteralSource source, std::string& errorMessage) override + bool AcceptShaderLiteralArgument(const techset::ShaderSelector shader, + techset::ShaderArgument shaderArgument, + techset::ShaderArgumentLiteralSource source, + std::string& errorMessage) override { assert(!m_passes.empty()); auto& pass = m_passes.at(m_passes.size() - 1); @@ -895,7 +935,9 @@ namespace IW4 return true; } - bool AcceptShaderMaterialArgument(const techset::ShaderSelector shader, techset::ShaderArgument shaderArgument, const techset::ShaderArgumentMaterialSource source, + bool AcceptShaderMaterialArgument(const techset::ShaderSelector shader, + techset::ShaderArgument shaderArgument, + const techset::ShaderArgumentMaterialSource source, std::string& errorMessage) override { assert(!m_passes.empty()); @@ -1010,52 +1052,53 @@ namespace IW4 static void UpdateTechniqueFlags(MaterialTechnique& technique) { // This is stupid but that's what the game does for zprepass for sure - // The other ones might be handled by the game in the same fashion because there is not recognizable pattern that connects the shaders with the same flags + // The other ones might be handled by the game in the same fashion because there is not recognizable pattern that connects the shaders with the same + // flags static std::unordered_map flagsByTechniqueName({ - {"zprepass", TECHNIQUE_FLAG_4 | TECHNIQUE_FLAG_200}, - {"build_floatz", TECHNIQUE_FLAG_8}, - {"build_shadowmap_depth", TECHNIQUE_FLAG_10 | TECHNIQUE_FLAG_200}, - {"build_shadowmap_model", TECHNIQUE_FLAG_10 | TECHNIQUE_FLAG_200}, - {"distortion_scale_ua_zfeather", TECHNIQUE_FLAG_100}, - {"distortion_scale_zfeather", TECHNIQUE_FLAG_100}, - {"distortion_scale_zfeather_dtex", TECHNIQUE_FLAG_100}, - {"alternate_scene_overlay", TECHNIQUE_FLAG_200}, - {"blur_apply", TECHNIQUE_FLAG_200}, - {"build_floatz", TECHNIQUE_FLAG_200}, - {"build_floatz_clear", TECHNIQUE_FLAG_200}, - {"build_floatz_dtex", TECHNIQUE_FLAG_200}, - {"build_floatz_ua", TECHNIQUE_FLAG_200}, - {"build_floatz_ua_dtex", TECHNIQUE_FLAG_200}, - {"build_shadowmap_depth_nc", TECHNIQUE_FLAG_200}, - {"build_shadowmap_depth_ua", TECHNIQUE_FLAG_200}, - {"build_shadowmap_model_dtex", TECHNIQUE_FLAG_200}, - {"build_shadowmap_model_nc_dtex", TECHNIQUE_FLAG_200}, - {"build_shadowmap_model_ua", TECHNIQUE_FLAG_200}, - {"cinematic", TECHNIQUE_FLAG_200}, - {"cinematic_3d", TECHNIQUE_FLAG_200}, - {"cinematic_dtex_3d", TECHNIQUE_FLAG_200}, - {"dof_near_coc", TECHNIQUE_FLAG_200}, - {"floatz", TECHNIQUE_FLAG_200}, - {"floatzdisplay", TECHNIQUE_FLAG_200}, - {"particle_blend", TECHNIQUE_FLAG_200}, - {"particle_zdownsample", TECHNIQUE_FLAG_200}, - {"passthru_alpha", TECHNIQUE_FLAG_200}, - {"postfx", TECHNIQUE_FLAG_200}, - {"postfx_mblur", TECHNIQUE_FLAG_200}, - {"processed_floatz", TECHNIQUE_FLAG_200}, - {"ps3_aadownsample", TECHNIQUE_FLAG_200}, - {"shell_shock", TECHNIQUE_FLAG_200}, - {"shell_shock_flashed", TECHNIQUE_FLAG_200}, - {"small_blur", TECHNIQUE_FLAG_200}, - {"stencildisplay", TECHNIQUE_FLAG_200}, - {"stencilshadow", TECHNIQUE_FLAG_200}, - {"wireframe_solid", TECHNIQUE_FLAG_200}, - {"wireframe_solid_atest_dtex", TECHNIQUE_FLAG_200}, - {"wireframe_solid_dtex", TECHNIQUE_FLAG_200}, - {"wireframe_solid_nc", TECHNIQUE_FLAG_200}, - {"wireframe_solid_nc_dtex", TECHNIQUE_FLAG_200}, - {"wireframe_solid_ua", TECHNIQUE_FLAG_200}, - {"wireframe_solid_ua_dtex", TECHNIQUE_FLAG_200} + {"zprepass", TECHNIQUE_FLAG_4 | TECHNIQUE_FLAG_200 }, + {"build_floatz", TECHNIQUE_FLAG_8 }, + {"build_shadowmap_depth", TECHNIQUE_FLAG_10 | TECHNIQUE_FLAG_200}, + {"build_shadowmap_model", TECHNIQUE_FLAG_10 | TECHNIQUE_FLAG_200}, + {"distortion_scale_ua_zfeather", TECHNIQUE_FLAG_100 }, + {"distortion_scale_zfeather", TECHNIQUE_FLAG_100 }, + {"distortion_scale_zfeather_dtex", TECHNIQUE_FLAG_100 }, + {"alternate_scene_overlay", TECHNIQUE_FLAG_200 }, + {"blur_apply", TECHNIQUE_FLAG_200 }, + {"build_floatz", TECHNIQUE_FLAG_200 }, + {"build_floatz_clear", TECHNIQUE_FLAG_200 }, + {"build_floatz_dtex", TECHNIQUE_FLAG_200 }, + {"build_floatz_ua", TECHNIQUE_FLAG_200 }, + {"build_floatz_ua_dtex", TECHNIQUE_FLAG_200 }, + {"build_shadowmap_depth_nc", TECHNIQUE_FLAG_200 }, + {"build_shadowmap_depth_ua", TECHNIQUE_FLAG_200 }, + {"build_shadowmap_model_dtex", TECHNIQUE_FLAG_200 }, + {"build_shadowmap_model_nc_dtex", TECHNIQUE_FLAG_200 }, + {"build_shadowmap_model_ua", TECHNIQUE_FLAG_200 }, + {"cinematic", TECHNIQUE_FLAG_200 }, + {"cinematic_3d", TECHNIQUE_FLAG_200 }, + {"cinematic_dtex_3d", TECHNIQUE_FLAG_200 }, + {"dof_near_coc", TECHNIQUE_FLAG_200 }, + {"floatz", TECHNIQUE_FLAG_200 }, + {"floatzdisplay", TECHNIQUE_FLAG_200 }, + {"particle_blend", TECHNIQUE_FLAG_200 }, + {"particle_zdownsample", TECHNIQUE_FLAG_200 }, + {"passthru_alpha", TECHNIQUE_FLAG_200 }, + {"postfx", TECHNIQUE_FLAG_200 }, + {"postfx_mblur", TECHNIQUE_FLAG_200 }, + {"processed_floatz", TECHNIQUE_FLAG_200 }, + {"ps3_aadownsample", TECHNIQUE_FLAG_200 }, + {"shell_shock", TECHNIQUE_FLAG_200 }, + {"shell_shock_flashed", TECHNIQUE_FLAG_200 }, + {"small_blur", TECHNIQUE_FLAG_200 }, + {"stencildisplay", TECHNIQUE_FLAG_200 }, + {"stencilshadow", TECHNIQUE_FLAG_200 }, + {"wireframe_solid", TECHNIQUE_FLAG_200 }, + {"wireframe_solid_atest_dtex", TECHNIQUE_FLAG_200 }, + {"wireframe_solid_dtex", TECHNIQUE_FLAG_200 }, + {"wireframe_solid_nc", TECHNIQUE_FLAG_200 }, + {"wireframe_solid_nc_dtex", TECHNIQUE_FLAG_200 }, + {"wireframe_solid_ua", TECHNIQUE_FLAG_200 }, + {"wireframe_solid_ua_dtex", TECHNIQUE_FLAG_200 }, }); const auto flagsForName = flagsByTechniqueName.find(technique.name); @@ -1140,19 +1183,19 @@ namespace IW4 stableArgCount++; break; case MTL_UPDATE_CUSTOM: + { + assert(arg.m_arg.type == MTL_ARG_CODE_PIXEL_SAMPLER); + if (arg.m_arg.type == MTL_ARG_CODE_PIXEL_SAMPLER) { - assert(arg.m_arg.type == MTL_ARG_CODE_PIXEL_SAMPLER); - if (arg.m_arg.type == MTL_ARG_CODE_PIXEL_SAMPLER) + const auto customSampler = std::find(std::begin(g_customSamplerSrc), std::end(g_customSamplerSrc), arg.m_arg.u.codeSampler); + assert(customSampler != std::end(g_customSamplerSrc)); + if (customSampler != std::end(g_customSamplerSrc)) { - const auto customSampler = std::find(std::begin(g_customSamplerSrc), std::end(g_customSamplerSrc), arg.m_arg.u.codeSampler); - assert(customSampler != std::end(g_customSamplerSrc)); - if (customSampler != std::end(g_customSamplerSrc)) - { - const auto customSamplerIndex = customSampler - std::begin(g_customSamplerSrc); - out.customSamplerFlags |= 1 << customSamplerIndex; - } + const auto customSamplerIndex = customSampler - std::begin(g_customSamplerSrc); + out.customSamplerFlags |= 1 << customSamplerIndex; } } + } continue; default: assert(false); @@ -1174,7 +1217,9 @@ namespace IW4 dependencies.push_back(in.m_vertex_decl_asset); } - MaterialTechnique* ConvertTechnique(const std::string& techniqueName, const std::vector& passes, std::vector& dependencies) const + MaterialTechnique* ConvertTechnique(const std::string& techniqueName, + const std::vector& passes, + std::vector& dependencies) const { assert(!passes.empty()); const auto techniqueSize = sizeof(MaterialTechnique) + (passes.size() - 1u) * sizeof(MaterialPass); @@ -1231,7 +1276,7 @@ namespace IW4 return m_zone_state->AddLoadedTechnique(techniqueName, techniqueFromRaw, dependencies); } }; -} +} // namespace IW4 void* AssetLoaderTechniqueSet::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) { @@ -1262,8 +1307,8 @@ std::string AssetLoaderTechniqueSet::GetStateMapFileName(const std::string& stat return ss.str(); } -bool AssetLoaderTechniqueSet::CreateTechsetFromDefinition(const std::string& assetName, const techset::TechsetDefinition& definition, ISearchPath* searchPath, MemoryManager* memory, - IAssetLoadingManager* manager) +bool AssetLoaderTechniqueSet::CreateTechsetFromDefinition( + const std::string& assetName, const techset::TechsetDefinition& definition, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager) { auto* techset = memory->Create(); memset(techset, 0, sizeof(MaterialTechniqueSet)); @@ -1293,7 +1338,8 @@ bool AssetLoaderTechniqueSet::CreateTechsetFromDefinition(const std::string& ass return true; } -techset::TechsetDefinition* AssetLoaderTechniqueSet::LoadTechsetDefinition(const std::string& assetName, ISearchPath* searchPath, techset::TechsetDefinitionCache* definitionCache) +techset::TechsetDefinition* + AssetLoaderTechniqueSet::LoadTechsetDefinition(const std::string& assetName, ISearchPath* searchPath, techset::TechsetDefinitionCache* definitionCache) { auto* cachedTechsetDefinition = definitionCache->GetCachedTechsetDefinition(assetName); if (cachedTechsetDefinition) @@ -1313,7 +1359,8 @@ techset::TechsetDefinition* AssetLoaderTechniqueSet::LoadTechsetDefinition(const return techsetDefinitionPtr; } -const state_map::StateMapDefinition* AssetLoaderTechniqueSet::LoadStateMapDefinition(const std::string& stateMapName, ISearchPath* searchPath, techset::TechniqueStateMapCache* stateMapCache) +const state_map::StateMapDefinition* + AssetLoaderTechniqueSet::LoadStateMapDefinition(const std::string& stateMapName, ISearchPath* searchPath, techset::TechniqueStateMapCache* stateMapCache) { auto* cachedStateMap = stateMapCache->GetCachedStateMap(stateMapName); if (cachedStateMap) @@ -1341,7 +1388,8 @@ bool AssetLoaderTechniqueSet::CanLoadFromRaw() const return true; } -bool AssetLoaderTechniqueSet::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderTechniqueSet::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { auto* definitionCache = manager->GetAssetLoadingContext()->GetZoneAssetLoaderState(); const auto* techsetDefinition = LoadTechsetDefinition(assetName, searchPath, definitionCache); diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderTechniqueSet.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderTechniqueSet.h index fe33e504c..9c58885ff 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderTechniqueSet.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderTechniqueSet.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" #include "StateMap/StateMapDefinition.h" #include "Techset/TechniqueStateMapCache.h" @@ -12,7 +12,10 @@ namespace IW4 { class AssetLoaderTechniqueSet final : public BasicAssetLoader { - static bool CreateTechsetFromDefinition(const std::string& assetName, const techset::TechsetDefinition& definition, ISearchPath* searchPath, MemoryManager* memory, + static bool CreateTechsetFromDefinition(const std::string& assetName, + const techset::TechsetDefinition& definition, + ISearchPath* searchPath, + MemoryManager* memory, IAssetLoadingManager* manager); public: @@ -20,11 +23,14 @@ namespace IW4 static std::string GetTechniqueFileName(const std::string& techniqueName); static std::string GetStateMapFileName(const std::string& stateMapName); - static techset::TechsetDefinition* LoadTechsetDefinition(const std::string& assetName, ISearchPath* searchPath, techset::TechsetDefinitionCache* definitionCache); - static const state_map::StateMapDefinition* LoadStateMapDefinition(const std::string& stateMapName, ISearchPath* searchPath, techset::TechniqueStateMapCache* stateMapCache); + static techset::TechsetDefinition* + LoadTechsetDefinition(const std::string& assetName, ISearchPath* searchPath, techset::TechsetDefinitionCache* definitionCache); + static const state_map::StateMapDefinition* + LoadStateMapDefinition(const std::string& stateMapName, ISearchPath* searchPath, techset::TechniqueStateMapCache* stateMapCache); _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderTracer.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderTracer.cpp index f7ca05b6c..bbce11b8a 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderTracer.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderTracer.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderTracer.h" -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderTracer::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderTracer.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderTracer.h index 44e855e1d..969e3048a 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderTracer.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderTracer.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,4 +11,4 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderVehicle.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderVehicle.cpp index 55e12a1fa..343bd8908 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderVehicle.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderVehicle.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderVehicle.h" -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderVehicle::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderVehicle.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderVehicle.h index 26ef3e371..62e484b3d 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderVehicle.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderVehicle.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,4 +11,4 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderVertexDecl.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderVertexDecl.cpp index e2b0ae122..bf446f45d 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderVertexDecl.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderVertexDecl.cpp @@ -1,13 +1,13 @@ #include "AssetLoaderVertexDecl.h" -#include -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" #include "Game/IW4/TechsetConstantsIW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include +#include + using namespace IW4; void* AssetLoaderVertexDecl::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) @@ -42,7 +42,8 @@ bool AssetLoaderVertexDecl::NextAbbreviation(const std::string& assetName, std:: return true; } -bool AssetLoaderVertexDecl::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderVertexDecl::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { MaterialVertexDeclaration decl{}; @@ -50,7 +51,7 @@ bool AssetLoaderVertexDecl::LoadFromRaw(const std::string& assetName, ISearchPat std::string sourceAbbreviation; while (NextAbbreviation(assetName, sourceAbbreviation, currentOffset)) { - if(decl.streamCount >= std::extent_v) + if (decl.streamCount >= std::extent_v) { std::cout << "Failed to add vertex decl stream. Too many abbreviations: " << assetName << "\n"; return false; @@ -63,14 +64,16 @@ bool AssetLoaderVertexDecl::LoadFromRaw(const std::string& assetName, ISearchPat return false; } - const auto foundSourceAbbreviation = std::find(std::begin(materialStreamSourceAbbreviation), std::end(materialStreamSourceAbbreviation), sourceAbbreviation); + const auto foundSourceAbbreviation = + std::find(std::begin(materialStreamSourceAbbreviation), std::end(materialStreamSourceAbbreviation), sourceAbbreviation); if (foundSourceAbbreviation == std::end(materialStreamSourceAbbreviation)) { std::cout << "Unknown vertex decl source abbreviation: " << sourceAbbreviation << "\n"; return false; } - const auto foundDestinationAbbreviation = std::find(std::begin(materialStreamDestinationAbbreviation), std::end(materialStreamDestinationAbbreviation), destinationAbbreviation); + const auto foundDestinationAbbreviation = + std::find(std::begin(materialStreamDestinationAbbreviation), std::end(materialStreamDestinationAbbreviation), destinationAbbreviation); if (foundDestinationAbbreviation == std::end(materialStreamDestinationAbbreviation)) { std::cout << "Unknown vertex decl destination abbreviation: " << destinationAbbreviation << "\n"; @@ -78,7 +81,8 @@ bool AssetLoaderVertexDecl::LoadFromRaw(const std::string& assetName, ISearchPat } const auto sourceIndex = static_cast(foundSourceAbbreviation - std::begin(materialStreamSourceAbbreviation)); - const auto destinationIndex = static_cast(foundDestinationAbbreviation - std::begin(materialStreamDestinationAbbreviation)); + const auto destinationIndex = + static_cast(foundDestinationAbbreviation - std::begin(materialStreamDestinationAbbreviation)); decl.routing.data[decl.streamCount].source = sourceIndex; decl.routing.data[decl.streamCount].dest = destinationIndex; diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderVertexDecl.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderVertexDecl.h index 196c52952..14cdde674 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderVertexDecl.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderVertexDecl.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -14,6 +14,7 @@ namespace IW4 _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderVertexShader.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderVertexShader.cpp index c619bbd6b..aa7615083 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderVertexShader.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderVertexShader.cpp @@ -1,14 +1,14 @@ #include "AssetLoaderVertexShader.h" +#include "Game/IW4/IW4.h" +#include "ObjLoading.h" +#include "Pool/GlobalAssetPool.h" + #include #include #include #include -#include "ObjLoading.h" -#include "Game/IW4/IW4.h" -#include "Pool/GlobalAssetPool.h" - using namespace IW4; void* AssetLoaderVertexShader::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) @@ -31,7 +31,8 @@ std::string AssetLoaderVertexShader::GetFileNameForAsset(const std::string& asse return ss.str(); } -bool AssetLoaderVertexShader::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderVertexShader::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto fileName = GetFileNameForAsset(assetName); const auto file = searchPath->Open(fileName); diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderVertexShader.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderVertexShader.h index b2eab7e89..a52368eba 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderVertexShader.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderVertexShader.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -13,6 +13,7 @@ namespace IW4 _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderWeapon.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderWeapon.cpp index dec4e5b6c..a46358758 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderWeapon.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderWeapon.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderWeapon.h" -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderWeapon::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderWeapon.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderWeapon.h index 6640e9467..bbd5f5986 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderWeapon.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderWeapon.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,4 +11,4 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderXAnim.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderXAnim.cpp index bb1a275b6..0f7ca8dc5 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderXAnim.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderXAnim.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderXAnim.h" -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderXAnim::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderXAnim.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderXAnim.h index a3d98d3f5..1bf98bb5e 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderXAnim.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderXAnim.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,4 +11,4 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderXModel.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderXModel.cpp index c8f43cfa3..b30da93d8 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderXModel.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderXModel.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderXModel.h" -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderXModel::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderXModel.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderXModel.h index b5e79d129..e9c80b68e 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderXModel.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderXModel.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,4 +11,4 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderXModelSurfs.cpp b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderXModelSurfs.cpp index ba8caa7bb..7adf87f90 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderXModelSurfs.cpp +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderXModelSurfs.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderXModelSurfs.h" -#include - -#include "ObjLoading.h" #include "Game/IW4/IW4.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW4; void* AssetLoaderXModelSurfs::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderXModelSurfs.h b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderXModelSurfs.h index f9326ee77..0a7a641bb 100644 --- a/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderXModelSurfs.h +++ b/src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderXModelSurfs.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW4/IW4.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW4/IW4.h" #include "SearchPath/ISearchPath.h" namespace IW4 @@ -11,4 +11,4 @@ namespace IW4 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/InfoString/InfoStringToStructConverter.cpp b/src/ObjLoading/Game/IW4/InfoString/InfoStringToStructConverter.cpp index df9b5dd27..8a52c21c1 100644 --- a/src/ObjLoading/Game/IW4/InfoString/InfoStringToStructConverter.cpp +++ b/src/ObjLoading/Game/IW4/InfoString/InfoStringToStructConverter.cpp @@ -5,8 +5,13 @@ using namespace IW4; -InfoStringToStructConverter::InfoStringToStructConverter(const InfoString& infoString, void* structure, ZoneScriptStrings& zoneScriptStrings, MemoryManager* memory, IAssetLoadingManager* manager, - const cspField_t* fields, const size_t fieldCount) +InfoStringToStructConverter::InfoStringToStructConverter(const InfoString& infoString, + void* structure, + ZoneScriptStrings& zoneScriptStrings, + MemoryManager* memory, + IAssetLoadingManager* manager, + const cspField_t* fields, + const size_t fieldCount) : InfoStringToStructConverterBase(infoString, structure, zoneScriptStrings, memory), m_loading_manager(manager), m_fields(fields), @@ -46,150 +51,150 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons return ConvertMilliseconds(value, field.iOffset); case CSPFT_FX: + { + if (value.empty()) { - if (value.empty()) - { - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = nullptr; - return true; - } + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = nullptr; + return true; + } - auto* fx = m_loading_manager->LoadDependency(ASSET_TYPE_FX, value); + auto* fx = m_loading_manager->LoadDependency(ASSET_TYPE_FX, value); - if (fx == nullptr) - { - std::cout << "Failed to load fx asset \"" << value << "\"" << std::endl; - return false; - } + if (fx == nullptr) + { + std::cout << "Failed to load fx asset \"" << value << "\"" << std::endl; + return false; + } - m_dependencies.emplace(fx); - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = fx->m_ptr; + m_dependencies.emplace(fx); + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = fx->m_ptr; - return true; - } + return true; + } case CSPFT_XMODEL: + { + if (value.empty()) { - if (value.empty()) - { - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = nullptr; - return true; - } + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = nullptr; + return true; + } - auto* xmodel = m_loading_manager->LoadDependency(ASSET_TYPE_XMODEL, value); + auto* xmodel = m_loading_manager->LoadDependency(ASSET_TYPE_XMODEL, value); - if (xmodel == nullptr) - { - std::cout << "Failed to load xmodel asset \"" << value << "\"" << std::endl; - return false; - } + if (xmodel == nullptr) + { + std::cout << "Failed to load xmodel asset \"" << value << "\"" << std::endl; + return false; + } - m_dependencies.emplace(xmodel); - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = xmodel->m_ptr; + m_dependencies.emplace(xmodel); + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = xmodel->m_ptr; - return true; - } + return true; + } case CSPFT_MATERIAL: + { + if (value.empty()) { - if (value.empty()) - { - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = nullptr; - return true; - } + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = nullptr; + return true; + } - auto* material = m_loading_manager->LoadDependency(ASSET_TYPE_MATERIAL, value); + auto* material = m_loading_manager->LoadDependency(ASSET_TYPE_MATERIAL, value); - if (material == nullptr) - { - std::cout << "Failed to load material asset \"" << value << "\"" << std::endl; - return false; - } + if (material == nullptr) + { + std::cout << "Failed to load material asset \"" << value << "\"" << std::endl; + return false; + } - m_dependencies.emplace(material); - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = material->m_ptr; + m_dependencies.emplace(material); + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = material->m_ptr; - return true; - } + return true; + } case CSPFT_TRACER: + { + if (value.empty()) { - if (value.empty()) - { - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = nullptr; - return true; - } + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = nullptr; + return true; + } - auto* tracer = m_loading_manager->LoadDependency(ASSET_TYPE_TRACER, value); + auto* tracer = m_loading_manager->LoadDependency(ASSET_TYPE_TRACER, value); - if (tracer == nullptr) - { - std::cout << "Failed to load tracer asset \"" << value << "\"" << std::endl; - return false; - } + if (tracer == nullptr) + { + std::cout << "Failed to load tracer asset \"" << value << "\"" << std::endl; + return false; + } - m_dependencies.emplace(tracer); - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = tracer->m_ptr; + m_dependencies.emplace(tracer); + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = tracer->m_ptr; - return true; - } + return true; + } case CSPFT_MPH_TO_INCHES_PER_SEC: - { - char* endPtr; - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = strtof(value.c_str(), &endPtr) * 17.6f; - - if (endPtr != &value[value.size()]) - { - std::cout << "Failed to parse value \"" << value << "\" as mph" << std::endl; - return false; - } + { + char* endPtr; + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = strtof(value.c_str(), &endPtr) * 17.6f; - return true; + if (endPtr != &value[value.size()]) + { + std::cout << "Failed to parse value \"" << value << "\" as mph" << std::endl; + return false; } + return true; + } + case CSPFT_PHYS_COLLMAP: + { + if (value.empty()) { - if (value.empty()) - { - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = nullptr; - return true; - } + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = nullptr; + return true; + } - auto* collmap = m_loading_manager->LoadDependency(ASSET_TYPE_PHYSCOLLMAP, value); + auto* collmap = m_loading_manager->LoadDependency(ASSET_TYPE_PHYSCOLLMAP, value); - if (collmap == nullptr) - { - std::cout << "Failed to load collmap asset \"" << value << "\"" << std::endl; - return false; - } + if (collmap == nullptr) + { + std::cout << "Failed to load collmap asset \"" << value << "\"" << std::endl; + return false; + } - m_dependencies.emplace(collmap); - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = collmap->m_ptr; + m_dependencies.emplace(collmap); + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = collmap->m_ptr; - return true; - } + return true; + } case CSPFT_SOUND: + { + if (value.empty()) { - if (value.empty()) - { - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = nullptr; - return true; - } + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = nullptr; + return true; + } - auto* sound = m_loading_manager->LoadDependency(ASSET_TYPE_SOUND, value); + auto* sound = m_loading_manager->LoadDependency(ASSET_TYPE_SOUND, value); - if (sound == nullptr) - { - std::cout << "Failed to load sound asset \"" << value << "\"" << std::endl; - return false; - } + if (sound == nullptr) + { + std::cout << "Failed to load sound asset \"" << value << "\"" << std::endl; + return false; + } - m_dependencies.emplace(sound); - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = sound->m_ptr; + m_dependencies.emplace(sound); + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = sound->m_ptr; - return true; - } + return true; + } case CSPFT_NUM_BASE_FIELD_TYPES: default: diff --git a/src/ObjLoading/Game/IW4/InfoString/InfoStringToStructConverter.h b/src/ObjLoading/Game/IW4/InfoString/InfoStringToStructConverter.h index 672af897b..341a1b562 100644 --- a/src/ObjLoading/Game/IW4/InfoString/InfoStringToStructConverter.h +++ b/src/ObjLoading/Game/IW4/InfoString/InfoStringToStructConverter.h @@ -1,7 +1,7 @@ #pragma once #include "AssetLoading/IAssetLoadingManager.h" -#include "InfoString/InfoStringToStructConverterBase.h" #include "Game/IW4/IW4.h" +#include "InfoString/InfoStringToStructConverterBase.h" namespace IW4 { @@ -16,8 +16,13 @@ namespace IW4 bool ConvertBaseField(const cspField_t& field, const std::string& value); public: - InfoStringToStructConverter(const InfoString& infoString, void* structure, ZoneScriptStrings& zoneScriptStrings, MemoryManager* memory, IAssetLoadingManager* manager, const cspField_t* fields, - size_t fieldCount); + InfoStringToStructConverter(const InfoString& infoString, + void* structure, + ZoneScriptStrings& zoneScriptStrings, + MemoryManager* memory, + IAssetLoadingManager* manager, + const cspField_t* fields, + size_t fieldCount); bool Convert() override; }; -} \ No newline at end of file +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/Menu/MenuConversionZoneStateIW4.h b/src/ObjLoading/Game/IW4/Menu/MenuConversionZoneStateIW4.h index bb4a5da9c..0978a6cc6 100644 --- a/src/ObjLoading/Game/IW4/Menu/MenuConversionZoneStateIW4.h +++ b/src/ObjLoading/Game/IW4/Menu/MenuConversionZoneStateIW4.h @@ -1,10 +1,10 @@ #pragma once -#include - #include "AssetLoading/IZoneAssetLoaderState.h" #include "Game/IW4/IW4.h" +#include + namespace IW4 { class MenuConversionZoneState final : public IZoneAssetLoaderState @@ -36,4 +36,4 @@ namespace IW4 void FinalizeSupportingData() const; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/Menu/MenuConverterIW4.cpp b/src/ObjLoading/Game/IW4/Menu/MenuConverterIW4.cpp index 24f90347f..6aa08ac60 100644 --- a/src/ObjLoading/Game/IW4/Menu/MenuConverterIW4.cpp +++ b/src/ObjLoading/Game/IW4/Menu/MenuConverterIW4.cpp @@ -1,21 +1,21 @@ #include "MenuConverterIW4.h" -#include -#include -#include - -#include "MenuConversionZoneStateIW4.h" -#include "Utils/ClassUtils.h" #include "Menu/AbstractMenuConverter.h" -#include "Parsing/Menu/MenuAssetZoneState.h" +#include "MenuConversionZoneStateIW4.h" #include "Parsing/Menu/Domain/EventHandler/CommonEventHandlerCondition.h" #include "Parsing/Menu/Domain/EventHandler/CommonEventHandlerScript.h" #include "Parsing/Menu/Domain/EventHandler/CommonEventHandlerSetLocalVar.h" #include "Parsing/Menu/Domain/Expression/CommonExpressionBaseFunctionCall.h" #include "Parsing/Menu/Domain/Expression/CommonExpressionCustomFunctionCall.h" +#include "Parsing/Menu/MenuAssetZoneState.h" #include "Parsing/Simple/Expression/SimpleExpressionBinaryOperation.h" #include "Parsing/Simple/Expression/SimpleExpressionConditionalOperator.h" #include "Parsing/Simple/Expression/SimpleExpressionUnaryOperation.h" +#include "Utils/ClassUtils.h" + +#include +#include +#include using namespace IW4; using namespace menu; @@ -35,7 +35,7 @@ namespace IW4 static_cast(rect.w), static_cast(rect.h), static_cast(rect.horizontalAlign), - static_cast(rect.verticalAlign) + static_cast(rect.verticalAlign), }; } @@ -47,7 +47,7 @@ namespace IW4 static_cast(rect.w), static_cast(rect.h), static_cast(rect.horizontalAlign), - static_cast(rect.verticalAlign) + static_cast(rect.verticalAlign), }; } @@ -101,7 +101,10 @@ namespace IW4 return static_cast(soundDependency->m_ptr); } - bool HandleStaticDvarFunctionCall(Statement_s* gameStatement, std::vector& entries, const CommonExpressionBaseFunctionCall* functionCall, const int targetFunctionIndex) const + bool HandleStaticDvarFunctionCall(Statement_s* gameStatement, + std::vector& entries, + const CommonExpressionBaseFunctionCall* functionCall, + const int targetFunctionIndex) const { if (functionCall->m_args.size() != 1) return false; @@ -122,7 +125,8 @@ namespace IW4 expressionEntry staticDvarIndexEntry{}; staticDvarIndexEntry.type = EET_OPERAND; staticDvarIndexEntry.data.operand.dataType = VAL_INT; - staticDvarIndexEntry.data.operand.internals.intVal = static_cast(m_conversion_zone_state->AddStaticDvar(*staticDvarNameExpressionValue.m_string_value)); + staticDvarIndexEntry.data.operand.internals.intVal = + static_cast(m_conversion_zone_state->AddStaticDvar(*staticDvarNameExpressionValue.m_string_value)); entries.emplace_back(staticDvarIndexEntry); expressionEntry parenRight{}; @@ -135,7 +139,10 @@ namespace IW4 return true; } - bool HandleSpecialBaseFunctionCall(Statement_s* gameStatement, std::vector& entries, const CommonExpressionBaseFunctionCall* functionCall, const CommonMenuDef* menu, + bool HandleSpecialBaseFunctionCall(Statement_s* gameStatement, + std::vector& entries, + const CommonExpressionBaseFunctionCall* functionCall, + const CommonMenuDef* menu, const CommonItemDef* item) const { switch (functionCall->m_function_index) @@ -155,7 +162,10 @@ namespace IW4 return false; } - void ConvertExpressionEntryBaseFunctionCall(Statement_s* gameStatement, std::vector& entries, const CommonExpressionBaseFunctionCall* functionCall, const CommonMenuDef* menu, + void ConvertExpressionEntryBaseFunctionCall(Statement_s* gameStatement, + std::vector& entries, + const CommonExpressionBaseFunctionCall* functionCall, + const CommonMenuDef* menu, const CommonItemDef* item) const { if (!HandleSpecialBaseFunctionCall(gameStatement, entries, functionCall, menu, item)) @@ -188,7 +198,9 @@ namespace IW4 } } - void ConvertExpressionEntryCustomFunctionCall(Statement_s* gameStatement, std::vector& entries, const CommonExpressionCustomFunctionCall* functionCall, + void ConvertExpressionEntryCustomFunctionCall(Statement_s* gameStatement, + std::vector& entries, + const CommonExpressionCustomFunctionCall* functionCall, const CommonMenuDef* menu, const CommonItemDef* item) const { @@ -216,11 +228,10 @@ namespace IW4 gameStatement->supportingData = m_conversion_zone_state->m_supporting_data; } - constexpr static expressionOperatorType_e UNARY_OPERATION_MAPPING[static_cast(SimpleUnaryOperationId::COUNT)] - { + constexpr static expressionOperatorType_e UNARY_OPERATION_MAPPING[static_cast(SimpleUnaryOperationId::COUNT)]{ OP_NOT, OP_BITWISENOT, - OP_SUBTRACT + OP_SUBTRACT, }; bool IsOperation(const ISimpleExpression* expression) const @@ -231,7 +242,10 @@ namespace IW4 return dynamic_cast(expression) || dynamic_cast(expression); } - void ConvertExpressionEntryUnaryOperation(Statement_s* gameStatement, std::vector& entries, const SimpleExpressionUnaryOperation* unaryOperation, const CommonMenuDef* menu, + void ConvertExpressionEntryUnaryOperation(Statement_s* gameStatement, + std::vector& entries, + const SimpleExpressionUnaryOperation* unaryOperation, + const CommonMenuDef* menu, const CommonItemDef* item) const { assert(static_cast(unaryOperation->m_operation_type->m_id) < static_cast(SimpleUnaryOperationId::COUNT)); @@ -258,8 +272,7 @@ namespace IW4 ConvertExpressionEntry(gameStatement, entries, unaryOperation->m_operand.get(), menu, item); } - constexpr static expressionOperatorType_e BINARY_OPERATION_MAPPING[static_cast(SimpleBinaryOperationId::COUNT)] - { + constexpr static expressionOperatorType_e BINARY_OPERATION_MAPPING[static_cast(SimpleBinaryOperationId::COUNT)]{ OP_ADD, OP_SUBTRACT, OP_MULTIPLY, @@ -276,10 +289,13 @@ namespace IW4 OP_EQUALS, OP_NOTEQUAL, OP_AND, - OP_OR + OP_OR, }; - void ConvertExpressionEntryBinaryOperation(Statement_s* gameStatement, std::vector& entries, const SimpleExpressionBinaryOperation* binaryOperation, const CommonMenuDef* menu, + void ConvertExpressionEntryBinaryOperation(Statement_s* gameStatement, + std::vector& entries, + const SimpleExpressionBinaryOperation* binaryOperation, + const CommonMenuDef* menu, const CommonItemDef* item) const { // Game needs all nested operations to have parenthesis @@ -349,7 +365,11 @@ namespace IW4 entries.emplace_back(entry); } - void ConvertExpressionEntry(Statement_s* gameStatement, std::vector& entries, const ISimpleExpression* expression, const CommonMenuDef* menu, const CommonItemDef* item) const + void ConvertExpressionEntry(Statement_s* gameStatement, + std::vector& entries, + const ISimpleExpression* expression, + const CommonMenuDef* menu, + const CommonItemDef* item) const { if (!m_disable_optimizations && expression->IsStatic()) { @@ -409,7 +429,10 @@ namespace IW4 return statement; } - _NODISCARD Statement_s* ConvertOrApplyStatement(float& staticValue, const ISimpleExpression* expression, const CommonMenuDef* menu, const CommonItemDef* item = nullptr) const + _NODISCARD Statement_s* ConvertOrApplyStatement(float& staticValue, + const ISimpleExpression* expression, + const CommonMenuDef* menu, + const CommonItemDef* item = nullptr) const { if (m_disable_optimizations) return ConvertExpression(expression, menu, item); @@ -437,7 +460,10 @@ namespace IW4 return ConvertExpression(expression, menu, item); } - _NODISCARD Statement_s* ConvertOrApplyStatement(const char*& staticValue, const ISimpleExpression* expression, const CommonMenuDef* menu, const CommonItemDef* item = nullptr) const + _NODISCARD Statement_s* ConvertOrApplyStatement(const char*& staticValue, + const ISimpleExpression* expression, + const CommonMenuDef* menu, + const CommonItemDef* item = nullptr) const { if (m_disable_optimizations) return ConvertExpression(expression, menu, item); @@ -464,7 +490,10 @@ namespace IW4 return ConvertExpression(expression, menu, item); } - _NODISCARD Statement_s* ConvertOrApplyStatement(Material*& staticValue, const ISimpleExpression* expression, const CommonMenuDef* menu, const CommonItemDef* item = nullptr) const + _NODISCARD Statement_s* ConvertOrApplyStatement(Material*& staticValue, + const ISimpleExpression* expression, + const CommonMenuDef* menu, + const CommonItemDef* item = nullptr) const { if (m_disable_optimizations) return ConvertExpression(expression, menu, item); @@ -491,7 +520,10 @@ namespace IW4 return ConvertExpression(expression, menu, item); } - _NODISCARD Statement_s* ConvertVisibleExpression(windowDef_t* window, const ISimpleExpression* expression, const CommonMenuDef* commonMenu, const CommonItemDef* commonItem = nullptr) const + _NODISCARD Statement_s* ConvertVisibleExpression(windowDef_t* window, + const ISimpleExpression* expression, + const CommonMenuDef* commonMenu, + const CommonItemDef* commonItem = nullptr) const { if (expression == nullptr) return nullptr; @@ -502,7 +534,8 @@ namespace IW4 { const auto* staticValue = dynamic_cast(expression); isStatic = staticValue != nullptr; - isTruthy = isStatic && (staticValue->m_type == SimpleExpressionValue::Type::INT || staticValue->m_type == SimpleExpressionValue::Type::DOUBLE) && staticValue->IsTruthy(); + isTruthy = isStatic && (staticValue->m_type == SimpleExpressionValue::Type::INT || staticValue->m_type == SimpleExpressionValue::Type::DOUBLE) + && staticValue->IsTruthy(); } else { @@ -540,7 +573,10 @@ namespace IW4 } } - void ConvertEventHandlerSetLocalVar(std::vector& elements, const CommonEventHandlerSetLocalVar* setLocalVar, const CommonMenuDef* menu, const CommonItemDef* item) const + void ConvertEventHandlerSetLocalVar(std::vector& elements, + const CommonEventHandlerSetLocalVar* setLocalVar, + const CommonMenuDef* menu, + const CommonItemDef* item) const { assert(setLocalVar); if (!setLocalVar) @@ -571,20 +607,22 @@ namespace IW4 elements.push_back(outputHandler); } - void ConvertEventHandlerCondition(std::vector& elements, const CommonEventHandlerCondition* condition, const CommonMenuDef* menu, + void ConvertEventHandlerCondition(std::vector& elements, + const CommonEventHandlerCondition* condition, + const CommonMenuDef* menu, const CommonItemDef* item) const { assert(condition); if (!condition || !condition->m_condition) return; - if(!m_disable_optimizations && condition->m_condition->IsStatic()) + if (!m_disable_optimizations && condition->m_condition->IsStatic()) { const auto staticValueIsTruthy = condition->m_condition->EvaluateStatic().IsTruthy(); - if(staticValueIsTruthy) + if (staticValueIsTruthy) ConvertEventHandlerElements(elements, condition->m_condition_elements.get(), menu, item); - else if(condition->m_else_elements) + else if (condition->m_else_elements) ConvertEventHandlerElements(elements, condition->m_else_elements.get(), menu, item); } else @@ -611,7 +649,9 @@ namespace IW4 } } - void ConvertEventHandler(std::vector& elements, const ICommonEventHandlerElement* eventHandler, const CommonMenuDef* menu, + void ConvertEventHandler(std::vector& elements, + const ICommonEventHandlerElement* eventHandler, + const CommonMenuDef* menu, const CommonItemDef* item) const { assert(eventHandler); @@ -634,13 +674,17 @@ namespace IW4 } } - void ConvertEventHandlerElements(std::vector& elements, const CommonEventHandlerSet* eventHandlerSet, const CommonMenuDef* menu, const CommonItemDef* item) const + void ConvertEventHandlerElements(std::vector& elements, + const CommonEventHandlerSet* eventHandlerSet, + const CommonMenuDef* menu, + const CommonItemDef* item) const { for (const auto& element : eventHandlerSet->m_elements) ConvertEventHandler(elements, element.get(), menu, item); } - _NODISCARD MenuEventHandlerSet* ConvertEventHandlerSet(const CommonEventHandlerSet* eventHandlerSet, const CommonMenuDef* menu, const CommonItemDef* item = nullptr) const + _NODISCARD MenuEventHandlerSet* + ConvertEventHandlerSet(const CommonEventHandlerSet* eventHandlerSet, const CommonMenuDef* menu, const CommonItemDef* item = nullptr) const { if (!eventHandlerSet) return nullptr; @@ -661,7 +705,9 @@ namespace IW4 return outputSet; } - _NODISCARD ItemKeyHandler* ConvertKeyHandler(const std::multimap>& keyHandlers, const CommonMenuDef* menu, const CommonItemDef* item = nullptr) const + _NODISCARD ItemKeyHandler* ConvertKeyHandler(const std::multimap>& keyHandlers, + const CommonMenuDef* menu, + const CommonItemDef* item = nullptr) const { if (keyHandlers.empty()) return nullptr; @@ -684,7 +730,8 @@ namespace IW4 return output; } - ItemFloatExpression* ConvertFloatExpressions(const CommonItemDef* commonItem, itemDef_s* item, const CommonMenuDef* parentMenu, int& floatExpressionCount) const + ItemFloatExpression* + ConvertFloatExpressions(const CommonItemDef* commonItem, itemDef_s* item, const CommonMenuDef* parentMenu, int& floatExpressionCount) const { struct FloatExpressionLocation { @@ -695,27 +742,42 @@ namespace IW4 unsigned m_static_value_array_size; unsigned m_dynamic_flags_to_set; }; - FloatExpressionLocation locations[] - { - {commonItem->m_rect_x_exp.get(), false, ITEM_FLOATEXP_TGT_RECT_X, &item->window.rectClient.x, 1, 0}, - {commonItem->m_rect_y_exp.get(), false, ITEM_FLOATEXP_TGT_RECT_Y, &item->window.rectClient.y, 1, 0}, - {commonItem->m_rect_w_exp.get(), false, ITEM_FLOATEXP_TGT_RECT_W, &item->window.rectClient.w, 1, 0}, - {commonItem->m_rect_h_exp.get(), false, ITEM_FLOATEXP_TGT_RECT_H, &item->window.rectClient.h, 1, 0}, - {commonItem->m_forecolor_expressions.m_r_exp.get(), false, ITEM_FLOATEXP_TGT_FORECOLOR_R, &item->window.foreColor[0], 1, WINDOW_FLAG_NON_DEFAULT_FORECOLOR}, - {commonItem->m_forecolor_expressions.m_g_exp.get(), false, ITEM_FLOATEXP_TGT_FORECOLOR_G, &item->window.foreColor[1], 1, WINDOW_FLAG_NON_DEFAULT_FORECOLOR}, - {commonItem->m_forecolor_expressions.m_b_exp.get(), false, ITEM_FLOATEXP_TGT_FORECOLOR_B, &item->window.foreColor[2], 1, WINDOW_FLAG_NON_DEFAULT_FORECOLOR}, - {commonItem->m_forecolor_expressions.m_a_exp.get(), false, ITEM_FLOATEXP_TGT_FORECOLOR_A, &item->window.foreColor[3], 1, WINDOW_FLAG_NON_DEFAULT_FORECOLOR}, - {commonItem->m_forecolor_expressions.m_rgb_exp.get(), false, ITEM_FLOATEXP_TGT_FORECOLOR_RGB, &item->window.foreColor[0], 3, WINDOW_FLAG_NON_DEFAULT_FORECOLOR}, - {commonItem->m_glowcolor_expressions.m_r_exp.get(), false, ITEM_FLOATEXP_TGT_GLOWCOLOR_R, &item->glowColor[0], 1, 0}, - {commonItem->m_glowcolor_expressions.m_g_exp.get(), false, ITEM_FLOATEXP_TGT_GLOWCOLOR_G, &item->glowColor[1], 1, 0}, - {commonItem->m_glowcolor_expressions.m_b_exp.get(), false, ITEM_FLOATEXP_TGT_GLOWCOLOR_B, &item->glowColor[2], 1, 0}, - {commonItem->m_glowcolor_expressions.m_a_exp.get(), false, ITEM_FLOATEXP_TGT_GLOWCOLOR_A, &item->glowColor[3], 1, 0}, - {commonItem->m_glowcolor_expressions.m_rgb_exp.get(), false, ITEM_FLOATEXP_TGT_GLOWCOLOR_RGB, &item->glowColor[0], 3, 0}, - {commonItem->m_backcolor_expressions.m_r_exp.get(), false, ITEM_FLOATEXP_TGT_BACKCOLOR_R, &item->window.backColor[0], 1, 0}, - {commonItem->m_backcolor_expressions.m_g_exp.get(), false, ITEM_FLOATEXP_TGT_BACKCOLOR_G, &item->window.backColor[1], 1, 0}, - {commonItem->m_backcolor_expressions.m_b_exp.get(), false, ITEM_FLOATEXP_TGT_BACKCOLOR_B, &item->window.backColor[2], 1, 0}, - {commonItem->m_backcolor_expressions.m_a_exp.get(), false, ITEM_FLOATEXP_TGT_BACKCOLOR_A, &item->window.backColor[3], 1, 0}, - {commonItem->m_backcolor_expressions.m_rgb_exp.get(), false, ITEM_FLOATEXP_TGT_BACKCOLOR_RGB, &item->window.backColor[0], 3, 0}, + + FloatExpressionLocation locations[]{ + {commonItem->m_rect_x_exp.get(), false, ITEM_FLOATEXP_TGT_RECT_X, &item->window.rectClient.x, 1, 0 }, + {commonItem->m_rect_y_exp.get(), false, ITEM_FLOATEXP_TGT_RECT_Y, &item->window.rectClient.y, 1, 0 }, + {commonItem->m_rect_w_exp.get(), false, ITEM_FLOATEXP_TGT_RECT_W, &item->window.rectClient.w, 1, 0 }, + {commonItem->m_rect_h_exp.get(), false, ITEM_FLOATEXP_TGT_RECT_H, &item->window.rectClient.h, 1, 0 }, + {commonItem->m_forecolor_expressions.m_r_exp.get(), + false, ITEM_FLOATEXP_TGT_FORECOLOR_R, + &item->window.foreColor[0], + 1, WINDOW_FLAG_NON_DEFAULT_FORECOLOR}, + {commonItem->m_forecolor_expressions.m_g_exp.get(), + false, ITEM_FLOATEXP_TGT_FORECOLOR_G, + &item->window.foreColor[1], + 1, WINDOW_FLAG_NON_DEFAULT_FORECOLOR}, + {commonItem->m_forecolor_expressions.m_b_exp.get(), + false, ITEM_FLOATEXP_TGT_FORECOLOR_B, + &item->window.foreColor[2], + 1, WINDOW_FLAG_NON_DEFAULT_FORECOLOR}, + {commonItem->m_forecolor_expressions.m_a_exp.get(), + false, ITEM_FLOATEXP_TGT_FORECOLOR_A, + &item->window.foreColor[3], + 1, WINDOW_FLAG_NON_DEFAULT_FORECOLOR}, + {commonItem->m_forecolor_expressions.m_rgb_exp.get(), + false, ITEM_FLOATEXP_TGT_FORECOLOR_RGB, + &item->window.foreColor[0], + 3, WINDOW_FLAG_NON_DEFAULT_FORECOLOR}, + {commonItem->m_glowcolor_expressions.m_r_exp.get(), false, ITEM_FLOATEXP_TGT_GLOWCOLOR_R, &item->glowColor[0], 1, 0 }, + {commonItem->m_glowcolor_expressions.m_g_exp.get(), false, ITEM_FLOATEXP_TGT_GLOWCOLOR_G, &item->glowColor[1], 1, 0 }, + {commonItem->m_glowcolor_expressions.m_b_exp.get(), false, ITEM_FLOATEXP_TGT_GLOWCOLOR_B, &item->glowColor[2], 1, 0 }, + {commonItem->m_glowcolor_expressions.m_a_exp.get(), false, ITEM_FLOATEXP_TGT_GLOWCOLOR_A, &item->glowColor[3], 1, 0 }, + {commonItem->m_glowcolor_expressions.m_rgb_exp.get(), false, ITEM_FLOATEXP_TGT_GLOWCOLOR_RGB, &item->glowColor[0], 3, 0 }, + {commonItem->m_backcolor_expressions.m_r_exp.get(), false, ITEM_FLOATEXP_TGT_BACKCOLOR_R, &item->window.backColor[0], 1, 0 }, + {commonItem->m_backcolor_expressions.m_g_exp.get(), false, ITEM_FLOATEXP_TGT_BACKCOLOR_G, &item->window.backColor[1], 1, 0 }, + {commonItem->m_backcolor_expressions.m_b_exp.get(), false, ITEM_FLOATEXP_TGT_BACKCOLOR_B, &item->window.backColor[2], 1, 0 }, + {commonItem->m_backcolor_expressions.m_a_exp.get(), false, ITEM_FLOATEXP_TGT_BACKCOLOR_A, &item->window.backColor[3], 1, 0 }, + {commonItem->m_backcolor_expressions.m_rgb_exp.get(), false, ITEM_FLOATEXP_TGT_BACKCOLOR_RGB, &item->window.backColor[0], 3, 0 }, }; floatExpressionCount = 0; @@ -732,7 +794,7 @@ namespace IW4 item->window.dynamicFlags[0] |= dynamicFlagsToSet; auto* staticValuePtr = staticValue; - for(auto i = 0u; i < staticValueArraySize; i++) + for (auto i = 0u; i < staticValueArraySize; i++) { *staticValuePtr = static_cast(evaluatedValue.m_int_value); staticValuePtr++; @@ -829,7 +891,10 @@ namespace IW4 return nullptr; } - _NODISCARD listBoxDef_s* ConvertListBoxFeatures(itemDef_s* item, CommonItemFeaturesListBox* commonListBox, const CommonMenuDef& parentMenu, const CommonItemDef& commonItem) const + _NODISCARD listBoxDef_s* ConvertListBoxFeatures(itemDef_s* item, + CommonItemFeaturesListBox* commonListBox, + const CommonMenuDef& parentMenu, + const CommonItemDef& commonItem) const { if (commonListBox == nullptr) return nullptr; @@ -863,7 +928,10 @@ namespace IW4 return listBox; } - _NODISCARD editFieldDef_s* ConvertEditFieldFeatures(itemDef_s* item, CommonItemFeaturesEditField* commonEditField, const CommonMenuDef& parentMenu, const CommonItemDef& commonItem) const + _NODISCARD editFieldDef_s* ConvertEditFieldFeatures(itemDef_s* item, + CommonItemFeaturesEditField* commonEditField, + const CommonMenuDef& parentMenu, + const CommonItemDef& commonItem) const { if (commonEditField == nullptr) return nullptr; @@ -882,7 +950,10 @@ namespace IW4 return editField; } - _NODISCARD multiDef_s* ConvertMultiValueFeatures(itemDef_s* item, CommonItemFeaturesMultiValue* commonMultiValue, const CommonMenuDef& parentMenu, const CommonItemDef& commonItem) const + _NODISCARD multiDef_s* ConvertMultiValueFeatures(itemDef_s* item, + CommonItemFeaturesMultiValue* commonMultiValue, + const CommonMenuDef& parentMenu, + const CommonItemDef& commonItem) const { if (commonMultiValue == nullptr) return nullptr; @@ -912,7 +983,10 @@ namespace IW4 return multiValue; } - _NODISCARD newsTickerDef_s* ConvertNewsTickerFeatures(itemDef_s* item, CommonItemFeaturesNewsTicker* commonNewsTicker, const CommonMenuDef& parentMenu, const CommonItemDef& commonItem) const + _NODISCARD newsTickerDef_s* ConvertNewsTickerFeatures(itemDef_s* item, + CommonItemFeaturesNewsTicker* commonNewsTicker, + const CommonMenuDef& parentMenu, + const CommonItemDef& commonItem) const { if (commonNewsTicker == nullptr) return nullptr; @@ -1016,7 +1090,7 @@ namespace IW4 case CommonItemFeatureType::NONE: default: - if(item->type == ITEM_TYPE_TEXT_SCROLL) + if (item->type == ITEM_TYPE_TEXT_SCROLL) { item->typeData.scroll = static_cast(m_memory->Alloc(sizeof(textScrollDef_s))); memset(item->typeData.scroll, 0, sizeof(textScrollDef_s)); @@ -1110,7 +1184,7 @@ namespace IW4 std::vector m_dependencies; }; -} +} // namespace IW4 MenuConverter::MenuConverter(const bool disableOptimizations, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager) : m_disable_optimizations(disableOptimizations), diff --git a/src/ObjLoading/Game/IW4/Menu/MenuConverterIW4.h b/src/ObjLoading/Game/IW4/Menu/MenuConverterIW4.h index 9dbdcb803..ffe6f40b4 100644 --- a/src/ObjLoading/Game/IW4/Menu/MenuConverterIW4.h +++ b/src/ObjLoading/Game/IW4/Menu/MenuConverterIW4.h @@ -1,11 +1,11 @@ #pragma once -#include "Utils/ClassUtils.h" #include "AssetLoading/IAssetLoadingManager.h" #include "Game/IW4/IW4.h" #include "Parsing/Menu/Domain/CommonMenuDef.h" -#include "Utils/MemoryManager.h" #include "SearchPath/ISearchPath.h" +#include "Utils/ClassUtils.h" +#include "Utils/MemoryManager.h" namespace IW4 { @@ -23,4 +23,4 @@ namespace IW4 std::vector& GetDependencies(); _NODISCARD menuDef_t* ConvertMenu(const menu::CommonMenuDef& commonMenu); }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW4/ObjLoaderIW4.cpp b/src/ObjLoading/Game/IW4/ObjLoaderIW4.cpp index 6bb437936..95ff6fff9 100644 --- a/src/ObjLoading/Game/IW4/ObjLoaderIW4.cpp +++ b/src/ObjLoading/Game/IW4/ObjLoaderIW4.cpp @@ -1,9 +1,5 @@ #include "ObjLoaderIW4.h" -#include "Game/IW4/GameIW4.h" -#include "Game/IW4/GameAssetPoolIW4.h" -#include "ObjContainer/IPak/IPak.h" -#include "ObjLoading.h" #include "AssetLoaders/AssetLoaderAddonMapEnts.h" #include "AssetLoaders/AssetLoaderClipMap.h" #include "AssetLoaders/AssetLoaderComWorld.h" @@ -41,16 +37,24 @@ #include "AssetLoaders/AssetLoaderXModel.h" #include "AssetLoaders/AssetLoaderXModelSurfs.h" #include "AssetLoading/AssetLoadingManager.h" +#include "Game/IW4/GameAssetPoolIW4.h" +#include "Game/IW4/GameIW4.h" #include "Image/Dx9TextureLoader.h" -#include "Image/Texture.h" #include "Image/IwiLoader.h" #include "Image/IwiTypes.h" +#include "Image/Texture.h" +#include "ObjContainer/IPak/IPak.h" +#include "ObjLoading.h" using namespace IW4; ObjLoader::ObjLoader() { -#define REGISTER_ASSET_LOADER(t) {auto l = std::make_unique(); m_asset_loaders_by_type[l->GetHandlingAssetType()] = std::move(l);} +#define REGISTER_ASSET_LOADER(t) \ + { \ + auto l = std::make_unique(); \ + m_asset_loaders_by_type[l->GetHandlingAssetType()] = std::move(l); \ + } REGISTER_ASSET_LOADER(AssetLoaderPhysPreset) REGISTER_ASSET_LOADER(AssetLoaderPhysCollmap) @@ -89,7 +93,7 @@ ObjLoader::ObjLoader() REGISTER_ASSET_LOADER(AssetLoaderTracer) REGISTER_ASSET_LOADER(AssetLoaderVehicle) REGISTER_ASSET_LOADER(AssetLoaderAddonMapEnts) - + #undef REGISTER_ASSET_LOADER } @@ -100,23 +104,17 @@ bool ObjLoader::SupportsZone(Zone* zone) const bool ObjLoader::IsMpZone(Zone* zone) { - return zone->m_name.compare(0, 3, "mp_") == 0 - || zone->m_name.compare(zone->m_name.length() - 3, 3, "_mp") == 0; + return zone->m_name.compare(0, 3, "mp_") == 0 || zone->m_name.compare(zone->m_name.length() - 3, 3, "_mp") == 0; } bool ObjLoader::IsZmZone(Zone* zone) { - return zone->m_name.compare(0, 3, "zm_") == 0 - || zone->m_name.compare(zone->m_name.length() - 3, 3, "_zm") == 0; + return zone->m_name.compare(0, 3, "zm_") == 0 || zone->m_name.compare(zone->m_name.length() - 3, 3, "_zm") == 0; } -void ObjLoader::LoadReferencedContainersForZone(ISearchPath* searchPath, Zone* zone) const -{ -} +void ObjLoader::LoadReferencedContainersForZone(ISearchPath* searchPath, Zone* zone) const {} -void ObjLoader::UnloadContainersOfZone(Zone* zone) const -{ -} +void ObjLoader::UnloadContainersOfZone(Zone* zone) const {} void ObjLoader::LoadImageFromLoadDef(GfxImage* image, Zone* zone) { diff --git a/src/ObjLoading/Game/IW4/ObjLoaderIW4.h b/src/ObjLoading/Game/IW4/ObjLoaderIW4.h index 5a24078a7..1739fab4a 100644 --- a/src/ObjLoading/Game/IW4/ObjLoaderIW4.h +++ b/src/ObjLoading/Game/IW4/ObjLoaderIW4.h @@ -1,12 +1,12 @@ #pragma once -#include -#include - -#include "IObjLoader.h" #include "AssetLoading/IAssetLoader.h" -#include "SearchPath/ISearchPath.h" #include "Game/IW4/IW4.h" +#include "IObjLoader.h" +#include "SearchPath/ISearchPath.h" + +#include +#include namespace IW4 { @@ -34,4 +34,4 @@ namespace IW4 bool LoadAssetForZone(AssetLoadingContext* context, asset_type_t assetType, const std::string& assetName) const override; void FinalizeAssetsForZone(AssetLoadingContext* context) const override; }; -} +} // namespace IW4 diff --git a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderLocalizeEntry.cpp b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderLocalizeEntry.cpp index f5eb59783..d3b94c757 100644 --- a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderLocalizeEntry.cpp +++ b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderLocalizeEntry.cpp @@ -1,10 +1,10 @@ #include "AssetLoaderLocalizeEntry.h" -#include - #include "Localize/LocalizeCommon.h" #include "Parsing/LocalizeFile/LocalizeFileReader.h" +#include + using namespace IW5; XAssetInfoGeneric* AssetLoaderLocalizeEntry::LoadFromGlobalAssetPools(const std::string& assetName) const @@ -22,7 +22,8 @@ bool AssetLoaderLocalizeEntry::CanLoadFromRaw() const return true; } -bool AssetLoaderLocalizeEntry::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderLocalizeEntry::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { std::string fileName; { diff --git a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderLocalizeEntry.h b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderLocalizeEntry.h index 8d4c21c4a..d21c80c70 100644 --- a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderLocalizeEntry.h +++ b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderLocalizeEntry.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW5/IW5.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/IW5/IW5.h" #include "SearchPath/ISearchPath.h" namespace IW5 @@ -12,6 +12,7 @@ namespace IW5 _NODISCARD XAssetInfoGeneric* LoadFromGlobalAssetPools(const std::string& assetName) const override; _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace IW5 diff --git a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMaterial.cpp b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMaterial.cpp index 8bd593202..6075ad871 100644 --- a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMaterial.cpp +++ b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMaterial.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderMaterial.h" -#include - -#include "ObjLoading.h" #include "Game/IW5/IW5.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW5; void* AssetLoaderMaterial::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMaterial.h b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMaterial.h index d283e74e8..7a7a08f04 100644 --- a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMaterial.h +++ b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMaterial.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW5/IW5.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW5/IW5.h" #include "SearchPath/ISearchPath.h" namespace IW5 @@ -11,4 +11,4 @@ namespace IW5 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; }; -} +} // namespace IW5 diff --git a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMenuDef.cpp b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMenuDef.cpp index d72739a78..dbbddba77 100644 --- a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMenuDef.cpp +++ b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMenuDef.cpp @@ -1,11 +1,11 @@ #include "AssetLoaderMenuDef.h" -#include - -#include "ObjLoading.h" #include "Game/IW5/IW5.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW5; void* AssetLoaderMenuDef::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMenuDef.h b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMenuDef.h index 8bf0bf906..eda174352 100644 --- a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMenuDef.h +++ b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMenuDef.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW5/IW5.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW5/IW5.h" #include "SearchPath/ISearchPath.h" namespace IW5 @@ -11,4 +11,4 @@ namespace IW5 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; }; -} +} // namespace IW5 diff --git a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMenuList.cpp b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMenuList.cpp index 10a75ace0..bbff52011 100644 --- a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMenuList.cpp +++ b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMenuList.cpp @@ -1,15 +1,15 @@ #include "AssetLoaderMenuList.h" -#include -#include - -#include "ObjLoading.h" #include "Game/IW5/IW5.h" #include "Game/IW5/Menu/MenuConversionZoneStateIW5.h" #include "Game/IW5/Menu/MenuConverterIW5.h" +#include "ObjLoading.h" #include "Parsing/Menu/MenuFileReader.h" #include "Pool/GlobalAssetPool.h" +#include +#include + using namespace IW5; namespace IW5 @@ -17,8 +17,14 @@ namespace IW5 class MenuLoader { public: - static bool ProcessParsedResults(const std::string& fileName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, menu::ParsingResult* parsingResult, - menu::MenuAssetZoneState* zoneState, MenuConversionZoneState* conversionState, std::vector& menus, + static bool ProcessParsedResults(const std::string& fileName, + ISearchPath* searchPath, + MemoryManager* memory, + IAssetLoadingManager* manager, + menu::ParsingResult* parsingResult, + menu::MenuAssetZoneState* zoneState, + MenuConversionZoneState* conversionState, + std::vector& menus, std::vector& menuListDependencies) { const auto menuCount = parsingResult->m_menus.size(); @@ -28,8 +34,8 @@ namespace IW5 for (const auto& menu : parsingResult->m_menus) totalItemCount += menu->m_items.size(); - std::cout << "Successfully read menu file \"" << fileName << "\" (" << menuLoadCount << " loads, " << menuCount << " menus, " << functionCount << " functions, " << totalItemCount << - " items)\n"; + std::cout << "Successfully read menu file \"" << fileName << "\" (" << menuLoadCount << " loads, " << menuCount << " menus, " << functionCount + << " functions, " << totalItemCount << " items)\n"; // Add all functions to the zone state to make them available for all menus to be converted for (auto& function : parsingResult->m_functions) @@ -51,7 +57,8 @@ namespace IW5 } menus.push_back(menuAsset); - auto* menuAssetInfo = manager->AddAsset(ASSET_TYPE_MENU, menu->m_name, menuAsset, std::move(converter.GetDependencies()), std::vector()); + auto* menuAssetInfo = + manager->AddAsset(ASSET_TYPE_MENU, menu->m_name, menuAsset, std::move(converter.GetDependencies()), std::vector()); if (menuAssetInfo) { @@ -86,20 +93,24 @@ namespace IW5 return menuListAsset; } - static std::unique_ptr ParseMenuFile(const std::string& menuFileName, ISearchPath* searchPath, const menu::MenuAssetZoneState* zoneState) + static std::unique_ptr + ParseMenuFile(const std::string& menuFileName, ISearchPath* searchPath, const menu::MenuAssetZoneState* zoneState) { const auto file = searchPath->Open(menuFileName); if (!file.IsOpen()) return nullptr; - menu::MenuFileReader reader(*file.m_stream, menuFileName, menu::FeatureLevel::IW5, [searchPath](const std::string& filename, const std::string& sourceFile) -> std::unique_ptr - { - auto foundFileToInclude = searchPath->Open(filename); - if (!foundFileToInclude.IsOpen() || !foundFileToInclude.m_stream) - return nullptr; + menu::MenuFileReader reader(*file.m_stream, + menuFileName, + menu::FeatureLevel::IW5, + [searchPath](const std::string& filename, const std::string& sourceFile) -> std::unique_ptr + { + auto foundFileToInclude = searchPath->Open(filename); + if (!foundFileToInclude.IsOpen() || !foundFileToInclude.m_stream) + return nullptr; - return std::move(foundFileToInclude.m_stream); - }); + return std::move(foundFileToInclude.m_stream); + }); reader.IncludeZoneState(zoneState); reader.SetPermissiveMode(ObjLoading::Configuration.MenuPermissiveParsing); @@ -107,7 +118,7 @@ namespace IW5 return reader.ReadMenuFile(); } }; -} +} // namespace IW5 void* AssetLoaderMenuList::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) { @@ -122,8 +133,15 @@ bool AssetLoaderMenuList::CanLoadFromRaw() const return true; } -bool BuildMenuFileQueue(std::deque& menuLoadQueue, const std::string& menuListAssetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, menu::MenuAssetZoneState* zoneState, - MenuConversionZoneState* conversionState, std::vector& menus, std::vector& menuListDependencies) +bool BuildMenuFileQueue(std::deque& menuLoadQueue, + const std::string& menuListAssetName, + ISearchPath* searchPath, + MemoryManager* memory, + IAssetLoadingManager* manager, + menu::MenuAssetZoneState* zoneState, + MenuConversionZoneState* conversionState, + std::vector& menus, + std::vector& menuListDependencies) { const auto alreadyLoadedMenuListFileMenus = conversionState->m_menus_by_filename.find(menuListAssetName); @@ -132,7 +150,8 @@ bool BuildMenuFileQueue(std::deque& menuLoadQueue, const std::strin const auto menuListResult = MenuLoader::ParseMenuFile(menuListAssetName, searchPath, zoneState); if (menuListResult) { - MenuLoader::ProcessParsedResults(menuListAssetName, searchPath, memory, manager, menuListResult.get(), zoneState, conversionState, menus, menuListDependencies); + MenuLoader::ProcessParsedResults( + menuListAssetName, searchPath, memory, manager, menuListResult.get(), zoneState, conversionState, menus, menuListDependencies); for (const auto& menuToLoad : menuListResult->m_menus_to_load) menuLoadQueue.push_back(menuToLoad); @@ -146,8 +165,14 @@ bool BuildMenuFileQueue(std::deque& menuLoadQueue, const std::strin return true; } -void LoadMenuFileFromQueue(const std::string& menuFilePath, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, menu::MenuAssetZoneState* zoneState, - MenuConversionZoneState* conversionState, std::vector& menus, std::vector& menuListDependencies) +void LoadMenuFileFromQueue(const std::string& menuFilePath, + ISearchPath* searchPath, + MemoryManager* memory, + IAssetLoadingManager* manager, + menu::MenuAssetZoneState* zoneState, + MenuConversionZoneState* conversionState, + std::vector& menus, + std::vector& menuListDependencies) { const auto alreadyLoadedMenuFile = conversionState->m_menus_by_filename.find(menuFilePath); if (alreadyLoadedMenuFile != conversionState->m_menus_by_filename.end()) @@ -164,7 +189,8 @@ void LoadMenuFileFromQueue(const std::string& menuFilePath, ISearchPath* searchP const auto menuFileResult = MenuLoader::ParseMenuFile(menuFilePath, searchPath, zoneState); if (menuFileResult) { - MenuLoader::ProcessParsedResults(menuFilePath, searchPath, memory, manager, menuFileResult.get(), zoneState, conversionState, menus, menuListDependencies); + MenuLoader::ProcessParsedResults( + menuFilePath, searchPath, memory, manager, menuFileResult.get(), zoneState, conversionState, menus, menuListDependencies); if (!menuFileResult->m_menus_to_load.empty()) std::cout << "WARNING: Menu file has menus to load even though it is not a menu list, ignoring: \"" << menuFilePath << "\"\n"; } @@ -172,7 +198,8 @@ void LoadMenuFileFromQueue(const std::string& menuFilePath, ISearchPath* searchP std::cerr << "Could not read menu file \"" << menuFilePath << "\"\n"; } -bool AssetLoaderMenuList::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderMenuList::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { std::vector menus; std::vector menuListDependencies; @@ -184,7 +211,7 @@ bool AssetLoaderMenuList::LoadFromRaw(const std::string& assetName, ISearchPath* if (!BuildMenuFileQueue(menuLoadQueue, assetName, searchPath, memory, manager, zoneState, conversionState, menus, menuListDependencies)) return false; - while(!menuLoadQueue.empty()) + while (!menuLoadQueue.empty()) { const auto& menuFileToLoad = menuLoadQueue.front(); diff --git a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMenuList.h b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMenuList.h index 3aa870410..a721acc2c 100644 --- a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMenuList.h +++ b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMenuList.h @@ -1,8 +1,8 @@ #pragma once -#include "Game/IW5/IW5.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/IW5/IW5.h" #include "SearchPath/ISearchPath.h" namespace IW5 @@ -12,7 +12,8 @@ namespace IW5 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; void FinalizeAssetsForZone(AssetLoadingContext* context) const override; }; -} +} // namespace IW5 diff --git a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderRawFile.cpp b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderRawFile.cpp index 41912d7a2..3f400af59 100644 --- a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderRawFile.cpp +++ b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderRawFile.cpp @@ -1,13 +1,13 @@ #include "AssetLoaderRawFile.h" +#include "Game/IW5/IW5.h" +#include "Pool/GlobalAssetPool.h" + #include #include #include #include -#include "Game/IW5/IW5.h" -#include "Pool/GlobalAssetPool.h" - using namespace IW5; void* AssetLoaderRawFile::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) @@ -23,7 +23,8 @@ bool AssetLoaderRawFile::CanLoadFromRaw() const return true; } -bool AssetLoaderRawFile::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderRawFile::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto file = searchPath->Open(assetName); if (!file.IsOpen()) diff --git a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderRawFile.h b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderRawFile.h index da6fe90a0..16df945a3 100644 --- a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderRawFile.h +++ b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderRawFile.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW5/IW5.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/IW5/IW5.h" #include "SearchPath/ISearchPath.h" namespace IW5 @@ -13,6 +13,7 @@ namespace IW5 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace IW5 diff --git a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderStringTable.cpp b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderStringTable.cpp index 95171e8fd..9c9eb6e24 100644 --- a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderStringTable.cpp +++ b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderStringTable.cpp @@ -1,13 +1,13 @@ #include "AssetLoaderStringTable.h" -#include - -#include "ObjLoading.h" #include "Csv/CsvStream.h" #include "Game/IW5/CommonIW5.h" #include "Game/IW5/IW5.h" +#include "ObjLoading.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace IW5; void* AssetLoaderStringTable::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) @@ -23,7 +23,8 @@ bool AssetLoaderStringTable::CanLoadFromRaw() const return true; } -bool AssetLoaderStringTable::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderStringTable::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto file = searchPath->Open(assetName); if (!file.IsOpen()) diff --git a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderStringTable.h b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderStringTable.h index 428d03f3f..334ba70da 100644 --- a/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderStringTable.h +++ b/src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderStringTable.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/IW5/IW5.h" #include "AssetLoading/BasicAssetLoader.h" +#include "Game/IW5/IW5.h" #include "SearchPath/ISearchPath.h" namespace IW5 @@ -11,6 +11,7 @@ namespace IW5 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace IW5 diff --git a/src/ObjLoading/Game/IW5/InfoString/InfoStringToStructConverter.cpp b/src/ObjLoading/Game/IW5/InfoString/InfoStringToStructConverter.cpp index 3233a77ee..b68d2bc9f 100644 --- a/src/ObjLoading/Game/IW5/InfoString/InfoStringToStructConverter.cpp +++ b/src/ObjLoading/Game/IW5/InfoString/InfoStringToStructConverter.cpp @@ -1,4 +1,3 @@ #include "InfoStringToStructConverter.h" using namespace IW5; - diff --git a/src/ObjLoading/Game/IW5/InfoString/InfoStringToStructConverter.h b/src/ObjLoading/Game/IW5/InfoString/InfoStringToStructConverter.h index d9e957bb8..f2026e183 100644 --- a/src/ObjLoading/Game/IW5/InfoString/InfoStringToStructConverter.h +++ b/src/ObjLoading/Game/IW5/InfoString/InfoStringToStructConverter.h @@ -1,7 +1,7 @@ #pragma once #include "AssetLoading/IAssetLoadingManager.h" -#include "InfoString/InfoStringToStructConverterBase.h" #include "Game/IW5/IW5.h" +#include "InfoString/InfoStringToStructConverterBase.h" namespace IW5 { @@ -18,8 +18,13 @@ namespace IW5 bool ConvertBaseField(const cspField_t& field, const std::string& value); public: - InfoStringToStructConverter(const InfoString& infoString, void* structure, ZoneScriptStrings& zoneScriptStrings, MemoryManager* memory, IAssetLoadingManager* manager, const cspField_t* fields, - size_t fieldCount); + InfoStringToStructConverter(const InfoString& infoString, + void* structure, + ZoneScriptStrings& zoneScriptStrings, + MemoryManager* memory, + IAssetLoadingManager* manager, + const cspField_t* fields, + size_t fieldCount); bool Convert() override; }; -} \ No newline at end of file +} // namespace IW5 diff --git a/src/ObjLoading/Game/IW5/Menu/MenuConversionZoneStateIW5.h b/src/ObjLoading/Game/IW5/Menu/MenuConversionZoneStateIW5.h index 890c1dc63..214a6f6ea 100644 --- a/src/ObjLoading/Game/IW5/Menu/MenuConversionZoneStateIW5.h +++ b/src/ObjLoading/Game/IW5/Menu/MenuConversionZoneStateIW5.h @@ -1,10 +1,10 @@ #pragma once -#include - #include "AssetLoading/IZoneAssetLoaderState.h" #include "Game/IW5/IW5.h" +#include + namespace IW5 { class MenuConversionZoneState final : public IZoneAssetLoaderState @@ -36,4 +36,4 @@ namespace IW5 void FinalizeSupportingData() const; }; -} +} // namespace IW5 diff --git a/src/ObjLoading/Game/IW5/Menu/MenuConverterIW5.cpp b/src/ObjLoading/Game/IW5/Menu/MenuConverterIW5.cpp index 1cde69a07..2da2a9da3 100644 --- a/src/ObjLoading/Game/IW5/Menu/MenuConverterIW5.cpp +++ b/src/ObjLoading/Game/IW5/Menu/MenuConverterIW5.cpp @@ -1,21 +1,21 @@ #include "MenuConverterIW5.h" -#include -#include -#include - -#include "MenuConversionZoneStateIW5.h" -#include "Utils/ClassUtils.h" #include "Menu/AbstractMenuConverter.h" -#include "Parsing/Menu/MenuAssetZoneState.h" +#include "MenuConversionZoneStateIW5.h" #include "Parsing/Menu/Domain/EventHandler/CommonEventHandlerCondition.h" #include "Parsing/Menu/Domain/EventHandler/CommonEventHandlerScript.h" #include "Parsing/Menu/Domain/EventHandler/CommonEventHandlerSetLocalVar.h" #include "Parsing/Menu/Domain/Expression/CommonExpressionBaseFunctionCall.h" #include "Parsing/Menu/Domain/Expression/CommonExpressionCustomFunctionCall.h" +#include "Parsing/Menu/MenuAssetZoneState.h" #include "Parsing/Simple/Expression/SimpleExpressionBinaryOperation.h" #include "Parsing/Simple/Expression/SimpleExpressionConditionalOperator.h" #include "Parsing/Simple/Expression/SimpleExpressionUnaryOperation.h" +#include "Utils/ClassUtils.h" + +#include +#include +#include using namespace IW5; using namespace menu; @@ -35,7 +35,7 @@ namespace IW5 static_cast(rect.w), static_cast(rect.h), static_cast(rect.horizontalAlign), - static_cast(rect.verticalAlign) + static_cast(rect.verticalAlign), }; } @@ -47,7 +47,7 @@ namespace IW5 static_cast(rect.w), static_cast(rect.h), static_cast(rect.horizontalAlign), - static_cast(rect.verticalAlign) + static_cast(rect.verticalAlign), }; } @@ -101,7 +101,10 @@ namespace IW5 return static_cast(soundDependency->m_ptr); } - bool HandleStaticDvarFunctionCall(Statement_s* gameStatement, std::vector& entries, const CommonExpressionBaseFunctionCall* functionCall, const int targetFunctionIndex) const + bool HandleStaticDvarFunctionCall(Statement_s* gameStatement, + std::vector& entries, + const CommonExpressionBaseFunctionCall* functionCall, + const int targetFunctionIndex) const { if (functionCall->m_args.size() != 1) return false; @@ -122,7 +125,8 @@ namespace IW5 expressionEntry staticDvarIndexEntry{}; staticDvarIndexEntry.type = EET_OPERAND; staticDvarIndexEntry.data.operand.dataType = VAL_INT; - staticDvarIndexEntry.data.operand.internals.intVal = static_cast(m_conversion_zone_state->AddStaticDvar(*staticDvarNameExpressionValue.m_string_value)); + staticDvarIndexEntry.data.operand.internals.intVal = + static_cast(m_conversion_zone_state->AddStaticDvar(*staticDvarNameExpressionValue.m_string_value)); entries.emplace_back(staticDvarIndexEntry); expressionEntry parenRight{}; @@ -135,7 +139,10 @@ namespace IW5 return true; } - bool HandleSpecialBaseFunctionCall(Statement_s* gameStatement, std::vector& entries, const CommonExpressionBaseFunctionCall* functionCall, const CommonMenuDef* menu, + bool HandleSpecialBaseFunctionCall(Statement_s* gameStatement, + std::vector& entries, + const CommonExpressionBaseFunctionCall* functionCall, + const CommonMenuDef* menu, const CommonItemDef* item) const { switch (functionCall->m_function_index) @@ -155,7 +162,10 @@ namespace IW5 return false; } - void ConvertExpressionEntryBaseFunctionCall(Statement_s* gameStatement, std::vector& entries, const CommonExpressionBaseFunctionCall* functionCall, const CommonMenuDef* menu, + void ConvertExpressionEntryBaseFunctionCall(Statement_s* gameStatement, + std::vector& entries, + const CommonExpressionBaseFunctionCall* functionCall, + const CommonMenuDef* menu, const CommonItemDef* item) const { if (!HandleSpecialBaseFunctionCall(gameStatement, entries, functionCall, menu, item)) @@ -188,7 +198,9 @@ namespace IW5 } } - void ConvertExpressionEntryCustomFunctionCall(Statement_s* gameStatement, std::vector& entries, const CommonExpressionCustomFunctionCall* functionCall, + void ConvertExpressionEntryCustomFunctionCall(Statement_s* gameStatement, + std::vector& entries, + const CommonExpressionCustomFunctionCall* functionCall, const CommonMenuDef* menu, const CommonItemDef* item) const { @@ -216,11 +228,10 @@ namespace IW5 gameStatement->supportingData = m_conversion_zone_state->m_supporting_data; } - constexpr static expressionOperatorType_e UNARY_OPERATION_MAPPING[static_cast(SimpleUnaryOperationId::COUNT)] - { + constexpr static expressionOperatorType_e UNARY_OPERATION_MAPPING[static_cast(SimpleUnaryOperationId::COUNT)]{ OP_NOT, OP_BITWISENOT, - OP_SUBTRACT + OP_SUBTRACT, }; bool IsOperation(const ISimpleExpression* expression) const @@ -231,7 +242,10 @@ namespace IW5 return dynamic_cast(expression) || dynamic_cast(expression); } - void ConvertExpressionEntryUnaryOperation(Statement_s* gameStatement, std::vector& entries, const SimpleExpressionUnaryOperation* unaryOperation, const CommonMenuDef* menu, + void ConvertExpressionEntryUnaryOperation(Statement_s* gameStatement, + std::vector& entries, + const SimpleExpressionUnaryOperation* unaryOperation, + const CommonMenuDef* menu, const CommonItemDef* item) const { assert(static_cast(unaryOperation->m_operation_type->m_id) < static_cast(SimpleUnaryOperationId::COUNT)); @@ -258,8 +272,7 @@ namespace IW5 ConvertExpressionEntry(gameStatement, entries, unaryOperation->m_operand.get(), menu, item); } - constexpr static expressionOperatorType_e BINARY_OPERATION_MAPPING[static_cast(SimpleBinaryOperationId::COUNT)] - { + constexpr static expressionOperatorType_e BINARY_OPERATION_MAPPING[static_cast(SimpleBinaryOperationId::COUNT)]{ OP_ADD, OP_SUBTRACT, OP_MULTIPLY, @@ -276,10 +289,13 @@ namespace IW5 OP_EQUALS, OP_NOTEQUAL, OP_AND, - OP_OR + OP_OR, }; - void ConvertExpressionEntryBinaryOperation(Statement_s* gameStatement, std::vector& entries, const SimpleExpressionBinaryOperation* binaryOperation, const CommonMenuDef* menu, + void ConvertExpressionEntryBinaryOperation(Statement_s* gameStatement, + std::vector& entries, + const SimpleExpressionBinaryOperation* binaryOperation, + const CommonMenuDef* menu, const CommonItemDef* item) const { // Game needs all nested operations to have parenthesis @@ -349,7 +365,11 @@ namespace IW5 entries.emplace_back(entry); } - void ConvertExpressionEntry(Statement_s* gameStatement, std::vector& entries, const ISimpleExpression* expression, const CommonMenuDef* menu, const CommonItemDef* item) const + void ConvertExpressionEntry(Statement_s* gameStatement, + std::vector& entries, + const ISimpleExpression* expression, + const CommonMenuDef* menu, + const CommonItemDef* item) const { if (!m_disable_optimizations && expression->IsStatic()) { @@ -411,7 +431,10 @@ namespace IW5 return statement; } - _NODISCARD Statement_s* ConvertOrApplyStatement(float& staticValue, const ISimpleExpression* expression, const CommonMenuDef* menu, const CommonItemDef* item = nullptr) const + _NODISCARD Statement_s* ConvertOrApplyStatement(float& staticValue, + const ISimpleExpression* expression, + const CommonMenuDef* menu, + const CommonItemDef* item = nullptr) const { if (m_disable_optimizations) return ConvertExpression(expression, menu, item); @@ -439,7 +462,10 @@ namespace IW5 return ConvertExpression(expression, menu, item); } - _NODISCARD Statement_s* ConvertOrApplyStatement(const char*& staticValue, const ISimpleExpression* expression, const CommonMenuDef* menu, const CommonItemDef* item = nullptr) const + _NODISCARD Statement_s* ConvertOrApplyStatement(const char*& staticValue, + const ISimpleExpression* expression, + const CommonMenuDef* menu, + const CommonItemDef* item = nullptr) const { if (m_disable_optimizations) return ConvertExpression(expression, menu, item); @@ -466,7 +492,10 @@ namespace IW5 return ConvertExpression(expression, menu, item); } - _NODISCARD Statement_s* ConvertOrApplyStatement(Material*& staticValue, const ISimpleExpression* expression, const CommonMenuDef* menu, const CommonItemDef* item = nullptr) const + _NODISCARD Statement_s* ConvertOrApplyStatement(Material*& staticValue, + const ISimpleExpression* expression, + const CommonMenuDef* menu, + const CommonItemDef* item = nullptr) const { if (m_disable_optimizations) return ConvertExpression(expression, menu, item); @@ -493,7 +522,10 @@ namespace IW5 return ConvertExpression(expression, menu, item); } - _NODISCARD Statement_s* ConvertVisibleExpression(windowDef_t* window, const ISimpleExpression* expression, const CommonMenuDef* commonMenu, const CommonItemDef* commonItem = nullptr) const + _NODISCARD Statement_s* ConvertVisibleExpression(windowDef_t* window, + const ISimpleExpression* expression, + const CommonMenuDef* commonMenu, + const CommonItemDef* commonItem = nullptr) const { if (expression == nullptr) return nullptr; @@ -504,7 +536,8 @@ namespace IW5 { const auto* staticValue = dynamic_cast(expression); isStatic = staticValue != nullptr; - isTruthy = isStatic && (staticValue->m_type == SimpleExpressionValue::Type::INT || staticValue->m_type == SimpleExpressionValue::Type::DOUBLE) && staticValue->IsTruthy(); + isTruthy = isStatic && (staticValue->m_type == SimpleExpressionValue::Type::INT || staticValue->m_type == SimpleExpressionValue::Type::DOUBLE) + && staticValue->IsTruthy(); } else { @@ -542,7 +575,10 @@ namespace IW5 } } - void ConvertEventHandlerSetLocalVar(std::vector& elements, const CommonEventHandlerSetLocalVar* setLocalVar, const CommonMenuDef* menu, const CommonItemDef* item) const + void ConvertEventHandlerSetLocalVar(std::vector& elements, + const CommonEventHandlerSetLocalVar* setLocalVar, + const CommonMenuDef* menu, + const CommonItemDef* item) const { assert(setLocalVar); if (!setLocalVar) @@ -573,7 +609,9 @@ namespace IW5 elements.push_back(outputHandler); } - void ConvertEventHandlerCondition(std::vector& elements, const CommonEventHandlerCondition* condition, const CommonMenuDef* menu, + void ConvertEventHandlerCondition(std::vector& elements, + const CommonEventHandlerCondition* condition, + const CommonMenuDef* menu, const CommonItemDef* item) const { assert(condition); @@ -613,7 +651,9 @@ namespace IW5 } } - void ConvertEventHandler(std::vector& elements, const ICommonEventHandlerElement* eventHandler, const CommonMenuDef* menu, + void ConvertEventHandler(std::vector& elements, + const ICommonEventHandlerElement* eventHandler, + const CommonMenuDef* menu, const CommonItemDef* item) const { assert(eventHandler); @@ -636,13 +676,17 @@ namespace IW5 } } - void ConvertEventHandlerElements(std::vector& elements, const CommonEventHandlerSet* eventHandlerSet, const CommonMenuDef* menu, const CommonItemDef* item) const + void ConvertEventHandlerElements(std::vector& elements, + const CommonEventHandlerSet* eventHandlerSet, + const CommonMenuDef* menu, + const CommonItemDef* item) const { for (const auto& element : eventHandlerSet->m_elements) ConvertEventHandler(elements, element.get(), menu, item); } - _NODISCARD MenuEventHandlerSet* ConvertEventHandlerSet(const CommonEventHandlerSet* eventHandlerSet, const CommonMenuDef* menu, const CommonItemDef* item = nullptr) const + _NODISCARD MenuEventHandlerSet* + ConvertEventHandlerSet(const CommonEventHandlerSet* eventHandlerSet, const CommonMenuDef* menu, const CommonItemDef* item = nullptr) const { if (!eventHandlerSet) return nullptr; @@ -663,7 +707,8 @@ namespace IW5 return outputSet; } - _NODISCARD ItemKeyHandler* ConvertKeyHandler(const std::multimap>& keyHandlers, const CommonMenuDef* menu, + _NODISCARD ItemKeyHandler* ConvertKeyHandler(const std::multimap>& keyHandlers, + const CommonMenuDef* menu, const CommonItemDef* item = nullptr) const { if (keyHandlers.empty()) @@ -687,7 +732,8 @@ namespace IW5 return output; } - ItemFloatExpression* ConvertFloatExpressions(const CommonItemDef* commonItem, itemDef_s* item, const CommonMenuDef* parentMenu, int& floatExpressionCount) const + ItemFloatExpression* + ConvertFloatExpressions(const CommonItemDef* commonItem, itemDef_s* item, const CommonMenuDef* parentMenu, int& floatExpressionCount) const { struct FloatExpressionLocation { @@ -698,27 +744,42 @@ namespace IW5 unsigned m_static_value_array_size; unsigned m_dynamic_flags_to_set; }; - FloatExpressionLocation locations[] - { - {commonItem->m_rect_x_exp.get(), false, ITEM_FLOATEXP_TGT_RECT_X, &item->window.rectClient.x, 1, 0}, - {commonItem->m_rect_y_exp.get(), false, ITEM_FLOATEXP_TGT_RECT_Y, &item->window.rectClient.y, 1, 0}, - {commonItem->m_rect_w_exp.get(), false, ITEM_FLOATEXP_TGT_RECT_W, &item->window.rectClient.w, 1, 0}, - {commonItem->m_rect_h_exp.get(), false, ITEM_FLOATEXP_TGT_RECT_H, &item->window.rectClient.h, 1, 0}, - {commonItem->m_forecolor_expressions.m_r_exp.get(), false, ITEM_FLOATEXP_TGT_FORECOLOR_R, &item->window.foreColor[0], 1, WINDOW_FLAG_NON_DEFAULT_FORECOLOR}, - {commonItem->m_forecolor_expressions.m_g_exp.get(), false, ITEM_FLOATEXP_TGT_FORECOLOR_G, &item->window.foreColor[1], 1, WINDOW_FLAG_NON_DEFAULT_FORECOLOR}, - {commonItem->m_forecolor_expressions.m_b_exp.get(), false, ITEM_FLOATEXP_TGT_FORECOLOR_B, &item->window.foreColor[2], 1, WINDOW_FLAG_NON_DEFAULT_FORECOLOR}, - {commonItem->m_forecolor_expressions.m_a_exp.get(), false, ITEM_FLOATEXP_TGT_FORECOLOR_A, &item->window.foreColor[3], 1, WINDOW_FLAG_NON_DEFAULT_FORECOLOR}, - {commonItem->m_forecolor_expressions.m_rgb_exp.get(), false, ITEM_FLOATEXP_TGT_FORECOLOR_RGB, &item->window.foreColor[0], 3, WINDOW_FLAG_NON_DEFAULT_FORECOLOR}, - {commonItem->m_glowcolor_expressions.m_r_exp.get(), false, ITEM_FLOATEXP_TGT_GLOWCOLOR_R, &item->glowColor[0], 1, 0}, - {commonItem->m_glowcolor_expressions.m_g_exp.get(), false, ITEM_FLOATEXP_TGT_GLOWCOLOR_G, &item->glowColor[1], 1, 0}, - {commonItem->m_glowcolor_expressions.m_b_exp.get(), false, ITEM_FLOATEXP_TGT_GLOWCOLOR_B, &item->glowColor[2], 1, 0}, - {commonItem->m_glowcolor_expressions.m_a_exp.get(), false, ITEM_FLOATEXP_TGT_GLOWCOLOR_A, &item->glowColor[3], 1, 0}, - {commonItem->m_glowcolor_expressions.m_rgb_exp.get(), false, ITEM_FLOATEXP_TGT_GLOWCOLOR_RGB, &item->glowColor[0], 3, 0}, - {commonItem->m_backcolor_expressions.m_r_exp.get(), false, ITEM_FLOATEXP_TGT_BACKCOLOR_R, &item->window.backColor[0], 1, 0}, - {commonItem->m_backcolor_expressions.m_g_exp.get(), false, ITEM_FLOATEXP_TGT_BACKCOLOR_G, &item->window.backColor[1], 1, 0}, - {commonItem->m_backcolor_expressions.m_b_exp.get(), false, ITEM_FLOATEXP_TGT_BACKCOLOR_B, &item->window.backColor[2], 1, 0}, - {commonItem->m_backcolor_expressions.m_a_exp.get(), false, ITEM_FLOATEXP_TGT_BACKCOLOR_A, &item->window.backColor[3], 1, 0}, - {commonItem->m_backcolor_expressions.m_rgb_exp.get(), false, ITEM_FLOATEXP_TGT_BACKCOLOR_RGB, &item->window.backColor[0], 3, 0}, + + FloatExpressionLocation locations[]{ + {commonItem->m_rect_x_exp.get(), false, ITEM_FLOATEXP_TGT_RECT_X, &item->window.rectClient.x, 1, 0 }, + {commonItem->m_rect_y_exp.get(), false, ITEM_FLOATEXP_TGT_RECT_Y, &item->window.rectClient.y, 1, 0 }, + {commonItem->m_rect_w_exp.get(), false, ITEM_FLOATEXP_TGT_RECT_W, &item->window.rectClient.w, 1, 0 }, + {commonItem->m_rect_h_exp.get(), false, ITEM_FLOATEXP_TGT_RECT_H, &item->window.rectClient.h, 1, 0 }, + {commonItem->m_forecolor_expressions.m_r_exp.get(), + false, ITEM_FLOATEXP_TGT_FORECOLOR_R, + &item->window.foreColor[0], + 1, WINDOW_FLAG_NON_DEFAULT_FORECOLOR}, + {commonItem->m_forecolor_expressions.m_g_exp.get(), + false, ITEM_FLOATEXP_TGT_FORECOLOR_G, + &item->window.foreColor[1], + 1, WINDOW_FLAG_NON_DEFAULT_FORECOLOR}, + {commonItem->m_forecolor_expressions.m_b_exp.get(), + false, ITEM_FLOATEXP_TGT_FORECOLOR_B, + &item->window.foreColor[2], + 1, WINDOW_FLAG_NON_DEFAULT_FORECOLOR}, + {commonItem->m_forecolor_expressions.m_a_exp.get(), + false, ITEM_FLOATEXP_TGT_FORECOLOR_A, + &item->window.foreColor[3], + 1, WINDOW_FLAG_NON_DEFAULT_FORECOLOR}, + {commonItem->m_forecolor_expressions.m_rgb_exp.get(), + false, ITEM_FLOATEXP_TGT_FORECOLOR_RGB, + &item->window.foreColor[0], + 3, WINDOW_FLAG_NON_DEFAULT_FORECOLOR}, + {commonItem->m_glowcolor_expressions.m_r_exp.get(), false, ITEM_FLOATEXP_TGT_GLOWCOLOR_R, &item->glowColor[0], 1, 0 }, + {commonItem->m_glowcolor_expressions.m_g_exp.get(), false, ITEM_FLOATEXP_TGT_GLOWCOLOR_G, &item->glowColor[1], 1, 0 }, + {commonItem->m_glowcolor_expressions.m_b_exp.get(), false, ITEM_FLOATEXP_TGT_GLOWCOLOR_B, &item->glowColor[2], 1, 0 }, + {commonItem->m_glowcolor_expressions.m_a_exp.get(), false, ITEM_FLOATEXP_TGT_GLOWCOLOR_A, &item->glowColor[3], 1, 0 }, + {commonItem->m_glowcolor_expressions.m_rgb_exp.get(), false, ITEM_FLOATEXP_TGT_GLOWCOLOR_RGB, &item->glowColor[0], 3, 0 }, + {commonItem->m_backcolor_expressions.m_r_exp.get(), false, ITEM_FLOATEXP_TGT_BACKCOLOR_R, &item->window.backColor[0], 1, 0 }, + {commonItem->m_backcolor_expressions.m_g_exp.get(), false, ITEM_FLOATEXP_TGT_BACKCOLOR_G, &item->window.backColor[1], 1, 0 }, + {commonItem->m_backcolor_expressions.m_b_exp.get(), false, ITEM_FLOATEXP_TGT_BACKCOLOR_B, &item->window.backColor[2], 1, 0 }, + {commonItem->m_backcolor_expressions.m_a_exp.get(), false, ITEM_FLOATEXP_TGT_BACKCOLOR_A, &item->window.backColor[3], 1, 0 }, + {commonItem->m_backcolor_expressions.m_rgb_exp.get(), false, ITEM_FLOATEXP_TGT_BACKCOLOR_RGB, &item->window.backColor[0], 3, 0 }, }; floatExpressionCount = 0; @@ -832,7 +893,10 @@ namespace IW5 return nullptr; } - _NODISCARD listBoxDef_s* ConvertListBoxFeatures(itemDef_s* item, CommonItemFeaturesListBox* commonListBox, const CommonMenuDef& parentMenu, const CommonItemDef& commonItem) const + _NODISCARD listBoxDef_s* ConvertListBoxFeatures(itemDef_s* item, + CommonItemFeaturesListBox* commonListBox, + const CommonMenuDef& parentMenu, + const CommonItemDef& commonItem) const { if (commonListBox == nullptr) return nullptr; @@ -850,7 +914,8 @@ namespace IW5 listBox->onDoubleClick = ConvertEventHandlerSet(commonListBox->m_on_double_click.get(), &parentMenu, &commonItem); ConvertColor(listBox->selectBorder, commonListBox->m_select_border); listBox->selectIcon = ConvertMaterial(commonListBox->m_select_icon, &parentMenu, &commonItem); - listBox->elementHeightExp = ConvertOrApplyStatement(listBox->elementHeight, commonListBox->m_element_height_expression.get(), &parentMenu, &commonItem); + listBox->elementHeightExp = + ConvertOrApplyStatement(listBox->elementHeight, commonListBox->m_element_height_expression.get(), &parentMenu, &commonItem); listBox->numColumns = static_cast(std::min(std::extent_v, commonListBox->m_columns.size())); for (auto i = 0; i < listBox->numColumns; i++) @@ -868,7 +933,10 @@ namespace IW5 return listBox; } - _NODISCARD editFieldDef_s* ConvertEditFieldFeatures(itemDef_s* item, CommonItemFeaturesEditField* commonEditField, const CommonMenuDef& parentMenu, const CommonItemDef& commonItem) const + _NODISCARD editFieldDef_s* ConvertEditFieldFeatures(itemDef_s* item, + CommonItemFeaturesEditField* commonEditField, + const CommonMenuDef& parentMenu, + const CommonItemDef& commonItem) const { if (commonEditField == nullptr) return nullptr; @@ -887,7 +955,10 @@ namespace IW5 return editField; } - _NODISCARD multiDef_s* ConvertMultiValueFeatures(itemDef_s* item, CommonItemFeaturesMultiValue* commonMultiValue, const CommonMenuDef& parentMenu, const CommonItemDef& commonItem) const + _NODISCARD multiDef_s* ConvertMultiValueFeatures(itemDef_s* item, + CommonItemFeaturesMultiValue* commonMultiValue, + const CommonMenuDef& parentMenu, + const CommonItemDef& commonItem) const { if (commonMultiValue == nullptr) return nullptr; @@ -917,7 +988,10 @@ namespace IW5 return multiValue; } - _NODISCARD newsTickerDef_s* ConvertNewsTickerFeatures(itemDef_s* item, CommonItemFeaturesNewsTicker* commonNewsTicker, const CommonMenuDef& parentMenu, const CommonItemDef& commonItem) const + _NODISCARD newsTickerDef_s* ConvertNewsTickerFeatures(itemDef_s* item, + CommonItemFeaturesNewsTicker* commonNewsTicker, + const CommonMenuDef& parentMenu, + const CommonItemDef& commonItem) const { if (commonNewsTicker == nullptr) return nullptr; @@ -1120,7 +1194,7 @@ namespace IW5 std::vector m_dependencies; }; -} +} // namespace IW5 MenuConverter::MenuConverter(const bool disableOptimizations, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager) : m_disable_optimizations(disableOptimizations), diff --git a/src/ObjLoading/Game/IW5/Menu/MenuConverterIW5.h b/src/ObjLoading/Game/IW5/Menu/MenuConverterIW5.h index 3570ba790..52381782a 100644 --- a/src/ObjLoading/Game/IW5/Menu/MenuConverterIW5.h +++ b/src/ObjLoading/Game/IW5/Menu/MenuConverterIW5.h @@ -1,11 +1,11 @@ #pragma once -#include "Utils/ClassUtils.h" #include "AssetLoading/IAssetLoadingManager.h" #include "Game/IW5/IW5.h" #include "Parsing/Menu/Domain/CommonMenuDef.h" -#include "Utils/MemoryManager.h" #include "SearchPath/ISearchPath.h" +#include "Utils/ClassUtils.h" +#include "Utils/MemoryManager.h" namespace IW5 { @@ -23,4 +23,4 @@ namespace IW5 std::vector& GetDependencies(); _NODISCARD menuDef_t* ConvertMenu(const menu::CommonMenuDef& commonMenu); }; -} +} // namespace IW5 diff --git a/src/ObjLoading/Game/IW5/ObjLoaderIW5.cpp b/src/ObjLoading/Game/IW5/ObjLoaderIW5.cpp index 9766e9845..6073c8328 100644 --- a/src/ObjLoading/Game/IW5/ObjLoaderIW5.cpp +++ b/src/ObjLoading/Game/IW5/ObjLoaderIW5.cpp @@ -1,9 +1,5 @@ #include "ObjLoaderIW5.h" -#include "Game/IW5/GameIW5.h" -#include "Game/IW5/GameAssetPoolIW5.h" -#include "ObjContainer/IPak/IPak.h" -#include "ObjLoading.h" #include "AssetLoaders/AssetLoaderLocalizeEntry.h" #include "AssetLoaders/AssetLoaderMaterial.h" #include "AssetLoaders/AssetLoaderMenuDef.h" @@ -11,16 +7,24 @@ #include "AssetLoaders/AssetLoaderRawFile.h" #include "AssetLoaders/AssetLoaderStringTable.h" #include "AssetLoading/AssetLoadingManager.h" +#include "Game/IW5/GameAssetPoolIW5.h" +#include "Game/IW5/GameIW5.h" #include "Image/Dx9TextureLoader.h" -#include "Image/Texture.h" #include "Image/IwiLoader.h" #include "Image/IwiTypes.h" +#include "Image/Texture.h" +#include "ObjContainer/IPak/IPak.h" +#include "ObjLoading.h" using namespace IW5; ObjLoader::ObjLoader() { -#define REGISTER_ASSET_LOADER(t) {auto l = std::make_unique(); m_asset_loaders_by_type[l->GetHandlingAssetType()] = std::move(l);} +#define REGISTER_ASSET_LOADER(t) \ + { \ + auto l = std::make_unique(); \ + m_asset_loaders_by_type[l->GetHandlingAssetType()] = std::move(l); \ + } #define BASIC_LOADER(assetType, assetClass) BasicAssetLoader REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_PHYSPRESET, PhysPreset)) @@ -75,23 +79,17 @@ bool ObjLoader::SupportsZone(Zone* zone) const bool ObjLoader::IsMpZone(Zone* zone) { - return zone->m_name.compare(0, 3, "mp_") == 0 - || zone->m_name.compare(zone->m_name.length() - 3, 3, "_mp") == 0; + return zone->m_name.compare(0, 3, "mp_") == 0 || zone->m_name.compare(zone->m_name.length() - 3, 3, "_mp") == 0; } bool ObjLoader::IsZmZone(Zone* zone) { - return zone->m_name.compare(0, 3, "zm_") == 0 - || zone->m_name.compare(zone->m_name.length() - 3, 3, "_zm") == 0; + return zone->m_name.compare(0, 3, "zm_") == 0 || zone->m_name.compare(zone->m_name.length() - 3, 3, "_zm") == 0; } -void ObjLoader::LoadReferencedContainersForZone(ISearchPath* searchPath, Zone* zone) const -{ -} +void ObjLoader::LoadReferencedContainersForZone(ISearchPath* searchPath, Zone* zone) const {} -void ObjLoader::UnloadContainersOfZone(Zone* zone) const -{ -} +void ObjLoader::UnloadContainersOfZone(Zone* zone) const {} void ObjLoader::LoadImageFromLoadDef(GfxImage* image, Zone* zone) { diff --git a/src/ObjLoading/Game/IW5/ObjLoaderIW5.h b/src/ObjLoading/Game/IW5/ObjLoaderIW5.h index 680e5454a..e843d1ae6 100644 --- a/src/ObjLoading/Game/IW5/ObjLoaderIW5.h +++ b/src/ObjLoading/Game/IW5/ObjLoaderIW5.h @@ -1,12 +1,12 @@ #pragma once -#include -#include - -#include "IObjLoader.h" #include "AssetLoading/IAssetLoader.h" -#include "SearchPath/ISearchPath.h" #include "Game/IW5/IW5.h" +#include "IObjLoader.h" +#include "SearchPath/ISearchPath.h" + +#include +#include namespace IW5 { @@ -34,4 +34,4 @@ namespace IW5 bool LoadAssetForZone(AssetLoadingContext* context, asset_type_t assetType, const std::string& assetName) const override; void FinalizeAssetsForZone(AssetLoadingContext* context) const override; }; -} +} // namespace IW5 diff --git a/src/ObjLoading/Game/T5/AssetLoaders/AssetLoaderLocalizeEntry.cpp b/src/ObjLoading/Game/T5/AssetLoaders/AssetLoaderLocalizeEntry.cpp index 1884c4325..33f67fafc 100644 --- a/src/ObjLoading/Game/T5/AssetLoaders/AssetLoaderLocalizeEntry.cpp +++ b/src/ObjLoading/Game/T5/AssetLoaders/AssetLoaderLocalizeEntry.cpp @@ -1,10 +1,10 @@ #include "AssetLoaderLocalizeEntry.h" -#include - #include "Localize/LocalizeCommon.h" #include "Parsing/LocalizeFile/LocalizeFileReader.h" +#include + using namespace T5; XAssetInfoGeneric* AssetLoaderLocalizeEntry::LoadFromGlobalAssetPools(const std::string& assetName) const @@ -22,7 +22,8 @@ bool AssetLoaderLocalizeEntry::CanLoadFromRaw() const return true; } -bool AssetLoaderLocalizeEntry::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderLocalizeEntry::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { std::string fileName; { diff --git a/src/ObjLoading/Game/T5/AssetLoaders/AssetLoaderLocalizeEntry.h b/src/ObjLoading/Game/T5/AssetLoaders/AssetLoaderLocalizeEntry.h index 65a2854f8..b311172cc 100644 --- a/src/ObjLoading/Game/T5/AssetLoaders/AssetLoaderLocalizeEntry.h +++ b/src/ObjLoading/Game/T5/AssetLoaders/AssetLoaderLocalizeEntry.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/T5/T5.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/T5/T5.h" #include "SearchPath/ISearchPath.h" namespace T5 @@ -12,6 +12,7 @@ namespace T5 _NODISCARD XAssetInfoGeneric* LoadFromGlobalAssetPools(const std::string& assetName) const override; _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace T5 diff --git a/src/ObjLoading/Game/T5/AssetLoaders/AssetLoaderRawFile.cpp b/src/ObjLoading/Game/T5/AssetLoaders/AssetLoaderRawFile.cpp index 07ab8458d..c241cb84b 100644 --- a/src/ObjLoading/Game/T5/AssetLoaders/AssetLoaderRawFile.cpp +++ b/src/ObjLoading/Game/T5/AssetLoaders/AssetLoaderRawFile.cpp @@ -1,13 +1,13 @@ #include "AssetLoaderRawFile.h" +#include "Game/T5/T5.h" +#include "Pool/GlobalAssetPool.h" + #include #include #include #include -#include "Game/T5/T5.h" -#include "Pool/GlobalAssetPool.h" - using namespace T5; namespace fs = std::filesystem; @@ -25,7 +25,8 @@ bool AssetLoaderRawFile::CanLoadFromRaw() const return true; } -bool AssetLoaderRawFile::LoadGsc(const SearchPathOpenFile& file, const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager) +bool AssetLoaderRawFile::LoadGsc( + const SearchPathOpenFile& file, const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager) { const auto uncompressedBuffer = std::make_unique(static_cast(file.m_length + 1)); file.m_stream->read(uncompressedBuffer.get(), file.m_length); @@ -65,7 +66,7 @@ bool AssetLoaderRawFile::LoadGsc(const SearchPathOpenFile& file, const std::stri const auto compressedSize = compressionBufferSize - zs.avail_out; reinterpret_cast(compressedBuffer)[0] = static_cast(file.m_length + 1); // outLen - reinterpret_cast(compressedBuffer)[1] = compressedSize; // inLen + reinterpret_cast(compressedBuffer)[1] = compressedSize; // inLen auto* rawFile = memory->Create(); rawFile->name = memory->Dup(assetName.c_str()); @@ -77,7 +78,8 @@ bool AssetLoaderRawFile::LoadGsc(const SearchPathOpenFile& file, const std::stri return true; } -bool AssetLoaderRawFile::LoadDefault(const SearchPathOpenFile& file, const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager) +bool AssetLoaderRawFile::LoadDefault( + const SearchPathOpenFile& file, const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager) { auto* rawFile = memory->Create(); rawFile->name = memory->Dup(assetName.c_str()); @@ -95,7 +97,8 @@ bool AssetLoaderRawFile::LoadDefault(const SearchPathOpenFile& file, const std:: return true; } -bool AssetLoaderRawFile::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderRawFile::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto file = searchPath->Open(assetName); if (!file.IsOpen()) @@ -104,7 +107,7 @@ bool AssetLoaderRawFile::LoadFromRaw(const std::string& assetName, ISearchPath* const fs::path rawFilePath(assetName); const auto extension = rawFilePath.extension().string(); - if(extension == ".gsc" ||extension == ".csc") + if (extension == ".gsc" || extension == ".csc") return LoadGsc(file, assetName, searchPath, memory, manager); return LoadDefault(file, assetName, searchPath, memory, manager); diff --git a/src/ObjLoading/Game/T5/AssetLoaders/AssetLoaderRawFile.h b/src/ObjLoading/Game/T5/AssetLoaders/AssetLoaderRawFile.h index 5a32e7a16..572ce670f 100644 --- a/src/ObjLoading/Game/T5/AssetLoaders/AssetLoaderRawFile.h +++ b/src/ObjLoading/Game/T5/AssetLoaders/AssetLoaderRawFile.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/T5/T5.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/T5/T5.h" #include "SearchPath/ISearchPath.h" namespace T5 @@ -10,12 +10,15 @@ namespace T5 { static constexpr size_t COMPRESSED_BUFFER_SIZE_PADDING = 64; - static bool LoadGsc(const SearchPathOpenFile& file, const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager); - static bool LoadDefault(const SearchPathOpenFile& file, const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager); + static bool LoadGsc( + const SearchPathOpenFile& file, const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager); + static bool LoadDefault( + const SearchPathOpenFile& file, const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager); public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace T5 diff --git a/src/ObjLoading/Game/T5/AssetLoaders/AssetLoaderStringTable.cpp b/src/ObjLoading/Game/T5/AssetLoaders/AssetLoaderStringTable.cpp index 986ce669b..8261df565 100644 --- a/src/ObjLoading/Game/T5/AssetLoaders/AssetLoaderStringTable.cpp +++ b/src/ObjLoading/Game/T5/AssetLoaders/AssetLoaderStringTable.cpp @@ -1,12 +1,12 @@ #include "AssetLoaderStringTable.h" -#include - #include "Csv/CsvStream.h" #include "Game/T5/CommonT5.h" #include "Game/T5/T5.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace T5; void* AssetLoaderStringTable::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) @@ -22,7 +22,8 @@ bool AssetLoaderStringTable::CanLoadFromRaw() const return true; } -bool AssetLoaderStringTable::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderStringTable::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto file = searchPath->Open(assetName); if (!file.IsOpen()) @@ -71,14 +72,15 @@ bool AssetLoaderStringTable::LoadFromRaw(const std::string& assetName, ISearchPa } } - - std::sort(&stringTable->cellIndex[0], &stringTable->cellIndex[cellCount - 1], [stringTable, maxCols](const int16_t a, const int16_t b) - { - auto compareResult = stringTable->values[a].hash - stringTable->values[b].hash; - if (compareResult == 0) - compareResult = a % maxCols - b % maxCols; - return compareResult < 0; - }); + std::sort(&stringTable->cellIndex[0], + &stringTable->cellIndex[cellCount - 1], + [stringTable, maxCols](const int16_t a, const int16_t b) + { + auto compareResult = stringTable->values[a].hash - stringTable->values[b].hash; + if (compareResult == 0) + compareResult = a % maxCols - b % maxCols; + return compareResult < 0; + }); } else diff --git a/src/ObjLoading/Game/T5/AssetLoaders/AssetLoaderStringTable.h b/src/ObjLoading/Game/T5/AssetLoaders/AssetLoaderStringTable.h index e80a82be1..963b5599c 100644 --- a/src/ObjLoading/Game/T5/AssetLoaders/AssetLoaderStringTable.h +++ b/src/ObjLoading/Game/T5/AssetLoaders/AssetLoaderStringTable.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/T5/T5.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/T5/T5.h" #include "SearchPath/ISearchPath.h" namespace T5 @@ -11,6 +11,7 @@ namespace T5 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace T5 diff --git a/src/ObjLoading/Game/T5/ObjLoaderT5.cpp b/src/ObjLoading/Game/T5/ObjLoaderT5.cpp index 562710a8a..01a42adbc 100644 --- a/src/ObjLoading/Game/T5/ObjLoaderT5.cpp +++ b/src/ObjLoading/Game/T5/ObjLoaderT5.cpp @@ -1,23 +1,27 @@ #include "ObjLoaderT5.h" -#include "Game/T5/GameT5.h" -#include "Game/T5/GameAssetPoolT5.h" -#include "ObjContainer/IPak/IPak.h" -#include "ObjLoading.h" #include "AssetLoaders/AssetLoaderLocalizeEntry.h" #include "AssetLoaders/AssetLoaderRawFile.h" #include "AssetLoaders/AssetLoaderStringTable.h" #include "AssetLoading/AssetLoadingManager.h" +#include "Game/T5/GameAssetPoolT5.h" +#include "Game/T5/GameT5.h" #include "Image/Dx9TextureLoader.h" -#include "Image/Texture.h" #include "Image/IwiLoader.h" #include "Image/IwiTypes.h" +#include "Image/Texture.h" +#include "ObjContainer/IPak/IPak.h" +#include "ObjLoading.h" using namespace T5; ObjLoader::ObjLoader() { -#define REGISTER_ASSET_LOADER(t) {auto l = std::make_unique(); m_asset_loaders_by_type[l->GetHandlingAssetType()] = std::move(l);} +#define REGISTER_ASSET_LOADER(t) \ + { \ + auto l = std::make_unique(); \ + m_asset_loaders_by_type[l->GetHandlingAssetType()] = std::move(l); \ + } #define BASIC_LOADER(assetType, assetClass) BasicAssetLoader REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_PHYSPRESET, PhysPreset)) @@ -65,23 +69,17 @@ bool ObjLoader::SupportsZone(Zone* zone) const bool ObjLoader::IsMpZone(Zone* zone) { - return zone->m_name.compare(0, 3, "mp_") == 0 - || zone->m_name.compare(zone->m_name.length() - 3, 3, "_mp") == 0; + return zone->m_name.compare(0, 3, "mp_") == 0 || zone->m_name.compare(zone->m_name.length() - 3, 3, "_mp") == 0; } bool ObjLoader::IsZmZone(Zone* zone) { - return zone->m_name.compare(0, 3, "zm_") == 0 - || zone->m_name.compare(zone->m_name.length() - 3, 3, "_zm") == 0; + return zone->m_name.compare(0, 3, "zm_") == 0 || zone->m_name.compare(zone->m_name.length() - 3, 3, "_zm") == 0; } -void ObjLoader::LoadReferencedContainersForZone(ISearchPath* searchPath, Zone* zone) const -{ -} +void ObjLoader::LoadReferencedContainersForZone(ISearchPath* searchPath, Zone* zone) const {} -void ObjLoader::UnloadContainersOfZone(Zone* zone) const -{ -} +void ObjLoader::UnloadContainersOfZone(Zone* zone) const {} void ObjLoader::LoadImageFromLoadDef(GfxImage* image, Zone* zone) { @@ -190,4 +188,4 @@ void ObjLoader::FinalizeAssetsForZone(AssetLoadingContext* context) const { for (const auto& [type, loader] : m_asset_loaders_by_type) loader->FinalizeAssetsForZone(context); -} \ No newline at end of file +} diff --git a/src/ObjLoading/Game/T5/ObjLoaderT5.h b/src/ObjLoading/Game/T5/ObjLoaderT5.h index c7377dde9..bb8d00359 100644 --- a/src/ObjLoading/Game/T5/ObjLoaderT5.h +++ b/src/ObjLoading/Game/T5/ObjLoaderT5.h @@ -1,12 +1,12 @@ #pragma once -#include -#include - -#include "IObjLoader.h" #include "AssetLoading/IAssetLoader.h" -#include "SearchPath/ISearchPath.h" #include "Game/T5/T5.h" +#include "IObjLoader.h" +#include "SearchPath/ISearchPath.h" + +#include +#include namespace T5 { @@ -34,4 +34,4 @@ namespace T5 bool LoadAssetForZone(AssetLoadingContext* context, asset_type_t assetType, const std::string& assetName) const override; void FinalizeAssetsForZone(AssetLoadingContext* context) const override; }; -} +} // namespace T5 diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderFontIcon.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderFontIcon.cpp index ae0682fa0..3fa19b18e 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderFontIcon.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderFontIcon.cpp @@ -1,14 +1,14 @@ #include "AssetLoaderFontIcon.h" -#include -#include -#include - #include "Csv/CsvStream.h" #include "Game/T6/CommonT6.h" #include "Game/T6/T6.h" #include "Pool/GlobalAssetPool.h" +#include +#include +#include + using namespace T6; void* AssetLoaderFontIcon::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) @@ -48,10 +48,12 @@ void AssetLoaderFontIcon::PreprocessRow(std::vector& row) bool AssetLoaderFontIcon::RowIsEmpty(const std::vector& row) { - return std::all_of(row.begin(), row.end(), [](const std::string& cell) - { - return cell.empty(); - }); + return std::all_of(row.begin(), + row.end(), + [](const std::string& cell) + { + return cell.empty(); + }); } bool AssetLoaderFontIcon::ParseInt(int& value, const std::string& str) @@ -90,8 +92,13 @@ bool AssetLoaderFontIcon::ParseHashStr(int& value, const std::string& str) return true; } -bool AssetLoaderFontIcon::ReadIconRow(const std::vector& row, FontIconEntry& icon, const std::string& assetName, const unsigned rowIndex, MemoryManager* memory, - IAssetLoadingManager* manager, std::vector& dependencies) +bool AssetLoaderFontIcon::ReadIconRow(const std::vector& row, + FontIconEntry& icon, + const std::string& assetName, + const unsigned rowIndex, + MemoryManager* memory, + IAssetLoadingManager* manager, + std::vector& dependencies) { if (row.size() < COL_COUNT_ICON) { @@ -105,8 +112,7 @@ bool AssetLoaderFontIcon::ReadIconRow(const std::vector& row, FontI return false; } - if (!ParseFloat(icon.xScale, row[ROW_ICON_XSCALE]) - || !ParseFloat(icon.yScale, row[ROW_ICON_YSCALE])) + if (!ParseFloat(icon.xScale, row[ROW_ICON_XSCALE]) || !ParseFloat(icon.yScale, row[ROW_ICON_YSCALE])) { std::cout << ErrorPrefix(assetName, rowIndex) << "Failed to parse scale" << std::endl; return false; @@ -126,7 +132,11 @@ bool AssetLoaderFontIcon::ReadIconRow(const std::vector& row, FontI return true; } -bool AssetLoaderFontIcon::ReadAliasRow(const std::vector& row, FontIconAlias& alias, const std::string& assetName, const unsigned rowIndex, MemoryManager* memory, +bool AssetLoaderFontIcon::ReadAliasRow(const std::vector& row, + FontIconAlias& alias, + const std::string& assetName, + const unsigned rowIndex, + MemoryManager* memory, IAssetLoadingManager* manager) { if (row.size() < COL_COUNT_ALIAS) @@ -150,7 +160,8 @@ bool AssetLoaderFontIcon::ReadAliasRow(const std::vector& row, Font return true; } -bool AssetLoaderFontIcon::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderFontIcon::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto file = searchPath->Open(assetName); if (!file.IsOpen()) @@ -254,7 +265,7 @@ bool AssetLoaderFontIcon::LoadFromRaw(const std::string& assetName, ISearchPath* } else fontIcon->fontIconAlias = nullptr; - + manager->AddAsset(ASSET_TYPE_FONTICON, assetName, fontIcon); return true; diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderFontIcon.h b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderFontIcon.h index 0ec8f0005..cd995fe78 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderFontIcon.h +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderFontIcon.h @@ -1,14 +1,14 @@ #pragma once -#include -#include -#include - -#include "Game/T6/T6.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/T6/T6.h" #include "SearchPath/ISearchPath.h" +#include +#include +#include + namespace T6 { class AssetLoaderFontIcon final : public BasicAssetLoader @@ -40,13 +40,24 @@ namespace T6 static bool ParseFloat(float& value, const std::string& str); static bool ParseHashStr(int& value, const std::string& str); - static bool ReadIconRow(const std::vector& row, FontIconEntry& icon, const std::string& assetName, unsigned rowIndex, MemoryManager* memory, IAssetLoadingManager* manager, + static bool ReadIconRow(const std::vector& row, + FontIconEntry& icon, + const std::string& assetName, + unsigned rowIndex, + MemoryManager* memory, + IAssetLoadingManager* manager, std::vector& dependencies); - static bool ReadAliasRow(const std::vector& row, FontIconAlias& alias, const std::string& assetName, unsigned rowIndex, MemoryManager* memory, IAssetLoadingManager* manager); + static bool ReadAliasRow(const std::vector& row, + FontIconAlias& alias, + const std::string& assetName, + unsigned rowIndex, + MemoryManager* memory, + IAssetLoadingManager* manager); public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace T6 diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderGfxImage.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderGfxImage.cpp index dcd4ff821..832a10a9c 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderGfxImage.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderGfxImage.cpp @@ -1,15 +1,15 @@ #include "AssetLoaderGfxImage.h" -#include -#include -#include -#include - #include "Game/T6/CommonT6.h" #include "Game/T6/T6.h" #include "Image/IwiLoader.h" #include "Pool/GlobalAssetPool.h" +#include +#include +#include +#include + using namespace T6; void* AssetLoaderGfxImage::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) @@ -25,7 +25,8 @@ bool AssetLoaderGfxImage::CanLoadFromRaw() const return true; } -bool AssetLoaderGfxImage::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderGfxImage::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto fileName = "images/" + assetName + ".iwi"; const auto file = searchPath->Open(fileName); @@ -64,7 +65,7 @@ bool AssetLoaderGfxImage::LoadFromRaw(const std::string& assetName, ISearchPath* image->streamedParts[0].levelSize = static_cast(fileSize); image->streamedParts[0].hash = dataHash & 0x1FFFFFFF; image->streamedPartCount = 1; - + manager->AddAsset(ASSET_TYPE_IMAGE, assetName, image); return true; diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderGfxImage.h b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderGfxImage.h index f88f76853..fa6610dcf 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderGfxImage.h +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderGfxImage.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/T6/T6.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/T6/T6.h" #include "SearchPath/ISearchPath.h" namespace T6 @@ -11,6 +11,7 @@ namespace T6 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace T6 diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderLocalizeEntry.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderLocalizeEntry.cpp index cd838610a..1a2265f71 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderLocalizeEntry.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderLocalizeEntry.cpp @@ -1,11 +1,10 @@ #include "AssetLoaderLocalizeEntry.h" -#include - - #include "Localize/LocalizeCommon.h" #include "Parsing/LocalizeFile/LocalizeFileReader.h" +#include + using namespace T6; XAssetInfoGeneric* AssetLoaderLocalizeEntry::LoadFromGlobalAssetPools(const std::string& assetName) const @@ -23,7 +22,8 @@ bool AssetLoaderLocalizeEntry::CanLoadFromRaw() const return true; } -bool AssetLoaderLocalizeEntry::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderLocalizeEntry::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { std::string fileName; { @@ -39,7 +39,7 @@ bool AssetLoaderLocalizeEntry::LoadFromRaw(const std::string& assetName, ISearch LocalizeFileReader reader(*file.m_stream, assetName, zone->m_language); const auto localizeEntries = reader.ReadLocalizeFile(); - for(const auto& entry : localizeEntries) + for (const auto& entry : localizeEntries) { auto* localizeEntry = memory->Create(); localizeEntry->name = memory->Dup(entry.m_key.c_str()); diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderLocalizeEntry.h b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderLocalizeEntry.h index a20112018..7afa4a7ab 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderLocalizeEntry.h +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderLocalizeEntry.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/T6/T6.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/T6/T6.h" #include "SearchPath/ISearchPath.h" namespace T6 @@ -12,6 +12,7 @@ namespace T6 _NODISCARD XAssetInfoGeneric* LoadFromGlobalAssetPools(const std::string& assetName) const override; _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace T6 diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderPhysConstraints.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderPhysConstraints.cpp index 6af31c517..603d914f3 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderPhysConstraints.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderPhysConstraints.cpp @@ -1,16 +1,16 @@ #include "AssetLoaderPhysConstraints.h" -#include -#include -#include - -#include "Game/T6/ObjConstantsT6.h" -#include "Game/T6/T6.h" #include "Game/T6/InfoString/EnumStrings.h" #include "Game/T6/InfoString/InfoStringToStructConverter.h" #include "Game/T6/InfoString/PhysConstraintsFields.h" +#include "Game/T6/ObjConstantsT6.h" +#include "Game/T6/T6.h" #include "InfoString/InfoString.h" +#include +#include +#include + using namespace T6; namespace T6 @@ -32,17 +32,22 @@ namespace T6 } public: - InfoStringToPhysConstraintsConverter(const InfoString& infoString, PhysConstraints* physConstraints, ZoneScriptStrings& zoneScriptStrings, MemoryManager* memory, IAssetLoadingManager* manager, - const cspField_t* fields, const size_t fieldCount) + InfoStringToPhysConstraintsConverter(const InfoString& infoString, + PhysConstraints* physConstraints, + ZoneScriptStrings& zoneScriptStrings, + MemoryManager* memory, + IAssetLoadingManager* manager, + const cspField_t* fields, + const size_t fieldCount) : InfoStringToStructConverter(infoString, physConstraints, zoneScriptStrings, memory, manager, fields, fieldCount) { } }; -} +} // namespace T6 void AssetLoaderPhysConstraints::CalculatePhysConstraintsFields(PhysConstraints* physConstraints, Zone* zone) { - for(auto& constraint : physConstraints->data) + for (auto& constraint : physConstraints->data) { constraint.targetname = zone->m_script_strings.AddOrGetScriptString(""); constraint.target_ent1 = zone->m_script_strings.AddOrGetScriptString(""); @@ -71,12 +76,14 @@ void AssetLoaderPhysConstraints::CalculatePhysConstraintsFields(PhysConstraints* } } -bool AssetLoaderPhysConstraints::LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) +bool AssetLoaderPhysConstraints::LoadFromInfoString( + const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) { auto* physConstraints = memory->Create(); memset(physConstraints, 0, sizeof(PhysConstraints)); - InfoStringToPhysConstraintsConverter converter(infoString, physConstraints, zone->m_script_strings, memory, manager, phys_constraints_fields, std::extent::value); + InfoStringToPhysConstraintsConverter converter( + infoString, physConstraints, zone->m_script_strings, memory, manager, phys_constraints_fields, std::extent::value); if (!converter.Convert()) { std::cout << "Failed to parse phys constraints: \"" << assetName << "\"" << std::endl; @@ -106,7 +113,8 @@ bool AssetLoaderPhysConstraints::CanLoadFromGdt() const return true; } -bool AssetLoaderPhysConstraints::LoadFromGdt(const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderPhysConstraints::LoadFromGdt( + const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { auto* gdtEntry = gdtQueryable->GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_PHYS_CONSTRAINTS, assetName); if (gdtEntry == nullptr) @@ -127,7 +135,8 @@ bool AssetLoaderPhysConstraints::CanLoadFromRaw() const return true; } -bool AssetLoaderPhysConstraints::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderPhysConstraints::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto fileName = "physconstraints/" + assetName; const auto file = searchPath->Open(fileName); diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderPhysConstraints.h b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderPhysConstraints.h index 8c5176d4f..9064e1168 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderPhysConstraints.h +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderPhysConstraints.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/T6/T6.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/T6/T6.h" #include "InfoString/InfoString.h" #include "SearchPath/ISearchPath.h" @@ -11,13 +11,16 @@ namespace T6 { static void CalculatePhysConstraintsFields(PhysConstraints* physConstraints, Zone* zone); - static bool LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone); + static bool + LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone); public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromGdt() const override; - bool LoadFromGdt(const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool LoadFromGdt( + const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace T6 diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderPhysPreset.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderPhysPreset.cpp index 26aae9762..1b0100fb4 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderPhysPreset.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderPhysPreset.cpp @@ -1,17 +1,17 @@ #include "AssetLoaderPhysPreset.h" +#include "Game/T6/InfoString/InfoStringToStructConverter.h" +#include "Game/T6/InfoString/PhysPresetFields.h" +#include "Game/T6/ObjConstantsT6.h" +#include "Game/T6/T6.h" +#include "InfoString/InfoString.h" + #include +#include #include #include -#include #include -#include "Game/T6/ObjConstantsT6.h" -#include "Game/T6/T6.h" -#include "Game/T6/InfoString/InfoStringToStructConverter.h" -#include "Game/T6/InfoString/PhysPresetFields.h" -#include "InfoString/InfoString.h" - using namespace T6; namespace T6 @@ -26,13 +26,18 @@ namespace T6 } public: - InfoStringToPhysPresetConverter(const InfoString& infoString, PhysPresetInfo* physPreset, ZoneScriptStrings& zoneScriptStrings, MemoryManager* memory, IAssetLoadingManager* manager, - const cspField_t* fields, const size_t fieldCount) + InfoStringToPhysPresetConverter(const InfoString& infoString, + PhysPresetInfo* physPreset, + ZoneScriptStrings& zoneScriptStrings, + MemoryManager* memory, + IAssetLoadingManager* manager, + const cspField_t* fields, + const size_t fieldCount) : InfoStringToStructConverter(infoString, physPreset, zoneScriptStrings, memory, manager, fields, fieldCount) { } }; -} +} // namespace T6 void AssetLoaderPhysPreset::CopyFromPhysPresetInfo(const PhysPresetInfo* physPresetInfo, PhysPreset* physPreset) { @@ -55,11 +60,13 @@ void AssetLoaderPhysPreset::CopyFromPhysPresetInfo(const PhysPresetInfo* physPre physPreset->buoyancyBoxMax = physPresetInfo->buoyancyBoxMax; } -bool AssetLoaderPhysPreset::LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) +bool AssetLoaderPhysPreset::LoadFromInfoString( + const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) { const auto presetInfo = std::make_unique(); memset(presetInfo.get(), 0, sizeof(PhysPresetInfo)); - InfoStringToPhysPresetConverter converter(infoString, presetInfo.get(), zone->m_script_strings, memory, manager, phys_preset_fields, std::extent::value); + InfoStringToPhysPresetConverter converter( + infoString, presetInfo.get(), zone->m_script_strings, memory, manager, phys_preset_fields, std::extent::value); if (!converter.Convert()) { std::cout << "Failed to parse phys preset: \"" << assetName << "\"" << std::endl; @@ -89,7 +96,8 @@ bool AssetLoaderPhysPreset::CanLoadFromGdt() const return true; } -bool AssetLoaderPhysPreset::LoadFromGdt(const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderPhysPreset::LoadFromGdt( + const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { auto* gdtEntry = gdtQueryable->GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_PHYS_PRESET, assetName); if (gdtEntry == nullptr) @@ -110,7 +118,8 @@ bool AssetLoaderPhysPreset::CanLoadFromRaw() const return true; } -bool AssetLoaderPhysPreset::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderPhysPreset::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto fileName = "physic/" + assetName; const auto file = searchPath->Open(fileName); diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderPhysPreset.h b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderPhysPreset.h index 79bcb672e..3483874e9 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderPhysPreset.h +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderPhysPreset.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/T6/T6.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/T6/T6.h" #include "InfoString/InfoString.h" #include "SearchPath/ISearchPath.h" @@ -11,13 +11,16 @@ namespace T6 { static void CopyFromPhysPresetInfo(const PhysPresetInfo* physPresetInfo, PhysPreset* physPreset); - static bool LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone); + static bool + LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone); public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromGdt() const override; - bool LoadFromGdt(const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool LoadFromGdt( + const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace T6 diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderQdb.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderQdb.cpp index 5508d459b..83f245959 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderQdb.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderQdb.cpp @@ -1,10 +1,10 @@ #include "AssetLoaderQdb.h" -#include - #include "Game/T6/T6.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace T6; void* AssetLoaderQdb::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderQdb.h b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderQdb.h index 5a4ea3558..af4c5b595 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderQdb.h +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderQdb.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/T6/T6.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/T6/T6.h" #include "SearchPath/ISearchPath.h" namespace T6 @@ -11,6 +11,7 @@ namespace T6 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace T6 diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderRawFile.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderRawFile.cpp index e4ce97897..559f339b1 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderRawFile.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderRawFile.cpp @@ -1,10 +1,10 @@ #include "AssetLoaderRawFile.h" -#include - #include "Game/T6/T6.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace T6; void* AssetLoaderRawFile::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) @@ -20,7 +20,8 @@ bool AssetLoaderRawFile::CanLoadFromRaw() const return true; } -bool AssetLoaderRawFile::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderRawFile::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto file = searchPath->Open(assetName); if (!file.IsOpen()) diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderRawFile.h b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderRawFile.h index f233aecf3..d4083e5d3 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderRawFile.h +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderRawFile.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/T6/T6.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/T6/T6.h" #include "SearchPath/ISearchPath.h" namespace T6 @@ -11,6 +11,7 @@ namespace T6 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace T6 diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderScriptParseTree.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderScriptParseTree.cpp index eeaffa417..6e5c4c98b 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderScriptParseTree.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderScriptParseTree.cpp @@ -1,10 +1,10 @@ #include "AssetLoaderScriptParseTree.h" -#include - #include "Game/T6/T6.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace T6; void* AssetLoaderScriptParseTree::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) @@ -20,7 +20,8 @@ bool AssetLoaderScriptParseTree::CanLoadFromRaw() const return true; } -bool AssetLoaderScriptParseTree::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderScriptParseTree::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto file = searchPath->Open(assetName); if (!file.IsOpen()) diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderScriptParseTree.h b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderScriptParseTree.h index 6092b6a82..61325828d 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderScriptParseTree.h +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderScriptParseTree.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/T6/T6.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/T6/T6.h" #include "SearchPath/ISearchPath.h" namespace T6 @@ -11,6 +11,7 @@ namespace T6 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace T6 diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderSlug.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderSlug.cpp index b1d425555..b364fa51c 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderSlug.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderSlug.cpp @@ -1,10 +1,10 @@ #include "AssetLoaderSlug.h" -#include - #include "Game/T6/T6.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace T6; void* AssetLoaderSlug::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderSlug.h b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderSlug.h index 83f2d030e..75ccd3539 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderSlug.h +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderSlug.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/T6/T6.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/T6/T6.h" #include "SearchPath/ISearchPath.h" namespace T6 @@ -11,6 +11,7 @@ namespace T6 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace T6 diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderStringTable.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderStringTable.cpp index a1acde615..150431f1d 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderStringTable.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderStringTable.cpp @@ -1,12 +1,12 @@ #include "AssetLoaderStringTable.h" -#include - #include "Csv/CsvStream.h" #include "Game/T6/CommonT6.h" #include "Game/T6/T6.h" #include "Pool/GlobalAssetPool.h" +#include + using namespace T6; void* AssetLoaderStringTable::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) @@ -22,7 +22,8 @@ bool AssetLoaderStringTable::CanLoadFromRaw() const return true; } -bool AssetLoaderStringTable::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderStringTable::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto file = searchPath->Open(assetName); if (!file.IsOpen()) @@ -71,13 +72,15 @@ bool AssetLoaderStringTable::LoadFromRaw(const std::string& assetName, ISearchPa } } - std::sort(&stringTable->cellIndex[0], &stringTable->cellIndex[cellCount - 1], [stringTable, maxCols](const int16_t a, const int16_t b) - { - auto compareResult = stringTable->values[a].hash - stringTable->values[b].hash; - if (compareResult == 0) - compareResult = a % maxCols - b % maxCols; - return compareResult < 0; - }); + std::sort(&stringTable->cellIndex[0], + &stringTable->cellIndex[cellCount - 1], + [stringTable, maxCols](const int16_t a, const int16_t b) + { + auto compareResult = stringTable->values[a].hash - stringTable->values[b].hash; + if (compareResult == 0) + compareResult = a % maxCols - b % maxCols; + return compareResult < 0; + }); } else diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderStringTable.h b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderStringTable.h index 40be6fafd..d6b58ae9b 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderStringTable.h +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderStringTable.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/T6/T6.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/T6/T6.h" #include "SearchPath/ISearchPath.h" namespace T6 @@ -11,6 +11,7 @@ namespace T6 public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace T6 diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderTracer.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderTracer.cpp index d786d25e0..99d7e8209 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderTracer.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderTracer.cpp @@ -1,16 +1,16 @@ #include "AssetLoaderTracer.h" -#include -#include -#include - -#include "Game/T6/ObjConstantsT6.h" -#include "Game/T6/T6.h" #include "Game/T6/InfoString/EnumStrings.h" #include "Game/T6/InfoString/InfoStringToStructConverter.h" #include "Game/T6/InfoString/TracerFields.h" +#include "Game/T6/ObjConstantsT6.h" +#include "Game/T6/T6.h" #include "InfoString/InfoString.h" +#include +#include +#include + using namespace T6; namespace T6 @@ -33,20 +33,27 @@ namespace T6 } public: - InfoStringToTracerConverter(const InfoString& infoString, TracerDef* tracer, ZoneScriptStrings& zoneScriptStrings, MemoryManager* memory, IAssetLoadingManager* manager, - const cspField_t* fields, const size_t fieldCount) + InfoStringToTracerConverter(const InfoString& infoString, + TracerDef* tracer, + ZoneScriptStrings& zoneScriptStrings, + MemoryManager* memory, + IAssetLoadingManager* manager, + const cspField_t* fields, + const size_t fieldCount) : InfoStringToStructConverter(infoString, tracer, zoneScriptStrings, memory, manager, fields, fieldCount) { } }; -} +} // namespace T6 -bool AssetLoaderTracer::LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) +bool AssetLoaderTracer::LoadFromInfoString( + const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) { auto* tracer = memory->Create(); memset(tracer, 0, sizeof(TracerDef)); - InfoStringToTracerConverter converter(infoString, tracer, zone->m_script_strings, memory, manager, tracer_fields, std::extent::value); + InfoStringToTracerConverter converter( + infoString, tracer, zone->m_script_strings, memory, manager, tracer_fields, std::extent::value); if (!converter.Convert()) { std::cout << "Failed to parse tracer: \"" << assetName << "\"" << std::endl; @@ -73,7 +80,8 @@ bool AssetLoaderTracer::CanLoadFromGdt() const return true; } -bool AssetLoaderTracer::LoadFromGdt(const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderTracer::LoadFromGdt( + const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { auto* gdtEntry = gdtQueryable->GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_TRACER, assetName); if (gdtEntry == nullptr) @@ -94,7 +102,8 @@ bool AssetLoaderTracer::CanLoadFromRaw() const return true; } -bool AssetLoaderTracer::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderTracer::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto fileName = "tracer/" + assetName; const auto file = searchPath->Open(fileName); diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderTracer.h b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderTracer.h index 18a18623a..323c2ee98 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderTracer.h +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderTracer.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/T6/T6.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/T6/T6.h" #include "InfoString/InfoString.h" #include "SearchPath/ISearchPath.h" @@ -9,13 +9,16 @@ namespace T6 { class AssetLoaderTracer final : public BasicAssetLoader { - static bool LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone); + static bool + LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone); public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromGdt() const override; - bool LoadFromGdt(const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool LoadFromGdt( + const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace T6 diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderVehicle.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderVehicle.cpp index 25778260e..bd51f0a78 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderVehicle.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderVehicle.cpp @@ -1,16 +1,16 @@ #include "AssetLoaderVehicle.h" -#include -#include - -#include "Game/T6/ObjConstantsT6.h" -#include "Game/T6/T6.h" #include "Game/T6/InfoString/EnumStrings.h" #include "Game/T6/InfoString/InfoStringToStructConverter.h" #include "Game/T6/InfoString/VehicleFields.h" +#include "Game/T6/ObjConstantsT6.h" +#include "Game/T6/T6.h" #include "InfoString/InfoString.h" #include "Pool/GlobalAssetPool.h" +#include +#include + using namespace T6; namespace T6 @@ -32,58 +32,58 @@ namespace T6 return ConvertEnumInt(value, field.iOffset, s_tractionTypeNames, std::extent::value); case VFT_MPH_TO_INCHES_PER_SECOND: - { - char* endPtr; - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = strtof(value.c_str(), &endPtr) * 17.6f; - - if (endPtr != &value[value.size()]) - { - std::cout << "Failed to parse value \"" << value << "\" as mph" << std::endl; - return false; - } + { + char* endPtr; + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = strtof(value.c_str(), &endPtr) * 17.6f; - return true; + if (endPtr != &value[value.size()]) + { + std::cout << "Failed to parse value \"" << value << "\" as mph" << std::endl; + return false; } + return true; + } + case VFT_POUNDS_TO_GAME_MASS: + { + char* endPtr; + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = strtof(value.c_str(), &endPtr) * 0.001f; + + if (endPtr != &value[value.size()]) { - char* endPtr; - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = strtof(value.c_str(), &endPtr) * 0.001f; + std::cout << "Failed to parse value \"" << value << "\" as pounds" << std::endl; + return false; + } - if (endPtr != &value[value.size()]) - { - std::cout << "Failed to parse value \"" << value << "\" as pounds" << std::endl; - return false; - } + return true; + } + case VFT_TEAM: + { + if (value == "axis") + { + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = TEAM_AXIS; return true; } - case VFT_TEAM: + if (value == "allies") { - if (value == "axis") - { - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = TEAM_AXIS; - return true; - } - - if (value == "allies") - { - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = TEAM_ALLIES; - return true; - } - - if (value == "neutral") - { - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = TEAM_FOUR; - return true; - } - - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = TEAM_BAD; - std::cout << "Failed to parse value \"" << value << "\" as team" << std::endl; - return false; + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = TEAM_ALLIES; + return true; + } + + if (value == "neutral") + { + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = TEAM_FOUR; + return true; } + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = TEAM_BAD; + std::cout << "Failed to parse value \"" << value << "\" as team" << std::endl; + return false; + } + case VFT_KEY_BINDING: case VFT_GRAPH: case VFT_WIIUCONTROLOVERRIDE: @@ -95,20 +95,27 @@ namespace T6 } public: - InfoStringToVehicleConverter(const InfoString& infoString, VehicleDef* vehicleDef, ZoneScriptStrings& zoneScriptStrings, MemoryManager* memory, IAssetLoadingManager* manager, - const cspField_t* fields, const size_t fieldCount) + InfoStringToVehicleConverter(const InfoString& infoString, + VehicleDef* vehicleDef, + ZoneScriptStrings& zoneScriptStrings, + MemoryManager* memory, + IAssetLoadingManager* manager, + const cspField_t* fields, + const size_t fieldCount) : InfoStringToStructConverter(infoString, vehicleDef, zoneScriptStrings, memory, manager, fields, fieldCount) { } }; -} +} // namespace T6 -bool AssetLoaderVehicle::LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) +bool AssetLoaderVehicle::LoadFromInfoString( + const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) { auto* vehicleDef = memory->Create(); memset(vehicleDef, 0, sizeof(VehicleDef)); - InfoStringToVehicleConverter converter(infoString, vehicleDef, zone->m_script_strings, memory, manager, vehicle_fields, std::extent::value); + InfoStringToVehicleConverter converter( + infoString, vehicleDef, zone->m_script_strings, memory, manager, vehicle_fields, std::extent::value); if (!converter.Convert()) { std::cout << "Failed to parse vehicle: \"" << assetName << "\"" << std::endl; @@ -135,7 +142,8 @@ bool AssetLoaderVehicle::CanLoadFromGdt() const return true; } -bool AssetLoaderVehicle::LoadFromGdt(const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderVehicle::LoadFromGdt( + const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { auto* gdtEntry = gdtQueryable->GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_VEHICLE, assetName); if (gdtEntry == nullptr) @@ -156,7 +164,8 @@ bool AssetLoaderVehicle::CanLoadFromRaw() const return true; } -bool AssetLoaderVehicle::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderVehicle::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto fileName = "vehicles/" + assetName; const auto file = searchPath->Open(fileName); diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderVehicle.h b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderVehicle.h index 360562588..1f91a42a4 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderVehicle.h +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderVehicle.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/T6/T6.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/T6/T6.h" #include "InfoString/InfoString.h" #include "SearchPath/ISearchPath.h" @@ -9,13 +9,16 @@ namespace T6 { class AssetLoaderVehicle final : public BasicAssetLoader { - static bool LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone); + static bool + LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone); public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromGdt() const override; - bool LoadFromGdt(const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool LoadFromGdt( + const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace T6 diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeapon.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeapon.cpp index ed7fcf9a8..59d1638de 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeapon.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeapon.cpp @@ -1,18 +1,17 @@ #include "AssetLoaderWeapon.h" -#include -#include -#include - - #include "AssetLoaderWeaponAttachmentUnique.h" -#include "Utils/ClassUtils.h" -#include "Game/T6/ObjConstantsT6.h" -#include "Game/T6/T6.h" #include "Game/T6/InfoString/EnumStrings.h" #include "Game/T6/InfoString/InfoStringToStructConverter.h" #include "Game/T6/InfoString/WeaponFields.h" +#include "Game/T6/ObjConstantsT6.h" +#include "Game/T6/T6.h" #include "InfoString/InfoString.h" +#include "Utils/ClassUtils.h" + +#include +#include +#include using namespace T6; @@ -88,7 +87,8 @@ namespace T6 if (pairs.size() > std::extent::value) { - std::cout << "Cannot have more than " << std::extent::value << " notetracksoundmap entries!" << std::endl; + std::cout << "Cannot have more than " << std::extent::value << " notetracksoundmap entries!" + << std::endl; return false; } @@ -166,15 +166,15 @@ namespace T6 if (static_cast(attachmentAsset->attachmentType) >= ATTACHMENT_TYPE_COUNT) { - std::cout << "Invalid attachment type " << attachmentAsset->attachmentType << " for attachment asset \"" << attachmentName << "\"" << std::endl; + std::cout << "Invalid attachment type " << attachmentAsset->attachmentType << " for attachment asset \"" << attachmentName << "\"" + << std::endl; return false; } if (attachments[attachmentAsset->attachmentType] != nullptr) { - std::cout << "Already loaded attachment with same type " << attachmentAsset->attachmentType - << ": \"" << attachments[attachmentAsset->attachmentType]->szInternalName << "\", \"" - << attachmentName << "\"" << std::endl; + std::cout << "Already loaded attachment with same type " << attachmentAsset->attachmentType << ": \"" + << attachments[attachmentAsset->attachmentType]->szInternalName << "\", \"" << attachmentName << "\"" << std::endl; return false; } @@ -219,8 +219,8 @@ namespace T6 if (attachmentCombinationIndex >= std::extent::value) { std::cout << "Cannot have more than " - << (std::extent::value - std::extent::value) - << " combined attachment attachment unique entries!" << std::endl; + << (std::extent::value - std::extent::value) + << " combined attachment attachment unique entries!" << std::endl; return false; } @@ -231,15 +231,16 @@ namespace T6 { if (static_cast(attachmentUniqueAsset->attachmentType) >= ATTACHMENT_TYPE_COUNT) { - std::cout << "Invalid attachment type " << attachmentUniqueAsset->attachmentType << " for attachment unique asset \"" << attachmentUniqueName << "\"" << std::endl; + std::cout << "Invalid attachment type " << attachmentUniqueAsset->attachmentType << " for attachment unique asset \"" + << attachmentUniqueName << "\"" << std::endl; return false; } if (attachmentUniques[attachmentUniqueAsset->attachmentType] != nullptr) { - std::cout << "Already loaded attachment unique with same type " << attachmentUniqueAsset->attachmentType - << ": \"" << attachmentUniques[attachmentUniqueAsset->attachmentType]->szInternalName << "\", \"" - << attachmentUniqueName << "\"" << std::endl; + std::cout << "Already loaded attachment unique with same type " << attachmentUniqueAsset->attachmentType << ": \"" + << attachmentUniques[attachmentUniqueAsset->attachmentType]->szInternalName << "\", \"" << attachmentUniqueName << "\"" + << std::endl; return false; } @@ -352,13 +353,18 @@ namespace T6 } public: - InfoStringToWeaponConverter(const InfoString& infoString, WeaponFullDef* weaponFullDef, ZoneScriptStrings& zoneScriptStrings, MemoryManager* memory, IAssetLoadingManager* manager, - const cspField_t* fields, const size_t fieldCount) + InfoStringToWeaponConverter(const InfoString& infoString, + WeaponFullDef* weaponFullDef, + ZoneScriptStrings& zoneScriptStrings, + MemoryManager* memory, + IAssetLoadingManager* manager, + const cspField_t* fields, + const size_t fieldCount) : InfoStringToStructConverter(infoString, weaponFullDef, zoneScriptStrings, memory, manager, fields, fieldCount) { } }; -} +} // namespace T6 void AssetLoaderWeapon::LinkWeaponFullDefSubStructs(WeaponFullDef* weapon) { @@ -423,13 +429,19 @@ bool AssetLoaderWeapon::IsFxOverride(FxEffectDef* effect1, FxEffectDef* effect2) return strcmp(effect1->name, effect2->name) != 0; } -void AssetLoaderWeapon::HandleSoundOverride(WeaponAttachmentUnique* attachmentUnique, const char* snd1, const char* snd2, const eAttachmentOverrideSounds sndOverrideIndex) +void AssetLoaderWeapon::HandleSoundOverride(WeaponAttachmentUnique* attachmentUnique, + const char* snd1, + const char* snd2, + const eAttachmentOverrideSounds sndOverrideIndex) { if (IsStringOverride(snd1, snd2)) attachmentUnique->soundOverrides |= 1 << static_cast(sndOverrideIndex); } -void AssetLoaderWeapon::HandleFxOverride(WeaponAttachmentUnique* attachmentUnique, FxEffectDef* effect1, FxEffectDef* effect2, const eAttachmentOverrideEffects fxOverrideIndex) +void AssetLoaderWeapon::HandleFxOverride(WeaponAttachmentUnique* attachmentUnique, + FxEffectDef* effect1, + FxEffectDef* effect2, + const eAttachmentOverrideEffects fxOverrideIndex) { if (IsFxOverride(effect1, effect2)) attachmentUnique->effectOverrides |= 1 << static_cast(fxOverrideIndex); @@ -450,15 +462,20 @@ void AssetLoaderWeapon::CalculateAttachmentFields(WeaponFullDef* weapon, unsigne HandleSoundOverride(attachmentUnique, weapon->weapDef.fireSound, attachmentUnique->fireSound, ATTACHMENT_OVERRIDE_SOUND_FIRE); HandleSoundOverride(attachmentUnique, weapon->weapDef.fireSoundPlayer, attachmentUnique->fireSoundPlayer, ATTACHMENT_OVERRIDE_SOUND_FIRE_PLAYER); HandleSoundOverride(attachmentUnique, weapon->weapDef.fireLoopSound, attachmentUnique->fireLoopSound, ATTACHMENT_OVERRIDE_SOUND_FIRE_LOOP); - HandleSoundOverride(attachmentUnique, weapon->weapDef.fireLoopSoundPlayer, attachmentUnique->fireLoopSoundPlayer, ATTACHMENT_OVERRIDE_SOUND_FIRE_LOOP_PLAYER); + HandleSoundOverride( + attachmentUnique, weapon->weapDef.fireLoopSoundPlayer, attachmentUnique->fireLoopSoundPlayer, ATTACHMENT_OVERRIDE_SOUND_FIRE_LOOP_PLAYER); HandleSoundOverride(attachmentUnique, weapon->weapDef.fireLoopEndSound, attachmentUnique->fireLoopEndSound, ATTACHMENT_OVERRIDE_SOUND_FIRE_LOOP_END); - HandleSoundOverride(attachmentUnique, weapon->weapDef.fireLoopEndSoundPlayer, attachmentUnique->fireLoopEndSoundPlayer, ATTACHMENT_OVERRIDE_SOUND_FIRE_LOOP_END_PLAYER); + HandleSoundOverride( + attachmentUnique, weapon->weapDef.fireLoopEndSoundPlayer, attachmentUnique->fireLoopEndSoundPlayer, ATTACHMENT_OVERRIDE_SOUND_FIRE_LOOP_END_PLAYER); HandleSoundOverride(attachmentUnique, weapon->weapDef.fireStartSound, attachmentUnique->fireStartSound, ATTACHMENT_OVERRIDE_SOUND_FIRE_START); HandleSoundOverride(attachmentUnique, weapon->weapDef.fireStopSound, attachmentUnique->fireStopSound, ATTACHMENT_OVERRIDE_SOUND_FIRE_STOP); - HandleSoundOverride(attachmentUnique, weapon->weapDef.fireStartSoundPlayer, attachmentUnique->fireStartSoundPlayer, ATTACHMENT_OVERRIDE_SOUND_FIRE_START_PLAYER); - HandleSoundOverride(attachmentUnique, weapon->weapDef.fireStopSoundPlayer, attachmentUnique->fireStopSoundPlayer, ATTACHMENT_OVERRIDE_SOUND_FIRE_STOP_PLAYER); + HandleSoundOverride( + attachmentUnique, weapon->weapDef.fireStartSoundPlayer, attachmentUnique->fireStartSoundPlayer, ATTACHMENT_OVERRIDE_SOUND_FIRE_START_PLAYER); + HandleSoundOverride( + attachmentUnique, weapon->weapDef.fireStopSoundPlayer, attachmentUnique->fireStopSoundPlayer, ATTACHMENT_OVERRIDE_SOUND_FIRE_STOP_PLAYER); HandleSoundOverride(attachmentUnique, weapon->weapDef.fireLastSound, attachmentUnique->fireLastSound, ATTACHMENT_OVERRIDE_SOUND_FIRE_LAST); - HandleSoundOverride(attachmentUnique, weapon->weapDef.fireLastSoundPlayer, attachmentUnique->fireLastSoundPlayer, ATTACHMENT_OVERRIDE_SOUND_FIRE_LAST_PLAYER); + HandleSoundOverride( + attachmentUnique, weapon->weapDef.fireLastSoundPlayer, attachmentUnique->fireLastSoundPlayer, ATTACHMENT_OVERRIDE_SOUND_FIRE_LAST_PLAYER); attachmentUnique->effectOverrides = 0; HandleFxOverride(attachmentUnique, weapon->weapDef.viewFlashEffect, attachmentUnique->viewFlashEffect, ATTACHMENT_OVERRIDE_EFFECT_VIEW_FLASH); @@ -468,7 +485,8 @@ void AssetLoaderWeapon::CalculateAttachmentFields(WeaponFullDef* weapon, unsigne if (attachmentUnique->combinedAttachmentTypeMask == 0) { WeaponAttachmentUnique* lastSibling = nullptr; - for (auto attachmentUniqueIndex = std::extent::value; attachmentUniqueIndex < std::extent::value; + for (auto attachmentUniqueIndex = std::extent::value; + attachmentUniqueIndex < std::extent::value; attachmentUniqueIndex++) { if (weapon->attachmentUniques[attachmentUniqueIndex] != nullptr @@ -476,7 +494,8 @@ void AssetLoaderWeapon::CalculateAttachmentFields(WeaponFullDef* weapon, unsigne && weapon->attachmentUniques[attachmentUniqueIndex]->attachmentType != attachmentUnique->attachmentType) { std::vector attachments; - if(AssetLoaderWeaponAttachmentUnique::ExtractAttachmentsFromAssetName(weapon->attachmentUniques[attachmentUniqueIndex]->szInternalName, attachments) + if (AssetLoaderWeaponAttachmentUnique::ExtractAttachmentsFromAssetName(weapon->attachmentUniques[attachmentUniqueIndex]->szInternalName, + attachments) && attachments.front() == attachmentUnique->attachmentType) { if (lastSibling == nullptr) @@ -506,13 +525,15 @@ void AssetLoaderWeapon::CalculateAttachmentFields(WeaponFullDef* weapon) } } -bool AssetLoaderWeapon::LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) +bool AssetLoaderWeapon::LoadFromInfoString( + const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) { auto* weaponFullDef = memory->Create(); memset(weaponFullDef, 0, sizeof(WeaponFullDef)); LinkWeaponFullDefSubStructs(weaponFullDef); - InfoStringToWeaponConverter converter(infoString, weaponFullDef, zone->m_script_strings, memory, manager, weapon_fields, std::extent::value); + InfoStringToWeaponConverter converter( + infoString, weaponFullDef, zone->m_script_strings, memory, manager, weapon_fields, std::extent::value); if (!converter.Convert()) { std::cout << "Failed to parse weapon: \"" << assetName << "\"" << std::endl; @@ -545,14 +566,15 @@ bool AssetLoaderWeapon::CanLoadFromGdt() const return true; } -bool AssetLoaderWeapon::LoadFromGdt(const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderWeapon::LoadFromGdt( + const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { auto* gdtEntry = gdtQueryable->GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_WEAPON, assetName); if (gdtEntry == nullptr) return false; InfoString infoString; - if(!infoString.FromGdtProperties(*gdtEntry)) + if (!infoString.FromGdtProperties(*gdtEntry)) { std::cout << "Failed to read weapon gdt entry: \"" << assetName << "\"" << std::endl; return true; @@ -566,7 +588,8 @@ bool AssetLoaderWeapon::CanLoadFromRaw() const return true; } -bool AssetLoaderWeapon::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderWeapon::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto fileName = "weapons/" + assetName; const auto file = searchPath->Open(fileName); diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeapon.h b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeapon.h index 3c352d29b..d2ba1e041 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeapon.h +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeapon.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/T6/T6.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/T6/T6.h" #include "InfoString/InfoString.h" #include "SearchPath/ISearchPath.h" @@ -13,20 +13,25 @@ namespace T6 static bool IsStringOverride(const char* str1, const char* str2); static bool IsFxOverride(FxEffectDef* effect1, FxEffectDef* effect2); - static void HandleSoundOverride(WeaponAttachmentUnique* attachmentUnique, const char* snd1, const char* snd2, eAttachmentOverrideSounds sndOverrideIndex); - static void HandleFxOverride(WeaponAttachmentUnique* attachmentUnique, FxEffectDef* effect1, FxEffectDef* effect2, eAttachmentOverrideEffects fxOverrideIndex); + static void + HandleSoundOverride(WeaponAttachmentUnique* attachmentUnique, const char* snd1, const char* snd2, eAttachmentOverrideSounds sndOverrideIndex); + static void + HandleFxOverride(WeaponAttachmentUnique* attachmentUnique, FxEffectDef* effect1, FxEffectDef* effect2, eAttachmentOverrideEffects fxOverrideIndex); static void CalculateWeaponFields(WeaponFullDef* weapon); static void CalculateAttachmentFields(WeaponFullDef* weapon, unsigned attachmentIndex, WeaponAttachmentUnique* attachmentUnique); static void CalculateAttachmentFields(WeaponFullDef* weapon); - static bool LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone); + static bool + LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone); public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromGdt() const override; - bool LoadFromGdt(const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool LoadFromGdt( + const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace T6 diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeaponAttachment.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeaponAttachment.cpp index 6f1cf1bae..b1542711d 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeaponAttachment.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeaponAttachment.cpp @@ -1,52 +1,51 @@ #include "AssetLoaderWeaponAttachment.h" -#include -#include -#include - -#include "Game/T6/ObjConstantsT6.h" -#include "Game/T6/T6.h" #include "Game/T6/InfoString/EnumStrings.h" #include "Game/T6/InfoString/InfoStringToStructConverter.h" #include "Game/T6/InfoString/WeaponAttachmentFields.h" +#include "Game/T6/ObjConstantsT6.h" +#include "Game/T6/T6.h" #include "InfoString/InfoString.h" +#include +#include +#include + using namespace T6; namespace T6 { - eAttachmentPoint attachmentPointByAttachmentTable[] - { - ATTACHMENT_POINT_NONE, // none - ATTACHMENT_POINT_TOP, // acog - ATTACHMENT_POINT_TRIGGER, // dualclip - ATTACHMENT_POINT_TOP, // dualoptic - ATTACHMENT_POINT_BOTTOM, // dw - ATTACHMENT_POINT_MUZZLE, // extbarrel - ATTACHMENT_POINT_TRIGGER, // extclip - ATTACHMENT_POINT_TRIGGER, // extramags - ATTACHMENT_POINT_GUNPERK, // fastads - ATTACHMENT_POINT_TOP, // fastreload - ATTACHMENT_POINT_TRIGGER, // fmj - ATTACHMENT_POINT_BOTTOM, // gl - ATTACHMENT_POINT_BOTTOM, // grip - ATTACHMENT_POINT_TOP, // holo - ATTACHMENT_POINT_BOTTOM, // ir - ATTACHMENT_POINT_BOTTOM, // is - ATTACHMENT_POINT_GUNPERK, // longbreath - ATTACHMENT_POINT_BOTTOM, // mk - ATTACHMENT_POINT_TOP, // mms - ATTACHMENT_POINT_TOP, // rangefinder - ATTACHMENT_POINT_TOP, // reflex - ATTACHMENT_POINT_MUZZLE, // rf - ATTACHMENT_POINT_BOTTOM, // sf - ATTACHMENT_POINT_MUZZLE, // silencer - ATTACHMENT_POINT_TRIGGER, // stackfire - ATTACHMENT_POINT_GUNPERK, // stalker - ATTACHMENT_POINT_GUNPERK, // steadyaim - ATTACHMENT_POINT_GUNPERK, // swayreduc - ATTACHMENT_POINT_TOP, // tacknife - ATTACHMENT_POINT_TOP, // vzoom + eAttachmentPoint attachmentPointByAttachmentTable[]{ + ATTACHMENT_POINT_NONE, // none + ATTACHMENT_POINT_TOP, // acog + ATTACHMENT_POINT_TRIGGER, // dualclip + ATTACHMENT_POINT_TOP, // dualoptic + ATTACHMENT_POINT_BOTTOM, // dw + ATTACHMENT_POINT_MUZZLE, // extbarrel + ATTACHMENT_POINT_TRIGGER, // extclip + ATTACHMENT_POINT_TRIGGER, // extramags + ATTACHMENT_POINT_GUNPERK, // fastads + ATTACHMENT_POINT_TOP, // fastreload + ATTACHMENT_POINT_TRIGGER, // fmj + ATTACHMENT_POINT_BOTTOM, // gl + ATTACHMENT_POINT_BOTTOM, // grip + ATTACHMENT_POINT_TOP, // holo + ATTACHMENT_POINT_BOTTOM, // ir + ATTACHMENT_POINT_BOTTOM, // is + ATTACHMENT_POINT_GUNPERK, // longbreath + ATTACHMENT_POINT_BOTTOM, // mk + ATTACHMENT_POINT_TOP, // mms + ATTACHMENT_POINT_TOP, // rangefinder + ATTACHMENT_POINT_TOP, // reflex + ATTACHMENT_POINT_MUZZLE, // rf + ATTACHMENT_POINT_BOTTOM, // sf + ATTACHMENT_POINT_MUZZLE, // silencer + ATTACHMENT_POINT_TRIGGER, // stackfire + ATTACHMENT_POINT_GUNPERK, // stalker + ATTACHMENT_POINT_GUNPERK, // steadyaim + ATTACHMENT_POINT_GUNPERK, // swayreduc + ATTACHMENT_POINT_TOP, // tacknife + ATTACHMENT_POINT_TOP, // vzoom }; static_assert(std::extent::value == ATTACHMENT_TYPE_COUNT); @@ -74,29 +73,36 @@ namespace T6 } public: - InfoStringToWeaponAttachmentConverter(const InfoString& infoString, WeaponAttachment* weaponAttachment, ZoneScriptStrings& zoneScriptStrings, MemoryManager* memory, IAssetLoadingManager* manager, - const cspField_t* fields, const size_t fieldCount) + InfoStringToWeaponAttachmentConverter(const InfoString& infoString, + WeaponAttachment* weaponAttachment, + ZoneScriptStrings& zoneScriptStrings, + MemoryManager* memory, + IAssetLoadingManager* manager, + const cspField_t* fields, + const size_t fieldCount) : InfoStringToStructConverter(infoString, weaponAttachment, zoneScriptStrings, memory, manager, fields, fieldCount) { } }; -} +} // namespace T6 void AssetLoaderWeaponAttachment::CalculateAttachmentFields(WeaponAttachment* attachment) { // attachmentPoint - if(static_cast(attachment->attachmentType) < ATTACHMENT_TYPE_COUNT) + if (static_cast(attachment->attachmentType) < ATTACHMENT_TYPE_COUNT) { attachment->attachmentPoint = attachmentPointByAttachmentTable[attachment->attachmentType]; } } -bool AssetLoaderWeaponAttachment::LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) +bool AssetLoaderWeaponAttachment::LoadFromInfoString( + const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) { auto* attachment = memory->Create(); memset(attachment, 0, sizeof(WeaponAttachment)); - InfoStringToWeaponAttachmentConverter converter(infoString, attachment, zone->m_script_strings, memory, manager, attachment_fields, std::extent::value); + InfoStringToWeaponAttachmentConverter converter( + infoString, attachment, zone->m_script_strings, memory, manager, attachment_fields, std::extent::value); if (!converter.Convert()) { std::cout << "Failed to parse attachment: \"" << assetName << "\"" << std::endl; @@ -125,7 +131,8 @@ bool AssetLoaderWeaponAttachment::CanLoadFromGdt() const return true; } -bool AssetLoaderWeaponAttachment::LoadFromGdt(const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderWeaponAttachment::LoadFromGdt( + const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { auto* gdtEntry = gdtQueryable->GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_WEAPON_ATTACHMENT, assetName); if (gdtEntry == nullptr) @@ -146,7 +153,8 @@ bool AssetLoaderWeaponAttachment::CanLoadFromRaw() const return true; } -bool AssetLoaderWeaponAttachment::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderWeaponAttachment::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto fileName = "attachment/" + assetName; const auto file = searchPath->Open(fileName); diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeaponAttachment.h b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeaponAttachment.h index f0099634e..f5abfec8c 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeaponAttachment.h +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeaponAttachment.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/T6/T6.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/T6/T6.h" #include "InfoString/InfoString.h" #include "SearchPath/ISearchPath.h" @@ -11,13 +11,16 @@ namespace T6 { static void CalculateAttachmentFields(WeaponAttachment* attachment); - static bool LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone); + static bool + LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone); public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromGdt() const override; - bool LoadFromGdt(const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool LoadFromGdt( + const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace T6 diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeaponAttachmentUnique.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeaponAttachmentUnique.cpp index 1fd65a4b5..5f36481e9 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeaponAttachmentUnique.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeaponAttachmentUnique.cpp @@ -1,16 +1,16 @@ #include "AssetLoaderWeaponAttachmentUnique.h" -#include -#include -#include - -#include "Utils/ClassUtils.h" -#include "Game/T6/ObjConstantsT6.h" -#include "Game/T6/T6.h" #include "Game/T6/InfoString/EnumStrings.h" #include "Game/T6/InfoString/InfoStringToStructConverter.h" #include "Game/T6/InfoString/WeaponAttachmentUniqueFields.h" +#include "Game/T6/ObjConstantsT6.h" +#include "Game/T6/T6.h" #include "InfoString/InfoString.h" +#include "Utils/ClassUtils.h" + +#include +#include +#include using namespace T6; @@ -102,13 +102,18 @@ namespace T6 } public: - InfoStringToWeaponAttachmentUniqueConverter(const InfoString& infoString, WeaponAttachmentUniqueFull* attachmentUniqueFull, ZoneScriptStrings& zoneScriptStrings, MemoryManager* memory, IAssetLoadingManager* manager, - const cspField_t* fields, const size_t fieldCount) + InfoStringToWeaponAttachmentUniqueConverter(const InfoString& infoString, + WeaponAttachmentUniqueFull* attachmentUniqueFull, + ZoneScriptStrings& zoneScriptStrings, + MemoryManager* memory, + IAssetLoadingManager* manager, + const cspField_t* fields, + const size_t fieldCount) : InfoStringToStructConverter(infoString, attachmentUniqueFull, zoneScriptStrings, memory, manager, fields, fieldCount) { } }; -} +} // namespace T6 bool AssetLoaderWeaponAttachmentUnique::ExtractAttachmentsFromAssetName(const std::string& assetName, std::vector& attachmentList) { @@ -116,14 +121,14 @@ bool AssetLoaderWeaponAttachmentUnique::ExtractAttachmentsFromAssetName(const st auto attachCount = 1u; auto partStart = 0u; - for(auto ci = 0u; ci < assetName.size(); ci++) + for (auto ci = 0u; ci < assetName.size(); ci++) { - if(assetName[ci] == '_') + if (assetName[ci] == '_') { parts.emplace_back(assetName, partStart, ci - partStart); partStart = ci + 1; } - else if(assetName[ci] == '+') + else if (assetName[ci] == '+') { attachCount++; parts.emplace_back(assetName, partStart, ci - partStart); @@ -131,10 +136,10 @@ bool AssetLoaderWeaponAttachmentUnique::ExtractAttachmentsFromAssetName(const st } } - if(partStart < assetName.size()) + if (partStart < assetName.size()) parts.emplace_back(assetName, partStart, assetName.size() - partStart); - for(auto attachPartOffset = parts.size() - attachCount; attachPartOffset < parts.size(); attachPartOffset++) + for (auto attachPartOffset = parts.size() - attachCount; attachPartOffset < parts.size(); attachPartOffset++) { auto& specifiedAttachName = parts[attachPartOffset]; @@ -142,9 +147,9 @@ bool AssetLoaderWeaponAttachmentUnique::ExtractAttachmentsFromAssetName(const st c = static_cast(tolower(c)); auto foundAttachment = false; - for(auto attachIndex = 0u; attachIndex < std::extent::value; attachIndex++) + for (auto attachIndex = 0u; attachIndex < std::extent::value; attachIndex++) { - if(specifiedAttachName == szAttachmentTypeNames[attachIndex]) + if (specifiedAttachName == szAttachmentTypeNames[attachIndex]) { attachmentList.push_back(static_cast(attachIndex)); foundAttachment = true; @@ -152,7 +157,7 @@ bool AssetLoaderWeaponAttachmentUnique::ExtractAttachmentsFromAssetName(const st } } - if(!foundAttachment) + if (!foundAttachment) return false; } @@ -170,7 +175,7 @@ bool AssetLoaderWeaponAttachmentUnique::CalculateAttachmentUniqueFields(const st { // combinedAttachmentTypeMask std::vector attachmentsFromName; - if(!ExtractAttachmentsFromAssetName(assetName, attachmentsFromName)) + if (!ExtractAttachmentsFromAssetName(assetName, attachmentsFromName)) { std::cout << "Failed to determine attachments from attachment unique name \"" << assetName << "\"" << std::endl; return false; @@ -178,7 +183,7 @@ bool AssetLoaderWeaponAttachmentUnique::CalculateAttachmentUniqueFields(const st if (attachmentsFromName.size() > 1) { - for(auto attachment : attachmentsFromName) + for (auto attachment : attachmentsFromName) { attachmentUnique->attachment.combinedAttachmentTypeMask |= 1 << attachment; } @@ -187,14 +192,21 @@ bool AssetLoaderWeaponAttachmentUnique::CalculateAttachmentUniqueFields(const st return true; } -bool AssetLoaderWeaponAttachmentUnique::LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) +bool AssetLoaderWeaponAttachmentUnique::LoadFromInfoString( + const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) { auto* attachmentUniqueFull = memory->Create(); memset(attachmentUniqueFull, 0, sizeof(WeaponAttachmentUniqueFull)); LinkAttachmentUniqueFullSubStructs(attachmentUniqueFull); - InfoStringToWeaponAttachmentUniqueConverter converter(infoString, attachmentUniqueFull, zone->m_script_strings, memory, manager, attachment_unique_fields, std::extent::value); + InfoStringToWeaponAttachmentUniqueConverter converter(infoString, + attachmentUniqueFull, + zone->m_script_strings, + memory, + manager, + attachment_unique_fields, + std::extent::value); if (!converter.Convert()) { std::cout << "Failed to parse attachment unique: \"" << assetName << "\"" << std::endl; @@ -209,7 +221,8 @@ bool AssetLoaderWeaponAttachmentUnique::LoadFromInfoString(const InfoString& inf auto* assetInfo = GlobalAssetPool::GetAssetByName(assetName); auto* asset = assetInfo ? assetInfo->Asset() : nullptr; - manager->AddAsset(ASSET_TYPE_ATTACHMENT_UNIQUE, assetName, &attachmentUniqueFull->attachment, converter.GetDependencies(), converter.GetUsedScriptStrings()); + manager->AddAsset( + ASSET_TYPE_ATTACHMENT_UNIQUE, assetName, &attachmentUniqueFull->attachment, converter.GetDependencies(), converter.GetUsedScriptStrings()); return true; } @@ -229,7 +242,8 @@ bool AssetLoaderWeaponAttachmentUnique::CanLoadFromGdt() const return true; } -bool AssetLoaderWeaponAttachmentUnique::LoadFromGdt(const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderWeaponAttachmentUnique::LoadFromGdt( + const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { auto* gdtEntry = gdtQueryable->GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_WEAPON_ATTACHMENT_UNIQUE, assetName); if (gdtEntry == nullptr) @@ -250,7 +264,8 @@ bool AssetLoaderWeaponAttachmentUnique::CanLoadFromRaw() const return true; } -bool AssetLoaderWeaponAttachmentUnique::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderWeaponAttachmentUnique::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto fileName = "attachmentunique/" + assetName; const auto file = searchPath->Open(fileName); diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeaponAttachmentUnique.h b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeaponAttachmentUnique.h index 9311a6dd5..87399723b 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeaponAttachmentUnique.h +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderWeaponAttachmentUnique.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/T6/T6.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/T6/T6.h" #include "InfoString/InfoString.h" #include "SearchPath/ISearchPath.h" @@ -12,15 +12,18 @@ namespace T6 static void LinkAttachmentUniqueFullSubStructs(WeaponAttachmentUniqueFull* attachmentUnique); static bool CalculateAttachmentUniqueFields(const std::string& assetName, WeaponAttachmentUniqueFull* attachmentUnique); - static bool LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone); + static bool + LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone); public: static bool ExtractAttachmentsFromAssetName(const std::string& assetName, std::vector& attachmentList); _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromGdt() const override; - bool LoadFromGdt(const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool LoadFromGdt( + const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace T6 diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderZBarrier.cpp b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderZBarrier.cpp index e4f5fe4f2..b445e1864 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderZBarrier.cpp +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderZBarrier.cpp @@ -1,15 +1,15 @@ #include "AssetLoaderZBarrier.h" -#include -#include -#include - -#include "Game/T6/ObjConstantsT6.h" -#include "Game/T6/T6.h" #include "Game/T6/InfoString/InfoStringToStructConverter.h" #include "Game/T6/InfoString/ZBarrierFields.h" +#include "Game/T6/ObjConstantsT6.h" +#include "Game/T6/T6.h" #include "InfoString/InfoString.h" +#include +#include +#include + using namespace T6; namespace T6 @@ -24,13 +24,18 @@ namespace T6 } public: - InfoStringToZBarrierConverter(const InfoString& infoString, ZBarrierDef* zbarrier, ZoneScriptStrings& zoneScriptStrings, MemoryManager* memory, IAssetLoadingManager* manager, - const cspField_t* fields, const size_t fieldCount) + InfoStringToZBarrierConverter(const InfoString& infoString, + ZBarrierDef* zbarrier, + ZoneScriptStrings& zoneScriptStrings, + MemoryManager* memory, + IAssetLoadingManager* manager, + const cspField_t* fields, + const size_t fieldCount) : InfoStringToStructConverter(infoString, zbarrier, zoneScriptStrings, memory, manager, fields, fieldCount) { } }; -} +} // namespace T6 void AssetLoaderZBarrier::CalculateZBarrierFields(ZBarrierDef* zbarrier) { @@ -52,12 +57,14 @@ void AssetLoaderZBarrier::CalculateZBarrierFields(ZBarrierDef* zbarrier) } } -bool AssetLoaderZBarrier::LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) +bool AssetLoaderZBarrier::LoadFromInfoString( + const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) { auto* zbarrier = memory->Create(); memset(zbarrier, 0, sizeof(ZBarrierDef)); - InfoStringToZBarrierConverter converter(infoString, zbarrier, zone->m_script_strings, memory, manager, zbarrier_fields, std::extent::value); + InfoStringToZBarrierConverter converter( + infoString, zbarrier, zone->m_script_strings, memory, manager, zbarrier_fields, std::extent::value); if (!converter.Convert()) { std::cout << "Failed to parse zbarrier: \"" << assetName << "\"" << std::endl; @@ -86,7 +93,8 @@ bool AssetLoaderZBarrier::CanLoadFromGdt() const return true; } -bool AssetLoaderZBarrier::LoadFromGdt(const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderZBarrier::LoadFromGdt( + const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { auto* gdtEntry = gdtQueryable->GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_ZBARRIER, assetName); if (gdtEntry == nullptr) @@ -107,7 +115,8 @@ bool AssetLoaderZBarrier::CanLoadFromRaw() const return true; } -bool AssetLoaderZBarrier::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const +bool AssetLoaderZBarrier::LoadFromRaw( + const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const { const auto fileName = "zbarrier/" + assetName; const auto file = searchPath->Open(fileName); diff --git a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderZBarrier.h b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderZBarrier.h index 8d52a9daf..ee6c6d1f2 100644 --- a/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderZBarrier.h +++ b/src/ObjLoading/Game/T6/AssetLoaders/AssetLoaderZBarrier.h @@ -1,7 +1,7 @@ #pragma once -#include "Game/T6/T6.h" #include "AssetLoading/BasicAssetLoader.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "Game/T6/T6.h" #include "InfoString/InfoString.h" #include "SearchPath/ISearchPath.h" @@ -11,13 +11,16 @@ namespace T6 { static void CalculateZBarrierFields(ZBarrierDef* zbarrier); - static bool LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone); + static bool + LoadFromInfoString(const InfoString& infoString, const std::string& assetName, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone); public: _NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override; _NODISCARD bool CanLoadFromGdt() const override; - bool LoadFromGdt(const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool LoadFromGdt( + const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; _NODISCARD bool CanLoadFromRaw() const override; - bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; + bool + LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override; }; -} +} // namespace T6 diff --git a/src/ObjLoading/Game/T6/InfoString/InfoStringToStructConverter.cpp b/src/ObjLoading/Game/T6/InfoString/InfoStringToStructConverter.cpp index 8acf6f113..5f7e98e5e 100644 --- a/src/ObjLoading/Game/T6/InfoString/InfoStringToStructConverter.cpp +++ b/src/ObjLoading/Game/T6/InfoString/InfoStringToStructConverter.cpp @@ -1,14 +1,19 @@ #include "InfoStringToStructConverter.h" +#include "Game/T6/CommonT6.h" + #include #include -#include "Game/T6/CommonT6.h" - using namespace T6; -InfoStringToStructConverter::InfoStringToStructConverter(const InfoString& infoString, void* structure, ZoneScriptStrings& zoneScriptStrings, MemoryManager* memory, IAssetLoadingManager* manager, - const cspField_t* fields, const size_t fieldCount) +InfoStringToStructConverter::InfoStringToStructConverter(const InfoString& infoString, + void* structure, + ZoneScriptStrings& zoneScriptStrings, + MemoryManager* memory, + IAssetLoadingManager* manager, + const cspField_t* fields, + const size_t fieldCount) : InfoStringToStructConverterBase(infoString, structure, zoneScriptStrings, memory), m_loading_manager(manager), m_fields(fields), @@ -64,132 +69,132 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons return ConvertMilliseconds(value, field.iOffset); case CSPFT_FX: + { + if (value.empty()) { - if (value.empty()) - { - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = nullptr; - return true; - } + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = nullptr; + return true; + } - auto* fx = m_loading_manager->LoadDependency(ASSET_TYPE_FX, value); + auto* fx = m_loading_manager->LoadDependency(ASSET_TYPE_FX, value); - if (fx == nullptr) - { - std::cout << "Failed to load fx asset \"" << value << "\"" << std::endl; - return false; - } + if (fx == nullptr) + { + std::cout << "Failed to load fx asset \"" << value << "\"" << std::endl; + return false; + } - m_dependencies.emplace(fx); - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = fx->m_ptr; + m_dependencies.emplace(fx); + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = fx->m_ptr; - return true; - } + return true; + } case CSPFT_XMODEL: + { + if (value.empty()) { - if (value.empty()) - { - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = nullptr; - return true; - } + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = nullptr; + return true; + } - auto* xmodel = m_loading_manager->LoadDependency(ASSET_TYPE_XMODEL, value); + auto* xmodel = m_loading_manager->LoadDependency(ASSET_TYPE_XMODEL, value); - if (xmodel == nullptr) - { - std::cout << "Failed to load xmodel asset \"" << value << "\"" << std::endl; - return false; - } + if (xmodel == nullptr) + { + std::cout << "Failed to load xmodel asset \"" << value << "\"" << std::endl; + return false; + } - m_dependencies.emplace(xmodel); - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = xmodel->m_ptr; + m_dependencies.emplace(xmodel); + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = xmodel->m_ptr; - return true; - } + return true; + } case CSPFT_MATERIAL: case CSPFT_MATERIAL_STREAM: + { + if (value.empty()) { - if (value.empty()) - { - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = nullptr; - return true; - } + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = nullptr; + return true; + } - auto* material = m_loading_manager->LoadDependency(ASSET_TYPE_MATERIAL, value); + auto* material = m_loading_manager->LoadDependency(ASSET_TYPE_MATERIAL, value); - if (material == nullptr) - { - std::cout << "Failed to load material asset \"" << value << "\"" << std::endl; - return false; - } + if (material == nullptr) + { + std::cout << "Failed to load material asset \"" << value << "\"" << std::endl; + return false; + } - m_dependencies.emplace(material); - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = material->m_ptr; + m_dependencies.emplace(material); + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = material->m_ptr; - return true; - } + return true; + } case CSPFT_PHYS_PRESET: + { + if (value.empty()) { - if (value.empty()) - { - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = nullptr; - return true; - } + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = nullptr; + return true; + } - auto* physPreset = m_loading_manager->LoadDependency(ASSET_TYPE_PHYSPRESET, value); + auto* physPreset = m_loading_manager->LoadDependency(ASSET_TYPE_PHYSPRESET, value); - if (physPreset == nullptr) - { - std::cout << "Failed to load physpreset asset \"" << value << "\"" << std::endl; - return false; - } + if (physPreset == nullptr) + { + std::cout << "Failed to load physpreset asset \"" << value << "\"" << std::endl; + return false; + } - m_dependencies.emplace(physPreset); - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = physPreset->m_ptr; + m_dependencies.emplace(physPreset); + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = physPreset->m_ptr; - return true; - } + return true; + } case CSPFT_SCRIPT_STRING: return ConvertScriptString(value, field.iOffset); case CSPFT_TRACER: + { + if (value.empty()) { - if (value.empty()) - { - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = nullptr; - return true; - } + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = nullptr; + return true; + } - auto* tracer = m_loading_manager->LoadDependency(ASSET_TYPE_TRACER, value); + auto* tracer = m_loading_manager->LoadDependency(ASSET_TYPE_TRACER, value); - if (tracer == nullptr) - { - std::cout << "Failed to load tracer asset \"" << value << "\"" << std::endl; - return false; - } + if (tracer == nullptr) + { + std::cout << "Failed to load tracer asset \"" << value << "\"" << std::endl; + return false; + } - m_dependencies.emplace(tracer); - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = tracer->m_ptr; + m_dependencies.emplace(tracer); + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = tracer->m_ptr; - return true; - } + return true; + } case CSPFT_SOUND_ALIAS_ID: + { + unsigned int soundAliasHash; + if (!GetHashValue(value, soundAliasHash)) { - unsigned int soundAliasHash; - if (!GetHashValue(value, soundAliasHash)) - { - std::cout << "Failed to parse value \"" << value << "\" as hash" << std::endl; - return false; - } - - *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = soundAliasHash; - return true; + std::cout << "Failed to parse value \"" << value << "\" as hash" << std::endl; + return false; } + *reinterpret_cast(reinterpret_cast(m_structure) + field.iOffset) = soundAliasHash; + return true; + } + case CSPFT_NUM_BASE_FIELD_TYPES: default: assert(false); diff --git a/src/ObjLoading/Game/T6/InfoString/InfoStringToStructConverter.h b/src/ObjLoading/Game/T6/InfoString/InfoStringToStructConverter.h index 9e9ecc6da..5adb8cf00 100644 --- a/src/ObjLoading/Game/T6/InfoString/InfoStringToStructConverter.h +++ b/src/ObjLoading/Game/T6/InfoString/InfoStringToStructConverter.h @@ -1,7 +1,7 @@ #pragma once #include "AssetLoading/IAssetLoadingManager.h" -#include "InfoString/InfoStringToStructConverterBase.h" #include "Game/T6/T6.h" +#include "InfoString/InfoStringToStructConverterBase.h" namespace T6 { @@ -18,8 +18,13 @@ namespace T6 bool ConvertBaseField(const cspField_t& field, const std::string& value); public: - InfoStringToStructConverter(const InfoString& infoString, void* structure, ZoneScriptStrings& zoneScriptStrings, MemoryManager* memory, IAssetLoadingManager* manager, const cspField_t* fields, + InfoStringToStructConverter(const InfoString& infoString, + void* structure, + ZoneScriptStrings& zoneScriptStrings, + MemoryManager* memory, + IAssetLoadingManager* manager, + const cspField_t* fields, size_t fieldCount); bool Convert() override; }; -} +} // namespace T6 diff --git a/src/ObjLoading/Game/T6/ObjLoaderT6.cpp b/src/ObjLoading/Game/T6/ObjLoaderT6.cpp index bafa90bb5..6fca08a8f 100644 --- a/src/ObjLoading/Game/T6/ObjLoaderT6.cpp +++ b/src/ObjLoading/Game/T6/ObjLoaderT6.cpp @@ -1,11 +1,5 @@ #include "ObjLoaderT6.h" -#include - -#include "Game/T6/GameT6.h" -#include "Game/T6/GameAssetPoolT6.h" -#include "ObjContainer/IPak/IPak.h" -#include "ObjLoading.h" #include "AssetLoaders/AssetLoaderFontIcon.h" #include "AssetLoaders/AssetLoaderGfxImage.h" #include "AssetLoaders/AssetLoaderLocalizeEntry.h" @@ -23,11 +17,17 @@ #include "AssetLoaders/AssetLoaderWeaponAttachmentUnique.h" #include "AssetLoaders/AssetLoaderZBarrier.h" #include "AssetLoading/AssetLoadingManager.h" -#include "Image/Texture.h" -#include "Image/IwiLoader.h" #include "Game/T6/CommonT6.h" +#include "Game/T6/GameAssetPoolT6.h" +#include "Game/T6/GameT6.h" #include "Image/Dx12TextureLoader.h" +#include "Image/IwiLoader.h" #include "Image/IwiTypes.h" +#include "Image/Texture.h" +#include "ObjContainer/IPak/IPak.h" +#include "ObjLoading.h" + +#include namespace T6 { @@ -36,7 +36,11 @@ namespace T6 ObjLoader::ObjLoader() { -#define REGISTER_ASSET_LOADER(t) {auto l = std::make_unique(); m_asset_loaders_by_type[l->GetHandlingAssetType()] = std::move(l);} +#define REGISTER_ASSET_LOADER(t) \ + { \ + auto l = std::make_unique(); \ + m_asset_loaders_by_type[l->GetHandlingAssetType()] = std::move(l); \ + } #define BASIC_LOADER(assetType, assetClass) BasicAssetLoader REGISTER_ASSET_LOADER(AssetLoaderPhysPreset) @@ -146,8 +150,12 @@ namespace T6 return nullptr; } - void ObjLoader::LoadSoundBankFromLinkedInfo(ISearchPath* searchPath, const std::string& soundBankFileName, const SndRuntimeAssetBank* sndBankLinkedInfo, Zone* zone, - std::set& loadedBanksForZone, std::stack& dependenciesToLoad) + void ObjLoader::LoadSoundBankFromLinkedInfo(ISearchPath* searchPath, + const std::string& soundBankFileName, + const SndRuntimeAssetBank* sndBankLinkedInfo, + Zone* zone, + std::set& loadedBanksForZone, + std::stack& dependenciesToLoad) { if (loadedBanksForZone.find(soundBankFileName) == loadedBanksForZone.end()) { @@ -245,14 +253,12 @@ namespace T6 bool ObjLoader::IsMpZone(Zone* zone) { - return zone->m_name.compare(0, 3, "mp_") == 0 - || zone->m_name.compare(zone->m_name.length() - 3, 3, "_mp") == 0; + return zone->m_name.compare(0, 3, "mp_") == 0 || zone->m_name.compare(zone->m_name.length() - 3, 3, "_mp") == 0; } bool ObjLoader::IsZmZone(Zone* zone) { - return zone->m_name.compare(0, 3, "zm_") == 0 - || zone->m_name.compare(zone->m_name.length() - 3, 3, "_zm") == 0; + return zone->m_name.compare(0, 3, "zm_") == 0 || zone->m_name.compare(zone->m_name.length() - 3, 3, "_zm") == 0; } void ObjLoader::LoadCommonIPaks(ISearchPath* searchPath, Zone* zone) @@ -462,4 +468,4 @@ namespace T6 for (const auto& [type, loader] : m_asset_loaders_by_type) loader->FinalizeAssetsForZone(context); } -} +} // namespace T6 diff --git a/src/ObjLoading/Game/T6/ObjLoaderT6.h b/src/ObjLoading/Game/T6/ObjLoaderT6.h index 73c73eed1..747841b69 100644 --- a/src/ObjLoading/Game/T6/ObjLoaderT6.h +++ b/src/ObjLoading/Game/T6/ObjLoaderT6.h @@ -1,16 +1,16 @@ #pragma once +#include "AssetLoading/IAssetLoader.h" +#include "Game/T6/T6.h" +#include "IObjLoader.h" +#include "ObjContainer/SoundBank/SoundBank.h" +#include "SearchPath/ISearchPath.h" + #include #include #include -#include #include - -#include "IObjLoader.h" -#include "AssetLoading/IAssetLoader.h" -#include "SearchPath/ISearchPath.h" -#include "Game/T6/T6.h" -#include "ObjContainer/SoundBank/SoundBank.h" +#include namespace T6 { @@ -23,8 +23,12 @@ namespace T6 static bool VerifySoundBankChecksum(const SoundBank* soundBank, const SndRuntimeAssetBank& sndRuntimeAssetBank); static SoundBank* LoadSoundBankForZone(ISearchPath* searchPath, const std::string& soundBankFileName, Zone* zone); - static void LoadSoundBankFromLinkedInfo(ISearchPath* searchPath, const std::string& soundBankFileName, const SndRuntimeAssetBank* sndBankLinkedInfo, Zone* zone, - std::set& loadedBanksForZone, std::stack& dependenciesToLoad); + static void LoadSoundBankFromLinkedInfo(ISearchPath* searchPath, + const std::string& soundBankFileName, + const SndRuntimeAssetBank* sndBankLinkedInfo, + Zone* zone, + std::set& loadedBanksForZone, + std::stack& dependenciesToLoad); static void LoadSoundBanksFromAsset(ISearchPath* searchPath, const SndBank* sndBank, Zone* zone, std::set& loadedBanksForZone); static void LoadIPakForZone(ISearchPath* searchPath, const std::string& ipakName, Zone* zone); @@ -50,4 +54,4 @@ namespace T6 bool LoadAssetForZone(AssetLoadingContext* context, asset_type_t assetType, const std::string& assetName) const override; void FinalizeAssetsForZone(AssetLoadingContext* context) const override; }; -} +} // namespace T6 diff --git a/src/ObjLoading/IObjLoader.h b/src/ObjLoading/IObjLoader.h index d38a26e84..ccf00d9aa 100644 --- a/src/ObjLoading/IObjLoader.h +++ b/src/ObjLoading/IObjLoader.h @@ -24,8 +24,8 @@ class IObjLoader virtual void LoadReferencedContainersForZone(ISearchPath* searchPath, Zone* zone) const = 0; /** - * \brief Unloads all containers of a specified zone. If a container is also loaded by another zone it will only be unloaded when all referencing zones are unloaded. - * \param zone The zone to unload all containers for. + * \brief Unloads all containers of a specified zone. If a container is also loaded by another zone it will only be unloaded when all referencing zones are + * unloaded. \param zone The zone to unload all containers for. */ virtual void UnloadContainersOfZone(Zone* zone) const = 0; @@ -38,4 +38,4 @@ class IObjLoader virtual bool LoadAssetForZone(AssetLoadingContext* context, asset_type_t assetType, const std::string& assetName) const = 0; virtual void FinalizeAssetsForZone(AssetLoadingContext* context) const = 0; -}; \ No newline at end of file +}; diff --git a/src/ObjLoading/Image/DdsLoader.cpp b/src/ObjLoading/Image/DdsLoader.cpp index d26d566eb..85bfef6ff 100644 --- a/src/ObjLoading/Image/DdsLoader.cpp +++ b/src/ObjLoading/Image/DdsLoader.cpp @@ -1,10 +1,10 @@ #include "DdsLoader.h" -#include - +#include "Image/DdsTypes.h" #include "Utils/ClassUtils.h" #include "Utils/FileUtils.h" -#include "Image/DdsTypes.h" + +#include class DdsLoaderInternal { @@ -145,9 +145,8 @@ class DdsLoaderInternal const auto* unsignedImageFormat = dynamic_cast(imageFormat); - if (unsignedImageFormat->m_r_offset == rOffset && unsignedImageFormat->m_r_size == rSize - && unsignedImageFormat->m_g_offset == gOffset && unsignedImageFormat->m_g_size == gSize - && unsignedImageFormat->m_b_offset == bOffset && unsignedImageFormat->m_b_size == bSize + if (unsignedImageFormat->m_r_offset == rOffset && unsignedImageFormat->m_r_size == rSize && unsignedImageFormat->m_g_offset == gOffset + && unsignedImageFormat->m_g_size == gSize && unsignedImageFormat->m_b_offset == bOffset && unsignedImageFormat->m_b_size == bSize && unsignedImageFormat->m_a_offset == aOffset && unsignedImageFormat->m_a_size == aSize) { m_format = imageFormat; @@ -155,10 +154,8 @@ class DdsLoaderInternal } } - std::cout << "Failed to find dds pixel format: R=" << std::hex << pf.dwRBitMask - << " G=" << std::hex << pf.dwGBitMask - << " B=" << std::hex << pf.dwBBitMask - << " A=" << std::hex << pf.dwABitMask << std::endl; + std::cout << "Failed to find dds pixel format: R=" << std::hex << pf.dwRBitMask << " G=" << std::hex << pf.dwGBitMask << " B=" << std::hex + << pf.dwBBitMask << " A=" << std::hex << pf.dwABitMask << std::endl; return false; } @@ -258,8 +255,7 @@ class DdsLoaderInternal Texture* LoadDds() { - if (!ReadMagic() - || !ReadHeader()) + if (!ReadMagic() || !ReadHeader()) { return nullptr; } diff --git a/src/ObjLoading/Image/DdsLoader.h b/src/ObjLoading/Image/DdsLoader.h index 6d80ab36d..28aa59acd 100644 --- a/src/ObjLoading/Image/DdsLoader.h +++ b/src/ObjLoading/Image/DdsLoader.h @@ -1,8 +1,9 @@ #pragma once -#include -#include "Utils/MemoryManager.h" #include "Image/Texture.h" +#include "Utils/MemoryManager.h" + +#include class DdsLoader { diff --git a/src/ObjLoading/Image/Dx12TextureLoader.cpp b/src/ObjLoading/Image/Dx12TextureLoader.cpp index 8ea1f69c7..76b8cd5f9 100644 --- a/src/ObjLoading/Image/Dx12TextureLoader.cpp +++ b/src/ObjLoading/Image/Dx12TextureLoader.cpp @@ -4,12 +4,12 @@ Dx12TextureLoader::Dx12TextureLoader(MemoryManager* memoryManager) : m_memory_manager(memoryManager), - m_format(DXGI_FORMAT_UNKNOWN), - m_type(TextureType::T_2D), - m_has_mip_maps(false), - m_width(1u), - m_height(1u), - m_depth(1u) + m_format(DXGI_FORMAT_UNKNOWN), + m_type(TextureType::T_2D), + m_has_mip_maps(false), + m_width(1u), + m_height(1u), + m_depth(1u) { } diff --git a/src/ObjLoading/Image/Dx12TextureLoader.h b/src/ObjLoading/Image/Dx12TextureLoader.h index 48306fdfd..5e9c3130b 100644 --- a/src/ObjLoading/Image/Dx12TextureLoader.h +++ b/src/ObjLoading/Image/Dx12TextureLoader.h @@ -1,11 +1,11 @@ #pragma once -#include - -#include "Utils/ClassUtils.h" #include "Image/DxgiFormat.h" -#include "Utils/MemoryManager.h" #include "Image/Texture.h" +#include "Utils/ClassUtils.h" +#include "Utils/MemoryManager.h" + +#include class Dx12TextureLoader { diff --git a/src/ObjLoading/Image/Dx9TextureLoader.h b/src/ObjLoading/Image/Dx9TextureLoader.h index 8af9afd76..0ad0dbae2 100644 --- a/src/ObjLoading/Image/Dx9TextureLoader.h +++ b/src/ObjLoading/Image/Dx9TextureLoader.h @@ -1,11 +1,11 @@ #pragma once -#include - -#include "Utils/ClassUtils.h" #include "Image/D3DFormat.h" -#include "Utils/MemoryManager.h" #include "Image/Texture.h" +#include "Utils/ClassUtils.h" +#include "Utils/MemoryManager.h" + +#include class Dx9TextureLoader { diff --git a/src/ObjLoading/Image/IwiLoader.cpp b/src/ObjLoading/Image/IwiLoader.cpp index c7206de6c..dd707cd8d 100644 --- a/src/ObjLoading/Image/IwiLoader.cpp +++ b/src/ObjLoading/Image/IwiLoader.cpp @@ -1,10 +1,10 @@ #include "IwiLoader.h" +#include "Image/IwiTypes.h" + #include #include -#include "Image/IwiTypes.h" - IwiLoader::IwiLoader(MemoryManager* memoryManager) { m_memory_manager = memoryManager; @@ -33,7 +33,7 @@ const ImageFormat* IwiLoader::GetFormat6(int8_t format) case iwi6::IwiFormat::IMG_FORMAT_BITMAP_LUMINANCE: return &ImageFormat::FORMAT_R8; case iwi6::IwiFormat::IMG_FORMAT_WAVELET_RGBA: // used - case iwi6::IwiFormat::IMG_FORMAT_WAVELET_RGB: // used + case iwi6::IwiFormat::IMG_FORMAT_WAVELET_RGB: // used case iwi6::IwiFormat::IMG_FORMAT_WAVELET_LUMINANCE_ALPHA: case iwi6::IwiFormat::IMG_FORMAT_WAVELET_LUMINANCE: case iwi6::IwiFormat::IMG_FORMAT_WAVELET_ALPHA: @@ -133,7 +133,7 @@ const ImageFormat* IwiLoader::GetFormat8(int8_t format) case iwi8::IwiFormat::IMG_FORMAT_BITMAP_LUMINANCE: return &ImageFormat::FORMAT_R8; case iwi8::IwiFormat::IMG_FORMAT_WAVELET_RGBA: // used - case iwi8::IwiFormat::IMG_FORMAT_WAVELET_RGB: // used + case iwi8::IwiFormat::IMG_FORMAT_WAVELET_RGB: // used case iwi8::IwiFormat::IMG_FORMAT_WAVELET_LUMINANCE_ALPHA: case iwi8::IwiFormat::IMG_FORMAT_WAVELET_LUMINANCE: case iwi8::IwiFormat::IMG_FORMAT_WAVELET_ALPHA: @@ -251,7 +251,7 @@ const ImageFormat* IwiLoader::GetFormat13(int8_t format) case iwi13::IwiFormat::IMG_FORMAT_BITMAP_LUMINANCE: return &ImageFormat::FORMAT_R8; case iwi13::IwiFormat::IMG_FORMAT_WAVELET_RGBA: // used - case iwi13::IwiFormat::IMG_FORMAT_WAVELET_RGB: // used + case iwi13::IwiFormat::IMG_FORMAT_WAVELET_RGB: // used case iwi13::IwiFormat::IMG_FORMAT_WAVELET_LUMINANCE_ALPHA: case iwi13::IwiFormat::IMG_FORMAT_WAVELET_LUMINANCE: case iwi13::IwiFormat::IMG_FORMAT_WAVELET_ALPHA: @@ -448,9 +448,7 @@ Texture* IwiLoader::LoadIwi(std::istream& stream) if (stream.gcount() != sizeof(iwiVersion)) return nullptr; - if (iwiVersion.tag[0] != 'I' - || iwiVersion.tag[1] != 'W' - || iwiVersion.tag[2] != 'i') + if (iwiVersion.tag[0] != 'I' || iwiVersion.tag[1] != 'W' || iwiVersion.tag[2] != 'i') { printf("Invalid IWI magic\n"); } diff --git a/src/ObjLoading/Image/IwiLoader.h b/src/ObjLoading/Image/IwiLoader.h index c06337405..2a01572bb 100644 --- a/src/ObjLoading/Image/IwiLoader.h +++ b/src/ObjLoading/Image/IwiLoader.h @@ -1,8 +1,9 @@ #pragma once -#include -#include "Utils/MemoryManager.h" #include "Image/Texture.h" +#include "Utils/MemoryManager.h" + +#include class IwiLoader { diff --git a/src/ObjLoading/InfoString/InfoStringToStructConverterBase.cpp b/src/ObjLoading/InfoString/InfoStringToStructConverterBase.cpp index 1e4fb97a4..d9d5fb0c3 100644 --- a/src/ObjLoading/InfoString/InfoStringToStructConverterBase.cpp +++ b/src/ObjLoading/InfoString/InfoStringToStructConverterBase.cpp @@ -3,7 +3,10 @@ #include #include -InfoStringToStructConverterBase::InfoStringToStructConverterBase(const InfoString& infoString, void* structure, ZoneScriptStrings& zoneScriptStrings, MemoryManager* memory) +InfoStringToStructConverterBase::InfoStringToStructConverterBase(const InfoString& infoString, + void* structure, + ZoneScriptStrings& zoneScriptStrings, + MemoryManager* memory) : m_info_string(infoString), m_zone_script_strings(zoneScriptStrings), m_memory(memory), @@ -23,14 +26,14 @@ bool InfoStringToStructConverterBase::ParseAsArray(const std::string& value, std valueArray.emplace_back(value, startPos, ci - startPos); startPos = ++ci + 1; } - else if(c == '\n') + else if (c == '\n') { valueArray.emplace_back(value, startPos, ci - startPos); startPos = ci + 1; } } - if(startPos < value.size()) + if (startPos < value.size()) { valueArray.emplace_back(value, startPos, value.size() - startPos); } @@ -117,7 +120,7 @@ bool InfoStringToStructConverterBase::ConvertInt(const std::string& value, const char* endPtr; *reinterpret_cast(reinterpret_cast(m_structure) + offset) = strtol(value.c_str(), &endPtr, 0); - if(endPtr != &value[value.size()]) + if (endPtr != &value[value.size()]) { std::cout << "Failed to parse value \"" << value << "\" as int" << std::endl; return false; @@ -209,22 +212,22 @@ bool InfoStringToStructConverterBase::ConvertScriptString(const std::string& val bool InfoStringToStructConverterBase::ConvertEnumInt(const std::string& value, const size_t offset, const char** enumValues, const size_t enumSize) { - for(auto i = 0u; i < enumSize; i++) + for (auto i = 0u; i < enumSize; i++) { - if(value == enumValues[i]) + if (value == enumValues[i]) { *reinterpret_cast(reinterpret_cast(m_structure) + offset) = static_cast(i); return true; } } - + return false; } std::vector InfoStringToStructConverterBase::GetUsedScriptStrings() const { std::vector scrStringList; - for(auto scrStr : m_used_script_string_list) + for (auto scrStr : m_used_script_string_list) { scrStringList.push_back(scrStr); } diff --git a/src/ObjLoading/InfoString/InfoStringToStructConverterBase.h b/src/ObjLoading/InfoString/InfoStringToStructConverterBase.h index 09380f1b4..d544127a5 100644 --- a/src/ObjLoading/InfoString/InfoStringToStructConverterBase.h +++ b/src/ObjLoading/InfoString/InfoStringToStructConverterBase.h @@ -1,15 +1,15 @@ #pragma once -#include -#include -#include - -#include "Utils/ClassUtils.h" #include "InfoString/InfoString.h" #include "Pool/XAssetInfo.h" +#include "Utils/ClassUtils.h" #include "Utils/MemoryManager.h" #include "Zone/ZoneScriptStrings.h" +#include +#include +#include + class InfoStringToStructConverterBase { protected: @@ -22,7 +22,7 @@ class InfoStringToStructConverterBase static bool ParseAsArray(const std::string& value, std::vector& valueArray); bool ParseAsPairs(const std::string& value, std::vector>& valueArray) const; - + bool ConvertString(const std::string& value, size_t offset); bool ConvertStringBuffer(const std::string& value, size_t offset, size_t bufferSize); bool ConvertInt(const std::string& value, size_t offset); diff --git a/src/ObjLoading/Menu/AbstractMenuConverter.h b/src/ObjLoading/Menu/AbstractMenuConverter.h index c82369501..442e10544 100644 --- a/src/ObjLoading/Menu/AbstractMenuConverter.h +++ b/src/ObjLoading/Menu/AbstractMenuConverter.h @@ -1,10 +1,10 @@ #pragma once -#include "MenuConversionException.h" #include "AssetLoading/IAssetLoadingManager.h" +#include "MenuConversionException.h" #include "SearchPath/ISearchPath.h" -#include "Utils/MemoryManager.h" #include "Utils/ClassUtils.h" +#include "Utils/MemoryManager.h" namespace menu { @@ -23,4 +23,4 @@ namespace menu public: static void PrintConversionExceptionDetails(const MenuConversionException& e); }; -} +} // namespace menu diff --git a/src/ObjLoading/Menu/MenuConversionException.h b/src/ObjLoading/Menu/MenuConversionException.h index 20e32b696..51ddfd0c2 100644 --- a/src/ObjLoading/Menu/MenuConversionException.h +++ b/src/ObjLoading/Menu/MenuConversionException.h @@ -13,4 +13,4 @@ namespace menu explicit MenuConversionException(std::string message, const CommonMenuDef* menu); MenuConversionException(std::string message, const CommonMenuDef* menu, const CommonItemDef* item); }; -} +} // namespace menu diff --git a/src/ObjLoading/ObjContainer/IPak/Exception/IPakLoadException.cpp b/src/ObjLoading/ObjContainer/IPak/Exception/IPakLoadException.cpp index 5d74b7675..938aa62b0 100644 --- a/src/ObjLoading/ObjContainer/IPak/Exception/IPakLoadException.cpp +++ b/src/ObjLoading/ObjContainer/IPak/Exception/IPakLoadException.cpp @@ -13,4 +13,4 @@ const std::string& IPakLoadException::DetailedMessage() const char const* IPakLoadException::what() const noexcept { return "There was an error when trying to load an ipak file."; -} \ No newline at end of file +} diff --git a/src/ObjLoading/ObjContainer/IPak/IPak.cpp b/src/ObjLoading/ObjContainer/IPak/IPak.cpp index c8d6fff16..1f87d471c 100644 --- a/src/ObjLoading/ObjContainer/IPak/IPak.cpp +++ b/src/ObjLoading/ObjContainer/IPak/IPak.cpp @@ -1,16 +1,15 @@ #include "IPak.h" -#include -#include -#include -#include - -#include "zlib.h" - -#include "Utils/FileUtils.h" #include "Exception/IPakLoadException.h" -#include "ObjContainer/IPak/IPakTypes.h" #include "IPakStreamManager.h" +#include "ObjContainer/IPak/IPakTypes.h" +#include "Utils/FileUtils.h" +#include "zlib.h" + +#include +#include +#include +#include namespace fs = std::filesystem; @@ -57,7 +56,8 @@ class IPak::Impl : public ObjContainerReferenceable m_index_entries.push_back(indexEntry); } - std::sort(m_index_entries.begin(), m_index_entries.end(), + std::sort(m_index_entries.begin(), + m_index_entries.end(), [](const IPakIndexEntry& entry1, const IPakIndexEntry& entry2) { return entry1.key.combinedKey < entry2.key.combinedKey; @@ -152,8 +152,7 @@ class IPak::Impl : public ObjContainerReferenceable { } - ~Impl() override - = default; + ~Impl() override = default; std::string GetName() override { diff --git a/src/ObjLoading/ObjContainer/IPak/IPak.h b/src/ObjLoading/ObjContainer/IPak/IPak.h index 1c16633bf..f60c1ba55 100644 --- a/src/ObjLoading/ObjContainer/IPak/IPak.h +++ b/src/ObjLoading/ObjContainer/IPak/IPak.h @@ -1,13 +1,13 @@ #pragma once -#include - -#include "Utils/ClassUtils.h" #include "ObjContainer/ObjContainerReferenceable.h" #include "ObjContainer/ObjContainerRepository.h" +#include "Utils/ClassUtils.h" #include "Utils/ObjStream.h" #include "Zone/Zone.h" +#include + class IPak final : public ObjContainerReferenceable { class Impl; diff --git a/src/ObjLoading/ObjContainer/IPak/IPakEntryReadStream.cpp b/src/ObjLoading/ObjContainer/IPak/IPakEntryReadStream.cpp index f3b5a1edd..711b8773c 100644 --- a/src/ObjLoading/ObjContainer/IPak/IPakEntryReadStream.cpp +++ b/src/ObjLoading/ObjContainer/IPak/IPakEntryReadStream.cpp @@ -1,16 +1,15 @@ #include "IPakEntryReadStream.h" +#include "ObjContainer/IPak/IPakTypes.h" + #include #include - #include -#include "ObjContainer/IPak/IPakTypes.h" - using namespace ipak_consts; -IPakEntryReadStream::IPakEntryReadStream(std::istream& stream, IPakStreamManagerActions* streamManagerActions, - uint8_t* chunkBuffer, const int64_t startOffset, const size_t entrySize) +IPakEntryReadStream::IPakEntryReadStream( + std::istream& stream, IPakStreamManagerActions* streamManagerActions, uint8_t* chunkBuffer, const int64_t startOffset, const size_t entrySize) : m_chunk_buffer(chunkBuffer), m_stream(stream), m_stream_manager_actions(streamManagerActions), @@ -85,8 +84,8 @@ bool IPakEntryReadStream::SetChunkBufferWindow(const int64_t startPos, size_t ch // Check whether we need to load additional data that was not previously loaded if (endPos > m_buffer_end_pos) { - const auto readChunkCount = ReadChunks(&m_chunk_buffer[m_buffer_end_pos - startPos], m_buffer_end_pos, - static_cast(endPos - m_buffer_end_pos) / IPAK_CHUNK_SIZE); + const auto readChunkCount = + ReadChunks(&m_chunk_buffer[m_buffer_end_pos - startPos], m_buffer_end_pos, static_cast(endPos - m_buffer_end_pos) / IPAK_CHUNK_SIZE); m_buffer_end_pos += static_cast(readChunkCount) * IPAK_CHUNK_SIZE; @@ -100,20 +99,18 @@ bool IPakEntryReadStream::SetChunkBufferWindow(const int64_t startPos, size_t ch // Check whether the end position is already part of the loaded data if (endPos > m_buffer_start_pos && endPos <= m_buffer_end_pos) { - assert(IPAK_CHUNK_SIZE * IPAK_CHUNK_COUNT_PER_READ - static_cast(m_buffer_start_pos - startPos) >= static_cast(endPos - m_buffer_start_pos)); + assert(IPAK_CHUNK_SIZE * IPAK_CHUNK_COUNT_PER_READ - static_cast(m_buffer_start_pos - startPos) + >= static_cast(endPos - m_buffer_start_pos)); // Move data to make sure the end is at the appropriate position to be able to load the missing data in the front memmove(&m_chunk_buffer[m_buffer_start_pos - startPos], m_chunk_buffer, static_cast(endPos - m_buffer_start_pos)); // We already established that the start of the buffer is not already loaded so we will need to load additional data nonetheless - const auto readChunkCount = ReadChunks(m_chunk_buffer, - startPos, - static_cast(m_buffer_start_pos - startPos) / IPAK_CHUNK_SIZE); + const auto readChunkCount = ReadChunks(m_chunk_buffer, startPos, static_cast(m_buffer_start_pos - startPos) / IPAK_CHUNK_SIZE); m_buffer_start_pos = startPos; - m_buffer_end_pos = readChunkCount == (m_buffer_start_pos - startPos) / IPAK_CHUNK_SIZE - ? endPos - : startPos + static_cast(readChunkCount) * IPAK_CHUNK_SIZE; + m_buffer_end_pos = + readChunkCount == (m_buffer_start_pos - startPos) / IPAK_CHUNK_SIZE ? endPos : startPos + static_cast(readChunkCount) * IPAK_CHUNK_SIZE; return m_buffer_end_pos == endPos; } @@ -143,8 +140,7 @@ bool IPakEntryReadStream::ValidateBlockHeader(const IPakDataBlockHeader* blockHe { // If compressed is not 0 or 1 it will not be read and therefore it is okay when the offset does not match // The game uses IPAK_COMMAND_SKIP as value for compressed when it intends to skip the specified amount of data - if (blockHeader->commands[currentCommand].compressed == 0 - || blockHeader->commands[currentCommand].compressed == 1) + if (blockHeader->commands[currentCommand].compressed == 0 || blockHeader->commands[currentCommand].compressed == 1) { std::cerr << "IPak block offset (" << blockHeader->countAndOffset.offset << ") is not the file head (" << m_file_head << ") -> Invalid\n"; return false; @@ -192,8 +188,7 @@ bool IPakEntryReadStream::NextBlock() const auto chunkStartPos = AlignBackwards(m_pos, IPAK_CHUNK_SIZE); const auto blockOffsetInChunk = static_cast(m_pos - chunkStartPos); - auto estimatedChunksToRead = AlignForward(m_entry_size - static_cast(m_pos - m_base_pos), IPAK_CHUNK_SIZE) - / IPAK_CHUNK_SIZE; + auto estimatedChunksToRead = AlignForward(m_entry_size - static_cast(m_pos - m_base_pos), IPAK_CHUNK_SIZE) / IPAK_CHUNK_SIZE; if (estimatedChunksToRead > IPAK_CHUNK_COUNT_PER_READ) estimatedChunksToRead = IPAK_CHUNK_COUNT_PER_READ; @@ -222,8 +217,7 @@ bool IPakEntryReadStream::ProcessCommand(const size_t commandSize, const int com if (compressed == 1) { lzo_uint outputSize = sizeof(m_decompress_buffer); - const auto result = lzo1x_decompress_safe(&m_chunk_buffer[m_pos - m_buffer_start_pos], commandSize, - m_decompress_buffer, &outputSize, nullptr); + const auto result = lzo1x_decompress_safe(&m_chunk_buffer[m_pos - m_buffer_start_pos], commandSize, m_decompress_buffer, &outputSize, nullptr); if (result != LZO_E_OK) { @@ -261,8 +255,7 @@ bool IPakEntryReadStream::AdvanceStream() return false; } - ProcessCommand(m_current_block->commands[m_next_command].size, - m_current_block->commands[m_next_command].compressed); + ProcessCommand(m_current_block->commands[m_next_command].size, m_current_block->commands[m_next_command].compressed); m_next_command++; return true; diff --git a/src/ObjLoading/ObjContainer/IPak/IPakEntryReadStream.h b/src/ObjLoading/ObjContainer/IPak/IPakEntryReadStream.h index c8be8e797..a32fb3b91 100644 --- a/src/ObjLoading/ObjContainer/IPak/IPakEntryReadStream.h +++ b/src/ObjLoading/ObjContainer/IPak/IPakEntryReadStream.h @@ -1,10 +1,10 @@ #pragma once -#include - -#include "Utils/ObjStream.h" #include "IPakStreamManager.h" #include "ObjContainer/IPak/IPakTypes.h" +#include "Utils/ObjStream.h" + +#include class IPakEntryReadStream final : public objbuf { @@ -33,14 +33,12 @@ class IPakEntryReadStream final : public objbuf int64_t m_buffer_start_pos; int64_t m_buffer_end_pos; - template - static T AlignForward(const T num, const T alignTo) + template static T AlignForward(const T num, const T alignTo) { return (num + alignTo - 1) / alignTo * alignTo; } - template - static T AlignBackwards(const T num, const T alignTo) + template static T AlignBackwards(const T num, const T alignTo) { return num / alignTo * alignTo; } @@ -86,8 +84,8 @@ class IPakEntryReadStream final : public objbuf /** * \brief Processes a command with the specified parameters at the current position. * \param commandSize The size of the command data - * \param compressed The compression value of the command. Can be \c 0 for uncompressed or \c 1 for lzo compression. Any other value skips the specified size of data. - * \return \c true if the specified command could be correctly processed or \c otherwise. + * \param compressed The compression value of the command. Can be \c 0 for uncompressed or \c 1 for lzo compression. Any other value skips the specified + * size of data. \return \c true if the specified command could be correctly processed or \c otherwise. */ bool ProcessCommand(size_t commandSize, int compressed); diff --git a/src/ObjLoading/ObjContainer/IPak/IPakStreamManager.cpp b/src/ObjLoading/ObjContainer/IPak/IPakStreamManager.cpp index 71e2e8248..546b621a1 100644 --- a/src/ObjLoading/ObjContainer/IPak/IPakStreamManager.cpp +++ b/src/ObjLoading/ObjContainer/IPak/IPakStreamManager.cpp @@ -1,11 +1,11 @@ #include "IPakStreamManager.h" -#include -#include - #include "IPakEntryReadStream.h" #include "ObjContainer/IPak/IPakTypes.h" +#include +#include + using namespace ipak_consts; class IPakStreamManager::Impl final : public IPakStreamManagerActions @@ -71,10 +71,12 @@ class IPakStreamManager::Impl final : public IPakStreamManagerActions m_stream_mutex.lock(); ChunkBuffer* reservedChunkBuffer; - const auto freeChunkBuffer = std::find_if(m_chunk_buffers.begin(), m_chunk_buffers.end(), [](ChunkBuffer* chunkBuffer) - { - return chunkBuffer->m_using_stream == nullptr; - }); + const auto freeChunkBuffer = std::find_if(m_chunk_buffers.begin(), + m_chunk_buffers.end(), + [](ChunkBuffer* chunkBuffer) + { + return chunkBuffer->m_using_stream == nullptr; + }); if (freeChunkBuffer == m_chunk_buffers.end()) { @@ -109,10 +111,12 @@ class IPakStreamManager::Impl final : public IPakStreamManagerActions { m_stream_mutex.lock(); - const auto openStreamEntry = std::find_if(m_open_streams.begin(), m_open_streams.end(), [stream](const ManagedStream& managedStream) - { - return managedStream.m_stream == stream; - }); + const auto openStreamEntry = std::find_if(m_open_streams.begin(), + m_open_streams.end(), + [stream](const ManagedStream& managedStream) + { + return managedStream.m_stream == stream; + }); if (openStreamEntry != m_open_streams.end()) { diff --git a/src/ObjLoading/ObjContainer/IPak/IPakStreamManager.h b/src/ObjLoading/ObjContainer/IPak/IPakStreamManager.h index 9de19c5c0..fc4b2904b 100644 --- a/src/ObjLoading/ObjContainer/IPak/IPakStreamManager.h +++ b/src/ObjLoading/ObjContainer/IPak/IPakStreamManager.h @@ -1,12 +1,12 @@ #pragma once -#include -#include -#include - #include "Utils/ClassUtils.h" #include "Utils/ObjStream.h" +#include +#include +#include + class IPakStreamManagerActions { public: @@ -31,4 +31,4 @@ class IPakStreamManager IPakStreamManager& operator=(IPakStreamManager&& other) noexcept = delete; _NODISCARD std::unique_ptr OpenStream(int64_t startPosition, size_t length) const; -}; \ No newline at end of file +}; diff --git a/src/ObjLoading/ObjContainer/IWD/IWD.cpp b/src/ObjLoading/ObjContainer/IWD/IWD.cpp index 2ec1c3ba7..55be6e2a7 100644 --- a/src/ObjLoading/ObjContainer/IWD/IWD.cpp +++ b/src/ObjLoading/ObjContainer/IWD/IWD.cpp @@ -3,12 +3,12 @@ #include "ObjLoading.h" #include "Utils/FileToZlibWrapper.h" -#include -#include #include -#include +#include #include +#include #include +#include namespace fs = std::filesystem; diff --git a/src/ObjLoading/ObjContainer/IWD/IWD.h b/src/ObjLoading/ObjContainer/IWD/IWD.h index 26a29680e..843227105 100644 --- a/src/ObjLoading/ObjContainer/IWD/IWD.h +++ b/src/ObjLoading/ObjContainer/IWD/IWD.h @@ -1,11 +1,11 @@ #pragma once -#include - +#include "ObjContainer/ObjContainerRepository.h" +#include "SearchPath/ISearchPath.h" #include "Utils/ClassUtils.h" #include "Utils/ObjStream.h" -#include "SearchPath/ISearchPath.h" -#include "ObjContainer/ObjContainerRepository.h" + +#include class IWD final : public ISearchPath, IObjContainer { @@ -33,4 +33,4 @@ class IWD final : public ISearchPath, IObjContainer std::string GetPath() override; std::string GetName() override; void Find(const SearchPathSearchOptions& options, const std::function& callback) override; -}; \ No newline at end of file +}; diff --git a/src/ObjLoading/ObjContainer/ObjContainerRepository.h b/src/ObjLoading/ObjContainer/ObjContainerRepository.h index f7b13470d..1f4fc27f7 100644 --- a/src/ObjLoading/ObjContainer/ObjContainerRepository.h +++ b/src/ObjLoading/ObjContainer/ObjContainerRepository.h @@ -4,13 +4,12 @@ #include "Utils/TransformIterator.h" #include +#include +#include #include #include -#include -#include -template -class ObjContainerRepository +template class ObjContainerRepository { class ObjContainerEntry { @@ -49,10 +48,12 @@ class ObjContainerRepository bool AddContainerReference(ContainerType* container, ReferencerType* referencer) { - auto firstEntry = std::find_if(m_containers.begin(), m_containers.end(), [container](const ObjContainerEntry& entry) - { - return entry.m_container.get() == container; - }); + auto firstEntry = std::find_if(m_containers.begin(), + m_containers.end(), + [container](const ObjContainerEntry& entry) + { + return entry.m_container.get() == container; + }); if (firstEntry != m_containers.end()) { @@ -87,10 +88,12 @@ class ObjContainerRepository ContainerType* GetContainerByName(const std::string& name) { - auto foundEntry = std::find_if(m_containers.begin(), m_containers.end(), [name](ObjContainerEntry& entry) - { - return entry.m_container->GetName() == name; - }); + auto foundEntry = std::find_if(m_containers.begin(), + m_containers.end(), + [name](ObjContainerEntry& entry) + { + return entry.m_container->GetName() == name; + }); if (foundEntry != m_containers.end()) { @@ -102,13 +105,19 @@ class ObjContainerRepository TransformIterator::iterator, ObjContainerEntry&, ContainerType*> begin() { - return TransformIterator::iterator, ObjContainerEntry&, ContainerType*>( - m_containers.begin(), [](ObjContainerEntry& entry) { return entry.m_container.get(); }); + return TransformIterator::iterator, ObjContainerEntry&, ContainerType*>(m_containers.begin(), + [](ObjContainerEntry& entry) + { + return entry.m_container.get(); + }); } TransformIterator::iterator, ObjContainerEntry&, ContainerType*> end() { - return TransformIterator::iterator, ObjContainerEntry&, ContainerType*>( - m_containers.end(), [](ObjContainerEntry& entry){ return entry.m_container.get(); }); + return TransformIterator::iterator, ObjContainerEntry&, ContainerType*>(m_containers.end(), + [](ObjContainerEntry& entry) + { + return entry.m_container.get(); + }); } }; diff --git a/src/ObjLoading/ObjContainer/SoundBank/SoundBank.cpp b/src/ObjLoading/ObjContainer/SoundBank/SoundBank.cpp index 7bdaadff9..2c8a5e6a2 100644 --- a/src/ObjLoading/ObjContainer/SoundBank/SoundBank.cpp +++ b/src/ObjLoading/ObjContainer/SoundBank/SoundBank.cpp @@ -1,13 +1,12 @@ #include "SoundBank.h" -#include -#include -#include -#include - +#include "Utils/FileUtils.h" #include "zlib.h" -#include "Utils/FileUtils.h" +#include +#include +#include +#include ObjContainerRepository SoundBank::Repository; @@ -149,7 +148,8 @@ bool SoundBank::ReadHeader() if (m_header.entrySize != sizeof(SoundAssetBankEntry)) { - std::cout << "Invalid sndbank entry size 0x" << std::hex << m_header.entrySize << " (should be 0x" << std::hex << sizeof(SoundAssetBankEntry) << ")" << std::endl; + std::cout << "Invalid sndbank entry size 0x" << std::hex << m_header.entrySize << " (should be 0x" << std::hex << sizeof(SoundAssetBankEntry) << ")" + << std::endl; return false; } @@ -159,8 +159,7 @@ bool SoundBank::ReadHeader() return false; } - if (m_header.entryCount - && (m_header.entryOffset <= 0 || m_header.entryOffset + sizeof(SoundAssetBankEntry) * m_header.entryCount > m_file_size)) + if (m_header.entryCount && (m_header.entryOffset <= 0 || m_header.entryOffset + sizeof(SoundAssetBankEntry) * m_header.entryCount > m_file_size)) { std::cout << "Invalid sndbank entry offset " << m_header.entryOffset << " (filesize is " << m_file_size << ")" << std::endl; return false; @@ -280,9 +279,7 @@ bool SoundBank::Initialize() if (m_initialized) return true; - if (!ReadHeader() - || !ReadEntries() - || !ReadChecksums()) + if (!ReadHeader() || !ReadEntries() || !ReadChecksums()) return false; m_initialized = true; diff --git a/src/ObjLoading/ObjContainer/SoundBank/SoundBank.h b/src/ObjLoading/ObjContainer/SoundBank/SoundBank.h index af0462223..c95586f9f 100644 --- a/src/ObjLoading/ObjContainer/SoundBank/SoundBank.h +++ b/src/ObjLoading/ObjContainer/SoundBank/SoundBank.h @@ -1,16 +1,16 @@ #pragma once -#include - -#include "Utils/ClassUtils.h" #include "ObjContainer/ObjContainerReferenceable.h" #include "ObjContainer/ObjContainerRepository.h" #include "ObjContainer/SoundBank/SoundBankTypes.h" #include "SearchPath/ISearchPath.h" +#include "Utils/ClassUtils.h" #include "Utils/FileUtils.h" #include "Utils/ObjStream.h" #include "Zone/Zone.h" +#include + class SoundBankEntryInputStream { public: diff --git a/src/ObjLoading/ObjContainer/SoundBank/SoundBankTypes.h b/src/ObjLoading/ObjContainer/SoundBank/SoundBankTypes.h index 4254ec8ea..27a305395 100644 --- a/src/ObjLoading/ObjContainer/SoundBank/SoundBankTypes.h +++ b/src/ObjLoading/ObjContainer/SoundBank/SoundBankTypes.h @@ -17,19 +17,19 @@ struct SoundAssetBankChecksum struct SoundAssetBankHeader { - unsigned int magic; // + 0x0 - unsigned int version; // + 0x4 - unsigned int entrySize; // + 0x8 - unsigned int checksumSize; // + 0xC - unsigned int dependencySize; // + 0x10 - unsigned int entryCount; // + 0x14 - unsigned int dependencyCount; // + 0x18 - unsigned int pad32; // + 0x1C - int64_t fileSize; // + 0x20 - int64_t entryOffset; // + 0x28 - int64_t checksumOffset; // + 0x30 - SoundAssetBankChecksum checksumChecksum; // + 0x38 - char dependencies[512]; // + 0x48 + unsigned int magic; // + 0x0 + unsigned int version; // + 0x4 + unsigned int entrySize; // + 0x8 + unsigned int checksumSize; // + 0xC + unsigned int dependencySize; // + 0x10 + unsigned int entryCount; // + 0x14 + unsigned int dependencyCount; // + 0x18 + unsigned int pad32; // + 0x1C + int64_t fileSize; // + 0x20 + int64_t entryOffset; // + 0x28 + int64_t checksumOffset; // + 0x30 + SoundAssetBankChecksum checksumChecksum; // + 0x38 + char dependencies[512]; // + 0x48 }; struct SoundAssetBankEntry diff --git a/src/ObjLoading/ObjLoading.cpp b/src/ObjLoading/ObjLoading.cpp index 25c86747d..4fe5af417 100644 --- a/src/ObjLoading/ObjLoading.cpp +++ b/src/ObjLoading/ObjLoading.cpp @@ -1,27 +1,20 @@ #include "ObjLoading.h" -#include - -#include "IObjLoader.h" #include "Game/IW3/ObjLoaderIW3.h" #include "Game/IW4/ObjLoaderIW4.h" #include "Game/IW5/ObjLoaderIW5.h" #include "Game/T5/ObjLoaderT5.h" #include "Game/T6/ObjLoaderT6.h" +#include "IObjLoader.h" #include "ObjContainer/IWD/IWD.h" #include "SearchPath/SearchPaths.h" #include "Utils/ObjFileStream.h" +#include + ObjLoading::Configuration_t ObjLoading::Configuration; -const IObjLoader* const OBJ_LOADERS[] -{ - new IW3::ObjLoader(), - new IW4::ObjLoader(), - new IW5::ObjLoader(), - new T5::ObjLoader(), - new T6::ObjLoader() -}; +const IObjLoader* const OBJ_LOADERS[]{new IW3::ObjLoader(), new IW4::ObjLoader(), new IW5::ObjLoader(), new T5::ObjLoader(), new T6::ObjLoader()}; void ObjLoading::LoadReferencedContainersForZone(ISearchPath* searchPath, Zone* zone) { @@ -61,20 +54,21 @@ void ObjLoading::UnloadContainersOfZone(Zone* zone) void ObjLoading::LoadIWDsInSearchPath(ISearchPath* searchPath) { - searchPath->Find(SearchPathSearchOptions().IncludeSubdirectories(false).FilterExtensions("iwd"), [searchPath](const std::string& path) - { - auto file = std::make_unique(path, std::fstream::in | std::fstream::binary); - - if (file->is_open()) - { - auto iwd = std::make_unique(path, std::move(file)); - - if (iwd->Initialize()) - { - IWD::Repository.AddContainer(std::move(iwd), searchPath); - } - } - }); + searchPath->Find(SearchPathSearchOptions().IncludeSubdirectories(false).FilterExtensions("iwd"), + [searchPath](const std::string& path) + { + auto file = std::make_unique(path, std::fstream::in | std::fstream::binary); + + if (file->is_open()) + { + auto iwd = std::make_unique(path, std::move(file)); + + if (iwd->Initialize()) + { + IWD::Repository.AddContainer(std::move(iwd), searchPath); + } + } + }); } void ObjLoading::UnloadIWDsInSearchPath(ISearchPath* searchPath) diff --git a/src/ObjLoading/ObjLoading.h b/src/ObjLoading/ObjLoading.h index 663014c3f..9582a50d1 100644 --- a/src/ObjLoading/ObjLoading.h +++ b/src/ObjLoading/ObjLoading.h @@ -1,9 +1,9 @@ #pragma once #include "AssetLoading/AssetLoadingContext.h" -#include "Zone/Zone.h" #include "SearchPath/ISearchPath.h" #include "SearchPath/SearchPaths.h" +#include "Zone/Zone.h" class ObjLoading { @@ -24,8 +24,8 @@ class ObjLoading static void LoadReferencedContainersForZone(ISearchPath* searchPath, Zone* zone); /** - * \brief Unloads all containers that were referenced by a specified zone. If referenced by more than one zone a container will only be unloaded once all referencing zones were unloaded the container. - * \param zone The zone to unload all referenced containers for. + * \brief Unloads all containers that were referenced by a specified zone. If referenced by more than one zone a container will only be unloaded once all + * referencing zones were unloaded the container. \param zone The zone to unload all referenced containers for. */ static void UnloadContainersOfZone(Zone* zone); diff --git a/src/ObjLoading/Parsing/LocalizeFile/LocalizeFileParser.cpp b/src/ObjLoading/Parsing/LocalizeFile/LocalizeFileParser.cpp index 356e69803..029a2142b 100644 --- a/src/ObjLoading/Parsing/LocalizeFile/LocalizeFileParser.cpp +++ b/src/ObjLoading/Parsing/LocalizeFile/LocalizeFileParser.cpp @@ -15,19 +15,15 @@ LocalizeFileParser::LocalizeFileParser(SimpleLexer* lexer, GameLanguage language const std::vector::sequence_t*>& LocalizeFileParser::GetTestsForState() { - static std::vector tests({ - new SequenceLocalizeFileReference(), - new SequenceLocalizeFileConfig(), - new SequenceLocalizeFileNotes(), - new SequenceLocalizeFileVersion(), - new SequenceLocalizeFileEndMarker(), - new SequenceLocalizeFileLanguageValue(), - new SequenceLocalizeFileConsumeEmptyLines() - }); + static std::vector tests({new SequenceLocalizeFileReference(), + new SequenceLocalizeFileConfig(), + new SequenceLocalizeFileNotes(), + new SequenceLocalizeFileVersion(), + new SequenceLocalizeFileEndMarker(), + new SequenceLocalizeFileLanguageValue(), + new SequenceLocalizeFileConsumeEmptyLines(),}); - static std::vector noTests({ - new SequenceLocalizeFileConsumeEmptyLines() - }); + static std::vector noTests({new SequenceLocalizeFileConsumeEmptyLines(),}); return !m_state->m_end ? tests : noTests; } diff --git a/src/ObjLoading/Parsing/LocalizeFile/LocalizeFileParser.h b/src/ObjLoading/Parsing/LocalizeFile/LocalizeFileParser.h index b730d503f..348e2a9e4 100644 --- a/src/ObjLoading/Parsing/LocalizeFile/LocalizeFileParser.h +++ b/src/ObjLoading/Parsing/LocalizeFile/LocalizeFileParser.h @@ -1,10 +1,10 @@ #pragma once -#include "LocalizeFileParserState.h" #include "Game/GameLanguage.h" +#include "LocalizeFileParserState.h" +#include "Parsing/Impl/AbstractParser.h" #include "Parsing/Simple/SimpleLexer.h" #include "Parsing/Simple/SimpleParserValue.h" -#include "Parsing/Impl/AbstractParser.h" class LocalizeFileParser final : public AbstractParser { diff --git a/src/ObjLoading/Parsing/LocalizeFile/LocalizeFileParserState.h b/src/ObjLoading/Parsing/LocalizeFile/LocalizeFileParserState.h index d8f01b011..9a01bf604 100644 --- a/src/ObjLoading/Parsing/LocalizeFile/LocalizeFileParserState.h +++ b/src/ObjLoading/Parsing/LocalizeFile/LocalizeFileParserState.h @@ -1,10 +1,10 @@ #pragma once -#include -#include - #include "Game/GameLanguage.h" #include "Localize/LocalizeFile.h" +#include +#include + class LocalizeFileParserState { public: diff --git a/src/ObjLoading/Parsing/LocalizeFile/LocalizeFileReader.h b/src/ObjLoading/Parsing/LocalizeFile/LocalizeFileReader.h index 43645efd9..34130c96c 100644 --- a/src/ObjLoading/Parsing/LocalizeFile/LocalizeFileReader.h +++ b/src/ObjLoading/Parsing/LocalizeFile/LocalizeFileReader.h @@ -1,13 +1,13 @@ #pragma once -#include -#include -#include - #include "Game/GameLanguage.h" #include "Localize/LocalizeFile.h" #include "Parsing/IParserLineStream.h" +#include +#include +#include + class LocalizeFileReader { std::string m_file_name; diff --git a/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileConfig.cpp b/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileConfig.cpp index a8c0e2b2d..1a47225a2 100644 --- a/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileConfig.cpp +++ b/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileConfig.cpp @@ -9,10 +9,8 @@ SequenceLocalizeFileConfig::SequenceLocalizeFileConfig() AddMatchers({ create.Keyword("CONFIG"), create.String(), - create.Type(SimpleParserValueType::NEW_LINE) + create.Type(SimpleParserValueType::NEW_LINE), }); } -void SequenceLocalizeFileConfig::ProcessMatch(LocalizeFileParserState* state, SequenceResult& result) const -{ -} +void SequenceLocalizeFileConfig::ProcessMatch(LocalizeFileParserState* state, SequenceResult& result) const {} diff --git a/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileConsumeEmptyLines.cpp b/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileConsumeEmptyLines.cpp index e9fe0e286..57f6a5b45 100644 --- a/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileConsumeEmptyLines.cpp +++ b/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileConsumeEmptyLines.cpp @@ -7,10 +7,8 @@ SequenceLocalizeFileConsumeEmptyLines::SequenceLocalizeFileConsumeEmptyLines() const SimpleMatcherFactory create(this); AddMatchers({ - create.Type(SimpleParserValueType::NEW_LINE) + create.Type(SimpleParserValueType::NEW_LINE), }); } -void SequenceLocalizeFileConsumeEmptyLines::ProcessMatch(LocalizeFileParserState* state, SequenceResult& result) const -{ -} +void SequenceLocalizeFileConsumeEmptyLines::ProcessMatch(LocalizeFileParserState* state, SequenceResult& result) const {} diff --git a/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileEndMarker.cpp b/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileEndMarker.cpp index 960ce3d1b..ef32331f0 100644 --- a/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileEndMarker.cpp +++ b/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileEndMarker.cpp @@ -7,7 +7,7 @@ SequenceLocalizeFileEndMarker::SequenceLocalizeFileEndMarker() const SimpleMatcherFactory create(this); AddMatchers({ - create.Keyword("ENDMARKER") + create.Keyword("ENDMARKER"), }); } diff --git a/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileLanguageValue.cpp b/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileLanguageValue.cpp index 3362aa6fc..81ce8b4a4 100644 --- a/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileLanguageValue.cpp +++ b/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileLanguageValue.cpp @@ -1,9 +1,9 @@ #include "SequenceLocalizeFileLanguageValue.h" -#include - #include "Parsing/Simple/Matcher/SimpleMatcherFactory.h" +#include + SequenceLocalizeFileLanguageValue::SequenceLocalizeFileLanguageValue() { const SimpleMatcherFactory create(this); @@ -11,7 +11,7 @@ SequenceLocalizeFileLanguageValue::SequenceLocalizeFileLanguageValue() AddMatchers({ create.KeywordPrefix("LANG_").Capture(CAPTURE_LANGUAGE_NAME), create.String().Capture(CAPTURE_ENTRY_VALUE), - create.Type(SimpleParserValueType::NEW_LINE) + create.Type(SimpleParserValueType::NEW_LINE), }); } @@ -22,7 +22,7 @@ void SequenceLocalizeFileLanguageValue::ProcessMatch(LocalizeFileParserState* st const auto langName = langToken.IdentifierValue().substr(std::char_traits::length("LANG_")); const auto alreadyDefinedLanguage = state->m_current_reference_languages.find(langName); - if(alreadyDefinedLanguage != state->m_current_reference_languages.end()) + if (alreadyDefinedLanguage != state->m_current_reference_languages.end()) { std::ostringstream str; str << "Value for reference \"" << state->m_current_reference << "\" already defined for language \"" << langToken.IdentifierValue() << "\""; @@ -30,6 +30,6 @@ void SequenceLocalizeFileLanguageValue::ProcessMatch(LocalizeFileParserState* st } state->m_current_reference_languages.emplace(langName); - if(langName == state->m_language_name_caps) + if (langName == state->m_language_name_caps) state->m_entries.emplace_back(state->m_current_reference, valueToken.StringValue()); } diff --git a/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileNotes.cpp b/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileNotes.cpp index f00d45ec7..998cb509a 100644 --- a/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileNotes.cpp +++ b/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileNotes.cpp @@ -9,10 +9,8 @@ SequenceLocalizeFileNotes::SequenceLocalizeFileNotes() AddMatchers({ create.Keyword("FILENOTES"), create.String(), - create.Type(SimpleParserValueType::NEW_LINE) + create.Type(SimpleParserValueType::NEW_LINE), }); } -void SequenceLocalizeFileNotes::ProcessMatch(LocalizeFileParserState* state, SequenceResult& result) const -{ -} +void SequenceLocalizeFileNotes::ProcessMatch(LocalizeFileParserState* state, SequenceResult& result) const {} diff --git a/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileReference.cpp b/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileReference.cpp index 0b0dc73f8..9767a1bae 100644 --- a/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileReference.cpp +++ b/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileReference.cpp @@ -8,11 +8,8 @@ SequenceLocalizeFileReference::SequenceLocalizeFileReference() AddMatchers({ create.Keyword("REFERENCE"), - create.Or({ - create.Identifier(), - create.String() - }).Capture(CAPTURE_REFERENCE_NAME), - create.Type(SimpleParserValueType::NEW_LINE) + create.Or({create.Identifier(), create.String(),}).Capture(CAPTURE_REFERENCE_NAME), + create.Type(SimpleParserValueType::NEW_LINE), }); } diff --git a/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileVersion.cpp b/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileVersion.cpp index 0f195c615..cfa18b1dd 100644 --- a/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileVersion.cpp +++ b/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileVersion.cpp @@ -9,14 +9,14 @@ SequenceLocalizeFileVersion::SequenceLocalizeFileVersion() AddMatchers({ create.Keyword("VERSION"), create.String().Capture(CAPTURE_VERSION), - create.Type(SimpleParserValueType::NEW_LINE) + create.Type(SimpleParserValueType::NEW_LINE), }); } void SequenceLocalizeFileVersion::ProcessMatch(LocalizeFileParserState* state, SequenceResult& result) const { const auto& versionCapture = result.NextCapture(CAPTURE_VERSION); - if(versionCapture.StringValue() != "1") + if (versionCapture.StringValue() != "1") { throw ParsingException(versionCapture.GetPos(), "Localize file needs to be version 1"); } diff --git a/src/ObjLoading/Parsing/Menu/Domain/CommonFunctionDef.h b/src/ObjLoading/Parsing/Menu/Domain/CommonFunctionDef.h index a9ec384d7..b30f8bc60 100644 --- a/src/ObjLoading/Parsing/Menu/Domain/CommonFunctionDef.h +++ b/src/ObjLoading/Parsing/Menu/Domain/CommonFunctionDef.h @@ -1,9 +1,9 @@ #pragma once -#include - #include "Parsing/Simple/Expression/ISimpleExpression.h" +#include + namespace menu { class CommonFunctionDef @@ -12,4 +12,4 @@ namespace menu std::string m_name; std::unique_ptr m_value; }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Domain/CommonItemDef.h b/src/ObjLoading/Parsing/Menu/Domain/CommonItemDef.h index 8960b4a22..7ec80e306 100644 --- a/src/ObjLoading/Parsing/Menu/Domain/CommonItemDef.h +++ b/src/ObjLoading/Parsing/Menu/Domain/CommonItemDef.h @@ -1,12 +1,12 @@ #pragma once -#include -#include - #include "CommonMenuTypes.h" #include "EventHandler/CommonEventHandlerSet.h" #include "Parsing/Simple/Expression/ISimpleExpression.h" +#include +#include + namespace menu { enum class CommonItemFeatureType @@ -163,4 +163,4 @@ namespace menu std::string m_enum_dvar_name; std::unique_ptr m_news_ticker_features; }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Domain/CommonMenuDef.h b/src/ObjLoading/Parsing/Menu/Domain/CommonMenuDef.h index 43a8872bf..07b6b7d05 100644 --- a/src/ObjLoading/Parsing/Menu/Domain/CommonMenuDef.h +++ b/src/ObjLoading/Parsing/Menu/Domain/CommonMenuDef.h @@ -1,15 +1,15 @@ #pragma once -#include -#include -#include -#include - #include "CommonItemDef.h" #include "CommonMenuTypes.h" #include "EventHandler/CommonEventHandlerSet.h" #include "Parsing/Simple/Expression/ISimpleExpression.h" +#include +#include +#include +#include + namespace menu { class CommonMenuDef @@ -63,4 +63,4 @@ namespace menu std::vector> m_items; }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Domain/CommonMenuTypes.cpp b/src/ObjLoading/Parsing/Menu/Domain/CommonMenuTypes.cpp index 4e061a9a3..1aa86dc87 100644 --- a/src/ObjLoading/Parsing/Menu/Domain/CommonMenuTypes.cpp +++ b/src/ObjLoading/Parsing/Menu/Domain/CommonMenuTypes.cpp @@ -1,7 +1,7 @@ #include "CommonMenuTypes.h" -#include #include +#include using namespace menu; @@ -25,10 +25,8 @@ CommonColor::CommonColor(const double r, const double g, const double b, const d bool CommonColor::Equals(const CommonColor& other) const { - return std::fabs(this->r - other.r) < std::numeric_limits::epsilon() - && std::fabs(this->g - other.g) < std::numeric_limits::epsilon() - && std::fabs(this->b - other.b) < std::numeric_limits::epsilon() - && std::fabs(this->a - other.a) < std::numeric_limits::epsilon(); + return std::fabs(this->r - other.r) < std::numeric_limits::epsilon() && std::fabs(this->g - other.g) < std::numeric_limits::epsilon() + && std::fabs(this->b - other.b) < std::numeric_limits::epsilon() && std::fabs(this->a - other.a) < std::numeric_limits::epsilon(); } CommonRect::CommonRect() diff --git a/src/ObjLoading/Parsing/Menu/Domain/CommonMenuTypes.h b/src/ObjLoading/Parsing/Menu/Domain/CommonMenuTypes.h index 0331be3d6..75b0597b7 100644 --- a/src/ObjLoading/Parsing/Menu/Domain/CommonMenuTypes.h +++ b/src/ObjLoading/Parsing/Menu/Domain/CommonMenuTypes.h @@ -11,6 +11,7 @@ namespace menu double b; double a; }; + double array[4]; CommonColor(); @@ -32,4 +33,4 @@ namespace menu CommonRect(double x, double y, double w, double h); CommonRect(double x, double y, double w, double h, int horizontalAlign, int verticalAlign); }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerCondition.cpp b/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerCondition.cpp index 2de327614..fe2b07ff6 100644 --- a/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerCondition.cpp +++ b/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerCondition.cpp @@ -2,10 +2,10 @@ using namespace menu; -CommonEventHandlerCondition::CommonEventHandlerCondition() -= default; +CommonEventHandlerCondition::CommonEventHandlerCondition() = default; -CommonEventHandlerCondition::CommonEventHandlerCondition(std::unique_ptr condition, std::unique_ptr conditionElements, +CommonEventHandlerCondition::CommonEventHandlerCondition(std::unique_ptr condition, + std::unique_ptr conditionElements, std::unique_ptr elseElements) : m_condition(std::move(condition)), m_condition_elements(std::move(conditionElements)), diff --git a/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerCondition.h b/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerCondition.h index 8d581411b..92065f324 100644 --- a/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerCondition.h +++ b/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerCondition.h @@ -1,11 +1,11 @@ #pragma once -#include - #include "CommonEventHandlerSet.h" #include "ICommonEventHandlerElement.h" #include "Parsing/Simple/Expression/ISimpleExpression.h" +#include + namespace menu { class CommonEventHandlerCondition final : public ICommonEventHandlerElement @@ -16,9 +16,10 @@ namespace menu std::unique_ptr m_else_elements; CommonEventHandlerCondition(); - CommonEventHandlerCondition(std::unique_ptr condition, std::unique_ptr conditionElements, + CommonEventHandlerCondition(std::unique_ptr condition, + std::unique_ptr conditionElements, std::unique_ptr elseElements); _NODISCARD CommonEventHandlerElementType GetType() const override; }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerScript.cpp b/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerScript.cpp index 7ce35e88e..0e03c502e 100644 --- a/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerScript.cpp +++ b/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerScript.cpp @@ -2,8 +2,7 @@ using namespace menu; -CommonEventHandlerScript::CommonEventHandlerScript() -= default; +CommonEventHandlerScript::CommonEventHandlerScript() = default; CommonEventHandlerScript::CommonEventHandlerScript(std::string script) : m_script(std::move(script)) diff --git a/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerScript.h b/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerScript.h index c6ec72d04..591933323 100644 --- a/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerScript.h +++ b/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerScript.h @@ -1,9 +1,9 @@ #pragma once -#include - #include "ICommonEventHandlerElement.h" +#include + namespace menu { class CommonEventHandlerScript final : public ICommonEventHandlerElement @@ -16,4 +16,4 @@ namespace menu _NODISCARD CommonEventHandlerElementType GetType() const override; }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerSet.cpp b/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerSet.cpp index bb7fd3dad..726904837 100644 --- a/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerSet.cpp +++ b/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerSet.cpp @@ -2,8 +2,7 @@ using namespace menu; -CommonEventHandlerSet::CommonEventHandlerSet() -= default; +CommonEventHandlerSet::CommonEventHandlerSet() = default; CommonEventHandlerSet::CommonEventHandlerSet(std::vector> elements) : m_elements(std::move(elements)) diff --git a/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerSet.h b/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerSet.h index ac4da860f..f702a224a 100644 --- a/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerSet.h +++ b/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerSet.h @@ -1,10 +1,10 @@ #pragma once +#include "ICommonEventHandlerElement.h" + #include #include -#include "ICommonEventHandlerElement.h" - namespace menu { class CommonEventHandlerSet @@ -15,4 +15,4 @@ namespace menu CommonEventHandlerSet(); explicit CommonEventHandlerSet(std::vector> elements); }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerSetLocalVar.h b/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerSetLocalVar.h index 69324a517..10d995206 100644 --- a/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerSetLocalVar.h +++ b/src/ObjLoading/Parsing/Menu/Domain/EventHandler/CommonEventHandlerSetLocalVar.h @@ -1,10 +1,10 @@ #pragma once -#include -#include - #include "ICommonEventHandlerElement.h" #include "Parsing/Simple/Expression/ISimpleExpression.h" +#include +#include + namespace menu { enum class SetLocalVarType @@ -28,4 +28,4 @@ namespace menu _NODISCARD CommonEventHandlerElementType GetType() const override; }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Domain/EventHandler/ICommonEventHandlerElement.h b/src/ObjLoading/Parsing/Menu/Domain/EventHandler/ICommonEventHandlerElement.h index 18e9bb342..da24ac956 100644 --- a/src/ObjLoading/Parsing/Menu/Domain/EventHandler/ICommonEventHandlerElement.h +++ b/src/ObjLoading/Parsing/Menu/Domain/EventHandler/ICommonEventHandlerElement.h @@ -25,4 +25,4 @@ namespace menu _NODISCARD virtual CommonEventHandlerElementType GetType() const = 0; }; -} \ No newline at end of file +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionBaseFunctionCall.cpp b/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionBaseFunctionCall.cpp index 79a269d77..1adbacff4 100644 --- a/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionBaseFunctionCall.cpp +++ b/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionBaseFunctionCall.cpp @@ -12,9 +12,7 @@ bool CommonExpressionBaseFunctionCall::Equals(const ISimpleExpression* other) co { const auto otherFunctionCall = dynamic_cast(other); - if (!otherFunctionCall - || m_function_name != otherFunctionCall->m_function_name - || m_function_index != otherFunctionCall->m_function_index + if (!otherFunctionCall || m_function_name != otherFunctionCall->m_function_name || m_function_index != otherFunctionCall->m_function_index || m_args.size() != otherFunctionCall->m_args.size()) { return false; diff --git a/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionBaseFunctionCall.h b/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionBaseFunctionCall.h index f558e02ee..a04a16403 100644 --- a/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionBaseFunctionCall.h +++ b/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionBaseFunctionCall.h @@ -1,8 +1,8 @@ #pragma once -#include - #include "Parsing/Simple/Expression/ISimpleExpression.h" +#include + namespace menu { class CommonExpressionBaseFunctionCall final : public ISimpleExpression @@ -19,4 +19,4 @@ namespace menu _NODISCARD SimpleExpressionValue EvaluateStatic() const override; _NODISCARD SimpleExpressionValue EvaluateNonStatic(const ISimpleExpressionScopeValues* scopeValues) const override; }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionCustomFunctionCall.h b/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionCustomFunctionCall.h index f226c0986..4c62886ae 100644 --- a/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionCustomFunctionCall.h +++ b/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionCustomFunctionCall.h @@ -16,4 +16,4 @@ namespace menu _NODISCARD SimpleExpressionValue EvaluateStatic() const override; _NODISCARD SimpleExpressionValue EvaluateNonStatic(const ISimpleExpressionScopeValues* scopeValues) const override; }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Domain/MenuFeatureLevel.h b/src/ObjLoading/Parsing/Menu/Domain/MenuFeatureLevel.h index 8fb8c5e72..350901804 100644 --- a/src/ObjLoading/Parsing/Menu/Domain/MenuFeatureLevel.h +++ b/src/ObjLoading/Parsing/Menu/Domain/MenuFeatureLevel.h @@ -7,4 +7,4 @@ namespace menu IW4, IW5 }; -} \ No newline at end of file +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Domain/MenuParsingResult.h b/src/ObjLoading/Parsing/Menu/Domain/MenuParsingResult.h index 46c022974..8c02b63f5 100644 --- a/src/ObjLoading/Parsing/Menu/Domain/MenuParsingResult.h +++ b/src/ObjLoading/Parsing/Menu/Domain/MenuParsingResult.h @@ -1,11 +1,11 @@ #pragma once -#include -#include - #include "CommonFunctionDef.h" #include "CommonMenuDef.h" +#include +#include + namespace menu { class ParsingResult @@ -15,4 +15,4 @@ namespace menu std::vector> m_functions; std::vector m_menus_to_load; }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Matcher/MenuExpressionMatchers.cpp b/src/ObjLoading/Parsing/Menu/Matcher/MenuExpressionMatchers.cpp index 35e7bf055..915956675 100644 --- a/src/ObjLoading/Parsing/Menu/Matcher/MenuExpressionMatchers.cpp +++ b/src/ObjLoading/Parsing/Menu/Matcher/MenuExpressionMatchers.cpp @@ -1,10 +1,10 @@ #include "MenuExpressionMatchers.h" -#include "MenuMatcherFactory.h" #include "Game/IW4/IW4.h" -#include "Game/IW5/IW5.h" #include "Game/IW4/MenuConstantsIW4.h" +#include "Game/IW5/IW5.h" #include "Game/IW5/MenuConstantsIW5.h" +#include "MenuMatcherFactory.h" #include "Parsing/Menu/Domain/Expression/CommonExpressionBaseFunctionCall.h" #include "Parsing/Menu/Domain/Expression/CommonExpressionCustomFunctionCall.h" @@ -30,45 +30,40 @@ std::unique_ptr MenuExpressionMatchers::Par { const MenuMatcherFactory create(labelSupplier); - return create.Or({ - create.And({ - create.Identifier().Capture(CAPTURE_FUNCTION_NAME), - create.Char('('), - create.Optional(create.And({ - create.Label(LABEL_EXPRESSION), - create.OptionalLoop(create.And({ - create.Char(','), - create.Label(LABEL_EXPRESSION) - })), - })), - create.Char(')').Tag(TAG_EXPRESSION_FUNCTION_CALL_END) - }).Tag(TAG_EXPRESSION_FUNCTION_CALL) - }); + return create.Or({create + .And({create.Identifier().Capture(CAPTURE_FUNCTION_NAME), + create.Char('('), + create.Optional(create.And({ + create.Label(LABEL_EXPRESSION), + create.OptionalLoop(create.And({create.Char(','), create.Label(LABEL_EXPRESSION)})), + })), + create.Char(')').Tag(TAG_EXPRESSION_FUNCTION_CALL_END)}) + .Tag(TAG_EXPRESSION_FUNCTION_CALL)}); } const std::map& MenuExpressionMatchers::GetBaseFunctionMapForFeatureLevel(const FeatureLevel featureLevel) { - if(featureLevel == FeatureLevel::IW4) + if (featureLevel == FeatureLevel::IW4) { static std::map iw4FunctionMap; static bool iw4FunctionMapInitialized = false; - if(!iw4FunctionMapInitialized) + if (!iw4FunctionMapInitialized) { - for(size_t i = IW4::expressionFunction_e::EXP_FUNC_DYN_START; i < std::extent_v; i++) + for (size_t i = IW4::expressionFunction_e::EXP_FUNC_DYN_START; i < std::extent_v; i++) iw4FunctionMap.emplace(std::make_pair(IW4::g_expFunctionNames[i], i)); } return iw4FunctionMap; } - if(featureLevel == FeatureLevel::IW5) + if (featureLevel == FeatureLevel::IW5) { static std::map iw5FunctionMap; static bool iw5FunctionMapInitialized = false; - if(!iw5FunctionMapInitialized) + if (!iw5FunctionMapInitialized) { - for(size_t i = IW5::expressionFunction_e::EXP_FUNC_DYN_START; i < std::extent_v; i++) + for (size_t i = IW5::expressionFunction_e::EXP_FUNC_DYN_START; i < std::extent_v; i++) iw5FunctionMap.emplace(std::make_pair(IW5::g_expFunctionNames[i], i)); } @@ -82,7 +77,7 @@ const std::map& MenuExpressionMatchers::GetBaseFunctionMapF std::unique_ptr MenuExpressionMatchers::ProcessOperandExtension(SequenceResult& result) const { assert(m_state); - if(m_state == nullptr) + if (m_state == nullptr) throw ParsingException(TokenPos(), "No state when processing menu operand extension!!"); if (result.PeekAndRemoveIfTag(TAG_EXPRESSION_FUNCTION_CALL) != TAG_EXPRESSION_FUNCTION_CALL) @@ -93,7 +88,7 @@ std::unique_ptr MenuExpressionMatchers::ProcessOperandExtensi const auto& baseFunctionMap = GetBaseFunctionMapForFeatureLevel(m_state->m_feature_level); const auto foundBaseFunction = baseFunctionMap.find(functionCallName); - if(foundBaseFunction != baseFunctionMap.end()) + if (foundBaseFunction != baseFunctionMap.end()) { auto functionCall = std::make_unique(std::move(functionCallName), foundBaseFunction->second); while (result.PeekAndRemoveIfTag(TAG_EXPRESSION_FUNCTION_CALL_END) != TAG_EXPRESSION_FUNCTION_CALL_END) @@ -104,11 +99,11 @@ std::unique_ptr MenuExpressionMatchers::ProcessOperandExtensi } const auto foundCustomFunction = m_state->m_functions_by_name.find(functionCallName); - if(foundCustomFunction != m_state->m_functions_by_name.end()) + if (foundCustomFunction != m_state->m_functions_by_name.end()) { auto functionCall = std::make_unique(std::move(functionCallName)); - if(result.PeekAndRemoveIfTag(TAG_EXPRESSION_FUNCTION_CALL_END) != TAG_EXPRESSION_FUNCTION_CALL_END) + if (result.PeekAndRemoveIfTag(TAG_EXPRESSION_FUNCTION_CALL_END) != TAG_EXPRESSION_FUNCTION_CALL_END) throw ParsingException(functionCallToken.GetPos(), "Custom functions cannot be called with arguments"); return std::move(functionCall); diff --git a/src/ObjLoading/Parsing/Menu/Matcher/MenuExpressionMatchers.h b/src/ObjLoading/Parsing/Menu/Matcher/MenuExpressionMatchers.h index b6821fced..4704c6ede 100644 --- a/src/ObjLoading/Parsing/Menu/Matcher/MenuExpressionMatchers.h +++ b/src/ObjLoading/Parsing/Menu/Matcher/MenuExpressionMatchers.h @@ -1,10 +1,10 @@ #pragma once -#include - #include "Parsing/Menu/MenuFileParserState.h" #include "Parsing/Simple/Expression/SimpleExpressionMatchers.h" +#include + namespace menu { class MenuExpressionMatchers final : public SimpleExpressionMatchers @@ -21,4 +21,4 @@ namespace menu std::unique_ptr ParseOperandExtension(const supplier_t* labelSupplier) const override; std::unique_ptr ProcessOperandExtension(SequenceResult& result) const override; }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherFactory.cpp b/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherFactory.cpp index b857c6f4a..f6fefcefd 100644 --- a/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherFactory.cpp +++ b/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherFactory.cpp @@ -1,9 +1,9 @@ #include "MenuMatcherFactory.h" -#include - #include "MenuExpressionMatchers.h" +#include + using namespace menu; MenuMatcherFactory::MenuMatcherFactory(const IMatcherForLabelSupplier* labelSupplier) @@ -13,23 +13,20 @@ MenuMatcherFactory::MenuMatcherFactory(const IMatcherForLabelSupplier MenuMatcherFactory::StringChain() const { - return Or({ - And({ - String(), - Loop(String()) - }).Transform([](const token_list_t& tokens) -> SimpleParserValue - { - std::ostringstream ss; - - for (const auto& token : tokens) - { - ss << token.get().StringValue(); - } - - return SimpleParserValue::String(tokens[0].get().GetPos(), new std::string(ss.str())); - }), - String() - }); + return Or({And({String(), Loop(String())}) + .Transform( + [](const token_list_t& tokens) -> SimpleParserValue + { + std::ostringstream ss; + + for (const auto& token : tokens) + { + ss << token.get().StringValue(); + } + + return SimpleParserValue::String(tokens[0].get().GetPos(), new std::string(ss.str())); + }), + String()}); } MatcherFactoryWrapper MenuMatcherFactory::Text() const @@ -49,26 +46,24 @@ MatcherFactoryWrapper MenuMatcherFactory::Numeric() const MatcherFactoryWrapper MenuMatcherFactory::IntExpression() const { - return MatcherFactoryWrapper(Or({ - Integer().Tag(TAG_INT).Capture(CAPTURE_INT), - And({ - Char('(').Capture(CAPTURE_FIRST_TOKEN), - Label(MenuExpressionMatchers::LABEL_EXPRESSION), - Char(')'), - }).Tag(TAG_EXPRESSION) - })); + return MatcherFactoryWrapper(Or({Integer().Tag(TAG_INT).Capture(CAPTURE_INT), + And({ + Char('(').Capture(CAPTURE_FIRST_TOKEN), + Label(MenuExpressionMatchers::LABEL_EXPRESSION), + Char(')'), + }) + .Tag(TAG_EXPRESSION)})); } MatcherFactoryWrapper MenuMatcherFactory::NumericExpression() const { - return MatcherFactoryWrapper(Or({ - Numeric().Tag(TAG_NUMERIC).Capture(CAPTURE_NUMERIC), - And({ - Char('(').Capture(CAPTURE_FIRST_TOKEN), - Label(MenuExpressionMatchers::LABEL_EXPRESSION), - Char(')'), - }).Tag(TAG_EXPRESSION) - })); + return MatcherFactoryWrapper(Or({Numeric().Tag(TAG_NUMERIC).Capture(CAPTURE_NUMERIC), + And({ + Char('(').Capture(CAPTURE_FIRST_TOKEN), + Label(MenuExpressionMatchers::LABEL_EXPRESSION), + Char(')'), + }) + .Tag(TAG_EXPRESSION)})); } int MenuMatcherFactory::TokenNumericIntValue(const SimpleParserValue& value) diff --git a/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherFactory.h b/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherFactory.h index 4762690b9..c0c8ccf43 100644 --- a/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherFactory.h +++ b/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherFactory.h @@ -1,8 +1,8 @@ #pragma once +#include "Parsing/Menu/MenuFileParserState.h" #include "Parsing/Sequence/SequenceResult.h" #include "Parsing/Simple/Matcher/SimpleMatcherFactory.h" -#include "Parsing/Menu/MenuFileParserState.h" namespace menu { @@ -34,4 +34,4 @@ namespace menu _NODISCARD static int TokenIntExpressionValue(MenuFileParserState* state, SequenceResult& result); _NODISCARD static double TokenNumericExpressionValue(MenuFileParserState* state, SequenceResult& result); }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherScriptInt.cpp b/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherScriptInt.cpp index 1b4a234f3..95baa1463 100644 --- a/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherScriptInt.cpp +++ b/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherScriptInt.cpp @@ -1,7 +1,6 @@ #include "MenuMatcherScriptInt.h" -MenuMatcherScriptInt::MenuMatcherScriptInt() -= default; +MenuMatcherScriptInt::MenuMatcherScriptInt() = default; MatcherResult MenuMatcherScriptInt::CanMatch(ILexer* lexer, const unsigned tokenOffset) { diff --git a/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherScriptInt.h b/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherScriptInt.h index e6ed7e547..0a9ea633a 100644 --- a/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherScriptInt.h +++ b/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherScriptInt.h @@ -1,7 +1,7 @@ #pragma once -#include "Parsing/Simple/SimpleParserValue.h" #include "Parsing/Matcher/AbstractMatcher.h" +#include "Parsing/Simple/SimpleParserValue.h" class MenuMatcherScriptInt final : public AbstractMatcher { diff --git a/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherScriptNumeric.cpp b/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherScriptNumeric.cpp index 969349d2d..8ef625b67 100644 --- a/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherScriptNumeric.cpp +++ b/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherScriptNumeric.cpp @@ -1,7 +1,6 @@ #include "MenuMatcherScriptNumeric.h" -MenuMatcherScriptNumeric::MenuMatcherScriptNumeric() -= default; +MenuMatcherScriptNumeric::MenuMatcherScriptNumeric() = default; MatcherResult MenuMatcherScriptNumeric::CanMatch(ILexer* lexer, const unsigned tokenOffset) { @@ -34,7 +33,7 @@ MatcherResult MenuMatcherScriptNumeric::CanMatch(ILexer::NoMatch(); return MatcherResult::Match(1); diff --git a/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherScriptNumeric.h b/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherScriptNumeric.h index e9325b297..75dfa91fc 100644 --- a/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherScriptNumeric.h +++ b/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherScriptNumeric.h @@ -1,7 +1,7 @@ #pragma once -#include "Parsing/Simple/SimpleParserValue.h" #include "Parsing/Matcher/AbstractMatcher.h" +#include "Parsing/Simple/SimpleParserValue.h" class MenuMatcherScriptNumeric final : public AbstractMatcher { diff --git a/src/ObjLoading/Parsing/Menu/MenuAssetZoneState.h b/src/ObjLoading/Parsing/Menu/MenuAssetZoneState.h index c6e0cadfe..54c503f14 100644 --- a/src/ObjLoading/Parsing/Menu/MenuAssetZoneState.h +++ b/src/ObjLoading/Parsing/Menu/MenuAssetZoneState.h @@ -1,11 +1,11 @@ #pragma once -#include - #include "AssetLoading/IZoneAssetLoaderState.h" #include "Domain/CommonFunctionDef.h" #include "Domain/CommonMenuDef.h" +#include + namespace menu { class MenuAssetZoneState final : public IZoneAssetLoaderState @@ -19,9 +19,9 @@ namespace menu std::map> m_menus_to_load_by_menu; MenuAssetZoneState() = default; - + void AddFunction(std::unique_ptr function); void AddMenu(std::unique_ptr menu); void AddMenusToLoad(std::string menuName, std::vector menusToLoad); }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/MenuFileCommonOperations.cpp b/src/ObjLoading/Parsing/Menu/MenuFileCommonOperations.cpp index 48abf663a..c939a1f5d 100644 --- a/src/ObjLoading/Parsing/Menu/MenuFileCommonOperations.cpp +++ b/src/ObjLoading/Parsing/Menu/MenuFileCommonOperations.cpp @@ -24,4 +24,4 @@ void MenuFileCommonOperations::EnsureIsStringExpression(const MenuFileParserStat if (staticValue.m_type != SimpleExpressionValue::Type::STRING) throw ParsingException(pos, "Expression is expected to be string. Use permissive mode to compile anyway."); } -} \ No newline at end of file +} diff --git a/src/ObjLoading/Parsing/Menu/MenuFileCommonOperations.h b/src/ObjLoading/Parsing/Menu/MenuFileCommonOperations.h index b56c83b56..081e791a5 100644 --- a/src/ObjLoading/Parsing/Menu/MenuFileCommonOperations.h +++ b/src/ObjLoading/Parsing/Menu/MenuFileCommonOperations.h @@ -1,7 +1,7 @@ #pragma once #include "MenuFileParserState.h" -#include "Parsing/TokenPos.h" #include "Parsing/Simple/Expression/ISimpleExpression.h" +#include "Parsing/TokenPos.h" namespace menu { @@ -11,4 +11,4 @@ namespace menu static void EnsureIsNumericExpression(const MenuFileParserState* state, const TokenPos& pos, const ISimpleExpression& expression); static void EnsureIsStringExpression(const MenuFileParserState* state, const TokenPos& pos, const ISimpleExpression& expression); }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/MenuFileParser.h b/src/ObjLoading/Parsing/Menu/MenuFileParser.h index 7e911f7de..f95ee2cc8 100644 --- a/src/ObjLoading/Parsing/Menu/MenuFileParser.h +++ b/src/ObjLoading/Parsing/Menu/MenuFileParser.h @@ -1,11 +1,11 @@ #pragma once #include "MenuAssetZoneState.h" -#include "Utils/ClassUtils.h" #include "MenuFileParserState.h" +#include "Parsing/Impl/AbstractParser.h" #include "Parsing/Simple/SimpleLexer.h" #include "Parsing/Simple/SimpleParserValue.h" -#include "Parsing/Impl/AbstractParser.h" +#include "Utils/ClassUtils.h" namespace menu { @@ -30,4 +30,4 @@ namespace menu MenuFileParser(SimpleLexer* lexer, FeatureLevel featureLevel, bool permissiveMode, const MenuAssetZoneState* zoneState); _NODISCARD MenuFileParserState* GetState() const; }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/MenuFileParserState.h b/src/ObjLoading/Parsing/Menu/MenuFileParserState.h index b01294ebd..7eedb75c5 100644 --- a/src/ObjLoading/Parsing/Menu/MenuFileParserState.h +++ b/src/ObjLoading/Parsing/Menu/MenuFileParserState.h @@ -1,17 +1,17 @@ #pragma once +#include "Domain/CommonFunctionDef.h" +#include "Domain/CommonMenuDef.h" +#include "Domain/EventHandler/CommonEventHandlerCondition.h" +#include "Domain/EventHandler/CommonEventHandlerSet.h" +#include "Domain/MenuFeatureLevel.h" +#include "MenuAssetZoneState.h" + #include #include -#include #include #include - -#include "MenuAssetZoneState.h" -#include "Domain/CommonFunctionDef.h" -#include "Domain/CommonMenuDef.h" -#include "Domain/MenuFeatureLevel.h" -#include "Domain/EventHandler/CommonEventHandlerSet.h" -#include "Domain/EventHandler/CommonEventHandlerCondition.h" +#include namespace menu { @@ -44,7 +44,7 @@ namespace menu CommonMenuDef* m_current_menu; CommonItemDef* m_current_item; CommonEventHandlerSet* m_current_event_handler_set; - + std::ostringstream m_current_script; bool m_current_script_statement_terminated; std::stack m_condition_stack; @@ -53,4 +53,4 @@ namespace menu explicit MenuFileParserState(FeatureLevel featureLevel, bool permissiveMode); MenuFileParserState(FeatureLevel featureLevel, bool permissiveMode, const MenuAssetZoneState* zoneState); }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/MenuFileReader.cpp b/src/ObjLoading/Parsing/Menu/MenuFileReader.cpp index d64eff638..6effb593e 100644 --- a/src/ObjLoading/Parsing/Menu/MenuFileReader.cpp +++ b/src/ObjLoading/Parsing/Menu/MenuFileReader.cpp @@ -1,7 +1,7 @@ #include "MenuFileReader.h" -#include "MenuFileParser.h" #include "Matcher/MenuExpressionMatchers.h" +#include "MenuFileParser.h" #include "Parsing/Impl/CommentRemovingStreamProxy.h" #include "Parsing/Impl/DefinesStreamProxy.h" #include "Parsing/Impl/IncludingStreamProxy.h" @@ -142,7 +142,7 @@ std::unique_ptr MenuFileReader::ReadMenuFile() std::cerr << "Parsing menu file failed!" << std::endl; const auto* parserEndState = parser->GetState(); - if(parserEndState->m_current_event_handler_set && !parserEndState->m_permissive_mode) + if (parserEndState->m_current_event_handler_set && !parserEndState->m_permissive_mode) std::cerr << "You can use the --menu-permissive option to try to compile the event handler script anyway." << std::endl; return nullptr; } diff --git a/src/ObjLoading/Parsing/Menu/MenuFileReader.h b/src/ObjLoading/Parsing/Menu/MenuFileReader.h index 990e5c31f..0947e2d2c 100644 --- a/src/ObjLoading/Parsing/Menu/MenuFileReader.h +++ b/src/ObjLoading/Parsing/Menu/MenuFileReader.h @@ -1,14 +1,14 @@ #pragma once -#include -#include -#include - -#include "MenuFileParserState.h" #include "Domain/MenuFeatureLevel.h" #include "Domain/MenuParsingResult.h" -#include "Parsing/IParserLineStream.h" #include "MenuAssetZoneState.h" +#include "MenuFileParserState.h" +#include "Parsing/IParserLineStream.h" + +#include +#include +#include namespace menu { @@ -43,4 +43,4 @@ namespace menu std::unique_ptr ReadMenuFile(); }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Sequence/EventHandlerSetScopeSequences.cpp b/src/ObjLoading/Parsing/Menu/Sequence/EventHandlerSetScopeSequences.cpp index f4ee4011d..5e919b8cf 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/EventHandlerSetScopeSequences.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/EventHandlerSetScopeSequences.cpp @@ -1,9 +1,5 @@ #include "EventHandlerSetScopeSequences.h" -#include -#include -#include - #include "Generic/GenericStringPropertySequence.h" #include "Parsing/Menu/Domain/EventHandler/CommonEventHandlerScript.h" #include "Parsing/Menu/Domain/EventHandler/CommonEventHandlerSetLocalVar.h" @@ -12,6 +8,10 @@ #include "Parsing/Menu/Matcher/MenuMatcherScriptInt.h" #include "Parsing/Menu/Matcher/MenuMatcherScriptNumeric.h" +#include +#include +#include + using namespace menu; namespace menu @@ -33,113 +33,113 @@ namespace menu _NODISCARD MatcherFactoryWrapper ScriptStrictNumeric() const { - return And({ - MatcherFactoryWrapper(std::make_unique()).Transform([](const token_list_t& tokens)-> SimpleParserValue - { - const auto& firstToken = tokens[0].get(); - - if (firstToken.m_type == SimpleParserValueType::CHARACTER) - { - const auto& secondToken = tokens[1].get(); - if (secondToken.m_type == SimpleParserValueType::INTEGER) - return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(-secondToken.IntegerValue()))); - - std::ostringstream ss; - ss << std::noshowpoint << -firstToken.FloatingPointValue(); - return SimpleParserValue::String(firstToken.GetPos(), new std::string(ss.str())); - } - - if (firstToken.m_type == SimpleParserValueType::INTEGER) - return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(firstToken.IntegerValue()))); - if (firstToken.m_type == SimpleParserValueType::FLOATING_POINT) - { - std::ostringstream ss; - ss << std::noshowpoint << firstToken.FloatingPointValue(); - return SimpleParserValue::String(firstToken.GetPos(), new std::string(ss.str())); - } - return SimpleParserValue::String(firstToken.GetPos(), new std::string(firstToken.StringValue())); - }) - }); + return And({MatcherFactoryWrapper(std::make_unique()) + .Transform( + [](const token_list_t& tokens) -> SimpleParserValue + { + const auto& firstToken = tokens[0].get(); + + if (firstToken.m_type == SimpleParserValueType::CHARACTER) + { + const auto& secondToken = tokens[1].get(); + if (secondToken.m_type == SimpleParserValueType::INTEGER) + return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(-secondToken.IntegerValue()))); + + std::ostringstream ss; + ss << std::noshowpoint << -firstToken.FloatingPointValue(); + return SimpleParserValue::String(firstToken.GetPos(), new std::string(ss.str())); + } + + if (firstToken.m_type == SimpleParserValueType::INTEGER) + return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(firstToken.IntegerValue()))); + if (firstToken.m_type == SimpleParserValueType::FLOATING_POINT) + { + std::ostringstream ss; + ss << std::noshowpoint << firstToken.FloatingPointValue(); + return SimpleParserValue::String(firstToken.GetPos(), new std::string(ss.str())); + } + return SimpleParserValue::String(firstToken.GetPos(), new std::string(firstToken.StringValue())); + })}); } _NODISCARD MatcherFactoryWrapper ScriptNumeric() const { - return Or({ - ScriptStrictNumeric(), - Or({ - Type(SimpleParserValueType::CHARACTER), - Type(SimpleParserValueType::STRING), - Type(SimpleParserValueType::IDENTIFIER), - }).Transform([](const token_list_t& tokens) -> SimpleParserValue - { - return SimpleParserValue::Integer(tokens[0].get().GetPos(), static_cast(ExpectedScriptToken::NUMERIC)); - }) - }); + return Or({ScriptStrictNumeric(), + Or({ + Type(SimpleParserValueType::CHARACTER), + Type(SimpleParserValueType::STRING), + Type(SimpleParserValueType::IDENTIFIER), + }) + .Transform( + [](const token_list_t& tokens) -> SimpleParserValue + { + return SimpleParserValue::Integer(tokens[0].get().GetPos(), static_cast(ExpectedScriptToken::NUMERIC)); + })}); } _NODISCARD MatcherFactoryWrapper ScriptStrictInt() const { - return And({ - MatcherFactoryWrapper(std::make_unique()).Transform([](const token_list_t& tokens)-> SimpleParserValue - { - const auto& firstToken = tokens[0].get(); - - if (firstToken.m_type == SimpleParserValueType::CHARACTER) - return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(-tokens[1].get().IntegerValue()))); - - if (firstToken.m_type == SimpleParserValueType::INTEGER) - return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(firstToken.IntegerValue()))); - return SimpleParserValue::String(firstToken.GetPos(), new std::string(firstToken.StringValue())); - }) - }); + return And({MatcherFactoryWrapper(std::make_unique()) + .Transform( + [](const token_list_t& tokens) -> SimpleParserValue + { + const auto& firstToken = tokens[0].get(); + + if (firstToken.m_type == SimpleParserValueType::CHARACTER) + return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(-tokens[1].get().IntegerValue()))); + + if (firstToken.m_type == SimpleParserValueType::INTEGER) + return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(firstToken.IntegerValue()))); + return SimpleParserValue::String(firstToken.GetPos(), new std::string(firstToken.StringValue())); + })}); } _NODISCARD MatcherFactoryWrapper ScriptChar(const char c) const { - return Or({ - Char(c), - Or({ - Type(SimpleParserValueType::INTEGER), - Type(SimpleParserValueType::FLOATING_POINT), - Type(SimpleParserValueType::STRING), - Type(SimpleParserValueType::IDENTIFIER), - }).Transform([](const token_list_t& tokens) -> SimpleParserValue - { - return SimpleParserValue::Integer(tokens[0].get().GetPos(), static_cast(ExpectedScriptToken::INT)); - }) - }); + return Or({Char(c), + Or({ + Type(SimpleParserValueType::INTEGER), + Type(SimpleParserValueType::FLOATING_POINT), + Type(SimpleParserValueType::STRING), + Type(SimpleParserValueType::IDENTIFIER), + }) + .Transform( + [](const token_list_t& tokens) -> SimpleParserValue + { + return SimpleParserValue::Integer(tokens[0].get().GetPos(), static_cast(ExpectedScriptToken::INT)); + })}); } _NODISCARD MatcherFactoryWrapper ScriptInt() const { - return Or({ - ScriptStrictInt(), - Or({ - Type(SimpleParserValueType::CHARACTER), - Type(SimpleParserValueType::FLOATING_POINT), - Type(SimpleParserValueType::STRING), - Type(SimpleParserValueType::IDENTIFIER), - }).Transform([](const token_list_t& tokens) -> SimpleParserValue - { - return SimpleParserValue::Integer(tokens[0].get().GetPos(), static_cast(ExpectedScriptToken::INT)); - }) - }); + return Or({ScriptStrictInt(), + Or({ + Type(SimpleParserValueType::CHARACTER), + Type(SimpleParserValueType::FLOATING_POINT), + Type(SimpleParserValueType::STRING), + Type(SimpleParserValueType::IDENTIFIER), + }) + .Transform( + [](const token_list_t& tokens) -> SimpleParserValue + { + return SimpleParserValue::Integer(tokens[0].get().GetPos(), static_cast(ExpectedScriptToken::INT)); + })}); } _NODISCARD MatcherFactoryWrapper ScriptText() const { - return Or({ - Type(SimpleParserValueType::STRING), - Type(SimpleParserValueType::IDENTIFIER), - Or({ - Type(SimpleParserValueType::CHARACTER), - Type(SimpleParserValueType::FLOATING_POINT), - Type(SimpleParserValueType::INTEGER), - }).Transform([](const token_list_t& tokens) -> SimpleParserValue - { - return SimpleParserValue::Integer(tokens[0].get().GetPos(), static_cast(ExpectedScriptToken::TEXT)); - }) - }); + return Or({Type(SimpleParserValueType::STRING), + Type(SimpleParserValueType::IDENTIFIER), + Or({ + Type(SimpleParserValueType::CHARACTER), + Type(SimpleParserValueType::FLOATING_POINT), + Type(SimpleParserValueType::INTEGER), + }) + .Transform( + [](const token_list_t& tokens) -> SimpleParserValue + { + return SimpleParserValue::Integer(tokens[0].get().GetPos(), static_cast(ExpectedScriptToken::TEXT)); + })}); } _NODISCARD MatcherFactoryWrapper ScriptKeyword(std::string keyword) const @@ -149,12 +149,7 @@ namespace menu _NODISCARD MatcherFactoryWrapper ScriptColor() const { - return And({ - ScriptStrictNumeric(), - Optional(ScriptStrictNumeric()), - Optional(ScriptStrictNumeric()), - Optional(ScriptStrictNumeric()) - }); + return And({ScriptStrictNumeric(), Optional(ScriptStrictNumeric()), Optional(ScriptStrictNumeric()), Optional(ScriptStrictNumeric())}); } _NODISCARD MatcherFactoryWrapper ScriptLocalVarIntOrLiteral() const @@ -183,7 +178,7 @@ namespace menu }); } }; -} +} // namespace menu namespace menu::event_handler_set_scope_sequences { @@ -196,9 +191,7 @@ namespace menu::event_handler_set_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({ - create.Char('}') - }); + AddMatchers({create.Char('}')}); } protected: @@ -235,8 +228,7 @@ namespace menu::event_handler_set_scope_sequences state->m_current_event_handler_set = nullptr; state->m_current_nested_event_handler_set = nullptr; } - } - while (conditionWasAutoSkip); + } while (conditionWasAutoSkip); } }; @@ -247,9 +239,7 @@ namespace menu::event_handler_set_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({ - create.Char(';') - }); + AddMatchers({create.Char(';')}); } protected: @@ -272,14 +262,14 @@ namespace menu::event_handler_set_scope_sequences { const ScriptMatcherFactory create(this); - AddMatchers({ - create.Or({ - create.Numeric(), - create.String(), - create.Identifier(), - create.Type(SimpleParserValueType::CHARACTER), - }).Capture(CAPTURE_SCRIPT_TOKEN) - }); + AddMatchers({create + .Or({ + create.Numeric(), + create.String(), + create.Identifier(), + create.Type(SimpleParserValueType::CHARACTER), + }) + .Capture(CAPTURE_SCRIPT_TOKEN)}); } protected: @@ -329,13 +319,11 @@ namespace menu::event_handler_set_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({ - create.And(matchers).Capture(CAPTURE_SCRIPT_TOKEN), - create.Optional(create.Char(';')) - }); + AddMatchers({create.And(matchers).Capture(CAPTURE_SCRIPT_TOKEN), create.Optional(create.Char(';'))}); } - static std::unique_ptr Create(std::initializer_list>>> matchers) + static std::unique_ptr + Create(std::initializer_list>>> matchers) { return std::make_unique(matchers); } @@ -401,13 +389,8 @@ namespace menu::event_handler_set_scope_sequences { const ScriptMatcherFactory create(this); - AddMatchers({ - create.And({ - create.ScriptKeyword("uiScript"), - create.And(matchers) - }).Capture(CAPTURE_SCRIPT_TOKEN), - create.Optional(create.Char(';')) - }); + AddMatchers( + {create.And({create.ScriptKeyword("uiScript"), create.And(matchers)}).Capture(CAPTURE_SCRIPT_TOKEN), create.Optional(create.Char(';'))}); } static std::unique_ptr Create(std::initializer_list>>> matchers) @@ -423,23 +406,21 @@ namespace menu::event_handler_set_scope_sequences static std::unique_ptr PlayerDataPathMatchers(const ScriptMatcherFactory& create) { - return create.Or({ - create.ScriptKeyword("false"), - create.ScriptKeyword("true"), - create.And({ - create.Or({ - create.ScriptKeyword("localvarstring"), - create.ScriptKeyword("localvarint"), - create.ScriptKeyword("localvarfloat"), - create.ScriptKeyword("localvarbool"), - }), - create.ScriptChar('('), - create.ScriptText(), - create.ScriptChar(')'), - }), - create.ScriptStrictInt(), - create.ScriptText() - }); + return create.Or({create.ScriptKeyword("false"), + create.ScriptKeyword("true"), + create.And({ + create.Or({ + create.ScriptKeyword("localvarstring"), + create.ScriptKeyword("localvarint"), + create.ScriptKeyword("localvarfloat"), + create.ScriptKeyword("localvarbool"), + }), + create.ScriptChar('('), + create.ScriptText(), + create.ScriptChar(')'), + }), + create.ScriptStrictInt(), + create.ScriptText()}); } }; @@ -451,19 +432,16 @@ namespace menu::event_handler_set_scope_sequences const ScriptMatcherFactory create(this); AddLabeledMatchers(PlayerDataPathMatchers(create), LABEL_PLAYER_DATA_PATH_ELEMENT); - AddMatchers({ - create.And({ - create.ScriptKeyword("setPlayerData"), - create.ScriptChar('('), - create.Label(LABEL_PLAYER_DATA_PATH_ELEMENT), - create.Loop(create.And({ - create.ScriptChar(','), - create.Label(LABEL_PLAYER_DATA_PATH_ELEMENT) - })), - create.ScriptChar(')'), - }).Capture(CAPTURE_SCRIPT_TOKEN), - create.Optional(create.Char(';')) - }); + AddMatchers({create + .And({ + create.ScriptKeyword("setPlayerData"), + create.ScriptChar('('), + create.Label(LABEL_PLAYER_DATA_PATH_ELEMENT), + create.Loop(create.And({create.ScriptChar(','), create.Label(LABEL_PLAYER_DATA_PATH_ELEMENT)})), + create.ScriptChar(')'), + }) + .Capture(CAPTURE_SCRIPT_TOKEN), + create.Optional(create.Char(';'))}); } }; @@ -475,21 +453,18 @@ namespace menu::event_handler_set_scope_sequences const ScriptMatcherFactory create(this); AddLabeledMatchers(PlayerDataPathMatchers(create), LABEL_PLAYER_DATA_PATH_ELEMENT); - AddMatchers({ - create.And({ - create.ScriptKeyword("setPlayerDataSplitscreen"), - create.ScriptChar('('), - create.ScriptInt(), - create.ScriptChar(','), - create.Label(LABEL_PLAYER_DATA_PATH_ELEMENT), - create.Loop(create.And({ - create.ScriptChar(','), - create.Label(LABEL_PLAYER_DATA_PATH_ELEMENT) - })), - create.ScriptChar(')'), - }).Capture(CAPTURE_SCRIPT_TOKEN), - create.Optional(create.Char(';')) - }); + AddMatchers({create + .And({ + create.ScriptKeyword("setPlayerDataSplitscreen"), + create.ScriptChar('('), + create.ScriptInt(), + create.ScriptChar(','), + create.Label(LABEL_PLAYER_DATA_PATH_ELEMENT), + create.Loop(create.And({create.ScriptChar(','), create.Label(LABEL_PLAYER_DATA_PATH_ELEMENT)})), + create.ScriptChar(')'), + }) + .Capture(CAPTURE_SCRIPT_TOKEN), + create.Optional(create.Char(';'))}); } }; @@ -500,24 +475,22 @@ namespace menu::event_handler_set_scope_sequences { const ScriptMatcherFactory create(this); - AddMatchers({ - create.And({ - create.ScriptKeyword("lerp"), - create.Or({ - create.ScriptKeyword("scale"), - create.ScriptKeyword("alpha"), - create.ScriptKeyword("x"), - create.ScriptKeyword("y"), - }), - create.ScriptKeyword("from"), - create.ScriptNumeric(), - create.ScriptKeyword("to"), - create.ScriptNumeric(), - create.ScriptKeyword("over"), - create.ScriptNumeric() - }).Capture(CAPTURE_SCRIPT_TOKEN), - create.Optional(create.Char(';')) - }); + AddMatchers({create + .And({create.ScriptKeyword("lerp"), + create.Or({ + create.ScriptKeyword("scale"), + create.ScriptKeyword("alpha"), + create.ScriptKeyword("x"), + create.ScriptKeyword("y"), + }), + create.ScriptKeyword("from"), + create.ScriptNumeric(), + create.ScriptKeyword("to"), + create.ScriptNumeric(), + create.ScriptKeyword("over"), + create.ScriptNumeric()}) + .Capture(CAPTURE_SCRIPT_TOKEN), + create.Optional(create.Char(';'))}); } }; @@ -538,17 +511,13 @@ namespace menu::event_handler_set_scope_sequences AddLabeledMatchers(expressionMatchers.Expression(this), MenuExpressionMatchers::LABEL_EXPRESSION); - AddMatchers({ - create.Or({ - create.ScriptKeyword("setLocalVarBool").Tag(TAG_BOOL), - create.ScriptKeyword("setLocalVarInt").Tag(TAG_INT), - create.ScriptKeyword("setLocalVarFloat").Tag(TAG_FLOAT), - create.ScriptKeyword("setLocalVarString").Tag(TAG_STRING) - }), - create.ScriptText().Capture(CAPTURE_VAR_NAME), - create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), - create.Optional(create.Char(';')) - }); + AddMatchers({create.Or({create.ScriptKeyword("setLocalVarBool").Tag(TAG_BOOL), + create.ScriptKeyword("setLocalVarInt").Tag(TAG_INT), + create.ScriptKeyword("setLocalVarFloat").Tag(TAG_FLOAT), + create.ScriptKeyword("setLocalVarString").Tag(TAG_STRING)}), + create.ScriptText().Capture(CAPTURE_VAR_NAME), + create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), + create.Optional(create.Char(';'))}); } private: @@ -612,7 +581,11 @@ namespace menu::event_handler_set_scope_sequences } } - static void EmitStaticSetLocalVar(MenuFileParserState* state, const TokenPos& pos, const SetLocalVarType type, const std::string& varName, std::unique_ptr expression) + static void EmitStaticSetLocalVar(MenuFileParserState* state, + const TokenPos& pos, + const SetLocalVarType type, + const std::string& varName, + std::unique_ptr expression) { state->m_current_script << "\"" << ScriptKeywordForType(type) << "\" \"" << varName << "\" \""; const auto staticValue = expression->EvaluateStatic(); @@ -621,14 +594,18 @@ namespace menu::event_handler_set_scope_sequences state->m_current_script << "\" ; "; } - static void EmitDynamicSetLocalVar(MenuFileParserState* state, const SetLocalVarType type, const std::string& varName, std::unique_ptr expression) + static void EmitDynamicSetLocalVar(MenuFileParserState* state, + const SetLocalVarType type, + const std::string& varName, + std::unique_ptr expression) { auto remainingScript = state->m_current_script.str(); if (!remainingScript.empty()) state->m_current_nested_event_handler_set->m_elements.emplace_back(std::make_unique(std::move(remainingScript))); state->m_current_script.str(std::string()); - state->m_current_nested_event_handler_set->m_elements.emplace_back(std::make_unique(type, varName, std::move(expression))); + state->m_current_nested_event_handler_set->m_elements.emplace_back( + std::make_unique(type, varName, std::move(expression))); } protected: @@ -663,13 +640,11 @@ namespace menu::event_handler_set_scope_sequences AddLabeledMatchers(expressionMatchers.Expression(this), MenuExpressionMatchers::LABEL_EXPRESSION); - AddMatchers({ - create.Keyword("if").Capture(CAPTURE_KEYWORD), - create.Char('('), - create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), - create.Char(')'), - create.Char('{') - }); + AddMatchers({create.Keyword("if").Capture(CAPTURE_KEYWORD), + create.Char('('), + create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), + create.Char(')'), + create.Char('{')}); } protected: @@ -707,14 +682,12 @@ namespace menu::event_handler_set_scope_sequences AddLabeledMatchers(expressionMatchers.Expression(this), MenuExpressionMatchers::LABEL_EXPRESSION); - AddMatchers({ - create.Char('}'), - create.Keyword("elseif").Capture(CAPTURE_KEYWORD), - create.Char('('), - create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), - create.Char(')'), - create.Char('{') - }); + AddMatchers({create.Char('}'), + create.Keyword("elseif").Capture(CAPTURE_KEYWORD), + create.Char('('), + create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), + create.Char(')'), + create.Char('{')}); } protected: @@ -761,11 +734,7 @@ namespace menu::event_handler_set_scope_sequences const ScriptMatcherFactory create(this); const MenuExpressionMatchers expressionMatchers; - AddMatchers({ - create.Char('}'), - create.Keyword("else").Capture(CAPTURE_KEYWORD), - create.Char('{') - }); + AddMatchers({create.Char('}'), create.Keyword("else").Capture(CAPTURE_KEYWORD), create.Char('{')}); } protected: @@ -803,69 +772,66 @@ namespace menu::event_handler_set_scope_sequences { const ScriptMatcherFactory create(this); - AddLabeledMatchers( - create.Or({ - create.ScriptKeyword("Browse"), - create.ScriptKeyword("Load"), - create.ScriptKeyword("Save"), - create.ScriptKeyword("Copy"), - }), LABEL_PARADIGM); - - AddLabeledMatchers( - create.Or({ - create.ScriptKeyword("Fb"), - create.ScriptKeyword("Elite"), - create.ScriptKeyword("Live"), - }), LABEL_PLATFORM); - - AddLabeledMatchers( - create.Or({ - create.ScriptKeyword("All"), - create.ScriptKeyword("Film"), - create.ScriptKeyword("Clip"), - create.ScriptKeyword("Screenshot"), - create.ScriptKeyword("Avi"), - create.ScriptKeyword("Cgm"), - create.ScriptKeyword("Rcu"), - }), LABEL_FILE_CATEGORY); - - AddLabeledMatchers( - create.And({ - create.ScriptKeyword("open"), - create.Label(LABEL_PARADIGM), - create.Optional(create.Label(LABEL_PLATFORM)), - create.Optional(create.Label(LABEL_FILE_CATEGORY)), - create.ScriptText() - }), LABEL_OPEN); - - AddMatchers({ - create.And({ - create.ScriptKeyword("uiScript"), - create.ScriptKeyword("OnlineVault"), - create.Or({ - create.Label(LABEL_OPEN), - create.ScriptKeyword("Pop"), - create.ScriptKeyword("CloseAll"), - create.ScriptKeyword("Load"), - create.ScriptKeyword("LoadAndRenderMovie"), - create.ScriptKeyword("TrySave"), - create.ScriptKeyword("Save"), - create.ScriptKeyword("Rename"), - create.ScriptKeyword("Delete"), - create.ScriptKeyword("Abort"), - create.ScriptKeyword("FacebookUploadPhoto"), - create.ScriptKeyword("FacebookUploadVideo"), - }) - }).Capture(CAPTURE_SCRIPT_TOKEN), - create.Optional(create.Char(';')) - }); + AddLabeledMatchers(create.Or({ + create.ScriptKeyword("Browse"), + create.ScriptKeyword("Load"), + create.ScriptKeyword("Save"), + create.ScriptKeyword("Copy"), + }), + LABEL_PARADIGM); + + AddLabeledMatchers(create.Or({ + create.ScriptKeyword("Fb"), + create.ScriptKeyword("Elite"), + create.ScriptKeyword("Live"), + }), + LABEL_PLATFORM); + + AddLabeledMatchers(create.Or({ + create.ScriptKeyword("All"), + create.ScriptKeyword("Film"), + create.ScriptKeyword("Clip"), + create.ScriptKeyword("Screenshot"), + create.ScriptKeyword("Avi"), + create.ScriptKeyword("Cgm"), + create.ScriptKeyword("Rcu"), + }), + LABEL_FILE_CATEGORY); + + AddLabeledMatchers(create.And({create.ScriptKeyword("open"), + create.Label(LABEL_PARADIGM), + create.Optional(create.Label(LABEL_PLATFORM)), + create.Optional(create.Label(LABEL_FILE_CATEGORY)), + create.ScriptText()}), + LABEL_OPEN); + + AddMatchers({create + .And({create.ScriptKeyword("uiScript"), + create.ScriptKeyword("OnlineVault"), + create.Or({ + create.Label(LABEL_OPEN), + create.ScriptKeyword("Pop"), + create.ScriptKeyword("CloseAll"), + create.ScriptKeyword("Load"), + create.ScriptKeyword("LoadAndRenderMovie"), + create.ScriptKeyword("TrySave"), + create.ScriptKeyword("Save"), + create.ScriptKeyword("Rename"), + create.ScriptKeyword("Delete"), + create.ScriptKeyword("Abort"), + create.ScriptKeyword("FacebookUploadPhoto"), + create.ScriptKeyword("FacebookUploadVideo"), + })}) + .Capture(CAPTURE_SCRIPT_TOKEN), + create.Optional(create.Char(';'))}); } }; -} +} // namespace menu::event_handler_set_scope_sequences using namespace event_handler_set_scope_sequences; -EventHandlerSetScopeSequences::EventHandlerSetScopeSequences(std::vector>& allSequences, std::vector& scopeSequences) +EventHandlerSetScopeSequences::EventHandlerSetScopeSequences(std::vector>& allSequences, + std::vector& scopeSequences) : AbstractScopeSequenceHolder(allSequences, scopeSequences) { } @@ -880,65 +846,76 @@ void EventHandlerSetScopeSequences::AddSequences(const FeatureLevel featureLevel if (!permissive) { - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("fadeIn"), create.ScriptText()})); // fadeIn - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("fadeOut"), create.ScriptText()})); // fadeOut - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("show"), create.ScriptText()})); // show - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("hide"), create.ScriptText()})); // hide + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("fadeIn"), create.ScriptText()})); // fadeIn + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("fadeOut"), create.ScriptText()})); // fadeOut + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("show"), create.ScriptText()})); // show + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("hide"), create.ScriptText()})); // hide AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("showMenu"), create.ScriptText()})); // showMenu AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("hideMenu"), create.ScriptText()})); // hideMenu - AddSequence(SequenceGenericScriptStatement::Create({ - create.ScriptKeyword("setColor"), - create.Or({create.ScriptKeyword("backColor"), create.ScriptKeyword("foreColor"), create.ScriptKeyword("borderColor")}), - create.ScriptColor() - })); // setColor ("backColor" | "foreColor" | "borderColor") [] [] [] - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("open"), create.ScriptText()})); // open - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("close"), create.ScriptText()})); // close ("self" | ) + AddSequence(SequenceGenericScriptStatement::Create( + {create.ScriptKeyword("setColor"), + create.Or({create.ScriptKeyword("backColor"), create.ScriptKeyword("foreColor"), create.ScriptKeyword("borderColor")}), + create.ScriptColor()})); // setColor ("backColor" | "foreColor" | "borderColor") [] [] [] + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("open"), create.ScriptText()})); // open + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("close"), create.ScriptText()})); // close ("self" | ) AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("escape"), create.ScriptText()})); // escape ("self" | ) - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("closeForAllPlayers"), create.ScriptText()})); // closeForAllPlayers - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("ingameOpen"), create.ScriptText()})); // ingameOpen - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("ingameClose"), create.ScriptText()})); // ingameClose + AddSequence( + SequenceGenericScriptStatement::Create({create.ScriptKeyword("closeForAllPlayers"), create.ScriptText()})); // closeForAllPlayers + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("ingameOpen"), create.ScriptText()})); // ingameOpen + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("ingameClose"), create.ScriptText()})); // ingameClose AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setBackground"), create.ScriptText()})); // setBackground - AddSequence(SequenceGenericScriptStatement::Create({ - create.ScriptKeyword("setItemColor"), - create.ScriptText(), - create.Or({create.ScriptKeyword("backColor"), create.ScriptKeyword("foreColor"), create.ScriptKeyword("borderColor"), create.ScriptKeyword("disableColor")}), - create.ScriptColor() - })); // setItemColor (backColor | foreColor | borderColor | disableColor) [] [] [] + AddSequence(SequenceGenericScriptStatement::Create( + {create.ScriptKeyword("setItemColor"), + create.ScriptText(), + create.Or({create.ScriptKeyword("backColor"), + create.ScriptKeyword("foreColor"), + create.ScriptKeyword("borderColor"), + create.ScriptKeyword("disableColor")}), + create.ScriptColor()})); // setItemColor (backColor | foreColor | borderColor | disableColor) [] [] [] AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("focusFirst")})); // setFocus game specific AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setFocusByDvar"), create.ScriptText()})); // setFocusByDvar // setDvar game specific - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("exec"), create.ScriptText()})); // exec + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("exec"), create.ScriptText()})); // exec AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execNow"), create.ScriptText()})); // execNow - AddSequence(SequenceGenericScriptStatement::Create({ - create.ScriptKeyword("execOnDvarStringValue"), create.ScriptText(), create.ScriptText(), create.ScriptText() - })); // execOnDvarStringValue - AddSequence(SequenceGenericScriptStatement::Create({ - create.ScriptKeyword("execOnDvarIntValue"), create.ScriptText(), create.ScriptInt(), create.ScriptText() - })); // execOnDvarIntValue - AddSequence(SequenceGenericScriptStatement::Create({ - create.ScriptKeyword("execOnDvarFloatValue"), create.ScriptText(), create.ScriptNumeric(), create.ScriptText() - })); // execOnDvarFloatValue - AddSequence(SequenceGenericScriptStatement::Create({ - create.ScriptKeyword("execNowOnDvarStringValue"), create.ScriptText(), create.ScriptText(), create.ScriptText() - })); // execNowOnDvarStringValue - AddSequence(SequenceGenericScriptStatement::Create({ - create.ScriptKeyword("execNowOnDvarIntValue"), create.ScriptText(), create.ScriptInt(), create.ScriptText() - })); // execNowOnDvarIntValue - AddSequence(SequenceGenericScriptStatement::Create({ - create.ScriptKeyword("execNowOnDvarFloatValue"), create.ScriptText(), create.ScriptNumeric(), create.ScriptText() - })); // execNowOnDvarFloatValue + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execOnDvarStringValue"), + create.ScriptText(), + create.ScriptText(), + create.ScriptText()})); // execOnDvarStringValue + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execOnDvarIntValue"), + create.ScriptText(), + create.ScriptInt(), + create.ScriptText()})); // execOnDvarIntValue + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execOnDvarFloatValue"), + create.ScriptText(), + create.ScriptNumeric(), + create.ScriptText()})); // execOnDvarFloatValue + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execNowOnDvarStringValue"), + create.ScriptText(), + create.ScriptText(), + create.ScriptText()})); // execNowOnDvarStringValue + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execNowOnDvarIntValue"), + create.ScriptText(), + create.ScriptInt(), + create.ScriptText()})); // execNowOnDvarIntValue + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execNowOnDvarFloatValue"), + create.ScriptText(), + create.ScriptNumeric(), + create.ScriptText()})); // execNowOnDvarFloatValue AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("play"), create.ScriptText()})); // play // scriptMenuResponse game specific - AddSequence(SequenceGenericScriptStatement::Create({ - create.ScriptKeyword("scriptMenuRespondOnDvarStringValue"), create.ScriptText(), create.ScriptText(), create.ScriptText() - })); // scriptMenuRespondOnDvarStringValue - AddSequence(SequenceGenericScriptStatement::Create({ - create.ScriptKeyword("scriptMenuRespondOnDvarIntValue"), create.ScriptText(), create.ScriptInt(), create.ScriptText() - })); // scriptMenuRespondOnDvarIntValue - AddSequence(SequenceGenericScriptStatement::Create({ - create.ScriptKeyword("scriptMenuRespondOnDvarFloatValue"), create.ScriptText(), create.ScriptNumeric(), create.ScriptText() - })); // scriptMenuRespondOnDvarFloatValue + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("scriptMenuRespondOnDvarStringValue"), + create.ScriptText(), + create.ScriptText(), + create.ScriptText()})); // scriptMenuRespondOnDvarStringValue + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("scriptMenuRespondOnDvarIntValue"), + create.ScriptText(), + create.ScriptInt(), + create.ScriptText()})); // scriptMenuRespondOnDvarIntValue + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("scriptMenuRespondOnDvarFloatValue"), + create.ScriptText(), + create.ScriptNumeric(), + create.ScriptText()})); // scriptMenuRespondOnDvarFloatValue AddSequence(std::make_unique()); AddSequence(std::make_unique()); AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("resetStatsConfirm")})); @@ -971,15 +948,22 @@ void EventHandlerSetScopeSequences::AddSequences(const FeatureLevel featureLevel AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("verifyLanguage")})); AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("updateLanguage")})); AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("mutePlayer")})); - AddSequence(SequenceUiScriptStatement::Create( - {create.ScriptKeyword("openMenuOnDvar"), create.ScriptText(), create.Or({create.ScriptStrictNumeric(), create.ScriptText()}), create.ScriptText()})); - AddSequence( - SequenceUiScriptStatement::Create({create.ScriptKeyword("openMenuOnDvarNot"), create.ScriptText(), create.Or({create.ScriptStrictNumeric(), create.ScriptText()}), create.ScriptText()})); - AddSequence(SequenceUiScriptStatement::Create({ - create.ScriptKeyword("closeMenuOnDvar"), create.ScriptText(), create.Or({create.ScriptStrictNumeric(), create.ScriptText()}), create.ScriptText() - })); - AddSequence(SequenceUiScriptStatement::Create( - {create.ScriptKeyword("closeMenuOnDvarNot"), create.ScriptText(), create.Or({create.ScriptStrictNumeric(), create.ScriptText()}), create.ScriptText()})); + AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("openMenuOnDvar"), + create.ScriptText(), + create.Or({create.ScriptStrictNumeric(), create.ScriptText()}), + create.ScriptText()})); + AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("openMenuOnDvarNot"), + create.ScriptText(), + create.Or({create.ScriptStrictNumeric(), create.ScriptText()}), + create.ScriptText()})); + AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("closeMenuOnDvar"), + create.ScriptText(), + create.Or({create.ScriptStrictNumeric(), create.ScriptText()}), + create.ScriptText()})); + AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("closeMenuOnDvarNot"), + create.ScriptText(), + create.Or({create.ScriptStrictNumeric(), create.ScriptText()}), + create.ScriptText()})); AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("setRecommended")})); AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("clearLoadErrorsSummary")})); AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("clearClientMatchData")})); @@ -987,10 +971,12 @@ void EventHandlerSetScopeSequences::AddSequences(const FeatureLevel featureLevel if (featureLevel == FeatureLevel::IW4) { AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setFocus"), create.ScriptText()})); // setFocus - AddSequence(SequenceGenericScriptStatement::Create({ - create.ScriptKeyword("setDvar"), create.ScriptText(), create.Or({create.ScriptStrictNumeric(), create.ScriptText()}) - })); // setDvar - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("scriptMenuResponse"), create.ScriptText()})); // scriptMenuResponse + AddSequence( + SequenceGenericScriptStatement::Create({create.ScriptKeyword("setDvar"), + create.ScriptText(), + create.Or({create.ScriptStrictNumeric(), create.ScriptText()})})); // setDvar + AddSequence(SequenceGenericScriptStatement::Create( + {create.ScriptKeyword("scriptMenuResponse"), create.ScriptText()})); // scriptMenuResponse AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("updateMail")})); AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("openMail")})); AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("deleteMail")})); @@ -1001,7 +987,6 @@ void EventHandlerSetScopeSequences::AddSequences(const FeatureLevel featureLevel // statSetUsingTable // TODO // statClearBitMask // TODO - // IW4x UiScripts AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("LoadMods")})); AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RunMod")})); @@ -1040,32 +1025,29 @@ void EventHandlerSetScopeSequences::AddSequences(const FeatureLevel featureLevel AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("forceClose"), create.ScriptText()})); // forceClose ("self" | ) AddSequence(SequenceGenericScriptStatement::Create({ create.ScriptKeyword("setFocus"), - create.Or({ - create.And({ - create.ScriptKeyword("localVarString"), - create.Char('('), - create.ScriptText(), - create.Char(')'), - }), - create.ScriptText() - }), + create.Or({create.And({ + create.ScriptKeyword("localVarString"), + create.Char('('), + create.ScriptText(), + create.Char(')'), + }), + create.ScriptText()}), })); // setFocus ((localVarString '(' ')') | ) AddSequence(SequenceGenericScriptStatement::Create({ create.ScriptKeyword("setDvar"), create.ScriptText(), - create.Or({ - create.And({ - create.ScriptKeyword("localVarString"), - create.Char('('), - create.ScriptText(), - create.Char(')'), - }), - create.ScriptStrictNumeric(), - create.ScriptText() - }), + create.Or({create.And({ + create.ScriptKeyword("localVarString"), + create.Char('('), + create.ScriptText(), + create.Char(')'), + }), + create.ScriptStrictNumeric(), + create.ScriptText()}), })); // setDvar ((localVarString '(' ')') | ) AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execFirstClient"), create.ScriptText()})); // execFirstClient - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execKeyPress"), create.Or({create.ScriptStrictNumeric(), create.ScriptText()})})); // execKeyPress + AddSequence(SequenceGenericScriptStatement::Create( + {create.ScriptKeyword("execKeyPress"), create.Or({create.ScriptStrictNumeric(), create.ScriptText()})})); // execKeyPress AddSequence(SequenceGenericScriptStatement::Create({ create.ScriptKeyword("scriptMenuResponse"), create.Or({ @@ -1086,80 +1068,93 @@ void EventHandlerSetScopeSequences::AddSequences(const FeatureLevel featureLevel })); // scriptMenuResponse (((localVarInt | localVarFloat | localVarBool | localVarString) '(' ')') | ) AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("deleteEliteCacFile")})); AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("integrateEliteCacFile")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setMatchRulesData")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("loadMatchRulesDataFromPlayer")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("saveMatchRulesDataToPlayer")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("loadMatchRulesDataFromHistory")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("loadMatchRulesDataDefaults")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setUsingMatchRulesData")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("saveMatchRulesDedicatedServer")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("loadMatchRulesDedicatedServer")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("onlineVaultEditMetadata")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("includeInMapRotation")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("useCustomMapRotation")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("useIntermissionTimer")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("stopIntermissionTimer")})); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setMatchRulesData")})); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("loadMatchRulesDataFromPlayer")})); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("saveMatchRulesDataToPlayer")})); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("loadMatchRulesDataFromHistory")})); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("loadMatchRulesDataDefaults")})); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setUsingMatchRulesData")})); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("saveMatchRulesDedicatedServer")})); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("loadMatchRulesDedicatedServer")})); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("onlineVaultEditMetadata")})); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("includeInMapRotation")})); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("useCustomMapRotation")})); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("useIntermissionTimer")})); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("stopIntermissionTimer")})); // unknown parameters AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("feederTop"), create.Optional(create.Text())})); // feederTop [] - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("feederBottom"), create.Optional(create.Text())})); // feederBottom [] - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("feederPageUp"), create.Optional(create.Text())})); // feederPageUp [] - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("feederPageDown"), create.Optional(create.Text())})); // feederPageDown [] - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("showCoopGamerCard")})); // unknown parameters + AddSequence( + SequenceGenericScriptStatement::Create({create.ScriptKeyword("feederBottom"), create.Optional(create.Text())})); // feederBottom [] + AddSequence( + SequenceGenericScriptStatement::Create({create.ScriptKeyword("feederPageUp"), create.Optional(create.Text())})); // feederPageUp [] + AddSequence(SequenceGenericScriptStatement::Create( + {create.ScriptKeyword("feederPageDown"), create.Optional(create.Text())})); // feederPageDown [] + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("showCoopGamerCard")})); // unknown parameters AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("showSplitscreenGamerCard")})); // unknown parameters AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("reportPlayerOffensive")})); AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("reportPlayerExploiting")})); AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("reportPlayerCheating")})); AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("reportPlayerBoosting")})); - AddSequence(SequenceGenericScriptStatement::Create({ - create.ScriptKeyword("setCardIcon"), create.Char('('), create.ScriptLocalVarIntOrLiteral(), create.Char(')') - })); // setCardIcon '(' ((localVarInt '(' ')') | ) ')' - AddSequence(SequenceGenericScriptStatement::Create({ - create.ScriptKeyword("setCardTitle"), create.Char('('), create.ScriptLocalVarIntOrLiteral(), create.Char(')') - })); // setCardTitle '(' ((localVarInt '(' ')') | ) ')' - AddSequence(SequenceGenericScriptStatement::Create({ - create.ScriptKeyword("setCardIconNew"), - create.Char('('), - create.ScriptLocalVarIntOrLiteral(), - create.Char(','), - create.Or({ - create.ScriptLocalVarIntOrLiteral(), - // This is wrong and the game does not even understand it. But because it's not a number it evaluates to 0... - // The game's menus do it and i don't want to fix it everywhere - create.ScriptKeyword("false"), - }), - create.Char(')') - })); // setCardIconNew '(' ((localVarInt '(' ')') | ) ',' ((localVarInt '(' ')') | ) ')' - AddSequence(SequenceGenericScriptStatement::Create({ - create.ScriptKeyword("setCardTitleNew"), - create.Char('('), - create.ScriptLocalVarIntOrLiteral(), - create.Char(','), - create.Or({ - create.ScriptLocalVarIntOrLiteral(), - // This is a hack (see setCardIconNew for details) - create.ScriptKeyword("false"), - }), - create.Char(')') - })); // setCardTitleNew '(' ((localVarInt '(' ')') | ) ',' ((localVarInt '(' ')') | ) ')' - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setCardIconSplitScreen")})); // unknown - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setCardTitleSplitScreen")})); // unknown - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setCardIconNewSplitScreen")})); // unknown + AddSequence( + SequenceGenericScriptStatement::Create({create.ScriptKeyword("setCardIcon"), + create.Char('('), + create.ScriptLocalVarIntOrLiteral(), + create.Char(')')})); // setCardIcon '(' ((localVarInt '(' ')') | ) ')' + AddSequence( + SequenceGenericScriptStatement::Create({create.ScriptKeyword("setCardTitle"), + create.Char('('), + create.ScriptLocalVarIntOrLiteral(), + create.Char(')')})); // setCardTitle '(' ((localVarInt '(' ')') | ) ')' + AddSequence(SequenceGenericScriptStatement::Create( + {create.ScriptKeyword("setCardIconNew"), + create.Char('('), + create.ScriptLocalVarIntOrLiteral(), + create.Char(','), + create.Or({ + create.ScriptLocalVarIntOrLiteral(), + // This is wrong and the game does not even understand it. But because it's not a number it evaluates to 0... + // The game's menus do it and i don't want to fix it everywhere + create.ScriptKeyword("false"), + }), + create.Char( + ')')})); // setCardIconNew '(' ((localVarInt '(' ')') | ) ',' ((localVarInt '(' ')') | ) ')' + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setCardTitleNew"), + create.Char('('), + create.ScriptLocalVarIntOrLiteral(), + create.Char(','), + create.Or({ + create.ScriptLocalVarIntOrLiteral(), + // This is a hack (see setCardIconNew for details) + create.ScriptKeyword("false"), + }), + create.Char(')')})); // setCardTitleNew '(' ((localVarInt '(' ')') | ) ',' ((localVarInt '(' ')') | ) ')' + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setCardIconSplitScreen")})); // unknown + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setCardTitleSplitScreen")})); // unknown + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setCardIconNewSplitScreen")})); // unknown AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setCardTitleNewSplitScreen")})); // unknown - AddSequence(SequenceGenericScriptStatement::Create({ - create.ScriptKeyword("purchasePrestigeTitle"), create.Char('('), create.ScriptText(), create.Char(')') - })); // purchasePrestigeTitle '(' ')' - AddSequence(SequenceGenericScriptStatement::Create({ - create.ScriptKeyword("setProfileItemNew"), create.Char('('), create.ScriptText(), create.Char(','), create.ScriptLocalVarIntOrLiteral(), create.Char(')') - })); // setProfileItemNew '(' <item name> ',' (0|1|(localVarInt '(' <var name> ')')) ')' + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("purchasePrestigeTitle"), + create.Char('('), + create.ScriptText(), + create.Char(')')})); // purchasePrestigeTitle '(' <title name> ')' + AddSequence( + SequenceGenericScriptStatement::Create({create.ScriptKeyword("setProfileItemNew"), + create.Char('('), + create.ScriptText(), + create.Char(','), + create.ScriptLocalVarIntOrLiteral(), + create.Char(')')})); // setProfileItemNew '(' <item name> ',' (0|1|(localVarInt '(' <var name> ')')) ')' AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setProfileItemNewSplitScreen")})); // unknown AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("storePopupXuid")})); AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("getHostMigrateQuestion")})); AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("makeHost")})); AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("saveGameHide")})); // saveGameHide <item name> AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("saveGameShow")})); // saveGameShow <item name> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("saveGameSetLocalBool"), create.ScriptText()})); // saveGameSetLocalBool <var name> + AddSequence( + SequenceGenericScriptStatement::Create({create.ScriptKeyword("saveGameSetLocalBool"), create.ScriptText()})); // saveGameSetLocalBool <var name> AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("saveDelay")})); AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("writeSave")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setSaveExecOnSuccess"), create.ScriptText()})); // setSaveExecOnSuccess <command> + AddSequence( + SequenceGenericScriptStatement::Create({create.ScriptKeyword("setSaveExecOnSuccess"), create.ScriptText()})); // setSaveExecOnSuccess <command> AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("nextLevel")})); AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("disablePause")})); AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("enablePause")})); @@ -1175,14 +1170,18 @@ void EventHandlerSetScopeSequences::AddSequences(const FeatureLevel featureLevel create.Char(','), create.ScriptLocalVarBoolOrLiteral(), create.Char(')'), - })); // playMenuVideo '(' <video name> ',' ((localVarInt '(' <var name> ')') | <offset>) ',' ((localVarBool '(' <var name> ')') | <maybe looping bool>) ')' - AddSequence(SequenceGenericScriptStatement::Create({ - create.ScriptKeyword("setBackgroundVideo"), create.Char('('), create.ScriptText(), create.Char(')') - })); // setBackgroundVideo '(' <video name or empty string> ')' - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("clearEntitlementNew"), create.ScriptText()})); // clearEntitlementNew <entitlement name> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setPastTitleRank")})); // unknown + })); // playMenuVideo '(' <video name> ',' ((localVarInt '(' <var name> ')') | <offset>) ',' ((localVarBool '(' <var name> ')') | <maybe looping + // bool>) ')' + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setBackgroundVideo"), + create.Char('('), + create.ScriptText(), + create.Char(')')})); // setBackgroundVideo '(' <video name or empty string> ')' + AddSequence(SequenceGenericScriptStatement::Create( + {create.ScriptKeyword("clearEntitlementNew"), create.ScriptText()})); // clearEntitlementNew <entitlement name> + AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setPastTitleRank")})); // unknown AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setPastTitlePrestige")})); // unknown - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("anticheat_bancheck"), create.ScriptStrictNumeric()})); // anticheat_bancheck <num> + AddSequence( + SequenceGenericScriptStatement::Create({create.ScriptKeyword("anticheat_bancheck"), create.ScriptStrictNumeric()})); // anticheat_bancheck <num> // UiScripts AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("LoadSaveGames")})); @@ -1260,25 +1259,24 @@ void EventHandlerSetScopeSequences::AddSequences(const FeatureLevel featureLevel AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("addFavorite")})); AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("deleteFavorite")})); AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("PlayDemo")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("SwitchSegmentTransition"), create.ScriptStrictInt(), create.ScriptStrictInt()})); + AddSequence( + SequenceUiScriptStatement::Create({create.ScriptKeyword("SwitchSegmentTransition"), create.ScriptStrictInt(), create.ScriptStrictInt()})); AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("PreviewSegment")})); AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("MoveSegment"), create.ScriptStrictInt()})); AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("DeleteSegment")})); AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("SetFocusOnSegmentButton")})); AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("PopulateLocalDemoFileInformation")})); AddSequence(std::make_unique<SequenceOnlineVault>()); - AddSequence(SequenceUiScriptStatement::Create({ - create.ScriptKeyword("Playlist"), - create.Or({ - create.And({ - create.ScriptKeyword("Open"), - create.ScriptStrictInt(), - }), - create.ScriptKeyword("DoAction"), - create.ScriptKeyword("Close"), - create.ScriptKeyword("CloseAll"), - }) - })); + AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("Playlist"), + create.Or({ + create.And({ + create.ScriptKeyword("Open"), + create.ScriptStrictInt(), + }), + create.ScriptKeyword("DoAction"), + create.ScriptKeyword("Close"), + create.ScriptKeyword("CloseAll"), + })})); AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("UpdateArenas")})); AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("SortChallengesTop")})); AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("xlaunchelitesearch")})); diff --git a/src/ObjLoading/Parsing/Menu/Sequence/EventHandlerSetScopeSequences.h b/src/ObjLoading/Parsing/Menu/Sequence/EventHandlerSetScopeSequences.h index 388117268..4e27d4c66 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/EventHandlerSetScopeSequences.h +++ b/src/ObjLoading/Parsing/Menu/Sequence/EventHandlerSetScopeSequences.h @@ -8,8 +8,9 @@ namespace menu class EventHandlerSetScopeSequences final : AbstractScopeSequenceHolder<MenuFileParser> { public: - EventHandlerSetScopeSequences(std::vector<std::unique_ptr<MenuFileParser::sequence_t>>& allSequences, std::vector<MenuFileParser::sequence_t*>& scopeSequences); + EventHandlerSetScopeSequences(std::vector<std::unique_ptr<MenuFileParser::sequence_t>>& allSequences, + std::vector<MenuFileParser::sequence_t*>& scopeSequences); void AddSequences(FeatureLevel featureLevel, bool permissive) const; }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Sequence/FunctionScopeSequences.cpp b/src/ObjLoading/Parsing/Menu/Sequence/FunctionScopeSequences.cpp index 8cf41392f..bf749de03 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/FunctionScopeSequences.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/FunctionScopeSequences.cpp @@ -1,86 +1,89 @@ #include "FunctionScopeSequences.h" -#include <sstream> - #include "Generic/GenericExpressionPropertySequence.h" #include "Generic/GenericStringPropertySequence.h" #include "Parsing/Menu/Matcher/MenuMatcherFactory.h" +#include <sstream> + using namespace menu; namespace menu::function_scope_sequences { - class SequenceCloseBlock final : public MenuFileParser::sequence_t - { - static constexpr auto CAPTURE_TOKEN = 1; + class SequenceCloseBlock final : public MenuFileParser::sequence_t + { + static constexpr auto CAPTURE_TOKEN = 1; - public: - SequenceCloseBlock() - { - const MenuMatcherFactory create(this); + public: + SequenceCloseBlock() + { + const MenuMatcherFactory create(this); - AddMatchers({ - create.Char('}').Capture(CAPTURE_TOKEN) - }); - } + AddMatchers({create.Char('}').Capture(CAPTURE_TOKEN)}); + } - protected: - void ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const override - { - if (!state->m_current_function->m_value) - { - std::ostringstream ss; - ss << "Cannot define function name \"" << state->m_current_function->m_name << "\" without a value"; - throw ParsingException(result.NextCapture(CAPTURE_TOKEN).GetPos(), ss.str()); - } + protected: + void ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const override + { + if (!state->m_current_function->m_value) + { + std::ostringstream ss; + ss << "Cannot define function name \"" << state->m_current_function->m_name << "\" without a value"; + throw ParsingException(result.NextCapture(CAPTURE_TOKEN).GetPos(), ss.str()); + } - const auto existingFunction = state->m_functions_by_name.find(state->m_current_function->m_name); - if (existingFunction == state->m_functions_by_name.end()) - { - state->m_functions_by_name.emplace(std::make_pair(state->m_current_function->m_name, state->m_current_function)); - state->m_current_function = nullptr; - } - else if (!state->m_current_function->m_value->Equals(existingFunction->second->m_value.get())) - { - std::ostringstream ss; - ss << "Function with name \"" << state->m_current_function->m_name << "\" already exists"; - throw ParsingException(result.NextCapture(CAPTURE_TOKEN).GetPos(), ss.str()); - } - else - { - // Remove definition of function to not re-add it - const auto foundFunction = std::find_if(state->m_functions.rbegin(), state->m_functions.rend(), [state](const auto& element) - { - return element.get() == state->m_current_function; - }); - - assert(foundFunction != state->m_functions.rend()); - assert((foundFunction + 1).base()->get() == state->m_current_function); - if (foundFunction != state->m_functions.rend()) - state->m_functions.erase((foundFunction + 1).base()); + const auto existingFunction = state->m_functions_by_name.find(state->m_current_function->m_name); + if (existingFunction == state->m_functions_by_name.end()) + { + state->m_functions_by_name.emplace(std::make_pair(state->m_current_function->m_name, state->m_current_function)); + state->m_current_function = nullptr; + } + else if (!state->m_current_function->m_value->Equals(existingFunction->second->m_value.get())) + { + std::ostringstream ss; + ss << "Function with name \"" << state->m_current_function->m_name << "\" already exists"; + throw ParsingException(result.NextCapture(CAPTURE_TOKEN).GetPos(), ss.str()); + } + else + { + // Remove definition of function to not re-add it + const auto foundFunction = std::find_if(state->m_functions.rbegin(), + state->m_functions.rend(), + [state](const auto& element) + { + return element.get() == state->m_current_function; + }); - state->m_current_function = nullptr; - } - } - }; -} + assert(foundFunction != state->m_functions.rend()); + assert((foundFunction + 1).base()->get() == state->m_current_function); + if (foundFunction != state->m_functions.rend()) + state->m_functions.erase((foundFunction + 1).base()); + + state->m_current_function = nullptr; + } + } + }; +} // namespace menu::function_scope_sequences using namespace function_scope_sequences; -FunctionScopeSequences::FunctionScopeSequences(std::vector<std::unique_ptr<MenuFileParser::sequence_t>>& allSequences, std::vector<MenuFileParser::sequence_t*>& scopeSequences) - : AbstractScopeSequenceHolder(allSequences, scopeSequences) +FunctionScopeSequences::FunctionScopeSequences(std::vector<std::unique_ptr<MenuFileParser::sequence_t>>& allSequences, + std::vector<MenuFileParser::sequence_t*>& scopeSequences) + : AbstractScopeSequenceHolder(allSequences, scopeSequences) { } void FunctionScopeSequences::AddSequences(FeatureLevel featureLevel, bool permissive) const { - AddSequence(std::make_unique<SequenceCloseBlock>()); - AddSequence(std::make_unique<GenericStringPropertySequence>("name", [](const MenuFileParserState* state, const TokenPos&, const std::string& value) - { - state->m_current_function->m_name = value; - })); - AddSequence(GenericExpressionPropertySequence::WithKeyword("value", [](const MenuFileParserState* state, const TokenPos&, std::unique_ptr<ISimpleExpression> value) - { - state->m_current_function->m_value = std::move(value); - })); + AddSequence(std::make_unique<SequenceCloseBlock>()); + AddSequence(std::make_unique<GenericStringPropertySequence>("name", + [](const MenuFileParserState* state, const TokenPos&, const std::string& value) + { + state->m_current_function->m_name = value; + })); + AddSequence(GenericExpressionPropertySequence::WithKeyword("value", + [](const MenuFileParserState* state, const TokenPos&, std::unique_ptr<ISimpleExpression> value) + { + state->m_current_function->m_value = std::move(value); + })); } diff --git a/src/ObjLoading/Parsing/Menu/Sequence/FunctionScopeSequences.h b/src/ObjLoading/Parsing/Menu/Sequence/FunctionScopeSequences.h index 012f2606b..acb4a6f37 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/FunctionScopeSequences.h +++ b/src/ObjLoading/Parsing/Menu/Sequence/FunctionScopeSequences.h @@ -8,8 +8,9 @@ namespace menu class FunctionScopeSequences final : AbstractScopeSequenceHolder<MenuFileParser> { public: - FunctionScopeSequences(std::vector<std::unique_ptr<MenuFileParser::sequence_t>>& allSequences, std::vector<MenuFileParser::sequence_t*>& scopeSequences); + FunctionScopeSequences(std::vector<std::unique_ptr<MenuFileParser::sequence_t>>& allSequences, + std::vector<MenuFileParser::sequence_t*>& scopeSequences); void AddSequences(FeatureLevel featureLevel, bool permissive) const; }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericBoolPropertySequence.cpp b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericBoolPropertySequence.cpp index 298f71bc9..d098304f6 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericBoolPropertySequence.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericBoolPropertySequence.cpp @@ -1,9 +1,9 @@ #include "GenericBoolPropertySequence.h" -#include <utility> - #include "Parsing/Menu/Matcher/MenuMatcherFactory.h" +#include <utility> + using namespace menu; GenericBoolPropertySequence::GenericBoolPropertySequence(std::string keywordName, callback_t setCallback) @@ -11,10 +11,7 @@ GenericBoolPropertySequence::GenericBoolPropertySequence(std::string keywordName { const MenuMatcherFactory create(this); - AddMatchers({ - create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN), - create.Integer().Capture(CAPTURE_VALUE) - }); + AddMatchers({create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN), create.Integer().Capture(CAPTURE_VALUE)}); } void GenericBoolPropertySequence::ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericBoolPropertySequence.h b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericBoolPropertySequence.h index 060298671..61b9adc91 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericBoolPropertySequence.h +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericBoolPropertySequence.h @@ -1,10 +1,10 @@ #pragma once -#include <string> -#include <functional> - #include "Parsing/Menu/MenuFileParser.h" +#include <functional> +#include <string> + namespace menu { class GenericBoolPropertySequence final : public MenuFileParser::sequence_t @@ -24,4 +24,4 @@ namespace menu public: GenericBoolPropertySequence(std::string keywordName, callback_t setCallback); }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericColorPropertySequence.cpp b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericColorPropertySequence.cpp index cec2bfc99..0ad92d427 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericColorPropertySequence.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericColorPropertySequence.cpp @@ -1,10 +1,10 @@ #include "GenericColorPropertySequence.h" -#include <utility> - #include "Parsing/Menu/Matcher/MenuExpressionMatchers.h" #include "Parsing/Menu/Matcher/MenuMatcherFactory.h" +#include <utility> + using namespace menu; GenericColorPropertySequence::GenericColorPropertySequence(std::string keywordName, callback_t setCallback) @@ -15,10 +15,10 @@ GenericColorPropertySequence::GenericColorPropertySequence(std::string keywordNa AddLabeledMatchers(MenuExpressionMatchers().Expression(this), MenuExpressionMatchers::LABEL_EXPRESSION); AddMatchers({ create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN), - create.NumericExpression().Tag(TAG_COLOR), // r + create.NumericExpression().Tag(TAG_COLOR), // r create.Optional(create.NumericExpression().Tag(TAG_COLOR)), // g create.Optional(create.NumericExpression().Tag(TAG_COLOR)), // b - create.Optional(create.NumericExpression().Tag(TAG_COLOR)) // a + create.Optional(create.NumericExpression().Tag(TAG_COLOR)) // a }); } diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericColorPropertySequence.h b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericColorPropertySequence.h index 49a0045a2..244151b03 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericColorPropertySequence.h +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericColorPropertySequence.h @@ -1,10 +1,10 @@ #pragma once -#include <string> -#include <functional> - -#include "Parsing/Menu/MenuFileParser.h" #include "Parsing/Menu/Domain/CommonMenuTypes.h" +#include "Parsing/Menu/MenuFileParser.h" + +#include <functional> +#include <string> namespace menu { @@ -28,4 +28,4 @@ namespace menu public: GenericColorPropertySequence(std::string keywordName, callback_t setCallback); }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericExpressionPropertySequence.cpp b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericExpressionPropertySequence.cpp index bfde58c7c..08d9a3964 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericExpressionPropertySequence.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericExpressionPropertySequence.cpp @@ -1,10 +1,10 @@ #include "GenericExpressionPropertySequence.h" -#include <utility> - #include "Parsing/Menu/Matcher/MenuExpressionMatchers.h" #include "Parsing/Menu/Matcher/MenuMatcherFactory.h" +#include <utility> + using namespace menu; GenericExpressionPropertySequence::GenericExpressionPropertySequence(callback_t setCallback) @@ -19,16 +19,15 @@ std::unique_ptr<GenericExpressionPropertySequence> GenericExpressionPropertySequ auto result = std::unique_ptr<GenericExpressionPropertySequence>(new GenericExpressionPropertySequence(std::move(setCallback))); const MenuMatcherFactory create(result.get()); - result->AddMatchers({ - create.KeywordIgnoreCase(std::move(keyword)).Capture(CAPTURE_FIRST_TOKEN), - create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), - create.Optional(create.Char(';')) - }); + result->AddMatchers({create.KeywordIgnoreCase(std::move(keyword)).Capture(CAPTURE_FIRST_TOKEN), + create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), + create.Optional(create.Char(';'))}); return std::move(result); } -std::unique_ptr<GenericExpressionPropertySequence> GenericExpressionPropertySequence::WithKeywords(const std::initializer_list<std::string> keywords, callback_t setCallback) +std::unique_ptr<GenericExpressionPropertySequence> GenericExpressionPropertySequence::WithKeywords(const std::initializer_list<std::string> keywords, + callback_t setCallback) { auto result = std::unique_ptr<GenericExpressionPropertySequence>(new GenericExpressionPropertySequence(std::move(setCallback))); @@ -37,11 +36,9 @@ std::unique_ptr<GenericExpressionPropertySequence> GenericExpressionPropertySequ for (auto keyword : keywords) keywordMatchers.emplace_back(create.KeywordIgnoreCase(std::move(keyword))); - result->AddMatchers({ - create.And(std::move(keywordMatchers)).Capture(CAPTURE_FIRST_TOKEN), - create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), - create.Optional(create.Char(';')) - }); + result->AddMatchers({create.And(std::move(keywordMatchers)).Capture(CAPTURE_FIRST_TOKEN), + create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), + create.Optional(create.Char(';'))}); return std::move(result); } @@ -51,12 +48,10 @@ std::unique_ptr<GenericExpressionPropertySequence> GenericExpressionPropertySequ auto result = std::unique_ptr<GenericExpressionPropertySequence>(new GenericExpressionPropertySequence(std::move(setCallback))); const MenuMatcherFactory create(result.get()); - result->AddMatchers({ - create.KeywordIgnoreCase(std::move(keyword)).Capture(CAPTURE_FIRST_TOKEN), - create.Optional(create.KeywordIgnoreCase("when")), - create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), - create.Optional(create.Char(';')) - }); + result->AddMatchers({create.KeywordIgnoreCase(std::move(keyword)).Capture(CAPTURE_FIRST_TOKEN), + create.Optional(create.KeywordIgnoreCase("when")), + create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), + create.Optional(create.Char(';'))}); return std::move(result); } diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericExpressionPropertySequence.h b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericExpressionPropertySequence.h index dab86f5e8..602db7273 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericExpressionPropertySequence.h +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericExpressionPropertySequence.h @@ -1,11 +1,11 @@ #pragma once -#include <string> -#include <functional> - #include "Parsing/Menu/MenuFileParser.h" #include "Parsing/Simple/Expression/ISimpleExpression.h" +#include <functional> +#include <string> + namespace menu { class GenericExpressionPropertySequence final : public MenuFileParser::sequence_t @@ -29,4 +29,4 @@ namespace menu static std::unique_ptr<GenericExpressionPropertySequence> WithKeywords(std::initializer_list<std::string> keywords, callback_t setCallback); static std::unique_ptr<GenericExpressionPropertySequence> WithKeywordAndBool(std::string keyword, callback_t setCallback); }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericFloatingPointPropertySequence.cpp b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericFloatingPointPropertySequence.cpp index 14ebd5421..e9156d618 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericFloatingPointPropertySequence.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericFloatingPointPropertySequence.cpp @@ -1,10 +1,10 @@ #include "GenericFloatingPointPropertySequence.h" -#include <utility> - #include "Parsing/Menu/Matcher/MenuExpressionMatchers.h" #include "Parsing/Menu/Matcher/MenuMatcherFactory.h" +#include <utility> + using namespace menu; GenericFloatingPointPropertySequence::GenericFloatingPointPropertySequence(std::string keywordName, callback_t setCallback) @@ -13,10 +13,7 @@ GenericFloatingPointPropertySequence::GenericFloatingPointPropertySequence(std:: const MenuMatcherFactory create(this); AddLabeledMatchers(MenuExpressionMatchers().Expression(this), MenuExpressionMatchers::LABEL_EXPRESSION); - AddMatchers({ - create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN), - create.NumericExpression() - }); + AddMatchers({create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN), create.NumericExpression()}); } void GenericFloatingPointPropertySequence::ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericFloatingPointPropertySequence.h b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericFloatingPointPropertySequence.h index a424928e1..3b070a0f2 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericFloatingPointPropertySequence.h +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericFloatingPointPropertySequence.h @@ -1,10 +1,10 @@ #pragma once -#include <string> -#include <functional> - #include "Parsing/Menu/MenuFileParser.h" +#include <functional> +#include <string> + namespace menu { class GenericFloatingPointPropertySequence final : public MenuFileParser::sequence_t @@ -23,4 +23,4 @@ namespace menu public: GenericFloatingPointPropertySequence(std::string keywordName, callback_t setCallback); }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericIntPropertySequence.cpp b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericIntPropertySequence.cpp index d2747dd15..0d777015d 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericIntPropertySequence.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericIntPropertySequence.cpp @@ -1,10 +1,10 @@ #include "GenericIntPropertySequence.h" -#include <utility> - #include "Parsing/Menu/Matcher/MenuExpressionMatchers.h" #include "Parsing/Menu/Matcher/MenuMatcherFactory.h" +#include <utility> + using namespace menu; GenericIntPropertySequence::GenericIntPropertySequence(std::string keywordName, callback_t setCallback) diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericIntPropertySequence.h b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericIntPropertySequence.h index 63c6a73d1..34e742d76 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericIntPropertySequence.h +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericIntPropertySequence.h @@ -1,10 +1,10 @@ #pragma once -#include <string> -#include <functional> - #include "Parsing/Menu/MenuFileParser.h" +#include <functional> +#include <string> + namespace menu { class GenericIntPropertySequence final : public MenuFileParser::sequence_t @@ -23,4 +23,4 @@ namespace menu public: GenericIntPropertySequence(std::string keywordName, callback_t setCallback); }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericKeywordPropertySequence.cpp b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericKeywordPropertySequence.cpp index 2a8033b28..73fe3efd8 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericKeywordPropertySequence.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericKeywordPropertySequence.cpp @@ -1,9 +1,9 @@ #include "GenericKeywordPropertySequence.h" -#include <utility> - #include "Parsing/Menu/Matcher/MenuMatcherFactory.h" +#include <utility> + using namespace menu; GenericKeywordPropertySequence::GenericKeywordPropertySequence(std::string keywordName, callback_t setCallback) diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericKeywordPropertySequence.h b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericKeywordPropertySequence.h index 4d67ad830..ad9cc86a1 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericKeywordPropertySequence.h +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericKeywordPropertySequence.h @@ -1,10 +1,10 @@ #pragma once -#include <string> -#include <functional> - #include "Parsing/Menu/MenuFileParser.h" +#include <functional> +#include <string> + namespace menu { class GenericKeywordPropertySequence final : public MenuFileParser::sequence_t @@ -23,4 +23,4 @@ namespace menu public: GenericKeywordPropertySequence(std::string keywordName, callback_t setCallback); }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericMenuEventHandlerSetPropertySequence.cpp b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericMenuEventHandlerSetPropertySequence.cpp index fafcfcc9d..39c68f375 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericMenuEventHandlerSetPropertySequence.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericMenuEventHandlerSetPropertySequence.cpp @@ -1,9 +1,9 @@ #include "GenericMenuEventHandlerSetPropertySequence.h" -#include <utility> - #include "Parsing/Menu/Matcher/MenuMatcherFactory.h" +#include <utility> + using namespace menu; GenericMenuEventHandlerSetPropertySequence::GenericMenuEventHandlerSetPropertySequence(std::string keywordName, callback_t setCallback) @@ -11,10 +11,7 @@ GenericMenuEventHandlerSetPropertySequence::GenericMenuEventHandlerSetPropertySe { const MenuMatcherFactory create(this); - AddMatchers({ - create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN), - create.Char('{') - }); + AddMatchers({create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN), create.Char('{')}); } void GenericMenuEventHandlerSetPropertySequence::ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const @@ -22,7 +19,7 @@ void GenericMenuEventHandlerSetPropertySequence::ProcessMatch(MenuFileParserStat if (m_set_callback) { auto& eventHandlerPtr = m_set_callback(state, result.NextCapture(CAPTURE_FIRST_TOKEN).GetPos()); - if(!eventHandlerPtr) + if (!eventHandlerPtr) eventHandlerPtr = std::make_unique<CommonEventHandlerSet>(); state->m_current_event_handler_set = eventHandlerPtr.get(); diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericMenuEventHandlerSetPropertySequence.h b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericMenuEventHandlerSetPropertySequence.h index 217c753f0..bf9ed7ebc 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericMenuEventHandlerSetPropertySequence.h +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericMenuEventHandlerSetPropertySequence.h @@ -1,17 +1,17 @@ #pragma once -#include <string> -#include <functional> - -#include "Parsing/Menu/MenuFileParser.h" #include "Parsing/Menu/Domain/EventHandler/CommonEventHandlerSet.h" +#include "Parsing/Menu/MenuFileParser.h" + +#include <functional> +#include <string> namespace menu { class GenericMenuEventHandlerSetPropertySequence final : public MenuFileParser::sequence_t { public: - using callback_t = std::function<std::unique_ptr<CommonEventHandlerSet>& (MenuFileParserState* state, const TokenPos& pos)>; + using callback_t = std::function<std::unique_ptr<CommonEventHandlerSet>&(MenuFileParserState* state, const TokenPos& pos)>; private: static constexpr auto CAPTURE_FIRST_TOKEN = 1; @@ -24,4 +24,4 @@ namespace menu public: GenericMenuEventHandlerSetPropertySequence(std::string keywordName, callback_t setCallback); }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericStringPropertySequence.cpp b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericStringPropertySequence.cpp index 8e554fd6e..8a800b6d3 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericStringPropertySequence.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericStringPropertySequence.cpp @@ -1,9 +1,9 @@ #include "GenericStringPropertySequence.h" -#include <utility> - #include "Parsing/Menu/Matcher/MenuMatcherFactory.h" +#include <utility> + using namespace menu; GenericStringPropertySequence::GenericStringPropertySequence(std::string keywordName, callback_t setCallback) @@ -11,10 +11,7 @@ GenericStringPropertySequence::GenericStringPropertySequence(std::string keyword { const MenuMatcherFactory create(this); - AddMatchers({ - create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN), - create.Text().Capture(CAPTURE_VALUE) - }); + AddMatchers({create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN), create.Text().Capture(CAPTURE_VALUE)}); } void GenericStringPropertySequence::ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericStringPropertySequence.h b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericStringPropertySequence.h index 1f35d9fef..c199c295a 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericStringPropertySequence.h +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericStringPropertySequence.h @@ -1,10 +1,10 @@ #pragma once -#include <string> -#include <functional> - #include "Parsing/Menu/MenuFileParser.h" +#include <functional> +#include <string> + namespace menu { class GenericStringPropertySequence final : public MenuFileParser::sequence_t @@ -24,4 +24,4 @@ namespace menu public: GenericStringPropertySequence(std::string keywordName, callback_t setCallback); }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Sequence/GlobalScopeSequences.cpp b/src/ObjLoading/Parsing/Menu/Sequence/GlobalScopeSequences.cpp index 989544669..23e85c0cc 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/GlobalScopeSequences.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/GlobalScopeSequences.cpp @@ -14,9 +14,7 @@ namespace menu::global_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({ - create.Char('}') - }); + AddMatchers({create.Char('}')}); } protected: @@ -98,11 +96,12 @@ namespace menu::global_scope_sequences state->m_menus_to_load.emplace_back(menuNameToken.StringValue()); } }; -} +} // namespace menu::global_scope_sequences using namespace global_scope_sequences; -GlobalScopeSequences::GlobalScopeSequences(std::vector<std::unique_ptr<MenuFileParser::sequence_t>>& allSequences, std::vector<MenuFileParser::sequence_t*>& scopeSequences) +GlobalScopeSequences::GlobalScopeSequences(std::vector<std::unique_ptr<MenuFileParser::sequence_t>>& allSequences, + std::vector<MenuFileParser::sequence_t*>& scopeSequences) : AbstractScopeSequenceHolder(allSequences, scopeSequences) { } diff --git a/src/ObjLoading/Parsing/Menu/Sequence/GlobalScopeSequences.h b/src/ObjLoading/Parsing/Menu/Sequence/GlobalScopeSequences.h index e6b5d3fa5..9703a46a1 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/GlobalScopeSequences.h +++ b/src/ObjLoading/Parsing/Menu/Sequence/GlobalScopeSequences.h @@ -12,4 +12,4 @@ namespace menu void AddSequences(FeatureLevel featureLevel, bool permissive) const; }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Sequence/ItemScopeSequences.cpp b/src/ObjLoading/Parsing/Menu/Sequence/ItemScopeSequences.cpp index cb94bf8c6..a3f24a3db 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/ItemScopeSequences.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/ItemScopeSequences.cpp @@ -1,8 +1,5 @@ #include "ItemScopeSequences.h" -#include <vector> -#include <string> - #include "Generic/GenericColorPropertySequence.h" #include "Generic/GenericExpressionPropertySequence.h" #include "Generic/GenericFloatingPointPropertySequence.h" @@ -10,68 +7,69 @@ #include "Generic/GenericKeywordPropertySequence.h" #include "Generic/GenericMenuEventHandlerSetPropertySequence.h" #include "Generic/GenericStringPropertySequence.h" -#include "Parsing/Menu/MenuFileCommonOperations.h" #include "Parsing/Menu/Matcher/MenuExpressionMatchers.h" #include "Parsing/Menu/Matcher/MenuMatcherFactory.h" +#include "Parsing/Menu/MenuFileCommonOperations.h" + +#include <string> +#include <vector> using namespace menu; class ItemScopeOperations { - inline static const CommonItemFeatureType IW4_FEATURE_TYPE_BY_TYPE[0x18] - { - CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_TEXT - CommonItemFeatureType::NONE, // ITEM_TYPE_BUTTON - CommonItemFeatureType::NONE, // ITEM_TYPE_RADIOBUTTON - CommonItemFeatureType::NONE, // ITEM_TYPE_CHECKBOX - CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_EDITFIELD - CommonItemFeatureType::NONE, // ITEM_TYPE_COMBO - CommonItemFeatureType::LISTBOX, // ITEM_TYPE_LISTBOX - CommonItemFeatureType::NONE, // ITEM_TYPE_MODEL - CommonItemFeatureType::NONE, // ITEM_TYPE_OWNERDRAW - CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_NUMERICFIELD - CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_SLIDER - CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_YESNO + inline static const CommonItemFeatureType IW4_FEATURE_TYPE_BY_TYPE[0x18]{ + CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_TEXT + CommonItemFeatureType::NONE, // ITEM_TYPE_BUTTON + CommonItemFeatureType::NONE, // ITEM_TYPE_RADIOBUTTON + CommonItemFeatureType::NONE, // ITEM_TYPE_CHECKBOX + CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_EDITFIELD + CommonItemFeatureType::NONE, // ITEM_TYPE_COMBO + CommonItemFeatureType::LISTBOX, // ITEM_TYPE_LISTBOX + CommonItemFeatureType::NONE, // ITEM_TYPE_MODEL + CommonItemFeatureType::NONE, // ITEM_TYPE_OWNERDRAW + CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_NUMERICFIELD + CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_SLIDER + CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_YESNO CommonItemFeatureType::MULTI_VALUE, // ITEM_TYPE_MULTI - CommonItemFeatureType::ENUM_DVAR, // ITEM_TYPE_DVARENUM - CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_BIND - CommonItemFeatureType::NONE, // ITEM_TYPE_MENUMODEL - CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_VALIDFILEFIELD - CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_DECIMALFIELD - CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_UPREDITFIELD - CommonItemFeatureType::NONE, // ITEM_TYPE_GAME_MESSAGE_WINDOW + CommonItemFeatureType::ENUM_DVAR, // ITEM_TYPE_DVARENUM + CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_BIND + CommonItemFeatureType::NONE, // ITEM_TYPE_MENUMODEL + CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_VALIDFILEFIELD + CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_DECIMALFIELD + CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_UPREDITFIELD + CommonItemFeatureType::NONE, // ITEM_TYPE_GAME_MESSAGE_WINDOW CommonItemFeatureType::NEWS_TICKER, // ITEM_TYPE_NEWS_TICKER - CommonItemFeatureType::NONE, // ITEM_TYPE_TEXT_SCROLL - CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_EMAILFIELD - CommonItemFeatureType::EDIT_FIELD // ITEM_TYPE_PASSWORDFIELD + CommonItemFeatureType::NONE, // ITEM_TYPE_TEXT_SCROLL + CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_EMAILFIELD + CommonItemFeatureType::EDIT_FIELD // ITEM_TYPE_PASSWORDFIELD }; - inline static const CommonItemFeatureType IW5_FEATURE_TYPE_BY_TYPE[0x18] - { - CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_TEXT - CommonItemFeatureType::NONE, // ITEM_TYPE_BUTTON - CommonItemFeatureType::NONE, // ITEM_TYPE_RADIOBUTTON - CommonItemFeatureType::NONE, // ITEM_TYPE_CHECKBOX - CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_EDITFIELD - CommonItemFeatureType::NONE, // ITEM_TYPE_COMBO - CommonItemFeatureType::LISTBOX, // ITEM_TYPE_LISTBOX - CommonItemFeatureType::NONE, // ITEM_TYPE_MODEL - CommonItemFeatureType::NONE, // ITEM_TYPE_OWNERDRAW - CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_NUMERICFIELD - CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_SLIDER - CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_YESNO + inline static const CommonItemFeatureType IW5_FEATURE_TYPE_BY_TYPE[0x18]{ + CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_TEXT + CommonItemFeatureType::NONE, // ITEM_TYPE_BUTTON + CommonItemFeatureType::NONE, // ITEM_TYPE_RADIOBUTTON + CommonItemFeatureType::NONE, // ITEM_TYPE_CHECKBOX + CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_EDITFIELD + CommonItemFeatureType::NONE, // ITEM_TYPE_COMBO + CommonItemFeatureType::LISTBOX, // ITEM_TYPE_LISTBOX + CommonItemFeatureType::NONE, // ITEM_TYPE_MODEL + CommonItemFeatureType::NONE, // ITEM_TYPE_OWNERDRAW + CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_NUMERICFIELD + CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_SLIDER + CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_YESNO CommonItemFeatureType::MULTI_VALUE, // ITEM_TYPE_MULTI - CommonItemFeatureType::ENUM_DVAR, // ITEM_TYPE_DVARENUM - CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_BIND - CommonItemFeatureType::NONE, // ITEM_TYPE_MENUMODEL - CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_VALIDFILEFIELD - CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_DECIMALFIELD - CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_UPREDITFIELD - CommonItemFeatureType::NONE, // ITEM_TYPE_GAME_MESSAGE_WINDOW + CommonItemFeatureType::ENUM_DVAR, // ITEM_TYPE_DVARENUM + CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_BIND + CommonItemFeatureType::NONE, // ITEM_TYPE_MENUMODEL + CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_VALIDFILEFIELD + CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_DECIMALFIELD + CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_UPREDITFIELD + CommonItemFeatureType::NONE, // ITEM_TYPE_GAME_MESSAGE_WINDOW CommonItemFeatureType::NEWS_TICKER, // ITEM_TYPE_NEWS_TICKER - CommonItemFeatureType::NONE, // ITEM_TYPE_TEXT_SCROLL - CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_EMAILFIELD - CommonItemFeatureType::EDIT_FIELD // ITEM_TYPE_PASSWORDFIELD + CommonItemFeatureType::NONE, // ITEM_TYPE_TEXT_SCROLL + CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_EMAILFIELD + CommonItemFeatureType::EDIT_FIELD // ITEM_TYPE_PASSWORDFIELD }; public: @@ -160,9 +158,7 @@ namespace menu::item_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({ - create.Char('}') - }); + AddMatchers({create.Char('}')}); } protected: @@ -179,15 +175,11 @@ namespace menu::item_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({ - create.Char(';') - }); + AddMatchers({create.Char(';')}); } protected: - void ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const override - { - } + void ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const override {} }; class SequenceRect final : public MenuFileParser::sequence_t @@ -201,17 +193,12 @@ namespace menu::item_scope_sequences const MenuMatcherFactory create(this); AddLabeledMatchers(MenuExpressionMatchers().Expression(this), MenuExpressionMatchers::LABEL_EXPRESSION); - AddMatchers({ - create.KeywordIgnoreCase("rect"), - create.NumericExpression(), // x - create.NumericExpression(), // y - create.NumericExpression(), // w - create.NumericExpression(), // h - create.Optional(create.And({ - create.Integer().Capture(CAPTURE_ALIGN_HORIZONTAL), - create.Integer().Capture(CAPTURE_ALIGN_VERTICAL) - })) - }); + AddMatchers({create.KeywordIgnoreCase("rect"), + create.NumericExpression(), // x + create.NumericExpression(), // y + create.NumericExpression(), // w + create.NumericExpression(), // h + create.Optional(create.And({create.Integer().Capture(CAPTURE_ALIGN_HORIZONTAL), create.Integer().Capture(CAPTURE_ALIGN_VERTICAL)}))}); } protected: @@ -223,14 +210,7 @@ namespace menu::item_scope_sequences const auto y = MenuMatcherFactory::TokenNumericExpressionValue(state, result); const auto w = MenuMatcherFactory::TokenNumericExpressionValue(state, result); const auto h = MenuMatcherFactory::TokenNumericExpressionValue(state, result); - CommonRect rect - { - x, - y, - w, - h, - 0, 0 - }; + CommonRect rect{x, y, w, h, 0, 0}; if (result.HasNextCapture(CAPTURE_ALIGN_HORIZONTAL) && result.HasNextCapture(CAPTURE_ALIGN_VERTICAL)) { @@ -253,7 +233,7 @@ namespace menu::item_scope_sequences AddMatchers({ create.KeywordIgnoreCase("origin"), create.NumericExpression(), // x - create.NumericExpression() // y + create.NumericExpression() // y }); } @@ -318,13 +298,8 @@ namespace menu::item_scope_sequences AddMatchers({ create.KeywordIgnoreCase(std::move(keyName)).Capture(CAPTURE_FIRST_TOKEN), create.Char('{'), - create.Optional(create.And({ - create.Text().Capture(CAPTURE_VALUE), - create.OptionalLoop(create.And({ - create.Char(';'), - create.Text().Capture(CAPTURE_VALUE) - })) - })), + create.Optional(create.And( + {create.Text().Capture(CAPTURE_VALUE), create.OptionalLoop(create.And({create.Char(';'), create.Text().Capture(CAPTURE_VALUE)}))})), create.Char('}'), }); } @@ -389,17 +364,15 @@ namespace menu::item_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({ - create.KeywordIgnoreCase("dvarStrList").Capture(CAPTURE_FIRST_TOKEN), - create.Char('{'), - create.OptionalLoop(create.And({ - create.TextNoChain().Capture(CAPTURE_STEP_NAME), - create.Optional(create.Char(';')), - create.TextNoChain().Capture(CAPTURE_STEP_VALUE), - create.Optional(create.Char(';')), - })), - create.Char('}') - }); + AddMatchers({create.KeywordIgnoreCase("dvarStrList").Capture(CAPTURE_FIRST_TOKEN), + create.Char('{'), + create.OptionalLoop(create.And({ + create.TextNoChain().Capture(CAPTURE_STEP_NAME), + create.Optional(create.Char(';')), + create.TextNoChain().Capture(CAPTURE_STEP_VALUE), + create.Optional(create.Char(';')), + })), + create.Char('}')}); } protected: @@ -429,17 +402,15 @@ namespace menu::item_scope_sequences const MenuMatcherFactory create(this); AddLabeledMatchers(MenuExpressionMatchers().Expression(this), MenuExpressionMatchers::LABEL_EXPRESSION); - AddMatchers({ - create.KeywordIgnoreCase("dvarFloatList").Capture(CAPTURE_FIRST_TOKEN), - create.Char('{'), - create.OptionalLoop(create.And({ - create.Text().Capture(CAPTURE_STEP_NAME), - create.Optional(create.Char(';')), - create.NumericExpression(), - create.Optional(create.Char(';')), - })), - create.Char('}') - }); + AddMatchers({create.KeywordIgnoreCase("dvarFloatList").Capture(CAPTURE_FIRST_TOKEN), + create.Char('{'), + create.OptionalLoop(create.And({ + create.Text().Capture(CAPTURE_STEP_NAME), + create.Optional(create.Char(';')), + create.NumericExpression(), + create.Optional(create.Char(';')), + })), + create.Char('}')}); } protected: @@ -514,15 +485,12 @@ namespace menu::item_scope_sequences const auto& listBoxFeatures = state->m_current_item->m_list_box_features; while (result.HasNextCapture(CAPTURE_X_POS)) { - CommonItemFeaturesListBox::Column column - { - result.NextCapture(CAPTURE_X_POS).IntegerValue(), - state->m_feature_level == FeatureLevel::IW5 ? result.NextCapture(CAPTURE_Y_POS).IntegerValue() : 0, - result.NextCapture(CAPTURE_WIDTH).IntegerValue(), - state->m_feature_level == FeatureLevel::IW5 ? result.NextCapture(CAPTURE_HEIGHT).IntegerValue() : 0, - result.NextCapture(CAPTURE_MAX_CHARS).IntegerValue(), - result.NextCapture(CAPTURE_ALIGNMENT).IntegerValue() - }; + CommonItemFeaturesListBox::Column column{result.NextCapture(CAPTURE_X_POS).IntegerValue(), + state->m_feature_level == FeatureLevel::IW5 ? result.NextCapture(CAPTURE_Y_POS).IntegerValue() : 0, + result.NextCapture(CAPTURE_WIDTH).IntegerValue(), + state->m_feature_level == FeatureLevel::IW5 ? result.NextCapture(CAPTURE_HEIGHT).IntegerValue() : 0, + result.NextCapture(CAPTURE_MAX_CHARS).IntegerValue(), + result.NextCapture(CAPTURE_ALIGNMENT).IntegerValue()}; listBoxFeatures->m_columns.emplace_back(column); } } @@ -537,11 +505,7 @@ namespace menu::item_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({ - create.KeywordIgnoreCase("execKey"), - create.StringChain().Capture(CAPTURE_KEY), - create.Char('{') - }); + AddMatchers({create.KeywordIgnoreCase("execKey"), create.StringChain().Capture(CAPTURE_KEY), create.Char('{')}); } protected: @@ -573,11 +537,7 @@ namespace menu::item_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({ - create.KeywordIgnoreCase("execKeyInt"), - create.Integer().Capture(CAPTURE_KEY), - create.Char('{') - }); + AddMatchers({create.KeywordIgnoreCase("execKeyInt"), create.Integer().Capture(CAPTURE_KEY), create.Char('{')}); } protected: @@ -597,11 +557,12 @@ namespace menu::item_scope_sequences state->m_current_item->m_key_handlers.emplace(std::make_pair(keyValue, std::move(newEventHandlerSet))); } }; -} +} // namespace menu::item_scope_sequences using namespace item_scope_sequences; -ItemScopeSequences::ItemScopeSequences(std::vector<std::unique_ptr<MenuFileParser::sequence_t>>& allSequences, std::vector<MenuFileParser::sequence_t*>& scopeSequences) +ItemScopeSequences::ItemScopeSequences(std::vector<std::unique_ptr<MenuFileParser::sequence_t>>& allSequences, + std::vector<MenuFileParser::sequence_t*>& scopeSequences) : AbstractScopeSequenceHolder(allSequences, scopeSequences) { } @@ -609,438 +570,575 @@ ItemScopeSequences::ItemScopeSequences(std::vector<std::unique_ptr<MenuFileParse void ItemScopeSequences::AddSequences(FeatureLevel featureLevel, bool permissive) const { AddSequence(std::make_unique<SequenceCloseBlock>()); - AddSequence(std::make_unique<GenericStringPropertySequence>("name", [](const MenuFileParserState* state, const TokenPos&, const std::string& value) - { - state->m_current_item->m_name = value; - })); - AddSequence(std::make_unique<GenericStringPropertySequence>("text", [](const MenuFileParserState* state, const TokenPos&, const std::string& value) - { - state->m_current_item->m_text = value; - })); + AddSequence(std::make_unique<GenericStringPropertySequence>("name", + [](const MenuFileParserState* state, const TokenPos&, const std::string& value) + { + state->m_current_item->m_name = value; + })); + AddSequence(std::make_unique<GenericStringPropertySequence>("text", + [](const MenuFileParserState* state, const TokenPos&, const std::string& value) + { + state->m_current_item->m_text = value; + })); // textfile - AddSequence(std::make_unique<GenericKeywordPropertySequence>("textsavegame", [](const MenuFileParserState* state, const TokenPos&) - { - state->m_current_item->m_text_save_game = true; - })); - AddSequence(std::make_unique<GenericKeywordPropertySequence>("textcinematicsubtitle", [](const MenuFileParserState* state, const TokenPos&) - { - state->m_current_item->m_text_cinematic_subtitle = true; - })); - AddSequence(std::make_unique<GenericStringPropertySequence>("group", [](const MenuFileParserState* state, const TokenPos&, const std::string& value) - { - state->m_current_item->m_group = value; - })); + AddSequence(std::make_unique<GenericKeywordPropertySequence>("textsavegame", + [](const MenuFileParserState* state, const TokenPos&) + { + state->m_current_item->m_text_save_game = true; + })); + AddSequence(std::make_unique<GenericKeywordPropertySequence>("textcinematicsubtitle", + [](const MenuFileParserState* state, const TokenPos&) + { + state->m_current_item->m_text_cinematic_subtitle = true; + })); + AddSequence(std::make_unique<GenericStringPropertySequence>("group", + [](const MenuFileParserState* state, const TokenPos&, const std::string& value) + { + state->m_current_item->m_group = value; + })); AddSequence(std::make_unique<SequenceRect>()); AddSequence(std::make_unique<SequenceOrigin>()); // rect480 // rect720 // pos480 // pos720 - AddSequence(std::make_unique<GenericIntPropertySequence>("style", [](const MenuFileParserState* state, const TokenPos&, const int value) - { - state->m_current_item->m_style = value; - })); - AddSequence(std::make_unique<GenericKeywordPropertySequence>("decoration", [](const MenuFileParserState* state, const TokenPos&) - { - state->m_current_item->m_decoration = true; - })); - AddSequence(std::make_unique<GenericKeywordPropertySequence>("autowrapped", [](const MenuFileParserState* state, const TokenPos&) - { - state->m_current_item->m_auto_wrapped = true; - })); - AddSequence(std::make_unique<GenericKeywordPropertySequence>("horizontalscroll", [](const MenuFileParserState* state, const TokenPos&) - { - state->m_current_item->m_horizontal_scroll = true; - })); - AddSequence(std::make_unique<GenericIntPropertySequence>("type", [](const MenuFileParserState* state, const TokenPos& pos, const int value) - { - ItemScopeOperations::SetItemType(*state->m_current_item, state->m_feature_level, pos, value); - })); - AddSequence(std::make_unique<GenericIntPropertySequence>("border", [](const MenuFileParserState* state, const TokenPos&, const int value) - { - state->m_current_item->m_border = value; - })); - AddSequence(std::make_unique<GenericFloatingPointPropertySequence>("borderSize", [](const MenuFileParserState* state, const TokenPos&, const double value) - { - state->m_current_item->m_border_size = value; - })); - AddSequence(GenericExpressionPropertySequence::WithKeywordAndBool("visible", [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_item->m_visible_expression = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywordAndBool("disabled", [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_item->m_disabled_expression = std::move(value); - })); - AddSequence(std::make_unique<GenericIntPropertySequence>("ownerdraw", [](const MenuFileParserState* state, const TokenPos&, const int value) - { - state->m_current_item->m_owner_draw = value; - })); - AddSequence(std::make_unique<GenericIntPropertySequence>("align", [](const MenuFileParserState* state, const TokenPos&, const int value) - { - state->m_current_item->m_align = value; - })); - AddSequence(std::make_unique<GenericIntPropertySequence>("textalign", [](const MenuFileParserState* state, const TokenPos&, const int value) - { - state->m_current_item->m_text_align = value; - })); - AddSequence(std::make_unique<GenericFloatingPointPropertySequence>("textalignx", [](const MenuFileParserState* state, const TokenPos&, const double value) - { - state->m_current_item->m_text_align_x = value; - })); - AddSequence(std::make_unique<GenericFloatingPointPropertySequence>("textaligny", [](const MenuFileParserState* state, const TokenPos&, const double value) - { - state->m_current_item->m_text_align_y = value; - })); - AddSequence(std::make_unique<GenericFloatingPointPropertySequence>("textscale", [](const MenuFileParserState* state, const TokenPos&, const double value) - { - state->m_current_item->m_text_scale = value; - })); - AddSequence(std::make_unique<GenericIntPropertySequence>("textstyle", [](const MenuFileParserState* state, const TokenPos&, const int value) - { - state->m_current_item->m_text_style = value; - })); - AddSequence(std::make_unique<GenericIntPropertySequence>("textfont", [](const MenuFileParserState* state, const TokenPos&, const int value) - { - state->m_current_item->m_text_font = value; - })); - AddSequence(std::make_unique<GenericColorPropertySequence>("backcolor", [](const MenuFileParserState* state, const TokenPos&, const CommonColor value) - { - state->m_current_item->m_back_color = value; - })); - AddSequence(std::make_unique<GenericColorPropertySequence>("forecolor", [](const MenuFileParserState* state, const TokenPos&, const CommonColor value) - { - state->m_current_item->m_fore_color = value; - })); - AddSequence(std::make_unique<GenericColorPropertySequence>("bordercolor", [](const MenuFileParserState* state, const TokenPos&, const CommonColor value) - { - state->m_current_item->m_border_color = value; - })); - AddSequence(std::make_unique<GenericColorPropertySequence>("outlinecolor", [](const MenuFileParserState* state, const TokenPos&, const CommonColor value) - { - state->m_current_item->m_outline_color = value; - })); - AddSequence(std::make_unique<GenericColorPropertySequence>("disablecolor", [](const MenuFileParserState* state, const TokenPos&, const CommonColor value) - { - state->m_current_item->m_disable_color = value; - })); - AddSequence(std::make_unique<GenericColorPropertySequence>("glowcolor", [](const MenuFileParserState* state, const TokenPos&, const CommonColor value) - { - state->m_current_item->m_glow_color = value; - })); - AddSequence(std::make_unique<GenericStringPropertySequence>("background", [](const MenuFileParserState* state, const TokenPos&, const std::string& value) - { - state->m_current_item->m_background = value; - })); - AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>("onFocus", [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& { - return state->m_current_item->m_on_focus; - })); - AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>("leaveFocus", [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& { - return state->m_current_item->m_on_leave_focus; - })); - AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>("mouseEnter", [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& { - return state->m_current_item->m_on_mouse_enter; - })); - AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>("mouseExit", [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& { - return state->m_current_item->m_on_mouse_exit; - })); - AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>("mouseEnterText", [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& { - return state->m_current_item->m_on_mouse_enter_text; - })); - AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>("mouseExitText", [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& { - return state->m_current_item->m_on_mouse_exit_text; - })); - AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>("action", [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& { - return state->m_current_item->m_on_action; - })); - AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>("accept", [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& { - return state->m_current_item->m_on_accept; - })); + AddSequence(std::make_unique<GenericIntPropertySequence>("style", + [](const MenuFileParserState* state, const TokenPos&, const int value) + { + state->m_current_item->m_style = value; + })); + AddSequence(std::make_unique<GenericKeywordPropertySequence>("decoration", + [](const MenuFileParserState* state, const TokenPos&) + { + state->m_current_item->m_decoration = true; + })); + AddSequence(std::make_unique<GenericKeywordPropertySequence>("autowrapped", + [](const MenuFileParserState* state, const TokenPos&) + { + state->m_current_item->m_auto_wrapped = true; + })); + AddSequence(std::make_unique<GenericKeywordPropertySequence>("horizontalscroll", + [](const MenuFileParserState* state, const TokenPos&) + { + state->m_current_item->m_horizontal_scroll = true; + })); + AddSequence(std::make_unique<GenericIntPropertySequence>("type", + [](const MenuFileParserState* state, const TokenPos& pos, const int value) + { + ItemScopeOperations::SetItemType(*state->m_current_item, state->m_feature_level, pos, value); + })); + AddSequence(std::make_unique<GenericIntPropertySequence>("border", + [](const MenuFileParserState* state, const TokenPos&, const int value) + { + state->m_current_item->m_border = value; + })); + AddSequence(std::make_unique<GenericFloatingPointPropertySequence>("borderSize", + [](const MenuFileParserState* state, const TokenPos&, const double value) + { + state->m_current_item->m_border_size = value; + })); + AddSequence(GenericExpressionPropertySequence::WithKeywordAndBool( + "visible", + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_item->m_visible_expression = std::move(value); + })); + AddSequence(GenericExpressionPropertySequence::WithKeywordAndBool( + "disabled", + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_item->m_disabled_expression = std::move(value); + })); + AddSequence(std::make_unique<GenericIntPropertySequence>("ownerdraw", + [](const MenuFileParserState* state, const TokenPos&, const int value) + { + state->m_current_item->m_owner_draw = value; + })); + AddSequence(std::make_unique<GenericIntPropertySequence>("align", + [](const MenuFileParserState* state, const TokenPos&, const int value) + { + state->m_current_item->m_align = value; + })); + AddSequence(std::make_unique<GenericIntPropertySequence>("textalign", + [](const MenuFileParserState* state, const TokenPos&, const int value) + { + state->m_current_item->m_text_align = value; + })); + AddSequence(std::make_unique<GenericFloatingPointPropertySequence>("textalignx", + [](const MenuFileParserState* state, const TokenPos&, const double value) + { + state->m_current_item->m_text_align_x = value; + })); + AddSequence(std::make_unique<GenericFloatingPointPropertySequence>("textaligny", + [](const MenuFileParserState* state, const TokenPos&, const double value) + { + state->m_current_item->m_text_align_y = value; + })); + AddSequence(std::make_unique<GenericFloatingPointPropertySequence>("textscale", + [](const MenuFileParserState* state, const TokenPos&, const double value) + { + state->m_current_item->m_text_scale = value; + })); + AddSequence(std::make_unique<GenericIntPropertySequence>("textstyle", + [](const MenuFileParserState* state, const TokenPos&, const int value) + { + state->m_current_item->m_text_style = value; + })); + AddSequence(std::make_unique<GenericIntPropertySequence>("textfont", + [](const MenuFileParserState* state, const TokenPos&, const int value) + { + state->m_current_item->m_text_font = value; + })); + AddSequence(std::make_unique<GenericColorPropertySequence>("backcolor", + [](const MenuFileParserState* state, const TokenPos&, const CommonColor value) + { + state->m_current_item->m_back_color = value; + })); + AddSequence(std::make_unique<GenericColorPropertySequence>("forecolor", + [](const MenuFileParserState* state, const TokenPos&, const CommonColor value) + { + state->m_current_item->m_fore_color = value; + })); + AddSequence(std::make_unique<GenericColorPropertySequence>("bordercolor", + [](const MenuFileParserState* state, const TokenPos&, const CommonColor value) + { + state->m_current_item->m_border_color = value; + })); + AddSequence(std::make_unique<GenericColorPropertySequence>("outlinecolor", + [](const MenuFileParserState* state, const TokenPos&, const CommonColor value) + { + state->m_current_item->m_outline_color = value; + })); + AddSequence(std::make_unique<GenericColorPropertySequence>("disablecolor", + [](const MenuFileParserState* state, const TokenPos&, const CommonColor value) + { + state->m_current_item->m_disable_color = value; + })); + AddSequence(std::make_unique<GenericColorPropertySequence>("glowcolor", + [](const MenuFileParserState* state, const TokenPos&, const CommonColor value) + { + state->m_current_item->m_glow_color = value; + })); + AddSequence(std::make_unique<GenericStringPropertySequence>("background", + [](const MenuFileParserState* state, const TokenPos&, const std::string& value) + { + state->m_current_item->m_background = value; + })); + AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>( + "onFocus", + [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& + { + return state->m_current_item->m_on_focus; + })); + AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>( + "leaveFocus", + [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& + { + return state->m_current_item->m_on_leave_focus; + })); + AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>( + "mouseEnter", + [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& + { + return state->m_current_item->m_on_mouse_enter; + })); + AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>( + "mouseExit", + [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& + { + return state->m_current_item->m_on_mouse_exit; + })); + AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>( + "mouseEnterText", + [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& + { + return state->m_current_item->m_on_mouse_enter_text; + })); + AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>( + "mouseExitText", + [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& + { + return state->m_current_item->m_on_mouse_exit_text; + })); + AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>( + "action", + [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& + { + return state->m_current_item->m_on_action; + })); + AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>( + "accept", + [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& + { + return state->m_current_item->m_on_accept; + })); // special - AddSequence(std::make_unique<GenericStringPropertySequence>("dvar", [](const MenuFileParserState* state, const TokenPos&, const std::string& value) - { - state->m_current_item->m_dvar = value; - })); - AddSequence(std::make_unique<GenericStringPropertySequence>("focusSound", [](const MenuFileParserState* state, const TokenPos&, const std::string& value) - { - state->m_current_item->m_focus_sound = value; - })); - AddSequence(std::make_unique<GenericIntPropertySequence>("ownerdrawFlag", [](const MenuFileParserState* state, const TokenPos&, const int value) - { - state->m_current_item->m_owner_draw_flags |= value; - })); - AddSequence(std::make_unique<SequenceMultiTokenBlock>("enableDvar", [](const MenuFileParserState* state, const TokenPos&, std::vector<std::string> value) - { - state->m_current_item->m_enable_dvar = std::move(value); - })); - AddSequence(std::make_unique<GenericStringPropertySequence>("dvarTest", [](const MenuFileParserState* state, const TokenPos&, const std::string& value) - { - state->m_current_item->m_dvar_test = value; - })); - AddSequence(std::make_unique<SequenceMultiTokenBlock>("disableDvar", [](const MenuFileParserState* state, const TokenPos&, std::vector<std::string> value) - { - state->m_current_item->m_disable_dvar = std::move(value); - })); - AddSequence(std::make_unique<SequenceMultiTokenBlock>("showDvar", [](const MenuFileParserState* state, const TokenPos&, std::vector<std::string> value) - { - state->m_current_item->m_show_dvar = std::move(value); - })); - AddSequence(std::make_unique<SequenceMultiTokenBlock>("hideDvar", [](const MenuFileParserState* state, const TokenPos&, std::vector<std::string> value) - { - state->m_current_item->m_hide_dvar = std::move(value); - })); - AddSequence(std::make_unique<SequenceMultiTokenBlock>("focusDvar", [](const MenuFileParserState* state, const TokenPos&, std::vector<std::string> value) - { - state->m_current_item->m_focus_dvar = std::move(value); - })); + AddSequence(std::make_unique<GenericStringPropertySequence>("dvar", + [](const MenuFileParserState* state, const TokenPos&, const std::string& value) + { + state->m_current_item->m_dvar = value; + })); + AddSequence(std::make_unique<GenericStringPropertySequence>("focusSound", + [](const MenuFileParserState* state, const TokenPos&, const std::string& value) + { + state->m_current_item->m_focus_sound = value; + })); + AddSequence(std::make_unique<GenericIntPropertySequence>("ownerdrawFlag", + [](const MenuFileParserState* state, const TokenPos&, const int value) + { + state->m_current_item->m_owner_draw_flags |= value; + })); + AddSequence(std::make_unique<SequenceMultiTokenBlock>("enableDvar", + [](const MenuFileParserState* state, const TokenPos&, std::vector<std::string> value) + { + state->m_current_item->m_enable_dvar = std::move(value); + })); + AddSequence(std::make_unique<GenericStringPropertySequence>("dvarTest", + [](const MenuFileParserState* state, const TokenPos&, const std::string& value) + { + state->m_current_item->m_dvar_test = value; + })); + AddSequence(std::make_unique<SequenceMultiTokenBlock>("disableDvar", + [](const MenuFileParserState* state, const TokenPos&, std::vector<std::string> value) + { + state->m_current_item->m_disable_dvar = std::move(value); + })); + AddSequence(std::make_unique<SequenceMultiTokenBlock>("showDvar", + [](const MenuFileParserState* state, const TokenPos&, std::vector<std::string> value) + { + state->m_current_item->m_show_dvar = std::move(value); + })); + AddSequence(std::make_unique<SequenceMultiTokenBlock>("hideDvar", + [](const MenuFileParserState* state, const TokenPos&, std::vector<std::string> value) + { + state->m_current_item->m_hide_dvar = std::move(value); + })); + AddSequence(std::make_unique<SequenceMultiTokenBlock>("focusDvar", + [](const MenuFileParserState* state, const TokenPos&, std::vector<std::string> value) + { + state->m_current_item->m_focus_dvar = std::move(value); + })); AddSequence(std::make_unique<SequenceExecKey>()); AddSequence(std::make_unique<SequenceExecKeyInt>()); - AddSequence(std::make_unique<GenericIntPropertySequence>("gamemsgwindowindex", [](const MenuFileParserState* state, const TokenPos&, const int value) - { - state->m_current_item->m_game_message_window_index = value; - })); - AddSequence(std::make_unique<GenericIntPropertySequence>("gamemsgwindowmode", [](const MenuFileParserState* state, const TokenPos&, const int value) - { - state->m_current_item->m_game_message_window_mode = value; - })); + AddSequence(std::make_unique<GenericIntPropertySequence>("gamemsgwindowindex", + [](const MenuFileParserState* state, const TokenPos&, const int value) + { + state->m_current_item->m_game_message_window_index = value; + })); + AddSequence(std::make_unique<GenericIntPropertySequence>("gamemsgwindowmode", + [](const MenuFileParserState* state, const TokenPos&, const int value) + { + state->m_current_item->m_game_message_window_mode = value; + })); AddSequence(std::make_unique<SequenceDecodeEffect>()); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "disabled"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_item->m_disabled_expression = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "text"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsStringExpression(state, pos, *value); - state->m_current_item->m_text_expression = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "material"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsStringExpression(state, pos, *value); - state->m_current_item->m_material_expression = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "rect", "X"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_item->m_rect_x_exp = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "rect", "Y"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_item->m_rect_y_exp = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "rect", "W"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_item->m_rect_w_exp = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "rect", "H"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_item->m_rect_h_exp = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "forecolor", "R"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_item->m_forecolor_expressions.m_r_exp = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "forecolor", "G"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_item->m_forecolor_expressions.m_g_exp = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "forecolor", "B"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_item->m_forecolor_expressions.m_b_exp = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "forecolor", "A"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_item->m_forecolor_expressions.m_a_exp = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "forecolor", "RGB"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_item->m_forecolor_expressions.m_rgb_exp = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "glowcolor", "R"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_item->m_glowcolor_expressions.m_r_exp = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "glowcolor", "G"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_item->m_glowcolor_expressions.m_g_exp = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "glowcolor", "B"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_item->m_glowcolor_expressions.m_b_exp = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "glowcolor", "A"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_item->m_glowcolor_expressions.m_a_exp = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "glowcolor", "RGB"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_item->m_glowcolor_expressions.m_rgb_exp = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "backcolor", "R"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_item->m_backcolor_expressions.m_r_exp = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "backcolor", "G"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_item->m_backcolor_expressions.m_g_exp = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "backcolor", "B"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_item->m_backcolor_expressions.m_b_exp = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "backcolor", "A"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_item->m_backcolor_expressions.m_a_exp = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "backcolor", "RGB"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_item->m_backcolor_expressions.m_rgb_exp = std::move(value); - })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "disabled"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_item->m_disabled_expression = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "text"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsStringExpression(state, pos, *value); + state->m_current_item->m_text_expression = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "material"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsStringExpression(state, pos, *value); + state->m_current_item->m_material_expression = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "rect", "X"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_item->m_rect_x_exp = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "rect", "Y"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_item->m_rect_y_exp = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "rect", "W"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_item->m_rect_w_exp = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "rect", "H"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_item->m_rect_h_exp = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "forecolor", "R"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_item->m_forecolor_expressions.m_r_exp = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "forecolor", "G"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_item->m_forecolor_expressions.m_g_exp = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "forecolor", "B"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_item->m_forecolor_expressions.m_b_exp = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "forecolor", "A"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_item->m_forecolor_expressions.m_a_exp = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "forecolor", "RGB"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_item->m_forecolor_expressions.m_rgb_exp = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "glowcolor", "R"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_item->m_glowcolor_expressions.m_r_exp = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "glowcolor", "G"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_item->m_glowcolor_expressions.m_g_exp = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "glowcolor", "B"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_item->m_glowcolor_expressions.m_b_exp = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "glowcolor", "A"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_item->m_glowcolor_expressions.m_a_exp = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "glowcolor", "RGB"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_item->m_glowcolor_expressions.m_rgb_exp = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "backcolor", "R"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_item->m_backcolor_expressions.m_r_exp = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "backcolor", "G"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_item->m_backcolor_expressions.m_g_exp = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "backcolor", "B"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_item->m_backcolor_expressions.m_b_exp = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "backcolor", "A"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_item->m_backcolor_expressions.m_a_exp = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "backcolor", "RGB"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_item->m_backcolor_expressions.m_rgb_exp = std::move(value); + })); if (featureLevel == FeatureLevel::IW5) { - AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>("hasFocus", [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& { - return state->m_current_item->m_has_focus; - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "textaligny"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_item->m_text_align_y_expression = std::move(value); - })); + AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>( + "hasFocus", + [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& + { + return state->m_current_item->m_has_focus; + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "textaligny"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_item->m_text_align_y_expression = std::move(value); + })); } // ============== ListBox ============== AddSequence(std::make_unique<SequenceColumns>(featureLevel)); - AddSequence(std::make_unique<GenericKeywordPropertySequence>("notselectable", [](const MenuFileParserState* state, const TokenPos& pos) - { - ItemScopeOperations::EnsureHasListboxFeatures(*state->m_current_item, pos); - state->m_current_item->m_list_box_features->m_not_selectable = true; - })); - AddSequence(std::make_unique<GenericKeywordPropertySequence>("noscrollbars", [](const MenuFileParserState* state, const TokenPos& pos) - { - ItemScopeOperations::EnsureHasListboxFeatures(*state->m_current_item, pos); - state->m_current_item->m_list_box_features->m_no_scrollbars = true; - })); - AddSequence(std::make_unique<GenericKeywordPropertySequence>("usepaging", [](const MenuFileParserState* state, const TokenPos& pos) - { - ItemScopeOperations::EnsureHasListboxFeatures(*state->m_current_item, pos); - state->m_current_item->m_list_box_features->m_use_paging = true; - })); - AddSequence(std::make_unique<GenericFloatingPointPropertySequence>("elementwidth", [](const MenuFileParserState* state, const TokenPos& pos, const double value) - { - ItemScopeOperations::EnsureHasListboxFeatures(*state->m_current_item, pos); - state->m_current_item->m_list_box_features->m_element_width = value; - })); - AddSequence(std::make_unique<GenericFloatingPointPropertySequence>("elementheight", [](const MenuFileParserState* state, const TokenPos& pos, const double value) - { - ItemScopeOperations::EnsureHasListboxFeatures(*state->m_current_item, pos); - state->m_current_item->m_list_box_features->m_element_height = value; - })); - AddSequence(std::make_unique<GenericFloatingPointPropertySequence>("feeder", [](const MenuFileParserState* state, const TokenPos& pos, const double value) - { - ItemScopeOperations::EnsureHasListboxFeatures(*state->m_current_item, pos); - state->m_current_item->m_list_box_features->m_feeder = value; - })); - AddSequence(std::make_unique<GenericIntPropertySequence>("elementtype", [](const MenuFileParserState* state, const TokenPos& pos, const int value) - { - ItemScopeOperations::EnsureHasListboxFeatures(*state->m_current_item, pos); - state->m_current_item->m_list_box_features->m_element_style = value; - })); - AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>("doubleclick", [](const MenuFileParserState* state, const TokenPos& pos) -> std::unique_ptr<CommonEventHandlerSet>& { - ItemScopeOperations::EnsureHasListboxFeatures(*state->m_current_item, pos); - return state->m_current_item->m_list_box_features->m_on_double_click; - })); - AddSequence(std::make_unique<GenericColorPropertySequence>("selectBorder", [](const MenuFileParserState* state, const TokenPos& pos, const CommonColor value) - { - ItemScopeOperations::EnsureHasListboxFeatures(*state->m_current_item, pos); - state->m_current_item->m_list_box_features->m_select_border = value; - })); - AddSequence(std::make_unique<GenericStringPropertySequence>("selectIcon", [](const MenuFileParserState* state, const TokenPos& pos, const std::string& value) - { - ItemScopeOperations::EnsureHasListboxFeatures(*state->m_current_item, pos); - state->m_current_item->m_list_box_features->m_select_icon = value; - })); - - if (featureLevel == FeatureLevel::IW5) - { - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "elementheight"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + AddSequence(std::make_unique<GenericKeywordPropertySequence>("notselectable", + [](const MenuFileParserState* state, const TokenPos& pos) + { + ItemScopeOperations::EnsureHasListboxFeatures(*state->m_current_item, pos); + state->m_current_item->m_list_box_features->m_not_selectable = true; + })); + AddSequence(std::make_unique<GenericKeywordPropertySequence>("noscrollbars", + [](const MenuFileParserState* state, const TokenPos& pos) + { + ItemScopeOperations::EnsureHasListboxFeatures(*state->m_current_item, pos); + state->m_current_item->m_list_box_features->m_no_scrollbars = true; + })); + AddSequence(std::make_unique<GenericKeywordPropertySequence>("usepaging", + [](const MenuFileParserState* state, const TokenPos& pos) + { + ItemScopeOperations::EnsureHasListboxFeatures(*state->m_current_item, pos); + state->m_current_item->m_list_box_features->m_use_paging = true; + })); + AddSequence(std::make_unique<GenericFloatingPointPropertySequence>("elementwidth", + [](const MenuFileParserState* state, const TokenPos& pos, const double value) + { + ItemScopeOperations::EnsureHasListboxFeatures(*state->m_current_item, pos); + state->m_current_item->m_list_box_features->m_element_width = value; + })); + AddSequence(std::make_unique<GenericFloatingPointPropertySequence>("elementheight", + [](const MenuFileParserState* state, const TokenPos& pos, const double value) + { + ItemScopeOperations::EnsureHasListboxFeatures(*state->m_current_item, pos); + state->m_current_item->m_list_box_features->m_element_height = value; + })); + AddSequence(std::make_unique<GenericFloatingPointPropertySequence>("feeder", + [](const MenuFileParserState* state, const TokenPos& pos, const double value) + { + ItemScopeOperations::EnsureHasListboxFeatures(*state->m_current_item, pos); + state->m_current_item->m_list_box_features->m_feeder = value; + })); + AddSequence(std::make_unique<GenericIntPropertySequence>("elementtype", + [](const MenuFileParserState* state, const TokenPos& pos, const int value) + { + ItemScopeOperations::EnsureHasListboxFeatures(*state->m_current_item, pos); + state->m_current_item->m_list_box_features->m_element_style = value; + })); + AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>( + "doubleclick", + [](const MenuFileParserState* state, const TokenPos& pos) -> std::unique_ptr<CommonEventHandlerSet>& { ItemScopeOperations::EnsureHasListboxFeatures(*state->m_current_item, pos); - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_item->m_list_box_features->m_element_height_expression = std::move(value); + return state->m_current_item->m_list_box_features->m_on_double_click; })); + AddSequence(std::make_unique<GenericColorPropertySequence>("selectBorder", + [](const MenuFileParserState* state, const TokenPos& pos, const CommonColor value) + { + ItemScopeOperations::EnsureHasListboxFeatures(*state->m_current_item, pos); + state->m_current_item->m_list_box_features->m_select_border = value; + })); + AddSequence(std::make_unique<GenericStringPropertySequence>("selectIcon", + [](const MenuFileParserState* state, const TokenPos& pos, const std::string& value) + { + ItemScopeOperations::EnsureHasListboxFeatures(*state->m_current_item, pos); + state->m_current_item->m_list_box_features->m_select_icon = value; + })); + + if (featureLevel == FeatureLevel::IW5) + { + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "elementheight"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + ItemScopeOperations::EnsureHasListboxFeatures(*state->m_current_item, pos); + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_item->m_list_box_features->m_element_height_expression = std::move(value); + })); } // ============== Edit Field ============== AddSequence(std::make_unique<SequenceDvarFloat>()); - AddSequence(std::make_unique<GenericStringPropertySequence>("localvar", [](const MenuFileParserState* state, const TokenPos& pos, const std::string& value) - { - ItemScopeOperations::EnsureHasEditFieldFeatures(*state->m_current_item, pos); - state->m_current_item->m_edit_field_features->m_local_var = value; - })); - AddSequence(std::make_unique<GenericIntPropertySequence>("maxChars", [](const MenuFileParserState* state, const TokenPos& pos, const int value) - { - ItemScopeOperations::EnsureHasEditFieldFeatures(*state->m_current_item, pos); - state->m_current_item->m_edit_field_features->m_max_chars = value; - })); - AddSequence(std::make_unique<GenericIntPropertySequence>("maxPaintChars", [](const MenuFileParserState* state, const TokenPos& pos, const int value) - { - ItemScopeOperations::EnsureHasEditFieldFeatures(*state->m_current_item, pos); - state->m_current_item->m_edit_field_features->m_max_paint_chars = value; - })); - AddSequence(std::make_unique<GenericKeywordPropertySequence>("maxCharsGotoNext", [](const MenuFileParserState* state, const TokenPos& pos) - { - ItemScopeOperations::EnsureHasEditFieldFeatures(*state->m_current_item, pos); - state->m_current_item->m_edit_field_features->m_max_chars_goto_next = true; - })); + AddSequence(std::make_unique<GenericStringPropertySequence>("localvar", + [](const MenuFileParserState* state, const TokenPos& pos, const std::string& value) + { + ItemScopeOperations::EnsureHasEditFieldFeatures(*state->m_current_item, pos); + state->m_current_item->m_edit_field_features->m_local_var = value; + })); + AddSequence(std::make_unique<GenericIntPropertySequence>("maxChars", + [](const MenuFileParserState* state, const TokenPos& pos, const int value) + { + ItemScopeOperations::EnsureHasEditFieldFeatures(*state->m_current_item, pos); + state->m_current_item->m_edit_field_features->m_max_chars = value; + })); + AddSequence(std::make_unique<GenericIntPropertySequence>("maxPaintChars", + [](const MenuFileParserState* state, const TokenPos& pos, const int value) + { + ItemScopeOperations::EnsureHasEditFieldFeatures(*state->m_current_item, pos); + state->m_current_item->m_edit_field_features->m_max_paint_chars = value; + })); + AddSequence(std::make_unique<GenericKeywordPropertySequence>("maxCharsGotoNext", + [](const MenuFileParserState* state, const TokenPos& pos) + { + ItemScopeOperations::EnsureHasEditFieldFeatures(*state->m_current_item, pos); + state->m_current_item->m_edit_field_features->m_max_chars_goto_next = true; + })); // ============== Multi Value ============== AddSequence(std::make_unique<SequenceDvarStrList>()); AddSequence(std::make_unique<SequenceDvarFloatList>()); // ============== Enum Dvar ============== - AddSequence(std::make_unique<GenericStringPropertySequence>("dvarEnumList", [](const MenuFileParserState* state, const TokenPos& pos, const std::string& value) - { - ItemScopeOperations::EnsureHasEnumDvarFeatures(*state->m_current_item, pos); - state->m_current_item->m_enum_dvar_name = value; - })); + AddSequence(std::make_unique<GenericStringPropertySequence>("dvarEnumList", + [](const MenuFileParserState* state, const TokenPos& pos, const std::string& value) + { + ItemScopeOperations::EnsureHasEnumDvarFeatures(*state->m_current_item, pos); + state->m_current_item->m_enum_dvar_name = value; + })); // ============== News Ticker ============== - AddSequence(std::make_unique<GenericIntPropertySequence>("spacing", [](const MenuFileParserState* state, const TokenPos& pos, const int value) - { - ItemScopeOperations::EnsureHasNewsTickerFeatures(*state->m_current_item, pos); - state->m_current_item->m_news_ticker_features->m_spacing = value; - })); - AddSequence(std::make_unique<GenericIntPropertySequence>("speed", [](const MenuFileParserState* state, const TokenPos& pos, const int value) - { - ItemScopeOperations::EnsureHasNewsTickerFeatures(*state->m_current_item, pos); - state->m_current_item->m_news_ticker_features->m_speed = value; - })); - AddSequence(std::make_unique<GenericIntPropertySequence>("newsfeed", [](const MenuFileParserState* state, const TokenPos& pos, const int value) - { - ItemScopeOperations::EnsureHasNewsTickerFeatures(*state->m_current_item, pos); - state->m_current_item->m_news_ticker_features->m_news_feed_id = value; - })); + AddSequence(std::make_unique<GenericIntPropertySequence>("spacing", + [](const MenuFileParserState* state, const TokenPos& pos, const int value) + { + ItemScopeOperations::EnsureHasNewsTickerFeatures(*state->m_current_item, pos); + state->m_current_item->m_news_ticker_features->m_spacing = value; + })); + AddSequence(std::make_unique<GenericIntPropertySequence>("speed", + [](const MenuFileParserState* state, const TokenPos& pos, const int value) + { + ItemScopeOperations::EnsureHasNewsTickerFeatures(*state->m_current_item, pos); + state->m_current_item->m_news_ticker_features->m_speed = value; + })); + AddSequence(std::make_unique<GenericIntPropertySequence>("newsfeed", + [](const MenuFileParserState* state, const TokenPos& pos, const int value) + { + ItemScopeOperations::EnsureHasNewsTickerFeatures(*state->m_current_item, pos); + state->m_current_item->m_news_ticker_features->m_news_feed_id = value; + })); AddSequence(std::make_unique<SequenceConsumeSemicolons>()); } diff --git a/src/ObjLoading/Parsing/Menu/Sequence/ItemScopeSequences.h b/src/ObjLoading/Parsing/Menu/Sequence/ItemScopeSequences.h index 357435939..843403653 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/ItemScopeSequences.h +++ b/src/ObjLoading/Parsing/Menu/Sequence/ItemScopeSequences.h @@ -12,4 +12,4 @@ namespace menu void AddSequences(FeatureLevel featureLevel, bool permissive) const; }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Sequence/MenuScopeSequences.cpp b/src/ObjLoading/Parsing/Menu/Sequence/MenuScopeSequences.cpp index cbfbbed64..ec85215dd 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/MenuScopeSequences.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/MenuScopeSequences.cpp @@ -1,7 +1,5 @@ #include "MenuScopeSequences.h" -#include <sstream> - #include "Generic/GenericBoolPropertySequence.h" #include "Generic/GenericColorPropertySequence.h" #include "Generic/GenericExpressionPropertySequence.h" @@ -10,10 +8,12 @@ #include "Generic/GenericKeywordPropertySequence.h" #include "Generic/GenericMenuEventHandlerSetPropertySequence.h" #include "Generic/GenericStringPropertySequence.h" -#include "Parsing/Menu/MenuFileCommonOperations.h" -#include "Parsing/Menu/Matcher/MenuMatcherFactory.h" #include "Parsing/Menu/Domain/CommonMenuTypes.h" #include "Parsing/Menu/Matcher/MenuExpressionMatchers.h" +#include "Parsing/Menu/Matcher/MenuMatcherFactory.h" +#include "Parsing/Menu/MenuFileCommonOperations.h" + +#include <sstream> using namespace menu; @@ -28,9 +28,7 @@ namespace menu::menu_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({ - create.Char('}').Capture(CAPTURE_TOKEN) - }); + AddMatchers({create.Char('}').Capture(CAPTURE_TOKEN)}); } protected: @@ -61,15 +59,11 @@ namespace menu::menu_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({ - create.Char(';') - }); + AddMatchers({create.Char(';')}); } protected: - void ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const override - { - } + void ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const override {} }; class SequenceItemDef final : public MenuFileParser::sequence_t @@ -81,10 +75,7 @@ namespace menu::menu_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({ - create.Keyword("itemDef"), - create.Char('{') - }); + AddMatchers({create.Keyword("itemDef"), create.Char('{')}); } protected: @@ -107,17 +98,12 @@ namespace menu::menu_scope_sequences const MenuMatcherFactory create(this); AddLabeledMatchers(MenuExpressionMatchers().Expression(this), MenuExpressionMatchers::LABEL_EXPRESSION); - AddMatchers({ - create.KeywordIgnoreCase("rect"), - create.NumericExpression(), // x - create.NumericExpression(), // y - create.NumericExpression(), // w - create.NumericExpression(), // h - create.Optional(create.And({ - create.Integer().Capture(CAPTURE_ALIGN_HORIZONTAL), - create.Integer().Capture(CAPTURE_ALIGN_VERTICAL) - })) - }); + AddMatchers({create.KeywordIgnoreCase("rect"), + create.NumericExpression(), // x + create.NumericExpression(), // y + create.NumericExpression(), // w + create.NumericExpression(), // h + create.Optional(create.And({create.Integer().Capture(CAPTURE_ALIGN_HORIZONTAL), create.Integer().Capture(CAPTURE_ALIGN_VERTICAL)}))}); } protected: @@ -129,14 +115,7 @@ namespace menu::menu_scope_sequences const auto y = MenuMatcherFactory::TokenNumericExpressionValue(state, result); const auto w = MenuMatcherFactory::TokenNumericExpressionValue(state, result); const auto h = MenuMatcherFactory::TokenNumericExpressionValue(state, result); - CommonRect rect - { - x, - y, - w, - h, - 0, 0 - }; + CommonRect rect{x, y, w, h, 0, 0}; if (result.HasNextCapture(CAPTURE_ALIGN_HORIZONTAL) && result.HasNextCapture(CAPTURE_ALIGN_VERTICAL)) { @@ -157,11 +136,7 @@ namespace menu::menu_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({ - create.KeywordIgnoreCase("execKey"), - create.StringChain().Capture(CAPTURE_KEY), - create.Char('{') - }); + AddMatchers({create.KeywordIgnoreCase("execKey"), create.StringChain().Capture(CAPTURE_KEY), create.Char('{')}); } protected: @@ -193,11 +168,7 @@ namespace menu::menu_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({ - create.KeywordIgnoreCase("execKeyInt"), - create.Integer().Capture(CAPTURE_KEY), - create.Char('{') - }); + AddMatchers({create.KeywordIgnoreCase("execKeyInt"), create.Integer().Capture(CAPTURE_KEY), create.Char('{')}); } protected: @@ -217,11 +188,12 @@ namespace menu::menu_scope_sequences state->m_current_menu->m_key_handlers.emplace(std::make_pair(keyValue, std::move(newEventHandlerSet))); } }; -} +} // namespace menu::menu_scope_sequences using namespace menu_scope_sequences; -MenuScopeSequences::MenuScopeSequences(std::vector<std::unique_ptr<MenuFileParser::sequence_t>>& allSequences, std::vector<MenuFileParser::sequence_t*>& scopeSequences) +MenuScopeSequences::MenuScopeSequences(std::vector<std::unique_ptr<MenuFileParser::sequence_t>>& allSequences, + std::vector<MenuFileParser::sequence_t*>& scopeSequences) : AbstractScopeSequenceHolder(allSequences, scopeSequences) { } @@ -230,190 +202,248 @@ void MenuScopeSequences::AddSequences(FeatureLevel featureLevel, bool permissive { AddSequence(std::make_unique<SequenceCloseBlock>()); AddSequence(std::make_unique<SequenceItemDef>()); - AddSequence(std::make_unique<GenericStringPropertySequence>("name", [](const MenuFileParserState* state, const TokenPos&, const std::string& value) - { - state->m_current_menu->m_name = value; - })); - AddSequence(std::make_unique<GenericBoolPropertySequence>("fullScreen", [](const MenuFileParserState* state, const TokenPos&, const bool value) - { - state->m_current_menu->m_full_screen = value; - })); - AddSequence(std::make_unique<GenericKeywordPropertySequence>("screenSpace", [](const MenuFileParserState* state, const TokenPos&) - { - state->m_current_menu->m_screen_space = true; - })); - AddSequence(std::make_unique<GenericKeywordPropertySequence>("decoration", [](const MenuFileParserState* state, const TokenPos&) - { - state->m_current_menu->m_decoration = true; - })); + AddSequence(std::make_unique<GenericStringPropertySequence>("name", + [](const MenuFileParserState* state, const TokenPos&, const std::string& value) + { + state->m_current_menu->m_name = value; + })); + AddSequence(std::make_unique<GenericBoolPropertySequence>("fullScreen", + [](const MenuFileParserState* state, const TokenPos&, const bool value) + { + state->m_current_menu->m_full_screen = value; + })); + AddSequence(std::make_unique<GenericKeywordPropertySequence>("screenSpace", + [](const MenuFileParserState* state, const TokenPos&) + { + state->m_current_menu->m_screen_space = true; + })); + AddSequence(std::make_unique<GenericKeywordPropertySequence>("decoration", + [](const MenuFileParserState* state, const TokenPos&) + { + state->m_current_menu->m_decoration = true; + })); AddSequence(std::make_unique<SequenceRect>()); // rect480 // rect720 // pos480 // pos720 - AddSequence(std::make_unique<GenericIntPropertySequence>("style", [](const MenuFileParserState* state, const TokenPos&, const int value) - { - state->m_current_menu->m_style = value; - })); - AddSequence(GenericExpressionPropertySequence::WithKeywordAndBool("visible", [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_menu->m_visible_expression = std::move(value); - })); - AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>("onOpen", [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& { - return state->m_current_menu->m_on_open; - })); - AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>("onClose", [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& { - return state->m_current_menu->m_on_close; - })); - AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>("onRequestClose", [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& { - return state->m_current_menu->m_on_request_close; - })); - AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>("onESC", [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& { - return state->m_current_menu->m_on_esc; - })); - AddSequence(std::make_unique<GenericIntPropertySequence>("border", [](const MenuFileParserState* state, const TokenPos&, const int value) - { - state->m_current_menu->m_border = value; - })); - AddSequence(std::make_unique<GenericFloatingPointPropertySequence>("borderSize", [](const MenuFileParserState* state, const TokenPos&, const double value) - { - state->m_current_menu->m_border_size = value; - })); - AddSequence(std::make_unique<GenericColorPropertySequence>("backcolor", [](const MenuFileParserState* state, const TokenPos&, const CommonColor value) - { - state->m_current_menu->m_back_color = value; - })); - AddSequence(std::make_unique<GenericColorPropertySequence>("forecolor", [](const MenuFileParserState* state, const TokenPos&, const CommonColor value) - { - state->m_current_menu->m_fore_color = value; - })); - AddSequence(std::make_unique<GenericColorPropertySequence>("bordercolor", [](const MenuFileParserState* state, const TokenPos&, const CommonColor value) - { - state->m_current_menu->m_border_color = value; - })); - AddSequence(std::make_unique<GenericColorPropertySequence>("focuscolor", [](const MenuFileParserState* state, const TokenPos&, const CommonColor value) - { - state->m_current_menu->m_focus_color = value; - })); - AddSequence(std::make_unique<GenericColorPropertySequence>("outlinecolor", [](const MenuFileParserState* state, const TokenPos&, const CommonColor value) - { - state->m_current_menu->m_outline_color = value; - })); - AddSequence(std::make_unique<GenericStringPropertySequence>("background", [](const MenuFileParserState* state, const TokenPos&, const std::string& value) - { - state->m_current_menu->m_background = value; - })); - AddSequence(std::make_unique<GenericIntPropertySequence>("ownerdraw", [](const MenuFileParserState* state, const TokenPos&, const int value) - { - state->m_current_menu->m_owner_draw = value; - })); - AddSequence(std::make_unique<GenericIntPropertySequence>("ownerdrawFlag", [](const MenuFileParserState* state, const TokenPos&, const int value) - { - state->m_current_menu->m_owner_draw_flags |= value; - })); - AddSequence(std::make_unique<GenericKeywordPropertySequence>("outOfBoundsClick", [](const MenuFileParserState* state, const TokenPos&) - { - state->m_current_menu->m_out_of_bounds_click = true; - })); - AddSequence(std::make_unique<GenericStringPropertySequence>("soundLoop", [](const MenuFileParserState* state, const TokenPos&, const std::string& value) - { - state->m_current_menu->m_sound_loop = value; - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "rect", "X"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_menu->m_rect_x_exp = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "rect", "Y"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_menu->m_rect_y_exp = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "rect", "W"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_menu->m_rect_w_exp = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "rect", "H"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); - state->m_current_menu->m_rect_h_exp = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "openSound"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsStringExpression(state, pos, *value); - state->m_current_menu->m_open_sound_exp = std::move(value); - })); - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "closeSound"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsStringExpression(state, pos, *value); - state->m_current_menu->m_close_sound_exp = std::move(value); - })); - AddSequence(std::make_unique<GenericKeywordPropertySequence>("popup", [](const MenuFileParserState* state, const TokenPos&) - { - state->m_current_menu->m_popup = true; - })); - AddSequence(std::make_unique<GenericFloatingPointPropertySequence>("fadeClamp", [](const MenuFileParserState* state, const TokenPos&, const double value) - { - state->m_current_menu->m_fade_clamp = value; - })); - AddSequence(std::make_unique<GenericIntPropertySequence>("fadeCycle", [](const MenuFileParserState* state, const TokenPos&, const int value) - { - state->m_current_menu->m_fade_cycle = value; - })); - AddSequence(std::make_unique<GenericFloatingPointPropertySequence>("fadeAmount", [](const MenuFileParserState* state, const TokenPos&, const double value) - { - state->m_current_menu->m_fade_amount = value; - })); - AddSequence(std::make_unique<GenericFloatingPointPropertySequence>("fadeInAmount", [](const MenuFileParserState* state, const TokenPos&, const double value) - { - state->m_current_menu->m_fade_in_amount = value; - })); + AddSequence(std::make_unique<GenericIntPropertySequence>("style", + [](const MenuFileParserState* state, const TokenPos&, const int value) + { + state->m_current_menu->m_style = value; + })); + AddSequence(GenericExpressionPropertySequence::WithKeywordAndBool( + "visible", + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_menu->m_visible_expression = std::move(value); + })); + AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>( + "onOpen", + [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& + { + return state->m_current_menu->m_on_open; + })); + AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>( + "onClose", + [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& + { + return state->m_current_menu->m_on_close; + })); + AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>( + "onRequestClose", + [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& + { + return state->m_current_menu->m_on_request_close; + })); + AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>( + "onESC", + [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& + { + return state->m_current_menu->m_on_esc; + })); + AddSequence(std::make_unique<GenericIntPropertySequence>("border", + [](const MenuFileParserState* state, const TokenPos&, const int value) + { + state->m_current_menu->m_border = value; + })); + AddSequence(std::make_unique<GenericFloatingPointPropertySequence>("borderSize", + [](const MenuFileParserState* state, const TokenPos&, const double value) + { + state->m_current_menu->m_border_size = value; + })); + AddSequence(std::make_unique<GenericColorPropertySequence>("backcolor", + [](const MenuFileParserState* state, const TokenPos&, const CommonColor value) + { + state->m_current_menu->m_back_color = value; + })); + AddSequence(std::make_unique<GenericColorPropertySequence>("forecolor", + [](const MenuFileParserState* state, const TokenPos&, const CommonColor value) + { + state->m_current_menu->m_fore_color = value; + })); + AddSequence(std::make_unique<GenericColorPropertySequence>("bordercolor", + [](const MenuFileParserState* state, const TokenPos&, const CommonColor value) + { + state->m_current_menu->m_border_color = value; + })); + AddSequence(std::make_unique<GenericColorPropertySequence>("focuscolor", + [](const MenuFileParserState* state, const TokenPos&, const CommonColor value) + { + state->m_current_menu->m_focus_color = value; + })); + AddSequence(std::make_unique<GenericColorPropertySequence>("outlinecolor", + [](const MenuFileParserState* state, const TokenPos&, const CommonColor value) + { + state->m_current_menu->m_outline_color = value; + })); + AddSequence(std::make_unique<GenericStringPropertySequence>("background", + [](const MenuFileParserState* state, const TokenPos&, const std::string& value) + { + state->m_current_menu->m_background = value; + })); + AddSequence(std::make_unique<GenericIntPropertySequence>("ownerdraw", + [](const MenuFileParserState* state, const TokenPos&, const int value) + { + state->m_current_menu->m_owner_draw = value; + })); + AddSequence(std::make_unique<GenericIntPropertySequence>("ownerdrawFlag", + [](const MenuFileParserState* state, const TokenPos&, const int value) + { + state->m_current_menu->m_owner_draw_flags |= value; + })); + AddSequence(std::make_unique<GenericKeywordPropertySequence>("outOfBoundsClick", + [](const MenuFileParserState* state, const TokenPos&) + { + state->m_current_menu->m_out_of_bounds_click = true; + })); + AddSequence(std::make_unique<GenericStringPropertySequence>("soundLoop", + [](const MenuFileParserState* state, const TokenPos&, const std::string& value) + { + state->m_current_menu->m_sound_loop = value; + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "rect", "X"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_menu->m_rect_x_exp = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "rect", "Y"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_menu->m_rect_y_exp = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "rect", "W"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_menu->m_rect_w_exp = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "rect", "H"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsNumericExpression(state, pos, *value); + state->m_current_menu->m_rect_h_exp = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "openSound"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsStringExpression(state, pos, *value); + state->m_current_menu->m_open_sound_exp = std::move(value); + })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "closeSound"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsStringExpression(state, pos, *value); + state->m_current_menu->m_close_sound_exp = std::move(value); + })); + AddSequence(std::make_unique<GenericKeywordPropertySequence>("popup", + [](const MenuFileParserState* state, const TokenPos&) + { + state->m_current_menu->m_popup = true; + })); + AddSequence(std::make_unique<GenericFloatingPointPropertySequence>("fadeClamp", + [](const MenuFileParserState* state, const TokenPos&, const double value) + { + state->m_current_menu->m_fade_clamp = value; + })); + AddSequence(std::make_unique<GenericIntPropertySequence>("fadeCycle", + [](const MenuFileParserState* state, const TokenPos&, const int value) + { + state->m_current_menu->m_fade_cycle = value; + })); + AddSequence(std::make_unique<GenericFloatingPointPropertySequence>("fadeAmount", + [](const MenuFileParserState* state, const TokenPos&, const double value) + { + state->m_current_menu->m_fade_amount = value; + })); + AddSequence(std::make_unique<GenericFloatingPointPropertySequence>("fadeInAmount", + [](const MenuFileParserState* state, const TokenPos&, const double value) + { + state->m_current_menu->m_fade_in_amount = value; + })); AddSequence(std::make_unique<SequenceExecKey>()); AddSequence(std::make_unique<SequenceExecKeyInt>()); - AddSequence(std::make_unique<GenericFloatingPointPropertySequence>("blurWorld", [](const MenuFileParserState* state, const TokenPos&, const double value) - { - state->m_current_menu->m_blur_radius = value; - })); - AddSequence(std::make_unique<GenericKeywordPropertySequence>("legacySplitScreenScale", [](const MenuFileParserState* state, const TokenPos&) - { - state->m_current_menu->m_legacy_split_screen_scale = true; - })); - AddSequence(std::make_unique<GenericKeywordPropertySequence>("hiddenDuringScope", [](const MenuFileParserState* state, const TokenPos&) - { - state->m_current_menu->m_hidden_during_scope = true; - })); - AddSequence(std::make_unique<GenericKeywordPropertySequence>("hiddenDuringFlashbang", [](const MenuFileParserState* state, const TokenPos&) - { - state->m_current_menu->m_hidden_during_flashbang = true; - })); - AddSequence(std::make_unique<GenericKeywordPropertySequence>("hiddenDuringUI", [](const MenuFileParserState* state, const TokenPos&) - { - state->m_current_menu->m_hidden_during_ui = true; - })); - AddSequence(std::make_unique<GenericStringPropertySequence>("allowedBinding", [](const MenuFileParserState* state, const TokenPos&, const std::string& value) - { - state->m_current_menu->m_allowed_binding = value; - })); - AddSequence(std::make_unique<GenericKeywordPropertySequence>("textOnlyFocus", [](const MenuFileParserState* state, const TokenPos&) - { - state->m_current_menu->m_text_only_focus = true; - })); - + AddSequence(std::make_unique<GenericFloatingPointPropertySequence>("blurWorld", + [](const MenuFileParserState* state, const TokenPos&, const double value) + { + state->m_current_menu->m_blur_radius = value; + })); + AddSequence(std::make_unique<GenericKeywordPropertySequence>("legacySplitScreenScale", + [](const MenuFileParserState* state, const TokenPos&) + { + state->m_current_menu->m_legacy_split_screen_scale = true; + })); + AddSequence(std::make_unique<GenericKeywordPropertySequence>("hiddenDuringScope", + [](const MenuFileParserState* state, const TokenPos&) + { + state->m_current_menu->m_hidden_during_scope = true; + })); + AddSequence(std::make_unique<GenericKeywordPropertySequence>("hiddenDuringFlashbang", + [](const MenuFileParserState* state, const TokenPos&) + { + state->m_current_menu->m_hidden_during_flashbang = true; + })); + AddSequence(std::make_unique<GenericKeywordPropertySequence>("hiddenDuringUI", + [](const MenuFileParserState* state, const TokenPos&) + { + state->m_current_menu->m_hidden_during_ui = true; + })); + AddSequence(std::make_unique<GenericStringPropertySequence>("allowedBinding", + [](const MenuFileParserState* state, const TokenPos&, const std::string& value) + { + state->m_current_menu->m_allowed_binding = value; + })); + AddSequence(std::make_unique<GenericKeywordPropertySequence>("textOnlyFocus", + [](const MenuFileParserState* state, const TokenPos&) + { + state->m_current_menu->m_text_only_focus = true; + })); if (featureLevel == FeatureLevel::IW5) { - AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "soundLoop"}, [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) - { - MenuFileCommonOperations::EnsureIsStringExpression(state, pos, *value); - state->m_current_menu->m_sound_loop_exp = std::move(value); - })); - AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>("onFocusDueToClose", [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& { - return state->m_current_menu->m_on_focus_due_to_close; - })); + AddSequence( + GenericExpressionPropertySequence::WithKeywords({"exp", "soundLoop"}, + [](const MenuFileParserState* state, const TokenPos& pos, std::unique_ptr<ISimpleExpression> value) + { + MenuFileCommonOperations::EnsureIsStringExpression(state, pos, *value); + state->m_current_menu->m_sound_loop_exp = std::move(value); + })); + AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>( + "onFocusDueToClose", + [](const MenuFileParserState* state, const TokenPos&) -> std::unique_ptr<CommonEventHandlerSet>& + { + return state->m_current_menu->m_on_focus_due_to_close; + })); } - AddSequence(std::make_unique<SequenceConsumeSemicolons>()); } diff --git a/src/ObjLoading/Parsing/Menu/Sequence/MenuScopeSequences.h b/src/ObjLoading/Parsing/Menu/Sequence/MenuScopeSequences.h index fcf7596ab..06982402a 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/MenuScopeSequences.h +++ b/src/ObjLoading/Parsing/Menu/Sequence/MenuScopeSequences.h @@ -12,4 +12,4 @@ namespace menu void AddSequences(FeatureLevel featureLevel, bool permissive) const; }; -} +} // namespace menu diff --git a/src/ObjLoading/Parsing/Menu/Sequence/NoScopeSequences.cpp b/src/ObjLoading/Parsing/Menu/Sequence/NoScopeSequences.cpp index 7c6135be0..34f4de888 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/NoScopeSequences.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/NoScopeSequences.cpp @@ -14,9 +14,7 @@ namespace menu::no_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({ - create.Char('{') - }); + AddMatchers({create.Char('{')}); } protected: @@ -25,11 +23,12 @@ namespace menu::no_scope_sequences state->m_in_global_scope = true; } }; -} +} // namespace menu::no_scope_sequences using namespace no_scope_sequences; -NoScopeSequences::NoScopeSequences(std::vector<std::unique_ptr<MenuFileParser::sequence_t>>& allSequences, std::vector<MenuFileParser::sequence_t*>& scopeSequences) +NoScopeSequences::NoScopeSequences(std::vector<std::unique_ptr<MenuFileParser::sequence_t>>& allSequences, + std::vector<MenuFileParser::sequence_t*>& scopeSequences) : AbstractScopeSequenceHolder(allSequences, scopeSequences) { } diff --git a/src/ObjLoading/Parsing/Menu/Sequence/NoScopeSequences.h b/src/ObjLoading/Parsing/Menu/Sequence/NoScopeSequences.h index b14a4ca78..40ca09ab0 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/NoScopeSequences.h +++ b/src/ObjLoading/Parsing/Menu/Sequence/NoScopeSequences.h @@ -12,4 +12,4 @@ namespace menu void AddSequences(FeatureLevel featureLevel, bool permissive) const; }; -} +} // namespace menu diff --git a/src/ObjLoading/SearchPath/ISearchPath.h b/src/ObjLoading/SearchPath/ISearchPath.h index bc07cfc6c..737f9eee1 100644 --- a/src/ObjLoading/SearchPath/ISearchPath.h +++ b/src/ObjLoading/SearchPath/ISearchPath.h @@ -1,12 +1,12 @@ #pragma once +#include "SearchPathSearchOptions.h" +#include "Utils/ClassUtils.h" + +#include <cstdint> #include <functional> #include <istream> #include <memory> -#include <cstdint> - -#include "Utils/ClassUtils.h" -#include "SearchPathSearchOptions.h" class SearchPathOpenFile { diff --git a/src/ObjLoading/SearchPath/SearchPathFilesystem.cpp b/src/ObjLoading/SearchPath/SearchPathFilesystem.cpp index 3f5873377..6d6804a69 100644 --- a/src/ObjLoading/SearchPath/SearchPathFilesystem.cpp +++ b/src/ObjLoading/SearchPath/SearchPathFilesystem.cpp @@ -1,10 +1,10 @@ #include "SearchPathFilesystem.h" +#include "Utils/ObjFileStream.h" + #include <filesystem> #include <fstream> -#include "Utils/ObjFileStream.h" - namespace fs = std::filesystem; SearchPathFilesystem::SearchPathFilesystem(std::string path) diff --git a/src/ObjLoading/SearchPath/SearchPathFilesystem.h b/src/ObjLoading/SearchPath/SearchPathFilesystem.h index d9997c856..c6c200aa1 100644 --- a/src/ObjLoading/SearchPath/SearchPathFilesystem.h +++ b/src/ObjLoading/SearchPath/SearchPathFilesystem.h @@ -1,9 +1,9 @@ #pragma once -#include <string> - #include "ISearchPath.h" +#include <string> + class SearchPathFilesystem final : public ISearchPath { std::string m_path; @@ -14,4 +14,4 @@ class SearchPathFilesystem final : public ISearchPath SearchPathOpenFile Open(const std::string& fileName) override; std::string GetPath() override; void Find(const SearchPathSearchOptions& options, const std::function<void(const std::string&)>& callback) override; -}; \ No newline at end of file +}; diff --git a/src/ObjLoading/SearchPath/SearchPathSearchOptions.cpp b/src/ObjLoading/SearchPath/SearchPathSearchOptions.cpp index bf943b41b..679929c7a 100644 --- a/src/ObjLoading/SearchPath/SearchPathSearchOptions.cpp +++ b/src/ObjLoading/SearchPath/SearchPathSearchOptions.cpp @@ -34,7 +34,7 @@ SearchPathSearchOptions& SearchPathSearchOptions::FilterExtensions(std::string e m_extension = std::move(extension); m_filter_extensions = true; - if(m_extension[0] != '.') + if (m_extension[0] != '.') m_extension = "." + m_extension; return *this; diff --git a/src/ObjLoading/SearchPath/SearchPathSearchOptions.h b/src/ObjLoading/SearchPath/SearchPathSearchOptions.h index d34cd9f7a..eb9cfdc4d 100644 --- a/src/ObjLoading/SearchPath/SearchPathSearchOptions.h +++ b/src/ObjLoading/SearchPath/SearchPathSearchOptions.h @@ -18,4 +18,4 @@ class SearchPathSearchOptions SearchPathSearchOptions& OnlyDiskFiles(bool value); SearchPathSearchOptions& AbsolutePaths(bool value); SearchPathSearchOptions& FilterExtensions(std::string extension); -}; \ No newline at end of file +}; diff --git a/src/ObjLoading/SearchPath/SearchPaths.cpp b/src/ObjLoading/SearchPath/SearchPaths.cpp index 2065dea57..221bfaca4 100644 --- a/src/ObjLoading/SearchPath/SearchPaths.cpp +++ b/src/ObjLoading/SearchPath/SearchPaths.cpp @@ -4,11 +4,11 @@ SearchPathOpenFile SearchPaths::Open(const std::string& fileName) { - for(auto* searchPathEntry : m_search_paths) + for (auto* searchPathEntry : m_search_paths) { auto file = searchPathEntry->Open(fileName); - if(file.IsOpen()) + if (file.IsOpen()) { return file; } @@ -43,9 +43,9 @@ void SearchPaths::IncludeSearchPath(ISearchPath* searchPath) void SearchPaths::RemoveSearchPath(ISearchPath* searchPath) { - for(auto i = m_search_paths.begin(); i != m_search_paths.end(); ++i) + for (auto i = m_search_paths.begin(); i != m_search_paths.end(); ++i) { - if(*i == searchPath) + if (*i == searchPath) { m_search_paths.erase(i); return; @@ -61,4 +61,4 @@ SearchPaths::iterator SearchPaths::begin() SearchPaths::iterator SearchPaths::end() { return m_search_paths.end(); -} \ No newline at end of file +} diff --git a/src/ObjLoading/SearchPath/SearchPaths.h b/src/ObjLoading/SearchPath/SearchPaths.h index a503a526a..d327f5b2f 100644 --- a/src/ObjLoading/SearchPath/SearchPaths.h +++ b/src/ObjLoading/SearchPath/SearchPaths.h @@ -1,9 +1,9 @@ #pragma once -#include <vector> - #include "ISearchPath.h" +#include <vector> + class SearchPaths final : public ISearchPath { std::vector<ISearchPath*> m_search_paths; @@ -37,8 +37,8 @@ class SearchPaths final : public ISearchPath void IncludeSearchPath(ISearchPath* searchPath); /** - * \brief Removes a search path from the \c SearchPaths object. If the search path was committed then it will \b NOT be deleted when destructing the \c SearchPaths object. - * \param searchPath The search path to remove. + * \brief Removes a search path from the \c SearchPaths object. If the search path was committed then it will \b NOT be deleted when destructing the \c + * SearchPaths object. \param searchPath The search path to remove. */ void RemoveSearchPath(ISearchPath* searchPath); diff --git a/src/ObjLoading/StateMap/Parsing/Matcher/StateMapExpressionMatchers.h b/src/ObjLoading/StateMap/Parsing/Matcher/StateMapExpressionMatchers.h index 5be3ea1e6..1480bd917 100644 --- a/src/ObjLoading/StateMap/Parsing/Matcher/StateMapExpressionMatchers.h +++ b/src/ObjLoading/StateMap/Parsing/Matcher/StateMapExpressionMatchers.h @@ -1,10 +1,10 @@ #pragma once -#include <memory> - #include "Parsing/Simple/Expression/SimpleExpressionMatchers.h" #include "StateMap/Parsing/StateMapParserState.h" +#include <memory> + namespace state_map { class StateMapExpressionMatchers final : public SimpleExpressionMatchers @@ -20,4 +20,4 @@ namespace state_map private: StateMapParserState* m_state; }; -} +} // namespace state_map diff --git a/src/ObjLoading/StateMap/Parsing/StateMapParser.cpp b/src/ObjLoading/StateMap/Parsing/StateMapParser.cpp index 406bfa972..f0e7edcc8 100644 --- a/src/ObjLoading/StateMap/Parsing/StateMapParser.cpp +++ b/src/ObjLoading/StateMap/Parsing/StateMapParser.cpp @@ -16,10 +16,7 @@ namespace state_map { const SimpleMatcherFactory create(this); - AddMatchers({ - create.Identifier().Capture(CAPTURE_ENTRY_NAME), - create.Char('{') - }); + AddMatchers({create.Identifier().Capture(CAPTURE_ENTRY_NAME), create.Char('{')}); } protected: @@ -45,9 +42,7 @@ namespace state_map { const SimpleMatcherFactory create(this); - AddMatchers({ - create.Char('}').Capture(CAPTURE_FIRST_TOKEN) - }); + AddMatchers({create.Char('}').Capture(CAPTURE_FIRST_TOKEN)}); } protected: @@ -72,13 +67,9 @@ namespace state_map AddLabeledMatchers(StateMapExpressionMatchers().Expression(this), StateMapExpressionMatchers::LABEL_EXPRESSION); const SimpleMatcherFactory create(this); - AddMatchers({ - create.Or({ - create.Keyword("default").Tag(TAG_DEFAULT), - create.Label(StateMapExpressionMatchers::LABEL_EXPRESSION).Tag(TAG_EXPRESSION) - }), - create.Char(':') - }); + AddMatchers( + {create.Or({create.Keyword("default").Tag(TAG_DEFAULT), create.Label(StateMapExpressionMatchers::LABEL_EXPRESSION).Tag(TAG_EXPRESSION)}), + create.Char(':')}); } protected: @@ -126,26 +117,14 @@ namespace state_map { const SimpleMatcherFactory create(this); - AddLabeledMatchers(create.Or({ - create.Identifier(), - create.Integer() - }), LABEL_VALUE); - - AddLabeledMatchers({ - create.Label(LABEL_VALUE).Capture(CAPTURE_VALUE), - create.OptionalLoop(create.And({ - create.Char(','), - create.Label(LABEL_VALUE).Capture(CAPTURE_VALUE) - })) - }, LABEL_VALUE_LIST); - - AddMatchers({ - create.Or({ - create.Keyword("passthrough").Tag(TAG_PASSTHROUGH), - create.Label(LABEL_VALUE_LIST).Tag(TAG_VALUE_LIST) - }), - create.Char(';').Capture(CAPTURE_VALUE_END) - }); + AddLabeledMatchers(create.Or({create.Identifier(), create.Integer()}), LABEL_VALUE); + + AddLabeledMatchers({create.Label(LABEL_VALUE).Capture(CAPTURE_VALUE), + create.OptionalLoop(create.And({create.Char(','), create.Label(LABEL_VALUE).Capture(CAPTURE_VALUE)}))}, + LABEL_VALUE_LIST); + + AddMatchers({create.Or({create.Keyword("passthrough").Tag(TAG_PASSTHROUGH), create.Label(LABEL_VALUE_LIST).Tag(TAG_VALUE_LIST)}), + create.Char(';').Capture(CAPTURE_VALUE_END)}); } protected: @@ -173,12 +152,15 @@ namespace state_map if (varForResult != state->m_valid_vars.end()) { const auto& var = state->m_layout.m_var_layout.m_vars[varForResult->second]; - const auto tokenValue = valueToken.m_type == SimpleParserValueType::IDENTIFIER ? valueToken.IdentifierValue() : std::to_string(valueToken.IntegerValue()); + const auto tokenValue = + valueToken.m_type == SimpleParserValueType::IDENTIFIER ? valueToken.IdentifierValue() : std::to_string(valueToken.IntegerValue()); - const auto referencedValue = std::find_if(var.m_values.begin(), var.m_values.end(), [&tokenValue](const StateMapLayoutVarValue& value) - { - return value.m_name == tokenValue; - }); + const auto referencedValue = std::find_if(var.m_values.begin(), + var.m_values.end(), + [&tokenValue](const StateMapLayoutVarValue& value) + { + return value.m_name == tokenValue; + }); if (referencedValue == var.m_values.end()) throw ParsingException(valueToken.GetPos(), "Not part of the valid values for this var"); @@ -204,7 +186,7 @@ namespace state_map state->m_current_rule = nullptr; } }; -} +} // namespace state_map StateMapParser::StateMapParser(SimpleLexer* lexer, std::string stateMapName, const StateMapLayout& layout) : AbstractParser(lexer, std::make_unique<StateMapParserState>(std::move(stateMapName), layout)) @@ -213,25 +195,15 @@ StateMapParser::StateMapParser(SimpleLexer* lexer, std::string stateMapName, con const std::vector<StateMapParser::sequence_t*>& StateMapParser::GetTestsForState() { - static std::vector<sequence_t*> rootSequences({ - new SequenceStateMapEntry() - }); + static std::vector<sequence_t*> rootSequences({new SequenceStateMapEntry()}); - static std::vector<sequence_t*> entrySequences({ - new SequenceStateMapEntryClose(), - new SequenceCondition() - }); + static std::vector<sequence_t*> entrySequences({new SequenceStateMapEntryClose(), new SequenceCondition()}); - static std::vector<sequence_t*> ruleSequences({ - new SequenceCondition(), - new SequenceValue() - }); + static std::vector<sequence_t*> ruleSequences({new SequenceCondition(), new SequenceValue()}); if (m_state->m_in_entry) { - return m_state->m_current_rule - ? ruleSequences - : entrySequences; + return m_state->m_current_rule ? ruleSequences : entrySequences; } return rootSequences; diff --git a/src/ObjLoading/StateMap/Parsing/StateMapParser.h b/src/ObjLoading/StateMap/Parsing/StateMapParser.h index 9dc490430..dad1bccab 100644 --- a/src/ObjLoading/StateMap/Parsing/StateMapParser.h +++ b/src/ObjLoading/StateMap/Parsing/StateMapParser.h @@ -1,11 +1,11 @@ #pragma once -#include "StateMapParserState.h" -#include "Utils/ClassUtils.h" -#include "Techset/TechsetDefinition.h" +#include "Parsing/Impl/AbstractParser.h" #include "Parsing/Simple/SimpleLexer.h" #include "Parsing/Simple/SimpleParserValue.h" -#include "Parsing/Impl/AbstractParser.h" +#include "StateMapParserState.h" +#include "Techset/TechsetDefinition.h" +#include "Utils/ClassUtils.h" namespace state_map { @@ -19,4 +19,4 @@ namespace state_map _NODISCARD std::unique_ptr<StateMapDefinition> GetStateMapDefinition() const; _NODISCARD StateMapParserState* GetState() const; }; -} +} // namespace state_map diff --git a/src/ObjLoading/StateMap/Parsing/StateMapParserState.h b/src/ObjLoading/StateMap/Parsing/StateMapParserState.h index 6a056fb55..260d4e66b 100644 --- a/src/ObjLoading/StateMap/Parsing/StateMapParserState.h +++ b/src/ObjLoading/StateMap/Parsing/StateMapParserState.h @@ -1,12 +1,12 @@ #pragma once -#include <unordered_map> +#include "StateMap/StateMapDefinition.h" +#include "StateMap/StateMapLayout.h" + #include <memory> #include <set> #include <string> - -#include "StateMap/StateMapDefinition.h" -#include "StateMap/StateMapLayout.h" +#include <unordered_map> namespace state_map { @@ -26,4 +26,4 @@ namespace state_map StateMapParserState(std::string stateMapName, const StateMapLayout& layout); }; -} +} // namespace state_map diff --git a/src/ObjLoading/StateMap/StateMapDefinition.h b/src/ObjLoading/StateMap/StateMapDefinition.h index 4b691cbdd..d7c96311e 100644 --- a/src/ObjLoading/StateMap/StateMapDefinition.h +++ b/src/ObjLoading/StateMap/StateMapDefinition.h @@ -1,11 +1,11 @@ #pragma once +#include "Parsing/Simple/Expression/ISimpleExpression.h" + #include <memory> #include <string> #include <vector> -#include "Parsing/Simple/Expression/ISimpleExpression.h" - namespace state_map { class StateMapRule @@ -35,4 +35,4 @@ namespace state_map std::string m_name; std::vector<StateMapEntry> m_state_map_entries; }; -} +} // namespace state_map diff --git a/src/ObjLoading/StateMap/StateMapFromTechniqueExtractor.cpp b/src/ObjLoading/StateMap/StateMapFromTechniqueExtractor.cpp index 182e50144..473d08c2f 100644 --- a/src/ObjLoading/StateMap/StateMapFromTechniqueExtractor.cpp +++ b/src/ObjLoading/StateMap/StateMapFromTechniqueExtractor.cpp @@ -7,9 +7,7 @@ std::string StateMapFromTechniqueExtractor::RetrieveStateMap() return std::move(m_state_map); } -void StateMapFromTechniqueExtractor::AcceptNextPass() -{ -} +void StateMapFromTechniqueExtractor::AcceptNextPass() {} bool StateMapFromTechniqueExtractor::AcceptEndPass(std::string& errorMessage) { @@ -32,22 +30,34 @@ bool StateMapFromTechniqueExtractor::AcceptPixelShader(const std::string& pixelS return true; } -bool StateMapFromTechniqueExtractor::AcceptShaderConstantArgument(techset::ShaderSelector shader, techset::ShaderArgument shaderArgument, techset::ShaderArgumentCodeSource source, std::string& errorMessage) +bool StateMapFromTechniqueExtractor::AcceptShaderConstantArgument(techset::ShaderSelector shader, + techset::ShaderArgument shaderArgument, + techset::ShaderArgumentCodeSource source, + std::string& errorMessage) { return true; } -bool StateMapFromTechniqueExtractor::AcceptShaderSamplerArgument(techset::ShaderSelector shader, techset::ShaderArgument shaderArgument, techset::ShaderArgumentCodeSource source, std::string& errorMessage) +bool StateMapFromTechniqueExtractor::AcceptShaderSamplerArgument(techset::ShaderSelector shader, + techset::ShaderArgument shaderArgument, + techset::ShaderArgumentCodeSource source, + std::string& errorMessage) { return true; } -bool StateMapFromTechniqueExtractor::AcceptShaderLiteralArgument(techset::ShaderSelector shader, techset::ShaderArgument shaderArgument, techset::ShaderArgumentLiteralSource source, std::string& errorMessage) +bool StateMapFromTechniqueExtractor::AcceptShaderLiteralArgument(techset::ShaderSelector shader, + techset::ShaderArgument shaderArgument, + techset::ShaderArgumentLiteralSource source, + std::string& errorMessage) { return true; } -bool StateMapFromTechniqueExtractor::AcceptShaderMaterialArgument(techset::ShaderSelector shader, techset::ShaderArgument shaderArgument, techset::ShaderArgumentMaterialSource source, std::string& errorMessage) +bool StateMapFromTechniqueExtractor::AcceptShaderMaterialArgument(techset::ShaderSelector shader, + techset::ShaderArgument shaderArgument, + techset::ShaderArgumentMaterialSource source, + std::string& errorMessage) { return true; } diff --git a/src/ObjLoading/StateMap/StateMapFromTechniqueExtractor.h b/src/ObjLoading/StateMap/StateMapFromTechniqueExtractor.h index 217d7ea65..48f70d9d5 100644 --- a/src/ObjLoading/StateMap/StateMapFromTechniqueExtractor.h +++ b/src/ObjLoading/StateMap/StateMapFromTechniqueExtractor.h @@ -1,9 +1,9 @@ #pragma once -#include <string> - #include "Techset/TechniqueDefinitionAcceptor.h" +#include <string> + namespace state_map { class StateMapFromTechniqueExtractor final : public techset::ITechniqueDefinitionAcceptor @@ -16,13 +16,25 @@ namespace state_map bool AcceptStateMap(const std::string& stateMapName, std::string& errorMessage) override; bool AcceptVertexShader(const std::string& vertexShaderName, std::string& errorMessage) override; bool AcceptPixelShader(const std::string& pixelShaderName, std::string& errorMessage) override; - bool AcceptShaderConstantArgument(techset::ShaderSelector shader, techset::ShaderArgument shaderArgument, techset::ShaderArgumentCodeSource source, std::string& errorMessage) override; - bool AcceptShaderSamplerArgument(techset::ShaderSelector shader, techset::ShaderArgument shaderArgument, techset::ShaderArgumentCodeSource source, std::string& errorMessage) override; - bool AcceptShaderLiteralArgument(techset::ShaderSelector shader, techset::ShaderArgument shaderArgument, techset::ShaderArgumentLiteralSource source, std::string& errorMessage) override; - bool AcceptShaderMaterialArgument(techset::ShaderSelector shader, techset::ShaderArgument shaderArgument, techset::ShaderArgumentMaterialSource source, std::string& errorMessage) override; + bool AcceptShaderConstantArgument(techset::ShaderSelector shader, + techset::ShaderArgument shaderArgument, + techset::ShaderArgumentCodeSource source, + std::string& errorMessage) override; + bool AcceptShaderSamplerArgument(techset::ShaderSelector shader, + techset::ShaderArgument shaderArgument, + techset::ShaderArgumentCodeSource source, + std::string& errorMessage) override; + bool AcceptShaderLiteralArgument(techset::ShaderSelector shader, + techset::ShaderArgument shaderArgument, + techset::ShaderArgumentLiteralSource source, + std::string& errorMessage) override; + bool AcceptShaderMaterialArgument(techset::ShaderSelector shader, + techset::ShaderArgument shaderArgument, + techset::ShaderArgumentMaterialSource source, + std::string& errorMessage) override; bool AcceptVertexStreamRouting(const std::string& destination, const std::string& source, std::string& errorMessage) override; private: std::string m_state_map; }; -} +} // namespace state_map diff --git a/src/ObjLoading/StateMap/StateMapHandler.cpp b/src/ObjLoading/StateMap/StateMapHandler.cpp index 7b56406ed..a34f1ee4c 100644 --- a/src/ObjLoading/StateMap/StateMapHandler.cpp +++ b/src/ObjLoading/StateMap/StateMapHandler.cpp @@ -1,8 +1,8 @@ #include "StateMapHandler.h" +#include <algorithm> #include <cassert> #include <iostream> -#include <algorithm> using namespace state_map; @@ -40,15 +40,19 @@ void StateMapHandler::ApplyStateMap(const uint32_t* baseStateBits, uint32_t* out for (auto entryIndex = 0u; entryIndex < m_state_map.m_state_map_entries.size(); entryIndex++) { const auto& entry = m_state_map.m_state_map_entries[entryIndex]; - const auto matchingRule = std::find_if(entry.m_rules.begin(), entry.m_rules.end(), [&vars](const std::unique_ptr<StateMapRule>& rule) - { - const auto matchingCondition = std::find_if(rule->m_conditions.begin(), rule->m_conditions.end(), [&vars](std::unique_ptr<ISimpleExpression>& condition) - { - return condition->EvaluateNonStatic(&vars).IsTruthy(); - }); - - return matchingCondition != rule->m_conditions.end(); - }); + const auto matchingRule = std::find_if(entry.m_rules.begin(), + entry.m_rules.end(), + [&vars](const std::unique_ptr<StateMapRule>& rule) + { + const auto matchingCondition = std::find_if(rule->m_conditions.begin(), + rule->m_conditions.end(), + [&vars](std::unique_ptr<ISimpleExpression>& condition) + { + return condition->EvaluateNonStatic(&vars).IsTruthy(); + }); + + return matchingCondition != rule->m_conditions.end(); + }); if (matchingRule != entry.m_rules.end()) ApplyRule(m_state_map_layout.m_entry_layout.m_entries[entryIndex], **matchingRule, outStateBits); @@ -64,10 +68,12 @@ StateMapVars StateMapHandler::BuildVars(const uint32_t* baseStateBits) const for (const auto& var : m_state_map_layout.m_var_layout.m_vars) { const auto baseStateBitField = baseStateBits[var.m_state_bits_index]; - const auto matchingValue = std::find_if(var.m_values.begin(), var.m_values.end(), [&baseStateBitField](const StateMapLayoutVarValue& value) - { - return (baseStateBitField & value.m_state_bits_mask) == value.m_state_bits_mask; - }); + const auto matchingValue = std::find_if(var.m_values.begin(), + var.m_values.end(), + [&baseStateBitField](const StateMapLayoutVarValue& value) + { + return (baseStateBitField & value.m_state_bits_mask) == value.m_state_bits_mask; + }); if (matchingValue != var.m_values.end()) result.AddValue(var.m_name, matchingValue->m_name); diff --git a/src/ObjLoading/StateMap/StateMapHandler.h b/src/ObjLoading/StateMap/StateMapHandler.h index 7fe44933d..6c4213769 100644 --- a/src/ObjLoading/StateMap/StateMapHandler.h +++ b/src/ObjLoading/StateMap/StateMapHandler.h @@ -1,11 +1,11 @@ #pragma once -#include <cstdint> -#include <unordered_map> - -#include "Utils/ClassUtils.h" #include "StateMap/StateMapDefinition.h" #include "StateMap/StateMapLayout.h" +#include "Utils/ClassUtils.h" + +#include <cstdint> +#include <unordered_map> namespace state_map { @@ -33,4 +33,4 @@ namespace state_map const StateMapLayout& m_state_map_layout; const StateMapDefinition& m_state_map; }; -} +} // namespace state_map diff --git a/src/ObjLoading/StateMap/StateMapReader.cpp b/src/ObjLoading/StateMap/StateMapReader.cpp index 5190350d2..f025cff1d 100644 --- a/src/ObjLoading/StateMap/StateMapReader.cpp +++ b/src/ObjLoading/StateMap/StateMapReader.cpp @@ -1,11 +1,11 @@ #include "StateMapReader.h" -#include <iostream> - -#include "Parsing/StateMapParser.h" #include "Parsing/Impl/CommentRemovingStreamProxy.h" #include "Parsing/Impl/ParserSingleInputStream.h" #include "Parsing/Matcher/StateMapExpressionMatchers.h" +#include "Parsing/StateMapParser.h" + +#include <iostream> using namespace state_map; diff --git a/src/ObjLoading/StateMap/StateMapReader.h b/src/ObjLoading/StateMap/StateMapReader.h index bb89aeb3e..5e52b3dab 100644 --- a/src/ObjLoading/StateMap/StateMapReader.h +++ b/src/ObjLoading/StateMap/StateMapReader.h @@ -1,13 +1,13 @@ #pragma once -#include <memory> -#include <string> - -#include "Utils/ClassUtils.h" -#include "StateMapDefinition.h" -#include "StateMap/StateMapLayout.h" #include "Parsing/IParserLineStream.h" #include "Parsing/StateMapParserState.h" +#include "StateMap/StateMapLayout.h" +#include "StateMapDefinition.h" +#include "Utils/ClassUtils.h" + +#include <memory> +#include <string> namespace state_map { @@ -25,4 +25,4 @@ namespace state_map _NODISCARD bool IsValidEndState(const StateMapParserState* state) const; _NODISCARD std::unique_ptr<StateMapDefinition> ReadStateMapDefinition() const; }; -} +} // namespace state_map diff --git a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataDefScopeSequences.cpp b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataDefScopeSequences.cpp index 56d536295..ab11f31b6 100644 --- a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataDefScopeSequences.cpp +++ b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataDefScopeSequences.cpp @@ -1,10 +1,10 @@ #include "StructuredDataDefScopeSequences.h" -#include <sstream> - #include "Parsing/Simple/Matcher/SimpleMatcherFactory.h" #include "StructuredDataDef/Parsing/StructuredDataDefSizeCalculator.h" +#include <sstream> + namespace sdd::def_scope_sequences { class SequenceEnum final : public StructuredDataDefParser::sequence_t @@ -17,16 +17,10 @@ namespace sdd::def_scope_sequences { const SimpleMatcherFactory create(this); - AddMatchers({ - create.Keyword("enum"), - create.Optional(create.And({ - create.Char('('), - create.Integer().Capture(CAPTURE_RESERVED_COUNT), - create.Char(')') - })), - create.Identifier().Capture(CAPTURE_NAME), - create.Char('{') - }); + AddMatchers({create.Keyword("enum"), + create.Optional(create.And({create.Char('('), create.Integer().Capture(CAPTURE_RESERVED_COUNT), create.Char(')')})), + create.Identifier().Capture(CAPTURE_NAME), + create.Char('{')}); } protected: @@ -76,11 +70,7 @@ namespace sdd::def_scope_sequences { const SimpleMatcherFactory create(this); - AddMatchers({ - create.Keyword("struct"), - create.Identifier().Capture(CAPTURE_NAME), - create.Char('{') - }); + AddMatchers({create.Keyword("struct"), create.Identifier().Capture(CAPTURE_NAME), create.Char('{')}); } protected: @@ -136,11 +126,7 @@ namespace sdd::def_scope_sequences { const SimpleMatcherFactory create(this); - AddMatchers({ - create.Keyword("checksumoverride"), - create.Integer().Capture(CAPTURE_VALUE), - create.Char(';') - }); + AddMatchers({create.Keyword("checksumoverride"), create.Integer().Capture(CAPTURE_VALUE), create.Char(';')}); } protected: @@ -162,9 +148,7 @@ namespace sdd::def_scope_sequences { const SimpleMatcherFactory create(this); - AddMatchers({ - create.Char('}') - }); + AddMatchers({create.Char('}')}); } private: @@ -179,7 +163,7 @@ namespace sdd::def_scope_sequences static void EnsureAllUsedTypesHaveBeenDefined(const StructuredDataDefParserState* state) { - for(const auto& undefinedType : state->m_undefined_types) + for (const auto& undefinedType : state->m_undefined_types) { if (undefinedType.m_mapped_type.m_category == CommonStructuredDataTypeCategory::UNKNOWN) { @@ -194,11 +178,11 @@ namespace sdd::def_scope_sequences { auto& def = *state->m_current_def; - for(const auto& _struct : def.m_structs) + for (const auto& _struct : def.m_structs) { - for(auto& property : _struct->m_properties) + for (auto& property : _struct->m_properties) { - if(property.m_type.m_category == CommonStructuredDataTypeCategory::UNKNOWN) + if (property.m_type.m_category == CommonStructuredDataTypeCategory::UNKNOWN) { assert(property.m_type.m_info.type_index < state->m_undefined_types.size()); const auto& undefinedType = state->m_undefined_types[property.m_type.m_info.type_index]; @@ -207,9 +191,9 @@ namespace sdd::def_scope_sequences } } - for(auto& indexedArray : def.m_indexed_arrays) + for (auto& indexedArray : def.m_indexed_arrays) { - if(indexedArray.m_array_type.m_category == CommonStructuredDataTypeCategory::UNKNOWN) + if (indexedArray.m_array_type.m_category == CommonStructuredDataTypeCategory::UNKNOWN) { assert(indexedArray.m_array_type.m_info.type_index < state->m_undefined_types.size()); const auto& undefinedType = state->m_undefined_types[indexedArray.m_array_type.m_info.type_index]; @@ -217,9 +201,9 @@ namespace sdd::def_scope_sequences } } - for(auto& enumedArray : def.m_enumed_arrays) + for (auto& enumedArray : def.m_enumed_arrays) { - if(enumedArray.m_array_type.m_category == CommonStructuredDataTypeCategory::UNKNOWN) + if (enumedArray.m_array_type.m_category == CommonStructuredDataTypeCategory::UNKNOWN) { assert(enumedArray.m_array_type.m_info.type_index < state->m_undefined_types.size()); const auto& undefinedType = state->m_undefined_types[enumedArray.m_array_type.m_info.type_index]; @@ -234,7 +218,7 @@ namespace sdd::def_scope_sequences { StructuredDataDefSizeCalculator::CalculateSizesAndOffsetsForDef(*state->m_current_def); } - catch(SizeCalculationException& e) + catch (SizeCalculationException& e) { throw ParsingException(TokenPos(), e.Message()); } @@ -275,7 +259,7 @@ namespace sdd::def_scope_sequences state->m_checksum_override_value = 0u; } }; -} +} // namespace sdd::def_scope_sequences using namespace sdd; using namespace def_scope_sequences; diff --git a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataDefScopeSequences.h b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataDefScopeSequences.h index 7ca944271..0fe08cbc5 100644 --- a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataDefScopeSequences.h +++ b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataDefScopeSequences.h @@ -8,8 +8,9 @@ namespace sdd class StructuredDataDefScopeSequences final : AbstractScopeSequenceHolder<StructuredDataDefParser> { public: - StructuredDataDefScopeSequences(std::vector<std::unique_ptr<StructuredDataDefParser::sequence_t>>& allSequences, std::vector<StructuredDataDefParser::sequence_t*>& scopeSequences); + StructuredDataDefScopeSequences(std::vector<std::unique_ptr<StructuredDataDefParser::sequence_t>>& allSequences, + std::vector<StructuredDataDefParser::sequence_t*>& scopeSequences); void AddSequences() const; }; -} +} // namespace sdd diff --git a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataEnumScopeSequences.cpp b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataEnumScopeSequences.cpp index 4e6153eb2..5f93e0085 100644 --- a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataEnumScopeSequences.cpp +++ b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataEnumScopeSequences.cpp @@ -1,9 +1,9 @@ #include "StructuredDataEnumScopeSequences.h" -#include <algorithm> - #include "Parsing/Simple/Matcher/SimpleMatcherFactory.h" +#include <algorithm> + namespace sdd::enum_scope_sequences { class SequenceEnumEntry final : public StructuredDataDefParser::sequence_t @@ -15,13 +15,7 @@ namespace sdd::enum_scope_sequences { const SimpleMatcherFactory create(this); - AddMatchers({ - create.String().Capture(CAPTURE_ENTRY_VALUE), - create.Or({ - create.Char(','), - create.Char('}').NoConsume() - }) - }); + AddMatchers({create.String().Capture(CAPTURE_ENTRY_VALUE), create.Or({create.Char(','), create.Char('}').NoConsume()})}); } protected: @@ -30,7 +24,8 @@ namespace sdd::enum_scope_sequences assert(state->m_current_enum); const auto& entryValueToken = result.NextCapture(CAPTURE_ENTRY_VALUE); - if (state->m_current_enum->m_reserved_entry_count > 0 && static_cast<size_t>(state->m_current_enum->m_reserved_entry_count) <= state->m_current_enum->m_entries.size()) + if (state->m_current_enum->m_reserved_entry_count > 0 + && static_cast<size_t>(state->m_current_enum->m_reserved_entry_count) <= state->m_current_enum->m_entries.size()) throw ParsingException(entryValueToken.GetPos(), "Enum entry count exceeds reserved count"); state->m_current_enum->m_entries.emplace_back(entryValueToken.StringValue(), state->m_current_enum->m_entries.size()); @@ -44,10 +39,7 @@ namespace sdd::enum_scope_sequences { const SimpleMatcherFactory create(this); - AddMatchers({ - create.Char('}'), - create.Optional(create.Char(';')) - }); + AddMatchers({create.Char('}'), create.Optional(create.Char(';'))}); } protected: @@ -57,13 +49,13 @@ namespace sdd::enum_scope_sequences state->m_current_enum = nullptr; } }; -} +} // namespace sdd::enum_scope_sequences using namespace sdd; using namespace enum_scope_sequences; StructuredDataEnumScopeSequences::StructuredDataEnumScopeSequences(std::vector<std::unique_ptr<StructuredDataDefParser::sequence_t>>& allSequences, - std::vector<StructuredDataDefParser::sequence_t*>& scopeSequences) + std::vector<StructuredDataDefParser::sequence_t*>& scopeSequences) : AbstractScopeSequenceHolder(allSequences, scopeSequences) { } diff --git a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataEnumScopeSequences.h b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataEnumScopeSequences.h index 3cacf8558..8a4fcf199 100644 --- a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataEnumScopeSequences.h +++ b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataEnumScopeSequences.h @@ -8,8 +8,9 @@ namespace sdd class StructuredDataEnumScopeSequences final : AbstractScopeSequenceHolder<StructuredDataDefParser> { public: - StructuredDataEnumScopeSequences(std::vector<std::unique_ptr<StructuredDataDefParser::sequence_t>>& allSequences, std::vector<StructuredDataDefParser::sequence_t*>& scopeSequences); + StructuredDataEnumScopeSequences(std::vector<std::unique_ptr<StructuredDataDefParser::sequence_t>>& allSequences, + std::vector<StructuredDataDefParser::sequence_t*>& scopeSequences); void AddSequences() const; }; -} +} // namespace sdd diff --git a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataNoScopeSequences.cpp b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataNoScopeSequences.cpp index 02eaeca09..2193bad02 100644 --- a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataNoScopeSequences.cpp +++ b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataNoScopeSequences.cpp @@ -13,11 +13,7 @@ namespace sdd::no_scope_sequences { const SimpleMatcherFactory create(this); - AddMatchers({ - create.Keyword("version"), - create.Integer().Capture(CAPTURE_VERSION), - create.Char('{') - }); + AddMatchers({create.Keyword("version"), create.Integer().Capture(CAPTURE_VERSION), create.Char('{')}); } protected: @@ -28,13 +24,13 @@ namespace sdd::no_scope_sequences state->m_defs.emplace_back(std::move(newDef)); } }; -} +} // namespace sdd::no_scope_sequences using namespace sdd; using namespace no_scope_sequences; StructuredDataNoScopeSequences::StructuredDataNoScopeSequences(std::vector<std::unique_ptr<StructuredDataDefParser::sequence_t>>& allSequences, - std::vector<StructuredDataDefParser::sequence_t*>& scopeSequences) + std::vector<StructuredDataDefParser::sequence_t*>& scopeSequences) : AbstractScopeSequenceHolder(allSequences, scopeSequences) { } diff --git a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataNoScopeSequences.h b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataNoScopeSequences.h index 52cd0a776..1b96eb4ff 100644 --- a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataNoScopeSequences.h +++ b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataNoScopeSequences.h @@ -8,8 +8,9 @@ namespace sdd class StructuredDataNoScopeSequences final : AbstractScopeSequenceHolder<StructuredDataDefParser> { public: - StructuredDataNoScopeSequences(std::vector<std::unique_ptr<StructuredDataDefParser::sequence_t>>& allSequences, std::vector<StructuredDataDefParser::sequence_t*>& scopeSequences); + StructuredDataNoScopeSequences(std::vector<std::unique_ptr<StructuredDataDefParser::sequence_t>>& allSequences, + std::vector<StructuredDataDefParser::sequence_t*>& scopeSequences); void AddSequences() const; }; -} +} // namespace sdd diff --git a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataStructScopeSequences.cpp b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataStructScopeSequences.cpp index 47f89265d..496589911 100644 --- a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataStructScopeSequences.cpp +++ b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataStructScopeSequences.cpp @@ -1,10 +1,10 @@ #include "StructuredDataStructScopeSequences.h" -#include <algorithm> - #include "Parsing/Simple/Matcher/SimpleMatcherFactory.h" #include "Utils/Alignment.h" +#include <algorithm> + namespace sdd::struct_scope_sequences { class SequenceStructEntry final : public StructuredDataDefParser::sequence_t @@ -24,32 +24,21 @@ namespace sdd::struct_scope_sequences static std::unique_ptr<matcher_t> TypeMatchers(const SimpleMatcherFactory& create) { - return create.Or({ - create.Keyword("int").Tag(TAG_TYPE_INT), - create.Keyword("byte").Tag(TAG_TYPE_BYTE), - create.Keyword("bool").Tag(TAG_TYPE_BOOL), - create.Keyword("float").Tag(TAG_TYPE_FLOAT), - create.Keyword("short").Tag(TAG_TYPE_SHORT), - create.And({ - create.Keyword("string"), - create.Char('('), - create.Integer().Capture(CAPTURE_STRING_LENGTH), - create.Char(')') - }).Tag(TAG_TYPE_STRING), - create.Identifier().Tag(TAG_TYPE_NAMED).Capture(CAPTURE_TYPE_NAME) - }); + return create.Or({create.Keyword("int").Tag(TAG_TYPE_INT), + create.Keyword("byte").Tag(TAG_TYPE_BYTE), + create.Keyword("bool").Tag(TAG_TYPE_BOOL), + create.Keyword("float").Tag(TAG_TYPE_FLOAT), + create.Keyword("short").Tag(TAG_TYPE_SHORT), + create.And({create.Keyword("string"), create.Char('('), create.Integer().Capture(CAPTURE_STRING_LENGTH), create.Char(')')}) + .Tag(TAG_TYPE_STRING), + create.Identifier().Tag(TAG_TYPE_NAMED).Capture(CAPTURE_TYPE_NAME)}); } static std::unique_ptr<matcher_t> ArrayMatchers(const SimpleMatcherFactory& create) { - return create.And({ - create.Char('['), - create.Or({ - create.Integer().Capture(CAPTURE_ARRAY_SIZE), - create.Identifier().Capture(CAPTURE_ARRAY_SIZE) - }), - create.Char(']') - }); + return create.And({create.Char('['), + create.Or({create.Integer().Capture(CAPTURE_ARRAY_SIZE), create.Identifier().Capture(CAPTURE_ARRAY_SIZE)}), + create.Char(']')}); } public: @@ -57,12 +46,7 @@ namespace sdd::struct_scope_sequences { const SimpleMatcherFactory create(this); - AddMatchers({ - TypeMatchers(create), - create.Identifier().Capture(CAPTURE_ENTRY_NAME), - create.OptionalLoop(ArrayMatchers(create)), - create.Char(';') - }); + AddMatchers({TypeMatchers(create), create.Identifier().Capture(CAPTURE_ENTRY_NAME), create.OptionalLoop(ArrayMatchers(create)), create.Char(';')}); } private: @@ -83,38 +67,39 @@ namespace sdd::struct_scope_sequences case TAG_TYPE_SHORT: return CommonStructuredDataType(CommonStructuredDataTypeCategory::SHORT); case TAG_TYPE_STRING: - { - const auto& stringLengthToken = result.NextCapture(CAPTURE_STRING_LENGTH); - const auto stringLength = stringLengthToken.IntegerValue(); + { + const auto& stringLengthToken = result.NextCapture(CAPTURE_STRING_LENGTH); + const auto stringLength = stringLengthToken.IntegerValue(); - if (stringLength <= 0) - throw ParsingException(stringLengthToken.GetPos(), "String length must be greater than zero"); + if (stringLength <= 0) + throw ParsingException(stringLengthToken.GetPos(), "String length must be greater than zero"); - return {CommonStructuredDataTypeCategory::STRING, static_cast<size_t>(stringLength)}; - } + return {CommonStructuredDataTypeCategory::STRING, static_cast<size_t>(stringLength)}; + } case TAG_TYPE_NAMED: + { + const auto& typeNameToken = result.NextCapture(CAPTURE_TYPE_NAME); + const auto typeName = typeNameToken.IdentifierValue(); + + const auto existingType = state->m_def_types_by_name.find(typeName); + if (existingType == state->m_def_types_by_name.end()) { - const auto& typeNameToken = result.NextCapture(CAPTURE_TYPE_NAME); - const auto typeName = typeNameToken.IdentifierValue(); - - const auto existingType = state->m_def_types_by_name.find(typeName); - if (existingType == state->m_def_types_by_name.end()) - { - const auto undefinedTypeIndex = state->m_undefined_types.size(); - const CommonStructuredDataType undefinedType(CommonStructuredDataTypeCategory::UNKNOWN, undefinedTypeIndex); - state->m_undefined_types.emplace_back(typeName, typeNameToken.GetPos()); - state->m_def_types_by_name.emplace(std::make_pair(typeName, undefinedType)); - return undefinedType; - } - - return existingType->second; + const auto undefinedTypeIndex = state->m_undefined_types.size(); + const CommonStructuredDataType undefinedType(CommonStructuredDataTypeCategory::UNKNOWN, undefinedTypeIndex); + state->m_undefined_types.emplace_back(typeName, typeNameToken.GetPos()); + state->m_def_types_by_name.emplace(std::make_pair(typeName, undefinedType)); + return undefinedType; } + + return existingType->second; + } default: throw ParsingException(TokenPos(), "Invalid Tag for Type @ ProcessType!!!"); } } - static CommonStructuredDataType ProcessArray(StructuredDataDefParserState* state, const SimpleParserValue& arrayToken, const CommonStructuredDataType currentType) + static CommonStructuredDataType + ProcessArray(StructuredDataDefParserState* state, const SimpleParserValue& arrayToken, const CommonStructuredDataType currentType) { if (arrayToken.m_type == SimpleParserValueType::INTEGER) { @@ -179,7 +164,8 @@ namespace sdd::struct_scope_sequences for (auto i = arrayTokens.rbegin(); i != arrayTokens.rend(); ++i) currentType = ProcessArray(state, i->get(), currentType); - state->m_current_struct->m_properties.emplace_back(result.NextCapture(CAPTURE_ENTRY_NAME).IdentifierValue(), currentType, state->m_current_struct_padding_offset); + state->m_current_struct->m_properties.emplace_back( + result.NextCapture(CAPTURE_ENTRY_NAME).IdentifierValue(), currentType, state->m_current_struct_padding_offset); } }; @@ -192,13 +178,7 @@ namespace sdd::struct_scope_sequences { const SimpleMatcherFactory create(this); - AddMatchers({ - create.Keyword("pad"), - create.Char('('), - create.Integer().Capture(CAPTURE_PADDING_VALUE), - create.Char(')'), - create.Char(';') - }); + AddMatchers({create.Keyword("pad"), create.Char('('), create.Integer().Capture(CAPTURE_PADDING_VALUE), create.Char(')'), create.Char(';')}); } protected: @@ -221,10 +201,7 @@ namespace sdd::struct_scope_sequences { const SimpleMatcherFactory create(this); - AddMatchers({ - create.Char('}'), - create.Optional(create.Char(';')) - }); + AddMatchers({create.Char('}'), create.Optional(create.Char(';'))}); } protected: @@ -242,7 +219,7 @@ namespace sdd::struct_scope_sequences state->m_current_struct = nullptr; } }; -} +} // namespace sdd::struct_scope_sequences using namespace sdd; using namespace struct_scope_sequences; diff --git a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataStructScopeSequences.h b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataStructScopeSequences.h index c67df87cc..d0c48be87 100644 --- a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataStructScopeSequences.h +++ b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataStructScopeSequences.h @@ -8,8 +8,9 @@ namespace sdd class StructuredDataStructScopeSequences final : AbstractScopeSequenceHolder<StructuredDataDefParser> { public: - StructuredDataStructScopeSequences(std::vector<std::unique_ptr<StructuredDataDefParser::sequence_t>>& allSequences, std::vector<StructuredDataDefParser::sequence_t*>& scopeSequences); + StructuredDataStructScopeSequences(std::vector<std::unique_ptr<StructuredDataDefParser::sequence_t>>& allSequences, + std::vector<StructuredDataDefParser::sequence_t*>& scopeSequences); void AddSequences() const; }; -} +} // namespace sdd diff --git a/src/ObjLoading/StructuredDataDef/Parsing/StructuredDataDefParser.h b/src/ObjLoading/StructuredDataDef/Parsing/StructuredDataDefParser.h index cf45b1a41..6b8c02fad 100644 --- a/src/ObjLoading/StructuredDataDef/Parsing/StructuredDataDefParser.h +++ b/src/ObjLoading/StructuredDataDef/Parsing/StructuredDataDefParser.h @@ -1,11 +1,11 @@ #pragma once -#include "Utils/ClassUtils.h" -#include "StructuredDataDefParserState.h" -#include "StructuredDataDef/CommonStructuredDataDef.h" +#include "Parsing/Impl/AbstractParser.h" #include "Parsing/Simple/SimpleLexer.h" #include "Parsing/Simple/SimpleParserValue.h" -#include "Parsing/Impl/AbstractParser.h" +#include "StructuredDataDef/CommonStructuredDataDef.h" +#include "StructuredDataDefParserState.h" +#include "Utils/ClassUtils.h" namespace sdd { @@ -16,7 +16,7 @@ namespace sdd std::vector<sequence_t*> m_def_tests; std::vector<sequence_t*> m_enum_tests; std::vector<sequence_t*> m_struct_tests; - + void CreateSequenceCollections(); protected: @@ -26,4 +26,4 @@ namespace sdd explicit StructuredDataDefParser(SimpleLexer* lexer); _NODISCARD std::vector<std::unique_ptr<CommonStructuredDataDef>> GetDefs() const; }; -} +} // namespace sdd diff --git a/src/ObjLoading/StructuredDataDef/Parsing/StructuredDataDefParserState.cpp b/src/ObjLoading/StructuredDataDef/Parsing/StructuredDataDefParserState.cpp index 72c16d50b..6aba6c870 100644 --- a/src/ObjLoading/StructuredDataDef/Parsing/StructuredDataDefParserState.cpp +++ b/src/ObjLoading/StructuredDataDef/Parsing/StructuredDataDefParserState.cpp @@ -2,8 +2,7 @@ using namespace sdd; -UndefinedType::UndefinedType() -= default; +UndefinedType::UndefinedType() = default; UndefinedType::UndefinedType(std::string name, const TokenPos firstUsagePos) : m_name(std::move(name)), diff --git a/src/ObjLoading/StructuredDataDef/Parsing/StructuredDataDefParserState.h b/src/ObjLoading/StructuredDataDef/Parsing/StructuredDataDefParserState.h index 53abf4398..83d8892e0 100644 --- a/src/ObjLoading/StructuredDataDef/Parsing/StructuredDataDefParserState.h +++ b/src/ObjLoading/StructuredDataDef/Parsing/StructuredDataDefParserState.h @@ -1,13 +1,13 @@ #pragma once +#include "Parsing/TokenPos.h" +#include "StructuredDataDef/CommonStructuredDataDef.h" + +#include <cstddef> #include <map> #include <memory> -#include <vector> -#include <cstddef> #include <string> - -#include "Parsing/TokenPos.h" -#include "StructuredDataDef/CommonStructuredDataDef.h" +#include <vector> namespace sdd { @@ -44,4 +44,4 @@ namespace sdd StructuredDataDefParserState(); }; -} +} // namespace sdd diff --git a/src/ObjLoading/StructuredDataDef/Parsing/StructuredDataDefSizeCalculator.cpp b/src/ObjLoading/StructuredDataDef/Parsing/StructuredDataDefSizeCalculator.cpp index 7953160f7..67ba6c24c 100644 --- a/src/ObjLoading/StructuredDataDef/Parsing/StructuredDataDefSizeCalculator.cpp +++ b/src/ObjLoading/StructuredDataDef/Parsing/StructuredDataDefSizeCalculator.cpp @@ -1,11 +1,11 @@ #include "StructuredDataDefSizeCalculator.h" -#include <cassert> -#include <sstream> - #include "Utils/Alignment.h" #include "Utils/ClassUtils.h" +#include <cassert> +#include <sstream> + using namespace sdd; SizeCalculationException::SizeCalculationException(std::string message) diff --git a/src/ObjLoading/StructuredDataDef/Parsing/StructuredDataDefSizeCalculator.h b/src/ObjLoading/StructuredDataDef/Parsing/StructuredDataDefSizeCalculator.h index be8a8283a..9e18a9512 100644 --- a/src/ObjLoading/StructuredDataDef/Parsing/StructuredDataDefSizeCalculator.h +++ b/src/ObjLoading/StructuredDataDef/Parsing/StructuredDataDefSizeCalculator.h @@ -1,10 +1,10 @@ #pragma once -#include <string> -#include <exception> - -#include "Utils/ClassUtils.h" #include "StructuredDataDef/CommonStructuredDataDef.h" +#include "Utils/ClassUtils.h" + +#include <exception> +#include <string> namespace sdd { @@ -24,4 +24,4 @@ namespace sdd public: static void CalculateSizesAndOffsetsForDef(CommonStructuredDataDef& def); }; -} +} // namespace sdd diff --git a/src/ObjLoading/StructuredDataDef/StructuredDataDefReader.cpp b/src/ObjLoading/StructuredDataDef/StructuredDataDefReader.cpp index 5dba0a647..2a5f3cbeb 100644 --- a/src/ObjLoading/StructuredDataDef/StructuredDataDefReader.cpp +++ b/src/ObjLoading/StructuredDataDef/StructuredDataDefReader.cpp @@ -1,11 +1,11 @@ #include "StructuredDataDefReader.h" -#include "StructuredDataDef/Parsing/StructuredDataDefParser.h" #include "Parsing/Impl/CommentRemovingStreamProxy.h" #include "Parsing/Impl/DefinesStreamProxy.h" #include "Parsing/Impl/IncludingStreamProxy.h" #include "Parsing/Impl/ParserMultiInputStream.h" #include "Parsing/Impl/ParserSingleInputStream.h" +#include "StructuredDataDef/Parsing/StructuredDataDefParser.h" using namespace sdd; diff --git a/src/ObjLoading/StructuredDataDef/StructuredDataDefReader.h b/src/ObjLoading/StructuredDataDef/StructuredDataDefReader.h index 34e1162fd..3ecb88993 100644 --- a/src/ObjLoading/StructuredDataDef/StructuredDataDefReader.h +++ b/src/ObjLoading/StructuredDataDef/StructuredDataDefReader.h @@ -1,12 +1,12 @@ #pragma once +#include "Parsing/IParserLineStream.h" +#include "StructuredDataDef/CommonStructuredDataDef.h" + #include <memory> #include <string> #include <vector> -#include "StructuredDataDef/CommonStructuredDataDef.h" -#include "Parsing/IParserLineStream.h" - class StructuredDataDefReader { public: diff --git a/src/ObjLoading/Techset/Parsing/Sequence/TechniqueNoScopeSequences.cpp b/src/ObjLoading/Techset/Parsing/Sequence/TechniqueNoScopeSequences.cpp index 3d5498cad..f6c5e1375 100644 --- a/src/ObjLoading/Techset/Parsing/Sequence/TechniqueNoScopeSequences.cpp +++ b/src/ObjLoading/Techset/Parsing/Sequence/TechniqueNoScopeSequences.cpp @@ -1,9 +1,9 @@ #include "TechniqueNoScopeSequences.h" -#include <cassert> - #include "Parsing/Simple/Matcher/SimpleMatcherFactory.h" +#include <cassert> + using namespace techset; namespace techset @@ -15,9 +15,7 @@ namespace techset { const SimpleMatcherFactory create(this); - AddMatchers({ - create.Char('{') - }); + AddMatchers({create.Char('{')}); } protected: @@ -29,13 +27,11 @@ namespace techset state->m_acceptor->AcceptNextPass(); } }; -} +} // namespace techset const std::vector<TechniqueParser::sequence_t*>& TechniqueNoScopeSequences::GetSequences() { - static std::vector<TechniqueParser::sequence_t*> tests({ - new SequencePass() - }); + static std::vector<TechniqueParser::sequence_t*> tests({new SequencePass()}); return tests; } diff --git a/src/ObjLoading/Techset/Parsing/Sequence/TechniqueNoScopeSequences.h b/src/ObjLoading/Techset/Parsing/Sequence/TechniqueNoScopeSequences.h index d8f33f7e2..81a03c9c0 100644 --- a/src/ObjLoading/Techset/Parsing/Sequence/TechniqueNoScopeSequences.h +++ b/src/ObjLoading/Techset/Parsing/Sequence/TechniqueNoScopeSequences.h @@ -1,8 +1,8 @@ #pragma once -#include <vector> - #include "Techset/Parsing/TechniqueFileParser.h" +#include <vector> + namespace techset { class TechniqueNoScopeSequences @@ -12,4 +12,4 @@ namespace techset public: static const std::vector<TechniqueParser::sequence_t*>& GetSequences(); }; -} +} // namespace techset diff --git a/src/ObjLoading/Techset/Parsing/Sequence/TechniquePassScopeSequences.cpp b/src/ObjLoading/Techset/Parsing/Sequence/TechniquePassScopeSequences.cpp index 76631ff5e..009a51d5f 100644 --- a/src/ObjLoading/Techset/Parsing/Sequence/TechniquePassScopeSequences.cpp +++ b/src/ObjLoading/Techset/Parsing/Sequence/TechniquePassScopeSequences.cpp @@ -1,10 +1,10 @@ #include "TechniquePassScopeSequences.h" +#include "Parsing/Simple/Matcher/SimpleMatcherFactory.h" + #include <cassert> #include <sstream> -#include "Parsing/Simple/Matcher/SimpleMatcherFactory.h" - using namespace techset; namespace techset @@ -18,9 +18,7 @@ namespace techset { const SimpleMatcherFactory create(this); - AddMatchers({ - create.Char('}').Capture(CAPTURE_FIRST_TOKEN) - }); + AddMatchers({create.Char('}').Capture(CAPTURE_FIRST_TOKEN)}); } protected: @@ -46,11 +44,7 @@ namespace techset { const SimpleMatcherFactory create(this); - AddMatchers({ - create.Keyword("stateMap").Capture(CAPTURE_START), - create.String().Capture(CAPTURE_STATE_MAP_NAME), - create.Char(';') - }); + AddMatchers({create.Keyword("stateMap").Capture(CAPTURE_START), create.String().Capture(CAPTURE_STATE_MAP_NAME), create.Char(';')}); } protected: @@ -82,23 +76,21 @@ namespace techset { const SimpleMatcherFactory create(this); - AddMatchers({ - create.Or({ - create.Keyword("vertexShader").Tag(TAG_VERTEX_SHADER), - create.Keyword("pixelShader").Tag(TAG_PIXEL_SHADER), - }).Capture(CAPTURE_START), - create.Or({ - create.And({ - create.Integer().Capture(CAPTURE_VERSION_MAJOR), - create.Char('.'), - create.Integer().Capture(CAPTURE_VERSION_MINOR), - }), - create.FloatingPoint().Capture(CAPTURE_VERSION), // This is dumb but cod devs made the format so cannot change it - create.String().Capture(CAPTURE_VERSION) - }), - create.String().Capture(CAPTURE_SHADER_NAME), - create.Char('{') - }); + AddMatchers({create + .Or({ + create.Keyword("vertexShader").Tag(TAG_VERTEX_SHADER), + create.Keyword("pixelShader").Tag(TAG_PIXEL_SHADER), + }) + .Capture(CAPTURE_START), + create.Or({create.And({ + create.Integer().Capture(CAPTURE_VERSION_MAJOR), + create.Char('.'), + create.Integer().Capture(CAPTURE_VERSION_MINOR), + }), + create.FloatingPoint().Capture(CAPTURE_VERSION), // This is dumb but cod devs made the format so cannot change it + create.String().Capture(CAPTURE_VERSION)}), + create.String().Capture(CAPTURE_SHADER_NAME), + create.Char('{')}); } protected: @@ -145,29 +137,19 @@ namespace techset { const SimpleMatcherFactory create(this); - AddMatchers({ - create.Keyword("vertex").Capture(CAPTURE_FIRST_TOKEN), - create.Char('.'), - create.Identifier().Capture(CAPTURE_STREAM_DESTINATION_NAME), - create.Optional(create.And({ - create.Char('['), - create.Integer().Capture(CAPTURE_STREAM_DESTINATION_INDEX), - create.Char(']') - })), - - create.Char('='), - - create.Keyword("code"), - create.Char('.'), - create.Identifier().Capture(CAPTURE_STREAM_SOURCE_NAME), - create.Optional(create.And({ - create.Char('['), - create.Integer().Capture(CAPTURE_STREAM_SOURCE_INDEX), - create.Char(']') - })), - - create.Char(';') - }); + AddMatchers({create.Keyword("vertex").Capture(CAPTURE_FIRST_TOKEN), + create.Char('.'), + create.Identifier().Capture(CAPTURE_STREAM_DESTINATION_NAME), + create.Optional(create.And({create.Char('['), create.Integer().Capture(CAPTURE_STREAM_DESTINATION_INDEX), create.Char(']')})), + + create.Char('='), + + create.Keyword("code"), + create.Char('.'), + create.Identifier().Capture(CAPTURE_STREAM_SOURCE_NAME), + create.Optional(create.And({create.Char('['), create.Integer().Capture(CAPTURE_STREAM_SOURCE_INDEX), create.Char(']')})), + + create.Char(';')}); } static std::string CreateRoutingString(SequenceResult<SimpleParserValue>& result, const int nameCapture, const int indexCapture) @@ -198,16 +180,12 @@ namespace techset throw ParsingException(firstToken.GetPos(), std::move(errorMessage)); } }; -} +} // namespace techset const std::vector<TechniqueParser::sequence_t*>& TechniquePassScopeSequences::GetSequences() { - static std::vector<TechniqueParser::sequence_t*> tests({ - new SequenceEndPass(), - new SequenceStateMap(), - new SequenceShader(), - new SequenceVertexStreamRouting() - }); + static std::vector<TechniqueParser::sequence_t*> tests( + {new SequenceEndPass(), new SequenceStateMap(), new SequenceShader(), new SequenceVertexStreamRouting()}); return tests; } diff --git a/src/ObjLoading/Techset/Parsing/Sequence/TechniquePassScopeSequences.h b/src/ObjLoading/Techset/Parsing/Sequence/TechniquePassScopeSequences.h index c159c4978..cf2f2a02e 100644 --- a/src/ObjLoading/Techset/Parsing/Sequence/TechniquePassScopeSequences.h +++ b/src/ObjLoading/Techset/Parsing/Sequence/TechniquePassScopeSequences.h @@ -1,8 +1,8 @@ #pragma once -#include <vector> - #include "Techset/Parsing/TechniqueFileParser.h" +#include <vector> + namespace techset { class TechniquePassScopeSequences @@ -12,4 +12,4 @@ namespace techset public: static const std::vector<TechniqueParser::sequence_t*>& GetSequences(); }; -} +} // namespace techset diff --git a/src/ObjLoading/Techset/Parsing/Sequence/TechniqueShaderScopeSequences.cpp b/src/ObjLoading/Techset/Parsing/Sequence/TechniqueShaderScopeSequences.cpp index eea462f44..9435cfdaa 100644 --- a/src/ObjLoading/Techset/Parsing/Sequence/TechniqueShaderScopeSequences.cpp +++ b/src/ObjLoading/Techset/Parsing/Sequence/TechniqueShaderScopeSequences.cpp @@ -1,9 +1,9 @@ #include "TechniqueShaderScopeSequences.h" -#include <cassert> - #include "Parsing/Simple/Matcher/SimpleMatcherFactory.h" +#include <cassert> + using namespace techset; namespace techset @@ -15,9 +15,7 @@ namespace techset { const SimpleMatcherFactory create(this); - AddMatchers({ - create.Char('}') - }); + AddMatchers({create.Char('}')}); } protected: @@ -46,63 +44,45 @@ namespace techset static std::unique_ptr<matcher_t> CodeMatchers(const SimpleMatcherFactory& create) { - return create.And({ - create.Or({ - create.Keyword("constant").Tag(TAG_CONSTANT), - create.Keyword("sampler").Tag(TAG_SAMPLER) - }), - create.Char('.'), - create.Identifier().Capture(CAPTURE_CODE_ACCESSOR), - create.OptionalLoop(create.And({ - create.Char('.'), - create.Identifier().Capture(CAPTURE_CODE_ACCESSOR) - })), - create.Optional(create.And({ - create.Char('['), - create.Integer().Capture(CAPTURE_CODE_INDEX), - create.Char(']') - })) - }); + return create.And({create.Or({create.Keyword("constant").Tag(TAG_CONSTANT), create.Keyword("sampler").Tag(TAG_SAMPLER)}), + create.Char('.'), + create.Identifier().Capture(CAPTURE_CODE_ACCESSOR), + create.OptionalLoop(create.And({create.Char('.'), create.Identifier().Capture(CAPTURE_CODE_ACCESSOR)})), + create.Optional(create.And({create.Char('['), create.Integer().Capture(CAPTURE_CODE_INDEX), create.Char(']')}))}); } static std::unique_ptr<matcher_t> LiteralValueMatchers(const SimpleMatcherFactory& create) { - return create.Or({ - create.FloatingPoint(), - create.Integer() - }).Capture(CAPTURE_LITERAL_VALUE); + return create.Or({create.FloatingPoint(), create.Integer()}).Capture(CAPTURE_LITERAL_VALUE); } static std::unique_ptr<matcher_t> LiteralMatchers(const SimpleMatcherFactory& create) { - return create.And({ - create.Keyword("float4"), - create.Char('('), - LiteralValueMatchers(create), - create.Char(','), - LiteralValueMatchers(create), - create.Char(','), - LiteralValueMatchers(create), - create.Char(','), - LiteralValueMatchers(create), - create.Char(')'), - }).Tag(TAG_LITERAL); + return create + .And({ + create.Keyword("float4"), + create.Char('('), + LiteralValueMatchers(create), + create.Char(','), + LiteralValueMatchers(create), + create.Char(','), + LiteralValueMatchers(create), + create.Char(','), + LiteralValueMatchers(create), + create.Char(')'), + }) + .Tag(TAG_LITERAL); } static std::unique_ptr<matcher_t> MaterialMatchers(const SimpleMatcherFactory& create) { - return create.And({ - create.Keyword("material"), - create.Char('.'), - - create.Or({ - create.And({ - create.Char('#'), - create.Integer().Capture(CAPTURE_MATERIAL_HASH) - }), - create.Identifier().Capture(CAPTURE_MATERIAL_NAME) - }) - }).Tag(TAG_MATERIAL); + return create + .And({create.Keyword("material"), + create.Char('.'), + + create.Or({create.And({create.Char('#'), create.Integer().Capture(CAPTURE_MATERIAL_HASH)}), + create.Identifier().Capture(CAPTURE_MATERIAL_NAME)})}) + .Tag(TAG_MATERIAL); } public: @@ -110,22 +90,12 @@ namespace techset { const SimpleMatcherFactory create(this); - AddMatchers({ - create.Identifier().Capture(CAPTURE_FIRST_TOKEN).NoConsume(), - create.Identifier().Capture(CAPTURE_SHADER_ARGUMENT), - create.Optional(create.And({ - create.Char('['), - create.Integer().Capture(CAPTURE_SHADER_INDEX), - create.Char(']') - })), - create.Char('='), - create.Or({ - CodeMatchers(create), - LiteralMatchers(create), - MaterialMatchers(create) - }), - create.Char(';') - }); + AddMatchers({create.Identifier().Capture(CAPTURE_FIRST_TOKEN).NoConsume(), + create.Identifier().Capture(CAPTURE_SHADER_ARGUMENT), + create.Optional(create.And({create.Char('['), create.Integer().Capture(CAPTURE_SHADER_INDEX), create.Char(']')})), + create.Char('='), + create.Or({CodeMatchers(create), LiteralMatchers(create), MaterialMatchers(create)}), + create.Char(';')}); } static void ProcessCodeArgument(const TechniqueParserState* state, SequenceResult<SimpleParserValue>& result, ShaderArgument arg, const bool isSampler) @@ -146,7 +116,7 @@ namespace techset source = ShaderArgumentCodeSource(std::move(accessors)); std::string errorMessage; - if(!isSampler) + if (!isSampler) { if (!state->m_acceptor->AcceptShaderConstantArgument(state->m_current_shader, std::move(arg), std::move(source), errorMessage)) throw ParsingException(result.NextCapture(CAPTURE_FIRST_TOKEN).GetPos(), std::move(errorMessage)); @@ -223,14 +193,11 @@ namespace techset ProcessMaterialArgument(state, result, std::move(arg)); } }; -} +} // namespace techset const std::vector<TechniqueParser::sequence_t*>& TechniqueShaderScopeSequences::GetSequences() { - static std::vector<TechniqueParser::sequence_t*> tests({ - new SequenceEndShader(), - new SequenceShaderArgument() - }); + static std::vector<TechniqueParser::sequence_t*> tests({new SequenceEndShader(), new SequenceShaderArgument()}); return tests; } diff --git a/src/ObjLoading/Techset/Parsing/Sequence/TechniqueShaderScopeSequences.h b/src/ObjLoading/Techset/Parsing/Sequence/TechniqueShaderScopeSequences.h index e49fe54cc..7fa20ca3a 100644 --- a/src/ObjLoading/Techset/Parsing/Sequence/TechniqueShaderScopeSequences.h +++ b/src/ObjLoading/Techset/Parsing/Sequence/TechniqueShaderScopeSequences.h @@ -1,8 +1,8 @@ #pragma once -#include <vector> - #include "Techset/Parsing/TechniqueFileParser.h" +#include <vector> + namespace techset { class TechniqueShaderScopeSequences @@ -12,4 +12,4 @@ namespace techset public: static const std::vector<TechniqueParser::sequence_t*>& GetSequences(); }; -} +} // namespace techset diff --git a/src/ObjLoading/Techset/Parsing/TechniqueFileParser.h b/src/ObjLoading/Techset/Parsing/TechniqueFileParser.h index 81570d133..8944f573f 100644 --- a/src/ObjLoading/Techset/Parsing/TechniqueFileParser.h +++ b/src/ObjLoading/Techset/Parsing/TechniqueFileParser.h @@ -1,9 +1,9 @@ #pragma once -#include "TechniqueFileParserState.h" +#include "Parsing/Impl/AbstractParser.h" #include "Parsing/Simple/SimpleLexer.h" #include "Parsing/Simple/SimpleParserValue.h" -#include "Parsing/Impl/AbstractParser.h" +#include "TechniqueFileParserState.h" namespace techset { @@ -15,4 +15,4 @@ namespace techset public: TechniqueParser(SimpleLexer* lexer, ITechniqueDefinitionAcceptor* acceptor); }; -} +} // namespace techset diff --git a/src/ObjLoading/Techset/Parsing/TechniqueFileParserState.h b/src/ObjLoading/Techset/Parsing/TechniqueFileParserState.h index 350007e58..08a87c48c 100644 --- a/src/ObjLoading/Techset/Parsing/TechniqueFileParserState.h +++ b/src/ObjLoading/Techset/Parsing/TechniqueFileParserState.h @@ -8,11 +8,11 @@ namespace techset { public: ITechniqueDefinitionAcceptor* const m_acceptor; - + bool m_in_pass; bool m_in_shader; ShaderSelector m_current_shader; explicit TechniqueParserState(ITechniqueDefinitionAcceptor* acceptor); }; -} +} // namespace techset diff --git a/src/ObjLoading/Techset/Parsing/TechsetFileParser.cpp b/src/ObjLoading/Techset/Parsing/TechsetFileParser.cpp index ffa62c5d6..1314e332b 100644 --- a/src/ObjLoading/Techset/Parsing/TechsetFileParser.cpp +++ b/src/ObjLoading/Techset/Parsing/TechsetFileParser.cpp @@ -15,10 +15,7 @@ namespace techset { const SimpleMatcherFactory create(this); - AddMatchers({ - create.String().Capture(CAPTURE_TYPE_NAME), - create.Char(':') - }); + AddMatchers({create.String().Capture(CAPTURE_TYPE_NAME), create.Char(':')}); } protected: @@ -43,13 +40,7 @@ namespace techset { const SimpleMatcherFactory create(this); - AddMatchers({ - create.Or({ - create.Identifier(), - create.String() - }).Capture(CAPTURE_NAME), - create.Char(';') - }); + AddMatchers({create.Or({create.Identifier(), create.String()}).Capture(CAPTURE_NAME), create.Char(';')}); } protected: @@ -58,16 +49,15 @@ namespace techset assert(!state->m_current_technique_types.empty()); const auto& techniqueNameToken = result.NextCapture(CAPTURE_NAME); - const auto& techniqueName = techniqueNameToken.m_type == SimpleParserValueType::STRING - ? techniqueNameToken.StringValue() - : techniqueNameToken.IdentifierValue(); + const auto& techniqueName = + techniqueNameToken.m_type == SimpleParserValueType::STRING ? techniqueNameToken.StringValue() : techniqueNameToken.IdentifierValue(); for (const auto techniqueTypeIndex : state->m_current_technique_types) state->m_definition->SetTechniqueByIndex(techniqueTypeIndex, techniqueName); state->m_current_technique_types.clear(); } }; -} +} // namespace techset TechsetParser::TechsetParser(SimpleLexer* lexer, const char** validTechniqueTypeNames, const size_t validTechniqueTypeNameCount) : AbstractParser(lexer, std::make_unique<TechsetParserState>(validTechniqueTypeNames, validTechniqueTypeNameCount)) @@ -76,13 +66,8 @@ TechsetParser::TechsetParser(SimpleLexer* lexer, const char** validTechniqueType const std::vector<TechsetParser::sequence_t*>& TechsetParser::GetTestsForState() { - static std::vector<sequence_t*> allTests({ - new SequenceTechniqueTypeName(), - new SequenceTechniqueName() - }); - static std::vector<sequence_t*> techniqueTypeNameOnlyTests({ - new SequenceTechniqueTypeName() - }); + static std::vector<sequence_t*> allTests({new SequenceTechniqueTypeName(), new SequenceTechniqueName()}); + static std::vector<sequence_t*> techniqueTypeNameOnlyTests({new SequenceTechniqueTypeName()}); return m_state->m_current_technique_types.empty() ? techniqueTypeNameOnlyTests : allTests; } diff --git a/src/ObjLoading/Techset/Parsing/TechsetFileParser.h b/src/ObjLoading/Techset/Parsing/TechsetFileParser.h index cbe59df93..20620693d 100644 --- a/src/ObjLoading/Techset/Parsing/TechsetFileParser.h +++ b/src/ObjLoading/Techset/Parsing/TechsetFileParser.h @@ -1,11 +1,11 @@ #pragma once -#include "Utils/ClassUtils.h" -#include "TechsetFileParserState.h" -#include "Techset/TechsetDefinition.h" +#include "Parsing/Impl/AbstractParser.h" #include "Parsing/Simple/SimpleLexer.h" #include "Parsing/Simple/SimpleParserValue.h" -#include "Parsing/Impl/AbstractParser.h" +#include "Techset/TechsetDefinition.h" +#include "TechsetFileParserState.h" +#include "Utils/ClassUtils.h" namespace techset { @@ -18,4 +18,4 @@ namespace techset TechsetParser(SimpleLexer* lexer, const char** validTechniqueTypeNames, size_t validTechniqueTypeNameCount); _NODISCARD std::unique_ptr<TechsetDefinition> GetTechsetDefinition() const; }; -} +} // namespace techset diff --git a/src/ObjLoading/Techset/Parsing/TechsetFileParserState.h b/src/ObjLoading/Techset/Parsing/TechsetFileParserState.h index ce0bad61e..8271198f5 100644 --- a/src/ObjLoading/Techset/Parsing/TechsetFileParserState.h +++ b/src/ObjLoading/Techset/Parsing/TechsetFileParserState.h @@ -1,11 +1,11 @@ #pragma once +#include "Techset/TechsetDefinition.h" + #include <map> #include <memory> #include <string> -#include "Techset/TechsetDefinition.h" - namespace techset { class TechsetParserState @@ -19,4 +19,4 @@ namespace techset bool FindTechniqueTypeIndex(const std::string& techniqueTypeName, size_t& techniqueTypeIndex) const; }; -} +} // namespace techset diff --git a/src/ObjLoading/Techset/TechniqueDefinitionAcceptor.cpp b/src/ObjLoading/Techset/TechniqueDefinitionAcceptor.cpp index e103aa338..f9aabd71b 100644 --- a/src/ObjLoading/Techset/TechniqueDefinitionAcceptor.cpp +++ b/src/ObjLoading/Techset/TechniqueDefinitionAcceptor.cpp @@ -94,7 +94,7 @@ namespace techset { return !(lhs < rhs); } -} +} // namespace techset ShaderArgumentMaterialSource::ShaderArgumentMaterialSource() : m_is_hash(false), diff --git a/src/ObjLoading/Techset/TechniqueDefinitionAcceptor.h b/src/ObjLoading/Techset/TechniqueDefinitionAcceptor.h index 2b1975a51..d01f4a19b 100644 --- a/src/ObjLoading/Techset/TechniqueDefinitionAcceptor.h +++ b/src/ObjLoading/Techset/TechniqueDefinitionAcceptor.h @@ -66,6 +66,7 @@ namespace techset { protected: ITechniqueDefinitionAcceptor() = default; + public: virtual ~ITechniqueDefinitionAcceptor() = default; ITechniqueDefinitionAcceptor(const ITechniqueDefinitionAcceptor& other) = default; @@ -81,11 +82,19 @@ namespace techset virtual bool AcceptVertexShader(const std::string& vertexShaderName, std::string& errorMessage) = 0; virtual bool AcceptPixelShader(const std::string& pixelShaderName, std::string& errorMessage) = 0; - virtual bool AcceptShaderConstantArgument(ShaderSelector shader, ShaderArgument shaderArgument, ShaderArgumentCodeSource source, std::string& errorMessage) = 0; - virtual bool AcceptShaderSamplerArgument(ShaderSelector shader, ShaderArgument shaderArgument, ShaderArgumentCodeSource source, std::string& errorMessage) = 0; - virtual bool AcceptShaderLiteralArgument(ShaderSelector shader, ShaderArgument shaderArgument, ShaderArgumentLiteralSource source, std::string& errorMessage) = 0; - virtual bool AcceptShaderMaterialArgument(ShaderSelector shader, ShaderArgument shaderArgument, ShaderArgumentMaterialSource source, std::string& errorMessage) = 0; + virtual bool + AcceptShaderConstantArgument(ShaderSelector shader, ShaderArgument shaderArgument, ShaderArgumentCodeSource source, std::string& errorMessage) = 0; + virtual bool + AcceptShaderSamplerArgument(ShaderSelector shader, ShaderArgument shaderArgument, ShaderArgumentCodeSource source, std::string& errorMessage) = 0; + virtual bool AcceptShaderLiteralArgument(ShaderSelector shader, + ShaderArgument shaderArgument, + ShaderArgumentLiteralSource source, + std::string& errorMessage) = 0; + virtual bool AcceptShaderMaterialArgument(ShaderSelector shader, + ShaderArgument shaderArgument, + ShaderArgumentMaterialSource source, + std::string& errorMessage) = 0; virtual bool AcceptVertexStreamRouting(const std::string& destination, const std::string& source, std::string& errorMessage) = 0; }; -} +} // namespace techset diff --git a/src/ObjLoading/Techset/TechniqueFileReader.cpp b/src/ObjLoading/Techset/TechniqueFileReader.cpp index 67d37fc75..60f2c5b81 100644 --- a/src/ObjLoading/Techset/TechniqueFileReader.cpp +++ b/src/ObjLoading/Techset/TechniqueFileReader.cpp @@ -1,11 +1,11 @@ #include "TechniqueFileReader.h" -#include <iostream> - -#include "Parsing/TechniqueFileParser.h" #include "Parsing/Impl/CommentRemovingStreamProxy.h" #include "Parsing/Impl/ParserSingleInputStream.h" #include "Parsing/Simple/SimpleLexer.h" +#include "Parsing/TechniqueFileParser.h" + +#include <iostream> using namespace techset; diff --git a/src/ObjLoading/Techset/TechniqueFileReader.h b/src/ObjLoading/Techset/TechniqueFileReader.h index f508ea491..fe85f9a88 100644 --- a/src/ObjLoading/Techset/TechniqueFileReader.h +++ b/src/ObjLoading/Techset/TechniqueFileReader.h @@ -1,12 +1,12 @@ #pragma once +#include "Parsing/IParserLineStream.h" +#include "TechniqueDefinitionAcceptor.h" +#include "Utils/ClassUtils.h" + #include <memory> #include <string> -#include "Utils/ClassUtils.h" -#include "TechniqueDefinitionAcceptor.h" -#include "Parsing/IParserLineStream.h" - namespace techset { class TechniqueFileReader @@ -21,4 +21,4 @@ namespace techset _NODISCARD bool ReadTechniqueDefinition() const; }; -} \ No newline at end of file +} // namespace techset diff --git a/src/ObjLoading/Techset/TechniqueStateMapCache.h b/src/ObjLoading/Techset/TechniqueStateMapCache.h index 2b0eea239..5d9d29a6d 100644 --- a/src/ObjLoading/Techset/TechniqueStateMapCache.h +++ b/src/ObjLoading/Techset/TechniqueStateMapCache.h @@ -1,13 +1,13 @@ #pragma once +#include "AssetLoading/IZoneAssetLoaderState.h" +#include "StateMap/StateMapDefinition.h" +#include "Utils/ClassUtils.h" + #include <memory> #include <string> #include <unordered_map> -#include "AssetLoading/IZoneAssetLoaderState.h" -#include "Utils/ClassUtils.h" -#include "StateMap/StateMapDefinition.h" - namespace techset { class TechniqueStateMapCache final : public IZoneAssetLoaderState @@ -23,4 +23,4 @@ namespace techset std::unordered_map<std::string, const state_map::StateMapDefinition*> m_state_map_per_technique; std::unordered_map<std::string, std::unique_ptr<state_map::StateMapDefinition>> m_state_map_cache; }; -} +} // namespace techset diff --git a/src/ObjLoading/Techset/TechsetDefinition.h b/src/ObjLoading/Techset/TechsetDefinition.h index 8dc533c3b..f8f2bf954 100644 --- a/src/ObjLoading/Techset/TechsetDefinition.h +++ b/src/ObjLoading/Techset/TechsetDefinition.h @@ -15,4 +15,4 @@ namespace techset bool GetTechniqueByIndex(size_t index, std::string& techniqueName) const; void SetTechniqueByIndex(size_t index, std::string techniqueName); }; -} +} // namespace techset diff --git a/src/ObjLoading/Techset/TechsetDefinitionCache.h b/src/ObjLoading/Techset/TechsetDefinitionCache.h index 9ca3ad96d..83bff7205 100644 --- a/src/ObjLoading/Techset/TechsetDefinitionCache.h +++ b/src/ObjLoading/Techset/TechsetDefinitionCache.h @@ -1,12 +1,12 @@ #pragma once -#include <unordered_map> -#include <string> -#include <memory> - -#include "Utils/ClassUtils.h" -#include "TechsetDefinition.h" #include "AssetLoading/IZoneAssetLoaderState.h" +#include "TechsetDefinition.h" +#include "Utils/ClassUtils.h" + +#include <memory> +#include <string> +#include <unordered_map> namespace techset { @@ -19,4 +19,4 @@ namespace techset private: std::unordered_map<std::string, std::unique_ptr<TechsetDefinition>> m_cache; }; -} +} // namespace techset diff --git a/src/ObjLoading/Techset/TechsetFileReader.cpp b/src/ObjLoading/Techset/TechsetFileReader.cpp index 52fdd964d..ee1f11fbd 100644 --- a/src/ObjLoading/Techset/TechsetFileReader.cpp +++ b/src/ObjLoading/Techset/TechsetFileReader.cpp @@ -1,10 +1,10 @@ #include "TechsetFileReader.h" -#include <iostream> - -#include "Parsing/TechsetFileParser.h" #include "Parsing/Impl/CommentRemovingStreamProxy.h" #include "Parsing/Impl/ParserSingleInputStream.h" +#include "Parsing/TechsetFileParser.h" + +#include <iostream> using namespace techset; diff --git a/src/ObjLoading/Techset/TechsetFileReader.h b/src/ObjLoading/Techset/TechsetFileReader.h index d8eacb5ca..6ba9ac6e0 100644 --- a/src/ObjLoading/Techset/TechsetFileReader.h +++ b/src/ObjLoading/Techset/TechsetFileReader.h @@ -1,12 +1,12 @@ #pragma once +#include "Parsing/IParserLineStream.h" +#include "TechsetDefinition.h" +#include "Utils/ClassUtils.h" + #include <memory> #include <string> -#include "Utils/ClassUtils.h" -#include "TechsetDefinition.h" -#include "Parsing/IParserLineStream.h" - namespace techset { class TechsetFileReader @@ -22,4 +22,4 @@ namespace techset _NODISCARD std::unique_ptr<TechsetDefinition> ReadTechsetDefinition() const; }; -} +} // namespace techset diff --git a/src/ObjWriting/Dumping/AbstractAssetDumper.h b/src/ObjWriting/Dumping/AbstractAssetDumper.h index a18b5e6f5..53fa97dc1 100644 --- a/src/ObjWriting/Dumping/AbstractAssetDumper.h +++ b/src/ObjWriting/Dumping/AbstractAssetDumper.h @@ -2,8 +2,7 @@ #include "IAssetDumper.h" -template<class T> -class AbstractAssetDumper : public IAssetDumper<T> +template<class T> class AbstractAssetDumper : public IAssetDumper<T> { protected: virtual bool ShouldDump(XAssetInfo<T>* asset) diff --git a/src/ObjWriting/Dumping/AbstractTextDumper.cpp b/src/ObjWriting/Dumping/AbstractTextDumper.cpp index 5dcb847f2..6124a8549 100644 --- a/src/ObjWriting/Dumping/AbstractTextDumper.cpp +++ b/src/ObjWriting/Dumping/AbstractTextDumper.cpp @@ -4,9 +4,8 @@ AbstractTextDumper::AbstractTextDumper(std::ostream& stream) : m_stream(stream), - m_indent(0u) + m_indent(0u) { - } void AbstractTextDumper::Indent() const @@ -25,4 +24,4 @@ void AbstractTextDumper::DecIndent() assert(m_indent > 0); if (m_indent > 0) m_indent--; -} \ No newline at end of file +} diff --git a/src/ObjWriting/Dumping/AbstractTextDumper.h b/src/ObjWriting/Dumping/AbstractTextDumper.h index 38ff119d5..6c8a6462f 100644 --- a/src/ObjWriting/Dumping/AbstractTextDumper.h +++ b/src/ObjWriting/Dumping/AbstractTextDumper.h @@ -13,4 +13,4 @@ class AbstractTextDumper void DecIndent(); explicit AbstractTextDumper(std::ostream& stream); -}; \ No newline at end of file +}; diff --git a/src/ObjWriting/Dumping/AssetDumpingContext.h b/src/ObjWriting/Dumping/AssetDumpingContext.h index 9e38bf29e..1061ee62c 100644 --- a/src/ObjWriting/Dumping/AssetDumpingContext.h +++ b/src/ObjWriting/Dumping/AssetDumpingContext.h @@ -1,15 +1,15 @@ #pragma once -#include <string> -#include <ostream> -#include <memory> -#include <typeindex> - #include "IZoneAssetDumperState.h" -#include "Utils/ClassUtils.h" #include "Obj/Gdt/GdtStream.h" +#include "Utils/ClassUtils.h" #include "Zone/Zone.h" +#include <memory> +#include <ostream> +#include <string> +#include <typeindex> + class AssetDumpingContext { std::unordered_map<std::type_index, std::unique_ptr<IZoneAssetDumperState>> m_zone_asset_dumper_states; @@ -23,8 +23,7 @@ class AssetDumpingContext _NODISCARD std::unique_ptr<std::ostream> OpenAssetFile(const std::string& fileName) const; - template<typename T> - T* GetZoneAssetDumperState() + template<typename T> T* GetZoneAssetDumperState() { static_assert(std::is_base_of_v<IZoneAssetDumperState, T>, "T must inherit IZoneAssetDumperState"); // T must also have a public default constructor diff --git a/src/ObjWriting/Dumping/IAssetDumper.h b/src/ObjWriting/Dumping/IAssetDumper.h index 8efa5fe6e..f712f1dd8 100644 --- a/src/ObjWriting/Dumping/IAssetDumper.h +++ b/src/ObjWriting/Dumping/IAssetDumper.h @@ -3,8 +3,7 @@ #include "AssetDumpingContext.h" #include "Pool/AssetPool.h" -template<class T> -class IAssetDumper +template<class T> class IAssetDumper { public: IAssetDumper() = default; @@ -15,4 +14,4 @@ class IAssetDumper IAssetDumper& operator=(IAssetDumper&& other) noexcept = default; virtual void DumpPool(AssetDumpingContext& context, AssetPool<T>* pool) = 0; -}; \ No newline at end of file +}; diff --git a/src/ObjWriting/Dumping/IZoneDumper.h b/src/ObjWriting/Dumping/IZoneDumper.h index 8f17ba99a..8b3a30a62 100644 --- a/src/ObjWriting/Dumping/IZoneDumper.h +++ b/src/ObjWriting/Dumping/IZoneDumper.h @@ -14,4 +14,4 @@ class IZoneDumper virtual bool CanHandleZone(AssetDumpingContext& assetDumpingContext) const = 0; virtual bool DumpZone(AssetDumpingContext& assetDumpingContext) const = 0; -}; \ No newline at end of file +}; diff --git a/src/ObjWriting/Dumping/Localize/StringFileDumper.cpp b/src/ObjWriting/Dumping/Localize/StringFileDumper.cpp index ba0ae1008..2dc25be8a 100644 --- a/src/ObjWriting/Dumping/Localize/StringFileDumper.cpp +++ b/src/ObjWriting/Dumping/Localize/StringFileDumper.cpp @@ -1,8 +1,9 @@ #include "StringFileDumper.h" -#include <regex> #include "Utils/StringUtils.h" +#include <regex> + StringFileDumper::StringFileDumper(Zone* zone, std::ostream& stream) : AbstractTextDumper(stream), m_zone(zone), @@ -14,7 +15,8 @@ StringFileDumper::StringFileDumper(Zone* zone, std::ostream& stream) void StringFileDumper::SetLanguageName(std::string language) { m_language_caps = std::move(language); - for (auto& c : m_language_caps) c = toupper(c); + for (auto& c : m_language_caps) + c = toupper(c); } void StringFileDumper::SetConfigFile(std::string configFile) diff --git a/src/ObjWriting/Dumping/MapFile/MapFileDumper.cpp b/src/ObjWriting/Dumping/MapFile/MapFileDumper.cpp index a524ac573..a1a60af0c 100644 --- a/src/ObjWriting/Dumping/MapFile/MapFileDumper.cpp +++ b/src/ObjWriting/Dumping/MapFile/MapFileDumper.cpp @@ -128,13 +128,10 @@ void MapFileDumper::WritePhysicsBox(const PhysicsBox box) IncIndent(); Indent(); - m_stream << std::fixed << std::setprecision(6) - << box.m_orientation[0].m_x << " " << box.m_orientation[0].m_y << " " << box.m_orientation[0].m_z - << " " << box.m_orientation[1].m_x << " " << box.m_orientation[1].m_y << " " << box.m_orientation[1].m_z - << " " << box.m_orientation[2].m_x << " " << box.m_orientation[2].m_y << " " << box.m_orientation[2].m_z - << " " << box.m_middle_point.m_x << " " << box.m_middle_point.m_y << " " << box.m_middle_point.m_z - << " " << box.m_half_size.m_x << " " << box.m_half_size.m_y << " " << box.m_half_size.m_z - << "\n"; + m_stream << std::fixed << std::setprecision(6) << box.m_orientation[0].m_x << " " << box.m_orientation[0].m_y << " " << box.m_orientation[0].m_z << " " + << box.m_orientation[1].m_x << " " << box.m_orientation[1].m_y << " " << box.m_orientation[1].m_z << " " << box.m_orientation[2].m_x << " " + << box.m_orientation[2].m_y << " " << box.m_orientation[2].m_z << " " << box.m_middle_point.m_x << " " << box.m_middle_point.m_y << " " + << box.m_middle_point.m_z << " " << box.m_half_size.m_x << " " << box.m_half_size.m_y << " " << box.m_half_size.m_z << "\n"; DecIndent(); Indent(); @@ -150,11 +147,9 @@ void MapFileDumper::WritePhysicsCylinder(PhysicsCylinder cylinder) IncIndent(); Indent(); - m_stream << std::fixed << std::setprecision(6) - << cylinder.m_orientation.m_x << " " << cylinder.m_orientation.m_y << " " << cylinder.m_orientation.m_z - << " " << cylinder.m_middle_point.m_x << " " << cylinder.m_middle_point.m_y << " " << cylinder.m_middle_point.m_z - << " " << cylinder.m_height << " " << cylinder.m_radius - << "\n"; + m_stream << std::fixed << std::setprecision(6) << cylinder.m_orientation.m_x << " " << cylinder.m_orientation.m_y << " " << cylinder.m_orientation.m_z + << " " << cylinder.m_middle_point.m_x << " " << cylinder.m_middle_point.m_y << " " << cylinder.m_middle_point.m_z << " " << cylinder.m_height + << " " << cylinder.m_radius << "\n"; DecIndent(); Indent(); diff --git a/src/ObjWriting/Dumping/MapFile/MapFileDumper.h b/src/ObjWriting/Dumping/MapFile/MapFileDumper.h index fd8f20ec8..0286a6d54 100644 --- a/src/ObjWriting/Dumping/MapFile/MapFileDumper.h +++ b/src/ObjWriting/Dumping/MapFile/MapFileDumper.h @@ -1,9 +1,9 @@ #pragma once -#include <ostream> - #include "Dumping/AbstractTextDumper.h" +#include <ostream> + class MapFileDumper : AbstractTextDumper { public: diff --git a/src/ObjWriting/Dumping/SndCurve/SndCurveDumper.h b/src/ObjWriting/Dumping/SndCurve/SndCurveDumper.h index 5394bce0b..9182518d5 100644 --- a/src/ObjWriting/Dumping/SndCurve/SndCurveDumper.h +++ b/src/ObjWriting/Dumping/SndCurve/SndCurveDumper.h @@ -1,9 +1,9 @@ #pragma once -#include <ostream> - #include "Dumping/AbstractTextDumper.h" +#include <ostream> + class SndCurveDumper : AbstractTextDumper { static constexpr auto DEFAULT_PRECISION = 4; diff --git a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperGfxImage.cpp b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperGfxImage.cpp index 2fc3b4704..f86ffe609 100644 --- a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperGfxImage.cpp +++ b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperGfxImage.cpp @@ -1,10 +1,10 @@ #include "AssetDumperGfxImage.h" -#include <cassert> - -#include "ObjWriting.h" -#include "Image/IwiWriter6.h" #include "Image/DdsWriter.h" +#include "Image/IwiWriter6.h" +#include "ObjWriting.h" + +#include <cassert> using namespace IW3; diff --git a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperGfxImage.h b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperGfxImage.h index 0c42f400b..d5a2792f0 100644 --- a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperGfxImage.h +++ b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperGfxImage.h @@ -1,11 +1,11 @@ #pragma once -#include <memory> - #include "Dumping/AbstractAssetDumper.h" #include "Game/IW3/IW3.h" #include "Image/IImageWriter.h" +#include <memory> + namespace IW3 { class AssetDumperGfxImage final : public AbstractAssetDumper<GfxImage> @@ -21,4 +21,4 @@ namespace IW3 public: AssetDumperGfxImage(); }; -} +} // namespace IW3 diff --git a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperLoadedSound.cpp b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperLoadedSound.cpp index 52c00d832..29a9a2941 100644 --- a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperLoadedSound.cpp +++ b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperLoadedSound.cpp @@ -11,41 +11,25 @@ bool AssetDumperLoadedSound::ShouldDump(XAssetInfo<LoadedSound>* asset) void AssetDumperLoadedSound::DumpWavPcm(AssetDumpingContext& context, 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)); - const WavChunkHeader formatChunkHeader - { - WAV_CHUNK_ID_FMT, - sizeof(WavFormatChunkPcm) - }; + const WavChunkHeader formatChunkHeader{WAV_CHUNK_ID_FMT, sizeof(WavFormatChunkPcm)}; stream.write(reinterpret_cast<const char*>(&formatChunkHeader), sizeof(formatChunkHeader)); - WavFormatChunkPcm formatChunk - { - WavFormat::PCM, - static_cast<uint16_t>(asset->sound.info.channels), - asset->sound.info.rate, - asset->sound.info.rate * asset->sound.info.channels * asset->sound.info.bits / 8, - static_cast<uint16_t>(asset->sound.info.block_size), - static_cast<uint16_t>(asset->sound.info.bits) - }; + WavFormatChunkPcm formatChunk{WavFormat::PCM, + static_cast<uint16_t>(asset->sound.info.channels), + asset->sound.info.rate, + asset->sound.info.rate * asset->sound.info.channels * asset->sound.info.bits / 8, + 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)); - const WavChunkHeader dataChunkHeader - { - WAV_CHUNK_ID_DATA, - asset->sound.info.data_len - }; + const WavChunkHeader dataChunkHeader{WAV_CHUNK_ID_DATA, asset->sound.info.data_len}; stream.write(reinterpret_cast<const char*>(&dataChunkHeader), sizeof(dataChunkHeader)); stream.write(asset->sound.data, asset->sound.info.data_len); } diff --git a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperLoadedSound.h b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperLoadedSound.h index 91ed3f7ef..f4be599e0 100644 --- a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperLoadedSound.h +++ b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperLoadedSound.h @@ -13,4 +13,4 @@ namespace IW3 bool ShouldDump(XAssetInfo<LoadedSound>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<LoadedSound>* asset) override; }; -} +} // namespace IW3 diff --git a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperLocalizeEntry.cpp b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperLocalizeEntry.cpp index 8c1b8e08e..d56accd10 100644 --- a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperLocalizeEntry.cpp +++ b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperLocalizeEntry.cpp @@ -1,9 +1,9 @@ #include "AssetDumperLocalizeEntry.h" -#include <sstream> - -#include "Localize/LocalizeCommon.h" #include "Dumping/Localize/StringFileDumper.h" +#include "Localize/LocalizeCommon.h" + +#include <sstream> using namespace IW3; @@ -40,4 +40,4 @@ void AssetDumperLocalizeEntry::DumpPool(AssetDumpingContext& context, AssetPool< { printf("Could not create string file for dumping localized strings of zone '%s'\n", context.m_zone->m_name.c_str()); } -} \ No newline at end of file +} diff --git a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperLocalizeEntry.h b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperLocalizeEntry.h index fdb1c2739..02d189550 100644 --- a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperLocalizeEntry.h +++ b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperLocalizeEntry.h @@ -10,4 +10,4 @@ namespace IW3 public: void DumpPool(AssetDumpingContext& context, AssetPool<LocalizeEntry>* pool) override; }; -} +} // namespace IW3 diff --git a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperMapEnts.h b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperMapEnts.h index 36da6a8e6..c769bec06 100644 --- a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperMapEnts.h +++ b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperMapEnts.h @@ -11,4 +11,4 @@ namespace IW3 bool ShouldDump(XAssetInfo<MapEnts>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<MapEnts>* asset) override; }; -} +} // namespace IW3 diff --git a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperMaterial.cpp b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperMaterial.cpp index 006133f1a..f1314d065 100644 --- a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperMaterial.cpp +++ b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperMaterial.cpp @@ -1,13 +1,13 @@ #include "AssetDumperMaterial.h" -#include <iomanip> -#include <sstream> -#include <nlohmann/json.hpp> - #include "Game/IW3/MaterialConstantsIW3.h" #include "Game/IW3/TechsetConstantsIW3.h" -//#define FLAGS_DEBUG 1 +#include <iomanip> +#include <nlohmann/json.hpp> +#include <sstream> + +// #define FLAGS_DEBUG 1 using namespace IW3; using json = nlohmann::json; @@ -21,8 +21,7 @@ namespace IW3 return name; } - template <size_t S> - json ArrayEntry(const char* (&a)[S], const size_t index) + template<size_t S> json ArrayEntry(const char* (&a)[S], const size_t index) { assert(index < S); if (index < S) @@ -73,20 +72,8 @@ namespace IW3 json BuildSamplerStateJson(unsigned char samplerState) { - static const char* samplerFilterNames[] - { - "none", - "nearest", - "linear", - "aniso2x", - "aniso4x" - }; - static const char* samplerMipmapNames[] - { - "disabled", - "nearest", - "linear" - }; + static const char* samplerFilterNames[]{"none", "nearest", "linear", "aniso2x", "aniso4x"}; + static const char* samplerMipmapNames[]{"disabled", "nearest", "linear"}; return json{ {"filter", ArrayEntry(samplerFilterNames, (samplerState & SAMPLER_FILTER_MASK) >> SAMPLER_FILTER_SHIFT)}, @@ -99,21 +86,8 @@ namespace IW3 json BuildTextureTableJson(const MaterialTextureDef* textureTable, const size_t count) { - static const char* semanticNames[] - { - "2d", - "function", - "colorMap", - "unused1", - "unused2", - "normalMap", - "unused3", - "unused4", - "specularMap", - "unused5", - "unused6", - "waterMap" - }; + static const char* semanticNames[]{ + "2d", "function", "colorMap", "unused1", "unused2", "normalMap", "unused3", "unused4", "specularMap", "unused5", "unused6", "waterMap"}; auto jArray = json::array(); @@ -136,9 +110,9 @@ namespace IW3 else { jEntry.merge_patch({ - {"nameHash", entry.nameHash}, + {"nameHash", entry.nameHash }, {"nameStart", entry.nameStart}, - {"nameEnd", entry.nameEnd}, + {"nameEnd", entry.nameEnd }, }); } @@ -211,8 +185,7 @@ namespace IW3 json BuildStateBitsTableJson(const GfxStateBits* stateBitsTable, const size_t count) { - static const char* blendNames[] - { + static const char* blendNames[]{ "disabled", "zero", "one", @@ -225,40 +198,20 @@ namespace IW3 "destColor", "invDestColor", }; - static const char* blendOpNames[] - { - "disabled", - "add", - "subtract", - "revSubtract", - "min", - "max" - }; - static const char* depthTestNames[] - { + static const char* blendOpNames[]{"disabled", "add", "subtract", "revSubtract", "min", "max"}; + static const char* depthTestNames[]{ "always", "less", "equal", "lessEqual", }; - static const char* polygonOffsetNames[] - { + static const char* polygonOffsetNames[]{ "0", "1", "2", "shadowMap", }; - static const char* stencilOpNames[] - { - "keep", - "zero", - "replace", - "incrSat", - "decrSat", - "invert", - "incr", - "decr" - }; + static const char* stencilOpNames[]{"keep", "zero", "replace", "incrSat", "decrSat", "invert", "incr", "decr"}; auto jArray = json::array(); @@ -333,7 +286,8 @@ namespace IW3 if (!surfaceTypeBits) return json(surfaceTypeNames[SURF_TYPE_DEFAULT]); - static constexpr auto NON_SURFACE_TYPE_BITS = ~(std::numeric_limits<unsigned>::max() >> ((sizeof(unsigned) * 8) - (static_cast<unsigned>(SURF_TYPE_NUM) - 1))); + static constexpr auto NON_SURFACE_TYPE_BITS = + ~(std::numeric_limits<unsigned>::max() >> ((sizeof(unsigned) * 8) - (static_cast<unsigned>(SURF_TYPE_NUM) - 1))); assert((surfaceTypeBits & NON_SURFACE_TYPE_BITS) == 0); std::ostringstream ss; @@ -372,7 +326,7 @@ namespace IW3 return json(values); } -} +} // namespace IW3 bool AssetDumperMaterial::ShouldDump(XAssetInfo<Material>* asset) { @@ -392,84 +346,72 @@ void AssetDumperMaterial::DumpAsset(AssetDumpingContext& context, XAssetInfo<Mat auto& stream = *assetFile; - static const char* cameraRegionNames[] - { - "lit", - "decal", - "emissive", - "none" - }; - static std::unordered_map<size_t, std::string> sortKeyNames - { - {0, "distortion"}, - {1, "opaque water"}, - {2, "boat hull"}, - {3, "opaque ambient"}, - {4, "opaque"}, - {5, "sky"}, - {6, "skybox - sun / moon"}, - {7, "skybox - clouds"}, - {8, "skybox - horizon"}, - {9, "decal - bottom 1"}, - {10, "decal - bottom 2"}, - {11, "decal - bottom 3"}, - {12, "decal - static decal"}, - {13, "decal - middle 1"}, - {14, "decal - middle 2"}, - {15, "decal - middle 3"}, - {24, "decal - weapon impact"}, - {29, "decal - top 1"}, - {30, "decal - top 2"}, - {31, "decal - top 3"}, - {32, "multiplicative"}, - {33, "banner / curtain"}, - {34, "hair"}, - {35, "underwater"}, - {36, "transparent water"}, - {37, "corona"}, - {38, "window inside"}, - {39, "window outside"}, + static const char* cameraRegionNames[]{"lit", "decal", "emissive", "none"}; + static std::unordered_map<size_t, std::string> sortKeyNames{ + {0, "distortion" }, + {1, "opaque water" }, + {2, "boat hull" }, + {3, "opaque ambient" }, + {4, "opaque" }, + {5, "sky" }, + {6, "skybox - sun / moon" }, + {7, "skybox - clouds" }, + {8, "skybox - horizon" }, + {9, "decal - bottom 1" }, + {10, "decal - bottom 2" }, + {11, "decal - bottom 3" }, + {12, "decal - static decal" }, + {13, "decal - middle 1" }, + {14, "decal - middle 2" }, + {15, "decal - middle 3" }, + {24, "decal - weapon impact" }, + {29, "decal - top 1" }, + {30, "decal - top 2" }, + {31, "decal - top 3" }, + {32, "multiplicative" }, + {33, "banner / curtain" }, + {34, "hair" }, + {35, "underwater" }, + {36, "transparent water" }, + {37, "corona" }, + {38, "window inside" }, + {39, "window outside" }, {40, "before effects - bottom"}, {41, "before effects - middle"}, - {42, "before effects - top"}, - {43, "blend / additive"}, - {48, "effect - auto sort"}, - {56, "after effects - bottom"}, - {57, "after effects - middle"}, - {58, "after effects - top"}, - {59, "viewmodel effect"}, + {42, "before effects - top" }, + {43, "blend / additive" }, + {48, "effect - auto sort" }, + {56, "after effects - bottom" }, + {57, "after effects - middle" }, + {58, "after effects - top" }, + {59, "viewmodel effect" }, }; const auto foundSortKeyName = sortKeyNames.find(material->info.sortKey); assert(foundSortKeyName != sortKeyNames.end()); const json j = { - { - "info", { + {"info", + { #if defined(FLAGS_DEBUG) && FLAGS_DEBUG == 1 - {"gameFlags", BuildCharFlagsJson("gameFlag", material->info.gameFlags)}, // TODO: Find out what gameflags mean + {"gameFlags", BuildCharFlagsJson("gameFlag", material->info.gameFlags)}, // TODO: Find out what gameflags mean #else - {"gameFlags", material->info.gameFlags}, // TODO: Find out what gameflags mean + {"gameFlags", material->info.gameFlags}, // TODO: Find out what gameflags mean #endif - {"sortKey", foundSortKeyName != sortKeyNames.end() ? foundSortKeyName->second : std::to_string(material->info.sortKey)}, - {"textureAtlasRowCount", material->info.textureAtlasRowCount}, - {"textureAtlasColumnCount", material->info.textureAtlasColumnCount}, - { - "drawSurf", { - {"objectId", static_cast<unsigned>(material->info.drawSurf.fields.objectId)}, - {"reflectionProbeIndex", static_cast<unsigned>(material->info.drawSurf.fields.reflectionProbeIndex)}, - {"customIndex", static_cast<unsigned>(material->info.drawSurf.fields.customIndex)}, - {"materialSortedIndex", static_cast<unsigned>(material->info.drawSurf.fields.materialSortedIndex)}, - {"prepass", static_cast<unsigned>(material->info.drawSurf.fields.prepass)}, - {"useHeroLighting", static_cast<unsigned>(material->info.drawSurf.fields.primaryLightIndex)}, - {"surfType", static_cast<unsigned>(material->info.drawSurf.fields.surfType)}, - {"primarySortKey", static_cast<unsigned>(material->info.drawSurf.fields.primarySortKey)} - } - }, - {"surfaceTypeBits", BuildSurfaceTypeBitsJson(material->info.surfaceTypeBits)}, - {"hashIndex", material->info.hashIndex} - } - }, + {"sortKey", foundSortKeyName != sortKeyNames.end() ? foundSortKeyName->second : std::to_string(material->info.sortKey)}, + {"textureAtlasRowCount", material->info.textureAtlasRowCount}, + {"textureAtlasColumnCount", material->info.textureAtlasColumnCount}, + {"drawSurf", + {{"objectId", static_cast<unsigned>(material->info.drawSurf.fields.objectId)}, + {"reflectionProbeIndex", static_cast<unsigned>(material->info.drawSurf.fields.reflectionProbeIndex)}, + {"customIndex", static_cast<unsigned>(material->info.drawSurf.fields.customIndex)}, + {"materialSortedIndex", static_cast<unsigned>(material->info.drawSurf.fields.materialSortedIndex)}, + {"prepass", static_cast<unsigned>(material->info.drawSurf.fields.prepass)}, + {"useHeroLighting", static_cast<unsigned>(material->info.drawSurf.fields.primaryLightIndex)}, + {"surfType", static_cast<unsigned>(material->info.drawSurf.fields.surfType)}, + {"primarySortKey", static_cast<unsigned>(material->info.drawSurf.fields.primarySortKey)}}}, + {"surfaceTypeBits", BuildSurfaceTypeBitsJson(material->info.surfaceTypeBits)}, + {"hashIndex", material->info.hashIndex}}}, {"stateBitsEntry", std::vector(std::begin(material->stateBitsEntry), std::end(material->stateBitsEntry))}, #if defined(FLAGS_DEBUG) && FLAGS_DEBUG == 1 {"stateFlags", BuildCharFlagsJson("stateFlag", material->stateFlags)}, diff --git a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperMaterial.h b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperMaterial.h index 94f9e54d2..09933cf40 100644 --- a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperMaterial.h +++ b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperMaterial.h @@ -11,4 +11,4 @@ namespace IW3 bool ShouldDump(XAssetInfo<Material>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<Material>* asset) override; }; -} +} // namespace IW3 diff --git a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperRawFile.h b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperRawFile.h index 7c79a4235..abeeda269 100644 --- a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperRawFile.h +++ b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperRawFile.h @@ -11,4 +11,4 @@ namespace IW3 bool ShouldDump(XAssetInfo<RawFile>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<RawFile>* asset) override; }; -} +} // namespace IW3 diff --git a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperStringTable.h b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperStringTable.h index d4cb92991..915f4a40f 100644 --- a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperStringTable.h +++ b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperStringTable.h @@ -11,4 +11,4 @@ namespace IW3 bool ShouldDump(XAssetInfo<StringTable>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<StringTable>* asset) override; }; -} +} // namespace IW3 diff --git a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperXModel.cpp b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperXModel.cpp index 68977d75c..45d031fd1 100644 --- a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperXModel.cpp +++ b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperXModel.cpp @@ -1,15 +1,15 @@ #include "AssetDumperXModel.h" -#include <cassert> -#include <sstream> - -#include "ObjWriting.h" #include "Game/IW3/CommonIW3.h" #include "Math/Quaternion.h" #include "Model/XModel/XModelExportWriter.h" +#include "ObjWriting.h" #include "Utils/HalfFloat.h" #include "Utils/QuatInt16.h" +#include <cassert> +#include <sstream> + using namespace IW3; bool AssetDumperXModel::ShouldDump(XAssetInfo<XModel>* asset) @@ -273,7 +273,8 @@ void AssetDumperXModel::AddXModelBones(const AssetDumpingContext& context, Abstr bone.globalOffset[0] = model->baseMat[boneNum].trans[0]; bone.globalOffset[1] = model->baseMat[boneNum].trans[1]; bone.globalOffset[2] = model->baseMat[boneNum].trans[2]; - bone.globalRotation = Quaternion32(model->baseMat[boneNum].quat[0], model->baseMat[boneNum].quat[1], model->baseMat[boneNum].quat[2], model->baseMat[boneNum].quat[3]); + bone.globalRotation = + Quaternion32(model->baseMat[boneNum].quat[0], model->baseMat[boneNum].quat[1], model->baseMat[boneNum].quat[2], model->baseMat[boneNum].quat[3]); if (boneNum < model->numRootBones) { @@ -287,12 +288,10 @@ void AssetDumperXModel::AddXModelBones(const AssetDumpingContext& context, Abstr bone.localOffset[0] = model->trans[boneNum - model->numRootBones][0]; bone.localOffset[1] = model->trans[boneNum - model->numRootBones][1]; bone.localOffset[2] = model->trans[boneNum - model->numRootBones][2]; - bone.localRotation = Quaternion32( - QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][0]), - QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][1]), - QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][2]), - QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][3]) - ); + bone.localRotation = Quaternion32(QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][0]), + QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][1]), + QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][2]), + QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][3])); } writer.AddBone(std::move(bone)); @@ -398,7 +397,10 @@ void AssetDumperXModel::AllocateXModelBoneWeights(const XModel* model, const uns weightCollection.weights = std::make_unique<XModelBoneWeight[]>(weightCollection.totalWeightCount); } -void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const XModel* model, const unsigned lod, XModelVertexBoneWeightCollection& weightCollection) +void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, + const XModel* model, + const unsigned lod, + XModelVertexBoneWeightCollection& weightCollection) { const auto* surfs = &model->surfs[model->lodInfo[lod].surfIndex]; const auto surfCount = model->lodInfo[lod].numsurfs; @@ -417,17 +419,11 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const auto& vertList = surface.vertList[vertListIndex]; const auto* boneWeightOffset = &weightCollection.weights[weightOffset]; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - static_cast<int>(vertList.boneOffset / sizeof(DObjSkelMat)), - 1.0f - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{static_cast<int>(vertList.boneOffset / sizeof(DObjSkelMat)), 1.0f}; for (auto vertListVertexOffset = 0u; vertListVertexOffset < vertList.vertCount; vertListVertexOffset++) { - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 1 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 1}); } handledVertices += vertList.vertCount; } @@ -441,17 +437,11 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, { const auto* boneWeightOffset = &weightCollection.weights[weightOffset]; const auto boneIndex0 = static_cast<int>(surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat)); - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex0, - 1.0f - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, 1.0f}; vertsBlendOffset += 1; - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 1 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 1}); } // 2 bone weights @@ -463,21 +453,12 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const auto boneWeight1 = HalfFloat::ToFloat(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]); const auto boneWeight0 = 1.0f - boneWeight1; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex0, - boneWeight0 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex1, - boneWeight1 - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, boneWeight0}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex1, boneWeight1}; vertsBlendOffset += 3; - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 2 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 2}); } // 3 bone weights @@ -491,25 +472,13 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const auto boneWeight2 = HalfFloat::ToFloat(surface.vertInfo.vertsBlend[vertsBlendOffset + 4]); const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex0, - boneWeight0 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex1, - boneWeight1 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex2, - boneWeight2 - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, boneWeight0}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex1, boneWeight1}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex2, boneWeight2}; vertsBlendOffset += 5; - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 3 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 3}); } // 4 bone weights @@ -525,29 +494,14 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const auto boneWeight3 = HalfFloat::ToFloat(surface.vertInfo.vertsBlend[vertsBlendOffset + 6]); const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2 - boneWeight3; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex0, - boneWeight0 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex1, - boneWeight1 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex2, - boneWeight2 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex3, - boneWeight3 - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, boneWeight0}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex1, boneWeight1}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex2, boneWeight2}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex3, boneWeight3}; vertsBlendOffset += 7; - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 4 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 4}); } handledVertices += surface.vertInfo.vertCount[0] + surface.vertInfo.vertCount[1] + surface.vertInfo.vertCount[2] + surface.vertInfo.vertCount[3]; @@ -555,10 +509,7 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, for (; handledVertices < surface.vertCount; handledVertices++) { - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - nullptr, - 0 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{nullptr, 0}); } } } diff --git a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperXModel.h b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperXModel.h index 5c57f42a1..665693861 100644 --- a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperXModel.h +++ b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperXModel.h @@ -2,9 +2,9 @@ #include "Dumping/AbstractAssetDumper.h" #include "Game/IW3/IW3.h" -#include "Utils/DistinctMapper.h" -#include "Model/XModel/AbstractXModelWriter.h" #include "Model/Obj/ObjWriter.h" +#include "Model/XModel/AbstractXModelWriter.h" +#include "Utils/DistinctMapper.h" namespace IW3 { @@ -27,7 +27,8 @@ namespace IW3 static void AddXModelObjects(AbstractXModelWriter& writer, const XModel* model, unsigned lod); static void AddXModelVertices(AbstractXModelWriter& writer, const XModel* model, unsigned lod); static void AllocateXModelBoneWeights(const XModel* model, unsigned lod, XModelVertexBoneWeightCollection& weightCollection); - static void AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const XModel* model, unsigned lod, XModelVertexBoneWeightCollection& weightCollection); + static void + AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const XModel* model, unsigned lod, XModelVertexBoneWeightCollection& weightCollection); static void AddXModelFaces(AbstractXModelWriter& writer, const DistinctMapper<Material*>& materialMapper, const XModel* model, unsigned lod); static void DumpXModelExportLod(const AssetDumpingContext& context, XAssetInfo<XModel>* asset, unsigned lod); static void DumpXModelExport(const AssetDumpingContext& context, XAssetInfo<XModel>* asset); @@ -36,4 +37,4 @@ namespace IW3 bool ShouldDump(XAssetInfo<XModel>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<XModel>* asset) override; }; -} +} // namespace IW3 diff --git a/src/ObjWriting/Game/IW3/ZoneDumperIW3.cpp b/src/ObjWriting/Game/IW3/ZoneDumperIW3.cpp index a01e839ec..9424d8cef 100644 --- a/src/ObjWriting/Game/IW3/ZoneDumperIW3.cpp +++ b/src/ObjWriting/Game/IW3/ZoneDumperIW3.cpp @@ -1,9 +1,5 @@ #include "ZoneDumperIW3.h" -#include "ObjWriting.h" -#include "Game/IW3/GameIW3.h" -#include "Game/IW3/GameAssetPoolIW3.h" - #include "AssetDumpers/AssetDumperGfxImage.h" #include "AssetDumpers/AssetDumperLoadedSound.h" #include "AssetDumpers/AssetDumperLocalizeEntry.h" @@ -13,6 +9,9 @@ #include "AssetDumpers/AssetDumperStringTable.h" #include "AssetDumpers/AssetDumperWeapon.h" #include "AssetDumpers/AssetDumperXModel.h" +#include "Game/IW3/GameAssetPoolIW3.h" +#include "Game/IW3/GameIW3.h" +#include "ObjWriting.h" using namespace IW3; @@ -23,11 +22,11 @@ bool ZoneDumper::CanHandleZone(AssetDumpingContext& context) const bool ZoneDumper::DumpZone(AssetDumpingContext& context) const { -#define DUMP_ASSET_POOL(dumperType, poolName, assetType) \ - if(assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \ - { \ - dumperType dumper; \ - dumper.DumpPool(context, assetPools->poolName.get()); \ +#define DUMP_ASSET_POOL(dumperType, poolName, assetType) \ + if (assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \ + { \ + dumperType dumper; \ + dumper.DumpPool(context, assetPools->poolName.get()); \ } const auto* assetPools = dynamic_cast<GameAssetPoolIW3*>(context.m_zone->m_pools.get()); diff --git a/src/ObjWriting/Game/IW3/ZoneDumperIW3.h b/src/ObjWriting/Game/IW3/ZoneDumperIW3.h index 4de44f6b7..4e0aa6f3c 100644 --- a/src/ObjWriting/Game/IW3/ZoneDumperIW3.h +++ b/src/ObjWriting/Game/IW3/ZoneDumperIW3.h @@ -9,4 +9,4 @@ namespace IW3 bool CanHandleZone(AssetDumpingContext& context) const override; bool DumpZone(AssetDumpingContext& context) const override; }; -} +} // namespace IW3 diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperAddonMapEnts.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperAddonMapEnts.h index 94da070ea..8a5ad601f 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperAddonMapEnts.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperAddonMapEnts.h @@ -11,4 +11,4 @@ namespace IW4 bool ShouldDump(XAssetInfo<AddonMapEnts>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<AddonMapEnts>* asset) override; }; -} +} // namespace IW4 diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperGfxImage.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperGfxImage.cpp index 916eaca26..93eebcb2d 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperGfxImage.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperGfxImage.cpp @@ -1,10 +1,10 @@ #include "AssetDumperGfxImage.h" -#include <cassert> - -#include "ObjWriting.h" -#include "Image/IwiWriter8.h" #include "Image/DdsWriter.h" +#include "Image/IwiWriter8.h" +#include "ObjWriting.h" + +#include <cassert> using namespace IW4; diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperGfxImage.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperGfxImage.h index 5d04301df..4f3cf9d52 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperGfxImage.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperGfxImage.h @@ -1,11 +1,11 @@ #pragma once -#include <memory> - #include "Dumping/AbstractAssetDumper.h" #include "Game/IW4/IW4.h" #include "Image/IImageWriter.h" +#include <memory> + namespace IW4 { class AssetDumperGfxImage final : public AbstractAssetDumper<GfxImage> @@ -21,4 +21,4 @@ namespace IW4 public: AssetDumperGfxImage(); }; -} +} // namespace IW4 diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperGfxLightDef.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperGfxLightDef.h index 9ac707518..275712ef9 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperGfxLightDef.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperGfxLightDef.h @@ -13,4 +13,4 @@ namespace IW4 bool ShouldDump(XAssetInfo<GfxLightDef>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<GfxLightDef>* asset) override; }; -} +} // namespace IW4 diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLoadedSound.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLoadedSound.cpp index 66ab28e3d..3e65ea6a4 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLoadedSound.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLoadedSound.cpp @@ -15,10 +15,7 @@ void AssetDumperLoadedSound::DumpWavPcm(AssetDumpingContext& context, const Load const WavWriter writer(stream); const WavMetaData metaData{ - static_cast<unsigned>(asset->sound.info.channels), - static_cast<unsigned>(asset->sound.info.rate), - static_cast<unsigned>(asset->sound.info.bits) - }; + static_cast<unsigned>(asset->sound.info.channels), static_cast<unsigned>(asset->sound.info.rate), static_cast<unsigned>(asset->sound.info.bits)}; writer.WritePcmHeader(metaData, asset->sound.info.data_len); writer.WritePcmData(asset->sound.data, asset->sound.info.data_len); diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLoadedSound.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLoadedSound.h index 915d54022..f3b3b4864 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLoadedSound.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLoadedSound.h @@ -8,8 +8,9 @@ namespace IW4 class AssetDumperLoadedSound final : public AbstractAssetDumper<LoadedSound> { static void DumpWavPcm(AssetDumpingContext& context, const LoadedSound* asset, std::ostream& stream); + protected: bool ShouldDump(XAssetInfo<LoadedSound>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<LoadedSound>* asset) override; }; -} +} // namespace IW4 diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLocalizeEntry.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLocalizeEntry.cpp index 4e4f4c180..33a682d42 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLocalizeEntry.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLocalizeEntry.cpp @@ -1,9 +1,9 @@ #include "AssetDumperLocalizeEntry.h" -#include <sstream> - -#include "Localize/LocalizeCommon.h" #include "Dumping/Localize/StringFileDumper.h" +#include "Localize/LocalizeCommon.h" + +#include <sstream> using namespace IW4; @@ -40,4 +40,4 @@ void AssetDumperLocalizeEntry::DumpPool(AssetDumpingContext& context, AssetPool< { printf("Could not create string file for dumping localized strings of zone '%s'\n", context.m_zone->m_name.c_str()); } -} \ No newline at end of file +} diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLocalizeEntry.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLocalizeEntry.h index 69641d33e..cc1e07f22 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLocalizeEntry.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperLocalizeEntry.h @@ -10,4 +10,4 @@ namespace IW4 public: void DumpPool(AssetDumpingContext& context, AssetPool<LocalizeEntry>* pool) override; }; -} +} // namespace IW4 diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMaterial.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMaterial.cpp index 616c35799..8281590db 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMaterial.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMaterial.cpp @@ -1,21 +1,21 @@ #include "AssetDumperMaterial.h" +#include "Game/IW4/MaterialConstantsIW4.h" +#include "Game/IW4/ObjConstantsIW4.h" +#include "Game/IW4/TechsetConstantsIW4.h" +#include "Math/Vector.h" +#include "Utils/ClassUtils.h" + #include <iomanip> +#include <nlohmann/json.hpp> #include <sstream> #include <string> #include <type_traits> #include <vector> -#include <nlohmann/json.hpp> - -#include "Utils/ClassUtils.h" -#include "Game/IW4/MaterialConstantsIW4.h" -#include "Game/IW4/ObjConstantsIW4.h" -#include "Game/IW4/TechsetConstantsIW4.h" -#include "Math/Vector.h" #define DUMP_AS_JSON 1 -//#define DUMP_AS_GDT 1 -//#define FLAGS_DEBUG 1 +// #define DUMP_AS_GDT 1 +// #define FLAGS_DEBUG 1 using namespace IW4; using json = nlohmann::json; @@ -30,8 +30,7 @@ namespace IW4 return name; } - template <size_t S> - json ArrayEntry(const char* (&a)[S], const size_t index) + template<size_t S> json ArrayEntry(const char* (&a)[S], const size_t index) { assert(index < S); if (index < S) @@ -82,20 +81,8 @@ namespace IW4 json BuildSamplerStateJson(unsigned char samplerState) { - static const char* samplerFilterNames[] - { - "none", - "nearest", - "linear", - "aniso2x", - "aniso4x" - }; - static const char* samplerMipmapNames[] - { - "disabled", - "nearest", - "linear" - }; + static const char* samplerFilterNames[]{"none", "nearest", "linear", "aniso2x", "aniso4x"}; + static const char* samplerMipmapNames[]{"disabled", "nearest", "linear"}; return json{ {"filter", ArrayEntry(samplerFilterNames, (samplerState & SAMPLER_FILTER_MASK) >> SAMPLER_FILTER_SHIFT)}, @@ -108,21 +95,8 @@ namespace IW4 json BuildTextureTableJson(MaterialTextureDef* textureTable, const size_t count) { - static const char* semanticNames[] - { - "2d", - "function", - "colorMap", - "detailMap", - "unused2", - "normalMap", - "unused3", - "unused4", - "specularMap", - "unused5", - "unused6", - "waterMap" - }; + static const char* semanticNames[]{ + "2d", "function", "colorMap", "detailMap", "unused2", "normalMap", "unused3", "unused4", "specularMap", "unused5", "unused6", "waterMap"}; auto jArray = json::array(); @@ -145,9 +119,9 @@ namespace IW4 else { jEntry.merge_patch({ - {"nameHash", entry.nameHash}, + {"nameHash", entry.nameHash }, {"nameStart", entry.nameStart}, - {"nameEnd", entry.nameEnd}, + {"nameEnd", entry.nameEnd }, }); } @@ -220,8 +194,7 @@ namespace IW4 json BuildStateBitsTableJson(const GfxStateBits* stateBitsTable, const size_t count) { - static const char* blendNames[] - { + static const char* blendNames[]{ "disabled", "zero", "one", @@ -234,51 +207,21 @@ namespace IW4 "destColor", "invDestColor", }; - static const char* blendOpNames[] - { - "disabled", - "add", - "subtract", - "revSubtract", - "min", - "max" - }; - static const char* depthTestNames[] - { + static const char* blendOpNames[]{"disabled", "add", "subtract", "revSubtract", "min", "max"}; + static const char* depthTestNames[]{ "always", "less", "equal", "lessEqual", }; - static const char* polygonOffsetNames[] - { + static const char* polygonOffsetNames[]{ "0", "1", "2", "shadowMap", }; - static const char* stencilOpNames[] - { - "keep", - "zero", - "replace", - "incrSat", - "decrSat", - "invert", - "incr", - "decr" - }; - static const char* stencilFuncNames[] - { - "never", - "less", - "equal", - "lessEqual", - "greater", - "notEqual", - "greaterEqual", - "always" - }; + static const char* stencilOpNames[]{"keep", "zero", "replace", "incrSat", "decrSat", "invert", "incr", "decr"}; + static const char* stencilFuncNames[]{"never", "less", "equal", "lessEqual", "greater", "notEqual", "greaterEqual", "always"}; auto jArray = json::array(); @@ -371,7 +314,8 @@ namespace IW4 if (!surfaceTypeBits) return "<none>"; - static constexpr auto NON_SURFACE_TYPE_BITS = ~(std::numeric_limits<unsigned>::max() >> ((sizeof(unsigned) * 8) - (static_cast<unsigned>(SURF_TYPE_NUM) - 1))); + static constexpr auto NON_SURFACE_TYPE_BITS = + ~(std::numeric_limits<unsigned>::max() >> ((sizeof(unsigned) * 8) - (static_cast<unsigned>(SURF_TYPE_NUM) - 1))); assert((surfaceTypeBits & NON_SURFACE_TYPE_BITS) == 0); std::ostringstream ss; @@ -396,44 +340,32 @@ namespace IW4 void DumpMaterialAsJson(Material* material, std::ostream& stream) { - static const char* cameraRegionNames[] - { - "litOpaque", - "litTrans", - "emissive", - "depthHack", - "none" - }; + static const char* cameraRegionNames[]{"litOpaque", "litTrans", "emissive", "depthHack", "none"}; const json j = { - { - "info", { + {"info", + { #if defined(FLAGS_DEBUG) && FLAGS_DEBUG == 1 - {"gameFlags", BuildCharFlagsJson("gameFlag", material->info.gameFlags)}, // TODO: Find out what gameflags mean + {"gameFlags", BuildCharFlagsJson("gameFlag", material->info.gameFlags)}, // TODO: Find out what gameflags mean #else - {"gameFlags", material->info.gameFlags}, // TODO: Find out what gameflags mean + {"gameFlags", material->info.gameFlags}, // TODO: Find out what gameflags mean #endif - {"sortKey", material->info.sortKey}, - {"textureAtlasRowCount", material->info.textureAtlasRowCount}, - {"textureAtlasColumnCount", material->info.textureAtlasColumnCount}, - { - "drawSurf", { - {"objectId", static_cast<unsigned>(material->info.drawSurf.fields.objectId)}, - {"reflectionProbeIndex", static_cast<unsigned>(material->info.drawSurf.fields.reflectionProbeIndex)}, - {"hasGfxEntIndex", static_cast<unsigned>(material->info.drawSurf.fields.hasGfxEntIndex)}, - {"customIndex", static_cast<unsigned>(material->info.drawSurf.fields.customIndex)}, - {"materialSortedIndex", static_cast<unsigned>(material->info.drawSurf.fields.materialSortedIndex)}, - {"prepass", static_cast<unsigned>(material->info.drawSurf.fields.prepass)}, - {"useHeroLighting", static_cast<unsigned>(material->info.drawSurf.fields.useHeroLighting)}, - {"sceneLightIndex", static_cast<unsigned>(material->info.drawSurf.fields.sceneLightIndex)}, - {"surfType", static_cast<unsigned>(material->info.drawSurf.fields.surfType)}, - {"primarySortKey", static_cast<unsigned>(material->info.drawSurf.fields.primarySortKey)} - } - }, - {"surfaceTypeBits", CreateSurfaceTypeString(material->info.surfaceTypeBits)}, - {"hashIndex", material->info.hashIndex} - } - }, + {"sortKey", material->info.sortKey}, + {"textureAtlasRowCount", material->info.textureAtlasRowCount}, + {"textureAtlasColumnCount", material->info.textureAtlasColumnCount}, + {"drawSurf", + {{"objectId", static_cast<unsigned>(material->info.drawSurf.fields.objectId)}, + {"reflectionProbeIndex", static_cast<unsigned>(material->info.drawSurf.fields.reflectionProbeIndex)}, + {"hasGfxEntIndex", static_cast<unsigned>(material->info.drawSurf.fields.hasGfxEntIndex)}, + {"customIndex", static_cast<unsigned>(material->info.drawSurf.fields.customIndex)}, + {"materialSortedIndex", static_cast<unsigned>(material->info.drawSurf.fields.materialSortedIndex)}, + {"prepass", static_cast<unsigned>(material->info.drawSurf.fields.prepass)}, + {"useHeroLighting", static_cast<unsigned>(material->info.drawSurf.fields.useHeroLighting)}, + {"sceneLightIndex", static_cast<unsigned>(material->info.drawSurf.fields.sceneLightIndex)}, + {"surfType", static_cast<unsigned>(material->info.drawSurf.fields.surfType)}, + {"primarySortKey", static_cast<unsigned>(material->info.drawSurf.fields.primarySortKey)}}}, + {"surfaceTypeBits", CreateSurfaceTypeString(material->info.surfaceTypeBits)}, + {"hashIndex", material->info.hashIndex}}}, {"stateBitsEntry", std::vector(std::begin(material->stateBitsEntry), std::end(material->stateBitsEntry))}, #if defined(FLAGS_DEBUG) && FLAGS_DEBUG == 1 {"stateFlags", BuildCharFlagsJson("stateFlag", material->stateFlags)}, @@ -478,7 +410,8 @@ namespace IW4 bool m_outdoor_only = false; // TODO: Find out what p0 in techset name actually means, seems like it only does stuff for techsets using a specular texture though - // TODO: Find out what o0 in techset name actually means, seems like it gives the colormap a blue/whiteish tint and is almost exclusively used on snow-related materials + // TODO: Find out what o0 in techset name actually means, seems like it gives the colormap a blue/whiteish tint and is almost exclusively used on + // snow-related materials // TODO: Find out what _lin in techset name actually means bool m_specular_p_flag = false; bool m_color_o_flag = false; @@ -576,9 +509,7 @@ namespace IW4 m_entry.m_properties.emplace(std::make_pair(key, value ? "1" : "0")); } - template <typename T, - typename = typename std::enable_if_t<std::is_arithmetic_v<T>, T>> - void SetValue(const std::string& key, T value) + template<typename T, typename = typename std::enable_if_t<std::is_arithmetic_v<T>, T>> void SetValue(const std::string& key, T value) { m_entry.m_properties.emplace(std::make_pair(key, std::to_string(value))); } @@ -679,8 +610,8 @@ namespace IW4 m_techset_info.m_uv_anim = true; else { - if (namePart != "add" && namePart != "replace" && namePart != "blend" && namePart != "eyeoffset" && namePart != "screen" && namePart != "effect" && namePart != "unlit" - && namePart != "multiply" && namePart != "sm") + if (namePart != "add" && namePart != "replace" && namePart != "blend" && namePart != "eyeoffset" && namePart != "screen" + && namePart != "effect" && namePart != "unlit" && namePart != "multiply" && namePart != "sm") { assert(false); } @@ -942,26 +873,78 @@ namespace IW4 CustomBlendFunc_e m_dst_blend_func_alpha; }; - static inline BlendFuncParameters knownBlendFuncs[] - { - // Only considering passthrough statemap - {BlendFunc_e::ADD, BlendOp_e::ADD, CustomBlendFunc_e::ONE, CustomBlendFunc_e::ONE, BlendOp_e::DISABLE, CustomBlendFunc_e::UNKNOWN, CustomBlendFunc_e::UNKNOWN}, - {BlendFunc_e::BLEND, BlendOp_e::ADD, CustomBlendFunc_e::SRC_ALPHA, CustomBlendFunc_e::INV_SRC_ALPHA, BlendOp_e::DISABLE, CustomBlendFunc_e::UNKNOWN, CustomBlendFunc_e::UNKNOWN}, - {BlendFunc_e::MULTIPLY, BlendOp_e::ADD, CustomBlendFunc_e::ZERO, CustomBlendFunc_e::SRC_COLOR, BlendOp_e::DISABLE, CustomBlendFunc_e::UNKNOWN, CustomBlendFunc_e::UNKNOWN}, - {BlendFunc_e::REPLACE, BlendOp_e::DISABLE, CustomBlendFunc_e::UNKNOWN, CustomBlendFunc_e::UNKNOWN, BlendOp_e::DISABLE, CustomBlendFunc_e::UNKNOWN, CustomBlendFunc_e::UNKNOWN}, - {BlendFunc_e::SCREEN_ADD, BlendOp_e::ADD, CustomBlendFunc_e::INV_DST_COLOR, CustomBlendFunc_e::ONE, BlendOp_e::DISABLE, CustomBlendFunc_e::UNKNOWN, CustomBlendFunc_e::UNKNOWN}, - - // TODO: Enable when using statemaps - // Considering default statemap - {BlendFunc_e::ADD, BlendOp_e::ADD, CustomBlendFunc_e::ONE, CustomBlendFunc_e::ONE, BlendOp_e::ADD, CustomBlendFunc_e::INV_DST_ALPHA, CustomBlendFunc_e::ONE}, - {BlendFunc_e::BLEND, BlendOp_e::ADD, CustomBlendFunc_e::SRC_ALPHA, CustomBlendFunc_e::INV_SRC_ALPHA, BlendOp_e::ADD, CustomBlendFunc_e::INV_DST_ALPHA, CustomBlendFunc_e::ONE}, - {BlendFunc_e::MULTIPLY, BlendOp_e::ADD, CustomBlendFunc_e::ZERO, CustomBlendFunc_e::SRC_COLOR, BlendOp_e::ADD, CustomBlendFunc_e::INV_DST_ALPHA, CustomBlendFunc_e::ONE}, - // REPLACE matches passthrough statemap - {BlendFunc_e::SCREEN_ADD, BlendOp_e::ADD, CustomBlendFunc_e::INV_DST_COLOR, CustomBlendFunc_e::ONE, BlendOp_e::ADD, CustomBlendFunc_e::INV_DST_ALPHA, CustomBlendFunc_e::ONE}, + static inline BlendFuncParameters knownBlendFuncs[]{ + // Only considering passthrough statemap + {BlendFunc_e::ADD, + BlendOp_e::ADD, + CustomBlendFunc_e::ONE, + CustomBlendFunc_e::ONE, + BlendOp_e::DISABLE, + CustomBlendFunc_e::UNKNOWN, + CustomBlendFunc_e::UNKNOWN}, + {BlendFunc_e::BLEND, + BlendOp_e::ADD, + CustomBlendFunc_e::SRC_ALPHA, + CustomBlendFunc_e::INV_SRC_ALPHA, + BlendOp_e::DISABLE, + CustomBlendFunc_e::UNKNOWN, + CustomBlendFunc_e::UNKNOWN}, + {BlendFunc_e::MULTIPLY, + BlendOp_e::ADD, + CustomBlendFunc_e::ZERO, + CustomBlendFunc_e::SRC_COLOR, + BlendOp_e::DISABLE, + CustomBlendFunc_e::UNKNOWN, + CustomBlendFunc_e::UNKNOWN}, + {BlendFunc_e::REPLACE, + BlendOp_e::DISABLE, + CustomBlendFunc_e::UNKNOWN, + CustomBlendFunc_e::UNKNOWN, + BlendOp_e::DISABLE, + CustomBlendFunc_e::UNKNOWN, + CustomBlendFunc_e::UNKNOWN}, + {BlendFunc_e::SCREEN_ADD, + BlendOp_e::ADD, + CustomBlendFunc_e::INV_DST_COLOR, + CustomBlendFunc_e::ONE, + BlendOp_e::DISABLE, + CustomBlendFunc_e::UNKNOWN, + CustomBlendFunc_e::UNKNOWN}, + + // TODO: Enable when using statemaps + // Considering default statemap + {BlendFunc_e::ADD, + BlendOp_e::ADD, + CustomBlendFunc_e::ONE, + CustomBlendFunc_e::ONE, + BlendOp_e::ADD, + CustomBlendFunc_e::INV_DST_ALPHA, + CustomBlendFunc_e::ONE }, + {BlendFunc_e::BLEND, + BlendOp_e::ADD, + CustomBlendFunc_e::SRC_ALPHA, + CustomBlendFunc_e::INV_SRC_ALPHA, + BlendOp_e::ADD, + CustomBlendFunc_e::INV_DST_ALPHA, + CustomBlendFunc_e::ONE }, + {BlendFunc_e::MULTIPLY, + BlendOp_e::ADD, + CustomBlendFunc_e::ZERO, + CustomBlendFunc_e::SRC_COLOR, + BlendOp_e::ADD, + CustomBlendFunc_e::INV_DST_ALPHA, + CustomBlendFunc_e::ONE }, + // REPLACE matches passthrough statemap + {BlendFunc_e::SCREEN_ADD, + BlendOp_e::ADD, + CustomBlendFunc_e::INV_DST_COLOR, + CustomBlendFunc_e::ONE, + BlendOp_e::ADD, + CustomBlendFunc_e::INV_DST_ALPHA, + CustomBlendFunc_e::ONE }, }; - template <typename T> - bool KnownBlendFuncParameterMatches(const T materialValue, const T blendFuncValue) + template<typename T> bool KnownBlendFuncParameterMatches(const T materialValue, const T blendFuncValue) { if (blendFuncValue == T::UNKNOWN) return true; @@ -983,8 +966,7 @@ namespace IW4 && KnownBlendFuncParameterMatches(m_state_bits_info.m_custom_dst_blend_func, knownBlendFunc.m_dst_blend_func) && KnownBlendFuncParameterMatches(m_state_bits_info.m_custom_blend_op_alpha, knownBlendFunc.m_blend_op_alpha) && KnownBlendFuncParameterMatches(m_state_bits_info.m_custom_src_blend_func_alpha, knownBlendFunc.m_src_blend_func_alpha) - && KnownBlendFuncParameterMatches(m_state_bits_info.m_custom_dst_blend_func_alpha, knownBlendFunc.m_dst_blend_func_alpha) - ) + && KnownBlendFuncParameterMatches(m_state_bits_info.m_custom_dst_blend_func_alpha, knownBlendFunc.m_dst_blend_func_alpha)) { m_state_bits_info.m_blend_func = knownBlendFunc.m_blend_func; return; @@ -994,8 +976,7 @@ namespace IW4 m_state_bits_info.m_blend_func = BlendFunc_e::CUSTOM; } - template <typename T> - T StateBitsToEnum(const unsigned input, const size_t mask, const size_t shift) + template<typename T> T StateBitsToEnum(const unsigned input, const size_t mask, const size_t shift) { const unsigned value = (input & mask) >> shift; return value >= (static_cast<unsigned>(T::COUNT) - 1) ? T::UNKNOWN : static_cast<T>(value + 1); @@ -1027,19 +1008,24 @@ namespace IW4 m_state_bits_info.m_custom_blend_op_rgb = StateBitsToEnum<BlendOp_e>(stateBits.loadBits[0], GFXS0_BLENDOP_RGB_MASK, GFXS0_BLENDOP_RGB_SHIFT); if (m_state_bits_info.m_custom_blend_op_alpha == BlendOp_e::UNKNOWN) - m_state_bits_info.m_custom_blend_op_alpha = StateBitsToEnum<BlendOp_e>(stateBits.loadBits[0], GFXS0_BLENDOP_ALPHA_MASK, GFXS0_BLENDOP_ALPHA_SHIFT); + m_state_bits_info.m_custom_blend_op_alpha = + StateBitsToEnum<BlendOp_e>(stateBits.loadBits[0], GFXS0_BLENDOP_ALPHA_MASK, GFXS0_BLENDOP_ALPHA_SHIFT); if (m_state_bits_info.m_custom_src_blend_func == CustomBlendFunc_e::UNKNOWN) - m_state_bits_info.m_custom_src_blend_func = StateBitsToEnum<CustomBlendFunc_e>(stateBits.loadBits[0], GFXS0_SRCBLEND_RGB_MASK, GFXS0_SRCBLEND_RGB_SHIFT); + m_state_bits_info.m_custom_src_blend_func = + StateBitsToEnum<CustomBlendFunc_e>(stateBits.loadBits[0], GFXS0_SRCBLEND_RGB_MASK, GFXS0_SRCBLEND_RGB_SHIFT); if (m_state_bits_info.m_custom_dst_blend_func == CustomBlendFunc_e::UNKNOWN) - m_state_bits_info.m_custom_dst_blend_func = StateBitsToEnum<CustomBlendFunc_e>(stateBits.loadBits[0], GFXS0_DSTBLEND_RGB_MASK, GFXS0_DSTBLEND_RGB_SHIFT); + m_state_bits_info.m_custom_dst_blend_func = + StateBitsToEnum<CustomBlendFunc_e>(stateBits.loadBits[0], GFXS0_DSTBLEND_RGB_MASK, GFXS0_DSTBLEND_RGB_SHIFT); if (m_state_bits_info.m_custom_src_blend_func_alpha == CustomBlendFunc_e::UNKNOWN) - m_state_bits_info.m_custom_src_blend_func_alpha = StateBitsToEnum<CustomBlendFunc_e>(stateBits.loadBits[0], GFXS0_SRCBLEND_ALPHA_MASK, GFXS0_SRCBLEND_ALPHA_SHIFT); + m_state_bits_info.m_custom_src_blend_func_alpha = + StateBitsToEnum<CustomBlendFunc_e>(stateBits.loadBits[0], GFXS0_SRCBLEND_ALPHA_MASK, GFXS0_SRCBLEND_ALPHA_SHIFT); if (m_state_bits_info.m_custom_dst_blend_func_alpha == CustomBlendFunc_e::UNKNOWN) - m_state_bits_info.m_custom_dst_blend_func_alpha = StateBitsToEnum<CustomBlendFunc_e>(stateBits.loadBits[0], GFXS0_DSTBLEND_ALPHA_MASK, GFXS0_DSTBLEND_ALPHA_SHIFT); + m_state_bits_info.m_custom_dst_blend_func_alpha = + StateBitsToEnum<CustomBlendFunc_e>(stateBits.loadBits[0], GFXS0_DSTBLEND_ALPHA_MASK, GFXS0_DSTBLEND_ALPHA_SHIFT); if (m_state_bits_info.m_alpha_test == AlphaTest_e::UNKNOWN) { @@ -1070,7 +1056,8 @@ namespace IW4 } if (m_state_bits_info.m_depth_write == StateBitsEnabledStatus_e::UNKNOWN) - m_state_bits_info.m_depth_write = (stateBits.loadBits[1] & GFXS1_DEPTHWRITE) ? StateBitsEnabledStatus_e::ENABLED : StateBitsEnabledStatus_e::DISABLED; + m_state_bits_info.m_depth_write = + (stateBits.loadBits[1] & GFXS1_DEPTHWRITE) ? StateBitsEnabledStatus_e::ENABLED : StateBitsEnabledStatus_e::DISABLED; if (m_state_bits_info.m_cull_face == CullFace_e::UNKNOWN) { @@ -1085,16 +1072,20 @@ namespace IW4 } if (m_state_bits_info.m_polygon_offset == PolygonOffset_e::UNKNOWN) - m_state_bits_info.m_polygon_offset = StateBitsToEnum<PolygonOffset_e>(stateBits.loadBits[1], GFXS1_POLYGON_OFFSET_MASK, GFXS1_POLYGON_OFFSET_SHIFT); + m_state_bits_info.m_polygon_offset = + StateBitsToEnum<PolygonOffset_e>(stateBits.loadBits[1], GFXS1_POLYGON_OFFSET_MASK, GFXS1_POLYGON_OFFSET_SHIFT); if (m_state_bits_info.m_color_write_rgb == StateBitsEnabledStatus_e::UNKNOWN) - m_state_bits_info.m_color_write_rgb = (stateBits.loadBits[0] & GFXS0_COLORWRITE_RGB) ? StateBitsEnabledStatus_e::ENABLED : StateBitsEnabledStatus_e::DISABLED; + m_state_bits_info.m_color_write_rgb = + (stateBits.loadBits[0] & GFXS0_COLORWRITE_RGB) ? StateBitsEnabledStatus_e::ENABLED : StateBitsEnabledStatus_e::DISABLED; if (m_state_bits_info.m_color_write_alpha == StateBitsEnabledStatus_e::UNKNOWN) - m_state_bits_info.m_color_write_alpha = (stateBits.loadBits[0] & GFXS0_COLORWRITE_ALPHA) ? StateBitsEnabledStatus_e::ENABLED : StateBitsEnabledStatus_e::DISABLED; + m_state_bits_info.m_color_write_alpha = + (stateBits.loadBits[0] & GFXS0_COLORWRITE_ALPHA) ? StateBitsEnabledStatus_e::ENABLED : StateBitsEnabledStatus_e::DISABLED; if (m_state_bits_info.m_gamma_write == StateBitsEnabledStatus_e::UNKNOWN) - m_state_bits_info.m_gamma_write = (stateBits.loadBits[0] & GFXS0_GAMMAWRITE) ? StateBitsEnabledStatus_e::ENABLED : StateBitsEnabledStatus_e::DISABLED; + m_state_bits_info.m_gamma_write = + (stateBits.loadBits[0] & GFXS0_GAMMAWRITE) ? StateBitsEnabledStatus_e::ENABLED : StateBitsEnabledStatus_e::DISABLED; if (m_state_bits_info.m_stencil_mode == StencilMode_e::UNKNOWN) { @@ -1115,28 +1106,36 @@ namespace IW4 } if (m_state_bits_info.m_stencil_front_func == StencilFunc_e::UNKNOWN) - m_state_bits_info.m_stencil_front_func = StateBitsToEnum<StencilFunc_e>(stateBits.loadBits[1], GFXS1_STENCIL_FRONT_FUNC_MASK, GFXS1_STENCIL_FRONT_FUNC_SHIFT); + m_state_bits_info.m_stencil_front_func = + StateBitsToEnum<StencilFunc_e>(stateBits.loadBits[1], GFXS1_STENCIL_FRONT_FUNC_MASK, GFXS1_STENCIL_FRONT_FUNC_SHIFT); if (m_state_bits_info.m_stencil_front_pass == StencilOp_e::UNKNOWN) - m_state_bits_info.m_stencil_front_pass = StateBitsToEnum<StencilOp_e>(stateBits.loadBits[1], GFXS1_STENCIL_FRONT_PASS_MASK, GFXS1_STENCIL_FRONT_PASS_SHIFT); + m_state_bits_info.m_stencil_front_pass = + StateBitsToEnum<StencilOp_e>(stateBits.loadBits[1], GFXS1_STENCIL_FRONT_PASS_MASK, GFXS1_STENCIL_FRONT_PASS_SHIFT); if (m_state_bits_info.m_stencil_front_fail == StencilOp_e::UNKNOWN) - m_state_bits_info.m_stencil_front_fail = StateBitsToEnum<StencilOp_e>(stateBits.loadBits[1], GFXS1_STENCIL_FRONT_FAIL_MASK, GFXS1_STENCIL_FRONT_FAIL_SHIFT); + m_state_bits_info.m_stencil_front_fail = + StateBitsToEnum<StencilOp_e>(stateBits.loadBits[1], GFXS1_STENCIL_FRONT_FAIL_MASK, GFXS1_STENCIL_FRONT_FAIL_SHIFT); if (m_state_bits_info.m_stencil_front_zfail == StencilOp_e::UNKNOWN) - m_state_bits_info.m_stencil_front_zfail = StateBitsToEnum<StencilOp_e>(stateBits.loadBits[1], GFXS1_STENCIL_FRONT_ZFAIL_MASK, GFXS1_STENCIL_FRONT_ZFAIL_SHIFT); + m_state_bits_info.m_stencil_front_zfail = + StateBitsToEnum<StencilOp_e>(stateBits.loadBits[1], GFXS1_STENCIL_FRONT_ZFAIL_MASK, GFXS1_STENCIL_FRONT_ZFAIL_SHIFT); if (m_state_bits_info.m_stencil_back_func == StencilFunc_e::UNKNOWN) - m_state_bits_info.m_stencil_back_func = StateBitsToEnum<StencilFunc_e>(stateBits.loadBits[1], GFXS1_STENCIL_BACK_FUNC_MASK, GFXS1_STENCIL_BACK_FUNC_SHIFT); + m_state_bits_info.m_stencil_back_func = + StateBitsToEnum<StencilFunc_e>(stateBits.loadBits[1], GFXS1_STENCIL_BACK_FUNC_MASK, GFXS1_STENCIL_BACK_FUNC_SHIFT); if (m_state_bits_info.m_stencil_back_pass == StencilOp_e::UNKNOWN) - m_state_bits_info.m_stencil_back_pass = StateBitsToEnum<StencilOp_e>(stateBits.loadBits[1], GFXS1_STENCIL_BACK_PASS_MASK, GFXS1_STENCIL_BACK_PASS_SHIFT); + m_state_bits_info.m_stencil_back_pass = + StateBitsToEnum<StencilOp_e>(stateBits.loadBits[1], GFXS1_STENCIL_BACK_PASS_MASK, GFXS1_STENCIL_BACK_PASS_SHIFT); if (m_state_bits_info.m_stencil_back_fail == StencilOp_e::UNKNOWN) - m_state_bits_info.m_stencil_back_fail = StateBitsToEnum<StencilOp_e>(stateBits.loadBits[1], GFXS1_STENCIL_BACK_FAIL_MASK, GFXS1_STENCIL_BACK_FAIL_SHIFT); + m_state_bits_info.m_stencil_back_fail = + StateBitsToEnum<StencilOp_e>(stateBits.loadBits[1], GFXS1_STENCIL_BACK_FAIL_MASK, GFXS1_STENCIL_BACK_FAIL_SHIFT); if (m_state_bits_info.m_stencil_back_zfail == StencilOp_e::UNKNOWN) - m_state_bits_info.m_stencil_back_zfail = StateBitsToEnum<StencilOp_e>(stateBits.loadBits[1], GFXS1_STENCIL_BACK_ZFAIL_MASK, GFXS1_STENCIL_BACK_ZFAIL_SHIFT); + m_state_bits_info.m_stencil_back_zfail = + StateBitsToEnum<StencilOp_e>(stateBits.loadBits[1], GFXS1_STENCIL_BACK_ZFAIL_MASK, GFXS1_STENCIL_BACK_ZFAIL_SHIFT); ExamineBlendFunc(); } @@ -1214,17 +1213,17 @@ namespace IW4 const auto materialType = m_techset_info.m_gdt_material_type; const auto colorMapIndex = FindTexture("colorMap"); const auto detailMapIndex = FindTexture("detailMap"); - const auto hasColorMap = colorMapIndex >= 0 && m_material->textureTable[colorMapIndex].semantic != TS_WATER_MAP && m_material->textureTable[colorMapIndex].u.image; - const auto hasDetailMap = detailMapIndex >= 0 && m_material->textureTable[detailMapIndex].semantic != TS_WATER_MAP && m_material->textureTable[detailMapIndex].u.image; + const auto hasColorMap = colorMapIndex >= 0 && m_material->textureTable[colorMapIndex].semantic != TS_WATER_MAP + && m_material->textureTable[colorMapIndex].u.image; + const auto hasDetailMap = detailMapIndex >= 0 && m_material->textureTable[detailMapIndex].semantic != TS_WATER_MAP + && m_material->textureTable[detailMapIndex].u.image; - if ((materialType == MATERIAL_TYPE_MODEL_PHONG || materialType == MATERIAL_TYPE_WORLD_PHONG) - && hasColorMap && hasDetailMap) + if ((materialType == MATERIAL_TYPE_MODEL_PHONG || materialType == MATERIAL_TYPE_WORLD_PHONG) && hasColorMap && hasDetailMap) { const auto colorMapTexture = m_material->textureTable[colorMapIndex].u.image; const auto detailMapTexture = m_material->textureTable[detailMapIndex].u.image; - if (colorMapTexture->width != 0 && colorMapTexture->height != 0 - && detailMapTexture->width != 0 && detailMapTexture->height != 0) + if (colorMapTexture->width != 0 && colorMapTexture->height != 0 && detailMapTexture->width != 0 && detailMapTexture->height != 0) { const auto detailScaleFactorX = static_cast<float>(colorMapTexture->width) / static_cast<float>(detailMapTexture->width); const auto detailScaleFactorY = static_cast<float>(colorMapTexture->height) / static_cast<float>(detailMapTexture->height); @@ -1304,7 +1303,6 @@ namespace IW4 SetValue("outdoorOnly", m_techset_info.m_outdoor_only); SetValue("eyeOffsetDepth", m_constants_info.m_eye_offset_depth); - // TODO: These are not good names, change when known what they do SetValue("specularP", m_techset_info.m_specular_p_flag); SetValue("colorO", m_techset_info.m_color_o_flag); @@ -1371,7 +1369,8 @@ namespace IW4 if (knownMaterialSourceName == knownTextureMaps.end()) { assert(false); - std::cout << "Unknown material texture source name hash: 0x" << std::hex << entry.nameHash << " (" << entry.nameStart << "..." << entry.nameEnd << ")\n"; + std::cout << "Unknown material texture source name hash: 0x" << std::hex << entry.nameHash << " (" << entry.nameStart << "..." + << entry.nameEnd << ")\n"; continue; } @@ -1457,7 +1456,7 @@ namespace IW4 return m_entry; } }; -} +} // namespace IW4 bool AssetDumperMaterial::ShouldDump(XAssetInfo<Material>* asset) { diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMaterial.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMaterial.h index 330d33cda..d55f439e8 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMaterial.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMaterial.h @@ -11,4 +11,4 @@ namespace IW4 bool ShouldDump(XAssetInfo<Material>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<Material>* asset) override; }; -} +} // namespace IW4 diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMenuDef.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMenuDef.cpp index ce642791e..4a90b9ad0 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMenuDef.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMenuDef.cpp @@ -1,13 +1,13 @@ #include "AssetDumperMenuDef.h" -#include <filesystem> -#include <string> - #include "AssetDumperMenuList.h" -#include "ObjWriting.h" #include "Game/IW4/GameAssetPoolIW4.h" #include "Game/IW4/Menu/MenuDumperIW4.h" #include "Menu/AbstractMenuDumper.h" +#include "ObjWriting.h" + +#include <filesystem> +#include <string> using namespace IW4; @@ -31,7 +31,7 @@ void AssetDumperMenuDef::DumpAsset(AssetDumpingContext& context, XAssetInfo<menu const auto* menu = asset->Asset(); auto* zoneState = context.GetZoneAssetDumperState<menu::MenuDumpingZoneState>(); - if(!ObjWriting::ShouldHandleAssetType(ASSET_TYPE_MENULIST)) + if (!ObjWriting::ShouldHandleAssetType(ASSET_TYPE_MENULIST)) { // Make sure menu paths based on menu lists are created const auto* gameAssetPool = dynamic_cast<GameAssetPoolIW4*>(asset->m_zone->m_pools.get()); diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMenuDef.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMenuDef.h index 3fa4a8d2a..fbebc2c69 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMenuDef.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMenuDef.h @@ -14,4 +14,4 @@ namespace IW4 bool ShouldDump(XAssetInfo<menuDef_t>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<menuDef_t>* asset) override; }; -} +} // namespace IW4 diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMenuList.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMenuList.cpp index 86c112d7a..2c4c690d7 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMenuList.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMenuList.cpp @@ -1,13 +1,13 @@ #include "AssetDumperMenuList.h" +#include "Game/IW4/Menu/MenuDumperIW4.h" +#include "Menu/AbstractMenuDumper.h" +#include "ObjWriting.h" + #include <cassert> #include <filesystem> -#include <sstream> #include <set> - -#include "ObjWriting.h" -#include "Game/IW4/Menu/MenuDumperIW4.h" -#include "Menu/AbstractMenuDumper.h" +#include <sstream> namespace fs = std::filesystem; @@ -21,17 +21,17 @@ std::vector<const ExpressionSupportingData*> AssetDumperMenuList::GetAllUniqueEx if (menuList->menus == nullptr) return result; - for(auto i = 0; i < menuList->menuCount; i++) + for (auto i = 0; i < menuList->menuCount; i++) { - if(menuList->menus[i] == nullptr) + if (menuList->menus[i] == nullptr) continue; const auto* menu = menuList->menus[i]; - if(menu->expressionData == nullptr) + if (menu->expressionData == nullptr) continue; - if(alreadyAddedSupportingData.find(menu->expressionData) == alreadyAddedSupportingData.end()) + if (alreadyAddedSupportingData.find(menu->expressionData) == alreadyAddedSupportingData.end()) { result.push_back(menu->expressionData); alreadyAddedSupportingData.emplace(menu->expressionData); @@ -53,10 +53,10 @@ void AssetDumperMenuList::DumpFunctions(MenuDumper& menuDumper, const MenuList* if (supportingData->uifunctions.functions == nullptr) continue; - for(auto i = 0; i < supportingData->uifunctions.totalFunctions; i++) + for (auto i = 0; i < supportingData->uifunctions.totalFunctions; i++) { const auto* function = supportingData->uifunctions.functions[i]; - if(function != nullptr) + if (function != nullptr) { std::stringstream ss; ss << "FUNC_" << functionIndex; @@ -76,7 +76,7 @@ void AssetDumperMenuList::DumpMenus(MenuDumper& menuDumper, menu::MenuDumpingZon const auto* menu = menuList->menus[menuNum]; const auto menuDumpingState = zoneState->m_menu_dumping_state_map.find(menu); - if(menuDumpingState == zoneState->m_menu_dumping_state_map.end()) + if (menuDumpingState == zoneState->m_menu_dumping_state_map.end()) continue; // If the menu was embedded directly as menu list write its data in the menu list file @@ -106,7 +106,7 @@ void AssetDumperMenuList::DumpAsset(AssetDumpingContext& context, XAssetInfo<Men menuDumper.Start(); - if(!ObjWriting::Configuration.MenuLegacyMode) + if (!ObjWriting::Configuration.MenuLegacyMode) DumpFunctions(menuDumper, menuList); DumpMenus(menuDumper, zoneState, menuList); @@ -141,21 +141,21 @@ void AssetDumperMenuList::CreateDumpingStateForMenuList(menu::MenuDumpingZoneSta if (p.has_parent_path()) parentPath = p.parent_path().string() + "/"; - for(auto i = 0; i < menuList->menuCount; i++) + for (auto i = 0; i < menuList->menuCount; i++) { auto* menu = menuList->menus[i]; - if(menu == nullptr) + if (menu == nullptr) continue; auto existingState = zoneState->m_menu_dumping_state_map.find(menu); - if(existingState == zoneState->m_menu_dumping_state_map.end()) + if (existingState == zoneState->m_menu_dumping_state_map.end()) { auto menuPath = PathForMenu(parentPath, menu); const auto isTheSameAsMenuList = menuPath == menuListName; zoneState->CreateMenuDumpingState(menu, std::move(menuPath), isTheSameAsMenuList ? menuList : nullptr); } - else if(existingState->second.m_alias_menu_list == nullptr) + else if (existingState->second.m_alias_menu_list == nullptr) { auto menuPath = PathForMenu(parentPath, menu); const auto isTheSameAsMenuList = menuPath == menuListName; @@ -172,7 +172,7 @@ void AssetDumperMenuList::DumpPool(AssetDumpingContext& context, AssetPool<MenuL { auto* zoneState = context.GetZoneAssetDumperState<menu::MenuDumpingZoneState>(); - for(auto* asset : *pool) + for (auto* asset : *pool) CreateDumpingStateForMenuList(zoneState, asset->Asset()); AbstractAssetDumper<MenuList>::DumpPool(context, pool); diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMenuList.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMenuList.h index eb75e852a..2e368d7ff 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMenuList.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperMenuList.h @@ -24,4 +24,4 @@ namespace IW4 static void CreateDumpingStateForMenuList(menu::MenuDumpingZoneState* zoneState, const MenuList* menuList); void DumpPool(AssetDumpingContext& context, AssetPool<MenuList>* pool) override; }; -} +} // namespace IW4 diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPhysCollmap.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPhysCollmap.cpp index 314ca79a7..f286a61ed 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPhysCollmap.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPhysCollmap.cpp @@ -1,10 +1,10 @@ #include "AssetDumperPhysCollmap.h" +#include "Dumping/MapFile/MapFileDumper.h" + #include <cassert> #include <sstream> -#include "Dumping/MapFile/MapFileDumper.h" - using namespace IW4; std::string AssetDumperPhysCollmap::GetAssetFilename(const std::string& assetName) @@ -54,9 +54,9 @@ void AssetDumperPhysCollmap::DumpAsset(AssetDumpingContext& context, XAssetInfo< mapFileDumper.WritePhysicsBox({ {geom.bounds.midPoint[0], geom.bounds.midPoint[1], geom.bounds.midPoint[2]}, {geom.bounds.halfSize[0], geom.bounds.halfSize[1], geom.bounds.halfSize[2]}, - {geom.orientation[0][0], geom.orientation[0][1], geom.orientation[0][2]}, - {geom.orientation[1][0], geom.orientation[1][1], geom.orientation[1][2]}, - {geom.orientation[2][0], geom.orientation[2][1], geom.orientation[2][2]} + {geom.orientation[0][0], geom.orientation[0][1], geom.orientation[0][2] }, + {geom.orientation[1][0], geom.orientation[1][1], geom.orientation[1][2] }, + {geom.orientation[2][0], geom.orientation[2][1], geom.orientation[2][2] } }); break; @@ -65,7 +65,7 @@ void AssetDumperPhysCollmap::DumpAsset(AssetDumpingContext& context, XAssetInfo< {geom.bounds.midPoint[0], geom.bounds.midPoint[1], geom.bounds.midPoint[2]}, geom.bounds.halfSize[0], geom.bounds.halfSize[2] * 2, - {geom.orientation[0][0], geom.orientation[0][1], geom.orientation[0][2]} + {geom.orientation[0][0], geom.orientation[0][1], geom.orientation[0][2] } }); break; diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPhysCollmap.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPhysCollmap.h index 22bde8836..213f1ce12 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPhysCollmap.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPhysCollmap.h @@ -13,4 +13,4 @@ namespace IW4 bool ShouldDump(XAssetInfo<PhysCollmap>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<PhysCollmap>* asset) override; }; -} +} // namespace IW4 diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPhysPreset.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPhysPreset.cpp index c673c1141..19b2adbb5 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPhysPreset.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPhysPreset.cpp @@ -1,14 +1,14 @@ #include "AssetDumperPhysPreset.h" +#include "Game/IW4/InfoString/InfoStringFromStructConverter.h" +#include "Game/IW4/InfoString/PhysPresetFields.h" +#include "Game/IW4/ObjConstantsIW4.h" + #include <algorithm> #include <cassert> #include <cmath> #include <type_traits> -#include "Game/IW4/ObjConstantsIW4.h" -#include "Game/IW4/InfoString/InfoStringFromStructConverter.h" -#include "Game/IW4/InfoString/PhysPresetFields.h" - using namespace IW4; namespace IW4 @@ -22,12 +22,15 @@ namespace IW4 } public: - InfoStringFromPhysPresetConverter(const PhysPresetInfo* structure, const cspField_t* fields, const size_t fieldCount, std::function<std::string(scr_string_t)> scriptStringValueCallback) + InfoStringFromPhysPresetConverter(const PhysPresetInfo* structure, + const cspField_t* fields, + const size_t fieldCount, + std::function<std::string(scr_string_t)> scriptStringValueCallback) : InfoStringFromStructConverter(structure, fields, fieldCount, std::move(scriptStringValueCallback)) { } }; -} +} // namespace IW4 void AssetDumperPhysPreset::CopyToPhysPresetInfo(const PhysPreset* physPreset, PhysPresetInfo* physPresetInfo) { @@ -59,14 +62,17 @@ InfoString AssetDumperPhysPreset::CreateInfoString(XAssetInfo<PhysPreset>* asset auto* physPresetInfo = new PhysPresetInfo; CopyToPhysPresetInfo(asset->Asset(), physPresetInfo); - InfoStringFromPhysPresetConverter converter(physPresetInfo, phys_preset_fields, std::extent<decltype(phys_preset_fields)>::value, [asset](const scr_string_t scrStr) -> std::string - { - assert(scrStr < asset->m_zone->m_script_strings.Count()); - if (scrStr >= asset->m_zone->m_script_strings.Count()) - return ""; + InfoStringFromPhysPresetConverter converter(physPresetInfo, + phys_preset_fields, + std::extent<decltype(phys_preset_fields)>::value, + [asset](const scr_string_t scrStr) -> std::string + { + assert(scrStr < asset->m_zone->m_script_strings.Count()); + if (scrStr >= asset->m_zone->m_script_strings.Count()) + return ""; - return asset->m_zone->m_script_strings[scrStr]; - }); + return asset->m_zone->m_script_strings[scrStr]; + }); return converter.Convert(); } @@ -98,4 +104,4 @@ void AssetDumperPhysPreset::DumpAsset(AssetDumpingContext& context, XAssetInfo<P const auto stringValue = infoString.ToString(ObjConstants::INFO_STRING_PREFIX_PHYS_PRESET); stream.write(stringValue.c_str(), stringValue.size()); } -} \ No newline at end of file +} diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPhysPreset.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPhysPreset.h index 6db3528e0..5de816cce 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPhysPreset.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPhysPreset.h @@ -15,4 +15,4 @@ namespace IW4 bool ShouldDump(XAssetInfo<PhysPreset>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<PhysPreset>* asset) override; }; -} +} // namespace IW4 diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPixelShader.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPixelShader.cpp index 5062d18c4..40bb4089f 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPixelShader.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPixelShader.cpp @@ -21,5 +21,6 @@ void AssetDumperPixelShader::DumpAsset(AssetDumpingContext& context, XAssetInfo< if (!shaderFile) return; - shaderFile->write(reinterpret_cast<const char*>(pixelShader->prog.loadDef.program), static_cast<std::streamsize>(pixelShader->prog.loadDef.programSize) * 4u); + shaderFile->write(reinterpret_cast<const char*>(pixelShader->prog.loadDef.program), + static_cast<std::streamsize>(pixelShader->prog.loadDef.programSize) * 4u); } diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPixelShader.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPixelShader.h index a01be4a92..925e80f9a 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPixelShader.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperPixelShader.h @@ -11,4 +11,4 @@ namespace IW4 bool ShouldDump(XAssetInfo<MaterialPixelShader>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<MaterialPixelShader>* asset) override; }; -} +} // namespace IW4 diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperRawFile.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperRawFile.cpp index 507d2cfa2..559c4c4ed 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperRawFile.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperRawFile.cpp @@ -1,7 +1,7 @@ #include "AssetDumperRawFile.h" -#include <zlib.h> #include <stdexcept> +#include <zlib.h> using namespace IW4; diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperRawFile.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperRawFile.h index 66a2c000f..5b2c2120b 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperRawFile.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperRawFile.h @@ -11,4 +11,4 @@ namespace IW4 bool ShouldDump(XAssetInfo<RawFile>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<RawFile>* asset) override; }; -} +} // namespace IW4 diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperSndCurve.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperSndCurve.cpp index 988549ecb..71958fbb3 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperSndCurve.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperSndCurve.cpp @@ -1,9 +1,9 @@ #include "AssetDumperSndCurve.h" -#include <sstream> - #include "Dumping/SndCurve/SndCurveDumper.h" +#include <sstream> + using namespace IW4; std::string AssetDumperSndCurve::GetAssetFilename(const std::string& assetName) diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperSndCurve.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperSndCurve.h index 6cad3ee74..0139fafe7 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperSndCurve.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperSndCurve.h @@ -13,4 +13,4 @@ namespace IW4 bool ShouldDump(XAssetInfo<SndCurve>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<SndCurve>* asset) override; }; -} +} // namespace IW4 diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperStringTable.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperStringTable.cpp index cadfd739b..2d76ab91e 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperStringTable.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperStringTable.cpp @@ -16,7 +16,7 @@ void AssetDumperStringTable::DumpAsset(AssetDumpingContext& context, XAssetInfo< if (!assetFile) return; - + CsvOutputStream csv(*assetFile); for (auto row = 0; row < stringTable->rowCount; row++) diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperStringTable.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperStringTable.h index 0194b747d..9d50d4314 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperStringTable.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperStringTable.h @@ -11,4 +11,4 @@ namespace IW4 bool ShouldDump(XAssetInfo<StringTable>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<StringTable>* asset) override; }; -} +} // namespace IW4 diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperStructuredDataDefSet.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperStructuredDataDefSet.cpp index ea98bde8f..0a21cf96a 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperStructuredDataDefSet.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperStructuredDataDefSet.cpp @@ -1,10 +1,10 @@ #include "AssetDumperStructuredDataDefSet.h" +#include "StructuredDataDef/StructuredDataDefDumper.h" + +#include <algorithm> #include <cassert> #include <sstream> -#include <algorithm> - -#include "StructuredDataDef/StructuredDataDefDumper.h" using namespace IW4; using namespace std::string_literals; @@ -73,7 +73,7 @@ void AssetDumperStructuredDataDefSet::ConvertEnum(CommonStructuredDataEnum* out, out->m_reserved_entry_count = -1; out->m_entries.resize(static_cast<size_t>(std::max(in->entryCount, 0))); - for(auto i = 0u; i < out->m_entries.size(); i++) + for (auto i = 0u; i < out->m_entries.size(); i++) { auto& outEntry = out->m_entries[i]; const auto& inEntry = in->entries[i]; @@ -85,7 +85,11 @@ void AssetDumperStructuredDataDefSet::ConvertEnum(CommonStructuredDataEnum* out, out->SortEntriesByOffset(); } -void AssetDumperStructuredDataDefSet::ConvertStruct(const CommonStructuredDataDef* def, const StructuredDataDef* gameDef, CommonStructuredDataStruct* out, const StructuredDataStruct* in, const size_t structIndex) +void AssetDumperStructuredDataDefSet::ConvertStruct(const CommonStructuredDataDef* def, + const StructuredDataDef* gameDef, + CommonStructuredDataStruct* out, + const StructuredDataStruct* in, + const size_t structIndex) { if (gameDef->rootType.type == DATA_STRUCT && structIndex == static_cast<size_t>(gameDef->rootType.u.structIndex)) { @@ -118,14 +122,18 @@ void AssetDumperStructuredDataDefSet::ConvertStruct(const CommonStructuredDataDe out->SortPropertiesByOffset(); } -void AssetDumperStructuredDataDefSet::ConvertIndexedArray(const CommonStructuredDataDef* def, CommonStructuredDataIndexedArray* out, const StructuredDataIndexedArray* in) +void AssetDumperStructuredDataDefSet::ConvertIndexedArray(const CommonStructuredDataDef* def, + CommonStructuredDataIndexedArray* out, + const StructuredDataIndexedArray* in) { out->m_element_count = static_cast<size_t>(std::max(in->arraySize, 0)); out->m_element_size_in_bits = in->elementType.type == DATA_BOOL ? 1 : in->elementSize * 8; out->m_array_type = ConvertType(def, in->elementType); } -void AssetDumperStructuredDataDefSet::ConvertEnumedArray(const CommonStructuredDataDef* def, CommonStructuredDataEnumedArray* out, const StructuredDataEnumedArray* in) +void AssetDumperStructuredDataDefSet::ConvertEnumedArray(const CommonStructuredDataDef* def, + CommonStructuredDataEnumedArray* out, + const StructuredDataEnumedArray* in) { assert(!def->m_enums.empty()); out->m_element_size_in_bits = in->elementType.type == DATA_BOOL ? 1 : in->elementSize * 8; diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperStructuredDataDefSet.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperStructuredDataDefSet.h index 703cd9772..7859af577 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperStructuredDataDefSet.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperStructuredDataDefSet.h @@ -1,18 +1,22 @@ #pragma once -#include <cstddef> - #include "Dumping/AbstractAssetDumper.h" #include "Game/IW4/IW4.h" #include "StructuredDataDef/CommonStructuredDataDef.h" +#include <cstddef> + namespace IW4 { class AssetDumperStructuredDataDefSet final : public AbstractAssetDumper<StructuredDataDefSet> { static CommonStructuredDataType ConvertType(const CommonStructuredDataDef* def, StructuredDataType in); static void ConvertEnum(CommonStructuredDataEnum* out, const StructuredDataEnum* in, size_t enumIndex); - static void ConvertStruct(const CommonStructuredDataDef* def, const StructuredDataDef* gameDef, CommonStructuredDataStruct* out, const StructuredDataStruct* in, size_t structIndex); + static void ConvertStruct(const CommonStructuredDataDef* def, + const StructuredDataDef* gameDef, + CommonStructuredDataStruct* out, + const StructuredDataStruct* in, + size_t structIndex); static void ConvertIndexedArray(const CommonStructuredDataDef* def, CommonStructuredDataIndexedArray* out, const StructuredDataIndexedArray* in); static void ConvertEnumedArray(const CommonStructuredDataDef* def, CommonStructuredDataEnumedArray* out, const StructuredDataEnumedArray* in); static std::unique_ptr<CommonStructuredDataDef> ConvertDef(const StructuredDataDef* in); @@ -21,4 +25,4 @@ namespace IW4 bool ShouldDump(XAssetInfo<StructuredDataDefSet>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<StructuredDataDefSet>* asset) override; }; -} +} // namespace IW4 diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperTechniqueSet.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperTechniqueSet.cpp index 8e8a3c257..abe35157c 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperTechniqueSet.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperTechniqueSet.cpp @@ -1,15 +1,15 @@ #include "AssetDumperTechniqueSet.h" -#include <algorithm> -#include <cassert> -#include <sstream> -#include <type_traits> - #include "Dumping/AbstractTextDumper.h" #include "Game/IW4/TechsetConstantsIW4.h" #include "Pool/GlobalAssetPool.h" #include "Shader/D3D9ShaderAnalyser.h" +#include <algorithm> +#include <cassert> +#include <sstream> +#include <type_traits> + using namespace IW4; namespace IW4 @@ -38,7 +38,9 @@ namespace IW4 m_stream << "stateMap \"passthrough\"; // TODO\n"; } - static bool FindCodeConstantSourceAccessor(const MaterialConstantSource sourceIndexToFind, const CodeConstantSource* codeConstantTable, std::string& codeSourceAccessor) + static bool FindCodeConstantSourceAccessor(const MaterialConstantSource sourceIndexToFind, + const CodeConstantSource* codeConstantTable, + std::string& codeSourceAccessor) { const auto* currentCodeConst = codeConstantTable; while (currentCodeConst->name != nullptr) @@ -60,7 +62,8 @@ namespace IW4 && static_cast<unsigned>(currentCodeConst->source) + currentCodeConst->arrayCount > static_cast<unsigned>(sourceIndexToFind)) { std::ostringstream ss; - ss << currentCodeConst->name << '[' << (static_cast<unsigned>(sourceIndexToFind) - static_cast<unsigned>(currentCodeConst->source)) << ']'; + ss << currentCodeConst->name << '[' << (static_cast<unsigned>(sourceIndexToFind) - static_cast<unsigned>(currentCodeConst->source)) + << ']'; codeSourceAccessor = ss.str(); return true; } @@ -77,7 +80,9 @@ namespace IW4 return false; } - static bool FindCodeSamplerSourceAccessor(const MaterialTextureSource sourceIndexToFind, const CodeSamplerSource* codeSamplerTable, std::string& codeSourceAccessor) + static bool FindCodeSamplerSourceAccessor(const MaterialTextureSource sourceIndexToFind, + const CodeSamplerSource* codeSamplerTable, + std::string& codeSourceAccessor) { const auto* currentCodeConst = codeSamplerTable; while (currentCodeConst->name != nullptr) @@ -99,7 +104,8 @@ namespace IW4 && static_cast<unsigned>(currentCodeConst->source) + currentCodeConst->arrayCount > static_cast<unsigned>(sourceIndexToFind)) { std::ostringstream ss; - ss << currentCodeConst->name << '[' << (static_cast<unsigned>(sourceIndexToFind) - static_cast<unsigned>(currentCodeConst->source)) << ']'; + ss << currentCodeConst->name << '[' << (static_cast<unsigned>(sourceIndexToFind) - static_cast<unsigned>(currentCodeConst->source)) + << ']'; codeSourceAccessor = ss.str(); return true; } @@ -118,11 +124,15 @@ namespace IW4 void DumpShaderArg(const MaterialShaderArgument& arg, const d3d9::ShaderInfo& shaderInfo) const { - const auto expectedRegisterSet = arg.type == MTL_ARG_CODE_PIXEL_SAMPLER || arg.type == MTL_ARG_MATERIAL_PIXEL_SAMPLER ? d3d9::RegisterSet::SAMPLER : d3d9::RegisterSet::FLOAT_4; - const auto targetShaderArg = std::find_if(shaderInfo.m_constants.begin(), shaderInfo.m_constants.end(), [arg, expectedRegisterSet](const d3d9::ShaderConstant& constant) - { - return constant.m_register_set == expectedRegisterSet && constant.m_register_index <= arg.dest && constant.m_register_index + constant.m_register_count > arg.dest; - }); + const auto expectedRegisterSet = + arg.type == MTL_ARG_CODE_PIXEL_SAMPLER || arg.type == MTL_ARG_MATERIAL_PIXEL_SAMPLER ? d3d9::RegisterSet::SAMPLER : d3d9::RegisterSet::FLOAT_4; + const auto targetShaderArg = std::find_if(shaderInfo.m_constants.begin(), + shaderInfo.m_constants.end(), + [arg, expectedRegisterSet](const d3d9::ShaderConstant& constant) + { + return constant.m_register_set == expectedRegisterSet && constant.m_register_index <= arg.dest + && constant.m_register_index + constant.m_register_count > arg.dest; + }); assert(targetShaderArg != shaderInfo.m_constants.end()); if (targetShaderArg == shaderInfo.m_constants.end()) @@ -200,11 +210,8 @@ namespace IW4 if (arg.u.literalConst) { Indent(); - m_stream << codeDestAccessor << " = float4( " << (*arg.u.literalConst)[0] - << ", " << (*arg.u.literalConst)[1] - << ", " << (*arg.u.literalConst)[2] - << ", " << (*arg.u.literalConst)[3] - << " );\n"; + m_stream << codeDestAccessor << " = float4( " << (*arg.u.literalConst)[0] << ", " << (*arg.u.literalConst)[1] << ", " + << (*arg.u.literalConst)[2] << ", " << (*arg.u.literalConst)[3] << " );\n"; } } else if (arg.type == MTL_ARG_MATERIAL_PIXEL_CONST || arg.type == MTL_ARG_MATERIAL_VERTEX_CONST || arg.type == MTL_ARG_MATERIAL_PIXEL_SAMPLER) @@ -221,7 +228,7 @@ namespace IW4 { const auto knownMaterialTextureName = knownTextureMaps.find(arg.u.nameHash); - if(knownMaterialTextureName != knownTextureMaps.end()) + if (knownMaterialTextureName != knownTextureMaps.end()) { m_stream << knownMaterialTextureName->second.m_name; } @@ -265,29 +272,28 @@ namespace IW4 vertexShader = loadedVertexShaderFromOtherZone->Asset(); } - const auto vertexShaderInfo = d3d9::ShaderAnalyser::GetShaderInfo(vertexShader->prog.loadDef.program, vertexShader->prog.loadDef.programSize * sizeof(uint32_t)); + const auto vertexShaderInfo = + d3d9::ShaderAnalyser::GetShaderInfo(vertexShader->prog.loadDef.program, vertexShader->prog.loadDef.programSize * sizeof(uint32_t)); assert(vertexShaderInfo); if (!vertexShaderInfo) return; m_stream << "\n"; Indent(); - m_stream << "vertexShader " << vertexShaderInfo->m_version_major << "." << vertexShaderInfo->m_version_minor << " \"" << vertexShader->name << "\"\n"; + m_stream << "vertexShader " << vertexShaderInfo->m_version_major << "." << vertexShaderInfo->m_version_minor << " \"" << vertexShader->name + << "\"\n"; Indent(); m_stream << "{\n"; IncIndent(); if (pass.args) { - const auto totalArgCount = static_cast<size_t>(pass.perPrimArgCount) - + static_cast<size_t>(pass.perObjArgCount) - + static_cast<size_t>(pass.stableArgCount); + const auto totalArgCount = + static_cast<size_t>(pass.perPrimArgCount) + static_cast<size_t>(pass.perObjArgCount) + static_cast<size_t>(pass.stableArgCount); for (auto i = 0u; i < totalArgCount; i++) { const auto& arg = pass.args[i]; - if (arg.type == MTL_ARG_MATERIAL_VERTEX_CONST - || arg.type == MTL_ARG_LITERAL_VERTEX_CONST - || arg.type == MTL_ARG_CODE_VERTEX_CONST) + if (arg.type == MTL_ARG_MATERIAL_VERTEX_CONST || arg.type == MTL_ARG_LITERAL_VERTEX_CONST || arg.type == MTL_ARG_CODE_VERTEX_CONST) { DumpShaderArg(arg, *vertexShaderInfo); } @@ -321,7 +327,8 @@ namespace IW4 pixelShader = loadedPixelShaderFromOtherZone->Asset(); } - const auto pixelShaderInfo = d3d9::ShaderAnalyser::GetShaderInfo(pixelShader->prog.loadDef.program, pixelShader->prog.loadDef.programSize * sizeof(uint32_t)); + const auto pixelShaderInfo = + d3d9::ShaderAnalyser::GetShaderInfo(pixelShader->prog.loadDef.program, pixelShader->prog.loadDef.programSize * sizeof(uint32_t)); assert(pixelShaderInfo); if (!pixelShaderInfo) return; @@ -335,17 +342,13 @@ namespace IW4 if (pass.args) { - const auto totalArgCount = static_cast<size_t>(pass.perPrimArgCount) - + static_cast<size_t>(pass.perObjArgCount) - + static_cast<size_t>(pass.stableArgCount); + const auto totalArgCount = + static_cast<size_t>(pass.perPrimArgCount) + static_cast<size_t>(pass.perObjArgCount) + static_cast<size_t>(pass.stableArgCount); for (auto i = 0u; i < totalArgCount; i++) { const auto& arg = pass.args[i]; - if (arg.type == MTL_ARG_MATERIAL_PIXEL_SAMPLER - || arg.type == MTL_ARG_CODE_PIXEL_SAMPLER - || arg.type == MTL_ARG_CODE_PIXEL_CONST - || arg.type == MTL_ARG_MATERIAL_PIXEL_CONST - || arg.type == MTL_ARG_LITERAL_PIXEL_CONST) + if (arg.type == MTL_ARG_MATERIAL_PIXEL_SAMPLER || arg.type == MTL_ARG_CODE_PIXEL_SAMPLER || arg.type == MTL_ARG_CODE_PIXEL_CONST + || arg.type == MTL_ARG_MATERIAL_PIXEL_CONST || arg.type == MTL_ARG_LITERAL_PIXEL_CONST) { DumpShaderArg(arg, *pixelShaderInfo); } @@ -408,8 +411,8 @@ namespace IW4 { const auto& stream = vertexDecl->routing.data[streamIndex]; Indent(); - m_stream << "vertex." << GetStreamDestinationString(static_cast<MaterialStreamDestination_e>(stream.dest)) - << " = code." << GetStreamSourceString(static_cast<MaterialStreamStreamSource_e>(stream.source)) << ";\n"; + m_stream << "vertex." << GetStreamDestinationString(static_cast<MaterialStreamDestination_e>(stream.dest)) << " = code." + << GetStreamSourceString(static_cast<MaterialStreamStreamSource_e>(stream.source)) << ";\n"; } } @@ -448,12 +451,12 @@ namespace IW4 void DumpTechnique(const MaterialTechnique* technique) { #ifdef TECHSET_DEBUG - if(technique->flags) + if (technique->flags) { - for(auto i = 0u; i < 16; i++) + for (auto i = 0u; i < 16; i++) { const auto mask = 1u << i; - if(technique->flags & mask) + if (technique->flags & mask) { Indent(); m_stream << "// TECHNIQUE FLAGS: 0x" << std::hex << mask << "\n"; @@ -512,7 +515,8 @@ namespace IW4 dumpedTechniques[techniqueIndex] = true; WriteTechniqueType(techniqueIndex); - for (auto nextTechniqueIndex = techniqueIndex + 1; nextTechniqueIndex < std::extent_v<decltype(MaterialTechniqueSet::techniques)>; nextTechniqueIndex++) + for (auto nextTechniqueIndex = techniqueIndex + 1; nextTechniqueIndex < std::extent_v<decltype(MaterialTechniqueSet::techniques)>; + nextTechniqueIndex++) { if (techset->techniques[nextTechniqueIndex] != technique) continue; @@ -525,7 +529,7 @@ namespace IW4 } } }; -} +} // namespace IW4 std::string AssetDumperTechniqueSet::GetTechniqueFileName(const MaterialTechnique* technique) { diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperTechniqueSet.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperTechniqueSet.h index fc503d4b8..67495b9b9 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperTechniqueSet.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperTechniqueSet.h @@ -14,4 +14,4 @@ namespace IW4 bool ShouldDump(XAssetInfo<MaterialTechniqueSet>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<MaterialTechniqueSet>* asset) override; }; -} +} // namespace IW4 diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperTracer.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperTracer.cpp index d648fd6a6..2475d98a4 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperTracer.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperTracer.cpp @@ -1,13 +1,13 @@ #include "AssetDumperTracer.h" -#include <cassert> -#include <sstream> -#include <type_traits> - #include "Game/IW4/CommonIW4.h" -#include "Game/IW4/ObjConstantsIW4.h" #include "Game/IW4/InfoString/InfoStringFromStructConverter.h" #include "Game/IW4/InfoString/TracerFields.h" +#include "Game/IW4/ObjConstantsIW4.h" + +#include <cassert> +#include <sstream> +#include <type_traits> using namespace IW4; @@ -22,23 +22,29 @@ namespace IW4 } public: - InfoStringFromTracerConverter(const TracerDef* structure, const cspField_t* fields, const size_t fieldCount, std::function<std::string(scr_string_t)> scriptStringValueCallback) + InfoStringFromTracerConverter(const TracerDef* structure, + const cspField_t* fields, + const size_t fieldCount, + std::function<std::string(scr_string_t)> scriptStringValueCallback) : InfoStringFromStructConverter(structure, fields, fieldCount, std::move(scriptStringValueCallback)) { } }; -} +} // namespace IW4 InfoString AssetDumperTracer::CreateInfoString(XAssetInfo<TracerDef>* asset) { - 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.Count()); - if (scrStr >= asset->m_zone->m_script_strings.Count()) - return ""; + 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.Count()); + if (scrStr >= asset->m_zone->m_script_strings.Count()) + return ""; - return asset->m_zone->m_script_strings[scrStr]; - }); + return asset->m_zone->m_script_strings[scrStr]; + }); return converter.Convert(); } diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperTracer.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperTracer.h index 02fe88de7..6e32b8606 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperTracer.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperTracer.h @@ -14,4 +14,4 @@ namespace IW4 bool ShouldDump(XAssetInfo<TracerDef>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<TracerDef>* asset) override; }; -} +} // namespace IW4 diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperVehicle.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperVehicle.cpp index 75ac80f63..d56146285 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperVehicle.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperVehicle.cpp @@ -1,14 +1,14 @@ #include "AssetDumperVehicle.h" -#include <cassert> -#include <sstream> -#include <type_traits> - #include "Game/IW4/CommonIW4.h" -#include "Game/IW4/InfoString/InfoStringFromStructConverter.h" -#include "Game/IW4/ObjConstantsIW4.h" #include "Game/IW4/InfoString/EnumStrings.h" +#include "Game/IW4/InfoString/InfoStringFromStructConverter.h" #include "Game/IW4/InfoString/VehicleFields.h" +#include "Game/IW4/ObjConstantsIW4.h" + +#include <cassert> +#include <sstream> +#include <type_traits> using namespace IW4; @@ -32,29 +32,29 @@ namespace IW4 break; case VFT_TROPHY_TAGS: - { - const auto* trophyTags = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); - std::stringstream ss; - bool first = true; + { + const auto* trophyTags = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); + std::stringstream ss; + bool first = true; - for (auto i = 0u; i < std::extent<decltype(VehicleDef::trophyTags)>::value; 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()) { - const auto& str = m_get_scr_string(trophyTags[i]); - if (!str.empty()) - { - if (!first) - ss << "\n"; - else - first = false; - - ss << str; - } - } + if (!first) + ss << "\n"; + else + first = false; - m_info_string.SetValueForKey(std::string(field.szName), ss.str()); - break; + ss << str; + } } + m_info_string.SetValueForKey(std::string(field.szName), ss.str()); + break; + } + case VFT_NUM: default: assert(false); @@ -63,23 +63,29 @@ namespace IW4 } public: - InfoStringFromVehicleConverter(const VehicleDef* structure, const cspField_t* fields, const size_t fieldCount, std::function<std::string(scr_string_t)> scriptStringValueCallback) + InfoStringFromVehicleConverter(const VehicleDef* structure, + const cspField_t* fields, + const size_t fieldCount, + std::function<std::string(scr_string_t)> scriptStringValueCallback) : InfoStringFromStructConverter(structure, fields, fieldCount, std::move(scriptStringValueCallback)) { } }; -} +} // namespace IW4 InfoString AssetDumperVehicle::CreateInfoString(XAssetInfo<VehicleDef>* asset) { - 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.Count()); - if (scrStr >= asset->m_zone->m_script_strings.Count()) - return ""; - - return asset->m_zone->m_script_strings[scrStr]; - }); + 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.Count()); + if (scrStr >= asset->m_zone->m_script_strings.Count()) + return ""; + + return asset->m_zone->m_script_strings[scrStr]; + }); return converter.Convert(); } diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperVehicle.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperVehicle.h index 9215e0d5c..66a1f074a 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperVehicle.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperVehicle.h @@ -14,4 +14,4 @@ namespace IW4 bool ShouldDump(XAssetInfo<VehicleDef>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset) override; }; -} +} // namespace IW4 diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperVertexShader.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperVertexShader.cpp index 4124fb68b..6bc12d7a4 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperVertexShader.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperVertexShader.cpp @@ -21,5 +21,6 @@ void AssetDumperVertexShader::DumpAsset(AssetDumpingContext& context, XAssetInfo if (!shaderFile) return; - shaderFile->write(reinterpret_cast<const char*>(vertexShader->prog.loadDef.program), static_cast<std::streamsize>(vertexShader->prog.loadDef.programSize) * 4u); + shaderFile->write(reinterpret_cast<const char*>(vertexShader->prog.loadDef.program), + static_cast<std::streamsize>(vertexShader->prog.loadDef.programSize) * 4u); } diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperVertexShader.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperVertexShader.h index c2b634306..a9d631ef7 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperVertexShader.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperVertexShader.h @@ -11,4 +11,4 @@ namespace IW4 bool ShouldDump(XAssetInfo<MaterialVertexShader>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<MaterialVertexShader>* asset) override; }; -} +} // namespace IW4 diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperWeapon.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperWeapon.cpp index 1d488b83d..39b320f5c 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperWeapon.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperWeapon.cpp @@ -1,15 +1,15 @@ #include "AssetDumperWeapon.h" -#include <cassert> -#include <cstring> -#include <sstream> -#include <type_traits> - #include "Game/IW4/CommonIW4.h" -#include "Game/IW4/ObjConstantsIW4.h" #include "Game/IW4/InfoString/EnumStrings.h" #include "Game/IW4/InfoString/InfoStringFromStructConverter.h" #include "Game/IW4/InfoString/WeaponFields.h" +#include "Game/IW4/ObjConstantsIW4.h" + +#include <cassert> +#include <cstring> +#include <sstream> +#include <type_traits> using namespace IW4; @@ -67,28 +67,27 @@ namespace IW4 break; case WFT_BOUNCE_SOUND: + { + const auto* bounceSound = *reinterpret_cast<SndAliasCustom**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); + + if (bounceSound && bounceSound->name) { - const auto* bounceSound = *reinterpret_cast<SndAliasCustom**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); + const std::string firstBounceSound(bounceSound->name->soundName); + const auto endOfBouncePrefix = firstBounceSound.rfind("_default"); + assert(endOfBouncePrefix != std::string::npos); - if (bounceSound && bounceSound->name) + if (endOfBouncePrefix != std::string::npos) { - const std::string firstBounceSound(bounceSound->name->soundName); - const auto endOfBouncePrefix = firstBounceSound.rfind("_default"); - assert(endOfBouncePrefix != std::string::npos); - - if (endOfBouncePrefix != std::string::npos) - { - m_info_string.SetValueForKey(std::string(field.szName), - firstBounceSound.substr(0, endOfBouncePrefix)); - } - else - m_info_string.SetValueForKey(std::string(field.szName), ""); + m_info_string.SetValueForKey(std::string(field.szName), firstBounceSound.substr(0, endOfBouncePrefix)); } else m_info_string.SetValueForKey(std::string(field.szName), ""); - - break; } + else + m_info_string.SetValueForKey(std::string(field.szName), ""); + + break; + } case WFT_STICKINESS: FillFromEnumInt(std::string(field.szName), field.iOffset, stickinessNames, std::extent<decltype(stickinessNames)>::value); @@ -119,87 +118,87 @@ namespace IW4 break; case WFT_HIDETAGS: - { - const auto* hideTags = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); - std::stringstream ss; - bool first = true; + { + const auto* hideTags = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); + std::stringstream ss; + bool first = true; - for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::hideTags)>::value; 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()) { - const auto& str = m_get_scr_string(hideTags[i]); - if (!str.empty()) - { - if (!first) - ss << "\n"; - else - first = false; - - ss << str; - } - } + if (!first) + ss << "\n"; + else + first = false; - m_info_string.SetValueForKey(std::string(field.szName), ss.str()); - break; + ss << str; + } } + m_info_string.SetValueForKey(std::string(field.szName), ss.str()); + break; + } + case WFT_NOTETRACKSOUNDMAP: - { - const auto* keys = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); - const auto* values = &keys[std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value]; - std::stringstream ss; - bool first = true; + { + const auto* keys = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); + const auto* values = &keys[std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value]; + std::stringstream ss; + bool first = true; - for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value; 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]); + if (!key.empty()) { - const auto& key = m_get_scr_string(keys[i]); - const auto& value = m_get_scr_string(values[i]); - if (!key.empty()) - { - if (!first) - ss << "\n"; - else - first = false; - - ss << key; - - if (!value.empty()) - ss << " " << value; - } - } + if (!first) + ss << "\n"; + else + first = false; - m_info_string.SetValueForKey(std::string(field.szName), ss.str()); - break; + ss << key; + + if (!value.empty()) + ss << " " << value; + } } + m_info_string.SetValueForKey(std::string(field.szName), ss.str()); + break; + } + case WFT_NOTETRACKRUMBLEMAP: - { - const auto* keys = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); - const auto* values = &keys[std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value]; - std::stringstream ss; - bool first = true; + { + const auto* keys = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); + const auto* values = &keys[std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value]; + std::stringstream ss; + bool first = true; - for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value; 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]); + if (!key.empty()) { - const auto& key = m_get_scr_string(keys[i]); - const auto& value = m_get_scr_string(values[i]); - if (!key.empty()) - { - if (!first) - ss << "\n"; - else - first = false; - - ss << key; - - if (!value.empty()) - ss << " " << value; - } - } + if (!first) + ss << "\n"; + else + first = false; + + ss << key; - m_info_string.SetValueForKey(std::string(field.szName), ss.str()); - break; + if (!value.empty()) + ss << " " << value; + } } + m_info_string.SetValueForKey(std::string(field.szName), ss.str()); + break; + } + case WFT_NUM_FIELD_TYPES: default: assert(false); @@ -208,12 +207,15 @@ namespace IW4 } public: - InfoStringFromWeaponConverter(const WeaponFullDef* structure, const cspField_t* fields, const size_t fieldCount, std::function<std::string(scr_string_t)> scriptStringValueCallback) + InfoStringFromWeaponConverter(const WeaponFullDef* structure, + const cspField_t* fields, + const size_t fieldCount, + std::function<std::string(scr_string_t)> scriptStringValueCallback) : InfoStringFromStructConverter(structure, fields, fieldCount, std::move(scriptStringValueCallback)) { } }; -} +} // namespace IW4 void AssetDumperWeapon::CopyToFullDef(const WeaponCompleteDef* weapon, WeaponFullDef* fullDef) { @@ -263,28 +265,36 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponCompleteDef* weapon, WeaponFul if (fullDef->weapDef.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); + 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) { 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); + 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) { 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); + 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) { 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); + memcpy(fullDef->notetrackRumbleMapValues, + fullDef->weapDef.notetrackRumbleMapValues, + sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackRumbleMapKeys)>::value); fullDef->weapDef.notetrackRumbleMapValues = fullDef->notetrackRumbleMapValues; } @@ -305,14 +315,18 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponCompleteDef* weapon, WeaponFul if (fullDef->weapDef.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); + memcpy(fullDef->perpendicularBounce, + fullDef->weapDef.perpendicularBounce, + sizeof(float) * std::extent<decltype(WeaponFullDef::perpendicularBounce)>::value); fullDef->weapDef.perpendicularBounce = fullDef->perpendicularBounce; } if (fullDef->weapDef.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); + memcpy(fullDef->locationDamageMultipliers, + fullDef->weapDef.locationDamageMultipliers, + sizeof(float) * std::extent<decltype(WeaponFullDef::locationDamageMultipliers)>::value); fullDef->weapDef.locationDamageMultipliers = fullDef->locationDamageMultipliers; } } @@ -323,14 +337,17 @@ InfoString AssetDumperWeapon::CreateInfoString(XAssetInfo<WeaponCompleteDef>* as memset(fullDef.get(), 0, sizeof(WeaponFullDef)); CopyToFullDef(asset->Asset(), fullDef.get()); - InfoStringFromWeaponConverter converter(fullDef.get(), weapon_fields, std::extent<decltype(weapon_fields)>::value, [asset](const scr_string_t scrStr) -> std::string - { - assert(scrStr < asset->m_zone->m_script_strings.Count()); - if (scrStr >= asset->m_zone->m_script_strings.Count()) - return ""; - - return asset->m_zone->m_script_strings[scrStr]; - }); + InfoStringFromWeaponConverter converter(fullDef.get(), + weapon_fields, + std::extent<decltype(weapon_fields)>::value, + [asset](const scr_string_t scrStr) -> std::string + { + assert(scrStr < asset->m_zone->m_script_strings.Count()); + if (scrStr >= asset->m_zone->m_script_strings.Count()) + return ""; + + return asset->m_zone->m_script_strings[scrStr]; + }); return converter.Convert(); } diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperWeapon.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperWeapon.h index 0407b7506..49562dbca 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperWeapon.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperWeapon.h @@ -15,4 +15,4 @@ namespace IW4 bool ShouldDump(XAssetInfo<WeaponCompleteDef>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<WeaponCompleteDef>* asset) override; }; -} +} // namespace IW4 diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperXModel.cpp b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperXModel.cpp index c0243cec6..43f565cf9 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperXModel.cpp +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperXModel.cpp @@ -1,14 +1,14 @@ #include "AssetDumperXModel.h" -#include <cassert> - -#include "ObjWriting.h" #include "Game/IW4/CommonIW4.h" #include "Math/Quaternion.h" #include "Model/XModel/XModelExportWriter.h" +#include "ObjWriting.h" #include "Utils/HalfFloat.h" #include "Utils/QuatInt16.h" +#include <cassert> + using namespace IW4; namespace IW4 @@ -27,7 +27,7 @@ namespace IW4 return true; } }; -} +} // namespace IW4 bool AssetDumperXModel::ShouldDump(XAssetInfo<XModel>* asset) { @@ -287,7 +287,8 @@ void AssetDumperXModel::AddXModelBones(const AssetDumpingContext& context, Abstr bone.globalOffset[0] = model->baseMat[boneNum].trans[0]; bone.globalOffset[1] = model->baseMat[boneNum].trans[1]; bone.globalOffset[2] = model->baseMat[boneNum].trans[2]; - bone.globalRotation = Quaternion32(model->baseMat[boneNum].quat[0], model->baseMat[boneNum].quat[1], model->baseMat[boneNum].quat[2], model->baseMat[boneNum].quat[3]); + bone.globalRotation = + Quaternion32(model->baseMat[boneNum].quat[0], model->baseMat[boneNum].quat[1], model->baseMat[boneNum].quat[2], model->baseMat[boneNum].quat[3]); if (boneNum < model->numRootBones) { @@ -301,12 +302,10 @@ void AssetDumperXModel::AddXModelBones(const AssetDumpingContext& context, Abstr bone.localOffset[0] = model->trans[boneNum - model->numRootBones][0]; bone.localOffset[1] = model->trans[boneNum - model->numRootBones][1]; bone.localOffset[2] = model->trans[boneNum - model->numRootBones][2]; - bone.localRotation = Quaternion32( - QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][0]), - QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][1]), - QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][2]), - QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][3]) - ); + bone.localRotation = Quaternion32(QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][0]), + QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][1]), + QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][2]), + QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][3])); } writer.AddBone(std::move(bone)); @@ -404,7 +403,9 @@ void AssetDumperXModel::AllocateXModelBoneWeights(const XModelSurfs* modelSurfs, weightCollection.weights = std::make_unique<XModelBoneWeight[]>(weightCollection.totalWeightCount); } -void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const XModelSurfs* modelSurfs, XModelVertexBoneWeightCollection& weightCollection) +void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, + const XModelSurfs* modelSurfs, + XModelVertexBoneWeightCollection& weightCollection) { size_t weightOffset = 0u; @@ -420,17 +421,11 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const auto& vertList = surface.vertList[vertListIndex]; const auto* boneWeightOffset = &weightCollection.weights[weightOffset]; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - static_cast<int>(vertList.boneOffset / sizeof(DObjSkelMat)), - 1.0f - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{static_cast<int>(vertList.boneOffset / sizeof(DObjSkelMat)), 1.0f}; for (auto vertListVertexOffset = 0u; vertListVertexOffset < vertList.vertCount; vertListVertexOffset++) { - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 1 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 1}); } handledVertices += vertList.vertCount; } @@ -444,17 +439,11 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, { const auto* boneWeightOffset = &weightCollection.weights[weightOffset]; const auto boneIndex0 = static_cast<int>(surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat)); - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex0, - 1.0f - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, 1.0f}; vertsBlendOffset += 1; - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 1 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 1}); } // 2 bone weights @@ -466,21 +455,12 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const auto boneWeight1 = HalfFloat::ToFloat(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]); const auto boneWeight0 = 1.0f - boneWeight1; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex0, - boneWeight0 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex1, - boneWeight1 - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, boneWeight0}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex1, boneWeight1}; vertsBlendOffset += 3; - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 2 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 2}); } // 3 bone weights @@ -494,25 +474,13 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const auto boneWeight2 = HalfFloat::ToFloat(surface.vertInfo.vertsBlend[vertsBlendOffset + 4]); const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex0, - boneWeight0 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex1, - boneWeight1 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex2, - boneWeight2 - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, boneWeight0}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex1, boneWeight1}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex2, boneWeight2}; vertsBlendOffset += 5; - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 3 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 3}); } // 4 bone weights @@ -528,29 +496,14 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const auto boneWeight3 = HalfFloat::ToFloat(surface.vertInfo.vertsBlend[vertsBlendOffset + 6]); const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2 - boneWeight3; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex0, - boneWeight0 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex1, - boneWeight1 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex2, - boneWeight2 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex3, - boneWeight3 - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, boneWeight0}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex1, boneWeight1}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex2, boneWeight2}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex3, boneWeight3}; vertsBlendOffset += 7; - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 4 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 4}); } handledVertices += surface.vertInfo.vertCount[0] + surface.vertInfo.vertCount[1] + surface.vertInfo.vertCount[2] + surface.vertInfo.vertCount[3]; @@ -558,15 +511,14 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, for (; handledVertices < surface.vertCount; handledVertices++) { - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - nullptr, - 0 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{nullptr, 0}); } } } -void AssetDumperXModel::AddXModelFaces(AbstractXModelWriter& writer, const DistinctMapper<Material*>& materialMapper, const XModelSurfs* modelSurfs, +void AssetDumperXModel::AddXModelFaces(AbstractXModelWriter& writer, + const DistinctMapper<Material*>& materialMapper, + const XModelSurfs* modelSurfs, const int baseSurfaceIndex) { for (auto surfIndex = 0u; surfIndex < modelSurfs->numsurfs; surfIndex++) diff --git a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperXModel.h b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperXModel.h index b4f3af49d..647ce28c1 100644 --- a/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperXModel.h +++ b/src/ObjWriting/Game/IW4/AssetDumpers/AssetDumperXModel.h @@ -2,9 +2,9 @@ #include "Dumping/AbstractAssetDumper.h" #include "Game/IW4/IW4.h" -#include "Utils/DistinctMapper.h" -#include "Model/XModel/AbstractXModelWriter.h" #include "Model/Obj/ObjWriter.h" +#include "Model/XModel/AbstractXModelWriter.h" +#include "Utils/DistinctMapper.h" namespace IW4 { @@ -28,7 +28,8 @@ namespace IW4 static void AddXModelVertices(AbstractXModelWriter& writer, const XModelSurfs* modelSurfs); static void AllocateXModelBoneWeights(const XModelSurfs* modelSurfs, XModelVertexBoneWeightCollection& weightCollection); static void AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const XModelSurfs* modelSurfs, XModelVertexBoneWeightCollection& weightCollection); - static void AddXModelFaces(AbstractXModelWriter& writer, const DistinctMapper<Material*>& materialMapper, const XModelSurfs* modelSurfs, int baseSurfaceIndex); + static void + AddXModelFaces(AbstractXModelWriter& writer, const DistinctMapper<Material*>& materialMapper, const XModelSurfs* modelSurfs, int baseSurfaceIndex); static void DumpXModelExportLod(const AssetDumpingContext& context, XAssetInfo<XModel>* asset, unsigned lod); static void DumpXModelExport(AssetDumpingContext& context, XAssetInfo<XModel>* asset); @@ -36,4 +37,4 @@ namespace IW4 bool ShouldDump(XAssetInfo<XModel>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<XModel>* asset) override; }; -} +} // namespace IW4 diff --git a/src/ObjWriting/Game/IW4/InfoString/InfoStringFromStructConverter.cpp b/src/ObjWriting/Game/IW4/InfoString/InfoStringFromStructConverter.cpp index ca9fe6205..e85a2452f 100644 --- a/src/ObjWriting/Game/IW4/InfoString/InfoStringFromStructConverter.cpp +++ b/src/ObjWriting/Game/IW4/InfoString/InfoStringFromStructConverter.cpp @@ -75,8 +75,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field) case CSPFT_MATERIAL: { - const auto* material = *reinterpret_cast<Material**>(reinterpret_cast<uintptr_t>(m_structure) + field. - iOffset); + const auto* material = *reinterpret_cast<Material**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); if (material) m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(material->info.name))); @@ -87,8 +86,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field) case CSPFT_PHYS_COLLMAP: { - const auto* physCollMap = *reinterpret_cast<PhysCollmap**>(reinterpret_cast<uintptr_t>(m_structure) + field. - iOffset); + const auto* physCollMap = *reinterpret_cast<PhysCollmap**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); if (physCollMap) m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(physCollMap->name))); @@ -99,8 +97,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field) case CSPFT_SOUND: { - const auto* sndAlias = reinterpret_cast<SndAliasCustom*>(reinterpret_cast<uintptr_t>(m_structure) + field. - iOffset); + const auto* sndAlias = reinterpret_cast<SndAliasCustom*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); if (sndAlias->name) m_info_string.SetValueForKey(std::string(field.szName), std::string(sndAlias->name->soundName)); @@ -111,8 +108,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field) case CSPFT_TRACER: { - const auto* tracer = *reinterpret_cast<TracerDef**>(reinterpret_cast<uintptr_t>(m_structure) + field. - iOffset); + const auto* tracer = *reinterpret_cast<TracerDef**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); if (tracer) m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(tracer->name))); @@ -142,18 +138,19 @@ void InfoStringFromStructConverter::FillInfoString() } } -InfoStringFromStructConverter::InfoStringFromStructConverter(const void* structure, const cspField_t* fields, - const size_t fieldCount) +InfoStringFromStructConverter::InfoStringFromStructConverter(const void* structure, const cspField_t* fields, const size_t fieldCount) : InfoStringFromStructConverterBase(structure), - m_fields(fields), - m_field_count(fieldCount) + m_fields(fields), + m_field_count(fieldCount) { } -InfoStringFromStructConverter::InfoStringFromStructConverter(const void* structure, const cspField_t* fields, const size_t fieldCount, - std::function<std::string(scr_string_t)> scriptStringValueCallback) +InfoStringFromStructConverter::InfoStringFromStructConverter(const void* structure, + const cspField_t* fields, + const size_t fieldCount, + std::function<std::string(scr_string_t)> scriptStringValueCallback) : InfoStringFromStructConverterBase(structure, std::move(scriptStringValueCallback)), - m_fields(fields), - m_field_count(fieldCount) + m_fields(fields), + m_field_count(fieldCount) { } diff --git a/src/ObjWriting/Game/IW4/InfoString/InfoStringFromStructConverter.h b/src/ObjWriting/Game/IW4/InfoString/InfoStringFromStructConverter.h index 2e33b602d..03e60a7cd 100644 --- a/src/ObjWriting/Game/IW4/InfoString/InfoStringFromStructConverter.h +++ b/src/ObjWriting/Game/IW4/InfoString/InfoStringFromStructConverter.h @@ -1,6 +1,6 @@ #pragma once -#include "InfoString/InfoStringFromStructConverterBase.h" #include "Game/IW4/IW4.h" +#include "InfoString/InfoStringFromStructConverterBase.h" namespace IW4 { @@ -16,6 +16,9 @@ namespace IW4 public: InfoStringFromStructConverter(const void* structure, const cspField_t* fields, size_t fieldCount); - InfoStringFromStructConverter(const void* structure, const cspField_t* fields, size_t fieldCount, std::function<std::string(scr_string_t)> scriptStringValueCallback); + InfoStringFromStructConverter(const void* structure, + const cspField_t* fields, + size_t fieldCount, + std::function<std::string(scr_string_t)> scriptStringValueCallback); }; -} \ No newline at end of file +} // namespace IW4 diff --git a/src/ObjWriting/Game/IW4/Menu/MenuDumperIW4.cpp b/src/ObjWriting/Game/IW4/Menu/MenuDumperIW4.cpp index 9aa5b3383..d3f301431 100644 --- a/src/ObjWriting/Game/IW4/Menu/MenuDumperIW4.cpp +++ b/src/ObjWriting/Game/IW4/Menu/MenuDumperIW4.cpp @@ -1,12 +1,12 @@ #include "MenuDumperIW4.h" -#include <cmath> +#include "Game/IW4/MenuConstantsIW4.h" +#include "ObjWriting.h" + #include <cassert> +#include <cmath> #include <sstream> -#include "ObjWriting.h" -#include "Game/IW4/MenuConstantsIW4.h" - using namespace IW4; size_t MenuDumper::FindStatementClosingParenthesis(const Statement_s* statement, size_t openingParenthesisPosition) @@ -92,9 +92,7 @@ void MenuDumper::WriteStatementOperator(const Statement_s* statement, size_t& cu const auto& staticDvarEntry = statement->entries[currentPos + 1]; if (staticDvarEntry.type == EET_OPERAND && staticDvarEntry.data.operand.dataType == VAL_INT) { - if (statement->supportingData - && statement->supportingData->staticDvarList.staticDvars - && staticDvarEntry.data.operand.internals.intVal >= 0 + if (statement->supportingData && statement->supportingData->staticDvarList.staticDvars && staticDvarEntry.data.operand.internals.intVal >= 0 && staticDvarEntry.data.operand.internals.intVal < statement->supportingData->staticDvarList.numStaticDvars) { const auto* staticDvar = statement->supportingData->staticDvarList.staticDvars[staticDvarEntry.data.operand.internals.intVal]; @@ -245,9 +243,7 @@ void MenuDumper::WriteStatementSkipInitialUnnecessaryParenthesis(const Statement const auto statementEnd = static_cast<size_t>(statementValue->numEntries); - if (statementValue->numEntries >= 1 - && statementValue->entries[0].type == EET_OPERATOR - && statementValue->entries[0].data.op == OP_LEFTPAREN) + if (statementValue->numEntries >= 1 && statementValue->entries[0].type == EET_OPERATOR && statementValue->entries[0].data.op == OP_LEFTPAREN) { const auto parenthesisEnd = FindStatementClosingParenthesis(statementValue, 0); @@ -296,7 +292,7 @@ void MenuDumper::WriteSetLocalVarData(const std::string& setFunction, const SetL m_stream << ";\n"; } -//#define WRITE_ORIGINAL_SCRIPT +// #define WRITE_ORIGINAL_SCRIPT void MenuDumper::WriteUnconditionalScript(const char* script) const { @@ -360,8 +356,7 @@ void MenuDumper::WriteMenuEventHandlerSet(const MenuEventHandlerSet* eventHandle break; case EVENT_IF: - if (eventHandler->eventData.conditionalScript == nullptr - || eventHandler->eventData.conditionalScript->eventExpression == nullptr + if (eventHandler->eventData.conditionalScript == nullptr || eventHandler->eventData.conditionalScript->eventExpression == nullptr || eventHandler->eventData.conditionalScript->eventHandlerSet == nullptr) { continue; @@ -423,7 +418,8 @@ void MenuDumper::WriteRectProperty(const std::string& propertyKey, const rectDef { Indent(); WriteKey(propertyKey); - m_stream << rect.x << " " << rect.y << " " << rect.w << " " << rect.h << " " << static_cast<int>(rect.horzAlign) << " " << static_cast<int>(rect.vertAlign) << "\n"; + m_stream << rect.x << " " << rect.y << " " << rect.w << " " << rect.h << " " << static_cast<int>(rect.horzAlign) << " " << static_cast<int>(rect.vertAlign) + << "\n"; } void MenuDumper::WriteMaterialProperty(const std::string& propertyKey, const Material* materialValue) const @@ -487,7 +483,7 @@ void MenuDumper::WriteFloatExpressionsProperty(const ItemFloatExpression* floatE continue; std::string propertyName = std::string("exp ") + floatExpressionTargetBindings[floatExpression.target].name + std::string(" ") - + floatExpressionTargetBindings[floatExpression.target].componentName; + + floatExpressionTargetBindings[floatExpression.target].componentName; WriteStatementProperty(propertyName, floatExpression.expression, false); } @@ -533,10 +529,8 @@ void MenuDumper::WriteColumnProperty(const std::string& propertyKey, const listB for (auto i = 0u; i < MENU_KEY_SPACING; i++) m_stream << " "; - m_stream << listBox->columnInfo[col].pos - << " " << listBox->columnInfo[col].width - << " " << listBox->columnInfo[col].maxChars - << " " << listBox->columnInfo[col].alignment << "\n"; + m_stream << listBox->columnInfo[col].pos << " " << listBox->columnInfo[col].width << " " << listBox->columnInfo[col].maxChars << " " + << listBox->columnInfo[col].alignment << "\n"; } } @@ -719,7 +713,7 @@ void MenuDumper::WriteItemData(const itemDef_s* item) // WriteFloatProperty("special", item->special, 0.0f); WriteSoundAliasProperty("focusSound", item->focusSound); WriteStringProperty("dvarTest", item->dvarTest); - + if (item->dvarFlags & ITEM_DVAR_FLAG_ENABLE) WriteMultiTokenStringProperty("enableDvar", item->enableDvar); else if (item->dvarFlags & ITEM_DVAR_FLAG_DISABLE) @@ -796,7 +790,7 @@ void MenuDumper::WriteMenuData(const menuDef_t* menu) WriteStatementProperty("visible", menu->visibleExp, true); else if (menu->window.dynamicFlags[0] & WINDOW_FLAG_VISIBLE) WriteIntProperty("visible", 1, 0); - + WriteStatementProperty("exp rect X", menu->rectXExp, false); WriteStatementProperty("exp rect Y", menu->rectYExp, false); WriteStatementProperty("exp rect W", menu->rectWExp, false); diff --git a/src/ObjWriting/Game/IW4/Menu/MenuDumperIW4.h b/src/ObjWriting/Game/IW4/Menu/MenuDumperIW4.h index 85eaf2c0b..89a843490 100644 --- a/src/ObjWriting/Game/IW4/Menu/MenuDumperIW4.h +++ b/src/ObjWriting/Game/IW4/Menu/MenuDumperIW4.h @@ -1,9 +1,9 @@ #pragma once -#include <string> - -#include "Menu/AbstractMenuDumper.h" #include "Game/IW4/IW4.h" +#include "Menu/AbstractMenuDumper.h" + +#include <string> namespace IW4 { @@ -52,4 +52,4 @@ namespace IW4 void WriteFunctionDef(const std::string& functionName, const Statement_s* statement); void WriteMenu(const menuDef_t* menu); }; -} +} // namespace IW4 diff --git a/src/ObjWriting/Game/IW4/ZoneDumperIW4.cpp b/src/ObjWriting/Game/IW4/ZoneDumperIW4.cpp index 4ed897dc8..b77684d7b 100644 --- a/src/ObjWriting/Game/IW4/ZoneDumperIW4.cpp +++ b/src/ObjWriting/Game/IW4/ZoneDumperIW4.cpp @@ -1,9 +1,5 @@ #include "ZoneDumperIW4.h" -#include "ObjWriting.h" -#include "Game/IW4/GameIW4.h" -#include "Game/IW4/GameAssetPoolIW4.h" - #include "AssetDumpers/AssetDumperAddonMapEnts.h" #include "AssetDumpers/AssetDumperGfxImage.h" #include "AssetDumpers/AssetDumperGfxLightDef.h" @@ -25,6 +21,9 @@ #include "AssetDumpers/AssetDumperVertexShader.h" #include "AssetDumpers/AssetDumperWeapon.h" #include "AssetDumpers/AssetDumperXModel.h" +#include "Game/IW4/GameAssetPoolIW4.h" +#include "Game/IW4/GameIW4.h" +#include "ObjWriting.h" using namespace IW4; @@ -35,11 +34,11 @@ bool ZoneDumper::CanHandleZone(AssetDumpingContext& context) const bool ZoneDumper::DumpZone(AssetDumpingContext& context) const { -#define DUMP_ASSET_POOL(dumperType, poolName, assetType) \ - if(assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \ - { \ - dumperType dumper; \ - dumper.DumpPool(context, assetPools->poolName.get()); \ +#define DUMP_ASSET_POOL(dumperType, poolName, assetType) \ + if (assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \ + { \ + dumperType dumper; \ + dumper.DumpPool(context, assetPools->poolName.get()); \ } const auto* assetPools = dynamic_cast<GameAssetPoolIW4*>(context.m_zone->m_pools.get()); diff --git a/src/ObjWriting/Game/IW4/ZoneDumperIW4.h b/src/ObjWriting/Game/IW4/ZoneDumperIW4.h index c46601785..bfc934d74 100644 --- a/src/ObjWriting/Game/IW4/ZoneDumperIW4.h +++ b/src/ObjWriting/Game/IW4/ZoneDumperIW4.h @@ -9,4 +9,4 @@ namespace IW4 bool CanHandleZone(AssetDumpingContext& context) const override; bool DumpZone(AssetDumpingContext& context) const override; }; -} +} // namespace IW4 diff --git a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperAddonMapEnts.h b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperAddonMapEnts.h index 47a6098e9..9e5ec39de 100644 --- a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperAddonMapEnts.h +++ b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperAddonMapEnts.h @@ -11,4 +11,4 @@ namespace IW5 bool ShouldDump(XAssetInfo<AddonMapEnts>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<AddonMapEnts>* asset) override; }; -} +} // namespace IW5 diff --git a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperGfxImage.cpp b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperGfxImage.cpp index 6c00be0a0..01b644812 100644 --- a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperGfxImage.cpp +++ b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperGfxImage.cpp @@ -1,10 +1,10 @@ #include "AssetDumperGfxImage.h" -#include <cassert> - -#include "ObjWriting.h" -#include "Image/IwiWriter8.h" #include "Image/DdsWriter.h" +#include "Image/IwiWriter8.h" +#include "ObjWriting.h" + +#include <cassert> using namespace IW5; diff --git a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperGfxImage.h b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperGfxImage.h index 64a9267cc..2cd2ec80d 100644 --- a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperGfxImage.h +++ b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperGfxImage.h @@ -1,11 +1,11 @@ #pragma once -#include <memory> - #include "Dumping/AbstractAssetDumper.h" #include "Game/IW5/IW5.h" #include "Image/IImageWriter.h" +#include <memory> + namespace IW5 { class AssetDumperGfxImage final : public AbstractAssetDumper<GfxImage> @@ -21,4 +21,4 @@ namespace IW5 public: AssetDumperGfxImage(); }; -} +} // namespace IW5 diff --git a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperLoadedSound.cpp b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperLoadedSound.cpp index 392d22ea2..54b79491b 100644 --- a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperLoadedSound.cpp +++ b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperLoadedSound.cpp @@ -11,41 +11,25 @@ bool AssetDumperLoadedSound::ShouldDump(XAssetInfo<LoadedSound>* asset) void AssetDumperLoadedSound::DumpWavPcm(AssetDumpingContext& context, 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)); - const WavChunkHeader formatChunkHeader - { - WAV_CHUNK_ID_FMT, - sizeof(WavFormatChunkPcm) - }; + const WavChunkHeader formatChunkHeader{WAV_CHUNK_ID_FMT, sizeof(WavFormatChunkPcm)}; stream.write(reinterpret_cast<const char*>(&formatChunkHeader), sizeof(formatChunkHeader)); - WavFormatChunkPcm formatChunk - { - WavFormat::PCM, - static_cast<uint16_t>(asset->sound.info.channels), - asset->sound.info.rate, - asset->sound.info.rate * asset->sound.info.channels * asset->sound.info.bits / 8, - static_cast<uint16_t>(asset->sound.info.block_size), - static_cast<uint16_t>(asset->sound.info.bits) - }; + WavFormatChunkPcm formatChunk{WavFormat::PCM, + static_cast<uint16_t>(asset->sound.info.channels), + asset->sound.info.rate, + asset->sound.info.rate * asset->sound.info.channels * asset->sound.info.bits / 8, + 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)); - const WavChunkHeader dataChunkHeader - { - WAV_CHUNK_ID_DATA, - asset->sound.info.data_len - }; + const WavChunkHeader dataChunkHeader{WAV_CHUNK_ID_DATA, asset->sound.info.data_len}; stream.write(reinterpret_cast<const char*>(&dataChunkHeader), sizeof(dataChunkHeader)); stream.write(asset->sound.data, asset->sound.info.data_len); } diff --git a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperLoadedSound.h b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperLoadedSound.h index d60e60882..e99ca33ba 100644 --- a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperLoadedSound.h +++ b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperLoadedSound.h @@ -13,4 +13,4 @@ namespace IW5 bool ShouldDump(XAssetInfo<LoadedSound>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<LoadedSound>* asset) override; }; -} +} // namespace IW5 diff --git a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperLocalizeEntry.cpp b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperLocalizeEntry.cpp index 476fc32e1..c46dd95b0 100644 --- a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperLocalizeEntry.cpp +++ b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperLocalizeEntry.cpp @@ -1,9 +1,9 @@ #include "AssetDumperLocalizeEntry.h" -#include <sstream> - -#include "Localize/LocalizeCommon.h" #include "Dumping/Localize/StringFileDumper.h" +#include "Localize/LocalizeCommon.h" + +#include <sstream> using namespace IW5; @@ -40,4 +40,4 @@ void AssetDumperLocalizeEntry::DumpPool(AssetDumpingContext& context, AssetPool< { printf("Could not create string file for dumping localized strings of zone '%s'\n", context.m_zone->m_name.c_str()); } -} \ No newline at end of file +} diff --git a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperLocalizeEntry.h b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperLocalizeEntry.h index ecbd837cd..151dcd739 100644 --- a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperLocalizeEntry.h +++ b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperLocalizeEntry.h @@ -10,4 +10,4 @@ namespace IW5 public: void DumpPool(AssetDumpingContext& context, AssetPool<LocalizeEntry>* pool) override; }; -} +} // namespace IW5 diff --git a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperMenuDef.cpp b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperMenuDef.cpp index 47154ffa0..b14b5dbe4 100644 --- a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperMenuDef.cpp +++ b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperMenuDef.cpp @@ -1,12 +1,12 @@ #include "AssetDumperMenuDef.h" -#include <filesystem> -#include <string> - -#include "ObjWriting.h" #include "Game/IW5/GameAssetPoolIW5.h" #include "Game/IW5/Menu/MenuDumperIW5.h" #include "Menu/AbstractMenuDumper.h" +#include "ObjWriting.h" + +#include <filesystem> +#include <string> namespace fs = std::filesystem; @@ -55,7 +55,7 @@ void AssetDumperMenuDef::DumpAsset(AssetDumpingContext& context, XAssetInfo<menu const auto* menu = asset->Asset(); const auto menuFilePath = GetPathForMenu(asset); - if(ObjWriting::ShouldHandleAssetType(ASSET_TYPE_MENULIST)) + if (ObjWriting::ShouldHandleAssetType(ASSET_TYPE_MENULIST)) { // Don't dump menu file separately if the name matches the menu list const auto* menuListParent = GetParentMenuList(asset); diff --git a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperMenuDef.h b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperMenuDef.h index d965cc91b..696da1999 100644 --- a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperMenuDef.h +++ b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperMenuDef.h @@ -14,4 +14,4 @@ namespace IW5 bool ShouldDump(XAssetInfo<menuDef_t>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<menuDef_t>* asset) override; }; -} +} // namespace IW5 diff --git a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperMenuList.cpp b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperMenuList.cpp index b5909f780..6d529bb03 100644 --- a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperMenuList.cpp +++ b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperMenuList.cpp @@ -1,13 +1,13 @@ #include "AssetDumperMenuList.h" +#include "Game/IW5/Menu/MenuDumperIW5.h" +#include "Menu/AbstractMenuDumper.h" +#include "ObjWriting.h" + #include <cassert> #include <filesystem> -#include <sstream> #include <set> - -#include "ObjWriting.h" -#include "Game/IW5/Menu/MenuDumperIW5.h" -#include "Menu/AbstractMenuDumper.h" +#include <sstream> namespace fs = std::filesystem; @@ -21,17 +21,17 @@ std::vector<const ExpressionSupportingData*> AssetDumperMenuList::GetAllUniqueEx if (menuList->menus == nullptr) return result; - for(auto i = 0; i < menuList->menuCount; i++) + for (auto i = 0; i < menuList->menuCount; i++) { - if(menuList->menus[i] == nullptr) + if (menuList->menus[i] == nullptr) continue; const auto* menu = menuList->menus[i]; - if(menu->data == nullptr || menu->data->expressionData == nullptr) + if (menu->data == nullptr || menu->data->expressionData == nullptr) continue; - if(alreadyAddedSupportingData.find(menu->data->expressionData) == alreadyAddedSupportingData.end()) + if (alreadyAddedSupportingData.find(menu->data->expressionData) == alreadyAddedSupportingData.end()) { result.push_back(menu->data->expressionData); alreadyAddedSupportingData.emplace(menu->data->expressionData); @@ -53,10 +53,10 @@ void AssetDumperMenuList::DumpFunctions(MenuDumper& menuDumper, const MenuList* if (supportingData->uifunctions.functions == nullptr) continue; - for(auto i = 0; i < supportingData->uifunctions.totalFunctions; i++) + for (auto i = 0; i < supportingData->uifunctions.totalFunctions; i++) { const auto* function = supportingData->uifunctions.functions[i]; - if(function == nullptr) + if (function == nullptr) continue; std::stringstream ss; @@ -114,7 +114,7 @@ void AssetDumperMenuList::DumpAsset(AssetDumpingContext& context, XAssetInfo<Men menuDumper.Start(); - if(!ObjWriting::Configuration.MenuLegacyMode) + if (!ObjWriting::Configuration.MenuLegacyMode) DumpFunctions(menuDumper, menuList); DumpMenus(menuDumper, menuList); diff --git a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperMenuList.h b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperMenuList.h index 6f12aaf39..58a83904a 100644 --- a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperMenuList.h +++ b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperMenuList.h @@ -17,4 +17,4 @@ namespace IW5 bool ShouldDump(XAssetInfo<MenuList>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<MenuList>* asset) override; }; -} +} // namespace IW5 diff --git a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperRawFile.cpp b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperRawFile.cpp index 47ef898b1..2a5fca666 100644 --- a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperRawFile.cpp +++ b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperRawFile.cpp @@ -1,7 +1,7 @@ #include "AssetDumperRawFile.h" -#include <zlib.h> #include <stdexcept> +#include <zlib.h> using namespace IW5; diff --git a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperRawFile.h b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperRawFile.h index b1c87b88b..495bc29e8 100644 --- a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperRawFile.h +++ b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperRawFile.h @@ -13,4 +13,4 @@ namespace IW5 bool ShouldDump(XAssetInfo<RawFile>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<RawFile>* asset) override; }; -} +} // namespace IW5 diff --git a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperStringTable.h b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperStringTable.h index bdc480fa9..9e8342675 100644 --- a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperStringTable.h +++ b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperStringTable.h @@ -11,4 +11,4 @@ namespace IW5 bool ShouldDump(XAssetInfo<StringTable>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<StringTable>* asset) override; }; -} +} // namespace IW5 diff --git a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperXModel.cpp b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperXModel.cpp index 34433ea99..865831cac 100644 --- a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperXModel.cpp +++ b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperXModel.cpp @@ -1,14 +1,14 @@ #include "AssetDumperXModel.h" -#include <cassert> - -#include "ObjWriting.h" #include "Game/IW5/CommonIW5.h" #include "Math/Quaternion.h" #include "Model/XModel/XModelExportWriter.h" +#include "ObjWriting.h" #include "Utils/HalfFloat.h" #include "Utils/QuatInt16.h" +#include <cassert> + using namespace IW5; namespace IW5 @@ -27,7 +27,7 @@ namespace IW5 return true; } }; -} +} // namespace IW5 bool AssetDumperXModel::ShouldDump(XAssetInfo<XModel>* asset) { @@ -286,7 +286,8 @@ void AssetDumperXModel::AddXModelBones(const AssetDumpingContext& context, Abstr bone.globalOffset[0] = model->baseMat[boneNum].trans[0]; bone.globalOffset[1] = model->baseMat[boneNum].trans[1]; bone.globalOffset[2] = model->baseMat[boneNum].trans[2]; - bone.globalRotation = Quaternion32(model->baseMat[boneNum].quat[0], model->baseMat[boneNum].quat[1], model->baseMat[boneNum].quat[2], model->baseMat[boneNum].quat[3]); + bone.globalRotation = + Quaternion32(model->baseMat[boneNum].quat[0], model->baseMat[boneNum].quat[1], model->baseMat[boneNum].quat[2], model->baseMat[boneNum].quat[3]); if (boneNum < model->numRootBones) { @@ -300,12 +301,10 @@ void AssetDumperXModel::AddXModelBones(const AssetDumpingContext& context, Abstr bone.localOffset[0] = model->trans[boneNum - model->numRootBones][0]; bone.localOffset[1] = model->trans[boneNum - model->numRootBones][1]; bone.localOffset[2] = model->trans[boneNum - model->numRootBones][2]; - bone.localRotation = Quaternion32( - QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][0]), - QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][1]), - QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][2]), - QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][3]) - ); + bone.localRotation = Quaternion32(QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][0]), + QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][1]), + QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][2]), + QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][3])); } writer.AddBone(std::move(bone)); @@ -403,7 +402,9 @@ void AssetDumperXModel::AllocateXModelBoneWeights(const XModelSurfs* modelSurfs, weightCollection.weights = std::make_unique<XModelBoneWeight[]>(weightCollection.totalWeightCount); } -void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const XModelSurfs* modelSurfs, XModelVertexBoneWeightCollection& weightCollection) +void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, + const XModelSurfs* modelSurfs, + XModelVertexBoneWeightCollection& weightCollection) { size_t weightOffset = 0u; @@ -419,17 +420,11 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const auto& vertList = surface.vertList[vertListIndex]; const auto* boneWeightOffset = &weightCollection.weights[weightOffset]; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - static_cast<int>(vertList.boneOffset / sizeof(DObjSkelMat)), - 1.0f - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{static_cast<int>(vertList.boneOffset / sizeof(DObjSkelMat)), 1.0f}; for (auto vertListVertexOffset = 0u; vertListVertexOffset < vertList.vertCount; vertListVertexOffset++) { - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 1 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 1}); } handledVertices += vertList.vertCount; } @@ -443,17 +438,11 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, { const auto* boneWeightOffset = &weightCollection.weights[weightOffset]; const auto boneIndex0 = static_cast<int>(surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat)); - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex0, - 1.0f - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, 1.0f}; vertsBlendOffset += 1; - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 1 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 1}); } // 2 bone weights @@ -465,21 +454,12 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const auto boneWeight1 = HalfFloat::ToFloat(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]); const auto boneWeight0 = 1.0f - boneWeight1; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex0, - boneWeight0 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex1, - boneWeight1 - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, boneWeight0}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex1, boneWeight1}; vertsBlendOffset += 3; - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 2 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 2}); } // 3 bone weights @@ -493,25 +473,13 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const auto boneWeight2 = HalfFloat::ToFloat(surface.vertInfo.vertsBlend[vertsBlendOffset + 4]); const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex0, - boneWeight0 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex1, - boneWeight1 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex2, - boneWeight2 - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, boneWeight0}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex1, boneWeight1}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex2, boneWeight2}; vertsBlendOffset += 5; - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 3 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 3}); } // 4 bone weights @@ -527,29 +495,14 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const auto boneWeight3 = HalfFloat::ToFloat(surface.vertInfo.vertsBlend[vertsBlendOffset + 6]); const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2 - boneWeight3; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex0, - boneWeight0 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex1, - boneWeight1 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex2, - boneWeight2 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex3, - boneWeight3 - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, boneWeight0}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex1, boneWeight1}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex2, boneWeight2}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex3, boneWeight3}; vertsBlendOffset += 7; - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 4 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 4}); } handledVertices += surface.vertInfo.vertCount[0] + surface.vertInfo.vertCount[1] + surface.vertInfo.vertCount[2] + surface.vertInfo.vertCount[3]; @@ -557,15 +510,14 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, for (; handledVertices < surface.vertCount; handledVertices++) { - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - nullptr, - 0 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{nullptr, 0}); } } } -void AssetDumperXModel::AddXModelFaces(AbstractXModelWriter& writer, const DistinctMapper<Material*>& materialMapper, const XModelSurfs* modelSurfs, +void AssetDumperXModel::AddXModelFaces(AbstractXModelWriter& writer, + const DistinctMapper<Material*>& materialMapper, + const XModelSurfs* modelSurfs, const int baseSurfaceIndex) { for (auto surfIndex = 0u; surfIndex < modelSurfs->numsurfs; surfIndex++) diff --git a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperXModel.h b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperXModel.h index 823c73870..458caba83 100644 --- a/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperXModel.h +++ b/src/ObjWriting/Game/IW5/AssetDumpers/AssetDumperXModel.h @@ -2,9 +2,9 @@ #include "Dumping/AbstractAssetDumper.h" #include "Game/IW5/IW5.h" -#include "Utils/DistinctMapper.h" -#include "Model/XModel/AbstractXModelWriter.h" #include "Model/Obj/ObjWriter.h" +#include "Model/XModel/AbstractXModelWriter.h" +#include "Utils/DistinctMapper.h" namespace IW5 { @@ -28,7 +28,8 @@ namespace IW5 static void AddXModelVertices(AbstractXModelWriter& writer, const XModelSurfs* modelSurfs); static void AllocateXModelBoneWeights(const XModelSurfs* modelSurfs, XModelVertexBoneWeightCollection& weightCollection); static void AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const XModelSurfs* modelSurfs, XModelVertexBoneWeightCollection& weightCollection); - static void AddXModelFaces(AbstractXModelWriter& writer, const DistinctMapper<Material*>& materialMapper, const XModelSurfs* modelSurfs, int baseSurfaceIndex); + static void + AddXModelFaces(AbstractXModelWriter& writer, const DistinctMapper<Material*>& materialMapper, const XModelSurfs* modelSurfs, int baseSurfaceIndex); static void DumpXModelExportLod(const AssetDumpingContext& context, XAssetInfo<XModel>* asset, unsigned lod); static void DumpXModelExport(AssetDumpingContext& context, XAssetInfo<XModel>* asset); @@ -36,4 +37,4 @@ namespace IW5 bool ShouldDump(XAssetInfo<XModel>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<XModel>* asset) override; }; -} +} // namespace IW5 diff --git a/src/ObjWriting/Game/IW5/InfoString/InfoStringFromStructConverter.cpp b/src/ObjWriting/Game/IW5/InfoString/InfoStringFromStructConverter.cpp index 33f30e255..046c164ec 100644 --- a/src/ObjWriting/Game/IW5/InfoString/InfoStringFromStructConverter.cpp +++ b/src/ObjWriting/Game/IW5/InfoString/InfoStringFromStructConverter.cpp @@ -75,8 +75,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field) case CSPFT_MATERIAL: { - const auto* material = *reinterpret_cast<Material**>(reinterpret_cast<uintptr_t>(m_structure) + field. - iOffset); + const auto* material = *reinterpret_cast<Material**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); if (material) m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(material->info.name))); @@ -87,8 +86,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field) case CSPFT_SOUND: { - const auto* sndAlias = reinterpret_cast<SndAliasCustom*>(reinterpret_cast<uintptr_t>(m_structure) + field. - iOffset); + const auto* sndAlias = reinterpret_cast<SndAliasCustom*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); if (sndAlias->name) m_info_string.SetValueForKey(std::string(field.szName), std::string(sndAlias->name->soundName)); @@ -99,8 +97,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field) case CSPFT_TRACER: { - const auto* tracer = *reinterpret_cast<TracerDef**>(reinterpret_cast<uintptr_t>(m_structure) + field. - iOffset); + const auto* tracer = *reinterpret_cast<TracerDef**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); if (tracer) m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(tracer->name))); @@ -130,18 +127,19 @@ void InfoStringFromStructConverter::FillInfoString() } } -InfoStringFromStructConverter::InfoStringFromStructConverter(const void* structure, const cspField_t* fields, - const size_t fieldCount) +InfoStringFromStructConverter::InfoStringFromStructConverter(const void* structure, const cspField_t* fields, const size_t fieldCount) : InfoStringFromStructConverterBase(structure), - m_fields(fields), - m_field_count(fieldCount) + m_fields(fields), + m_field_count(fieldCount) { } -InfoStringFromStructConverter::InfoStringFromStructConverter(const void* structure, const cspField_t* fields, const size_t fieldCount, - std::function<std::string(scr_string_t)> scriptStringValueCallback) +InfoStringFromStructConverter::InfoStringFromStructConverter(const void* structure, + const cspField_t* fields, + const size_t fieldCount, + std::function<std::string(scr_string_t)> scriptStringValueCallback) : InfoStringFromStructConverterBase(structure, std::move(scriptStringValueCallback)), - m_fields(fields), - m_field_count(fieldCount) + m_fields(fields), + m_field_count(fieldCount) { } diff --git a/src/ObjWriting/Game/IW5/InfoString/InfoStringFromStructConverter.h b/src/ObjWriting/Game/IW5/InfoString/InfoStringFromStructConverter.h index 9521faae1..c3c504af1 100644 --- a/src/ObjWriting/Game/IW5/InfoString/InfoStringFromStructConverter.h +++ b/src/ObjWriting/Game/IW5/InfoString/InfoStringFromStructConverter.h @@ -1,6 +1,6 @@ #pragma once -#include "InfoString/InfoStringFromStructConverterBase.h" #include "Game/IW5/IW5.h" +#include "InfoString/InfoStringFromStructConverterBase.h" namespace IW5 { @@ -16,6 +16,9 @@ namespace IW5 public: InfoStringFromStructConverter(const void* structure, const cspField_t* fields, size_t fieldCount); - InfoStringFromStructConverter(const void* structure, const cspField_t* fields, size_t fieldCount, std::function<std::string(scr_string_t)> scriptStringValueCallback); + InfoStringFromStructConverter(const void* structure, + const cspField_t* fields, + size_t fieldCount, + std::function<std::string(scr_string_t)> scriptStringValueCallback); }; -} \ No newline at end of file +} // namespace IW5 diff --git a/src/ObjWriting/Game/IW5/Menu/MenuDumperIW5.cpp b/src/ObjWriting/Game/IW5/Menu/MenuDumperIW5.cpp index cc153b02b..2c0c93d45 100644 --- a/src/ObjWriting/Game/IW5/Menu/MenuDumperIW5.cpp +++ b/src/ObjWriting/Game/IW5/Menu/MenuDumperIW5.cpp @@ -1,12 +1,12 @@ #include "MenuDumperIW5.h" -#include <cmath> +#include "Game/IW5/MenuConstantsIW5.h" +#include "ObjWriting.h" + #include <cassert> +#include <cmath> #include <sstream> -#include "ObjWriting.h" -#include "Game/IW5/MenuConstantsIW5.h" - using namespace IW5; size_t MenuDumper::FindStatementClosingParenthesis(const Statement_s* statement, size_t openingParenthesisPosition) @@ -92,9 +92,7 @@ void MenuDumper::WriteStatementOperator(const Statement_s* statement, size_t& cu const auto& staticDvarEntry = statement->entries[currentPos + 1]; if (staticDvarEntry.type == EET_OPERAND && staticDvarEntry.data.operand.dataType == VAL_INT) { - if (statement->supportingData - && statement->supportingData->staticDvarList.staticDvars - && staticDvarEntry.data.operand.internals.intVal >= 0 + if (statement->supportingData && statement->supportingData->staticDvarList.staticDvars && staticDvarEntry.data.operand.internals.intVal >= 0 && staticDvarEntry.data.operand.internals.intVal < statement->supportingData->staticDvarList.numStaticDvars) { const auto* staticDvar = statement->supportingData->staticDvarList.staticDvars[staticDvarEntry.data.operand.internals.intVal]; @@ -244,9 +242,7 @@ void MenuDumper::WriteStatementSkipInitialUnnecessaryParenthesis(const Statement const auto statementEnd = static_cast<size_t>(statementValue->numEntries); - if (statementValue->numEntries >= 1 - && statementValue->entries[0].type == EET_OPERATOR - && statementValue->entries[0].data.op == OP_LEFTPAREN) + if (statementValue->numEntries >= 1 && statementValue->entries[0].type == EET_OPERATOR && statementValue->entries[0].data.op == OP_LEFTPAREN) { const auto parenthesisEnd = FindStatementClosingParenthesis(statementValue, 0); @@ -295,7 +291,7 @@ void MenuDumper::WriteSetLocalVarData(const std::string& setFunction, const SetL m_stream << ";\n"; } -//#define WRITE_ORIGINAL_SCRIPT +// #define WRITE_ORIGINAL_SCRIPT void MenuDumper::WriteUnconditionalScript(const char* script) const { @@ -359,8 +355,7 @@ void MenuDumper::WriteMenuEventHandlerSet(const MenuEventHandlerSet* eventHandle break; case EVENT_IF: - if (eventHandler->eventData.conditionalScript == nullptr - || eventHandler->eventData.conditionalScript->eventExpression == nullptr + if (eventHandler->eventData.conditionalScript == nullptr || eventHandler->eventData.conditionalScript->eventExpression == nullptr || eventHandler->eventData.conditionalScript->eventHandlerSet == nullptr) { continue; @@ -422,7 +417,8 @@ void MenuDumper::WriteRectProperty(const std::string& propertyKey, const rectDef { Indent(); WriteKey(propertyKey); - m_stream << rect.x << " " << rect.y << " " << rect.w << " " << rect.h << " " << static_cast<int>(rect.horzAlign) << " " << static_cast<int>(rect.vertAlign) << "\n"; + m_stream << rect.x << " " << rect.y << " " << rect.w << " " << rect.h << " " << static_cast<int>(rect.horzAlign) << " " << static_cast<int>(rect.vertAlign) + << "\n"; } void MenuDumper::WriteMaterialProperty(const std::string& propertyKey, const Material* materialValue) const @@ -486,7 +482,7 @@ void MenuDumper::WriteFloatExpressionsProperty(const ItemFloatExpression* floatE continue; std::string propertyName = std::string("exp ") + floatExpressionTargetBindings[floatExpression.target].name + std::string(" ") - + floatExpressionTargetBindings[floatExpression.target].componentName; + + floatExpressionTargetBindings[floatExpression.target].componentName; WriteStatementProperty(propertyName, floatExpression.expression, false); } @@ -532,12 +528,8 @@ void MenuDumper::WriteColumnProperty(const std::string& propertyKey, const listB for (auto i = 0u; i < MENU_KEY_SPACING; i++) m_stream << " "; - m_stream << listBox->columnInfo[col].xpos - << " " << listBox->columnInfo[col].ypos - << " " << listBox->columnInfo[col].width - << " " << listBox->columnInfo[col].height - << " " << listBox->columnInfo[col].maxChars - << " " << listBox->columnInfo[col].alignment << "\n"; + m_stream << listBox->columnInfo[col].xpos << " " << listBox->columnInfo[col].ypos << " " << listBox->columnInfo[col].width << " " + << listBox->columnInfo[col].height << " " << listBox->columnInfo[col].maxChars << " " << listBox->columnInfo[col].alignment << "\n"; } } diff --git a/src/ObjWriting/Game/IW5/Menu/MenuDumperIW5.h b/src/ObjWriting/Game/IW5/Menu/MenuDumperIW5.h index b9fe76a88..4879eb6df 100644 --- a/src/ObjWriting/Game/IW5/Menu/MenuDumperIW5.h +++ b/src/ObjWriting/Game/IW5/Menu/MenuDumperIW5.h @@ -1,9 +1,9 @@ #pragma once -#include <string> - -#include "Menu/AbstractMenuDumper.h" #include "Game/IW5/IW5.h" +#include "Menu/AbstractMenuDumper.h" + +#include <string> namespace IW5 { @@ -52,4 +52,4 @@ namespace IW5 void WriteFunctionDef(const std::string& functionName, const Statement_s* statement); void WriteMenu(const menuDef_t* menu); }; -} +} // namespace IW5 diff --git a/src/ObjWriting/Game/IW5/ZoneDumperIW5.cpp b/src/ObjWriting/Game/IW5/ZoneDumperIW5.cpp index 32f4579b6..c67408c92 100644 --- a/src/ObjWriting/Game/IW5/ZoneDumperIW5.cpp +++ b/src/ObjWriting/Game/IW5/ZoneDumperIW5.cpp @@ -1,9 +1,5 @@ #include "ZoneDumperIW5.h" -#include "ObjWriting.h" -#include "Game/IW5/GameIW5.h" -#include "Game/IW5/GameAssetPoolIW5.h" - #include "AssetDumpers/AssetDumperAddonMapEnts.h" #include "AssetDumpers/AssetDumperGfxImage.h" #include "AssetDumpers/AssetDumperLoadedSound.h" @@ -13,6 +9,9 @@ #include "AssetDumpers/AssetDumperRawFile.h" #include "AssetDumpers/AssetDumperStringTable.h" #include "AssetDumpers/AssetDumperXModel.h" +#include "Game/IW5/GameAssetPoolIW5.h" +#include "Game/IW5/GameIW5.h" +#include "ObjWriting.h" using namespace IW5; @@ -23,11 +22,11 @@ bool ZoneDumper::CanHandleZone(AssetDumpingContext& context) const bool ZoneDumper::DumpZone(AssetDumpingContext& context) const { -#define DUMP_ASSET_POOL(dumperType, poolName, assetType) \ - if(assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \ - { \ - dumperType dumper; \ - dumper.DumpPool(context, assetPools->poolName.get()); \ +#define DUMP_ASSET_POOL(dumperType, poolName, assetType) \ + if (assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \ + { \ + dumperType dumper; \ + dumper.DumpPool(context, assetPools->poolName.get()); \ } const auto* assetPools = dynamic_cast<GameAssetPoolIW5*>(context.m_zone->m_pools.get()); diff --git a/src/ObjWriting/Game/IW5/ZoneDumperIW5.h b/src/ObjWriting/Game/IW5/ZoneDumperIW5.h index 6291a5a94..e471fe115 100644 --- a/src/ObjWriting/Game/IW5/ZoneDumperIW5.h +++ b/src/ObjWriting/Game/IW5/ZoneDumperIW5.h @@ -9,4 +9,4 @@ namespace IW5 bool CanHandleZone(AssetDumpingContext& context) const override; bool DumpZone(AssetDumpingContext& context) const override; }; -} +} // namespace IW5 diff --git a/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperGfxImage.cpp b/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperGfxImage.cpp index 745784d10..fca948780 100644 --- a/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperGfxImage.cpp +++ b/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperGfxImage.cpp @@ -1,10 +1,10 @@ #include "AssetDumperGfxImage.h" -#include <cassert> - -#include "ObjWriting.h" -#include "Image/IwiWriter27.h" #include "Image/DdsWriter.h" +#include "Image/IwiWriter27.h" +#include "ObjWriting.h" + +#include <cassert> using namespace T5; diff --git a/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperGfxImage.h b/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperGfxImage.h index 4bbe63a88..c1a158a22 100644 --- a/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperGfxImage.h +++ b/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperGfxImage.h @@ -1,11 +1,11 @@ #pragma once -#include <memory> - #include "Dumping/AbstractAssetDumper.h" #include "Game/T5/T5.h" #include "Image/IImageWriter.h" +#include <memory> + namespace T5 { class AssetDumperGfxImage final : public AbstractAssetDumper<GfxImage> @@ -21,4 +21,4 @@ namespace T5 public: AssetDumperGfxImage(); }; -} +} // namespace T5 diff --git a/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperLocalizeEntry.cpp b/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperLocalizeEntry.cpp index 0d7d6717a..f78ff324d 100644 --- a/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperLocalizeEntry.cpp +++ b/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperLocalizeEntry.cpp @@ -1,9 +1,9 @@ #include "AssetDumperLocalizeEntry.h" -#include <sstream> - -#include "Localize/LocalizeCommon.h" #include "Dumping/Localize/StringFileDumper.h" +#include "Localize/LocalizeCommon.h" + +#include <sstream> using namespace T5; @@ -40,4 +40,4 @@ void AssetDumperLocalizeEntry::DumpPool(AssetDumpingContext& context, AssetPool< { printf("Could not create string file for dumping localized strings of zone '%s'\n", context.m_zone->m_name.c_str()); } -} \ No newline at end of file +} diff --git a/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperLocalizeEntry.h b/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperLocalizeEntry.h index 03d4e99f2..e4aec7e8a 100644 --- a/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperLocalizeEntry.h +++ b/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperLocalizeEntry.h @@ -10,4 +10,4 @@ namespace T5 public: void DumpPool(AssetDumpingContext& context, AssetPool<LocalizeEntry>* pool) override; }; -} +} // namespace T5 diff --git a/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperRawFile.cpp b/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperRawFile.cpp index 0c1d883ed..1bba8ebb7 100644 --- a/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperRawFile.cpp +++ b/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperRawFile.cpp @@ -23,13 +23,13 @@ void AssetDumperRawFile::DumpGsc(AssetDumpingContext& context, XAssetInfo<RawFil assert(inLen == static_cast<unsigned>(rawFile->len) - 8); - if(inLen > static_cast<unsigned>(rawFile->len - 8) + 1) + if (inLen > static_cast<unsigned>(rawFile->len - 8) + 1) { std::cout << "Invalid compression of gsc file \"" << rawFile->name << "\": " << inLen << std::endl; return; } - if(outLen > GSC_MAX_SIZE) + if (outLen > GSC_MAX_SIZE) { std::cout << "Invalid size of gsc file \"" << rawFile->name << "\": " << outLen << std::endl; return; @@ -71,7 +71,7 @@ void AssetDumperRawFile::DumpGsc(AssetDumpingContext& context, XAssetInfo<RawFil const auto inflateOutSize = sizeof buffer - zs.avail_out; - if(writtenSize + inflateOutSize >= outLen) + if (writtenSize + inflateOutSize >= outLen) { // Last byte is a \0 byte. Skip it. stream.write(reinterpret_cast<char*>(buffer), inflateOutSize - 1); @@ -111,4 +111,4 @@ void AssetDumperRawFile::DumpAsset(AssetDumpingContext& context, XAssetInfo<RawF { stream.write(rawFile->buffer, rawFile->len); } -} \ No newline at end of file +} diff --git a/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperRawFile.h b/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperRawFile.h index de3e8ddc1..b2d107632 100644 --- a/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperRawFile.h +++ b/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperRawFile.h @@ -15,4 +15,4 @@ namespace T5 bool ShouldDump(XAssetInfo<RawFile>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<RawFile>* asset) override; }; -} +} // namespace T5 diff --git a/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperStringTable.cpp b/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperStringTable.cpp index ba164c801..10899c2e2 100644 --- a/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperStringTable.cpp +++ b/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperStringTable.cpp @@ -29,4 +29,4 @@ void AssetDumperStringTable::DumpAsset(AssetDumpingContext& context, XAssetInfo< csv.NextRow(); } -} \ No newline at end of file +} diff --git a/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperStringTable.h b/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperStringTable.h index cbbd86ea9..64b2739c5 100644 --- a/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperStringTable.h +++ b/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperStringTable.h @@ -11,4 +11,4 @@ namespace T5 bool ShouldDump(XAssetInfo<StringTable>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<StringTable>* asset) override; }; -} +} // namespace T5 diff --git a/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperXModel.cpp b/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperXModel.cpp index 5f41c5702..5997be6bd 100644 --- a/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperXModel.cpp +++ b/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperXModel.cpp @@ -1,15 +1,15 @@ #include "AssetDumperXModel.h" -#include <cassert> -#include <sstream> - -#include "ObjWriting.h" #include "Game/T5/CommonT5.h" #include "Math/Quaternion.h" #include "Model/XModel/XModelExportWriter.h" +#include "ObjWriting.h" #include "Utils/HalfFloat.h" #include "Utils/QuatInt16.h" +#include <cassert> +#include <sstream> + using namespace T5; bool AssetDumperXModel::ShouldDump(XAssetInfo<XModel>* asset) @@ -21,7 +21,7 @@ GfxImage* AssetDumperXModel::GetMaterialColorMap(const Material* material) { std::vector<MaterialTextureDef*> potentialTextureDefs; - for(auto textureIndex = 0u; textureIndex < material->textureCount; textureIndex++) + for (auto textureIndex = 0u; textureIndex < material->textureCount; textureIndex++) { MaterialTextureDef* def = &material->textureTable[textureIndex]; @@ -34,7 +34,7 @@ GfxImage* AssetDumperXModel::GetMaterialColorMap(const Material* material) if (potentialTextureDefs.size() == 1) return potentialTextureDefs[0]->u.image; - for(const auto* def : potentialTextureDefs) + for (const auto* def : potentialTextureDefs) { if (def->nameStart == 'c' && def->nameEnd == 'p') return def->u.image; @@ -273,7 +273,8 @@ void AssetDumperXModel::AddXModelBones(const AssetDumpingContext& context, Abstr bone.globalOffset[0] = model->baseMat[boneNum].trans[0]; bone.globalOffset[1] = model->baseMat[boneNum].trans[1]; bone.globalOffset[2] = model->baseMat[boneNum].trans[2]; - bone.globalRotation = Quaternion32(model->baseMat[boneNum].quat[0], model->baseMat[boneNum].quat[1], model->baseMat[boneNum].quat[2], model->baseMat[boneNum].quat[3]); + bone.globalRotation = + Quaternion32(model->baseMat[boneNum].quat[0], model->baseMat[boneNum].quat[1], model->baseMat[boneNum].quat[2], model->baseMat[boneNum].quat[3]); if (boneNum < model->numRootBones) { @@ -287,12 +288,10 @@ void AssetDumperXModel::AddXModelBones(const AssetDumpingContext& context, Abstr bone.localOffset[0] = model->trans[boneNum - model->numRootBones][0]; bone.localOffset[1] = model->trans[boneNum - model->numRootBones][1]; bone.localOffset[2] = model->trans[boneNum - model->numRootBones][2]; - bone.localRotation = Quaternion32( - QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][0]), - QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][1]), - QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][2]), - QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][3]) - ); + bone.localRotation = Quaternion32(QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][0]), + QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][1]), + QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][2]), + QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][3])); } writer.AddBone(std::move(bone)); @@ -398,7 +397,10 @@ void AssetDumperXModel::AllocateXModelBoneWeights(const XModel* model, const uns weightCollection.weights = std::make_unique<XModelBoneWeight[]>(weightCollection.totalWeightCount); } -void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const XModel* model, const unsigned lod, XModelVertexBoneWeightCollection& weightCollection) +void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, + const XModel* model, + const unsigned lod, + XModelVertexBoneWeightCollection& weightCollection) { const auto* surfs = &model->surfs[model->lodInfo[lod].surfIndex]; const auto surfCount = model->lodInfo[lod].numsurfs; @@ -417,17 +419,11 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const auto& vertList = surface.vertList[vertListIndex]; const auto* boneWeightOffset = &weightCollection.weights[weightOffset]; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - static_cast<int>(vertList.boneOffset / sizeof(DObjSkelMat)), - 1.0f - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{static_cast<int>(vertList.boneOffset / sizeof(DObjSkelMat)), 1.0f}; for (auto vertListVertexOffset = 0u; vertListVertexOffset < vertList.vertCount; vertListVertexOffset++) { - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 1 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 1}); } handledVertices += vertList.vertCount; } @@ -441,17 +437,11 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, { const auto* boneWeightOffset = &weightCollection.weights[weightOffset]; const auto boneIndex0 = static_cast<int>(surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat)); - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex0, - 1.0f - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, 1.0f}; vertsBlendOffset += 1; - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 1 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 1}); } // 2 bone weights @@ -463,21 +453,12 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const auto boneWeight1 = HalfFloat::ToFloat(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]); const auto boneWeight0 = 1.0f - boneWeight1; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex0, - boneWeight0 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex1, - boneWeight1 - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, boneWeight0}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex1, boneWeight1}; vertsBlendOffset += 3; - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 2 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 2}); } // 3 bone weights @@ -491,25 +472,13 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const auto boneWeight2 = HalfFloat::ToFloat(surface.vertInfo.vertsBlend[vertsBlendOffset + 4]); const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex0, - boneWeight0 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex1, - boneWeight1 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex2, - boneWeight2 - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, boneWeight0}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex1, boneWeight1}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex2, boneWeight2}; vertsBlendOffset += 5; - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 3 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 3}); } // 4 bone weights @@ -525,29 +494,14 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const auto boneWeight3 = HalfFloat::ToFloat(surface.vertInfo.vertsBlend[vertsBlendOffset + 6]); const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2 - boneWeight3; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex0, - boneWeight0 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex1, - boneWeight1 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex2, - boneWeight2 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex3, - boneWeight3 - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, boneWeight0}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex1, boneWeight1}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex2, boneWeight2}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex3, boneWeight3}; vertsBlendOffset += 7; - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 4 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 4}); } handledVertices += surface.vertInfo.vertCount[0] + surface.vertInfo.vertCount[1] + surface.vertInfo.vertCount[2] + surface.vertInfo.vertCount[3]; @@ -555,10 +509,7 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, for (; handledVertices < surface.vertCount; handledVertices++) { - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - nullptr, - 0 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{nullptr, 0}); } } } diff --git a/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperXModel.h b/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperXModel.h index 41f16b536..bd96b00e6 100644 --- a/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperXModel.h +++ b/src/ObjWriting/Game/T5/AssetDumpers/AssetDumperXModel.h @@ -2,9 +2,9 @@ #include "Dumping/AbstractAssetDumper.h" #include "Game/T5/T5.h" -#include "Utils/DistinctMapper.h" -#include "Model/XModel/AbstractXModelWriter.h" #include "Model/Obj/ObjWriter.h" +#include "Model/XModel/AbstractXModelWriter.h" +#include "Utils/DistinctMapper.h" namespace T5 { @@ -27,7 +27,8 @@ namespace T5 static void AddXModelObjects(AbstractXModelWriter& writer, const XModel* model, unsigned lod); static void AddXModelVertices(AbstractXModelWriter& writer, const XModel* model, unsigned lod); static void AllocateXModelBoneWeights(const XModel* model, unsigned lod, XModelVertexBoneWeightCollection& weightCollection); - static void AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const XModel* model, unsigned lod, XModelVertexBoneWeightCollection& weightCollection); + static void + AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const XModel* model, unsigned lod, XModelVertexBoneWeightCollection& weightCollection); static void AddXModelFaces(AbstractXModelWriter& writer, const DistinctMapper<Material*>& materialMapper, const XModel* model, unsigned lod); static void DumpXModelExportLod(const AssetDumpingContext& context, XAssetInfo<XModel>* asset, unsigned lod); static void DumpXModelExport(const AssetDumpingContext& context, XAssetInfo<XModel>* asset); @@ -36,4 +37,4 @@ namespace T5 bool ShouldDump(XAssetInfo<XModel>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<XModel>* asset) override; }; -} +} // namespace T5 diff --git a/src/ObjWriting/Game/T5/ZoneDumperT5.cpp b/src/ObjWriting/Game/T5/ZoneDumperT5.cpp index 3d8fd3c56..891fb7c76 100644 --- a/src/ObjWriting/Game/T5/ZoneDumperT5.cpp +++ b/src/ObjWriting/Game/T5/ZoneDumperT5.cpp @@ -1,18 +1,17 @@ #include "ZoneDumperT5.h" -#include "ObjWriting.h" -#include "Game/T5/GameT5.h" -#include "Game/T5/GameAssetPoolT5.h" - -#include "AssetDumpers/AssetDumperRawFile.h" -#include "AssetDumpers/AssetDumperStringTable.h" -#include "AssetDumpers/AssetDumperLocalizeEntry.h" #include "AssetDumpers/AssetDumperGfxImage.h" +#include "AssetDumpers/AssetDumperLocalizeEntry.h" #include "AssetDumpers/AssetDumperPhysConstraints.h" #include "AssetDumpers/AssetDumperPhysPreset.h" +#include "AssetDumpers/AssetDumperRawFile.h" #include "AssetDumpers/AssetDumperSndBank.h" +#include "AssetDumpers/AssetDumperStringTable.h" #include "AssetDumpers/AssetDumperWeapon.h" #include "AssetDumpers/AssetDumperXModel.h" +#include "Game/T5/GameAssetPoolT5.h" +#include "Game/T5/GameT5.h" +#include "ObjWriting.h" using namespace T5; @@ -23,11 +22,11 @@ bool ZoneDumper::CanHandleZone(AssetDumpingContext& context) const bool ZoneDumper::DumpZone(AssetDumpingContext& context) const { -#define DUMP_ASSET_POOL(dumperType, poolName, assetType) \ - if(assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \ - { \ - dumperType dumper; \ - dumper.DumpPool(context, assetPools->poolName.get()); \ +#define DUMP_ASSET_POOL(dumperType, poolName, assetType) \ + if (assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \ + { \ + dumperType dumper; \ + dumper.DumpPool(context, assetPools->poolName.get()); \ } const auto* assetPools = dynamic_cast<GameAssetPoolT5*>(context.m_zone->m_pools.get()); diff --git a/src/ObjWriting/Game/T5/ZoneDumperT5.h b/src/ObjWriting/Game/T5/ZoneDumperT5.h index 5d90906f8..6e07068d8 100644 --- a/src/ObjWriting/Game/T5/ZoneDumperT5.h +++ b/src/ObjWriting/Game/T5/ZoneDumperT5.h @@ -9,4 +9,4 @@ namespace T5 bool CanHandleZone(AssetDumpingContext& context) const override; bool DumpZone(AssetDumpingContext& context) const override; }; -} +} // namespace T5 diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.cpp index cbb02436f..3ceb26186 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.cpp @@ -23,123 +23,105 @@ class AssetDumperFontIconInternal }; inline static const std::string TYPE_ICON = "icon"; - inline static const std::string ICON_HEADERS[] - { - "# index", - "# type", - "# name", - "# material", - "# size", - "# xScale", - "# yScale" - }; + inline static const std::string ICON_HEADERS[]{"# index", "# type", "# name", "# material", "# size", "# xScale", "# yScale"}; inline static const std::string TYPE_ALIAS = "alias"; - inline static const std::string ALIAS_HEADERS[] - { - "# index", - "# type", - "# alias", - "# button" - }; - - inline static const KnownAlias KNOWN_ALIASES[] - { - KnownAlias("BUTTON_ADS"), - KnownAlias("BUTTON_CAC_NEXT"), - KnownAlias("BUTTON_CAC_PREV"), - KnownAlias("BUTTON_CANCEL"), - KnownAlias("BUTTON_CAROUSEL_STICK"), - KnownAlias("BUTTON_CREATE"), - KnownAlias("BUTTON_CYCLE_LEFT"), - KnownAlias("BUTTON_CYCLE_LEFT_ACTIVE"), - KnownAlias("BUTTON_CYCLE_RIGHT"), - KnownAlias("BUTTON_CYCLE_RIGHT_ACTIVE"), - KnownAlias("BUTTON_DELETE"), - KnownAlias("BUTTON_EDIT"), - KnownAlias("BUTTON_EMBLEM_BACKWARD"), - KnownAlias("BUTTON_EMBLEM_FLIP"), - KnownAlias("BUTTON_EMBLEM_FORWARD"), - KnownAlias("BUTTON_EMBLEM_FORWARD_BACKWARD"), - KnownAlias("BUTTON_EMBLEM_MOVE"), - KnownAlias("BUTTON_EMBLEM_OUTLINE"), - KnownAlias("BUTTON_EMBLEM_PALETTE_CYCLE"), - KnownAlias("BUTTON_EMBLEM_PALETTE_NEXT"), - KnownAlias("BUTTON_EMBLEM_PALETTE_PREV"), - KnownAlias("BUTTON_EMBLEM_RESET"), - KnownAlias("BUTTON_EMBLEM_ROTATE_LEFT"), - KnownAlias("BUTTON_EMBLEM_ROTATE_RIGHT"), - KnownAlias("BUTTON_EMBLEM_SCALE"), - KnownAlias("BUTTON_FIRE"), - KnownAlias("BUTTON_FRIENDSLIST"), - KnownAlias("BUTTON_INTERACT"), - KnownAlias("BUTTON_LOOKSTICK"), - KnownAlias("BUTTON_LOOK"), - KnownAlias("BUTTON_LUI_ALT1"), - KnownAlias("BUTTON_LUI_ALT2"), - KnownAlias("BUTTON_LUI_DPAD_ALL"), - KnownAlias("BUTTON_LUI_DPAD_D"), - KnownAlias("BUTTON_LUI_DPAD_L"), - KnownAlias("BUTTON_LUI_DPAD_RL"), - KnownAlias("BUTTON_LUI_DPAD_R"), - KnownAlias("BUTTON_LUI_DPAD_UD"), - KnownAlias("BUTTON_LUI_DPAD_U"), - KnownAlias("BUTTON_LUI_LEFT_STICK_UP"), - KnownAlias("BUTTON_LUI_LEFT_TRIGGER"), - KnownAlias("BUTTON_LUI_PRIMARY"), - KnownAlias("BUTTON_LUI_RIGHT_STICK"), - KnownAlias("BUTTON_LUI_RIGHT_TRIGGER"), - KnownAlias("BUTTON_LUI_SECONDARY"), - KnownAlias("BUTTON_LUI_SELECT"), - KnownAlias("BUTTON_LUI_SHOULDERL"), - KnownAlias("BUTTON_LUI_SHOULDERR"), - KnownAlias("BUTTON_LUI_START"), - KnownAlias("BUTTON_MOUSE_CLICK"), - KnownAlias("BUTTON_MOUSE_CLICK_ACTIVE"), - KnownAlias("BUTTON_MOUSE_EDIT"), - KnownAlias("BUTTON_MOUSE_EDIT_ACTIVE"), - KnownAlias("BUTTON_MOUSE_LEFT"), - KnownAlias("BUTTON_MOUSE_MIDDLE"), - KnownAlias("BUTTON_MOUSE_RIGHT"), - KnownAlias("BUTTON_MOVESTICK"), - KnownAlias("BUTTON_MOVE"), - KnownAlias("BUTTON_MP_CANCELCOMMAND"), - KnownAlias("BUTTON_MP_CHANGESETTINGS"), - KnownAlias("BUTTON_MP_GAMERCARD"), - KnownAlias("BUTTON_MP_GAMERREVIEW"), - KnownAlias("BUTTON_MP_JOINGAME"), - KnownAlias("BUTTON_MP_KICKPLAYER"), - KnownAlias("BUTTON_MP_LEAVEGAME"), - KnownAlias("BUTTON_MP_LOBBY_GAMERCARD"), - KnownAlias("BUTTON_MP_NOTREADY"), - KnownAlias("BUTTON_MP_PGDOWN"), - KnownAlias("BUTTON_MP_PGUP"), - KnownAlias("BUTTON_MP_READY"), - KnownAlias("BUTTON_MP_REFRESH"), - KnownAlias("BUTTON_MP_SCOREBOARD"), - KnownAlias("BUTTON_MP_SIGNIN"), - KnownAlias("BUTTON_MP_SPECNEXT"), - KnownAlias("BUTTON_MP_SPECPREV"), - KnownAlias("BUTTON_MP_STARTGAME"), - KnownAlias("BUTTON_MP_TOGGLECHASECAM"), - KnownAlias("BUTTON_MP_TOGGLEVIEW"), - KnownAlias("BUTTON_NO"), - KnownAlias("BUTTON_RECORD_VIEW_NEXT"), - KnownAlias("BUTTON_RECORD_VIEW_PREV"), - KnownAlias("BUTTON_SELECTCHOICE"), - KnownAlias("BUTTON_SP_TOGGLEMENU"), - KnownAlias("BUTTON_YES"), - KnownAlias("CP"), - KnownAlias("FONT_CAPITAL_I"), - KnownAlias("FONT_NUMBER_ZERO"), - KnownAlias("KEY_DOWN_ARROW"), - KnownAlias("KEY_LEFT_ARROW"), - KnownAlias("KEY_RIGHT_ARROW"), - KnownAlias("KEY_UP_ARROW"), - KnownAlias("MOUSE_WHEEL_DOWN"), - KnownAlias("MOUSE_WHEEL_UP"), - KnownAlias("Remote_LStick") - }; + inline static const std::string ALIAS_HEADERS[]{"# index", "# type", "# alias", "# button"}; + + inline static const KnownAlias KNOWN_ALIASES[]{KnownAlias("BUTTON_ADS"), + KnownAlias("BUTTON_CAC_NEXT"), + KnownAlias("BUTTON_CAC_PREV"), + KnownAlias("BUTTON_CANCEL"), + KnownAlias("BUTTON_CAROUSEL_STICK"), + KnownAlias("BUTTON_CREATE"), + KnownAlias("BUTTON_CYCLE_LEFT"), + KnownAlias("BUTTON_CYCLE_LEFT_ACTIVE"), + KnownAlias("BUTTON_CYCLE_RIGHT"), + KnownAlias("BUTTON_CYCLE_RIGHT_ACTIVE"), + KnownAlias("BUTTON_DELETE"), + KnownAlias("BUTTON_EDIT"), + KnownAlias("BUTTON_EMBLEM_BACKWARD"), + KnownAlias("BUTTON_EMBLEM_FLIP"), + KnownAlias("BUTTON_EMBLEM_FORWARD"), + KnownAlias("BUTTON_EMBLEM_FORWARD_BACKWARD"), + KnownAlias("BUTTON_EMBLEM_MOVE"), + KnownAlias("BUTTON_EMBLEM_OUTLINE"), + KnownAlias("BUTTON_EMBLEM_PALETTE_CYCLE"), + KnownAlias("BUTTON_EMBLEM_PALETTE_NEXT"), + KnownAlias("BUTTON_EMBLEM_PALETTE_PREV"), + KnownAlias("BUTTON_EMBLEM_RESET"), + KnownAlias("BUTTON_EMBLEM_ROTATE_LEFT"), + KnownAlias("BUTTON_EMBLEM_ROTATE_RIGHT"), + KnownAlias("BUTTON_EMBLEM_SCALE"), + KnownAlias("BUTTON_FIRE"), + KnownAlias("BUTTON_FRIENDSLIST"), + KnownAlias("BUTTON_INTERACT"), + KnownAlias("BUTTON_LOOKSTICK"), + KnownAlias("BUTTON_LOOK"), + KnownAlias("BUTTON_LUI_ALT1"), + KnownAlias("BUTTON_LUI_ALT2"), + KnownAlias("BUTTON_LUI_DPAD_ALL"), + KnownAlias("BUTTON_LUI_DPAD_D"), + KnownAlias("BUTTON_LUI_DPAD_L"), + KnownAlias("BUTTON_LUI_DPAD_RL"), + KnownAlias("BUTTON_LUI_DPAD_R"), + KnownAlias("BUTTON_LUI_DPAD_UD"), + KnownAlias("BUTTON_LUI_DPAD_U"), + KnownAlias("BUTTON_LUI_LEFT_STICK_UP"), + KnownAlias("BUTTON_LUI_LEFT_TRIGGER"), + KnownAlias("BUTTON_LUI_PRIMARY"), + KnownAlias("BUTTON_LUI_RIGHT_STICK"), + KnownAlias("BUTTON_LUI_RIGHT_TRIGGER"), + KnownAlias("BUTTON_LUI_SECONDARY"), + KnownAlias("BUTTON_LUI_SELECT"), + KnownAlias("BUTTON_LUI_SHOULDERL"), + KnownAlias("BUTTON_LUI_SHOULDERR"), + KnownAlias("BUTTON_LUI_START"), + KnownAlias("BUTTON_MOUSE_CLICK"), + KnownAlias("BUTTON_MOUSE_CLICK_ACTIVE"), + KnownAlias("BUTTON_MOUSE_EDIT"), + KnownAlias("BUTTON_MOUSE_EDIT_ACTIVE"), + KnownAlias("BUTTON_MOUSE_LEFT"), + KnownAlias("BUTTON_MOUSE_MIDDLE"), + KnownAlias("BUTTON_MOUSE_RIGHT"), + KnownAlias("BUTTON_MOVESTICK"), + KnownAlias("BUTTON_MOVE"), + KnownAlias("BUTTON_MP_CANCELCOMMAND"), + KnownAlias("BUTTON_MP_CHANGESETTINGS"), + KnownAlias("BUTTON_MP_GAMERCARD"), + KnownAlias("BUTTON_MP_GAMERREVIEW"), + KnownAlias("BUTTON_MP_JOINGAME"), + KnownAlias("BUTTON_MP_KICKPLAYER"), + KnownAlias("BUTTON_MP_LEAVEGAME"), + KnownAlias("BUTTON_MP_LOBBY_GAMERCARD"), + KnownAlias("BUTTON_MP_NOTREADY"), + KnownAlias("BUTTON_MP_PGDOWN"), + KnownAlias("BUTTON_MP_PGUP"), + KnownAlias("BUTTON_MP_READY"), + KnownAlias("BUTTON_MP_REFRESH"), + KnownAlias("BUTTON_MP_SCOREBOARD"), + KnownAlias("BUTTON_MP_SIGNIN"), + KnownAlias("BUTTON_MP_SPECNEXT"), + KnownAlias("BUTTON_MP_SPECPREV"), + KnownAlias("BUTTON_MP_STARTGAME"), + KnownAlias("BUTTON_MP_TOGGLECHASECAM"), + KnownAlias("BUTTON_MP_TOGGLEVIEW"), + KnownAlias("BUTTON_NO"), + KnownAlias("BUTTON_RECORD_VIEW_NEXT"), + KnownAlias("BUTTON_RECORD_VIEW_PREV"), + KnownAlias("BUTTON_SELECTCHOICE"), + KnownAlias("BUTTON_SP_TOGGLEMENU"), + KnownAlias("BUTTON_YES"), + KnownAlias("CP"), + KnownAlias("FONT_CAPITAL_I"), + KnownAlias("FONT_NUMBER_ZERO"), + KnownAlias("KEY_DOWN_ARROW"), + KnownAlias("KEY_LEFT_ARROW"), + KnownAlias("KEY_RIGHT_ARROW"), + KnownAlias("KEY_UP_ARROW"), + KnownAlias("MOUSE_WHEEL_DOWN"), + KnownAlias("MOUSE_WHEEL_UP"), + KnownAlias("Remote_LStick")}; CsvOutputStream m_csv; diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.h index 23f1d54f7..0581829f0 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.h @@ -11,4 +11,4 @@ namespace T6 bool ShouldDump(XAssetInfo<FontIcon>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<FontIcon>* asset) override; }; -} +} // namespace T6 diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperGfxImage.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperGfxImage.cpp index a205c05d8..f51e26e98 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperGfxImage.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperGfxImage.cpp @@ -1,10 +1,10 @@ #include "AssetDumperGfxImage.h" -#include <cassert> - -#include "ObjWriting.h" -#include "Image/IwiWriter27.h" #include "Image/DdsWriter.h" +#include "Image/IwiWriter27.h" +#include "ObjWriting.h" + +#include <cassert> using namespace T6; diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperGfxImage.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperGfxImage.h index 456dd84b8..820c90ae8 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperGfxImage.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperGfxImage.h @@ -1,11 +1,11 @@ #pragma once -#include <memory> - #include "Dumping/AbstractAssetDumper.h" #include "Game/T6/T6.h" #include "Image/IImageWriter.h" +#include <memory> + namespace T6 { class AssetDumperGfxImage final : public AbstractAssetDumper<GfxImage> @@ -21,4 +21,4 @@ namespace T6 public: AssetDumperGfxImage(); }; -} +} // namespace T6 diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperLocalizeEntry.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperLocalizeEntry.cpp index 212ff1900..0f5257c32 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperLocalizeEntry.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperLocalizeEntry.cpp @@ -1,9 +1,9 @@ #include "AssetDumperLocalizeEntry.h" -#include <sstream> - -#include "Localize/LocalizeCommon.h" #include "Dumping/Localize/StringFileDumper.h" +#include "Localize/LocalizeCommon.h" + +#include <sstream> using namespace T6; @@ -29,7 +29,7 @@ void AssetDumperLocalizeEntry::DumpPool(AssetDumpingContext& context, AssetPool< stringFileDumper.SetNotes(""); - for(auto* localizeEntry : *pool) + for (auto* localizeEntry : *pool) { stringFileDumper.WriteLocalizeEntry(localizeEntry->m_name, localizeEntry->Asset()->value); } @@ -40,4 +40,4 @@ void AssetDumperLocalizeEntry::DumpPool(AssetDumpingContext& context, AssetPool< { printf("Could not create string file for dumping localized strings of zone '%s'\n", context.m_zone->m_name.c_str()); } -} \ No newline at end of file +} diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperLocalizeEntry.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperLocalizeEntry.h index 06d7cfe2c..d85de9ac3 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperLocalizeEntry.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperLocalizeEntry.h @@ -10,4 +10,4 @@ namespace T6 public: void DumpPool(AssetDumpingContext& context, AssetPool<LocalizeEntry>* pool) override; }; -} +} // namespace T6 diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperPhysConstraints.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperPhysConstraints.cpp index 7568ef9e4..95b171440 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperPhysConstraints.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperPhysConstraints.cpp @@ -1,12 +1,12 @@ #include "AssetDumperPhysConstraints.h" -#include <cassert> -#include <type_traits> - -#include "Game/T6/ObjConstantsT6.h" #include "Game/T6/InfoString/EnumStrings.h" #include "Game/T6/InfoString/InfoStringFromStructConverter.h" #include "Game/T6/InfoString/PhysConstraintsFields.h" +#include "Game/T6/ObjConstantsT6.h" + +#include <cassert> +#include <type_traits> using namespace T6; @@ -22,7 +22,7 @@ namespace T6 case CFT_TYPE: FillFromEnumInt(std::string(field.szName), field.iOffset, s_constraintTypeNames, std::extent<decltype(s_constraintTypeNames)>::value); break; - + default: assert(false); break; @@ -30,25 +30,31 @@ namespace T6 } public: - InfoStringFromPhysConstraintsConverter(const PhysConstraints* structure, const cspField_t* fields, const size_t fieldCount, std::function<std::string(scr_string_t)> scriptStringValueCallback) + InfoStringFromPhysConstraintsConverter(const PhysConstraints* structure, + const cspField_t* fields, + const size_t fieldCount, + std::function<std::string(scr_string_t)> scriptStringValueCallback) : InfoStringFromStructConverter(structure, fields, fieldCount, std::move(scriptStringValueCallback)) { } }; -} +} // namespace T6 InfoString AssetDumperPhysConstraints::CreateInfoString(XAssetInfo<PhysConstraints>* asset) { assert(asset->Asset()->count <= 4); - 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.Count()); - if (scrStr >= asset->m_zone->m_script_strings.Count()) - return ""; + 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.Count()); + if (scrStr >= asset->m_zone->m_script_strings.Count()) + return ""; - return asset->m_zone->m_script_strings[scrStr]; - }); + return asset->m_zone->m_script_strings[scrStr]; + }); return converter.Convert(); } @@ -80,4 +86,4 @@ void AssetDumperPhysConstraints::DumpAsset(AssetDumpingContext& context, XAssetI const auto stringValue = infoString.ToString(ObjConstants::INFO_STRING_PREFIX_PHYS_CONSTRAINTS); stream.write(stringValue.c_str(), stringValue.size()); } -} \ No newline at end of file +} diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperPhysConstraints.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperPhysConstraints.h index e94bfdd98..8f3d938e5 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperPhysConstraints.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperPhysConstraints.h @@ -14,4 +14,4 @@ namespace T6 bool ShouldDump(XAssetInfo<PhysConstraints>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<PhysConstraints>* asset) override; }; -} +} // namespace T6 diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperPhysPreset.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperPhysPreset.cpp index 2db9c7abc..89558d338 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperPhysPreset.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperPhysPreset.cpp @@ -1,14 +1,14 @@ #include "AssetDumperPhysPreset.h" +#include "Game/T6/InfoString/InfoStringFromStructConverter.h" +#include "Game/T6/InfoString/PhysPresetFields.h" +#include "Game/T6/ObjConstantsT6.h" + #include <algorithm> #include <cassert> #include <cmath> #include <type_traits> -#include "Game/T6/ObjConstantsT6.h" -#include "Game/T6/InfoString/InfoStringFromStructConverter.h" -#include "Game/T6/InfoString/PhysPresetFields.h" - using namespace T6; namespace T6 @@ -22,19 +22,22 @@ namespace T6 } public: - InfoStringFromPhysPresetConverter(const PhysPresetInfo* structure, const cspField_t* fields, const size_t fieldCount, std::function<std::string(scr_string_t)> scriptStringValueCallback) + InfoStringFromPhysPresetConverter(const PhysPresetInfo* structure, + const cspField_t* fields, + const size_t fieldCount, + std::function<std::string(scr_string_t)> scriptStringValueCallback) : InfoStringFromStructConverter(structure, fields, fieldCount, std::move(scriptStringValueCallback)) { } }; -} +} // namespace T6 void AssetDumperPhysPreset::CopyToPhysPresetInfo(const PhysPreset* physPreset, PhysPresetInfo* physPresetInfo) { physPresetInfo->mass = std::clamp(physPreset->mass * 1000.0f, 1.0f, 2000.0f); physPresetInfo->bounce = physPreset->bounce; - if(std::isinf(physPreset->friction)) + if (std::isinf(physPreset->friction)) { physPresetInfo->isFrictionInfinity = 1; physPresetInfo->friction = 0; @@ -61,14 +64,17 @@ InfoString AssetDumperPhysPreset::CreateInfoString(XAssetInfo<PhysPreset>* asset auto* physPresetInfo = new PhysPresetInfo; CopyToPhysPresetInfo(asset->Asset(), physPresetInfo); - InfoStringFromPhysPresetConverter converter(physPresetInfo, phys_preset_fields, std::extent<decltype(phys_preset_fields)>::value, [asset](const scr_string_t scrStr) -> std::string - { - assert(scrStr < asset->m_zone->m_script_strings.Count()); - if (scrStr >= asset->m_zone->m_script_strings.Count()) - return ""; + InfoStringFromPhysPresetConverter converter(physPresetInfo, + phys_preset_fields, + std::extent<decltype(phys_preset_fields)>::value, + [asset](const scr_string_t scrStr) -> std::string + { + assert(scrStr < asset->m_zone->m_script_strings.Count()); + if (scrStr >= asset->m_zone->m_script_strings.Count()) + return ""; - return asset->m_zone->m_script_strings[scrStr]; - }); + return asset->m_zone->m_script_strings[scrStr]; + }); return converter.Convert(); } @@ -100,4 +106,4 @@ void AssetDumperPhysPreset::DumpAsset(AssetDumpingContext& context, XAssetInfo<P const auto stringValue = infoString.ToString(ObjConstants::INFO_STRING_PREFIX_PHYS_PRESET); stream.write(stringValue.c_str(), stringValue.size()); } -} \ No newline at end of file +} diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperPhysPreset.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperPhysPreset.h index 3dcb9445b..a760ef45e 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperPhysPreset.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperPhysPreset.h @@ -15,4 +15,4 @@ namespace T6 bool ShouldDump(XAssetInfo<PhysPreset>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<PhysPreset>* asset) override; }; -} +} // namespace T6 diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperQdb.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperQdb.cpp index d847be17d..dde4a739a 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperQdb.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperQdb.cpp @@ -17,4 +17,4 @@ void AssetDumperQdb::DumpAsset(AssetDumpingContext& context, XAssetInfo<Qdb>* as auto& stream = *assetFile; stream.write(qdb->buffer, qdb->len); -} \ No newline at end of file +} diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperQdb.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperQdb.h index 7d253a4f5..fd6a74562 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperQdb.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperQdb.h @@ -11,4 +11,4 @@ namespace T6 bool ShouldDump(XAssetInfo<Qdb>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<Qdb>* asset) override; }; -} +} // namespace T6 diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperRawFile.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperRawFile.cpp index 5c5b2357e..33947efdb 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperRawFile.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperRawFile.cpp @@ -17,4 +17,4 @@ void AssetDumperRawFile::DumpAsset(AssetDumpingContext& context, XAssetInfo<RawF auto& stream = *assetFile; stream.write(rawFile->buffer, rawFile->len); -} \ No newline at end of file +} diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperRawFile.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperRawFile.h index 8916419dd..017d38b68 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperRawFile.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperRawFile.h @@ -11,4 +11,4 @@ namespace T6 bool ShouldDump(XAssetInfo<RawFile>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<RawFile>* asset) override; }; -} +} // namespace T6 diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperScriptParseTree.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperScriptParseTree.cpp index dc87009de..fb1ff0794 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperScriptParseTree.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperScriptParseTree.cpp @@ -17,4 +17,4 @@ void AssetDumperScriptParseTree::DumpAsset(AssetDumpingContext& context, XAssetI auto& stream = *assetFile; stream.write(scriptParseTree->buffer, scriptParseTree->len); -} \ No newline at end of file +} diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperScriptParseTree.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperScriptParseTree.h index 396100b0e..8ff1db2e6 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperScriptParseTree.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperScriptParseTree.h @@ -11,4 +11,4 @@ namespace T6 bool ShouldDump(XAssetInfo<ScriptParseTree>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<ScriptParseTree>* asset) override; }; -} +} // namespace T6 diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSlug.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSlug.cpp index 0be7b081a..09dd50a41 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSlug.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSlug.cpp @@ -17,4 +17,4 @@ void AssetDumperSlug::DumpAsset(AssetDumpingContext& context, XAssetInfo<Slug>* auto& stream = *assetFile; stream.write(slug->buffer, slug->len); -} \ No newline at end of file +} diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSlug.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSlug.h index f84fa9935..015988102 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSlug.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSlug.h @@ -11,4 +11,4 @@ namespace T6 bool ShouldDump(XAssetInfo<Slug>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<Slug>* asset) override; }; -} +} // namespace T6 diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp index 351c51cb7..50b321053 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp @@ -1,21 +1,20 @@ #include "AssetDumperSndBank.h" -#include <fstream> -#include <filesystem> -#include <unordered_set> - -#include "Utils/ClassUtils.h" #include "Csv/CsvStream.h" #include "ObjContainer/SoundBank/SoundBank.h" #include "Sound/WavWriter.h" +#include "Utils/ClassUtils.h" + +#include <filesystem> +#include <fstream> +#include <unordered_set> using namespace T6; namespace fs = std::filesystem; namespace { - const std::string ALIAS_HEADERS[] - { + const std::string ALIAS_HEADERS[]{ "# name", "# file", "# template", @@ -81,25 +80,13 @@ namespace "# snapshot", }; - const std::string PREFIXES_TO_DROP[] - { + const std::string PREFIXES_TO_DROP[]{ "raw/", "devraw/", }; - constexpr size_t FRAME_RATE_FOR_INDEX[] - { - 8000, - 12000, - 16000, - 24000, - 32000, - 44100, - 48000, - 96000, - 192000 - }; -} + constexpr size_t FRAME_RATE_FOR_INDEX[]{8000, 12000, 16000, 24000, 32000, 44100, 48000, 96000, 192000}; +} // namespace class AssetDumperSndBank::Internal { @@ -286,11 +273,7 @@ class AssetDumperSndBank::Internal if (soundFile.m_entry.frameRateIndex >= std::extent_v<decltype(FRAME_RATE_FOR_INDEX)>) return; - const WavMetaData metaData{ - soundFile.m_entry.channelCount, - FRAME_RATE_FOR_INDEX[soundFile.m_entry.frameRateIndex], - bitsPerSample - }; + const WavMetaData metaData{soundFile.m_entry.channelCount, FRAME_RATE_FOR_INDEX[soundFile.m_entry.frameRateIndex], bitsPerSample}; writer.WritePcmHeader(metaData, soundFile.m_entry.size); diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.h index 923eed516..61883c588 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.h @@ -12,4 +12,4 @@ namespace T6 public: void DumpPool(AssetDumpingContext& context, AssetPool<SndBank>* pool) override; }; -} +} // namespace T6 diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperStringTable.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperStringTable.cpp index 1116559b0..d214ebf8d 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperStringTable.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperStringTable.cpp @@ -29,4 +29,4 @@ void AssetDumperStringTable::DumpAsset(AssetDumpingContext& context, XAssetInfo< csv.NextRow(); } -} \ No newline at end of file +} diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperStringTable.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperStringTable.h index d175e8120..1618db880 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperStringTable.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperStringTable.h @@ -11,4 +11,4 @@ namespace T6 bool ShouldDump(XAssetInfo<StringTable>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<StringTable>* asset) override; }; -} +} // namespace T6 diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperTracer.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperTracer.cpp index ccafb90c6..b9e7224ca 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperTracer.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperTracer.cpp @@ -1,12 +1,12 @@ #include "AssetDumperTracer.h" -#include <cassert> -#include <type_traits> - -#include "Game/T6/ObjConstantsT6.h" #include "Game/T6/InfoString/EnumStrings.h" #include "Game/T6/InfoString/InfoStringFromStructConverter.h" #include "Game/T6/InfoString/TracerFields.h" +#include "Game/T6/ObjConstantsT6.h" + +#include <cassert> +#include <type_traits> using namespace T6; @@ -31,23 +31,29 @@ namespace T6 } public: - InfoStringFromTracerConverter(const TracerDef* structure, const cspField_t* fields, const size_t fieldCount, std::function<std::string(scr_string_t)> scriptStringValueCallback) + InfoStringFromTracerConverter(const TracerDef* structure, + const cspField_t* fields, + const size_t fieldCount, + std::function<std::string(scr_string_t)> scriptStringValueCallback) : InfoStringFromStructConverter(structure, fields, fieldCount, std::move(scriptStringValueCallback)) { } }; -} +} // namespace T6 InfoString AssetDumperTracer::CreateInfoString(XAssetInfo<TracerDef>* asset) { - 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.Count()); - if (scrStr >= asset->m_zone->m_script_strings.Count()) - return ""; + 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.Count()); + if (scrStr >= asset->m_zone->m_script_strings.Count()) + return ""; - return asset->m_zone->m_script_strings[scrStr]; - }); + return asset->m_zone->m_script_strings[scrStr]; + }); return converter.Convert(); } diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperTracer.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperTracer.h index 36f6e7b6f..51c25c02e 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperTracer.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperTracer.h @@ -14,4 +14,4 @@ namespace T6 bool ShouldDump(XAssetInfo<TracerDef>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<TracerDef>* asset) override; }; -} +} // namespace T6 diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperVehicle.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperVehicle.cpp index c998bce9b..ac7873fc0 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperVehicle.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperVehicle.cpp @@ -1,12 +1,12 @@ #include "AssetDumperVehicle.h" -#include <cassert> -#include <type_traits> - -#include "Game/T6/ObjConstantsT6.h" #include "Game/T6/InfoString/EnumStrings.h" #include "Game/T6/InfoString/InfoStringFromStructConverter.h" #include "Game/T6/InfoString/VehicleFields.h" +#include "Game/T6/ObjConstantsT6.h" + +#include <cassert> +#include <type_traits> using namespace T6; @@ -32,43 +32,43 @@ namespace T6 break; case VFT_MPH_TO_INCHES_PER_SECOND: - { - const auto* num = reinterpret_cast<float*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); - m_info_string.SetValueForKey(std::string(field.szName), std::to_string(*num / 17.6f)); - break; - } + { + const auto* num = reinterpret_cast<float*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); + m_info_string.SetValueForKey(std::string(field.szName), std::to_string(*num / 17.6f)); + break; + } case VFT_POUNDS_TO_GAME_MASS: - { - const auto* num = reinterpret_cast<float*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); - m_info_string.SetValueForKey(std::string(field.szName), std::to_string(*num / 0.001f)); - break; - } + { + const auto* num = reinterpret_cast<float*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); + m_info_string.SetValueForKey(std::string(field.szName), std::to_string(*num / 0.001f)); + break; + } case VFT_TEAM: + { + const auto* num = reinterpret_cast<int*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); + switch (*num) { - const auto* num = reinterpret_cast<int*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); - switch (*num) - { - case TEAM_AXIS: - m_info_string.SetValueForKey(std::string(field.szName), "axis"); - break; - - case TEAM_ALLIES: - m_info_string.SetValueForKey(std::string(field.szName), "allies"); - break; - - case TEAM_FOUR: - m_info_string.SetValueForKey(std::string(field.szName), "neutral"); - break; - - default: - assert(false); - m_info_string.SetValueForKey(std::string(field.szName), ""); - break; - } + case TEAM_AXIS: + m_info_string.SetValueForKey(std::string(field.szName), "axis"); + break; + + case TEAM_ALLIES: + m_info_string.SetValueForKey(std::string(field.szName), "allies"); + break; + + case TEAM_FOUR: + m_info_string.SetValueForKey(std::string(field.szName), "neutral"); + break; + + default: + assert(false); + m_info_string.SetValueForKey(std::string(field.szName), ""); break; } + break; + } case VFT_KEY_BINDING: case VFT_GRAPH: @@ -81,23 +81,29 @@ namespace T6 } public: - InfoStringFromVehicleConverter(const VehicleDef* structure, const cspField_t* fields, const size_t fieldCount, std::function<std::string(scr_string_t)> scriptStringValueCallback) + InfoStringFromVehicleConverter(const VehicleDef* structure, + const cspField_t* fields, + const size_t fieldCount, + std::function<std::string(scr_string_t)> scriptStringValueCallback) : InfoStringFromStructConverter(structure, fields, fieldCount, std::move(scriptStringValueCallback)) { } }; -} +} // namespace T6 InfoString AssetDumperVehicle::CreateInfoString(XAssetInfo<VehicleDef>* asset) { - 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.Count()); - if (scrStr >= asset->m_zone->m_script_strings.Count()) - return ""; - - return asset->m_zone->m_script_strings[scrStr]; - }); + 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.Count()); + if (scrStr >= asset->m_zone->m_script_strings.Count()) + return ""; + + return asset->m_zone->m_script_strings[scrStr]; + }); return converter.Convert(); } diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperVehicle.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperVehicle.h index 499181e49..a8c8421e3 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperVehicle.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperVehicle.h @@ -14,4 +14,4 @@ namespace T6 bool ShouldDump(XAssetInfo<VehicleDef>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<VehicleDef>* asset) override; }; -} +} // namespace T6 diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeapon.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeapon.cpp index 0870e33ac..7c76d914a 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeapon.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeapon.cpp @@ -1,14 +1,14 @@ #include "AssetDumperWeapon.h" -#include <cassert> -#include <sstream> -#include <type_traits> -#include <cstring> - -#include "Game/T6/ObjConstantsT6.h" #include "Game/T6/InfoString/EnumStrings.h" #include "Game/T6/InfoString/InfoStringFromStructConverter.h" #include "Game/T6/InfoString/WeaponFields.h" +#include "Game/T6/ObjConstantsT6.h" + +#include <cassert> +#include <cstring> +#include <sstream> +#include <type_traits> using namespace T6; @@ -41,18 +41,15 @@ namespace T6 break; case WFT_STANCE: - FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapStanceNames, - std::extent<decltype(szWeapStanceNames)>::value); + 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, - std::extent<decltype(szProjectileExplosionNames)>::value); + 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, - std::extent<decltype(offhandClassNames)>::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, offhandClassNames, std::extent<decltype(offhandClassNames)>::value); break; case WFT_OFFHAND_SLOT: @@ -60,44 +57,39 @@ namespace T6 break; case WFT_ANIMTYPE: - FillFromEnumInt(std::string(field.szName), field.iOffset, playerAnimTypeNames, - std::extent<decltype(playerAnimTypeNames)>::value); + 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, - std::extent<decltype(activeReticleNames)>::value); + 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, - std::extent<decltype(guidedMissileNames)>::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, guidedMissileNames, std::extent<decltype(guidedMissileNames)>::value); break; case WFT_BOUNCE_SOUND: + { + const auto* bounceSound = *reinterpret_cast<const char***>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); + + if (bounceSound && bounceSound[0]) { - const auto* bounceSound = *reinterpret_cast<const char***>(reinterpret_cast<uintptr_t>(m_structure) - + field.iOffset); + const std::string firstBounceSound(bounceSound[0]); + const auto endOfBouncePrefix = firstBounceSound.rfind("_default"); + assert(endOfBouncePrefix != std::string::npos); - if (bounceSound && bounceSound[0]) + if (endOfBouncePrefix != std::string::npos) { - const std::string firstBounceSound(bounceSound[0]); - const auto endOfBouncePrefix = firstBounceSound.rfind("_default"); - assert(endOfBouncePrefix != std::string::npos); - - if (endOfBouncePrefix != std::string::npos) - { - m_info_string.SetValueForKey(std::string(field.szName), - firstBounceSound.substr(0, endOfBouncePrefix)); - } - else - m_info_string.SetValueForKey(std::string(field.szName), ""); + m_info_string.SetValueForKey(std::string(field.szName), firstBounceSound.substr(0, endOfBouncePrefix)); } else m_info_string.SetValueForKey(std::string(field.szName), ""); - - break; } + else + m_info_string.SetValueForKey(std::string(field.szName), ""); + + break; + } case WFT_STICKINESS: FillFromEnumInt(std::string(field.szName), field.iOffset, stickinessNames, std::extent<decltype(stickinessNames)>::value); @@ -108,28 +100,23 @@ namespace T6 break; case WFT_OVERLAYINTERFACE: - FillFromEnumInt(std::string(field.szName), field.iOffset, overlayInterfaceNames, - std::extent<decltype(overlayInterfaceNames)>::value); + 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, - std::extent<decltype(szWeapInventoryTypeNames)>::value); + 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, - std::extent<decltype(szWeapFireTypeNames)>::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapFireTypeNames, std::extent<decltype(szWeapFireTypeNames)>::value); break; case WFT_CLIPTYPE: - FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapClipTypeNames, - std::extent<decltype(szWeapClipTypeNames)>::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapClipTypeNames, std::extent<decltype(szWeapClipTypeNames)>::value); break; case WFT_AMMOCOUNTER_CLIPTYPE: - FillFromEnumInt(std::string(field.szName), field.iOffset, ammoCounterClipNames, - std::extent<decltype(ammoCounterClipNames)>::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, ammoCounterClipNames, std::extent<decltype(ammoCounterClipNames)>::value); break; case WFT_ICONRATIO_HUD: @@ -137,8 +124,7 @@ namespace T6 case WFT_ICONRATIO_KILL: case WFT_ICONRATIO_DPAD: case WFT_ICONRATIO_INDICATOR: - FillFromEnumInt(std::string(field.szName), field.iOffset, weapIconRatioNames, - std::extent<decltype(weapIconRatioNames)>::value); + FillFromEnumInt(std::string(field.szName), field.iOffset, weapIconRatioNames, std::extent<decltype(weapIconRatioNames)>::value); break; case WFT_BARRELTYPE: @@ -146,118 +132,117 @@ namespace T6 break; case WFT_HIDETAGS: - { - const auto* hideTags = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); - std::stringstream ss; - bool first = true; + { + const auto* hideTags = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); + std::stringstream ss; + bool first = true; - for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::hideTags)>::value; 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()) { - const auto& str = m_get_scr_string(hideTags[i]); - if (!str.empty()) - { - if (!first) - ss << "\n"; - else - first = false; - - ss << str; - } - } + if (!first) + ss << "\n"; + else + first = false; - m_info_string.SetValueForKey(std::string(field.szName), ss.str()); - break; + ss << str; + } } + m_info_string.SetValueForKey(std::string(field.szName), ss.str()); + break; + } + case WFT_EXPLOSION_TAG: FillFromScriptString(std::string(field.szName), field.iOffset); break; case WFT_NOTETRACKSOUNDMAP: - { - const auto* keys = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); - const auto* values = &keys[std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value]; - std::stringstream ss; - bool first = true; + { + const auto* keys = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); + const auto* values = &keys[std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value]; + std::stringstream ss; + bool first = true; - for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::notetrackSoundMapKeys)>::value; 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]); + if (!key.empty()) { - const auto& key = m_get_scr_string(keys[i]); - const auto& value = m_get_scr_string(values[i]); - if (!key.empty()) - { - if (!first) - ss << "\n"; - else - first = false; - - ss << key; - - if (!value.empty()) - ss << " " << value; - } - } + if (!first) + ss << "\n"; + else + first = false; + + ss << key; - m_info_string.SetValueForKey(std::string(field.szName), ss.str()); - break; + if (!value.empty()) + ss << " " << value; + } } + m_info_string.SetValueForKey(std::string(field.szName), ss.str()); + break; + } + case WFT_WEAPON_CAMO: - { - const auto* camo = *reinterpret_cast<WeaponCamo**>(reinterpret_cast<uintptr_t>(m_structure) + field - .iOffset); + { + const auto* camo = *reinterpret_cast<WeaponCamo**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); - if (camo) - m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(camo->name))); - else - m_info_string.SetValueForKey(std::string(field.szName), ""); - break; - } + if (camo) + m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(camo->name))); + else + m_info_string.SetValueForKey(std::string(field.szName), ""); + break; + } case WFT_ATTACHMENTS: - { - const auto* attachments = reinterpret_cast<WeaponAttachment**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); - std::stringstream ss; - auto first = true; + { + const auto* attachments = reinterpret_cast<WeaponAttachment**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); + std::stringstream ss; + auto first = true; - for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::attachments)>::value; i++) + for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::attachments)>::value; i++) + { + if (attachments[i]) { - if (attachments[i]) - { - if (!first) - ss << "\n"; - else - first = false; - ss << AssetName(attachments[i]->szInternalName); - } + if (!first) + ss << "\n"; + else + first = false; + ss << AssetName(attachments[i]->szInternalName); } - - m_info_string.SetValueForKey(std::string(field.szName), ss.str()); - break; } + m_info_string.SetValueForKey(std::string(field.szName), ss.str()); + break; + } + case WFT_ATTACHMENT_UNIQUES: - { - const auto* attachmentUniques = reinterpret_cast<WeaponAttachmentUnique**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); - std::stringstream ss; - auto first = true; + { + const auto* attachmentUniques = reinterpret_cast<WeaponAttachmentUnique**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); + std::stringstream ss; + auto first = true; - for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::attachmentUniques)>::value; i++) + for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::attachmentUniques)>::value; i++) + { + if (attachmentUniques[i]) { - if (attachmentUniques[i]) - { - if (!first) - ss << "\n"; - else - first = false; - ss << AssetName(attachmentUniques[i]->szInternalName); - } + if (!first) + ss << "\n"; + else + first = false; + ss << AssetName(attachmentUniques[i]->szInternalName); } - - m_info_string.SetValueForKey(std::string(field.szName), ss.str()); - break; } + m_info_string.SetValueForKey(std::string(field.szName), ss.str()); + break; + } + case WFT_NUM_FIELD_TYPES: default: assert(false); @@ -266,12 +251,15 @@ namespace T6 } public: - InfoStringFromWeaponConverter(const WeaponFullDef* structure, const cspField_t* fields, const size_t fieldCount, std::function<std::string(scr_string_t)> scriptStringValueCallback) + InfoStringFromWeaponConverter(const WeaponFullDef* structure, + const cspField_t* fields, + const size_t fieldCount, + std::function<std::string(scr_string_t)> scriptStringValueCallback) : InfoStringFromStructConverter(structure, fields, fieldCount, std::move(scriptStringValueCallback)) { } }; -} +} // namespace T6 void AssetDumperWeapon::CopyToFullDef(const WeaponVariantDef* weapon, WeaponFullDef* fullDef) { @@ -321,14 +309,18 @@ void AssetDumperWeapon::CopyToFullDef(const WeaponVariantDef* weapon, WeaponFull if (fullDef->weapDef.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); + 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) { 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); + memcpy(fullDef->notetrackSoundMapValues, + fullDef->weapDef.notetrackSoundMapValues, + sizeof(scr_string_t) * std::extent<decltype(WeaponFullDef::notetrackSoundMapValues)>::value); fullDef->weapDef.notetrackSoundMapValues = fullDef->notetrackSoundMapValues; } @@ -400,14 +392,17 @@ InfoString AssetDumperWeapon::CreateInfoString(XAssetInfo<WeaponVariantDef>* ass memset(fullDef.get(), 0, sizeof(WeaponFullDef)); CopyToFullDef(asset->Asset(), fullDef.get()); - InfoStringFromWeaponConverter converter(fullDef.get(), weapon_fields, std::extent<decltype(weapon_fields)>::value, [asset](const scr_string_t scrStr) -> std::string - { - assert(scrStr < asset->m_zone->m_script_strings.Count()); - if (scrStr >= asset->m_zone->m_script_strings.Count()) - return ""; - - return asset->m_zone->m_script_strings[scrStr]; - }); + InfoStringFromWeaponConverter converter(fullDef.get(), + weapon_fields, + std::extent<decltype(weapon_fields)>::value, + [asset](const scr_string_t scrStr) -> std::string + { + assert(scrStr < asset->m_zone->m_script_strings.Count()); + if (scrStr >= asset->m_zone->m_script_strings.Count()) + return ""; + + return asset->m_zone->m_script_strings[scrStr]; + }); return converter.Convert(); } diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeapon.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeapon.h index 1e89f189e..b46a846d7 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeapon.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeapon.h @@ -15,4 +15,4 @@ namespace T6 bool ShouldDump(XAssetInfo<WeaponVariantDef>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<WeaponVariantDef>* asset) override; }; -} +} // namespace T6 diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeaponAttachment.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeaponAttachment.cpp index adb665e80..572c5c918 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeaponAttachment.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeaponAttachment.cpp @@ -1,12 +1,12 @@ #include "AssetDumperWeaponAttachment.h" -#include <cassert> -#include <type_traits> - -#include "Game/T6/ObjConstantsT6.h" #include "Game/T6/InfoString/EnumStrings.h" #include "Game/T6/InfoString/InfoStringFromStructConverter.h" #include "Game/T6/InfoString/WeaponAttachmentFields.h" +#include "Game/T6/ObjConstantsT6.h" + +#include <cassert> +#include <type_traits> using namespace T6; @@ -37,23 +37,29 @@ namespace T6 } public: - InfoStringFromAttachmentConverter(const WeaponAttachment* structure, const cspField_t* fields, const size_t fieldCount, std::function<std::string(scr_string_t)> scriptStringValueCallback) + InfoStringFromAttachmentConverter(const WeaponAttachment* structure, + const cspField_t* fields, + const size_t fieldCount, + std::function<std::string(scr_string_t)> scriptStringValueCallback) : InfoStringFromStructConverter(structure, fields, fieldCount, std::move(scriptStringValueCallback)) { } }; -} +} // namespace T6 InfoString AssetDumperWeaponAttachment::CreateInfoString(XAssetInfo<WeaponAttachment>* asset) { - InfoStringFromAttachmentConverter converter(asset->Asset(), attachment_fields, std::extent<decltype(attachment_fields)>::value, [asset](const scr_string_t scrStr) -> std::string - { - assert(scrStr < asset->m_zone->m_script_strings.Count()); - if (scrStr >= asset->m_zone->m_script_strings.Count()) - return ""; + InfoStringFromAttachmentConverter converter(asset->Asset(), + attachment_fields, + std::extent<decltype(attachment_fields)>::value, + [asset](const scr_string_t scrStr) -> std::string + { + assert(scrStr < asset->m_zone->m_script_strings.Count()); + if (scrStr >= asset->m_zone->m_script_strings.Count()) + return ""; - return asset->m_zone->m_script_strings[scrStr]; - }); + return asset->m_zone->m_script_strings[scrStr]; + }); return converter.Convert(); } diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeaponAttachment.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeaponAttachment.h index 25158627a..cde27cf56 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeaponAttachment.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeaponAttachment.h @@ -14,4 +14,4 @@ namespace T6 bool ShouldDump(XAssetInfo<WeaponAttachment>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<WeaponAttachment>* asset) override; }; -} +} // namespace T6 diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeaponAttachmentUnique.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeaponAttachmentUnique.cpp index 85e62da5d..ba4139571 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeaponAttachmentUnique.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeaponAttachmentUnique.cpp @@ -1,14 +1,14 @@ #include "AssetDumperWeaponAttachmentUnique.h" -#include <cassert> -#include <sstream> -#include <type_traits> -#include <cstring> - -#include "Game/T6/ObjConstantsT6.h" #include "Game/T6/InfoString/EnumStrings.h" #include "Game/T6/InfoString/InfoStringFromStructConverter.h" #include "Game/T6/InfoString/WeaponAttachmentUniqueFields.h" +#include "Game/T6/ObjConstantsT6.h" + +#include <cassert> +#include <cstring> +#include <sstream> +#include <type_traits> using namespace T6; @@ -26,44 +26,43 @@ namespace T6 break; case AUFT_HIDETAGS: - { - const auto* hideTags = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); - std::stringstream ss; - auto first = true; + { + const auto* hideTags = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); + std::stringstream ss; + auto first = true; - for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::hideTags)>::value; 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()) { - const auto& str = m_get_scr_string(hideTags[i]); - if (!str.empty()) - { - if (!first) - ss << "\n"; - else - first = false; - - ss << str; - } - } + if (!first) + ss << "\n"; + else + first = false; - m_info_string.SetValueForKey(std::string(field.szName), ss.str()); - break; + ss << str; + } } + m_info_string.SetValueForKey(std::string(field.szName), ss.str()); + break; + } + case AUFT_OVERLAYRETICLE: FillFromEnumInt(std::string(field.szName), field.iOffset, szWeapOverlayReticleNames, std::extent<decltype(szWeapOverlayReticleNames)>::value); break; case AUFT_CAMO: - { - const auto* camo = *reinterpret_cast<WeaponCamo**>(reinterpret_cast<uintptr_t>(m_structure) + field - .iOffset); - - if (camo) - m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(camo->name))); - else - m_info_string.SetValueForKey(std::string(field.szName), ""); - break; - } + { + const auto* camo = *reinterpret_cast<WeaponCamo**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); + + if (camo) + m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(camo->name))); + else + m_info_string.SetValueForKey(std::string(field.szName), ""); + break; + } default: assert(false); @@ -72,13 +71,15 @@ namespace T6 } public: - InfoStringFromWeaponAttachmentUniqueConverter(const WeaponAttachmentUniqueFull* structure, const cspField_t* fields, const size_t fieldCount, + InfoStringFromWeaponAttachmentUniqueConverter(const WeaponAttachmentUniqueFull* structure, + const cspField_t* fields, + const size_t fieldCount, std::function<std::string(scr_string_t)> scriptStringValueCallback) : InfoStringFromStructConverter(structure, fields, fieldCount, std::move(scriptStringValueCallback)) { } }; -} +} // namespace T6 void AssetDumperWeaponAttachmentUnique::CopyToFullDef(const WeaponAttachmentUnique* attachment, WeaponAttachmentUniqueFull* fullDef) { @@ -112,16 +113,17 @@ InfoString AssetDumperWeaponAttachmentUnique::CreateInfoString(XAssetInfo<Weapon memset(fullDef.get(), 0, sizeof(WeaponAttachmentUniqueFull)); CopyToFullDef(asset->Asset(), fullDef.get()); - InfoStringFromWeaponAttachmentUniqueConverter converter( - fullDef.get(), attachment_unique_fields, std::extent<decltype(attachment_unique_fields)>::value, - [asset](const scr_string_t scrStr) -> std::string - { - assert(scrStr < asset->m_zone->m_script_strings.Count()); - if (scrStr >= asset->m_zone->m_script_strings.Count()) - return ""; - - return asset->m_zone->m_script_strings[scrStr]; - }); + InfoStringFromWeaponAttachmentUniqueConverter converter(fullDef.get(), + attachment_unique_fields, + std::extent<decltype(attachment_unique_fields)>::value, + [asset](const scr_string_t scrStr) -> std::string + { + assert(scrStr < asset->m_zone->m_script_strings.Count()); + if (scrStr >= asset->m_zone->m_script_strings.Count()) + return ""; + + return asset->m_zone->m_script_strings[scrStr]; + }); return converter.Convert(); } diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeaponAttachmentUnique.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeaponAttachmentUnique.h index 39d4f7d96..4d6a9c410 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeaponAttachmentUnique.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperWeaponAttachmentUnique.h @@ -15,4 +15,4 @@ namespace T6 bool ShouldDump(XAssetInfo<WeaponAttachmentUnique>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<WeaponAttachmentUnique>* asset) override; }; -} +} // namespace T6 diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperXModel.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperXModel.cpp index 8281ac593..038848316 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperXModel.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperXModel.cpp @@ -1,15 +1,15 @@ #include "AssetDumperXModel.h" -#include <cassert> -#include <sstream> - -#include "ObjWriting.h" #include "Game/T6/CommonT6.h" #include "Math/Quaternion.h" #include "Model/XModel/XModelExportWriter.h" +#include "ObjWriting.h" #include "Utils/HalfFloat.h" #include "Utils/QuatInt16.h" +#include <cassert> +#include <sstream> + using namespace T6; bool AssetDumperXModel::ShouldDump(XAssetInfo<XModel>* asset) @@ -21,7 +21,7 @@ GfxImage* AssetDumperXModel::GetMaterialColorMap(const Material* material) { std::vector<MaterialTextureDef*> potentialTextureDefs; - for(auto textureIndex = 0u; textureIndex < material->textureCount; textureIndex++) + for (auto textureIndex = 0u; textureIndex < material->textureCount; textureIndex++) { MaterialTextureDef* def = &material->textureTable[textureIndex]; @@ -34,19 +34,19 @@ GfxImage* AssetDumperXModel::GetMaterialColorMap(const Material* material) if (potentialTextureDefs.size() == 1) return potentialTextureDefs[0]->image; - for(const auto* def : potentialTextureDefs) + for (const auto* def : potentialTextureDefs) { if (tolower(def->nameStart) == 'c' && tolower(def->nameEnd) == 'p') return def->image; } - for(const auto* def : potentialTextureDefs) + for (const auto* def : potentialTextureDefs) { if (tolower(def->nameStart) == 'r' && tolower(def->nameEnd) == 'k') return def->image; } - for(const auto* def : potentialTextureDefs) + for (const auto* def : potentialTextureDefs) { if (tolower(def->nameStart) == 'd' && tolower(def->nameEnd) == 'p') return def->image; @@ -285,7 +285,8 @@ void AssetDumperXModel::AddXModelBones(const AssetDumpingContext& context, Abstr bone.globalOffset[0] = model->baseMat[boneNum].trans.x; bone.globalOffset[1] = model->baseMat[boneNum].trans.y; bone.globalOffset[2] = model->baseMat[boneNum].trans.z; - bone.globalRotation = Quaternion32(model->baseMat[boneNum].quat.x, model->baseMat[boneNum].quat.y, model->baseMat[boneNum].quat.z, model->baseMat[boneNum].quat.w); + bone.globalRotation = + Quaternion32(model->baseMat[boneNum].quat.x, model->baseMat[boneNum].quat.y, model->baseMat[boneNum].quat.z, model->baseMat[boneNum].quat.w); if (boneNum < model->numRootBones) { @@ -299,12 +300,10 @@ void AssetDumperXModel::AddXModelBones(const AssetDumpingContext& context, Abstr bone.localOffset[0] = model->trans[boneNum - model->numRootBones][0]; bone.localOffset[1] = model->trans[boneNum - model->numRootBones][1]; bone.localOffset[2] = model->trans[boneNum - model->numRootBones][2]; - bone.localRotation = Quaternion32( - QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][0]), - QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][1]), - QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][2]), - QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][3]) - ); + bone.localRotation = Quaternion32(QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][0]), + QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][1]), + QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][2]), + QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][3])); } writer.AddBone(std::move(bone)); @@ -416,7 +415,10 @@ void AssetDumperXModel::AllocateXModelBoneWeights(const XModel* model, const uns weightCollection.weights = std::make_unique<XModelBoneWeight[]>(weightCollection.totalWeightCount); } -void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const XModel* model, const unsigned lod, XModelVertexBoneWeightCollection& weightCollection) +void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, + const XModel* model, + const unsigned lod, + XModelVertexBoneWeightCollection& weightCollection) { const auto* surfs = &model->surfs[model->lodInfo[lod].surfIndex]; const auto surfCount = model->lodInfo[lod].numsurfs; @@ -438,17 +440,11 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const auto& vertList = surface.vertList[vertListIndex]; const auto* boneWeightOffset = &weightCollection.weights[weightOffset]; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - static_cast<int>(vertList.boneOffset / sizeof(DObjSkelMat)), - 1.0f - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{static_cast<int>(vertList.boneOffset / sizeof(DObjSkelMat)), 1.0f}; for (auto vertListVertexOffset = 0u; vertListVertexOffset < vertList.vertCount; vertListVertexOffset++) { - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 1 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 1}); } handledVertices += vertList.vertCount; } @@ -462,17 +458,11 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, { const auto* boneWeightOffset = &weightCollection.weights[weightOffset]; const auto boneIndex0 = static_cast<int>(surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat)); - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex0, - 1.0f - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, 1.0f}; vertsBlendOffset += 1; - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 1 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 1}); } // 2 bone weights @@ -484,21 +474,12 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const auto boneWeight1 = HalfFloat::ToFloat(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]); const auto boneWeight0 = 1.0f - boneWeight1; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex0, - boneWeight0 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex1, - boneWeight1 - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, boneWeight0}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex1, boneWeight1}; vertsBlendOffset += 3; - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 2 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 2}); } // 3 bone weights @@ -512,25 +493,13 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const auto boneWeight2 = HalfFloat::ToFloat(surface.vertInfo.vertsBlend[vertsBlendOffset + 4]); const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex0, - boneWeight0 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex1, - boneWeight1 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex2, - boneWeight2 - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, boneWeight0}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex1, boneWeight1}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex2, boneWeight2}; vertsBlendOffset += 5; - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 3 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 3}); } // 4 bone weights @@ -546,29 +515,14 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const auto boneWeight3 = HalfFloat::ToFloat(surface.vertInfo.vertsBlend[vertsBlendOffset + 6]); const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2 - boneWeight3; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex0, - boneWeight0 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex1, - boneWeight1 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex2, - boneWeight2 - }; - weightCollection.weights[weightOffset++] = XModelBoneWeight{ - boneIndex3, - boneWeight3 - }; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, boneWeight0}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex1, boneWeight1}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex2, boneWeight2}; + weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex3, boneWeight3}; vertsBlendOffset += 7; - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - boneWeightOffset, - 4 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{boneWeightOffset, 4}); } handledVertices += surface.vertInfo.vertCount[0] + surface.vertInfo.vertCount[1] + surface.vertInfo.vertCount[2] + surface.vertInfo.vertCount[3]; @@ -576,10 +530,7 @@ void AssetDumperXModel::AddXModelVertexBoneWeights(AbstractXModelWriter& writer, for (; handledVertices < surface.vertCount; handledVertices++) { - writer.AddVertexBoneWeights(XModelVertexBoneWeights{ - nullptr, - 0 - }); + writer.AddVertexBoneWeights(XModelVertexBoneWeights{nullptr, 0}); } } } diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperXModel.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperXModel.h index 1cb673790..a39bdaff5 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperXModel.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperXModel.h @@ -2,9 +2,9 @@ #include "Dumping/AbstractAssetDumper.h" #include "Game/T6/T6.h" -#include "Utils/DistinctMapper.h" -#include "Model/XModel/AbstractXModelWriter.h" #include "Model/Obj/ObjWriter.h" +#include "Model/XModel/AbstractXModelWriter.h" +#include "Utils/DistinctMapper.h" namespace T6 { @@ -27,7 +27,8 @@ namespace T6 static void AddXModelObjects(AbstractXModelWriter& writer, const XModel* model, unsigned lod); static void AddXModelVertices(AbstractXModelWriter& writer, const XModel* model, unsigned lod); static void AllocateXModelBoneWeights(const XModel* model, unsigned lod, XModelVertexBoneWeightCollection& weightCollection); - static void AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const XModel* model, unsigned lod, XModelVertexBoneWeightCollection& weightCollection); + static void + AddXModelVertexBoneWeights(AbstractXModelWriter& writer, const XModel* model, unsigned lod, XModelVertexBoneWeightCollection& weightCollection); static void AddXModelFaces(AbstractXModelWriter& writer, const DistinctMapper<Material*>& materialMapper, const XModel* model, unsigned lod); static void DumpXModelExportLod(const AssetDumpingContext& context, XAssetInfo<XModel>* asset, unsigned lod); static void DumpXModelExport(const AssetDumpingContext& context, XAssetInfo<XModel>* asset); @@ -36,4 +37,4 @@ namespace T6 bool ShouldDump(XAssetInfo<XModel>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<XModel>* asset) override; }; -} +} // namespace T6 diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperZBarrier.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperZBarrier.cpp index c9cb00fad..1efe9d60e 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperZBarrier.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperZBarrier.cpp @@ -1,11 +1,11 @@ #include "AssetDumperZBarrier.h" -#include <cassert> -#include <type_traits> - -#include "Game/T6/ObjConstantsT6.h" #include "Game/T6/InfoString/InfoStringFromStructConverter.h" #include "Game/T6/InfoString/ZBarrierFields.h" +#include "Game/T6/ObjConstantsT6.h" + +#include <cassert> +#include <type_traits> using namespace T6; @@ -20,23 +20,29 @@ namespace T6 } public: - InfoStringFromZBarrierConverter(const ZBarrierDef* structure, const cspField_t* fields, const size_t fieldCount, std::function<std::string(scr_string_t)> scriptStringValueCallback) + InfoStringFromZBarrierConverter(const ZBarrierDef* structure, + const cspField_t* fields, + const size_t fieldCount, + std::function<std::string(scr_string_t)> scriptStringValueCallback) : InfoStringFromStructConverter(structure, fields, fieldCount, std::move(scriptStringValueCallback)) { } }; -} +} // namespace T6 InfoString AssetDumperZBarrier::CreateInfoString(XAssetInfo<ZBarrierDef>* asset) { - 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.Count()); - if (scrStr >= asset->m_zone->m_script_strings.Count()) - return ""; + 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.Count()); + if (scrStr >= asset->m_zone->m_script_strings.Count()) + return ""; - return asset->m_zone->m_script_strings[scrStr]; - }); + return asset->m_zone->m_script_strings[scrStr]; + }); return converter.Convert(); } diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperZBarrier.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperZBarrier.h index 8dd46e545..0a2ba56d3 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperZBarrier.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperZBarrier.h @@ -14,4 +14,4 @@ namespace T6 bool ShouldDump(XAssetInfo<ZBarrierDef>* asset) override; void DumpAsset(AssetDumpingContext& context, XAssetInfo<ZBarrierDef>* asset) override; }; -} +} // namespace T6 diff --git a/src/ObjWriting/Game/T6/InfoString/InfoStringFromStructConverter.cpp b/src/ObjWriting/Game/T6/InfoString/InfoStringFromStructConverter.cpp index afa762ff8..ac23dec68 100644 --- a/src/ObjWriting/Game/T6/InfoString/InfoStringFromStructConverter.cpp +++ b/src/ObjWriting/Game/T6/InfoString/InfoStringFromStructConverter.cpp @@ -74,8 +74,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field) case CSPFT_MATERIAL: case CSPFT_MATERIAL_STREAM: { - const auto* material = *reinterpret_cast<Material**>(reinterpret_cast<uintptr_t>(m_structure) + field. - iOffset); + const auto* material = *reinterpret_cast<Material**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); if (material) m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(material->info.name))); @@ -86,8 +85,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field) case CSPFT_PHYS_PRESET: { - const auto* physPreset = *reinterpret_cast<PhysPreset**>(reinterpret_cast<uintptr_t>(m_structure) + field. - iOffset); + const auto* physPreset = *reinterpret_cast<PhysPreset**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); if (physPreset) m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(physPreset->name))); @@ -142,18 +140,19 @@ void InfoStringFromStructConverter::FillInfoString() } } -InfoStringFromStructConverter::InfoStringFromStructConverter(const void* structure, const cspField_t* fields, - const size_t fieldCount) +InfoStringFromStructConverter::InfoStringFromStructConverter(const void* structure, const cspField_t* fields, const size_t fieldCount) : InfoStringFromStructConverterBase(structure), - m_fields(fields), - m_field_count(fieldCount) + m_fields(fields), + m_field_count(fieldCount) { } -InfoStringFromStructConverter::InfoStringFromStructConverter(const void* structure, const cspField_t* fields, const size_t fieldCount, - std::function<std::string(scr_string_t)> scriptStringValueCallback) +InfoStringFromStructConverter::InfoStringFromStructConverter(const void* structure, + const cspField_t* fields, + const size_t fieldCount, + std::function<std::string(scr_string_t)> scriptStringValueCallback) : InfoStringFromStructConverterBase(structure, std::move(scriptStringValueCallback)), - m_fields(fields), - m_field_count(fieldCount) + m_fields(fields), + m_field_count(fieldCount) { } diff --git a/src/ObjWriting/Game/T6/InfoString/InfoStringFromStructConverter.h b/src/ObjWriting/Game/T6/InfoString/InfoStringFromStructConverter.h index 9a8b79562..364e59fcc 100644 --- a/src/ObjWriting/Game/T6/InfoString/InfoStringFromStructConverter.h +++ b/src/ObjWriting/Game/T6/InfoString/InfoStringFromStructConverter.h @@ -1,6 +1,6 @@ #pragma once -#include "InfoString/InfoStringFromStructConverterBase.h" #include "Game/T6/T6.h" +#include "InfoString/InfoStringFromStructConverterBase.h" namespace T6 { @@ -16,6 +16,9 @@ namespace T6 public: InfoStringFromStructConverter(const void* structure, const cspField_t* fields, size_t fieldCount); - InfoStringFromStructConverter(const void* structure, const cspField_t* fields, size_t fieldCount, std::function<std::string(scr_string_t)> scriptStringValueCallback); + InfoStringFromStructConverter(const void* structure, + const cspField_t* fields, + size_t fieldCount, + std::function<std::string(scr_string_t)> scriptStringValueCallback); }; -} \ No newline at end of file +} // namespace T6 diff --git a/src/ObjWriting/Game/T6/ZoneDumperT6.cpp b/src/ObjWriting/Game/T6/ZoneDumperT6.cpp index 4a7349b51..c01fe85b5 100644 --- a/src/ObjWriting/Game/T6/ZoneDumperT6.cpp +++ b/src/ObjWriting/Game/T6/ZoneDumperT6.cpp @@ -1,20 +1,16 @@ #include "ZoneDumperT6.h" -#include "ObjWriting.h" -#include "Game/T6/GameT6.h" -#include "Game/T6/GameAssetPoolT6.h" - -#include "AssetDumpers/AssetDumperRawFile.h" -#include "AssetDumpers/AssetDumperSlug.h" -#include "AssetDumpers/AssetDumperQdb.h" -#include "AssetDumpers/AssetDumperScriptParseTree.h" -#include "AssetDumpers/AssetDumperStringTable.h" -#include "AssetDumpers/AssetDumperLocalizeEntry.h" -#include "AssetDumpers/AssetDumperGfxImage.h" #include "AssetDumpers/AssetDumperFontIcon.h" +#include "AssetDumpers/AssetDumperGfxImage.h" +#include "AssetDumpers/AssetDumperLocalizeEntry.h" #include "AssetDumpers/AssetDumperPhysConstraints.h" #include "AssetDumpers/AssetDumperPhysPreset.h" +#include "AssetDumpers/AssetDumperQdb.h" +#include "AssetDumpers/AssetDumperRawFile.h" +#include "AssetDumpers/AssetDumperScriptParseTree.h" +#include "AssetDumpers/AssetDumperSlug.h" #include "AssetDumpers/AssetDumperSndBank.h" +#include "AssetDumpers/AssetDumperStringTable.h" #include "AssetDumpers/AssetDumperTracer.h" #include "AssetDumpers/AssetDumperVehicle.h" #include "AssetDumpers/AssetDumperWeapon.h" @@ -22,6 +18,9 @@ #include "AssetDumpers/AssetDumperWeaponAttachmentUnique.h" #include "AssetDumpers/AssetDumperXModel.h" #include "AssetDumpers/AssetDumperZBarrier.h" +#include "Game/T6/GameAssetPoolT6.h" +#include "Game/T6/GameT6.h" +#include "ObjWriting.h" using namespace T6; @@ -32,11 +31,11 @@ bool ZoneDumper::CanHandleZone(AssetDumpingContext& context) const bool ZoneDumper::DumpZone(AssetDumpingContext& context) const { -#define DUMP_ASSET_POOL(dumperType, poolName, assetType) \ - if(assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \ - { \ - dumperType dumper; \ - dumper.DumpPool(context, assetPools->poolName.get()); \ +#define DUMP_ASSET_POOL(dumperType, poolName, assetType) \ + if (assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \ + { \ + dumperType dumper; \ + dumper.DumpPool(context, assetPools->poolName.get()); \ } const auto* assetPools = dynamic_cast<GameAssetPoolT6*>(context.m_zone->m_pools.get()); diff --git a/src/ObjWriting/Game/T6/ZoneDumperT6.h b/src/ObjWriting/Game/T6/ZoneDumperT6.h index 7c0ed40d4..908b32636 100644 --- a/src/ObjWriting/Game/T6/ZoneDumperT6.h +++ b/src/ObjWriting/Game/T6/ZoneDumperT6.h @@ -9,4 +9,4 @@ namespace T6 bool CanHandleZone(AssetDumpingContext& context) const override; bool DumpZone(AssetDumpingContext& context) const override; }; -} +} // namespace T6 diff --git a/src/ObjWriting/Image/DdsWriter.cpp b/src/ObjWriting/Image/DdsWriter.cpp index fef3429c2..9183e1eb5 100644 --- a/src/ObjWriting/Image/DdsWriter.cpp +++ b/src/ObjWriting/Image/DdsWriter.cpp @@ -1,14 +1,13 @@ #include "DdsWriter.h" +#include "Image/DdsTypes.h" +#include "Image/TextureConverter.h" + #include <cassert> #include <map> #include <memory> -#include "Image/DdsTypes.h" -#include "Image/TextureConverter.h" - -const std::map<ImageFormatId, ImageFormatId> DDS_CONVERSION_TABLE -{ +const std::map<ImageFormatId, ImageFormatId> DDS_CONVERSION_TABLE{ {ImageFormatId::R8_G8_B8, ImageFormatId::B8_G8_R8_X8}, }; @@ -130,11 +129,8 @@ class DdsWriterInternal if (m_texture->GetTextureType() == TextureType::T_CUBE) { - header.dwCaps2 |= - DDSCAPS2_CUBEMAP - | DDSCAPS2_CUBEMAP_POSITIVEX | DDSCAPS2_CUBEMAP_NEGATIVEX - | DDSCAPS2_CUBEMAP_POSITIVEY | DDSCAPS2_CUBEMAP_NEGATIVEY - | DDSCAPS2_CUBEMAP_POSITIVEZ | DDSCAPS2_CUBEMAP_NEGATIVEZ; + header.dwCaps2 |= DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEX | DDSCAPS2_CUBEMAP_NEGATIVEX | DDSCAPS2_CUBEMAP_POSITIVEY + | DDSCAPS2_CUBEMAP_NEGATIVEY | DDSCAPS2_CUBEMAP_POSITIVEZ | DDSCAPS2_CUBEMAP_NEGATIVEZ; } header.dwCaps3 = 0; @@ -170,7 +166,7 @@ class DdsWriterInternal { auto entry = DDS_CONVERSION_TABLE.find(m_texture->GetFormat()->GetId()); - if(entry != DDS_CONVERSION_TABLE.end()) + if (entry != DDS_CONVERSION_TABLE.end()) { TextureConverter converter(m_texture, ImageFormat::ALL_FORMATS[static_cast<unsigned>(entry->second)]); m_converted_texture = std::unique_ptr<Texture>(converter.Convert()); @@ -225,8 +221,7 @@ class DdsWriterInternal } }; -DdsWriter::~DdsWriter() -= default; +DdsWriter::~DdsWriter() = default; bool DdsWriter::SupportsImageFormat(const ImageFormat* imageFormat) { diff --git a/src/ObjWriting/Image/DdsWriter.h b/src/ObjWriting/Image/DdsWriter.h index a2a010017..e87cfa219 100644 --- a/src/ObjWriting/Image/DdsWriter.h +++ b/src/ObjWriting/Image/DdsWriter.h @@ -6,7 +6,7 @@ class DdsWriter final : public IImageWriter public: ~DdsWriter() override; - bool SupportsImageFormat(const ImageFormat * imageFormat) override; + bool SupportsImageFormat(const ImageFormat* imageFormat) override; std::string GetFileExtension() override; void DumpImage(std::ostream& stream, Texture* texture) override; }; diff --git a/src/ObjWriting/Image/IImageWriter.h b/src/ObjWriting/Image/IImageWriter.h index 1886b9e4e..d494c656f 100644 --- a/src/ObjWriting/Image/IImageWriter.h +++ b/src/ObjWriting/Image/IImageWriter.h @@ -1,10 +1,10 @@ #pragma once +#include "Image/Texture.h" + #include <ostream> #include <string> -#include "Image/Texture.h" - class IImageWriter { public: @@ -13,4 +13,4 @@ class IImageWriter virtual bool SupportsImageFormat(const ImageFormat* imageFormat) = 0; virtual std::string GetFileExtension() = 0; virtual void DumpImage(std::ostream& stream, Texture* texture) = 0; -}; \ No newline at end of file +}; diff --git a/src/ObjWriting/Image/IwiWriter27.cpp b/src/ObjWriting/Image/IwiWriter27.cpp index f10fd8a3d..929209bc4 100644 --- a/src/ObjWriting/Image/IwiWriter27.cpp +++ b/src/ObjWriting/Image/IwiWriter27.cpp @@ -1,14 +1,13 @@ #include "IwiWriter27.h" + #include <cassert> #include <ostream> using namespace iwi27; -IwiWriter::IwiWriter() -= default; +IwiWriter::IwiWriter() = default; -IwiWriter::~IwiWriter() -= default; +IwiWriter::~IwiWriter() = default; IwiFormat IwiWriter::GetIwiFormatForImageFormat(const ImageFormat* imageFormat) { diff --git a/src/ObjWriting/Image/IwiWriter27.h b/src/ObjWriting/Image/IwiWriter27.h index 88bbc834a..3541013c4 100644 --- a/src/ObjWriting/Image/IwiWriter27.h +++ b/src/ObjWriting/Image/IwiWriter27.h @@ -27,4 +27,4 @@ namespace iwi27 std::string GetFileExtension() override; void DumpImage(std::ostream& stream, Texture* texture) override; }; -} +} // namespace iwi27 diff --git a/src/ObjWriting/Image/IwiWriter6.cpp b/src/ObjWriting/Image/IwiWriter6.cpp index adc12f5e6..0e55243fc 100644 --- a/src/ObjWriting/Image/IwiWriter6.cpp +++ b/src/ObjWriting/Image/IwiWriter6.cpp @@ -4,13 +4,11 @@ using namespace iwi6; -IwiWriter::IwiWriter() -= default; +IwiWriter::IwiWriter() = default; -IwiWriter::~IwiWriter() -= default; +IwiWriter::~IwiWriter() = default; -IwiFormat IwiWriter::GetIwiFormatForImageFormat(const ImageFormat * imageFormat) +IwiFormat IwiWriter::GetIwiFormatForImageFormat(const ImageFormat* imageFormat) { switch (imageFormat->GetId()) { @@ -40,7 +38,7 @@ IwiFormat IwiWriter::GetIwiFormatForImageFormat(const ImageFormat * imageFormat) } } -void IwiWriter::WriteVersion(std::ostream & stream) +void IwiWriter::WriteVersion(std::ostream& stream) { IwiVersion version{}; version.tag[0] = 'I'; @@ -51,14 +49,14 @@ void IwiWriter::WriteVersion(std::ostream & stream) stream.write(reinterpret_cast<char*>(&version), sizeof(IwiVersion)); } -void IwiWriter::FillHeader2D(IwiHeader * header, Texture2D * texture) +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] = 1u; } -void IwiWriter::FillHeaderCube(IwiHeader * header, TextureCube * texture) +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()); @@ -66,7 +64,7 @@ void IwiWriter::FillHeaderCube(IwiHeader * header, TextureCube * texture) header->flags |= IMG_FLAG_CUBEMAP; } -void IwiWriter::FillHeader3D(IwiHeader * header, Texture3D * texture) +void IwiWriter::FillHeader3D(IwiHeader* header, Texture3D* texture) { header->dimensions[0] = static_cast<uint16_t>(texture->GetWidth()); header->dimensions[1] = static_cast<uint16_t>(texture->GetHeight()); @@ -74,7 +72,7 @@ void IwiWriter::FillHeader3D(IwiHeader * header, Texture3D * texture) header->flags |= IMG_FLAG_VOLMAP; } -bool IwiWriter::SupportsImageFormat(const ImageFormat * imageFormat) +bool IwiWriter::SupportsImageFormat(const ImageFormat* imageFormat) { return GetIwiFormatForImageFormat(imageFormat) != IwiFormat::IMG_FORMAT_INVALID; } @@ -84,7 +82,7 @@ std::string IwiWriter::GetFileExtension() return ".iwi"; } -void IwiWriter::DumpImage(std::ostream & stream, Texture * texture) +void IwiWriter::DumpImage(std::ostream& stream, Texture* texture) { assert(texture != nullptr); diff --git a/src/ObjWriting/Image/IwiWriter6.h b/src/ObjWriting/Image/IwiWriter6.h index 2ca178d11..ad8d618dd 100644 --- a/src/ObjWriting/Image/IwiWriter6.h +++ b/src/ObjWriting/Image/IwiWriter6.h @@ -27,4 +27,4 @@ namespace iwi6 std::string GetFileExtension() override; void DumpImage(std::ostream& stream, Texture* texture) override; }; -} +} // namespace iwi6 diff --git a/src/ObjWriting/Image/IwiWriter8.cpp b/src/ObjWriting/Image/IwiWriter8.cpp index 028a86b5c..f3b89520c 100644 --- a/src/ObjWriting/Image/IwiWriter8.cpp +++ b/src/ObjWriting/Image/IwiWriter8.cpp @@ -4,11 +4,9 @@ using namespace iwi8; -IwiWriter::IwiWriter() -= default; +IwiWriter::IwiWriter() = default; -IwiWriter::~IwiWriter() -= default; +IwiWriter::~IwiWriter() = default; IwiFormat IwiWriter::GetIwiFormatForImageFormat(const ImageFormat* imageFormat) { diff --git a/src/ObjWriting/Image/IwiWriter8.h b/src/ObjWriting/Image/IwiWriter8.h index 1d3542932..830a77bb6 100644 --- a/src/ObjWriting/Image/IwiWriter8.h +++ b/src/ObjWriting/Image/IwiWriter8.h @@ -27,4 +27,4 @@ namespace iwi8 std::string GetFileExtension() override; void DumpImage(std::ostream& stream, Texture* texture) override; }; -} +} // namespace iwi8 diff --git a/src/ObjWriting/InfoString/InfoStringFromStructConverterBase.cpp b/src/ObjWriting/InfoString/InfoStringFromStructConverterBase.cpp index c06adaf9b..106b3859e 100644 --- a/src/ObjWriting/InfoString/InfoStringFromStructConverterBase.cpp +++ b/src/ObjWriting/InfoString/InfoStringFromStructConverterBase.cpp @@ -6,11 +6,12 @@ InfoStringFromStructConverterBase::InfoStringFromStructConverterBase(const void* structure) : m_structure(structure), - m_get_scr_string([](scr_string_t) - { - assert(false); - return ""; - }) + m_get_scr_string( + [](scr_string_t) + { + assert(false); + return ""; + }) { } @@ -44,8 +45,7 @@ void InfoStringFromStructConverterBase::FillFromString(const std::string& key, c m_info_string.SetValueForKey(key, ""); } -void InfoStringFromStructConverterBase::FillFromStringBuffer(const std::string& key, const size_t offset, - const size_t bufferSize) +void InfoStringFromStructConverterBase::FillFromStringBuffer(const std::string& key, const size_t offset, const size_t bufferSize) { const auto* str = reinterpret_cast<const char*>(reinterpret_cast<uintptr_t>(m_structure) + offset); const auto strLen = strnlen(str, bufferSize); @@ -104,8 +104,7 @@ void InfoStringFromStructConverterBase::FillFromScriptString(const std::string& m_info_string.SetValueForKey(key, m_get_scr_string(*scrStr)); } -void InfoStringFromStructConverterBase::FillFromEnumInt(const std::string& key, const size_t offset, - const char** enumValues, const size_t enumSize) +void InfoStringFromStructConverterBase::FillFromEnumInt(const std::string& key, const size_t offset, const char** enumValues, const size_t enumSize) { const auto num = *reinterpret_cast<int*>(reinterpret_cast<uintptr_t>(m_structure) + offset); diff --git a/src/ObjWriting/InfoString/InfoStringFromStructConverterBase.h b/src/ObjWriting/InfoString/InfoStringFromStructConverterBase.h index f918083e6..603b5ce59 100644 --- a/src/ObjWriting/InfoString/InfoStringFromStructConverterBase.h +++ b/src/ObjWriting/InfoString/InfoStringFromStructConverterBase.h @@ -1,9 +1,9 @@ #pragma once -#include <functional> - #include "InfoString/InfoString.h" #include "Zone/ZoneTypes.h" +#include <functional> + class InfoStringFromStructConverterBase { protected: @@ -35,4 +35,4 @@ class InfoStringFromStructConverterBase InfoStringFromStructConverterBase& operator=(InfoStringFromStructConverterBase&& other) noexcept = delete; InfoString Convert(); -}; \ No newline at end of file +}; diff --git a/src/ObjWriting/Menu/AbstractMenuDumper.cpp b/src/ObjWriting/Menu/AbstractMenuDumper.cpp index 6f02352ed..bf41830e1 100644 --- a/src/ObjWriting/Menu/AbstractMenuDumper.cpp +++ b/src/ObjWriting/Menu/AbstractMenuDumper.cpp @@ -1,12 +1,12 @@ #include "AbstractMenuDumper.h" -#include <algorithm> -#include <sstream> -#include <cmath> - #include "Parsing/Impl/ParserSingleInputStream.h" #include "Parsing/Simple/SimpleLexer.h" +#include <algorithm> +#include <cmath> +#include <sstream> + AbstractMenuDumper::AbstractMenuDumper(std::ostream& stream) : m_stream(stream), m_indent(0u) @@ -115,18 +115,22 @@ bool AbstractMenuDumper::DoesTokenNeedQuotationMarks(const std::string& token) if (token.empty()) return true; - const auto hasAlNumCharacter = std::any_of(token.begin(), token.end(), [](const char& c) - { - return isalnum(c); - }); + const auto hasAlNumCharacter = std::any_of(token.begin(), + token.end(), + [](const char& c) + { + return isalnum(c); + }); if (!hasAlNumCharacter) return false; - const auto hasNonIdentifierCharacter = std::any_of(token.begin(), token.end(), [](const char& c) - { - return !isalnum(c) && c != '_'; - }); + const auto hasNonIdentifierCharacter = std::any_of(token.begin(), + token.end(), + [](const char& c) + { + return !isalnum(c) && c != '_'; + }); return hasNonIdentifierCharacter; } diff --git a/src/ObjWriting/Menu/AbstractMenuDumper.h b/src/ObjWriting/Menu/AbstractMenuDumper.h index 5a826d057..104946845 100644 --- a/src/ObjWriting/Menu/AbstractMenuDumper.h +++ b/src/ObjWriting/Menu/AbstractMenuDumper.h @@ -1,8 +1,8 @@ #pragma once -#include <string> #include <cstddef> #include <ostream> +#include <string> #include <vector> class AbstractMenuDumper @@ -11,8 +11,8 @@ class AbstractMenuDumper static constexpr auto MENU_KEY_SPACING = 28u; static const inline std::string BOOL_VALUE_TRUE = "1"; static const inline std::string BOOL_VALUE_FALSE = "0"; - static constexpr inline float COLOR_0000[4]{ 0.0f, 0.0f, 0.0f, 0.0f }; - static constexpr inline float COLOR_1111[4]{ 1.0f, 1.0f, 1.0f, 1.0f }; + static constexpr inline float COLOR_0000[4]{0.0f, 0.0f, 0.0f, 0.0f}; + static constexpr inline float COLOR_1111[4]{1.0f, 1.0f, 1.0f, 1.0f}; std::ostream& m_stream; size_t m_indent; @@ -39,7 +39,7 @@ class AbstractMenuDumper void WriteBoolProperty(const std::string& propertyKey, bool propertyValue, bool defaultValue) const; void WriteIntProperty(const std::string& propertyKey, int propertyValue, int defaultValue) const; void WriteFloatProperty(const std::string& propertyKey, float propertyValue, float defaultValue) const; - void WriteColorProperty(const std::string& propertyKey, const float(&propertyValue)[4], const float(&defaultValue)[4]) const; + void WriteColorProperty(const std::string& propertyKey, const float (&propertyValue)[4], const float (&defaultValue)[4]) const; void WriteKeywordProperty(const std::string& propertyKey, bool shouldWrite) const; void WriteFlagsProperty(const std::string& propertyKey, int flagsValue) const; @@ -50,4 +50,4 @@ class AbstractMenuDumper void End(); void IncludeMenu(const std::string& menuPath) const; -}; \ No newline at end of file +}; diff --git a/src/ObjWriting/Menu/MenuDumpingZoneState.h b/src/ObjWriting/Menu/MenuDumpingZoneState.h index 677891fda..6cb92f564 100644 --- a/src/ObjWriting/Menu/MenuDumpingZoneState.h +++ b/src/ObjWriting/Menu/MenuDumpingZoneState.h @@ -1,8 +1,8 @@ #pragma once -#include <map> - #include "Dumping/IZoneAssetDumperState.h" +#include <map> + namespace menu { class MenuDumpingZoneState final : public IZoneAssetDumperState @@ -21,4 +21,4 @@ namespace menu void CreateMenuDumpingState(const void* menuDef, std::string path, const void* aliasMenuList); }; -} +} // namespace menu diff --git a/src/ObjWriting/Model/Obj/ObjWriter.cpp b/src/ObjWriting/Model/Obj/ObjWriter.cpp index c476244d4..2c8ad9082 100644 --- a/src/ObjWriting/Model/Obj/ObjWriter.cpp +++ b/src/ObjWriting/Model/Obj/ObjWriter.cpp @@ -106,29 +106,27 @@ void ObjWriter::WriteObj(std::ostream& stream, const std::string& mtlName) for (const auto& f : objectData.m_faces) { - const size_t v[3] - { - objectData.m_vertices.GetDistinctPositionByInputPosition(f.vertexIndex[0] - inputOffsetsByObject[objectIndex].vertexOffset) + distinctOffsetsByObject[objectIndex].vertexOffset + 1, - objectData.m_vertices.GetDistinctPositionByInputPosition(f.vertexIndex[1] - inputOffsetsByObject[objectIndex].vertexOffset) + distinctOffsetsByObject[objectIndex].vertexOffset + 1, - objectData.m_vertices.GetDistinctPositionByInputPosition(f.vertexIndex[2] - inputOffsetsByObject[objectIndex].vertexOffset) + distinctOffsetsByObject[objectIndex].vertexOffset + 1 - }; - const size_t n[3] - { - objectData.m_normals.GetDistinctPositionByInputPosition(f.normalIndex[0] - inputOffsetsByObject[objectIndex].normalOffset) + distinctOffsetsByObject[objectIndex].normalOffset + 1, - objectData.m_normals.GetDistinctPositionByInputPosition(f.normalIndex[1] - inputOffsetsByObject[objectIndex].normalOffset) + distinctOffsetsByObject[objectIndex].normalOffset + 1, - objectData.m_normals.GetDistinctPositionByInputPosition(f.normalIndex[2] - inputOffsetsByObject[objectIndex].normalOffset) + distinctOffsetsByObject[objectIndex].normalOffset + 1 - }; - const size_t uv[3] - { - objectData.m_uvs.GetDistinctPositionByInputPosition(f.uvIndex[0] - inputOffsetsByObject[objectIndex].uvOffset) + distinctOffsetsByObject[objectIndex].uvOffset + 1, - objectData.m_uvs.GetDistinctPositionByInputPosition(f.uvIndex[1] - inputOffsetsByObject[objectIndex].uvOffset) + distinctOffsetsByObject[objectIndex].uvOffset + 1, - objectData.m_uvs.GetDistinctPositionByInputPosition(f.uvIndex[2] - inputOffsetsByObject[objectIndex].uvOffset) + distinctOffsetsByObject[objectIndex].uvOffset + 1 - }; - - stream << "f " << v[0] << "/" << uv[0] << "/" << n[0] - << " " << v[1] << "/" << uv[1] << "/" << n[1] - << " " << v[2] << "/" << uv[2] << "/" << n[2] - << "\n"; + const size_t v[3]{objectData.m_vertices.GetDistinctPositionByInputPosition(f.vertexIndex[0] - inputOffsetsByObject[objectIndex].vertexOffset) + + distinctOffsetsByObject[objectIndex].vertexOffset + 1, + objectData.m_vertices.GetDistinctPositionByInputPosition(f.vertexIndex[1] - inputOffsetsByObject[objectIndex].vertexOffset) + + distinctOffsetsByObject[objectIndex].vertexOffset + 1, + objectData.m_vertices.GetDistinctPositionByInputPosition(f.vertexIndex[2] - inputOffsetsByObject[objectIndex].vertexOffset) + + distinctOffsetsByObject[objectIndex].vertexOffset + 1}; + const size_t n[3]{objectData.m_normals.GetDistinctPositionByInputPosition(f.normalIndex[0] - inputOffsetsByObject[objectIndex].normalOffset) + + distinctOffsetsByObject[objectIndex].normalOffset + 1, + objectData.m_normals.GetDistinctPositionByInputPosition(f.normalIndex[1] - inputOffsetsByObject[objectIndex].normalOffset) + + distinctOffsetsByObject[objectIndex].normalOffset + 1, + objectData.m_normals.GetDistinctPositionByInputPosition(f.normalIndex[2] - inputOffsetsByObject[objectIndex].normalOffset) + + distinctOffsetsByObject[objectIndex].normalOffset + 1}; + const size_t uv[3]{objectData.m_uvs.GetDistinctPositionByInputPosition(f.uvIndex[0] - inputOffsetsByObject[objectIndex].uvOffset) + + distinctOffsetsByObject[objectIndex].uvOffset + 1, + objectData.m_uvs.GetDistinctPositionByInputPosition(f.uvIndex[1] - inputOffsetsByObject[objectIndex].uvOffset) + + distinctOffsetsByObject[objectIndex].uvOffset + 1, + objectData.m_uvs.GetDistinctPositionByInputPosition(f.uvIndex[2] - inputOffsetsByObject[objectIndex].uvOffset) + + distinctOffsetsByObject[objectIndex].uvOffset + 1}; + + stream << "f " << v[0] << "/" << uv[0] << "/" << n[0] << " " << v[1] << "/" << uv[1] << "/" << n[1] << " " << v[2] << "/" << uv[2] << "/" << n[2] + << "\n"; } objectIndex++; diff --git a/src/ObjWriting/Model/Obj/ObjWriter.h b/src/ObjWriting/Model/Obj/ObjWriter.h index 5cb1660a6..157ffc875 100644 --- a/src/ObjWriting/Model/Obj/ObjWriter.h +++ b/src/ObjWriting/Model/Obj/ObjWriter.h @@ -1,11 +1,11 @@ #pragma once -#include <vector> -#include <ostream> - #include "Model/Obj/ObjCommon.h" #include "Utils/DistinctMapper.h" +#include <ostream> +#include <vector> + class ObjWriter { protected: diff --git a/src/ObjWriting/Model/XModel/AbstractXModelWriter.cpp b/src/ObjWriting/Model/XModel/AbstractXModelWriter.cpp index 1575b471e..726cde891 100644 --- a/src/ObjWriting/Model/XModel/AbstractXModelWriter.cpp +++ b/src/ObjWriting/Model/XModel/AbstractXModelWriter.cpp @@ -1,7 +1,6 @@ #include "AbstractXModelWriter.h" -AbstractXModelWriter::AbstractXModelWriter() -= default; +AbstractXModelWriter::AbstractXModelWriter() = default; void AbstractXModelWriter::AddObject(XModelObject object) { diff --git a/src/ObjWriting/Model/XModel/AbstractXModelWriter.h b/src/ObjWriting/Model/XModel/AbstractXModelWriter.h index ab2c30e3a..277b52828 100644 --- a/src/ObjWriting/Model/XModel/AbstractXModelWriter.h +++ b/src/ObjWriting/Model/XModel/AbstractXModelWriter.h @@ -1,9 +1,9 @@ #pragma once -#include <vector> - #include "Model/XModel/XModelCommon.h" +#include <vector> + class AbstractXModelWriter { protected: diff --git a/src/ObjWriting/Model/XModel/XModelExportWriter.cpp b/src/ObjWriting/Model/XModel/XModelExportWriter.cpp index b85d46852..64e0dc101 100644 --- a/src/ObjWriting/Model/XModel/XModelExportWriter.cpp +++ b/src/ObjWriting/Model/XModel/XModelExportWriter.cpp @@ -1,10 +1,10 @@ #include "XModelExportWriter.h" +#include "Math/Quaternion.h" + #include <iomanip> #include <iostream> -#include "Math/Quaternion.h" - class XModelExportWriterBase : public XModelExportWriter { protected: @@ -20,21 +20,12 @@ class XModelExportWriterBase : public XModelExportWriter auto vertexOffset = 0u; for (const auto& vertex : m_vertices) { - XModelVertexBoneWeights weights{ - nullptr, - 0 - }; + XModelVertexBoneWeights weights{nullptr, 0}; - if(vertexOffset < m_vertex_bone_weights.size()) + if (vertexOffset < m_vertex_bone_weights.size()) weights = m_vertex_bone_weights[vertexOffset]; - m_vertex_merger.Add(VertexMergerPos{ - vertex.coordinates[0], - vertex.coordinates[1], - vertex.coordinates[2], - weights.weights, - weights.weightCount - }); + m_vertex_merger.Add(VertexMergerPos{vertex.coordinates[0], vertex.coordinates[1], vertex.coordinates[2], weights.weights, weights.weightCount}); vertexOffset++; } @@ -72,25 +63,20 @@ class XModelExportWriterBase : public XModelExportWriter { stream << "BONE " << boneNum << "\n"; stream << "OFFSET "; - stream << std::setprecision(6) << std::fixed << bone.globalOffset[0] - << ", " << std::setprecision(6) << std::fixed << bone.globalOffset[1] - << ", " << std::setprecision(6) << std::fixed << bone.globalOffset[2] << "\n"; + stream << std::setprecision(6) << std::fixed << bone.globalOffset[0] << ", " << std::setprecision(6) << std::fixed << bone.globalOffset[1] << ", " + << std::setprecision(6) << std::fixed << bone.globalOffset[2] << "\n"; stream << "SCALE "; - stream << std::setprecision(6) << std::fixed << bone.scale[0] - << ", " << std::setprecision(6) << std::fixed << bone.scale[1] - << ", " << std::setprecision(6) << std::fixed << bone.scale[2] << "\n"; + stream << std::setprecision(6) << std::fixed << bone.scale[0] << ", " << std::setprecision(6) << std::fixed << bone.scale[1] << ", " + << std::setprecision(6) << std::fixed << bone.scale[2] << "\n"; const Matrix32 mat = bone.globalRotation.ToMatrix(); - stream << "X " << std::setprecision(6) << std::fixed << mat.m_data[0][0] - << ", " << std::setprecision(6) << std::fixed << mat.m_data[1][0] - << ", " << std::setprecision(6) << std::fixed << mat.m_data[2][0] << "\n"; - stream << "Y " << std::setprecision(6) << std::fixed << mat.m_data[0][1] - << ", " << std::setprecision(6) << std::fixed << mat.m_data[1][1] - << ", " << std::setprecision(6) << std::fixed << mat.m_data[2][1] << "\n"; - stream << "Z " << std::setprecision(6) << std::fixed << mat.m_data[0][2] - << ", " << std::setprecision(6) << std::fixed << mat.m_data[1][2] - << ", " << std::setprecision(6) << std::fixed << mat.m_data[2][2] << "\n"; + stream << "X " << std::setprecision(6) << std::fixed << mat.m_data[0][0] << ", " << std::setprecision(6) << std::fixed << mat.m_data[1][0] << ", " + << std::setprecision(6) << std::fixed << mat.m_data[2][0] << "\n"; + stream << "Y " << std::setprecision(6) << std::fixed << mat.m_data[0][1] << ", " << std::setprecision(6) << std::fixed << mat.m_data[1][1] << ", " + << std::setprecision(6) << std::fixed << mat.m_data[2][1] << "\n"; + stream << "Z " << std::setprecision(6) << std::fixed << mat.m_data[0][2] << ", " << std::setprecision(6) << std::fixed << mat.m_data[1][2] << ", " + << std::setprecision(6) << std::fixed << mat.m_data[2][2] << "\n"; stream << "\n"; boneNum++; } @@ -114,15 +100,14 @@ class XModelExportWriter6 final : public XModelExportWriterBase { stream << "VERT " << vertexNum << "\n"; stream << "OFFSET "; - stream << std::setprecision(6) << std::fixed << vertexPos.x - << ", " << std::setprecision(6) << std::fixed << vertexPos.y - << ", " << std::setprecision(6) << std::fixed << vertexPos.z << "\n"; + stream << std::setprecision(6) << std::fixed << vertexPos.x << ", " << std::setprecision(6) << std::fixed << vertexPos.y << ", " + << std::setprecision(6) << std::fixed << vertexPos.z << "\n"; stream << "BONES " << vertexPos.weightCount << "\n"; for (auto weightIndex = 0u; weightIndex < vertexPos.weightCount; weightIndex++) { - stream << "BONE " << vertexPos.weights[weightIndex].boneIndex - << " " << std::setprecision(6) << std::fixed << vertexPos.weights[weightIndex].weight << "\n"; + stream << "BONE " << vertexPos.weights[weightIndex].boneIndex << " " << std::setprecision(6) << std::fixed + << vertexPos.weights[weightIndex].weight << "\n"; } stream << "\n"; vertexNum++; @@ -132,15 +117,11 @@ class XModelExportWriter6 final : public XModelExportWriterBase static void WriteFaceVertex(std::ostream& stream, const size_t index, const XModelVertex& vertex) { stream << "VERT " << index << "\n"; - stream << "NORMAL " << std::setprecision(6) << std::fixed << vertex.normal[0] - << " " << std::setprecision(6) << std::fixed << vertex.normal[1] - << " " << std::setprecision(6) << std::fixed << vertex.normal[2] << "\n"; - stream << "COLOR " << std::setprecision(6) << std::fixed << vertex.color[0] - << " " << std::setprecision(6) << std::fixed << vertex.color[1] - << " " << std::setprecision(6) << std::fixed << vertex.color[2] - << " " << std::setprecision(6) << std::fixed << vertex.color[3] << "\n"; - stream << "UV 1 " << std::setprecision(6) << std::fixed << vertex.uv[0] - << " " << std::setprecision(6) << std::fixed << vertex.uv[1] << "\n"; + stream << "NORMAL " << std::setprecision(6) << std::fixed << vertex.normal[0] << " " << std::setprecision(6) << std::fixed << vertex.normal[1] << " " + << std::setprecision(6) << std::fixed << vertex.normal[2] << "\n"; + stream << "COLOR " << std::setprecision(6) << std::fixed << vertex.color[0] << " " << std::setprecision(6) << std::fixed << vertex.color[1] << " " + << std::setprecision(6) << std::fixed << vertex.color[2] << " " << std::setprecision(6) << std::fixed << vertex.color[3] << "\n"; + stream << "UV 1 " << std::setprecision(6) << std::fixed << vertex.uv[0] << " " << std::setprecision(6) << std::fixed << vertex.uv[1] << "\n"; } void WriteFaces(std::ostream& stream) const @@ -148,12 +129,9 @@ class XModelExportWriter6 final : public XModelExportWriterBase stream << "NUMFACES " << m_faces.size() << "\n"; for (const auto& face : m_faces) { - const size_t distinctPositions[3] - { - m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[0]), - m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[1]), - m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[2]) - }; + const size_t distinctPositions[3]{m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[0]), + m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[1]), + m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[2])}; const XModelVertex& v0 = m_vertices[face.vertexIndex[0]]; const XModelVertex& v1 = m_vertices[face.vertexIndex[1]]; @@ -187,40 +165,30 @@ class XModelExportWriter6 final : public XModelExportWriterBase { const auto colorMapPath = "../images/" + material.colorMapName + ".dds"; stream << "MATERIAL " << materialNum << " \"" << material.name << "\" \"" << material.materialTypeName << "\" \"" << colorMapPath << "\"\n"; - stream << "COLOR " << std::setprecision(6) << std::fixed << material.color[0] - << " " << std::setprecision(6) << std::fixed << material.color[1] - << " " << std::setprecision(6) << std::fixed << material.color[2] - << " " << std::setprecision(6) << std::fixed << material.color[3] << "\n"; - stream << "TRANSPARENCY " << std::setprecision(6) << std::fixed << material.transparency[0] - << " " << std::setprecision(6) << std::fixed << material.transparency[1] - << " " << std::setprecision(6) << std::fixed << material.transparency[2] - << " " << std::setprecision(6) << std::fixed << material.transparency[3] << "\n"; - stream << "AMBIENTCOLOR " << std::setprecision(6) << std::fixed << material.ambientColor[0] - << " " << std::setprecision(6) << std::fixed << material.ambientColor[1] - << " " << std::setprecision(6) << std::fixed << material.ambientColor[2] - << " " << std::setprecision(6) << std::fixed << material.ambientColor[3] << "\n"; - stream << "INCANDESCENCE " << std::setprecision(6) << std::fixed << material.incandescence[0] - << " " << std::setprecision(6) << std::fixed << material.incandescence[1] - << " " << std::setprecision(6) << std::fixed << material.incandescence[2] - << " " << std::setprecision(6) << std::fixed << material.incandescence[3] << "\n"; - stream << "COEFFS " << std::setprecision(6) << std::fixed << material.coeffs[0] - << " " << std::setprecision(6) << std::fixed << material.coeffs[1] << "\n"; - stream << "GLOW " << std::setprecision(6) << std::fixed << material.glow.x - << " " << material.glow.y << "\n"; - stream << "REFRACTIVE " << material.refractive.x - << " " << std::setprecision(6) << std::fixed << material.refractive.y << "\n"; - stream << "SPECULARCOLOR " << std::setprecision(6) << std::fixed << material.specularColor[0] - << " " << std::setprecision(6) << std::fixed << material.specularColor[1] - << " " << std::setprecision(6) << std::fixed << material.specularColor[2] - << " " << std::setprecision(6) << std::fixed << material.specularColor[3] << "\n"; - stream << "REFLECTIVECOLOR " << std::setprecision(6) << std::fixed << material.reflectiveColor[0] - << " " << std::setprecision(6) << std::fixed << material.reflectiveColor[1] - << " " << std::setprecision(6) << std::fixed << material.reflectiveColor[2] - << " " << std::setprecision(6) << std::fixed << material.reflectiveColor[3] << "\n"; - stream << "REFLECTIVE " << material.reflective.x - << " " << std::setprecision(6) << std::fixed << material.reflective.y << "\n"; - stream << "BLINN " << std::setprecision(6) << std::fixed << material.blinn[0] - << " " << std::setprecision(6) << std::fixed << material.blinn[1] << "\n"; + stream << "COLOR " << std::setprecision(6) << std::fixed << material.color[0] << " " << std::setprecision(6) << std::fixed << material.color[1] + << " " << std::setprecision(6) << std::fixed << material.color[2] << " " << std::setprecision(6) << std::fixed << material.color[3] << "\n"; + stream << "TRANSPARENCY " << std::setprecision(6) << std::fixed << material.transparency[0] << " " << std::setprecision(6) << std::fixed + << material.transparency[1] << " " << std::setprecision(6) << std::fixed << material.transparency[2] << " " << std::setprecision(6) + << std::fixed << material.transparency[3] << "\n"; + stream << "AMBIENTCOLOR " << std::setprecision(6) << std::fixed << material.ambientColor[0] << " " << std::setprecision(6) << std::fixed + << material.ambientColor[1] << " " << std::setprecision(6) << std::fixed << material.ambientColor[2] << " " << std::setprecision(6) + << std::fixed << material.ambientColor[3] << "\n"; + stream << "INCANDESCENCE " << std::setprecision(6) << std::fixed << material.incandescence[0] << " " << std::setprecision(6) << std::fixed + << material.incandescence[1] << " " << std::setprecision(6) << std::fixed << material.incandescence[2] << " " << std::setprecision(6) + << std::fixed << material.incandescence[3] << "\n"; + stream << "COEFFS " << std::setprecision(6) << std::fixed << material.coeffs[0] << " " << std::setprecision(6) << std::fixed << material.coeffs[1] + << "\n"; + stream << "GLOW " << std::setprecision(6) << std::fixed << material.glow.x << " " << material.glow.y << "\n"; + stream << "REFRACTIVE " << material.refractive.x << " " << std::setprecision(6) << std::fixed << material.refractive.y << "\n"; + stream << "SPECULARCOLOR " << std::setprecision(6) << std::fixed << material.specularColor[0] << " " << std::setprecision(6) << std::fixed + << material.specularColor[1] << " " << std::setprecision(6) << std::fixed << material.specularColor[2] << " " << std::setprecision(6) + << std::fixed << material.specularColor[3] << "\n"; + stream << "REFLECTIVECOLOR " << std::setprecision(6) << std::fixed << material.reflectiveColor[0] << " " << std::setprecision(6) << std::fixed + << material.reflectiveColor[1] << " " << std::setprecision(6) << std::fixed << material.reflectiveColor[2] << " " << std::setprecision(6) + << std::fixed << material.reflectiveColor[3] << "\n"; + stream << "REFLECTIVE " << material.reflective.x << " " << std::setprecision(6) << std::fixed << material.reflective.y << "\n"; + stream << "BLINN " << std::setprecision(6) << std::fixed << material.blinn[0] << " " << std::setprecision(6) << std::fixed << material.blinn[1] + << "\n"; stream << "PHONG " << std::setprecision(6) << std::fixed << material.phong << "\n"; stream << "\n"; materialNum++; diff --git a/src/ObjWriting/Model/XModel/XModelExportWriter.h b/src/ObjWriting/Model/XModel/XModelExportWriter.h index 0d4d217d4..5535f5797 100644 --- a/src/ObjWriting/Model/XModel/XModelExportWriter.h +++ b/src/ObjWriting/Model/XModel/XModelExportWriter.h @@ -1,10 +1,10 @@ #pragma once -#include <ostream> -#include <memory> - #include "AbstractXModelWriter.h" +#include <memory> +#include <ostream> + class XModelExportWriter : public AbstractXModelWriter { public: diff --git a/src/ObjWriting/ObjContainer/IPak/IPakWriter.cpp b/src/ObjWriting/ObjContainer/IPak/IPakWriter.cpp index 6767a64d4..98a745c68 100644 --- a/src/ObjWriting/ObjContainer/IPak/IPakWriter.cpp +++ b/src/ObjWriting/ObjContainer/IPak/IPakWriter.cpp @@ -1,16 +1,16 @@ #include "IPakWriter.h" +#include "Game/T6/CommonT6.h" +#include "Game/T6/GameT6.h" +#include "ObjContainer/IPak/IPakTypes.h" +#include "Utils/Alignment.h" + #include <algorithm> #include <iostream> #include <minilzo.h> #include <sstream> #include <zlib.h> -#include "Game/T6/CommonT6.h" -#include "Game/T6/GameT6.h" -#include "ObjContainer/IPak/IPakTypes.h" -#include "Utils/Alignment.h" - class IPakWriterImpl final : public IPakWriter { static constexpr char BRANDING[] = "Created with OAT - OpenAssetTools"; @@ -80,33 +80,20 @@ class IPakWriterImpl final : public IPakWriter { GoTo(0); - const IPakHeader header{ - ipak_consts::IPAK_MAGIC, - ipak_consts::IPAK_VERSION, - static_cast<uint32_t>(m_total_size), - SECTION_COUNT - }; - - const IPakSection dataSection{ - ipak_consts::IPAK_DATA_SECTION, - static_cast<uint32_t>(m_data_section_offset), - static_cast<uint32_t>(m_data_section_size), - static_cast<uint32_t>(m_index_entries.size()) - }; - - const IPakSection indexSection{ - ipak_consts::IPAK_INDEX_SECTION, - static_cast<uint32_t>(m_index_section_offset), - static_cast<uint32_t>(sizeof(IPakIndexEntry) * m_index_entries.size()), - static_cast<uint32_t>(m_index_entries.size()) - }; + const IPakHeader header{ipak_consts::IPAK_MAGIC, ipak_consts::IPAK_VERSION, static_cast<uint32_t>(m_total_size), SECTION_COUNT}; + + const IPakSection dataSection{ipak_consts::IPAK_DATA_SECTION, + static_cast<uint32_t>(m_data_section_offset), + static_cast<uint32_t>(m_data_section_size), + static_cast<uint32_t>(m_index_entries.size())}; + + const IPakSection indexSection{ipak_consts::IPAK_INDEX_SECTION, + static_cast<uint32_t>(m_index_section_offset), + static_cast<uint32_t>(sizeof(IPakIndexEntry) * m_index_entries.size()), + static_cast<uint32_t>(m_index_entries.size())}; const IPakSection brandingSection{ - ipak_consts::IPAK_BRANDING_SECTION, - static_cast<uint32_t>(m_branding_section_offset), - std::extent_v<decltype(BRANDING)>, - 1 - }; + ipak_consts::IPAK_BRANDING_SECTION, static_cast<uint32_t>(m_branding_section_offset), std::extent_v<decltype(BRANDING)>, 1}; Write(&header, sizeof(header)); Write(&dataSection, sizeof(dataSection)); @@ -178,7 +165,8 @@ class IPakWriterImpl final : public IPakWriter AlignToBlockHeader(); // Skip to the next chunk when only the header could fit into the current chunk anyway - if (static_cast<size_t>(utils::Align(m_current_offset, static_cast<int64_t>(ipak_consts::IPAK_CHUNK_SIZE)) - m_current_offset) <= sizeof(IPakDataBlockHeader)) + if (static_cast<size_t>(utils::Align(m_current_offset, static_cast<int64_t>(ipak_consts::IPAK_CHUNK_SIZE)) - m_current_offset) + <= sizeof(IPakDataBlockHeader)) FlushChunk(); m_current_block_header_offset = m_current_offset; @@ -202,7 +190,8 @@ class IPakWriterImpl final : public IPakWriter const auto remainingSize = dataSize - dataOffset; const auto remainingChunkBufferWindowSize = std::max((ipak_consts::IPAK_CHUNK_COUNT_PER_READ * ipak_consts::IPAK_CHUNK_SIZE) - - static_cast<size_t>(m_current_offset - m_chunk_buffer_window_start), 0u); + - static_cast<size_t>(m_current_offset - m_chunk_buffer_window_start), + 0u); if (remainingChunkBufferWindowSize == 0) { @@ -217,7 +206,10 @@ class IPakWriterImpl final : public IPakWriter if (USE_COMPRESSION) { auto outLen = static_cast<lzo_uint>(ipak_consts::IPAK_CHUNK_SIZE); - const auto result = lzo1x_1_compress(&static_cast<const unsigned char*>(data)[dataOffset], commandSize, reinterpret_cast<unsigned char*>(m_decompressed_buffer.get()), &outLen, + const auto result = lzo1x_1_compress(&static_cast<const unsigned char*>(data)[dataOffset], + commandSize, + reinterpret_cast<unsigned char*>(m_decompressed_buffer.get()), + &outLen, m_lzo_work_buffer.get()); if (result == LZO_E_OK && outLen < commandSize) @@ -291,10 +283,12 @@ class IPakWriterImpl final : public IPakWriter m_index_entries.reserve(m_images.size()); - const auto result = std::all_of(m_images.begin(), m_images.end(), [this](const std::string& imageName) - { - return WriteImageData(imageName); - }); + const auto result = std::all_of(m_images.begin(), + m_images.end(), + [this](const std::string& imageName) + { + return WriteImageData(imageName); + }); FlushBlock(); m_data_section_size = static_cast<size_t>(m_current_offset - m_data_section_offset); diff --git a/src/ObjWriting/ObjContainer/IPak/IPakWriter.h b/src/ObjWriting/ObjContainer/IPak/IPakWriter.h index 6b9f0a3a0..546ddc1d0 100644 --- a/src/ObjWriting/ObjContainer/IPak/IPakWriter.h +++ b/src/ObjWriting/ObjContainer/IPak/IPakWriter.h @@ -1,9 +1,9 @@ #pragma once +#include "SearchPath/ISearchPath.h" + #include <memory> #include <ostream> -#include "SearchPath/ISearchPath.h" - class IPakWriter { public: diff --git a/src/ObjWriting/ObjWriting.cpp b/src/ObjWriting/ObjWriting.cpp index 90dda09a8..ca028755f 100644 --- a/src/ObjWriting/ObjWriting.cpp +++ b/src/ObjWriting/ObjWriting.cpp @@ -1,4 +1,5 @@ #include "ObjWriting.h" + #include "Dumping/IZoneDumper.h" #include "Game/IW3/ZoneDumperIW3.h" #include "Game/IW4/ZoneDumperIW4.h" @@ -8,14 +9,7 @@ ObjWriting::Configuration_t ObjWriting::Configuration; -const IZoneDumper* const ZONE_DUMPER[] -{ - new IW3::ZoneDumper(), - new IW4::ZoneDumper(), - new IW5::ZoneDumper(), - new T5::ZoneDumper(), - new T6::ZoneDumper() -}; +const IZoneDumper* const ZONE_DUMPER[]{new IW3::ZoneDumper(), new IW4::ZoneDumper(), new IW5::ZoneDumper(), new T5::ZoneDumper(), new T6::ZoneDumper()}; bool ObjWriting::DumpZone(AssetDumpingContext& context) { diff --git a/src/ObjWriting/ObjWriting.h b/src/ObjWriting/ObjWriting.h index beacbf7a7..e69903e2b 100644 --- a/src/ObjWriting/ObjWriting.h +++ b/src/ObjWriting/ObjWriting.h @@ -1,10 +1,10 @@ #pragma once -#include <vector> - #include "Dumping/AssetDumpingContext.h" #include "Zone/ZoneTypes.h" +#include <vector> + class ObjWriting { public: diff --git a/src/ObjWriting/Sound/WavWriter.cpp b/src/ObjWriting/Sound/WavWriter.cpp index 160aa0f99..6f5caa9cc 100644 --- a/src/ObjWriting/Sound/WavWriter.cpp +++ b/src/ObjWriting/Sound/WavWriter.cpp @@ -9,41 +9,25 @@ WavWriter::WavWriter(std::ostream& stream) void WavWriter::WritePcmHeader(const WavMetaData& metaData, const size_t dataLen) const { - constexpr auto riffMasterChunkSize = sizeof(WAV_CHUNK_ID_RIFF) - + sizeof(uint32_t) - + sizeof(WAV_WAVE_ID) - + sizeof(WavChunkHeader) - + sizeof(WavFormatChunkPcm) - + sizeof(WavChunkHeader) - + sizeof(dataLen); + constexpr auto riffMasterChunkSize = sizeof(WAV_CHUNK_ID_RIFF) + sizeof(uint32_t) + sizeof(WAV_WAVE_ID) + sizeof(WavChunkHeader) + sizeof(WavFormatChunkPcm) + + sizeof(WavChunkHeader) + sizeof(dataLen); m_stream.write(reinterpret_cast<const char*>(&WAV_CHUNK_ID_RIFF), sizeof(WAV_CHUNK_ID_RIFF)); m_stream.write(reinterpret_cast<const char*>(&riffMasterChunkSize), sizeof(riffMasterChunkSize)); m_stream.write(reinterpret_cast<const char*>(&WAV_WAVE_ID), sizeof(WAV_WAVE_ID)); - constexpr WavChunkHeader formatChunkHeader - { - WAV_CHUNK_ID_FMT, - sizeof(WavFormatChunkPcm) - }; + constexpr WavChunkHeader formatChunkHeader{WAV_CHUNK_ID_FMT, sizeof(WavFormatChunkPcm)}; m_stream.write(reinterpret_cast<const char*>(&formatChunkHeader), sizeof(formatChunkHeader)); - const WavFormatChunkPcm formatChunk - { - WavFormat::PCM, - static_cast<uint16_t>(metaData.channelCount), - metaData.samplesPerSec, - metaData.samplesPerSec * metaData.channelCount * metaData.bitsPerSample / 8, - static_cast<uint16_t>(metaData.channelCount * (metaData.bitsPerSample / 8)), - static_cast<uint16_t>(metaData.bitsPerSample) - }; + const WavFormatChunkPcm formatChunk{WavFormat::PCM, + static_cast<uint16_t>(metaData.channelCount), + metaData.samplesPerSec, + metaData.samplesPerSec * metaData.channelCount * metaData.bitsPerSample / 8, + static_cast<uint16_t>(metaData.channelCount * (metaData.bitsPerSample / 8)), + static_cast<uint16_t>(metaData.bitsPerSample)}; m_stream.write(reinterpret_cast<const char*>(&formatChunk), sizeof(formatChunk)); - const WavChunkHeader dataChunkHeader - { - WAV_CHUNK_ID_DATA, - dataLen - }; + const WavChunkHeader dataChunkHeader{WAV_CHUNK_ID_DATA, dataLen}; m_stream.write(reinterpret_cast<const char*>(&dataChunkHeader), sizeof(dataChunkHeader)); } diff --git a/src/ObjWriting/StructuredDataDef/StructuredDataDefDumper.cpp b/src/ObjWriting/StructuredDataDef/StructuredDataDefDumper.cpp index a8fed89f2..9aea7629f 100644 --- a/src/ObjWriting/StructuredDataDef/StructuredDataDefDumper.cpp +++ b/src/ObjWriting/StructuredDataDef/StructuredDataDefDumper.cpp @@ -1,11 +1,11 @@ #include "StructuredDataDefDumper.h" -#include <cassert> -#include <sstream> - #include "Utils/Alignment.h" #include "Utils/StringUtils.h" +#include <cassert> +#include <sstream> + StructuredDataDefDumper::StructuredDataDefDumper(std::ostream& stream) : AbstractTextDumper(stream), m_flags{} @@ -52,7 +52,10 @@ void StructuredDataDefDumper::DumpEnum(const CommonStructuredDataEnum& _enum) m_stream << "};\n"; // end enum } -void StructuredDataDefDumper::DumpType(const CommonStructuredDataDef& def, CommonStructuredDataType type, std::string& typeName, std::vector<std::string>& arraySpecifiers) const +void StructuredDataDefDumper::DumpType(const CommonStructuredDataDef& def, + CommonStructuredDataType type, + std::string& typeName, + std::vector<std::string>& arraySpecifiers) const { while (type.m_category != CommonStructuredDataTypeCategory::UNKNOWN) { @@ -79,13 +82,13 @@ void StructuredDataDefDumper::DumpType(const CommonStructuredDataDef& def, Commo type = CommonStructuredDataType(CommonStructuredDataTypeCategory::UNKNOWN); break; case CommonStructuredDataTypeCategory::STRING: - { - std::ostringstream ss; - ss << "string(" << type.m_info.string_length << ')'; - typeName = ss.str(); - type = CommonStructuredDataType(CommonStructuredDataTypeCategory::UNKNOWN); - } - break; + { + std::ostringstream ss; + ss << "string(" << type.m_info.string_length << ')'; + typeName = ss.str(); + type = CommonStructuredDataType(CommonStructuredDataTypeCategory::UNKNOWN); + } + break; case CommonStructuredDataTypeCategory::ENUM: assert(type.m_info.type_index < def.m_enums.size()); if (type.m_info.type_index < def.m_enums.size()) @@ -134,7 +137,9 @@ void StructuredDataDefDumper::DumpType(const CommonStructuredDataDef& def, Commo } } -void StructuredDataDefDumper::DumpProperty(const CommonStructuredDataDef& def, const CommonStructuredDataStructProperty& property, unsigned& currentOffsetInBit) const +void StructuredDataDefDumper::DumpProperty(const CommonStructuredDataDef& def, + const CommonStructuredDataStructProperty& property, + unsigned& currentOffsetInBit) const { std::string typeName; std::vector<std::string> arraySpecifiers; @@ -199,7 +204,8 @@ void StructuredDataDefDumper::DumpStruct(const CommonStructuredDataDef& def, con IncIndent(); - auto currentOffsetInBit = def.m_root_type.m_category == CommonStructuredDataTypeCategory::STRUCT && def.m_root_type.m_info.type_index == structIndex ? 64u : 0u; + auto currentOffsetInBit = + def.m_root_type.m_category == CommonStructuredDataTypeCategory::STRUCT && def.m_root_type.m_info.type_index == structIndex ? 64u : 0u; for (const auto& property : _struct.m_properties) DumpProperty(def, property, currentOffsetInBit); diff --git a/src/ObjWriting/StructuredDataDef/StructuredDataDefDumper.h b/src/ObjWriting/StructuredDataDef/StructuredDataDefDumper.h index 5195f2235..64b69f20e 100644 --- a/src/ObjWriting/StructuredDataDef/StructuredDataDefDumper.h +++ b/src/ObjWriting/StructuredDataDef/StructuredDataDefDumper.h @@ -1,11 +1,11 @@ #pragma once +#include "Dumping/AbstractTextDumper.h" +#include "StructuredDataDef/CommonStructuredDataDef.h" + #include <ostream> #include <string> #include <vector> -#include "Dumping/AbstractTextDumper.h" -#include "StructuredDataDef/CommonStructuredDataDef.h" - class StructuredDataDefDumper : AbstractTextDumper { struct diff --git a/src/Parser/Parsing/ILexer.h b/src/Parser/Parsing/ILexer.h index e84249fe4..e0a53c3c5 100644 --- a/src/Parser/Parsing/ILexer.h +++ b/src/Parser/Parsing/ILexer.h @@ -3,8 +3,7 @@ #include "IParserLineStream.h" #include "Parsing/IParserValue.h" -template<typename TokenType> -class ILexer +template<typename TokenType> class ILexer { // TokenType must inherit IParserValue static_assert(std::is_base_of<IParserValue, TokenType>::value); diff --git a/src/Parser/Parsing/IPackValueSupplier.h b/src/Parser/Parsing/IPackValueSupplier.h index d023011c8..0c2626447 100644 --- a/src/Parser/Parsing/IPackValueSupplier.h +++ b/src/Parser/Parsing/IPackValueSupplier.h @@ -11,4 +11,4 @@ class IPackValueSupplier IPackValueSupplier& operator=(IPackValueSupplier&& other) noexcept = default; virtual int GetCurrentPack() const = 0; -}; \ No newline at end of file +}; diff --git a/src/Parser/Parsing/IParserLineStream.h b/src/Parser/Parsing/IParserLineStream.h index f00a3432a..8fb393447 100644 --- a/src/Parser/Parsing/IParserLineStream.h +++ b/src/Parser/Parsing/IParserLineStream.h @@ -1,10 +1,10 @@ #pragma once -#include <string> +#include "Utils/ClassUtils.h" + #include <functional> #include <memory> - -#include "Utils/ClassUtils.h" +#include <string> class ParserLine { diff --git a/src/Parser/Parsing/IParserValue.h b/src/Parser/Parsing/IParserValue.h index 3dfd4c4c9..bb138cc1b 100644 --- a/src/Parser/Parsing/IParserValue.h +++ b/src/Parser/Parsing/IParserValue.h @@ -1,7 +1,7 @@ #pragma once -#include "Utils/ClassUtils.h" #include "TokenPos.h" +#include "Utils/ClassUtils.h" class IParserValue { diff --git a/src/Parser/Parsing/Impl/AbstractDirectiveStreamProxy.cpp b/src/Parser/Parsing/Impl/AbstractDirectiveStreamProxy.cpp index 492ecbd96..a6c321929 100644 --- a/src/Parser/Parsing/Impl/AbstractDirectiveStreamProxy.cpp +++ b/src/Parser/Parsing/Impl/AbstractDirectiveStreamProxy.cpp @@ -7,7 +7,7 @@ TokenPos AbstractDirectiveStreamProxy::CreatePos(const ParserLine& line, const u bool AbstractDirectiveStreamProxy::SkipWhitespace(const ParserLine& line, unsigned& position) { - while(true) + while (true) { if (position >= line.m_line.size()) return false; @@ -31,7 +31,7 @@ bool AbstractDirectiveStreamProxy::ExtractInteger(const ParserLine& line, unsign value = strtol(startPosition, &endPosition, 0); const auto len = endPosition - startPosition; - if(len > 0) + if (len > 0) { position += len; return true; @@ -49,9 +49,7 @@ bool AbstractDirectiveStreamProxy::ExtractIdentifier(const ParserLine& line, uns return !firstChar; const auto c = line.m_line[position]; - if (isalpha(c) - || c == '_' - || !firstChar && isdigit(c)) + if (isalpha(c) || c == '_' || !firstChar && isdigit(c)) { position++; } @@ -108,10 +106,10 @@ bool AbstractDirectiveStreamProxy::FindDirective(const ParserLine& line, unsigne continue; directiveEndPos = directiveStartPosition + 1; - for(; directiveEndPos < line.m_line.size(); directiveEndPos++) + for (; directiveEndPos < line.m_line.size(); directiveEndPos++) { const auto c2 = line.m_line[directiveEndPos]; - + if (isspace(c2)) break; } diff --git a/src/Parser/Parsing/Impl/AbstractLexer.h b/src/Parser/Parsing/Impl/AbstractLexer.h index dfbb91c8f..637be8078 100644 --- a/src/Parser/Parsing/Impl/AbstractLexer.h +++ b/src/Parser/Parsing/Impl/AbstractLexer.h @@ -1,17 +1,16 @@ #pragma once -#include <cassert> -#include <deque> -#include <sstream> - -#include "Utils/ClassUtils.h" #include "Parsing/ILexer.h" #include "Parsing/IParserLineStream.h" #include "Parsing/ParsingException.h" +#include "Utils/ClassUtils.h" #include "Utils/StringUtils.h" -template <typename TokenType> -class AbstractLexer : public ILexer<TokenType> +#include <cassert> +#include <deque> +#include <sstream> + +template<typename TokenType> class AbstractLexer : public ILexer<TokenType> { // TokenType must inherit IParserValue static_assert(std::is_base_of<IParserValue, TokenType>::value); @@ -311,16 +310,12 @@ class AbstractLexer : public ILexer<TokenType> { const auto& currentLine = CurrentLine(); assert(m_current_line_offset >= 1); - assert(isdigit(currentLine.m_line[m_current_line_offset - 1]) - || currentLine.m_line[m_current_line_offset - 1] == '.' - || currentLine.m_line[m_current_line_offset - 1] == '+' - || currentLine.m_line[m_current_line_offset - 1] == '-'); + assert(isdigit(currentLine.m_line[m_current_line_offset - 1]) || currentLine.m_line[m_current_line_offset - 1] == '.' + || currentLine.m_line[m_current_line_offset - 1] == '+' || currentLine.m_line[m_current_line_offset - 1] == '-'); hasSignPrefix = currentLine.m_line[m_current_line_offset - 1] == '+' || currentLine.m_line[m_current_line_offset - 1] == '-'; const auto lineLength = currentLine.m_line.size(); - if (lineLength - m_current_line_offset >= 1 - && currentLine.m_line[m_current_line_offset - 1] == '0' - && currentLine.m_line[m_current_line_offset] == 'x') + if (lineLength - m_current_line_offset >= 1 && currentLine.m_line[m_current_line_offset - 1] == '0' && currentLine.m_line[m_current_line_offset] == 'x') { isFloatingPoint = false; ReadHexNumber(integerValue); @@ -341,15 +336,12 @@ class AbstractLexer : public ILexer<TokenType> { const auto& currentLine = CurrentLine(); assert(m_current_line_offset >= 1); - assert(isdigit(currentLine.m_line[m_current_line_offset - 1]) - || currentLine.m_line[m_current_line_offset - 1] == '+' - || currentLine.m_line[m_current_line_offset - 1] == '-'); + assert(isdigit(currentLine.m_line[m_current_line_offset - 1]) || currentLine.m_line[m_current_line_offset - 1] == '+' + || currentLine.m_line[m_current_line_offset - 1] == '-'); hasSignPrefix = currentLine.m_line[m_current_line_offset - 1] == '+' || currentLine.m_line[m_current_line_offset - 1] == '-'; const auto lineLength = currentLine.m_line.size(); - if (lineLength - m_current_line_offset >= 1 - && currentLine.m_line[m_current_line_offset - 1] == '0' - && currentLine.m_line[m_current_line_offset] == 'x') + if (lineLength - m_current_line_offset >= 1 && currentLine.m_line[m_current_line_offset - 1] == '0' && currentLine.m_line[m_current_line_offset] == 'x') { ReadHexNumber(integerValue); } @@ -376,9 +368,9 @@ class AbstractLexer : public ILexer<TokenType> if (static_cast<int>(m_token_cache.size()) <= amount) { const auto& lastToken = m_token_cache.back(); - while (!m_line_cache.empty() - && (m_line_cache.front().m_line_number != lastToken.GetPos().m_line - || *m_line_cache.front().m_filename != lastToken.GetPos().m_filename.get())) + while ( + !m_line_cache.empty() + && (m_line_cache.front().m_line_number != lastToken.GetPos().m_line || *m_line_cache.front().m_filename != lastToken.GetPos().m_filename.get())) { m_line_cache.pop_front(); m_line_index--; @@ -390,8 +382,8 @@ class AbstractLexer : public ILexer<TokenType> m_token_cache.erase(m_token_cache.begin(), m_token_cache.begin() + amount); const auto& firstToken = m_token_cache.front(); while (!m_line_cache.empty() - && (m_line_cache.front().m_line_number != firstToken.GetPos().m_line - || *m_line_cache.front().m_filename != firstToken.GetPos().m_filename.get())) + && (m_line_cache.front().m_line_number != firstToken.GetPos().m_line + || *m_line_cache.front().m_filename != firstToken.GetPos().m_filename.get())) { m_line_cache.pop_front(); m_line_index--; @@ -413,9 +405,7 @@ class AbstractLexer : public ILexer<TokenType> { for (const auto& line : m_line_cache) { - if (line.m_filename - && *line.m_filename == pos.m_filename.get() - && line.m_line_number == pos.m_line) + if (line.m_filename && *line.m_filename == pos.m_filename.get() && line.m_line_number == pos.m_line) { return line; } diff --git a/src/Parser/Parsing/Impl/AbstractParser.h b/src/Parser/Parsing/Impl/AbstractParser.h index ba83b4818..5e9ac3c69 100644 --- a/src/Parser/Parsing/Impl/AbstractParser.h +++ b/src/Parser/Parsing/Impl/AbstractParser.h @@ -1,15 +1,14 @@ #pragma once -#include <iostream> -#include <vector> - -#include "Parsing/IParser.h" #include "Parsing/ILexer.h" -#include "Parsing/Sequence/AbstractSequence.h" +#include "Parsing/IParser.h" #include "Parsing/ParsingException.h" +#include "Parsing/Sequence/AbstractSequence.h" + +#include <iostream> +#include <vector> -template <typename TokenType, typename ParserState> -class AbstractParser : public IParser +template<typename TokenType, typename ParserState> class AbstractParser : public IParser { // TokenType must inherit IParserValue static_assert(std::is_base_of<IParserValue, TokenType>::value); @@ -65,11 +64,12 @@ class AbstractParser : public IParser if (!line.IsEof()) { std::cerr << "Error: " << pos.m_filename.get() << " L" << pos.m_line << ':' << pos.m_column << " Could not parse expression:\n" - << line.m_line.substr(pos.m_column - 1) << std::endl; + << line.m_line.substr(pos.m_column - 1) << std::endl; } else { - std::cerr << "Error: " << pos.m_filename.get() << " L" << pos.m_line << ':' << pos.m_column << " Could not parse expression." << std::endl; + std::cerr << "Error: " << pos.m_filename.get() << " L" << pos.m_line << ':' << pos.m_column << " Could not parse expression." + << std::endl; } return false; } diff --git a/src/Parser/Parsing/Impl/CommentRemovingStreamProxy.cpp b/src/Parser/Parsing/Impl/CommentRemovingStreamProxy.cpp index b4bf76940..32f0f2a12 100644 --- a/src/Parser/Parsing/Impl/CommentRemovingStreamProxy.cpp +++ b/src/Parser/Parsing/Impl/CommentRemovingStreamProxy.cpp @@ -34,7 +34,7 @@ ParserLine CommentRemovingStreamProxy::NextLine() m_inside_multi_line_comment = false; } } - else if(inString) + else if (inString) { if (isEscaped) isEscaped = false; @@ -45,11 +45,11 @@ ParserLine CommentRemovingStreamProxy::NextLine() } else { - if(c == '"') + if (c == '"') { inString = true; } - else if(c == '/' && i + 1 < line.m_line.size()) + else if (c == '/' && i + 1 < line.m_line.size()) { const auto c1 = line.m_line[i + 1]; @@ -58,7 +58,7 @@ ParserLine CommentRemovingStreamProxy::NextLine() multiLineCommentStart = i; m_inside_multi_line_comment = true; } - else if(c1 == '/') + else if (c1 == '/') { m_next_line_is_comment = line.m_line[line.m_line.size() - 1] == '\\'; line.m_line.erase(i); @@ -68,7 +68,7 @@ ParserLine CommentRemovingStreamProxy::NextLine() } } - if(m_inside_multi_line_comment) + if (m_inside_multi_line_comment) line.m_line.erase(multiLineCommentStart); return line; diff --git a/src/Parser/Parsing/Impl/DefinesStreamProxy.cpp b/src/Parser/Parsing/Impl/DefinesStreamProxy.cpp index 4e6f7deaf..b54a5330a 100644 --- a/src/Parser/Parsing/Impl/DefinesStreamProxy.cpp +++ b/src/Parser/Parsing/Impl/DefinesStreamProxy.cpp @@ -1,15 +1,15 @@ #include "DefinesStreamProxy.h" -#include <regex> -#include <sstream> -#include <utility> - -#include "Utils/ClassUtils.h" #include "ParserSingleInputStream.h" #include "Parsing/ParsingException.h" -#include "Parsing/Simple/SimpleExpressionInterpreter.h" #include "Parsing/Simple/Expression/ISimpleExpression.h" #include "Parsing/Simple/Expression/SimpleExpressionMatchers.h" +#include "Parsing/Simple/SimpleExpressionInterpreter.h" +#include "Utils/ClassUtils.h" + +#include <regex> +#include <sstream> +#include <utility> DefinesStreamProxy::DefineParameterPosition::DefineParameterPosition() : m_parameter_index(0u), @@ -23,8 +23,7 @@ DefinesStreamProxy::DefineParameterPosition::DefineParameterPosition(const unsig { } -DefinesStreamProxy::Define::Define() -= default; +DefinesStreamProxy::Define::Define() = default; DefinesStreamProxy::Define::Define(std::string name, std::string value) : m_name(std::move(name)), @@ -277,7 +276,8 @@ bool DefinesStreamProxy::MatchUndefDirective(const ParserLine& line, const unsig return true; } -std::unique_ptr<ISimpleExpression> DefinesStreamProxy::ParseExpression(std::shared_ptr<std::string> fileName, int lineNumber, std::string expressionString) const +std::unique_ptr<ISimpleExpression> + DefinesStreamProxy::ParseExpression(std::shared_ptr<std::string> fileName, int lineNumber, std::string expressionString) const { ParserLine pseudoLine(std::move(fileName), lineNumber, std::move(expressionString)); ExpandDefinedExpressions(pseudoLine); @@ -463,16 +463,13 @@ bool DefinesStreamProxy::MatchDirectives(const ParserLine& line) if (m_modes.empty() || m_modes.top() == BlockMode::IN_BLOCK) { - if (MatchDefineDirective(line, directiveStartPos, directiveEndPos) - || MatchUndefDirective(line, directiveStartPos, directiveEndPos)) + if (MatchDefineDirective(line, directiveStartPos, directiveEndPos) || MatchUndefDirective(line, directiveStartPos, directiveEndPos)) return true; } - return MatchIfdefDirective(line, directiveStartPos, directiveEndPos) - || MatchIfDirective(line, directiveStartPos, directiveEndPos) - || MatchElIfDirective(line, directiveStartPos, directiveEndPos) - || MatchElseDirective(line, directiveStartPos, directiveEndPos) - || MatchEndifDirective(line, directiveStartPos, directiveEndPos); + return MatchIfdefDirective(line, directiveStartPos, directiveEndPos) || MatchIfDirective(line, directiveStartPos, directiveEndPos) + || MatchElIfDirective(line, directiveStartPos, directiveEndPos) || MatchElseDirective(line, directiveStartPos, directiveEndPos) + || MatchEndifDirective(line, directiveStartPos, directiveEndPos); } bool DefinesStreamProxy::FindDefineForWord(const ParserLine& line, const unsigned wordStart, const unsigned wordEnd, const Define*& value) const @@ -488,7 +485,10 @@ bool DefinesStreamProxy::FindDefineForWord(const ParserLine& line, const unsigne return false; } -void DefinesStreamProxy::ExtractParametersFromDefineUsage(const ParserLine& line, const unsigned parameterStart, unsigned& parameterEnd, std::vector<std::string>& parameterValues) +void DefinesStreamProxy::ExtractParametersFromDefineUsage(const ParserLine& line, + const unsigned parameterStart, + unsigned& parameterEnd, + std::vector<std::string>& parameterValues) { if (line.m_line[parameterStart] != '(') return; @@ -553,7 +553,7 @@ void DefinesStreamProxy::ExtractParametersFromDefineUsage(const ParserLine& line bool DefinesStreamProxy::MatchDefinedExpression(const ParserLine& line, unsigned& pos, std::string& definitionName) { unsigned currentPos = pos; - + if (!MatchNextCharacter(line, currentPos, '(')) return false; @@ -609,7 +609,8 @@ void DefinesStreamProxy::ExpandDefines(ParserLine& line) const do { if (defineIterations > MAX_DEFINE_ITERATIONS) - throw ParsingException(CreatePos(line, 1), "Potential define loop? Exceeded max define iterations of " + std::to_string(MAX_DEFINE_ITERATIONS) + " iterations."); + throw ParsingException(CreatePos(line, 1), + "Potential define loop? Exceeded max define iterations of " + std::to_string(MAX_DEFINE_ITERATIONS) + " iterations."); usesDefines = false; @@ -684,8 +685,7 @@ void DefinesStreamProxy::ExpandDefines(ParserLine& line) const } defineIterations++; - } - while (usesDefines); + } while (usesDefines); } void DefinesStreamProxy::AddDefine(Define define) diff --git a/src/Parser/Parsing/Impl/DefinesStreamProxy.h b/src/Parser/Parsing/Impl/DefinesStreamProxy.h index 77188981b..8b216981a 100644 --- a/src/Parser/Parsing/Impl/DefinesStreamProxy.h +++ b/src/Parser/Parsing/Impl/DefinesStreamProxy.h @@ -1,13 +1,13 @@ #pragma once -#include <map> -#include <stack> -#include <sstream> - #include "AbstractDirectiveStreamProxy.h" #include "Parsing/IParserLineStream.h" #include "Parsing/Simple/Expression/ISimpleExpression.h" +#include <map> +#include <sstream> +#include <stack> + class DefinesStreamProxy final : public AbstractDirectiveStreamProxy { static constexpr const char* DEFINE_DIRECTIVE = "define"; @@ -77,7 +77,8 @@ class DefinesStreamProxy final : public AbstractDirectiveStreamProxy _NODISCARD bool MatchEndifDirective(const ParserLine& line, unsigned directiveStartPosition, unsigned directiveEndPosition); _NODISCARD bool MatchDirectives(const ParserLine& line); - static void ExtractParametersFromDefineUsage(const ParserLine& line, unsigned parameterStart, unsigned& parameterEnd, std::vector<std::string>& parameterValues); + static void + ExtractParametersFromDefineUsage(const ParserLine& line, unsigned parameterStart, unsigned& parameterEnd, std::vector<std::string>& parameterValues); bool FindDefineForWord(const ParserLine& line, unsigned wordStart, unsigned wordEnd, const Define*& value) const; static bool MatchDefinedExpression(const ParserLine& line, unsigned& pos, std::string& definitionName); diff --git a/src/Parser/Parsing/Impl/IncludingStreamProxy.cpp b/src/Parser/Parsing/Impl/IncludingStreamProxy.cpp index bd1b38c8c..6b628e8eb 100644 --- a/src/Parser/Parsing/Impl/IncludingStreamProxy.cpp +++ b/src/Parser/Parsing/Impl/IncludingStreamProxy.cpp @@ -1,10 +1,10 @@ #include "IncludingStreamProxy.h" -#include <sstream> -#include <filesystem> - #include "Parsing/ParsingException.h" +#include <filesystem> +#include <sstream> + namespace fs = std::filesystem; IncludingStreamProxy::IncludingStreamProxy(IParserLineStream* stream) @@ -12,7 +12,10 @@ IncludingStreamProxy::IncludingStreamProxy(IParserLineStream* stream) { } -bool IncludingStreamProxy::ExtractIncludeFilename(const ParserLine& line, const unsigned includeDirectivePosition, unsigned& filenameStartPosition, unsigned& filenameEndPosition) +bool IncludingStreamProxy::ExtractIncludeFilename(const ParserLine& line, + const unsigned includeDirectivePosition, + unsigned& filenameStartPosition, + unsigned& filenameEndPosition) { auto currentPos = includeDirectivePosition; bool isDoubleQuotes; @@ -66,7 +69,7 @@ bool IncludingStreamProxy::MatchIncludeDirective(const ParserLine& line, const u { return false; } - + unsigned filenameStart, filenameEnd; if (!ExtractIncludeFilename(line, currentPos, filenameStart, filenameEnd)) @@ -91,7 +94,7 @@ bool IncludingStreamProxy::MatchPragmaOnceDirective(const ParserLine& line, cons { auto currentPos = directiveStartPos; - if(directiveEndPos - directiveStartPos != std::char_traits<char>::length(PRAGMA_DIRECTIVE) + if (directiveEndPos - directiveStartPos != std::char_traits<char>::length(PRAGMA_DIRECTIVE) || !MatchString(line, currentPos, PRAGMA_DIRECTIVE, std::char_traits<char>::length(PRAGMA_DIRECTIVE))) { return false; @@ -123,15 +126,14 @@ bool IncludingStreamProxy::MatchDirectives(const ParserLine& line) return false; directiveStartPos++; - return MatchIncludeDirective(line, directiveStartPos, directiveEndPos) - || MatchPragmaOnceDirective(line, directiveStartPos, directiveEndPos); + return MatchIncludeDirective(line, directiveStartPos, directiveEndPos) || MatchPragmaOnceDirective(line, directiveStartPos, directiveEndPos); } ParserLine IncludingStreamProxy::NextLine() { auto line = m_stream->NextLine(); - while(MatchDirectives(line)) + while (MatchDirectives(line)) line = m_stream->NextLine(); return line; diff --git a/src/Parser/Parsing/Impl/IncludingStreamProxy.h b/src/Parser/Parsing/Impl/IncludingStreamProxy.h index 6fb64587c..dd201cfa6 100644 --- a/src/Parser/Parsing/Impl/IncludingStreamProxy.h +++ b/src/Parser/Parsing/Impl/IncludingStreamProxy.h @@ -1,10 +1,10 @@ #pragma once -#include <set> - #include "AbstractDirectiveStreamProxy.h" #include "Parsing/IParserLineStream.h" +#include <set> + class IncludingStreamProxy final : public AbstractDirectiveStreamProxy { static constexpr const char* INCLUDE_QUOTES_ERROR = "Invalid include directive. Expected \"\" or <>"; @@ -14,8 +14,9 @@ class IncludingStreamProxy final : public AbstractDirectiveStreamProxy IParserLineStream* const m_stream; std::set<std::string> m_included_files; - - _NODISCARD static bool ExtractIncludeFilename(const ParserLine& line, unsigned includeDirectivePosition, unsigned& filenameStartPosition, unsigned& filenameEndPosition); + + _NODISCARD static bool + ExtractIncludeFilename(const ParserLine& line, unsigned includeDirectivePosition, unsigned& filenameStartPosition, unsigned& filenameEndPosition); _NODISCARD bool MatchIncludeDirective(const ParserLine& line, unsigned directiveStartPos, unsigned directiveEndPos) const; _NODISCARD bool MatchPragmaOnceDirective(const ParserLine& line, unsigned directiveStartPos, unsigned directiveEndPos); _NODISCARD bool MatchDirectives(const ParserLine& line); diff --git a/src/Parser/Parsing/Impl/PackDefinitionStreamProxy.h b/src/Parser/Parsing/Impl/PackDefinitionStreamProxy.h index 9dce21eb7..73730ff6b 100644 --- a/src/Parser/Parsing/Impl/PackDefinitionStreamProxy.h +++ b/src/Parser/Parsing/Impl/PackDefinitionStreamProxy.h @@ -1,11 +1,11 @@ #pragma once -#include <stack> - -#include "Utils/ClassUtils.h" #include "AbstractDirectiveStreamProxy.h" #include "Parsing/IPackValueSupplier.h" #include "Parsing/IParserLineStream.h" +#include "Utils/ClassUtils.h" + +#include <stack> class PackDefinitionStreamProxy final : public AbstractDirectiveStreamProxy, public IPackValueSupplier { diff --git a/src/Parser/Parsing/Impl/ParserFilesystemStream.cpp b/src/Parser/Parsing/Impl/ParserFilesystemStream.cpp index 8192533ee..894843e93 100644 --- a/src/Parser/Parsing/Impl/ParserFilesystemStream.cpp +++ b/src/Parser/Parsing/Impl/ParserFilesystemStream.cpp @@ -1,7 +1,7 @@ #include "ParserFilesystemStream.h" -#include <sstream> #include <filesystem> +#include <sstream> namespace fs = std::filesystem; @@ -20,8 +20,7 @@ ParserFilesystemStream::ParserFilesystemStream(const std::string& path) bool ParserFilesystemStream::IsOpen() const { - return !m_files.empty() - && m_files.top().m_stream.is_open(); + return !m_files.empty() && m_files.top().m_stream.is_open(); } ParserLine ParserFilesystemStream::NextLine() @@ -32,7 +31,7 @@ ParserLine ParserFilesystemStream::NextLine() if (m_files.empty()) return ParserLine(); - while(!m_files.empty()) + while (!m_files.empty()) { auto& fileInfo = m_files.top(); @@ -61,7 +60,7 @@ ParserLine ParserFilesystemStream::NextLine() c = fileInfo.m_stream.get(); } - if(hasLength) + if (hasLength) return ParserLine(fileInfo.m_file_path, fileInfo.m_line_number, str.str()); m_files.pop(); } @@ -73,7 +72,7 @@ bool ParserFilesystemStream::IncludeFile(const std::string& filename) { if (m_files.empty()) return false; - + auto newFilePath = fs::path(*m_files.top().m_file_path); newFilePath.remove_filename().concat(filename); newFilePath = absolute(newFilePath); @@ -89,12 +88,11 @@ bool ParserFilesystemStream::IncludeFile(const std::string& filename) void ParserFilesystemStream::PopCurrentFile() { - if(!m_files.empty()) + if (!m_files.empty()) m_files.pop(); } bool ParserFilesystemStream::Eof() const { - return m_files.empty() - || m_files.top().m_stream.eof(); + return m_files.empty() || m_files.top().m_stream.eof(); } diff --git a/src/Parser/Parsing/Impl/ParserFilesystemStream.h b/src/Parser/Parsing/Impl/ParserFilesystemStream.h index 628708964..a981e9040 100644 --- a/src/Parser/Parsing/Impl/ParserFilesystemStream.h +++ b/src/Parser/Parsing/Impl/ParserFilesystemStream.h @@ -1,10 +1,10 @@ #pragma once -#include <stack> -#include <fstream> - #include "Parsing/IParserLineStream.h" +#include <fstream> +#include <stack> + class ParserFilesystemStream final : public IParserLineStream { class FileInfo @@ -16,6 +16,7 @@ class ParserFilesystemStream final : public IParserLineStream explicit FileInfo(std::string filePath); }; + std::stack<FileInfo> m_files; public: diff --git a/src/Parser/Parsing/Impl/ParserMultiInputStream.h b/src/Parser/Parsing/Impl/ParserMultiInputStream.h index bd6ee7cb4..1d74d659b 100644 --- a/src/Parser/Parsing/Impl/ParserMultiInputStream.h +++ b/src/Parser/Parsing/Impl/ParserMultiInputStream.h @@ -1,11 +1,11 @@ #pragma once +#include "Parsing/IParserLineStream.h" + +#include <functional> #include <istream> -#include <stack> #include <memory> -#include <functional> - -#include "Parsing/IParserLineStream.h" +#include <stack> class ParserMultiInputStream final : public IParserLineStream { @@ -37,4 +37,4 @@ class ParserMultiInputStream final : public IParserLineStream void PopCurrentFile() override; _NODISCARD bool IsOpen() const override; _NODISCARD bool Eof() const override; -}; \ No newline at end of file +}; diff --git a/src/Parser/Parsing/Impl/ParserSingleInputStream.cpp b/src/Parser/Parsing/Impl/ParserSingleInputStream.cpp index e561b2c24..359b23118 100644 --- a/src/Parser/Parsing/Impl/ParserSingleInputStream.cpp +++ b/src/Parser/Parsing/Impl/ParserSingleInputStream.cpp @@ -50,9 +50,7 @@ bool ParserSingleInputStream::IncludeFile(const std::string& filename) return false; } -void ParserSingleInputStream::PopCurrentFile() -{ -} +void ParserSingleInputStream::PopCurrentFile() {} bool ParserSingleInputStream::IsOpen() const { diff --git a/src/Parser/Parsing/Impl/ParserSingleInputStream.h b/src/Parser/Parsing/Impl/ParserSingleInputStream.h index 4a60adbc8..c81e4ea50 100644 --- a/src/Parser/Parsing/Impl/ParserSingleInputStream.h +++ b/src/Parser/Parsing/Impl/ParserSingleInputStream.h @@ -1,10 +1,10 @@ #pragma once +#include "Parsing/IParserLineStream.h" + #include <istream> #include <memory> -#include "Parsing/IParserLineStream.h" - class ParserSingleInputStream final : public IParserLineStream { std::istream& m_stream; @@ -19,4 +19,4 @@ class ParserSingleInputStream final : public IParserLineStream void PopCurrentFile() override; _NODISCARD bool IsOpen() const override; _NODISCARD bool Eof() const override; -}; \ No newline at end of file +}; diff --git a/src/Parser/Parsing/Matcher/AbstractMatcher.h b/src/Parser/Parsing/Matcher/AbstractMatcher.h index f6e4d797a..8b1121307 100644 --- a/src/Parser/Parsing/Matcher/AbstractMatcher.h +++ b/src/Parser/Parsing/Matcher/AbstractMatcher.h @@ -1,13 +1,12 @@ #pragma once -#include <functional> - -#include "Parsing/IParserValue.h" #include "Parsing/ILexer.h" +#include "Parsing/IParserValue.h" #include "Parsing/Matcher/MatcherResult.h" -template <typename TokenType> -class AbstractMatcher +#include <functional> + +template<typename TokenType> class AbstractMatcher { // TokenType must inherit IParserValue static_assert(std::is_base_of<IParserValue, TokenType>::value); @@ -83,7 +82,7 @@ class AbstractMatcher result.m_matched_tokens.clear(); result.m_matched_tokens.emplace_back(result.m_fabricated_tokens.size() - 1, true); } - else if(result.m_matched_tokens.empty()) + else if (result.m_matched_tokens.empty()) { for (auto i = 0u; i < result.m_consumed_token_count; i++) result.m_matched_tokens.emplace_back(tokenOffset + i, false); diff --git a/src/Parser/Parsing/Matcher/AbstractMatcherFactory.h b/src/Parser/Parsing/Matcher/AbstractMatcherFactory.h index 39535cc4b..1b957512e 100644 --- a/src/Parser/Parsing/Matcher/AbstractMatcherFactory.h +++ b/src/Parser/Parsing/Matcher/AbstractMatcherFactory.h @@ -1,20 +1,19 @@ #pragma once -#include <memory> - -#include "Utils/ClassUtils.h" #include "AbstractMatcher.h" #include "MatcherAnd.h" +#include "MatcherFalse.h" #include "MatcherLabel.h" #include "MatcherLoop.h" -#include "MatcherFalse.h" -#include "MatcherTrue.h" #include "MatcherOptional.h" #include "MatcherOr.h" +#include "MatcherTrue.h" #include "Parsing/IParserValue.h" +#include "Utils/ClassUtils.h" + +#include <memory> -template <typename TokenType> -class MatcherFactoryWrapper +template<typename TokenType> class MatcherFactoryWrapper { // TokenType must inherit IParserValue static_assert(std::is_base_of<IParserValue, TokenType>::value); @@ -71,8 +70,7 @@ class MatcherFactoryWrapper } }; -template <typename TokenType> -class AbstractMatcherFactory +template<typename TokenType> class AbstractMatcherFactory { // TokenType must inherit IParserValue static_assert(std::is_base_of<IParserValue, TokenType>::value); diff --git a/src/Parser/Parsing/Matcher/MatcherAnd.h b/src/Parser/Parsing/Matcher/MatcherAnd.h index 740c36b17..9059e09fe 100644 --- a/src/Parser/Parsing/Matcher/MatcherAnd.h +++ b/src/Parser/Parsing/Matcher/MatcherAnd.h @@ -1,13 +1,12 @@ #pragma once +#include "AbstractMatcher.h" +#include "Parsing/IParserValue.h" + #include <iterator> #include <memory> -#include "Parsing/IParserValue.h" -#include "AbstractMatcher.h" - -template <typename TokenType> -class MatcherAnd final : public AbstractMatcher<TokenType> +template<typename TokenType> class MatcherAnd final : public AbstractMatcher<TokenType> { // TokenType must inherit IParserValue static_assert(std::is_base_of<IParserValue, TokenType>::value); @@ -25,10 +24,10 @@ class MatcherAnd final : public AbstractMatcher<TokenType> if (!result.m_matches) return MatcherResult<TokenType>::NoMatch(); - + matchResult.Absorb(std::move(result)); } - + return matchResult; } diff --git a/src/Parser/Parsing/Matcher/MatcherFalse.h b/src/Parser/Parsing/Matcher/MatcherFalse.h index 3834c223d..f184fc593 100644 --- a/src/Parser/Parsing/Matcher/MatcherFalse.h +++ b/src/Parser/Parsing/Matcher/MatcherFalse.h @@ -1,12 +1,11 @@ #pragma once -#include <memory> - -#include "Parsing/IParserValue.h" #include "AbstractMatcher.h" +#include "Parsing/IParserValue.h" + +#include <memory> -template <typename TokenType> -class MatcherFalse final : public AbstractMatcher<TokenType> +template<typename TokenType> class MatcherFalse final : public AbstractMatcher<TokenType> { // TokenType must inherit IParserValue static_assert(std::is_base_of<IParserValue, TokenType>::value); @@ -18,6 +17,5 @@ class MatcherFalse final : public AbstractMatcher<TokenType> } public: - MatcherFalse() - = default; + MatcherFalse() = default; }; diff --git a/src/Parser/Parsing/Matcher/MatcherLabel.h b/src/Parser/Parsing/Matcher/MatcherLabel.h index 1dff01a31..d07e9c335 100644 --- a/src/Parser/Parsing/Matcher/MatcherLabel.h +++ b/src/Parser/Parsing/Matcher/MatcherLabel.h @@ -1,13 +1,12 @@ #pragma once -#include <cassert> - -#include "Utils/ClassUtils.h" -#include "Parsing/IParserValue.h" #include "AbstractMatcher.h" +#include "Parsing/IParserValue.h" +#include "Utils/ClassUtils.h" + +#include <cassert> -template <typename TokenType> -class IMatcherForLabelSupplier +template<typename TokenType> class IMatcherForLabelSupplier { // TokenType must inherit IParserValue static_assert(std::is_base_of<IParserValue, TokenType>::value); @@ -23,8 +22,7 @@ class IMatcherForLabelSupplier _NODISCARD virtual AbstractMatcher<TokenType>* GetMatcherForLabel(int label) const = 0; }; -template <typename TokenType> -class MatcherLabel final : public AbstractMatcher<TokenType> +template<typename TokenType> class MatcherLabel final : public AbstractMatcher<TokenType> { // TokenType must inherit IParserValue static_assert(std::is_base_of<IParserValue, TokenType>::value); diff --git a/src/Parser/Parsing/Matcher/MatcherLoop.h b/src/Parser/Parsing/Matcher/MatcherLoop.h index 2ef415072..f623c69f1 100644 --- a/src/Parser/Parsing/Matcher/MatcherLoop.h +++ b/src/Parser/Parsing/Matcher/MatcherLoop.h @@ -1,12 +1,11 @@ #pragma once -#include <memory> - -#include "Parsing/IParserValue.h" #include "AbstractMatcher.h" +#include "Parsing/IParserValue.h" + +#include <memory> -template <typename TokenType> -class MatcherLoop final : public AbstractMatcher<TokenType> +template<typename TokenType> class MatcherLoop final : public AbstractMatcher<TokenType> { // TokenType must inherit IParserValue static_assert(std::is_base_of<IParserValue, TokenType>::value); @@ -19,11 +18,11 @@ class MatcherLoop final : public AbstractMatcher<TokenType> auto matchResult = MatcherResult<TokenType>::Match(0); auto loopedAtLeastOnce = false; - while(true) + while (true) { auto result = m_matcher->Match(lexer, tokenOffset + matchResult.m_consumed_token_count); - if(!result.m_matches) + if (!result.m_matches) { if (loopedAtLeastOnce) return matchResult; diff --git a/src/Parser/Parsing/Matcher/MatcherOptional.h b/src/Parser/Parsing/Matcher/MatcherOptional.h index 1360fd6b3..56ebd004a 100644 --- a/src/Parser/Parsing/Matcher/MatcherOptional.h +++ b/src/Parser/Parsing/Matcher/MatcherOptional.h @@ -1,12 +1,11 @@ #pragma once -#include <memory> - -#include "Parsing/IParserValue.h" #include "AbstractMatcher.h" +#include "Parsing/IParserValue.h" + +#include <memory> -template <typename TokenType> -class MatcherOptional final : public AbstractMatcher<TokenType> +template<typename TokenType> class MatcherOptional final : public AbstractMatcher<TokenType> { // TokenType must inherit IParserValue static_assert(std::is_base_of<IParserValue, TokenType>::value); diff --git a/src/Parser/Parsing/Matcher/MatcherOr.h b/src/Parser/Parsing/Matcher/MatcherOr.h index 993073ac5..d8dba50fb 100644 --- a/src/Parser/Parsing/Matcher/MatcherOr.h +++ b/src/Parser/Parsing/Matcher/MatcherOr.h @@ -1,13 +1,12 @@ #pragma once +#include "AbstractMatcher.h" +#include "Parsing/IParserValue.h" + #include <iterator> #include <memory> -#include "Parsing/IParserValue.h" -#include "AbstractMatcher.h" - -template <typename TokenType> -class MatcherOr final : public AbstractMatcher<TokenType> +template<typename TokenType> class MatcherOr final : public AbstractMatcher<TokenType> { // TokenType must inherit IParserValue static_assert(std::is_base_of<IParserValue, TokenType>::value); diff --git a/src/Parser/Parsing/Matcher/MatcherResult.h b/src/Parser/Parsing/Matcher/MatcherResult.h index 925904a5f..f3e99e9d7 100644 --- a/src/Parser/Parsing/Matcher/MatcherResult.h +++ b/src/Parser/Parsing/Matcher/MatcherResult.h @@ -1,14 +1,13 @@ #pragma once +#include "Parsing/IParserValue.h" +#include "Utils/ClassUtils.h" + #include <iterator> #include <limits> #include <vector> -#include "Utils/ClassUtils.h" -#include "Parsing/IParserValue.h" - -template <typename TokenType> -class MatcherResult +template<typename TokenType> class MatcherResult { // TokenType must inherit IParserValue static_assert(std::is_base_of<IParserValue, TokenType>::value); diff --git a/src/Parser/Parsing/Matcher/MatcherTrue.h b/src/Parser/Parsing/Matcher/MatcherTrue.h index 7dd6375cc..5895a02f0 100644 --- a/src/Parser/Parsing/Matcher/MatcherTrue.h +++ b/src/Parser/Parsing/Matcher/MatcherTrue.h @@ -1,12 +1,11 @@ #pragma once -#include <memory> - -#include "Parsing/IParserValue.h" #include "AbstractMatcher.h" +#include "Parsing/IParserValue.h" + +#include <memory> -template <typename TokenType> -class MatcherTrue final : public AbstractMatcher<TokenType> +template<typename TokenType> class MatcherTrue final : public AbstractMatcher<TokenType> { // TokenType must inherit IParserValue static_assert(std::is_base_of<IParserValue, TokenType>::value); @@ -18,6 +17,5 @@ class MatcherTrue final : public AbstractMatcher<TokenType> } public: - MatcherTrue() - = default; + MatcherTrue() = default; }; diff --git a/src/Parser/Parsing/ParsingException.h b/src/Parser/Parsing/ParsingException.h index 400b92341..e036f8732 100644 --- a/src/Parser/Parsing/ParsingException.h +++ b/src/Parser/Parsing/ParsingException.h @@ -1,11 +1,11 @@ #pragma once -#include <exception> -#include <string> - #include "TokenPos.h" #include "Utils/ClassUtils.h" +#include <exception> +#include <string> + class ParsingException final : std::exception { TokenPos m_pos; diff --git a/src/Parser/Parsing/Sequence/AbstractScopeSequenceHolder.h b/src/Parser/Parsing/Sequence/AbstractScopeSequenceHolder.h index 24403005e..0c2950628 100644 --- a/src/Parser/Parsing/Sequence/AbstractScopeSequenceHolder.h +++ b/src/Parser/Parsing/Sequence/AbstractScopeSequenceHolder.h @@ -3,14 +3,14 @@ #include <memory> #include <vector> -template <typename ParserType> -class AbstractScopeSequenceHolder +template<typename ParserType> class AbstractScopeSequenceHolder { std::vector<std::unique_ptr<typename ParserType::sequence_t>>& m_all_sequences; std::vector<typename ParserType::sequence_t*>& m_scope_sequences; protected: - AbstractScopeSequenceHolder(std::vector<std::unique_ptr<typename ParserType::sequence_t>>& allSequences, std::vector<typename ParserType::sequence_t*>& scopeSequences) + AbstractScopeSequenceHolder(std::vector<std::unique_ptr<typename ParserType::sequence_t>>& allSequences, + std::vector<typename ParserType::sequence_t*>& scopeSequences) : m_all_sequences(allSequences), m_scope_sequences(scopeSequences) { diff --git a/src/Parser/Parsing/Sequence/AbstractSequence.h b/src/Parser/Parsing/Sequence/AbstractSequence.h index b61fd06fb..83a9ade73 100644 --- a/src/Parser/Parsing/Sequence/AbstractSequence.h +++ b/src/Parser/Parsing/Sequence/AbstractSequence.h @@ -1,16 +1,15 @@ #pragma once -#include <unordered_map> -#include <cassert> - -#include "SequenceResult.h" -#include "Utils/ClassUtils.h" #include "Parsing/Matcher/AbstractMatcher.h" #include "Parsing/Matcher/MatcherAnd.h" #include "Parsing/Matcher/MatcherLabel.h" +#include "SequenceResult.h" +#include "Utils/ClassUtils.h" + +#include <cassert> +#include <unordered_map> -template<typename TokenType, typename ParserState> -class AbstractSequence : protected IMatcherForLabelSupplier<TokenType> +template<typename TokenType, typename ParserState> class AbstractSequence : protected IMatcherForLabelSupplier<TokenType> { // TokenType must inherit IParserValue static_assert(std::is_base_of<IParserValue, TokenType>::value); @@ -19,7 +18,6 @@ class AbstractSequence : protected IMatcherForLabelSupplier<TokenType> typedef AbstractMatcher<TokenType> matcher_t; private: - std::unique_ptr<matcher_t> m_entry; std::unordered_map<int, std::unique_ptr<matcher_t>> m_matchers; @@ -80,7 +78,7 @@ class AbstractSequence : protected IMatcherForLabelSupplier<TokenType> return false; auto result = m_entry->Match(lexer, 0); - + if (result.m_matches) { SequenceResult<TokenType> sequenceResult(lexer, result); diff --git a/src/Parser/Parsing/Sequence/SequenceResult.h b/src/Parser/Parsing/Sequence/SequenceResult.h index 8c7ae076a..764e43ea3 100644 --- a/src/Parser/Parsing/Sequence/SequenceResult.h +++ b/src/Parser/Parsing/Sequence/SequenceResult.h @@ -1,14 +1,13 @@ #pragma once -#include <unordered_map> - -#include "Utils/ClassUtils.h" #include "Parsing/Matcher/AbstractMatcher.h" #include "Parsing/Matcher/MatcherResult.h" #include "Parsing/ParsingException.h" +#include "Utils/ClassUtils.h" -template <typename TokenType> -class SequenceResult +#include <unordered_map> + +template<typename TokenType> class SequenceResult { class Capture { @@ -57,7 +56,7 @@ class SequenceResult if (m_tag_offset < m_tags.size()) { const auto result = m_tags[m_tag_offset]; - + if (result == tag) m_tag_offset++; @@ -92,7 +91,7 @@ class SequenceResult if (foundEntry == m_captures.end()) throw ParsingException(TokenPos(), "Tried to access next capture even though no captures exists!"); - if(foundEntry->second.m_offset >= foundEntry->second.m_tokens.size()) + if (foundEntry->second.m_offset >= foundEntry->second.m_tokens.size()) throw ParsingException(TokenPos(), "Tried to access next capture even though none exists!"); return foundEntry->second.m_tokens[foundEntry->second.m_offset++]; diff --git a/src/Parser/Parsing/Simple/Expression/ISimpleExpression.h b/src/Parser/Parsing/Simple/Expression/ISimpleExpression.h index 97c026b00..9c2cb7788 100644 --- a/src/Parser/Parsing/Simple/Expression/ISimpleExpression.h +++ b/src/Parser/Parsing/Simple/Expression/ISimpleExpression.h @@ -1,14 +1,16 @@ #pragma once -#include <string> - #include "Utils/ClassUtils.h" +#include <string> + class SimpleExpressionValue; + class ISimpleExpressionScopeValues { protected: ISimpleExpressionScopeValues() = default; + public: virtual ~ISimpleExpressionScopeValues() = default; ISimpleExpressionScopeValues(const ISimpleExpressionScopeValues& other) = default; @@ -23,6 +25,7 @@ class ISimpleExpression { protected: ISimpleExpression() = default; + public: virtual ~ISimpleExpression() = default; ISimpleExpression(const ISimpleExpression& other) = default; @@ -37,4 +40,4 @@ class ISimpleExpression }; // Include SimpleExpressionValue after definition to avoid "base class not defined" -#include "SimpleExpressionValue.h" \ No newline at end of file +#include "SimpleExpressionValue.h" diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionBinaryOperation.cpp b/src/Parser/Parsing/Simple/Expression/SimpleExpressionBinaryOperation.cpp index 8b4131b73..4cd1175e1 100644 --- a/src/Parser/Parsing/Simple/Expression/SimpleExpressionBinaryOperation.cpp +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionBinaryOperation.cpp @@ -3,7 +3,9 @@ #include <cassert> #include <cmath> -SimpleExpressionBinaryOperationType::SimpleExpressionBinaryOperationType(const SimpleBinaryOperationId id, std::string syntax, const SimpleOperationPrecedence precedence, +SimpleExpressionBinaryOperationType::SimpleExpressionBinaryOperationType(const SimpleBinaryOperationId id, + std::string syntax, + const SimpleOperationPrecedence precedence, evaluation_function_t evaluationFunction) : m_id(id), m_syntax(std::move(syntax)), @@ -47,8 +49,7 @@ const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::O } return SimpleExpressionValue(0); - } -); + }); const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::OPERATION_SUBTRACT( SimpleBinaryOperationId::SUBTRACT, @@ -72,8 +73,7 @@ const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::O } return SimpleExpressionValue(0); - } -); + }); const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::OPERATION_MULTIPLY( SimpleBinaryOperationId::MULTIPLY, @@ -97,8 +97,7 @@ const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::O } return SimpleExpressionValue(0); - } -); + }); const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::OPERATION_DIVIDE( SimpleBinaryOperationId::DIVIDE, @@ -122,8 +121,7 @@ const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::O } return SimpleExpressionValue(0); - } -); + }); const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::OPERATION_REMAINDER( SimpleBinaryOperationId::REMAINDER, @@ -135,8 +133,7 @@ const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::O return SimpleExpressionValue(operand1.m_int_value % operand2.m_int_value); return SimpleExpressionValue(0); - } -); + }); const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::OPERATION_BITWISE_AND( SimpleBinaryOperationId::BITWISE_AND, @@ -148,8 +145,7 @@ const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::O return SimpleExpressionValue(operand1.m_int_value & operand2.m_int_value); return SimpleExpressionValue(0); - } -); + }); const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::OPERATION_BITWISE_OR( SimpleBinaryOperationId::BITWISE_OR, @@ -161,8 +157,7 @@ const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::O return SimpleExpressionValue(operand1.m_int_value | operand2.m_int_value); return SimpleExpressionValue(0); - } -); + }); const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::OPERATION_SHIFT_LEFT( SimpleBinaryOperationId::SHIFT_LEFT, @@ -174,8 +169,7 @@ const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::O return SimpleExpressionValue(operand1.m_int_value << operand2.m_int_value); return SimpleExpressionValue(0); - } -); + }); const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::OPERATION_SHIFT_RIGHT( SimpleBinaryOperationId::SHIFT_RIGHT, @@ -187,8 +181,7 @@ const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::O return SimpleExpressionValue(operand1.m_int_value >> operand2.m_int_value); return SimpleExpressionValue(0); - } -); + }); const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::OPERATION_GREATER_THAN( SimpleBinaryOperationId::GREATER_THAN, @@ -215,8 +208,7 @@ const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::O } return SimpleExpressionValue(0); - } -); + }); const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::OPERATION_GREATER_EQUAL_THAN( SimpleBinaryOperationId::GREATER_EQUAL_THAN, @@ -243,8 +235,7 @@ const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::O } return SimpleExpressionValue(0); - } -); + }); const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::OPERATION_LESS_THAN( SimpleBinaryOperationId::LESS_THAN, @@ -271,8 +262,7 @@ const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::O } return SimpleExpressionValue(0); - } -); + }); const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::OPERATION_LESS_EQUAL_THAN( SimpleBinaryOperationId::LESS_EQUAL_THAN, @@ -299,8 +289,7 @@ const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::O } return SimpleExpressionValue(0); - } -); + }); const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::OPERATION_EQUALS( SimpleBinaryOperationId::EQUALS, @@ -337,8 +326,7 @@ const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::O } return SimpleExpressionValue(0); - } -); + }); const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::OPERATION_NOT_EQUAL( SimpleBinaryOperationId::NOT_EQUAL, @@ -375,35 +363,31 @@ const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::O } return SimpleExpressionValue(0); - } -); - -const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::OPERATION_AND( - SimpleBinaryOperationId::AND, - "&&", - SimpleOperationPrecedence::LOGICAL_AND, - [](const SimpleExpressionValue& operand1, const SimpleExpressionValue& operand2) -> SimpleExpressionValue - { - if (operand1.IsTruthy()) - return operand2; - return operand1; - } -); - -const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::OPERATION_OR( - SimpleBinaryOperationId::OR, - "||", - SimpleOperationPrecedence::LOGICAL_OR, - [](const SimpleExpressionValue& operand1, const SimpleExpressionValue& operand2) -> SimpleExpressionValue - { - if (operand1.IsTruthy()) - return operand1; - return operand2; - } -); - -const SimpleExpressionBinaryOperationType* const SimpleExpressionBinaryOperationType::ALL_OPERATION_TYPES[static_cast<int>(SimpleBinaryOperationId::COUNT)] -{ + }); + +const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::OPERATION_AND(SimpleBinaryOperationId::AND, + "&&", + SimpleOperationPrecedence::LOGICAL_AND, + [](const SimpleExpressionValue& operand1, + const SimpleExpressionValue& operand2) -> SimpleExpressionValue + { + if (operand1.IsTruthy()) + return operand2; + return operand1; + }); + +const SimpleExpressionBinaryOperationType SimpleExpressionBinaryOperationType::OPERATION_OR(SimpleBinaryOperationId::OR, + "||", + SimpleOperationPrecedence::LOGICAL_OR, + [](const SimpleExpressionValue& operand1, + const SimpleExpressionValue& operand2) -> SimpleExpressionValue + { + if (operand1.IsTruthy()) + return operand1; + return operand2; + }); + +const SimpleExpressionBinaryOperationType* const SimpleExpressionBinaryOperationType::ALL_OPERATION_TYPES[static_cast<int>(SimpleBinaryOperationId::COUNT)]{ &OPERATION_ADD, &OPERATION_SUBTRACT, &OPERATION_MULTIPLY, @@ -420,10 +404,10 @@ const SimpleExpressionBinaryOperationType* const SimpleExpressionBinaryOperation &OPERATION_EQUALS, &OPERATION_NOT_EQUAL, &OPERATION_AND, - &OPERATION_OR -}; + &OPERATION_OR}; -SimpleExpressionBinaryOperation::SimpleExpressionBinaryOperation(const SimpleExpressionBinaryOperationType* operationType, std::unique_ptr<ISimpleExpression> operand1, +SimpleExpressionBinaryOperation::SimpleExpressionBinaryOperation(const SimpleExpressionBinaryOperationType* operationType, + std::unique_ptr<ISimpleExpression> operand1, std::unique_ptr<ISimpleExpression> operand2) : m_operation_type(operationType), m_operand1(std::move(operand1)), @@ -447,10 +431,8 @@ bool SimpleExpressionBinaryOperation::Equals(const ISimpleExpression* other) con { const auto* otherBinaryOperation = dynamic_cast<const SimpleExpressionBinaryOperation*>(other); - return otherBinaryOperation - && m_operation_type->m_id == otherBinaryOperation->m_operation_type->m_id - && m_operand1->Equals(otherBinaryOperation->m_operand1.get()) - && m_operand2->Equals(otherBinaryOperation->m_operand2.get()); + return otherBinaryOperation && m_operation_type->m_id == otherBinaryOperation->m_operation_type->m_id + && m_operand1->Equals(otherBinaryOperation->m_operand1.get()) && m_operand2->Equals(otherBinaryOperation->m_operand2.get()); } bool SimpleExpressionBinaryOperation::IsStatic() const diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionBinaryOperation.h b/src/Parser/Parsing/Simple/Expression/SimpleExpressionBinaryOperation.h index 210c1cb93..a28875dae 100644 --- a/src/Parser/Parsing/Simple/Expression/SimpleExpressionBinaryOperation.h +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionBinaryOperation.h @@ -1,12 +1,12 @@ #pragma once -#include <string> -#include <memory> -#include <functional> - #include "ISimpleExpression.h" #include "SimpleExpressionValue.h" +#include <functional> +#include <memory> +#include <string> + // https://en.cppreference.com/w/cpp/language/operator_precedence enum class SimpleOperationPrecedence { @@ -55,7 +55,10 @@ class SimpleExpressionBinaryOperationType evaluation_function_t m_evaluation_function; private: - SimpleExpressionBinaryOperationType(SimpleBinaryOperationId id, std::string syntax, SimpleOperationPrecedence precedence, evaluation_function_t evaluationFunction); + SimpleExpressionBinaryOperationType(SimpleBinaryOperationId id, + std::string syntax, + SimpleOperationPrecedence precedence, + evaluation_function_t evaluationFunction); public: static const SimpleExpressionBinaryOperationType OPERATION_ADD; @@ -87,8 +90,8 @@ class SimpleExpressionBinaryOperation final : public ISimpleExpression std::unique_ptr<ISimpleExpression> m_operand2; SimpleExpressionBinaryOperation(const SimpleExpressionBinaryOperationType* operationType, - std::unique_ptr<ISimpleExpression> operand1, - std::unique_ptr<ISimpleExpression> operand2); + std::unique_ptr<ISimpleExpression> operand1, + std::unique_ptr<ISimpleExpression> operand2); _NODISCARD bool Operand1NeedsParenthesis() const; _NODISCARD bool Operand2NeedsParenthesis() const; diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionConditionalOperator.cpp b/src/Parser/Parsing/Simple/Expression/SimpleExpressionConditionalOperator.cpp index b945b8b4c..11da510d9 100644 --- a/src/Parser/Parsing/Simple/Expression/SimpleExpressionConditionalOperator.cpp +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionConditionalOperator.cpp @@ -1,9 +1,9 @@ #include "SimpleExpressionConditionalOperator.h" -SimpleExpressionConditionalOperator::SimpleExpressionConditionalOperator() -= default; +SimpleExpressionConditionalOperator::SimpleExpressionConditionalOperator() = default; -SimpleExpressionConditionalOperator::SimpleExpressionConditionalOperator(std::unique_ptr<ISimpleExpression> condition, std::unique_ptr<ISimpleExpression> trueExpression, +SimpleExpressionConditionalOperator::SimpleExpressionConditionalOperator(std::unique_ptr<ISimpleExpression> condition, + std::unique_ptr<ISimpleExpression> trueExpression, std::unique_ptr<ISimpleExpression> falseExpression) : m_condition(std::move(condition)), m_true_value(std::move(trueExpression)), @@ -15,10 +15,8 @@ bool SimpleExpressionConditionalOperator::Equals(const ISimpleExpression* other) { const auto* otherConditionalOperator = dynamic_cast<const SimpleExpressionConditionalOperator*>(other); - return otherConditionalOperator - && m_condition->Equals(otherConditionalOperator->m_condition.get()) - && m_true_value->Equals(otherConditionalOperator->m_true_value.get()) - && m_false_value->Equals(otherConditionalOperator->m_false_value.get()); + return otherConditionalOperator && m_condition->Equals(otherConditionalOperator->m_condition.get()) + && m_true_value->Equals(otherConditionalOperator->m_true_value.get()) && m_false_value->Equals(otherConditionalOperator->m_false_value.get()); } bool SimpleExpressionConditionalOperator::IsStatic() const @@ -33,7 +31,6 @@ SimpleExpressionValue SimpleExpressionConditionalOperator::EvaluateStatic() cons SimpleExpressionValue SimpleExpressionConditionalOperator::EvaluateNonStatic(const ISimpleExpressionScopeValues* scopeValues) const { - return m_condition->EvaluateNonStatic(scopeValues).IsTruthy() - ? m_true_value->EvaluateNonStatic(scopeValues) - : m_false_value->EvaluateNonStatic(scopeValues); + return m_condition->EvaluateNonStatic(scopeValues).IsTruthy() ? m_true_value->EvaluateNonStatic(scopeValues) + : m_false_value->EvaluateNonStatic(scopeValues); } diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionConditionalOperator.h b/src/Parser/Parsing/Simple/Expression/SimpleExpressionConditionalOperator.h index 3a43483e1..479e8c2e3 100644 --- a/src/Parser/Parsing/Simple/Expression/SimpleExpressionConditionalOperator.h +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionConditionalOperator.h @@ -14,5 +14,7 @@ class SimpleExpressionConditionalOperator final : public ISimpleExpression _NODISCARD SimpleExpressionValue EvaluateNonStatic(const ISimpleExpressionScopeValues* scopeValues) const override; SimpleExpressionConditionalOperator(); - SimpleExpressionConditionalOperator(std::unique_ptr<ISimpleExpression> condition, std::unique_ptr<ISimpleExpression> trueExpression, std::unique_ptr<ISimpleExpression> falseExpression); + SimpleExpressionConditionalOperator(std::unique_ptr<ISimpleExpression> condition, + std::unique_ptr<ISimpleExpression> trueExpression, + std::unique_ptr<ISimpleExpression> falseExpression); }; diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionMatchers.cpp b/src/Parser/Parsing/Simple/Expression/SimpleExpressionMatchers.cpp index dae82f950..a6d571fd0 100644 --- a/src/Parser/Parsing/Simple/Expression/SimpleExpressionMatchers.cpp +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionMatchers.cpp @@ -1,12 +1,12 @@ #include "SimpleExpressionMatchers.h" -#include <algorithm> -#include <list> - -#include "SimpleExpressionConditionalOperator.h" -#include "Parsing/Simple/Matcher/SimpleMatcherFactory.h" #include "Parsing/Simple/Expression/SimpleExpressionBinaryOperation.h" #include "Parsing/Simple/Expression/SimpleExpressionUnaryOperation.h" +#include "Parsing/Simple/Matcher/SimpleMatcherFactory.h" +#include "SimpleExpressionConditionalOperator.h" + +#include <algorithm> +#include <list> static constexpr int TAG_EXPRESSION = SimpleExpressionMatchers::TAG_OFFSET_EXPRESSION + 1; static constexpr int TAG_OPERAND = SimpleExpressionMatchers::TAG_OFFSET_EXPRESSION + 2; @@ -29,7 +29,10 @@ SimpleExpressionMatchers::SimpleExpressionMatchers() { } -SimpleExpressionMatchers::SimpleExpressionMatchers(const bool enableStringOperands, const bool enableIdentifierOperands, const bool enableFloatingPointOperands, const bool enableIntOperands, +SimpleExpressionMatchers::SimpleExpressionMatchers(const bool enableStringOperands, + const bool enableIdentifierOperands, + const bool enableFloatingPointOperands, + const bool enableIntOperands, const bool enableConditionalOperator) : m_enable_string_operands(enableStringOperands), m_enable_identifier_operands(enableIdentifierOperands), @@ -39,8 +42,7 @@ SimpleExpressionMatchers::SimpleExpressionMatchers(const bool enableStringOperan { } -SimpleExpressionMatchers::~SimpleExpressionMatchers() -= default; +SimpleExpressionMatchers::~SimpleExpressionMatchers() = default; void SimpleExpressionMatchers::ApplyTokensToLexerConfig(SimpleLexer::Config& lexerConfig) { @@ -63,14 +65,16 @@ void SimpleExpressionMatchers::ApplyTokensToLexerConfig(SimpleLexer::Config& lex std::vector<const SimpleExpressionUnaryOperationType*> SimpleExpressionMatchers::EnabledUnaryOperations() const { - return std::vector(&SimpleExpressionUnaryOperationType::ALL_OPERATION_TYPES[0], - &SimpleExpressionUnaryOperationType::ALL_OPERATION_TYPES[std::extent_v<decltype(SimpleExpressionUnaryOperationType::ALL_OPERATION_TYPES)>]); + return std::vector( + &SimpleExpressionUnaryOperationType::ALL_OPERATION_TYPES[0], + &SimpleExpressionUnaryOperationType::ALL_OPERATION_TYPES[std::extent_v<decltype(SimpleExpressionUnaryOperationType::ALL_OPERATION_TYPES)>]); } std::vector<const SimpleExpressionBinaryOperationType*> SimpleExpressionMatchers::EnabledBinaryOperations() const { - return std::vector(&SimpleExpressionBinaryOperationType::ALL_OPERATION_TYPES[0], - &SimpleExpressionBinaryOperationType::ALL_OPERATION_TYPES[std::extent_v<decltype(SimpleExpressionBinaryOperationType::ALL_OPERATION_TYPES)>]); + return std::vector( + &SimpleExpressionBinaryOperationType::ALL_OPERATION_TYPES[0], + &SimpleExpressionBinaryOperationType::ALL_OPERATION_TYPES[std::extent_v<decltype(SimpleExpressionBinaryOperationType::ALL_OPERATION_TYPES)>]); } std::unique_ptr<ISimpleExpression> SimpleExpressionMatchers::ProcessExpressionInParenthesis(SequenceResult<SimpleParserValue>& result) const @@ -83,7 +87,8 @@ std::unique_ptr<ISimpleExpression> SimpleExpressionMatchers::ProcessExpressionIn return processedEvaluation; } -std::unique_ptr<ISimpleExpression> SimpleExpressionMatchers::ProcessConditionalOperation(std::unique_ptr<ISimpleExpression> condition, SequenceResult<SimpleParserValue>& result) const +std::unique_ptr<ISimpleExpression> SimpleExpressionMatchers::ProcessConditionalOperation(std::unique_ptr<ISimpleExpression> condition, + SequenceResult<SimpleParserValue>& result) const { auto trueExpression = ProcessExpression(result); @@ -194,19 +199,21 @@ std::unique_ptr<ISimpleExpression> SimpleExpressionMatchers::ProcessExpression(S throw ParsingException(TokenPos(), "Expected EvaluationTag @ Evaluation"); } - operators.sort([](const std::pair<unsigned, const SimpleExpressionBinaryOperationType*>& p1, const std::pair<unsigned, const SimpleExpressionBinaryOperationType*>& p2) - { - if (p1.second->m_precedence != p2.second->m_precedence) - return p1.second->m_precedence > p2.second->m_precedence; + operators.sort( + [](const std::pair<unsigned, const SimpleExpressionBinaryOperationType*>& p1, const std::pair<unsigned, const SimpleExpressionBinaryOperationType*>& p2) + { + if (p1.second->m_precedence != p2.second->m_precedence) + return p1.second->m_precedence > p2.second->m_precedence; - return p1.first > p2.first; - }); + return p1.first > p2.first; + }); while (!operators.empty()) { const auto [operatorIndex, operatorType] = operators.back(); // This must not be a reference - auto operation = std::make_unique<SimpleExpressionBinaryOperation>(operatorType, std::move(operands[operatorIndex]), std::move(operands[operatorIndex + 1])); + auto operation = + std::make_unique<SimpleExpressionBinaryOperation>(operatorType, std::move(operands[operatorIndex]), std::move(operands[operatorIndex + 1])); operands.erase(operands.begin() + static_cast<int>(operatorIndex)); operands[operatorIndex] = std::move(operation); @@ -256,48 +263,51 @@ std::unique_ptr<SimpleExpressionMatchers::matcher_t> SimpleExpressionMatchers::P { if (enabledBinaryOperation->m_syntax.size() > 1) { - binaryOperationsMatchers.emplace_back( - create.MultiChar(MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(enabledBinaryOperation->m_id)) - .Transform([enabledBinaryOperation](const SimpleMatcherFactory::token_list_t& values) - { - return SimpleParserValue::Integer(values[0].get().GetPos(), static_cast<int>(enabledBinaryOperation->m_id)); - })); + binaryOperationsMatchers.emplace_back(create.MultiChar(MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(enabledBinaryOperation->m_id)) + .Transform( + [enabledBinaryOperation](const SimpleMatcherFactory::token_list_t& values) + { + return SimpleParserValue::Integer(values[0].get().GetPos(), + static_cast<int>(enabledBinaryOperation->m_id)); + })); } else if (!enabledBinaryOperation->m_syntax.empty()) { - binaryOperationsMatchers.emplace_back( - create.Char(enabledBinaryOperation->m_syntax[0]) - .Transform([enabledBinaryOperation](const SimpleMatcherFactory::token_list_t& values) - { - return SimpleParserValue::Integer(values[0].get().GetPos(), static_cast<int>(enabledBinaryOperation->m_id)); - })); + binaryOperationsMatchers.emplace_back(create.Char(enabledBinaryOperation->m_syntax[0]) + .Transform( + [enabledBinaryOperation](const SimpleMatcherFactory::token_list_t& values) + { + return SimpleParserValue::Integer(values[0].get().GetPos(), + static_cast<int>(enabledBinaryOperation->m_id)); + })); } } - const auto hasAddOperation = std::any_of(enabledBinaryOperations.begin(), enabledBinaryOperations.end(), [](const SimpleExpressionBinaryOperationType* type) - { - return type == &SimpleExpressionBinaryOperationType::OPERATION_ADD; - }); - const auto hasSubtractOperation = std::any_of(enabledBinaryOperations.begin(), enabledBinaryOperations.end(), [](const SimpleExpressionBinaryOperationType* type) - { - return type == &SimpleExpressionBinaryOperationType::OPERATION_SUBTRACT; - }); + const auto hasAddOperation = std::any_of(enabledBinaryOperations.begin(), + enabledBinaryOperations.end(), + [](const SimpleExpressionBinaryOperationType* type) + { + return type == &SimpleExpressionBinaryOperationType::OPERATION_ADD; + }); + const auto hasSubtractOperation = std::any_of(enabledBinaryOperations.begin(), + enabledBinaryOperations.end(), + [](const SimpleExpressionBinaryOperationType* type) + { + return type == &SimpleExpressionBinaryOperationType::OPERATION_SUBTRACT; + }); if (hasAddOperation && hasSubtractOperation) { - binaryOperationsMatchers.emplace_back( - create.Or({ - create.IntegerWithSign(), - create.FloatingPointWithSign() - }) - .NoConsume() - .Transform([](const SimpleMatcherFactory::token_list_t& values) - { - return SimpleParserValue::Integer(values[0].get().GetPos(), static_cast<int>(SimpleBinaryOperationId::ADD)); - })); + binaryOperationsMatchers.emplace_back(create.Or({create.IntegerWithSign(), create.FloatingPointWithSign()}) + .NoConsume() + .Transform( + [](const SimpleMatcherFactory::token_list_t& values) + { + return SimpleParserValue::Integer(values[0].get().GetPos(), + static_cast<int>(SimpleBinaryOperationId::ADD)); + })); } - return create.Or(std::move(binaryOperationsMatchers)).Capture(CAPTURE_BINARY_OPERATION_TYPE); } @@ -320,21 +330,23 @@ std::unique_ptr<SimpleExpressionMatchers::matcher_t> SimpleExpressionMatchers::P { if (enabledUnaryOperation->m_syntax.size() > 1) { - unaryOperationsMatchers.emplace_back( - create.MultiChar(MULTI_TOKEN_OFFSET_UNARY + static_cast<int>(enabledUnaryOperation->m_id)) - .Transform([enabledUnaryOperation](const SimpleMatcherFactory::token_list_t& values) - { - return SimpleParserValue::Integer(values[0].get().GetPos(), static_cast<int>(enabledUnaryOperation->m_id)); - })); + unaryOperationsMatchers.emplace_back(create.MultiChar(MULTI_TOKEN_OFFSET_UNARY + static_cast<int>(enabledUnaryOperation->m_id)) + .Transform( + [enabledUnaryOperation](const SimpleMatcherFactory::token_list_t& values) + { + return SimpleParserValue::Integer(values[0].get().GetPos(), + static_cast<int>(enabledUnaryOperation->m_id)); + })); } else if (!enabledUnaryOperation->m_syntax.empty()) { - unaryOperationsMatchers.emplace_back( - create.Char(enabledUnaryOperation->m_syntax[0]) - .Transform([enabledUnaryOperation](const SimpleMatcherFactory::token_list_t& values) - { - return SimpleParserValue::Integer(values[0].get().GetPos(), static_cast<int>(enabledUnaryOperation->m_id)); - })); + unaryOperationsMatchers.emplace_back(create.Char(enabledUnaryOperation->m_syntax[0]) + .Transform( + [enabledUnaryOperation](const SimpleMatcherFactory::token_list_t& values) + { + return SimpleParserValue::Integer(values[0].get().GetPos(), + static_cast<int>(enabledUnaryOperation->m_id)); + })); } } @@ -348,40 +360,23 @@ std::unique_ptr<SimpleExpressionMatchers::matcher_t> SimpleExpressionMatchers::P if (!m_enable_conditional_operator) return create.False(); - return create.And({ - create.Char('?').Tag(TAG_CONDITIONAL_OPERATOR), - create.Label(LABEL_EXPRESSION), - create.Char(':').Tag(TAG_CONDITIONAL_OPERATOR_SEPARATOR), - create.Label(LABEL_EXPRESSION), - create.True().Tag(TAG_CONDITIONAL_OPERATOR_END) - }); + return create.And({create.Char('?').Tag(TAG_CONDITIONAL_OPERATOR), + create.Label(LABEL_EXPRESSION), + create.Char(':').Tag(TAG_CONDITIONAL_OPERATOR_SEPARATOR), + create.Label(LABEL_EXPRESSION), + create.True().Tag(TAG_CONDITIONAL_OPERATOR_END)}); } std::unique_ptr<SimpleExpressionMatchers::matcher_t> SimpleExpressionMatchers::Expression(const supplier_t* labelSupplier) const { const SimpleMatcherFactory create(labelSupplier); - return create.And({ - create.OptionalLoop(ParseUnaryOperationType(labelSupplier)), - create.Or({ - create.And({ - create.Char('('), - create.Label(LABEL_EXPRESSION), - create.Char(')').Tag(TAG_PARENTHESIS_END) - }).Tag(TAG_PARENTHESIS), - create.And({ - create.True().Tag(TAG_OPERAND_EXT), - ParseOperandExtension(labelSupplier), - create.True().Tag(TAG_OPERAND_EXT_END) - }), - ParseOperand(labelSupplier) - }), - create.Optional(create.Or({ - ParseConditionalOperator(labelSupplier), - create.And({ - ParseBinaryOperationType(labelSupplier), - create.Label(LABEL_EXPRESSION) - }).Tag(TAG_BINARY_OPERATION) - })) - }).Tag(TAG_EXPRESSION); + return create + .And({create.OptionalLoop(ParseUnaryOperationType(labelSupplier)), + create.Or({create.And({create.Char('('), create.Label(LABEL_EXPRESSION), create.Char(')').Tag(TAG_PARENTHESIS_END)}).Tag(TAG_PARENTHESIS), + create.And({create.True().Tag(TAG_OPERAND_EXT), ParseOperandExtension(labelSupplier), create.True().Tag(TAG_OPERAND_EXT_END)}), + ParseOperand(labelSupplier)}), + create.Optional(create.Or({ParseConditionalOperator(labelSupplier), + create.And({ParseBinaryOperationType(labelSupplier), create.Label(LABEL_EXPRESSION)}).Tag(TAG_BINARY_OPERATION)}))}) + .Tag(TAG_EXPRESSION); } diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionMatchers.h b/src/Parser/Parsing/Simple/Expression/SimpleExpressionMatchers.h index edb98876c..021688e23 100644 --- a/src/Parser/Parsing/Simple/Expression/SimpleExpressionMatchers.h +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionMatchers.h @@ -1,16 +1,16 @@ #pragma once -#include <memory> - -#include "SimpleExpressionBinaryOperation.h" -#include "SimpleExpressionUnaryOperation.h" -#include "Utils/ClassUtils.h" #include "Parsing/Matcher/AbstractMatcher.h" #include "Parsing/Matcher/MatcherLabel.h" -#include "Parsing/Simple/Expression/ISimpleExpression.h" #include "Parsing/Sequence/SequenceResult.h" +#include "Parsing/Simple/Expression/ISimpleExpression.h" #include "Parsing/Simple/SimpleParserValue.h" +#include "SimpleExpressionBinaryOperation.h" +#include "SimpleExpressionUnaryOperation.h" +#include "Utils/ClassUtils.h" + #include <Parsing/Simple/SimpleLexer.h> +#include <memory> class SimpleExpressionMatchers { @@ -35,7 +35,8 @@ class SimpleExpressionMatchers public: SimpleExpressionMatchers(); - SimpleExpressionMatchers(bool enableStringOperands, bool enableIdentifierOperands, bool enableFloatingPointOperands, bool enableIntOperands, bool enableConditionalOperator); + SimpleExpressionMatchers( + bool enableStringOperands, bool enableIdentifierOperands, bool enableFloatingPointOperands, bool enableIntOperands, bool enableConditionalOperator); virtual ~SimpleExpressionMatchers(); SimpleExpressionMatchers(const SimpleExpressionMatchers& other) = default; SimpleExpressionMatchers(SimpleExpressionMatchers&& other) noexcept = default; @@ -56,7 +57,8 @@ class SimpleExpressionMatchers std::unique_ptr<matcher_t> ParseConditionalOperator(const supplier_t* labelSupplier) const; std::unique_ptr<ISimpleExpression> ProcessExpressionInParenthesis(SequenceResult<SimpleParserValue>& result) const; - std::unique_ptr<ISimpleExpression> ProcessConditionalOperation(std::unique_ptr<ISimpleExpression> condition, SequenceResult<SimpleParserValue>& result) const; + std::unique_ptr<ISimpleExpression> ProcessConditionalOperation(std::unique_ptr<ISimpleExpression> condition, + SequenceResult<SimpleParserValue>& result) const; std::unique_ptr<ISimpleExpression> ProcessOperand(SequenceResult<SimpleParserValue>& result) const; public: @@ -64,4 +66,4 @@ class SimpleExpressionMatchers std::unique_ptr<ISimpleExpression> ProcessExpression(SequenceResult<SimpleParserValue>& result) const; virtual void ApplyTokensToLexerConfig(SimpleLexer::Config& lexerConfig); -}; \ No newline at end of file +}; diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionScopeValue.h b/src/Parser/Parsing/Simple/Expression/SimpleExpressionScopeValue.h index 2d4c78d34..3e0b0da2f 100644 --- a/src/Parser/Parsing/Simple/Expression/SimpleExpressionScopeValue.h +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionScopeValue.h @@ -1,10 +1,10 @@ #pragma once -#include <string> - #include "ISimpleExpression.h" #include "SimpleExpressionValue.h" +#include <string> + class SimpleExpressionScopeValue final : public ISimpleExpression { public: diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionUnaryOperation.cpp b/src/Parser/Parsing/Simple/Expression/SimpleExpressionUnaryOperation.cpp index 4f9081717..458407646 100644 --- a/src/Parser/Parsing/Simple/Expression/SimpleExpressionUnaryOperation.cpp +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionUnaryOperation.cpp @@ -1,59 +1,57 @@ #include "SimpleExpressionUnaryOperation.h" -#include <cassert> - #include "SimpleExpressionBinaryOperation.h" -SimpleExpressionUnaryOperationType::SimpleExpressionUnaryOperationType(const SimpleUnaryOperationId id, std::string syntax, evaluation_function_t evaluationFunction) +#include <cassert> + +SimpleExpressionUnaryOperationType::SimpleExpressionUnaryOperationType(const SimpleUnaryOperationId id, + std::string syntax, + evaluation_function_t evaluationFunction) : m_id(id), m_syntax(std::move(syntax)), m_evaluation_function(std::move(evaluationFunction)) { } -const SimpleExpressionUnaryOperationType SimpleExpressionUnaryOperationType::OPERATION_NOT( - SimpleUnaryOperationId::NOT, - "!", - [](const SimpleExpressionValue& operand) -> SimpleExpressionValue - { - return SimpleExpressionValue(!operand.IsTruthy()); - } -); - -const SimpleExpressionUnaryOperationType SimpleExpressionUnaryOperationType::OPERATION_BITWISE_NOT( - SimpleUnaryOperationId::BITWISE_NOT, - "~", - [](const SimpleExpressionValue& operand) -> SimpleExpressionValue - { - if (operand.m_type == SimpleExpressionValue::Type::INT) - return SimpleExpressionValue(~operand.m_int_value); - - return SimpleExpressionValue(0); - } -); - -const SimpleExpressionUnaryOperationType SimpleExpressionUnaryOperationType::OPERATION_NEGATIVE( - SimpleUnaryOperationId::NEGATIVE, - "-", - [](const SimpleExpressionValue& operand) -> SimpleExpressionValue - { - if (operand.m_type == SimpleExpressionValue::Type::INT) - return SimpleExpressionValue(-operand.m_int_value); - if (operand.m_type == SimpleExpressionValue::Type::DOUBLE) - return SimpleExpressionValue(-operand.m_double_value); - - return SimpleExpressionValue(0); - } -); - -const SimpleExpressionUnaryOperationType* const SimpleExpressionUnaryOperationType::ALL_OPERATION_TYPES[static_cast<int>(SimpleUnaryOperationId::COUNT)] -{ +const SimpleExpressionUnaryOperationType SimpleExpressionUnaryOperationType::OPERATION_NOT(SimpleUnaryOperationId::NOT, + "!", + [](const SimpleExpressionValue& operand) -> SimpleExpressionValue + { + return SimpleExpressionValue(!operand.IsTruthy()); + }); + +const SimpleExpressionUnaryOperationType + SimpleExpressionUnaryOperationType::OPERATION_BITWISE_NOT(SimpleUnaryOperationId::BITWISE_NOT, + "~", + [](const SimpleExpressionValue& operand) -> SimpleExpressionValue + { + if (operand.m_type == SimpleExpressionValue::Type::INT) + return SimpleExpressionValue(~operand.m_int_value); + + return SimpleExpressionValue(0); + }); + +const SimpleExpressionUnaryOperationType + SimpleExpressionUnaryOperationType::OPERATION_NEGATIVE(SimpleUnaryOperationId::NEGATIVE, + "-", + [](const SimpleExpressionValue& operand) -> SimpleExpressionValue + { + if (operand.m_type == SimpleExpressionValue::Type::INT) + return SimpleExpressionValue(-operand.m_int_value); + if (operand.m_type == SimpleExpressionValue::Type::DOUBLE) + return SimpleExpressionValue(-operand.m_double_value); + + return SimpleExpressionValue(0); + }); + +const SimpleExpressionUnaryOperationType* const SimpleExpressionUnaryOperationType::ALL_OPERATION_TYPES[static_cast<int>(SimpleUnaryOperationId::COUNT)]{ &OPERATION_NOT, &OPERATION_BITWISE_NOT, &OPERATION_NEGATIVE, }; -SimpleExpressionUnaryOperation::SimpleExpressionUnaryOperation(const SimpleExpressionUnaryOperationType* operationType, std::unique_ptr<ISimpleExpression> operand) +SimpleExpressionUnaryOperation::SimpleExpressionUnaryOperation(const SimpleExpressionUnaryOperationType* operationType, + std::unique_ptr<ISimpleExpression> operand) : m_operation_type(operationType), m_operand(std::move(operand)) { @@ -68,7 +66,8 @@ bool SimpleExpressionUnaryOperation::Equals(const ISimpleExpression* other) cons { const auto* otherUnaryOperation = dynamic_cast<const SimpleExpressionUnaryOperation*>(other); - return otherUnaryOperation && m_operation_type->m_id == otherUnaryOperation->m_operation_type->m_id && m_operand->Equals(otherUnaryOperation->m_operand.get()); + return otherUnaryOperation && m_operation_type->m_id == otherUnaryOperation->m_operation_type->m_id + && m_operand->Equals(otherUnaryOperation->m_operand.get()); } bool SimpleExpressionUnaryOperation::IsStatic() const diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionUnaryOperation.h b/src/Parser/Parsing/Simple/Expression/SimpleExpressionUnaryOperation.h index 18e0dcc65..d981dfc0a 100644 --- a/src/Parser/Parsing/Simple/Expression/SimpleExpressionUnaryOperation.h +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionUnaryOperation.h @@ -1,12 +1,12 @@ #pragma once -#include <string> -#include <memory> -#include <functional> - #include "ISimpleExpression.h" #include "SimpleExpressionValue.h" +#include <functional> +#include <memory> +#include <string> + enum class SimpleUnaryOperationId { NOT, diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionValue.h b/src/Parser/Parsing/Simple/Expression/SimpleExpressionValue.h index a99d137d5..e1df8615d 100644 --- a/src/Parser/Parsing/Simple/Expression/SimpleExpressionValue.h +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionValue.h @@ -1,12 +1,13 @@ #pragma once -#include <memory> -#include <string> - #include "ISimpleExpression.h" #include "Utils/ClassUtils.h" +#include <memory> +#include <string> + class ISimpleExpression; + class SimpleExpressionValue final : public ISimpleExpression { public: @@ -19,6 +20,7 @@ class SimpleExpressionValue final : public ISimpleExpression Type m_type; std::shared_ptr<std::string> m_string_value; + union { double m_double_value; diff --git a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherAnyCharacterBesides.h b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherAnyCharacterBesides.h index 46e254080..2608a1ac4 100644 --- a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherAnyCharacterBesides.h +++ b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherAnyCharacterBesides.h @@ -1,9 +1,9 @@ #pragma once -#include <vector> - -#include "Parsing/Simple/SimpleParserValue.h" #include "Parsing/Matcher/AbstractMatcher.h" +#include "Parsing/Simple/SimpleParserValue.h" + +#include <vector> class SimpleMatcherAnyCharacterBesides final : public AbstractMatcher<SimpleParserValue> { diff --git a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherCharacter.cpp b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherCharacter.cpp index 19531b305..1bbb3cbdc 100644 --- a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherCharacter.cpp +++ b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherCharacter.cpp @@ -8,7 +8,6 @@ SimpleMatcherCharacter::SimpleMatcherCharacter(const char c) MatcherResult<SimpleParserValue> SimpleMatcherCharacter::CanMatch(ILexer<SimpleParserValue>* lexer, const unsigned tokenOffset) { const auto& token = lexer->GetToken(tokenOffset); - return token.m_type == SimpleParserValueType::CHARACTER && token.CharacterValue() == m_char - ? MatcherResult<SimpleParserValue>::Match(1) - : MatcherResult<SimpleParserValue>::NoMatch(); + return token.m_type == SimpleParserValueType::CHARACTER && token.CharacterValue() == m_char ? MatcherResult<SimpleParserValue>::Match(1) + : MatcherResult<SimpleParserValue>::NoMatch(); } diff --git a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherCharacter.h b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherCharacter.h index c795061f7..9e6026ec3 100644 --- a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherCharacter.h +++ b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherCharacter.h @@ -1,7 +1,7 @@ #pragma once -#include "Parsing/Simple/SimpleParserValue.h" #include "Parsing/Matcher/AbstractMatcher.h" +#include "Parsing/Simple/SimpleParserValue.h" class SimpleMatcherCharacter final : public AbstractMatcher<SimpleParserValue> { diff --git a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherFactory.h b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherFactory.h index 5831a4fc7..7853e4508 100644 --- a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherFactory.h +++ b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherFactory.h @@ -1,15 +1,15 @@ #pragma once -#include <string> - -#include "Parsing/Simple/SimpleParserValue.h" #include "Parsing/Matcher/AbstractMatcherFactory.h" +#include "Parsing/Simple/SimpleParserValue.h" + +#include <string> class SimpleMatcherFactory : public AbstractMatcherFactory<SimpleParserValue> { public: explicit SimpleMatcherFactory(const IMatcherForLabelSupplier<SimpleParserValue>* labelSupplier); - + _NODISCARD MatcherFactoryWrapper<SimpleParserValue> Type(SimpleParserValueType type) const; _NODISCARD MatcherFactoryWrapper<SimpleParserValue> Keyword(std::string value) const; _NODISCARD MatcherFactoryWrapper<SimpleParserValue> KeywordIgnoreCase(std::string value) const; diff --git a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherKeyword.cpp b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherKeyword.cpp index b29e00211..f7764c05d 100644 --- a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherKeyword.cpp +++ b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherKeyword.cpp @@ -11,6 +11,6 @@ MatcherResult<SimpleParserValue> SimpleMatcherKeyword::CanMatch(ILexer<SimplePar { const auto& token = lexer->GetToken(tokenOffset); return token.m_type == SimpleParserValueType::IDENTIFIER && token.IdentifierHash() == m_hash && token.IdentifierValue() == m_value - ? MatcherResult<SimpleParserValue>::Match(1) - : MatcherResult<SimpleParserValue>::NoMatch(); + ? MatcherResult<SimpleParserValue>::Match(1) + : MatcherResult<SimpleParserValue>::NoMatch(); } diff --git a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherKeyword.h b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherKeyword.h index 40183667c..72afab947 100644 --- a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherKeyword.h +++ b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherKeyword.h @@ -1,9 +1,9 @@ #pragma once -#include <string> - -#include "Parsing/Simple/SimpleParserValue.h" #include "Parsing/Matcher/AbstractMatcher.h" +#include "Parsing/Simple/SimpleParserValue.h" + +#include <string> class SimpleMatcherKeyword final : public AbstractMatcher<SimpleParserValue> { diff --git a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherKeywordIgnoreCase.cpp b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherKeywordIgnoreCase.cpp index 3c241d160..b7fad05f2 100644 --- a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherKeywordIgnoreCase.cpp +++ b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherKeywordIgnoreCase.cpp @@ -17,10 +17,14 @@ MatcherResult<SimpleParserValue> SimpleMatcherKeywordIgnoreCase::CanMatch(ILexer return MatcherResult<SimpleParserValue>::NoMatch(); const auto& identifierValue = token.IdentifierValue(); - const auto isEqual = std::equal(identifierValue.begin(), identifierValue.end(), m_value.begin(), m_value.end(), [](const char a, const char b) - { - return tolower(a) == b; - }); + const auto isEqual = std::equal(identifierValue.begin(), + identifierValue.end(), + m_value.begin(), + m_value.end(), + [](const char a, const char b) + { + return tolower(a) == b; + }); if (isEqual) return MatcherResult<SimpleParserValue>::Match(1); diff --git a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherKeywordIgnoreCase.h b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherKeywordIgnoreCase.h index 3b52aca8a..ec6f5e989 100644 --- a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherKeywordIgnoreCase.h +++ b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherKeywordIgnoreCase.h @@ -1,9 +1,9 @@ #pragma once -#include <string> - -#include "Parsing/Simple/SimpleParserValue.h" #include "Parsing/Matcher/AbstractMatcher.h" +#include "Parsing/Simple/SimpleParserValue.h" + +#include <string> class SimpleMatcherKeywordIgnoreCase final : public AbstractMatcher<SimpleParserValue> { diff --git a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherKeywordPrefix.cpp b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherKeywordPrefix.cpp index 303ddaf64..34793cc8a 100644 --- a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherKeywordPrefix.cpp +++ b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherKeywordPrefix.cpp @@ -9,6 +9,6 @@ MatcherResult<SimpleParserValue> SimpleMatcherKeywordPrefix::CanMatch(ILexer<Sim { const auto& token = lexer->GetToken(tokenOffset); return token.m_type == SimpleParserValueType::IDENTIFIER && token.IdentifierValue().compare(0, m_value.size(), m_value) == 0 - ? MatcherResult<SimpleParserValue>::Match(1) - : MatcherResult<SimpleParserValue>::NoMatch(); + ? MatcherResult<SimpleParserValue>::Match(1) + : MatcherResult<SimpleParserValue>::NoMatch(); } diff --git a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherKeywordPrefix.h b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherKeywordPrefix.h index 29bc19413..3fa9c3959 100644 --- a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherKeywordPrefix.h +++ b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherKeywordPrefix.h @@ -1,9 +1,9 @@ #pragma once -#include <string> - -#include "Parsing/Simple/SimpleParserValue.h" #include "Parsing/Matcher/AbstractMatcher.h" +#include "Parsing/Simple/SimpleParserValue.h" + +#include <string> class SimpleMatcherKeywordPrefix final : public AbstractMatcher<SimpleParserValue> { diff --git a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherMultiCharacter.h b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherMultiCharacter.h index cb68fe6ea..5836cc994 100644 --- a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherMultiCharacter.h +++ b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherMultiCharacter.h @@ -1,7 +1,7 @@ #pragma once -#include "Parsing/Simple/SimpleParserValue.h" #include "Parsing/Matcher/AbstractMatcher.h" +#include "Parsing/Simple/SimpleParserValue.h" class SimpleMatcherMultiCharacter final : public AbstractMatcher<SimpleParserValue> { diff --git a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherValueType.cpp b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherValueType.cpp index c71a50f21..517ebbfa0 100644 --- a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherValueType.cpp +++ b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherValueType.cpp @@ -7,7 +7,5 @@ SimpleMatcherValueType::SimpleMatcherValueType(const SimpleParserValueType type) MatcherResult<SimpleParserValue> SimpleMatcherValueType::CanMatch(ILexer<SimpleParserValue>* lexer, const unsigned tokenOffset) { - return lexer->GetToken(tokenOffset).m_type == m_type - ? MatcherResult<SimpleParserValue>::Match(1) - : MatcherResult<SimpleParserValue>::NoMatch(); + return lexer->GetToken(tokenOffset).m_type == m_type ? MatcherResult<SimpleParserValue>::Match(1) : MatcherResult<SimpleParserValue>::NoMatch(); } diff --git a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherValueType.h b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherValueType.h index 9bb6669cf..3314a62f0 100644 --- a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherValueType.h +++ b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherValueType.h @@ -1,7 +1,7 @@ #pragma once -#include "Parsing/Simple/SimpleParserValue.h" #include "Parsing/Matcher/AbstractMatcher.h" +#include "Parsing/Simple/SimpleParserValue.h" class SimpleMatcherValueType final : public AbstractMatcher<SimpleParserValue> { diff --git a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherValueTypeAndHasPrefix.cpp b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherValueTypeAndHasPrefix.cpp index 4378a0e4c..bf475f5cc 100644 --- a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherValueTypeAndHasPrefix.cpp +++ b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherValueTypeAndHasPrefix.cpp @@ -9,7 +9,6 @@ SimpleMatcherValueTypeAndHasSignPrefix::SimpleMatcherValueTypeAndHasSignPrefix(c MatcherResult<SimpleParserValue> SimpleMatcherValueTypeAndHasSignPrefix::CanMatch(ILexer<SimpleParserValue>* lexer, const unsigned tokenOffset) { const auto& token = lexer->GetToken(tokenOffset); - return token.m_type == m_type && token.m_has_sign_prefix == m_has_sign_prefix - ? MatcherResult<SimpleParserValue>::Match(1) - : MatcherResult<SimpleParserValue>::NoMatch(); + return token.m_type == m_type && token.m_has_sign_prefix == m_has_sign_prefix ? MatcherResult<SimpleParserValue>::Match(1) + : MatcherResult<SimpleParserValue>::NoMatch(); } diff --git a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherValueTypeAndHasSignPrefix.h b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherValueTypeAndHasSignPrefix.h index b5564a9c8..bdab003ad 100644 --- a/src/Parser/Parsing/Simple/Matcher/SimpleMatcherValueTypeAndHasSignPrefix.h +++ b/src/Parser/Parsing/Simple/Matcher/SimpleMatcherValueTypeAndHasSignPrefix.h @@ -1,7 +1,7 @@ #pragma once -#include "Parsing/Simple/SimpleParserValue.h" #include "Parsing/Matcher/AbstractMatcher.h" +#include "Parsing/Simple/SimpleParserValue.h" class SimpleMatcherValueTypeAndHasSignPrefix final : public AbstractMatcher<SimpleParserValue> { diff --git a/src/Parser/Parsing/Simple/SimpleExpressionInterpreter.cpp b/src/Parser/Parsing/Simple/SimpleExpressionInterpreter.cpp index f4975734c..01a9b09a8 100644 --- a/src/Parser/Parsing/Simple/SimpleExpressionInterpreter.cpp +++ b/src/Parser/Parsing/Simple/SimpleExpressionInterpreter.cpp @@ -1,9 +1,9 @@ #include "SimpleExpressionInterpreter.h" -#include "Utils/ClassUtils.h" #include "Expression/SimpleExpressionMatchers.h" #include "Matcher/SimpleMatcherFactory.h" #include "Parsing/Impl/AbstractParser.h" +#include "Utils/ClassUtils.h" class SimpleExpressionInterpreterParserState { @@ -47,10 +47,7 @@ class SimpleExpressionInterpreterParser final : public AbstractParser<SimplePars protected: const std::vector<sequence_t*>& GetTestsForState() override { - static std::vector<sequence_t*> sequences - { - new SimpleExpressionInterpreterExpressionSequence() - }; + static std::vector<sequence_t*> sequences{new SimpleExpressionInterpreterExpressionSequence()}; return sequences; } }; diff --git a/src/Parser/Parsing/Simple/SimpleLexer.cpp b/src/Parser/Parsing/Simple/SimpleLexer.cpp index 719bad83c..63d5a5564 100644 --- a/src/Parser/Parsing/Simple/SimpleLexer.cpp +++ b/src/Parser/Parsing/Simple/SimpleLexer.cpp @@ -52,7 +52,8 @@ void SimpleLexer::AddMultiCharacterTokenConfigToLookup(Config::MultiCharacterTok } else { - m_multi_character_token_lookup[firstCharacterValue] = std::make_unique<MultiCharacterTokenLookupEntry>(tokenConfig.m_id, std::move(tokenConfig.m_value)); + m_multi_character_token_lookup[firstCharacterValue] = + std::make_unique<MultiCharacterTokenLookupEntry>(tokenConfig.m_id, std::move(tokenConfig.m_value)); } } @@ -123,12 +124,13 @@ SimpleParserValue SimpleLexer::GetNextToken() if (m_config.m_read_strings && c == '\"') return SimpleParserValue::String(pos, new std::string(m_config.m_string_escape_sequences ? ReadStringWithEscapeSequences() : ReadString())); - if (m_config.m_read_integer_numbers && (isdigit(c) || (c == '+' || c == '-' || (m_config.m_read_floating_point_numbers && c == '.')) && isdigit(PeekChar()))) + if (m_config.m_read_integer_numbers + && (isdigit(c) || (c == '+' || c == '-' || (m_config.m_read_floating_point_numbers && c == '.')) && isdigit(PeekChar()))) { bool hasSignPrefix; int integerValue; - if(m_config.m_read_floating_point_numbers) + if (m_config.m_read_floating_point_numbers) { bool isFloatingPointValue; double floatingPointValue; diff --git a/src/Parser/Parsing/Simple/SimpleLexer.h b/src/Parser/Parsing/Simple/SimpleLexer.h index fd051f2d4..c1220d527 100644 --- a/src/Parser/Parsing/Simple/SimpleLexer.h +++ b/src/Parser/Parsing/Simple/SimpleLexer.h @@ -1,12 +1,12 @@ #pragma once +#include "Parsing/Impl/AbstractLexer.h" +#include "SimpleParserValue.h" + #include <cstdint> #include <limits> #include <memory> -#include "SimpleParserValue.h" -#include "Parsing/Impl/AbstractLexer.h" - class SimpleLexer : public AbstractLexer<SimpleParserValue> { public: @@ -55,4 +55,4 @@ class SimpleLexer : public AbstractLexer<SimpleParserValue> public: explicit SimpleLexer(IParserLineStream* stream); SimpleLexer(IParserLineStream* stream, Config config); -}; \ No newline at end of file +}; diff --git a/src/Parser/Parsing/Simple/SimpleParserValue.h b/src/Parser/Parsing/Simple/SimpleParserValue.h index 79cd3d408..61ce3bbcf 100644 --- a/src/Parser/Parsing/Simple/SimpleParserValue.h +++ b/src/Parser/Parsing/Simple/SimpleParserValue.h @@ -1,10 +1,10 @@ #pragma once -#include <string> - #include "Parsing/IParserValue.h" -#include "Utils/ClassUtils.h" #include "Parsing/TokenPos.h" +#include "Utils/ClassUtils.h" + +#include <string> enum class SimpleParserValueType { @@ -34,6 +34,7 @@ class SimpleParserValue final : public IParserValue SimpleParserValueType m_type; size_t m_hash; bool m_has_sign_prefix; + union ValueType { char char_value; diff --git a/src/Parser/Parsing/TokenPos.h b/src/Parser/Parsing/TokenPos.h index 6035cc982..103b2dd5f 100644 --- a/src/Parser/Parsing/TokenPos.h +++ b/src/Parser/Parsing/TokenPos.h @@ -1,7 +1,7 @@ #pragma once -#include <string> #include <functional> +#include <string> class TokenPos { diff --git a/src/RawTemplater/RawTemplater.cpp b/src/RawTemplater/RawTemplater.cpp index 1f7300394..27af12d58 100644 --- a/src/RawTemplater/RawTemplater.cpp +++ b/src/RawTemplater/RawTemplater.cpp @@ -1,12 +1,12 @@ #include "RawTemplater.h" -#include <fstream> -#include <iostream> -#include <filesystem> - #include "RawTemplaterArguments.h" #include "Templating/Templater.h" +#include <filesystem> +#include <fstream> +#include <iostream> + namespace fs = std::filesystem; class RawTemplater::Impl diff --git a/src/RawTemplater/RawTemplaterArguments.cpp b/src/RawTemplater/RawTemplaterArguments.cpp index 2ad5b6f48..9174d71f1 100644 --- a/src/RawTemplater/RawTemplaterArguments.cpp +++ b/src/RawTemplater/RawTemplaterArguments.cpp @@ -3,24 +3,18 @@ #include "Utils/Arguments/CommandLineOption.h" #include "Utils/Arguments/UsageInformation.h" -const CommandLineOption* const OPTION_HELP = CommandLineOption::Builder::Create() - .WithShortName("?") - .WithLongName("help") - .WithDescription("Displays usage information.") - .Build(); - -const CommandLineOption* const OPTION_VERBOSE = CommandLineOption::Builder::Create() - .WithShortName("v") - .WithLongName("verbose") - .WithDescription("Outputs a lot more and more detailed messages.") - .Build(); +const CommandLineOption* const OPTION_HELP = + CommandLineOption::Builder::Create().WithShortName("?").WithLongName("help").WithDescription("Displays usage information.").Build(); + +const CommandLineOption* const OPTION_VERBOSE = + CommandLineOption::Builder::Create().WithShortName("v").WithLongName("verbose").WithDescription("Outputs a lot more and more detailed messages.").Build(); const CommandLineOption* const OPTION_OUTPUT_FOLDER = CommandLineOption::Builder::Create() - .WithShortName("o") - .WithLongName("output") - .WithDescription("Specify the folder to save the generated files. Defaults to the current directory.") - .WithParameter("outputPath") - .Build(); + .WithShortName("o") + .WithLongName("output") + .WithDescription("Specify the folder to save the generated files. Defaults to the current directory.") + .WithParameter("outputPath") + .Build(); const CommandLineOption* const OPTION_BUILD_LOG = CommandLineOption::Builder::Create() .WithLongName("build-log") @@ -29,21 +23,14 @@ const CommandLineOption* const OPTION_BUILD_LOG = CommandLineOption::Builder::Cr .Build(); const CommandLineOption* const OPTION_DEFINE = CommandLineOption::Builder::Create() - .WithShortName("d") - .WithLongName("define") - .WithDescription("Adds a define for the templating process. Can be of format define or define=value.") - .WithParameter("defineValue") - .Reusable() - .Build(); - -const CommandLineOption* const COMMAND_LINE_OPTIONS[] -{ - OPTION_HELP, - OPTION_VERBOSE, - OPTION_OUTPUT_FOLDER, - OPTION_BUILD_LOG, - OPTION_DEFINE -}; + .WithShortName("d") + .WithLongName("define") + .WithDescription("Adds a define for the templating process. Can be of format define or define=value.") + .WithParameter("defineValue") + .Reusable() + .Build(); + +const CommandLineOption* const COMMAND_LINE_OPTIONS[]{OPTION_HELP, OPTION_VERBOSE, OPTION_OUTPUT_FOLDER, OPTION_BUILD_LOG, OPTION_DEFINE}; RawTemplaterArguments::RawTemplaterArguments() : m_argument_parser(COMMAND_LINE_OPTIONS, std::extent_v<decltype(COMMAND_LINE_OPTIONS)>), diff --git a/src/RawTemplater/RawTemplaterArguments.h b/src/RawTemplater/RawTemplaterArguments.h index 25fc3158c..463ccbc60 100644 --- a/src/RawTemplater/RawTemplaterArguments.h +++ b/src/RawTemplater/RawTemplaterArguments.h @@ -1,11 +1,11 @@ #pragma once +#include "Utils/Arguments/ArgumentParser.h" + #include <string> #include <utility> #include <vector> -#include "Utils/Arguments/ArgumentParser.h" - class RawTemplaterArguments { ArgumentParser m_argument_parser; @@ -28,4 +28,4 @@ class RawTemplaterArguments RawTemplaterArguments(); bool Parse(int argc, const char** argv); -}; \ No newline at end of file +}; diff --git a/src/RawTemplater/Templating/DirectiveEscapeStreamProxy.h b/src/RawTemplater/Templating/DirectiveEscapeStreamProxy.h index 1a2ada984..bb79d4a53 100644 --- a/src/RawTemplater/Templating/DirectiveEscapeStreamProxy.h +++ b/src/RawTemplater/Templating/DirectiveEscapeStreamProxy.h @@ -17,4 +17,4 @@ namespace templating private: IParserLineStream* const m_stream; }; -} +} // namespace templating diff --git a/src/RawTemplater/Templating/SetDefineStreamProxy.h b/src/RawTemplater/Templating/SetDefineStreamProxy.h index 70315a684..03bbb448b 100644 --- a/src/RawTemplater/Templating/SetDefineStreamProxy.h +++ b/src/RawTemplater/Templating/SetDefineStreamProxy.h @@ -1,8 +1,8 @@ #pragma once -#include "Utils/ClassUtils.h" #include "Parsing/Impl/AbstractDirectiveStreamProxy.h" #include "Parsing/Impl/DefinesStreamProxy.h" +#include "Utils/ClassUtils.h" namespace templating { @@ -28,4 +28,4 @@ namespace templating IParserLineStream* const m_stream; DefinesStreamProxy* m_defines_proxy; }; -} +} // namespace templating diff --git a/src/RawTemplater/Templating/Templater.cpp b/src/RawTemplater/Templating/Templater.cpp index 91fea331d..50fed415b 100644 --- a/src/RawTemplater/Templating/Templater.cpp +++ b/src/RawTemplater/Templating/Templater.cpp @@ -1,19 +1,19 @@ #include "Templater.h" -#include <unordered_map> -#include <vector> -#include <filesystem> -#include <fstream> -#include <iostream> - -#include "Utils/ClassUtils.h" #include "DirectiveEscapeStreamProxy.h" -#include "SetDefineStreamProxy.h" -#include "TemplatingStreamProxy.h" -#include "Parsing/ParsingException.h" #include "Parsing/Impl/DefinesStreamProxy.h" #include "Parsing/Impl/ParserSingleInputStream.h" #include "Parsing/Impl/SkipUntilFirstNonEmptyProxy.h" +#include "Parsing/ParsingException.h" +#include "SetDefineStreamProxy.h" +#include "TemplatingStreamProxy.h" +#include "Utils/ClassUtils.h" + +#include <filesystem> +#include <fstream> +#include <iostream> +#include <unordered_map> +#include <vector> using namespace templating; namespace fs = std::filesystem; @@ -378,7 +378,7 @@ namespace templating std::ofstream m_output_stream; std::ostringstream m_output_cache; }; -} +} // namespace templating Templater::Templater(std::istream& stream, std::string fileName) : m_stream(stream), diff --git a/src/RawTemplater/Templating/Templater.h b/src/RawTemplater/Templating/Templater.h index 1b2ff73d9..f73cc7af9 100644 --- a/src/RawTemplater/Templating/Templater.h +++ b/src/RawTemplater/Templating/Templater.h @@ -1,8 +1,8 @@ #pragma once -#include <string> - -#include "Utils/ClassUtils.h" #include "Parsing/IParserLineStream.h" +#include "Utils/ClassUtils.h" + +#include <string> namespace templating { @@ -19,4 +19,4 @@ namespace templating std::ostream* m_build_log; std::string m_file_name; }; -} +} // namespace templating diff --git a/src/RawTemplater/Templating/TemplatingStreamProxy.cpp b/src/RawTemplater/Templating/TemplatingStreamProxy.cpp index 5cddd5743..63fe872c0 100644 --- a/src/RawTemplater/Templating/TemplatingStreamProxy.cpp +++ b/src/RawTemplater/Templating/TemplatingStreamProxy.cpp @@ -1,9 +1,9 @@ #include "TemplatingStreamProxy.h" -#include <iostream> - #include "Parsing/ParsingException.h" +#include <iostream> + using namespace templating; TemplatingStreamProxy::TemplatingStreamProxy(IParserLineStream* stream, ITemplaterControl* templaterControl) @@ -153,10 +153,8 @@ bool TemplatingStreamProxy::MatchDirectives(const ParserLine& line) const directiveStartPos++; - return MatchSwitchDirective(line, directiveStartPos, directiveEndPos) - || MatchOptionsDirective(line, directiveStartPos, directiveEndPos) - || MatchFilenameDirective(line, directiveStartPos, directiveEndPos) - || MatchSkipDirective(line, directiveStartPos, directiveEndPos); + return MatchSwitchDirective(line, directiveStartPos, directiveEndPos) || MatchOptionsDirective(line, directiveStartPos, directiveEndPos) + || MatchFilenameDirective(line, directiveStartPos, directiveEndPos) || MatchSkipDirective(line, directiveStartPos, directiveEndPos); } ParserLine TemplatingStreamProxy::NextLine() diff --git a/src/RawTemplater/Templating/TemplatingStreamProxy.h b/src/RawTemplater/Templating/TemplatingStreamProxy.h index 36676dc1f..81afe1f9e 100644 --- a/src/RawTemplater/Templating/TemplatingStreamProxy.h +++ b/src/RawTemplater/Templating/TemplatingStreamProxy.h @@ -1,8 +1,8 @@ #pragma once -#include "Utils/ClassUtils.h" #include "Parsing/Impl/AbstractDirectiveStreamProxy.h" #include "Parsing/Impl/DefinesStreamProxy.h" +#include "Utils/ClassUtils.h" namespace templating { @@ -53,4 +53,4 @@ namespace templating ITemplaterControl* const m_templater_control; DefinesStreamProxy* m_defines_proxy; }; -} +} // namespace templating diff --git a/src/Unlinker/ContentLister/ContentPrinter.cpp b/src/Unlinker/ContentLister/ContentPrinter.cpp index 5edfecef3..54c707ddc 100644 --- a/src/Unlinker/ContentLister/ContentPrinter.cpp +++ b/src/Unlinker/ContentLister/ContentPrinter.cpp @@ -11,7 +11,7 @@ void ContentPrinter::PrintContent() const printf("Zone '%s' (%s)\n", m_zone->m_name.c_str(), m_zone->m_game->GetShortName().c_str()); puts("Content:"); - for(const auto& asset : *pools) + for (const auto& asset : *pools) { printf("%s, %s\n", pools->GetAssetTypeName(asset->m_type), asset->m_name.c_str()); } diff --git a/src/Unlinker/ContentLister/ContentPrinter.h b/src/Unlinker/ContentLister/ContentPrinter.h index 245095a53..9e13402a5 100644 --- a/src/Unlinker/ContentLister/ContentPrinter.h +++ b/src/Unlinker/ContentLister/ContentPrinter.h @@ -10,4 +10,4 @@ class ContentPrinter explicit ContentPrinter(Zone* zone); void PrintContent() const; -}; \ No newline at end of file +}; diff --git a/src/Unlinker/ContentLister/ZoneDefWriter.cpp b/src/Unlinker/ContentLister/ZoneDefWriter.cpp index a7627d5a6..8ee121f11 100644 --- a/src/Unlinker/ContentLister/ZoneDefWriter.cpp +++ b/src/Unlinker/ContentLister/ZoneDefWriter.cpp @@ -8,7 +8,7 @@ void AbstractZoneDefWriter::WriteZoneDef(std::ostream& stream, const UnlinkerArg out.WriteMetaData(META_DATA_KEY_GAME, zone->m_game->GetShortName()); out.EmptyLine(); - if(args->m_use_gdt) + if (args->m_use_gdt) { out.WriteComment("Load asset gdt files"); out.WriteMetaData(META_DATA_KEY_GDT, zone->m_name); @@ -17,4 +17,4 @@ void AbstractZoneDefWriter::WriteZoneDef(std::ostream& stream, const UnlinkerArg WriteMetaData(out, args, zone); WriteContent(out, args, zone); -} \ No newline at end of file +} diff --git a/src/Unlinker/ContentLister/ZoneDefWriter.h b/src/Unlinker/ContentLister/ZoneDefWriter.h index a3e86557e..89370784b 100644 --- a/src/Unlinker/ContentLister/ZoneDefWriter.h +++ b/src/Unlinker/ContentLister/ZoneDefWriter.h @@ -1,8 +1,8 @@ #pragma once #include "UnlinkerArgs.h" -#include "Zone/Zone.h" #include "Zone/Definition/ZoneDefinitionStream.h" +#include "Zone/Zone.h" class IZoneDefWriter { @@ -23,10 +23,10 @@ class AbstractZoneDefWriter : public IZoneDefWriter protected: static constexpr const char* META_DATA_KEY_GAME = "game"; static constexpr const char* META_DATA_KEY_GDT = "gdt"; - + virtual void WriteMetaData(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const = 0; virtual void WriteContent(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const = 0; public: void WriteZoneDef(std::ostream& stream, const UnlinkerArgs* args, Zone* zone) const override; -}; \ No newline at end of file +}; diff --git a/src/Unlinker/Game/IW3/ZoneDefWriterIW3.cpp b/src/Unlinker/Game/IW3/ZoneDefWriterIW3.cpp index b3ee1bb02..7e1dce977 100644 --- a/src/Unlinker/Game/IW3/ZoneDefWriterIW3.cpp +++ b/src/Unlinker/Game/IW3/ZoneDefWriterIW3.cpp @@ -1,9 +1,9 @@ #include "ZoneDefWriterIW3.h" -#include <cassert> - -#include "Game/IW3/GameIW3.h" #include "Game/IW3/GameAssetPoolIW3.h" +#include "Game/IW3/GameIW3.h" + +#include <cassert> using namespace IW3; @@ -12,9 +12,7 @@ bool ZoneDefWriter::CanHandleZone(Zone* zone) const return zone->m_game == &g_GameIW3; } -void ZoneDefWriter::WriteMetaData(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const -{ -} +void ZoneDefWriter::WriteMetaData(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const {} void ZoneDefWriter::WriteContent(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const { diff --git a/src/Unlinker/Game/IW3/ZoneDefWriterIW3.h b/src/Unlinker/Game/IW3/ZoneDefWriterIW3.h index b07e57d1b..17aa55598 100644 --- a/src/Unlinker/Game/IW3/ZoneDefWriterIW3.h +++ b/src/Unlinker/Game/IW3/ZoneDefWriterIW3.h @@ -13,4 +13,4 @@ namespace IW3 public: bool CanHandleZone(Zone* zone) const override; }; -} \ No newline at end of file +} // namespace IW3 diff --git a/src/Unlinker/Game/IW4/ZoneDefWriterIW4.cpp b/src/Unlinker/Game/IW4/ZoneDefWriterIW4.cpp index 76be5b7c4..869e70ff0 100644 --- a/src/Unlinker/Game/IW4/ZoneDefWriterIW4.cpp +++ b/src/Unlinker/Game/IW4/ZoneDefWriterIW4.cpp @@ -1,9 +1,9 @@ #include "ZoneDefWriterIW4.h" -#include <cassert> - -#include "Game/IW4/GameIW4.h" #include "Game/IW4/GameAssetPoolIW4.h" +#include "Game/IW4/GameIW4.h" + +#include <cassert> using namespace IW4; @@ -12,9 +12,7 @@ bool ZoneDefWriter::CanHandleZone(Zone* zone) const return zone->m_game == &g_GameIW4; } -void ZoneDefWriter::WriteMetaData(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const -{ -} +void ZoneDefWriter::WriteMetaData(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const {} void ZoneDefWriter::WriteContent(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const { diff --git a/src/Unlinker/Game/IW4/ZoneDefWriterIW4.h b/src/Unlinker/Game/IW4/ZoneDefWriterIW4.h index 6f9e1b82a..901800ba1 100644 --- a/src/Unlinker/Game/IW4/ZoneDefWriterIW4.h +++ b/src/Unlinker/Game/IW4/ZoneDefWriterIW4.h @@ -13,4 +13,4 @@ namespace IW4 public: bool CanHandleZone(Zone* zone) const override; }; -} \ No newline at end of file +} // namespace IW4 diff --git a/src/Unlinker/Game/IW5/ZoneDefWriterIW5.cpp b/src/Unlinker/Game/IW5/ZoneDefWriterIW5.cpp index 304a8019d..cd2e9b3d8 100644 --- a/src/Unlinker/Game/IW5/ZoneDefWriterIW5.cpp +++ b/src/Unlinker/Game/IW5/ZoneDefWriterIW5.cpp @@ -1,9 +1,9 @@ #include "ZoneDefWriterIW5.h" -#include <cassert> - -#include "Game/IW5/GameIW5.h" #include "Game/IW5/GameAssetPoolIW5.h" +#include "Game/IW5/GameIW5.h" + +#include <cassert> using namespace IW5; @@ -12,9 +12,7 @@ bool ZoneDefWriter::CanHandleZone(Zone* zone) const return zone->m_game == &g_GameIW5; } -void ZoneDefWriter::WriteMetaData(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const -{ -} +void ZoneDefWriter::WriteMetaData(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const {} void ZoneDefWriter::WriteContent(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const { diff --git a/src/Unlinker/Game/IW5/ZoneDefWriterIW5.h b/src/Unlinker/Game/IW5/ZoneDefWriterIW5.h index e68b942fd..92402fbff 100644 --- a/src/Unlinker/Game/IW5/ZoneDefWriterIW5.h +++ b/src/Unlinker/Game/IW5/ZoneDefWriterIW5.h @@ -13,4 +13,4 @@ namespace IW5 public: bool CanHandleZone(Zone* zone) const override; }; -} \ No newline at end of file +} // namespace IW5 diff --git a/src/Unlinker/Game/T5/ZoneDefWriterT5.cpp b/src/Unlinker/Game/T5/ZoneDefWriterT5.cpp index 1cc9e1cf1..024578bb2 100644 --- a/src/Unlinker/Game/T5/ZoneDefWriterT5.cpp +++ b/src/Unlinker/Game/T5/ZoneDefWriterT5.cpp @@ -1,9 +1,9 @@ #include "ZoneDefWriterT5.h" -#include <cassert> - -#include "Game/T5/GameT5.h" #include "Game/T5/GameAssetPoolT5.h" +#include "Game/T5/GameT5.h" + +#include <cassert> using namespace T5; @@ -12,9 +12,7 @@ bool ZoneDefWriter::CanHandleZone(Zone* zone) const return zone->m_game == &g_GameT5; } -void ZoneDefWriter::WriteMetaData(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const -{ -} +void ZoneDefWriter::WriteMetaData(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const {} void ZoneDefWriter::WriteContent(ZoneDefinitionOutputStream& stream, const UnlinkerArgs* args, Zone* zone) const { diff --git a/src/Unlinker/Game/T5/ZoneDefWriterT5.h b/src/Unlinker/Game/T5/ZoneDefWriterT5.h index bca2c2e33..a284dffd1 100644 --- a/src/Unlinker/Game/T5/ZoneDefWriterT5.h +++ b/src/Unlinker/Game/T5/ZoneDefWriterT5.h @@ -13,4 +13,4 @@ namespace T5 public: bool CanHandleZone(Zone* zone) const override; }; -} \ No newline at end of file +} // namespace T5 diff --git a/src/Unlinker/Game/T6/ZoneDefWriterT6.cpp b/src/Unlinker/Game/T6/ZoneDefWriterT6.cpp index 8f0ff78c8..6534636d9 100644 --- a/src/Unlinker/Game/T6/ZoneDefWriterT6.cpp +++ b/src/Unlinker/Game/T6/ZoneDefWriterT6.cpp @@ -1,11 +1,12 @@ #include "ZoneDefWriterT6.h" -#include "Game/T6/GameT6.h" + #include "Game/T6/CommonT6.h" #include "Game/T6/GameAssetPoolT6.h" +#include "Game/T6/GameT6.h" -#include <sstream> -#include <iomanip> #include <cassert> +#include <iomanip> +#include <sstream> using namespace T6; @@ -24,14 +25,13 @@ namespace T6 } }; - const KeyValuePairKnownKey KEY_VALUE_PAIR_KNOWN_KEYS[] - { + const KeyValuePairKnownKey KEY_VALUE_PAIR_KNOWN_KEYS[]{ KeyValuePairKnownKey("ipak_read"), KeyValuePairKnownKey("ipak_write"), KeyValuePairKnownKey("initial_xmodels"), KeyValuePairKnownKey("initial_materials"), }; -} +} // namespace T6 bool ZoneDefWriter::CanHandleZone(Zone* zone) const { @@ -99,4 +99,4 @@ void ZoneDefWriter::WriteContent(ZoneDefinitionOutputStream& stream, const Unlin break; } } -} \ No newline at end of file +} diff --git a/src/Unlinker/Game/T6/ZoneDefWriterT6.h b/src/Unlinker/Game/T6/ZoneDefWriterT6.h index 73c247d80..3eb04ec81 100644 --- a/src/Unlinker/Game/T6/ZoneDefWriterT6.h +++ b/src/Unlinker/Game/T6/ZoneDefWriterT6.h @@ -16,4 +16,4 @@ namespace T6 public: bool CanHandleZone(Zone* zone) const override; }; -} +} // namespace T6 diff --git a/src/Unlinker/Unlinker.cpp b/src/Unlinker/Unlinker.cpp index 043c7a679..2abcf3547 100644 --- a/src/Unlinker/Unlinker.cpp +++ b/src/Unlinker/Unlinker.cpp @@ -1,37 +1,36 @@ #include "Unlinker.h" -#include <set> -#include <regex> -#include <filesystem> -#include <fstream> - -#include "Utils/ClassUtils.h" -#include "Utils/Arguments/ArgumentParser.h" -#include "ZoneLoading.h" -#include "ObjWriting.h" #include "ContentLister/ContentPrinter.h" -#include "ObjLoading.h" -#include "SearchPath/SearchPaths.h" -#include "SearchPath/SearchPathFilesystem.h" #include "ContentLister/ZoneDefWriter.h" -#include "ObjContainer/IWD/IWD.h" -#include "UnlinkerArgs.h" #include "Game/IW3/ZoneDefWriterIW3.h" #include "Game/IW4/ZoneDefWriterIW4.h" #include "Game/IW5/ZoneDefWriterIW5.h" #include "Game/T5/ZoneDefWriterT5.h" #include "Game/T6/ZoneDefWriterT6.h" +#include "ObjContainer/IWD/IWD.h" +#include "ObjLoading.h" +#include "ObjWriting.h" +#include "SearchPath/SearchPathFilesystem.h" +#include "SearchPath/SearchPaths.h" +#include "UnlinkerArgs.h" +#include "Utils/Arguments/ArgumentParser.h" +#include "Utils/ClassUtils.h" #include "Utils/ObjFileStream.h" +#include "ZoneLoading.h" + +#include <filesystem> +#include <fstream> +#include <regex> +#include <set> namespace fs = std::filesystem; -const IZoneDefWriter* const ZONE_DEF_WRITERS[] -{ +const IZoneDefWriter* const ZONE_DEF_WRITERS[]{ new IW3::ZoneDefWriter(), new IW4::ZoneDefWriter(), new IW5::ZoneDefWriter(), new T5::ZoneDefWriter(), - new T6::ZoneDefWriter() + new T6::ZoneDefWriter(), }; class Unlinker::Impl @@ -346,7 +345,6 @@ class Unlinker::Impl ObjLoading::LoadObjDataForZone(&searchPathsForZone, zone.get()); } - m_loaded_zones.emplace_back(std::move(zone)); } @@ -403,7 +401,7 @@ class Unlinker::Impl if (ShouldLoadObj()) { ObjLoading::LoadReferencedContainersForZone(&searchPathsForZone, zone.get()); - ObjLoading::LoadObjDataForZone(&searchPathsForZone, zone.get()); + ObjLoading::LoadObjDataForZone(&searchPathsForZone, zone.get()); } if (!HandleZone(zone.get())) diff --git a/src/Unlinker/Unlinker.h b/src/Unlinker/Unlinker.h index 21653e76c..c549682f5 100644 --- a/src/Unlinker/Unlinker.h +++ b/src/Unlinker/Unlinker.h @@ -21,4 +21,4 @@ class Unlinker * \return \c true if the application was successful or \c false if an error occurred. */ bool Start(int argc, const char** argv) const; -}; \ No newline at end of file +}; diff --git a/src/Unlinker/UnlinkerArgs.cpp b/src/Unlinker/UnlinkerArgs.cpp index 25caad324..3802354a3 100644 --- a/src/Unlinker/UnlinkerArgs.cpp +++ b/src/Unlinker/UnlinkerArgs.cpp @@ -1,129 +1,104 @@ #include "UnlinkerArgs.h" -#include <regex> -#include <type_traits> - -#include "Utils/Arguments/UsageInformation.h" #include "ObjLoading.h" #include "ObjWriting.h" +#include "Utils/Arguments/UsageInformation.h" #include "Utils/FileUtils.h" +#include <regex> +#include <type_traits> + const CommandLineOption* const OPTION_HELP = - CommandLineOption::Builder::Create() - .WithShortName("?") - .WithLongName("help") - .WithDescription("Displays usage information.") - .Build(); + CommandLineOption::Builder::Create().WithShortName("?").WithLongName("help").WithDescription("Displays usage information.").Build(); const CommandLineOption* const OPTION_VERBOSE = - CommandLineOption::Builder::Create() - .WithShortName("v") - .WithLongName("verbose") - .WithDescription("Outputs a lot more and more detailed messages.") - .Build(); + CommandLineOption::Builder::Create().WithShortName("v").WithLongName("verbose").WithDescription("Outputs a lot more and more detailed messages.").Build(); const CommandLineOption* const OPTION_MINIMAL_ZONE_FILE = CommandLineOption::Builder::Create() - .WithShortName("min") - .WithLongName("minimal-zone") - .WithDescription("Minimizes the size of the zone file output by only including assets that are not a dependency of another asset.") - .Build(); - -const CommandLineOption* const OPTION_LOAD = - CommandLineOption::Builder::Create() - .WithShortName("l") - .WithLongName("load") - .WithDescription("Loads an existing zone before trying to unlink any zone.") - .WithParameter("zonePath") - .Reusable() - .Build(); + .WithShortName("min") + .WithLongName("minimal-zone") + .WithDescription("Minimizes the size of the zone file output by only including assets that are not a dependency of another asset.") + .Build(); + +const CommandLineOption* const OPTION_LOAD = CommandLineOption::Builder::Create() + .WithShortName("l") + .WithLongName("load") + .WithDescription("Loads an existing zone before trying to unlink any zone.") + .WithParameter("zonePath") + .Reusable() + .Build(); const CommandLineOption* const OPTION_LIST = - CommandLineOption::Builder::Create() - .WithLongName("list") - .WithDescription("Lists the contents of a zone instead of writing them to the disk.") - .Build(); + CommandLineOption::Builder::Create().WithLongName("list").WithDescription("Lists the contents of a zone instead of writing them to the disk.").Build(); const CommandLineOption* const OPTION_OUTPUT_FOLDER = CommandLineOption::Builder::Create() - .WithShortName("o") - .WithLongName("output-folder") - .WithDescription("Specifies the output folder containing the contents of the unlinked zones. Defaults to \"" + std::string(UnlinkerArgs::DEFAULT_OUTPUT_FOLDER) + "\"") - .WithParameter("outputFolderPath") - .Build(); - -const CommandLineOption* const OPTION_SEARCH_PATH = - CommandLineOption::Builder::Create() - .WithLongName("search-path") - .WithDescription("Specifies a semi-colon separated list of paths to search for additional game files.") - .WithParameter("searchPathString") - .Build(); - -const CommandLineOption* const OPTION_IMAGE_FORMAT = - CommandLineOption::Builder::Create() - .WithLongName("image-format") - .WithDescription("Specifies the format of dumped image files. Valid values are: DDS, IWI") - .WithParameter("imageFormatValue") - .Build(); - -const CommandLineOption* const OPTION_MODEL_FORMAT = - CommandLineOption::Builder::Create() - .WithLongName("model-format") - .WithDescription("Specifies the format of dumped model files. Valid values are: XMODEL_EXPORT, OBJ") - .WithParameter("modelFormatValue") - .Build(); + .WithShortName("o") + .WithLongName("output-folder") + .WithDescription("Specifies the output folder containing the contents of the unlinked zones. Defaults to \"" + + std::string(UnlinkerArgs::DEFAULT_OUTPUT_FOLDER) + "\"") + .WithParameter("outputFolderPath") + .Build(); + +const CommandLineOption* const OPTION_SEARCH_PATH = CommandLineOption::Builder::Create() + .WithLongName("search-path") + .WithDescription("Specifies a semi-colon separated list of paths to search for additional game files.") + .WithParameter("searchPathString") + .Build(); + +const CommandLineOption* const OPTION_IMAGE_FORMAT = CommandLineOption::Builder::Create() + .WithLongName("image-format") + .WithDescription("Specifies the format of dumped image files. Valid values are: DDS, IWI") + .WithParameter("imageFormatValue") + .Build(); + +const CommandLineOption* const OPTION_MODEL_FORMAT = CommandLineOption::Builder::Create() + .WithLongName("model-format") + .WithDescription("Specifies the format of dumped model files. Valid values are: XMODEL_EXPORT, OBJ") + .WithParameter("modelFormatValue") + .Build(); const CommandLineOption* const OPTION_SKIP_OBJ = - CommandLineOption::Builder::Create() - .WithLongName("skip-obj") - .WithDescription("Skips loading raw obj data.") - .Build(); + CommandLineOption::Builder::Create().WithLongName("skip-obj").WithDescription("Skips loading raw obj data.").Build(); const CommandLineOption* const OPTION_GDT = - CommandLineOption::Builder::Create() - .WithLongName("gdt") - .WithDescription("Dumps assets in a GDT whenever possible.") - .Build(); - -const CommandLineOption* const OPTION_EXCLUDE_ASSETS = - CommandLineOption::Builder::Create() - .WithLongName("exclude-assets") - .WithDescription("Specify all asset types that should be excluded.") - .WithParameter("assetTypeList") - .Reusable() - .Build(); - -const CommandLineOption* const OPTION_INCLUDE_ASSETS = - CommandLineOption::Builder::Create() - .WithLongName("include-assets") - .WithDescription("Specify all asset types that should be included.") - .WithParameter("assetTypeList") - .Reusable() - .Build(); + CommandLineOption::Builder::Create().WithLongName("gdt").WithDescription("Dumps assets in a GDT whenever possible.").Build(); + +const CommandLineOption* const OPTION_EXCLUDE_ASSETS = CommandLineOption::Builder::Create() + .WithLongName("exclude-assets") + .WithDescription("Specify all asset types that should be excluded.") + .WithParameter("assetTypeList") + .Reusable() + .Build(); + +const CommandLineOption* const OPTION_INCLUDE_ASSETS = CommandLineOption::Builder::Create() + .WithLongName("include-assets") + .WithDescription("Specify all asset types that should be included.") + .WithParameter("assetTypeList") + .Reusable() + .Build(); const CommandLineOption* const OPTION_LEGACY_MENUS = CommandLineOption::Builder::Create() - .WithLongName("legacy-menus") - .WithDescription("Dumps menus with a compatibility mode to work with applications not compatible with the newer dumping mode.") - .Build(); - -const CommandLineOption* const COMMAND_LINE_OPTIONS[] -{ - OPTION_HELP, - OPTION_VERBOSE, - OPTION_MINIMAL_ZONE_FILE, - OPTION_LOAD, - OPTION_LIST, - OPTION_OUTPUT_FOLDER, - OPTION_SEARCH_PATH, - OPTION_IMAGE_FORMAT, - OPTION_MODEL_FORMAT, - OPTION_SKIP_OBJ, - OPTION_GDT, - OPTION_EXCLUDE_ASSETS, - OPTION_INCLUDE_ASSETS, - OPTION_LEGACY_MENUS -}; + .WithLongName("legacy-menus") + .WithDescription("Dumps menus with a compatibility mode to work with applications not compatible with the newer dumping mode.") + .Build(); + +const CommandLineOption* const COMMAND_LINE_OPTIONS[]{OPTION_HELP, + OPTION_VERBOSE, + OPTION_MINIMAL_ZONE_FILE, + OPTION_LOAD, + OPTION_LIST, + OPTION_OUTPUT_FOLDER, + OPTION_SEARCH_PATH, + OPTION_IMAGE_FORMAT, + OPTION_MODEL_FORMAT, + OPTION_SKIP_OBJ, + OPTION_GDT, + OPTION_EXCLUDE_ASSETS, + OPTION_INCLUDE_ASSETS, + OPTION_LEGACY_MENUS}; UnlinkerArgs::UnlinkerArgs() : m_argument_parser(COMMAND_LINE_OPTIONS, std::extent_v<decltype(COMMAND_LINE_OPTIONS)>), @@ -258,7 +233,6 @@ bool UnlinkerArgs::ParseArgs(const int argc, const char** argv) return false; } - // -v; --verbose SetVerbose(m_argument_parser.IsOptionSpecified(OPTION_VERBOSE)); diff --git a/src/Unlinker/UnlinkerArgs.h b/src/Unlinker/UnlinkerArgs.h index 7a4d081f3..d26dca949 100644 --- a/src/Unlinker/UnlinkerArgs.h +++ b/src/Unlinker/UnlinkerArgs.h @@ -1,12 +1,12 @@ #pragma once +#include "Utils/Arguments/ArgumentParser.h" +#include "Zone/Zone.h" + #include <regex> #include <set> -#include <vector> #include <string> #include <unordered_map> - -#include "Utils/Arguments/ArgumentParser.h" -#include "Zone/Zone.h" +#include <vector> class UnlinkerArgs { diff --git a/src/Utils/Math/Matrix.h b/src/Utils/Math/Matrix.h index 4f5006e77..9810a344b 100644 --- a/src/Utils/Math/Matrix.h +++ b/src/Utils/Math/Matrix.h @@ -1,31 +1,27 @@ #pragma once -template <typename T> -class Matrix +template<typename T> class Matrix { public: T m_data[4][4]; Matrix() : m_data{ - {T(1.0), 0, 0, 0}, - {0, T(1.0), 0, 0}, - {0, 0, T(1.0), 0}, - {0, 0, 0, T(1.0)} - } + {T(1.0), 0, 0, 0 }, + {0, T(1.0), 0, 0 }, + {0, 0, T(1.0), 0 }, + {0, 0, 0, T(1.0)} + } { } - Matrix(T d00, T d01, T d02, T d03, - T d10, T d11, T d12, T d13, - T d20, T d21, T d22, T d23, - T d30, T d31, T d32, T d33) + Matrix(T d00, T d01, T d02, T d03, T d10, T d11, T d12, T d13, T d20, T d21, T d22, T d23, T d30, T d31, T d32, T d33) : m_data{ {d00, d01, d02, d03}, {d10, d11, d12, d13}, {d20, d21, d22, d23}, {d30, d31, d32, d33} - } + } { } diff --git a/src/Utils/Math/Quaternion.h b/src/Utils/Math/Quaternion.h index 2d0336ece..1090f96ea 100644 --- a/src/Utils/Math/Quaternion.h +++ b/src/Utils/Math/Quaternion.h @@ -1,10 +1,9 @@ #pragma once -#include "Utils/ClassUtils.h" #include "Matrix.h" +#include "Utils/ClassUtils.h" -template <typename T> -class Quaternion +template<typename T> class Quaternion { public: T m_x; @@ -50,12 +49,7 @@ class Quaternion const T m21 = 2 * yz + 2 * xw; const T m22 = 1 - 2 * xx - 2 * yy; - return Matrix<T>( - m00, m01, m02, 0, - m10, m11, m12, 0, - m20, m21, m22, 0, - 0, 0, 0, T(1.0) - ); + return Matrix<T>(m00, m01, m02, 0, m10, m11, m12, 0, m20, m21, m22, 0, 0, 0, 0, T(1.0)); } }; diff --git a/src/Utils/Math/Vector.h b/src/Utils/Math/Vector.h index 7fa9caac2..3657d33d0 100644 --- a/src/Utils/Math/Vector.h +++ b/src/Utils/Math/Vector.h @@ -1,26 +1,25 @@ #pragma once -#include <cassert> - #include "Utils/ClassUtils.h" -template <typename T> -class Vector2 +#include <cassert> + +template<typename T> class Vector2 { T m_value[2]; public: Vector2() - : m_value{ T(0), T(0)} + : m_value{T(0), T(0)} { } Vector2(T x, T y) - : m_value{ x, y } + : m_value{x, y} { } explicit Vector2(const T* value) - : m_value{ value[0], value[1] } + : m_value{value[0], value[1]} { } @@ -36,33 +35,47 @@ class Vector2 return m_value[index]; } - _NODISCARD T& x() { return m_value[0]; } - _NODISCARD T& y() { return m_value[1]; } - _NODISCARD const T& x() const { return m_value[0]; } - _NODISCARD const T& y() const { return m_value[1]; } + _NODISCARD T& x() + { + return m_value[0]; + } + + _NODISCARD T& y() + { + return m_value[1]; + } + + _NODISCARD const T& x() const + { + return m_value[0]; + } + + _NODISCARD const T& y() const + { + return m_value[1]; + } }; typedef Vector2<float> Vector2f; typedef Vector2<double> Vector2d; -template <typename T> -class Vector3 +template<typename T> class Vector3 { T m_value[3]; public: Vector3() - : m_value{ T(0), T(0), T(0) } + : m_value{T(0), T(0), T(0)} { } Vector3(T x, T y, T z) - : m_value{ x, y, z } + : m_value{x, y, z} { } explicit Vector3(const T* value) - : m_value{ value[0], value[1], value[2] } + : m_value{value[0], value[1], value[2]} { } @@ -78,26 +91,71 @@ class Vector3 return m_value[index]; } - _NODISCARD T& x() { return m_value[0]; } - _NODISCARD T& y() { return m_value[1]; } - _NODISCARD T& z() { return m_value[2]; } - _NODISCARD const T& x() const { return m_value[0]; } - _NODISCARD const T& y() const { return m_value[1]; } - _NODISCARD const T& z() const { return m_value[2]; } + _NODISCARD T& x() + { + return m_value[0]; + } + + _NODISCARD T& y() + { + return m_value[1]; + } + + _NODISCARD T& z() + { + return m_value[2]; + } + + _NODISCARD const T& x() const + { + return m_value[0]; + } + + _NODISCARD const T& y() const + { + return m_value[1]; + } + + _NODISCARD const T& z() const + { + return m_value[2]; + } + + _NODISCARD T& r() + { + return m_value[0]; + } + + _NODISCARD T& g() + { + return m_value[1]; + } + + _NODISCARD T& b() + { + return m_value[2]; + } + + _NODISCARD const T& r() const + { + return m_value[0]; + } + + _NODISCARD const T& g() const + { + return m_value[1]; + } - _NODISCARD T& r() { return m_value[0]; } - _NODISCARD T& g() { return m_value[1]; } - _NODISCARD T& b() { return m_value[2]; } - _NODISCARD const T& r() const { return m_value[0]; } - _NODISCARD const T& g() const { return m_value[1]; } - _NODISCARD const T& b() const { return m_value[2]; } + _NODISCARD const T& b() const + { + return m_value[2]; + } }; typedef Vector3<float> Vector3f; typedef Vector3<double> Vector3d; -template <typename T> -class Vector4 +template<typename T> class Vector4 { T m_value[4]; @@ -113,7 +171,7 @@ class Vector4 } explicit Vector4(const T* value) - : m_value{ value[0], value[1], value[2], value[3] } + : m_value{value[0], value[1], value[2], value[3]} { } @@ -129,23 +187,85 @@ class Vector4 return m_value[index]; } - _NODISCARD T& x() { return m_value[0]; } - _NODISCARD T& y() { return m_value[1]; } - _NODISCARD T& z() { return m_value[2]; } - _NODISCARD T& w() { return m_value[3]; } - _NODISCARD const T& x() const { return m_value[0]; } - _NODISCARD const T& y() const { return m_value[1]; } - _NODISCARD const T& z() const { return m_value[2]; } - _NODISCARD const T& w() const { return m_value[3]; } - - _NODISCARD T& r() { return m_value[0]; } - _NODISCARD T& g() { return m_value[1]; } - _NODISCARD T& b() { return m_value[2]; } - _NODISCARD T& a() { return m_value[3]; } - _NODISCARD const T& r() const { return m_value[0]; } - _NODISCARD const T& g() const { return m_value[1]; } - _NODISCARD const T& b() const { return m_value[2]; } - _NODISCARD const T& a() const { return m_value[3]; } + _NODISCARD T& x() + { + return m_value[0]; + } + + _NODISCARD T& y() + { + return m_value[1]; + } + + _NODISCARD T& z() + { + return m_value[2]; + } + + _NODISCARD T& w() + { + return m_value[3]; + } + + _NODISCARD const T& x() const + { + return m_value[0]; + } + + _NODISCARD const T& y() const + { + return m_value[1]; + } + + _NODISCARD const T& z() const + { + return m_value[2]; + } + + _NODISCARD const T& w() const + { + return m_value[3]; + } + + _NODISCARD T& r() + { + return m_value[0]; + } + + _NODISCARD T& g() + { + return m_value[1]; + } + + _NODISCARD T& b() + { + return m_value[2]; + } + + _NODISCARD T& a() + { + return m_value[3]; + } + + _NODISCARD const T& r() const + { + return m_value[0]; + } + + _NODISCARD const T& g() const + { + return m_value[1]; + } + + _NODISCARD const T& b() const + { + return m_value[2]; + } + + _NODISCARD const T& a() const + { + return m_value[3]; + } }; typedef Vector4<float> Vector4f; diff --git a/src/Utils/Utils/Alignment.h b/src/Utils/Utils/Alignment.h index 053a46364..f6e86193e 100644 --- a/src/Utils/Utils/Alignment.h +++ b/src/Utils/Utils/Alignment.h @@ -2,19 +2,17 @@ namespace utils { - template <typename T> - constexpr T Align(const T value, const T toNext) + template<typename T> constexpr T Align(const T value, const T toNext) { if (toNext > 0) return (value + toNext - 1) / toNext * toNext; return value; } - template <typename T> - constexpr T AlignToPrevious(const T value, const T toPrevious) + template<typename T> constexpr T AlignToPrevious(const T value, const T toPrevious) { if (toPrevious > 0) return value / toPrevious * toPrevious; return value; } -} +} // namespace utils diff --git a/src/Utils/Utils/Arguments/ArgumentParser.cpp b/src/Utils/Utils/Arguments/ArgumentParser.cpp index fe3fabd16..9625fd343 100644 --- a/src/Utils/Utils/Arguments/ArgumentParser.cpp +++ b/src/Utils/Utils/Arguments/ArgumentParser.cpp @@ -1,4 +1,5 @@ #include "ArgumentParser.h" + #include <sstream> const std::string PREFIX_LONG = "--"; @@ -6,7 +7,7 @@ const std::string PREFIX_SHORT = "-"; ArgumentParser::ArgumentParser(const CommandLineOption* const* options, const size_t optionCount) { - for(unsigned optionIndex = 0; optionIndex < optionCount; optionIndex++) + for (unsigned optionIndex = 0; optionIndex < optionCount; optionIndex++) { m_command_line_options.push_back(options[optionIndex]); } @@ -15,8 +16,8 @@ ArgumentParser::ArgumentParser(const CommandLineOption* const* options, const si bool ArgumentParser::ParseArguments(const int argc, const char** argv) { std::vector<std::string> args(argc); - - for(int arg = 0; arg < argc; arg++) + + for (int arg = 0; arg < argc; arg++) { args[arg] = argv[arg]; } @@ -34,23 +35,23 @@ bool ArgumentParser::ParseArguments(std::vector<std::string>& args) { std::string& arg = args[argIndex]; - if(arg.compare(0, PREFIX_SHORT.size(), PREFIX_SHORT) == 0) + if (arg.compare(0, PREFIX_SHORT.size(), PREFIX_SHORT) == 0) { // Options should be case insensitive. So before comparing we make the argument lower case. const size_t argStrLen = arg.size(); - for(unsigned argStrIndex = 0; argStrIndex < argStrLen; argStrIndex++) + for (unsigned argStrIndex = 0; argStrIndex < argStrLen; argStrIndex++) { arg[argStrIndex] = tolower(arg[argStrIndex]); } const CommandLineOption* matchedOption = nullptr; - if(arg.compare(0, PREFIX_LONG.size(), PREFIX_LONG) == 0) + if (arg.compare(0, PREFIX_LONG.size(), PREFIX_LONG) == 0) { std::string longName = arg.substr(2); for (auto option : m_command_line_options) { - if(option->m_long_name == longName) + if (option->m_long_name == longName) { matchedOption = option; break; @@ -63,7 +64,7 @@ bool ArgumentParser::ParseArguments(std::vector<std::string>& args) for (auto option : m_command_line_options) { - if(option->m_short_name == shortName) + if (option->m_short_name == shortName) { matchedOption = option; break; @@ -71,15 +72,15 @@ bool ArgumentParser::ParseArguments(std::vector<std::string>& args) } } - if(matchedOption == nullptr) + if (matchedOption == nullptr) { printf("Unknown option '%s'.\n", arg.c_str()); return false; } - if(m_matched_options.find(matchedOption) != m_matched_options.end()) + if (m_matched_options.find(matchedOption) != m_matched_options.end()) { - if(!matchedOption->m_multi_use) + if (!matchedOption->m_multi_use) { printf("Option '%s' already specified.\n", arg.c_str()); return false; @@ -89,20 +90,20 @@ bool ArgumentParser::ParseArguments(std::vector<std::string>& args) { m_matched_options[matchedOption] = std::vector<std::string>(); } - + const size_t parameterCount = matchedOption->m_parameters.size(); - if(argIndex + parameterCount >= argCount) + if (argIndex + parameterCount >= argCount) { printf("Not enough parameters for option '%s'.\n", arg.c_str()); return false; } std::vector<std::string>& parameters = m_matched_options[matchedOption]; - for(unsigned parameterIndex = 0; parameterIndex < parameterCount; parameterIndex++) + for (unsigned parameterIndex = 0; parameterIndex < parameterCount; parameterIndex++) { std::string& param = args[argIndex + parameterIndex + 1]; - if(param.compare(0, PREFIX_SHORT.size(), PREFIX_SHORT) == 0) + if (param.compare(0, PREFIX_SHORT.size(), PREFIX_SHORT) == 0) { printf("Not enough parameters for option '%s'.\n", arg.c_str()); return false; @@ -129,14 +130,14 @@ std::vector<std::string> ArgumentParser::GetArguments() const std::string ArgumentParser::GetValueForOption(const CommandLineOption* option) { - if(!IsOptionSpecified(option)) + if (!IsOptionSpecified(option)) return ""; std::stringstream value; bool firstMatch = true; for (const auto& match : m_matched_options[option]) { - if(!firstMatch) + if (!firstMatch) { value << " " << match; } @@ -152,7 +153,7 @@ std::string ArgumentParser::GetValueForOption(const CommandLineOption* option) std::vector<std::string> ArgumentParser::GetParametersForOption(const CommandLineOption* option) { - if(!IsOptionSpecified(option)) + if (!IsOptionSpecified(option)) return std::vector<std::string>(); return m_matched_options[option]; @@ -161,4 +162,4 @@ std::vector<std::string> ArgumentParser::GetParametersForOption(const CommandLin bool ArgumentParser::IsOptionSpecified(const CommandLineOption* option) { return m_matched_options.find(option) != m_matched_options.end(); -} \ No newline at end of file +} diff --git a/src/Utils/Utils/Arguments/ArgumentParser.h b/src/Utils/Utils/Arguments/ArgumentParser.h index 7e23d65de..1983d2f21 100644 --- a/src/Utils/Utils/Arguments/ArgumentParser.h +++ b/src/Utils/Utils/Arguments/ArgumentParser.h @@ -1,8 +1,9 @@ #pragma once #include "CommandLineOption.h" + +#include <map> #include <string> #include <vector> -#include <map> class ArgumentParser { @@ -12,7 +13,7 @@ class ArgumentParser public: ArgumentParser(const CommandLineOption* const* options, size_t optionCount); - + bool ParseArguments(std::vector<std::string>& args); bool ParseArguments(int argc, const char** argv); diff --git a/src/Utils/Utils/Arguments/CommandLineOption.h b/src/Utils/Utils/Arguments/CommandLineOption.h index 1d915cb36..585001691 100644 --- a/src/Utils/Utils/Arguments/CommandLineOption.h +++ b/src/Utils/Utils/Arguments/CommandLineOption.h @@ -32,4 +32,4 @@ class CommandLineOption::Builder Builder& WithParameter(std::string parameterName); Builder& Reusable(); CommandLineOption* Build() const; -}; \ No newline at end of file +}; diff --git a/src/Utils/Utils/Arguments/UsageInformation.cpp b/src/Utils/Utils/Arguments/UsageInformation.cpp index c94d1381c..ad80ee2f1 100644 --- a/src/Utils/Utils/Arguments/UsageInformation.cpp +++ b/src/Utils/Utils/Arguments/UsageInformation.cpp @@ -1,7 +1,8 @@ #include "UsageInformation.h" + +#include <iomanip> #include <iostream> #include <map> -#include <iomanip> UsageInformation::ArgumentUsage::ArgumentUsage(std::string name, const bool optional) { @@ -88,18 +89,14 @@ void UsageInformation::Print() for (auto option : category.second) { - str << std::setw(static_cast<std::streamsize>(longestShortName) + 1) << (!option->m_short_name.empty() - ? "-" + option->m_short_name - : ""); + str << std::setw(static_cast<std::streamsize>(longestShortName) + 1) << (!option->m_short_name.empty() ? "-" + option->m_short_name : ""); if (!option->m_short_name.empty() && !option->m_long_name.empty()) str << ", "; else str << " "; - str << std::setw(static_cast<std::streamsize>(longestLongName) + 2) << (!option->m_long_name.empty() - ? "--" + option->m_long_name - : ""); + str << std::setw(static_cast<std::streamsize>(longestLongName) + 2) << (!option->m_long_name.empty() ? "--" + option->m_long_name : ""); str << " "; str << std::setw(longestArgumentLength) << GetOptionArgument(option); @@ -160,7 +157,6 @@ size_t UsageInformation::GetOptionArgumentLength(const CommandLineOption* option parameterCombinedStringLength += param.length(); } - return parameterCount * 2 // < and > - + parameterCombinedStringLength - + (parameterCount > 1 ? parameterCount - 1 : 0); // One space between each argument + return parameterCount * 2 // < and > + + parameterCombinedStringLength + (parameterCount > 1 ? parameterCount - 1 : 0); // One space between each argument } diff --git a/src/Utils/Utils/Arguments/UsageInformation.h b/src/Utils/Utils/Arguments/UsageInformation.h index 16f663495..a2b23843a 100644 --- a/src/Utils/Utils/Arguments/UsageInformation.h +++ b/src/Utils/Utils/Arguments/UsageInformation.h @@ -1,8 +1,9 @@ #pragma once #include "CommandLineOption.h" + +#include <sstream> #include <string> #include <vector> -#include <sstream> class UsageInformation { @@ -21,7 +22,7 @@ class UsageInformation bool m_var_args; void PrintUsageOverview(std::stringstream& str); - + static std::string GetOptionArgument(const CommandLineOption* option); static size_t GetOptionArgumentLength(const CommandLineOption* option); @@ -34,4 +35,4 @@ class UsageInformation void SetVariableArguments(bool enabled); void Print(); -}; \ No newline at end of file +}; diff --git a/src/Utils/Utils/ClassUtils.h b/src/Utils/Utils/ClassUtils.h index 8fd506454..39fef73c8 100644 --- a/src/Utils/Utils/ClassUtils.h +++ b/src/Utils/Utils/ClassUtils.h @@ -28,13 +28,12 @@ #define _NORETURN #endif -template <class T> -struct Movable +template<class T> struct Movable { mutable T m_val; // ReSharper disable once CppNonExplicitConversionOperator - operator T() const && + operator T() const&& { return std::move(m_val); } diff --git a/src/Utils/Utils/Endianness.cpp b/src/Utils/Utils/Endianness.cpp index 4047984e8..995e3203f 100644 --- a/src/Utils/Utils/Endianness.cpp +++ b/src/Utils/Utils/Endianness.cpp @@ -6,10 +6,7 @@ namespace endianness { constexpr uint16_t byteswap16u(const uint16_t in) { - return static_cast<uint16_t>( - (in >> 8) | - (in << 8) - ); + return static_cast<uint16_t>((in >> 8) | (in << 8)); } constexpr int16_t byteswap16s(const int16_t in) @@ -19,12 +16,7 @@ namespace endianness constexpr uint32_t byteswap32u(const uint32_t in) { - return static_cast<uint32_t>( - (in >> 24) | - ((in >> 8) & 0x0000FF00ui32) | - ((in << 8) & 0x00FF0000ui32) | - (in << 24) - ); + return static_cast<uint32_t>((in >> 24) | ((in >> 8) & 0x0000FF00ui32) | ((in << 8) & 0x00FF0000ui32) | (in << 24)); } constexpr int32_t byteswap32s(const int32_t in) @@ -34,23 +26,16 @@ namespace endianness constexpr uint64_t byteswap64u(const uint64_t in) { - return static_cast<uint32_t>( - (in >> 56) | - ((in >> 40) & 0x000000000000FF00ui64) | - ((in >> 24) & 0x0000000000FF0000ui64) | - ((in >> 8) & 0x00000000FF000000ui64) | - ((in << 8) & 0x000000FF00000000ui64) | - ((in << 24) & 0x0000FF0000000000ui64) | - ((in << 40) & 0x00FF000000000000ui64) | - (in << 56) - ); + return static_cast<uint32_t>((in >> 56) | ((in >> 40) & 0x000000000000FF00ui64) | ((in >> 24) & 0x0000000000FF0000ui64) + | ((in >> 8) & 0x00000000FF000000ui64) | ((in << 8) & 0x000000FF00000000ui64) | ((in << 24) & 0x0000FF0000000000ui64) + | ((in << 40) & 0x00FF000000000000ui64) | (in << 56)); } constexpr int64_t byteswap64s(const int64_t in) { return static_cast<int64_t>(byteswap64u(static_cast<uint64_t>(in))); } -} +} // namespace endianness #else @@ -85,7 +70,7 @@ namespace endianness { return __builtin_bswap64(in); } -} +} // namespace endianness #endif @@ -216,4 +201,4 @@ namespace endianness } #endif -} +} // namespace endianness diff --git a/src/Utils/Utils/Endianness.h b/src/Utils/Utils/Endianness.h index 196ae7969..0840e4ea2 100644 --- a/src/Utils/Utils/Endianness.h +++ b/src/Utils/Utils/Endianness.h @@ -24,18 +24,65 @@ namespace endianness { #if HOST_ENDIANNESS == LITTLE_ENDIAN_ENDIANNESS - constexpr int16_t ToLittleEndian(const int16_t in) { return in; } - constexpr uint16_t ToLittleEndian(const uint16_t in) { return in; } - constexpr int32_t ToLittleEndian(const int32_t in) { return in; } - constexpr uint32_t ToLittleEndian(const uint32_t in) { return in; } - constexpr int64_t ToLittleEndian(const int64_t in) { return in; } - constexpr uint64_t ToLittleEndian(const uint64_t in) { return in; } - constexpr int16_t FromLittleEndian(const int16_t in) { return in; } - constexpr uint16_t FromLittleEndian(const uint16_t in) { return in; } - constexpr int32_t FromLittleEndian(const int32_t in) { return in; } - constexpr uint32_t FromLittleEndian(const uint32_t in) { return in; } - constexpr int64_t FromLittleEndian(const int64_t in) { return in; } - constexpr uint64_t FromLittleEndian(const uint64_t in) { return in; } + constexpr int16_t ToLittleEndian(const int16_t in) + { + return in; + } + + constexpr uint16_t ToLittleEndian(const uint16_t in) + { + return in; + } + + constexpr int32_t ToLittleEndian(const int32_t in) + { + return in; + } + + constexpr uint32_t ToLittleEndian(const uint32_t in) + { + return in; + } + + constexpr int64_t ToLittleEndian(const int64_t in) + { + return in; + } + + constexpr uint64_t ToLittleEndian(const uint64_t in) + { + return in; + } + + constexpr int16_t FromLittleEndian(const int16_t in) + { + return in; + } + + constexpr uint16_t FromLittleEndian(const uint16_t in) + { + return in; + } + + constexpr int32_t FromLittleEndian(const int32_t in) + { + return in; + } + + constexpr uint32_t FromLittleEndian(const uint32_t in) + { + return in; + } + + constexpr int64_t FromLittleEndian(const int64_t in) + { + return in; + } + + constexpr uint64_t FromLittleEndian(const uint64_t in) + { + return in; + } #else int16_t ToLittleEndian(int16_t in); uint16_t ToLittleEndian(uint16_t in); @@ -51,20 +98,66 @@ namespace endianness uint64_t FromLittleEndian(uint64_t in); #endif - #if HOST_ENDIANNESS == BIG_ENDIAN_ENDIANNESS - constexpr int16_t ToBigEndian(const int16_t in) { return in; } - constexpr uint16_t ToBigEndian(const uint16_t in) { return in; } - constexpr int32_t ToBigEndian(const int32_t in) { return in; } - constexpr uint32_t ToBigEndian(const uint32_t in) { return in; } - constexpr int64_t ToBigEndian(const int64_t in) { return in; } - constexpr uint64_t ToBigEndian(const uint64_t in) { return in; } - constexpr int16_t FromBigEndian(const int16_t in) { return in; } - constexpr uint16_t FromBigEndian(const uint16_t in) { return in; } - constexpr int32_t FromBigEndian(const int32_t in) { return in; } - constexpr uint32_t FromBigEndian(const uint32_t in) { return in; } - constexpr int64_t FromBigEndian(const int64_t in) { return in; } - constexpr uint64_t FromBigEndian(const uint64_t in) { return in; } + constexpr int16_t ToBigEndian(const int16_t in) + { + return in; + } + + constexpr uint16_t ToBigEndian(const uint16_t in) + { + return in; + } + + constexpr int32_t ToBigEndian(const int32_t in) + { + return in; + } + + constexpr uint32_t ToBigEndian(const uint32_t in) + { + return in; + } + + constexpr int64_t ToBigEndian(const int64_t in) + { + return in; + } + + constexpr uint64_t ToBigEndian(const uint64_t in) + { + return in; + } + + constexpr int16_t FromBigEndian(const int16_t in) + { + return in; + } + + constexpr uint16_t FromBigEndian(const uint16_t in) + { + return in; + } + + constexpr int32_t FromBigEndian(const int32_t in) + { + return in; + } + + constexpr uint32_t FromBigEndian(const uint32_t in) + { + return in; + } + + constexpr int64_t FromBigEndian(const int64_t in) + { + return in; + } + + constexpr uint64_t FromBigEndian(const uint64_t in) + { + return in; + } #else int16_t ToBigEndian(int16_t in); uint16_t ToBigEndian(uint16_t in); @@ -79,4 +172,4 @@ namespace endianness int64_t FromBigEndian(int64_t in); uint64_t FromBigEndian(uint64_t in); #endif -} +} // namespace endianness diff --git a/src/Utils/Utils/FileUtils.h b/src/Utils/Utils/FileUtils.h index e96178b6d..18a1525cf 100644 --- a/src/Utils/Utils/FileUtils.h +++ b/src/Utils/Utils/FileUtils.h @@ -8,10 +8,7 @@ class FileUtils public: static constexpr uint32_t MakeMagic32(const char ch0, const char ch1, const char ch2, const char ch3) { - return static_cast<uint32_t>(ch0) - | static_cast<uint32_t>(ch1) << 8 - | static_cast<uint32_t>(ch2) << 16 - | static_cast<uint32_t>(ch3) << 24; + return static_cast<uint32_t>(ch0) | static_cast<uint32_t>(ch1) << 8 | static_cast<uint32_t>(ch2) << 16 | static_cast<uint32_t>(ch3) << 24; } /** diff --git a/src/Utils/Utils/MemoryManager.cpp b/src/Utils/Utils/MemoryManager.cpp index 31582fb1e..2943b5251 100644 --- a/src/Utils/Utils/MemoryManager.cpp +++ b/src/Utils/Utils/MemoryManager.cpp @@ -9,8 +9,7 @@ MemoryManager::AllocationInfo::AllocationInfo(IDestructible* data, void* dataPtr m_data_ptr = dataPtr; } -MemoryManager::MemoryManager() -= default; +MemoryManager::MemoryManager() = default; MemoryManager::~MemoryManager() { diff --git a/src/Utils/Utils/MemoryManager.h b/src/Utils/Utils/MemoryManager.h index 03ec0a4de..505fa14a7 100644 --- a/src/Utils/Utils/MemoryManager.h +++ b/src/Utils/Utils/MemoryManager.h @@ -11,13 +11,12 @@ class MemoryManager virtual ~IDestructible() = default; }; - template <class T> - class Allocation final : public IDestructible + template<class T> class Allocation final : public IDestructible { public: T m_entry; - template <class... _Valty> + template<class... _Valty> explicit Allocation(_Valty&&... _Val) : m_entry(std::forward<_Valty>(_Val)...) { @@ -50,8 +49,7 @@ class MemoryManager void* Alloc(size_t size); char* Dup(const char* str); - template <class T, class... _Valty> - T* Create(_Valty&&... _Val) + template<class T, class... _Valty> T* Create(_Valty&&... _Val) { Allocation<T>* allocation = new Allocation<T>(std::forward<_Valty>(_Val)...); m_destructible.emplace_back(allocation, &allocation->m_entry); @@ -60,4 +58,4 @@ class MemoryManager void Free(void* data); void Delete(void* data); -}; \ No newline at end of file +}; diff --git a/src/Utils/Utils/StringUtils.cpp b/src/Utils/Utils/StringUtils.cpp index 3edf0c593..cffa5ed61 100644 --- a/src/Utils/Utils/StringUtils.cpp +++ b/src/Utils/Utils/StringUtils.cpp @@ -100,4 +100,4 @@ namespace utils for (auto& c : str) c = static_cast<char>(toupper(c)); } -} +} // namespace utils diff --git a/src/Utils/Utils/StringUtils.h b/src/Utils/Utils/StringUtils.h index d49de6b90..ca3f771d8 100644 --- a/src/Utils/Utils/StringUtils.h +++ b/src/Utils/Utils/StringUtils.h @@ -14,4 +14,4 @@ namespace utils void MakeStringLowerCase(std::string& str); void MakeStringUpperCase(std::string& str); -} +} // namespace utils diff --git a/src/Utils/Utils/TransformIterator.h b/src/Utils/Utils/TransformIterator.h index 619609af6..950df10c9 100644 --- a/src/Utils/Utils/TransformIterator.h +++ b/src/Utils/Utils/TransformIterator.h @@ -2,15 +2,15 @@ #include <functional> -template <typename BaseIteratorType, typename SourceType, typename TargetType> -class TransformIterator +template<typename BaseIteratorType, typename SourceType, typename TargetType> class TransformIterator { BaseIteratorType m_base; std::function<TargetType(SourceType)> m_transform; public: TransformIterator(BaseIteratorType base, std::function<TargetType(SourceType)> transform) - : m_base(base), m_transform(transform) + : m_base(base), + m_transform(transform) { } @@ -20,7 +20,18 @@ class TransformIterator return *this; } - bool operator==(TransformIterator other) const { return m_base == other.m_base; } - bool operator!=(TransformIterator other) const { return !(m_base == other.m_base); } - TargetType operator*() { return m_transform(*m_base); } + bool operator==(TransformIterator other) const + { + return m_base == other.m_base; + } + + bool operator!=(TransformIterator other) const + { + return !(m_base == other.m_base); + } + + TargetType operator*() + { + return m_transform(*m_base); + } }; diff --git a/src/ZoneCode/Game/Common.h b/src/ZoneCode/Game/Common.h index dd9fe65f3..b9f554e62 100644 --- a/src/ZoneCode/Game/Common.h +++ b/src/ZoneCode/Game/Common.h @@ -6,23 +6,23 @@ // =========================================== // Windows Types -typedef unsigned long DWORD; -typedef int BOOL; -typedef unsigned char BYTE; -typedef unsigned short WORD; -typedef float FLOAT; +typedef unsigned long DWORD; +typedef int BOOL; +typedef unsigned char BYTE; +typedef unsigned short WORD; +typedef float FLOAT; namespace std { - typedef char int8_t; - typedef short int16_t; - typedef int int32_t; - typedef long long int64_t; - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; - typedef unsigned long long uint64_t; -} + typedef char int8_t; + typedef short int16_t; + typedef int int32_t; + typedef long long int64_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; + typedef unsigned long long uint64_t; +} // namespace std #define __int8 char #define __int16 short @@ -52,4 +52,4 @@ typedef void Texture; #define volatile #define __cppobj -// EOF \ No newline at end of file +// EOF diff --git a/src/ZoneCode/Game/IW3/IW3.h b/src/ZoneCode/Game/IW3/IW3.h index 98e6e4aff..8c2054a18 100644 --- a/src/ZoneCode/Game/IW3/IW3.h +++ b/src/ZoneCode/Game/IW3/IW3.h @@ -2,7 +2,7 @@ // Entry point for IW3 code generation -#include "../Common.h" #include "../../../Common/Game/IW3/IW3_Assets.h" +#include "../Common.h" -// EOF \ No newline at end of file +// EOF diff --git a/src/ZoneCode/Game/IW4/IW4.h b/src/ZoneCode/Game/IW4/IW4.h index da61db127..368ab5f2f 100644 --- a/src/ZoneCode/Game/IW4/IW4.h +++ b/src/ZoneCode/Game/IW4/IW4.h @@ -2,7 +2,7 @@ // Entry point for IW4 code generation -#include "../Common.h" #include "../../../Common/Game/IW4/IW4_Assets.h" +#include "../Common.h" -// EOF \ No newline at end of file +// EOF diff --git a/src/ZoneCode/Game/IW5/IW5.h b/src/ZoneCode/Game/IW5/IW5.h index 46fba6de1..621ba4d5e 100644 --- a/src/ZoneCode/Game/IW5/IW5.h +++ b/src/ZoneCode/Game/IW5/IW5.h @@ -2,7 +2,7 @@ // Entry point for IW5 code generation -#include "../Common.h" #include "../../../Common/Game/IW5/IW5_Assets.h" +#include "../Common.h" -// EOF \ No newline at end of file +// EOF diff --git a/src/ZoneCode/Game/T5/T5.h b/src/ZoneCode/Game/T5/T5.h index dfcd4342a..7803852c3 100644 --- a/src/ZoneCode/Game/T5/T5.h +++ b/src/ZoneCode/Game/T5/T5.h @@ -2,7 +2,7 @@ // Entry point for T5 code generation -#include "../Common.h" #include "../../../Common/Game/T5/T5_Assets.h" +#include "../Common.h" -// EOF \ No newline at end of file +// EOF diff --git a/src/ZoneCode/Game/T6/T6.h b/src/ZoneCode/Game/T6/T6.h index eca6b0c01..7cbce404e 100644 --- a/src/ZoneCode/Game/T6/T6.h +++ b/src/ZoneCode/Game/T6/T6.h @@ -2,7 +2,7 @@ // Entry point for T6 code generation -#include "../Common.h" #include "../../../Common/Game/T6/T6_Assets.h" +#include "../Common.h" -// EOF \ No newline at end of file +// EOF diff --git a/src/ZoneCodeGeneratorLib/Domain/Computations/MemberComputations.cpp b/src/ZoneCodeGeneratorLib/Domain/Computations/MemberComputations.cpp index 407ce18b7..501218f0e 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Computations/MemberComputations.cpp +++ b/src/ZoneCodeGeneratorLib/Domain/Computations/MemberComputations.cpp @@ -1,11 +1,11 @@ #include "MemberComputations.h" -#include <algorithm> -#include <cassert> - -#include "StructureComputations.h" #include "Domain/Definition/ArrayDeclarationModifier.h" #include "Domain/Definition/PointerDeclarationModifier.h" +#include "StructureComputations.h" + +#include <algorithm> +#include <cassert> MemberComputations::MemberComputations(const MemberInformation* member) : m_info(member) @@ -21,10 +21,12 @@ bool MemberComputations::ShouldIgnore() const bool MemberComputations::ContainsNonEmbeddedReference() const { const auto& declarationModifiers = m_info->m_member->m_type_declaration->m_declaration_modifiers; - return std::any_of(declarationModifiers.begin(), declarationModifiers.end(), [](const std::unique_ptr<DeclarationModifier>& modifier) - { - return modifier->GetType() == DeclarationModifierType::POINTER; - }); + return std::any_of(declarationModifiers.begin(), + declarationModifiers.end(), + [](const std::unique_ptr<DeclarationModifier>& modifier) + { + return modifier->GetType() == DeclarationModifierType::POINTER; + }); } bool MemberComputations::ContainsSinglePointerReference() const @@ -81,9 +83,8 @@ const IEvaluation* MemberComputations::GetArrayPointerCountEvaluation() const return nullptr; const auto* lastModifier = declarationModifiers[declarationModifiers.size() - 1].get(); - return lastModifier->GetType() == DeclarationModifierType::POINTER - ? dynamic_cast<const PointerDeclarationModifier*>(lastModifier)->GetCountEvaluation() - : nullptr; + return lastModifier->GetType() == DeclarationModifierType::POINTER ? dynamic_cast<const PointerDeclarationModifier*>(lastModifier)->GetCountEvaluation() + : nullptr; } bool MemberComputations::IsArray() const @@ -135,10 +136,12 @@ bool MemberComputations::IsPointerToArray() const if (lastModifier->GetType() != DeclarationModifierType::ARRAY) return false; - return std::any_of(declarationModifiers.begin(), declarationModifiers.end(), [](const std::unique_ptr<DeclarationModifier>& modifier) - { - return modifier->GetType() == DeclarationModifierType::POINTER; - }); + return std::any_of(declarationModifiers.begin(), + declarationModifiers.end(), + [](const std::unique_ptr<DeclarationModifier>& modifier) + { + return modifier->GetType() == DeclarationModifierType::POINTER; + }); } std::vector<int> MemberComputations::GetPointerToArraySizes() const @@ -164,7 +167,7 @@ int MemberComputations::GetPointerDepth() const { auto depth = 0; const auto& declarationModifiers = m_info->m_member->m_type_declaration->m_declaration_modifiers; - for(const auto& declarationModifier : declarationModifiers) + for (const auto& declarationModifier : declarationModifiers) { if (declarationModifier->GetType() == DeclarationModifierType::POINTER) depth++; @@ -204,11 +207,13 @@ bool MemberComputations::HasDynamicArraySize() const { const auto& declarationModifiers = m_info->m_member->m_type_declaration->m_declaration_modifiers; - return std::any_of(declarationModifiers.begin(), declarationModifiers.end(), [](const std::unique_ptr<DeclarationModifier>& declarationModifier) - { - return declarationModifier->GetType() == DeclarationModifierType::ARRAY - && dynamic_cast<ArrayDeclarationModifier*>(declarationModifier.get())->m_dynamic_size_evaluation; - }); + return std::any_of(declarationModifiers.begin(), + declarationModifiers.end(), + [](const std::unique_ptr<DeclarationModifier>& declarationModifier) + { + return declarationModifier->GetType() == DeclarationModifierType::ARRAY + && dynamic_cast<ArrayDeclarationModifier*>(declarationModifier.get())->m_dynamic_size_evaluation; + }); } bool MemberComputations::IsDynamicMember() const diff --git a/src/ZoneCodeGeneratorLib/Domain/Computations/MemberDeclarationModifierComputations.cpp b/src/ZoneCodeGeneratorLib/Domain/Computations/MemberDeclarationModifierComputations.cpp index 6699322bf..9f6954e92 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Computations/MemberDeclarationModifierComputations.cpp +++ b/src/ZoneCodeGeneratorLib/Domain/Computations/MemberDeclarationModifierComputations.cpp @@ -1,11 +1,11 @@ #include "MemberDeclarationModifierComputations.h" -#include <algorithm> -#include <cassert> - -#include "MemberComputations.h" #include "Domain/Definition/ArrayDeclarationModifier.h" #include "Domain/Definition/PointerDeclarationModifier.h" +#include "MemberComputations.h" + +#include <algorithm> +#include <cassert> DeclarationModifierComputations::DeclarationModifierComputations(const MemberInformation* member, std::vector<int> modifierIndices) : m_information(member), @@ -135,16 +135,17 @@ bool DeclarationModifierComputations::IsSinglePointer() const { auto* declarationModifier = GetDeclarationModifier(); - if (declarationModifier != nullptr - && declarationModifier->GetType() == DeclarationModifierType::POINTER + if (declarationModifier != nullptr && declarationModifier->GetType() == DeclarationModifierType::POINTER && !dynamic_cast<PointerDeclarationModifier*>(declarationModifier)->CountEvaluationIsArray(m_combined_index)) { const auto following = GetFollowingDeclarationModifiers(); - return !std::any_of(following.begin(), following.end(), [](const DeclarationModifier* modifier) - { - return modifier->GetType() == DeclarationModifierType::POINTER; - }); + return !std::any_of(following.begin(), + following.end(), + [](const DeclarationModifier* modifier) + { + return modifier->GetType() == DeclarationModifierType::POINTER; + }); } return false; @@ -154,16 +155,17 @@ bool DeclarationModifierComputations::IsArrayPointer() const { auto* declarationModifier = GetDeclarationModifier(); - if (declarationModifier != nullptr - && declarationModifier->GetType() == DeclarationModifierType::POINTER + if (declarationModifier != nullptr && declarationModifier->GetType() == DeclarationModifierType::POINTER && dynamic_cast<PointerDeclarationModifier*>(declarationModifier)->CountEvaluationIsArray(m_combined_index)) { const auto following = GetFollowingDeclarationModifiers(); - return !std::any_of(following.begin(), following.end(), [](const DeclarationModifier* modifier) - { - return modifier->GetType() == DeclarationModifierType::POINTER; - }); + return !std::any_of(following.begin(), + following.end(), + [](const DeclarationModifier* modifier) + { + return modifier->GetType() == DeclarationModifierType::POINTER; + }); } return false; @@ -189,14 +191,14 @@ bool DeclarationModifierComputations::IsPointerArray() const return false; const auto thisDeclModIsArray = declarationModifier->GetType() == DeclarationModifierType::POINTER - && dynamic_cast<PointerDeclarationModifier*>(declarationModifier)->CountEvaluationIsArray(m_combined_index) - || declarationModifier->GetType() == DeclarationModifierType::ARRAY; + && dynamic_cast<PointerDeclarationModifier*>(declarationModifier)->CountEvaluationIsArray(m_combined_index) + || declarationModifier->GetType() == DeclarationModifierType::ARRAY; if (!thisDeclModIsArray) return false; const auto nextDeclModIsSinglePointer = nextDeclarationModifier->GetType() == DeclarationModifierType::POINTER - && !dynamic_cast<PointerDeclarationModifier*>(nextDeclarationModifier)->AnyCountEvaluationIsArray(); + && !dynamic_cast<PointerDeclarationModifier*>(nextDeclarationModifier)->AnyCountEvaluationIsArray(); return nextDeclModIsSinglePointer; } @@ -229,14 +231,13 @@ bool DeclarationModifierComputations::IsDynamicArray() const return false; return declarationModifier->GetType() == DeclarationModifierType::ARRAY - && dynamic_cast<ArrayDeclarationModifier*>(declarationModifier)->m_dynamic_size_evaluation != nullptr; + && dynamic_cast<ArrayDeclarationModifier*>(declarationModifier)->m_dynamic_size_evaluation != nullptr; } const IEvaluation* DeclarationModifierComputations::GetDynamicArraySizeEvaluation() const { auto* declarationModifier = GetDeclarationModifier(); - if (declarationModifier == nullptr - || declarationModifier->GetType() != DeclarationModifierType::ARRAY) + if (declarationModifier == nullptr || declarationModifier->GetType() != DeclarationModifierType::ARRAY) return nullptr; return dynamic_cast<ArrayDeclarationModifier*>(declarationModifier)->m_dynamic_size_evaluation.get(); @@ -246,8 +247,12 @@ unsigned DeclarationModifierComputations::GetAlignment() const { const auto following = GetFollowingDeclarationModifiers(); - return std::any_of(following.begin(), following.end(), [](const DeclarationModifier* modifier) - { - return modifier->GetType() == DeclarationModifierType::POINTER; - }) ? m_information->m_member->GetAlignment() : m_information->m_member->m_type_declaration->m_type->GetAlignment(); + return std::any_of(following.begin(), + following.end(), + [](const DeclarationModifier* modifier) + { + return modifier->GetType() == DeclarationModifierType::POINTER; + }) + ? m_information->m_member->GetAlignment() + : m_information->m_member->m_type_declaration->m_type->GetAlignment(); } diff --git a/src/ZoneCodeGeneratorLib/Domain/Computations/MemberDeclarationModifierComputations.h b/src/ZoneCodeGeneratorLib/Domain/Computations/MemberDeclarationModifierComputations.h index 490697d36..17e155328 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Computations/MemberDeclarationModifierComputations.h +++ b/src/ZoneCodeGeneratorLib/Domain/Computations/MemberDeclarationModifierComputations.h @@ -1,8 +1,8 @@ #pragma once -#include "Utils/ClassUtils.h" -#include "Domain/Information/MemberInformation.h" #include "Domain/Evaluation/IEvaluation.h" +#include "Domain/Information/MemberInformation.h" +#include "Utils/ClassUtils.h" class DeclarationModifierComputations { diff --git a/src/ZoneCodeGeneratorLib/Domain/Computations/StructureComputations.cpp b/src/ZoneCodeGeneratorLib/Domain/Computations/StructureComputations.cpp index a6badb0ef..60dae0118 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Computations/StructureComputations.cpp +++ b/src/ZoneCodeGeneratorLib/Domain/Computations/StructureComputations.cpp @@ -1,9 +1,9 @@ #include "StructureComputations.h" -#include <cassert> - #include "MemberComputations.h" +#include <cassert> + StructureComputations::StructureComputations(const StructureInformation* structure) : m_info(structure) { @@ -48,4 +48,4 @@ std::vector<MemberInformation*> StructureComputations::GetUsedMembers() const } return members; -} \ No newline at end of file +} diff --git a/src/ZoneCodeGeneratorLib/Domain/Definition/ArrayDeclarationModifier.h b/src/ZoneCodeGeneratorLib/Domain/Definition/ArrayDeclarationModifier.h index 713e0c0e4..152ffc877 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Definition/ArrayDeclarationModifier.h +++ b/src/ZoneCodeGeneratorLib/Domain/Definition/ArrayDeclarationModifier.h @@ -1,10 +1,10 @@ #pragma once -#include <memory> - -#include "Utils/ClassUtils.h" #include "DeclarationModifier.h" #include "Domain/Evaluation/IEvaluation.h" +#include "Utils/ClassUtils.h" + +#include <memory> class ArrayDeclarationModifier final : public DeclarationModifier { diff --git a/src/ZoneCodeGeneratorLib/Domain/Definition/BaseTypeDefinition.cpp b/src/ZoneCodeGeneratorLib/Domain/Definition/BaseTypeDefinition.cpp index 47716c050..4293b8030 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Definition/BaseTypeDefinition.cpp +++ b/src/ZoneCodeGeneratorLib/Domain/Definition/BaseTypeDefinition.cpp @@ -42,21 +42,6 @@ const BaseTypeDefinition* const BaseTypeDefinition::UNSIGNED_LONG = new BaseType const BaseTypeDefinition* const BaseTypeDefinition::LONG_LONG = new BaseTypeDefinition("long long", 8); const BaseTypeDefinition* const BaseTypeDefinition::UNSIGNED_LONG_LONG = new BaseTypeDefinition("unsigned long long", 8); const BaseTypeDefinition* const BaseTypeDefinition::VOID = new BaseTypeDefinition("void", 0); -const BaseTypeDefinition* const BaseTypeDefinition::ALL_BASE_TYPES[] -{ - FLOAT, - DOUBLE, - BOOL, - CHAR, - UNSIGNED_CHAR, - SHORT, - UNSIGNED_SHORT, - INT, - UNSIGNED_INT, - LONG, - UNSIGNED_LONG, - LONG_LONG, - UNSIGNED_LONG_LONG, - VOID -}; -const size_t BaseTypeDefinition::ALL_BASE_TYPES_COUNT = std::extent<decltype(ALL_BASE_TYPES)>::value; \ No newline at end of file +const BaseTypeDefinition* const BaseTypeDefinition::ALL_BASE_TYPES[]{ + FLOAT, DOUBLE, BOOL, CHAR, UNSIGNED_CHAR, SHORT, UNSIGNED_SHORT, INT, UNSIGNED_INT, LONG, UNSIGNED_LONG, LONG_LONG, UNSIGNED_LONG_LONG, VOID}; +const size_t BaseTypeDefinition::ALL_BASE_TYPES_COUNT = std::extent<decltype(ALL_BASE_TYPES)>::value; diff --git a/src/ZoneCodeGeneratorLib/Domain/Definition/DataDefinition.cpp b/src/ZoneCodeGeneratorLib/Domain/Definition/DataDefinition.cpp index ac097f336..cb79c4cd1 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Definition/DataDefinition.cpp +++ b/src/ZoneCodeGeneratorLib/Domain/Definition/DataDefinition.cpp @@ -1,11 +1,10 @@ #include "DataDefinition.h" +#include "Utils/NamespaceBuilder.h" #include <cassert> #include <sstream> -#include "Utils/NamespaceBuilder.h" - DataDefinition::DataDefinition(std::string _namespace, std::string name) : m_namespace(std::move(_namespace)), m_name(std::move(name)) diff --git a/src/ZoneCodeGeneratorLib/Domain/Definition/DataDefinition.h b/src/ZoneCodeGeneratorLib/Domain/Definition/DataDefinition.h index c3e0ba903..3b6134145 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Definition/DataDefinition.h +++ b/src/ZoneCodeGeneratorLib/Domain/Definition/DataDefinition.h @@ -1,8 +1,8 @@ #pragma once -#include <string> - #include "Utils/ClassUtils.h" +#include <string> + enum class DataDefinitionType { STRUCT, @@ -27,7 +27,7 @@ class DataDefinition std::string m_namespace; std::string m_name; - + _NODISCARD virtual DataDefinitionType GetType() const = 0; _NODISCARD virtual unsigned GetAlignment() const = 0; _NODISCARD virtual bool GetForceAlignment() const = 0; diff --git a/src/ZoneCodeGeneratorLib/Domain/Definition/DeclarationModifier.h b/src/ZoneCodeGeneratorLib/Domain/Definition/DeclarationModifier.h index f34dda33a..13abdb35e 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Definition/DeclarationModifier.h +++ b/src/ZoneCodeGeneratorLib/Domain/Definition/DeclarationModifier.h @@ -19,4 +19,4 @@ class DeclarationModifier DeclarationModifier& operator=(DeclarationModifier&& other) noexcept = default; _NODISCARD virtual DeclarationModifierType GetType() const = 0; -}; \ No newline at end of file +}; diff --git a/src/ZoneCodeGeneratorLib/Domain/Definition/DefinitionWithMembers.cpp b/src/ZoneCodeGeneratorLib/Domain/Definition/DefinitionWithMembers.cpp index dade3c986..9a1f10418 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Definition/DefinitionWithMembers.cpp +++ b/src/ZoneCodeGeneratorLib/Domain/Definition/DefinitionWithMembers.cpp @@ -14,25 +14,25 @@ DefinitionWithMembers::DefinitionWithMembers(std::string _namespace, std::string { } -//void DefinitionWithMembers::CalculateAlignment() +// void DefinitionWithMembers::CalculateAlignment() //{ -// if (m_has_alignment_override) -// { -// m_flags |= FLAG_ALIGNMENT_FORCED; -// m_alignment = m_alignment_override; -// } -// else -// { -// m_alignment = 0; -// for (const auto& member : m_members) -// { -// const auto memberAlignment = member->GetAlignment(); -// if (memberAlignment > m_alignment) -// m_alignment = memberAlignment; -// } -// } -// m_flags |= FLAG_ALIGNMENT_CALCULATED; -//} +// if (m_has_alignment_override) +// { +// m_flags |= FLAG_ALIGNMENT_FORCED; +// m_alignment = m_alignment_override; +// } +// else +// { +// m_alignment = 0; +// for (const auto& member : m_members) +// { +// const auto memberAlignment = member->GetAlignment(); +// if (memberAlignment > m_alignment) +// m_alignment = memberAlignment; +// } +// } +// m_flags |= FLAG_ALIGNMENT_CALCULATED; +// } unsigned DefinitionWithMembers::GetAlignment() const { diff --git a/src/ZoneCodeGeneratorLib/Domain/Definition/DefinitionWithMembers.h b/src/ZoneCodeGeneratorLib/Domain/Definition/DefinitionWithMembers.h index 658a25a74..8e2e5837e 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Definition/DefinitionWithMembers.h +++ b/src/ZoneCodeGeneratorLib/Domain/Definition/DefinitionWithMembers.h @@ -1,11 +1,11 @@ #pragma once -#include <memory> -#include <vector> - #include "DataDefinition.h" #include "Variable.h" +#include <memory> +#include <vector> + class DefinitionWithMembers : public DataDefinition { public: @@ -30,4 +30,4 @@ class DefinitionWithMembers : public DataDefinition _NODISCARD unsigned GetAlignment() const override; _NODISCARD bool GetForceAlignment() const override; _NODISCARD unsigned GetSize() const override; -}; \ No newline at end of file +}; diff --git a/src/ZoneCodeGeneratorLib/Domain/Definition/EnumDefinition.h b/src/ZoneCodeGeneratorLib/Domain/Definition/EnumDefinition.h index f7104a106..6dbb08038 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Definition/EnumDefinition.h +++ b/src/ZoneCodeGeneratorLib/Domain/Definition/EnumDefinition.h @@ -1,12 +1,12 @@ #pragma once -#include <memory> -#include <vector> - #include "BaseTypeDefinition.h" #include "DataDefinition.h" #include "EnumMember.h" +#include <memory> +#include <vector> + class EnumDefinition final : public DataDefinition { public: diff --git a/src/ZoneCodeGeneratorLib/Domain/Definition/EnumMember.h b/src/ZoneCodeGeneratorLib/Domain/Definition/EnumMember.h index d7336e5ee..a11ea3929 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Definition/EnumMember.h +++ b/src/ZoneCodeGeneratorLib/Domain/Definition/EnumMember.h @@ -10,4 +10,4 @@ class EnumMember EnumMember(); EnumMember(std::string name, int value); -}; \ No newline at end of file +}; diff --git a/src/ZoneCodeGeneratorLib/Domain/Definition/PointerDeclarationModifier.cpp b/src/ZoneCodeGeneratorLib/Domain/Definition/PointerDeclarationModifier.cpp index 44f1a1d20..299cff61d 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Definition/PointerDeclarationModifier.cpp +++ b/src/ZoneCodeGeneratorLib/Domain/Definition/PointerDeclarationModifier.cpp @@ -49,7 +49,7 @@ bool PointerDeclarationModifier::CountEvaluationIsArray() const bool PointerDeclarationModifier::CountEvaluationIsArray(const int index) const { - if(index >= 0 && m_count_evaluation_by_array_index.size() > static_cast<unsigned>(index)) + if (index >= 0 && m_count_evaluation_by_array_index.size() > static_cast<unsigned>(index)) { return EvaluationIsArray(m_count_evaluation_by_array_index[index].get()); } @@ -62,7 +62,7 @@ bool PointerDeclarationModifier::AnyCountEvaluationIsArray() const if (m_count_evaluation && EvaluationIsArray(m_count_evaluation.get())) return true; - for(const auto& arrayCountEvaluation : m_count_evaluation_by_array_index) + for (const auto& arrayCountEvaluation : m_count_evaluation_by_array_index) { if (EvaluationIsArray(arrayCountEvaluation.get())) return true; diff --git a/src/ZoneCodeGeneratorLib/Domain/Definition/PointerDeclarationModifier.h b/src/ZoneCodeGeneratorLib/Domain/Definition/PointerDeclarationModifier.h index 06e60fa05..b2dc8905e 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Definition/PointerDeclarationModifier.h +++ b/src/ZoneCodeGeneratorLib/Domain/Definition/PointerDeclarationModifier.h @@ -1,11 +1,11 @@ #pragma once -#include <memory> -#include <vector> - #include "DeclarationModifier.h" #include "Domain/Evaluation/IEvaluation.h" +#include <memory> +#include <vector> + class PointerDeclarationModifier final : public DeclarationModifier { static const IEvaluation* const DEFAULT_COUNT; diff --git a/src/ZoneCodeGeneratorLib/Domain/Definition/TypeDeclaration.cpp b/src/ZoneCodeGeneratorLib/Domain/Definition/TypeDeclaration.cpp index 20243f169..7b5cafe2a 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Definition/TypeDeclaration.cpp +++ b/src/ZoneCodeGeneratorLib/Domain/Definition/TypeDeclaration.cpp @@ -1,9 +1,9 @@ #include "TypeDeclaration.h" -#include <cassert> - #include "ArrayDeclarationModifier.h" +#include <cassert> + TypeDeclaration::TypeDeclaration(const DataDefinition* type) : m_flags(0), m_size(0), diff --git a/src/ZoneCodeGeneratorLib/Domain/Definition/TypeDeclaration.h b/src/ZoneCodeGeneratorLib/Domain/Definition/TypeDeclaration.h index 1d2b541f8..157ae1645 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Definition/TypeDeclaration.h +++ b/src/ZoneCodeGeneratorLib/Domain/Definition/TypeDeclaration.h @@ -1,11 +1,11 @@ #pragma once -#include <memory> -#include <vector> - -#include "Utils/ClassUtils.h" #include "DataDefinition.h" #include "DeclarationModifier.h" +#include "Utils/ClassUtils.h" + +#include <memory> +#include <vector> class TypeDeclaration { diff --git a/src/ZoneCodeGeneratorLib/Domain/Definition/UnionDefinition.h b/src/ZoneCodeGeneratorLib/Domain/Definition/UnionDefinition.h index e841ad79c..a3181c445 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Definition/UnionDefinition.h +++ b/src/ZoneCodeGeneratorLib/Domain/Definition/UnionDefinition.h @@ -4,8 +4,8 @@ class UnionDefinition final : public DefinitionWithMembers { -//protected: -// void CalculateSize() override; + // protected: + // void CalculateSize() override; public: UnionDefinition(std::string _namespace, std::string name, int pack); diff --git a/src/ZoneCodeGeneratorLib/Domain/Definition/Variable.h b/src/ZoneCodeGeneratorLib/Domain/Definition/Variable.h index 77af2df30..853b06a60 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Definition/Variable.h +++ b/src/ZoneCodeGeneratorLib/Domain/Definition/Variable.h @@ -1,11 +1,11 @@ #pragma once +#include "TypeDeclaration.h" +#include "Utils/ClassUtils.h" + #include <memory> #include <string> -#include "Utils/ClassUtils.h" -#include "TypeDeclaration.h" - class Variable { public: diff --git a/src/ZoneCodeGeneratorLib/Domain/Environment/Architecture.h b/src/ZoneCodeGeneratorLib/Domain/Environment/Architecture.h index 0748fbfbc..b9bfc8a19 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Environment/Architecture.h +++ b/src/ZoneCodeGeneratorLib/Domain/Environment/Architecture.h @@ -5,4 +5,4 @@ enum class Architecture UNKNOWN, X86, X64 -}; \ No newline at end of file +}; diff --git a/src/ZoneCodeGeneratorLib/Domain/Evaluation/IEvaluation.h b/src/ZoneCodeGeneratorLib/Domain/Evaluation/IEvaluation.h index 5cd0ceb2d..cd394730d 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Evaluation/IEvaluation.h +++ b/src/ZoneCodeGeneratorLib/Domain/Evaluation/IEvaluation.h @@ -23,4 +23,4 @@ class IEvaluation _NODISCARD virtual EvaluationType GetType() const = 0; _NODISCARD virtual bool IsStatic() const = 0; _NODISCARD virtual int EvaluateNumeric() const = 0; -}; \ No newline at end of file +}; diff --git a/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperandDynamic.cpp b/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperandDynamic.cpp index 0a2817351..045898dfd 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperandDynamic.cpp +++ b/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperandDynamic.cpp @@ -7,7 +7,9 @@ OperandDynamic::OperandDynamic(StructureInformation* structure) { } -OperandDynamic::OperandDynamic(StructureInformation* structure, std::vector<MemberInformation*> referencedMemberChain, std::vector<std::unique_ptr<IEvaluation>> arrayIndices) +OperandDynamic::OperandDynamic(StructureInformation* structure, + std::vector<MemberInformation*> referencedMemberChain, + std::vector<std::unique_ptr<IEvaluation>> arrayIndices) : m_structure(structure), m_referenced_member_chain(std::move(referencedMemberChain)), m_array_indices(std::move(arrayIndices)) diff --git a/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperandDynamic.h b/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperandDynamic.h index 0ebf3b0db..96bd8c4aa 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperandDynamic.h +++ b/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperandDynamic.h @@ -1,10 +1,10 @@ #pragma once -#include <memory> -#include <vector> - -#include "IEvaluation.h" #include "Domain/Information/MemberInformation.h" #include "Domain/Information/StructureInformation.h" +#include "IEvaluation.h" + +#include <memory> +#include <vector> class OperandDynamic final : public IEvaluation { @@ -14,7 +14,9 @@ class OperandDynamic final : public IEvaluation std::vector<std::unique_ptr<IEvaluation>> m_array_indices; explicit OperandDynamic(StructureInformation* structure); - OperandDynamic(StructureInformation* structure, std::vector<MemberInformation*> referencedMemberChain, std::vector<std::unique_ptr<IEvaluation>> arrayIndices); + OperandDynamic(StructureInformation* structure, + std::vector<MemberInformation*> referencedMemberChain, + std::vector<std::unique_ptr<IEvaluation>> arrayIndices); _NODISCARD EvaluationType GetType() const override; _NODISCARD bool IsStatic() const override; diff --git a/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperandStatic.h b/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperandStatic.h index 7ea1150f9..9d1b67706 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperandStatic.h +++ b/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperandStatic.h @@ -1,7 +1,7 @@ #pragma once -#include "IEvaluation.h" #include "Domain/Definition/EnumMember.h" +#include "IEvaluation.h" class OperandStatic final : public IEvaluation { diff --git a/src/ZoneCodeGeneratorLib/Domain/Evaluation/Operation.cpp b/src/ZoneCodeGeneratorLib/Domain/Evaluation/Operation.cpp index e1cfc07c4..e107f9267 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Evaluation/Operation.cpp +++ b/src/ZoneCodeGeneratorLib/Domain/Evaluation/Operation.cpp @@ -30,11 +30,11 @@ int Operation::EvaluateNumeric() const bool Operation::Operand1NeedsParenthesis() const { return m_operand1->GetType() == EvaluationType::OPERATION - && dynamic_cast<Operation*>(m_operand1.get())->m_operation_type->m_precedence > m_operation_type->m_precedence; + && dynamic_cast<Operation*>(m_operand1.get())->m_operation_type->m_precedence > m_operation_type->m_precedence; } bool Operation::Operand2NeedsParenthesis() const { return m_operand2->GetType() == EvaluationType::OPERATION - && dynamic_cast<Operation*>(m_operand2.get())->m_operation_type->m_precedence >= m_operation_type->m_precedence; + && dynamic_cast<Operation*>(m_operand2.get())->m_operation_type->m_precedence >= m_operation_type->m_precedence; } diff --git a/src/ZoneCodeGeneratorLib/Domain/Evaluation/Operation.h b/src/ZoneCodeGeneratorLib/Domain/Evaluation/Operation.h index 6ff78d2a3..c428517db 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Evaluation/Operation.h +++ b/src/ZoneCodeGeneratorLib/Domain/Evaluation/Operation.h @@ -1,10 +1,10 @@ #pragma once -#include <memory> - -#include "Utils/ClassUtils.h" #include "IEvaluation.h" #include "OperationType.h" +#include "Utils/ClassUtils.h" + +#include <memory> class Operation final : public IEvaluation { diff --git a/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperationType.cpp b/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperationType.cpp index 3615f0d14..baa482891 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperationType.cpp +++ b/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperationType.cpp @@ -7,133 +7,147 @@ OperationType::OperationType(std::string syntax, const OperationPrecedence prece { } -const OperationType* const OperationType::OPERATION_ADD - = new OperationType("+", OperationPrecedence::ADDITION_SUBTRACTION, [](auto op1, auto op2) - { - return op1 + op2; - }); - -const OperationType* const OperationType::OPERATION_SUBTRACT - = new OperationType("-", OperationPrecedence::ADDITION_SUBTRACTION, [](auto op1, auto op2) - { - return op1 - op2; - }); - -const OperationType* const OperationType::OPERATION_MULTIPLY - = new OperationType("*", OperationPrecedence::MULTIPLICATION_DIVISION_REMAINDER, [](auto op1, auto op2) - { - return op1 * op2; - }); - -const OperationType* const OperationType::OPERATION_DIVIDE - = new OperationType("/", OperationPrecedence::MULTIPLICATION_DIVISION_REMAINDER, [](auto op1, auto op2) - { - return op1 / op2; - }); - -const OperationType* const OperationType::OPERATION_REMAINDER - = new OperationType("%", OperationPrecedence::MULTIPLICATION_DIVISION_REMAINDER, [](auto op1, auto op2) - { - return op1 % op2; - }); - -const OperationType* const OperationType::OPERATION_BITWISE_AND - = new OperationType("&", OperationPrecedence::BITWISE_AND, [](auto op1, auto op2) - { - return op1 & op2; - }); - -const OperationType* const OperationType::OPERATION_BITWISE_XOR - = new OperationType("^", OperationPrecedence::BITWISE_XOR, [](auto op1, auto op2) - { - return op1 ^ op2; - }); - -const OperationType* const OperationType::OPERATION_BITWISE_OR - = new OperationType("|", OperationPrecedence::BITWISE_OR, [](auto op1, auto op2) - { - return op1 | op2; - }); - -const OperationType* const OperationType::OPERATION_SHIFT_LEFT - = new OperationType("<<", OperationPrecedence::BITWISE_SHIFT, [](auto op1, auto op2) - { - return op1 << op2; - }); - -const OperationType* const OperationType::OPERATION_SHIFT_RIGHT - = new OperationType(">>", OperationPrecedence::BITWISE_SHIFT, [](auto op1, auto op2) - { - return op1 >> op2; - }); - -const OperationType* const OperationType::OPERATION_GREATER_THAN - = new OperationType(">", OperationPrecedence::RELATIONAL_GREATER_LESS_THAN, [](auto op1, auto op2) - { - return op1 > op2 ? 1 : 0; - }); - -const OperationType* const OperationType::OPERATION_GREATER_EQUAL_THAN - = new OperationType(">=", OperationPrecedence::RELATIONAL_GREATER_LESS_THAN, [](auto op1, auto op2) - { - return op1 >= op2 ? 1 : 0; - }); - -const OperationType* const OperationType::OPERATION_LESS_THAN - = new OperationType("<", OperationPrecedence::RELATIONAL_GREATER_LESS_THAN, [](auto op1, auto op2) - { - return op1 < op2 ? 1 : 0; - }); - -const OperationType* const OperationType::OPERATION_LESS_EQUAL_THAN - = new OperationType("<=", OperationPrecedence::RELATIONAL_GREATER_LESS_THAN, [](auto op1, auto op2) - { - return op1 <= op2 ? 1 : 0; - }); - -const OperationType* const OperationType::OPERATION_EQUALS - = new OperationType("==", OperationPrecedence::RELATIONAL_EQUALS, [](auto op1, auto op2) - { - return op1 == op2 ? 1 : 0; - }); - -const OperationType* const OperationType::OPERATION_NOT_EQUAL - = new OperationType("!=", OperationPrecedence::RELATIONAL_EQUALS, [](auto op1, auto op2) - { - return op1 != op2 ? 1 : 0; - }); - -const OperationType* const OperationType::OPERATION_AND - = new OperationType("&&", OperationPrecedence::LOGICAL_AND, [](auto op1, auto op2) - { - return op1 > 0 && op2 > 0 ? 1 : 0; - }); - -const OperationType* const OperationType::OPERATION_OR - = new OperationType("||", OperationPrecedence::LOGICAL_OR, [](auto op1, auto op2) - { - return op1 > 0 || op2 > 0 ? 1 : 0; - }); - - -const OperationType* const OperationType::ALL_OPERATION_TYPES[] -{ - OPERATION_ADD, - OPERATION_SUBTRACT, - OPERATION_MULTIPLY, - OPERATION_DIVIDE, - OPERATION_REMAINDER, - OPERATION_BITWISE_AND, - OPERATION_BITWISE_XOR, - OPERATION_BITWISE_OR, - OPERATION_SHIFT_LEFT, - OPERATION_SHIFT_RIGHT, - OPERATION_GREATER_THAN, - OPERATION_GREATER_EQUAL_THAN, - OPERATION_LESS_THAN, - OPERATION_LESS_EQUAL_THAN, - OPERATION_EQUALS, - OPERATION_NOT_EQUAL, - OPERATION_AND, - OPERATION_OR -}; +const OperationType* const OperationType::OPERATION_ADD = new OperationType("+", + OperationPrecedence::ADDITION_SUBTRACTION, + [](auto op1, auto op2) + { + return op1 + op2; + }); + +const OperationType* const OperationType::OPERATION_SUBTRACT = new OperationType("-", + OperationPrecedence::ADDITION_SUBTRACTION, + [](auto op1, auto op2) + { + return op1 - op2; + }); + +const OperationType* const OperationType::OPERATION_MULTIPLY = new OperationType("*", + OperationPrecedence::MULTIPLICATION_DIVISION_REMAINDER, + [](auto op1, auto op2) + { + return op1 * op2; + }); + +const OperationType* const OperationType::OPERATION_DIVIDE = new OperationType("/", + OperationPrecedence::MULTIPLICATION_DIVISION_REMAINDER, + [](auto op1, auto op2) + { + return op1 / op2; + }); + +const OperationType* const OperationType::OPERATION_REMAINDER = new OperationType("%", + OperationPrecedence::MULTIPLICATION_DIVISION_REMAINDER, + [](auto op1, auto op2) + { + return op1 % op2; + }); + +const OperationType* const OperationType::OPERATION_BITWISE_AND = new OperationType("&", + OperationPrecedence::BITWISE_AND, + [](auto op1, auto op2) + { + return op1 & op2; + }); + +const OperationType* const OperationType::OPERATION_BITWISE_XOR = new OperationType("^", + OperationPrecedence::BITWISE_XOR, + [](auto op1, auto op2) + { + return op1 ^ op2; + }); + +const OperationType* const OperationType::OPERATION_BITWISE_OR = new OperationType("|", + OperationPrecedence::BITWISE_OR, + [](auto op1, auto op2) + { + return op1 | op2; + }); + +const OperationType* const OperationType::OPERATION_SHIFT_LEFT = new OperationType("<<", + OperationPrecedence::BITWISE_SHIFT, + [](auto op1, auto op2) + { + return op1 << op2; + }); + +const OperationType* const OperationType::OPERATION_SHIFT_RIGHT = new OperationType(">>", + OperationPrecedence::BITWISE_SHIFT, + [](auto op1, auto op2) + { + return op1 >> op2; + }); + +const OperationType* const OperationType::OPERATION_GREATER_THAN = new OperationType(">", + OperationPrecedence::RELATIONAL_GREATER_LESS_THAN, + [](auto op1, auto op2) + { + return op1 > op2 ? 1 : 0; + }); + +const OperationType* const OperationType::OPERATION_GREATER_EQUAL_THAN = new OperationType(">=", + OperationPrecedence::RELATIONAL_GREATER_LESS_THAN, + [](auto op1, auto op2) + { + return op1 >= op2 ? 1 : 0; + }); + +const OperationType* const OperationType::OPERATION_LESS_THAN = new OperationType("<", + OperationPrecedence::RELATIONAL_GREATER_LESS_THAN, + [](auto op1, auto op2) + { + return op1 < op2 ? 1 : 0; + }); + +const OperationType* const OperationType::OPERATION_LESS_EQUAL_THAN = new OperationType("<=", + OperationPrecedence::RELATIONAL_GREATER_LESS_THAN, + [](auto op1, auto op2) + { + return op1 <= op2 ? 1 : 0; + }); + +const OperationType* const OperationType::OPERATION_EQUALS = new OperationType("==", + OperationPrecedence::RELATIONAL_EQUALS, + [](auto op1, auto op2) + { + return op1 == op2 ? 1 : 0; + }); + +const OperationType* const OperationType::OPERATION_NOT_EQUAL = new OperationType("!=", + OperationPrecedence::RELATIONAL_EQUALS, + [](auto op1, auto op2) + { + return op1 != op2 ? 1 : 0; + }); + +const OperationType* const OperationType::OPERATION_AND = new OperationType("&&", + OperationPrecedence::LOGICAL_AND, + [](auto op1, auto op2) + { + return op1 > 0 && op2 > 0 ? 1 : 0; + }); + +const OperationType* const OperationType::OPERATION_OR = new OperationType("||", + OperationPrecedence::LOGICAL_OR, + [](auto op1, auto op2) + { + return op1 > 0 || op2 > 0 ? 1 : 0; + }); + +const OperationType* const OperationType::ALL_OPERATION_TYPES[]{OPERATION_ADD, + OPERATION_SUBTRACT, + OPERATION_MULTIPLY, + OPERATION_DIVIDE, + OPERATION_REMAINDER, + OPERATION_BITWISE_AND, + OPERATION_BITWISE_XOR, + OPERATION_BITWISE_OR, + OPERATION_SHIFT_LEFT, + OPERATION_SHIFT_RIGHT, + OPERATION_GREATER_THAN, + OPERATION_GREATER_EQUAL_THAN, + OPERATION_LESS_THAN, + OPERATION_LESS_EQUAL_THAN, + OPERATION_EQUALS, + OPERATION_NOT_EQUAL, + OPERATION_AND, + OPERATION_OR}; diff --git a/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperationType.h b/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperationType.h index f33cf3cca..30a2b33e8 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperationType.h +++ b/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperationType.h @@ -49,4 +49,4 @@ class OperationType static const OperationType* const OPERATION_OR; static const OperationType* const ALL_OPERATION_TYPES[]; -}; \ No newline at end of file +}; diff --git a/src/ZoneCodeGeneratorLib/Domain/Extension/CustomAction.h b/src/ZoneCodeGeneratorLib/Domain/Extension/CustomAction.h index b5fa5d791..5710eb6e9 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Extension/CustomAction.h +++ b/src/ZoneCodeGeneratorLib/Domain/Extension/CustomAction.h @@ -1,10 +1,10 @@ #pragma once +#include "Domain/Definition/DataDefinition.h" + #include <string> #include <vector> -#include "Domain/Definition/DataDefinition.h" - class CustomAction { public: diff --git a/src/ZoneCodeGeneratorLib/Domain/FastFile/FastFileBlock.h b/src/ZoneCodeGeneratorLib/Domain/FastFile/FastFileBlock.h index 11a9c6b06..10005f70d 100644 --- a/src/ZoneCodeGeneratorLib/Domain/FastFile/FastFileBlock.h +++ b/src/ZoneCodeGeneratorLib/Domain/FastFile/FastFileBlock.h @@ -19,4 +19,4 @@ class FastFileBlock bool m_is_default; FastFileBlock(std::string name, unsigned index, FastFileBlockType type, bool isDefault); -}; \ No newline at end of file +}; diff --git a/src/ZoneCodeGeneratorLib/Domain/Information/MemberInformation.h b/src/ZoneCodeGeneratorLib/Domain/Information/MemberInformation.h index 857291ae7..1c93235a8 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Information/MemberInformation.h +++ b/src/ZoneCodeGeneratorLib/Domain/Information/MemberInformation.h @@ -1,14 +1,15 @@ #pragma once -#include <memory> - -#include "Utils/ClassUtils.h" -#include "StructureInformation.h" #include "Domain/Definition/Variable.h" -#include "Domain/FastFile/FastFileBlock.h" #include "Domain/Evaluation/IEvaluation.h" +#include "Domain/FastFile/FastFileBlock.h" +#include "StructureInformation.h" +#include "Utils/ClassUtils.h" + +#include <memory> class StructureInformation; + class MemberInformation { public: diff --git a/src/ZoneCodeGeneratorLib/Domain/Information/StructureInformation.h b/src/ZoneCodeGeneratorLib/Domain/Information/StructureInformation.h index 29c19e988..cc82aebaf 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Information/StructureInformation.h +++ b/src/ZoneCodeGeneratorLib/Domain/Information/StructureInformation.h @@ -1,13 +1,14 @@ #pragma once -#include "Utils/ClassUtils.h" -#include "MemberInformation.h" #include "Domain/Definition/DefinitionWithMembers.h" #include "Domain/Definition/EnumMember.h" #include "Domain/Extension/CustomAction.h" #include "Domain/FastFile/FastFileBlock.h" +#include "MemberInformation.h" +#include "Utils/ClassUtils.h" class MemberInformation; + class StructureInformation { public: diff --git a/src/ZoneCodeGeneratorLib/Generating/CodeGenerator.cpp b/src/ZoneCodeGeneratorLib/Generating/CodeGenerator.cpp index 41b766f67..575aa631b 100644 --- a/src/ZoneCodeGeneratorLib/Generating/CodeGenerator.cpp +++ b/src/ZoneCodeGeneratorLib/Generating/CodeGenerator.cpp @@ -1,14 +1,14 @@ #include "CodeGenerator.h" -#include <filesystem> -#include <fstream> -#include <iostream> - #include "Domain/Computations/StructureComputations.h" #include "Templates/AssetStructTestsTemplate.h" #include "Templates/ZoneLoadTemplate.h" #include "Templates/ZoneWriteTemplate.h" +#include <filesystem> +#include <fstream> +#include <iostream> + namespace fs = std::filesystem; CodeGenerator::CodeGenerator(const ZoneCodeGeneratorArguments* args) @@ -68,7 +68,7 @@ bool CodeGenerator::GetAssetWithName(IDataRepository* repository, const std::str return false; } - if(!StructureComputations(info).IsAsset()) + if (!StructureComputations(info).IsAsset()) { std::cout << "Type is not an asset '" << name << "'" << std::endl; return false; @@ -109,11 +109,13 @@ bool CodeGenerator::GenerateCode(IDataRepository* repository) auto context = RenderingContext::BuildContext(repository, asset); if (!GenerateCodeForTemplate(context.get(), foundTemplate->second.get())) { - std::cout << "Failed to generate code for asset '" << asset->m_definition->GetFullName() << "' with preset '" << foundTemplate->first << "'\n"; + std::cout << "Failed to generate code for asset '" << asset->m_definition->GetFullName() << "' with preset '" << foundTemplate->first + << "'\n"; return false; } - - std::cout << "Successfully generated code for asset '" << asset->m_definition->GetFullName() << "' with preset '" << foundTemplate->first << "'\n"; + + std::cout << "Successfully generated code for asset '" << asset->m_definition->GetFullName() << "' with preset '" << foundTemplate->first + << "'\n"; } } else diff --git a/src/ZoneCodeGeneratorLib/Generating/CodeGenerator.h b/src/ZoneCodeGeneratorLib/Generating/CodeGenerator.h index aee800238..5630725b5 100644 --- a/src/ZoneCodeGeneratorLib/Generating/CodeGenerator.h +++ b/src/ZoneCodeGeneratorLib/Generating/CodeGenerator.h @@ -1,10 +1,10 @@ #pragma once -#include <unordered_map> - #include "ICodeTemplate.h" #include "ZoneCodeGeneratorArguments.h" +#include <unordered_map> + class CodeGenerator { const ZoneCodeGeneratorArguments* m_args; diff --git a/src/ZoneCodeGeneratorLib/Generating/ICodeTemplate.h b/src/ZoneCodeGeneratorLib/Generating/ICodeTemplate.h index 153b5c97a..a9c449af9 100644 --- a/src/ZoneCodeGeneratorLib/Generating/ICodeTemplate.h +++ b/src/ZoneCodeGeneratorLib/Generating/ICodeTemplate.h @@ -1,11 +1,11 @@ #pragma once +#include "RenderingContext.h" + #include <ostream> #include <string> #include <vector> -#include "RenderingContext.h" - class CodeTemplateFile { public: @@ -28,7 +28,7 @@ class ICodeTemplate ICodeTemplate(ICodeTemplate&& other) noexcept = default; ICodeTemplate& operator=(const ICodeTemplate& other) = default; ICodeTemplate& operator=(ICodeTemplate&& other) noexcept = default; - + virtual std::vector<CodeTemplateFile> GetFilesToRender(RenderingContext* context) = 0; virtual void RenderFile(std::ostream& stream, int fileTag, RenderingContext* context) = 0; }; diff --git a/src/ZoneCodeGeneratorLib/Generating/RenderingContext.cpp b/src/ZoneCodeGeneratorLib/Generating/RenderingContext.cpp index 5e40e0a5e..9478ed24c 100644 --- a/src/ZoneCodeGeneratorLib/Generating/RenderingContext.cpp +++ b/src/ZoneCodeGeneratorLib/Generating/RenderingContext.cpp @@ -47,15 +47,15 @@ RenderingUsedType* RenderingContext::AddUsedType(std::unique_ptr<RenderingUsedTy RenderingUsedType* RenderingContext::GetBaseType(const IDataRepository* repository, MemberComputations* computations, RenderingUsedType* usedType) { - if(usedType->m_type->GetType() == DataDefinitionType::TYPEDEF) + if (usedType->m_type->GetType() == DataDefinitionType::TYPEDEF) { const auto* typedefDefinition = dynamic_cast<const TypedefDefinition*>(usedType->m_type); - while(typedefDefinition->m_type_declaration->m_type->GetType() == DataDefinitionType::TYPEDEF) + while (typedefDefinition->m_type_declaration->m_type->GetType() == DataDefinitionType::TYPEDEF) typedefDefinition = dynamic_cast<const TypedefDefinition*>(typedefDefinition->m_type_declaration->m_type); const auto foundUsedType = m_used_types_lookup.find(typedefDefinition->m_type_declaration->m_type); - if(foundUsedType == m_used_types_lookup.end()) + if (foundUsedType == m_used_types_lookup.end()) { const auto* memberDef = dynamic_cast<const DefinitionWithMembers*>(typedefDefinition->m_type_declaration->m_type); StructureInformation* info = nullptr; @@ -75,23 +75,23 @@ RenderingUsedType* RenderingContext::GetBaseType(const IDataRepository* reposito void RenderingContext::AddMembersToContext(const IDataRepository* repository, StructureInformation* info) { - for(const auto& member : info->m_ordered_members) + for (const auto& member : info->m_ordered_members) { MemberComputations computations(member.get()); - if(computations.ShouldIgnore()) + if (computations.ShouldIgnore()) continue; RenderingUsedType* usedType; const auto existingUsedType = m_used_types_lookup.find(member->m_member->m_type_declaration->m_type); - if(existingUsedType == m_used_types_lookup.end()) + if (existingUsedType == m_used_types_lookup.end()) usedType = AddUsedType(std::make_unique<RenderingUsedType>(member->m_member->m_type_declaration->m_type, member->m_type)); else usedType = existingUsedType->second.get(); auto* baseUsedType = GetBaseType(repository, &computations, usedType); - if(!computations.IsInRuntimeBlock()) + if (!computations.IsInRuntimeBlock()) { usedType->m_non_runtime_reference_exists = true; @@ -105,7 +105,7 @@ void RenderingContext::AddMembersToContext(const IDataRepository* repository, St if (computations.ContainsArrayPointerReference() || computations.ContainsArrayReference()) usedType->m_array_reference_exists = true; - if(computations.ContainsPointerArrayReference() && !member->m_is_string) + if (computations.ContainsPointerArrayReference() && !member->m_is_string) { usedType->m_pointer_array_reference_exists = true; @@ -136,29 +136,27 @@ void RenderingContext::MakeAsset(const IDataRepository* repository, StructureInf void RenderingContext::CreateUsedTypeCollections() { - for(auto* usedType : m_used_types) + for (auto* usedType : m_used_types) { if (usedType->m_info != nullptr) { StructureComputations computations(usedType->m_info); - if(usedType->m_info->m_definition == usedType->m_type) + if (usedType->m_info->m_definition == usedType->m_type) m_used_structures.push_back(usedType); - if(computations.IsAsset() && usedType->m_info != m_asset) + if (computations.IsAsset() && usedType->m_info != m_asset) m_referenced_assets.push_back(usedType); if (!m_has_actions) { - if ((!computations.IsAsset() || usedType->m_is_context_asset) - && usedType->m_non_runtime_reference_exists + if ((!computations.IsAsset() || usedType->m_is_context_asset) && usedType->m_non_runtime_reference_exists && usedType->m_info->m_post_load_action) { m_has_actions = true; } } } - } } diff --git a/src/ZoneCodeGeneratorLib/Generating/RenderingContext.h b/src/ZoneCodeGeneratorLib/Generating/RenderingContext.h index cf9edef5f..bedd3b5a8 100644 --- a/src/ZoneCodeGeneratorLib/Generating/RenderingContext.h +++ b/src/ZoneCodeGeneratorLib/Generating/RenderingContext.h @@ -1,12 +1,12 @@ #pragma once -#include <string> -#include <unordered_map> - #include "Domain/Computations/MemberComputations.h" #include "Domain/Information/StructureInformation.h" #include "Persistence/IDataRepository.h" +#include <string> +#include <unordered_map> + class RenderingUsedType { public: diff --git a/src/ZoneCodeGeneratorLib/Generating/Templates/AssetStructTestsTemplate.cpp b/src/ZoneCodeGeneratorLib/Generating/Templates/AssetStructTestsTemplate.cpp index 2a98eef22..d3e57b0cf 100644 --- a/src/ZoneCodeGeneratorLib/Generating/Templates/AssetStructTestsTemplate.cpp +++ b/src/ZoneCodeGeneratorLib/Generating/Templates/AssetStructTestsTemplate.cpp @@ -1,31 +1,33 @@ #include "AssetStructTestsTemplate.h" -#include <iostream> -#include <sstream> - #include "Domain/Computations/StructureComputations.h" #include "Internal/BaseTemplate.h" +#include <iostream> +#include <sstream> + class AssetStructTestsTemplate::Internal final : BaseTemplate { void TestMethod(StructureInformation* structure) { - LINE("TEST_CASE(\""<<m_env.m_game<<"::"<<m_env.m_asset->m_definition->GetFullName()<<": Tests for "<<structure->m_definition->GetFullName()<<"\", \"[assetstruct]\")") + LINE("TEST_CASE(\"" << m_env.m_game << "::" << m_env.m_asset->m_definition->GetFullName() << ": Tests for " << structure->m_definition->GetFullName() + << "\", \"[assetstruct]\")") LINE("{") m_intendation++; - for(const auto& member : structure->m_ordered_members) + for (const auto& member : structure->m_ordered_members) { - if(!member->m_member->m_name.empty() && !member->m_member->m_type_declaration->m_has_custom_bit_size) + if (!member->m_member->m_name.empty() && !member->m_member->m_type_declaration->m_has_custom_bit_size) { - LINE("REQUIRE(offsetof(" << structure->m_definition->GetFullName() << ", " << member->m_member->m_name << ") == " << member->m_member->m_offset << ");") + LINE("REQUIRE(offsetof(" << structure->m_definition->GetFullName() << ", " << member->m_member->m_name << ") == " << member->m_member->m_offset + << ");") } } LINE("") - LINE("REQUIRE("<<structure->m_definition->GetSize()<<"u == sizeof("<<structure->m_definition->GetFullName()<<"));") - LINE("REQUIRE("<<structure->m_definition->GetAlignment()<<"u == alignof("<<structure->m_definition->GetFullName()<<"));") + LINE("REQUIRE(" << structure->m_definition->GetSize() << "u == sizeof(" << structure->m_definition->GetFullName() << "));") + LINE("REQUIRE(" << structure->m_definition->GetAlignment() << "u == alignof(" << structure->m_definition->GetFullName() << "));") m_intendation--; LINE("}") } @@ -51,7 +53,7 @@ class AssetStructTestsTemplate::Internal final : BaseTemplate LINE("") LINE("using namespace " << m_env.m_game << ";") LINE("") - LINE("namespace game::"<<m_env.m_game<<"::xassets::asset_"<<Lower(m_env.m_asset->m_definition->m_name)) + LINE("namespace game::" << m_env.m_game << "::xassets::asset_" << Lower(m_env.m_asset->m_definition->m_name)) LINE("{") m_intendation++; diff --git a/src/ZoneCodeGeneratorLib/Generating/Templates/Internal/BaseTemplate.cpp b/src/ZoneCodeGeneratorLib/Generating/Templates/Internal/BaseTemplate.cpp index 8c5a51f30..c454554be 100644 --- a/src/ZoneCodeGeneratorLib/Generating/Templates/Internal/BaseTemplate.cpp +++ b/src/ZoneCodeGeneratorLib/Generating/Templates/Internal/BaseTemplate.cpp @@ -1,11 +1,10 @@ #include "BaseTemplate.h" -#include <sstream> - - #include "Domain/Computations/MemberComputations.h" #include "Domain/Definition/ArrayDeclarationModifier.h" +#include <sstream> + BaseTemplate::BaseTemplate(std::ostream& stream, RenderingContext* context) : m_out(stream), m_env(*context), @@ -88,7 +87,6 @@ std::string BaseTemplate::MakeTypeVarName(const DataDefinition* def) return str.str(); } - std::string BaseTemplate::MakeTypeWrittenVarName(const DataDefinition* def) { std::ostringstream str; @@ -137,7 +135,10 @@ std::string BaseTemplate::MakeWrittenMemberAccess(StructureInformation* info, Me return str.str(); } -std::string BaseTemplate::MakeMemberAccess(const std::string& variableName, StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier) +std::string BaseTemplate::MakeMemberAccess(const std::string& variableName, + StructureInformation* info, + MemberInformation* member, + const DeclarationModifierComputations& modifier) { std::ostringstream str; str << variableName << "->" << member->m_member->m_name; @@ -210,7 +211,7 @@ std::string BaseTemplate::MakeCustomActionCall(CustomAction* action) std::string BaseTemplate::MakeArrayCount(const ArrayDeclarationModifier* arrayModifier) { - if(arrayModifier->m_dynamic_count_evaluation) + if (arrayModifier->m_dynamic_count_evaluation) { return MakeEvaluation(arrayModifier->m_dynamic_count_evaluation.get()); } @@ -234,11 +235,11 @@ void BaseTemplate::MakeOperandDynamic(const OperandDynamic* op, std::ostringstre { MakeTypeVarNameInternal(op->m_structure->m_definition, str); - if(!op->m_referenced_member_chain.empty()) + if (!op->m_referenced_member_chain.empty()) { str << "->"; const auto lastEntry = op->m_referenced_member_chain.end() - 1; - for(auto i = op->m_referenced_member_chain.begin(); i != lastEntry; ++i) + for (auto i = op->m_referenced_member_chain.begin(); i != lastEntry; ++i) { MemberComputations computations(*i); str << (*i)->m_member->m_name; diff --git a/src/ZoneCodeGeneratorLib/Generating/Templates/Internal/BaseTemplate.h b/src/ZoneCodeGeneratorLib/Generating/Templates/Internal/BaseTemplate.h index 074c3ddd1..446c9423f 100644 --- a/src/ZoneCodeGeneratorLib/Generating/Templates/Internal/BaseTemplate.h +++ b/src/ZoneCodeGeneratorLib/Generating/Templates/Internal/BaseTemplate.h @@ -1,8 +1,5 @@ #pragma once -#include <ostream> -#include <sstream> - #include "Domain/Computations/MemberDeclarationModifierComputations.h" #include "Domain/Definition/ArrayDeclarationModifier.h" #include "Domain/Evaluation/OperandDynamic.h" @@ -10,6 +7,9 @@ #include "Domain/Evaluation/Operation.h" #include "Generating/RenderingContext.h" +#include <ostream> +#include <sstream> + class BaseTemplate { protected: @@ -45,7 +45,10 @@ class BaseTemplate static std::string MakeSafeTypeName(const DataDefinition* def); static std::string MakeMemberAccess(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier); static std::string MakeWrittenMemberAccess(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier); - static std::string MakeMemberAccess(const std::string& variableName, StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier); + static std::string MakeMemberAccess(const std::string& variableName, + StructureInformation* info, + MemberInformation* member, + const DeclarationModifierComputations& modifier); static std::string MakeTypeDecl(const TypeDeclaration* decl); static std::string MakeFollowingReferences(const std::vector<DeclarationModifier*>& modifiers); static std::string MakeArrayIndices(const DeclarationModifierComputations& modifierComputations); @@ -54,7 +57,21 @@ class BaseTemplate static std::string MakeEvaluation(const IEvaluation* evaluation); }; -#define LINE(x) {DoIntendation(); m_out << x << "\n";} -#define LINE_START(x) {DoIntendation(); m_out << x;} -#define LINE_MIDDLE(x) {m_out << x;} -#define LINE_END(x) {m_out << x << "\n";} \ No newline at end of file +#define LINE(x) \ + { \ + DoIntendation(); \ + m_out << x << "\n"; \ + } +#define LINE_START(x) \ + { \ + DoIntendation(); \ + m_out << x; \ + } +#define LINE_MIDDLE(x) \ + { \ + m_out << x; \ + } +#define LINE_END(x) \ + { \ + m_out << x << "\n"; \ + } diff --git a/src/ZoneCodeGeneratorLib/Generating/Templates/ZoneLoadTemplate.cpp b/src/ZoneCodeGeneratorLib/Generating/Templates/ZoneLoadTemplate.cpp index 682cd0b15..927f82738 100644 --- a/src/ZoneCodeGeneratorLib/Generating/Templates/ZoneLoadTemplate.cpp +++ b/src/ZoneCodeGeneratorLib/Generating/Templates/ZoneLoadTemplate.cpp @@ -1,13 +1,13 @@ #include "ZoneLoadTemplate.h" -#include <cassert> -#include <iostream> -#include <sstream> - #include "Domain/Computations/MemberComputations.h" #include "Domain/Computations/StructureComputations.h" #include "Internal/BaseTemplate.h" +#include <cassert> +#include <iostream> +#include <sstream> + class ZoneLoadTemplate::Internal final : BaseTemplate { enum class MemberLoadType @@ -43,52 +43,52 @@ class ZoneLoadTemplate::Internal final : BaseTemplate void PrintHeaderPtrArrayLoadMethodDeclaration(const DataDefinition* def) const { - LINE("void LoadPtrArray_"<< MakeSafeTypeName(def)<<"(bool atStreamStart, size_t count);") + LINE("void LoadPtrArray_" << MakeSafeTypeName(def) << "(bool atStreamStart, size_t count);") } void PrintHeaderArrayLoadMethodDeclaration(const DataDefinition* def) const { - LINE("void LoadArray_"<< MakeSafeTypeName(def)<<"(bool atStreamStart, size_t count);") + LINE("void LoadArray_" << MakeSafeTypeName(def) << "(bool atStreamStart, size_t count);") } void PrintHeaderLoadMethodDeclaration(const StructureInformation* info) const { - LINE("void Load_"<< MakeSafeTypeName(info->m_definition)<<"(bool atStreamStart);") + LINE("void Load_" << MakeSafeTypeName(info->m_definition) << "(bool atStreamStart);") } void PrintHeaderTempPtrLoadMethodDeclaration(const StructureInformation* info) const { - LINE("void LoadPtr_"<< MakeSafeTypeName(info->m_definition)<<"(bool atStreamStart);") + LINE("void LoadPtr_" << MakeSafeTypeName(info->m_definition) << "(bool atStreamStart);") } void PrintHeaderAssetLoadMethodDeclaration(const StructureInformation* info) const { - LINE("void LoadAsset_"<< MakeSafeTypeName(info->m_definition)<<"("<<info->m_definition->GetFullName()<<"** pAsset);") + LINE("void LoadAsset_" << MakeSafeTypeName(info->m_definition) << "(" << info->m_definition->GetFullName() << "** pAsset);") } void PrintHeaderGetNameMethodDeclaration(const StructureInformation* info) const { - LINE("static std::string GetAssetName("<<info->m_definition->GetFullName()<<"* pAsset);") + LINE("static std::string GetAssetName(" << info->m_definition->GetFullName() << "* pAsset);") } void PrintHeaderMainLoadMethodDeclaration(const StructureInformation* info) const { - LINE("XAssetInfo<"<<info->m_definition->GetFullName()<<">* Load("<<info->m_definition->GetFullName()<<"** pAsset);") + LINE("XAssetInfo<" << info->m_definition->GetFullName() << ">* Load(" << info->m_definition->GetFullName() << "** pAsset);") } void PrintHeaderConstructor() const { - LINE(LoaderClassName(m_env.m_asset)<<"(Zone* zone, IZoneInputStream* stream);") + LINE(LoaderClassName(m_env.m_asset) << "(Zone* zone, IZoneInputStream* stream);") } void PrintVariableInitialization(const DataDefinition* def) const { - LINE("var"<<def->m_name<<" = nullptr;") + LINE("var" << def->m_name << " = nullptr;") } void PrintPointerVariableInitialization(const DataDefinition* def) const { - LINE("var"<<def->m_name<<"Ptr = nullptr;") + LINE("var" << def->m_name << "Ptr = nullptr;") } void PrintConstructorMethod() @@ -96,7 +96,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate LINE(LoaderClassName(m_env.m_asset) << "::" << LoaderClassName(m_env.m_asset) << "(Zone* zone, IZoneInputStream* stream)") m_intendation++; - LINE_START(": AssetLoader("<<m_env.m_asset->m_asset_enum_entry->m_name<<", zone, stream)") + LINE_START(": AssetLoader(" << m_env.m_asset->m_asset_enum_entry->m_name << ", zone, stream)") if (m_env.m_has_actions) { LINE_MIDDLE(", m_actions(zone)") @@ -133,16 +133,16 @@ class ZoneLoadTemplate::Internal final : BaseTemplate void PrintLoadPtrArrayMethod_Loading(const DataDefinition* def, StructureInformation* info) const { - LINE("*"<< MakeTypePtrVarName(def)<<" = m_stream->Alloc<"<<def->GetFullName()<<">("<< def->GetAlignment() <<");") + LINE("*" << MakeTypePtrVarName(def) << " = m_stream->Alloc<" << def->GetFullName() << ">(" << def->GetAlignment() << ");") if (info && !info->m_is_leaf) { - LINE(MakeTypeVarName(info->m_definition)<<" = *"<< MakeTypePtrVarName(def)<<";") - LINE("Load_"<< MakeSafeTypeName(def)<<"(true);") + LINE(MakeTypeVarName(info->m_definition) << " = *" << MakeTypePtrVarName(def) << ";") + LINE("Load_" << MakeSafeTypeName(def) << "(true);") } else { - LINE("m_stream->Load<"<<def->GetFullName()<<">(*"<< MakeTypePtrVarName(def)<<");") + LINE("m_stream->Load<" << def->GetFullName() << ">(*" << MakeTypePtrVarName(def) << ");") } } @@ -154,8 +154,8 @@ class ZoneLoadTemplate::Internal final : BaseTemplate if (info && StructureComputations(info).IsAsset()) { - LINE(LoaderClassName(info)<<" loader(m_zone, m_stream);") - LINE("AddDependency(loader.Load("<< MakeTypePtrVarName(def)<<"));") + LINE(LoaderClassName(info) << " loader(m_zone, m_stream);") + LINE("AddDependency(loader.Load(" << MakeTypePtrVarName(def) << "));") } else { @@ -173,7 +173,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate LINE("{") m_intendation++; - LINE("*"<< MakeTypePtrVarName(def)<<" = m_stream->ConvertOffsetToPointer(*"<< MakeTypePtrVarName(def)<<");") + LINE("*" << MakeTypePtrVarName(def) << " = m_stream->ConvertOffsetToPointer(*" << MakeTypePtrVarName(def) << ");") m_intendation--; LINE("}") @@ -190,7 +190,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate void PrintLoadPtrArrayMethod(const DataDefinition* def, StructureInformation* info, const bool reusable) { - LINE("void "<<LoaderClassName(m_env.m_asset)<<"::LoadPtrArray_"<< MakeSafeTypeName(def)<<"(const bool atStreamStart, const size_t count)") + LINE("void " << LoaderClassName(m_env.m_asset) << "::LoadPtrArray_" << MakeSafeTypeName(def) << "(const bool atStreamStart, const size_t count)") LINE("{") m_intendation++; @@ -199,7 +199,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate LINE("if(atStreamStart)") m_intendation++; - LINE("m_stream->Load<"<<def->GetFullName()<<"*>("<< MakeTypePtrVarName(def)<<", count);") + LINE("m_stream->Load<" << def->GetFullName() << "*>(" << MakeTypePtrVarName(def) << ", count);") m_intendation--; LINE("") @@ -229,7 +229,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate LINE("") LINE("if(atStreamStart)") m_intendation++; - LINE("m_stream->Load<"<<def->GetFullName()<<">("<<MakeTypeVarName(def)<<", count);") + LINE("m_stream->Load<" << def->GetFullName() << ">(" << MakeTypeVarName(def) << ", count);") m_intendation--; LINE("") @@ -239,7 +239,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate m_intendation++; LINE(MakeTypeVarName(info->m_definition) << " = var;") - LINE("Load_"<<info->m_definition->m_name<<"(false);") + LINE("Load_" << info->m_definition->m_name << "(false);") LINE("var++;") m_intendation--; @@ -249,7 +249,10 @@ class ZoneLoadTemplate::Internal final : BaseTemplate LINE("}") } - void LoadMember_ScriptString(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, const MemberLoadType loadType) const + void LoadMember_ScriptString(StructureInformation* info, + MemberInformation* member, + const DeclarationModifierComputations& modifier, + const MemberLoadType loadType) const { if (loadType == MemberLoadType::ARRAY_POINTER) { @@ -272,12 +275,15 @@ class ZoneLoadTemplate::Internal final : BaseTemplate } } - void LoadMember_Asset(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, const MemberLoadType loadType) const + void LoadMember_Asset(StructureInformation* info, + MemberInformation* member, + const DeclarationModifierComputations& modifier, + const MemberLoadType loadType) const { if (loadType == MemberLoadType::SINGLE_POINTER) { - LINE(LoaderClassName(member->m_type)<<" loader(m_zone, m_stream);") - LINE("AddDependency(loader.Load(&"<<MakeMemberAccess(info, member, modifier)<<"));") + LINE(LoaderClassName(member->m_type) << " loader(m_zone, m_stream);") + LINE("AddDependency(loader.Load(&" << MakeMemberAccess(info, member, modifier) << "));") } else if (loadType == MemberLoadType::POINTER_ARRAY) { @@ -290,7 +296,10 @@ class ZoneLoadTemplate::Internal final : BaseTemplate } } - void LoadMember_String(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, const MemberLoadType loadType) const + void LoadMember_String(StructureInformation* info, + MemberInformation* member, + const DeclarationModifierComputations& modifier, + const MemberLoadType loadType) const { if (loadType == MemberLoadType::SINGLE_POINTER) { @@ -309,17 +318,17 @@ class ZoneLoadTemplate::Internal final : BaseTemplate LINE("varXString = " << MakeMemberAccess(info, member, modifier) << ";") if (modifier.IsArray()) { - LINE("LoadXStringArray(false, "<<modifier.GetArraySize()<<");") + LINE("LoadXStringArray(false, " << modifier.GetArraySize() << ");") } else { - LINE("LoadXStringArray(true, "<<MakeEvaluation(modifier.GetPointerArrayCountEvaluation())<<");") + LINE("LoadXStringArray(true, " << MakeEvaluation(modifier.GetPointerArrayCountEvaluation()) << ");") } } else { assert(false); - LINE("#error unsupported loadType "<<static_cast<int>(loadType)<<" for string") + LINE("#error unsupported loadType " << static_cast<int>(loadType) << " for string") } } @@ -329,7 +338,8 @@ class ZoneLoadTemplate::Internal final : BaseTemplate if (member->m_type && !member->m_type->m_is_leaf && !computations.IsInRuntimeBlock()) { LINE(MakeTypeVarName(member->m_member->m_type_declaration->m_type) << " = " << MakeMemberAccess(info, member, modifier) << ";") - LINE("LoadArray_" << MakeSafeTypeName(member->m_member->m_type_declaration->m_type) << "(true, " << MakeEvaluation(modifier.GetArrayPointerCountEvaluation()) << ");") + LINE("LoadArray_" << MakeSafeTypeName(member->m_member->m_type_declaration->m_type) << "(true, " + << MakeEvaluation(modifier.GetArrayPointerCountEvaluation()) << ");") if (member->m_type->m_post_load_action) { @@ -339,8 +349,9 @@ class ZoneLoadTemplate::Internal final : BaseTemplate } else { - LINE("m_stream->Load<" << MakeTypeDecl(member->m_member->m_type_declaration.get()) << MakeFollowingReferences(modifier.GetFollowingDeclarationModifiers()) - << ">(" << MakeMemberAccess(info, member, modifier) << ", " << MakeEvaluation(modifier.GetArrayPointerCountEvaluation()) << ");") + LINE("m_stream->Load<" << MakeTypeDecl(member->m_member->m_type_declaration.get()) + << MakeFollowingReferences(modifier.GetFollowingDeclarationModifiers()) << ">(" << MakeMemberAccess(info, member, modifier) + << ", " << MakeEvaluation(modifier.GetArrayPointerCountEvaluation()) << ");") } } @@ -349,11 +360,12 @@ class ZoneLoadTemplate::Internal final : BaseTemplate LINE(MakeTypePtrVarName(member->m_member->m_type_declaration->m_type) << " = " << MakeMemberAccess(info, member, modifier) << ";") if (modifier.IsArray()) { - LINE("LoadPtrArray_"<<MakeSafeTypeName(member->m_member->m_type_declaration->m_type)<<"(false, "<<modifier.GetArraySize()<<");") + LINE("LoadPtrArray_" << MakeSafeTypeName(member->m_member->m_type_declaration->m_type) << "(false, " << modifier.GetArraySize() << ");") } else { - LINE("LoadPtrArray_"<<MakeSafeTypeName(member->m_member->m_type_declaration->m_type)<<"(true, "<<MakeEvaluation(modifier.GetPointerArrayCountEvaluation())<<");") + LINE("LoadPtrArray_" << MakeSafeTypeName(member->m_member->m_type_declaration->m_type) << "(true, " + << MakeEvaluation(modifier.GetPointerArrayCountEvaluation()) << ");") } } @@ -373,11 +385,11 @@ class ZoneLoadTemplate::Internal final : BaseTemplate if (computations.IsAfterPartialLoad()) { - LINE("LoadArray_" << MakeSafeTypeName(member->m_member->m_type_declaration->m_type) << "(true, "<<arraySizeStr <<");") + LINE("LoadArray_" << MakeSafeTypeName(member->m_member->m_type_declaration->m_type) << "(true, " << arraySizeStr << ");") } else { - LINE("LoadArray_"<<MakeSafeTypeName(member->m_member->m_type_declaration->m_type)<<"(false, "<<arraySizeStr <<");") + LINE("LoadArray_" << MakeSafeTypeName(member->m_member->m_type_declaration->m_type) << "(false, " << arraySizeStr << ");") } if (member->m_type->m_post_load_action) @@ -388,8 +400,9 @@ class ZoneLoadTemplate::Internal final : BaseTemplate } else if (computations.IsAfterPartialLoad()) { - LINE("m_stream->Load<" << MakeTypeDecl(member->m_member->m_type_declaration.get()) << MakeFollowingReferences(modifier.GetFollowingDeclarationModifiers()) - << ">(" << MakeMemberAccess(info, member, modifier) <<", "<<arraySizeStr <<");") + LINE("m_stream->Load<" << MakeTypeDecl(member->m_member->m_type_declaration.get()) + << MakeFollowingReferences(modifier.GetFollowingDeclarationModifiers()) << ">(" << MakeMemberAccess(info, member, modifier) + << ", " << arraySizeStr << ");") } } @@ -398,12 +411,14 @@ class ZoneLoadTemplate::Internal final : BaseTemplate if (member->m_type && !member->m_type->m_is_leaf) { LINE(MakeTypeVarName(member->m_member->m_type_declaration->m_type) << " = " << MakeMemberAccess(info, member, modifier) << ";") - LINE("LoadArray_"<<MakeSafeTypeName(member->m_member->m_type_declaration->m_type)<<"(true, "<<MakeEvaluation(modifier.GetDynamicArraySizeEvaluation())<<");") + LINE("LoadArray_" << MakeSafeTypeName(member->m_member->m_type_declaration->m_type) << "(true, " + << MakeEvaluation(modifier.GetDynamicArraySizeEvaluation()) << ");") } else { - LINE("m_stream->Load<"<<MakeTypeDecl(member->m_member->m_type_declaration.get())<<MakeFollowingReferences(modifier.GetFollowingDeclarationModifiers()) - <<">("<<MakeMemberAccess(info, member, modifier)<<", "<<MakeEvaluation(modifier.GetDynamicArraySizeEvaluation())<<");") + LINE("m_stream->Load<" << MakeTypeDecl(member->m_member->m_type_declaration.get()) + << MakeFollowingReferences(modifier.GetFollowingDeclarationModifiers()) << ">(" << MakeMemberAccess(info, member, modifier) + << ", " << MakeEvaluation(modifier.GetDynamicArraySizeEvaluation()) << ");") } } @@ -431,8 +446,9 @@ class ZoneLoadTemplate::Internal final : BaseTemplate } else if (computations.IsAfterPartialLoad()) { - LINE("m_stream->Load<"<<MakeTypeDecl(member->m_member->m_type_declaration.get()) << MakeFollowingReferences(modifier.GetFollowingDeclarationModifiers()) - << ">(&" << MakeMemberAccess(info, member, modifier)<<");") + LINE("m_stream->Load<" << MakeTypeDecl(member->m_member->m_type_declaration.get()) + << MakeFollowingReferences(modifier.GetFollowingDeclarationModifiers()) << ">(&" << MakeMemberAccess(info, member, modifier) + << ");") } } @@ -452,12 +468,16 @@ class ZoneLoadTemplate::Internal final : BaseTemplate } else { - LINE("m_stream->Load<" << MakeTypeDecl(member->m_member->m_type_declaration.get()) << MakeFollowingReferences(modifier.GetFollowingDeclarationModifiers()) - << ">(" << MakeMemberAccess(info, member, modifier) << ");") + LINE("m_stream->Load<" << MakeTypeDecl(member->m_member->m_type_declaration.get()) + << MakeFollowingReferences(modifier.GetFollowingDeclarationModifiers()) << ">(" << MakeMemberAccess(info, member, modifier) + << ");") } } - void LoadMember_TypeCheck(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, const MemberLoadType loadType) const + void LoadMember_TypeCheck(StructureInformation* info, + MemberInformation* member, + const DeclarationModifierComputations& modifier, + const MemberLoadType loadType) const { if (member->m_is_string) { @@ -506,11 +526,12 @@ class ZoneLoadTemplate::Internal final : BaseTemplate } } - static bool LoadMember_ShouldMakeAlloc(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, const MemberLoadType loadType) + static bool LoadMember_ShouldMakeAlloc(StructureInformation* info, + MemberInformation* member, + const DeclarationModifierComputations& modifier, + const MemberLoadType loadType) { - if (loadType != MemberLoadType::ARRAY_POINTER - && loadType != MemberLoadType::POINTER_ARRAY - && loadType != MemberLoadType::SINGLE_POINTER) + if (loadType != MemberLoadType::ARRAY_POINTER && loadType != MemberLoadType::POINTER_ARRAY && loadType != MemberLoadType::SINGLE_POINTER) { return false; } @@ -544,23 +565,25 @@ class ZoneLoadTemplate::Internal final : BaseTemplate const MemberComputations computations(member); if (computations.IsInTempBlock()) { - LINE(member->m_member->m_type_declaration->m_type->GetFullName()<< "* ptr = "<<MakeMemberAccess(info, member, modifier)<<";") + LINE(member->m_member->m_type_declaration->m_type->GetFullName() << "* ptr = " << MakeMemberAccess(info, member, modifier) << ";") } const auto typeDecl = MakeTypeDecl(member->m_member->m_type_declaration.get()); const auto followingReferences = MakeFollowingReferences(modifier.GetFollowingDeclarationModifiers()); // This used to use `alignof()` to calculate alignment but due to inconsistencies between compilers and bugs discovered in MSVC - // (Alignment specified via `__declspec(align())` showing as correct via intellisense but is incorrect when compiled for types that have a larger alignment than the specified value) - // this was changed to make ZoneCodeGenerator calculate what is supposed to be used as alignment when allocating. + // (Alignment specified via `__declspec(align())` showing as correct via intellisense but is incorrect when compiled for types that have a larger + // alignment than the specified value) this was changed to make ZoneCodeGenerator calculate what is supposed to be used as alignment when allocating. // This is more reliable when being used with different compilers and the value used can be seen in the source code directly if (member->m_alloc_alignment) { - LINE(MakeMemberAccess(info, member, modifier)<<" = m_stream->Alloc<"<<typeDecl<<followingReferences<<">("<<MakeEvaluation(member->m_alloc_alignment.get())<<");") + LINE(MakeMemberAccess(info, member, modifier) + << " = m_stream->Alloc<" << typeDecl << followingReferences << ">(" << MakeEvaluation(member->m_alloc_alignment.get()) << ");") } else { - LINE(MakeMemberAccess(info, member, modifier)<<" = m_stream->Alloc<"<<typeDecl<<followingReferences<<">("<<modifier.GetAlignment()<<");") + LINE(MakeMemberAccess(info, member, modifier) + << " = m_stream->Alloc<" << typeDecl << followingReferences << ">(" << modifier.GetAlignment() << ");") } if (computations.IsInTempBlock()) @@ -569,7 +592,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate LINE(member->m_member->m_type_declaration->m_type->GetFullName() << "** toInsert = nullptr;") LINE("if(ptr == PTR_INSERT)") m_intendation++; - LINE("toInsert = m_stream->InsertPointer<"<<member->m_member->m_type_declaration->m_type->GetFullName() << ">();") + LINE("toInsert = m_stream->InsertPointer<" << member->m_member->m_type_declaration->m_type->GetFullName() << ">();") m_intendation--; LINE("") } @@ -581,22 +604,22 @@ class ZoneLoadTemplate::Internal final : BaseTemplate LINE("") LINE("if(toInsert != nullptr)") m_intendation++; - LINE("*toInsert = "<<MakeTypeVarName(info->m_definition)<<"->"<<member->m_member->m_name<<";") + LINE("*toInsert = " << MakeTypeVarName(info->m_definition) << "->" << member->m_member->m_name << ";") m_intendation--; } } - static bool LoadMember_ShouldMakeReuse(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, const MemberLoadType loadType) + static bool LoadMember_ShouldMakeReuse(StructureInformation* info, + MemberInformation* member, + const DeclarationModifierComputations& modifier, + const MemberLoadType loadType) { - if (loadType != MemberLoadType::ARRAY_POINTER - && loadType != MemberLoadType::SINGLE_POINTER - && loadType != MemberLoadType::POINTER_ARRAY) + if (loadType != MemberLoadType::ARRAY_POINTER && loadType != MemberLoadType::SINGLE_POINTER && loadType != MemberLoadType::POINTER_ARRAY) { return false; } - if (loadType == MemberLoadType::POINTER_ARRAY - && modifier.IsArray()) + if (loadType == MemberLoadType::POINTER_ARRAY && modifier.IsArray()) { return false; } @@ -606,8 +629,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate void LoadMember_Reuse(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, const MemberLoadType loadType) { - if (!LoadMember_ShouldMakeReuse(info, member, modifier, loadType) - || !member->m_is_reusable) + if (!LoadMember_ShouldMakeReuse(info, member, modifier, loadType) || !member->m_is_reusable) { LoadMember_Alloc(info, member, modifier, loadType); return; @@ -616,7 +638,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate const MemberComputations computations(member); if (computations.IsInTempBlock()) { - LINE("if("<<MakeMemberAccess(info, member, modifier)<<" == PTR_FOLLOWING || "<<MakeMemberAccess(info, member, modifier)<<" == PTR_INSERT)") + LINE("if(" << MakeMemberAccess(info, member, modifier) << " == PTR_FOLLOWING || " << MakeMemberAccess(info, member, modifier) << " == PTR_INSERT)") LINE("{") m_intendation++; @@ -635,7 +657,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate } else { - LINE("if("<<MakeMemberAccess(info, member, modifier)<<" == PTR_FOLLOWING)") + LINE("if(" << MakeMemberAccess(info, member, modifier) << " == PTR_FOLLOWING)") LINE("{") m_intendation++; @@ -647,11 +669,12 @@ class ZoneLoadTemplate::Internal final : BaseTemplate LINE("{") m_intendation++; - LINE(MakeMemberAccess(info, member, modifier)<< " = m_stream->ConvertOffsetToPointer("<<MakeMemberAccess(info, member, modifier)<<");") + LINE(MakeMemberAccess(info, member, modifier) << " = m_stream->ConvertOffsetToPointer(" << MakeMemberAccess(info, member, modifier) << ");") if (member->m_is_script_string && loadType == MemberLoadType::ARRAY_POINTER) { - LINE("MarkScriptStringArrayAsUsed(" << MakeMemberAccess(info, member, modifier) << ", " << MakeEvaluation(modifier.GetArrayPointerCountEvaluation()) << ");") + LINE("MarkScriptStringArrayAsUsed(" << MakeMemberAccess(info, member, modifier) << ", " + << MakeEvaluation(modifier.GetArrayPointerCountEvaluation()) << ");") } m_intendation--; @@ -659,11 +682,12 @@ class ZoneLoadTemplate::Internal final : BaseTemplate } } - static bool LoadMember_ShouldMakePointerCheck(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, MemberLoadType loadType) + static bool LoadMember_ShouldMakePointerCheck(StructureInformation* info, + MemberInformation* member, + const DeclarationModifierComputations& modifier, + MemberLoadType loadType) { - if (loadType != MemberLoadType::ARRAY_POINTER - && loadType != MemberLoadType::POINTER_ARRAY - && loadType != MemberLoadType::SINGLE_POINTER) + if (loadType != MemberLoadType::ARRAY_POINTER && loadType != MemberLoadType::POINTER_ARRAY && loadType != MemberLoadType::SINGLE_POINTER) { return false; } @@ -681,7 +705,10 @@ class ZoneLoadTemplate::Internal final : BaseTemplate return true; } - void LoadMember_PointerCheck(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, const MemberLoadType loadType) + void LoadMember_PointerCheck(StructureInformation* info, + MemberInformation* member, + const DeclarationModifierComputations& modifier, + const MemberLoadType loadType) { if (LoadMember_ShouldMakePointerCheck(info, member, modifier, loadType)) { @@ -769,7 +796,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate else { assert(false); - LINE("#error LoadMemberReference failed @ "<<member->m_member->m_name) + LINE("#error LoadMemberReference failed @ " << member->m_member->m_name) } } @@ -778,7 +805,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate LINE("") if (member->m_condition) { - LINE("if("<<MakeEvaluation(member->m_condition.get())<<")") + LINE("if(" << MakeEvaluation(member->m_condition.get()) << ")") LINE("{") m_intendation++; @@ -802,7 +829,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate LINE("") if (member->m_condition) { - LINE("if("<<MakeEvaluation(member->m_condition.get())<<")") + LINE("if(" << MakeEvaluation(member->m_condition.get()) << ")") LINE("{") m_intendation++; @@ -820,7 +847,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate { if (member->m_condition) { - LINE("else if("<<MakeEvaluation(member->m_condition.get())<<")") + LINE("else if(" << MakeEvaluation(member->m_condition.get()) << ")") LINE("{") m_intendation++; @@ -845,7 +872,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate { if (member->m_condition) { - LINE("else if("<<MakeEvaluation(member->m_condition.get())<<")") + LINE("else if(" << MakeEvaluation(member->m_condition.get()) << ")") LINE("{") m_intendation++; @@ -856,7 +883,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate } else { - LINE("#error Middle member of union must have condition ("<<member->m_member->m_name<<")") + LINE("#error Middle member of union must have condition (" << member->m_member->m_name << ")") } } } @@ -867,10 +894,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate if (computations.ShouldIgnore()) return; - if (member->m_is_string - || member->m_is_script_string - || computations.ContainsNonEmbeddedReference() - || member->m_type && !member->m_type->m_is_leaf + if (member->m_is_string || member->m_is_script_string || computations.ContainsNonEmbeddedReference() || member->m_type && !member->m_type->m_is_leaf || computations.IsAfterPartialLoad()) { if (info->m_definition->GetType() == DataDefinitionType::UNION) @@ -887,7 +911,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate LINE("{") m_intendation++; - LINE("assert(" <<MakeTypeVarName(info->m_definition) << " != nullptr);") + LINE("assert(" << MakeTypeVarName(info->m_definition) << " != nullptr);") auto* dynamicMember = computations.GetDynamicMember(); if (!(info->m_definition->GetType() == DataDefinitionType::UNION && dynamicMember)) @@ -898,12 +922,13 @@ class ZoneLoadTemplate::Internal final : BaseTemplate if (dynamicMember == nullptr) { - LINE("m_stream->Load<"<<info->m_definition->GetFullName()<<">("<<MakeTypeVarName(info->m_definition)<<"); // Size: "<<info->m_definition->GetSize()) + LINE("m_stream->Load<" << info->m_definition->GetFullName() << ">(" << MakeTypeVarName(info->m_definition) + << "); // Size: " << info->m_definition->GetSize()) } else { - LINE("m_stream->LoadPartial<"<<info->m_definition->GetFullName()<<">("<<MakeTypeVarName(info->m_definition)<<", offsetof("<<info->m_definition->GetFullName() - <<", "<<dynamicMember->m_member->m_name<<"));") + LINE("m_stream->LoadPartial<" << info->m_definition->GetFullName() << ">(" << MakeTypeVarName(info->m_definition) << ", offsetof(" + << info->m_definition->GetFullName() << ", " << dynamicMember->m_member->m_name << "));") } m_intendation--; @@ -921,7 +946,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate else if (info->m_block) { LINE("") - LINE("m_stream->PushBlock("<<info->m_block->m_name<<");") + LINE("m_stream->PushBlock(" << info->m_block->m_name << ");") } for (const auto& member : info->m_ordered_members) @@ -942,16 +967,16 @@ class ZoneLoadTemplate::Internal final : BaseTemplate void PrintLoadPtrMethod(StructureInformation* info) { const bool inTemp = info->m_block && info->m_block->m_type == FastFileBlockType::TEMP; - LINE("void "<<LoaderClassName(m_env.m_asset)<<"::LoadPtr_"<<MakeSafeTypeName(info->m_definition)<<"(const bool atStreamStart)") + LINE("void " << LoaderClassName(m_env.m_asset) << "::LoadPtr_" << MakeSafeTypeName(info->m_definition) << "(const bool atStreamStart)") LINE("{") m_intendation++; - LINE("assert("<<MakeTypePtrVarName(info->m_definition)<<" != nullptr);") + LINE("assert(" << MakeTypePtrVarName(info->m_definition) << " != nullptr);") LINE("") LINE("if(atStreamStart)") m_intendation++; - LINE("m_stream->Load<"<<info->m_definition->GetFullName()<<"*>("<< MakeTypePtrVarName(info->m_definition)<<");") + LINE("m_stream->Load<" << info->m_definition->GetFullName() << "*>(" << MakeTypePtrVarName(info->m_definition) << ");") m_intendation--; LINE("") @@ -961,7 +986,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate LINE("") } - LINE("if(*"<< MakeTypePtrVarName(info->m_definition)<<" != nullptr)") + LINE("if(*" << MakeTypePtrVarName(info->m_definition) << " != nullptr)") LINE("{") m_intendation++; @@ -980,7 +1005,8 @@ class ZoneLoadTemplate::Internal final : BaseTemplate { LINE(info->m_definition->GetFullName() << "* ptr = *" << MakeTypePtrVarName(info->m_definition) << ";") } - LINE("*" << MakeTypePtrVarName(info->m_definition) << " = m_stream->Alloc<" << info->m_definition->GetFullName() << ">("<< info->m_definition->GetAlignment() <<");") + LINE("*" << MakeTypePtrVarName(info->m_definition) << " = m_stream->Alloc<" << info->m_definition->GetFullName() << ">(" + << info->m_definition->GetAlignment() << ");") if (inTemp) { @@ -1001,8 +1027,8 @@ class ZoneLoadTemplate::Internal final : BaseTemplate startLoadSection = false; LINE("") } - LINE(MakeTypeVarName(info->m_definition)<<" = *"<< MakeTypePtrVarName(info->m_definition)<<";") - LINE("Load_"<<MakeSafeTypeName(info->m_definition)<<"(true);") + LINE(MakeTypeVarName(info->m_definition) << " = *" << MakeTypePtrVarName(info->m_definition) << ";") + LINE("Load_" << MakeSafeTypeName(info->m_definition) << "(true);") } else { @@ -1018,7 +1044,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate if (StructureComputations(info).IsAsset()) { LINE("") - LINE("LoadAsset_"<<MakeSafeTypeName(info->m_definition)<<"("<<MakeTypePtrVarName(info->m_definition)<<");") + LINE("LoadAsset_" << MakeSafeTypeName(info->m_definition) << "(" << MakeTypePtrVarName(info->m_definition) << ");") } if (inTemp) @@ -1067,12 +1093,13 @@ class ZoneLoadTemplate::Internal final : BaseTemplate void PrintLoadAssetMethod(StructureInformation* info) { - LINE("void " << LoaderClassName(m_env.m_asset) << "::LoadAsset_" << MakeSafeTypeName(info->m_definition) << "(" << info->m_definition->GetFullName() << "** pAsset)") + LINE("void " << LoaderClassName(m_env.m_asset) << "::LoadAsset_" << MakeSafeTypeName(info->m_definition) << "(" << info->m_definition->GetFullName() + << "** pAsset)") LINE("{") m_intendation++; LINE("assert(pAsset != nullptr);") - LINE("m_asset_info = reinterpret_cast<XAssetInfo<"<<info->m_definition->GetFullName()<<">*>(LinkAsset(GetAssetName(*pAsset), *pAsset));") + LINE("m_asset_info = reinterpret_cast<XAssetInfo<" << info->m_definition->GetFullName() << ">*>(LinkAsset(GetAssetName(*pAsset), *pAsset));") LINE("*pAsset = m_asset_info->Asset();") m_intendation--; @@ -1081,7 +1108,8 @@ class ZoneLoadTemplate::Internal final : BaseTemplate void PrintMainLoadMethod() { - LINE("XAssetInfo<" << m_env.m_asset->m_definition->GetFullName() << ">* " << LoaderClassName(m_env.m_asset) << "::Load(" << m_env.m_asset->m_definition->GetFullName() << "** pAsset)") + LINE("XAssetInfo<" << m_env.m_asset->m_definition->GetFullName() << ">* " << LoaderClassName(m_env.m_asset) << "::Load(" + << m_env.m_asset->m_definition->GetFullName() << "** pAsset)") LINE("{") m_intendation++; @@ -1094,7 +1122,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate LINE("") LINE("if(m_asset_info == nullptr && *pAsset != nullptr)") m_intendation++; - LINE("m_asset_info = reinterpret_cast<XAssetInfo<"<<m_env.m_asset->m_definition->GetFullName()<<">*>(GetAssetInfo(GetAssetName(*pAsset)));") + LINE("m_asset_info = reinterpret_cast<XAssetInfo<" << m_env.m_asset->m_definition->GetFullName() << ">*>(GetAssetInfo(GetAssetName(*pAsset)));") m_intendation--; LINE("") LINE("return m_asset_info;") @@ -1119,7 +1147,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate if (first) { first = false; - LINE_MIDDLE("->"<<member->m_member->m_name) + LINE_MIDDLE("->" << member->m_member->m_name) } else { @@ -1130,7 +1158,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate } else { - LINE("return \""<<m_env.m_asset->m_definition->m_name<<"\";") + LINE("return \"" << m_env.m_asset->m_definition->m_name << "\";") } m_intendation--; @@ -1157,7 +1185,8 @@ class ZoneLoadTemplate::Internal final : BaseTemplate LINE("#include \"Game/" << m_env.m_game << "/" << m_env.m_game << ".h\"") if (m_env.m_has_actions) { - LINE("#include \"Game/" << m_env.m_game << "/XAssets/" << Lower(m_env.m_asset->m_definition->m_name) << "/" << Lower(m_env.m_asset->m_definition->m_name) << "_actions.h\"") + LINE("#include \"Game/" << m_env.m_game << "/XAssets/" << Lower(m_env.m_asset->m_definition->m_name) << "/" + << Lower(m_env.m_asset->m_definition->m_name) << "_actions.h\"") } LINE("#include <string>") LINE("") @@ -1168,10 +1197,10 @@ class ZoneLoadTemplate::Internal final : BaseTemplate LINE("{") m_intendation++; - LINE("XAssetInfo<"<<m_env.m_asset->m_definition->GetFullName()<<">* m_asset_info;") + LINE("XAssetInfo<" << m_env.m_asset->m_definition->GetFullName() << ">* m_asset_info;") if (m_env.m_has_actions) { - LINE("Actions_"<<m_env.m_asset->m_definition->m_name<<" m_actions;") + LINE("Actions_" << m_env.m_asset->m_definition->m_name << " m_actions;") } LINE(VariableDecl(m_env.m_asset->m_definition)) LINE(PointerVariableDecl(m_env.m_asset->m_definition)) @@ -1242,7 +1271,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate LINE("// Any changes will be discarded when regenerating.") LINE("// ====================================================================") LINE("") - LINE("#include \""<<Lower(m_env.m_asset->m_definition->m_name)<<"_load_db.h\"") + LINE("#include \"" << Lower(m_env.m_asset->m_definition->m_name) << "_load_db.h\"") LINE("#include <cassert>") LINE("") @@ -1251,7 +1280,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate LINE("// Referenced Assets:") for (auto* type : m_env.m_referenced_assets) { - LINE("#include \"../"<<Lower(type->m_type->m_name)<<"/"<<Lower(type->m_type->m_name)<<"_load_db.h\"") + LINE("#include \"../" << Lower(type->m_type->m_name) << "/" << Lower(type->m_type->m_name) << "_load_db.h\"") } LINE("") } diff --git a/src/ZoneCodeGeneratorLib/Generating/Templates/ZoneWriteTemplate.cpp b/src/ZoneCodeGeneratorLib/Generating/Templates/ZoneWriteTemplate.cpp index 95ed06840..36d503f61 100644 --- a/src/ZoneCodeGeneratorLib/Generating/Templates/ZoneWriteTemplate.cpp +++ b/src/ZoneCodeGeneratorLib/Generating/Templates/ZoneWriteTemplate.cpp @@ -1,12 +1,12 @@ #include "ZoneWriteTemplate.h" +#include "Domain/Computations/StructureComputations.h" +#include "Internal/BaseTemplate.h" + #include <cassert> #include <iostream> #include <sstream> -#include "Domain/Computations/StructureComputations.h" -#include "Internal/BaseTemplate.h" - class ZoneWriteTemplate::Internal final : BaseTemplate { enum class MemberWriteType @@ -86,7 +86,7 @@ class ZoneWriteTemplate::Internal final : BaseTemplate void PrintHeaderConstructor() const { - LINE(WriterClassName(m_env.m_asset) << "("<<m_env.m_asset->m_definition->GetFullName()<<"* asset, Zone* zone, IZoneOutputStream* stream);") + LINE(WriterClassName(m_env.m_asset) << "(" << m_env.m_asset->m_definition->GetFullName() << "* asset, Zone* zone, IZoneOutputStream* stream);") } void PrintVariableInitialization(const DataDefinition* def) const @@ -111,10 +111,12 @@ class ZoneWriteTemplate::Internal final : BaseTemplate void PrintConstructorMethod() { - LINE(WriterClassName(m_env.m_asset) << "::" << WriterClassName(m_env.m_asset) << "("<<m_env.m_asset->m_definition->GetFullName()<<"* asset, Zone* zone, IZoneOutputStream* stream)") + LINE(WriterClassName(m_env.m_asset) << "::" << WriterClassName(m_env.m_asset) << "(" << m_env.m_asset->m_definition->GetFullName() + << "* asset, Zone* zone, IZoneOutputStream* stream)") m_intendation++; - LINE_START(": AssetWriter(zone->m_pools->GetAsset("<<m_env.m_asset->m_asset_enum_entry->m_name<<", GetAssetName(asset))"<<", zone, stream)") + LINE_START(": AssetWriter(zone->m_pools->GetAsset(" << m_env.m_asset->m_asset_enum_entry->m_name << ", GetAssetName(asset))" + << ", zone, stream)") LINE_END("") m_intendation--; @@ -148,12 +150,15 @@ class ZoneWriteTemplate::Internal final : BaseTemplate LINE("}") } - void WriteMember_ScriptString(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, const MemberWriteType writeType) const + void WriteMember_ScriptString(StructureInformation* info, + MemberInformation* member, + const DeclarationModifierComputations& modifier, + const MemberWriteType writeType) const { if (writeType == MemberWriteType::ARRAY_POINTER) { LINE("varScriptString = " << MakeMemberAccess(info, member, modifier) << ";") - LINE("m_stream->MarkFollowing("<<MakeWrittenMemberAccess(info, member, modifier)<<");") + LINE("m_stream->MarkFollowing(" << MakeWrittenMemberAccess(info, member, modifier) << ");") LINE("WriteScriptStringArray(true, " << MakeEvaluation(modifier.GetArrayPointerCountEvaluation()) << ");") } else if (writeType == MemberWriteType::EMBEDDED_ARRAY) @@ -172,11 +177,14 @@ class ZoneWriteTemplate::Internal final : BaseTemplate } } - void WriteMember_Asset(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, const MemberWriteType writeType) const + void WriteMember_Asset(StructureInformation* info, + MemberInformation* member, + const DeclarationModifierComputations& modifier, + const MemberWriteType writeType) const { if (writeType == MemberWriteType::SINGLE_POINTER) { - LINE(WriterClassName(member->m_type) << " writer("<<MakeMemberAccess(info, member, modifier)<<", m_zone, m_stream);") + LINE(WriterClassName(member->m_type) << " writer(" << MakeMemberAccess(info, member, modifier) << ", m_zone, m_stream);") LINE("writer.Write(&" << MakeWrittenMemberAccess(info, member, modifier) << ");") } else if (writeType == MemberWriteType::POINTER_ARRAY) @@ -190,7 +198,10 @@ class ZoneWriteTemplate::Internal final : BaseTemplate } } - void WriteMember_String(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, const MemberWriteType writeType) const + void WriteMember_String(StructureInformation* info, + MemberInformation* member, + const DeclarationModifierComputations& modifier, + const MemberWriteType writeType) const { if (writeType == MemberWriteType::SINGLE_POINTER) { @@ -232,12 +243,14 @@ class ZoneWriteTemplate::Internal final : BaseTemplate if (member->m_type && !member->m_type->m_is_leaf && !computations.IsInRuntimeBlock()) { LINE(MakeTypeVarName(member->m_member->m_type_declaration->m_type) << " = " << MakeMemberAccess(info, member, modifier) << ";") - LINE("WriteArray_" << MakeSafeTypeName(member->m_member->m_type_declaration->m_type) << "(true, " << MakeEvaluation(modifier.GetArrayPointerCountEvaluation()) << ");") + LINE("WriteArray_" << MakeSafeTypeName(member->m_member->m_type_declaration->m_type) << "(true, " + << MakeEvaluation(modifier.GetArrayPointerCountEvaluation()) << ");") } else { - LINE("m_stream->Write<" << MakeTypeDecl(member->m_member->m_type_declaration.get()) << MakeFollowingReferences(modifier.GetFollowingDeclarationModifiers()) - << ">(" << MakeMemberAccess(info, member, modifier) << ", " << MakeEvaluation(modifier.GetArrayPointerCountEvaluation()) << ");") + LINE("m_stream->Write<" << MakeTypeDecl(member->m_member->m_type_declaration.get()) + << MakeFollowingReferences(modifier.GetFollowingDeclarationModifiers()) << ">(" << MakeMemberAccess(info, member, modifier) + << ", " << MakeEvaluation(modifier.GetArrayPointerCountEvaluation()) << ");") } } @@ -252,7 +265,8 @@ class ZoneWriteTemplate::Internal final : BaseTemplate else { LINE("m_stream->MarkFollowing(" << MakeWrittenMemberAccess(info, member, modifier) << ");") - LINE("WritePtrArray_" << MakeSafeTypeName(member->m_member->m_type_declaration->m_type) << "(true, " << MakeEvaluation(modifier.GetPointerArrayCountEvaluation()) << ");") + LINE("WritePtrArray_" << MakeSafeTypeName(member->m_member->m_type_declaration->m_type) << "(true, " + << MakeEvaluation(modifier.GetPointerArrayCountEvaluation()) << ");") } } @@ -270,7 +284,7 @@ class ZoneWriteTemplate::Internal final : BaseTemplate { if (computations.IsAfterPartialLoad()) { - LINE(MakeTypeVarName(member->m_member->m_type_declaration->m_type)<<" = "<< MakeMemberAccess(info, member, modifier) <<";") + LINE(MakeTypeVarName(member->m_member->m_type_declaration->m_type) << " = " << MakeMemberAccess(info, member, modifier) << ";") LINE("WriteArray_" << MakeSafeTypeName(member->m_member->m_type_declaration->m_type) << "(true, " << arraySizeStr << ");") } else @@ -282,8 +296,9 @@ class ZoneWriteTemplate::Internal final : BaseTemplate } else if (computations.IsAfterPartialLoad()) { - LINE("m_stream->Write<" << MakeTypeDecl(member->m_member->m_type_declaration.get()) << MakeFollowingReferences(modifier.GetFollowingDeclarationModifiers()) - << ">(" << MakeMemberAccess(info, member, modifier) << ", " << arraySizeStr << ");") + LINE("m_stream->Write<" << MakeTypeDecl(member->m_member->m_type_declaration.get()) + << MakeFollowingReferences(modifier.GetFollowingDeclarationModifiers()) << ">(" << MakeMemberAccess(info, member, modifier) + << ", " << arraySizeStr << ");") } } @@ -292,12 +307,14 @@ class ZoneWriteTemplate::Internal final : BaseTemplate if (member->m_type && !member->m_type->m_is_leaf) { LINE(MakeTypeVarName(member->m_member->m_type_declaration->m_type) << " = " << MakeMemberAccess(info, member, modifier) << ";") - LINE("WriteArray_" << MakeSafeTypeName(member->m_member->m_type_declaration->m_type) << "(true, " << MakeEvaluation(modifier.GetDynamicArraySizeEvaluation()) << ");") + LINE("WriteArray_" << MakeSafeTypeName(member->m_member->m_type_declaration->m_type) << "(true, " + << MakeEvaluation(modifier.GetDynamicArraySizeEvaluation()) << ");") } else { - LINE("m_stream->Write<" << MakeTypeDecl(member->m_member->m_type_declaration.get()) << MakeFollowingReferences(modifier.GetFollowingDeclarationModifiers()) - << ">(" << MakeMemberAccess(info, member, modifier) << ", " << MakeEvaluation(modifier.GetDynamicArraySizeEvaluation()) << ");") + LINE("m_stream->Write<" << MakeTypeDecl(member->m_member->m_type_declaration.get()) + << MakeFollowingReferences(modifier.GetFollowingDeclarationModifiers()) << ">(" << MakeMemberAccess(info, member, modifier) + << ", " << MakeEvaluation(modifier.GetDynamicArraySizeEvaluation()) << ");") } } @@ -321,8 +338,9 @@ class ZoneWriteTemplate::Internal final : BaseTemplate } else if (computations.IsAfterPartialLoad()) { - LINE("m_stream->Write<" << MakeTypeDecl(member->m_member->m_type_declaration.get()) << MakeFollowingReferences(modifier.GetFollowingDeclarationModifiers()) - << ">(&" << MakeMemberAccess(info, member, modifier) << ");") + LINE("m_stream->Write<" << MakeTypeDecl(member->m_member->m_type_declaration.get()) + << MakeFollowingReferences(modifier.GetFollowingDeclarationModifiers()) << ">(&" << MakeMemberAccess(info, member, modifier) + << ");") } } @@ -337,12 +355,16 @@ class ZoneWriteTemplate::Internal final : BaseTemplate } else { - LINE("m_stream->Write<" << MakeTypeDecl(member->m_member->m_type_declaration.get()) << MakeFollowingReferences(modifier.GetFollowingDeclarationModifiers()) - << ">(" << MakeMemberAccess(info, member, modifier) << ");") + LINE("m_stream->Write<" << MakeTypeDecl(member->m_member->m_type_declaration.get()) + << MakeFollowingReferences(modifier.GetFollowingDeclarationModifiers()) << ">(" << MakeMemberAccess(info, member, modifier) + << ");") } } - void WriteMember_TypeCheck(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, const MemberWriteType writeType) const + void WriteMember_TypeCheck(StructureInformation* info, + MemberInformation* member, + const DeclarationModifierComputations& modifier, + const MemberWriteType writeType) const { if (member->m_is_string) { @@ -391,17 +413,17 @@ class ZoneWriteTemplate::Internal final : BaseTemplate } } - static bool WriteMember_ShouldMakeInsertReuse(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, const MemberWriteType writeType) + static bool WriteMember_ShouldMakeInsertReuse(StructureInformation* info, + MemberInformation* member, + const DeclarationModifierComputations& modifier, + const MemberWriteType writeType) { - if (writeType != MemberWriteType::ARRAY_POINTER - && writeType != MemberWriteType::SINGLE_POINTER - && writeType != MemberWriteType::POINTER_ARRAY) + if (writeType != MemberWriteType::ARRAY_POINTER && writeType != MemberWriteType::SINGLE_POINTER && writeType != MemberWriteType::POINTER_ARRAY) { return false; } - if (writeType == MemberWriteType::POINTER_ARRAY - && modifier.IsArray()) + if (writeType == MemberWriteType::POINTER_ARRAY && modifier.IsArray()) { return false; } @@ -425,7 +447,10 @@ class ZoneWriteTemplate::Internal final : BaseTemplate return true; } - void WriteMember_InsertReuse(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, const MemberWriteType writeType) + void WriteMember_InsertReuse(StructureInformation* info, + MemberInformation* member, + const DeclarationModifierComputations& modifier, + const MemberWriteType writeType) { if (!WriteMember_ShouldMakeInsertReuse(info, member, modifier, writeType)) { @@ -435,7 +460,8 @@ class ZoneWriteTemplate::Internal final : BaseTemplate if (writeType == MemberWriteType::ARRAY_POINTER) { - LINE("m_stream->ReusableAddOffset("<<MakeMemberAccess(info, member, modifier)<<", "<<MakeEvaluation(modifier.GetArrayPointerCountEvaluation())<<");") + LINE("m_stream->ReusableAddOffset(" << MakeMemberAccess(info, member, modifier) << ", " << MakeEvaluation(modifier.GetArrayPointerCountEvaluation()) + << ");") } else if (writeType == MemberWriteType::POINTER_ARRAY) { @@ -443,7 +469,8 @@ class ZoneWriteTemplate::Internal final : BaseTemplate if (evaluation) { - LINE("m_stream->ReusableAddOffset(" << MakeMemberAccess(info, member, modifier) << ", " << MakeEvaluation(modifier.GetPointerArrayCountEvaluation()) << ");") + LINE("m_stream->ReusableAddOffset(" << MakeMemberAccess(info, member, modifier) << ", " + << MakeEvaluation(modifier.GetPointerArrayCountEvaluation()) << ");") } else { @@ -452,17 +479,18 @@ class ZoneWriteTemplate::Internal final : BaseTemplate } else { - LINE("m_stream->ReusableAddOffset("<<MakeMemberAccess(info, member, modifier)<<");") + LINE("m_stream->ReusableAddOffset(" << MakeMemberAccess(info, member, modifier) << ");") } WriteMember_TypeCheck(info, member, modifier, writeType); } - static bool WriteMember_ShouldMakeAlign(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, const MemberWriteType writeType) + static bool WriteMember_ShouldMakeAlign(StructureInformation* info, + MemberInformation* member, + const DeclarationModifierComputations& modifier, + const MemberWriteType writeType) { - if (writeType != MemberWriteType::ARRAY_POINTER - && writeType != MemberWriteType::POINTER_ARRAY - && writeType != MemberWriteType::SINGLE_POINTER) + if (writeType != MemberWriteType::ARRAY_POINTER && writeType != MemberWriteType::POINTER_ARRAY && writeType != MemberWriteType::SINGLE_POINTER) { return false; } @@ -485,7 +513,10 @@ class ZoneWriteTemplate::Internal final : BaseTemplate return true; } - void WriteMember_Align(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, const MemberWriteType writeType) + void WriteMember_Align(StructureInformation* info, + MemberInformation* member, + const DeclarationModifierComputations& modifier, + const MemberWriteType writeType) { if (!WriteMember_ShouldMakeAlign(info, member, modifier, writeType)) { @@ -498,27 +529,27 @@ class ZoneWriteTemplate::Internal final : BaseTemplate if (member->m_alloc_alignment) { - LINE("m_stream->Align("<<MakeEvaluation(member->m_alloc_alignment.get())<<");") + LINE("m_stream->Align(" << MakeEvaluation(member->m_alloc_alignment.get()) << ");") } else { - LINE("m_stream->Align("<<modifier.GetAlignment()<<");") + LINE("m_stream->Align(" << modifier.GetAlignment() << ");") } WriteMember_InsertReuse(info, member, modifier, writeType); } - static bool WriteMember_ShouldMakeReuse(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, const MemberWriteType writeType) + static bool WriteMember_ShouldMakeReuse(StructureInformation* info, + MemberInformation* member, + const DeclarationModifierComputations& modifier, + const MemberWriteType writeType) { - if (writeType != MemberWriteType::ARRAY_POINTER - && writeType != MemberWriteType::SINGLE_POINTER - && writeType != MemberWriteType::POINTER_ARRAY) + if (writeType != MemberWriteType::ARRAY_POINTER && writeType != MemberWriteType::SINGLE_POINTER && writeType != MemberWriteType::POINTER_ARRAY) { return false; } - if (writeType == MemberWriteType::POINTER_ARRAY - && modifier.IsArray()) + if (writeType == MemberWriteType::POINTER_ARRAY && modifier.IsArray()) { return false; } @@ -526,7 +557,10 @@ class ZoneWriteTemplate::Internal final : BaseTemplate return member->m_is_reusable; } - void WriteMember_Reuse(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, const MemberWriteType writeType) + void WriteMember_Reuse(StructureInformation* info, + MemberInformation* member, + const DeclarationModifierComputations& modifier, + const MemberWriteType writeType) { if (!WriteMember_ShouldMakeReuse(info, member, modifier, writeType)) { @@ -544,11 +578,12 @@ class ZoneWriteTemplate::Internal final : BaseTemplate LINE("}") } - static bool WriteMember_ShouldMakePointerCheck(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, const MemberWriteType writeType) + static bool WriteMember_ShouldMakePointerCheck(StructureInformation* info, + MemberInformation* member, + const DeclarationModifierComputations& modifier, + const MemberWriteType writeType) { - if (writeType != MemberWriteType::ARRAY_POINTER - && writeType != MemberWriteType::POINTER_ARRAY - && writeType != MemberWriteType::SINGLE_POINTER) + if (writeType != MemberWriteType::ARRAY_POINTER && writeType != MemberWriteType::POINTER_ARRAY && writeType != MemberWriteType::SINGLE_POINTER) { return false; } @@ -566,7 +601,10 @@ class ZoneWriteTemplate::Internal final : BaseTemplate return true; } - void WriteMember_PointerCheck(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, const MemberWriteType writeType) + void WriteMember_PointerCheck(StructureInformation* info, + MemberInformation* member, + const DeclarationModifierComputations& modifier, + const MemberWriteType writeType) { if (WriteMember_ShouldMakePointerCheck(info, member, modifier, writeType)) { @@ -752,10 +790,7 @@ class ZoneWriteTemplate::Internal final : BaseTemplate if (computations.ShouldIgnore()) return; - if (member->m_is_string - || member->m_is_script_string - || computations.ContainsNonEmbeddedReference() - || member->m_type && !member->m_type->m_is_leaf + if (member->m_is_string || member->m_is_script_string || computations.ContainsNonEmbeddedReference() || member->m_type && !member->m_type->m_is_leaf || computations.IsAfterPartialLoad()) { if (info->m_definition->GetType() == DataDefinitionType::UNION) @@ -783,13 +818,14 @@ class ZoneWriteTemplate::Internal final : BaseTemplate if (dynamicMember == nullptr) { - LINE(MakeTypeWrittenVarName(info->m_definition)<<" = m_stream->Write<" << info->m_definition->GetFullName() << ">(" << MakeTypeVarName(info->m_definition) << "); // Size: " - << info->m_definition->GetSize()) + LINE(MakeTypeWrittenVarName(info->m_definition) << " = m_stream->Write<" << info->m_definition->GetFullName() << ">(" + << MakeTypeVarName(info->m_definition) << "); // Size: " << info->m_definition->GetSize()) } else { - LINE(MakeTypeWrittenVarName(info->m_definition) << " = m_stream->WritePartial<" << info->m_definition->GetFullName() << ">(" << MakeTypeVarName(info->m_definition) << ", offsetof(" << - info->m_definition->GetFullName() << ", " << dynamicMember->m_member->m_name << "));") + LINE(MakeTypeWrittenVarName(info->m_definition) + << " = m_stream->WritePartial<" << info->m_definition->GetFullName() << ">(" << MakeTypeVarName(info->m_definition) << ", offsetof(" + << info->m_definition->GetFullName() << ", " << dynamicMember->m_member->m_name << "));") } m_intendation--; @@ -840,7 +876,8 @@ class ZoneWriteTemplate::Internal final : BaseTemplate LINE("if(atStreamStart)") m_intendation++; - LINE(MakeTypeWrittenPtrVarName(info->m_definition)<<" = m_stream->Write<" << info->m_definition->GetFullName() << "*>(" << MakeTypePtrVarName(info->m_definition) << ");") + LINE(MakeTypeWrittenPtrVarName(info->m_definition) + << " = m_stream->Write<" << info->m_definition->GetFullName() << "*>(" << MakeTypePtrVarName(info->m_definition) << ");") m_intendation--; LINE("") @@ -857,7 +894,7 @@ class ZoneWriteTemplate::Internal final : BaseTemplate m_intendation++; LINE("m_stream->Align(" << info->m_definition->GetAlignment() << ");") - LINE("m_stream->ReusableAddOffset(*"<<MakeTypePtrVarName(info->m_definition)<<");") + LINE("m_stream->ReusableAddOffset(*" << MakeTypePtrVarName(info->m_definition) << ");") LINE("") if (!info->m_is_leaf) { @@ -870,7 +907,7 @@ class ZoneWriteTemplate::Internal final : BaseTemplate } LINE("") - LINE("m_stream->MarkFollowing(*"<<MakeTypeWrittenPtrVarName(info->m_definition)<<");") + LINE("m_stream->MarkFollowing(*" << MakeTypeWrittenPtrVarName(info->m_definition) << ");") m_intendation--; LINE("}") @@ -895,7 +932,7 @@ class ZoneWriteTemplate::Internal final : BaseTemplate LINE("assert(m_asset != nullptr);") LINE("assert(m_asset->m_ptr != nullptr);") LINE("") - LINE("auto* zoneAsset = static_cast<"<<m_env.m_asset->m_definition->GetFullName()<<"*>(m_asset->m_ptr);") + LINE("auto* zoneAsset = static_cast<" << m_env.m_asset->m_definition->GetFullName() << "*>(m_asset->m_ptr);") LINE(MakeTypePtrVarName(m_env.m_asset->m_definition) << " = &zoneAsset;") LINE(MakeTypeWrittenPtrVarName(m_env.m_asset->m_definition) << " = &zoneAsset;") LINE("WritePtr_" << MakeSafeTypeName(m_env.m_asset->m_definition) << "(false);") @@ -941,11 +978,11 @@ class ZoneWriteTemplate::Internal final : BaseTemplate void PrintWritePtrArrayMethod_Loading(const DataDefinition* def, StructureInformation* info, const bool reusable) const { - LINE("m_stream->Align("<<def->GetAlignment()<<");") + LINE("m_stream->Align(" << def->GetAlignment() << ");") if (reusable) { - LINE("m_stream->ReusableAddOffset(*"<<MakeTypePtrVarName(def)<< ");") + LINE("m_stream->ReusableAddOffset(*" << MakeTypePtrVarName(def) << ");") } if (info && !info->m_is_leaf) @@ -957,7 +994,7 @@ class ZoneWriteTemplate::Internal final : BaseTemplate { LINE("m_stream->Write<" << def->GetFullName() << ">(*" << MakeTypePtrVarName(def) << ");") } - LINE("m_stream->MarkFollowing(*"<< MakeTypeWrittenPtrVarName(def)<<");") + LINE("m_stream->MarkFollowing(*" << MakeTypeWrittenPtrVarName(def) << ");") } void PrintWritePtrArrayMethod_PointerCheck(const DataDefinition* def, StructureInformation* info, const bool reusable) @@ -968,7 +1005,7 @@ class ZoneWriteTemplate::Internal final : BaseTemplate if (info && StructureComputations(info).IsAsset()) { - LINE(WriterClassName(info) << " writer(*"<< MakeTypePtrVarName(def)<<", m_zone, m_stream);") + LINE(WriterClassName(info) << " writer(*" << MakeTypePtrVarName(def) << ", m_zone, m_stream);") LINE("writer.Write(" << MakeTypeWrittenPtrVarName(def) << ");") } else @@ -1005,7 +1042,7 @@ class ZoneWriteTemplate::Internal final : BaseTemplate LINE("if(atStreamStart)") m_intendation++; - LINE(MakeTypeWrittenPtrVarName(def)<<" = m_stream->Write<" << def->GetFullName() << "*>(" << MakeTypePtrVarName(def) << ", count);") + LINE(MakeTypeWrittenPtrVarName(def) << " = m_stream->Write<" << def->GetFullName() << "*>(" << MakeTypePtrVarName(def) << ", count);") m_intendation--; LINE("") @@ -1041,7 +1078,7 @@ class ZoneWriteTemplate::Internal final : BaseTemplate LINE("") LINE("if(atStreamStart)") m_intendation++; - LINE(MakeTypeWrittenVarName(def)<<" = m_stream->Write<" << def->GetFullName() << ">(" << MakeTypeVarName(def) << ", count);") + LINE(MakeTypeWrittenVarName(def) << " = m_stream->Write<" << def->GetFullName() << ">(" << MakeTypeVarName(def) << ", count);") m_intendation--; LINE("") diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/CommandsFileReader.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/CommandsFileReader.cpp index c9bd679d4..fd9d8c62c 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/CommandsFileReader.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/CommandsFileReader.cpp @@ -1,9 +1,5 @@ #include "CommandsFileReader.h" -#include <algorithm> -#include <chrono> -#include <iostream> - #include "Impl/CommandsLexer.h" #include "Impl/CommandsParser.h" #include "Parsing/Impl/CommentRemovingStreamProxy.h" @@ -16,6 +12,10 @@ #include "Parsing/PostProcessing/UnionsPostProcessor.h" #include "Parsing/PostProcessing/UsagesPostProcessor.h" +#include <algorithm> +#include <chrono> +#include <iostream> + CommandsFileReader::CommandsFileReader(const ZoneCodeGeneratorArguments* args, std::string filename) : m_args(args), m_filename(std::move(filename)), @@ -64,7 +64,7 @@ void CommandsFileReader::SetupPostProcessors() bool CommandsFileReader::ReadCommandsFile(IDataRepository* repository) { - if(m_args->m_verbose) + if (m_args->m_verbose) { std::cout << "Reading commands file: " << m_filename << std::endl; } @@ -81,7 +81,7 @@ bool CommandsFileReader::ReadCommandsFile(IDataRepository* repository) const auto result = parser->Parse(); const auto end = std::chrono::steady_clock::now(); - if(m_args->m_verbose) + if (m_args->m_verbose) { std::cout << "Processing commands took " << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() << "ms" << std::endl; } @@ -89,8 +89,10 @@ bool CommandsFileReader::ReadCommandsFile(IDataRepository* repository) if (!result) return false; - return std::all_of(m_post_processors.begin(), m_post_processors.end(), [repository](const std::unique_ptr<IPostProcessor>& postProcessor) - { - return postProcessor->PostProcess(repository); - }); + return std::all_of(m_post_processors.begin(), + m_post_processors.end(), + [repository](const std::unique_ptr<IPostProcessor>& postProcessor) + { + return postProcessor->PostProcess(repository); + }); } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/CommandsFileReader.h b/src/ZoneCodeGeneratorLib/Parsing/Commands/CommandsFileReader.h index bfe77f607..dafae4562 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/CommandsFileReader.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/CommandsFileReader.h @@ -1,11 +1,11 @@ #pragma once -#include <string> - -#include "ZoneCodeGeneratorArguments.h" #include "Parsing/IParserLineStream.h" #include "Parsing/PostProcessing/IPostProcessor.h" #include "Persistence/IDataRepository.h" +#include "ZoneCodeGeneratorArguments.h" + +#include <string> class CommandsFileReader { diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Impl/CommandsParser.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Impl/CommandsParser.cpp index 610dde7f4..4f634b577 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Impl/CommandsParser.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Impl/CommandsParser.cpp @@ -26,25 +26,23 @@ CommandsParser::CommandsParser(CommandsLexer* lexer, IDataRepository* targetRepo const std::vector<CommandsParser::sequence_t*>& CommandsParser::GetTestsForState() { - static std::vector<sequence_t*> tests({ - new SequenceAction(), - new SequenceAllocAlign(), - new SequenceArchitecture(), - new SequenceArrayCount(), - new SequenceArraySize(), - new SequenceAsset(), - new SequenceBlock(), - new SequenceCondition(), - new SequenceCount(), - new SequenceGame(), - new SequenceName(), - new SequenceReorder(), - new SequenceReusable(), - new SequenceScriptString(), - new SequenceSetBlock(), - new SequenceString(), - new SequenceUse() - }); + static std::vector<sequence_t*> tests({new SequenceAction(), + new SequenceAllocAlign(), + new SequenceArchitecture(), + new SequenceArrayCount(), + new SequenceArraySize(), + new SequenceAsset(), + new SequenceBlock(), + new SequenceCondition(), + new SequenceCount(), + new SequenceGame(), + new SequenceName(), + new SequenceReorder(), + new SequenceReusable(), + new SequenceScriptString(), + new SequenceSetBlock(), + new SequenceString(), + new SequenceUse()}); return tests; } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Impl/CommandsParserState.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Impl/CommandsParserState.cpp index e7ba6ebd5..75f6c66ba 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Impl/CommandsParserState.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Impl/CommandsParserState.cpp @@ -54,8 +54,7 @@ bool CommandsParserState::GetNextTypenameSeparatorPos(const std::string& typeNam const auto typeNameValueSize = typeNameValue.size(); for (auto currentHead = startPos + 1; currentHead < typeNameValueSize; currentHead++) { - if (typeNameValue[currentHead] == ':' - && typeNameValue[currentHead - 1] == ':') + if (typeNameValue[currentHead] == ':' && typeNameValue[currentHead - 1] == ':') { separatorPos = currentHead - 1; return true; @@ -65,7 +64,10 @@ bool CommandsParserState::GetNextTypenameSeparatorPos(const std::string& typeNam return false; } -bool CommandsParserState::ExtractMembersFromTypenameInternal(const std::string& typeNameValue, unsigned typeNameOffset, StructureInformation* type, std::vector<MemberInformation*>& members) +bool CommandsParserState::ExtractMembersFromTypenameInternal(const std::string& typeNameValue, + unsigned typeNameOffset, + StructureInformation* type, + std::vector<MemberInformation*>& members) { auto startOffset = typeNameOffset; while (GetNextTypenameSeparatorPos(typeNameValue, typeNameOffset, typeNameOffset)) @@ -89,13 +91,17 @@ bool CommandsParserState::ExtractMembersFromTypenameInternal(const std::string& return true; } -bool CommandsParserState::GetMembersFromTypename(const std::string& typeNameValue, StructureInformation* baseType, std::vector<MemberInformation*>& members) const +bool CommandsParserState::GetMembersFromTypename(const std::string& typeNameValue, + StructureInformation* baseType, + std::vector<MemberInformation*>& members) const { return m_in_use != nullptr && ExtractMembersFromTypenameInternal(typeNameValue, 0, m_in_use, members) - || ExtractMembersFromTypenameInternal(typeNameValue, 0, baseType, members); + || ExtractMembersFromTypenameInternal(typeNameValue, 0, baseType, members); } -bool CommandsParserState::GetTypenameAndMembersFromTypename(const std::string& typeNameValue, StructureInformation*& structure, std::vector<MemberInformation*>& members) const +bool CommandsParserState::GetTypenameAndMembersFromTypename(const std::string& typeNameValue, + StructureInformation*& structure, + std::vector<MemberInformation*>& members) const { if (m_in_use != nullptr) { diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Impl/CommandsParserState.h b/src/ZoneCodeGeneratorLib/Parsing/Commands/Impl/CommandsParserState.h index c23b3c807..3453b5f44 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Impl/CommandsParserState.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Impl/CommandsParserState.h @@ -1,11 +1,11 @@ #pragma once +#include "Persistence/IDataRepository.h" +#include "Utils/ClassUtils.h" + #include <memory> #include <string> -#include "Utils/ClassUtils.h" -#include "Persistence/IDataRepository.h" - class CommandsParserState { IDataRepository* m_repository; @@ -13,7 +13,10 @@ class CommandsParserState static MemberInformation* GetMemberWithName(const std::string& memberName, StructureInformation* type); static bool GetNextTypenameSeparatorPos(const std::string& typeNameValue, unsigned startPos, unsigned& separatorPos); - static bool ExtractMembersFromTypenameInternal(const std::string& typeNameValue, unsigned typeNameOffset, StructureInformation* type, std::vector<MemberInformation*>& members); + static bool ExtractMembersFromTypenameInternal(const std::string& typeNameValue, + unsigned typeNameOffset, + StructureInformation* type, + std::vector<MemberInformation*>& members); public: explicit CommandsParserState(IDataRepository* repository); diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Impl/CommandsParserValue.h b/src/ZoneCodeGeneratorLib/Parsing/Commands/Impl/CommandsParserValue.h index 9ef0c204b..a53392d2e 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Impl/CommandsParserValue.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Impl/CommandsParserValue.h @@ -1,11 +1,11 @@ #pragma once -#include <string> - #include "Domain/Evaluation/OperationType.h" #include "Parsing/IParserValue.h" -#include "Utils/ClassUtils.h" #include "Parsing/TokenPos.h" +#include "Utils/ClassUtils.h" + +#include <string> enum class CommandsParserValueType { @@ -55,6 +55,7 @@ class CommandsParserValue final : public IParserValue TokenPos m_pos; CommandsParserValueType m_type; size_t m_hash; + union ValueType { char char_value; @@ -103,4 +104,4 @@ class CommandsParserValue final : public IParserValue _NODISCARD size_t IdentifierHash() const; _NODISCARD std::string& TypeNameValue() const; _NODISCARD const OperationType* OpTypeValue() const; -}; \ No newline at end of file +}; diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsCommonMatchers.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsCommonMatchers.cpp index d95a6fa0f..c25d4a376 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsCommonMatchers.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsCommonMatchers.cpp @@ -1,95 +1,74 @@ #include "CommandsCommonMatchers.h" -#include <list> -#include <sstream> -#include <vector> -#include <type_traits> - #include "CommandsMatcherFactory.h" #include "Domain/Evaluation/OperandDynamic.h" #include "Domain/Evaluation/OperandStatic.h" #include "Domain/Evaluation/Operation.h" +#include <list> +#include <sstream> +#include <type_traits> +#include <vector> + std::unique_ptr<CommandsCommonMatchers::matcher_t> CommandsCommonMatchers::Typename(const supplier_t* labelSupplier) { - static constexpr const char* BUILT_IN_TYPE_NAMES[] - { - "unsigned", - "char", - "short", - "int", - "long" - }; - static_assert(std::extent<decltype(BUILT_IN_TYPE_NAMES)>::value == static_cast<int>(CommandsParserValueType::BUILT_IN_LAST) - static_cast<int>(CommandsParserValueType::BUILT_IN_FIRST) + 1); + static constexpr const char* BUILT_IN_TYPE_NAMES[]{"unsigned", "char", "short", "int", "long"}; + static_assert(std::extent<decltype(BUILT_IN_TYPE_NAMES)>::value + == static_cast<int>(CommandsParserValueType::BUILT_IN_LAST) - static_cast<int>(CommandsParserValueType::BUILT_IN_FIRST) + 1); const CommandsMatcherFactory create(labelSupplier); - return create.Or({ - create.And({ - create.Optional(create.Type(CommandsParserValueType::UNSIGNED)), - create.Or({ - create.Type(CommandsParserValueType::CHAR), - create.Type(CommandsParserValueType::SHORT), - create.Type(CommandsParserValueType::INT), - create.And({ - create.Type(CommandsParserValueType::LONG), - create.Optional(create.Type(CommandsParserValueType::LONG)) - }) - }) - }).Transform([](CommandsMatcherFactory::token_list_t& values) - { - std::ostringstream str; - auto first = true; - - for (const auto& token : values) - { - if (first) - first = false; - else - str << " "; - str << BUILT_IN_TYPE_NAMES[static_cast<int>(token.get().m_type) - static_cast<int>(CommandsParserValueType::BUILT_IN_FIRST)]; - } - - return CommandsParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); - }), - create.And({ - create.Identifier(), - create.OptionalLoop(create.And({ - create.Char(':'), - create.Char(':'), - create.Identifier() - })) - }).Transform([](CommandsMatcherFactory::token_list_t& values) - { - std::ostringstream str; - str << values[0].get().IdentifierValue(); - - for (auto i = 3u; i < values.size(); i += 3) - str << "::" << values[i].get().IdentifierValue(); - - return CommandsParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); - }) - }); + return create.Or( + {create + .And({create.Optional(create.Type(CommandsParserValueType::UNSIGNED)), + create.Or({create.Type(CommandsParserValueType::CHAR), + create.Type(CommandsParserValueType::SHORT), + create.Type(CommandsParserValueType::INT), + create.And({create.Type(CommandsParserValueType::LONG), create.Optional(create.Type(CommandsParserValueType::LONG))})})}) + .Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + std::ostringstream str; + auto first = true; + + for (const auto& token : values) + { + if (first) + first = false; + else + str << " "; + str << BUILT_IN_TYPE_NAMES[static_cast<int>(token.get().m_type) - static_cast<int>(CommandsParserValueType::BUILT_IN_FIRST)]; + } + + return CommandsParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); + }), + create.And({create.Identifier(), create.OptionalLoop(create.And({create.Char(':'), create.Char(':'), create.Identifier()}))}) + .Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + std::ostringstream str; + str << values[0].get().IdentifierValue(); + + for (auto i = 3u; i < values.size(); i += 3) + str << "::" << values[i].get().IdentifierValue(); + + return CommandsParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); + })}); } std::unique_ptr<CommandsCommonMatchers::matcher_t> CommandsCommonMatchers::ArrayDef(const supplier_t* labelSupplier) { const CommandsMatcherFactory create(labelSupplier); - return create.And({ - create.Char('['), - create.Or({ - create.Integer(), - create.Identifier() - }), - create.Char(']') - }).Transform([](CommandsMatcherFactory::token_list_t& values) - { - if (values[1].get().m_type == CommandsParserValueType::INTEGER) - return CommandsParserValue::Integer(values[1].get().GetPos(), values[1].get().IntegerValue()); + return create.And({create.Char('['), create.Or({create.Integer(), create.Identifier()}), create.Char(']')}) + .Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + if (values[1].get().m_type == CommandsParserValueType::INTEGER) + return CommandsParserValue::Integer(values[1].get().GetPos(), values[1].get().IntegerValue()); - return CommandsParserValue::Identifier(values[1].get().GetPos(), new std::string(values[1].get().IdentifierValue())); - }); + return CommandsParserValue::Identifier(values[1].get().GetPos(), new std::string(values[1].get().IdentifierValue())); + }); } static constexpr int TAG_OPERAND = std::numeric_limits<int>::max() - 1; @@ -112,125 +91,142 @@ std::unique_ptr<CommandsCommonMatchers::matcher_t> CommandsCommonMatchers::Parse { const CommandsMatcherFactory create(labelSupplier); - return create.And({ - create.Char('['), - create.Label(LABEL_EVALUATION), - create.Char(']').Tag(TAG_OPERAND_ARRAY_END) - }).Tag(TAG_OPERAND_ARRAY); + return create.And({create.Char('['), create.Label(LABEL_EVALUATION), create.Char(']').Tag(TAG_OPERAND_ARRAY_END)}).Tag(TAG_OPERAND_ARRAY); } std::unique_ptr<CommandsCommonMatchers::matcher_t> CommandsCommonMatchers::ParseOperand(const supplier_t* labelSupplier) { const CommandsMatcherFactory create(labelSupplier); - return create.Or({ - create.And({ - create.Label(LABEL_TYPENAME).Capture(CAPTURE_OPERAND_TYPENAME), - create.OptionalLoop(MatcherFactoryWrapper<CommandsParserValue>(ParseOperandArray(labelSupplier)).Capture(CAPTURE_OPERAND_ARRAY)) - }).Tag(TAG_OPERAND_TYPENAME), - create.Integer().Tag(TAG_OPERAND_INTEGER).Capture(CAPTURE_OPERAND_INTEGER) - }).Tag(TAG_OPERAND); + return create + .Or({create + .And({create.Label(LABEL_TYPENAME).Capture(CAPTURE_OPERAND_TYPENAME), + create.OptionalLoop(MatcherFactoryWrapper<CommandsParserValue>(ParseOperandArray(labelSupplier)).Capture(CAPTURE_OPERAND_ARRAY))}) + .Tag(TAG_OPERAND_TYPENAME), + create.Integer().Tag(TAG_OPERAND_INTEGER).Capture(CAPTURE_OPERAND_INTEGER)}) + .Tag(TAG_OPERAND); } std::unique_ptr<CommandsCommonMatchers::matcher_t> CommandsCommonMatchers::ParseOperationType(const supplier_t* labelSupplier) { const CommandsMatcherFactory create(labelSupplier); - return create.Or({ - create.Char('+').Transform([](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_ADD); - }), - create.Char('-').Transform([](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_SUBTRACT); - }), - create.Char('*').Transform([](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_MULTIPLY); - }), - create.Char('/').Transform([](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_DIVIDE); - }), - create.Char('%').Transform([](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_REMAINDER); - }), - create.Char('&').Transform([](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_BITWISE_AND); - }), - create.Char('^').Transform([](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_BITWISE_XOR); - }), - create.Char('|').Transform([](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_BITWISE_OR); - }), - create.Type(CommandsParserValueType::SHIFT_LEFT).Transform([](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_SHIFT_LEFT); - }), - create.Type(CommandsParserValueType::SHIFT_RIGHT).Transform([](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_SHIFT_RIGHT); - }), - create.Char('>').Transform([](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_GREATER_THAN); - }), - create.Type(CommandsParserValueType::GREATER_EQUAL).Transform([](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_GREATER_EQUAL_THAN); - }), - create.Char('<').Transform([](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_LESS_THAN); - }), - create.Type(CommandsParserValueType::LESS_EQUAL).Transform([](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_LESS_EQUAL_THAN); - }), - create.Type(CommandsParserValueType::EQUALS).Transform([](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_EQUALS); - }), - create.Type(CommandsParserValueType::NOT_EQUAL).Transform([](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_NOT_EQUAL); - }), - create.Type(CommandsParserValueType::LOGICAL_AND).Transform([](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_AND); - }), - create.Type(CommandsParserValueType::LOGICAL_OR).Transform([](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_OR); - }) - }).Capture(CAPTURE_BINARY_OPERATION_TYPE); + return create + .Or({create.Char('+').Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_ADD); + }), + create.Char('-').Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_SUBTRACT); + }), + create.Char('*').Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_MULTIPLY); + }), + create.Char('/').Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_DIVIDE); + }), + create.Char('%').Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_REMAINDER); + }), + create.Char('&').Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_BITWISE_AND); + }), + create.Char('^').Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_BITWISE_XOR); + }), + create.Char('|').Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_BITWISE_OR); + }), + create.Type(CommandsParserValueType::SHIFT_LEFT) + .Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_SHIFT_LEFT); + }), + create.Type(CommandsParserValueType::SHIFT_RIGHT) + .Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_SHIFT_RIGHT); + }), + create.Char('>').Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_GREATER_THAN); + }), + create.Type(CommandsParserValueType::GREATER_EQUAL) + .Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_GREATER_EQUAL_THAN); + }), + create.Char('<').Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_LESS_THAN); + }), + create.Type(CommandsParserValueType::LESS_EQUAL) + .Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_LESS_EQUAL_THAN); + }), + create.Type(CommandsParserValueType::EQUALS) + .Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_EQUALS); + }), + create.Type(CommandsParserValueType::NOT_EQUAL) + .Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_NOT_EQUAL); + }), + create.Type(CommandsParserValueType::LOGICAL_AND) + .Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_AND); + }), + create.Type(CommandsParserValueType::LOGICAL_OR) + .Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_OR); + })}) + .Capture(CAPTURE_BINARY_OPERATION_TYPE); } std::unique_ptr<CommandsCommonMatchers::matcher_t> CommandsCommonMatchers::Evaluation(const supplier_t* labelSupplier) { const CommandsMatcherFactory create(labelSupplier); - return create.And({ - create.Or({ - create.And({ - create.Optional(create.Char('!').Tag(TAG_EVALUATION_NOT)), - create.Char('('), - create.Label(LABEL_EVALUATION), - create.Char(')').Tag(TAG_EVALUATION_PARENTHESIS_END) - }).Tag(TAG_EVALUATION_PARENTHESIS), - ParseOperand(labelSupplier) - }), - create.Optional(create.And({ - ParseOperationType(labelSupplier), - create.Label(LABEL_EVALUATION) - }).Tag(TAG_EVALUATION_OPERATION)) - }).Tag(TAG_EVALUATION); + return create + .And({create.Or({create + .And({create.Optional(create.Char('!').Tag(TAG_EVALUATION_NOT)), + create.Char('('), + create.Label(LABEL_EVALUATION), + create.Char(')').Tag(TAG_EVALUATION_PARENTHESIS_END)}) + .Tag(TAG_EVALUATION_PARENTHESIS), + ParseOperand(labelSupplier)}), + create.Optional(create.And({ParseOperationType(labelSupplier), create.Label(LABEL_EVALUATION)}).Tag(TAG_EVALUATION_OPERATION))}) + .Tag(TAG_EVALUATION); } std::unique_ptr<IEvaluation> CommandsCommonMatchers::ProcessEvaluationInParenthesis(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) @@ -248,7 +244,8 @@ std::unique_ptr<IEvaluation> CommandsCommonMatchers::ProcessEvaluationInParenthe return processedEvaluation; } -std::unique_ptr<IEvaluation> CommandsCommonMatchers::ProcessOperand(CommandsParserState* state, SequenceResult<CommandsParserValue>& result, StructureInformation* currentType) +std::unique_ptr<IEvaluation> + CommandsCommonMatchers::ProcessOperand(CommandsParserState* state, SequenceResult<CommandsParserValue>& result, StructureInformation* currentType) { const auto nextTag = result.NextTag(); @@ -293,7 +290,8 @@ std::unique_ptr<IEvaluation> CommandsCommonMatchers::ProcessEvaluation(CommandsP return ProcessEvaluation(state, result, nullptr); } -std::unique_ptr<IEvaluation> CommandsCommonMatchers::ProcessEvaluation(CommandsParserState* state, SequenceResult<CommandsParserValue>& result, StructureInformation* currentType) +std::unique_ptr<IEvaluation> + CommandsCommonMatchers::ProcessEvaluation(CommandsParserState* state, SequenceResult<CommandsParserValue>& result, StructureInformation* currentType) { if (result.PeekAndRemoveIfTag(TAG_EVALUATION) != TAG_EVALUATION) return nullptr; @@ -332,14 +330,15 @@ std::unique_ptr<IEvaluation> CommandsCommonMatchers::ProcessEvaluation(CommandsP throw ParsingException(TokenPos(), "Expected EvaluationTag @ Evaluation"); } - operators.sort([](const std::pair<unsigned, const OperationType*>& p1, const std::pair<unsigned, const OperationType*>& p2) - { - if(p1.second->m_precedence != p2.second->m_precedence) - return p1.second->m_precedence > p2.second->m_precedence; + operators.sort( + [](const std::pair<unsigned, const OperationType*>& p1, const std::pair<unsigned, const OperationType*>& p2) + { + if (p1.second->m_precedence != p2.second->m_precedence) + return p1.second->m_precedence > p2.second->m_precedence; + + return p1.first > p2.first; + }); - return p1.first > p2.first; - }); - while (!operators.empty()) { const auto [operatorIndex, operatorType] = operators.back(); @@ -350,12 +349,12 @@ std::unique_ptr<IEvaluation> CommandsCommonMatchers::ProcessEvaluation(CommandsP operators.pop_back(); - for(auto& [opIndex, _] : operators) + for (auto& [opIndex, _] : operators) { if (opIndex > operatorIndex) opIndex--; } } - + return std::move(operands.front()); } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsCommonMatchers.h b/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsCommonMatchers.h index 7514257ff..cb2bd0e97 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsCommonMatchers.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsCommonMatchers.h @@ -1,8 +1,5 @@ #pragma once -#include <limits> -#include <memory> - #include "Domain/Evaluation/IEvaluation.h" #include "Domain/Evaluation/OperationType.h" #include "Parsing/Commands/Impl/CommandsParserState.h" @@ -11,6 +8,9 @@ #include "Parsing/Matcher/MatcherLabel.h" #include "Parsing/Sequence/SequenceResult.h" +#include <limits> +#include <memory> + class CommandsCommonMatchers { public: @@ -20,7 +20,7 @@ class CommandsCommonMatchers static constexpr int LABEL_TYPENAME = std::numeric_limits<int>::max() - 1; static constexpr int LABEL_ARRAY_DEF = std::numeric_limits<int>::max() - 2; static constexpr int LABEL_EVALUATION = std::numeric_limits<int>::max() - 3; - + static std::unique_ptr<matcher_t> Typename(const supplier_t* labelSupplier); static std::unique_ptr<matcher_t> ArrayDef(const supplier_t* labelSupplier); @@ -30,10 +30,12 @@ class CommandsCommonMatchers static std::unique_ptr<matcher_t> ParseOperationType(const supplier_t* labelSupplier); static std::unique_ptr<IEvaluation> ProcessEvaluationInParenthesis(CommandsParserState* state, SequenceResult<CommandsParserValue>& result); - static std::unique_ptr<IEvaluation> ProcessOperand(CommandsParserState* state, SequenceResult<CommandsParserValue>& result, StructureInformation* currentType); + static std::unique_ptr<IEvaluation> + ProcessOperand(CommandsParserState* state, SequenceResult<CommandsParserValue>& result, StructureInformation* currentType); public: static std::unique_ptr<matcher_t> Evaluation(const supplier_t* labelSupplier); static std::unique_ptr<IEvaluation> ProcessEvaluation(CommandsParserState* state, SequenceResult<CommandsParserValue>& result); - static std::unique_ptr<IEvaluation> ProcessEvaluation(CommandsParserState* state, SequenceResult<CommandsParserValue>& result, StructureInformation* currentType); + static std::unique_ptr<IEvaluation> + ProcessEvaluation(CommandsParserState* state, SequenceResult<CommandsParserValue>& result, StructureInformation* currentType); }; diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsMatcherCharacter.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsMatcherCharacter.cpp index 7ed5c9dee..18c63af4d 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsMatcherCharacter.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsMatcherCharacter.cpp @@ -8,7 +8,6 @@ CommandsMatcherCharacter::CommandsMatcherCharacter(const char c) MatcherResult<CommandsParserValue> CommandsMatcherCharacter::CanMatch(ILexer<CommandsParserValue>* lexer, const unsigned tokenOffset) { const auto& token = lexer->GetToken(tokenOffset); - return token.m_type == CommandsParserValueType::CHARACTER && token.CharacterValue() == m_char - ? MatcherResult<CommandsParserValue>::Match(1) - : MatcherResult<CommandsParserValue>::NoMatch(); + return token.m_type == CommandsParserValueType::CHARACTER && token.CharacterValue() == m_char ? MatcherResult<CommandsParserValue>::Match(1) + : MatcherResult<CommandsParserValue>::NoMatch(); } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsMatcherFactory.h b/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsMatcherFactory.h index 42013f370..cd80546f3 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsMatcherFactory.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsMatcherFactory.h @@ -1,10 +1,10 @@ #pragma once -#include <string> - #include "Parsing/Commands/Impl/CommandsParserValue.h" #include "Parsing/Matcher/AbstractMatcherFactory.h" +#include <string> + class CommandsMatcherFactory final : public AbstractMatcherFactory<CommandsParserValue> { public: diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsMatcherKeyword.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsMatcherKeyword.cpp index 521666347..458235102 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsMatcherKeyword.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsMatcherKeyword.cpp @@ -11,6 +11,6 @@ MatcherResult<CommandsParserValue> CommandsMatcherKeyword::CanMatch(ILexer<Comma { const auto& token = lexer->GetToken(tokenOffset); return token.m_type == CommandsParserValueType::IDENTIFIER && token.IdentifierHash() == m_hash && token.IdentifierValue() == m_value - ? MatcherResult<CommandsParserValue>::Match(1) - : MatcherResult<CommandsParserValue>::NoMatch(); + ? MatcherResult<CommandsParserValue>::Match(1) + : MatcherResult<CommandsParserValue>::NoMatch(); } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsMatcherKeyword.h b/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsMatcherKeyword.h index 290c09e75..9fd636823 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsMatcherKeyword.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsMatcherKeyword.h @@ -1,10 +1,10 @@ #pragma once -#include <string> - #include "Parsing/Commands/Impl/CommandsParserValue.h" #include "Parsing/Matcher/AbstractMatcher.h" +#include <string> + class CommandsMatcherKeyword final : public AbstractMatcher<CommandsParserValue> { size_t m_hash; diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsMatcherValueType.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsMatcherValueType.cpp index 6c4e35325..a023020fa 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsMatcherValueType.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsMatcherValueType.cpp @@ -7,7 +7,5 @@ CommandsMatcherValueType::CommandsMatcherValueType(CommandsParserValueType type) MatcherResult<CommandsParserValue> CommandsMatcherValueType::CanMatch(ILexer<CommandsParserValue>* lexer, const unsigned tokenOffset) { - return lexer->GetToken(tokenOffset).m_type == m_type - ? MatcherResult<CommandsParserValue>::Match(1) - : MatcherResult<CommandsParserValue>::NoMatch(); + return lexer->GetToken(tokenOffset).m_type == m_type ? MatcherResult<CommandsParserValue>::Match(1) : MatcherResult<CommandsParserValue>::NoMatch(); } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAction.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAction.cpp index 59ad7231b..85451c486 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAction.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAction.cpp @@ -1,7 +1,7 @@ #include "SequenceAction.h" -#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" #include "Parsing/Commands/Matcher/CommandsCommonMatchers.h" +#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" SequenceAction::SequenceAction() { @@ -9,31 +9,20 @@ SequenceAction::SequenceAction() AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); AddLabeledMatchers( - { - create.Char('('), - create.Optional(create.And({ - create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_ARG_TYPE), - create.OptionalLoop(create.And({ - create.Char(','), - create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_ARG_TYPE) - })) - })), - create.Char(')') - }, LABEL_ACTION_ARGS); + {create.Char('('), + create.Optional( + create.And({create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_ARG_TYPE), + create.OptionalLoop(create.And({create.Char(','), create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_ARG_TYPE)}))})), + create.Char(')')}, + LABEL_ACTION_ARGS); - AddMatchers({ - create.Keyword("set"), - create.Keyword("action"), - create.Or({ - create.And({ - create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.Identifier().Capture(CAPTURE_ACTION_NAME) - }), - create.Identifier().Capture(CAPTURE_ACTION_NAME) - }), - create.Label(LABEL_ACTION_ARGS), - create.Char(';') - }); + AddMatchers( + {create.Keyword("set"), + create.Keyword("action"), + create.Or({create.And({create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), create.Identifier().Capture(CAPTURE_ACTION_NAME)}), + create.Identifier().Capture(CAPTURE_ACTION_NAME)}), + create.Label(LABEL_ACTION_ARGS), + create.Char(';')}); } void SequenceAction::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const @@ -67,7 +56,7 @@ void SequenceAction::ProcessMatch(CommandsParserState* state, SequenceResult<Com // Extract all parameter types that were specified std::vector<DataDefinition*> parameterTypes; - while(result.HasNextCapture(CAPTURE_ARG_TYPE)) + while (result.HasNextCapture(CAPTURE_ARG_TYPE)) { const auto& argTypeToken = result.NextCapture(CAPTURE_ARG_TYPE); auto* dataDefinition = state->GetRepository()->GetDataDefinitionByName(argTypeToken.TypeNameValue()); diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAllocAlign.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAllocAlign.cpp index 52e362537..36709e8d2 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAllocAlign.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAllocAlign.cpp @@ -1,7 +1,7 @@ #include "SequenceAllocAlign.h" -#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" #include "Parsing/Commands/Matcher/CommandsCommonMatchers.h" +#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" SequenceAllocAlign::SequenceAllocAlign() { @@ -9,13 +9,11 @@ SequenceAllocAlign::SequenceAllocAlign() AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); AddLabeledMatchers(CommandsCommonMatchers::Evaluation(this), CommandsCommonMatchers::LABEL_EVALUATION); - AddMatchers({ - create.Keyword("set"), - create.Keyword("allocalign"), - create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.Label(CommandsCommonMatchers::LABEL_EVALUATION), - create.Char(';') - }); + AddMatchers({create.Keyword("set"), + create.Keyword("allocalign"), + create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.Label(CommandsCommonMatchers::LABEL_EVALUATION), + create.Char(';')}); } void SequenceAllocAlign::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const @@ -26,7 +24,7 @@ void SequenceAllocAlign::ProcessMatch(CommandsParserState* state, SequenceResult if (!state->GetTypenameAndMembersFromTypename(typeNameToken.TypeNameValue(), type, memberChain)) throw ParsingException(typeNameToken.GetPos(), "Unknown type"); - if(memberChain.empty()) + if (memberChain.empty()) throw ParsingException(typeNameToken.GetPos(), "Need to specify a member"); auto allocAlignEvaluation = CommandsCommonMatchers::ProcessEvaluation(state, result, type); diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArchitecture.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArchitecture.cpp index a553e5c4c..38244c446 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArchitecture.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArchitecture.cpp @@ -1,17 +1,13 @@ #include "SequenceArchitecture.h" -#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" #include "Parsing/Commands/Matcher/CommandsCommonMatchers.h" +#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" SequenceArchitecture::SequenceArchitecture() { const CommandsMatcherFactory create(this); - AddMatchers({ - create.Keyword("architecture"), - create.Identifier().Capture(CAPTURE_ARCHITECTURE), - create.Char(';') - }); + AddMatchers({create.Keyword("architecture"), create.Identifier().Capture(CAPTURE_ARCHITECTURE), create.Char(';')}); m_architecture_mapping["x86"] = Architecture::X86; m_architecture_mapping["x64"] = Architecture::X64; @@ -23,7 +19,7 @@ void SequenceArchitecture::ProcessMatch(CommandsParserState* state, SequenceResu const auto foundArchitecture = m_architecture_mapping.find(architectureToken.IdentifierValue()); - if(foundArchitecture == m_architecture_mapping.end()) + if (foundArchitecture == m_architecture_mapping.end()) throw ParsingException(architectureToken.GetPos(), "Unknown architecture"); state->SetArchitecture(foundArchitecture->second); diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArrayCount.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArrayCount.cpp index 48a1284e9..2ae1a944d 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArrayCount.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArrayCount.cpp @@ -1,9 +1,8 @@ #include "SequenceArrayCount.h" - #include "Domain/Definition/ArrayDeclarationModifier.h" -#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" #include "Parsing/Commands/Matcher/CommandsCommonMatchers.h" +#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" SequenceArrayCount::SequenceArrayCount() { @@ -11,13 +10,11 @@ SequenceArrayCount::SequenceArrayCount() AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); AddLabeledMatchers(CommandsCommonMatchers::Evaluation(this), CommandsCommonMatchers::LABEL_EVALUATION); - AddMatchers({ - create.Keyword("set"), - create.Keyword("arraycount"), - create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.Label(CommandsCommonMatchers::LABEL_EVALUATION), - create.Char(';') - }); + AddMatchers({create.Keyword("set"), + create.Keyword("arraycount"), + create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.Label(CommandsCommonMatchers::LABEL_EVALUATION), + create.Char(';')}); } void SequenceArrayCount::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const @@ -29,7 +26,7 @@ void SequenceArrayCount::ProcessMatch(CommandsParserState* state, SequenceResult if (!state->GetTypenameAndMembersFromTypename(typeNameToken.TypeNameValue(), structure, memberChain)) throw ParsingException(typeNameToken.GetPos(), "Unknown type"); - if(memberChain.empty()) + if (memberChain.empty()) throw ParsingException(typeNameToken.GetPos(), "Must specify type with member"); const auto& memberDeclarationModifiers = memberChain.back()->m_member->m_type_declaration->m_declaration_modifiers; diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArraySize.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArraySize.cpp index 88a25a38a..91bd363c0 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArraySize.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArraySize.cpp @@ -1,9 +1,8 @@ #include "SequenceArraySize.h" - #include "Domain/Definition/ArrayDeclarationModifier.h" -#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" #include "Parsing/Commands/Matcher/CommandsCommonMatchers.h" +#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" SequenceArraySize::SequenceArraySize() { @@ -11,13 +10,11 @@ SequenceArraySize::SequenceArraySize() AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); AddLabeledMatchers(CommandsCommonMatchers::Evaluation(this), CommandsCommonMatchers::LABEL_EVALUATION); - AddMatchers({ - create.Keyword("set"), - create.Keyword("arraysize"), - create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.Label(CommandsCommonMatchers::LABEL_EVALUATION).Capture(CAPTURE_EVALUATION), - create.Char(';') - }); + AddMatchers({create.Keyword("set"), + create.Keyword("arraysize"), + create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.Label(CommandsCommonMatchers::LABEL_EVALUATION).Capture(CAPTURE_EVALUATION), + create.Char(';')}); } void SequenceArraySize::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAsset.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAsset.cpp index 2e11db0bb..0cf06711b 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAsset.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAsset.cpp @@ -1,19 +1,17 @@ #include "SequenceAsset.h" -#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" #include "Parsing/Commands/Matcher/CommandsCommonMatchers.h" +#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" SequenceAsset::SequenceAsset() { const CommandsMatcherFactory create(this); AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); - AddMatchers({ - create.Keyword("asset"), - create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.Identifier().Capture(CAPTURE_ENUM_ENTRY), - create.Char(';') - }); + AddMatchers({create.Keyword("asset"), + create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.Identifier().Capture(CAPTURE_ENUM_ENTRY), + create.Char(';')}); } void SequenceAsset::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceBlock.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceBlock.cpp index 85f21dee0..2e3381900 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceBlock.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceBlock.cpp @@ -1,7 +1,7 @@ #include "SequenceBlock.h" -#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" #include "Parsing/Commands/Matcher/CommandsCommonMatchers.h" +#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" SequenceBlock::SequenceBlock() { @@ -14,13 +14,11 @@ SequenceBlock::SequenceBlock() DEFINE_FAST_FILE_BLOCK_TYPE(NORMAL); #undef DEFINE_FAST_FILE_BLOCK_TYPE - AddMatchers({ - create.Keyword("block"), - create.Identifier().Capture(CAPTURE_BLOCK_TYPE), - create.Identifier().Capture(CAPTURE_BLOCK_ENUM_ENTRY), - create.Optional(create.Keyword("default").Tag(TAG_DEFAULT)), - create.Char(';') - }); + AddMatchers({create.Keyword("block"), + create.Identifier().Capture(CAPTURE_BLOCK_TYPE), + create.Identifier().Capture(CAPTURE_BLOCK_ENUM_ENTRY), + create.Optional(create.Keyword("default").Tag(TAG_DEFAULT)), + create.Char(';')}); } void SequenceBlock::AddFastFileBlockToLookup(std::string name, const FastFileBlockType type) diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceBlock.h b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceBlock.h index 296ac97db..b8596260a 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceBlock.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceBlock.h @@ -1,9 +1,9 @@ #pragma once -#include <unordered_map> - -#include "Utils/ClassUtils.h" #include "Parsing/Commands/Impl/CommandsParser.h" +#include "Utils/ClassUtils.h" + +#include <unordered_map> class SequenceBlock final : public CommandsParser::sequence_t { diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCondition.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCondition.cpp index db18a5d5e..dd2e7566b 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCondition.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCondition.cpp @@ -1,8 +1,8 @@ #include "SequenceCondition.h" #include "Domain/Evaluation/OperandStatic.h" -#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" #include "Parsing/Commands/Matcher/CommandsCommonMatchers.h" +#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" SequenceCondition::SequenceCondition() { @@ -10,17 +10,13 @@ SequenceCondition::SequenceCondition() AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); AddLabeledMatchers(CommandsCommonMatchers::Evaluation(this), CommandsCommonMatchers::LABEL_EVALUATION); - AddMatchers({ - create.Keyword("set"), - create.Keyword("condition"), - create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.Or({ - create.Keyword("always").Tag(TAG_ALWAYS), - create.Keyword("never").Tag(TAG_NEVER), - create.Label(CommandsCommonMatchers::LABEL_EVALUATION).Tag(TAG_EVALUATION).Capture(CAPTURE_EVALUATION) - }), - create.Char(';') - }); + AddMatchers({create.Keyword("set"), + create.Keyword("condition"), + create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.Or({create.Keyword("always").Tag(TAG_ALWAYS), + create.Keyword("never").Tag(TAG_NEVER), + create.Label(CommandsCommonMatchers::LABEL_EVALUATION).Tag(TAG_EVALUATION).Capture(CAPTURE_EVALUATION)}), + create.Char(';')}); } void SequenceCondition::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const @@ -36,7 +32,7 @@ void SequenceCondition::ProcessMatch(CommandsParserState* state, SequenceResult< throw ParsingException(typeNameToken.GetPos(), "Conditions can only be set on members and not for types"); std::unique_ptr<IEvaluation> conditionEvaluation; - switch(result.NextTag()) + switch (result.NextTag()) { case TAG_ALWAYS: conditionEvaluation = std::make_unique<OperandStatic>(1); diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCount.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCount.cpp index 5844fdd1c..38aee31a1 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCount.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCount.cpp @@ -2,8 +2,8 @@ #include "Domain/Definition/ArrayDeclarationModifier.h" #include "Domain/Definition/PointerDeclarationModifier.h" -#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" #include "Parsing/Commands/Matcher/CommandsCommonMatchers.h" +#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" SequenceCount::SequenceCount() { @@ -12,18 +12,19 @@ SequenceCount::SequenceCount() AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); AddLabeledMatchers(CommandsCommonMatchers::Evaluation(this), CommandsCommonMatchers::LABEL_EVALUATION); AddLabeledMatchers(CommandsCommonMatchers::ArrayDef(this), CommandsCommonMatchers::LABEL_ARRAY_DEF); - AddMatchers({ - create.Keyword("set").Capture(CAPTURE_START), - create.Keyword("count"), - create.OptionalLoop(create.Char('*').Tag(TAG_POINTER_RESOLVE)), - create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.OptionalLoop(create.Label(CommandsCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY_INDEX)), - create.Label(CommandsCommonMatchers::LABEL_EVALUATION), - create.Char(';') - }); + AddMatchers({create.Keyword("set").Capture(CAPTURE_START), + create.Keyword("count"), + create.OptionalLoop(create.Char('*').Tag(TAG_POINTER_RESOLVE)), + create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.OptionalLoop(create.Label(CommandsCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY_INDEX)), + create.Label(CommandsCommonMatchers::LABEL_EVALUATION), + create.Char(';')}); } -void SequenceCount::SetCountByArrayIndex(CommandsParserState* state, SequenceResult<CommandsParserValue>& result, MemberInformation* member, PointerDeclarationModifier* pointer, +void SequenceCount::SetCountByArrayIndex(CommandsParserState* state, + SequenceResult<CommandsParserValue>& result, + MemberInformation* member, + PointerDeclarationModifier* pointer, std::unique_ptr<IEvaluation> evaluation) { std::vector<int> arraySizes; @@ -33,12 +34,12 @@ void SequenceCount::SetCountByArrayIndex(CommandsParserState* state, SequenceRes if (modifier->GetType() == DeclarationModifierType::ARRAY) arraySizes.push_back(dynamic_cast<ArrayDeclarationModifier*>(modifier.get())->m_size); } - + depthSize.resize(arraySizes.size()); auto currentDepthSize = 1u; for (auto i = arraySizes.size(); i > 0; i--) { - if(i < arraySizes.size()) + if (i < arraySizes.size()) currentDepthSize *= arraySizes[i]; depthSize[i - 1] = currentDepthSize; } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCount.h b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCount.h index dafa49814..848b5f026 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCount.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCount.h @@ -11,7 +11,10 @@ class SequenceCount final : public CommandsParser::sequence_t static constexpr auto CAPTURE_TYPE = 2; static constexpr auto CAPTURE_ARRAY_INDEX = 3; - static void SetCountByArrayIndex(CommandsParserState* state, SequenceResult<CommandsParserValue>& result, MemberInformation* member, PointerDeclarationModifier* pointer, + static void SetCountByArrayIndex(CommandsParserState* state, + SequenceResult<CommandsParserValue>& result, + MemberInformation* member, + PointerDeclarationModifier* pointer, std::unique_ptr<IEvaluation> evaluation); protected: diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceGame.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceGame.cpp index 0b904b691..7ef01077c 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceGame.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceGame.cpp @@ -1,17 +1,13 @@ #include "SequenceGame.h" -#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" #include "Parsing/Commands/Matcher/CommandsCommonMatchers.h" +#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" SequenceGame::SequenceGame() { const CommandsMatcherFactory create(this); - AddMatchers({ - create.Keyword("game"), - create.Identifier().Capture(CAPTURE_GAME), - create.Char(';') - }); + AddMatchers({create.Keyword("game"), create.Identifier().Capture(CAPTURE_GAME), create.Char(';')}); } void SequenceGame::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceName.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceName.cpp index 58e695405..73489fe05 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceName.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceName.cpp @@ -1,19 +1,14 @@ #include "SequenceName.h" -#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" #include "Parsing/Commands/Matcher/CommandsCommonMatchers.h" +#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" SequenceName::SequenceName() { const CommandsMatcherFactory create(this); AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); - AddMatchers({ - create.Keyword("set"), - create.Keyword("name"), - create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.Char(';') - }); + AddMatchers({create.Keyword("set"), create.Keyword("name"), create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), create.Char(';')}); } void SequenceName::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceReorder.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceReorder.cpp index b93e63e39..4244b33de 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceReorder.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceReorder.cpp @@ -1,27 +1,21 @@ #include "SequenceReorder.h" -#include <list> - -#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" #include "Parsing/Commands/Matcher/CommandsCommonMatchers.h" +#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" + +#include <list> SequenceReorder::SequenceReorder() { const CommandsMatcherFactory create(this); AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); - AddMatchers({ - create.Keyword("reorder").Capture(CAPTURE_START), - create.Optional(create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE)), - create.Char(':'), - create.Optional(create.And({ - create.Char('.'), - create.Char('.'), - create.Char('.') - }).Tag(TAG_FIND_FIRST)), - create.Loop(create.Identifier().Capture(CAPTURE_ENTRY)), - create.Char(';') - }); + AddMatchers({create.Keyword("reorder").Capture(CAPTURE_START), + create.Optional(create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE)), + create.Char(':'), + create.Optional(create.And({create.Char('.'), create.Char('.'), create.Char('.')}).Tag(TAG_FIND_FIRST)), + create.Loop(create.Identifier().Capture(CAPTURE_ENTRY)), + create.Char(';')}); } StructureInformation* SequenceReorder::GetType(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) @@ -58,7 +52,7 @@ void SequenceReorder::ProcessMatch(CommandsParserState* state, SequenceResult<Co auto findFirst = result.PeekAndRemoveIfTag(TAG_FIND_FIRST) == TAG_FIND_FIRST; std::string firstVariableName; - if(findFirst) + if (findFirst) firstVariableName = result.NextCapture(CAPTURE_ENTRY).IdentifierValue(); std::vector<std::unique_ptr<MemberInformation>> newMembers; @@ -67,15 +61,15 @@ void SequenceReorder::ProcessMatch(CommandsParserState* state, SequenceResult<Co for (auto& oldMember : information->m_ordered_members) oldMembers.emplace_back(std::move(oldMember)); - while(result.HasNextCapture(CAPTURE_ENTRY)) + while (result.HasNextCapture(CAPTURE_ENTRY)) { const auto& entryToken = result.NextCapture(CAPTURE_ENTRY); const auto& nextVariableName = entryToken.IdentifierValue(); auto foundEntry = false; - for(auto i = oldMembers.begin(); i != oldMembers.end(); ++i) + for (auto i = oldMembers.begin(); i != oldMembers.end(); ++i) { - if(i->get()->m_member->m_name == nextVariableName) + if (i->get()->m_member->m_name == nextVariableName) { newMembers.emplace_back(std::move(*i)); oldMembers.erase(i); @@ -90,7 +84,7 @@ void SequenceReorder::ProcessMatch(CommandsParserState* state, SequenceResult<Co information->m_ordered_members.clear(); - while(findFirst && !oldMembers.empty()) + while (findFirst && !oldMembers.empty()) { if (oldMembers.front()->m_member->m_name == firstVariableName) findFirst = false; diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceReusable.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceReusable.cpp index 89ab259c2..deafe3970 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceReusable.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceReusable.cpp @@ -1,19 +1,15 @@ #include "SequenceReusable.h" -#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" #include "Parsing/Commands/Matcher/CommandsCommonMatchers.h" +#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" SequenceReusable::SequenceReusable() { const CommandsMatcherFactory create(this); AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); - AddMatchers({ - create.Keyword("set"), - create.Keyword("reusable"), - create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.Char(';') - }); + AddMatchers( + {create.Keyword("set"), create.Keyword("reusable"), create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), create.Char(';')}); } void SequenceReusable::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceScriptString.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceScriptString.cpp index fc813baaf..e2c1dc65e 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceScriptString.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceScriptString.cpp @@ -1,19 +1,15 @@ #include "SequenceScriptString.h" -#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" #include "Parsing/Commands/Matcher/CommandsCommonMatchers.h" +#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" SequenceScriptString::SequenceScriptString() { const CommandsMatcherFactory create(this); AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); - AddMatchers({ - create.Keyword("set"), - create.Keyword("scriptstring"), - create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.Char(';') - }); + AddMatchers( + {create.Keyword("set"), create.Keyword("scriptstring"), create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), create.Char(';')}); } void SequenceScriptString::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceSetBlock.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceSetBlock.cpp index d24c2aa5f..bb9a03070 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceSetBlock.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceSetBlock.cpp @@ -1,25 +1,19 @@ #include "SequenceSetBlock.h" -#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" #include "Parsing/Commands/Matcher/CommandsCommonMatchers.h" +#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" SequenceSetBlock::SequenceSetBlock() { const CommandsMatcherFactory create(this); AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); - AddMatchers({ - create.Keyword("set").Capture(CAPTURE_START), - create.Keyword("block"), - create.Or({ - create.And({ - create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.Identifier().Capture(CAPTURE_BLOCK_ENUM_ENTRY) - }), - create.Identifier().Capture(CAPTURE_BLOCK_ENUM_ENTRY) - }), - create.Char(';') - }); + AddMatchers({create.Keyword("set").Capture(CAPTURE_START), + create.Keyword("block"), + create.Or({create.And({create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.Identifier().Capture(CAPTURE_BLOCK_ENUM_ENTRY)}), + create.Identifier().Capture(CAPTURE_BLOCK_ENUM_ENTRY)}), + create.Char(';')}); } void SequenceSetBlock::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceString.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceString.cpp index dd8a3e580..a82092ac9 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceString.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceString.cpp @@ -1,22 +1,17 @@ #include "SequenceString.h" -#include <algorithm> - - -#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" #include "Parsing/Commands/Matcher/CommandsCommonMatchers.h" +#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" + +#include <algorithm> SequenceString::SequenceString() { const CommandsMatcherFactory create(this); AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); - AddMatchers({ - create.Keyword("set"), - create.Keyword("string"), - create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.Char(';') - }); + AddMatchers( + {create.Keyword("set"), create.Keyword("string"), create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), create.Char(';')}); } void SequenceString::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const @@ -40,10 +35,12 @@ void SequenceString::ProcessMatch(CommandsParserState* state, SequenceResult<Com if (!hasPointerRef) { const auto& modifiers = typeDecl->m_declaration_modifiers; - hasPointerRef = std::any_of(modifiers.begin(), modifiers.end(), [](const std::unique_ptr<DeclarationModifier>& modifier) - { - return modifier->GetType() == DeclarationModifierType::POINTER; - }); + hasPointerRef = std::any_of(modifiers.begin(), + modifiers.end(), + [](const std::unique_ptr<DeclarationModifier>& modifier) + { + return modifier->GetType() == DeclarationModifierType::POINTER; + }); } if (typeDecl->m_type->GetType() == DataDefinitionType::TYPEDEF) diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceUse.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceUse.cpp index 5a82381df..3ba7cffff 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceUse.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceUse.cpp @@ -1,18 +1,14 @@ #include "SequenceUse.h" -#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" #include "Parsing/Commands/Matcher/CommandsCommonMatchers.h" +#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h" SequenceUse::SequenceUse() { const CommandsMatcherFactory create(this); AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); - AddMatchers({ - create.Keyword("use"), - create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.Char(';') - }); + AddMatchers({create.Keyword("use"), create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), create.Char(';')}); } void SequenceUse::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockEnum.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockEnum.cpp index f213bcade..8f09895d3 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockEnum.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockEnum.cpp @@ -19,10 +19,7 @@ HeaderBlockType HeaderBlockEnum::GetType() const std::vector<IHeaderBlock::sequence_t*>& HeaderBlockEnum::GetTestsForBlock() { - static std::vector<sequence_t*> tests({ - new SequenceCloseBlock(true), - new SequenceEnumMember() - }); + static std::vector<sequence_t*> tests({new SequenceCloseBlock(true), new SequenceEnumMember()}); return tests; } @@ -51,9 +48,7 @@ void HeaderBlockEnum::OnClose(HeaderParserState* state) state->AddDataType(std::make_unique<TypedefDefinition>(m_namespace, m_variable_name, std::make_unique<TypeDeclaration>(m_enum_definition))); } -void HeaderBlockEnum::OnChildBlockClose(HeaderParserState* state, IHeaderBlock* block) -{ -} +void HeaderBlockEnum::OnChildBlockClose(HeaderParserState* state, IHeaderBlock* block) {} void HeaderBlockEnum::AddEnumMember(std::unique_ptr<EnumMember> enumMember) { diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockEnum.h b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockEnum.h index e9eb91649..dd62dbe28 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockEnum.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockEnum.h @@ -1,11 +1,11 @@ #pragma once -#include "Utils/ClassUtils.h" +#include "Domain/Definition/BaseTypeDefinition.h" +#include "Domain/Definition/EnumDefinition.h" #include "IHeaderBlock.h" #include "IHeaderBlockNameHolder.h" #include "IHeaderBlockVariableDefining.h" -#include "Domain/Definition/BaseTypeDefinition.h" -#include "Domain/Definition/EnumDefinition.h" +#include "Utils/ClassUtils.h" class HeaderBlockEnum final : public IHeaderBlock, public IHeaderBlockNameHolder, public IHeaderBlockVariableDefining { diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockNamespace.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockNamespace.cpp index 79b7591ac..1fce375f7 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockNamespace.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockNamespace.cpp @@ -20,15 +20,13 @@ HeaderBlockType HeaderBlockNamespace::GetType() const std::vector<IHeaderBlock::sequence_t*>& HeaderBlockNamespace::GetTestsForBlock() { - static std::vector<sequence_t*> tests({ - new SequenceCloseBlock(false), - new SequenceEnum(), - new SequenceForwardDecl(), - new SequenceNamespace(), - new SequenceStruct(), - new SequenceTypedef(), - new SequenceUnion() - }); + static std::vector<sequence_t*> tests({new SequenceCloseBlock(false), + new SequenceEnum(), + new SequenceForwardDecl(), + new SequenceNamespace(), + new SequenceStruct(), + new SequenceTypedef(), + new SequenceUnion()}); return tests; } @@ -43,6 +41,4 @@ void HeaderBlockNamespace::OnClose(HeaderParserState* state) state->m_namespace.Pop(); } -void HeaderBlockNamespace::OnChildBlockClose(HeaderParserState* state, IHeaderBlock* block) -{ -} +void HeaderBlockNamespace::OnChildBlockClose(HeaderParserState* state, IHeaderBlock* block) {} diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockNone.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockNone.cpp index 342c5226d..02cf11f88 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockNone.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockNone.cpp @@ -14,26 +14,14 @@ HeaderBlockType HeaderBlockNone::GetType() const std::vector<IHeaderBlock::sequence_t*>& HeaderBlockNone::GetTestsForBlock() { - static std::vector<sequence_t*> tests({ - new SequenceEnum(), - new SequenceForwardDecl(), - new SequenceNamespace(), - new SequenceStruct(), - new SequenceTypedef(), - new SequenceUnion() - }); - + static std::vector<sequence_t*> tests( + {new SequenceEnum(), new SequenceForwardDecl(), new SequenceNamespace(), new SequenceStruct(), new SequenceTypedef(), new SequenceUnion()}); + return tests; } -void HeaderBlockNone::OnOpen(HeaderParserState* state) -{ -} +void HeaderBlockNone::OnOpen(HeaderParserState* state) {} -void HeaderBlockNone::OnClose(HeaderParserState* state) -{ -} +void HeaderBlockNone::OnClose(HeaderParserState* state) {} -void HeaderBlockNone::OnChildBlockClose(HeaderParserState* state, IHeaderBlock* block) -{ -} +void HeaderBlockNone::OnChildBlockClose(HeaderParserState* state, IHeaderBlock* block) {} diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockStruct.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockStruct.cpp index 6678a4ade..2a07ab7f2 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockStruct.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockStruct.cpp @@ -24,13 +24,8 @@ HeaderBlockType HeaderBlockStruct::GetType() const std::vector<IHeaderBlock::sequence_t*>& HeaderBlockStruct::GetTestsForBlock() { - static std::vector<sequence_t*> tests({ - new SequenceCloseBlock(true), - new SequenceEnum(), - new SequenceStruct(), - new SequenceUnion(), - new SequenceVariable() - }); + static std::vector<sequence_t*> tests( + {new SequenceCloseBlock(true), new SequenceEnum(), new SequenceStruct(), new SequenceUnion(), new SequenceVariable()}); return tests; } @@ -66,7 +61,7 @@ void HeaderBlockStruct::OnClose(HeaderParserState* state) for (auto& member : m_members) structDefinition->m_members.emplace_back(std::move(member)); - if(m_has_custom_align) + if (m_has_custom_align) { structDefinition->m_alignment_override = static_cast<unsigned>(m_custom_alignment); structDefinition->m_has_alignment_override = true; @@ -83,7 +78,8 @@ void HeaderBlockStruct::OnChildBlockClose(HeaderParserState* state, IHeaderBlock auto* variableDefining = dynamic_cast<IHeaderBlockVariableDefining*>(block); if (variableDefining && variableDefining->IsDefiningVariable()) - m_members.emplace_back(std::make_shared<Variable>(variableDefining->GetVariableName(), std::make_unique<TypeDeclaration>(variableDefining->GetVariableType()))); + m_members.emplace_back( + std::make_shared<Variable>(variableDefining->GetVariableName(), std::make_unique<TypeDeclaration>(variableDefining->GetVariableType()))); } void HeaderBlockStruct::AddVariable(std::shared_ptr<Variable> variable) diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockStruct.h b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockStruct.h index eba3c274c..a5ea42e1c 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockStruct.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockStruct.h @@ -1,13 +1,13 @@ #pragma once -#include <string> - +#include "Domain/Definition/StructDefinition.h" +#include "Domain/Definition/Variable.h" #include "IHeaderBlock.h" #include "IHeaderBlockNameHolder.h" #include "IHeaderBlockVariableDefining.h" #include "IHeaderBlockVariableHolder.h" -#include "Domain/Definition/StructDefinition.h" -#include "Domain/Definition/Variable.h" + +#include <string> class HeaderBlockStruct final : public IHeaderBlock, public IHeaderBlockNameHolder, public IHeaderBlockVariableDefining, public IHeaderBlockVariableHolder { diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockUnion.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockUnion.cpp index 7a032a300..f3570ae0e 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockUnion.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockUnion.cpp @@ -24,13 +24,8 @@ HeaderBlockType HeaderBlockUnion::GetType() const std::vector<IHeaderBlock::sequence_t*>& HeaderBlockUnion::GetTestsForBlock() { - static std::vector<sequence_t*> tests({ - new SequenceCloseBlock(true), - new SequenceEnum(), - new SequenceStruct(), - new SequenceUnion(), - new SequenceVariable() - }); + static std::vector<sequence_t*> tests( + {new SequenceCloseBlock(true), new SequenceEnum(), new SequenceStruct(), new SequenceUnion(), new SequenceVariable()}); return tests; } @@ -83,7 +78,8 @@ void HeaderBlockUnion::OnChildBlockClose(HeaderParserState* state, IHeaderBlock* auto* variableDefining = dynamic_cast<IHeaderBlockVariableDefining*>(block); if (variableDefining && variableDefining->IsDefiningVariable()) - m_members.emplace_back(std::make_shared<Variable>(variableDefining->GetVariableName(), std::make_unique<TypeDeclaration>(variableDefining->GetVariableType()))); + m_members.emplace_back( + std::make_shared<Variable>(variableDefining->GetVariableName(), std::make_unique<TypeDeclaration>(variableDefining->GetVariableType()))); } void HeaderBlockUnion::AddVariable(std::shared_ptr<Variable> variable) diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockUnion.h b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockUnion.h index 3fc53fd74..a926360d3 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockUnion.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockUnion.h @@ -32,7 +32,7 @@ class HeaderBlockUnion final : public IHeaderBlock, public IHeaderBlockNameHolde void AddVariable(std::shared_ptr<Variable> variable) override; void SetCustomAlignment(int alignment); void Inherit(const StructDefinition* parentStruct); - + void SetBlockName(const TokenPos& nameTokenPos, std::string name) override; bool IsDefiningVariable() override; DataDefinition* GetVariableType() override; diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/IHeaderBlock.h b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/IHeaderBlock.h index b42286f18..479f8339d 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/IHeaderBlock.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/IHeaderBlock.h @@ -1,9 +1,9 @@ #pragma once -#include <vector> - -#include "Parsing/Sequence/AbstractSequence.h" #include "Parsing/Header/Impl/HeaderParserState.h" +#include "Parsing/Sequence/AbstractSequence.h" + +#include <vector> enum class HeaderBlockType { @@ -16,6 +16,7 @@ enum class HeaderBlockType class HeaderParserValue; class HeaderParserState; + class IHeaderBlock { public: @@ -35,4 +36,4 @@ class IHeaderBlock virtual void OnOpen(HeaderParserState* state) = 0; virtual void OnClose(HeaderParserState* state) = 0; virtual void OnChildBlockClose(HeaderParserState* state, IHeaderBlock* block) = 0; -}; \ No newline at end of file +}; diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/IHeaderBlockVariableDefining.h b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/IHeaderBlockVariableDefining.h index 23b7cb830..418f58510 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/IHeaderBlockVariableDefining.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/IHeaderBlockVariableDefining.h @@ -1,9 +1,9 @@ #pragma once -#include <string> - #include "Domain/Definition/DataDefinition.h" +#include <string> + class IHeaderBlockVariableDefining { public: diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/IHeaderBlockVariableHolder.h b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/IHeaderBlockVariableHolder.h index 86141f4c1..e94fbabf7 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/IHeaderBlockVariableHolder.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/IHeaderBlockVariableHolder.h @@ -1,9 +1,9 @@ #pragma once -#include <memory> - #include "Domain/Definition/Variable.h" +#include <memory> + class IHeaderBlockVariableHolder { public: diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/HeaderFileReader.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/HeaderFileReader.cpp index 83871165a..fa67ffd3a 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/HeaderFileReader.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/HeaderFileReader.cpp @@ -1,9 +1,5 @@ #include "HeaderFileReader.h" -#include <algorithm> -#include <chrono> -#include <iostream> - #include "Impl/HeaderLexer.h" #include "Impl/HeaderParser.h" #include "Parsing/Impl/CommentRemovingStreamProxy.h" @@ -15,6 +11,10 @@ #include "Parsing/PostProcessing/CreateStructureInformationPostProcessor.h" #include "Parsing/PostProcessing/IPostProcessor.h" +#include <algorithm> +#include <chrono> +#include <iostream> + HeaderFileReader::HeaderFileReader(const ZoneCodeGeneratorArguments* args, std::string filename) : m_args(args), m_filename(std::move(filename)), @@ -83,7 +83,7 @@ bool HeaderFileReader::ReadHeaderFile(IDataRepository* repository) result = parser->SaveToRepository(repository); const auto end = std::chrono::steady_clock::now(); - if(m_args->m_verbose) + if (m_args->m_verbose) { std::cout << "Processing header took " << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() << "ms" << std::endl; } @@ -91,8 +91,10 @@ bool HeaderFileReader::ReadHeaderFile(IDataRepository* repository) if (!result) return false; - return std::all_of(m_post_processors.begin(), m_post_processors.end(), [repository](const std::unique_ptr<IPostProcessor>& postProcessor) - { - return postProcessor->PostProcess(repository); - }); + return std::all_of(m_post_processors.begin(), + m_post_processors.end(), + [repository](const std::unique_ptr<IPostProcessor>& postProcessor) + { + return postProcessor->PostProcess(repository); + }); } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/HeaderFileReader.h b/src/ZoneCodeGeneratorLib/Parsing/Header/HeaderFileReader.h index 6b9ed2599..eb17cabd3 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/HeaderFileReader.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/HeaderFileReader.h @@ -1,12 +1,12 @@ #pragma once -#include <string> - -#include "ZoneCodeGeneratorArguments.h" #include "Parsing/IPackValueSupplier.h" #include "Parsing/IParserLineStream.h" #include "Parsing/PostProcessing/IPostProcessor.h" #include "Persistence/IDataRepository.h" +#include "ZoneCodeGeneratorArguments.h" + +#include <string> class HeaderFileReader { diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Impl/HeaderLexer.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Impl/HeaderLexer.cpp index ff4dd0346..3e482ff3f 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Impl/HeaderLexer.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Impl/HeaderLexer.cpp @@ -33,136 +33,136 @@ HeaderParserValue HeaderLexer::GetNextToken() switch (c) { case '\"': - { - return HeaderParserValue::String(GetPreviousCharacterPos(), new std::string(ReadString())); - } + { + return HeaderParserValue::String(GetPreviousCharacterPos(), new std::string(ReadString())); + } case '<': + { + if (!IsLineEnd()) { - if (!IsLineEnd()) + const auto pos = GetPreviousCharacterPos(); + const auto nextChar = PeekChar(); + + if (nextChar == '=') { - const auto pos = GetPreviousCharacterPos(); - const auto nextChar = PeekChar(); - - if (nextChar == '=') - { - NextChar(); - return HeaderParserValue::LessEqual(pos); - } - if (nextChar == '<') - { - NextChar(); - return HeaderParserValue::ShiftLeft(pos); - } + NextChar(); + return HeaderParserValue::LessEqual(pos); + } + if (nextChar == '<') + { + NextChar(); + return HeaderParserValue::ShiftLeft(pos); } - - return HeaderParserValue::Character(GetPreviousCharacterPos(), static_cast<char>(c)); } + return HeaderParserValue::Character(GetPreviousCharacterPos(), static_cast<char>(c)); + } + case '>': + { + if (!IsLineEnd()) { - if (!IsLineEnd()) + const auto pos = GetPreviousCharacterPos(); + const auto nextChar = PeekChar(); + + if (nextChar == '=') { - const auto pos = GetPreviousCharacterPos(); - const auto nextChar = PeekChar(); - - if (nextChar == '=') - { - NextChar(); - return HeaderParserValue::GreaterEqual(pos); - } - if (nextChar == '>') - { - NextChar(); - return HeaderParserValue::ShiftRight(pos); - } + NextChar(); + return HeaderParserValue::GreaterEqual(pos); } - - return HeaderParserValue::Character(GetPreviousCharacterPos(), static_cast<char>(c)); - } - - case '=': - { - if (NextCharInLineIs('=')) + if (nextChar == '>') { - const auto pos = GetPreviousCharacterPos(); NextChar(); - return HeaderParserValue::Equals(pos); + return HeaderParserValue::ShiftRight(pos); } + } + + return HeaderParserValue::Character(GetPreviousCharacterPos(), static_cast<char>(c)); + } - return HeaderParserValue::Character(GetPreviousCharacterPos(), static_cast<char>(c)); + case '=': + { + if (NextCharInLineIs('=')) + { + const auto pos = GetPreviousCharacterPos(); + NextChar(); + return HeaderParserValue::Equals(pos); } + return HeaderParserValue::Character(GetPreviousCharacterPos(), static_cast<char>(c)); + } + case '&': + { + if (NextCharInLineIs('&')) { - if (NextCharInLineIs('&')) - { - const auto pos = GetPreviousCharacterPos(); - NextChar(); - return HeaderParserValue::LogicalAnd(pos); - } - - return HeaderParserValue::Character(GetPreviousCharacterPos(), static_cast<char>(c)); + const auto pos = GetPreviousCharacterPos(); + NextChar(); + return HeaderParserValue::LogicalAnd(pos); } + return HeaderParserValue::Character(GetPreviousCharacterPos(), static_cast<char>(c)); + } + case '|': + { + if (NextCharInLineIs('|')) { - if (NextCharInLineIs('|')) - { - const auto pos = GetPreviousCharacterPos(); - NextChar(); - return HeaderParserValue::LogicalOr(pos); - } - - return HeaderParserValue::Character(GetPreviousCharacterPos(), static_cast<char>(c)); + const auto pos = GetPreviousCharacterPos(); + NextChar(); + return HeaderParserValue::LogicalOr(pos); } + return HeaderParserValue::Character(GetPreviousCharacterPos(), static_cast<char>(c)); + } + case '!': + { + if (NextCharInLineIs('=')) { - if (NextCharInLineIs('=')) - { - const auto pos = GetPreviousCharacterPos(); - NextChar(); - return HeaderParserValue::NotEqual(pos); - } - - return HeaderParserValue::Character(GetPreviousCharacterPos(), static_cast<char>(c)); + const auto pos = GetPreviousCharacterPos(); + NextChar(); + return HeaderParserValue::NotEqual(pos); } - default: - { - if (isspace(c)) - break; + return HeaderParserValue::Character(GetPreviousCharacterPos(), static_cast<char>(c)); + } - const auto pos = GetPreviousCharacterPos(); - if(isdigit(c)) - { - bool isFloatingPointValue; - bool hasSignPrefix; - double doubleValue; - int integerValue; + default: + { + if (isspace(c)) + break; - ReadNumber(isFloatingPointValue, hasSignPrefix, doubleValue, integerValue); + const auto pos = GetPreviousCharacterPos(); + if (isdigit(c)) + { + bool isFloatingPointValue; + bool hasSignPrefix; + double doubleValue; + int integerValue; - if (isFloatingPointValue) - return HeaderParserValue::FloatingPoint(pos, doubleValue); + ReadNumber(isFloatingPointValue, hasSignPrefix, doubleValue, integerValue); - return HeaderParserValue::Integer(pos, integerValue); - } + if (isFloatingPointValue) + return HeaderParserValue::FloatingPoint(pos, doubleValue); - if (isalpha(c) || c == '_') - { - auto identifier = ReadIdentifier(); + return HeaderParserValue::Integer(pos, integerValue); + } - const auto foundKeyword = m_keywords.find(identifier); - if (foundKeyword != m_keywords.end()) - return HeaderParserValue::Keyword(pos, foundKeyword->second); + if (isalpha(c) || c == '_') + { + auto identifier = ReadIdentifier(); - return HeaderParserValue::Identifier(pos, new std::string(std::move(identifier))); - } + const auto foundKeyword = m_keywords.find(identifier); + if (foundKeyword != m_keywords.end()) + return HeaderParserValue::Keyword(pos, foundKeyword->second); - return HeaderParserValue::Character(pos, static_cast<char>(c)); + return HeaderParserValue::Identifier(pos, new std::string(std::move(identifier))); } + + return HeaderParserValue::Character(pos, static_cast<char>(c)); + } } c = NextChar(); diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Impl/HeaderLexer.h b/src/ZoneCodeGeneratorLib/Parsing/Header/Impl/HeaderLexer.h index ab9640b7c..fe0a86268 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Impl/HeaderLexer.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Impl/HeaderLexer.h @@ -1,10 +1,10 @@ #pragma once -#include <unordered_map> - #include "HeaderParserValue.h" #include "Parsing/Impl/AbstractLexer.h" +#include <unordered_map> + class HeaderLexer final : public AbstractLexer<HeaderParserValue> { std::unordered_map<std::string, HeaderParserValueType> m_keywords; diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Impl/HeaderParserState.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Impl/HeaderParserState.cpp index b4dbb7f8d..43046ba70 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Impl/HeaderParserState.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Impl/HeaderParserState.cpp @@ -1,11 +1,10 @@ #include "HeaderParserState.h" -#include <iostream> - - #include "Domain/Definition/EnumDefinition.h" #include "Parsing/Header/Block/HeaderBlockNone.h" +#include <iostream> + HeaderParserState::HeaderParserState(const IPackValueSupplier* packValueSupplier) : m_pack_value_supplier(packValueSupplier) @@ -198,7 +197,5 @@ bool HeaderParserState::MoveDefinitionsToRepository(IDataRepository* repository) bool HeaderParserState::SaveToRepository(IDataRepository* repository) { - return ResolveForwardDeclarations() - && ReplaceForwardDeclarationsInDefinitions() - && MoveDefinitionsToRepository(repository); + return ResolveForwardDeclarations() && ReplaceForwardDeclarationsInDefinitions() && MoveDefinitionsToRepository(repository); } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Impl/HeaderParserState.h b/src/ZoneCodeGeneratorLib/Parsing/Header/Impl/HeaderParserState.h index e0b6b4c94..9c1b96c68 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Impl/HeaderParserState.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Impl/HeaderParserState.h @@ -1,18 +1,18 @@ #pragma once -#include <memory> -#include <stack> -#include <unordered_map> - -#include "Utils/ClassUtils.h" #include "Domain/Definition/BaseTypeDefinition.h" #include "Domain/Definition/DataDefinition.h" #include "Domain/Definition/EnumMember.h" #include "Domain/Definition/ForwardDeclaration.h" -#include "Parsing/IPackValueSupplier.h" -#include "Utils/NamespaceBuilder.h" #include "Parsing/Header/Block/IHeaderBlock.h" +#include "Parsing/IPackValueSupplier.h" #include "Persistence/IDataRepository.h" +#include "Utils/ClassUtils.h" +#include "Utils/NamespaceBuilder.h" + +#include <memory> +#include <stack> +#include <unordered_map> class IHeaderBlock; diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Impl/HeaderParserValue.h b/src/ZoneCodeGeneratorLib/Parsing/Header/Impl/HeaderParserValue.h index d707c677b..fc2e440fa 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Impl/HeaderParserValue.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Impl/HeaderParserValue.h @@ -1,10 +1,10 @@ #pragma once -#include <string> - #include "Parsing/IParserValue.h" -#include "Utils/ClassUtils.h" #include "Parsing/TokenPos.h" +#include "Utils/ClassUtils.h" + +#include <string> enum class HeaderParserValueType { @@ -63,6 +63,7 @@ class HeaderParserValue final : public IParserValue public: TokenPos m_pos; HeaderParserValueType m_type; + union ValueType { char char_value; @@ -108,4 +109,4 @@ class HeaderParserValue final : public IParserValue _NODISCARD std::string& StringValue() const; _NODISCARD std::string& IdentifierValue() const; _NODISCARD std::string& TypeNameValue() const; -}; \ No newline at end of file +}; diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderCommonMatchers.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderCommonMatchers.cpp index 8e632fd31..3b7482d50 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderCommonMatchers.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderCommonMatchers.cpp @@ -1,117 +1,92 @@ #include "HeaderCommonMatchers.h" +#include "HeaderMatcherFactory.h" + #include <sstream> #include <type_traits> -#include "HeaderMatcherFactory.h" - std::unique_ptr<HeaderCommonMatchers::matcher_t> HeaderCommonMatchers::Align(const supplier_t* labelSupplier) { const HeaderMatcherFactory create(labelSupplier); - return create.Or({ - create.And({ - create.Type(HeaderParserValueType::DECLSPEC), - create.Char('('), - create.Type(HeaderParserValueType::ALIGN), - create.Char('('), - create.Integer(), - create.Char(')'), - create.Char(')') - }).Transform([](HeaderMatcherFactory::token_list_t& values) - { - return HeaderParserValue::Integer(values[4].get().GetPos(), values[4].get().IntegerValue()); - }), - create.And({ - create.Type(HeaderParserValueType::ALIGNAS), - create.Char('('), - create.Integer(), - create.Char(')') - }).Transform([](HeaderMatcherFactory::token_list_t& values) - { - return HeaderParserValue::Integer(values[2].get().GetPos(), values[2].get().IntegerValue()); - }) - }); + return create.Or({create + .And({create.Type(HeaderParserValueType::DECLSPEC), + create.Char('('), + create.Type(HeaderParserValueType::ALIGN), + create.Char('('), + create.Integer(), + create.Char(')'), + create.Char(')')}) + .Transform( + [](HeaderMatcherFactory::token_list_t& values) + { + return HeaderParserValue::Integer(values[4].get().GetPos(), values[4].get().IntegerValue()); + }), + create.And({create.Type(HeaderParserValueType::ALIGNAS), create.Char('('), create.Integer(), create.Char(')')}) + .Transform( + [](HeaderMatcherFactory::token_list_t& values) + { + return HeaderParserValue::Integer(values[2].get().GetPos(), values[2].get().IntegerValue()); + })}); } std::unique_ptr<HeaderCommonMatchers::matcher_t> HeaderCommonMatchers::ArrayDef(const supplier_t* labelSupplier) { const HeaderMatcherFactory create(labelSupplier); - return create.And({ - create.Char('['), - create.Or({ - create.Integer(), - create.Identifier() - }), - create.Char(']') - }).Transform([](HeaderMatcherFactory::token_list_t& values) - { - if (values[1].get().m_type == HeaderParserValueType::INTEGER) - return HeaderParserValue::Integer(values[1].get().GetPos(), values[1].get().IntegerValue()); + return create.And({create.Char('['), create.Or({create.Integer(), create.Identifier()}), create.Char(']')}) + .Transform( + [](HeaderMatcherFactory::token_list_t& values) + { + if (values[1].get().m_type == HeaderParserValueType::INTEGER) + return HeaderParserValue::Integer(values[1].get().GetPos(), values[1].get().IntegerValue()); - return HeaderParserValue::Identifier(values[1].get().GetPos(), new std::string(values[1].get().IdentifierValue())); - }); + return HeaderParserValue::Identifier(values[1].get().GetPos(), new std::string(values[1].get().IdentifierValue())); + }); } std::unique_ptr<HeaderCommonMatchers::matcher_t> HeaderCommonMatchers::Typename(const supplier_t* labelSupplier) { - static constexpr const char* BUILT_IN_TYPE_NAMES[] - { - "unsigned", - "char", - "short", - "int", - "long" - }; - static_assert(std::extent<decltype(BUILT_IN_TYPE_NAMES)>::value == static_cast<int>(HeaderParserValueType::BUILT_IN_LAST) - static_cast<int>(HeaderParserValueType::BUILT_IN_FIRST) + 1); + static constexpr const char* BUILT_IN_TYPE_NAMES[]{"unsigned", "char", "short", "int", "long"}; + static_assert(std::extent<decltype(BUILT_IN_TYPE_NAMES)>::value + == static_cast<int>(HeaderParserValueType::BUILT_IN_LAST) - static_cast<int>(HeaderParserValueType::BUILT_IN_FIRST) + 1); const HeaderMatcherFactory create(labelSupplier); - return create.Or({ - create.And({ - create.Optional(create.Type(HeaderParserValueType::UNSIGNED)), - create.Or({ - create.Type(HeaderParserValueType::CHAR), - create.Type(HeaderParserValueType::SHORT), - create.Type(HeaderParserValueType::INT), - create.And({ - create.Type(HeaderParserValueType::LONG), - create.Optional(create.Type(HeaderParserValueType::LONG)) - }) - }) - }).Transform([](HeaderMatcherFactory::token_list_t& values) - { - std::ostringstream str; - auto first = true; + return create.Or( + {create + .And({create.Optional(create.Type(HeaderParserValueType::UNSIGNED)), + create.Or({create.Type(HeaderParserValueType::CHAR), + create.Type(HeaderParserValueType::SHORT), + create.Type(HeaderParserValueType::INT), + create.And({create.Type(HeaderParserValueType::LONG), create.Optional(create.Type(HeaderParserValueType::LONG))})})}) + .Transform( + [](HeaderMatcherFactory::token_list_t& values) + { + std::ostringstream str; + auto first = true; - for (const auto& token : values) - { - if (first) - first = false; - else - str << " "; - str << BUILT_IN_TYPE_NAMES[static_cast<int>(token.get().m_type) - static_cast<int>(HeaderParserValueType::BUILT_IN_FIRST)]; - } + for (const auto& token : values) + { + if (first) + first = false; + else + str << " "; + str << BUILT_IN_TYPE_NAMES[static_cast<int>(token.get().m_type) - static_cast<int>(HeaderParserValueType::BUILT_IN_FIRST)]; + } - return HeaderParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); - }), - create.And({ - create.Identifier(), - create.OptionalLoop(create.And({ - create.Char(':'), - create.Char(':'), - create.Identifier() - })) - }).Transform([](HeaderMatcherFactory::token_list_t& values) - { - std::ostringstream str; - str << values[0].get().IdentifierValue(); + return HeaderParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); + }), + create.And({create.Identifier(), create.OptionalLoop(create.And({create.Char(':'), create.Char(':'), create.Identifier()}))}) + .Transform( + [](HeaderMatcherFactory::token_list_t& values) + { + std::ostringstream str; + str << values[0].get().IdentifierValue(); - for (auto i = 3u; i < values.size(); i += 3) - str << "::" << values[i].get().IdentifierValue(); + for (auto i = 3u; i < values.size(); i += 3) + str << "::" << values[i].get().IdentifierValue(); - return HeaderParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); - }) - }); + return HeaderParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); + })}); } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderCommonMatchers.h b/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderCommonMatchers.h index 516bf4ce3..adab69076 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderCommonMatchers.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderCommonMatchers.h @@ -1,12 +1,12 @@ #pragma once -#include <limits> -#include <memory> - #include "Parsing/Header/Impl/HeaderParserValue.h" #include "Parsing/Matcher/AbstractMatcher.h" #include "Parsing/Matcher/MatcherLabel.h" +#include <limits> +#include <memory> + class HeaderCommonMatchers { public: diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderMatcherCharacter.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderMatcherCharacter.cpp index 8305a27c0..9b0a0d869 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderMatcherCharacter.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderMatcherCharacter.cpp @@ -8,7 +8,6 @@ HeaderMatcherCharacter::HeaderMatcherCharacter(const char c) MatcherResult<HeaderParserValue> HeaderMatcherCharacter::CanMatch(ILexer<HeaderParserValue>* lexer, const unsigned tokenOffset) { const auto& token = lexer->GetToken(tokenOffset); - return token.m_type == HeaderParserValueType::CHARACTER && token.CharacterValue() == m_char - ? MatcherResult<HeaderParserValue>::Match(1) - : MatcherResult<HeaderParserValue>::NoMatch(); + return token.m_type == HeaderParserValueType::CHARACTER && token.CharacterValue() == m_char ? MatcherResult<HeaderParserValue>::Match(1) + : MatcherResult<HeaderParserValue>::NoMatch(); } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderMatcherValueType.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderMatcherValueType.cpp index a37c8eb2f..1c57068c4 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderMatcherValueType.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderMatcherValueType.cpp @@ -7,7 +7,5 @@ HeaderMatcherValueType::HeaderMatcherValueType(HeaderParserValueType type) MatcherResult<HeaderParserValue> HeaderMatcherValueType::CanMatch(ILexer<HeaderParserValue>* lexer, const unsigned tokenOffset) { - return lexer->GetToken(tokenOffset).m_type == m_type - ? MatcherResult<HeaderParserValue>::Match(1) - : MatcherResult<HeaderParserValue>::NoMatch(); + return lexer->GetToken(tokenOffset).m_type == m_type ? MatcherResult<HeaderParserValue>::Match(1) : MatcherResult<HeaderParserValue>::NoMatch(); } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceCloseBlock.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceCloseBlock.cpp index 84718444e..16aeedae7 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceCloseBlock.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceCloseBlock.cpp @@ -1,21 +1,16 @@ #include "SequenceCloseBlock.h" #include "Parsing/Header/Block/IHeaderBlockNameHolder.h" -#include "Parsing/Header/Matcher/HeaderMatcherFactory.h" #include "Parsing/Header/Matcher/HeaderCommonMatchers.h" +#include "Parsing/Header/Matcher/HeaderMatcherFactory.h" SequenceCloseBlock::SequenceCloseBlock(const bool semicolonRequired) : m_semicolon_required(semicolonRequired) { const HeaderMatcherFactory create(this); - AddMatchers({ - create.Char('}').Capture(CAPTURE_CLOSING_PARENTHESIS), - create.Optional(create.And({ - create.Optional(create.Identifier().Capture(CAPTURE_NAME)), - create.Char(';').Tag(TAG_SEMICOLON) - })) - }); + AddMatchers({create.Char('}').Capture(CAPTURE_CLOSING_PARENTHESIS), + create.Optional(create.And({create.Optional(create.Identifier().Capture(CAPTURE_NAME)), create.Char(';').Tag(TAG_SEMICOLON)}))}); } void SequenceCloseBlock::ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceCloseBlock.h b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceCloseBlock.h index 1376dccc6..62093b522 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceCloseBlock.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceCloseBlock.h @@ -1,9 +1,9 @@ #pragma once #include "Parsing/Header/Impl/HeaderParser.h" -#include "Parsing/Sequence/AbstractSequence.h" #include "Parsing/Header/Impl/HeaderParserState.h" #include "Parsing/Header/Impl/HeaderParserValue.h" +#include "Parsing/Sequence/AbstractSequence.h" class SequenceCloseBlock final : public HeaderParser::sequence_t { diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnum.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnum.cpp index c60704c68..e5e0cee7c 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnum.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnum.cpp @@ -1,24 +1,19 @@ #include "SequenceEnum.h" #include "Parsing/Header/Block/HeaderBlockEnum.h" -#include "Parsing/Header/Matcher/HeaderMatcherFactory.h" #include "Parsing/Header/Matcher/HeaderCommonMatchers.h" +#include "Parsing/Header/Matcher/HeaderMatcherFactory.h" SequenceEnum::SequenceEnum() { const HeaderMatcherFactory create(this); AddLabeledMatchers(HeaderCommonMatchers::Typename(this), HeaderCommonMatchers::LABEL_TYPENAME); - AddMatchers({ - create.Optional(create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF)), - create.Type(HeaderParserValueType::ENUM), - create.Optional(create.Identifier().Capture(CAPTURE_NAME)), - create.Optional(create.And({ - create.Char(':'), - create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_PARENT_TYPE) - })), - create.Char('{') - }); + AddMatchers({create.Optional(create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF)), + create.Type(HeaderParserValueType::ENUM), + create.Optional(create.Identifier().Capture(CAPTURE_NAME)), + create.Optional(create.And({create.Char(':'), create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_PARENT_TYPE)})), + create.Char('{')}); } void SequenceEnum::ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const @@ -30,7 +25,7 @@ void SequenceEnum::ProcessMatch(HeaderParserState* state, SequenceResult<HeaderP if (result.HasNextCapture(CAPTURE_NAME)) name = result.NextCapture(CAPTURE_NAME).IdentifierValue(); - if(result.HasNextCapture(CAPTURE_PARENT_TYPE)) + if (result.HasNextCapture(CAPTURE_PARENT_TYPE)) { const auto& typeNameToken = result.NextCapture(CAPTURE_PARENT_TYPE); const auto* foundTypeDefinition = state->FindType(typeNameToken.TypeNameValue()); diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnum.h b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnum.h index 93f1641dc..ab540c6b3 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnum.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnum.h @@ -1,9 +1,9 @@ #pragma once #include "Parsing/Header/Impl/HeaderParser.h" -#include "Parsing/Sequence/AbstractSequence.h" #include "Parsing/Header/Impl/HeaderParserState.h" #include "Parsing/Header/Impl/HeaderParserValue.h" +#include "Parsing/Sequence/AbstractSequence.h" class SequenceEnum final : public HeaderParser::sequence_t { diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnumMember.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnumMember.cpp index ca482b589..1ea705390 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnumMember.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnumMember.cpp @@ -1,27 +1,17 @@ #include "SequenceEnumMember.h" #include "Parsing/Header/Block/HeaderBlockEnum.h" -#include "Parsing/Header/Matcher/HeaderMatcherFactory.h" #include "Parsing/Header/Matcher/HeaderCommonMatchers.h" +#include "Parsing/Header/Matcher/HeaderMatcherFactory.h" SequenceEnumMember::SequenceEnumMember() { const HeaderMatcherFactory create(this); - AddMatchers({ - create.Identifier().Capture(CAPTURE_NAME), - create.Optional(create.And({ - create.Char('='), - create.Or({ - create.Identifier().Capture(CAPTURE_VALUE), - create.Integer().Capture(CAPTURE_VALUE) - }) - })), - create.Or({ - create.Char(','), - create.Char('}').NoConsume() - }) - }); + AddMatchers( + {create.Identifier().Capture(CAPTURE_NAME), + create.Optional(create.And({create.Char('='), create.Or({create.Identifier().Capture(CAPTURE_VALUE), create.Integer().Capture(CAPTURE_VALUE)})})), + create.Or({create.Char(','), create.Char('}').NoConsume()})}); } void SequenceEnumMember::ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnumMember.h b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnumMember.h index bd039d734..b180dd840 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnumMember.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnumMember.h @@ -1,9 +1,9 @@ #pragma once #include "Parsing/Header/Impl/HeaderParser.h" -#include "Parsing/Sequence/AbstractSequence.h" #include "Parsing/Header/Impl/HeaderParserState.h" #include "Parsing/Header/Impl/HeaderParserValue.h" +#include "Parsing/Sequence/AbstractSequence.h" class SequenceEnumMember final : public HeaderParser::sequence_t { diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceForwardDecl.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceForwardDecl.cpp index 77dc1b60e..161d56807 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceForwardDecl.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceForwardDecl.cpp @@ -1,21 +1,19 @@ #include "SequenceForwardDecl.h" -#include "Parsing/Header/Matcher/HeaderMatcherFactory.h" #include "Parsing/Header/Matcher/HeaderCommonMatchers.h" +#include "Parsing/Header/Matcher/HeaderMatcherFactory.h" SequenceForwardDecl::SequenceForwardDecl() { const HeaderMatcherFactory create(this); - AddMatchers({ - create.Or({ - create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM), - create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), - create.Type(HeaderParserValueType::UNION).Tag(TAG_UNION) - }).Capture(CAPTURE_TYPE), - create.Identifier().Capture(CAPTURE_NAME), - create.Char(';') - }); + AddMatchers({create + .Or({create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM), + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + create.Type(HeaderParserValueType::UNION).Tag(TAG_UNION)}) + .Capture(CAPTURE_TYPE), + create.Identifier().Capture(CAPTURE_NAME), + create.Char(';')}); } void SequenceForwardDecl::ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const @@ -23,7 +21,7 @@ void SequenceForwardDecl::ProcessMatch(HeaderParserState* state, SequenceResult< const auto typeTag = result.NextTag(); DataDefinitionType type; - switch(typeTag) + switch (typeTag) { case TAG_ENUM: type = DataDefinitionType::ENUM; diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceForwardDecl.h b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceForwardDecl.h index 44304de2c..ebcd6efc7 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceForwardDecl.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceForwardDecl.h @@ -1,9 +1,9 @@ #pragma once #include "Parsing/Header/Impl/HeaderParser.h" -#include "Parsing/Sequence/AbstractSequence.h" #include "Parsing/Header/Impl/HeaderParserState.h" #include "Parsing/Header/Impl/HeaderParserValue.h" +#include "Parsing/Sequence/AbstractSequence.h" class SequenceForwardDecl final : public HeaderParser::sequence_t { diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceNamespace.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceNamespace.cpp index 261293924..f40e6c7ec 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceNamespace.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceNamespace.cpp @@ -1,6 +1,5 @@ #include "SequenceNamespace.h" - #include "Parsing/Header/Block/HeaderBlockNamespace.h" #include "Parsing/Header/Matcher/HeaderMatcherFactory.h" @@ -8,11 +7,7 @@ SequenceNamespace::SequenceNamespace() { const HeaderMatcherFactory create(this); - AddMatchers({ - create.Type(HeaderParserValueType::NAMESPACE), - create.Type(HeaderParserValueType::IDENTIFIER).Capture(CAPTURE_NAME), - create.Char('{') - }); + AddMatchers({create.Type(HeaderParserValueType::NAMESPACE), create.Type(HeaderParserValueType::IDENTIFIER).Capture(CAPTURE_NAME), create.Char('{')}); } void SequenceNamespace::ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceNamespace.h b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceNamespace.h index a3d7793a9..5a66a45a3 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceNamespace.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceNamespace.h @@ -1,9 +1,9 @@ #pragma once #include "Parsing/Header/Impl/HeaderParser.h" -#include "Parsing/Sequence/AbstractSequence.h" #include "Parsing/Header/Impl/HeaderParserState.h" #include "Parsing/Header/Impl/HeaderParserValue.h" +#include "Parsing/Sequence/AbstractSequence.h" class SequenceNamespace final : public HeaderParser::sequence_t { diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceStruct.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceStruct.cpp index 1a89ee042..dda29228d 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceStruct.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceStruct.cpp @@ -1,8 +1,8 @@ #include "SequenceStruct.h" #include "Parsing/Header/Block/HeaderBlockStruct.h" -#include "Parsing/Header/Matcher/HeaderMatcherFactory.h" #include "Parsing/Header/Matcher/HeaderCommonMatchers.h" +#include "Parsing/Header/Matcher/HeaderMatcherFactory.h" SequenceStruct::SequenceStruct() { @@ -10,18 +10,13 @@ SequenceStruct::SequenceStruct() AddLabeledMatchers(HeaderCommonMatchers::Align(this), HeaderCommonMatchers::LABEL_ALIGN); AddLabeledMatchers(HeaderCommonMatchers::Typename(this), HeaderCommonMatchers::LABEL_TYPENAME); - AddMatchers({ - create.Optional(create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF)), - create.Optional(create.Type(HeaderParserValueType::CONST)), - create.Type(HeaderParserValueType::STRUCT), - create.Optional(create.Label(HeaderCommonMatchers::LABEL_ALIGN).Capture(CAPTURE_ALIGN)), - create.Optional(create.Identifier().Capture(CAPTURE_NAME)), - create.Optional(create.And({ - create.Char(':'), - create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_PARENT_TYPE) - })), - create.Char('{') - }); + AddMatchers({create.Optional(create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF)), + create.Optional(create.Type(HeaderParserValueType::CONST)), + create.Type(HeaderParserValueType::STRUCT), + create.Optional(create.Label(HeaderCommonMatchers::LABEL_ALIGN).Capture(CAPTURE_ALIGN)), + create.Optional(create.Identifier().Capture(CAPTURE_NAME)), + create.Optional(create.And({create.Char(':'), create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_PARENT_TYPE)})), + create.Char('{')}); } void SequenceStruct::ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const @@ -37,12 +32,12 @@ void SequenceStruct::ProcessMatch(HeaderParserState* state, SequenceResult<Heade if (result.HasNextCapture(CAPTURE_ALIGN)) structBlock->SetCustomAlignment(result.NextCapture(CAPTURE_ALIGN).IntegerValue()); - if(result.HasNextCapture(CAPTURE_PARENT_TYPE)) + if (result.HasNextCapture(CAPTURE_PARENT_TYPE)) { const auto& parentTypeToken = result.NextCapture(CAPTURE_PARENT_TYPE); const auto* parentDefinition = state->FindType(parentTypeToken.TypeNameValue()); - if(parentDefinition == nullptr && !state->m_namespace.IsEmpty()) + if (parentDefinition == nullptr && !state->m_namespace.IsEmpty()) { const auto fullTypeName = NamespaceBuilder::Combine(state->m_namespace.ToString(), parentTypeToken.TypeNameValue()); parentDefinition = state->FindType(fullTypeName); @@ -51,7 +46,7 @@ void SequenceStruct::ProcessMatch(HeaderParserState* state, SequenceResult<Heade if (parentDefinition == nullptr) throw ParsingException(parentTypeToken.GetPos(), "Cannot find specified parent type"); - if(parentDefinition->GetType() != DataDefinitionType::STRUCT) + if (parentDefinition->GetType() != DataDefinitionType::STRUCT) throw ParsingException(parentTypeToken.GetPos(), "Parent type must be a struct"); structBlock->Inherit(dynamic_cast<const StructDefinition*>(parentDefinition)); diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceStruct.h b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceStruct.h index 5fee02838..5ea59dece 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceStruct.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceStruct.h @@ -1,9 +1,9 @@ #pragma once #include "Parsing/Header/Impl/HeaderParser.h" -#include "Parsing/Sequence/AbstractSequence.h" #include "Parsing/Header/Impl/HeaderParserState.h" #include "Parsing/Header/Impl/HeaderParserValue.h" +#include "Parsing/Sequence/AbstractSequence.h" class SequenceStruct final : public HeaderParser::sequence_t { diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceTypedef.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceTypedef.cpp index 4204f0efe..7b3995730 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceTypedef.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceTypedef.cpp @@ -2,8 +2,8 @@ #include "Domain/Definition/ArrayDeclarationModifier.h" #include "Domain/Definition/PointerDeclarationModifier.h" -#include "Parsing/Header/Matcher/HeaderMatcherFactory.h" #include "Parsing/Header/Matcher/HeaderCommonMatchers.h" +#include "Parsing/Header/Matcher/HeaderMatcherFactory.h" SequenceTypedef::SequenceTypedef() { @@ -13,36 +13,28 @@ SequenceTypedef::SequenceTypedef() AddLabeledMatchers(HeaderCommonMatchers::ArrayDef(this), HeaderCommonMatchers::LABEL_ARRAY_DEF); AddLabeledMatchers(HeaderCommonMatchers::Typename(this), HeaderCommonMatchers::LABEL_TYPENAME); - AddLabeledMatchers( - { - create.Optional(create.Type(HeaderParserValueType::CONST).Tag(TAG_CONST)), - create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.OptionalLoop(create.Char('*').Tag(TAG_POINTER)), - create.Identifier().Capture(CAPTURE_NAME), - create.OptionalLoop(create.Label(HeaderCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY)), - create.Char(';') - }, LABEL_ARRAY_OF_POINTERS); - - AddLabeledMatchers( - { - create.Optional(create.Type(HeaderParserValueType::CONST).Tag(TAG_CONST)), - create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.Char('('), - create.Loop(create.Char('*').Tag(TAG_POINTER)), - create.Identifier().Capture(CAPTURE_NAME), - create.Char(')'), - create.Loop(create.Label(HeaderCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY)), - create.Char(';') - }, LABEL_POINTER_TO_ARRAY); - - AddMatchers({ - create.Type(HeaderParserValueType::TYPEDEF), - create.Optional(create.Label(HeaderCommonMatchers::LABEL_ALIGN).Capture(CAPTURE_ALIGN)), - create.Or({ - create.Label(LABEL_ARRAY_OF_POINTERS).Tag(TAG_ARRAY_OF_POINTERS), - create.Label(LABEL_POINTER_TO_ARRAY).Tag(TAG_POINTER_TO_ARRAY) - }) - }); + AddLabeledMatchers({create.Optional(create.Type(HeaderParserValueType::CONST).Tag(TAG_CONST)), + create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.OptionalLoop(create.Char('*').Tag(TAG_POINTER)), + create.Identifier().Capture(CAPTURE_NAME), + create.OptionalLoop(create.Label(HeaderCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY)), + create.Char(';')}, + LABEL_ARRAY_OF_POINTERS); + + AddLabeledMatchers({create.Optional(create.Type(HeaderParserValueType::CONST).Tag(TAG_CONST)), + create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.Char('('), + create.Loop(create.Char('*').Tag(TAG_POINTER)), + create.Identifier().Capture(CAPTURE_NAME), + create.Char(')'), + create.Loop(create.Label(HeaderCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY)), + create.Char(';')}, + LABEL_POINTER_TO_ARRAY); + + AddMatchers( + {create.Type(HeaderParserValueType::TYPEDEF), + create.Optional(create.Label(HeaderCommonMatchers::LABEL_ALIGN).Capture(CAPTURE_ALIGN)), + create.Or({create.Label(LABEL_ARRAY_OF_POINTERS).Tag(TAG_ARRAY_OF_POINTERS), create.Label(LABEL_POINTER_TO_ARRAY).Tag(TAG_POINTER_TO_ARRAY)})}); } void SequenceTypedef::AddPointerDeclarationModifiers(SequenceResult<HeaderParserValue>& result, TypeDeclaration* typeDeclaration) const @@ -93,7 +85,7 @@ void SequenceTypedef::ProcessMatch(HeaderParserState* state, SequenceResult<Head auto typedefDefinition = std::make_unique<TypedefDefinition>(state->m_namespace.ToString(), name, std::make_unique<TypeDeclaration>(type)); typedefDefinition->m_type_declaration->m_is_const = result.PeekAndRemoveIfTag(TAG_CONST) == TAG_CONST; - if(result.HasNextCapture(CAPTURE_ALIGN)) + if (result.HasNextCapture(CAPTURE_ALIGN)) { const auto& alignToken = result.NextCapture(CAPTURE_ALIGN); typedefDefinition->m_alignment_override = static_cast<unsigned>(alignToken.IntegerValue()); diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceTypedef.h b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceTypedef.h index 424e47e93..ed6441a92 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceTypedef.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceTypedef.h @@ -1,9 +1,9 @@ #pragma once #include "Parsing/Header/Impl/HeaderParser.h" -#include "Parsing/Sequence/AbstractSequence.h" #include "Parsing/Header/Impl/HeaderParserState.h" #include "Parsing/Header/Impl/HeaderParserValue.h" +#include "Parsing/Sequence/AbstractSequence.h" class SequenceTypedef final : public HeaderParser::sequence_t { diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceUnion.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceUnion.cpp index a2fe83da3..a685b9632 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceUnion.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceUnion.cpp @@ -1,8 +1,8 @@ #include "SequenceUnion.h" #include "Parsing/Header/Block/HeaderBlockUnion.h" -#include "Parsing/Header/Matcher/HeaderMatcherFactory.h" #include "Parsing/Header/Matcher/HeaderCommonMatchers.h" +#include "Parsing/Header/Matcher/HeaderMatcherFactory.h" SequenceUnion::SequenceUnion() { @@ -10,18 +10,13 @@ SequenceUnion::SequenceUnion() AddLabeledMatchers(HeaderCommonMatchers::Align(this), HeaderCommonMatchers::LABEL_ALIGN); AddLabeledMatchers(HeaderCommonMatchers::Typename(this), HeaderCommonMatchers::LABEL_TYPENAME); - AddMatchers({ - create.Optional(create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF)), - create.Optional(create.Type(HeaderParserValueType::CONST)), - create.Type(HeaderParserValueType::UNION), - create.Optional(create.Label(HeaderCommonMatchers::LABEL_ALIGN).Capture(CAPTURE_ALIGN)), - create.Optional(create.Identifier().Capture(CAPTURE_NAME)), - create.Optional(create.And({ - create.Char(':'), - create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_PARENT_TYPE) - })), - create.Char('{') - }); + AddMatchers({create.Optional(create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF)), + create.Optional(create.Type(HeaderParserValueType::CONST)), + create.Type(HeaderParserValueType::UNION), + create.Optional(create.Label(HeaderCommonMatchers::LABEL_ALIGN).Capture(CAPTURE_ALIGN)), + create.Optional(create.Identifier().Capture(CAPTURE_NAME)), + create.Optional(create.And({create.Char(':'), create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_PARENT_TYPE)})), + create.Char('{')}); } void SequenceUnion::ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceUnion.h b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceUnion.h index 707243563..e839e8798 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceUnion.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceUnion.h @@ -1,9 +1,9 @@ #pragma once #include "Parsing/Header/Impl/HeaderParser.h" -#include "Parsing/Sequence/AbstractSequence.h" #include "Parsing/Header/Impl/HeaderParserState.h" #include "Parsing/Header/Impl/HeaderParserValue.h" +#include "Parsing/Sequence/AbstractSequence.h" class SequenceUnion final : public HeaderParser::sequence_t { diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceVariable.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceVariable.cpp index 5d348044e..da19809ae 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceVariable.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceVariable.cpp @@ -3,8 +3,8 @@ #include "Domain/Definition/ArrayDeclarationModifier.h" #include "Domain/Definition/PointerDeclarationModifier.h" #include "Parsing/Header/Block/IHeaderBlockVariableHolder.h" -#include "Parsing/Header/Matcher/HeaderMatcherFactory.h" #include "Parsing/Header/Matcher/HeaderCommonMatchers.h" +#include "Parsing/Header/Matcher/HeaderMatcherFactory.h" SequenceVariable::SequenceVariable() { @@ -14,36 +14,26 @@ SequenceVariable::SequenceVariable() AddLabeledMatchers(HeaderCommonMatchers::ArrayDef(this), HeaderCommonMatchers::LABEL_ARRAY_DEF); AddLabeledMatchers(HeaderCommonMatchers::Typename(this), HeaderCommonMatchers::LABEL_TYPENAME); - AddLabeledMatchers( - { - create.Optional(create.Type(HeaderParserValueType::CONST).Tag(TAG_CONST)), - create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.OptionalLoop(create.Char('*').Tag(TAG_POINTER)), - create.Identifier().Capture(CAPTURE_NAME), - create.OptionalLoop(create.Label(HeaderCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY)), - create.Optional(create.And({ - create.Char(':'), - create.Integer().Capture(CAPTURE_BIT_SIZE) - })), - create.Char(';') - }, LABEL_ARRAY_OF_POINTERS); - - AddLabeledMatchers( - { - create.Optional(create.Type(HeaderParserValueType::CONST).Tag(TAG_CONST)), - create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.Char('('), - create.Loop(create.Char('*').Tag(TAG_POINTER)), - create.Identifier().Capture(CAPTURE_NAME), - create.Char(')'), - create.Loop(create.Label(HeaderCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY)), - create.Char(';') - }, LABEL_POINTER_TO_ARRAY); - - AddMatchers(create.Or({ - create.Label(LABEL_ARRAY_OF_POINTERS).Tag(TAG_ARRAY_OF_POINTERS), - create.Label(LABEL_POINTER_TO_ARRAY).Tag(TAG_POINTER_TO_ARRAY) - })); + AddLabeledMatchers({create.Optional(create.Type(HeaderParserValueType::CONST).Tag(TAG_CONST)), + create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.OptionalLoop(create.Char('*').Tag(TAG_POINTER)), + create.Identifier().Capture(CAPTURE_NAME), + create.OptionalLoop(create.Label(HeaderCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY)), + create.Optional(create.And({create.Char(':'), create.Integer().Capture(CAPTURE_BIT_SIZE)})), + create.Char(';')}, + LABEL_ARRAY_OF_POINTERS); + + AddLabeledMatchers({create.Optional(create.Type(HeaderParserValueType::CONST).Tag(TAG_CONST)), + create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.Char('('), + create.Loop(create.Char('*').Tag(TAG_POINTER)), + create.Identifier().Capture(CAPTURE_NAME), + create.Char(')'), + create.Loop(create.Label(HeaderCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY)), + create.Char(';')}, + LABEL_POINTER_TO_ARRAY); + + AddMatchers(create.Or({create.Label(LABEL_ARRAY_OF_POINTERS).Tag(TAG_ARRAY_OF_POINTERS), create.Label(LABEL_POINTER_TO_ARRAY).Tag(TAG_POINTER_TO_ARRAY)})); } void SequenceVariable::AddPointerDeclarationModifiers(SequenceResult<HeaderParserValue>& result, TypeDeclaration* typeDeclaration) const @@ -105,7 +95,7 @@ void SequenceVariable::ProcessMatch(HeaderParserState* state, SequenceResult<Hea variable->m_has_alignment_override = true; } - if(result.HasNextCapture(CAPTURE_BIT_SIZE)) + if (result.HasNextCapture(CAPTURE_BIT_SIZE)) { const auto& bitSizeToken = result.NextCapture(CAPTURE_BIT_SIZE); variable->m_type_declaration->m_custom_bit_size = bitSizeToken.IntegerValue(); diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceVariable.h b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceVariable.h index 70a5986f4..7c7b4b0dd 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceVariable.h +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceVariable.h @@ -1,9 +1,9 @@ #pragma once #include "Parsing/Header/Impl/HeaderParser.h" -#include "Parsing/Sequence/AbstractSequence.h" #include "Parsing/Header/Impl/HeaderParserState.h" #include "Parsing/Header/Impl/HeaderParserValue.h" +#include "Parsing/Sequence/AbstractSequence.h" class SequenceVariable final : public HeaderParser::sequence_t { diff --git a/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/CalculateSizeAndAlignPostProcessor.cpp b/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/CalculateSizeAndAlignPostProcessor.cpp index d686ab3a7..2b42d18e6 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/CalculateSizeAndAlignPostProcessor.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/CalculateSizeAndAlignPostProcessor.cpp @@ -1,12 +1,12 @@ #include "CalculateSizeAndAlignPostProcessor.h" -#include <cassert> -#include <iostream> -#include <cstdint> - #include "Domain/Definition/ArrayDeclarationModifier.h" #include "Utils/AlignmentUtils.h" +#include <cassert> +#include <cstdint> +#include <iostream> + unsigned CalculateSizeAndAlignPostProcessor::GetPointerSizeForArchitecture(const Architecture architecture) { switch (architecture) @@ -141,7 +141,8 @@ bool CalculateSizeAndAlignPostProcessor::CalculateSize(IDataRepository* reposito currentBitOffset = 0; } - definition->m_size = AlignmentUtils::Align(definition->m_size, member->GetForceAlignment() ? member->GetAlignment() : std::min(member->GetAlignment(), definition->m_pack)); + definition->m_size = AlignmentUtils::Align( + definition->m_size, member->GetForceAlignment() ? member->GetAlignment() : std::min(member->GetAlignment(), definition->m_pack)); member->m_offset = definition->m_size; @@ -186,8 +187,7 @@ bool CalculateSizeAndAlignPostProcessor::CalculateFields(IDataRepository* reposi if (declaration->m_flags & TypeDeclaration::FLAG_FIELDS_CALCULATED) return true; - if(!CalculateAlign(repository, declaration) - || !CalculateSize(repository, declaration)) + if (!CalculateAlign(repository, declaration) || !CalculateSize(repository, declaration)) { return false; } @@ -208,8 +208,7 @@ bool CalculateSizeAndAlignPostProcessor::CalculateFields(IDataRepository* reposi structDefinition->m_flags |= DefinitionWithMembers::FLAG_FIELDS_CALCULATING; - if (!CalculateAlign(repository, structDefinition) - || !CalculateSize(repository, structDefinition)) + if (!CalculateAlign(repository, structDefinition) || !CalculateSize(repository, structDefinition)) { return false; } @@ -232,8 +231,7 @@ bool CalculateSizeAndAlignPostProcessor::CalculateFields(IDataRepository* reposi unionDefinition->m_flags |= DefinitionWithMembers::FLAG_FIELDS_CALCULATING; - if (!CalculateAlign(repository, unionDefinition) - || !CalculateSize(repository, unionDefinition)) + if (!CalculateAlign(repository, unionDefinition) || !CalculateSize(repository, unionDefinition)) { return false; } @@ -246,19 +244,19 @@ bool CalculateSizeAndAlignPostProcessor::CalculateFields(IDataRepository* reposi bool CalculateSizeAndAlignPostProcessor::CalculateFieldsIfNecessary(IDataRepository* repository, const DataDefinition* definition) { - if(definition->GetType() == DataDefinitionType::STRUCT) + if (definition->GetType() == DataDefinitionType::STRUCT) { // We can do a const cast here because the only reason that field is const anyway is because it could be a base type return CalculateFields(repository, dynamic_cast<StructDefinition*>(const_cast<DataDefinition*>(definition))); } - if(definition->GetType() == DataDefinitionType::UNION) + if (definition->GetType() == DataDefinitionType::UNION) { // We can do a const cast here because the only reason that field is const anyway is because it could be a base type return CalculateFields(repository, dynamic_cast<UnionDefinition*>(const_cast<DataDefinition*>(definition))); } - if(definition->GetType() == DataDefinitionType::TYPEDEF) + if (definition->GetType() == DataDefinitionType::TYPEDEF) { // We can do a const cast here because the only reason that field is const anyway is because it could be a base type return CalculateFields(repository, dynamic_cast<TypedefDefinition*>(const_cast<DataDefinition*>(definition))->m_type_declaration.get()); diff --git a/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/CreateMemberInformationPostProcessor.cpp b/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/CreateMemberInformationPostProcessor.cpp index 5bd9b5c50..84c42dabb 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/CreateMemberInformationPostProcessor.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/CreateMemberInformationPostProcessor.cpp @@ -4,19 +4,19 @@ bool CreateMemberInformationPostProcessor::CreateMemberInformationForStructure(IDataRepository* repository, StructureInformation* structure) const { - for(const auto& member : structure->m_definition->m_members) + for (const auto& member : structure->m_definition->m_members) { StructureInformation* typeInfo = nullptr; const auto* currentDefinition = member->m_type_declaration->m_type; - while(currentDefinition->GetType() == DataDefinitionType::TYPEDEF) + while (currentDefinition->GetType() == DataDefinitionType::TYPEDEF) { currentDefinition = dynamic_cast<const TypedefDefinition*>(currentDefinition)->m_type_declaration->m_type; } const auto* memberDefinition = dynamic_cast<const DefinitionWithMembers*>(currentDefinition); - if(memberDefinition != nullptr) + if (memberDefinition != nullptr) typeInfo = repository->GetInformationFor(memberDefinition); structure->m_ordered_members.emplace_back(std::make_unique<MemberInformation>(structure, typeInfo, member.get())); @@ -29,8 +29,10 @@ bool CreateMemberInformationPostProcessor::PostProcess(IDataRepository* reposito { const auto& allStructureInformation = repository->GetAllStructureInformation(); - return std::all_of(allStructureInformation.begin(), allStructureInformation.end(), [this, repository](StructureInformation* structure) - { - return CreateMemberInformationForStructure(repository, structure); - }); + return std::all_of(allStructureInformation.begin(), + allStructureInformation.end(), + [this, repository](StructureInformation* structure) + { + return CreateMemberInformationForStructure(repository, structure); + }); } diff --git a/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/CreateStructureInformationPostProcessor.cpp b/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/CreateStructureInformationPostProcessor.cpp index 3d95f041f..08a4d50a3 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/CreateStructureInformationPostProcessor.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/CreateStructureInformationPostProcessor.cpp @@ -2,17 +2,17 @@ bool CreateStructureInformationPostProcessor::PostProcess(IDataRepository* repository) { - for(auto* structDefinition : repository->GetAllStructs()) + for (auto* structDefinition : repository->GetAllStructs()) { auto* information = repository->GetInformationFor(structDefinition); - if(information == nullptr) + if (information == nullptr) repository->Add(std::make_unique<StructureInformation>(structDefinition)); } - for(auto* unionDefinition : repository->GetAllUnions()) + for (auto* unionDefinition : repository->GetAllUnions()) { auto* information = repository->GetInformationFor(unionDefinition); - if(information == nullptr) + if (information == nullptr) repository->Add(std::make_unique<StructureInformation>(unionDefinition)); } diff --git a/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/LeafsPostProcessor.cpp b/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/LeafsPostProcessor.cpp index fa692323d..62eff71b1 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/LeafsPostProcessor.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/LeafsPostProcessor.cpp @@ -35,9 +35,7 @@ bool LeafsPostProcessor::IsLeaf(StructureInformation* info) if (computations.HasDynamicArraySize()) return false; - if (member->m_type != nullptr - && member->m_type != info - && !IsLeaf(member->m_type)) + if (member->m_type != nullptr && member->m_type != info && !IsLeaf(member->m_type)) { return false; } diff --git a/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/MemberLeafsPostProcessor.cpp b/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/MemberLeafsPostProcessor.cpp index 4c8d2a2dc..d3d730896 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/MemberLeafsPostProcessor.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/MemberLeafsPostProcessor.cpp @@ -34,7 +34,7 @@ bool MemberLeafsPostProcessor::MemberIsLeaf(MemberInformation* member) void MemberLeafsPostProcessor::ProcessInfo(StructureInformation* info) { - for(const auto& member : info->m_ordered_members) + for (const auto& member : info->m_ordered_members) { member->m_is_leaf = MemberIsLeaf(member.get()); } diff --git a/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/UnionsPostProcessor.cpp b/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/UnionsPostProcessor.cpp index f843092ac..2af004e0e 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/UnionsPostProcessor.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/UnionsPostProcessor.cpp @@ -9,9 +9,9 @@ bool UnionsPostProcessor::ProcessUnion(StructureInformation* info) auto lastEntryWithoutCondition = 0u; auto entriesWithoutConditionCount = 0u; - for(const auto& member : info->m_ordered_members) + for (const auto& member : info->m_ordered_members) { - if(!member->m_condition && !member->m_is_leaf) + if (!member->m_condition && !member->m_is_leaf) { entriesWithoutConditionCount++; lastEntryWithoutCondition = index; @@ -40,11 +40,13 @@ bool UnionsPostProcessor::PostProcess(IDataRepository* repository) { const auto& allInfos = repository->GetAllStructureInformation(); - return std::all_of(allInfos.begin(), allInfos.end(), [](StructureInformation* info) - { - if (info->m_definition->GetType() != DataDefinitionType::UNION) - return true; + return std::all_of(allInfos.begin(), + allInfos.end(), + [](StructureInformation* info) + { + if (info->m_definition->GetType() != DataDefinitionType::UNION) + return true; - return ProcessUnion(info); - }); + return ProcessUnion(info); + }); } diff --git a/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/UsagesPostProcessor.cpp b/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/UsagesPostProcessor.cpp index cc48213b6..e8214f315 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/UsagesPostProcessor.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/PostProcessing/UsagesPostProcessor.cpp @@ -1,12 +1,12 @@ #include "UsagesPostProcessor.h" +#include "Domain/Computations/MemberComputations.h" +#include "Domain/Computations/StructureComputations.h" + #include <algorithm> #include <queue> #include <set> -#include "Domain/Computations/MemberComputations.h" -#include "Domain/Computations/StructureComputations.h" - bool UsagesPostProcessor::ProcessAsset(StructureInformation* info) { std::set<StructureInformation*> processedInfos; @@ -14,23 +14,23 @@ bool UsagesPostProcessor::ProcessAsset(StructureInformation* info) processingQueue.push(info); - while(!processingQueue.empty()) + while (!processingQueue.empty()) { auto* currentStructure = processingQueue.front(); processingQueue.pop(); - if(processedInfos.find(currentStructure) != processedInfos.end()) + if (processedInfos.find(currentStructure) != processedInfos.end()) continue; processedInfos.emplace(currentStructure); for (const auto& member : currentStructure->m_ordered_members) { - if(member->m_type == nullptr) + if (member->m_type == nullptr) continue; const MemberComputations computations(member.get()); - if(computations.ShouldIgnore()) + if (computations.ShouldIgnore()) continue; if (computations.ContainsNonEmbeddedReference()) @@ -63,9 +63,11 @@ bool UsagesPostProcessor::PostProcess(IDataRepository* repository) { const auto& allInfos = repository->GetAllStructureInformation(); - return std::all_of(allInfos.begin(), allInfos.end(), [](StructureInformation* info) - { - const StructureComputations computations(info); - return !computations.IsAsset() || ProcessAsset(info); - }); + return std::all_of(allInfos.begin(), + allInfos.end(), + [](StructureInformation* info) + { + const StructureComputations computations(info); + return !computations.IsAsset() || ProcessAsset(info); + }); } diff --git a/src/ZoneCodeGeneratorLib/Persistence/IDataRepository.h b/src/ZoneCodeGeneratorLib/Persistence/IDataRepository.h index 8bb6758b1..0176aa17a 100644 --- a/src/ZoneCodeGeneratorLib/Persistence/IDataRepository.h +++ b/src/ZoneCodeGeneratorLib/Persistence/IDataRepository.h @@ -1,15 +1,15 @@ #pragma once -#include <vector> - -#include "Utils/ClassUtils.h" #include "Domain/Definition/EnumDefinition.h" #include "Domain/Definition/StructDefinition.h" #include "Domain/Definition/TypedefDefinition.h" #include "Domain/Definition/UnionDefinition.h" #include "Domain/Environment/Architecture.h" -#include "Domain/Information/StructureInformation.h" #include "Domain/FastFile/FastFileBlock.h" +#include "Domain/Information/StructureInformation.h" +#include "Utils/ClassUtils.h" + +#include <vector> class IDataRepository { diff --git a/src/ZoneCodeGeneratorLib/Persistence/InMemory/InMemoryRepository.h b/src/ZoneCodeGeneratorLib/Persistence/InMemory/InMemoryRepository.h index 3ba5566df..6bac128ef 100644 --- a/src/ZoneCodeGeneratorLib/Persistence/InMemory/InMemoryRepository.h +++ b/src/ZoneCodeGeneratorLib/Persistence/InMemory/InMemoryRepository.h @@ -1,9 +1,9 @@ #pragma once -#include <map> - #include "Persistence/IDataRepository.h" +#include <map> + class InMemoryRepository final : public IDataRepository { std::vector<EnumDefinition*> m_enums; diff --git a/src/ZoneCodeGeneratorLib/Printing/PrettyPrinter.cpp b/src/ZoneCodeGeneratorLib/Printing/PrettyPrinter.cpp index d6306c799..fdfb964a3 100644 --- a/src/ZoneCodeGeneratorLib/Printing/PrettyPrinter.cpp +++ b/src/ZoneCodeGeneratorLib/Printing/PrettyPrinter.cpp @@ -1,13 +1,11 @@ #include "PrettyPrinter.h" +#include "Domain/Definition/ArrayDeclarationModifier.h" +#include "Utils/NamespaceBuilder.h" #include <algorithm> #include <iostream> - -#include "Domain/Definition/ArrayDeclarationModifier.h" -#include "Utils/NamespaceBuilder.h" - PrettyPrinter::PrettyPrinter(std::ostream& stream, const IDataRepository* repository) : m_stream(stream), m_repository(repository) @@ -17,8 +15,8 @@ PrettyPrinter::PrettyPrinter(std::ostream& stream, const IDataRepository* reposi void PrettyPrinter::PrintSeparator() const { m_stream << std::endl - << "==========================================================================================================" << std::endl - << std::endl; + << "==========================================================================================================" << std::endl + << std::endl; } void PrettyPrinter::PrintVariablePointerToArray(Variable* variable) const @@ -64,7 +62,7 @@ void PrettyPrinter::PrintVariableArrayOfPointers(Variable* variable) const auto pointerDepth = 0; auto modifierOffset = 0u; - for(; modifierOffset < declarationModifiers.size(); modifierOffset++) + for (; modifierOffset < declarationModifiers.size(); modifierOffset++) { const auto& modifier = declarationModifiers[modifierOffset]; if (modifier->GetType() != DeclarationModifierType::ARRAY) @@ -73,7 +71,7 @@ void PrettyPrinter::PrintVariableArrayOfPointers(Variable* variable) const arraySize.push_back(dynamic_cast<ArrayDeclarationModifier*>(modifier.get())->m_size); } - for(; modifierOffset < declarationModifiers.size(); modifierOffset++) + for (; modifierOffset < declarationModifiers.size(); modifierOffset++) { const auto& modifier = declarationModifiers[modifierOffset]; if (modifier->GetType() != DeclarationModifierType::POINTER) @@ -101,10 +99,12 @@ void PrettyPrinter::PrintVariable(Variable* variable) const else { if (declarationModifiers[0]->GetType() == DeclarationModifierType::POINTER - && std::any_of(declarationModifiers.begin(), declarationModifiers.end(), [](const std::unique_ptr<DeclarationModifier>& modifier) - { - return modifier->GetType() == DeclarationModifierType::ARRAY; - })) + && std::any_of(declarationModifiers.begin(), + declarationModifiers.end(), + [](const std::unique_ptr<DeclarationModifier>& modifier) + { + return modifier->GetType() == DeclarationModifierType::ARRAY; + })) { PrintVariablePointerToArray(variable); } @@ -264,10 +264,12 @@ void PrettyPrinter::PrintTypedefs() const else { if (declarationModifiers[0]->GetType() == DeclarationModifierType::POINTER - && std::any_of(declarationModifiers.begin(), declarationModifiers.end(), [](const std::unique_ptr<DeclarationModifier>& modifier) - { - return modifier->GetType() == DeclarationModifierType::ARRAY; - })) + && std::any_of(declarationModifiers.begin(), + declarationModifiers.end(), + [](const std::unique_ptr<DeclarationModifier>& modifier) + { + return modifier->GetType() == DeclarationModifierType::ARRAY; + })) { PrintTypedefPointerToArray(typedefDefinition); } diff --git a/src/ZoneCodeGeneratorLib/Printing/PrettyPrinter.h b/src/ZoneCodeGeneratorLib/Printing/PrettyPrinter.h index 714f33654..6aa5b0db3 100644 --- a/src/ZoneCodeGeneratorLib/Printing/PrettyPrinter.h +++ b/src/ZoneCodeGeneratorLib/Printing/PrettyPrinter.h @@ -1,9 +1,9 @@ #pragma once -#include <ostream> - #include "Persistence/IDataRepository.h" +#include <ostream> + class PrettyPrinter { std::ostream& m_stream; diff --git a/src/ZoneCodeGeneratorLib/Utils/AlignmentUtils.h b/src/ZoneCodeGeneratorLib/Utils/AlignmentUtils.h index b734193f7..beafd28c2 100644 --- a/src/ZoneCodeGeneratorLib/Utils/AlignmentUtils.h +++ b/src/ZoneCodeGeneratorLib/Utils/AlignmentUtils.h @@ -3,12 +3,11 @@ class AlignmentUtils { public: - template<typename T> - static T Align(T number, T alignmentValue) + template<typename T> static T Align(T number, T alignmentValue) { if (alignmentValue == 0) return number; return (number + (alignmentValue - 1)) / alignmentValue * alignmentValue; } -}; \ No newline at end of file +}; diff --git a/src/ZoneCodeGeneratorLib/Utils/NamespaceBuilder.cpp b/src/ZoneCodeGeneratorLib/Utils/NamespaceBuilder.cpp index 572be3329..c5b8c1d61 100644 --- a/src/ZoneCodeGeneratorLib/Utils/NamespaceBuilder.cpp +++ b/src/ZoneCodeGeneratorLib/Utils/NamespaceBuilder.cpp @@ -33,7 +33,7 @@ std::string NamespaceBuilder::ToString() std::ostringstream str; auto first = true; - for(const auto& element : m_elements) + for (const auto& element : m_elements) { if (first) first = false; diff --git a/src/ZoneCodeGeneratorLib/Utils/NamespaceBuilder.h b/src/ZoneCodeGeneratorLib/Utils/NamespaceBuilder.h index f64863fec..a75b0a4e0 100644 --- a/src/ZoneCodeGeneratorLib/Utils/NamespaceBuilder.h +++ b/src/ZoneCodeGeneratorLib/Utils/NamespaceBuilder.h @@ -1,6 +1,7 @@ #pragma once #include "Utils/ClassUtils.h" + #include <string> #include <vector> diff --git a/src/ZoneCodeGeneratorLib/ZoneCodeGenerator.cpp b/src/ZoneCodeGeneratorLib/ZoneCodeGenerator.cpp index ac4186e00..b6b7a5940 100644 --- a/src/ZoneCodeGeneratorLib/ZoneCodeGenerator.cpp +++ b/src/ZoneCodeGeneratorLib/ZoneCodeGenerator.cpp @@ -1,17 +1,17 @@ #include "ZoneCodeGenerator.h" -#include <cstdio> -#include <memory> -#include <string> -#include <iostream> - -#include "ZoneCodeGeneratorArguments.h" #include "Generating/CodeGenerator.h" #include "Parsing/Commands/CommandsFileReader.h" #include "Parsing/Header/HeaderFileReader.h" #include "Persistence/IDataRepository.h" #include "Persistence/InMemory/InMemoryRepository.h" #include "Printing/PrettyPrinter.h" +#include "ZoneCodeGeneratorArguments.h" + +#include <cstdio> +#include <iostream> +#include <memory> +#include <string> class ZoneCodeGenerator::Impl { @@ -70,12 +70,12 @@ class ZoneCodeGenerator::Impl if (!ReadHeaderData() || !ReadCommandsData()) return 1; - if(m_args.ShouldPrint()) + if (m_args.ShouldPrint()) { PrintData(); } - if(m_args.ShouldGenerate()) + if (m_args.ShouldGenerate()) { if (!GenerateCode()) return 1; diff --git a/src/ZoneCodeGeneratorLib/ZoneCodeGenerator.h b/src/ZoneCodeGeneratorLib/ZoneCodeGenerator.h index 61f5b3417..861d4d484 100644 --- a/src/ZoneCodeGeneratorLib/ZoneCodeGenerator.h +++ b/src/ZoneCodeGeneratorLib/ZoneCodeGenerator.h @@ -14,4 +14,4 @@ class ZoneCodeGenerator ZoneCodeGenerator& operator=(ZoneCodeGenerator&& other) noexcept = default; int Run(int argc, const char** argv) const; -}; \ No newline at end of file +}; diff --git a/src/ZoneCodeGeneratorLib/ZoneCodeGeneratorArguments.cpp b/src/ZoneCodeGeneratorLib/ZoneCodeGeneratorArguments.cpp index 675184c45..9f30103ba 100644 --- a/src/ZoneCodeGeneratorLib/ZoneCodeGeneratorArguments.cpp +++ b/src/ZoneCodeGeneratorLib/ZoneCodeGeneratorArguments.cpp @@ -1,22 +1,16 @@ #include "ZoneCodeGeneratorArguments.h" -#include <iostream> -#include <type_traits> - #include "Utils/Arguments/CommandLineOption.h" #include "Utils/Arguments/UsageInformation.h" -const CommandLineOption* const OPTION_HELP = CommandLineOption::Builder::Create() - .WithShortName("?") - .WithLongName("help") - .WithDescription("Displays usage information.") - .Build(); +#include <iostream> +#include <type_traits> + +const CommandLineOption* const OPTION_HELP = + CommandLineOption::Builder::Create().WithShortName("?").WithLongName("help").WithDescription("Displays usage information.").Build(); -const CommandLineOption* const OPTION_VERBOSE = CommandLineOption::Builder::Create() - .WithShortName("v") - .WithLongName("verbose") - .WithDescription("Outputs a lot more and more detailed messages.") - .Build(); +const CommandLineOption* const OPTION_VERBOSE = + CommandLineOption::Builder::Create().WithShortName("v").WithLongName("verbose").WithDescription("Outputs a lot more and more detailed messages.").Build(); // ------ // INPUT @@ -25,65 +19,58 @@ const CommandLineOption* const OPTION_VERBOSE = CommandLineOption::Builder::Crea constexpr const char* CATEGORY_INPUT = "Input"; const CommandLineOption* const OPTION_HEADER = CommandLineOption::Builder::Create() - .WithShortName("h") - .WithLongName("header") - .WithDescription("Reads from the specified header file.") - .WithCategory(CATEGORY_INPUT) - .WithParameter("headerFile") - .Reusable() - .Build(); + .WithShortName("h") + .WithLongName("header") + .WithDescription("Reads from the specified header file.") + .WithCategory(CATEGORY_INPUT) + .WithParameter("headerFile") + .Reusable() + .Build(); const CommandLineOption* const OPTION_COMMANDS_FILE = CommandLineOption::Builder::Create() - .WithShortName("c") - .WithLongName("commands-file") - .WithDescription("Specifies the commands file. Defaults to stdin.") - .WithCategory(CATEGORY_INPUT) - .WithParameter("commandFile") - .Reusable() - .Build(); + .WithShortName("c") + .WithLongName("commands-file") + .WithDescription("Specifies the commands file. Defaults to stdin.") + .WithCategory(CATEGORY_INPUT) + .WithParameter("commandFile") + .Reusable() + .Build(); // ------ // OUTPUT // ------ constexpr const char* CATEGORY_OUTPUT = "Output"; -const CommandLineOption* const OPTION_OUTPUT_FOLDER = CommandLineOption::Builder::Create() - .WithShortName("o") - .WithLongName("output") - .WithDescription("Specify the folder to save the generate code files to. Defaults to the current directory.") - .WithCategory(CATEGORY_OUTPUT) - .WithParameter("outputPath") - .Build(); +const CommandLineOption* const OPTION_OUTPUT_FOLDER = + CommandLineOption::Builder::Create() + .WithShortName("o") + .WithLongName("output") + .WithDescription("Specify the folder to save the generate code files to. Defaults to the current directory.") + .WithCategory(CATEGORY_OUTPUT) + .WithParameter("outputPath") + .Build(); const CommandLineOption* const OPTION_PRINT = CommandLineOption::Builder::Create() - .WithShortName("p") - .WithLongName("print") - .WithDescription("Print the loaded data.") - .WithCategory(CATEGORY_OUTPUT) - .Build(); - -const CommandLineOption* const OPTION_GENERATE = CommandLineOption::Builder::Create() - .WithShortName("g") - .WithLongName("generate") - .WithDescription( - "Generates a specified asset/preset combination. Can be used multiple times. Available presets: " - "ZoneLoad, ZoneWrite, AssetStructTests") - .WithCategory(CATEGORY_OUTPUT) - .WithParameter("assetName") - .WithParameter("preset") - .Reusable() - .Build(); - -const CommandLineOption* const COMMAND_LINE_OPTIONS[] -{ - OPTION_HELP, - OPTION_VERBOSE, - OPTION_HEADER, - OPTION_COMMANDS_FILE, - OPTION_OUTPUT_FOLDER, - OPTION_PRINT, - OPTION_GENERATE -}; + .WithShortName("p") + .WithLongName("print") + .WithDescription("Print the loaded data.") + .WithCategory(CATEGORY_OUTPUT) + .Build(); + +const CommandLineOption* const OPTION_GENERATE = + CommandLineOption::Builder::Create() + .WithShortName("g") + .WithLongName("generate") + .WithDescription("Generates a specified asset/preset combination. Can be used multiple times. Available presets: " + "ZoneLoad, ZoneWrite, AssetStructTests") + .WithCategory(CATEGORY_OUTPUT) + .WithParameter("assetName") + .WithParameter("preset") + .Reusable() + .Build(); + +const CommandLineOption* const COMMAND_LINE_OPTIONS[]{ + OPTION_HELP, OPTION_VERBOSE, OPTION_HEADER, OPTION_COMMANDS_FILE, OPTION_OUTPUT_FOLDER, OPTION_PRINT, OPTION_GENERATE}; ZoneCodeGeneratorArguments::GenerationTask::GenerationTask() : m_all_assets(false) diff --git a/src/ZoneCodeGeneratorLib/ZoneCodeGeneratorArguments.h b/src/ZoneCodeGeneratorLib/ZoneCodeGeneratorArguments.h index 286e5e68f..1344d2af9 100644 --- a/src/ZoneCodeGeneratorLib/ZoneCodeGeneratorArguments.h +++ b/src/ZoneCodeGeneratorLib/ZoneCodeGeneratorArguments.h @@ -1,7 +1,7 @@ #pragma once -#include "Utils/ClassUtils.h" #include "Utils/Arguments/ArgumentParser.h" +#include "Utils/ClassUtils.h" #include <vector> diff --git a/src/ZoneCommon/Game/IW3/GameAssetPoolIW3.cpp b/src/ZoneCommon/Game/IW3/GameAssetPoolIW3.cpp index e203030c8..d802128d1 100644 --- a/src/ZoneCommon/Game/IW3/GameAssetPoolIW3.cpp +++ b/src/ZoneCommon/Game/IW3/GameAssetPoolIW3.cpp @@ -1,48 +1,18 @@ #include "GameAssetPoolIW3.h" +#include "Pool/AssetPoolDynamic.h" +#include "Pool/AssetPoolStatic.h" + #include <cassert> #include <type_traits> -#include "Pool/AssetPoolStatic.h" -#include "Pool/AssetPoolDynamic.h" - using namespace IW3; -const char* GameAssetPoolIW3::ASSET_TYPE_NAMES[] -{ - "xmodelpieces", - "physpreset", - "xanim", - "xmodel", - "material", - "techniqueset", - "image", - "sound", - "soundcurve", - "loadedsound", - "clipmap", - "clipmap", - "comworld", - "gameworldsp", - "gameworldmp", - "mapents", - "gfxworld", - "lightdef", - "uimap", - "font", - "menulist", - "menu", - "localize", - "weapon", - "snddriverglobals", - "fx", - "impactfx", - "aitype", - "mptype", - "character", - "xmodelalias", - "rawfile", - "stringtable" +const char* GameAssetPoolIW3::ASSET_TYPE_NAMES[]{ + "xmodelpieces", "physpreset", "xanim", "xmodel", "material", "techniqueset", "image", "sound", "soundcurve", "loadedsound", + "clipmap", "clipmap", "comworld", "gameworldsp", "gameworldmp", "mapents", "gfxworld", "lightdef", "uimap", "font", + "menulist", "menu", "localize", "weapon", "snddriverglobals", "fx", "impactfx", "aitype", "mptype", "character", + "xmodelalias", "rawfile", "stringtable", }; /* @@ -81,21 +51,21 @@ const char* GameAssetPoolIW3::ASSET_TYPE_NAMES[] GameAssetPoolIW3::GameAssetPoolIW3(Zone* zone, const int priority) : ZoneAssetPools(zone), - m_priority(priority) + m_priority(priority) { static_assert(std::extent<decltype(ASSET_TYPE_NAMES)>::value == ASSET_TYPE_COUNT); } void GameAssetPoolIW3::InitPoolStatic(const asset_type_t type, const size_t capacity) { -#define CASE_INIT_POOL_STATIC(assetType, poolName, poolType) \ - case assetType: \ - { \ - if((poolName) == nullptr && capacity > 0) \ - { \ - (poolName) = std::make_unique<AssetPoolStatic<poolType>>(capacity, m_priority, (assetType)); \ - } \ - break; \ +#define CASE_INIT_POOL_STATIC(assetType, poolName, poolType) \ + case assetType: \ + { \ + if ((poolName) == nullptr && capacity > 0) \ + { \ + (poolName) = std::make_unique<AssetPoolStatic<poolType>>(capacity, m_priority, (assetType)); \ + } \ + break; \ } switch (type) @@ -137,14 +107,14 @@ void GameAssetPoolIW3::InitPoolStatic(const asset_type_t type, const size_t capa void GameAssetPoolIW3::InitPoolDynamic(const asset_type_t type) { -#define CASE_INIT_POOL_DYNAMIC(assetType, poolName, poolType) \ - case assetType: \ - { \ - if((poolName) == nullptr) \ - { \ - (poolName) = std::make_unique<AssetPoolDynamic<poolType>>(m_priority, (assetType)); \ - } \ - break; \ +#define CASE_INIT_POOL_DYNAMIC(assetType, poolName, poolType) \ + case assetType: \ + { \ + if ((poolName) == nullptr) \ + { \ + (poolName) = std::make_unique<AssetPoolDynamic<poolType>>(m_priority, (assetType)); \ + } \ + break; \ } switch (type) @@ -184,18 +154,19 @@ void GameAssetPoolIW3::InitPoolDynamic(const asset_type_t type) #undef CASE_INIT_POOL_STATIC } -XAssetInfoGeneric* GameAssetPoolIW3::AddAssetToPool(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone) +XAssetInfoGeneric* GameAssetPoolIW3::AddAssetToPool( + asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone) { XAsset xAsset{}; xAsset.type = static_cast<XAssetType>(type); xAsset.header.data = asset; -#define CASE_ADD_TO_POOL(assetType, poolName, headerName) \ - case assetType: \ - { \ - assert((poolName) != nullptr); \ - return (poolName)->AddAsset(std::move(name), xAsset.header.headerName, zone, std::move(dependencies), std::move(usedScriptStrings)); \ +#define CASE_ADD_TO_POOL(assetType, poolName, headerName) \ + case assetType: \ + { \ + assert((poolName) != nullptr); \ + return (poolName)->AddAsset(std::move(name), xAsset.header.headerName, zone, std::move(dependencies), std::move(usedScriptStrings)); \ } switch (xAsset.type) @@ -239,12 +210,12 @@ XAssetInfoGeneric* GameAssetPoolIW3::AddAssetToPool(asset_type_t type, std::stri XAssetInfoGeneric* GameAssetPoolIW3::GetAsset(const asset_type_t type, std::string name) const { -#define CASE_GET_ASSET(assetType, poolName) \ - case assetType: \ - { \ - if((poolName) != nullptr) \ - return (poolName)->GetAsset(std::move(name)); \ - break; \ +#define CASE_GET_ASSET(assetType, poolName) \ + case assetType: \ + { \ + if ((poolName) != nullptr) \ + return (poolName)->GetAsset(std::move(name)); \ + break; \ } switch (type) diff --git a/src/ZoneCommon/Game/IW3/GameAssetPoolIW3.h b/src/ZoneCommon/Game/IW3/GameAssetPoolIW3.h index 71bcc282c..40e7c82f5 100644 --- a/src/ZoneCommon/Game/IW3/GameAssetPoolIW3.h +++ b/src/ZoneCommon/Game/IW3/GameAssetPoolIW3.h @@ -1,10 +1,10 @@ #pragma once -#include <memory> - -#include "Pool/ZoneAssetPools.h" -#include "Pool/AssetPool.h" #include "Game/IW3/IW3.h" +#include "Pool/AssetPool.h" +#include "Pool/ZoneAssetPools.h" + +#include <memory> class GameAssetPoolIW3 final : public ZoneAssetPools { @@ -14,7 +14,12 @@ class GameAssetPoolIW3 final : public ZoneAssetPools static const char* ASSET_TYPE_NAMES[]; protected: - XAssetInfoGeneric* AddAssetToPool(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone) override; + XAssetInfoGeneric* AddAssetToPool(asset_type_t type, + std::string name, + void* asset, + std::vector<XAssetInfoGeneric*> dependencies, + std::vector<scr_string_t> usedScriptStrings, + Zone* zone) override; public: std::unique_ptr<AssetPool<IW3::PhysPreset>> m_phys_preset; diff --git a/src/ZoneCommon/Game/IW3/ZoneConstantsIW3.h b/src/ZoneCommon/Game/IW3/ZoneConstantsIW3.h index 1c85befe9..45896c5e7 100644 --- a/src/ZoneCommon/Game/IW3/ZoneConstantsIW3.h +++ b/src/ZoneCommon/Game/IW3/ZoneConstantsIW3.h @@ -1,10 +1,10 @@ #pragma once +#include "Game/IW3/IW3.h" +#include "Zone/ZoneTypes.h" + #include <cstdint> #include <string> -#include "Zone/ZoneTypes.h" -#include "Game/IW3/IW3.h" - namespace IW3 { class ZoneConstants final @@ -14,7 +14,7 @@ namespace IW3 public: static constexpr const char* MAGIC_UNSIGNED = "IWffu100"; static constexpr int ZONE_VERSION = 5; - + static_assert(std::char_traits<char>::length(MAGIC_UNSIGNED) == sizeof(ZoneHeader::m_magic)); static constexpr size_t AUTHED_CHUNK_SIZE = 0x2000; @@ -23,4 +23,4 @@ namespace IW3 static constexpr int OFFSET_BLOCK_BIT_COUNT = 4; static constexpr block_t INSERT_BLOCK = XFILE_BLOCK_VIRTUAL; }; -} +} // namespace IW3 diff --git a/src/ZoneCommon/Game/IW4/GameAssetPoolIW4.cpp b/src/ZoneCommon/Game/IW4/GameAssetPoolIW4.cpp index d6cf8a863..b05195335 100644 --- a/src/ZoneCommon/Game/IW4/GameAssetPoolIW4.cpp +++ b/src/ZoneCommon/Game/IW4/GameAssetPoolIW4.cpp @@ -1,64 +1,24 @@ #include "GameAssetPoolIW4.h" +#include "Pool/AssetPoolDynamic.h" +#include "Pool/AssetPoolStatic.h" + #include <cassert> #include <type_traits> -#include "Pool/AssetPoolStatic.h" -#include "Pool/AssetPoolDynamic.h" - using namespace IW4; -const char* GameAssetPoolIW4::ASSET_TYPE_NAMES[] -{ - "physpreset", - "physcollmap", - "xanim", - "xmodelsurfs", - "xmodel", - "material", - "pixelshader", - "vertexshader", - "vertexdecl", - "techniqueset", - "image", - "sound", - "soundcurve", - "loadedsound", - "clipmap", - "clipmap", - "comworld", - "gameworldsp", - "gameworldmp", - "mapents", - "fxworld", - "gfxworld", - "lightdef", - "uimap", - "font", - "menulist", - "menu", - "localize", - "weapon", - "snddriverglobals", - "fx", - "impactfx", - "aitype", - "mptype", - "character", - "xmodelalias", - "rawfile", - "stringtable", - "leaderboard", - "structureddatadef", - "tracer", - "vehicle", - "addonmapents" -}; +const char* GameAssetPoolIW4::ASSET_TYPE_NAMES[]{ + "physpreset", "physcollmap", "xanim", "xmodelsurfs", "xmodel", "material", "pixelshader", "vertexshader", "vertexdecl", "techniqueset", + "image", "sound", "soundcurve", "loadedsound", "clipmap", "clipmap", "comworld", "gameworldsp", "gameworldmp", "mapents", + "fxworld", "gfxworld", "lightdef", "uimap", "font", "menulist", "menu", "localize", "weapon", "snddriverglobals", + "fx", "impactfx", "aitype", "mptype", "character", "xmodelalias", "rawfile", "stringtable", "leaderboard", "structureddatadef", + "tracer", "vehicle", "addonmapents"}; /* Asset Pool Table Useful for macro generation via regex-replace for example - + #assetType, #typeName, #unionEntry, #poolName ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset, m_phys_preset ASSET_TYPE_PHYSCOLLMAP, PhysCollmap, physCollmap, m_phys_collmap @@ -108,54 +68,54 @@ GameAssetPoolIW4::GameAssetPoolIW4(Zone* zone, const int priority) void GameAssetPoolIW4::InitPoolStatic(const asset_type_t type, const size_t capacity) { -#define CASE_INIT_POOL_STATIC(assetType, poolName, poolType) \ - case assetType: \ - { \ - if((poolName) == nullptr && capacity > 0) \ - { \ - (poolName) = std::make_unique<AssetPoolStatic<poolType>>(capacity, m_priority, (assetType)); \ - } \ - break; \ +#define CASE_INIT_POOL_STATIC(assetType, poolName, poolType) \ + case assetType: \ + { \ + if ((poolName) == nullptr && capacity > 0) \ + { \ + (poolName) = std::make_unique<AssetPoolStatic<poolType>>(capacity, m_priority, (assetType)); \ + } \ + break; \ } switch (type) { - CASE_INIT_POOL_STATIC(ASSET_TYPE_PHYSPRESET, m_phys_preset, PhysPreset); - CASE_INIT_POOL_STATIC(ASSET_TYPE_PHYSCOLLMAP, m_phys_collmap, PhysCollmap); - CASE_INIT_POOL_STATIC(ASSET_TYPE_XANIMPARTS, m_xanim_parts, XAnimParts); - CASE_INIT_POOL_STATIC(ASSET_TYPE_XMODEL, m_xmodel, XModel); - CASE_INIT_POOL_STATIC(ASSET_TYPE_MATERIAL, m_material, Material); - CASE_INIT_POOL_STATIC(ASSET_TYPE_PIXELSHADER, m_material_pixel_shader, MaterialPixelShader); - CASE_INIT_POOL_STATIC(ASSET_TYPE_VERTEXSHADER, m_material_vertex_shader, MaterialVertexShader); - CASE_INIT_POOL_STATIC(ASSET_TYPE_VERTEXDECL, m_material_vertex_decl, MaterialVertexDeclaration); - CASE_INIT_POOL_STATIC(ASSET_TYPE_TECHNIQUE_SET, m_technique_set, MaterialTechniqueSet); - CASE_INIT_POOL_STATIC(ASSET_TYPE_IMAGE, m_image, GfxImage); - CASE_INIT_POOL_STATIC(ASSET_TYPE_SOUND, m_sound, snd_alias_list_t); - CASE_INIT_POOL_STATIC(ASSET_TYPE_SOUND_CURVE, m_sound_curve, SndCurve); - CASE_INIT_POOL_STATIC(ASSET_TYPE_LOADED_SOUND, m_loaded_sound, LoadedSound); - CASE_INIT_POOL_STATIC(ASSET_TYPE_CLIPMAP_SP, m_clip_map, clipMap_t); - CASE_INIT_POOL_STATIC(ASSET_TYPE_CLIPMAP_MP, m_clip_map, clipMap_t); - CASE_INIT_POOL_STATIC(ASSET_TYPE_COMWORLD, m_com_world, ComWorld); - CASE_INIT_POOL_STATIC(ASSET_TYPE_GAMEWORLD_SP, m_game_world_sp, GameWorldSp); - CASE_INIT_POOL_STATIC(ASSET_TYPE_GAMEWORLD_MP, m_game_world_mp, GameWorldMp); - CASE_INIT_POOL_STATIC(ASSET_TYPE_MAP_ENTS, m_map_ents, MapEnts); - CASE_INIT_POOL_STATIC(ASSET_TYPE_FXWORLD, m_fx_world, FxWorld); - CASE_INIT_POOL_STATIC(ASSET_TYPE_GFXWORLD, m_gfx_world, GfxWorld); - CASE_INIT_POOL_STATIC(ASSET_TYPE_LIGHT_DEF, m_gfx_light_def, GfxLightDef); - CASE_INIT_POOL_STATIC(ASSET_TYPE_FONT, m_font, Font_s); - CASE_INIT_POOL_STATIC(ASSET_TYPE_MENULIST, m_menu_list, MenuList); - CASE_INIT_POOL_STATIC(ASSET_TYPE_MENU, m_menu_def, menuDef_t); - CASE_INIT_POOL_STATIC(ASSET_TYPE_LOCALIZE_ENTRY, m_localize, LocalizeEntry); - CASE_INIT_POOL_STATIC(ASSET_TYPE_WEAPON, m_weapon, WeaponCompleteDef); - CASE_INIT_POOL_STATIC(ASSET_TYPE_FX, m_fx, FxEffectDef); - CASE_INIT_POOL_STATIC(ASSET_TYPE_IMPACT_FX, m_fx_impact_table, FxImpactTable); - CASE_INIT_POOL_STATIC(ASSET_TYPE_RAWFILE, m_raw_file, RawFile); - CASE_INIT_POOL_STATIC(ASSET_TYPE_STRINGTABLE, m_string_table, StringTable); - CASE_INIT_POOL_STATIC(ASSET_TYPE_LEADERBOARD, m_leaderboard, LeaderboardDef); - CASE_INIT_POOL_STATIC(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set, StructuredDataDefSet); - CASE_INIT_POOL_STATIC(ASSET_TYPE_TRACER, m_tracer, TracerDef); - CASE_INIT_POOL_STATIC(ASSET_TYPE_VEHICLE, m_vehicle, VehicleDef); - CASE_INIT_POOL_STATIC(ASSET_TYPE_ADDON_MAP_ENTS, m_addon_map_ents, AddonMapEnts); + CASE_INIT_POOL_STATIC(ASSET_TYPE_PHYSPRESET, m_phys_preset, PhysPreset); + CASE_INIT_POOL_STATIC(ASSET_TYPE_PHYSCOLLMAP, m_phys_collmap, PhysCollmap); + CASE_INIT_POOL_STATIC(ASSET_TYPE_XANIMPARTS, m_xanim_parts, XAnimParts); + CASE_INIT_POOL_STATIC(ASSET_TYPE_XMODEL, m_xmodel, XModel); + CASE_INIT_POOL_STATIC(ASSET_TYPE_MATERIAL, m_material, Material); + CASE_INIT_POOL_STATIC(ASSET_TYPE_PIXELSHADER, m_material_pixel_shader, MaterialPixelShader); + CASE_INIT_POOL_STATIC(ASSET_TYPE_VERTEXSHADER, m_material_vertex_shader, MaterialVertexShader); + CASE_INIT_POOL_STATIC(ASSET_TYPE_VERTEXDECL, m_material_vertex_decl, MaterialVertexDeclaration); + CASE_INIT_POOL_STATIC(ASSET_TYPE_TECHNIQUE_SET, m_technique_set, MaterialTechniqueSet); + CASE_INIT_POOL_STATIC(ASSET_TYPE_IMAGE, m_image, GfxImage); + CASE_INIT_POOL_STATIC(ASSET_TYPE_SOUND, m_sound, snd_alias_list_t); + CASE_INIT_POOL_STATIC(ASSET_TYPE_SOUND_CURVE, m_sound_curve, SndCurve); + CASE_INIT_POOL_STATIC(ASSET_TYPE_LOADED_SOUND, m_loaded_sound, LoadedSound); + CASE_INIT_POOL_STATIC(ASSET_TYPE_CLIPMAP_SP, m_clip_map, clipMap_t); + CASE_INIT_POOL_STATIC(ASSET_TYPE_CLIPMAP_MP, m_clip_map, clipMap_t); + CASE_INIT_POOL_STATIC(ASSET_TYPE_COMWORLD, m_com_world, ComWorld); + CASE_INIT_POOL_STATIC(ASSET_TYPE_GAMEWORLD_SP, m_game_world_sp, GameWorldSp); + CASE_INIT_POOL_STATIC(ASSET_TYPE_GAMEWORLD_MP, m_game_world_mp, GameWorldMp); + CASE_INIT_POOL_STATIC(ASSET_TYPE_MAP_ENTS, m_map_ents, MapEnts); + CASE_INIT_POOL_STATIC(ASSET_TYPE_FXWORLD, m_fx_world, FxWorld); + CASE_INIT_POOL_STATIC(ASSET_TYPE_GFXWORLD, m_gfx_world, GfxWorld); + CASE_INIT_POOL_STATIC(ASSET_TYPE_LIGHT_DEF, m_gfx_light_def, GfxLightDef); + CASE_INIT_POOL_STATIC(ASSET_TYPE_FONT, m_font, Font_s); + CASE_INIT_POOL_STATIC(ASSET_TYPE_MENULIST, m_menu_list, MenuList); + CASE_INIT_POOL_STATIC(ASSET_TYPE_MENU, m_menu_def, menuDef_t); + CASE_INIT_POOL_STATIC(ASSET_TYPE_LOCALIZE_ENTRY, m_localize, LocalizeEntry); + CASE_INIT_POOL_STATIC(ASSET_TYPE_WEAPON, m_weapon, WeaponCompleteDef); + CASE_INIT_POOL_STATIC(ASSET_TYPE_FX, m_fx, FxEffectDef); + CASE_INIT_POOL_STATIC(ASSET_TYPE_IMPACT_FX, m_fx_impact_table, FxImpactTable); + CASE_INIT_POOL_STATIC(ASSET_TYPE_RAWFILE, m_raw_file, RawFile); + CASE_INIT_POOL_STATIC(ASSET_TYPE_STRINGTABLE, m_string_table, StringTable); + CASE_INIT_POOL_STATIC(ASSET_TYPE_LEADERBOARD, m_leaderboard, LeaderboardDef); + CASE_INIT_POOL_STATIC(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set, StructuredDataDefSet); + CASE_INIT_POOL_STATIC(ASSET_TYPE_TRACER, m_tracer, TracerDef); + CASE_INIT_POOL_STATIC(ASSET_TYPE_VEHICLE, m_vehicle, VehicleDef); + CASE_INIT_POOL_STATIC(ASSET_TYPE_ADDON_MAP_ENTS, m_addon_map_ents, AddonMapEnts); default: assert(type >= 0 && type < ASSET_TYPE_COUNT); @@ -167,54 +127,54 @@ void GameAssetPoolIW4::InitPoolStatic(const asset_type_t type, const size_t capa void GameAssetPoolIW4::InitPoolDynamic(const asset_type_t type) { -#define CASE_INIT_POOL_DYNAMIC(assetType, poolName, poolType) \ - case assetType: \ - { \ - if((poolName) == nullptr) \ - { \ - (poolName) = std::make_unique<AssetPoolDynamic<poolType>>(m_priority, (assetType)); \ - } \ - break; \ +#define CASE_INIT_POOL_DYNAMIC(assetType, poolName, poolType) \ + case assetType: \ + { \ + if ((poolName) == nullptr) \ + { \ + (poolName) = std::make_unique<AssetPoolDynamic<poolType>>(m_priority, (assetType)); \ + } \ + break; \ } switch (type) { - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_PHYSPRESET, m_phys_preset, PhysPreset); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_PHYSCOLLMAP, m_phys_collmap, PhysCollmap); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_XANIMPARTS, m_xanim_parts, XAnimParts); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_XMODEL, m_xmodel, XModel); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_MATERIAL, m_material, Material); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_PIXELSHADER, m_material_pixel_shader, MaterialPixelShader); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_VERTEXSHADER, m_material_vertex_shader, MaterialVertexShader); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_VERTEXDECL, m_material_vertex_decl, MaterialVertexDeclaration); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_TECHNIQUE_SET, m_technique_set, MaterialTechniqueSet); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_IMAGE, m_image, GfxImage); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_SOUND, m_sound, snd_alias_list_t); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_SOUND_CURVE, m_sound_curve, SndCurve); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_LOADED_SOUND, m_loaded_sound, LoadedSound); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_CLIPMAP_SP, m_clip_map, clipMap_t); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_CLIPMAP_MP, m_clip_map, clipMap_t); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_COMWORLD, m_com_world, ComWorld); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_GAMEWORLD_SP, m_game_world_sp, GameWorldSp); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_GAMEWORLD_MP, m_game_world_mp, GameWorldMp); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_MAP_ENTS, m_map_ents, MapEnts); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_FXWORLD, m_fx_world, FxWorld); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_GFXWORLD, m_gfx_world, GfxWorld); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_LIGHT_DEF, m_gfx_light_def, GfxLightDef); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_FONT, m_font, Font_s); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_MENULIST, m_menu_list, MenuList); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_MENU, m_menu_def, menuDef_t); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_LOCALIZE_ENTRY, m_localize, LocalizeEntry); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_WEAPON, m_weapon, WeaponCompleteDef); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_FX, m_fx, FxEffectDef); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_IMPACT_FX, m_fx_impact_table, FxImpactTable); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_RAWFILE, m_raw_file, RawFile); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_STRINGTABLE, m_string_table, StringTable); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_LEADERBOARD, m_leaderboard, LeaderboardDef); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set, StructuredDataDefSet); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_TRACER, m_tracer, TracerDef); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_VEHICLE, m_vehicle, VehicleDef); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_ADDON_MAP_ENTS, m_addon_map_ents, AddonMapEnts); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_PHYSPRESET, m_phys_preset, PhysPreset); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_PHYSCOLLMAP, m_phys_collmap, PhysCollmap); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_XANIMPARTS, m_xanim_parts, XAnimParts); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_XMODEL, m_xmodel, XModel); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_MATERIAL, m_material, Material); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_PIXELSHADER, m_material_pixel_shader, MaterialPixelShader); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_VERTEXSHADER, m_material_vertex_shader, MaterialVertexShader); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_VERTEXDECL, m_material_vertex_decl, MaterialVertexDeclaration); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_TECHNIQUE_SET, m_technique_set, MaterialTechniqueSet); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_IMAGE, m_image, GfxImage); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_SOUND, m_sound, snd_alias_list_t); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_SOUND_CURVE, m_sound_curve, SndCurve); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_LOADED_SOUND, m_loaded_sound, LoadedSound); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_CLIPMAP_SP, m_clip_map, clipMap_t); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_CLIPMAP_MP, m_clip_map, clipMap_t); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_COMWORLD, m_com_world, ComWorld); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_GAMEWORLD_SP, m_game_world_sp, GameWorldSp); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_GAMEWORLD_MP, m_game_world_mp, GameWorldMp); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_MAP_ENTS, m_map_ents, MapEnts); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_FXWORLD, m_fx_world, FxWorld); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_GFXWORLD, m_gfx_world, GfxWorld); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_LIGHT_DEF, m_gfx_light_def, GfxLightDef); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_FONT, m_font, Font_s); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_MENULIST, m_menu_list, MenuList); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_MENU, m_menu_def, menuDef_t); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_LOCALIZE_ENTRY, m_localize, LocalizeEntry); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_WEAPON, m_weapon, WeaponCompleteDef); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_FX, m_fx, FxEffectDef); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_IMPACT_FX, m_fx_impact_table, FxImpactTable); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_RAWFILE, m_raw_file, RawFile); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_STRINGTABLE, m_string_table, StringTable); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_LEADERBOARD, m_leaderboard, LeaderboardDef); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set, StructuredDataDefSet); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_TRACER, m_tracer, TracerDef); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_VEHICLE, m_vehicle, VehicleDef); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_ADDON_MAP_ENTS, m_addon_map_ents, AddonMapEnts); default: assert(type >= 0 && type < ASSET_TYPE_COUNT); @@ -224,58 +184,59 @@ void GameAssetPoolIW4::InitPoolDynamic(const asset_type_t type) #undef CASE_INIT_POOL_STATIC } -XAssetInfoGeneric* GameAssetPoolIW4::AddAssetToPool(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone) +XAssetInfoGeneric* GameAssetPoolIW4::AddAssetToPool( + asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone) { XAsset xAsset{}; xAsset.type = static_cast<XAssetType>(type); xAsset.header.data = asset; -#define CASE_ADD_TO_POOL(assetType, poolName, headerName) \ - case assetType: \ - { \ - assert((poolName) != nullptr); \ - return (poolName)->AddAsset(std::move(name), xAsset.header.headerName, zone, std::move(dependencies), std::move(usedScriptStrings)); \ +#define CASE_ADD_TO_POOL(assetType, poolName, headerName) \ + case assetType: \ + { \ + assert((poolName) != nullptr); \ + return (poolName)->AddAsset(std::move(name), xAsset.header.headerName, zone, std::move(dependencies), std::move(usedScriptStrings)); \ } switch (xAsset.type) { - CASE_ADD_TO_POOL(ASSET_TYPE_PHYSPRESET, m_phys_preset, physPreset); - CASE_ADD_TO_POOL(ASSET_TYPE_PHYSCOLLMAP, m_phys_collmap, physCollmap); - CASE_ADD_TO_POOL(ASSET_TYPE_XANIMPARTS, m_xanim_parts, parts); - CASE_ADD_TO_POOL(ASSET_TYPE_XMODEL, m_xmodel, model); - CASE_ADD_TO_POOL(ASSET_TYPE_MATERIAL, m_material, material); - CASE_ADD_TO_POOL(ASSET_TYPE_PIXELSHADER, m_material_pixel_shader, pixelShader); - CASE_ADD_TO_POOL(ASSET_TYPE_VERTEXSHADER, m_material_vertex_shader, vertexShader); - CASE_ADD_TO_POOL(ASSET_TYPE_VERTEXDECL, m_material_vertex_decl, vertexDecl); - CASE_ADD_TO_POOL(ASSET_TYPE_TECHNIQUE_SET, m_technique_set, techniqueSet); - CASE_ADD_TO_POOL(ASSET_TYPE_IMAGE, m_image, image); - CASE_ADD_TO_POOL(ASSET_TYPE_SOUND, m_sound, sound); - CASE_ADD_TO_POOL(ASSET_TYPE_SOUND_CURVE, m_sound_curve, sndCurve); - CASE_ADD_TO_POOL(ASSET_TYPE_LOADED_SOUND, m_loaded_sound, loadSnd); - CASE_ADD_TO_POOL(ASSET_TYPE_CLIPMAP_SP, m_clip_map, clipMap); - CASE_ADD_TO_POOL(ASSET_TYPE_CLIPMAP_MP, m_clip_map, clipMap); - CASE_ADD_TO_POOL(ASSET_TYPE_COMWORLD, m_com_world, comWorld); - CASE_ADD_TO_POOL(ASSET_TYPE_GAMEWORLD_SP, m_game_world_sp, gameWorldSp); - CASE_ADD_TO_POOL(ASSET_TYPE_GAMEWORLD_MP, m_game_world_mp, gameWorldMp); - CASE_ADD_TO_POOL(ASSET_TYPE_MAP_ENTS, m_map_ents, mapEnts); - CASE_ADD_TO_POOL(ASSET_TYPE_FXWORLD, m_fx_world, fxWorld); - CASE_ADD_TO_POOL(ASSET_TYPE_GFXWORLD, m_gfx_world, gfxWorld); - CASE_ADD_TO_POOL(ASSET_TYPE_LIGHT_DEF, m_gfx_light_def, lightDef); - CASE_ADD_TO_POOL(ASSET_TYPE_FONT, m_font, font); - CASE_ADD_TO_POOL(ASSET_TYPE_MENULIST, m_menu_list, menuList); - CASE_ADD_TO_POOL(ASSET_TYPE_MENU, m_menu_def, menu); - CASE_ADD_TO_POOL(ASSET_TYPE_LOCALIZE_ENTRY, m_localize, localize); - CASE_ADD_TO_POOL(ASSET_TYPE_WEAPON, m_weapon, weapon); - CASE_ADD_TO_POOL(ASSET_TYPE_FX, m_fx, fx); - CASE_ADD_TO_POOL(ASSET_TYPE_IMPACT_FX, m_fx_impact_table, impactFx); - CASE_ADD_TO_POOL(ASSET_TYPE_RAWFILE, m_raw_file, rawfile); - CASE_ADD_TO_POOL(ASSET_TYPE_STRINGTABLE, m_string_table, stringTable); - CASE_ADD_TO_POOL(ASSET_TYPE_LEADERBOARD, m_leaderboard, leaderboardDef); - CASE_ADD_TO_POOL(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set, structuredDataDefSet); - CASE_ADD_TO_POOL(ASSET_TYPE_TRACER, m_tracer, tracerDef); - CASE_ADD_TO_POOL(ASSET_TYPE_VEHICLE, m_vehicle, vehDef); - CASE_ADD_TO_POOL(ASSET_TYPE_ADDON_MAP_ENTS, m_addon_map_ents, addonMapEnts); + CASE_ADD_TO_POOL(ASSET_TYPE_PHYSPRESET, m_phys_preset, physPreset); + CASE_ADD_TO_POOL(ASSET_TYPE_PHYSCOLLMAP, m_phys_collmap, physCollmap); + CASE_ADD_TO_POOL(ASSET_TYPE_XANIMPARTS, m_xanim_parts, parts); + CASE_ADD_TO_POOL(ASSET_TYPE_XMODEL, m_xmodel, model); + CASE_ADD_TO_POOL(ASSET_TYPE_MATERIAL, m_material, material); + CASE_ADD_TO_POOL(ASSET_TYPE_PIXELSHADER, m_material_pixel_shader, pixelShader); + CASE_ADD_TO_POOL(ASSET_TYPE_VERTEXSHADER, m_material_vertex_shader, vertexShader); + CASE_ADD_TO_POOL(ASSET_TYPE_VERTEXDECL, m_material_vertex_decl, vertexDecl); + CASE_ADD_TO_POOL(ASSET_TYPE_TECHNIQUE_SET, m_technique_set, techniqueSet); + CASE_ADD_TO_POOL(ASSET_TYPE_IMAGE, m_image, image); + CASE_ADD_TO_POOL(ASSET_TYPE_SOUND, m_sound, sound); + CASE_ADD_TO_POOL(ASSET_TYPE_SOUND_CURVE, m_sound_curve, sndCurve); + CASE_ADD_TO_POOL(ASSET_TYPE_LOADED_SOUND, m_loaded_sound, loadSnd); + CASE_ADD_TO_POOL(ASSET_TYPE_CLIPMAP_SP, m_clip_map, clipMap); + CASE_ADD_TO_POOL(ASSET_TYPE_CLIPMAP_MP, m_clip_map, clipMap); + CASE_ADD_TO_POOL(ASSET_TYPE_COMWORLD, m_com_world, comWorld); + CASE_ADD_TO_POOL(ASSET_TYPE_GAMEWORLD_SP, m_game_world_sp, gameWorldSp); + CASE_ADD_TO_POOL(ASSET_TYPE_GAMEWORLD_MP, m_game_world_mp, gameWorldMp); + CASE_ADD_TO_POOL(ASSET_TYPE_MAP_ENTS, m_map_ents, mapEnts); + CASE_ADD_TO_POOL(ASSET_TYPE_FXWORLD, m_fx_world, fxWorld); + CASE_ADD_TO_POOL(ASSET_TYPE_GFXWORLD, m_gfx_world, gfxWorld); + CASE_ADD_TO_POOL(ASSET_TYPE_LIGHT_DEF, m_gfx_light_def, lightDef); + CASE_ADD_TO_POOL(ASSET_TYPE_FONT, m_font, font); + CASE_ADD_TO_POOL(ASSET_TYPE_MENULIST, m_menu_list, menuList); + CASE_ADD_TO_POOL(ASSET_TYPE_MENU, m_menu_def, menu); + CASE_ADD_TO_POOL(ASSET_TYPE_LOCALIZE_ENTRY, m_localize, localize); + CASE_ADD_TO_POOL(ASSET_TYPE_WEAPON, m_weapon, weapon); + CASE_ADD_TO_POOL(ASSET_TYPE_FX, m_fx, fx); + CASE_ADD_TO_POOL(ASSET_TYPE_IMPACT_FX, m_fx_impact_table, impactFx); + CASE_ADD_TO_POOL(ASSET_TYPE_RAWFILE, m_raw_file, rawfile); + CASE_ADD_TO_POOL(ASSET_TYPE_STRINGTABLE, m_string_table, stringTable); + CASE_ADD_TO_POOL(ASSET_TYPE_LEADERBOARD, m_leaderboard, leaderboardDef); + CASE_ADD_TO_POOL(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set, structuredDataDefSet); + CASE_ADD_TO_POOL(ASSET_TYPE_TRACER, m_tracer, tracerDef); + CASE_ADD_TO_POOL(ASSET_TYPE_VEHICLE, m_vehicle, vehDef); + CASE_ADD_TO_POOL(ASSET_TYPE_ADDON_MAP_ENTS, m_addon_map_ents, addonMapEnts); default: assert(false); @@ -289,52 +250,52 @@ XAssetInfoGeneric* GameAssetPoolIW4::AddAssetToPool(asset_type_t type, std::stri XAssetInfoGeneric* GameAssetPoolIW4::GetAsset(const asset_type_t type, std::string name) const { -#define CASE_GET_ASSET(assetType, poolName) \ - case assetType: \ - { \ - if((poolName) != nullptr) \ - return (poolName)->GetAsset(std::move(name)); \ - break; \ +#define CASE_GET_ASSET(assetType, poolName) \ + case assetType: \ + { \ + if ((poolName) != nullptr) \ + return (poolName)->GetAsset(std::move(name)); \ + break; \ } switch (type) { - CASE_GET_ASSET(ASSET_TYPE_PHYSPRESET, m_phys_preset); - CASE_GET_ASSET(ASSET_TYPE_PHYSCOLLMAP, m_phys_collmap); - CASE_GET_ASSET(ASSET_TYPE_XANIMPARTS, m_xanim_parts); - CASE_GET_ASSET(ASSET_TYPE_XMODEL, m_xmodel); - CASE_GET_ASSET(ASSET_TYPE_MATERIAL, m_material); - CASE_GET_ASSET(ASSET_TYPE_PIXELSHADER, m_material_pixel_shader); - CASE_GET_ASSET(ASSET_TYPE_VERTEXSHADER, m_material_vertex_shader); - CASE_GET_ASSET(ASSET_TYPE_VERTEXDECL, m_material_vertex_decl); - CASE_GET_ASSET(ASSET_TYPE_TECHNIQUE_SET, m_technique_set); - CASE_GET_ASSET(ASSET_TYPE_IMAGE, m_image); - CASE_GET_ASSET(ASSET_TYPE_SOUND, m_sound); - CASE_GET_ASSET(ASSET_TYPE_SOUND_CURVE, m_sound_curve); - CASE_GET_ASSET(ASSET_TYPE_LOADED_SOUND, m_loaded_sound); - CASE_GET_ASSET(ASSET_TYPE_CLIPMAP_SP, m_clip_map); - CASE_GET_ASSET(ASSET_TYPE_CLIPMAP_MP, m_clip_map); - CASE_GET_ASSET(ASSET_TYPE_COMWORLD, m_com_world); - CASE_GET_ASSET(ASSET_TYPE_GAMEWORLD_SP, m_game_world_sp); - CASE_GET_ASSET(ASSET_TYPE_GAMEWORLD_MP, m_game_world_mp); - CASE_GET_ASSET(ASSET_TYPE_MAP_ENTS, m_map_ents); - CASE_GET_ASSET(ASSET_TYPE_FXWORLD, m_fx_world); - CASE_GET_ASSET(ASSET_TYPE_GFXWORLD, m_gfx_world); - CASE_GET_ASSET(ASSET_TYPE_LIGHT_DEF, m_gfx_light_def); - CASE_GET_ASSET(ASSET_TYPE_FONT, m_font); - CASE_GET_ASSET(ASSET_TYPE_MENULIST, m_menu_list); - CASE_GET_ASSET(ASSET_TYPE_MENU, m_menu_def); - CASE_GET_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, m_localize); - CASE_GET_ASSET(ASSET_TYPE_WEAPON, m_weapon); - CASE_GET_ASSET(ASSET_TYPE_FX, m_fx); - CASE_GET_ASSET(ASSET_TYPE_IMPACT_FX, m_fx_impact_table); - CASE_GET_ASSET(ASSET_TYPE_RAWFILE, m_raw_file); - CASE_GET_ASSET(ASSET_TYPE_STRINGTABLE, m_string_table); - CASE_GET_ASSET(ASSET_TYPE_LEADERBOARD, m_leaderboard); - CASE_GET_ASSET(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set); - CASE_GET_ASSET(ASSET_TYPE_TRACER, m_tracer); - CASE_GET_ASSET(ASSET_TYPE_VEHICLE, m_vehicle); - CASE_GET_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, m_addon_map_ents); + CASE_GET_ASSET(ASSET_TYPE_PHYSPRESET, m_phys_preset); + CASE_GET_ASSET(ASSET_TYPE_PHYSCOLLMAP, m_phys_collmap); + CASE_GET_ASSET(ASSET_TYPE_XANIMPARTS, m_xanim_parts); + CASE_GET_ASSET(ASSET_TYPE_XMODEL, m_xmodel); + CASE_GET_ASSET(ASSET_TYPE_MATERIAL, m_material); + CASE_GET_ASSET(ASSET_TYPE_PIXELSHADER, m_material_pixel_shader); + CASE_GET_ASSET(ASSET_TYPE_VERTEXSHADER, m_material_vertex_shader); + CASE_GET_ASSET(ASSET_TYPE_VERTEXDECL, m_material_vertex_decl); + CASE_GET_ASSET(ASSET_TYPE_TECHNIQUE_SET, m_technique_set); + CASE_GET_ASSET(ASSET_TYPE_IMAGE, m_image); + CASE_GET_ASSET(ASSET_TYPE_SOUND, m_sound); + CASE_GET_ASSET(ASSET_TYPE_SOUND_CURVE, m_sound_curve); + CASE_GET_ASSET(ASSET_TYPE_LOADED_SOUND, m_loaded_sound); + CASE_GET_ASSET(ASSET_TYPE_CLIPMAP_SP, m_clip_map); + CASE_GET_ASSET(ASSET_TYPE_CLIPMAP_MP, m_clip_map); + CASE_GET_ASSET(ASSET_TYPE_COMWORLD, m_com_world); + CASE_GET_ASSET(ASSET_TYPE_GAMEWORLD_SP, m_game_world_sp); + CASE_GET_ASSET(ASSET_TYPE_GAMEWORLD_MP, m_game_world_mp); + CASE_GET_ASSET(ASSET_TYPE_MAP_ENTS, m_map_ents); + CASE_GET_ASSET(ASSET_TYPE_FXWORLD, m_fx_world); + CASE_GET_ASSET(ASSET_TYPE_GFXWORLD, m_gfx_world); + CASE_GET_ASSET(ASSET_TYPE_LIGHT_DEF, m_gfx_light_def); + CASE_GET_ASSET(ASSET_TYPE_FONT, m_font); + CASE_GET_ASSET(ASSET_TYPE_MENULIST, m_menu_list); + CASE_GET_ASSET(ASSET_TYPE_MENU, m_menu_def); + CASE_GET_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, m_localize); + CASE_GET_ASSET(ASSET_TYPE_WEAPON, m_weapon); + CASE_GET_ASSET(ASSET_TYPE_FX, m_fx); + CASE_GET_ASSET(ASSET_TYPE_IMPACT_FX, m_fx_impact_table); + CASE_GET_ASSET(ASSET_TYPE_RAWFILE, m_raw_file); + CASE_GET_ASSET(ASSET_TYPE_STRINGTABLE, m_string_table); + CASE_GET_ASSET(ASSET_TYPE_LEADERBOARD, m_leaderboard); + CASE_GET_ASSET(ASSET_TYPE_STRUCTURED_DATA_DEF, m_structed_data_def_set); + CASE_GET_ASSET(ASSET_TYPE_TRACER, m_tracer); + CASE_GET_ASSET(ASSET_TYPE_VEHICLE, m_vehicle); + CASE_GET_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, m_addon_map_ents); default: assert(false); diff --git a/src/ZoneCommon/Game/IW4/GameAssetPoolIW4.h b/src/ZoneCommon/Game/IW4/GameAssetPoolIW4.h index 1cf60a472..90d70ff50 100644 --- a/src/ZoneCommon/Game/IW4/GameAssetPoolIW4.h +++ b/src/ZoneCommon/Game/IW4/GameAssetPoolIW4.h @@ -1,11 +1,11 @@ #pragma once -#include <memory> - -#include "Utils/ClassUtils.h" -#include "Pool/ZoneAssetPools.h" -#include "Pool/AssetPool.h" #include "Game/IW4/IW4.h" +#include "Pool/AssetPool.h" +#include "Pool/ZoneAssetPools.h" +#include "Utils/ClassUtils.h" + +#include <memory> class GameAssetPoolIW4 final : public ZoneAssetPools { @@ -15,7 +15,12 @@ class GameAssetPoolIW4 final : public ZoneAssetPools static const char* ASSET_TYPE_NAMES[]; protected: - XAssetInfoGeneric* AddAssetToPool(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone) override; + XAssetInfoGeneric* AddAssetToPool(asset_type_t type, + std::string name, + void* asset, + std::vector<XAssetInfoGeneric*> dependencies, + std::vector<scr_string_t> usedScriptStrings, + Zone* zone) override; public: std::unique_ptr<AssetPool<IW4::PhysPreset>> m_phys_preset; diff --git a/src/ZoneCommon/Game/IW4/ZoneConstantsIW4.h b/src/ZoneCommon/Game/IW4/ZoneConstantsIW4.h index 621e91ee3..8b6cbee48 100644 --- a/src/ZoneCommon/Game/IW4/ZoneConstantsIW4.h +++ b/src/ZoneCommon/Game/IW4/ZoneConstantsIW4.h @@ -1,10 +1,10 @@ #pragma once +#include "Game/IW4/IW4.h" +#include "Zone/ZoneTypes.h" + #include <cstdint> #include <string> -#include "Zone/ZoneTypes.h" -#include "Game/IW4/IW4.h" - namespace IW4 { class ZoneConstants final @@ -25,43 +25,19 @@ namespace IW4 static_assert(std::char_traits<char>::length(MAGIC_IW4X) == sizeof(ZoneHeader::m_magic) - sizeof(uint32_t)); static constexpr const char* MAGIC_AUTH_HEADER = "IWffs100"; - inline static const uint8_t RSA_PUBLIC_KEY_INFINITY_WARD[] - { - 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, - 0x00, 0xA5, 0x86, 0xCC, 0x18, 0xA9, 0x12, 0x17, - 0x4F, 0x3A, 0xC9, 0x0C, 0xD2, 0x38, 0x5D, 0xDB, - 0x67, 0x62, 0xA4, 0xE3, 0xD4, 0x42, 0x05, 0x8A, - 0x57, 0x0C, 0x31, 0x4E, 0x19, 0xE4, 0xBA, 0x89, - 0x73, 0x13, 0xDB, 0x72, 0x25, 0x63, 0xB1, 0x2F, - 0xD7, 0xF1, 0x08, 0x48, 0x34, 0x06, 0xD7, 0x84, - 0x5F, 0xC8, 0xCF, 0x2F, 0xB6, 0xA3, 0x5A, 0x8F, - 0x7E, 0xAA, 0x9D, 0x51, 0xE7, 0x0F, 0xB9, 0x07, - 0xB7, 0x30, 0x91, 0x04, 0x39, 0x9C, 0xDC, 0x1C, - 0xF1, 0x16, 0xCB, 0x96, 0x10, 0xEB, 0x38, 0xB1, - 0x3B, 0xBA, 0x42, 0xE3, 0xE2, 0x78, 0xBD, 0x77, - 0x82, 0x1A, 0x2B, 0x54, 0x27, 0x0A, 0xF7, 0x66, - 0x06, 0xAD, 0x46, 0x39, 0xC0, 0xEB, 0xB5, 0xC2, - 0x27, 0xDD, 0x2C, 0x08, 0x62, 0x2C, 0x0B, 0xC4, - 0x00, 0x0D, 0xCB, 0xAD, 0x22, 0x67, 0x01, 0xA6, - 0x92, 0x9C, 0x00, 0xAF, 0x9D, 0x55, 0xCC, 0x68, - 0xEC, 0x39, 0x49, 0x85, 0x7E, 0x2C, 0x98, 0xCF, - 0x4C, 0x12, 0x8D, 0xED, 0xC7, 0x1D, 0x21, 0x54, - 0x9C, 0x2F, 0xC9, 0x54, 0x36, 0x08, 0xA9, 0x67, - 0xEE, 0x91, 0xE6, 0xD9, 0xB1, 0xFA, 0xA9, 0x2B, - 0x88, 0xAD, 0x2A, 0xD0, 0xAA, 0x28, 0xF9, 0x47, - 0xA6, 0x0F, 0xCF, 0x55, 0x4C, 0x9B, 0x26, 0x41, - 0x89, 0x76, 0x11, 0xFD, 0x1B, 0x83, 0xE4, 0xE8, - 0x8E, 0x7E, 0xB4, 0x03, 0xA3, 0x29, 0xDD, 0x4F, - 0xAC, 0x99, 0xBE, 0x7C, 0xD3, 0xFD, 0x14, 0x28, - 0x1C, 0x59, 0x69, 0xE0, 0x79, 0x5F, 0x4B, 0xDA, - 0x6B, 0xAB, 0x48, 0x4E, 0x28, 0x39, 0x84, 0xC6, - 0x2B, 0xC6, 0x20, 0x05, 0xDB, 0x05, 0x21, 0xC3, - 0xE1, 0xD4, 0x20, 0x28, 0xDD, 0x3A, 0x4D, 0x51, - 0xE7, 0x49, 0x8A, 0x49, 0xEF, 0xF5, 0xDA, 0xDA, - 0x7D, 0x5D, 0xA8, 0x0B, 0xA1, 0x77, 0xCD, 0x62, - 0x7D, 0x9D, 0x40, 0x26, 0x44, 0x4B, 0x3B, 0x0A, - 0x89, 0x02, 0x03, 0x01, 0x00, 0x01 - }; + inline static const uint8_t RSA_PUBLIC_KEY_INFINITY_WARD[]{ + 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, 0xA5, 0x86, 0xCC, 0x18, 0xA9, 0x12, 0x17, 0x4F, 0x3A, 0xC9, 0x0C, 0xD2, 0x38, 0x5D, + 0xDB, 0x67, 0x62, 0xA4, 0xE3, 0xD4, 0x42, 0x05, 0x8A, 0x57, 0x0C, 0x31, 0x4E, 0x19, 0xE4, 0xBA, 0x89, 0x73, 0x13, 0xDB, 0x72, 0x25, 0x63, + 0xB1, 0x2F, 0xD7, 0xF1, 0x08, 0x48, 0x34, 0x06, 0xD7, 0x84, 0x5F, 0xC8, 0xCF, 0x2F, 0xB6, 0xA3, 0x5A, 0x8F, 0x7E, 0xAA, 0x9D, 0x51, 0xE7, + 0x0F, 0xB9, 0x07, 0xB7, 0x30, 0x91, 0x04, 0x39, 0x9C, 0xDC, 0x1C, 0xF1, 0x16, 0xCB, 0x96, 0x10, 0xEB, 0x38, 0xB1, 0x3B, 0xBA, 0x42, 0xE3, + 0xE2, 0x78, 0xBD, 0x77, 0x82, 0x1A, 0x2B, 0x54, 0x27, 0x0A, 0xF7, 0x66, 0x06, 0xAD, 0x46, 0x39, 0xC0, 0xEB, 0xB5, 0xC2, 0x27, 0xDD, 0x2C, + 0x08, 0x62, 0x2C, 0x0B, 0xC4, 0x00, 0x0D, 0xCB, 0xAD, 0x22, 0x67, 0x01, 0xA6, 0x92, 0x9C, 0x00, 0xAF, 0x9D, 0x55, 0xCC, 0x68, 0xEC, 0x39, + 0x49, 0x85, 0x7E, 0x2C, 0x98, 0xCF, 0x4C, 0x12, 0x8D, 0xED, 0xC7, 0x1D, 0x21, 0x54, 0x9C, 0x2F, 0xC9, 0x54, 0x36, 0x08, 0xA9, 0x67, 0xEE, + 0x91, 0xE6, 0xD9, 0xB1, 0xFA, 0xA9, 0x2B, 0x88, 0xAD, 0x2A, 0xD0, 0xAA, 0x28, 0xF9, 0x47, 0xA6, 0x0F, 0xCF, 0x55, 0x4C, 0x9B, 0x26, 0x41, + 0x89, 0x76, 0x11, 0xFD, 0x1B, 0x83, 0xE4, 0xE8, 0x8E, 0x7E, 0xB4, 0x03, 0xA3, 0x29, 0xDD, 0x4F, 0xAC, 0x99, 0xBE, 0x7C, 0xD3, 0xFD, 0x14, + 0x28, 0x1C, 0x59, 0x69, 0xE0, 0x79, 0x5F, 0x4B, 0xDA, 0x6B, 0xAB, 0x48, 0x4E, 0x28, 0x39, 0x84, 0xC6, 0x2B, 0xC6, 0x20, 0x05, 0xDB, 0x05, + 0x21, 0xC3, 0xE1, 0xD4, 0x20, 0x28, 0xDD, 0x3A, 0x4D, 0x51, 0xE7, 0x49, 0x8A, 0x49, 0xEF, 0xF5, 0xDA, 0xDA, 0x7D, 0x5D, 0xA8, 0x0B, 0xA1, + 0x77, 0xCD, 0x62, 0x7D, 0x9D, 0x40, 0x26, 0x44, 0x4B, 0x3B, 0x0A, 0x89, 0x02, 0x03, 0x01, 0x00, 0x01}; static constexpr size_t AUTHED_CHUNK_SIZE = 0x2000; static constexpr unsigned AUTHED_CHUNK_COUNT_PER_GROUP = 256; @@ -69,4 +45,4 @@ namespace IW4 static constexpr int OFFSET_BLOCK_BIT_COUNT = 4; static constexpr block_t INSERT_BLOCK = XFILE_BLOCK_VIRTUAL; }; -} +} // namespace IW4 diff --git a/src/ZoneCommon/Game/IW5/GameAssetPoolIW5.cpp b/src/ZoneCommon/Game/IW5/GameAssetPoolIW5.cpp index 0c1761653..ceb8e3bcb 100644 --- a/src/ZoneCommon/Game/IW5/GameAssetPoolIW5.cpp +++ b/src/ZoneCommon/Game/IW5/GameAssetPoolIW5.cpp @@ -1,62 +1,59 @@ #include "GameAssetPoolIW5.h" +#include "Pool/AssetPoolDynamic.h" +#include "Pool/AssetPoolStatic.h" + #include <cassert> #include <type_traits> -#include "Pool/AssetPoolStatic.h" -#include "Pool/AssetPoolDynamic.h" - using namespace IW5; -const char* GameAssetPoolIW5::ASSET_TYPE_NAMES[] -{ - "physpreset", - "physcollmap", - "xanim", - "xmodelsurfs", - "xmodel", - "material", - "pixelshader", - "vertexshader", - "vertexdecl", - "techniqueset", - "image", - "sound", - "soundcurve", - "loadedsound", - "clipmap", - "comworld", - "glassworld", - "pathdata", - "vehicletrack", - "mapents", - "fxworld", - "gfxworld", - "lightdef", - "uimap", - "font", - "menulist", - "menu", - "localize", - "attachment", - "weapon", - "snddriverglobals", - "fx", - "impactfx", - "surfacefx", - "aitype", - "mptype", - "character", - "xmodelalias", - "rawfile", - "scriptfile", - "stringtable", - "leaderboard", - "structureddatadef", - "tracer", - "vehicle", - "addonmapents" -}; +const char* GameAssetPoolIW5::ASSET_TYPE_NAMES[]{"physpreset", + "physcollmap", + "xanim", + "xmodelsurfs", + "xmodel", + "material", + "pixelshader", + "vertexshader", + "vertexdecl", + "techniqueset", + "image", + "sound", + "soundcurve", + "loadedsound", + "clipmap", + "comworld", + "glassworld", + "pathdata", + "vehicletrack", + "mapents", + "fxworld", + "gfxworld", + "lightdef", + "uimap", + "font", + "menulist", + "menu", + "localize", + "attachment", + "weapon", + "snddriverglobals", + "fx", + "impactfx", + "surfacefx", + "aitype", + "mptype", + "character", + "xmodelalias", + "rawfile", + "scriptfile", + "stringtable", + "leaderboard", + "structureddatadef", + "tracer", + "vehicle", + "addonmapents"}; /* Asset Pool Table @@ -107,21 +104,21 @@ const char* GameAssetPoolIW5::ASSET_TYPE_NAMES[] GameAssetPoolIW5::GameAssetPoolIW5(Zone* zone, const int priority) : ZoneAssetPools(zone), - m_priority(priority) + m_priority(priority) { assert(std::extent<decltype(ASSET_TYPE_NAMES)>::value == ASSET_TYPE_COUNT); } void GameAssetPoolIW5::InitPoolStatic(const asset_type_t type, const size_t capacity) { -#define CASE_INIT_POOL_STATIC(assetType, poolName, poolType) \ - case assetType: \ - { \ - if((poolName) == nullptr && capacity > 0) \ - { \ - (poolName) = std::make_unique<AssetPoolStatic<poolType>>(capacity, m_priority, (assetType)); \ - } \ - break; \ +#define CASE_INIT_POOL_STATIC(assetType, poolName, poolType) \ + case assetType: \ + { \ + if ((poolName) == nullptr && capacity > 0) \ + { \ + (poolName) = std::make_unique<AssetPoolStatic<poolType>>(capacity, m_priority, (assetType)); \ + } \ + break; \ } switch (type) @@ -177,14 +174,14 @@ void GameAssetPoolIW5::InitPoolStatic(const asset_type_t type, const size_t capa void GameAssetPoolIW5::InitPoolDynamic(const asset_type_t type) { -#define CASE_INIT_POOL_DYNAMIC(assetType, poolName, poolType) \ - case assetType: \ - { \ - if((poolName) == nullptr) \ - { \ - (poolName) = std::make_unique<AssetPoolDynamic<poolType>>(m_priority, (assetType)); \ - } \ - break; \ +#define CASE_INIT_POOL_DYNAMIC(assetType, poolName, poolType) \ + case assetType: \ + { \ + if ((poolName) == nullptr) \ + { \ + (poolName) = std::make_unique<AssetPoolDynamic<poolType>>(m_priority, (assetType)); \ + } \ + break; \ } switch (type) @@ -238,18 +235,19 @@ void GameAssetPoolIW5::InitPoolDynamic(const asset_type_t type) #undef CASE_INIT_POOL_STATIC } -XAssetInfoGeneric* GameAssetPoolIW5::AddAssetToPool(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone) +XAssetInfoGeneric* GameAssetPoolIW5::AddAssetToPool( + asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone) { XAsset xAsset{}; xAsset.type = static_cast<XAssetType>(type); xAsset.header.data = asset; -#define CASE_ADD_TO_POOL(assetType, poolName, headerName) \ - case assetType: \ - { \ - assert((poolName) != nullptr); \ - return (poolName)->AddAsset(std::move(name), xAsset.header.headerName, zone, std::move(dependencies), std::move(usedScriptStrings)); \ +#define CASE_ADD_TO_POOL(assetType, poolName, headerName) \ + case assetType: \ + { \ + assert((poolName) != nullptr); \ + return (poolName)->AddAsset(std::move(name), xAsset.header.headerName, zone, std::move(dependencies), std::move(usedScriptStrings)); \ } switch (xAsset.type) @@ -307,12 +305,12 @@ XAssetInfoGeneric* GameAssetPoolIW5::AddAssetToPool(asset_type_t type, std::stri XAssetInfoGeneric* GameAssetPoolIW5::GetAsset(const asset_type_t type, std::string name) const { -#define CASE_GET_ASSET(assetType, poolName) \ - case assetType: \ - { \ - if((poolName) != nullptr) \ - return (poolName)->GetAsset(std::move(name)); \ - break; \ +#define CASE_GET_ASSET(assetType, poolName) \ + case assetType: \ + { \ + if ((poolName) != nullptr) \ + return (poolName)->GetAsset(std::move(name)); \ + break; \ } switch (type) diff --git a/src/ZoneCommon/Game/IW5/GameAssetPoolIW5.h b/src/ZoneCommon/Game/IW5/GameAssetPoolIW5.h index a9d03a7a5..435bc833c 100644 --- a/src/ZoneCommon/Game/IW5/GameAssetPoolIW5.h +++ b/src/ZoneCommon/Game/IW5/GameAssetPoolIW5.h @@ -1,10 +1,10 @@ #pragma once -#include <memory> - -#include "Pool/ZoneAssetPools.h" -#include "Pool/AssetPool.h" #include "Game/IW5/IW5.h" +#include "Pool/AssetPool.h" +#include "Pool/ZoneAssetPools.h" + +#include <memory> class GameAssetPoolIW5 final : public ZoneAssetPools { @@ -14,7 +14,12 @@ class GameAssetPoolIW5 final : public ZoneAssetPools static const char* ASSET_TYPE_NAMES[]; protected: - XAssetInfoGeneric* AddAssetToPool(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone) override; + XAssetInfoGeneric* AddAssetToPool(asset_type_t type, + std::string name, + void* asset, + std::vector<XAssetInfoGeneric*> dependencies, + std::vector<scr_string_t> usedScriptStrings, + Zone* zone) override; public: std::unique_ptr<AssetPool<IW5::PhysPreset>> m_phys_preset; diff --git a/src/ZoneCommon/Game/IW5/ZoneConstantsIW5.h b/src/ZoneCommon/Game/IW5/ZoneConstantsIW5.h index a62fe2c53..618b2ab79 100644 --- a/src/ZoneCommon/Game/IW5/ZoneConstantsIW5.h +++ b/src/ZoneCommon/Game/IW5/ZoneConstantsIW5.h @@ -1,10 +1,10 @@ #pragma once +#include "Game/IW5/IW5.h" +#include "Zone/ZoneTypes.h" + #include <cstdint> #include <string> -#include "Zone/ZoneTypes.h" -#include "Game/IW5/IW5.h" - namespace IW5 { class ZoneConstants final @@ -22,43 +22,19 @@ namespace IW5 static_assert(std::char_traits<char>::length(MAGIC_UNSIGNED) == sizeof(ZoneHeader::m_magic)); static constexpr const char* MAGIC_AUTH_HEADER = "IWffs100"; - inline static const uint8_t RSA_PUBLIC_KEY_INFINITY_WARD[] - { - 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, - 0x00, 0xA5, 0x86, 0xCC, 0x18, 0xA9, 0x12, 0x17, - 0x4F, 0x3A, 0xC9, 0x0C, 0xD2, 0x38, 0x5D, 0xDB, - 0x67, 0x62, 0xA4, 0xE3, 0xD4, 0x42, 0x05, 0x8A, - 0x57, 0x0C, 0x31, 0x4E, 0x19, 0xE4, 0xBA, 0x89, - 0x73, 0x13, 0xDB, 0x72, 0x25, 0x63, 0xB1, 0x2F, - 0xD7, 0xF1, 0x08, 0x48, 0x34, 0x06, 0xD7, 0x84, - 0x5F, 0xC8, 0xCF, 0x2F, 0xB6, 0xA3, 0x5A, 0x8F, - 0x7E, 0xAA, 0x9D, 0x51, 0xE7, 0x0F, 0xB9, 0x07, - 0xB7, 0x30, 0x91, 0x04, 0x39, 0x9C, 0xDC, 0x1C, - 0xF1, 0x16, 0xCB, 0x96, 0x10, 0xEB, 0x38, 0xB1, - 0x3B, 0xBA, 0x42, 0xE3, 0xE2, 0x78, 0xBD, 0x77, - 0x82, 0x1A, 0x2B, 0x54, 0x27, 0x0A, 0xF7, 0x66, - 0x06, 0xAD, 0x46, 0x39, 0xC0, 0xEB, 0xB5, 0xC2, - 0x27, 0xDD, 0x2C, 0x08, 0x62, 0x2C, 0x0B, 0xC4, - 0x00, 0x0D, 0xCB, 0xAD, 0x22, 0x67, 0x01, 0xA6, - 0x92, 0x9C, 0x00, 0xAF, 0x9D, 0x55, 0xCC, 0x68, - 0xEC, 0x39, 0x49, 0x85, 0x7E, 0x2C, 0x98, 0xCF, - 0x4C, 0x12, 0x8D, 0xED, 0xC7, 0x1D, 0x21, 0x54, - 0x9C, 0x2F, 0xC9, 0x54, 0x36, 0x08, 0xA9, 0x67, - 0xEE, 0x91, 0xE6, 0xD9, 0xB1, 0xFA, 0xA9, 0x2B, - 0x88, 0xAD, 0x2A, 0xD0, 0xAA, 0x28, 0xF9, 0x47, - 0xA6, 0x0F, 0xCF, 0x55, 0x4C, 0x9B, 0x26, 0x41, - 0x89, 0x76, 0x11, 0xFD, 0x1B, 0x83, 0xE4, 0xE8, - 0x8E, 0x7E, 0xB4, 0x03, 0xA3, 0x29, 0xDD, 0x4F, - 0xAC, 0x99, 0xBE, 0x7C, 0xD3, 0xFD, 0x14, 0x28, - 0x1C, 0x59, 0x69, 0xE0, 0x79, 0x5F, 0x4B, 0xDA, - 0x6B, 0xAB, 0x48, 0x4E, 0x28, 0x39, 0x84, 0xC6, - 0x2B, 0xC6, 0x20, 0x05, 0xDB, 0x05, 0x21, 0xC3, - 0xE1, 0xD4, 0x20, 0x28, 0xDD, 0x3A, 0x4D, 0x51, - 0xE7, 0x49, 0x8A, 0x49, 0xEF, 0xF5, 0xDA, 0xDA, - 0x7D, 0x5D, 0xA8, 0x0B, 0xA1, 0x77, 0xCD, 0x62, - 0x7D, 0x9D, 0x40, 0x26, 0x44, 0x4B, 0x3B, 0x0A, - 0x89, 0x02, 0x03, 0x01, 0x00, 0x01 - }; + inline static const uint8_t RSA_PUBLIC_KEY_INFINITY_WARD[]{ + 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, 0xA5, 0x86, 0xCC, 0x18, 0xA9, 0x12, 0x17, 0x4F, 0x3A, 0xC9, 0x0C, 0xD2, 0x38, 0x5D, + 0xDB, 0x67, 0x62, 0xA4, 0xE3, 0xD4, 0x42, 0x05, 0x8A, 0x57, 0x0C, 0x31, 0x4E, 0x19, 0xE4, 0xBA, 0x89, 0x73, 0x13, 0xDB, 0x72, 0x25, 0x63, + 0xB1, 0x2F, 0xD7, 0xF1, 0x08, 0x48, 0x34, 0x06, 0xD7, 0x84, 0x5F, 0xC8, 0xCF, 0x2F, 0xB6, 0xA3, 0x5A, 0x8F, 0x7E, 0xAA, 0x9D, 0x51, 0xE7, + 0x0F, 0xB9, 0x07, 0xB7, 0x30, 0x91, 0x04, 0x39, 0x9C, 0xDC, 0x1C, 0xF1, 0x16, 0xCB, 0x96, 0x10, 0xEB, 0x38, 0xB1, 0x3B, 0xBA, 0x42, 0xE3, + 0xE2, 0x78, 0xBD, 0x77, 0x82, 0x1A, 0x2B, 0x54, 0x27, 0x0A, 0xF7, 0x66, 0x06, 0xAD, 0x46, 0x39, 0xC0, 0xEB, 0xB5, 0xC2, 0x27, 0xDD, 0x2C, + 0x08, 0x62, 0x2C, 0x0B, 0xC4, 0x00, 0x0D, 0xCB, 0xAD, 0x22, 0x67, 0x01, 0xA6, 0x92, 0x9C, 0x00, 0xAF, 0x9D, 0x55, 0xCC, 0x68, 0xEC, 0x39, + 0x49, 0x85, 0x7E, 0x2C, 0x98, 0xCF, 0x4C, 0x12, 0x8D, 0xED, 0xC7, 0x1D, 0x21, 0x54, 0x9C, 0x2F, 0xC9, 0x54, 0x36, 0x08, 0xA9, 0x67, 0xEE, + 0x91, 0xE6, 0xD9, 0xB1, 0xFA, 0xA9, 0x2B, 0x88, 0xAD, 0x2A, 0xD0, 0xAA, 0x28, 0xF9, 0x47, 0xA6, 0x0F, 0xCF, 0x55, 0x4C, 0x9B, 0x26, 0x41, + 0x89, 0x76, 0x11, 0xFD, 0x1B, 0x83, 0xE4, 0xE8, 0x8E, 0x7E, 0xB4, 0x03, 0xA3, 0x29, 0xDD, 0x4F, 0xAC, 0x99, 0xBE, 0x7C, 0xD3, 0xFD, 0x14, + 0x28, 0x1C, 0x59, 0x69, 0xE0, 0x79, 0x5F, 0x4B, 0xDA, 0x6B, 0xAB, 0x48, 0x4E, 0x28, 0x39, 0x84, 0xC6, 0x2B, 0xC6, 0x20, 0x05, 0xDB, 0x05, + 0x21, 0xC3, 0xE1, 0xD4, 0x20, 0x28, 0xDD, 0x3A, 0x4D, 0x51, 0xE7, 0x49, 0x8A, 0x49, 0xEF, 0xF5, 0xDA, 0xDA, 0x7D, 0x5D, 0xA8, 0x0B, 0xA1, + 0x77, 0xCD, 0x62, 0x7D, 0x9D, 0x40, 0x26, 0x44, 0x4B, 0x3B, 0x0A, 0x89, 0x02, 0x03, 0x01, 0x00, 0x01}; static constexpr size_t AUTHED_CHUNK_SIZE = 0x2000; static constexpr unsigned AUTHED_CHUNK_COUNT_PER_GROUP = 256; @@ -66,4 +42,4 @@ namespace IW5 static constexpr int OFFSET_BLOCK_BIT_COUNT = 4; static constexpr block_t INSERT_BLOCK = XFILE_BLOCK_VIRTUAL; }; -} +} // namespace IW5 diff --git a/src/ZoneCommon/Game/T5/GameAssetPoolT5.cpp b/src/ZoneCommon/Game/T5/GameAssetPoolT5.cpp index b46e8d3c0..40f05d444 100644 --- a/src/ZoneCommon/Game/T5/GameAssetPoolT5.cpp +++ b/src/ZoneCommon/Game/T5/GameAssetPoolT5.cpp @@ -1,77 +1,39 @@ #include "GameAssetPoolT5.h" +#include "Pool/AssetPoolDynamic.h" +#include "Pool/AssetPoolStatic.h" + #include <cassert> #include <type_traits> -#include "Pool/AssetPoolStatic.h" -#include "Pool/AssetPoolDynamic.h" - using namespace T5; -const char* GameAssetPoolT5::ASSET_TYPE_NAMES[] -{ - "xmodelpieces", - "physpreset", - "physconstraints", - "destructibledef", - "xanim", - "xmodel", - "material", - "techniqueset", - "image", - "soundbank", - "soundpatch", - "clipmap", - "clipmap", - "comworld", - "gameworldsp", - "gameworldmp", - "mapents", - "gfxworld", - "gfxlightdef", - "uimap", - "font", - "menulist", - "menu", - "localize", - "weapon", - "weapondef", - "weaponvariant", - "snddriverglobals", - "fx", - "fximpacttable", - "aitype", - "mptype", - "mpbody", - "mphead", - "character", - "xmodelalias", - "rawfile", - "stringtable", - "packindex", - "xglobals", - "ddl", - "glasses", - "emblemset" -}; +const char* GameAssetPoolT5::ASSET_TYPE_NAMES[]{ + "xmodelpieces", "physpreset", "physconstraints", "destructibledef", "xanim", "xmodel", "material", + "techniqueset", "image", "soundbank", "soundpatch", "clipmap", "clipmap", "comworld", + "gameworldsp", "gameworldmp", "mapents", "gfxworld", "gfxlightdef", "uimap", "font", + "menulist", "menu", "localize", "weapon", "weapondef", "weaponvariant", "snddriverglobals", + "fx", "fximpacttable", "aitype", "mptype", "mpbody", "mphead", "character", + "xmodelalias", "rawfile", "stringtable", "packindex", "xglobals", "ddl", "glasses", + "emblemset"}; GameAssetPoolT5::GameAssetPoolT5(Zone* zone, const int priority) : ZoneAssetPools(zone), - m_priority(priority) + m_priority(priority) { assert(std::extent<decltype(ASSET_TYPE_NAMES)>::value == ASSET_TYPE_COUNT); } void GameAssetPoolT5::InitPoolStatic(const asset_type_t type, const size_t capacity) { -#define CASE_INIT_POOL_STATIC(assetType, poolName, poolType) \ - case assetType: \ - { \ - if((poolName) == nullptr && capacity > 0) \ - { \ - (poolName) = std::make_unique<AssetPoolStatic<poolType>>(capacity, m_priority, (assetType)); \ - } \ - break; \ +#define CASE_INIT_POOL_STATIC(assetType, poolName, poolType) \ + case assetType: \ + { \ + if ((poolName) == nullptr && capacity > 0) \ + { \ + (poolName) = std::make_unique<AssetPoolStatic<poolType>>(capacity, m_priority, (assetType)); \ + } \ + break; \ } switch (type) @@ -120,14 +82,14 @@ void GameAssetPoolT5::InitPoolStatic(const asset_type_t type, const size_t capac void GameAssetPoolT5::InitPoolDynamic(const asset_type_t type) { -#define CASE_INIT_POOL_DYNAMIC(assetType, poolName, poolType) \ - case assetType: \ - { \ - if((poolName) == nullptr) \ - { \ - (poolName) = std::make_unique<AssetPoolDynamic<poolType>>(m_priority, (assetType)); \ - } \ - break; \ +#define CASE_INIT_POOL_DYNAMIC(assetType, poolName, poolType) \ + case assetType: \ + { \ + if ((poolName) == nullptr) \ + { \ + (poolName) = std::make_unique<AssetPoolDynamic<poolType>>(m_priority, (assetType)); \ + } \ + break; \ } switch (type) @@ -174,19 +136,19 @@ void GameAssetPoolT5::InitPoolDynamic(const asset_type_t type) #undef CASE_INIT_POOL_STATIC } -XAssetInfoGeneric* GameAssetPoolT5::AddAssetToPool(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, - Zone* zone) +XAssetInfoGeneric* GameAssetPoolT5::AddAssetToPool( + asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone) { XAsset xAsset{}; xAsset.type = static_cast<XAssetType>(type); xAsset.header.data = asset; -#define CASE_ADD_TO_POOL(assetType, poolName, headerName) \ - case assetType: \ - { \ - assert((poolName) != nullptr); \ - return (poolName)->AddAsset(std::move(name), xAsset.header.headerName, zone, std::move(dependencies), std::move(usedScriptStrings)); \ +#define CASE_ADD_TO_POOL(assetType, poolName, headerName) \ + case assetType: \ + { \ + assert((poolName) != nullptr); \ + return (poolName)->AddAsset(std::move(name), xAsset.header.headerName, zone, std::move(dependencies), std::move(usedScriptStrings)); \ } switch (xAsset.type) @@ -237,12 +199,12 @@ XAssetInfoGeneric* GameAssetPoolT5::AddAssetToPool(asset_type_t type, std::strin XAssetInfoGeneric* GameAssetPoolT5::GetAsset(const asset_type_t type, std::string name) const { -#define CASE_GET_ASSET(assetType, poolName) \ - case assetType: \ - { \ - if((poolName) != nullptr) \ - return (poolName)->GetAsset(std::move(name)); \ - break; \ +#define CASE_GET_ASSET(assetType, poolName) \ + case assetType: \ + { \ + if ((poolName) != nullptr) \ + return (poolName)->GetAsset(std::move(name)); \ + break; \ } switch (type) diff --git a/src/ZoneCommon/Game/T5/GameAssetPoolT5.h b/src/ZoneCommon/Game/T5/GameAssetPoolT5.h index e1aba0d14..29b4306a6 100644 --- a/src/ZoneCommon/Game/T5/GameAssetPoolT5.h +++ b/src/ZoneCommon/Game/T5/GameAssetPoolT5.h @@ -1,10 +1,10 @@ #pragma once -#include <memory> - -#include "Pool/ZoneAssetPools.h" -#include "Pool/AssetPool.h" #include "Game/T5/T5.h" +#include "Pool/AssetPool.h" +#include "Pool/ZoneAssetPools.h" + +#include <memory> class GameAssetPoolT5 final : public ZoneAssetPools { @@ -14,7 +14,12 @@ class GameAssetPoolT5 final : public ZoneAssetPools static const char* ASSET_TYPE_NAMES[]; protected: - XAssetInfoGeneric* AddAssetToPool(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone) override; + XAssetInfoGeneric* AddAssetToPool(asset_type_t type, + std::string name, + void* asset, + std::vector<XAssetInfoGeneric*> dependencies, + std::vector<scr_string_t> usedScriptStrings, + Zone* zone) override; public: std::unique_ptr<AssetPool<T5::PhysPreset>> m_phys_preset; diff --git a/src/ZoneCommon/Game/T5/ZoneConstantsT5.h b/src/ZoneCommon/Game/T5/ZoneConstantsT5.h index 6a1cfc8d9..5b79dc2ad 100644 --- a/src/ZoneCommon/Game/T5/ZoneConstantsT5.h +++ b/src/ZoneCommon/Game/T5/ZoneConstantsT5.h @@ -1,10 +1,10 @@ #pragma once +#include "Game/T5/T5.h" +#include "Zone/ZoneTypes.h" + #include <cstdint> #include <string> -#include "Zone/ZoneTypes.h" -#include "Game/T5/T5.h" - namespace T5 { class ZoneConstants final @@ -14,7 +14,7 @@ namespace T5 public: static constexpr const char* MAGIC_UNSIGNED = "IWffu100"; static constexpr int ZONE_VERSION = 473; - + static_assert(std::char_traits<char>::length(MAGIC_UNSIGNED) == sizeof(ZoneHeader::m_magic)); static constexpr size_t AUTHED_CHUNK_SIZE = 0x2000; @@ -23,4 +23,4 @@ namespace T5 static constexpr int OFFSET_BLOCK_BIT_COUNT = 3; static constexpr block_t INSERT_BLOCK = XFILE_BLOCK_VIRTUAL; }; -} +} // namespace T5 diff --git a/src/ZoneCommon/Game/T6/GameAssetPoolT6.cpp b/src/ZoneCommon/Game/T6/GameAssetPoolT6.cpp index b667df7ed..c8e130206 100644 --- a/src/ZoneCommon/Game/T6/GameAssetPoolT6.cpp +++ b/src/ZoneCommon/Game/T6/GameAssetPoolT6.cpp @@ -1,76 +1,73 @@ #include "GameAssetPoolT6.h" +#include "Pool/AssetPoolDynamic.h" +#include "Pool/AssetPoolStatic.h" + #include <cassert> #include <type_traits> -#include "Pool/AssetPoolStatic.h" -#include "Pool/AssetPoolDynamic.h" - using namespace T6; -const char* GameAssetPoolT6::ASSET_TYPE_NAMES[] -{ - "xmodelpieces", - "physpreset", - "physconstraints", - "destructibledef", - "xanim", - "xmodel", - "material", - "techniqueset", - "image", - "soundbank", - "soundpatch", - "clipmap", - "clipmap", - "comworld", - "gameworldsp", - "gameworldmp", - "mapents", - "gfxworld", - "gfxlightdef", - "uimap", - "font", - "fonticon", - "menulist", - "menu", - "localize", - "weapon", - "weapondef", - "weaponvariant", - "weaponfull", - "attachment", - "attachmentunique", - "camo", - "snddriverglobals", - "fx", - "fximpacttable", - "aitype", - "mptype", - "mpbody", - "mphead", - "character", - "xmodelalias", - "rawfile", - "stringtable", - "leaderboard", - "xglobals", - "ddl", - "glasses", - "emblemset", - "script", - "keyvaluepairs", - "vehicle", - "memoryblock", - "addonmapents", - "tracer", - "skinnedverts", - "qdb", - "slug", - "footsteptable", - "footstepfxtable", - "zbarrier" -}; +const char* GameAssetPoolT6::ASSET_TYPE_NAMES[]{"xmodelpieces", + "physpreset", + "physconstraints", + "destructibledef", + "xanim", + "xmodel", + "material", + "techniqueset", + "image", + "soundbank", + "soundpatch", + "clipmap", + "clipmap", + "comworld", + "gameworldsp", + "gameworldmp", + "mapents", + "gfxworld", + "gfxlightdef", + "uimap", + "font", + "fonticon", + "menulist", + "menu", + "localize", + "weapon", + "weapondef", + "weaponvariant", + "weaponfull", + "attachment", + "attachmentunique", + "camo", + "snddriverglobals", + "fx", + "fximpacttable", + "aitype", + "mptype", + "mpbody", + "mphead", + "character", + "xmodelalias", + "rawfile", + "stringtable", + "leaderboard", + "xglobals", + "ddl", + "glasses", + "emblemset", + "script", + "keyvaluepairs", + "vehicle", + "memoryblock", + "addonmapents", + "tracer", + "skinnedverts", + "qdb", + "slug", + "footsteptable", + "footstepfxtable", + "zbarrier"}; GameAssetPoolT6::GameAssetPoolT6(Zone* zone, const int priority) : ZoneAssetPools(zone), @@ -81,67 +78,67 @@ GameAssetPoolT6::GameAssetPoolT6(Zone* zone, const int priority) void GameAssetPoolT6::InitPoolStatic(const asset_type_t type, const size_t capacity) { -#define CASE_INIT_POOL_STATIC(assetType, poolName, poolType) \ - case assetType: \ - { \ - if((poolName) == nullptr && capacity > 0) \ - { \ - (poolName) = std::make_unique<AssetPoolStatic<poolType>>(capacity, m_priority, (assetType)); \ - } \ - break; \ +#define CASE_INIT_POOL_STATIC(assetType, poolName, poolType) \ + case assetType: \ + { \ + if ((poolName) == nullptr && capacity > 0) \ + { \ + (poolName) = std::make_unique<AssetPoolStatic<poolType>>(capacity, m_priority, (assetType)); \ + } \ + break; \ } switch (type) { - CASE_INIT_POOL_STATIC(ASSET_TYPE_PHYSPRESET, m_phys_preset, PhysPreset); - CASE_INIT_POOL_STATIC(ASSET_TYPE_PHYSCONSTRAINTS, m_phys_constraints, PhysConstraints); - CASE_INIT_POOL_STATIC(ASSET_TYPE_DESTRUCTIBLEDEF, m_destructible_def, DestructibleDef); - CASE_INIT_POOL_STATIC(ASSET_TYPE_XANIMPARTS, m_xanim_parts, XAnimParts); - CASE_INIT_POOL_STATIC(ASSET_TYPE_XMODEL, m_xmodel, XModel); - CASE_INIT_POOL_STATIC(ASSET_TYPE_MATERIAL, m_material, Material); - CASE_INIT_POOL_STATIC(ASSET_TYPE_TECHNIQUE_SET, m_technique_set, MaterialTechniqueSet); - CASE_INIT_POOL_STATIC(ASSET_TYPE_IMAGE, m_image, GfxImage); - CASE_INIT_POOL_STATIC(ASSET_TYPE_SOUND, m_sound_bank, SndBank); - CASE_INIT_POOL_STATIC(ASSET_TYPE_SOUND_PATCH, m_sound_patch, SndPatch); - CASE_INIT_POOL_STATIC(ASSET_TYPE_CLIPMAP, m_clip_map, clipMap_t); - CASE_INIT_POOL_STATIC(ASSET_TYPE_CLIPMAP_PVS, m_clip_map, clipMap_t); - CASE_INIT_POOL_STATIC(ASSET_TYPE_COMWORLD, m_com_world, ComWorld); - CASE_INIT_POOL_STATIC(ASSET_TYPE_GAMEWORLD_SP, m_game_world_sp, GameWorldSp); - CASE_INIT_POOL_STATIC(ASSET_TYPE_GAMEWORLD_MP, m_game_world_mp, GameWorldMp); - CASE_INIT_POOL_STATIC(ASSET_TYPE_MAP_ENTS, m_map_ents, MapEnts); - CASE_INIT_POOL_STATIC(ASSET_TYPE_GFXWORLD, m_gfx_world, GfxWorld); - CASE_INIT_POOL_STATIC(ASSET_TYPE_LIGHT_DEF, m_gfx_light_def, GfxLightDef); - CASE_INIT_POOL_STATIC(ASSET_TYPE_FONT, m_font, Font_s); - CASE_INIT_POOL_STATIC(ASSET_TYPE_FONTICON, m_font_icon, FontIcon); - CASE_INIT_POOL_STATIC(ASSET_TYPE_MENULIST, m_menu_list, MenuList); - CASE_INIT_POOL_STATIC(ASSET_TYPE_MENU, m_menu_def, menuDef_t); - CASE_INIT_POOL_STATIC(ASSET_TYPE_LOCALIZE_ENTRY, m_localize, LocalizeEntry); - CASE_INIT_POOL_STATIC(ASSET_TYPE_WEAPON, m_weapon, WeaponVariantDef); - CASE_INIT_POOL_STATIC(ASSET_TYPE_ATTACHMENT, m_attachment, WeaponAttachment); - CASE_INIT_POOL_STATIC(ASSET_TYPE_ATTACHMENT_UNIQUE, m_attachment_unique, WeaponAttachmentUnique); - CASE_INIT_POOL_STATIC(ASSET_TYPE_WEAPON_CAMO, m_camo, WeaponCamo); - CASE_INIT_POOL_STATIC(ASSET_TYPE_SNDDRIVER_GLOBALS, m_snd_driver_globals, SndDriverGlobals); - CASE_INIT_POOL_STATIC(ASSET_TYPE_FX, m_fx, FxEffectDef); - CASE_INIT_POOL_STATIC(ASSET_TYPE_IMPACT_FX, m_fx_impact_table, FxImpactTable); - CASE_INIT_POOL_STATIC(ASSET_TYPE_RAWFILE, m_raw_file, RawFile); - CASE_INIT_POOL_STATIC(ASSET_TYPE_STRINGTABLE, m_string_table, StringTable); - CASE_INIT_POOL_STATIC(ASSET_TYPE_LEADERBOARD, m_leaderboard, LeaderboardDef); - CASE_INIT_POOL_STATIC(ASSET_TYPE_XGLOBALS, m_xglobals, XGlobals); - CASE_INIT_POOL_STATIC(ASSET_TYPE_DDL, m_ddl, ddlRoot_t); - CASE_INIT_POOL_STATIC(ASSET_TYPE_GLASSES, m_glasses, Glasses); - CASE_INIT_POOL_STATIC(ASSET_TYPE_EMBLEMSET, m_emblem_set, EmblemSet); - CASE_INIT_POOL_STATIC(ASSET_TYPE_SCRIPTPARSETREE, m_script, ScriptParseTree); - CASE_INIT_POOL_STATIC(ASSET_TYPE_KEYVALUEPAIRS, m_key_value_pairs, KeyValuePairs); - CASE_INIT_POOL_STATIC(ASSET_TYPE_VEHICLEDEF, m_vehicle, VehicleDef); - CASE_INIT_POOL_STATIC(ASSET_TYPE_MEMORYBLOCK, m_memory_block, MemoryBlock); - CASE_INIT_POOL_STATIC(ASSET_TYPE_ADDON_MAP_ENTS, m_addon_map_ents, AddonMapEnts); - CASE_INIT_POOL_STATIC(ASSET_TYPE_TRACER, m_tracer, TracerDef); - CASE_INIT_POOL_STATIC(ASSET_TYPE_SKINNEDVERTS, m_skinned_verts, SkinnedVertsDef); - CASE_INIT_POOL_STATIC(ASSET_TYPE_QDB, m_qdb, Qdb); - CASE_INIT_POOL_STATIC(ASSET_TYPE_SLUG, m_slug, Slug); - CASE_INIT_POOL_STATIC(ASSET_TYPE_FOOTSTEP_TABLE, m_footstep_table, FootstepTableDef); - CASE_INIT_POOL_STATIC(ASSET_TYPE_FOOTSTEPFX_TABLE, m_footstep_fx_table, FootstepFXTableDef); - CASE_INIT_POOL_STATIC(ASSET_TYPE_ZBARRIER, m_zbarrier, ZBarrierDef); + CASE_INIT_POOL_STATIC(ASSET_TYPE_PHYSPRESET, m_phys_preset, PhysPreset); + CASE_INIT_POOL_STATIC(ASSET_TYPE_PHYSCONSTRAINTS, m_phys_constraints, PhysConstraints); + CASE_INIT_POOL_STATIC(ASSET_TYPE_DESTRUCTIBLEDEF, m_destructible_def, DestructibleDef); + CASE_INIT_POOL_STATIC(ASSET_TYPE_XANIMPARTS, m_xanim_parts, XAnimParts); + CASE_INIT_POOL_STATIC(ASSET_TYPE_XMODEL, m_xmodel, XModel); + CASE_INIT_POOL_STATIC(ASSET_TYPE_MATERIAL, m_material, Material); + CASE_INIT_POOL_STATIC(ASSET_TYPE_TECHNIQUE_SET, m_technique_set, MaterialTechniqueSet); + CASE_INIT_POOL_STATIC(ASSET_TYPE_IMAGE, m_image, GfxImage); + CASE_INIT_POOL_STATIC(ASSET_TYPE_SOUND, m_sound_bank, SndBank); + CASE_INIT_POOL_STATIC(ASSET_TYPE_SOUND_PATCH, m_sound_patch, SndPatch); + CASE_INIT_POOL_STATIC(ASSET_TYPE_CLIPMAP, m_clip_map, clipMap_t); + CASE_INIT_POOL_STATIC(ASSET_TYPE_CLIPMAP_PVS, m_clip_map, clipMap_t); + CASE_INIT_POOL_STATIC(ASSET_TYPE_COMWORLD, m_com_world, ComWorld); + CASE_INIT_POOL_STATIC(ASSET_TYPE_GAMEWORLD_SP, m_game_world_sp, GameWorldSp); + CASE_INIT_POOL_STATIC(ASSET_TYPE_GAMEWORLD_MP, m_game_world_mp, GameWorldMp); + CASE_INIT_POOL_STATIC(ASSET_TYPE_MAP_ENTS, m_map_ents, MapEnts); + CASE_INIT_POOL_STATIC(ASSET_TYPE_GFXWORLD, m_gfx_world, GfxWorld); + CASE_INIT_POOL_STATIC(ASSET_TYPE_LIGHT_DEF, m_gfx_light_def, GfxLightDef); + CASE_INIT_POOL_STATIC(ASSET_TYPE_FONT, m_font, Font_s); + CASE_INIT_POOL_STATIC(ASSET_TYPE_FONTICON, m_font_icon, FontIcon); + CASE_INIT_POOL_STATIC(ASSET_TYPE_MENULIST, m_menu_list, MenuList); + CASE_INIT_POOL_STATIC(ASSET_TYPE_MENU, m_menu_def, menuDef_t); + CASE_INIT_POOL_STATIC(ASSET_TYPE_LOCALIZE_ENTRY, m_localize, LocalizeEntry); + CASE_INIT_POOL_STATIC(ASSET_TYPE_WEAPON, m_weapon, WeaponVariantDef); + CASE_INIT_POOL_STATIC(ASSET_TYPE_ATTACHMENT, m_attachment, WeaponAttachment); + CASE_INIT_POOL_STATIC(ASSET_TYPE_ATTACHMENT_UNIQUE, m_attachment_unique, WeaponAttachmentUnique); + CASE_INIT_POOL_STATIC(ASSET_TYPE_WEAPON_CAMO, m_camo, WeaponCamo); + CASE_INIT_POOL_STATIC(ASSET_TYPE_SNDDRIVER_GLOBALS, m_snd_driver_globals, SndDriverGlobals); + CASE_INIT_POOL_STATIC(ASSET_TYPE_FX, m_fx, FxEffectDef); + CASE_INIT_POOL_STATIC(ASSET_TYPE_IMPACT_FX, m_fx_impact_table, FxImpactTable); + CASE_INIT_POOL_STATIC(ASSET_TYPE_RAWFILE, m_raw_file, RawFile); + CASE_INIT_POOL_STATIC(ASSET_TYPE_STRINGTABLE, m_string_table, StringTable); + CASE_INIT_POOL_STATIC(ASSET_TYPE_LEADERBOARD, m_leaderboard, LeaderboardDef); + CASE_INIT_POOL_STATIC(ASSET_TYPE_XGLOBALS, m_xglobals, XGlobals); + CASE_INIT_POOL_STATIC(ASSET_TYPE_DDL, m_ddl, ddlRoot_t); + CASE_INIT_POOL_STATIC(ASSET_TYPE_GLASSES, m_glasses, Glasses); + CASE_INIT_POOL_STATIC(ASSET_TYPE_EMBLEMSET, m_emblem_set, EmblemSet); + CASE_INIT_POOL_STATIC(ASSET_TYPE_SCRIPTPARSETREE, m_script, ScriptParseTree); + CASE_INIT_POOL_STATIC(ASSET_TYPE_KEYVALUEPAIRS, m_key_value_pairs, KeyValuePairs); + CASE_INIT_POOL_STATIC(ASSET_TYPE_VEHICLEDEF, m_vehicle, VehicleDef); + CASE_INIT_POOL_STATIC(ASSET_TYPE_MEMORYBLOCK, m_memory_block, MemoryBlock); + CASE_INIT_POOL_STATIC(ASSET_TYPE_ADDON_MAP_ENTS, m_addon_map_ents, AddonMapEnts); + CASE_INIT_POOL_STATIC(ASSET_TYPE_TRACER, m_tracer, TracerDef); + CASE_INIT_POOL_STATIC(ASSET_TYPE_SKINNEDVERTS, m_skinned_verts, SkinnedVertsDef); + CASE_INIT_POOL_STATIC(ASSET_TYPE_QDB, m_qdb, Qdb); + CASE_INIT_POOL_STATIC(ASSET_TYPE_SLUG, m_slug, Slug); + CASE_INIT_POOL_STATIC(ASSET_TYPE_FOOTSTEP_TABLE, m_footstep_table, FootstepTableDef); + CASE_INIT_POOL_STATIC(ASSET_TYPE_FOOTSTEPFX_TABLE, m_footstep_fx_table, FootstepFXTableDef); + CASE_INIT_POOL_STATIC(ASSET_TYPE_ZBARRIER, m_zbarrier, ZBarrierDef); default: assert(type >= 0 && type < ASSET_TYPE_COUNT); @@ -153,67 +150,67 @@ void GameAssetPoolT6::InitPoolStatic(const asset_type_t type, const size_t capac void GameAssetPoolT6::InitPoolDynamic(const asset_type_t type) { -#define CASE_INIT_POOL_DYNAMIC(assetType, poolName, poolType) \ - case assetType: \ - { \ - if((poolName) == nullptr) \ - { \ - (poolName) = std::make_unique<AssetPoolDynamic<poolType>>(m_priority, (assetType)); \ - } \ - break; \ +#define CASE_INIT_POOL_DYNAMIC(assetType, poolName, poolType) \ + case assetType: \ + { \ + if ((poolName) == nullptr) \ + { \ + (poolName) = std::make_unique<AssetPoolDynamic<poolType>>(m_priority, (assetType)); \ + } \ + break; \ } switch (type) { - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_PHYSPRESET, m_phys_preset, PhysPreset); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_PHYSCONSTRAINTS, m_phys_constraints, PhysConstraints); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_DESTRUCTIBLEDEF, m_destructible_def, DestructibleDef); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_XANIMPARTS, m_xanim_parts, XAnimParts); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_XMODEL, m_xmodel, XModel); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_MATERIAL, m_material, Material); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_TECHNIQUE_SET, m_technique_set, MaterialTechniqueSet); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_IMAGE, m_image, GfxImage); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_SOUND, m_sound_bank, SndBank); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_SOUND_PATCH, m_sound_patch, SndPatch); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_CLIPMAP, m_clip_map, clipMap_t); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_CLIPMAP_PVS, m_clip_map, clipMap_t); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_COMWORLD, m_com_world, ComWorld); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_GAMEWORLD_SP, m_game_world_sp, GameWorldSp); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_GAMEWORLD_MP, m_game_world_mp, GameWorldMp); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_MAP_ENTS, m_map_ents, MapEnts); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_GFXWORLD, m_gfx_world, GfxWorld); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_LIGHT_DEF, m_gfx_light_def, GfxLightDef); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_FONT, m_font, Font_s); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_FONTICON, m_font_icon, FontIcon); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_MENULIST, m_menu_list, MenuList); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_MENU, m_menu_def, menuDef_t); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_LOCALIZE_ENTRY, m_localize, LocalizeEntry); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_WEAPON, m_weapon, WeaponVariantDef); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_ATTACHMENT, m_attachment, WeaponAttachment); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_ATTACHMENT_UNIQUE, m_attachment_unique, WeaponAttachmentUnique); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_WEAPON_CAMO, m_camo, WeaponCamo); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_SNDDRIVER_GLOBALS, m_snd_driver_globals, SndDriverGlobals); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_FX, m_fx, FxEffectDef); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_IMPACT_FX, m_fx_impact_table, FxImpactTable); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_RAWFILE, m_raw_file, RawFile); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_STRINGTABLE, m_string_table, StringTable); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_LEADERBOARD, m_leaderboard, LeaderboardDef); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_XGLOBALS, m_xglobals, XGlobals); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_DDL, m_ddl, ddlRoot_t); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_GLASSES, m_glasses, Glasses); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_EMBLEMSET, m_emblem_set, EmblemSet); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_SCRIPTPARSETREE, m_script, ScriptParseTree); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_KEYVALUEPAIRS, m_key_value_pairs, KeyValuePairs); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_VEHICLEDEF, m_vehicle, VehicleDef); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_MEMORYBLOCK, m_memory_block, MemoryBlock); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_ADDON_MAP_ENTS, m_addon_map_ents, AddonMapEnts); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_TRACER, m_tracer, TracerDef); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_SKINNEDVERTS, m_skinned_verts, SkinnedVertsDef); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_QDB, m_qdb, Qdb); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_SLUG, m_slug, Slug); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_FOOTSTEP_TABLE, m_footstep_table, FootstepTableDef); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_FOOTSTEPFX_TABLE, m_footstep_fx_table, FootstepFXTableDef); - CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_ZBARRIER, m_zbarrier, ZBarrierDef); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_PHYSPRESET, m_phys_preset, PhysPreset); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_PHYSCONSTRAINTS, m_phys_constraints, PhysConstraints); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_DESTRUCTIBLEDEF, m_destructible_def, DestructibleDef); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_XANIMPARTS, m_xanim_parts, XAnimParts); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_XMODEL, m_xmodel, XModel); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_MATERIAL, m_material, Material); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_TECHNIQUE_SET, m_technique_set, MaterialTechniqueSet); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_IMAGE, m_image, GfxImage); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_SOUND, m_sound_bank, SndBank); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_SOUND_PATCH, m_sound_patch, SndPatch); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_CLIPMAP, m_clip_map, clipMap_t); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_CLIPMAP_PVS, m_clip_map, clipMap_t); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_COMWORLD, m_com_world, ComWorld); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_GAMEWORLD_SP, m_game_world_sp, GameWorldSp); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_GAMEWORLD_MP, m_game_world_mp, GameWorldMp); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_MAP_ENTS, m_map_ents, MapEnts); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_GFXWORLD, m_gfx_world, GfxWorld); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_LIGHT_DEF, m_gfx_light_def, GfxLightDef); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_FONT, m_font, Font_s); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_FONTICON, m_font_icon, FontIcon); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_MENULIST, m_menu_list, MenuList); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_MENU, m_menu_def, menuDef_t); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_LOCALIZE_ENTRY, m_localize, LocalizeEntry); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_WEAPON, m_weapon, WeaponVariantDef); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_ATTACHMENT, m_attachment, WeaponAttachment); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_ATTACHMENT_UNIQUE, m_attachment_unique, WeaponAttachmentUnique); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_WEAPON_CAMO, m_camo, WeaponCamo); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_SNDDRIVER_GLOBALS, m_snd_driver_globals, SndDriverGlobals); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_FX, m_fx, FxEffectDef); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_IMPACT_FX, m_fx_impact_table, FxImpactTable); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_RAWFILE, m_raw_file, RawFile); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_STRINGTABLE, m_string_table, StringTable); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_LEADERBOARD, m_leaderboard, LeaderboardDef); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_XGLOBALS, m_xglobals, XGlobals); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_DDL, m_ddl, ddlRoot_t); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_GLASSES, m_glasses, Glasses); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_EMBLEMSET, m_emblem_set, EmblemSet); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_SCRIPTPARSETREE, m_script, ScriptParseTree); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_KEYVALUEPAIRS, m_key_value_pairs, KeyValuePairs); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_VEHICLEDEF, m_vehicle, VehicleDef); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_MEMORYBLOCK, m_memory_block, MemoryBlock); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_ADDON_MAP_ENTS, m_addon_map_ents, AddonMapEnts); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_TRACER, m_tracer, TracerDef); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_SKINNEDVERTS, m_skinned_verts, SkinnedVertsDef); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_QDB, m_qdb, Qdb); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_SLUG, m_slug, Slug); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_FOOTSTEP_TABLE, m_footstep_table, FootstepTableDef); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_FOOTSTEPFX_TABLE, m_footstep_fx_table, FootstepFXTableDef); + CASE_INIT_POOL_DYNAMIC(ASSET_TYPE_ZBARRIER, m_zbarrier, ZBarrierDef); default: assert(type >= 0 && type < ASSET_TYPE_COUNT); @@ -223,72 +220,72 @@ void GameAssetPoolT6::InitPoolDynamic(const asset_type_t type) #undef CASE_INIT_POOL_STATIC } -XAssetInfoGeneric* GameAssetPoolT6::AddAssetToPool(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, - Zone* zone) +XAssetInfoGeneric* GameAssetPoolT6::AddAssetToPool( + asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone) { XAsset xAsset{}; xAsset.type = static_cast<XAssetType>(type); xAsset.header.data = asset; -#define CASE_ADD_TO_POOL(assetType, poolName, headerName) \ - case assetType: \ - { \ - assert((poolName) != nullptr); \ - return (poolName)->AddAsset(std::move(name), xAsset.header.headerName, zone, std::move(dependencies), std::move(usedScriptStrings)); \ +#define CASE_ADD_TO_POOL(assetType, poolName, headerName) \ + case assetType: \ + { \ + assert((poolName) != nullptr); \ + return (poolName)->AddAsset(std::move(name), xAsset.header.headerName, zone, std::move(dependencies), std::move(usedScriptStrings)); \ } switch (xAsset.type) { - CASE_ADD_TO_POOL(ASSET_TYPE_PHYSPRESET, m_phys_preset, physPreset); - CASE_ADD_TO_POOL(ASSET_TYPE_PHYSCONSTRAINTS, m_phys_constraints, physConstraints); - CASE_ADD_TO_POOL(ASSET_TYPE_DESTRUCTIBLEDEF, m_destructible_def, destructibleDef); - CASE_ADD_TO_POOL(ASSET_TYPE_XANIMPARTS, m_xanim_parts, parts); - CASE_ADD_TO_POOL(ASSET_TYPE_XMODEL, m_xmodel, model); - CASE_ADD_TO_POOL(ASSET_TYPE_MATERIAL, m_material, material); - CASE_ADD_TO_POOL(ASSET_TYPE_TECHNIQUE_SET, m_technique_set, techniqueSet); - CASE_ADD_TO_POOL(ASSET_TYPE_IMAGE, m_image, image); - CASE_ADD_TO_POOL(ASSET_TYPE_SOUND, m_sound_bank, sound); - CASE_ADD_TO_POOL(ASSET_TYPE_SOUND_PATCH, m_sound_patch, soundPatch); - CASE_ADD_TO_POOL(ASSET_TYPE_CLIPMAP, m_clip_map, clipMap); - CASE_ADD_TO_POOL(ASSET_TYPE_CLIPMAP_PVS, m_clip_map, clipMap); - CASE_ADD_TO_POOL(ASSET_TYPE_COMWORLD, m_com_world, comWorld); - CASE_ADD_TO_POOL(ASSET_TYPE_GAMEWORLD_SP, m_game_world_sp, gameWorldSp); - CASE_ADD_TO_POOL(ASSET_TYPE_GAMEWORLD_MP, m_game_world_mp, gameWorldMp); - CASE_ADD_TO_POOL(ASSET_TYPE_MAP_ENTS, m_map_ents, mapEnts); - CASE_ADD_TO_POOL(ASSET_TYPE_GFXWORLD, m_gfx_world, gfxWorld); - CASE_ADD_TO_POOL(ASSET_TYPE_LIGHT_DEF, m_gfx_light_def, lightDef); - CASE_ADD_TO_POOL(ASSET_TYPE_FONT, m_font, font); - CASE_ADD_TO_POOL(ASSET_TYPE_FONTICON, m_font_icon, fontIcon); - CASE_ADD_TO_POOL(ASSET_TYPE_MENULIST, m_menu_list, menuList); - CASE_ADD_TO_POOL(ASSET_TYPE_MENU, m_menu_def, menu); - CASE_ADD_TO_POOL(ASSET_TYPE_LOCALIZE_ENTRY, m_localize, localize); - CASE_ADD_TO_POOL(ASSET_TYPE_WEAPON, m_weapon, weapon); - CASE_ADD_TO_POOL(ASSET_TYPE_ATTACHMENT, m_attachment, attachment); - CASE_ADD_TO_POOL(ASSET_TYPE_ATTACHMENT_UNIQUE, m_attachment_unique, attachmentUnique); - CASE_ADD_TO_POOL(ASSET_TYPE_WEAPON_CAMO, m_camo, weaponCamo); - CASE_ADD_TO_POOL(ASSET_TYPE_SNDDRIVER_GLOBALS, m_snd_driver_globals, sndDriverGlobals); - CASE_ADD_TO_POOL(ASSET_TYPE_FX, m_fx, fx); - CASE_ADD_TO_POOL(ASSET_TYPE_IMPACT_FX, m_fx_impact_table, impactFx); - CASE_ADD_TO_POOL(ASSET_TYPE_RAWFILE, m_raw_file, rawfile); - CASE_ADD_TO_POOL(ASSET_TYPE_STRINGTABLE, m_string_table, stringTable); - CASE_ADD_TO_POOL(ASSET_TYPE_LEADERBOARD, m_leaderboard, leaderboardDef); - CASE_ADD_TO_POOL(ASSET_TYPE_XGLOBALS, m_xglobals, xGlobals); - CASE_ADD_TO_POOL(ASSET_TYPE_DDL, m_ddl, ddlRoot); - CASE_ADD_TO_POOL(ASSET_TYPE_GLASSES, m_glasses, glasses); - CASE_ADD_TO_POOL(ASSET_TYPE_EMBLEMSET, m_emblem_set, emblemSet); - CASE_ADD_TO_POOL(ASSET_TYPE_SCRIPTPARSETREE, m_script, scriptParseTree); - CASE_ADD_TO_POOL(ASSET_TYPE_KEYVALUEPAIRS, m_key_value_pairs, keyValuePairs); - CASE_ADD_TO_POOL(ASSET_TYPE_VEHICLEDEF, m_vehicle, vehicleDef); - CASE_ADD_TO_POOL(ASSET_TYPE_MEMORYBLOCK, m_memory_block, memoryBlock); - CASE_ADD_TO_POOL(ASSET_TYPE_ADDON_MAP_ENTS, m_addon_map_ents, addonMapEnts); - CASE_ADD_TO_POOL(ASSET_TYPE_TRACER, m_tracer, tracerDef); - CASE_ADD_TO_POOL(ASSET_TYPE_SKINNEDVERTS, m_skinned_verts, skinnedVertsDef); - CASE_ADD_TO_POOL(ASSET_TYPE_QDB, m_qdb, qdb); - CASE_ADD_TO_POOL(ASSET_TYPE_SLUG, m_slug, slug); - CASE_ADD_TO_POOL(ASSET_TYPE_FOOTSTEP_TABLE, m_footstep_table, footstepTableDef); - CASE_ADD_TO_POOL(ASSET_TYPE_FOOTSTEPFX_TABLE, m_footstep_fx_table, footstepFXTableDef); - CASE_ADD_TO_POOL(ASSET_TYPE_ZBARRIER, m_zbarrier, zbarrierDef); + CASE_ADD_TO_POOL(ASSET_TYPE_PHYSPRESET, m_phys_preset, physPreset); + CASE_ADD_TO_POOL(ASSET_TYPE_PHYSCONSTRAINTS, m_phys_constraints, physConstraints); + CASE_ADD_TO_POOL(ASSET_TYPE_DESTRUCTIBLEDEF, m_destructible_def, destructibleDef); + CASE_ADD_TO_POOL(ASSET_TYPE_XANIMPARTS, m_xanim_parts, parts); + CASE_ADD_TO_POOL(ASSET_TYPE_XMODEL, m_xmodel, model); + CASE_ADD_TO_POOL(ASSET_TYPE_MATERIAL, m_material, material); + CASE_ADD_TO_POOL(ASSET_TYPE_TECHNIQUE_SET, m_technique_set, techniqueSet); + CASE_ADD_TO_POOL(ASSET_TYPE_IMAGE, m_image, image); + CASE_ADD_TO_POOL(ASSET_TYPE_SOUND, m_sound_bank, sound); + CASE_ADD_TO_POOL(ASSET_TYPE_SOUND_PATCH, m_sound_patch, soundPatch); + CASE_ADD_TO_POOL(ASSET_TYPE_CLIPMAP, m_clip_map, clipMap); + CASE_ADD_TO_POOL(ASSET_TYPE_CLIPMAP_PVS, m_clip_map, clipMap); + CASE_ADD_TO_POOL(ASSET_TYPE_COMWORLD, m_com_world, comWorld); + CASE_ADD_TO_POOL(ASSET_TYPE_GAMEWORLD_SP, m_game_world_sp, gameWorldSp); + CASE_ADD_TO_POOL(ASSET_TYPE_GAMEWORLD_MP, m_game_world_mp, gameWorldMp); + CASE_ADD_TO_POOL(ASSET_TYPE_MAP_ENTS, m_map_ents, mapEnts); + CASE_ADD_TO_POOL(ASSET_TYPE_GFXWORLD, m_gfx_world, gfxWorld); + CASE_ADD_TO_POOL(ASSET_TYPE_LIGHT_DEF, m_gfx_light_def, lightDef); + CASE_ADD_TO_POOL(ASSET_TYPE_FONT, m_font, font); + CASE_ADD_TO_POOL(ASSET_TYPE_FONTICON, m_font_icon, fontIcon); + CASE_ADD_TO_POOL(ASSET_TYPE_MENULIST, m_menu_list, menuList); + CASE_ADD_TO_POOL(ASSET_TYPE_MENU, m_menu_def, menu); + CASE_ADD_TO_POOL(ASSET_TYPE_LOCALIZE_ENTRY, m_localize, localize); + CASE_ADD_TO_POOL(ASSET_TYPE_WEAPON, m_weapon, weapon); + CASE_ADD_TO_POOL(ASSET_TYPE_ATTACHMENT, m_attachment, attachment); + CASE_ADD_TO_POOL(ASSET_TYPE_ATTACHMENT_UNIQUE, m_attachment_unique, attachmentUnique); + CASE_ADD_TO_POOL(ASSET_TYPE_WEAPON_CAMO, m_camo, weaponCamo); + CASE_ADD_TO_POOL(ASSET_TYPE_SNDDRIVER_GLOBALS, m_snd_driver_globals, sndDriverGlobals); + CASE_ADD_TO_POOL(ASSET_TYPE_FX, m_fx, fx); + CASE_ADD_TO_POOL(ASSET_TYPE_IMPACT_FX, m_fx_impact_table, impactFx); + CASE_ADD_TO_POOL(ASSET_TYPE_RAWFILE, m_raw_file, rawfile); + CASE_ADD_TO_POOL(ASSET_TYPE_STRINGTABLE, m_string_table, stringTable); + CASE_ADD_TO_POOL(ASSET_TYPE_LEADERBOARD, m_leaderboard, leaderboardDef); + CASE_ADD_TO_POOL(ASSET_TYPE_XGLOBALS, m_xglobals, xGlobals); + CASE_ADD_TO_POOL(ASSET_TYPE_DDL, m_ddl, ddlRoot); + CASE_ADD_TO_POOL(ASSET_TYPE_GLASSES, m_glasses, glasses); + CASE_ADD_TO_POOL(ASSET_TYPE_EMBLEMSET, m_emblem_set, emblemSet); + CASE_ADD_TO_POOL(ASSET_TYPE_SCRIPTPARSETREE, m_script, scriptParseTree); + CASE_ADD_TO_POOL(ASSET_TYPE_KEYVALUEPAIRS, m_key_value_pairs, keyValuePairs); + CASE_ADD_TO_POOL(ASSET_TYPE_VEHICLEDEF, m_vehicle, vehicleDef); + CASE_ADD_TO_POOL(ASSET_TYPE_MEMORYBLOCK, m_memory_block, memoryBlock); + CASE_ADD_TO_POOL(ASSET_TYPE_ADDON_MAP_ENTS, m_addon_map_ents, addonMapEnts); + CASE_ADD_TO_POOL(ASSET_TYPE_TRACER, m_tracer, tracerDef); + CASE_ADD_TO_POOL(ASSET_TYPE_SKINNEDVERTS, m_skinned_verts, skinnedVertsDef); + CASE_ADD_TO_POOL(ASSET_TYPE_QDB, m_qdb, qdb); + CASE_ADD_TO_POOL(ASSET_TYPE_SLUG, m_slug, slug); + CASE_ADD_TO_POOL(ASSET_TYPE_FOOTSTEP_TABLE, m_footstep_table, footstepTableDef); + CASE_ADD_TO_POOL(ASSET_TYPE_FOOTSTEPFX_TABLE, m_footstep_fx_table, footstepFXTableDef); + CASE_ADD_TO_POOL(ASSET_TYPE_ZBARRIER, m_zbarrier, zbarrierDef); default: assert(false); @@ -302,65 +299,65 @@ XAssetInfoGeneric* GameAssetPoolT6::AddAssetToPool(asset_type_t type, std::strin XAssetInfoGeneric* GameAssetPoolT6::GetAsset(const asset_type_t type, std::string name) const { -#define CASE_GET_ASSET(assetType, poolName) \ - case assetType: \ - { \ - if((poolName) != nullptr) \ - return (poolName)->GetAsset(std::move(name)); \ - break; \ +#define CASE_GET_ASSET(assetType, poolName) \ + case assetType: \ + { \ + if ((poolName) != nullptr) \ + return (poolName)->GetAsset(std::move(name)); \ + break; \ } switch (type) { - CASE_GET_ASSET(ASSET_TYPE_PHYSPRESET, m_phys_preset); - CASE_GET_ASSET(ASSET_TYPE_PHYSCONSTRAINTS, m_phys_constraints); - CASE_GET_ASSET(ASSET_TYPE_DESTRUCTIBLEDEF, m_destructible_def); - CASE_GET_ASSET(ASSET_TYPE_XANIMPARTS, m_xanim_parts); - CASE_GET_ASSET(ASSET_TYPE_XMODEL, m_xmodel); - CASE_GET_ASSET(ASSET_TYPE_MATERIAL, m_material); - CASE_GET_ASSET(ASSET_TYPE_TECHNIQUE_SET, m_technique_set); - CASE_GET_ASSET(ASSET_TYPE_IMAGE, m_image); - CASE_GET_ASSET(ASSET_TYPE_SOUND, m_sound_bank); - CASE_GET_ASSET(ASSET_TYPE_SOUND_PATCH, m_sound_patch); - CASE_GET_ASSET(ASSET_TYPE_CLIPMAP, m_clip_map); - CASE_GET_ASSET(ASSET_TYPE_CLIPMAP_PVS, m_clip_map); - CASE_GET_ASSET(ASSET_TYPE_COMWORLD, m_com_world); - CASE_GET_ASSET(ASSET_TYPE_GAMEWORLD_SP, m_game_world_sp); - CASE_GET_ASSET(ASSET_TYPE_GAMEWORLD_MP, m_game_world_mp); - CASE_GET_ASSET(ASSET_TYPE_MAP_ENTS, m_map_ents); - CASE_GET_ASSET(ASSET_TYPE_GFXWORLD, m_gfx_world); - CASE_GET_ASSET(ASSET_TYPE_LIGHT_DEF, m_gfx_light_def); - CASE_GET_ASSET(ASSET_TYPE_FONT, m_font); - CASE_GET_ASSET(ASSET_TYPE_FONTICON, m_font_icon); - CASE_GET_ASSET(ASSET_TYPE_MENULIST, m_menu_list); - CASE_GET_ASSET(ASSET_TYPE_MENU, m_menu_def); - CASE_GET_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, m_localize); - CASE_GET_ASSET(ASSET_TYPE_WEAPON, m_weapon); - CASE_GET_ASSET(ASSET_TYPE_ATTACHMENT, m_attachment); - CASE_GET_ASSET(ASSET_TYPE_ATTACHMENT_UNIQUE, m_attachment_unique); - CASE_GET_ASSET(ASSET_TYPE_WEAPON_CAMO, m_camo); - CASE_GET_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, m_snd_driver_globals); - CASE_GET_ASSET(ASSET_TYPE_FX, m_fx); - CASE_GET_ASSET(ASSET_TYPE_IMPACT_FX, m_fx_impact_table); - CASE_GET_ASSET(ASSET_TYPE_RAWFILE, m_raw_file); - CASE_GET_ASSET(ASSET_TYPE_STRINGTABLE, m_string_table); - CASE_GET_ASSET(ASSET_TYPE_LEADERBOARD, m_leaderboard); - CASE_GET_ASSET(ASSET_TYPE_XGLOBALS, m_xglobals); - CASE_GET_ASSET(ASSET_TYPE_DDL, m_ddl); - CASE_GET_ASSET(ASSET_TYPE_GLASSES, m_glasses); - CASE_GET_ASSET(ASSET_TYPE_EMBLEMSET, m_emblem_set); - CASE_GET_ASSET(ASSET_TYPE_SCRIPTPARSETREE, m_script); - CASE_GET_ASSET(ASSET_TYPE_KEYVALUEPAIRS, m_key_value_pairs); - CASE_GET_ASSET(ASSET_TYPE_VEHICLEDEF, m_vehicle); - CASE_GET_ASSET(ASSET_TYPE_MEMORYBLOCK, m_memory_block); - CASE_GET_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, m_addon_map_ents); - CASE_GET_ASSET(ASSET_TYPE_TRACER, m_tracer); - CASE_GET_ASSET(ASSET_TYPE_SKINNEDVERTS, m_skinned_verts); - CASE_GET_ASSET(ASSET_TYPE_QDB, m_qdb); - CASE_GET_ASSET(ASSET_TYPE_SLUG, m_slug); - CASE_GET_ASSET(ASSET_TYPE_FOOTSTEP_TABLE, m_footstep_table); - CASE_GET_ASSET(ASSET_TYPE_FOOTSTEPFX_TABLE, m_footstep_fx_table); - CASE_GET_ASSET(ASSET_TYPE_ZBARRIER, m_zbarrier); + CASE_GET_ASSET(ASSET_TYPE_PHYSPRESET, m_phys_preset); + CASE_GET_ASSET(ASSET_TYPE_PHYSCONSTRAINTS, m_phys_constraints); + CASE_GET_ASSET(ASSET_TYPE_DESTRUCTIBLEDEF, m_destructible_def); + CASE_GET_ASSET(ASSET_TYPE_XANIMPARTS, m_xanim_parts); + CASE_GET_ASSET(ASSET_TYPE_XMODEL, m_xmodel); + CASE_GET_ASSET(ASSET_TYPE_MATERIAL, m_material); + CASE_GET_ASSET(ASSET_TYPE_TECHNIQUE_SET, m_technique_set); + CASE_GET_ASSET(ASSET_TYPE_IMAGE, m_image); + CASE_GET_ASSET(ASSET_TYPE_SOUND, m_sound_bank); + CASE_GET_ASSET(ASSET_TYPE_SOUND_PATCH, m_sound_patch); + CASE_GET_ASSET(ASSET_TYPE_CLIPMAP, m_clip_map); + CASE_GET_ASSET(ASSET_TYPE_CLIPMAP_PVS, m_clip_map); + CASE_GET_ASSET(ASSET_TYPE_COMWORLD, m_com_world); + CASE_GET_ASSET(ASSET_TYPE_GAMEWORLD_SP, m_game_world_sp); + CASE_GET_ASSET(ASSET_TYPE_GAMEWORLD_MP, m_game_world_mp); + CASE_GET_ASSET(ASSET_TYPE_MAP_ENTS, m_map_ents); + CASE_GET_ASSET(ASSET_TYPE_GFXWORLD, m_gfx_world); + CASE_GET_ASSET(ASSET_TYPE_LIGHT_DEF, m_gfx_light_def); + CASE_GET_ASSET(ASSET_TYPE_FONT, m_font); + CASE_GET_ASSET(ASSET_TYPE_FONTICON, m_font_icon); + CASE_GET_ASSET(ASSET_TYPE_MENULIST, m_menu_list); + CASE_GET_ASSET(ASSET_TYPE_MENU, m_menu_def); + CASE_GET_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, m_localize); + CASE_GET_ASSET(ASSET_TYPE_WEAPON, m_weapon); + CASE_GET_ASSET(ASSET_TYPE_ATTACHMENT, m_attachment); + CASE_GET_ASSET(ASSET_TYPE_ATTACHMENT_UNIQUE, m_attachment_unique); + CASE_GET_ASSET(ASSET_TYPE_WEAPON_CAMO, m_camo); + CASE_GET_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, m_snd_driver_globals); + CASE_GET_ASSET(ASSET_TYPE_FX, m_fx); + CASE_GET_ASSET(ASSET_TYPE_IMPACT_FX, m_fx_impact_table); + CASE_GET_ASSET(ASSET_TYPE_RAWFILE, m_raw_file); + CASE_GET_ASSET(ASSET_TYPE_STRINGTABLE, m_string_table); + CASE_GET_ASSET(ASSET_TYPE_LEADERBOARD, m_leaderboard); + CASE_GET_ASSET(ASSET_TYPE_XGLOBALS, m_xglobals); + CASE_GET_ASSET(ASSET_TYPE_DDL, m_ddl); + CASE_GET_ASSET(ASSET_TYPE_GLASSES, m_glasses); + CASE_GET_ASSET(ASSET_TYPE_EMBLEMSET, m_emblem_set); + CASE_GET_ASSET(ASSET_TYPE_SCRIPTPARSETREE, m_script); + CASE_GET_ASSET(ASSET_TYPE_KEYVALUEPAIRS, m_key_value_pairs); + CASE_GET_ASSET(ASSET_TYPE_VEHICLEDEF, m_vehicle); + CASE_GET_ASSET(ASSET_TYPE_MEMORYBLOCK, m_memory_block); + CASE_GET_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, m_addon_map_ents); + CASE_GET_ASSET(ASSET_TYPE_TRACER, m_tracer); + CASE_GET_ASSET(ASSET_TYPE_SKINNEDVERTS, m_skinned_verts); + CASE_GET_ASSET(ASSET_TYPE_QDB, m_qdb); + CASE_GET_ASSET(ASSET_TYPE_SLUG, m_slug); + CASE_GET_ASSET(ASSET_TYPE_FOOTSTEP_TABLE, m_footstep_table); + CASE_GET_ASSET(ASSET_TYPE_FOOTSTEPFX_TABLE, m_footstep_fx_table); + CASE_GET_ASSET(ASSET_TYPE_ZBARRIER, m_zbarrier); default: assert(false); diff --git a/src/ZoneCommon/Game/T6/GameAssetPoolT6.h b/src/ZoneCommon/Game/T6/GameAssetPoolT6.h index 1daddca66..891a43aa7 100644 --- a/src/ZoneCommon/Game/T6/GameAssetPoolT6.h +++ b/src/ZoneCommon/Game/T6/GameAssetPoolT6.h @@ -1,10 +1,10 @@ #pragma once -#include <memory> - -#include "Pool/ZoneAssetPools.h" -#include "Pool/AssetPool.h" #include "Game/T6/T6.h" +#include "Pool/AssetPool.h" +#include "Pool/ZoneAssetPools.h" + +#include <memory> class GameAssetPoolT6 final : public ZoneAssetPools { @@ -14,7 +14,12 @@ class GameAssetPoolT6 final : public ZoneAssetPools static const char* ASSET_TYPE_NAMES[]; protected: - XAssetInfoGeneric* AddAssetToPool(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone) override; + XAssetInfoGeneric* AddAssetToPool(asset_type_t type, + std::string name, + void* asset, + std::vector<XAssetInfoGeneric*> dependencies, + std::vector<scr_string_t> usedScriptStrings, + Zone* zone) override; public: std::unique_ptr<AssetPool<T6::PhysPreset>> m_phys_preset; diff --git a/src/ZoneCommon/Game/T6/ZoneConstantsT6.h b/src/ZoneCommon/Game/T6/ZoneConstantsT6.h index 5f66fdbde..217265888 100644 --- a/src/ZoneCommon/Game/T6/ZoneConstantsT6.h +++ b/src/ZoneCommon/Game/T6/ZoneConstantsT6.h @@ -1,10 +1,10 @@ #pragma once +#include "Game/T6/T6.h" +#include "Zone/ZoneTypes.h" + #include <cstdint> #include <string> -#include "Zone/ZoneTypes.h" -#include "Game/T6/T6.h" - namespace T6 { class ZoneConstants final @@ -34,54 +34,21 @@ namespace T6 static constexpr size_t FILE_SUFFIX_ZERO_ALIGN = 0x40; static constexpr const char* MAGIC_AUTH_HEADER = "PHEEBs71"; - inline static const uint8_t SALSA20_KEY_TREYARCH[] - { - 0x64, 0x1D, 0x8A, 0x2F, - 0xE3, 0x1D, 0x3A, 0xA6, - 0x36, 0x22, 0xBB, 0xC9, - 0xCE, 0x85, 0x87, 0x22, - 0x9D, 0x42, 0xB0, 0xF8, - 0xED, 0x9B, 0x92, 0x41, - 0x30, 0xBF, 0x88, 0xB6, - 0x5E, 0xDC, 0x50, 0xBE - }; - - inline static const uint8_t RSA_PUBLIC_KEY_TREYARCH[] - { - 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, - 0x00, 0xc7, 0x9d, 0x33, 0xe0, 0x75, 0xaf, 0xef, - 0x08, 0x08, 0x2b, 0x89, 0xd9, 0x3b, 0xf3, 0xd5, - 0x9a, 0x65, 0xa6, 0xde, 0x3b, 0x1e, 0x20, 0xde, - 0x59, 0x19, 0x43, 0x88, 0x1a, 0x8b, 0x39, 0x13, - 0x60, 0x12, 0xd3, 0xb2, 0x77, 0x6d, 0xe1, 0x99, - 0x75, 0x24, 0xb4, 0x0d, 0x8c, 0xb7, 0x84, 0xf2, - 0x48, 0x8f, 0xd5, 0x4c, 0xb7, 0x64, 0x44, 0xa3, - 0xa8, 0x4a, 0xac, 0x2d, 0x54, 0x15, 0x2b, 0x1f, - 0xb3, 0xf4, 0x4c, 0x16, 0xa0, 0x92, 0x8e, 0xd2, - 0xfa, 0xcc, 0x11, 0x6a, 0x74, 0x6a, 0x70, 0xb8, - 0xd3, 0x34, 0x6b, 0x39, 0xc6, 0x2a, 0x69, 0xde, - 0x31, 0x34, 0xdf, 0xe7, 0x8b, 0x7e, 0x17, 0xa3, - 0x17, 0xd9, 0x5e, 0x88, 0x39, 0x21, 0xf8, 0x7d, - 0x3c, 0x29, 0x21, 0x6c, 0x0e, 0xf1, 0xb4, 0x09, - 0x54, 0xe8, 0x20, 0x34, 0x90, 0x2e, 0xb4, 0x1a, - 0x95, 0x95, 0x90, 0xe5, 0xfb, 0xce, 0xfe, 0x8a, - 0xbf, 0xea, 0xaf, 0x09, 0x0c, 0x0b, 0x87, 0x22, - 0xe1, 0xfe, 0x82, 0x6e, 0x91, 0xe8, 0xd1, 0xb6, - 0x35, 0x03, 0x4f, 0xdb, 0xc1, 0x31, 0xe2, 0xba, - 0xa0, 0x13, 0xf6, 0xdb, 0x07, 0x9b, 0xcb, 0x99, - 0xce, 0x9f, 0x49, 0xc4, 0x51, 0x8e, 0xf1, 0x04, - 0x9b, 0x30, 0xc3, 0x02, 0xff, 0x7b, 0x94, 0xca, - 0x12, 0x69, 0x1e, 0xdb, 0x2d, 0x3e, 0xbd, 0x48, - 0x16, 0xe1, 0x72, 0x37, 0xb8, 0x5f, 0x61, 0xfa, - 0x24, 0x16, 0x3a, 0xde, 0xbf, 0x6a, 0x71, 0x62, - 0x32, 0xf3, 0xaa, 0x7f, 0x28, 0x3a, 0x0c, 0x27, - 0xeb, 0xa9, 0x0a, 0x4c, 0x79, 0x88, 0x84, 0xb3, - 0xe2, 0x52, 0xb9, 0x68, 0x1e, 0x82, 0xcf, 0x67, - 0x43, 0xf3, 0x68, 0xf7, 0x26, 0x19, 0xaa, 0xdd, - 0x3f, 0x1e, 0xc6, 0x46, 0x11, 0x9f, 0x24, 0x23, - 0xa7, 0xb0, 0x1b, 0x79, 0xa7, 0x0c, 0x5a, 0xfe, - 0x96, 0xf7, 0xe7, 0x88, 0x09, 0xa6, 0x69, 0xe3, - 0x8b, 0x02, 0x03, 0x01, 0x00, 0x01 - }; + inline static const uint8_t SALSA20_KEY_TREYARCH[]{0x64, 0x1D, 0x8A, 0x2F, 0xE3, 0x1D, 0x3A, 0xA6, 0x36, 0x22, 0xBB, 0xC9, 0xCE, 0x85, 0x87, 0x22, + 0x9D, 0x42, 0xB0, 0xF8, 0xED, 0x9B, 0x92, 0x41, 0x30, 0xBF, 0x88, 0xB6, 0x5E, 0xDC, 0x50, 0xBE}; + + inline static const uint8_t RSA_PUBLIC_KEY_TREYARCH[]{ + 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xc7, 0x9d, 0x33, 0xe0, 0x75, 0xaf, 0xef, 0x08, 0x08, 0x2b, 0x89, 0xd9, 0x3b, 0xf3, + 0xd5, 0x9a, 0x65, 0xa6, 0xde, 0x3b, 0x1e, 0x20, 0xde, 0x59, 0x19, 0x43, 0x88, 0x1a, 0x8b, 0x39, 0x13, 0x60, 0x12, 0xd3, 0xb2, 0x77, 0x6d, + 0xe1, 0x99, 0x75, 0x24, 0xb4, 0x0d, 0x8c, 0xb7, 0x84, 0xf2, 0x48, 0x8f, 0xd5, 0x4c, 0xb7, 0x64, 0x44, 0xa3, 0xa8, 0x4a, 0xac, 0x2d, 0x54, + 0x15, 0x2b, 0x1f, 0xb3, 0xf4, 0x4c, 0x16, 0xa0, 0x92, 0x8e, 0xd2, 0xfa, 0xcc, 0x11, 0x6a, 0x74, 0x6a, 0x70, 0xb8, 0xd3, 0x34, 0x6b, 0x39, + 0xc6, 0x2a, 0x69, 0xde, 0x31, 0x34, 0xdf, 0xe7, 0x8b, 0x7e, 0x17, 0xa3, 0x17, 0xd9, 0x5e, 0x88, 0x39, 0x21, 0xf8, 0x7d, 0x3c, 0x29, 0x21, + 0x6c, 0x0e, 0xf1, 0xb4, 0x09, 0x54, 0xe8, 0x20, 0x34, 0x90, 0x2e, 0xb4, 0x1a, 0x95, 0x95, 0x90, 0xe5, 0xfb, 0xce, 0xfe, 0x8a, 0xbf, 0xea, + 0xaf, 0x09, 0x0c, 0x0b, 0x87, 0x22, 0xe1, 0xfe, 0x82, 0x6e, 0x91, 0xe8, 0xd1, 0xb6, 0x35, 0x03, 0x4f, 0xdb, 0xc1, 0x31, 0xe2, 0xba, 0xa0, + 0x13, 0xf6, 0xdb, 0x07, 0x9b, 0xcb, 0x99, 0xce, 0x9f, 0x49, 0xc4, 0x51, 0x8e, 0xf1, 0x04, 0x9b, 0x30, 0xc3, 0x02, 0xff, 0x7b, 0x94, 0xca, + 0x12, 0x69, 0x1e, 0xdb, 0x2d, 0x3e, 0xbd, 0x48, 0x16, 0xe1, 0x72, 0x37, 0xb8, 0x5f, 0x61, 0xfa, 0x24, 0x16, 0x3a, 0xde, 0xbf, 0x6a, 0x71, + 0x62, 0x32, 0xf3, 0xaa, 0x7f, 0x28, 0x3a, 0x0c, 0x27, 0xeb, 0xa9, 0x0a, 0x4c, 0x79, 0x88, 0x84, 0xb3, 0xe2, 0x52, 0xb9, 0x68, 0x1e, 0x82, + 0xcf, 0x67, 0x43, 0xf3, 0x68, 0xf7, 0x26, 0x19, 0xaa, 0xdd, 0x3f, 0x1e, 0xc6, 0x46, 0x11, 0x9f, 0x24, 0x23, 0xa7, 0xb0, 0x1b, 0x79, 0xa7, + 0x0c, 0x5a, 0xfe, 0x96, 0xf7, 0xe7, 0x88, 0x09, 0xa6, 0x69, 0xe3, 0x8b, 0x02, 0x03, 0x01, 0x00, 0x01}; }; -} \ No newline at end of file +} // namespace T6 diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/Matcher/ZoneDefinitionMatcherCharacter.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/Matcher/ZoneDefinitionMatcherCharacter.cpp index f3734ab60..a13827731 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/Matcher/ZoneDefinitionMatcherCharacter.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/Matcher/ZoneDefinitionMatcherCharacter.cpp @@ -8,7 +8,6 @@ ZoneDefinitionMatcherCharacter::ZoneDefinitionMatcherCharacter(const char c) MatcherResult<ZoneDefinitionParserValue> ZoneDefinitionMatcherCharacter::CanMatch(ILexer<ZoneDefinitionParserValue>* lexer, const unsigned tokenOffset) { const auto& token = lexer->GetToken(tokenOffset); - return token.m_type == ZoneDefinitionParserValueType::CHARACTER && token.CharacterValue() == m_char - ? MatcherResult<ZoneDefinitionParserValue>::Match(1) - : MatcherResult<ZoneDefinitionParserValue>::NoMatch(); + return token.m_type == ZoneDefinitionParserValueType::CHARACTER && token.CharacterValue() == m_char ? MatcherResult<ZoneDefinitionParserValue>::Match(1) + : MatcherResult<ZoneDefinitionParserValue>::NoMatch(); } diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/Matcher/ZoneDefinitionMatcherFactory.h b/src/ZoneCommon/Parsing/ZoneDefinition/Matcher/ZoneDefinitionMatcherFactory.h index 9059cb491..00903ec2e 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/Matcher/ZoneDefinitionMatcherFactory.h +++ b/src/ZoneCommon/Parsing/ZoneDefinition/Matcher/ZoneDefinitionMatcherFactory.h @@ -1,9 +1,9 @@ #pragma once -#include <string> - -#include "Parsing/ZoneDefinition/ZoneDefinitionParserValue.h" #include "Parsing/Matcher/AbstractMatcherFactory.h" +#include "Parsing/ZoneDefinition/ZoneDefinitionParserValue.h" + +#include <string> class ZoneDefinitionMatcherFactory final : public AbstractMatcherFactory<ZoneDefinitionParserValue> { diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/Matcher/ZoneDefinitionMatcherKeyword.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/Matcher/ZoneDefinitionMatcherKeyword.cpp index ae787fcaa..54769d67e 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/Matcher/ZoneDefinitionMatcherKeyword.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/Matcher/ZoneDefinitionMatcherKeyword.cpp @@ -11,6 +11,6 @@ MatcherResult<ZoneDefinitionParserValue> ZoneDefinitionMatcherKeyword::CanMatch( { const auto& token = lexer->GetToken(tokenOffset); return token.m_type == ZoneDefinitionParserValueType::FIELD && token.FieldHash() == m_hash && token.FieldValue() == m_value - ? MatcherResult<ZoneDefinitionParserValue>::Match(1) - : MatcherResult<ZoneDefinitionParserValue>::NoMatch(); + ? MatcherResult<ZoneDefinitionParserValue>::Match(1) + : MatcherResult<ZoneDefinitionParserValue>::NoMatch(); } diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/Matcher/ZoneDefinitionMatcherKeyword.h b/src/ZoneCommon/Parsing/ZoneDefinition/Matcher/ZoneDefinitionMatcherKeyword.h index a643af45e..0a8684a0a 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/Matcher/ZoneDefinitionMatcherKeyword.h +++ b/src/ZoneCommon/Parsing/ZoneDefinition/Matcher/ZoneDefinitionMatcherKeyword.h @@ -1,9 +1,9 @@ #pragma once -#include <string> - -#include "Parsing/ZoneDefinition/ZoneDefinitionParserValue.h" #include "Parsing/Matcher/AbstractMatcher.h" +#include "Parsing/ZoneDefinition/ZoneDefinitionParserValue.h" + +#include <string> class ZoneDefinitionMatcherKeyword final : public AbstractMatcher<ZoneDefinitionParserValue> { diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/Matcher/ZoneDefinitionMatcherValueType.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/Matcher/ZoneDefinitionMatcherValueType.cpp index d2fd51ab6..42ee715dc 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/Matcher/ZoneDefinitionMatcherValueType.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/Matcher/ZoneDefinitionMatcherValueType.cpp @@ -7,7 +7,6 @@ ZoneDefinitionMatcherValueType::ZoneDefinitionMatcherValueType(const ZoneDefinit MatcherResult<ZoneDefinitionParserValue> ZoneDefinitionMatcherValueType::CanMatch(ILexer<ZoneDefinitionParserValue>* lexer, const unsigned tokenOffset) { - return lexer->GetToken(tokenOffset).m_type == m_type - ? MatcherResult<ZoneDefinitionParserValue>::Match(1) - : MatcherResult<ZoneDefinitionParserValue>::NoMatch(); + return lexer->GetToken(tokenOffset).m_type == m_type ? MatcherResult<ZoneDefinitionParserValue>::Match(1) + : MatcherResult<ZoneDefinitionParserValue>::NoMatch(); } diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/Matcher/ZoneDefinitionMatcherValueType.h b/src/ZoneCommon/Parsing/ZoneDefinition/Matcher/ZoneDefinitionMatcherValueType.h index 1749a389f..0aefbc858 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/Matcher/ZoneDefinitionMatcherValueType.h +++ b/src/ZoneCommon/Parsing/ZoneDefinition/Matcher/ZoneDefinitionMatcherValueType.h @@ -1,7 +1,7 @@ #pragma once -#include "Parsing/ZoneDefinition/ZoneDefinitionParserValue.h" #include "Parsing/Matcher/AbstractMatcher.h" +#include "Parsing/ZoneDefinition/ZoneDefinitionParserValue.h" class ZoneDefinitionMatcherValueType final : public AbstractMatcher<ZoneDefinitionParserValue> { diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionAssetList.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionAssetList.cpp index 39a356251..72d1a4fbe 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionAssetList.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionAssetList.cpp @@ -6,11 +6,7 @@ SequenceZoneDefinitionAssetList::SequenceZoneDefinitionAssetList() { const ZoneDefinitionMatcherFactory create(this); - AddMatchers({ - create.Keyword("assetlist"), - create.Char(','), - create.Field().Capture(CAPTURE_ASSET_LIST_NAME) - }); + AddMatchers({create.Keyword("assetlist"), create.Char(','), create.Field().Capture(CAPTURE_ASSET_LIST_NAME)}); } void SequenceZoneDefinitionAssetList::ProcessMatch(ZoneDefinition* state, SequenceResult<ZoneDefinitionParserValue>& result) const diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionBuild.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionBuild.cpp index 1c4a1661a..423551024 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionBuild.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionBuild.cpp @@ -6,11 +6,7 @@ SequenceZoneDefinitionBuild::SequenceZoneDefinitionBuild() { const ZoneDefinitionMatcherFactory create(this); - AddMatchers({ - create.Keyword("build"), - create.Char(','), - create.Field().Capture(CAPTURE_BUILD_TARGET_NAME) - }); + AddMatchers({create.Keyword("build"), create.Char(','), create.Field().Capture(CAPTURE_BUILD_TARGET_NAME)}); } void SequenceZoneDefinitionBuild::ProcessMatch(ZoneDefinition* state, SequenceResult<ZoneDefinitionParserValue>& result) const diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionEntry.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionEntry.cpp index 1e1c402ea..db52b8b3d 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionEntry.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionEntry.cpp @@ -5,16 +5,11 @@ SequenceZoneDefinitionEntry::SequenceZoneDefinitionEntry() { const ZoneDefinitionMatcherFactory create(this); - - AddMatchers({ - create.Field().Capture(CAPTURE_TYPE_NAME), - create.Char(','), - create.Optional(create.Char(',').Tag(TAG_REFERENCE)), - create.Or({ - create.String(), - create.Field() - }).Capture(CAPTURE_ASSET_NAME) - }); + + AddMatchers({create.Field().Capture(CAPTURE_TYPE_NAME), + create.Char(','), + create.Optional(create.Char(',').Tag(TAG_REFERENCE)), + create.Or({create.String(), create.Field()}).Capture(CAPTURE_ASSET_NAME)}); } void SequenceZoneDefinitionEntry::ProcessMatch(ZoneDefinition* state, SequenceResult<ZoneDefinitionParserValue>& result) const @@ -31,8 +26,5 @@ void SequenceZoneDefinitionEntry::ProcessMatch(ZoneDefinition* state, SequenceRe assetName = assetNameCapture.FieldValue(); } - state->m_assets.emplace_back( - result.NextCapture(CAPTURE_TYPE_NAME).FieldValue(), - assetName, - result.NextTag() == TAG_REFERENCE); + state->m_assets.emplace_back(result.NextCapture(CAPTURE_TYPE_NAME).FieldValue(), assetName, result.NextTag() == TAG_REFERENCE); } diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionIgnore.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionIgnore.cpp index c08144575..1ecac14df 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionIgnore.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionIgnore.cpp @@ -6,11 +6,7 @@ SequenceZoneDefinitionIgnore::SequenceZoneDefinitionIgnore() { const ZoneDefinitionMatcherFactory create(this); - AddMatchers({ - create.Keyword("ignore"), - create.Char(','), - create.Field().Capture(CAPTURE_IGNORE_NAME) - }); + AddMatchers({create.Keyword("ignore"), create.Char(','), create.Field().Capture(CAPTURE_IGNORE_NAME)}); } void SequenceZoneDefinitionIgnore::ProcessMatch(ZoneDefinition* state, SequenceResult<ZoneDefinitionParserValue>& result) const diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionInclude.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionInclude.cpp index c76134195..1d94366d0 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionInclude.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionInclude.cpp @@ -6,11 +6,7 @@ SequenceZoneDefinitionInclude::SequenceZoneDefinitionInclude() { const ZoneDefinitionMatcherFactory create(this); - AddMatchers({ - create.Keyword("include"), - create.Char(','), - create.Field().Capture(CAPTURE_INCLUDE_NAME) - }); + AddMatchers({create.Keyword("include"), create.Char(','), create.Field().Capture(CAPTURE_INCLUDE_NAME)}); } void SequenceZoneDefinitionInclude::ProcessMatch(ZoneDefinition* state, SequenceResult<ZoneDefinitionParserValue>& result) const diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionMetaData.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionMetaData.cpp index 32a347efd..0a662cf03 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionMetaData.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionMetaData.cpp @@ -6,12 +6,7 @@ SequenceZoneDefinitionMetaData::SequenceZoneDefinitionMetaData() { const ZoneDefinitionMatcherFactory create(this); - AddMatchers({ - create.Char('>'), - create.Field().Capture(CAPTURE_KEY), - create.Char(','), - create.Field().Capture(CAPTURE_VALUE) - }); + AddMatchers({create.Char('>'), create.Field().Capture(CAPTURE_KEY), create.Char(','), create.Field().Capture(CAPTURE_VALUE)}); } void SequenceZoneDefinitionMetaData::ProcessMatch(ZoneDefinition* state, SequenceResult<ZoneDefinitionParserValue>& result) const diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionLexer.h b/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionLexer.h index 10f0ddd06..9fa3e966c 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionLexer.h +++ b/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionLexer.h @@ -1,7 +1,7 @@ #pragma once -#include "ZoneDefinitionParserValue.h" #include "Parsing/Impl/AbstractLexer.h" +#include "ZoneDefinitionParserValue.h" class ZoneDefinitionLexer final : public AbstractLexer<ZoneDefinitionParserValue> { diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionParser.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionParser.cpp index fcb7c0846..32163600d 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionParser.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionParser.cpp @@ -14,14 +14,12 @@ ZoneDefinitionParser::ZoneDefinitionParser(ZoneDefinitionLexer* lexer) const std::vector<AbstractParser<ZoneDefinitionParserValue, ZoneDefinition>::sequence_t*>& ZoneDefinitionParser::GetTestsForState() { - static std::vector<sequence_t*> tests({ - new SequenceZoneDefinitionMetaData(), - new SequenceZoneDefinitionInclude(), - new SequenceZoneDefinitionIgnore(), - new SequenceZoneDefinitionAssetList(), - new SequenceZoneDefinitionBuild(), - new SequenceZoneDefinitionEntry() - }); + static std::vector<sequence_t*> tests({new SequenceZoneDefinitionMetaData(), + new SequenceZoneDefinitionInclude(), + new SequenceZoneDefinitionIgnore(), + new SequenceZoneDefinitionAssetList(), + new SequenceZoneDefinitionBuild(), + new SequenceZoneDefinitionEntry()}); return tests; } diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionParser.h b/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionParser.h index 29a861973..b4a3099bb 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionParser.h +++ b/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionParser.h @@ -1,9 +1,9 @@ #pragma once -#include "ZoneDefinitionLexer.h" -#include "ZoneDefinitionParserValue.h" #include "Parsing/Impl/AbstractParser.h" #include "Zone/Definition/ZoneDefinition.h" +#include "ZoneDefinitionLexer.h" +#include "ZoneDefinitionParserValue.h" class ZoneDefinitionParser final : public AbstractParser<ZoneDefinitionParserValue, ZoneDefinition> { diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionParserValue.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionParserValue.cpp index ac120cc7b..75177c4db 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionParserValue.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionParserValue.cpp @@ -38,9 +38,9 @@ ZoneDefinitionParserValue ZoneDefinitionParserValue::Field(const TokenPos pos, s ZoneDefinitionParserValue::ZoneDefinitionParserValue(const TokenPos pos, const ZoneDefinitionParserValueType type) : m_pos(pos), - m_type(type), - m_hash(0), - m_value{} + m_type(type), + m_hash(0), + m_value{} { } @@ -62,9 +62,9 @@ ZoneDefinitionParserValue::~ZoneDefinitionParserValue() ZoneDefinitionParserValue::ZoneDefinitionParserValue(ZoneDefinitionParserValue&& other) noexcept : m_pos(other.m_pos), - m_type(other.m_type), - m_hash(other.m_hash), - m_value(other.m_value) + m_type(other.m_type), + m_hash(other.m_hash), + m_value(other.m_value) { other.m_value = ValueType(); } diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionParserValue.h b/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionParserValue.h index 1b57b229c..a6935a093 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionParserValue.h +++ b/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionParserValue.h @@ -1,17 +1,17 @@ #pragma once -#include <string> - #include "Parsing/IParserValue.h" -#include "Utils/ClassUtils.h" #include "Parsing/TokenPos.h" +#include "Utils/ClassUtils.h" + +#include <string> enum class ZoneDefinitionParserValueType { // Meta tokens INVALID, END_OF_FILE, - + CHARACTER, STRING, FIELD, @@ -26,6 +26,7 @@ class ZoneDefinitionParserValue final : public IParserValue TokenPos m_pos; ZoneDefinitionParserValueType m_type; size_t m_hash; + union ValueType { char char_value; diff --git a/src/ZoneCommon/Pool/AssetPool.h b/src/ZoneCommon/Pool/AssetPool.h index 86c64b3d2..a19f9026f 100644 --- a/src/ZoneCommon/Pool/AssetPool.h +++ b/src/ZoneCommon/Pool/AssetPool.h @@ -1,15 +1,14 @@ #pragma once -#include <string> -#include <map> - #include "XAssetInfo.h" #include "Zone/Zone.h" +#include <map> +#include <string> + class Zone; -template<typename T> -class AssetPool +template<typename T> class AssetPool { public: std::map<std::string, XAssetInfo<T>*> m_asset_lookup; @@ -47,13 +46,14 @@ class AssetPool virtual ~AssetPool() = default; - virtual XAssetInfo<T>* AddAsset(std::string name, T* asset, Zone* zone, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings) = 0; + virtual XAssetInfo<T>* + AddAsset(std::string name, T* asset, Zone* zone, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings) = 0; XAssetInfo<T>* GetAsset(const std::string& name) { auto foundAsset = m_asset_lookup.find(name); - if(foundAsset == m_asset_lookup.end()) + if (foundAsset == m_asset_lookup.end()) return nullptr; return foundAsset->second; @@ -68,4 +68,4 @@ class AssetPool { return Iterator(m_asset_lookup.end()); } -}; \ No newline at end of file +}; diff --git a/src/ZoneCommon/Pool/AssetPoolDynamic.h b/src/ZoneCommon/Pool/AssetPoolDynamic.h index 26d72532d..c8a642f4f 100644 --- a/src/ZoneCommon/Pool/AssetPoolDynamic.h +++ b/src/ZoneCommon/Pool/AssetPoolDynamic.h @@ -6,8 +6,7 @@ #include <cstring> -template <typename T> -class AssetPoolDynamic final : public AssetPool<T> +template<typename T> class AssetPoolDynamic final : public AssetPool<T> { using AssetPool<T>::m_asset_lookup; @@ -23,14 +22,14 @@ class AssetPoolDynamic final : public AssetPool<T> AssetPoolDynamic(AssetPoolDynamic<T>&) = delete; AssetPoolDynamic(AssetPoolDynamic<T>&&) = delete; - AssetPoolDynamic<T>& operator =(AssetPoolDynamic<T>&) = delete; - AssetPoolDynamic<T>& operator =(AssetPoolDynamic<T>&&) = default; + AssetPoolDynamic<T>& operator=(AssetPoolDynamic<T>&) = delete; + AssetPoolDynamic<T>& operator=(AssetPoolDynamic<T>&&) = default; ~AssetPoolDynamic() override { GlobalAssetPool<T>::UnlinkAssetPool(this); - for(auto* entry : m_assets) + for (auto* entry : m_assets) { delete entry->Asset(); delete entry; @@ -40,7 +39,8 @@ class AssetPoolDynamic final : public AssetPool<T> m_asset_lookup.clear(); } - XAssetInfo<T>* AddAsset(std::string name, T* asset, Zone* zone, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings) override + XAssetInfo<T>* + AddAsset(std::string name, T* asset, Zone* zone, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings) override { auto* newInfo = new XAssetInfo<T>(); newInfo->m_type = m_type; @@ -52,10 +52,10 @@ class AssetPoolDynamic final : public AssetPool<T> T* newAsset = new T(); memcpy(newAsset, asset, sizeof(T)); newInfo->m_ptr = newAsset; - + m_assets.push_back(newInfo); m_asset_lookup[newInfo->m_name] = newInfo; - + GlobalAssetPool<T>::LinkAsset(this, newInfo); return newInfo; diff --git a/src/ZoneCommon/Pool/AssetPoolStatic.h b/src/ZoneCommon/Pool/AssetPoolStatic.h index 07473b2fc..5151cfd48 100644 --- a/src/ZoneCommon/Pool/AssetPoolStatic.h +++ b/src/ZoneCommon/Pool/AssetPoolStatic.h @@ -1,14 +1,13 @@ #pragma once -#include <cstring> -#include <stdexcept> - -#include "GlobalAssetPool.h" #include "AssetPool.h" +#include "GlobalAssetPool.h" #include "XAssetInfo.h" -template <typename T> -class AssetPoolStatic final : public AssetPool<T> +#include <cstring> +#include <stdexcept> + +template<typename T> class AssetPoolStatic final : public AssetPool<T> { using AssetPool<T>::m_asset_lookup; @@ -40,7 +39,7 @@ class AssetPoolStatic final : public AssetPool<T> m_pool = new AssetPoolEntry[m_capacity]; m_info_pool = new XAssetInfo<T>[m_capacity]; - for(size_t i = 0; i < m_capacity - 1; i++) + for (size_t i = 0; i < m_capacity - 1; i++) { m_pool[i].m_info = &m_info_pool[i]; m_pool[i].m_next = &m_pool[i + 1]; @@ -49,7 +48,7 @@ class AssetPoolStatic final : public AssetPool<T> m_pool[m_capacity - 1].m_next = nullptr; m_free = m_pool; - + GlobalAssetPool<T>::LinkAssetPool(this, priority); } else @@ -62,12 +61,12 @@ class AssetPoolStatic final : public AssetPool<T> AssetPoolStatic(AssetPoolStatic<T>&) = delete; AssetPoolStatic(AssetPoolStatic<T>&&) = delete; - AssetPoolStatic<T>& operator =(AssetPoolStatic<T>&) = delete; - AssetPoolStatic<T>& operator =(AssetPoolStatic<T>&&) = default; + AssetPoolStatic<T>& operator=(AssetPoolStatic<T>&) = delete; + AssetPoolStatic<T>& operator=(AssetPoolStatic<T>&&) = default; ~AssetPoolStatic() override { - if(m_capacity > 0) + if (m_capacity > 0) { GlobalAssetPool<T>::UnlinkAssetPool(this); } @@ -82,9 +81,10 @@ class AssetPoolStatic final : public AssetPool<T> m_capacity = 0; } - XAssetInfo<T>* AddAsset(std::string name, T* asset, Zone* zone, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings) override + XAssetInfo<T>* + AddAsset(std::string name, T* asset, Zone* zone, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings) override { - if(m_free == nullptr) + if (m_free == nullptr) { throw std::runtime_error("Could not add asset to static asset pool: capacity exhausted."); } @@ -104,7 +104,7 @@ class AssetPoolStatic final : public AssetPool<T> m_asset_lookup[poolSlot->m_info->m_name] = poolSlot->m_info; GlobalAssetPool<T>::LinkAsset(this, poolSlot->m_info); - + return poolSlot->m_info; } }; diff --git a/src/ZoneCommon/Pool/GlobalAssetPool.h b/src/ZoneCommon/Pool/GlobalAssetPool.h index c185de772..66409a8ad 100644 --- a/src/ZoneCommon/Pool/GlobalAssetPool.h +++ b/src/ZoneCommon/Pool/GlobalAssetPool.h @@ -1,16 +1,15 @@ #pragma once -#include <vector> -#include <unordered_map> -#include <string> +#include "AssetPool.h" + #include <algorithm> #include <cassert> #include <memory> +#include <string> +#include <unordered_map> +#include <vector> -#include "AssetPool.h" - -template <typename T> -class GlobalAssetPool +template<typename T> class GlobalAssetPool { struct LinkedAssetPool { @@ -30,10 +29,12 @@ class GlobalAssetPool static void SortLinkedAssetPools() { - std::sort(m_linked_asset_pools.begin(), m_linked_asset_pools.end(), [](const std::unique_ptr<LinkedAssetPool>& a, const std::unique_ptr<LinkedAssetPool>& b) -> bool - { - return a->m_priority < b->m_priority; - }); + std::sort(m_linked_asset_pools.begin(), + m_linked_asset_pools.end(), + [](const std::unique_ptr<LinkedAssetPool>& a, const std::unique_ptr<LinkedAssetPool>& b) -> bool + { + return a->m_priority < b->m_priority; + }); } static bool ReplaceAssetPoolEntry(GameAssetPoolEntry& assetEntry) @@ -179,8 +180,10 @@ class GlobalAssetPool } }; -template <typename T> -std::vector<std::unique_ptr<typename GlobalAssetPool<T>::LinkedAssetPool>> GlobalAssetPool<T>::m_linked_asset_pools = std::vector<std::unique_ptr<LinkedAssetPool>>(); +template<typename T> +std::vector<std::unique_ptr<typename GlobalAssetPool<T>::LinkedAssetPool>> GlobalAssetPool<T>::m_linked_asset_pools = + std::vector<std::unique_ptr<LinkedAssetPool>>(); -template <typename T> -std::unordered_map<std::string, typename GlobalAssetPool<T>::GameAssetPoolEntry> GlobalAssetPool<T>::m_assets = std::unordered_map<std::string, GameAssetPoolEntry>(); +template<typename T> +std::unordered_map<std::string, typename GlobalAssetPool<T>::GameAssetPoolEntry> GlobalAssetPool<T>::m_assets = + std::unordered_map<std::string, GameAssetPoolEntry>(); diff --git a/src/ZoneCommon/Pool/XAssetInfo.h b/src/ZoneCommon/Pool/XAssetInfo.h index d698cb975..4b447565c 100644 --- a/src/ZoneCommon/Pool/XAssetInfo.h +++ b/src/ZoneCommon/Pool/XAssetInfo.h @@ -1,9 +1,9 @@ #pragma once -#include <vector> -#include <string> - #include "Zone/Zone.h" +#include <string> +#include <vector> + class Zone; class XAssetInfoGeneric @@ -17,8 +17,7 @@ class XAssetInfoGeneric void* m_ptr; }; -template<typename T> -class XAssetInfo : public XAssetInfoGeneric +template<typename T> class XAssetInfo : public XAssetInfoGeneric { public: T* Asset() diff --git a/src/ZoneCommon/Pool/ZoneAssetPools.cpp b/src/ZoneCommon/Pool/ZoneAssetPools.cpp index 16bf5cccb..088358af6 100644 --- a/src/ZoneCommon/Pool/ZoneAssetPools.cpp +++ b/src/ZoneCommon/Pool/ZoneAssetPools.cpp @@ -5,12 +5,18 @@ ZoneAssetPools::ZoneAssetPools(Zone* zone) { } -XAssetInfoGeneric* ZoneAssetPools::AddAsset(const asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings) +XAssetInfoGeneric* ZoneAssetPools::AddAsset( + const asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings) { return AddAsset(type, std::move(name), asset, std::move(dependencies), std::move(usedScriptStrings), m_zone); } -XAssetInfoGeneric* ZoneAssetPools::AddAsset(const asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone) +XAssetInfoGeneric* ZoneAssetPools::AddAsset(const asset_type_t type, + std::string name, + void* asset, + std::vector<XAssetInfoGeneric*> dependencies, + std::vector<scr_string_t> usedScriptStrings, + Zone* zone) { auto* assetInfo = AddAssetToPool(type, std::move(name), asset, std::move(dependencies), std::move(usedScriptStrings), zone); if (assetInfo) diff --git a/src/ZoneCommon/Pool/ZoneAssetPools.h b/src/ZoneCommon/Pool/ZoneAssetPools.h index d2c7efc4e..22ba03726 100644 --- a/src/ZoneCommon/Pool/ZoneAssetPools.h +++ b/src/ZoneCommon/Pool/ZoneAssetPools.h @@ -1,12 +1,12 @@ #pragma once -#include <vector> -#include <string> -#include <cstddef> - #include "Utils/ClassUtils.h" #include "XAssetInfo.h" -#include "Zone/ZoneTypes.h" #include "Zone/Zone.h" +#include "Zone/ZoneTypes.h" + +#include <cstddef> +#include <string> +#include <vector> class Zone; class XAssetInfoGeneric; @@ -17,7 +17,11 @@ class ZoneAssetPools Zone* m_zone; std::vector<XAssetInfoGeneric*> m_assets_in_order; - virtual XAssetInfoGeneric* AddAssetToPool(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, + virtual XAssetInfoGeneric* AddAssetToPool(asset_type_t type, + std::string name, + void* asset, + std::vector<XAssetInfoGeneric*> dependencies, + std::vector<scr_string_t> usedScriptStrings, Zone* zone) = 0; public: @@ -30,8 +34,14 @@ class ZoneAssetPools ZoneAssetPools& operator=(const ZoneAssetPools& other) = delete; ZoneAssetPools& operator=(ZoneAssetPools&& other) noexcept = default; - XAssetInfoGeneric* AddAsset(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings); - XAssetInfoGeneric* AddAsset(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone); + XAssetInfoGeneric* + AddAsset(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings); + XAssetInfoGeneric* AddAsset(asset_type_t type, + std::string name, + void* asset, + std::vector<XAssetInfoGeneric*> dependencies, + std::vector<scr_string_t> usedScriptStrings, + Zone* zone); _NODISCARD virtual XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const = 0; _NODISCARD virtual asset_type_t GetAssetTypeCount() const = 0; _NODISCARD virtual const char* GetAssetTypeName(asset_type_t assetType) const = 0; diff --git a/src/ZoneCommon/Zone/AssetList/AssetList.h b/src/ZoneCommon/Zone/AssetList/AssetList.h index 186288fd0..56178a291 100644 --- a/src/ZoneCommon/Zone/AssetList/AssetList.h +++ b/src/ZoneCommon/Zone/AssetList/AssetList.h @@ -17,4 +17,4 @@ class AssetList { public: std::vector<AssetListEntry> m_entries; -}; \ No newline at end of file +}; diff --git a/src/ZoneCommon/Zone/AssetList/AssetListStream.h b/src/ZoneCommon/Zone/AssetList/AssetListStream.h index d15807c6d..634bee973 100644 --- a/src/ZoneCommon/Zone/AssetList/AssetListStream.h +++ b/src/ZoneCommon/Zone/AssetList/AssetListStream.h @@ -1,9 +1,9 @@ #pragma once -#include <iostream> - #include "AssetList.h" #include "Csv/CsvStream.h" +#include <iostream> + class AssetListInputStream { CsvInputStream m_stream; @@ -22,4 +22,4 @@ class AssetListOutputStream explicit AssetListOutputStream(std::ostream& stream); void WriteEntry(const AssetListEntry& entry); -}; \ No newline at end of file +}; diff --git a/src/ZoneCommon/Zone/Definition/ZoneDefinition.cpp b/src/ZoneCommon/Zone/Definition/ZoneDefinition.cpp index 0c710d478..068f86f70 100644 --- a/src/ZoneCommon/Zone/Definition/ZoneDefinition.cpp +++ b/src/ZoneCommon/Zone/Definition/ZoneDefinition.cpp @@ -12,8 +12,7 @@ ZoneDefinitionEntry::ZoneDefinitionEntry(std::string type, std::string name, con { } -ZoneMetaDataEntry::ZoneMetaDataEntry() -= default; +ZoneMetaDataEntry::ZoneMetaDataEntry() = default; ZoneMetaDataEntry::ZoneMetaDataEntry(std::string key, std::string value) : m_key(std::move(key)), diff --git a/src/ZoneCommon/Zone/Definition/ZoneDefinition.h b/src/ZoneCommon/Zone/Definition/ZoneDefinition.h index 74c540121..64514cfdb 100644 --- a/src/ZoneCommon/Zone/Definition/ZoneDefinition.h +++ b/src/ZoneCommon/Zone/Definition/ZoneDefinition.h @@ -1,12 +1,12 @@ #pragma once -#include <string> +#include "Zone/AssetList/AssetList.h" + #include <memory> +#include <string> #include <unordered_map> #include <vector> -#include "Zone/AssetList/AssetList.h" - class ZoneDefinitionEntry { public: @@ -43,4 +43,4 @@ class ZoneDefinition void AddMetaData(std::string key, std::string value); void Include(const AssetList& assetListToInclude); void Include(const ZoneDefinition& definitionToInclude); -}; \ No newline at end of file +}; diff --git a/src/ZoneCommon/Zone/Definition/ZoneDefinitionStream.cpp b/src/ZoneCommon/Zone/Definition/ZoneDefinitionStream.cpp index e2a4774dc..6cc1b4952 100644 --- a/src/ZoneCommon/Zone/Definition/ZoneDefinitionStream.cpp +++ b/src/ZoneCommon/Zone/Definition/ZoneDefinitionStream.cpp @@ -1,15 +1,14 @@ #include "ZoneDefinitionStream.h" -#include <chrono> - -#include "Parsing/Impl/ParserSingleInputStream.h" -#include <Parsing/Impl/CommentRemovingStreamProxy.h> - #include "Parsing/Impl/DefinesStreamProxy.h" +#include "Parsing/Impl/ParserSingleInputStream.h" #include "Parsing/Simple/SimpleLexer.h" #include "Parsing/ZoneDefinition/ZoneDefinitionLexer.h" #include "Parsing/ZoneDefinition/ZoneDefinitionParser.h" +#include <Parsing/Impl/CommentRemovingStreamProxy.h> +#include <chrono> + ZoneDefinitionInputStream::ZoneDefinitionInputStream(std::istream& stream, std::string fileName, bool verbose) : m_file_name(std::move(fileName)), m_verbose(verbose), @@ -84,8 +83,7 @@ void ZoneDefinitionOutputStream::WriteEntry(const std::string& entryKey, const s { m_stream << entryKey << ","; - if (entryValue.find('"') != std::string::npos - || entryValue.find("//") != std::string::npos) + if (entryValue.find('"') != std::string::npos || entryValue.find("//") != std::string::npos) { m_stream << '"'; for (const auto& c : entryValue) diff --git a/src/ZoneCommon/Zone/Definition/ZoneDefinitionStream.h b/src/ZoneCommon/Zone/Definition/ZoneDefinitionStream.h index 54441a470..25723c182 100644 --- a/src/ZoneCommon/Zone/Definition/ZoneDefinitionStream.h +++ b/src/ZoneCommon/Zone/Definition/ZoneDefinitionStream.h @@ -1,10 +1,10 @@ #pragma once +#include "Parsing/IParserLineStream.h" +#include "ZoneDefinition.h" + #include <iostream> #include <memory> -#include "ZoneDefinition.h" -#include "Parsing/IParserLineStream.h" - class ZoneDefinitionInputStream { static constexpr const char* ZONE_CODE_GENERATOR_DEFINE_NAME = "__zonecodegenerator"; @@ -35,4 +35,4 @@ class ZoneDefinitionOutputStream void WriteComment(const std::string& comment) const; void WriteMetaData(const std::string& metaDataKey, const std::string& metaDataValue) const; void WriteEntry(const std::string& entryKey, const std::string& entryValue) const; -}; \ No newline at end of file +}; diff --git a/src/ZoneCommon/Zone/Stream/IZoneStream.h b/src/ZoneCommon/Zone/Stream/IZoneStream.h index cefdf8035..61a8562a3 100644 --- a/src/ZoneCommon/Zone/Stream/IZoneStream.h +++ b/src/ZoneCommon/Zone/Stream/IZoneStream.h @@ -13,4 +13,4 @@ class IZoneStream virtual void PushBlock(block_t block) = 0; virtual block_t PopBlock() = 0; -}; \ No newline at end of file +}; diff --git a/src/ZoneCommon/Zone/XBlock.cpp b/src/ZoneCommon/Zone/XBlock.cpp index cdf7c53c2..f5825865f 100644 --- a/src/ZoneCommon/Zone/XBlock.cpp +++ b/src/ZoneCommon/Zone/XBlock.cpp @@ -1,4 +1,5 @@ #include "XBlock.h" + #include <cassert> XBlock::XBlock(const std::string& name, const int index, const Type type) @@ -20,7 +21,7 @@ void XBlock::Alloc(const size_t blockSize) { delete[] m_buffer; - if(blockSize > 0) + if (blockSize > 0) { m_buffer = new uint8_t[blockSize]; m_buffer_size = blockSize; @@ -30,4 +31,4 @@ void XBlock::Alloc(const size_t blockSize) m_buffer = nullptr; m_buffer_size = 0; } -} \ No newline at end of file +} diff --git a/src/ZoneCommon/Zone/XChunk/AbstractSalsa20Processor.h b/src/ZoneCommon/Zone/XChunk/AbstractSalsa20Processor.h index 884ae18e7..c769eb196 100644 --- a/src/ZoneCommon/Zone/XChunk/AbstractSalsa20Processor.h +++ b/src/ZoneCommon/Zone/XChunk/AbstractSalsa20Processor.h @@ -1,12 +1,12 @@ #pragma once +#include "Crypto.h" +#include "Utils/ClassUtils.h" +#include "Utils/ICapturedDataProvider.h" + #include <cstdint> #include <memory> #include <string> -#include "Utils/ClassUtils.h" -#include "Crypto.h" -#include "Utils/ICapturedDataProvider.h" - class AbstractSalsa20Processor : public ICapturedDataProvider { protected: diff --git a/src/ZoneCommon/Zone/XChunk/IXChunkProcessor.h b/src/ZoneCommon/Zone/XChunk/IXChunkProcessor.h index 7eb164dec..22e444b1d 100644 --- a/src/ZoneCommon/Zone/XChunk/IXChunkProcessor.h +++ b/src/ZoneCommon/Zone/XChunk/IXChunkProcessor.h @@ -1,7 +1,7 @@ #pragma once -#include <cstdint> #include <cstddef> +#include <cstdint> class IXChunkProcessor { diff --git a/src/ZoneCommon/Zone/XChunk/XChunkException.h b/src/ZoneCommon/Zone/XChunk/XChunkException.h index 79df22136..97346d7c7 100644 --- a/src/ZoneCommon/Zone/XChunk/XChunkException.h +++ b/src/ZoneCommon/Zone/XChunk/XChunkException.h @@ -1,9 +1,9 @@ #pragma once +#include "Utils/ClassUtils.h" + #include <exception> #include <string> -#include "Utils/ClassUtils.h" - class XChunkException final : public std::exception { std::string m_message; diff --git a/src/ZoneCommon/Zone/XChunk/XChunkProcessorDeflate.cpp b/src/ZoneCommon/Zone/XChunk/XChunkProcessorDeflate.cpp index 0556ff101..594250146 100644 --- a/src/ZoneCommon/Zone/XChunk/XChunkProcessorDeflate.cpp +++ b/src/ZoneCommon/Zone/XChunk/XChunkProcessorDeflate.cpp @@ -1,19 +1,18 @@ #include "XChunkProcessorDeflate.h" +#include "XChunkException.h" #include <cassert> #include <zlib.h> #include <zutil.h> -#include "XChunkException.h" - size_t XChunkProcessorDeflate::Process(int streamNumber, const uint8_t* input, const size_t inputLength, uint8_t* output, const size_t outputBufferSize) { z_stream stream{}; stream.zalloc = Z_NULL; stream.zfree = Z_NULL; stream.opaque = Z_NULL; - + auto ret = deflateInit2(&stream, Z_BEST_COMPRESSION, Z_DEFLATED, -DEF_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); if (ret != Z_OK) throw XChunkException("Initializing deflate failed."); diff --git a/src/ZoneCommon/Zone/XChunk/XChunkProcessorInflate.cpp b/src/ZoneCommon/Zone/XChunk/XChunkProcessorInflate.cpp index 82203921d..c18e6fe92 100644 --- a/src/ZoneCommon/Zone/XChunk/XChunkProcessorInflate.cpp +++ b/src/ZoneCommon/Zone/XChunk/XChunkProcessorInflate.cpp @@ -1,10 +1,10 @@ #include "XChunkProcessorInflate.h" +#include "XChunkException.h" + #include <zlib.h> #include <zutil.h> -#include "XChunkException.h" - size_t XChunkProcessorInflate::Process(int streamNumber, const uint8_t* input, const size_t inputLength, uint8_t* output, const size_t outputBufferSize) { z_stream stream{}; diff --git a/src/ZoneCommon/Zone/XChunk/XChunkProcessorSalsa20Decryption.cpp b/src/ZoneCommon/Zone/XChunk/XChunkProcessorSalsa20Decryption.cpp index e44990687..57018c626 100644 --- a/src/ZoneCommon/Zone/XChunk/XChunkProcessorSalsa20Decryption.cpp +++ b/src/ZoneCommon/Zone/XChunk/XChunkProcessorSalsa20Decryption.cpp @@ -1,16 +1,20 @@ #include "XChunkProcessorSalsa20Decryption.h" -#include <cassert> - -#include "Crypto.h" #include "AbstractSalsa20Processor.h" +#include "Crypto.h" + +#include <cassert> -XChunkProcessorSalsa20Decryption::XChunkProcessorSalsa20Decryption(const int streamCount, std::string& zoneName, const uint8_t* salsa20Key, const size_t keySize) +XChunkProcessorSalsa20Decryption::XChunkProcessorSalsa20Decryption(const int streamCount, + std::string& zoneName, + const uint8_t* salsa20Key, + const size_t keySize) : AbstractSalsa20Processor(streamCount, zoneName, salsa20Key, keySize) { } -size_t XChunkProcessorSalsa20Decryption::Process(const int streamNumber, const uint8_t* input, const size_t inputLength, uint8_t* output, const size_t outputBufferSize) +size_t XChunkProcessorSalsa20Decryption::Process( + const int streamNumber, const uint8_t* input, const size_t inputLength, uint8_t* output, const size_t outputBufferSize) { assert(streamNumber >= 0 && streamNumber < m_stream_count); assert(input != nullptr); diff --git a/src/ZoneCommon/Zone/XChunk/XChunkProcessorSalsa20Decryption.h b/src/ZoneCommon/Zone/XChunk/XChunkProcessorSalsa20Decryption.h index 380768483..c5c57d51b 100644 --- a/src/ZoneCommon/Zone/XChunk/XChunkProcessorSalsa20Decryption.h +++ b/src/ZoneCommon/Zone/XChunk/XChunkProcessorSalsa20Decryption.h @@ -1,8 +1,8 @@ #pragma once -#include <string> - -#include "IXChunkProcessor.h" #include "AbstractSalsa20Processor.h" +#include "IXChunkProcessor.h" + +#include <string> class XChunkProcessorSalsa20Decryption final : public IXChunkProcessor, public AbstractSalsa20Processor { diff --git a/src/ZoneCommon/Zone/XChunk/XChunkProcessorSalsa20Encryption.cpp b/src/ZoneCommon/Zone/XChunk/XChunkProcessorSalsa20Encryption.cpp index b95795676..4bca33f80 100644 --- a/src/ZoneCommon/Zone/XChunk/XChunkProcessorSalsa20Encryption.cpp +++ b/src/ZoneCommon/Zone/XChunk/XChunkProcessorSalsa20Encryption.cpp @@ -2,12 +2,16 @@ #include <cassert> -XChunkProcessorSalsa20Encryption::XChunkProcessorSalsa20Encryption(const int streamCount, std::string& zoneName, const uint8_t* salsa20Key, const size_t keySize) +XChunkProcessorSalsa20Encryption::XChunkProcessorSalsa20Encryption(const int streamCount, + std::string& zoneName, + const uint8_t* salsa20Key, + const size_t keySize) : AbstractSalsa20Processor(streamCount, zoneName, salsa20Key, keySize) { } -size_t XChunkProcessorSalsa20Encryption::Process(const int streamNumber, const uint8_t* input, const size_t inputLength, uint8_t* output, const size_t outputBufferSize) +size_t XChunkProcessorSalsa20Encryption::Process( + const int streamNumber, const uint8_t* input, const size_t inputLength, uint8_t* output, const size_t outputBufferSize) { assert(streamNumber >= 0 && streamNumber < m_stream_count); assert(input != nullptr); diff --git a/src/ZoneCommon/Zone/XChunk/XChunkProcessorSalsa20Encryption.h b/src/ZoneCommon/Zone/XChunk/XChunkProcessorSalsa20Encryption.h index cc5637ed5..b1fa7206c 100644 --- a/src/ZoneCommon/Zone/XChunk/XChunkProcessorSalsa20Encryption.h +++ b/src/ZoneCommon/Zone/XChunk/XChunkProcessorSalsa20Encryption.h @@ -1,10 +1,10 @@ #pragma once -#include <string> - #include "AbstractSalsa20Processor.h" #include "IXChunkProcessor.h" +#include <string> + class XChunkProcessorSalsa20Encryption final : public IXChunkProcessor, public AbstractSalsa20Processor { public: diff --git a/src/ZoneCommon/Zone/Zone.h b/src/ZoneCommon/Zone/Zone.h index 2e4d7efdf..9f586b83b 100644 --- a/src/ZoneCommon/Zone/Zone.h +++ b/src/ZoneCommon/Zone/Zone.h @@ -1,16 +1,16 @@ #pragma once -#include <memory> -#include <string> - +#include "Game/GameLanguage.h" +#include "Game/IGame.h" +#include "Pool/ZoneAssetPools.h" #include "Utils/ClassUtils.h" #include "Zone/ZoneTypes.h" -#include "Pool/ZoneAssetPools.h" -#include "Game/IGame.h" -#include "Game/GameLanguage.h" #include "ZoneMemory.h" #include "ZoneScriptStrings.h" +#include <memory> +#include <string> + class IGame; class ZoneAssetPools; diff --git a/src/ZoneCommon/Zone/ZoneMemory.cpp b/src/ZoneCommon/Zone/ZoneMemory.cpp index 0b3745d26..72394d527 100644 --- a/src/ZoneCommon/Zone/ZoneMemory.cpp +++ b/src/ZoneCommon/Zone/ZoneMemory.cpp @@ -1,7 +1,6 @@ #include "ZoneMemory.h" -ZoneMemory::ZoneMemory() -= default; +ZoneMemory::ZoneMemory() = default; void ZoneMemory::AddBlock(std::unique_ptr<XBlock> block) { diff --git a/src/ZoneCommon/Zone/ZoneMemory.h b/src/ZoneCommon/Zone/ZoneMemory.h index d5120dee8..1344eef49 100644 --- a/src/ZoneCommon/Zone/ZoneMemory.h +++ b/src/ZoneCommon/Zone/ZoneMemory.h @@ -1,11 +1,11 @@ #pragma once -#include <memory> -#include <vector> - #include "Utils/MemoryManager.h" #include "Zone/XBlock.h" +#include <memory> +#include <vector> + class ZoneMemory : public MemoryManager { std::vector<std::unique_ptr<XBlock>> m_blocks; diff --git a/src/ZoneCommon/Zone/ZoneScriptStrings.cpp b/src/ZoneCommon/Zone/ZoneScriptStrings.cpp index d78cdf69d..7d7acc65d 100644 --- a/src/ZoneCommon/Zone/ZoneScriptStrings.cpp +++ b/src/ZoneCommon/Zone/ZoneScriptStrings.cpp @@ -1,8 +1,8 @@ #include "ZoneScriptStrings.h" #include <cassert> -#include <stdexcept> #include <sstream> +#include <stdexcept> ZoneScriptStrings::ZoneScriptStrings() : m_null_entry_pos(0) diff --git a/src/ZoneCommon/Zone/ZoneScriptStrings.h b/src/ZoneCommon/Zone/ZoneScriptStrings.h index 3ccbd3fdd..bd01235df 100644 --- a/src/ZoneCommon/Zone/ZoneScriptStrings.h +++ b/src/ZoneCommon/Zone/ZoneScriptStrings.h @@ -1,13 +1,13 @@ #pragma once +#include "Utils/ClassUtils.h" +#include "Zone/ZoneTypes.h" + #include <cstddef> #include <string> #include <unordered_map> #include <vector> -#include "Utils/ClassUtils.h" -#include "Zone/ZoneTypes.h" - class ZoneScriptStrings { int m_null_entry_pos; @@ -36,4 +36,4 @@ class ZoneScriptStrings _NODISCARD const std::string& operator[](size_t index) const; _NODISCARD std::vector<std::string>::const_iterator begin() const; _NODISCARD std::vector<std::string>::const_iterator end() const; -}; \ No newline at end of file +}; diff --git a/src/ZoneLoading/Game/IW3/ContentLoaderIW3.cpp b/src/ZoneLoading/Game/IW3/ContentLoaderIW3.cpp index 08e18ea5b..045ef2bbd 100644 --- a/src/ZoneLoading/Game/IW3/ContentLoaderIW3.cpp +++ b/src/ZoneLoading/Game/IW3/ContentLoaderIW3.cpp @@ -1,9 +1,6 @@ #include "ContentLoaderIW3.h" -#include "Game/IW3/IW3.h" -#include "Loading/Exception/UnsupportedAssetTypeException.h" - -#include <cassert> +#include "Game/IW3/IW3.h" #include "Game/IW3/XAssets/clipmap_t/clipmap_t_load_db.h" #include "Game/IW3/XAssets/comworld/comworld_load_db.h" #include "Game/IW3/XAssets/font_s/font_s_load_db.h" @@ -29,6 +26,9 @@ #include "Game/IW3/XAssets/weapondef/weapondef_load_db.h" #include "Game/IW3/XAssets/xanimparts/xanimparts_load_db.h" #include "Game/IW3/XAssets/xmodel/xmodel_load_db.h" +#include "Loading/Exception/UnsupportedAssetTypeException.h" + +#include <cassert> using namespace IW3; @@ -64,15 +64,15 @@ void ContentLoader::LoadScriptStringList(const bool atStreamStart) void ContentLoader::LoadXAsset(const bool atStreamStart) const { -#define LOAD_ASSET(type_index, typeName, headerEntry) \ - case type_index: \ - { \ - Loader_##typeName loader(m_zone, m_stream); \ - loader.Load(&varXAsset->header.headerEntry); \ - break; \ - } -#define SKIP_ASSET(type_index, typeName, headerEntry) \ - case type_index: \ +#define LOAD_ASSET(type_index, typeName, headerEntry) \ + case type_index: \ + { \ + Loader_##typeName loader(m_zone, m_stream); \ + loader.Load(&varXAsset->header.headerEntry); \ + break; \ + } +#define SKIP_ASSET(type_index, typeName, headerEntry) \ + case type_index: \ break; assert(varXAsset != nullptr); @@ -82,38 +82,38 @@ void ContentLoader::LoadXAsset(const bool atStreamStart) const switch (varXAsset->type) { - LOAD_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset) - LOAD_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts) - LOAD_ASSET(ASSET_TYPE_XMODEL, XModel, model) - LOAD_ASSET(ASSET_TYPE_MATERIAL, Material, material) - LOAD_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet) - LOAD_ASSET(ASSET_TYPE_IMAGE, GfxImage, image) - LOAD_ASSET(ASSET_TYPE_SOUND, snd_alias_list_t, sound) - LOAD_ASSET(ASSET_TYPE_SOUND_CURVE, SndCurve, sndCurve) - LOAD_ASSET(ASSET_TYPE_LOADED_SOUND, LoadedSound, loadSnd) - LOAD_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap) - LOAD_ASSET(ASSET_TYPE_CLIPMAP_PVS, clipMap_t, clipMap) - LOAD_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld) - LOAD_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp) - LOAD_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp) - LOAD_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts) - LOAD_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld) - LOAD_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef) - LOAD_ASSET(ASSET_TYPE_FONT, Font_s, font) - LOAD_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList) - LOAD_ASSET(ASSET_TYPE_MENU, menuDef_t, menu) - LOAD_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize) - LOAD_ASSET(ASSET_TYPE_WEAPON, WeaponDef, weapon) - SKIP_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals) - LOAD_ASSET(ASSET_TYPE_FX, FxEffectDef, fx) - LOAD_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx) - LOAD_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile) - LOAD_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable) + LOAD_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset) + LOAD_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts) + LOAD_ASSET(ASSET_TYPE_XMODEL, XModel, model) + LOAD_ASSET(ASSET_TYPE_MATERIAL, Material, material) + LOAD_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet) + LOAD_ASSET(ASSET_TYPE_IMAGE, GfxImage, image) + LOAD_ASSET(ASSET_TYPE_SOUND, snd_alias_list_t, sound) + LOAD_ASSET(ASSET_TYPE_SOUND_CURVE, SndCurve, sndCurve) + LOAD_ASSET(ASSET_TYPE_LOADED_SOUND, LoadedSound, loadSnd) + LOAD_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap) + LOAD_ASSET(ASSET_TYPE_CLIPMAP_PVS, clipMap_t, clipMap) + LOAD_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld) + LOAD_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp) + LOAD_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp) + LOAD_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts) + LOAD_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld) + LOAD_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef) + LOAD_ASSET(ASSET_TYPE_FONT, Font_s, font) + LOAD_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList) + LOAD_ASSET(ASSET_TYPE_MENU, menuDef_t, menu) + LOAD_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize) + LOAD_ASSET(ASSET_TYPE_WEAPON, WeaponDef, weapon) + SKIP_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals) + LOAD_ASSET(ASSET_TYPE_FX, FxEffectDef, fx) + LOAD_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx) + LOAD_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile) + LOAD_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable) default: - { - throw UnsupportedAssetTypeException(varXAsset->type); - } + { + throw UnsupportedAssetTypeException(varXAsset->type); + } } #undef LOAD_ASSET diff --git a/src/ZoneLoading/Game/IW3/ContentLoaderIW3.h b/src/ZoneLoading/Game/IW3/ContentLoaderIW3.h index 1790a1fce..1d0c0d306 100644 --- a/src/ZoneLoading/Game/IW3/ContentLoaderIW3.h +++ b/src/ZoneLoading/Game/IW3/ContentLoaderIW3.h @@ -1,7 +1,7 @@ #pragma once +#include "Game/IW3/IW3.h" #include "Loading/ContentLoaderBase.h" #include "Loading/IContentLoadingEntryPoint.h" -#include "Game/IW3/IW3.h" namespace IW3 { @@ -20,4 +20,4 @@ namespace IW3 void Load(Zone* zone, IZoneInputStream* stream) override; }; -} +} // namespace IW3 diff --git a/src/ZoneLoading/Game/IW3/XAssets/gfximage/gfximage_actions.h b/src/ZoneLoading/Game/IW3/XAssets/gfximage/gfximage_actions.h index 440bf9a41..fc2c96174 100644 --- a/src/ZoneLoading/Game/IW3/XAssets/gfximage/gfximage_actions.h +++ b/src/ZoneLoading/Game/IW3/XAssets/gfximage/gfximage_actions.h @@ -1,7 +1,7 @@ #pragma once -#include "Loading/AssetLoadingActions.h" #include "Game/IW3/IW3.h" +#include "Loading/AssetLoadingActions.h" namespace IW3 { @@ -13,4 +13,4 @@ namespace IW3 void OnImageLoaded(GfxImage* image) const; void LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image) const; }; -} +} // namespace IW3 diff --git a/src/ZoneLoading/Game/IW3/XAssets/loadedsound/loadedsound_actions.h b/src/ZoneLoading/Game/IW3/XAssets/loadedsound/loadedsound_actions.h index cb0b1332a..6df942e70 100644 --- a/src/ZoneLoading/Game/IW3/XAssets/loadedsound/loadedsound_actions.h +++ b/src/ZoneLoading/Game/IW3/XAssets/loadedsound/loadedsound_actions.h @@ -1,7 +1,7 @@ #pragma once -#include "Loading/AssetLoadingActions.h" #include "Game/IW3/IW3.h" +#include "Loading/AssetLoadingActions.h" namespace IW3 { @@ -12,4 +12,4 @@ namespace IW3 void SetSoundData(MssSound* sound) const; }; -} +} // namespace IW3 diff --git a/src/ZoneLoading/Game/IW3/ZoneLoaderFactoryIW3.cpp b/src/ZoneLoading/Game/IW3/ZoneLoaderFactoryIW3.cpp index 77c59f534..1c5d6ff10 100644 --- a/src/ZoneLoading/Game/IW3/ZoneLoaderFactoryIW3.cpp +++ b/src/ZoneLoading/Game/IW3/ZoneLoaderFactoryIW3.cpp @@ -1,22 +1,21 @@ #include "ZoneLoaderFactoryIW3.h" -#include <cassert> -#include <cstring> -#include <type_traits> - -#include "Game/IW3/IW3.h" - -#include "Utils/ClassUtils.h" #include "ContentLoaderIW3.h" +#include "Game/GameLanguage.h" #include "Game/IW3/GameAssetPoolIW3.h" #include "Game/IW3/GameIW3.h" -#include "Game/GameLanguage.h" +#include "Game/IW3/IW3.h" #include "Game/IW3/ZoneConstantsIW3.h" #include "Loading/Processor/ProcessorInflate.h" -#include "Loading/Steps/StepSkipBytes.h" #include "Loading/Steps/StepAddProcessor.h" #include "Loading/Steps/StepAllocXBlocks.h" #include "Loading/Steps/StepLoadZoneContent.h" +#include "Loading/Steps/StepSkipBytes.h" +#include "Utils/ClassUtils.h" + +#include <cassert> +#include <cstring> +#include <type_traits> using namespace IW3; @@ -93,7 +92,8 @@ class ZoneLoaderFactory::Impl zoneLoader->AddLoadingStep(std::make_unique<StepAllocXBlocks>()); // Start of the zone content - zoneLoader->AddLoadingStep(std::make_unique<StepLoadZoneContent>(std::make_unique<ContentLoader>(), zonePtr, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK)); + zoneLoader->AddLoadingStep(std::make_unique<StepLoadZoneContent>( + std::make_unique<ContentLoader>(), zonePtr, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK)); // Return the fully setup zoneloader return zoneLoader; diff --git a/src/ZoneLoading/Game/IW3/ZoneLoaderFactoryIW3.h b/src/ZoneLoading/Game/IW3/ZoneLoaderFactoryIW3.h index 65362e053..cbe67a652 100644 --- a/src/ZoneLoading/Game/IW3/ZoneLoaderFactoryIW3.h +++ b/src/ZoneLoading/Game/IW3/ZoneLoaderFactoryIW3.h @@ -1,6 +1,7 @@ #pragma once #include "Loading/IZoneLoaderFactory.h" + #include <string> namespace IW3 @@ -12,4 +13,4 @@ namespace IW3 public: ZoneLoader* CreateLoaderForHeader(ZoneHeader& header, std::string& fileName) override; }; -} +} // namespace IW3 diff --git a/src/ZoneLoading/Game/IW4/ContentLoaderIW4.cpp b/src/ZoneLoading/Game/IW4/ContentLoaderIW4.cpp index 9c265686e..209edc7e5 100644 --- a/src/ZoneLoading/Game/IW4/ContentLoaderIW4.cpp +++ b/src/ZoneLoading/Game/IW4/ContentLoaderIW4.cpp @@ -1,9 +1,6 @@ #include "ContentLoaderIW4.h" -#include "Game/IW4/IW4.h" -#include "Loading/Exception/UnsupportedAssetTypeException.h" - -#include <cassert> +#include "Game/IW4/IW4.h" #include "Game/IW4/XAssets/addonmapents/addonmapents_load_db.h" #include "Game/IW4/XAssets/clipmap_t/clipmap_t_load_db.h" #include "Game/IW4/XAssets/comworld/comworld_load_db.h" @@ -39,6 +36,9 @@ #include "Game/IW4/XAssets/weaponcompletedef/weaponcompletedef_load_db.h" #include "Game/IW4/XAssets/xanimparts/xanimparts_load_db.h" #include "Game/IW4/XAssets/xmodel/xmodel_load_db.h" +#include "Loading/Exception/UnsupportedAssetTypeException.h" + +#include <cassert> using namespace IW4; @@ -74,15 +74,15 @@ void ContentLoader::LoadScriptStringList(const bool atStreamStart) void ContentLoader::LoadXAsset(const bool atStreamStart) const { -#define LOAD_ASSET(type_index, typeName, headerEntry) \ - case type_index: \ - { \ - Loader_##typeName loader(m_zone, m_stream); \ - loader.Load(&varXAsset->header.headerEntry); \ - break; \ - } -#define SKIP_ASSET(type_index, typeName, headerEntry) \ - case type_index: \ +#define LOAD_ASSET(type_index, typeName, headerEntry) \ + case type_index: \ + { \ + Loader_##typeName loader(m_zone, m_stream); \ + loader.Load(&varXAsset->header.headerEntry); \ + break; \ + } +#define SKIP_ASSET(type_index, typeName, headerEntry) \ + case type_index: \ break; assert(varXAsset != nullptr); @@ -92,48 +92,48 @@ void ContentLoader::LoadXAsset(const bool atStreamStart) const switch (varXAsset->type) { - LOAD_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset) - LOAD_ASSET(ASSET_TYPE_PHYSCOLLMAP, PhysCollmap, physCollmap) - LOAD_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts) - LOAD_ASSET(ASSET_TYPE_XMODEL, XModel, model) - LOAD_ASSET(ASSET_TYPE_MATERIAL, Material, material) - LOAD_ASSET(ASSET_TYPE_PIXELSHADER, MaterialPixelShader, pixelShader) - LOAD_ASSET(ASSET_TYPE_VERTEXSHADER, MaterialVertexShader, vertexShader) - LOAD_ASSET(ASSET_TYPE_VERTEXDECL, MaterialVertexDeclaration, vertexDecl) - LOAD_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet) - LOAD_ASSET(ASSET_TYPE_IMAGE, GfxImage, image) - LOAD_ASSET(ASSET_TYPE_SOUND, snd_alias_list_t, sound) - LOAD_ASSET(ASSET_TYPE_SOUND_CURVE, SndCurve, sndCurve) - LOAD_ASSET(ASSET_TYPE_LOADED_SOUND, LoadedSound, loadSnd) - LOAD_ASSET(ASSET_TYPE_CLIPMAP_SP, clipMap_t, clipMap) - LOAD_ASSET(ASSET_TYPE_CLIPMAP_MP, clipMap_t, clipMap) - LOAD_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld) - LOAD_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp) - LOAD_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp) - LOAD_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts) - LOAD_ASSET(ASSET_TYPE_FXWORLD, FxWorld, fxWorld) - LOAD_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld) - LOAD_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef) - LOAD_ASSET(ASSET_TYPE_FONT, Font_s, font) - LOAD_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList) - LOAD_ASSET(ASSET_TYPE_MENU, menuDef_t, menu) - LOAD_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize) - LOAD_ASSET(ASSET_TYPE_WEAPON, WeaponCompleteDef, weapon) - SKIP_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals) - LOAD_ASSET(ASSET_TYPE_FX, FxEffectDef, fx) - LOAD_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx) - LOAD_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile) - LOAD_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable) - LOAD_ASSET(ASSET_TYPE_LEADERBOARD, LeaderboardDef, leaderboardDef) - LOAD_ASSET(ASSET_TYPE_STRUCTURED_DATA_DEF, StructuredDataDefSet, structuredDataDefSet) - LOAD_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef) - LOAD_ASSET(ASSET_TYPE_VEHICLE, VehicleDef, vehDef) - LOAD_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts) + LOAD_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset) + LOAD_ASSET(ASSET_TYPE_PHYSCOLLMAP, PhysCollmap, physCollmap) + LOAD_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts) + LOAD_ASSET(ASSET_TYPE_XMODEL, XModel, model) + LOAD_ASSET(ASSET_TYPE_MATERIAL, Material, material) + LOAD_ASSET(ASSET_TYPE_PIXELSHADER, MaterialPixelShader, pixelShader) + LOAD_ASSET(ASSET_TYPE_VERTEXSHADER, MaterialVertexShader, vertexShader) + LOAD_ASSET(ASSET_TYPE_VERTEXDECL, MaterialVertexDeclaration, vertexDecl) + LOAD_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet) + LOAD_ASSET(ASSET_TYPE_IMAGE, GfxImage, image) + LOAD_ASSET(ASSET_TYPE_SOUND, snd_alias_list_t, sound) + LOAD_ASSET(ASSET_TYPE_SOUND_CURVE, SndCurve, sndCurve) + LOAD_ASSET(ASSET_TYPE_LOADED_SOUND, LoadedSound, loadSnd) + LOAD_ASSET(ASSET_TYPE_CLIPMAP_SP, clipMap_t, clipMap) + LOAD_ASSET(ASSET_TYPE_CLIPMAP_MP, clipMap_t, clipMap) + LOAD_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld) + LOAD_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp) + LOAD_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp) + LOAD_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts) + LOAD_ASSET(ASSET_TYPE_FXWORLD, FxWorld, fxWorld) + LOAD_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld) + LOAD_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef) + LOAD_ASSET(ASSET_TYPE_FONT, Font_s, font) + LOAD_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList) + LOAD_ASSET(ASSET_TYPE_MENU, menuDef_t, menu) + LOAD_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize) + LOAD_ASSET(ASSET_TYPE_WEAPON, WeaponCompleteDef, weapon) + SKIP_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals) + LOAD_ASSET(ASSET_TYPE_FX, FxEffectDef, fx) + LOAD_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx) + LOAD_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile) + LOAD_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable) + LOAD_ASSET(ASSET_TYPE_LEADERBOARD, LeaderboardDef, leaderboardDef) + LOAD_ASSET(ASSET_TYPE_STRUCTURED_DATA_DEF, StructuredDataDefSet, structuredDataDefSet) + LOAD_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef) + LOAD_ASSET(ASSET_TYPE_VEHICLE, VehicleDef, vehDef) + LOAD_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts) default: - { - throw UnsupportedAssetTypeException(varXAsset->type); - } + { + throw UnsupportedAssetTypeException(varXAsset->type); + } } #undef LOAD_ASSET diff --git a/src/ZoneLoading/Game/IW4/ContentLoaderIW4.h b/src/ZoneLoading/Game/IW4/ContentLoaderIW4.h index da132e4f0..4ba9f1b86 100644 --- a/src/ZoneLoading/Game/IW4/ContentLoaderIW4.h +++ b/src/ZoneLoading/Game/IW4/ContentLoaderIW4.h @@ -1,7 +1,7 @@ #pragma once +#include "Game/IW4/IW4.h" #include "Loading/ContentLoaderBase.h" #include "Loading/IContentLoadingEntryPoint.h" -#include "Game/IW4/IW4.h" namespace IW4 { @@ -20,4 +20,4 @@ namespace IW4 void Load(Zone* zone, IZoneInputStream* stream) override; }; -} +} // namespace IW4 diff --git a/src/ZoneLoading/Game/IW4/XAssets/gfximage/gfximage_actions.h b/src/ZoneLoading/Game/IW4/XAssets/gfximage/gfximage_actions.h index ed2e12adc..5dc03af63 100644 --- a/src/ZoneLoading/Game/IW4/XAssets/gfximage/gfximage_actions.h +++ b/src/ZoneLoading/Game/IW4/XAssets/gfximage/gfximage_actions.h @@ -1,7 +1,7 @@ #pragma once -#include "Loading/AssetLoadingActions.h" #include "Game/IW4/IW4.h" +#include "Loading/AssetLoadingActions.h" namespace IW4 { @@ -13,4 +13,4 @@ namespace IW4 void OnImageLoaded(GfxImage* image) const; void LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image) const; }; -} +} // namespace IW4 diff --git a/src/ZoneLoading/Game/IW4/XAssets/loadedsound/loadedsound_actions.h b/src/ZoneLoading/Game/IW4/XAssets/loadedsound/loadedsound_actions.h index bf0f16de1..7b04a24a0 100644 --- a/src/ZoneLoading/Game/IW4/XAssets/loadedsound/loadedsound_actions.h +++ b/src/ZoneLoading/Game/IW4/XAssets/loadedsound/loadedsound_actions.h @@ -1,7 +1,7 @@ #pragma once -#include "Loading/AssetLoadingActions.h" #include "Game/IW4/IW4.h" +#include "Loading/AssetLoadingActions.h" namespace IW4 { @@ -12,4 +12,4 @@ namespace IW4 void SetSoundData(MssSound* sound) const; }; -} +} // namespace IW4 diff --git a/src/ZoneLoading/Game/IW4/XAssets/xmodel/xmodel_actions.cpp b/src/ZoneLoading/Game/IW4/XAssets/xmodel/xmodel_actions.cpp index 39152ed45..9c122db89 100644 --- a/src/ZoneLoading/Game/IW4/XAssets/xmodel/xmodel_actions.cpp +++ b/src/ZoneLoading/Game/IW4/XAssets/xmodel/xmodel_actions.cpp @@ -11,7 +11,7 @@ Actions_XModel::Actions_XModel(Zone* zone) void Actions_XModel::SetModelSurfs(XModelLodInfo* lodInfo, XModelSurfs* modelSurfs) const { - if(modelSurfs) + if (modelSurfs) { lodInfo->modelSurfs = m_zone->GetMemory()->Create<XModelSurfs>(); memcpy(lodInfo->modelSurfs, modelSurfs, sizeof(XModelSurfs)); diff --git a/src/ZoneLoading/Game/IW4/XAssets/xmodel/xmodel_actions.h b/src/ZoneLoading/Game/IW4/XAssets/xmodel/xmodel_actions.h index e19dbc0af..8f98d3773 100644 --- a/src/ZoneLoading/Game/IW4/XAssets/xmodel/xmodel_actions.h +++ b/src/ZoneLoading/Game/IW4/XAssets/xmodel/xmodel_actions.h @@ -1,7 +1,7 @@ #pragma once -#include "Loading/AssetLoadingActions.h" #include "Game/IW4/IW4.h" +#include "Loading/AssetLoadingActions.h" namespace IW4 { @@ -12,4 +12,4 @@ namespace IW4 void SetModelSurfs(XModelLodInfo* lodInfo, XModelSurfs* modelSurfs) const; }; -} +} // namespace IW4 diff --git a/src/ZoneLoading/Game/IW4/ZoneLoaderFactoryIW4.cpp b/src/ZoneLoading/Game/IW4/ZoneLoaderFactoryIW4.cpp index c1e46935d..6e5e8856e 100644 --- a/src/ZoneLoading/Game/IW4/ZoneLoaderFactoryIW4.cpp +++ b/src/ZoneLoading/Game/IW4/ZoneLoaderFactoryIW4.cpp @@ -1,32 +1,31 @@ #include "ZoneLoaderFactoryIW4.h" -#include <cassert> -#include <cstring> -#include <type_traits> - -#include "Game/IW4/IW4.h" - -#include "Utils/ClassUtils.h" #include "ContentLoaderIW4.h" +#include "Game/GameLanguage.h" #include "Game/IW4/GameAssetPoolIW4.h" #include "Game/IW4/GameIW4.h" -#include "Game/GameLanguage.h" +#include "Game/IW4/IW4.h" #include "Game/IW4/ZoneConstantsIW4.h" #include "Loading/Processor/ProcessorAuthedBlocks.h" #include "Loading/Processor/ProcessorCaptureData.h" -#include "Loading/Processor/ProcessorInflate.h" #include "Loading/Processor/ProcessorIW4xDecryption.h" -#include "Loading/Steps/StepVerifyMagic.h" -#include "Loading/Steps/StepSkipBytes.h" -#include "Loading/Steps/StepVerifyFileName.h" -#include "Loading/Steps/StepLoadSignature.h" -#include "Loading/Steps/StepVerifySignature.h" +#include "Loading/Processor/ProcessorInflate.h" #include "Loading/Steps/StepAddProcessor.h" #include "Loading/Steps/StepAllocXBlocks.h" -#include "Loading/Steps/StepLoadZoneContent.h" #include "Loading/Steps/StepLoadHash.h" +#include "Loading/Steps/StepLoadSignature.h" +#include "Loading/Steps/StepLoadZoneContent.h" #include "Loading/Steps/StepRemoveProcessor.h" +#include "Loading/Steps/StepSkipBytes.h" +#include "Loading/Steps/StepVerifyFileName.h" #include "Loading/Steps/StepVerifyHash.h" +#include "Loading/Steps/StepVerifyMagic.h" +#include "Loading/Steps/StepVerifySignature.h" +#include "Utils/ClassUtils.h" + +#include <cassert> +#include <cstring> +#include <type_traits> using namespace IW4; @@ -50,7 +49,7 @@ class ZoneLoaderFactory::Impl if (!memcmp(header.m_magic, ZoneConstants::MAGIC_IW4X, std::char_traits<char>::length(ZoneConstants::MAGIC_IW4X))) { - if(*reinterpret_cast<uint32_t*>(&header.m_magic[std::char_traits<char>::length(ZoneConstants::MAGIC_IW4X)]) == ZoneConstants::IW4X_ZONE_VERSION) + if (*reinterpret_cast<uint32_t*>(&header.m_magic[std::char_traits<char>::length(ZoneConstants::MAGIC_IW4X)]) == ZoneConstants::IW4X_ZONE_VERSION) { *isSecure = false; *isOfficial = false; @@ -100,8 +99,7 @@ class ZoneLoaderFactory::Impl { if (isOfficial) { - auto rsa = Crypto::CreateRSA(IPublicKeyAlgorithm::HashingAlgorithm::RSA_HASH_SHA256, - Crypto::RSAPaddingMode::RSA_PADDING_PSS); + auto rsa = Crypto::CreateRSA(IPublicKeyAlgorithm::HashingAlgorithm::RSA_HASH_SHA256, Crypto::RSAPaddingMode::RSA_PADDING_PSS); if (!rsa->SetKey(ZoneConstants::RSA_PUBLIC_KEY_INFINITY_WARD, sizeof(ZoneConstants::RSA_PUBLIC_KEY_INFINITY_WARD))) { @@ -120,8 +118,7 @@ class ZoneLoaderFactory::Impl } } - static void AddAuthHeaderSteps(const bool isSecure, const bool isOfficial, ZoneLoader* zoneLoader, - std::string& fileName) + static void AddAuthHeaderSteps(const bool isSecure, const bool isOfficial, ZoneLoader* zoneLoader, std::string& fileName) { // Unsigned zones do not have an auth header if (!isSecure) @@ -154,15 +151,19 @@ class ZoneLoaderFactory::Impl auto* masterBlockHashesPtr = masterBlockHashes.get(); zoneLoader->AddLoadingStep(std::move(masterBlockHashes)); - zoneLoader->AddLoadingStep(std::make_unique<StepVerifyHash>(std::unique_ptr<IHashFunction>(Crypto::CreateSHA256()), 0, subHeaderHashPtr, subHeaderCapturePtr)); + zoneLoader->AddLoadingStep( + std::make_unique<StepVerifyHash>(std::unique_ptr<IHashFunction>(Crypto::CreateSHA256()), 0, subHeaderHashPtr, subHeaderCapturePtr)); zoneLoader->AddLoadingStep(std::make_unique<StepRemoveProcessor>(subHeaderCapturePtr)); // Skip the rest of the first chunk zoneLoader->AddLoadingStep(std::make_unique<StepSkipBytes>(ZoneConstants::AUTHED_CHUNK_SIZE - sizeof(DB_AuthHeader))); - zoneLoader->AddLoadingStep(std::make_unique<StepAddProcessor>(std::make_unique<ProcessorAuthedBlocks>( - ZoneConstants::AUTHED_CHUNK_COUNT_PER_GROUP, ZoneConstants::AUTHED_CHUNK_SIZE, std::extent<decltype(DB_AuthSubHeader::masterBlockHashes)>::value, - std::unique_ptr<IHashFunction>(Crypto::CreateSHA256()), masterBlockHashesPtr))); + zoneLoader->AddLoadingStep( + std::make_unique<StepAddProcessor>(std::make_unique<ProcessorAuthedBlocks>(ZoneConstants::AUTHED_CHUNK_COUNT_PER_GROUP, + ZoneConstants::AUTHED_CHUNK_SIZE, + std::extent<decltype(DB_AuthSubHeader::masterBlockHashes)>::value, + std::unique_ptr<IHashFunction>(Crypto::CreateSHA256()), + masterBlockHashesPtr))); } public: @@ -210,7 +211,8 @@ class ZoneLoaderFactory::Impl zoneLoader->AddLoadingStep(std::make_unique<StepAllocXBlocks>()); // Start of the zone content - zoneLoader->AddLoadingStep(std::make_unique<StepLoadZoneContent>(std::make_unique<ContentLoader>(), zonePtr, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK)); + zoneLoader->AddLoadingStep(std::make_unique<StepLoadZoneContent>( + std::make_unique<ContentLoader>(), zonePtr, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK)); // Return the fully setup zoneloader return zoneLoader; diff --git a/src/ZoneLoading/Game/IW4/ZoneLoaderFactoryIW4.h b/src/ZoneLoading/Game/IW4/ZoneLoaderFactoryIW4.h index 636fd84ac..ce31128c4 100644 --- a/src/ZoneLoading/Game/IW4/ZoneLoaderFactoryIW4.h +++ b/src/ZoneLoading/Game/IW4/ZoneLoaderFactoryIW4.h @@ -1,6 +1,7 @@ #pragma once #include "Loading/IZoneLoaderFactory.h" + #include <string> namespace IW4 @@ -12,4 +13,4 @@ namespace IW4 public: ZoneLoader* CreateLoaderForHeader(ZoneHeader& header, std::string& fileName) override; }; -} +} // namespace IW4 diff --git a/src/ZoneLoading/Game/IW5/ContentLoaderIW5.cpp b/src/ZoneLoading/Game/IW5/ContentLoaderIW5.cpp index 3f63d81bf..7eca7251d 100644 --- a/src/ZoneLoading/Game/IW5/ContentLoaderIW5.cpp +++ b/src/ZoneLoading/Game/IW5/ContentLoaderIW5.cpp @@ -1,9 +1,6 @@ #include "ContentLoaderIW5.h" -#include "Game/IW5/IW5.h" -#include "Loading/Exception/UnsupportedAssetTypeException.h" - -#include <cassert> +#include "Game/IW5/IW5.h" #include "Game/IW5/XAssets/addonmapents/addonmapents_load_db.h" #include "Game/IW5/XAssets/clipmap_t/clipmap_t_load_db.h" #include "Game/IW5/XAssets/comworld/comworld_load_db.h" @@ -44,6 +41,9 @@ #include "Game/IW5/XAssets/xanimparts/xanimparts_load_db.h" #include "Game/IW5/XAssets/xmodel/xmodel_load_db.h" #include "Game/IW5/XAssets/xmodelsurfs/xmodelsurfs_load_db.h" +#include "Loading/Exception/UnsupportedAssetTypeException.h" + +#include <cassert> using namespace IW5; @@ -79,15 +79,15 @@ void ContentLoader::LoadScriptStringList(const bool atStreamStart) void ContentLoader::LoadXAsset(const bool atStreamStart) const { -#define LOAD_ASSET(type_index, typeName, headerEntry) \ - case type_index: \ - { \ - Loader_##typeName loader(m_zone, m_stream); \ - loader.Load(&varXAsset->header.headerEntry); \ - break; \ - } -#define SKIP_ASSET(type_index) \ - case type_index: \ +#define LOAD_ASSET(type_index, typeName, headerEntry) \ + case type_index: \ + { \ + Loader_##typeName loader(m_zone, m_stream); \ + loader.Load(&varXAsset->header.headerEntry); \ + break; \ + } +#define SKIP_ASSET(type_index) \ + case type_index: \ break; assert(varXAsset != nullptr); @@ -97,52 +97,52 @@ void ContentLoader::LoadXAsset(const bool atStreamStart) const switch (varXAsset->type) { - LOAD_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset) - LOAD_ASSET(ASSET_TYPE_PHYSCOLLMAP, PhysCollmap, physCollmap) - LOAD_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts) - LOAD_ASSET(ASSET_TYPE_XMODEL_SURFS, XModelSurfs, modelSurfs) - LOAD_ASSET(ASSET_TYPE_XMODEL, XModel, model) - LOAD_ASSET(ASSET_TYPE_MATERIAL, Material, material) - LOAD_ASSET(ASSET_TYPE_PIXELSHADER, MaterialPixelShader, pixelShader) - LOAD_ASSET(ASSET_TYPE_VERTEXSHADER, MaterialVertexShader, vertexShader) - LOAD_ASSET(ASSET_TYPE_VERTEXDECL, MaterialVertexDeclaration, vertexDecl) - LOAD_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet) - LOAD_ASSET(ASSET_TYPE_IMAGE, GfxImage, image) - LOAD_ASSET(ASSET_TYPE_SOUND, snd_alias_list_t, sound) - LOAD_ASSET(ASSET_TYPE_SOUND_CURVE, SndCurve, sndCurve) - LOAD_ASSET(ASSET_TYPE_LOADED_SOUND, LoadedSound, loadSnd) - LOAD_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap) - LOAD_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld) - LOAD_ASSET(ASSET_TYPE_GLASSWORLD, GlassWorld, glassWorld) - LOAD_ASSET(ASSET_TYPE_PATHDATA, PathData, pathData) - LOAD_ASSET(ASSET_TYPE_VEHICLE_TRACK, VehicleTrack, vehicleTrack) - LOAD_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts) - LOAD_ASSET(ASSET_TYPE_FXWORLD, FxWorld, fxWorld) - LOAD_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld) - LOAD_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef) - LOAD_ASSET(ASSET_TYPE_FONT, Font_s, font) - LOAD_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList) - LOAD_ASSET(ASSET_TYPE_MENU, menuDef_t, menu) - LOAD_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize) - LOAD_ASSET(ASSET_TYPE_ATTACHMENT, WeaponAttachment, attachment) - LOAD_ASSET(ASSET_TYPE_WEAPON, WeaponCompleteDef, weapon) - SKIP_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS) - LOAD_ASSET(ASSET_TYPE_FX, FxEffectDef, fx) - LOAD_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx) - LOAD_ASSET(ASSET_TYPE_SURFACE_FX, SurfaceFxTable, surfaceFx) - LOAD_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile) - LOAD_ASSET(ASSET_TYPE_SCRIPTFILE, ScriptFile, scriptfile) - LOAD_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable) - LOAD_ASSET(ASSET_TYPE_LEADERBOARD, LeaderboardDef, leaderboardDef) - LOAD_ASSET(ASSET_TYPE_STRUCTURED_DATA_DEF, StructuredDataDefSet, structuredDataDefSet) - LOAD_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef) - LOAD_ASSET(ASSET_TYPE_VEHICLE, VehicleDef, vehDef) - LOAD_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts) + LOAD_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset) + LOAD_ASSET(ASSET_TYPE_PHYSCOLLMAP, PhysCollmap, physCollmap) + LOAD_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts) + LOAD_ASSET(ASSET_TYPE_XMODEL_SURFS, XModelSurfs, modelSurfs) + LOAD_ASSET(ASSET_TYPE_XMODEL, XModel, model) + LOAD_ASSET(ASSET_TYPE_MATERIAL, Material, material) + LOAD_ASSET(ASSET_TYPE_PIXELSHADER, MaterialPixelShader, pixelShader) + LOAD_ASSET(ASSET_TYPE_VERTEXSHADER, MaterialVertexShader, vertexShader) + LOAD_ASSET(ASSET_TYPE_VERTEXDECL, MaterialVertexDeclaration, vertexDecl) + LOAD_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet) + LOAD_ASSET(ASSET_TYPE_IMAGE, GfxImage, image) + LOAD_ASSET(ASSET_TYPE_SOUND, snd_alias_list_t, sound) + LOAD_ASSET(ASSET_TYPE_SOUND_CURVE, SndCurve, sndCurve) + LOAD_ASSET(ASSET_TYPE_LOADED_SOUND, LoadedSound, loadSnd) + LOAD_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap) + LOAD_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld) + LOAD_ASSET(ASSET_TYPE_GLASSWORLD, GlassWorld, glassWorld) + LOAD_ASSET(ASSET_TYPE_PATHDATA, PathData, pathData) + LOAD_ASSET(ASSET_TYPE_VEHICLE_TRACK, VehicleTrack, vehicleTrack) + LOAD_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts) + LOAD_ASSET(ASSET_TYPE_FXWORLD, FxWorld, fxWorld) + LOAD_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld) + LOAD_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef) + LOAD_ASSET(ASSET_TYPE_FONT, Font_s, font) + LOAD_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList) + LOAD_ASSET(ASSET_TYPE_MENU, menuDef_t, menu) + LOAD_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize) + LOAD_ASSET(ASSET_TYPE_ATTACHMENT, WeaponAttachment, attachment) + LOAD_ASSET(ASSET_TYPE_WEAPON, WeaponCompleteDef, weapon) + SKIP_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS) + LOAD_ASSET(ASSET_TYPE_FX, FxEffectDef, fx) + LOAD_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx) + LOAD_ASSET(ASSET_TYPE_SURFACE_FX, SurfaceFxTable, surfaceFx) + LOAD_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile) + LOAD_ASSET(ASSET_TYPE_SCRIPTFILE, ScriptFile, scriptfile) + LOAD_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable) + LOAD_ASSET(ASSET_TYPE_LEADERBOARD, LeaderboardDef, leaderboardDef) + LOAD_ASSET(ASSET_TYPE_STRUCTURED_DATA_DEF, StructuredDataDefSet, structuredDataDefSet) + LOAD_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef) + LOAD_ASSET(ASSET_TYPE_VEHICLE, VehicleDef, vehDef) + LOAD_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts) default: - { - throw UnsupportedAssetTypeException(varXAsset->type); - } + { + throw UnsupportedAssetTypeException(varXAsset->type); + } } #undef LOAD_ASSET diff --git a/src/ZoneLoading/Game/IW5/ContentLoaderIW5.h b/src/ZoneLoading/Game/IW5/ContentLoaderIW5.h index 79a0813c8..115f2c910 100644 --- a/src/ZoneLoading/Game/IW5/ContentLoaderIW5.h +++ b/src/ZoneLoading/Game/IW5/ContentLoaderIW5.h @@ -1,7 +1,7 @@ #pragma once +#include "Game/IW5/IW5.h" #include "Loading/ContentLoaderBase.h" #include "Loading/IContentLoadingEntryPoint.h" -#include "Game/IW5/IW5.h" namespace IW5 { @@ -20,4 +20,4 @@ namespace IW5 void Load(Zone* zone, IZoneInputStream* stream) override; }; -} +} // namespace IW5 diff --git a/src/ZoneLoading/Game/IW5/XAssets/gfximage/gfximage_actions.h b/src/ZoneLoading/Game/IW5/XAssets/gfximage/gfximage_actions.h index ca2e6dcbc..7ea60d7dd 100644 --- a/src/ZoneLoading/Game/IW5/XAssets/gfximage/gfximage_actions.h +++ b/src/ZoneLoading/Game/IW5/XAssets/gfximage/gfximage_actions.h @@ -1,7 +1,7 @@ #pragma once -#include "Loading/AssetLoadingActions.h" #include "Game/IW5/IW5.h" +#include "Loading/AssetLoadingActions.h" namespace IW5 { @@ -13,4 +13,4 @@ namespace IW5 void OnImageLoaded(GfxImage* image) const; void LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image) const; }; -} +} // namespace IW5 diff --git a/src/ZoneLoading/Game/IW5/XAssets/loadedsound/loadedsound_actions.h b/src/ZoneLoading/Game/IW5/XAssets/loadedsound/loadedsound_actions.h index a6bbfc1a4..4e0de4d26 100644 --- a/src/ZoneLoading/Game/IW5/XAssets/loadedsound/loadedsound_actions.h +++ b/src/ZoneLoading/Game/IW5/XAssets/loadedsound/loadedsound_actions.h @@ -1,7 +1,7 @@ #pragma once -#include "Loading/AssetLoadingActions.h" #include "Game/IW5/IW5.h" +#include "Loading/AssetLoadingActions.h" namespace IW5 { @@ -12,4 +12,4 @@ namespace IW5 void SetSoundData(MssSound* sound) const; }; -} +} // namespace IW5 diff --git a/src/ZoneLoading/Game/IW5/XAssets/xmodel/xmodel_actions.cpp b/src/ZoneLoading/Game/IW5/XAssets/xmodel/xmodel_actions.cpp index 499557814..7b1590a59 100644 --- a/src/ZoneLoading/Game/IW5/XAssets/xmodel/xmodel_actions.cpp +++ b/src/ZoneLoading/Game/IW5/XAssets/xmodel/xmodel_actions.cpp @@ -11,7 +11,7 @@ Actions_XModel::Actions_XModel(Zone* zone) void Actions_XModel::SetModelSurfs(XModelLodInfo* lodInfo, XModelSurfs* modelSurfs) const { - if(modelSurfs) + if (modelSurfs) { lodInfo->modelSurfs = m_zone->GetMemory()->Create<XModelSurfs>(); memcpy(lodInfo->modelSurfs, modelSurfs, sizeof(XModelSurfs)); diff --git a/src/ZoneLoading/Game/IW5/XAssets/xmodel/xmodel_actions.h b/src/ZoneLoading/Game/IW5/XAssets/xmodel/xmodel_actions.h index 60cb637ea..3176c8f9a 100644 --- a/src/ZoneLoading/Game/IW5/XAssets/xmodel/xmodel_actions.h +++ b/src/ZoneLoading/Game/IW5/XAssets/xmodel/xmodel_actions.h @@ -1,7 +1,7 @@ #pragma once -#include "Loading/AssetLoadingActions.h" #include "Game/IW5/IW5.h" +#include "Loading/AssetLoadingActions.h" namespace IW5 { @@ -12,4 +12,4 @@ namespace IW5 void SetModelSurfs(XModelLodInfo* lodInfo, XModelSurfs* modelSurfs) const; }; -} +} // namespace IW5 diff --git a/src/ZoneLoading/Game/IW5/ZoneLoaderFactoryIW5.cpp b/src/ZoneLoading/Game/IW5/ZoneLoaderFactoryIW5.cpp index 8a6a1a94c..462967fc5 100644 --- a/src/ZoneLoading/Game/IW5/ZoneLoaderFactoryIW5.cpp +++ b/src/ZoneLoading/Game/IW5/ZoneLoaderFactoryIW5.cpp @@ -1,31 +1,30 @@ #include "ZoneLoaderFactoryIW5.h" -#include <cassert> -#include <cstring> -#include <type_traits> - -#include "Game/IW5/IW5.h" - -#include "Utils/ClassUtils.h" #include "ContentLoaderIW5.h" +#include "Game/GameLanguage.h" #include "Game/IW5/GameAssetPoolIW5.h" #include "Game/IW5/GameIW5.h" -#include "Game/GameLanguage.h" +#include "Game/IW5/IW5.h" #include "Game/IW5/ZoneConstantsIW5.h" #include "Loading/Processor/ProcessorAuthedBlocks.h" #include "Loading/Processor/ProcessorCaptureData.h" #include "Loading/Processor/ProcessorInflate.h" -#include "Loading/Steps/StepVerifyMagic.h" -#include "Loading/Steps/StepSkipBytes.h" -#include "Loading/Steps/StepVerifyFileName.h" -#include "Loading/Steps/StepLoadSignature.h" -#include "Loading/Steps/StepVerifySignature.h" #include "Loading/Steps/StepAddProcessor.h" #include "Loading/Steps/StepAllocXBlocks.h" -#include "Loading/Steps/StepLoadZoneContent.h" #include "Loading/Steps/StepLoadHash.h" +#include "Loading/Steps/StepLoadSignature.h" +#include "Loading/Steps/StepLoadZoneContent.h" #include "Loading/Steps/StepRemoveProcessor.h" +#include "Loading/Steps/StepSkipBytes.h" +#include "Loading/Steps/StepVerifyFileName.h" #include "Loading/Steps/StepVerifyHash.h" +#include "Loading/Steps/StepVerifyMagic.h" +#include "Loading/Steps/StepVerifySignature.h" +#include "Utils/ClassUtils.h" + +#include <cassert> +#include <cstring> +#include <type_traits> using namespace IW5; @@ -84,8 +83,7 @@ class ZoneLoaderFactory::Impl { if (isOfficial) { - auto rsa = Crypto::CreateRSA(IPublicKeyAlgorithm::HashingAlgorithm::RSA_HASH_SHA256, - Crypto::RSAPaddingMode::RSA_PADDING_PSS); + auto rsa = Crypto::CreateRSA(IPublicKeyAlgorithm::HashingAlgorithm::RSA_HASH_SHA256, Crypto::RSAPaddingMode::RSA_PADDING_PSS); if (!rsa->SetKey(ZoneConstants::RSA_PUBLIC_KEY_INFINITY_WARD, sizeof(ZoneConstants::RSA_PUBLIC_KEY_INFINITY_WARD))) { @@ -104,8 +102,7 @@ class ZoneLoaderFactory::Impl } } - static void AddAuthHeaderSteps(const bool isSecure, const bool isOfficial, ZoneLoader* zoneLoader, - std::string& fileName) + static void AddAuthHeaderSteps(const bool isSecure, const bool isOfficial, ZoneLoader* zoneLoader, std::string& fileName) { // Unsigned zones do not have an auth header if (!isSecure) @@ -138,15 +135,19 @@ class ZoneLoaderFactory::Impl auto* masterBlockHashesPtr = masterBlockHashes.get(); zoneLoader->AddLoadingStep(std::move(masterBlockHashes)); - zoneLoader->AddLoadingStep(std::make_unique<StepVerifyHash>(std::unique_ptr<IHashFunction>(Crypto::CreateSHA256()), 0, subHeaderHashPtr, subHeaderCapturePtr)); + zoneLoader->AddLoadingStep( + std::make_unique<StepVerifyHash>(std::unique_ptr<IHashFunction>(Crypto::CreateSHA256()), 0, subHeaderHashPtr, subHeaderCapturePtr)); zoneLoader->AddLoadingStep(std::make_unique<StepRemoveProcessor>(subHeaderCapturePtr)); // Skip the rest of the first chunk zoneLoader->AddLoadingStep(std::make_unique<StepSkipBytes>(ZoneConstants::AUTHED_CHUNK_SIZE - sizeof(DB_AuthHeader))); - zoneLoader->AddLoadingStep(std::make_unique<StepAddProcessor>(std::make_unique<ProcessorAuthedBlocks>( - ZoneConstants::AUTHED_CHUNK_COUNT_PER_GROUP, ZoneConstants::AUTHED_CHUNK_SIZE, std::extent<decltype(DB_AuthSubHeader::masterBlockHashes)>::value, - std::unique_ptr<IHashFunction>(Crypto::CreateSHA256()), masterBlockHashesPtr))); + zoneLoader->AddLoadingStep( + std::make_unique<StepAddProcessor>(std::make_unique<ProcessorAuthedBlocks>(ZoneConstants::AUTHED_CHUNK_COUNT_PER_GROUP, + ZoneConstants::AUTHED_CHUNK_SIZE, + std::extent<decltype(DB_AuthSubHeader::masterBlockHashes)>::value, + std::unique_ptr<IHashFunction>(Crypto::CreateSHA256()), + masterBlockHashesPtr))); } public: @@ -187,7 +188,8 @@ class ZoneLoaderFactory::Impl zoneLoader->AddLoadingStep(std::make_unique<StepAllocXBlocks>()); // Start of the zone content - zoneLoader->AddLoadingStep(std::make_unique<StepLoadZoneContent>(std::make_unique<ContentLoader>(), zonePtr, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK)); + zoneLoader->AddLoadingStep(std::make_unique<StepLoadZoneContent>( + std::make_unique<ContentLoader>(), zonePtr, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK)); // Return the fully setup zoneloader return zoneLoader; diff --git a/src/ZoneLoading/Game/IW5/ZoneLoaderFactoryIW5.h b/src/ZoneLoading/Game/IW5/ZoneLoaderFactoryIW5.h index cecef3001..435c89f2b 100644 --- a/src/ZoneLoading/Game/IW5/ZoneLoaderFactoryIW5.h +++ b/src/ZoneLoading/Game/IW5/ZoneLoaderFactoryIW5.h @@ -1,6 +1,7 @@ #pragma once #include "Loading/IZoneLoaderFactory.h" + #include <string> namespace IW5 @@ -12,4 +13,4 @@ namespace IW5 public: ZoneLoader* CreateLoaderForHeader(ZoneHeader& header, std::string& fileName) override; }; -} +} // namespace IW5 diff --git a/src/ZoneLoading/Game/T5/ContentLoaderT5.cpp b/src/ZoneLoading/Game/T5/ContentLoaderT5.cpp index c5fd6de3b..5a174a975 100644 --- a/src/ZoneLoading/Game/T5/ContentLoaderT5.cpp +++ b/src/ZoneLoading/Game/T5/ContentLoaderT5.cpp @@ -1,9 +1,6 @@ #include "ContentLoaderT5.h" -#include "Game/T5/T5.h" -#include "Loading/Exception/UnsupportedAssetTypeException.h" - -#include <cassert> +#include "Game/T5/T5.h" #include "Game/T5/XAssets/clipmap_t/clipmap_t_load_db.h" #include "Game/T5/XAssets/comworld/comworld_load_db.h" #include "Game/T5/XAssets/ddlroot_t/ddlroot_t_load_db.h" @@ -36,6 +33,9 @@ #include "Game/T5/XAssets/xanimparts/xanimparts_load_db.h" #include "Game/T5/XAssets/xglobals/xglobals_load_db.h" #include "Game/T5/XAssets/xmodel/xmodel_load_db.h" +#include "Loading/Exception/UnsupportedAssetTypeException.h" + +#include <cassert> using namespace T5; @@ -71,15 +71,15 @@ void ContentLoader::LoadScriptStringList(const bool atStreamStart) void ContentLoader::LoadXAsset(const bool atStreamStart) const { -#define LOAD_ASSET(type_index, typeName, headerEntry) \ - case type_index: \ - { \ - Loader_##typeName loader(m_zone, m_stream); \ - loader.Load(&varXAsset->header.headerEntry); \ - break; \ - } -#define SKIP_ASSET(type_index, typeName, headerEntry) \ - case type_index: \ +#define LOAD_ASSET(type_index, typeName, headerEntry) \ + case type_index: \ + { \ + Loader_##typeName loader(m_zone, m_stream); \ + loader.Load(&varXAsset->header.headerEntry); \ + break; \ + } +#define SKIP_ASSET(type_index, typeName, headerEntry) \ + case type_index: \ break; assert(varXAsset != nullptr); @@ -89,44 +89,44 @@ void ContentLoader::LoadXAsset(const bool atStreamStart) const switch (varXAsset->type) { - LOAD_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset) - LOAD_ASSET(ASSET_TYPE_PHYSCONSTRAINTS, PhysConstraints, physConstraints) - LOAD_ASSET(ASSET_TYPE_DESTRUCTIBLEDEF, DestructibleDef, destructibleDef) - LOAD_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts) - LOAD_ASSET(ASSET_TYPE_XMODEL, XModel, model) - LOAD_ASSET(ASSET_TYPE_MATERIAL, Material, material) - LOAD_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet) - LOAD_ASSET(ASSET_TYPE_IMAGE, GfxImage, image) - LOAD_ASSET(ASSET_TYPE_SOUND, SndBank, sound) - LOAD_ASSET(ASSET_TYPE_SOUND_PATCH, SndPatch, soundPatch) - LOAD_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap) - LOAD_ASSET(ASSET_TYPE_CLIPMAP_PVS, clipMap_t, clipMap) - LOAD_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld) - LOAD_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp) - LOAD_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp) - LOAD_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts) - LOAD_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld) - LOAD_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef) - LOAD_ASSET(ASSET_TYPE_FONT, Font_s, font) - LOAD_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList) - LOAD_ASSET(ASSET_TYPE_MENU, menuDef_t, menu) - LOAD_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize) - LOAD_ASSET(ASSET_TYPE_WEAPON, WeaponVariantDef, weapon) - LOAD_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals) - LOAD_ASSET(ASSET_TYPE_FX, FxEffectDef, fx) - LOAD_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx) - LOAD_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile) - LOAD_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable) - LOAD_ASSET(ASSET_TYPE_PACK_INDEX, PackIndex, packIndex) - LOAD_ASSET(ASSET_TYPE_XGLOBALS, XGlobals, xGlobals) - LOAD_ASSET(ASSET_TYPE_DDL, ddlRoot_t, ddlRoot) - LOAD_ASSET(ASSET_TYPE_GLASSES, Glasses, glasses) - LOAD_ASSET(ASSET_TYPE_EMBLEMSET, EmblemSet, emblemSet) + LOAD_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset) + LOAD_ASSET(ASSET_TYPE_PHYSCONSTRAINTS, PhysConstraints, physConstraints) + LOAD_ASSET(ASSET_TYPE_DESTRUCTIBLEDEF, DestructibleDef, destructibleDef) + LOAD_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts) + LOAD_ASSET(ASSET_TYPE_XMODEL, XModel, model) + LOAD_ASSET(ASSET_TYPE_MATERIAL, Material, material) + LOAD_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet) + LOAD_ASSET(ASSET_TYPE_IMAGE, GfxImage, image) + LOAD_ASSET(ASSET_TYPE_SOUND, SndBank, sound) + LOAD_ASSET(ASSET_TYPE_SOUND_PATCH, SndPatch, soundPatch) + LOAD_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap) + LOAD_ASSET(ASSET_TYPE_CLIPMAP_PVS, clipMap_t, clipMap) + LOAD_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld) + LOAD_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp) + LOAD_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp) + LOAD_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts) + LOAD_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld) + LOAD_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef) + LOAD_ASSET(ASSET_TYPE_FONT, Font_s, font) + LOAD_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList) + LOAD_ASSET(ASSET_TYPE_MENU, menuDef_t, menu) + LOAD_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize) + LOAD_ASSET(ASSET_TYPE_WEAPON, WeaponVariantDef, weapon) + LOAD_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals) + LOAD_ASSET(ASSET_TYPE_FX, FxEffectDef, fx) + LOAD_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx) + LOAD_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile) + LOAD_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable) + LOAD_ASSET(ASSET_TYPE_PACK_INDEX, PackIndex, packIndex) + LOAD_ASSET(ASSET_TYPE_XGLOBALS, XGlobals, xGlobals) + LOAD_ASSET(ASSET_TYPE_DDL, ddlRoot_t, ddlRoot) + LOAD_ASSET(ASSET_TYPE_GLASSES, Glasses, glasses) + LOAD_ASSET(ASSET_TYPE_EMBLEMSET, EmblemSet, emblemSet) default: - { - throw UnsupportedAssetTypeException(varXAsset->type); - } + { + throw UnsupportedAssetTypeException(varXAsset->type); + } } #undef LOAD_ASSET diff --git a/src/ZoneLoading/Game/T5/ContentLoaderT5.h b/src/ZoneLoading/Game/T5/ContentLoaderT5.h index ffc36ceb0..e924514be 100644 --- a/src/ZoneLoading/Game/T5/ContentLoaderT5.h +++ b/src/ZoneLoading/Game/T5/ContentLoaderT5.h @@ -1,7 +1,7 @@ #pragma once +#include "Game/T5/T5.h" #include "Loading/ContentLoaderBase.h" #include "Loading/IContentLoadingEntryPoint.h" -#include "Game/T5/T5.h" namespace T5 { @@ -20,4 +20,4 @@ namespace T5 void Load(Zone* zone, IZoneInputStream* stream) override; }; -} +} // namespace T5 diff --git a/src/ZoneLoading/Game/T5/XAssets/gfximage/gfximage_actions.h b/src/ZoneLoading/Game/T5/XAssets/gfximage/gfximage_actions.h index e5f252b9a..bc98aefe7 100644 --- a/src/ZoneLoading/Game/T5/XAssets/gfximage/gfximage_actions.h +++ b/src/ZoneLoading/Game/T5/XAssets/gfximage/gfximage_actions.h @@ -1,7 +1,7 @@ #pragma once -#include "Loading/AssetLoadingActions.h" #include "Game/T5/T5.h" +#include "Loading/AssetLoadingActions.h" namespace T5 { @@ -13,4 +13,4 @@ namespace T5 void OnImageLoaded(GfxImage* image) const; void LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image) const; }; -} +} // namespace T5 diff --git a/src/ZoneLoading/Game/T5/ZoneLoaderFactoryT5.cpp b/src/ZoneLoading/Game/T5/ZoneLoaderFactoryT5.cpp index b33a6d8f9..fd49746e6 100644 --- a/src/ZoneLoading/Game/T5/ZoneLoaderFactoryT5.cpp +++ b/src/ZoneLoading/Game/T5/ZoneLoaderFactoryT5.cpp @@ -1,22 +1,21 @@ #include "ZoneLoaderFactoryT5.h" -#include <cassert> -#include <cstring> -#include <type_traits> - -#include "Game/T5/T5.h" - -#include "Utils/ClassUtils.h" #include "ContentLoaderT5.h" +#include "Game/GameLanguage.h" #include "Game/T5/GameAssetPoolT5.h" #include "Game/T5/GameT5.h" -#include "Game/GameLanguage.h" +#include "Game/T5/T5.h" #include "Game/T5/ZoneConstantsT5.h" #include "Loading/Processor/ProcessorInflate.h" -#include "Loading/Steps/StepSkipBytes.h" #include "Loading/Steps/StepAddProcessor.h" #include "Loading/Steps/StepAllocXBlocks.h" #include "Loading/Steps/StepLoadZoneContent.h" +#include "Loading/Steps/StepSkipBytes.h" +#include "Utils/ClassUtils.h" + +#include <cassert> +#include <cstring> +#include <type_traits> using namespace T5; @@ -91,7 +90,8 @@ class ZoneLoaderFactory::Impl zoneLoader->AddLoadingStep(std::make_unique<StepAllocXBlocks>()); // Start of the zone content - zoneLoader->AddLoadingStep(std::make_unique<StepLoadZoneContent>(std::make_unique<ContentLoader>(), zonePtr, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK)); + zoneLoader->AddLoadingStep(std::make_unique<StepLoadZoneContent>( + std::make_unique<ContentLoader>(), zonePtr, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK)); // Return the fully setup zoneloader return zoneLoader; diff --git a/src/ZoneLoading/Game/T5/ZoneLoaderFactoryT5.h b/src/ZoneLoading/Game/T5/ZoneLoaderFactoryT5.h index 4a55573c7..98f3182a0 100644 --- a/src/ZoneLoading/Game/T5/ZoneLoaderFactoryT5.h +++ b/src/ZoneLoading/Game/T5/ZoneLoaderFactoryT5.h @@ -1,6 +1,7 @@ #pragma once #include "Loading/IZoneLoaderFactory.h" + #include <string> namespace T5 @@ -12,4 +13,4 @@ namespace T5 public: ZoneLoader* CreateLoaderForHeader(ZoneHeader& header, std::string& fileName) override; }; -} +} // namespace T5 diff --git a/src/ZoneLoading/Game/T6/ContentLoaderT6.cpp b/src/ZoneLoading/Game/T6/ContentLoaderT6.cpp index cffe27efc..7c82bee6e 100644 --- a/src/ZoneLoading/Game/T6/ContentLoaderT6.cpp +++ b/src/ZoneLoading/Game/T6/ContentLoaderT6.cpp @@ -1,9 +1,6 @@ #include "ContentLoaderT6.h" -#include "Game/T6/T6.h" -#include "Loading/Exception/UnsupportedAssetTypeException.h" - -#include <cassert> +#include "Game/T6/T6.h" #include "Game/T6/XAssets/addonmapents/addonmapents_load_db.h" #include "Game/T6/XAssets/clipmap_t/clipmap_t_load_db.h" #include "Game/T6/XAssets/comworld/comworld_load_db.h" @@ -52,6 +49,9 @@ #include "Game/T6/XAssets/xglobals/xglobals_load_db.h" #include "Game/T6/XAssets/xmodel/xmodel_load_db.h" #include "Game/T6/XAssets/zbarrierdef/zbarrierdef_load_db.h" +#include "Loading/Exception/UnsupportedAssetTypeException.h" + +#include <cassert> using namespace T6; @@ -87,13 +87,13 @@ void ContentLoader::LoadScriptStringList(const bool atStreamStart) void ContentLoader::LoadXAsset(const bool atStreamStart) const { -#define LOAD_ASSET(type_index, typeName, headerEntry) \ - case type_index: \ - { \ - Loader_##typeName loader(m_zone, m_stream); \ - loader.Load(&varXAsset->header.headerEntry); \ - break; \ - } +#define LOAD_ASSET(type_index, typeName, headerEntry) \ + case type_index: \ + { \ + Loader_##typeName loader(m_zone, m_stream); \ + loader.Load(&varXAsset->header.headerEntry); \ + break; \ + } assert(varXAsset != nullptr); @@ -102,60 +102,60 @@ void ContentLoader::LoadXAsset(const bool atStreamStart) const switch (varXAsset->type) { - LOAD_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset) - LOAD_ASSET(ASSET_TYPE_PHYSCONSTRAINTS, PhysConstraints, physConstraints) - LOAD_ASSET(ASSET_TYPE_DESTRUCTIBLEDEF, DestructibleDef, destructibleDef) - LOAD_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts) - LOAD_ASSET(ASSET_TYPE_XMODEL, XModel, model) - LOAD_ASSET(ASSET_TYPE_MATERIAL, Material, material) - LOAD_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet) - LOAD_ASSET(ASSET_TYPE_IMAGE, GfxImage, image) - LOAD_ASSET(ASSET_TYPE_SOUND, SndBank, sound) - LOAD_ASSET(ASSET_TYPE_SOUND_PATCH, SndPatch, soundPatch) - LOAD_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap) - LOAD_ASSET(ASSET_TYPE_CLIPMAP_PVS, clipMap_t, clipMap) - LOAD_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld) - LOAD_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp) - LOAD_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp) - LOAD_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts) - LOAD_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld) - LOAD_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef) - LOAD_ASSET(ASSET_TYPE_FONT, Font_s, font) - LOAD_ASSET(ASSET_TYPE_FONTICON, FontIcon, fontIcon) - LOAD_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList) - LOAD_ASSET(ASSET_TYPE_MENU, menuDef_t, menu) - LOAD_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize) - LOAD_ASSET(ASSET_TYPE_WEAPON, WeaponVariantDef, weapon) - LOAD_ASSET(ASSET_TYPE_ATTACHMENT, WeaponAttachment, attachment) - LOAD_ASSET(ASSET_TYPE_ATTACHMENT_UNIQUE, WeaponAttachmentUnique, attachmentUnique) - LOAD_ASSET(ASSET_TYPE_WEAPON_CAMO, WeaponCamo, weaponCamo) - LOAD_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals) - LOAD_ASSET(ASSET_TYPE_FX, FxEffectDef, fx) - LOAD_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx) - LOAD_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile) - LOAD_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable) - LOAD_ASSET(ASSET_TYPE_LEADERBOARD, LeaderboardDef, leaderboardDef) - LOAD_ASSET(ASSET_TYPE_XGLOBALS, XGlobals, xGlobals) - LOAD_ASSET(ASSET_TYPE_DDL, ddlRoot_t, ddlRoot) - LOAD_ASSET(ASSET_TYPE_GLASSES, Glasses, glasses) - LOAD_ASSET(ASSET_TYPE_EMBLEMSET, EmblemSet, emblemSet) - LOAD_ASSET(ASSET_TYPE_SCRIPTPARSETREE, ScriptParseTree, scriptParseTree) - LOAD_ASSET(ASSET_TYPE_KEYVALUEPAIRS, KeyValuePairs, keyValuePairs) - LOAD_ASSET(ASSET_TYPE_VEHICLEDEF, VehicleDef, vehicleDef) - LOAD_ASSET(ASSET_TYPE_MEMORYBLOCK, MemoryBlock, memoryBlock); - LOAD_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts) - LOAD_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef) - LOAD_ASSET(ASSET_TYPE_SKINNEDVERTS, SkinnedVertsDef, skinnedVertsDef) - LOAD_ASSET(ASSET_TYPE_QDB, Qdb, qdb) - LOAD_ASSET(ASSET_TYPE_SLUG, Slug, slug) - LOAD_ASSET(ASSET_TYPE_FOOTSTEP_TABLE, FootstepTableDef, footstepTableDef) - LOAD_ASSET(ASSET_TYPE_FOOTSTEPFX_TABLE, FootstepFXTableDef, footstepFXTableDef) - LOAD_ASSET(ASSET_TYPE_ZBARRIER, ZBarrierDef, zbarrierDef) + LOAD_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset) + LOAD_ASSET(ASSET_TYPE_PHYSCONSTRAINTS, PhysConstraints, physConstraints) + LOAD_ASSET(ASSET_TYPE_DESTRUCTIBLEDEF, DestructibleDef, destructibleDef) + LOAD_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts) + LOAD_ASSET(ASSET_TYPE_XMODEL, XModel, model) + LOAD_ASSET(ASSET_TYPE_MATERIAL, Material, material) + LOAD_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet) + LOAD_ASSET(ASSET_TYPE_IMAGE, GfxImage, image) + LOAD_ASSET(ASSET_TYPE_SOUND, SndBank, sound) + LOAD_ASSET(ASSET_TYPE_SOUND_PATCH, SndPatch, soundPatch) + LOAD_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap) + LOAD_ASSET(ASSET_TYPE_CLIPMAP_PVS, clipMap_t, clipMap) + LOAD_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld) + LOAD_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp) + LOAD_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp) + LOAD_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts) + LOAD_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld) + LOAD_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef) + LOAD_ASSET(ASSET_TYPE_FONT, Font_s, font) + LOAD_ASSET(ASSET_TYPE_FONTICON, FontIcon, fontIcon) + LOAD_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList) + LOAD_ASSET(ASSET_TYPE_MENU, menuDef_t, menu) + LOAD_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize) + LOAD_ASSET(ASSET_TYPE_WEAPON, WeaponVariantDef, weapon) + LOAD_ASSET(ASSET_TYPE_ATTACHMENT, WeaponAttachment, attachment) + LOAD_ASSET(ASSET_TYPE_ATTACHMENT_UNIQUE, WeaponAttachmentUnique, attachmentUnique) + LOAD_ASSET(ASSET_TYPE_WEAPON_CAMO, WeaponCamo, weaponCamo) + LOAD_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals) + LOAD_ASSET(ASSET_TYPE_FX, FxEffectDef, fx) + LOAD_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx) + LOAD_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile) + LOAD_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable) + LOAD_ASSET(ASSET_TYPE_LEADERBOARD, LeaderboardDef, leaderboardDef) + LOAD_ASSET(ASSET_TYPE_XGLOBALS, XGlobals, xGlobals) + LOAD_ASSET(ASSET_TYPE_DDL, ddlRoot_t, ddlRoot) + LOAD_ASSET(ASSET_TYPE_GLASSES, Glasses, glasses) + LOAD_ASSET(ASSET_TYPE_EMBLEMSET, EmblemSet, emblemSet) + LOAD_ASSET(ASSET_TYPE_SCRIPTPARSETREE, ScriptParseTree, scriptParseTree) + LOAD_ASSET(ASSET_TYPE_KEYVALUEPAIRS, KeyValuePairs, keyValuePairs) + LOAD_ASSET(ASSET_TYPE_VEHICLEDEF, VehicleDef, vehicleDef) + LOAD_ASSET(ASSET_TYPE_MEMORYBLOCK, MemoryBlock, memoryBlock); + LOAD_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts) + LOAD_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef) + LOAD_ASSET(ASSET_TYPE_SKINNEDVERTS, SkinnedVertsDef, skinnedVertsDef) + LOAD_ASSET(ASSET_TYPE_QDB, Qdb, qdb) + LOAD_ASSET(ASSET_TYPE_SLUG, Slug, slug) + LOAD_ASSET(ASSET_TYPE_FOOTSTEP_TABLE, FootstepTableDef, footstepTableDef) + LOAD_ASSET(ASSET_TYPE_FOOTSTEPFX_TABLE, FootstepFXTableDef, footstepFXTableDef) + LOAD_ASSET(ASSET_TYPE_ZBARRIER, ZBarrierDef, zbarrierDef) default: - { - throw UnsupportedAssetTypeException(varXAsset->type); - } + { + throw UnsupportedAssetTypeException(varXAsset->type); + } } #undef LOAD_ASSET diff --git a/src/ZoneLoading/Game/T6/ContentLoaderT6.h b/src/ZoneLoading/Game/T6/ContentLoaderT6.h index 592e6f81e..fc88dc59c 100644 --- a/src/ZoneLoading/Game/T6/ContentLoaderT6.h +++ b/src/ZoneLoading/Game/T6/ContentLoaderT6.h @@ -1,7 +1,7 @@ #pragma once +#include "Game/T6/T6.h" #include "Loading/ContentLoaderBase.h" #include "Loading/IContentLoadingEntryPoint.h" -#include "Game/T6/T6.h" namespace T6 { @@ -20,4 +20,4 @@ namespace T6 void Load(Zone* zone, IZoneInputStream* stream) override; }; -} +} // namespace T6 diff --git a/src/ZoneLoading/Game/T6/XAssets/gfximage/gfximage_actions.h b/src/ZoneLoading/Game/T6/XAssets/gfximage/gfximage_actions.h index 67b32395a..d938ff6f4 100644 --- a/src/ZoneLoading/Game/T6/XAssets/gfximage/gfximage_actions.h +++ b/src/ZoneLoading/Game/T6/XAssets/gfximage/gfximage_actions.h @@ -1,7 +1,7 @@ #pragma once -#include "Loading/AssetLoadingActions.h" #include "Game/T6/T6.h" +#include "Loading/AssetLoadingActions.h" namespace T6 { @@ -13,4 +13,4 @@ namespace T6 void OnImageLoaded(GfxImage* image) const; void LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image) const; }; -} +} // namespace T6 diff --git a/src/ZoneLoading/Game/T6/ZoneLoaderFactoryT6.cpp b/src/ZoneLoading/Game/T6/ZoneLoaderFactoryT6.cpp index b613d2ef8..b10b9b25d 100644 --- a/src/ZoneLoading/Game/T6/ZoneLoaderFactoryT6.cpp +++ b/src/ZoneLoading/Game/T6/ZoneLoaderFactoryT6.cpp @@ -1,29 +1,28 @@ #include "ZoneLoaderFactoryT6.h" -#include <cassert> -#include <cstring> -#include <memory> - -#include "Game/T6/T6.h" -#include "Game/T6/ZoneConstantsT6.h" - -#include "Utils/ClassUtils.h" #include "ContentLoaderT6.h" -#include "Game/T6/GameAssetPoolT6.h" #include "Game/GameLanguage.h" +#include "Game/T6/GameAssetPoolT6.h" #include "Game/T6/GameT6.h" +#include "Game/T6/T6.h" +#include "Game/T6/ZoneConstantsT6.h" #include "Loading/Processor/ProcessorXChunks.h" -#include "Zone/XChunk/XChunkProcessorSalsa20Decryption.h" -#include "Zone/XChunk/XChunkProcessorInflate.h" -#include "Loading/Steps/StepVerifyMagic.h" -#include "Loading/Steps/StepSkipBytes.h" -#include "Loading/Steps/StepVerifyFileName.h" -#include "Loading/Steps/StepLoadSignature.h" -#include "Loading/Steps/StepVerifySignature.h" #include "Loading/Steps/StepAddProcessor.h" #include "Loading/Steps/StepAllocXBlocks.h" +#include "Loading/Steps/StepLoadSignature.h" #include "Loading/Steps/StepLoadZoneContent.h" #include "Loading/Steps/StepLoadZoneSizes.h" +#include "Loading/Steps/StepSkipBytes.h" +#include "Loading/Steps/StepVerifyFileName.h" +#include "Loading/Steps/StepVerifyMagic.h" +#include "Loading/Steps/StepVerifySignature.h" +#include "Utils/ClassUtils.h" +#include "Zone/XChunk/XChunkProcessorInflate.h" +#include "Zone/XChunk/XChunkProcessorSalsa20Decryption.h" + +#include <cassert> +#include <cstring> +#include <memory> using namespace T6; @@ -153,8 +152,8 @@ class ZoneLoaderFactory::Impl if (isEncrypted) { // If zone is encrypted, the decryption is applied before the decompression. T6 Zones always use Salsa20. - auto chunkProcessorSalsa20 = std::make_unique<XChunkProcessorSalsa20Decryption>(ZoneConstants::STREAM_COUNT, fileName, ZoneConstants::SALSA20_KEY_TREYARCH, - sizeof(ZoneConstants::SALSA20_KEY_TREYARCH)); + auto chunkProcessorSalsa20 = std::make_unique<XChunkProcessorSalsa20Decryption>( + ZoneConstants::STREAM_COUNT, fileName, ZoneConstants::SALSA20_KEY_TREYARCH, sizeof(ZoneConstants::SALSA20_KEY_TREYARCH)); result = chunkProcessorSalsa20.get(); xChunkProcessor->AddChunkProcessor(std::move(chunkProcessorSalsa20)); } @@ -203,7 +202,8 @@ class ZoneLoaderFactory::Impl zoneLoader->AddLoadingStep(std::make_unique<StepAllocXBlocks>()); // Start of the zone content - zoneLoader->AddLoadingStep(std::make_unique<StepLoadZoneContent>(std::make_unique<ContentLoader>(), zonePtr, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK)); + zoneLoader->AddLoadingStep(std::make_unique<StepLoadZoneContent>( + std::make_unique<ContentLoader>(), zonePtr, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK)); if (isSecure) { diff --git a/src/ZoneLoading/Game/T6/ZoneLoaderFactoryT6.h b/src/ZoneLoading/Game/T6/ZoneLoaderFactoryT6.h index 4ff8af076..4f55d94c8 100644 --- a/src/ZoneLoading/Game/T6/ZoneLoaderFactoryT6.h +++ b/src/ZoneLoading/Game/T6/ZoneLoaderFactoryT6.h @@ -1,6 +1,7 @@ #pragma once #include "Loading/IZoneLoaderFactory.h" + #include <string> namespace T6 @@ -12,4 +13,4 @@ namespace T6 public: ZoneLoader* CreateLoaderForHeader(ZoneHeader& header, std::string& fileName) override; }; -} +} // namespace T6 diff --git a/src/ZoneLoading/Loading/AssetLoader.cpp b/src/ZoneLoading/Loading/AssetLoader.cpp index b2fb1eaf0..8a903c918 100644 --- a/src/ZoneLoading/Loading/AssetLoader.cpp +++ b/src/ZoneLoading/Loading/AssetLoader.cpp @@ -1,7 +1,7 @@ #include "AssetLoader.h" -#include <cassert> #include <algorithm> +#include <cassert> AssetLoader::AssetLoader(const asset_type_t assetType, Zone* zone, IZoneInputStream* stream) : ContentLoaderBase(zone, stream), diff --git a/src/ZoneLoading/Loading/AssetLoader.h b/src/ZoneLoading/Loading/AssetLoader.h index 6c7550f67..55d1bc840 100644 --- a/src/ZoneLoading/Loading/AssetLoader.h +++ b/src/ZoneLoading/Loading/AssetLoader.h @@ -1,11 +1,11 @@ #pragma once -#include <vector> -#include <unordered_set> - -#include "Zone/ZoneTypes.h" -#include "Pool/XAssetInfo.h" #include "ContentLoaderBase.h" +#include "Pool/XAssetInfo.h" +#include "Zone/ZoneTypes.h" + +#include <unordered_set> +#include <vector> class AssetLoader : public ContentLoaderBase { @@ -18,7 +18,7 @@ class AssetLoader : public ContentLoaderBase scr_string_t* varScriptString; AssetLoader(asset_type_t assetType, Zone* zone, IZoneInputStream* stream); - + void AddDependency(XAssetInfoGeneric* assetInfo); scr_string_t UseScriptString(scr_string_t scrString); diff --git a/src/ZoneLoading/Loading/AssetLoadingActions.h b/src/ZoneLoading/Loading/AssetLoadingActions.h index 5f62066d3..37e7a7817 100644 --- a/src/ZoneLoading/Loading/AssetLoadingActions.h +++ b/src/ZoneLoading/Loading/AssetLoadingActions.h @@ -9,4 +9,4 @@ class AssetLoadingActions public: explicit AssetLoadingActions(Zone* zone); -}; \ No newline at end of file +}; diff --git a/src/ZoneLoading/Loading/ContentLoaderBase.cpp b/src/ZoneLoading/Loading/ContentLoaderBase.cpp index b3c4e83b7..8ac12b96a 100644 --- a/src/ZoneLoading/Loading/ContentLoaderBase.cpp +++ b/src/ZoneLoading/Loading/ContentLoaderBase.cpp @@ -1,4 +1,5 @@ #include "ContentLoaderBase.h" + #include <cassert> const void* ContentLoaderBase::PTR_FOLLOWING = reinterpret_cast<void*>(-1); diff --git a/src/ZoneLoading/Loading/ContentLoaderBase.h b/src/ZoneLoading/Loading/ContentLoaderBase.h index 122b706b1..eba6aac2c 100644 --- a/src/ZoneLoading/Loading/ContentLoaderBase.h +++ b/src/ZoneLoading/Loading/ContentLoaderBase.h @@ -1,7 +1,7 @@ #pragma once -#include "Zone/Zone.h" #include "Zone/Stream/IZoneInputStream.h" +#include "Zone/Zone.h" class ContentLoaderBase { diff --git a/src/ZoneLoading/Loading/Exception/BlockOverflowException.cpp b/src/ZoneLoading/Loading/Exception/BlockOverflowException.cpp index 779e77e59..68e0533b7 100644 --- a/src/ZoneLoading/Loading/Exception/BlockOverflowException.cpp +++ b/src/ZoneLoading/Loading/Exception/BlockOverflowException.cpp @@ -13,4 +13,4 @@ std::string BlockOverflowException::DetailedMessage() char const* BlockOverflowException::what() const noexcept { return "Invalid Zone. XBlock overflowed."; -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/Exception/InvalidChunkSizeException.cpp b/src/ZoneLoading/Loading/Exception/InvalidChunkSizeException.cpp index ea6959b46..bd592520f 100644 --- a/src/ZoneLoading/Loading/Exception/InvalidChunkSizeException.cpp +++ b/src/ZoneLoading/Loading/Exception/InvalidChunkSizeException.cpp @@ -14,7 +14,7 @@ InvalidChunkSizeException::InvalidChunkSizeException(const size_t size, const si std::string InvalidChunkSizeException::DetailedMessage() { - if(m_max > 0) + if (m_max > 0) { return "Zone chunk size has a chunk size of " + std::to_string(m_size) + " which is larger than the maximum of " + std::to_string(m_max); } @@ -27,4 +27,4 @@ std::string InvalidChunkSizeException::DetailedMessage() char const* InvalidChunkSizeException::what() const noexcept { return "Zone has invalid chunk size"; -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/Exception/InvalidFileNameException.cpp b/src/ZoneLoading/Loading/Exception/InvalidFileNameException.cpp index ac82d25a6..b4ec34f63 100644 --- a/src/ZoneLoading/Loading/Exception/InvalidFileNameException.cpp +++ b/src/ZoneLoading/Loading/Exception/InvalidFileNameException.cpp @@ -14,4 +14,4 @@ std::string InvalidFileNameException::DetailedMessage() char const* InvalidFileNameException::what() const noexcept { return "The filename when created and when loaded does not match"; -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/Exception/InvalidHashException.cpp b/src/ZoneLoading/Loading/Exception/InvalidHashException.cpp index ffab2c8c3..2fd3d1868 100644 --- a/src/ZoneLoading/Loading/Exception/InvalidHashException.cpp +++ b/src/ZoneLoading/Loading/Exception/InvalidHashException.cpp @@ -8,4 +8,4 @@ std::string InvalidHashException::DetailedMessage() char const* InvalidHashException::what() const noexcept { return "Loaded fastfile has an invalid hash."; -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/Exception/InvalidMagicException.cpp b/src/ZoneLoading/Loading/Exception/InvalidMagicException.cpp index 22395ed03..242209141 100644 --- a/src/ZoneLoading/Loading/Exception/InvalidMagicException.cpp +++ b/src/ZoneLoading/Loading/Exception/InvalidMagicException.cpp @@ -1,5 +1,5 @@ #include "InvalidMagicException.h" - + InvalidMagicException::InvalidMagicException(const char* expectedMagic) { m_expected_magic = expectedMagic; @@ -13,4 +13,4 @@ std::string InvalidMagicException::DetailedMessage() char const* InvalidMagicException::what() const noexcept { return "Encountered invalid magic when loading."; -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/Exception/InvalidOffsetBlockException.cpp b/src/ZoneLoading/Loading/Exception/InvalidOffsetBlockException.cpp index fbe4114d5..0e6fe19a0 100644 --- a/src/ZoneLoading/Loading/Exception/InvalidOffsetBlockException.cpp +++ b/src/ZoneLoading/Loading/Exception/InvalidOffsetBlockException.cpp @@ -13,4 +13,4 @@ std::string InvalidOffsetBlockException::DetailedMessage() char const* InvalidOffsetBlockException::what() const noexcept { return "Zone referenced invalid block"; -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/Exception/InvalidOffsetBlockOffsetException.cpp b/src/ZoneLoading/Loading/Exception/InvalidOffsetBlockOffsetException.cpp index 58ab1dbc6..1752677c2 100644 --- a/src/ZoneLoading/Loading/Exception/InvalidOffsetBlockOffsetException.cpp +++ b/src/ZoneLoading/Loading/Exception/InvalidOffsetBlockOffsetException.cpp @@ -8,11 +8,11 @@ InvalidOffsetBlockOffsetException::InvalidOffsetBlockOffsetException(XBlock* blo std::string InvalidOffsetBlockOffsetException::DetailedMessage() { - return "Zone referenced offset " + std::to_string(m_referenced_offset) + " of block " + m_referenced_block->m_name - + " which is larger than its size " + std::to_string(m_referenced_block->m_buffer_size); + return "Zone referenced offset " + std::to_string(m_referenced_offset) + " of block " + m_referenced_block->m_name + " which is larger than its size " + + std::to_string(m_referenced_block->m_buffer_size); } char const* InvalidOffsetBlockOffsetException::what() const noexcept { return "Zone referenced offset of block that is out of bounds"; -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/Exception/InvalidSignatureException.cpp b/src/ZoneLoading/Loading/Exception/InvalidSignatureException.cpp index 429d4ecb5..d380d4feb 100644 --- a/src/ZoneLoading/Loading/Exception/InvalidSignatureException.cpp +++ b/src/ZoneLoading/Loading/Exception/InvalidSignatureException.cpp @@ -8,4 +8,4 @@ std::string InvalidSignatureException::DetailedMessage() char const* InvalidSignatureException::what() const noexcept { return "Loaded fastfile has an invalid signature."; -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/Exception/InvalidVersionException.cpp b/src/ZoneLoading/Loading/Exception/InvalidVersionException.cpp index 6aabdc597..64cf68cd0 100644 --- a/src/ZoneLoading/Loading/Exception/InvalidVersionException.cpp +++ b/src/ZoneLoading/Loading/Exception/InvalidVersionException.cpp @@ -14,4 +14,4 @@ std::string InvalidVersionException::DetailedMessage() char const* InvalidVersionException::what() const noexcept { return "Encountered invalid version when loading."; -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/Exception/InvalidXBlockSizeException.cpp b/src/ZoneLoading/Loading/Exception/InvalidXBlockSizeException.cpp index 4ca598b86..a0f257792 100644 --- a/src/ZoneLoading/Loading/Exception/InvalidXBlockSizeException.cpp +++ b/src/ZoneLoading/Loading/Exception/InvalidXBlockSizeException.cpp @@ -14,4 +14,4 @@ std::string InvalidXBlockSizeException::DetailedMessage() char const* InvalidXBlockSizeException::what() const noexcept { return "Zone has invalid block size"; -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/Exception/InvalidXBlockSizeException.h b/src/ZoneLoading/Loading/Exception/InvalidXBlockSizeException.h index 41ca32de4..692b5e5f1 100644 --- a/src/ZoneLoading/Loading/Exception/InvalidXBlockSizeException.h +++ b/src/ZoneLoading/Loading/Exception/InvalidXBlockSizeException.h @@ -1,7 +1,8 @@ #pragma once -#include <cstdint> #include "LoadingException.h" +#include <cstdint> + class InvalidXBlockSizeException final : public LoadingException { uint64_t m_size; diff --git a/src/ZoneLoading/Loading/Exception/OutOfBlockBoundsException.cpp b/src/ZoneLoading/Loading/Exception/OutOfBlockBoundsException.cpp index 3b020eb1b..1640b183e 100644 --- a/src/ZoneLoading/Loading/Exception/OutOfBlockBoundsException.cpp +++ b/src/ZoneLoading/Loading/Exception/OutOfBlockBoundsException.cpp @@ -13,4 +13,4 @@ std::string OutOfBlockBoundsException::DetailedMessage() char const* OutOfBlockBoundsException::what() const noexcept { return "Invalid Zone. Out of XBlock bounds."; -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/Exception/TooManyAuthedGroupsException.cpp b/src/ZoneLoading/Loading/Exception/TooManyAuthedGroupsException.cpp index 3f580b362..8c39ad643 100644 --- a/src/ZoneLoading/Loading/Exception/TooManyAuthedGroupsException.cpp +++ b/src/ZoneLoading/Loading/Exception/TooManyAuthedGroupsException.cpp @@ -8,4 +8,4 @@ std::string TooManyAuthedGroupsException::DetailedMessage() char const* TooManyAuthedGroupsException::what() const noexcept { return "Loaded fastfile has too many authed groups."; -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/Exception/UnexpectedEndOfFileException.cpp b/src/ZoneLoading/Loading/Exception/UnexpectedEndOfFileException.cpp index c860eacf0..8dade0310 100644 --- a/src/ZoneLoading/Loading/Exception/UnexpectedEndOfFileException.cpp +++ b/src/ZoneLoading/Loading/Exception/UnexpectedEndOfFileException.cpp @@ -1,5 +1,5 @@ #include "UnexpectedEndOfFileException.h" - + UnexpectedEndOfFileException::UnexpectedEndOfFileException() = default; std::string UnexpectedEndOfFileException::DetailedMessage() @@ -10,4 +10,4 @@ std::string UnexpectedEndOfFileException::DetailedMessage() char const* UnexpectedEndOfFileException::what() const noexcept { return "Unexpected end of file"; -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/Exception/UnsupportedAssetTypeException.cpp b/src/ZoneLoading/Loading/Exception/UnsupportedAssetTypeException.cpp index 20f68d156..c99f1cd31 100644 --- a/src/ZoneLoading/Loading/Exception/UnsupportedAssetTypeException.cpp +++ b/src/ZoneLoading/Loading/Exception/UnsupportedAssetTypeException.cpp @@ -13,4 +13,4 @@ std::string UnsupportedAssetTypeException::DetailedMessage() char const* UnsupportedAssetTypeException::what() const noexcept { return "Zone has unsupported asset type."; -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/IContentLoadingEntryPoint.h b/src/ZoneLoading/Loading/IContentLoadingEntryPoint.h index 271bbe039..3ffda7684 100644 --- a/src/ZoneLoading/Loading/IContentLoadingEntryPoint.h +++ b/src/ZoneLoading/Loading/IContentLoadingEntryPoint.h @@ -1,7 +1,7 @@ #pragma once -#include "Zone/Zone.h" #include "Zone/Stream/IZoneInputStream.h" +#include "Zone/Zone.h" class IContentLoadingEntryPoint { @@ -9,4 +9,4 @@ class IContentLoadingEntryPoint virtual ~IContentLoadingEntryPoint() = default; virtual void Load(Zone* zone, IZoneInputStream* stream) = 0; -}; \ No newline at end of file +}; diff --git a/src/ZoneLoading/Loading/ILoadingStep.h b/src/ZoneLoading/Loading/ILoadingStep.h index 2460e5b5a..6f29f718f 100644 --- a/src/ZoneLoading/Loading/ILoadingStep.h +++ b/src/ZoneLoading/Loading/ILoadingStep.h @@ -1,7 +1,7 @@ #pragma once -#include "Loading/ZoneLoader.h" #include "ILoadingStream.h" +#include "Loading/ZoneLoader.h" class ZoneLoader; diff --git a/src/ZoneLoading/Loading/ILoadingStream.h b/src/ZoneLoading/Loading/ILoadingStream.h index 95f7b1c49..aade82e1b 100644 --- a/src/ZoneLoading/Loading/ILoadingStream.h +++ b/src/ZoneLoading/Loading/ILoadingStream.h @@ -1,7 +1,7 @@ #pragma once -#include <cstdint> #include <cstddef> +#include <cstdint> class ILoadingStream { @@ -10,4 +10,4 @@ class ILoadingStream virtual size_t Load(void* buffer, size_t length) = 0; virtual int64_t Pos() = 0; -}; \ No newline at end of file +}; diff --git a/src/ZoneLoading/Loading/IZoneLoaderFactory.h b/src/ZoneLoading/Loading/IZoneLoaderFactory.h index 7cd03092f..988c763c0 100644 --- a/src/ZoneLoading/Loading/IZoneLoaderFactory.h +++ b/src/ZoneLoading/Loading/IZoneLoaderFactory.h @@ -14,4 +14,4 @@ class IZoneLoaderFactory IZoneLoaderFactory& operator=(IZoneLoaderFactory&& other) noexcept = default; virtual ZoneLoader* CreateLoaderForHeader(ZoneHeader& header, std::string& fileName) = 0; -}; \ No newline at end of file +}; diff --git a/src/ZoneLoading/Loading/LoadingFileStream.cpp b/src/ZoneLoading/Loading/LoadingFileStream.cpp index 807db569f..20da5a023 100644 --- a/src/ZoneLoading/Loading/LoadingFileStream.cpp +++ b/src/ZoneLoading/Loading/LoadingFileStream.cpp @@ -14,4 +14,4 @@ size_t LoadingFileStream::Load(void* buffer, const size_t length) int64_t LoadingFileStream::Pos() { return m_stream.tellg(); -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/LoadingFileStream.h b/src/ZoneLoading/Loading/LoadingFileStream.h index 21a7cc320..8073f4778 100644 --- a/src/ZoneLoading/Loading/LoadingFileStream.h +++ b/src/ZoneLoading/Loading/LoadingFileStream.h @@ -1,8 +1,8 @@ #pragma once -#include <istream> - #include "ILoadingStream.h" +#include <istream> + class LoadingFileStream final : public ILoadingStream { std::istream& m_stream; diff --git a/src/ZoneLoading/Loading/Processor/ProcessorAuthedBlocks.cpp b/src/ZoneLoading/Loading/Processor/ProcessorAuthedBlocks.cpp index 144fda654..aeb86e5a0 100644 --- a/src/ZoneLoading/Loading/Processor/ProcessorAuthedBlocks.cpp +++ b/src/ZoneLoading/Loading/Processor/ProcessorAuthedBlocks.cpp @@ -1,14 +1,14 @@ #include "ProcessorAuthedBlocks.h" -#include <cassert> -#include <memory> -#include <cstring> - #include "Game/IW4/IW4.h" #include "Loading/Exception/InvalidHashException.h" #include "Loading/Exception/TooManyAuthedGroupsException.h" #include "Loading/Exception/UnexpectedEndOfFileException.h" +#include <cassert> +#include <cstring> +#include <memory> + class ProcessorAuthedBlocks::Impl { ProcessorAuthedBlocks* const m_base; @@ -30,7 +30,9 @@ class ProcessorAuthedBlocks::Impl size_t m_current_chunk_size; public: - Impl(ProcessorAuthedBlocks* base, const unsigned authedChunkCount, const size_t chunkSize, + Impl(ProcessorAuthedBlocks* base, + const unsigned authedChunkCount, + const size_t chunkSize, const unsigned maxMasterBlockCount, std::unique_ptr<IHashFunction> hashFunction, IHashProvider* masterBlockHashProvider) @@ -76,8 +78,7 @@ class ProcessorAuthedBlocks::Impl m_master_block_hash_provider->GetHash(m_current_group - 1, &masterBlockHash, &masterBlockHashSize); if (masterBlockHashSize != m_hash_function->GetHashSize() - || std::memcmp(m_current_chunk_hash_buffer.get(), masterBlockHash, - m_hash_function->GetHashSize()) != 0) + || std::memcmp(m_current_chunk_hash_buffer.get(), masterBlockHash, m_hash_function->GetHashSize()) != 0) throw InvalidHashException(); memcpy(m_chunk_hashes_buffer.get(), m_chunk_buffer.get(), m_authed_chunk_count * m_hash_function->GetHashSize()); @@ -88,7 +89,8 @@ class ProcessorAuthedBlocks::Impl { if (std::memcmp(m_current_chunk_hash_buffer.get(), &m_chunk_hashes_buffer[(m_current_chunk_in_group - 1) * m_hash_function->GetHashSize()], - m_hash_function->GetHashSize()) != 0) + m_hash_function->GetHashSize()) + != 0) throw InvalidHashException(); if (++m_current_chunk_in_group > m_authed_chunk_count) @@ -136,12 +138,12 @@ class ProcessorAuthedBlocks::Impl } }; -ProcessorAuthedBlocks::ProcessorAuthedBlocks(const unsigned authedChunkCount, const size_t chunkSize, +ProcessorAuthedBlocks::ProcessorAuthedBlocks(const unsigned authedChunkCount, + const size_t chunkSize, const unsigned maxMasterBlockCount, std::unique_ptr<IHashFunction> hashFunction, IHashProvider* masterBlockHashProvider) - : m_impl(new Impl(this, authedChunkCount, chunkSize, maxMasterBlockCount, std::move(hashFunction), - masterBlockHashProvider)) + : m_impl(new Impl(this, authedChunkCount, chunkSize, maxMasterBlockCount, std::move(hashFunction), masterBlockHashProvider)) { } diff --git a/src/ZoneLoading/Loading/Processor/ProcessorAuthedBlocks.h b/src/ZoneLoading/Loading/Processor/ProcessorAuthedBlocks.h index b7be3891f..22a82e6e6 100644 --- a/src/ZoneLoading/Loading/Processor/ProcessorAuthedBlocks.h +++ b/src/ZoneLoading/Loading/Processor/ProcessorAuthedBlocks.h @@ -1,9 +1,9 @@ #pragma once -#include <memory> - #include "Crypto.h" -#include "Loading/StreamProcessor.h" #include "Loading/IHashProvider.h" +#include "Loading/StreamProcessor.h" + +#include <memory> class ProcessorAuthedBlocks final : public StreamProcessor { @@ -11,8 +11,11 @@ class ProcessorAuthedBlocks final : public StreamProcessor Impl* m_impl; public: - ProcessorAuthedBlocks(unsigned authedChunkCount, size_t chunkSize, unsigned maxMasterBlockCount, - std::unique_ptr<IHashFunction> hashFunction, IHashProvider* masterBlockHashProvider); + ProcessorAuthedBlocks(unsigned authedChunkCount, + size_t chunkSize, + unsigned maxMasterBlockCount, + std::unique_ptr<IHashFunction> hashFunction, + IHashProvider* masterBlockHashProvider); ~ProcessorAuthedBlocks() override; ProcessorAuthedBlocks(const ProcessorAuthedBlocks& other) = delete; ProcessorAuthedBlocks(ProcessorAuthedBlocks&& other) noexcept = default; diff --git a/src/ZoneLoading/Loading/Processor/ProcessorCaptureData.cpp b/src/ZoneLoading/Loading/Processor/ProcessorCaptureData.cpp index 8168d8047..f0b1b3b51 100644 --- a/src/ZoneLoading/Loading/Processor/ProcessorCaptureData.cpp +++ b/src/ZoneLoading/Loading/Processor/ProcessorCaptureData.cpp @@ -10,8 +10,7 @@ ProcessorCaptureData::ProcessorCaptureData(const size_t captureSize) { } -ProcessorCaptureData::~ProcessorCaptureData() -= default; +ProcessorCaptureData::~ProcessorCaptureData() = default; size_t ProcessorCaptureData::Load(void* buffer, const size_t length) { @@ -29,7 +28,7 @@ size_t ProcessorCaptureData::Load(void* buffer, const size_t length) m_captured_data_size += loadedSize; - if(length > dataToCapture) + if (length > dataToCapture) loadedSize += m_base_stream->Load(&static_cast<uint8_t*>(buffer)[dataToCapture], length - dataToCapture); return loadedSize; diff --git a/src/ZoneLoading/Loading/Processor/ProcessorCaptureData.h b/src/ZoneLoading/Loading/Processor/ProcessorCaptureData.h index 28f46bd81..4d6fac572 100644 --- a/src/ZoneLoading/Loading/Processor/ProcessorCaptureData.h +++ b/src/ZoneLoading/Loading/Processor/ProcessorCaptureData.h @@ -1,9 +1,9 @@ #pragma once -#include <memory> - #include "Loading/StreamProcessor.h" #include "Utils/ICapturedDataProvider.h" +#include <memory> + class ProcessorCaptureData final : public StreamProcessor, public ICapturedDataProvider { std::unique_ptr<uint8_t[]> m_data; diff --git a/src/ZoneLoading/Loading/Processor/ProcessorIW4xDecryption.cpp b/src/ZoneLoading/Loading/Processor/ProcessorIW4xDecryption.cpp index bb66145b3..c26157f97 100644 --- a/src/ZoneLoading/Loading/Processor/ProcessorIW4xDecryption.cpp +++ b/src/ZoneLoading/Loading/Processor/ProcessorIW4xDecryption.cpp @@ -24,7 +24,7 @@ size_t ProcessorIW4xDecryption::Load(void* buffer, const size_t length) const auto readLen = m_base_stream->Load(buffer, length); auto* charBuffer = static_cast<uint8_t*>(buffer); - for(auto i = 0u; i < readLen; i++) + for (auto i = 0u; i < readLen; i++) { auto value = charBuffer[i]; value ^= m_last_byte; diff --git a/src/ZoneLoading/Loading/Processor/ProcessorInflate.cpp b/src/ZoneLoading/Loading/Processor/ProcessorInflate.cpp index 2a4c7a520..afda6ba6b 100644 --- a/src/ZoneLoading/Loading/Processor/ProcessorInflate.cpp +++ b/src/ZoneLoading/Loading/Processor/ProcessorInflate.cpp @@ -1,13 +1,13 @@ #include "ProcessorInflate.h" -#include <stdexcept> +#include "Loading/Exception/InvalidCompressionException.h" + #include <cstdint> #include <memory> +#include <stdexcept> #include <zlib.h> #include <zutil.h> -#include "Loading/Exception/InvalidCompressionException.h" - class ProcessorInflate::Impl { z_stream m_stream{}; @@ -65,7 +65,7 @@ class ProcessorInflate::Impl auto ret = inflate(&m_stream, Z_SYNC_FLUSH); - if(ret < 0) + if (ret < 0) throw InvalidCompressionException(); } diff --git a/src/ZoneLoading/Loading/Processor/ProcessorStreamCipher.cpp b/src/ZoneLoading/Loading/Processor/ProcessorStreamCipher.cpp index 8dfaf4c76..5a03ace9b 100644 --- a/src/ZoneLoading/Loading/Processor/ProcessorStreamCipher.cpp +++ b/src/ZoneLoading/Loading/Processor/ProcessorStreamCipher.cpp @@ -11,18 +11,17 @@ ProcessorStreamCipher::~ProcessorStreamCipher() m_cipher = nullptr; } - size_t ProcessorStreamCipher::Load(void* buffer, const size_t length) { - if(m_base_stream != nullptr) + if (m_base_stream != nullptr) { const size_t readSize = m_base_stream->Load(buffer, length); - if(readSize > 0) + if (readSize > 0) m_cipher->Process(buffer, buffer, readSize); return readSize; } return 0; -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/Processor/ProcessorStreamCipher.h b/src/ZoneLoading/Loading/Processor/ProcessorStreamCipher.h index cb81ef5f4..ebcc3b243 100644 --- a/src/ZoneLoading/Loading/Processor/ProcessorStreamCipher.h +++ b/src/ZoneLoading/Loading/Processor/ProcessorStreamCipher.h @@ -1,6 +1,6 @@ #pragma once -#include "Loading/StreamProcessor.h" #include "Crypto.h" +#include "Loading/StreamProcessor.h" class ProcessorStreamCipher final : public StreamProcessor { diff --git a/src/ZoneLoading/Loading/Processor/ProcessorXChunks.cpp b/src/ZoneLoading/Loading/Processor/ProcessorXChunks.cpp index 80e655995..11553fe06 100644 --- a/src/ZoneLoading/Loading/Processor/ProcessorXChunks.cpp +++ b/src/ZoneLoading/Loading/Processor/ProcessorXChunks.cpp @@ -1,14 +1,15 @@ #include "ProcessorXChunks.h" -#include "Zone/ZoneTypes.h" + #include "Loading/Exception/InvalidChunkSizeException.h" +#include "Zone/ZoneTypes.h" -#include <vector> -#include <thread> -#include <mutex> -#include <condition_variable> #include <cassert> +#include <condition_variable> #include <cstring> #include <memory> +#include <mutex> +#include <thread> +#include <vector> class DBLoadStream { @@ -59,15 +60,15 @@ class DBLoadStream } public: - DBLoadStream(const int streamIndex, const size_t chunkSize, - std::vector<std::unique_ptr<IXChunkProcessor>>& chunkProcessors) : m_processors(chunkProcessors) + DBLoadStream(const int streamIndex, const size_t chunkSize, std::vector<std::unique_ptr<IXChunkProcessor>>& chunkProcessors) + : m_processors(chunkProcessors) { m_index = streamIndex; m_chunk_size = chunkSize; - for(auto& buffer : m_buffers) + for (auto& buffer : m_buffers) buffer = std::make_unique<uint8_t[]>(chunkSize); - + m_input_buffer = m_buffers[0].get(); m_output_buffer = m_buffers[1].get(); @@ -246,8 +247,8 @@ class ProcessorXChunks::ProcessorXChunksImpl m_eof_stream = 0; } - ProcessorXChunksImpl(ProcessorXChunks* base, const int numStreams, const size_t xChunkSize, - const size_t vanillaBufferSize) : ProcessorXChunksImpl(base, numStreams, xChunkSize) + ProcessorXChunksImpl(ProcessorXChunks* base, const int numStreams, const size_t xChunkSize, const size_t vanillaBufferSize) + : ProcessorXChunksImpl(base, numStreams, xChunkSize) { m_vanilla_buffer_size = vanillaBufferSize; } @@ -334,4 +335,4 @@ size_t ProcessorXChunks::Load(void* buffer, const size_t length) int64_t ProcessorXChunks::Pos() { return m_impl->Pos(); -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/Processor/ProcessorXChunks.h b/src/ZoneLoading/Loading/Processor/ProcessorXChunks.h index f3f82e447..924f799b2 100644 --- a/src/ZoneLoading/Loading/Processor/ProcessorXChunks.h +++ b/src/ZoneLoading/Loading/Processor/ProcessorXChunks.h @@ -1,9 +1,9 @@ #pragma once -#include <memory> - #include "Loading/StreamProcessor.h" #include "Zone/XChunk/IXChunkProcessor.h" +#include <memory> + class ProcessorXChunks : public StreamProcessor { class ProcessorXChunksImpl; diff --git a/src/ZoneLoading/Loading/Steps/StepAddProcessor.cpp b/src/ZoneLoading/Loading/Steps/StepAddProcessor.cpp index 9c8d23d9f..f86e9c934 100644 --- a/src/ZoneLoading/Loading/Steps/StepAddProcessor.cpp +++ b/src/ZoneLoading/Loading/Steps/StepAddProcessor.cpp @@ -1,4 +1,5 @@ #include "StepAddProcessor.h" + #include <cassert> StepAddProcessor::StepAddProcessor(std::unique_ptr<StreamProcessor> streamProcessor) @@ -13,4 +14,4 @@ void StepAddProcessor::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* strea zoneLoader->AddStreamProcessor(std::move(m_stream_processor)); m_stream_processor = nullptr; -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/Steps/StepAddProcessor.h b/src/ZoneLoading/Loading/Steps/StepAddProcessor.h index 72bf92b40..661ec0e6b 100644 --- a/src/ZoneLoading/Loading/Steps/StepAddProcessor.h +++ b/src/ZoneLoading/Loading/Steps/StepAddProcessor.h @@ -1,9 +1,9 @@ #pragma once -#include <memory> - #include "Loading/ILoadingStep.h" +#include <memory> + class StepAddProcessor final : public ILoadingStep { std::unique_ptr<StreamProcessor> m_stream_processor; diff --git a/src/ZoneLoading/Loading/Steps/StepAllocXBlocks.cpp b/src/ZoneLoading/Loading/Steps/StepAllocXBlocks.cpp index 52dc7d44f..aa9e27865 100644 --- a/src/ZoneLoading/Loading/Steps/StepAllocXBlocks.cpp +++ b/src/ZoneLoading/Loading/Steps/StepAllocXBlocks.cpp @@ -1,4 +1,5 @@ #include "StepAllocXBlocks.h" + #include "Loading/Exception/InvalidXBlockSizeException.h" const uint64_t StepAllocXBlocks::MAX_XBLOCK_SIZE = 0x3C000000; @@ -11,20 +12,20 @@ void StepAllocXBlocks::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* strea stream->Load(blockSizes, sizeof(xblock_size_t) * blockCount); uint64_t totalMemory = 0; - for(unsigned int block = 0; block < blockCount; block++) + for (unsigned int block = 0; block < blockCount; block++) { totalMemory += blockSizes[block]; } - if(totalMemory > MAX_XBLOCK_SIZE) + if (totalMemory > MAX_XBLOCK_SIZE) { throw InvalidXBlockSizeException(totalMemory, MAX_XBLOCK_SIZE); } - for(unsigned int block = 0; block < blockCount; block++) + for (unsigned int block = 0; block < blockCount; block++) { zoneLoader->m_blocks[block]->Alloc(blockSizes[block]); } delete[] blockSizes; -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/Steps/StepDumpData.cpp b/src/ZoneLoading/Loading/Steps/StepDumpData.cpp index 960227efe..9257b8117 100644 --- a/src/ZoneLoading/Loading/Steps/StepDumpData.cpp +++ b/src/ZoneLoading/Loading/Steps/StepDumpData.cpp @@ -37,4 +37,4 @@ void StepDumpData::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) } tempFile.close(); -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/Steps/StepDumpData.h b/src/ZoneLoading/Loading/Steps/StepDumpData.h index 021e73913..648bdea3a 100644 --- a/src/ZoneLoading/Loading/Steps/StepDumpData.h +++ b/src/ZoneLoading/Loading/Steps/StepDumpData.h @@ -10,4 +10,4 @@ class StepDumpData final : public ILoadingStep explicit StepDumpData(unsigned int dumpCount); void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override; -}; \ No newline at end of file +}; diff --git a/src/ZoneLoading/Loading/Steps/StepLoadHash.cpp b/src/ZoneLoading/Loading/Steps/StepLoadHash.cpp index 847f5c5be..545ccd847 100644 --- a/src/ZoneLoading/Loading/Steps/StepLoadHash.cpp +++ b/src/ZoneLoading/Loading/Steps/StepLoadHash.cpp @@ -1,5 +1,7 @@ #include "StepLoadHash.h" + #include "Loading/Exception/UnexpectedEndOfFileException.h" + #include <cassert> StepLoadHash::StepLoadHash(const size_t hashSize, const unsigned hashCount) @@ -9,8 +11,7 @@ StepLoadHash::StepLoadHash(const size_t hashSize, const unsigned hashCount) { } -StepLoadHash::~StepLoadHash() -= default; +StepLoadHash::~StepLoadHash() = default; void StepLoadHash::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) { @@ -36,7 +37,7 @@ void StepLoadHash::GetCapturedData(const uint8_t** pCapturedData, size_t* pSize) { assert(pCapturedData != nullptr); assert(pSize != nullptr); - + *pCapturedData = m_hashes.get(); *pSize = m_hash_size * m_hash_count; } diff --git a/src/ZoneLoading/Loading/Steps/StepLoadHash.h b/src/ZoneLoading/Loading/Steps/StepLoadHash.h index bc5dbe576..c7e4cdf88 100644 --- a/src/ZoneLoading/Loading/Steps/StepLoadHash.h +++ b/src/ZoneLoading/Loading/Steps/StepLoadHash.h @@ -1,10 +1,10 @@ #pragma once -#include <memory> - -#include "Utils/ICapturedDataProvider.h" -#include "Loading/ILoadingStep.h" #include "Loading/IHashProvider.h" +#include "Loading/ILoadingStep.h" +#include "Utils/ICapturedDataProvider.h" + +#include <memory> class StepLoadHash final : public ILoadingStep, public IHashProvider, public ICapturedDataProvider { diff --git a/src/ZoneLoading/Loading/Steps/StepLoadSignature.cpp b/src/ZoneLoading/Loading/Steps/StepLoadSignature.cpp index beae7ef15..8fbc19e81 100644 --- a/src/ZoneLoading/Loading/Steps/StepLoadSignature.cpp +++ b/src/ZoneLoading/Loading/Steps/StepLoadSignature.cpp @@ -1,5 +1,7 @@ #include "StepLoadSignature.h" + #include "Loading/Exception/UnexpectedEndOfFileException.h" + #include <cassert> StepLoadSignature::StepLoadSignature(const size_t signatureSize) @@ -17,8 +19,8 @@ StepLoadSignature::~StepLoadSignature() void StepLoadSignature::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) { assert(stream != nullptr); - - if(stream->Load(m_signature, m_signature_size) != m_signature_size) + + if (stream->Load(m_signature, m_signature_size) != m_signature_size) throw UnexpectedEndOfFileException(); } @@ -31,4 +33,4 @@ void StepLoadSignature::GetSignature(const uint8_t** pSignature, size_t* pSize) *pSignature = m_signature; *pSize = m_signature_size; -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/Steps/StepLoadZoneContent.cpp b/src/ZoneLoading/Loading/Steps/StepLoadZoneContent.cpp index 16360fe6a..fa4e1c67d 100644 --- a/src/ZoneLoading/Loading/Steps/StepLoadZoneContent.cpp +++ b/src/ZoneLoading/Loading/Steps/StepLoadZoneContent.cpp @@ -1,8 +1,13 @@ #include "StepLoadZoneContent.h" + #include "Zone/Stream/Impl/XBlockInputStream.h" + #include <cassert> -StepLoadZoneContent::StepLoadZoneContent(std::unique_ptr<IContentLoadingEntryPoint> entryPoint, Zone* zone, const int offsetBlockBitCount, const block_t insertBlock) +StepLoadZoneContent::StepLoadZoneContent(std::unique_ptr<IContentLoadingEntryPoint> entryPoint, + Zone* zone, + const int offsetBlockBitCount, + const block_t insertBlock) : m_content_loader(std::move(entryPoint)), m_zone(zone), m_offset_block_bit_count(offsetBlockBitCount), diff --git a/src/ZoneLoading/Loading/Steps/StepLoadZoneContent.h b/src/ZoneLoading/Loading/Steps/StepLoadZoneContent.h index d0c5bcbeb..450c7f163 100644 --- a/src/ZoneLoading/Loading/Steps/StepLoadZoneContent.h +++ b/src/ZoneLoading/Loading/Steps/StepLoadZoneContent.h @@ -1,9 +1,9 @@ #pragma once -#include <memory> - -#include "Loading/ILoadingStep.h" #include "Loading/IContentLoadingEntryPoint.h" +#include "Loading/ILoadingStep.h" + +#include <memory> class StepLoadZoneContent final : public ILoadingStep { diff --git a/src/ZoneLoading/Loading/Steps/StepLoadZoneSizes.h b/src/ZoneLoading/Loading/Steps/StepLoadZoneSizes.h index eac0c3cb2..10061adf4 100644 --- a/src/ZoneLoading/Loading/Steps/StepLoadZoneSizes.h +++ b/src/ZoneLoading/Loading/Steps/StepLoadZoneSizes.h @@ -1,9 +1,9 @@ #pragma once -#include <cstddef> - -#include "Utils/ClassUtils.h" #include "Loading/ILoadingStep.h" +#include "Utils/ClassUtils.h" + +#include <cstddef> class StepLoadZoneSizes final : public ILoadingStep { diff --git a/src/ZoneLoading/Loading/Steps/StepRemoveProcessor.cpp b/src/ZoneLoading/Loading/Steps/StepRemoveProcessor.cpp index 343bce187..521f93b5e 100644 --- a/src/ZoneLoading/Loading/Steps/StepRemoveProcessor.cpp +++ b/src/ZoneLoading/Loading/Steps/StepRemoveProcessor.cpp @@ -1,4 +1,5 @@ #include "StepRemoveProcessor.h" + #include <cassert> StepRemoveProcessor::StepRemoveProcessor(StreamProcessor* streamProcessor) diff --git a/src/ZoneLoading/Loading/Steps/StepSkipBytes.cpp b/src/ZoneLoading/Loading/Steps/StepSkipBytes.cpp index f2849c231..52dcd09d6 100644 --- a/src/ZoneLoading/Loading/Steps/StepSkipBytes.cpp +++ b/src/ZoneLoading/Loading/Steps/StepSkipBytes.cpp @@ -10,11 +10,11 @@ void StepSkipBytes::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) uint8_t tempBuffer[128]; unsigned int skippedBytes = 0; - while(skippedBytes < m_skip_count) + while (skippedBytes < m_skip_count) { unsigned int toSkip; - if(m_skip_count - skippedBytes < sizeof(tempBuffer)) + if (m_skip_count - skippedBytes < sizeof(tempBuffer)) { toSkip = m_skip_count - skippedBytes; } @@ -27,4 +27,4 @@ void StepSkipBytes::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) skippedBytes += toSkip; } -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/Steps/StepSkipBytes.h b/src/ZoneLoading/Loading/Steps/StepSkipBytes.h index 2166f8757..eaedf563b 100644 --- a/src/ZoneLoading/Loading/Steps/StepSkipBytes.h +++ b/src/ZoneLoading/Loading/Steps/StepSkipBytes.h @@ -10,4 +10,4 @@ class StepSkipBytes final : public ILoadingStep explicit StepSkipBytes(unsigned int skipCount); void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override; -}; \ No newline at end of file +}; diff --git a/src/ZoneLoading/Loading/Steps/StepVerifyFileName.cpp b/src/ZoneLoading/Loading/Steps/StepVerifyFileName.cpp index 3f633f633..eeeaa8860 100644 --- a/src/ZoneLoading/Loading/Steps/StepVerifyFileName.cpp +++ b/src/ZoneLoading/Loading/Steps/StepVerifyFileName.cpp @@ -1,15 +1,15 @@ #include "StepVerifyFileName.h" -#include <sstream> - #include "Loading/Exception/InvalidFileNameException.h" +#include <sstream> + StepVerifyFileName::StepVerifyFileName(std::string fileName, const size_t fileNameBufferSize) { m_file_name = std::move(fileName); m_file_name_buffer_size = fileNameBufferSize; - if(m_file_name.length() > m_file_name_buffer_size) + if (m_file_name.length() > m_file_name_buffer_size) m_file_name.erase(m_file_name_buffer_size); } @@ -19,12 +19,12 @@ void StepVerifyFileName::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* str unsigned bufferOffset = 0; char c; - for(; bufferOffset < m_file_name_buffer_size; bufferOffset++) + for (; bufferOffset < m_file_name_buffer_size; bufferOffset++) { stream->Load(&c, sizeof(char)); - if(c == '\00') + if (c == '\00') { bufferOffset++; break; @@ -34,7 +34,7 @@ void StepVerifyFileName::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* str } // Skip the rest of the buffer which should be null bytes - while(bufferOffset < m_file_name_buffer_size) + while (bufferOffset < m_file_name_buffer_size) { stream->Load(&c, sizeof(char)); bufferOffset++; @@ -42,6 +42,6 @@ void StepVerifyFileName::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* str std::string originalFileName = originalFilenameStream.str(); - if(originalFileName != m_file_name) + if (originalFileName != m_file_name) throw InvalidFileNameException(m_file_name, originalFileName); -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/Steps/StepVerifyFileName.h b/src/ZoneLoading/Loading/Steps/StepVerifyFileName.h index be9447ebe..4f021ec8f 100644 --- a/src/ZoneLoading/Loading/Steps/StepVerifyFileName.h +++ b/src/ZoneLoading/Loading/Steps/StepVerifyFileName.h @@ -11,4 +11,4 @@ class StepVerifyFileName final : public ILoadingStep explicit StepVerifyFileName(std::string fileName, size_t fileNameBufferSize); void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override; -}; \ No newline at end of file +}; diff --git a/src/ZoneLoading/Loading/Steps/StepVerifyHash.cpp b/src/ZoneLoading/Loading/Steps/StepVerifyHash.cpp index 55936d08e..7264000d9 100644 --- a/src/ZoneLoading/Loading/Steps/StepVerifyHash.cpp +++ b/src/ZoneLoading/Loading/Steps/StepVerifyHash.cpp @@ -1,12 +1,14 @@ #include "StepVerifyHash.h" -#include <memory> -#include <cstring> - #include "Loading/Exception/InvalidHashException.h" -StepVerifyHash::StepVerifyHash(std::unique_ptr<IHashFunction> hashFunction, const unsigned hashIndex, IHashProvider* hashProvider, - ICapturedDataProvider* dataProvider) +#include <cstring> +#include <memory> + +StepVerifyHash::StepVerifyHash(std::unique_ptr<IHashFunction> hashFunction, + const unsigned hashIndex, + IHashProvider* hashProvider, + ICapturedDataProvider* dataProvider) : m_hash_function(std::move(hashFunction)), m_hash_index(hashIndex), m_hash_provider(hashProvider), @@ -14,8 +16,7 @@ StepVerifyHash::StepVerifyHash(std::unique_ptr<IHashFunction> hashFunction, cons { } -StepVerifyHash::~StepVerifyHash() -= default; +StepVerifyHash::~StepVerifyHash() = default; void StepVerifyHash::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) { @@ -35,6 +36,6 @@ void StepVerifyHash::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) m_hash_function->Process(dataToHash, dataToHashSize); m_hash_function->Finish(hashMemory.get()); - if(std::memcmp(hashData, hashMemory.get(), m_hash_function->GetHashSize()) != 0) + if (std::memcmp(hashData, hashMemory.get(), m_hash_function->GetHashSize()) != 0) throw InvalidHashException(); } diff --git a/src/ZoneLoading/Loading/Steps/StepVerifyHash.h b/src/ZoneLoading/Loading/Steps/StepVerifyHash.h index bc3bcb7b9..b02b40788 100644 --- a/src/ZoneLoading/Loading/Steps/StepVerifyHash.h +++ b/src/ZoneLoading/Loading/Steps/StepVerifyHash.h @@ -1,11 +1,11 @@ #pragma once -#include <memory> - #include "Crypto.h" +#include "Loading/IHashProvider.h" #include "Loading/ILoadingStep.h" #include "Utils/ICapturedDataProvider.h" -#include "Loading/IHashProvider.h" + +#include <memory> class StepVerifyHash final : public ILoadingStep { diff --git a/src/ZoneLoading/Loading/Steps/StepVerifyMagic.cpp b/src/ZoneLoading/Loading/Steps/StepVerifyMagic.cpp index 4e9b13cd7..047f42847 100644 --- a/src/ZoneLoading/Loading/Steps/StepVerifyMagic.cpp +++ b/src/ZoneLoading/Loading/Steps/StepVerifyMagic.cpp @@ -1,9 +1,9 @@ #include "StepVerifyMagic.h" -#include <cstring> - #include "Loading/Exception/InvalidMagicException.h" +#include <cstring> + StepVerifyMagic::StepVerifyMagic(const char* magic) { m_magic = magic; @@ -14,11 +14,11 @@ void StepVerifyMagic::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream { char currentCharacter; - for(unsigned i = 0; i < m_magic_len; i++) + for (unsigned i = 0; i < m_magic_len; i++) { stream->Load(¤tCharacter, sizeof(char)); - if(currentCharacter != m_magic[i]) + if (currentCharacter != m_magic[i]) throw InvalidMagicException(m_magic); } -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/Steps/StepVerifyMagic.h b/src/ZoneLoading/Loading/Steps/StepVerifyMagic.h index 3fa35bd82..9eed74101 100644 --- a/src/ZoneLoading/Loading/Steps/StepVerifyMagic.h +++ b/src/ZoneLoading/Loading/Steps/StepVerifyMagic.h @@ -11,4 +11,4 @@ class StepVerifyMagic final : public ILoadingStep explicit StepVerifyMagic(const char* magic); void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override; -}; \ No newline at end of file +}; diff --git a/src/ZoneLoading/Loading/Steps/StepVerifySignature.cpp b/src/ZoneLoading/Loading/Steps/StepVerifySignature.cpp index 728240823..c5f2e74ef 100644 --- a/src/ZoneLoading/Loading/Steps/StepVerifySignature.cpp +++ b/src/ZoneLoading/Loading/Steps/StepVerifySignature.cpp @@ -1,8 +1,12 @@ #include "StepVerifySignature.h" + #include "Loading/Exception/InvalidSignatureException.h" + #include <cassert> -StepVerifySignature::StepVerifySignature(std::unique_ptr<IPublicKeyAlgorithm> signatureAlgorithm, ISignatureProvider* signatureProvider, ICapturedDataProvider* signatureDataProvider) +StepVerifySignature::StepVerifySignature(std::unique_ptr<IPublicKeyAlgorithm> signatureAlgorithm, + ISignatureProvider* signatureProvider, + ICapturedDataProvider* signatureDataProvider) : m_algorithm(std::move(signatureAlgorithm)), m_signature_provider(signatureProvider), m_signature_data_provider(signatureDataProvider) diff --git a/src/ZoneLoading/Loading/Steps/StepVerifySignature.h b/src/ZoneLoading/Loading/Steps/StepVerifySignature.h index 2beb0d39c..f415ebead 100644 --- a/src/ZoneLoading/Loading/Steps/StepVerifySignature.h +++ b/src/ZoneLoading/Loading/Steps/StepVerifySignature.h @@ -1,7 +1,7 @@ #pragma once -#include "Loading/ILoadingStep.h" #include "Crypto.h" +#include "Loading/ILoadingStep.h" #include "Loading/ISignatureProvider.h" #include "Utils/ICapturedDataProvider.h" @@ -12,7 +12,9 @@ class StepVerifySignature final : public ILoadingStep ICapturedDataProvider* m_signature_data_provider; public: - StepVerifySignature(std::unique_ptr<IPublicKeyAlgorithm> signatureAlgorithm, ISignatureProvider* signatureProvider, ICapturedDataProvider* signatureDataProvider); + StepVerifySignature(std::unique_ptr<IPublicKeyAlgorithm> signatureAlgorithm, + ISignatureProvider* signatureProvider, + ICapturedDataProvider* signatureDataProvider); ~StepVerifySignature() override = default; StepVerifySignature(const StepVerifySignature& other) = delete; StepVerifySignature(StepVerifySignature&& other) noexcept = default; @@ -20,4 +22,4 @@ class StepVerifySignature final : public ILoadingStep StepVerifySignature& operator=(StepVerifySignature&& other) noexcept = default; void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override; -}; \ No newline at end of file +}; diff --git a/src/ZoneLoading/Loading/StreamProcessor.cpp b/src/ZoneLoading/Loading/StreamProcessor.cpp index d6d4daf1f..be296763d 100644 --- a/src/ZoneLoading/Loading/StreamProcessor.cpp +++ b/src/ZoneLoading/Loading/StreamProcessor.cpp @@ -8,4 +8,4 @@ StreamProcessor::StreamProcessor() void StreamProcessor::SetBaseStream(ILoadingStream* baseStream) { m_base_stream = baseStream; -} \ No newline at end of file +} diff --git a/src/ZoneLoading/Loading/ZoneLoader.cpp b/src/ZoneLoading/Loading/ZoneLoader.cpp index 22e407485..14557334c 100644 --- a/src/ZoneLoading/Loading/ZoneLoader.cpp +++ b/src/ZoneLoading/Loading/ZoneLoader.cpp @@ -1,10 +1,10 @@ #include "ZoneLoader.h" -#include <algorithm> - #include "Exception/LoadingException.h" #include "LoadingFileStream.h" +#include <algorithm> + ZoneLoader::ZoneLoader(std::unique_ptr<Zone> zone) : m_processor_chain_dirty(false), m_zone(std::move(zone)) @@ -30,10 +30,12 @@ void ZoneLoader::AddXBlock(std::unique_ptr<XBlock> block) { m_blocks.push_back(block.get()); - std::sort(m_blocks.begin(), m_blocks.end(), [](XBlock* b1, XBlock* b2) -> bool - { - return b1->m_index < b2->m_index; - }); + std::sort(m_blocks.begin(), + m_blocks.end(), + [](XBlock* b1, XBlock* b2) -> bool + { + return b1->m_index < b2->m_index; + }); m_zone->GetMemory()->AddBlock(std::move(block)); } diff --git a/src/ZoneLoading/Loading/ZoneLoader.h b/src/ZoneLoading/Loading/ZoneLoader.h index ad0d4689f..f0bfe3f17 100644 --- a/src/ZoneLoading/Loading/ZoneLoader.h +++ b/src/ZoneLoading/Loading/ZoneLoader.h @@ -1,13 +1,13 @@ #pragma once #include "ILoadingStep.h" -#include "Zone/Zone.h" -#include "Zone/XBlock.h" #include "StreamProcessor.h" +#include "Zone/XBlock.h" +#include "Zone/Zone.h" -#include <vector> #include <istream> #include <memory> +#include <vector> class ILoadingStep; diff --git a/src/ZoneLoading/Zone/Stream/IZoneInputStream.h b/src/ZoneLoading/Zone/Stream/IZoneInputStream.h index 4738ec438..b1158e177 100644 --- a/src/ZoneLoading/Zone/Stream/IZoneInputStream.h +++ b/src/ZoneLoading/Zone/Stream/IZoneInputStream.h @@ -1,17 +1,16 @@ #pragma once -#include <cstdint> -#include <cstddef> - #include "Zone/Stream/IZoneStream.h" +#include <cstddef> +#include <cstdint> + class IZoneInputStream : public IZoneStream { public: virtual void* Alloc(unsigned align) = 0; - template<typename T> - T* Alloc(const unsigned align) + template<typename T> T* Alloc(const unsigned align) { return static_cast<T*>(Alloc(align)); } @@ -21,41 +20,38 @@ class IZoneInputStream : public IZoneStream virtual void IncBlockPos(size_t size) = 0; virtual void LoadNullTerminated(void* dst) = 0; - template<typename T> - void Load(T* dst) + template<typename T> void Load(T* dst) { LoadDataInBlock(const_cast<void*>(reinterpret_cast<const void*>(dst)), sizeof(T)); } - template<typename T> - void Load(T* dst, const uint32_t count) + template<typename T> void Load(T* dst, const uint32_t count) { LoadDataInBlock(const_cast<void*>(reinterpret_cast<const void*>(dst)), count * sizeof(T)); } - template<typename T> - void LoadPartial(T* dst, const size_t size) + template<typename T> void LoadPartial(T* dst, const size_t size) { LoadDataInBlock(const_cast<void*>(reinterpret_cast<const void*>(dst)), size); } virtual void** InsertPointer() = 0; - template<typename T> - T** InsertPointer() + + template<typename T> T** InsertPointer() { return reinterpret_cast<T**>(InsertPointer()); } virtual void* ConvertOffsetToPointer(const void* offset) = 0; - template<typename T> - T* ConvertOffsetToPointer(T* offset) + + template<typename T> T* ConvertOffsetToPointer(T* offset) { return static_cast<T*>(ConvertOffsetToPointer(static_cast<const void*>(offset))); } virtual void* ConvertOffsetToAlias(const void* offset) = 0; - template<typename T> - T* ConvertOffsetToAlias(T* offset) + + template<typename T> T* ConvertOffsetToAlias(T* offset) { return static_cast<T*>(ConvertOffsetToAlias(static_cast<const void*>(offset))); } diff --git a/src/ZoneLoading/Zone/Stream/Impl/XBlockInputStream.cpp b/src/ZoneLoading/Zone/Stream/Impl/XBlockInputStream.cpp index 0c2466540..f1e59b344 100644 --- a/src/ZoneLoading/Zone/Stream/Impl/XBlockInputStream.cpp +++ b/src/ZoneLoading/Zone/Stream/Impl/XBlockInputStream.cpp @@ -1,15 +1,15 @@ #include "XBlockInputStream.h" -#include <cassert> -#include <cstring> - #include "Loading/Exception/BlockOverflowException.h" #include "Loading/Exception/InvalidOffsetBlockException.h" #include "Loading/Exception/InvalidOffsetBlockOffsetException.h" #include "Loading/Exception/OutOfBlockBoundsException.h" -XBlockInputStream::XBlockInputStream(std::vector<XBlock*>& blocks, ILoadingStream* stream, const int blockBitCount, - const block_t insertBlock) : m_blocks(blocks) +#include <cassert> +#include <cstring> + +XBlockInputStream::XBlockInputStream(std::vector<XBlock*>& blocks, ILoadingStream* stream, const int blockBitCount, const block_t insertBlock) + : m_blocks(blocks) { m_stream = stream; @@ -51,7 +51,7 @@ void XBlockInputStream::PushBlock(const block_t block) m_block_stack.push(newBlock); - if(newBlock->m_type == XBlock::Type::BLOCK_TYPE_TEMP) + if (newBlock->m_type == XBlock::Type::BLOCK_TYPE_TEMP) { m_temp_offsets.push(m_block_offsets[newBlock->m_index]); } @@ -140,7 +140,6 @@ void XBlockInputStream::LoadDataInBlock(void* dst, const size_t size) break; } - IncBlockPos(size); } @@ -183,8 +182,7 @@ void XBlockInputStream::LoadNullTerminated(void* dst) m_stream->Load(&byte, 1); block->m_buffer[offset++] = byte; - } - while (byte != 0); + } while (byte != 0); m_block_offsets[block->m_index] = offset; } diff --git a/src/ZoneLoading/Zone/Stream/Impl/XBlockInputStream.h b/src/ZoneLoading/Zone/Stream/Impl/XBlockInputStream.h index 1c6c8d36f..bbaba39d1 100644 --- a/src/ZoneLoading/Zone/Stream/Impl/XBlockInputStream.h +++ b/src/ZoneLoading/Zone/Stream/Impl/XBlockInputStream.h @@ -1,11 +1,11 @@ #pragma once +#include "Loading/ILoadingStream.h" #include "Zone/Stream/IZoneInputStream.h" #include "Zone/XBlock.h" -#include "Loading/ILoadingStream.h" -#include <vector> #include <stack> +#include <vector> class XBlockInputStream final : public IZoneInputStream { @@ -39,5 +39,4 @@ class XBlockInputStream final : public IZoneInputStream void* ConvertOffsetToPointer(const void* offset) override; void* ConvertOffsetToAlias(const void* offset) override; - }; diff --git a/src/ZoneLoading/ZoneLoading.cpp b/src/ZoneLoading/ZoneLoading.cpp index 995c011cd..cf9041de2 100644 --- a/src/ZoneLoading/ZoneLoading.cpp +++ b/src/ZoneLoading/ZoneLoading.cpp @@ -1,9 +1,5 @@ #include "ZoneLoading.h" -#include <filesystem> -#include <fstream> -#include <iostream> - #include "Game/IW3/ZoneLoaderFactoryIW3.h" #include "Game/IW4/ZoneLoaderFactoryIW4.h" #include "Game/IW5/ZoneLoaderFactoryIW5.h" @@ -11,23 +7,21 @@ #include "Game/T6/ZoneLoaderFactoryT6.h" #include "Utils/ObjFileStream.h" +#include <filesystem> +#include <fstream> +#include <iostream> + namespace fs = std::filesystem; -IZoneLoaderFactory* ZoneLoaderFactories[] -{ - new IW3::ZoneLoaderFactory(), - new IW4::ZoneLoaderFactory(), - new IW5::ZoneLoaderFactory(), - new T5::ZoneLoaderFactory(), - new T6::ZoneLoaderFactory() -}; +IZoneLoaderFactory* ZoneLoaderFactories[]{ + new IW3::ZoneLoaderFactory(), new IW4::ZoneLoaderFactory(), new IW5::ZoneLoaderFactory(), new T5::ZoneLoaderFactory(), new T6::ZoneLoaderFactory()}; std::unique_ptr<Zone> ZoneLoading::LoadZone(const std::string& path) { auto zoneName = fs::path(path).filename().replace_extension("").string(); std::ifstream file(path, std::fstream::in | std::fstream::binary); - if(!file.is_open()) + if (!file.is_open()) { printf("Could not open file '%s'.\n", path.c_str()); return nullptr; @@ -35,22 +29,22 @@ std::unique_ptr<Zone> ZoneLoading::LoadZone(const std::string& path) ZoneHeader header{}; file.read(reinterpret_cast<char*>(&header), sizeof header); - if(file.gcount() != sizeof header) + if (file.gcount() != sizeof header) { std::cout << "Failed to read zone header from file '" << path << "'.\n"; return nullptr; } ZoneLoader* zoneLoader = nullptr; - for(auto* factory : ZoneLoaderFactories) + for (auto* factory : ZoneLoaderFactories) { zoneLoader = factory->CreateLoaderForHeader(header, zoneName); - if(zoneLoader != nullptr) + if (zoneLoader != nullptr) break; } - if(zoneLoader == nullptr) + if (zoneLoader == nullptr) { printf("Could not create factory for zone '%s'.\n", zoneName.c_str()); return nullptr; @@ -61,4 +55,4 @@ std::unique_ptr<Zone> ZoneLoading::LoadZone(const std::string& path) file.close(); return std::move(loadedZone); -} \ No newline at end of file +} diff --git a/src/ZoneLoading/ZoneLoading.h b/src/ZoneLoading/ZoneLoading.h index 3017e115f..749db0506 100644 --- a/src/ZoneLoading/ZoneLoading.h +++ b/src/ZoneLoading/ZoneLoading.h @@ -1,8 +1,8 @@ #pragma once -#include <string> - #include "Zone/Zone.h" +#include <string> + class ZoneLoading { public: diff --git a/src/ZoneWriting/Game/IW3/ContentWriterIW3.cpp b/src/ZoneWriting/Game/IW3/ContentWriterIW3.cpp index 161beaa19..f27386863 100644 --- a/src/ZoneWriting/Game/IW3/ContentWriterIW3.cpp +++ b/src/ZoneWriting/Game/IW3/ContentWriterIW3.cpp @@ -1,8 +1,5 @@ #include "ContentWriterIW3.h" -#include <cassert> -#include <sstream> - #include "Game/IW3/XAssets/clipmap_t/clipmap_t_write_db.h" #include "Game/IW3/XAssets/comworld/comworld_write_db.h" #include "Game/IW3/XAssets/font_s/font_s_write_db.h" @@ -28,9 +25,11 @@ #include "Game/IW3/XAssets/weapondef/weapondef_write_db.h" #include "Game/IW3/XAssets/xanimparts/xanimparts_write_db.h" #include "Game/IW3/XAssets/xmodel/xmodel_write_db.h" - #include "Writing/WritingException.h" +#include <cassert> +#include <sstream> + using namespace IW3; ContentWriter::ContentWriter() @@ -100,15 +99,15 @@ void ContentWriter::WriteScriptStringList(const bool atStreamStart) void ContentWriter::WriteXAsset(const bool atStreamStart) { -#define WRITE_ASSET(type_index, typeName, headerEntry) \ - case type_index: \ - { \ - Writer_##typeName writer(varXAsset->header.headerEntry, m_zone, m_stream); \ - writer.Write(&varXAsset->header.headerEntry); \ - break; \ - } -#define SKIP_ASSET(type_index, typeName, headerEntry) \ - case type_index: \ +#define WRITE_ASSET(type_index, typeName, headerEntry) \ + case type_index: \ + { \ + Writer_##typeName writer(varXAsset->header.headerEntry, m_zone, m_stream); \ + writer.Write(&varXAsset->header.headerEntry); \ + break; \ + } +#define SKIP_ASSET(type_index, typeName, headerEntry) \ + case type_index: \ break; assert(varXAsset != nullptr); @@ -118,40 +117,40 @@ void ContentWriter::WriteXAsset(const bool atStreamStart) switch (varXAsset->type) { - WRITE_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset) - WRITE_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts) - WRITE_ASSET(ASSET_TYPE_XMODEL, XModel, model) - WRITE_ASSET(ASSET_TYPE_MATERIAL, Material, material) - WRITE_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet) - WRITE_ASSET(ASSET_TYPE_IMAGE, GfxImage, image) - WRITE_ASSET(ASSET_TYPE_SOUND, snd_alias_list_t, sound) - WRITE_ASSET(ASSET_TYPE_SOUND_CURVE, SndCurve, sndCurve) - WRITE_ASSET(ASSET_TYPE_LOADED_SOUND, LoadedSound, loadSnd) - WRITE_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap) - WRITE_ASSET(ASSET_TYPE_CLIPMAP_PVS, clipMap_t, clipMap) - WRITE_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld) - WRITE_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp) - WRITE_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp) - WRITE_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts) - WRITE_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld) - WRITE_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef) - WRITE_ASSET(ASSET_TYPE_FONT, Font_s, font) - WRITE_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList) - WRITE_ASSET(ASSET_TYPE_MENU, menuDef_t, menu) - WRITE_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize) - WRITE_ASSET(ASSET_TYPE_WEAPON, WeaponDef, weapon) - SKIP_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals) - WRITE_ASSET(ASSET_TYPE_FX, FxEffectDef, fx) - WRITE_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx) - WRITE_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile) - WRITE_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable) + WRITE_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset) + WRITE_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts) + WRITE_ASSET(ASSET_TYPE_XMODEL, XModel, model) + WRITE_ASSET(ASSET_TYPE_MATERIAL, Material, material) + WRITE_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet) + WRITE_ASSET(ASSET_TYPE_IMAGE, GfxImage, image) + WRITE_ASSET(ASSET_TYPE_SOUND, snd_alias_list_t, sound) + WRITE_ASSET(ASSET_TYPE_SOUND_CURVE, SndCurve, sndCurve) + WRITE_ASSET(ASSET_TYPE_LOADED_SOUND, LoadedSound, loadSnd) + WRITE_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap) + WRITE_ASSET(ASSET_TYPE_CLIPMAP_PVS, clipMap_t, clipMap) + WRITE_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld) + WRITE_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp) + WRITE_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp) + WRITE_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts) + WRITE_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld) + WRITE_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef) + WRITE_ASSET(ASSET_TYPE_FONT, Font_s, font) + WRITE_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList) + WRITE_ASSET(ASSET_TYPE_MENU, menuDef_t, menu) + WRITE_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize) + WRITE_ASSET(ASSET_TYPE_WEAPON, WeaponDef, weapon) + SKIP_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals) + WRITE_ASSET(ASSET_TYPE_FX, FxEffectDef, fx) + WRITE_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx) + WRITE_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile) + WRITE_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable) default: - { - std::ostringstream str; - str << "Unsupported asset type: " << varXAsset->type << "."; - throw WritingException(str.str()); - } + { + std::ostringstream str; + str << "Unsupported asset type: " << varXAsset->type << "."; + throw WritingException(str.str()); + } } #undef WRITE_ASSET diff --git a/src/ZoneWriting/Game/IW3/ContentWriterIW3.h b/src/ZoneWriting/Game/IW3/ContentWriterIW3.h index 452029254..0b619b9ec 100644 --- a/src/ZoneWriting/Game/IW3/ContentWriterIW3.h +++ b/src/ZoneWriting/Game/IW3/ContentWriterIW3.h @@ -1,7 +1,7 @@ #pragma once +#include "Game/IW3/IW3.h" #include "Writing/ContentWriterBase.h" #include "Writing/IContentWritingEntryPoint.h" -#include "Game/IW3/IW3.h" namespace IW3 { @@ -23,4 +23,4 @@ namespace IW3 void WriteContent(Zone* zone, IZoneOutputStream* stream) override; }; -} +} // namespace IW3 diff --git a/src/ZoneWriting/Game/IW3/ZoneWriterFactoryIW3.cpp b/src/ZoneWriting/Game/IW3/ZoneWriterFactoryIW3.cpp index 50cc4bff3..4fdeead9c 100644 --- a/src/ZoneWriting/Game/IW3/ZoneWriterFactoryIW3.cpp +++ b/src/ZoneWriting/Game/IW3/ZoneWriterFactoryIW3.cpp @@ -1,10 +1,8 @@ #include "ZoneWriterFactoryIW3.h" -#include <cstring> - #include "ContentWriterIW3.h" -#include "Game/IW3/IW3.h" #include "Game/IW3/GameIW3.h" +#include "Game/IW3/IW3.h" #include "Game/IW3/ZoneConstantsIW3.h" #include "Writing/Processor/OutputProcessorDeflate.h" #include "Writing/Steps/StepAddOutputProcessor.h" @@ -14,6 +12,8 @@ #include "Writing/Steps/StepWriteZoneHeader.h" #include "Writing/Steps/StepWriteZoneSizes.h" +#include <cstring> + using namespace IW3; class ZoneWriterFactory::Impl @@ -24,7 +24,7 @@ class ZoneWriterFactory::Impl public: explicit Impl(Zone* zone) : m_zone(zone), - m_writer(std::make_unique<ZoneWriter>()) + m_writer(std::make_unique<ZoneWriter>()) { } @@ -58,7 +58,8 @@ class ZoneWriterFactory::Impl { SetupBlocks(); - auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>(std::make_unique<ContentWriter>(), m_zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK); + auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>( + std::make_unique<ContentWriter>(), m_zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK); auto* contentInMemoryPtr = contentInMemory.get(); m_writer->AddWritingStep(std::move(contentInMemory)); diff --git a/src/ZoneWriting/Game/IW3/ZoneWriterFactoryIW3.h b/src/ZoneWriting/Game/IW3/ZoneWriterFactoryIW3.h index f73d235af..e0f26e1f9 100644 --- a/src/ZoneWriting/Game/IW3/ZoneWriterFactoryIW3.h +++ b/src/ZoneWriting/Game/IW3/ZoneWriterFactoryIW3.h @@ -1,9 +1,9 @@ #pragma once -#include <memory> - #include "Writing/IZoneWriterFactory.h" +#include <memory> + namespace IW3 { class ZoneWriterFactory final : public IZoneWriterFactory @@ -14,4 +14,4 @@ namespace IW3 _NODISCARD bool SupportsZone(Zone* zone) const override; _NODISCARD std::unique_ptr<ZoneWriter> CreateWriter(Zone* zone) const override; }; -} +} // namespace IW3 diff --git a/src/ZoneWriting/Game/IW4/ContentWriterIW4.cpp b/src/ZoneWriting/Game/IW4/ContentWriterIW4.cpp index c3e97cbbe..0ec176c6e 100644 --- a/src/ZoneWriting/Game/IW4/ContentWriterIW4.cpp +++ b/src/ZoneWriting/Game/IW4/ContentWriterIW4.cpp @@ -1,8 +1,5 @@ #include "ContentWriterIW4.h" -#include <cassert> -#include <sstream> - #include "Game/IW4/XAssets/addonmapents/addonmapents_write_db.h" #include "Game/IW4/XAssets/clipmap_t/clipmap_t_write_db.h" #include "Game/IW4/XAssets/comworld/comworld_write_db.h" @@ -38,9 +35,11 @@ #include "Game/IW4/XAssets/weaponcompletedef/weaponcompletedef_write_db.h" #include "Game/IW4/XAssets/xanimparts/xanimparts_write_db.h" #include "Game/IW4/XAssets/xmodel/xmodel_write_db.h" - #include "Writing/WritingException.h" +#include <cassert> +#include <sstream> + using namespace IW4; ContentWriter::ContentWriter() @@ -110,15 +109,15 @@ void ContentWriter::WriteScriptStringList(const bool atStreamStart) void ContentWriter::WriteXAsset(const bool atStreamStart) { -#define WRITE_ASSET(type_index, typeName, headerEntry) \ - case type_index: \ - { \ - Writer_##typeName writer(varXAsset->header.headerEntry, m_zone, m_stream); \ - writer.Write(&varXAsset->header.headerEntry); \ - break; \ - } -#define SKIP_ASSET(type_index, typeName, headerEntry) \ - case type_index: \ +#define WRITE_ASSET(type_index, typeName, headerEntry) \ + case type_index: \ + { \ + Writer_##typeName writer(varXAsset->header.headerEntry, m_zone, m_stream); \ + writer.Write(&varXAsset->header.headerEntry); \ + break; \ + } +#define SKIP_ASSET(type_index, typeName, headerEntry) \ + case type_index: \ break; assert(varXAsset != nullptr); @@ -128,50 +127,50 @@ void ContentWriter::WriteXAsset(const bool atStreamStart) switch (varXAsset->type) { - WRITE_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset) - WRITE_ASSET(ASSET_TYPE_PHYSCOLLMAP, PhysCollmap, physCollmap) - WRITE_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts) - WRITE_ASSET(ASSET_TYPE_XMODEL, XModel, model) - WRITE_ASSET(ASSET_TYPE_MATERIAL, Material, material) - WRITE_ASSET(ASSET_TYPE_PIXELSHADER, MaterialPixelShader, pixelShader) - WRITE_ASSET(ASSET_TYPE_VERTEXSHADER, MaterialVertexShader, vertexShader) - WRITE_ASSET(ASSET_TYPE_VERTEXDECL, MaterialVertexDeclaration, vertexDecl) - WRITE_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet) - WRITE_ASSET(ASSET_TYPE_IMAGE, GfxImage, image) - WRITE_ASSET(ASSET_TYPE_SOUND, snd_alias_list_t, sound) - WRITE_ASSET(ASSET_TYPE_SOUND_CURVE, SndCurve, sndCurve) - WRITE_ASSET(ASSET_TYPE_LOADED_SOUND, LoadedSound, loadSnd) - WRITE_ASSET(ASSET_TYPE_CLIPMAP_SP, clipMap_t, clipMap) - WRITE_ASSET(ASSET_TYPE_CLIPMAP_MP, clipMap_t, clipMap) - WRITE_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld) - WRITE_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp) - WRITE_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp) - WRITE_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts) - WRITE_ASSET(ASSET_TYPE_FXWORLD, FxWorld, fxWorld) - WRITE_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld) - WRITE_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef) - WRITE_ASSET(ASSET_TYPE_FONT, Font_s, font) - WRITE_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList) - WRITE_ASSET(ASSET_TYPE_MENU, menuDef_t, menu) - WRITE_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize) - WRITE_ASSET(ASSET_TYPE_WEAPON, WeaponCompleteDef, weapon) - SKIP_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals) - WRITE_ASSET(ASSET_TYPE_FX, FxEffectDef, fx) - WRITE_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx) - WRITE_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile) - WRITE_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable) - WRITE_ASSET(ASSET_TYPE_LEADERBOARD, LeaderboardDef, leaderboardDef) - WRITE_ASSET(ASSET_TYPE_STRUCTURED_DATA_DEF, StructuredDataDefSet, structuredDataDefSet) - WRITE_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef) - WRITE_ASSET(ASSET_TYPE_VEHICLE, VehicleDef, vehDef) - WRITE_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts) + WRITE_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset) + WRITE_ASSET(ASSET_TYPE_PHYSCOLLMAP, PhysCollmap, physCollmap) + WRITE_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts) + WRITE_ASSET(ASSET_TYPE_XMODEL, XModel, model) + WRITE_ASSET(ASSET_TYPE_MATERIAL, Material, material) + WRITE_ASSET(ASSET_TYPE_PIXELSHADER, MaterialPixelShader, pixelShader) + WRITE_ASSET(ASSET_TYPE_VERTEXSHADER, MaterialVertexShader, vertexShader) + WRITE_ASSET(ASSET_TYPE_VERTEXDECL, MaterialVertexDeclaration, vertexDecl) + WRITE_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet) + WRITE_ASSET(ASSET_TYPE_IMAGE, GfxImage, image) + WRITE_ASSET(ASSET_TYPE_SOUND, snd_alias_list_t, sound) + WRITE_ASSET(ASSET_TYPE_SOUND_CURVE, SndCurve, sndCurve) + WRITE_ASSET(ASSET_TYPE_LOADED_SOUND, LoadedSound, loadSnd) + WRITE_ASSET(ASSET_TYPE_CLIPMAP_SP, clipMap_t, clipMap) + WRITE_ASSET(ASSET_TYPE_CLIPMAP_MP, clipMap_t, clipMap) + WRITE_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld) + WRITE_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp) + WRITE_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp) + WRITE_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts) + WRITE_ASSET(ASSET_TYPE_FXWORLD, FxWorld, fxWorld) + WRITE_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld) + WRITE_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef) + WRITE_ASSET(ASSET_TYPE_FONT, Font_s, font) + WRITE_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList) + WRITE_ASSET(ASSET_TYPE_MENU, menuDef_t, menu) + WRITE_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize) + WRITE_ASSET(ASSET_TYPE_WEAPON, WeaponCompleteDef, weapon) + SKIP_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals) + WRITE_ASSET(ASSET_TYPE_FX, FxEffectDef, fx) + WRITE_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx) + WRITE_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile) + WRITE_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable) + WRITE_ASSET(ASSET_TYPE_LEADERBOARD, LeaderboardDef, leaderboardDef) + WRITE_ASSET(ASSET_TYPE_STRUCTURED_DATA_DEF, StructuredDataDefSet, structuredDataDefSet) + WRITE_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef) + WRITE_ASSET(ASSET_TYPE_VEHICLE, VehicleDef, vehDef) + WRITE_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts) default: - { - std::ostringstream str; - str << "Unsupported asset type: " << varXAsset->type << "."; - throw WritingException(str.str()); - } + { + std::ostringstream str; + str << "Unsupported asset type: " << varXAsset->type << "."; + throw WritingException(str.str()); + } } #undef WRITE_ASSET diff --git a/src/ZoneWriting/Game/IW4/ContentWriterIW4.h b/src/ZoneWriting/Game/IW4/ContentWriterIW4.h index 945d2afcc..10e095c60 100644 --- a/src/ZoneWriting/Game/IW4/ContentWriterIW4.h +++ b/src/ZoneWriting/Game/IW4/ContentWriterIW4.h @@ -1,7 +1,7 @@ #pragma once +#include "Game/IW4/IW4.h" #include "Writing/ContentWriterBase.h" #include "Writing/IContentWritingEntryPoint.h" -#include "Game/IW4/IW4.h" namespace IW4 { @@ -23,4 +23,4 @@ namespace IW4 void WriteContent(Zone* zone, IZoneOutputStream* stream) override; }; -} +} // namespace IW4 diff --git a/src/ZoneWriting/Game/IW4/ZoneWriterFactoryIW4.cpp b/src/ZoneWriting/Game/IW4/ZoneWriterFactoryIW4.cpp index 50fea07b3..8dbd67549 100644 --- a/src/ZoneWriting/Game/IW4/ZoneWriterFactoryIW4.cpp +++ b/src/ZoneWriting/Game/IW4/ZoneWriterFactoryIW4.cpp @@ -1,10 +1,8 @@ #include "ZoneWriterFactoryIW4.h" -#include <cstring> - #include "ContentWriterIW4.h" -#include "Game/IW4/IW4.h" #include "Game/IW4/GameIW4.h" +#include "Game/IW4/IW4.h" #include "Game/IW4/ZoneConstantsIW4.h" #include "Writing/Processor/OutputProcessorDeflate.h" #include "Writing/Steps/StepAddOutputProcessor.h" @@ -16,6 +14,8 @@ #include "Writing/Steps/StepWriteZoneHeader.h" #include "Writing/Steps/StepWriteZoneSizes.h" +#include <cstring> + using namespace IW4; class ZoneWriterFactory::Impl @@ -73,7 +73,8 @@ class ZoneWriterFactory::Impl SetupBlocks(); - auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>(std::make_unique<ContentWriter>(), m_zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK); + auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>( + std::make_unique<ContentWriter>(), m_zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK); auto* contentInMemoryPtr = contentInMemory.get(); m_writer->AddWritingStep(std::move(contentInMemory)); diff --git a/src/ZoneWriting/Game/IW4/ZoneWriterFactoryIW4.h b/src/ZoneWriting/Game/IW4/ZoneWriterFactoryIW4.h index d6017aa5a..7625668ec 100644 --- a/src/ZoneWriting/Game/IW4/ZoneWriterFactoryIW4.h +++ b/src/ZoneWriting/Game/IW4/ZoneWriterFactoryIW4.h @@ -1,9 +1,9 @@ #pragma once -#include <memory> - #include "Writing/IZoneWriterFactory.h" +#include <memory> + namespace IW4 { class ZoneWriterFactory final : public IZoneWriterFactory @@ -14,4 +14,4 @@ namespace IW4 _NODISCARD bool SupportsZone(Zone* zone) const override; _NODISCARD std::unique_ptr<ZoneWriter> CreateWriter(Zone* zone) const override; }; -} +} // namespace IW4 diff --git a/src/ZoneWriting/Game/IW5/ContentWriterIW5.cpp b/src/ZoneWriting/Game/IW5/ContentWriterIW5.cpp index 916294a7a..01635a0ff 100644 --- a/src/ZoneWriting/Game/IW5/ContentWriterIW5.cpp +++ b/src/ZoneWriting/Game/IW5/ContentWriterIW5.cpp @@ -1,8 +1,5 @@ #include "ContentWriterIW5.h" -#include <cassert> -#include <sstream> - #include "Game/IW5/XAssets/addonmapents/addonmapents_write_db.h" #include "Game/IW5/XAssets/clipmap_t/clipmap_t_write_db.h" #include "Game/IW5/XAssets/comworld/comworld_write_db.h" @@ -43,9 +40,11 @@ #include "Game/IW5/XAssets/xanimparts/xanimparts_write_db.h" #include "Game/IW5/XAssets/xmodel/xmodel_write_db.h" #include "Game/IW5/XAssets/xmodelsurfs/xmodelsurfs_write_db.h" - #include "Writing/WritingException.h" +#include <cassert> +#include <sstream> + using namespace IW5; ContentWriter::ContentWriter() @@ -115,15 +114,15 @@ void ContentWriter::WriteScriptStringList(const bool atStreamStart) void ContentWriter::WriteXAsset(const bool atStreamStart) { -#define WRITE_ASSET(type_index, typeName, headerEntry) \ - case type_index: \ - { \ - Writer_##typeName writer(varXAsset->header.headerEntry, m_zone, m_stream); \ - writer.Write(&varXAsset->header.headerEntry); \ - break; \ - } -#define SKIP_ASSET(type_index, typeName, headerEntry) \ - case type_index: \ +#define WRITE_ASSET(type_index, typeName, headerEntry) \ + case type_index: \ + { \ + Writer_##typeName writer(varXAsset->header.headerEntry, m_zone, m_stream); \ + writer.Write(&varXAsset->header.headerEntry); \ + break; \ + } +#define SKIP_ASSET(type_index, typeName, headerEntry) \ + case type_index: \ break; assert(varXAsset != nullptr); @@ -133,53 +132,53 @@ void ContentWriter::WriteXAsset(const bool atStreamStart) switch (varXAsset->type) { - WRITE_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset) - WRITE_ASSET(ASSET_TYPE_PHYSCOLLMAP, PhysCollmap, physCollmap) - WRITE_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts) - WRITE_ASSET(ASSET_TYPE_XMODEL_SURFS, XModelSurfs, modelSurfs) - WRITE_ASSET(ASSET_TYPE_XMODEL, XModel, model) - WRITE_ASSET(ASSET_TYPE_MATERIAL, Material, material) - WRITE_ASSET(ASSET_TYPE_PIXELSHADER, MaterialPixelShader, pixelShader) - WRITE_ASSET(ASSET_TYPE_VERTEXSHADER, MaterialVertexShader, vertexShader) - WRITE_ASSET(ASSET_TYPE_VERTEXDECL, MaterialVertexDeclaration, vertexDecl) - WRITE_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet) - WRITE_ASSET(ASSET_TYPE_IMAGE, GfxImage, image) - WRITE_ASSET(ASSET_TYPE_SOUND, snd_alias_list_t, sound) - WRITE_ASSET(ASSET_TYPE_SOUND_CURVE, SndCurve, sndCurve) - WRITE_ASSET(ASSET_TYPE_LOADED_SOUND, LoadedSound, loadSnd) - WRITE_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap) - WRITE_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld) - WRITE_ASSET(ASSET_TYPE_GLASSWORLD, GlassWorld, glassWorld) - WRITE_ASSET(ASSET_TYPE_PATHDATA, PathData, pathData) - WRITE_ASSET(ASSET_TYPE_VEHICLE_TRACK, VehicleTrack, vehicleTrack) - WRITE_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts) - WRITE_ASSET(ASSET_TYPE_FXWORLD, FxWorld, fxWorld) - WRITE_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld) - WRITE_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef) - WRITE_ASSET(ASSET_TYPE_FONT, Font_s, font) - WRITE_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList) - WRITE_ASSET(ASSET_TYPE_MENU, menuDef_t, menu) - WRITE_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize) - WRITE_ASSET(ASSET_TYPE_ATTACHMENT, WeaponAttachment, attachment) - WRITE_ASSET(ASSET_TYPE_WEAPON, WeaponCompleteDef, weapon) - WRITE_ASSET(ASSET_TYPE_FX, FxEffectDef, fx) - WRITE_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx) - WRITE_ASSET(ASSET_TYPE_SURFACE_FX, SurfaceFxTable, surfaceFx) - WRITE_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile) - WRITE_ASSET(ASSET_TYPE_SCRIPTFILE, ScriptFile, scriptfile) - WRITE_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable) - WRITE_ASSET(ASSET_TYPE_LEADERBOARD, LeaderboardDef, leaderboardDef) - WRITE_ASSET(ASSET_TYPE_STRUCTURED_DATA_DEF, StructuredDataDefSet, structuredDataDefSet) - WRITE_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef) - WRITE_ASSET(ASSET_TYPE_VEHICLE, VehicleDef, vehDef) - WRITE_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts) + WRITE_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset) + WRITE_ASSET(ASSET_TYPE_PHYSCOLLMAP, PhysCollmap, physCollmap) + WRITE_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts) + WRITE_ASSET(ASSET_TYPE_XMODEL_SURFS, XModelSurfs, modelSurfs) + WRITE_ASSET(ASSET_TYPE_XMODEL, XModel, model) + WRITE_ASSET(ASSET_TYPE_MATERIAL, Material, material) + WRITE_ASSET(ASSET_TYPE_PIXELSHADER, MaterialPixelShader, pixelShader) + WRITE_ASSET(ASSET_TYPE_VERTEXSHADER, MaterialVertexShader, vertexShader) + WRITE_ASSET(ASSET_TYPE_VERTEXDECL, MaterialVertexDeclaration, vertexDecl) + WRITE_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet) + WRITE_ASSET(ASSET_TYPE_IMAGE, GfxImage, image) + WRITE_ASSET(ASSET_TYPE_SOUND, snd_alias_list_t, sound) + WRITE_ASSET(ASSET_TYPE_SOUND_CURVE, SndCurve, sndCurve) + WRITE_ASSET(ASSET_TYPE_LOADED_SOUND, LoadedSound, loadSnd) + WRITE_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap) + WRITE_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld) + WRITE_ASSET(ASSET_TYPE_GLASSWORLD, GlassWorld, glassWorld) + WRITE_ASSET(ASSET_TYPE_PATHDATA, PathData, pathData) + WRITE_ASSET(ASSET_TYPE_VEHICLE_TRACK, VehicleTrack, vehicleTrack) + WRITE_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts) + WRITE_ASSET(ASSET_TYPE_FXWORLD, FxWorld, fxWorld) + WRITE_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld) + WRITE_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef) + WRITE_ASSET(ASSET_TYPE_FONT, Font_s, font) + WRITE_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList) + WRITE_ASSET(ASSET_TYPE_MENU, menuDef_t, menu) + WRITE_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize) + WRITE_ASSET(ASSET_TYPE_ATTACHMENT, WeaponAttachment, attachment) + WRITE_ASSET(ASSET_TYPE_WEAPON, WeaponCompleteDef, weapon) + WRITE_ASSET(ASSET_TYPE_FX, FxEffectDef, fx) + WRITE_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx) + WRITE_ASSET(ASSET_TYPE_SURFACE_FX, SurfaceFxTable, surfaceFx) + WRITE_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile) + WRITE_ASSET(ASSET_TYPE_SCRIPTFILE, ScriptFile, scriptfile) + WRITE_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable) + WRITE_ASSET(ASSET_TYPE_LEADERBOARD, LeaderboardDef, leaderboardDef) + WRITE_ASSET(ASSET_TYPE_STRUCTURED_DATA_DEF, StructuredDataDefSet, structuredDataDefSet) + WRITE_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef) + WRITE_ASSET(ASSET_TYPE_VEHICLE, VehicleDef, vehDef) + WRITE_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts) default: - { - std::ostringstream str; - str << "Unsupported asset type: " << varXAsset->type << "."; - throw WritingException(str.str()); - } + { + std::ostringstream str; + str << "Unsupported asset type: " << varXAsset->type << "."; + throw WritingException(str.str()); + } } #undef WRITE_ASSET diff --git a/src/ZoneWriting/Game/IW5/ContentWriterIW5.h b/src/ZoneWriting/Game/IW5/ContentWriterIW5.h index c90384b30..3b08d9bdb 100644 --- a/src/ZoneWriting/Game/IW5/ContentWriterIW5.h +++ b/src/ZoneWriting/Game/IW5/ContentWriterIW5.h @@ -1,7 +1,7 @@ #pragma once +#include "Game/IW5/IW5.h" #include "Writing/ContentWriterBase.h" #include "Writing/IContentWritingEntryPoint.h" -#include "Game/IW5/IW5.h" namespace IW5 { @@ -23,4 +23,4 @@ namespace IW5 void WriteContent(Zone* zone, IZoneOutputStream* stream) override; }; -} +} // namespace IW5 diff --git a/src/ZoneWriting/Game/IW5/ZoneWriterFactoryIW5.cpp b/src/ZoneWriting/Game/IW5/ZoneWriterFactoryIW5.cpp index 0457f8e6a..1b91a4c5b 100644 --- a/src/ZoneWriting/Game/IW5/ZoneWriterFactoryIW5.cpp +++ b/src/ZoneWriting/Game/IW5/ZoneWriterFactoryIW5.cpp @@ -1,10 +1,8 @@ #include "ZoneWriterFactoryIW5.h" -#include <cstring> - #include "ContentWriterIW5.h" -#include "Game/IW5/IW5.h" #include "Game/IW5/GameIW5.h" +#include "Game/IW5/IW5.h" #include "Game/IW5/ZoneConstantsIW5.h" #include "Writing/Processor/OutputProcessorDeflate.h" #include "Writing/Steps/StepAddOutputProcessor.h" @@ -16,6 +14,8 @@ #include "Writing/Steps/StepWriteZoneHeader.h" #include "Writing/Steps/StepWriteZoneSizes.h" +#include <cstring> + using namespace IW5; class ZoneWriterFactory::Impl @@ -26,7 +26,7 @@ class ZoneWriterFactory::Impl public: explicit Impl(Zone* zone) : m_zone(zone), - m_writer(std::make_unique<ZoneWriter>()) + m_writer(std::make_unique<ZoneWriter>()) { } @@ -74,7 +74,8 @@ class ZoneWriterFactory::Impl SetupBlocks(); - auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>(std::make_unique<ContentWriter>(), m_zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK); + auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>( + std::make_unique<ContentWriter>(), m_zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK); auto* contentInMemoryPtr = contentInMemory.get(); m_writer->AddWritingStep(std::move(contentInMemory)); diff --git a/src/ZoneWriting/Game/IW5/ZoneWriterFactoryIW5.h b/src/ZoneWriting/Game/IW5/ZoneWriterFactoryIW5.h index beb5147fa..847dd1149 100644 --- a/src/ZoneWriting/Game/IW5/ZoneWriterFactoryIW5.h +++ b/src/ZoneWriting/Game/IW5/ZoneWriterFactoryIW5.h @@ -1,9 +1,9 @@ #pragma once -#include <memory> - #include "Writing/IZoneWriterFactory.h" +#include <memory> + namespace IW5 { class ZoneWriterFactory final : public IZoneWriterFactory @@ -14,4 +14,4 @@ namespace IW5 _NODISCARD bool SupportsZone(Zone* zone) const override; _NODISCARD std::unique_ptr<ZoneWriter> CreateWriter(Zone* zone) const override; }; -} +} // namespace IW5 diff --git a/src/ZoneWriting/Game/T5/ContentWriterT5.cpp b/src/ZoneWriting/Game/T5/ContentWriterT5.cpp index ef7b02466..448e82e12 100644 --- a/src/ZoneWriting/Game/T5/ContentWriterT5.cpp +++ b/src/ZoneWriting/Game/T5/ContentWriterT5.cpp @@ -1,8 +1,5 @@ #include "ContentWriterT5.h" -#include <cassert> -#include <sstream> - #include "Game/T5/XAssets/clipmap_t/clipmap_t_write_db.h" #include "Game/T5/XAssets/comworld/comworld_write_db.h" #include "Game/T5/XAssets/ddlroot_t/ddlroot_t_write_db.h" @@ -35,9 +32,11 @@ #include "Game/T5/XAssets/xanimparts/xanimparts_write_db.h" #include "Game/T5/XAssets/xglobals/xglobals_write_db.h" #include "Game/T5/XAssets/xmodel/xmodel_write_db.h" - #include "Writing/WritingException.h" +#include <cassert> +#include <sstream> + using namespace T5; ContentWriter::ContentWriter() @@ -107,15 +106,15 @@ void ContentWriter::WriteScriptStringList(const bool atStreamStart) void ContentWriter::WriteXAsset(const bool atStreamStart) { -#define WRITE_ASSET(type_index, typeName, headerEntry) \ - case type_index: \ - { \ - Writer_##typeName writer(varXAsset->header.headerEntry, m_zone, m_stream); \ - writer.Write(&varXAsset->header.headerEntry); \ - break; \ - } -#define SKIP_ASSET(type_index, typeName, headerEntry) \ - case type_index: \ +#define WRITE_ASSET(type_index, typeName, headerEntry) \ + case type_index: \ + { \ + Writer_##typeName writer(varXAsset->header.headerEntry, m_zone, m_stream); \ + writer.Write(&varXAsset->header.headerEntry); \ + break; \ + } +#define SKIP_ASSET(type_index, typeName, headerEntry) \ + case type_index: \ break; assert(varXAsset != nullptr); @@ -125,46 +124,46 @@ void ContentWriter::WriteXAsset(const bool atStreamStart) switch (varXAsset->type) { - WRITE_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset) - WRITE_ASSET(ASSET_TYPE_PHYSCONSTRAINTS, PhysConstraints, physConstraints) - WRITE_ASSET(ASSET_TYPE_DESTRUCTIBLEDEF, DestructibleDef, destructibleDef) - WRITE_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts) - WRITE_ASSET(ASSET_TYPE_XMODEL, XModel, model) - WRITE_ASSET(ASSET_TYPE_MATERIAL, Material, material) - WRITE_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet) - WRITE_ASSET(ASSET_TYPE_IMAGE, GfxImage, image) - WRITE_ASSET(ASSET_TYPE_SOUND, SndBank, sound) - WRITE_ASSET(ASSET_TYPE_SOUND_PATCH, SndPatch, soundPatch) - WRITE_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap) - WRITE_ASSET(ASSET_TYPE_CLIPMAP_PVS, clipMap_t, clipMap) - WRITE_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld) - WRITE_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp) - WRITE_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp) - WRITE_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts) - WRITE_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld) - WRITE_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef) - WRITE_ASSET(ASSET_TYPE_FONT, Font_s, font) - WRITE_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList) - WRITE_ASSET(ASSET_TYPE_MENU, menuDef_t, menu) - WRITE_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize) - WRITE_ASSET(ASSET_TYPE_WEAPON, WeaponVariantDef, weapon) - WRITE_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals) - WRITE_ASSET(ASSET_TYPE_FX, FxEffectDef, fx) - WRITE_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx) - WRITE_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile) - WRITE_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable) - WRITE_ASSET(ASSET_TYPE_PACK_INDEX, PackIndex, packIndex) - WRITE_ASSET(ASSET_TYPE_XGLOBALS, XGlobals, xGlobals) - WRITE_ASSET(ASSET_TYPE_DDL, ddlRoot_t, ddlRoot) - WRITE_ASSET(ASSET_TYPE_GLASSES, Glasses, glasses) - WRITE_ASSET(ASSET_TYPE_EMBLEMSET, EmblemSet, emblemSet) + WRITE_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset) + WRITE_ASSET(ASSET_TYPE_PHYSCONSTRAINTS, PhysConstraints, physConstraints) + WRITE_ASSET(ASSET_TYPE_DESTRUCTIBLEDEF, DestructibleDef, destructibleDef) + WRITE_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts) + WRITE_ASSET(ASSET_TYPE_XMODEL, XModel, model) + WRITE_ASSET(ASSET_TYPE_MATERIAL, Material, material) + WRITE_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet) + WRITE_ASSET(ASSET_TYPE_IMAGE, GfxImage, image) + WRITE_ASSET(ASSET_TYPE_SOUND, SndBank, sound) + WRITE_ASSET(ASSET_TYPE_SOUND_PATCH, SndPatch, soundPatch) + WRITE_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap) + WRITE_ASSET(ASSET_TYPE_CLIPMAP_PVS, clipMap_t, clipMap) + WRITE_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld) + WRITE_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp) + WRITE_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp) + WRITE_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts) + WRITE_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld) + WRITE_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef) + WRITE_ASSET(ASSET_TYPE_FONT, Font_s, font) + WRITE_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList) + WRITE_ASSET(ASSET_TYPE_MENU, menuDef_t, menu) + WRITE_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize) + WRITE_ASSET(ASSET_TYPE_WEAPON, WeaponVariantDef, weapon) + WRITE_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals) + WRITE_ASSET(ASSET_TYPE_FX, FxEffectDef, fx) + WRITE_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx) + WRITE_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile) + WRITE_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable) + WRITE_ASSET(ASSET_TYPE_PACK_INDEX, PackIndex, packIndex) + WRITE_ASSET(ASSET_TYPE_XGLOBALS, XGlobals, xGlobals) + WRITE_ASSET(ASSET_TYPE_DDL, ddlRoot_t, ddlRoot) + WRITE_ASSET(ASSET_TYPE_GLASSES, Glasses, glasses) + WRITE_ASSET(ASSET_TYPE_EMBLEMSET, EmblemSet, emblemSet) default: - { - std::ostringstream str; - str << "Unsupported asset type: " << varXAsset->type << "."; - throw WritingException(str.str()); - } + { + std::ostringstream str; + str << "Unsupported asset type: " << varXAsset->type << "."; + throw WritingException(str.str()); + } } #undef WRITE_ASSET diff --git a/src/ZoneWriting/Game/T5/ContentWriterT5.h b/src/ZoneWriting/Game/T5/ContentWriterT5.h index 51b118ad8..42ae4d9a9 100644 --- a/src/ZoneWriting/Game/T5/ContentWriterT5.h +++ b/src/ZoneWriting/Game/T5/ContentWriterT5.h @@ -1,7 +1,7 @@ #pragma once +#include "Game/T5/T5.h" #include "Writing/ContentWriterBase.h" #include "Writing/IContentWritingEntryPoint.h" -#include "Game/T5/T5.h" namespace T5 { @@ -23,4 +23,4 @@ namespace T5 void WriteContent(Zone* zone, IZoneOutputStream* stream) override; }; -} +} // namespace T5 diff --git a/src/ZoneWriting/Game/T5/ZoneWriterFactoryT5.cpp b/src/ZoneWriting/Game/T5/ZoneWriterFactoryT5.cpp index 4eae84b6a..7fe341440 100644 --- a/src/ZoneWriting/Game/T5/ZoneWriterFactoryT5.cpp +++ b/src/ZoneWriting/Game/T5/ZoneWriterFactoryT5.cpp @@ -1,10 +1,8 @@ #include "ZoneWriterFactoryT5.h" -#include <cstring> - #include "ContentWriterT5.h" -#include "Game/T5/T5.h" #include "Game/T5/GameT5.h" +#include "Game/T5/T5.h" #include "Game/T5/ZoneConstantsT5.h" #include "Writing/Processor/OutputProcessorDeflate.h" #include "Writing/Steps/StepAddOutputProcessor.h" @@ -14,6 +12,8 @@ #include "Writing/Steps/StepWriteZoneHeader.h" #include "Writing/Steps/StepWriteZoneSizes.h" +#include <cstring> + using namespace T5; class ZoneWriterFactory::Impl @@ -24,7 +24,7 @@ class ZoneWriterFactory::Impl public: explicit Impl(Zone* zone) : m_zone(zone), - m_writer(std::make_unique<ZoneWriter>()) + m_writer(std::make_unique<ZoneWriter>()) { } @@ -56,7 +56,8 @@ class ZoneWriterFactory::Impl { SetupBlocks(); - auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>(std::make_unique<ContentWriter>(), m_zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK); + auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>( + std::make_unique<ContentWriter>(), m_zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK); auto* contentInMemoryPtr = contentInMemory.get(); m_writer->AddWritingStep(std::move(contentInMemory)); diff --git a/src/ZoneWriting/Game/T5/ZoneWriterFactoryT5.h b/src/ZoneWriting/Game/T5/ZoneWriterFactoryT5.h index 04d67bb4f..6a6fa5a7a 100644 --- a/src/ZoneWriting/Game/T5/ZoneWriterFactoryT5.h +++ b/src/ZoneWriting/Game/T5/ZoneWriterFactoryT5.h @@ -1,9 +1,9 @@ #pragma once -#include <memory> - #include "Writing/IZoneWriterFactory.h" +#include <memory> + namespace T5 { class ZoneWriterFactory final : public IZoneWriterFactory @@ -14,4 +14,4 @@ namespace T5 _NODISCARD bool SupportsZone(Zone* zone) const override; _NODISCARD std::unique_ptr<ZoneWriter> CreateWriter(Zone* zone) const override; }; -} +} // namespace T5 diff --git a/src/ZoneWriting/Game/T6/ContentWriterT6.cpp b/src/ZoneWriting/Game/T6/ContentWriterT6.cpp index cbb68e740..ae860ad5a 100644 --- a/src/ZoneWriting/Game/T6/ContentWriterT6.cpp +++ b/src/ZoneWriting/Game/T6/ContentWriterT6.cpp @@ -1,8 +1,5 @@ #include "ContentWriterT6.h" -#include <cassert> -#include <sstream> - #include "Game/T6/XAssets/addonmapents/addonmapents_write_db.h" #include "Game/T6/XAssets/clipmap_t/clipmap_t_write_db.h" #include "Game/T6/XAssets/comworld/comworld_write_db.h" @@ -51,9 +48,11 @@ #include "Game/T6/XAssets/xglobals/xglobals_write_db.h" #include "Game/T6/XAssets/xmodel/xmodel_write_db.h" #include "Game/T6/XAssets/zbarrierdef/zbarrierdef_write_db.h" - #include "Writing/WritingException.h" +#include <cassert> +#include <sstream> + using namespace T6; ContentWriter::ContentWriter() @@ -126,13 +125,13 @@ void ContentWriter::WriteScriptStringList(const bool atStreamStart) void ContentWriter::WriteXAsset(const bool atStreamStart) { -#define WRITE_ASSET(type_index, typeName, headerEntry) \ - case type_index: \ - { \ - Writer_##typeName writer(varXAsset->header.headerEntry, m_zone, m_stream); \ - writer.Write(&varXAsset->header.headerEntry); \ - break; \ - } +#define WRITE_ASSET(type_index, typeName, headerEntry) \ + case type_index: \ + { \ + Writer_##typeName writer(varXAsset->header.headerEntry, m_zone, m_stream); \ + writer.Write(&varXAsset->header.headerEntry); \ + break; \ + } assert(varXAsset != nullptr); @@ -141,62 +140,62 @@ void ContentWriter::WriteXAsset(const bool atStreamStart) switch (varXAsset->type) { - WRITE_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset) - WRITE_ASSET(ASSET_TYPE_PHYSCONSTRAINTS, PhysConstraints, physConstraints) - WRITE_ASSET(ASSET_TYPE_DESTRUCTIBLEDEF, DestructibleDef, destructibleDef) - WRITE_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts) - WRITE_ASSET(ASSET_TYPE_XMODEL, XModel, model) - WRITE_ASSET(ASSET_TYPE_MATERIAL, Material, material) - WRITE_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet) - WRITE_ASSET(ASSET_TYPE_IMAGE, GfxImage, image) - WRITE_ASSET(ASSET_TYPE_SOUND, SndBank, sound) - WRITE_ASSET(ASSET_TYPE_SOUND_PATCH, SndPatch, soundPatch) - WRITE_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap) - WRITE_ASSET(ASSET_TYPE_CLIPMAP_PVS, clipMap_t, clipMap) - WRITE_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld) - WRITE_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp) - WRITE_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp) - WRITE_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts) - WRITE_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld) - WRITE_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef) - WRITE_ASSET(ASSET_TYPE_FONT, Font_s, font) - WRITE_ASSET(ASSET_TYPE_FONTICON, FontIcon, fontIcon) - WRITE_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList) - WRITE_ASSET(ASSET_TYPE_MENU, menuDef_t, menu) - WRITE_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize) - WRITE_ASSET(ASSET_TYPE_WEAPON, WeaponVariantDef, weapon) - WRITE_ASSET(ASSET_TYPE_ATTACHMENT, WeaponAttachment, attachment) - WRITE_ASSET(ASSET_TYPE_ATTACHMENT_UNIQUE, WeaponAttachmentUnique, attachmentUnique) - WRITE_ASSET(ASSET_TYPE_WEAPON_CAMO, WeaponCamo, weaponCamo) - WRITE_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals) - WRITE_ASSET(ASSET_TYPE_FX, FxEffectDef, fx) - WRITE_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx) - WRITE_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile) - WRITE_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable) - WRITE_ASSET(ASSET_TYPE_LEADERBOARD, LeaderboardDef, leaderboardDef) - WRITE_ASSET(ASSET_TYPE_XGLOBALS, XGlobals, xGlobals) - WRITE_ASSET(ASSET_TYPE_DDL, ddlRoot_t, ddlRoot) - WRITE_ASSET(ASSET_TYPE_GLASSES, Glasses, glasses) - WRITE_ASSET(ASSET_TYPE_EMBLEMSET, EmblemSet, emblemSet) - WRITE_ASSET(ASSET_TYPE_SCRIPTPARSETREE, ScriptParseTree, scriptParseTree) - WRITE_ASSET(ASSET_TYPE_KEYVALUEPAIRS, KeyValuePairs, keyValuePairs) - WRITE_ASSET(ASSET_TYPE_VEHICLEDEF, VehicleDef, vehicleDef) - WRITE_ASSET(ASSET_TYPE_MEMORYBLOCK, MemoryBlock, memoryBlock); - WRITE_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts) - WRITE_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef) - WRITE_ASSET(ASSET_TYPE_SKINNEDVERTS, SkinnedVertsDef, skinnedVertsDef) - WRITE_ASSET(ASSET_TYPE_QDB, Qdb, qdb) - WRITE_ASSET(ASSET_TYPE_SLUG, Slug, slug) - WRITE_ASSET(ASSET_TYPE_FOOTSTEP_TABLE, FootstepTableDef, footstepTableDef) - WRITE_ASSET(ASSET_TYPE_FOOTSTEPFX_TABLE, FootstepFXTableDef, footstepFXTableDef) - WRITE_ASSET(ASSET_TYPE_ZBARRIER, ZBarrierDef, zbarrierDef) + WRITE_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset) + WRITE_ASSET(ASSET_TYPE_PHYSCONSTRAINTS, PhysConstraints, physConstraints) + WRITE_ASSET(ASSET_TYPE_DESTRUCTIBLEDEF, DestructibleDef, destructibleDef) + WRITE_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts) + WRITE_ASSET(ASSET_TYPE_XMODEL, XModel, model) + WRITE_ASSET(ASSET_TYPE_MATERIAL, Material, material) + WRITE_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet) + WRITE_ASSET(ASSET_TYPE_IMAGE, GfxImage, image) + WRITE_ASSET(ASSET_TYPE_SOUND, SndBank, sound) + WRITE_ASSET(ASSET_TYPE_SOUND_PATCH, SndPatch, soundPatch) + WRITE_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap) + WRITE_ASSET(ASSET_TYPE_CLIPMAP_PVS, clipMap_t, clipMap) + WRITE_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld) + WRITE_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp) + WRITE_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp) + WRITE_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts) + WRITE_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld) + WRITE_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef) + WRITE_ASSET(ASSET_TYPE_FONT, Font_s, font) + WRITE_ASSET(ASSET_TYPE_FONTICON, FontIcon, fontIcon) + WRITE_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList) + WRITE_ASSET(ASSET_TYPE_MENU, menuDef_t, menu) + WRITE_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize) + WRITE_ASSET(ASSET_TYPE_WEAPON, WeaponVariantDef, weapon) + WRITE_ASSET(ASSET_TYPE_ATTACHMENT, WeaponAttachment, attachment) + WRITE_ASSET(ASSET_TYPE_ATTACHMENT_UNIQUE, WeaponAttachmentUnique, attachmentUnique) + WRITE_ASSET(ASSET_TYPE_WEAPON_CAMO, WeaponCamo, weaponCamo) + WRITE_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals) + WRITE_ASSET(ASSET_TYPE_FX, FxEffectDef, fx) + WRITE_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx) + WRITE_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile) + WRITE_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable) + WRITE_ASSET(ASSET_TYPE_LEADERBOARD, LeaderboardDef, leaderboardDef) + WRITE_ASSET(ASSET_TYPE_XGLOBALS, XGlobals, xGlobals) + WRITE_ASSET(ASSET_TYPE_DDL, ddlRoot_t, ddlRoot) + WRITE_ASSET(ASSET_TYPE_GLASSES, Glasses, glasses) + WRITE_ASSET(ASSET_TYPE_EMBLEMSET, EmblemSet, emblemSet) + WRITE_ASSET(ASSET_TYPE_SCRIPTPARSETREE, ScriptParseTree, scriptParseTree) + WRITE_ASSET(ASSET_TYPE_KEYVALUEPAIRS, KeyValuePairs, keyValuePairs) + WRITE_ASSET(ASSET_TYPE_VEHICLEDEF, VehicleDef, vehicleDef) + WRITE_ASSET(ASSET_TYPE_MEMORYBLOCK, MemoryBlock, memoryBlock); + WRITE_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts) + WRITE_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef) + WRITE_ASSET(ASSET_TYPE_SKINNEDVERTS, SkinnedVertsDef, skinnedVertsDef) + WRITE_ASSET(ASSET_TYPE_QDB, Qdb, qdb) + WRITE_ASSET(ASSET_TYPE_SLUG, Slug, slug) + WRITE_ASSET(ASSET_TYPE_FOOTSTEP_TABLE, FootstepTableDef, footstepTableDef) + WRITE_ASSET(ASSET_TYPE_FOOTSTEPFX_TABLE, FootstepFXTableDef, footstepFXTableDef) + WRITE_ASSET(ASSET_TYPE_ZBARRIER, ZBarrierDef, zbarrierDef) default: - { - std::ostringstream str; - str << "Unsupported asset type: " << varXAsset->type << "."; - throw WritingException(str.str()); - } + { + std::ostringstream str; + str << "Unsupported asset type: " << varXAsset->type << "."; + throw WritingException(str.str()); + } } #undef WRITE_ASSET diff --git a/src/ZoneWriting/Game/T6/ContentWriterT6.h b/src/ZoneWriting/Game/T6/ContentWriterT6.h index af4d56fdc..be3aa5e58 100644 --- a/src/ZoneWriting/Game/T6/ContentWriterT6.h +++ b/src/ZoneWriting/Game/T6/ContentWriterT6.h @@ -1,7 +1,7 @@ #pragma once +#include "Game/T6/T6.h" #include "Writing/ContentWriterBase.h" #include "Writing/IContentWritingEntryPoint.h" -#include "Game/T6/T6.h" namespace T6 { @@ -23,4 +23,4 @@ namespace T6 void WriteContent(Zone* zone, IZoneOutputStream* stream) override; }; -} +} // namespace T6 diff --git a/src/ZoneWriting/Game/T6/ZoneWriterFactoryT6.cpp b/src/ZoneWriting/Game/T6/ZoneWriterFactoryT6.cpp index 3bf154f5e..20f24c0c3 100644 --- a/src/ZoneWriting/Game/T6/ZoneWriterFactoryT6.cpp +++ b/src/ZoneWriting/Game/T6/ZoneWriterFactoryT6.cpp @@ -1,16 +1,11 @@ #include "ZoneWriterFactoryT6.h" -#include <cassert> -#include <cstring> - #include "ContentWriterT6.h" -#include "Utils/ICapturedDataProvider.h" -#include "Game/T6/T6.h" #include "Game/T6/GameT6.h" +#include "Game/T6/T6.h" #include "Game/T6/ZoneConstantsT6.h" +#include "Utils/ICapturedDataProvider.h" #include "Writing/Processor/OutputProcessorXChunks.h" -#include "Zone/XChunk/XChunkProcessorDeflate.h" -#include "Zone/XChunk/XChunkProcessorSalsa20Encryption.h" #include "Writing/Steps/StepAddOutputProcessor.h" #include "Writing/Steps/StepAlign.h" #include "Writing/Steps/StepRemoveOutputProcessor.h" @@ -20,6 +15,11 @@ #include "Writing/Steps/StepWriteZoneContentToMemory.h" #include "Writing/Steps/StepWriteZoneHeader.h" #include "Writing/Steps/StepWriteZoneSizes.h" +#include "Zone/XChunk/XChunkProcessorDeflate.h" +#include "Zone/XChunk/XChunkProcessorSalsa20Encryption.h" + +#include <cassert> +#include <cstring> using namespace T6; @@ -56,7 +56,7 @@ class ZoneWriterFactory::Impl ZoneHeader header{}; header.m_version = ZoneConstants::ZONE_VERSION; - if(isSecure) + if (isSecure) { if (isOfficial) memcpy(header.m_magic, ZoneConstants::MAGIC_SIGNED_TREYARCH, sizeof(ZoneHeader::m_magic)); @@ -76,7 +76,8 @@ class ZoneWriterFactory::Impl void AddXChunkProcessor(const bool isEncrypted, ICapturedDataProvider** dataToSignProviderPtr, OutputProcessorXChunks** xChunkProcessorPtr) const { - auto xChunkProcessor = std::make_unique<OutputProcessorXChunks>(ZoneConstants::STREAM_COUNT, ZoneConstants::XCHUNK_SIZE, ZoneConstants::XCHUNK_MAX_WRITE_SIZE, ZoneConstants::VANILLA_BUFFER_SIZE); + auto xChunkProcessor = std::make_unique<OutputProcessorXChunks>( + ZoneConstants::STREAM_COUNT, ZoneConstants::XCHUNK_SIZE, ZoneConstants::XCHUNK_MAX_WRITE_SIZE, ZoneConstants::VANILLA_BUFFER_SIZE); if (xChunkProcessorPtr) *xChunkProcessorPtr = xChunkProcessor.get(); @@ -86,8 +87,8 @@ class ZoneWriterFactory::Impl if (isEncrypted) { // If zone is encrypted, the decryption is applied before the decompression. T6 Zones always use Salsa20. - auto chunkProcessorSalsa20 = std::make_unique<XChunkProcessorSalsa20Encryption>(ZoneConstants::STREAM_COUNT, m_zone->m_name, ZoneConstants::SALSA20_KEY_TREYARCH, - sizeof(ZoneConstants::SALSA20_KEY_TREYARCH)); + auto chunkProcessorSalsa20 = std::make_unique<XChunkProcessorSalsa20Encryption>( + ZoneConstants::STREAM_COUNT, m_zone->m_name, ZoneConstants::SALSA20_KEY_TREYARCH, sizeof(ZoneConstants::SALSA20_KEY_TREYARCH)); // If there is encryption, the signed data of the zone is the final hash blocks provided by the Salsa20 IV adaption algorithm if (dataToSignProviderPtr) @@ -97,7 +98,6 @@ class ZoneWriterFactory::Impl } m_writer->AddWritingStep(std::make_unique<StepAddOutputProcessor>(std::move(xChunkProcessor))); - } std::unique_ptr<ZoneWriter> CreateWriter() @@ -108,7 +108,8 @@ class ZoneWriterFactory::Impl SetupBlocks(); - auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>(std::make_unique<ContentWriter>(), m_zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK); + auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>( + std::make_unique<ContentWriter>(), m_zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK); auto* contentInMemoryPtr = contentInMemory.get(); m_writer->AddWritingStep(std::move(contentInMemory)); @@ -121,7 +122,7 @@ class ZoneWriterFactory::Impl AddXChunkProcessor(isEncrypted, &dataToSignProvider, &xChunksProcessor); // Start of the XFile struct - //m_writer->AddWritingStep(std::make_unique<StepSkipBytes>(8)); // Skip size and externalSize fields since they are not interesting for us + // m_writer->AddWritingStep(std::make_unique<StepSkipBytes>(8)); // Skip size and externalSize fields since they are not interesting for us m_writer->AddWritingStep(std::make_unique<StepWriteZoneSizes>(contentInMemoryPtr)); m_writer->AddWritingStep(std::make_unique<StepWriteXBlockSizes>(m_zone)); diff --git a/src/ZoneWriting/Game/T6/ZoneWriterFactoryT6.h b/src/ZoneWriting/Game/T6/ZoneWriterFactoryT6.h index a7ba249e1..7f9c6cd5f 100644 --- a/src/ZoneWriting/Game/T6/ZoneWriterFactoryT6.h +++ b/src/ZoneWriting/Game/T6/ZoneWriterFactoryT6.h @@ -1,9 +1,9 @@ #pragma once -#include <memory> - #include "Writing/IZoneWriterFactory.h" +#include <memory> + namespace T6 { class ZoneWriterFactory final : public IZoneWriterFactory @@ -14,4 +14,4 @@ namespace T6 _NODISCARD bool SupportsZone(Zone* zone) const override; _NODISCARD std::unique_ptr<ZoneWriter> CreateWriter(Zone* zone) const override; }; -} +} // namespace T6 diff --git a/src/ZoneWriting/Writing/AssetWriter.h b/src/ZoneWriting/Writing/AssetWriter.h index b074a889f..bffc5e7ed 100644 --- a/src/ZoneWriting/Writing/AssetWriter.h +++ b/src/ZoneWriting/Writing/AssetWriter.h @@ -1,10 +1,10 @@ #pragma once +#include "ContentWriterBase.h" +#include "Pool/XAssetInfo.h" #include "Utils/ClassUtils.h" #include "Zone/Zone.h" #include "Zone/ZoneTypes.h" -#include "Pool/XAssetInfo.h" -#include "ContentWriterBase.h" class AssetWriter : public ContentWriterBase { diff --git a/src/ZoneWriting/Writing/ContentWriterBase.h b/src/ZoneWriting/Writing/ContentWriterBase.h index 8b752f851..be0cc8ef1 100644 --- a/src/ZoneWriting/Writing/ContentWriterBase.h +++ b/src/ZoneWriting/Writing/ContentWriterBase.h @@ -1,7 +1,7 @@ #pragma once -#include "Zone/Zone.h" #include "Zone/Stream/IZoneOutputStream.h" +#include "Zone/Zone.h" class ContentWriterBase { diff --git a/src/ZoneWriting/Writing/IContentWritingEntryPoint.h b/src/ZoneWriting/Writing/IContentWritingEntryPoint.h index d00f82d1b..11d1962b6 100644 --- a/src/ZoneWriting/Writing/IContentWritingEntryPoint.h +++ b/src/ZoneWriting/Writing/IContentWritingEntryPoint.h @@ -1,7 +1,7 @@ #pragma once -#include "Zone/Zone.h" #include "Zone/Stream/IZoneOutputStream.h" +#include "Zone/Zone.h" class IContentWritingEntryPoint { @@ -14,4 +14,4 @@ class IContentWritingEntryPoint IContentWritingEntryPoint& operator=(IContentWritingEntryPoint&& other) noexcept = default; virtual void WriteContent(Zone* zone, IZoneOutputStream* stream) = 0; -}; \ No newline at end of file +}; diff --git a/src/ZoneWriting/Writing/IWritingStep.h b/src/ZoneWriting/Writing/IWritingStep.h index 43abf30c0..db64f9cdc 100644 --- a/src/ZoneWriting/Writing/IWritingStep.h +++ b/src/ZoneWriting/Writing/IWritingStep.h @@ -1,7 +1,7 @@ #pragma once -#include "Writing/ZoneWriter.h" #include "IWritingStream.h" +#include "Writing/ZoneWriter.h" class ZoneWriter; diff --git a/src/ZoneWriting/Writing/IWritingStream.h b/src/ZoneWriting/Writing/IWritingStream.h index 6324e1337..2e32096dd 100644 --- a/src/ZoneWriting/Writing/IWritingStream.h +++ b/src/ZoneWriting/Writing/IWritingStream.h @@ -1,7 +1,7 @@ #pragma once -#include <cstdint> #include <cstddef> +#include <cstdint> class IWritingStream { @@ -16,4 +16,4 @@ class IWritingStream virtual void Write(const void* buffer, size_t length) = 0; virtual void Flush() = 0; virtual int64_t Pos() = 0; -}; \ No newline at end of file +}; diff --git a/src/ZoneWriting/Writing/IZoneWriterFactory.h b/src/ZoneWriting/Writing/IZoneWriterFactory.h index e855b55fc..84a1d484f 100644 --- a/src/ZoneWriting/Writing/IZoneWriterFactory.h +++ b/src/ZoneWriting/Writing/IZoneWriterFactory.h @@ -1,8 +1,8 @@ #pragma once #include "Utils/ClassUtils.h" -#include "ZoneWriter.h" #include "Zone/Zone.h" +#include "ZoneWriter.h" class IZoneWriterFactory { @@ -16,4 +16,4 @@ class IZoneWriterFactory _NODISCARD virtual bool SupportsZone(Zone* zone) const = 0; _NODISCARD virtual std::unique_ptr<ZoneWriter> CreateWriter(Zone* zone) const = 0; -}; \ No newline at end of file +}; diff --git a/src/ZoneWriting/Writing/InMemoryZoneData.cpp b/src/ZoneWriting/Writing/InMemoryZoneData.cpp index 79a0a7ef3..48894c0e6 100644 --- a/src/ZoneWriting/Writing/InMemoryZoneData.cpp +++ b/src/ZoneWriting/Writing/InMemoryZoneData.cpp @@ -18,7 +18,7 @@ InMemoryZoneData::MemoryBuffer::MemoryBuffer(const size_t size) void* InMemoryZoneData::GetBufferOfSize(const size_t size) { - if(size > BUFFER_SIZE) + if (size > BUFFER_SIZE) { m_buffers.emplace_back(size); } diff --git a/src/ZoneWriting/Writing/InMemoryZoneData.h b/src/ZoneWriting/Writing/InMemoryZoneData.h index 0d43bdb8a..ede184061 100644 --- a/src/ZoneWriting/Writing/InMemoryZoneData.h +++ b/src/ZoneWriting/Writing/InMemoryZoneData.h @@ -1,7 +1,7 @@ #pragma once -#include <vector> #include <memory> +#include <vector> class InMemoryZoneData { @@ -22,4 +22,4 @@ class InMemoryZoneData InMemoryZoneData(); void* GetBufferOfSize(size_t size); -}; \ No newline at end of file +}; diff --git a/src/ZoneWriting/Writing/OutputStreamProcessor.cpp b/src/ZoneWriting/Writing/OutputStreamProcessor.cpp index 81f5e86e0..c95d8bc3c 100644 --- a/src/ZoneWriting/Writing/OutputStreamProcessor.cpp +++ b/src/ZoneWriting/Writing/OutputStreamProcessor.cpp @@ -8,4 +8,4 @@ OutputStreamProcessor::OutputStreamProcessor() void OutputStreamProcessor::SetBaseStream(IWritingStream* baseStream) { m_base_stream = baseStream; -} \ No newline at end of file +} diff --git a/src/ZoneWriting/Writing/Processor/OutputProcessorDeflate.cpp b/src/ZoneWriting/Writing/Processor/OutputProcessorDeflate.cpp index 84c6eaac3..07abf2308 100644 --- a/src/ZoneWriting/Writing/Processor/OutputProcessorDeflate.cpp +++ b/src/ZoneWriting/Writing/Processor/OutputProcessorDeflate.cpp @@ -1,13 +1,13 @@ #include "OutputProcessorDeflate.h" -#include <stdexcept> +#include "Utils/ClassUtils.h" +#include "Writing/WritingException.h" + #include <cstdint> #include <memory> +#include <stdexcept> #include <zlib.h> -#include "Utils/ClassUtils.h" -#include "Writing/WritingException.h" - class OutputProcessorDeflate::Impl { z_stream m_stream{}; @@ -62,7 +62,7 @@ class OutputProcessorDeflate::Impl m_stream.next_out = m_buffer.get(); m_stream.avail_out = m_buffer_size; } - + const auto ret = deflate(&m_stream, Z_NO_FLUSH); if (ret != Z_OK) throw WritingException("Failed to deflate memory of zone."); @@ -73,7 +73,7 @@ class OutputProcessorDeflate::Impl { m_stream.avail_in = 0; m_stream.next_in = Z_NULL; - while(true) + while (true) { if (m_stream.avail_out < m_buffer_size) { @@ -83,7 +83,7 @@ class OutputProcessorDeflate::Impl } const auto ret = deflate(&m_stream, Z_FINISH); - if(ret == Z_OK) + if (ret == Z_OK) continue; if (ret != Z_STREAM_END) diff --git a/src/ZoneWriting/Writing/Processor/OutputProcessorDeflate.h b/src/ZoneWriting/Writing/Processor/OutputProcessorDeflate.h index a7e7036e2..69a27b0f6 100644 --- a/src/ZoneWriting/Writing/Processor/OutputProcessorDeflate.h +++ b/src/ZoneWriting/Writing/Processor/OutputProcessorDeflate.h @@ -1,9 +1,9 @@ #pragma once -#include <cstdint> -#include <cstddef> - #include "Writing/OutputStreamProcessor.h" +#include <cstddef> +#include <cstdint> + class OutputProcessorDeflate final : public OutputStreamProcessor { class Impl; @@ -23,4 +23,4 @@ class OutputProcessorDeflate final : public OutputStreamProcessor void Write(const void* buffer, size_t length) override; void Flush() override; int64_t Pos() override; -}; \ No newline at end of file +}; diff --git a/src/ZoneWriting/Writing/Processor/OutputProcessorXChunks.cpp b/src/ZoneWriting/Writing/Processor/OutputProcessorXChunks.cpp index 4bf265a63..910e941e0 100644 --- a/src/ZoneWriting/Writing/Processor/OutputProcessorXChunks.cpp +++ b/src/ZoneWriting/Writing/Processor/OutputProcessorXChunks.cpp @@ -1,11 +1,11 @@ #include "OutputProcessorXChunks.h" -#include <cassert> -#include <cstring> - #include "Writing/WritingException.h" -#include "Zone/ZoneTypes.h" #include "Zone/XChunk/XChunkException.h" +#include "Zone/ZoneTypes.h" + +#include <cassert> +#include <cstring> void OutputProcessorXChunks::Init() { diff --git a/src/ZoneWriting/Writing/Processor/OutputProcessorXChunks.h b/src/ZoneWriting/Writing/Processor/OutputProcessorXChunks.h index 83ff87156..5a8a28e06 100644 --- a/src/ZoneWriting/Writing/Processor/OutputProcessorXChunks.h +++ b/src/ZoneWriting/Writing/Processor/OutputProcessorXChunks.h @@ -1,12 +1,12 @@ #pragma once -#include <memory> -#include <vector> -#include <cstdint> -#include <cstddef> - #include "Writing/OutputStreamProcessor.h" #include "Zone/XChunk/IXChunkProcessor.h" +#include <cstddef> +#include <cstdint> +#include <memory> +#include <vector> + class OutputProcessorXChunks final : public OutputStreamProcessor { std::vector<std::unique_ptr<IXChunkProcessor>> m_chunk_processors; diff --git a/src/ZoneWriting/Writing/Steps/StepAddOutputProcessor.cpp b/src/ZoneWriting/Writing/Steps/StepAddOutputProcessor.cpp index a61831197..64a7e54f8 100644 --- a/src/ZoneWriting/Writing/Steps/StepAddOutputProcessor.cpp +++ b/src/ZoneWriting/Writing/Steps/StepAddOutputProcessor.cpp @@ -1,4 +1,5 @@ #include "StepAddOutputProcessor.h" + #include <cassert> StepAddOutputProcessor::StepAddOutputProcessor(std::unique_ptr<OutputStreamProcessor> streamProcessor) @@ -14,4 +15,4 @@ void StepAddOutputProcessor::PerformStep(ZoneWriter* zoneWriter, IWritingStream* stream->Flush(); zoneWriter->AddStreamProcessor(std::move(m_stream_processor)); m_stream_processor = nullptr; -} \ No newline at end of file +} diff --git a/src/ZoneWriting/Writing/Steps/StepAddOutputProcessor.h b/src/ZoneWriting/Writing/Steps/StepAddOutputProcessor.h index 638a842a0..2e5712385 100644 --- a/src/ZoneWriting/Writing/Steps/StepAddOutputProcessor.h +++ b/src/ZoneWriting/Writing/Steps/StepAddOutputProcessor.h @@ -1,9 +1,9 @@ #pragma once -#include <memory> - -#include "Writing/OutputStreamProcessor.h" #include "Writing/IWritingStep.h" +#include "Writing/OutputStreamProcessor.h" + +#include <memory> class StepAddOutputProcessor final : public IWritingStep { diff --git a/src/ZoneWriting/Writing/Steps/StepAlign.cpp b/src/ZoneWriting/Writing/Steps/StepAlign.cpp index 9f8cdde7d..be6a241d6 100644 --- a/src/ZoneWriting/Writing/Steps/StepAlign.cpp +++ b/src/ZoneWriting/Writing/Steps/StepAlign.cpp @@ -12,6 +12,6 @@ void StepAlign::PerformStep(ZoneWriter* zoneWriter, IWritingStream* stream) const auto targetPos = (pos + m_align_to - 1) / m_align_to * m_align_to; const auto valueCount = static_cast<size_t>(targetPos - pos); - for(auto i = 0u; i < valueCount; i++) + for (auto i = 0u; i < valueCount; i++) stream->Write(&m_align_value, sizeof(m_align_value)); } diff --git a/src/ZoneWriting/Writing/Steps/StepAlign.h b/src/ZoneWriting/Writing/Steps/StepAlign.h index aa730a2f9..7fb076010 100644 --- a/src/ZoneWriting/Writing/Steps/StepAlign.h +++ b/src/ZoneWriting/Writing/Steps/StepAlign.h @@ -1,10 +1,10 @@ #pragma once +#include "Writing/IWritingStep.h" + #include <cstddef> #include <cstdint> -#include "Writing/IWritingStep.h" - class StepAlign final : public IWritingStep { size_t m_align_to; diff --git a/src/ZoneWriting/Writing/Steps/StepRemoveOutputProcessor.h b/src/ZoneWriting/Writing/Steps/StepRemoveOutputProcessor.h index 7b8fc1f8d..f1f5c7fbb 100644 --- a/src/ZoneWriting/Writing/Steps/StepRemoveOutputProcessor.h +++ b/src/ZoneWriting/Writing/Steps/StepRemoveOutputProcessor.h @@ -1,7 +1,7 @@ #pragma once -#include "Writing/OutputStreamProcessor.h" #include "Writing/IWritingStep.h" +#include "Writing/OutputStreamProcessor.h" class StepRemoveOutputProcessor final : public IWritingStep { diff --git a/src/ZoneWriting/Writing/Steps/StepWriteTimestamp.cpp b/src/ZoneWriting/Writing/Steps/StepWriteTimestamp.cpp index c06812655..763a30074 100644 --- a/src/ZoneWriting/Writing/Steps/StepWriteTimestamp.cpp +++ b/src/ZoneWriting/Writing/Steps/StepWriteTimestamp.cpp @@ -3,9 +3,7 @@ #include <algorithm> #include <ctime> -StepWriteTimestamp::StepWriteTimestamp() -{ -} +StepWriteTimestamp::StepWriteTimestamp() {} void StepWriteTimestamp::PerformStep(ZoneWriter* zoneWriter, IWritingStream* stream) { diff --git a/src/ZoneWriting/Writing/Steps/StepWriteXBlockSizes.cpp b/src/ZoneWriting/Writing/Steps/StepWriteXBlockSizes.cpp index baa59ff56..d3f0bd383 100644 --- a/src/ZoneWriting/Writing/Steps/StepWriteXBlockSizes.cpp +++ b/src/ZoneWriting/Writing/Steps/StepWriteXBlockSizes.cpp @@ -7,7 +7,7 @@ StepWriteXBlockSizes::StepWriteXBlockSizes(Zone* zone) void StepWriteXBlockSizes::PerformStep(ZoneWriter* zoneWriter, IWritingStream* stream) { - for(const auto& block : zoneWriter->m_blocks) + for (const auto& block : zoneWriter->m_blocks) { auto blockSize = static_cast<xblock_size_t>(block->m_buffer_size); stream->Write(&blockSize, sizeof(blockSize)); diff --git a/src/ZoneWriting/Writing/Steps/StepWriteZero.cpp b/src/ZoneWriting/Writing/Steps/StepWriteZero.cpp index 940df2ae5..5fc423683 100644 --- a/src/ZoneWriting/Writing/Steps/StepWriteZero.cpp +++ b/src/ZoneWriting/Writing/Steps/StepWriteZero.cpp @@ -12,7 +12,7 @@ void StepWriteZero::PerformStep(ZoneWriter* zoneWriter, IWritingStream* stream) const uint64_t num = 0; size_t toWrite; - for(auto i = 0u; i < m_count; i += toWrite) + for (auto i = 0u; i < m_count; i += toWrite) { toWrite = std::min(sizeof(uint64_t), m_count - i); stream->Write(&num, toWrite); diff --git a/src/ZoneWriting/Writing/Steps/StepWriteZoneContentToFile.cpp b/src/ZoneWriting/Writing/Steps/StepWriteZoneContentToFile.cpp index 8348c331e..ea45c3898 100644 --- a/src/ZoneWriting/Writing/Steps/StepWriteZoneContentToFile.cpp +++ b/src/ZoneWriting/Writing/Steps/StepWriteZoneContentToFile.cpp @@ -7,7 +7,7 @@ StepWriteZoneContentToFile::StepWriteZoneContentToFile(StepWriteZoneContentToMem void StepWriteZoneContentToFile::PerformStep(ZoneWriter* zoneWriter, IWritingStream* stream) { - for(const auto& dataBuffer : m_memory->GetData()->m_buffers) + for (const auto& dataBuffer : m_memory->GetData()->m_buffers) { stream->Write(dataBuffer.m_data.get(), dataBuffer.m_size); } diff --git a/src/ZoneWriting/Writing/Steps/StepWriteZoneContentToMemory.cpp b/src/ZoneWriting/Writing/Steps/StepWriteZoneContentToMemory.cpp index 225367a84..8db79a621 100644 --- a/src/ZoneWriting/Writing/Steps/StepWriteZoneContentToMemory.cpp +++ b/src/ZoneWriting/Writing/Steps/StepWriteZoneContentToMemory.cpp @@ -2,7 +2,10 @@ #include "Zone/Stream/Impl/InMemoryZoneOutputStream.h" -StepWriteZoneContentToMemory::StepWriteZoneContentToMemory(std::unique_ptr<IContentWritingEntryPoint> entryPoint, Zone* zone, int offsetBlockBitCount, block_t insertBlock) +StepWriteZoneContentToMemory::StepWriteZoneContentToMemory(std::unique_ptr<IContentWritingEntryPoint> entryPoint, + Zone* zone, + int offsetBlockBitCount, + block_t insertBlock) : m_content_loader(std::move(entryPoint)), m_zone_data(std::make_unique<InMemoryZoneData>()), m_zone(zone), diff --git a/src/ZoneWriting/Writing/Steps/StepWriteZoneContentToMemory.h b/src/ZoneWriting/Writing/Steps/StepWriteZoneContentToMemory.h index 6ec4713e6..ed92205d7 100644 --- a/src/ZoneWriting/Writing/Steps/StepWriteZoneContentToMemory.h +++ b/src/ZoneWriting/Writing/Steps/StepWriteZoneContentToMemory.h @@ -1,11 +1,11 @@ #pragma once -#include <memory> - #include "Utils/ClassUtils.h" #include "Writing/IContentWritingEntryPoint.h" -#include "Writing/InMemoryZoneData.h" #include "Writing/IWritingStep.h" +#include "Writing/InMemoryZoneData.h" + +#include <memory> class StepWriteZoneContentToMemory final : public IWritingStep { diff --git a/src/ZoneWriting/Writing/WritingException.h b/src/ZoneWriting/Writing/WritingException.h index d3dc8664c..c3725b6f8 100644 --- a/src/ZoneWriting/Writing/WritingException.h +++ b/src/ZoneWriting/Writing/WritingException.h @@ -1,9 +1,9 @@ #pragma once -#include <string> -#include <exception> - #include "Utils/ClassUtils.h" +#include <exception> +#include <string> + class WritingException final : public std::exception { std::string m_error_message; diff --git a/src/ZoneWriting/Writing/WritingFileStream.h b/src/ZoneWriting/Writing/WritingFileStream.h index 117d711f0..1aa9dfa27 100644 --- a/src/ZoneWriting/Writing/WritingFileStream.h +++ b/src/ZoneWriting/Writing/WritingFileStream.h @@ -1,8 +1,8 @@ #pragma once -#include <ostream> - #include "IWritingStream.h" +#include <ostream> + class WritingFileStream final : public IWritingStream { std::ostream& m_stream; diff --git a/src/ZoneWriting/Writing/ZoneWriter.cpp b/src/ZoneWriting/Writing/ZoneWriter.cpp index 0f5a96f62..522817533 100644 --- a/src/ZoneWriting/Writing/ZoneWriter.cpp +++ b/src/ZoneWriting/Writing/ZoneWriter.cpp @@ -1,11 +1,11 @@ #include "ZoneWriter.h" -#include <iostream> -#include <stdexcept> - #include "WritingException.h" #include "WritingFileStream.h" +#include <iostream> +#include <stdexcept> + ZoneWriter::ZoneWriter() : m_processor_chain_dirty(false) { diff --git a/src/ZoneWriting/Writing/ZoneWriter.h b/src/ZoneWriting/Writing/ZoneWriter.h index 05cae4a43..231bc5ee6 100644 --- a/src/ZoneWriting/Writing/ZoneWriter.h +++ b/src/ZoneWriting/Writing/ZoneWriter.h @@ -1,12 +1,12 @@ #pragma once -#include <vector> -#include <memory> - #include "IWritingStep.h" #include "OutputStreamProcessor.h" #include "Zone/Zone.h" +#include <memory> +#include <vector> + class IWritingStep; class ZoneWriter diff --git a/src/ZoneWriting/Zone/Stream/IZoneOutputStream.h b/src/ZoneWriting/Zone/Stream/IZoneOutputStream.h index 407685150..b1c890bc4 100644 --- a/src/ZoneWriting/Zone/Stream/IZoneOutputStream.h +++ b/src/ZoneWriting/Zone/Stream/IZoneOutputStream.h @@ -1,11 +1,11 @@ #pragma once +#include "Zone/Stream/IZoneStream.h" + #include <cstddef> #include <typeindex> #include <typeinfo> -#include "Zone/Stream/IZoneStream.h" - class IZoneOutputStream : public IZoneStream { public: @@ -23,44 +23,37 @@ class IZoneOutputStream : public IZoneStream virtual void ReusableAddOffset(void* ptr, size_t size, size_t count, std::type_index type) = 0; virtual void MarkFollowing(void** pPtr) = 0; - template<typename T> - bool ReusableShouldWrite(T** pPtr) + template<typename T> bool ReusableShouldWrite(T** pPtr) { return ReusableShouldWrite(reinterpret_cast<void**>(reinterpret_cast<uintptr_t>(pPtr)), sizeof(T), std::type_index(typeid(T))); } - template<typename T> - void ReusableAddOffset(T* ptr) + template<typename T> void ReusableAddOffset(T* ptr) { ReusableAddOffset(const_cast<void*>(reinterpret_cast<const void*>(ptr)), sizeof(T), 1, std::type_index(typeid(T))); } - template<typename T> - void ReusableAddOffset(T* ptr, const size_t count) + template<typename T> void ReusableAddOffset(T* ptr, const size_t count) { ReusableAddOffset(const_cast<void*>(reinterpret_cast<const void*>(ptr)), sizeof(T), count, std::type_index(typeid(T))); } - template<typename T> - T* Write(T* dst) + template<typename T> T* Write(T* dst) { return static_cast<T*>(WriteDataInBlock(reinterpret_cast<const void*>(dst), sizeof(T))); } - template<typename T> - T* Write(T* dst, const uint32_t count) + template<typename T> T* Write(T* dst, const uint32_t count) { return static_cast<T*>(WriteDataInBlock(reinterpret_cast<const void*>(dst), count * sizeof(T))); } - template<typename T> - T* WritePartial(T* dst, const size_t size) + template<typename T> T* WritePartial(T* dst, const size_t size) { return static_cast<T*>(WriteDataInBlock(reinterpret_cast<const void*>(dst), size)); } - template<typename T> - void MarkFollowing(T*& ptr) + template<typename T> void MarkFollowing(T*& ptr) { MarkFollowing(reinterpret_cast<void**>(reinterpret_cast<uintptr_t>(&ptr))); } diff --git a/src/ZoneWriting/Zone/Stream/Impl/InMemoryZoneOutputStream.cpp b/src/ZoneWriting/Zone/Stream/Impl/InMemoryZoneOutputStream.cpp index df4411ed4..a1f3760da 100644 --- a/src/ZoneWriting/Zone/Stream/Impl/InMemoryZoneOutputStream.cpp +++ b/src/ZoneWriting/Zone/Stream/Impl/InMemoryZoneOutputStream.cpp @@ -15,7 +15,8 @@ InMemoryZoneOutputStream::ReusableEntry::ReusableEntry(void* startPtr, const siz : m_start_ptr(startPtr), m_end_ptr(reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(startPtr) + entrySize * entryCount)), m_start_zone_ptr(startZonePtr), - m_entry_size(entrySize), m_entry_count(entryCount) + m_entry_size(entrySize), + m_entry_count(entryCount) { } @@ -184,16 +185,16 @@ bool InMemoryZoneOutputStream::ReusableShouldWrite(void** pPtr, const size_t ent return true; } - for(const auto& entry : foundEntriesForType->second) + for (const auto& entry : foundEntriesForType->second) { - if(*pPtr >= entry.m_start_ptr && *pPtr < entry.m_end_ptr) + if (*pPtr >= entry.m_start_ptr && *pPtr < entry.m_end_ptr) { assert((reinterpret_cast<uintptr_t>(*pPtr) - reinterpret_cast<uintptr_t>(entry.m_start_ptr)) % entrySize == 0); *pPtr = reinterpret_cast<void*>(entry.m_start_zone_ptr + (reinterpret_cast<uintptr_t>(*pPtr) - reinterpret_cast<uintptr_t>(entry.m_start_ptr))); return false; } } - + return true; } diff --git a/src/ZoneWriting/Zone/Stream/Impl/InMemoryZoneOutputStream.h b/src/ZoneWriting/Zone/Stream/Impl/InMemoryZoneOutputStream.h index f255591c0..3f2f8947e 100644 --- a/src/ZoneWriting/Zone/Stream/Impl/InMemoryZoneOutputStream.h +++ b/src/ZoneWriting/Zone/Stream/Impl/InMemoryZoneOutputStream.h @@ -1,12 +1,12 @@ #pragma once +#include "Writing/InMemoryZoneData.h" +#include "Zone/Stream/IZoneOutputStream.h" +#include "Zone/XBlock.h" + #include <stack> #include <unordered_map> #include <vector> -#include "Writing/InMemoryZoneData.h" -#include "Zone/XBlock.h" -#include "Zone/Stream/IZoneOutputStream.h" - class InMemoryZoneOutputStream final : public IZoneOutputStream { class ReusableEntry diff --git a/src/ZoneWriting/ZoneWriting.cpp b/src/ZoneWriting/ZoneWriting.cpp index 75e6dc116..b0c3af93d 100644 --- a/src/ZoneWriting/ZoneWriting.cpp +++ b/src/ZoneWriting/ZoneWriting.cpp @@ -7,14 +7,8 @@ #include "Game/T6/ZoneWriterFactoryT6.h" #include "Writing/IZoneWriterFactory.h" -IZoneWriterFactory* ZoneWriterFactories[] -{ - new IW3::ZoneWriterFactory(), - new IW4::ZoneWriterFactory(), - new IW5::ZoneWriterFactory(), - new T5::ZoneWriterFactory(), - new T6::ZoneWriterFactory() -}; +IZoneWriterFactory* ZoneWriterFactories[]{ + new IW3::ZoneWriterFactory(), new IW4::ZoneWriterFactory(), new IW5::ZoneWriterFactory(), new T5::ZoneWriterFactory(), new T6::ZoneWriterFactory()}; bool ZoneWriting::WriteZone(std::ostream& stream, Zone* zone) { diff --git a/src/ZoneWriting/ZoneWriting.h b/src/ZoneWriting/ZoneWriting.h index 8d11f67c7..06b106f3d 100644 --- a/src/ZoneWriting/ZoneWriting.h +++ b/src/ZoneWriting/ZoneWriting.h @@ -1,11 +1,11 @@ #pragma once -#include <string> -#include <ostream> - #include "Zone/Zone.h" +#include <ostream> +#include <string> + class ZoneWriting { public: static bool WriteZone(std::ostream& stream, Zone* zone); -}; \ No newline at end of file +}; diff --git a/test/ObjCommonTests/Image/ImageFormatTests.cpp b/test/ObjCommonTests/Image/ImageFormatTests.cpp index a87e1c322..3a7f58f58 100644 --- a/test/ObjCommonTests/Image/ImageFormatTests.cpp +++ b/test/ObjCommonTests/Image/ImageFormatTests.cpp @@ -1,20 +1,19 @@ +#include "Image/ImageFormat.h" + #include <catch2/catch_test_macros.hpp> #include <catch2/generators/catch_generators.hpp> - #include <type_traits> -#include "Image/ImageFormat.h" - namespace image::image_format { - TEST_CASE("ImageFormat: EnsureAllFormatsArrayIndicesAreIds", "[image]") - { - REQUIRE(static_cast<unsigned int>(ImageFormatId::MAX) == std::extent<decltype(ImageFormat::ALL_FORMATS)>::value); + TEST_CASE("ImageFormat: EnsureAllFormatsArrayIndicesAreIds", "[image]") + { + REQUIRE(static_cast<unsigned int>(ImageFormatId::MAX) == std::extent<decltype(ImageFormat::ALL_FORMATS)>::value); - for(unsigned i = 0; i < std::extent<decltype(ImageFormat::ALL_FORMATS)>::value; i++) - { - REQUIRE(ImageFormat::ALL_FORMATS[i] != nullptr); - REQUIRE(i == static_cast<unsigned>(ImageFormat::ALL_FORMATS[i]->GetId())); - } - } -} \ No newline at end of file + for (unsigned i = 0; i < std::extent<decltype(ImageFormat::ALL_FORMATS)>::value; i++) + { + REQUIRE(ImageFormat::ALL_FORMATS[i] != nullptr); + REQUIRE(i == static_cast<unsigned>(ImageFormat::ALL_FORMATS[i]->GetId())); + } + } +} // namespace image::image_format diff --git a/test/ObjCommonTests/Obj/Gdt/GdtTests.cpp b/test/ObjCommonTests/Obj/Gdt/GdtTests.cpp index d8bfa8f23..979fdc6be 100644 --- a/test/ObjCommonTests/Obj/Gdt/GdtTests.cpp +++ b/test/ObjCommonTests/Obj/Gdt/GdtTests.cpp @@ -1,341 +1,340 @@ +#include "Obj/Gdt/Gdt.h" +#include "Obj/Gdt/GdtStream.h" + #include <catch2/catch_test_macros.hpp> #include <catch2/generators/catch_generators.hpp> - #include <sstream> -#include "Obj/Gdt/Gdt.h" -#include "Obj/Gdt/GdtStream.h" - namespace obj::gdt { - TEST_CASE("Gdt: Ensure can parse simple gdt", "[gdt]") - { - std::string gdtString = "{\n" - "\t\"test_entry\" ( \"test.gdf\" )\n" - "\t{\n" - "\t\t\"testkey\" \"testvalue\"\n" - "\t\t\"test2key\" \"test2value\"\n" - "\t}\n" - "}"; - std::istringstream ss(gdtString); - - Gdt gdt; - GdtReader reader(ss); - REQUIRE(reader.Read(gdt)); - - REQUIRE(gdt.m_entries.size() == 1); - - { - const auto& entry = *gdt.m_entries[0]; - REQUIRE(entry.m_name == "test_entry"); - REQUIRE(entry.m_gdf_name == "test.gdf"); - REQUIRE(entry.m_parent == nullptr); - REQUIRE(entry.m_properties.size() == 2); - - REQUIRE(entry.m_properties.at("testkey") == "testvalue"); - REQUIRE(entry.m_properties.at("test2key") == "test2value"); - } - } - - TEST_CASE("Gdt: Ensure can parse compact gdt", "[gdt]") - { - std::string gdtString = "{" - R"("test_entry"("test.gdf"))" - "{" - R"("testkey""testvalue")" - R"("test2key""test2value")" - "}" - "}"; - std::istringstream ss(gdtString); - - Gdt gdt; - GdtReader reader(ss); - REQUIRE(reader.Read(gdt)); - - REQUIRE(gdt.m_entries.size() == 1); - - { - const auto& entry = *gdt.m_entries[0]; - REQUIRE(entry.m_name == "test_entry"); - REQUIRE(entry.m_gdf_name == "test.gdf"); - REQUIRE(entry.m_parent == nullptr); - REQUIRE(entry.m_properties.size() == 2); - - REQUIRE(entry.m_properties.at("testkey") == "testvalue"); - REQUIRE(entry.m_properties.at("test2key") == "test2value"); - } - } - - TEST_CASE("Gdt: Ensure can parse version section", "[gdt]") - { - std::string gdtString = "{" - R"("version" ( "version.gdf" ))" - "{" - R"("game" "t6")" - R"("version" "1337")" - "}" - "}"; - std::istringstream ss(gdtString); - - Gdt gdt; - GdtReader reader(ss); - REQUIRE(reader.Read(gdt)); - - REQUIRE(gdt.m_entries.empty()); - REQUIRE(gdt.m_version.m_game == "t6"); - REQUIRE(gdt.m_version.m_version == 1337); - } - - TEST_CASE("Gdt: Ensure can parse version section and entries", "[gdt]") - { - std::string gdtString = "{" - R"("version" ( "version.gdf" ))" - "{" - R"("game" "t6")" - R"("version" "1337")" - "}" - R"("test_entry" ( "another_test.gdf" ))" - "{" - R"("game" "t6")" - R"("version" "420")" - "}" - "}"; - std::istringstream ss(gdtString); - - Gdt gdt; - GdtReader reader(ss); - REQUIRE(reader.Read(gdt)); - - REQUIRE(gdt.m_version.m_game == "t6"); - REQUIRE(gdt.m_version.m_version == 1337); - - REQUIRE(gdt.m_entries.size() == 1); - - { - const auto& entry = *gdt.m_entries[0]; - REQUIRE(entry.m_name == "test_entry"); - REQUIRE(entry.m_gdf_name == "another_test.gdf"); - REQUIRE(entry.m_parent == nullptr); - REQUIRE(entry.m_properties.size() == 2); - - REQUIRE(entry.m_properties.at("game") == "t6"); - REQUIRE(entry.m_properties.at("version") == "420"); - } - } - - TEST_CASE("Gdt: Ensure can parse multiple entries", "[gdt]") - { - std::string gdtString = "{" - R"("version" ( "version.gdf" ))" - "{" - R"("game" "t6")" - R"("version" "1337")" - "}" - R"("test_entry" ( "another_test.gdf" ))" - "{" - R"("game" "t6")" - R"("version" "420")" - "}" - R"("yet_another_entry" ( "super_kewl_asset_type.gdf" ))" - "{" - R"("name" "hello")" - R"("value" "asdf")" - R"("value2" "22")" - "}" - R"("final_entry" ( "quite_boring.gdf" ))" - "{" - R"("_HI_" "Hello World")" - "}" - "}"; - std::istringstream ss(gdtString); - - Gdt gdt; - GdtReader reader(ss); - REQUIRE(reader.Read(gdt)); - - REQUIRE(gdt.m_version.m_game == "t6"); - REQUIRE(gdt.m_version.m_version == 1337); - - REQUIRE(gdt.m_entries.size() == 3); - - { - const auto& entry = *gdt.m_entries[0]; - REQUIRE(entry.m_name == "test_entry"); - REQUIRE(entry.m_gdf_name == "another_test.gdf"); - REQUIRE(entry.m_parent == nullptr); - REQUIRE(entry.m_properties.size() == 2); - - REQUIRE(entry.m_properties.at("game") == "t6"); - REQUIRE(entry.m_properties.at("version") == "420"); - } - - { - const auto& entry = *gdt.m_entries[1]; - REQUIRE(entry.m_name == "yet_another_entry"); - REQUIRE(entry.m_gdf_name == "super_kewl_asset_type.gdf"); - REQUIRE(entry.m_parent == nullptr); - REQUIRE(entry.m_properties.size() == 3); - - REQUIRE(entry.m_properties.at("name") == "hello"); - REQUIRE(entry.m_properties.at("value") == "asdf"); - REQUIRE(entry.m_properties.at("value2") == "22"); - } - - { - const auto& entry = *gdt.m_entries[2]; - REQUIRE(entry.m_name == "final_entry"); - REQUIRE(entry.m_gdf_name == "quite_boring.gdf"); - REQUIRE(entry.m_parent == nullptr); - REQUIRE(entry.m_properties.size() == 1); - - REQUIRE(entry.m_properties.at("_HI_") == "Hello World"); - } - } - - TEST_CASE("Gdt: Ensure can parse entries with parent", "[gdt]") - { - std::string gdtString = "{" - R"("version" ( "version.gdf" ))" - "{" - R"("game" "t6")" - R"("version" "1337")" - "}" - R"("test_entry" ( "another_test.gdf" ))" - "{" - R"("game" "t6")" - R"("version" "420")" - "}" - R"("yet_another_entry" [ "test_entry" ])" - "{" - R"("name" "hello")" - R"("value" "asdf")" - R"("value2" "22")" - "}" - "}"; - std::istringstream ss(gdtString); - - Gdt gdt; - GdtReader reader(ss); - REQUIRE(reader.Read(gdt)); - - REQUIRE(gdt.m_version.m_game == "t6"); - REQUIRE(gdt.m_version.m_version == 1337); - - REQUIRE(gdt.m_entries.size() == 2); - - { - const auto& entry = *gdt.m_entries[0]; - REQUIRE(entry.m_name == "test_entry"); - REQUIRE(entry.m_gdf_name == "another_test.gdf"); - REQUIRE(entry.m_parent == nullptr); - REQUIRE(entry.m_properties.size() == 2); - - REQUIRE(entry.m_properties.at("game") == "t6"); - REQUIRE(entry.m_properties.at("version") == "420"); - } - - { - const auto& entry = *gdt.m_entries[1]; - REQUIRE(entry.m_name == "yet_another_entry"); - REQUIRE(entry.m_parent == gdt.m_entries[0].get()); - REQUIRE(entry.m_properties.size() == 3); - - REQUIRE(entry.m_properties.at("name") == "hello"); - REQUIRE(entry.m_properties.at("value") == "asdf"); - REQUIRE(entry.m_properties.at("value2") == "22"); - } - } - - TEST_CASE("Gdt: Ensure can write simple gdt and parse it again", "[gdt]") - { - Gdt gdt; - gdt.m_version.m_game = "whatagame"; - gdt.m_version.m_version = 6969; - - { - auto entry = std::make_unique<GdtEntry>("sickentry", "verycool.gdf"); - entry->m_properties["hello"] = "world"; - entry->m_properties["hi"] = "universe"; - gdt.m_entries.emplace_back(std::move(entry)); - } - - { - auto entry = std::make_unique<GdtEntry>("evencoolerentry", gdt.m_entries[0].get()); - entry->m_properties["nope"] = "xd"; - entry->m_properties["idk"] = "whattotypeanymore"; - gdt.m_entries.emplace_back(std::move(entry)); - } - - std::stringstream ss; - GdtOutputStream::WriteGdt(gdt, ss); - - std::cout << ss.str() << std::endl; - - Gdt gdt2; - GdtReader reader(ss); - REQUIRE(reader.Read(gdt2)); - - REQUIRE(gdt2.m_version.m_game == "whatagame"); - REQUIRE(gdt2.m_version.m_version == 6969); - - REQUIRE(gdt2.m_entries.size() == 2); - - { - const auto& entry = *gdt2.m_entries[0]; - REQUIRE(entry.m_name == "sickentry"); - REQUIRE(entry.m_gdf_name == "verycool.gdf"); - REQUIRE(entry.m_parent == nullptr); - REQUIRE(entry.m_properties.size() == 2); - - REQUIRE(entry.m_properties.at("hello") == "world"); - REQUIRE(entry.m_properties.at("hi") == "universe"); - } - - { - const auto& entry = *gdt2.m_entries[1]; - REQUIRE(entry.m_name == "evencoolerentry"); - REQUIRE(entry.m_parent == gdt2.m_entries[0].get()); - REQUIRE(entry.m_properties.size() == 2); - - REQUIRE(entry.m_properties.at("nope") == "xd"); - REQUIRE(entry.m_properties.at("idk") == "whattotypeanymore"); - } - } - - TEST_CASE("Gdt: Ensure can write gdt with escape values and parse it again", "[gdt]") - { - Gdt gdt; - gdt.m_version.m_game = "whatagame"; - gdt.m_version.m_version = 6969; - - { - auto entry = std::make_unique<GdtEntry>("sickentry", "verycool.gdf"); - entry->m_properties["hello"] = "very\nkewl\\stuff"; - gdt.m_entries.emplace_back(std::move(entry)); - } - - std::stringstream ss; - GdtOutputStream::WriteGdt(gdt, ss); - - std::cout << ss.str() << std::endl; - - Gdt gdt2; - GdtReader reader(ss); - REQUIRE(reader.Read(gdt2)); - - REQUIRE(gdt2.m_version.m_game == "whatagame"); - REQUIRE(gdt2.m_version.m_version == 6969); - - REQUIRE(gdt2.m_entries.size() == 1); - - { - const auto& entry = *gdt2.m_entries[0]; - REQUIRE(entry.m_name == "sickentry"); - REQUIRE(entry.m_gdf_name == "verycool.gdf"); - REQUIRE(entry.m_parent == nullptr); - REQUIRE(entry.m_properties.size() == 1); - - REQUIRE(entry.m_properties.at("hello") == "very\nkewl\\stuff"); - } - } -} + TEST_CASE("Gdt: Ensure can parse simple gdt", "[gdt]") + { + std::string gdtString = "{\n" + "\t\"test_entry\" ( \"test.gdf\" )\n" + "\t{\n" + "\t\t\"testkey\" \"testvalue\"\n" + "\t\t\"test2key\" \"test2value\"\n" + "\t}\n" + "}"; + std::istringstream ss(gdtString); + + Gdt gdt; + GdtReader reader(ss); + REQUIRE(reader.Read(gdt)); + + REQUIRE(gdt.m_entries.size() == 1); + + { + const auto& entry = *gdt.m_entries[0]; + REQUIRE(entry.m_name == "test_entry"); + REQUIRE(entry.m_gdf_name == "test.gdf"); + REQUIRE(entry.m_parent == nullptr); + REQUIRE(entry.m_properties.size() == 2); + + REQUIRE(entry.m_properties.at("testkey") == "testvalue"); + REQUIRE(entry.m_properties.at("test2key") == "test2value"); + } + } + + TEST_CASE("Gdt: Ensure can parse compact gdt", "[gdt]") + { + std::string gdtString = "{" + R"("test_entry"("test.gdf"))" + "{" + R"("testkey""testvalue")" + R"("test2key""test2value")" + "}" + "}"; + std::istringstream ss(gdtString); + + Gdt gdt; + GdtReader reader(ss); + REQUIRE(reader.Read(gdt)); + + REQUIRE(gdt.m_entries.size() == 1); + + { + const auto& entry = *gdt.m_entries[0]; + REQUIRE(entry.m_name == "test_entry"); + REQUIRE(entry.m_gdf_name == "test.gdf"); + REQUIRE(entry.m_parent == nullptr); + REQUIRE(entry.m_properties.size() == 2); + + REQUIRE(entry.m_properties.at("testkey") == "testvalue"); + REQUIRE(entry.m_properties.at("test2key") == "test2value"); + } + } + + TEST_CASE("Gdt: Ensure can parse version section", "[gdt]") + { + std::string gdtString = "{" + R"("version" ( "version.gdf" ))" + "{" + R"("game" "t6")" + R"("version" "1337")" + "}" + "}"; + std::istringstream ss(gdtString); + + Gdt gdt; + GdtReader reader(ss); + REQUIRE(reader.Read(gdt)); + + REQUIRE(gdt.m_entries.empty()); + REQUIRE(gdt.m_version.m_game == "t6"); + REQUIRE(gdt.m_version.m_version == 1337); + } + + TEST_CASE("Gdt: Ensure can parse version section and entries", "[gdt]") + { + std::string gdtString = "{" + R"("version" ( "version.gdf" ))" + "{" + R"("game" "t6")" + R"("version" "1337")" + "}" + R"("test_entry" ( "another_test.gdf" ))" + "{" + R"("game" "t6")" + R"("version" "420")" + "}" + "}"; + std::istringstream ss(gdtString); + + Gdt gdt; + GdtReader reader(ss); + REQUIRE(reader.Read(gdt)); + + REQUIRE(gdt.m_version.m_game == "t6"); + REQUIRE(gdt.m_version.m_version == 1337); + + REQUIRE(gdt.m_entries.size() == 1); + + { + const auto& entry = *gdt.m_entries[0]; + REQUIRE(entry.m_name == "test_entry"); + REQUIRE(entry.m_gdf_name == "another_test.gdf"); + REQUIRE(entry.m_parent == nullptr); + REQUIRE(entry.m_properties.size() == 2); + + REQUIRE(entry.m_properties.at("game") == "t6"); + REQUIRE(entry.m_properties.at("version") == "420"); + } + } + + TEST_CASE("Gdt: Ensure can parse multiple entries", "[gdt]") + { + std::string gdtString = "{" + R"("version" ( "version.gdf" ))" + "{" + R"("game" "t6")" + R"("version" "1337")" + "}" + R"("test_entry" ( "another_test.gdf" ))" + "{" + R"("game" "t6")" + R"("version" "420")" + "}" + R"("yet_another_entry" ( "super_kewl_asset_type.gdf" ))" + "{" + R"("name" "hello")" + R"("value" "asdf")" + R"("value2" "22")" + "}" + R"("final_entry" ( "quite_boring.gdf" ))" + "{" + R"("_HI_" "Hello World")" + "}" + "}"; + std::istringstream ss(gdtString); + + Gdt gdt; + GdtReader reader(ss); + REQUIRE(reader.Read(gdt)); + + REQUIRE(gdt.m_version.m_game == "t6"); + REQUIRE(gdt.m_version.m_version == 1337); + + REQUIRE(gdt.m_entries.size() == 3); + + { + const auto& entry = *gdt.m_entries[0]; + REQUIRE(entry.m_name == "test_entry"); + REQUIRE(entry.m_gdf_name == "another_test.gdf"); + REQUIRE(entry.m_parent == nullptr); + REQUIRE(entry.m_properties.size() == 2); + + REQUIRE(entry.m_properties.at("game") == "t6"); + REQUIRE(entry.m_properties.at("version") == "420"); + } + + { + const auto& entry = *gdt.m_entries[1]; + REQUIRE(entry.m_name == "yet_another_entry"); + REQUIRE(entry.m_gdf_name == "super_kewl_asset_type.gdf"); + REQUIRE(entry.m_parent == nullptr); + REQUIRE(entry.m_properties.size() == 3); + + REQUIRE(entry.m_properties.at("name") == "hello"); + REQUIRE(entry.m_properties.at("value") == "asdf"); + REQUIRE(entry.m_properties.at("value2") == "22"); + } + + { + const auto& entry = *gdt.m_entries[2]; + REQUIRE(entry.m_name == "final_entry"); + REQUIRE(entry.m_gdf_name == "quite_boring.gdf"); + REQUIRE(entry.m_parent == nullptr); + REQUIRE(entry.m_properties.size() == 1); + + REQUIRE(entry.m_properties.at("_HI_") == "Hello World"); + } + } + + TEST_CASE("Gdt: Ensure can parse entries with parent", "[gdt]") + { + std::string gdtString = "{" + R"("version" ( "version.gdf" ))" + "{" + R"("game" "t6")" + R"("version" "1337")" + "}" + R"("test_entry" ( "another_test.gdf" ))" + "{" + R"("game" "t6")" + R"("version" "420")" + "}" + R"("yet_another_entry" [ "test_entry" ])" + "{" + R"("name" "hello")" + R"("value" "asdf")" + R"("value2" "22")" + "}" + "}"; + std::istringstream ss(gdtString); + + Gdt gdt; + GdtReader reader(ss); + REQUIRE(reader.Read(gdt)); + + REQUIRE(gdt.m_version.m_game == "t6"); + REQUIRE(gdt.m_version.m_version == 1337); + + REQUIRE(gdt.m_entries.size() == 2); + + { + const auto& entry = *gdt.m_entries[0]; + REQUIRE(entry.m_name == "test_entry"); + REQUIRE(entry.m_gdf_name == "another_test.gdf"); + REQUIRE(entry.m_parent == nullptr); + REQUIRE(entry.m_properties.size() == 2); + + REQUIRE(entry.m_properties.at("game") == "t6"); + REQUIRE(entry.m_properties.at("version") == "420"); + } + + { + const auto& entry = *gdt.m_entries[1]; + REQUIRE(entry.m_name == "yet_another_entry"); + REQUIRE(entry.m_parent == gdt.m_entries[0].get()); + REQUIRE(entry.m_properties.size() == 3); + + REQUIRE(entry.m_properties.at("name") == "hello"); + REQUIRE(entry.m_properties.at("value") == "asdf"); + REQUIRE(entry.m_properties.at("value2") == "22"); + } + } + + TEST_CASE("Gdt: Ensure can write simple gdt and parse it again", "[gdt]") + { + Gdt gdt; + gdt.m_version.m_game = "whatagame"; + gdt.m_version.m_version = 6969; + + { + auto entry = std::make_unique<GdtEntry>("sickentry", "verycool.gdf"); + entry->m_properties["hello"] = "world"; + entry->m_properties["hi"] = "universe"; + gdt.m_entries.emplace_back(std::move(entry)); + } + + { + auto entry = std::make_unique<GdtEntry>("evencoolerentry", gdt.m_entries[0].get()); + entry->m_properties["nope"] = "xd"; + entry->m_properties["idk"] = "whattotypeanymore"; + gdt.m_entries.emplace_back(std::move(entry)); + } + + std::stringstream ss; + GdtOutputStream::WriteGdt(gdt, ss); + + std::cout << ss.str() << std::endl; + + Gdt gdt2; + GdtReader reader(ss); + REQUIRE(reader.Read(gdt2)); + + REQUIRE(gdt2.m_version.m_game == "whatagame"); + REQUIRE(gdt2.m_version.m_version == 6969); + + REQUIRE(gdt2.m_entries.size() == 2); + + { + const auto& entry = *gdt2.m_entries[0]; + REQUIRE(entry.m_name == "sickentry"); + REQUIRE(entry.m_gdf_name == "verycool.gdf"); + REQUIRE(entry.m_parent == nullptr); + REQUIRE(entry.m_properties.size() == 2); + + REQUIRE(entry.m_properties.at("hello") == "world"); + REQUIRE(entry.m_properties.at("hi") == "universe"); + } + + { + const auto& entry = *gdt2.m_entries[1]; + REQUIRE(entry.m_name == "evencoolerentry"); + REQUIRE(entry.m_parent == gdt2.m_entries[0].get()); + REQUIRE(entry.m_properties.size() == 2); + + REQUIRE(entry.m_properties.at("nope") == "xd"); + REQUIRE(entry.m_properties.at("idk") == "whattotypeanymore"); + } + } + + TEST_CASE("Gdt: Ensure can write gdt with escape values and parse it again", "[gdt]") + { + Gdt gdt; + gdt.m_version.m_game = "whatagame"; + gdt.m_version.m_version = 6969; + + { + auto entry = std::make_unique<GdtEntry>("sickentry", "verycool.gdf"); + entry->m_properties["hello"] = "very\nkewl\\stuff"; + gdt.m_entries.emplace_back(std::move(entry)); + } + + std::stringstream ss; + GdtOutputStream::WriteGdt(gdt, ss); + + std::cout << ss.str() << std::endl; + + Gdt gdt2; + GdtReader reader(ss); + REQUIRE(reader.Read(gdt2)); + + REQUIRE(gdt2.m_version.m_game == "whatagame"); + REQUIRE(gdt2.m_version.m_version == 6969); + + REQUIRE(gdt2.m_entries.size() == 1); + + { + const auto& entry = *gdt2.m_entries[0]; + REQUIRE(entry.m_name == "sickentry"); + REQUIRE(entry.m_gdf_name == "verycool.gdf"); + REQUIRE(entry.m_parent == nullptr); + REQUIRE(entry.m_properties.size() == 1); + + REQUIRE(entry.m_properties.at("hello") == "very\nkewl\\stuff"); + } + } +} // namespace obj::gdt diff --git a/test/ObjLoadingTests/Game/IW4/Menu/MenuParsingIW4IT.cpp b/test/ObjLoadingTests/Game/IW4/Menu/MenuParsingIW4IT.cpp index 493cf5d97..f9b1f4c71 100644 --- a/test/ObjLoadingTests/Game/IW4/Menu/MenuParsingIW4IT.cpp +++ b/test/ObjLoadingTests/Game/IW4/Menu/MenuParsingIW4IT.cpp @@ -1,16 +1,15 @@ -#include <catch2/catch_test_macros.hpp> -#include <catch2/matchers/catch_matchers_floating_point.hpp> -#include <catch2/generators/catch_generators.hpp> - -#include <string> - -#include "Game/IW4/GameIW4.h" #include "Game/IW4/AssetLoaders/AssetLoaderMenuList.h" +#include "Game/IW4/GameIW4.h" #include "Mock/MockAssetLoadingManager.h" #include "Mock/MockSearchPath.h" #include "Parsing/Menu/MenuFileReader.h" #include "Utils/MemoryManager.h" +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> +#include <catch2/matchers/catch_matchers_floating_point.hpp> +#include <string> + using namespace menu; using namespace IW4; using namespace std::literals; @@ -18,71 +17,71 @@ using namespace Catch::Matchers; namespace test::game::iw4::menu::parsing::it { - class MenuParsingItHelper - { - static constexpr const char* DEFAULT_ASSET_NAME = "test.txt"; - - Zone m_zone; - MockSearchPath m_search_path; - MockAssetLoadingManager m_manager; - AssetLoaderMenuList m_asset_loader; - - public: - MenuParsingItHelper() - : m_zone("MockZone", 0, &g_GameIW4), - m_manager(&m_zone, &m_search_path) - { - } + class MenuParsingItHelper + { + static constexpr const char* DEFAULT_ASSET_NAME = "test.txt"; + + Zone m_zone; + MockSearchPath m_search_path; + MockAssetLoadingManager m_manager; + AssetLoaderMenuList m_asset_loader; + + public: + MenuParsingItHelper() + : m_zone("MockZone", 0, &g_GameIW4), + m_manager(&m_zone, &m_search_path) + { + } - void AddFile(std::string fileName, std::string data) - { - m_search_path.AddFileData(std::move(fileName), std::move(data)); - } + void AddFile(std::string fileName, std::string data) + { + m_search_path.AddFileData(std::move(fileName), std::move(data)); + } - void AddFile(std::string data) - { - AddFile(DEFAULT_ASSET_NAME, std::move(data)); - } + void AddFile(std::string data) + { + AddFile(DEFAULT_ASSET_NAME, std::move(data)); + } - Material* AddMaterial(const std::string& name) - { - auto* material = m_zone.GetMemory()->Create<Material>(); - material->info.name = m_zone.GetMemory()->Dup(name.c_str()); + Material* AddMaterial(const std::string& name) + { + auto* material = m_zone.GetMemory()->Create<Material>(); + material->info.name = m_zone.GetMemory()->Dup(name.c_str()); - m_manager.MockAddAvailableDependency(ASSET_TYPE_MATERIAL, name, material); + m_manager.MockAddAvailableDependency(ASSET_TYPE_MATERIAL, name, material); - return material; - } + return material; + } - bool RunIntegrationTest() - { - return m_asset_loader.LoadFromRaw(DEFAULT_ASSET_NAME, &m_search_path, m_zone.GetMemory(), &m_manager, &m_zone); - } + bool RunIntegrationTest() + { + return m_asset_loader.LoadFromRaw(DEFAULT_ASSET_NAME, &m_search_path, m_zone.GetMemory(), &m_manager, &m_zone); + } - MenuList* GetMenuListAsset() - { - const auto addedAsset = m_manager.MockGetAddedAsset(DEFAULT_ASSET_NAME); - REQUIRE(addedAsset); - REQUIRE(addedAsset->m_type == ASSET_TYPE_MENULIST); + MenuList* GetMenuListAsset() + { + const auto addedAsset = m_manager.MockGetAddedAsset(DEFAULT_ASSET_NAME); + REQUIRE(addedAsset); + REQUIRE(addedAsset->m_type == ASSET_TYPE_MENULIST); - return static_cast<MenuList*>(addedAsset->m_ptr); - } + return static_cast<MenuList*>(addedAsset->m_ptr); + } - menuDef_t* GetMenuAsset(const std::string& menuName) - { - const auto addedAsset = m_manager.MockGetAddedAsset(menuName); - REQUIRE(addedAsset); - REQUIRE(addedAsset->m_type == ASSET_TYPE_MENU); + menuDef_t* GetMenuAsset(const std::string& menuName) + { + const auto addedAsset = m_manager.MockGetAddedAsset(menuName); + REQUIRE(addedAsset); + REQUIRE(addedAsset->m_type == ASSET_TYPE_MENU); - return static_cast<menuDef_t*>(addedAsset->m_ptr); - } - }; + return static_cast<menuDef_t*>(addedAsset->m_ptr); + } + }; - TEST_CASE("MenuParsingIW4IT: Can convert simple menu without properties", "[parsing][converting][menu][it]") - { - MenuParsingItHelper helper; + TEST_CASE("MenuParsingIW4IT: Can convert simple menu without properties", "[parsing][converting][menu][it]") + { + MenuParsingItHelper helper; - helper.AddFile(R"testmenu( + helper.AddFile(R"testmenu( { menuDef { @@ -91,27 +90,27 @@ namespace test::game::iw4::menu::parsing::it } )testmenu"); - const auto result = helper.RunIntegrationTest(); - REQUIRE(result); + const auto result = helper.RunIntegrationTest(); + REQUIRE(result); - const auto* menuList = helper.GetMenuListAsset(); - const auto* menu = helper.GetMenuAsset("Hello"); + const auto* menuList = helper.GetMenuListAsset(); + const auto* menu = helper.GetMenuAsset("Hello"); - REQUIRE(menuList->menuCount == 1); - REQUIRE(menuList->menus); + REQUIRE(menuList->menuCount == 1); + REQUIRE(menuList->menus); - REQUIRE(menuList->menus[0] == menu); + REQUIRE(menuList->menus[0] == menu); - REQUIRE(menu->window.name == "Hello"s); - REQUIRE(menu->itemCount == 0); - REQUIRE(menu->items == nullptr); - } + REQUIRE(menu->window.name == "Hello"s); + REQUIRE(menu->itemCount == 0); + REQUIRE(menu->items == nullptr); + } - TEST_CASE("MenuParsingIW4IT: Can convert simple menu", "[parsing][converting][menu][it]") - { - MenuParsingItHelper helper; + TEST_CASE("MenuParsingIW4IT: Can convert simple menu", "[parsing][converting][menu][it]") + { + MenuParsingItHelper helper; - helper.AddFile(R"testmenu( + helper.AddFile(R"testmenu( #define COOL_STYLE 5 #define VISIBILITY_ENABLED 1 #define HIDE_STUPID_ELEMENTS 0 @@ -170,144 +169,147 @@ namespace test::game::iw4::menu::parsing::it } )testmenu"); - const auto* funnyDogMaterial = helper.AddMaterial("funny_dog.png"); - - const auto result = helper.RunIntegrationTest(); - REQUIRE(result); - - const auto* menuList = helper.GetMenuListAsset(); - const auto* menu = helper.GetMenuAsset("Bla"); - - REQUIRE(menuList->menuCount == 1); - REQUIRE(menuList->menus); - - REQUIRE(menuList->menus[0] == menu); - - REQUIRE(menu->window.name == "Bla"s); - REQUIRE(menu->fullScreen > 0); - REQUIRE(menu->window.staticFlags & WINDOW_FLAG_SCREEN_SPACE); - REQUIRE(menu->window.staticFlags & WINDOW_FLAG_DECORATION); - REQUIRE_THAT(menu->window.rect.x, WithinRel(420.0f)); - REQUIRE_THAT(menu->window.rect.y, WithinRel(1337.0f)); - REQUIRE_THAT(menu->window.rect.w, WithinRel(12.0f)); - REQUIRE_THAT(menu->window.rect.h, WithinRel(64.0f)); - REQUIRE(menu->window.rect.horzAlign == 1); - REQUIRE(menu->window.rect.vertAlign == 2); - REQUIRE(menu->window.style == 5); - - REQUIRE(menu->visibleExp == nullptr); - REQUIRE(menu->window.dynamicFlags[0] & WINDOW_FLAG_VISIBLE); - - REQUIRE(menu->onOpen != nullptr); - REQUIRE(menu->onOpen->eventHandlerCount == 1); - REQUIRE(menu->onOpen->eventHandlers[0]->eventType == EventType::EVENT_UNCONDITIONAL); - REQUIRE(menu->onOpen->eventHandlers[0]->eventData.unconditionalScript != nullptr); - REQUIRE(menu->onOpen->eventHandlers[0]->eventData.unconditionalScript == R"("focusFirst" ; "play" "fart_sound" ; "exec" "wait 1; set r_fullbright 1" ; )"s); - - REQUIRE(menu->onClose != nullptr); - REQUIRE(menu->onClose->eventHandlerCount == 4); - REQUIRE(menu->onClose->eventHandlers[0]->eventType == EventType::EVENT_UNCONDITIONAL); - REQUIRE(menu->onClose->eventHandlers[0]->eventData.unconditionalScript != nullptr); - REQUIRE(menu->onClose->eventHandlers[0]->eventData.unconditionalScript == R"("setBackground" "cute_cat.jpg" ; )"s); - REQUIRE(menu->onClose->eventHandlers[1]->eventType == EventType::EVENT_IF); - REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript != nullptr); - REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventExpression != nullptr); - REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventExpression->numEntries == 5); - REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventExpression->entries[0].type == expressionEntryType::EET_OPERATOR); - REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventExpression->entries[0].data.op == 102); // anynewmappacks - REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventExpression->entries[1].type == expressionEntryType::EET_OPERATOR); - REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventExpression->entries[1].data.op == OP_RIGHTPAREN); - REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventExpression->entries[2].type == expressionEntryType::EET_OPERATOR); - REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventExpression->entries[2].data.op == OP_AND); - REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventExpression->entries[3].type == expressionEntryType::EET_OPERATOR); - REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventExpression->entries[3].data.op == 118); // isreloading - REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventExpression->entries[4].type == expressionEntryType::EET_OPERATOR); - REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventExpression->entries[4].data.op == OP_RIGHTPAREN); - REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventHandlerSet != nullptr); - REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventHandlerSet->eventHandlerCount == 1); - REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventHandlerSet->eventHandlers != nullptr); - REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventHandlerSet->eventHandlers[0] != nullptr); - REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventHandlerSet->eventHandlers[0]->eventType == EventType::EVENT_UNCONDITIONAL); - REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventHandlerSet->eventHandlers[0]->eventData.unconditionalScript == R"("exec" "quit" ; )"s); - REQUIRE(menu->onClose->eventHandlers[2]->eventType == EventType::EVENT_ELSE); - REQUIRE(menu->onClose->eventHandlers[2]->eventData.elseScript != nullptr); - REQUIRE(menu->onClose->eventHandlers[2]->eventData.elseScript->eventHandlerCount == 1); - REQUIRE(menu->onClose->eventHandlers[2]->eventData.elseScript->eventHandlers != nullptr); - REQUIRE(menu->onClose->eventHandlers[2]->eventData.elseScript->eventHandlers[0] != nullptr); - REQUIRE(menu->onClose->eventHandlers[2]->eventData.elseScript->eventHandlers[0]->eventType == EventType::EVENT_UNCONDITIONAL); - REQUIRE(menu->onClose->eventHandlers[2]->eventData.elseScript->eventHandlers[0]->eventData.unconditionalScript == R"("uiScript" "startSingleplayer" ; )"s); - REQUIRE(menu->onClose->eventHandlers[3]->eventType == EventType::EVENT_UNCONDITIONAL); - REQUIRE(menu->onClose->eventHandlers[3]->eventData.unconditionalScript != nullptr); - REQUIRE(menu->onClose->eventHandlers[3]->eventData.unconditionalScript == R"("setGameMode" "dm" ; )"s); - - REQUIRE(menu->onCloseRequest != nullptr); - REQUIRE(menu->onCloseRequest->eventHandlerCount == 1); - REQUIRE(menu->onCloseRequest->eventHandlers[0]->eventType == EventType::EVENT_UNCONDITIONAL); - REQUIRE(menu->onCloseRequest->eventHandlers[0]->eventData.unconditionalScript != nullptr); - REQUIRE(menu->onCloseRequest->eventHandlers[0]->eventData.unconditionalScript == R"("play" "nope" ; )"s); - - REQUIRE(menu->onESC != nullptr); - REQUIRE(menu->onESC->eventHandlerCount == 1); - REQUIRE(menu->onESC->eventHandlers[0]->eventType == EventType::EVENT_UNCONDITIONAL); - REQUIRE(menu->onESC->eventHandlers[0]->eventData.unconditionalScript != nullptr); - REQUIRE(menu->onESC->eventHandlers[0]->eventData.unconditionalScript == R"("setColor" "backColor" "1" "0.5" "0.1" "1" ; )"s); - - REQUIRE(menu->window.border == 1); - REQUIRE_THAT(menu->window.borderSize, WithinRel(1.25f)); - REQUIRE_THAT(menu->window.borderSize, WithinRel(1.25)); - REQUIRE_THAT(menu->window.backColor[0], WithinRel(1.0f)); - REQUIRE_THAT(menu->window.backColor[1], WithinRel(0.8f)); - REQUIRE_THAT(menu->window.backColor[2], WithinRel(0.4f)); - REQUIRE_THAT(menu->window.backColor[3], WithinRel(0.95f)); - REQUIRE_THAT(menu->window.foreColor[0], WithinRel(0.7f)); - REQUIRE_THAT(menu->window.foreColor[1], WithinRel(0.0f)); - REQUIRE_THAT(menu->window.foreColor[2], WithinRel(0.0f)); - REQUIRE_THAT(menu->window.foreColor[3], WithinRel(0.0f)); - REQUIRE(menu->window.background == funnyDogMaterial); - - REQUIRE(menu->onKey != nullptr); - REQUIRE(menu->onKey->next != nullptr); - REQUIRE(menu->onKey->next->next == nullptr); - - const auto keyHandler1 = menu->onKey; - const auto keyHandler2 = menu->onKey->next; - - ItemKeyHandler* qKeyHandler; - ItemKeyHandler* leetKeyHandler; - if (keyHandler1->key == 'q') - { - qKeyHandler = keyHandler1; - leetKeyHandler = keyHandler2; - } - else - { - leetKeyHandler = keyHandler1; - qKeyHandler = keyHandler2; - } - - REQUIRE(qKeyHandler->key == 'q'); - REQUIRE(qKeyHandler->action->eventHandlerCount == 1); - REQUIRE(qKeyHandler->action->eventHandlers != nullptr); - REQUIRE(qKeyHandler->action->eventHandlers[0] != nullptr); - REQUIRE(qKeyHandler->action->eventHandlers[0]->eventType == EVENT_UNCONDITIONAL); - REQUIRE(qKeyHandler->action->eventHandlers[0]->eventData.unconditionalScript == R"("exec" "quit" ; )"s); - - REQUIRE(leetKeyHandler->key == 1337); - REQUIRE(leetKeyHandler->action->eventHandlerCount == 1); - REQUIRE(leetKeyHandler->action->eventHandlers != nullptr); - REQUIRE(leetKeyHandler->action->eventHandlers[0] != nullptr); - REQUIRE(leetKeyHandler->action->eventHandlers[0]->eventType == EVENT_UNCONDITIONAL); - REQUIRE(leetKeyHandler->action->eventHandlers[0]->eventData.unconditionalScript == R"("exec" "vid_restart" ; )"s); - - REQUIRE(menu->itemCount == 0); - REQUIRE(menu->items == nullptr); - } - - TEST_CASE("MenuParsingIW4IT: Can specify event handler multiple times", "[parsing][converting][menu][it]") - { - MenuParsingItHelper helper; + const auto* funnyDogMaterial = helper.AddMaterial("funny_dog.png"); + + const auto result = helper.RunIntegrationTest(); + REQUIRE(result); + + const auto* menuList = helper.GetMenuListAsset(); + const auto* menu = helper.GetMenuAsset("Bla"); + + REQUIRE(menuList->menuCount == 1); + REQUIRE(menuList->menus); + + REQUIRE(menuList->menus[0] == menu); + + REQUIRE(menu->window.name == "Bla"s); + REQUIRE(menu->fullScreen > 0); + REQUIRE(menu->window.staticFlags & WINDOW_FLAG_SCREEN_SPACE); + REQUIRE(menu->window.staticFlags & WINDOW_FLAG_DECORATION); + REQUIRE_THAT(menu->window.rect.x, WithinRel(420.0f)); + REQUIRE_THAT(menu->window.rect.y, WithinRel(1337.0f)); + REQUIRE_THAT(menu->window.rect.w, WithinRel(12.0f)); + REQUIRE_THAT(menu->window.rect.h, WithinRel(64.0f)); + REQUIRE(menu->window.rect.horzAlign == 1); + REQUIRE(menu->window.rect.vertAlign == 2); + REQUIRE(menu->window.style == 5); + + REQUIRE(menu->visibleExp == nullptr); + REQUIRE(menu->window.dynamicFlags[0] & WINDOW_FLAG_VISIBLE); + + REQUIRE(menu->onOpen != nullptr); + REQUIRE(menu->onOpen->eventHandlerCount == 1); + REQUIRE(menu->onOpen->eventHandlers[0]->eventType == EventType::EVENT_UNCONDITIONAL); + REQUIRE(menu->onOpen->eventHandlers[0]->eventData.unconditionalScript != nullptr); + REQUIRE(menu->onOpen->eventHandlers[0]->eventData.unconditionalScript + == R"("focusFirst" ; "play" "fart_sound" ; "exec" "wait 1; set r_fullbright 1" ; )"s); + + REQUIRE(menu->onClose != nullptr); + REQUIRE(menu->onClose->eventHandlerCount == 4); + REQUIRE(menu->onClose->eventHandlers[0]->eventType == EventType::EVENT_UNCONDITIONAL); + REQUIRE(menu->onClose->eventHandlers[0]->eventData.unconditionalScript != nullptr); + REQUIRE(menu->onClose->eventHandlers[0]->eventData.unconditionalScript == R"("setBackground" "cute_cat.jpg" ; )"s); + REQUIRE(menu->onClose->eventHandlers[1]->eventType == EventType::EVENT_IF); + REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript != nullptr); + REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventExpression != nullptr); + REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventExpression->numEntries == 5); + REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventExpression->entries[0].type == expressionEntryType::EET_OPERATOR); + REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventExpression->entries[0].data.op == 102); // anynewmappacks + REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventExpression->entries[1].type == expressionEntryType::EET_OPERATOR); + REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventExpression->entries[1].data.op == OP_RIGHTPAREN); + REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventExpression->entries[2].type == expressionEntryType::EET_OPERATOR); + REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventExpression->entries[2].data.op == OP_AND); + REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventExpression->entries[3].type == expressionEntryType::EET_OPERATOR); + REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventExpression->entries[3].data.op == 118); // isreloading + REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventExpression->entries[4].type == expressionEntryType::EET_OPERATOR); + REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventExpression->entries[4].data.op == OP_RIGHTPAREN); + REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventHandlerSet != nullptr); + REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventHandlerSet->eventHandlerCount == 1); + REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventHandlerSet->eventHandlers != nullptr); + REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventHandlerSet->eventHandlers[0] != nullptr); + REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventHandlerSet->eventHandlers[0]->eventType == EventType::EVENT_UNCONDITIONAL); + REQUIRE(menu->onClose->eventHandlers[1]->eventData.conditionalScript->eventHandlerSet->eventHandlers[0]->eventData.unconditionalScript + == R"("exec" "quit" ; )"s); + REQUIRE(menu->onClose->eventHandlers[2]->eventType == EventType::EVENT_ELSE); + REQUIRE(menu->onClose->eventHandlers[2]->eventData.elseScript != nullptr); + REQUIRE(menu->onClose->eventHandlers[2]->eventData.elseScript->eventHandlerCount == 1); + REQUIRE(menu->onClose->eventHandlers[2]->eventData.elseScript->eventHandlers != nullptr); + REQUIRE(menu->onClose->eventHandlers[2]->eventData.elseScript->eventHandlers[0] != nullptr); + REQUIRE(menu->onClose->eventHandlers[2]->eventData.elseScript->eventHandlers[0]->eventType == EventType::EVENT_UNCONDITIONAL); + REQUIRE(menu->onClose->eventHandlers[2]->eventData.elseScript->eventHandlers[0]->eventData.unconditionalScript + == R"("uiScript" "startSingleplayer" ; )"s); + REQUIRE(menu->onClose->eventHandlers[3]->eventType == EventType::EVENT_UNCONDITIONAL); + REQUIRE(menu->onClose->eventHandlers[3]->eventData.unconditionalScript != nullptr); + REQUIRE(menu->onClose->eventHandlers[3]->eventData.unconditionalScript == R"("setGameMode" "dm" ; )"s); + + REQUIRE(menu->onCloseRequest != nullptr); + REQUIRE(menu->onCloseRequest->eventHandlerCount == 1); + REQUIRE(menu->onCloseRequest->eventHandlers[0]->eventType == EventType::EVENT_UNCONDITIONAL); + REQUIRE(menu->onCloseRequest->eventHandlers[0]->eventData.unconditionalScript != nullptr); + REQUIRE(menu->onCloseRequest->eventHandlers[0]->eventData.unconditionalScript == R"("play" "nope" ; )"s); + + REQUIRE(menu->onESC != nullptr); + REQUIRE(menu->onESC->eventHandlerCount == 1); + REQUIRE(menu->onESC->eventHandlers[0]->eventType == EventType::EVENT_UNCONDITIONAL); + REQUIRE(menu->onESC->eventHandlers[0]->eventData.unconditionalScript != nullptr); + REQUIRE(menu->onESC->eventHandlers[0]->eventData.unconditionalScript == R"("setColor" "backColor" "1" "0.5" "0.1" "1" ; )"s); + + REQUIRE(menu->window.border == 1); + REQUIRE_THAT(menu->window.borderSize, WithinRel(1.25f)); + REQUIRE_THAT(menu->window.borderSize, WithinRel(1.25)); + REQUIRE_THAT(menu->window.backColor[0], WithinRel(1.0f)); + REQUIRE_THAT(menu->window.backColor[1], WithinRel(0.8f)); + REQUIRE_THAT(menu->window.backColor[2], WithinRel(0.4f)); + REQUIRE_THAT(menu->window.backColor[3], WithinRel(0.95f)); + REQUIRE_THAT(menu->window.foreColor[0], WithinRel(0.7f)); + REQUIRE_THAT(menu->window.foreColor[1], WithinRel(0.0f)); + REQUIRE_THAT(menu->window.foreColor[2], WithinRel(0.0f)); + REQUIRE_THAT(menu->window.foreColor[3], WithinRel(0.0f)); + REQUIRE(menu->window.background == funnyDogMaterial); + + REQUIRE(menu->onKey != nullptr); + REQUIRE(menu->onKey->next != nullptr); + REQUIRE(menu->onKey->next->next == nullptr); + + const auto keyHandler1 = menu->onKey; + const auto keyHandler2 = menu->onKey->next; + + ItemKeyHandler* qKeyHandler; + ItemKeyHandler* leetKeyHandler; + if (keyHandler1->key == 'q') + { + qKeyHandler = keyHandler1; + leetKeyHandler = keyHandler2; + } + else + { + leetKeyHandler = keyHandler1; + qKeyHandler = keyHandler2; + } - helper.AddFile(R"testmenu( + REQUIRE(qKeyHandler->key == 'q'); + REQUIRE(qKeyHandler->action->eventHandlerCount == 1); + REQUIRE(qKeyHandler->action->eventHandlers != nullptr); + REQUIRE(qKeyHandler->action->eventHandlers[0] != nullptr); + REQUIRE(qKeyHandler->action->eventHandlers[0]->eventType == EVENT_UNCONDITIONAL); + REQUIRE(qKeyHandler->action->eventHandlers[0]->eventData.unconditionalScript == R"("exec" "quit" ; )"s); + + REQUIRE(leetKeyHandler->key == 1337); + REQUIRE(leetKeyHandler->action->eventHandlerCount == 1); + REQUIRE(leetKeyHandler->action->eventHandlers != nullptr); + REQUIRE(leetKeyHandler->action->eventHandlers[0] != nullptr); + REQUIRE(leetKeyHandler->action->eventHandlers[0]->eventType == EVENT_UNCONDITIONAL); + REQUIRE(leetKeyHandler->action->eventHandlers[0]->eventData.unconditionalScript == R"("exec" "vid_restart" ; )"s); + + REQUIRE(menu->itemCount == 0); + REQUIRE(menu->items == nullptr); + } + + TEST_CASE("MenuParsingIW4IT: Can specify event handler multiple times", "[parsing][converting][menu][it]") + { + MenuParsingItHelper helper; + + helper.AddFile(R"testmenu( { menuDef { @@ -340,45 +342,44 @@ namespace test::game::iw4::menu::parsing::it } )testmenu"); - const auto result = helper.RunIntegrationTest(); - REQUIRE(result); - - const auto* menuList = helper.GetMenuListAsset(); - const auto* menu = helper.GetMenuAsset("Blab"); - - REQUIRE(menuList->menuCount == 1); - REQUIRE(menuList->menus); - - REQUIRE(menuList->menus[0] == menu); - - REQUIRE(menu->window.name == "Blab"s); - - REQUIRE(menu->onOpen != nullptr); - REQUIRE(menu->onOpen->eventHandlerCount == 3); - REQUIRE(menu->onOpen->eventHandlers[0]->eventType == EventType::EVENT_UNCONDITIONAL); - REQUIRE(menu->onOpen->eventHandlers[0]->eventData.unconditionalScript != nullptr); - REQUIRE(menu->onOpen->eventHandlers[0]->eventData.unconditionalScript == R"("focusFirst" ; )"s); - REQUIRE(menu->onOpen->eventHandlers[1]->eventType == EventType::EVENT_UNCONDITIONAL); - REQUIRE(menu->onOpen->eventHandlers[1]->eventData.unconditionalScript != nullptr); - REQUIRE(menu->onOpen->eventHandlers[1]->eventData.unconditionalScript == R"("play" "fart_sound" ; )"s); - REQUIRE(menu->onOpen->eventHandlers[2]->eventType == EventType::EVENT_UNCONDITIONAL); - REQUIRE(menu->onOpen->eventHandlers[2]->eventData.unconditionalScript != nullptr); - REQUIRE(menu->onOpen->eventHandlers[2]->eventData.unconditionalScript == R"("exec" "wait 1; set r_fullbright 1" ; )"s); - - - REQUIRE(menu->itemCount == 1); - REQUIRE(menu->items != nullptr); - - const auto* item = menu->items[0]; - REQUIRE(item != nullptr); - - REQUIRE(item->action != nullptr); - REQUIRE(item->action->eventHandlerCount == 2); - REQUIRE(item->action->eventHandlers[0]->eventType == EventType::EVENT_UNCONDITIONAL); - REQUIRE(item->action->eventHandlers[0]->eventData.unconditionalScript != nullptr); - REQUIRE(item->action->eventHandlers[0]->eventData.unconditionalScript == R"("play" "lmfao" ; )"s); - REQUIRE(item->action->eventHandlers[1]->eventType == EventType::EVENT_UNCONDITIONAL); - REQUIRE(item->action->eventHandlers[1]->eventData.unconditionalScript != nullptr); - REQUIRE(item->action->eventHandlers[1]->eventData.unconditionalScript == R"("play" "lol" ; )"s); - } -} + const auto result = helper.RunIntegrationTest(); + REQUIRE(result); + + const auto* menuList = helper.GetMenuListAsset(); + const auto* menu = helper.GetMenuAsset("Blab"); + + REQUIRE(menuList->menuCount == 1); + REQUIRE(menuList->menus); + + REQUIRE(menuList->menus[0] == menu); + + REQUIRE(menu->window.name == "Blab"s); + + REQUIRE(menu->onOpen != nullptr); + REQUIRE(menu->onOpen->eventHandlerCount == 3); + REQUIRE(menu->onOpen->eventHandlers[0]->eventType == EventType::EVENT_UNCONDITIONAL); + REQUIRE(menu->onOpen->eventHandlers[0]->eventData.unconditionalScript != nullptr); + REQUIRE(menu->onOpen->eventHandlers[0]->eventData.unconditionalScript == R"("focusFirst" ; )"s); + REQUIRE(menu->onOpen->eventHandlers[1]->eventType == EventType::EVENT_UNCONDITIONAL); + REQUIRE(menu->onOpen->eventHandlers[1]->eventData.unconditionalScript != nullptr); + REQUIRE(menu->onOpen->eventHandlers[1]->eventData.unconditionalScript == R"("play" "fart_sound" ; )"s); + REQUIRE(menu->onOpen->eventHandlers[2]->eventType == EventType::EVENT_UNCONDITIONAL); + REQUIRE(menu->onOpen->eventHandlers[2]->eventData.unconditionalScript != nullptr); + REQUIRE(menu->onOpen->eventHandlers[2]->eventData.unconditionalScript == R"("exec" "wait 1; set r_fullbright 1" ; )"s); + + REQUIRE(menu->itemCount == 1); + REQUIRE(menu->items != nullptr); + + const auto* item = menu->items[0]; + REQUIRE(item != nullptr); + + REQUIRE(item->action != nullptr); + REQUIRE(item->action->eventHandlerCount == 2); + REQUIRE(item->action->eventHandlers[0]->eventType == EventType::EVENT_UNCONDITIONAL); + REQUIRE(item->action->eventHandlers[0]->eventData.unconditionalScript != nullptr); + REQUIRE(item->action->eventHandlers[0]->eventData.unconditionalScript == R"("play" "lmfao" ; )"s); + REQUIRE(item->action->eventHandlers[1]->eventType == EventType::EVENT_UNCONDITIONAL); + REQUIRE(item->action->eventHandlers[1]->eventData.unconditionalScript != nullptr); + REQUIRE(item->action->eventHandlers[1]->eventData.unconditionalScript == R"("play" "lol" ; )"s); + } +} // namespace test::game::iw4::menu::parsing::it diff --git a/test/ObjLoadingTests/Mock/MockAssetLoadingManager.cpp b/test/ObjLoadingTests/Mock/MockAssetLoadingManager.cpp index 20c72373e..a97ff559b 100644 --- a/test/ObjLoadingTests/Mock/MockAssetLoadingManager.cpp +++ b/test/ObjLoadingTests/Mock/MockAssetLoadingManager.cpp @@ -1,56 +1,59 @@ #include "MockAssetLoadingManager.h" MockAssetLoadingManager::MockAssetLoadingManager(Zone* zone, ISearchPath* searchPath) - : m_zone(zone), - m_mock_gdt(std::make_unique<Gdt>()), - m_context(std::make_unique<AssetLoadingContext>(zone, searchPath, std::vector({m_mock_gdt.get()}))) + : m_zone(zone), + m_mock_gdt(std::make_unique<Gdt>()), + m_context(std::make_unique<AssetLoadingContext>(zone, searchPath, std::vector({m_mock_gdt.get()}))) { } AssetLoadingContext* MockAssetLoadingManager::GetAssetLoadingContext() const { - return m_context.get(); + return m_context.get(); } -XAssetInfoGeneric* MockAssetLoadingManager::AddAsset(const asset_type_t assetType, const std::string& assetName, void* asset, std::vector<XAssetInfoGeneric*> dependencies, +XAssetInfoGeneric* MockAssetLoadingManager::AddAsset(const asset_type_t assetType, + const std::string& assetName, + void* asset, + std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings) { - XAssetInfoGeneric assetInfoObj{assetType, assetName, m_zone, std::move(dependencies), std::move(usedScriptStrings), asset}; - auto assetInfo = std::make_unique<XAssetInfoGeneric>(std::move(assetInfoObj)); - const auto assetInfoPtr = assetInfo.get(); - m_added_assets.emplace(std::make_pair(assetInfo->m_name, std::move(assetInfo))); + XAssetInfoGeneric assetInfoObj{assetType, assetName, m_zone, std::move(dependencies), std::move(usedScriptStrings), asset}; + auto assetInfo = std::make_unique<XAssetInfoGeneric>(std::move(assetInfoObj)); + const auto assetInfoPtr = assetInfo.get(); + m_added_assets.emplace(std::make_pair(assetInfo->m_name, std::move(assetInfo))); - return assetInfoPtr; + return assetInfoPtr; } XAssetInfoGeneric* MockAssetLoadingManager::LoadDependency(const asset_type_t assetType, const std::string& assetName) { - auto foundDependencies = m_available_dependencies.find(assetName); + auto foundDependencies = m_available_dependencies.find(assetName); - while (foundDependencies != m_available_dependencies.end()) - { - if (foundDependencies->second->m_type == assetType) - return foundDependencies->second.get(); + while (foundDependencies != m_available_dependencies.end()) + { + if (foundDependencies->second->m_type == assetType) + return foundDependencies->second.get(); - ++foundDependencies; - } + ++foundDependencies; + } - return nullptr; + return nullptr; } void MockAssetLoadingManager::MockAddAvailableDependency(const asset_type_t assetType, std::string assetName, void* asset) { - XAssetInfoGeneric assetInfoObj{assetType, std::move(assetName), m_zone, std::vector<XAssetInfoGeneric*>(), std::vector<scr_string_t>(), asset}; - auto assetInfo = std::make_unique<XAssetInfoGeneric>(std::move(assetInfoObj)); - m_available_dependencies.emplace(std::make_pair(assetInfo->m_name, std::move(assetInfo))); + XAssetInfoGeneric assetInfoObj{assetType, std::move(assetName), m_zone, std::vector<XAssetInfoGeneric*>(), std::vector<scr_string_t>(), asset}; + auto assetInfo = std::make_unique<XAssetInfoGeneric>(std::move(assetInfoObj)); + m_available_dependencies.emplace(std::make_pair(assetInfo->m_name, std::move(assetInfo))); } XAssetInfoGeneric* MockAssetLoadingManager::MockGetAddedAsset(const std::string& assetName) { - const auto foundAsset = m_added_assets.find(assetName); + const auto foundAsset = m_added_assets.find(assetName); - if (foundAsset != m_added_assets.end()) - return foundAsset->second.get(); + if (foundAsset != m_added_assets.end()) + return foundAsset->second.get(); - return nullptr; + return nullptr; } diff --git a/test/ObjLoadingTests/Mock/MockAssetLoadingManager.h b/test/ObjLoadingTests/Mock/MockAssetLoadingManager.h index a0867169a..e6bee03d7 100644 --- a/test/ObjLoadingTests/Mock/MockAssetLoadingManager.h +++ b/test/ObjLoadingTests/Mock/MockAssetLoadingManager.h @@ -1,25 +1,29 @@ #pragma once -#include <memory> -#include <map> - #include "AssetLoading/IAssetLoadingManager.h" +#include <map> +#include <memory> + class MockAssetLoadingManager final : public IAssetLoadingManager { - Zone* m_zone; - std::unique_ptr<Gdt> m_mock_gdt; - std::unique_ptr<AssetLoadingContext> m_context; - std::map<std::string, std::unique_ptr<XAssetInfoGeneric>> m_added_assets; - std::multimap<std::string, std::unique_ptr<XAssetInfoGeneric>> m_available_dependencies; + Zone* m_zone; + std::unique_ptr<Gdt> m_mock_gdt; + std::unique_ptr<AssetLoadingContext> m_context; + std::map<std::string, std::unique_ptr<XAssetInfoGeneric>> m_added_assets; + std::multimap<std::string, std::unique_ptr<XAssetInfoGeneric>> m_available_dependencies; public: - MockAssetLoadingManager(Zone* zone, ISearchPath* searchPath); + MockAssetLoadingManager(Zone* zone, ISearchPath* searchPath); - _NODISCARD AssetLoadingContext* GetAssetLoadingContext() const override; - XAssetInfoGeneric* AddAsset(asset_type_t assetType, const std::string& assetName, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings) override; - XAssetInfoGeneric* LoadDependency(asset_type_t assetType, const std::string& assetName) override; + _NODISCARD AssetLoadingContext* GetAssetLoadingContext() const override; + XAssetInfoGeneric* AddAsset(asset_type_t assetType, + const std::string& assetName, + void* asset, + std::vector<XAssetInfoGeneric*> dependencies, + std::vector<scr_string_t> usedScriptStrings) override; + XAssetInfoGeneric* LoadDependency(asset_type_t assetType, const std::string& assetName) override; - void MockAddAvailableDependency(asset_type_t assetType, std::string assetName, void* asset); - XAssetInfoGeneric* MockGetAddedAsset(const std::string& assetName); + void MockAddAvailableDependency(asset_type_t assetType, std::string assetName, void* asset); + XAssetInfoGeneric* MockGetAddedAsset(const std::string& assetName); }; diff --git a/test/ObjLoadingTests/Mock/MockSearchPath.cpp b/test/ObjLoadingTests/Mock/MockSearchPath.cpp index b0662a4ae..3bf0c92d7 100644 --- a/test/ObjLoadingTests/Mock/MockSearchPath.cpp +++ b/test/ObjLoadingTests/Mock/MockSearchPath.cpp @@ -4,24 +4,22 @@ void MockSearchPath::AddFileData(std::string fileName, std::string fileData) { - m_file_data_map.emplace(std::make_pair(std::move(fileName), std::move(fileData))); + m_file_data_map.emplace(std::make_pair(std::move(fileName), std::move(fileData))); } SearchPathOpenFile MockSearchPath::Open(const std::string& fileName) { - const auto foundFileData = m_file_data_map.find(fileName); + const auto foundFileData = m_file_data_map.find(fileName); - if(foundFileData == m_file_data_map.end()) - return {}; + if (foundFileData == m_file_data_map.end()) + return {}; - return {std::make_unique<std::istringstream>(foundFileData->second), foundFileData->second.size()}; + return {std::make_unique<std::istringstream>(foundFileData->second), foundFileData->second.size()}; } std::string MockSearchPath::GetPath() { - return "MockFiles"; + return "MockFiles"; } -void MockSearchPath::Find(const SearchPathSearchOptions& options, const std::function<void(const std::string&)>& callback) -{ -} +void MockSearchPath::Find(const SearchPathSearchOptions& options, const std::function<void(const std::string&)>& callback) {} diff --git a/test/ObjLoadingTests/Mock/MockSearchPath.h b/test/ObjLoadingTests/Mock/MockSearchPath.h index b43bc8f2c..6951326e6 100644 --- a/test/ObjLoadingTests/Mock/MockSearchPath.h +++ b/test/ObjLoadingTests/Mock/MockSearchPath.h @@ -1,16 +1,16 @@ #pragma once -#include <map> - #include "SearchPath/ISearchPath.h" +#include <map> + class MockSearchPath final : public ISearchPath { - std::map<std::string, std::string> m_file_data_map; + std::map<std::string, std::string> m_file_data_map; public: - void AddFileData(std::string fileName, std::string fileData); + void AddFileData(std::string fileName, std::string fileData); - SearchPathOpenFile Open(const std::string& fileName) override; - std::string GetPath() override; - void Find(const SearchPathSearchOptions& options, const std::function<void(const std::string&)>& callback) override; + SearchPathOpenFile Open(const std::string& fileName) override; + std::string GetPath() override; + void Find(const SearchPathSearchOptions& options, const std::function<void(const std::string&)>& callback) override; }; diff --git a/test/ObjLoadingTests/Parsing/Menu/Sequence/EventHandlerSetScopeSequencesTests.cpp b/test/ObjLoadingTests/Parsing/Menu/Sequence/EventHandlerSetScopeSequencesTests.cpp index 441a05c7a..3f01ebb81 100644 --- a/test/ObjLoadingTests/Parsing/Menu/Sequence/EventHandlerSetScopeSequencesTests.cpp +++ b/test/ObjLoadingTests/Parsing/Menu/Sequence/EventHandlerSetScopeSequencesTests.cpp @@ -1,11 +1,11 @@ -#include <catch2/catch_test_macros.hpp> -#include <catch2/generators/catch_generators.hpp> - #include "Parsing/Menu/Domain/EventHandler/CommonEventHandlerScript.h" #include "Parsing/Menu/Domain/EventHandler/CommonEventHandlerSetLocalVar.h" -#include "Utils/ClassUtils.h" #include "Parsing/Menu/Sequence/EventHandlerSetScopeSequences.h" #include "Parsing/Mock/MockLexer.h" +#include "Utils/ClassUtils.h" + +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> using namespace menu; @@ -66,16 +66,15 @@ namespace test::parsing::menu::sequence::event_handler_set }; #pragma region General + TEST_CASE("EventHandlerSetScopeSequences: Keyword casing doesnt matter", "[parsing][sequence][menu]") { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Identifier(pos, new std::string("fadein")), - SimpleParserValue::String(pos, new std::string("some_element")), - SimpleParserValue::Character(pos, ';'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Identifier(pos, new std::string("fadein")), + SimpleParserValue::String(pos, new std::string("some_element")), + SimpleParserValue::Character(pos, ';'), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -90,12 +89,10 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Identifier(pos, new std::string("noScriptCommand")), - SimpleParserValue::String(pos, new std::string("some_element")), - SimpleParserValue::Character(pos, ';'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Identifier(pos, new std::string("noScriptCommand")), + SimpleParserValue::String(pos, new std::string("some_element")), + SimpleParserValue::Character(pos, ';'), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -107,13 +104,11 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, true); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Identifier(pos, new std::string("uiScript")), - SimpleParserValue::Identifier(pos, new std::string("somethingUnknown")), - SimpleParserValue::String(pos, new std::string("anArgumentForTheUnknownScript")), - SimpleParserValue::Character(pos, ';'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Identifier(pos, new std::string("uiScript")), + SimpleParserValue::Identifier(pos, new std::string("somethingUnknown")), + SimpleParserValue::String(pos, new std::string("anArgumentForTheUnknownScript")), + SimpleParserValue::Character(pos, ';'), + SimpleParserValue::EndOfFile(pos)}); auto result = helper.PerformTest(); REQUIRE(result); @@ -166,55 +161,43 @@ namespace test::parsing::menu::sequence::event_handler_set TEST_CASE("EventHandlerSetScopeSequences: Ensure can use fadeIn", "[parsing][sequence][menu]") { TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("fadeIn")), - SimpleParserValue::String(TokenPos(), new std::string("some_element")) - }, R"("fadeIn" "some_element" ; )"); + {SimpleParserValue::Identifier(TokenPos(), new std::string("fadeIn")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + R"("fadeIn" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use fadeOut", "[parsing][sequence][menu]") { TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("fadeOut")), - SimpleParserValue::String(TokenPos(), new std::string("some_element")) - }, R"("fadeOut" "some_element" ; )"); + {SimpleParserValue::Identifier(TokenPos(), new std::string("fadeOut")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + R"("fadeOut" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use show", "[parsing][sequence][menu]") { TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("show")), - SimpleParserValue::String(TokenPos(), new std::string("some_element")) - }, R"("show" "some_element" ; )"); + {SimpleParserValue::Identifier(TokenPos(), new std::string("show")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + R"("show" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use hide", "[parsing][sequence][menu]") { TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("hide")), - SimpleParserValue::String(TokenPos(), new std::string("some_element")) - }, R"("hide" "some_element" ; )"); + {SimpleParserValue::Identifier(TokenPos(), new std::string("hide")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + R"("hide" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use showMenu", "[parsing][sequence][menu]") { TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("showMenu")), - SimpleParserValue::String(TokenPos(), new std::string("some_element")) - }, R"("showMenu" "some_element" ; )"); + {SimpleParserValue::Identifier(TokenPos(), new std::string("showMenu")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + R"("showMenu" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use hideMenu", "[parsing][sequence][menu]") { TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("hideMenu")), - SimpleParserValue::String(TokenPos(), new std::string("some_element")) - }, R"("hideMenu" "some_element" ; )"); + {SimpleParserValue::Identifier(TokenPos(), new std::string("hideMenu")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + R"("hideMenu" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use setColor", "[parsing][sequence][menu]") @@ -227,7 +210,8 @@ namespace test::parsing::menu::sequence::event_handler_set SimpleParserValue::Integer(TokenPos(), 1), SimpleParserValue::Integer(TokenPos(), 1), SimpleParserValue::Integer(TokenPos(), 1), - }, R"("setColor" "backColor" "1" "1" "1" "1" ; )"); + }, + R"("setColor" "backColor" "1" "1" "1" "1" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use setColor with 3 colors", "[parsing][sequence][menu]") @@ -239,7 +223,8 @@ namespace test::parsing::menu::sequence::event_handler_set SimpleParserValue::Integer(TokenPos(), 1), SimpleParserValue::Integer(TokenPos(), 1), SimpleParserValue::Integer(TokenPos(), 1), - }, R"("setColor" "backColor" "1" "1" "1" ; )"); + }, + R"("setColor" "backColor" "1" "1" "1" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use setColor with 2 colors", "[parsing][sequence][menu]") @@ -250,7 +235,8 @@ namespace test::parsing::menu::sequence::event_handler_set SimpleParserValue::Identifier(TokenPos(), new std::string("backColor")), SimpleParserValue::Integer(TokenPos(), 1), SimpleParserValue::Integer(TokenPos(), 1), - }, R"("setColor" "backColor" "1" "1" ; )"); + }, + R"("setColor" "backColor" "1" "1" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use setColor with 1 color", "[parsing][sequence][menu]") @@ -260,19 +246,18 @@ namespace test::parsing::menu::sequence::event_handler_set SimpleParserValue::Identifier(TokenPos(), new std::string("setColor")), SimpleParserValue::Identifier(TokenPos(), new std::string("backColor")), SimpleParserValue::Integer(TokenPos(), 1), - }, R"("setColor" "backColor" "1" ; )"); + }, + R"("setColor" "backColor" "1" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure cannot use setColor with no color", "[parsing][sequence][menu]") { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Identifier(pos, new std::string("setColor")), - SimpleParserValue::Identifier(TokenPos(), new std::string("backColor")), - SimpleParserValue::Character(pos, ';'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Identifier(pos, new std::string("setColor")), + SimpleParserValue::Identifier(TokenPos(), new std::string("backColor")), + SimpleParserValue::Character(pos, ';'), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -283,64 +268,50 @@ namespace test::parsing::menu::sequence::event_handler_set TEST_CASE("EventHandlerSetScopeSequences: Ensure can use open", "[parsing][sequence][menu]") { TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("open")), - SimpleParserValue::String(TokenPos(), new std::string("some_element")) - }, R"("open" "some_element" ; )"); + {SimpleParserValue::Identifier(TokenPos(), new std::string("open")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + R"("open" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use close", "[parsing][sequence][menu]") { TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("close")), - SimpleParserValue::String(TokenPos(), new std::string("some_element")) - }, R"("close" "some_element" ; )"); + {SimpleParserValue::Identifier(TokenPos(), new std::string("close")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + R"("close" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use escape", "[parsing][sequence][menu]") { TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("escape")), - SimpleParserValue::String(TokenPos(), new std::string("some_element")) - }, R"("escape" "some_element" ; )"); + {SimpleParserValue::Identifier(TokenPos(), new std::string("escape")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + R"("escape" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use closeForAllPlayers", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("closeForAllPlayers")), - SimpleParserValue::String(TokenPos(), new std::string("some_element")) - }, R"("closeForAllPlayers" "some_element" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("closeForAllPlayers")), + SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + R"("closeForAllPlayers" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use ingameOpen", "[parsing][sequence][menu]") { TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("ingameOpen")), - SimpleParserValue::String(TokenPos(), new std::string("some_element")) - }, R"("ingameOpen" "some_element" ; )"); + {SimpleParserValue::Identifier(TokenPos(), new std::string("ingameOpen")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + R"("ingameOpen" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use ingameClose", "[parsing][sequence][menu]") { TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("ingameClose")), - SimpleParserValue::String(TokenPos(), new std::string("some_element")) - }, R"("ingameClose" "some_element" ; )"); + {SimpleParserValue::Identifier(TokenPos(), new std::string("ingameClose")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + R"("ingameClose" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use setBackground", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("setBackground")), - SimpleParserValue::String(TokenPos(), new std::string("some_element")) - }, R"("setBackground" "some_element" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("setBackground")), + SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + R"("setBackground" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use setItemColor with forecolor", "[parsing][sequence][menu]") @@ -354,7 +325,8 @@ namespace test::parsing::menu::sequence::event_handler_set SimpleParserValue::Integer(TokenPos(), 1), SimpleParserValue::Integer(TokenPos(), 1), SimpleParserValue::Integer(TokenPos(), 1), - }, R"("setItemColor" "some_element" "forecolor" "1" "1" "1" "1" ; )"); + }, + R"("setItemColor" "some_element" "forecolor" "1" "1" "1" "1" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use setItemColor with backcolor", "[parsing][sequence][menu]") @@ -368,7 +340,8 @@ namespace test::parsing::menu::sequence::event_handler_set SimpleParserValue::Integer(TokenPos(), 1), SimpleParserValue::Integer(TokenPos(), 1), SimpleParserValue::Integer(TokenPos(), 1), - }, R"("setItemColor" "some_element" "backColor" "1" "1" "1" "1" ; )"); + }, + R"("setItemColor" "some_element" "backColor" "1" "1" "1" "1" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use setItemColor with bordercolor", "[parsing][sequence][menu]") @@ -382,7 +355,8 @@ namespace test::parsing::menu::sequence::event_handler_set SimpleParserValue::Integer(TokenPos(), 1), SimpleParserValue::Integer(TokenPos(), 1), SimpleParserValue::Integer(TokenPos(), 1), - }, R"("setItemColor" "some_element" "bordercolor" "1" "1" "1" "1" ; )"); + }, + R"("setItemColor" "some_element" "bordercolor" "1" "1" "1" "1" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use setItemColor with disablecolor", "[parsing][sequence][menu]") @@ -396,7 +370,8 @@ namespace test::parsing::menu::sequence::event_handler_set SimpleParserValue::Integer(TokenPos(), 1), SimpleParserValue::Integer(TokenPos(), 1), SimpleParserValue::Integer(TokenPos(), 1), - }, R"("setItemColor" "some_element" "disablecolor" "1" "1" "1" "1" ; )"); + }, + R"("setItemColor" "some_element" "disablecolor" "1" "1" "1" "1" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use focusFirst", "[parsing][sequence][menu]") @@ -404,25 +379,22 @@ namespace test::parsing::menu::sequence::event_handler_set TestGenericScriptStatement( { SimpleParserValue::Identifier(TokenPos(), new std::string("focusFirst")), - }, R"("focusFirst" ; )"); + }, + R"("focusFirst" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use setFocus", "[parsing][sequence][menu]") { TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("setFocus")), - SimpleParserValue::String(TokenPos(), new std::string("some_element")) - }, R"("setFocus" "some_element" ; )"); + {SimpleParserValue::Identifier(TokenPos(), new std::string("setFocus")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + R"("setFocus" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use setFocusByDvar", "[parsing][sequence][menu]") { TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("setFocusByDvar")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")) - }, R"("setFocusByDvar" "some_dvar" ; )"); + {SimpleParserValue::Identifier(TokenPos(), new std::string("setFocusByDvar")), SimpleParserValue::String(TokenPos(), new std::string("some_dvar"))}, + R"("setFocusByDvar" "some_dvar" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use setDvar", "[parsing][sequence][menu]") @@ -432,281 +404,209 @@ namespace test::parsing::menu::sequence::event_handler_set SimpleParserValue::Identifier(TokenPos(), new std::string("setDvar")), SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), SimpleParserValue::String(TokenPos(), new std::string("some_value")), - }, R"("setDvar" "some_dvar" "some_value" ; )"); + }, + R"("setDvar" "some_dvar" "some_value" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use exec", "[parsing][sequence][menu]") { TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("exec")), - SimpleParserValue::String(TokenPos(), new std::string("some_command")) - }, R"("exec" "some_command" ; )"); + {SimpleParserValue::Identifier(TokenPos(), new std::string("exec")), SimpleParserValue::String(TokenPos(), new std::string("some_command"))}, + R"("exec" "some_command" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use execNow", "[parsing][sequence][menu]") { TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("execNow")), - SimpleParserValue::String(TokenPos(), new std::string("some_command")) - }, R"("execNow" "some_command" ; )"); + {SimpleParserValue::Identifier(TokenPos(), new std::string("execNow")), SimpleParserValue::String(TokenPos(), new std::string("some_command"))}, + R"("execNow" "some_command" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use execOnDvarStringValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("execOnDvarStringValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::String(TokenPos(), new std::string("some_value")), - SimpleParserValue::String(TokenPos(), new std::string("some_command")) - }, R"("execOnDvarStringValue" "some_dvar" "some_value" "some_command" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("execOnDvarStringValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::String(TokenPos(), new std::string("some_value")), + SimpleParserValue::String(TokenPos(), new std::string("some_command"))}, + R"("execOnDvarStringValue" "some_dvar" "some_value" "some_command" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use execOnDvarIntValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("execOnDvarIntValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::Integer(TokenPos(), 1), - SimpleParserValue::String(TokenPos(), new std::string("some_command")) - }, R"("execOnDvarIntValue" "some_dvar" "1" "some_command" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("execOnDvarIntValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::Integer(TokenPos(), 1), + SimpleParserValue::String(TokenPos(), new std::string("some_command"))}, + R"("execOnDvarIntValue" "some_dvar" "1" "some_command" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use execOnDvarFloatValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("execOnDvarFloatValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::Integer(TokenPos(), 1), - SimpleParserValue::String(TokenPos(), new std::string("some_command")) - }, R"("execOnDvarFloatValue" "some_dvar" "1" "some_command" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("execOnDvarFloatValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::Integer(TokenPos(), 1), + SimpleParserValue::String(TokenPos(), new std::string("some_command"))}, + R"("execOnDvarFloatValue" "some_dvar" "1" "some_command" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use execNowOnDvarStringValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("execNowOnDvarStringValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::String(TokenPos(), new std::string("some_value")), - SimpleParserValue::String(TokenPos(), new std::string("some_command")) - }, R"("execNowOnDvarStringValue" "some_dvar" "some_value" "some_command" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("execNowOnDvarStringValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::String(TokenPos(), new std::string("some_value")), + SimpleParserValue::String(TokenPos(), new std::string("some_command"))}, + R"("execNowOnDvarStringValue" "some_dvar" "some_value" "some_command" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use execNowOnDvarIntValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("execNowOnDvarIntValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::Integer(TokenPos(), 1), - SimpleParserValue::String(TokenPos(), new std::string("some_command")) - }, R"("execNowOnDvarIntValue" "some_dvar" "1" "some_command" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("execNowOnDvarIntValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::Integer(TokenPos(), 1), + SimpleParserValue::String(TokenPos(), new std::string("some_command"))}, + R"("execNowOnDvarIntValue" "some_dvar" "1" "some_command" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use execNowOnDvarFloatValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("execNowOnDvarFloatValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::Integer(TokenPos(), 1), - SimpleParserValue::String(TokenPos(), new std::string("some_command")) - }, R"("execNowOnDvarFloatValue" "some_dvar" "1" "some_command" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("execNowOnDvarFloatValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::Integer(TokenPos(), 1), + SimpleParserValue::String(TokenPos(), new std::string("some_command"))}, + R"("execNowOnDvarFloatValue" "some_dvar" "1" "some_command" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use play", "[parsing][sequence][menu]") { TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("play")), - SimpleParserValue::String(TokenPos(), new std::string("some_sound")) - }, R"("play" "some_sound" ; )"); + {SimpleParserValue::Identifier(TokenPos(), new std::string("play")), SimpleParserValue::String(TokenPos(), new std::string("some_sound"))}, + R"("play" "some_sound" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use scriptMenuResponse", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("scriptMenuResponse")), - SimpleParserValue::String(TokenPos(), new std::string("some_response")) - }, R"("scriptMenuResponse" "some_response" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("scriptMenuResponse")), + SimpleParserValue::String(TokenPos(), new std::string("some_response"))}, + R"("scriptMenuResponse" "some_response" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use scriptMenuRespondOnDvarStringValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("scriptMenuRespondOnDvarStringValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::String(TokenPos(), new std::string("some_value")), - SimpleParserValue::String(TokenPos(), new std::string("some_response")) - }, R"("scriptMenuRespondOnDvarStringValue" "some_dvar" "some_value" "some_response" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("scriptMenuRespondOnDvarStringValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::String(TokenPos(), new std::string("some_value")), + SimpleParserValue::String(TokenPos(), new std::string("some_response"))}, + R"("scriptMenuRespondOnDvarStringValue" "some_dvar" "some_value" "some_response" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use scriptMenuRespondOnDvarIntValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("scriptMenuRespondOnDvarIntValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::Integer(TokenPos(), 1), - SimpleParserValue::String(TokenPos(), new std::string("some_response")) - }, R"("scriptMenuRespondOnDvarIntValue" "some_dvar" "1" "some_response" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("scriptMenuRespondOnDvarIntValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::Integer(TokenPos(), 1), + SimpleParserValue::String(TokenPos(), new std::string("some_response"))}, + R"("scriptMenuRespondOnDvarIntValue" "some_dvar" "1" "some_response" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use scriptMenuRespondOnDvarFloatValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("scriptMenuRespondOnDvarFloatValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::Integer(TokenPos(), 1), - SimpleParserValue::String(TokenPos(), new std::string("some_response")) - }, R"("scriptMenuRespondOnDvarFloatValue" "some_dvar" "1" "some_response" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("scriptMenuRespondOnDvarFloatValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::Integer(TokenPos(), 1), + SimpleParserValue::String(TokenPos(), new std::string("some_response"))}, + R"("scriptMenuRespondOnDvarFloatValue" "some_dvar" "1" "some_response" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use updateMail", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("updateMail")) - }, R"("updateMail" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("updateMail"))}, R"("updateMail" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use openMail", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("openMail")) - }, R"("openMail" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("openMail"))}, R"("openMail" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use deleteMail", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("deleteMail")) - }, R"("deleteMail" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("deleteMail"))}, R"("deleteMail" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use doMailLottery", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("doMailLottery")) - }, R"("doMailLottery" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("doMailLottery"))}, R"("doMailLottery" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use resetStatsConfirm", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("resetStatsConfirm")) - }, R"("resetStatsConfirm" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("resetStatsConfirm"))}, R"("resetStatsConfirm" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use resetStatsCancel", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("resetStatsCancel")) - }, R"("resetStatsCancel" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("resetStatsCancel"))}, R"("resetStatsCancel" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use setGameMode", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("setGameMode")), - SimpleParserValue::String(TokenPos(), new std::string("some_game_mode")) - }, R"("setGameMode" "some_game_mode" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("setGameMode")), + SimpleParserValue::String(TokenPos(), new std::string("some_game_mode"))}, + R"("setGameMode" "some_game_mode" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use feederTop", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("feederTop")) - }, R"("feederTop" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("feederTop"))}, R"("feederTop" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use feederBottom", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("feederBottom")) - }, R"("feederBottom" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("feederBottom"))}, R"("feederBottom" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use showGamerCard", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("showGamerCard")) - }, R"("showGamerCard" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("showGamerCard"))}, R"("showGamerCard" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use openForGameType", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("openForGameType")), - SimpleParserValue::String(TokenPos(), new std::string("some_game_type")) - }, R"("openForGameType" "some_game_type" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("openForGameType")), + SimpleParserValue::String(TokenPos(), new std::string("some_game_type"))}, + R"("openForGameType" "some_game_type" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use closeForGameType", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("closeForGameType")), - SimpleParserValue::String(TokenPos(), new std::string("some_game_type")) - }, R"("closeForGameType" "some_game_type" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("closeForGameType")), + SimpleParserValue::String(TokenPos(), new std::string("some_game_type"))}, + R"("closeForGameType" "some_game_type" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use kickPlayer", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("kickPlayer")) - }, R"("kickPlayer" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("kickPlayer"))}, R"("kickPlayer" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use getKickPlayerQuestion", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("getKickPlayerQuestion")) - }, R"("getKickPlayerQuestion" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("getKickPlayerQuestion"))}, R"("getKickPlayerQuestion" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use partyUpdateMissingMapPackDvar", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("partyUpdateMissingMapPackDvar")) - }, R"("partyUpdateMissingMapPackDvar" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("partyUpdateMissingMapPackDvar"))}, + R"("partyUpdateMissingMapPackDvar" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use togglePlayerMute", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("togglePlayerMute")) - }, R"("togglePlayerMute" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("togglePlayerMute"))}, R"("togglePlayerMute" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use resolveError", "[parsing][sequence][menu]") { - TestGenericScriptStatement( - { - SimpleParserValue::Identifier(TokenPos(), new std::string("resolveError")) - }, R"("resolveError" ; )"); + TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("resolveError"))}, R"("resolveError" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use lerp scale", "[parsing][sequence][menu]") @@ -721,7 +621,8 @@ namespace test::parsing::menu::sequence::event_handler_set SimpleParserValue::Integer(TokenPos(), 2), SimpleParserValue::Identifier(TokenPos(), new std::string("over")), SimpleParserValue::Integer(TokenPos(), 3), - }, R"("lerp" "scale" "from" "1" "to" "2" "over" "3" ; )"); + }, + R"("lerp" "scale" "from" "1" "to" "2" "over" "3" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use lerp alpha", "[parsing][sequence][menu]") @@ -736,7 +637,8 @@ namespace test::parsing::menu::sequence::event_handler_set SimpleParserValue::Integer(TokenPos(), 2), SimpleParserValue::Identifier(TokenPos(), new std::string("over")), SimpleParserValue::Integer(TokenPos(), 3), - }, R"("lerp" "alpha" "from" "1" "to" "2" "over" "3" ; )"); + }, + R"("lerp" "alpha" "from" "1" "to" "2" "over" "3" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use lerp x", "[parsing][sequence][menu]") @@ -751,7 +653,8 @@ namespace test::parsing::menu::sequence::event_handler_set SimpleParserValue::Integer(TokenPos(), 2), SimpleParserValue::Identifier(TokenPos(), new std::string("over")), SimpleParserValue::Integer(TokenPos(), 3), - }, R"("lerp" "x" "from" "1" "to" "2" "over" "3" ; )"); + }, + R"("lerp" "x" "from" "1" "to" "2" "over" "3" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use lerp y", "[parsing][sequence][menu]") @@ -766,7 +669,8 @@ namespace test::parsing::menu::sequence::event_handler_set SimpleParserValue::Integer(TokenPos(), 2), SimpleParserValue::Identifier(TokenPos(), new std::string("over")), SimpleParserValue::Integer(TokenPos(), 3), - }, R"("lerp" "y" "from" "1" "to" "2" "over" "3" ; )"); + }, + R"("lerp" "y" "from" "1" "to" "2" "over" "3" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use setPlayerData", "[parsing][sequence][menu]") @@ -788,7 +692,8 @@ namespace test::parsing::menu::sequence::event_handler_set SimpleParserValue::Character(TokenPos(), ','), SimpleParserValue::Identifier(TokenPos(), new std::string("speciality_null")), SimpleParserValue::Character(TokenPos(), ')'), - }, R"("setPlayerData" ( "customClasses" , "localVarInt" ( "classIndex" ) , "perks" , "0" , "speciality_null" ) ; )"); + }, + R"("setPlayerData" ( "customClasses" , "localVarInt" ( "classIndex" ) , "perks" , "0" , "speciality_null" ) ; )"); } #pragma endregion @@ -804,7 +709,8 @@ namespace test::parsing::menu::sequence::event_handler_set SimpleParserValue::Integer(TokenPos(), 1339), SimpleParserValue::Character(TokenPos(), '-'), SimpleParserValue::Integer(TokenPos(), 2), - }, R"("setLocalVarBool" "sample_var" "1337" ; )"); + }, + R"("setLocalVarBool" "sample_var" "1337" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure setLocalVarInt is script on static value", "[parsing][sequence][menu]") @@ -816,7 +722,8 @@ namespace test::parsing::menu::sequence::event_handler_set SimpleParserValue::Integer(TokenPos(), 1339), SimpleParserValue::Character(TokenPos(), '-'), SimpleParserValue::Integer(TokenPos(), 2), - }, R"("setLocalVarInt" "sample_var" "1337" ; )"); + }, + R"("setLocalVarInt" "sample_var" "1337" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure setLocalVarString is script on static value", "[parsing][sequence][menu]") @@ -830,24 +737,23 @@ namespace test::parsing::menu::sequence::event_handler_set SimpleParserValue::String(TokenPos(), new std::string(" ")), SimpleParserValue::Character(TokenPos(), '+'), SimpleParserValue::String(TokenPos(), new std::string("World")), - }, R"("setLocalVarString" "sample_var" "Hello World" ; )"); + }, + R"("setLocalVarString" "sample_var" "Hello World" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure setLocalVarBool is setLocalVar handler on non-static value", "[parsing][sequence][menu]") { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Identifier(TokenPos(), new std::string("setLocalVarBool")), - SimpleParserValue::Identifier(TokenPos(), new std::string("sample_var")), - SimpleParserValue::Identifier(TokenPos(), new std::string("milliseconds")), - SimpleParserValue::Character(TokenPos(), '('), - SimpleParserValue::Character(TokenPos(), ')'), - SimpleParserValue::Character(TokenPos(), '%'), - SimpleParserValue::Integer(TokenPos(), 2), - SimpleParserValue::Character(TokenPos(), ';'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Identifier(TokenPos(), new std::string("setLocalVarBool")), + SimpleParserValue::Identifier(TokenPos(), new std::string("sample_var")), + SimpleParserValue::Identifier(TokenPos(), new std::string("milliseconds")), + SimpleParserValue::Character(TokenPos(), '('), + SimpleParserValue::Character(TokenPos(), ')'), + SimpleParserValue::Character(TokenPos(), '%'), + SimpleParserValue::Integer(TokenPos(), 2), + SimpleParserValue::Character(TokenPos(), ';'), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); REQUIRE(result); @@ -872,17 +778,15 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Identifier(TokenPos(), new std::string("setLocalVarInt")), - SimpleParserValue::Identifier(TokenPos(), new std::string("sample_var")), - SimpleParserValue::Identifier(TokenPos(), new std::string("milliseconds")), - SimpleParserValue::Character(TokenPos(), '('), - SimpleParserValue::Character(TokenPos(), ')'), - SimpleParserValue::Character(TokenPos(), '*'), - SimpleParserValue::Integer(TokenPos(), 2), - SimpleParserValue::Character(TokenPos(), ';'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Identifier(TokenPos(), new std::string("setLocalVarInt")), + SimpleParserValue::Identifier(TokenPos(), new std::string("sample_var")), + SimpleParserValue::Identifier(TokenPos(), new std::string("milliseconds")), + SimpleParserValue::Character(TokenPos(), '('), + SimpleParserValue::Character(TokenPos(), ')'), + SimpleParserValue::Character(TokenPos(), '*'), + SimpleParserValue::Integer(TokenPos(), 2), + SimpleParserValue::Character(TokenPos(), ';'), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); REQUIRE(result); @@ -907,17 +811,15 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Identifier(TokenPos(), new std::string("setLocalVarFloat")), - SimpleParserValue::Identifier(TokenPos(), new std::string("sample_var")), - SimpleParserValue::Identifier(TokenPos(), new std::string("milliseconds")), - SimpleParserValue::Character(TokenPos(), '('), - SimpleParserValue::Character(TokenPos(), ')'), - SimpleParserValue::Character(TokenPos(), '/'), - SimpleParserValue::Integer(TokenPos(), 2), - SimpleParserValue::Character(TokenPos(), ';'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Identifier(TokenPos(), new std::string("setLocalVarFloat")), + SimpleParserValue::Identifier(TokenPos(), new std::string("sample_var")), + SimpleParserValue::Identifier(TokenPos(), new std::string("milliseconds")), + SimpleParserValue::Character(TokenPos(), '('), + SimpleParserValue::Character(TokenPos(), ')'), + SimpleParserValue::Character(TokenPos(), '/'), + SimpleParserValue::Integer(TokenPos(), 2), + SimpleParserValue::Character(TokenPos(), ';'), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); REQUIRE(result); @@ -942,17 +844,15 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Identifier(TokenPos(), new std::string("setLocalVarString")), - SimpleParserValue::Identifier(TokenPos(), new std::string("sample_var")), - SimpleParserValue::Identifier(TokenPos(), new std::string("milliseconds")), - SimpleParserValue::Character(TokenPos(), '('), - SimpleParserValue::Character(TokenPos(), ')'), - SimpleParserValue::Character(TokenPos(), '+'), - SimpleParserValue::String(TokenPos(), new std::string(" Hello")), - SimpleParserValue::Character(TokenPos(), ';'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Identifier(TokenPos(), new std::string("setLocalVarString")), + SimpleParserValue::Identifier(TokenPos(), new std::string("sample_var")), + SimpleParserValue::Identifier(TokenPos(), new std::string("milliseconds")), + SimpleParserValue::Character(TokenPos(), '('), + SimpleParserValue::Character(TokenPos(), ')'), + SimpleParserValue::Character(TokenPos(), '+'), + SimpleParserValue::String(TokenPos(), new std::string(" Hello")), + SimpleParserValue::Character(TokenPos(), ';'), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); REQUIRE(result); @@ -981,10 +881,7 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Character(pos, '}'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Character(pos, '}'), SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -1002,10 +899,7 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Character(pos, '}'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Character(pos, '}'), SimpleParserValue::EndOfFile(pos)}); helper.m_state->m_current_script << R"("fadeIn" "some_element" ; )"; @@ -1031,16 +925,14 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Identifier(pos, new std::string("if")), - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 1336), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 1), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Identifier(pos, new std::string("if")), + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 1336), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -1077,14 +969,12 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Identifier(pos, new std::string("if")), - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Identifier(pos, new std::string("if")), + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos)}); helper.m_state->m_current_script << R"("fadeIn" "some_element" ; )"; @@ -1116,17 +1006,15 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Character(pos, '}'), - SimpleParserValue::Identifier(pos, new std::string("elseif")), - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 1336), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 1), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Character(pos, '}'), + SimpleParserValue::Identifier(pos, new std::string("elseif")), + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 1336), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos)}); const auto currentIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), nullptr); helper.m_state->m_current_nested_event_handler_set = currentIfCondition->m_condition_elements.get(); @@ -1170,15 +1058,13 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Character(pos, '}'), - SimpleParserValue::Identifier(pos, new std::string("elseif")), - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Character(pos, '}'), + SimpleParserValue::Identifier(pos, new std::string("elseif")), + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos)}); const auto currentIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), nullptr); helper.m_state->m_current_nested_event_handler_set = currentIfCondition->m_condition_elements.get(); @@ -1214,15 +1100,13 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Character(pos, '}'), - SimpleParserValue::Identifier(pos, new std::string("elseif")), - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Character(pos, '}'), + SimpleParserValue::Identifier(pos, new std::string("elseif")), + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos)}); REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException); } @@ -1231,17 +1115,16 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Character(pos, '}'), - SimpleParserValue::Identifier(pos, new std::string("elseif")), - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos) - }); - - const auto currentIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), std::make_unique<CommonEventHandlerSet>()); + helper.Tokens({SimpleParserValue::Character(pos, '}'), + SimpleParserValue::Identifier(pos, new std::string("elseif")), + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos)}); + + const auto currentIfCondition = + std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), std::make_unique<CommonEventHandlerSet>()); helper.m_state->m_current_nested_event_handler_set = currentIfCondition->m_condition_elements.get(); helper.m_state->m_condition_stack.emplace(currentIfCondition.get()); helper.m_state->m_condition_stack.top().m_in_condition_elements = false; @@ -1253,12 +1136,10 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Character(pos, '}'), - SimpleParserValue::Identifier(pos, new std::string("else")), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Character(pos, '}'), + SimpleParserValue::Identifier(pos, new std::string("else")), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos)}); const auto currentIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), nullptr); helper.m_state->m_current_nested_event_handler_set = currentIfCondition->m_condition_elements.get(); @@ -1285,12 +1166,10 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Character(pos, '}'), - SimpleParserValue::Identifier(pos, new std::string("else")), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Character(pos, '}'), + SimpleParserValue::Identifier(pos, new std::string("else")), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos)}); const auto currentIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), nullptr); helper.m_state->m_current_nested_event_handler_set = currentIfCondition->m_condition_elements.get(); @@ -1317,12 +1196,10 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Character(pos, '}'), - SimpleParserValue::Identifier(pos, new std::string("else")), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Character(pos, '}'), + SimpleParserValue::Identifier(pos, new std::string("else")), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos)}); REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException); } @@ -1331,14 +1208,13 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Character(pos, '}'), - SimpleParserValue::Identifier(pos, new std::string("else")), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos) - }); - - const auto currentIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), std::make_unique<CommonEventHandlerSet>()); + helper.Tokens({SimpleParserValue::Character(pos, '}'), + SimpleParserValue::Identifier(pos, new std::string("else")), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos)}); + + const auto currentIfCondition = + std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), std::make_unique<CommonEventHandlerSet>()); helper.m_state->m_current_nested_event_handler_set = currentIfCondition->m_condition_elements.get(); helper.m_state->m_condition_stack.emplace(currentIfCondition.get()); helper.m_state->m_condition_stack.top().m_in_condition_elements = false; @@ -1350,10 +1226,7 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Character(pos, '}'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Character(pos, '}'), SimpleParserValue::EndOfFile(pos)}); const auto currentIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), nullptr); helper.m_state->m_current_nested_event_handler_set = currentIfCondition->m_condition_elements.get(); @@ -1375,10 +1248,7 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Character(pos, '}'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Character(pos, '}'), SimpleParserValue::EndOfFile(pos)}); const auto baseIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), nullptr); helper.m_state->m_current_nested_event_handler_set = baseIfCondition->m_condition_elements.get(); @@ -1404,12 +1274,10 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Character(pos, '}'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Character(pos, '}'), SimpleParserValue::EndOfFile(pos)}); - const auto baseIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), std::make_unique<CommonEventHandlerSet>()); + const auto baseIfCondition = + std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), std::make_unique<CommonEventHandlerSet>()); helper.m_state->m_current_nested_event_handler_set = baseIfCondition->m_condition_elements.get(); helper.m_state->m_condition_stack.emplace(baseIfCondition.get()); helper.m_state->m_condition_stack.top().m_in_condition_elements = false; @@ -1434,10 +1302,7 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Character(pos, '}'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Character(pos, '}'), SimpleParserValue::EndOfFile(pos)}); const auto baseIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), nullptr); helper.m_state->m_current_nested_event_handler_set = baseIfCondition->m_condition_elements.get(); @@ -1467,10 +1332,7 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Character(pos, '}'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Character(pos, '}'), SimpleParserValue::EndOfFile(pos)}); const auto baseIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), nullptr); helper.m_state->m_current_nested_event_handler_set = baseIfCondition->m_condition_elements.get(); @@ -1493,4 +1355,4 @@ namespace test::parsing::menu::sequence::event_handler_set } #pragma endregion -} +} // namespace test::parsing::menu::sequence::event_handler_set diff --git a/test/ObjLoadingTests/Parsing/Menu/Sequence/ItemScopeSequencesTests.cpp b/test/ObjLoadingTests/Parsing/Menu/Sequence/ItemScopeSequencesTests.cpp index e15e87646..818bed7a8 100644 --- a/test/ObjLoadingTests/Parsing/Menu/Sequence/ItemScopeSequencesTests.cpp +++ b/test/ObjLoadingTests/Parsing/Menu/Sequence/ItemScopeSequencesTests.cpp @@ -1,9 +1,9 @@ -#include <catch2/catch_test_macros.hpp> -#include <catch2/generators/catch_generators.hpp> - -#include "Utils/ClassUtils.h" #include "Parsing/Menu/Sequence/ItemScopeSequences.h" #include "Parsing/Mock/MockLexer.h" +#include "Utils/ClassUtils.h" + +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> using namespace menu; @@ -61,25 +61,23 @@ namespace test::parsing::menu::sequence::item return false; } }; - + TEST_CASE("ItemScopeSequences: Simple dvarStrList works", "[parsing][sequence][menu]") { ItemSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Identifier(pos, new std::string("dvarStrList")), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::String(pos, new std::string("@MENU_AUTO")), - SimpleParserValue::String(pos, new std::string("auto")), - SimpleParserValue::String(pos, new std::string("@MENU_STANDARD_4_3")), - SimpleParserValue::String(pos, new std::string("standard")), - SimpleParserValue::String(pos, new std::string("@MENU_WIDE_16_10")), - SimpleParserValue::String(pos, new std::string("wide 16:10")), - SimpleParserValue::String(pos, new std::string("@MENU_WIDE_16_9")), - SimpleParserValue::String(pos, new std::string("wide 16:9")), - SimpleParserValue::Character(pos, '}'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Identifier(pos, new std::string("dvarStrList")), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::String(pos, new std::string("@MENU_AUTO")), + SimpleParserValue::String(pos, new std::string("auto")), + SimpleParserValue::String(pos, new std::string("@MENU_STANDARD_4_3")), + SimpleParserValue::String(pos, new std::string("standard")), + SimpleParserValue::String(pos, new std::string("@MENU_WIDE_16_10")), + SimpleParserValue::String(pos, new std::string("wide 16:10")), + SimpleParserValue::String(pos, new std::string("@MENU_WIDE_16_9")), + SimpleParserValue::String(pos, new std::string("wide 16:9")), + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::EndOfFile(pos)}); helper.m_item->m_feature_type = CommonItemFeatureType::MULTI_VALUE; helper.m_item->m_multi_value_features = std::make_unique<CommonItemFeaturesMultiValue>(); @@ -89,4 +87,4 @@ namespace test::parsing::menu::sequence::item REQUIRE(result); REQUIRE(helper.m_consumed_token_count == 11); } -} +} // namespace test::parsing::menu::sequence::item diff --git a/test/ParserTestUtils/Parsing/Mock/MockLexer.h b/test/ParserTestUtils/Parsing/Mock/MockLexer.h index 78be4b34b..ae484456a 100644 --- a/test/ParserTestUtils/Parsing/Mock/MockLexer.h +++ b/test/ParserTestUtils/Parsing/Mock/MockLexer.h @@ -1,13 +1,12 @@ #pragma once -#include <vector> -#include <iterator> - -#include "Utils/ClassUtils.h" #include "Parsing/ILexer.h" +#include "Utils/ClassUtils.h" + +#include <iterator> +#include <vector> -template <typename TokenType> -class MockLexer final : public ILexer<TokenType> +template<typename TokenType> class MockLexer final : public ILexer<TokenType> { // TokenType must inherit IParserValue static_assert(std::is_base_of<IParserValue, TokenType>::value); @@ -19,15 +18,15 @@ class MockLexer final : public ILexer<TokenType> public: MockLexer(std::initializer_list<Movable<TokenType>> tokens, TokenType eof) : m_tokens(std::make_move_iterator(tokens.begin()), std::make_move_iterator(tokens.end())), - m_eof(std::move(eof)), - m_pop_count(0u) + m_eof(std::move(eof)), + m_pop_count(0u) { } MockLexer(std::vector<TokenType> tokens, TokenType eof) : m_tokens(std::move(tokens)), - m_eof(std::move(eof)), - m_pop_count(0u) + m_eof(std::move(eof)), + m_pop_count(0u) { } diff --git a/test/ParserTestUtils/Parsing/Mock/MockPackValueSupplier.h b/test/ParserTestUtils/Parsing/Mock/MockPackValueSupplier.h index adcb01140..7c668183d 100644 --- a/test/ParserTestUtils/Parsing/Mock/MockPackValueSupplier.h +++ b/test/ParserTestUtils/Parsing/Mock/MockPackValueSupplier.h @@ -1,7 +1,7 @@ #pragma once -#include "Utils/ClassUtils.h" #include "Parsing/IPackValueSupplier.h" +#include "Utils/ClassUtils.h" class MockPackValueSupplier final : public IPackValueSupplier { diff --git a/test/ParserTestUtils/Parsing/Mock/MockParserLineStream.cpp b/test/ParserTestUtils/Parsing/Mock/MockParserLineStream.cpp index 5bae82b4e..865e774a1 100644 --- a/test/ParserTestUtils/Parsing/Mock/MockParserLineStream.cpp +++ b/test/ParserTestUtils/Parsing/Mock/MockParserLineStream.cpp @@ -61,8 +61,10 @@ bool MockParserLineStream::IsOpen() const bool MockParserLineStream::Eof() const { - return !std::any_of(m_include_positions.begin(), m_include_positions.end(), [](const IncludePos& pos) - { - return pos.m_pos < pos.m_lines.size(); - }); + return !std::any_of(m_include_positions.begin(), + m_include_positions.end(), + [](const IncludePos& pos) + { + return pos.m_pos < pos.m_lines.size(); + }); } diff --git a/test/ParserTestUtils/Parsing/Mock/MockParserLineStream.h b/test/ParserTestUtils/Parsing/Mock/MockParserLineStream.h index 31e10b5ba..8d7b28f94 100644 --- a/test/ParserTestUtils/Parsing/Mock/MockParserLineStream.h +++ b/test/ParserTestUtils/Parsing/Mock/MockParserLineStream.h @@ -1,10 +1,10 @@ #pragma once -#include <vector> -#include <unordered_map> - #include "Parsing/IParserLineStream.h" +#include <unordered_map> +#include <vector> + class MockParserLineStream final : public IParserLineStream { public: @@ -20,7 +20,7 @@ class MockParserLineStream final : public IParserLineStream IncludePos(std::string filename, const std::vector<std::string>& lines); }; - + std::unordered_map<std::string, std::vector<std::string>> m_include_lines; std::vector<IncludePos> m_include_positions; diff --git a/test/ParserTestUtils/Parsing/Mock/MockSequence.h b/test/ParserTestUtils/Parsing/Mock/MockSequence.h index bd052e297..4b70c9b57 100644 --- a/test/ParserTestUtils/Parsing/Mock/MockSequence.h +++ b/test/ParserTestUtils/Parsing/Mock/MockSequence.h @@ -7,15 +7,14 @@ struct MockSequenceState char m_dummy; }; -template<typename TokenType> -class MockSequence final : public AbstractSequence<TokenType, MockSequenceState> +template<typename TokenType> class MockSequence final : public AbstractSequence<TokenType, MockSequenceState> { public: typedef AbstractSequence<TokenType, MockSequenceState> parent_t; private: - using parent_t::AddMatchers; using parent_t::AddLabeledMatchers; + using parent_t::AddMatchers; std::function<void(SequenceResult<TokenType>&)> m_handler; @@ -46,4 +45,4 @@ class MockSequence final : public AbstractSequence<TokenType, MockSequenceState> { return this; } -}; \ No newline at end of file +}; diff --git a/test/ParserTests/Parsing/Impl/CommentRemovingStreamProxyTests.cpp b/test/ParserTests/Parsing/Impl/CommentRemovingStreamProxyTests.cpp index af6fca37e..750d5aa36 100644 --- a/test/ParserTests/Parsing/Impl/CommentRemovingStreamProxyTests.cpp +++ b/test/ParserTests/Parsing/Impl/CommentRemovingStreamProxyTests.cpp @@ -1,19 +1,14 @@ -#include <catch2/catch_test_macros.hpp> -#include <catch2/generators/catch_generators.hpp> - #include "Parsing/Impl/CommentRemovingStreamProxy.h" #include "Parsing/Mock/MockParserLineStream.h" +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> + namespace test::parsing::impl::comment_removing_stream_proxy { TEST_CASE("CommentRemovingStreamProxy: Ensure simple single line comment is working", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "// hello", - "prefix // test", - "t//est" - }; + const std::vector<std::string> lines{"// hello", "prefix // test", "t//est"}; MockParserLineStream mockStream(lines); CommentRemovingStreamProxy proxy(&mockStream); @@ -41,12 +36,7 @@ namespace test::parsing::impl::comment_removing_stream_proxy TEST_CASE("CommentRemovingStreamProxy: Ensure single line comment expands to next line on backslash", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "// hello\\", - "this should still be a comment", - "this should not be a comment anymore" - }; + const std::vector<std::string> lines{"// hello\\", "this should still be a comment", "this should not be a comment anymore"}; MockParserLineStream mockStream(lines); CommentRemovingStreamProxy proxy(&mockStream); @@ -74,13 +64,7 @@ namespace test::parsing::impl::comment_removing_stream_proxy TEST_CASE("CommentRemovingStreamProxy: Ensure single line comment expands to next line on backslash and is repeatable", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "// hello\\", - "this should still be a comment \\", - "this as well", - "this not anymore" - }; + const std::vector<std::string> lines{"// hello\\", "this should still be a comment \\", "this as well", "this not anymore"}; MockParserLineStream mockStream(lines); CommentRemovingStreamProxy proxy(&mockStream); @@ -114,12 +98,7 @@ namespace test::parsing::impl::comment_removing_stream_proxy TEST_CASE("CommentRemovingStreamProxy: Ensure backslash must be last character to expand single line comment to next line", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "// hello\\", - "this should still be a comment \\ ", - "this not anymore" - }; + const std::vector<std::string> lines{"// hello\\", "this should still be a comment \\ ", "this not anymore"}; MockParserLineStream mockStream(lines); CommentRemovingStreamProxy proxy(&mockStream); @@ -147,13 +126,7 @@ namespace test::parsing::impl::comment_removing_stream_proxy TEST_CASE("CommentRemovingStreamProxy: Ensure simple multiline comment works on one line", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "hello/* hell*/ world", - "/*this should be a comment*/", - "Hello /*asdf*/", - "/*asdf*/World" - }; + const std::vector<std::string> lines{"hello/* hell*/ world", "/*this should be a comment*/", "Hello /*asdf*/", "/*asdf*/World"}; MockParserLineStream mockStream(lines); CommentRemovingStreamProxy proxy(&mockStream); @@ -187,13 +160,7 @@ namespace test::parsing::impl::comment_removing_stream_proxy TEST_CASE("CommentRemovingStreamProxy: Ensure simple multiline comment works over multiple lines", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "hello/* hell", - " hell*/ world/*nope", - "notatall", - "hehe*/xd" - }; + const std::vector<std::string> lines{"hello/* hell", " hell*/ world/*nope", "notatall", "hehe*/xd"}; MockParserLineStream mockStream(lines); CommentRemovingStreamProxy proxy(&mockStream); @@ -227,8 +194,7 @@ namespace test::parsing::impl::comment_removing_stream_proxy TEST_CASE("CommentRemovingStreamProxy: Can have multiple comment blocks in one line", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { + const std::vector<std::string> lines{ "Hello/* lovely*/ world and/* beautiful*/ universe", "Hello/* lovely*/ world// and beautiful universe", }; @@ -250,4 +216,4 @@ namespace test::parsing::impl::comment_removing_stream_proxy REQUIRE(proxy.Eof()); } -} +} // namespace test::parsing::impl::comment_removing_stream_proxy diff --git a/test/ParserTests/Parsing/Impl/DefinesStreamProxyTests.cpp b/test/ParserTests/Parsing/Impl/DefinesStreamProxyTests.cpp index ba3d53ce9..335c8c6c3 100644 --- a/test/ParserTests/Parsing/Impl/DefinesStreamProxyTests.cpp +++ b/test/ParserTests/Parsing/Impl/DefinesStreamProxyTests.cpp @@ -1,9 +1,9 @@ -#include <catch2/catch_test_macros.hpp> -#include <catch2/generators/catch_generators.hpp> - #include "Parsing/Impl/DefinesStreamProxy.h" #include "Parsing/Mock/MockParserLineStream.h" +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> + namespace test::parsing::impl::defines_stream_proxy { void ExpectLine(IParserLineStream* stream, const int lineNumber, const std::string& value) @@ -15,14 +15,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure simple define and positive ifdef is working", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "#define ASDF", - "#ifdef ASDF", - "Hello World", - "#endif", - "Hello Galaxy" - }; + const std::vector<std::string> lines{"#define ASDF", "#ifdef ASDF", "Hello World", "#endif", "Hello Galaxy"}; MockParserLineStream mockStream(lines); DefinesStreamProxy proxy(&mockStream); @@ -38,14 +31,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure simple define and negative ifdef is working", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "#define ASDF", - "#ifdef NONO", - "Hello World", - "#endif", - "Hello Galaxy" - }; + const std::vector<std::string> lines{"#define ASDF", "#ifdef NONO", "Hello World", "#endif", "Hello Galaxy"}; MockParserLineStream mockStream(lines); DefinesStreamProxy proxy(&mockStream); @@ -61,14 +47,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure simple define and positive ifndef is working", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "#define ASDF", - "#ifndef NONO", - "Hello World", - "#endif", - "Hello Galaxy" - }; + const std::vector<std::string> lines{"#define ASDF", "#ifndef NONO", "Hello World", "#endif", "Hello Galaxy"}; MockParserLineStream mockStream(lines); DefinesStreamProxy proxy(&mockStream); @@ -84,14 +63,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure simple define and negative ifndef is working", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "#define ASDF", - "#ifndef ASDF", - "Hello World", - "#endif", - "Hello Galaxy" - }; + const std::vector<std::string> lines{"#define ASDF", "#ifndef ASDF", "Hello World", "#endif", "Hello Galaxy"}; MockParserLineStream mockStream(lines); DefinesStreamProxy proxy(&mockStream); @@ -107,16 +79,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure else is working", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "#define ASDF", - "#ifdef NONO", - "Hello World1", - "#else", - "Hello World2", - "#endif", - "Hello Galaxy" - }; + const std::vector<std::string> lines{"#define ASDF", "#ifdef NONO", "Hello World1", "#else", "Hello World2", "#endif", "Hello Galaxy"}; MockParserLineStream mockStream(lines); DefinesStreamProxy proxy(&mockStream); @@ -134,24 +97,21 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure nested ifdef is working", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "#define ASDF", - "#ifdef ASDF", - "#ifdef NONO", - "Hello World1", - "#else", - "Hello World2", - "#endif", - "#else", - "#ifdef ASDF", - "Hello World3", - "#else", - "Hello World4", - "#endif", - "#endif", - "Hello Galaxy" - }; + const std::vector<std::string> lines{"#define ASDF", + "#ifdef ASDF", + "#ifdef NONO", + "Hello World1", + "#else", + "Hello World2", + "#endif", + "#else", + "#ifdef ASDF", + "Hello World3", + "#else", + "Hello World4", + "#endif", + "#endif", + "Hello Galaxy"}; MockParserLineStream mockStream(lines); DefinesStreamProxy proxy(&mockStream); @@ -177,18 +137,8 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure undef is working", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "#define ASDF", - "#ifdef ASDF", - "Hello World", - "#endif", - "#undef ASDF", - "#ifdef ASDF", - "Hello World", - "#endif", - "Hello Galaxy" - }; + const std::vector<std::string> lines{ + "#define ASDF", "#ifdef ASDF", "Hello World", "#endif", "#undef ASDF", "#ifdef ASDF", "Hello World", "#endif", "Hello Galaxy"}; MockParserLineStream mockStream(lines); DefinesStreamProxy proxy(&mockStream); @@ -208,18 +158,8 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure undef does not undefine everything", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "#define ASDF", - "#ifdef ASDF", - "Hello World", - "#endif", - "#undef NONO", - "#ifdef ASDF", - "Hello World", - "#endif", - "Hello Galaxy" - }; + const std::vector<std::string> lines{ + "#define ASDF", "#ifdef ASDF", "Hello World", "#endif", "#undef NONO", "#ifdef ASDF", "Hello World", "#endif", "Hello Galaxy"}; MockParserLineStream mockStream(lines); DefinesStreamProxy proxy(&mockStream); @@ -239,14 +179,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure simple defines are working", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "#define ASDF LOL", - "ASDF", - "A ASDF B", - "ASDF B", - "A ASDF" - }; + const std::vector<std::string> lines{"#define ASDF LOL", "ASDF", "A ASDF B", "ASDF B", "A ASDF"}; MockParserLineStream mockStream(lines); DefinesStreamProxy proxy(&mockStream); @@ -262,11 +195,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure defines can be surrounded by symbols", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "#define ASDF LOL", - "!ASDF%" - }; + const std::vector<std::string> lines{"#define ASDF LOL", "!ASDF%"}; MockParserLineStream mockStream(lines); DefinesStreamProxy proxy(&mockStream); @@ -279,12 +208,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure can use multiple defines in one line", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "#define A Hello", - "#define B world", - "A my dear B!" - }; + const std::vector<std::string> lines{"#define A Hello", "#define B world", "A my dear B!"}; MockParserLineStream mockStream(lines); DefinesStreamProxy proxy(&mockStream); @@ -298,13 +222,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure defines in disabled block are ignored", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "#ifdef LOLO", - "#define hello world", - "#endif", - "hello" - }; + const std::vector<std::string> lines{"#ifdef LOLO", "#define hello world", "#endif", "hello"}; MockParserLineStream mockStream(lines); DefinesStreamProxy proxy(&mockStream); @@ -319,14 +237,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure undefs in disabled block are ignored", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "#define hello world", - "#ifdef LOLO", - "#undef hello", - "#endif", - "hello" - }; + const std::vector<std::string> lines{"#define hello world", "#ifdef LOLO", "#undef hello", "#endif", "hello"}; MockParserLineStream mockStream(lines); DefinesStreamProxy proxy(&mockStream); @@ -342,11 +253,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure can define name with underscores and digits", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "#define __int16 short", - "unsigned __int16 value;" - }; + const std::vector<std::string> lines{"#define __int16 short", "unsigned __int16 value;"}; MockParserLineStream mockStream(lines); DefinesStreamProxy proxy(&mockStream); @@ -361,14 +268,10 @@ namespace test::parsing::impl::defines_stream_proxy { DefinesStreamProxy::Define define("helloworld", "hello universe"); - std::vector<std::string> parameterNames({ - "universe" - }); + std::vector<std::string> parameterNames({"universe"}); define.IdentifyParameters(parameterNames); - std::vector<std::string> parameterValues({ - "mr moneyman" - }); + std::vector<std::string> parameterValues({"mr moneyman"}); REQUIRE(define.Render(parameterValues) == "hello mr moneyman"); } @@ -376,24 +279,16 @@ namespace test::parsing::impl::defines_stream_proxy { DefinesStreamProxy::Define define("helloworld", "alignas(x)"); - std::vector<std::string> parameterNames({ - "x" - }); + std::vector<std::string> parameterNames({"x"}); define.IdentifyParameters(parameterNames); - std::vector<std::string> parameterValues({ - "1337" - }); + std::vector<std::string> parameterValues({"1337"}); REQUIRE(define.Render(parameterValues) == "alignas(1337)"); } TEST_CASE("DefinesStreamProxy: Ensure can add define with parameters", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "#define test(x) alignas(x)", - "struct test(1337) test_struct" - }; + const std::vector<std::string> lines{"#define test(x) alignas(x)", "struct test(1337) test_struct"}; MockParserLineStream mockStream(lines); DefinesStreamProxy proxy(&mockStream); @@ -406,11 +301,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure can use parameter multiple times", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "#define test(x) x|x|x|x", - "struct test(1337) test_struct" - }; + const std::vector<std::string> lines{"#define test(x) x|x|x|x", "struct test(1337) test_struct"}; MockParserLineStream mockStream(lines); DefinesStreamProxy proxy(&mockStream); @@ -423,11 +314,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure can use parameterized define in between symbols", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "#define test(x) x|x|x|x", - "%test(5)%" - }; + const std::vector<std::string> lines{"#define test(x) x|x|x|x", "%test(5)%"}; MockParserLineStream mockStream(lines); DefinesStreamProxy proxy(&mockStream); @@ -440,11 +327,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure can define multiple parameters", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "#define test(a1, a2, a3) a1 + a2 = a3", - "make calc test(1, 2, 3);" - }; + const std::vector<std::string> lines{"#define test(a1, a2, a3) a1 + a2 = a3", "make calc test(1, 2, 3);"}; MockParserLineStream mockStream(lines); DefinesStreamProxy proxy(&mockStream); @@ -457,11 +340,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure can define multiple parameters without spacing", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "#define test(a1,a2,a3) a1+a2=a3", - "make calc test(1,2,3);" - }; + const std::vector<std::string> lines{"#define test(a1,a2,a3) a1+a2=a3", "make calc test(1,2,3);"}; MockParserLineStream mockStream(lines); DefinesStreamProxy proxy(&mockStream); @@ -474,11 +353,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure can define parameters with underscore", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "#define test(test_parameter) this is test_parameter", - "Apparently test(a very cool text);" - }; + const std::vector<std::string> lines{"#define test(test_parameter) this is test_parameter", "Apparently test(a very cool text);"}; MockParserLineStream mockStream(lines); DefinesStreamProxy proxy(&mockStream); @@ -491,8 +366,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure simple if is working with truthy value", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { + const std::vector<std::string> lines{ "#if 1", "Hello World", "#endif", @@ -510,8 +384,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure simple if is working with non-truthy value", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { + const std::vector<std::string> lines{ "#if 0", "Hello World", "#endif", @@ -529,8 +402,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure simple if is working with calculated values", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { + const std::vector<std::string> lines{ "#if 0 || 1", "Hello World", "#endif", @@ -554,8 +426,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure can handle defined operator with defined definition", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { + const std::vector<std::string> lines{ "#define someStuff 1", "#if defined(someStuff)", "Hello World", @@ -575,8 +446,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure can handle defined operator with undefined definition", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { + const std::vector<std::string> lines{ "#define someStuff 1", "#if defined(someStuff) && defined(thisIsNotDefined)", "Hello World", @@ -602,8 +472,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure can use elif", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { + const std::vector<std::string> lines{ "#define someStuff 1", "#if defined(someStuff) && defined(thisIsNotDefined)", "Hello World", @@ -637,8 +506,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure elif does not work when if was true", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { + const std::vector<std::string> lines{ "#define someStuff 1", "#if defined(someStuff)", "Hello World", @@ -662,8 +530,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure can use else when no elif matched", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { + const std::vector<std::string> lines{ "#define someStuff 1", "#if 0", "Hello World", @@ -691,11 +558,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure can use parenthesis in parameters values", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "#define someStuff(param1) Hello param1 World", - "someStuff(A sentence with (parenthesis) and stuff)" - }; + const std::vector<std::string> lines{"#define someStuff(param1) Hello param1 World", "someStuff(A sentence with (parenthesis) and stuff)"}; MockParserLineStream mockStream(lines); DefinesStreamProxy proxy(&mockStream); @@ -708,11 +571,8 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure can use comma in parenthesis in parameters values", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "#define someStuff(param1) Hello param1 World", - "someStuff(A sentence with (parenthesis and a , character) and stuff)" - }; + const std::vector<std::string> lines{"#define someStuff(param1) Hello param1 World", + "someStuff(A sentence with (parenthesis and a , character) and stuff)"}; MockParserLineStream mockStream(lines); DefinesStreamProxy proxy(&mockStream); @@ -725,12 +585,7 @@ namespace test::parsing::impl::defines_stream_proxy TEST_CASE("DefinesStreamProxy: Ensure defines can go over multiple lines", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "#define someStuff(param1) Hello param1 World \\", - "and hello universe", - "someStuff(lovely)" - }; + const std::vector<std::string> lines{"#define someStuff(param1) Hello param1 World \\", "and hello universe", "someStuff(lovely)"}; MockParserLineStream mockStream(lines); DefinesStreamProxy proxy(&mockStream); @@ -741,4 +596,4 @@ namespace test::parsing::impl::defines_stream_proxy REQUIRE(proxy.Eof()); } -} +} // namespace test::parsing::impl::defines_stream_proxy diff --git a/test/ParserTests/Parsing/Impl/IncludingStreamProxyTests.cpp b/test/ParserTests/Parsing/Impl/IncludingStreamProxyTests.cpp index 13f329335..f302e44e0 100644 --- a/test/ParserTests/Parsing/Impl/IncludingStreamProxyTests.cpp +++ b/test/ParserTests/Parsing/Impl/IncludingStreamProxyTests.cpp @@ -1,24 +1,16 @@ -#include <catch2/catch_test_macros.hpp> -#include <catch2/generators/catch_generators.hpp> - #include "Parsing/Impl/IncludingStreamProxy.h" #include "Parsing/Mock/MockParserLineStream.h" +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> + namespace test::parsing::impl::including_stream_proxy { TEST_CASE("IncludingStreamProxy: Ensure simple include is working", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "Hello world", - "#include \"ASDF.txt\"", - "and bye" - }; + const std::vector<std::string> lines{"Hello world", "#include \"ASDF.txt\"", "and bye"}; - const std::vector<std::string> asdf - { - "Hello galaxy" - }; + const std::vector<std::string> asdf{"Hello galaxy"}; MockParserLineStream mockStream(lines); mockStream.AddIncludeLines("ASDF.txt", asdf); @@ -51,17 +43,9 @@ namespace test::parsing::impl::including_stream_proxy TEST_CASE("IncludingStreamProxy: Ensure simple include with angle brackets is working", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "Hello world", - "#include <ASDF.txt>", - "and bye" - }; + const std::vector<std::string> lines{"Hello world", "#include <ASDF.txt>", "and bye"}; - const std::vector<std::string> asdf - { - "Hello galaxy" - }; + const std::vector<std::string> asdf{"Hello galaxy"}; MockParserLineStream mockStream(lines); mockStream.AddIncludeLines("ASDF.txt", asdf); @@ -94,17 +78,9 @@ namespace test::parsing::impl::including_stream_proxy TEST_CASE("IncludingStreamProxy: Ensure can have spaces before include directive", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "Hello world", - " #include \"ASDF.txt\" ", - "and bye" - }; + const std::vector<std::string> lines{"Hello world", " #include \"ASDF.txt\" ", "and bye"}; - const std::vector<std::string> asdf - { - "Hello galaxy" - }; + const std::vector<std::string> asdf{"Hello galaxy"}; MockParserLineStream mockStream(lines); mockStream.AddIncludeLines("ASDF.txt", asdf); @@ -137,19 +113,9 @@ namespace test::parsing::impl::including_stream_proxy TEST_CASE("IncludingStreamProxy: Ensure pragma once prevents including the same file more than once", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "Hello world", - "#include \"ASDF.txt\"", - "#include \"ASDF.txt\"", - "and bye" - }; + const std::vector<std::string> lines{"Hello world", "#include \"ASDF.txt\"", "#include \"ASDF.txt\"", "and bye"}; - const std::vector<std::string> asdf - { - "#pragma once", - "Hello galaxy" - }; + const std::vector<std::string> asdf{"#pragma once", "Hello galaxy"}; MockParserLineStream mockStream(lines); mockStream.AddIncludeLines("ASDF.txt", asdf); @@ -179,4 +145,4 @@ namespace test::parsing::impl::including_stream_proxy REQUIRE(proxy.Eof()); } -} +} // namespace test::parsing::impl::including_stream_proxy diff --git a/test/ParserTests/Parsing/Impl/PackDefinitionStreamProxyTests.cpp b/test/ParserTests/Parsing/Impl/PackDefinitionStreamProxyTests.cpp index 7f85f4e5e..d382de226 100644 --- a/test/ParserTests/Parsing/Impl/PackDefinitionStreamProxyTests.cpp +++ b/test/ParserTests/Parsing/Impl/PackDefinitionStreamProxyTests.cpp @@ -1,9 +1,9 @@ -#include <catch2/catch_test_macros.hpp> -#include <catch2/generators/catch_generators.hpp> - #include "Parsing/Impl/PackDefinitionStreamProxy.h" #include "Parsing/Mock/MockParserLineStream.h" +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> + namespace test::parsing::impl::pack_definition_stream_proxy { void ExpectLine(IParserLineStream* stream, const int lineNumber, const std::string& value) @@ -15,14 +15,7 @@ namespace test::parsing::impl::pack_definition_stream_proxy TEST_CASE("PackDefinitionStreamProxy: Ensure simple pack directives are working", "[parsing][parsingstream]") { - const std::vector<std::string> lines - { - "hello world", - "#pragma pack(push, 32)", - "hello galaxy", - "#pragma pack(pop)", - "hello universe" - }; + const std::vector<std::string> lines{"hello world", "#pragma pack(push, 32)", "hello galaxy", "#pragma pack(pop)", "hello universe"}; MockParserLineStream mockStream(lines); PackDefinitionStreamProxy proxy(&mockStream); @@ -37,4 +30,4 @@ namespace test::parsing::impl::pack_definition_stream_proxy REQUIRE(proxy.Eof()); } -} \ No newline at end of file +} // namespace test::parsing::impl::pack_definition_stream_proxy diff --git a/test/ParserTests/Parsing/Simple/SimpleExpressionTests.cpp b/test/ParserTests/Parsing/Simple/SimpleExpressionTests.cpp index 14082bd35..4ce91aec1 100644 --- a/test/ParserTests/Parsing/Simple/SimpleExpressionTests.cpp +++ b/test/ParserTests/Parsing/Simple/SimpleExpressionTests.cpp @@ -1,16 +1,15 @@ -#include <catch2/catch_test_macros.hpp> -#include <catch2/generators/catch_generators.hpp> - -#include <sstream> - #include "Parsing/Impl/AbstractParser.h" #include "Parsing/Impl/ParserSingleInputStream.h" -#include "Utils/ClassUtils.h" #include "Parsing/Mock/MockLexer.h" -#include "Parsing/Simple/SimpleParserValue.h" #include "Parsing/Simple/Expression/ISimpleExpression.h" #include "Parsing/Simple/Expression/SimpleExpressionMatchers.h" #include "Parsing/Simple/Matcher/SimpleMatcherFactory.h" +#include "Parsing/Simple/SimpleParserValue.h" +#include "Utils/ClassUtils.h" + +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> +#include <sstream> namespace test::parsing::simple::expression { @@ -60,9 +59,7 @@ namespace test::parsing::simple::expression protected: const std::vector<sequence_t*>& GetTestsForState() override { - static std::vector<sequence_t*> tests({ - new SimpleExpressionSequence() - }); + static std::vector<sequence_t*> tests({new SimpleExpressionSequence()}); return tests; } @@ -143,12 +140,10 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Integer(pos, 1336), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 1), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Integer(pos, 1336), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -167,12 +162,10 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Integer(pos, 428), - SimpleParserValue::Character(pos, '-'), - SimpleParserValue::Integer(pos, 8), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Integer(pos, 428), + SimpleParserValue::Character(pos, '-'), + SimpleParserValue::Integer(pos, 8), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -191,12 +184,10 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Integer(pos, 105), - SimpleParserValue::Character(pos, '*'), - SimpleParserValue::Integer(pos, 4), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Integer(pos, 105), + SimpleParserValue::Character(pos, '*'), + SimpleParserValue::Integer(pos, 4), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -215,12 +206,10 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Integer(pos, 561540), - SimpleParserValue::Character(pos, '/'), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Integer(pos, 561540), + SimpleParserValue::Character(pos, '/'), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -239,12 +228,10 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Integer(pos, 92673), - SimpleParserValue::Character(pos, '%'), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Integer(pos, 92673), + SimpleParserValue::Character(pos, '%'), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -263,12 +250,10 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Integer(pos, 0x7FFFFFF0), - SimpleParserValue::Character(pos, '&'), - SimpleParserValue::Integer(pos, 0x2AAAAAAA), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Integer(pos, 0x7FFFFFF0), + SimpleParserValue::Character(pos, '&'), + SimpleParserValue::Integer(pos, 0x2AAAAAAA), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -287,12 +272,10 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Integer(pos, 5), - SimpleParserValue::Character(pos, '|'), - SimpleParserValue::Integer(pos, 3), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Integer(pos, 5), + SimpleParserValue::Character(pos, '|'), + SimpleParserValue::Integer(pos, 3), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -311,12 +294,11 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Integer(pos, 105), - SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::SHIFT_LEFT)), - SimpleParserValue::Integer(pos, 2), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Integer(pos, 105), + SimpleParserValue::MultiCharacter( + pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::SHIFT_LEFT)), + SimpleParserValue::Integer(pos, 2), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -335,12 +317,11 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Integer(pos, 42784), - SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::SHIFT_RIGHT)), - SimpleParserValue::Integer(pos, 5), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Integer(pos, 42784), + SimpleParserValue::MultiCharacter( + pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::SHIFT_RIGHT)), + SimpleParserValue::Integer(pos, 5), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -359,12 +340,10 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::Character(pos, '>'), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::Character(pos, '>'), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -383,12 +362,11 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::GREATER_EQUAL_THAN)), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::MultiCharacter( + pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::GREATER_EQUAL_THAN)), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -407,12 +385,10 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, '<'), - SimpleParserValue::Integer(pos, 421), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, '<'), + SimpleParserValue::Integer(pos, 421), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -431,12 +407,11 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::LESS_EQUAL_THAN)), - SimpleParserValue::Integer(pos, 421), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Integer(pos, 420), + SimpleParserValue::MultiCharacter( + pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::LESS_EQUAL_THAN)), + SimpleParserValue::Integer(pos, 421), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -455,12 +430,11 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::EQUALS)), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens( + {SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::EQUALS)), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -479,12 +453,11 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::NOT_EQUAL)), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens( + {SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::NOT_EQUAL)), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -503,12 +476,11 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::AND)), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens( + {SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::AND)), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -527,12 +499,11 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Integer(pos, 0), - SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::OR)), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens( + {SimpleParserValue::Integer(pos, 0), + SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::OR)), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -551,16 +522,14 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Integer(pos, 100), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 4), - SimpleParserValue::Character(pos, '*'), - SimpleParserValue::Integer(pos, 25), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 220), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Integer(pos, 100), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 4), + SimpleParserValue::Character(pos, '*'), + SimpleParserValue::Integer(pos, 25), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 220), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -579,16 +548,14 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 40), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 2), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '*'), - SimpleParserValue::Integer(pos, 10), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 40), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 2), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '*'), + SimpleParserValue::Integer(pos, 10), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -607,14 +574,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Integer(pos, 1), - SimpleParserValue::Character(pos, '?'), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ':'), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Integer(pos, 1), + SimpleParserValue::Character(pos, '?'), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ':'), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -633,14 +598,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Integer(pos, 0), - SimpleParserValue::Character(pos, '?'), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ':'), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Integer(pos, 0), + SimpleParserValue::Character(pos, '?'), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ':'), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -659,18 +622,16 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 1), - SimpleParserValue::Character(pos, '?'), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ':'), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 1), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::Character(pos, '?'), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ':'), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -689,18 +650,16 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 0), - SimpleParserValue::Character(pos, '?'), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ':'), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 1), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 0), + SimpleParserValue::Character(pos, '?'), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ':'), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -719,18 +678,16 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, -1), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 2), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '?'), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ':'), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, -1), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 2), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '?'), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ':'), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -749,18 +706,16 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Integer(pos, 1), - SimpleParserValue::Character(pos, '?'), - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 210), - SimpleParserValue::Character(pos, '*'), - SimpleParserValue::Integer(pos, 2), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, ':'), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Integer(pos, 1), + SimpleParserValue::Character(pos, '?'), + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 210), + SimpleParserValue::Character(pos, '*'), + SimpleParserValue::Integer(pos, 2), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, ':'), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -779,18 +734,16 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({ - SimpleParserValue::Integer(pos, 0), - SimpleParserValue::Character(pos, '?'), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ':'), - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 1336), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 1), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::EndOfFile(pos) - }); + helper.Tokens({SimpleParserValue::Integer(pos, 0), + SimpleParserValue::Character(pos, '?'), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ':'), + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 1336), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::EndOfFile(pos)}); const auto result = helper.PerformTest(); @@ -840,5 +793,5 @@ namespace test::parsing::simple::expression REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 11); } - } -} + } // namespace it +} // namespace test::parsing::simple::expression diff --git a/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Impl/CommandsLexerTests.cpp b/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Impl/CommandsLexerTests.cpp index 8f5ed4172..af0082fa5 100644 --- a/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Impl/CommandsLexerTests.cpp +++ b/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Impl/CommandsLexerTests.cpp @@ -1,13 +1,10 @@ -#include <catch2/catch_test_macros.hpp> -#include <catch2/generators/catch_generators.hpp> - #include "Parsing/Commands/Impl/CommandsLexer.h" #include "Parsing/Mock/MockParserLineStream.h" +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> + namespace test::parsing::commands::impl::commands_lexer { - TEST_CASE("CommandsLexer: ", "[parsing][commands]") - { - - } -} + TEST_CASE("CommandsLexer: ", "[parsing][commands]") {} +} // namespace test::parsing::commands::impl::commands_lexer diff --git a/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceActionTests.cpp b/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceActionTests.cpp index f801b59d6..e78a1dc0f 100644 --- a/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceActionTests.cpp +++ b/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceActionTests.cpp @@ -1,12 +1,12 @@ -#include <catch2/catch_test_macros.hpp> -#include <catch2/generators/catch_generators.hpp> - -#include "Utils/ClassUtils.h" #include "Parsing/Commands/Sequence/SequenceAction.h" #include "Parsing/Mock/MockLexer.h" #include "Parsing/PostProcessing/CreateMemberInformationPostProcessor.h" #include "Parsing/PostProcessing/CreateStructureInformationPostProcessor.h" #include "Persistence/InMemory/InMemoryRepository.h" +#include "Utils/ClassUtils.h" + +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> namespace test::parsing::commands::sequence::sequence_action { @@ -54,8 +54,7 @@ namespace test::parsing::commands::sequence::sequence_action auto createStructureInformation = std::make_unique<CreateStructureInformationPostProcessor>(); auto createMemberInformation = std::make_unique<CreateMemberInformationPostProcessor>(); - return createStructureInformation->PostProcess(m_repository.get()) - && createMemberInformation->PostProcess(m_repository.get()); + return createStructureInformation->PostProcess(m_repository.get()) && createMemberInformation->PostProcess(m_repository.get()); } void AddSampleData() @@ -89,7 +88,6 @@ namespace test::parsing::commands::sequence::sequence_action } public: - CommandsSequenceTestsHelper() : m_repository(std::make_unique<InMemoryRepository>()), m_state(std::make_unique<CommandsParserState>(m_repository.get())), @@ -127,16 +125,14 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({ - CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos) - }); + helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos)}); auto result = helper.PerformTest(); @@ -151,17 +147,15 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({ - CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Identifier(pos, new std::string("arg_t")), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos) - }); + helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Identifier(pos, new std::string("arg_t")), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos)}); auto result = helper.PerformTest(); @@ -177,19 +171,17 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({ - CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Identifier(pos, new std::string("arg_t")), - CommandsParserValue::Character(pos, ','), - CommandsParserValue::Identifier(pos, new std::string("another_arg_t")), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos) - }); + helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Identifier(pos, new std::string("arg_t")), + CommandsParserValue::Character(pos, ','), + CommandsParserValue::Identifier(pos, new std::string("another_arg_t")), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos)}); auto result = helper.PerformTest(); @@ -206,21 +198,19 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({ - CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Identifier(pos, new std::string("arg_t")), - CommandsParserValue::Character(pos, ','), - CommandsParserValue::Identifier(pos, new std::string("another_arg_t")), - CommandsParserValue::Character(pos, ','), - CommandsParserValue::Identifier(pos, new std::string("yeet_t")), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos) - }); + helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Identifier(pos, new std::string("arg_t")), + CommandsParserValue::Character(pos, ','), + CommandsParserValue::Identifier(pos, new std::string("another_arg_t")), + CommandsParserValue::Character(pos, ','), + CommandsParserValue::Identifier(pos, new std::string("yeet_t")), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos)}); auto result = helper.PerformTest(); @@ -238,16 +228,14 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({ - CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("unknown_struct_t")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos) - }); + helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("unknown_struct_t")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos)}); REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException); REQUIRE(helper.m_test_struct->m_post_load_action == nullptr); @@ -257,21 +245,19 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({ - CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Identifier(pos, new std::string("arg_t")), - CommandsParserValue::Character(pos, ','), - CommandsParserValue::Identifier(pos, new std::string("another_arg_t")), - CommandsParserValue::Character(pos, ','), - CommandsParserValue::Identifier(pos, new std::string("unknown_type_t")), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos) - }); + helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Identifier(pos, new std::string("arg_t")), + CommandsParserValue::Character(pos, ','), + CommandsParserValue::Identifier(pos, new std::string("another_arg_t")), + CommandsParserValue::Character(pos, ','), + CommandsParserValue::Identifier(pos, new std::string("unknown_type_t")), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos)}); REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException); REQUIRE(helper.m_test_struct->m_post_load_action == nullptr); @@ -281,15 +267,13 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({ - CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos) - }); + helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos)}); REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException); REQUIRE(helper.m_test_struct->m_post_load_action == nullptr); @@ -299,15 +283,13 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({ - CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos) - }); + helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos)}); helper.m_state->SetInUse(helper.m_test_struct); auto result = helper.PerformTest(); @@ -323,19 +305,17 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({ - CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("container_struct_t")), - CommandsParserValue::Character(pos, ':'), - CommandsParserValue::Character(pos, ':'), - CommandsParserValue::Identifier(pos, new std::string("m_child")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos) - }); + helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("container_struct_t")), + CommandsParserValue::Character(pos, ':'), + CommandsParserValue::Character(pos, ':'), + CommandsParserValue::Identifier(pos, new std::string("m_child")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos)}); auto result = helper.PerformTest(); @@ -350,16 +330,14 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({ - CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("m_child")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos) - }); + helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("m_child")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos)}); helper.m_state->SetInUse(helper.m_test_struct2); auto result = helper.PerformTest(); @@ -375,19 +353,17 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({ - CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("container_struct_t")), - CommandsParserValue::Character(pos, ':'), - CommandsParserValue::Character(pos, ':'), - CommandsParserValue::Identifier(pos, new std::string("m_child")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos) - }); + helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("container_struct_t")), + CommandsParserValue::Character(pos, ':'), + CommandsParserValue::Character(pos, ':'), + CommandsParserValue::Identifier(pos, new std::string("m_child")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos)}); helper.m_state->SetInUse(helper.m_arg_struct2); auto result = helper.PerformTest(); @@ -403,21 +379,19 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({ - CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), - CommandsParserValue::Character(pos, ':'), - CommandsParserValue::Character(pos, ':'), - CommandsParserValue::Identifier(pos, new std::string("m_test")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos) - }); + helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), + CommandsParserValue::Character(pos, ':'), + CommandsParserValue::Character(pos, ':'), + CommandsParserValue::Identifier(pos, new std::string("m_test")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos)}); REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException); REQUIRE(helper.m_test_struct->m_post_load_action == nullptr); } -} +} // namespace test::parsing::commands::sequence::sequence_action diff --git a/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceArchitectureTests.cpp b/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceArchitectureTests.cpp index 12e7518de..01d5cfe91 100644 --- a/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceArchitectureTests.cpp +++ b/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceArchitectureTests.cpp @@ -1,10 +1,10 @@ -#include <catch2/catch_test_macros.hpp> -#include <catch2/generators/catch_generators.hpp> - -#include "Utils/ClassUtils.h" #include "Parsing/Commands/Sequence/SequenceArchitecture.h" #include "Parsing/Mock/MockLexer.h" #include "Persistence/InMemory/InMemoryRepository.h" +#include "Utils/ClassUtils.h" + +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> namespace test::parsing::commands::sequence::sequence_architecture { @@ -16,7 +16,7 @@ namespace test::parsing::commands::sequence::sequence_architecture std::unique_ptr<ILexer<CommandsParserValue>> m_lexer; unsigned m_consumed_token_count; - + CommandsSequenceTestsHelper() : m_repository(std::make_unique<InMemoryRepository>()), m_state(std::make_unique<CommandsParserState>(m_repository.get())), @@ -41,12 +41,10 @@ namespace test::parsing::commands::sequence::sequence_architecture { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({ - CommandsParserValue::Identifier(pos, new std::string("architecture")), - CommandsParserValue::Identifier(pos, new std::string("x86")), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos) - }); + helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("architecture")), + CommandsParserValue::Identifier(pos, new std::string("x86")), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos)}); auto result = helper.PerformTest(); @@ -59,12 +57,10 @@ namespace test::parsing::commands::sequence::sequence_architecture { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({ - CommandsParserValue::Identifier(pos, new std::string("architecture")), - CommandsParserValue::Identifier(pos, new std::string("x86")), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos) - }); + helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("architecture")), + CommandsParserValue::Identifier(pos, new std::string("x86")), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos)}); auto result = helper.PerformTest(); @@ -77,14 +73,12 @@ namespace test::parsing::commands::sequence::sequence_architecture { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({ - CommandsParserValue::Identifier(pos, new std::string("architecture")), - CommandsParserValue::Identifier(pos, new std::string("x1337")), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos) - }); - + helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("architecture")), + CommandsParserValue::Identifier(pos, new std::string("x1337")), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos)}); + REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException); REQUIRE(helper.m_repository->GetArchitecture() == Architecture::UNKNOWN); } -} +} // namespace test::parsing::commands::sequence::sequence_architecture diff --git a/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceGameTests.cpp b/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceGameTests.cpp index 03cc85c68..d6d64ddba 100644 --- a/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceGameTests.cpp +++ b/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceGameTests.cpp @@ -1,10 +1,10 @@ -#include <catch2/catch_test_macros.hpp> -#include <catch2/generators/catch_generators.hpp> - -#include "Utils/ClassUtils.h" #include "Parsing/Commands/Sequence/SequenceGame.h" #include "Parsing/Mock/MockLexer.h" #include "Persistence/InMemory/InMemoryRepository.h" +#include "Utils/ClassUtils.h" + +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> namespace test::parsing::commands::sequence::sequence_game { @@ -41,12 +41,10 @@ namespace test::parsing::commands::sequence::sequence_game { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({ - CommandsParserValue::Identifier(pos, new std::string("game")), - CommandsParserValue::Identifier(pos, new std::string("very_cool_game")), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos) - }); + helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("game")), + CommandsParserValue::Identifier(pos, new std::string("very_cool_game")), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos)}); auto result = helper.PerformTest(); @@ -54,4 +52,4 @@ namespace test::parsing::commands::sequence::sequence_game REQUIRE(helper.m_consumed_token_count == 3); REQUIRE(helper.m_repository->GetGameName() == "very_cool_game"); } -} +} // namespace test::parsing::commands::sequence::sequence_game diff --git a/test/ZoneCodeGeneratorLibTests/Parsing/Header/Impl/HeaderLexerTests.cpp b/test/ZoneCodeGeneratorLibTests/Parsing/Header/Impl/HeaderLexerTests.cpp index b33cc697e..10a40dd44 100644 --- a/test/ZoneCodeGeneratorLibTests/Parsing/Header/Impl/HeaderLexerTests.cpp +++ b/test/ZoneCodeGeneratorLibTests/Parsing/Header/Impl/HeaderLexerTests.cpp @@ -1,10 +1,10 @@ -#include <catch2/catch_test_macros.hpp> -#include <catch2/matchers/catch_matchers_floating_point.hpp> -#include <catch2/generators/catch_generators.hpp> - #include "Parsing/Header/Impl/HeaderLexer.h" #include "Parsing/Mock/MockParserLineStream.h" +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> +#include <catch2/matchers/catch_matchers_floating_point.hpp> + using namespace Catch::Matchers; namespace test::parsing::header::impl::header_lexer @@ -53,13 +53,7 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Ensure can parse simple hex numbers", "[parsing][header]") { - const std::vector<std::string> lines - { - "0x1A4", - " 0xABC ", - " 0xAAA", - "0xBBB " - }; + const std::vector<std::string> lines{"0x1A4", " 0xABC ", " 0xAAA", "0xBBB "}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -74,12 +68,7 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Ensure can parse simple hex numbers surrounded by identifiers", "[parsing][header]") { - const std::vector<std::string> lines - { - "abc 0xABC cba", - "aaa 0xAAA", - "0xBBB bbb" - }; + const std::vector<std::string> lines{"abc 0xABC cba", "aaa 0xAAA", "0xBBB bbb"}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -99,8 +88,7 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Ensure can parse simple hex numbers surrounded by symbols", "[parsing][header]") { - const std::vector<std::string> lines - { + const std::vector<std::string> lines{ "0x25:0xABC,0x1a4", }; @@ -118,10 +106,7 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Ensure throws exception when parsing incomplete hex number", "[parsing][header]") { - const std::vector<std::string> lines - { - "0x" - }; + const std::vector<std::string> lines{"0x"}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -131,11 +116,8 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Ensure throws exception when parsing invalid hex number", "[parsing][header]") { - const std::vector<std::string> lines - { - "0xGEGE" - }; - + const std::vector<std::string> lines{"0xGEGE"}; + MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -144,10 +126,7 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Ensure throws exception when parsing invalid hex number that starts with a valid letter", "[parsing][header]") { - const std::vector<std::string> lines - { - "0xEGEG" - }; + const std::vector<std::string> lines{"0xEGEG"}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -157,12 +136,7 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Ensure can parse simple integers", "[parsing][header]") { - const std::vector<std::string> lines - { - " 524 ", - "4221111 1337 ", - "0 420" - }; + const std::vector<std::string> lines{" 524 ", "4221111 1337 ", "0 420"}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -176,12 +150,7 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Ensure can parse integers surrounded by identifiers", "[parsing][header]") { - const std::vector<std::string> lines - { - "aa 6 bb", - "123456789 ccc", - "0 d 420" - }; + const std::vector<std::string> lines{"aa 6 bb", "123456789 ccc", "0 d 420"}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -198,28 +167,22 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Ensure parses negative numbers as character and number", "[parsing][header]") { - const std::vector<std::string> lines - { - "-1337" - }; + const std::vector<std::string> lines{"-1337"}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); - + ExpectCharacterToken(lexer, '-'); ExpectIntegerToken(lexer, 1337); } TEST_CASE("HeaderLexer: Ensure recognizes numbers surrounded by characters", "[parsing][header]") { - const std::vector<std::string> lines - { - "(1337)" - }; + const std::vector<std::string> lines{"(1337)"}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); - + ExpectCharacterToken(lexer, '('); ExpectIntegerToken(lexer, 1337); ExpectCharacterToken(lexer, ')'); @@ -227,25 +190,17 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Ensure parses simple floating point numbers", "[parsing][header]") { - const std::vector<std::string> lines - { - "420.1337" - }; + const std::vector<std::string> lines{"420.1337"}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); - + ExpectFloatingPointToken(lexer, 420.1337); } TEST_CASE("HeaderLexer: Ensure parses simple floating point numbers surrounded by identifiers", "[parsing][header]") { - const std::vector<std::string> lines - { - "aa 50.24 a", - "b 36.999", - "59595.2414 c" - }; + const std::vector<std::string> lines{"aa 50.24 a", "b 36.999", "59595.2414 c"}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -261,10 +216,7 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Ensure recognizes floating point numbers surrounded by characters", "[parsing][header]") { - const std::vector<std::string> lines - { - "(1337.420)" - }; + const std::vector<std::string> lines{"(1337.420)"}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -276,10 +228,7 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Ensure can separate identifiers with symbols", "[parsing][header]") { - const std::vector<std::string> lines - { - "hello|world hello_+universe" - }; + const std::vector<std::string> lines{"hello|world hello_+universe"}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -294,10 +243,7 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Can recognize shift left", "[parsing][header]") { - const std::vector<std::string> lines - { - "<<hello<<world<<" - }; + const std::vector<std::string> lines{"<<hello<<world<<"}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -311,10 +257,7 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Can recognize less equals", "[parsing][header]") { - const std::vector<std::string> lines - { - "<=hello<=world<=" - }; + const std::vector<std::string> lines{"<=hello<=world<="}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -328,10 +271,7 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Can recognize less", "[parsing][header]") { - const std::vector<std::string> lines - { - "<%hello<world<&" - }; + const std::vector<std::string> lines{"<%hello<world<&"}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -347,10 +287,7 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Can recognize shift right", "[parsing][header]") { - const std::vector<std::string> lines - { - ">>hello>>world>>" - }; + const std::vector<std::string> lines{">>hello>>world>>"}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -364,10 +301,7 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Can recognize greater equals", "[parsing][header]") { - const std::vector<std::string> lines - { - ">=hello>=world>=" - }; + const std::vector<std::string> lines{">=hello>=world>="}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -381,10 +315,7 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Can recognize greater", "[parsing][header]") { - const std::vector<std::string> lines - { - ">%hello>world>&" - }; + const std::vector<std::string> lines{">%hello>world>&"}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -400,10 +331,7 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Can recognize equals", "[parsing][header]") { - const std::vector<std::string> lines - { - "==hello==world==" - }; + const std::vector<std::string> lines{"==hello==world=="}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -417,10 +345,7 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Can recognize assign", "[parsing][header]") { - const std::vector<std::string> lines - { - "=%hello=world=&" - }; + const std::vector<std::string> lines{"=%hello=world=&"}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -436,10 +361,7 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Can recognize logical and", "[parsing][header]") { - const std::vector<std::string> lines - { - "&&hello&&world&&" - }; + const std::vector<std::string> lines{"&&hello&&world&&"}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -453,10 +375,7 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Can recognize ampersand", "[parsing][header]") { - const std::vector<std::string> lines - { - "&%hello&world&+" - }; + const std::vector<std::string> lines{"&%hello&world&+"}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -472,10 +391,7 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Can recognize logical or", "[parsing][header]") { - const std::vector<std::string> lines - { - "||hello||world||" - }; + const std::vector<std::string> lines{"||hello||world||"}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -489,10 +405,7 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Can recognize pipe", "[parsing][header]") { - const std::vector<std::string> lines - { - "|%hello|world|&" - }; + const std::vector<std::string> lines{"|%hello|world|&"}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -508,10 +421,7 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Can recognize not equals", "[parsing][header]") { - const std::vector<std::string> lines - { - "!=hello!=world!=" - }; + const std::vector<std::string> lines{"!=hello!=world!="}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -525,10 +435,7 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Can recognize exclamation mark", "[parsing][header]") { - const std::vector<std::string> lines - { - "!%hello!world!&" - }; + const std::vector<std::string> lines{"!%hello!world!&"}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -544,13 +451,7 @@ namespace test::parsing::header::impl::header_lexer TEST_CASE("HeaderLexer: Can recognize strings", "[parsing][header]") { - const std::vector<std::string> lines - { - "\"hello world\"", - "a\"hi there\"bbb", - " \"nice\"", - "\"meme\" " - }; + const std::vector<std::string> lines{"\"hello world\"", "a\"hi there\"bbb", " \"nice\"", "\"meme\" "}; MockParserLineStream mockStream(lines); HeaderLexer lexer(&mockStream); @@ -562,4 +463,4 @@ namespace test::parsing::header::impl::header_lexer ExpectStringToken(lexer, "nice"); ExpectStringToken(lexer, "meme"); } -} +} // namespace test::parsing::header::impl::header_lexer diff --git a/test/ZoneCodeGeneratorLibTests/Parsing/Header/Sequence/SequenceNamespaceTests.cpp b/test/ZoneCodeGeneratorLibTests/Parsing/Header/Sequence/SequenceNamespaceTests.cpp index 3497dbd44..7137da5f8 100644 --- a/test/ZoneCodeGeneratorLibTests/Parsing/Header/Sequence/SequenceNamespaceTests.cpp +++ b/test/ZoneCodeGeneratorLibTests/Parsing/Header/Sequence/SequenceNamespaceTests.cpp @@ -1,21 +1,20 @@ -#include <catch2/catch_test_macros.hpp> -#include <catch2/generators/catch_generators.hpp> - #include "Parsing/Header/Sequence/SequenceNamespace.h" #include "Parsing/Mock/MockLexer.h" #include "Parsing/Mock/MockPackValueSupplier.h" +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> + namespace test::parsing::header::sequence::sequence_namespace { TEST_CASE("SequenceNamespace: Ensure can parse simple namespace directive", "[parsing][parsingstream]") { const TokenPos pos; - const auto lexer = std::make_unique<MockLexer<HeaderParserValue>>(MockLexer<HeaderParserValue>( - { - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("test_namespace")), - HeaderParserValue::Character(pos, '{') - }, HeaderParserValue::EndOfFile(pos))); + const auto lexer = + std::make_unique<MockLexer<HeaderParserValue>>(MockLexer<HeaderParserValue>({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("test_namespace")), + HeaderParserValue::Character(pos, '{')}, + HeaderParserValue::EndOfFile(pos))); const auto packValueSupplier = std::make_unique<MockPackValueSupplier>(); const auto sequence = std::make_unique<SequenceNamespace>(); @@ -26,4 +25,4 @@ namespace test::parsing::header::sequence::sequence_namespace REQUIRE(result); } -} +} // namespace test::parsing::header::sequence::sequence_namespace diff --git a/test/ZoneCodeGeneratorLibTests/Parsing/Matcher/MatcherTests.cpp b/test/ZoneCodeGeneratorLibTests/Parsing/Matcher/MatcherTests.cpp index d04e23f56..e4abf4ff4 100644 --- a/test/ZoneCodeGeneratorLibTests/Parsing/Matcher/MatcherTests.cpp +++ b/test/ZoneCodeGeneratorLibTests/Parsing/Matcher/MatcherTests.cpp @@ -1,15 +1,14 @@ -#include <catch2/catch_test_macros.hpp> -#include <catch2/generators/catch_generators.hpp> - -#include <algorithm> -#include <sstream> - -#include "Utils/ClassUtils.h" #include "Parsing/Header/Impl/HeaderParserValue.h" #include "Parsing/Header/Matcher/HeaderMatcherFactory.h" #include "Parsing/Impl/DefinesStreamProxy.h" #include "Parsing/Mock/MockLexer.h" #include "Parsing/Mock/MockSequence.h" +#include "Utils/ClassUtils.h" + +#include <algorithm> +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> +#include <sstream> namespace test::parsing::matcher { @@ -80,18 +79,12 @@ namespace test::parsing::matcher { MatchersTestsHelper test; const TokenPos pos; - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("test_namespace")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos) - }); + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("test_namespace")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos)}); const auto create = test.Factory(); - test.Matchers({ - create.Type(HeaderParserValueType::NAMESPACE), - create.Identifier(), - create.Char('{') - }); + test.Matchers({create.Type(HeaderParserValueType::NAMESPACE), create.Identifier(), create.Char('{')}); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 3); @@ -101,18 +94,12 @@ namespace test::parsing::matcher { MatchersTestsHelper test; const TokenPos pos; - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("test_namespace")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos) - }); + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("test_namespace")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos)}); const auto create = test.Factory(); - test.Matchers({ - create.Type(HeaderParserValueType::NAMESPACE), - create.Identifier(), - create.Char('+') - }); + test.Matchers({create.Type(HeaderParserValueType::NAMESPACE), create.Identifier(), create.Char('+')}); REQUIRE(!test.PerformTest()); } @@ -122,20 +109,17 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; auto callbackCalled = false; - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("test_namespace")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos) - }); + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("test_namespace")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos)}); const auto create = test.Factory(); - test.Matchers({ - create.Type(HeaderParserValueType::NAMESPACE) - }); - test.MatchCallback([&callbackCalled](sequence_result_t& result) - { - callbackCalled = true; - }); + test.Matchers({create.Type(HeaderParserValueType::NAMESPACE)}); + test.MatchCallback( + [&callbackCalled](sequence_result_t& result) + { + callbackCalled = true; + }); REQUIRE(test.PerformTest()); REQUIRE(callbackCalled); @@ -146,18 +130,14 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; auto callbackCalled = false; - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Invalid(pos) - }); + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), HeaderParserValue::Invalid(pos)}); const auto create = test.Factory(); - test.Matchers({ - create.Type(HeaderParserValueType::NAMESPACE) - }); - test.MatchCallback([&callbackCalled](sequence_result_t& result) - { - callbackCalled = true; - }); + test.Matchers({create.Type(HeaderParserValueType::NAMESPACE)}); + test.MatchCallback( + [&callbackCalled](sequence_result_t& result) + { + callbackCalled = true; + }); REQUIRE(!test.PerformTest()); REQUIRE(!callbackCalled); @@ -171,37 +151,33 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({ - create.Or({ - create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), - }) - }); - - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("test_namespace")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos) - }); - test.MatchCallback([](sequence_result_t& result) - { - REQUIRE(result.NextTag() == TAG_NAMESPACE); - }); + test.Matchers({create.Or({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + })}); + + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("test_namespace")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos)}); + test.MatchCallback( + [](sequence_result_t& result) + { + REQUIRE(result.NextTag() == TAG_NAMESPACE); + }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 1); - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Identifier(pos, new std::string("test_struct")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos) - }); - test.MatchCallback([](sequence_result_t& result) - { - REQUIRE(result.NextTag() == TAG_STRUCT); - }); + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Identifier(pos, new std::string("test_struct")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos)}); + test.MatchCallback( + [](sequence_result_t& result) + { + REQUIRE(result.NextTag() == TAG_STRUCT); + }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 1); @@ -215,23 +191,20 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({ - create.Or({ - create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), - }) - }); - - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), - HeaderParserValue::Identifier(pos, new std::string("test_namespace")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos) - }); - test.MatchCallback([](sequence_result_t& result) - { - FAIL(); - }); + test.Matchers({create.Or({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + })}); + + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), + HeaderParserValue::Identifier(pos, new std::string("test_namespace")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos)}); + test.MatchCallback( + [](sequence_result_t& result) + { + FAIL(); + }); REQUIRE(!test.PerformTest()); } @@ -244,25 +217,22 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({ - create.Loop(create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE)), - create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT) - }); - - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Invalid(pos) - }); - test.MatchCallback([](sequence_result_t& result) - { - REQUIRE(result.NextTag() == TAG_NAMESPACE); - REQUIRE(result.NextTag() == TAG_NAMESPACE); - REQUIRE(result.NextTag() == TAG_NAMESPACE); - REQUIRE(result.NextTag() == TAG_STRUCT); - }); + test.Matchers( + {create.Loop(create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE)), create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)}); + + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Invalid(pos)}); + test.MatchCallback( + [](sequence_result_t& result) + { + REQUIRE(result.NextTag() == TAG_NAMESPACE); + REQUIRE(result.NextTag() == TAG_NAMESPACE); + REQUIRE(result.NextTag() == TAG_NAMESPACE); + REQUIRE(result.NextTag() == TAG_STRUCT); + }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 4); @@ -276,15 +246,10 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({ - create.Loop(create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE)), - create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT) - }); + test.Matchers( + {create.Loop(create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE)), create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)}); - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Invalid(pos) - }); + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), HeaderParserValue::Invalid(pos)}); REQUIRE(!test.PerformTest()); } @@ -297,15 +262,10 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({ - create.OptionalLoop(create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE)), - create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT) - }); + test.Matchers({create.OptionalLoop(create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE)), + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)}); - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Invalid(pos) - }); + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), HeaderParserValue::Invalid(pos)}); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 1); @@ -320,17 +280,13 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({ - create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Optional(create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)), - create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM) - }); + test.Matchers({create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Optional(create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)), + create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM)}); - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), - HeaderParserValue::Invalid(pos) - }); + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), + HeaderParserValue::Invalid(pos)}); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 2); @@ -345,18 +301,14 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({ - create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Optional(create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)), - create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM) - }); + test.Matchers({create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Optional(create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)), + create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM)}); - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), - HeaderParserValue::Invalid(pos) - }); + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), + HeaderParserValue::Invalid(pos)}); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 3); @@ -371,19 +323,15 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({ - create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Optional(create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)), - create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM) - }); - - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), - HeaderParserValue::Invalid(pos) - }); + test.Matchers({create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Optional(create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)), + create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM)}); + + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), + HeaderParserValue::Invalid(pos)}); REQUIRE(!test.PerformTest()); } @@ -398,39 +346,31 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({ - create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Loop(create.Or({ - create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), - create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF) - })), - create.Or({ - create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF), - create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM) - }) - }); - - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::TYPEDEF), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::TYPEDEF), - HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), - HeaderParserValue::Invalid(pos) - }); - - test.MatchCallback([](sequence_result_t& result) - { - REQUIRE(result.NextTag() == TAG_NAMESPACE); - REQUIRE(result.NextTag() == TAG_STRUCT); - REQUIRE(result.NextTag() == TAG_STRUCT); - REQUIRE(result.NextTag() == TAG_TYPEDEF); - REQUIRE(result.NextTag() == TAG_STRUCT); - REQUIRE(result.NextTag() == TAG_TYPEDEF); - REQUIRE(result.NextTag() == TAG_ENUM); - }); + test.Matchers( + {create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Loop(create.Or({create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF)})), + create.Or({create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF), create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM)})}); + + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::TYPEDEF), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::TYPEDEF), + HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), + HeaderParserValue::Invalid(pos)}); + + test.MatchCallback( + [](sequence_result_t& result) + { + REQUIRE(result.NextTag() == TAG_NAMESPACE); + REQUIRE(result.NextTag() == TAG_STRUCT); + REQUIRE(result.NextTag() == TAG_STRUCT); + REQUIRE(result.NextTag() == TAG_TYPEDEF); + REQUIRE(result.NextTag() == TAG_STRUCT); + REQUIRE(result.NextTag() == TAG_TYPEDEF); + REQUIRE(result.NextTag() == TAG_ENUM); + }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 7); @@ -446,30 +386,22 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers( + test.Matchers({create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), create.Label(LABEL_TEST)}); + test.LabeledMatchers({create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)}, + LABEL_TEST); + + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Invalid(pos)}); + + test.MatchCallback( + [](sequence_result_t& result) { - create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Label(LABEL_TEST) + REQUIRE(result.NextTag() == TAG_NAMESPACE); + REQUIRE(result.NextTag() == TAG_STRUCT); + REQUIRE(result.NextTag() == TAG_STRUCT); }); - test.LabeledMatchers( - { - create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), - create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT) - }, LABEL_TEST); - - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Invalid(pos) - }); - - test.MatchCallback([](sequence_result_t& result) - { - REQUIRE(result.NextTag() == TAG_NAMESPACE); - REQUIRE(result.NextTag() == TAG_STRUCT); - REQUIRE(result.NextTag() == TAG_STRUCT); - }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 3); @@ -485,32 +417,23 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers( + test.Matchers({create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), create.Label(LABEL_TEST)}); + test.LabeledMatchers({create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), create.Optional(create.Label(LABEL_TEST))}, LABEL_TEST); + + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Invalid(pos)}); + + test.MatchCallback( + [](sequence_result_t& result) { - create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Label(LABEL_TEST) + REQUIRE(result.NextTag() == TAG_NAMESPACE); + REQUIRE(result.NextTag() == TAG_STRUCT); + REQUIRE(result.NextTag() == TAG_STRUCT); + REQUIRE(result.NextTag() == TAG_STRUCT); }); - test.LabeledMatchers( - { - create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), - create.Optional(create.Label(LABEL_TEST)) - }, LABEL_TEST); - - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Invalid(pos) - }); - - test.MatchCallback([](sequence_result_t& result) - { - REQUIRE(result.NextTag() == TAG_NAMESPACE); - REQUIRE(result.NextTag() == TAG_STRUCT); - REQUIRE(result.NextTag() == TAG_STRUCT); - REQUIRE(result.NextTag() == TAG_STRUCT); - }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 4); @@ -525,33 +448,29 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({ - create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Identifier().Capture(CAPTURE_NAMESPACE_NAME), - create.Char('{') - }); - - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("hello_world")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos) - }); - - test.MatchCallback([](sequence_result_t& result) - { - REQUIRE(result.NextTag() == TAG_NAMESPACE); - REQUIRE(result.NextTag() == matcher_t::NO_ID); + test.Matchers( + {create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), create.Identifier().Capture(CAPTURE_NAMESPACE_NAME), create.Char('{')}); + + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("hello_world")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos)}); - REQUIRE(result.HasNextCapture(CAPTURE_NAMESPACE_NAME)); + test.MatchCallback( + [](sequence_result_t& result) { - const auto& capture = result.NextCapture(CAPTURE_NAMESPACE_NAME); - REQUIRE(capture.m_type == HeaderParserValueType::IDENTIFIER); - REQUIRE(capture.IdentifierValue() == "hello_world"); - } + REQUIRE(result.NextTag() == TAG_NAMESPACE); + REQUIRE(result.NextTag() == matcher_t::NO_ID); - REQUIRE(!result.HasNextCapture(CAPTURE_NAMESPACE_NAME)); - }); + REQUIRE(result.HasNextCapture(CAPTURE_NAMESPACE_NAME)); + { + const auto& capture = result.NextCapture(CAPTURE_NAMESPACE_NAME); + REQUIRE(capture.m_type == HeaderParserValueType::IDENTIFIER); + REQUIRE(capture.IdentifierValue() == "hello_world"); + } + + REQUIRE(!result.HasNextCapture(CAPTURE_NAMESPACE_NAME)); + }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 3); @@ -568,64 +487,58 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({ - create.Or({ - create.And({ - create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Identifier().Capture(CAPTURE_NAMESPACE_NAME), - }), - create.And({ - create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), - create.Identifier().Capture(CAPTURE_STRUCT_NAME), - }) - }), - create.Char('{') - }); - - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("hello_world")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos) - }); - test.MatchCallback([](sequence_result_t& result) - { - REQUIRE(result.NextTag() == TAG_NAMESPACE); - REQUIRE(result.NextTag() == matcher_t::NO_ID); - - REQUIRE(result.HasNextCapture(CAPTURE_NAMESPACE_NAME)); + test.Matchers({create.Or({create.And({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Identifier().Capture(CAPTURE_NAMESPACE_NAME), + }), + create.And({ + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + create.Identifier().Capture(CAPTURE_STRUCT_NAME), + })}), + create.Char('{')}); + + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("hello_world")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos)}); + test.MatchCallback( + [](sequence_result_t& result) { - const auto& capture = result.NextCapture(CAPTURE_NAMESPACE_NAME); - REQUIRE(capture.m_type == HeaderParserValueType::IDENTIFIER); - REQUIRE(capture.IdentifierValue() == "hello_world"); - } + REQUIRE(result.NextTag() == TAG_NAMESPACE); + REQUIRE(result.NextTag() == matcher_t::NO_ID); - REQUIRE(!result.HasNextCapture(CAPTURE_NAMESPACE_NAME)); - }); + REQUIRE(result.HasNextCapture(CAPTURE_NAMESPACE_NAME)); + { + const auto& capture = result.NextCapture(CAPTURE_NAMESPACE_NAME); + REQUIRE(capture.m_type == HeaderParserValueType::IDENTIFIER); + REQUIRE(capture.IdentifierValue() == "hello_world"); + } + + REQUIRE(!result.HasNextCapture(CAPTURE_NAMESPACE_NAME)); + }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 3); - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Identifier(pos, new std::string("bye_struct")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos) - }); - test.MatchCallback([](sequence_result_t& result) - { - REQUIRE(result.NextTag() == TAG_STRUCT); - REQUIRE(result.NextTag() == matcher_t::NO_ID); - - REQUIRE(result.HasNextCapture(CAPTURE_STRUCT_NAME)); + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Identifier(pos, new std::string("bye_struct")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos)}); + test.MatchCallback( + [](sequence_result_t& result) { - const auto& capture = result.NextCapture(CAPTURE_STRUCT_NAME); - REQUIRE(capture.m_type == HeaderParserValueType::IDENTIFIER); - REQUIRE(capture.IdentifierValue() == "bye_struct"); - } + REQUIRE(result.NextTag() == TAG_STRUCT); + REQUIRE(result.NextTag() == matcher_t::NO_ID); + + REQUIRE(result.HasNextCapture(CAPTURE_STRUCT_NAME)); + { + const auto& capture = result.NextCapture(CAPTURE_STRUCT_NAME); + REQUIRE(capture.m_type == HeaderParserValueType::IDENTIFIER); + REQUIRE(capture.IdentifierValue() == "bye_struct"); + } - REQUIRE(!result.HasNextCapture(CAPTURE_STRUCT_NAME)); - }); + REQUIRE(!result.HasNextCapture(CAPTURE_STRUCT_NAME)); + }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 3); @@ -640,49 +553,46 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({ - create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Loop(create.Identifier().Capture(CAPTURE_NAMESPACE_NAME)), - create.Char('{') - }); - - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("hello_world")), - HeaderParserValue::Identifier(pos, new std::string("hello_universe")), - HeaderParserValue::Identifier(pos, new std::string("hello_everyone")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos) - }); - - test.MatchCallback([](sequence_result_t& result) - { - REQUIRE(result.NextTag() == TAG_NAMESPACE); - REQUIRE(result.NextTag() == matcher_t::NO_ID); - - REQUIRE(result.HasNextCapture(CAPTURE_NAMESPACE_NAME)); + test.Matchers({create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Loop(create.Identifier().Capture(CAPTURE_NAMESPACE_NAME)), + create.Char('{')}); + + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("hello_world")), + HeaderParserValue::Identifier(pos, new std::string("hello_universe")), + HeaderParserValue::Identifier(pos, new std::string("hello_everyone")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos)}); + + test.MatchCallback( + [](sequence_result_t& result) { - const auto& capture = result.NextCapture(CAPTURE_NAMESPACE_NAME); - REQUIRE(capture.m_type == HeaderParserValueType::IDENTIFIER); - REQUIRE(capture.IdentifierValue() == "hello_world"); - } + REQUIRE(result.NextTag() == TAG_NAMESPACE); + REQUIRE(result.NextTag() == matcher_t::NO_ID); - REQUIRE(result.HasNextCapture(CAPTURE_NAMESPACE_NAME)); - { - const auto& capture = result.NextCapture(CAPTURE_NAMESPACE_NAME); - REQUIRE(capture.m_type == HeaderParserValueType::IDENTIFIER); - REQUIRE(capture.IdentifierValue() == "hello_universe"); - } + REQUIRE(result.HasNextCapture(CAPTURE_NAMESPACE_NAME)); + { + const auto& capture = result.NextCapture(CAPTURE_NAMESPACE_NAME); + REQUIRE(capture.m_type == HeaderParserValueType::IDENTIFIER); + REQUIRE(capture.IdentifierValue() == "hello_world"); + } - REQUIRE(result.HasNextCapture(CAPTURE_NAMESPACE_NAME)); - { - const auto& capture = result.NextCapture(CAPTURE_NAMESPACE_NAME); - REQUIRE(capture.m_type == HeaderParserValueType::IDENTIFIER); - REQUIRE(capture.IdentifierValue() == "hello_everyone"); - } + REQUIRE(result.HasNextCapture(CAPTURE_NAMESPACE_NAME)); + { + const auto& capture = result.NextCapture(CAPTURE_NAMESPACE_NAME); + REQUIRE(capture.m_type == HeaderParserValueType::IDENTIFIER); + REQUIRE(capture.IdentifierValue() == "hello_universe"); + } - REQUIRE(!result.HasNextCapture(CAPTURE_NAMESPACE_NAME)); - }); + REQUIRE(result.HasNextCapture(CAPTURE_NAMESPACE_NAME)); + { + const auto& capture = result.NextCapture(CAPTURE_NAMESPACE_NAME); + REQUIRE(capture.m_type == HeaderParserValueType::IDENTIFIER); + REQUIRE(capture.IdentifierValue() == "hello_everyone"); + } + + REQUIRE(!result.HasNextCapture(CAPTURE_NAMESPACE_NAME)); + }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 5); @@ -697,38 +607,32 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({ - create.And({ - create.Type(HeaderParserValueType::NAMESPACE), - create.Identifier() - }).Tag(TAG_AND_GROUP).Capture(CAPTURE_AND_GROUP), - create.Char('{') - }); - - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("hello_world")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos) - }); - - test.MatchCallback([](sequence_result_t& result) - { - REQUIRE(result.NextTag() == TAG_AND_GROUP); - REQUIRE(result.NextTag() == matcher_t::NO_ID); + test.Matchers( + {create.And({create.Type(HeaderParserValueType::NAMESPACE), create.Identifier()}).Tag(TAG_AND_GROUP).Capture(CAPTURE_AND_GROUP), create.Char('{')}); - REQUIRE(result.HasNextCapture(CAPTURE_AND_GROUP)); - REQUIRE(result.NextCapture(CAPTURE_AND_GROUP).m_type == HeaderParserValueType::NAMESPACE); + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("hello_world")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos)}); - REQUIRE(result.HasNextCapture(CAPTURE_AND_GROUP)); + test.MatchCallback( + [](sequence_result_t& result) { - const auto& capture = result.NextCapture(CAPTURE_AND_GROUP); - REQUIRE(capture.m_type == HeaderParserValueType::IDENTIFIER); - REQUIRE(capture.IdentifierValue() == "hello_world"); - } + REQUIRE(result.NextTag() == TAG_AND_GROUP); + REQUIRE(result.NextTag() == matcher_t::NO_ID); - REQUIRE(!result.HasNextCapture(CAPTURE_AND_GROUP)); - }); + REQUIRE(result.HasNextCapture(CAPTURE_AND_GROUP)); + REQUIRE(result.NextCapture(CAPTURE_AND_GROUP).m_type == HeaderParserValueType::NAMESPACE); + + REQUIRE(result.HasNextCapture(CAPTURE_AND_GROUP)); + { + const auto& capture = result.NextCapture(CAPTURE_AND_GROUP); + REQUIRE(capture.m_type == HeaderParserValueType::IDENTIFIER); + REQUIRE(capture.IdentifierValue() == "hello_world"); + } + + REQUIRE(!result.HasNextCapture(CAPTURE_AND_GROUP)); + }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 3); @@ -743,50 +647,45 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({ - create.Loop(create.And({ - create.Type(HeaderParserValueType::NAMESPACE), - create.Identifier() - })).Tag(TAG_LOOP_GROUP).Capture(CAPTURE_LOOP_GROUP), - create.Char('{') - }); - - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("hello_world")), - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("hello_universe")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos) - }); - - test.MatchCallback([](sequence_result_t& result) - { - REQUIRE(result.NextTag() == TAG_LOOP_GROUP); - REQUIRE(result.NextTag() == matcher_t::NO_ID); + test.Matchers( + {create.Loop(create.And({create.Type(HeaderParserValueType::NAMESPACE), create.Identifier()})).Tag(TAG_LOOP_GROUP).Capture(CAPTURE_LOOP_GROUP), + create.Char('{')}); + + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("hello_world")), + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("hello_universe")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos)}); + + test.MatchCallback( + [](sequence_result_t& result) + { + REQUIRE(result.NextTag() == TAG_LOOP_GROUP); + REQUIRE(result.NextTag() == matcher_t::NO_ID); - REQUIRE(result.HasNextCapture(CAPTURE_LOOP_GROUP)); - REQUIRE(result.NextCapture(CAPTURE_LOOP_GROUP).m_type == HeaderParserValueType::NAMESPACE); + REQUIRE(result.HasNextCapture(CAPTURE_LOOP_GROUP)); + REQUIRE(result.NextCapture(CAPTURE_LOOP_GROUP).m_type == HeaderParserValueType::NAMESPACE); - REQUIRE(result.HasNextCapture(CAPTURE_LOOP_GROUP)); - { - const auto& capture = result.NextCapture(CAPTURE_LOOP_GROUP); - REQUIRE(capture.m_type == HeaderParserValueType::IDENTIFIER); - REQUIRE(capture.IdentifierValue() == "hello_world"); - } + REQUIRE(result.HasNextCapture(CAPTURE_LOOP_GROUP)); + { + const auto& capture = result.NextCapture(CAPTURE_LOOP_GROUP); + REQUIRE(capture.m_type == HeaderParserValueType::IDENTIFIER); + REQUIRE(capture.IdentifierValue() == "hello_world"); + } - REQUIRE(result.HasNextCapture(CAPTURE_LOOP_GROUP)); - REQUIRE(result.NextCapture(CAPTURE_LOOP_GROUP).m_type == HeaderParserValueType::NAMESPACE); + REQUIRE(result.HasNextCapture(CAPTURE_LOOP_GROUP)); + REQUIRE(result.NextCapture(CAPTURE_LOOP_GROUP).m_type == HeaderParserValueType::NAMESPACE); - REQUIRE(result.HasNextCapture(CAPTURE_LOOP_GROUP)); - { - const auto& capture = result.NextCapture(CAPTURE_LOOP_GROUP); - REQUIRE(capture.m_type == HeaderParserValueType::IDENTIFIER); - REQUIRE(capture.IdentifierValue() == "hello_universe"); - } + REQUIRE(result.HasNextCapture(CAPTURE_LOOP_GROUP)); + { + const auto& capture = result.NextCapture(CAPTURE_LOOP_GROUP); + REQUIRE(capture.m_type == HeaderParserValueType::IDENTIFIER); + REQUIRE(capture.IdentifierValue() == "hello_universe"); + } - REQUIRE(!result.HasNextCapture(CAPTURE_LOOP_GROUP)); - }); + REQUIRE(!result.HasNextCapture(CAPTURE_LOOP_GROUP)); + }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 5); @@ -801,56 +700,43 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers( - { - create.Type(HeaderParserValueType::STRUCT), - create.Label(LABEL_TYPENAME).Capture(CAPTURE_TYPENAME), - create.Char('{') - }); - test.LabeledMatchers( + test.Matchers({create.Type(HeaderParserValueType::STRUCT), create.Label(LABEL_TYPENAME).Capture(CAPTURE_TYPENAME), create.Char('{')}); + test.LabeledMatchers({create.And({create.Identifier(), create.OptionalLoop(create.And({create.Char(':'), create.Char(':'), create.Identifier()}))}) + .Transform( + [](HeaderMatcherFactory::token_list_t& values) + { + std::ostringstream str; + str << values[0].get().IdentifierValue(); + + for (auto i = 3u; i < values.size(); i += 3) + str << "::" << values[i].get().IdentifierValue(); + + return HeaderParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); + })}, + LABEL_TYPENAME); + + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Identifier(pos, new std::string("hello")), + HeaderParserValue::Character(pos, ':'), + HeaderParserValue::Character(pos, ':'), + HeaderParserValue::Identifier(pos, new std::string("world")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos)}); + + test.MatchCallback( + [](sequence_result_t& result) { - create.And({ - create.Identifier(), - create.OptionalLoop(create.And({ - create.Char(':'), - create.Char(':'), - create.Identifier() - })) - }).Transform([](HeaderMatcherFactory::token_list_t& values) - { - std::ostringstream str; - str << values[0].get().IdentifierValue(); - - for (auto i = 3u; i < values.size(); i += 3) - str << "::" << values[i].get().IdentifierValue(); - - return HeaderParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); - }) - }, LABEL_TYPENAME); - - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Identifier(pos, new std::string("hello")), - HeaderParserValue::Character(pos, ':'), - HeaderParserValue::Character(pos, ':'), - HeaderParserValue::Identifier(pos, new std::string("world")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos) - }); - - test.MatchCallback([](sequence_result_t& result) - { - REQUIRE(result.NextTag() == matcher_t::NO_ID); + REQUIRE(result.NextTag() == matcher_t::NO_ID); - REQUIRE(result.HasNextCapture(CAPTURE_TYPENAME)); - { - const auto& capture = result.NextCapture(CAPTURE_TYPENAME); - REQUIRE(capture.m_type == HeaderParserValueType::TYPE_NAME); - REQUIRE(capture.TypeNameValue() == "hello::world"); - } + REQUIRE(result.HasNextCapture(CAPTURE_TYPENAME)); + { + const auto& capture = result.NextCapture(CAPTURE_TYPENAME); + REQUIRE(capture.m_type == HeaderParserValueType::TYPE_NAME); + REQUIRE(capture.TypeNameValue() == "hello::world"); + } - REQUIRE(!result.HasNextCapture(CAPTURE_TYPENAME)); - }); + REQUIRE(!result.HasNextCapture(CAPTURE_TYPENAME)); + }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 6); @@ -866,65 +752,54 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers( - { - create.Type(HeaderParserValueType::STRUCT), - create.Label(LABEL_TYPENAME).Capture(CAPTURE_TYPENAME), - create.Char('{') - }); - test.LabeledMatchers( + test.Matchers({create.Type(HeaderParserValueType::STRUCT), create.Label(LABEL_TYPENAME).Capture(CAPTURE_TYPENAME), create.Char('{')}); + test.LabeledMatchers({create + .And({create.Identifier().Capture(CAPTURE_FIRST_TYPENAME_IDENTIFIER), + create.OptionalLoop(create.And({create.Char(':'), create.Char(':'), create.Identifier()}))}) + .Transform( + [](HeaderMatcherFactory::token_list_t& values) + { + std::ostringstream str; + str << values[0].get().IdentifierValue(); + + for (auto i = 3u; i < values.size(); i += 3) + str << "::" << values[i].get().IdentifierValue(); + + return HeaderParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); + })}, + LABEL_TYPENAME); + + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Identifier(pos, new std::string("hello")), + HeaderParserValue::Character(pos, ':'), + HeaderParserValue::Character(pos, ':'), + HeaderParserValue::Identifier(pos, new std::string("world")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos)}); + + test.MatchCallback( + [](sequence_result_t& result) { - create.And({ - create.Identifier().Capture(CAPTURE_FIRST_TYPENAME_IDENTIFIER), - create.OptionalLoop(create.And({ - create.Char(':'), - create.Char(':'), - create.Identifier() - })) - }).Transform([](HeaderMatcherFactory::token_list_t& values) - { - std::ostringstream str; - str << values[0].get().IdentifierValue(); - - for (auto i = 3u; i < values.size(); i += 3) - str << "::" << values[i].get().IdentifierValue(); - - return HeaderParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); - }) - }, LABEL_TYPENAME); - - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Identifier(pos, new std::string("hello")), - HeaderParserValue::Character(pos, ':'), - HeaderParserValue::Character(pos, ':'), - HeaderParserValue::Identifier(pos, new std::string("world")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos) - }); - - test.MatchCallback([](sequence_result_t& result) - { - REQUIRE(result.NextTag() == matcher_t::NO_ID); + REQUIRE(result.NextTag() == matcher_t::NO_ID); - REQUIRE(result.HasNextCapture(CAPTURE_TYPENAME)); - { - const auto& capture = result.NextCapture(CAPTURE_TYPENAME); - REQUIRE(capture.m_type == HeaderParserValueType::TYPE_NAME); - REQUIRE(capture.TypeNameValue() == "hello::world"); - } + REQUIRE(result.HasNextCapture(CAPTURE_TYPENAME)); + { + const auto& capture = result.NextCapture(CAPTURE_TYPENAME); + REQUIRE(capture.m_type == HeaderParserValueType::TYPE_NAME); + REQUIRE(capture.TypeNameValue() == "hello::world"); + } - REQUIRE(!result.HasNextCapture(CAPTURE_TYPENAME)); + REQUIRE(!result.HasNextCapture(CAPTURE_TYPENAME)); - REQUIRE(result.HasNextCapture(CAPTURE_FIRST_TYPENAME_IDENTIFIER)); - { - const auto& capture = result.NextCapture(CAPTURE_FIRST_TYPENAME_IDENTIFIER); - REQUIRE(capture.m_type == HeaderParserValueType::IDENTIFIER); - REQUIRE(capture.IdentifierValue() == "hello"); - } + REQUIRE(result.HasNextCapture(CAPTURE_FIRST_TYPENAME_IDENTIFIER)); + { + const auto& capture = result.NextCapture(CAPTURE_FIRST_TYPENAME_IDENTIFIER); + REQUIRE(capture.m_type == HeaderParserValueType::IDENTIFIER); + REQUIRE(capture.IdentifierValue() == "hello"); + } - REQUIRE(!result.HasNextCapture(CAPTURE_FIRST_TYPENAME_IDENTIFIER)); - }); + REQUIRE(!result.HasNextCapture(CAPTURE_FIRST_TYPENAME_IDENTIFIER)); + }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 6); @@ -937,38 +812,37 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers( + test.Matchers({create.Type(HeaderParserValueType::STRUCT), + create.Identifier() + .Capture(CAPTURE_NAME) + .Transform( + [](HeaderMatcherFactory::token_list_t& tokens) + { + auto str = tokens[0].get().IdentifierValue(); + std::transform(str.begin(), str.end(), str.begin(), toupper); + return HeaderParserValue::Identifier(tokens[0].get().GetPos(), new std::string(std::move(str))); + }), + create.Char('{')}); + + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Identifier(pos, new std::string("hello_world")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos)}); + + test.MatchCallback( + [](sequence_result_t& result) { - create.Type(HeaderParserValueType::STRUCT), - create.Identifier().Capture(CAPTURE_NAME).Transform([](HeaderMatcherFactory::token_list_t& tokens) - { - auto str = tokens[0].get().IdentifierValue(); - std::transform(str.begin(), str.end(), str.begin(), toupper); - return HeaderParserValue::Identifier(tokens[0].get().GetPos(), new std::string(std::move(str))); - }), - create.Char('{') - }); + REQUIRE(result.NextTag() == matcher_t::NO_ID); - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Identifier(pos, new std::string("hello_world")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos) - }); - - test.MatchCallback([](sequence_result_t& result) - { - REQUIRE(result.NextTag() == matcher_t::NO_ID); - - REQUIRE(result.HasNextCapture(CAPTURE_NAME)); - { - const auto& capture = result.NextCapture(CAPTURE_NAME); - REQUIRE(capture.m_type == HeaderParserValueType::IDENTIFIER); - REQUIRE(capture.IdentifierValue() == "HELLO_WORLD"); - } + REQUIRE(result.HasNextCapture(CAPTURE_NAME)); + { + const auto& capture = result.NextCapture(CAPTURE_NAME); + REQUIRE(capture.m_type == HeaderParserValueType::IDENTIFIER); + REQUIRE(capture.IdentifierValue() == "HELLO_WORLD"); + } - REQUIRE(!result.HasNextCapture(CAPTURE_NAME)); - }); + REQUIRE(!result.HasNextCapture(CAPTURE_NAME)); + }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 3); @@ -978,18 +852,12 @@ namespace test::parsing::matcher { MatchersTestsHelper test; const TokenPos pos; - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("test_namespace")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos) - }); + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("test_namespace")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos)}); const auto create = test.Factory(); - test.Matchers({ - create.Type(HeaderParserValueType::NAMESPACE), - create.Identifier(), - create.Char('{').NoConsume() - }); + test.Matchers({create.Type(HeaderParserValueType::NAMESPACE), create.Identifier(), create.Char('{').NoConsume()}); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 2); @@ -1001,28 +869,24 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; - test.Tokens({ - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("test_namespace")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos) - }); + test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("test_namespace")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos)}); const auto create = test.Factory(); - test.Matchers({ - create.Type(HeaderParserValueType::NAMESPACE), - create.Identifier().NoConsume().Capture(CAPTURE_NAME) - }); - test.MatchCallback([](sequence_result_t& result) - { - REQUIRE(result.HasNextCapture(CAPTURE_NAME)); + test.Matchers({create.Type(HeaderParserValueType::NAMESPACE), create.Identifier().NoConsume().Capture(CAPTURE_NAME)}); + test.MatchCallback( + [](sequence_result_t& result) { - const auto& capture = result.NextCapture(CAPTURE_NAME); - REQUIRE(capture.m_type == HeaderParserValueType::IDENTIFIER); - REQUIRE(capture.IdentifierValue() == "test_namespace"); - } - }); + REQUIRE(result.HasNextCapture(CAPTURE_NAME)); + { + const auto& capture = result.NextCapture(CAPTURE_NAME); + REQUIRE(capture.m_type == HeaderParserValueType::IDENTIFIER); + REQUIRE(capture.IdentifierValue() == "test_namespace"); + } + }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 1); } -} +} // namespace test::parsing::matcher From da18710bd0ba2d79d3964cc77fc981a09fdbad36 Mon Sep 17 00:00:00 2001 From: Jan <jan@laupetin.net> Date: Sun, 19 Nov 2023 15:39:37 +0100 Subject: [PATCH 08/13] Use clang 17 in formatting pipeline --- .github/workflows/check-formatting.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-formatting.yaml b/.github/workflows/check-formatting.yaml index 7a1e8f061..ac7198a8e 100644 --- a/.github/workflows/check-formatting.yaml +++ b/.github/workflows/check-formatting.yaml @@ -12,8 +12,13 @@ jobs: with: submodules: recursive + - name: Install LLVM and Clang + uses: KyleMayes/install-llvm-action@v1 + with: + version: "17.0" + - name: Test formatting for all files working-directory: ${{ github.workspace }} run: | - export CLANG_FORMAT_BIN='clang-format-15' + export CLANG_FORMAT_BIN="${LLVM_PATH}/bin/clang-format" ./scripts/check-format.sh \ No newline at end of file From 8c4d311527a4c851da2ccd16ee3848383bba64de Mon Sep 17 00:00:00 2001 From: Jan <jan@laupetin.net> Date: Sun, 19 Nov 2023 15:56:59 +0100 Subject: [PATCH 09/13] Fix formatting of two remaining files --- .../LocalizeFile/LocalizeFileParser.cpp | 20 +++++++++++-------- .../SequenceLocalizeFileReference.cpp | 7 ++++++- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/ObjLoading/Parsing/LocalizeFile/LocalizeFileParser.cpp b/src/ObjLoading/Parsing/LocalizeFile/LocalizeFileParser.cpp index 029a2142b..c2a46338c 100644 --- a/src/ObjLoading/Parsing/LocalizeFile/LocalizeFileParser.cpp +++ b/src/ObjLoading/Parsing/LocalizeFile/LocalizeFileParser.cpp @@ -15,15 +15,19 @@ LocalizeFileParser::LocalizeFileParser(SimpleLexer* lexer, GameLanguage language const std::vector<AbstractParser<SimpleParserValue, LocalizeFileParserState>::sequence_t*>& LocalizeFileParser::GetTestsForState() { - static std::vector<sequence_t*> tests({new SequenceLocalizeFileReference(), - new SequenceLocalizeFileConfig(), - new SequenceLocalizeFileNotes(), - new SequenceLocalizeFileVersion(), - new SequenceLocalizeFileEndMarker(), - new SequenceLocalizeFileLanguageValue(), - new SequenceLocalizeFileConsumeEmptyLines(),}); + static std::vector<sequence_t*> tests({ + new SequenceLocalizeFileReference(), + new SequenceLocalizeFileConfig(), + new SequenceLocalizeFileNotes(), + new SequenceLocalizeFileVersion(), + new SequenceLocalizeFileEndMarker(), + new SequenceLocalizeFileLanguageValue(), + new SequenceLocalizeFileConsumeEmptyLines(), + }); - static std::vector<sequence_t*> noTests({new SequenceLocalizeFileConsumeEmptyLines(),}); + static std::vector<sequence_t*> noTests({ + new SequenceLocalizeFileConsumeEmptyLines(), + }); return !m_state->m_end ? tests : noTests; } diff --git a/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileReference.cpp b/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileReference.cpp index 9767a1bae..10bdc809d 100644 --- a/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileReference.cpp +++ b/src/ObjLoading/Parsing/LocalizeFile/Sequence/SequenceLocalizeFileReference.cpp @@ -8,7 +8,12 @@ SequenceLocalizeFileReference::SequenceLocalizeFileReference() AddMatchers({ create.Keyword("REFERENCE"), - create.Or({create.Identifier(), create.String(),}).Capture(CAPTURE_REFERENCE_NAME), + create + .Or({ + create.Identifier(), + create.String(), + }) + .Capture(CAPTURE_REFERENCE_NAME), create.Type(SimpleParserValueType::NEW_LINE), }); } From 0c4835bc36f5fa520eec247f2ab06c87fb1c286c Mon Sep 17 00:00:00 2001 From: Jan <jan@laupetin.net> Date: Sun, 19 Nov 2023 16:26:36 +0100 Subject: [PATCH 10/13] Fix build due to reordered headers --- src/ObjLoading/Parsing/Menu/Domain/CommonItemDef.h | 1 + src/ZoneCode/Game/IW3/IW3.h | 6 +++++- src/ZoneCode/Game/IW4/IW4.h | 6 +++++- src/ZoneCode/Game/IW5/IW5.h | 6 +++++- src/ZoneCode/Game/T5/T5.h | 6 +++++- src/ZoneCode/Game/T6/T6.h | 6 +++++- src/ZoneCommon/Pool/XAssetInfo.h | 1 + 7 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/ObjLoading/Parsing/Menu/Domain/CommonItemDef.h b/src/ObjLoading/Parsing/Menu/Domain/CommonItemDef.h index 7ec80e306..98a227640 100644 --- a/src/ObjLoading/Parsing/Menu/Domain/CommonItemDef.h +++ b/src/ObjLoading/Parsing/Menu/Domain/CommonItemDef.h @@ -4,6 +4,7 @@ #include "EventHandler/CommonEventHandlerSet.h" #include "Parsing/Simple/Expression/ISimpleExpression.h" +#include <map> #include <string> #include <vector> diff --git a/src/ZoneCode/Game/IW3/IW3.h b/src/ZoneCode/Game/IW3/IW3.h index 8c2054a18..8444b5353 100644 --- a/src/ZoneCode/Game/IW3/IW3.h +++ b/src/ZoneCode/Game/IW3/IW3.h @@ -2,7 +2,11 @@ // Entry point for IW3 code generation -#include "../../../Common/Game/IW3/IW3_Assets.h" +// clang-format off: Order of includes matters here + #include "../Common.h" +#include "../../../Common/Game/IW3/IW3_Assets.h" + +// clang-format on // EOF diff --git a/src/ZoneCode/Game/IW4/IW4.h b/src/ZoneCode/Game/IW4/IW4.h index 368ab5f2f..39b80eea2 100644 --- a/src/ZoneCode/Game/IW4/IW4.h +++ b/src/ZoneCode/Game/IW4/IW4.h @@ -2,7 +2,11 @@ // Entry point for IW4 code generation -#include "../../../Common/Game/IW4/IW4_Assets.h" +// clang-format off: Order of includes matters here + #include "../Common.h" +#include "../../../Common/Game/IW4/IW4_Assets.h" + +// clang-format on // EOF diff --git a/src/ZoneCode/Game/IW5/IW5.h b/src/ZoneCode/Game/IW5/IW5.h index 621ba4d5e..3052fdafb 100644 --- a/src/ZoneCode/Game/IW5/IW5.h +++ b/src/ZoneCode/Game/IW5/IW5.h @@ -2,7 +2,11 @@ // Entry point for IW5 code generation -#include "../../../Common/Game/IW5/IW5_Assets.h" +// clang-format off: Order of includes matters here + #include "../Common.h" +#include "../../../Common/Game/IW5/IW5_Assets.h" + +// clang-format on // EOF diff --git a/src/ZoneCode/Game/T5/T5.h b/src/ZoneCode/Game/T5/T5.h index 7803852c3..7fc65d2cb 100644 --- a/src/ZoneCode/Game/T5/T5.h +++ b/src/ZoneCode/Game/T5/T5.h @@ -2,7 +2,11 @@ // Entry point for T5 code generation -#include "../../../Common/Game/T5/T5_Assets.h" +// clang-format off: Order of includes matters here + #include "../Common.h" +#include "../../../Common/Game/T5/T5_Assets.h" + +// clang-format on // EOF diff --git a/src/ZoneCode/Game/T6/T6.h b/src/ZoneCode/Game/T6/T6.h index 7cbce404e..d71df041b 100644 --- a/src/ZoneCode/Game/T6/T6.h +++ b/src/ZoneCode/Game/T6/T6.h @@ -2,7 +2,11 @@ // Entry point for T6 code generation -#include "../../../Common/Game/T6/T6_Assets.h" +// clang-format off: Order of includes matters here + #include "../Common.h" +#include "../../../Common/Game/T6/T6_Assets.h" + +// clang-format on // EOF diff --git a/src/ZoneCommon/Pool/XAssetInfo.h b/src/ZoneCommon/Pool/XAssetInfo.h index 4b447565c..59aa3e1d0 100644 --- a/src/ZoneCommon/Pool/XAssetInfo.h +++ b/src/ZoneCommon/Pool/XAssetInfo.h @@ -1,5 +1,6 @@ #pragma once #include "Zone/Zone.h" +#include "Zone/ZoneTypes.h" #include <string> #include <vector> From 161a1924c8055f4da9c767964d1f43cecff07f37 Mon Sep 17 00:00:00 2001 From: Jan <jan@laupetin.net> Date: Sun, 19 Nov 2023 16:27:00 +0100 Subject: [PATCH 11/13] Fix debug compilation on MSVC due to libtommath requiring dead code elimination --- thirdparty/libtommath.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/thirdparty/libtommath.lua b/thirdparty/libtommath.lua index dc3189c57..08163de1a 100644 --- a/thirdparty/libtommath.lua +++ b/thirdparty/libtommath.lua @@ -29,6 +29,11 @@ function libtommath:project() location "%{wks.location}/thirdparty/%{prj.name}" kind "StaticLib" language "C" + + filter "configurations:Debug" + -- libtommath requires dead code elimination to work + optimize "On" + filter {} files { path.join(folder, "libtommath/*.h"), From d5f881be045163503916991edda55e5f07e7c743 Mon Sep 17 00:00:00 2001 From: Jan <jan@laupetin.net> Date: Sun, 19 Nov 2023 16:42:13 +0100 Subject: [PATCH 12/13] Fix more missing headers --- src/ObjCommon/Utils/DistinctMapper.h | 1 + src/Utils/Math/Vector.h | 1 + src/ZoneLoading/Loading/IHashProvider.h | 2 ++ 3 files changed, 4 insertions(+) diff --git a/src/ObjCommon/Utils/DistinctMapper.h b/src/ObjCommon/Utils/DistinctMapper.h index 46d616c45..a5173285a 100644 --- a/src/ObjCommon/Utils/DistinctMapper.h +++ b/src/ObjCommon/Utils/DistinctMapper.h @@ -2,6 +2,7 @@ #include "Utils/ClassUtils.h" +#include <cstddef> #include <map> #include <vector> diff --git a/src/Utils/Math/Vector.h b/src/Utils/Math/Vector.h index 3657d33d0..2a188a1df 100644 --- a/src/Utils/Math/Vector.h +++ b/src/Utils/Math/Vector.h @@ -2,6 +2,7 @@ #include "Utils/ClassUtils.h" #include <cassert> +#include <cstddef> template<typename T> class Vector2 { diff --git a/src/ZoneLoading/Loading/IHashProvider.h b/src/ZoneLoading/Loading/IHashProvider.h index 27d8562cd..da76becbb 100644 --- a/src/ZoneLoading/Loading/IHashProvider.h +++ b/src/ZoneLoading/Loading/IHashProvider.h @@ -1,4 +1,6 @@ #pragma once + +#include <cstddef> #include <cstdint> class IHashProvider From c858695f0c74cd35f5fcd124cdae5f408144fd5f Mon Sep 17 00:00:00 2001 From: Clang Format <jan+clang-format@laupetin.net> Date: Sun, 19 Nov 2023 21:59:57 +0100 Subject: [PATCH 13/13] Adjust further code formatting --- src/ObjLoading/ObjLoading.cpp | 8 +- .../Menu/Matcher/MenuExpressionMatchers.cpp | 25 +- .../Menu/Matcher/MenuMatcherFactory.cpp | 80 +- .../EventHandlerSetScopeSequences.cpp | 1790 +++++++++++------ .../Menu/Sequence/FunctionScopeSequences.cpp | 4 +- .../Generic/GenericBoolPropertySequence.cpp | 5 +- .../Generic/GenericColorPropertySequence.cpp | 2 +- .../GenericExpressionPropertySequence.cpp | 26 +- .../GenericFloatingPointPropertySequence.cpp | 5 +- ...ricMenuEventHandlerSetPropertySequence.cpp | 5 +- .../Generic/GenericStringPropertySequence.cpp | 5 +- .../Menu/Sequence/GlobalScopeSequences.cpp | 4 +- .../Menu/Sequence/ItemScopeSequences.cpp | 106 +- .../Menu/Sequence/MenuScopeSequences.cpp | 42 +- .../Menu/Sequence/NoScopeSequences.cpp | 4 +- .../StateMap/Parsing/StateMapParser.cpp | 66 +- .../StructuredDataDefScopeSequences.cpp | 30 +- .../StructuredDataEnumScopeSequences.cpp | 13 +- .../StructuredDataNoScopeSequences.cpp | 6 +- .../StructuredDataStructScopeSequences.cpp | 55 +- .../Sequence/TechniqueNoScopeSequences.cpp | 8 +- .../Sequence/TechniquePassScopeSequences.cpp | 88 +- .../TechniqueShaderScopeSequences.cpp | 77 +- .../Techset/Parsing/TechsetFileParser.cpp | 24 +- .../AssetDumpers/AssetDumperLoadedSound.cpp | 14 +- .../IW3/AssetDumpers/AssetDumperMaterial.cpp | 60 +- .../T6/AssetDumpers/AssetDumperFontIcon.cpp | 209 +- .../T6/AssetDumpers/AssetDumperSndBank.cpp | 12 +- .../Model/XModel/XModelExportWriter.cpp | 8 +- .../ObjContainer/IPak/IPakWriter.cpp | 28 +- src/ObjWriting/ObjWriting.cpp | 8 +- src/ObjWriting/Sound/WavWriter.cpp | 14 +- .../SimpleExpressionBinaryOperation.cpp | 3 +- .../Expression/SimpleExpressionMatchers.cpp | 51 +- .../Simple/SimpleExpressionInterpreter.cpp | 4 +- src/Unlinker/UnlinkerArgs.cpp | 174 +- src/Utils/Math/Matrix.h | 4 +- .../Domain/Evaluation/OperationType.cpp | 38 +- .../Parsing/Commands/Impl/CommandsParser.cpp | 36 +- .../Matcher/CommandsCommonMatchers.cpp | 353 ++-- .../Commands/Sequence/SequenceAction.cpp | 36 +- .../Commands/Sequence/SequenceAllocAlign.cpp | 12 +- .../Sequence/SequenceArchitecture.cpp | 6 +- .../Commands/Sequence/SequenceArrayCount.cpp | 12 +- .../Commands/Sequence/SequenceArraySize.cpp | 12 +- .../Commands/Sequence/SequenceAsset.cpp | 10 +- .../Commands/Sequence/SequenceBlock.cpp | 12 +- .../Commands/Sequence/SequenceCondition.cpp | 18 +- .../Commands/Sequence/SequenceCount.cpp | 16 +- .../Commands/Sequence/SequenceGame.cpp | 6 +- .../Commands/Sequence/SequenceName.cpp | 7 +- .../Commands/Sequence/SequenceReorder.cpp | 20 +- .../Commands/Sequence/SequenceReusable.cpp | 8 +- .../Sequence/SequenceScriptString.cpp | 8 +- .../Commands/Sequence/SequenceSetBlock.cpp | 18 +- .../Commands/Sequence/SequenceString.cpp | 8 +- .../Parsing/Commands/Sequence/SequenceUse.cpp | 6 +- .../Parsing/Header/Block/HeaderBlockEnum.cpp | 5 +- .../Header/Block/HeaderBlockNamespace.cpp | 16 +- .../Parsing/Header/Block/HeaderBlockNone.cpp | 10 +- .../Header/Block/HeaderBlockStruct.cpp | 9 +- .../Parsing/Header/Block/HeaderBlockUnion.cpp | 9 +- .../Header/Matcher/HeaderCommonMatchers.cpp | 138 +- .../Header/Sequence/SequenceCloseBlock.cpp | 9 +- .../Parsing/Header/Sequence/SequenceEnum.cpp | 15 +- .../Header/Sequence/SequenceEnumMember.cpp | 18 +- .../Header/Sequence/SequenceForwardDecl.cpp | 18 +- .../Header/Sequence/SequenceNamespace.cpp | 6 +- .../Header/Sequence/SequenceStruct.cpp | 19 +- .../Header/Sequence/SequenceTypedef.cpp | 54 +- .../Parsing/Header/Sequence/SequenceUnion.cpp | 19 +- .../Header/Sequence/SequenceVariable.cpp | 52 +- src/ZoneCommon/Game/IW4/GameAssetPoolIW4.cpp | 11 +- src/ZoneCommon/Game/IW4/ZoneConstantsIW4.h | 3 +- src/ZoneCommon/Game/IW5/GameAssetPoolIW5.cpp | 94 +- src/ZoneCommon/Game/IW5/ZoneConstantsIW5.h | 3 +- src/ZoneCommon/Game/T5/GameAssetPoolT5.cpp | 3 +- src/ZoneCommon/Game/T6/GameAssetPoolT6.cpp | 122 +- src/ZoneCommon/Game/T6/ZoneConstantsT6.h | 9 +- .../SequenceZoneDefinitionAssetList.cpp | 6 +- .../Sequence/SequenceZoneDefinitionBuild.cpp | 6 +- .../Sequence/SequenceZoneDefinitionEntry.cpp | 15 +- .../Sequence/SequenceZoneDefinitionIgnore.cpp | 6 +- .../SequenceZoneDefinitionInclude.cpp | 6 +- .../SequenceZoneDefinitionMetaData.cpp | 7 +- .../ZoneDefinition/ZoneDefinitionParser.cpp | 14 +- src/ZoneLoading/ZoneLoading.cpp | 7 +- src/ZoneWriting/ZoneWriting.cpp | 7 +- .../EventHandlerSetScopeSequencesTests.cpp | 633 ++++-- .../Menu/Sequence/ItemScopeSequencesTests.cpp | 26 +- .../Parsing/Simple/SimpleExpressionTests.cpp | 359 ++-- .../Commands/Sequence/SequenceActionTests.cpp | 258 +-- .../Sequence/SequenceArchitectureTests.cpp | 30 +- .../Commands/Sequence/SequenceGameTests.cpp | 10 +- .../Sequence/SequenceNamespaceTests.cpp | 12 +- .../Parsing/Matcher/MatcherTests.cpp | 622 +++--- 96 files changed, 4085 insertions(+), 2290 deletions(-) diff --git a/src/ObjLoading/ObjLoading.cpp b/src/ObjLoading/ObjLoading.cpp index 4fe5af417..a4727ec15 100644 --- a/src/ObjLoading/ObjLoading.cpp +++ b/src/ObjLoading/ObjLoading.cpp @@ -14,7 +14,13 @@ ObjLoading::Configuration_t ObjLoading::Configuration; -const IObjLoader* const OBJ_LOADERS[]{new IW3::ObjLoader(), new IW4::ObjLoader(), new IW5::ObjLoader(), new T5::ObjLoader(), new T6::ObjLoader()}; +const IObjLoader* const OBJ_LOADERS[]{ + new IW3::ObjLoader(), + new IW4::ObjLoader(), + new IW5::ObjLoader(), + new T5::ObjLoader(), + new T6::ObjLoader(), +}; void ObjLoading::LoadReferencedContainersForZone(ISearchPath* searchPath, Zone* zone) { diff --git a/src/ObjLoading/Parsing/Menu/Matcher/MenuExpressionMatchers.cpp b/src/ObjLoading/Parsing/Menu/Matcher/MenuExpressionMatchers.cpp index 915956675..684257b1a 100644 --- a/src/ObjLoading/Parsing/Menu/Matcher/MenuExpressionMatchers.cpp +++ b/src/ObjLoading/Parsing/Menu/Matcher/MenuExpressionMatchers.cpp @@ -30,15 +30,22 @@ std::unique_ptr<SimpleExpressionMatchers::matcher_t> MenuExpressionMatchers::Par { const MenuMatcherFactory create(labelSupplier); - return create.Or({create - .And({create.Identifier().Capture(CAPTURE_FUNCTION_NAME), - create.Char('('), - create.Optional(create.And({ - create.Label(LABEL_EXPRESSION), - create.OptionalLoop(create.And({create.Char(','), create.Label(LABEL_EXPRESSION)})), - })), - create.Char(')').Tag(TAG_EXPRESSION_FUNCTION_CALL_END)}) - .Tag(TAG_EXPRESSION_FUNCTION_CALL)}); + return create.Or({ + create + .And({ + create.Identifier().Capture(CAPTURE_FUNCTION_NAME), + create.Char('('), + create.Optional(create.And({ + create.Label(LABEL_EXPRESSION), + create.OptionalLoop(create.And({ + create.Char(','), + create.Label(LABEL_EXPRESSION), + })), + })), + create.Char(')').Tag(TAG_EXPRESSION_FUNCTION_CALL_END), + }) + .Tag(TAG_EXPRESSION_FUNCTION_CALL), + }); } const std::map<std::string, size_t>& MenuExpressionMatchers::GetBaseFunctionMapForFeatureLevel(const FeatureLevel featureLevel) diff --git a/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherFactory.cpp b/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherFactory.cpp index f6fefcefd..3adb50438 100644 --- a/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherFactory.cpp +++ b/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherFactory.cpp @@ -13,57 +13,75 @@ MenuMatcherFactory::MenuMatcherFactory(const IMatcherForLabelSupplier<SimplePars MatcherFactoryWrapper<SimpleParserValue> MenuMatcherFactory::StringChain() const { - return Or({And({String(), Loop(String())}) - .Transform( - [](const token_list_t& tokens) -> SimpleParserValue - { - std::ostringstream ss; - - for (const auto& token : tokens) - { - ss << token.get().StringValue(); - } - - return SimpleParserValue::String(tokens[0].get().GetPos(), new std::string(ss.str())); - }), - String()}); + return Or({ + And({ + String(), + Loop(String()), + }) + .Transform( + [](const token_list_t& tokens) -> SimpleParserValue + { + std::ostringstream ss; + + for (const auto& token : tokens) + { + ss << token.get().StringValue(); + } + + return SimpleParserValue::String(tokens[0].get().GetPos(), new std::string(ss.str())); + }), + String(), + }); } MatcherFactoryWrapper<SimpleParserValue> MenuMatcherFactory::Text() const { - return MatcherFactoryWrapper(Or({StringChain(), Identifier()})); + return MatcherFactoryWrapper(Or({ + StringChain(), + Identifier(), + })); } MatcherFactoryWrapper<SimpleParserValue> MenuMatcherFactory::TextNoChain() const { - return MatcherFactoryWrapper(Or({String(), Identifier()})); + return MatcherFactoryWrapper(Or({ + String(), + Identifier(), + })); } MatcherFactoryWrapper<SimpleParserValue> MenuMatcherFactory::Numeric() const { - return MatcherFactoryWrapper(Or({FloatingPoint(), Integer()})); + return MatcherFactoryWrapper(Or({ + FloatingPoint(), + Integer(), + })); } MatcherFactoryWrapper<SimpleParserValue> MenuMatcherFactory::IntExpression() const { - return MatcherFactoryWrapper(Or({Integer().Tag(TAG_INT).Capture(CAPTURE_INT), - And({ - Char('(').Capture(CAPTURE_FIRST_TOKEN), - Label(MenuExpressionMatchers::LABEL_EXPRESSION), - Char(')'), - }) - .Tag(TAG_EXPRESSION)})); + return MatcherFactoryWrapper(Or({ + Integer().Tag(TAG_INT).Capture(CAPTURE_INT), + And({ + Char('(').Capture(CAPTURE_FIRST_TOKEN), + Label(MenuExpressionMatchers::LABEL_EXPRESSION), + Char(')'), + }) + .Tag(TAG_EXPRESSION), + })); } MatcherFactoryWrapper<SimpleParserValue> MenuMatcherFactory::NumericExpression() const { - return MatcherFactoryWrapper(Or({Numeric().Tag(TAG_NUMERIC).Capture(CAPTURE_NUMERIC), - And({ - Char('(').Capture(CAPTURE_FIRST_TOKEN), - Label(MenuExpressionMatchers::LABEL_EXPRESSION), - Char(')'), - }) - .Tag(TAG_EXPRESSION)})); + return MatcherFactoryWrapper(Or({ + Numeric().Tag(TAG_NUMERIC).Capture(CAPTURE_NUMERIC), + And({ + Char('(').Capture(CAPTURE_FIRST_TOKEN), + Label(MenuExpressionMatchers::LABEL_EXPRESSION), + Char(')'), + }) + .Tag(TAG_EXPRESSION), + })); } int MenuMatcherFactory::TokenNumericIntValue(const SimpleParserValue& value) diff --git a/src/ObjLoading/Parsing/Menu/Sequence/EventHandlerSetScopeSequences.cpp b/src/ObjLoading/Parsing/Menu/Sequence/EventHandlerSetScopeSequences.cpp index 5e919b8cf..04aa7a6f0 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/EventHandlerSetScopeSequences.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/EventHandlerSetScopeSequences.cpp @@ -33,113 +33,125 @@ namespace menu _NODISCARD MatcherFactoryWrapper<SimpleParserValue> ScriptStrictNumeric() const { - return And({MatcherFactoryWrapper<SimpleParserValue>(std::make_unique<MenuMatcherScriptNumeric>()) - .Transform( - [](const token_list_t& tokens) -> SimpleParserValue - { - const auto& firstToken = tokens[0].get(); - - if (firstToken.m_type == SimpleParserValueType::CHARACTER) - { - const auto& secondToken = tokens[1].get(); - if (secondToken.m_type == SimpleParserValueType::INTEGER) - return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(-secondToken.IntegerValue()))); - - std::ostringstream ss; - ss << std::noshowpoint << -firstToken.FloatingPointValue(); - return SimpleParserValue::String(firstToken.GetPos(), new std::string(ss.str())); - } - - if (firstToken.m_type == SimpleParserValueType::INTEGER) - return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(firstToken.IntegerValue()))); - if (firstToken.m_type == SimpleParserValueType::FLOATING_POINT) - { - std::ostringstream ss; - ss << std::noshowpoint << firstToken.FloatingPointValue(); - return SimpleParserValue::String(firstToken.GetPos(), new std::string(ss.str())); - } - return SimpleParserValue::String(firstToken.GetPos(), new std::string(firstToken.StringValue())); - })}); + return And({ + MatcherFactoryWrapper<SimpleParserValue>(std::make_unique<MenuMatcherScriptNumeric>()) + .Transform( + [](const token_list_t& tokens) -> SimpleParserValue + { + const auto& firstToken = tokens[0].get(); + + if (firstToken.m_type == SimpleParserValueType::CHARACTER) + { + const auto& secondToken = tokens[1].get(); + if (secondToken.m_type == SimpleParserValueType::INTEGER) + return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(-secondToken.IntegerValue()))); + + std::ostringstream ss; + ss << std::noshowpoint << -firstToken.FloatingPointValue(); + return SimpleParserValue::String(firstToken.GetPos(), new std::string(ss.str())); + } + + if (firstToken.m_type == SimpleParserValueType::INTEGER) + return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(firstToken.IntegerValue()))); + if (firstToken.m_type == SimpleParserValueType::FLOATING_POINT) + { + std::ostringstream ss; + ss << std::noshowpoint << firstToken.FloatingPointValue(); + return SimpleParserValue::String(firstToken.GetPos(), new std::string(ss.str())); + } + return SimpleParserValue::String(firstToken.GetPos(), new std::string(firstToken.StringValue())); + }), + }); } _NODISCARD MatcherFactoryWrapper<SimpleParserValue> ScriptNumeric() const { - return Or({ScriptStrictNumeric(), - Or({ - Type(SimpleParserValueType::CHARACTER), - Type(SimpleParserValueType::STRING), - Type(SimpleParserValueType::IDENTIFIER), - }) - .Transform( - [](const token_list_t& tokens) -> SimpleParserValue - { - return SimpleParserValue::Integer(tokens[0].get().GetPos(), static_cast<int>(ExpectedScriptToken::NUMERIC)); - })}); + return Or({ + ScriptStrictNumeric(), + Or({ + Type(SimpleParserValueType::CHARACTER), + Type(SimpleParserValueType::STRING), + Type(SimpleParserValueType::IDENTIFIER), + }) + .Transform( + [](const token_list_t& tokens) -> SimpleParserValue + { + return SimpleParserValue::Integer(tokens[0].get().GetPos(), static_cast<int>(ExpectedScriptToken::NUMERIC)); + }), + }); } _NODISCARD MatcherFactoryWrapper<SimpleParserValue> ScriptStrictInt() const { - return And({MatcherFactoryWrapper<SimpleParserValue>(std::make_unique<MenuMatcherScriptInt>()) - .Transform( - [](const token_list_t& tokens) -> SimpleParserValue - { - const auto& firstToken = tokens[0].get(); - - if (firstToken.m_type == SimpleParserValueType::CHARACTER) - return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(-tokens[1].get().IntegerValue()))); - - if (firstToken.m_type == SimpleParserValueType::INTEGER) - return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(firstToken.IntegerValue()))); - return SimpleParserValue::String(firstToken.GetPos(), new std::string(firstToken.StringValue())); - })}); + return And({ + MatcherFactoryWrapper<SimpleParserValue>(std::make_unique<MenuMatcherScriptInt>()) + .Transform( + [](const token_list_t& tokens) -> SimpleParserValue + { + const auto& firstToken = tokens[0].get(); + + if (firstToken.m_type == SimpleParserValueType::CHARACTER) + return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(-tokens[1].get().IntegerValue()))); + + if (firstToken.m_type == SimpleParserValueType::INTEGER) + return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(firstToken.IntegerValue()))); + return SimpleParserValue::String(firstToken.GetPos(), new std::string(firstToken.StringValue())); + }), + }); } _NODISCARD MatcherFactoryWrapper<SimpleParserValue> ScriptChar(const char c) const { - return Or({Char(c), - Or({ - Type(SimpleParserValueType::INTEGER), - Type(SimpleParserValueType::FLOATING_POINT), - Type(SimpleParserValueType::STRING), - Type(SimpleParserValueType::IDENTIFIER), - }) - .Transform( - [](const token_list_t& tokens) -> SimpleParserValue - { - return SimpleParserValue::Integer(tokens[0].get().GetPos(), static_cast<int>(ExpectedScriptToken::INT)); - })}); + return Or({ + Char(c), + Or({ + Type(SimpleParserValueType::INTEGER), + Type(SimpleParserValueType::FLOATING_POINT), + Type(SimpleParserValueType::STRING), + Type(SimpleParserValueType::IDENTIFIER), + }) + .Transform( + [](const token_list_t& tokens) -> SimpleParserValue + { + return SimpleParserValue::Integer(tokens[0].get().GetPos(), static_cast<int>(ExpectedScriptToken::INT)); + }), + }); } _NODISCARD MatcherFactoryWrapper<SimpleParserValue> ScriptInt() const { - return Or({ScriptStrictInt(), - Or({ - Type(SimpleParserValueType::CHARACTER), - Type(SimpleParserValueType::FLOATING_POINT), - Type(SimpleParserValueType::STRING), - Type(SimpleParserValueType::IDENTIFIER), - }) - .Transform( - [](const token_list_t& tokens) -> SimpleParserValue - { - return SimpleParserValue::Integer(tokens[0].get().GetPos(), static_cast<int>(ExpectedScriptToken::INT)); - })}); + return Or({ + ScriptStrictInt(), + Or({ + Type(SimpleParserValueType::CHARACTER), + Type(SimpleParserValueType::FLOATING_POINT), + Type(SimpleParserValueType::STRING), + Type(SimpleParserValueType::IDENTIFIER), + }) + .Transform( + [](const token_list_t& tokens) -> SimpleParserValue + { + return SimpleParserValue::Integer(tokens[0].get().GetPos(), static_cast<int>(ExpectedScriptToken::INT)); + }), + }); } _NODISCARD MatcherFactoryWrapper<SimpleParserValue> ScriptText() const { - return Or({Type(SimpleParserValueType::STRING), - Type(SimpleParserValueType::IDENTIFIER), - Or({ - Type(SimpleParserValueType::CHARACTER), - Type(SimpleParserValueType::FLOATING_POINT), - Type(SimpleParserValueType::INTEGER), - }) - .Transform( - [](const token_list_t& tokens) -> SimpleParserValue - { - return SimpleParserValue::Integer(tokens[0].get().GetPos(), static_cast<int>(ExpectedScriptToken::TEXT)); - })}); + return Or({ + Type(SimpleParserValueType::STRING), + Type(SimpleParserValueType::IDENTIFIER), + Or({ + Type(SimpleParserValueType::CHARACTER), + Type(SimpleParserValueType::FLOATING_POINT), + Type(SimpleParserValueType::INTEGER), + }) + .Transform( + [](const token_list_t& tokens) -> SimpleParserValue + { + return SimpleParserValue::Integer(tokens[0].get().GetPos(), static_cast<int>(ExpectedScriptToken::TEXT)); + }), + }); } _NODISCARD MatcherFactoryWrapper<SimpleParserValue> ScriptKeyword(std::string keyword) const @@ -149,7 +161,12 @@ namespace menu _NODISCARD MatcherFactoryWrapper<SimpleParserValue> ScriptColor() const { - return And({ScriptStrictNumeric(), Optional(ScriptStrictNumeric()), Optional(ScriptStrictNumeric()), Optional(ScriptStrictNumeric())}); + return And({ + ScriptStrictNumeric(), + Optional(ScriptStrictNumeric()), + Optional(ScriptStrictNumeric()), + Optional(ScriptStrictNumeric()), + }); } _NODISCARD MatcherFactoryWrapper<SimpleParserValue> ScriptLocalVarIntOrLiteral() const @@ -191,7 +208,9 @@ namespace menu::event_handler_set_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({create.Char('}')}); + AddMatchers({ + create.Char('}'), + }); } protected: @@ -239,7 +258,9 @@ namespace menu::event_handler_set_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({create.Char(';')}); + AddMatchers({ + create.Char(';'), + }); } protected: @@ -262,14 +283,16 @@ namespace menu::event_handler_set_scope_sequences { const ScriptMatcherFactory create(this); - AddMatchers({create - .Or({ - create.Numeric(), - create.String(), - create.Identifier(), - create.Type(SimpleParserValueType::CHARACTER), - }) - .Capture(CAPTURE_SCRIPT_TOKEN)}); + AddMatchers({ + create + .Or({ + create.Numeric(), + create.String(), + create.Identifier(), + create.Type(SimpleParserValueType::CHARACTER), + }) + .Capture(CAPTURE_SCRIPT_TOKEN), + }); } protected: @@ -319,7 +342,10 @@ namespace menu::event_handler_set_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({create.And(matchers).Capture(CAPTURE_SCRIPT_TOKEN), create.Optional(create.Char(';'))}); + AddMatchers({ + create.And(matchers).Capture(CAPTURE_SCRIPT_TOKEN), + create.Optional(create.Char(';')), + }); } static std::unique_ptr<SequenceGenericScriptStatement> @@ -389,8 +415,15 @@ namespace menu::event_handler_set_scope_sequences { const ScriptMatcherFactory create(this); - AddMatchers( - {create.And({create.ScriptKeyword("uiScript"), create.And(matchers)}).Capture(CAPTURE_SCRIPT_TOKEN), create.Optional(create.Char(';'))}); + AddMatchers({ + create + .And({ + create.ScriptKeyword("uiScript"), + create.And(matchers), + }) + .Capture(CAPTURE_SCRIPT_TOKEN), + create.Optional(create.Char(';')), + }); } static std::unique_ptr<SequenceUiScriptStatement> Create(std::initializer_list<Movable<std::unique_ptr<AbstractMatcher<SimpleParserValue>>>> matchers) @@ -406,21 +439,23 @@ namespace menu::event_handler_set_scope_sequences static std::unique_ptr<matcher_t> PlayerDataPathMatchers(const ScriptMatcherFactory& create) { - return create.Or({create.ScriptKeyword("false"), - create.ScriptKeyword("true"), - create.And({ - create.Or({ - create.ScriptKeyword("localvarstring"), - create.ScriptKeyword("localvarint"), - create.ScriptKeyword("localvarfloat"), - create.ScriptKeyword("localvarbool"), - }), - create.ScriptChar('('), - create.ScriptText(), - create.ScriptChar(')'), - }), - create.ScriptStrictInt(), - create.ScriptText()}); + return create.Or({ + create.ScriptKeyword("false"), + create.ScriptKeyword("true"), + create.And({ + create.Or({ + create.ScriptKeyword("localvarstring"), + create.ScriptKeyword("localvarint"), + create.ScriptKeyword("localvarfloat"), + create.ScriptKeyword("localvarbool"), + }), + create.ScriptChar('('), + create.ScriptText(), + create.ScriptChar(')'), + }), + create.ScriptStrictInt(), + create.ScriptText(), + }); } }; @@ -432,16 +467,21 @@ namespace menu::event_handler_set_scope_sequences const ScriptMatcherFactory create(this); AddLabeledMatchers(PlayerDataPathMatchers(create), LABEL_PLAYER_DATA_PATH_ELEMENT); - AddMatchers({create - .And({ - create.ScriptKeyword("setPlayerData"), - create.ScriptChar('('), - create.Label(LABEL_PLAYER_DATA_PATH_ELEMENT), - create.Loop(create.And({create.ScriptChar(','), create.Label(LABEL_PLAYER_DATA_PATH_ELEMENT)})), - create.ScriptChar(')'), - }) - .Capture(CAPTURE_SCRIPT_TOKEN), - create.Optional(create.Char(';'))}); + AddMatchers({ + create + .And({ + create.ScriptKeyword("setPlayerData"), + create.ScriptChar('('), + create.Label(LABEL_PLAYER_DATA_PATH_ELEMENT), + create.Loop(create.And({ + create.ScriptChar(','), + create.Label(LABEL_PLAYER_DATA_PATH_ELEMENT), + })), + create.ScriptChar(')'), + }) + .Capture(CAPTURE_SCRIPT_TOKEN), + create.Optional(create.Char(';')), + }); } }; @@ -453,18 +493,23 @@ namespace menu::event_handler_set_scope_sequences const ScriptMatcherFactory create(this); AddLabeledMatchers(PlayerDataPathMatchers(create), LABEL_PLAYER_DATA_PATH_ELEMENT); - AddMatchers({create - .And({ - create.ScriptKeyword("setPlayerDataSplitscreen"), - create.ScriptChar('('), - create.ScriptInt(), - create.ScriptChar(','), - create.Label(LABEL_PLAYER_DATA_PATH_ELEMENT), - create.Loop(create.And({create.ScriptChar(','), create.Label(LABEL_PLAYER_DATA_PATH_ELEMENT)})), - create.ScriptChar(')'), - }) - .Capture(CAPTURE_SCRIPT_TOKEN), - create.Optional(create.Char(';'))}); + AddMatchers({ + create + .And({ + create.ScriptKeyword("setPlayerDataSplitscreen"), + create.ScriptChar('('), + create.ScriptInt(), + create.ScriptChar(','), + create.Label(LABEL_PLAYER_DATA_PATH_ELEMENT), + create.Loop(create.And({ + create.ScriptChar(','), + create.Label(LABEL_PLAYER_DATA_PATH_ELEMENT), + })), + create.ScriptChar(')'), + }) + .Capture(CAPTURE_SCRIPT_TOKEN), + create.Optional(create.Char(';')), + }); } }; @@ -475,22 +520,26 @@ namespace menu::event_handler_set_scope_sequences { const ScriptMatcherFactory create(this); - AddMatchers({create - .And({create.ScriptKeyword("lerp"), - create.Or({ - create.ScriptKeyword("scale"), - create.ScriptKeyword("alpha"), - create.ScriptKeyword("x"), - create.ScriptKeyword("y"), - }), - create.ScriptKeyword("from"), - create.ScriptNumeric(), - create.ScriptKeyword("to"), - create.ScriptNumeric(), - create.ScriptKeyword("over"), - create.ScriptNumeric()}) - .Capture(CAPTURE_SCRIPT_TOKEN), - create.Optional(create.Char(';'))}); + AddMatchers({ + create + .And({ + create.ScriptKeyword("lerp"), + create.Or({ + create.ScriptKeyword("scale"), + create.ScriptKeyword("alpha"), + create.ScriptKeyword("x"), + create.ScriptKeyword("y"), + }), + create.ScriptKeyword("from"), + create.ScriptNumeric(), + create.ScriptKeyword("to"), + create.ScriptNumeric(), + create.ScriptKeyword("over"), + create.ScriptNumeric(), + }) + .Capture(CAPTURE_SCRIPT_TOKEN), + create.Optional(create.Char(';')), + }); } }; @@ -511,13 +560,17 @@ namespace menu::event_handler_set_scope_sequences AddLabeledMatchers(expressionMatchers.Expression(this), MenuExpressionMatchers::LABEL_EXPRESSION); - AddMatchers({create.Or({create.ScriptKeyword("setLocalVarBool").Tag(TAG_BOOL), - create.ScriptKeyword("setLocalVarInt").Tag(TAG_INT), - create.ScriptKeyword("setLocalVarFloat").Tag(TAG_FLOAT), - create.ScriptKeyword("setLocalVarString").Tag(TAG_STRING)}), - create.ScriptText().Capture(CAPTURE_VAR_NAME), - create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), - create.Optional(create.Char(';'))}); + AddMatchers({ + create.Or({ + create.ScriptKeyword("setLocalVarBool").Tag(TAG_BOOL), + create.ScriptKeyword("setLocalVarInt").Tag(TAG_INT), + create.ScriptKeyword("setLocalVarFloat").Tag(TAG_FLOAT), + create.ScriptKeyword("setLocalVarString").Tag(TAG_STRING), + }), + create.ScriptText().Capture(CAPTURE_VAR_NAME), + create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), + create.Optional(create.Char(';')), + }); } private: @@ -640,11 +693,13 @@ namespace menu::event_handler_set_scope_sequences AddLabeledMatchers(expressionMatchers.Expression(this), MenuExpressionMatchers::LABEL_EXPRESSION); - AddMatchers({create.Keyword("if").Capture(CAPTURE_KEYWORD), - create.Char('('), - create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), - create.Char(')'), - create.Char('{')}); + AddMatchers({ + create.Keyword("if").Capture(CAPTURE_KEYWORD), + create.Char('('), + create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), + create.Char(')'), + create.Char('{'), + }); } protected: @@ -682,12 +737,14 @@ namespace menu::event_handler_set_scope_sequences AddLabeledMatchers(expressionMatchers.Expression(this), MenuExpressionMatchers::LABEL_EXPRESSION); - AddMatchers({create.Char('}'), - create.Keyword("elseif").Capture(CAPTURE_KEYWORD), - create.Char('('), - create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), - create.Char(')'), - create.Char('{')}); + AddMatchers({ + create.Char('}'), + create.Keyword("elseif").Capture(CAPTURE_KEYWORD), + create.Char('('), + create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), + create.Char(')'), + create.Char('{'), + }); } protected: @@ -734,7 +791,11 @@ namespace menu::event_handler_set_scope_sequences const ScriptMatcherFactory create(this); const MenuExpressionMatchers expressionMatchers; - AddMatchers({create.Char('}'), create.Keyword("else").Capture(CAPTURE_KEYWORD), create.Char('{')}); + AddMatchers({ + create.Char('}'), + create.Keyword("else").Capture(CAPTURE_KEYWORD), + create.Char('{'), + }); } protected: @@ -798,32 +859,38 @@ namespace menu::event_handler_set_scope_sequences }), LABEL_FILE_CATEGORY); - AddLabeledMatchers(create.And({create.ScriptKeyword("open"), - create.Label(LABEL_PARADIGM), - create.Optional(create.Label(LABEL_PLATFORM)), - create.Optional(create.Label(LABEL_FILE_CATEGORY)), - create.ScriptText()}), + AddLabeledMatchers(create.And({ + create.ScriptKeyword("open"), + create.Label(LABEL_PARADIGM), + create.Optional(create.Label(LABEL_PLATFORM)), + create.Optional(create.Label(LABEL_FILE_CATEGORY)), + create.ScriptText(), + }), LABEL_OPEN); - AddMatchers({create - .And({create.ScriptKeyword("uiScript"), - create.ScriptKeyword("OnlineVault"), - create.Or({ - create.Label(LABEL_OPEN), - create.ScriptKeyword("Pop"), - create.ScriptKeyword("CloseAll"), - create.ScriptKeyword("Load"), - create.ScriptKeyword("LoadAndRenderMovie"), - create.ScriptKeyword("TrySave"), - create.ScriptKeyword("Save"), - create.ScriptKeyword("Rename"), - create.ScriptKeyword("Delete"), - create.ScriptKeyword("Abort"), - create.ScriptKeyword("FacebookUploadPhoto"), - create.ScriptKeyword("FacebookUploadVideo"), - })}) - .Capture(CAPTURE_SCRIPT_TOKEN), - create.Optional(create.Char(';'))}); + AddMatchers({ + create + .And({ + create.ScriptKeyword("uiScript"), + create.ScriptKeyword("OnlineVault"), + create.Or({ + create.Label(LABEL_OPEN), + create.ScriptKeyword("Pop"), + create.ScriptKeyword("CloseAll"), + create.ScriptKeyword("Load"), + create.ScriptKeyword("LoadAndRenderMovie"), + create.ScriptKeyword("TrySave"), + create.ScriptKeyword("Save"), + create.ScriptKeyword("Rename"), + create.ScriptKeyword("Delete"), + create.ScriptKeyword("Abort"), + create.ScriptKeyword("FacebookUploadPhoto"), + create.ScriptKeyword("FacebookUploadVideo"), + }), + }) + .Capture(CAPTURE_SCRIPT_TOKEN), + create.Optional(create.Char(';')), + }); } }; } // namespace menu::event_handler_set_scope_sequences @@ -846,208 +913,466 @@ void EventHandlerSetScopeSequences::AddSequences(const FeatureLevel featureLevel if (!permissive) { - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("fadeIn"), create.ScriptText()})); // fadeIn <item group name> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("fadeOut"), create.ScriptText()})); // fadeOut <item group name> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("show"), create.ScriptText()})); // show <item group name> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("hide"), create.ScriptText()})); // hide <item group name> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("showMenu"), create.ScriptText()})); // showMenu <menu name> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("hideMenu"), create.ScriptText()})); // hideMenu <menu name> - AddSequence(SequenceGenericScriptStatement::Create( - {create.ScriptKeyword("setColor"), - create.Or({create.ScriptKeyword("backColor"), create.ScriptKeyword("foreColor"), create.ScriptKeyword("borderColor")}), - create.ScriptColor()})); // setColor ("backColor" | "foreColor" | "borderColor") <r> [<g>] [<b>] [<a>] - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("open"), create.ScriptText()})); // open <menu name> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("close"), create.ScriptText()})); // close ("self" | <menu name>) - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("escape"), create.ScriptText()})); // escape ("self" | <menu name>) - AddSequence( - SequenceGenericScriptStatement::Create({create.ScriptKeyword("closeForAllPlayers"), create.ScriptText()})); // closeForAllPlayers <menu name> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("ingameOpen"), create.ScriptText()})); // ingameOpen <menu name> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("ingameClose"), create.ScriptText()})); // ingameClose <menu name> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setBackground"), create.ScriptText()})); // setBackground <material name> - AddSequence(SequenceGenericScriptStatement::Create( - {create.ScriptKeyword("setItemColor"), - create.ScriptText(), - create.Or({create.ScriptKeyword("backColor"), - create.ScriptKeyword("foreColor"), - create.ScriptKeyword("borderColor"), - create.ScriptKeyword("disableColor")}), - create.ScriptColor()})); // setItemColor <item group name> (backColor | foreColor | borderColor | disableColor) <r> [<g>] [<b>] [<a>] - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("focusFirst")})); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("fadeIn"), + create.ScriptText(), + })); // fadeIn <item group name> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("fadeOut"), + create.ScriptText(), + })); // fadeOut <item group name> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("show"), + create.ScriptText(), + })); // show <item group name> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("hide"), + create.ScriptText(), + })); // hide <item group name> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("showMenu"), + create.ScriptText(), + })); // showMenu <menu name> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("hideMenu"), + create.ScriptText(), + })); // hideMenu <menu name> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setColor"), + create.Or({ + create.ScriptKeyword("backColor"), + create.ScriptKeyword("foreColor"), + create.ScriptKeyword("borderColor"), + }), + create.ScriptColor(), + })); // setColor ("backColor" | "foreColor" | "borderColor") <r> [<g>] [<b>] [<a>] + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("open"), + create.ScriptText(), + })); // open <menu name> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("close"), + create.ScriptText(), + })); // close ("self" | <menu name>) + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("escape"), + create.ScriptText(), + })); // escape ("self" | <menu name>) + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("closeForAllPlayers"), + create.ScriptText(), + })); // closeForAllPlayers <menu name> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("ingameOpen"), + create.ScriptText(), + })); // ingameOpen <menu name> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("ingameClose"), + create.ScriptText(), + })); // ingameClose <menu name> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setBackground"), + create.ScriptText(), + })); // setBackground <material name> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setItemColor"), + create.ScriptText(), + create.Or({ + create.ScriptKeyword("backColor"), + create.ScriptKeyword("foreColor"), + create.ScriptKeyword("borderColor"), + create.ScriptKeyword("disableColor"), + }), + create.ScriptColor(), + })); // setItemColor <item group name> (backColor | foreColor | borderColor | disableColor) <r> [<g>] [<b>] [<a>] + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("focusFirst"), + })); // setFocus game specific - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setFocusByDvar"), create.ScriptText()})); // setFocusByDvar <dvar name> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setFocusByDvar"), + create.ScriptText(), + })); // setFocusByDvar <dvar name> // setDvar game specific - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("exec"), create.ScriptText()})); // exec <command> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execNow"), create.ScriptText()})); // execNow <command> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execOnDvarStringValue"), - create.ScriptText(), - create.ScriptText(), - create.ScriptText()})); // execOnDvarStringValue <dvar name> <value> <command> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execOnDvarIntValue"), - create.ScriptText(), - create.ScriptInt(), - create.ScriptText()})); // execOnDvarIntValue <dvar name> <value> <command> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execOnDvarFloatValue"), - create.ScriptText(), - create.ScriptNumeric(), - create.ScriptText()})); // execOnDvarFloatValue <dvar name> <value> <command> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execNowOnDvarStringValue"), - create.ScriptText(), - create.ScriptText(), - create.ScriptText()})); // execNowOnDvarStringValue <dvar name> <value> <command> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execNowOnDvarIntValue"), - create.ScriptText(), - create.ScriptInt(), - create.ScriptText()})); // execNowOnDvarIntValue <dvar name> <value> <command> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execNowOnDvarFloatValue"), - create.ScriptText(), - create.ScriptNumeric(), - create.ScriptText()})); // execNowOnDvarFloatValue <dvar name> <value> <command> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("play"), create.ScriptText()})); // play <sound name> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("exec"), + create.ScriptText(), + })); // exec <command> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("execNow"), + create.ScriptText(), + })); // execNow <command> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("execOnDvarStringValue"), + create.ScriptText(), + create.ScriptText(), + create.ScriptText(), + })); // execOnDvarStringValue <dvar name> <value> <command> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("execOnDvarIntValue"), + create.ScriptText(), + create.ScriptInt(), + create.ScriptText(), + })); // execOnDvarIntValue <dvar name> <value> <command> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("execOnDvarFloatValue"), + create.ScriptText(), + create.ScriptNumeric(), + create.ScriptText(), + })); // execOnDvarFloatValue <dvar name> <value> <command> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("execNowOnDvarStringValue"), + create.ScriptText(), + create.ScriptText(), + create.ScriptText(), + })); // execNowOnDvarStringValue <dvar name> <value> <command> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("execNowOnDvarIntValue"), + create.ScriptText(), + create.ScriptInt(), + create.ScriptText(), + })); // execNowOnDvarIntValue <dvar name> <value> <command> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("execNowOnDvarFloatValue"), + create.ScriptText(), + create.ScriptNumeric(), + create.ScriptText(), + })); // execNowOnDvarFloatValue <dvar name> <value> <command> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("play"), + create.ScriptText(), + })); // play <sound name> // scriptMenuResponse game specific - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("scriptMenuRespondOnDvarStringValue"), - create.ScriptText(), - create.ScriptText(), - create.ScriptText()})); // scriptMenuRespondOnDvarStringValue <dvar name> <value> <response value> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("scriptMenuRespondOnDvarIntValue"), - create.ScriptText(), - create.ScriptInt(), - create.ScriptText()})); // scriptMenuRespondOnDvarIntValue <dvar name> <value> <response value> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("scriptMenuRespondOnDvarFloatValue"), - create.ScriptText(), - create.ScriptNumeric(), - create.ScriptText()})); // scriptMenuRespondOnDvarFloatValue <dvar name> <value> <response value> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("scriptMenuRespondOnDvarStringValue"), + create.ScriptText(), + create.ScriptText(), + create.ScriptText(), + })); // scriptMenuRespondOnDvarStringValue <dvar name> <value> <response value> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("scriptMenuRespondOnDvarIntValue"), + create.ScriptText(), + create.ScriptInt(), + create.ScriptText(), + })); // scriptMenuRespondOnDvarIntValue <dvar name> <value> <response value> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("scriptMenuRespondOnDvarFloatValue"), + create.ScriptText(), + create.ScriptNumeric(), + create.ScriptText(), + })); // scriptMenuRespondOnDvarFloatValue <dvar name> <value> <response value> AddSequence(std::make_unique<SequenceSetPlayerData>()); AddSequence(std::make_unique<SequenceSetPlayerDataSplitscreen>()); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("resetStatsConfirm")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("resetStatsCancel")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setGameMode"), create.ScriptText()})); // setGameMode <mode name> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("resetStatsConfirm"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("resetStatsCancel"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setGameMode"), + create.ScriptText(), + })); // setGameMode <mode name> // feederTop / feederBottom game specific - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("showGamerCard")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("openForGameType"), create.ScriptText()})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("closeForGameType"), create.ScriptText()})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("kickPlayer")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("getKickPlayerQuestion")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("partyUpdateMissingMapPackDvar")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("togglePlayerMute")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("resolveError")})); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("showGamerCard"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("openForGameType"), + create.ScriptText(), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("closeForGameType"), + create.ScriptText(), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("kickPlayer"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("getKickPlayerQuestion"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("partyUpdateMissingMapPackDvar"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("togglePlayerMute"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("resolveError"), + })); AddSequence(std::make_unique<SequenceLerp>()); // UiScripts - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("StartServer")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("loadArenas")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("loadGameInfo")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("clearError")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("Quit")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("Controls")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("Leave")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("closeingame")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("update"), create.ScriptText()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("startSingleplayer")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("startMultiplayer")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("getLanguage")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("verifyLanguage")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("updateLanguage")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("mutePlayer")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("openMenuOnDvar"), - create.ScriptText(), - create.Or({create.ScriptStrictNumeric(), create.ScriptText()}), - create.ScriptText()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("openMenuOnDvarNot"), - create.ScriptText(), - create.Or({create.ScriptStrictNumeric(), create.ScriptText()}), - create.ScriptText()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("closeMenuOnDvar"), - create.ScriptText(), - create.Or({create.ScriptStrictNumeric(), create.ScriptText()}), - create.ScriptText()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("closeMenuOnDvarNot"), - create.ScriptText(), - create.Or({create.ScriptStrictNumeric(), create.ScriptText()}), - create.ScriptText()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("setRecommended")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("clearLoadErrorsSummary")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("clearClientMatchData")})); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("StartServer"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("loadArenas"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("loadGameInfo"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("clearError"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("Quit"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("Controls"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("Leave"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("closeingame"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("update"), + create.ScriptText(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("startSingleplayer"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("startMultiplayer"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("getLanguage"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("verifyLanguage"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("updateLanguage"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("mutePlayer"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("openMenuOnDvar"), + create.ScriptText(), + create.Or({ + create.ScriptStrictNumeric(), + create.ScriptText(), + }), + create.ScriptText(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("openMenuOnDvarNot"), + create.ScriptText(), + create.Or({ + create.ScriptStrictNumeric(), + create.ScriptText(), + }), + create.ScriptText(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("closeMenuOnDvar"), + create.ScriptText(), + create.Or({ + create.ScriptStrictNumeric(), + create.ScriptText(), + }), + create.ScriptText(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("closeMenuOnDvarNot"), + create.ScriptText(), + create.Or({ + create.ScriptStrictNumeric(), + create.ScriptText(), + }), + create.ScriptText(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("setRecommended"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("clearLoadErrorsSummary"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("clearClientMatchData"), + })); if (featureLevel == FeatureLevel::IW4) { - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setFocus"), create.ScriptText()})); // setFocus <item name> - AddSequence( - SequenceGenericScriptStatement::Create({create.ScriptKeyword("setDvar"), - create.ScriptText(), - create.Or({create.ScriptStrictNumeric(), create.ScriptText()})})); // setDvar <dvar name> <dvar value> - AddSequence(SequenceGenericScriptStatement::Create( - {create.ScriptKeyword("scriptMenuResponse"), create.ScriptText()})); // scriptMenuResponse <response value> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("updateMail")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("openMail")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("deleteMail")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("doMailLottery")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("feederTop")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("feederBottom")})); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setFocus"), + create.ScriptText(), + })); // setFocus <item name> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setDvar"), + create.ScriptText(), + create.Or({ + create.ScriptStrictNumeric(), + create.ScriptText(), + }), + })); // setDvar <dvar name> <dvar value> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("scriptMenuResponse"), + create.ScriptText(), + })); // scriptMenuResponse <response value> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("updateMail"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("openMail"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("deleteMail"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("doMailLottery"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("feederTop"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("feederBottom"), + })); // statClearPerkNew // TODO // statSetUsingTable // TODO // statClearBitMask // TODO // IW4x UiScripts - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("LoadMods")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RunMod")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("ClearMods")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("security_increase_cancel")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("mod_download_cancel")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("LoadFriends")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("JoinFriend")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("downloadDLC"), create.ScriptInt()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("checkFirstLaunch")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("visitWebsite")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("visitWiki")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("visitDiscord")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("updateui_mousePitch")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("ServerStatus")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("UpdateFilter")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RefreshFilter")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RefreshServers")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("JoinServer")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("ServerSort"), create.ScriptInt()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("CreateListFavorite")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("CreateFavorite")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("CreateCurrentServerFavorite")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("DeleteFavorite")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("nextStartupMessage")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("UpdateClasses")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("loadDemos")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("launchDemo")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("deleteDemo")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("ApplyMap")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("ApplyInitialMap")})); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("LoadMods"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RunMod"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("ClearMods"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("security_increase_cancel"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("mod_download_cancel"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("LoadFriends"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("JoinFriend"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("downloadDLC"), + create.ScriptInt(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("checkFirstLaunch"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("visitWebsite"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("visitWiki"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("visitDiscord"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("updateui_mousePitch"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("ServerStatus"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("UpdateFilter"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RefreshFilter"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RefreshServers"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("JoinServer"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("ServerSort"), + create.ScriptInt(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("CreateListFavorite"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("CreateFavorite"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("CreateCurrentServerFavorite"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("DeleteFavorite"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("nextStartupMessage"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("UpdateClasses"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("loadDemos"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("launchDemo"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("deleteDemo"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("ApplyMap"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("ApplyInitialMap"), + })); } if (featureLevel == FeatureLevel::IW5) { - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("forceClose"), create.ScriptText()})); // forceClose ("self" | <menu name>) + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("forceClose"), + create.ScriptText(), + })); // forceClose ("self" | <menu name>) AddSequence(SequenceGenericScriptStatement::Create({ create.ScriptKeyword("setFocus"), - create.Or({create.And({ - create.ScriptKeyword("localVarString"), - create.Char('('), - create.ScriptText(), - create.Char(')'), - }), - create.ScriptText()}), + create.Or({ + create.And({ + create.ScriptKeyword("localVarString"), + create.Char('('), + create.ScriptText(), + create.Char(')'), + }), + create.ScriptText(), + }), })); // setFocus ((localVarString '(' <var name> ')') | <item name>) AddSequence(SequenceGenericScriptStatement::Create({ create.ScriptKeyword("setDvar"), create.ScriptText(), - create.Or({create.And({ - create.ScriptKeyword("localVarString"), - create.Char('('), - create.ScriptText(), - create.Char(')'), - }), - create.ScriptStrictNumeric(), - create.ScriptText()}), + create.Or({ + create.And({ + create.ScriptKeyword("localVarString"), + create.Char('('), + create.ScriptText(), + create.Char(')'), + }), + create.ScriptStrictNumeric(), + create.ScriptText(), + }), })); // setDvar <dvar name> ((localVarString '(' <var name> ')') | <dvar value>) - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execFirstClient"), create.ScriptText()})); // execFirstClient <command> - AddSequence(SequenceGenericScriptStatement::Create( - {create.ScriptKeyword("execKeyPress"), create.Or({create.ScriptStrictNumeric(), create.ScriptText()})})); // execKeyPress <key number> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("execFirstClient"), + create.ScriptText(), + })); // execFirstClient <command> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("execKeyPress"), + create.Or({ + create.ScriptStrictNumeric(), + create.ScriptText(), + }), + })); // execKeyPress <key number> AddSequence(SequenceGenericScriptStatement::Create({ create.ScriptKeyword("scriptMenuResponse"), create.Or({ @@ -1066,101 +1391,199 @@ void EventHandlerSetScopeSequences::AddSequences(const FeatureLevel featureLevel create.ScriptText(), }), })); // scriptMenuResponse (((localVarInt | localVarFloat | localVarBool | localVarString) '(' <var name> ')') | <response value>) - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("deleteEliteCacFile")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("integrateEliteCacFile")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setMatchRulesData")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("loadMatchRulesDataFromPlayer")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("saveMatchRulesDataToPlayer")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("loadMatchRulesDataFromHistory")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("loadMatchRulesDataDefaults")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setUsingMatchRulesData")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("saveMatchRulesDedicatedServer")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("loadMatchRulesDedicatedServer")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("onlineVaultEditMetadata")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("includeInMapRotation")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("useCustomMapRotation")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("useIntermissionTimer")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("stopIntermissionTimer")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("feederTop"), create.Optional(create.Text())})); // feederTop [<var name>] - AddSequence( - SequenceGenericScriptStatement::Create({create.ScriptKeyword("feederBottom"), create.Optional(create.Text())})); // feederBottom [<var name>] - AddSequence( - SequenceGenericScriptStatement::Create({create.ScriptKeyword("feederPageUp"), create.Optional(create.Text())})); // feederPageUp [<var name>] - AddSequence(SequenceGenericScriptStatement::Create( - {create.ScriptKeyword("feederPageDown"), create.Optional(create.Text())})); // feederPageDown [<var name>] - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("showCoopGamerCard")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("showSplitscreenGamerCard")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("reportPlayerOffensive")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("reportPlayerExploiting")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("reportPlayerCheating")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("reportPlayerBoosting")})); - AddSequence( - SequenceGenericScriptStatement::Create({create.ScriptKeyword("setCardIcon"), - create.Char('('), - create.ScriptLocalVarIntOrLiteral(), - create.Char(')')})); // setCardIcon '(' ((localVarInt '(' <var name> ')') | <card icon index>) ')' - AddSequence( - SequenceGenericScriptStatement::Create({create.ScriptKeyword("setCardTitle"), - create.Char('('), - create.ScriptLocalVarIntOrLiteral(), - create.Char(')')})); // setCardTitle '(' ((localVarInt '(' <var name> ')') | <card title index>) ')' - AddSequence(SequenceGenericScriptStatement::Create( - {create.ScriptKeyword("setCardIconNew"), - create.Char('('), - create.ScriptLocalVarIntOrLiteral(), - create.Char(','), - create.Or({ - create.ScriptLocalVarIntOrLiteral(), - // This is wrong and the game does not even understand it. But because it's not a number it evaluates to 0... - // The game's menus do it and i don't want to fix it everywhere - create.ScriptKeyword("false"), - }), - create.Char( - ')')})); // setCardIconNew '(' ((localVarInt '(' <var name> ')') | <card icon index>) ',' ((localVarInt '(' <var name> ')') | <is new>) ')' - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setCardTitleNew"), - create.Char('('), - create.ScriptLocalVarIntOrLiteral(), - create.Char(','), - create.Or({ - create.ScriptLocalVarIntOrLiteral(), - // This is a hack (see setCardIconNew for details) - create.ScriptKeyword("false"), - }), - create.Char(')')})); // setCardTitleNew '(' ((localVarInt '(' <var name> ')') | <card icon - // index>) ',' ((localVarInt '(' <var name> ')') | <is new>) ')' - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setCardIconSplitScreen")})); // unknown - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setCardTitleSplitScreen")})); // unknown - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setCardIconNewSplitScreen")})); // unknown - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setCardTitleNewSplitScreen")})); // unknown - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("purchasePrestigeTitle"), - create.Char('('), - create.ScriptText(), - create.Char(')')})); // purchasePrestigeTitle '(' <title name> ')' - AddSequence( - SequenceGenericScriptStatement::Create({create.ScriptKeyword("setProfileItemNew"), - create.Char('('), - create.ScriptText(), - create.Char(','), - create.ScriptLocalVarIntOrLiteral(), - create.Char(')')})); // setProfileItemNew '(' <item name> ',' (0|1|(localVarInt '(' <var name> ')')) ')' - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setProfileItemNewSplitScreen")})); // unknown - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("storePopupXuid")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("getHostMigrateQuestion")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("makeHost")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("saveGameHide")})); // saveGameHide <item name> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("saveGameShow")})); // saveGameShow <item name> - AddSequence( - SequenceGenericScriptStatement::Create({create.ScriptKeyword("saveGameSetLocalBool"), create.ScriptText()})); // saveGameSetLocalBool <var name> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("saveDelay")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("writeSave")})); - AddSequence( - SequenceGenericScriptStatement::Create({create.ScriptKeyword("setSaveExecOnSuccess"), create.ScriptText()})); // setSaveExecOnSuccess <command> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("nextLevel")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("disablePause")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("enablePause")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("runCompletionResolve")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("clearCompletionResolve")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execWithResolve"), create.ScriptText()})); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("deleteEliteCacFile"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("integrateEliteCacFile"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setMatchRulesData"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("loadMatchRulesDataFromPlayer"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("saveMatchRulesDataToPlayer"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("loadMatchRulesDataFromHistory"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("loadMatchRulesDataDefaults"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setUsingMatchRulesData"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("saveMatchRulesDedicatedServer"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("loadMatchRulesDedicatedServer"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("onlineVaultEditMetadata"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("includeInMapRotation"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("useCustomMapRotation"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("useIntermissionTimer"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("stopIntermissionTimer"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("feederTop"), + create.Optional(create.Text()), + })); // feederTop [<var name>] + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("feederBottom"), + create.Optional(create.Text()), + })); // feederBottom [<var name>] + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("feederPageUp"), + create.Optional(create.Text()), + })); // feederPageUp [<var name>] + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("feederPageDown"), + create.Optional(create.Text()), + })); // feederPageDown [<var name>] + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("showCoopGamerCard"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("showSplitscreenGamerCard"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("reportPlayerOffensive"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("reportPlayerExploiting"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("reportPlayerCheating"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("reportPlayerBoosting"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setCardIcon"), + create.Char('('), + create.ScriptLocalVarIntOrLiteral(), + create.Char(')'), + })); // setCardIcon '(' ((localVarInt '(' <var name> ')') | <card icon index>) ')' + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setCardTitle"), + create.Char('('), + create.ScriptLocalVarIntOrLiteral(), + create.Char(')'), + })); // setCardTitle '(' ((localVarInt '(' <var name> ')') | <card title index>) ')' + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setCardIconNew"), + create.Char('('), + create.ScriptLocalVarIntOrLiteral(), + create.Char(','), + create.Or({ + create.ScriptLocalVarIntOrLiteral(), + // This is wrong and the game does not even understand it. But because it's not a number it evaluates to 0... + // The game's menus do it and i don't want to fix it everywhere + create.ScriptKeyword("false"), + }), + create.Char(')'), + })); // setCardIconNew '(' ((localVarInt '(' <var name> ')') | <card icon index>) ',' ((localVarInt '(' <var name> ')') | <is new>) ')' + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setCardTitleNew"), + create.Char('('), + create.ScriptLocalVarIntOrLiteral(), + create.Char(','), + create.Or({ + create.ScriptLocalVarIntOrLiteral(), + // This is a hack (see setCardIconNew for details) + create.ScriptKeyword("false"), + }), + create.Char(')'), + })); // setCardTitleNew '(' ((localVarInt '(' <var name> ')') | <card icon index>) ',' ((localVarInt '(' <var name> ')') | <is new>) ')' + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setCardIconSplitScreen"), + })); // unknown + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setCardTitleSplitScreen"), + })); // unknown + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setCardIconNewSplitScreen"), + })); // unknown + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setCardTitleNewSplitScreen"), + })); // unknown + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("purchasePrestigeTitle"), + create.Char('('), + create.ScriptText(), + create.Char(')'), + })); // purchasePrestigeTitle '(' <title name> ')' + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setProfileItemNew"), + create.Char('('), + create.ScriptText(), + create.Char(','), + create.ScriptLocalVarIntOrLiteral(), + create.Char(')'), + })); // setProfileItemNew '(' <item name> ',' (0|1|(localVarInt '(' <var name> ')')) ')' + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setProfileItemNewSplitScreen"), + })); // unknown + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("storePopupXuid"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("getHostMigrateQuestion"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("makeHost"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("saveGameHide"), + })); // saveGameHide <item name> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("saveGameShow"), + })); // saveGameShow <item name> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("saveGameSetLocalBool"), + create.ScriptText(), + })); // saveGameSetLocalBool <var name> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("saveDelay"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("writeSave"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setSaveExecOnSuccess"), + create.ScriptText(), + })); // setSaveExecOnSuccess <command> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("nextLevel"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("disablePause"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("enablePause"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("runCompletionResolve"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("clearCompletionResolve"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("execWithResolve"), + create.ScriptText(), + })); AddSequence(SequenceGenericScriptStatement::Create({ create.ScriptKeyword("playMenuVideo"), create.Char('('), @@ -1170,124 +1593,329 @@ void EventHandlerSetScopeSequences::AddSequences(const FeatureLevel featureLevel create.Char(','), create.ScriptLocalVarBoolOrLiteral(), create.Char(')'), - })); // playMenuVideo '(' <video name> ',' ((localVarInt '(' <var name> ')') | <offset>) ',' ((localVarBool '(' <var name> ')') | <maybe looping - // bool>) ')' - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setBackgroundVideo"), - create.Char('('), - create.ScriptText(), - create.Char(')')})); // setBackgroundVideo '(' <video name or empty string> ')' - AddSequence(SequenceGenericScriptStatement::Create( - {create.ScriptKeyword("clearEntitlementNew"), create.ScriptText()})); // clearEntitlementNew <entitlement name> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setPastTitleRank")})); // unknown - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setPastTitlePrestige")})); // unknown - AddSequence( - SequenceGenericScriptStatement::Create({create.ScriptKeyword("anticheat_bancheck"), create.ScriptStrictNumeric()})); // anticheat_bancheck <num> + })); // playMenuVideo '(' <video name> ',' ((localVarInt '(' <var name> ')') | <offset>) ',' ((localVarBool '(' <var name> ')') | + // <maybe_looping_bool>) ')' + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setBackgroundVideo"), + create.Char('('), + create.ScriptText(), + create.Char(')'), + })); // setBackgroundVideo '(' <video name or empty string> ')' + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("clearEntitlementNew"), + create.ScriptText(), + })); // clearEntitlementNew <entitlement name> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setPastTitleRank"), + })); // unknown + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setPastTitlePrestige"), + })); // unknown + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("anticheat_bancheck"), + create.ScriptStrictNumeric(), + })); // anticheat_bancheck <num> // UiScripts - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("LoadSaveGames")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("LoadGame")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("SaveGame")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("ForceSave")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("DelSaveGame")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("SaveGameSort"), create.ScriptStrictInt()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("playerStart")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("saveComplete")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("saveRevert")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("resetvscroll"), create.ScriptText()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RefreshLeaderboards")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("ViewGamerCard")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("OpenLeaderboard"), create.ScriptText()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("OpenLeaderboardExt"), create.ScriptText(), create.Optional(create.Text())})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("ClearLeaderboard")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FriendStoreXUID")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FriendClearXUID")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FriendInvite")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FriendJoin")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FriendGamerCard")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FriendReportOffensive")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FriendReportExploiter")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FriendReportCheater")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FriendReportBooster")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RecentPlayerStoreXUID")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RecentPlayerClearXUID")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RecentPlayerGamerCard")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RecentPlayerFriendRequest")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RecentPlayerShowGroups")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RecentPlayerJoin")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RecentPlayerInvite")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RecentPlayerReportOffensive")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RecentPlayerReportExploiter")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RecentPlayerReportCheater")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RecentPlayerReportBooster")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FacebookStoreXUID")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FacebookClearXUID")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FacebookGamerCard")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FacebookFriendRequest")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FacebookPageRight")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FacebookPageLeft")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FacebookJoin")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FacebookInvite")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FacebookReportOffensive")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FacebookReportExploiter")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FacebookReportCheater")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FacebookReportBooster")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("EliteClanStoreXUID")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("EliteClanClearXUID")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("EliteClanGamerCard")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("EliteClanFriendRequest")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("EliteClanJoin")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("EliteClanInvite")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("EliteClanReportOffensive")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("EliteClanReportExploiter")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("EliteClanReportCheater")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("EliteClanReportBooster")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("coopPlayerShowGroups"), create.ScriptStrictInt()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("simulateKeyPress"), create.ScriptStrictInt()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("commerceShowStore")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("voteTypeMap")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("voteMap")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("voteGame")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RefreshServers")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RefreshFilter")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("closeJoin")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("StopRefresh")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("TrimRecipeName")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("ResetRecipeList")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("SelectServer")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("ShowCurrentServerTooltip")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("voteTempBan")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("addFavorite")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("deleteFavorite")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("PlayDemo")})); - AddSequence( - SequenceUiScriptStatement::Create({create.ScriptKeyword("SwitchSegmentTransition"), create.ScriptStrictInt(), create.ScriptStrictInt()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("PreviewSegment")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("MoveSegment"), create.ScriptStrictInt()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("DeleteSegment")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("SetFocusOnSegmentButton")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("PopulateLocalDemoFileInformation")})); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("LoadSaveGames"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("LoadGame"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("SaveGame"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("ForceSave"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("DelSaveGame"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("SaveGameSort"), + create.ScriptStrictInt(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("playerStart"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("saveComplete"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("saveRevert"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("resetvscroll"), + create.ScriptText(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RefreshLeaderboards"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("ViewGamerCard"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("OpenLeaderboard"), + create.ScriptText(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("OpenLeaderboardExt"), + create.ScriptText(), + create.Optional(create.Text()), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("ClearLeaderboard"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FriendStoreXUID"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FriendClearXUID"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FriendInvite"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FriendJoin"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FriendGamerCard"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FriendReportOffensive"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FriendReportExploiter"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FriendReportCheater"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FriendReportBooster"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RecentPlayerStoreXUID"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RecentPlayerClearXUID"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RecentPlayerGamerCard"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RecentPlayerFriendRequest"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RecentPlayerShowGroups"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RecentPlayerJoin"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RecentPlayerInvite"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RecentPlayerReportOffensive"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RecentPlayerReportExploiter"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RecentPlayerReportCheater"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RecentPlayerReportBooster"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FacebookStoreXUID"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FacebookClearXUID"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FacebookGamerCard"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FacebookFriendRequest"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FacebookPageRight"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FacebookPageLeft"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FacebookJoin"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FacebookInvite"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FacebookReportOffensive"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FacebookReportExploiter"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FacebookReportCheater"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FacebookReportBooster"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("EliteClanStoreXUID"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("EliteClanClearXUID"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("EliteClanGamerCard"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("EliteClanFriendRequest"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("EliteClanJoin"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("EliteClanInvite"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("EliteClanReportOffensive"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("EliteClanReportExploiter"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("EliteClanReportCheater"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("EliteClanReportBooster"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("coopPlayerShowGroups"), + create.ScriptStrictInt(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("simulateKeyPress"), + create.ScriptStrictInt(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("commerceShowStore"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("voteTypeMap"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("voteMap"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("voteGame"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RefreshServers"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RefreshFilter"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("closeJoin"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("StopRefresh"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("TrimRecipeName"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("ResetRecipeList"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("SelectServer"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("ShowCurrentServerTooltip"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("voteTempBan"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("addFavorite"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("deleteFavorite"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("PlayDemo"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("SwitchSegmentTransition"), + create.ScriptStrictInt(), + create.ScriptStrictInt(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("PreviewSegment"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("MoveSegment"), + create.ScriptStrictInt(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("DeleteSegment"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("SetFocusOnSegmentButton"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("PopulateLocalDemoFileInformation"), + })); AddSequence(std::make_unique<SequenceOnlineVault>()); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("Playlist"), - create.Or({ - create.And({ - create.ScriptKeyword("Open"), - create.ScriptStrictInt(), - }), - create.ScriptKeyword("DoAction"), - create.ScriptKeyword("Close"), - create.ScriptKeyword("CloseAll"), - })})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("UpdateArenas")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("SortChallengesTop")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("xlaunchelitesearch")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("xlaunchelitelaunch")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("xlaunchelitestore")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("LobbyShowGroups")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("addPlayerProfiles")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("createPlayerProfile")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("deletePlayerProfile")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("loadPlayerProfile")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("selectActivePlayerProfile")})); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("Playlist"), + create.Or({ + create.And({ + create.ScriptKeyword("Open"), + create.ScriptStrictInt(), + }), + create.ScriptKeyword("DoAction"), + create.ScriptKeyword("Close"), + create.ScriptKeyword("CloseAll"), + }), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("UpdateArenas"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("SortChallengesTop"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("xlaunchelitesearch"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("xlaunchelitelaunch"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("xlaunchelitestore"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("LobbyShowGroups"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("addPlayerProfiles"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("createPlayerProfile"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("deletePlayerProfile"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("loadPlayerProfile"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("selectActivePlayerProfile"), + })); } } diff --git a/src/ObjLoading/Parsing/Menu/Sequence/FunctionScopeSequences.cpp b/src/ObjLoading/Parsing/Menu/Sequence/FunctionScopeSequences.cpp index bf749de03..5459a3dd6 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/FunctionScopeSequences.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/FunctionScopeSequences.cpp @@ -19,7 +19,9 @@ namespace menu::function_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({create.Char('}').Capture(CAPTURE_TOKEN)}); + AddMatchers({ + create.Char('}').Capture(CAPTURE_TOKEN), + }); } protected: diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericBoolPropertySequence.cpp b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericBoolPropertySequence.cpp index d098304f6..ac44837f9 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericBoolPropertySequence.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericBoolPropertySequence.cpp @@ -11,7 +11,10 @@ GenericBoolPropertySequence::GenericBoolPropertySequence(std::string keywordName { const MenuMatcherFactory create(this); - AddMatchers({create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN), create.Integer().Capture(CAPTURE_VALUE)}); + AddMatchers({ + create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN), + create.Integer().Capture(CAPTURE_VALUE), + }); } void GenericBoolPropertySequence::ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericColorPropertySequence.cpp b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericColorPropertySequence.cpp index 0ad92d427..53856cd10 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericColorPropertySequence.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericColorPropertySequence.cpp @@ -18,7 +18,7 @@ GenericColorPropertySequence::GenericColorPropertySequence(std::string keywordNa create.NumericExpression().Tag(TAG_COLOR), // r create.Optional(create.NumericExpression().Tag(TAG_COLOR)), // g create.Optional(create.NumericExpression().Tag(TAG_COLOR)), // b - create.Optional(create.NumericExpression().Tag(TAG_COLOR)) // a + create.Optional(create.NumericExpression().Tag(TAG_COLOR)), // a }); } diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericExpressionPropertySequence.cpp b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericExpressionPropertySequence.cpp index 08d9a3964..dd793646f 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericExpressionPropertySequence.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericExpressionPropertySequence.cpp @@ -19,9 +19,11 @@ std::unique_ptr<GenericExpressionPropertySequence> GenericExpressionPropertySequ auto result = std::unique_ptr<GenericExpressionPropertySequence>(new GenericExpressionPropertySequence(std::move(setCallback))); const MenuMatcherFactory create(result.get()); - result->AddMatchers({create.KeywordIgnoreCase(std::move(keyword)).Capture(CAPTURE_FIRST_TOKEN), - create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), - create.Optional(create.Char(';'))}); + result->AddMatchers({ + create.KeywordIgnoreCase(std::move(keyword)).Capture(CAPTURE_FIRST_TOKEN), + create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), + create.Optional(create.Char(';')), + }); return std::move(result); } @@ -36,9 +38,11 @@ std::unique_ptr<GenericExpressionPropertySequence> GenericExpressionPropertySequ for (auto keyword : keywords) keywordMatchers.emplace_back(create.KeywordIgnoreCase(std::move(keyword))); - result->AddMatchers({create.And(std::move(keywordMatchers)).Capture(CAPTURE_FIRST_TOKEN), - create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), - create.Optional(create.Char(';'))}); + result->AddMatchers({ + create.And(std::move(keywordMatchers)).Capture(CAPTURE_FIRST_TOKEN), + create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), + create.Optional(create.Char(';')), + }); return std::move(result); } @@ -48,10 +52,12 @@ std::unique_ptr<GenericExpressionPropertySequence> GenericExpressionPropertySequ auto result = std::unique_ptr<GenericExpressionPropertySequence>(new GenericExpressionPropertySequence(std::move(setCallback))); const MenuMatcherFactory create(result.get()); - result->AddMatchers({create.KeywordIgnoreCase(std::move(keyword)).Capture(CAPTURE_FIRST_TOKEN), - create.Optional(create.KeywordIgnoreCase("when")), - create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), - create.Optional(create.Char(';'))}); + result->AddMatchers({ + create.KeywordIgnoreCase(std::move(keyword)).Capture(CAPTURE_FIRST_TOKEN), + create.Optional(create.KeywordIgnoreCase("when")), + create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), + create.Optional(create.Char(';')), + }); return std::move(result); } diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericFloatingPointPropertySequence.cpp b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericFloatingPointPropertySequence.cpp index e9156d618..4582e91b9 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericFloatingPointPropertySequence.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericFloatingPointPropertySequence.cpp @@ -13,7 +13,10 @@ GenericFloatingPointPropertySequence::GenericFloatingPointPropertySequence(std:: const MenuMatcherFactory create(this); AddLabeledMatchers(MenuExpressionMatchers().Expression(this), MenuExpressionMatchers::LABEL_EXPRESSION); - AddMatchers({create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN), create.NumericExpression()}); + AddMatchers({ + create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN), + create.NumericExpression(), + }); } void GenericFloatingPointPropertySequence::ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericMenuEventHandlerSetPropertySequence.cpp b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericMenuEventHandlerSetPropertySequence.cpp index 39c68f375..131cbf005 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericMenuEventHandlerSetPropertySequence.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericMenuEventHandlerSetPropertySequence.cpp @@ -11,7 +11,10 @@ GenericMenuEventHandlerSetPropertySequence::GenericMenuEventHandlerSetPropertySe { const MenuMatcherFactory create(this); - AddMatchers({create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN), create.Char('{')}); + AddMatchers({ + create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN), + create.Char('{'), + }); } void GenericMenuEventHandlerSetPropertySequence::ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericStringPropertySequence.cpp b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericStringPropertySequence.cpp index 8a800b6d3..c0faa0744 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericStringPropertySequence.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericStringPropertySequence.cpp @@ -11,7 +11,10 @@ GenericStringPropertySequence::GenericStringPropertySequence(std::string keyword { const MenuMatcherFactory create(this); - AddMatchers({create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN), create.Text().Capture(CAPTURE_VALUE)}); + AddMatchers({ + create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN), + create.Text().Capture(CAPTURE_VALUE), + }); } void GenericStringPropertySequence::ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const diff --git a/src/ObjLoading/Parsing/Menu/Sequence/GlobalScopeSequences.cpp b/src/ObjLoading/Parsing/Menu/Sequence/GlobalScopeSequences.cpp index 23e85c0cc..ec034cca1 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/GlobalScopeSequences.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/GlobalScopeSequences.cpp @@ -14,7 +14,9 @@ namespace menu::global_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({create.Char('}')}); + AddMatchers({ + create.Char('}'), + }); } protected: diff --git a/src/ObjLoading/Parsing/Menu/Sequence/ItemScopeSequences.cpp b/src/ObjLoading/Parsing/Menu/Sequence/ItemScopeSequences.cpp index a3f24a3db..cf6f6ad4a 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/ItemScopeSequences.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/ItemScopeSequences.cpp @@ -42,7 +42,7 @@ class ItemScopeOperations CommonItemFeatureType::NEWS_TICKER, // ITEM_TYPE_NEWS_TICKER CommonItemFeatureType::NONE, // ITEM_TYPE_TEXT_SCROLL CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_EMAILFIELD - CommonItemFeatureType::EDIT_FIELD // ITEM_TYPE_PASSWORDFIELD + CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_PASSWORDFIELD }; inline static const CommonItemFeatureType IW5_FEATURE_TYPE_BY_TYPE[0x18]{ @@ -69,7 +69,7 @@ class ItemScopeOperations CommonItemFeatureType::NEWS_TICKER, // ITEM_TYPE_NEWS_TICKER CommonItemFeatureType::NONE, // ITEM_TYPE_TEXT_SCROLL CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_EMAILFIELD - CommonItemFeatureType::EDIT_FIELD // ITEM_TYPE_PASSWORDFIELD + CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_PASSWORDFIELD }; public: @@ -158,7 +158,9 @@ namespace menu::item_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({create.Char('}')}); + AddMatchers({ + create.Char('}'), + }); } protected: @@ -175,7 +177,9 @@ namespace menu::item_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({create.Char(';')}); + AddMatchers({ + create.Char(';'), + }); } protected: @@ -193,12 +197,17 @@ namespace menu::item_scope_sequences const MenuMatcherFactory create(this); AddLabeledMatchers(MenuExpressionMatchers().Expression(this), MenuExpressionMatchers::LABEL_EXPRESSION); - AddMatchers({create.KeywordIgnoreCase("rect"), - create.NumericExpression(), // x - create.NumericExpression(), // y - create.NumericExpression(), // w - create.NumericExpression(), // h - create.Optional(create.And({create.Integer().Capture(CAPTURE_ALIGN_HORIZONTAL), create.Integer().Capture(CAPTURE_ALIGN_VERTICAL)}))}); + AddMatchers({ + create.KeywordIgnoreCase("rect"), + create.NumericExpression(), // x + create.NumericExpression(), // y + create.NumericExpression(), // w + create.NumericExpression(), // h + create.Optional(create.And({ + create.Integer().Capture(CAPTURE_ALIGN_HORIZONTAL), + create.Integer().Capture(CAPTURE_ALIGN_VERTICAL), + })), + }); } protected: @@ -233,7 +242,7 @@ namespace menu::item_scope_sequences AddMatchers({ create.KeywordIgnoreCase("origin"), create.NumericExpression(), // x - create.NumericExpression() // y + create.NumericExpression(), // y }); } @@ -298,8 +307,13 @@ namespace menu::item_scope_sequences AddMatchers({ create.KeywordIgnoreCase(std::move(keyName)).Capture(CAPTURE_FIRST_TOKEN), create.Char('{'), - create.Optional(create.And( - {create.Text().Capture(CAPTURE_VALUE), create.OptionalLoop(create.And({create.Char(';'), create.Text().Capture(CAPTURE_VALUE)}))})), + create.Optional(create.And({ + create.Text().Capture(CAPTURE_VALUE), + create.OptionalLoop(create.And({ + create.Char(';'), + create.Text().Capture(CAPTURE_VALUE), + })), + })), create.Char('}'), }); } @@ -364,15 +378,17 @@ namespace menu::item_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({create.KeywordIgnoreCase("dvarStrList").Capture(CAPTURE_FIRST_TOKEN), - create.Char('{'), - create.OptionalLoop(create.And({ - create.TextNoChain().Capture(CAPTURE_STEP_NAME), - create.Optional(create.Char(';')), - create.TextNoChain().Capture(CAPTURE_STEP_VALUE), - create.Optional(create.Char(';')), - })), - create.Char('}')}); + AddMatchers({ + create.KeywordIgnoreCase("dvarStrList").Capture(CAPTURE_FIRST_TOKEN), + create.Char('{'), + create.OptionalLoop(create.And({ + create.TextNoChain().Capture(CAPTURE_STEP_NAME), + create.Optional(create.Char(';')), + create.TextNoChain().Capture(CAPTURE_STEP_VALUE), + create.Optional(create.Char(';')), + })), + create.Char('}'), + }); } protected: @@ -402,15 +418,17 @@ namespace menu::item_scope_sequences const MenuMatcherFactory create(this); AddLabeledMatchers(MenuExpressionMatchers().Expression(this), MenuExpressionMatchers::LABEL_EXPRESSION); - AddMatchers({create.KeywordIgnoreCase("dvarFloatList").Capture(CAPTURE_FIRST_TOKEN), - create.Char('{'), - create.OptionalLoop(create.And({ - create.Text().Capture(CAPTURE_STEP_NAME), - create.Optional(create.Char(';')), - create.NumericExpression(), - create.Optional(create.Char(';')), - })), - create.Char('}')}); + AddMatchers({ + create.KeywordIgnoreCase("dvarFloatList").Capture(CAPTURE_FIRST_TOKEN), + create.Char('{'), + create.OptionalLoop(create.And({ + create.Text().Capture(CAPTURE_STEP_NAME), + create.Optional(create.Char(';')), + create.NumericExpression(), + create.Optional(create.Char(';')), + })), + create.Char('}'), + }); } protected: @@ -485,12 +503,14 @@ namespace menu::item_scope_sequences const auto& listBoxFeatures = state->m_current_item->m_list_box_features; while (result.HasNextCapture(CAPTURE_X_POS)) { - CommonItemFeaturesListBox::Column column{result.NextCapture(CAPTURE_X_POS).IntegerValue(), - state->m_feature_level == FeatureLevel::IW5 ? result.NextCapture(CAPTURE_Y_POS).IntegerValue() : 0, - result.NextCapture(CAPTURE_WIDTH).IntegerValue(), - state->m_feature_level == FeatureLevel::IW5 ? result.NextCapture(CAPTURE_HEIGHT).IntegerValue() : 0, - result.NextCapture(CAPTURE_MAX_CHARS).IntegerValue(), - result.NextCapture(CAPTURE_ALIGNMENT).IntegerValue()}; + CommonItemFeaturesListBox::Column column{ + result.NextCapture(CAPTURE_X_POS).IntegerValue(), + state->m_feature_level == FeatureLevel::IW5 ? result.NextCapture(CAPTURE_Y_POS).IntegerValue() : 0, + result.NextCapture(CAPTURE_WIDTH).IntegerValue(), + state->m_feature_level == FeatureLevel::IW5 ? result.NextCapture(CAPTURE_HEIGHT).IntegerValue() : 0, + result.NextCapture(CAPTURE_MAX_CHARS).IntegerValue(), + result.NextCapture(CAPTURE_ALIGNMENT).IntegerValue(), + }; listBoxFeatures->m_columns.emplace_back(column); } } @@ -505,7 +525,11 @@ namespace menu::item_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({create.KeywordIgnoreCase("execKey"), create.StringChain().Capture(CAPTURE_KEY), create.Char('{')}); + AddMatchers({ + create.KeywordIgnoreCase("execKey"), + create.StringChain().Capture(CAPTURE_KEY), + create.Char('{'), + }); } protected: @@ -537,7 +561,11 @@ namespace menu::item_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({create.KeywordIgnoreCase("execKeyInt"), create.Integer().Capture(CAPTURE_KEY), create.Char('{')}); + AddMatchers({ + create.KeywordIgnoreCase("execKeyInt"), + create.Integer().Capture(CAPTURE_KEY), + create.Char('{'), + }); } protected: diff --git a/src/ObjLoading/Parsing/Menu/Sequence/MenuScopeSequences.cpp b/src/ObjLoading/Parsing/Menu/Sequence/MenuScopeSequences.cpp index ec85215dd..8b8efced6 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/MenuScopeSequences.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/MenuScopeSequences.cpp @@ -28,7 +28,9 @@ namespace menu::menu_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({create.Char('}').Capture(CAPTURE_TOKEN)}); + AddMatchers({ + create.Char('}').Capture(CAPTURE_TOKEN), + }); } protected: @@ -59,7 +61,9 @@ namespace menu::menu_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({create.Char(';')}); + AddMatchers({ + create.Char(';'), + }); } protected: @@ -75,7 +79,10 @@ namespace menu::menu_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({create.Keyword("itemDef"), create.Char('{')}); + AddMatchers({ + create.Keyword("itemDef"), + create.Char('{'), + }); } protected: @@ -98,12 +105,17 @@ namespace menu::menu_scope_sequences const MenuMatcherFactory create(this); AddLabeledMatchers(MenuExpressionMatchers().Expression(this), MenuExpressionMatchers::LABEL_EXPRESSION); - AddMatchers({create.KeywordIgnoreCase("rect"), - create.NumericExpression(), // x - create.NumericExpression(), // y - create.NumericExpression(), // w - create.NumericExpression(), // h - create.Optional(create.And({create.Integer().Capture(CAPTURE_ALIGN_HORIZONTAL), create.Integer().Capture(CAPTURE_ALIGN_VERTICAL)}))}); + AddMatchers({ + create.KeywordIgnoreCase("rect"), + create.NumericExpression(), // x + create.NumericExpression(), // y + create.NumericExpression(), // w + create.NumericExpression(), // h + create.Optional(create.And({ + create.Integer().Capture(CAPTURE_ALIGN_HORIZONTAL), + create.Integer().Capture(CAPTURE_ALIGN_VERTICAL), + })), + }); } protected: @@ -136,7 +148,11 @@ namespace menu::menu_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({create.KeywordIgnoreCase("execKey"), create.StringChain().Capture(CAPTURE_KEY), create.Char('{')}); + AddMatchers({ + create.KeywordIgnoreCase("execKey"), + create.StringChain().Capture(CAPTURE_KEY), + create.Char('{'), + }); } protected: @@ -168,7 +184,11 @@ namespace menu::menu_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({create.KeywordIgnoreCase("execKeyInt"), create.Integer().Capture(CAPTURE_KEY), create.Char('{')}); + AddMatchers({ + create.KeywordIgnoreCase("execKeyInt"), + create.Integer().Capture(CAPTURE_KEY), + create.Char('{'), + }); } protected: diff --git a/src/ObjLoading/Parsing/Menu/Sequence/NoScopeSequences.cpp b/src/ObjLoading/Parsing/Menu/Sequence/NoScopeSequences.cpp index 34f4de888..213e91438 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/NoScopeSequences.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/NoScopeSequences.cpp @@ -14,7 +14,9 @@ namespace menu::no_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({create.Char('{')}); + AddMatchers({ + create.Char('{'), + }); } protected: diff --git a/src/ObjLoading/StateMap/Parsing/StateMapParser.cpp b/src/ObjLoading/StateMap/Parsing/StateMapParser.cpp index f0e7edcc8..12a29f29e 100644 --- a/src/ObjLoading/StateMap/Parsing/StateMapParser.cpp +++ b/src/ObjLoading/StateMap/Parsing/StateMapParser.cpp @@ -16,7 +16,10 @@ namespace state_map { const SimpleMatcherFactory create(this); - AddMatchers({create.Identifier().Capture(CAPTURE_ENTRY_NAME), create.Char('{')}); + AddMatchers({ + create.Identifier().Capture(CAPTURE_ENTRY_NAME), + create.Char('{'), + }); } protected: @@ -42,7 +45,9 @@ namespace state_map { const SimpleMatcherFactory create(this); - AddMatchers({create.Char('}').Capture(CAPTURE_FIRST_TOKEN)}); + AddMatchers({ + create.Char('}').Capture(CAPTURE_FIRST_TOKEN), + }); } protected: @@ -67,9 +72,13 @@ namespace state_map AddLabeledMatchers(StateMapExpressionMatchers().Expression(this), StateMapExpressionMatchers::LABEL_EXPRESSION); const SimpleMatcherFactory create(this); - AddMatchers( - {create.Or({create.Keyword("default").Tag(TAG_DEFAULT), create.Label(StateMapExpressionMatchers::LABEL_EXPRESSION).Tag(TAG_EXPRESSION)}), - create.Char(':')}); + AddMatchers({ + create.Or({ + create.Keyword("default").Tag(TAG_DEFAULT), + create.Label(StateMapExpressionMatchers::LABEL_EXPRESSION).Tag(TAG_EXPRESSION), + }), + create.Char(':'), + }); } protected: @@ -117,14 +126,29 @@ namespace state_map { const SimpleMatcherFactory create(this); - AddLabeledMatchers(create.Or({create.Identifier(), create.Integer()}), LABEL_VALUE); + AddLabeledMatchers(create.Or({ + create.Identifier(), + create.Integer(), + }), + LABEL_VALUE); - AddLabeledMatchers({create.Label(LABEL_VALUE).Capture(CAPTURE_VALUE), - create.OptionalLoop(create.And({create.Char(','), create.Label(LABEL_VALUE).Capture(CAPTURE_VALUE)}))}, - LABEL_VALUE_LIST); - - AddMatchers({create.Or({create.Keyword("passthrough").Tag(TAG_PASSTHROUGH), create.Label(LABEL_VALUE_LIST).Tag(TAG_VALUE_LIST)}), - create.Char(';').Capture(CAPTURE_VALUE_END)}); + AddLabeledMatchers( + { + create.Label(LABEL_VALUE).Capture(CAPTURE_VALUE), + create.OptionalLoop(create.And({ + create.Char(','), + create.Label(LABEL_VALUE).Capture(CAPTURE_VALUE), + })), + }, + LABEL_VALUE_LIST); + + AddMatchers({ + create.Or({ + create.Keyword("passthrough").Tag(TAG_PASSTHROUGH), + create.Label(LABEL_VALUE_LIST).Tag(TAG_VALUE_LIST), + }), + create.Char(';').Capture(CAPTURE_VALUE_END), + }); } protected: @@ -195,11 +219,19 @@ StateMapParser::StateMapParser(SimpleLexer* lexer, std::string stateMapName, con const std::vector<StateMapParser::sequence_t*>& StateMapParser::GetTestsForState() { - static std::vector<sequence_t*> rootSequences({new SequenceStateMapEntry()}); - - static std::vector<sequence_t*> entrySequences({new SequenceStateMapEntryClose(), new SequenceCondition()}); - - static std::vector<sequence_t*> ruleSequences({new SequenceCondition(), new SequenceValue()}); + static std::vector<sequence_t*> rootSequences({ + new SequenceStateMapEntry(), + }); + + static std::vector<sequence_t*> entrySequences({ + new SequenceStateMapEntryClose(), + new SequenceCondition(), + }); + + static std::vector<sequence_t*> ruleSequences({ + new SequenceCondition(), + new SequenceValue(), + }); if (m_state->m_in_entry) { diff --git a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataDefScopeSequences.cpp b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataDefScopeSequences.cpp index ab11f31b6..e4100de8e 100644 --- a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataDefScopeSequences.cpp +++ b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataDefScopeSequences.cpp @@ -17,10 +17,16 @@ namespace sdd::def_scope_sequences { const SimpleMatcherFactory create(this); - AddMatchers({create.Keyword("enum"), - create.Optional(create.And({create.Char('('), create.Integer().Capture(CAPTURE_RESERVED_COUNT), create.Char(')')})), - create.Identifier().Capture(CAPTURE_NAME), - create.Char('{')}); + AddMatchers({ + create.Keyword("enum"), + create.Optional(create.And({ + create.Char('('), + create.Integer().Capture(CAPTURE_RESERVED_COUNT), + create.Char(')'), + })), + create.Identifier().Capture(CAPTURE_NAME), + create.Char('{'), + }); } protected: @@ -70,7 +76,11 @@ namespace sdd::def_scope_sequences { const SimpleMatcherFactory create(this); - AddMatchers({create.Keyword("struct"), create.Identifier().Capture(CAPTURE_NAME), create.Char('{')}); + AddMatchers({ + create.Keyword("struct"), + create.Identifier().Capture(CAPTURE_NAME), + create.Char('{'), + }); } protected: @@ -126,7 +136,11 @@ namespace sdd::def_scope_sequences { const SimpleMatcherFactory create(this); - AddMatchers({create.Keyword("checksumoverride"), create.Integer().Capture(CAPTURE_VALUE), create.Char(';')}); + AddMatchers({ + create.Keyword("checksumoverride"), + create.Integer().Capture(CAPTURE_VALUE), + create.Char(';'), + }); } protected: @@ -148,7 +162,9 @@ namespace sdd::def_scope_sequences { const SimpleMatcherFactory create(this); - AddMatchers({create.Char('}')}); + AddMatchers({ + create.Char('}'), + }); } private: diff --git a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataEnumScopeSequences.cpp b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataEnumScopeSequences.cpp index 5f93e0085..9ee63a2c3 100644 --- a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataEnumScopeSequences.cpp +++ b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataEnumScopeSequences.cpp @@ -15,7 +15,13 @@ namespace sdd::enum_scope_sequences { const SimpleMatcherFactory create(this); - AddMatchers({create.String().Capture(CAPTURE_ENTRY_VALUE), create.Or({create.Char(','), create.Char('}').NoConsume()})}); + AddMatchers({ + create.String().Capture(CAPTURE_ENTRY_VALUE), + create.Or({ + create.Char(','), + create.Char('}').NoConsume(), + }), + }); } protected: @@ -39,7 +45,10 @@ namespace sdd::enum_scope_sequences { const SimpleMatcherFactory create(this); - AddMatchers({create.Char('}'), create.Optional(create.Char(';'))}); + AddMatchers({ + create.Char('}'), + create.Optional(create.Char(';')), + }); } protected: diff --git a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataNoScopeSequences.cpp b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataNoScopeSequences.cpp index 2193bad02..db77583fc 100644 --- a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataNoScopeSequences.cpp +++ b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataNoScopeSequences.cpp @@ -13,7 +13,11 @@ namespace sdd::no_scope_sequences { const SimpleMatcherFactory create(this); - AddMatchers({create.Keyword("version"), create.Integer().Capture(CAPTURE_VERSION), create.Char('{')}); + AddMatchers({ + create.Keyword("version"), + create.Integer().Capture(CAPTURE_VERSION), + create.Char('{'), + }); } protected: diff --git a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataStructScopeSequences.cpp b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataStructScopeSequences.cpp index 496589911..bde662ecc 100644 --- a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataStructScopeSequences.cpp +++ b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataStructScopeSequences.cpp @@ -24,21 +24,34 @@ namespace sdd::struct_scope_sequences static std::unique_ptr<matcher_t> TypeMatchers(const SimpleMatcherFactory& create) { - return create.Or({create.Keyword("int").Tag(TAG_TYPE_INT), - create.Keyword("byte").Tag(TAG_TYPE_BYTE), - create.Keyword("bool").Tag(TAG_TYPE_BOOL), - create.Keyword("float").Tag(TAG_TYPE_FLOAT), - create.Keyword("short").Tag(TAG_TYPE_SHORT), - create.And({create.Keyword("string"), create.Char('('), create.Integer().Capture(CAPTURE_STRING_LENGTH), create.Char(')')}) - .Tag(TAG_TYPE_STRING), - create.Identifier().Tag(TAG_TYPE_NAMED).Capture(CAPTURE_TYPE_NAME)}); + return create.Or({ + create.Keyword("int").Tag(TAG_TYPE_INT), + create.Keyword("byte").Tag(TAG_TYPE_BYTE), + create.Keyword("bool").Tag(TAG_TYPE_BOOL), + create.Keyword("float").Tag(TAG_TYPE_FLOAT), + create.Keyword("short").Tag(TAG_TYPE_SHORT), + create + .And({ + create.Keyword("string"), + create.Char('('), + create.Integer().Capture(CAPTURE_STRING_LENGTH), + create.Char(')'), + }) + .Tag(TAG_TYPE_STRING), + create.Identifier().Tag(TAG_TYPE_NAMED).Capture(CAPTURE_TYPE_NAME), + }); } static std::unique_ptr<matcher_t> ArrayMatchers(const SimpleMatcherFactory& create) { - return create.And({create.Char('['), - create.Or({create.Integer().Capture(CAPTURE_ARRAY_SIZE), create.Identifier().Capture(CAPTURE_ARRAY_SIZE)}), - create.Char(']')}); + return create.And({ + create.Char('['), + create.Or({ + create.Integer().Capture(CAPTURE_ARRAY_SIZE), + create.Identifier().Capture(CAPTURE_ARRAY_SIZE), + }), + create.Char(']'), + }); } public: @@ -46,7 +59,12 @@ namespace sdd::struct_scope_sequences { const SimpleMatcherFactory create(this); - AddMatchers({TypeMatchers(create), create.Identifier().Capture(CAPTURE_ENTRY_NAME), create.OptionalLoop(ArrayMatchers(create)), create.Char(';')}); + AddMatchers({ + TypeMatchers(create), + create.Identifier().Capture(CAPTURE_ENTRY_NAME), + create.OptionalLoop(ArrayMatchers(create)), + create.Char(';'), + }); } private: @@ -178,7 +196,13 @@ namespace sdd::struct_scope_sequences { const SimpleMatcherFactory create(this); - AddMatchers({create.Keyword("pad"), create.Char('('), create.Integer().Capture(CAPTURE_PADDING_VALUE), create.Char(')'), create.Char(';')}); + AddMatchers({ + create.Keyword("pad"), + create.Char('('), + create.Integer().Capture(CAPTURE_PADDING_VALUE), + create.Char(')'), + create.Char(';'), + }); } protected: @@ -201,7 +225,10 @@ namespace sdd::struct_scope_sequences { const SimpleMatcherFactory create(this); - AddMatchers({create.Char('}'), create.Optional(create.Char(';'))}); + AddMatchers({ + create.Char('}'), + create.Optional(create.Char(';')), + }); } protected: diff --git a/src/ObjLoading/Techset/Parsing/Sequence/TechniqueNoScopeSequences.cpp b/src/ObjLoading/Techset/Parsing/Sequence/TechniqueNoScopeSequences.cpp index f6c5e1375..f94e1a71f 100644 --- a/src/ObjLoading/Techset/Parsing/Sequence/TechniqueNoScopeSequences.cpp +++ b/src/ObjLoading/Techset/Parsing/Sequence/TechniqueNoScopeSequences.cpp @@ -15,7 +15,9 @@ namespace techset { const SimpleMatcherFactory create(this); - AddMatchers({create.Char('{')}); + AddMatchers({ + create.Char('{'), + }); } protected: @@ -31,7 +33,9 @@ namespace techset const std::vector<TechniqueParser::sequence_t*>& TechniqueNoScopeSequences::GetSequences() { - static std::vector<TechniqueParser::sequence_t*> tests({new SequencePass()}); + static std::vector<TechniqueParser::sequence_t*> tests({ + new SequencePass(), + }); return tests; } diff --git a/src/ObjLoading/Techset/Parsing/Sequence/TechniquePassScopeSequences.cpp b/src/ObjLoading/Techset/Parsing/Sequence/TechniquePassScopeSequences.cpp index 009a51d5f..fca643b8b 100644 --- a/src/ObjLoading/Techset/Parsing/Sequence/TechniquePassScopeSequences.cpp +++ b/src/ObjLoading/Techset/Parsing/Sequence/TechniquePassScopeSequences.cpp @@ -18,7 +18,9 @@ namespace techset { const SimpleMatcherFactory create(this); - AddMatchers({create.Char('}').Capture(CAPTURE_FIRST_TOKEN)}); + AddMatchers({ + create.Char('}').Capture(CAPTURE_FIRST_TOKEN), + }); } protected: @@ -44,7 +46,11 @@ namespace techset { const SimpleMatcherFactory create(this); - AddMatchers({create.Keyword("stateMap").Capture(CAPTURE_START), create.String().Capture(CAPTURE_STATE_MAP_NAME), create.Char(';')}); + AddMatchers({ + create.Keyword("stateMap").Capture(CAPTURE_START), + create.String().Capture(CAPTURE_STATE_MAP_NAME), + create.Char(';'), + }); } protected: @@ -76,21 +82,25 @@ namespace techset { const SimpleMatcherFactory create(this); - AddMatchers({create - .Or({ - create.Keyword("vertexShader").Tag(TAG_VERTEX_SHADER), - create.Keyword("pixelShader").Tag(TAG_PIXEL_SHADER), - }) - .Capture(CAPTURE_START), - create.Or({create.And({ - create.Integer().Capture(CAPTURE_VERSION_MAJOR), - create.Char('.'), - create.Integer().Capture(CAPTURE_VERSION_MINOR), - }), - create.FloatingPoint().Capture(CAPTURE_VERSION), // This is dumb but cod devs made the format so cannot change it - create.String().Capture(CAPTURE_VERSION)}), - create.String().Capture(CAPTURE_SHADER_NAME), - create.Char('{')}); + AddMatchers({ + create + .Or({ + create.Keyword("vertexShader").Tag(TAG_VERTEX_SHADER), + create.Keyword("pixelShader").Tag(TAG_PIXEL_SHADER), + }) + .Capture(CAPTURE_START), + create.Or({ + create.And({ + create.Integer().Capture(CAPTURE_VERSION_MAJOR), + create.Char('.'), + create.Integer().Capture(CAPTURE_VERSION_MINOR), + }), + create.FloatingPoint().Capture(CAPTURE_VERSION), // This is dumb but cod devs made the format so cannot change it + create.String().Capture(CAPTURE_VERSION), + }), + create.String().Capture(CAPTURE_SHADER_NAME), + create.Char('{'), + }); } protected: @@ -137,19 +147,29 @@ namespace techset { const SimpleMatcherFactory create(this); - AddMatchers({create.Keyword("vertex").Capture(CAPTURE_FIRST_TOKEN), - create.Char('.'), - create.Identifier().Capture(CAPTURE_STREAM_DESTINATION_NAME), - create.Optional(create.And({create.Char('['), create.Integer().Capture(CAPTURE_STREAM_DESTINATION_INDEX), create.Char(']')})), - - create.Char('='), - - create.Keyword("code"), - create.Char('.'), - create.Identifier().Capture(CAPTURE_STREAM_SOURCE_NAME), - create.Optional(create.And({create.Char('['), create.Integer().Capture(CAPTURE_STREAM_SOURCE_INDEX), create.Char(']')})), - - create.Char(';')}); + AddMatchers({ + create.Keyword("vertex").Capture(CAPTURE_FIRST_TOKEN), + create.Char('.'), + create.Identifier().Capture(CAPTURE_STREAM_DESTINATION_NAME), + create.Optional(create.And({ + create.Char('['), + create.Integer().Capture(CAPTURE_STREAM_DESTINATION_INDEX), + create.Char(']'), + })), + + create.Char('='), + + create.Keyword("code"), + create.Char('.'), + create.Identifier().Capture(CAPTURE_STREAM_SOURCE_NAME), + create.Optional(create.And({ + create.Char('['), + create.Integer().Capture(CAPTURE_STREAM_SOURCE_INDEX), + create.Char(']'), + })), + + create.Char(';'), + }); } static std::string CreateRoutingString(SequenceResult<SimpleParserValue>& result, const int nameCapture, const int indexCapture) @@ -184,8 +204,12 @@ namespace techset const std::vector<TechniqueParser::sequence_t*>& TechniquePassScopeSequences::GetSequences() { - static std::vector<TechniqueParser::sequence_t*> tests( - {new SequenceEndPass(), new SequenceStateMap(), new SequenceShader(), new SequenceVertexStreamRouting()}); + static std::vector<TechniqueParser::sequence_t*> tests({ + new SequenceEndPass(), + new SequenceStateMap(), + new SequenceShader(), + new SequenceVertexStreamRouting(), + }); return tests; } diff --git a/src/ObjLoading/Techset/Parsing/Sequence/TechniqueShaderScopeSequences.cpp b/src/ObjLoading/Techset/Parsing/Sequence/TechniqueShaderScopeSequences.cpp index 9435cfdaa..c94d9f6e2 100644 --- a/src/ObjLoading/Techset/Parsing/Sequence/TechniqueShaderScopeSequences.cpp +++ b/src/ObjLoading/Techset/Parsing/Sequence/TechniqueShaderScopeSequences.cpp @@ -15,7 +15,9 @@ namespace techset { const SimpleMatcherFactory create(this); - AddMatchers({create.Char('}')}); + AddMatchers({ + create.Char('}'), + }); } protected: @@ -44,16 +46,33 @@ namespace techset static std::unique_ptr<matcher_t> CodeMatchers(const SimpleMatcherFactory& create) { - return create.And({create.Or({create.Keyword("constant").Tag(TAG_CONSTANT), create.Keyword("sampler").Tag(TAG_SAMPLER)}), - create.Char('.'), - create.Identifier().Capture(CAPTURE_CODE_ACCESSOR), - create.OptionalLoop(create.And({create.Char('.'), create.Identifier().Capture(CAPTURE_CODE_ACCESSOR)})), - create.Optional(create.And({create.Char('['), create.Integer().Capture(CAPTURE_CODE_INDEX), create.Char(']')}))}); + return create.And({ + create.Or({ + create.Keyword("constant").Tag(TAG_CONSTANT), + create.Keyword("sampler").Tag(TAG_SAMPLER), + }), + create.Char('.'), + create.Identifier().Capture(CAPTURE_CODE_ACCESSOR), + create.OptionalLoop(create.And({ + create.Char('.'), + create.Identifier().Capture(CAPTURE_CODE_ACCESSOR), + })), + create.Optional(create.And({ + create.Char('['), + create.Integer().Capture(CAPTURE_CODE_INDEX), + create.Char(']'), + })), + }); } static std::unique_ptr<matcher_t> LiteralValueMatchers(const SimpleMatcherFactory& create) { - return create.Or({create.FloatingPoint(), create.Integer()}).Capture(CAPTURE_LITERAL_VALUE); + return create + .Or({ + create.FloatingPoint(), + create.Integer(), + }) + .Capture(CAPTURE_LITERAL_VALUE); } static std::unique_ptr<matcher_t> LiteralMatchers(const SimpleMatcherFactory& create) @@ -77,11 +96,18 @@ namespace techset static std::unique_ptr<matcher_t> MaterialMatchers(const SimpleMatcherFactory& create) { return create - .And({create.Keyword("material"), - create.Char('.'), - - create.Or({create.And({create.Char('#'), create.Integer().Capture(CAPTURE_MATERIAL_HASH)}), - create.Identifier().Capture(CAPTURE_MATERIAL_NAME)})}) + .And({ + create.Keyword("material"), + create.Char('.'), + + create.Or({ + create.And({ + create.Char('#'), + create.Integer().Capture(CAPTURE_MATERIAL_HASH), + }), + create.Identifier().Capture(CAPTURE_MATERIAL_NAME), + }), + }) .Tag(TAG_MATERIAL); } @@ -90,12 +116,22 @@ namespace techset { const SimpleMatcherFactory create(this); - AddMatchers({create.Identifier().Capture(CAPTURE_FIRST_TOKEN).NoConsume(), - create.Identifier().Capture(CAPTURE_SHADER_ARGUMENT), - create.Optional(create.And({create.Char('['), create.Integer().Capture(CAPTURE_SHADER_INDEX), create.Char(']')})), - create.Char('='), - create.Or({CodeMatchers(create), LiteralMatchers(create), MaterialMatchers(create)}), - create.Char(';')}); + AddMatchers({ + create.Identifier().Capture(CAPTURE_FIRST_TOKEN).NoConsume(), + create.Identifier().Capture(CAPTURE_SHADER_ARGUMENT), + create.Optional(create.And({ + create.Char('['), + create.Integer().Capture(CAPTURE_SHADER_INDEX), + create.Char(']'), + })), + create.Char('='), + create.Or({ + CodeMatchers(create), + LiteralMatchers(create), + MaterialMatchers(create), + }), + create.Char(';'), + }); } static void ProcessCodeArgument(const TechniqueParserState* state, SequenceResult<SimpleParserValue>& result, ShaderArgument arg, const bool isSampler) @@ -197,7 +233,10 @@ namespace techset const std::vector<TechniqueParser::sequence_t*>& TechniqueShaderScopeSequences::GetSequences() { - static std::vector<TechniqueParser::sequence_t*> tests({new SequenceEndShader(), new SequenceShaderArgument()}); + static std::vector<TechniqueParser::sequence_t*> tests({ + new SequenceEndShader(), + new SequenceShaderArgument(), + }); return tests; } diff --git a/src/ObjLoading/Techset/Parsing/TechsetFileParser.cpp b/src/ObjLoading/Techset/Parsing/TechsetFileParser.cpp index 1314e332b..6b6f1b860 100644 --- a/src/ObjLoading/Techset/Parsing/TechsetFileParser.cpp +++ b/src/ObjLoading/Techset/Parsing/TechsetFileParser.cpp @@ -15,7 +15,10 @@ namespace techset { const SimpleMatcherFactory create(this); - AddMatchers({create.String().Capture(CAPTURE_TYPE_NAME), create.Char(':')}); + AddMatchers({ + create.String().Capture(CAPTURE_TYPE_NAME), + create.Char(':'), + }); } protected: @@ -40,7 +43,15 @@ namespace techset { const SimpleMatcherFactory create(this); - AddMatchers({create.Or({create.Identifier(), create.String()}).Capture(CAPTURE_NAME), create.Char(';')}); + AddMatchers({ + create + .Or({ + create.Identifier(), + create.String(), + }) + .Capture(CAPTURE_NAME), + create.Char(';'), + }); } protected: @@ -66,8 +77,13 @@ TechsetParser::TechsetParser(SimpleLexer* lexer, const char** validTechniqueType const std::vector<TechsetParser::sequence_t*>& TechsetParser::GetTestsForState() { - static std::vector<sequence_t*> allTests({new SequenceTechniqueTypeName(), new SequenceTechniqueName()}); - static std::vector<sequence_t*> techniqueTypeNameOnlyTests({new SequenceTechniqueTypeName()}); + static std::vector<sequence_t*> allTests({ + new SequenceTechniqueTypeName(), + new SequenceTechniqueName(), + }); + static std::vector<sequence_t*> techniqueTypeNameOnlyTests({ + new SequenceTechniqueTypeName(), + }); return m_state->m_current_technique_types.empty() ? techniqueTypeNameOnlyTests : allTests; } diff --git a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperLoadedSound.cpp b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperLoadedSound.cpp index 29a9a2941..0c894a2c4 100644 --- a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperLoadedSound.cpp +++ b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperLoadedSound.cpp @@ -21,12 +21,14 @@ void AssetDumperLoadedSound::DumpWavPcm(AssetDumpingContext& context, const Load const WavChunkHeader formatChunkHeader{WAV_CHUNK_ID_FMT, sizeof(WavFormatChunkPcm)}; stream.write(reinterpret_cast<const char*>(&formatChunkHeader), sizeof(formatChunkHeader)); - WavFormatChunkPcm formatChunk{WavFormat::PCM, - static_cast<uint16_t>(asset->sound.info.channels), - asset->sound.info.rate, - asset->sound.info.rate * asset->sound.info.channels * asset->sound.info.bits / 8, - static_cast<uint16_t>(asset->sound.info.block_size), - static_cast<uint16_t>(asset->sound.info.bits)}; + WavFormatChunkPcm formatChunk{ + WavFormat::PCM, + static_cast<uint16_t>(asset->sound.info.channels), + asset->sound.info.rate, + asset->sound.info.rate * asset->sound.info.channels * asset->sound.info.bits / 8, + 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)); const WavChunkHeader dataChunkHeader{WAV_CHUNK_ID_DATA, asset->sound.info.data_len}; diff --git a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperMaterial.cpp b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperMaterial.cpp index f1314d065..0f90a158b 100644 --- a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperMaterial.cpp +++ b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperMaterial.cpp @@ -41,7 +41,7 @@ namespace IW3 const auto& entry = complexTable[index]; jArray.emplace_back(json{ {"real", entry.real}, - {"imag", entry.imag} + {"imag", entry.imag}, }); } } @@ -66,14 +66,24 @@ namespace IW3 {"winddir", std::vector(std::begin(water->winddir), std::end(water->winddir))}, {"amplitude", water->amplitude}, {"codeConstant", std::vector(std::begin(water->codeConstant), std::end(water->codeConstant))}, - {"image", water->image && water->image->name ? AssetName(water->image->name) : nullptr} + {"image", water->image && water->image->name ? AssetName(water->image->name) : nullptr}, }; } json BuildSamplerStateJson(unsigned char samplerState) { - static const char* samplerFilterNames[]{"none", "nearest", "linear", "aniso2x", "aniso4x"}; - static const char* samplerMipmapNames[]{"disabled", "nearest", "linear"}; + static const char* samplerFilterNames[]{ + "none", + "nearest", + "linear", + "aniso2x", + "aniso4x", + }; + static const char* samplerMipmapNames[]{ + "disabled", + "nearest", + "linear", + }; return json{ {"filter", ArrayEntry(samplerFilterNames, (samplerState & SAMPLER_FILTER_MASK) >> SAMPLER_FILTER_SHIFT)}, @@ -87,7 +97,19 @@ namespace IW3 json BuildTextureTableJson(const MaterialTextureDef* textureTable, const size_t count) { static const char* semanticNames[]{ - "2d", "function", "colorMap", "unused1", "unused2", "normalMap", "unused3", "unused4", "specularMap", "unused5", "unused6", "waterMap"}; + "2d", + "function", + "colorMap", + "unused1", + "unused2", + "normalMap", + "unused3", + "unused4", + "specularMap", + "unused5", + "unused6", + "waterMap", + }; auto jArray = json::array(); @@ -99,7 +121,7 @@ namespace IW3 json jEntry = { {"samplerState", BuildSamplerStateJson(entry.samplerState)}, - {"semantic", ArrayEntry(semanticNames, entry.semantic)} + {"semantic", ArrayEntry(semanticNames, entry.semantic)}, }; const auto knownMaterialSourceName = knownMaterialSourceNames.find(entry.nameHash); @@ -142,7 +164,7 @@ namespace IW3 { const auto& entry = constantTable[index]; json jEntry = { - {"literal", std::vector(std::begin(entry.literal), std::end(entry.literal))} + {"literal", std::vector(std::begin(entry.literal), std::end(entry.literal))}, }; const auto nameLen = strnlen(entry.name, std::extent_v<decltype(MaterialConstantDef::name)>); @@ -166,7 +188,7 @@ namespace IW3 { jEntry.merge_patch({ {"nameHash", entry.nameHash}, - {"namePart", fullLengthName} + {"namePart", fullLengthName}, }); } } @@ -198,7 +220,14 @@ namespace IW3 "destColor", "invDestColor", }; - static const char* blendOpNames[]{"disabled", "add", "subtract", "revSubtract", "min", "max"}; + static const char* blendOpNames[]{ + "disabled", + "add", + "subtract", + "revSubtract", + "min", + "max", + }; static const char* depthTestNames[]{ "always", "less", @@ -211,7 +240,16 @@ namespace IW3 "2", "shadowMap", }; - static const char* stencilOpNames[]{"keep", "zero", "replace", "incrSat", "decrSat", "invert", "incr", "decr"}; + static const char* stencilOpNames[]{ + "keep", + "zero", + "replace", + "incrSat", + "decrSat", + "invert", + "incr", + "decr", + }; auto jArray = json::array(); @@ -422,7 +460,7 @@ void AssetDumperMaterial::DumpAsset(AssetDumpingContext& context, XAssetInfo<Mat {"techniqueSet", material->techniqueSet && material->techniqueSet->name ? AssetName(material->techniqueSet->name) : nullptr}, {"textureTable", BuildTextureTableJson(material->textureTable, material->textureCount)}, {"constantTable", BuildConstantTableJson(material->constantTable, material->constantCount)}, - {"stateBitsTable", BuildStateBitsTableJson(material->stateBitsTable, material->stateBitsCount)} + {"stateBitsTable", BuildStateBitsTableJson(material->stateBitsTable, material->stateBitsCount)}, }; stream << std::setw(4) << j; diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.cpp index 3ceb26186..4849d6090 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.cpp @@ -23,105 +23,120 @@ class AssetDumperFontIconInternal }; inline static const std::string TYPE_ICON = "icon"; - inline static const std::string ICON_HEADERS[]{"# index", "# type", "# name", "# material", "# size", "# xScale", "# yScale"}; + inline static const std::string ICON_HEADERS[]{ + "# index", + "# type", + "# name", + "# material", + "# size", + "# xScale", + "# yScale", + }; inline static const std::string TYPE_ALIAS = "alias"; - inline static const std::string ALIAS_HEADERS[]{"# index", "# type", "# alias", "# button"}; - - inline static const KnownAlias KNOWN_ALIASES[]{KnownAlias("BUTTON_ADS"), - KnownAlias("BUTTON_CAC_NEXT"), - KnownAlias("BUTTON_CAC_PREV"), - KnownAlias("BUTTON_CANCEL"), - KnownAlias("BUTTON_CAROUSEL_STICK"), - KnownAlias("BUTTON_CREATE"), - KnownAlias("BUTTON_CYCLE_LEFT"), - KnownAlias("BUTTON_CYCLE_LEFT_ACTIVE"), - KnownAlias("BUTTON_CYCLE_RIGHT"), - KnownAlias("BUTTON_CYCLE_RIGHT_ACTIVE"), - KnownAlias("BUTTON_DELETE"), - KnownAlias("BUTTON_EDIT"), - KnownAlias("BUTTON_EMBLEM_BACKWARD"), - KnownAlias("BUTTON_EMBLEM_FLIP"), - KnownAlias("BUTTON_EMBLEM_FORWARD"), - KnownAlias("BUTTON_EMBLEM_FORWARD_BACKWARD"), - KnownAlias("BUTTON_EMBLEM_MOVE"), - KnownAlias("BUTTON_EMBLEM_OUTLINE"), - KnownAlias("BUTTON_EMBLEM_PALETTE_CYCLE"), - KnownAlias("BUTTON_EMBLEM_PALETTE_NEXT"), - KnownAlias("BUTTON_EMBLEM_PALETTE_PREV"), - KnownAlias("BUTTON_EMBLEM_RESET"), - KnownAlias("BUTTON_EMBLEM_ROTATE_LEFT"), - KnownAlias("BUTTON_EMBLEM_ROTATE_RIGHT"), - KnownAlias("BUTTON_EMBLEM_SCALE"), - KnownAlias("BUTTON_FIRE"), - KnownAlias("BUTTON_FRIENDSLIST"), - KnownAlias("BUTTON_INTERACT"), - KnownAlias("BUTTON_LOOKSTICK"), - KnownAlias("BUTTON_LOOK"), - KnownAlias("BUTTON_LUI_ALT1"), - KnownAlias("BUTTON_LUI_ALT2"), - KnownAlias("BUTTON_LUI_DPAD_ALL"), - KnownAlias("BUTTON_LUI_DPAD_D"), - KnownAlias("BUTTON_LUI_DPAD_L"), - KnownAlias("BUTTON_LUI_DPAD_RL"), - KnownAlias("BUTTON_LUI_DPAD_R"), - KnownAlias("BUTTON_LUI_DPAD_UD"), - KnownAlias("BUTTON_LUI_DPAD_U"), - KnownAlias("BUTTON_LUI_LEFT_STICK_UP"), - KnownAlias("BUTTON_LUI_LEFT_TRIGGER"), - KnownAlias("BUTTON_LUI_PRIMARY"), - KnownAlias("BUTTON_LUI_RIGHT_STICK"), - KnownAlias("BUTTON_LUI_RIGHT_TRIGGER"), - KnownAlias("BUTTON_LUI_SECONDARY"), - KnownAlias("BUTTON_LUI_SELECT"), - KnownAlias("BUTTON_LUI_SHOULDERL"), - KnownAlias("BUTTON_LUI_SHOULDERR"), - KnownAlias("BUTTON_LUI_START"), - KnownAlias("BUTTON_MOUSE_CLICK"), - KnownAlias("BUTTON_MOUSE_CLICK_ACTIVE"), - KnownAlias("BUTTON_MOUSE_EDIT"), - KnownAlias("BUTTON_MOUSE_EDIT_ACTIVE"), - KnownAlias("BUTTON_MOUSE_LEFT"), - KnownAlias("BUTTON_MOUSE_MIDDLE"), - KnownAlias("BUTTON_MOUSE_RIGHT"), - KnownAlias("BUTTON_MOVESTICK"), - KnownAlias("BUTTON_MOVE"), - KnownAlias("BUTTON_MP_CANCELCOMMAND"), - KnownAlias("BUTTON_MP_CHANGESETTINGS"), - KnownAlias("BUTTON_MP_GAMERCARD"), - KnownAlias("BUTTON_MP_GAMERREVIEW"), - KnownAlias("BUTTON_MP_JOINGAME"), - KnownAlias("BUTTON_MP_KICKPLAYER"), - KnownAlias("BUTTON_MP_LEAVEGAME"), - KnownAlias("BUTTON_MP_LOBBY_GAMERCARD"), - KnownAlias("BUTTON_MP_NOTREADY"), - KnownAlias("BUTTON_MP_PGDOWN"), - KnownAlias("BUTTON_MP_PGUP"), - KnownAlias("BUTTON_MP_READY"), - KnownAlias("BUTTON_MP_REFRESH"), - KnownAlias("BUTTON_MP_SCOREBOARD"), - KnownAlias("BUTTON_MP_SIGNIN"), - KnownAlias("BUTTON_MP_SPECNEXT"), - KnownAlias("BUTTON_MP_SPECPREV"), - KnownAlias("BUTTON_MP_STARTGAME"), - KnownAlias("BUTTON_MP_TOGGLECHASECAM"), - KnownAlias("BUTTON_MP_TOGGLEVIEW"), - KnownAlias("BUTTON_NO"), - KnownAlias("BUTTON_RECORD_VIEW_NEXT"), - KnownAlias("BUTTON_RECORD_VIEW_PREV"), - KnownAlias("BUTTON_SELECTCHOICE"), - KnownAlias("BUTTON_SP_TOGGLEMENU"), - KnownAlias("BUTTON_YES"), - KnownAlias("CP"), - KnownAlias("FONT_CAPITAL_I"), - KnownAlias("FONT_NUMBER_ZERO"), - KnownAlias("KEY_DOWN_ARROW"), - KnownAlias("KEY_LEFT_ARROW"), - KnownAlias("KEY_RIGHT_ARROW"), - KnownAlias("KEY_UP_ARROW"), - KnownAlias("MOUSE_WHEEL_DOWN"), - KnownAlias("MOUSE_WHEEL_UP"), - KnownAlias("Remote_LStick")}; + inline static const std::string ALIAS_HEADERS[]{ + "# index", + "# type", + "# alias", + "# button", + }; + + inline static const KnownAlias KNOWN_ALIASES[]{ + KnownAlias("BUTTON_ADS"), + KnownAlias("BUTTON_CAC_NEXT"), + KnownAlias("BUTTON_CAC_PREV"), + KnownAlias("BUTTON_CANCEL"), + KnownAlias("BUTTON_CAROUSEL_STICK"), + KnownAlias("BUTTON_CREATE"), + KnownAlias("BUTTON_CYCLE_LEFT"), + KnownAlias("BUTTON_CYCLE_LEFT_ACTIVE"), + KnownAlias("BUTTON_CYCLE_RIGHT"), + KnownAlias("BUTTON_CYCLE_RIGHT_ACTIVE"), + KnownAlias("BUTTON_DELETE"), + KnownAlias("BUTTON_EDIT"), + KnownAlias("BUTTON_EMBLEM_BACKWARD"), + KnownAlias("BUTTON_EMBLEM_FLIP"), + KnownAlias("BUTTON_EMBLEM_FORWARD"), + KnownAlias("BUTTON_EMBLEM_FORWARD_BACKWARD"), + KnownAlias("BUTTON_EMBLEM_MOVE"), + KnownAlias("BUTTON_EMBLEM_OUTLINE"), + KnownAlias("BUTTON_EMBLEM_PALETTE_CYCLE"), + KnownAlias("BUTTON_EMBLEM_PALETTE_NEXT"), + KnownAlias("BUTTON_EMBLEM_PALETTE_PREV"), + KnownAlias("BUTTON_EMBLEM_RESET"), + KnownAlias("BUTTON_EMBLEM_ROTATE_LEFT"), + KnownAlias("BUTTON_EMBLEM_ROTATE_RIGHT"), + KnownAlias("BUTTON_EMBLEM_SCALE"), + KnownAlias("BUTTON_FIRE"), + KnownAlias("BUTTON_FRIENDSLIST"), + KnownAlias("BUTTON_INTERACT"), + KnownAlias("BUTTON_LOOKSTICK"), + KnownAlias("BUTTON_LOOK"), + KnownAlias("BUTTON_LUI_ALT1"), + KnownAlias("BUTTON_LUI_ALT2"), + KnownAlias("BUTTON_LUI_DPAD_ALL"), + KnownAlias("BUTTON_LUI_DPAD_D"), + KnownAlias("BUTTON_LUI_DPAD_L"), + KnownAlias("BUTTON_LUI_DPAD_RL"), + KnownAlias("BUTTON_LUI_DPAD_R"), + KnownAlias("BUTTON_LUI_DPAD_UD"), + KnownAlias("BUTTON_LUI_DPAD_U"), + KnownAlias("BUTTON_LUI_LEFT_STICK_UP"), + KnownAlias("BUTTON_LUI_LEFT_TRIGGER"), + KnownAlias("BUTTON_LUI_PRIMARY"), + KnownAlias("BUTTON_LUI_RIGHT_STICK"), + KnownAlias("BUTTON_LUI_RIGHT_TRIGGER"), + KnownAlias("BUTTON_LUI_SECONDARY"), + KnownAlias("BUTTON_LUI_SELECT"), + KnownAlias("BUTTON_LUI_SHOULDERL"), + KnownAlias("BUTTON_LUI_SHOULDERR"), + KnownAlias("BUTTON_LUI_START"), + KnownAlias("BUTTON_MOUSE_CLICK"), + KnownAlias("BUTTON_MOUSE_CLICK_ACTIVE"), + KnownAlias("BUTTON_MOUSE_EDIT"), + KnownAlias("BUTTON_MOUSE_EDIT_ACTIVE"), + KnownAlias("BUTTON_MOUSE_LEFT"), + KnownAlias("BUTTON_MOUSE_MIDDLE"), + KnownAlias("BUTTON_MOUSE_RIGHT"), + KnownAlias("BUTTON_MOVESTICK"), + KnownAlias("BUTTON_MOVE"), + KnownAlias("BUTTON_MP_CANCELCOMMAND"), + KnownAlias("BUTTON_MP_CHANGESETTINGS"), + KnownAlias("BUTTON_MP_GAMERCARD"), + KnownAlias("BUTTON_MP_GAMERREVIEW"), + KnownAlias("BUTTON_MP_JOINGAME"), + KnownAlias("BUTTON_MP_KICKPLAYER"), + KnownAlias("BUTTON_MP_LEAVEGAME"), + KnownAlias("BUTTON_MP_LOBBY_GAMERCARD"), + KnownAlias("BUTTON_MP_NOTREADY"), + KnownAlias("BUTTON_MP_PGDOWN"), + KnownAlias("BUTTON_MP_PGUP"), + KnownAlias("BUTTON_MP_READY"), + KnownAlias("BUTTON_MP_REFRESH"), + KnownAlias("BUTTON_MP_SCOREBOARD"), + KnownAlias("BUTTON_MP_SIGNIN"), + KnownAlias("BUTTON_MP_SPECNEXT"), + KnownAlias("BUTTON_MP_SPECPREV"), + KnownAlias("BUTTON_MP_STARTGAME"), + KnownAlias("BUTTON_MP_TOGGLECHASECAM"), + KnownAlias("BUTTON_MP_TOGGLEVIEW"), + KnownAlias("BUTTON_NO"), + KnownAlias("BUTTON_RECORD_VIEW_NEXT"), + KnownAlias("BUTTON_RECORD_VIEW_PREV"), + KnownAlias("BUTTON_SELECTCHOICE"), + KnownAlias("BUTTON_SP_TOGGLEMENU"), + KnownAlias("BUTTON_YES"), + KnownAlias("CP"), + KnownAlias("FONT_CAPITAL_I"), + KnownAlias("FONT_NUMBER_ZERO"), + KnownAlias("KEY_DOWN_ARROW"), + KnownAlias("KEY_LEFT_ARROW"), + KnownAlias("KEY_RIGHT_ARROW"), + KnownAlias("KEY_UP_ARROW"), + KnownAlias("MOUSE_WHEEL_DOWN"), + KnownAlias("MOUSE_WHEEL_UP"), + KnownAlias("Remote_LStick"), + }; CsvOutputStream m_csv; diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp index 50b321053..b72dabfa8 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp @@ -85,7 +85,17 @@ namespace "devraw/", }; - constexpr size_t FRAME_RATE_FOR_INDEX[]{8000, 12000, 16000, 24000, 32000, 44100, 48000, 96000, 192000}; + constexpr size_t FRAME_RATE_FOR_INDEX[]{ + 8000, + 12000, + 16000, + 24000, + 32000, + 44100, + 48000, + 96000, + 192000, + }; } // namespace class AssetDumperSndBank::Internal diff --git a/src/ObjWriting/Model/XModel/XModelExportWriter.cpp b/src/ObjWriting/Model/XModel/XModelExportWriter.cpp index 64e0dc101..c8b963959 100644 --- a/src/ObjWriting/Model/XModel/XModelExportWriter.cpp +++ b/src/ObjWriting/Model/XModel/XModelExportWriter.cpp @@ -129,9 +129,11 @@ class XModelExportWriter6 final : public XModelExportWriterBase stream << "NUMFACES " << m_faces.size() << "\n"; for (const auto& face : m_faces) { - const size_t distinctPositions[3]{m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[0]), - m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[1]), - m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[2])}; + const size_t distinctPositions[3]{ + m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[0]), + m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[1]), + m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[2]), + }; const XModelVertex& v0 = m_vertices[face.vertexIndex[0]]; const XModelVertex& v1 = m_vertices[face.vertexIndex[1]]; diff --git a/src/ObjWriting/ObjContainer/IPak/IPakWriter.cpp b/src/ObjWriting/ObjContainer/IPak/IPakWriter.cpp index 98a745c68..f97318b05 100644 --- a/src/ObjWriting/ObjContainer/IPak/IPakWriter.cpp +++ b/src/ObjWriting/ObjContainer/IPak/IPakWriter.cpp @@ -82,18 +82,26 @@ class IPakWriterImpl final : public IPakWriter const IPakHeader header{ipak_consts::IPAK_MAGIC, ipak_consts::IPAK_VERSION, static_cast<uint32_t>(m_total_size), SECTION_COUNT}; - const IPakSection dataSection{ipak_consts::IPAK_DATA_SECTION, - static_cast<uint32_t>(m_data_section_offset), - static_cast<uint32_t>(m_data_section_size), - static_cast<uint32_t>(m_index_entries.size())}; - - const IPakSection indexSection{ipak_consts::IPAK_INDEX_SECTION, - static_cast<uint32_t>(m_index_section_offset), - static_cast<uint32_t>(sizeof(IPakIndexEntry) * m_index_entries.size()), - static_cast<uint32_t>(m_index_entries.size())}; + const IPakSection dataSection{ + ipak_consts::IPAK_DATA_SECTION, + static_cast<uint32_t>(m_data_section_offset), + static_cast<uint32_t>(m_data_section_size), + static_cast<uint32_t>(m_index_entries.size()), + }; + + const IPakSection indexSection{ + ipak_consts::IPAK_INDEX_SECTION, + static_cast<uint32_t>(m_index_section_offset), + static_cast<uint32_t>(sizeof(IPakIndexEntry) * m_index_entries.size()), + static_cast<uint32_t>(m_index_entries.size()), + }; const IPakSection brandingSection{ - ipak_consts::IPAK_BRANDING_SECTION, static_cast<uint32_t>(m_branding_section_offset), std::extent_v<decltype(BRANDING)>, 1}; + ipak_consts::IPAK_BRANDING_SECTION, + static_cast<uint32_t>(m_branding_section_offset), + std::extent_v<decltype(BRANDING)>, + 1, + }; Write(&header, sizeof(header)); Write(&dataSection, sizeof(dataSection)); diff --git a/src/ObjWriting/ObjWriting.cpp b/src/ObjWriting/ObjWriting.cpp index ca028755f..46627e65d 100644 --- a/src/ObjWriting/ObjWriting.cpp +++ b/src/ObjWriting/ObjWriting.cpp @@ -9,7 +9,13 @@ ObjWriting::Configuration_t ObjWriting::Configuration; -const IZoneDumper* const ZONE_DUMPER[]{new IW3::ZoneDumper(), new IW4::ZoneDumper(), new IW5::ZoneDumper(), new T5::ZoneDumper(), new T6::ZoneDumper()}; +const IZoneDumper* const ZONE_DUMPER[]{ + new IW3::ZoneDumper(), + new IW4::ZoneDumper(), + new IW5::ZoneDumper(), + new T5::ZoneDumper(), + new T6::ZoneDumper(), +}; bool ObjWriting::DumpZone(AssetDumpingContext& context) { diff --git a/src/ObjWriting/Sound/WavWriter.cpp b/src/ObjWriting/Sound/WavWriter.cpp index 6f5caa9cc..6d0a5ae71 100644 --- a/src/ObjWriting/Sound/WavWriter.cpp +++ b/src/ObjWriting/Sound/WavWriter.cpp @@ -19,12 +19,14 @@ void WavWriter::WritePcmHeader(const WavMetaData& metaData, const size_t dataLen constexpr WavChunkHeader formatChunkHeader{WAV_CHUNK_ID_FMT, sizeof(WavFormatChunkPcm)}; m_stream.write(reinterpret_cast<const char*>(&formatChunkHeader), sizeof(formatChunkHeader)); - const WavFormatChunkPcm formatChunk{WavFormat::PCM, - static_cast<uint16_t>(metaData.channelCount), - metaData.samplesPerSec, - metaData.samplesPerSec * metaData.channelCount * metaData.bitsPerSample / 8, - static_cast<uint16_t>(metaData.channelCount * (metaData.bitsPerSample / 8)), - static_cast<uint16_t>(metaData.bitsPerSample)}; + const WavFormatChunkPcm formatChunk{ + WavFormat::PCM, + static_cast<uint16_t>(metaData.channelCount), + metaData.samplesPerSec, + metaData.samplesPerSec * metaData.channelCount * metaData.bitsPerSample / 8, + static_cast<uint16_t>(metaData.channelCount * (metaData.bitsPerSample / 8)), + static_cast<uint16_t>(metaData.bitsPerSample), + }; m_stream.write(reinterpret_cast<const char*>(&formatChunk), sizeof(formatChunk)); const WavChunkHeader dataChunkHeader{WAV_CHUNK_ID_DATA, dataLen}; diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionBinaryOperation.cpp b/src/Parser/Parsing/Simple/Expression/SimpleExpressionBinaryOperation.cpp index 4cd1175e1..649130e45 100644 --- a/src/Parser/Parsing/Simple/Expression/SimpleExpressionBinaryOperation.cpp +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionBinaryOperation.cpp @@ -404,7 +404,8 @@ const SimpleExpressionBinaryOperationType* const SimpleExpressionBinaryOperation &OPERATION_EQUALS, &OPERATION_NOT_EQUAL, &OPERATION_AND, - &OPERATION_OR}; + &OPERATION_OR, +}; SimpleExpressionBinaryOperation::SimpleExpressionBinaryOperation(const SimpleExpressionBinaryOperationType* operationType, std::unique_ptr<ISimpleExpression> operand1, diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionMatchers.cpp b/src/Parser/Parsing/Simple/Expression/SimpleExpressionMatchers.cpp index a6d571fd0..7a3e3b986 100644 --- a/src/Parser/Parsing/Simple/Expression/SimpleExpressionMatchers.cpp +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionMatchers.cpp @@ -298,7 +298,11 @@ std::unique_ptr<SimpleExpressionMatchers::matcher_t> SimpleExpressionMatchers::P if (hasAddOperation && hasSubtractOperation) { - binaryOperationsMatchers.emplace_back(create.Or({create.IntegerWithSign(), create.FloatingPointWithSign()}) + binaryOperationsMatchers.emplace_back(create + .Or({ + create.IntegerWithSign(), + create.FloatingPointWithSign(), + }) .NoConsume() .Transform( [](const SimpleMatcherFactory::token_list_t& values) @@ -360,11 +364,13 @@ std::unique_ptr<SimpleExpressionMatchers::matcher_t> SimpleExpressionMatchers::P if (!m_enable_conditional_operator) return create.False(); - return create.And({create.Char('?').Tag(TAG_CONDITIONAL_OPERATOR), - create.Label(LABEL_EXPRESSION), - create.Char(':').Tag(TAG_CONDITIONAL_OPERATOR_SEPARATOR), - create.Label(LABEL_EXPRESSION), - create.True().Tag(TAG_CONDITIONAL_OPERATOR_END)}); + return create.And({ + create.Char('?').Tag(TAG_CONDITIONAL_OPERATOR), + create.Label(LABEL_EXPRESSION), + create.Char(':').Tag(TAG_CONDITIONAL_OPERATOR_SEPARATOR), + create.Label(LABEL_EXPRESSION), + create.True().Tag(TAG_CONDITIONAL_OPERATOR_END), + }); } std::unique_ptr<SimpleExpressionMatchers::matcher_t> SimpleExpressionMatchers::Expression(const supplier_t* labelSupplier) const @@ -372,11 +378,32 @@ std::unique_ptr<SimpleExpressionMatchers::matcher_t> SimpleExpressionMatchers::E const SimpleMatcherFactory create(labelSupplier); return create - .And({create.OptionalLoop(ParseUnaryOperationType(labelSupplier)), - create.Or({create.And({create.Char('('), create.Label(LABEL_EXPRESSION), create.Char(')').Tag(TAG_PARENTHESIS_END)}).Tag(TAG_PARENTHESIS), - create.And({create.True().Tag(TAG_OPERAND_EXT), ParseOperandExtension(labelSupplier), create.True().Tag(TAG_OPERAND_EXT_END)}), - ParseOperand(labelSupplier)}), - create.Optional(create.Or({ParseConditionalOperator(labelSupplier), - create.And({ParseBinaryOperationType(labelSupplier), create.Label(LABEL_EXPRESSION)}).Tag(TAG_BINARY_OPERATION)}))}) + .And({ + create.OptionalLoop(ParseUnaryOperationType(labelSupplier)), + create.Or({ + create + .And({ + create.Char('('), + create.Label(LABEL_EXPRESSION), + create.Char(')').Tag(TAG_PARENTHESIS_END), + }) + .Tag(TAG_PARENTHESIS), + create.And({ + create.True().Tag(TAG_OPERAND_EXT), + ParseOperandExtension(labelSupplier), + create.True().Tag(TAG_OPERAND_EXT_END), + }), + ParseOperand(labelSupplier), + }), + create.Optional(create.Or({ + ParseConditionalOperator(labelSupplier), + create + .And({ + ParseBinaryOperationType(labelSupplier), + create.Label(LABEL_EXPRESSION), + }) + .Tag(TAG_BINARY_OPERATION), + })), + }) .Tag(TAG_EXPRESSION); } diff --git a/src/Parser/Parsing/Simple/SimpleExpressionInterpreter.cpp b/src/Parser/Parsing/Simple/SimpleExpressionInterpreter.cpp index 01a9b09a8..6f8ba50cb 100644 --- a/src/Parser/Parsing/Simple/SimpleExpressionInterpreter.cpp +++ b/src/Parser/Parsing/Simple/SimpleExpressionInterpreter.cpp @@ -47,7 +47,9 @@ class SimpleExpressionInterpreterParser final : public AbstractParser<SimplePars protected: const std::vector<sequence_t*>& GetTestsForState() override { - static std::vector<sequence_t*> sequences{new SimpleExpressionInterpreterExpressionSequence()}; + static std::vector<sequence_t*> sequences{ + new SimpleExpressionInterpreterExpressionSequence(), + }; return sequences; } }; diff --git a/src/Unlinker/UnlinkerArgs.cpp b/src/Unlinker/UnlinkerArgs.cpp index 3802354a3..5c7bfaa02 100644 --- a/src/Unlinker/UnlinkerArgs.cpp +++ b/src/Unlinker/UnlinkerArgs.cpp @@ -8,97 +8,125 @@ #include <regex> #include <type_traits> +// clang-format off const CommandLineOption* const OPTION_HELP = - CommandLineOption::Builder::Create().WithShortName("?").WithLongName("help").WithDescription("Displays usage information.").Build(); + CommandLineOption::Builder::Create() + .WithShortName("?") + .WithLongName("help") + .WithDescription("Displays usage information.") + .Build(); const CommandLineOption* const OPTION_VERBOSE = - CommandLineOption::Builder::Create().WithShortName("v").WithLongName("verbose").WithDescription("Outputs a lot more and more detailed messages.").Build(); + CommandLineOption::Builder::Create() + .WithShortName("v") + .WithLongName("verbose") + .WithDescription("Outputs a lot more and more detailed messages.") + .Build(); const CommandLineOption* const OPTION_MINIMAL_ZONE_FILE = CommandLineOption::Builder::Create() - .WithShortName("min") - .WithLongName("minimal-zone") - .WithDescription("Minimizes the size of the zone file output by only including assets that are not a dependency of another asset.") - .Build(); - -const CommandLineOption* const OPTION_LOAD = CommandLineOption::Builder::Create() - .WithShortName("l") - .WithLongName("load") - .WithDescription("Loads an existing zone before trying to unlink any zone.") - .WithParameter("zonePath") - .Reusable() - .Build(); + .WithShortName("min") + .WithLongName("minimal-zone") + .WithDescription("Minimizes the size of the zone file output by only including assets that are not a dependency of another asset.") + .Build(); + +const CommandLineOption* const OPTION_LOAD = + CommandLineOption::Builder::Create() + .WithShortName("l") + .WithLongName("load") + .WithDescription("Loads an existing zone before trying to unlink any zone.") + .WithParameter("zonePath") + .Reusable() + .Build(); const CommandLineOption* const OPTION_LIST = - CommandLineOption::Builder::Create().WithLongName("list").WithDescription("Lists the contents of a zone instead of writing them to the disk.").Build(); + CommandLineOption::Builder::Create() + .WithLongName("list") + .WithDescription("Lists the contents of a zone instead of writing them to the disk.") + .Build(); const CommandLineOption* const OPTION_OUTPUT_FOLDER = CommandLineOption::Builder::Create() - .WithShortName("o") - .WithLongName("output-folder") - .WithDescription("Specifies the output folder containing the contents of the unlinked zones. Defaults to \"" - + std::string(UnlinkerArgs::DEFAULT_OUTPUT_FOLDER) + "\"") - .WithParameter("outputFolderPath") - .Build(); - -const CommandLineOption* const OPTION_SEARCH_PATH = CommandLineOption::Builder::Create() - .WithLongName("search-path") - .WithDescription("Specifies a semi-colon separated list of paths to search for additional game files.") - .WithParameter("searchPathString") - .Build(); - -const CommandLineOption* const OPTION_IMAGE_FORMAT = CommandLineOption::Builder::Create() - .WithLongName("image-format") - .WithDescription("Specifies the format of dumped image files. Valid values are: DDS, IWI") - .WithParameter("imageFormatValue") - .Build(); - -const CommandLineOption* const OPTION_MODEL_FORMAT = CommandLineOption::Builder::Create() - .WithLongName("model-format") - .WithDescription("Specifies the format of dumped model files. Valid values are: XMODEL_EXPORT, OBJ") - .WithParameter("modelFormatValue") - .Build(); + .WithShortName("o") + .WithLongName("output-folder") + .WithDescription("Specifies the output folder containing the contents of the unlinked zones. Defaults to \"" + + std::string(UnlinkerArgs::DEFAULT_OUTPUT_FOLDER) + "\"") + .WithParameter("outputFolderPath") + .Build(); + +const CommandLineOption* const OPTION_SEARCH_PATH = + CommandLineOption::Builder::Create() + .WithLongName("search-path") + .WithDescription("Specifies a semi-colon separated list of paths to search for additional game files.") + .WithParameter("searchPathString") + .Build(); + +const CommandLineOption* const OPTION_IMAGE_FORMAT = + CommandLineOption::Builder::Create() + .WithLongName("image-format") + .WithDescription("Specifies the format of dumped image files. Valid values are: DDS, IWI") + .WithParameter("imageFormatValue") + .Build(); + +const CommandLineOption* const OPTION_MODEL_FORMAT = + CommandLineOption::Builder::Create() + .WithLongName("model-format") + .WithDescription("Specifies the format of dumped model files. Valid values are: XMODEL_EXPORT, OBJ") + .WithParameter("modelFormatValue") + .Build(); const CommandLineOption* const OPTION_SKIP_OBJ = - CommandLineOption::Builder::Create().WithLongName("skip-obj").WithDescription("Skips loading raw obj data.").Build(); + CommandLineOption::Builder::Create() + .WithLongName("skip-obj") + .WithDescription("Skips loading raw obj data.") + .Build(); const CommandLineOption* const OPTION_GDT = - CommandLineOption::Builder::Create().WithLongName("gdt").WithDescription("Dumps assets in a GDT whenever possible.").Build(); - -const CommandLineOption* const OPTION_EXCLUDE_ASSETS = CommandLineOption::Builder::Create() - .WithLongName("exclude-assets") - .WithDescription("Specify all asset types that should be excluded.") - .WithParameter("assetTypeList") - .Reusable() - .Build(); - -const CommandLineOption* const OPTION_INCLUDE_ASSETS = CommandLineOption::Builder::Create() - .WithLongName("include-assets") - .WithDescription("Specify all asset types that should be included.") - .WithParameter("assetTypeList") - .Reusable() - .Build(); + CommandLineOption::Builder::Create() + .WithLongName("gdt") + .WithDescription("Dumps assets in a GDT whenever possible.") + .Build(); + +const CommandLineOption* const OPTION_EXCLUDE_ASSETS = + CommandLineOption::Builder::Create() + .WithLongName("exclude-assets") + .WithDescription("Specify all asset types that should be excluded.") + .WithParameter("assetTypeList") + .Reusable() + .Build(); + +const CommandLineOption* const OPTION_INCLUDE_ASSETS = + CommandLineOption::Builder::Create() + .WithLongName("include-assets") + .WithDescription("Specify all asset types that should be included.") + .WithParameter("assetTypeList") + .Reusable() + .Build(); const CommandLineOption* const OPTION_LEGACY_MENUS = CommandLineOption::Builder::Create() - .WithLongName("legacy-menus") - .WithDescription("Dumps menus with a compatibility mode to work with applications not compatible with the newer dumping mode.") - .Build(); - -const CommandLineOption* const COMMAND_LINE_OPTIONS[]{OPTION_HELP, - OPTION_VERBOSE, - OPTION_MINIMAL_ZONE_FILE, - OPTION_LOAD, - OPTION_LIST, - OPTION_OUTPUT_FOLDER, - OPTION_SEARCH_PATH, - OPTION_IMAGE_FORMAT, - OPTION_MODEL_FORMAT, - OPTION_SKIP_OBJ, - OPTION_GDT, - OPTION_EXCLUDE_ASSETS, - OPTION_INCLUDE_ASSETS, - OPTION_LEGACY_MENUS}; + .WithLongName("legacy-menus") + .WithDescription("Dumps menus with a compatibility mode to work with applications not compatible with the newer dumping mode.") + .Build(); + +// clang-format on + +const CommandLineOption* const COMMAND_LINE_OPTIONS[]{ + OPTION_HELP, + OPTION_VERBOSE, + OPTION_MINIMAL_ZONE_FILE, + OPTION_LOAD, + OPTION_LIST, + OPTION_OUTPUT_FOLDER, + OPTION_SEARCH_PATH, + OPTION_IMAGE_FORMAT, + OPTION_MODEL_FORMAT, + OPTION_SKIP_OBJ, + OPTION_GDT, + OPTION_EXCLUDE_ASSETS, + OPTION_INCLUDE_ASSETS, + OPTION_LEGACY_MENUS, +}; UnlinkerArgs::UnlinkerArgs() : m_argument_parser(COMMAND_LINE_OPTIONS, std::extent_v<decltype(COMMAND_LINE_OPTIONS)>), diff --git a/src/Utils/Math/Matrix.h b/src/Utils/Math/Matrix.h index 9810a344b..4bbd96f1a 100644 --- a/src/Utils/Math/Matrix.h +++ b/src/Utils/Math/Matrix.h @@ -10,7 +10,7 @@ template<typename T> class Matrix {T(1.0), 0, 0, 0 }, {0, T(1.0), 0, 0 }, {0, 0, T(1.0), 0 }, - {0, 0, 0, T(1.0)} + {0, 0, 0, T(1.0)}, } { } @@ -20,7 +20,7 @@ template<typename T> class Matrix {d00, d01, d02, d03}, {d10, d11, d12, d13}, {d20, d21, d22, d23}, - {d30, d31, d32, d33} + {d30, d31, d32, d33}, } { } diff --git a/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperationType.cpp b/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperationType.cpp index baa482891..f032fbc40 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperationType.cpp +++ b/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperationType.cpp @@ -133,21 +133,23 @@ const OperationType* const OperationType::OPERATION_OR = new OperationType("||", return op1 > 0 || op2 > 0 ? 1 : 0; }); -const OperationType* const OperationType::ALL_OPERATION_TYPES[]{OPERATION_ADD, - OPERATION_SUBTRACT, - OPERATION_MULTIPLY, - OPERATION_DIVIDE, - OPERATION_REMAINDER, - OPERATION_BITWISE_AND, - OPERATION_BITWISE_XOR, - OPERATION_BITWISE_OR, - OPERATION_SHIFT_LEFT, - OPERATION_SHIFT_RIGHT, - OPERATION_GREATER_THAN, - OPERATION_GREATER_EQUAL_THAN, - OPERATION_LESS_THAN, - OPERATION_LESS_EQUAL_THAN, - OPERATION_EQUALS, - OPERATION_NOT_EQUAL, - OPERATION_AND, - OPERATION_OR}; +const OperationType* const OperationType::ALL_OPERATION_TYPES[]{ + OPERATION_ADD, + OPERATION_SUBTRACT, + OPERATION_MULTIPLY, + OPERATION_DIVIDE, + OPERATION_REMAINDER, + OPERATION_BITWISE_AND, + OPERATION_BITWISE_XOR, + OPERATION_BITWISE_OR, + OPERATION_SHIFT_LEFT, + OPERATION_SHIFT_RIGHT, + OPERATION_GREATER_THAN, + OPERATION_GREATER_EQUAL_THAN, + OPERATION_LESS_THAN, + OPERATION_LESS_EQUAL_THAN, + OPERATION_EQUALS, + OPERATION_NOT_EQUAL, + OPERATION_AND, + OPERATION_OR, +}; diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Impl/CommandsParser.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Impl/CommandsParser.cpp index 4f634b577..f86e1f8f0 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Impl/CommandsParser.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Impl/CommandsParser.cpp @@ -26,23 +26,25 @@ CommandsParser::CommandsParser(CommandsLexer* lexer, IDataRepository* targetRepo const std::vector<CommandsParser::sequence_t*>& CommandsParser::GetTestsForState() { - static std::vector<sequence_t*> tests({new SequenceAction(), - new SequenceAllocAlign(), - new SequenceArchitecture(), - new SequenceArrayCount(), - new SequenceArraySize(), - new SequenceAsset(), - new SequenceBlock(), - new SequenceCondition(), - new SequenceCount(), - new SequenceGame(), - new SequenceName(), - new SequenceReorder(), - new SequenceReusable(), - new SequenceScriptString(), - new SequenceSetBlock(), - new SequenceString(), - new SequenceUse()}); + static std::vector<sequence_t*> tests({ + new SequenceAction(), + new SequenceAllocAlign(), + new SequenceArchitecture(), + new SequenceArrayCount(), + new SequenceArraySize(), + new SequenceAsset(), + new SequenceBlock(), + new SequenceCondition(), + new SequenceCount(), + new SequenceGame(), + new SequenceName(), + new SequenceReorder(), + new SequenceReusable(), + new SequenceScriptString(), + new SequenceSetBlock(), + new SequenceString(), + new SequenceUse(), + }); return tests; } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsCommonMatchers.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsCommonMatchers.cpp index c25d4a376..032ff879d 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsCommonMatchers.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsCommonMatchers.cpp @@ -12,55 +12,85 @@ std::unique_ptr<CommandsCommonMatchers::matcher_t> CommandsCommonMatchers::Typename(const supplier_t* labelSupplier) { - static constexpr const char* BUILT_IN_TYPE_NAMES[]{"unsigned", "char", "short", "int", "long"}; + static constexpr const char* BUILT_IN_TYPE_NAMES[]{ + "unsigned", + "char", + "short", + "int", + "long", + }; static_assert(std::extent<decltype(BUILT_IN_TYPE_NAMES)>::value == static_cast<int>(CommandsParserValueType::BUILT_IN_LAST) - static_cast<int>(CommandsParserValueType::BUILT_IN_FIRST) + 1); const CommandsMatcherFactory create(labelSupplier); - return create.Or( - {create - .And({create.Optional(create.Type(CommandsParserValueType::UNSIGNED)), - create.Or({create.Type(CommandsParserValueType::CHAR), - create.Type(CommandsParserValueType::SHORT), - create.Type(CommandsParserValueType::INT), - create.And({create.Type(CommandsParserValueType::LONG), create.Optional(create.Type(CommandsParserValueType::LONG))})})}) - .Transform( - [](CommandsMatcherFactory::token_list_t& values) - { - std::ostringstream str; - auto first = true; - - for (const auto& token : values) - { - if (first) - first = false; - else - str << " "; - str << BUILT_IN_TYPE_NAMES[static_cast<int>(token.get().m_type) - static_cast<int>(CommandsParserValueType::BUILT_IN_FIRST)]; - } - - return CommandsParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); - }), - create.And({create.Identifier(), create.OptionalLoop(create.And({create.Char(':'), create.Char(':'), create.Identifier()}))}) - .Transform( - [](CommandsMatcherFactory::token_list_t& values) - { - std::ostringstream str; - str << values[0].get().IdentifierValue(); - - for (auto i = 3u; i < values.size(); i += 3) - str << "::" << values[i].get().IdentifierValue(); - - return CommandsParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); - })}); + return create.Or({ + create + .And({ + create.Optional(create.Type(CommandsParserValueType::UNSIGNED)), + create.Or({ + create.Type(CommandsParserValueType::CHAR), + create.Type(CommandsParserValueType::SHORT), + create.Type(CommandsParserValueType::INT), + create.And({ + create.Type(CommandsParserValueType::LONG), + create.Optional(create.Type(CommandsParserValueType::LONG)), + }), + }), + }) + .Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + std::ostringstream str; + auto first = true; + + for (const auto& token : values) + { + if (first) + first = false; + else + str << " "; + str << BUILT_IN_TYPE_NAMES[static_cast<int>(token.get().m_type) - static_cast<int>(CommandsParserValueType::BUILT_IN_FIRST)]; + } + + return CommandsParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); + }), + create + .And({ + create.Identifier(), + create.OptionalLoop(create.And({ + create.Char(':'), + create.Char(':'), + create.Identifier(), + })), + }) + .Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + std::ostringstream str; + str << values[0].get().IdentifierValue(); + + for (auto i = 3u; i < values.size(); i += 3) + str << "::" << values[i].get().IdentifierValue(); + + return CommandsParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); + }), + }); } std::unique_ptr<CommandsCommonMatchers::matcher_t> CommandsCommonMatchers::ArrayDef(const supplier_t* labelSupplier) { const CommandsMatcherFactory create(labelSupplier); - return create.And({create.Char('['), create.Or({create.Integer(), create.Identifier()}), create.Char(']')}) + return create + .And({ + create.Char('['), + create.Or({ + create.Integer(), + create.Identifier(), + }), + create.Char(']'), + }) .Transform( [](CommandsMatcherFactory::token_list_t& values) { @@ -91,7 +121,13 @@ std::unique_ptr<CommandsCommonMatchers::matcher_t> CommandsCommonMatchers::Parse { const CommandsMatcherFactory create(labelSupplier); - return create.And({create.Char('['), create.Label(LABEL_EVALUATION), create.Char(']').Tag(TAG_OPERAND_ARRAY_END)}).Tag(TAG_OPERAND_ARRAY); + return create + .And({ + create.Char('['), + create.Label(LABEL_EVALUATION), + create.Char(']').Tag(TAG_OPERAND_ARRAY_END), + }) + .Tag(TAG_OPERAND_ARRAY); } std::unique_ptr<CommandsCommonMatchers::matcher_t> CommandsCommonMatchers::ParseOperand(const supplier_t* labelSupplier) @@ -99,11 +135,15 @@ std::unique_ptr<CommandsCommonMatchers::matcher_t> CommandsCommonMatchers::Parse const CommandsMatcherFactory create(labelSupplier); return create - .Or({create - .And({create.Label(LABEL_TYPENAME).Capture(CAPTURE_OPERAND_TYPENAME), - create.OptionalLoop(MatcherFactoryWrapper<CommandsParserValue>(ParseOperandArray(labelSupplier)).Capture(CAPTURE_OPERAND_ARRAY))}) - .Tag(TAG_OPERAND_TYPENAME), - create.Integer().Tag(TAG_OPERAND_INTEGER).Capture(CAPTURE_OPERAND_INTEGER)}) + .Or({ + create + .And({ + create.Label(LABEL_TYPENAME).Capture(CAPTURE_OPERAND_TYPENAME), + create.OptionalLoop(MatcherFactoryWrapper<CommandsParserValue>(ParseOperandArray(labelSupplier)).Capture(CAPTURE_OPERAND_ARRAY)), + }) + .Tag(TAG_OPERAND_TYPENAME), + create.Integer().Tag(TAG_OPERAND_INTEGER).Capture(CAPTURE_OPERAND_INTEGER), + }) .Tag(TAG_OPERAND); } @@ -112,104 +152,106 @@ std::unique_ptr<CommandsCommonMatchers::matcher_t> CommandsCommonMatchers::Parse const CommandsMatcherFactory create(labelSupplier); return create - .Or({create.Char('+').Transform( - [](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_ADD); - }), - create.Char('-').Transform( - [](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_SUBTRACT); - }), - create.Char('*').Transform( - [](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_MULTIPLY); - }), - create.Char('/').Transform( - [](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_DIVIDE); - }), - create.Char('%').Transform( - [](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_REMAINDER); - }), - create.Char('&').Transform( - [](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_BITWISE_AND); - }), - create.Char('^').Transform( - [](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_BITWISE_XOR); - }), - create.Char('|').Transform( - [](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_BITWISE_OR); - }), - create.Type(CommandsParserValueType::SHIFT_LEFT) - .Transform( - [](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_SHIFT_LEFT); - }), - create.Type(CommandsParserValueType::SHIFT_RIGHT) - .Transform( - [](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_SHIFT_RIGHT); - }), - create.Char('>').Transform( - [](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_GREATER_THAN); - }), - create.Type(CommandsParserValueType::GREATER_EQUAL) - .Transform( - [](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_GREATER_EQUAL_THAN); - }), - create.Char('<').Transform( - [](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_LESS_THAN); - }), - create.Type(CommandsParserValueType::LESS_EQUAL) - .Transform( - [](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_LESS_EQUAL_THAN); - }), - create.Type(CommandsParserValueType::EQUALS) - .Transform( - [](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_EQUALS); - }), - create.Type(CommandsParserValueType::NOT_EQUAL) - .Transform( - [](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_NOT_EQUAL); - }), - create.Type(CommandsParserValueType::LOGICAL_AND) - .Transform( - [](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_AND); - }), - create.Type(CommandsParserValueType::LOGICAL_OR) - .Transform( - [](CommandsMatcherFactory::token_list_t& values) - { - return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_OR); - })}) + .Or({ + create.Char('+').Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_ADD); + }), + create.Char('-').Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_SUBTRACT); + }), + create.Char('*').Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_MULTIPLY); + }), + create.Char('/').Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_DIVIDE); + }), + create.Char('%').Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_REMAINDER); + }), + create.Char('&').Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_BITWISE_AND); + }), + create.Char('^').Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_BITWISE_XOR); + }), + create.Char('|').Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_BITWISE_OR); + }), + create.Type(CommandsParserValueType::SHIFT_LEFT) + .Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_SHIFT_LEFT); + }), + create.Type(CommandsParserValueType::SHIFT_RIGHT) + .Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_SHIFT_RIGHT); + }), + create.Char('>').Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_GREATER_THAN); + }), + create.Type(CommandsParserValueType::GREATER_EQUAL) + .Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_GREATER_EQUAL_THAN); + }), + create.Char('<').Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_LESS_THAN); + }), + create.Type(CommandsParserValueType::LESS_EQUAL) + .Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_LESS_EQUAL_THAN); + }), + create.Type(CommandsParserValueType::EQUALS) + .Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_EQUALS); + }), + create.Type(CommandsParserValueType::NOT_EQUAL) + .Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_NOT_EQUAL); + }), + create.Type(CommandsParserValueType::LOGICAL_AND) + .Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_AND); + }), + create.Type(CommandsParserValueType::LOGICAL_OR) + .Transform( + [](CommandsMatcherFactory::token_list_t& values) + { + return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_OR); + }), + }) .Capture(CAPTURE_BINARY_OPERATION_TYPE); } @@ -218,14 +260,25 @@ std::unique_ptr<CommandsCommonMatchers::matcher_t> CommandsCommonMatchers::Evalu const CommandsMatcherFactory create(labelSupplier); return create - .And({create.Or({create - .And({create.Optional(create.Char('!').Tag(TAG_EVALUATION_NOT)), - create.Char('('), - create.Label(LABEL_EVALUATION), - create.Char(')').Tag(TAG_EVALUATION_PARENTHESIS_END)}) - .Tag(TAG_EVALUATION_PARENTHESIS), - ParseOperand(labelSupplier)}), - create.Optional(create.And({ParseOperationType(labelSupplier), create.Label(LABEL_EVALUATION)}).Tag(TAG_EVALUATION_OPERATION))}) + .And({ + create.Or({ + create + .And({ + create.Optional(create.Char('!').Tag(TAG_EVALUATION_NOT)), + create.Char('('), + create.Label(LABEL_EVALUATION), + create.Char(')').Tag(TAG_EVALUATION_PARENTHESIS_END), + }) + .Tag(TAG_EVALUATION_PARENTHESIS), + ParseOperand(labelSupplier), + }), + create.Optional(create + .And({ + ParseOperationType(labelSupplier), + create.Label(LABEL_EVALUATION), + }) + .Tag(TAG_EVALUATION_OPERATION)), + }) .Tag(TAG_EVALUATION); } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAction.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAction.cpp index 85451c486..bc7a9d30a 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAction.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAction.cpp @@ -9,20 +9,32 @@ SequenceAction::SequenceAction() AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); AddLabeledMatchers( - {create.Char('('), - create.Optional( - create.And({create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_ARG_TYPE), - create.OptionalLoop(create.And({create.Char(','), create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_ARG_TYPE)}))})), - create.Char(')')}, + { + create.Char('('), + create.Optional(create.And({ + create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_ARG_TYPE), + create.OptionalLoop(create.And({ + create.Char(','), + create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_ARG_TYPE), + })), + })), + create.Char(')'), + }, LABEL_ACTION_ARGS); - AddMatchers( - {create.Keyword("set"), - create.Keyword("action"), - create.Or({create.And({create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), create.Identifier().Capture(CAPTURE_ACTION_NAME)}), - create.Identifier().Capture(CAPTURE_ACTION_NAME)}), - create.Label(LABEL_ACTION_ARGS), - create.Char(';')}); + AddMatchers({ + create.Keyword("set"), + create.Keyword("action"), + create.Or({ + create.And({ + create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.Identifier().Capture(CAPTURE_ACTION_NAME), + }), + create.Identifier().Capture(CAPTURE_ACTION_NAME), + }), + create.Label(LABEL_ACTION_ARGS), + create.Char(';'), + }); } void SequenceAction::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAllocAlign.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAllocAlign.cpp index 36709e8d2..9048380a8 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAllocAlign.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAllocAlign.cpp @@ -9,11 +9,13 @@ SequenceAllocAlign::SequenceAllocAlign() AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); AddLabeledMatchers(CommandsCommonMatchers::Evaluation(this), CommandsCommonMatchers::LABEL_EVALUATION); - AddMatchers({create.Keyword("set"), - create.Keyword("allocalign"), - create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.Label(CommandsCommonMatchers::LABEL_EVALUATION), - create.Char(';')}); + AddMatchers({ + create.Keyword("set"), + create.Keyword("allocalign"), + create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.Label(CommandsCommonMatchers::LABEL_EVALUATION), + create.Char(';'), + }); } void SequenceAllocAlign::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArchitecture.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArchitecture.cpp index 38244c446..e3cde76ad 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArchitecture.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArchitecture.cpp @@ -7,7 +7,11 @@ SequenceArchitecture::SequenceArchitecture() { const CommandsMatcherFactory create(this); - AddMatchers({create.Keyword("architecture"), create.Identifier().Capture(CAPTURE_ARCHITECTURE), create.Char(';')}); + AddMatchers({ + create.Keyword("architecture"), + create.Identifier().Capture(CAPTURE_ARCHITECTURE), + create.Char(';'), + }); m_architecture_mapping["x86"] = Architecture::X86; m_architecture_mapping["x64"] = Architecture::X64; diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArrayCount.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArrayCount.cpp index 2ae1a944d..50d41bb16 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArrayCount.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArrayCount.cpp @@ -10,11 +10,13 @@ SequenceArrayCount::SequenceArrayCount() AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); AddLabeledMatchers(CommandsCommonMatchers::Evaluation(this), CommandsCommonMatchers::LABEL_EVALUATION); - AddMatchers({create.Keyword("set"), - create.Keyword("arraycount"), - create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.Label(CommandsCommonMatchers::LABEL_EVALUATION), - create.Char(';')}); + AddMatchers({ + create.Keyword("set"), + create.Keyword("arraycount"), + create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.Label(CommandsCommonMatchers::LABEL_EVALUATION), + create.Char(';'), + }); } void SequenceArrayCount::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArraySize.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArraySize.cpp index 91bd363c0..1a8f5dd15 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArraySize.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArraySize.cpp @@ -10,11 +10,13 @@ SequenceArraySize::SequenceArraySize() AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); AddLabeledMatchers(CommandsCommonMatchers::Evaluation(this), CommandsCommonMatchers::LABEL_EVALUATION); - AddMatchers({create.Keyword("set"), - create.Keyword("arraysize"), - create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.Label(CommandsCommonMatchers::LABEL_EVALUATION).Capture(CAPTURE_EVALUATION), - create.Char(';')}); + AddMatchers({ + create.Keyword("set"), + create.Keyword("arraysize"), + create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.Label(CommandsCommonMatchers::LABEL_EVALUATION).Capture(CAPTURE_EVALUATION), + create.Char(';'), + }); } void SequenceArraySize::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAsset.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAsset.cpp index 0cf06711b..559820a97 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAsset.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAsset.cpp @@ -8,10 +8,12 @@ SequenceAsset::SequenceAsset() const CommandsMatcherFactory create(this); AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); - AddMatchers({create.Keyword("asset"), - create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.Identifier().Capture(CAPTURE_ENUM_ENTRY), - create.Char(';')}); + AddMatchers({ + create.Keyword("asset"), + create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.Identifier().Capture(CAPTURE_ENUM_ENTRY), + create.Char(';'), + }); } void SequenceAsset::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceBlock.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceBlock.cpp index 2e3381900..2bbcfaef0 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceBlock.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceBlock.cpp @@ -14,11 +14,13 @@ SequenceBlock::SequenceBlock() DEFINE_FAST_FILE_BLOCK_TYPE(NORMAL); #undef DEFINE_FAST_FILE_BLOCK_TYPE - AddMatchers({create.Keyword("block"), - create.Identifier().Capture(CAPTURE_BLOCK_TYPE), - create.Identifier().Capture(CAPTURE_BLOCK_ENUM_ENTRY), - create.Optional(create.Keyword("default").Tag(TAG_DEFAULT)), - create.Char(';')}); + AddMatchers({ + create.Keyword("block"), + create.Identifier().Capture(CAPTURE_BLOCK_TYPE), + create.Identifier().Capture(CAPTURE_BLOCK_ENUM_ENTRY), + create.Optional(create.Keyword("default").Tag(TAG_DEFAULT)), + create.Char(';'), + }); } void SequenceBlock::AddFastFileBlockToLookup(std::string name, const FastFileBlockType type) diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCondition.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCondition.cpp index dd2e7566b..98f6f2975 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCondition.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCondition.cpp @@ -10,13 +10,17 @@ SequenceCondition::SequenceCondition() AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); AddLabeledMatchers(CommandsCommonMatchers::Evaluation(this), CommandsCommonMatchers::LABEL_EVALUATION); - AddMatchers({create.Keyword("set"), - create.Keyword("condition"), - create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.Or({create.Keyword("always").Tag(TAG_ALWAYS), - create.Keyword("never").Tag(TAG_NEVER), - create.Label(CommandsCommonMatchers::LABEL_EVALUATION).Tag(TAG_EVALUATION).Capture(CAPTURE_EVALUATION)}), - create.Char(';')}); + AddMatchers({ + create.Keyword("set"), + create.Keyword("condition"), + create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.Or({ + create.Keyword("always").Tag(TAG_ALWAYS), + create.Keyword("never").Tag(TAG_NEVER), + create.Label(CommandsCommonMatchers::LABEL_EVALUATION).Tag(TAG_EVALUATION).Capture(CAPTURE_EVALUATION), + }), + create.Char(';'), + }); } void SequenceCondition::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCount.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCount.cpp index 38aee31a1..b05cc6e91 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCount.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCount.cpp @@ -12,13 +12,15 @@ SequenceCount::SequenceCount() AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); AddLabeledMatchers(CommandsCommonMatchers::Evaluation(this), CommandsCommonMatchers::LABEL_EVALUATION); AddLabeledMatchers(CommandsCommonMatchers::ArrayDef(this), CommandsCommonMatchers::LABEL_ARRAY_DEF); - AddMatchers({create.Keyword("set").Capture(CAPTURE_START), - create.Keyword("count"), - create.OptionalLoop(create.Char('*').Tag(TAG_POINTER_RESOLVE)), - create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.OptionalLoop(create.Label(CommandsCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY_INDEX)), - create.Label(CommandsCommonMatchers::LABEL_EVALUATION), - create.Char(';')}); + AddMatchers({ + create.Keyword("set").Capture(CAPTURE_START), + create.Keyword("count"), + create.OptionalLoop(create.Char('*').Tag(TAG_POINTER_RESOLVE)), + create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.OptionalLoop(create.Label(CommandsCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY_INDEX)), + create.Label(CommandsCommonMatchers::LABEL_EVALUATION), + create.Char(';'), + }); } void SequenceCount::SetCountByArrayIndex(CommandsParserState* state, diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceGame.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceGame.cpp index 7ef01077c..56b9718bd 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceGame.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceGame.cpp @@ -7,7 +7,11 @@ SequenceGame::SequenceGame() { const CommandsMatcherFactory create(this); - AddMatchers({create.Keyword("game"), create.Identifier().Capture(CAPTURE_GAME), create.Char(';')}); + AddMatchers({ + create.Keyword("game"), + create.Identifier().Capture(CAPTURE_GAME), + create.Char(';'), + }); } void SequenceGame::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceName.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceName.cpp index 73489fe05..efeb5b006 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceName.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceName.cpp @@ -8,7 +8,12 @@ SequenceName::SequenceName() const CommandsMatcherFactory create(this); AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); - AddMatchers({create.Keyword("set"), create.Keyword("name"), create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), create.Char(';')}); + AddMatchers({ + create.Keyword("set"), + create.Keyword("name"), + create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.Char(';'), + }); } void SequenceName::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceReorder.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceReorder.cpp index 4244b33de..58365f3d7 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceReorder.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceReorder.cpp @@ -10,12 +10,20 @@ SequenceReorder::SequenceReorder() const CommandsMatcherFactory create(this); AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); - AddMatchers({create.Keyword("reorder").Capture(CAPTURE_START), - create.Optional(create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE)), - create.Char(':'), - create.Optional(create.And({create.Char('.'), create.Char('.'), create.Char('.')}).Tag(TAG_FIND_FIRST)), - create.Loop(create.Identifier().Capture(CAPTURE_ENTRY)), - create.Char(';')}); + AddMatchers({ + create.Keyword("reorder").Capture(CAPTURE_START), + create.Optional(create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE)), + create.Char(':'), + create.Optional(create + .And({ + create.Char('.'), + create.Char('.'), + create.Char('.'), + }) + .Tag(TAG_FIND_FIRST)), + create.Loop(create.Identifier().Capture(CAPTURE_ENTRY)), + create.Char(';'), + }); } StructureInformation* SequenceReorder::GetType(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceReusable.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceReusable.cpp index deafe3970..8c1aece92 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceReusable.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceReusable.cpp @@ -8,8 +8,12 @@ SequenceReusable::SequenceReusable() const CommandsMatcherFactory create(this); AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); - AddMatchers( - {create.Keyword("set"), create.Keyword("reusable"), create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), create.Char(';')}); + AddMatchers({ + create.Keyword("set"), + create.Keyword("reusable"), + create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.Char(';'), + }); } void SequenceReusable::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceScriptString.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceScriptString.cpp index e2c1dc65e..54c52aa09 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceScriptString.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceScriptString.cpp @@ -8,8 +8,12 @@ SequenceScriptString::SequenceScriptString() const CommandsMatcherFactory create(this); AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); - AddMatchers( - {create.Keyword("set"), create.Keyword("scriptstring"), create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), create.Char(';')}); + AddMatchers({ + create.Keyword("set"), + create.Keyword("scriptstring"), + create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.Char(';'), + }); } void SequenceScriptString::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceSetBlock.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceSetBlock.cpp index bb9a03070..066565f0f 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceSetBlock.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceSetBlock.cpp @@ -8,12 +8,18 @@ SequenceSetBlock::SequenceSetBlock() const CommandsMatcherFactory create(this); AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); - AddMatchers({create.Keyword("set").Capture(CAPTURE_START), - create.Keyword("block"), - create.Or({create.And({create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.Identifier().Capture(CAPTURE_BLOCK_ENUM_ENTRY)}), - create.Identifier().Capture(CAPTURE_BLOCK_ENUM_ENTRY)}), - create.Char(';')}); + AddMatchers({ + create.Keyword("set").Capture(CAPTURE_START), + create.Keyword("block"), + create.Or({ + create.And({ + create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.Identifier().Capture(CAPTURE_BLOCK_ENUM_ENTRY), + }), + create.Identifier().Capture(CAPTURE_BLOCK_ENUM_ENTRY), + }), + create.Char(';'), + }); } void SequenceSetBlock::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceString.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceString.cpp index a82092ac9..79405a322 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceString.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceString.cpp @@ -10,8 +10,12 @@ SequenceString::SequenceString() const CommandsMatcherFactory create(this); AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); - AddMatchers( - {create.Keyword("set"), create.Keyword("string"), create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), create.Char(';')}); + AddMatchers({ + create.Keyword("set"), + create.Keyword("string"), + create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.Char(';'), + }); } void SequenceString::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceUse.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceUse.cpp index 3ba7cffff..b223ce940 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceUse.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceUse.cpp @@ -8,7 +8,11 @@ SequenceUse::SequenceUse() const CommandsMatcherFactory create(this); AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME); - AddMatchers({create.Keyword("use"), create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), create.Char(';')}); + AddMatchers({ + create.Keyword("use"), + create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.Char(';'), + }); } void SequenceUse::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockEnum.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockEnum.cpp index 8f09895d3..5a147599b 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockEnum.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockEnum.cpp @@ -19,7 +19,10 @@ HeaderBlockType HeaderBlockEnum::GetType() const std::vector<IHeaderBlock::sequence_t*>& HeaderBlockEnum::GetTestsForBlock() { - static std::vector<sequence_t*> tests({new SequenceCloseBlock(true), new SequenceEnumMember()}); + static std::vector<sequence_t*> tests({ + new SequenceCloseBlock(true), + new SequenceEnumMember(), + }); return tests; } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockNamespace.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockNamespace.cpp index 1fce375f7..6d7b60507 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockNamespace.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockNamespace.cpp @@ -20,13 +20,15 @@ HeaderBlockType HeaderBlockNamespace::GetType() const std::vector<IHeaderBlock::sequence_t*>& HeaderBlockNamespace::GetTestsForBlock() { - static std::vector<sequence_t*> tests({new SequenceCloseBlock(false), - new SequenceEnum(), - new SequenceForwardDecl(), - new SequenceNamespace(), - new SequenceStruct(), - new SequenceTypedef(), - new SequenceUnion()}); + static std::vector<sequence_t*> tests({ + new SequenceCloseBlock(false), + new SequenceEnum(), + new SequenceForwardDecl(), + new SequenceNamespace(), + new SequenceStruct(), + new SequenceTypedef(), + new SequenceUnion(), + }); return tests; } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockNone.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockNone.cpp index 02cf11f88..330cb6e77 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockNone.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockNone.cpp @@ -14,8 +14,14 @@ HeaderBlockType HeaderBlockNone::GetType() const std::vector<IHeaderBlock::sequence_t*>& HeaderBlockNone::GetTestsForBlock() { - static std::vector<sequence_t*> tests( - {new SequenceEnum(), new SequenceForwardDecl(), new SequenceNamespace(), new SequenceStruct(), new SequenceTypedef(), new SequenceUnion()}); + static std::vector<sequence_t*> tests({ + new SequenceEnum(), + new SequenceForwardDecl(), + new SequenceNamespace(), + new SequenceStruct(), + new SequenceTypedef(), + new SequenceUnion(), + }); return tests; } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockStruct.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockStruct.cpp index 2a07ab7f2..90ca7e6c0 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockStruct.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockStruct.cpp @@ -24,8 +24,13 @@ HeaderBlockType HeaderBlockStruct::GetType() const std::vector<IHeaderBlock::sequence_t*>& HeaderBlockStruct::GetTestsForBlock() { - static std::vector<sequence_t*> tests( - {new SequenceCloseBlock(true), new SequenceEnum(), new SequenceStruct(), new SequenceUnion(), new SequenceVariable()}); + static std::vector<sequence_t*> tests({ + new SequenceCloseBlock(true), + new SequenceEnum(), + new SequenceStruct(), + new SequenceUnion(), + new SequenceVariable(), + }); return tests; } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockUnion.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockUnion.cpp index f3570ae0e..13767f26d 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockUnion.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockUnion.cpp @@ -24,8 +24,13 @@ HeaderBlockType HeaderBlockUnion::GetType() const std::vector<IHeaderBlock::sequence_t*>& HeaderBlockUnion::GetTestsForBlock() { - static std::vector<sequence_t*> tests( - {new SequenceCloseBlock(true), new SequenceEnum(), new SequenceStruct(), new SequenceUnion(), new SequenceVariable()}); + static std::vector<sequence_t*> tests({ + new SequenceCloseBlock(true), + new SequenceEnum(), + new SequenceStruct(), + new SequenceUnion(), + new SequenceVariable(), + }); return tests; } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderCommonMatchers.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderCommonMatchers.cpp index 3b7482d50..90969e85a 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderCommonMatchers.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderCommonMatchers.cpp @@ -9,32 +9,50 @@ std::unique_ptr<HeaderCommonMatchers::matcher_t> HeaderCommonMatchers::Align(con { const HeaderMatcherFactory create(labelSupplier); - return create.Or({create - .And({create.Type(HeaderParserValueType::DECLSPEC), - create.Char('('), - create.Type(HeaderParserValueType::ALIGN), - create.Char('('), - create.Integer(), - create.Char(')'), - create.Char(')')}) - .Transform( - [](HeaderMatcherFactory::token_list_t& values) - { - return HeaderParserValue::Integer(values[4].get().GetPos(), values[4].get().IntegerValue()); - }), - create.And({create.Type(HeaderParserValueType::ALIGNAS), create.Char('('), create.Integer(), create.Char(')')}) - .Transform( - [](HeaderMatcherFactory::token_list_t& values) - { - return HeaderParserValue::Integer(values[2].get().GetPos(), values[2].get().IntegerValue()); - })}); + return create.Or({ + create + .And({ + create.Type(HeaderParserValueType::DECLSPEC), + create.Char('('), + create.Type(HeaderParserValueType::ALIGN), + create.Char('('), + create.Integer(), + create.Char(')'), + create.Char(')'), + }) + .Transform( + [](HeaderMatcherFactory::token_list_t& values) + { + return HeaderParserValue::Integer(values[4].get().GetPos(), values[4].get().IntegerValue()); + }), + create + .And({ + create.Type(HeaderParserValueType::ALIGNAS), + create.Char('('), + create.Integer(), + create.Char(')'), + }) + .Transform( + [](HeaderMatcherFactory::token_list_t& values) + { + return HeaderParserValue::Integer(values[2].get().GetPos(), values[2].get().IntegerValue()); + }), + }); } std::unique_ptr<HeaderCommonMatchers::matcher_t> HeaderCommonMatchers::ArrayDef(const supplier_t* labelSupplier) { const HeaderMatcherFactory create(labelSupplier); - return create.And({create.Char('['), create.Or({create.Integer(), create.Identifier()}), create.Char(']')}) + return create + .And({ + create.Char('['), + create.Or({ + create.Integer(), + create.Identifier(), + }), + create.Char(']'), + }) .Transform( [](HeaderMatcherFactory::token_list_t& values) { @@ -53,40 +71,56 @@ std::unique_ptr<HeaderCommonMatchers::matcher_t> HeaderCommonMatchers::Typename( const HeaderMatcherFactory create(labelSupplier); - return create.Or( - {create - .And({create.Optional(create.Type(HeaderParserValueType::UNSIGNED)), - create.Or({create.Type(HeaderParserValueType::CHAR), - create.Type(HeaderParserValueType::SHORT), - create.Type(HeaderParserValueType::INT), - create.And({create.Type(HeaderParserValueType::LONG), create.Optional(create.Type(HeaderParserValueType::LONG))})})}) - .Transform( - [](HeaderMatcherFactory::token_list_t& values) - { - std::ostringstream str; - auto first = true; + return create.Or({ + create + .And({ + create.Optional(create.Type(HeaderParserValueType::UNSIGNED)), + create.Or({ + create.Type(HeaderParserValueType::CHAR), + create.Type(HeaderParserValueType::SHORT), + create.Type(HeaderParserValueType::INT), + create.And({ + create.Type(HeaderParserValueType::LONG), + create.Optional(create.Type(HeaderParserValueType::LONG)), + }), + }), + }) + .Transform( + [](HeaderMatcherFactory::token_list_t& values) + { + std::ostringstream str; + auto first = true; - for (const auto& token : values) - { - if (first) - first = false; - else - str << " "; - str << BUILT_IN_TYPE_NAMES[static_cast<int>(token.get().m_type) - static_cast<int>(HeaderParserValueType::BUILT_IN_FIRST)]; - } + for (const auto& token : values) + { + if (first) + first = false; + else + str << " "; + str << BUILT_IN_TYPE_NAMES[static_cast<int>(token.get().m_type) - static_cast<int>(HeaderParserValueType::BUILT_IN_FIRST)]; + } - return HeaderParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); - }), - create.And({create.Identifier(), create.OptionalLoop(create.And({create.Char(':'), create.Char(':'), create.Identifier()}))}) - .Transform( - [](HeaderMatcherFactory::token_list_t& values) - { - std::ostringstream str; - str << values[0].get().IdentifierValue(); + return HeaderParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); + }), + create + .And({ + create.Identifier(), + create.OptionalLoop(create.And({ + create.Char(':'), + create.Char(':'), + create.Identifier(), + })), + }) + .Transform( + [](HeaderMatcherFactory::token_list_t& values) + { + std::ostringstream str; + str << values[0].get().IdentifierValue(); - for (auto i = 3u; i < values.size(); i += 3) - str << "::" << values[i].get().IdentifierValue(); + for (auto i = 3u; i < values.size(); i += 3) + str << "::" << values[i].get().IdentifierValue(); - return HeaderParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); - })}); + return HeaderParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); + }), + }); } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceCloseBlock.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceCloseBlock.cpp index 16aeedae7..668e2b26a 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceCloseBlock.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceCloseBlock.cpp @@ -9,8 +9,13 @@ SequenceCloseBlock::SequenceCloseBlock(const bool semicolonRequired) { const HeaderMatcherFactory create(this); - AddMatchers({create.Char('}').Capture(CAPTURE_CLOSING_PARENTHESIS), - create.Optional(create.And({create.Optional(create.Identifier().Capture(CAPTURE_NAME)), create.Char(';').Tag(TAG_SEMICOLON)}))}); + AddMatchers({ + create.Char('}').Capture(CAPTURE_CLOSING_PARENTHESIS), + create.Optional(create.And({ + create.Optional(create.Identifier().Capture(CAPTURE_NAME)), + create.Char(';').Tag(TAG_SEMICOLON), + })), + }); } void SequenceCloseBlock::ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnum.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnum.cpp index e5e0cee7c..b95330816 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnum.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnum.cpp @@ -9,11 +9,16 @@ SequenceEnum::SequenceEnum() const HeaderMatcherFactory create(this); AddLabeledMatchers(HeaderCommonMatchers::Typename(this), HeaderCommonMatchers::LABEL_TYPENAME); - AddMatchers({create.Optional(create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF)), - create.Type(HeaderParserValueType::ENUM), - create.Optional(create.Identifier().Capture(CAPTURE_NAME)), - create.Optional(create.And({create.Char(':'), create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_PARENT_TYPE)})), - create.Char('{')}); + AddMatchers({ + create.Optional(create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF)), + create.Type(HeaderParserValueType::ENUM), + create.Optional(create.Identifier().Capture(CAPTURE_NAME)), + create.Optional(create.And({ + create.Char(':'), + create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_PARENT_TYPE), + })), + create.Char('{'), + }); } void SequenceEnum::ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnumMember.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnumMember.cpp index 1ea705390..607276169 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnumMember.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnumMember.cpp @@ -8,10 +8,20 @@ SequenceEnumMember::SequenceEnumMember() { const HeaderMatcherFactory create(this); - AddMatchers( - {create.Identifier().Capture(CAPTURE_NAME), - create.Optional(create.And({create.Char('='), create.Or({create.Identifier().Capture(CAPTURE_VALUE), create.Integer().Capture(CAPTURE_VALUE)})})), - create.Or({create.Char(','), create.Char('}').NoConsume()})}); + AddMatchers({ + create.Identifier().Capture(CAPTURE_NAME), + create.Optional(create.And({ + create.Char('='), + create.Or({ + create.Identifier().Capture(CAPTURE_VALUE), + create.Integer().Capture(CAPTURE_VALUE), + }), + })), + create.Or({ + create.Char(','), + create.Char('}').NoConsume(), + }), + }); } void SequenceEnumMember::ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceForwardDecl.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceForwardDecl.cpp index 161d56807..ed71388ac 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceForwardDecl.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceForwardDecl.cpp @@ -7,13 +7,17 @@ SequenceForwardDecl::SequenceForwardDecl() { const HeaderMatcherFactory create(this); - AddMatchers({create - .Or({create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM), - create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), - create.Type(HeaderParserValueType::UNION).Tag(TAG_UNION)}) - .Capture(CAPTURE_TYPE), - create.Identifier().Capture(CAPTURE_NAME), - create.Char(';')}); + AddMatchers({ + create + .Or({ + create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM), + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + create.Type(HeaderParserValueType::UNION).Tag(TAG_UNION), + }) + .Capture(CAPTURE_TYPE), + create.Identifier().Capture(CAPTURE_NAME), + create.Char(';'), + }); } void SequenceForwardDecl::ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceNamespace.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceNamespace.cpp index f40e6c7ec..d878a7f5a 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceNamespace.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceNamespace.cpp @@ -7,7 +7,11 @@ SequenceNamespace::SequenceNamespace() { const HeaderMatcherFactory create(this); - AddMatchers({create.Type(HeaderParserValueType::NAMESPACE), create.Type(HeaderParserValueType::IDENTIFIER).Capture(CAPTURE_NAME), create.Char('{')}); + AddMatchers({ + create.Type(HeaderParserValueType::NAMESPACE), + create.Type(HeaderParserValueType::IDENTIFIER).Capture(CAPTURE_NAME), + create.Char('{'), + }); } void SequenceNamespace::ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceStruct.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceStruct.cpp index dda29228d..60a6a1542 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceStruct.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceStruct.cpp @@ -10,13 +10,18 @@ SequenceStruct::SequenceStruct() AddLabeledMatchers(HeaderCommonMatchers::Align(this), HeaderCommonMatchers::LABEL_ALIGN); AddLabeledMatchers(HeaderCommonMatchers::Typename(this), HeaderCommonMatchers::LABEL_TYPENAME); - AddMatchers({create.Optional(create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF)), - create.Optional(create.Type(HeaderParserValueType::CONST)), - create.Type(HeaderParserValueType::STRUCT), - create.Optional(create.Label(HeaderCommonMatchers::LABEL_ALIGN).Capture(CAPTURE_ALIGN)), - create.Optional(create.Identifier().Capture(CAPTURE_NAME)), - create.Optional(create.And({create.Char(':'), create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_PARENT_TYPE)})), - create.Char('{')}); + AddMatchers({ + create.Optional(create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF)), + create.Optional(create.Type(HeaderParserValueType::CONST)), + create.Type(HeaderParserValueType::STRUCT), + create.Optional(create.Label(HeaderCommonMatchers::LABEL_ALIGN).Capture(CAPTURE_ALIGN)), + create.Optional(create.Identifier().Capture(CAPTURE_NAME)), + create.Optional(create.And({ + create.Char(':'), + create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_PARENT_TYPE), + })), + create.Char('{'), + }); } void SequenceStruct::ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceTypedef.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceTypedef.cpp index 7b3995730..f56579b18 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceTypedef.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceTypedef.cpp @@ -13,28 +13,38 @@ SequenceTypedef::SequenceTypedef() AddLabeledMatchers(HeaderCommonMatchers::ArrayDef(this), HeaderCommonMatchers::LABEL_ARRAY_DEF); AddLabeledMatchers(HeaderCommonMatchers::Typename(this), HeaderCommonMatchers::LABEL_TYPENAME); - AddLabeledMatchers({create.Optional(create.Type(HeaderParserValueType::CONST).Tag(TAG_CONST)), - create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.OptionalLoop(create.Char('*').Tag(TAG_POINTER)), - create.Identifier().Capture(CAPTURE_NAME), - create.OptionalLoop(create.Label(HeaderCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY)), - create.Char(';')}, - LABEL_ARRAY_OF_POINTERS); - - AddLabeledMatchers({create.Optional(create.Type(HeaderParserValueType::CONST).Tag(TAG_CONST)), - create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.Char('('), - create.Loop(create.Char('*').Tag(TAG_POINTER)), - create.Identifier().Capture(CAPTURE_NAME), - create.Char(')'), - create.Loop(create.Label(HeaderCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY)), - create.Char(';')}, - LABEL_POINTER_TO_ARRAY); - - AddMatchers( - {create.Type(HeaderParserValueType::TYPEDEF), - create.Optional(create.Label(HeaderCommonMatchers::LABEL_ALIGN).Capture(CAPTURE_ALIGN)), - create.Or({create.Label(LABEL_ARRAY_OF_POINTERS).Tag(TAG_ARRAY_OF_POINTERS), create.Label(LABEL_POINTER_TO_ARRAY).Tag(TAG_POINTER_TO_ARRAY)})}); + AddLabeledMatchers( + { + create.Optional(create.Type(HeaderParserValueType::CONST).Tag(TAG_CONST)), + create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.OptionalLoop(create.Char('*').Tag(TAG_POINTER)), + create.Identifier().Capture(CAPTURE_NAME), + create.OptionalLoop(create.Label(HeaderCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY)), + create.Char(';'), + }, + LABEL_ARRAY_OF_POINTERS); + + AddLabeledMatchers( + { + create.Optional(create.Type(HeaderParserValueType::CONST).Tag(TAG_CONST)), + create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.Char('('), + create.Loop(create.Char('*').Tag(TAG_POINTER)), + create.Identifier().Capture(CAPTURE_NAME), + create.Char(')'), + create.Loop(create.Label(HeaderCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY)), + create.Char(';'), + }, + LABEL_POINTER_TO_ARRAY); + + AddMatchers({ + create.Type(HeaderParserValueType::TYPEDEF), + create.Optional(create.Label(HeaderCommonMatchers::LABEL_ALIGN).Capture(CAPTURE_ALIGN)), + create.Or({ + create.Label(LABEL_ARRAY_OF_POINTERS).Tag(TAG_ARRAY_OF_POINTERS), + create.Label(LABEL_POINTER_TO_ARRAY).Tag(TAG_POINTER_TO_ARRAY), + }), + }); } void SequenceTypedef::AddPointerDeclarationModifiers(SequenceResult<HeaderParserValue>& result, TypeDeclaration* typeDeclaration) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceUnion.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceUnion.cpp index a685b9632..ce7c0045b 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceUnion.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceUnion.cpp @@ -10,13 +10,18 @@ SequenceUnion::SequenceUnion() AddLabeledMatchers(HeaderCommonMatchers::Align(this), HeaderCommonMatchers::LABEL_ALIGN); AddLabeledMatchers(HeaderCommonMatchers::Typename(this), HeaderCommonMatchers::LABEL_TYPENAME); - AddMatchers({create.Optional(create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF)), - create.Optional(create.Type(HeaderParserValueType::CONST)), - create.Type(HeaderParserValueType::UNION), - create.Optional(create.Label(HeaderCommonMatchers::LABEL_ALIGN).Capture(CAPTURE_ALIGN)), - create.Optional(create.Identifier().Capture(CAPTURE_NAME)), - create.Optional(create.And({create.Char(':'), create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_PARENT_TYPE)})), - create.Char('{')}); + AddMatchers({ + create.Optional(create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF)), + create.Optional(create.Type(HeaderParserValueType::CONST)), + create.Type(HeaderParserValueType::UNION), + create.Optional(create.Label(HeaderCommonMatchers::LABEL_ALIGN).Capture(CAPTURE_ALIGN)), + create.Optional(create.Identifier().Capture(CAPTURE_NAME)), + create.Optional(create.And({ + create.Char(':'), + create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_PARENT_TYPE), + })), + create.Char('{'), + }); } void SequenceUnion::ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceVariable.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceVariable.cpp index da19809ae..ea9c8d9dd 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceVariable.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceVariable.cpp @@ -14,26 +14,38 @@ SequenceVariable::SequenceVariable() AddLabeledMatchers(HeaderCommonMatchers::ArrayDef(this), HeaderCommonMatchers::LABEL_ARRAY_DEF); AddLabeledMatchers(HeaderCommonMatchers::Typename(this), HeaderCommonMatchers::LABEL_TYPENAME); - AddLabeledMatchers({create.Optional(create.Type(HeaderParserValueType::CONST).Tag(TAG_CONST)), - create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.OptionalLoop(create.Char('*').Tag(TAG_POINTER)), - create.Identifier().Capture(CAPTURE_NAME), - create.OptionalLoop(create.Label(HeaderCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY)), - create.Optional(create.And({create.Char(':'), create.Integer().Capture(CAPTURE_BIT_SIZE)})), - create.Char(';')}, - LABEL_ARRAY_OF_POINTERS); - - AddLabeledMatchers({create.Optional(create.Type(HeaderParserValueType::CONST).Tag(TAG_CONST)), - create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), - create.Char('('), - create.Loop(create.Char('*').Tag(TAG_POINTER)), - create.Identifier().Capture(CAPTURE_NAME), - create.Char(')'), - create.Loop(create.Label(HeaderCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY)), - create.Char(';')}, - LABEL_POINTER_TO_ARRAY); - - AddMatchers(create.Or({create.Label(LABEL_ARRAY_OF_POINTERS).Tag(TAG_ARRAY_OF_POINTERS), create.Label(LABEL_POINTER_TO_ARRAY).Tag(TAG_POINTER_TO_ARRAY)})); + AddLabeledMatchers( + { + create.Optional(create.Type(HeaderParserValueType::CONST).Tag(TAG_CONST)), + create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.OptionalLoop(create.Char('*').Tag(TAG_POINTER)), + create.Identifier().Capture(CAPTURE_NAME), + create.OptionalLoop(create.Label(HeaderCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY)), + create.Optional(create.And({ + create.Char(':'), + create.Integer().Capture(CAPTURE_BIT_SIZE), + })), + create.Char(';'), + }, + LABEL_ARRAY_OF_POINTERS); + + AddLabeledMatchers( + { + create.Optional(create.Type(HeaderParserValueType::CONST).Tag(TAG_CONST)), + create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), + create.Char('('), + create.Loop(create.Char('*').Tag(TAG_POINTER)), + create.Identifier().Capture(CAPTURE_NAME), + create.Char(')'), + create.Loop(create.Label(HeaderCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY)), + create.Char(';'), + }, + LABEL_POINTER_TO_ARRAY); + + AddMatchers(create.Or({ + create.Label(LABEL_ARRAY_OF_POINTERS).Tag(TAG_ARRAY_OF_POINTERS), + create.Label(LABEL_POINTER_TO_ARRAY).Tag(TAG_POINTER_TO_ARRAY), + })); } void SequenceVariable::AddPointerDeclarationModifiers(SequenceResult<HeaderParserValue>& result, TypeDeclaration* typeDeclaration) const diff --git a/src/ZoneCommon/Game/IW4/GameAssetPoolIW4.cpp b/src/ZoneCommon/Game/IW4/GameAssetPoolIW4.cpp index b05195335..5ddea61de 100644 --- a/src/ZoneCommon/Game/IW4/GameAssetPoolIW4.cpp +++ b/src/ZoneCommon/Game/IW4/GameAssetPoolIW4.cpp @@ -9,11 +9,12 @@ using namespace IW4; const char* GameAssetPoolIW4::ASSET_TYPE_NAMES[]{ - "physpreset", "physcollmap", "xanim", "xmodelsurfs", "xmodel", "material", "pixelshader", "vertexshader", "vertexdecl", "techniqueset", - "image", "sound", "soundcurve", "loadedsound", "clipmap", "clipmap", "comworld", "gameworldsp", "gameworldmp", "mapents", - "fxworld", "gfxworld", "lightdef", "uimap", "font", "menulist", "menu", "localize", "weapon", "snddriverglobals", - "fx", "impactfx", "aitype", "mptype", "character", "xmodelalias", "rawfile", "stringtable", "leaderboard", "structureddatadef", - "tracer", "vehicle", "addonmapents"}; + "physpreset", "physcollmap", "xanim", "xmodelsurfs", "xmodel", "material", "pixelshader", "vertexshader", "vertexdecl", "techniqueset", + "image", "sound", "soundcurve", "loadedsound", "clipmap", "clipmap", "comworld", "gameworldsp", "gameworldmp", "mapents", + "fxworld", "gfxworld", "lightdef", "uimap", "font", "menulist", "menu", "localize", "weapon", "snddriverglobals", + "fx", "impactfx", "aitype", "mptype", "character", "xmodelalias", "rawfile", "stringtable", "leaderboard", "structureddatadef", + "tracer", "vehicle", "addonmapents", +}; /* Asset Pool Table diff --git a/src/ZoneCommon/Game/IW4/ZoneConstantsIW4.h b/src/ZoneCommon/Game/IW4/ZoneConstantsIW4.h index 8b6cbee48..42a334cdf 100644 --- a/src/ZoneCommon/Game/IW4/ZoneConstantsIW4.h +++ b/src/ZoneCommon/Game/IW4/ZoneConstantsIW4.h @@ -37,7 +37,8 @@ namespace IW4 0x89, 0x76, 0x11, 0xFD, 0x1B, 0x83, 0xE4, 0xE8, 0x8E, 0x7E, 0xB4, 0x03, 0xA3, 0x29, 0xDD, 0x4F, 0xAC, 0x99, 0xBE, 0x7C, 0xD3, 0xFD, 0x14, 0x28, 0x1C, 0x59, 0x69, 0xE0, 0x79, 0x5F, 0x4B, 0xDA, 0x6B, 0xAB, 0x48, 0x4E, 0x28, 0x39, 0x84, 0xC6, 0x2B, 0xC6, 0x20, 0x05, 0xDB, 0x05, 0x21, 0xC3, 0xE1, 0xD4, 0x20, 0x28, 0xDD, 0x3A, 0x4D, 0x51, 0xE7, 0x49, 0x8A, 0x49, 0xEF, 0xF5, 0xDA, 0xDA, 0x7D, 0x5D, 0xA8, 0x0B, 0xA1, - 0x77, 0xCD, 0x62, 0x7D, 0x9D, 0x40, 0x26, 0x44, 0x4B, 0x3B, 0x0A, 0x89, 0x02, 0x03, 0x01, 0x00, 0x01}; + 0x77, 0xCD, 0x62, 0x7D, 0x9D, 0x40, 0x26, 0x44, 0x4B, 0x3B, 0x0A, 0x89, 0x02, 0x03, 0x01, 0x00, 0x01, + }; static constexpr size_t AUTHED_CHUNK_SIZE = 0x2000; static constexpr unsigned AUTHED_CHUNK_COUNT_PER_GROUP = 256; diff --git a/src/ZoneCommon/Game/IW5/GameAssetPoolIW5.cpp b/src/ZoneCommon/Game/IW5/GameAssetPoolIW5.cpp index ceb8e3bcb..673c9a7af 100644 --- a/src/ZoneCommon/Game/IW5/GameAssetPoolIW5.cpp +++ b/src/ZoneCommon/Game/IW5/GameAssetPoolIW5.cpp @@ -8,52 +8,54 @@ using namespace IW5; -const char* GameAssetPoolIW5::ASSET_TYPE_NAMES[]{"physpreset", - "physcollmap", - "xanim", - "xmodelsurfs", - "xmodel", - "material", - "pixelshader", - "vertexshader", - "vertexdecl", - "techniqueset", - "image", - "sound", - "soundcurve", - "loadedsound", - "clipmap", - "comworld", - "glassworld", - "pathdata", - "vehicletrack", - "mapents", - "fxworld", - "gfxworld", - "lightdef", - "uimap", - "font", - "menulist", - "menu", - "localize", - "attachment", - "weapon", - "snddriverglobals", - "fx", - "impactfx", - "surfacefx", - "aitype", - "mptype", - "character", - "xmodelalias", - "rawfile", - "scriptfile", - "stringtable", - "leaderboard", - "structureddatadef", - "tracer", - "vehicle", - "addonmapents"}; +const char* GameAssetPoolIW5::ASSET_TYPE_NAMES[]{ + "physpreset", + "physcollmap", + "xanim", + "xmodelsurfs", + "xmodel", + "material", + "pixelshader", + "vertexshader", + "vertexdecl", + "techniqueset", + "image", + "sound", + "soundcurve", + "loadedsound", + "clipmap", + "comworld", + "glassworld", + "pathdata", + "vehicletrack", + "mapents", + "fxworld", + "gfxworld", + "lightdef", + "uimap", + "font", + "menulist", + "menu", + "localize", + "attachment", + "weapon", + "snddriverglobals", + "fx", + "impactfx", + "surfacefx", + "aitype", + "mptype", + "character", + "xmodelalias", + "rawfile", + "scriptfile", + "stringtable", + "leaderboard", + "structureddatadef", + "tracer", + "vehicle", + "addonmapents", +}; /* Asset Pool Table diff --git a/src/ZoneCommon/Game/IW5/ZoneConstantsIW5.h b/src/ZoneCommon/Game/IW5/ZoneConstantsIW5.h index 618b2ab79..27f6b9f51 100644 --- a/src/ZoneCommon/Game/IW5/ZoneConstantsIW5.h +++ b/src/ZoneCommon/Game/IW5/ZoneConstantsIW5.h @@ -34,7 +34,8 @@ namespace IW5 0x89, 0x76, 0x11, 0xFD, 0x1B, 0x83, 0xE4, 0xE8, 0x8E, 0x7E, 0xB4, 0x03, 0xA3, 0x29, 0xDD, 0x4F, 0xAC, 0x99, 0xBE, 0x7C, 0xD3, 0xFD, 0x14, 0x28, 0x1C, 0x59, 0x69, 0xE0, 0x79, 0x5F, 0x4B, 0xDA, 0x6B, 0xAB, 0x48, 0x4E, 0x28, 0x39, 0x84, 0xC6, 0x2B, 0xC6, 0x20, 0x05, 0xDB, 0x05, 0x21, 0xC3, 0xE1, 0xD4, 0x20, 0x28, 0xDD, 0x3A, 0x4D, 0x51, 0xE7, 0x49, 0x8A, 0x49, 0xEF, 0xF5, 0xDA, 0xDA, 0x7D, 0x5D, 0xA8, 0x0B, 0xA1, - 0x77, 0xCD, 0x62, 0x7D, 0x9D, 0x40, 0x26, 0x44, 0x4B, 0x3B, 0x0A, 0x89, 0x02, 0x03, 0x01, 0x00, 0x01}; + 0x77, 0xCD, 0x62, 0x7D, 0x9D, 0x40, 0x26, 0x44, 0x4B, 0x3B, 0x0A, 0x89, 0x02, 0x03, 0x01, 0x00, 0x01, + }; static constexpr size_t AUTHED_CHUNK_SIZE = 0x2000; static constexpr unsigned AUTHED_CHUNK_COUNT_PER_GROUP = 256; diff --git a/src/ZoneCommon/Game/T5/GameAssetPoolT5.cpp b/src/ZoneCommon/Game/T5/GameAssetPoolT5.cpp index 40f05d444..b5e6effac 100644 --- a/src/ZoneCommon/Game/T5/GameAssetPoolT5.cpp +++ b/src/ZoneCommon/Game/T5/GameAssetPoolT5.cpp @@ -15,7 +15,8 @@ const char* GameAssetPoolT5::ASSET_TYPE_NAMES[]{ "menulist", "menu", "localize", "weapon", "weapondef", "weaponvariant", "snddriverglobals", "fx", "fximpacttable", "aitype", "mptype", "mpbody", "mphead", "character", "xmodelalias", "rawfile", "stringtable", "packindex", "xglobals", "ddl", "glasses", - "emblemset"}; + "emblemset", +}; GameAssetPoolT5::GameAssetPoolT5(Zone* zone, const int priority) : ZoneAssetPools(zone), diff --git a/src/ZoneCommon/Game/T6/GameAssetPoolT6.cpp b/src/ZoneCommon/Game/T6/GameAssetPoolT6.cpp index c8e130206..300cab7de 100644 --- a/src/ZoneCommon/Game/T6/GameAssetPoolT6.cpp +++ b/src/ZoneCommon/Game/T6/GameAssetPoolT6.cpp @@ -8,66 +8,68 @@ using namespace T6; -const char* GameAssetPoolT6::ASSET_TYPE_NAMES[]{"xmodelpieces", - "physpreset", - "physconstraints", - "destructibledef", - "xanim", - "xmodel", - "material", - "techniqueset", - "image", - "soundbank", - "soundpatch", - "clipmap", - "clipmap", - "comworld", - "gameworldsp", - "gameworldmp", - "mapents", - "gfxworld", - "gfxlightdef", - "uimap", - "font", - "fonticon", - "menulist", - "menu", - "localize", - "weapon", - "weapondef", - "weaponvariant", - "weaponfull", - "attachment", - "attachmentunique", - "camo", - "snddriverglobals", - "fx", - "fximpacttable", - "aitype", - "mptype", - "mpbody", - "mphead", - "character", - "xmodelalias", - "rawfile", - "stringtable", - "leaderboard", - "xglobals", - "ddl", - "glasses", - "emblemset", - "script", - "keyvaluepairs", - "vehicle", - "memoryblock", - "addonmapents", - "tracer", - "skinnedverts", - "qdb", - "slug", - "footsteptable", - "footstepfxtable", - "zbarrier"}; +const char* GameAssetPoolT6::ASSET_TYPE_NAMES[]{ + "xmodelpieces", + "physpreset", + "physconstraints", + "destructibledef", + "xanim", + "xmodel", + "material", + "techniqueset", + "image", + "soundbank", + "soundpatch", + "clipmap", + "clipmap", + "comworld", + "gameworldsp", + "gameworldmp", + "mapents", + "gfxworld", + "gfxlightdef", + "uimap", + "font", + "fonticon", + "menulist", + "menu", + "localize", + "weapon", + "weapondef", + "weaponvariant", + "weaponfull", + "attachment", + "attachmentunique", + "camo", + "snddriverglobals", + "fx", + "fximpacttable", + "aitype", + "mptype", + "mpbody", + "mphead", + "character", + "xmodelalias", + "rawfile", + "stringtable", + "leaderboard", + "xglobals", + "ddl", + "glasses", + "emblemset", + "script", + "keyvaluepairs", + "vehicle", + "memoryblock", + "addonmapents", + "tracer", + "skinnedverts", + "qdb", + "slug", + "footsteptable", + "footstepfxtable", + "zbarrier", +}; GameAssetPoolT6::GameAssetPoolT6(Zone* zone, const int priority) : ZoneAssetPools(zone), diff --git a/src/ZoneCommon/Game/T6/ZoneConstantsT6.h b/src/ZoneCommon/Game/T6/ZoneConstantsT6.h index 217265888..d68535ca9 100644 --- a/src/ZoneCommon/Game/T6/ZoneConstantsT6.h +++ b/src/ZoneCommon/Game/T6/ZoneConstantsT6.h @@ -34,8 +34,10 @@ namespace T6 static constexpr size_t FILE_SUFFIX_ZERO_ALIGN = 0x40; static constexpr const char* MAGIC_AUTH_HEADER = "PHEEBs71"; - inline static const uint8_t SALSA20_KEY_TREYARCH[]{0x64, 0x1D, 0x8A, 0x2F, 0xE3, 0x1D, 0x3A, 0xA6, 0x36, 0x22, 0xBB, 0xC9, 0xCE, 0x85, 0x87, 0x22, - 0x9D, 0x42, 0xB0, 0xF8, 0xED, 0x9B, 0x92, 0x41, 0x30, 0xBF, 0x88, 0xB6, 0x5E, 0xDC, 0x50, 0xBE}; + inline static const uint8_t SALSA20_KEY_TREYARCH[]{ + 0x64, 0x1D, 0x8A, 0x2F, 0xE3, 0x1D, 0x3A, 0xA6, 0x36, 0x22, 0xBB, 0xC9, 0xCE, 0x85, 0x87, 0x22, + 0x9D, 0x42, 0xB0, 0xF8, 0xED, 0x9B, 0x92, 0x41, 0x30, 0xBF, 0x88, 0xB6, 0x5E, 0xDC, 0x50, 0xBE, + }; inline static const uint8_t RSA_PUBLIC_KEY_TREYARCH[]{ 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xc7, 0x9d, 0x33, 0xe0, 0x75, 0xaf, 0xef, 0x08, 0x08, 0x2b, 0x89, 0xd9, 0x3b, 0xf3, @@ -49,6 +51,7 @@ namespace T6 0x12, 0x69, 0x1e, 0xdb, 0x2d, 0x3e, 0xbd, 0x48, 0x16, 0xe1, 0x72, 0x37, 0xb8, 0x5f, 0x61, 0xfa, 0x24, 0x16, 0x3a, 0xde, 0xbf, 0x6a, 0x71, 0x62, 0x32, 0xf3, 0xaa, 0x7f, 0x28, 0x3a, 0x0c, 0x27, 0xeb, 0xa9, 0x0a, 0x4c, 0x79, 0x88, 0x84, 0xb3, 0xe2, 0x52, 0xb9, 0x68, 0x1e, 0x82, 0xcf, 0x67, 0x43, 0xf3, 0x68, 0xf7, 0x26, 0x19, 0xaa, 0xdd, 0x3f, 0x1e, 0xc6, 0x46, 0x11, 0x9f, 0x24, 0x23, 0xa7, 0xb0, 0x1b, 0x79, 0xa7, - 0x0c, 0x5a, 0xfe, 0x96, 0xf7, 0xe7, 0x88, 0x09, 0xa6, 0x69, 0xe3, 0x8b, 0x02, 0x03, 0x01, 0x00, 0x01}; + 0x0c, 0x5a, 0xfe, 0x96, 0xf7, 0xe7, 0x88, 0x09, 0xa6, 0x69, 0xe3, 0x8b, 0x02, 0x03, 0x01, 0x00, 0x01, + }; }; } // namespace T6 diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionAssetList.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionAssetList.cpp index 72d1a4fbe..2ba2af5ea 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionAssetList.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionAssetList.cpp @@ -6,7 +6,11 @@ SequenceZoneDefinitionAssetList::SequenceZoneDefinitionAssetList() { const ZoneDefinitionMatcherFactory create(this); - AddMatchers({create.Keyword("assetlist"), create.Char(','), create.Field().Capture(CAPTURE_ASSET_LIST_NAME)}); + AddMatchers({ + create.Keyword("assetlist"), + create.Char(','), + create.Field().Capture(CAPTURE_ASSET_LIST_NAME), + }); } void SequenceZoneDefinitionAssetList::ProcessMatch(ZoneDefinition* state, SequenceResult<ZoneDefinitionParserValue>& result) const diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionBuild.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionBuild.cpp index 423551024..a7a11a080 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionBuild.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionBuild.cpp @@ -6,7 +6,11 @@ SequenceZoneDefinitionBuild::SequenceZoneDefinitionBuild() { const ZoneDefinitionMatcherFactory create(this); - AddMatchers({create.Keyword("build"), create.Char(','), create.Field().Capture(CAPTURE_BUILD_TARGET_NAME)}); + AddMatchers({ + create.Keyword("build"), + create.Char(','), + create.Field().Capture(CAPTURE_BUILD_TARGET_NAME), + }); } void SequenceZoneDefinitionBuild::ProcessMatch(ZoneDefinition* state, SequenceResult<ZoneDefinitionParserValue>& result) const diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionEntry.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionEntry.cpp index db52b8b3d..dbdb150ee 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionEntry.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionEntry.cpp @@ -6,10 +6,17 @@ SequenceZoneDefinitionEntry::SequenceZoneDefinitionEntry() { const ZoneDefinitionMatcherFactory create(this); - AddMatchers({create.Field().Capture(CAPTURE_TYPE_NAME), - create.Char(','), - create.Optional(create.Char(',').Tag(TAG_REFERENCE)), - create.Or({create.String(), create.Field()}).Capture(CAPTURE_ASSET_NAME)}); + AddMatchers({ + create.Field().Capture(CAPTURE_TYPE_NAME), + create.Char(','), + create.Optional(create.Char(',').Tag(TAG_REFERENCE)), + create + .Or({ + create.String(), + create.Field(), + }) + .Capture(CAPTURE_ASSET_NAME), + }); } void SequenceZoneDefinitionEntry::ProcessMatch(ZoneDefinition* state, SequenceResult<ZoneDefinitionParserValue>& result) const diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionIgnore.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionIgnore.cpp index 1ecac14df..a6ea79af7 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionIgnore.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionIgnore.cpp @@ -6,7 +6,11 @@ SequenceZoneDefinitionIgnore::SequenceZoneDefinitionIgnore() { const ZoneDefinitionMatcherFactory create(this); - AddMatchers({create.Keyword("ignore"), create.Char(','), create.Field().Capture(CAPTURE_IGNORE_NAME)}); + AddMatchers({ + create.Keyword("ignore"), + create.Char(','), + create.Field().Capture(CAPTURE_IGNORE_NAME), + }); } void SequenceZoneDefinitionIgnore::ProcessMatch(ZoneDefinition* state, SequenceResult<ZoneDefinitionParserValue>& result) const diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionInclude.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionInclude.cpp index 1d94366d0..dda360f25 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionInclude.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionInclude.cpp @@ -6,7 +6,11 @@ SequenceZoneDefinitionInclude::SequenceZoneDefinitionInclude() { const ZoneDefinitionMatcherFactory create(this); - AddMatchers({create.Keyword("include"), create.Char(','), create.Field().Capture(CAPTURE_INCLUDE_NAME)}); + AddMatchers({ + create.Keyword("include"), + create.Char(','), + create.Field().Capture(CAPTURE_INCLUDE_NAME), + }); } void SequenceZoneDefinitionInclude::ProcessMatch(ZoneDefinition* state, SequenceResult<ZoneDefinitionParserValue>& result) const diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionMetaData.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionMetaData.cpp index 0a662cf03..56e8cd3d7 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionMetaData.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionMetaData.cpp @@ -6,7 +6,12 @@ SequenceZoneDefinitionMetaData::SequenceZoneDefinitionMetaData() { const ZoneDefinitionMatcherFactory create(this); - AddMatchers({create.Char('>'), create.Field().Capture(CAPTURE_KEY), create.Char(','), create.Field().Capture(CAPTURE_VALUE)}); + AddMatchers({ + create.Char('>'), + create.Field().Capture(CAPTURE_KEY), + create.Char(','), + create.Field().Capture(CAPTURE_VALUE), + }); } void SequenceZoneDefinitionMetaData::ProcessMatch(ZoneDefinition* state, SequenceResult<ZoneDefinitionParserValue>& result) const diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionParser.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionParser.cpp index 32163600d..5ae6bfc20 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionParser.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionParser.cpp @@ -14,12 +14,14 @@ ZoneDefinitionParser::ZoneDefinitionParser(ZoneDefinitionLexer* lexer) const std::vector<AbstractParser<ZoneDefinitionParserValue, ZoneDefinition>::sequence_t*>& ZoneDefinitionParser::GetTestsForState() { - static std::vector<sequence_t*> tests({new SequenceZoneDefinitionMetaData(), - new SequenceZoneDefinitionInclude(), - new SequenceZoneDefinitionIgnore(), - new SequenceZoneDefinitionAssetList(), - new SequenceZoneDefinitionBuild(), - new SequenceZoneDefinitionEntry()}); + static std::vector<sequence_t*> tests({ + new SequenceZoneDefinitionMetaData(), + new SequenceZoneDefinitionInclude(), + new SequenceZoneDefinitionIgnore(), + new SequenceZoneDefinitionAssetList(), + new SequenceZoneDefinitionBuild(), + new SequenceZoneDefinitionEntry(), + }); return tests; } diff --git a/src/ZoneLoading/ZoneLoading.cpp b/src/ZoneLoading/ZoneLoading.cpp index cf9041de2..6842cb1fb 100644 --- a/src/ZoneLoading/ZoneLoading.cpp +++ b/src/ZoneLoading/ZoneLoading.cpp @@ -14,7 +14,12 @@ namespace fs = std::filesystem; IZoneLoaderFactory* ZoneLoaderFactories[]{ - new IW3::ZoneLoaderFactory(), new IW4::ZoneLoaderFactory(), new IW5::ZoneLoaderFactory(), new T5::ZoneLoaderFactory(), new T6::ZoneLoaderFactory()}; + new IW3::ZoneLoaderFactory(), + new IW4::ZoneLoaderFactory(), + new IW5::ZoneLoaderFactory(), + new T5::ZoneLoaderFactory(), + new T6::ZoneLoaderFactory(), +}; std::unique_ptr<Zone> ZoneLoading::LoadZone(const std::string& path) { diff --git a/src/ZoneWriting/ZoneWriting.cpp b/src/ZoneWriting/ZoneWriting.cpp index b0c3af93d..eaf3ebcc8 100644 --- a/src/ZoneWriting/ZoneWriting.cpp +++ b/src/ZoneWriting/ZoneWriting.cpp @@ -8,7 +8,12 @@ #include "Writing/IZoneWriterFactory.h" IZoneWriterFactory* ZoneWriterFactories[]{ - new IW3::ZoneWriterFactory(), new IW4::ZoneWriterFactory(), new IW5::ZoneWriterFactory(), new T5::ZoneWriterFactory(), new T6::ZoneWriterFactory()}; + new IW3::ZoneWriterFactory(), + new IW4::ZoneWriterFactory(), + new IW5::ZoneWriterFactory(), + new T5::ZoneWriterFactory(), + new T6::ZoneWriterFactory(), +}; bool ZoneWriting::WriteZone(std::ostream& stream, Zone* zone) { diff --git a/test/ObjLoadingTests/Parsing/Menu/Sequence/EventHandlerSetScopeSequencesTests.cpp b/test/ObjLoadingTests/Parsing/Menu/Sequence/EventHandlerSetScopeSequencesTests.cpp index 3f01ebb81..63c87085e 100644 --- a/test/ObjLoadingTests/Parsing/Menu/Sequence/EventHandlerSetScopeSequencesTests.cpp +++ b/test/ObjLoadingTests/Parsing/Menu/Sequence/EventHandlerSetScopeSequencesTests.cpp @@ -71,10 +71,12 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Identifier(pos, new std::string("fadein")), - SimpleParserValue::String(pos, new std::string("some_element")), - SimpleParserValue::Character(pos, ';'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Identifier(pos, new std::string("fadein")), + SimpleParserValue::String(pos, new std::string("some_element")), + SimpleParserValue::Character(pos, ';'), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -89,10 +91,12 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Identifier(pos, new std::string("noScriptCommand")), - SimpleParserValue::String(pos, new std::string("some_element")), - SimpleParserValue::Character(pos, ';'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Identifier(pos, new std::string("noScriptCommand")), + SimpleParserValue::String(pos, new std::string("some_element")), + SimpleParserValue::Character(pos, ';'), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -104,11 +108,13 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, true); const TokenPos pos; - helper.Tokens({SimpleParserValue::Identifier(pos, new std::string("uiScript")), - SimpleParserValue::Identifier(pos, new std::string("somethingUnknown")), - SimpleParserValue::String(pos, new std::string("anArgumentForTheUnknownScript")), - SimpleParserValue::Character(pos, ';'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Identifier(pos, new std::string("uiScript")), + SimpleParserValue::Identifier(pos, new std::string("somethingUnknown")), + SimpleParserValue::String(pos, new std::string("anArgumentForTheUnknownScript")), + SimpleParserValue::Character(pos, ';'), + SimpleParserValue::EndOfFile(pos), + }); auto result = helper.PerformTest(); REQUIRE(result); @@ -161,42 +167,60 @@ namespace test::parsing::menu::sequence::event_handler_set TEST_CASE("EventHandlerSetScopeSequences: Ensure can use fadeIn", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("fadeIn")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("fadeIn")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, R"("fadeIn" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use fadeOut", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("fadeOut")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("fadeOut")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, R"("fadeOut" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use show", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("show")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("show")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, R"("show" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use hide", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("hide")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("hide")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, R"("hide" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use showMenu", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("showMenu")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("showMenu")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, R"("showMenu" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use hideMenu", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("hideMenu")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("hideMenu")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, R"("hideMenu" "some_element" ; )"); } @@ -254,10 +278,12 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Identifier(pos, new std::string("setColor")), - SimpleParserValue::Identifier(TokenPos(), new std::string("backColor")), - SimpleParserValue::Character(pos, ';'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Identifier(pos, new std::string("setColor")), + SimpleParserValue::Identifier(TokenPos(), new std::string("backColor")), + SimpleParserValue::Character(pos, ';'), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -268,50 +294,71 @@ namespace test::parsing::menu::sequence::event_handler_set TEST_CASE("EventHandlerSetScopeSequences: Ensure can use open", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("open")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("open")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, R"("open" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use close", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("close")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("close")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, R"("close" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use escape", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("escape")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("escape")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, R"("escape" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use closeForAllPlayers", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("closeForAllPlayers")), - SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, - R"("closeForAllPlayers" "some_element" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("closeForAllPlayers")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, + R"("closeForAllPlayers" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use ingameOpen", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("ingameOpen")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("ingameOpen")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, R"("ingameOpen" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use ingameClose", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("ingameClose")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("ingameClose")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, R"("ingameClose" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use setBackground", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("setBackground")), - SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, - R"("setBackground" "some_element" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("setBackground")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, + R"("setBackground" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use setItemColor with forecolor", "[parsing][sequence][menu]") @@ -386,14 +433,20 @@ namespace test::parsing::menu::sequence::event_handler_set TEST_CASE("EventHandlerSetScopeSequences: Ensure can use setFocus", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("setFocus")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("setFocus")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, R"("setFocus" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use setFocusByDvar", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("setFocusByDvar")), SimpleParserValue::String(TokenPos(), new std::string("some_dvar"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("setFocusByDvar")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + }, R"("setFocusByDvar" "some_dvar" ; )"); } @@ -411,202 +464,305 @@ namespace test::parsing::menu::sequence::event_handler_set TEST_CASE("EventHandlerSetScopeSequences: Ensure can use exec", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("exec")), SimpleParserValue::String(TokenPos(), new std::string("some_command"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("exec")), + SimpleParserValue::String(TokenPos(), new std::string("some_command")), + }, R"("exec" "some_command" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use execNow", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("execNow")), SimpleParserValue::String(TokenPos(), new std::string("some_command"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("execNow")), + SimpleParserValue::String(TokenPos(), new std::string("some_command")), + }, R"("execNow" "some_command" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use execOnDvarStringValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("execOnDvarStringValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::String(TokenPos(), new std::string("some_value")), - SimpleParserValue::String(TokenPos(), new std::string("some_command"))}, - R"("execOnDvarStringValue" "some_dvar" "some_value" "some_command" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("execOnDvarStringValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::String(TokenPos(), new std::string("some_value")), + SimpleParserValue::String(TokenPos(), new std::string("some_command")), + }, + R"("execOnDvarStringValue" "some_dvar" "some_value" "some_command" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use execOnDvarIntValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("execOnDvarIntValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::Integer(TokenPos(), 1), - SimpleParserValue::String(TokenPos(), new std::string("some_command"))}, - R"("execOnDvarIntValue" "some_dvar" "1" "some_command" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("execOnDvarIntValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::Integer(TokenPos(), 1), + SimpleParserValue::String(TokenPos(), new std::string("some_command")), + }, + R"("execOnDvarIntValue" "some_dvar" "1" "some_command" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use execOnDvarFloatValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("execOnDvarFloatValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::Integer(TokenPos(), 1), - SimpleParserValue::String(TokenPos(), new std::string("some_command"))}, - R"("execOnDvarFloatValue" "some_dvar" "1" "some_command" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("execOnDvarFloatValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::Integer(TokenPos(), 1), + SimpleParserValue::String(TokenPos(), new std::string("some_command")), + }, + R"("execOnDvarFloatValue" "some_dvar" "1" "some_command" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use execNowOnDvarStringValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("execNowOnDvarStringValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::String(TokenPos(), new std::string("some_value")), - SimpleParserValue::String(TokenPos(), new std::string("some_command"))}, - R"("execNowOnDvarStringValue" "some_dvar" "some_value" "some_command" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("execNowOnDvarStringValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::String(TokenPos(), new std::string("some_value")), + SimpleParserValue::String(TokenPos(), new std::string("some_command")), + }, + R"("execNowOnDvarStringValue" "some_dvar" "some_value" "some_command" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use execNowOnDvarIntValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("execNowOnDvarIntValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::Integer(TokenPos(), 1), - SimpleParserValue::String(TokenPos(), new std::string("some_command"))}, - R"("execNowOnDvarIntValue" "some_dvar" "1" "some_command" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("execNowOnDvarIntValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::Integer(TokenPos(), 1), + SimpleParserValue::String(TokenPos(), new std::string("some_command")), + }, + R"("execNowOnDvarIntValue" "some_dvar" "1" "some_command" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use execNowOnDvarFloatValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("execNowOnDvarFloatValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::Integer(TokenPos(), 1), - SimpleParserValue::String(TokenPos(), new std::string("some_command"))}, - R"("execNowOnDvarFloatValue" "some_dvar" "1" "some_command" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("execNowOnDvarFloatValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::Integer(TokenPos(), 1), + SimpleParserValue::String(TokenPos(), new std::string("some_command")), + }, + R"("execNowOnDvarFloatValue" "some_dvar" "1" "some_command" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use play", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("play")), SimpleParserValue::String(TokenPos(), new std::string("some_sound"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("play")), + SimpleParserValue::String(TokenPos(), new std::string("some_sound")), + }, R"("play" "some_sound" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use scriptMenuResponse", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("scriptMenuResponse")), - SimpleParserValue::String(TokenPos(), new std::string("some_response"))}, - R"("scriptMenuResponse" "some_response" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("scriptMenuResponse")), + SimpleParserValue::String(TokenPos(), new std::string("some_response")), + }, + R"("scriptMenuResponse" "some_response" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use scriptMenuRespondOnDvarStringValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("scriptMenuRespondOnDvarStringValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::String(TokenPos(), new std::string("some_value")), - SimpleParserValue::String(TokenPos(), new std::string("some_response"))}, - R"("scriptMenuRespondOnDvarStringValue" "some_dvar" "some_value" "some_response" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("scriptMenuRespondOnDvarStringValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::String(TokenPos(), new std::string("some_value")), + SimpleParserValue::String(TokenPos(), new std::string("some_response")), + }, + R"("scriptMenuRespondOnDvarStringValue" "some_dvar" "some_value" "some_response" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use scriptMenuRespondOnDvarIntValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("scriptMenuRespondOnDvarIntValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::Integer(TokenPos(), 1), - SimpleParserValue::String(TokenPos(), new std::string("some_response"))}, - R"("scriptMenuRespondOnDvarIntValue" "some_dvar" "1" "some_response" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("scriptMenuRespondOnDvarIntValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::Integer(TokenPos(), 1), + SimpleParserValue::String(TokenPos(), new std::string("some_response")), + }, + R"("scriptMenuRespondOnDvarIntValue" "some_dvar" "1" "some_response" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use scriptMenuRespondOnDvarFloatValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("scriptMenuRespondOnDvarFloatValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::Integer(TokenPos(), 1), - SimpleParserValue::String(TokenPos(), new std::string("some_response"))}, - R"("scriptMenuRespondOnDvarFloatValue" "some_dvar" "1" "some_response" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("scriptMenuRespondOnDvarFloatValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::Integer(TokenPos(), 1), + SimpleParserValue::String(TokenPos(), new std::string("some_response")), + }, + R"("scriptMenuRespondOnDvarFloatValue" "some_dvar" "1" "some_response" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use updateMail", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("updateMail"))}, R"("updateMail" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("updateMail")), + }, + R"("updateMail" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use openMail", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("openMail"))}, R"("openMail" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("openMail")), + }, + R"("openMail" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use deleteMail", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("deleteMail"))}, R"("deleteMail" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("deleteMail")), + }, + R"("deleteMail" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use doMailLottery", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("doMailLottery"))}, R"("doMailLottery" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("doMailLottery")), + }, + R"("doMailLottery" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use resetStatsConfirm", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("resetStatsConfirm"))}, R"("resetStatsConfirm" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("resetStatsConfirm")), + }, + R"("resetStatsConfirm" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use resetStatsCancel", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("resetStatsCancel"))}, R"("resetStatsCancel" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("resetStatsCancel")), + }, + R"("resetStatsCancel" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use setGameMode", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("setGameMode")), - SimpleParserValue::String(TokenPos(), new std::string("some_game_mode"))}, - R"("setGameMode" "some_game_mode" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("setGameMode")), + SimpleParserValue::String(TokenPos(), new std::string("some_game_mode")), + }, + R"("setGameMode" "some_game_mode" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use feederTop", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("feederTop"))}, R"("feederTop" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("feederTop")), + }, + R"("feederTop" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use feederBottom", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("feederBottom"))}, R"("feederBottom" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("feederBottom")), + }, + R"("feederBottom" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use showGamerCard", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("showGamerCard"))}, R"("showGamerCard" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("showGamerCard")), + }, + R"("showGamerCard" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use openForGameType", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("openForGameType")), - SimpleParserValue::String(TokenPos(), new std::string("some_game_type"))}, - R"("openForGameType" "some_game_type" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("openForGameType")), + SimpleParserValue::String(TokenPos(), new std::string("some_game_type")), + }, + R"("openForGameType" "some_game_type" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use closeForGameType", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("closeForGameType")), - SimpleParserValue::String(TokenPos(), new std::string("some_game_type"))}, - R"("closeForGameType" "some_game_type" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("closeForGameType")), + SimpleParserValue::String(TokenPos(), new std::string("some_game_type")), + }, + R"("closeForGameType" "some_game_type" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use kickPlayer", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("kickPlayer"))}, R"("kickPlayer" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("kickPlayer")), + }, + R"("kickPlayer" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use getKickPlayerQuestion", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("getKickPlayerQuestion"))}, R"("getKickPlayerQuestion" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("getKickPlayerQuestion")), + }, + R"("getKickPlayerQuestion" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use partyUpdateMissingMapPackDvar", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("partyUpdateMissingMapPackDvar"))}, - R"("partyUpdateMissingMapPackDvar" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("partyUpdateMissingMapPackDvar")), + }, + R"("partyUpdateMissingMapPackDvar" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use togglePlayerMute", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("togglePlayerMute"))}, R"("togglePlayerMute" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("togglePlayerMute")), + }, + R"("togglePlayerMute" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use resolveError", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("resolveError"))}, R"("resolveError" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("resolveError")), + }, + R"("resolveError" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use lerp scale", "[parsing][sequence][menu]") @@ -745,15 +901,17 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Identifier(TokenPos(), new std::string("setLocalVarBool")), - SimpleParserValue::Identifier(TokenPos(), new std::string("sample_var")), - SimpleParserValue::Identifier(TokenPos(), new std::string("milliseconds")), - SimpleParserValue::Character(TokenPos(), '('), - SimpleParserValue::Character(TokenPos(), ')'), - SimpleParserValue::Character(TokenPos(), '%'), - SimpleParserValue::Integer(TokenPos(), 2), - SimpleParserValue::Character(TokenPos(), ';'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Identifier(TokenPos(), new std::string("setLocalVarBool")), + SimpleParserValue::Identifier(TokenPos(), new std::string("sample_var")), + SimpleParserValue::Identifier(TokenPos(), new std::string("milliseconds")), + SimpleParserValue::Character(TokenPos(), '('), + SimpleParserValue::Character(TokenPos(), ')'), + SimpleParserValue::Character(TokenPos(), '%'), + SimpleParserValue::Integer(TokenPos(), 2), + SimpleParserValue::Character(TokenPos(), ';'), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); REQUIRE(result); @@ -778,15 +936,17 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Identifier(TokenPos(), new std::string("setLocalVarInt")), - SimpleParserValue::Identifier(TokenPos(), new std::string("sample_var")), - SimpleParserValue::Identifier(TokenPos(), new std::string("milliseconds")), - SimpleParserValue::Character(TokenPos(), '('), - SimpleParserValue::Character(TokenPos(), ')'), - SimpleParserValue::Character(TokenPos(), '*'), - SimpleParserValue::Integer(TokenPos(), 2), - SimpleParserValue::Character(TokenPos(), ';'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Identifier(TokenPos(), new std::string("setLocalVarInt")), + SimpleParserValue::Identifier(TokenPos(), new std::string("sample_var")), + SimpleParserValue::Identifier(TokenPos(), new std::string("milliseconds")), + SimpleParserValue::Character(TokenPos(), '('), + SimpleParserValue::Character(TokenPos(), ')'), + SimpleParserValue::Character(TokenPos(), '*'), + SimpleParserValue::Integer(TokenPos(), 2), + SimpleParserValue::Character(TokenPos(), ';'), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); REQUIRE(result); @@ -811,15 +971,17 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Identifier(TokenPos(), new std::string("setLocalVarFloat")), - SimpleParserValue::Identifier(TokenPos(), new std::string("sample_var")), - SimpleParserValue::Identifier(TokenPos(), new std::string("milliseconds")), - SimpleParserValue::Character(TokenPos(), '('), - SimpleParserValue::Character(TokenPos(), ')'), - SimpleParserValue::Character(TokenPos(), '/'), - SimpleParserValue::Integer(TokenPos(), 2), - SimpleParserValue::Character(TokenPos(), ';'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Identifier(TokenPos(), new std::string("setLocalVarFloat")), + SimpleParserValue::Identifier(TokenPos(), new std::string("sample_var")), + SimpleParserValue::Identifier(TokenPos(), new std::string("milliseconds")), + SimpleParserValue::Character(TokenPos(), '('), + SimpleParserValue::Character(TokenPos(), ')'), + SimpleParserValue::Character(TokenPos(), '/'), + SimpleParserValue::Integer(TokenPos(), 2), + SimpleParserValue::Character(TokenPos(), ';'), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); REQUIRE(result); @@ -844,15 +1006,17 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Identifier(TokenPos(), new std::string("setLocalVarString")), - SimpleParserValue::Identifier(TokenPos(), new std::string("sample_var")), - SimpleParserValue::Identifier(TokenPos(), new std::string("milliseconds")), - SimpleParserValue::Character(TokenPos(), '('), - SimpleParserValue::Character(TokenPos(), ')'), - SimpleParserValue::Character(TokenPos(), '+'), - SimpleParserValue::String(TokenPos(), new std::string(" Hello")), - SimpleParserValue::Character(TokenPos(), ';'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Identifier(TokenPos(), new std::string("setLocalVarString")), + SimpleParserValue::Identifier(TokenPos(), new std::string("sample_var")), + SimpleParserValue::Identifier(TokenPos(), new std::string("milliseconds")), + SimpleParserValue::Character(TokenPos(), '('), + SimpleParserValue::Character(TokenPos(), ')'), + SimpleParserValue::Character(TokenPos(), '+'), + SimpleParserValue::String(TokenPos(), new std::string(" Hello")), + SimpleParserValue::Character(TokenPos(), ';'), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); REQUIRE(result); @@ -881,7 +1045,10 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -899,7 +1066,10 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::EndOfFile(pos), + }); helper.m_state->m_current_script << R"("fadeIn" "some_element" ; )"; @@ -925,14 +1095,16 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Identifier(pos, new std::string("if")), - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 1336), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 1), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Identifier(pos, new std::string("if")), + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 1336), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -969,12 +1141,14 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Identifier(pos, new std::string("if")), - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Identifier(pos, new std::string("if")), + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos), + }); helper.m_state->m_current_script << R"("fadeIn" "some_element" ; )"; @@ -1006,15 +1180,17 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), - SimpleParserValue::Identifier(pos, new std::string("elseif")), - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 1336), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 1), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::Identifier(pos, new std::string("elseif")), + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 1336), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos), + }); const auto currentIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), nullptr); helper.m_state->m_current_nested_event_handler_set = currentIfCondition->m_condition_elements.get(); @@ -1058,13 +1234,15 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), - SimpleParserValue::Identifier(pos, new std::string("elseif")), - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::Identifier(pos, new std::string("elseif")), + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos), + }); const auto currentIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), nullptr); helper.m_state->m_current_nested_event_handler_set = currentIfCondition->m_condition_elements.get(); @@ -1100,13 +1278,15 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), - SimpleParserValue::Identifier(pos, new std::string("elseif")), - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::Identifier(pos, new std::string("elseif")), + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos), + }); REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException); } @@ -1115,13 +1295,15 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), - SimpleParserValue::Identifier(pos, new std::string("elseif")), - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::Identifier(pos, new std::string("elseif")), + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos), + }); const auto currentIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), std::make_unique<CommonEventHandlerSet>()); @@ -1136,10 +1318,12 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), - SimpleParserValue::Identifier(pos, new std::string("else")), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::Identifier(pos, new std::string("else")), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos), + }); const auto currentIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), nullptr); helper.m_state->m_current_nested_event_handler_set = currentIfCondition->m_condition_elements.get(); @@ -1166,10 +1350,12 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), - SimpleParserValue::Identifier(pos, new std::string("else")), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::Identifier(pos, new std::string("else")), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos), + }); const auto currentIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), nullptr); helper.m_state->m_current_nested_event_handler_set = currentIfCondition->m_condition_elements.get(); @@ -1196,10 +1382,12 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), - SimpleParserValue::Identifier(pos, new std::string("else")), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::Identifier(pos, new std::string("else")), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos), + }); REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException); } @@ -1208,10 +1396,12 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), - SimpleParserValue::Identifier(pos, new std::string("else")), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::Identifier(pos, new std::string("else")), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos), + }); const auto currentIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), std::make_unique<CommonEventHandlerSet>()); @@ -1226,7 +1416,10 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::EndOfFile(pos), + }); const auto currentIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), nullptr); helper.m_state->m_current_nested_event_handler_set = currentIfCondition->m_condition_elements.get(); @@ -1248,7 +1441,10 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::EndOfFile(pos), + }); const auto baseIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), nullptr); helper.m_state->m_current_nested_event_handler_set = baseIfCondition->m_condition_elements.get(); @@ -1274,7 +1470,10 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::EndOfFile(pos), + }); const auto baseIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), std::make_unique<CommonEventHandlerSet>()); @@ -1302,7 +1501,10 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::EndOfFile(pos), + }); const auto baseIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), nullptr); helper.m_state->m_current_nested_event_handler_set = baseIfCondition->m_condition_elements.get(); @@ -1332,7 +1534,10 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::EndOfFile(pos), + }); const auto baseIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), nullptr); helper.m_state->m_current_nested_event_handler_set = baseIfCondition->m_condition_elements.get(); diff --git a/test/ObjLoadingTests/Parsing/Menu/Sequence/ItemScopeSequencesTests.cpp b/test/ObjLoadingTests/Parsing/Menu/Sequence/ItemScopeSequencesTests.cpp index 818bed7a8..7109a818b 100644 --- a/test/ObjLoadingTests/Parsing/Menu/Sequence/ItemScopeSequencesTests.cpp +++ b/test/ObjLoadingTests/Parsing/Menu/Sequence/ItemScopeSequencesTests.cpp @@ -66,18 +66,20 @@ namespace test::parsing::menu::sequence::item { ItemSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Identifier(pos, new std::string("dvarStrList")), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::String(pos, new std::string("@MENU_AUTO")), - SimpleParserValue::String(pos, new std::string("auto")), - SimpleParserValue::String(pos, new std::string("@MENU_STANDARD_4_3")), - SimpleParserValue::String(pos, new std::string("standard")), - SimpleParserValue::String(pos, new std::string("@MENU_WIDE_16_10")), - SimpleParserValue::String(pos, new std::string("wide 16:10")), - SimpleParserValue::String(pos, new std::string("@MENU_WIDE_16_9")), - SimpleParserValue::String(pos, new std::string("wide 16:9")), - SimpleParserValue::Character(pos, '}'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Identifier(pos, new std::string("dvarStrList")), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::String(pos, new std::string("@MENU_AUTO")), + SimpleParserValue::String(pos, new std::string("auto")), + SimpleParserValue::String(pos, new std::string("@MENU_STANDARD_4_3")), + SimpleParserValue::String(pos, new std::string("standard")), + SimpleParserValue::String(pos, new std::string("@MENU_WIDE_16_10")), + SimpleParserValue::String(pos, new std::string("wide 16:10")), + SimpleParserValue::String(pos, new std::string("@MENU_WIDE_16_9")), + SimpleParserValue::String(pos, new std::string("wide 16:9")), + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::EndOfFile(pos), + }); helper.m_item->m_feature_type = CommonItemFeatureType::MULTI_VALUE; helper.m_item->m_multi_value_features = std::make_unique<CommonItemFeaturesMultiValue>(); diff --git a/test/ParserTests/Parsing/Simple/SimpleExpressionTests.cpp b/test/ParserTests/Parsing/Simple/SimpleExpressionTests.cpp index 4ce91aec1..2e2778a79 100644 --- a/test/ParserTests/Parsing/Simple/SimpleExpressionTests.cpp +++ b/test/ParserTests/Parsing/Simple/SimpleExpressionTests.cpp @@ -59,7 +59,9 @@ namespace test::parsing::simple::expression protected: const std::vector<sequence_t*>& GetTestsForState() override { - static std::vector<sequence_t*> tests({new SimpleExpressionSequence()}); + static std::vector<sequence_t*> tests({ + new SimpleExpressionSequence(), + }); return tests; } @@ -140,10 +142,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 1336), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 1), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 1336), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -162,10 +166,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 428), - SimpleParserValue::Character(pos, '-'), - SimpleParserValue::Integer(pos, 8), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 428), + SimpleParserValue::Character(pos, '-'), + SimpleParserValue::Integer(pos, 8), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -184,10 +190,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 105), - SimpleParserValue::Character(pos, '*'), - SimpleParserValue::Integer(pos, 4), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 105), + SimpleParserValue::Character(pos, '*'), + SimpleParserValue::Integer(pos, 4), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -206,10 +214,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 561540), - SimpleParserValue::Character(pos, '/'), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 561540), + SimpleParserValue::Character(pos, '/'), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -228,10 +238,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 92673), - SimpleParserValue::Character(pos, '%'), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 92673), + SimpleParserValue::Character(pos, '%'), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -250,10 +262,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 0x7FFFFFF0), - SimpleParserValue::Character(pos, '&'), - SimpleParserValue::Integer(pos, 0x2AAAAAAA), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 0x7FFFFFF0), + SimpleParserValue::Character(pos, '&'), + SimpleParserValue::Integer(pos, 0x2AAAAAAA), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -272,10 +286,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 5), - SimpleParserValue::Character(pos, '|'), - SimpleParserValue::Integer(pos, 3), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 5), + SimpleParserValue::Character(pos, '|'), + SimpleParserValue::Integer(pos, 3), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -294,11 +310,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 105), - SimpleParserValue::MultiCharacter( - pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::SHIFT_LEFT)), - SimpleParserValue::Integer(pos, 2), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 105), + SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::SHIFT_LEFT)), + SimpleParserValue::Integer(pos, 2), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -317,11 +334,13 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 42784), - SimpleParserValue::MultiCharacter( - pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::SHIFT_RIGHT)), - SimpleParserValue::Integer(pos, 5), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 42784), + SimpleParserValue::MultiCharacter(pos, + SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::SHIFT_RIGHT)), + SimpleParserValue::Integer(pos, 5), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -340,10 +359,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::Character(pos, '>'), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::Character(pos, '>'), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -362,11 +383,13 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::MultiCharacter( - pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::GREATER_EQUAL_THAN)), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::MultiCharacter( + pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::GREATER_EQUAL_THAN)), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -385,10 +408,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, '<'), - SimpleParserValue::Integer(pos, 421), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, '<'), + SimpleParserValue::Integer(pos, 421), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -407,11 +432,13 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 420), - SimpleParserValue::MultiCharacter( - pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::LESS_EQUAL_THAN)), - SimpleParserValue::Integer(pos, 421), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::MultiCharacter(pos, + SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::LESS_EQUAL_THAN)), + SimpleParserValue::Integer(pos, 421), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -430,11 +457,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens( - {SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::EQUALS)), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::EQUALS)), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -453,11 +481,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens( - {SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::NOT_EQUAL)), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::NOT_EQUAL)), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -476,11 +505,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens( - {SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::AND)), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::AND)), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -499,11 +529,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens( - {SimpleParserValue::Integer(pos, 0), - SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::OR)), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 0), + SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::OR)), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -522,14 +553,16 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 100), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 4), - SimpleParserValue::Character(pos, '*'), - SimpleParserValue::Integer(pos, 25), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 220), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 100), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 4), + SimpleParserValue::Character(pos, '*'), + SimpleParserValue::Integer(pos, 25), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 220), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -548,14 +581,16 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 40), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 2), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '*'), - SimpleParserValue::Integer(pos, 10), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 40), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 2), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '*'), + SimpleParserValue::Integer(pos, 10), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -574,12 +609,14 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 1), - SimpleParserValue::Character(pos, '?'), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ':'), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::Character(pos, '?'), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ':'), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -598,12 +635,14 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 0), - SimpleParserValue::Character(pos, '?'), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ':'), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 0), + SimpleParserValue::Character(pos, '?'), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ':'), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -622,16 +661,18 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 1), - SimpleParserValue::Character(pos, '?'), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ':'), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 1), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::Character(pos, '?'), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ':'), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -650,16 +691,18 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 0), - SimpleParserValue::Character(pos, '?'), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ':'), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 1), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 0), + SimpleParserValue::Character(pos, '?'), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ':'), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -678,16 +721,18 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, -1), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 2), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '?'), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ':'), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, -1), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 2), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '?'), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ':'), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -706,16 +751,18 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 1), - SimpleParserValue::Character(pos, '?'), - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 210), - SimpleParserValue::Character(pos, '*'), - SimpleParserValue::Integer(pos, 2), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, ':'), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::Character(pos, '?'), + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 210), + SimpleParserValue::Character(pos, '*'), + SimpleParserValue::Integer(pos, 2), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, ':'), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -734,16 +781,18 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 0), - SimpleParserValue::Character(pos, '?'), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ':'), - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 1336), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 1), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 0), + SimpleParserValue::Character(pos, '?'), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ':'), + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 1336), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); diff --git a/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceActionTests.cpp b/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceActionTests.cpp index e78a1dc0f..2c89f3a0d 100644 --- a/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceActionTests.cpp +++ b/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceActionTests.cpp @@ -125,14 +125,16 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); auto result = helper.PerformTest(); @@ -147,15 +149,17 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Identifier(pos, new std::string("arg_t")), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Identifier(pos, new std::string("arg_t")), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); auto result = helper.PerformTest(); @@ -171,17 +175,19 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Identifier(pos, new std::string("arg_t")), - CommandsParserValue::Character(pos, ','), - CommandsParserValue::Identifier(pos, new std::string("another_arg_t")), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Identifier(pos, new std::string("arg_t")), + CommandsParserValue::Character(pos, ','), + CommandsParserValue::Identifier(pos, new std::string("another_arg_t")), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); auto result = helper.PerformTest(); @@ -198,19 +204,21 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Identifier(pos, new std::string("arg_t")), - CommandsParserValue::Character(pos, ','), - CommandsParserValue::Identifier(pos, new std::string("another_arg_t")), - CommandsParserValue::Character(pos, ','), - CommandsParserValue::Identifier(pos, new std::string("yeet_t")), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Identifier(pos, new std::string("arg_t")), + CommandsParserValue::Character(pos, ','), + CommandsParserValue::Identifier(pos, new std::string("another_arg_t")), + CommandsParserValue::Character(pos, ','), + CommandsParserValue::Identifier(pos, new std::string("yeet_t")), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); auto result = helper.PerformTest(); @@ -228,14 +236,16 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("unknown_struct_t")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("unknown_struct_t")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException); REQUIRE(helper.m_test_struct->m_post_load_action == nullptr); @@ -245,19 +255,21 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Identifier(pos, new std::string("arg_t")), - CommandsParserValue::Character(pos, ','), - CommandsParserValue::Identifier(pos, new std::string("another_arg_t")), - CommandsParserValue::Character(pos, ','), - CommandsParserValue::Identifier(pos, new std::string("unknown_type_t")), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Identifier(pos, new std::string("arg_t")), + CommandsParserValue::Character(pos, ','), + CommandsParserValue::Identifier(pos, new std::string("another_arg_t")), + CommandsParserValue::Character(pos, ','), + CommandsParserValue::Identifier(pos, new std::string("unknown_type_t")), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException); REQUIRE(helper.m_test_struct->m_post_load_action == nullptr); @@ -267,13 +279,15 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException); REQUIRE(helper.m_test_struct->m_post_load_action == nullptr); @@ -283,13 +297,15 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); helper.m_state->SetInUse(helper.m_test_struct); auto result = helper.PerformTest(); @@ -305,17 +321,19 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("container_struct_t")), - CommandsParserValue::Character(pos, ':'), - CommandsParserValue::Character(pos, ':'), - CommandsParserValue::Identifier(pos, new std::string("m_child")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("container_struct_t")), + CommandsParserValue::Character(pos, ':'), + CommandsParserValue::Character(pos, ':'), + CommandsParserValue::Identifier(pos, new std::string("m_child")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); auto result = helper.PerformTest(); @@ -330,14 +348,16 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("m_child")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("m_child")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); helper.m_state->SetInUse(helper.m_test_struct2); auto result = helper.PerformTest(); @@ -353,17 +373,19 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("container_struct_t")), - CommandsParserValue::Character(pos, ':'), - CommandsParserValue::Character(pos, ':'), - CommandsParserValue::Identifier(pos, new std::string("m_child")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("container_struct_t")), + CommandsParserValue::Character(pos, ':'), + CommandsParserValue::Character(pos, ':'), + CommandsParserValue::Identifier(pos, new std::string("m_child")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); helper.m_state->SetInUse(helper.m_arg_struct2); auto result = helper.PerformTest(); @@ -379,17 +401,19 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), - CommandsParserValue::Character(pos, ':'), - CommandsParserValue::Character(pos, ':'), - CommandsParserValue::Identifier(pos, new std::string("m_test")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), + CommandsParserValue::Character(pos, ':'), + CommandsParserValue::Character(pos, ':'), + CommandsParserValue::Identifier(pos, new std::string("m_test")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException); REQUIRE(helper.m_test_struct->m_post_load_action == nullptr); diff --git a/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceArchitectureTests.cpp b/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceArchitectureTests.cpp index 01d5cfe91..9a4692395 100644 --- a/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceArchitectureTests.cpp +++ b/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceArchitectureTests.cpp @@ -41,10 +41,12 @@ namespace test::parsing::commands::sequence::sequence_architecture { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("architecture")), - CommandsParserValue::Identifier(pos, new std::string("x86")), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("architecture")), + CommandsParserValue::Identifier(pos, new std::string("x86")), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); auto result = helper.PerformTest(); @@ -57,10 +59,12 @@ namespace test::parsing::commands::sequence::sequence_architecture { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("architecture")), - CommandsParserValue::Identifier(pos, new std::string("x86")), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("architecture")), + CommandsParserValue::Identifier(pos, new std::string("x86")), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); auto result = helper.PerformTest(); @@ -73,10 +77,12 @@ namespace test::parsing::commands::sequence::sequence_architecture { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("architecture")), - CommandsParserValue::Identifier(pos, new std::string("x1337")), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("architecture")), + CommandsParserValue::Identifier(pos, new std::string("x1337")), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException); REQUIRE(helper.m_repository->GetArchitecture() == Architecture::UNKNOWN); diff --git a/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceGameTests.cpp b/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceGameTests.cpp index d6d64ddba..1a800565d 100644 --- a/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceGameTests.cpp +++ b/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceGameTests.cpp @@ -41,10 +41,12 @@ namespace test::parsing::commands::sequence::sequence_game { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("game")), - CommandsParserValue::Identifier(pos, new std::string("very_cool_game")), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("game")), + CommandsParserValue::Identifier(pos, new std::string("very_cool_game")), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); auto result = helper.PerformTest(); diff --git a/test/ZoneCodeGeneratorLibTests/Parsing/Header/Sequence/SequenceNamespaceTests.cpp b/test/ZoneCodeGeneratorLibTests/Parsing/Header/Sequence/SequenceNamespaceTests.cpp index 7137da5f8..27599a372 100644 --- a/test/ZoneCodeGeneratorLibTests/Parsing/Header/Sequence/SequenceNamespaceTests.cpp +++ b/test/ZoneCodeGeneratorLibTests/Parsing/Header/Sequence/SequenceNamespaceTests.cpp @@ -10,11 +10,13 @@ namespace test::parsing::header::sequence::sequence_namespace TEST_CASE("SequenceNamespace: Ensure can parse simple namespace directive", "[parsing][parsingstream]") { const TokenPos pos; - const auto lexer = - std::make_unique<MockLexer<HeaderParserValue>>(MockLexer<HeaderParserValue>({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("test_namespace")), - HeaderParserValue::Character(pos, '{')}, - HeaderParserValue::EndOfFile(pos))); + const auto lexer = std::make_unique<MockLexer<HeaderParserValue>>(MockLexer<HeaderParserValue>( + { + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("test_namespace")), + HeaderParserValue::Character(pos, '{'), + }, + HeaderParserValue::EndOfFile(pos))); const auto packValueSupplier = std::make_unique<MockPackValueSupplier>(); const auto sequence = std::make_unique<SequenceNamespace>(); diff --git a/test/ZoneCodeGeneratorLibTests/Parsing/Matcher/MatcherTests.cpp b/test/ZoneCodeGeneratorLibTests/Parsing/Matcher/MatcherTests.cpp index e4abf4ff4..912f2b407 100644 --- a/test/ZoneCodeGeneratorLibTests/Parsing/Matcher/MatcherTests.cpp +++ b/test/ZoneCodeGeneratorLibTests/Parsing/Matcher/MatcherTests.cpp @@ -79,12 +79,18 @@ namespace test::parsing::matcher { MatchersTestsHelper test; const TokenPos pos; - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("test_namespace")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("test_namespace")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::NAMESPACE), create.Identifier(), create.Char('{')}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE), + create.Identifier(), + create.Char('{'), + }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 3); @@ -94,12 +100,18 @@ namespace test::parsing::matcher { MatchersTestsHelper test; const TokenPos pos; - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("test_namespace")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("test_namespace")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::NAMESPACE), create.Identifier(), create.Char('+')}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE), + create.Identifier(), + create.Char('+'), + }); REQUIRE(!test.PerformTest()); } @@ -109,12 +121,16 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; auto callbackCalled = false; - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("test_namespace")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("test_namespace")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::NAMESPACE)}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE), + }); test.MatchCallback( [&callbackCalled](sequence_result_t& result) { @@ -130,9 +146,14 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; auto callbackCalled = false; - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Invalid(pos), + }); const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::NAMESPACE)}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE), + }); test.MatchCallback( [&callbackCalled](sequence_result_t& result) { @@ -151,15 +172,19 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.Or({ - create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), - })}); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("test_namespace")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create.Or({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + }), + }); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("test_namespace")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) { @@ -169,10 +194,12 @@ namespace test::parsing::matcher REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 1); - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Identifier(pos, new std::string("test_struct")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Identifier(pos, new std::string("test_struct")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) { @@ -191,15 +218,19 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.Or({ - create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), - })}); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), - HeaderParserValue::Identifier(pos, new std::string("test_namespace")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create.Or({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + }), + }); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), + HeaderParserValue::Identifier(pos, new std::string("test_namespace")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) { @@ -217,14 +248,18 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers( - {create.Loop(create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE)), create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)}); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create.Loop(create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE)), + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + }); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) { @@ -246,10 +281,15 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers( - {create.Loop(create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE)), create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)}); + test.Matchers({ + create.Loop(create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE)), + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + }); - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Invalid(pos), + }); REQUIRE(!test.PerformTest()); } @@ -262,10 +302,15 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.OptionalLoop(create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE)), - create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)}); + test.Matchers({ + create.OptionalLoop(create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE)), + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + }); - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Invalid(pos), + }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 1); @@ -280,13 +325,17 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Optional(create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)), - create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM)}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Optional(create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)), + create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM), + }); - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), - HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), + HeaderParserValue::Invalid(pos), + }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 2); @@ -301,14 +350,18 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Optional(create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)), - create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM)}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Optional(create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)), + create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM), + }); - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), - HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), + HeaderParserValue::Invalid(pos), + }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 3); @@ -323,15 +376,19 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Optional(create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)), - create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM)}); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Optional(create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)), + create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM), + }); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), + HeaderParserValue::Invalid(pos), + }); REQUIRE(!test.PerformTest()); } @@ -346,19 +403,28 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers( - {create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Loop(create.Or({create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF)})), - create.Or({create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF), create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM)})}); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::TYPEDEF), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::TYPEDEF), - HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Loop(create.Or({ + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF), + })), + create.Or({ + create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF), + create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM), + }), + }); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::TYPEDEF), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::TYPEDEF), + HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) @@ -386,14 +452,23 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), create.Label(LABEL_TEST)}); - test.LabeledMatchers({create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)}, - LABEL_TEST); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Label(LABEL_TEST), + }); + test.LabeledMatchers( + { + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + }, + LABEL_TEST); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) @@ -417,14 +492,24 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), create.Label(LABEL_TEST)}); - test.LabeledMatchers({create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), create.Optional(create.Label(LABEL_TEST))}, LABEL_TEST); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Label(LABEL_TEST), + }); + test.LabeledMatchers( + { + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + create.Optional(create.Label(LABEL_TEST)), + }, + LABEL_TEST); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) @@ -448,13 +533,18 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers( - {create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), create.Identifier().Capture(CAPTURE_NAMESPACE_NAME), create.Char('{')}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Identifier().Capture(CAPTURE_NAMESPACE_NAME), + create.Char('{'), + }); - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("hello_world")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("hello_world")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) @@ -487,20 +577,26 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.Or({create.And({ - create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Identifier().Capture(CAPTURE_NAMESPACE_NAME), - }), - create.And({ - create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), - create.Identifier().Capture(CAPTURE_STRUCT_NAME), - })}), - create.Char('{')}); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("hello_world")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create.Or({ + create.And({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Identifier().Capture(CAPTURE_NAMESPACE_NAME), + }), + create.And({ + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + create.Identifier().Capture(CAPTURE_STRUCT_NAME), + }), + }), + create.Char('{'), + }); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("hello_world")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) { @@ -520,10 +616,12 @@ namespace test::parsing::matcher REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 3); - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Identifier(pos, new std::string("bye_struct")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Identifier(pos, new std::string("bye_struct")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) { @@ -553,16 +651,20 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Loop(create.Identifier().Capture(CAPTURE_NAMESPACE_NAME)), - create.Char('{')}); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("hello_world")), - HeaderParserValue::Identifier(pos, new std::string("hello_universe")), - HeaderParserValue::Identifier(pos, new std::string("hello_everyone")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Loop(create.Identifier().Capture(CAPTURE_NAMESPACE_NAME)), + create.Char('{'), + }); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("hello_world")), + HeaderParserValue::Identifier(pos, new std::string("hello_universe")), + HeaderParserValue::Identifier(pos, new std::string("hello_everyone")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) @@ -607,13 +709,23 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers( - {create.And({create.Type(HeaderParserValueType::NAMESPACE), create.Identifier()}).Tag(TAG_AND_GROUP).Capture(CAPTURE_AND_GROUP), create.Char('{')}); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("hello_world")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create + .And({ + create.Type(HeaderParserValueType::NAMESPACE), + create.Identifier(), + }) + .Tag(TAG_AND_GROUP) + .Capture(CAPTURE_AND_GROUP), + create.Char('{'), + }); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("hello_world")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) @@ -647,16 +759,25 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers( - {create.Loop(create.And({create.Type(HeaderParserValueType::NAMESPACE), create.Identifier()})).Tag(TAG_LOOP_GROUP).Capture(CAPTURE_LOOP_GROUP), - create.Char('{')}); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("hello_world")), - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("hello_universe")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create + .Loop(create.And({ + create.Type(HeaderParserValueType::NAMESPACE), + create.Identifier(), + })) + .Tag(TAG_LOOP_GROUP) + .Capture(CAPTURE_LOOP_GROUP), + create.Char('{'), + }); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("hello_world")), + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("hello_universe")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) @@ -700,28 +821,45 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::STRUCT), create.Label(LABEL_TYPENAME).Capture(CAPTURE_TYPENAME), create.Char('{')}); - test.LabeledMatchers({create.And({create.Identifier(), create.OptionalLoop(create.And({create.Char(':'), create.Char(':'), create.Identifier()}))}) - .Transform( - [](HeaderMatcherFactory::token_list_t& values) - { - std::ostringstream str; - str << values[0].get().IdentifierValue(); - - for (auto i = 3u; i < values.size(); i += 3) - str << "::" << values[i].get().IdentifierValue(); - - return HeaderParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); - })}, - LABEL_TYPENAME); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Identifier(pos, new std::string("hello")), - HeaderParserValue::Character(pos, ':'), - HeaderParserValue::Character(pos, ':'), - HeaderParserValue::Identifier(pos, new std::string("world")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create.Type(HeaderParserValueType::STRUCT), + create.Label(LABEL_TYPENAME).Capture(CAPTURE_TYPENAME), + create.Char('{'), + }); + test.LabeledMatchers( + { + create + .And({ + create.Identifier(), + create.OptionalLoop(create.And({ + create.Char(':'), + create.Char(':'), + create.Identifier(), + })), + }) + .Transform( + [](HeaderMatcherFactory::token_list_t& values) + { + std::ostringstream str; + str << values[0].get().IdentifierValue(); + + for (auto i = 3u; i < values.size(); i += 3) + str << "::" << values[i].get().IdentifierValue(); + + return HeaderParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); + }), + }, + LABEL_TYPENAME); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Identifier(pos, new std::string("hello")), + HeaderParserValue::Character(pos, ':'), + HeaderParserValue::Character(pos, ':'), + HeaderParserValue::Identifier(pos, new std::string("world")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) @@ -752,30 +890,45 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::STRUCT), create.Label(LABEL_TYPENAME).Capture(CAPTURE_TYPENAME), create.Char('{')}); - test.LabeledMatchers({create - .And({create.Identifier().Capture(CAPTURE_FIRST_TYPENAME_IDENTIFIER), - create.OptionalLoop(create.And({create.Char(':'), create.Char(':'), create.Identifier()}))}) - .Transform( - [](HeaderMatcherFactory::token_list_t& values) - { - std::ostringstream str; - str << values[0].get().IdentifierValue(); - - for (auto i = 3u; i < values.size(); i += 3) - str << "::" << values[i].get().IdentifierValue(); - - return HeaderParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); - })}, - LABEL_TYPENAME); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Identifier(pos, new std::string("hello")), - HeaderParserValue::Character(pos, ':'), - HeaderParserValue::Character(pos, ':'), - HeaderParserValue::Identifier(pos, new std::string("world")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create.Type(HeaderParserValueType::STRUCT), + create.Label(LABEL_TYPENAME).Capture(CAPTURE_TYPENAME), + create.Char('{'), + }); + test.LabeledMatchers( + { + create + .And({ + create.Identifier().Capture(CAPTURE_FIRST_TYPENAME_IDENTIFIER), + create.OptionalLoop(create.And({ + create.Char(':'), + create.Char(':'), + create.Identifier(), + })), + }) + .Transform( + [](HeaderMatcherFactory::token_list_t& values) + { + std::ostringstream str; + str << values[0].get().IdentifierValue(); + + for (auto i = 3u; i < values.size(); i += 3) + str << "::" << values[i].get().IdentifierValue(); + + return HeaderParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); + }), + }, + LABEL_TYPENAME); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Identifier(pos, new std::string("hello")), + HeaderParserValue::Character(pos, ':'), + HeaderParserValue::Character(pos, ':'), + HeaderParserValue::Identifier(pos, new std::string("world")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) @@ -812,22 +965,26 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::STRUCT), - create.Identifier() - .Capture(CAPTURE_NAME) - .Transform( - [](HeaderMatcherFactory::token_list_t& tokens) - { - auto str = tokens[0].get().IdentifierValue(); - std::transform(str.begin(), str.end(), str.begin(), toupper); - return HeaderParserValue::Identifier(tokens[0].get().GetPos(), new std::string(std::move(str))); - }), - create.Char('{')}); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Identifier(pos, new std::string("hello_world")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create.Type(HeaderParserValueType::STRUCT), + create.Identifier() + .Capture(CAPTURE_NAME) + .Transform( + [](HeaderMatcherFactory::token_list_t& tokens) + { + auto str = tokens[0].get().IdentifierValue(); + std::transform(str.begin(), str.end(), str.begin(), toupper); + return HeaderParserValue::Identifier(tokens[0].get().GetPos(), new std::string(std::move(str))); + }), + create.Char('{'), + }); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Identifier(pos, new std::string("hello_world")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) @@ -852,12 +1009,18 @@ namespace test::parsing::matcher { MatchersTestsHelper test; const TokenPos pos; - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("test_namespace")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("test_namespace")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::NAMESPACE), create.Identifier(), create.Char('{').NoConsume()}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE), + create.Identifier(), + create.Char('{').NoConsume(), + }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 2); @@ -869,12 +1032,17 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("test_namespace")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("test_namespace")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::NAMESPACE), create.Identifier().NoConsume().Capture(CAPTURE_NAME)}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE), + create.Identifier().NoConsume().Capture(CAPTURE_NAME), + }); test.MatchCallback( [](sequence_result_t& result) {