- added RedNukem project.
|
@ -27,6 +27,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libxmp-lite", "libxmp-lite.
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glad", "glad.vcxproj", "{6AC1D997-8DAE-4343-8DD8-DA2A1CA63212}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rednukem", "rednukem.vcxproj", "{44C4B4F0-B489-4612-B9C7-A38503B7FB67}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
|
@ -91,6 +93,14 @@ Global
|
|||
{6AC1D997-8DAE-4343-8DD8-DA2A1CA63212}.Release|Win32.Build.0 = Release|Win32
|
||||
{6AC1D997-8DAE-4343-8DD8-DA2A1CA63212}.Release|x64.ActiveCfg = Release|x64
|
||||
{6AC1D997-8DAE-4343-8DD8-DA2A1CA63212}.Release|x64.Build.0 = Release|x64
|
||||
{44C4B4F0-B489-4612-B9C7-A38503B7FB67}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{44C4B4F0-B489-4612-B9C7-A38503B7FB67}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{44C4B4F0-B489-4612-B9C7-A38503B7FB67}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{44C4B4F0-B489-4612-B9C7-A38503B7FB67}.Debug|x64.Build.0 = Debug|x64
|
||||
{44C4B4F0-B489-4612-B9C7-A38503B7FB67}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{44C4B4F0-B489-4612-B9C7-A38503B7FB67}.Release|Win32.Build.0 = Release|Win32
|
||||
{44C4B4F0-B489-4612-B9C7-A38503B7FB67}.Release|x64.ActiveCfg = Release|x64
|
||||
{44C4B4F0-B489-4612-B9C7-A38503B7FB67}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -103,6 +113,7 @@ Global
|
|||
{BCDE1852-E2C6-4ABB-84FB-5CD431764A9A} = {8BD117A0-7FA2-44B0-88A5-29D6C220601E}
|
||||
{32D4CF70-A3D6-4CEA-81D7-64C743980276} = {8BD117A0-7FA2-44B0-88A5-29D6C220601E}
|
||||
{6AC1D997-8DAE-4343-8DD8-DA2A1CA63212} = {8BD117A0-7FA2-44B0-88A5-29D6C220601E}
|
||||
{44C4B4F0-B489-4612-B9C7-A38503B7FB67} = {18C3CB5F-1DE6-4CFE-B7F7-ABE824222E1C}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {0346D2C0-3EB9-4AFB-973F-2904758D6C02}
|
||||
|
|
309
platform/Windows/rednukem.vcxproj
Normal file
|
@ -0,0 +1,309 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{44C4B4F0-B489-4612-B9C7-A38503B7FB67}</ProjectGuid>
|
||||
<RootNamespace>rednukem</RootNamespace>
|
||||
<Keyword>MakeFileProj</Keyword>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="props\build_x64.props" />
|
||||
<Import Project="props\build_common.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="props\build_x64.props" />
|
||||
<Import Project="props\build_common.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="props\build_x86.props" />
|
||||
<Import Project="props\build_common.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="props\build_x86.props" />
|
||||
<Import Project="props\build_common.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<OutDir>$(SolutionDir)..\..\</OutDir>
|
||||
<IntDir>$(Platform)\Build\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<NMakeIncludeSearchPath>$(NMakeIncludeSearchPath);..\..\source\build\include;..\..\source\mact\include;..\..\source\audiolib\include;..\..\source\enet\include;..\..\platform\windows\include</NMakeIncludeSearchPath>
|
||||
<NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">nmake /f msvc.mak DEBUG=1 WINBITS=32 RENDERTYPE=SDL</NMakeBuildCommandLine>
|
||||
<NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">nmake /f msvc.mak veryclean all DEBUG=1 WINBITS=32 RENDERTYPE=SDL</NMakeReBuildCommandLine>
|
||||
<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">nmake /f msvc.mak veryclean DEBUG=1 WINBITS=32 RENDERTYPE=SDL</NMakeCleanCommandLine>
|
||||
<NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">USE_OPENGL;POLYMER;SDL_USEFOLDER;SDL_TARGET=2</NMakePreprocessorDefinitions>
|
||||
<NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">nmake /f msvc.mak WINBITS=32 RENDERTYPE=SDL</NMakeBuildCommandLine>
|
||||
<NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">nmake /f msvc.mak veryclean all WINBITS=32 RENDERTYPE=SDL</NMakeReBuildCommandLine>
|
||||
<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">nmake /f msvc.mak veryclean WINBITS=32 RENDERTYPE=SDL</NMakeCleanCommandLine>
|
||||
<NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">USE_OPENGL;POLYMER;SDL_USEFOLDER;SDL_TARGET=2</NMakePreprocessorDefinitions>
|
||||
<NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">nmake /f msvc.mak DEBUG=1 WINBITS=64 RENDERTYPE=SDL</NMakeBuildCommandLine>
|
||||
<NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">nmake /f msvc.mak veryclean all DEBUG=1 WINBITS=64 RENDERTYPE=SDL</NMakeReBuildCommandLine>
|
||||
<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">nmake /f msvc.mak veryclean DEBUG=1 WINBITS=64 RENDERTYPE=SDL</NMakeCleanCommandLine>
|
||||
<NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">USE_OPENGL;POLYMER;NOASM;SDL_USEFOLDER;SDL_TARGET=2</NMakePreprocessorDefinitions>
|
||||
<NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|x64'">nmake /f msvc.mak WINBITS=64 RENDERTYPE=SDL</NMakeBuildCommandLine>
|
||||
<NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|x64'">nmake /f msvc.mak veryclean all WINBITS=64 RENDERTYPE=SDL</NMakeReBuildCommandLine>
|
||||
<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|x64'">nmake /f msvc.mak veryclean WINBITS=64 RENDERTYPE=SDL</NMakeCleanCommandLine>
|
||||
<NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">USE_OPENGL;POLYMER;NOASM;SDL_USEFOLDER;SDL_TARGET=2</NMakePreprocessorDefinitions>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<EmbedManifest>false</EmbedManifest>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<EmbedManifest>false</EmbedManifest>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<EmbedManifest>false</EmbedManifest>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<EmbedManifest>false</EmbedManifest>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Link>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<SupportJustMyCode>true</SupportJustMyCode>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp14</LanguageStandard>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<ExceptionHandling>SyncCThrow</ExceptionHandling>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Link>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp14</LanguageStandard>
|
||||
<ExceptionHandling>SyncCThrow</ExceptionHandling>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<OmitFramePointers>false</OmitFramePointers>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<SupportJustMyCode>true</SupportJustMyCode>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp14</LanguageStandard>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<ExceptionHandling>SyncCThrow</ExceptionHandling>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Link>
|
||||
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp14</LanguageStandard>
|
||||
<ExceptionHandling>SyncCThrow</ExceptionHandling>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\source\rr\src\actors.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\android.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\in_android.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\anim.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\cheats.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\cmdline.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\common_game.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\demo.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\events_defs.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\game.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\gameexec.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\gamevars.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\global.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\input.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\inv.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\menus.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\mpu401.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\net.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\player.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\premap.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\quotes.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\savegame.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\sbar.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\screens.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\screentext.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\sector.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\_functio.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\_midi.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\_rts.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\config.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\duke3d.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\function.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\gamedef.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\gamedefs.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\grpscan.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\keys.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\macros.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\mdump.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\names.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\namesdyn.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\osdcmds.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\osdfuncs.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\rts.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\soundefs.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\sounds.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\soundsdyn.h" />
|
||||
<ClInclude Include="..\..\source\rr\src\startwin.game.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\source\rr\rsrc\eduke32_icon.c" />
|
||||
<ClCompile Include="..\..\source\rr\src\actors.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\anim.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\cheats.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\cmdline.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\config.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\common.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\demo.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\file_lib.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\game.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\gamedef.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\gameexec.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\gamestructures.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\gamevars.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\global.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\grpscan.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\input.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\mdump.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\menus.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\midi.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\mpu401.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\music.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\namesdyn.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\net.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\osdcmds.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\osdfuncs.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\player.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\premap.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\rts.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\savegame.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\sbar.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\screens.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\screentext.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\sdlmusic.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\sector.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\sounds.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\soundsdyn.cpp" />
|
||||
<ClCompile Include="..\..\source\rr\src\startgtk.game.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\startwin.game.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="audiolib.vcxproj">
|
||||
<Project>{0029c61b-b63d-4e61-99f2-f4e49aabfc47}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="build.vcxproj">
|
||||
<Project>{dbecb851-5624-4fa8-9a9d-7169d0f12ff1}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="enet.vcxproj">
|
||||
<Project>{a68cc5e4-567a-44c8-94fe-c1de09aeeb40}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="glad.vcxproj">
|
||||
<Project>{6ac1d997-8dae-4343-8dd8-da2a1ca63212}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="libxmp-lite.vcxproj">
|
||||
<Project>{32d4cf70-a3d6-4cea-81d7-64c743980276}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="mact.vcxproj">
|
||||
<Project>{bcde1852-e2c6-4abb-84fb-5cd431764a9a}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\..\source\rr\rsrc\gameres.rc">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Manifest Include="rednukem.exe.manifest" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
289
platform/Windows/rednukem.vcxproj.filters
Normal file
|
@ -0,0 +1,289 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\android">
|
||||
<UniqueIdentifier>{c0296ff5-d859-419b-a732-9596d77717dc}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\source\rr\src\_functio.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\_rts.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\config.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\duke3d.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\function.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\gamedef.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\gamedefs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\grpscan.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\keys.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\macros.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\mdump.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\names.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\namesdyn.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\osdcmds.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\osdfuncs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\rts.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\soundefs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\sounds.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\soundsdyn.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\startwin.game.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\sector.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\gameexec.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\actors.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\player.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\gamevars.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\net.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\global.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\game.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\premap.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\menus.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\savegame.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\anim.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\demo.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\events_defs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\quotes.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\input.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\common_game.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\in_android.h">
|
||||
<Filter>Header Files\android</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\android.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\mpu401.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\_midi.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\cheats.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\sbar.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\screentext.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\screens.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\cmdline.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\source\rr\src\inv.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\source\rr\src\actors.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\anim.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\config.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\game.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\gamedef.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\gameexec.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\gamestructures.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\gamevars.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\global.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\grpscan.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\mdump.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\menus.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\midi.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\mpu401.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\music.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\namesdyn.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\osdcmds.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\osdfuncs.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\player.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\premap.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\rts.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\savegame.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\sdlmusic.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\sector.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\sounds.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\soundsdyn.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\startgtk.game.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\startwin.game.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\net.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\demo.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\input.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\common.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\cheats.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\sbar.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\screentext.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\screens.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\cmdline.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\rsrc\eduke32_icon.c">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\rr\src\file_lib.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\..\source\rr\rsrc\gameres.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Manifest Include="rednukem.exe.manifest">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Manifest>
|
||||
</ItemGroup>
|
||||
</Project>
|
94
source/rr/Dependencies.mak
Normal file
|
@ -0,0 +1,94 @@
|
|||
duke3d_h=\
|
||||
$(engine_inc)/compat.h \
|
||||
$(engine_inc)/pragmas.h \
|
||||
$(engine_inc)/build.h \
|
||||
$(engine_inc)/baselayer.h \
|
||||
$(engine_inc)/polymer.h \
|
||||
$(engine_inc)/polymost.h \
|
||||
$(engine_inc)/texcache.h \
|
||||
$(engine_inc)/cache1d.h \
|
||||
$(mact_inc)/file_lib.h \
|
||||
$(mact_inc)/keyboard.h \
|
||||
$(mact_inc)/mouse.h \
|
||||
$(mact_inc)/joystick.h \
|
||||
$(mact_inc)/control.h \
|
||||
$(rr_src)/macros.h \
|
||||
$(rr_src)/gamedefs.h \
|
||||
$(rr_src)/function.h \
|
||||
$(rr_src)/config.h \
|
||||
$(rr_src)/sounds.h \
|
||||
$(rr_src)/sounds_common.h \
|
||||
$(rr_src)/soundsdyn.h \
|
||||
$(rr_src)/rts.h \
|
||||
$(rr_src)/_rts.h \
|
||||
$(rr_src)/soundefs.h \
|
||||
$(audiolib_inc)/fx_man.h \
|
||||
$(audiolib_inc)/music.h \
|
||||
$(rr_src)/namesdyn.h \
|
||||
$(rr_src)/duke3d.h \
|
||||
$(rr_src)/player.h \
|
||||
$(rr_src)/sector.h \
|
||||
$(rr_src)/game.h \
|
||||
$(rr_src)/actors.h \
|
||||
$(rr_src)/menus.h
|
||||
|
||||
gamedef_h=$(rr_src)/gamedef.h $(rr_src)/gameexec.h $(rr_src)/gamevars.h
|
||||
|
||||
game_defs_dep=$(rr_src)/lunatic/_defs_game.lua
|
||||
|
||||
$(rr_obj)/game.$o: $(rr_src)/game.cpp $(game_defs_dep) $(mact_inc)/scriplib.h $(rr_h) $(rr_src)/input.h $(rr_src)/osdfuncs.h $(rr_src)/osdcmds.h $(rr_src)/grpscan.h $(rr_src)/demo.h $(engine_inc)/hightile.h
|
||||
$(rr_obj)/actors.$o: $(rr_src)/actors.cpp $(rr_h)
|
||||
$(rr_obj)/anim.$o: $(rr_src)/anim.cpp $(rr_h) $(rr_src)/input.h $(mact_inc)/animlib.h $(engine_inc)/animvpx.h
|
||||
$(rr_obj)/cheats.$o: $(rr_src)/cheats.cpp $(rr_src)/cheats.h
|
||||
$(rr_obj)/cmdline.$o: $(rr_src)/cmdline.cpp $(rr_src)/cmdline.h
|
||||
$(rr_obj)/demo.$o: $(rr_src)/demo.cpp $(rr_h) $(rr_src)/input.h
|
||||
$(rr_obj)/gamedef.$o: $(rr_src)/gamedef.cpp $(rr_h) $(gamedef_h) $(rr_src)/savegame.h
|
||||
$(rr_obj)/gameexec.$o: $(rr_src)/gameexec.cpp $(rr_src)/gamestructures.cpp $(rr_h) $(gamedef_h)
|
||||
$(rr_obj)/gamestructures.$o: $(rr_src)/gamestructures.cpp $(rr_h) $(gamedef_h)
|
||||
$(rr_obj)/gamevars.$o: $(rr_src)/gamevars.cpp $(rr_src)/gamestructures.cpp $(rr_h) $(gamedef_h) $(rr_src)/savegame.h
|
||||
$(rr_obj)/global.$o: $(rr_src)/global.cpp $(rr_h)
|
||||
$(rr_obj)/input.$o: $(rr_src)/input.cpp $(rr_h) $(rr_src)/input.h
|
||||
$(rr_obj)/mdump.$o: $(rr_src)/mdump.cpp $(rr_src)/mdump.h
|
||||
$(rr_obj)/menus.$o: $(rr_src)/menus.cpp $(rr_h) $(rr_src)/input.h $(mact_inc)/mouse.h $(rr_src)/menus.h
|
||||
$(rr_obj)/namesdyn.$o: $(rr_src)/namesdyn.cpp $(rr_h)
|
||||
$(rr_obj)/net.$o: $(rr_src)/net.cpp $(rr_h)
|
||||
$(rr_obj)/player.$o: $(rr_src)/player.cpp $(rr_h)
|
||||
$(rr_obj)/premap.$o: $(rr_src)/premap.cpp $(rr_h) $(engine_inc)/osd.h
|
||||
$(rr_obj)/savegame.$o: $(rr_src)/savegame.cpp $(rr_h) $(rr_src)/savegame.h
|
||||
$(rr_obj)/sbar.$o: $(rr_src)/sbar.cpp $(rr_src)/sbar.h
|
||||
$(rr_obj)/screens.$o: $(rr_src)/screens.cpp $(rr_src)/screens.h
|
||||
$(rr_obj)/screentext.$o: $(rr_src)/screentext.cpp $(rr_src)/screentext.h
|
||||
$(rr_obj)/sector.$o: $(rr_src)/sector.cpp $(rr_h) $(rr_src)/input.h
|
||||
$(rr_obj)/sounds.$o: $(rr_src)/sounds.cpp $(rr_h)
|
||||
$(rr_obj)/soundsdyn.$o: $(rr_src)/soundsdyn.cpp $(rr_h)
|
||||
$(rr_obj)/rts.$o: $(rr_src)/rts.cpp $(rr_h)
|
||||
$(rr_obj)/config.$o: $(rr_src)/config.cpp $(rr_h) $(mact_inc)/scriplib.h $(rr_src)/_functio.h
|
||||
$(rr_obj)/winbits.$o: $(rr_src)/winbits.cpp
|
||||
$(rr_obj)/osdfuncs.$o: $(rr_src)/names.h $(engine_inc)/build.h $(engine_inc)/osd.h
|
||||
$(rr_obj)/osdcmds.$o: $(rr_src)/osdcmds.cpp $(rr_src)/osdcmds.h $(engine_inc)/osd.h $(rr_h)
|
||||
|
||||
$(rr_obj)/lunatic_game.$o: $(engine_inc)/lunatic.h $(rr_src)/lunatic/lunatic_game.cpp $(rr_src)/lunatic/lunatic_game.h $(rr_src)/gamedef.h $(rr_src)/gameexec.h $(engine_inc)/cache1d.h $(engine_inc)/osd.h
|
||||
$(rr_obj)/lunatic_editor.$o: $(engine_inc)/lunatic.h $(rr_src)/lunatic/lunatic_editor.cpp $(rr_src)/lunatic/lunatic_editor.h $(engine_inc)/cache1d.h $(engine_inc)/osd.h
|
||||
|
||||
# misc objects
|
||||
$(rr_obj)/game_icon.$o: $(rr_rsrc)/game_icon.c $(rr_rsrc)/game_icon.ico
|
||||
$(rr_obj)/build_icon.$o: $(rr_rsrc)/build_icon.c $(rr_rsrc)/build_icon.ico
|
||||
|
||||
$(rr_obj)/grpscan.$o: $(rr_src)/grpscan.cpp $(engine_inc)/compat.h $(engine_inc)/baselayer.h $(engine_inc)/scriptfile.h $(engine_inc)/cache1d.h $(engine_inc)/crc32.h $(rr_src)/grpscan.h
|
||||
$(rr_obj)/gameres.$o: $(rr_rsrc)/gameres.rc $(rr_src)/startwin.game.h $(rr_rsrc)/game.bmp
|
||||
$(rr_obj)/buildres.$o: $(rr_rsrc)/buildres.rc $(engine_inc)/startwin.editor.h $(rr_rsrc)/build.bmp
|
||||
$(rr_obj)/startwin.game.$o: $(rr_src)/startwin.game.cpp $(rr_h) $(engine_inc)/build.h $(engine_inc)/winlayer.h $(engine_inc)/compat.h $(rr_src)/grpscan.h
|
||||
$(rr_obj)/startgtk.game.$o: $(rr_src)/startgtk.game.cpp $(rr_h) $(engine_inc)/dynamicgtk.h $(engine_inc)/build.h $(engine_inc)/baselayer.h $(engine_inc)/compat.h
|
||||
|
||||
|
||||
# mact objects
|
||||
$(mact_obj)/animlib.$o: $(mact_src)/animlib.cpp $(mact_inc)/animlib.h $(engine_inc)/compat.h
|
||||
$(mact_obj)/file_lib.$o: $(mact_src)/file_lib.cpp $(mact_inc)/file_lib.h
|
||||
$(mact_obj)/control.$o: $(mact_src)/control.cpp $(mact_inc)/control.h $(mact_inc)/keyboard.h $(mact_inc)/mouse.h $(mact_inc)/joystick.h $(engine_inc)/baselayer.h
|
||||
$(mact_obj)/keyboard.$o: $(mact_src)/keyboard.cpp $(mact_inc)/keyboard.h $(engine_inc)/compat.h $(engine_inc)/baselayer.h
|
||||
$(mact_obj)/joystick.$o: $(mact_src)/joystick.cpp $(mact_inc)/joystick.h $(engine_inc)/baselayer.h
|
||||
$(mact_obj)/scriplib.$o: $(mact_src)/scriplib.cpp $(mact_inc)/scriplib.h $(mact_src)/_scrplib.h $(engine_inc)/compat.h
|
||||
|
||||
$(rr_obj)/midi.$o: $(rr_src)/midi.cpp $(rr_src)/_midi.h $(rr_src)/midi.h $(audiolib_inc)/music.h
|
||||
$(rr_obj)/mpu401.$o: $(rr_src)/mpu401.cpp $(rr_src)/mpu401.h $(audiolib_inc)/music.h
|
||||
$(rr_obj)/music.$o: $(rr_src)/music.cpp $(rr_src)/midi.h $(rr_src)/mpu401.h $(audiolib_inc)/music.h
|
339
source/rr/gpl-2.0.txt
Normal file
|
@ -0,0 +1,339 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
BIN
source/rr/rsrc/build.bmp
Normal file
After Width: | Height: | Size: 328 KiB |
1
source/rr/rsrc/build_icon.c
Normal file
|
@ -0,0 +1 @@
|
|||
#include "eduke32_icon.c"
|
BIN
source/rr/rsrc/build_icon.ico
Normal file
After Width: | Height: | Size: 83 KiB |
72
source/rr/rsrc/buildres.rc
Normal file
|
@ -0,0 +1,72 @@
|
|||
#define NEED_COMMCTRL_H
|
||||
#include "../../build/include/windows_inc.h"
|
||||
#include "../../build/include/startwin.editor.h"
|
||||
|
||||
RSRC_ICON ICON "build_icon.ico"
|
||||
RSRC_BMP BITMAP "build.bmp"
|
||||
|
||||
WIN_STARTWIN DIALOGEX DISCARDABLE 20, 40, 260, 200
|
||||
STYLE DS_MODALFRAME | DS_CENTER | DS_SETFONT | DS_FIXEDSYS | WS_OVERLAPPED | WS_CAPTION | WS_VISIBLE | WS_SYSMENU
|
||||
CAPTION "Startup"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "", WIN_STARTWIN_BITMAP, "STATIC", SS_BITMAP | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE, 0, 0, 66, 172
|
||||
CONTROL "", WIN_STARTWIN_TABCTL, WC_TABCONTROL, WS_CLIPSIBLINGS | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 5, 250, 170
|
||||
CONTROL "&Start", WIN_STARTWIN_START, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 154, 180, 48, 14
|
||||
CONTROL "&Cancel", WIN_STARTWIN_CANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 207, 180, 48, 14
|
||||
|
||||
CONTROL "", WIN_STARTWIN_MESSAGES, "EDIT", ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VSCROLL, 0, 0, 32, 32
|
||||
END
|
||||
|
||||
WIN_STARTWINPAGE_CONFIG DIALOGEX DISCARDABLE 20, 40, 279, 168
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "&2D Video mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 8, 50, 8
|
||||
CONTROL "", IDC2DVMODE, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 6, 80, 56
|
||||
CONTROL "&Fullscreen", IDCFULLSCREEN, "BUTTON", BS_CHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 148, 8, 49, 10
|
||||
CONTROL "&3D Video mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 24, 50, 8
|
||||
CONTROL "", IDC3DVMODE, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 22, 80, 56
|
||||
CONTROL "&Always show this window at startup", IDCALWAYSSHOW, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 118, 116, 140, 8
|
||||
END
|
||||
|
||||
#define FILEVER 1,9,9,9
|
||||
#define PRODUCTVER 1,9,9,9
|
||||
#define STRFILEVER "2.0.0devel\0"
|
||||
#define STRPRODUCTVER "2.0.0devel\0"
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION FILEVER
|
||||
PRODUCTVERSION PRODUCTVER
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x3L
|
||||
#else
|
||||
FILEFLAGS 0x2L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "FileDescription", "Mapster32 for EDuke32"
|
||||
VALUE "FileVersion", STRFILEVER
|
||||
VALUE "InternalName", "Mapster32"
|
||||
VALUE "LegalCopyright", "Copyright © 2018 EDuke32 Developers, 1996, 2003 3D Realms Entertainment"
|
||||
VALUE "LegalTrademarks", "Duke Nukem® is a Registered Trademark of Gearbox Software, LLC."
|
||||
VALUE "OriginalFilename", "mapster32.exe"
|
||||
VALUE "ProductName", "Mapster32"
|
||||
VALUE "ProductVersion", STRPRODUCTVER
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
1 24 "manifest.build.xml"
|
20
source/rr/rsrc/eduke32_icon.c
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
#include "sdl_inc.h"
|
||||
#include "sdlappicon.h"
|
||||
|
||||
static Uint8 sdlappicon_pixels[] = {
|
||||
#if defined _WIN32 && SDL_MAJOR_VERSION==1
|
||||
# include "eduke32_icon_32px.c"
|
||||
#else
|
||||
# include "eduke32_icon_48px.c"
|
||||
#endif
|
||||
};
|
||||
|
||||
struct sdlappicon sdlappicon = {
|
||||
#if defined _WIN32 && SDL_MAJOR_VERSION==1
|
||||
32,32,
|
||||
#else
|
||||
48,48,
|
||||
#endif
|
||||
sdlappicon_pixels
|
||||
};
|
196
source/rr/rsrc/eduke32_icon_32px.c
Normal file
|
@ -0,0 +1,196 @@
|
|||
/* GIMP RGBA C-Source image dump (eduke32_icon_32px.c) */
|
||||
#if 0
|
||||
static const struct {
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
unsigned int bytes_per_pixel; /* 2:RGB16, 3:RGB, 4:RGBA */
|
||||
unsigned char pixel_data[32 * 32 * 4 + 1];
|
||||
} sdlappicon = {
|
||||
32, 32, 4,
|
||||
#endif
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\313\035\035\033\303\034\034]\311\034\034\225\340''\301\343<<\330\345JJ"
|
||||
"\346\345JJ\346\342\065\065\330\337\040\040\301\314\035\035\225\303\034\034]\275\032"
|
||||
"\032\033\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\302\033\033\062\320\035\035\240\345JJ\351\360\231\231\377\366\305\305\377"
|
||||
"\372\341\341\377\375\364\364\377\375\360\360\377\373\343\343\377\365\272"
|
||||
"\272\377\361\236\236\377\356\213\213\377\352mm\377\342\071\071\351\320\035\035"
|
||||
"\240\302\033\033\062\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\257\030\030\007\311"
|
||||
"\034\034\214\343AA\371\363\253\253\377\374\357\357\377\376\375\375\377\376"
|
||||
"\375\375\377\376\375\375\377\376\375\375\377\376\375\375\377\376\371\371"
|
||||
"\377\373\346\346\377\370\323\323\377\365\270\270\377\363\254\254\377\363"
|
||||
"\262\262\377\360\231\231\377\344EE\371\302\033\033\214\257\030\030\007\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\313\035\035\062\322\036\036\320\353rr\377\366\301\301\377\371\330\330"
|
||||
"\377\376\371\371\377\376\375\375\377\374\355\355\377\366\305\305\377\361"
|
||||
"\236\236\377\356\207\207\377\355\202\202\377\356\215\215\377\363\256\256"
|
||||
"\377\370\315\315\377\370\315\315\377\370\323\323\377\370\325\325\377\372"
|
||||
"\341\341\377\361\236\236\377\325\036\036\320\302\033\033\062\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\307\034\034/\331\037"
|
||||
"\037\350\353rr\377\360\235\235\377\363\262\262\377\374\353\353\377\367\307"
|
||||
"\307\377\354{{\377\345JJ\377\341\064\064\377\340++\377\332\037\037\377\314\035"
|
||||
"\035\377\303\034\034\377\313\035\035\377\340%%\377\351ff\377\366\277\277\377\374"
|
||||
"\357\357\377\374\351\351\377\376\375\375\377\366\277\277\377\340''\350\302"
|
||||
"\033\033/\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\314\035\035"
|
||||
",\327\036\036\360\351ll\377\354{{\377\365\272\272\377\370\317\317\377\347\\"
|
||||
"\\\377\314\035\035\377\322\036\036\377\340++\377\341\064\064\377\342\065\065\377"
|
||||
"\341\062\062\377\336\037\037\377\313\035\035\377\302\033\033\377\275\032\032\377\302"
|
||||
"\033\033\377\314\035\035\377\351jj\377\374\353\353\377\376\375\375\377\376\375"
|
||||
"\375\377\370\321\321\377\340%%\360\302\033\033,\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\237\026\026\005\320\035\035\322\351ff\377\353tt\377\363\253\253\377"
|
||||
"\366\277\277\377\342\065\065\377\322\036\036\377\303\034\034\377\332\037\037\377"
|
||||
"\342\065\065\377\343<<\377\343<<\377\342\065\065\377\337\040\040\377\320\035\035"
|
||||
"\377\305\034\034\377\302\033\033\377\313\035\035\377\302\033\033\377\311\034\034\377"
|
||||
"\346OO\377\371\334\334\377\375\366\366\377\371\330\330\377\361\236\236\377"
|
||||
"\325\036\036\322\237\026\026\005\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\303\034\034\213"
|
||||
"\350ee\377\360\225\225\377\365\270\270\377\365\272\272\377\307\034\034\377"
|
||||
"\303\034\034\377\307\034\034\377\347WW\377\347WW\377\337\040\040\377\342\065\065"
|
||||
"\377\342\067\067\377\340--\377\336\037\037\377\313\035\035\377\305\034\034\377\302"
|
||||
"\033\033\377\340--\377\347XX\377\337\040\040\377\322\036\036\377\340''\377\367"
|
||||
"\312\312\377\372\341\341\377\367\310\310\377\354yy\377\302\033\033\213\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\302\033\033+\342\065\065\372\363\256\256\377\363\253\253"
|
||||
"\377\370\321\321\377\331\037\037\377\276\033\033\377\271\032\032\377\350ee\377"
|
||||
"\374\357\357\377\367\307\307\377\320\035\035\377\262\031\031\377\242\027\027\377"
|
||||
"\223\025\025\377\217\024\024\377\235\026\026\377\251\030\030\377\302\033\033\377\360"
|
||||
"\225\225\377\376\373\373\377\355\204\204\377\320\035\035\377\275\032\032\377"
|
||||
"\341..\377\371\330\330\377\365\270\270\377\363\253\253\377\342\067\067\372"
|
||||
"\307\034\034+\000\000\000\000\000\000\000\000\314\035\035\242\357\224\224\377\367\307\307\377"
|
||||
"\372\341\341\377\347WW\377\322\036\036\377\303\034\034\377\350__\377\373\346"
|
||||
"\346\377\355\204\204\377\361\244\244\377\342\071\071\377z\021\021\377w\020\020"
|
||||
"\377w\020\020\377w\020\020\377z\021\021\377w\020\020\377\244\027\027\377\364\263\263"
|
||||
"\377\374\351\351\377\376\373\373\377\353tt\377\275\032\032\377\313\035\035\377"
|
||||
"\346SS\377\370\323\323\377\360\231\231\377\353xx\377\320\035\035\242\000\000\000"
|
||||
"\000\307\034\034\026\343<<\361\367\310\310\377\372\337\337\377\366\277\277\377"
|
||||
"\302\033\033\377\311\034\034\377\343@@\377\373\346\346\377\356\211\211\377\340"
|
||||
"--\377\366\277\277\377\370\323\323\377\223\025\025\377|\021\021\377|\021\021\377"
|
||||
"|\021\021\377w\020\020\377z\021\021\377\354}}\377\367\310\310\377\347WW\377\370"
|
||||
"\323\323\377\374\357\357\377\343@@\377\322\036\036\377\302\033\033\377\364\263"
|
||||
"\263\377\364\263\263\377\360\227\227\377\341\062\062\361\307\034\034\026\302\033"
|
||||
"\033\\\353xx\377\367\312\312\377\373\344\344\377\351ll\377\275\032\032\377\313"
|
||||
"\035\035\377\365\272\272\377\371\334\334\377\345HH\377\363\262\262\377\376"
|
||||
"\373\373\377\376\373\373\377\353rr\377z\021\021\377|\021\021\377|\021\021\377z"
|
||||
"\021\021\377\244\027\027\377\375\366\366\377\376\373\373\377\364\267\267\377"
|
||||
"\345JJ\377\370\325\325\377\363\260\260\377\302\033\033\377\322\036\036\377\350"
|
||||
"]]\377\370\315\315\377\361\236\236\377\351ff\377\303\034\034\\\313\035\035\227"
|
||||
"\357\220\220\377\367\310\310\377\370\323\323\377\340))\377\302\033\033\377"
|
||||
"\347WW\377\376\373\373\377\360\233\233\377\353vv\377\376\373\373\377\376"
|
||||
"\373\373\377\376\373\373\377\375\362\362\377\244\027\027\377\214\023\023\377"
|
||||
"\235\026\026\377\217\024\024\377\353rr\377\376\373\373\377\376\373\373\377\376"
|
||||
"\373\373\377\353tt\377\353vv\377\373\346\346\377\343AA\377\311\034\034\377"
|
||||
"\331\037\037\377\367\312\312\377\363\256\256\377\355\202\202\377\313\035\035"
|
||||
"\227\337\040\040\303\361\236\236\377\370\323\323\377\362\245\245\377\311\034"
|
||||
"\034\377\275\032\032\377\357\220\220\377\374\353\353\377\347ZZ\377\371\330\330"
|
||||
"\377\376\373\373\377\376\373\373\377\376\373\373\377\376\373\373\377\372"
|
||||
"\337\337\377\373\346\346\377\376\373\373\377\367\307\307\377\376\373\373"
|
||||
"\377\376\373\373\377\376\373\373\377\376\373\373\377\371\330\330\377\345"
|
||||
"HH\377\370\325\325\377\356\213\213\377\311\034\034\377\276\033\033\377\362\247"
|
||||
"\247\377\367\307\307\377\360\225\225\377\340%%\303\342\067\067\330\363\262"
|
||||
"\262\377\372\335\335\377\356\215\215\377\275\032\032\377\313\035\035\377\364"
|
||||
"\265\265\377\366\277\277\377\343AA\377\376\373\373\377\376\373\373\377\376"
|
||||
"\373\373\377\376\373\373\377\376\373\373\377\376\373\373\377\372\341\341"
|
||||
"\377\366\305\305\377\376\373\373\377\376\373\373\377\376\373\373\377\376"
|
||||
"\373\373\377\376\373\373\377\376\373\373\377\343AA\377\364\265\265\377\363"
|
||||
"\262\262\377\305\034\034\377\303\034\034\377\356\213\213\377\370\323\323\377"
|
||||
"\363\253\253\377\342\071\071\330\344GG\346\367\314\314\377\373\346\346\377"
|
||||
"\355\202\202\377\275\032\032\377\336\037\037\377\371\330\330\377\370\321\321"
|
||||
"\377\357\224\224\377\376\373\373\377\376\373\373\377\376\373\373\377\376"
|
||||
"\373\373\377\376\373\373\377\366\277\277\377\217\024\024\377z\021\021\377\337"
|
||||
"\"\"\377\375\366\366\377\376\373\373\377\376\373\373\377\376\373\373\377"
|
||||
"\376\373\373\377\357\220\220\377\367\310\310\377\370\325\325\377\325\036\036"
|
||||
"\377\303\034\034\377\354}}\377\372\335\335\377\364\267\267\377\343AA\346\345"
|
||||
"JJ\346\371\332\332\377\375\360\360\377\355\206\206\377\307\034\034\377\337"
|
||||
"\040\040\377\355\206\206\377\360\235\235\377\353vv\377\352qq\377\353rr\377"
|
||||
"\353rr\377\354}}\377\376\373\373\377\353vv\377w\020\020\377w\020\020\377\214"
|
||||
"\023\023\377\376\367\367\377\371\330\330\377\353rr\377\353rr\377\352qq\377"
|
||||
"\353vv\377\357\220\220\377\353vv\377\311\034\034\377\303\034\034\377\354}}\377"
|
||||
"\371\332\332\377\364\267\267\377\344EE\346\343AA\330\371\330\330\377\376"
|
||||
"\367\367\377\360\225\225\377\331\037\037\377\337\040\040\377\325\036\036\377\313"
|
||||
"\035\035\377\230\025\025\377w\020\020\377z\021\021\377p\020\020\377\217\024\024\377\373"
|
||||
"\350\350\377\375\362\362\377\235\026\026\377|\021\021\377\346UU\377\376\373\373"
|
||||
"\377\342\071\071\377z\021\021\377z\021\021\377w\020\020\377\217\024\024\377\302\033"
|
||||
"\033\377\275\032\032\377\302\033\033\377\275\032\032\377\356\213\213\377\370\325"
|
||||
"\325\377\363\254\254\377\342\071\071\330\340))\303\367\312\312\377\376\367"
|
||||
"\367\377\364\263\263\377\337$$\377\337\040\040\377\337\"\"\377\336\037\037\377"
|
||||
"\260\031\031\377w\020\020\377|\021\021\377z\021\021\377z\021\021\377\345JJ\377\376"
|
||||
"\373\373\377\375\366\366\377\374\351\351\377\376\373\373\377\371\332\332"
|
||||
"\377\235\026\026\377|\021\021\377|\021\021\377w\020\020\377\251\030\030\377\307\034"
|
||||
"\034\377\311\034\034\377\302\033\033\377\311\034\034\377\362\247\247\377\370\323"
|
||||
"\323\377\361\236\236\377\340%%\303\313\035\035\227\363\262\262\377\375\362"
|
||||
"\362\377\372\335\335\377\341\064\064\377\320\035\035\377\331\037\037\377\325\036"
|
||||
"\036\377\302\033\033\377~\021\021\377w\020\020\377|\021\021\377w\020\020\377\212\023"
|
||||
"\023\377\362\245\245\377\376\373\373\377\376\373\373\377\376\373\373\377\337"
|
||||
"\"\"\377z\021\021\377|\021\021\377w\020\020\377~\021\021\377\275\032\032\377\305\034"
|
||||
"\034\377\311\034\034\377\276\033\033\377\337$$\377\370\321\321\377\366\305\305"
|
||||
"\377\357\220\220\377\313\035\035\227\275\032\032\\\355\202\202\377\372\341\341"
|
||||
"\377\374\351\351\377\351jj\377\275\032\032\377\314\035\035\377\302\033\033\377"
|
||||
"\276\033\033\377\250\030\030\377w\020\020\377z\021\021\377z\021\021\377\244\027\027\377"
|
||||
"\375\362\362\377\376\373\373\377\376\373\373\377\376\373\373\377\362\245"
|
||||
"\245\377z\021\021\377w\020\020\377w\020\020\377\244\027\027\377\276\033\033\377\276"
|
||||
"\033\033\377\302\033\033\377\303\034\034\377\350__\377\371\330\330\377\365\270"
|
||||
"\270\377\353tt\377\302\033\033\\\307\034\034\026\343<<\361\366\305\305\377\371"
|
||||
"\332\332\377\365\272\272\377\275\032\032\377\302\033\033\377\275\032\032\377\276"
|
||||
"\033\033\377\276\033\033\377\237\026\026\377z\021\021\377\217\024\024\377\375\362\362"
|
||||
"\377\376\373\373\377\376\373\373\377\376\373\373\377\376\373\373\377\376"
|
||||
"\373\373\377\346OO\377z\021\021\377\237\026\026\377\276\033\033\377\275\032\032\377"
|
||||
"\275\032\032\377\302\033\033\377\303\034\034\377\365\270\270\377\366\305\305\377"
|
||||
"\363\253\253\377\342\067\067\361\307\034\034\026\000\000\000\000\313\035\035\242\355\206"
|
||||
"\206\377\363\262\262\377\371\326\326\377\346QQ\377\311\034\034\377\275\032\032"
|
||||
"\377\275\032\032\377\276\033\033\377\276\033\033\377\232\026\026\377\346OO\377\372"
|
||||
"\341\341\377\376\373\373\377\376\373\373\377\376\373\373\377\376\373\373"
|
||||
"\377\372\335\335\377\366\277\277\377\260\031\031\377\302\033\033\377\276\033\033"
|
||||
"\377\276\033\033\377\275\032\032\377\320\035\035\377\345NN\377\370\325\325\377"
|
||||
"\361\244\244\377\355\202\202\377\320\035\035\242\000\000\000\000\000\000\000\000\302\033\033"
|
||||
"+\340--\372\361\236\236\377\362\251\251\377\371\330\330\377\337\040\040\377"
|
||||
"\311\034\034\377\275\032\032\377\276\033\033\377\275\032\032\377\347ZZ\377\371\334"
|
||||
"\334\377\347\\\\\377\347WW\377\351ff\377\351ff\377\350__\377\343AA\377\365"
|
||||
"\272\272\377\370\315\315\377\307\034\034\377\275\032\032\377\275\032\032\377\313"
|
||||
"\035\035\377\337\040\040\377\370\323\323\377\360\235\235\377\360\235\235\377"
|
||||
"\342\067\067\372\307\034\034+\000\000\000\000\000\000\000\000\000\000\000\000\302\033\033\213\350aa\377"
|
||||
"\362\247\247\377\367\310\310\377\366\305\305\377\322\036\036\377\311\034\034"
|
||||
"\377\276\033\033\377\275\032\032\377\357\217\217\377\376\373\373\377\373\350"
|
||||
"\350\377\370\317\317\377\370\315\315\377\370\315\315\377\370\315\315\377"
|
||||
"\374\351\351\377\376\367\367\377\363\262\262\377\325\036\036\377\275\032\032"
|
||||
"\377\313\035\035\377\322\036\036\377\367\307\307\377\367\307\307\377\360\231"
|
||||
"\231\377\351jj\377\311\034\034\213\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\237\026\026"
|
||||
"\005\320\035\035\322\353xx\377\360\227\227\377\366\277\277\377\367\310\310\377"
|
||||
"\341\062\062\377\311\034\034\377\276\033\033\377\325\036\036\377\345JJ\377\357\217"
|
||||
"\217\377\364\265\265\377\370\315\315\377\370\315\315\377\364\265\265\377"
|
||||
"\357\217\217\377\345JJ\377\302\033\033\377\275\032\032\377\313\035\035\377\343"
|
||||
"<<\377\367\310\310\377\366\305\305\377\360\235\235\377\355\202\202\377\327"
|
||||
"\036\036\322\237\026\026\005\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\307\034\034"
|
||||
",\332\037\037\360\356\207\207\377\360\235\235\377\370\315\315\377\371\326\326"
|
||||
"\377\347\\\\\377\302\033\033\377\275\032\032\377\302\033\033\377\275\032\032\377"
|
||||
"\320\035\035\377\337\040\040\377\337\"\"\377\320\035\035\377\275\032\032\377\311"
|
||||
"\034\034\377\303\034\034\377\275\032\032\377\347\\\\\377\371\334\334\377\370\315"
|
||||
"\315\377\361\236\236\377\360\225\225\377\340%%\360\307\034\034,\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\307\034\034/\336\037\037\350\355"
|
||||
"\202\202\377\363\262\262\377\365\274\274\377\373\344\344\377\366\277\277"
|
||||
"\377\352oo\377\341\062\062\377\320\035\035\377\307\034\034\377\302\033\033\377\302"
|
||||
"\033\033\377\307\034\034\377\314\035\035\377\340--\377\351ll\377\364\267\267\377"
|
||||
"\371\334\334\377\365\270\270\377\364\267\267\377\356\215\215\377\337$$\350"
|
||||
"\307\034\034/\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\307\034\034\062\322\036\036\320\353tt\377\366\301\301\377\367\312\312"
|
||||
"\377\372\341\341\377\373\346\346\377\370\325\325\377\363\256\256\377\360"
|
||||
"\231\231\377\356\207\207\377\356\207\207\377\360\235\235\377\363\262\262"
|
||||
"\377\370\325\325\377\372\341\341\377\370\323\323\377\364\263\263\377\365"
|
||||
"\270\270\377\354}}\377\327\036\036\320\307\034\034\062\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\257\030\030"
|
||||
"\007\303\034\034\214\343<<\371\360\225\225\377\366\305\305\377\370\315\315\377"
|
||||
"\370\315\315\377\371\332\332\377\373\344\344\377\375\360\360\377\375\364"
|
||||
"\364\377\373\346\346\377\371\330\330\377\367\312\312\377\367\310\310\377"
|
||||
"\365\272\272\377\357\220\220\377\343<<\371\307\034\034\214\257\030\030\007\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\302\033\033\062\314\035\035\240\342\071\071"
|
||||
"\351\354yy\377\360\225\225\377\363\254\254\377\366\305\305\377\371\330\330"
|
||||
"\377\371\330\330\377\367\307\307\377\363\254\254\377\357\224\224\377\353"
|
||||
"xx\377\343<<\351\320\035\035\240\302\033\033\062\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\275\032\032\033\276\033\033]\311\034"
|
||||
"\034\225\337$$\301\343<<\330\344GG\346\344GG\346\343<<\330\340''\301\313\035"
|
||||
"\035\225\276\033\033]\275\032\032\033\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000",
|
||||
#if 0
|
||||
};
|
||||
#endif
|
423
source/rr/rsrc/eduke32_icon_48px.c
Normal file
|
@ -0,0 +1,423 @@
|
|||
/* GIMP RGBA C-Source image dump (test.c) */
|
||||
#if 0
|
||||
static const struct {
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
unsigned int bytes_per_pixel; /* 2:RGB16, 3:RGB, 4:RGBA */
|
||||
unsigned char pixel_data[48 * 48 * 4 + 1];
|
||||
} sdlappicon = {
|
||||
48, 48, 4,
|
||||
#endif
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\037\004\004\001\325\036"
|
||||
"\036(\325\036\036_\325\036\036\222\325\036\036\270\325\036\036\321\325\036\036\343\325"
|
||||
"\036\036\355\325\036\036\355\325\036\036\343\325\036\036\321\325\036\036\270\325\036"
|
||||
"\036\222\325\036\036_\325\036\036(\037\004\004\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\325\036\036"
|
||||
"\036\325\036\036s\325\036\036\304\325\036\036\365\343<<\377\350aa\377\355\202\202"
|
||||
"\377\361\242\242\377\366\277\277\377\366\301\301\377\366\277\277\377\362"
|
||||
"\251\251\377\355\202\202\377\350ee\377\345JJ\377\340--\377\325\036\036\365"
|
||||
"\325\036\036\304\325\036\036s\325\036\036\036\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\334\037\037&\325\036\036\222\325\036\036\354\343"
|
||||
"AA\377\360\227\227\377\371\334\334\377\375\364\364\377\376\371\371\377\376"
|
||||
"\371\371\377\375\366\366\377\374\353\353\377\372\341\341\377\371\330\330"
|
||||
"\377\370\315\315\377\365\274\274\377\364\267\267\377\364\267\267\377\363"
|
||||
"\253\253\377\360\235\235\377\352oo\377\341\062\062\377\325\036\036\354\325\036"
|
||||
"\036\222\334\037\037&\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\311\034\034\014\325\036\036"
|
||||
"|\325\036\036\354\345NN\377\365\270\270\377\373\350\350\377\375\362\362\377"
|
||||
"\375\362\362\377\375\366\366\377\375\360\360\377\375\362\362\377\375\362"
|
||||
"\362\377\373\350\350\377\371\334\334\377\371\326\326\377\367\312\312\377"
|
||||
"\365\270\270\377\363\262\262\377\363\254\254\377\361\244\244\377\361\242"
|
||||
"\242\377\362\247\247\377\363\262\262\377\361\236\236\377\344GG\377\325\036"
|
||||
"\036\354\325\036\036|\311\034\034\014\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\325\036\036\064\325\036\036\305\341\062"
|
||||
"\062\377\360\231\231\377\367\310\310\377\370\325\325\377\371\334\334\377\373"
|
||||
"\350\350\377\374\357\357\377\375\364\364\377\375\366\366\377\375\366\366"
|
||||
"\377\376\367\367\377\375\366\366\377\375\366\366\377\375\364\364\377\374"
|
||||
"\353\353\377\372\341\341\377\370\323\323\377\365\270\270\377\361\236\236"
|
||||
"\377\361\236\236\377\361\244\244\377\363\262\262\377\366\301\301\377\367"
|
||||
"\310\310\377\363\254\254\377\342\067\067\377\325\036\036\305\325\036\036\064\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\325\036\036Z\325"
|
||||
"\036\036\356\344GG\377\361\236\236\377\363\262\262\377\365\272\272\377\367"
|
||||
"\310\310\377\371\326\326\377\373\350\350\377\375\364\364\377\376\371\371"
|
||||
"\377\371\330\330\377\362\251\251\377\355\206\206\377\351ll\377\347WW\377"
|
||||
"\346OO\377\347XX\377\352oo\377\360\227\227\377\370\325\325\377\375\362\362"
|
||||
"\377\370\325\325\377\365\270\270\377\365\274\274\377\366\301\301\377\367"
|
||||
"\307\307\377\370\323\323\377\372\341\341\377\351ff\377\325\036\036\356\325"
|
||||
"\036\036Z\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\325\036\036q\325\036"
|
||||
"\036\374\347XX\377\357\220\220\377\360\225\225\377\361\242\242\377\364\263"
|
||||
"\263\377\370\325\325\377\375\360\360\377\370\323\323\377\356\213\213\377"
|
||||
"\345NN\377\342\067\067\377\342\067\067\377\342\067\067\377\341\062\062\377\340++"
|
||||
"\377\337$$\377\331\037\037\377\320\035\035\377\314\035\035\377\311\034\034\377\337"
|
||||
"\040\040\377\353tt\377\370\315\315\377\374\353\353\377\371\326\326\377\370"
|
||||
"\315\315\377\371\330\330\377\373\346\346\377\374\351\351\377\357\224\224"
|
||||
"\377\325\036\036\374\325\036\036q\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\325\036\036q\320"
|
||||
"\035\035\377\347XX\377\355\206\206\377\355\206\206\377\356\215\215\377\361"
|
||||
"\244\244\377\371\330\330\377\370\321\321\377\347\\\\\377\340''\377\340--"
|
||||
"\377\342\065\065\377\342\067\067\377\342\067\067\377\342\067\067\377\342\065\065\377"
|
||||
"\340++\377\340%%\377\327\036\036\377\320\035\035\377\314\035\035\377\303\034\034"
|
||||
"\377\302\033\033\377\307\034\034\377\322\036\036\377\347XX\377\370\323\323\377"
|
||||
"\374\353\353\377\373\343\343\377\373\350\350\377\373\346\346\377\374\351"
|
||||
"\351\377\363\254\254\377\332\037\037\377\325\036\036q\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\325\036\036"
|
||||
"Z\325\036\036\374\347WW\377\354yy\377\353xx\377\354\177\177\377\363\254\254"
|
||||
"\377\376\367\367\377\353tt\377\313\035\035\377\327\036\036\377\337\040\040\377"
|
||||
"\340++\377\341\064\064\377\342\067\067\377\342\067\067\377\342\067\067\377\342\065"
|
||||
"\065\377\340--\377\340%%\377\327\036\036\377\320\035\035\377\313\035\035\377\303"
|
||||
"\034\034\377\302\033\033\377\313\035\035\377\325\036\036\377\331\037\037\377\336\037"
|
||||
"\037\377\356\207\207\377\376\371\371\377\374\353\353\377\373\346\346\377\372"
|
||||
"\341\341\377\371\334\334\377\361\236\236\377\325\036\036\374\325\036\036Z\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\327"
|
||||
"\036\036\061\325\036\036\355\345NN\377\354{{\377\352oo\377\353tt\377\364\263\263"
|
||||
"\377\373\350\350\377\343<<\377\275\032\032\377\303\034\034\377\320\035\035\377"
|
||||
"\336\037\037\377\340''\377\341..\377\342\065\065\377\342\067\067\377\342\067\067"
|
||||
"\377\342\065\065\377\340--\377\337$$\377\327\036\036\377\320\035\035\377\311\034"
|
||||
"\034\377\302\033\033\377\303\034\034\377\320\035\035\377\331\037\037\377\332\037\037"
|
||||
"\377\340''\377\340--\377\351ff\377\374\357\357\377\374\353\353\377\371\330"
|
||||
"\330\377\370\315\315\377\367\310\310\377\354}}\377\325\036\036\355\327\036\036"
|
||||
"\061\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\331\037\037\013"
|
||||
"\325\036\036\310\342\071\071\377\356\213\213\377\354\177\177\377\354yy\377\364"
|
||||
"\263\263\377\371\326\326\377\320\035\035\377\262\031\031\377\266\031\031\377\275"
|
||||
"\032\032\377\307\034\034\377\327\036\036\377\337$$\377\340--\377\342\065\065\377"
|
||||
"\342\067\067\377\342\067\067\377\342\065\065\377\340--\377\337$$\377\327\036\036"
|
||||
"\377\314\035\035\377\311\034\034\377\302\033\033\377\311\034\034\377\325\036\036\377"
|
||||
"\331\037\037\377\337\040\040\377\340--\377\341..\377\341..\377\345JJ\377\371"
|
||||
"\334\334\377\373\343\343\377\366\277\277\377\365\270\270\377\366\277\277"
|
||||
"\377\346QQ\377\325\036\036\310\331\037\037\013\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\325\036\036|\336\037\037\377\360\225\225\377\357\220\220\377"
|
||||
"\356\207\207\377\363\262\262\377\372\341\341\377\303\034\034\377\257\030\030"
|
||||
"\377\260\031\031\377\262\031\031\377\271\032\032\377\340''\377\363\254\254\377"
|
||||
"\340--\377\340))\377\341\062\062\377\342\067\067\377\342\067\067\377\342\067\067"
|
||||
"\377\340--\377\337$$\377\322\036\036\377\314\035\035\377\307\034\034\377\303\034"
|
||||
"\034\377\320\035\035\377\331\037\037\377\353tt\377\345JJ\377\341..\377\341..\377"
|
||||
"\340++\377\340''\377\342\065\065\377\373\344\344\377\370\323\323\377\364\263"
|
||||
"\263\377\364\263\263\377\363\254\254\377\337$$\377\325\036\036|\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\322\036\036\"\325\036\036\356\354\177\177\377\361"
|
||||
"\244\244\377\360\227\227\377\361\242\242\377\375\366\366\377\340''\377\257"
|
||||
"\030\030\377\253\030\030\377\253\030\030\377\260\031\031\377\343<<\377\375\360\360"
|
||||
"\377\370\323\323\377\361\236\236\377\337$$\377\331\037\037\377\275\032\032\377"
|
||||
"\246\027\027\377\223\025\025\377\203\022\022\377\203\022\022\377\214\023\023\377\232"
|
||||
"\026\026\377\250\030\030\377\273\032\032\377\322\036\036\377\342\071\071\377\376\367"
|
||||
"\367\377\375\362\362\377\351jj\377\340--\377\340''\377\336\037\037\377\325"
|
||||
"\036\036\377\343AA\377\375\366\366\377\365\272\272\377\362\251\251\377\361"
|
||||
"\236\236\377\355\202\202\377\325\036\036\356\322\036\036\"\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\325\036\036\222\342\067\067\377\364\267\267\377\362\251\251\377"
|
||||
"\361\244\244\377\370\325\325\377\351ll\377\271\032\032\377\264\031\031\377\262"
|
||||
"\031\031\377\253\030\030\377\346SS\377\376\367\367\377\362\251\251\377\360\225"
|
||||
"\225\377\375\366\366\377\313\035\035\377\177\022\022\377~\021\021\377x\021\021\377"
|
||||
"w\020\020\377u\020\020\377u\020\020\377w\020\020\377x\021\021\377~\021\021\377\177\022"
|
||||
"\022\377\250\030\030\377\363\253\253\377\374\357\357\377\374\357\357\377\376"
|
||||
"\371\371\377\354yy\377\336\037\037\377\327\036\036\377\322\036\036\377\314\035\035"
|
||||
"\377\353tt\377\371\326\326\377\360\231\231\377\360\227\227\377\360\235\235"
|
||||
"\377\342\065\065\377\325\036\036\222\000\000\000\000\000\000\000\000\000\000\000\000\325\036\036\036\325"
|
||||
"\036\036\355\360\227\227\377\366\277\277\377\363\262\262\377\367\310\310\377"
|
||||
"\370\315\315\377\303\034\034\377\276\033\033\377\275\032\032\377\266\031\031\377"
|
||||
"\343<<\377\376\367\367\377\357\220\220\377\354{{\377\351ff\377\356\213\213"
|
||||
"\377\360\227\227\377w\020\020\377u\020\020\377u\020\020\377u\020\020\377u\020\020\377"
|
||||
"u\020\020\377u\020\020\377u\020\020\377u\020\020\377w\020\020\377\253\030\030\377\371"
|
||||
"\330\330\377\363\253\253\377\373\344\344\377\371\334\334\377\376\371\371"
|
||||
"\377\347XX\377\322\036\036\377\314\035\035\377\303\034\034\377\302\033\033\377\370"
|
||||
"\315\315\377\364\267\267\377\357\220\220\377\357\220\220\377\354\177\177"
|
||||
"\377\325\036\036\355\325\036\036\036\000\000\000\000\000\000\000\000\325\036\036q\341..\377\367"
|
||||
"\312\312\377\366\301\301\377\365\274\274\377\374\351\351\377\346OO\377\313"
|
||||
"\035\035\377\307\034\034\377\302\033\033\377\340''\377\374\353\353\377\361\244"
|
||||
"\244\377\353tt\377\346QQ\377\346OO\377\365\270\270\377\376\375\375\377\302"
|
||||
"\033\033\377u\020\020\377u\020\020\377u\020\020\377u\020\020\377u\020\020\377u\020\020"
|
||||
"\377u\020\020\377u\020\020\377u\020\020\377\360\231\231\377\370\323\323\377\346"
|
||||
"OO\377\357\220\220\377\366\301\301\377\370\315\315\377\374\357\357\377\341"
|
||||
"..\377\302\033\033\377\276\033\033\377\275\032\032\377\343AA\377\372\341\341\377"
|
||||
"\357\220\220\377\357\224\224\377\360\235\235\377\340))\377\325\036\036q\000\000"
|
||||
"\000\000\221\024\024\003\325\036\036\305\353tt\377\366\301\301\377\365\272\272\377"
|
||||
"\367\312\312\377\370\315\315\377\325\036\036\377\322\036\036\377\320\035\035\377"
|
||||
"\314\035\035\377\364\263\263\377\367\307\307\377\357\220\220\377\350aa\377"
|
||||
"\346OO\377\367\310\310\377\376\375\375\377\376\375\375\377\367\312\312\377"
|
||||
"|\021\021\377u\020\020\377u\020\020\377u\020\020\377u\020\020\377u\020\020\377u\020\020"
|
||||
"\377u\020\020\377\271\032\032\377\376\375\375\377\376\375\375\377\367\310\310"
|
||||
"\377\346OO\377\356\207\207\377\363\262\262\377\370\315\315\377\364\263\263"
|
||||
"\377\276\033\033\377\275\032\032\377\273\032\032\377\273\032\032\377\367\310\310"
|
||||
"\377\363\253\253\377\360\225\225\377\360\231\231\377\350ee\377\325\036\036"
|
||||
"\305\221\024\024\003\327\036\036'\325\036\036\366\363\253\253\377\364\267\267\377"
|
||||
"\365\270\270\377\373\343\343\377\353rr\377\327\036\036\377\327\036\036\377\327"
|
||||
"\036\036\377\345NN\377\374\351\351\377\363\256\256\377\357\220\220\377\341"
|
||||
"\064\064\377\365\270\270\377\376\375\375\377\376\375\375\377\376\375\375\377"
|
||||
"\376\375\375\377\343AA\377u\020\020\377u\020\020\377u\020\020\377u\020\020\377u\020"
|
||||
"\020\377u\020\020\377u\020\020\377\364\267\267\377\376\375\375\377\376\375\375"
|
||||
"\377\376\375\375\377\365\270\270\377\341\064\064\377\356\215\215\377\360\227"
|
||||
"\227\377\373\343\343\377\343<<\377\275\032\032\377\275\032\032\377\276\033\033"
|
||||
"\377\350ee\377\370\323\323\377\357\224\224\377\357\224\224\377\357\220\220"
|
||||
"\377\325\036\036\366\327\036\036'\325\036\036_\341..\377\364\267\267\377\364\263"
|
||||
"\263\377\364\263\263\377\376\371\371\377\337\040\040\377\322\036\036\377\322"
|
||||
"\036\036\377\327\036\036\377\366\277\277\377\370\323\323\377\365\272\272\377"
|
||||
"\351ff\377\356\207\207\377\376\375\375\377\376\375\375\377\376\375\375\377"
|
||||
"\376\375\375\377\376\375\375\377\374\353\353\377\223\025\025\377u\020\020\377"
|
||||
"u\020\020\377u\020\020\377u\020\020\377u\020\020\377\320\035\035\377\376\375\375\377"
|
||||
"\376\375\375\377\376\375\375\377\376\375\375\377\376\375\375\377\356\207"
|
||||
"\207\377\346SS\377\357\224\224\377\365\270\270\377\365\272\272\377\275\032"
|
||||
"\032\377\275\032\032\377\275\032\032\377\314\035\035\377\376\367\367\377\360\231"
|
||||
"\231\377\360\231\231\377\361\242\242\377\340++\377\325\036\036_\325\036\036\222"
|
||||
"\344GG\377\364\267\267\377\363\262\262\377\366\277\277\377\367\307\307\377"
|
||||
"\320\035\035\377\320\035\035\377\320\035\035\377\340--\377\376\371\371\377\365"
|
||||
"\274\274\377\361\242\242\377\343<<\377\372\335\335\377\376\375\375\377\376"
|
||||
"\375\375\377\376\375\375\377\376\375\375\377\376\375\375\377\376\375\375"
|
||||
"\377\354\177\177\377\241\027\027\377\346SS\377\352oo\377\340%%\377\212\023\023"
|
||||
"\377\367\312\312\377\376\375\375\377\376\375\375\377\376\375\375\377\376"
|
||||
"\375\375\377\376\375\375\377\372\335\335\377\343<<\377\355\202\202\377\360"
|
||||
"\225\225\377\376\367\367\377\331\037\037\377\275\032\032\377\276\033\033\377\302"
|
||||
"\033\033\377\366\305\305\377\364\263\263\377\361\236\236\377\363\253\253\377"
|
||||
"\344CC\377\325\036\036\222\325\036\036\272\351ff\377\364\263\263\377\363\256"
|
||||
"\256\377\370\323\323\377\357\220\220\377\320\035\035\377\320\035\035\377\320"
|
||||
"\035\035\377\351ff\377\372\341\341\377\364\263\263\377\352oo\377\354yy\377"
|
||||
"\376\375\375\377\376\375\375\377\376\375\375\377\376\375\375\377\376\375"
|
||||
"\375\377\376\375\375\377\376\375\375\377\376\375\375\377\376\375\375\377"
|
||||
"\376\375\375\377\376\375\375\377\376\375\375\377\376\375\375\377\376\375"
|
||||
"\375\377\376\375\375\377\376\375\375\377\376\375\375\377\376\375\375\377"
|
||||
"\376\375\375\377\376\375\375\377\354yy\377\350]]\377\360\231\231\377\371"
|
||||
"\330\330\377\350aa\377\302\033\033\377\302\033\033\377\303\034\034\377\357\220"
|
||||
"\220\377\367\312\312\377\361\242\242\377\362\247\247\377\351jj\377\325\036"
|
||||
"\036\272\325\036\036\321\355\202\202\377\365\270\270\377\363\262\262\377\372"
|
||||
"\341\341\377\352mm\377\320\035\035\377\314\035\035\377\314\035\035\377\360\227"
|
||||
"\227\377\370\321\321\377\363\256\256\377\345JJ\377\363\256\256\377\376\375"
|
||||
"\375\377\376\375\375\377\376\375\375\377\376\375\375\377\376\375\375\377"
|
||||
"\376\375\375\377\376\375\375\377\376\375\375\377\376\375\375\377\376\375"
|
||||
"\375\377\376\375\375\377\376\375\375\377\376\375\375\377\376\375\375\377"
|
||||
"\376\375\375\377\376\375\375\377\376\375\375\377\376\375\375\377\376\375"
|
||||
"\375\377\376\375\375\377\363\256\256\377\344EE\377\361\236\236\377\367\310"
|
||||
"\310\377\357\224\224\377\303\034\034\377\303\034\034\377\303\034\034\377\351jj"
|
||||
"\377\371\330\330\377\362\247\247\377\363\253\253\377\356\207\207\377\325"
|
||||
"\036\036\321\325\036\036\343\361\242\242\377\365\270\270\377\364\263\263\377"
|
||||
"\373\350\350\377\347WW\377\320\035\035\377\320\035\035\377\320\035\035\377\365"
|
||||
"\272\272\377\367\307\307\377\363\262\262\377\341..\377\371\326\326\377\376"
|
||||
"\375\375\377\376\375\375\377\376\375\375\377\376\375\375\377\376\375\375"
|
||||
"\377\376\375\375\377\376\375\375\377\376\375\375\377\363\256\256\377\244"
|
||||
"\027\027\377u\020\020\377\276\033\033\377\370\323\323\377\376\375\375\377\376\375"
|
||||
"\375\377\376\375\375\377\376\375\375\377\376\375\375\377\376\375\375\377"
|
||||
"\376\375\375\377\371\326\326\377\340--\377\362\247\247\377\365\274\274\377"
|
||||
"\366\277\277\377\311\034\034\377\311\034\034\377\311\034\034\377\346QQ\377\373"
|
||||
"\344\344\377\363\253\253\377\363\254\254\377\357\224\224\377\325\036\036\343"
|
||||
"\325\036\036\355\364\263\263\377\366\305\305\377\366\277\277\377\374\357\357"
|
||||
"\377\345NN\377\327\036\036\377\327\036\036\377\327\036\036\377\370\315\315\377"
|
||||
"\367\312\312\377\367\310\310\377\345JJ\377\375\364\364\377\376\375\375\377"
|
||||
"\376\375\375\377\376\375\375\377\376\375\375\377\376\375\375\377\376\375"
|
||||
"\375\377\376\375\375\377\376\367\367\377\223\025\025\377u\020\020\377u\020\020"
|
||||
"\377u\020\020\377\275\032\032\377\376\375\375\377\376\375\375\377\376\375\375"
|
||||
"\377\376\375\375\377\376\375\375\377\376\375\375\377\376\375\375\377\375"
|
||||
"\364\364\377\344GG\377\365\274\274\377\365\274\274\377\367\312\312\377\313"
|
||||
"\035\035\377\313\035\035\377\313\035\035\377\344CC\377\374\351\351\377\363\254"
|
||||
"\254\377\363\256\256\377\361\244\244\377\325\036\036\355\325\036\036\355\365"
|
||||
"\270\270\377\367\312\312\377\367\310\310\377\375\360\360\377\346QQ\377\336"
|
||||
"\037\037\377\336\037\037\377\336\037\037\377\363\254\254\377\370\321\321\377\370"
|
||||
"\321\321\377\365\272\272\377\364\267\267\377\364\267\267\377\364\267\267"
|
||||
"\377\364\267\267\377\364\267\267\377\364\267\267\377\372\341\341\377\376"
|
||||
"\375\375\377\367\307\307\377u\020\020\377u\020\020\377u\020\020\377u\020\020\377"
|
||||
"\201\022\022\377\376\375\375\377\376\375\375\377\370\323\323\377\364\267\267"
|
||||
"\377\364\267\267\377\364\267\267\377\364\267\267\377\364\267\267\377\365"
|
||||
"\272\272\377\370\315\315\377\370\315\315\377\361\244\244\377\311\034\034\377"
|
||||
"\311\034\034\377\311\034\034\377\343AA\377\373\350\350\377\363\253\253\377\363"
|
||||
"\254\254\377\361\244\244\377\325\036\036\355\325\036\036\343\365\270\270\377"
|
||||
"\370\323\323\377\370\315\315\377\374\357\357\377\350aa\377\337\040\040\377"
|
||||
"\337$$\377\337$$\377\337$$\377\337$$\377\337$$\377\221\024\024\377w\020\020\377"
|
||||
"u\020\020\377u\020\020\377u\020\020\377u\020\020\377u\020\020\377\346OO\377\376\375"
|
||||
"\375\377\375\360\360\377\210\023\023\377u\020\020\377u\020\020\377u\020\020\377\253"
|
||||
"\030\030\377\376\375\375\377\376\375\375\377\320\035\035\377u\020\020\377u\020\020"
|
||||
"\377u\020\020\377u\020\020\377w\020\020\377\214\023\023\377\311\034\034\377\311\034"
|
||||
"\034\377\311\034\034\377\311\034\034\377\311\034\034\377\311\034\034\377\346QQ\377"
|
||||
"\373\344\344\377\363\253\253\377\363\253\253\377\360\235\235\377\325\036\036"
|
||||
"\343\325\036\036\321\361\242\242\377\371\330\330\377\370\325\325\377\374\353"
|
||||
"\353\377\354yy\377\337$$\377\340''\377\340''\377\340''\377\340''\377\340"
|
||||
"%%\377\241\027\027\377x\021\021\377u\020\020\377u\020\020\377u\020\020\377u\020\020\377"
|
||||
"u\020\020\377\331\037\037\377\376\375\375\377\376\375\375\377\360\225\225\377"
|
||||
"\210\023\023\377u\020\020\377\233\026\026\377\366\301\301\377\376\375\375\377\376"
|
||||
"\375\375\377\233\026\026\377u\020\020\377u\020\020\377u\020\020\377u\020\020\377x\021"
|
||||
"\021\377\232\026\026\377\313\035\035\377\313\035\035\377\311\034\034\377\311\034\034"
|
||||
"\377\311\034\034\377\311\034\034\377\351jj\377\371\334\334\377\363\253\253\377"
|
||||
"\363\256\256\377\356\207\207\377\325\036\036\321\325\036\036\272\354\177\177"
|
||||
"\377\371\334\334\377\371\330\330\377\373\346\346\377\360\235\235\377\340"
|
||||
"%%\377\340''\377\340%%\377\340%%\377\337\040\040\377\337\040\040\377\262\031\031"
|
||||
"\377~\021\021\377u\020\020\377u\020\020\377u\020\020\377u\020\020\377u\020\020\377~\021"
|
||||
"\021\377\367\312\312\377\376\375\375\377\376\375\375\377\376\375\375\377\373"
|
||||
"\344\344\377\376\375\375\377\376\375\375\377\376\375\375\377\360\231\231"
|
||||
"\377u\020\020\377u\020\020\377u\020\020\377u\020\020\377u\020\020\377~\021\021\377\251"
|
||||
"\030\030\377\311\034\034\377\311\034\034\377\311\034\034\377\311\034\034\377\311\034"
|
||||
"\034\377\313\035\035\377\357\220\220\377\370\321\321\377\363\254\254\377\363"
|
||||
"\262\262\377\352mm\377\325\036\036\272\325\036\036\222\347XX\377\371\334\334"
|
||||
"\377\371\330\330\377\371\334\334\377\367\312\312\377\337$$\377\337\040\040"
|
||||
"\377\337\040\040\377\336\037\037\377\332\037\037\377\331\037\037\377\303\034\034\377"
|
||||
"\177\022\022\377w\020\020\377u\020\020\377u\020\020\377u\020\020\377u\020\020\377u\020"
|
||||
"\020\377\235\026\026\377\367\307\307\377\376\375\375\377\376\375\375\377\376"
|
||||
"\375\375\377\376\375\375\377\376\375\375\377\361\236\236\377\212\023\023\377"
|
||||
"u\020\020\377u\020\020\377u\020\020\377u\020\020\377w\020\020\377\177\022\022\377\271"
|
||||
"\032\032\377\307\034\034\377\307\034\034\377\311\034\034\377\311\034\034\377\311\034"
|
||||
"\034\377\311\034\034\377\366\305\305\377\366\277\277\377\363\256\256\377\363"
|
||||
"\262\262\377\345JJ\377\325\036\036\222\325\036\036_\342\065\065\377\371\330\330"
|
||||
"\377\370\325\325\377\370\321\321\377\376\371\371\377\341..\377\336\037\037"
|
||||
"\377\331\037\037\377\327\036\036\377\327\036\036\377\320\035\035\377\313\035\035\377"
|
||||
"\241\027\027\377|\021\021\377u\020\020\377u\020\020\377u\020\020\377u\020\020\377u\020"
|
||||
"\020\377u\020\020\377\351ll\377\376\375\375\377\376\375\375\377\376\375\375"
|
||||
"\377\376\375\375\377\376\375\375\377\340%%\377u\020\020\377u\020\020\377u\020"
|
||||
"\020\377u\020\020\377u\020\020\377|\021\021\377\241\027\027\377\302\033\033\377\302"
|
||||
"\033\033\377\303\034\034\377\311\034\034\377\311\034\034\377\311\034\034\377\332\037"
|
||||
"\037\377\376\371\371\377\363\254\254\377\363\254\254\377\363\262\262\377\340"
|
||||
"--\377\325\036\036_\327\036\036'\325\036\036\366\366\277\277\377\367\312\312\377"
|
||||
"\367\307\307\377\373\346\346\377\353rr\377\327\036\036\377\322\036\036\377\320"
|
||||
"\035\035\377\313\035\035\377\302\033\033\377\276\033\033\377\266\031\031\377\177\022"
|
||||
"\022\377w\020\020\377u\020\020\377u\020\020\377u\020\020\377u\020\020\377\253\030\030"
|
||||
"\377\376\367\367\377\376\375\375\377\376\375\375\377\376\375\375\377\376"
|
||||
"\375\375\377\376\375\375\377\373\344\344\377\210\023\023\377u\020\020\377u\020"
|
||||
"\020\377u\020\020\377w\020\020\377\177\022\022\377\262\031\031\377\275\032\032\377\276"
|
||||
"\033\033\377\302\033\033\377\302\033\033\377\303\034\034\377\303\034\034\377\351ff"
|
||||
"\377\371\334\334\377\362\251\251\377\363\253\253\377\362\247\247\377\325"
|
||||
"\036\036\366\327\036\036'\221\024\024\003\325\036\036\305\354}}\377\367\310\310\377"
|
||||
"\366\301\301\377\370\315\315\377\367\312\312\377\320\035\035\377\311\034\034"
|
||||
"\377\303\034\034\377\302\033\033\377\275\032\032\377\275\032\032\377\276\033\033\377"
|
||||
"\253\030\030\377~\021\021\377w\020\020\377u\020\020\377u\020\020\377w\020\020\377\365"
|
||||
"\272\272\377\376\375\375\377\376\375\375\377\376\375\375\377\376\375\375"
|
||||
"\377\376\375\375\377\376\375\375\377\376\375\375\377\354\177\177\377u\020"
|
||||
"\020\377u\020\020\377w\020\020\377~\021\021\377\253\030\030\377\271\032\032\377\271"
|
||||
"\032\032\377\273\032\032\377\275\032\032\377\276\033\033\377\302\033\033\377\303\034"
|
||||
"\034\377\367\310\310\377\364\267\267\377\361\244\244\377\363\253\253\377\352"
|
||||
"oo\377\325\036\036\305\221\024\024\003\000\000\000\000\325\036\036q\340--\377\367\307\307"
|
||||
"\377\365\270\270\377\363\262\262\377\373\346\346\377\344GG\377\302\033\033"
|
||||
"\377\275\032\032\377\275\032\032\377\275\032\032\377\275\032\032\377\275\032\032\377"
|
||||
"\275\032\032\377\250\030\030\377~\021\021\377w\020\020\377u\020\020\377\343AA\377\376"
|
||||
"\375\375\377\376\375\375\377\376\375\375\377\376\375\375\377\376\375\375"
|
||||
"\377\376\375\375\377\376\375\375\377\376\375\375\377\376\375\375\377\271"
|
||||
"\032\032\377w\020\020\377~\021\021\377\250\030\030\377\275\032\032\377\275\032\032\377"
|
||||
"\273\032\032\377\273\032\032\377\271\032\032\377\275\032\032\377\275\032\032\377\343"
|
||||
"AA\377\373\344\344\377\361\236\236\377\361\244\244\377\363\254\254\377\340"
|
||||
"++\377\325\036\036q\000\000\000\000\000\000\000\000\325\036\036\036\325\036\036\355\356\215\215"
|
||||
"\377\363\262\262\377\362\247\247\377\365\272\272\377\370\315\315\377\276"
|
||||
"\033\033\377\275\032\032\377\275\032\032\377\275\032\032\377\275\032\032\377\275\032"
|
||||
"\032\377\273\032\032\377\275\032\032\377\257\030\030\377\177\022\022\377\237\026\026"
|
||||
"\377\374\353\353\377\376\375\375\377\376\375\375\377\376\375\375\377\376"
|
||||
"\375\375\377\376\375\375\377\376\375\375\377\376\375\375\377\376\375\375"
|
||||
"\377\373\346\346\377\370\315\315\377\206\023\023\377\260\031\031\377\276\033\033"
|
||||
"\377\275\032\032\377\276\033\033\377\275\032\032\377\273\032\032\377\271\032\032\377"
|
||||
"\271\032\032\377\275\032\032\377\370\315\315\377\365\270\270\377\360\227\227"
|
||||
"\377\361\242\242\377\356\213\213\377\325\036\036\355\325\036\036\036\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\325\036\036\222\340--\377\362\247\247\377\360\227\227\377\360"
|
||||
"\225\225\377\370\323\323\377\352mm\377\275\032\032\377\275\032\032\377\275\032"
|
||||
"\032\377\273\032\032\377\273\032\032\377\275\032\032\377\302\033\033\377\303\034\034"
|
||||
"\377\276\033\033\377\363\254\254\377\357\224\224\377\354yy\377\363\256\256"
|
||||
"\377\371\326\326\377\375\362\362\377\375\362\362\377\371\326\326\377\363"
|
||||
"\256\256\377\354yy\377\343<<\377\365\270\270\377\355\202\202\377\311\034\034"
|
||||
"\377\303\034\034\377\276\033\033\377\275\032\032\377\275\032\032\377\275\032\032\377"
|
||||
"\275\032\032\377\273\032\032\377\351jj\377\370\315\315\377\356\215\215\377\357"
|
||||
"\224\224\377\361\236\236\377\343<<\377\325\036\036\222\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\322\036\036\"\325\036\036\356\353tt\377\360\227\227\377\360\225"
|
||||
"\225\377\362\251\251\377\375\366\366\377\340--\377\275\032\032\377\273\032\032"
|
||||
"\377\273\032\032\377\275\032\032\377\302\033\033\377\303\034\034\377\311\034\034\377"
|
||||
"\350aa\377\373\346\346\377\361\242\242\377\353tt\377\345NN\377\341\062\062"
|
||||
"\377\336\037\037\377\336\037\037\377\341\062\062\377\345JJ\377\352oo\377\360\231"
|
||||
"\231\377\363\262\262\377\375\366\366\377\341\062\062\377\311\034\034\377\302"
|
||||
"\033\033\377\275\032\032\377\275\032\032\377\275\032\032\377\275\032\032\377\340--"
|
||||
"\377\375\366\366\377\361\236\236\377\356\213\213\377\357\220\220\377\354"
|
||||
"}}\377\325\036\036\356\322\036\036\"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\325\036\036|\331\037\037\377\360\227\227\377\360\231\231\377\360\227\227\377"
|
||||
"\366\277\277\377\372\341\341\377\327\036\036\377\273\032\032\377\275\032\032\377"
|
||||
"\276\033\033\377\302\033\033\377\307\034\034\377\332\037\037\377\373\350\350\377"
|
||||
"\370\323\323\377\366\277\277\377\365\270\270\377\365\270\270\377\366\277"
|
||||
"\277\377\367\310\310\377\367\312\312\377\366\277\277\377\364\267\267\377"
|
||||
"\364\263\263\377\364\263\263\377\367\312\312\377\373\346\346\377\356\207"
|
||||
"\207\377\311\034\034\377\303\034\034\377\302\033\033\377\275\032\032\377\275\032\032"
|
||||
"\377\327\036\036\377\373\343\343\377\366\277\277\377\357\220\220\377\357\220"
|
||||
"\220\377\357\224\224\377\340''\377\325\036\036|\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\331\037\037\013\325\036\036\310\342\067\067\377\361\236\236"
|
||||
"\377\357\224\224\377\357\220\220\377\366\305\305\377\371\330\330\377\336"
|
||||
"\037\037\377\276\033\033\377\302\033\033\377\303\034\034\377\311\034\034\377\320\035"
|
||||
"\035\377\346QQ\377\366\277\277\377\376\367\367\377\373\344\344\377\370\325"
|
||||
"\325\377\371\330\330\377\370\325\325\377\371\326\326\377\371\330\330\377"
|
||||
"\370\325\325\377\373\343\343\377\375\366\366\377\365\274\274\377\345JJ\377"
|
||||
"\303\034\034\377\307\034\034\377\311\034\034\377\307\034\034\377\302\033\033\377\336"
|
||||
"\037\037\377\371\330\330\377\367\310\310\377\360\225\225\377\357\224\224\377"
|
||||
"\360\225\225\377\345JJ\377\325\036\036\310\331\037\037\013\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\327\036\036\061\325\036\036\355\347XX\377"
|
||||
"\360\225\225\377\357\220\220\377\357\220\220\377\366\301\301\377\374\351"
|
||||
"\351\377\343AA\377\302\033\033\377\311\034\034\377\314\035\035\377\322\036\036\377"
|
||||
"\327\036\036\377\327\036\036\377\337$$\377\350ee\377\361\236\236\377\363\253"
|
||||
"\253\377\370\321\321\377\370\321\321\377\363\253\253\377\361\236\236\377"
|
||||
"\350ee\377\336\037\037\377\320\035\035\377\314\035\035\377\311\034\034\377\307\034"
|
||||
"\034\377\311\034\034\377\311\034\034\377\343AA\377\374\351\351\377\366\301\301"
|
||||
"\377\360\225\225\377\360\225\225\377\360\231\231\377\352mm\377\325\036\036"
|
||||
"\355\327\036\036\061\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\325\036\036Z\325\036\036\374\352mm\377\360\227\227\377\357\224"
|
||||
"\224\377\360\227\227\377\366\277\277\377\376\371\371\377\354yy\377\313\035"
|
||||
"\035\377\320\035\035\377\322\036\036\377\325\036\036\377\325\036\036\377\322\036\036"
|
||||
"\377\320\035\035\377\325\036\036\377\331\037\037\377\336\037\037\377\336\037\037\377"
|
||||
"\331\037\037\377\322\036\036\377\320\035\035\377\320\035\035\377\320\035\035\377\320"
|
||||
"\035\035\377\313\035\035\377\307\034\034\377\307\034\034\377\354yy\377\376\371\371"
|
||||
"\377\366\277\277\377\360\231\231\377\360\225\225\377\360\231\231\377\354"
|
||||
"\177\177\377\325\036\036\374\325\036\036Z\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\325\036\036q\322\036\036"
|
||||
"\377\353rr\377\360\235\235\377\361\236\236\377\361\236\236\377\363\262\262"
|
||||
"\377\371\334\334\377\370\321\321\377\345JJ\377\327\036\036\377\327\036\036\377"
|
||||
"\322\036\036\377\322\036\036\377\320\035\035\377\327\036\036\377\331\037\037\377\336"
|
||||
"\037\037\377\336\037\037\377\332\037\037\377\325\036\036\377\320\035\035\377\320\035"
|
||||
"\035\377\320\035\035\377\320\035\035\377\313\035\035\377\344CC\377\370\315\315\377"
|
||||
"\371\330\330\377\363\262\262\377\361\244\244\377\362\247\247\377\361\236"
|
||||
"\236\377\355\202\202\377\336\037\037\377\325\036\036q\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\325\036\036q\325\036\036\374\351ff\377\361\236\236\377\362\251\251\377"
|
||||
"\362\251\251\377\363\256\256\377\370\315\315\377\374\353\353\377\367\312"
|
||||
"\312\377\354}}\377\341..\377\320\035\035\377\322\036\036\377\327\036\036\377\332"
|
||||
"\037\037\377\336\037\037\377\336\037\037\377\332\037\037\377\327\036\036\377\322\036"
|
||||
"\036\377\320\035\035\377\340++\377\354yy\377\367\312\312\377\373\350\350\377"
|
||||
"\366\305\305\377\362\247\247\377\363\253\253\377\363\253\253\377\362\251"
|
||||
"\251\377\353tt\377\325\036\036\374\325\036\036q\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\325\036\036Z\325\036\036\356\345JJ\377\363\254\254\377\364"
|
||||
"\263\263\377\364\263\263\377\365\270\270\377\365\274\274\377\370\315\315"
|
||||
"\377\372\341\341\377\375\364\364\377\370\323\323\377\361\236\236\377\354"
|
||||
"{{\377\353tt\377\346QQ\377\346QQ\377\353tt\377\354{{\377\361\236\236\377"
|
||||
"\370\323\323\377\375\364\364\377\371\334\334\377\366\305\305\377\363\254"
|
||||
"\254\377\362\251\251\377\362\247\247\377\363\262\262\377\363\256\256\377"
|
||||
"\346SS\377\325\036\036\356\325\036\036Z\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\325\036\036\064\325\036\036\305\340))\377\357\220\220"
|
||||
"\377\365\274\274\377\366\277\277\377\366\277\277\377\365\274\274\377\365"
|
||||
"\272\272\377\364\263\263\377\366\301\301\377\370\325\325\377\373\343\343"
|
||||
"\377\373\344\344\377\375\360\360\377\375\360\360\377\373\346\346\377\373"
|
||||
"\343\343\377\370\325\325\377\366\301\301\377\364\267\267\377\364\267\267"
|
||||
"\377\363\262\262\377\364\263\263\377\363\262\262\377\363\254\254\377\357"
|
||||
"\220\220\377\341..\377\325\036\036\305\325\036\036\064\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\311\034\034\014\325"
|
||||
"\036\036|\325\036\036\354\343<<\377\361\236\236\377\367\307\307\377\366\277\277"
|
||||
"\377\365\272\272\377\364\267\267\377\364\267\267\377\365\272\272\377\366"
|
||||
"\277\277\377\366\301\301\377\367\312\312\377\370\315\315\377\367\310\310"
|
||||
"\377\366\277\277\377\365\270\270\377\364\267\267\377\364\263\263\377\364"
|
||||
"\263\263\377\365\272\272\377\364\267\267\377\361\236\236\377\344EE\377\325"
|
||||
"\036\036\354\325\036\036|\311\034\034\014\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\334\037"
|
||||
"\037&\325\036\036\222\325\036\036\354\340))\377\353tt\377\363\256\256\377\366"
|
||||
"\277\277\377\366\301\301\377\366\277\277\377\366\305\305\377\367\307\307"
|
||||
"\377\370\315\315\377\370\321\321\377\370\315\315\377\367\307\307\377\366"
|
||||
"\277\277\377\366\277\277\377\365\270\270\377\363\254\254\377\354{{\377\341"
|
||||
"\064\064\377\325\036\036\354\325\036\036\222\334\037\037&\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\325\036\036\036\325\036\036s\325\036\036"
|
||||
"\304\325\036\036\365\340++\377\345JJ\377\352mm\377\357\220\220\377\363\254"
|
||||
"\254\377\364\267\267\377\364\267\267\377\363\256\256\377\357\220\220\377"
|
||||
"\353rr\377\346OO\377\340--\377\325\036\036\365\325\036\036\304\325\036\036s\325"
|
||||
"\036\036\036\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\037\004\004\001\325\036\036(\325\036\036_\325\036\036"
|
||||
"\222\325\036\036\270\325\036\036\321\325\036\036\343\325\036\036\355\325\036\036\355"
|
||||
"\325\036\036\343\325\036\036\321\325\036\036\270\325\036\036\222\325\036\036_\325\036"
|
||||
"\036(\037\004\004\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
|
||||
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000",
|
||||
#if 0
|
||||
};
|
||||
#endif
|
BIN
source/rr/rsrc/game.bmp
Normal file
After Width: | Height: | Size: 328 KiB |
1
source/rr/rsrc/game_icon.c
Normal file
|
@ -0,0 +1 @@
|
|||
#include "eduke32_icon.c"
|
BIN
source/rr/rsrc/game_icon.ico
Normal file
After Width: | Height: | Size: 145 KiB |
80
source/rr/rsrc/gameres.rc
Normal file
|
@ -0,0 +1,80 @@
|
|||
#define NEED_COMMCTRL_H
|
||||
#include "../../build/include/windows_inc.h"
|
||||
#include "../src/startwin.game.h"
|
||||
|
||||
RSRC_ICON ICON "game_icon.ico"
|
||||
RSRC_BMP BITMAP "game.bmp"
|
||||
|
||||
WIN_STARTWIN DIALOGEX DISCARDABLE 20, 40, 260, 200
|
||||
STYLE DS_MODALFRAME | DS_CENTER | DS_SETFONT | DS_FIXEDSYS | WS_OVERLAPPED | WS_CAPTION | WS_VISIBLE | WS_SYSMENU
|
||||
CAPTION "Startup"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "", WIN_STARTWIN_BITMAP, "STATIC", SS_BITMAP | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE, 0, 0, 66, 172
|
||||
CONTROL "", WIN_STARTWIN_TABCTL, WC_TABCONTROL, WS_CLIPSIBLINGS | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 5, 250, 170
|
||||
CONTROL "&Start", WIN_STARTWIN_START, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 154, 180, 48, 14
|
||||
CONTROL "&Cancel", WIN_STARTWIN_CANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 207, 180, 48, 14
|
||||
|
||||
CONTROL "", WIN_STARTWIN_MESSAGES, "EDIT", ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VSCROLL, 0, 0, 32, 32
|
||||
END
|
||||
WIN_STARTWINPAGE_CONFIG DIALOGEX DISCARDABLE 20, 40, 279, 168
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "&Video mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 6, 50, 8
|
||||
CONTROL "", IDCVMODE, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 4, 86, 56
|
||||
CONTROL "&Fullscreen", IDCFULLSCREEN, "BUTTON", BS_CHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 154, 6, 46, 10
|
||||
#if defined POLYMER && POLYMER != 0
|
||||
CONTROL "&Polymer", IDCPOLYMER, "BUTTON", BS_CHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 203, 6, 40, 10
|
||||
#endif
|
||||
CONTROL "Input devices:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 20, 50, 8
|
||||
CONTROL "", IDCINPUT, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 19, 86, 56
|
||||
CONTROL "&Game:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 35, 100, 8
|
||||
CONTROL "", IDCDATA, "LISTBOX", LBS_NOINTEGRALHEIGHT | LBS_USETABSTOPS | LBS_STANDARD | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 45, 226, 43
|
||||
|
||||
CONTROL "Custom game content &directory:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 90, 160, 8
|
||||
CONTROL "", IDCGAMEDIR, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 10, 99, 226, 156
|
||||
CONTROL "&Enable ""autoload"" folder", IDCAUTOLOAD, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 116, 100, 8
|
||||
CONTROL "&Always show this window at startup", IDCALWAYSSHOW, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 118, 116, 140, 8
|
||||
END
|
||||
|
||||
#define FILEVER 1,9,9,9
|
||||
#define PRODUCTVER 1,9,9,9
|
||||
#define STRFILEVER "2.0.0devel\0"
|
||||
#define STRPRODUCTVER "2.0.0devel\0"
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION FILEVER
|
||||
PRODUCTVERSION PRODUCTVER
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x3L
|
||||
#else
|
||||
FILEFLAGS 0x2L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "FileDescription", "Rednukem"
|
||||
VALUE "FileVersion", STRFILEVER
|
||||
VALUE "InternalName", "Rednukem"
|
||||
VALUE "LegalCopyright", "Copyright © 2018 EDuke32 Developers, 1996, 2003 3D Realms Entertainment"
|
||||
VALUE "LegalTrademarks", "Duke Nukem® is a Registered Trademark of Gearbox Software, LLC."
|
||||
VALUE "OriginalFilename", "rednukem.exe"
|
||||
VALUE "ProductName", "Rednukem"
|
||||
VALUE "ProductVersion", STRPRODUCTVER
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
1 24 "manifest.game.xml"
|
42
source/rr/rsrc/manifest.build.xml
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
||||
<dpiAware>true</dpiAware>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
<assemblyIdentity
|
||||
version="1.0.0.0"
|
||||
processorArchitecture="*"
|
||||
name="EDuke32.Mapster32"
|
||||
type="win32"
|
||||
/>
|
||||
<description>Mapster32 for EDuke32</description>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- Windows Vista -->
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
|
||||
<!-- Windows 7 -->
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||
<!-- Windows 8 -->
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
||||
<!-- Windows 8.1 -->
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
42
source/rr/rsrc/manifest.game.xml
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
||||
<dpiAware>true</dpiAware>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
<assemblyIdentity
|
||||
version="1.0.0.0"
|
||||
processorArchitecture="*"
|
||||
name="EDuke32"
|
||||
type="win32"
|
||||
/>
|
||||
<description>EDuke32</description>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- Windows Vista -->
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
|
||||
<!-- Windows 7 -->
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||
<!-- Windows 8 -->
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
||||
<!-- Windows 8.1 -->
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
BIN
source/rr/rsrc/source/EDuke32_logo_21_large.psd
Normal file
BIN
source/rr/rsrc/source/EDuke32_logo_21_large_blue.psd
Normal file
BIN
source/rr/rsrc/source/EDuke32_logo_21_large_opaque.psd
Normal file
BIN
source/rr/rsrc/source/game2.psd
Normal file
BIN
source/rr/rsrc/source/game3.psd
Normal file
BIN
source/rr/rsrc/source/wii-hbc-icon.xcf
Normal file
26
source/rr/src/GameListSource.game.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* GameListSource.game.h
|
||||
* duke3d
|
||||
*
|
||||
* Created by Jonathon Fowler on 24/07/09.
|
||||
* Copyright 2009 __MyCompanyName__. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
@interface GameListSource : NSObject <NSComboBoxDataSource>
|
||||
{
|
||||
NSMutableArray *list;
|
||||
}
|
||||
- (id)init;
|
||||
- (void)dealloc;
|
||||
- (GrpFile*)grpAtIndex:(int)index;
|
||||
- (int)findIndexForGrpname:(NSString*)grpname;
|
||||
- (id)tableView:(NSTableView *)aTableView
|
||||
objectValueForTableColumn:(NSTableColumn *)aTableColumn
|
||||
row:(NSInteger)rowIndex;
|
||||
- (int)numberOfRowsInTableView:(NSTableView *)aTableView;
|
||||
@end
|
||||
|
75
source/rr/src/GameListSource.game.mm
Normal file
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* GameListSource.game.m
|
||||
* duke3d
|
||||
*
|
||||
* Created by Jonathon Fowler on 24/07/09.
|
||||
* Copyright 2009 __MyCompanyName__. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
#import "GrpFile.game.h"
|
||||
#import "GameListSource.game.h"
|
||||
|
||||
@implementation GameListSource
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
list = [[NSMutableArray alloc] init];
|
||||
|
||||
for (grpfile_t const *p = foundgrps; p; p=p->next) {
|
||||
[list addObject:[[GrpFile alloc] initWithGrpfile:p]];
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[list release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (GrpFile*)grpAtIndex:(int)index
|
||||
{
|
||||
return [list objectAtIndex:index];
|
||||
}
|
||||
|
||||
- (int)findIndexForGrpname:(NSString*)grpname
|
||||
{
|
||||
NSUInteger i, listcount = [list count];
|
||||
for (i=0; i<listcount; i++) {
|
||||
if ([[[list objectAtIndex:i] grpname] isEqual:grpname]) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
- (id)tableView:(NSTableView *)aTableView
|
||||
objectValueForTableColumn:(NSTableColumn *)aTableColumn
|
||||
row:(NSInteger)rowIndex
|
||||
{
|
||||
UNREFERENCED_PARAMETER(aTableView);
|
||||
|
||||
NSParameterAssert((NSUInteger)rowIndex < [list count]);
|
||||
switch ([[aTableColumn identifier] intValue]) {
|
||||
case 0: // name column
|
||||
return [[list objectAtIndex:rowIndex] name];
|
||||
case 1: // grp column
|
||||
return [[list objectAtIndex:rowIndex] grpname];
|
||||
default: return nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (int)numberOfRowsInTableView:(NSTableView *)aTableView
|
||||
{
|
||||
UNREFERENCED_PARAMETER(aTableView);
|
||||
|
||||
return [list count];
|
||||
}
|
||||
@end
|
||||
|
26
source/rr/src/GrpFile.game.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* GrpFile.game.h
|
||||
* duke3d
|
||||
*
|
||||
* Created by Jonathon Fowler on 24/07/09.
|
||||
* Copyright 2009 __MyCompanyName__. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#include "grpscan.h"
|
||||
|
||||
@interface GrpFile : NSObject
|
||||
{
|
||||
NSString *namestring;
|
||||
NSString *grpnamestring;
|
||||
grpfile_t const *fg;
|
||||
}
|
||||
- (id)initWithGrpfile:(grpfile_t const *)grpfile;
|
||||
- (void)dealloc;
|
||||
- (NSString *)name;
|
||||
- (NSString *)grpname;
|
||||
- (grpfile_t const *)entryptr;
|
||||
@end
|
||||
|
43
source/rr/src/GrpFile.game.mm
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* GrpFile.game.m
|
||||
* duke3d
|
||||
*
|
||||
* Created by Jonathon Fowler on 24/07/09.
|
||||
* Copyright 2009 __MyCompanyName__. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "GrpFile.game.h"
|
||||
|
||||
@implementation GrpFile
|
||||
- (id)initWithGrpfile:(grpfile_t const *)grpfile
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
fg = grpfile;
|
||||
namestring = [NSString stringWithCString:fg->type->name encoding:NSUTF8StringEncoding];
|
||||
[namestring retain];
|
||||
grpnamestring = [NSString stringWithCString:fg->filename encoding:NSUTF8StringEncoding];
|
||||
[grpnamestring retain];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
- (void)dealloc
|
||||
{
|
||||
[namestring release];
|
||||
[grpnamestring release];
|
||||
[super dealloc];
|
||||
}
|
||||
- (NSString *)name
|
||||
{
|
||||
return namestring;
|
||||
}
|
||||
- (NSString *)grpname
|
||||
{
|
||||
return grpnamestring;
|
||||
}
|
||||
- (grpfile_t const *)entryptr
|
||||
{
|
||||
return fg;
|
||||
}
|
||||
@end
|
390
source/rr/src/_functio.h
Normal file
|
@ -0,0 +1,390 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
// _functio.h
|
||||
|
||||
// file created by makehead.exe
|
||||
// these headers contain default key assignments, as well as
|
||||
// default button assignments and game function names
|
||||
// axis defaults are also included
|
||||
|
||||
#include "_control.h"
|
||||
#include "control.h"
|
||||
|
||||
#ifndef function_private_h_
|
||||
#define function_private_h_
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
// KEEPINSYNC lunatic/con_lang.lua
|
||||
char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN] =
|
||||
{
|
||||
"Move_Forward",
|
||||
"Move_Backward",
|
||||
"Turn_Left",
|
||||
"Turn_Right",
|
||||
"Strafe",
|
||||
"Fire",
|
||||
"Open",
|
||||
"Run",
|
||||
"AutoRun",
|
||||
"Jump",
|
||||
"Crouch",
|
||||
"Look_Up",
|
||||
"Look_Down",
|
||||
"Look_Left",
|
||||
"Look_Right",
|
||||
"Strafe_Left",
|
||||
"Strafe_Right",
|
||||
"Aim_Up",
|
||||
"Aim_Down",
|
||||
"Weapon_1",
|
||||
"Weapon_2",
|
||||
"Weapon_3",
|
||||
"Weapon_4",
|
||||
"Weapon_5",
|
||||
"Weapon_6",
|
||||
"Weapon_7",
|
||||
"Weapon_8",
|
||||
"Weapon_9",
|
||||
"Weapon_10",
|
||||
"Inventory",
|
||||
"Inventory_Left",
|
||||
"Inventory_Right",
|
||||
"Holo_Duke",
|
||||
"Jetpack",
|
||||
"NightVision",
|
||||
"MedKit",
|
||||
"TurnAround",
|
||||
"SendMessage",
|
||||
"Map",
|
||||
"Shrink_Screen",
|
||||
"Enlarge_Screen",
|
||||
"Center_View",
|
||||
"Holster_Weapon",
|
||||
"Show_Opponents_Weapon",
|
||||
"Map_Follow_Mode",
|
||||
"See_Coop_View",
|
||||
"Mouse_Aiming",
|
||||
"Toggle_Crosshair",
|
||||
"Steroids",
|
||||
"Quick_Kick",
|
||||
"Next_Weapon",
|
||||
"Previous_Weapon",
|
||||
"Show_Console",
|
||||
"Show_DukeMatch_Scores",
|
||||
"Dpad_Select",
|
||||
"Dpad_Aiming",
|
||||
"Alternate_Weapon",
|
||||
"Last_Used_Weapon",
|
||||
"Quick_Save",
|
||||
"Quick_Load",
|
||||
};
|
||||
|
||||
#ifdef __SETUP__
|
||||
|
||||
char keydefaults[NUMGAMEFUNCTIONS*2][MAXGAMEFUNCLEN] =
|
||||
{
|
||||
"W", "Kpad8",
|
||||
"S", "Kpad2",
|
||||
"Left", "Kpad4",
|
||||
"Right", "KPad6",
|
||||
"LAlt", "RAlt",
|
||||
"", "RCtrl",
|
||||
"E", "",
|
||||
"LShift", "RShift",
|
||||
"CapLck", "",
|
||||
"Space", "/",
|
||||
"LCtrl", "",
|
||||
"PgUp", "Kpad9",
|
||||
"PgDn", "Kpad3",
|
||||
"Insert", "Kpad0",
|
||||
"Delete", "Kpad.",
|
||||
"A", "",
|
||||
"D", "",
|
||||
"Home", "KPad7",
|
||||
"End", "Kpad1",
|
||||
"1", "",
|
||||
"2", "",
|
||||
"3", "",
|
||||
"4", "",
|
||||
"5", "",
|
||||
"6", "",
|
||||
"7", "",
|
||||
"8", "",
|
||||
"9", "",
|
||||
"0", "",
|
||||
"Enter", "KpdEnt",
|
||||
"[", "",
|
||||
"]", "",
|
||||
"H", "",
|
||||
"J", "",
|
||||
"N", "",
|
||||
"M", "",
|
||||
"BakSpc", "",
|
||||
"T", "",
|
||||
"Tab", "",
|
||||
"-", "Kpad-",
|
||||
"=", "Kpad+",
|
||||
"KPad5", "",
|
||||
"ScrLck", "",
|
||||
"Y", "",
|
||||
"F", "",
|
||||
"K", "",
|
||||
"U", "",
|
||||
"I", "",
|
||||
"R", "",
|
||||
"Q", "",
|
||||
"'", "",
|
||||
";", "",
|
||||
"`", "",
|
||||
"", "",
|
||||
"", "",
|
||||
"", "",
|
||||
"", "",
|
||||
"", "",
|
||||
"F6", "",
|
||||
"F9", "",
|
||||
};
|
||||
|
||||
char oldkeydefaults[NUMGAMEFUNCTIONS*2][MAXGAMEFUNCLEN] =
|
||||
{
|
||||
"Up", "Kpad8",
|
||||
"Down", "Kpad2",
|
||||
"Left", "Kpad4",
|
||||
"Right", "KPad6",
|
||||
"LAlt", "RAlt",
|
||||
"LCtrl", "RCtrl",
|
||||
"Space", "",
|
||||
"LShift", "RShift",
|
||||
"CapLck", "",
|
||||
"A", "/",
|
||||
"Z", "",
|
||||
"PgUp", "Kpad9",
|
||||
"PgDn", "Kpad3",
|
||||
"Insert", "Kpad0",
|
||||
"Delete", "Kpad.",
|
||||
",", "",
|
||||
".", "",
|
||||
"Home", "KPad7",
|
||||
"End", "Kpad1",
|
||||
"1", "",
|
||||
"2", "",
|
||||
"3", "",
|
||||
"4", "",
|
||||
"5", "",
|
||||
"6", "",
|
||||
"7", "",
|
||||
"8", "",
|
||||
"9", "",
|
||||
"0", "",
|
||||
"Enter", "KpdEnt",
|
||||
"[", "",
|
||||
"]", "",
|
||||
"H", "",
|
||||
"J", "",
|
||||
"N", "",
|
||||
"M", "",
|
||||
"BakSpc", "",
|
||||
"T", "",
|
||||
"Tab", "",
|
||||
"-", "Kpad-",
|
||||
"=", "Kpad+",
|
||||
"KPad5", "",
|
||||
"ScrLck", "",
|
||||
"W", "",
|
||||
"F", "",
|
||||
"K", "",
|
||||
"U", "",
|
||||
"I", "",
|
||||
"R", "",
|
||||
"`", "",
|
||||
"'", "",
|
||||
";", "",
|
||||
"C", "",
|
||||
"", "",
|
||||
"", "",
|
||||
"", "",
|
||||
"", "",
|
||||
"", "",
|
||||
"F6", "",
|
||||
"F9", "",
|
||||
};
|
||||
|
||||
static const char * mousedefaults[MAXMOUSEBUTTONS] =
|
||||
{
|
||||
"Fire",
|
||||
"MedKit",
|
||||
"Jetpack",
|
||||
"",
|
||||
"Previous_Weapon",
|
||||
"Next_Weapon",
|
||||
};
|
||||
|
||||
|
||||
static const char * mouseclickeddefaults[MAXMOUSEBUTTONS] =
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
static const char * mouseanalogdefaults[MAXMOUSEAXES] =
|
||||
{
|
||||
"analog_turning",
|
||||
"analog_moving",
|
||||
};
|
||||
|
||||
|
||||
static const char * mousedigitaldefaults[MAXMOUSEDIGITAL] =
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(GEKKO)
|
||||
static const char * joystickdefaults[MAXJOYBUTTONSANDHATS] =
|
||||
{
|
||||
"Open", // A
|
||||
"Fire", // B
|
||||
"Run", // 1
|
||||
"Map", // 2
|
||||
"Previous_Weapon", // -
|
||||
"Next_Weapon", // +
|
||||
"", // Home
|
||||
"Jump", // Z
|
||||
"Crouch", // C
|
||||
"Map", // X
|
||||
"Run", // Y
|
||||
"Jump", // L
|
||||
"Quick_Kick", // R
|
||||
"Crouch", // ZL
|
||||
"Fire", // ZR
|
||||
"Quick_Kick", // D-Pad Up
|
||||
"Inventory_Right", // D-Pad Right
|
||||
"Inventory", // D-Pad Down
|
||||
"Inventory_Left", // D-Pad Left
|
||||
};
|
||||
|
||||
|
||||
static const char * joystickclickeddefaults[MAXJOYBUTTONSANDHATS] =
|
||||
{
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"Inventory",
|
||||
};
|
||||
|
||||
|
||||
static const char * joystickanalogdefaults[MAXJOYAXES] =
|
||||
{
|
||||
"analog_strafing",
|
||||
"analog_moving",
|
||||
"analog_turning",
|
||||
"analog_lookingupanddown",
|
||||
};
|
||||
|
||||
|
||||
static const char * joystickdigitaldefaults[MAXJOYDIGITAL] =
|
||||
{
|
||||
};
|
||||
#else
|
||||
static const char * joystickdefaults[MAXJOYBUTTONSANDHATS] =
|
||||
{
|
||||
"Fire",
|
||||
"Strafe",
|
||||
"Run",
|
||||
"Open",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"Aim_Down",
|
||||
"Look_Right",
|
||||
"Aim_Up",
|
||||
"Look_Left",
|
||||
};
|
||||
|
||||
|
||||
static const char * joystickclickeddefaults[MAXJOYBUTTONSANDHATS] =
|
||||
{
|
||||
"",
|
||||
"Inventory",
|
||||
"Jump",
|
||||
"Crouch",
|
||||
};
|
||||
|
||||
|
||||
static const char * joystickanalogdefaults[MAXJOYAXES] =
|
||||
{
|
||||
"analog_turning",
|
||||
"analog_moving",
|
||||
"analog_strafing",
|
||||
};
|
||||
|
||||
|
||||
static const char * joystickdigitaldefaults[MAXJOYDIGITAL] =
|
||||
{
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"Run",
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
147
source/rr/src/_midi.h
Normal file
|
@ -0,0 +1,147 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2016 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#ifndef ___MIDI_H
|
||||
#define ___MIDI_H
|
||||
#include "compat.h"
|
||||
|
||||
#define RELATIVE_BEAT( measure, beat, tick ) \
|
||||
( ( tick ) + ( ( beat ) << 9 ) + ( ( measure ) << 16 ) )
|
||||
|
||||
//Bobby Prince thinks this may be 100
|
||||
//#define GENMIDI_DefaultVolume 100
|
||||
#define GENMIDI_DefaultVolume 90
|
||||
|
||||
#define MAX_FORMAT 1
|
||||
|
||||
#define NUM_MIDI_CHANNELS 16
|
||||
|
||||
#define TIME_PRECISION 16
|
||||
|
||||
#define MIDI_HEADER_SIGNATURE 0x6468544d // "MThd"
|
||||
#define MIDI_TRACK_SIGNATURE 0x6b72544d // "MTrk"
|
||||
|
||||
#define MIDI_VOLUME 7
|
||||
#define MIDI_PAN 10
|
||||
#define MIDI_DETUNE 94
|
||||
#define MIDI_RHYTHM_CHANNEL 9
|
||||
#define MIDI_RPN_MSB 100
|
||||
#define MIDI_RPN_LSB 101
|
||||
#define MIDI_DATAENTRY_MSB 6
|
||||
#define MIDI_DATAENTRY_LSB 38
|
||||
#define MIDI_PITCHBEND_MSB 0
|
||||
#define MIDI_PITCHBEND_LSB 0
|
||||
#define MIDI_RUNNING_STATUS 0x80
|
||||
#define MIDI_NOTE_OFF 0x8
|
||||
#define MIDI_NOTE_ON 0x9
|
||||
#define MIDI_POLY_AFTER_TCH 0xA
|
||||
#define MIDI_CONTROL_CHANGE 0xB
|
||||
#define MIDI_PROGRAM_CHANGE 0xC
|
||||
#define MIDI_AFTER_TOUCH 0xD
|
||||
#define MIDI_PITCH_BEND 0xE
|
||||
#define MIDI_SPECIAL 0xF
|
||||
#define MIDI_SYSEX 0xF0
|
||||
#define MIDI_SYSEX_CONTINUE 0xF7
|
||||
#define MIDI_META_EVENT 0xFF
|
||||
#define MIDI_END_OF_TRACK 0x2F
|
||||
#define MIDI_TEMPO_CHANGE 0x51
|
||||
#define MIDI_TIME_SIGNATURE 0x58
|
||||
#define MIDI_RESET_ALL_CONTROLLERS 0x79
|
||||
#define MIDI_ALL_NOTES_OFF 0x7b
|
||||
#define MIDI_MONO_MODE_ON 0x7E
|
||||
#define MIDI_SYSTEM_RESET 0xFF
|
||||
|
||||
#define GET_NEXT_EVENT( track, data ) do { \
|
||||
( data ) = *( track )->pos; \
|
||||
( track )->pos += 1; \
|
||||
} while (0)
|
||||
|
||||
#define GET_MIDI_CHANNEL( event ) ( ( event ) & 0xf )
|
||||
#define GET_MIDI_COMMAND( event ) ( ( event ) >> 4 )
|
||||
|
||||
#define EMIDI_INFINITE -1
|
||||
#define EMIDI_END_LOOP_VALUE 127
|
||||
#define EMIDI_ALL_CARDS 127
|
||||
#define EMIDI_INCLUDE_TRACK 110
|
||||
#define EMIDI_EXCLUDE_TRACK 111
|
||||
#define EMIDI_PROGRAM_CHANGE 112
|
||||
#define EMIDI_VOLUME_CHANGE 113
|
||||
#define EMIDI_CONTEXT_START 114
|
||||
#define EMIDI_CONTEXT_END 115
|
||||
#define EMIDI_LOOP_START 116
|
||||
#define EMIDI_LOOP_END 117
|
||||
#define EMIDI_SONG_LOOP_START 118
|
||||
#define EMIDI_SONG_LOOP_END 119
|
||||
|
||||
#define EMIDI_GeneralMIDI 0
|
||||
|
||||
#define EMIDI_AffectsCurrentCard(c, type) (((c) == EMIDI_ALL_CARDS) || ((c) == (type)))
|
||||
#define EMIDI_NUM_CONTEXTS 7
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *pos;
|
||||
char *loopstart;
|
||||
int16_t loopcount;
|
||||
int16_t RunningStatus;
|
||||
unsigned time;
|
||||
int32_t FPSecondsPerTick;
|
||||
int16_t tick;
|
||||
int16_t beat;
|
||||
int16_t measure;
|
||||
int16_t BeatsPerMeasure;
|
||||
int16_t TicksPerBeat;
|
||||
int16_t TimeBase;
|
||||
int32_t delay;
|
||||
int16_t active;
|
||||
} songcontext;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *start;
|
||||
char *pos;
|
||||
|
||||
int32_t delay;
|
||||
int16_t active;
|
||||
int16_t RunningStatus;
|
||||
|
||||
int16_t currentcontext;
|
||||
songcontext context[EMIDI_NUM_CONTEXTS];
|
||||
|
||||
char EMIDI_IncludeTrack;
|
||||
char EMIDI_ProgramChange;
|
||||
char EMIDI_VolumeChange;
|
||||
} track;
|
||||
|
||||
static int32_t _MIDI_ReadNumber(void *from, size_t size);
|
||||
static int32_t _MIDI_ReadDelta(track *ptr);
|
||||
static void _MIDI_ResetTracks(void);
|
||||
static void _MIDI_AdvanceTick(void);
|
||||
static void _MIDI_MetaEvent(track *Track);
|
||||
static void _MIDI_SysEx(track *Track);
|
||||
static int32_t _MIDI_InterpretControllerInfo(track *Track, int32_t TimeSet, int32_t channel, int32_t c1, int32_t c2);
|
||||
static int32_t _MIDI_SendControlChange(int32_t channel, int32_t c1, int32_t c2);
|
||||
static void _MIDI_SetChannelVolume(int32_t channel, int32_t volume);
|
||||
static void _MIDI_SendChannelVolumes(void);
|
||||
static void _MIDI_InitEMIDI(void);
|
||||
|
||||
#endif
|
50
source/rr/src/_rts.h
Normal file
|
@ -0,0 +1,50 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#ifndef rts_private__
|
||||
#define rts_private__
|
||||
|
||||
//===============
|
||||
// TYPES
|
||||
//===============
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[8];
|
||||
int32_t handle, position, size;
|
||||
} lumpinfo_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char identification[4]; // should be "IWAD"
|
||||
int32_t numlumps;
|
||||
int32_t infotableofs;
|
||||
} wadinfo_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int32_t filepos;
|
||||
int32_t size;
|
||||
char name[8];
|
||||
} filelump_t;
|
||||
|
||||
#endif
|
9703
source/rr/src/actors.cpp
Normal file
350
source/rr/src/actors.h
Normal file
|
@ -0,0 +1,350 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#ifndef actors_h_
|
||||
#define actors_h_
|
||||
|
||||
#include "player.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MAXSLEEPDIST 16384
|
||||
#define SLEEPTIME 1536
|
||||
#define ZOFFSET (1<<8)
|
||||
#define ZOFFSET2 (16<<8)
|
||||
#define ZOFFSET3 (8<<8)
|
||||
#define ZOFFSET4 (12<<8)
|
||||
#define ZOFFSET5 (32<<8)
|
||||
#define ZOFFSET6 (4<<8)
|
||||
|
||||
#define ACTOR_MAXFALLINGZVEL 6144
|
||||
#define ACTOR_ONWATER_ADDZ (24<<8)
|
||||
|
||||
// KEEPINSYNC lunatic/con_lang.lua
|
||||
#define STAT_DEFAULT 0
|
||||
#define STAT_ACTOR 1
|
||||
#define STAT_ZOMBIEACTOR 2
|
||||
#define STAT_EFFECTOR 3
|
||||
#define STAT_PROJECTILE 4
|
||||
#define STAT_MISC 5
|
||||
#define STAT_STANDABLE 6
|
||||
#define STAT_LOCATOR 7
|
||||
#define STAT_ACTIVATOR 8
|
||||
#define STAT_TRANSPORT 9
|
||||
#define STAT_PLAYER 10
|
||||
#define STAT_FX 11
|
||||
#define STAT_FALLER 12
|
||||
#define STAT_DUMMYPLAYER 13
|
||||
#define STAT_LIGHT 14
|
||||
#define STAT_RAROR 15
|
||||
#define STAT_NETALLOC MAXSTATUS-1
|
||||
|
||||
|
||||
// Defines the motion characteristics of an actor
|
||||
enum amoveflags_t
|
||||
{
|
||||
face_player = 1,
|
||||
geth = 2,
|
||||
getv = 4,
|
||||
random_angle = 8,
|
||||
face_player_slow = 16,
|
||||
spin = 32,
|
||||
face_player_smart = 64,
|
||||
fleeenemy = 128,
|
||||
jumptoplayer_only = 256,
|
||||
jumptoplayer_bits = 257, // NOTE: two bits set!
|
||||
seekplayer = 512,
|
||||
furthestdir = 1024,
|
||||
dodgebullet = 4096,
|
||||
justjump2 = 8192,
|
||||
windang = 16384,
|
||||
antifaceplayerslow = 32768
|
||||
};
|
||||
|
||||
// Defines for 'useractor' keyword
|
||||
enum uactortypes_t
|
||||
{
|
||||
notenemy,
|
||||
enemy,
|
||||
enemystayput
|
||||
};
|
||||
|
||||
// These macros are there to give names to the t_data[]/T*/vm.g_t[] indices
|
||||
// when used with actors. Greppability of source code is certainly a virtue.
|
||||
#define AC_COUNT(t) ((t)[0]) /* the actor's count */
|
||||
/* The ID of the actor's current move. In C-CON, the bytecode offset to the
|
||||
* move composite: */
|
||||
#define AC_MOVE_ID(t) ((t)[1])
|
||||
#define AC_ACTION_COUNT(t) ((t)[2]) /* the actor's action count */
|
||||
#define AC_CURFRAME(t) ((t)[3]) /* the actor's current frame offset */
|
||||
/* The ID of the actor's current action. In C-CON, the bytecode offset to the
|
||||
* action composite: */
|
||||
#define AC_ACTION_ID(t) ((t)[4])
|
||||
#define AC_AI_ID(t) ((t)[5]) /* the ID of the actor's current ai */
|
||||
|
||||
enum actionparams
|
||||
{
|
||||
ACTION_STARTFRAME = 0,
|
||||
ACTION_NUMFRAMES,
|
||||
ACTION_VIEWTYPE,
|
||||
ACTION_INCVAL,
|
||||
ACTION_DELAY,
|
||||
ACTION_FLAGS,
|
||||
ACTION_PARAM_COUNT,
|
||||
};
|
||||
|
||||
enum actionflags
|
||||
{
|
||||
AF_VIEWPOINT = 1u<<0u,
|
||||
};
|
||||
|
||||
// Select an actor's actiontics and movflags locations depending on
|
||||
// whether we compile the Lunatic build.
|
||||
// <spr>: sprite pointer
|
||||
// <a>: actor_t pointer
|
||||
# define AC_ACTIONTICS(spr, a) ((spr)->lotag)
|
||||
# define AC_MOVFLAGS(spr, a) ((spr)->hitag)
|
||||
|
||||
// (+ 40 16 16 4 8 6 8 6 4 20)
|
||||
#pragma pack(push, 1)
|
||||
typedef struct
|
||||
{
|
||||
int32_t t_data[10]; // 40b sometimes used to hold offsets to con code
|
||||
|
||||
int32_t flags; // 4b
|
||||
vec3_t bpos; // 12b
|
||||
int32_t floorz, ceilingz; // 8b
|
||||
vec2_t lastv; // 8b
|
||||
int16_t picnum, ang, extra, owner; // 8b
|
||||
int16_t movflag, tempang, timetosleep; // 6b
|
||||
int16_t actorstayput; // 2b
|
||||
|
||||
uint8_t cgg, lasttransport; // 2b
|
||||
// NOTE: 'dispicnum' is updated every frame, not in sync with game tics!
|
||||
int16_t dispicnum; // 2b
|
||||
|
||||
#ifdef POLYMER
|
||||
int16_t lightId, lightmaxrange; // 4b
|
||||
_prlight *lightptr; // 4b/8b aligned on 96 bytes
|
||||
uint8_t lightcount, filler[3];
|
||||
#endif
|
||||
} actor_t;
|
||||
|
||||
// this struct needs to match the beginning of actor_t above
|
||||
typedef struct
|
||||
{
|
||||
int32_t t_data[10]; // 40b sometimes used to hold offsets to con code
|
||||
|
||||
int32_t flags; // 4b
|
||||
vec3_t bpos; // 12b
|
||||
int32_t floorz, ceilingz; // 8b
|
||||
vec2_t lastv; // 8b
|
||||
int16_t picnum, ang, extra, owner; // 8b
|
||||
int16_t movflag, tempang, timetosleep; // 6b
|
||||
int16_t actorstayput;
|
||||
|
||||
uint8_t cgg, lasttransport;
|
||||
|
||||
spritetype sprite;
|
||||
int16_t netIndex;
|
||||
} netactor_t;
|
||||
#pragma pack(pop)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
intptr_t *execPtr; // pointer to CON script for this tile, formerly actorscrptr
|
||||
intptr_t *loadPtr; // pointer to load time CON script, formerly actorLoadEventScrPtr or something
|
||||
projectile_t *proj;
|
||||
projectile_t *defproj;
|
||||
uint32_t flags; // formerly SpriteFlags, ActorType
|
||||
int32_t cacherange; // formerly SpriteCache
|
||||
} tiledata_t;
|
||||
|
||||
|
||||
// KEEPINSYNC lunatic/con_lang.lua
|
||||
enum sflags_t
|
||||
{
|
||||
SFLAG_SHADOW = 0x00000001,
|
||||
SFLAG_NVG = 0x00000002,
|
||||
SFLAG_NOSHADE = 0x00000004,
|
||||
SFLAG_PROJECTILE = 0x00000008,
|
||||
SFLAG_DECAL = 0x00000010,
|
||||
SFLAG_BADGUY = 0x00000020,
|
||||
SFLAG_NOPAL = 0x00000040,
|
||||
SFLAG_NOEVENTCODE = 0x00000080,
|
||||
SFLAG_NOLIGHT = 0x00000100,
|
||||
SFLAG_USEACTIVATOR = 0x00000200,
|
||||
SFLAG_NULL = 0x00000400, // null sprite in multiplayer
|
||||
SFLAG_NOCLIP = 0x00000800, // clipmove it with cliptype 0
|
||||
SFLAG_NOFLOORSHADOW = 0x00001000, // for temp. internal use, per-tile flag not checked
|
||||
SFLAG_SMOOTHMOVE = 0x00002000,
|
||||
SFLAG_NOTELEPORT = 0x00004000,
|
||||
SFLAG_BADGUYSTAYPUT = 0x00008000,
|
||||
SFLAG_CACHE = 0x00010000,
|
||||
// rotation-fixed wrt a pivot point to prevent position diverging due to
|
||||
// roundoff error accumulation:
|
||||
SFLAG_ROTFIXED = 0x00020000,
|
||||
SFLAG_HARDCODED_BADGUY = 0x00040000,
|
||||
SFLAG_DIDNOSE7WATER = 0x00080000, // used temporarily
|
||||
SFLAG_NODAMAGEPUSH = 0x00100000,
|
||||
SFLAG_NOWATERDIP = 0x00200000,
|
||||
SFLAG_HURTSPAWNBLOOD = 0x00400000,
|
||||
SFLAG_GREENSLIMEFOOD = 0x00800000,
|
||||
SFLAG_REALCLIPDIST = 0x01000000,
|
||||
SFLAG_WAKEUPBADGUYS = 0x02000000,
|
||||
SFLAG_DAMAGEEVENT = 0x04000000,
|
||||
SFLAG_BADGUY_TILE = 0x08000000,
|
||||
SFLAG_KILLCOUNT = 0x10000000,
|
||||
SFLAG_NOCANSEECHECK = 0x20000000,
|
||||
};
|
||||
|
||||
// Custom projectiles "workslike" flags.
|
||||
// XXX: Currently not predefined from CON.
|
||||
enum pflags_t
|
||||
{
|
||||
PROJECTILE_HITSCAN = 0x00000001,
|
||||
PROJECTILE_RPG = 0x00000002,
|
||||
PROJECTILE_BOUNCESOFFWALLS = 0x00000004,
|
||||
PROJECTILE_BOUNCESOFFMIRRORS = 0x00000008,
|
||||
PROJECTILE_KNEE = 0x00000010,
|
||||
PROJECTILE_WATERBUBBLES = 0x00000020,
|
||||
PROJECTILE_TIMED = 0x00000040,
|
||||
PROJECTILE_BOUNCESOFFSPRITES = 0x00000080,
|
||||
PROJECTILE_SPIT = 0x00000100,
|
||||
PROJECTILE_COOLEXPLOSION1 = 0x00000200,
|
||||
PROJECTILE_BLOOD = 0x00000400,
|
||||
PROJECTILE_LOSESVELOCITY = 0x00000800,
|
||||
PROJECTILE_NOAIM = 0x00001000,
|
||||
PROJECTILE_RANDDECALSIZE = 0x00002000,
|
||||
PROJECTILE_EXPLODEONTIMER = 0x00004000,
|
||||
PROJECTILE_RPG_IMPACT = 0x00008000,
|
||||
PROJECTILE_RADIUS_PICNUM = 0x00010000,
|
||||
PROJECTILE_ACCURATE_AUTOAIM = 0x00020000,
|
||||
PROJECTILE_FORCEIMPACT = 0x00040000,
|
||||
PROJECTILE_REALCLIPDIST = 0x00080000,
|
||||
PROJECTILE_ACCURATE = 0x00100000,
|
||||
PROJECTILE_NOSETOWNERSHADE = 0x00200000,
|
||||
PROJECTILE_RPG_IMPACT_DAMAGE = 0x00400000,
|
||||
PROJECTILE_MOVED = 0x80000000, // internal flag, do not document
|
||||
PROJECTILE_TYPE_MASK = PROJECTILE_HITSCAN | PROJECTILE_RPG | PROJECTILE_KNEE | PROJECTILE_BLOOD,
|
||||
};
|
||||
|
||||
extern tiledata_t g_tile[MAXTILES];
|
||||
extern actor_t actor[MAXSPRITES];
|
||||
extern int32_t block_deletesprite;
|
||||
extern int32_t g_noEnemies;
|
||||
extern int32_t otherp;
|
||||
extern int32_t ticrandomseed;
|
||||
extern int g_canSeePlayer;
|
||||
|
||||
|
||||
int A_CheckNoSE7Water(uspritetype const *pSprite, int sectNum, int sectLotag, int32_t *pOther);
|
||||
int A_CheckSwitchTile(int spriteNum);
|
||||
int A_IncurDamage(int spriteNum);
|
||||
void A_AddToDeleteQueue(int spriteNum);
|
||||
void A_DeleteSprite(int spriteNum);
|
||||
void A_DoGuts(int spriteNum, int tileNum, int spawnCnt);
|
||||
void A_DoGutsDir(int spriteNum, int tileNum, int spawnCnt);
|
||||
void A_MoveCyclers(void);
|
||||
void A_MoveDummyPlayers(void);
|
||||
void A_MoveSector(int spriteNum);
|
||||
void A_PlayAlertSound(int spriteNum);
|
||||
void A_RadiusDamage(int spriteNum, int blastRadius, int dmg1, int dmg2, int dmg3, int dmg4);
|
||||
void A_SpawnMultiple(int spriteNum, int tileNum, int spawnCnt);
|
||||
void A_ResetLanePics(void);
|
||||
|
||||
int G_SetInterpolation(int32_t *posptr);
|
||||
void G_AddGameLight(int lightRadius, int spriteNum, int zOffset, int lightRange, int lightColor, int lightPrio);
|
||||
void G_ClearCameraView(DukePlayer_t *ps);
|
||||
void G_DoInterpolations(int smoothRatio);
|
||||
void G_MoveWorld(void);
|
||||
void G_RefreshLights(void);
|
||||
void G_StopInterpolation(const int32_t *posptr);
|
||||
|
||||
// PK 20110701: changed input argument: int32_t i (== sprite, whose sectnum...) --> sectnum directly
|
||||
void Sect_ToggleInterpolation(int sectnum, int setInterpolation);
|
||||
static FORCE_INLINE void Sect_ClearInterpolation(int sectnum) { Sect_ToggleInterpolation(sectnum, 0); }
|
||||
static FORCE_INLINE void Sect_SetInterpolation(int sectnum) { Sect_ToggleInterpolation(sectnum, 1); }
|
||||
|
||||
#if KRANDDEBUG
|
||||
# define ACTOR_INLINE __fastcall
|
||||
# define ACTOR_INLINE_HEADER extern __fastcall
|
||||
#else
|
||||
# define ACTOR_INLINE EXTERN_INLINE
|
||||
# define ACTOR_INLINE_HEADER EXTERN_INLINE_HEADER
|
||||
#endif
|
||||
|
||||
extern int32_t A_MoveSprite(int32_t spritenum, vec3_t const * change, uint32_t cliptype);
|
||||
ACTOR_INLINE_HEADER int A_CheckEnemyTile(int tileNum);
|
||||
ACTOR_INLINE_HEADER int A_SetSprite(int spriteNum, uint32_t cliptype);
|
||||
|
||||
EXTERN_INLINE_HEADER int G_CheckForSpaceCeiling(int sectnum);
|
||||
EXTERN_INLINE_HEADER int G_CheckForSpaceFloor(int sectnum);
|
||||
|
||||
EXTERN_INLINE_HEADER int A_CheckEnemySprite(void const * s);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined actors_c_ || !defined DISABLE_INLINING
|
||||
|
||||
# if !KRANDDEBUG || (KRANDDEBUG && defined actors_c_)
|
||||
|
||||
ACTOR_INLINE int A_CheckEnemyTile(int const tileNum)
|
||||
{
|
||||
return ((g_tile[tileNum].flags & (SFLAG_BADGUY_TILE | SFLAG_BADGUY)) != 0);
|
||||
}
|
||||
|
||||
ACTOR_INLINE int A_SetSprite(int const spriteNum, uint32_t cliptype)
|
||||
{
|
||||
vec3_t davect = { (sprite[spriteNum].xvel * (sintable[(sprite[spriteNum].ang + 512) & 2047])) >> 14,
|
||||
(sprite[spriteNum].xvel * (sintable[sprite[spriteNum].ang & 2047])) >> 14, sprite[spriteNum].zvel };
|
||||
return (A_MoveSprite(spriteNum, &davect, cliptype) == 0);
|
||||
}
|
||||
|
||||
# endif
|
||||
|
||||
# include "namesdyn.h"
|
||||
|
||||
EXTERN_INLINE int G_CheckForSpaceCeiling(int const sectnum)
|
||||
{
|
||||
return ((sector[sectnum].ceilingstat&1) && sector[sectnum].ceilingpal == 0 &&
|
||||
(sector[sectnum].ceilingpicnum==MOONSKY1 || sector[sectnum].ceilingpicnum==BIGORBIT1));
|
||||
}
|
||||
|
||||
EXTERN_INLINE int G_CheckForSpaceFloor(int const sectnum)
|
||||
{
|
||||
return ((sector[sectnum].floorstat&1) && sector[sectnum].ceilingpal == 0 &&
|
||||
(sector[sectnum].floorpicnum==MOONSKY1 || sector[sectnum].floorpicnum==BIGORBIT1));
|
||||
}
|
||||
|
||||
EXTERN_INLINE int A_CheckEnemySprite(void const * const pSprite)
|
||||
{
|
||||
return A_CheckEnemyTile(((uspritetype const *) pSprite)->picnum);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
44
source/rr/src/android.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#ifndef android_h_
|
||||
#define android_h_
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include "compat.h"
|
||||
#include "control.h"
|
||||
#include "in_android.h"
|
||||
|
||||
//extern int android_sample_rate;
|
||||
|
||||
//extern int android_audio_buffer_size;
|
||||
|
||||
|
||||
extern void CONTROL_Android_ClearButton(int32_t whichbutton);
|
||||
extern void CONTROL_Android_PollDevices(ControlInfo *info);
|
||||
extern void CONTROL_Android_SetLastWeapon(int w);
|
||||
|
||||
extern void CONTROL_Android_ScrollMap(int32_t *angle,int32_t *x, int32_t *y, uint16_t *zoom );
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
598
source/rr/src/anim.cpp
Normal file
|
@ -0,0 +1,598 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#include "baselayer.h"
|
||||
#include "renderlayer.h"
|
||||
#include "duke3d.h"
|
||||
#include "animlib.h"
|
||||
#include "mouse.h"
|
||||
#include "compat.h"
|
||||
#include "input.h"
|
||||
|
||||
#include "anim.h"
|
||||
|
||||
#ifdef USE_LIBVPX
|
||||
# include "animvpx.h"
|
||||
#endif
|
||||
|
||||
// animsound_t.sound
|
||||
EDUKE32_STATIC_ASSERT(INT16_MAX >= MAXSOUNDS);
|
||||
|
||||
hashtable_t h_dukeanim = { 8, NULL };
|
||||
dukeanim_t * g_animPtr;
|
||||
|
||||
dukeanim_t *Anim_Find(const char *s)
|
||||
{
|
||||
intptr_t ptr = hash_findcase(&h_dukeanim, s);
|
||||
|
||||
if (ptr == -1)
|
||||
{
|
||||
int const siz = Bstrlen(s) + 5;
|
||||
char * const str = (char *)Xcalloc(1, siz);
|
||||
|
||||
maybe_append_ext(str, siz, s, ".anm");
|
||||
ptr = hash_findcase(&h_dukeanim, str);
|
||||
|
||||
if (ptr == -1)
|
||||
{
|
||||
maybe_append_ext(str, siz, s, ".ivf");
|
||||
ptr = hash_findcase(&h_dukeanim, str);
|
||||
}
|
||||
|
||||
Bfree(str);
|
||||
}
|
||||
|
||||
return (dukeanim_t *)(ptr == -1 ? NULL : (dukeanim_t *)ptr);
|
||||
}
|
||||
|
||||
dukeanim_t * Anim_Create(char const * fn)
|
||||
{
|
||||
dukeanim_t * anim = (dukeanim_t *)Xcalloc(1, sizeof(dukeanim_t));
|
||||
|
||||
hash_add(&h_dukeanim, fn, (intptr_t)anim, 0);
|
||||
|
||||
return anim;
|
||||
}
|
||||
|
||||
#ifdef DYNSOUNDREMAP_ENABLE
|
||||
static int32_t const StopAllSounds = -1;
|
||||
#else
|
||||
# define StopAllSounds -1
|
||||
#endif
|
||||
|
||||
void Anim_Init(void)
|
||||
{
|
||||
hash_init(&h_dukeanim);
|
||||
|
||||
|
||||
struct defaultanmsound {
|
||||
#ifdef DYNSOUNDREMAP_ENABLE
|
||||
int32_t const & sound;
|
||||
#else
|
||||
int16_t sound;
|
||||
#endif
|
||||
uint8_t frame;
|
||||
};
|
||||
|
||||
static defaultanmsound const logo[] =
|
||||
{
|
||||
{ FLY_BY, 1 },
|
||||
{ PIPEBOMB_EXPLODE, 19 },
|
||||
};
|
||||
|
||||
static defaultanmsound const cineov2[] =
|
||||
{
|
||||
{ WIND_AMBIENCE, 1 },
|
||||
{ ENDSEQVOL2SND1, 26 },
|
||||
{ ENDSEQVOL2SND2, 36 },
|
||||
{ THUD, 54 },
|
||||
{ ENDSEQVOL2SND3, 62 },
|
||||
{ ENDSEQVOL2SND4, 75 },
|
||||
{ ENDSEQVOL2SND5, 81 },
|
||||
{ ENDSEQVOL2SND6, 115 },
|
||||
{ ENDSEQVOL2SND7, 124 },
|
||||
};
|
||||
|
||||
static defaultanmsound const cineov3[] =
|
||||
{
|
||||
{ WIND_REPEAT, 1 },
|
||||
{ DUKE_GRUNT, 98 },
|
||||
{ THUD, 82+20 },
|
||||
{ SQUISHED, 82+20 },
|
||||
{ ENDSEQVOL3SND3, 104+20 },
|
||||
{ ENDSEQVOL3SND2, 114+20 },
|
||||
{ PIPEBOMB_EXPLODE, 158 },
|
||||
};
|
||||
|
||||
static defaultanmsound const vol42a[] =
|
||||
{
|
||||
{ INTRO4_B, 1 },
|
||||
{ SHORT_CIRCUIT, 12 },
|
||||
{ INTRO4_5, 18 },
|
||||
{ SHORT_CIRCUIT, 34 },
|
||||
};
|
||||
|
||||
static defaultanmsound const vol41a[] =
|
||||
{
|
||||
{ INTRO4_1, 1 },
|
||||
{ INTRO4_3, 7 },
|
||||
{ INTRO4_2, 12 },
|
||||
{ INTRO4_4, 26 },
|
||||
};
|
||||
|
||||
static defaultanmsound const vol43a[] =
|
||||
{
|
||||
{ INTRO4_6, 10 },
|
||||
};
|
||||
|
||||
static defaultanmsound const vol4e1[] =
|
||||
{
|
||||
{ DUKE_UNDERWATER, 3 },
|
||||
{ VOL4ENDSND1, 35 },
|
||||
};
|
||||
|
||||
static defaultanmsound const vol4e2[] =
|
||||
{
|
||||
{ DUKE_UNDERWATER, 11 },
|
||||
{ VOL4ENDSND1, 20 },
|
||||
{ VOL4ENDSND2, 39 },
|
||||
{ StopAllSounds, 50 },
|
||||
};
|
||||
|
||||
static defaultanmsound const vol4e3[] =
|
||||
{
|
||||
{ BOSS4_DEADSPEECH, 1 },
|
||||
{ VOL4ENDSND1, 40 },
|
||||
{ DUKE_UNDERWATER, 40 },
|
||||
{ BIGBANG, 50 },
|
||||
};
|
||||
|
||||
static defaultanmsound const rr_intro[] =
|
||||
{
|
||||
{ 29, 1 },
|
||||
};
|
||||
|
||||
static defaultanmsound const redneck[] =
|
||||
{
|
||||
{ 478, 1 },
|
||||
};
|
||||
|
||||
static defaultanmsound const xatlogo[] =
|
||||
{
|
||||
{ 479, 1 },
|
||||
};
|
||||
|
||||
static defaultanmsound const turdmov[] =
|
||||
{
|
||||
{ 82, 1 },
|
||||
};
|
||||
|
||||
static defaultanmsound const rr_outro[] =
|
||||
{
|
||||
{ 35, 1 },
|
||||
};
|
||||
|
||||
struct defaultanm {
|
||||
char const *fn;
|
||||
defaultanmsound const *sounds;
|
||||
uint8_t numsounds;
|
||||
uint8_t fdelay;
|
||||
};
|
||||
|
||||
#define anmsnd(x) (x), ARRAY_SIZE(x)
|
||||
static defaultanm const anms[] =
|
||||
{
|
||||
{ "logo.anm", anmsnd(logo), 9 },
|
||||
{ "3dr.anm", NULL, 0, 10 },
|
||||
{ "vol4e1.anm", anmsnd(vol4e1), 10 },
|
||||
{ "vol4e2.anm", anmsnd(vol4e2), 14 },
|
||||
{ "vol4e3.anm", anmsnd(vol4e3), 10 },
|
||||
{ "vol41a.anm", anmsnd(vol41a), 14 },
|
||||
{ "vol42a.anm", anmsnd(vol42a), 18 },
|
||||
{ "vol43a.anm", anmsnd(vol43a), 10 },
|
||||
{ "duketeam.anm", NULL, 0, 10 },
|
||||
{ "radlogo.anm", NULL, 0, 10 },
|
||||
{ "cineov2.anm", anmsnd(cineov2), 18 },
|
||||
{ "cineov3.anm", anmsnd(cineov3), 10 },
|
||||
{ "rr_intro.anm", anmsnd(rr_intro), 9 },
|
||||
{ "redneck.anm", anmsnd(redneck), 9 },
|
||||
{ "xatlogo.anm", anmsnd(xatlogo), 9 },
|
||||
{ "turdmov.anm", anmsnd(turdmov), 9 },
|
||||
{ "rr_outro.anm", anmsnd(rr_outro), 9 },
|
||||
{ "lvl1.anm", NULL, 0, 20 },
|
||||
{ "lvl2.anm", NULL, 0, 20 },
|
||||
{ "lvl3.anm", NULL, 0, 20 },
|
||||
{ "lvl4.anm", NULL, 0, 20 },
|
||||
{ "lvl5.anm", NULL, 0, 20 },
|
||||
{ "lvl6.anm", NULL, 0, 20 },
|
||||
{ "lvl7.anm", NULL, 0, 20 },
|
||||
{ "lvl8.anm", NULL, 0, 20 },
|
||||
{ "lvl9.anm", NULL, 0, 20 },
|
||||
{ "lvl10.anm", NULL, 0, 20 },
|
||||
{ "lvl11.anm", NULL, 0, 20 },
|
||||
{ "lvl12.anm", NULL, 0, 20 },
|
||||
{ "lvl13.anm", NULL, 0, 20 },
|
||||
};
|
||||
#undef anmsnd
|
||||
|
||||
for (defaultanm const & anm : anms)
|
||||
{
|
||||
dukeanim_t * anim = Anim_Create(anm.fn);
|
||||
anim->framedelay = anm.fdelay;
|
||||
|
||||
if (anm.numsounds)
|
||||
{
|
||||
anim->sounds = (animsound_t *)Xmalloc(anm.numsounds * sizeof(animsound_t));
|
||||
size_t const numsounds = anm.numsounds;
|
||||
for (size_t i = 0; i < numsounds; ++i)
|
||||
{
|
||||
defaultanmsound const & src = anm.sounds[i];
|
||||
animsound_t & dst = anim->sounds[i];
|
||||
|
||||
dst.sound = src.sound;
|
||||
dst.frame = src.frame;
|
||||
}
|
||||
anim->numsounds = numsounds;
|
||||
}
|
||||
|
||||
anim->frameflags = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t Anim_Play(const char *fn)
|
||||
{
|
||||
dukeanim_t *anim = Anim_Find(fn);
|
||||
|
||||
if (!anim)
|
||||
{
|
||||
OSD_Printf("Animation %s is undefined!\n", fn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t soundidx = 0; // custom anim sounds
|
||||
int32_t running = 1, i;
|
||||
|
||||
I_ClearAllInput();
|
||||
|
||||
#ifdef USE_LIBVPX
|
||||
uint16_t framenum = 0;
|
||||
while (videoGetRenderMode() >= REND_POLYMOST) // if, really
|
||||
{
|
||||
char const * dot = Bstrrchr(fn, '.');
|
||||
if (!dot)
|
||||
break;
|
||||
|
||||
dukeanim_t const * origanim = anim;
|
||||
int32_t handle = -1;
|
||||
if (!Bstrcmp(dot, ".ivf"))
|
||||
{
|
||||
handle = kopen4loadfrommod(fn, 0);
|
||||
if (handle == -1)
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
char vpxfn[BMAX_PATH];
|
||||
Bstrncpyz(vpxfn, fn, BMAX_PATH);
|
||||
|
||||
ptrdiff_t dotpos = dot - fn;
|
||||
if (dotpos + 4 >= BMAX_PATH)
|
||||
break;
|
||||
|
||||
char *vpxfndot = vpxfn + dotpos;
|
||||
vpxfndot[1] = 'i';
|
||||
vpxfndot[2] = 'v';
|
||||
vpxfndot[3] = 'f';
|
||||
vpxfndot[4] = '\0';
|
||||
|
||||
handle = kopen4loadfrommod(vpxfn, 0);
|
||||
if (handle == -1)
|
||||
break;
|
||||
|
||||
anim = Anim_Find(vpxfn);
|
||||
}
|
||||
|
||||
animvpx_ivf_header_t info;
|
||||
i = animvpx_read_ivf_header(handle, &info);
|
||||
|
||||
if (i)
|
||||
{
|
||||
OSD_Printf("Failed reading IVF file: %s\n", animvpx_read_ivf_header_errmsg[i]);
|
||||
kclose(handle);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (anim)
|
||||
animvpx_setup_glstate(anim->frameflags);
|
||||
else
|
||||
animvpx_setup_glstate(origanim->frameflags);
|
||||
|
||||
animvpx_codec_ctx codec;
|
||||
|
||||
if (animvpx_init_codec(&info, handle, &codec))
|
||||
{
|
||||
OSD_Printf("Error initializing VPX codec.\n");
|
||||
animvpx_restore_glstate();
|
||||
kclose(handle);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
uint32_t const convnumer = 120 * info.fpsdenom;
|
||||
uint32_t const convdenom = info.fpsnumer * origanim->framedelay;
|
||||
|
||||
uint32_t const msecsperframe = scale(info.fpsdenom, 1000, info.fpsnumer);
|
||||
uint32_t nextframetime = timerGetTicks();
|
||||
uint8_t *pic;
|
||||
|
||||
// OSD_Printf("msecs per frame: %d\n", msecsperframe);
|
||||
|
||||
do
|
||||
{
|
||||
nextframetime += msecsperframe;
|
||||
|
||||
i = animvpx_nextpic(&codec, &pic);
|
||||
if (i)
|
||||
{
|
||||
OSD_Printf("Failed getting next pic: %s\n", animvpx_nextpic_errmsg[i]);
|
||||
if (codec.errmsg)
|
||||
{
|
||||
OSD_Printf(" %s\n", codec.errmsg);
|
||||
if (codec.errmsg_detail)
|
||||
OSD_Printf(" detail: %s\n", codec.errmsg_detail);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!pic)
|
||||
break; // no more pics!
|
||||
|
||||
videoClearScreen(0);
|
||||
|
||||
ototalclock = totalclock + 1; // pause game like ANMs
|
||||
|
||||
if (anim)
|
||||
{
|
||||
if (anim->frameaspect1 == 0 || anim->frameaspect2 == 0)
|
||||
animvpx_render_frame(&codec, 0);
|
||||
else
|
||||
animvpx_render_frame(&codec, anim->frameaspect1 / anim->frameaspect2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (origanim->frameaspect1 == 0 || origanim->frameaspect2 == 0)
|
||||
animvpx_render_frame(&codec, 0);
|
||||
else
|
||||
animvpx_render_frame(&codec, origanim->frameaspect1 / origanim->frameaspect2);
|
||||
}
|
||||
|
||||
// after rendering the frame but before displaying: maybe play sound...
|
||||
framenum++;
|
||||
if (anim)
|
||||
{
|
||||
while (soundidx < anim->numsounds && anim->sounds[soundidx].frame <= framenum)
|
||||
{
|
||||
int16_t sound = anim->sounds[soundidx].sound;
|
||||
if (sound == -1)
|
||||
FX_StopAllSounds();
|
||||
else
|
||||
S_PlaySound(sound);
|
||||
|
||||
soundidx++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uint16_t convframenum = scale(framenum, convnumer, convdenom);
|
||||
while (soundidx < origanim->numsounds && origanim->sounds[soundidx].frame <= convframenum)
|
||||
{
|
||||
int16_t sound = origanim->sounds[soundidx].sound;
|
||||
if (sound == -1)
|
||||
FX_StopAllSounds();
|
||||
else
|
||||
S_PlaySound(sound);
|
||||
|
||||
soundidx++;
|
||||
}
|
||||
}
|
||||
|
||||
// this and showframe() instead of nextpage() are so that
|
||||
// nobody tramples on our carefully set up GL state!
|
||||
palfadedelta = 0;
|
||||
videoShowFrame(0);
|
||||
|
||||
// I_ClearAllInput();
|
||||
|
||||
do
|
||||
{
|
||||
G_HandleAsync();
|
||||
|
||||
if (I_CheckAllInput())
|
||||
{
|
||||
running = 0;
|
||||
break;
|
||||
}
|
||||
} while (timerGetTicks() < nextframetime);
|
||||
} while (running);
|
||||
|
||||
animvpx_print_stats(&codec);
|
||||
|
||||
//
|
||||
kclose(handle);
|
||||
animvpx_restore_glstate();
|
||||
animvpx_uninit_codec(&codec);
|
||||
|
||||
I_ClearAllInput();
|
||||
return !running; // done with playing VP8!
|
||||
}
|
||||
#endif
|
||||
// ANM playback --- v v v ---
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
int32_t ogltexfiltermode = gltexfiltermode;
|
||||
#endif
|
||||
int32_t handle = kopen4load(fn, 0);
|
||||
|
||||
if (handle == -1)
|
||||
return 0;
|
||||
|
||||
int32_t length = kfilelength(handle);
|
||||
|
||||
if (length <= 4)
|
||||
{
|
||||
OSD_Printf("Warning: skipping playback of empty ANM file \"%s\".\n", fn);
|
||||
goto end_anim;
|
||||
}
|
||||
|
||||
walock[TILE_ANIM] = 219;
|
||||
anim->animlock = 1;
|
||||
|
||||
if (!anim->animbuf)
|
||||
cacheAllocateBlock((intptr_t *)&anim->animbuf, length + 1, &anim->animlock);
|
||||
|
||||
tilesiz[TILE_ANIM].x = 200;
|
||||
tilesiz[TILE_ANIM].y = 320;
|
||||
|
||||
kread(handle, anim->animbuf, length);
|
||||
kclose(handle);
|
||||
|
||||
uint32_t firstfour;
|
||||
Bmemcpy(&firstfour, anim->animbuf, 4);
|
||||
|
||||
// "DKIF" (.ivf)
|
||||
if (firstfour == B_LITTLE32(0x46494B44))
|
||||
goto end_anim;
|
||||
|
||||
int32_t numframes;
|
||||
|
||||
// "LPF " (.anm)
|
||||
if (firstfour != B_LITTLE32(0x2046504C) ||
|
||||
ANIM_LoadAnim(anim->animbuf, length) < 0 ||
|
||||
(numframes = ANIM_NumFrames()) <= 0)
|
||||
{
|
||||
// XXX: ANM_LoadAnim() still checks less than the bare minimum,
|
||||
// e.g. ANM file could still be too small and not contain any frames.
|
||||
OSD_Printf("Error: malformed ANM file \"%s\".\n", fn);
|
||||
goto end_anim;
|
||||
}
|
||||
|
||||
paletteSetColorTable(ANIMPAL, ANIM_GetPalette());
|
||||
|
||||
// setpalette(0L,256L,tempbuf);
|
||||
// setbrightness(ud.brightness>>2,tempbuf,2);
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, ANIMPAL, 8 + 2);
|
||||
|
||||
timerUpdate();
|
||||
ototalclock = totalclock;
|
||||
|
||||
i = 1;
|
||||
int32_t frametime; frametime = 0;
|
||||
|
||||
do
|
||||
{
|
||||
if (i > 4 && totalclock > frametime + 60)
|
||||
{
|
||||
OSD_Printf("WARNING: slowdown in %s, skipping playback\n", fn);
|
||||
goto end_anim_restore_gl;
|
||||
}
|
||||
|
||||
G_HandleAsync();
|
||||
|
||||
if (totalclock < ototalclock - 1)
|
||||
continue;
|
||||
|
||||
waloff[TILE_ANIM] = (intptr_t)ANIM_DrawFrame(i);
|
||||
tileInvalidate(TILE_ANIM, 0, 1 << 4); // JBF 20031228
|
||||
|
||||
if (I_CheckAllInput())
|
||||
{
|
||||
running = 0;
|
||||
goto end_anim_restore_gl;
|
||||
}
|
||||
|
||||
if (g_restorePalette == 1)
|
||||
{
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, ANIMPAL, 0);
|
||||
g_restorePalette = 0;
|
||||
}
|
||||
|
||||
frametime = totalclock;
|
||||
|
||||
videoClearScreen(0);
|
||||
|
||||
int32_t z;
|
||||
if (anim->frameaspect1 > 0 && anim->frameaspect2 > 0 && ((anim->frameaspect1 / anim->frameaspect2) != (tilesiz[TILE_ANIM].y / (tilesiz[TILE_ANIM].x * 1.2))))
|
||||
{
|
||||
int32_t const oyxaspect = yxaspect;
|
||||
if ((anim->frameaspect1 / anim->frameaspect2) >= ((decltype(anim->frameaspect1))xdim / ydim))
|
||||
z = divscale16(320, tilesiz[TILE_ANIM].y);
|
||||
else
|
||||
z = divscale16(lrint(320 * ydim * anim->frameaspect1), lrint(tilesiz[TILE_ANIM].y * xdim * anim->frameaspect2));
|
||||
int32_t aspect = divscale16(lrint(tilesiz[TILE_ANIM].y * anim->frameaspect2), lrint(tilesiz[TILE_ANIM].x * anim->frameaspect1));
|
||||
renderSetAspect(viewingrange, aspect);
|
||||
rotatesprite_fs(160<<16, 100<<16, z, 512, TILE_ANIM, 0, 0, 2|4|8|64|1024);
|
||||
renderSetAspect(viewingrange, oyxaspect);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((tilesiz[TILE_ANIM].y / (tilesiz[TILE_ANIM].x * 1.2f)) > (1.f * xdim / ydim))
|
||||
z = divscale16(320 * xdim * 3, tilesiz[TILE_ANIM].y * ydim * 4);
|
||||
else
|
||||
z = divscale16(200, tilesiz[TILE_ANIM].x);
|
||||
rotatesprite_fs(160<<16, 100<<16, z, 512, TILE_ANIM, 0, 0, 2|4|8|64);
|
||||
}
|
||||
|
||||
g_animPtr = NULL;
|
||||
|
||||
videoNextPage();
|
||||
|
||||
I_ClearAllInput();
|
||||
|
||||
ototalclock += anim->framedelay;
|
||||
|
||||
while (soundidx < anim->numsounds && anim->sounds[soundidx].frame <= (uint16_t)i)
|
||||
{
|
||||
int16_t sound = anim->sounds[soundidx].sound;
|
||||
if (sound == -1)
|
||||
FX_StopAllSounds();
|
||||
else
|
||||
S_PlaySound(sound);
|
||||
|
||||
soundidx++;
|
||||
}
|
||||
|
||||
++i;
|
||||
} while (i < numframes);
|
||||
|
||||
end_anim_restore_gl:
|
||||
#ifdef USE_OPENGL
|
||||
gltexfiltermode = ogltexfiltermode;
|
||||
gltexapplyprops();
|
||||
#endif
|
||||
end_anim:
|
||||
I_ClearAllInput();
|
||||
ANIM_FreeAnim();
|
||||
walock[TILE_ANIM] = 1;
|
||||
anim->animlock = 0;
|
||||
|
||||
return !running;
|
||||
}
|
49
source/rr/src/anim.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#ifndef anim_h_
|
||||
#define anim_h_
|
||||
|
||||
typedef struct {
|
||||
uint16_t frame;
|
||||
int16_t sound;
|
||||
} animsound_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double frameaspect1, frameaspect2;
|
||||
uint8_t* animbuf;
|
||||
animsound_t *sounds;
|
||||
uint16_t numsounds;
|
||||
uint8_t framedelay;
|
||||
uint8_t frameflags;
|
||||
char animlock;
|
||||
} dukeanim_t;
|
||||
|
||||
extern dukeanim_t * g_animPtr;
|
||||
extern hashtable_t h_dukeanim;
|
||||
extern dukeanim_t * Anim_Find(const char *s);
|
||||
extern dukeanim_t * Anim_Create(const char *fn);
|
||||
int32_t Anim_Play(const char *fn);
|
||||
void Anim_Init(void);
|
||||
|
||||
#endif
|
860
source/rr/src/cheats.cpp
Normal file
|
@ -0,0 +1,860 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2016 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#include "duke3d.h"
|
||||
#include "osdcmds.h"
|
||||
#include "cheats.h"
|
||||
|
||||
// KEEPINSYNC game.h: enum cheatindex_t
|
||||
char CheatStrings [NUMCHEATS][MAXCHEATLEN] =
|
||||
{
|
||||
"cornholio", // 0
|
||||
"stuff", // 1
|
||||
"scotty###", // 2
|
||||
"coords", // 3
|
||||
"view", // 4
|
||||
"time", // 5
|
||||
"unlock", // 6
|
||||
"cashman", // 7
|
||||
"items", // 8
|
||||
"rate", // 9
|
||||
"skill#", // 10
|
||||
"beta", // 11
|
||||
"hyper", // 12
|
||||
"monsters", // 13
|
||||
"<RESERVED>", // 14
|
||||
"<RESERVED>", // 15
|
||||
"todd", // 16
|
||||
"showmap", // 17
|
||||
"kroz", // 18
|
||||
"allen", // 19
|
||||
"clip", // 20
|
||||
"weapons", // 21
|
||||
"inventory", // 22
|
||||
"keys", // 23
|
||||
"debug", // 24
|
||||
"<RESERVED>", // 25
|
||||
"<RESERVED>", // 26
|
||||
"<RESERVED>", // 27
|
||||
"<RESERVED>", // 28
|
||||
"<RESERVED>", // 29
|
||||
"<RESERVED>", // 30
|
||||
"<RESERVED>", // 31
|
||||
"<RESERVED>", // 32
|
||||
"<RESERVED>", // 33
|
||||
"<RESERVED>", // 34
|
||||
"<RESERVED>", // 35
|
||||
"<RESERVED>", // 36
|
||||
"<RESERVED>", // 37
|
||||
"<RESERVED>", // 38
|
||||
"<RESERVED>", // 39
|
||||
};
|
||||
|
||||
const uint32_t CheatFunctionFlags [NUMCHEATS] =
|
||||
{
|
||||
1 << CHEATFUNC_GOD,
|
||||
1 << CHEATFUNC_GIVEEVERYTHING,
|
||||
1 << CHEATFUNC_WARP,
|
||||
1 << CHEATFUNC_COORDS,
|
||||
1 << CHEATFUNC_VIEW,
|
||||
0,
|
||||
1 << CHEATFUNC_UNLOCK,
|
||||
1 << CHEATFUNC_CASHMAN,
|
||||
1 << CHEATFUNC_GIVEALLITEMS,
|
||||
1 << CHEATFUNC_FRAMERATE,
|
||||
1 << CHEATFUNC_SKILL,
|
||||
1 << CHEATFUNC_QUOTEBETA,
|
||||
1 << CHEATFUNC_HYPER,
|
||||
1 << CHEATFUNC_MONSTERS,
|
||||
0,
|
||||
0,
|
||||
1 << CHEATFUNC_QUOTETODD,
|
||||
1 << CHEATFUNC_SHOWMAP,
|
||||
1 << CHEATFUNC_GOD,
|
||||
1 << CHEATFUNC_QUOTEALLEN,
|
||||
1 << CHEATFUNC_CLIP,
|
||||
1 << CHEATFUNC_GIVEWEAPONS,
|
||||
1 << CHEATFUNC_GIVEINVENTORY,
|
||||
1 << CHEATFUNC_GIVEKEYS,
|
||||
1 << CHEATFUNC_DEBUG,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
};
|
||||
|
||||
// KEEPINSYNC game.h: enum CheatCodeFunctions
|
||||
// KEEPINSYNC menus.c: MenuEntry_t ME_CheatCodes[]
|
||||
const uint8_t CheatFunctionIDs[NUMCHEATS] =
|
||||
{
|
||||
CHEAT_CASHMAN,
|
||||
CHEAT_CORNHOLIO,
|
||||
CHEAT_STUFF,
|
||||
CHEAT_WEAPONS,
|
||||
CHEAT_ITEMS,
|
||||
CHEAT_INVENTORY,
|
||||
CHEAT_KEYS,
|
||||
CHEAT_HYPER,
|
||||
CHEAT_VIEW,
|
||||
CHEAT_SHOWMAP,
|
||||
CHEAT_UNLOCK,
|
||||
CHEAT_CLIP,
|
||||
CHEAT_SCOTTY,
|
||||
CHEAT_SKILL,
|
||||
CHEAT_MONSTERS,
|
||||
CHEAT_RATE,
|
||||
CHEAT_BETA,
|
||||
CHEAT_TODD,
|
||||
CHEAT_ALLEN,
|
||||
CHEAT_COORDS,
|
||||
CHEAT_DEBUG,
|
||||
};
|
||||
void G_SetupCheats(void)
|
||||
{
|
||||
if (RR)
|
||||
{
|
||||
CheatKeys[0] = sc_R;
|
||||
CheatKeys[1] = sc_D;
|
||||
Bstrcpy(CheatStrings[0], "hounddog");
|
||||
Bstrcpy(CheatStrings[1], "all");
|
||||
Bstrcpy(CheatStrings[2], "meadow###");
|
||||
Bstrcpy(CheatStrings[3], "yerat");
|
||||
Bstrcpy(CheatStrings[7], "cluck");
|
||||
Bstrcpy(CheatStrings[11], "teachers");
|
||||
Bstrcpy(CheatStrings[12], "moonshine");
|
||||
Bstrcpy(CheatStrings[13], "critters");
|
||||
Bstrcpy(CheatStrings[16], "rafael");
|
||||
Bstrcpy(CheatStrings[18], "elvis");
|
||||
Bstrcpy(CheatStrings[19], "<RESERVED>");
|
||||
Bstrcpy(CheatStrings[21], "guns");
|
||||
if (RRRA)
|
||||
{
|
||||
Bstrcpy(CheatStrings[25], "joseph");
|
||||
Bstrcpy(CheatStrings[26], "mrbill");
|
||||
Bstrcpy(CheatStrings[27], "tony");
|
||||
Bstrcpy(CheatStrings[28], "gary");
|
||||
Bstrcpy(CheatStrings[29], "rhett");
|
||||
Bstrcpy(CheatStrings[30], "aaron");
|
||||
Bstrcpy(CheatStrings[31], "nocheat");
|
||||
Bstrcpy(CheatStrings[32], "woleslagle");
|
||||
Bstrcpy(CheatStrings[33], "mikael");
|
||||
Bstrcpy(CheatStrings[34], "greg");
|
||||
Bstrcpy(CheatStrings[35], "noah");
|
||||
Bstrcpy(CheatStrings[36], "arijit");
|
||||
Bstrcpy(CheatStrings[37], "donut");
|
||||
Bstrcpy(CheatStrings[38], "kfc");
|
||||
Bstrcpy(CheatStrings[39], "van");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void doinvcheat(DukePlayer_t * const pPlayer, int32_t invidx, int32_t defaultnum)
|
||||
{
|
||||
if (defaultnum >= 0)
|
||||
pPlayer->inv_amount[invidx] = defaultnum;
|
||||
}
|
||||
|
||||
static void G_CheatGetInv(DukePlayer_t *pPlayer)
|
||||
{
|
||||
doinvcheat(pPlayer, GET_STEROIDS, 400);
|
||||
if (!RR) doinvcheat(pPlayer, GET_HEATS, 1200);
|
||||
doinvcheat(pPlayer, GET_BOOTS, RR ? 2000 : 200);
|
||||
doinvcheat(pPlayer, GET_SHIELD, 100);
|
||||
doinvcheat(pPlayer, GET_SCUBA, 6400);
|
||||
doinvcheat(pPlayer, GET_HOLODUKE, 2400);
|
||||
doinvcheat(pPlayer, GET_JETPACK, RR ? 600 : 1600);
|
||||
doinvcheat(pPlayer, GET_FIRSTAID, pPlayer->max_player_health);
|
||||
}
|
||||
|
||||
static void end_cheat(DukePlayer_t * const pPlayer)
|
||||
{
|
||||
pPlayer->cheat_phase = 0;
|
||||
KB_FlushKeyboardQueue();
|
||||
}
|
||||
|
||||
static int32_t cheatbuflen;
|
||||
static int8_t cheatbuf[MAXCHEATLEN];
|
||||
|
||||
void G_DoCheats(void)
|
||||
{
|
||||
DukePlayer_t * const pPlayer = g_player[myconnectindex].ps;
|
||||
int consoleCheat = 0;
|
||||
int cheatNum;
|
||||
|
||||
if (osdcmd_cheatsinfo_stat.cheatnum != -1)
|
||||
{
|
||||
cheatNum = osdcmd_cheatsinfo_stat.cheatnum;
|
||||
|
||||
if (ud.player_skill == 4 || (RR && ud.player_skill > 3) || (RRRA && pPlayer->nocheat))
|
||||
{
|
||||
switch (cheatNum)
|
||||
{
|
||||
case CHEAT_DEBUG:
|
||||
case CHEAT_COORDS:
|
||||
case CHEAT_RATE:
|
||||
case CHEAT_RESERVED:
|
||||
case CHEAT_RESERVED2:
|
||||
//case CHEAT_RESERVED3:
|
||||
break;
|
||||
default:
|
||||
P_DoQuote(QUOTE_CHEATS_DISABLED, pPlayer);
|
||||
osdcmd_cheatsinfo_stat.cheatnum = -1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// JBF 20030914
|
||||
osdcmd_cheatsinfo_stat.cheatnum = -1;
|
||||
consoleCheat = 1;
|
||||
}
|
||||
|
||||
static int volumeOne = 0;
|
||||
|
||||
if (VOLUMEONE && !volumeOne)
|
||||
{
|
||||
// change "scotty###" to "scotty##"
|
||||
uint32_t const warpend = Bstrlen(CheatStrings[2]);
|
||||
if (strcmp(&CheatStrings[2][warpend-3], "###") == 0)
|
||||
CheatStrings[2][warpend-1] = '\0';
|
||||
|
||||
Bstrcpy(CheatStrings[6], "<RESERVED>");
|
||||
volumeOne = 1;
|
||||
}
|
||||
|
||||
if (consoleCheat && numplayers < 2 && ud.recstat == 0)
|
||||
goto FOUNDCHEAT;
|
||||
|
||||
if ((RR && ud.player_skill > 3) || (RRRA && pPlayer->nocheat))
|
||||
return;
|
||||
|
||||
if (pPlayer->gm & (MODE_TYPE|MODE_MENU))
|
||||
return;
|
||||
|
||||
if (pPlayer->cheat_phase == 1)
|
||||
{
|
||||
int ch;
|
||||
|
||||
while (KB_KeyWaiting())
|
||||
{
|
||||
ch = Btolower(KB_GetCh());
|
||||
|
||||
if (!((ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9')))
|
||||
{
|
||||
pPlayer->cheat_phase = 0;
|
||||
// P_DoQuote(QUOTE_46,pPlayer);
|
||||
return;
|
||||
}
|
||||
|
||||
cheatbuf[cheatbuflen++] = (int8_t) ch;
|
||||
// This assertion is not obvious, but it should hold because of the
|
||||
// cheat string matching logic below.
|
||||
Bassert(cheatbuflen < (signed)sizeof(cheatbuf));
|
||||
cheatbuf[cheatbuflen] = 0;
|
||||
// KB_ClearKeysDown();
|
||||
|
||||
for (cheatNum=0; cheatNum < NUMCHEATCODES; cheatNum++)
|
||||
{
|
||||
for (bssize_t j = 0; j<cheatbuflen; j++)
|
||||
{
|
||||
if (cheatbuf[j] == CheatStrings[cheatNum][j] || (CheatStrings[cheatNum][j] == '#' && ch >= '0' && ch <= '9'))
|
||||
{
|
||||
if (CheatStrings[cheatNum][j+1] == 0) goto FOUNDCHEAT;
|
||||
if (j == cheatbuflen-1) return;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
}
|
||||
|
||||
pPlayer->cheat_phase = 0;
|
||||
return;
|
||||
|
||||
FOUNDCHEAT:;
|
||||
|
||||
if (cheatNum == CHEAT_SCOTTY)
|
||||
{
|
||||
size_t const i = Bstrlen(CheatStrings[cheatNum])-3+VOLUMEONE;
|
||||
if (!consoleCheat)
|
||||
{
|
||||
// JBF 20030914
|
||||
int32_t volnume, levnume;
|
||||
if (VOLUMEALL)
|
||||
{
|
||||
volnume = cheatbuf[i] - '0';
|
||||
levnume = (cheatbuf[i+1] - '0')*10+(cheatbuf[i+2]-'0');
|
||||
}
|
||||
else
|
||||
{
|
||||
volnume = cheatbuf[i] - '0';
|
||||
levnume = cheatbuf[i+1] - '0';
|
||||
}
|
||||
|
||||
volnume--;
|
||||
levnume--;
|
||||
|
||||
ud.m_volume_number = volnume;
|
||||
ud.m_level_number = levnume;
|
||||
}
|
||||
else
|
||||
{
|
||||
// JBF 20030914
|
||||
ud.m_volume_number = osdcmd_cheatsinfo_stat.volume;
|
||||
ud.m_level_number = osdcmd_cheatsinfo_stat.level;
|
||||
}
|
||||
}
|
||||
else if (cheatNum == CHEAT_SKILL)
|
||||
{
|
||||
if (!consoleCheat)
|
||||
{
|
||||
size_t const i = Bstrlen(CheatStrings[cheatNum])-1;
|
||||
ud.m_player_skill = cheatbuf[i] - '1';
|
||||
}
|
||||
else
|
||||
{
|
||||
ud.m_player_skill = osdcmd_cheatsinfo_stat.volume;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
switch (cheatNum)
|
||||
{
|
||||
case CHEAT_WEAPONS:
|
||||
{
|
||||
int const weaponLimit = (VOLUMEONE) ? 6 : 0;
|
||||
|
||||
for (bssize_t weaponNum = PISTOL_WEAPON; weaponNum < MAX_WEAPONS-weaponLimit; weaponNum++)
|
||||
{
|
||||
P_AddAmmo(pPlayer, weaponNum, pPlayer->max_ammo_amount[weaponNum]);
|
||||
pPlayer->gotweapon |= (1<<weaponNum);
|
||||
}
|
||||
|
||||
if (RRRA) pPlayer->ammo_amount[SLINGBLADE_WEAPON] = 1;
|
||||
|
||||
P_DoQuote(QUOTE_CHEAT_ALL_WEAPONS, pPlayer);
|
||||
|
||||
end_cheat(pPlayer);
|
||||
}
|
||||
return;
|
||||
|
||||
case CHEAT_INVENTORY:
|
||||
G_CheatGetInv(pPlayer);
|
||||
P_DoQuote(QUOTE_CHEAT_ALL_INV, pPlayer);
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
|
||||
case CHEAT_KEYS:
|
||||
pPlayer->got_access = 7;
|
||||
if (RR)
|
||||
for (int key = 0; key < 5; key++)
|
||||
pPlayer->keys[key] = 1;
|
||||
KB_FlushKeyboardQueue();
|
||||
P_DoQuote(QUOTE_CHEAT_ALL_KEYS, pPlayer);
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
|
||||
case CHEAT_DEBUG:
|
||||
g_Debug = 1-g_Debug;
|
||||
|
||||
G_DumpDebugInfo();
|
||||
Bsprintf(tempbuf, "Gamevars dumped to log");
|
||||
G_AddUserQuote(tempbuf);
|
||||
Bsprintf(tempbuf, "Map dumped to debug.map");
|
||||
G_AddUserQuote(tempbuf);
|
||||
end_cheat(pPlayer);
|
||||
break;
|
||||
|
||||
case CHEAT_CLIP:
|
||||
ud.noclip = !ud.noclip;
|
||||
P_DoQuote(QUOTE_CHEAT_NOCLIP-!ud.noclip, pPlayer);
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
|
||||
case CHEAT_RESERVED2:
|
||||
if (RR)
|
||||
{
|
||||
P_DoQuote(QUOTE_JETPACK_ON, pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
}
|
||||
else
|
||||
{
|
||||
pPlayer->player_par = 0;
|
||||
pPlayer->gm = MODE_EOL;
|
||||
}
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
|
||||
case CHEAT_ALLEN:
|
||||
P_DoQuote(QUOTE_CHEAT_ALLEN, pPlayer);
|
||||
pPlayer->cheat_phase = 0;
|
||||
KB_ClearKeyDown(sc_N);
|
||||
return;
|
||||
|
||||
case CHEAT_CORNHOLIO:
|
||||
case CHEAT_KROZ:
|
||||
//case CHEAT_COMEGETSOME:
|
||||
{
|
||||
const int32_t pi = pPlayer->i;
|
||||
|
||||
ud.god = 1-ud.god;
|
||||
|
||||
if (ud.god)
|
||||
{
|
||||
if (RRRA)
|
||||
S_PlaySound(218);
|
||||
pus = 1;
|
||||
pub = 1;
|
||||
sprite[pi].cstat = 257;
|
||||
|
||||
actor[pi].t_data[0] = 0;
|
||||
actor[pi].t_data[1] = 0;
|
||||
actor[pi].t_data[2] = 0;
|
||||
actor[pi].t_data[3] = 0;
|
||||
actor[pi].t_data[4] = 0;
|
||||
actor[pi].t_data[5] = 0;
|
||||
|
||||
sprite[pi].hitag = 0;
|
||||
sprite[pi].lotag = 0;
|
||||
sprite[pi].pal = pPlayer->palookup;
|
||||
|
||||
//if (cheatNum != CHEAT_COMEGETSOME)
|
||||
//{
|
||||
P_DoQuote(QUOTE_CHEAT_GODMODE_ON, pPlayer);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Bstrcpy(apStrings[QUOTE_RESERVED4], "Come Get Some!");
|
||||
//
|
||||
// S_PlaySound(DUKE_GETWEAPON2);
|
||||
// P_DoQuote(QUOTE_RESERVED4, pPlayer);
|
||||
// G_CheatGetInv(pPlayer);
|
||||
//
|
||||
// for (bssize_t weaponNum = PISTOL_WEAPON; weaponNum < MAX_WEAPONS; weaponNum++)
|
||||
// pPlayer->gotweapon |= (1<<weaponNum);
|
||||
//
|
||||
// for (bssize_t weaponNum = PISTOL_WEAPON; weaponNum < MAX_WEAPONS; weaponNum++)
|
||||
// P_AddAmmo(pPlayer, weaponNum, pPlayer->max_ammo_amount[weaponNum]);
|
||||
//
|
||||
// pPlayer->got_access = 7;
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite[pi].extra = pPlayer->max_player_health;
|
||||
actor[pi].extra = -1;
|
||||
pPlayer->last_extra = pPlayer->max_player_health;
|
||||
P_DoQuote(QUOTE_CHEAT_GODMODE_OFF, pPlayer);
|
||||
}
|
||||
|
||||
sprite[pi].extra = pPlayer->max_player_health;
|
||||
actor[pi].extra = 0;
|
||||
|
||||
//if (cheatNum != CHEAT_COMEGETSOME)
|
||||
pPlayer->dead_flag = 0;
|
||||
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
}
|
||||
|
||||
case CHEAT_STUFF:
|
||||
{
|
||||
int const weaponLimit = (VOLUMEONE) ? 6 : 0;
|
||||
|
||||
for (bssize_t weaponNum = PISTOL_WEAPON; weaponNum < MAX_WEAPONS-weaponLimit; weaponNum++)
|
||||
pPlayer->gotweapon |= (1<<weaponNum);
|
||||
|
||||
for (bssize_t weaponNum = PISTOL_WEAPON; weaponNum < MAX_WEAPONS-weaponLimit; weaponNum++)
|
||||
P_AddAmmo(pPlayer, weaponNum, pPlayer->max_ammo_amount[weaponNum]);
|
||||
|
||||
if (RRRA)
|
||||
pPlayer->ammo_amount[SLINGBLADE_WEAPON] = 1;
|
||||
|
||||
G_CheatGetInv(pPlayer);
|
||||
pPlayer->got_access = 7;
|
||||
if (RR)
|
||||
for (int key = 0; key < 5; key++)
|
||||
pPlayer->keys[key] = 1;
|
||||
P_DoQuote(QUOTE_CHEAT_EVERYTHING, pPlayer);
|
||||
|
||||
// P_DoQuote(QUOTE_21,pPlayer);
|
||||
pPlayer->inven_icon = ICON_FIRSTAID;
|
||||
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
}
|
||||
|
||||
case CHEAT_SCOTTY:
|
||||
{
|
||||
if (RR)
|
||||
g_lastLevel = 0;
|
||||
int32_t const volnume = ud.m_volume_number, levnume = ud.m_level_number;
|
||||
|
||||
if ((!VOLUMEONE || volnume == 0) && (unsigned)volnume < (unsigned)g_volumeCnt &&
|
||||
(unsigned)levnume < MAXLEVELS && g_mapInfo[volnume*MAXLEVELS + levnume].filename != NULL)
|
||||
{
|
||||
ud.volume_number = volnume;
|
||||
ud.level_number = levnume;
|
||||
|
||||
#if 0
|
||||
if (numplayers > 1 && g_netServer)
|
||||
Net_NewGame(volnume, levnume);
|
||||
else
|
||||
#endif
|
||||
pPlayer->gm |= MODE_RESTART;
|
||||
}
|
||||
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
}
|
||||
|
||||
case CHEAT_SKILL:
|
||||
if (RR)
|
||||
g_lastLevel = 0;
|
||||
ud.player_skill = ud.m_player_skill;
|
||||
|
||||
#if 0
|
||||
if (numplayers > 1 && g_netServer)
|
||||
Net_NewGame(ud.m_volume_number, ud.m_level_number);
|
||||
else
|
||||
#endif
|
||||
pPlayer->gm |= MODE_RESTART;
|
||||
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
|
||||
case CHEAT_COORDS:
|
||||
#ifdef USE_OPENGL
|
||||
if (++ud.coords >= 3) ud.coords = 0;
|
||||
#else
|
||||
if (++ud.coords >= 2) ud.coords = 0;
|
||||
#endif
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
|
||||
case CHEAT_VIEW:
|
||||
if (!RRRA || (!pPlayer->on_motorcycle && !pPlayer->on_boat))
|
||||
{
|
||||
pPlayer->over_shoulder_on ^= 1;
|
||||
CAMERADIST = 0;
|
||||
CAMERACLOCK = totalclock;
|
||||
// P_DoQuote(QUOTE_CHEATS_DISABLED,pPlayer);
|
||||
}
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
|
||||
case CHEAT_TIME:
|
||||
// P_DoQuote(QUOTE_21,pPlayer);
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
|
||||
case CHEAT_UNLOCK:
|
||||
if (VOLUMEONE) return;
|
||||
|
||||
for (bssize_t i=numsectors-1; i>=0; i--) //Unlock
|
||||
{
|
||||
int const lotag = sector[i].lotag;
|
||||
if (lotag == -1 || lotag == 32767) continue;
|
||||
if ((lotag & 0x7fff) > 2)
|
||||
{
|
||||
if (lotag & (uint16_t)~16384u)
|
||||
sector[i].lotag &= (uint16_t)~16384u;
|
||||
G_OperateSectors(i, pPlayer->i);
|
||||
}
|
||||
}
|
||||
G_OperateForceFields(pPlayer->i, -1);
|
||||
|
||||
P_DoQuote(QUOTE_CHEAT_UNLOCK, pPlayer);
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
|
||||
case CHEAT_CASHMAN:
|
||||
ud.cashman = 1-ud.cashman;
|
||||
KB_ClearKeyDown(sc_N);
|
||||
pPlayer->cheat_phase = 0;
|
||||
return;
|
||||
|
||||
case CHEAT_ITEMS:
|
||||
G_CheatGetInv(pPlayer);
|
||||
pPlayer->got_access = 7;
|
||||
if (RR)
|
||||
for(int key = 0; key < 5; key++)
|
||||
pPlayer->keys[key] = 1;
|
||||
P_DoQuote(QUOTE_CHEAT_EVERYTHING, pPlayer);
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
|
||||
case CHEAT_SHOWMAP: // SHOW ALL OF THE MAP TOGGLE;
|
||||
ud.showallmap = !ud.showallmap;
|
||||
|
||||
for (char & i : show2dsector)
|
||||
i = ud.showallmap*255;
|
||||
|
||||
P_DoQuote(ud.showallmap ? QUOTE_SHOW_MAP_ON : QUOTE_SHOW_MAP_OFF,
|
||||
pPlayer);
|
||||
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
|
||||
case CHEAT_TODD:
|
||||
P_DoQuote(QUOTE_CHEAT_TODD, pPlayer);
|
||||
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
|
||||
case CHEAT_RATE:
|
||||
if (++ud.showfps > 3)
|
||||
ud.showfps = 0;
|
||||
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
|
||||
case CHEAT_BETA:
|
||||
P_DoQuote(QUOTE_CHEAT_BETA, pPlayer);
|
||||
KB_ClearKeyDown(sc_H);
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
|
||||
case CHEAT_HYPER:
|
||||
pPlayer->inv_amount[GET_STEROIDS] = 399;
|
||||
if (!RR)
|
||||
pPlayer->inv_amount[GET_HEATS] = 1200;
|
||||
P_DoQuote(QUOTE_CHEAT_STEROIDS, pPlayer);
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
|
||||
case CHEAT_MONSTERS:
|
||||
{
|
||||
const char *s [] = { "On", "Off", "On (2)" };
|
||||
|
||||
if (++g_noEnemies == 3)
|
||||
g_noEnemies = 0;
|
||||
|
||||
Bsprintf(apStrings[QUOTE_RESERVED4], "Monsters: %s", s[g_noEnemies]);
|
||||
P_DoQuote(QUOTE_RESERVED4, pPlayer);
|
||||
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
}
|
||||
|
||||
case CHEAT_RESERVED:
|
||||
//case CHEAT_RESERVED3:
|
||||
if (RR)
|
||||
{
|
||||
P_DoQuote(51, pPlayer);
|
||||
end_cheat(pPlayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
ud.eog = 1;
|
||||
pPlayer->player_par = 0;
|
||||
pPlayer->gm |= MODE_EOL;
|
||||
}
|
||||
KB_FlushKeyboardQueue();
|
||||
return;
|
||||
|
||||
case CHEAT_RAJOSEPH:
|
||||
G_OnMotorcycle(pPlayer, 0);
|
||||
pPlayer->ammo_amount[MOTORCYCLE_WEAPON] = pPlayer->max_ammo_amount[MOTORCYCLE_WEAPON];
|
||||
P_DoQuote(126, pPlayer);
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
return;
|
||||
|
||||
case CHEAT_RAMRBILL:
|
||||
P_QuickKill(pPlayer);
|
||||
P_DoQuote(127, pPlayer);
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
return;
|
||||
|
||||
case CHEAT_RAGARY:
|
||||
S_PlayRRMusic(10);
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
return;
|
||||
|
||||
case CHEAT_RANOAH:
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
return;
|
||||
|
||||
case CHEAT_RARHETT:
|
||||
ud.god = 0;
|
||||
pPlayer->gotweapon = 1<<KNEE_WEAPON;
|
||||
pPlayer->curr_weapon = KNEE_WEAPON;
|
||||
pPlayer->nocheat = 1;
|
||||
sprite[pPlayer->i].extra = 1;
|
||||
P_DoQuote(128, pPlayer);
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
return;
|
||||
|
||||
case CHEAT_RAAARON:
|
||||
pPlayer->drug_mode = pPlayer->drug_mode ? 0 : 5;
|
||||
pPlayer->drug_timer = totalclock;
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
return;
|
||||
|
||||
case CHEAT_RANOCHEAT:
|
||||
pPlayer->nocheat = 1;
|
||||
P_DoQuote(130, pPlayer);
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
return;
|
||||
|
||||
case CHEAT_RATONY:
|
||||
g_changeEnemySize = 2;
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
return;
|
||||
|
||||
case CHEAT_RAVAN:
|
||||
g_changeEnemySize = 3;
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
return;
|
||||
|
||||
case CHEAT_RAKFC:
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
int const newSprite = A_Spawn(pPlayer->i, HEN);
|
||||
sprite[newSprite].pal = 1;
|
||||
sprite[newSprite].xrepeat <<= 2;
|
||||
sprite[newSprite].yrepeat <<= 2;
|
||||
}
|
||||
P_DoQuote(139, pPlayer);
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
return;
|
||||
|
||||
case CHEAT_RAWOLESLAGLE:
|
||||
if (pPlayer->drink_amt)
|
||||
{
|
||||
pPlayer->drink_amt = 0;
|
||||
P_DoQuote(132, pPlayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
pPlayer->drink_amt = 90;
|
||||
P_DoQuote(131, pPlayer);
|
||||
}
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
return;
|
||||
|
||||
case CHEAT_RAMIKAEL:
|
||||
for (bssize_t weaponNum = PISTOL_WEAPON; weaponNum < MAX_WEAPONS; weaponNum++)
|
||||
{
|
||||
pPlayer->gotweapon |= 1 << weaponNum;
|
||||
pPlayer->ammo_amount[weaponNum] = 66;
|
||||
}
|
||||
|
||||
pPlayer->ammo_amount[SLINGBLADE_WEAPON] = 1;
|
||||
|
||||
G_CheatGetInv(pPlayer);
|
||||
pPlayer->got_access = 7;
|
||||
for (int key = 0; key < 5; key++)
|
||||
pPlayer->keys[key] = 1;
|
||||
P_DoQuote(5, pPlayer);
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
return;
|
||||
|
||||
case CHEAT_RAGREG:
|
||||
if (pPlayer->sea_sick_stat)
|
||||
{
|
||||
pPlayer->sea_sick_stat = 0;
|
||||
P_DoQuote(129, pPlayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
pPlayer->sea_sick_stat = 1;
|
||||
P_DoQuote(137, pPlayer);
|
||||
}
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
return;
|
||||
|
||||
case CHEAT_RAARIJIT:
|
||||
case CHEAT_RADONUT:
|
||||
G_OnBoat(pPlayer, 0);
|
||||
pPlayer->ammo_amount[BOAT_WEAPON] = pPlayer->max_ammo_amount[BOAT_WEAPON];
|
||||
P_DoQuote(136, pPlayer);
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
return;
|
||||
|
||||
default:
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (KB_KeyPressed((uint8_t) CheatKeys[0]))
|
||||
{
|
||||
if (pPlayer->cheat_phase >= 0 && numplayers < 2 && ud.recstat == 0)
|
||||
{
|
||||
if (CheatKeys[0] == CheatKeys[1])
|
||||
KB_ClearKeyDown((uint8_t) CheatKeys[0]);
|
||||
pPlayer->cheat_phase = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (KB_KeyPressed((uint8_t) CheatKeys[1]))
|
||||
{
|
||||
if (pPlayer->cheat_phase == -1)
|
||||
{
|
||||
if (ud.player_skill == 4)
|
||||
{
|
||||
P_DoQuote(QUOTE_CHEATS_DISABLED, pPlayer);
|
||||
pPlayer->cheat_phase = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
pPlayer->cheat_phase = 1;
|
||||
// P_DoQuote(QUOTE_25,pPlayer);
|
||||
cheatbuflen = 0;
|
||||
}
|
||||
KB_FlushKeyboardQueue();
|
||||
}
|
||||
else if (pPlayer->cheat_phase != 0)
|
||||
{
|
||||
pPlayer->cheat_phase = 0;
|
||||
KB_ClearKeyDown((uint8_t) CheatKeys[0]);
|
||||
KB_ClearKeyDown((uint8_t) CheatKeys[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
103
source/rr/src/cheats.h
Normal file
|
@ -0,0 +1,103 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2016 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
extern void G_DoCheats(void);
|
||||
extern void G_SetupCheats(void);
|
||||
|
||||
// Cheats
|
||||
// KEEPINSYNC game.c: char CheatStrings[][]
|
||||
enum cheatindex_t
|
||||
{
|
||||
CHEAT_CORNHOLIO, // 0
|
||||
CHEAT_STUFF,
|
||||
CHEAT_SCOTTY,
|
||||
CHEAT_COORDS,
|
||||
CHEAT_VIEW,
|
||||
CHEAT_TIME, // 5
|
||||
CHEAT_UNLOCK,
|
||||
CHEAT_CASHMAN,
|
||||
CHEAT_ITEMS,
|
||||
CHEAT_RATE,
|
||||
CHEAT_SKILL, // 10
|
||||
CHEAT_BETA,
|
||||
CHEAT_HYPER,
|
||||
CHEAT_MONSTERS,
|
||||
CHEAT_RESERVED,
|
||||
CHEAT_RESERVED2, // 15
|
||||
CHEAT_TODD,
|
||||
CHEAT_SHOWMAP,
|
||||
CHEAT_KROZ,
|
||||
CHEAT_ALLEN,
|
||||
CHEAT_CLIP, // 20
|
||||
CHEAT_WEAPONS,
|
||||
CHEAT_INVENTORY,
|
||||
CHEAT_KEYS,
|
||||
CHEAT_DEBUG,
|
||||
CHEAT_RAJOSEPH, // 25
|
||||
CHEAT_RAMRBILL,
|
||||
CHEAT_RATONY,
|
||||
CHEAT_RAGARY,
|
||||
CHEAT_RARHETT,
|
||||
CHEAT_RAAARON, // 30
|
||||
CHEAT_RANOCHEAT,
|
||||
CHEAT_RAWOLESLAGLE,
|
||||
CHEAT_RAMIKAEL,
|
||||
CHEAT_RAGREG,
|
||||
CHEAT_RANOAH, // 35
|
||||
CHEAT_RAARIJIT,
|
||||
CHEAT_RADONUT,
|
||||
CHEAT_RAKFC,
|
||||
CHEAT_RAVAN,
|
||||
NUMCHEATS,
|
||||
};
|
||||
|
||||
extern char CheatStrings[NUMCHEATS][MAXCHEATLEN];
|
||||
|
||||
// KEEPINSYNC game.c: uint8_t CheatFunctionIDs[]
|
||||
// KEEPINSYNC menus.c: MenuEntry_t ME_CheatCodes[]
|
||||
enum CheatCodeFunctions
|
||||
{
|
||||
CHEATFUNC_CASHMAN,
|
||||
CHEATFUNC_GOD,
|
||||
CHEATFUNC_GIVEEVERYTHING,
|
||||
CHEATFUNC_GIVEWEAPONS,
|
||||
CHEATFUNC_GIVEALLITEMS,
|
||||
CHEATFUNC_GIVEINVENTORY,
|
||||
CHEATFUNC_GIVEKEYS,
|
||||
CHEATFUNC_HYPER,
|
||||
CHEATFUNC_VIEW,
|
||||
CHEATFUNC_SHOWMAP,
|
||||
CHEATFUNC_UNLOCK,
|
||||
CHEATFUNC_CLIP,
|
||||
CHEATFUNC_WARP,
|
||||
CHEATFUNC_SKILL,
|
||||
CHEATFUNC_MONSTERS,
|
||||
CHEATFUNC_FRAMERATE,
|
||||
CHEATFUNC_QUOTEBETA,
|
||||
CHEATFUNC_QUOTETODD,
|
||||
CHEATFUNC_QUOTEALLEN,
|
||||
CHEATFUNC_COORDS,
|
||||
CHEATFUNC_DEBUG,
|
||||
NUMCHEATFUNCS,
|
||||
};
|
782
source/rr/src/cmdline.cpp
Normal file
|
@ -0,0 +1,782 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2016 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#include "duke3d.h"
|
||||
#include "demo.h"
|
||||
#include "screens.h"
|
||||
#include "renderlayer.h"
|
||||
#include "cmdline.h"
|
||||
|
||||
int32_t g_commandSetup = 0;
|
||||
int32_t g_noSetup = 0;
|
||||
int32_t g_noAutoLoad = 0;
|
||||
int32_t g_noSound = 0;
|
||||
int32_t g_noMusic = 0;
|
||||
const char *CommandMap = NULL;
|
||||
const char *CommandName = NULL;
|
||||
int32_t g_forceWeaponChoice = 0;
|
||||
int32_t g_fakeMultiMode = 0;
|
||||
|
||||
void G_ShowParameterHelp(void)
|
||||
{
|
||||
static char const s[] = "Usage: " APPBASENAME " [files] [options]\n"
|
||||
"Example: " APPBASENAME " -usecwd -cfg myconfig.cfg -map nukeland.map\n\n"
|
||||
"Files can be of type [grp|zip|map|con|def]\n"
|
||||
"\n"
|
||||
"-cfg [file.cfg]\tUse an alternate configuration file\n"
|
||||
#ifdef HAVE_CLIPSHAPE_FEATURE
|
||||
"-clipmap [file.map]\tLoad an additional clipping map for use with clipshape\n"
|
||||
#endif
|
||||
"-connect [host]\tConnect to a multiplayer game\n"
|
||||
"-c#\t\tMultiplayer mode #, 1 = DM, 2 = Co-op, 3 = DM(no spawn)\n"
|
||||
"-d [file.edm or #]\tPlay a demo\n"
|
||||
"-g [file.grp]\tLoad additional game data\n"
|
||||
"-h [file.def]\tLoad an alternate definitions file\n"
|
||||
"-j [dir]\t\tAdd a directory to " APPNAME "'s search list\n"
|
||||
"-l#\t\tStart game on level #, see -v\n"
|
||||
"-map [file.map]\tLoad an external map file\n"
|
||||
"-mh [file.def]\tInclude an additional definitions module\n"
|
||||
"-mx [file.con]\tInclude an additional CON script module\n"
|
||||
"-m\t\tDisable enemies\n"
|
||||
"-rts [file.rts]\tLoad a custom Remote Ridicule sound bank\n"
|
||||
"-r\t\tRecord demo\n"
|
||||
"-s#\t\tStart game on skill level #\n"
|
||||
"-server\t\tStart a multiplayer server\n"
|
||||
#ifdef STARTUP_SETUP_WINDOW
|
||||
"-setup/nosetup\tEnable or disable startup window\n"
|
||||
#endif
|
||||
"-t#\t\tRespawn mode: 1 = enemies, 2 = weapons, 3 = items, x = all\n"
|
||||
"-usecwd\t\tRead data and configuration from current directory\n"
|
||||
"-u#########\tUser's favorite weapon order (default: 3425689071)\n"
|
||||
"-v#\t\tStart game on episode #, see -l\n"
|
||||
"-x [game.con]\tLoad custom CON script\n"
|
||||
"-#\t\tLoad and run a game from slot # (0-9)\n"
|
||||
// "\n-?/--help\tDisplay this help message and exit\n"
|
||||
"\nSee " APPBASENAME " -debughelp for additional parameters for debugging"
|
||||
;
|
||||
#ifdef WM_MSGBOX_WINDOW
|
||||
Bsnprintf(tempbuf, sizeof(tempbuf), HEAD2 " %s", s_buildRev);
|
||||
wm_msgbox(tempbuf, s);
|
||||
#else
|
||||
initprintf("%s\n", s);
|
||||
#endif
|
||||
}
|
||||
|
||||
void G_ShowDebugHelp(void)
|
||||
{
|
||||
static char const s[] = "Usage: " APPBASENAME " [files] [options]\n"
|
||||
"\n"
|
||||
#if 0
|
||||
"-a\t\tUse fake player AI (fake multiplayer only)\n"
|
||||
#endif
|
||||
"-cachesize #\tSet cache size in kB\n"
|
||||
"-game_dir [dir]\tSpecify game data directory\n"
|
||||
"-gamegrp \tSelect main grp file\n"
|
||||
"-name [name]\tPlayer name in multiplayer\n"
|
||||
"-noautoload\tDisable loading from autoload directory\n"
|
||||
#if defined RENDERTYPEWIN
|
||||
"-nodinput\t\tDisable DirectInput (joystick) support\n"
|
||||
#endif
|
||||
"-nologo\t\tSkip intro anim\n"
|
||||
"-ns\t\tDisable sound\n"
|
||||
"-nm\t\tDisable music\n"
|
||||
"-q#\t\tFake multiplayer with # players\n"
|
||||
"-z#/-condebug\tEnable line-by-line CON compile debugging at level #\n"
|
||||
"-conversion YYYYMMDD\tSelects CON script version for compatibility with older mods\n"
|
||||
"-rotatesprite-no-widescreen\tStretch screen drawing from scripts to fullscreen\n"
|
||||
;
|
||||
#ifdef WM_MSGBOX_WINDOW
|
||||
Bsnprintf(tempbuf, sizeof(tempbuf), HEAD2 " %s", s_buildRev);
|
||||
wm_msgbox(tempbuf, s);
|
||||
#else
|
||||
initprintf("%s\n", s);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void G_AddDemo(const char* param)
|
||||
{
|
||||
Bstrncpy(tempbuf, param, sizeof(tempbuf));
|
||||
char * colon = (char *) Bstrchr(tempbuf, ':');
|
||||
int32_t framespertic=-1, numrepeats=1;
|
||||
|
||||
if (colon && colon != tempbuf)
|
||||
{
|
||||
// -d<filename>:<num>[,<num>]
|
||||
// profiling options
|
||||
*(colon++) = 0;
|
||||
Bsscanf(colon, "%d,%d", &framespertic, &numrepeats);
|
||||
}
|
||||
|
||||
Demo_SetFirst(tempbuf);
|
||||
|
||||
if (framespertic < 0)
|
||||
{
|
||||
initprintf("Play demo %s.\n", g_firstDemoFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
framespertic = clamp(framespertic, 0, 8)+1;
|
||||
// TODO: repeat count and gathering statistics.
|
||||
initprintf("Profile demo %s, %d frames/gametic, repeated 1x.\n", g_firstDemoFile,
|
||||
framespertic-1);
|
||||
Demo_PlayFirst(framespertic, 1);
|
||||
g_noLogo = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void G_CheckCommandLine(int32_t argc, char const * const * argv)
|
||||
{
|
||||
int16_t i = 1, j;
|
||||
const char *c, *k;
|
||||
|
||||
ud.fta_on = 1;
|
||||
ud.god = 0;
|
||||
ud.m_respawn_items = 0;
|
||||
ud.m_respawn_monsters = 0;
|
||||
ud.m_respawn_inventory = 0;
|
||||
ud.warp_on = 0;
|
||||
ud.cashman = 0;
|
||||
ud.m_player_skill = ud.player_skill = 2;
|
||||
g_player[0].wchoice[0] = 3;
|
||||
g_player[0].wchoice[1] = 4;
|
||||
g_player[0].wchoice[2] = 5;
|
||||
g_player[0].wchoice[3] = 7;
|
||||
g_player[0].wchoice[4] = 8;
|
||||
g_player[0].wchoice[5] = 6;
|
||||
g_player[0].wchoice[6] = 0;
|
||||
g_player[0].wchoice[7] = 2;
|
||||
g_player[0].wchoice[8] = 9;
|
||||
g_player[0].wchoice[9] = 1;
|
||||
Bsprintf(ud.wchoice, "3457860291");
|
||||
|
||||
#ifdef HAVE_CLIPSHAPE_FEATURE
|
||||
// pre-form the default 10 clipmaps
|
||||
for (j = '0'; j<='9'; ++j)
|
||||
{
|
||||
char clipshape[16] = "_clipshape0.map";
|
||||
|
||||
clipshape[10] = j;
|
||||
g_clipMapFiles.append(Xstrdup(clipshape));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
initprintf("Application parameters: ");
|
||||
while (i < argc)
|
||||
initprintf("%s ", argv[i++]);
|
||||
initprintf("\n");
|
||||
|
||||
i = 1;
|
||||
do
|
||||
{
|
||||
const char *const oc = argv[i];
|
||||
int32_t shortopt = 0, ignored_short_opt = 0;
|
||||
|
||||
c = oc;
|
||||
|
||||
if ((*c == '-')
|
||||
#ifdef _WIN32
|
||||
|| (*c == '/')
|
||||
#endif
|
||||
)
|
||||
{
|
||||
shortopt = 0;
|
||||
|
||||
if (!Bstrcasecmp(c+1, "?") || !Bstrcasecmp(c+1, "help") || !Bstrcasecmp(c+1, "-help"))
|
||||
{
|
||||
G_ShowParameterHelp();
|
||||
Bexit(0);
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "addon"))
|
||||
{
|
||||
if (argc > i+1)
|
||||
{
|
||||
g_addonNum = Batoi(argv[i+1]);
|
||||
|
||||
if (g_addonNum > ADDON_NONE && g_addonNum < NUMADDONS)
|
||||
g_noSetup = 1;
|
||||
else g_addonNum = ADDON_NONE;
|
||||
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "debughelp") || !Bstrcasecmp(c+1, "-debughelp"))
|
||||
{
|
||||
G_ShowDebugHelp();
|
||||
Bexit(0);
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "grp") || !Bstrcasecmp(c+1, "g"))
|
||||
{
|
||||
if (argc > i+1)
|
||||
{
|
||||
G_AddGroup(argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "game_dir"))
|
||||
{
|
||||
if (argc > i+1)
|
||||
{
|
||||
Bstrncpyz(g_modDir, argv[i+1], sizeof(g_modDir));
|
||||
G_AddPath(argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "cfg"))
|
||||
{
|
||||
if (argc > i+1)
|
||||
{
|
||||
Bstrcpy(g_setupFileName, argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "gamegrp"))
|
||||
{
|
||||
if (argc > i+1)
|
||||
{
|
||||
clearGrpNamePtr();
|
||||
g_grpNamePtr = dup_filename(argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "setup"))
|
||||
{
|
||||
g_commandSetup = TRUE;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "nosetup"))
|
||||
{
|
||||
g_noSetup = 1;
|
||||
g_commandSetup = 0;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
#if defined RENDERTYPEWIN
|
||||
if (!Bstrcasecmp(c+1, "nodinput"))
|
||||
{
|
||||
initprintf("DirectInput (joystick) support disabled\n");
|
||||
di_disabled = 1;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (!Bstrcasecmp(c+1, "noautoload"))
|
||||
{
|
||||
initprintf("Autoload disabled\n");
|
||||
g_noAutoLoad = 1;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
#ifndef NETCODE_DISABLE
|
||||
if (!Bstrcasecmp(c+1, "net"))
|
||||
{
|
||||
G_GameExit("EDuke32 no longer supports legacy networking.\n\n"
|
||||
"If using YANG or other launchers that only support legacy netplay, download an older build of EDuke32. "
|
||||
"Otherwise, run the following:\n\n"
|
||||
"eduke32 -server\n\n"
|
||||
"Other clients can then connect by typing \"connect [host]\" in the console.\n\n"
|
||||
"EDuke32 will now close.");
|
||||
}
|
||||
#endif
|
||||
if (!Bstrcasecmp(c+1, "port"))
|
||||
{
|
||||
if (argc > i+1)
|
||||
{
|
||||
g_netPort = Batoi(argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
#ifndef NETCODE_DISABLE
|
||||
if (!Bstrcasecmp(c+1, "server"))
|
||||
{
|
||||
g_networkMode = NET_SERVER;
|
||||
g_noSetup = g_noLogo = TRUE;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "dedicated"))
|
||||
{
|
||||
g_networkMode = NET_DEDICATED_SERVER;
|
||||
g_noSetup = g_noLogo = TRUE;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "connect"))
|
||||
{
|
||||
if (argc > i+1)
|
||||
{
|
||||
Net_Connect(argv[i+1]);
|
||||
g_noSetup = g_noLogo = TRUE;
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "password"))
|
||||
{
|
||||
if (argc > i+1)
|
||||
{
|
||||
Bstrncpyz(g_netPassword, argv[i+1], sizeof(g_netPassword));
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (!Bstrcasecmp(c+1, "name"))
|
||||
{
|
||||
if (argc > i+1)
|
||||
{
|
||||
CommandName = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "map"))
|
||||
{
|
||||
if (argc > i+1)
|
||||
{
|
||||
CommandMap = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "rts"))
|
||||
{
|
||||
if (argc > i+1)
|
||||
{
|
||||
free(g_rtsNamePtr);
|
||||
g_rtsNamePtr = dup_filename(argv[i+1]);
|
||||
initprintf("Using RTS file \"%s\".\n", g_rtsNamePtr);
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "x"))
|
||||
{
|
||||
if (argc > i+1)
|
||||
{
|
||||
G_AddCon(argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "mx"))
|
||||
{
|
||||
if (argc > i+1)
|
||||
{
|
||||
G_AddConModule(argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "h"))
|
||||
{
|
||||
if (argc > i+1)
|
||||
{
|
||||
G_AddDef(argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "mh"))
|
||||
{
|
||||
if (argc > i+1)
|
||||
{
|
||||
G_AddDefModule(argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "j"))
|
||||
{
|
||||
if (argc > i+1)
|
||||
{
|
||||
G_AddPath(argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "d"))
|
||||
{
|
||||
if (argc > i+1)
|
||||
{
|
||||
G_AddDemo(argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
#ifdef HAVE_CLIPSHAPE_FEATURE
|
||||
if (!Bstrcasecmp(c+1, "clipmap"))
|
||||
{
|
||||
if (argc > i+1)
|
||||
{
|
||||
G_AddClipMap(argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (!Bstrcasecmp(c+1, "condebug"))
|
||||
{
|
||||
g_scriptDebug = 1;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "nologo"))
|
||||
{
|
||||
g_noLogo = 1;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "rotatesprite-no-widescreen"))
|
||||
{
|
||||
g_rotatespriteNoWidescreen = 1;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "usecwd"))
|
||||
{
|
||||
g_useCwd = 1;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "cachesize"))
|
||||
{
|
||||
if (argc > i+1)
|
||||
{
|
||||
uint32_t j = Batol(argv[i+1]);
|
||||
MAXCACHE1DSIZE = j<<10;
|
||||
initprintf("Cache size: %dkB\n", j);
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "noinstancechecking"))
|
||||
{
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
#if defined(RENDERTYPEWIN) && defined(USE_OPENGL)
|
||||
if (!Bstrcasecmp(c+1, "forcegl"))
|
||||
{
|
||||
forcegl = 1;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
// the following two dummy entries allow us to serve as a drop-in replacement for NAM on Steam
|
||||
if (!Bstrcasecmp(c+1, "noconsole"))
|
||||
{
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "conf"))
|
||||
{
|
||||
if (argc > i+1)
|
||||
i++;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ((*c == '-')
|
||||
#ifdef _WIN32
|
||||
|| (*c == '/')
|
||||
#endif
|
||||
)
|
||||
{
|
||||
shortopt = 1;
|
||||
|
||||
c++;
|
||||
switch (Btolower(*c))
|
||||
{
|
||||
case 'a':
|
||||
ud.playerai = 1;
|
||||
initprintf("Other player AI.\n");
|
||||
break;
|
||||
case 'c':
|
||||
c++;
|
||||
ud.m_coop = 0;
|
||||
while ((*c >= '0')&&(*c <= '9'))
|
||||
{
|
||||
ud.m_coop *= 10;
|
||||
ud.m_coop += *c - '0';
|
||||
c++;
|
||||
}
|
||||
ud.m_coop--;
|
||||
break;
|
||||
case 'd':
|
||||
{
|
||||
c++;
|
||||
if (*c)
|
||||
G_AddDemo(c);
|
||||
break;
|
||||
}
|
||||
case 'g':
|
||||
c++;
|
||||
if (*c)
|
||||
G_AddGroup(c);
|
||||
break;
|
||||
case 'h':
|
||||
c++;
|
||||
if (*c)
|
||||
G_AddDef(c);
|
||||
break;
|
||||
case 'j':
|
||||
c++;
|
||||
if (*c)
|
||||
G_AddPath(c);
|
||||
break;
|
||||
case 'l':
|
||||
// NOTE: Overlaid with -Lopts=... options for Lunatic, hence the check.
|
||||
if (Bisdigit(c[1]))
|
||||
{
|
||||
ud.warp_on = 1;
|
||||
c++;
|
||||
ud.m_level_number = ud.level_number = ((unsigned) (Batoi(c)-1))%MAXLEVELS;
|
||||
}
|
||||
break;
|
||||
case 'm':
|
||||
if (*(c+1) != 'a' && *(c+1) != 'A')
|
||||
{
|
||||
ud.m_monsters_off = 1;
|
||||
ud.m_player_skill = ud.player_skill = 0;
|
||||
initprintf("Monsters off.\n");
|
||||
}
|
||||
break;
|
||||
case 'n':
|
||||
c++;
|
||||
if (*c == 's' || *c == 'S')
|
||||
{
|
||||
g_noSound = 2;
|
||||
initprintf("Sound off.\n");
|
||||
}
|
||||
else if (*c == 'm' || *c == 'M')
|
||||
{
|
||||
g_noMusic = 1;
|
||||
initprintf("Music off.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
G_ShowParameterHelp();
|
||||
exit(-1);
|
||||
}
|
||||
break;
|
||||
case 'q':
|
||||
if (*(++c) == 0)
|
||||
{
|
||||
ud.multimode = 1;
|
||||
initprintf("Fake multiplayer mode: expected number after -q, falling back to 1 player.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
int32_t numpl = Batoi(c);
|
||||
|
||||
if (numpl < 2 || numpl > MAXPLAYERS)
|
||||
{
|
||||
initprintf("Fake multiplayer mode: expected 2-%d players, falling back to 1.\n",
|
||||
MAXPLAYERS);
|
||||
}
|
||||
else
|
||||
{
|
||||
ud.multimode = numpl;
|
||||
initprintf("Fake multiplayer mode: %d players.\n", ud.multimode);
|
||||
|
||||
g_fakeMultiMode = numpl;
|
||||
}
|
||||
}
|
||||
|
||||
ud.m_coop = ud.coop = 0;
|
||||
ud.m_marker = ud.marker = 1;
|
||||
ud.m_respawn_monsters = ud.respawn_monsters = 1;
|
||||
ud.m_respawn_items = ud.respawn_items = 1;
|
||||
ud.m_respawn_inventory = ud.respawn_inventory = 1;
|
||||
break;
|
||||
case 'r':
|
||||
ud.m_recstat = 1;
|
||||
initprintf("Demo record mode on.\n");
|
||||
break;
|
||||
case 's':
|
||||
c++;
|
||||
ud.m_player_skill = ud.player_skill = (Batoi(c)%5);
|
||||
if (ud.m_player_skill == 4)
|
||||
ud.m_respawn_monsters = ud.respawn_monsters = 1;
|
||||
break;
|
||||
case 't':
|
||||
c++;
|
||||
if (*c == '1') ud.m_respawn_monsters = 1;
|
||||
else if (*c == '2') ud.m_respawn_items = 1;
|
||||
else if (*c == '3') ud.m_respawn_inventory = 1;
|
||||
else
|
||||
{
|
||||
ud.m_respawn_monsters = 1;
|
||||
ud.m_respawn_items = 1;
|
||||
ud.m_respawn_inventory = 1;
|
||||
}
|
||||
initprintf("Respawn on.\n");
|
||||
break;
|
||||
case 'u':
|
||||
g_forceWeaponChoice = 1;
|
||||
c++;
|
||||
j = 0;
|
||||
if (*c)
|
||||
{
|
||||
initprintf("Using favorite weapon order(s).\n");
|
||||
while (*c)
|
||||
{
|
||||
g_player[0].wchoice[j] = *c-'0';
|
||||
ud.wchoice[j] = *c;
|
||||
c++;
|
||||
j++;
|
||||
}
|
||||
|
||||
while (j < 10)
|
||||
{
|
||||
if (j == 9)
|
||||
{
|
||||
g_player[0].wchoice[9] = 1;
|
||||
ud.wchoice[9] = '1';
|
||||
}
|
||||
else
|
||||
{
|
||||
g_player[0].wchoice[j] = 2;
|
||||
ud.wchoice[j] = '2';
|
||||
}
|
||||
|
||||
j++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
initprintf("Using default weapon orders.\n");
|
||||
g_player[0].wchoice[0] = 3;
|
||||
g_player[0].wchoice[1] = 4;
|
||||
g_player[0].wchoice[2] = 5;
|
||||
g_player[0].wchoice[3] = 7;
|
||||
g_player[0].wchoice[4] = 8;
|
||||
g_player[0].wchoice[5] = 6;
|
||||
g_player[0].wchoice[6] = 0;
|
||||
g_player[0].wchoice[7] = 2;
|
||||
g_player[0].wchoice[8] = 9;
|
||||
g_player[0].wchoice[9] = 1;
|
||||
|
||||
Bsprintf(ud.wchoice, "3457860291");
|
||||
}
|
||||
break;
|
||||
case 'v':
|
||||
c++;
|
||||
ud.warp_on = 1;
|
||||
ud.m_volume_number = ud.volume_number = ((unsigned) (Batoi(c)-1))%MAXVOLUMES;
|
||||
break;
|
||||
case 'w':
|
||||
ud.coords = 1;
|
||||
break;
|
||||
case 'x':
|
||||
c++;
|
||||
if (*c)
|
||||
G_AddCon(c);
|
||||
break;
|
||||
case 'z':
|
||||
c++;
|
||||
g_scriptDebug = Batoi(c);
|
||||
if (!g_scriptDebug)
|
||||
g_scriptDebug = 1;
|
||||
break;
|
||||
default:
|
||||
ignored_short_opt = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
shortopt = 0;
|
||||
|
||||
k = Bstrrchr(c, '.');
|
||||
if (k)
|
||||
{
|
||||
if (!Bstrcasecmp(k, ".map"))
|
||||
{
|
||||
CommandMap = argv[i++];
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(k, ".grp") || !Bstrcasecmp(k, ".zip") || !Bstrcasecmp(k, ".pk3") || !Bstrcasecmp(k, ".pk4"))
|
||||
{
|
||||
G_AddGroup(argv[i++]);
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(k, ".con"))
|
||||
{
|
||||
clearScriptNamePtr();
|
||||
g_scriptNamePtr = dup_filename(argv[i++]);
|
||||
initprintf("Using CON file \"%s\".\n", g_scriptNamePtr);
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(k, ".def"))
|
||||
{
|
||||
clearDefNamePtr();
|
||||
g_defNamePtr = dup_filename(argv[i++]);
|
||||
initprintf("Using DEF file \"%s\".\n", g_defNamePtr);
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(k, ".rts"))
|
||||
{
|
||||
free(g_rtsNamePtr);
|
||||
g_rtsNamePtr = dup_filename(argv[i++]);
|
||||
initprintf("Using RTS file \"%s\".\n", g_rtsNamePtr);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!shortopt || ignored_short_opt)
|
||||
initprintf("Warning: ignored application parameter \"%s\".\n", oc);
|
||||
|
||||
i++;
|
||||
} while (i < argc);
|
||||
}
|
||||
}
|
35
source/rr/src/cmdline.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2016 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
extern void G_CheckCommandLine(int32_t argc, char const * const * argv);
|
||||
extern void G_ShowParameterHelp(void);
|
||||
extern void G_ShowDebugHelp(void);
|
||||
|
||||
extern int32_t g_commandSetup;
|
||||
extern int32_t g_noSetup;
|
||||
extern int32_t g_noAutoLoad;
|
||||
extern int32_t g_noSound;
|
||||
extern int32_t g_noMusic;
|
||||
extern const char *CommandMap;
|
||||
extern const char *CommandName;
|
||||
extern int32_t g_forceWeaponChoice;
|
||||
extern int32_t g_fakeMultiMode;
|
1208
source/rr/src/common.cpp
Normal file
170
source/rr/src/common_game.h
Normal file
|
@ -0,0 +1,170 @@
|
|||
//
|
||||
// Definitions of common game-only data structures/functions
|
||||
// (and declarations of data appearing in both)
|
||||
// for EDuke32 and Mapster32
|
||||
//
|
||||
|
||||
#ifndef EDUKE32_COMMON_GAME_H_
|
||||
#define EDUKE32_COMMON_GAME_H_
|
||||
|
||||
#include "grpscan.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int g_useCwd;
|
||||
|
||||
#ifndef APPNAME
|
||||
#define APPNAME "Rednukem"
|
||||
#endif
|
||||
|
||||
#ifndef APPBASENAME
|
||||
#define APPBASENAME "rednukem"
|
||||
#endif
|
||||
|
||||
#define GAMEFLAG_DUKE 0x00000001
|
||||
#define GAMEFLAG_RR 0x00000002
|
||||
#define GAMEFLAG_RRRA 0x00000004
|
||||
//#define GAMEFLAG_NAM 0x00000002
|
||||
//#define GAMEFLAG_NAPALM 0x00000004
|
||||
//#define GAMEFLAG_WW2GI 0x00000008
|
||||
#define GAMEFLAG_ADDON 0x00000010
|
||||
#define GAMEFLAG_SHAREWARE 0x00000020
|
||||
//#define GAMEFLAG_DUKEBETA 0x00000060 // includes 0x20 since it's a shareware beta
|
||||
//#define GAMEFLAG_IONMAIDEN 0x00000080
|
||||
//#define GAMEFLAG_STANDALONE 0x00000100
|
||||
#define GAMEFLAGMASK 0x000000FF // flags allowed from grpinfo
|
||||
|
||||
extern struct grpfile_t const *g_selectedGrp;
|
||||
|
||||
extern int32_t g_gameType;
|
||||
extern int g_addonNum;
|
||||
|
||||
#define DUKE (g_gameType & GAMEFLAG_DUKE)
|
||||
#define RR (g_gameType & GAMEFLAG_RR)
|
||||
#define RRRA (g_gameType & GAMEFLAG_RRRA)
|
||||
//#define NAM (g_gameType & GAMEFLAG_NAM)
|
||||
//#define NAPALM (g_gameType & GAMEFLAG_NAPALM)
|
||||
//#define WW2GI (g_gameType & GAMEFLAG_WW2GI)
|
||||
//#define NAM_WW2GI (g_gameType & (GAMEFLAG_NAM|GAMEFLAG_WW2GI))
|
||||
#define SHAREWARE (g_gameType & GAMEFLAG_SHAREWARE)
|
||||
//#define DUKEBETA ((g_gameType & GAMEFLAG_DUKEBETA) == GAMEFLAG_DUKEBETA)
|
||||
//#define IONMAIDEN (g_gameType & GAMEFLAG_IONMAIDEN)
|
||||
|
||||
enum Games_t {
|
||||
GAME_DUKE = 0,
|
||||
GAME_RR,
|
||||
GAME_RRRA,
|
||||
//GAME_NAM,
|
||||
//GAME_NAPALM,
|
||||
//GAME_WW2GI,
|
||||
GAMECOUNT
|
||||
};
|
||||
|
||||
enum instpath_t {
|
||||
INSTPATH_STEAM_DUKE3D_MEGATON,
|
||||
INSTPATH_STEAM_DUKE3D_3DR,
|
||||
INSTPATH_GOG_DUKE3D,
|
||||
INSTPATH_3DR_DUKE3D,
|
||||
INSTPATH_3DR_ANTH,
|
||||
//INSTPATH_STEAM_NAM,
|
||||
//INSTPATH_STEAM_WW2GI,
|
||||
INSTPATH_GOG_RR,
|
||||
INSTPATH_GOG_RRRA,
|
||||
NUMINSTPATHS
|
||||
};
|
||||
|
||||
enum searchpathtypes_t {
|
||||
SEARCHPATH_REMOVE = 1<<0,
|
||||
SEARCHPATH_RR = 1<<1,
|
||||
SEARCHPATH_RRRA = 1<<2,
|
||||
};
|
||||
|
||||
typedef enum basepal_ {
|
||||
BASEPAL = 0,
|
||||
WATERPAL,
|
||||
SLIMEPAL,
|
||||
DREALMSPAL,
|
||||
TITLEPAL,
|
||||
ENDINGPAL, // 5
|
||||
ANIMPAL,
|
||||
DRUGPAL,
|
||||
BASEPALCOUNT
|
||||
} basepal_t;
|
||||
|
||||
#define OSDTEXT_DEFAULT "^00"
|
||||
#define OSDTEXT_DARKRED "^10"
|
||||
#define OSDTEXT_GREEN "^11"
|
||||
#define OSDTEXT_RED "^21"
|
||||
#define OSDTEXT_YELLOW "^23"
|
||||
|
||||
#define OSDTEXT_BRIGHT "^S0"
|
||||
|
||||
#define OSD_ERROR OSDTEXT_DARKRED OSDTEXT_BRIGHT
|
||||
|
||||
extern const char *g_gameNamePtr;
|
||||
|
||||
extern char *g_grpNamePtr;
|
||||
extern char *g_scriptNamePtr;
|
||||
extern char *g_rtsNamePtr;
|
||||
|
||||
extern const char *G_DefaultGrpFile(void);
|
||||
extern const char *G_GrpFile(void);
|
||||
|
||||
extern const char *G_DefaultConFile(void);
|
||||
extern const char *G_ConFile(void);
|
||||
|
||||
extern GrowArray<char *> g_scriptModules;
|
||||
|
||||
extern void G_AddCon(const char *buffer);
|
||||
extern void G_AddConModule(const char *buffer);
|
||||
|
||||
extern void clearGrpNamePtr(void);
|
||||
extern void clearScriptNamePtr(void);
|
||||
|
||||
extern int loaddefinitions_game(const char *fn, int32_t preload);
|
||||
extern int32_t g_groupFileHandle;
|
||||
|
||||
//////////
|
||||
|
||||
extern void G_InitMultiPsky(int CLOUDYOCEAN__DYN, int MOONSKY1__DYN, int BIGORBIT1__DYN, int LA__DYN);
|
||||
extern void G_SetupGlobalPsky(void);
|
||||
|
||||
//////////
|
||||
|
||||
extern char g_modDir[BMAX_PATH];
|
||||
extern int kopen4loadfrommod(const char *filename, char searchfirst);
|
||||
extern void G_AddSearchPaths(void);
|
||||
extern void G_CleanupSearchPaths(void);
|
||||
|
||||
extern void G_ExtPreInit(int32_t argc,char const * const * argv);
|
||||
extern void G_ExtInit(void);
|
||||
extern void G_ScanGroups(void);
|
||||
extern void G_LoadGroups(int32_t autoload);
|
||||
|
||||
extern const char * G_GetInstallPath(int32_t insttype);
|
||||
|
||||
//////////
|
||||
|
||||
void G_LoadGroupsInDir(const char *dirname);
|
||||
void G_DoAutoload(const char *dirname);
|
||||
|
||||
//////////
|
||||
|
||||
extern void G_LoadLookups(void);
|
||||
|
||||
//////////
|
||||
|
||||
#if defined HAVE_FLAC || defined HAVE_VORBIS
|
||||
# define FORMAT_UPGRADE_ELIGIBLE
|
||||
extern int32_t S_OpenAudio(const char *fn, char searchfirst, uint8_t ismusic);
|
||||
#else
|
||||
# define S_OpenAudio(fn, searchfirst, ismusic) kopen4loadfrommod(fn, searchfirst)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
973
source/rr/src/config.cpp
Normal file
|
@ -0,0 +1,973 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2016 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#include "duke3d.h"
|
||||
#include "scriplib.h"
|
||||
#include "osdcmds.h"
|
||||
#include "renderlayer.h"
|
||||
#include "cmdline.h"
|
||||
|
||||
#ifdef __ANDROID__
|
||||
# include "android.h"
|
||||
#endif
|
||||
|
||||
#if defined RENDERTYPESDL && defined SDL_TARGET && SDL_TARGET > 1
|
||||
# include "sdl_inc.h"
|
||||
#endif
|
||||
|
||||
// we load this in to get default button and key assignments
|
||||
// as well as setting up function mappings
|
||||
|
||||
#define __SETUP__ // JBF 20031211
|
||||
#include "_functio.h"
|
||||
|
||||
hashtable_t h_gamefuncs = { NUMGAMEFUNCTIONS<<1, NULL };
|
||||
|
||||
int32_t CONFIG_FunctionNameToNum(const char *func)
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
if (!func)
|
||||
return -1;
|
||||
|
||||
i = hash_find(&h_gamefuncs,func);
|
||||
|
||||
if (i < 0)
|
||||
{
|
||||
char *str = Bstrtolower(Xstrdup(func));
|
||||
i = hash_find(&h_gamefuncs,str);
|
||||
Bfree(str);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
char *CONFIG_FunctionNumToName(int32_t func)
|
||||
{
|
||||
if ((unsigned)func >= (unsigned)NUMGAMEFUNCTIONS)
|
||||
return NULL;
|
||||
return gamefunctions[func];
|
||||
}
|
||||
|
||||
|
||||
int32_t CONFIG_AnalogNameToNum(const char *func)
|
||||
{
|
||||
if (!func)
|
||||
return -1;
|
||||
|
||||
if (!Bstrcasecmp(func,"analog_turning"))
|
||||
{
|
||||
return analog_turning;
|
||||
}
|
||||
if (!Bstrcasecmp(func,"analog_strafing"))
|
||||
{
|
||||
return analog_strafing;
|
||||
}
|
||||
if (!Bstrcasecmp(func,"analog_moving"))
|
||||
{
|
||||
return analog_moving;
|
||||
}
|
||||
if (!Bstrcasecmp(func,"analog_lookingupanddown"))
|
||||
{
|
||||
return analog_lookingupanddown;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
const char *CONFIG_AnalogNumToName(int32_t func)
|
||||
{
|
||||
switch (func)
|
||||
{
|
||||
case analog_turning:
|
||||
return "analog_turning";
|
||||
case analog_strafing:
|
||||
return "analog_strafing";
|
||||
case analog_moving:
|
||||
return "analog_moving";
|
||||
case analog_lookingupanddown:
|
||||
return "analog_lookingupanddown";
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void CONFIG_SetDefaultKeys(const char (*keyptr)[MAXGAMEFUNCLEN])
|
||||
{
|
||||
Bmemset(ud.config.KeyboardKeys, 0xff, sizeof(ud.config.KeyboardKeys));
|
||||
|
||||
CONTROL_ClearAllBinds();
|
||||
|
||||
for (size_t i=0; i < ARRAY_SIZE(gamefunctions); ++i)
|
||||
{
|
||||
if (gamefunctions[i][0] == '\0')
|
||||
continue;
|
||||
|
||||
ud.config.KeyboardKeys[i][0] = KB_StringToScanCode(keyptr[i<<1]);
|
||||
ud.config.KeyboardKeys[i][1] = KB_StringToScanCode(keyptr[(i<<1)+1]);
|
||||
|
||||
if (i == gamefunc_Show_Console)
|
||||
OSD_CaptureKey(ud.config.KeyboardKeys[i][0]);
|
||||
else
|
||||
CONFIG_MapKey(i, ud.config.KeyboardKeys[i][0], 0, ud.config.KeyboardKeys[i][1], 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CONFIG_SetDefaults(void)
|
||||
{
|
||||
// JBF 20031211
|
||||
int32_t i;
|
||||
|
||||
ud.config.scripthandle = -1;
|
||||
#ifdef __ANDROID__
|
||||
droidinput.forward_sens = 5.f;
|
||||
droidinput.strafe_sens = 5.f;
|
||||
droidinput.pitch_sens = 5.f;
|
||||
droidinput.yaw_sens = 5.f;
|
||||
droidinput.hideStick = 0;
|
||||
droidinput.gameControlsAlpha = 0.5;
|
||||
droidinput.toggleCrouch = 1;
|
||||
droidinput.quickSelectWeapon = 1;
|
||||
|
||||
ud.config.ScreenWidth = droidinfo.screen_width;
|
||||
ud.config.ScreenHeight = droidinfo.screen_height;
|
||||
#else
|
||||
# if defined RENDERTYPESDL && SDL_MAJOR_VERSION > 1
|
||||
uint32_t inited = SDL_WasInit(SDL_INIT_VIDEO);
|
||||
if (inited == 0)
|
||||
SDL_Init(SDL_INIT_VIDEO);
|
||||
else if (!(inited & SDL_INIT_VIDEO))
|
||||
SDL_InitSubSystem(SDL_INIT_VIDEO);
|
||||
|
||||
SDL_DisplayMode dm;
|
||||
if (SDL_GetDesktopDisplayMode(0, &dm) == 0)
|
||||
{
|
||||
ud.config.ScreenWidth = dm.w;
|
||||
ud.config.ScreenHeight = dm.h;
|
||||
}
|
||||
else
|
||||
# endif
|
||||
{
|
||||
ud.config.ScreenWidth = 1024;
|
||||
ud.config.ScreenHeight = 768;
|
||||
}
|
||||
#endif
|
||||
|
||||
ud.config.ScreenMode = 1;
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
ud.config.ScreenBPP = 32;
|
||||
#else
|
||||
ud.config.ScreenBPP = 8;
|
||||
#endif
|
||||
ud.config.useprecache = 1;
|
||||
ud.config.ForceSetup = 1;
|
||||
ud.config.NoAutoLoad = 1;
|
||||
ud.config.AmbienceToggle = 1;
|
||||
ud.config.AutoAim = 1;
|
||||
ud.config.FXVolume = 255;
|
||||
#if defined(_WIN32)
|
||||
ud.config.MixRate = 44100;
|
||||
#elif defined __ANDROID__
|
||||
ud.config.MixRate = droidinfo.audio_sample_rate;
|
||||
#else
|
||||
ud.config.MixRate = 48000;
|
||||
#endif
|
||||
ud.config.MouseBias = 0;
|
||||
ud.config.MouseDeadZone = 0;
|
||||
ud.config.MusicToggle = 1;
|
||||
ud.config.MusicVolume = 195;
|
||||
g_myAimMode = g_player[0].ps->aim_mode = 1;
|
||||
ud.config.NumBits = 16;
|
||||
ud.config.NumChannels = 2;
|
||||
#if defined GEKKO || defined __OPENDINGUX__
|
||||
ud.config.NumVoices = 32;
|
||||
#else
|
||||
ud.config.NumVoices = 64;
|
||||
#endif
|
||||
ud.config.ReverseStereo = 0;
|
||||
ud.auto_run = 1;
|
||||
ud.config.ShowOpponentWeapons = 0;
|
||||
ud.config.SmoothInput = 1;
|
||||
ud.config.SoundToggle = 1;
|
||||
ud.althud = 1;
|
||||
ud.automsg = 0;
|
||||
ud.autovote = 0;
|
||||
ud.brightness = 8;
|
||||
ud.camerasprite = -1;
|
||||
|
||||
#if defined GEKKO || defined __OPENDINGUX__
|
||||
ud.camera_time = 11;
|
||||
#elif defined(__ANDROID__)
|
||||
ud.camera_time = 7;
|
||||
#else
|
||||
ud.camera_time = 4;
|
||||
#endif
|
||||
|
||||
ud.color = 0;
|
||||
ud.crosshair = 1;
|
||||
ud.crosshairscale = 50;
|
||||
ud.obituaries = 1;
|
||||
ud.democams = 1;
|
||||
ud.detail = 0;
|
||||
ud.drawweapon = 1;
|
||||
ud.idplayers = 1;
|
||||
ud.levelstats = 0;
|
||||
ud.lockout = 0;
|
||||
ud.m_ffire = 1;
|
||||
ud.m_marker = 1;
|
||||
ud.menu_slidebarz = 65536;
|
||||
ud.menu_slidebarmargin = RR ? 6 * 65536 : 65536;
|
||||
ud.menu_slidecursorz = RR ? 32768 : 65536;
|
||||
ud.mouseaiming = 0;
|
||||
ud.mouseflip = 1;
|
||||
ud.msgdisptime = 120;
|
||||
ud.pwlockout[0] = '\0';
|
||||
ud.runkey_mode = 0;
|
||||
ud.screen_size = 4;
|
||||
ud.screen_tilting = 1;
|
||||
ud.shadows = 1;
|
||||
ud.statusbarflags = STATUSBAR_NOSHRINK;
|
||||
ud.statusbarmode = 1;
|
||||
ud.statusbarscale = 100;
|
||||
ud.team = 0;
|
||||
ud.viewbob = 1;
|
||||
ud.weaponsway = 1;
|
||||
ud.weaponswitch = 3; // new+empty
|
||||
ud.angleinterpolation = 0;
|
||||
#ifdef GEKKO
|
||||
ud.config.UseJoystick = 1;
|
||||
#else
|
||||
ud.config.UseJoystick = 0;
|
||||
#endif
|
||||
ud.config.UseMouse = 1;
|
||||
ud.config.VoiceToggle = 5; // bitfield, 1 = local, 2 = dummy, 4 = other players in DM
|
||||
ud.display_bonus_screen = 1;
|
||||
ud.show_level_text = 1;
|
||||
ud.configversion = 0;
|
||||
ud.weaponscale = 100;
|
||||
ud.textscale = 200;
|
||||
ud.screenfade = 1;
|
||||
ud.menubackground = 1;
|
||||
ud.hudontop = 0;
|
||||
ud.default_skill = 1;
|
||||
ud.slidebar_paldisabled = 1;
|
||||
ud.shadow_pal = 4;
|
||||
ud.menu_scrollbartilenum = -1;
|
||||
ud.menu_scrollbarz = 65536;
|
||||
ud.menu_scrollcursorz = 65536;
|
||||
ud.autosave = 1;
|
||||
ud.autosavedeletion = 1;
|
||||
ud.maxautosaves = 5;
|
||||
|
||||
ud.config.CheckForUpdates = 1;
|
||||
|
||||
Bstrcpy(ud.rtsname, G_DefaultRtsFile());
|
||||
|
||||
Bstrcpy(szPlayerName, "Player");
|
||||
|
||||
//if (RR)
|
||||
//{
|
||||
// Bstrcpy(ud.ridecule[0], "Yer as ugly as a mud fence!");
|
||||
// Bstrcpy(ud.ridecule[1], "Duck you pecker-head!");
|
||||
// Bstrcpy(ud.ridecule[2], "You like that boy?");
|
||||
// Bstrcpy(ud.ridecule[3], "Yer lower than catfish crap!");
|
||||
// Bstrcpy(ud.ridecule[4], "Eat lead, you shit monkey!");
|
||||
// Bstrcpy(ud.ridecule[5], "You dumb-ass!");
|
||||
// Bstrcpy(ud.ridecule[6], "Yer slower'n a three legged dog!");
|
||||
// Bstrcpy(ud.ridecule[7], "Come on...Squeal like a pig!");
|
||||
// Bstrcpy(ud.ridecule[8], "Haw, haw, haw!");
|
||||
// Bstrcpy(ud.ridecule[9], "Now you gone and done it!");
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
Bstrcpy(ud.ridecule[0], "An inspiration for birth control.");
|
||||
Bstrcpy(ud.ridecule[1], "You're gonna die for that!");
|
||||
Bstrcpy(ud.ridecule[2], "It hurts to be you.");
|
||||
Bstrcpy(ud.ridecule[3], "Lucky son of a bitch.");
|
||||
Bstrcpy(ud.ridecule[4], "Hmmm... payback time.");
|
||||
Bstrcpy(ud.ridecule[5], "You bottom dwelling scum sucker.");
|
||||
Bstrcpy(ud.ridecule[6], "Damn, you're ugly.");
|
||||
Bstrcpy(ud.ridecule[7], "Ha ha ha... wasted!");
|
||||
Bstrcpy(ud.ridecule[8], "You suck!");
|
||||
Bstrcpy(ud.ridecule[9], "AARRRGHHHHH!!!");
|
||||
//}
|
||||
|
||||
// JBF 20031211
|
||||
|
||||
if (RR)
|
||||
{
|
||||
Bstrcpy((char*)keydefaults[gamefunc_Holo_Duke<<1], "B");
|
||||
Bstrcpy((char*)keydefaults[gamefunc_Jetpack<<1], "C");
|
||||
Bstrcpy((char*)keydefaults[gamefunc_NightVision<<1], "Y");
|
||||
Bstrcpy((char*)keydefaults[gamefunc_MedKit<<1], "R");
|
||||
Bstrcpy((char*)keydefaults[gamefunc_Steroids<<1], "M");
|
||||
Bstrcpy((char*)keydefaults[gamefunc_Show_Opponents_Weapon<<1], "V");
|
||||
|
||||
Bstrcpy((char*)oldkeydefaults[gamefunc_Holo_Duke<<1], "B");
|
||||
Bstrcpy((char*)oldkeydefaults[gamefunc_Jetpack<<1], "C");
|
||||
Bstrcpy((char*)oldkeydefaults[gamefunc_NightVision<<1], "Y");
|
||||
Bstrcpy((char*)oldkeydefaults[gamefunc_MedKit<<1], "W");
|
||||
Bstrcpy((char*)oldkeydefaults[gamefunc_Steroids<<1], "M");
|
||||
Bstrcpy((char*)oldkeydefaults[gamefunc_Show_Opponents_Weapon<<1], "E");
|
||||
Bstrcpy((char*)oldkeydefaults[gamefunc_Show_Console<<1], "V");
|
||||
}
|
||||
|
||||
CONFIG_SetDefaultKeys(keydefaults);
|
||||
|
||||
memset(ud.config.MouseFunctions, -1, sizeof(ud.config.MouseFunctions));
|
||||
for (i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
ud.config.MouseFunctions[i][0] = CONFIG_FunctionNameToNum(mousedefaults[i]);
|
||||
CONTROL_MapButton(ud.config.MouseFunctions[i][0], i, 0, controldevice_mouse);
|
||||
if (i>=4) continue;
|
||||
ud.config.MouseFunctions[i][1] = CONFIG_FunctionNameToNum(mouseclickeddefaults[i]);
|
||||
CONTROL_MapButton(ud.config.MouseFunctions[i][1], i, 1, controldevice_mouse);
|
||||
}
|
||||
|
||||
memset(ud.config.MouseDigitalFunctions, -1, sizeof(ud.config.MouseDigitalFunctions));
|
||||
for (i=0; i<MAXMOUSEAXES; i++)
|
||||
{
|
||||
ud.config.MouseAnalogueScale[i] = DEFAULTMOUSEANALOGUESCALE;
|
||||
CONTROL_SetAnalogAxisScale(i, ud.config.MouseAnalogueScale[i], controldevice_mouse);
|
||||
|
||||
ud.config.MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(mousedigitaldefaults[i*2]);
|
||||
ud.config.MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(mousedigitaldefaults[i*2+1]);
|
||||
CONTROL_MapDigitalAxis(i, ud.config.MouseDigitalFunctions[i][0], 0, controldevice_mouse);
|
||||
CONTROL_MapDigitalAxis(i, ud.config.MouseDigitalFunctions[i][1], 1, controldevice_mouse);
|
||||
|
||||
ud.config.MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(mouseanalogdefaults[i]);
|
||||
CONTROL_MapAnalogAxis(i, ud.config.MouseAnalogueAxes[i], controldevice_mouse);
|
||||
}
|
||||
CONTROL_MouseSensitivity = DEFAULTMOUSESENSITIVITY;
|
||||
|
||||
memset(ud.config.JoystickFunctions, -1, sizeof(ud.config.JoystickFunctions));
|
||||
for (i=0; i<MAXJOYBUTTONSANDHATS; i++)
|
||||
{
|
||||
ud.config.JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(joystickdefaults[i]);
|
||||
ud.config.JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(joystickclickeddefaults[i]);
|
||||
CONTROL_MapButton(ud.config.JoystickFunctions[i][0], i, 0, controldevice_joystick);
|
||||
CONTROL_MapButton(ud.config.JoystickFunctions[i][1], i, 1, controldevice_joystick);
|
||||
}
|
||||
|
||||
memset(ud.config.JoystickDigitalFunctions, -1, sizeof(ud.config.JoystickDigitalFunctions));
|
||||
for (i=0; i<MAXJOYAXES; i++)
|
||||
{
|
||||
ud.config.JoystickAnalogueScale[i] = DEFAULTJOYSTICKANALOGUESCALE;
|
||||
ud.config.JoystickAnalogueDead[i] = DEFAULTJOYSTICKANALOGUEDEAD;
|
||||
ud.config.JoystickAnalogueSaturate[i] = DEFAULTJOYSTICKANALOGUESATURATE;
|
||||
CONTROL_SetAnalogAxisScale(i, ud.config.JoystickAnalogueScale[i], controldevice_joystick);
|
||||
|
||||
ud.config.JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(joystickdigitaldefaults[i*2]);
|
||||
ud.config.JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(joystickdigitaldefaults[i*2+1]);
|
||||
CONTROL_MapDigitalAxis(i, ud.config.JoystickDigitalFunctions[i][0], 0, controldevice_joystick);
|
||||
CONTROL_MapDigitalAxis(i, ud.config.JoystickDigitalFunctions[i][1], 1, controldevice_joystick);
|
||||
|
||||
ud.config.JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(joystickanalogdefaults[i]);
|
||||
CONTROL_MapAnalogAxis(i, ud.config.JoystickAnalogueAxes[i], controldevice_joystick);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// wrapper for CONTROL_MapKey(), generates key bindings to reflect changes to keyboard setup
|
||||
void CONFIG_MapKey(int32_t which, kb_scancode key1, kb_scancode oldkey1, kb_scancode key2, kb_scancode oldkey2)
|
||||
{
|
||||
int32_t i, j, k;
|
||||
int32_t ii[] = { key1, key2, oldkey1, oldkey2 };
|
||||
char buf[2*MAXGAMEFUNCLEN];
|
||||
|
||||
UNREFERENCED_PARAMETER(which);
|
||||
// CONTROL_MapKey(which, key1, key2);
|
||||
|
||||
if (which == gamefunc_Show_Console)
|
||||
OSD_CaptureKey(key1);
|
||||
|
||||
for (k = 0; (unsigned)k < ARRAY_SIZE(ii); k++)
|
||||
{
|
||||
if (ii[k] == 0xff || !ii[k])
|
||||
continue;
|
||||
|
||||
for (j=0; ConsoleKeys[j].name; j++)
|
||||
if (ii[k] == ConsoleKeys[j].id)
|
||||
break;
|
||||
|
||||
tempbuf[0] = 0;
|
||||
|
||||
for (i=NUMGAMEFUNCTIONS-1; i>=0; i--)
|
||||
{
|
||||
if (ud.config.KeyboardKeys[i][0] == ii[k] || ud.config.KeyboardKeys[i][1] == ii[k])
|
||||
{
|
||||
Bsprintf(buf,"gamefunc_%s; ",CONFIG_FunctionNumToName(i));
|
||||
Bstrcat(tempbuf,buf);
|
||||
}
|
||||
}
|
||||
|
||||
i = Bstrlen(tempbuf);
|
||||
if (i >= 2)
|
||||
{
|
||||
tempbuf[i-2] = 0; // cut off the trailing "; "
|
||||
CONTROL_BindKey(ii[k], tempbuf, 1, ConsoleKeys[j].name ? ConsoleKeys[j].name : "<?>");
|
||||
}
|
||||
else
|
||||
{
|
||||
CONTROL_FreeKeyBind(ii[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CONFIG_SetupMouse(void)
|
||||
{
|
||||
int32_t i;
|
||||
char str[80];
|
||||
char temp[80];
|
||||
int32_t scale;
|
||||
|
||||
if (ud.config.scripthandle < 0) return;
|
||||
|
||||
for (i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
Bsprintf(str,"MouseButton%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp))
|
||||
ud.config.MouseFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseButtonClicked%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp))
|
||||
ud.config.MouseFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
}
|
||||
|
||||
// map over the axes
|
||||
for (i=0; i<MAXMOUSEAXES; i++)
|
||||
{
|
||||
Bsprintf(str,"MouseAnalogAxes%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
|
||||
if (CONFIG_AnalogNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
|
||||
ud.config.MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseDigitalAxes%d_0",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
|
||||
if (CONFIG_FunctionNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
|
||||
ud.config.MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseDigitalAxes%d_1",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
|
||||
if (CONFIG_FunctionNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
|
||||
ud.config.MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseAnalogScale%d",i);
|
||||
scale = ud.config.MouseAnalogueScale[i];
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale);
|
||||
ud.config.MouseAnalogueScale[i] = scale;
|
||||
}
|
||||
|
||||
{
|
||||
tempbuf[0] = 0;
|
||||
SCRIPT_GetString(ud.config.scripthandle, "Controls","Mouse_Sensitivity",&tempbuf[0]);
|
||||
if (tempbuf[0]) CONTROL_MouseSensitivity = atof(tempbuf);
|
||||
}
|
||||
|
||||
for (i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
CONTROL_MapButton(ud.config.MouseFunctions[i][0], i, 0, controldevice_mouse);
|
||||
CONTROL_MapButton(ud.config.MouseFunctions[i][1], i, 1, controldevice_mouse);
|
||||
}
|
||||
for (i=0; i<MAXMOUSEAXES; i++)
|
||||
{
|
||||
CONTROL_MapAnalogAxis(i, ud.config.MouseAnalogueAxes[i], controldevice_mouse);
|
||||
CONTROL_MapDigitalAxis(i, ud.config.MouseDigitalFunctions[i][0], 0,controldevice_mouse);
|
||||
CONTROL_MapDigitalAxis(i, ud.config.MouseDigitalFunctions[i][1], 1,controldevice_mouse);
|
||||
CONTROL_SetAnalogAxisScale(i, ud.config.MouseAnalogueScale[i], controldevice_mouse);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CONFIG_SetupJoystick(void)
|
||||
{
|
||||
int32_t i;
|
||||
char str[80];
|
||||
char temp[80];
|
||||
int32_t scale;
|
||||
|
||||
if (ud.config.scripthandle < 0) return;
|
||||
|
||||
for (i=0; i<MAXJOYBUTTONSANDHATS; i++)
|
||||
{
|
||||
Bsprintf(str,"JoystickButton%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp))
|
||||
ud.config.JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"JoystickButtonClicked%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp))
|
||||
ud.config.JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
}
|
||||
|
||||
// map over the axes
|
||||
for (i=0; i<MAXJOYAXES; i++)
|
||||
{
|
||||
Bsprintf(str,"JoystickAnalogAxes%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
|
||||
if (CONFIG_AnalogNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
|
||||
ud.config.JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"JoystickDigitalAxes%d_0",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
|
||||
if (CONFIG_FunctionNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
|
||||
ud.config.JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"JoystickDigitalAxes%d_1",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
|
||||
if (CONFIG_FunctionNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
|
||||
ud.config.JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"JoystickAnalogScale%d",i);
|
||||
scale = ud.config.JoystickAnalogueScale[i];
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale);
|
||||
ud.config.JoystickAnalogueScale[i] = scale;
|
||||
|
||||
Bsprintf(str,"JoystickAnalogDead%d",i);
|
||||
scale = ud.config.JoystickAnalogueDead[i];
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale);
|
||||
ud.config.JoystickAnalogueDead[i] = scale;
|
||||
|
||||
Bsprintf(str,"JoystickAnalogSaturate%d",i);
|
||||
scale = ud.config.JoystickAnalogueSaturate[i];
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale);
|
||||
ud.config.JoystickAnalogueSaturate[i] = scale;
|
||||
}
|
||||
|
||||
for (i=0; i<MAXJOYBUTTONSANDHATS; i++)
|
||||
{
|
||||
CONTROL_MapButton(ud.config.JoystickFunctions[i][0], i, 0, controldevice_joystick);
|
||||
CONTROL_MapButton(ud.config.JoystickFunctions[i][1], i, 1, controldevice_joystick);
|
||||
}
|
||||
for (i=0; i<MAXJOYAXES; i++)
|
||||
{
|
||||
CONTROL_MapAnalogAxis(i, ud.config.JoystickAnalogueAxes[i], controldevice_joystick);
|
||||
CONTROL_MapDigitalAxis(i, ud.config.JoystickDigitalFunctions[i][0], 0, controldevice_joystick);
|
||||
CONTROL_MapDigitalAxis(i, ud.config.JoystickDigitalFunctions[i][1], 1, controldevice_joystick);
|
||||
CONTROL_SetAnalogAxisScale(i, ud.config.JoystickAnalogueScale[i], controldevice_joystick);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int32_t CONFIG_ReadSetup(void)
|
||||
{
|
||||
int32_t dummy;
|
||||
char commmacro[] = "CommbatMacro# ";
|
||||
char tempbuf[1024];
|
||||
|
||||
CONTROL_ClearAssignments();
|
||||
CONFIG_SetDefaults();
|
||||
|
||||
ud.config.setupread = 1;
|
||||
pathsearchmode = 1;
|
||||
|
||||
if (ud.config.scripthandle < 0)
|
||||
{
|
||||
ud.config.scripthandle = SCRIPT_Load(g_setupFileName);
|
||||
}
|
||||
|
||||
pathsearchmode = 0;
|
||||
|
||||
if (ud.config.scripthandle < 0)
|
||||
return -1;
|
||||
|
||||
for (dummy = 0; dummy < MAXRIDECULE; dummy++)
|
||||
{
|
||||
commmacro[13] = dummy+'0';
|
||||
SCRIPT_GetString(ud.config.scripthandle, "Comm Setup",commmacro,&ud.ridecule[dummy][0]);
|
||||
}
|
||||
|
||||
Bmemset(tempbuf, 0, sizeof(tempbuf));
|
||||
SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","PlayerName",&tempbuf[0]);
|
||||
|
||||
char nameBuf[64];
|
||||
|
||||
while (Bstrlen(OSD_StripColors(nameBuf, tempbuf)) > 10)
|
||||
tempbuf[Bstrlen(tempbuf) - 1] = '\0';
|
||||
|
||||
Bstrncpyz(szPlayerName, tempbuf, sizeof(szPlayerName));
|
||||
|
||||
SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]);
|
||||
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "ConfigVersion", &ud.configversion);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "ForceSetup", &ud.config.ForceSetup);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "NoAutoLoad", &ud.config.NoAutoLoad);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "CacheSize", &dummy);
|
||||
|
||||
if (dummy > MAXCACHE1DSIZE)
|
||||
MAXCACHE1DSIZE = dummy;
|
||||
|
||||
if (g_noSetup == 0 && g_modDir[0] == '/')
|
||||
{
|
||||
struct Bstat st;
|
||||
SCRIPT_GetString(ud.config.scripthandle, "Setup","ModDir",&g_modDir[0]);
|
||||
|
||||
if (Bstat(g_modDir, &st))
|
||||
{
|
||||
if ((st.st_mode & S_IFDIR) != S_IFDIR)
|
||||
{
|
||||
initprintf("Invalid mod dir in cfg!\n");
|
||||
Bsprintf(g_modDir,"/");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (g_grpNamePtr == NULL && g_addonNum == 0)
|
||||
{
|
||||
SCRIPT_GetStringPtr(ud.config.scripthandle, "Setup","SelectedGRP",&g_grpNamePtr);
|
||||
if (g_grpNamePtr && !Bstrlen(g_grpNamePtr))
|
||||
g_grpNamePtr = dup_filename(G_DefaultGrpFile());
|
||||
}
|
||||
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Out",&ud.lockout);
|
||||
SCRIPT_GetString(ud.config.scripthandle, "Screen Setup","Password",&ud.pwlockout[0]);
|
||||
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenHeight",&ud.config.ScreenHeight);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenMode",&ud.config.ScreenMode);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth",&ud.config.ScreenWidth);
|
||||
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", (int32_t *)&windowpos);
|
||||
|
||||
windowx = -1;
|
||||
windowy = -1;
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", (int32_t *)&windowx);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", (int32_t *)&windowy);
|
||||
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq", (int32_t *)&maxrefreshfreq);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP", &ud.config.ScreenBPP);
|
||||
|
||||
if (ud.config.ScreenBPP < 8) ud.config.ScreenBPP = 32;
|
||||
|
||||
#ifdef POLYMER
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Polymer", &dummy);
|
||||
if (dummy > 0 && ud.config.ScreenBPP >= 16) glrendmode = REND_POLYMER;
|
||||
else glrendmode = REND_POLYMOST;
|
||||
#endif
|
||||
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Executions",&ud.executions);
|
||||
|
||||
#ifdef _WIN32
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", &ud.config.CheckForUpdates);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", &ud.config.LastUpdateCheck);
|
||||
#endif
|
||||
|
||||
ud.config.setupread = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void CONFIG_WriteSettings(void) // save binds and aliases to <cfgname>_settings.cfg
|
||||
{
|
||||
int32_t i;
|
||||
BFILE *fp;
|
||||
char *ptr = Xstrdup(g_setupFileName);
|
||||
char tempbuf[128];
|
||||
|
||||
if (!Bstrcmp(g_setupFileName, SETUPFILENAME))
|
||||
Bsprintf(tempbuf, "settings.cfg");
|
||||
else Bsprintf(tempbuf, "%s_settings.cfg", strtok(ptr, "."));
|
||||
|
||||
fp = Bfopen(tempbuf, "wt");
|
||||
|
||||
if (fp)
|
||||
{
|
||||
Bfprintf(fp,"// this file is automatically generated by %s\n", AppProperName);
|
||||
Bfprintf(fp,"unbindall\n");
|
||||
|
||||
for (i=0; i<MAXBOUNDKEYS+MAXMOUSEBUTTONS; i++)
|
||||
if (CONTROL_KeyIsBound(i))
|
||||
Bfprintf(fp,"bind \"%s\"%s \"%s\"\n",CONTROL_KeyBinds[i].key,
|
||||
CONTROL_KeyBinds[i].repeat?"":" norepeat",CONTROL_KeyBinds[i].cmdstr);
|
||||
|
||||
OSD_WriteAliases(fp);
|
||||
|
||||
if (g_crosshairSum != -1 && g_crosshairSum != DefaultCrosshairColors.r+(DefaultCrosshairColors.g<<8)+(DefaultCrosshairColors.b<<16))
|
||||
Bfprintf(fp, "crosshaircolor %d %d %d\n", CrosshairColors.r, CrosshairColors.g, CrosshairColors.b);
|
||||
|
||||
OSD_WriteCvars(fp);
|
||||
|
||||
Bfclose(fp);
|
||||
|
||||
if (!Bstrcmp(g_setupFileName, SETUPFILENAME))
|
||||
OSD_Printf("Wrote settings.cfg\n");
|
||||
else OSD_Printf("Wrote %s_settings.cfg\n",ptr);
|
||||
|
||||
Bfree(ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Bstrcmp(g_setupFileName, SETUPFILENAME))
|
||||
OSD_Printf("Error writing settings.cfg: %s\n", strerror(errno));
|
||||
else OSD_Printf("Error writing %s_settings.cfg: %s\n",ptr,strerror(errno));
|
||||
|
||||
Bfree(ptr);
|
||||
}
|
||||
|
||||
void CONFIG_WriteSetup(uint32_t flags)
|
||||
{
|
||||
int32_t dummy;
|
||||
|
||||
if (!ud.config.setupread) return;
|
||||
|
||||
if (ud.config.scripthandle < 0)
|
||||
ud.config.scripthandle = SCRIPT_Init(g_setupFileName);
|
||||
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Executions",ud.executions,FALSE,FALSE);
|
||||
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Setup","ConfigVersion",BYTEVERSION_EDUKE32,FALSE,FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "ForceSetup",ud.config.ForceSetup,FALSE,FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "NoAutoLoad",ud.config.NoAutoLoad,FALSE,FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "CacheSize", MAXCACHE1DSIZE, FALSE, FALSE);
|
||||
|
||||
#ifdef POLYMER
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Polymer",glrendmode == REND_POLYMER,FALSE,FALSE);
|
||||
#endif
|
||||
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP",ud.config.ScreenBPP,FALSE,FALSE); // JBF 20040523
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenHeight",ud.config.ScreenHeight,FALSE,FALSE); // JBF 20031206
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenMode",ud.config.ScreenMode,FALSE,FALSE); // JBF 20031206
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth",ud.config.ScreenWidth,FALSE,FALSE); // JBF 20031206
|
||||
|
||||
if (g_grpNamePtr && !g_addonNum)
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Setup","SelectedGRP",g_grpNamePtr);
|
||||
|
||||
#ifdef STARTUP_SETUP_WINDOW
|
||||
if (g_noSetup == 0)
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Setup","ModDir",&g_modDir[0]);
|
||||
#endif
|
||||
// exit early after only updating the values that can be changed from the startup window
|
||||
if (flags & 1)
|
||||
{
|
||||
SCRIPT_Save(ud.config.scripthandle, g_setupFileName);
|
||||
SCRIPT_Free(ud.config.scripthandle);
|
||||
return;
|
||||
}
|
||||
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", windowpos, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", windowx, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", windowy, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq", maxrefreshfreq, FALSE, FALSE);
|
||||
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Out",ud.lockout,FALSE,FALSE);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "Password",ud.pwlockout);
|
||||
|
||||
#ifdef _WIN32
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", ud.config.CheckForUpdates, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", ud.config.LastUpdateCheck, FALSE, FALSE);
|
||||
#endif
|
||||
|
||||
if (ud.config.UseMouse)
|
||||
{
|
||||
for (dummy=0; dummy<MAXMOUSEBUTTONS; dummy++)
|
||||
{
|
||||
if (CONFIG_FunctionNumToName(ud.config.MouseFunctions[dummy][0]))
|
||||
{
|
||||
Bsprintf(buf, "MouseButton%d", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.MouseFunctions[dummy][0]));
|
||||
}
|
||||
|
||||
if (dummy >= (MAXMOUSEBUTTONS-2)) continue;
|
||||
|
||||
if (CONFIG_FunctionNumToName(ud.config.MouseFunctions[dummy][1]))
|
||||
{
|
||||
Bsprintf(buf, "MouseButtonClicked%d", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.MouseFunctions[dummy][1]));
|
||||
}
|
||||
}
|
||||
|
||||
for (dummy=0; dummy<MAXMOUSEAXES; dummy++)
|
||||
{
|
||||
if (CONFIG_AnalogNumToName(ud.config.MouseAnalogueAxes[dummy]))
|
||||
{
|
||||
Bsprintf(buf, "MouseAnalogAxes%d", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_AnalogNumToName(ud.config.MouseAnalogueAxes[dummy]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[dummy][0]))
|
||||
{
|
||||
Bsprintf(buf, "MouseDigitalAxes%d_0", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[dummy][0]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[dummy][1]))
|
||||
{
|
||||
Bsprintf(buf, "MouseDigitalAxes%d_1", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[dummy][1]));
|
||||
}
|
||||
|
||||
if (ud.config.MouseAnalogueScale[dummy] != DEFAULTMOUSEANALOGUESCALE)
|
||||
{
|
||||
Bsprintf(buf, "MouseAnalogScale%d", dummy);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, ud.config.MouseAnalogueScale[dummy], FALSE, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ud.config.UseJoystick)
|
||||
{
|
||||
for (dummy=0; dummy<MAXJOYBUTTONSANDHATS; dummy++)
|
||||
{
|
||||
if (CONFIG_FunctionNumToName(ud.config.JoystickFunctions[dummy][0]))
|
||||
{
|
||||
Bsprintf(buf, "JoystickButton%d", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.JoystickFunctions[dummy][0]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(ud.config.JoystickFunctions[dummy][1]))
|
||||
{
|
||||
Bsprintf(buf, "JoystickButtonClicked%d", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.JoystickFunctions[dummy][1]));
|
||||
}
|
||||
}
|
||||
for (dummy=0; dummy<MAXJOYAXES; dummy++)
|
||||
{
|
||||
if (CONFIG_AnalogNumToName(ud.config.JoystickAnalogueAxes[dummy]))
|
||||
{
|
||||
Bsprintf(buf, "JoystickAnalogAxes%d", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_AnalogNumToName(ud.config.JoystickAnalogueAxes[dummy]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[dummy][0]))
|
||||
{
|
||||
Bsprintf(buf, "JoystickDigitalAxes%d_0", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[dummy][0]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[dummy][1]))
|
||||
{
|
||||
Bsprintf(buf, "JoystickDigitalAxes%d_1", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[dummy][1]));
|
||||
}
|
||||
|
||||
if (ud.config.JoystickAnalogueScale[dummy] != DEFAULTJOYSTICKANALOGUESCALE)
|
||||
{
|
||||
Bsprintf(buf, "JoystickAnalogScale%d", dummy);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, ud.config.JoystickAnalogueScale[dummy], FALSE, FALSE);
|
||||
}
|
||||
|
||||
if (ud.config.JoystickAnalogueDead[dummy] != DEFAULTJOYSTICKANALOGUEDEAD)
|
||||
{
|
||||
Bsprintf(buf, "JoystickAnalogDead%d", dummy);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, ud.config.JoystickAnalogueDead[dummy], FALSE, FALSE);
|
||||
}
|
||||
|
||||
if (ud.config.JoystickAnalogueSaturate[dummy] != DEFAULTJOYSTICKANALOGUESATURATE)
|
||||
{
|
||||
Bsprintf(buf, "JoystickAnalogSaturate%d", dummy);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, ud.config.JoystickAnalogueSaturate[dummy], FALSE, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Comm Setup","PlayerName",&szPlayerName[0]);
|
||||
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]);
|
||||
|
||||
char commmacro[] = "CommbatMacro# ";
|
||||
|
||||
for (dummy = 0; dummy < MAXRIDECULE; dummy++)
|
||||
{
|
||||
commmacro[13] = dummy+'0';
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Comm Setup",commmacro,&ud.ridecule[dummy][0]);
|
||||
}
|
||||
|
||||
SCRIPT_Save(ud.config.scripthandle, g_setupFileName);
|
||||
|
||||
if ((flags & 2) == 0)
|
||||
SCRIPT_Free(ud.config.scripthandle);
|
||||
|
||||
OSD_Printf("Wrote %s\n",g_setupFileName);
|
||||
CONFIG_WriteSettings();
|
||||
Bfflush(NULL);
|
||||
}
|
||||
|
||||
static const char *CONFIG_GetMapEntryName(char m[], char const * const mapname)
|
||||
{
|
||||
strcpy(m, mapname);
|
||||
|
||||
char *p = strrchr(m, '/');
|
||||
if (!p) p = strrchr(m, '\\');
|
||||
if (p) Bmemmove(m, p, Bstrlen(p)+1);
|
||||
for (p=m; *p; p++) *p = tolower(*p);
|
||||
|
||||
// cheap hack because SCRIPT_GetNumber doesn't like the slashes
|
||||
p = m;
|
||||
while (*p == '/') p++;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
static void CONFIG_GetMD4EntryName(char m[], uint8_t const * const md4)
|
||||
{
|
||||
sprintf(m, "MD4_%08x%08x%08x%08x",
|
||||
B_BIG32(B_UNBUF32(&md4[0])), B_BIG32(B_UNBUF32(&md4[4])),
|
||||
B_BIG32(B_UNBUF32(&md4[8])), B_BIG32(B_UNBUF32(&md4[12])));
|
||||
}
|
||||
|
||||
int32_t CONFIG_GetMapBestTime(char const * const mapname, uint8_t const * const mapmd4)
|
||||
{
|
||||
if (!ud.config.setupread || ud.config.scripthandle < 0)
|
||||
return -1;
|
||||
|
||||
char m[37];
|
||||
CONFIG_GetMD4EntryName(m, mapmd4);
|
||||
|
||||
int32_t t = -1;
|
||||
if (SCRIPT_GetNumber(ud.config.scripthandle, "MapTimes", m, &t))
|
||||
{
|
||||
// fall back to map filenames
|
||||
char m2[BMAX_PATH];
|
||||
char const * const p = CONFIG_GetMapEntryName(m2, mapname);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "MapTimes", p, &t);
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
int32_t CONFIG_SetMapBestTime(uint8_t const * const mapmd4, int32_t const tm)
|
||||
{
|
||||
if (ud.config.scripthandle < 0) ud.config.scripthandle = SCRIPT_Init(g_setupFileName);
|
||||
if (ud.config.scripthandle < 0) return -1;
|
||||
|
||||
char m[37];
|
||||
CONFIG_GetMD4EntryName(m, mapmd4);
|
||||
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "MapTimes", m, tm, FALSE, FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
46
source/rr/src/config.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#ifndef config_public_h_
|
||||
#define config_public_h_
|
||||
|
||||
#define SETUPNAMEPARM "SETUPFILE"
|
||||
|
||||
int32_t CONFIG_ReadSetup( void );
|
||||
void CONFIG_GetSetupFilename( void );
|
||||
void CONFIG_WriteSetup(uint32_t flags);
|
||||
void CONFIG_SetupMouse( void );
|
||||
void CONFIG_SetupJoystick( void );
|
||||
void CONFIG_SetDefaultKeys(const char (*keyptr)[MAXGAMEFUNCLEN]);
|
||||
|
||||
int32_t CONFIG_GetMapBestTime(char const * mapname, uint8_t const * mapmd4);
|
||||
int32_t CONFIG_SetMapBestTime(uint8_t const * mapmd4, int32_t tm);
|
||||
|
||||
void CONFIG_MapKey(int32_t which, kb_scancode key1, kb_scancode oldkey1, kb_scancode key2, kb_scancode oldkey2);
|
||||
|
||||
int32_t CONFIG_FunctionNameToNum(const char *func);
|
||||
char *CONFIG_FunctionNumToName(int32_t func);
|
||||
int32_t CONFIG_AnalogNameToNum(const char *func);
|
||||
const char *CONFIG_AnalogNumToName(int32_t func);
|
||||
void CONFIG_SetDefaults(void);
|
||||
|
||||
#endif
|
1147
source/rr/src/demo.cpp
Normal file
65
source/rr/src/demo.h
Normal file
|
@ -0,0 +1,65 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#ifndef demo_h_
|
||||
#define demo_h_
|
||||
|
||||
#define DEMOFN_FMT "edemo%03d.edm"
|
||||
#define LDEMOFN_FMT "demo%d.dmo"
|
||||
#define MAXDEMOS 1000
|
||||
|
||||
extern FILE *g_demo_filePtr;
|
||||
extern char g_firstDemoFile[BMAX_PATH];
|
||||
|
||||
extern int32_t demoplay_diffs;
|
||||
extern int32_t demoplay_showsync;
|
||||
extern int32_t demorec_diffcompress_cvar;
|
||||
extern int32_t demorec_diffs_cvar;
|
||||
extern int32_t demorec_difftics_cvar;
|
||||
extern int32_t demorec_force_cvar;
|
||||
extern int32_t demorec_seeds_cvar;
|
||||
extern int32_t demorec_synccompress_cvar;
|
||||
extern int32_t g_demo_cnt;
|
||||
extern int32_t g_demo_goalCnt;
|
||||
extern int32_t g_demo_paused;
|
||||
extern int32_t g_demo_recFilePtr;
|
||||
extern int32_t g_demo_rewind;
|
||||
extern int32_t g_demo_showStats;
|
||||
extern int32_t g_demo_totalCnt;
|
||||
|
||||
int32_t G_PlaybackDemo(void);
|
||||
void Demo_PrepareWarp(void);
|
||||
void G_CloseDemoWrite(void);
|
||||
void G_DemoRecord(void);
|
||||
void G_OpenDemoWrite(void);
|
||||
|
||||
void Demo_PlayFirst(int32_t prof, int32_t exitafter);
|
||||
void Demo_SetFirst(const char *demostr);
|
||||
|
||||
int32_t Demo_IsProfiling(void);
|
||||
|
||||
#if KRANDDEBUG
|
||||
int32_t krd_print(const char *filename);
|
||||
void krd_enable(int32_t which);
|
||||
#endif
|
||||
|
||||
#endif
|
152
source/rr/src/duke3d.h
Normal file
|
@ -0,0 +1,152 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2016 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#ifndef duke3d_h_
|
||||
#define duke3d_h_
|
||||
|
||||
// JBF
|
||||
#include "compat.h"
|
||||
#include "a.h"
|
||||
#include "build.h"
|
||||
|
||||
#ifdef POLYMER
|
||||
#include "polymer.h"
|
||||
#else
|
||||
#ifdef USE_OPENGL
|
||||
#include "polymost.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "cache1d.h"
|
||||
#include "pragmas.h"
|
||||
#include "baselayer.h"
|
||||
#include "file_lib.h"
|
||||
#include "keyboard.h"
|
||||
#include "fx_man.h"
|
||||
|
||||
#define HEAD2 APPNAME
|
||||
|
||||
#define VOLUMEALL (g_Shareware == 0)
|
||||
#define PLUTOPAK (g_scriptVersion >= 14)
|
||||
#define VOLUMEONE (g_Shareware == 1)
|
||||
|
||||
// increase by 3, because atomic GRP adds 1, and Shareware adds 2
|
||||
// Non-Lua build
|
||||
# define BYTEVERSION_EDUKE32 336
|
||||
|
||||
//#define BYTEVERSION_13 27
|
||||
//#define BYTEVERSION_14 116
|
||||
//#define BYTEVERSION_15 117
|
||||
#define BYTEVERSION (BYTEVERSION_EDUKE32+(PLUTOPAK?1:(VOLUMEONE<<1)))
|
||||
|
||||
#define NUMPAGES 1
|
||||
|
||||
#define RECSYNCBUFSIZ 2520 //2520 is the (LCM of 1-8)*3
|
||||
#define MOVEFIFOSIZ 2
|
||||
|
||||
// KEEPINSYNC lunatic/con_lang.lua
|
||||
#define MAXVOLUMES 7
|
||||
#define MAXLEVELS 64
|
||||
#define MAXGAMETYPES 16
|
||||
|
||||
enum {
|
||||
MUS_FIRST_SPECIAL = MAXVOLUMES*MAXLEVELS,
|
||||
|
||||
MUS_INTRO = MUS_FIRST_SPECIAL,
|
||||
MUS_BRIEFING = MUS_FIRST_SPECIAL + 1,
|
||||
MUS_LOADING = MUS_FIRST_SPECIAL + 2,
|
||||
};
|
||||
|
||||
////////// TIMING CONSTANTS //////////
|
||||
// The number of 'totalclock' increments per second:
|
||||
#define TICRATE 120
|
||||
// The number of game state updates per second:
|
||||
#define REALGAMETICSPERSEC 30
|
||||
// The number of 'totalclock' increments per game state update:
|
||||
// NOTE: calling a game state update a 'frame' is really weird.
|
||||
// (This used to be TICRATE/GAMETICSPERSEC, which was 120/26 = 4.615~ truncated
|
||||
// to 4 by integer division.)
|
||||
#define TICSPERFRAME (TICRATE/REALGAMETICSPERSEC)
|
||||
// Used as a constant to satisfy all of the calculations written with ticrate =
|
||||
// 26 in mind:
|
||||
#define GAMETICSPERSEC 26
|
||||
|
||||
|
||||
#define PACKBUF_SIZE 32768
|
||||
|
||||
#define TILE_SAVESHOT (MAXTILES-1)
|
||||
#define TILE_LOADSHOT (MAXTILES-3)
|
||||
#define TILE_TILT (MAXTILES-2)
|
||||
#define TILE_ANIM (MAXTILES-4)
|
||||
#define TILE_VIEWSCR (MAXTILES-5)
|
||||
// Reserved: TILE_VIEWSCR_1 (MAXTILES-6)
|
||||
// Reserved: TILE_VIEWSCR_2 (MAXTILES-7)
|
||||
EDUKE32_STATIC_ASSERT(7 <= MAXTILES-MAXUSERTILES);
|
||||
|
||||
// sprites with these statnums should be considered for fixing
|
||||
#define ROTFIXSPR_STATNUMP(k) ((k)==STAT_DEFAULT || (k)==STAT_STANDABLE || (k)==STAT_FX || \
|
||||
(k)==STAT_FALLER || (k)==STAT_LIGHT)
|
||||
#define ROTFIXSPR_MAGIC 0x18190000
|
||||
|
||||
// JBF 20040604: sync is a function on some platforms
|
||||
#define sync dsync
|
||||
|
||||
// Uncomment the following to remove calls to a.nasm functions with the GL renderers
|
||||
// so that debugging with valgrind --smc-check=none is possible:
|
||||
//#define DEBUG_VALGRIND_NO_SMC
|
||||
|
||||
#include "common_game.h"
|
||||
#include "namesdyn.h"
|
||||
#include "function.h"
|
||||
#include "macros.h"
|
||||
#include "gamedefs.h"
|
||||
#include "config.h"
|
||||
#include "sounds.h"
|
||||
#include "control.h"
|
||||
#include "_rts.h"
|
||||
#include "rts.h"
|
||||
#include "soundsdyn.h"
|
||||
#include "music.h"
|
||||
#include "inv.h"
|
||||
#include "player.h"
|
||||
#include "actors.h"
|
||||
#include "quotes.h"
|
||||
#include "global.h"
|
||||
#include "sector.h"
|
||||
#include "net.h"
|
||||
#include "game.h"
|
||||
#include "gamedef.h"
|
||||
#include "gameexec.h"
|
||||
#include "gamevars.h"
|
||||
#include "screentext.h"
|
||||
|
||||
static inline int32_t G_HaveActor(int spriteNum)
|
||||
{
|
||||
return g_tile[spriteNum].execPtr!=NULL;
|
||||
}
|
||||
|
||||
static inline int32_t G_DefaultActorHealth(int spriteNum)
|
||||
{
|
||||
return G_HaveActor(spriteNum) ? g_tile[spriteNum].execPtr[0] : 0;
|
||||
}
|
||||
|
||||
#endif
|
5
source/rr/src/events_defs.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
#ifndef EDUKE32_EVENTS_DEFS_H_
|
||||
#define EDUKE32_EVENTS_DEFS_H_
|
||||
|
||||
#endif
|
126
source/rr/src/file_lib.cpp
Normal file
|
@ -0,0 +1,126 @@
|
|||
/*
|
||||
* file_lib.c
|
||||
* File functions to emulate MACT
|
||||
*
|
||||
* by Jonathon Fowler
|
||||
*
|
||||
* Since we weren't given the source for MACT386.LIB so I've had to do some
|
||||
* creative interpolation here.
|
||||
*
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Duke Nukem Copyright (C) 1996, 2003 3D Realms Entertainment
|
||||
|
||||
This file is part of Duke Nukem 3D version 1.5 - Atomic Edition
|
||||
|
||||
Duke Nukem 3D is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
#include "file_lib.h"
|
||||
#include "cache1d.h"
|
||||
#include "baselayer.h"
|
||||
|
||||
#define MaxFiles 20
|
||||
static char *FileNames[MaxFiles];
|
||||
|
||||
int32_t SafeOpen(const char *filename, int32_t mode, int32_t sharemode)
|
||||
{
|
||||
int32_t h;
|
||||
|
||||
h = openfrompath(filename, mode, sharemode);
|
||||
if (h < 0)
|
||||
{
|
||||
initprintf("Error opening %s: %s", filename, strerror(errno));
|
||||
return h;
|
||||
}
|
||||
|
||||
if (h < MaxFiles)
|
||||
{
|
||||
Bfree(FileNames[h]);
|
||||
FileNames[h] = (char*)Xmalloc(strlen(filename)+1);
|
||||
strcpy(FileNames[h], filename);
|
||||
}
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
int32_t SafeOpenRead(const char *filename, int32_t filetype)
|
||||
{
|
||||
switch (filetype)
|
||||
{
|
||||
case filetype_binary:
|
||||
return SafeOpen(filename, O_RDONLY|O_BINARY, BS_IREAD);
|
||||
case filetype_text:
|
||||
return SafeOpen(filename, O_RDONLY|O_TEXT, BS_IREAD);
|
||||
default:
|
||||
initprintf("SafeOpenRead: Illegal filetype specified");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
void SafeClose(int32_t handle)
|
||||
{
|
||||
if (handle < 0) return;
|
||||
if (close(handle) < 0)
|
||||
{
|
||||
if (handle < MaxFiles)
|
||||
initprintf("Unable to close file %s", FileNames[handle]);
|
||||
else
|
||||
initprintf("Unable to close file");
|
||||
return;
|
||||
}
|
||||
|
||||
if (handle < MaxFiles && FileNames[handle])
|
||||
{
|
||||
DO_FREE_AND_NULL(FileNames[handle]);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t SafeFileExists(const char *filename)
|
||||
{
|
||||
if (!access(filename, F_OK)) return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int32_t SafeFileLength(int32_t handle)
|
||||
{
|
||||
if (handle < 0) return -1;
|
||||
return _filelength(handle);
|
||||
}
|
||||
|
||||
void SafeRead(int32_t handle, void *buffer, int32_t count)
|
||||
{
|
||||
int32_t b;
|
||||
|
||||
b = read(handle, buffer, count);
|
||||
if (b != count)
|
||||
{
|
||||
close(handle);
|
||||
if (handle < MaxFiles)
|
||||
initprintf("File read failure %s reading %d bytes from file %s.",
|
||||
strerror(errno), count, FileNames[handle]);
|
||||
else
|
||||
initprintf("File read failure %s reading %d bytes.",
|
||||
strerror(errno), count);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
262
source/rr/src/file_lib.h
Normal file
|
@ -0,0 +1,262 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 1996, 2003 - 3D Realms Entertainment
|
||||
|
||||
This file is part of Duke Nukem 3D version 1.5 - Atomic Edition
|
||||
|
||||
Duke Nukem 3D is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Original Source: 1996 - Todd Replogle
|
||||
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef file_lib_public_
|
||||
#define file_lib_public_
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
filetype_binary,
|
||||
filetype_text
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
access_read,
|
||||
access_write,
|
||||
access_append
|
||||
};
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// SafeOpenWrite - Opens a file for writing, returns handle
|
||||
//
|
||||
//==========================================================================
|
||||
int32_t SafeOpenWrite ( const char * filename, int32_t filetype );
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// SafeOpenRead - Opens a file for reading, returns handle
|
||||
//
|
||||
//==========================================================================
|
||||
int32_t SafeOpenRead ( const char * filename, int32_t filetype );
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// SafeOpenAppend - Opens a file for appending, returns handle
|
||||
//
|
||||
//==========================================================================
|
||||
int32_t SafeOpenAppend ( const char * filename, int32_t filetype );
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// SafeClose - Close a file denoted by the file handle
|
||||
//
|
||||
//==========================================================================
|
||||
void SafeClose ( int32_t handle );
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// SafeFileExists - Checks for existence of file
|
||||
//
|
||||
//==========================================================================
|
||||
int32_t SafeFileExists ( const char * filename );
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// SafeFileLength - Get length of a file pointed to by handle
|
||||
//
|
||||
//==========================================================================
|
||||
int32_t SafeFileLength ( int32_t handle );
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// SafeRead - reads from a handle
|
||||
//
|
||||
// handle - handle of file to read from
|
||||
//
|
||||
// buffer - pointer of buffer to read into
|
||||
//
|
||||
// count - number of bytes to read
|
||||
//
|
||||
//==========================================================================
|
||||
void SafeRead (int32_t handle, void *buffer, int32_t count);
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// SafeWrite - writes to a handle
|
||||
//
|
||||
// handle - handle of file to write to
|
||||
//
|
||||
// buffer - pointer of buffer to write from
|
||||
//
|
||||
// count - number of bytes to write
|
||||
//
|
||||
//==========================================================================
|
||||
void SafeWrite (int32_t handle, void *buffer, int32_t count);
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// LoadFile - Load a file
|
||||
//
|
||||
// filename - name of file
|
||||
//
|
||||
// bufferptr - pointer to pointer of buffer to read into
|
||||
//
|
||||
// returns number of bytes read
|
||||
//
|
||||
//==========================================================================
|
||||
int32_t LoadFile ( const char * filename, void ** bufferptr );
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// SaveFile - Save a file
|
||||
//
|
||||
// filename - name of file
|
||||
//
|
||||
// bufferptr - pointer to buffer to write from
|
||||
//
|
||||
// count - number of bytes to write
|
||||
//
|
||||
//==========================================================================
|
||||
void SaveFile ( const char * filename, void * bufferptr, int32_t count );
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// GetPathFromEnvironment - Add a pathname described in an environment
|
||||
// variable to a standard filename.
|
||||
//
|
||||
// fullname - final string containing entire path
|
||||
//
|
||||
// envname - string naming enivronment variable
|
||||
//
|
||||
// filename - standard filename
|
||||
//
|
||||
//==========================================================================
|
||||
void GetPathFromEnvironment( char *fullname, const char *envname, const char *filename );
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// DefaultExtension - Add a default extension to a path
|
||||
//
|
||||
// path - a path
|
||||
//
|
||||
// extension - default extension should include '.'
|
||||
//
|
||||
//==========================================================================
|
||||
void DefaultExtension (char *path, const char *extension);
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// DefaultPath - Add the default path to a filename if it doesn't have one
|
||||
//
|
||||
// path - filename
|
||||
//
|
||||
// extension - default path
|
||||
//
|
||||
//==========================================================================
|
||||
void DefaultPath (char *path, const char *basepath);
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// ExtractFileBase - Extract the base filename from a path
|
||||
//
|
||||
// path - the path
|
||||
//
|
||||
// dest - where the file base name will be placed
|
||||
//
|
||||
//==========================================================================
|
||||
void ExtractFileBase (char *path, char *dest);
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// GetExtension - Extract the extension from a name
|
||||
// returns true if an extension is found
|
||||
// returns false otherwise
|
||||
//
|
||||
//==========================================================================
|
||||
int32_t GetExtension( char *filename, char *extension );
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// SetExtension - Sets the extension from a name. Assumes that enough
|
||||
// space is left at the end of the string to hold an extension.
|
||||
//
|
||||
//==========================================================================
|
||||
void SetExtension( char *filename, const char *extension );
|
||||
|
||||
#ifdef __MSDOS__
|
||||
//******************************************************************************
|
||||
//
|
||||
// GetPath
|
||||
//
|
||||
// Purpose
|
||||
// To parse the directory entered by the user to make the directory.
|
||||
//
|
||||
// Parms
|
||||
// Path - the path to be parsed.
|
||||
//
|
||||
// Returns
|
||||
// Pointer to next path
|
||||
//
|
||||
//******************************************************************************
|
||||
char * GetPath (char * path, char *dir);
|
||||
|
||||
//******************************************************************************
|
||||
//
|
||||
// ChangeDirectory ()
|
||||
//
|
||||
// Purpose
|
||||
// To change to a directory. Checks for drive changes.
|
||||
//
|
||||
// Parms
|
||||
// path - The path to change to.
|
||||
//
|
||||
// Returns
|
||||
// TRUE - If successful.
|
||||
// FALSE - If unsuccessful.
|
||||
//
|
||||
//******************************************************************************
|
||||
int32_t ChangeDirectory (char * path);
|
||||
|
||||
//******************************************************************************
|
||||
//
|
||||
// ChangeDrive ()
|
||||
//
|
||||
// Purpose
|
||||
// To change drives.
|
||||
//
|
||||
// Parms
|
||||
// drive - The drive to change to.
|
||||
//
|
||||
// Returns
|
||||
// TRUE - If drive change successful.
|
||||
// FALSE - If drive change unsuccessful.
|
||||
//
|
||||
//******************************************************************************
|
||||
int32_t ChangeDrive (char *drive);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
110
source/rr/src/function.h
Normal file
|
@ -0,0 +1,110 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
// function.h
|
||||
|
||||
// file created by makehead.exe
|
||||
// these headers contain default key assignments, as well as
|
||||
// default button assignments and game function names
|
||||
// axis defaults are also included
|
||||
|
||||
|
||||
#ifndef function_public_h_
|
||||
#define function_public_h_
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define NUMGAMEFUNCTIONS 60
|
||||
#define MAXGAMEFUNCLEN 32
|
||||
|
||||
extern char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN];
|
||||
extern char keydefaults[NUMGAMEFUNCTIONS*2][MAXGAMEFUNCLEN];
|
||||
extern char oldkeydefaults[NUMGAMEFUNCTIONS*2][MAXGAMEFUNCLEN];
|
||||
|
||||
enum GameFunction_t
|
||||
{
|
||||
gamefunc_Move_Forward,
|
||||
gamefunc_Move_Backward,
|
||||
gamefunc_Turn_Left,
|
||||
gamefunc_Turn_Right,
|
||||
gamefunc_Strafe,
|
||||
gamefunc_Fire,
|
||||
gamefunc_Open,
|
||||
gamefunc_Run,
|
||||
gamefunc_AutoRun,
|
||||
gamefunc_Jump,
|
||||
gamefunc_Crouch,
|
||||
gamefunc_Look_Up,
|
||||
gamefunc_Look_Down,
|
||||
gamefunc_Look_Left,
|
||||
gamefunc_Look_Right,
|
||||
gamefunc_Strafe_Left,
|
||||
gamefunc_Strafe_Right,
|
||||
gamefunc_Aim_Up,
|
||||
gamefunc_Aim_Down,
|
||||
gamefunc_Weapon_1,
|
||||
gamefunc_Weapon_2,
|
||||
gamefunc_Weapon_3,
|
||||
gamefunc_Weapon_4,
|
||||
gamefunc_Weapon_5,
|
||||
gamefunc_Weapon_6,
|
||||
gamefunc_Weapon_7,
|
||||
gamefunc_Weapon_8,
|
||||
gamefunc_Weapon_9,
|
||||
gamefunc_Weapon_10,
|
||||
gamefunc_Inventory,
|
||||
gamefunc_Inventory_Left,
|
||||
gamefunc_Inventory_Right,
|
||||
gamefunc_Holo_Duke,
|
||||
gamefunc_Jetpack,
|
||||
gamefunc_NightVision,
|
||||
gamefunc_MedKit,
|
||||
gamefunc_TurnAround,
|
||||
gamefunc_SendMessage,
|
||||
gamefunc_Map,
|
||||
gamefunc_Shrink_Screen,
|
||||
gamefunc_Enlarge_Screen,
|
||||
gamefunc_Center_View,
|
||||
gamefunc_Holster_Weapon,
|
||||
gamefunc_Show_Opponents_Weapon,
|
||||
gamefunc_Map_Follow_Mode,
|
||||
gamefunc_See_Coop_View,
|
||||
gamefunc_Mouse_Aiming,
|
||||
gamefunc_Toggle_Crosshair,
|
||||
gamefunc_Steroids,
|
||||
gamefunc_Quick_Kick,
|
||||
gamefunc_Next_Weapon,
|
||||
gamefunc_Previous_Weapon,
|
||||
gamefunc_Show_Console,
|
||||
gamefunc_Show_DukeMatch_Scores,
|
||||
gamefunc_Dpad_Select,
|
||||
gamefunc_Dpad_Aiming,
|
||||
gamefunc_Alt_Weapon,
|
||||
gamefunc_Last_Weapon,
|
||||
gamefunc_Quick_Save,
|
||||
gamefunc_Quick_Load,
|
||||
};
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
8805
source/rr/src/game.cpp
Normal file
579
source/rr/src/game.h
Normal file
|
@ -0,0 +1,579 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2016 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef game_h_
|
||||
#define game_h_
|
||||
|
||||
#ifndef ONLY_USERDEFS
|
||||
#include "premap.h" // XXX
|
||||
#endif
|
||||
|
||||
#include "fix16.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef ONLY_USERDEFS
|
||||
|
||||
// Compile game-side legacy Room over Room code?
|
||||
#define LEGACY_ROR 1
|
||||
|
||||
#define USERQUOTE_LEFTOFFSET 5
|
||||
#define USERQUOTE_RIGHTOFFSET 14
|
||||
|
||||
#if defined(GEKKO) || defined(__OPENDINGUX__)
|
||||
# define VIEWSCREENFACTOR 0
|
||||
#elif defined(__ANDROID__)
|
||||
# define VIEWSCREENFACTOR 1
|
||||
#else
|
||||
# define VIEWSCREENFACTOR 2
|
||||
#endif
|
||||
|
||||
enum GametypeFlags_t {
|
||||
GAMETYPE_COOP = 0x00000001,
|
||||
GAMETYPE_WEAPSTAY = 0x00000002,
|
||||
GAMETYPE_FRAGBAR = 0x00000004,
|
||||
GAMETYPE_SCORESHEET = 0x00000008,
|
||||
GAMETYPE_DMSWITCHES = 0x00000010,
|
||||
GAMETYPE_COOPSPAWN = 0x00000020,
|
||||
GAMETYPE_ACCESSCARDSPRITES = 0x00000040,
|
||||
GAMETYPE_COOPVIEW = 0x00000080,
|
||||
GAMETYPE_COOPSOUND = 0x00000100,
|
||||
GAMETYPE_OTHERPLAYERSINMAP = 0x00000200,
|
||||
GAMETYPE_ITEMRESPAWN = 0x00000400,
|
||||
GAMETYPE_MARKEROPTION = 0x00000800,
|
||||
GAMETYPE_PLAYERSFRIENDLY = 0x00001000,
|
||||
GAMETYPE_FIXEDRESPAWN = 0x00002000,
|
||||
GAMETYPE_ACCESSATSTART = 0x00004000,
|
||||
GAMETYPE_PRESERVEINVENTORYDEATH = 0x00008000,
|
||||
GAMETYPE_TDM = 0x00010000,
|
||||
GAMETYPE_TDMSPAWN = 0x00020000
|
||||
};
|
||||
|
||||
// logo control
|
||||
enum LogoFlags_t {
|
||||
LOGO_ENABLED = 0x00000001,
|
||||
LOGO_PLAYANIM = 0x00000002,
|
||||
LOGO_PLAYMUSIC = 0x00000004,
|
||||
LOGO_3DRSCREEN = 0x00000008,
|
||||
LOGO_TITLESCREEN = 0x00000010,
|
||||
LOGO_DUKENUKEM = 0x00000020,
|
||||
LOGO_THREEDEE = 0x00000040,
|
||||
LOGO_PLUTOPAKSPRITE = 0x00000080,
|
||||
LOGO_SHAREWARESCREENS = 0x00000100,
|
||||
LOGO_TENSCREEN = 0x00000200,
|
||||
LOGO_STOPANIMSOUNDS = 0x00000400,
|
||||
LOGO_NOE4CUTSCENE = 0x00000800,
|
||||
LOGO_NOE1BONUSSCENE = 0x00001000,
|
||||
LOGO_NOE2BONUSSCENE = 0x00002000,
|
||||
LOGO_NOE3BONUSSCENE = 0x00004000,
|
||||
LOGO_NOE4BONUSSCENE = 0x00008000,
|
||||
LOGO_NOE1ENDSCREEN = 0x00010000,
|
||||
LOGO_NOE2ENDSCREEN = 0x00020000,
|
||||
LOGO_NOE3RADLOGO = 0x00040000,
|
||||
LOGO_NODUKETEAMTEXT = 0x00080000,
|
||||
LOGO_NODUKETEAMPIC = 0x00100000,
|
||||
LOGO_STOPMISCSOUNDS = 0x00200000,
|
||||
LOGO_NOGAMETITLE = 0x00400000,
|
||||
LOGO_NOTITLEBAR = 0x00800000,
|
||||
LOGO_HIDEEPISODE = 0x01000000,
|
||||
LOGO_NOHELP = 0x02000000,
|
||||
LOGO_NOCREDITS = 0x04000000,
|
||||
};
|
||||
|
||||
enum {
|
||||
STATUSBAR_NONONE = 0x00000001,
|
||||
STATUSBAR_NOMINI = 0x00000002,
|
||||
STATUSBAR_NOFULL = 0x00000004,
|
||||
STATUSBAR_NOSHRINK = 0x00000008,
|
||||
STATUSBAR_NOFRAGBAR = 0x00000010,
|
||||
STATUSBAR_NOOVERLAY = 0x00000020,
|
||||
STATUSBAR_NOMODERN = 0x00000040,
|
||||
};
|
||||
|
||||
void A_DeleteSprite(int spriteNum);
|
||||
|
||||
//static inline int32_t G_GetLogoFlags(void)
|
||||
//{
|
||||
// return 255;
|
||||
//}
|
||||
|
||||
# define CAMERA(Membname) (ud.camera ## Membname)
|
||||
# define CAMERADIST g_cameraDistance
|
||||
# define CAMERACLOCK g_cameraClock
|
||||
|
||||
#endif
|
||||
|
||||
#define MAXRIDECULE 10
|
||||
#define MAXRIDECULELENGTH 40
|
||||
#define MAXSAVEGAMENAMESTRUCT 32
|
||||
#define MAXSAVEGAMENAME (MAXSAVEGAMENAMESTRUCT-1)
|
||||
#define MAXPWLOCKOUT 128
|
||||
#define MAXRTSNAME 128
|
||||
|
||||
#define MAX_RETURN_VALUES 6
|
||||
|
||||
// KEEPINSYNC lunatic/_defs_game.lua
|
||||
typedef struct {
|
||||
vec3_t camerapos;
|
||||
int32_t const_visibility,uw_framerate;
|
||||
int32_t camera_time,folfvel,folavel,folx,foly,fola;
|
||||
int32_t reccnt,crosshairscale;
|
||||
|
||||
int32_t runkey_mode,statusbarscale,mouseaiming,weaponswitch,drawweapon; // JBF 20031125
|
||||
int32_t democams,color,msgdisptime,statusbarmode;
|
||||
int32_t m_noexits,noexits,autovote,automsg,idplayers;
|
||||
int32_t team, viewbob, weaponsway, althud, weaponscale, textscale;
|
||||
int32_t statusbarflags, statusbarrange, statusbarcustom;
|
||||
int32_t hudontop;
|
||||
int32_t menu_slidebarz, menu_slidebarmargin, menu_slidecursorz;
|
||||
int32_t menu_scrollbartilenum, menu_scrollbarz, menu_scrollcursorz;
|
||||
|
||||
int32_t entered_name,screen_tilting,shadows,fta_on,executions,auto_run;
|
||||
int32_t coords,showfps,levelstats,m_coop,coop,screen_size,lockout,crosshair;
|
||||
int32_t playerai,angleinterpolation,obituaries;
|
||||
|
||||
int32_t respawn_monsters,respawn_items,respawn_inventory,recstat,monsters_off,brightness;
|
||||
int32_t m_respawn_items,m_respawn_monsters,m_respawn_inventory,m_recstat,m_monsters_off,detail;
|
||||
int32_t m_ffire,ffire,m_player_skill,m_level_number,m_volume_number,multimode;
|
||||
int32_t player_skill,level_number,volume_number,m_marker,marker,mouseflip;
|
||||
int32_t music_episode, music_level;
|
||||
|
||||
int32_t playerbest;
|
||||
|
||||
int32_t configversion, bgstretch;
|
||||
|
||||
int32_t default_volume, default_skill;
|
||||
|
||||
int32_t autosave;
|
||||
int32_t autosavedeletion, maxautosaves;
|
||||
|
||||
//int32_t returnvar[MAX_RETURN_VALUES-1];
|
||||
|
||||
uint32_t userbytever;
|
||||
|
||||
fix16_t cameraq16ang, cameraq16horiz;
|
||||
int16_t camerasect;
|
||||
int16_t pause_on,from_bonus;
|
||||
int16_t camerasprite,last_camsprite;
|
||||
int16_t last_level,secretlevel;
|
||||
|
||||
int8_t menutitle_pal, slidebar_palselected, slidebar_paldisabled;
|
||||
|
||||
struct {
|
||||
int32_t UseJoystick;
|
||||
int32_t UseMouse;
|
||||
int32_t AutoAim;
|
||||
int32_t ShowOpponentWeapons;
|
||||
int32_t MouseDeadZone,MouseBias;
|
||||
int32_t SmoothInput;
|
||||
|
||||
// JBF 20031211: Store the input settings because
|
||||
// (currently) mact can't regurgitate them
|
||||
int32_t MouseFunctions[MAXMOUSEBUTTONS][2];
|
||||
int32_t MouseDigitalFunctions[MAXMOUSEAXES][2];
|
||||
int32_t MouseAnalogueAxes[MAXMOUSEAXES];
|
||||
int32_t MouseAnalogueScale[MAXMOUSEAXES];
|
||||
int32_t JoystickFunctions[MAXJOYBUTTONSANDHATS][2];
|
||||
int32_t JoystickDigitalFunctions[MAXJOYAXES][2];
|
||||
int32_t JoystickAnalogueAxes[MAXJOYAXES];
|
||||
int32_t JoystickAnalogueScale[MAXJOYAXES];
|
||||
int32_t JoystickAnalogueDead[MAXJOYAXES];
|
||||
int32_t JoystickAnalogueSaturate[MAXJOYAXES];
|
||||
uint8_t KeyboardKeys[NUMGAMEFUNCTIONS][2];
|
||||
|
||||
//
|
||||
// Sound variables
|
||||
//
|
||||
int32_t FXVolume;
|
||||
int32_t MusicVolume;
|
||||
int32_t SoundToggle;
|
||||
int32_t MusicToggle;
|
||||
int32_t VoiceToggle;
|
||||
int32_t AmbienceToggle;
|
||||
|
||||
int32_t NumVoices;
|
||||
int32_t NumChannels;
|
||||
int32_t NumBits;
|
||||
int32_t MixRate;
|
||||
|
||||
int32_t ReverseStereo;
|
||||
|
||||
//
|
||||
// Screen variables
|
||||
//
|
||||
|
||||
int32_t ScreenMode;
|
||||
|
||||
int32_t ScreenWidth;
|
||||
int32_t ScreenHeight;
|
||||
int32_t ScreenBPP;
|
||||
|
||||
int32_t ForceSetup;
|
||||
int32_t NoAutoLoad;
|
||||
|
||||
int32_t scripthandle;
|
||||
int32_t setupread;
|
||||
|
||||
int32_t CheckForUpdates;
|
||||
int32_t LastUpdateCheck;
|
||||
int32_t useprecache;
|
||||
} config;
|
||||
|
||||
char overhead_on,last_overhead,showweapons;
|
||||
char god,warp_on,cashman,eog,showallmap;
|
||||
char show_help,scrollmode,noclip;
|
||||
char ridecule[MAXRIDECULE][MAXRIDECULELENGTH];
|
||||
char pwlockout[MAXPWLOCKOUT],rtsname[MAXRTSNAME];
|
||||
char display_bonus_screen;
|
||||
char show_level_text;
|
||||
char wchoice[MAX_WEAPONS];
|
||||
|
||||
uint8_t user_map;
|
||||
uint8_t screenfade, menubackground;
|
||||
uint8_t shadow_pal;
|
||||
} user_defs;
|
||||
|
||||
extern user_defs ud;
|
||||
|
||||
#ifndef ONLY_USERDEFS
|
||||
|
||||
// this is checked against http://eduke32.com/VERSION
|
||||
extern const char *s_buildDate;
|
||||
|
||||
extern char boardfilename[BMAX_PATH], currentboardfilename[BMAX_PATH];
|
||||
|
||||
static inline int G_HaveUserMap(void)
|
||||
{
|
||||
return (boardfilename[0] != 0 && ud.level_number == 7 && ud.volume_number == 0);
|
||||
}
|
||||
|
||||
static inline int Menu_HaveUserMap(void)
|
||||
{
|
||||
return (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0);
|
||||
}
|
||||
|
||||
extern const char *defaultrtsfilename[GAMECOUNT];
|
||||
extern const char *G_DefaultRtsFile(void);
|
||||
|
||||
#ifdef LEGACY_ROR
|
||||
extern char ror_protectedsectors[MAXSECTORS];
|
||||
#endif
|
||||
|
||||
extern float r_ambientlight;
|
||||
|
||||
extern int32_t g_Debug;
|
||||
extern int32_t g_Shareware;
|
||||
extern int32_t g_cameraClock;
|
||||
extern int32_t g_cameraDistance;
|
||||
extern int32_t g_crosshairSum;
|
||||
extern int32_t g_doQuickSave;
|
||||
extern int32_t g_forceWeaponChoice;
|
||||
extern int32_t g_fakeMultiMode;
|
||||
extern int32_t g_levelTextTime;
|
||||
extern int32_t g_quitDeadline;
|
||||
extern int32_t g_restorePalette;
|
||||
extern int32_t hud_glowingquotes;
|
||||
extern int32_t hud_showmapname;
|
||||
extern int32_t r_maxfps;
|
||||
extern int32_t tempwallptr;
|
||||
extern int32_t ticrandomseed;
|
||||
extern int32_t vote_map;
|
||||
extern int32_t voting;
|
||||
|
||||
extern int32_t MAXCACHE1DSIZE;
|
||||
//extern int8_t cheatbuf[MAXCHEATLEN],cheatbuflen;
|
||||
|
||||
#define CROSSHAIR_PAL (MAXPALOOKUPS-RESERVEDPALS-1)
|
||||
|
||||
extern palette_t CrosshairColors;
|
||||
extern palette_t DefaultCrosshairColors;
|
||||
|
||||
extern uint64_t g_frameDelay;
|
||||
|
||||
int32_t A_CheckInventorySprite(spritetype *s);
|
||||
int32_t A_InsertSprite(int16_t whatsect, int32_t s_x, int32_t s_y, int32_t s_z, int16_t s_pn, int8_t s_s, uint8_t s_xr,
|
||||
uint8_t s_yr, int16_t s_a, int16_t s_ve, int16_t s_zv, int16_t s_ow, int16_t s_ss);
|
||||
int A_Spawn(int spriteNum,int tileNum);
|
||||
int G_DoMoveThings(void);
|
||||
//int32_t G_EndOfLevel(void);
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
void Yax_SetBunchZs(int32_t sectnum, int32_t cf, int32_t daz);
|
||||
#else
|
||||
#define Yax_SetBunchZs(sectnum, cf, daz)
|
||||
#endif
|
||||
|
||||
void G_PostCreateGameState(void);
|
||||
|
||||
void A_SpawnCeilingGlass(int spriteNum,int sectNum,int glassCnt);
|
||||
void A_SpawnGlass(int spriteNum,int glassCnt);
|
||||
void A_SpawnRandomGlass(int spriteNum,int wallNum,int glassCnt);
|
||||
void A_SpawnWallGlass(int spriteNum,int wallnum,int glassCnt);
|
||||
void A_SpawnWallPopcorn(int spriteNum,int wallnum,int glassCnt);
|
||||
void G_AddUserQuote(const char *daquote);
|
||||
void G_BackToMenu(void);
|
||||
void G_DumpDebugInfo(void);
|
||||
|
||||
const char* G_PrintYourTime(void);
|
||||
const char* G_PrintParTime(void);
|
||||
const char* G_PrintDesignerTime(void);
|
||||
const char* G_PrintBestTime(void);
|
||||
void G_BonusScreen(int32_t bonusonly);
|
||||
void G_BonusScreenRRRA(int32_t bonusonly);
|
||||
//void G_CheatGetInv(void);
|
||||
void G_DisplayRest(int32_t smoothratio);
|
||||
void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoothratio);
|
||||
void G_DrawBackground(void);
|
||||
void G_DrawFrags(void);
|
||||
void G_HandleMirror(int32_t x, int32_t y, int32_t z, fix16_t a, fix16_t horiz, int32_t smoothratio);
|
||||
void G_DrawRooms(int32_t playerNum,int32_t smoothratio);
|
||||
void G_DrawTXDigiNumZ(int32_t starttile,int32_t x,int32_t y,int32_t n,int32_t s,int32_t pal,int32_t cs,int32_t x1,int32_t y1,int32_t x2,int32_t y2,int32_t z);
|
||||
int G_FPSLimit(void);
|
||||
void G_GameExit(const char *msg) ATTRIBUTE((noreturn));
|
||||
void G_GameQuit(void);
|
||||
void G_GetCrosshairColor(void);
|
||||
void G_HandleLocalKeys(void);
|
||||
void G_HandleSpecialKeys(void);
|
||||
void G_UpdateAppTitle(void);
|
||||
void G_PrintGameQuotes(int32_t snum);
|
||||
//void G_SE40(int32_t smoothratio);
|
||||
void G_SetCrosshairColor(int32_t r,int32_t g,int32_t b);
|
||||
void G_Shutdown(void);
|
||||
void G_UpdatePlayerFromMenu(void);
|
||||
void M32RunScript(const char *s);
|
||||
void P_DoQuote(int32_t q,DukePlayer_t *p);
|
||||
void P_SetGamePalette(DukePlayer_t *player, uint32_t palid, int32_t set);
|
||||
void G_OnMotorcycle(DukePlayer_t *pPlayer, int spriteNum);
|
||||
void G_OffMotorcycle(DukePlayer_t *pPlayer);
|
||||
void G_OnBoat(DukePlayer_t *pPlayer, int spriteNum);
|
||||
void G_OffBoat(DukePlayer_t *pPlayer);
|
||||
|
||||
#define NEG_ALPHA_TO_BLEND(alpha, blend, orientation) do { \
|
||||
if (alpha < 0) { blend = -alpha; alpha = 0; orientation |= RS_TRANS1; } \
|
||||
} while (0)
|
||||
|
||||
// Cstat protection mask for (currently) spawned MASKWALL* sprites.
|
||||
// TODO: look at more cases of cstat=(cstat&PROTECTED)|ADDED in A_Spawn()?
|
||||
// 2048+(32+16)+8+4
|
||||
#define SPAWN_PROTECT_CSTAT_MASK (CSTAT_SPRITE_NOSHADE|CSTAT_SPRITE_ALIGNMENT_SLAB|CSTAT_SPRITE_XFLIP|CSTAT_SPRITE_YFLIP);
|
||||
|
||||
void fadepal(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step);
|
||||
//void fadepaltile(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step,int32_t tile);
|
||||
void G_InitTimer(int32_t ticspersec);
|
||||
|
||||
static inline int32_t G_GetTeamPalette(int32_t team)
|
||||
{
|
||||
int8_t pal[] = { 3, 10, 11, 12 };
|
||||
|
||||
if ((unsigned)team >= ARRAY_SIZE(pal))
|
||||
return 0;
|
||||
|
||||
return pal[team];
|
||||
}
|
||||
|
||||
#define A_CheckSpriteFlags(spriteNum, iType) (((g_tile[sprite[spriteNum].picnum].flags^actor[spriteNum].flags) & iType) != 0)
|
||||
// (unsigned)iPicnum check: AMC TC Rusty Nails, bayonet MG alt. fire, iPicnum == -1 (via aplWeaponShoots)
|
||||
#define A_CheckSpriteTileFlags(iPicnum, iType) (((unsigned)iPicnum < MAXTILES) && (g_tile[iPicnum].flags & iType) != 0)
|
||||
#define S_StopSound(num) S_StopEnvSound(num, -1)
|
||||
|
||||
extern int G_StartRTS(int lumpNum, int localPlayer);
|
||||
|
||||
extern void G_MaybeAllocPlayer(int32_t pnum);
|
||||
|
||||
static inline void G_HandleAsync(void)
|
||||
{
|
||||
handleevents();
|
||||
Net_GetPackets();
|
||||
}
|
||||
|
||||
static inline int32_t calc_smoothratio(int32_t totalclk, int32_t ototalclk)
|
||||
{
|
||||
return clamp((totalclk-ototalclk)*(65536/TICSPERFRAME), 0, 65536);
|
||||
}
|
||||
|
||||
// sector effector lotags
|
||||
enum
|
||||
{
|
||||
SE_0_ROTATING_SECTOR = 0,
|
||||
SE_1_PIVOT = 1,
|
||||
SE_2_EARTHQUAKE = 2,
|
||||
SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT = 3,
|
||||
SE_4_RANDOM_LIGHTS = 4,
|
||||
SE_5 = 5,
|
||||
SE_6_SUBWAY = 6,
|
||||
// ^^ potentially incomplete substitution in code
|
||||
// vv almost surely complete substitution
|
||||
SE_7_TELEPORT = 7,
|
||||
SE_8_UP_OPEN_DOOR_LIGHTS = 8,
|
||||
SE_9_DOWN_OPEN_DOOR_LIGHTS = 9,
|
||||
SE_10_DOOR_AUTO_CLOSE = 10,
|
||||
SE_11_SWINGING_DOOR = 11,
|
||||
SE_12_LIGHT_SWITCH = 12,
|
||||
SE_13_EXPLOSIVE = 13,
|
||||
SE_14_SUBWAY_CAR = 14,
|
||||
SE_15_SLIDING_DOOR = 15,
|
||||
SE_16_REACTOR = 16,
|
||||
SE_17_WARP_ELEVATOR = 17,
|
||||
SE_18_INCREMENTAL_SECTOR_RISE_FALL = 18,
|
||||
SE_19_EXPLOSION_LOWERS_CEILING = 19,
|
||||
SE_20_STRETCH_BRIDGE = 20,
|
||||
SE_21_DROP_FLOOR = 21,
|
||||
SE_22_TEETH_DOOR = 22,
|
||||
SE_23_ONE_WAY_TELEPORT = 23,
|
||||
SE_24_CONVEYOR = 24,
|
||||
SE_25_PISTON = 25,
|
||||
SE_26 = 26,
|
||||
SE_27_DEMO_CAM = 27,
|
||||
SE_28_LIGHTNING = 28,
|
||||
SE_29_WAVES = 29,
|
||||
SE_30_TWO_WAY_TRAIN = 30,
|
||||
SE_31_FLOOR_RISE_FALL = 31,
|
||||
SE_32_CEILING_RISE_FALL = 32,
|
||||
SE_33_QUAKE_DEBRIS = 33,
|
||||
SE_34 = 34, // XXX
|
||||
SE_35 = 35, // XXX
|
||||
SE_36_PROJ_SHOOTER = 36,
|
||||
SE_49_POINT_LIGHT = 49,
|
||||
SE_50_SPOT_LIGHT = 50,
|
||||
SE_130 = 130,
|
||||
SE_131 = 131,
|
||||
};
|
||||
|
||||
// sector lotags
|
||||
enum
|
||||
{
|
||||
ST_0_NO_EFFECT = 0,
|
||||
ST_1_ABOVE_WATER = 1,
|
||||
ST_2_UNDERWATER = 2,
|
||||
ST_3 = 3,
|
||||
// ^^^ maybe not complete substitution in code
|
||||
ST_9_SLIDING_ST_DOOR = 9,
|
||||
ST_15_WARP_ELEVATOR = 15,
|
||||
ST_16_PLATFORM_DOWN = 16,
|
||||
ST_17_PLATFORM_UP = 17,
|
||||
ST_18_ELEVATOR_DOWN = 18,
|
||||
ST_19_ELEVATOR_UP = 19,
|
||||
ST_20_CEILING_DOOR = 20,
|
||||
ST_21_FLOOR_DOOR = 21,
|
||||
ST_22_SPLITTING_DOOR = 22,
|
||||
ST_23_SWINGING_DOOR = 23,
|
||||
ST_25_SLIDING_DOOR = 25,
|
||||
ST_26_SPLITTING_ST_DOOR = 26,
|
||||
ST_27_STRETCH_BRIDGE = 27,
|
||||
ST_28_DROP_FLOOR = 28,
|
||||
ST_29_TEETH_DOOR = 29,
|
||||
ST_30_ROTATE_RISE_BRIDGE = 30,
|
||||
ST_31_TWO_WAY_TRAIN = 31,
|
||||
// left: ST 32767, 65534, 65535
|
||||
};
|
||||
|
||||
|
||||
#define G_ModDirSnprintf(buf, size, basename, ...) \
|
||||
\
|
||||
(((g_modDir[0] != '/') ? Bsnprintf(buf, size, "%s/" basename, g_modDir, ##__VA_ARGS__) \
|
||||
: Bsnprintf(buf, size, basename, ##__VA_ARGS__)) >= ((int32_t)size) - 1\
|
||||
)
|
||||
#define G_ModDirSnprintfLite(buf, size, basename) \
|
||||
\
|
||||
((g_modDir[0] != '/') ? Bsnprintf(buf, size, "%s/%s", g_modDir, basename) \
|
||||
: Bsnprintf(buf, size, basename))
|
||||
|
||||
static inline void G_NewGame_EnterLevel(void)
|
||||
{
|
||||
G_NewGame(ud.m_volume_number, ud.m_level_number, ud.m_player_skill);
|
||||
|
||||
if (G_EnterLevel(MODE_GAME))
|
||||
G_BackToMenu();
|
||||
}
|
||||
|
||||
static inline int G_GetMusicIdx(const char *str)
|
||||
{
|
||||
int32_t lev, ep;
|
||||
signed char b1, b2;
|
||||
|
||||
int numMatches = sscanf(str, "%c%d%c%d", &b1,&ep, &b2,&lev);
|
||||
|
||||
if (numMatches != 4 || Btoupper(b1) != 'E' || Btoupper(b2) != 'L')
|
||||
return -1;
|
||||
|
||||
if ((unsigned)--lev >= MAXLEVELS || (unsigned)--ep >= MAXVOLUMES)
|
||||
return -2;
|
||||
|
||||
return (ep * MAXLEVELS) + lev;
|
||||
}
|
||||
|
||||
static inline int G_GetViewscreenSizeShift(const uspritetype *tspr)
|
||||
{
|
||||
#if VIEWSCREENFACTOR == 0
|
||||
UNREFERENCED_PARAMETER(tspr);
|
||||
return VIEWSCREENFACTOR;
|
||||
#else
|
||||
static const int mask = (1<<VIEWSCREENFACTOR)-1;
|
||||
const int rem = (tspr->xrepeat & mask) | (tspr->yrepeat & mask);
|
||||
|
||||
for (bssize_t i=0; i < VIEWSCREENFACTOR; i++)
|
||||
if (rem & (1<<i))
|
||||
return i;
|
||||
|
||||
return VIEWSCREENFACTOR;
|
||||
#endif
|
||||
}
|
||||
|
||||
extern void G_PrintCurrentMusic(void);
|
||||
|
||||
EXTERN_INLINE_HEADER void G_SetStatusBarScale(int32_t sc);
|
||||
|
||||
EXTERN_INLINE_HEADER void SetIfGreater(int32_t *variable, int32_t potentialValue);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef ONLY_USERDEFS
|
||||
|
||||
#if defined game_c_ || !defined DISABLE_INLINING
|
||||
|
||||
EXTERN_INLINE void G_SetStatusBarScale(int32_t sc)
|
||||
{
|
||||
ud.statusbarscale = clamp(sc, 36, 100);
|
||||
G_UpdateScreenArea();
|
||||
}
|
||||
|
||||
// the point of this is to prevent re-running a function or calculation passed to potentialValue
|
||||
// without making a new variable under each individual circumstance
|
||||
EXTERN_INLINE void SetIfGreater(int32_t *variable, int32_t potentialValue)
|
||||
{
|
||||
if (potentialValue > *variable)
|
||||
*variable = potentialValue;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
2565
source/rr/src/gamedef.cpp
Normal file
870
source/rr/src/gamedef.h
Normal file
|
@ -0,0 +1,870 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2016 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#ifndef gamedef_h_
|
||||
#define gamedef_h_
|
||||
|
||||
#include "build.h" // hashtable_t
|
||||
#include "common.h" // tokenlist
|
||||
#include "player.h" // projectile_t
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
LABEL_ANY = -1,
|
||||
LABEL_DEFINE = 1,
|
||||
LABEL_STATE = 2,
|
||||
LABEL_ACTOR = 4,
|
||||
LABEL_ACTION = 8,
|
||||
LABEL_AI = 16,
|
||||
LABEL_MOVE = 32,
|
||||
LABEL_EVENT = 64,
|
||||
};
|
||||
|
||||
#define LABEL_HASPARM2 1
|
||||
#define LABEL_ISSTRING 2
|
||||
|
||||
#define MAXCHEATLEN 20
|
||||
#define NUMCHEATCODES (int32_t)ARRAY_SIZE(CheatStrings)
|
||||
|
||||
#define VM_INSTMASK 0xfff
|
||||
|
||||
#define C_CUSTOMERROR(Text, ...) \
|
||||
do \
|
||||
{ \
|
||||
C_ReportError(-1); \
|
||||
initprintf("%s:%d: error: " Text "\n", g_scriptFileName, g_lineNumber, ##__VA_ARGS__); \
|
||||
g_errorCnt++; \
|
||||
} while (0)
|
||||
|
||||
#define C_CUSTOMWARNING(Text, ...) \
|
||||
do \
|
||||
{ \
|
||||
C_ReportError(-1); \
|
||||
initprintf("%s:%d: warning: " Text "\n", g_scriptFileName, g_lineNumber, ##__VA_ARGS__); \
|
||||
g_warningCnt++; \
|
||||
} while (0)
|
||||
|
||||
extern intptr_t const * insptr;
|
||||
extern void VM_ScriptInfo(intptr_t const *ptr, int range);
|
||||
|
||||
extern hashtable_t h_gamefuncs;
|
||||
|
||||
extern hashtable_t h_labels;
|
||||
|
||||
extern int32_t g_aimAngleVarID; // var ID of "AUTOAIMANGLE"
|
||||
extern int32_t g_angRangeVarID; // var ID of "ANGRANGE"
|
||||
extern int32_t g_hitagVarID; // var ID of "HITAG"
|
||||
extern int32_t g_lotagVarID; // var ID of "LOTAG"
|
||||
extern int32_t g_returnVarID; // var ID of "RETURN"
|
||||
extern int32_t g_textureVarID; // var ID of "TEXTURE"
|
||||
extern int32_t g_thisActorVarID; // var ID of "THISACTOR"
|
||||
extern int32_t g_weaponVarID; // var ID of "WEAPON"
|
||||
extern int32_t g_worksLikeVarID; // var ID of "WORKSLIKE"
|
||||
extern int32_t g_zRangeVarID; // var ID of "ZRANGE"
|
||||
|
||||
// KEEPINSYNC gamevars.c: "special vars for struct access"
|
||||
enum QuickStructureAccess_t
|
||||
{
|
||||
STRUCT_SPRITE,
|
||||
STRUCT_SECTOR,
|
||||
STRUCT_WALL,
|
||||
STRUCT_PLAYER,
|
||||
STRUCT_ACTORVAR,
|
||||
STRUCT_PLAYERVAR,
|
||||
STRUCT_TSPR,
|
||||
STRUCT_PROJECTILE,
|
||||
STRUCT_THISPROJECTILE,
|
||||
STRUCT_USERDEF,
|
||||
STRUCT_INPUT,
|
||||
STRUCT_TILEDATA,
|
||||
STRUCT_PALDATA,
|
||||
NUMQUICKSTRUCTS,
|
||||
};
|
||||
|
||||
extern int32_t g_structVarIDs;
|
||||
|
||||
extern char CheatStrings[][MAXCHEATLEN];
|
||||
extern char g_scriptFileName[BMAX_PATH];
|
||||
|
||||
extern const uint32_t CheatFunctionFlags[];
|
||||
extern const uint8_t CheatFunctionIDs[];
|
||||
|
||||
extern int32_t g_errorCnt;
|
||||
extern int32_t g_lineNumber;
|
||||
extern int32_t g_scriptVersion;
|
||||
extern int32_t g_totalLines;
|
||||
extern int32_t g_warningCnt;
|
||||
extern uint32_t g_scriptcrc;
|
||||
extern int32_t otherp;
|
||||
|
||||
extern const char *EventNames[]; // MAXEVENTS
|
||||
|
||||
extern intptr_t *g_scriptPtr;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *name;
|
||||
int lId, flags, maxParm2;
|
||||
} memberlabel_t;
|
||||
|
||||
extern const memberlabel_t ActorLabels[];
|
||||
extern const memberlabel_t InputLabels[];
|
||||
extern const memberlabel_t PalDataLabels[];
|
||||
extern const memberlabel_t PlayerLabels[];
|
||||
extern const memberlabel_t ProjectileLabels[];
|
||||
extern const memberlabel_t SectorLabels[];
|
||||
extern const memberlabel_t TileDataLabels[];
|
||||
extern const memberlabel_t TsprLabels[];
|
||||
extern const memberlabel_t UserdefsLabels[];
|
||||
extern const memberlabel_t WallLabels[];
|
||||
|
||||
typedef projectile_t defaultprojectile_t;
|
||||
|
||||
extern defaultprojectile_t DefaultProjectile;
|
||||
int32_t C_AllocQuote(int32_t qnum);
|
||||
void C_InitQuotes(void);
|
||||
|
||||
extern int32_t g_numProjectiles;
|
||||
|
||||
typedef struct {
|
||||
int spriteNum;
|
||||
int playerNum;
|
||||
int playerDist;
|
||||
int flags;
|
||||
|
||||
union {
|
||||
spritetype * pSprite;
|
||||
uspritetype *pUSprite;
|
||||
};
|
||||
|
||||
int32_t * pData;
|
||||
DukePlayer_t *pPlayer;
|
||||
actor_t * pActor;
|
||||
} vmstate_t;
|
||||
|
||||
extern vmstate_t vm;
|
||||
|
||||
void G_DoGameStartup(const int32_t *params);
|
||||
void C_DefineMusic(int volumeNum, int levelNum, const char *fileName);
|
||||
|
||||
void C_DefineVolumeFlags(int32_t vol, int32_t flags);
|
||||
void C_UndefineVolume(int32_t vol);
|
||||
void C_UndefineSkill(int32_t skill);
|
||||
void C_UndefineLevel(int32_t vol, int32_t lev);
|
||||
void C_ReportError(int32_t iError);
|
||||
void C_Compile(const char *filenam);
|
||||
|
||||
extern int32_t g_errorLineNum;
|
||||
extern int32_t g_tw;
|
||||
|
||||
typedef struct {
|
||||
const char* token;
|
||||
int32_t val;
|
||||
} tokenmap_t;
|
||||
|
||||
extern char const * VM_GetKeywordForID(int32_t id);
|
||||
|
||||
// KEEPINSYNC lunatic/con_lang.lua
|
||||
enum SystemString_t {
|
||||
STR_MAPNAME,
|
||||
STR_MAPFILENAME,
|
||||
STR_PLAYERNAME,
|
||||
STR_VERSION,
|
||||
STR_GAMETYPE,
|
||||
STR_VOLUMENAME,
|
||||
STR_YOURTIME,
|
||||
STR_PARTIME,
|
||||
STR_DESIGNERTIME,
|
||||
STR_BESTTIME,
|
||||
STR_USERMAPFILENAME,
|
||||
};
|
||||
|
||||
enum ScriptError_t
|
||||
{
|
||||
ERROR_CLOSEBRACKET,
|
||||
ERROR_EVENTONLY,
|
||||
ERROR_EXCEEDSMAXTILES,
|
||||
ERROR_EXPECTEDKEYWORD,
|
||||
ERROR_FOUNDWITHIN,
|
||||
ERROR_ISAKEYWORD,
|
||||
ERROR_NOENDSWITCH,
|
||||
ERROR_NOTAGAMEDEF,
|
||||
ERROR_NOTAGAMEVAR,
|
||||
ERROR_NOTAGAMEARRAY,
|
||||
ERROR_GAMEARRAYBNC,
|
||||
ERROR_GAMEARRAYBNO,
|
||||
ERROR_INVALIDARRAYWRITE,
|
||||
ERROR_OPENBRACKET,
|
||||
ERROR_PARAMUNDEFINED,
|
||||
ERROR_NOTAMEMBER,
|
||||
ERROR_SYNTAXERROR,
|
||||
ERROR_VARREADONLY,
|
||||
ERROR_ARRAYREADONLY,
|
||||
ERROR_VARTYPEMISMATCH,
|
||||
WARNING_BADGAMEVAR,
|
||||
WARNING_DUPLICATECASE,
|
||||
WARNING_DUPLICATEDEFINITION,
|
||||
WARNING_EVENTSYNC,
|
||||
WARNING_LABELSONLY,
|
||||
WARNING_NAMEMATCHESVAR,
|
||||
WARNING_VARMASKSKEYWORD,
|
||||
WARNING_ARRAYMASKSKEYWORD
|
||||
};
|
||||
|
||||
enum PlayerLabel_t
|
||||
{
|
||||
PLAYER_ZOOM,
|
||||
PLAYER_EXITX,
|
||||
PLAYER_EXITY,
|
||||
PLAYER_LOOGIEX,
|
||||
PLAYER_LOOGIEY,
|
||||
PLAYER_NUMLOOGS,
|
||||
PLAYER_LOOGCNT,
|
||||
PLAYER_POSX,
|
||||
PLAYER_POSY,
|
||||
PLAYER_POSZ,
|
||||
PLAYER_HORIZ,
|
||||
PLAYER_OHORIZ,
|
||||
PLAYER_OHORIZOFF,
|
||||
PLAYER_INVDISPTIME,
|
||||
PLAYER_BOBPOSX,
|
||||
PLAYER_BOBPOSY,
|
||||
PLAYER_OPOSX,
|
||||
PLAYER_OPOSY,
|
||||
PLAYER_OPOSZ,
|
||||
PLAYER_PYOFF,
|
||||
PLAYER_OPYOFF,
|
||||
PLAYER_POSXV,
|
||||
PLAYER_POSYV,
|
||||
PLAYER_POSZV,
|
||||
PLAYER_LAST_PISSED_TIME,
|
||||
PLAYER_TRUEFZ,
|
||||
PLAYER_TRUECZ,
|
||||
PLAYER_PLAYER_PAR,
|
||||
PLAYER_VISIBILITY,
|
||||
PLAYER_BOBCOUNTER,
|
||||
PLAYER_WEAPON_SWAY,
|
||||
PLAYER_PALS_TIME,
|
||||
PLAYER_RANDOMFLAMEX,
|
||||
PLAYER_CRACK_TIME,
|
||||
PLAYER_AIM_MODE,
|
||||
PLAYER_ANG,
|
||||
PLAYER_OANG,
|
||||
PLAYER_ANGVEL,
|
||||
PLAYER_CURSECTNUM,
|
||||
PLAYER_LOOK_ANG,
|
||||
PLAYER_LAST_EXTRA,
|
||||
PLAYER_SUBWEAPON,
|
||||
PLAYER_AMMO_AMOUNT,
|
||||
PLAYER_WACKEDBYACTOR,
|
||||
PLAYER_FRAG,
|
||||
PLAYER_FRAGGEDSELF,
|
||||
PLAYER_CURR_WEAPON,
|
||||
PLAYER_LAST_WEAPON,
|
||||
PLAYER_TIPINCS,
|
||||
PLAYER_HORIZOFF,
|
||||
PLAYER_WANTWEAPONFIRE,
|
||||
PLAYER_HOLODUKE_AMOUNT,
|
||||
PLAYER_NEWOWNER,
|
||||
PLAYER_HURT_DELAY,
|
||||
PLAYER_HBOMB_HOLD_DELAY,
|
||||
PLAYER_JUMPING_COUNTER,
|
||||
PLAYER_AIRLEFT,
|
||||
PLAYER_KNEE_INCS,
|
||||
PLAYER_ACCESS_INCS,
|
||||
PLAYER_FTA,
|
||||
PLAYER_FTQ,
|
||||
PLAYER_ACCESS_WALLNUM,
|
||||
PLAYER_ACCESS_SPRITENUM,
|
||||
PLAYER_KICKBACK_PIC,
|
||||
PLAYER_GOT_ACCESS,
|
||||
PLAYER_WEAPON_ANG,
|
||||
PLAYER_FIRSTAID_AMOUNT,
|
||||
PLAYER_SOMETHINGONPLAYER,
|
||||
PLAYER_ON_CRANE,
|
||||
PLAYER_I,
|
||||
PLAYER_ONE_PARALLAX_SECTNUM,
|
||||
PLAYER_OVER_SHOULDER_ON,
|
||||
PLAYER_RANDOM_CLUB_FRAME,
|
||||
PLAYER_FIST_INCS,
|
||||
PLAYER_ONE_EIGHTY_COUNT,
|
||||
PLAYER_CHEAT_PHASE,
|
||||
PLAYER_DUMMYPLAYERSPRITE,
|
||||
PLAYER_EXTRA_EXTRA8,
|
||||
PLAYER_QUICK_KICK,
|
||||
PLAYER_HEAT_AMOUNT,
|
||||
PLAYER_ACTORSQU,
|
||||
PLAYER_TIMEBEFOREEXIT,
|
||||
PLAYER_CUSTOMEXITSOUND,
|
||||
PLAYER_WEAPRECS,
|
||||
PLAYER_WEAPRECCNT,
|
||||
PLAYER_INTERFACE_TOGGLE_FLAG,
|
||||
PLAYER_ROTSCRNANG,
|
||||
PLAYER_DEAD_FLAG,
|
||||
PLAYER_SHOW_EMPTY_WEAPON,
|
||||
PLAYER_SCUBA_AMOUNT,
|
||||
PLAYER_JETPACK_AMOUNT,
|
||||
PLAYER_STEROIDS_AMOUNT,
|
||||
PLAYER_SHIELD_AMOUNT,
|
||||
PLAYER_HOLODUKE_ON,
|
||||
PLAYER_PYCOUNT,
|
||||
PLAYER_WEAPON_POS,
|
||||
PLAYER_FRAG_PS,
|
||||
PLAYER_TRANSPORTER_HOLD,
|
||||
PLAYER_CLIPDIST,
|
||||
PLAYER_LAST_FULL_WEAPON,
|
||||
PLAYER_FOOTPRINTSHADE,
|
||||
PLAYER_BOOT_AMOUNT,
|
||||
PLAYER_SCREAM_VOICE,
|
||||
PLAYER_GM,
|
||||
PLAYER_ON_WARPING_SECTOR,
|
||||
PLAYER_FOOTPRINTCOUNT,
|
||||
PLAYER_HBOMB_ON,
|
||||
PLAYER_JUMPING_TOGGLE,
|
||||
PLAYER_RAPID_FIRE_HOLD,
|
||||
PLAYER_ON_GROUND,
|
||||
PLAYER_NAME,
|
||||
PLAYER_INVEN_ICON,
|
||||
PLAYER_BUTTONPALETTE,
|
||||
PLAYER_JETPACK_ON,
|
||||
PLAYER_SPRITEBRIDGE,
|
||||
PLAYER_LASTRANDOMSPOT,
|
||||
PLAYER_SCUBA_ON,
|
||||
PLAYER_FOOTPRINTPAL,
|
||||
PLAYER_HEAT_ON,
|
||||
PLAYER_HOLSTER_WEAPON,
|
||||
PLAYER_FALLING_COUNTER,
|
||||
PLAYER_GOTWEAPON,
|
||||
PLAYER_REFRESH_INVENTORY,
|
||||
PLAYER_PALETTE,
|
||||
PLAYER_TOGGLE_KEY_FLAG,
|
||||
PLAYER_KNUCKLE_INCS,
|
||||
PLAYER_WALKING_SND_TOGGLE,
|
||||
PLAYER_PALOOKUP,
|
||||
PLAYER_HARD_LANDING,
|
||||
PLAYER_MAX_SECRET_ROOMS,
|
||||
PLAYER_SECRET_ROOMS,
|
||||
PLAYER_PALS,
|
||||
PLAYER_MAX_ACTORS_KILLED,
|
||||
PLAYER_ACTORS_KILLED,
|
||||
PLAYER_RETURN_TO_CENTER,
|
||||
PLAYER_RUNSPEED,
|
||||
PLAYER_SBS,
|
||||
PLAYER_RELOADING,
|
||||
PLAYER_AUTO_AIM,
|
||||
PLAYER_MOVEMENT_LOCK,
|
||||
PLAYER_SOUND_PITCH,
|
||||
PLAYER_WEAPONSWITCH,
|
||||
PLAYER_TEAM,
|
||||
PLAYER_MAX_PLAYER_HEALTH,
|
||||
PLAYER_MAX_SHIELD_AMOUNT,
|
||||
PLAYER_MAX_AMMO_AMOUNT,
|
||||
PLAYER_LAST_QUICK_KICK,
|
||||
PLAYER_AUTOSTEP,
|
||||
PLAYER_AUTOSTEP_SBW,
|
||||
PLAYER_HUDPAL,
|
||||
PLAYER_INDEX,
|
||||
PLAYER_CONNECTED,
|
||||
PLAYER_FRAGS,
|
||||
PLAYER_DEATHS,
|
||||
PLAYER_LAST_USED_WEAPON,
|
||||
PLAYER_END
|
||||
};
|
||||
|
||||
enum UserdefsLabel_t
|
||||
{
|
||||
USERDEFS_GOD,
|
||||
USERDEFS_WARP_ON,
|
||||
USERDEFS_CASHMAN,
|
||||
USERDEFS_EOG,
|
||||
USERDEFS_SHOWALLMAP,
|
||||
USERDEFS_SHOW_HELP,
|
||||
USERDEFS_SCROLLMODE,
|
||||
USERDEFS_CLIPPING,
|
||||
USERDEFS_USER_NAME,
|
||||
USERDEFS_RIDECULE,
|
||||
USERDEFS_SAVEGAME,
|
||||
USERDEFS_PWLOCKOUT,
|
||||
USERDEFS_RTSNAME,
|
||||
USERDEFS_OVERHEAD_ON,
|
||||
USERDEFS_LAST_OVERHEAD,
|
||||
USERDEFS_SHOWWEAPONS,
|
||||
USERDEFS_PAUSE_ON,
|
||||
USERDEFS_FROM_BONUS,
|
||||
USERDEFS_CAMERASPRITE,
|
||||
USERDEFS_LAST_CAMSPRITE,
|
||||
USERDEFS_LAST_LEVEL,
|
||||
USERDEFS_SECRETLEVEL,
|
||||
USERDEFS_CONST_VISIBILITY,
|
||||
USERDEFS_UW_FRAMERATE,
|
||||
USERDEFS_CAMERA_TIME,
|
||||
USERDEFS_FOLFVEL,
|
||||
USERDEFS_FOLAVEL,
|
||||
USERDEFS_FOLX,
|
||||
USERDEFS_FOLY,
|
||||
USERDEFS_FOLA,
|
||||
USERDEFS_RECCNT,
|
||||
USERDEFS_ENTERED_NAME,
|
||||
USERDEFS_SCREEN_TILTING,
|
||||
USERDEFS_SHADOWS,
|
||||
USERDEFS_FTA_ON,
|
||||
USERDEFS_EXECUTIONS,
|
||||
USERDEFS_AUTO_RUN,
|
||||
USERDEFS_COORDS,
|
||||
USERDEFS_TICKRATE,
|
||||
USERDEFS_M_COOP,
|
||||
USERDEFS_COOP,
|
||||
USERDEFS_SCREEN_SIZE,
|
||||
USERDEFS_LOCKOUT,
|
||||
USERDEFS_CROSSHAIR,
|
||||
USERDEFS_PLAYERAI,
|
||||
USERDEFS_RESPAWN_MONSTERS,
|
||||
USERDEFS_RESPAWN_ITEMS,
|
||||
USERDEFS_RESPAWN_INVENTORY,
|
||||
USERDEFS_RECSTAT,
|
||||
USERDEFS_MONSTERS_OFF,
|
||||
USERDEFS_BRIGHTNESS,
|
||||
USERDEFS_M_RESPAWN_ITEMS,
|
||||
USERDEFS_M_RESPAWN_MONSTERS,
|
||||
USERDEFS_M_RESPAWN_INVENTORY,
|
||||
USERDEFS_M_RECSTAT,
|
||||
USERDEFS_M_MONSTERS_OFF,
|
||||
USERDEFS_DETAIL,
|
||||
USERDEFS_M_FFIRE,
|
||||
USERDEFS_FFIRE,
|
||||
USERDEFS_M_PLAYER_SKILL,
|
||||
USERDEFS_M_LEVEL_NUMBER,
|
||||
USERDEFS_M_VOLUME_NUMBER,
|
||||
USERDEFS_MULTIMODE,
|
||||
USERDEFS_PLAYER_SKILL,
|
||||
USERDEFS_LEVEL_NUMBER,
|
||||
USERDEFS_VOLUME_NUMBER,
|
||||
USERDEFS_M_MARKER,
|
||||
USERDEFS_MARKER,
|
||||
USERDEFS_MOUSEFLIP,
|
||||
USERDEFS_STATUSBARSCALE,
|
||||
USERDEFS_DRAWWEAPON,
|
||||
USERDEFS_MOUSEAIMING,
|
||||
USERDEFS_WEAPONSWITCH,
|
||||
USERDEFS_DEMOCAMS,
|
||||
USERDEFS_COLOR,
|
||||
USERDEFS_MSGDISPTIME,
|
||||
USERDEFS_STATUSBARMODE,
|
||||
USERDEFS_M_NOEXITS,
|
||||
USERDEFS_NOEXITS,
|
||||
USERDEFS_AUTOVOTE,
|
||||
USERDEFS_AUTOMSG,
|
||||
USERDEFS_IDPLAYERS,
|
||||
USERDEFS_TEAM,
|
||||
USERDEFS_VIEWBOB,
|
||||
USERDEFS_WEAPONSWAY,
|
||||
USERDEFS_ANGLEINTERPOLATION,
|
||||
USERDEFS_OBITUARIES,
|
||||
USERDEFS_LEVELSTATS,
|
||||
USERDEFS_CROSSHAIRSCALE,
|
||||
USERDEFS_ALTHUD,
|
||||
USERDEFS_DISPLAY_BONUS_SCREEN,
|
||||
USERDEFS_SHOW_LEVEL_TEXT,
|
||||
USERDEFS_WEAPONSCALE,
|
||||
USERDEFS_TEXTSCALE,
|
||||
USERDEFS_RUNKEY_MODE,
|
||||
USERDEFS_M_ORIGIN_X,
|
||||
USERDEFS_M_ORIGIN_Y,
|
||||
USERDEFS_PLAYERBEST,
|
||||
USERDEFS_MUSICTOGGLE,
|
||||
USERDEFS_USEVOXELS,
|
||||
USERDEFS_USEHIGHTILE,
|
||||
USERDEFS_USEMODELS,
|
||||
USERDEFS_GAMETYPEFLAGS,
|
||||
USERDEFS_M_GAMETYPEFLAGS,
|
||||
USERDEFS_GLOBALFLAGS,
|
||||
USERDEFS_GLOBALGAMEFLAGS,
|
||||
USERDEFS_VM_PLAYER,
|
||||
USERDEFS_VM_SPRITE,
|
||||
USERDEFS_VM_DISTANCE,
|
||||
USERDEFS_SOUNDTOGGLE,
|
||||
USERDEFS_GAMETEXT_TRACKING,
|
||||
USERDEFS_MGAMETEXT_TRACKING,
|
||||
USERDEFS_MENUTEXT_TRACKING,
|
||||
USERDEFS_MAXSPRITESONSCREEN,
|
||||
USERDEFS_SCREENAREA_X1,
|
||||
USERDEFS_SCREENAREA_Y1,
|
||||
USERDEFS_SCREENAREA_X2,
|
||||
USERDEFS_SCREENAREA_Y2,
|
||||
USERDEFS_SCREENFADE,
|
||||
USERDEFS_MENUBACKGROUND,
|
||||
USERDEFS_STATUSBARFLAGS,
|
||||
USERDEFS_STATUSBARRANGE,
|
||||
USERDEFS_STATUSBARCUSTOM,
|
||||
USERDEFS_HUDONTOP,
|
||||
USERDEFS_MENU_SLIDEBARZ,
|
||||
USERDEFS_MENU_SLIDEBARMARGIN,
|
||||
USERDEFS_MENU_SLIDECURSORZ,
|
||||
USERDEFS_GLOBAL_R,
|
||||
USERDEFS_GLOBAL_G,
|
||||
USERDEFS_GLOBAL_B,
|
||||
USERDEFS_DEFAULT_VOLUME,
|
||||
USERDEFS_DEFAULT_SKILL,
|
||||
USERDEFS_MENU_SHADEDESELECTED,
|
||||
USERDEFS_MENU_SHADEDISABLED,
|
||||
USERDEFS_MENUTEXT_ZOOM,
|
||||
USERDEFS_MENUTEXT_XSPACE,
|
||||
USERDEFS_MENUTEXT_PAL,
|
||||
USERDEFS_MENUTEXT_PALSELECTED,
|
||||
USERDEFS_MENUTEXT_PALDESELECTED,
|
||||
USERDEFS_MENUTEXT_PALDISABLED,
|
||||
USERDEFS_MENUTEXT_PALSELECTED_RIGHT,
|
||||
USERDEFS_MENUTEXT_PALDESELECTED_RIGHT,
|
||||
USERDEFS_MENUTEXT_PALDISABLED_RIGHT,
|
||||
USERDEFS_GAMETEXT_ZOOM,
|
||||
USERDEFS_GAMETEXT_XSPACE,
|
||||
USERDEFS_GAMETEXT_PAL,
|
||||
USERDEFS_GAMETEXT_PALSELECTED,
|
||||
USERDEFS_GAMETEXT_PALDESELECTED,
|
||||
USERDEFS_GAMETEXT_PALDISABLED,
|
||||
USERDEFS_GAMETEXT_PALSELECTED_RIGHT,
|
||||
USERDEFS_GAMETEXT_PALDESELECTED_RIGHT,
|
||||
USERDEFS_GAMETEXT_PALDISABLED_RIGHT,
|
||||
USERDEFS_MINITEXT_ZOOM,
|
||||
USERDEFS_MINITEXT_XSPACE,
|
||||
USERDEFS_MINITEXT_TRACKING,
|
||||
USERDEFS_MINITEXT_PAL,
|
||||
USERDEFS_MINITEXT_PALSELECTED,
|
||||
USERDEFS_MINITEXT_PALDESELECTED,
|
||||
USERDEFS_MINITEXT_PALDISABLED,
|
||||
USERDEFS_MINITEXT_PALSELECTED_RIGHT,
|
||||
USERDEFS_MINITEXT_PALDESELECTED_RIGHT,
|
||||
USERDEFS_MINITEXT_PALDISABLED_RIGHT,
|
||||
USERDEFS_MENUTITLE_PAL,
|
||||
USERDEFS_SLIDEBAR_PALSELECTED,
|
||||
USERDEFS_SLIDEBAR_PALDISABLED,
|
||||
USERDEFS_USER_MAP,
|
||||
USERDEFS_M_USER_MAP,
|
||||
USERDEFS_MUSIC_EPISODE,
|
||||
USERDEFS_MUSIC_LEVEL,
|
||||
USERDEFS_SHADOW_PAL,
|
||||
USERDEFS_MENU_SCROLLBARTILENUM,
|
||||
USERDEFS_MENU_SCROLLBARZ,
|
||||
USERDEFS_MENU_SCROLLCURSORZ,
|
||||
USERDEFS_RETURN,
|
||||
USERDEFS_USERBYTEVERSION,
|
||||
USERDEFS_AUTOSAVE,
|
||||
USERDEFS_END
|
||||
};
|
||||
|
||||
enum SectorLabel_t
|
||||
{
|
||||
SECTOR_WALLPTR,
|
||||
SECTOR_WALLNUM,
|
||||
SECTOR_CEILINGZ,
|
||||
SECTOR_CEILINGZGOAL,
|
||||
SECTOR_CEILINGZVEL,
|
||||
SECTOR_FLOORZ,
|
||||
SECTOR_FLOORZGOAL,
|
||||
SECTOR_FLOORZVEL,
|
||||
SECTOR_CEILINGSTAT,
|
||||
SECTOR_FLOORSTAT,
|
||||
SECTOR_CEILINGPICNUM,
|
||||
SECTOR_CEILINGSLOPE,
|
||||
SECTOR_CEILINGSHADE,
|
||||
SECTOR_CEILINGPAL,
|
||||
SECTOR_CEILINGXPANNING,
|
||||
SECTOR_CEILINGYPANNING,
|
||||
SECTOR_FLOORPICNUM,
|
||||
SECTOR_FLOORSLOPE,
|
||||
SECTOR_FLOORSHADE,
|
||||
SECTOR_FLOORPAL,
|
||||
SECTOR_FLOORXPANNING,
|
||||
SECTOR_FLOORYPANNING,
|
||||
SECTOR_VISIBILITY,
|
||||
SECTOR_FOGPAL,
|
||||
SECTOR_LOTAG,
|
||||
SECTOR_HITAG,
|
||||
SECTOR_EXTRA,
|
||||
SECTOR_CEILINGBUNCH,
|
||||
SECTOR_FLOORBUNCH,
|
||||
SECTOR_ULOTAG,
|
||||
SECTOR_UHITAG,
|
||||
SECTOR_END
|
||||
};
|
||||
|
||||
enum WallLabel_t
|
||||
{
|
||||
WALL_X,
|
||||
WALL_Y,
|
||||
WALL_POINT2,
|
||||
WALL_NEXTWALL,
|
||||
WALL_NEXTSECTOR,
|
||||
WALL_CSTAT,
|
||||
WALL_PICNUM,
|
||||
WALL_OVERPICNUM,
|
||||
WALL_SHADE,
|
||||
WALL_PAL,
|
||||
WALL_XREPEAT,
|
||||
WALL_YREPEAT,
|
||||
WALL_XPANNING,
|
||||
WALL_YPANNING,
|
||||
WALL_LOTAG,
|
||||
WALL_HITAG,
|
||||
WALL_EXTRA,
|
||||
WALL_ULOTAG,
|
||||
WALL_UHITAG,
|
||||
WALL_BLEND,
|
||||
WALL_END
|
||||
};
|
||||
|
||||
enum ActorLabel_t
|
||||
{
|
||||
ACTOR_X,
|
||||
ACTOR_Y,
|
||||
ACTOR_Z,
|
||||
ACTOR_CSTAT,
|
||||
ACTOR_PICNUM,
|
||||
ACTOR_SHADE,
|
||||
ACTOR_PAL,
|
||||
ACTOR_CLIPDIST,
|
||||
ACTOR_DETAIL,
|
||||
ACTOR_XREPEAT,
|
||||
ACTOR_YREPEAT,
|
||||
ACTOR_XOFFSET,
|
||||
ACTOR_YOFFSET,
|
||||
ACTOR_SECTNUM,
|
||||
ACTOR_STATNUM,
|
||||
ACTOR_ANG,
|
||||
ACTOR_OWNER,
|
||||
ACTOR_XVEL,
|
||||
ACTOR_YVEL,
|
||||
ACTOR_ZVEL,
|
||||
ACTOR_LOTAG,
|
||||
ACTOR_HITAG,
|
||||
ACTOR_EXTRA,
|
||||
ACTOR_HTCGG,
|
||||
ACTOR_HTPICNUM,
|
||||
ACTOR_HTANG,
|
||||
ACTOR_HTEXTRA,
|
||||
ACTOR_HTOWNER,
|
||||
ACTOR_HTMOVFLAG,
|
||||
ACTOR_HTTEMPANG,
|
||||
ACTOR_HTACTORSTAYPUT,
|
||||
ACTOR_HTDISPICNUM,
|
||||
ACTOR_HTTIMETOSLEEP,
|
||||
ACTOR_HTFLOORZ,
|
||||
ACTOR_HTCEILINGZ,
|
||||
ACTOR_HTLASTVX,
|
||||
ACTOR_HTLASTVY,
|
||||
ACTOR_HTBPOSX,
|
||||
ACTOR_HTBPOSY,
|
||||
ACTOR_HTBPOSZ,
|
||||
ACTOR_HTG_T,
|
||||
ACTOR_ANGOFF,
|
||||
ACTOR_PITCH,
|
||||
ACTOR_ROLL,
|
||||
ACTOR_MDXOFF,
|
||||
ACTOR_MDYOFF,
|
||||
ACTOR_MDZOFF,
|
||||
ACTOR_MDFLAGS,
|
||||
ACTOR_XPANNING,
|
||||
ACTOR_YPANNING,
|
||||
ACTOR_HTFLAGS,
|
||||
ACTOR_ALPHA,
|
||||
ACTOR_ULOTAG,
|
||||
ACTOR_UHITAG,
|
||||
ACTOR_ISVALID,
|
||||
ACTOR_END
|
||||
};
|
||||
|
||||
enum InputLabel_t
|
||||
{
|
||||
INPUT_AVEL,
|
||||
INPUT_Q16AVEL,
|
||||
INPUT_HORZ,
|
||||
INPUT_Q16HORZ,
|
||||
INPUT_FVEL,
|
||||
INPUT_SVEL,
|
||||
INPUT_BITS,
|
||||
INPUT_EXTBITS,
|
||||
INPUT_END
|
||||
};
|
||||
|
||||
enum ScriptKeywords_t
|
||||
{
|
||||
CON_ELSE, // 0
|
||||
CON_ACTOR, // 1
|
||||
CON_ADDAMMO, // 2
|
||||
CON_IFRND, // 3
|
||||
CON_ENDA, // 4
|
||||
CON_IFCANSEE, // 5
|
||||
CON_IFHITWEAPON, // 6
|
||||
CON_ACTION, // 7
|
||||
CON_IFPDISTL, // 8
|
||||
CON_IFPDISTG, // 9
|
||||
CON_DEFINELEVELNAME, // 10
|
||||
CON_STRENGTH, // 11
|
||||
CON_BREAK, // 12
|
||||
CON_SHOOT, // 13
|
||||
CON_PALFROM, // 14
|
||||
CON_SOUND, // 15
|
||||
CON_FALL, // 16
|
||||
CON_STATE, // 17
|
||||
CON_ENDS, // 18
|
||||
CON_DEFINE, // 19
|
||||
CON_COMMENT, // 20 deprecated
|
||||
CON_IFAI, // 21
|
||||
CON_KILLIT, // 22
|
||||
CON_ADDWEAPON, // 23
|
||||
CON_AI, // 24
|
||||
CON_ADDPHEALTH, // 25
|
||||
CON_IFDEAD, // 26
|
||||
CON_IFSQUISHED, // 27
|
||||
CON_SIZETO, // 28
|
||||
CON_LEFTBRACE, // 29
|
||||
CON_RIGHTBRACE, // 30
|
||||
CON_SPAWN, // 31
|
||||
CON_MOVE, // 32
|
||||
CON_IFWASWEAPON, // 33
|
||||
CON_IFACTION, // 34
|
||||
CON_IFACTIONCOUNT, // 35
|
||||
CON_RESETACTIONCOUNT, // 36
|
||||
CON_DEBRIS, // 37
|
||||
CON_PSTOMP, // 38
|
||||
CON_BLOCKCOMMENT, // 39 deprecated
|
||||
CON_CSTAT, // 40
|
||||
CON_IFMOVE, // 41
|
||||
CON_RESETPLAYER, // 42
|
||||
CON_IFONWATER, // 43
|
||||
CON_IFINWATER, // 44
|
||||
CON_IFCANSHOOTTARGET, // 45
|
||||
CON_IFCOUNT, // 46
|
||||
CON_RESETCOUNT, // 47
|
||||
CON_ADDINVENTORY, // 48
|
||||
CON_IFACTORNOTSTAYPUT, // 49
|
||||
CON_HITRADIUS, // 50
|
||||
CON_IFP, // 51
|
||||
CON_COUNT, // 52
|
||||
CON_IFACTOR, // 53
|
||||
CON_MUSIC, // 54
|
||||
CON_INCLUDE, // 55
|
||||
CON_IFSTRENGTH, // 56
|
||||
CON_DEFINESOUND, // 57
|
||||
CON_GUTS, // 58
|
||||
CON_IFSPAWNEDBY, // 59
|
||||
CON_GAMESTARTUP, // 60
|
||||
CON_WACKPLAYER, // 61
|
||||
CON_IFGAPZL, // 62
|
||||
CON_IFHITSPACE, // 63
|
||||
CON_IFOUTSIDE, // 64
|
||||
CON_IFMULTIPLAYER, // 65
|
||||
CON_OPERATE, // 66
|
||||
CON_IFINSPACE, // 67
|
||||
CON_DEBUG, // 68
|
||||
CON_ENDOFGAME, // 69
|
||||
CON_IFBULLETNEAR, // 70
|
||||
CON_IFRESPAWN, // 71
|
||||
CON_IFFLOORDISTL, // 72
|
||||
CON_IFCEILINGDISTL, // 73
|
||||
CON_SPRITEPAL, // 74
|
||||
CON_IFPINVENTORY, // 75
|
||||
CON_BETANAME, // 76
|
||||
CON_CACTOR, // 77
|
||||
CON_IFPHEALTHL, // 78
|
||||
CON_DEFINEQUOTE, // 79
|
||||
CON_QUOTE, // 80
|
||||
CON_IFINOUTERSPACE, // 81
|
||||
CON_IFNOTMOVING, // 82
|
||||
CON_RESPAWNHITAG, // 83
|
||||
CON_TIP, // 84
|
||||
CON_IFSPRITEPAL, // 85
|
||||
CON_MONEY, // 86
|
||||
CON_SOUNDONCE, // 87
|
||||
CON_ADDKILLS, // 88
|
||||
CON_STOPSOUND, // 89
|
||||
CON_IFAWAYFROMWALL, // 90
|
||||
CON_IFCANSEETARGET, // 91
|
||||
CON_GLOBALSOUND, // 92
|
||||
CON_LOTSOFGLASS, // 93
|
||||
CON_IFGOTWEAPONCE, // 94
|
||||
CON_GETLASTPAL, // 95
|
||||
CON_PKICK, // 96
|
||||
CON_MIKESND, // 97
|
||||
CON_USERACTOR, // 98
|
||||
CON_SIZEAT, // 99
|
||||
CON_ADDSTRENGTH, // 100
|
||||
CON_CSTATOR, // 101
|
||||
CON_MAIL, // 102
|
||||
CON_PAPER, // 103
|
||||
CON_TOSSWEAPON, // 104
|
||||
CON_SLEEPTIME, // 105
|
||||
CON_NULLOP, // 106
|
||||
CON_DEFINEVOLUMENAME, // 107
|
||||
CON_DEFINESKILLNAME, // 108
|
||||
CON_IFNOSOUNDS, // 109
|
||||
CON_CLIPDIST, // 110
|
||||
CON_IFANGDIFFL, // 111
|
||||
CON_IFNOCOVER, // 112
|
||||
CON_IFHITTRUCK, // 113
|
||||
CON_IFTIPCOW, // 114
|
||||
CON_ISDRUNK, // 115
|
||||
CON_ISEAT, // 116
|
||||
CON_DESTROYIT, // 117
|
||||
CON_LARRYBIRD, // 118
|
||||
CON_STRAFELEFT, // 119
|
||||
CON_STRAFERIGHT, // 120
|
||||
CON_IFACTORHEALTHG, // 121
|
||||
CON_IFACTORHEALTHL, // 122
|
||||
CON_SLAPPLAYER, // 123
|
||||
CON_IFPDRUNK, // 124
|
||||
CON_TEARITUP, // 125
|
||||
CON_SMACKBUBBA, // 126
|
||||
CON_SOUNDTAGONCE, // 127
|
||||
CON_SOUNDTAG, // 128
|
||||
CON_IFSOUNDID, // 129
|
||||
CON_IFSOUNDDIST, // 130
|
||||
CON_IFONMUD, // 131
|
||||
CON_IFCOOP, // 132
|
||||
CON_IFMOTOFAST, // 133
|
||||
CON_IFWIND, // 134
|
||||
CON_SMACKSPRITE, // 135
|
||||
CON_IFONMOTO, // 136
|
||||
CON_IFONBOAT, // 137
|
||||
CON_FAKEBUBBA, // 138
|
||||
CON_MAMATRIGGER, // 139
|
||||
CON_MAMASPAWN, // 140
|
||||
CON_MAMAQUAKE, // 141
|
||||
CON_MAMAEND, // 142
|
||||
CON_NEWPIC, // 143
|
||||
CON_GARYBANJO, // 144
|
||||
CON_MOTOLOOPSND, // 145
|
||||
CON_IFSIZEDOWN, // 146
|
||||
CON_RNDMOVE, // 147
|
||||
CON_END
|
||||
};
|
||||
// KEEPINSYNC with the keyword list in lunatic/con_lang.lua
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // gamedef_h_
|
71
source/rr/src/gamedefs.h
Normal file
|
@ -0,0 +1,71 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
//****************************************************************************
|
||||
//
|
||||
// gamedefs.h
|
||||
//
|
||||
// common defines between the game and the setup program
|
||||
//
|
||||
//****************************************************************************
|
||||
|
||||
#ifndef gamedefs_public_h_
|
||||
#define gamedefs_public_h_
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// config file name
|
||||
#define SETUPFILENAME APPBASENAME ".cfg"
|
||||
|
||||
// KEEPINSYNC mact/include/_control.h, build/src/sdlayer.cpp
|
||||
#define MAXJOYBUTTONS 32
|
||||
#define MAXJOYBUTTONSANDHATS (MAXJOYBUTTONS+4)
|
||||
|
||||
// KEEPINSYNC mact/include/_control.h, build/src/sdlayer.cpp
|
||||
#define MAXMOUSEAXES 2
|
||||
#define MAXMOUSEDIGITAL (MAXMOUSEAXES*2)
|
||||
|
||||
// KEEPINSYNC mact/include/_control.h, build/src/sdlayer.cpp
|
||||
#define MAXJOYAXES 9
|
||||
#define MAXJOYDIGITAL (MAXJOYAXES*2)
|
||||
|
||||
// default mouse scale
|
||||
#define DEFAULTMOUSEANALOGUESCALE 65536
|
||||
|
||||
// default joystick settings
|
||||
|
||||
#if defined(GEKKO)
|
||||
#define DEFAULTJOYSTICKANALOGUESCALE 16384
|
||||
#define DEFAULTJOYSTICKANALOGUEDEAD 1000
|
||||
#define DEFAULTJOYSTICKANALOGUESATURATE 9500
|
||||
#else
|
||||
#define DEFAULTJOYSTICKANALOGUESCALE 65536
|
||||
#define DEFAULTJOYSTICKANALOGUEDEAD 1000
|
||||
#define DEFAULTJOYSTICKANALOGUESATURATE 9500
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
2719
source/rr/src/gameexec.cpp
Normal file
73
source/rr/src/gameexec.h
Normal file
|
@ -0,0 +1,73 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#ifndef gameexec_h_
|
||||
#define gameexec_h_
|
||||
|
||||
#include "build.h"
|
||||
#include "sector.h" // mapstate_t
|
||||
#include "gamedef.h" // vmstate_t
|
||||
#include "events_defs.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int32_t ticrandomseed;
|
||||
|
||||
extern vmstate_t vm;
|
||||
extern int32_t g_tw;
|
||||
extern int32_t g_errorLineNum;
|
||||
extern int32_t g_currentEventExec;
|
||||
|
||||
void A_LoadActor(int32_t spriteNum);
|
||||
|
||||
extern uint32_t g_actorCalls[MAXTILES];
|
||||
extern double g_actorTotalMs[MAXTILES], g_actorMinMs[MAXTILES], g_actorMaxMs[MAXTILES];
|
||||
|
||||
void A_Execute(int spriteNum, int playerNum, int playerDist);
|
||||
void A_Fall(int spriteNum);
|
||||
int32_t A_GetFurthestAngle(int spriteNum, int angDiv);
|
||||
void A_GetZLimits(int spriteNum);
|
||||
int32_t __fastcall G_GetAngleDelta(int32_t currAngle, int32_t newAngle);
|
||||
//void G_RestoreMapState();
|
||||
//void G_SaveMapState();
|
||||
|
||||
#define CON_ERRPRINTF(Text, ...) do { \
|
||||
OSD_Printf("Line %d, %s: " Text, g_errorLineNum, VM_GetKeywordForID(g_tw), ## __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define CON_CRITICALERRPRINTF(Text, ...) do { \
|
||||
OSD_Printf("Line %d, %s: " Text, g_errorLineNum, VM_GetKeywordForID(g_tw), ## __VA_ARGS__); \
|
||||
wm_msgbox(APPNAME, "Line %d, %s: " Text, g_errorLineNum, VM_GetKeywordForID(g_tw), ## __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
void G_GetTimeDate(int32_t * pValues);
|
||||
int G_StartTrack(int levelNum);
|
||||
void VM_UpdateAnim(int spriteNum, int32_t *pData);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
21
source/rr/src/gamestructures.cpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
0
source/rr/src/gamevars.cpp
Normal file
32
source/rr/src/gamevars.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#ifndef gamevars_h_
|
||||
#define gamevars_h_
|
||||
|
||||
// Alignments for per-player and per-actor variables.
|
||||
#define PLAYER_VAR_ALIGNMENT (sizeof(intptr_t))
|
||||
#define ACTOR_VAR_ALIGNMENT 16
|
||||
|
||||
#define ARRAY_ALIGNMENT 16
|
||||
|
||||
#endif
|
133
source/rr/src/global.cpp
Normal file
|
@ -0,0 +1,133 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#define global_c_
|
||||
#include "global.h"
|
||||
#include "duke3d.h"
|
||||
|
||||
user_defs ud;
|
||||
|
||||
const char *s_buildDate = "20120522";
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
char g_volumeNames[MAXVOLUMES][33] = { "L.A. Meltdown", "Lunar Apocalypse", "Shrapnel City" };
|
||||
char g_skillNames[MAXSKILLS][33] = { "Piece Of Cake", "Let's Rock", "Come Get Some", "Damn I'm Good" };
|
||||
char g_gametypeNames[MAXGAMETYPES][33]
|
||||
= { "DukeMatch (Spawn)", "Cooperative Play", "DukeMatch (No Spawn)", "Team DM (Spawn)", "Team DM (No Spawn)" };
|
||||
|
||||
int32_t g_volumeFlags[MAXVOLUMES];
|
||||
|
||||
int32_t g_gametypeFlags[MAXGAMETYPES] =
|
||||
{
|
||||
GAMETYPE_FRAGBAR |
|
||||
GAMETYPE_SCORESHEET |
|
||||
GAMETYPE_DMSWITCHES |
|
||||
GAMETYPE_ITEMRESPAWN |
|
||||
GAMETYPE_MARKEROPTION |
|
||||
GAMETYPE_ACCESSATSTART,
|
||||
|
||||
GAMETYPE_COOP |
|
||||
GAMETYPE_WEAPSTAY |
|
||||
GAMETYPE_COOPSPAWN |
|
||||
GAMETYPE_ACCESSCARDSPRITES |
|
||||
GAMETYPE_COOPVIEW |
|
||||
GAMETYPE_COOPSOUND |
|
||||
GAMETYPE_OTHERPLAYERSINMAP |
|
||||
GAMETYPE_PLAYERSFRIENDLY |
|
||||
GAMETYPE_FIXEDRESPAWN |
|
||||
GAMETYPE_PRESERVEINVENTORYDEATH,
|
||||
|
||||
GAMETYPE_WEAPSTAY |
|
||||
GAMETYPE_FRAGBAR |
|
||||
GAMETYPE_SCORESHEET |
|
||||
GAMETYPE_DMSWITCHES |
|
||||
GAMETYPE_ACCESSATSTART,
|
||||
|
||||
GAMETYPE_FRAGBAR |
|
||||
GAMETYPE_SCORESHEET |
|
||||
GAMETYPE_DMSWITCHES |
|
||||
GAMETYPE_ITEMRESPAWN |
|
||||
GAMETYPE_MARKEROPTION |
|
||||
GAMETYPE_ACCESSATSTART |
|
||||
GAMETYPE_TDM |
|
||||
GAMETYPE_TDMSPAWN,
|
||||
|
||||
GAMETYPE_WEAPSTAY |
|
||||
GAMETYPE_FRAGBAR |
|
||||
GAMETYPE_SCORESHEET |
|
||||
GAMETYPE_DMSWITCHES |
|
||||
GAMETYPE_ACCESSATSTART |
|
||||
GAMETYPE_TDM |
|
||||
GAMETYPE_TDMSPAWN,
|
||||
};
|
||||
|
||||
float g_gameUpdateAvgTime = -1.f;
|
||||
|
||||
int32_t g_actorRespawnTime = 768;
|
||||
int32_t g_bouncemineRadius = 2500;
|
||||
int32_t g_deleteQueueSize = 64;
|
||||
int32_t g_itemRespawnTime = 768;
|
||||
|
||||
int32_t g_morterRadius = 2500;
|
||||
int32_t g_numFreezeBounces = 3;
|
||||
int32_t g_gametypeCnt = 5;
|
||||
int32_t g_volumeCnt = 3;
|
||||
int32_t g_pipebombRadius = 2500;
|
||||
int32_t g_playerFriction = 0xCFD0;
|
||||
int32_t g_rpgRadius = 1780;
|
||||
int32_t g_scriptSize = 1048576;
|
||||
int32_t g_seenineRadius = 2048;
|
||||
int32_t g_shrinkerRadius = 650;
|
||||
int32_t g_spriteGravity = 176;
|
||||
int32_t g_timerTicsPerSecond = TICRATE;
|
||||
int32_t g_tripbombRadius = 3880;
|
||||
|
||||
int16_t g_blimpSpawnItems[15] =
|
||||
{
|
||||
RPGSPRITE__STATIC,
|
||||
CHAINGUNSPRITE__STATIC,
|
||||
DEVISTATORAMMO__STATIC,
|
||||
RPGAMMO__STATIC,
|
||||
RPGAMMO__STATIC,
|
||||
JETPACK__STATIC,
|
||||
SHIELD__STATIC,
|
||||
FIRSTAID__STATIC,
|
||||
STEROIDS__STATIC,
|
||||
RPGAMMO__STATIC,
|
||||
RPGAMMO__STATIC,
|
||||
RPGSPRITE__STATIC,
|
||||
RPGAMMO__STATIC,
|
||||
FREEZESPRITE__STATIC,
|
||||
FREEZEAMMO__STATIC
|
||||
};
|
||||
|
||||
char CheatKeys[2] = { sc_D, sc_N };
|
||||
|
||||
char g_setupFileName[BMAX_PATH] = SETUPFILENAME;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
302
source/rr/src/global.h
Normal file
|
@ -0,0 +1,302 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#ifndef global_h_
|
||||
#define global_h_
|
||||
|
||||
#define MAXMINECARTS 16
|
||||
#define MAXJAILDOORS 32
|
||||
#define MAXLIGHTNINSECTORS 64
|
||||
#define MAXTORCHSECTORS 64
|
||||
#define MAXGEOSECTORS 64
|
||||
|
||||
#ifdef global_c_
|
||||
#define G_EXTERN
|
||||
#else
|
||||
#define G_EXTERN extern
|
||||
#endif
|
||||
|
||||
#define MAXINTERPOLATIONS MAXSPRITES
|
||||
// KEEPINSYNC lunatic/con_lang.lua
|
||||
#define MAXSKILLS 7
|
||||
|
||||
// duke3d global soup :(
|
||||
|
||||
// XXX: we don't #include everything we need.
|
||||
#include "compat.h"
|
||||
#include "build.h"
|
||||
|
||||
G_EXTERN int32_t g_interpolationCnt;
|
||||
G_EXTERN int32_t g_interpolationLock;
|
||||
G_EXTERN int32_t oldipos[MAXINTERPOLATIONS];
|
||||
G_EXTERN int32_t *curipos[MAXINTERPOLATIONS];
|
||||
G_EXTERN int32_t bakipos[MAXINTERPOLATIONS];
|
||||
|
||||
#include "mmulti.h"
|
||||
|
||||
#include "duke3d.h"
|
||||
#include "sector.h"
|
||||
#include "quotes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
G_EXTERN int32_t duke3d_globalflags;
|
||||
|
||||
// KEEPINSYNC astub.c (used values only)
|
||||
enum DUKE3D_GLOBALFLAGS {
|
||||
DUKE3D_NO_WIDESCREEN_PINNING = 1<<0,
|
||||
DUKE3D_NO_HARDCODED_FOGPALS = 1<<1,
|
||||
DUKE3D_NO_PALETTE_CHANGES = 1<<2,
|
||||
};
|
||||
|
||||
G_EXTERN DukeStatus_t sbar;
|
||||
G_EXTERN actor_t actor[MAXSPRITES];
|
||||
// g_tile: tile-specific data THAT DOES NOT CHANGE during the course of a game
|
||||
G_EXTERN tiledata_t g_tile[MAXTILES];
|
||||
G_EXTERN animwalltype animwall[MAXANIMWALLS];
|
||||
G_EXTERN char *apStrings[MAXQUOTES],*apXStrings[MAXQUOTES];
|
||||
G_EXTERN char *label;
|
||||
G_EXTERN int32_t g_musicIndex;
|
||||
G_EXTERN char g_loadFromGroupOnly;
|
||||
G_EXTERN char g_skillCnt;
|
||||
G_EXTERN char pus,pub;
|
||||
G_EXTERN char ready2send;
|
||||
#define MAXPLAYERNAME 32
|
||||
G_EXTERN char szPlayerName[MAXPLAYERNAME];
|
||||
G_EXTERN char tempbuf[MAXSECTORS<<1],packbuf[PACKBUF_SIZE],buf[1024];
|
||||
#define TYPEBUFSIZE 141
|
||||
G_EXTERN char typebuf[TYPEBUFSIZE];
|
||||
|
||||
|
||||
G_EXTERN input_t localInput;
|
||||
G_EXTERN input_t recsync[RECSYNCBUFSIZ];
|
||||
|
||||
G_EXTERN int32_t g_animWallCnt;
|
||||
G_EXTERN int32_t g_animateCnt;
|
||||
G_EXTERN int32_t g_cloudCnt;
|
||||
G_EXTERN int32_t g_curViewscreen;
|
||||
G_EXTERN int32_t g_frameRate;
|
||||
G_EXTERN int32_t g_cyclerCnt;
|
||||
G_EXTERN int32_t g_damageCameras;
|
||||
G_EXTERN int32_t g_defaultLabelCnt;
|
||||
G_EXTERN int32_t g_doQuickSave;
|
||||
G_EXTERN int32_t g_earthquakeTime;
|
||||
G_EXTERN int32_t g_freezerSelfDamage;
|
||||
G_EXTERN int32_t g_gameQuit;
|
||||
G_EXTERN int32_t g_globalRandom;
|
||||
G_EXTERN int32_t g_impactDamage;
|
||||
G_EXTERN int32_t g_labelCnt;
|
||||
G_EXTERN int32_t g_maxPlayerHealth;
|
||||
G_EXTERN int32_t g_mirrorCount;
|
||||
G_EXTERN int32_t g_mostConcurrentPlayers;
|
||||
G_EXTERN int32_t g_musicSize;
|
||||
G_EXTERN int32_t g_playerSpawnCnt;
|
||||
G_EXTERN int32_t g_scriptDebug;
|
||||
G_EXTERN int32_t g_showShareware;
|
||||
G_EXTERN int32_t g_spriteDeleteQueuePos;
|
||||
G_EXTERN int32_t g_startArmorAmount;
|
||||
G_EXTERN int32_t g_tripbombLaserMode;
|
||||
G_EXTERN int32_t screenpeek;
|
||||
|
||||
G_EXTERN int16_t g_animateSect[MAXANIMATES];
|
||||
G_EXTERN int32_t *g_animatePtr[MAXANIMATES];
|
||||
G_EXTERN int32_t g_animateGoal[MAXANIMATES];
|
||||
G_EXTERN int32_t g_animateVel[MAXANIMATES];
|
||||
|
||||
G_EXTERN int16_t g_cloudSect[256];
|
||||
G_EXTERN int16_t g_cloudX;
|
||||
G_EXTERN int16_t g_cloudY;
|
||||
G_EXTERN int32_t g_cloudClock;
|
||||
|
||||
G_EXTERN int16_t SpriteDeletionQueue[1024];
|
||||
G_EXTERN int16_t g_cyclers[MAXCYCLERS][6];
|
||||
G_EXTERN int16_t g_mirrorSector[64];
|
||||
G_EXTERN int16_t g_mirrorWall[64];
|
||||
G_EXTERN int32_t *labelcode;
|
||||
G_EXTERN int32_t *labeltype;
|
||||
G_EXTERN int32_t lockclock;
|
||||
G_EXTERN int32_t ototalclock;
|
||||
|
||||
G_EXTERN int32_t g_wupass;
|
||||
G_EXTERN int32_t g_chickenPlant;
|
||||
G_EXTERN int32_t g_thunderOn;
|
||||
G_EXTERN int32_t g_ufoSpawn;
|
||||
G_EXTERN int32_t g_ufoCnt;
|
||||
G_EXTERN int32_t g_hulkSpawn;
|
||||
G_EXTERN int32_t g_vixenLevel;
|
||||
G_EXTERN int32_t g_lastLevel;
|
||||
G_EXTERN int32_t g_turdLevel;
|
||||
|
||||
G_EXTERN int32_t g_mineCartDir[MAXMINECARTS];
|
||||
G_EXTERN int32_t g_mineCartSpeed[MAXMINECARTS];
|
||||
G_EXTERN int32_t g_mineCartChildSect[MAXMINECARTS];
|
||||
G_EXTERN int32_t g_mineCartSound[MAXMINECARTS];
|
||||
G_EXTERN int32_t g_mineCartDist[MAXMINECARTS];
|
||||
G_EXTERN int32_t g_mineCartDrag[MAXMINECARTS];
|
||||
G_EXTERN int32_t g_mineCartOpen[MAXMINECARTS];
|
||||
G_EXTERN int32_t g_mineCartSect[MAXMINECARTS];
|
||||
G_EXTERN uint32_t g_mineCartCnt;
|
||||
|
||||
G_EXTERN int32_t g_jailDoorSound[MAXJAILDOORS];
|
||||
G_EXTERN int32_t g_jailDoorDrag[MAXJAILDOORS];
|
||||
G_EXTERN int32_t g_jailDoorSpeed[MAXJAILDOORS];
|
||||
G_EXTERN int32_t g_jailDoorSecHitag[MAXJAILDOORS];
|
||||
G_EXTERN int32_t g_jailDoorDist[MAXJAILDOORS];
|
||||
G_EXTERN int32_t g_jailDoorDir[MAXJAILDOORS];
|
||||
G_EXTERN int32_t g_jailDoorOpen[MAXJAILDOORS];
|
||||
G_EXTERN int32_t g_jailDoorSect[MAXJAILDOORS];
|
||||
G_EXTERN uint32_t g_jailDoorCnt;
|
||||
|
||||
G_EXTERN int32_t g_lightninSector[MAXLIGHTNINSECTORS];
|
||||
G_EXTERN int32_t g_lightninSectorShade[MAXLIGHTNINSECTORS];
|
||||
G_EXTERN uint32_t g_lightninCnt;
|
||||
|
||||
G_EXTERN int32_t g_torchSector[MAXTORCHSECTORS];
|
||||
G_EXTERN int32_t g_torchSectorShade[MAXTORCHSECTORS];
|
||||
G_EXTERN int32_t g_torchType[MAXTORCHSECTORS];
|
||||
G_EXTERN uint32_t g_torchCnt;
|
||||
|
||||
G_EXTERN int32_t g_geoSectorWarp[MAXGEOSECTORS];
|
||||
G_EXTERN int32_t g_geoSectorWarp2[MAXGEOSECTORS];
|
||||
G_EXTERN int32_t g_geoSector[MAXGEOSECTORS];
|
||||
G_EXTERN int32_t g_geoSectorX[MAXGEOSECTORS];
|
||||
G_EXTERN int32_t g_geoSectorY[MAXGEOSECTORS];
|
||||
G_EXTERN int32_t g_geoSectorX2[MAXGEOSECTORS];
|
||||
G_EXTERN int32_t g_geoSectorY2[MAXGEOSECTORS];
|
||||
G_EXTERN uint32_t g_geoSectorCnt;
|
||||
|
||||
G_EXTERN int32_t g_thunderFlash;
|
||||
G_EXTERN int32_t g_thunderTime;
|
||||
G_EXTERN int32_t g_winderFlash;
|
||||
G_EXTERN int32_t g_winderTime;
|
||||
G_EXTERN int32_t g_brightness;
|
||||
|
||||
G_EXTERN int16_t g_ambientLotag[64];
|
||||
G_EXTERN int16_t g_ambientHitag[64];
|
||||
G_EXTERN uint32_t g_ambientCnt;
|
||||
|
||||
G_EXTERN intptr_t *apScript;
|
||||
G_EXTERN intptr_t *g_scriptPtr;
|
||||
|
||||
G_EXTERN map_t g_mapInfo[(MAXVOLUMES + 1) * MAXLEVELS]; // +1 volume for "intro", "briefing" and "loading" music
|
||||
G_EXTERN vec2_t g_origins[MAXANIMPOINTS];
|
||||
|
||||
G_EXTERN int32_t g_windTime, g_windDir;
|
||||
G_EXTERN int16_t g_fakeBubbaCnt, g_mamaSpawnCnt, g_banjoSong, g_bellTime, g_bellSprite;
|
||||
G_EXTERN uint8_t g_spriteExtra[MAXSPRITES], g_sectorExtra[MAXSECTORS];
|
||||
G_EXTERN uint8_t g_changeEnemySize, g_slotWin, g_ufoSpawnMinion, g_pistonSound, g_chickenWeaponTimer, g_RAendLevel, g_RAendEpisode, g_fogType;
|
||||
G_EXTERN int32_t g_cdTrack;
|
||||
|
||||
// XXX: I think this pragma pack is meaningless here.
|
||||
// MSDN (https://msdn.microsoft.com/en-us/library/2e70t5y1%28VS.80%29.aspx) says:
|
||||
// "pack takes effect at the first struct, union, or class declaration after
|
||||
// the pragma is seen; pack has no effect on definitions."
|
||||
#pragma pack(push,1)
|
||||
#ifdef global_c_
|
||||
static playerdata_t g_player_s[1 + MAXPLAYERS];
|
||||
playerdata_t *const g_player = &g_player_s[1];
|
||||
#else
|
||||
extern playerdata_t *const g_player;
|
||||
#endif
|
||||
G_EXTERN playerspawn_t g_playerSpawnPoints[MAXPLAYERS];
|
||||
G_EXTERN input_t inputfifo[MOVEFIFOSIZ][MAXPLAYERS];
|
||||
#pragma pack(pop)
|
||||
|
||||
G_EXTERN char g_soundlocks[MAXSOUNDS];
|
||||
G_EXTERN int32_t g_noEnemies;
|
||||
G_EXTERN int32_t g_restorePalette;
|
||||
G_EXTERN int32_t g_screenCapture;
|
||||
G_EXTERN sound_t g_sounds[MAXSOUNDS];
|
||||
G_EXTERN uint32_t everyothertime;
|
||||
G_EXTERN uint32_t g_moveThingsCount;
|
||||
G_EXTERN uint32_t g_gameUpdateTime;
|
||||
G_EXTERN uint32_t g_gameUpdateAndDrawTime;
|
||||
#define GAMEUPDATEAVGTIMENUMSAMPLES 100
|
||||
extern float g_gameUpdateAvgTime;
|
||||
|
||||
#ifndef global_c_
|
||||
extern char CheatKeys[2];
|
||||
extern char g_gametypeNames[MAXGAMETYPES][33];
|
||||
extern char g_setupFileName[BMAX_PATH];
|
||||
extern char g_skillNames[MAXSKILLS][33];
|
||||
extern char g_volumeNames[MAXVOLUMES][33];
|
||||
|
||||
extern int32_t g_actorRespawnTime;
|
||||
extern int32_t g_bouncemineRadius;
|
||||
extern int32_t g_deleteQueueSize;
|
||||
extern int32_t g_gametypeCnt;
|
||||
extern int32_t g_itemRespawnTime;
|
||||
extern int32_t g_morterRadius;
|
||||
extern int32_t g_numFreezeBounces;
|
||||
extern int32_t g_pipebombRadius;
|
||||
extern int32_t g_playerFriction;
|
||||
extern int32_t g_rpgRadius;
|
||||
extern int32_t g_scriptSize;
|
||||
extern int32_t g_seenineRadius;
|
||||
extern int32_t g_shrinkerRadius;
|
||||
extern int32_t g_spriteGravity;
|
||||
extern int32_t g_timerTicsPerSecond;
|
||||
extern int32_t g_tripbombRadius;
|
||||
extern int32_t g_volumeCnt;
|
||||
|
||||
extern int16_t g_blimpSpawnItems[15];
|
||||
extern int32_t g_gametypeFlags[MAXGAMETYPES];
|
||||
extern int32_t g_volumeFlags[MAXVOLUMES];
|
||||
|
||||
extern const char *s_buildDate;
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
EF_HIDEFROMSP = 1<<0,
|
||||
// EF_HIDEFROMMP = 1<<1,
|
||||
};
|
||||
|
||||
EXTERN_INLINE_HEADER void G_UpdateInterpolations(void);
|
||||
EXTERN_INLINE_HEADER void G_RestoreInterpolations(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined global_c_ || !defined DISABLE_INLINING
|
||||
|
||||
EXTERN_INLINE void G_UpdateInterpolations(void) //Stick at beginning of G_DoMoveThings
|
||||
{
|
||||
for (bssize_t i=g_interpolationCnt-1; i>=0; i--) oldipos[i] = *curipos[i];
|
||||
}
|
||||
|
||||
EXTERN_INLINE void G_RestoreInterpolations(void) //Stick at end of drawscreen
|
||||
{
|
||||
int32_t i=g_interpolationCnt-1;
|
||||
|
||||
if (--g_interpolationLock)
|
||||
return;
|
||||
|
||||
for (; i>=0; i--) *curipos[i] = bakipos[i];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
537
source/rr/src/grpscan.cpp
Normal file
|
@ -0,0 +1,537 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#include "compat.h"
|
||||
#include "baselayer.h"
|
||||
|
||||
#include "scriptfile.h"
|
||||
#include "cache1d.h"
|
||||
#include "crc32.h"
|
||||
|
||||
#include "duke3d.h"
|
||||
#include "common_game.h"
|
||||
#include "grpscan.h"
|
||||
|
||||
//static void process_vaca13(int32_t crcval);
|
||||
static void process_vacapp15(int32_t crcval);
|
||||
|
||||
// custom GRP support for the startup window, file format reflects the structure below
|
||||
#define GAMELISTFILE "games.list"
|
||||
// name crc size flags dependency scriptname postprocessing
|
||||
static internalgrpinfo_t const internalgrpfiles[] =
|
||||
{
|
||||
//{ "Duke Nukem 3D", DUKE13_CRC, 26524524, GAMEFLAG_DUKE, 0, NULL, NULL},
|
||||
//{ "Duke Nukem 3D (South Korean Censored)", DUKEKR_CRC, 26385383, GAMEFLAG_DUKE, 0, NULL, NULL},
|
||||
{ "Duke Nukem 3D: Atomic Edition", DUKE15_CRC, 44356548, GAMEFLAG_DUKE, 0, NULL, NULL},
|
||||
{ "Duke Nukem 3D: Atomic Edition (WT)", DUKEWT_CRC, 44356548, GAMEFLAG_DUKE, 0, NULL, NULL},
|
||||
{ "Duke Nukem 3D: Plutonium Pak", DUKEPP_CRC, 44348015, GAMEFLAG_DUKE, 0, NULL, NULL},
|
||||
//{ "Duke Nukem 3D Shareware 0.99", DUKE099_CRC, 9690241, GAMEFLAG_DUKE|GAMEFLAG_DUKEBETA, 0, NULL, NULL},
|
||||
//{ "Duke Nukem 3D Shareware 1.0", DUKE10_CRC, 10429258, GAMEFLAG_DUKE|GAMEFLAG_SHAREWARE, 0, NULL, NULL},
|
||||
//{ "Duke Nukem 3D Shareware 1.1", DUKE11_CRC, 10442980, GAMEFLAG_DUKE|GAMEFLAG_SHAREWARE, 0, NULL, NULL},
|
||||
//{ "Duke Nukem 3D Shareware 1.3D", DUKESW_CRC, 11035779, GAMEFLAG_DUKE|GAMEFLAG_SHAREWARE, 0, NULL, NULL},
|
||||
//{ "Duke Nukem 3D Mac Demo", DUKEMD_CRC, 10444391, GAMEFLAG_DUKE|GAMEFLAG_SHAREWARE, 0, NULL, NULL},
|
||||
//{ "Duke Nukem 3D MacUser Demo", DUKEMD2_CRC, 10628573, GAMEFLAG_DUKE|GAMEFLAG_SHAREWARE, 0, NULL, NULL },
|
||||
//{ "Duke it out in D.C. (1.3D)", DUKEDC13_CRC, 7926624, GAMEFLAG_DUKE|GAMEFLAG_ADDON, DUKE13_CRC, NULL, NULL},
|
||||
{ "Duke it out in D.C.", DUKEDCPP_CRC, 8225517, GAMEFLAG_DUKE|GAMEFLAG_ADDON, DUKE15_CRC, NULL, NULL},
|
||||
{ "Duke it out in D.C.", DUKEDC_CRC, 8410183, GAMEFLAG_DUKE|GAMEFLAG_ADDON, DUKE15_CRC, NULL, NULL},
|
||||
{ "Duke it out in D.C.", (int32_t) 0x39A692BF, 8410187, GAMEFLAG_DUKE|GAMEFLAG_ADDON, DUKE15_CRC, "DUKEDC.CON", NULL},
|
||||
//{ "Duke Caribbean: Life's a Beach (1.3D)", VACA13_CRC, 23559381, GAMEFLAG_DUKE|GAMEFLAG_ADDON, DUKE13_CRC, NULL, process_vaca13},
|
||||
{ "Duke Caribbean: Life's a Beach (PPak)", VACAPP_CRC, 22551333, GAMEFLAG_DUKE|GAMEFLAG_ADDON, DUKEPP_CRC, NULL, process_vacapp15},
|
||||
{ "Duke Caribbean: Life's a Beach", VACA15_CRC, 22521880, GAMEFLAG_DUKE|GAMEFLAG_ADDON, DUKE15_CRC, NULL, process_vacapp15},
|
||||
{ "Duke Caribbean: Life's a Beach", DUKECB_CRC, 22213819, GAMEFLAG_DUKE|GAMEFLAG_ADDON, DUKE15_CRC, NULL, NULL},
|
||||
{ "Duke Caribbean: Life's a Beach", (int32_t) 0x65B5F690, 22397273, GAMEFLAG_DUKE|GAMEFLAG_ADDON, DUKE15_CRC, "VACATION.CON", NULL},
|
||||
{ "Duke: Nuclear Winter", DUKENW_CRC, 16169365, GAMEFLAG_DUKE|GAMEFLAG_ADDON, DUKE15_CRC, "NWINTER.CON", NULL},
|
||||
{ "Duke: Nuclear Winter Demo", (int32_t) 0xC7EFBFA9, 10965909, GAMEFLAG_DUKE|GAMEFLAG_ADDON, DUKE15_CRC, "NWINTER.CON", NULL},
|
||||
// { "Duke!ZONE II (1.3D)", DZ2_13_CRC, 26135388, GAMEFLAG_DUKE|GAMEFLAG_ADDON, DUKE13_CRC, "DZ-GAME.CON", NULL},
|
||||
{ "Duke!ZONE II", DZ2_PP_CRC, 44100411, GAMEFLAG_DUKE|GAMEFLAG_ADDON, DUKE15_CRC, "DZ-GAME.CON", NULL},
|
||||
{ "Duke!ZONE II", (int32_t) 0x1E9516F1, 3186656, GAMEFLAG_DUKE|GAMEFLAG_ADDON, DUKE15_CRC, "DZ-GAME.CON", NULL},
|
||||
//{ "NAM", NAM_CRC, 43448927, GAMEFLAG_NAM, 0, NULL, NULL},
|
||||
//{ "NAPALM", NAPALM_CRC, 44365728, GAMEFLAG_NAM|GAMEFLAG_NAPALM, 0, NULL, NULL},
|
||||
//{ "WWII GI", WW2GI_CRC, 77939508, GAMEFLAG_WW2GI, 0, NULL, NULL},
|
||||
//{ "Platoon Leader", PLATOONL_CRC, 37852572, GAMEFLAG_WW2GI|GAMEFLAG_ADDON, WW2GI_CRC, "PLATOONL.DEF", NULL},
|
||||
{ "Redneck Rampage", RR_CRC, 141174222, GAMEFLAG_RR, 0, NULL, NULL },
|
||||
{ "Redneck Rampage: Rides Again", RRRA_CRC, 191798609, GAMEFLAG_RR|GAMEFLAG_RRRA, 0, NULL, NULL },
|
||||
};
|
||||
|
||||
struct grpfile_t *foundgrps = NULL;
|
||||
struct grpinfo_t *listgrps = NULL;
|
||||
|
||||
static void LoadList(const char * filename)
|
||||
{
|
||||
scriptfile *script = scriptfile_fromfile(filename);
|
||||
|
||||
if (!script)
|
||||
return;
|
||||
|
||||
scriptfile_addsymbolvalue("GAMEFLAG_DUKE", GAMEFLAG_DUKE);
|
||||
scriptfile_addsymbolvalue("GAMEFLAG_ADDON", GAMEFLAG_DUKE|GAMEFLAG_ADDON);
|
||||
scriptfile_addsymbolvalue("GAMEFLAG_RR", GAMEFLAG_RR);
|
||||
scriptfile_addsymbolvalue("GAMEFLAG_RRRA", GAMEFLAG_RR|GAMEFLAG_RRRA);
|
||||
scriptfile_addsymbolvalue("DUKE15_CRC", DUKE15_CRC);
|
||||
scriptfile_addsymbolvalue("DUKEPP_CRC", DUKEPP_CRC);
|
||||
scriptfile_addsymbolvalue("DUKE13_CRC", DUKE13_CRC);
|
||||
scriptfile_addsymbolvalue("DUKEDC13_CRC", DUKEDC13_CRC);
|
||||
scriptfile_addsymbolvalue("DUKEDCPP_CRC", DUKEDCPP_CRC);
|
||||
scriptfile_addsymbolvalue("DUKEDC_CRC", DUKEDC_CRC);
|
||||
scriptfile_addsymbolvalue("VACA13_CRC", VACA13_CRC);
|
||||
scriptfile_addsymbolvalue("VACAPP_CRC", VACAPP_CRC);
|
||||
scriptfile_addsymbolvalue("VACA15_CRC", VACA15_CRC);
|
||||
scriptfile_addsymbolvalue("DUKECB_CRC", DUKECB_CRC);
|
||||
scriptfile_addsymbolvalue("DUKENW_CRC", DUKENW_CRC);
|
||||
scriptfile_addsymbolvalue("DZ2_13_CRC", DZ2_13_CRC);
|
||||
scriptfile_addsymbolvalue("DZ2_PP_CRC", DZ2_PP_CRC);
|
||||
scriptfile_addsymbolvalue("NAM_CRC", NAM_CRC);
|
||||
scriptfile_addsymbolvalue("NAPALM_CRC", NAPALM_CRC);
|
||||
scriptfile_addsymbolvalue("WW2GI_CRC", WW2GI_CRC);
|
||||
|
||||
while (!scriptfile_eof(script))
|
||||
{
|
||||
enum
|
||||
{
|
||||
T_GRPINFO,
|
||||
T_GAMENAME,
|
||||
T_CRC,
|
||||
T_SIZE,
|
||||
T_DEPCRC,
|
||||
T_SCRIPTNAME,
|
||||
T_DEFNAME,
|
||||
T_FLAGS,
|
||||
T_RTSNAME,
|
||||
};
|
||||
|
||||
static const tokenlist profiletokens[] =
|
||||
{
|
||||
{ "grpinfo", T_GRPINFO },
|
||||
};
|
||||
|
||||
int32_t token = getatoken(script,profiletokens,ARRAY_SIZE(profiletokens));
|
||||
switch (token)
|
||||
{
|
||||
case T_GRPINFO:
|
||||
{
|
||||
int32_t gsize = 0, gcrcval = 0, gflags = GAMEFLAG_DUKE, gdepcrc = DUKE15_CRC;
|
||||
char *gname = NULL, *gscript = NULL, *gdef = NULL;
|
||||
char *grts = NULL;
|
||||
char *grpend = NULL;
|
||||
|
||||
static const tokenlist grpinfotokens[] =
|
||||
{
|
||||
{ "name", T_GAMENAME },
|
||||
{ "scriptname", T_SCRIPTNAME },
|
||||
{ "defname", T_DEFNAME },
|
||||
{ "rtsname", T_RTSNAME },
|
||||
{ "crc", T_CRC },
|
||||
{ "dependency", T_DEPCRC },
|
||||
{ "size", T_SIZE },
|
||||
{ "flags", T_FLAGS },
|
||||
|
||||
};
|
||||
|
||||
if (scriptfile_getbraces(script,&grpend)) break;
|
||||
|
||||
while (script->textptr < grpend)
|
||||
{
|
||||
int32_t token = getatoken(script,grpinfotokens,ARRAY_SIZE(grpinfotokens));
|
||||
|
||||
switch (token)
|
||||
{
|
||||
case T_GAMENAME:
|
||||
scriptfile_getstring(script,&gname); break;
|
||||
case T_SCRIPTNAME:
|
||||
scriptfile_getstring(script,&gscript); break;
|
||||
case T_DEFNAME:
|
||||
scriptfile_getstring(script,&gdef); break;
|
||||
case T_RTSNAME:
|
||||
scriptfile_getstring(script,&grts); break;
|
||||
|
||||
case T_FLAGS:
|
||||
scriptfile_getsymbol(script,&gflags); gflags &= GAMEFLAGMASK; break;
|
||||
case T_DEPCRC:
|
||||
scriptfile_getsymbol(script,&gdepcrc); break;
|
||||
case T_CRC:
|
||||
scriptfile_getsymbol(script,&gcrcval); break;
|
||||
case T_SIZE:
|
||||
scriptfile_getnumber(script,&gsize); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
grpinfo_t * const fg = (grpinfo_t *)Xcalloc(1, sizeof(grpinfo_t));
|
||||
fg->next = listgrps;
|
||||
listgrps = fg;
|
||||
|
||||
if (gname)
|
||||
fg->name = Xstrdup(gname);
|
||||
|
||||
fg->size = gsize;
|
||||
fg->crcval = gcrcval;
|
||||
fg->dependency = gdepcrc;
|
||||
fg->game = gflags;
|
||||
|
||||
if (gscript)
|
||||
fg->scriptname = dup_filename(gscript);
|
||||
|
||||
if (gdef)
|
||||
fg->defname = dup_filename(gdef);
|
||||
|
||||
if (grts)
|
||||
fg->rtsname = dup_filename(grts);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
scriptfile_close(script);
|
||||
scriptfile_clearsymbols();
|
||||
}
|
||||
|
||||
static void LoadGameList(void)
|
||||
{
|
||||
for (size_t i = 0; i < ARRAY_SIZE(internalgrpfiles); i++)
|
||||
{
|
||||
grpinfo_t * const fg = (grpinfo_t *)Xcalloc(1, sizeof(grpinfo_t));
|
||||
|
||||
fg->name = Xstrdup(internalgrpfiles[i].name);
|
||||
fg->crcval = internalgrpfiles[i].crcval;
|
||||
fg->size = internalgrpfiles[i].size;
|
||||
fg->game = internalgrpfiles[i].game;
|
||||
fg->dependency = internalgrpfiles[i].dependency;
|
||||
|
||||
if (internalgrpfiles[i].scriptname)
|
||||
fg->scriptname = dup_filename(internalgrpfiles[i].scriptname);
|
||||
|
||||
fg->postprocessing = internalgrpfiles[i].postprocessing;
|
||||
|
||||
fg->next = listgrps;
|
||||
listgrps = fg;
|
||||
}
|
||||
|
||||
CACHE1D_FIND_REC * const srch = klistpath("/", "*.grpinfo", CACHE1D_FIND_FILE);
|
||||
|
||||
for (CACHE1D_FIND_REC *sidx = srch; sidx; sidx = sidx->next)
|
||||
LoadList(sidx->name);
|
||||
|
||||
klistfree(srch);
|
||||
}
|
||||
|
||||
static void FreeGameList(void)
|
||||
{
|
||||
while (listgrps)
|
||||
{
|
||||
Bfree(listgrps->name);
|
||||
Bfree(listgrps->scriptname);
|
||||
Bfree(listgrps->defname);
|
||||
Bfree(listgrps->rtsname);
|
||||
|
||||
grpinfo_t * const fg = listgrps->next;
|
||||
Bfree(listgrps);
|
||||
listgrps = fg;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define GRPCACHEFILE "grpfiles.cache"
|
||||
static struct grpcache
|
||||
{
|
||||
struct grpcache *next;
|
||||
int32_t size;
|
||||
int32_t mtime;
|
||||
int32_t crcval;
|
||||
char name[BMAX_PATH];
|
||||
}
|
||||
*grpcache = NULL, *usedgrpcache = NULL;
|
||||
|
||||
static int32_t LoadGroupsCache(void)
|
||||
{
|
||||
struct grpcache *fg;
|
||||
|
||||
int32_t fsize, fmtime, fcrcval;
|
||||
char *fname;
|
||||
|
||||
scriptfile *script;
|
||||
|
||||
script = scriptfile_fromfile(GRPCACHEFILE);
|
||||
if (!script) return -1;
|
||||
|
||||
while (!scriptfile_eof(script))
|
||||
{
|
||||
if (scriptfile_getstring(script, &fname)) break; // filename
|
||||
if (scriptfile_getnumber(script, &fsize)) break; // filesize
|
||||
if (scriptfile_getnumber(script, &fmtime)) break; // modification time
|
||||
if (scriptfile_getnumber(script, &fcrcval)) break; // crc checksum
|
||||
|
||||
fg = (struct grpcache *)Xcalloc(1, sizeof(struct grpcache));
|
||||
fg->next = grpcache;
|
||||
grpcache = fg;
|
||||
|
||||
Bstrncpy(fg->name, fname, BMAX_PATH);
|
||||
fg->size = fsize;
|
||||
fg->mtime = fmtime;
|
||||
fg->crcval = fcrcval;
|
||||
}
|
||||
|
||||
scriptfile_close(script);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void FreeGroupsCache(void)
|
||||
{
|
||||
while (grpcache)
|
||||
{
|
||||
struct grpcache * const fg = grpcache->next;
|
||||
Bfree(grpcache);
|
||||
grpcache = fg;
|
||||
}
|
||||
}
|
||||
|
||||
static void RemoveGroup(grpfile_t *igrp)
|
||||
{
|
||||
for (grpfile_t *prev = NULL, *grp = foundgrps; grp; grp=grp->next)
|
||||
{
|
||||
if (grp == igrp)
|
||||
{
|
||||
if (grp == foundgrps)
|
||||
foundgrps = grp->next;
|
||||
else
|
||||
prev->next = grp->next;
|
||||
|
||||
Bfree((char *)grp->filename);
|
||||
Bfree(grp);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
prev = grp;
|
||||
}
|
||||
}
|
||||
|
||||
grpfile_t * FindGroup(int32_t crcval)
|
||||
{
|
||||
grpfile_t *grp;
|
||||
|
||||
for (grp = foundgrps; grp; grp=grp->next)
|
||||
{
|
||||
if (grp->type->crcval == crcval)
|
||||
return grp;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static grpinfo_t const * FindGrpInfo(int32_t crcval, int32_t size)
|
||||
{
|
||||
grpinfo_t *grpinfo;
|
||||
|
||||
for (grpinfo = listgrps; grpinfo; grpinfo=grpinfo->next)
|
||||
{
|
||||
if (grpinfo->crcval == crcval && grpinfo->size == size)
|
||||
return grpinfo;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void ProcessGroups(CACHE1D_FIND_REC *srch)
|
||||
{
|
||||
CACHE1D_FIND_REC *sidx;
|
||||
struct grpcache *fg, *fgg;
|
||||
char *fn;
|
||||
struct Bstat st;
|
||||
|
||||
#define BUFFER_SIZE (1024 * 1024 * 8)
|
||||
uint8_t *buf = (uint8_t *)Xmalloc(BUFFER_SIZE);
|
||||
|
||||
for (sidx = srch; sidx; sidx = sidx->next)
|
||||
{
|
||||
for (fg = grpcache; fg; fg = fg->next)
|
||||
{
|
||||
if (!Bstrcmp(fg->name, sidx->name)) break;
|
||||
}
|
||||
|
||||
if (fg)
|
||||
{
|
||||
if (findfrompath(sidx->name, &fn)) continue; // failed to resolve the filename
|
||||
if (Bstat(fn, &st))
|
||||
{
|
||||
Bfree(fn);
|
||||
continue;
|
||||
} // failed to stat the file
|
||||
Bfree(fn);
|
||||
if (fg->size == (int32_t)st.st_size && fg->mtime == (int32_t)st.st_mtime)
|
||||
{
|
||||
grpinfo_t const * const grptype = FindGrpInfo(fg->crcval, fg->size);
|
||||
if (grptype)
|
||||
{
|
||||
grpfile_t * const grp = (grpfile_t *)Xcalloc(1, sizeof(grpfile_t));
|
||||
grp->filename = Xstrdup(sidx->name);
|
||||
grp->type = grptype;
|
||||
grp->next = foundgrps;
|
||||
foundgrps = grp;
|
||||
}
|
||||
|
||||
fgg = (struct grpcache *)Xcalloc(1, sizeof(struct grpcache));
|
||||
strcpy(fgg->name, fg->name);
|
||||
fgg->size = fg->size;
|
||||
fgg->mtime = fg->mtime;
|
||||
fgg->crcval = fg->crcval;
|
||||
fgg->next = usedgrpcache;
|
||||
usedgrpcache = fgg;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
int32_t b, fh;
|
||||
int32_t crcval = 0;
|
||||
|
||||
fh = openfrompath(sidx->name, BO_RDONLY|BO_BINARY, BS_IREAD);
|
||||
if (fh < 0) continue;
|
||||
if (Bfstat(fh, &st)) continue;
|
||||
|
||||
initprintf(" Checksumming %s...", sidx->name);
|
||||
do
|
||||
{
|
||||
b = read(fh, buf, BUFFER_SIZE);
|
||||
if (b > 0) crcval = Bcrc32((uint8_t *)buf, b, crcval);
|
||||
}
|
||||
while (b == BUFFER_SIZE);
|
||||
close(fh);
|
||||
initprintf(" Done\n");
|
||||
|
||||
grpinfo_t const * const grptype = FindGrpInfo(crcval, st.st_size);
|
||||
if (grptype)
|
||||
{
|
||||
grpfile_t * const grp = (grpfile_t *)Xcalloc(1, sizeof(grpfile_t));
|
||||
grp->filename = Xstrdup(sidx->name);
|
||||
grp->type = grptype;
|
||||
grp->next = foundgrps;
|
||||
foundgrps = grp;
|
||||
}
|
||||
|
||||
fgg = (struct grpcache *)Xcalloc(1, sizeof(struct grpcache));
|
||||
Bstrncpy(fgg->name, sidx->name, BMAX_PATH);
|
||||
fgg->size = st.st_size;
|
||||
fgg->mtime = st.st_mtime;
|
||||
fgg->crcval = crcval;
|
||||
fgg->next = usedgrpcache;
|
||||
usedgrpcache = fgg;
|
||||
}
|
||||
}
|
||||
|
||||
Bfree(buf);
|
||||
}
|
||||
|
||||
int32_t ScanGroups(void)
|
||||
{
|
||||
struct grpcache *fg, *fgg;
|
||||
|
||||
initprintf("Searching for game data...\n");
|
||||
|
||||
LoadGameList();
|
||||
LoadGroupsCache();
|
||||
|
||||
static char const *extensions[] =
|
||||
{
|
||||
"*.grp",
|
||||
"*.ssi",
|
||||
"*.dat",
|
||||
};
|
||||
|
||||
for (char const *extension : extensions)
|
||||
{
|
||||
CACHE1D_FIND_REC *srch = klistpath("/", extension, CACHE1D_FIND_FILE);
|
||||
ProcessGroups(srch);
|
||||
klistfree(srch);
|
||||
}
|
||||
|
||||
FreeGroupsCache();
|
||||
|
||||
for (grpfile_t *grp = foundgrps; grp; grp=grp->next)
|
||||
{
|
||||
if (grp->type->dependency)
|
||||
{
|
||||
if (FindGroup(grp->type->dependency) == NULL) // couldn't find dependency
|
||||
{
|
||||
//initprintf("removing %s\n", grp->name);
|
||||
RemoveGroup(grp);
|
||||
grp = foundgrps;
|
||||
// start from the beginning so we can remove anything that depended on this grp
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (usedgrpcache)
|
||||
{
|
||||
int32_t i = 0;
|
||||
FILE *fp;
|
||||
fp = fopen(GRPCACHEFILE, "wt");
|
||||
if (fp)
|
||||
{
|
||||
for (fg = usedgrpcache; fg; fg=fgg)
|
||||
{
|
||||
fgg = fg->next;
|
||||
fprintf(fp, "\"%s\" %d %d %d\n", fg->name, fg->size, fg->mtime, fg->crcval);
|
||||
Bfree(fg);
|
||||
i++;
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
// initprintf("Found %d recognized GRP %s.\n",i,i>1?"files":"file");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
initprintf("Found no recognized game data!\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void FreeGroups(void)
|
||||
{
|
||||
while (foundgrps)
|
||||
{
|
||||
Bfree((char *)foundgrps->filename);
|
||||
grpfile_t * const fg = foundgrps->next;
|
||||
Bfree(foundgrps);
|
||||
foundgrps = fg;
|
||||
}
|
||||
|
||||
FreeGameList();
|
||||
}
|
||||
|
||||
static void process_vacapp15(int32_t crcval)
|
||||
{
|
||||
krename(crcval, 5, "DEFS.CON");
|
||||
krename(crcval, 6, "GAME.CON");
|
||||
krename(crcval, 7, "USER.CON");
|
||||
krename(crcval, 8, "DEMO1.DMO");
|
||||
krename(crcval, 9, "DEMO2.DMO");
|
||||
krename(crcval, 10, "DEMO3.DMO");
|
||||
|
||||
initgroupfile("VACATION.PRG");
|
||||
}
|
110
source/rr/src/grpscan.h
Normal file
|
@ -0,0 +1,110 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#ifndef grpscan_h_
|
||||
#define grpscan_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MAXLISTNAMELEN 32
|
||||
|
||||
// List of internally-known GRP files
|
||||
#define DUKE13_CRC (int32_t)0xBBC9CE44
|
||||
#define DUKEKR_CRC (int32_t)0xAA4F6A40
|
||||
#define DUKE15_CRC (int32_t)0xFD3DCFF1
|
||||
#define DUKEPP_CRC (int32_t)0xF514A6AC
|
||||
#define DUKEWT_CRC (int32_t)0x982AFE4A
|
||||
#define DUKE099_CRC (int32_t)0x02F18900
|
||||
#define DUKE10_CRC (int32_t)0xA28AA589
|
||||
#define DUKE11_CRC (int32_t)0x912E1E8D
|
||||
#define DUKESW_CRC (int32_t)0x983AD923
|
||||
#define DUKEMD_CRC (int32_t)0xC5F71561
|
||||
#define DUKEMD2_CRC (int32_t)0x73A15EE7
|
||||
#define DUKEDC13_CRC (int32_t)0xA9242158
|
||||
#define DUKEDCPP_CRC (int32_t)0xB79D997F
|
||||
#define DUKEDC_CRC (int32_t)0xA8CF80DA
|
||||
#define VACA13_CRC (int32_t)0x4A2DBB62
|
||||
#define VACAPP_CRC (int32_t)0x2F4FCCEE
|
||||
#define VACA15_CRC (int32_t)0xB62B42FD
|
||||
#define DUKECB_CRC (int32_t)0x18F01C5B
|
||||
#define DUKENW_CRC (int32_t)0xF1CAE8E4
|
||||
#define DZ2_13_CRC (int32_t)0x82C1B47F
|
||||
#define DZ2_PP_CRC (int32_t)0x7FB6117C
|
||||
#define NAM_CRC (int32_t)0x75C1F07B
|
||||
#define NAPALM_CRC (int32_t)0x3DE1589A
|
||||
#define WW2GI_CRC (int32_t)0x907B82BF
|
||||
#define PLATOONL_CRC (int32_t)0xD1ED8C0C
|
||||
#define RR_CRC (int32_t)0x19D9BC79
|
||||
#define RRRA_CRC (int32_t)0x958018C6
|
||||
|
||||
enum addon_t {
|
||||
ADDON_NONE,
|
||||
ADDON_DUKEDC,
|
||||
ADDON_NWINTER,
|
||||
ADDON_CARIBBEAN,
|
||||
NUMADDONS
|
||||
};
|
||||
|
||||
typedef struct internalgrpinfo_t {
|
||||
char const *name;
|
||||
int32_t const crcval;
|
||||
int32_t const size;
|
||||
int32_t const game;
|
||||
int32_t const dependency;
|
||||
char const *scriptname;
|
||||
void(*postprocessing)(int32_t);
|
||||
} internalgrpinfo_t;
|
||||
|
||||
typedef struct grpinfo_t {
|
||||
char *name;
|
||||
int32_t crcval;
|
||||
int32_t size;
|
||||
int32_t game;
|
||||
int32_t dependency;
|
||||
char *scriptname;
|
||||
char *defname;
|
||||
char *rtsname;
|
||||
void (*postprocessing)(int32_t);
|
||||
struct grpinfo_t *next;
|
||||
} grpinfo_t;
|
||||
|
||||
typedef struct grpfile_t {
|
||||
char *filename;
|
||||
struct grpinfo_t const *type;
|
||||
struct grpfile_t *next;
|
||||
} grpfile_t;
|
||||
|
||||
extern grpfile_t *foundgrps;
|
||||
extern grpinfo_t *listgrps;
|
||||
|
||||
extern grpfile_t * FindGroup(int32_t crcval);
|
||||
|
||||
int32_t ScanGroups(void);
|
||||
void FreeGroups(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
354
source/rr/src/in_android.cpp
Normal file
|
@ -0,0 +1,354 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2015 EDuke32 developers and contributors
|
||||
Copyright (C) 2015 Voidpoint, LLC
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#include "compat.h"
|
||||
#include "sdl_inc.h"
|
||||
#include "baselayer.h"
|
||||
#include "keys.h"
|
||||
#include "duke3d.h"
|
||||
#include "common_game.h"
|
||||
#include "osd.h"
|
||||
#include "player.h"
|
||||
#include "game.h"
|
||||
#include "build.h"
|
||||
#include "anim.h"
|
||||
#include "player.h"
|
||||
|
||||
#include "keyboard.h"
|
||||
#include "control.h"
|
||||
#include "_control.h"
|
||||
|
||||
#include "menus.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern int SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode);
|
||||
extern int SDL_SendKeyboardText(const char *text);
|
||||
extern int SDL_SendMouseMotion(SDL_Window * window, Uint32 mouseID, int relative, int x, int y);
|
||||
extern int SDL_SendMouseButton(SDL_Window * window, Uint32 mouseID, Uint8 state, Uint8 button);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "in_android.h"
|
||||
#include <android/log.h>
|
||||
|
||||
#if defined __GNUC__
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
#endif
|
||||
|
||||
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO,"DUKE", __VA_ARGS__))
|
||||
|
||||
static char sdl_text[2];
|
||||
|
||||
droidinput_t droidinput;
|
||||
|
||||
void AndroidTimer(int tics) { G_InitTimer(tics); }
|
||||
|
||||
int AndroidKeyEvent(int state, int code,int unicode)
|
||||
{
|
||||
LOGI("AndroidKeyEvent %d %d %d",state,(SDL_Scancode)code,unicode);
|
||||
SDL_SendKeyboardKey(state ? SDL_PRESSED : SDL_RELEASED, (SDL_Scancode)code);
|
||||
SDL_EventState(SDL_TEXTINPUT, SDL_ENABLE);
|
||||
|
||||
// if (code == 42)
|
||||
// unicode = 42;
|
||||
|
||||
if (state)
|
||||
{
|
||||
//if (unicode < 128)
|
||||
{
|
||||
sdl_text[0] = unicode;
|
||||
sdl_text[1] = 0;
|
||||
|
||||
int posted = SDL_SendKeyboardText((const char*)sdl_text);
|
||||
LOGI("posted = %d",posted);
|
||||
}
|
||||
|
||||
if (state == 2)
|
||||
AndroidKeyEvent(0, code, unicode);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AndroidMouseMenu(float x,float y)
|
||||
{
|
||||
SDL_SendMouseMotion(NULL,0,0,x,y);
|
||||
}
|
||||
|
||||
void AndroidMouseMenuButton(int state,int button)
|
||||
{
|
||||
SDL_SendMouseButton(NULL, SDL_TOUCH_MOUSEID, state?SDL_PRESSED:SDL_RELEASED, SDL_BUTTON_LEFT);
|
||||
}
|
||||
|
||||
void changeActionState(int state, int action)
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
//BUTTONSET(action,1);
|
||||
droidinput.functionSticky |= ((uint64_t)1<<((uint64_t)(action)));
|
||||
droidinput.functionHeld |= ((uint64_t)1<<((uint64_t)(action)));
|
||||
return;
|
||||
}
|
||||
|
||||
//BUTTONCLEAR(action);
|
||||
droidinput.functionHeld &= ~((uint64_t) 1<<((uint64_t) (action)));
|
||||
}
|
||||
|
||||
void AndroidAction(int state, int action)
|
||||
{
|
||||
LOGI("AndroidAction action = %d, state = %d", action, state);
|
||||
|
||||
if (action >= MENU_UP && action <= MENU_BACK)
|
||||
{
|
||||
int const sdl_code [] = { SDL_SCANCODE_UP, SDL_SCANCODE_DOWN, SDL_SCANCODE_LEFT,
|
||||
SDL_SCANCODE_RIGHT, SDL_SCANCODE_RETURN, SDL_SCANCODE_ESCAPE };
|
||||
AndroidKeyEvent(state, sdl_code[action-MENU_UP], 0);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (AndroidRead(READ_SCREEN_MODE) != TOUCH_SCREEN_GAME) //If not in game don't do any of this
|
||||
/// return;
|
||||
|
||||
//Special toggle for crouch, NOT when using jetpack or in water
|
||||
if (droidinput.toggleCrouch)
|
||||
{
|
||||
int lotag = sector[g_player[myconnectindex].ps->cursectnum].lotag;
|
||||
|
||||
if (droidinput.crouchToggleState && (lotag == ST_2_UNDERWATER || lotag == ST_1_ABOVE_WATER))
|
||||
{
|
||||
droidinput.crouchToggleState = 0;
|
||||
if (action == gamefunc_Crouch)
|
||||
state = 0;
|
||||
else AndroidAction(0, gamefunc_Crouch);
|
||||
}
|
||||
|
||||
if (action == gamefunc_Crouch)
|
||||
{
|
||||
if (!g_player[myconnectindex].ps->jetpack_on && g_player[myconnectindex].ps->on_ground &&
|
||||
lotag != ST_2_UNDERWATER && lotag != ST_1_ABOVE_WATER)
|
||||
{
|
||||
if (state)
|
||||
droidinput.crouchToggleState = !droidinput.crouchToggleState;
|
||||
|
||||
state = droidinput.crouchToggleState;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Check if jumping while crouched
|
||||
if (action == gamefunc_Jump)
|
||||
{
|
||||
if (droidinput.crouchToggleState)
|
||||
{
|
||||
droidinput.crouchToggleState = 0;
|
||||
changeActionState(0, gamefunc_Crouch);
|
||||
}
|
||||
else
|
||||
changeActionState(state, action);
|
||||
}
|
||||
else
|
||||
changeActionState(state, action);
|
||||
|
||||
if (state == 2)
|
||||
AndroidAction(0, action);
|
||||
|
||||
// LOGI("AndroidAction state = 0x%016llX", CONTROL_ButtonState);
|
||||
}
|
||||
}
|
||||
|
||||
int const deadRegion = 0.3;
|
||||
|
||||
float analogCalibrate(float v)
|
||||
{
|
||||
float rv = 0;
|
||||
|
||||
if (v > deadRegion) rv = (v - deadRegion) * (v - deadRegion);
|
||||
else if (-v > deadRegion) rv = -(-v - deadRegion) * (-v - deadRegion);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
//Need these NAN check as not cumulative.
|
||||
void AndroidMove(float fwd, float strafe)
|
||||
{
|
||||
if (!ud.auto_run)
|
||||
{
|
||||
fwd *= 0.5f;
|
||||
strafe *= 0.5f;
|
||||
}
|
||||
|
||||
if (!isnan(fwd))
|
||||
droidinput.forwardmove = fclamp2(analogCalibrate(fwd), -1.f, 1.f);
|
||||
|
||||
if (!isnan(strafe))
|
||||
droidinput.sidemove = fclamp2(analogCalibrate(strafe), -1.f, 1.f);
|
||||
}
|
||||
|
||||
void AndroidLook(float yaw, float pitch)
|
||||
{
|
||||
droidinput.pitch += pitch;
|
||||
droidinput.yaw += yaw;
|
||||
}
|
||||
|
||||
void AndroidLookJoystick(float yaw, float pitch)
|
||||
{
|
||||
if (!isnan(pitch))
|
||||
droidinput.pitch_joystick = analogCalibrate(pitch);
|
||||
|
||||
if (!isnan(yaw))
|
||||
droidinput.yaw_joystick = analogCalibrate(yaw);
|
||||
}
|
||||
|
||||
void AndroidOSD(const char * cmd)
|
||||
{
|
||||
OSD_Dispatch(cmd);
|
||||
}
|
||||
|
||||
int consoleShown = 0;
|
||||
void AndroidSetConsoleShown(int onf)
|
||||
{
|
||||
consoleShown = onf;
|
||||
}
|
||||
|
||||
extern int inExtraScreens; //In game.c
|
||||
int32_t AndroidRead(portableread_t r)
|
||||
{
|
||||
int32_t rv;
|
||||
|
||||
switch (r)
|
||||
{
|
||||
case R_TOUCH_MODE:
|
||||
if (g_animPtr || inExtraScreens)
|
||||
rv = TOUCH_SCREEN_BLANK_TAP;
|
||||
else if (consoleShown)
|
||||
rv = TOUCH_SCREEN_CONSOLE;
|
||||
else if ((g_player[myconnectindex].ps->gm & MODE_MENU) == MODE_MENU && g_currentMenu != MENU_MAIN)
|
||||
rv = (m_currentMenu->type == Verify && totalclock > (m_animation.length + m_animation.start)) ? TOUCH_SCREEN_YES_NO : TOUCH_SCREEN_MENU;
|
||||
else if ((g_player[myconnectindex].ps->gm & MODE_MENU) == MODE_MENU && g_currentMenu == MENU_MAIN)
|
||||
rv = TOUCH_SCREEN_MENU_NOBACK;
|
||||
/*
|
||||
else if (ud.overhead_on == 2)
|
||||
rv = TOUCH_SCREEN_AUTOMAP;
|
||||
*/
|
||||
else if ((g_player[myconnectindex].ps->gm & MODE_GAME))
|
||||
if (AndroidRead(R_PLAYER_DEAD_FLAG))
|
||||
rv = TOUCH_SCREEN_BLANK_TAP;
|
||||
else
|
||||
rv = TOUCH_SCREEN_GAME;
|
||||
else
|
||||
rv = TOUCH_SCREEN_BLANK_TAP;
|
||||
break;
|
||||
case R_PLAYER_GOTWEAPON:
|
||||
rv = g_player[myconnectindex].ps->gotweapon; break;
|
||||
case R_UD_OVERHEAD_ON:
|
||||
rv = 0; break;//ud.overhead_on != 0; break;// ud.overhead_on ranges from 0-2
|
||||
case R_UD_SCROLLMODE:
|
||||
rv = ud.scrollmode; break;
|
||||
case R_PLAYER_LASTWEAPON:
|
||||
rv = droidinput.lastWeapon;
|
||||
if ((unsigned)rv < MAX_WEAPONS && !g_player[myconnectindex].ps->ammo_amount[rv])
|
||||
rv = -1;
|
||||
break;
|
||||
case R_GAME_PAUSED:
|
||||
rv = ud.pause_on != 0; break;
|
||||
case R_PLAYER_DEAD_FLAG:
|
||||
rv = g_player[myconnectindex].ps->dead_flag; break;
|
||||
case R_PLAYER_INV_AMOUNT:
|
||||
rv = 0;
|
||||
for (bssize_t i = 0; i < GET_MAX; i++)
|
||||
{
|
||||
if (g_player[myconnectindex].ps->inv_amount[i])
|
||||
rv += (1 << i);
|
||||
}
|
||||
break;
|
||||
case R_SOMETHINGONPLAYER:
|
||||
rv = g_player[myconnectindex].ps->somethingonplayer != -1;
|
||||
break;
|
||||
default:
|
||||
rv = 0; break;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
static float map_zoom,map_dx,map_dy = 0;
|
||||
|
||||
void AndroidAutomapControl(float zoom,float dx,float dy)
|
||||
{
|
||||
map_zoom += zoom;
|
||||
map_dx += dx;
|
||||
map_dy += dy;
|
||||
}
|
||||
|
||||
///This stuff is called from the game/engine
|
||||
|
||||
extern void CONTROL_Android_ScrollMap(int32_t *angle,int32_t *x, int32_t *y, uint16_t *zoom )
|
||||
{
|
||||
|
||||
*x += ((int)(map_dx * -30000)*sintable[(512+2048-*angle)&2047])>>14;
|
||||
*y += ((int)(map_dy * -30000)*sintable[(512+1024-512-*angle)&2047])>>14;
|
||||
|
||||
// *zoom += map_zoom * 2000;
|
||||
//*angle = 0;
|
||||
map_dx = map_dy = map_zoom = 0;
|
||||
}
|
||||
|
||||
void CONTROL_Android_SetLastWeapon(int w)
|
||||
{
|
||||
droidinput.lastWeapon = w;
|
||||
}
|
||||
|
||||
void CONTROL_Android_ClearButton(int32_t whichbutton)
|
||||
{
|
||||
droidinput.functionHeld &= ~((uint64_t)1<<((uint64_t)(whichbutton)));
|
||||
}
|
||||
|
||||
void CONTROL_Android_PollDevices(ControlInfo *info)
|
||||
{
|
||||
//LOGI("CONTROL_Android_PollDevices %f %f",forwardmove,sidemove);
|
||||
//LOGI("CONTROL_Android_PollDevices %f %f",droidinput.pitch,droidinput.yaw);
|
||||
|
||||
info->dz = (int32_t)nearbyintf(-droidinput.forwardmove * ANDROIDMOVEFACTOR);
|
||||
info->dx = (int32_t)nearbyintf(droidinput.sidemove * ANDROIDMOVEFACTOR) >> 5;
|
||||
info->dpitch =
|
||||
(int32_t)nearbyintf(droidinput.pitch * ANDROIDLOOKFACTOR + droidinput.pitch_joystick * ANDROIDPITCHFACTORJOYSTICK);
|
||||
info->dyaw =
|
||||
(int32_t)nearbyintf(-droidinput.yaw * ANDROIDLOOKFACTOR - droidinput.yaw_joystick * ANDROIDYAWFACTORJOYSTICK);
|
||||
|
||||
droidinput.pitch = droidinput.yaw = 0.f;
|
||||
CONTROL_ButtonState = droidinput.functionSticky | droidinput.functionHeld;
|
||||
droidinput.functionSticky = 0;
|
||||
|
||||
//LOGI("poll state = 0x%016llX",CONTROL_ButtonState);
|
||||
}
|
||||
|
||||
#if defined __GNUC__
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
120
source/rr/src/in_android.h
Normal file
|
@ -0,0 +1,120 @@
|
|||
#include "function.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#define MENU_UP 0x200
|
||||
#define MENU_DOWN 0x201
|
||||
#define MENU_LEFT 0x202
|
||||
#define MENU_RIGHT 0x203
|
||||
#define MENU_SELECT 0x204
|
||||
#define MENU_BACK 0x205
|
||||
|
||||
#define KEY_QUICK_CMD 0x1005
|
||||
#define KEY_SHOW_KBRD 0x1008
|
||||
#define KEY_SHOW_INVEN 0x1009
|
||||
#define KEY_QUICK_SAVE 0x100A
|
||||
#define KEY_QUICK_LOAD 0x100B
|
||||
|
||||
#define KEY_QUICK_KEY1 0x1011
|
||||
#define KEY_QUICK_KEY2 0x1012
|
||||
#define KEY_QUICK_KEY3 0x1013
|
||||
#define KEY_QUICK_KEY4 0x1014
|
||||
|
||||
// #define BUTTONSET(x,value) (CONTROL_ButtonState |= ((uint64_t)value<<((uint64_t)(x))))
|
||||
// #define BUTTONCLEAR(x) (CONTROL_ButtonState &= ~((uint64_t)1<<((uint64_t)(x))))
|
||||
|
||||
#define PRECISIONSHOOTFACTOR 0.3f
|
||||
|
||||
// where do these numbers come from?
|
||||
#define ANDROIDMOVEFACTOR 6400
|
||||
#define ANDROIDLOOKFACTOR 1600
|
||||
|
||||
#define ANDROIDPITCHFACTORJOYSTICK 2000
|
||||
#define ANDROIDYAWFACTORJOYSTICK 4000
|
||||
|
||||
typedef enum {
|
||||
R_TOUCH_MODE,
|
||||
R_PLAYER_GOTWEAPON,
|
||||
R_UD_OVERHEAD_ON,
|
||||
R_UD_SCROLLMODE,
|
||||
R_PLAYER_LASTWEAPON,
|
||||
R_GAME_PAUSED,
|
||||
R_PLAYER_DEAD_FLAG,
|
||||
R_PLAYER_INV_AMOUNT,
|
||||
R_SOMETHINGONPLAYER
|
||||
} portableread_t;
|
||||
|
||||
|
||||
typedef enum {
|
||||
TOUCH_SCREEN_BLANK, //Nothing on screen (not used)
|
||||
TOUCH_SCREEN_BLANK_TAP, //One button filling screen with no graphic, tap to send Enter key
|
||||
TOUCH_SCREEN_YES_NO, //Yes/No buttons on screen, sends Enter or Esc
|
||||
TOUCH_SCREEN_MENU, //Normal menu
|
||||
TOUCH_SCREEN_MENU_NOBACK, // menu without back button
|
||||
TOUCH_SCREEN_GAME, //Normal game screen
|
||||
TOUCH_SCREEN_AUTOMAP, //When auto map is up (not used yet)
|
||||
TOUCH_SCREEN_CONSOLE //When Console is up
|
||||
} touchscreemode_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int32_t crouchToggleState;
|
||||
int32_t lastWeapon;
|
||||
int32_t toggleCrouch;
|
||||
int32_t quickSelectWeapon;
|
||||
|
||||
uint64_t functionSticky; //To let at least one tick
|
||||
uint64_t functionHeld;
|
||||
|
||||
int32_t left_double_action;
|
||||
int32_t right_double_action;
|
||||
|
||||
int32_t invertLook, hideStick;
|
||||
|
||||
double pitch, yaw;
|
||||
double pitch_joystick, yaw_joystick;
|
||||
float forwardmove, sidemove;
|
||||
|
||||
// set by configuration UI
|
||||
float strafe_sens, forward_sens;
|
||||
float pitch_sens, yaw_sens;
|
||||
|
||||
float gameControlsAlpha;
|
||||
} droidinput_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int32_t audio_sample_rate;
|
||||
int32_t audio_buffer_size;
|
||||
uint16_t screen_width, screen_height;
|
||||
} droidsysinfo_t;
|
||||
|
||||
extern droidinput_t droidinput;
|
||||
extern droidsysinfo_t droidinfo;
|
||||
|
||||
void AndroidTimer(int tics);
|
||||
int AndroidKeyEvent(int state, int code, int unicode);
|
||||
int AndroidRead(portableread_t r);
|
||||
|
||||
void AndroidAction(int state, int action);
|
||||
|
||||
void AndroidMouseMenu(float x,float y);
|
||||
void AndroidMouseMenuButton(int state,int button);
|
||||
|
||||
void AndroidMove(float fwd, float strafe);
|
||||
void AndroidLook(float yaw, float pitch);
|
||||
void AndroidLookJoystick(float yaw, float pitch);
|
||||
void AndroidOSD(const char * cmd);
|
||||
|
||||
void AndroidAutomapControl(float zoom,float dx,float dy);
|
||||
|
||||
void AndroidShowKeyboard(int onf);
|
||||
|
||||
void AndroidToggleButtonEditor(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
346
source/rr/src/input.cpp
Normal file
|
@ -0,0 +1,346 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#include "global.h"
|
||||
#include "game.h"
|
||||
#include "function.h"
|
||||
#include "keyboard.h"
|
||||
#include "mouse.h"
|
||||
#include "joystick.h"
|
||||
#include "control.h"
|
||||
#include "input.h"
|
||||
#include "menus.h"
|
||||
|
||||
int32_t I_CheckAllInput(void)
|
||||
{
|
||||
return (
|
||||
#if defined EDUKE32_IOS
|
||||
g_mouseClickState == MOUSE_PRESSED ||
|
||||
#endif
|
||||
KB_KeyWaiting() ||
|
||||
MOUSE_GetButtons() ||
|
||||
JOYSTICK_GetButtons()
|
||||
);
|
||||
}
|
||||
void I_ClearAllInput(void)
|
||||
{
|
||||
#if defined EDUKE32_IOS
|
||||
mouseAdvanceClickState();
|
||||
#endif
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeysDown();
|
||||
MOUSE_ClearAllButtons();
|
||||
JOYSTICK_ClearAllButtons();
|
||||
}
|
||||
|
||||
|
||||
int32_t I_AdvanceTrigger(void)
|
||||
{
|
||||
return (
|
||||
KB_KeyPressed(sc_kpad_Enter) ||
|
||||
KB_KeyPressed(sc_Enter) ||
|
||||
#if !defined EDUKE32_TOUCH_DEVICES
|
||||
MOUSEINACTIVECONDITIONAL(MOUSE_GetButtons()&LEFT_MOUSE) ||
|
||||
#endif
|
||||
#if defined(GEKKO)
|
||||
MOUSEINACTIVECONDITIONAL(JOYSTICK_GetButtons()&WII_A)
|
||||
#else
|
||||
BUTTON(gamefunc_Open) ||
|
||||
# if !defined EDUKE32_TOUCH_DEVICES
|
||||
MOUSEINACTIVECONDITIONAL(BUTTON(gamefunc_Fire))
|
||||
# else
|
||||
BUTTON(gamefunc_Fire)
|
||||
# endif
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
void I_AdvanceTriggerClear(void)
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeyDown(sc_kpad_Enter);
|
||||
KB_ClearKeyDown(sc_Enter);
|
||||
MOUSE_ClearButton(LEFT_MOUSE);
|
||||
#if defined(GEKKO)
|
||||
JOYSTICK_ClearButton(WII_A);
|
||||
#else
|
||||
CONTROL_ClearButton(gamefunc_Open);
|
||||
CONTROL_ClearButton(gamefunc_Fire);
|
||||
#endif
|
||||
}
|
||||
|
||||
int32_t I_ReturnTrigger(void)
|
||||
{
|
||||
return (
|
||||
KB_KeyPressed(sc_Escape) ||
|
||||
(MOUSE_GetButtons()&RIGHT_MOUSE) ||
|
||||
BUTTON(gamefunc_Crouch)
|
||||
#if defined(GEKKO)
|
||||
|| (JOYSTICK_GetButtons()&(WII_B|WII_HOME))
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
void I_ReturnTriggerClear(void)
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeyDown(sc_Escape);
|
||||
MOUSE_ClearButton(RIGHT_MOUSE);
|
||||
CONTROL_ClearButton(gamefunc_Crouch);
|
||||
#if defined(GEKKO)
|
||||
JOYSTICK_ClearButton(WII_B);
|
||||
JOYSTICK_ClearButton(WII_HOME);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int32_t I_EscapeTrigger(void)
|
||||
{
|
||||
return (
|
||||
KB_KeyPressed(sc_Escape)
|
||||
#if defined(GEKKO)
|
||||
|| (JOYSTICK_GetButtons()&WII_HOME)
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
void I_EscapeTriggerClear(void)
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeyDown(sc_Escape);
|
||||
#if defined(GEKKO)
|
||||
JOYSTICK_ClearButton(WII_HOME);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int32_t I_MenuUp(void)
|
||||
{
|
||||
return (
|
||||
KB_KeyPressed(sc_UpArrow) ||
|
||||
KB_KeyPressed(sc_kpad_8) ||
|
||||
(MOUSE_GetButtons()&WHEELUP_MOUSE) ||
|
||||
BUTTON(gamefunc_Move_Forward) ||
|
||||
(JOYSTICK_GetHat(0)&HAT_UP)
|
||||
);
|
||||
}
|
||||
|
||||
void I_MenuUpClear(void)
|
||||
{
|
||||
KB_ClearKeyDown(sc_UpArrow);
|
||||
KB_ClearKeyDown(sc_kpad_8);
|
||||
MOUSE_ClearButton(WHEELUP_MOUSE);
|
||||
CONTROL_ClearButton(gamefunc_Move_Forward);
|
||||
JOYSTICK_ClearHat(0);
|
||||
}
|
||||
|
||||
|
||||
int32_t I_MenuDown(void)
|
||||
{
|
||||
return (
|
||||
KB_KeyPressed(sc_DownArrow) ||
|
||||
KB_KeyPressed(sc_kpad_2) ||
|
||||
(MOUSE_GetButtons()&WHEELDOWN_MOUSE) ||
|
||||
BUTTON(gamefunc_Move_Backward) ||
|
||||
(JOYSTICK_GetHat(0)&HAT_DOWN)
|
||||
);
|
||||
}
|
||||
|
||||
void I_MenuDownClear(void)
|
||||
{
|
||||
KB_ClearKeyDown(sc_DownArrow);
|
||||
KB_ClearKeyDown(sc_kpad_2);
|
||||
KB_ClearKeyDown(sc_PgDn);
|
||||
MOUSE_ClearButton(WHEELDOWN_MOUSE);
|
||||
CONTROL_ClearButton(gamefunc_Move_Backward);
|
||||
JOYSTICK_ClearHat(0);
|
||||
}
|
||||
|
||||
|
||||
int32_t I_MenuLeft(void)
|
||||
{
|
||||
return (
|
||||
KB_KeyPressed(sc_LeftArrow) ||
|
||||
KB_KeyPressed(sc_kpad_4) ||
|
||||
(SHIFTS_IS_PRESSED && KB_KeyPressed(sc_Tab)) ||
|
||||
BUTTON(gamefunc_Turn_Left) ||
|
||||
BUTTON(gamefunc_Strafe_Left) ||
|
||||
(JOYSTICK_GetHat(0)&HAT_LEFT)
|
||||
);
|
||||
}
|
||||
|
||||
void I_MenuLeftClear(void)
|
||||
{
|
||||
KB_ClearKeyDown(sc_LeftArrow);
|
||||
KB_ClearKeyDown(sc_kpad_4);
|
||||
KB_ClearKeyDown(sc_Tab);
|
||||
CONTROL_ClearButton(gamefunc_Turn_Left);
|
||||
CONTROL_ClearButton(gamefunc_Strafe_Left);
|
||||
JOYSTICK_ClearHat(0);
|
||||
}
|
||||
|
||||
|
||||
int32_t I_MenuRight(void)
|
||||
{
|
||||
return (
|
||||
KB_KeyPressed(sc_RightArrow) ||
|
||||
KB_KeyPressed(sc_kpad_6) ||
|
||||
(!SHIFTS_IS_PRESSED && KB_KeyPressed(sc_Tab)) ||
|
||||
BUTTON(gamefunc_Turn_Right) ||
|
||||
BUTTON(gamefunc_Strafe_Right) ||
|
||||
(MOUSE_GetButtons()&MIDDLE_MOUSE) ||
|
||||
(JOYSTICK_GetHat(0)&HAT_RIGHT)
|
||||
);
|
||||
}
|
||||
|
||||
void I_MenuRightClear(void)
|
||||
{
|
||||
KB_ClearKeyDown(sc_RightArrow);
|
||||
KB_ClearKeyDown(sc_kpad_6);
|
||||
KB_ClearKeyDown(sc_Tab);
|
||||
CONTROL_ClearButton(gamefunc_Turn_Right);
|
||||
CONTROL_ClearButton(gamefunc_Strafe_Right);
|
||||
MOUSE_ClearButton(MIDDLE_MOUSE);
|
||||
JOYSTICK_ClearHat(0);
|
||||
}
|
||||
|
||||
|
||||
int32_t I_PanelUp(void)
|
||||
{
|
||||
return (
|
||||
KB_KeyPressed(sc_PgUp) ||
|
||||
I_MenuUp() ||
|
||||
I_MenuLeft()
|
||||
);
|
||||
}
|
||||
|
||||
void I_PanelUpClear(void)
|
||||
{
|
||||
KB_ClearKeyDown(sc_PgUp);
|
||||
I_MenuUpClear();
|
||||
I_MenuLeftClear();
|
||||
}
|
||||
|
||||
|
||||
int32_t I_PanelDown(void)
|
||||
{
|
||||
return (
|
||||
KB_KeyPressed(sc_PgDn) ||
|
||||
I_MenuDown() ||
|
||||
I_MenuRight() ||
|
||||
I_AdvanceTrigger()
|
||||
);
|
||||
}
|
||||
|
||||
void I_PanelDownClear(void)
|
||||
{
|
||||
KB_ClearKeyDown(sc_PgDn);
|
||||
I_MenuDownClear();
|
||||
I_MenuRightClear();
|
||||
I_AdvanceTriggerClear();
|
||||
}
|
||||
|
||||
|
||||
int32_t I_SliderLeft(void)
|
||||
{
|
||||
return (
|
||||
#if !defined EDUKE32_TOUCH_DEVICES
|
||||
MOUSEINACTIVECONDITIONAL((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELUP_MOUSE)) ||
|
||||
#endif
|
||||
I_MenuLeft()
|
||||
);
|
||||
}
|
||||
|
||||
void I_SliderLeftClear(void)
|
||||
{
|
||||
I_MenuLeftClear();
|
||||
MOUSE_ClearButton(WHEELUP_MOUSE);
|
||||
}
|
||||
|
||||
|
||||
int32_t I_SliderRight(void)
|
||||
{
|
||||
return (
|
||||
#if !defined EDUKE32_TOUCH_DEVICES
|
||||
MOUSEINACTIVECONDITIONAL((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELDOWN_MOUSE)) ||
|
||||
#endif
|
||||
I_MenuRight()
|
||||
);
|
||||
}
|
||||
|
||||
void I_SliderRightClear(void)
|
||||
{
|
||||
I_MenuRightClear();
|
||||
MOUSE_ClearButton(WHEELDOWN_MOUSE);
|
||||
}
|
||||
|
||||
|
||||
int32_t I_EnterText(char *t, int32_t maxlength, int32_t flags)
|
||||
{
|
||||
char ch;
|
||||
int32_t inputloc = Bstrlen(typebuf);
|
||||
|
||||
while ((ch = KB_GetCh()) != 0)
|
||||
{
|
||||
if (ch == asc_BackSpace)
|
||||
{
|
||||
if (inputloc > 0)
|
||||
{
|
||||
inputloc--;
|
||||
*(t+inputloc) = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ch == asc_Enter)
|
||||
{
|
||||
I_AdvanceTriggerClear();
|
||||
return 1;
|
||||
}
|
||||
else if (ch == asc_Escape)
|
||||
{
|
||||
I_ReturnTriggerClear();
|
||||
return -1;
|
||||
}
|
||||
else if (ch >= 32 && inputloc < maxlength && ch < 127)
|
||||
{
|
||||
if (!(flags & INPUT_NUMERIC) || (ch >= '0' && ch <= '9'))
|
||||
{
|
||||
// JBF 20040508: so we can have numeric only if we want
|
||||
*(t+inputloc) = ch;
|
||||
*(t+inputloc+1) = 0;
|
||||
inputloc++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// All gamefuncs (and *only* _gamefuncs_) in I_ReturnTriggerClear() should be replicated here.
|
||||
CONTROL_ClearButton(gamefunc_Crouch);
|
||||
if (I_ReturnTrigger())
|
||||
{
|
||||
I_ReturnTriggerClear();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
66
source/rr/src/input.h
Normal file
|
@ -0,0 +1,66 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#ifndef input_h_
|
||||
#define input_h_
|
||||
|
||||
extern int32_t I_CheckAllInput(void);
|
||||
extern void I_ClearAllInput(void);
|
||||
|
||||
// Advance = Selecting a menu option || Saying "Yes" || Going forward in Help/Credits
|
||||
// Return = Closing a sub-menu || Saying "No"
|
||||
// Escape = Opening the menu in-game (should not be any gamefuncs)
|
||||
|
||||
extern int32_t I_AdvanceTrigger(void);
|
||||
extern void I_AdvanceTriggerClear(void);
|
||||
extern int32_t I_ReturnTrigger(void);
|
||||
extern void I_ReturnTriggerClear(void);
|
||||
extern int32_t I_EscapeTrigger(void);
|
||||
extern void I_EscapeTriggerClear(void);
|
||||
|
||||
extern int32_t I_MenuUp(void);
|
||||
extern void I_MenuUpClear(void);
|
||||
extern int32_t I_MenuDown(void);
|
||||
extern void I_MenuDownClear(void);
|
||||
extern int32_t I_MenuLeft(void);
|
||||
extern void I_MenuLeftClear(void);
|
||||
extern int32_t I_MenuRight(void);
|
||||
extern void I_MenuRightClear(void);
|
||||
|
||||
extern int32_t I_PanelUp(void);
|
||||
extern void I_PanelUpClear(void);
|
||||
extern int32_t I_PanelDown(void);
|
||||
extern void I_PanelDownClear(void);
|
||||
|
||||
extern int32_t I_SliderLeft(void);
|
||||
extern void I_SliderLeftClear(void);
|
||||
extern int32_t I_SliderRight(void);
|
||||
extern void I_SliderRightClear(void);
|
||||
|
||||
|
||||
enum EnterTextFlags_t {
|
||||
INPUT_NUMERIC = 0x00000001,
|
||||
};
|
||||
|
||||
extern int32_t I_EnterText(char *t, int32_t maxlength, int32_t flags);
|
||||
|
||||
#endif
|
58
source/rr/src/inv.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2016 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
enum dukeinv_t
|
||||
{
|
||||
GET_STEROIDS, // 0
|
||||
GET_SHIELD,
|
||||
GET_SCUBA,
|
||||
GET_HOLODUKE,
|
||||
GET_JETPACK,
|
||||
GET_DUMMY1, // 5
|
||||
GET_ACCESS,
|
||||
GET_HEATS,
|
||||
GET_DUMMY2,
|
||||
GET_FIRSTAID,
|
||||
GET_BOOTS, // 10
|
||||
GET_MAX
|
||||
};
|
||||
|
||||
// these are not in the same order as the above, and it can't be changed for compat reasons. lame!
|
||||
enum dukeinvicon_t
|
||||
{
|
||||
ICON_NONE, // 0
|
||||
ICON_FIRSTAID,
|
||||
ICON_STEROIDS,
|
||||
ICON_HOLODUKE,
|
||||
ICON_JETPACK,
|
||||
ICON_HEATS, // 5
|
||||
ICON_SCUBA,
|
||||
ICON_BOOTS,
|
||||
ICON_MAX
|
||||
};
|
||||
|
||||
extern int const icon_to_inv[ICON_MAX];
|
||||
|
||||
extern int const inv_to_icon[GET_MAX];
|
||||
|
148
source/rr/src/keys.h
Normal file
|
@ -0,0 +1,148 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#ifndef KEYS_H
|
||||
|
||||
#define KEYS_H
|
||||
|
||||
#define NUM_CODES 128
|
||||
|
||||
#define ESC 0x1B
|
||||
#define ENTER 0x0D
|
||||
|
||||
#define KEYSC_ESC 0x01
|
||||
#define KEYSC_1 0x02
|
||||
#define KEYSC_2 0x03
|
||||
#define KEYSC_3 0x04
|
||||
#define KEYSC_4 0x05
|
||||
#define KEYSC_5 0x06
|
||||
#define KEYSC_6 0x07
|
||||
#define KEYSC_7 0x08
|
||||
#define KEYSC_8 0x09
|
||||
#define KEYSC_9 0x0a
|
||||
#define KEYSC_0 0x0b
|
||||
#define KEYSC_DASH 0x0c
|
||||
#define KEYSC_EQUAL 0x0d
|
||||
|
||||
#define KEYSC_BS 0x0e
|
||||
#define KEYSC_TAB 0x0f
|
||||
#define KEYSC_Q 0x10
|
||||
#define KEYSC_W 0x11
|
||||
#define KEYSC_E 0x12
|
||||
#define KEYSC_R 0x13
|
||||
#define KEYSC_T 0x14
|
||||
#define KEYSC_Y 0x15
|
||||
#define KEYSC_U 0x16
|
||||
#define KEYSC_I 0x17
|
||||
#define KEYSC_O 0x18
|
||||
#define KEYSC_P 0x19
|
||||
#define KEYSC_LBRACK 0x1a
|
||||
#define KEYSC_RBRACK 0x1b
|
||||
#define KEYSC_ENTER 0x1c
|
||||
|
||||
#define KEYSC_LCTRL 0x1d
|
||||
#define KEYSC_A 0x1e
|
||||
#define KEYSC_S 0x1f
|
||||
#define KEYSC_D 0x20
|
||||
#define KEYSC_F 0x21
|
||||
#define KEYSC_G 0x22
|
||||
#define KEYSC_H 0x23
|
||||
#define KEYSC_J 0x24
|
||||
#define KEYSC_K 0x25
|
||||
#define KEYSC_L 0x26
|
||||
#define KEYSC_SEMI 0x27
|
||||
#define KEYSC_QUOTE 0x28
|
||||
#define KEYSC_BQUOTE 0x29
|
||||
#define KEYSC_TILDE 0x29
|
||||
|
||||
#define KEYSC_LSHIFT 0x2a
|
||||
#define KEYSC_BSLASH 0x2b
|
||||
#define KEYSC_Z 0x2c
|
||||
#define KEYSC_X 0x2d
|
||||
#define KEYSC_C 0x2e
|
||||
#define KEYSC_V 0x2f
|
||||
#define KEYSC_B 0x30
|
||||
#define KEYSC_N 0x31
|
||||
#define KEYSC_M 0x32
|
||||
#define KEYSC_COMMA 0x33
|
||||
#define KEYSC_PERIOD 0x34
|
||||
#define KEYSC_SLASH 0x35
|
||||
#define KEYSC_RSHIFT 0x36
|
||||
#define KEYSC_gSTAR 0x37
|
||||
|
||||
#define KEYSC_LALT 0x38
|
||||
#define KEYSC_SPACE 0x39
|
||||
#define KEYSC_CAPS 0x3a
|
||||
|
||||
#define KEYSC_F1 0x3b
|
||||
#define KEYSC_F2 0x3c
|
||||
#define KEYSC_F3 0x3d
|
||||
#define KEYSC_F4 0x3e
|
||||
#define KEYSC_F5 0x3f
|
||||
#define KEYSC_F6 0x40
|
||||
#define KEYSC_F7 0x41
|
||||
#define KEYSC_F8 0x42
|
||||
#define KEYSC_F9 0x43
|
||||
#define KEYSC_F10 0x44
|
||||
|
||||
#define KEYSC_gNUM 0x45
|
||||
#define KEYSC_SCROLL 0x46
|
||||
|
||||
#define KEYSC_gHOME 0x47
|
||||
#define KEYSC_gUP 0x48
|
||||
#define KEYSC_gPGUP 0x49
|
||||
#define KEYSC_gMINUS 0x4a
|
||||
#define KEYSC_gLEFT 0x4b
|
||||
#define KEYSC_gKP5 0x4c
|
||||
#define KEYSC_gRIGHT 0x4d
|
||||
#define KEYSC_gPLUS 0x4e
|
||||
#define KEYSC_gEND 0x4f
|
||||
#define KEYSC_gDOWN 0x50
|
||||
#define KEYSC_gPGDN 0x51
|
||||
#define KEYSC_gINS 0x52
|
||||
#define KEYSC_gDEL 0x53
|
||||
|
||||
#define KEYSC_F11 0x57
|
||||
#define KEYSC_F12 0x58
|
||||
|
||||
#define KEYSC_gENTER 0x9C
|
||||
#define KEYSC_RCTRL 0x9D
|
||||
#define KEYSC_gSLASH 0xB5
|
||||
#define KEYSC_RALT 0xB8
|
||||
#define KEYSC_PRTSCN 0xB7
|
||||
#define KEYSC_PAUSE 0xC5
|
||||
#define KEYSC_HOME 0xC7
|
||||
#define KEYSC_UP 0xC8
|
||||
#define KEYSC_PGUP 0xC9
|
||||
#define KEYSC_LEFT 0xCB
|
||||
#define KEYSC_RIGHT 0xCD
|
||||
#define KEYSC_END 0xCF
|
||||
#define KEYSC_DOWN 0xD0
|
||||
#define KEYSC_PGDN 0xD1
|
||||
#define KEYSC_INSERT 0xD2
|
||||
#define KEYSC_DELETE 0xD3
|
||||
|
||||
#define asc_Esc 27
|
||||
#define asc_Enter 13
|
||||
#define asc_Space 32
|
||||
|
||||
#endif
|
55
source/rr/src/lunatic/_defs_editor.lua
Normal file
|
@ -0,0 +1,55 @@
|
|||
-- INTERNAL
|
||||
-- definitions of BUILD and game types for the Lunatic Interpreter
|
||||
|
||||
local ffi = require("ffi")
|
||||
local ffiC = ffi.C
|
||||
|
||||
ffi.cdef[[
|
||||
enum {
|
||||
LUNATIC_CLIENT_MAPSTER32 = 0,
|
||||
LUNATIC_CLIENT_EDUKE32 = 1,
|
||||
|
||||
LUNATIC_CLIENT = LUNATIC_CLIENT_MAPSTER32
|
||||
}
|
||||
]]
|
||||
|
||||
--== First, load the definitions common to the game's and editor's Lua interface.
|
||||
decl = ffi.cdef
|
||||
local defs_c = require("defs_common")
|
||||
defs_c.finish_spritetype({})
|
||||
|
||||
defs_c.create_globals(_G)
|
||||
|
||||
-- TODO: provide access to only a subset, restict access to ffiC?
|
||||
gv = ffiC
|
||||
|
||||
--== Mapster32-specific initialization
|
||||
|
||||
ffi.cdef "char *listsearchpath(int32_t initp);"
|
||||
|
||||
-- Add the search path directories to the Lua load path.
|
||||
local initp = 1
|
||||
while (true) do
|
||||
local sp_c = ffiC.listsearchpath(initp)
|
||||
|
||||
if (sp_c == nil) then
|
||||
break
|
||||
end
|
||||
|
||||
local sp = ffi.string(sp_c)
|
||||
assert(sp:sub(-1)=='/')
|
||||
package.path = sp..'?.lua;'..package.path
|
||||
|
||||
initp = 0
|
||||
end
|
||||
|
||||
-- Helper functions
|
||||
local package = package
|
||||
local require = require
|
||||
|
||||
function reload(modname)
|
||||
package.loaded[modname] = nil
|
||||
return require(modname)
|
||||
end
|
||||
|
||||
--print('Lua load path: '..package.path)
|
2632
source/rr/src/lunatic/_defs_game.lua
Normal file
124
source/rr/src/lunatic/bcarray.lua
Normal file
|
@ -0,0 +1,124 @@
|
|||
-- Implementation of a bound-checked array type factory for LuaJIT 2.0 or later.
|
||||
--
|
||||
-- Usage example:
|
||||
--
|
||||
-- > bcarray.new("int8_t", 3, "test", "three_pigs")
|
||||
-- > a = ffi.new("struct { int32_t a; three_pigs p; int16_t b; }")
|
||||
-- > =ffi.sizeof(a) --> 12
|
||||
-- > b = ffi.new("__attribute__((packed)) struct { int32_t a; three_pigs p; int16_t b; }")
|
||||
-- > =ffi.sizeof(b) --> 9
|
||||
|
||||
local ffi = require("ffi")
|
||||
|
||||
local string = require("string")
|
||||
local table = require("table")
|
||||
|
||||
local assert = assert
|
||||
local error = error
|
||||
local pairs = pairs
|
||||
local type = type
|
||||
|
||||
|
||||
local bcarray = {}
|
||||
|
||||
|
||||
-- Generate C decl for a sequence of <nelts> const struct members.
|
||||
-- For example, for 4 elements,
|
||||
-- "const $ _r1, _f2, _u3, _n4;"
|
||||
local function flatten_array(nelts, rng)
|
||||
local strtab = { "$ " }
|
||||
|
||||
if (rng and rng.getu32==nil) then
|
||||
assert(type(rng)=="table")
|
||||
|
||||
for i=1,#rng do
|
||||
strtab[i+1] = rng[i]..((i<#rng) and "," or ";")
|
||||
end
|
||||
else
|
||||
for i=1,nelts do
|
||||
local ch = 97 + (rng and (rng:getu32() % 25) or 0) -- 'a'..'z'
|
||||
strtab[i+1] = string.format("_%c%x%s", ch, i, (i<nelts) and "," or ";")
|
||||
end
|
||||
end
|
||||
|
||||
return table.concat(strtab)
|
||||
end
|
||||
|
||||
-- ctype = bcarray.new(basetype, numelts, showname [, typename] [, rng] [, mtadd])
|
||||
-- (optional fields may be nil)
|
||||
--
|
||||
-- <numelts>: Number of elements in array (small number)
|
||||
-- <showname>: The name to be shown for the derived type in error messages
|
||||
-- <typename>: If non-nil, the name under which the derived type is typedef'd
|
||||
-- <rng>: Random generator state + method :getu32(). If nil, then members are
|
||||
-- named _a1, _a2, ...
|
||||
-- It also may be a table containing member names at numeric indices 1..#rng.
|
||||
-- <mtadd>: A table containing functions __index and/or __newindex. They are
|
||||
-- called first and the bound-checking ones are tail-called then. If the
|
||||
-- custom __index one returns something, it is returned by the composite one.
|
||||
function bcarray.new(basetype, numelts, showname, typename, rng, mtadd)
|
||||
local eltptr_t = ffi.typeof("$ *", ffi.typeof(basetype))
|
||||
|
||||
local mt = {
|
||||
__index = function(ar, idx)
|
||||
if (not (idx >= 0 and idx < numelts)) then
|
||||
error("out-of-bounds "..showname.." read access", 2)
|
||||
end
|
||||
return ffi.cast(eltptr_t, ar)[idx]
|
||||
end,
|
||||
|
||||
-- NOTE: this function will be dead code if the prefixed __newindex
|
||||
-- errors out unconditionally or the bcarray is declared 'const'.
|
||||
__newindex = function(ar, idx, val)
|
||||
if (not (idx >= 0 and idx < numelts)) then
|
||||
error("out-of-bounds "..showname.." write access", 2)
|
||||
end
|
||||
ffi.cast(eltptr_t, ar)[idx] = val
|
||||
end,
|
||||
}
|
||||
|
||||
if (mtadd ~= nil) then
|
||||
local curindexf, curnewindexf = mt.__index, mt.__newindex
|
||||
local addindexf, addnewindexf = mtadd.__index, mtadd.__newindex
|
||||
|
||||
if (addindexf) then
|
||||
-- Additional __index metamethod given.
|
||||
mt.__index = function(ar, idx)
|
||||
local sth = addindexf(ar, idx)
|
||||
if (sth ~= nil) then
|
||||
return sth
|
||||
end
|
||||
return curindexf(ar, idx)
|
||||
end
|
||||
end
|
||||
|
||||
if (addnewindexf) then
|
||||
-- Additional __newindex metamethod given.
|
||||
mt.__newindex = function(ar, idx, val)
|
||||
addnewindexf(ar, idx, val)
|
||||
return curnewindexf(ar, idx, val)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local cdeclstr = "struct {"..flatten_array(numelts, rng).."}"
|
||||
local bcarray_t = ffi.typeof(cdeclstr, ffi.typeof(basetype));
|
||||
|
||||
bcarray_t = ffi.metatype(bcarray_t, mt)
|
||||
if (not (rng and rng.getu32==nil)) then
|
||||
-- When passing a member name table, it is allowed to have a different
|
||||
-- number of named members than array elements.
|
||||
assert(ffi.sizeof(bcarray_t) == ffi.sizeof(basetype)*numelts)
|
||||
end
|
||||
|
||||
if (typename ~= nil) then
|
||||
-- Register the type name in the global namespace.
|
||||
assert(type(typename)=="string")
|
||||
ffi.cdef("typedef $ $;", bcarray_t, typename)
|
||||
end
|
||||
|
||||
return bcarray_t
|
||||
end
|
||||
|
||||
|
||||
return bcarray
|
126
source/rr/src/lunatic/bcheck.lua
Normal file
|
@ -0,0 +1,126 @@
|
|||
-- Bound-checking functions for engine and game "things".
|
||||
|
||||
local ffiC = require("ffi").C
|
||||
local type = type
|
||||
local error = error
|
||||
|
||||
local bcheck = {}
|
||||
|
||||
--== ENGINE ==--
|
||||
|
||||
function bcheck.sector_idx(sectnum)
|
||||
if (not (sectnum >= 0 and sectnum < ffiC.numsectors)) then
|
||||
error("invalid sector number "..sectnum, 3)
|
||||
end
|
||||
end
|
||||
|
||||
function bcheck.wall_idx(wallnum)
|
||||
if (not (wallnum >= 0 and wallnum < ffiC.numwalls)) then
|
||||
error("invalid wall number "..wallnum, 3)
|
||||
end
|
||||
end
|
||||
|
||||
-- TODO: Provide another function that also checks whether the sprite exists in
|
||||
-- the game world (statnum != MAXSTATUS).
|
||||
function bcheck.sprite_idx(spritenum)
|
||||
-- if (not (spritenum >= 0 and spritenum < ffiC.MAXSPRITES)) then
|
||||
if (not (spritenum >= 0 and spritenum < ffiC.MAXSPRITES)) then
|
||||
error("invalid sprite number "..spritenum, 3)
|
||||
end
|
||||
end
|
||||
|
||||
function bcheck.tile_idx(tilenum)
|
||||
if (not (tilenum >= 0 and tilenum < ffiC.MAXTILES)) then
|
||||
error("invalid tile number "..tilenum, 3)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--== HELPERS ==--
|
||||
|
||||
function bcheck.number(val, errlev)
|
||||
if (type(val)~="number" or val~=val) then
|
||||
error("invalid argument: must be a non-NaN number", errlev or 3)
|
||||
end
|
||||
end
|
||||
|
||||
function bcheck.type(val, typestr, errlev)
|
||||
if (type(val)~=typestr) then
|
||||
error("invalid argument: must be a "..typestr, errlev or 3)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--== GAME ==--
|
||||
if (ffiC.LUNATIC_CLIENT == ffiC.LUNATIC_CLIENT_MAPSTER32) then
|
||||
return bcheck
|
||||
end
|
||||
|
||||
local con_lang = require("con_lang")
|
||||
|
||||
function bcheck.player_idx(snum)
|
||||
if (not (snum >= 0 and snum < ffiC.g_mostConcurrentPlayers)) then
|
||||
error("invalid player number "..snum, 3)
|
||||
end
|
||||
end
|
||||
|
||||
function bcheck.sound_idx(sndidx)
|
||||
if (not (sndidx >= 0 and sndidx < con_lang.MAXSOUNDS)) then
|
||||
error("invalid sound number "..sndidx, 3)
|
||||
end
|
||||
end
|
||||
|
||||
function bcheck.weapon_idx(weap)
|
||||
if (not (weap >= 0 and weap < ffiC.MAX_WEAPONS)) then
|
||||
error("Invalid weapon ID "..weap, 3)
|
||||
end
|
||||
end
|
||||
|
||||
function bcheck.inventory_idx(inv)
|
||||
if (not (inv >= 0 and inv < ffiC.GET_MAX)) then
|
||||
error("Invalid inventory ID "..inv, 3)
|
||||
end
|
||||
end
|
||||
|
||||
function bcheck.volume_idx(volume)
|
||||
if (not (volume >= 0 and volume < con_lang.MAXVOLUMES)) then
|
||||
error("invalid volume number "..volume, 3)
|
||||
end
|
||||
end
|
||||
|
||||
function bcheck.level_idx(level)
|
||||
if (not (level >= 0 and level < con_lang.MAXLEVELS)) then
|
||||
error("invalid level number "..level, 3)
|
||||
end
|
||||
end
|
||||
|
||||
function bcheck.linear_map_idx(idx)
|
||||
if (not (idx >= 0 and idx <= con_lang.MAXLEVELS * con_lang.MAXVOLUMES)) then
|
||||
error("invalid linear map index "..idx, 3)
|
||||
end
|
||||
end
|
||||
|
||||
function bcheck.quote_idx(qnum, onlyidx)
|
||||
if (not (qnum >= 0 and qnum < con_lang.MAXQUOTES)) then
|
||||
error("invalid quote number "..qnum, 3)
|
||||
end
|
||||
|
||||
local cstr = ffiC.apStrings[qnum]
|
||||
if (onlyidx) then
|
||||
return cstr
|
||||
end
|
||||
|
||||
if (cstr == nil) then
|
||||
error("null quote "..qnum, 3)
|
||||
end
|
||||
|
||||
return cstr
|
||||
end
|
||||
|
||||
function bcheck.top_level(funcname, errlev)
|
||||
if (ffiC.g_elCallDepth > 0) then
|
||||
error("Invalid use of "..funcname..": must be called from top level", errlev or 3)
|
||||
end
|
||||
end
|
||||
|
||||
return bcheck
|
293
source/rr/src/lunatic/bitar.lua
Normal file
|
@ -0,0 +1,293 @@
|
|||
|
||||
-- "Bit array" module based on LuaJIT's BitOp.
|
||||
|
||||
local bit = require "bit"
|
||||
local math = require "math"
|
||||
|
||||
local ffi = require "ffi"
|
||||
|
||||
local assert = assert
|
||||
local error = error
|
||||
local type = type
|
||||
|
||||
local tostring = tostring
|
||||
|
||||
|
||||
module(...)
|
||||
|
||||
|
||||
local bitar_ct = ffi.typeof[[
|
||||
struct {
|
||||
const double maxbidx; // last permissible bit index
|
||||
const double maxidx; // last permissible int32_t index
|
||||
const intptr_t arptr; // address of the int32_t array
|
||||
}]]
|
||||
local ptr_to_int = ffi.typeof("int32_t *")
|
||||
|
||||
local anchor = {}
|
||||
|
||||
-- population count of a nibble
|
||||
local nibpop = ffi.new("double [?]", 16,
|
||||
{ 0, 1, 1, 2, 1, 2, 2, 3,
|
||||
1, 2, 2, 3, 2, 3, 3, 4 })
|
||||
-- ...and of a byte
|
||||
local bytepop = ffi.new("double [?]", 256)
|
||||
for i=0,255 do
|
||||
bytepop[i] = nibpop[bit.band(i, 15)] + nibpop[bit.rshift(i, 4)]
|
||||
end
|
||||
nibpop = nil
|
||||
|
||||
local function bitar_from_intar(maxbidx, maxidx, ar)
|
||||
-- We need to have the int32_t[?] array be reachable so that it will not be
|
||||
-- garbage collected
|
||||
local ar_intptr = ffi.cast("intptr_t", ar)
|
||||
anchor[tostring(ar_intptr)] = ar
|
||||
|
||||
-- Leaving the (potential) high trailing bits at 0 lets us not worry
|
||||
-- about them in the population count calculation (__len metamethod).
|
||||
-- Also, this is correct for maxbidx%32 == 0, since BitOp's shifts
|
||||
-- mask the 5 lower bits of the counts.
|
||||
local numremain = bit.band(maxbidx+1, 31)
|
||||
ar[maxidx] = bit.band(ar[maxidx], bit.rshift(-1, 32-numremain))
|
||||
|
||||
return bitar_ct(maxbidx, maxidx, ar_intptr)
|
||||
end
|
||||
|
||||
local function setop_common_rel(s1, s2)
|
||||
if (s1.maxbidx ~= s2.maxbidx) then
|
||||
error("bad arguments to bit array set op: must be of same length", 4)
|
||||
end
|
||||
|
||||
local ar1 = ffi.cast(ptr_to_int, s1.arptr)
|
||||
local ar2 = ffi.cast(ptr_to_int, s2.arptr)
|
||||
|
||||
return ar1, ar2
|
||||
end
|
||||
|
||||
local function setop_common(s1, s2)
|
||||
if (not ffi.istype(bitar_ct, s1) or not ffi.istype(bitar_ct, s2)) then
|
||||
error("bad arguments to bit array set op: both must be 'bitar' types", 3)
|
||||
end
|
||||
|
||||
local ar1, ar2 = setop_common_rel(s1, s2)
|
||||
local ar = ffi.new("int32_t [?]", s1.maxidx+1)
|
||||
|
||||
return ar, ar1, ar2
|
||||
end
|
||||
|
||||
local mt = {
|
||||
--- Operational methods
|
||||
|
||||
__add = function(s1, s2) -- set union
|
||||
local ar, ar1, ar2 = setop_common(s1, s2)
|
||||
for i=0,s1.maxidx do
|
||||
ar[i] = bit.bor(ar1[i], ar2[i])
|
||||
end
|
||||
return bitar_from_intar(s1.maxbidx, s1.maxidx, ar)
|
||||
end,
|
||||
|
||||
__mul = function(s1, s2) -- set intersection
|
||||
local ar, ar1, ar2 = setop_common(s1, s2)
|
||||
for i=0,s1.maxidx do
|
||||
ar[i] = bit.band(ar1[i], ar2[i])
|
||||
end
|
||||
return bitar_from_intar(s1.maxbidx, s1.maxidx, ar)
|
||||
end,
|
||||
|
||||
__sub = function(s1, s2) -- set difference
|
||||
local ar, ar1, ar2 = setop_common(s1, s2)
|
||||
for i=0,s1.maxidx do
|
||||
ar[i] = bit.band(ar1[i], bit.bnot(ar2[i]))
|
||||
end
|
||||
return bitar_from_intar(s1.maxbidx, s1.maxidx, ar)
|
||||
end,
|
||||
|
||||
__unm = function(s) -- bitwise NOT
|
||||
local newar = ffi.new("int32_t [?]", s.maxidx+1)
|
||||
local oldar = ffi.cast(ptr_to_int, s.arptr)
|
||||
for i=0,s.maxidx do
|
||||
newar[i] = bit.bnot(oldar[i])
|
||||
end
|
||||
return bitar_from_intar(s.maxbidx, s.maxidx, newar)
|
||||
end,
|
||||
|
||||
|
||||
--- Additional operations
|
||||
|
||||
__index = {
|
||||
-- TODO: Rename to 'testi', 'seti', 'cleari'; add 'flipi'?
|
||||
|
||||
-- Is bit i set?
|
||||
isset = function(s, i)
|
||||
if (not (i >= 0 and i<=s.maxbidx)) then
|
||||
error("bad bit index for isset: must be in [0.."..s.maxbidx.."]", 2)
|
||||
end
|
||||
s = ffi.cast(ptr_to_int, s.arptr)
|
||||
return (bit.band(s[bit.rshift(i, 5)], bit.lshift(1, i)) ~= 0)
|
||||
end,
|
||||
|
||||
-- Clear bit i.
|
||||
set0 = function(s, i)
|
||||
if (not (i >= 0 and i<=s.maxbidx)) then
|
||||
error("bad bit index for set0: must be in [0.."..s.maxbidx.."]", 2)
|
||||
end
|
||||
s = ffi.cast(ptr_to_int, s.arptr)
|
||||
local jx = bit.rshift(i, 5)
|
||||
s[jx] = bit.band(s[jx], bit.rol(0xfffffffe, i))
|
||||
end,
|
||||
|
||||
-- Set bit i.
|
||||
set1 = function(s, i)
|
||||
if (not (i >= 0 and i<=s.maxbidx)) then
|
||||
error("bad bit index for set1: must be in [0.."..s.maxbidx.."]", 2)
|
||||
end
|
||||
s = ffi.cast(ptr_to_int, s.arptr)
|
||||
local jx = bit.rshift(i, 5)
|
||||
s[jx] = bit.bor(s[jx], bit.rol(0x00000001, i))
|
||||
end
|
||||
},
|
||||
|
||||
|
||||
--- Relational methods
|
||||
|
||||
__eq = function(s1, s2) -- set identity
|
||||
local ar1, ar2 = setop_common_rel(s1, s2)
|
||||
for i=0,s1.maxidx do
|
||||
if (bit.bxor(ar1[i], ar2[i]) ~= 0) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end,
|
||||
|
||||
__le = function(s1, s2)
|
||||
local ar1, ar2 = setop_common_rel(s1, s2)
|
||||
for i=0,s1.maxidx do
|
||||
if (bit.band(ar1[i], bit.bnot(ar2[i])) ~= 0) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end,
|
||||
|
||||
__lt = function(s1, s2)
|
||||
return s1 <= s2 and not (s2 == s1)
|
||||
end,
|
||||
|
||||
-- The length operator gets the population count of the bit array, i.e. the
|
||||
-- number of set bits.
|
||||
__len = function(s)
|
||||
local ar = ffi.cast(ptr_to_int, s.arptr)
|
||||
local popcnt = 0
|
||||
for i=0,s.maxidx do
|
||||
popcnt = popcnt + bytepop[bit.band(ar[i], 255)] +
|
||||
bytepop[bit.band(bit.rshift(ar[i], 8), 255)] +
|
||||
bytepop[bit.band(bit.rshift(ar[i], 16), 255)] +
|
||||
bytepop[bit.rshift(ar[i], 24)]
|
||||
end
|
||||
return popcnt
|
||||
end,
|
||||
|
||||
-- serialization
|
||||
__tostring = function(s)
|
||||
local size=s.maxidx+1
|
||||
local ar = ffi.cast(ptr_to_int, s.arptr)
|
||||
|
||||
local hdr = "bitar.new("..s.maxbidx..", '"
|
||||
local ofs = #hdr
|
||||
local totalstrlen = ofs+8*size+2
|
||||
local str = ffi.new("char [?]", totalstrlen)
|
||||
|
||||
ffi.copy(str, hdr, ofs)
|
||||
|
||||
for i=0,s.maxidx do
|
||||
-- 'a' is ASCII 97
|
||||
for nib=0,7 do
|
||||
str[ofs + 8*i + nib] = 97 + bit.band(bit.rshift(ar[i], 4*nib), 0x0000000f)
|
||||
end
|
||||
end
|
||||
|
||||
ffi.copy(str+totalstrlen-2, "')", 2)
|
||||
|
||||
return ffi.string(str, totalstrlen)
|
||||
end,
|
||||
|
||||
-- On garbage collection of the bitar, clear the array's anchor so that it
|
||||
-- can be collected too.
|
||||
__gc = function(s)
|
||||
anchor[tostring(s.arptr)] = nil
|
||||
end,
|
||||
|
||||
__metatable = true,
|
||||
}
|
||||
|
||||
ffi.metatype(bitar_ct, mt)
|
||||
|
||||
|
||||
-- Create new bit array.
|
||||
function new(maxbidx, initval)
|
||||
if (type(maxbidx) ~= "number" or not (maxbidx >= 0 and maxbidx <= (2^31)-2)) then
|
||||
-- NOTE: Uh-oh, we can't write '2^31' because that would be interpreted
|
||||
-- as color by OSD_Printf.
|
||||
error("bad argument #1 to bitar.new (must be a number in [0..(2**31)-2])", 2)
|
||||
end
|
||||
|
||||
if (math.floor(maxbidx) ~= maxbidx) then
|
||||
error("bad argument #1 to bitar.new (must be an integral number)")
|
||||
end
|
||||
|
||||
if (ffi.istype(ptr_to_int, initval)) then
|
||||
-- Initialization from an array on the C side. INTERNAL.
|
||||
-- Cannot be reached by user code since there's no access to the FFI
|
||||
-- (and thus no way to create pointers).
|
||||
|
||||
return bitar_from_intar(maxbidx, (maxbidx+1)/32-1, initval)
|
||||
|
||||
elseif (type(initval)=="string") then
|
||||
-- String containing hex digits (a..p) given, for INTERNAL use only.
|
||||
-- XXX: Can be reached by user code.
|
||||
|
||||
local lstr = initval
|
||||
|
||||
local numnibs = #lstr
|
||||
assert(numnibs%8 == 0)
|
||||
|
||||
local size = numnibs/8
|
||||
local maxidx = size-1
|
||||
local ar = ffi.new("int32_t [?]", size)
|
||||
|
||||
local str = ffi.new("char [?]", numnibs)
|
||||
ffi.copy(str, lstr, numnibs)
|
||||
|
||||
for i=0,maxidx do
|
||||
ar[i] = 0
|
||||
|
||||
for nib=0,7 do
|
||||
local hexdig = str[8*i + nib]
|
||||
assert(hexdig >= 97 and hexdig < 97+16)
|
||||
ar[i] = bit.bor(ar[i], bit.lshift(hexdig-97, 4*nib))
|
||||
end
|
||||
end
|
||||
|
||||
-- NOTE: <maxbidx> cannot be extracted from the string, use the passed one.
|
||||
return bitar_from_intar(maxbidx, maxidx, ar)
|
||||
|
||||
else
|
||||
-- User-requested bitar creation.
|
||||
|
||||
if (initval ~= 0 and initval ~= 1) then
|
||||
error("bad argument #2 to bitar.new (must be either 0 or 1)", 2)
|
||||
end
|
||||
|
||||
local maxidx = math.floor(maxbidx/32)
|
||||
local size = maxidx+1
|
||||
|
||||
local ar = ffi.new("int32_t [?]", size)
|
||||
|
||||
if (initval==1) then
|
||||
ffi.fill(ar, size*4, -1)
|
||||
end
|
||||
|
||||
return bitar_from_intar(maxbidx, maxidx, ar)
|
||||
end
|
||||
end
|
1340
source/rr/src/lunatic/con_lang.lua
Normal file
2420
source/rr/src/lunatic/control.lua
Normal file
1431
source/rr/src/lunatic/defs_common.lua
Normal file
20
source/rr/src/lunatic/dis_x64.lua
Normal file
|
@ -0,0 +1,20 @@
|
|||
----------------------------------------------------------------------------
|
||||
-- LuaJIT x64 disassembler wrapper module.
|
||||
--
|
||||
-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
-- Released under the MIT license. See Copyright Notice in luajit.h
|
||||
----------------------------------------------------------------------------
|
||||
-- This module just exports the 64 bit functions from the combined
|
||||
-- x86/x64 disassembler module. All the interesting stuff is there.
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
local require = require
|
||||
|
||||
module(...)
|
||||
|
||||
local dis_x86 = require(_PACKAGE.."dis_x86")
|
||||
|
||||
create = dis_x86.create64
|
||||
disass = dis_x86.disass64
|
||||
regname = dis_x86.regname64
|
||||
|
836
source/rr/src/lunatic/dis_x86.lua
Normal file
|
@ -0,0 +1,836 @@
|
|||
----------------------------------------------------------------------------
|
||||
-- LuaJIT x86/x64 disassembler module.
|
||||
--
|
||||
-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
-- Released under the MIT license. See Copyright Notice in luajit.h
|
||||
----------------------------------------------------------------------------
|
||||
-- This is a helper module used by the LuaJIT machine code dumper module.
|
||||
--
|
||||
-- Sending small code snippets to an external disassembler and mixing the
|
||||
-- output with our own stuff was too fragile. So I had to bite the bullet
|
||||
-- and write yet another x86 disassembler. Oh well ...
|
||||
--
|
||||
-- The output format is very similar to what ndisasm generates. But it has
|
||||
-- been developed independently by looking at the opcode tables from the
|
||||
-- Intel and AMD manuals. The supported instruction set is quite extensive
|
||||
-- and reflects what a current generation Intel or AMD CPU implements in
|
||||
-- 32 bit and 64 bit mode. Yes, this includes MMX, SSE, SSE2, SSE3, SSSE3,
|
||||
-- SSE4.1, SSE4.2, SSE4a and even privileged and hypervisor (VMX/SVM)
|
||||
-- instructions.
|
||||
--
|
||||
-- Notes:
|
||||
-- * The (useless) a16 prefix, 3DNow and pre-586 opcodes are unsupported.
|
||||
-- * No attempt at optimization has been made -- it's fast enough for my needs.
|
||||
-- * The public API may change when more architectures are added.
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
local type = type
|
||||
local sub, byte, format = string.sub, string.byte, string.format
|
||||
local match, gmatch, gsub = string.match, string.gmatch, string.gsub
|
||||
local lower, rep = string.lower, string.rep
|
||||
|
||||
-- Map for 1st opcode byte in 32 bit mode. Ugly? Well ... read on.
|
||||
local map_opc1_32 = {
|
||||
--0x
|
||||
[0]="addBmr","addVmr","addBrm","addVrm","addBai","addVai","push es","pop es",
|
||||
"orBmr","orVmr","orBrm","orVrm","orBai","orVai","push cs","opc2*",
|
||||
--1x
|
||||
"adcBmr","adcVmr","adcBrm","adcVrm","adcBai","adcVai","push ss","pop ss",
|
||||
"sbbBmr","sbbVmr","sbbBrm","sbbVrm","sbbBai","sbbVai","push ds","pop ds",
|
||||
--2x
|
||||
"andBmr","andVmr","andBrm","andVrm","andBai","andVai","es:seg","daa",
|
||||
"subBmr","subVmr","subBrm","subVrm","subBai","subVai","cs:seg","das",
|
||||
--3x
|
||||
"xorBmr","xorVmr","xorBrm","xorVrm","xorBai","xorVai","ss:seg","aaa",
|
||||
"cmpBmr","cmpVmr","cmpBrm","cmpVrm","cmpBai","cmpVai","ds:seg","aas",
|
||||
--4x
|
||||
"incVR","incVR","incVR","incVR","incVR","incVR","incVR","incVR",
|
||||
"decVR","decVR","decVR","decVR","decVR","decVR","decVR","decVR",
|
||||
--5x
|
||||
"pushUR","pushUR","pushUR","pushUR","pushUR","pushUR","pushUR","pushUR",
|
||||
"popUR","popUR","popUR","popUR","popUR","popUR","popUR","popUR",
|
||||
--6x
|
||||
"sz*pushaw,pusha","sz*popaw,popa","boundVrm","arplWmr",
|
||||
"fs:seg","gs:seg","o16:","a16",
|
||||
"pushUi","imulVrmi","pushBs","imulVrms",
|
||||
"insb","insVS","outsb","outsVS",
|
||||
--7x
|
||||
"joBj","jnoBj","jbBj","jnbBj","jzBj","jnzBj","jbeBj","jaBj",
|
||||
"jsBj","jnsBj","jpeBj","jpoBj","jlBj","jgeBj","jleBj","jgBj",
|
||||
--8x
|
||||
"arith!Bmi","arith!Vmi","arith!Bmi","arith!Vms",
|
||||
"testBmr","testVmr","xchgBrm","xchgVrm",
|
||||
"movBmr","movVmr","movBrm","movVrm",
|
||||
"movVmg","leaVrm","movWgm","popUm",
|
||||
--9x
|
||||
"nop*xchgVaR|pause|xchgWaR|repne nop","xchgVaR","xchgVaR","xchgVaR",
|
||||
"xchgVaR","xchgVaR","xchgVaR","xchgVaR",
|
||||
"sz*cbw,cwde,cdqe","sz*cwd,cdq,cqo","call farViw","wait",
|
||||
"sz*pushfw,pushf","sz*popfw,popf","sahf","lahf",
|
||||
--Ax
|
||||
"movBao","movVao","movBoa","movVoa",
|
||||
"movsb","movsVS","cmpsb","cmpsVS",
|
||||
"testBai","testVai","stosb","stosVS",
|
||||
"lodsb","lodsVS","scasb","scasVS",
|
||||
--Bx
|
||||
"movBRi","movBRi","movBRi","movBRi","movBRi","movBRi","movBRi","movBRi",
|
||||
"movVRI","movVRI","movVRI","movVRI","movVRI","movVRI","movVRI","movVRI",
|
||||
--Cx
|
||||
"shift!Bmu","shift!Vmu","retBw","ret","$lesVrm","$ldsVrm","movBmi","movVmi",
|
||||
"enterBwu","leave","retfBw","retf","int3","intBu","into","iretVS",
|
||||
--Dx
|
||||
"shift!Bm1","shift!Vm1","shift!Bmc","shift!Vmc","aamBu","aadBu","salc","xlatb",
|
||||
"fp*0","fp*1","fp*2","fp*3","fp*4","fp*5","fp*6","fp*7",
|
||||
--Ex
|
||||
"loopneBj","loopeBj","loopBj","sz*jcxzBj,jecxzBj,jrcxzBj",
|
||||
"inBau","inVau","outBua","outVua",
|
||||
"callVj","jmpVj","jmp farViw","jmpBj","inBad","inVad","outBda","outVda",
|
||||
--Fx
|
||||
"lock:","int1","repne:rep","rep:","hlt","cmc","testb!Bm","testv!Vm",
|
||||
"clc","stc","cli","sti","cld","std","incb!Bm","incd!Vm",
|
||||
}
|
||||
assert(#map_opc1_32 == 255)
|
||||
|
||||
-- Map for 1st opcode byte in 64 bit mode (overrides only).
|
||||
local map_opc1_64 = setmetatable({
|
||||
[0x06]=false, [0x07]=false, [0x0e]=false,
|
||||
[0x16]=false, [0x17]=false, [0x1e]=false, [0x1f]=false,
|
||||
[0x27]=false, [0x2f]=false, [0x37]=false, [0x3f]=false,
|
||||
[0x60]=false, [0x61]=false, [0x62]=false, [0x63]="movsxdVrDmt", [0x67]="a32:",
|
||||
[0x40]="rex*", [0x41]="rex*b", [0x42]="rex*x", [0x43]="rex*xb",
|
||||
[0x44]="rex*r", [0x45]="rex*rb", [0x46]="rex*rx", [0x47]="rex*rxb",
|
||||
[0x48]="rex*w", [0x49]="rex*wb", [0x4a]="rex*wx", [0x4b]="rex*wxb",
|
||||
[0x4c]="rex*wr", [0x4d]="rex*wrb", [0x4e]="rex*wrx", [0x4f]="rex*wrxb",
|
||||
[0x82]=false, [0x9a]=false, [0xc4]=false, [0xc5]=false, [0xce]=false,
|
||||
[0xd4]=false, [0xd5]=false, [0xd6]=false, [0xea]=false,
|
||||
}, { __index = map_opc1_32 })
|
||||
|
||||
-- Map for 2nd opcode byte (0F xx). True CISC hell. Hey, I told you.
|
||||
-- Prefix dependent MMX/SSE opcodes: (none)|rep|o16|repne, -|F3|66|F2
|
||||
local map_opc2 = {
|
||||
--0x
|
||||
[0]="sldt!Dmp","sgdt!Ump","larVrm","lslVrm",nil,"syscall","clts","sysret",
|
||||
"invd","wbinvd",nil,"ud1",nil,"$prefetch!Bm","femms","3dnowMrmu",
|
||||
--1x
|
||||
"movupsXrm|movssXrm|movupdXrm|movsdXrm",
|
||||
"movupsXmr|movssXmr|movupdXmr|movsdXmr",
|
||||
"movhlpsXrm$movlpsXrm|movsldupXrm|movlpdXrm|movddupXrm",
|
||||
"movlpsXmr||movlpdXmr",
|
||||
"unpcklpsXrm||unpcklpdXrm",
|
||||
"unpckhpsXrm||unpckhpdXrm",
|
||||
"movlhpsXrm$movhpsXrm|movshdupXrm|movhpdXrm",
|
||||
"movhpsXmr||movhpdXmr",
|
||||
"$prefetcht!Bm","hintnopVm","hintnopVm","hintnopVm",
|
||||
"hintnopVm","hintnopVm","hintnopVm","hintnopVm",
|
||||
--2x
|
||||
"movUmx$","movUmy$","movUxm$","movUym$","movUmz$",nil,"movUzm$",nil,
|
||||
"movapsXrm||movapdXrm",
|
||||
"movapsXmr||movapdXmr",
|
||||
"cvtpi2psXrMm|cvtsi2ssXrVmt|cvtpi2pdXrMm|cvtsi2sdXrVmt",
|
||||
"movntpsXmr|movntssXmr|movntpdXmr|movntsdXmr",
|
||||
"cvttps2piMrXm|cvttss2siVrXm|cvttpd2piMrXm|cvttsd2siVrXm",
|
||||
"cvtps2piMrXm|cvtss2siVrXm|cvtpd2piMrXm|cvtsd2siVrXm",
|
||||
"ucomissXrm||ucomisdXrm",
|
||||
"comissXrm||comisdXrm",
|
||||
--3x
|
||||
"wrmsr","rdtsc","rdmsr","rdpmc","sysenter","sysexit",nil,"getsec",
|
||||
"opc3*38",nil,"opc3*3a",nil,nil,nil,nil,nil,
|
||||
--4x
|
||||
"cmovoVrm","cmovnoVrm","cmovbVrm","cmovnbVrm",
|
||||
"cmovzVrm","cmovnzVrm","cmovbeVrm","cmovaVrm",
|
||||
"cmovsVrm","cmovnsVrm","cmovpeVrm","cmovpoVrm",
|
||||
"cmovlVrm","cmovgeVrm","cmovleVrm","cmovgVrm",
|
||||
--5x
|
||||
"movmskpsVrXm$||movmskpdVrXm$","sqrtpsXrm|sqrtssXrm|sqrtpdXrm|sqrtsdXrm",
|
||||
"rsqrtpsXrm|rsqrtssXrm","rcppsXrm|rcpssXrm",
|
||||
"andpsXrm||andpdXrm","andnpsXrm||andnpdXrm",
|
||||
"orpsXrm||orpdXrm","xorpsXrm||xorpdXrm",
|
||||
"addpsXrm|addssXrm|addpdXrm|addsdXrm","mulpsXrm|mulssXrm|mulpdXrm|mulsdXrm",
|
||||
"cvtps2pdXrm|cvtss2sdXrm|cvtpd2psXrm|cvtsd2ssXrm",
|
||||
"cvtdq2psXrm|cvttps2dqXrm|cvtps2dqXrm",
|
||||
"subpsXrm|subssXrm|subpdXrm|subsdXrm","minpsXrm|minssXrm|minpdXrm|minsdXrm",
|
||||
"divpsXrm|divssXrm|divpdXrm|divsdXrm","maxpsXrm|maxssXrm|maxpdXrm|maxsdXrm",
|
||||
--6x
|
||||
"punpcklbwPrm","punpcklwdPrm","punpckldqPrm","packsswbPrm",
|
||||
"pcmpgtbPrm","pcmpgtwPrm","pcmpgtdPrm","packuswbPrm",
|
||||
"punpckhbwPrm","punpckhwdPrm","punpckhdqPrm","packssdwPrm",
|
||||
"||punpcklqdqXrm","||punpckhqdqXrm",
|
||||
"movPrVSm","movqMrm|movdquXrm|movdqaXrm",
|
||||
--7x
|
||||
"pshufwMrmu|pshufhwXrmu|pshufdXrmu|pshuflwXrmu","pshiftw!Pmu",
|
||||
"pshiftd!Pmu","pshiftq!Mmu||pshiftdq!Xmu",
|
||||
"pcmpeqbPrm","pcmpeqwPrm","pcmpeqdPrm","emms|",
|
||||
"vmreadUmr||extrqXmuu$|insertqXrmuu$","vmwriteUrm||extrqXrm$|insertqXrm$",
|
||||
nil,nil,
|
||||
"||haddpdXrm|haddpsXrm","||hsubpdXrm|hsubpsXrm",
|
||||
"movVSmMr|movqXrm|movVSmXr","movqMmr|movdquXmr|movdqaXmr",
|
||||
--8x
|
||||
"joVj","jnoVj","jbVj","jnbVj","jzVj","jnzVj","jbeVj","jaVj",
|
||||
"jsVj","jnsVj","jpeVj","jpoVj","jlVj","jgeVj","jleVj","jgVj",
|
||||
--9x
|
||||
"setoBm","setnoBm","setbBm","setnbBm","setzBm","setnzBm","setbeBm","setaBm",
|
||||
"setsBm","setnsBm","setpeBm","setpoBm","setlBm","setgeBm","setleBm","setgBm",
|
||||
--Ax
|
||||
"push fs","pop fs","cpuid","btVmr","shldVmru","shldVmrc",nil,nil,
|
||||
"push gs","pop gs","rsm","btsVmr","shrdVmru","shrdVmrc","fxsave!Dmp","imulVrm",
|
||||
--Bx
|
||||
"cmpxchgBmr","cmpxchgVmr","$lssVrm","btrVmr",
|
||||
"$lfsVrm","$lgsVrm","movzxVrBmt","movzxVrWmt",
|
||||
"|popcntVrm","ud2Dp","bt!Vmu","btcVmr",
|
||||
"bsfVrm","bsrVrm|lzcntVrm|bsrWrm","movsxVrBmt","movsxVrWmt",
|
||||
--Cx
|
||||
"xaddBmr","xaddVmr",
|
||||
"cmppsXrmu|cmpssXrmu|cmppdXrmu|cmpsdXrmu","$movntiVmr|",
|
||||
"pinsrwPrWmu","pextrwDrPmu",
|
||||
"shufpsXrmu||shufpdXrmu","$cmpxchg!Qmp",
|
||||
"bswapVR","bswapVR","bswapVR","bswapVR","bswapVR","bswapVR","bswapVR","bswapVR",
|
||||
--Dx
|
||||
"||addsubpdXrm|addsubpsXrm","psrlwPrm","psrldPrm","psrlqPrm",
|
||||
"paddqPrm","pmullwPrm",
|
||||
"|movq2dqXrMm|movqXmr|movdq2qMrXm$","pmovmskbVrMm||pmovmskbVrXm",
|
||||
"psubusbPrm","psubuswPrm","pminubPrm","pandPrm",
|
||||
"paddusbPrm","padduswPrm","pmaxubPrm","pandnPrm",
|
||||
--Ex
|
||||
"pavgbPrm","psrawPrm","psradPrm","pavgwPrm",
|
||||
"pmulhuwPrm","pmulhwPrm",
|
||||
"|cvtdq2pdXrm|cvttpd2dqXrm|cvtpd2dqXrm","$movntqMmr||$movntdqXmr",
|
||||
"psubsbPrm","psubswPrm","pminswPrm","porPrm",
|
||||
"paddsbPrm","paddswPrm","pmaxswPrm","pxorPrm",
|
||||
--Fx
|
||||
"|||lddquXrm","psllwPrm","pslldPrm","psllqPrm",
|
||||
"pmuludqPrm","pmaddwdPrm","psadbwPrm","maskmovqMrm||maskmovdquXrm$",
|
||||
"psubbPrm","psubwPrm","psubdPrm","psubqPrm",
|
||||
"paddbPrm","paddwPrm","padddPrm","ud",
|
||||
}
|
||||
assert(map_opc2[255] == "ud")
|
||||
|
||||
-- Map for three-byte opcodes. Can't wait for their next invention.
|
||||
local map_opc3 = {
|
||||
["38"] = { -- [66] 0f 38 xx
|
||||
--0x
|
||||
[0]="pshufbPrm","phaddwPrm","phadddPrm","phaddswPrm",
|
||||
"pmaddubswPrm","phsubwPrm","phsubdPrm","phsubswPrm",
|
||||
"psignbPrm","psignwPrm","psigndPrm","pmulhrswPrm",
|
||||
nil,nil,nil,nil,
|
||||
--1x
|
||||
"||pblendvbXrma",nil,nil,nil,
|
||||
"||blendvpsXrma","||blendvpdXrma",nil,"||ptestXrm",
|
||||
nil,nil,nil,nil,
|
||||
"pabsbPrm","pabswPrm","pabsdPrm",nil,
|
||||
--2x
|
||||
"||pmovsxbwXrm","||pmovsxbdXrm","||pmovsxbqXrm","||pmovsxwdXrm",
|
||||
"||pmovsxwqXrm","||pmovsxdqXrm",nil,nil,
|
||||
"||pmuldqXrm","||pcmpeqqXrm","||$movntdqaXrm","||packusdwXrm",
|
||||
nil,nil,nil,nil,
|
||||
--3x
|
||||
"||pmovzxbwXrm","||pmovzxbdXrm","||pmovzxbqXrm","||pmovzxwdXrm",
|
||||
"||pmovzxwqXrm","||pmovzxdqXrm",nil,"||pcmpgtqXrm",
|
||||
"||pminsbXrm","||pminsdXrm","||pminuwXrm","||pminudXrm",
|
||||
"||pmaxsbXrm","||pmaxsdXrm","||pmaxuwXrm","||pmaxudXrm",
|
||||
--4x
|
||||
"||pmulddXrm","||phminposuwXrm",
|
||||
--Fx
|
||||
[0xf0] = "|||crc32TrBmt",[0xf1] = "|||crc32TrVmt",
|
||||
},
|
||||
|
||||
["3a"] = { -- [66] 0f 3a xx
|
||||
--0x
|
||||
[0x00]=nil,nil,nil,nil,nil,nil,nil,nil,
|
||||
"||roundpsXrmu","||roundpdXrmu","||roundssXrmu","||roundsdXrmu",
|
||||
"||blendpsXrmu","||blendpdXrmu","||pblendwXrmu","palignrPrmu",
|
||||
--1x
|
||||
nil,nil,nil,nil,
|
||||
"||pextrbVmXru","||pextrwVmXru","||pextrVmSXru","||extractpsVmXru",
|
||||
nil,nil,nil,nil,nil,nil,nil,nil,
|
||||
--2x
|
||||
"||pinsrbXrVmu","||insertpsXrmu","||pinsrXrVmuS",nil,
|
||||
--4x
|
||||
[0x40] = "||dppsXrmu",
|
||||
[0x41] = "||dppdXrmu",
|
||||
[0x42] = "||mpsadbwXrmu",
|
||||
--6x
|
||||
[0x60] = "||pcmpestrmXrmu",[0x61] = "||pcmpestriXrmu",
|
||||
[0x62] = "||pcmpistrmXrmu",[0x63] = "||pcmpistriXrmu",
|
||||
},
|
||||
}
|
||||
|
||||
-- Map for VMX/SVM opcodes 0F 01 C0-FF (sgdt group with register operands).
|
||||
local map_opcvm = {
|
||||
[0xc1]="vmcall",[0xc2]="vmlaunch",[0xc3]="vmresume",[0xc4]="vmxoff",
|
||||
[0xc8]="monitor",[0xc9]="mwait",
|
||||
[0xd8]="vmrun",[0xd9]="vmmcall",[0xda]="vmload",[0xdb]="vmsave",
|
||||
[0xdc]="stgi",[0xdd]="clgi",[0xde]="skinit",[0xdf]="invlpga",
|
||||
[0xf8]="swapgs",[0xf9]="rdtscp",
|
||||
}
|
||||
|
||||
-- Map for FP opcodes. And you thought stack machines are simple?
|
||||
local map_opcfp = {
|
||||
-- D8-DF 00-BF: opcodes with a memory operand.
|
||||
-- D8
|
||||
[0]="faddFm","fmulFm","fcomFm","fcompFm","fsubFm","fsubrFm","fdivFm","fdivrFm",
|
||||
"fldFm",nil,"fstFm","fstpFm","fldenvVm","fldcwWm","fnstenvVm","fnstcwWm",
|
||||
-- DA
|
||||
"fiaddDm","fimulDm","ficomDm","ficompDm",
|
||||
"fisubDm","fisubrDm","fidivDm","fidivrDm",
|
||||
-- DB
|
||||
"fildDm","fisttpDm","fistDm","fistpDm",nil,"fld twordFmp",nil,"fstp twordFmp",
|
||||
-- DC
|
||||
"faddGm","fmulGm","fcomGm","fcompGm","fsubGm","fsubrGm","fdivGm","fdivrGm",
|
||||
-- DD
|
||||
"fldGm","fisttpQm","fstGm","fstpGm","frstorDmp",nil,"fnsaveDmp","fnstswWm",
|
||||
-- DE
|
||||
"fiaddWm","fimulWm","ficomWm","ficompWm",
|
||||
"fisubWm","fisubrWm","fidivWm","fidivrWm",
|
||||
-- DF
|
||||
"fildWm","fisttpWm","fistWm","fistpWm",
|
||||
"fbld twordFmp","fildQm","fbstp twordFmp","fistpQm",
|
||||
-- xx C0-FF: opcodes with a pseudo-register operand.
|
||||
-- D8
|
||||
"faddFf","fmulFf","fcomFf","fcompFf","fsubFf","fsubrFf","fdivFf","fdivrFf",
|
||||
-- D9
|
||||
"fldFf","fxchFf",{"fnop"},nil,
|
||||
{"fchs","fabs",nil,nil,"ftst","fxam"},
|
||||
{"fld1","fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz"},
|
||||
{"f2xm1","fyl2x","fptan","fpatan","fxtract","fprem1","fdecstp","fincstp"},
|
||||
{"fprem","fyl2xp1","fsqrt","fsincos","frndint","fscale","fsin","fcos"},
|
||||
-- DA
|
||||
"fcmovbFf","fcmoveFf","fcmovbeFf","fcmovuFf",nil,{nil,"fucompp"},nil,nil,
|
||||
-- DB
|
||||
"fcmovnbFf","fcmovneFf","fcmovnbeFf","fcmovnuFf",
|
||||
{nil,nil,"fnclex","fninit"},"fucomiFf","fcomiFf",nil,
|
||||
-- DC
|
||||
"fadd toFf","fmul toFf",nil,nil,
|
||||
"fsub toFf","fsubr toFf","fdivr toFf","fdiv toFf",
|
||||
-- DD
|
||||
"ffreeFf",nil,"fstFf","fstpFf","fucomFf","fucompFf",nil,nil,
|
||||
-- DE
|
||||
"faddpFf","fmulpFf",nil,{nil,"fcompp"},
|
||||
"fsubrpFf","fsubpFf","fdivrpFf","fdivpFf",
|
||||
-- DF
|
||||
nil,nil,nil,nil,{"fnstsw ax"},"fucomipFf","fcomipFf",nil,
|
||||
}
|
||||
assert(map_opcfp[126] == "fcomipFf")
|
||||
|
||||
-- Map for opcode groups. The subkey is sp from the ModRM byte.
|
||||
local map_opcgroup = {
|
||||
arith = { "add", "or", "adc", "sbb", "and", "sub", "xor", "cmp" },
|
||||
shift = { "rol", "ror", "rcl", "rcr", "shl", "shr", "sal", "sar" },
|
||||
testb = { "testBmi", "testBmi", "not", "neg", "mul", "imul", "div", "idiv" },
|
||||
testv = { "testVmi", "testVmi", "not", "neg", "mul", "imul", "div", "idiv" },
|
||||
incb = { "inc", "dec" },
|
||||
incd = { "inc", "dec", "callUmp", "$call farDmp",
|
||||
"jmpUmp", "$jmp farDmp", "pushUm" },
|
||||
sldt = { "sldt", "str", "lldt", "ltr", "verr", "verw" },
|
||||
sgdt = { "vm*$sgdt", "vm*$sidt", "$lgdt", "vm*$lidt",
|
||||
"smsw", nil, "lmsw", "vm*$invlpg" },
|
||||
bt = { nil, nil, nil, nil, "bt", "bts", "btr", "btc" },
|
||||
cmpxchg = { nil, "sz*,cmpxchg8bQmp,cmpxchg16bXmp", nil, nil,
|
||||
nil, nil, "vmptrld|vmxon|vmclear", "vmptrst" },
|
||||
pshiftw = { nil, nil, "psrlw", nil, "psraw", nil, "psllw" },
|
||||
pshiftd = { nil, nil, "psrld", nil, "psrad", nil, "pslld" },
|
||||
pshiftq = { nil, nil, "psrlq", nil, nil, nil, "psllq" },
|
||||
pshiftdq = { nil, nil, "psrlq", "psrldq", nil, nil, "psllq", "pslldq" },
|
||||
fxsave = { "$fxsave", "$fxrstor", "$ldmxcsr", "$stmxcsr",
|
||||
nil, "lfenceDp$", "mfenceDp$", "sfenceDp$clflush" },
|
||||
prefetch = { "prefetch", "prefetchw" },
|
||||
prefetcht = { "prefetchnta", "prefetcht0", "prefetcht1", "prefetcht2" },
|
||||
}
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
-- Maps for register names.
|
||||
local map_regs = {
|
||||
B = { "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh",
|
||||
"r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b", "r15b" },
|
||||
B64 = { "al", "cl", "dl", "bl", "spl", "bpl", "sil", "dil",
|
||||
"r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b", "r15b" },
|
||||
W = { "ax", "cx", "dx", "bx", "sp", "bp", "si", "di",
|
||||
"r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w" },
|
||||
D = { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi",
|
||||
"r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d" },
|
||||
Q = { "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
|
||||
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15" },
|
||||
M = { "mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7",
|
||||
"mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7" }, -- No x64 ext!
|
||||
X = { "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7",
|
||||
"xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15" },
|
||||
}
|
||||
local map_segregs = { "es", "cs", "ss", "ds", "fs", "gs", "segr6", "segr7" }
|
||||
|
||||
-- Maps for size names.
|
||||
local map_sz2n = {
|
||||
B = 1, W = 2, D = 4, Q = 8, M = 8, X = 16,
|
||||
}
|
||||
local map_sz2prefix = {
|
||||
B = "byte", W = "word", D = "dword",
|
||||
Q = "qword",
|
||||
M = "qword", X = "xword",
|
||||
F = "dword", G = "qword", -- No need for sizes/register names for these two.
|
||||
}
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
-- Output a nicely formatted line with an opcode and operands.
|
||||
local function putop(ctx, text, operands)
|
||||
local code, pos, hex = ctx.code, ctx.pos, ""
|
||||
local hmax = ctx.hexdump
|
||||
if hmax > 0 then
|
||||
for i=ctx.start,pos-1 do
|
||||
hex = hex..format("%02X", byte(code, i, i))
|
||||
end
|
||||
if #hex > hmax then hex = sub(hex, 1, hmax)..". "
|
||||
else hex = hex..rep(" ", hmax-#hex+2) end
|
||||
end
|
||||
if operands then text = text.." "..operands end
|
||||
if ctx.o16 then text = "o16 "..text; ctx.o16 = false end
|
||||
if ctx.a32 then text = "a32 "..text; ctx.a32 = false end
|
||||
if ctx.rep then text = ctx.rep.." "..text; ctx.rep = false end
|
||||
if ctx.rex then
|
||||
local t = (ctx.rexw and "w" or "")..(ctx.rexr and "r" or "")..
|
||||
(ctx.rexx and "x" or "")..(ctx.rexb and "b" or "")
|
||||
if t ~= "" then text = "rex."..t.." "..text end
|
||||
ctx.rexw = false; ctx.rexr = false; ctx.rexx = false; ctx.rexb = false
|
||||
ctx.rex = false
|
||||
end
|
||||
if ctx.seg then
|
||||
local text2, n = gsub(text, "%[", "["..ctx.seg..":")
|
||||
if n == 0 then text = ctx.seg.." "..text else text = text2 end
|
||||
ctx.seg = false
|
||||
end
|
||||
if ctx.lock then text = "lock "..text; ctx.lock = false end
|
||||
local imm = ctx.imm
|
||||
if imm then
|
||||
local sym = ctx.symtab[imm]
|
||||
if sym then text = text.."\t->"..sym end
|
||||
end
|
||||
ctx.out(format("%08x %s%s\n", ctx.addr+ctx.start, hex, text))
|
||||
ctx.mrm = false
|
||||
ctx.start = pos
|
||||
ctx.imm = nil
|
||||
end
|
||||
|
||||
-- Clear all prefix flags.
|
||||
local function clearprefixes(ctx)
|
||||
ctx.o16 = false; ctx.seg = false; ctx.lock = false; ctx.rep = false
|
||||
ctx.rexw = false; ctx.rexr = false; ctx.rexx = false; ctx.rexb = false
|
||||
ctx.rex = false; ctx.a32 = false
|
||||
end
|
||||
|
||||
-- Fallback for incomplete opcodes at the end.
|
||||
local function incomplete(ctx)
|
||||
ctx.pos = ctx.stop+1
|
||||
clearprefixes(ctx)
|
||||
return putop(ctx, "(incomplete)")
|
||||
end
|
||||
|
||||
-- Fallback for unknown opcodes.
|
||||
local function unknown(ctx)
|
||||
clearprefixes(ctx)
|
||||
return putop(ctx, "(unknown)")
|
||||
end
|
||||
|
||||
-- Return an immediate of the specified size.
|
||||
local function getimm(ctx, pos, n)
|
||||
if pos+n-1 > ctx.stop then return incomplete(ctx) end
|
||||
local code = ctx.code
|
||||
if n == 1 then
|
||||
local b1 = byte(code, pos, pos)
|
||||
return b1
|
||||
elseif n == 2 then
|
||||
local b1, b2 = byte(code, pos, pos+1)
|
||||
return b1+b2*256
|
||||
else
|
||||
local b1, b2, b3, b4 = byte(code, pos, pos+3)
|
||||
local imm = b1+b2*256+b3*65536+b4*16777216
|
||||
ctx.imm = imm
|
||||
return imm
|
||||
end
|
||||
end
|
||||
|
||||
-- Process pattern string and generate the operands.
|
||||
local function putpat(ctx, name, pat)
|
||||
local operands, regs, sz, mode, sp, rm, sc, rx, sdisp
|
||||
local code, pos, stop = ctx.code, ctx.pos, ctx.stop
|
||||
|
||||
-- Chars used: 1DFGIMPQRSTUVWXacdfgijmoprstuwxyz
|
||||
for p in gmatch(pat, ".") do
|
||||
local x = nil
|
||||
if p == "V" or p == "U" then
|
||||
if ctx.rexw then sz = "Q"; ctx.rexw = false
|
||||
elseif ctx.o16 then sz = "W"; ctx.o16 = false
|
||||
elseif p == "U" and ctx.x64 then sz = "Q"
|
||||
else sz = "D" end
|
||||
regs = map_regs[sz]
|
||||
elseif p == "T" then
|
||||
if ctx.rexw then sz = "Q"; ctx.rexw = false else sz = "D" end
|
||||
regs = map_regs[sz]
|
||||
elseif p == "B" then
|
||||
sz = "B"
|
||||
regs = ctx.rex and map_regs.B64 or map_regs.B
|
||||
elseif match(p, "[WDQMXFG]") then
|
||||
sz = p
|
||||
regs = map_regs[sz]
|
||||
elseif p == "P" then
|
||||
sz = ctx.o16 and "X" or "M"; ctx.o16 = false
|
||||
regs = map_regs[sz]
|
||||
elseif p == "S" then
|
||||
name = name..lower(sz)
|
||||
elseif p == "s" then
|
||||
local imm = getimm(ctx, pos, 1); if not imm then return end
|
||||
x = imm <= 127 and format("+0x%02x", imm)
|
||||
or format("-0x%02x", 256-imm)
|
||||
pos = pos+1
|
||||
elseif p == "u" then
|
||||
local imm = getimm(ctx, pos, 1); if not imm then return end
|
||||
x = format("0x%02x", imm)
|
||||
pos = pos+1
|
||||
elseif p == "w" then
|
||||
local imm = getimm(ctx, pos, 2); if not imm then return end
|
||||
x = format("0x%x", imm)
|
||||
pos = pos+2
|
||||
elseif p == "o" then -- [offset]
|
||||
if ctx.x64 then
|
||||
local imm1 = getimm(ctx, pos, 4); if not imm1 then return end
|
||||
local imm2 = getimm(ctx, pos+4, 4); if not imm2 then return end
|
||||
x = format("[0x%08x%08x]", imm2, imm1)
|
||||
pos = pos+8
|
||||
else
|
||||
local imm = getimm(ctx, pos, 4); if not imm then return end
|
||||
x = format("[0x%08x]", imm)
|
||||
pos = pos+4
|
||||
end
|
||||
elseif p == "i" or p == "I" then
|
||||
local n = map_sz2n[sz]
|
||||
if n == 8 and ctx.x64 and p == "I" then
|
||||
local imm1 = getimm(ctx, pos, 4); if not imm1 then return end
|
||||
local imm2 = getimm(ctx, pos+4, 4); if not imm2 then return end
|
||||
x = format("0x%08x%08x", imm2, imm1)
|
||||
else
|
||||
if n == 8 then n = 4 end
|
||||
local imm = getimm(ctx, pos, n); if not imm then return end
|
||||
if sz == "Q" and (imm < 0 or imm > 0x7fffffff) then
|
||||
imm = (0xffffffff+1)-imm
|
||||
x = format(imm > 65535 and "-0x%08x" or "-0x%x", imm)
|
||||
else
|
||||
x = format(imm > 65535 and "0x%08x" or "0x%x", imm)
|
||||
end
|
||||
end
|
||||
pos = pos+n
|
||||
elseif p == "j" then
|
||||
local n = map_sz2n[sz]
|
||||
if n == 8 then n = 4 end
|
||||
local imm = getimm(ctx, pos, n); if not imm then return end
|
||||
if sz == "B" and imm > 127 then imm = imm-256
|
||||
elseif imm > 2147483647 then imm = imm-4294967296 end
|
||||
pos = pos+n
|
||||
imm = imm + pos + ctx.addr
|
||||
if imm > 4294967295 and not ctx.x64 then imm = imm-4294967296 end
|
||||
ctx.imm = imm
|
||||
if sz == "W" then
|
||||
x = format("word 0x%04x", imm%65536)
|
||||
elseif ctx.x64 then
|
||||
local lo = imm % 0x1000000
|
||||
x = format("0x%02x%06x", (imm-lo) / 0x1000000, lo)
|
||||
else
|
||||
x = format("0x%08x", imm)
|
||||
end
|
||||
elseif p == "R" then
|
||||
local r = byte(code, pos-1, pos-1)%8
|
||||
if ctx.rexb then r = r + 8; ctx.rexb = false end
|
||||
x = regs[r+1]
|
||||
elseif p == "a" then x = regs[1]
|
||||
elseif p == "c" then x = "cl"
|
||||
elseif p == "d" then x = "dx"
|
||||
elseif p == "1" then x = "1"
|
||||
else
|
||||
if not mode then
|
||||
mode = ctx.mrm
|
||||
if not mode then
|
||||
if pos > stop then return incomplete(ctx) end
|
||||
mode = byte(code, pos, pos)
|
||||
pos = pos+1
|
||||
end
|
||||
rm = mode%8; mode = (mode-rm)/8
|
||||
sp = mode%8; mode = (mode-sp)/8
|
||||
sdisp = ""
|
||||
if mode < 3 then
|
||||
if rm == 4 then
|
||||
if pos > stop then return incomplete(ctx) end
|
||||
sc = byte(code, pos, pos)
|
||||
pos = pos+1
|
||||
rm = sc%8; sc = (sc-rm)/8
|
||||
rx = sc%8; sc = (sc-rx)/8
|
||||
if ctx.rexx then rx = rx + 8; ctx.rexx = false end
|
||||
if rx == 4 then rx = nil end
|
||||
end
|
||||
if mode > 0 or rm == 5 then
|
||||
local dsz = mode
|
||||
if dsz ~= 1 then dsz = 4 end
|
||||
local disp = getimm(ctx, pos, dsz); if not disp then return end
|
||||
if mode == 0 then rm = nil end
|
||||
if rm or rx or (not sc and ctx.x64 and not ctx.a32) then
|
||||
if dsz == 1 and disp > 127 then
|
||||
sdisp = format("-0x%x", 256-disp)
|
||||
elseif disp >= 0 and disp <= 0x7fffffff then
|
||||
sdisp = format("+0x%x", disp)
|
||||
else
|
||||
sdisp = format("-0x%x", (0xffffffff+1)-disp)
|
||||
end
|
||||
else
|
||||
sdisp = format(ctx.x64 and not ctx.a32 and
|
||||
not (disp >= 0 and disp <= 0x7fffffff)
|
||||
and "0xffffffff%08x" or "0x%08x", disp)
|
||||
end
|
||||
pos = pos+dsz
|
||||
end
|
||||
end
|
||||
if rm and ctx.rexb then rm = rm + 8; ctx.rexb = false end
|
||||
if ctx.rexr then sp = sp + 8; ctx.rexr = false end
|
||||
end
|
||||
if p == "m" then
|
||||
if mode == 3 then x = regs[rm+1]
|
||||
else
|
||||
local aregs = ctx.a32 and map_regs.D or ctx.aregs
|
||||
local srm, srx = "", ""
|
||||
if rm then srm = aregs[rm+1]
|
||||
elseif not sc and ctx.x64 and not ctx.a32 then srm = "rip" end
|
||||
ctx.a32 = false
|
||||
if rx then
|
||||
if rm then srm = srm.."+" end
|
||||
srx = aregs[rx+1]
|
||||
if sc > 0 then srx = srx.."*"..(2^sc) end
|
||||
end
|
||||
x = format("[%s%s%s]", srm, srx, sdisp)
|
||||
end
|
||||
if mode < 3 and
|
||||
(not match(pat, "[aRrgp]") or match(pat, "t")) then -- Yuck.
|
||||
x = map_sz2prefix[sz].." "..x
|
||||
end
|
||||
elseif p == "r" then x = regs[sp+1]
|
||||
elseif p == "g" then x = map_segregs[sp+1]
|
||||
elseif p == "p" then -- Suppress prefix.
|
||||
elseif p == "f" then x = "st"..rm
|
||||
elseif p == "x" then
|
||||
if sp == 0 and ctx.lock and not ctx.x64 then
|
||||
x = "CR8"; ctx.lock = false
|
||||
else
|
||||
x = "CR"..sp
|
||||
end
|
||||
elseif p == "y" then x = "DR"..sp
|
||||
elseif p == "z" then x = "TR"..sp
|
||||
elseif p == "t" then
|
||||
else
|
||||
error("bad pattern `"..pat.."'")
|
||||
end
|
||||
end
|
||||
if x then operands = operands and operands..", "..x or x end
|
||||
end
|
||||
ctx.pos = pos
|
||||
return putop(ctx, name, operands)
|
||||
end
|
||||
|
||||
-- Forward declaration.
|
||||
local map_act
|
||||
|
||||
-- Fetch and cache MRM byte.
|
||||
local function getmrm(ctx)
|
||||
local mrm = ctx.mrm
|
||||
if not mrm then
|
||||
local pos = ctx.pos
|
||||
if pos > ctx.stop then return nil end
|
||||
mrm = byte(ctx.code, pos, pos)
|
||||
ctx.pos = pos+1
|
||||
ctx.mrm = mrm
|
||||
end
|
||||
return mrm
|
||||
end
|
||||
|
||||
-- Dispatch to handler depending on pattern.
|
||||
local function dispatch(ctx, opat, patgrp)
|
||||
if not opat then return unknown(ctx) end
|
||||
if match(opat, "%|") then -- MMX/SSE variants depending on prefix.
|
||||
local p
|
||||
if ctx.rep then
|
||||
p = ctx.rep=="rep" and "%|([^%|]*)" or "%|[^%|]*%|[^%|]*%|([^%|]*)"
|
||||
ctx.rep = false
|
||||
elseif ctx.o16 then p = "%|[^%|]*%|([^%|]*)"; ctx.o16 = false
|
||||
else p = "^[^%|]*" end
|
||||
opat = match(opat, p)
|
||||
if not opat then return unknown(ctx) end
|
||||
-- ctx.rep = false; ctx.o16 = false
|
||||
--XXX fails for 66 f2 0f 38 f1 06 crc32 eax,WORD PTR [esi]
|
||||
--XXX remove in branches?
|
||||
end
|
||||
if match(opat, "%$") then -- reg$mem variants.
|
||||
local mrm = getmrm(ctx); if not mrm then return incomplete(ctx) end
|
||||
opat = match(opat, mrm >= 192 and "^[^%$]*" or "%$(.*)")
|
||||
if opat == "" then return unknown(ctx) end
|
||||
end
|
||||
if opat == "" then return unknown(ctx) end
|
||||
local name, pat = match(opat, "^([a-z0-9 ]*)(.*)")
|
||||
if pat == "" and patgrp then pat = patgrp end
|
||||
return map_act[sub(pat, 1, 1)](ctx, name, pat)
|
||||
end
|
||||
|
||||
-- Get a pattern from an opcode map and dispatch to handler.
|
||||
local function dispatchmap(ctx, opcmap)
|
||||
local pos = ctx.pos
|
||||
local opat = opcmap[byte(ctx.code, pos, pos)]
|
||||
pos = pos + 1
|
||||
ctx.pos = pos
|
||||
return dispatch(ctx, opat)
|
||||
end
|
||||
|
||||
-- Map for action codes. The key is the first char after the name.
|
||||
map_act = {
|
||||
-- Simple opcodes without operands.
|
||||
[""] = function(ctx, name, pat)
|
||||
return putop(ctx, name)
|
||||
end,
|
||||
|
||||
-- Operand size chars fall right through.
|
||||
B = putpat, W = putpat, D = putpat, Q = putpat,
|
||||
V = putpat, U = putpat, T = putpat,
|
||||
M = putpat, X = putpat, P = putpat,
|
||||
F = putpat, G = putpat,
|
||||
|
||||
-- Collect prefixes.
|
||||
[":"] = function(ctx, name, pat)
|
||||
ctx[pat == ":" and name or sub(pat, 2)] = name
|
||||
if ctx.pos - ctx.start > 5 then return unknown(ctx) end -- Limit #prefixes.
|
||||
end,
|
||||
|
||||
-- Chain to special handler specified by name.
|
||||
["*"] = function(ctx, name, pat)
|
||||
return map_act[name](ctx, name, sub(pat, 2))
|
||||
end,
|
||||
|
||||
-- Use named subtable for opcode group.
|
||||
["!"] = function(ctx, name, pat)
|
||||
local mrm = getmrm(ctx); if not mrm then return incomplete(ctx) end
|
||||
return dispatch(ctx, map_opcgroup[name][((mrm-(mrm%8))/8)%8+1], sub(pat, 2))
|
||||
end,
|
||||
|
||||
-- o16,o32[,o64] variants.
|
||||
sz = function(ctx, name, pat)
|
||||
if ctx.o16 then ctx.o16 = false
|
||||
else
|
||||
pat = match(pat, ",(.*)")
|
||||
if ctx.rexw then
|
||||
local p = match(pat, ",(.*)")
|
||||
if p then pat = p; ctx.rexw = false end
|
||||
end
|
||||
end
|
||||
pat = match(pat, "^[^,]*")
|
||||
return dispatch(ctx, pat)
|
||||
end,
|
||||
|
||||
-- Two-byte opcode dispatch.
|
||||
opc2 = function(ctx, name, pat)
|
||||
return dispatchmap(ctx, map_opc2)
|
||||
end,
|
||||
|
||||
-- Three-byte opcode dispatch.
|
||||
opc3 = function(ctx, name, pat)
|
||||
return dispatchmap(ctx, map_opc3[pat])
|
||||
end,
|
||||
|
||||
-- VMX/SVM dispatch.
|
||||
vm = function(ctx, name, pat)
|
||||
return dispatch(ctx, map_opcvm[ctx.mrm])
|
||||
end,
|
||||
|
||||
-- Floating point opcode dispatch.
|
||||
fp = function(ctx, name, pat)
|
||||
local mrm = getmrm(ctx); if not mrm then return incomplete(ctx) end
|
||||
local rm = mrm%8
|
||||
local idx = pat*8 + ((mrm-rm)/8)%8
|
||||
if mrm >= 192 then idx = idx + 64 end
|
||||
local opat = map_opcfp[idx]
|
||||
if type(opat) == "table" then opat = opat[rm+1] end
|
||||
return dispatch(ctx, opat)
|
||||
end,
|
||||
|
||||
-- REX prefix.
|
||||
rex = function(ctx, name, pat)
|
||||
if ctx.rex then return unknown(ctx) end -- Only 1 REX prefix allowed.
|
||||
for p in gmatch(pat, ".") do ctx["rex"..p] = true end
|
||||
ctx.rex = true
|
||||
end,
|
||||
|
||||
-- Special case for nop with REX prefix.
|
||||
nop = function(ctx, name, pat)
|
||||
return dispatch(ctx, ctx.rex and pat or "nop")
|
||||
end,
|
||||
}
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
-- Disassemble a block of code.
|
||||
local function disass_block(ctx, ofs, len)
|
||||
if not ofs then ofs = 0 end
|
||||
local stop = len and ofs+len or #ctx.code
|
||||
ofs = ofs + 1
|
||||
ctx.start = ofs
|
||||
ctx.pos = ofs
|
||||
ctx.stop = stop
|
||||
ctx.imm = nil
|
||||
ctx.mrm = false
|
||||
clearprefixes(ctx)
|
||||
while ctx.pos <= stop do dispatchmap(ctx, ctx.map1) end
|
||||
if ctx.pos ~= ctx.start then incomplete(ctx) end
|
||||
end
|
||||
|
||||
-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).
|
||||
local function create_(code, addr, out)
|
||||
local ctx = {}
|
||||
ctx.code = code
|
||||
ctx.addr = (addr or 0) - 1
|
||||
ctx.out = out or io.write
|
||||
ctx.symtab = {}
|
||||
ctx.disass = disass_block
|
||||
ctx.hexdump = 16
|
||||
ctx.x64 = false
|
||||
ctx.map1 = map_opc1_32
|
||||
ctx.aregs = map_regs.D
|
||||
return ctx
|
||||
end
|
||||
|
||||
local function create64_(code, addr, out)
|
||||
local ctx = create_(code, addr, out)
|
||||
ctx.x64 = true
|
||||
ctx.map1 = map_opc1_64
|
||||
ctx.aregs = map_regs.Q
|
||||
return ctx
|
||||
end
|
||||
|
||||
-- Simple API: disassemble code (a string) at address and output via out.
|
||||
local function disass_(code, addr, out)
|
||||
create_(code, addr, out):disass()
|
||||
end
|
||||
|
||||
local function disass64_(code, addr, out)
|
||||
create64_(code, addr, out):disass()
|
||||
end
|
||||
|
||||
-- Return register name for RID.
|
||||
local function regname_(r)
|
||||
if r < 8 then return map_regs.D[r+1] end
|
||||
return map_regs.X[r-7]
|
||||
end
|
||||
|
||||
local function regname64_(r)
|
||||
if r < 16 then return map_regs.Q[r+1] end
|
||||
return map_regs.X[r-15]
|
||||
end
|
||||
|
||||
-- Public module functions.
|
||||
module(...)
|
||||
|
||||
create = create_
|
||||
create64 = create64_
|
||||
disass = disass_
|
||||
disass64 = disass64_
|
||||
regname = regname_
|
||||
regname64 = regname64_
|
||||
|
16
source/rr/src/lunatic/doc/Makefile
Normal file
|
@ -0,0 +1,16 @@
|
|||
FILES=lunatic.html lunacon.html
|
||||
|
||||
# NOTE: the 'source-highlight-args' attribute is not present in the default
|
||||
# AsciiDoc distribution. It has to be hacked into its
|
||||
# filters/source/source-highlight-filter.conf like this:
|
||||
#
|
||||
# filter="source-highlight -f xhtml -s {language} (...)"
|
||||
# -->
|
||||
# filter="source-highlight {source-highlight-args} -f xhtml -s {language} (...)"
|
||||
%.html: %.txt Makefile lunatic_sh.style
|
||||
asciidoc -v -a latexmath -a source-highlight-args="--style-file=$(shell pwd)/lunatic_sh.style" $<
|
||||
|
||||
all: $(FILES)
|
||||
|
||||
clean:
|
||||
rm -f $(FILES)
|
BIN
source/rr/src/lunatic/doc/din_w_collapse.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
source/rr/src/lunatic/doc/din_w_crushing.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
source/rr/src/lunatic/doc/din_w_explosive.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
BIN
source/rr/src/lunatic/doc/din_w_toxic.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
14
source/rr/src/lunatic/doc/how_to_build_lunatic.txt
Normal file
|
@ -0,0 +1,14 @@
|
|||
|
||||
Lunatic depends on the following:
|
||||
|
||||
* LuaJIT 2.0.3 or later [http://luajit.org]. It is recommended to get the
|
||||
latest git HEAD of the 2.0 branch. As of time of writing, LuaJIT 2.1 is
|
||||
in alpha, and has not been successfully tested with Lunatic.
|
||||
|
||||
* LPeg 0.12 [http://www.inf.puc-rio.br/~roberto/lpeg].
|
||||
|
||||
For Windows, static libraries and headers have been provided.
|
||||
|
||||
See platform/Windows/lib/instructions.txt for information on building.
|
||||
|
||||
Build EDuke32 with the GNU Make invocation "make LUNATIC=1".
|
73
source/rr/src/lunatic/doc/lpeg-lunatic.patch
Normal file
|
@ -0,0 +1,73 @@
|
|||
diff --git a/lpcap.h b/lpcap.h
|
||||
index c0a0e38..1bfc109 100644
|
||||
--- a/lpcap.h
|
||||
+++ b/lpcap.h
|
||||
@@ -18,7 +18,7 @@ typedef enum CapKind {
|
||||
|
||||
typedef struct Capture {
|
||||
const char *s; /* subject position */
|
||||
- short idx; /* extra info about capture (group name, arg index, etc.) */
|
||||
+ int idx; /* extra info about capture (group name, arg index, etc.) */
|
||||
byte kind; /* kind of capture */
|
||||
byte siz; /* size of full capture + 1 (0 = not a full capture) */
|
||||
} Capture;
|
||||
diff --git a/makefile b/makefile
|
||||
index 57a18fb..88e8a60 100644
|
||||
--- a/makefile
|
||||
+++ b/makefile
|
||||
@@ -1,5 +1,8 @@
|
||||
LIBNAME = lpeg
|
||||
-LUADIR = ../lua/
|
||||
+# Linux example:
|
||||
+LUADIR = /usr/local/include/luajit-2.0
|
||||
+# Windows example (from MSYS bash):
|
||||
+#LUADIR = /f/g/mod/luajit-2.0/src
|
||||
|
||||
COPT = -O2
|
||||
# COPT = -DLPEG_DEBUG -g
|
||||
@@ -19,10 +22,21 @@ CWARNS = -Wall -Wextra -pedantic \
|
||||
-Wmissing-prototypes \
|
||||
-Wnested-externs \
|
||||
-Wstrict-prototypes \
|
||||
+ -Werror-implicit-function-declaration \
|
||||
# -Wunreachable-code \
|
||||
|
||||
+# Example:
|
||||
+# --------
|
||||
+# 1. Build shared lib (for LunaCON standalone)
|
||||
+# $ make linux
|
||||
+# 2. Remove shared-lib *.o
|
||||
+# $ rm *.o
|
||||
+# 3. Build static lib (for EDuke32/Lunatic)
|
||||
+# $ PIC='' make liblpeg.a
|
||||
|
||||
-CFLAGS = $(CWARNS) $(COPT) -std=c99 -I$(LUADIR) -fPIC
|
||||
+PIC ?= -fPIC
|
||||
+
|
||||
+CFLAGS = $(CWARNS) $(COPT) -std=c99 -I$(LUADIR) $(PIC)
|
||||
CC = gcc
|
||||
|
||||
FILES = lpvm.o lpcap.o lptree.o lpcode.o lpprint.o
|
||||
@@ -38,13 +52,16 @@ macosx:
|
||||
lpeg.so: $(FILES)
|
||||
env $(CC) $(DLLFLAGS) $(FILES) -o lpeg.so
|
||||
|
||||
+liblpeg.a: $(FILES)
|
||||
+ $(AR) rc $@ $^
|
||||
+
|
||||
$(FILES): makefile
|
||||
|
||||
test: test.lua re.lua lpeg.so
|
||||
./test.lua
|
||||
|
||||
clean:
|
||||
- rm -f $(FILES) lpeg.so
|
||||
+ rm -f $(FILES) lpeg.so liblpeg.a
|
||||
|
||||
|
||||
lpcap.o: lpcap.c lpcap.h lptypes.h
|
||||
@@ -52,4 +69,3 @@ lpcode.o: lpcode.c lptypes.h lpcode.h lptree.h lpvm.h lpcap.h
|
||||
lpprint.o: lpprint.c lptypes.h lpprint.h lptree.h lpvm.h lpcap.h
|
||||
lptree.o: lptree.c lptypes.h lpcap.h lpcode.h lptree.h lpvm.h lpprint.h
|
||||
lpvm.o: lpvm.c lpcap.h lptypes.h lpvm.h lpprint.h lptree.h
|
||||
-
|
366
source/rr/src/lunatic/doc/lunacon.txt
Normal file
|
@ -0,0 +1,366 @@
|
|||
LunaCON User Manual -- The ``Lunatic Translator''
|
||||
=================================================
|
||||
Helixhorned <contact: Duke4.net forums>
|
||||
:max-width: 56em
|
||||
:numbered:
|
||||
:icons:
|
||||
:toc:
|
||||
:conf-files: lunatic.conf
|
||||
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
The Lunatic build of EDuke32 completely reimplements the CON scripting language
|
||||
using the framework provided by its Lua interface. It does so by generating at
|
||||
start-up time one Lunatic module from all specified CON files and
|
||||
mutators.footnote:[In CON, the *`include`* directive amounts to merely textual
|
||||
inclusion, as is mutator appending with the `-mx` switch. All CON code is
|
||||
translated in one global context sharing the same namespace.]
|
||||
|
||||
LunaCON implements nearly all of modern EDuke32 CON. One of its main aims is
|
||||
correctness in a broad sense, which encompasses multiple issues.
|
||||
|
||||
* LunaCON more strictly validates the CON source at translation time. For
|
||||
example, using labels of mismatched type, such as a ++define++d number where
|
||||
a `move` is expected, issues an translation error.
|
||||
|
||||
* Lexically and syntactically, LunaCON accepts only a subset of what the C-CON
|
||||
translator would pass through. This includes rejecting clearly erroneous code
|
||||
such as an unfinished directive at the end of a translation unit, but also
|
||||
code that implies ambiguities in the language.
|
||||
|
||||
* On the run-time side, most checking is done by Lunatic. For example, indexing
|
||||
actor gamevars with out-of-bounds values produces an error that gets
|
||||
permanently displayed on the screen. Like with Lua code, the
|
||||
link:lunatic.html#error[error] entry in the log then contains a traceback
|
||||
annotated with line numbers, making it possible for the CON coder to pinpoint
|
||||
its location and context.
|
||||
|
||||
For these reasons, many existing CON mods and TCs are expected to need
|
||||
amendments in order to translate and/or run properly. This is generally a
|
||||
desired thing, since otherwise (most of the time, unintentional) misuse of the
|
||||
CON system may produce behavior that is either erratic, or appears to work on
|
||||
the surface but is hiding potential issues.
|
||||
|
||||
.A warning
|
||||
The code generated by LunaCON is unsuitable for human consumption --
|
||||
specifically, it should not be used as a base for new Lunatic code. Even though
|
||||
that code runs in Lunatic's protected user environment, it uses private
|
||||
interfaces that are subject to change in addition to the officially exposed and
|
||||
documented ones.
|
||||
|
||||
Nevertheless, LunaCON is also available as a stand-alone Lua script. Primarily,
|
||||
this allows it to be used as a checking tool during CON development without the
|
||||
need to start EDuke32. Also, multiple CON codebases can be checked in a batch
|
||||
fashion for non-runtime problems.
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
:LuaJIT: http://luajit.org
|
||||
:LPeg: http://www.inf.puc-rio.br/~roberto/lpeg/
|
||||
|
||||
The stand-alone LunaCON script, `lunacon.lua`, needs {LuaJIT}[LuaJIT] for
|
||||
execution and {LPeg}[LPeg] as additional dependency.footnote:[In order to
|
||||
translate some very large CON files, minor modifications have to be made to
|
||||
LuaJIT and LPeg. Refer to `lunatic/doc/how_to_build_lunatic.txt` in the EDuke32
|
||||
source distribution for details.] The script also requires `con_lang.lua` to be
|
||||
present. It expects one or more names of root CON files together with any
|
||||
number of options, in any order (arguments starting with a dash are always
|
||||
interpreted as the latter).
|
||||
|
||||
.Example usage
|
||||
----------
|
||||
luajit ./lunacon.lua -Wall mymod.con
|
||||
----------
|
||||
|
||||
All arguments after a single `@` argument are taken to name _file lists_.
|
||||
These are files containing lines either
|
||||
|
||||
* a file name of a root CON file which gets processed, or
|
||||
* a completely blank line or a line starting with `#`, both of which are ignored.
|
||||
|
||||
|
||||
Options
|
||||
-------
|
||||
|
||||
Most options documented in the following can also be passed to the Lunatic
|
||||
build of EDuke32. Options on the command line are processed in their given
|
||||
order, from left to right. Many of them can be negated by appeding `no-` after
|
||||
the ``option category letter'', for example `-Wno-not-redefined`. This index
|
||||
only lists the positive forms of each non-compound option and labels whether it
|
||||
is enabled or disabled by default.
|
||||
|
||||
General options
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
++-I__directory__++ (stand-alone only)::
|
||||
Specifies a _default directory_ to search for CON files as a last resort. This
|
||||
can be useful if mods expect part of their included files to reside inside GRP
|
||||
or ZIP containers, which the stand-alone translator cannot examine. This option
|
||||
can only be passed once.
|
||||
|
||||
Warning options
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
These options affect on which occasions warnings, or in some cases, errors
|
||||
instead of warnings, are produced at translation time.
|
||||
|
||||
`-Wall`::
|
||||
Enables all warning and errors described in this subsection.
|
||||
|
||||
`-Wbad-identifier` (default: off)::
|
||||
Warns whenever an identifier does not match `[A-Za-z_][A-Za-z0-9_]*`. In words,
|
||||
a ``good'' identifier is expected to start with a letter or an underscore,
|
||||
followed by zero or more letters, underscores, or digits.
|
||||
|
||||
`-Wchained-loadactor` (default: on)::
|
||||
Warns whenever an `eventloadactor` block appears multiple times for the same
|
||||
tile number. In LunaCON, these are translated to an `EVENT_LOADACTOR` block
|
||||
that checks the tile number of its current actor. This event gets chained to
|
||||
the end of all preceding `EVENT_LOADACTOR` definitions, whereas with C-CON, a
|
||||
new `eventloadactor` block for the same tile number would override the existing
|
||||
one.
|
||||
|
||||
`-Werror-bad-getactorvar` (default: off)::
|
||||
When enabled, produces an error whenever a global or per-player gamevar is
|
||||
attempted to be read using ++getactorvar++. Otherwise, a warning is emitted. In
|
||||
this case, the generated code is either a read of the (global) gamevar, or an
|
||||
access of the per-player gamevar with the given index or the current player
|
||||
index (depending on `-fbad-getactorvar-use-pli`), which is probably not what
|
||||
the coder intended.
|
||||
|
||||
`-Wnot-redefined` (default: on)::
|
||||
Warns whenever a `define` directive was ignored because it attempted to
|
||||
redefine an already existing label to a different number. The label can exist
|
||||
either due to a previous `define`, or because it is a predefined label such as
|
||||
`NO`.
|
||||
|
||||
`-Wnumber-conversion` (default: on)::
|
||||
Warns whenever a literal decimal number is encountered that is out of the range
|
||||
for a 32-bit integer, but inside that of an unsigned 32-bit integer. In this
|
||||
case, 2^32^ is subtracted from the number, producing a negative value without
|
||||
changing the bit representation.
|
||||
|
||||
`-Wnever-used-gamevar` (default: off)::
|
||||
After translation, issues a warning for every CON-side user gamevar definition
|
||||
that was never referenced, that is, neither read nor written in the CON code.
|
||||
|
||||
`-Wnever-read-gamevar` (default: off)::
|
||||
After translation, issues a warning for every CON-side user gamevar definition
|
||||
that was assigned to but never read in the CON code.
|
||||
|
||||
`-Wsystem-gamevar` (default: on)::
|
||||
Warns whenever the initial value of a system gamevar was overridden (by issuing
|
||||
`gamevar` at file scope), but the provided gamevar flags did not match those of
|
||||
the kept predefined ones.
|
||||
|
||||
Code generation options
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
These options change the way certain CON code constructs are translated to Lua,
|
||||
set the output behavior of the stand-alone translator, or toggle various error
|
||||
conditions.
|
||||
|
||||
`-fno` (stand-alone only)::
|
||||
Disable printing out the generated code and validating its syntax.
|
||||
|
||||
`-fno=onlycheck` (stand-alone only)::
|
||||
Disable printing out the generated code, but validate whether it is
|
||||
syntactically legal Lua code. A failure of this check represents a bug with
|
||||
LunaCON itself.
|
||||
|
||||
`-fnames` (stand-alone only)::
|
||||
Instead of generating Lua code, output all ++define++d names that were ever
|
||||
passed as tile number to `actor`, `useractor` or `eventloadactor` in a form
|
||||
suitable for the `names.h` file read by Mapster32.
|
||||
|
||||
`-ferror-nostate` (default: on)::
|
||||
If enabled, an attempt to call a `state` that was not previously defined
|
||||
results in an error. Otherwise, a warning is issued and no code is generated
|
||||
for the `state` invocation.
|
||||
|
||||
`-ferror-nonlocal-userdef` (default: on)::
|
||||
If enabled, an attept to issue `getuserdef` or `setuserdef` when the current
|
||||
player doesn't equal the local player generates an error. Otherwise, the
|
||||
userdef structure can be accessed irrespective of the current player.
|
||||
|
||||
`-ferror-negative-tag-write` (default: off)::
|
||||
If enabled, an attempt to assign a negative value to the `lotag` or `hitag`
|
||||
member of the sector, wall or (t)sprite structures produces an error.
|
||||
Normally, it is legal to assign negative values to these members, but since
|
||||
they are unsigned 16-bit integers on the C side, such values will be converted
|
||||
to positive ones and may entail undesired behavior.
|
||||
+
|
||||
NOTE: From CON as well as Lunatic, `hitag` and `lotag` are seen as *signed*
|
||||
16-bit integers.
|
||||
|
||||
`-fbad-getactorvar-use-pli` (default: on)::
|
||||
If enabled and `-Werror-bad-getactorvar` is off, a `getactorvar` of a
|
||||
per-player variable will result the gamevar being indexed with the current
|
||||
player instead of the provided index. This is the (probably unintended)
|
||||
behavior of C-CON.
|
||||
|
||||
`-fplayervar` (default: on)::
|
||||
If enabled, per-player `gamevar` definitions really generate `con.playervar`
|
||||
initializations in the translated Lua code. Otherwise, per-player gamevars are
|
||||
treated as global gamevars, which can be useful for code that attempts to
|
||||
access them in contexts with no current player, yielding errors in Lunatic.
|
||||
|
||||
`-ftrapv` (default: off)::
|
||||
Enable _trapping_ behavior for arithmetic operations whose result overflows the
|
||||
range of a signed 32-bit integer, i.e. generate an error on overflow. By
|
||||
default, overflow results in undefined behavior. Currently, only multiplication
|
||||
is handled.
|
||||
|
||||
`-fwrapv` (default: off)::
|
||||
Enable _wrapping_ behavior for arithmetic operations whose result overflows the
|
||||
range of a signed 32-bit integer, i.e. after each operation, only the 32 lower
|
||||
bits of the result are kept. Currently, only multiplication is handled. Only
|
||||
one of `-ftrapv` or `-fwrapv` may be enabled at the same time.
|
||||
|
||||
|
||||
Differences from C-CON
|
||||
----------------------
|
||||
|
||||
Despite the aim to provide as much compatibility to CON as possible where
|
||||
reasonable, a couple of its ``features'' -- some of which are coincidental --
|
||||
cannot be implemented without unnaturally bending the implementation into
|
||||
shape. On the other hand, LunaCON sports some features that C-CON lacks, and
|
||||
does not exhibit some of its strange quirks or outright bugs.
|
||||
|
||||
|
||||
Syntactic and lexical changes
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The two command classes
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
LunaCON makes a clear distinction between ``outer'' commands that have an
|
||||
effect when translating a CON file (_directives_ such as `gamevar`,
|
||||
`definesound` or `spritenvg`) and ``inner'' commands meant to be effective at
|
||||
execution time of `actor`/`useractor`, `state`, `event` and `eventloadactor`
|
||||
blocks. Thus, issuing directives inside of these will make LunaCON reject the
|
||||
input file due to a syntax error, as will an attempt to use run-time commands
|
||||
such as `sizeat` at file scope.
|
||||
|
||||
This strict behavior is one hand a consequence of how the LunaCON parser is
|
||||
structured, but on the other hand it may expose code for which the author
|
||||
misunderstood its meaning. An example for the first case would be a `gamevar`
|
||||
inside a block, which one mistakenly could take to have local scope. Gamevars
|
||||
in CON always have both global scope and lifetime though, so such a mental
|
||||
model on the coder's part may lead to unexpected bugs. In the second case,
|
||||
run-time commands at file scope are really translated to bytecode by C-CON, but
|
||||
as they reside outside of any block, they are never reached -- in other words,
|
||||
they are dead code.
|
||||
|
||||
Currently, the only exception to this rule is that a `definequote` is allowed
|
||||
inside delimited blocks, which however does not change its semantics in any
|
||||
way: it still only defines the initial contents of a quote, and does not
|
||||
magically act like `redefinequote`.
|
||||
|
||||
Ambiguous lexical elements
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
LunaCON is fairly relaxed as to which character sequences constitute valid
|
||||
identifier names used for e.g. ++define++d labels or variables. It does so out
|
||||
of the necessity of supporting CON code found ``in the wild''. An identifier
|
||||
|
||||
* must not be a token denoting a number,
|
||||
* must start with an _allowed first character_,
|
||||
* may contain any number of _allowed following characters_,
|
||||
|
||||
where
|
||||
|
||||
* allowed first characters are: letters, digits, and those in ```_*?`''
|
||||
* allowed following characters are the same as allowed first characters, plus
|
||||
``+++++'', ``++-++'' and ``++.++''.
|
||||
|
||||
// ^ `+` and `-`
|
||||
|
||||
Numbers can be written in either decimal or hexadecimal form, optionally
|
||||
prepended by a ``++-++'' sign. In the decimal case, the modulus of the number
|
||||
can be (lexically) any sequence of decimal digits, though there are
|
||||
restrictions on the permitted values.footnote:[Specifically, it is forbidden to
|
||||
write a number whose value falls outside the range [--2^31^-1 .. 2^32^--1\].]
|
||||
Hexadecimal number literals must be prefixed with `0x` or `0X`, and may
|
||||
optionally be suffixed with an `h`.
|
||||
|
||||
The following constructions are not allowed, as they would create ambiguities
|
||||
with the definitions above:
|
||||
|
||||
* A sequence of digits followed by letters to mean the the digits interpreted
|
||||
as a number, ignoring the trailing letters, e.g. `1267AT`.
|
||||
* A hexadecimal constant denoted using only a trailing `h`, for example
|
||||
`00000000h`.
|
||||
|
||||
Miscellaneous
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
* Read array expressions as well as `switch` statements can be arbitrarily
|
||||
nested.
|
||||
|
||||
// XXX: 'Read' is confusing. Need better wording.
|
||||
|
||||
|
||||
Run-time changes
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
Behavior on error
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
As LunaCON is implemented by translating all given CON code to a Lunatic
|
||||
module, it is the Lunatic runtime that checks for proper use of its services at
|
||||
execution time and takes care of error handling and reporting. In Lua, an error
|
||||
link:lunatic.html#nlcf[transfers control] to the end of the innermost
|
||||
``protected'' call of a Lua chunk.
|
||||
|
||||
This is in contrast to C-CON, which for some errors would print a message to
|
||||
the log, but otherwise would continue execution as if nothing had happened. In
|
||||
LunaCON, the code following an error is *not* executed. This way, the author of
|
||||
the CON code is notified of the presence of the bug, and by fixing it
|
||||
eventually obtains cleaner code.
|
||||
|
||||
Quote behavior
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
* The `redefinequote` command can be issued even if the given quote number has
|
||||
not been previously allocated using the `definequote` directive. This makes
|
||||
it possible to use a range of quote numbers on the fly without the need to
|
||||
declare their future use.
|
||||
|
||||
Miscellaneous
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
:r5097: http://svn.eduke32.com/listing.php?repname=eduke32&rev=5097
|
||||
|
||||
* Issuing `break` inside a part of an event chain (defined using multiple
|
||||
`onevent` blocks for one event kind) does not abort the whole chain. (Since
|
||||
EDuke32 {r5097}[r5097], this is the behavior of C-CON as well.)
|
||||
|
||||
|
||||
Unavailable functionality
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
C-CON's `jump` and `getcurraddress` are not available and will not be
|
||||
implemented.
|
||||
|
||||
The following commands are not yet implemented. Those highlighted in bold give
|
||||
errors, while the others merely warn either at translation or execution
|
||||
time.
|
||||
|
||||
Directives
|
||||
^^^^^^^^^^
|
||||
*`includedefault`*, `definecheat`, `setcfgname`, `setgamename`
|
||||
|
||||
Run-time commands
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
*`activatecheat`*, *`clearmapstate`*, *`startcutscene`*, *`ifcutscene`*, `save`,
|
||||
`savenn`, *`lineintersect`*, *`rayintersect`*, *`sectorofwall`*.
|
||||
|
||||
Additionally, various multiplayer-related commands either unconditionally
|
||||
return results as if no multiplayer game is in progress, or are non-functional
|
||||
for more than the first player. Also, some MP-related variables are merely
|
||||
predefined constants.
|
3
source/rr/src/lunatic/doc/lunatic.conf
Normal file
|
@ -0,0 +1,3 @@
|
|||
[replacements]
|
||||
# Make -- an en dash for good looking minus signs.
|
||||
--=–
|
2716
source/rr/src/lunatic/doc/lunatic.txt
Normal file
10
source/rr/src/lunatic/doc/lunatic_sh.style
Normal file
|
@ -0,0 +1,10 @@
|
|||
// Custom style file for GNU Source-highlight, derived from its default.style
|
||||
|
||||
bgcolor "white"; // the background color for documents
|
||||
context gray; // the color for context lines (when specified with line ranges)
|
||||
|
||||
keyword darkblue b; // for language keywords
|
||||
string "#116611" f; // for strings and chars
|
||||
specialchar pink f; // for special chars, e.g., \n, \t, \\
|
||||
comment "#444444" i, noref; // for comments
|
||||
cbracket red; // for block brackets (e.g. {, })
|
699
source/rr/src/lunatic/dump.lua
Normal file
|
@ -0,0 +1,699 @@
|
|||
----------------------------------------------------------------------------
|
||||
-- LuaJIT compiler dump module.
|
||||
--
|
||||
-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
-- Released under the MIT license. See Copyright Notice in luajit.h
|
||||
----------------------------------------------------------------------------
|
||||
--
|
||||
-- This module can be used to debug the JIT compiler itself. It dumps the
|
||||
-- code representations and structures used in various compiler stages.
|
||||
--
|
||||
-- Example usage:
|
||||
--
|
||||
-- luajit -jdump -e "local x=0; for i=1,1e6 do x=x+i end; print(x)"
|
||||
-- luajit -jdump=im -e "for i=1,1000 do for j=1,1000 do end end" | less -R
|
||||
-- luajit -jdump=is myapp.lua | less -R
|
||||
-- luajit -jdump=-b myapp.lua
|
||||
-- luajit -jdump=+aH,myapp.html myapp.lua
|
||||
-- luajit -jdump=ixT,myapp.dump myapp.lua
|
||||
--
|
||||
-- The first argument specifies the dump mode. The second argument gives
|
||||
-- the output file name. Default output is to stdout, unless the environment
|
||||
-- variable LUAJIT_DUMPFILE is set. The file is overwritten every time the
|
||||
-- module is started.
|
||||
--
|
||||
-- Different features can be turned on or off with the dump mode. If the
|
||||
-- mode starts with a '+', the following features are added to the default
|
||||
-- set of features; a '-' removes them. Otherwise the features are replaced.
|
||||
--
|
||||
-- The following dump features are available (* marks the default):
|
||||
--
|
||||
-- * t Print a line for each started, ended or aborted trace (see also -jv).
|
||||
-- * b Dump the traced bytecode.
|
||||
-- * i Dump the IR (intermediate representation).
|
||||
-- r Augment the IR with register/stack slots.
|
||||
-- s Dump the snapshot map.
|
||||
-- * m Dump the generated machine code.
|
||||
-- x Print each taken trace exit.
|
||||
-- X Print each taken trace exit and the contents of all registers.
|
||||
-- a Print the IR of aborted traces, too.
|
||||
--
|
||||
-- The output format can be set with the following characters:
|
||||
--
|
||||
-- T Plain text output.
|
||||
-- A ANSI-colored text output
|
||||
-- H Colorized HTML + CSS output.
|
||||
--
|
||||
-- The default output format is plain text. It's set to ANSI-colored text
|
||||
-- if the COLORTERM variable is set. Note: this is independent of any output
|
||||
-- redirection, which is actually considered a feature.
|
||||
--
|
||||
-- You probably want to use less -R to enjoy viewing ANSI-colored text from
|
||||
-- a pipe or a file. Add this to your ~/.bashrc: export LESS="-R"
|
||||
--
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
-- Cache some library functions and objects.
|
||||
local jit = require("jit")
|
||||
assert(jit.version_num == 20003, "LuaJIT core/library version mismatch")
|
||||
local jutil = require("jit.util")
|
||||
local vmdef = require("jit.vmdef")
|
||||
local funcinfo, funcbc = jutil.funcinfo, jutil.funcbc
|
||||
local traceinfo, traceir, tracek = jutil.traceinfo, jutil.traceir, jutil.tracek
|
||||
local tracemc, tracesnap = jutil.tracemc, jutil.tracesnap
|
||||
local traceexitstub, ircalladdr = jutil.traceexitstub, jutil.ircalladdr
|
||||
local bit = require("bit")
|
||||
local band, shl, shr = bit.band, bit.lshift, bit.rshift
|
||||
local sub, gsub, format = string.sub, string.gsub, string.format
|
||||
local byte, char, rep = string.byte, string.char, string.rep
|
||||
local type, tostring = type, tostring
|
||||
local stdout, stderr = io.stdout, io.stderr
|
||||
|
||||
-- Load other modules on-demand.
|
||||
local bcline, disass
|
||||
|
||||
-- Active flag, output file handle and dump mode.
|
||||
local active, out, dumpmode
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
local symtabmt = { __index = false }
|
||||
local symtab = {}
|
||||
local nexitsym = 0
|
||||
|
||||
-- Fill nested symbol table with per-trace exit stub addresses.
|
||||
local function fillsymtab_tr(tr, nexit)
|
||||
local t = {}
|
||||
symtabmt.__index = t
|
||||
if jit.arch == "mips" or jit.arch == "mipsel" then
|
||||
t[traceexitstub(tr, 0)] = "exit"
|
||||
return
|
||||
end
|
||||
for i=0,nexit-1 do
|
||||
local addr = traceexitstub(tr, i)
|
||||
t[addr] = tostring(i)
|
||||
end
|
||||
local addr = traceexitstub(tr, nexit)
|
||||
if addr then t[addr] = "stack_check" end
|
||||
end
|
||||
|
||||
-- Fill symbol table with trace exit stub addresses.
|
||||
local function fillsymtab(tr, nexit)
|
||||
local t = symtab
|
||||
if nexitsym == 0 then
|
||||
local ircall = vmdef.ircall
|
||||
for i=0,#ircall do
|
||||
local addr = ircalladdr(i)
|
||||
if addr ~= 0 then t[addr] = ircall[i] end
|
||||
end
|
||||
end
|
||||
if nexitsym == 1000000 then -- Per-trace exit stubs.
|
||||
fillsymtab_tr(tr, nexit)
|
||||
elseif nexit > nexitsym then -- Shared exit stubs.
|
||||
for i=nexitsym,nexit-1 do
|
||||
local addr = traceexitstub(i)
|
||||
if addr == nil then -- Fall back to per-trace exit stubs.
|
||||
fillsymtab_tr(tr, nexit)
|
||||
setmetatable(symtab, symtabmt)
|
||||
nexit = 1000000
|
||||
break
|
||||
end
|
||||
t[addr] = tostring(i)
|
||||
end
|
||||
nexitsym = nexit
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
||||
local function dumpwrite(s)
|
||||
out:write(s)
|
||||
end
|
||||
|
||||
-- Disassemble machine code.
|
||||
local function dump_mcode(tr)
|
||||
local info = traceinfo(tr)
|
||||
if not info then return end
|
||||
local mcode, addr, loop = tracemc(tr)
|
||||
if not mcode then return end
|
||||
if not disass then disass = require("jit.dis_"..jit.arch) end
|
||||
out:write("---- TRACE ", tr, " mcode ", #mcode, "\n")
|
||||
local ctx = disass.create(mcode, addr, dumpwrite)
|
||||
ctx.hexdump = 0
|
||||
ctx.symtab = fillsymtab(tr, info.nexit)
|
||||
if loop ~= 0 then
|
||||
symtab[addr+loop] = "LOOP"
|
||||
ctx:disass(0, loop)
|
||||
out:write("->LOOP:\n")
|
||||
ctx:disass(loop, #mcode-loop)
|
||||
symtab[addr+loop] = nil
|
||||
else
|
||||
ctx:disass(0, #mcode)
|
||||
end
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
local irtype_text = {
|
||||
[0] = "nil",
|
||||
"fal",
|
||||
"tru",
|
||||
"lud",
|
||||
"str",
|
||||
"p32",
|
||||
"thr",
|
||||
"pro",
|
||||
"fun",
|
||||
"p64",
|
||||
"cdt",
|
||||
"tab",
|
||||
"udt",
|
||||
"flt",
|
||||
"num",
|
||||
"i8 ",
|
||||
"u8 ",
|
||||
"i16",
|
||||
"u16",
|
||||
"int",
|
||||
"u32",
|
||||
"i64",
|
||||
"u64",
|
||||
"sfp",
|
||||
}
|
||||
|
||||
local colortype_ansi = {
|
||||
[0] = "%s",
|
||||
"%s",
|
||||
"%s",
|
||||
"\027[36m%s\027[m",
|
||||
"\027[32m%s\027[m",
|
||||
"%s",
|
||||
"\027[1m%s\027[m",
|
||||
"%s",
|
||||
"\027[1m%s\027[m",
|
||||
"%s",
|
||||
"\027[33m%s\027[m",
|
||||
"\027[31m%s\027[m",
|
||||
"\027[36m%s\027[m",
|
||||
"\027[34m%s\027[m",
|
||||
"\027[34m%s\027[m",
|
||||
"\027[35m%s\027[m",
|
||||
"\027[35m%s\027[m",
|
||||
"\027[35m%s\027[m",
|
||||
"\027[35m%s\027[m",
|
||||
"\027[35m%s\027[m",
|
||||
"\027[35m%s\027[m",
|
||||
"\027[35m%s\027[m",
|
||||
"\027[35m%s\027[m",
|
||||
"\027[35m%s\027[m",
|
||||
}
|
||||
|
||||
local function colorize_text(s, t)
|
||||
return s
|
||||
end
|
||||
|
||||
local function colorize_ansi(s, t)
|
||||
return format(colortype_ansi[t], s)
|
||||
end
|
||||
|
||||
local irtype_ansi = setmetatable({},
|
||||
{ __index = function(tab, t)
|
||||
local s = colorize_ansi(irtype_text[t], t); tab[t] = s; return s; end })
|
||||
|
||||
local html_escape = { ["<"] = "<", [">"] = ">", ["&"] = "&", }
|
||||
|
||||
local function colorize_html(s, t)
|
||||
s = gsub(s, "[<>&]", html_escape)
|
||||
return format('<span class="irt_%s">%s</span>', irtype_text[t], s)
|
||||
end
|
||||
|
||||
local irtype_html = setmetatable({},
|
||||
{ __index = function(tab, t)
|
||||
local s = colorize_html(irtype_text[t], t); tab[t] = s; return s; end })
|
||||
|
||||
local header_html = [[
|
||||
<style type="text/css">
|
||||
background { background: #ffffff; color: #000000; }
|
||||
pre.ljdump {
|
||||
font-size: 10pt;
|
||||
background: #f0f4ff;
|
||||
color: #000000;
|
||||
border: 1px solid #bfcfff;
|
||||
padding: 0.5em;
|
||||
margin-left: 2em;
|
||||
margin-right: 2em;
|
||||
}
|
||||
span.irt_str { color: #00a000; }
|
||||
span.irt_thr, span.irt_fun { color: #404040; font-weight: bold; }
|
||||
span.irt_tab { color: #c00000; }
|
||||
span.irt_udt, span.irt_lud { color: #00c0c0; }
|
||||
span.irt_num { color: #4040c0; }
|
||||
span.irt_int, span.irt_i8, span.irt_u8, span.irt_i16, span.irt_u16 { color: #b040b0; }
|
||||
</style>
|
||||
]]
|
||||
|
||||
local colorize, irtype
|
||||
|
||||
-- Lookup tables to convert some literals into names.
|
||||
local litname = {
|
||||
["SLOAD "] = setmetatable({}, { __index = function(t, mode)
|
||||
local s = ""
|
||||
if band(mode, 1) ~= 0 then s = s.."P" end
|
||||
if band(mode, 2) ~= 0 then s = s.."F" end
|
||||
if band(mode, 4) ~= 0 then s = s.."T" end
|
||||
if band(mode, 8) ~= 0 then s = s.."C" end
|
||||
if band(mode, 16) ~= 0 then s = s.."R" end
|
||||
if band(mode, 32) ~= 0 then s = s.."I" end
|
||||
t[mode] = s
|
||||
return s
|
||||
end}),
|
||||
["XLOAD "] = { [0] = "", "R", "V", "RV", "U", "RU", "VU", "RVU", },
|
||||
["CONV "] = setmetatable({}, { __index = function(t, mode)
|
||||
local s = irtype[band(mode, 31)]
|
||||
s = irtype[band(shr(mode, 5), 31)].."."..s
|
||||
if band(mode, 0x400) ~= 0 then s = s.." trunc"
|
||||
elseif band(mode, 0x800) ~= 0 then s = s.." sext" end
|
||||
local c = shr(mode, 14)
|
||||
if c == 2 then s = s.." index" elseif c == 3 then s = s.." check" end
|
||||
t[mode] = s
|
||||
return s
|
||||
end}),
|
||||
["FLOAD "] = vmdef.irfield,
|
||||
["FREF "] = vmdef.irfield,
|
||||
["FPMATH"] = vmdef.irfpm,
|
||||
}
|
||||
|
||||
local function ctlsub(c)
|
||||
if c == "\n" then return "\\n"
|
||||
elseif c == "\r" then return "\\r"
|
||||
elseif c == "\t" then return "\\t"
|
||||
else return format("\\%03d", byte(c))
|
||||
end
|
||||
end
|
||||
|
||||
local function fmtfunc(func, pc)
|
||||
local fi = funcinfo(func, pc)
|
||||
if fi.loc then
|
||||
return fi.loc
|
||||
elseif fi.ffid then
|
||||
return vmdef.ffnames[fi.ffid]
|
||||
elseif fi.addr then
|
||||
return format("C:%x", fi.addr)
|
||||
else
|
||||
return "(?)"
|
||||
end
|
||||
end
|
||||
|
||||
local function formatk(tr, idx)
|
||||
local k, t, slot = tracek(tr, idx)
|
||||
local tn = type(k)
|
||||
local s
|
||||
if tn == "number" then
|
||||
if k == 2^52+2^51 then
|
||||
s = "bias"
|
||||
else
|
||||
s = format("%+.14g", k)
|
||||
end
|
||||
elseif tn == "string" then
|
||||
s = format(#k > 20 and '"%.20s"~' or '"%s"', gsub(k, "%c", ctlsub))
|
||||
elseif tn == "function" then
|
||||
s = fmtfunc(k)
|
||||
elseif tn == "table" then
|
||||
s = format("{%p}", k)
|
||||
elseif tn == "userdata" then
|
||||
if t == 12 then
|
||||
s = format("userdata:%p", k)
|
||||
else
|
||||
s = format("[%p]", k)
|
||||
if s == "[0x00000000]" then s = "NULL" end
|
||||
end
|
||||
elseif t == 21 then -- int64_t
|
||||
s = sub(tostring(k), 1, -3)
|
||||
if sub(s, 1, 1) ~= "-" then s = "+"..s end
|
||||
else
|
||||
s = tostring(k) -- For primitives.
|
||||
end
|
||||
s = colorize(format("%-4s", s), t)
|
||||
if slot then
|
||||
s = format("%s @%d", s, slot)
|
||||
end
|
||||
return s
|
||||
end
|
||||
|
||||
local function printsnap(tr, snap)
|
||||
local n = 2
|
||||
for s=0,snap[1]-1 do
|
||||
local sn = snap[n]
|
||||
if shr(sn, 24) == s then
|
||||
n = n + 1
|
||||
local ref = band(sn, 0xffff) - 0x8000 -- REF_BIAS
|
||||
if ref < 0 then
|
||||
out:write(formatk(tr, ref))
|
||||
elseif band(sn, 0x80000) ~= 0 then -- SNAP_SOFTFPNUM
|
||||
out:write(colorize(format("%04d/%04d", ref, ref+1), 14))
|
||||
else
|
||||
local m, ot, op1, op2 = traceir(tr, ref)
|
||||
out:write(colorize(format("%04d", ref), band(ot, 31)))
|
||||
end
|
||||
out:write(band(sn, 0x10000) == 0 and " " or "|") -- SNAP_FRAME
|
||||
else
|
||||
out:write("---- ")
|
||||
end
|
||||
end
|
||||
out:write("]\n")
|
||||
end
|
||||
|
||||
-- Dump snapshots (not interleaved with IR).
|
||||
local function dump_snap(tr)
|
||||
out:write("---- TRACE ", tr, " snapshots\n")
|
||||
for i=0,1000000000 do
|
||||
local snap = tracesnap(tr, i)
|
||||
if not snap then break end
|
||||
out:write(format("#%-3d %04d [ ", i, snap[0]))
|
||||
printsnap(tr, snap)
|
||||
end
|
||||
end
|
||||
|
||||
-- Return a register name or stack slot for a rid/sp location.
|
||||
local function ridsp_name(ridsp, ins)
|
||||
if not disass then disass = require("jit.dis_"..jit.arch) end
|
||||
local rid, slot = band(ridsp, 0xff), shr(ridsp, 8)
|
||||
if rid == 253 or rid == 254 then
|
||||
return (slot == 0 or slot == 255) and " {sink" or format(" {%04d", ins-slot)
|
||||
end
|
||||
if ridsp > 255 then return format("[%x]", slot*4) end
|
||||
if rid < 128 then return disass.regname(rid) end
|
||||
return ""
|
||||
end
|
||||
|
||||
-- Dump CALL* function ref and return optional ctype.
|
||||
local function dumpcallfunc(tr, ins)
|
||||
local ctype
|
||||
if ins > 0 then
|
||||
local m, ot, op1, op2 = traceir(tr, ins)
|
||||
if band(ot, 31) == 0 then -- nil type means CARG(func, ctype).
|
||||
ins = op1
|
||||
ctype = formatk(tr, op2)
|
||||
end
|
||||
end
|
||||
if ins < 0 then
|
||||
out:write(format("[0x%x](", tonumber((tracek(tr, ins)))))
|
||||
else
|
||||
out:write(format("%04d (", ins))
|
||||
end
|
||||
return ctype
|
||||
end
|
||||
|
||||
-- Recursively gather CALL* args and dump them.
|
||||
local function dumpcallargs(tr, ins)
|
||||
if ins < 0 then
|
||||
out:write(formatk(tr, ins))
|
||||
else
|
||||
local m, ot, op1, op2 = traceir(tr, ins)
|
||||
local oidx = 6*shr(ot, 8)
|
||||
local op = sub(vmdef.irnames, oidx+1, oidx+6)
|
||||
if op == "CARG " then
|
||||
dumpcallargs(tr, op1)
|
||||
if op2 < 0 then
|
||||
out:write(" ", formatk(tr, op2))
|
||||
else
|
||||
out:write(" ", format("%04d", op2))
|
||||
end
|
||||
else
|
||||
out:write(format("%04d", ins))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Dump IR and interleaved snapshots.
|
||||
local function dump_ir(tr, dumpsnap, dumpreg)
|
||||
local info = traceinfo(tr)
|
||||
if not info then return end
|
||||
local nins = info.nins
|
||||
out:write("---- TRACE ", tr, " IR\n")
|
||||
local irnames = vmdef.irnames
|
||||
local snapref = 65536
|
||||
local snap, snapno
|
||||
if dumpsnap then
|
||||
snap = tracesnap(tr, 0)
|
||||
snapref = snap[0]
|
||||
snapno = 0
|
||||
end
|
||||
for ins=1,nins do
|
||||
if ins >= snapref then
|
||||
if dumpreg then
|
||||
out:write(format(".... SNAP #%-3d [ ", snapno))
|
||||
else
|
||||
out:write(format(".... SNAP #%-3d [ ", snapno))
|
||||
end
|
||||
printsnap(tr, snap)
|
||||
snapno = snapno + 1
|
||||
snap = tracesnap(tr, snapno)
|
||||
snapref = snap and snap[0] or 65536
|
||||
end
|
||||
local m, ot, op1, op2, ridsp = traceir(tr, ins)
|
||||
local oidx, t = 6*shr(ot, 8), band(ot, 31)
|
||||
local op = sub(irnames, oidx+1, oidx+6)
|
||||
if op == "LOOP " then
|
||||
if dumpreg then
|
||||
out:write(format("%04d ------------ LOOP ------------\n", ins))
|
||||
else
|
||||
out:write(format("%04d ------ LOOP ------------\n", ins))
|
||||
end
|
||||
elseif op ~= "NOP " and op ~= "CARG " and
|
||||
(dumpreg or op ~= "RENAME") then
|
||||
local rid = band(ridsp, 255)
|
||||
if dumpreg then
|
||||
out:write(format("%04d %-6s", ins, ridsp_name(ridsp, ins)))
|
||||
else
|
||||
out:write(format("%04d ", ins))
|
||||
end
|
||||
out:write(format("%s%s %s %s ",
|
||||
(rid == 254 or rid == 253) and "}" or
|
||||
(band(ot, 128) == 0 and " " or ">"),
|
||||
band(ot, 64) == 0 and " " or "+",
|
||||
irtype[t], op))
|
||||
local m1, m2 = band(m, 3), band(m, 3*4)
|
||||
if sub(op, 1, 4) == "CALL" then
|
||||
local ctype
|
||||
if m2 == 1*4 then -- op2 == IRMlit
|
||||
out:write(format("%-10s (", vmdef.ircall[op2]))
|
||||
else
|
||||
ctype = dumpcallfunc(tr, op2)
|
||||
end
|
||||
if op1 ~= -1 then dumpcallargs(tr, op1) end
|
||||
out:write(")")
|
||||
if ctype then out:write(" ctype ", ctype) end
|
||||
elseif op == "CNEW " and op2 == -1 then
|
||||
out:write(formatk(tr, op1))
|
||||
elseif m1 ~= 3 then -- op1 != IRMnone
|
||||
if op1 < 0 then
|
||||
out:write(formatk(tr, op1))
|
||||
else
|
||||
out:write(format(m1 == 0 and "%04d" or "#%-3d", op1))
|
||||
end
|
||||
if m2 ~= 3*4 then -- op2 != IRMnone
|
||||
if m2 == 1*4 then -- op2 == IRMlit
|
||||
local litn = litname[op]
|
||||
if litn and litn[op2] then
|
||||
out:write(" ", litn[op2])
|
||||
elseif op == "UREFO " or op == "UREFC " then
|
||||
out:write(format(" #%-3d", shr(op2, 8)))
|
||||
else
|
||||
out:write(format(" #%-3d", op2))
|
||||
end
|
||||
elseif op2 < 0 then
|
||||
out:write(" ", formatk(tr, op2))
|
||||
else
|
||||
out:write(format(" %04d", op2))
|
||||
end
|
||||
end
|
||||
end
|
||||
out:write("\n")
|
||||
end
|
||||
end
|
||||
if snap then
|
||||
if dumpreg then
|
||||
out:write(format(".... SNAP #%-3d [ ", snapno))
|
||||
else
|
||||
out:write(format(".... SNAP #%-3d [ ", snapno))
|
||||
end
|
||||
printsnap(tr, snap)
|
||||
end
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
local recprefix = ""
|
||||
local recdepth = 0
|
||||
|
||||
-- Format trace error message.
|
||||
local function fmterr(err, info)
|
||||
if type(err) == "number" then
|
||||
if type(info) == "function" then info = fmtfunc(info) end
|
||||
err = format(vmdef.traceerr[err], info)
|
||||
end
|
||||
return err
|
||||
end
|
||||
|
||||
-- Dump trace states.
|
||||
local function dump_trace(what, tr, func, pc, otr, oex)
|
||||
if what == "stop" or (what == "abort" and dumpmode.a) then
|
||||
if dumpmode.i then dump_ir(tr, dumpmode.s, dumpmode.r and what == "stop")
|
||||
elseif dumpmode.s then dump_snap(tr) end
|
||||
if dumpmode.m then dump_mcode(tr) end
|
||||
end
|
||||
if what == "start" then
|
||||
if dumpmode.H then out:write('<pre class="ljdump">\n') end
|
||||
out:write("---- TRACE ", tr, " ", what)
|
||||
if otr then out:write(" ", otr, "/", oex) end
|
||||
out:write(" ", fmtfunc(func, pc), "\n")
|
||||
elseif what == "stop" or what == "abort" then
|
||||
out:write("---- TRACE ", tr, " ", what)
|
||||
if what == "abort" then
|
||||
out:write(" ", fmtfunc(func, pc), " -- ", fmterr(otr, oex), "\n")
|
||||
else
|
||||
local info = traceinfo(tr)
|
||||
local link, ltype = info.link, info.linktype
|
||||
if link == tr or link == 0 then
|
||||
out:write(" -> ", ltype, "\n")
|
||||
elseif ltype == "root" then
|
||||
out:write(" -> ", link, "\n")
|
||||
else
|
||||
out:write(" -> ", link, " ", ltype, "\n")
|
||||
end
|
||||
end
|
||||
if dumpmode.H then out:write("</pre>\n\n") else out:write("\n") end
|
||||
else
|
||||
out:write("---- TRACE ", what, "\n\n")
|
||||
end
|
||||
out:flush()
|
||||
end
|
||||
|
||||
-- Dump recorded bytecode.
|
||||
local function dump_record(tr, func, pc, depth, callee)
|
||||
if depth ~= recdepth then
|
||||
recdepth = depth
|
||||
recprefix = rep(" .", depth)
|
||||
end
|
||||
local line
|
||||
if pc >= 0 then
|
||||
line = bcline(func, pc, recprefix)
|
||||
if dumpmode.H then line = gsub(line, "[<>&]", html_escape) end
|
||||
else
|
||||
line = "0000 "..recprefix.." FUNCC \n"
|
||||
callee = func
|
||||
end
|
||||
if pc <= 0 then
|
||||
out:write(sub(line, 1, -2), " ; ", fmtfunc(func), "\n")
|
||||
else
|
||||
out:write(line)
|
||||
end
|
||||
if pc >= 0 and band(funcbc(func, pc), 0xff) < 16 then -- ORDER BC
|
||||
out:write(bcline(func, pc+1, recprefix)) -- Write JMP for cond.
|
||||
end
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
-- Dump taken trace exits.
|
||||
local function dump_texit(tr, ex, ngpr, nfpr, ...)
|
||||
out:write("---- TRACE ", tr, " exit ", ex, "\n")
|
||||
if dumpmode.X then
|
||||
local regs = {...}
|
||||
if jit.arch == "x64" then
|
||||
for i=1,ngpr do
|
||||
out:write(format(" %016x", regs[i]))
|
||||
if i % 4 == 0 then out:write("\n") end
|
||||
end
|
||||
else
|
||||
for i=1,ngpr do
|
||||
out:write(format(" %08x", regs[i]))
|
||||
if i % 8 == 0 then out:write("\n") end
|
||||
end
|
||||
end
|
||||
if jit.arch == "mips" or jit.arch == "mipsel" then
|
||||
for i=1,nfpr,2 do
|
||||
out:write(format(" %+17.14g", regs[ngpr+i]))
|
||||
if i % 8 == 7 then out:write("\n") end
|
||||
end
|
||||
else
|
||||
for i=1,nfpr do
|
||||
out:write(format(" %+17.14g", regs[ngpr+i]))
|
||||
if i % 4 == 0 then out:write("\n") end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
-- Detach dump handlers.
|
||||
local function dumpoff()
|
||||
if active then
|
||||
active = false
|
||||
jit.attach(dump_texit)
|
||||
jit.attach(dump_record)
|
||||
jit.attach(dump_trace)
|
||||
if out and out ~= stdout and out ~= stderr then out:close() end
|
||||
out = nil
|
||||
end
|
||||
end
|
||||
|
||||
-- Open the output file and attach dump handlers.
|
||||
local function dumpon(opt, outfile)
|
||||
if active then dumpoff() end
|
||||
|
||||
local colormode = os.getenv("COLORTERM") and "A" or "T"
|
||||
if opt then
|
||||
opt = gsub(opt, "[TAH]", function(mode) colormode = mode; return ""; end)
|
||||
end
|
||||
|
||||
local m = { t=true, b=true, i=true, m=true, }
|
||||
if opt and opt ~= "" then
|
||||
local o = sub(opt, 1, 1)
|
||||
if o ~= "+" and o ~= "-" then m = {} end
|
||||
for i=1,#opt do m[sub(opt, i, i)] = (o ~= "-") end
|
||||
end
|
||||
dumpmode = m
|
||||
|
||||
if m.t or m.b or m.i or m.s or m.m then
|
||||
jit.attach(dump_trace, "trace")
|
||||
end
|
||||
if m.b then
|
||||
jit.attach(dump_record, "record")
|
||||
if not bcline then bcline = require("jit.bc").line end
|
||||
end
|
||||
if m.x or m.X then
|
||||
jit.attach(dump_texit, "texit")
|
||||
end
|
||||
|
||||
if not outfile then outfile = os.getenv("LUAJIT_DUMPFILE") end
|
||||
if outfile then
|
||||
out = outfile == "-" and stdout or assert(io.open(outfile, "w"))
|
||||
else
|
||||
out = stdout
|
||||
end
|
||||
|
||||
m[colormode] = true
|
||||
if colormode == "A" then
|
||||
colorize = colorize_ansi
|
||||
irtype = irtype_ansi
|
||||
elseif colormode == "H" then
|
||||
colorize = colorize_html
|
||||
irtype = irtype_html
|
||||
out:write(header_html)
|
||||
else
|
||||
colorize = colorize_text
|
||||
irtype = irtype_text
|
||||
end
|
||||
|
||||
active = true
|
||||
end
|
||||
|
||||
-- Public module functions.
|
||||
module(...)
|
||||
|
||||
on = dumpon
|
||||
off = dumpoff
|
||||
start = dumpon -- For -j command line option.
|
||||
|
118
source/rr/src/lunatic/dynsymlist_editor.lds
Normal file
|
@ -0,0 +1,118 @@
|
|||
{
|
||||
engine_main_arrays_are_static;
|
||||
engine_v8;
|
||||
|
||||
saveboard_maptext;
|
||||
loadboard_maptext;
|
||||
|
||||
sector;
|
||||
wall;
|
||||
sprite;
|
||||
tsprite;
|
||||
spriteext;
|
||||
|
||||
Numsprites;
|
||||
numsectors;
|
||||
numwalls;
|
||||
numyaxbunches;
|
||||
spritesortcnt;
|
||||
guniqhudid;
|
||||
|
||||
qsetmode;
|
||||
rendmode;
|
||||
totalclock;
|
||||
randomseed;
|
||||
xdim;
|
||||
ydim;
|
||||
windowxy1;
|
||||
windowxy2;
|
||||
yxaspect;
|
||||
viewingrange;
|
||||
|
||||
sectorofwall_noquick;
|
||||
getceilzofslopeptr;
|
||||
getflorzofslopeptr;
|
||||
getzsofslopeptr;
|
||||
spriteheightofsptr;
|
||||
|
||||
changespritesect;
|
||||
changespritestat;
|
||||
|
||||
headspritesect;
|
||||
headspritestat;
|
||||
prevspritesect;
|
||||
prevspritestat;
|
||||
nextspritesect;
|
||||
nextspritestat;
|
||||
tilesiz;
|
||||
picanm;
|
||||
|
||||
show2dsector;
|
||||
|
||||
headsectbunch;
|
||||
nextsectbunch;
|
||||
|
||||
krand;
|
||||
ksqrt;
|
||||
inside;
|
||||
getangle;
|
||||
Mulscale;
|
||||
cansee;
|
||||
hitscan;
|
||||
dragpoint;
|
||||
neartag;
|
||||
getzrange;
|
||||
clipmovex;
|
||||
rotatesprite_;
|
||||
setaspect;
|
||||
|
||||
getclosestcol_lim;
|
||||
palookup;
|
||||
palette;
|
||||
getblendtab;
|
||||
setblendtab;
|
||||
setpalookup;
|
||||
|
||||
kopen4load;
|
||||
kfilelength;
|
||||
kclose;
|
||||
kread;
|
||||
klseek;
|
||||
|
||||
dist;
|
||||
ldist;
|
||||
|
||||
updatesector;
|
||||
updatesectorz;
|
||||
updatesectorbreadth;
|
||||
|
||||
getticks;
|
||||
gethiticks;
|
||||
OSD_Printf;
|
||||
|
||||
Bcrc32;
|
||||
|
||||
luaJIT_BC__defs_editor;
|
||||
luaJIT_BC_defs_common;
|
||||
luaJIT_BC_engine_maptext;
|
||||
luaJIT_BC_engine;
|
||||
luaJIT_BC_bcarray;
|
||||
luaJIT_BC_bcheck;
|
||||
luaJIT_BC_bitar;
|
||||
luaJIT_BC_xmath;
|
||||
luaJIT_BC_v;
|
||||
luaJIT_BC_dump;
|
||||
luaJIT_BC_dis_x86;
|
||||
luaJIT_BC_dis_x64;
|
||||
|
||||
g_argv;
|
||||
|
||||
|
||||
_getnumber16;
|
||||
getstring_simple;
|
||||
listsearchpath;
|
||||
LM_Register;
|
||||
LM_Clear;
|
||||
|
||||
basepaltable;
|
||||
};
|
252
source/rr/src/lunatic/dynsymlist_game.lds
Normal file
|
@ -0,0 +1,252 @@
|
|||
{
|
||||
engine_main_arrays_are_static;
|
||||
engine_v8;
|
||||
|
||||
saveboard_maptext;
|
||||
loadboard_maptext;
|
||||
|
||||
sector;
|
||||
wall;
|
||||
sprite;
|
||||
tsprite;
|
||||
spriteext;
|
||||
|
||||
Numsprites;
|
||||
numsectors;
|
||||
numwalls;
|
||||
numyaxbunches;
|
||||
spritesortcnt;
|
||||
guniqhudid;
|
||||
|
||||
qsetmode;
|
||||
rendmode;
|
||||
totalclock;
|
||||
randomseed;
|
||||
xdim;
|
||||
ydim;
|
||||
windowxy1;
|
||||
windowxy2;
|
||||
yxaspect;
|
||||
viewingrange;
|
||||
|
||||
sectorofwall_noquick;
|
||||
getceilzofslopeptr;
|
||||
getflorzofslopeptr;
|
||||
getzsofslopeptr;
|
||||
spriteheightofsptr;
|
||||
|
||||
changespritesect;
|
||||
changespritestat;
|
||||
|
||||
headspritesect;
|
||||
headspritestat;
|
||||
prevspritesect;
|
||||
prevspritestat;
|
||||
nextspritesect;
|
||||
nextspritestat;
|
||||
tilesiz;
|
||||
picanm;
|
||||
|
||||
show2dsector;
|
||||
|
||||
headsectbunch;
|
||||
nextsectbunch;
|
||||
|
||||
krand;
|
||||
ksqrt;
|
||||
inside;
|
||||
getangle;
|
||||
Mulscale;
|
||||
cansee;
|
||||
hitscan;
|
||||
dragpoint;
|
||||
neartag;
|
||||
getzrange;
|
||||
clipmovex;
|
||||
rotatesprite_;
|
||||
setaspect;
|
||||
|
||||
getclosestcol_lim;
|
||||
palookup;
|
||||
palette;
|
||||
getblendtab;
|
||||
setblendtab;
|
||||
setpalookup;
|
||||
|
||||
kopen4load;
|
||||
kfilelength;
|
||||
kclose;
|
||||
kread;
|
||||
klseek;
|
||||
|
||||
pathsearchmode;
|
||||
klistfree;
|
||||
klistpath;
|
||||
|
||||
dist;
|
||||
ldist;
|
||||
|
||||
updatesector;
|
||||
updatesectorz;
|
||||
updatesectorbreadth;
|
||||
|
||||
getticks;
|
||||
gethiticks;
|
||||
OSD_Printf;
|
||||
|
||||
Bcrc32;
|
||||
|
||||
luaJIT_BC_defs_common;
|
||||
luaJIT_BC_engine_maptext;
|
||||
luaJIT_BC_engine;
|
||||
|
||||
g_argv;
|
||||
|
||||
|
||||
g_elCONSize;
|
||||
g_elCON;
|
||||
El_SetCON;
|
||||
El_OnError;
|
||||
|
||||
basepaltable;
|
||||
|
||||
g_elSavecode;
|
||||
El_FreeSaveCode;
|
||||
El_SerializeGamevars;
|
||||
El_RestoreGamevars;
|
||||
El_GetLabelValue;
|
||||
|
||||
s_buildRev;
|
||||
g_sizes_of_what;
|
||||
g_sizes_of;
|
||||
g_elFirstTime;
|
||||
g_elCallDepth;
|
||||
block_deletesprite;
|
||||
myconnectindex;
|
||||
g_RETURN;
|
||||
g_elModules;
|
||||
g_modDir;
|
||||
g_elSessionVar;
|
||||
|
||||
g_mapInfo;
|
||||
g_volumeNames;
|
||||
|
||||
kopen4loadfrommod;
|
||||
|
||||
g_scriptModules;
|
||||
g_scriptModulesNum;
|
||||
|
||||
G_ConFile;
|
||||
G_DoGameStartup;
|
||||
C_DefineSound;
|
||||
C_DefineMusic;
|
||||
C_DefineQuote;
|
||||
C_DefineVolumeName;
|
||||
C_DefineVolumeFlags;
|
||||
C_UndefineVolume;
|
||||
C_DefineSkillName;
|
||||
C_UndefineSkill;
|
||||
C_DefineLevelName;
|
||||
C_UndefineLevel;
|
||||
C_DefineProjectile;
|
||||
C_DefineGameFuncName;
|
||||
C_DefineGameType;
|
||||
C_SetDefName;
|
||||
C_SetCfgName;
|
||||
|
||||
SCRIPT_GetNumber;
|
||||
SCRIPT_PutNumber;
|
||||
|
||||
actor;
|
||||
g_camera;
|
||||
ud;
|
||||
g_player;
|
||||
g_player_ps;
|
||||
g_playerWeapon;
|
||||
g_weaponOverridden;
|
||||
WeaponPickupSprites;
|
||||
g_tile;
|
||||
SpriteProjectile;
|
||||
|
||||
g_noResetVars;
|
||||
A_ResetVars;
|
||||
|
||||
g_dynTileList;
|
||||
g_dynSoundList;
|
||||
|
||||
apStrings;
|
||||
|
||||
screenpeek;
|
||||
hudweap;
|
||||
g_mostConcurrentPlayers;
|
||||
g_deleteQueueSize;
|
||||
g_blimpSpawnItems;
|
||||
g_scriptVersion;
|
||||
g_frameRate;
|
||||
g_currentMenu;
|
||||
g_earthquakeTime;
|
||||
g_moveThingsCount;
|
||||
CheatKeys;
|
||||
g_logoFlags;
|
||||
|
||||
luaJIT_BC_lunacon;
|
||||
luaJIT_BC_con_lang;
|
||||
luaJIT_BC_randgen;
|
||||
luaJIT_BC_stat;
|
||||
luaJIT_BC_bitar;
|
||||
luaJIT_BC_control;
|
||||
luaJIT_BC_bcarray;
|
||||
luaJIT_BC_bcheck;
|
||||
luaJIT_BC_xmath;
|
||||
luaJIT_BC__defs_game;
|
||||
luaJIT_BC_v;
|
||||
luaJIT_BC_dump;
|
||||
luaJIT_BC_dis_x86;
|
||||
luaJIT_BC_dis_x64;
|
||||
luaJIT_BC_lunasave;
|
||||
luaJIT_BC_fs;
|
||||
|
||||
rand_jkiss_u32;
|
||||
rand_jkiss_dbl;
|
||||
|
||||
A_IncurDamage;
|
||||
G_CheckActivatorMotion;
|
||||
A_Dodge;
|
||||
A_MoveSpriteClipdist;
|
||||
P_DoQuote;
|
||||
P_SetGamePalette;
|
||||
G_AddUserQuote;
|
||||
G_ClearCameraView;
|
||||
VM_DrawTileGeneric;
|
||||
G_InitTimer;
|
||||
G_GetTimeDate;
|
||||
G_ToggleWallInterpolation;
|
||||
G_StartTrack;
|
||||
VM_CheckSquished2;
|
||||
Menu_Change;
|
||||
|
||||
KB_ScanCodeToString;
|
||||
|
||||
A_CheckAnySoundPlaying;
|
||||
S_CheckSoundPlaying;
|
||||
S_StopEnvSound;
|
||||
S_StopAllSounds;
|
||||
S_ChangeSoundPitch;
|
||||
S_GetMusicPosition;
|
||||
S_SetMusicPosition;
|
||||
|
||||
minitext_;
|
||||
G_DrawTXDigiNumZ;
|
||||
G_PrintGameText;
|
||||
G_ScreenText;
|
||||
G_ScreenTextSize;
|
||||
G_PrintYourTime;
|
||||
G_PrintParTime;
|
||||
G_PrintDesignerTime;
|
||||
G_PrintBestTime;
|
||||
|
||||
G_UpdateScreenArea;
|
||||
G_SaveMapState;
|
||||
G_RestoreMapState;
|
||||
G_FreeMapState;
|
||||
};
|
522
source/rr/src/lunatic/engine.lua
Normal file
|
@ -0,0 +1,522 @@
|
|||
|
||||
local ffi = require("ffi")
|
||||
local C = ffi.C
|
||||
|
||||
local bcarray = require("bcarray")
|
||||
|
||||
local assert = assert
|
||||
local error = error
|
||||
local ipairs = ipairs
|
||||
local type = type
|
||||
|
||||
local decl = assert(decl) -- comes from above (_defs_game.lua or defs_m32.lua)
|
||||
|
||||
local ismapster32 = (C.LUNATIC_CLIENT == C.LUNATIC_CLIENT_MAPSTER32)
|
||||
|
||||
----------
|
||||
|
||||
decl[[
|
||||
const int32_t qsetmode;
|
||||
int32_t getclosestcol_lim(int32_t r, int32_t g, int32_t b, int32_t lastokcol);
|
||||
char *palookup[256]; // MAXPALOOKUPS
|
||||
uint8_t palette[768];
|
||||
uint8_t *basepaltable[];
|
||||
|
||||
const char *getblendtab(int32_t blend);
|
||||
void setblendtab(int32_t blend, const char *tab);
|
||||
|
||||
int32_t setpalookup(int32_t palnum, const uint8_t *shtab);
|
||||
]]
|
||||
|
||||
if (ismapster32) then
|
||||
ffi.cdef[[
|
||||
int32_t _getnumber16(const char *namestart, int32_t num, int32_t maxnumber, char sign, const char *(func)(int32_t));
|
||||
const char *getstring_simple(const char *querystr, const char *defaultstr, int32_t maxlen, int32_t completion);
|
||||
|
||||
typedef const char *(*luamenufunc_t)(void);
|
||||
void LM_Register(const char *name, luamenufunc_t funcptr, const char *description);
|
||||
void LM_Clear(void);
|
||||
]]
|
||||
end
|
||||
|
||||
----------
|
||||
|
||||
|
||||
-- The API table
|
||||
local engine = {}
|
||||
|
||||
|
||||
local shtab_t -- forward-decl
|
||||
|
||||
local function cast_u8ptr(sth)
|
||||
return ffi.cast("uint8_t *", sth)
|
||||
end
|
||||
|
||||
local shtab_methods = {
|
||||
-- Remap consecutive blocks of 16 color indices and return this new shade
|
||||
-- table.
|
||||
--
|
||||
-- <idxs16>: table with idxs16[0] .. idxs16[15] >= 0 and <= 15
|
||||
-- (i.e. 0-based indices of such 16-tuples)
|
||||
--
|
||||
-- For example, the table
|
||||
-- { [0]=0,1, 2,3, 5,4, 6,7, 8,13, 10,11, 12,9, 14,15 }
|
||||
-- TODO (...)
|
||||
remap16 = function(sht, idxs16)
|
||||
if (type(idxs16) ~= "table") then
|
||||
error("invalid argument #2: must be a table", 2)
|
||||
end
|
||||
|
||||
for i=0,15 do
|
||||
local idx = idxs16[i]
|
||||
if (not (idx==nil or type(idx)=="number" and idx >= 0 and idx <= 15)) then
|
||||
error("invalid reordering table: elements must be numbers in [0 .. 15], or nil", 2)
|
||||
end
|
||||
end
|
||||
|
||||
local newsht = shtab_t()
|
||||
for sh=0,31 do
|
||||
for i=0,15 do
|
||||
ffi.copy(cast_u8ptr(newsht[sh]) + 16*i,
|
||||
cast_u8ptr(sht[sh]) + 16*(idxs16[i] or i), 16)
|
||||
end
|
||||
end
|
||||
return newsht
|
||||
end,
|
||||
}
|
||||
|
||||
local function shtab_mt__index(sht, idx)
|
||||
local method = shtab_methods[idx]
|
||||
if (method) then
|
||||
return method
|
||||
end
|
||||
end
|
||||
|
||||
local pal256_t = bcarray.new("uint8_t", 256, "color index 256-tuple")
|
||||
local SIZEOF_PAL256 = ffi.sizeof(pal256_t)
|
||||
|
||||
-- The shade table type, effectively a bound-checked uint8_t [32][256]:
|
||||
shtab_t = bcarray.new(pal256_t, 32, "shade table", nil, nil, { __index = shtab_mt__index })
|
||||
local SIZEOF_SHTAB = ffi.sizeof(shtab_t)
|
||||
|
||||
local blendtab_t = bcarray.new(pal256_t, 256, "blending table")
|
||||
local SIZEOF_BLENDTAB = ffi.sizeof(blendtab_t)
|
||||
|
||||
local RESERVEDPALS = 8 -- KEEPINSYNC build.h: assure that ours is >= theirs
|
||||
engine.RESERVEDPALS = RESERVEDPALS
|
||||
|
||||
local MAXBLENDTABS = 256 -- KEEPINSYNC build.h
|
||||
|
||||
local function check_palidx(i)
|
||||
if (type(i) ~= "number" or not (i >= 0 and i <= 255-RESERVEDPALS)) then
|
||||
error("invalid argument #1: palette swap index must be in the range [0 .. "..255-RESERVEDPALS.."]", 3)
|
||||
end
|
||||
end
|
||||
|
||||
local function check_blendidx(i)
|
||||
if (type(i) ~= "number" or not (i >= 0 and i <= MAXBLENDTABS-1)) then
|
||||
error("invalid argument #1: blending table index must be in the range [0 .. ".. MAXBLENDTABS-1 .."]", 3)
|
||||
end
|
||||
end
|
||||
|
||||
local function err_uncommon_shade_table(ret)
|
||||
if (ret == -1) then
|
||||
error("loaded engine shade tables don't have 32 gradients of shade", 3)
|
||||
end
|
||||
end
|
||||
|
||||
local function palookup_isdefault(palnum) -- KEEPINSYNC engine.c
|
||||
return (C.palookup[palnum] == nil or (palnum ~= 0 and C.palookup[palnum] == C.palookup[0]))
|
||||
end
|
||||
|
||||
function engine.shadetab()
|
||||
return shtab_t()
|
||||
end
|
||||
|
||||
function engine.blendtab()
|
||||
return blendtab_t()
|
||||
end
|
||||
|
||||
function engine.getshadetab(palidx)
|
||||
check_palidx(palidx)
|
||||
if (palookup_isdefault(palidx)) then
|
||||
return nil
|
||||
end
|
||||
|
||||
local ret = C.setpalookup(palidx, nil)
|
||||
err_uncommon_shade_table(ret)
|
||||
|
||||
local sht = shtab_t()
|
||||
ffi.copy(sht, C.palookup[palidx], SIZEOF_SHTAB)
|
||||
return sht
|
||||
end
|
||||
|
||||
function engine.getblendtab(blendidx)
|
||||
check_blendidx(blendidx)
|
||||
|
||||
local ptr = C.getblendtab(blendidx)
|
||||
if (ptr == nil) then
|
||||
return nil
|
||||
end
|
||||
|
||||
local tab = blendtab_t()
|
||||
ffi.copy(tab, ptr, SIZEOF_BLENDTAB)
|
||||
return tab
|
||||
end
|
||||
|
||||
|
||||
local function check_first_time()
|
||||
if (not ismapster32 and C.g_elFirstTime == 0) then
|
||||
error("may be called only while LUNATIC_FIRST_TIME is true", 3)
|
||||
end
|
||||
end
|
||||
|
||||
function engine.setshadetab(palidx, shtab)
|
||||
check_first_time()
|
||||
check_palidx(palidx)
|
||||
|
||||
if (not ffi.istype(shtab_t, shtab)) then
|
||||
error("invalid argument #2: must be a shade table obtained by shadetab()", 2)
|
||||
end
|
||||
|
||||
if (not ismapster32 and not palookup_isdefault(palidx)) then
|
||||
error("attempt to override already defined shade table", 2)
|
||||
end
|
||||
|
||||
local ret = C.setpalookup(palidx, cast_u8ptr(shtab))
|
||||
err_uncommon_shade_table(ret)
|
||||
end
|
||||
|
||||
function engine.setblendtab(blendidx, tab)
|
||||
check_first_time()
|
||||
check_blendidx(blendidx)
|
||||
|
||||
if (not ffi.istype(blendtab_t, tab)) then
|
||||
error("invalid argument #2: must be a blending table obtained by blendtab()", 2)
|
||||
end
|
||||
|
||||
if (not ismapster32 and C.getblendtab(blendidx) ~= nil) then
|
||||
error("attempt to override already defined blending table", 2)
|
||||
end
|
||||
|
||||
C.setblendtab(blendidx, cast_u8ptr(tab))
|
||||
end
|
||||
|
||||
|
||||
local function check_colcomp(a)
|
||||
if (type(a) ~= "number" or not (a >= 0 and a < 256)) then
|
||||
error("color component must be in the range [0 .. 256)", 3)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- TODO: other base palettes?
|
||||
function engine.getrgb(colidx)
|
||||
if (type(colidx) ~= "number" or not (colidx >= 0 and colidx <= 255)) then
|
||||
error("color index must be in the range [0 .. 255]", 2)
|
||||
end
|
||||
|
||||
-- NOTE: In the game, palette[255*{0..2}] is set to 0 in
|
||||
-- G_LoadExtraPalettes() via G_Startup(). However, that's after Lua state
|
||||
-- initialization (i.e. when LUNATIC_FIRST_TIME would be true), and in the
|
||||
-- editor, it's never changed from the purple color. Therefore, I think
|
||||
-- it's more useful to always return the fully black color here.
|
||||
if (colidx == 255) then
|
||||
return 0, 0, 0
|
||||
end
|
||||
|
||||
local rgbptr = C.palette + 3*colidx
|
||||
return rgbptr[0], rgbptr[1], rgbptr[2]
|
||||
end
|
||||
|
||||
function engine.nearcolor(r, g, b, lastokcol)
|
||||
check_colcomp(r)
|
||||
check_colcomp(g)
|
||||
check_colcomp(b)
|
||||
|
||||
if (lastokcol == nil) then
|
||||
lastokcol = 255
|
||||
elseif (type(lastokcol)~="number" or not (lastokcol >= 0 and lastokcol <= 255)) then
|
||||
error("invalid argument #4 <lastokcol>: must be in the range [0 .. 255]", 2)
|
||||
end
|
||||
|
||||
return C.getclosestcol_lim(r, g, b, lastokcol)
|
||||
end
|
||||
|
||||
|
||||
---------- Mapster32-only functions ----------
|
||||
|
||||
if (ismapster32) then
|
||||
local io = require("io")
|
||||
local math = require("math")
|
||||
local string = require("string")
|
||||
|
||||
ffi.cdef[[size_t fwrite(const void * restrict ptr, size_t size, size_t nmemb, void * restrict stream);]]
|
||||
|
||||
local function validate_more_blendtabs(moreblends, kindname, gettabfunc)
|
||||
if (moreblends == nil) then
|
||||
return nil, nil
|
||||
end
|
||||
|
||||
-- Additional blending tables: validate <moreblends> table.
|
||||
if (type(moreblends) ~= "table") then
|
||||
error("invalid argument #4: must be a table", 3)
|
||||
end
|
||||
|
||||
local haveblend = { [0]=true }
|
||||
local blendnumtab, blendptrtab = {}, {}
|
||||
|
||||
for i=1,#moreblends do
|
||||
local tmp = moreblends[i]
|
||||
local blendspec = (type(tmp) == "number") and { tmp, tmp } or tmp
|
||||
|
||||
if (not (type(blendspec) == "table" and #blendspec == 2)) then
|
||||
error("invalid argument #4: must contain numbers or 2-tables", 3)
|
||||
end
|
||||
|
||||
local blend1, blend2 = math.floor(blendspec[1]), math.floor(blendspec[2])
|
||||
|
||||
if (not (type(blend1)=="number" and blend1 >= 1 and blend1 <= 255 and
|
||||
type(blend2)=="number" and blend2 >= 1 and blend2 <= 255)) then
|
||||
error("invalid argument #4: "..kindname.." table numbers must be in [1 .. 255]", 3)
|
||||
end
|
||||
|
||||
for bi=blend1,blend2 do
|
||||
if (haveblend[bi]) then
|
||||
error("invalid argument #4: duplicate "..kindname.." table number "..bi, 3)
|
||||
end
|
||||
haveblend[bi] = true
|
||||
|
||||
local ptr = gettabfunc(bi)
|
||||
if (ptr == nil) then
|
||||
error("invalid argument #4: "..kindname.." table for number "..bi.." is void", 3)
|
||||
end
|
||||
|
||||
blendnumtab[#blendnumtab+1] = bi
|
||||
blendptrtab[#blendptrtab+1] = ptr
|
||||
end
|
||||
end
|
||||
|
||||
assert(#blendnumtab <= 255)
|
||||
return blendnumtab, blendptrtab
|
||||
end
|
||||
|
||||
-- ok, errmsg, nummoreblends = engine.savePaletteDat(
|
||||
-- filename [, palnum [, blendnum [, moreblends [, lognumalphatabs]]]])
|
||||
function engine.savePaletteDat(filename, palnum, blendnum, moreblends, lognumalphatabs)
|
||||
local sht = engine.getshadetab(palnum or 0)
|
||||
local tab = engine.getblendtab(blendnum or 0)
|
||||
|
||||
if (sht == nil) then
|
||||
return nil, "no shade table with number "..palnum
|
||||
elseif (tab == nil) then
|
||||
return nil, "no blending table with number "..blendnum
|
||||
end
|
||||
|
||||
local blendnumtab, blendptrtab = validate_more_blendtabs(
|
||||
moreblends, "blending", C.getblendtab)
|
||||
|
||||
if (lognumalphatabs ~= nil) then
|
||||
if (not (type(lognumalphatabs)=="number" and lognumalphatabs >= 1 and lognumalphatabs <= 7)) then
|
||||
error("invalid argument #5: must be a number in [1 .. 7]", 2)
|
||||
end
|
||||
end
|
||||
|
||||
local f, errmsg = io.open(filename, "wb+")
|
||||
if (f == nil) then
|
||||
return nil, errmsg
|
||||
end
|
||||
|
||||
local truncpal = pal256_t()
|
||||
ffi.copy(truncpal, C.palette, SIZEOF_PAL256)
|
||||
for i=0,255 do
|
||||
truncpal[i] = bit.rshift(truncpal[i], 2)
|
||||
end
|
||||
|
||||
local n1 = C.fwrite(truncpal, 3, 256, f)
|
||||
f:write("\032\000") -- int16_t numshades
|
||||
local n3 = C.fwrite(sht, 256, 32, f)
|
||||
local n4 = C.fwrite(tab, 256, 256, f)
|
||||
|
||||
if (n1 ~= 256 or n3 ~= 32 or n4 ~= 256) then
|
||||
return nil, "failed writing classic PALETTE.DAT data"
|
||||
end
|
||||
|
||||
if (blendnumtab ~= nil) then
|
||||
f:write("MoreBlendTab")
|
||||
f:write(string.char(#blendnumtab))
|
||||
|
||||
for i=1,#blendnumtab do
|
||||
f:write(string.char(blendnumtab[i]))
|
||||
if (C.fwrite(blendptrtab[i], 256, 256, f) ~= 256) then
|
||||
return nil, "failed writing additional blending table"
|
||||
end
|
||||
end
|
||||
|
||||
if (lognumalphatabs ~= nil) then
|
||||
-- XXX: no checking whether these blending tables 1 to
|
||||
-- 1<<lognumalphatabs have been written.
|
||||
f:write(string.char(lognumalphatabs))
|
||||
end
|
||||
end
|
||||
|
||||
f:close()
|
||||
|
||||
return true, nil, (blendnumtab ~= nil) and #blendnumtab or 0
|
||||
end
|
||||
|
||||
-- ok, errmsg, numlookups = engine.saveLookupDat(filename, lookups)
|
||||
function engine.saveLookupDat(filename, lookups)
|
||||
if (lookups == nil) then
|
||||
-- set to an invalid value, validate_more_blendtabs will error
|
||||
lookups = 0
|
||||
end
|
||||
|
||||
local lookupnumtab, lookupptrtab = validate_more_blendtabs(
|
||||
lookups, "lookup", engine.getshadetab)
|
||||
|
||||
local f, errmsg = io.open(filename, "wb+")
|
||||
if (f == nil) then
|
||||
return nil, errmsg
|
||||
end
|
||||
|
||||
f:write(string.char(#lookupnumtab))
|
||||
|
||||
for i=1,#lookupnumtab do
|
||||
f:write(string.char(lookupnumtab[i]))
|
||||
if (C.fwrite(lookupptrtab[i], 1, 256, f) ~= 256) then
|
||||
return nil, "failed writing lookup table"
|
||||
end
|
||||
end
|
||||
|
||||
-- Write five base palettes
|
||||
for i=1,5 do
|
||||
local bpi = (i==3 or i==4) and 4+3-i or i
|
||||
|
||||
local truncbasepal = pal256_t()
|
||||
ffi.copy(truncbasepal, C.basepaltable[bpi], SIZEOF_PAL256)
|
||||
for j=0,255 do
|
||||
truncbasepal[j] = bit.rshift(truncbasepal[j], 2)
|
||||
end
|
||||
|
||||
if (C.fwrite(truncbasepal, 1, 768, f) ~= 768) then
|
||||
return nil, "failed writing base palette"
|
||||
end
|
||||
end
|
||||
|
||||
f:close()
|
||||
|
||||
return true, nil, #lookupnumtab
|
||||
end
|
||||
|
||||
local hexmap = {
|
||||
[0] = 0, -14, -- 0, 1: gray ramp
|
||||
14, 0, -- 2, 3: skin color ramp
|
||||
0, 14, -- 4, 5: blue ramp (second part first)
|
||||
14, 0, -- 6, 7: nightvision yellow/green
|
||||
14, -- 8: red first part...
|
||||
8, -- 9: yellow (slightly more red than green)
|
||||
14, 0, -- 10, 11: almost gray ramp, but with a slight red hue
|
||||
8, -- 12: "dirty" orange
|
||||
0, -- 13: ...red second part
|
||||
8, -- 14: blue-purple-red
|
||||
}
|
||||
|
||||
-- Setup base palette 1 (water) to contain one color for each consecutive
|
||||
-- 16-tuple (which I'm calling a 'hex' for brevity), except for the last
|
||||
-- one with the fullbrights.
|
||||
function engine.setupDebugBasePal()
|
||||
for i=0,14 do
|
||||
local ptr = C.basepaltable[1] + 3*(16*i)
|
||||
local src = C.basepaltable[0] + 3*(16*i) + 3*hexmap[i]
|
||||
local r, g, b = src[0], src[1], src[2]
|
||||
|
||||
for j=0,15 do
|
||||
local dst = ptr + 3*j
|
||||
dst[0], dst[1], dst[2] = r, g, b
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function engine.linearizeBasePal()
|
||||
for _, begi in ipairs{0, 32, 96, 160} do
|
||||
local ptr = C.basepaltable[0] + 3*begi
|
||||
local refcol = ptr + 3*31
|
||||
|
||||
for i=0,30 do
|
||||
for c=0,2 do
|
||||
ptr[3*i + c] = i*refcol[c]/31
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for _, begi in ipairs{128, 144, 192, 208, 224} do
|
||||
local ptr = C.basepaltable[0] + 3*begi
|
||||
|
||||
for i=0,3*15+2 do
|
||||
ptr[i] = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Interfaces to Mapster32's status bar menu
|
||||
|
||||
local pcall = pcall
|
||||
|
||||
function engine.clearMenu()
|
||||
C.LM_Clear()
|
||||
end
|
||||
|
||||
function engine.registerMenuFunc(name, func, description)
|
||||
if (type(name) ~= "string") then
|
||||
error("invalid argument #1: must be a string", 2)
|
||||
end
|
||||
if (type(func) ~= "function") then
|
||||
error("invalid argument #2: must be a function", 2)
|
||||
end
|
||||
if (description~=nil and type(description)~="string") then
|
||||
error("invalid argument #3: must be nil or a string", 2)
|
||||
end
|
||||
|
||||
local safefunc = function()
|
||||
local ok, errmsg = pcall(func)
|
||||
if (not ok) then
|
||||
return errmsg
|
||||
end
|
||||
end
|
||||
|
||||
C.LM_Register(name, safefunc, description)
|
||||
end
|
||||
|
||||
engine.GETNUMFLAG = {
|
||||
NEG_ALLOWED = 1,
|
||||
AUTOCOMPL_NAMES = 2,
|
||||
AUTOCOMPL_TAGLAB = 4,
|
||||
RET_M1_ON_CANCEL = 8,
|
||||
|
||||
NEXTFREE = 16,
|
||||
}
|
||||
|
||||
function engine.getnumber16(namestart, num, maxnumber, flags)
|
||||
if (C.qsetmode == 200) then
|
||||
error("getnumber16 must be called from 2D mode", 2)
|
||||
end
|
||||
if (type(namestart)~="string") then
|
||||
error("invalid argument #1: must be a string", 2)
|
||||
end
|
||||
|
||||
return C._getnumber16(namestart, num, maxnumber, flags or 8, nil) -- RET_M1_ON_CANCEL
|
||||
end
|
||||
|
||||
function engine.getstring(querystr)
|
||||
if (type(querystr) ~= "string") then
|
||||
error("invalid argument #2: must be a string", 2)
|
||||
end
|
||||
local cstr = C.getstring_simple(querystr, nil, 0, 0)
|
||||
return cstr~=nil and ffi.string(cstr) or nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Done!
|
||||
return engine
|
538
source/rr/src/lunatic/engine_maptext.lua
Normal file
|
@ -0,0 +1,538 @@
|
|||
-- MAPTEXT
|
||||
-- Lunatic: routines for reading and writing map-text.
|
||||
|
||||
local ffi = require("ffi")
|
||||
local ffiC = ffi.C
|
||||
|
||||
local assert = assert
|
||||
local loadstring = loadstring
|
||||
local pairs = pairs
|
||||
local pcall = pcall
|
||||
local print = print
|
||||
local setfenv = setfenv
|
||||
local tonumber = tonumber
|
||||
local type = type
|
||||
|
||||
local readintostr = assert(string.readintostr)
|
||||
|
||||
local io = require("io")
|
||||
local string = require("string")
|
||||
|
||||
|
||||
ffi.cdef[[
|
||||
int32_t (*saveboard_maptext)(const char *filename, const vec3_t *dapos, int16_t daang, int16_t dacursectnum);
|
||||
int32_t (*loadboard_maptext)(int32_t fil, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum);
|
||||
]]
|
||||
|
||||
|
||||
--== COMMON ==--
|
||||
|
||||
local sector_members = {
|
||||
-- Mandatory positional members first, [pos]=<name>.
|
||||
"ceilingz", "floorz",
|
||||
"ceilingpicnum", "floorpicnum",
|
||||
"ceilingshade", "floorshade";
|
||||
|
||||
-- If other positional members are to be added, they must be optional
|
||||
-- for backwards compatibility.
|
||||
|
||||
-- Optional key/value members next.
|
||||
B = { "ceilingbunch", -1 }, b = { "floorbunch", -1 }, -- default: -1
|
||||
F = "ceilingstat", f = "floorstat", -- default: 0
|
||||
H = "ceilingheinum", h = "floorheinum",
|
||||
P = "ceilingpal", p = "floorpal",
|
||||
X = "ceilingxpanning", x = "floorxpanning",
|
||||
Y = "ceilingypanning", y = "floorypanning",
|
||||
|
||||
v = "visibility",
|
||||
_ = "fogpal",
|
||||
o = "lotag", i = "hitag", e = { "extra", -1 }
|
||||
}
|
||||
|
||||
-- Defines the order in which the members are written out. A space denotes that
|
||||
-- a newline should appear in the output. KEEPINSYNC with sector_members.
|
||||
local sector_ord = { mand="12 34 56 ", opt="Bb Ff Hh Pp Xx Yy v _ oie" }
|
||||
|
||||
-- KEEPINSYNC with sector_members.
|
||||
local sector_default = ffi.new("const sectortype", { ceilingbunch=-1, floorbunch=-1, extra=-1 })
|
||||
|
||||
|
||||
local wall_members = {
|
||||
-- mandatory
|
||||
"point2", -- special: 0, 1 or 2 in map-text
|
||||
"x", "y",
|
||||
"nextwall",
|
||||
"picnum",
|
||||
"shade",
|
||||
"xrepeat", "yrepeat",
|
||||
"xpanning", "ypanning";
|
||||
|
||||
-- optional
|
||||
f = "cstat",
|
||||
m = "overpicnum", b = "blend",
|
||||
p = "pal",
|
||||
w = { "upwall", -1 }, W = { "dnwall", -1 },
|
||||
o = "lotag", i = "hitag", e = { "extra", -1 }
|
||||
}
|
||||
|
||||
local wall_ord = { mand="1 23 4 5 6 78 90 ", opt="f mb p wW oie" }
|
||||
local wall_default = ffi.new("const walltype", { extra = -1, upwall=-1, dnwall=-1 })
|
||||
|
||||
|
||||
local sprite_members = {
|
||||
-- mandatory
|
||||
"x", "y", "z",
|
||||
"ang",
|
||||
"sectnum",
|
||||
"picnum",
|
||||
"cstat",
|
||||
"shade",
|
||||
"xrepeat", "yrepeat",
|
||||
|
||||
-- optional
|
||||
p = "pal",
|
||||
c = { "clipdist", 32 },
|
||||
b = "blend",
|
||||
x = "xoffset", y = "yoffset",
|
||||
s = "statnum",
|
||||
w = { "owner", -1 },
|
||||
X = "xvel", Y = "yvel", Z = "zvel",
|
||||
o = "lotag", i = "hitag", e = { "extra", -1 }
|
||||
}
|
||||
|
||||
local sprite_ord = { mand="123 4 5 6 7 8 90 ", opt="p c b xy s w XYZ oie" }
|
||||
local sprite_default = ffi.new("const spritetype", { clipdist=32, owner=-1, extra=-1 })
|
||||
|
||||
|
||||
--== SAVING ==--
|
||||
|
||||
local function write_struct(f, struct, members, ord)
|
||||
-- Write mandatory members first.
|
||||
local str = ord.mand:gsub(".",
|
||||
function(s)
|
||||
local num = (s=="0") and 10 or tonumber(s)
|
||||
return (s==" ") and "\n" or (struct[members[num]]..",")
|
||||
end)
|
||||
f:write("{"..str)
|
||||
|
||||
local havesth = false
|
||||
|
||||
-- Write optional members next.
|
||||
str = ord.opt:gsub(".",
|
||||
function(s)
|
||||
if (s==" ") then
|
||||
local ohavesth = havesth
|
||||
havesth = false
|
||||
return ohavesth and "\n" or ""
|
||||
end
|
||||
|
||||
local memb = members[s]
|
||||
local mname = (type(memb)=="table") and memb[1] or memb
|
||||
local mdefault = (type(memb)=="table") and memb[2] or 0
|
||||
|
||||
local val = struct[mname]
|
||||
|
||||
if (val~=mdefault) then
|
||||
havesth = true
|
||||
return s.."="..val..","
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end)
|
||||
|
||||
local neednl = (#str>0 and str:sub(-1)~="\n")
|
||||
f:write(str..(neednl and "\n" or "").."},\n")
|
||||
end
|
||||
|
||||
-- common
|
||||
local function check_bad_point2()
|
||||
local lastloopstart = 0
|
||||
|
||||
for i=0,ffiC.numwalls-1 do
|
||||
local p2 = ffiC.wall[i].point2
|
||||
|
||||
if (not (p2 == i+1 or (p2 ~= i and p2 == lastloopstart))) then
|
||||
-- If we hit this, the map is seriously corrupted!
|
||||
print(string.format("INTERNAL ERROR: wall[%d].point2=%d invalid", i, p2))
|
||||
return true
|
||||
end
|
||||
|
||||
if (p2 ~= i+1) then
|
||||
lastloopstart = i+1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function lastwallofsect(s)
|
||||
return ffiC.sector[s].wallptr + ffiC.sector[s].wallnum - 1
|
||||
end
|
||||
|
||||
-- In map-text, instead of saving wall[].point2, we store whether a particular
|
||||
-- wall is the last one in its loop instead: the on-disk wall[i].point2 is
|
||||
-- * 2 if wall i is last of its sector (no need to save sector's .wallnum),
|
||||
-- * 1 if wall i is last of its loop,
|
||||
-- * 0 otherwise.
|
||||
-- This function prepares saving to map-text by tweaking the wall[].point2
|
||||
-- members in-place.
|
||||
local function save_tweak_point2()
|
||||
-- Check first.
|
||||
if (check_bad_point2()) then
|
||||
return true
|
||||
end
|
||||
|
||||
-- Do it for real.
|
||||
local lastloopstart = 0
|
||||
local cursect, curlastwall = 0, lastwallofsect(0)
|
||||
|
||||
for i=0,ffiC.numwalls-1 do
|
||||
local wal = ffiC.wall[i]
|
||||
|
||||
if (wal.point2 == i+1) then
|
||||
wal.point2 = 0
|
||||
else
|
||||
-- Wall i is last point in loop.
|
||||
|
||||
if (i==curlastwall) then
|
||||
-- ... and also last wall of sector.
|
||||
cursect = cursect+1
|
||||
curlastwall = lastwallofsect(cursect)
|
||||
|
||||
wal.point2 = 2
|
||||
else
|
||||
wal.point2 = 1
|
||||
end
|
||||
|
||||
lastloopstart = i+1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Common: restore tweaked point2 members to actual wall indices.
|
||||
-- If <alsosectorp> is true, also set sector's .wallptr and .wallnum members.
|
||||
local function restore_point2(alsosectorp)
|
||||
local lastloopstart = 0
|
||||
local cursect, curfirstwall = 0, 0
|
||||
|
||||
for i=0,ffiC.numwalls-1 do
|
||||
local wal = ffiC.wall[i]
|
||||
local islast = (wal.point2~=0)
|
||||
|
||||
if (not islast) then
|
||||
wal.point2 = i+1
|
||||
else
|
||||
-- Wall i is last point in loop.
|
||||
|
||||
if (alsosectorp and wal.point2 == 2) then
|
||||
-- ... and also last wall of sector.
|
||||
|
||||
if (cursect==ffiC.MAXSECTORS) then
|
||||
return true -- Too many sectors.
|
||||
end
|
||||
|
||||
ffiC.sector[cursect].wallptr = curfirstwall
|
||||
ffiC.sector[cursect].wallnum = i-curfirstwall+1
|
||||
cursect = cursect+1
|
||||
curfirstwall = i+1
|
||||
end
|
||||
|
||||
wal.point2 = lastloopstart
|
||||
lastloopstart = i+1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function saveboard_maptext(filename, pos, ang, cursectnum)
|
||||
assert(ffiC.numsectors > 0)
|
||||
|
||||
-- First, temporarily tweak wall[].point2.
|
||||
if (save_tweak_point2()) then
|
||||
return -1
|
||||
end
|
||||
|
||||
-- We open in binary mode so that newlines get written out as one byte even
|
||||
-- on Windows.
|
||||
local f, msg = io.open(ffi.string(filename), "wb")
|
||||
|
||||
if (f == nil) then
|
||||
print(string.format("Couldn't open \"%s\" for writing: %s\n", filename, msg))
|
||||
restore_point2(false)
|
||||
return -1
|
||||
end
|
||||
|
||||
-- Write header.
|
||||
f:write(string.format("--EDuke32 map\n"..
|
||||
"return {\n"..
|
||||
"version=10,\n\n"..
|
||||
|
||||
"pos={%d,%d,%d},\n"..
|
||||
"sectnum=%d,\n"..
|
||||
"ang=%d,\n\n",
|
||||
|
||||
pos.x, pos.y, pos.z,
|
||||
cursectnum,
|
||||
ang))
|
||||
|
||||
-- Sectors.
|
||||
f:write("sector={\n")
|
||||
for i=0,ffiC.numsectors-1 do
|
||||
write_struct(f, ffiC.sector[i], sector_members, sector_ord)
|
||||
end
|
||||
f:write("},\n\n")
|
||||
|
||||
-- Walls.
|
||||
f:write("wall={\n")
|
||||
for i=0,ffiC.numwalls-1 do
|
||||
write_struct(f, ffiC.wall[i], wall_members, wall_ord)
|
||||
end
|
||||
f:write("},\n\n")
|
||||
|
||||
-- Sprites.
|
||||
f:write("sprite={\n")
|
||||
for i=0,ffiC.MAXSPRITES-1 do
|
||||
if (ffiC.sprite[i].statnum ~= ffiC.MAXSTATUS) then
|
||||
write_struct(f, ffiC.sprite[i], sprite_members, sprite_ord)
|
||||
end
|
||||
end
|
||||
f:write("},\n\n")
|
||||
|
||||
f:write("}\n");
|
||||
|
||||
-- Done.
|
||||
f:close()
|
||||
restore_point2(false)
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
--== LOADING ==--
|
||||
|
||||
local function isnum(v)
|
||||
return (type(v)=="number")
|
||||
end
|
||||
|
||||
local function istab(v)
|
||||
return (type(v)=="table")
|
||||
end
|
||||
|
||||
-- Checks whether <tab> is a table all values of <tab> are of type <extype>.
|
||||
local function allxtab(tab, extype)
|
||||
if (not istab(tab)) then
|
||||
return false
|
||||
end
|
||||
|
||||
for _,val in pairs(tab) do
|
||||
if (type(val) ~= extype) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-- Is table of all numbers?
|
||||
local function allnumtab(tab) return allxtab(tab, "number") end
|
||||
-- Is table of all tables?
|
||||
local function alltabtab(tab) return allxtab(tab, "table") end
|
||||
|
||||
-- Is table of tables of all numbers? Additionally, each must contain exactly
|
||||
-- as many mandatory positional entries as given by the <members> table.
|
||||
local function tabofnumtabs(tab, members)
|
||||
for i=1,#tab do
|
||||
if (not allnumtab(tab[i])) then
|
||||
return false
|
||||
end
|
||||
|
||||
local nummand = #members -- number of mandatory entries
|
||||
if (#tab[i] ~= nummand) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
-- Read data from Lua table <stab> into C struct <cs>, using the struct
|
||||
-- description <members>.
|
||||
-- Returns true on error.
|
||||
local function read_struct(cs, stab, members, defaults)
|
||||
-- Clear struct to default values.
|
||||
ffi.copy(cs, defaults, ffi.sizeof(defaults))
|
||||
|
||||
-- Read mandatory positional members.
|
||||
for i=1,#members do
|
||||
cs[members[i]] = stab[i]
|
||||
end
|
||||
|
||||
-- Read optional key/value members.
|
||||
for k,val in pairs(stab) do
|
||||
if (members[k]==nil) then
|
||||
-- No such member abbreviation for the given struct.
|
||||
return true
|
||||
end
|
||||
|
||||
local memb = istab(members[k]) and members[k][1] or members[k]
|
||||
cs[memb] = val
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local RETERR = -4
|
||||
|
||||
local function loadboard_maptext(fil, posptr, angptr, cursectnumptr)
|
||||
-- Read the whole map-text as string.
|
||||
local str = readintostr(fil)
|
||||
|
||||
if (str == nil) then
|
||||
return RETERR
|
||||
end
|
||||
|
||||
-- Strip all one-line comments (currently, only the header).
|
||||
str = str:gsub("%-%-.-\n", "")
|
||||
|
||||
--- Preliminary (pseudo-syntactical) validation ---
|
||||
|
||||
-- Whitelist approach: map-text may only contain certain characters. This
|
||||
-- excludes various potentially 'bad' operations (such as calling a
|
||||
-- function) in one blow. Also, this assures (by exclusion) that the Lua
|
||||
-- code contains no long comments, strings, or function calls.
|
||||
if (not str:find("^[ A-Za-z_0-9{},%-\n=]+$")) then
|
||||
return RETERR-1
|
||||
end
|
||||
|
||||
-- The map-text code must return a single table.
|
||||
if (not str:find("^return %b{}\n$")) then
|
||||
return RETERR-2
|
||||
end
|
||||
|
||||
local func, errmsg = loadstring(str, "maptext")
|
||||
if (func == nil) then
|
||||
print("Error preloading map-text Lua code: "..errmsg)
|
||||
return RETERR-3
|
||||
end
|
||||
|
||||
-- Completely empty the function's environment as an additional safety
|
||||
-- measure, then run the chunk protected! (XXX: currently a bit pointless
|
||||
-- because of the asserts below.)
|
||||
local ok, map = pcall(setfenv(func, {}))
|
||||
if (not ok) then
|
||||
print("Error executing map-text Lua code: "..map)
|
||||
return RETERR-4
|
||||
end
|
||||
|
||||
assert(istab(map))
|
||||
-- OK, now 'map' contains the map data.
|
||||
|
||||
--- Structural validation ---
|
||||
|
||||
-- Check types.
|
||||
if (not isnum(map.version) or not allnumtab(map.pos) or #map.pos~=3 or
|
||||
not isnum(map.sectnum) or not isnum(map.ang))
|
||||
then
|
||||
return RETERR-5
|
||||
end
|
||||
|
||||
if (not (map.version <= 10)) then
|
||||
return RETERR-6
|
||||
end
|
||||
|
||||
local msector, mwall, msprite = map.sector, map.wall, map.sprite
|
||||
|
||||
if (not alltabtab(msector) or not alltabtab(mwall) or not alltabtab(msprite)) then
|
||||
return RETERR-7
|
||||
end
|
||||
|
||||
if (not tabofnumtabs(msector, sector_members) or
|
||||
not tabofnumtabs(mwall, wall_members) or
|
||||
not tabofnumtabs(msprite, sprite_members))
|
||||
then
|
||||
return RETERR-8
|
||||
end
|
||||
|
||||
local numsectors, numwalls, numsprites = #msector, #mwall, #msprite
|
||||
local sector, wall, sprite = ffiC.sector, ffiC.wall, ffiC.sprite
|
||||
|
||||
if (numsectors == 0 or numsectors > ffiC.MAXSECTORS or
|
||||
numwalls > ffiC.MAXWALLS or numsprites > ffiC.MAXSPRITES)
|
||||
then
|
||||
return RETERR-9
|
||||
end
|
||||
|
||||
--- From here on, start filling out C structures. ---
|
||||
|
||||
ffiC.numsectors = numsectors
|
||||
ffiC.numwalls = numwalls
|
||||
|
||||
-- Header.
|
||||
posptr.x = map.pos[1]
|
||||
posptr.y = map.pos[2]
|
||||
posptr.z = map.pos[3]
|
||||
|
||||
angptr[0] = map.ang
|
||||
cursectnumptr[0] = map.sectnum
|
||||
|
||||
-- Sectors.
|
||||
for i=0,numsectors-1 do
|
||||
if (read_struct(sector[i], msector[i+1], sector_members, sector_default)) then
|
||||
return RETERR-10
|
||||
end
|
||||
end
|
||||
|
||||
-- Walls.
|
||||
for i=0,numwalls-1 do
|
||||
if (read_struct(wall[i], mwall[i+1], wall_members, wall_default)) then
|
||||
return RETERR-11
|
||||
end
|
||||
end
|
||||
|
||||
-- Sprites.
|
||||
for i=0,numsprites-1 do
|
||||
if (read_struct(sprite[i], msprite[i+1], sprite_members, sprite_default)) then
|
||||
return RETERR-12
|
||||
end
|
||||
end
|
||||
|
||||
-- XXX: need to consistency-check much more here! Basically, all of
|
||||
-- astub.c's CheckMapCorruption() for corruption level >=4?
|
||||
-- See NOTNICE below.
|
||||
|
||||
--- Tweakery: mostly setting dependent members. ---
|
||||
|
||||
-- sector[]: .wallptr calculated from .wallnum.
|
||||
local numw = 0
|
||||
for i=0,numsectors-1 do
|
||||
assert(numw >= 0 and numw < numwalls) -- NOTNICE, cheap check instead of real one.
|
||||
sector[i].wallptr = numw
|
||||
numw = numw + sector[i].wallnum
|
||||
end
|
||||
|
||||
-- .point2 in {0, 1} --> wall index, sector[].wallptr/.wallnum
|
||||
if (restore_point2(true)) then
|
||||
return RETERR-13
|
||||
end
|
||||
|
||||
-- Check .point2 at least.
|
||||
if (check_bad_point2()) then
|
||||
return RETERR-14
|
||||
end
|
||||
|
||||
-- wall[]: .nextsector calculated by using engine's sectorofwall_noquick()
|
||||
for i=0,numwalls-1 do
|
||||
local nw = wall[i].nextwall
|
||||
|
||||
if (nw >= 0) then
|
||||
assert(nw >= 0 and nw < numwalls) -- NOTNICE
|
||||
wall[i].nextsector = ffiC.sectorofwall_noquick(nw)
|
||||
else
|
||||
wall[i].nextsector = -1
|
||||
end
|
||||
end
|
||||
|
||||
-- All OK, return the number of sprites for further engine loading code.
|
||||
return numsprites
|
||||
end
|
||||
|
||||
|
||||
-- Register our Lua functions as callbacks from C.
|
||||
ffiC.saveboard_maptext = saveboard_maptext
|
||||
ffiC.loadboard_maptext = loadboard_maptext
|
96
source/rr/src/lunatic/fs.lua
Normal file
|
@ -0,0 +1,96 @@
|
|||
-- Virtual file system facilities for Lunatic
|
||||
|
||||
local ffi = require("ffi")
|
||||
local C = ffi.C
|
||||
|
||||
local decl = require("lprivate").decl
|
||||
|
||||
local assert = assert
|
||||
local error = error
|
||||
local type = type
|
||||
|
||||
----------
|
||||
|
||||
decl[[
|
||||
int32_t pathsearchmode;
|
||||
|
||||
typedef struct _CACHE1D_FIND_REC {
|
||||
char *name;
|
||||
int32_t type, source;
|
||||
struct _CACHE1D_FIND_REC *next, *prev, *usera, *userb;
|
||||
} CACHE1D_FIND_REC;
|
||||
|
||||
void klistfree(CACHE1D_FIND_REC *rec);
|
||||
CACHE1D_FIND_REC *klistpath(const char *path, const char *mask, int32_t type);
|
||||
]]
|
||||
|
||||
|
||||
-- The API table
|
||||
local fs = {}
|
||||
|
||||
local CACHE1D = ffi.new[[
|
||||
struct {
|
||||
static const int FIND_FILE = 1;
|
||||
static const int FIND_DIR = 2;
|
||||
static const int FIND_DRIVE = 4;
|
||||
static const int FIND_NOCURDIR = 8;
|
||||
|
||||
static const int OPT_NOSTACK = 0x100;
|
||||
|
||||
// the lower the number, the higher the priority
|
||||
static const int SOURCE_DRIVE = 0;
|
||||
static const int SOURCE_CURDIR = 1;
|
||||
static const int SOURCE_PATH = 2; // + path stack depth
|
||||
static const int SOURCE_ZIP = 0x7ffffffe;
|
||||
static const int SOURCE_GRP = 0x7fffffff;
|
||||
}
|
||||
]]
|
||||
|
||||
-- files = fs.listpath(path, mask)
|
||||
-- TODO: filter by 'source' (path, zip and/or grp)
|
||||
-- TODO: directories too, so that one can list them recursively, for example
|
||||
function fs.listpath(path, mask)
|
||||
if (type(path)~="string") then
|
||||
-- TODO: maybe also allow nil
|
||||
error("Invalid argument #1: must be a string", 2)
|
||||
end
|
||||
|
||||
if (type(mask) ~= "string") then
|
||||
error("Invalid argument #2: must be a string", 2)
|
||||
end
|
||||
|
||||
-- Normalization, for portability's sake
|
||||
|
||||
if (path:find("\\")) then
|
||||
error("Invalid argument #1: must not contain backslashes", 2)
|
||||
end
|
||||
|
||||
if (mask:find("[\\/]")) then
|
||||
error("Invalid argument #2: must not contain back or forward slashes", 2)
|
||||
end
|
||||
|
||||
local opsm = C.pathsearchmode
|
||||
C.pathsearchmode = 0
|
||||
local rootrec = C.klistpath(path, mask, CACHE1D.FIND_FILE + CACHE1D.FIND_NOCURDIR)
|
||||
C.pathsearchmode = opsm
|
||||
|
||||
if (rootrec == nil) then
|
||||
-- XXX: may have failed hard or just no matching files
|
||||
return {}
|
||||
end
|
||||
|
||||
local files = {}
|
||||
|
||||
local rec = rootrec
|
||||
while (rec ~= nil) do
|
||||
assert(rec.name ~= nil)
|
||||
files[#files+1] = ffi.string(rec.name)
|
||||
rec = rec.next
|
||||
end
|
||||
|
||||
C.klistfree(rootrec)
|
||||
|
||||
return files
|
||||
end
|
||||
|
||||
return fs
|
35
source/rr/src/lunatic/listglobals.sh
Normal file
|
@ -0,0 +1,35 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
# S or G can be used to display SETGLOBALs or GETGLOBALs, respectively
|
||||
echo "Usage: $0 [S|G] <files.lua...>"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
GS=
|
||||
|
||||
if [ "$1" = G ]; then
|
||||
GS=G
|
||||
shift
|
||||
elif [ "$1" = S ]; then
|
||||
GS=S
|
||||
shift
|
||||
fi
|
||||
|
||||
# Lua 5.2 required to parse ::label:: / goto generated by LunaCON.
|
||||
LUAC=luac
|
||||
|
||||
for f in "$@"; do
|
||||
if [ ! -f "$f" ]; then
|
||||
echo "$f: No such file"
|
||||
exit 2
|
||||
fi
|
||||
echo "[$f]"
|
||||
# Strip LuaJIT specific syntax first. Run luac and extract interesting lines.
|
||||
sed -r -e "s/[0-9]+U?LL/0/g" "$f" | $LUAC -p -l - | grep "${GS}ETTABUP.*; _ENV " |
|
||||
# Reformat them.
|
||||
sed -e 's/.*\[\(.*\)\].*\([SG]ET\)TABUP.*"\(.*\)".*/\1: \2 \3/' |
|
||||
# Mark where the new module environment starts.
|
||||
sed -e 's/GET module/& ____________________/'
|
||||
echo
|
||||
done
|