diff options
author | Svxy <aidan61605@gmail.com> | 2023-05-31 23:31:32 +0200 |
---|---|---|
committer | Svxy <aidan61605@gmail.com> | 2023-05-31 23:31:32 +0200 |
commit | eb4b3404aa00220d659e532151dab13d642c17a3 (patch) | |
tree | 7e1107c4995489a26c4007e41b53ea8d00ab2134 /tools/SectorTable | |
download | The-Simpsons-Hit-and-Run-TSH&R-PC.tar The-Simpsons-Hit-and-Run-TSH&R-PC.tar.gz The-Simpsons-Hit-and-Run-TSH&R-PC.tar.bz2 The-Simpsons-Hit-and-Run-TSH&R-PC.tar.lz The-Simpsons-Hit-and-Run-TSH&R-PC.tar.xz The-Simpsons-Hit-and-Run-TSH&R-PC.tar.zst The-Simpsons-Hit-and-Run-TSH&R-PC.zip |
Diffstat (limited to 'tools/SectorTable')
-rw-r--r-- | tools/SectorTable/Release/SectorTable.exe | bin | 0 -> 53248 bytes | |||
-rw-r--r-- | tools/SectorTable/SectorTable.cpp | 121 | ||||
-rw-r--r-- | tools/SectorTable/SectorTable.sln | 51 | ||||
-rw-r--r-- | tools/SectorTable/SectorTable.vcproj | 137 | ||||
-rw-r--r-- | tools/SectorTable/stdafx.cpp | 8 | ||||
-rw-r--r-- | tools/SectorTable/stdafx.h | 12 |
6 files changed, 329 insertions, 0 deletions
diff --git a/tools/SectorTable/Release/SectorTable.exe b/tools/SectorTable/Release/SectorTable.exe Binary files differnew file mode 100644 index 0000000..bedcb51 --- /dev/null +++ b/tools/SectorTable/Release/SectorTable.exe diff --git a/tools/SectorTable/SectorTable.cpp b/tools/SectorTable/SectorTable.cpp new file mode 100644 index 0000000..41cd895 --- /dev/null +++ b/tools/SectorTable/SectorTable.cpp @@ -0,0 +1,121 @@ +// SectorTable.cpp : Defines the entry point for the console application. +// + +#include "stdafx.h" +#include <tlentity.hpp> + +int _tmain(int argc, _TCHAR* argv[]) +{ + const int NameCount = 75; + char* sectorNames[ NameCount ] = { + "l1r1.p3d", "l1r2.p3d", "l1r3.p3d", "l1r4a.p3d", "l1r4b.p3d", "l1r6.p3d", "l1r7.p3d", + "l1z1.p3d", "l1z2.p3d", "l1z3.p3d", "l1z4.p3d", "l1z6.p3d", "l1z7.p3d", + "l2r1.p3d", "l2r2.p3d", "l2r3.p3d", "l2r4.p3d", + "l2z1.p3d", "l2z2.p3d", "l2z3.p3d", "l2z4.p3d", + "l3r1.p3d", "l3r2.p3d", "l3r3.p3d", "l3r4.p3d", "l3r5.p3d", + "l3z1.p3d", "l3z2.p3d", "l3z3.p3d", "l3z4.p3d", "l3z5.p3d", + "l4r1.p3d", "l4r2.p3d", "l4r3.p3d", "l4r4a.p3d", "l4r4b.p3d", "l4r6.p3d", "l4r7.p3d", + "l4z1.p3d", "l4z2.p3d", "l4z3.p3d", "l4z4.p3d", "l4z6.p3d", "l4z7.p3d", + "l5r1.p3d", "l5r2.p3d", "l5r3.p3d", "l5r4.p3d", + "l5z1.p3d", "l5z2.p3d", "l5z3.p3d", "l5z4.p3d", + "l6r1.p3d", "l6r2.p3d", "l6r3.p3d", "l6r4.p3d", "l6r5.p3d", + "l6z1.p3d", "l6z2.p3d", "l6z3.p3d", "l6z4.p3d", "l6z5.p3d", + "l7r1.p3d", "l7r2.p3d", "l7r3.p3d", "l7r4a.p3d", "l7r4b.p3d", "l7r6.p3d", "l7r7.p3d", + "l7z1.p3d", "l7z2.p3d", "l7z3.p3d", "l7z4.p3d", "l7z6.p3d", "l7z7.p3d" }; + + char* typeStr[ 4 ] = { "unsigned char", "unsigned short", "int", "TLUID" }; + TLUID sectorIDs[ NameCount ]; + for( int i = 0; i < NameCount; ++i ) + { + sectorIDs[ i ] = tlEntity::MakeUID( sectorNames[ i ] ); + } + + // Check for dups in the lower order bits. + bool noDups = true; + int type = 0; + int mask = 0xFF; + for( int i = 0; ( i < NameCount - 1 ) && ( noDups ); ++i ) + { + char first = (char)( sectorIDs[ i ] & mask ); + for( int j = i + 1; j < NameCount; ++j ) + { + char second = (char)( sectorIDs[ j ] & mask ); + if( first == second ) + { + noDups = false; + break; + } + } + } + if( !noDups ) + { + ++type; + noDups = true; + mask = 0xFFFF; + for( int i = 0; ( i < NameCount - 1 ) && ( noDups ); ++i ) + { + short first = (short)( sectorIDs[ i ] & mask ); + for( int j = i + 1; j < NameCount; ++j ) + { + short second = (short)( sectorIDs[ j ] & mask ); + if( first == second ) + { + noDups = false; + break; + } + } + } + } + if( !noDups ) + { + ++type; + noDups = true; + mask = 0xFFFFFFFF; + for( int i = 0; ( i < NameCount - 1 ) && ( noDups ); ++i ) + { + int first = (int)( sectorIDs[ i ] & mask ); + for( int j = i + 1; j < NameCount; ++j ) + { + int second = (int)( sectorIDs[ j ] & mask ); + if( first == second ) + { + noDups = false; + break; + } + } + } + } + if( !noDups ) + { + ++type; + } + + printf( "// Auto generated with SectorTable.\n" ); + printf( "struct SectorMap\n{\n %s Sector;\n char CurIndex;\n};\n\n", typeStr[ type ] ); + printf( "static const int NUM_SECTORS = %d;\n\n", NameCount ); + printf( "SectorMap sSectorMap[ NUM_SECTORS ] = {\n" ); + for( int i = 0; i < NameCount; ++i ) + { + TLUID id = tlEntity::MakeUID( sectorNames[ i ] ); + unsigned hi = (unsigned)( id >> 32 ); + unsigned lo = (unsigned)( id & 0xFFFFFFFF ); + printf( "{ 0x" ); + switch( type ) + { + case 0: + printf("%02X", lo & 0xFF ); + break; + case 1: + printf("%04X", lo & 0xFFFF ); + break; + case 2: + printf("%08X", lo ); + break; + default: + printf( "%08X%08X", hi, lo ); + break; + } + printf( ", 0 }%s //%s\n", i != NameCount -1 ? ", " : " };", sectorNames[ i ] ); + } + return 0; +}
\ No newline at end of file diff --git a/tools/SectorTable/SectorTable.sln b/tools/SectorTable/SectorTable.sln new file mode 100644 index 0000000..c40d4c8 --- /dev/null +++ b/tools/SectorTable/SectorTable.sln @@ -0,0 +1,51 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "toollib", "..\..\game\libs\pure3d\toollib\toollib.vcproj", "{A224C960-67EC-49C2-8171-9FA441C7634D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SectorTable", "SectorTable.vcproj", "{B316572B-39EC-4EB1-B40D-E62D1B033F52}" +EndProject +Global + GlobalSection(SourceCodeControl) = preSolution + SccNumberOfProjects = 1 + SccProjectUniqueName0 = ..\\..\\game\\libs\\pure3d\\toollib\\toollib.vcproj + SccProjectName0 = Perforce\u0020Project + SccLocalPath0 = ..\\..\\game\\libs\\pure3d\\toollib + SccProvider0 = MSSCCI:Perforce\u0020SCM + CanCheckoutShared = true + EndGlobalSection + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + ConfigName.2 = Tools Debug + ConfigName.3 = Tools Release + ConfigName.4 = Tune + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + {B316572B-39EC-4EB1-B40D-E62D1B033F52}.0 = {A224C960-67EC-49C2-8171-9FA441C7634D} + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {A224C960-67EC-49C2-8171-9FA441C7634D}.Debug.ActiveCfg = Debug|Win32 + {A224C960-67EC-49C2-8171-9FA441C7634D}.Debug.Build.0 = Debug|Win32 + {A224C960-67EC-49C2-8171-9FA441C7634D}.Release.ActiveCfg = Release|Win32 + {A224C960-67EC-49C2-8171-9FA441C7634D}.Release.Build.0 = Release|Win32 + {A224C960-67EC-49C2-8171-9FA441C7634D}.Tools Debug.ActiveCfg = Tools Debug|Win32 + {A224C960-67EC-49C2-8171-9FA441C7634D}.Tools Debug.Build.0 = Tools Debug|Win32 + {A224C960-67EC-49C2-8171-9FA441C7634D}.Tools Release.ActiveCfg = Tools Release|Win32 + {A224C960-67EC-49C2-8171-9FA441C7634D}.Tools Release.Build.0 = Tools Release|Win32 + {A224C960-67EC-49C2-8171-9FA441C7634D}.Tune.ActiveCfg = Tools Release|Win32 + {A224C960-67EC-49C2-8171-9FA441C7634D}.Tune.Build.0 = Tools Release|Win32 + {B316572B-39EC-4EB1-B40D-E62D1B033F52}.Debug.ActiveCfg = Debug|Win32 + {B316572B-39EC-4EB1-B40D-E62D1B033F52}.Debug.Build.0 = Debug|Win32 + {B316572B-39EC-4EB1-B40D-E62D1B033F52}.Release.ActiveCfg = Release|Win32 + {B316572B-39EC-4EB1-B40D-E62D1B033F52}.Release.Build.0 = Release|Win32 + {B316572B-39EC-4EB1-B40D-E62D1B033F52}.Tools Debug.ActiveCfg = Debug|Win32 + {B316572B-39EC-4EB1-B40D-E62D1B033F52}.Tools Debug.Build.0 = Debug|Win32 + {B316572B-39EC-4EB1-B40D-E62D1B033F52}.Tools Release.ActiveCfg = Release|Win32 + {B316572B-39EC-4EB1-B40D-E62D1B033F52}.Tools Release.Build.0 = Release|Win32 + {B316572B-39EC-4EB1-B40D-E62D1B033F52}.Tune.ActiveCfg = Release|Win32 + {B316572B-39EC-4EB1-B40D-E62D1B033F52}.Tune.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/tools/SectorTable/SectorTable.vcproj b/tools/SectorTable/SectorTable.vcproj new file mode 100644 index 0000000..be79730 --- /dev/null +++ b/tools/SectorTable/SectorTable.vcproj @@ -0,0 +1,137 @@ +<?xml version="1.0" encoding = "Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="7.00" + Name="SectorTable" + ProjectGUID="{B316572B-39EC-4EB1-B40D-E62D1B033F52}" + Keyword="Win32Proj"> + <Platforms> + <Platform + Name="Win32"/> + </Platforms> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="Debug" + IntermediateDirectory="Debug" + ConfigurationType="1" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="..\..\game\libs\pure3d\toollib\inc" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;RAD_PC;RAD_DEBUG;RAD_WIN32" + MinimalRebuild="TRUE" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="TRUE" + DebugInformationFormat="4"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)/SectorTable.exe" + LinkIncremental="2" + IgnoreDefaultLibraryNames="" + GenerateDebugInformation="TRUE" + ProgramDatabaseFile="$(OutDir)/SectorTable.pdb" + SubSystem="1" + TargetMachine="1"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="Release" + IntermediateDirectory="Release" + ConfigurationType="1" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + OmitFramePointers="TRUE" + AdditionalIncludeDirectories="..\..\game\libs\pure3d\toollib\inc" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + StringPooling="TRUE" + RuntimeLibrary="0" + EnableFunctionLevelLinking="TRUE" + UsePrecompiledHeader="3" + WarningLevel="3" + Detect64BitPortabilityProblems="TRUE" + DebugInformationFormat="3"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)/SectorTable.exe" + LinkIncremental="1" + GenerateDebugInformation="TRUE" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + </Configuration> + </Configurations> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"> + <File + RelativePath="SectorTable.cpp"> + </File> + <File + RelativePath="stdafx.cpp"> + <FileConfiguration + Name="Debug|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="1"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="1"/> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc"> + <File + RelativePath="stdafx.h"> + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/tools/SectorTable/stdafx.cpp b/tools/SectorTable/stdafx.cpp new file mode 100644 index 0000000..0366889 --- /dev/null +++ b/tools/SectorTable/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// SectorTable.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/tools/SectorTable/stdafx.h b/tools/SectorTable/stdafx.h new file mode 100644 index 0000000..ea18047 --- /dev/null +++ b/tools/SectorTable/stdafx.h @@ -0,0 +1,12 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#include <stdio.h> +#include <tchar.h> + +// TODO: reference additional headers your program requires here |