mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2024-12-26 14:45:38 +03:00
Remove hookers stuff
Refactoring & cleanup code
This commit is contained in:
parent
9a91e9ca38
commit
32df585edc
@ -1,26 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug MP Play|Win32">
|
||||
<Configuration>Debug MP Play</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug MP|Win32">
|
||||
<Configuration>Debug MP</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release MP Play|Win32">
|
||||
<Configuration>Release MP Play</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release MP|Win32">
|
||||
<Configuration>Release MP</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
@ -55,34 +39,6 @@
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MP|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MP|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release MP Play|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MP Play|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Nav|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
@ -104,18 +60,6 @@
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug MP|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release MP|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release MP Play|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug MP Play|Win32'" 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)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
@ -137,70 +81,6 @@
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug MP|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\include\</AdditionalIncludeDirectories>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release MP|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\include\</AdditionalIncludeDirectories>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release MP Play|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\include\</AdditionalIncludeDirectories>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug MP Play|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\include\</AdditionalIncludeDirectories>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.21005.1
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReGameDLL", "..\regamedll\msvc\ReGameDLL.vcxproj", "{70A2B904-B7DB-4C48-8DE0-AF567360D572}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
@ -20,47 +20,27 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "gradle", "gradle", "{DB5703
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug MP Play|Win32 = Debug MP Play|Win32
|
||||
Debug MP|Win32 = Debug MP|Win32
|
||||
Debug Play|Win32 = Debug Play|Win32
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release MP Play|Win32 = Release MP Play|Win32
|
||||
Release MP|Win32 = Release MP|Win32
|
||||
Release Play|Win32 = Release Play|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
Tests|Win32 = Tests|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Debug MP Play|Win32.ActiveCfg = Debug MP Play|Win32
|
||||
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Debug MP Play|Win32.Build.0 = Debug MP Play|Win32
|
||||
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Debug MP|Win32.ActiveCfg = Debug MP|Win32
|
||||
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Debug MP|Win32.Build.0 = Debug MP|Win32
|
||||
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Debug Play|Win32.ActiveCfg = Debug Play|Win32
|
||||
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Debug Play|Win32.Build.0 = Debug Play|Win32
|
||||
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Release MP Play|Win32.ActiveCfg = Release MP Play|Win32
|
||||
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Release MP Play|Win32.Build.0 = Release MP Play|Win32
|
||||
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Release MP|Win32.ActiveCfg = Release MP|Win32
|
||||
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Release MP|Win32.Build.0 = Release MP|Win32
|
||||
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Release Play|Win32.ActiveCfg = Release Play|Win32
|
||||
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Release Play|Win32.Build.0 = Release Play|Win32
|
||||
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Release|Win32.Build.0 = Release|Win32
|
||||
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Tests|Win32.ActiveCfg = Tests|Win32
|
||||
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Tests|Win32.Build.0 = Tests|Win32
|
||||
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Debug MP Play|Win32.ActiveCfg = Debug MP Play|Win32
|
||||
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Debug MP Play|Win32.Build.0 = Debug MP Play|Win32
|
||||
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Debug MP|Win32.ActiveCfg = Debug MP|Win32
|
||||
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Debug MP|Win32.Build.0 = Debug MP|Win32
|
||||
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Debug Play|Win32.ActiveCfg = Debug|Win32
|
||||
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Debug Play|Win32.Build.0 = Debug|Win32
|
||||
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Release MP Play|Win32.ActiveCfg = Release MP Play|Win32
|
||||
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Release MP Play|Win32.Build.0 = Release MP Play|Win32
|
||||
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Release MP|Win32.ActiveCfg = Release MP|Win32
|
||||
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Release MP|Win32.Build.0 = Release MP|Win32
|
||||
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Release Play|Win32.ActiveCfg = Release|Win32
|
||||
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Release Play|Win32.Build.0 = Release|Win32
|
||||
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Release|Win32.ActiveCfg = Release|Win32
|
||||
|
@ -21,31 +21,25 @@ task publishPrepareFiles {
|
||||
|
||||
pubRootDir.mkdirs()
|
||||
|
||||
// hookers binaries
|
||||
//project.file('publish/publishRoot/bin/hookers').mkdirs()
|
||||
//_copyFileToDir('publish/releaseRegamedllNofixes/filesystem_stdio.dll', 'publish/publishRoot/bin/hookers/')
|
||||
//_copyFileToDir('publish/releaseRegamedllNofixes/filesystem_stdio.pdb', 'publish/publishRoot/bin/hookers/')
|
||||
//_copyFile('publish/releaseRegamedllNofixes/libfilesystem_stdio.so', 'publish/publishRoot/bin/hookers/filesystem_stdio.so')
|
||||
|
||||
//bugfixed binaries
|
||||
// bugfixed binaries
|
||||
project.file('publish/publishRoot/bin/bugfixed').mkdirs()
|
||||
_copyFileToDir('publish/releaseRegamedllFixes/mp.dll', 'publish/publishRoot/bin/bugfixed/')
|
||||
_copyFileToDir('publish/releaseRegamedllFixes/mp.pdb', 'publish/publishRoot/bin/bugfixed/')
|
||||
_copyFile('publish/releaseRegamedllFixes/libcs.so', 'publish/publishRoot/bin/bugfixed/cs.so')
|
||||
|
||||
//pure binaries
|
||||
// pure binaries
|
||||
project.file('publish/publishRoot/bin/pure').mkdirs()
|
||||
_copyFileToDir('publish/releaseRegamedllNofixes/mp.dll', 'publish/publishRoot/bin/pure/')
|
||||
_copyFileToDir('publish/releaseRegamedllNofixes/mp.pdb', 'publish/publishRoot/bin/pure/')
|
||||
_copyFile('publish/releaseRegamedllNofixes/libcs.so', 'publish/publishRoot/bin/pure/cs.so')
|
||||
|
||||
//copy files from folder dist
|
||||
// copy files from folder dist
|
||||
copy {
|
||||
from('dist')
|
||||
into 'publish/publishRoot'
|
||||
}
|
||||
|
||||
//cssdk
|
||||
// cssdk
|
||||
project.file('publish/publishRoot/cssdk').mkdirs()
|
||||
copy {
|
||||
from 'regamedll/extra/cssdk'
|
||||
|
@ -45,12 +45,10 @@ project.ext.dep_cppunitlite = project(':dep/cppunitlite')
|
||||
|
||||
void createIntergrationTestTask(NativeBinarySpec b) {
|
||||
boolean regamedllFixes = b.flavor.name.contains('regamedllFixes')
|
||||
boolean mpLib = b.name.toLowerCase().contains('mp')
|
||||
|
||||
if (!(b instanceof SharedLibraryBinarySpec)) return
|
||||
if (!GradleCppUtils.windows) return
|
||||
if (regamedllFixes) return
|
||||
if (!mpLib) return
|
||||
|
||||
String unitTestTask = b.hasProperty('cppUnitTestTask') ? b.cppUnitTestTask : null
|
||||
|
||||
@ -93,11 +91,10 @@ void postEvaluate(NativeBinarySpec b) {
|
||||
void setupToolchain(NativeBinarySpec b)
|
||||
{
|
||||
boolean unitTestExecutable = b.component.name.endsWith('_tests')
|
||||
boolean mpLib = b.name.toLowerCase().contains('mp')
|
||||
boolean regamedllFixes = b.flavor.name.contains('regamedllFixes')
|
||||
|
||||
ToolchainConfig cfg = rootProject.createToolchainConfig(b)
|
||||
cfg.projectInclude(project, '', '/engine', '/common', '/dlls', '/game_shared', '/pm_shared', '/regamedll', '/hookers', '/public', '/public/regamedll')
|
||||
cfg.projectInclude(project, '', '/engine', '/common', '/dlls', '/game_shared', '/pm_shared', '/regamedll', '/public', '/public/regamedll')
|
||||
|
||||
if (unitTestExecutable)
|
||||
{
|
||||
@ -125,11 +122,6 @@ void setupToolchain(NativeBinarySpec b)
|
||||
cfg.compilerOptions.args '/Oi', '/GF', '/GS-', '/GR-'
|
||||
}
|
||||
|
||||
if (mpLib)
|
||||
{
|
||||
cfg.linkerOptions.randomizedBaseAddress = false
|
||||
cfg.linkerOptions.baseAddress = '0x4970000'
|
||||
}
|
||||
cfg.projectLibpath(project, '/lib')
|
||||
cfg.extraLibs 'libacof32.lib'
|
||||
}
|
||||
@ -159,14 +151,12 @@ void setupToolchain(NativeBinarySpec b)
|
||||
cfg.extraLibs 'dl', 'm', 'stdc++', 'aelf32'
|
||||
}
|
||||
|
||||
if (mpLib && GradleCppUtils.windows && !unitTestExecutable) {
|
||||
if (GradleCppUtils.windows && !unitTestExecutable) {
|
||||
cfg.linkerOptions.definitionFile = "${projectDir}\\msvc\\mp.def";
|
||||
}
|
||||
|
||||
if (unitTestExecutable) {
|
||||
cfg.singleDefines 'REGAMEDLL_UNIT_TESTS'
|
||||
} else if (!mpLib) {
|
||||
cfg.singleDefines 'HOOK_GAMEDLL'
|
||||
}
|
||||
|
||||
if (regamedllFixes) {
|
||||
@ -186,7 +176,7 @@ class RegamedllSrc {
|
||||
h.regamedll_src(CppSourceSet) {
|
||||
|
||||
source {
|
||||
srcDirs "engine", "dlls", "dlls/addons", "game_shared", "pm_shared", "regamedll", "public", "version"
|
||||
srcDirs "engine", "dlls", "dlls/API", "dlls/addons", "game_shared", "pm_shared", "regamedll", "public", "version"
|
||||
|
||||
include "**/*.cpp"
|
||||
exclude "precompiled.cpp"
|
||||
@ -214,24 +204,6 @@ class RegamedllSrc {
|
||||
}
|
||||
}
|
||||
|
||||
static void regamedll_hooker_src(def h) {
|
||||
h.regamedll_hooker_src(CppSourceSet) {
|
||||
source {
|
||||
srcDirs "hookers"
|
||||
include "main.cpp", "6153_hooker.cpp", "hooker.cpp", "memory.cpp", "hooker_impl.cpp", "RegameDLLRuntimeConfig.cpp"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void regamedll_mp_src(def h) {
|
||||
h.regamedll_mp_src(CppSourceSet) {
|
||||
source {
|
||||
srcDirs "hookers"
|
||||
include "main_mp.cpp"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void regamedll_tests_src(def h) {
|
||||
h.regamedll_tests_src(CppSourceSet) {
|
||||
source {
|
||||
@ -267,18 +239,6 @@ model {
|
||||
}
|
||||
|
||||
components {
|
||||
regamedll_hooker_gamedll(NativeLibrarySpec) {
|
||||
targetPlatform 'x86'
|
||||
baseName 'filesystem_stdio'
|
||||
|
||||
sources {
|
||||
RegamedllSrc.regamedll_pch(it)
|
||||
RegamedllSrc.regamedll_src(it)
|
||||
RegamedllSrc.regamedll_hooker_src(it)
|
||||
}
|
||||
|
||||
binaries.all { NativeBinarySpec b -> project.setupToolchain(b) }
|
||||
}
|
||||
|
||||
regamedll_mp_gamedll(NativeLibrarySpec) {
|
||||
targetPlatform 'x86'
|
||||
@ -286,22 +246,10 @@ model {
|
||||
sources {
|
||||
RegamedllSrc.regamedll_pch(it)
|
||||
RegamedllSrc.regamedll_src(it)
|
||||
RegamedllSrc.regamedll_mp_src(it)
|
||||
}
|
||||
binaries.all { NativeBinarySpec b -> project.setupToolchain(b) }
|
||||
}
|
||||
|
||||
regamedll_hooker_gamedll_tests(NativeExecutableSpec) {
|
||||
targetPlatform 'x86'
|
||||
sources {
|
||||
RegamedllSrc.regamedll_pch(it)
|
||||
RegamedllSrc.regamedll_src(it)
|
||||
RegamedllSrc.regamedll_tests_src(it)
|
||||
}
|
||||
|
||||
binaries.all { NativeBinarySpec b -> project.setupToolchain(b) }
|
||||
}
|
||||
|
||||
regamedll_mp_gamedll_tests(NativeExecutableSpec) {
|
||||
targetPlatform 'x86'
|
||||
sources {
|
||||
@ -317,7 +265,7 @@ model {
|
||||
|
||||
task buildRelease {
|
||||
dependsOn binaries.withType(SharedLibraryBinarySpec).matching { SharedLibraryBinarySpec blib ->
|
||||
blib.buildable && blib.buildType.name == 'release' && !blib.name.contains('Regamedll_hooker_gamedll')
|
||||
blib.buildable && blib.buildType.name == 'release'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,22 +90,6 @@ const T& clamp(const T& a, const T& min, const T& max) { return (a > max) ? max
|
||||
#define clamp(val, min, max) (((val) > (max)) ? (max) : (((val) < (min)) ? (min) : (val)))
|
||||
#endif // __cplusplus
|
||||
|
||||
// bitwise operators templates
|
||||
//template<class T, class type=typename std::underlying_type<T>::type>
|
||||
//inline T operator~ (T a) { return (T)~(type)a; }
|
||||
//template<class T, class type=typename std::underlying_type<T>::type>
|
||||
//inline T operator| (T a, T b) { return (T)((type)a | (type)b); }
|
||||
//template<class T, class type=typename std::underlying_type<T>::type>
|
||||
//inline T operator& (T a, T b) { return (T)((type)a & (type)b); }
|
||||
//template<class T, class type=typename std::underlying_type<T>::type>
|
||||
//inline T operator^ (T a, T b) { return (T)((type)a ^ (type)b); }
|
||||
//template<class T, class type=typename std::underlying_type<T>::type>
|
||||
//inline T& operator|= (T& a, T b) { return (T&)((type&)a |= (type)b); }
|
||||
//template<class T, class type=typename std::underlying_type<T>::type>
|
||||
//inline T& operator&= (T& a, T b) { return (T&)((type&)a &= (type)b); }
|
||||
//template<class T, class type=typename std::underlying_type<T>::type>
|
||||
//inline T& operator^= (T& a, T b) { return (T&)((type&)a ^= (type)b); }
|
||||
|
||||
inline float M_sqrt(float value) {
|
||||
return _mm_cvtss_f32(_mm_sqrt_ss(_mm_load_ss(&value)));
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
#if _MSC_VER >= 1500 // MSVC++ 9.0 (Visual Studio 2008)
|
||||
#pragma push_macro("ARRAYSIZE")
|
||||
#ifdef ARRAYSIZE
|
||||
#undef ARRAYSIZE
|
||||
#endif
|
||||
#define HSPRITE WINDOWS_HSPRITE
|
||||
#endif
|
@ -1,4 +0,0 @@
|
||||
#if _MSC_VER >= 1500 // MSVC++ 9.0 (Visual Studio 2008)
|
||||
#undef HSPRITE
|
||||
#pragma pop_macro("ARRAYSIZE")
|
||||
#endif
|
@ -143,48 +143,48 @@ GAMEHOOK_REGISTRY(CSGameRules_OnRoundFreezeEnd);
|
||||
GAMEHOOK_REGISTRY(PM_UpdateStepSound);
|
||||
GAMEHOOK_REGISTRY(CBasePlayer_StartDeathCam);
|
||||
|
||||
int EXT_FUNC CReGameApi::GetMajorVersion() {
|
||||
int CReGameApi::GetMajorVersion() {
|
||||
return REGAMEDLL_API_VERSION_MAJOR;
|
||||
}
|
||||
|
||||
int EXT_FUNC CReGameApi::GetMinorVersion() {
|
||||
int CReGameApi::GetMinorVersion() {
|
||||
return REGAMEDLL_API_VERSION_MINOR;
|
||||
}
|
||||
|
||||
const EXT_FUNC ReGameFuncs_t *CReGameApi::GetFuncs() {
|
||||
const ReGameFuncs_t *CReGameApi::GetFuncs() {
|
||||
return &g_ReGameApiFuncs;
|
||||
}
|
||||
|
||||
IReGameHookchains *EXT_FUNC CReGameApi::GetHookchains() {
|
||||
IReGameHookchains *CReGameApi::GetHookchains() {
|
||||
return &g_ReGameHookchains;
|
||||
}
|
||||
|
||||
CGameRules *EXT_FUNC CReGameApi::GetGameRules() {
|
||||
CGameRules *CReGameApi::GetGameRules() {
|
||||
return g_pGameRules;
|
||||
}
|
||||
|
||||
WeaponInfoStruct *EXT_FUNC CReGameApi::GetWeaponInfo(int weaponID) {
|
||||
WeaponInfoStruct *CReGameApi::GetWeaponInfo(int weaponID) {
|
||||
return ::GetWeaponInfo(weaponID);
|
||||
}
|
||||
|
||||
WeaponInfoStruct *EXT_FUNC CReGameApi::GetWeaponInfo(const char *weaponName) {
|
||||
WeaponInfoStruct *CReGameApi::GetWeaponInfo(const char *weaponName) {
|
||||
return ::GetWeaponInfo(weaponName);
|
||||
}
|
||||
|
||||
playermove_t *EXT_FUNC CReGameApi::GetPlayerMove() {
|
||||
playermove_t *CReGameApi::GetPlayerMove() {
|
||||
return pmove;
|
||||
}
|
||||
|
||||
WeaponSlotInfo *EXT_FUNC CReGameApi::GetWeaponSlot(WeaponIdType weaponID) { return ::GetWeaponSlot(weaponID); }
|
||||
WeaponSlotInfo *EXT_FUNC CReGameApi::GetWeaponSlot(const char *weaponName) { return ::GetWeaponSlot(weaponName); }
|
||||
WeaponSlotInfo *CReGameApi::GetWeaponSlot(WeaponIdType weaponID) { return ::GetWeaponSlot(weaponID); }
|
||||
WeaponSlotInfo *CReGameApi::GetWeaponSlot(const char *weaponName) { return ::GetWeaponSlot(weaponName); }
|
||||
|
||||
ItemInfo *EXT_FUNC CReGameApi::GetItemInfo(WeaponIdType weaponID) { return &IMPL_CLASS(CBasePlayerItem, m_ItemInfoArray)[weaponID]; }
|
||||
AmmoInfo *EXT_FUNC CReGameApi::GetAmmoInfo(AmmoType ammoID) { return &IMPL_CLASS(CBasePlayerItem, m_AmmoInfoArray)[ammoID]; }
|
||||
ItemInfo *CReGameApi::GetItemInfo(WeaponIdType weaponID) { return &CBasePlayerItem::m_ItemInfoArray[weaponID]; }
|
||||
AmmoInfo *CReGameApi::GetAmmoInfo(AmmoType ammoID) { return &CBasePlayerItem::m_AmmoInfoArray[ammoID]; }
|
||||
|
||||
AmmoInfoStruct *EXT_FUNC CReGameApi::GetAmmoInfoEx(AmmoType ammoID) { return ::GetAmmoInfo(ammoID); }
|
||||
AmmoInfoStruct *EXT_FUNC CReGameApi::GetAmmoInfoEx(const char *ammoName) { return ::GetAmmoInfo(ammoName); }
|
||||
AmmoInfoStruct *CReGameApi::GetAmmoInfoEx(AmmoType ammoID) { return ::GetAmmoInfo(ammoID); }
|
||||
AmmoInfoStruct *CReGameApi::GetAmmoInfoEx(const char *ammoName) { return ::GetAmmoInfo(ammoName); }
|
||||
|
||||
void EXT_FUNC Regamedll_ChangeString_api(char *&dest, const char *source)
|
||||
EXT_FUNC void Regamedll_ChangeString_api(char *&dest, const char *source)
|
||||
{
|
||||
size_t len = Q_strlen(source);
|
||||
if (dest == nullptr || Q_strlen(dest) != len) {
|
||||
@ -195,22 +195,22 @@ void EXT_FUNC Regamedll_ChangeString_api(char *&dest, const char *source)
|
||||
Q_strcpy(dest, source);
|
||||
}
|
||||
|
||||
void EXT_FUNC RadiusDamage_api(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType)
|
||||
EXT_FUNC void RadiusDamage_api(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType)
|
||||
{
|
||||
RadiusDamage(vecSrc, pevInflictor, pevAttacker, flDamage, flRadius, iClassIgnore, bitsDamageType);
|
||||
}
|
||||
|
||||
void EXT_FUNC ClearMultiDamage_api()
|
||||
EXT_FUNC void ClearMultiDamage_api()
|
||||
{
|
||||
ClearMultiDamage();
|
||||
}
|
||||
|
||||
void EXT_FUNC ApplyMultiDamage_api(entvars_t *pevInflictor, entvars_t *pevAttacker)
|
||||
EXT_FUNC void ApplyMultiDamage_api(entvars_t *pevInflictor, entvars_t *pevAttacker)
|
||||
{
|
||||
ApplyMultiDamage(pevInflictor, pevAttacker);
|
||||
}
|
||||
|
||||
void EXT_FUNC AddMultiDamage_api(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType)
|
||||
EXT_FUNC void AddMultiDamage_api(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType)
|
||||
{
|
||||
AddMultiDamage(pevInflictor, pEntity, flDamage, bitsDamageType);
|
||||
}
|
@ -30,7 +30,86 @@
|
||||
|
||||
#include "archtypes.h"
|
||||
#include "regamedll_api.h"
|
||||
#include "regamedll_interfaces_impl.h"
|
||||
|
||||
#ifdef REGAMEDLL_API
|
||||
|
||||
#define __API_HOOK(fname)\
|
||||
fname##_OrigFunc
|
||||
|
||||
#define LINK_HOOK_CLASS_VOID_CHAIN(className, functionName, args, ...)\
|
||||
void className::functionName args {\
|
||||
g_ReGameHookchains.m_##className##_##functionName.callChain(&className::functionName##_OrigFunc, this, __VA_ARGS__);\
|
||||
}
|
||||
#define LINK_HOOK_CLASS_VOID_CHAIN2(className, functionName)\
|
||||
void EXT_FUNC className::functionName() {\
|
||||
g_ReGameHookchains.m_##className##_##functionName.callChain(&className::functionName##_OrigFunc, this);\
|
||||
}
|
||||
|
||||
#define LINK_HOOK_CLASS_CHAIN(ret, className, functionName, args, ...)\
|
||||
ret className::functionName args {\
|
||||
return g_ReGameHookchains.m_##className##_##functionName.callChain(&className::functionName##_OrigFunc, this, __VA_ARGS__);\
|
||||
}
|
||||
#define LINK_HOOK_CLASS_CHAIN2(ret, className, functionName)\
|
||||
ret className::functionName() {\
|
||||
return g_ReGameHookchains.m_##className##_##functionName.callChain(&className::functionName##_OrigFunc, this);\
|
||||
}
|
||||
|
||||
#define LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN(className, customPrefix, functionName, args, ...)\
|
||||
void className::functionName args {\
|
||||
g_ReGameHookchains.m_##customPrefix##_##functionName.callChain(&className::functionName##_OrigFunc, this, __VA_ARGS__);\
|
||||
}
|
||||
#define LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(className, customPrefix, functionName)\
|
||||
void className::functionName() {\
|
||||
g_ReGameHookchains.m_##customPrefix##_##functionName.callChain(&className::functionName##_OrigFunc, this);\
|
||||
}
|
||||
|
||||
#define LINK_HOOK_CLASS_CUSTOM_CHAIN(ret, className, customPrefix, functionName, args, ...)\
|
||||
ret className::functionName args {\
|
||||
return g_ReGameHookchains.m_##customPrefix##_##functionName.callChain(&className::functionName##_OrigFunc, this, __VA_ARGS__);\
|
||||
}
|
||||
#define LINK_HOOK_CLASS_CUSTOM_CHAIN2(ret, className, customPrefix, functionName)\
|
||||
ret className::functionName() {\
|
||||
return g_ReGameHookchains.m_##customPrefix##_##functionName.callChain(&className::functionName##_OrigFunc, this);\
|
||||
}
|
||||
|
||||
#define LINK_HOOK_VOID_CHAIN(functionName, args, ...)\
|
||||
void functionName args {\
|
||||
g_ReGameHookchains.m_##functionName.callChain(functionName##_OrigFunc, __VA_ARGS__);\
|
||||
}
|
||||
|
||||
#define LINK_HOOK_CHAIN(ret, functionName, args, ...)\
|
||||
ret functionName args {\
|
||||
return g_ReGameHookchains.m_##functionName.callChain(functionName##_OrigFunc, __VA_ARGS__);\
|
||||
}
|
||||
|
||||
#define LINK_HOOK_VOID_CHAIN2(functionName)\
|
||||
void functionName() {\
|
||||
g_ReGameHookchains.m_##functionName.callChain(functionName##_OrigFunc);\
|
||||
}
|
||||
|
||||
#define LINK_HOOK_CHAIN2(ret, functionName)\
|
||||
ret functionName() {\
|
||||
return g_ReGameHookchains.m_##functionName.callChain(functionName##_OrigFunc);\
|
||||
}
|
||||
#else
|
||||
|
||||
#define __API_HOOK(fname)\
|
||||
fname
|
||||
|
||||
#define LINK_HOOK_CLASS_VOID_CHAIN(...)
|
||||
#define LINK_HOOK_CLASS_VOID_CHAIN2(...)
|
||||
#define LINK_HOOK_CLASS_CHAIN(...)
|
||||
#define LINK_HOOK_CLASS_CHAIN2(...)
|
||||
#define LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN(...)
|
||||
#define LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(...)
|
||||
#define LINK_HOOK_CLASS_CUSTOM_CHAIN(...)
|
||||
#define LINK_HOOK_CLASS_CUSTOM_CHAIN2(...)
|
||||
#define LINK_HOOK_VOID_CHAIN(...)
|
||||
#define LINK_HOOK_VOID_CHAIN2(...)
|
||||
#define LINK_HOOK_CHAIN(...)
|
||||
#define LINK_HOOK_CHAIN2(...)
|
||||
|
||||
#endif // REGAMEDLL_API
|
||||
|
||||
#define GAMEHOOK_REGISTRY(func)\
|
||||
IReGameHookRegistry_##func *CReGameHookchains::func() { return &m_##func; }
|
||||
@ -541,22 +620,22 @@ extern ReGameFuncs_t g_ReGameApiFuncs;
|
||||
|
||||
class CReGameApi: public IReGameApi {
|
||||
public:
|
||||
virtual int GetMajorVersion();
|
||||
virtual int GetMinorVersion();
|
||||
EXT_FUNC virtual int GetMajorVersion();
|
||||
EXT_FUNC virtual int GetMinorVersion();
|
||||
|
||||
virtual const ReGameFuncs_t *GetFuncs();
|
||||
virtual IReGameHookchains *GetHookchains();
|
||||
EXT_FUNC virtual const ReGameFuncs_t *GetFuncs();
|
||||
EXT_FUNC virtual IReGameHookchains *GetHookchains();
|
||||
|
||||
virtual CGameRules *GetGameRules();
|
||||
virtual WeaponInfoStruct *GetWeaponInfo(int weaponID);
|
||||
virtual WeaponInfoStruct *GetWeaponInfo(const char *weaponName);
|
||||
virtual playermove_t *GetPlayerMove();
|
||||
virtual WeaponSlotInfo *GetWeaponSlot(WeaponIdType weaponID);
|
||||
virtual WeaponSlotInfo *GetWeaponSlot(const char *weaponName);
|
||||
virtual ItemInfo *GetItemInfo(WeaponIdType weaponID);
|
||||
virtual AmmoInfo *GetAmmoInfo(AmmoType ammoID);
|
||||
virtual AmmoInfoStruct *GetAmmoInfoEx(AmmoType ammoID);
|
||||
virtual AmmoInfoStruct *GetAmmoInfoEx(const char *ammoName);
|
||||
EXT_FUNC virtual CGameRules *GetGameRules();
|
||||
EXT_FUNC virtual WeaponInfoStruct *GetWeaponInfo(int weaponID);
|
||||
EXT_FUNC virtual WeaponInfoStruct *GetWeaponInfo(const char *weaponName);
|
||||
EXT_FUNC virtual playermove_t *GetPlayerMove();
|
||||
EXT_FUNC virtual WeaponSlotInfo *GetWeaponSlot(WeaponIdType weaponID);
|
||||
EXT_FUNC virtual WeaponSlotInfo *GetWeaponSlot(const char *weaponName);
|
||||
EXT_FUNC virtual ItemInfo *GetItemInfo(WeaponIdType weaponID);
|
||||
EXT_FUNC virtual AmmoInfo *GetAmmoInfo(AmmoType ammoID);
|
||||
EXT_FUNC virtual AmmoInfoStruct *GetAmmoInfoEx(AmmoType ammoID);
|
||||
EXT_FUNC virtual AmmoInfoStruct *GetAmmoInfoEx(const char *ammoName);
|
||||
};
|
||||
|
||||
void Regamedll_ChangeString_api(char *&dest, const char *source);
|
39
regamedll/dlls/API/CSEntity.cpp
Normal file
39
regamedll/dlls/API/CSEntity.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
void CCSEntity::FireBullets(int iShots, Vector &vecSrc, Vector &vecDirShooting, Vector &vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker)
|
||||
{
|
||||
m_pContainingEntity->FireBullets(iShots, vecSrc, vecDirShooting, vecSpread, flDistance, iBulletType, iTracerFreq, iDamage, pevAttacker);
|
||||
}
|
||||
|
||||
Vector CCSEntity::FireBullets3(Vector &vecSrc, Vector &vecDirShooting, float vecSpread, float flDistance, int iPenetration, int iBulletType, int iDamage, float flRangeModifier, entvars_t *pevAttacker, bool bPistol, int shared_rand)
|
||||
{
|
||||
return m_pContainingEntity->FireBullets3(vecSrc, vecDirShooting, vecSpread, flDistance, iPenetration, iBulletType, iDamage, flRangeModifier, pevAttacker, bPistol, shared_rand);
|
||||
}
|
@ -28,15 +28,7 @@
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
void EXT_FUNC CCSEntity::FireBullets(int iShots, Vector &vecSrc, Vector &vecDirShooting, Vector &vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker) {
|
||||
m_pContainingEntity->FireBullets(iShots, vecSrc, vecDirShooting, vecSpread, flDistance, iBulletType, iTracerFreq, iDamage, pevAttacker);
|
||||
};
|
||||
|
||||
Vector EXT_FUNC CCSEntity::FireBullets3(Vector &vecSrc, Vector &vecDirShooting, float vecSpread, float flDistance, int iPenetration, int iBulletType, int iDamage, float flRangeModifier, entvars_t *pevAttacker, bool bPistol, int shared_rand) {
|
||||
return m_pContainingEntity->FireBullets3(vecSrc, vecDirShooting, vecSpread, flDistance, iPenetration, iBulletType, iDamage, flRangeModifier, pevAttacker, bPistol, shared_rand);
|
||||
};
|
||||
|
||||
bool EXT_FUNC CCSPlayer::JoinTeam(TeamName team)
|
||||
EXT_FUNC bool CCSPlayer::JoinTeam(TeamName team)
|
||||
{
|
||||
CBasePlayer *pPlayer = BasePlayer();
|
||||
switch (team)
|
||||
@ -140,7 +132,7 @@ bool EXT_FUNC CCSPlayer::JoinTeam(TeamName team)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EXT_FUNC CCSPlayer::RemovePlayerItem(const char *pszItemName)
|
||||
EXT_FUNC bool CCSPlayer::RemovePlayerItem(const char *pszItemName)
|
||||
{
|
||||
if (!pszItemName)
|
||||
return false;
|
||||
@ -148,7 +140,8 @@ bool EXT_FUNC CCSPlayer::RemovePlayerItem(const char *pszItemName)
|
||||
CBasePlayer *pPlayer = BasePlayer();
|
||||
|
||||
// if it item_ ?
|
||||
if (pszItemName[0] == 'i') {
|
||||
if (pszItemName[0] == 'i')
|
||||
{
|
||||
pszItemName += sizeof("item_") - 1;
|
||||
|
||||
// item_thighpack
|
||||
@ -208,7 +201,8 @@ bool EXT_FUNC CCSPlayer::RemovePlayerItem(const char *pszItemName)
|
||||
return true;
|
||||
}
|
||||
|
||||
else if (FStrEq(pszItemName, "weapon_shield")) {
|
||||
else if (FStrEq(pszItemName, "weapon_shield"))
|
||||
{
|
||||
if (!pPlayer->HasShield())
|
||||
return false;
|
||||
|
||||
@ -223,7 +217,7 @@ bool EXT_FUNC CCSPlayer::RemovePlayerItem(const char *pszItemName)
|
||||
|
||||
if (pWeapon->m_iId == WEAPON_HEGRENADE || pWeapon->m_iId == WEAPON_FLASHBANG || pWeapon->m_iId == WEAPON_SMOKEGRENADE)
|
||||
{
|
||||
if (pPlayer->m_rgAmmo[ pWeapon->m_iPrimaryAmmoType ] <= 0)
|
||||
if (pPlayer->m_rgAmmo[pWeapon->m_iPrimaryAmmoType] <= 0)
|
||||
g_pGameRules->GetNextBestWeapon(pPlayer, pWeapon);
|
||||
}
|
||||
|
||||
@ -274,7 +268,7 @@ bool EXT_FUNC CCSPlayer::RemovePlayerItem(const char *pszItemName)
|
||||
return false;
|
||||
}
|
||||
|
||||
CBaseEntity *EXT_FUNC CCSPlayer::GiveNamedItemEx(const char *pszName)
|
||||
EXT_FUNC CBaseEntity *CCSPlayer::GiveNamedItemEx(const char *pszName)
|
||||
{
|
||||
CBasePlayer *pPlayer = BasePlayer();
|
||||
|
||||
@ -294,41 +288,192 @@ CBaseEntity *EXT_FUNC CCSPlayer::GiveNamedItemEx(const char *pszName)
|
||||
return pPlayer->GiveNamedItemEx(pszName);
|
||||
}
|
||||
|
||||
bool EXT_FUNC CCSPlayer::IsConnected() const { return m_pContainingEntity->has_disconnected == false; }
|
||||
void EXT_FUNC CCSPlayer::SetAnimation(PLAYER_ANIM playerAnim) { BasePlayer()->SetAnimation(playerAnim); }
|
||||
void EXT_FUNC CCSPlayer::AddAccount(int amount, RewardType type, bool bTrackChange) { BasePlayer()->AddAccount(amount, type, bTrackChange); }
|
||||
CBaseEntity *EXT_FUNC CCSPlayer::GiveNamedItem(const char *pszName) { return BasePlayer()->GiveNamedItem(pszName); }
|
||||
void EXT_FUNC CCSPlayer::GiveDefaultItems() { BasePlayer()->GiveDefaultItems(); }
|
||||
void EXT_FUNC CCSPlayer::GiveShield(bool bDeploy) { BasePlayer()->GiveShield(bDeploy); }
|
||||
void EXT_FUNC CCSPlayer::DropShield(bool bDeploy) { BasePlayer()->DropShield(bDeploy); }
|
||||
void EXT_FUNC CCSPlayer::DropPlayerItem(const char *pszItemName) { BasePlayer()->DropPlayerItem(pszItemName); }
|
||||
void EXT_FUNC CCSPlayer::RemoveShield() { BasePlayer()->RemoveShield(); }
|
||||
void EXT_FUNC CCSPlayer::RemoveAllItems(bool bRemoveSuit) { BasePlayer()->RemoveAllItems(bRemoveSuit ? TRUE : FALSE); }
|
||||
void EXT_FUNC CCSPlayer::SetPlayerModel(bool bHasC4) { BasePlayer()->SetPlayerModel(bHasC4 ? TRUE : FALSE); }
|
||||
void EXT_FUNC CCSPlayer::SetPlayerModelEx(const char *modelName) { Q_strncpy(m_szModel, modelName, sizeof(m_szModel) - 1); m_szModel[sizeof(m_szModel) - 1] = '\0'; };
|
||||
void EXT_FUNC CCSPlayer::SetNewPlayerModel(const char *modelName) { BasePlayer()->SetNewPlayerModel(STRING(ALLOC_STRING(modelName))); }
|
||||
void EXT_FUNC CCSPlayer::ClientCommand(const char *cmd, const char *arg1, const char *arg2, const char *arg3) { BasePlayer()->ClientCommand(cmd, arg1, arg2, arg3); }
|
||||
void EXT_FUNC CCSPlayer::SetProgressBarTime(int time) { BasePlayer()->SetProgressBarTime(time); }
|
||||
void EXT_FUNC CCSPlayer::SetProgressBarTime2(int time, float timeElapsed) { BasePlayer()->SetProgressBarTime2(time, timeElapsed); }
|
||||
edict_t *EXT_FUNC CCSPlayer::EntSelectSpawnPoint() { return BasePlayer()->EntSelectSpawnPoint(); }
|
||||
void EXT_FUNC CCSPlayer::SendItemStatus() { BasePlayer()->SendItemStatus(); }
|
||||
void EXT_FUNC CCSPlayer::SetBombIcon(bool bFlash) { BasePlayer()->SetBombIcon(bFlash ? TRUE : FALSE); }
|
||||
void EXT_FUNC CCSPlayer::SetScoreAttrib(CBasePlayer *dest) { BasePlayer()->SetScoreAttrib(dest); }
|
||||
void EXT_FUNC CCSPlayer::ReloadWeapons(CBasePlayerItem *pWeapon, bool bForceReload, bool bForceRefill) { BasePlayer()->ReloadWeapons(pWeapon, bForceReload, bForceRefill); }
|
||||
void EXT_FUNC CCSPlayer::Observer_SetMode(int iMode) { BasePlayer()->Observer_SetMode(iMode); }
|
||||
bool EXT_FUNC CCSPlayer::SelectSpawnSpot(const char *pEntClassName, CBaseEntity *&pSpot) { return BasePlayer()->SelectSpawnSpot(pEntClassName, pSpot); }
|
||||
bool EXT_FUNC CCSPlayer::SwitchWeapon(CBasePlayerItem *pWeapon) { return BasePlayer()->SwitchWeapon(pWeapon) != FALSE; }
|
||||
void EXT_FUNC CCSPlayer::SwitchTeam() { BasePlayer()->SwitchTeam(); }
|
||||
void EXT_FUNC CCSPlayer::StartObserver(Vector& vecPosition, Vector& vecViewAngle) { BasePlayer()->StartObserver(vecPosition, vecViewAngle); }
|
||||
void EXT_FUNC CCSPlayer::TeamChangeUpdate() { BasePlayer()->TeamChangeUpdate(); }
|
||||
void EXT_FUNC CCSPlayer::DropSecondary() { BasePlayer()->DropSecondary(); }
|
||||
void EXT_FUNC CCSPlayer::DropPrimary() { BasePlayer()->DropPrimary(); }
|
||||
bool EXT_FUNC CCSPlayer::HasPlayerItem(CBasePlayerItem *pCheckItem) { return BasePlayer()->HasPlayerItem(pCheckItem); }
|
||||
bool EXT_FUNC CCSPlayer::HasNamedPlayerItem(const char *pszItemName) { return BasePlayer()->HasNamedPlayerItem(pszItemName); }
|
||||
CBasePlayerItem *EXT_FUNC CCSPlayer::GetItemById(WeaponIdType weaponID) { return BasePlayer()->GetItemById(weaponID); }
|
||||
CBasePlayerItem *EXT_FUNC CCSPlayer::GetItemByName(const char *itemName) { return BasePlayer()->GetItemByName(itemName); }
|
||||
void EXT_FUNC CCSPlayer::Disappear() { BasePlayer()->Disappear(); }
|
||||
void EXT_FUNC CCSPlayer::MakeVIP() { BasePlayer()->MakeVIP(); }
|
||||
bool EXT_FUNC CCSPlayer::MakeBomber() { return BasePlayer()->MakeBomber(); }
|
||||
void EXT_FUNC CCSPlayer::ResetSequenceInfo() { BasePlayer()->ResetSequenceInfo(); }
|
||||
void EXT_FUNC CCSPlayer::StartDeathCam() { BasePlayer()->StartDeathCam(); }
|
||||
EXT_FUNC bool CCSPlayer::IsConnected() const
|
||||
{
|
||||
return m_pContainingEntity->has_disconnected == false;
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::SetAnimation(PLAYER_ANIM playerAnim)
|
||||
{
|
||||
BasePlayer()->SetAnimation(playerAnim);
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::AddAccount(int amount, RewardType type, bool bTrackChange)
|
||||
{
|
||||
BasePlayer()->AddAccount(amount, type, bTrackChange);
|
||||
}
|
||||
|
||||
EXT_FUNC CBaseEntity *CCSPlayer::GiveNamedItem(const char *pszName)
|
||||
{
|
||||
return BasePlayer()->GiveNamedItem(pszName);
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::GiveDefaultItems()
|
||||
{
|
||||
BasePlayer()->GiveDefaultItems();
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::GiveShield(bool bDeploy)
|
||||
{
|
||||
BasePlayer()->GiveShield(bDeploy);
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::DropShield(bool bDeploy)
|
||||
{
|
||||
BasePlayer()->DropShield(bDeploy);
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::DropPlayerItem(const char *pszItemName)
|
||||
{
|
||||
BasePlayer()->DropPlayerItem(pszItemName);
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::RemoveShield()
|
||||
{
|
||||
BasePlayer()->RemoveShield();
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::RemoveAllItems(bool bRemoveSuit)
|
||||
{
|
||||
BasePlayer()->RemoveAllItems(bRemoveSuit ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::SetPlayerModel(bool bHasC4)
|
||||
{
|
||||
BasePlayer()->SetPlayerModel(bHasC4 ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::SetPlayerModelEx(const char *modelName)
|
||||
{
|
||||
Q_strlcpy(m_szModel, modelName);
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::SetNewPlayerModel(const char *modelName)
|
||||
{
|
||||
BasePlayer()->SetNewPlayerModel(STRING(ALLOC_STRING(modelName)));
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::ClientCommand(const char *cmd, const char *arg1, const char *arg2, const char *arg3)
|
||||
{
|
||||
BasePlayer()->ClientCommand(cmd, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::SetProgressBarTime(int time)
|
||||
{
|
||||
BasePlayer()->SetProgressBarTime(time);
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::SetProgressBarTime2(int time, float timeElapsed)
|
||||
{
|
||||
BasePlayer()->SetProgressBarTime2(time, timeElapsed);
|
||||
}
|
||||
|
||||
EXT_FUNC edict_t *CCSPlayer::EntSelectSpawnPoint()
|
||||
{
|
||||
return BasePlayer()->EntSelectSpawnPoint();
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::SendItemStatus()
|
||||
{
|
||||
BasePlayer()->SendItemStatus();
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::SetBombIcon(bool bFlash)
|
||||
{
|
||||
BasePlayer()->SetBombIcon(bFlash ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::SetScoreAttrib(CBasePlayer *dest)
|
||||
{
|
||||
BasePlayer()->SetScoreAttrib(dest);
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::ReloadWeapons(CBasePlayerItem *pWeapon, bool bForceReload, bool bForceRefill)
|
||||
{
|
||||
BasePlayer()->ReloadWeapons(pWeapon, bForceReload, bForceRefill);
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::Observer_SetMode(int iMode)
|
||||
{
|
||||
BasePlayer()->Observer_SetMode(iMode);
|
||||
}
|
||||
|
||||
EXT_FUNC bool CCSPlayer::SelectSpawnSpot(const char *pEntClassName, CBaseEntity *&pSpot)
|
||||
{
|
||||
return BasePlayer()->SelectSpawnSpot(pEntClassName, pSpot);
|
||||
}
|
||||
|
||||
EXT_FUNC bool CCSPlayer::SwitchWeapon(CBasePlayerItem *pWeapon)
|
||||
{
|
||||
return BasePlayer()->SwitchWeapon(pWeapon) != FALSE;
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::SwitchTeam()
|
||||
{
|
||||
BasePlayer()->SwitchTeam();
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::StartObserver(Vector& vecPosition, Vector& vecViewAngle)
|
||||
{
|
||||
BasePlayer()->StartObserver(vecPosition, vecViewAngle);
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::TeamChangeUpdate()
|
||||
{
|
||||
BasePlayer()->TeamChangeUpdate();
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::DropSecondary()
|
||||
{
|
||||
BasePlayer()->DropSecondary();
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::DropPrimary()
|
||||
{
|
||||
BasePlayer()->DropPrimary();
|
||||
}
|
||||
|
||||
EXT_FUNC bool CCSPlayer::HasPlayerItem(CBasePlayerItem *pCheckItem)
|
||||
{
|
||||
return BasePlayer()->HasPlayerItem(pCheckItem);
|
||||
}
|
||||
|
||||
EXT_FUNC bool CCSPlayer::HasNamedPlayerItem(const char *pszItemName)
|
||||
{
|
||||
return BasePlayer()->HasNamedPlayerItem(pszItemName);
|
||||
}
|
||||
|
||||
EXT_FUNC CBasePlayerItem *CCSPlayer::GetItemById(WeaponIdType weaponID)
|
||||
{
|
||||
return BasePlayer()->GetItemById(weaponID);
|
||||
}
|
||||
|
||||
EXT_FUNC CBasePlayerItem *CCSPlayer::GetItemByName(const char *itemName)
|
||||
{
|
||||
return BasePlayer()->GetItemByName(itemName);
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::Disappear()
|
||||
{
|
||||
BasePlayer()->Disappear();
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::MakeVIP()
|
||||
{
|
||||
BasePlayer()->MakeVIP();
|
||||
}
|
||||
|
||||
EXT_FUNC bool CCSPlayer::MakeBomber()
|
||||
{
|
||||
return BasePlayer()->MakeBomber();
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::ResetSequenceInfo()
|
||||
{
|
||||
BasePlayer()->ResetSequenceInfo();
|
||||
}
|
||||
|
||||
EXT_FUNC void CCSPlayer::StartDeathCam()
|
||||
{
|
||||
BasePlayer()->StartDeathCam();
|
||||
}
|
46
regamedll/dlls/API/CSPlayerItem.cpp
Normal file
46
regamedll/dlls/API/CSPlayerItem.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
EXT_FUNC void CCSPlayerItem::SetItemInfo(ItemInfo *pInfo)
|
||||
{
|
||||
Q_memcpy(&m_ItemInfo, pInfo, sizeof(m_ItemInfo));
|
||||
}
|
||||
|
||||
#ifdef REGAMEDLL_API
|
||||
int CBasePlayerItem::iPosition() const { return CSPlayerItem()->m_ItemInfo.iPosition; }
|
||||
const char *CBasePlayerItem::pszAmmo1() const { return CSPlayerItem()->m_ItemInfo.pszAmmo1; }
|
||||
int CBasePlayerItem::iMaxAmmo1() const { return CSPlayerItem()->m_ItemInfo.iMaxAmmo1; }
|
||||
const char *CBasePlayerItem::pszAmmo2() const { return CSPlayerItem()->m_ItemInfo.pszAmmo2; }
|
||||
int CBasePlayerItem::iMaxAmmo2() const { return CSPlayerItem()->m_ItemInfo.iMaxAmmo2; }
|
||||
const char *CBasePlayerItem::pszName() const { return CSPlayerItem()->m_ItemInfo.pszName; }
|
||||
int CBasePlayerItem::iMaxClip() const { return CSPlayerItem()->m_ItemInfo.iMaxClip; }
|
||||
int CBasePlayerItem::iWeight() const { return CSPlayerItem()->m_ItemInfo.iWeight; }
|
||||
int CBasePlayerItem::iFlags() const { return CSPlayerItem()->m_ItemInfo.iFlags; }
|
||||
#endif
|
@ -1,17 +1,10 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
TYPEDESCRIPTION CAirtank::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CAirtank, m_state, FIELD_INTEGER)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
LINK_ENTITY_TO_CLASS(item_airtank, CAirtank, CCSAirtank)
|
||||
IMPLEMENT_SAVERESTORE(CAirtank, CGrenade)
|
||||
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
void EXPORT TankTouch(CBaseEntity *pOther);
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[1];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
private:
|
||||
int m_state;
|
||||
|
@ -1,10 +1,5 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
TYPEDESCRIPTION CBaseAnimating::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CBaseMonster, m_flFrameRate, FIELD_FLOAT),
|
||||
@ -14,8 +9,6 @@ TYPEDESCRIPTION CBaseAnimating::m_SaveData[] =
|
||||
DEFINE_FIELD(CBaseMonster, m_fSequenceLoops, FIELD_BOOLEAN),
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
IMPLEMENT_SAVERESTORE(CBaseAnimating, CBaseDelay)
|
||||
|
||||
float CBaseAnimating::StudioFrameAdvance(float flInterval)
|
||||
|
@ -1,10 +1,5 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
void EXT_FUNC SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t *angles, const vec_t *origin, const byte *pcontroller, const byte *pblending, int iBone, const edict_t *pEdict);
|
||||
|
||||
sv_blending_interface_t svBlending =
|
||||
@ -13,8 +8,6 @@ sv_blending_interface_t svBlending =
|
||||
SV_StudioSetupBones
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
server_studio_api_t IEngineStudio;
|
||||
studiohdr_t *g_pstudiohdr;
|
||||
|
||||
@ -361,7 +354,7 @@ float SetController(void *pmodel, entvars_t *pev, int iController, float flValue
|
||||
int setting = int64(255.0f * (flValue - pbonecontroller->start) / (pbonecontroller->end - pbonecontroller->start));
|
||||
setting = Q_clamp(setting, 0, 255);
|
||||
|
||||
pev->controller[ iController ] = setting;
|
||||
pev->controller[iController] = setting;
|
||||
|
||||
return setting * (1.0f / 255.0f) * (pbonecontroller->end - pbonecontroller->start) + pbonecontroller->start;
|
||||
}
|
||||
@ -693,12 +686,12 @@ mstudioanim_t *StudioGetAnim(model_t *m_pSubModel, mstudioseqdesc_t *pseqdesc)
|
||||
m_pSubModel->submodels = (dmodel_t *)paSequences;
|
||||
}
|
||||
|
||||
if (!IEngineStudio.Cache_Check((struct cache_user_s *)&(paSequences[ pseqdesc->seqgroup ])))
|
||||
if (!IEngineStudio.Cache_Check((struct cache_user_s *)&(paSequences[pseqdesc->seqgroup])))
|
||||
{
|
||||
IEngineStudio.LoadCacheFile(pseqgroup->name, (struct cache_user_s *)&paSequences[ pseqdesc->seqgroup ]);
|
||||
IEngineStudio.LoadCacheFile(pseqgroup->name, (struct cache_user_s *)&paSequences[pseqdesc->seqgroup]);
|
||||
}
|
||||
|
||||
return (mstudioanim_t *)((byte *)paSequences[ pseqdesc->seqgroup ].data + pseqdesc->animindex);
|
||||
return (mstudioanim_t *)((byte *)paSequences[pseqdesc->seqgroup].data + pseqdesc->animindex);
|
||||
}
|
||||
|
||||
mstudioanim_t *LookupAnimation(model_t *model, mstudioseqdesc_t *pseqdesc, int index)
|
||||
|
@ -812,7 +812,7 @@ int CBaseMonster::IRelationship(CBaseEntity *pTarget)
|
||||
{ R_NO, R_NO, R_DL, R_DL, R_DL, R_AL, R_NO, R_DL, R_DL, R_NO, R_NO, R_DL, R_DL, R_NO }, // ABIOWEAPON
|
||||
};
|
||||
|
||||
return iEnemy[ Classify() ][ pTarget->Classify() ];
|
||||
return iEnemy[Classify()][pTarget->Classify()];
|
||||
}
|
||||
|
||||
// Base class monster function to find enemies or food by sight.
|
||||
|
@ -1,33 +1,5 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
TYPEDESCRIPTION CFuncRotating::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CFuncRotating, m_flFanFriction, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CFuncRotating, m_flAttenuation, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CFuncRotating, m_flVolume, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CFuncRotating, m_pitch, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CFuncRotating, m_sounds, FIELD_INTEGER)
|
||||
};
|
||||
|
||||
TYPEDESCRIPTION CPendulum::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CPendulum, m_accel, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CPendulum, m_distance, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CPendulum, m_time, FIELD_TIME),
|
||||
DEFINE_FIELD(CPendulum, m_damp, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CPendulum, m_maxSpeed, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CPendulum, m_dampSpeed, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CPendulum, m_center, FIELD_VECTOR),
|
||||
DEFINE_FIELD(CPendulum, m_start, FIELD_VECTOR),
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// BModelOrigin - calculates origin of a bmodel from absmin/size because all bmodel origins are 0 0 0
|
||||
Vector VecBModelOrigin(entvars_t *pevBModel)
|
||||
{
|
||||
@ -223,6 +195,15 @@ void CFuncMonsterClip::Spawn()
|
||||
pev->flags |= FL_MONSTERCLIP;
|
||||
}
|
||||
|
||||
TYPEDESCRIPTION CFuncRotating::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CFuncRotating, m_flFanFriction, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CFuncRotating, m_flAttenuation, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CFuncRotating, m_flVolume, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CFuncRotating, m_pitch, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CFuncRotating, m_sounds, FIELD_INTEGER)
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS(func_rotating, CFuncRotating, CCSFuncRotating)
|
||||
IMPLEMENT_SAVERESTORE(CFuncRotating, CBaseEntity)
|
||||
|
||||
@ -687,6 +668,18 @@ void CFuncRotating::Blocked(CBaseEntity *pOther)
|
||||
pOther->TakeDamage(pev, pev, pev->dmg, DMG_CRUSH);
|
||||
}
|
||||
|
||||
TYPEDESCRIPTION CPendulum::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CPendulum, m_accel, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CPendulum, m_distance, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CPendulum, m_time, FIELD_TIME),
|
||||
DEFINE_FIELD(CPendulum, m_damp, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CPendulum, m_maxSpeed, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CPendulum, m_dampSpeed, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CPendulum, m_center, FIELD_VECTOR),
|
||||
DEFINE_FIELD(CPendulum, m_start, FIELD_VECTOR),
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS(func_pendulum, CPendulum, CCSPendulum)
|
||||
IMPLEMENT_SAVERESTORE(CPendulum, CBaseEntity)
|
||||
|
||||
|
@ -144,7 +144,7 @@ public:
|
||||
void RampPitchVol(BOOL fUp);
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[5];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
float m_flFanFriction;
|
||||
float m_flAttenuation;
|
||||
@ -183,7 +183,7 @@ public:
|
||||
void EXPORT RopeTouch(CBaseEntity *pOther);
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[8];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
float m_accel; // acceleration
|
||||
float m_distance;
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
@ -565,15 +593,15 @@ void CCSBot::SetHidingSpotCheckTimestamp(HidingSpot *spot)
|
||||
// if there is room for more spots, append this one
|
||||
if (m_checkedHidingSpotCount < MAX_CHECKED_SPOTS)
|
||||
{
|
||||
m_checkedHidingSpot[ m_checkedHidingSpotCount ].spot = spot;
|
||||
m_checkedHidingSpot[ m_checkedHidingSpotCount ].timestamp = gpGlobals->time;
|
||||
m_checkedHidingSpot[m_checkedHidingSpotCount].spot = spot;
|
||||
m_checkedHidingSpot[m_checkedHidingSpotCount].timestamp = gpGlobals->time;
|
||||
m_checkedHidingSpotCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// replace the least recent spot
|
||||
m_checkedHidingSpot[ leastRecent ].spot = spot;
|
||||
m_checkedHidingSpot[ leastRecent ].timestamp = gpGlobals->time;
|
||||
m_checkedHidingSpot[leastRecent].spot = spot;
|
||||
m_checkedHidingSpot[leastRecent].timestamp = gpGlobals->time;
|
||||
}
|
||||
}
|
||||
|
||||
@ -840,7 +868,7 @@ const Vector *FindNearbyRetreatSpot(CCSBot *me, float maxRange)
|
||||
|
||||
// select a hiding spot at random
|
||||
int which = RANDOM_LONG(0, collector.m_count - 1);
|
||||
return collector.m_spot[ which ];
|
||||
return collector.m_spot[which];
|
||||
}
|
||||
|
||||
// Return euclidean distance to farthest escorted hostage.
|
||||
|
@ -45,12 +45,6 @@ enum
|
||||
extern int _navAreaCount;
|
||||
extern int _currentIndex;
|
||||
|
||||
extern struct BuyInfo primaryWeaponBuyInfoCT[MAX_BUY_WEAPON_PRIMARY];
|
||||
extern struct BuyInfo secondaryWeaponBuyInfoCT[MAX_BUY_WEAPON_SECONDARY];
|
||||
|
||||
extern struct BuyInfo primaryWeaponBuyInfoT[MAX_BUY_WEAPON_PRIMARY];
|
||||
extern struct BuyInfo secondaryWeaponBuyInfoT[MAX_BUY_WEAPON_SECONDARY];
|
||||
|
||||
class CCSBot;
|
||||
class BotChatterInterface;
|
||||
|
||||
|
@ -1,16 +1,37 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
#include <algorithm>
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
BotPhraseManager *TheBotPhrases = nullptr;
|
||||
CountdownTimer BotChatterInterface::m_encourageTimer;
|
||||
IntervalTimer BotChatterInterface::m_radioSilenceInterval[ 2 ];
|
||||
|
||||
#endif
|
||||
IntervalTimer BotChatterInterface::m_radioSilenceInterval[2];
|
||||
|
||||
const Vector *GetRandomSpotAtPlace(Place place)
|
||||
{
|
||||
@ -297,16 +318,16 @@ char *BotPhrase::GetSpeakable(int bankIndex, float *duration) const
|
||||
}
|
||||
|
||||
// find phrase that meets the current criteria
|
||||
int start = m_index[ bankIndex ];
|
||||
int start = m_index[bankIndex];
|
||||
while (true)
|
||||
{
|
||||
BotSpeakableVector *speakables = m_voiceBank[ bankIndex ];
|
||||
int &index = m_index[ bankIndex ];
|
||||
BotSpeakableVector *speakables = m_voiceBank[bankIndex];
|
||||
int &index = m_index[bankIndex];
|
||||
|
||||
const BotSpeakable *speak = (*speakables)[index++];
|
||||
|
||||
if (m_index[ bankIndex ] >= m_count[ bankIndex ])
|
||||
m_index[ bankIndex ] = 0;
|
||||
if (m_index[bankIndex] >= m_count[bankIndex])
|
||||
m_index[bankIndex] = 0;
|
||||
|
||||
// check place criteria
|
||||
// if this speakable has a place criteria, it must match to be used
|
||||
@ -341,7 +362,6 @@ char *BotPhrase::GetSpeakable(int bankIndex, float *duration) const
|
||||
}
|
||||
|
||||
// Randomly shuffle the speakable order
|
||||
#ifndef HOOK_GAMEDLL
|
||||
void BotPhrase::Randomize()
|
||||
{
|
||||
for (size_t i = 0; i < m_voiceBank.size(); i++)
|
||||
@ -349,7 +369,6 @@ void BotPhrase::Randomize()
|
||||
std::random_shuffle(m_voiceBank[i]->begin(), m_voiceBank[i]->end());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
BotPhraseManager::BotPhraseManager()
|
||||
{
|
||||
@ -617,10 +636,10 @@ bool BotPhraseManager::Initialize(const char *filename, int bankIndex)
|
||||
speak->m_duration = 1.0f;
|
||||
}
|
||||
|
||||
BotSpeakableVector *speakables = phrase->m_voiceBank[ bankIndex ];
|
||||
BotSpeakableVector *speakables = phrase->m_voiceBank[bankIndex];
|
||||
speakables->push_back(speak);
|
||||
|
||||
phrase->m_count[ bankIndex ]++;
|
||||
phrase->m_count[bankIndex]++;
|
||||
}
|
||||
|
||||
if (isDefault)
|
||||
@ -792,7 +811,7 @@ void BotStatement::AttachMeme(BotMeme *meme)
|
||||
void BotStatement::AddCondition(ConditionType condition)
|
||||
{
|
||||
if (m_conditionCount < MAX_BOT_CONDITIONS)
|
||||
m_condition[ m_conditionCount++ ] = condition;
|
||||
m_condition[m_conditionCount++] = condition;
|
||||
}
|
||||
|
||||
// Return true if this statement is "important" and not personality chatter
|
||||
@ -938,8 +957,9 @@ void BotStatement::AppendPhrase(const BotPhrase *phrase)
|
||||
|
||||
if (m_count < MAX_BOT_PHRASES)
|
||||
{
|
||||
m_statement[ m_count ].isPhrase = true;
|
||||
m_statement[ m_count++ ].phrase = phrase;
|
||||
m_statement[m_count].isPhrase = true;
|
||||
m_statement[m_count].phrase = phrase;
|
||||
m_count++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -948,8 +968,9 @@ void BotStatement::AppendPhrase(ContextType contextPhrase)
|
||||
{
|
||||
if (m_count < MAX_BOT_PHRASES)
|
||||
{
|
||||
m_statement[ m_count ].isPhrase = false;
|
||||
m_statement[ m_count++ ].context = contextPhrase;
|
||||
m_statement[m_count].isPhrase = false;
|
||||
m_statement[m_count].context = contextPhrase;
|
||||
m_count++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -970,7 +991,7 @@ bool BotStatement::Update()
|
||||
}
|
||||
|
||||
// special case - context dependent delay
|
||||
if (m_index >= 0 && m_statement[ m_index ].context == ACCUMULATE_ENEMIES_DELAY)
|
||||
if (m_index >= 0 && m_statement[m_index].context == ACCUMULATE_ENEMIES_DELAY)
|
||||
{
|
||||
// report if we see a lot of enemies, or if enough time has passed
|
||||
const float reportTime = 2.0f;
|
||||
@ -999,15 +1020,15 @@ bool BotStatement::Update()
|
||||
float duration = 0.0f;
|
||||
const BotPhrase *phrase = nullptr;
|
||||
|
||||
if (m_statement[ m_index ].isPhrase)
|
||||
if (m_statement[m_index].isPhrase)
|
||||
{
|
||||
// normal phrase
|
||||
phrase = m_statement[ m_index ].phrase;
|
||||
phrase = m_statement[m_index].phrase;
|
||||
}
|
||||
else
|
||||
{
|
||||
// context-dependant phrase
|
||||
switch (m_statement[ m_index ].context)
|
||||
switch (m_statement[m_index].context)
|
||||
{
|
||||
case CURRENT_ENEMY_COUNT:
|
||||
{
|
||||
@ -1047,7 +1068,7 @@ bool BotStatement::Update()
|
||||
}
|
||||
else
|
||||
{
|
||||
phrase = TheBotPhrases->GetPhrase(speak[ enemyCount ]);
|
||||
phrase = TheBotPhrases->GetPhrase(speak[enemyCount]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1247,7 +1268,7 @@ void BotChatterInterface::Reset()
|
||||
m_heardNoiseTimer.Invalidate();
|
||||
m_scaredInterval.Invalidate();
|
||||
m_planInterval.Invalidate();
|
||||
IMPL(m_encourageTimer).Invalidate();
|
||||
m_encourageTimer.Invalidate();
|
||||
m_escortingHostageTimer.Invalidate();
|
||||
}
|
||||
|
||||
@ -1571,7 +1592,7 @@ float BotChatterInterface::GetRadioSilenceDuration()
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
return IMPL(m_radioSilenceInterval)[m_me->m_iTeam - 1].GetElapsedTime();
|
||||
return m_radioSilenceInterval[m_me->m_iTeam - 1].GetElapsedTime();
|
||||
}
|
||||
|
||||
void BotChatterInterface::ResetRadioSilenceDuration()
|
||||
@ -1581,7 +1602,7 @@ void BotChatterInterface::ResetRadioSilenceDuration()
|
||||
return;
|
||||
#endif
|
||||
|
||||
IMPL(m_radioSilenceInterval)[m_me->m_iTeam - 1].Reset();
|
||||
m_radioSilenceInterval[m_me->m_iTeam - 1].Reset();
|
||||
}
|
||||
|
||||
inline void SayWhere(BotStatement *say, Place place)
|
||||
@ -2176,10 +2197,10 @@ NOXREF void BotChatterInterface::HostageDown()
|
||||
|
||||
void BotChatterInterface::Encourage(const char *phraseName, float repeatInterval, float lifetime)
|
||||
{
|
||||
if (IMPL(m_encourageTimer).IsElapsed())
|
||||
if (m_encourageTimer.IsElapsed())
|
||||
{
|
||||
Say(phraseName, lifetime);
|
||||
IMPL(m_encourageTimer).Start(repeatInterval);
|
||||
m_encourageTimer.Start(repeatInterval);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,8 +176,8 @@ public:
|
||||
CountCriteria m_count;
|
||||
};
|
||||
|
||||
typedef std::STD_VECTOR<BotSpeakable *> BotSpeakableVector;
|
||||
typedef std::STD_VECTOR<BotSpeakableVector *> BotVoiceBankVector;
|
||||
typedef std::vector<BotSpeakable *> BotSpeakableVector;
|
||||
typedef std::vector<BotSpeakableVector *> BotVoiceBankVector;
|
||||
|
||||
// The BotPhrase class is a collection of Speakables associated with a name, ID, and criteria
|
||||
class BotPhrase
|
||||
@ -210,8 +210,8 @@ private:
|
||||
bool m_isImportant; // mission-critical statement
|
||||
|
||||
mutable BotVoiceBankVector m_voiceBank; // array of voice banks (arrays of speakables)
|
||||
std::STD_VECTOR<int> m_count; // number of speakables
|
||||
mutable std::STD_VECTOR< int > m_index; // index of next speakable to return
|
||||
std::vector<int> m_count; // number of speakables
|
||||
mutable std::vector< int > m_index; // index of next speakable to return
|
||||
int m_numVoiceBanks; // number of voice banks that have been initialized
|
||||
void InitVoiceBank(int bankIndex); // sets up the vector of voice banks for the first bankIndex voice banks
|
||||
|
||||
@ -219,7 +219,7 @@ private:
|
||||
mutable CountCriteria m_countCriteria;
|
||||
};
|
||||
|
||||
typedef std::STD_LIST<BotPhrase *> BotPhraseList;
|
||||
typedef std::list<BotPhrase *> BotPhraseList;
|
||||
|
||||
inline void BotPhrase::ClearCriteria() const
|
||||
{
|
||||
@ -538,7 +538,8 @@ private:
|
||||
|
||||
int m_pitch;
|
||||
|
||||
static IntervalTimer IMPL(m_radioSilenceInterval)[2]; // one timer for each team
|
||||
static IntervalTimer m_radioSilenceInterval[]; // one timer for each team
|
||||
static CountdownTimer m_encourageTimer; // timer to know when we can "encourage" the human player again - shared by all bots
|
||||
|
||||
IntervalTimer m_needBackupInterval;
|
||||
IntervalTimer m_spottedBomberInterval;
|
||||
@ -547,7 +548,6 @@ private:
|
||||
CountdownTimer m_spottedLooseBombTimer;
|
||||
CountdownTimer m_heardNoiseTimer;
|
||||
CountdownTimer m_escortingHostageTimer;
|
||||
static CountdownTimer IMPL(m_encourageTimer); // timer to know when we can "encourage" the human player again - shared by all bots
|
||||
};
|
||||
|
||||
inline BotChatterInterface::VerbosityType BotChatterInterface::GetVerbosity() const
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
void CCSBot::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
|
||||
|
@ -1,9 +1,32 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
cvar_t cv_bot_traceview = { "bot_traceview", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t cv_bot_stop = { "bot_stop", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
@ -35,8 +58,6 @@ cvar_t cv_bot_defer_to_human = { "bot_defer_to_human", "0", FCVAR_SERVER, 0.0f,
|
||||
cvar_t cv_bot_chatter = { "bot_chatter", "normal", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t cv_bot_profile_db = { "bot_profile_db", "BotProfile.db", FCVAR_SERVER, 0.0f, nullptr };
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
cvar_t cv_bot_deathmatch = { "bot_deathmatch", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t cv_bot_quota_mode = { "bot_quota_mode", "normal", FCVAR_SERVER, 0.0f, nullptr };
|
||||
|
64
regamedll/dlls/bot/cs_bot_init.h
Normal file
64
regamedll/dlls/bot/cs_bot_init.h
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
extern cvar_t cv_bot_traceview;
|
||||
extern cvar_t cv_bot_stop;
|
||||
extern cvar_t cv_bot_show_nav;
|
||||
extern cvar_t cv_bot_show_danger;
|
||||
extern cvar_t cv_bot_nav_edit;
|
||||
extern cvar_t cv_bot_nav_zdraw;
|
||||
extern cvar_t cv_bot_walk;
|
||||
extern cvar_t cv_bot_difficulty;
|
||||
extern cvar_t cv_bot_debug;
|
||||
extern cvar_t cv_bot_quicksave;
|
||||
extern cvar_t cv_bot_quota;
|
||||
extern cvar_t cv_bot_quota_match;
|
||||
extern cvar_t cv_bot_prefix;
|
||||
extern cvar_t cv_bot_allow_rogues;
|
||||
extern cvar_t cv_bot_allow_pistols;
|
||||
extern cvar_t cv_bot_allow_shotguns;
|
||||
extern cvar_t cv_bot_allow_sub_machine_guns;
|
||||
extern cvar_t cv_bot_allow_rifles;
|
||||
extern cvar_t cv_bot_allow_machine_guns;
|
||||
extern cvar_t cv_bot_allow_grenades;
|
||||
extern cvar_t cv_bot_allow_snipers;
|
||||
extern cvar_t cv_bot_allow_shield;
|
||||
extern cvar_t cv_bot_join_team;
|
||||
extern cvar_t cv_bot_join_after_player;
|
||||
extern cvar_t cv_bot_auto_vacate;
|
||||
extern cvar_t cv_bot_zombie;
|
||||
extern cvar_t cv_bot_defer_to_human;
|
||||
extern cvar_t cv_bot_chatter;
|
||||
extern cvar_t cv_bot_profile_db;
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
extern cvar_t cv_bot_deathmatch;
|
||||
extern cvar_t cv_bot_quota_mode;
|
||||
#endif
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
const float updateTimesliceDuration = 0.5f;
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
// Listen for enemy noises, and determine if we should react to them.
|
||||
|
@ -1,9 +1,32 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
CBotManager *TheBots = nullptr;
|
||||
|
||||
@ -13,11 +36,9 @@ bool CCSBotManager::m_isLearningMap = false;
|
||||
bool CCSBotManager::m_isAnalysisRequested = false;
|
||||
NavEditCmdType CCSBotManager::m_editCmd = EDIT_NONE;
|
||||
|
||||
#endif
|
||||
|
||||
CCSBotManager::CCSBotManager()
|
||||
{
|
||||
IMPL(m_flNextCVarCheck) = 0.0f;
|
||||
m_flNextCVarCheck = 0.0f;
|
||||
|
||||
m_zoneCount = 0;
|
||||
SetLooseBomb(nullptr);
|
||||
@ -25,9 +46,9 @@ CCSBotManager::CCSBotManager()
|
||||
m_isBombPlanted = false;
|
||||
m_bombDefuser = nullptr;
|
||||
|
||||
IMPL(m_isLearningMap) = false;
|
||||
IMPL(m_isAnalysisRequested) = false;
|
||||
IMPL(m_editCmd) = EDIT_NONE;
|
||||
m_isLearningMap = false;
|
||||
m_isAnalysisRequested = false;
|
||||
m_editCmd = EDIT_NONE;
|
||||
|
||||
m_navPlace = 0;
|
||||
m_roundStartTimestamp = 0.0f;
|
||||
@ -96,7 +117,7 @@ void CCSBotManager::RestartRound()
|
||||
m_earliestBombPlantTimestamp = gpGlobals->time + RANDOM_FLOAT(10.0f, 30.0f);
|
||||
m_bombDefuser = nullptr;
|
||||
|
||||
IMPL(m_editCmd) = EDIT_NONE;
|
||||
m_editCmd = EDIT_NONE;
|
||||
|
||||
ResetRadioMessageTimestamps();
|
||||
|
||||
@ -114,59 +135,7 @@ void CCSBotManager::RestartRound()
|
||||
m_canRespawn = true;
|
||||
}
|
||||
|
||||
void UTIL_DrawBox(Extent *extent, int lifetime, int red, int green, int blue)
|
||||
{
|
||||
Vector v[8];
|
||||
v[0].x = extent->lo.x; v[0].y = extent->lo.y; v[0].z = extent->lo.z;
|
||||
v[1].x = extent->hi.x; v[1].y = extent->lo.y; v[1].z = extent->lo.z;
|
||||
v[2].x = extent->hi.x; v[2].y = extent->hi.y; v[2].z = extent->lo.z;
|
||||
v[3].x = extent->lo.x; v[3].y = extent->hi.y; v[3].z = extent->lo.z;
|
||||
v[4].x = extent->lo.x; v[4].y = extent->lo.y; v[4].z = extent->hi.z;
|
||||
v[5].x = extent->hi.x; v[5].y = extent->lo.y; v[5].z = extent->hi.z;
|
||||
v[6].x = extent->hi.x; v[6].y = extent->hi.y; v[6].z = extent->hi.z;
|
||||
v[7].x = extent->lo.x; v[7].y = extent->hi.y; v[7].z = extent->hi.z;
|
||||
|
||||
static int edge[] =
|
||||
{
|
||||
1, 2, 3, 4, -1,
|
||||
5, 6, 7, 8, -5,
|
||||
1, -5,
|
||||
2, -6,
|
||||
3, -7,
|
||||
4, -8,
|
||||
0 // end iterator
|
||||
};
|
||||
|
||||
Vector from, to;
|
||||
bool restart = true;
|
||||
|
||||
for (int i = 0; edge[i] != 0; i++)
|
||||
{
|
||||
if (restart)
|
||||
{
|
||||
to = v[ edge[i] - 1 ];
|
||||
restart = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
from = to;
|
||||
|
||||
int index = edge[i];
|
||||
if (index < 0)
|
||||
{
|
||||
restart = true;
|
||||
index = -index;
|
||||
}
|
||||
|
||||
to = v[ index - 1 ];
|
||||
|
||||
UTIL_DrawBeamPoints(from, to, lifetime, red, green, blue);
|
||||
UTIL_DrawBeamPoints(to, from, lifetime, red, green, blue);
|
||||
}
|
||||
}
|
||||
|
||||
// Called each frame
|
||||
|
||||
void CCSBotManager::StartFrame()
|
||||
{
|
||||
// EXTEND
|
||||
@ -244,7 +213,7 @@ bool CCSBotManager::IsOnOffense(CBasePlayer *player) const
|
||||
void CCSBotManager::ServerActivate()
|
||||
{
|
||||
DestroyNavigationMap();
|
||||
IMPL(m_isMapDataLoaded) = false;
|
||||
m_isMapDataLoaded = false;
|
||||
|
||||
m_zoneCount = 0;
|
||||
m_gameScenario = SCENARIO_DEATHMATCH;
|
||||
@ -252,8 +221,8 @@ void CCSBotManager::ServerActivate()
|
||||
ValidateMapData();
|
||||
RestartRound();
|
||||
|
||||
IMPL(m_isLearningMap) = false;
|
||||
IMPL(m_isAnalysisRequested) = false;
|
||||
m_isLearningMap = false;
|
||||
m_isAnalysisRequested = false;
|
||||
|
||||
m_bServerActive = true;
|
||||
AddServerCommands();
|
||||
@ -510,59 +479,59 @@ void CCSBotManager::ServerCommand(const char *pcmd)
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_delete"))
|
||||
{
|
||||
IMPL(m_editCmd) = EDIT_DELETE;
|
||||
m_editCmd = EDIT_DELETE;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_split"))
|
||||
{
|
||||
IMPL(m_editCmd) = EDIT_SPLIT;
|
||||
m_editCmd = EDIT_SPLIT;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_merge"))
|
||||
{
|
||||
IMPL(m_editCmd) = EDIT_MERGE;
|
||||
m_editCmd = EDIT_MERGE;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_mark"))
|
||||
{
|
||||
IMPL(m_editCmd) = EDIT_MARK;
|
||||
m_editCmd = EDIT_MARK;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_begin_area"))
|
||||
{
|
||||
IMPL(m_editCmd) = EDIT_BEGIN_AREA;
|
||||
m_editCmd = EDIT_BEGIN_AREA;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_end_area"))
|
||||
{
|
||||
IMPL(m_editCmd) = EDIT_END_AREA;
|
||||
m_editCmd = EDIT_END_AREA;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_connect"))
|
||||
{
|
||||
IMPL(m_editCmd) = EDIT_CONNECT;
|
||||
m_editCmd = EDIT_CONNECT;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_disconnect"))
|
||||
{
|
||||
IMPL(m_editCmd) = EDIT_DISCONNECT;
|
||||
m_editCmd = EDIT_DISCONNECT;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_splice"))
|
||||
{
|
||||
IMPL(m_editCmd) = EDIT_SPLICE;
|
||||
m_editCmd = EDIT_SPLICE;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_crouch"))
|
||||
{
|
||||
IMPL(m_editCmd) = EDIT_ATTRIB_CROUCH;
|
||||
m_editCmd = EDIT_ATTRIB_CROUCH;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_jump"))
|
||||
{
|
||||
IMPL(m_editCmd) = EDIT_ATTRIB_JUMP;
|
||||
m_editCmd = EDIT_ATTRIB_JUMP;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_precise"))
|
||||
{
|
||||
IMPL(m_editCmd) = EDIT_ATTRIB_PRECISE;
|
||||
m_editCmd = EDIT_ATTRIB_PRECISE;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_no_jump"))
|
||||
{
|
||||
IMPL(m_editCmd) = EDIT_ATTRIB_NO_JUMP;
|
||||
m_editCmd = EDIT_ATTRIB_NO_JUMP;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_analyze"))
|
||||
{
|
||||
IMPL(m_isAnalysisRequested) = true;
|
||||
m_isAnalysisRequested = true;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_strip"))
|
||||
{
|
||||
@ -645,19 +614,19 @@ void CCSBotManager::ServerCommand(const char *pcmd)
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_toggle_place_mode"))
|
||||
{
|
||||
IMPL(m_editCmd) = EDIT_TOGGLE_PLACE_MODE;
|
||||
m_editCmd = EDIT_TOGGLE_PLACE_MODE;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_place_floodfill"))
|
||||
{
|
||||
IMPL(m_editCmd) = EDIT_PLACE_FLOODFILL;
|
||||
m_editCmd = EDIT_PLACE_FLOODFILL;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_place_pick"))
|
||||
{
|
||||
IMPL(m_editCmd) = EDIT_PLACE_PICK;
|
||||
m_editCmd = EDIT_PLACE_PICK;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_toggle_place_painting"))
|
||||
{
|
||||
IMPL(m_editCmd) = EDIT_TOGGLE_PLACE_PAINTING;
|
||||
m_editCmd = EDIT_TOGGLE_PLACE_PAINTING;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_goto_mark"))
|
||||
{
|
||||
@ -716,23 +685,23 @@ void CCSBotManager::ServerCommand(const char *pcmd)
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_mark_unnamed"))
|
||||
{
|
||||
IMPL(m_editCmd) = EDIT_MARK_UNNAMED;
|
||||
m_editCmd = EDIT_MARK_UNNAMED;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_warp"))
|
||||
{
|
||||
IMPL(m_editCmd) = EDIT_WARP_TO_MARK;
|
||||
m_editCmd = EDIT_WARP_TO_MARK;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_corner_select"))
|
||||
{
|
||||
IMPL(m_editCmd) = EDIT_SELECT_CORNER;
|
||||
m_editCmd = EDIT_SELECT_CORNER;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_corner_raise"))
|
||||
{
|
||||
IMPL(m_editCmd) = EDIT_RAISE_CORNER;
|
||||
m_editCmd = EDIT_RAISE_CORNER;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_corner_lower"))
|
||||
{
|
||||
IMPL(m_editCmd) = EDIT_LOWER_CORNER;
|
||||
m_editCmd = EDIT_LOWER_CORNER;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_check_consistency"))
|
||||
{
|
||||
@ -762,11 +731,10 @@ BOOL CCSBotManager::ClientCommand(CBasePlayer *pPlayer, const char *pcmd)
|
||||
bool CCSBotManager::BotAddCommand(BotProfileTeamType team, bool isFromConsole)
|
||||
{
|
||||
// dont allow bots to join if the Navigation Area is being generated
|
||||
if (IMPL(m_isLearningMap))
|
||||
if (m_isLearningMap)
|
||||
return false;
|
||||
|
||||
const BotProfile *profile = nullptr;
|
||||
|
||||
if (!isFromConsole || CMD_ARGC() < 2)
|
||||
{
|
||||
// if team not specified, check cv_bot_join_team cvar for preference
|
||||
@ -838,7 +806,7 @@ void CCSBotManager::MaintainBotQuota()
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (IMPL(m_isLearningMap))
|
||||
if (m_isLearningMap)
|
||||
return;
|
||||
|
||||
int totalHumansInGame = UTIL_HumansInGame();
|
||||
@ -961,17 +929,17 @@ void CCSBotManager::MonitorBotCVars()
|
||||
{
|
||||
if (cv_bot_nav_edit.value != 0.0f)
|
||||
{
|
||||
EditNavAreas(IMPL(m_editCmd));
|
||||
IMPL(m_editCmd) = EDIT_NONE;
|
||||
EditNavAreas(m_editCmd);
|
||||
m_editCmd = EDIT_NONE;
|
||||
}
|
||||
|
||||
if (gpGlobals->time >= IMPL(m_flNextCVarCheck))
|
||||
if (gpGlobals->time >= m_flNextCVarCheck)
|
||||
{
|
||||
if (cv_bot_show_danger.value != 0.0f)
|
||||
DrawDanger();
|
||||
|
||||
MaintainBotQuota();
|
||||
IMPL(m_flNextCVarCheck) = gpGlobals->time + 0.3f;
|
||||
m_flNextCVarCheck = gpGlobals->time + 0.3f;
|
||||
}
|
||||
}
|
||||
|
||||
@ -993,7 +961,7 @@ class CollectOverlappingAreas
|
||||
&& areaExtent->hi.z >= m_zone->m_extent.lo.z && areaExtent->lo.z <= m_zone->m_extent.hi.z)
|
||||
{
|
||||
// area overlaps m_zone
|
||||
m_zone->m_area[ m_zone->m_areaCount++ ] = area;
|
||||
m_zone->m_area[m_zone->m_areaCount++] = area;
|
||||
if (m_zone->m_areaCount == CCSBotManager::MAX_ZONE_NAV_AREAS)
|
||||
{
|
||||
return false;
|
||||
@ -1010,10 +978,10 @@ class CollectOverlappingAreas
|
||||
// Search the map entities to determine the game scenario and define important zones.
|
||||
void CCSBotManager::ValidateMapData()
|
||||
{
|
||||
if (IMPL(m_isMapDataLoaded) || !AreBotsAllowed())
|
||||
if (m_isMapDataLoaded || !AreBotsAllowed())
|
||||
return;
|
||||
|
||||
IMPL(m_isMapDataLoaded) = true;
|
||||
m_isMapDataLoaded = true;
|
||||
|
||||
if (LoadNavigationMap())
|
||||
{
|
||||
@ -1079,10 +1047,10 @@ void CCSBotManager::ValidateMapData()
|
||||
{
|
||||
if (m_zoneCount < MAX_ZONES)
|
||||
{
|
||||
m_zone[ m_zoneCount ].m_center = isLegacy ? pEntity->pev->origin : (pEntity->pev->absmax + pEntity->pev->absmin) / 2.0f;
|
||||
m_zone[ m_zoneCount ].m_isLegacy = isLegacy;
|
||||
m_zone[ m_zoneCount ].m_index = m_zoneCount;
|
||||
m_zone[ m_zoneCount ].m_entity = pEntity;
|
||||
m_zone[m_zoneCount].m_center = isLegacy ? pEntity->pev->origin : (pEntity->pev->absmax + pEntity->pev->absmin) / 2.0f;
|
||||
m_zone[m_zoneCount].m_isLegacy = isLegacy;
|
||||
m_zone[m_zoneCount].m_index = m_zoneCount;
|
||||
m_zone[m_zoneCount].m_entity = pEntity;
|
||||
m_zoneCount++;
|
||||
}
|
||||
else
|
||||
@ -1110,10 +1078,10 @@ void CCSBotManager::ValidateMapData()
|
||||
|
||||
if (m_zoneCount < MAX_ZONES)
|
||||
{
|
||||
m_zone[ m_zoneCount ].m_center = pEntity->pev->origin;
|
||||
m_zone[ m_zoneCount ].m_isLegacy = true;
|
||||
m_zone[ m_zoneCount ].m_index = m_zoneCount;
|
||||
m_zone[ m_zoneCount ].m_entity = pEntity;
|
||||
m_zone[m_zoneCount].m_center = pEntity->pev->origin;
|
||||
m_zone[m_zoneCount].m_isLegacy = true;
|
||||
m_zone[m_zoneCount].m_index = m_zoneCount;
|
||||
m_zone[m_zoneCount].m_entity = pEntity;
|
||||
m_zoneCount++;
|
||||
}
|
||||
else
|
||||
@ -1306,7 +1274,7 @@ CNavArea *CCSBotManager::GetRandomAreaInZone(const Zone *zone) const
|
||||
if (!zone->m_areaCount)
|
||||
return nullptr;
|
||||
|
||||
return zone->m_area[ RANDOM_LONG(0, zone->m_areaCount - 1) ];
|
||||
return zone->m_area[RANDOM_LONG(0, zone->m_areaCount - 1)];
|
||||
}
|
||||
|
||||
void CCSBotManager::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
|
||||
@ -1455,7 +1423,7 @@ float CCSBotManager::GetRadioMessageTimestamp(GameEventType event, int teamID) c
|
||||
return 0.0f;
|
||||
|
||||
int i = (teamID == TERRORIST) ? 0 : 1;
|
||||
return m_radioMsgTimestamp[ event - EVENT_START_RADIO_1 ][ i ];
|
||||
return m_radioMsgTimestamp[event - EVENT_START_RADIO_1][i];
|
||||
}
|
||||
|
||||
// Return the interval since the last time this message was sent
|
||||
@ -1465,7 +1433,7 @@ float CCSBotManager::GetRadioMessageInterval(GameEventType event, int teamID) co
|
||||
return 99999999.9f;
|
||||
|
||||
int i = (teamID == TERRORIST) ? 0 : 1;
|
||||
return gpGlobals->time - m_radioMsgTimestamp[ event - EVENT_START_RADIO_1 ][ i ];
|
||||
return gpGlobals->time - m_radioMsgTimestamp[event - EVENT_START_RADIO_1][i];
|
||||
}
|
||||
|
||||
// Set the given radio message timestamp.
|
||||
@ -1476,7 +1444,7 @@ void CCSBotManager::SetRadioMessageTimestamp(GameEventType event, int teamID)
|
||||
return;
|
||||
|
||||
int i = (teamID == TERRORIST) ? 0 : 1;
|
||||
m_radioMsgTimestamp[ event - EVENT_START_RADIO_1 ][ i ] = gpGlobals->time;
|
||||
m_radioMsgTimestamp[event - EVENT_START_RADIO_1][i] = gpGlobals->time;
|
||||
}
|
||||
|
||||
// Reset all radio message timestamps
|
||||
|
@ -28,6 +28,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cs_bot_init.h"
|
||||
|
||||
extern CBotManager *TheBots;
|
||||
|
||||
// The manager for Counter-Strike specific bots
|
||||
@ -56,11 +58,11 @@ public:
|
||||
public:
|
||||
void ValidateMapData();
|
||||
void OnFreeEntPrivateData(CBaseEntity *pEntity);
|
||||
bool IsLearningMap() const { return IMPL(m_isLearningMap); }
|
||||
void SetLearningMapFlag() { IMPL(m_isLearningMap) = true; }
|
||||
bool IsAnalysisRequested() const { return IMPL(m_isAnalysisRequested); }
|
||||
void RequestAnalysis() { IMPL(m_isAnalysisRequested) = true; }
|
||||
void AckAnalysisRequest() { IMPL(m_isAnalysisRequested) = false; }
|
||||
bool IsLearningMap() const { return m_isLearningMap; }
|
||||
void SetLearningMapFlag() { m_isLearningMap = true; }
|
||||
bool IsAnalysisRequested() const { return m_isAnalysisRequested; }
|
||||
void RequestAnalysis() { m_isAnalysisRequested = true; }
|
||||
void AckAnalysisRequest() { m_isAnalysisRequested = false; }
|
||||
|
||||
// difficulty levels
|
||||
static BotDifficultyType GetDifficultyLevel()
|
||||
@ -85,6 +87,7 @@ public:
|
||||
SCENARIO_RESCUE_HOSTAGES,
|
||||
SCENARIO_ESCORT_VIP
|
||||
};
|
||||
|
||||
GameScenarioType GetScenario() const
|
||||
{
|
||||
#ifdef REGAMEDLL_ADD
|
||||
@ -213,10 +216,10 @@ public:
|
||||
bool BotAddCommand(BotProfileTeamType team, bool isFromConsole = false); // process the "bot_add" console command
|
||||
|
||||
private:
|
||||
static float IMPL(m_flNextCVarCheck);
|
||||
static bool IMPL(m_isMapDataLoaded); // true if we've attempted to load map data
|
||||
static bool IMPL(m_isLearningMap);
|
||||
static bool IMPL(m_isAnalysisRequested);
|
||||
static float m_flNextCVarCheck;
|
||||
static bool m_isMapDataLoaded; // true if we've attempted to load map data
|
||||
static bool m_isLearningMap;
|
||||
static bool m_isAnalysisRequested;
|
||||
|
||||
GameScenarioType m_gameScenario; // what kind of game are we playing
|
||||
|
||||
@ -239,7 +242,7 @@ private:
|
||||
|
||||
bool m_isDefenseRushing; // whether defensive team is rushing this round or not
|
||||
|
||||
static NavEditCmdType IMPL(m_editCmd);
|
||||
static NavEditCmdType m_editCmd;
|
||||
unsigned int m_navPlace;
|
||||
CountdownTimer m_respawnTimer;
|
||||
bool m_isRespawnStarted;
|
||||
@ -264,4 +267,3 @@ inline bool AreBotsAllowed()
|
||||
}
|
||||
|
||||
void PrintAllEntities();
|
||||
void UTIL_DrawBox(Extent *extent, int lifetime, int red, int green, int blue);
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
// Reset the stuck-checker.
|
||||
@ -51,7 +79,7 @@ void CCSBot::StuckCheck()
|
||||
float moveDist = vel.Length();
|
||||
float deltaT = g_flBotFullThinkInterval;
|
||||
|
||||
m_avgVel[ m_avgVelIndex++ ] = moveDist / deltaT;
|
||||
m_avgVel[m_avgVelIndex++] = moveDist / deltaT;
|
||||
|
||||
if (m_avgVelIndex == MAX_VEL_SAMPLES)
|
||||
m_avgVelIndex = 0;
|
||||
@ -258,7 +286,7 @@ void CCSBot::MoveTowardsPosition(const Vector *pos)
|
||||
NOXREF void CCSBot::MoveAwayFromPosition(const Vector *pos)
|
||||
{
|
||||
// compute our current forward and lateral vectors
|
||||
float angle = pev->v_angle[ YAW ];
|
||||
float angle = pev->v_angle[YAW];
|
||||
|
||||
Vector2D dir(BotCOS(angle), BotSIN(angle));
|
||||
Vector2D lat(-dir.y, dir.x);
|
||||
@ -287,7 +315,7 @@ NOXREF void CCSBot::MoveAwayFromPosition(const Vector *pos)
|
||||
void CCSBot::StrafeAwayFromPosition(const Vector *pos)
|
||||
{
|
||||
// compute our current forward and lateral vectors
|
||||
float angle = pev->v_angle[ YAW ];
|
||||
float angle = pev->v_angle[YAW];
|
||||
|
||||
Vector2D dir(BotCOS(angle), BotSIN(angle));
|
||||
Vector2D lat(-dir.y, dir.x);
|
||||
@ -400,7 +428,7 @@ void CCSBot::ComputeApproachPoints()
|
||||
Vector bendPoint;
|
||||
if (BendLineOfSight(&eye, &ap, &bendPoint))
|
||||
{
|
||||
m_approachPoint[ m_approachPointCount++ ] = bendPoint;
|
||||
m_approachPoint[m_approachPointCount++] = bendPoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
// Determine actual path positions bot will move between along the path
|
||||
@ -14,7 +42,7 @@ bool CCSBot::ComputePathPositions()
|
||||
for (int i = 1; i < m_pathLength; i++)
|
||||
{
|
||||
const ConnectInfo *from = &m_path[i - 1];
|
||||
ConnectInfo *to = &m_path[ i ];
|
||||
ConnectInfo *to = &m_path[i ];
|
||||
|
||||
// walk along the floor to the next area
|
||||
if (to->how <= GO_WEST)
|
||||
@ -128,7 +156,7 @@ void CCSBot::SetupLadderMovement()
|
||||
if (m_pathIndex < 1 || m_pathLength == 0)
|
||||
return;
|
||||
|
||||
const ConnectInfo *to = &m_path[ m_pathIndex ];
|
||||
const ConnectInfo *to = &m_path[m_pathIndex];
|
||||
|
||||
if (to->ladder)
|
||||
{
|
||||
@ -337,7 +365,7 @@ bool CCSBot::UpdateLadderMovement()
|
||||
PrintIfWatched("Fell from ladder.\n");
|
||||
|
||||
m_pathLadderState = MOVE_TO_DESTINATION;
|
||||
m_path[ m_pathIndex ].area->GetClosestPointOnArea(&m_pathLadder->m_bottom, &m_goalPosition);
|
||||
m_path[m_pathIndex].area->GetClosestPointOnArea(&m_pathLadder->m_bottom, &m_goalPosition);
|
||||
|
||||
AddDirectionVector(&m_goalPosition, m_pathLadder->m_dir, HalfHumanWidth);
|
||||
PrintIfWatched("MOVE_TO_DESTINATION\n");
|
||||
@ -443,7 +471,7 @@ bool CCSBot::UpdateLadderMovement()
|
||||
PrintIfWatched("Fell from ladder.\n");
|
||||
|
||||
m_pathLadderState = MOVE_TO_DESTINATION;
|
||||
m_path[ m_pathIndex ].area->GetClosestPointOnArea(&m_pathLadder->m_bottom, &m_goalPosition);
|
||||
m_path[m_pathIndex].area->GetClosestPointOnArea(&m_pathLadder->m_bottom, &m_goalPosition);
|
||||
|
||||
AddDirectionVector(&m_goalPosition, m_pathLadder->m_dir, HalfHumanWidth);
|
||||
PrintIfWatched("MOVE_TO_DESTINATION\n");
|
||||
@ -470,7 +498,7 @@ bool CCSBot::UpdateLadderMovement()
|
||||
Run();
|
||||
|
||||
// if our destination area requires us to crouch, do it
|
||||
if (m_path[ m_pathIndex ].area->GetAttributes() & NAV_CROUCH)
|
||||
if (m_path[m_pathIndex].area->GetAttributes() & NAV_CROUCH)
|
||||
Crouch();
|
||||
|
||||
// did we reach the top?
|
||||
@ -480,11 +508,11 @@ bool CCSBot::UpdateLadderMovement()
|
||||
m_pathLadderState = DISMOUNT_ASCENDING_LADDER;
|
||||
PrintIfWatched("DISMOUNT_ASCENDING_LADDER\n");
|
||||
|
||||
if (m_path[ m_pathIndex ].area == m_pathLadder->m_topForwardArea)
|
||||
if (m_path[m_pathIndex].area == m_pathLadder->m_topForwardArea)
|
||||
m_pathLadderDismountDir = FORWARD;
|
||||
else if (m_path[ m_pathIndex ].area == m_pathLadder->m_topLeftArea)
|
||||
else if (m_path[m_pathIndex].area == m_pathLadder->m_topLeftArea)
|
||||
m_pathLadderDismountDir = LEFT;
|
||||
else if (m_path[ m_pathIndex ].area == m_pathLadder->m_topRightArea)
|
||||
else if (m_path[m_pathIndex].area == m_pathLadder->m_topRightArea)
|
||||
m_pathLadderDismountDir = RIGHT;
|
||||
|
||||
m_pathLadderDismountTimestamp = gpGlobals->time;
|
||||
@ -509,7 +537,7 @@ bool CCSBot::UpdateLadderMovement()
|
||||
{
|
||||
// we reached the bottom, or we fell off - dismount
|
||||
m_pathLadderState = MOVE_TO_DESTINATION;
|
||||
m_path[ m_pathIndex ].area->GetClosestPointOnArea(&m_pathLadder->m_bottom, &m_goalPosition);
|
||||
m_path[m_pathIndex].area->GetClosestPointOnArea(&m_pathLadder->m_bottom, &m_goalPosition);
|
||||
|
||||
AddDirectionVector(&m_goalPosition, m_pathLadder->m_dir, HalfHumanWidth);
|
||||
PrintIfWatched("MOVE_TO_DESTINATION\n");
|
||||
@ -524,7 +552,7 @@ bool CCSBot::UpdateLadderMovement()
|
||||
if (gpGlobals->time - m_pathLadderDismountTimestamp >= 0.4f)
|
||||
{
|
||||
m_pathLadderState = MOVE_TO_DESTINATION;
|
||||
m_path[ m_pathIndex ].area->GetClosestPointOnArea(&pev->origin, &m_goalPosition);
|
||||
m_path[m_pathIndex].area->GetClosestPointOnArea(&pev->origin, &m_goalPosition);
|
||||
PrintIfWatched("MOVE_TO_DESTINATION\n");
|
||||
}
|
||||
|
||||
@ -551,7 +579,7 @@ bool CCSBot::UpdateLadderMovement()
|
||||
}
|
||||
case MOVE_TO_DESTINATION:
|
||||
{
|
||||
if (m_path[ m_pathIndex ].area->Contains(&pev->origin))
|
||||
if (m_path[m_pathIndex].area->Contains(&pev->origin))
|
||||
{
|
||||
// successfully traversed ladder and reached destination area
|
||||
// exit ladder state machine
|
||||
@ -796,7 +824,7 @@ int CCSBot::FindPathPoint(float aheadRange, Vector *point, int *prevIndex)
|
||||
if (index >= m_pathLength)
|
||||
index = m_pathLength - 1;
|
||||
|
||||
*point = m_path[ index ].pos;
|
||||
*point = m_path[index].pos;
|
||||
|
||||
// if we are very close to the next point in the path, skip ahead to the next one to avoid wiggling
|
||||
// we must do a 2D check here, in case the goal point is floating in space due to jump down, etc
|
||||
@ -811,7 +839,7 @@ int CCSBot::FindPathPoint(float aheadRange, Vector *point, int *prevIndex)
|
||||
break;
|
||||
}
|
||||
|
||||
*point = m_path[ index ].pos;
|
||||
*point = m_path[index].pos;
|
||||
}
|
||||
|
||||
return index;
|
||||
@ -820,7 +848,7 @@ int CCSBot::FindPathPoint(float aheadRange, Vector *point, int *prevIndex)
|
||||
// make sure we use a node a minimum distance ahead of us, to avoid wiggling
|
||||
while (startIndex < m_pathLength - 1)
|
||||
{
|
||||
Vector pos = m_path[ startIndex + 1 ].pos;
|
||||
Vector pos = m_path[startIndex + 1].pos;
|
||||
|
||||
// we must do a 2D check here, in case the goal point is floating in space due to jump down, etc
|
||||
const float closeEpsilon = 20.0f;
|
||||
@ -836,9 +864,9 @@ int CCSBot::FindPathPoint(float aheadRange, Vector *point, int *prevIndex)
|
||||
|
||||
// if we hit a ladder, stop, or jump area, must stop (dont use ladder behind us)
|
||||
if (startIndex > m_pathIndex && startIndex < m_pathLength
|
||||
&& (m_path[ startIndex ].ladder || (m_path[ startIndex ].area->GetAttributes() & NAV_JUMP)))
|
||||
&& (m_path[startIndex].ladder || (m_path[startIndex].area->GetAttributes() & NAV_JUMP)))
|
||||
{
|
||||
*point = m_path[ startIndex ].pos;
|
||||
*point = m_path[startIndex].pos;
|
||||
return startIndex;
|
||||
}
|
||||
|
||||
@ -847,14 +875,14 @@ int CCSBot::FindPathPoint(float aheadRange, Vector *point, int *prevIndex)
|
||||
startIndex = m_pathLength - 1;
|
||||
|
||||
// if we hit a ladder, stop, or jump area, must stop
|
||||
if (startIndex < m_pathLength && (m_path[ startIndex ].ladder || (m_path[ startIndex ].area->GetAttributes() & NAV_JUMP)))
|
||||
if (startIndex < m_pathLength && (m_path[startIndex].ladder || (m_path[startIndex].area->GetAttributes() & NAV_JUMP)))
|
||||
{
|
||||
*point = m_path[ startIndex ].pos;
|
||||
*point = m_path[startIndex].pos;
|
||||
return startIndex;
|
||||
}
|
||||
|
||||
// note direction of path segment we are standing on
|
||||
Vector initDir = m_path[ startIndex ].pos - m_path[ startIndex - 1 ].pos;
|
||||
Vector initDir = m_path[startIndex].pos - m_path[startIndex - 1].pos;
|
||||
initDir.NormalizeInPlace();
|
||||
|
||||
Vector feet(pev->origin.x, pev->origin.y, GetFeetZ());
|
||||
@ -902,7 +930,7 @@ int CCSBot::FindPathPoint(float aheadRange, Vector *point, int *prevIndex)
|
||||
}
|
||||
|
||||
// if we encounter a ladder or jump area, we must stop
|
||||
if (i < m_pathLength && (m_path[ i ].ladder || (m_path[ i ].area->GetAttributes() & NAV_JUMP)))
|
||||
if (i < m_pathLength && (m_path[i].ladder || (m_path[i].area->GetAttributes() & NAV_JUMP)))
|
||||
break;
|
||||
|
||||
// Check straight-line path from our current position to this position
|
||||
@ -936,8 +964,8 @@ int CCSBot::FindPathPoint(float aheadRange, Vector *point, int *prevIndex)
|
||||
else
|
||||
{
|
||||
// interpolate point along path segment
|
||||
const Vector *afterPoint = &m_path[ afterIndex ].pos;
|
||||
const Vector *beforePoint = &m_path[ afterIndex - 1 ].pos;
|
||||
const Vector *afterPoint = &m_path[afterIndex].pos;
|
||||
const Vector *beforePoint = &m_path[afterIndex - 1].pos;
|
||||
|
||||
Vector to = *afterPoint - *beforePoint;
|
||||
float length = to.Length2D();
|
||||
@ -1009,7 +1037,7 @@ void CCSBot::SetPathIndex(int newIndex)
|
||||
m_pathIndex = Q_min(newIndex, m_pathLength - 1);
|
||||
m_areaEnteredTimestamp = gpGlobals->time;
|
||||
|
||||
if (m_path[ m_pathIndex ].ladder)
|
||||
if (m_path[m_pathIndex].ladder)
|
||||
{
|
||||
SetupLadderMovement();
|
||||
}
|
||||
@ -1017,7 +1045,7 @@ void CCSBot::SetPathIndex(int newIndex)
|
||||
{
|
||||
// get our "encounter spots" for this leg of the path
|
||||
if (m_pathIndex < m_pathLength && m_pathIndex >= 2)
|
||||
m_spotEncounter = m_path[ m_pathIndex - 1 ].area->GetSpotEncounter(m_path[ m_pathIndex - 2 ].area, m_path[ m_pathIndex ].area);
|
||||
m_spotEncounter = m_path[m_pathIndex - 1].area->GetSpotEncounter(m_path[m_pathIndex - 2].area, m_path[m_pathIndex].area);
|
||||
else
|
||||
m_spotEncounter = nullptr;
|
||||
|
||||
@ -1033,9 +1061,9 @@ bool CCSBot::IsNearJump() const
|
||||
|
||||
for (int i = m_pathIndex - 1; i < m_pathIndex; i++)
|
||||
{
|
||||
if (m_path[ i ].area->GetAttributes() & NAV_JUMP)
|
||||
if (m_path[i].area->GetAttributes() & NAV_JUMP)
|
||||
{
|
||||
float dz = m_path[ i + 1 ].pos.z - m_path[ i ].pos.z;
|
||||
float dz = m_path[i + 1].pos.z - m_path[i].pos.z;
|
||||
if (dz > 0.0f)
|
||||
{
|
||||
return true;
|
||||
@ -1374,11 +1402,11 @@ CCSBot::PathResult CCSBot::UpdatePathMovement(bool allowSpeedChange)
|
||||
}
|
||||
else if (m_pathIndex < m_pathLength)
|
||||
{
|
||||
toGoal = m_path[ m_pathIndex ].pos - pev->origin;
|
||||
toGoal = m_path[m_pathIndex].pos - pev->origin;
|
||||
|
||||
// actually aim our view farther down the path
|
||||
const float lookAheadRange = 500.0f;
|
||||
if (!m_path[ m_pathIndex ].ladder && !IsNearJump() && toGoal.Make2D().IsLengthLessThan(lookAheadRange))
|
||||
if (!m_path[m_pathIndex].ladder && !IsNearJump() && toGoal.Make2D().IsLengthLessThan(lookAheadRange))
|
||||
{
|
||||
float along = toGoal.Length2D();
|
||||
int i;
|
||||
@ -1444,7 +1472,7 @@ CCSBot::PathResult CCSBot::UpdatePathMovement(bool allowSpeedChange)
|
||||
{
|
||||
DrawPath();
|
||||
|
||||
const Vector *pos = &m_path[ m_pathIndex ].pos;
|
||||
const Vector *pos = &m_path[m_pathIndex].pos;
|
||||
UTIL_DrawBeamPoints(*pos, *pos + Vector(0, 0, 50), 1, 255, 255, 0);
|
||||
UTIL_DrawBeamPoints(adjustedGoal, adjustedGoal + Vector(0, 0, 50), 1, 255, 0, 255);
|
||||
UTIL_DrawBeamPoints(pev->origin, adjustedGoal + Vector(0, 0, 50), 1, 255, 0, 255);
|
||||
@ -1503,7 +1531,7 @@ CCSBot::PathResult CCSBot::UpdatePathMovement(bool allowSpeedChange)
|
||||
// check if we can reach the next node, in case this was a "jump down" situation
|
||||
if (m_pathIndex < m_pathLength - 1)
|
||||
{
|
||||
if (m_path[ m_pathIndex + 1 ].pos.z - GetFeetZ() > JumpCrouchHeight)
|
||||
if (m_path[m_pathIndex + 1].pos.z - GetFeetZ() > JumpCrouchHeight)
|
||||
{
|
||||
// the next node is too high, too - we really did fall of the path
|
||||
didFall = true;
|
||||
@ -1531,7 +1559,7 @@ CCSBot::PathResult CCSBot::UpdatePathMovement(bool allowSpeedChange)
|
||||
// if we havent made any progress in a long time, give up
|
||||
if (m_pathIndex < m_pathLength - 1)
|
||||
{
|
||||
PrintIfWatched("Giving up trying to get to area #%d\n", m_path[ m_pathIndex ].area->GetID());
|
||||
PrintIfWatched("Giving up trying to get to area #%d\n", m_path[m_pathIndex].area->GetID());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1648,8 +1676,8 @@ bool CCSBot::ComputePath(CNavArea *goalArea, const Vector *goal, RouteType route
|
||||
for (area = effectiveGoalArea; count && area; area = area->GetParent())
|
||||
{
|
||||
count--;
|
||||
m_path[ count ].area = area;
|
||||
m_path[ count ].how = area->GetParentHow();
|
||||
m_path[count].area = area;
|
||||
m_path[count].how = area->GetParentHow();
|
||||
}
|
||||
|
||||
// compute path positions
|
||||
@ -1681,10 +1709,10 @@ bool CCSBot::ComputePath(CNavArea *goalArea, const Vector *goal, RouteType route
|
||||
}
|
||||
|
||||
// append path end position
|
||||
m_path[ m_pathLength ].area = effectiveGoalArea;
|
||||
m_path[ m_pathLength ].pos = pathEndPosition;
|
||||
m_path[ m_pathLength ].ladder = nullptr;
|
||||
m_path[ m_pathLength ].how = NUM_TRAVERSE_TYPES;
|
||||
m_path[m_pathLength].area = effectiveGoalArea;
|
||||
m_path[m_pathLength].pos = pathEndPosition;
|
||||
m_path[m_pathLength].ladder = nullptr;
|
||||
m_path[m_pathLength].how = NUM_TRAVERSE_TYPES;
|
||||
m_pathLength++;
|
||||
|
||||
// do movement setup
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
// Returns true if the radio message is an order to do something
|
||||
@ -286,7 +314,7 @@ void CCSBot::SendRadioMessage(GameEventType event)
|
||||
return;
|
||||
}
|
||||
|
||||
PrintIfWatched("%3.1f: SendRadioMessage( %s )\n", gpGlobals->time, GameEventName[ event ]);
|
||||
PrintIfWatched("%3.1f: SendRadioMessage( %s )\n", gpGlobals->time, GameEventName[event]);
|
||||
|
||||
// note the time the message was sent
|
||||
TheCSBots()->SetRadioMessageTimestamp(event, m_iTeam);
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
// This method is the ONLY legal way to change a bot's current state
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
// Lightweight maintenance, invoked frequently
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
// Used to update view angles to stay on a ladder
|
||||
@ -23,7 +51,6 @@ float StayOnLadderLine(CCSBot *me, const CNavLadder *ladder)
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
#ifndef HOOK_GAMEDLL
|
||||
// Move actual view angles towards desired ones.
|
||||
// This is the only place v_angle is altered.
|
||||
// TODO: Make stiffness and turn rate constants timestep invariant.
|
||||
@ -191,7 +218,6 @@ void CCSBot::UpdateLookAngles()
|
||||
|
||||
pev->v_angle.z = 0.0f;
|
||||
}
|
||||
#endif // HOOK_GAMEDLL
|
||||
|
||||
// Return true if we can see the point
|
||||
bool CCSBot::IsVisible(const Vector *pos, bool testFOV) const
|
||||
@ -647,7 +673,7 @@ CBasePlayer *CCSBot::FindMostDangerousThreat()
|
||||
if (prevIndex < 0)
|
||||
prevIndex = MAX_ENEMY_QUEUE - 1;
|
||||
|
||||
CBasePlayer *currentThreat = m_enemyQueue[ prevIndex ].player;
|
||||
CBasePlayer *currentThreat = m_enemyQueue[prevIndex].player;
|
||||
#endif
|
||||
|
||||
m_bomber = nullptr;
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
// Fire our active weapon towards our current enemy
|
||||
@ -34,7 +62,7 @@ void CCSBot::FireWeaponAtEnemy()
|
||||
float rangeToEnemy = toAimSpot.NormalizeInPlace();
|
||||
|
||||
const float_precision halfPI = (M_PI / 180.0f);
|
||||
float_precision yaw = pev->v_angle[ YAW ] * halfPI;
|
||||
float_precision yaw = pev->v_angle[YAW] * halfPI;
|
||||
|
||||
Vector2D dir(Q_cos(yaw), Q_sin(yaw));
|
||||
float_precision onTarget = DotProduct(toAimSpot, dir);
|
||||
@ -367,7 +395,7 @@ bool CCSBot::IsPrimaryWeaponEmpty() const
|
||||
// Return true if pistol doesn't exist or is totally out of ammo
|
||||
bool CCSBot::IsPistolEmpty() const
|
||||
{
|
||||
CBasePlayerWeapon *pCurrentWeapon = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[ PISTOL_SLOT ]);
|
||||
CBasePlayerWeapon *pCurrentWeapon = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[PISTOL_SLOT]);
|
||||
if (!pCurrentWeapon)
|
||||
return true;
|
||||
|
||||
@ -407,7 +435,7 @@ void CCSBot::EquipBestWeapon(bool mustEquip)
|
||||
if (!mustEquip && m_equipTimer.GetElapsedTime() < minEquipInterval)
|
||||
return;
|
||||
|
||||
CBasePlayerWeapon *pPrimary = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ]);
|
||||
CBasePlayerWeapon *pPrimary = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[PRIMARY_WEAPON_SLOT]);
|
||||
if (pPrimary)
|
||||
{
|
||||
WeaponClassType weaponClass = WeaponIDToWeaponClass(pPrimary->m_iId);
|
||||
@ -430,7 +458,7 @@ void CCSBot::EquipBestWeapon(bool mustEquip)
|
||||
|
||||
if (TheCSBots()->AllowPistols())
|
||||
{
|
||||
if (DoEquip(static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[ PISTOL_SLOT ])))
|
||||
if (DoEquip(static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[PISTOL_SLOT])))
|
||||
return;
|
||||
}
|
||||
|
||||
@ -447,7 +475,7 @@ void CCSBot::EquipPistol()
|
||||
|
||||
if (TheCSBots()->AllowPistols() && !IsUsingPistol())
|
||||
{
|
||||
CBasePlayerWeapon *pistol = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[ PISTOL_SLOT ]);
|
||||
CBasePlayerWeapon *pistol = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[PISTOL_SLOT]);
|
||||
DoEquip(pistol);
|
||||
}
|
||||
}
|
||||
@ -457,7 +485,7 @@ void CCSBot::EquipKnife()
|
||||
{
|
||||
if (!IsUsingKnife())
|
||||
{
|
||||
CBasePlayerWeapon *pKnife = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[ KNIFE_SLOT ]);
|
||||
CBasePlayerWeapon *pKnife = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[KNIFE_SLOT]);
|
||||
if (pKnife)
|
||||
{
|
||||
SelectItem(STRING(pKnife->pev->classname));
|
||||
@ -468,7 +496,7 @@ void CCSBot::EquipKnife()
|
||||
// Return true if we have a grenade in our inventory
|
||||
bool CCSBot::HasGrenade() const
|
||||
{
|
||||
CBasePlayerWeapon *pGrenade = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[ GRENADE_SLOT ]);
|
||||
CBasePlayerWeapon *pGrenade = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[GRENADE_SLOT]);
|
||||
return pGrenade != nullptr;
|
||||
}
|
||||
|
||||
@ -484,7 +512,7 @@ bool CCSBot::EquipGrenade(bool noSmoke)
|
||||
|
||||
if (HasGrenade())
|
||||
{
|
||||
CBasePlayerWeapon *pGrenade = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[ GRENADE_SLOT ]);
|
||||
CBasePlayerWeapon *pGrenade = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[GRENADE_SLOT]);
|
||||
if (pGrenade)
|
||||
{
|
||||
if (noSmoke && pGrenade->m_iId == WEAPON_SMOKEGRENADE)
|
||||
@ -774,12 +802,12 @@ void CCSBot::SilencerCheck()
|
||||
// Invoked when in contact with a CWeaponBox
|
||||
void CCSBot::OnTouchingWeapon(CWeaponBox *box)
|
||||
{
|
||||
auto pDroppedWeapon = box->m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ];
|
||||
auto pDroppedWeapon = box->m_rgpPlayerItems[PRIMARY_WEAPON_SLOT];
|
||||
|
||||
// right now we only care about primary weapons on the ground
|
||||
if (pDroppedWeapon)
|
||||
{
|
||||
CBasePlayerWeapon *pWeapon = (CBasePlayerWeapon *)m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ];
|
||||
CBasePlayerWeapon *pWeapon = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[PRIMARY_WEAPON_SLOT]);
|
||||
|
||||
// if the gun on the ground is the same one we have, dont bother
|
||||
if (pWeapon && pWeapon->IsWeapon() && pDroppedWeapon->m_iId != pWeapon->m_iId)
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
CSGameState::CSGameState(CCSBot *owner)
|
||||
@ -403,7 +431,7 @@ const Vector *CSGameState::GetRandomFreeHostagePosition()
|
||||
if (info->hostage->IsFollowingSomeone())
|
||||
continue;
|
||||
|
||||
freePos[ freeCount++ ] = &info->hostage->pev->origin;
|
||||
freePos[freeCount++] = &info->hostage->pev->origin;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -411,7 +439,7 @@ const Vector *CSGameState::GetRandomFreeHostagePosition()
|
||||
if (info->isValid == false)
|
||||
continue;
|
||||
|
||||
freePos[ freeCount++ ] = &info->knownPos;
|
||||
freePos[freeCount++] = &info->knownPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
// Begin attacking
|
||||
|
@ -1,8 +1,36 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
bool HasDefaultPistol(CCSBot *me)
|
||||
{
|
||||
CBasePlayerWeapon *pSecondary = static_cast<CBasePlayerWeapon *>(me->m_rgpPlayerItems[ PISTOL_SLOT ]);
|
||||
CBasePlayerWeapon *pSecondary = static_cast<CBasePlayerWeapon *>(me->m_rgpPlayerItems[PISTOL_SLOT]);
|
||||
|
||||
if (!pSecondary)
|
||||
return false;
|
||||
@ -73,7 +101,7 @@ void BuyState::OnEnter(CCSBot *me)
|
||||
|
||||
if (TheCSBots()->AllowPistols())
|
||||
{
|
||||
CBasePlayerWeapon *pSecondary = static_cast<CBasePlayerWeapon *>(me->m_rgpPlayerItems[ PISTOL_SLOT ]);
|
||||
CBasePlayerWeapon *pSecondary = static_cast<CBasePlayerWeapon *>(me->m_rgpPlayerItems[PISTOL_SLOT]);
|
||||
|
||||
// check if we have a pistol
|
||||
if (pSecondary)
|
||||
@ -130,10 +158,7 @@ struct BuyInfo
|
||||
};
|
||||
|
||||
// These tables MUST be kept in sync with the CT and T buy aliases
|
||||
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
BuyInfo primaryWeaponBuyInfoCT[ MAX_BUY_WEAPON_PRIMARY ] =
|
||||
BuyInfo primaryWeaponBuyInfoCT[MAX_BUY_WEAPON_PRIMARY] =
|
||||
{
|
||||
{ SHOTGUN, false, "m3" }, // WEAPON_M3
|
||||
{ SHOTGUN, false, "xm1014" }, // WEAPON_XM1014
|
||||
@ -150,7 +175,7 @@ BuyInfo primaryWeaponBuyInfoCT[ MAX_BUY_WEAPON_PRIMARY ] =
|
||||
{ MACHINE_GUN, false, "m249" }, // WEAPON_M249
|
||||
};
|
||||
|
||||
BuyInfo secondaryWeaponBuyInfoCT[ MAX_BUY_WEAPON_SECONDARY ] =
|
||||
BuyInfo secondaryWeaponBuyInfoCT[MAX_BUY_WEAPON_SECONDARY] =
|
||||
{
|
||||
// { PISTOL, false, "glock" },
|
||||
// { PISTOL, false, "usp" },
|
||||
@ -159,7 +184,7 @@ BuyInfo secondaryWeaponBuyInfoCT[ MAX_BUY_WEAPON_SECONDARY ] =
|
||||
{ PISTOL, true, "fn57" },
|
||||
};
|
||||
|
||||
BuyInfo primaryWeaponBuyInfoT[ MAX_BUY_WEAPON_PRIMARY ] =
|
||||
BuyInfo primaryWeaponBuyInfoT[MAX_BUY_WEAPON_PRIMARY] =
|
||||
{
|
||||
{ SHOTGUN, false, "m3" }, // WEAPON_M3
|
||||
{ SHOTGUN, false, "xm1014" }, // WEAPON_XM1014
|
||||
@ -176,7 +201,7 @@ BuyInfo primaryWeaponBuyInfoT[ MAX_BUY_WEAPON_PRIMARY ] =
|
||||
{ MACHINE_GUN, false, "m249" }, // WEAPON_M249
|
||||
};
|
||||
|
||||
BuyInfo secondaryWeaponBuyInfoT[ MAX_BUY_WEAPON_SECONDARY ] =
|
||||
BuyInfo secondaryWeaponBuyInfoT[MAX_BUY_WEAPON_SECONDARY] =
|
||||
{
|
||||
// { PISTOL, false, "glock" },
|
||||
// { PISTOL, false, "usp" },
|
||||
@ -185,16 +210,6 @@ BuyInfo secondaryWeaponBuyInfoT[ MAX_BUY_WEAPON_SECONDARY ] =
|
||||
{ PISTOL, true, "elites" },
|
||||
};
|
||||
|
||||
#else // HOOK_GAMEDLL
|
||||
|
||||
BuyInfo primaryWeaponBuyInfoCT[ MAX_BUY_WEAPON_PRIMARY ];
|
||||
BuyInfo secondaryWeaponBuyInfoCT[ MAX_BUY_WEAPON_SECONDARY];
|
||||
|
||||
BuyInfo primaryWeaponBuyInfoT[ MAX_BUY_WEAPON_PRIMARY ];
|
||||
BuyInfo secondaryWeaponBuyInfoT[ MAX_BUY_WEAPON_SECONDARY ];
|
||||
|
||||
#endif // HOOK_GAMEDLL
|
||||
|
||||
// Given a weapon alias, return the kind of weapon it is
|
||||
inline WeaponType GetWeaponType(const char *alias)
|
||||
{
|
||||
@ -373,7 +388,7 @@ void BuyState::OnUpdate(CCSBot *me)
|
||||
{
|
||||
// build list of allowable weapons to buy
|
||||
BuyInfo *masterPrimary = (me->m_iTeam == TERRORIST) ? primaryWeaponBuyInfoT : primaryWeaponBuyInfoCT;
|
||||
BuyInfo *stockPrimary[ MAX_BUY_WEAPON_PRIMARY ];
|
||||
BuyInfo *stockPrimary[MAX_BUY_WEAPON_PRIMARY];
|
||||
int stockPrimaryCount = 0;
|
||||
|
||||
// dont choose sniper rifles as often
|
||||
@ -388,7 +403,7 @@ void BuyState::OnUpdate(CCSBot *me)
|
||||
(masterPrimary[i].type == SNIPER_RIFLE && TheCSBots()->AllowSnipers() && wantSniper) ||
|
||||
(masterPrimary[i].type == MACHINE_GUN && TheCSBots()->AllowMachineGuns()))
|
||||
{
|
||||
stockPrimary[ stockPrimaryCount++ ] = &masterPrimary[i];
|
||||
stockPrimary[stockPrimaryCount++] = &masterPrimary[i];
|
||||
}
|
||||
}
|
||||
|
||||
@ -428,8 +443,8 @@ void BuyState::OnUpdate(CCSBot *me)
|
||||
which = RANDOM_LONG(0, stockPrimaryCount - 1);
|
||||
}
|
||||
|
||||
me->ClientCommand(stockPrimary[ which ]->buyAlias);
|
||||
me->PrintIfWatched("Tried to buy %s.\n", stockPrimary[ which ]->buyAlias);
|
||||
me->ClientCommand(stockPrimary[which]->buyAlias);
|
||||
me->PrintIfWatched("Tried to buy %s.\n", stockPrimary[which]->buyAlias);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -455,9 +470,9 @@ void BuyState::OnUpdate(CCSBot *me)
|
||||
int which = RANDOM_LONG(0, MAX_BUY_WEAPON_SECONDARY - 1);
|
||||
|
||||
if (me->m_iTeam == TERRORIST)
|
||||
me->ClientCommand(secondaryWeaponBuyInfoT[ which ].buyAlias);
|
||||
me->ClientCommand(secondaryWeaponBuyInfoT[which].buyAlias);
|
||||
else
|
||||
me->ClientCommand(secondaryWeaponBuyInfoCT[ which ].buyAlias);
|
||||
me->ClientCommand(secondaryWeaponBuyInfoCT[which].buyAlias);
|
||||
|
||||
// only buy one pistol
|
||||
m_buyPistol = false;
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
// Begin defusing the bomb
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
void EscapeFromBombState::OnEnter(CCSBot *me)
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
// Move to the bomb on the floor and pick it up
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
// Follow our leader
|
||||
@ -216,7 +244,7 @@ void FollowState::OnUpdate(CCSBot *me)
|
||||
// if we are idle, pick a random area
|
||||
if (m_idleTimer.IsElapsed())
|
||||
{
|
||||
target = collector.m_targetArea[ RANDOM_LONG(0, collector.m_targetAreaCount - 1) ];
|
||||
target = collector.m_targetArea[RANDOM_LONG(0, collector.m_targetAreaCount - 1)];
|
||||
targetPos = *target->GetCenter();
|
||||
me->PrintIfWatched("%4.1f: Bored. Repathing to a new nearby area\n", gpGlobals->time);
|
||||
}
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
// Begin moving to a nearby hidey-hole.
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
// Begin the hunt
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
// range for snipers to select a hiding spot
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
// Move towards currently heard noise
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
// Move to a potentially far away position.
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
// Plant the bomb.
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
// Face the entity and "use" it
|
||||
|
@ -1,10 +1,5 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
TYPEDESCRIPTION CEnvGlobal::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CEnvGlobal, m_globalstate, FIELD_STRING),
|
||||
@ -12,46 +7,6 @@ TYPEDESCRIPTION CEnvGlobal::m_SaveData[] =
|
||||
DEFINE_FIELD(CEnvGlobal, m_initialstate, FIELD_INTEGER),
|
||||
};
|
||||
|
||||
TYPEDESCRIPTION CMultiSource::m_SaveData[] =
|
||||
{
|
||||
// BUGBUG FIX
|
||||
DEFINE_ARRAY(CMultiSource, m_rgEntities, FIELD_EHANDLE, MAX_MS_TARGETS),
|
||||
DEFINE_ARRAY(CMultiSource, m_rgTriggered, FIELD_INTEGER, MAX_MS_TARGETS),
|
||||
DEFINE_FIELD(CMultiSource, m_iTotal, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CMultiSource, m_globalstate, FIELD_STRING),
|
||||
};
|
||||
|
||||
// CBaseButton
|
||||
TYPEDESCRIPTION CBaseButton::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CBaseButton, m_fStayPushed, FIELD_BOOLEAN),
|
||||
DEFINE_FIELD(CBaseButton, m_fRotating, FIELD_BOOLEAN),
|
||||
DEFINE_FIELD(CBaseButton, m_sounds, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CBaseButton, m_bLockedSound, FIELD_CHARACTER),
|
||||
DEFINE_FIELD(CBaseButton, m_bLockedSentence, FIELD_CHARACTER),
|
||||
DEFINE_FIELD(CBaseButton, m_bUnlockedSound, FIELD_CHARACTER),
|
||||
DEFINE_FIELD(CBaseButton, m_bUnlockedSentence, FIELD_CHARACTER),
|
||||
DEFINE_FIELD(CBaseButton, m_strChangeTarget, FIELD_STRING),
|
||||
// DEFINE_FIELD(CBaseButton, m_ls, FIELD_???), // This is restored in Precache()
|
||||
};
|
||||
|
||||
TYPEDESCRIPTION CMomentaryRotButton::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CMomentaryRotButton, m_lastUsed, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CMomentaryRotButton, m_direction, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CMomentaryRotButton, m_returnSpeed, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CMomentaryRotButton, m_start, FIELD_VECTOR),
|
||||
DEFINE_FIELD(CMomentaryRotButton, m_end, FIELD_VECTOR),
|
||||
DEFINE_FIELD(CMomentaryRotButton, m_sounds, FIELD_INTEGER),
|
||||
};
|
||||
|
||||
TYPEDESCRIPTION CEnvSpark::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CEnvSpark, m_flDelay, FIELD_FLOAT),
|
||||
};
|
||||
|
||||
#endif // HOOK_GAMEDLL
|
||||
|
||||
IMPLEMENT_SAVERESTORE(CEnvGlobal, CBaseEntity)
|
||||
LINK_ENTITY_TO_CLASS(env_global, CEnvGlobal, CCSEnvGlobal)
|
||||
|
||||
@ -136,6 +91,15 @@ void CEnvGlobal::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use
|
||||
gGlobalState.EntityAdd(m_globalstate, gpGlobals->mapname, newState);
|
||||
}
|
||||
|
||||
TYPEDESCRIPTION CMultiSource::m_SaveData[] =
|
||||
{
|
||||
// BUGBUG FIX
|
||||
DEFINE_ARRAY(CMultiSource, m_rgEntities, FIELD_EHANDLE, MAX_MS_TARGETS),
|
||||
DEFINE_ARRAY(CMultiSource, m_rgTriggered, FIELD_INTEGER, MAX_MS_TARGETS),
|
||||
DEFINE_FIELD(CMultiSource, m_iTotal, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CMultiSource, m_globalstate, FIELD_STRING),
|
||||
};
|
||||
|
||||
IMPLEMENT_SAVERESTORE(CMultiSource, CBaseEntity)
|
||||
LINK_ENTITY_TO_CLASS(multisource, CMultiSource, CCSMultiSource)
|
||||
|
||||
@ -297,6 +261,19 @@ void CMultiSource::Register()
|
||||
pev->spawnflags &= ~SF_MULTI_INIT;
|
||||
}
|
||||
|
||||
TYPEDESCRIPTION CBaseButton::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CBaseButton, m_fStayPushed, FIELD_BOOLEAN),
|
||||
DEFINE_FIELD(CBaseButton, m_fRotating, FIELD_BOOLEAN),
|
||||
DEFINE_FIELD(CBaseButton, m_sounds, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CBaseButton, m_bLockedSound, FIELD_CHARACTER),
|
||||
DEFINE_FIELD(CBaseButton, m_bLockedSentence, FIELD_CHARACTER),
|
||||
DEFINE_FIELD(CBaseButton, m_bUnlockedSound, FIELD_CHARACTER),
|
||||
DEFINE_FIELD(CBaseButton, m_bUnlockedSentence, FIELD_CHARACTER),
|
||||
DEFINE_FIELD(CBaseButton, m_strChangeTarget, FIELD_STRING),
|
||||
// DEFINE_FIELD(CBaseButton, m_ls, FIELD_???), // This is restored in Precache()
|
||||
};
|
||||
|
||||
IMPLEMENT_SAVERESTORE(CBaseButton, CBaseToggle)
|
||||
|
||||
void CBaseButton::Precache()
|
||||
@ -922,6 +899,16 @@ void CRotButton::Restart()
|
||||
}
|
||||
#endif
|
||||
|
||||
TYPEDESCRIPTION CMomentaryRotButton::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CMomentaryRotButton, m_lastUsed, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CMomentaryRotButton, m_direction, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CMomentaryRotButton, m_returnSpeed, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CMomentaryRotButton, m_start, FIELD_VECTOR),
|
||||
DEFINE_FIELD(CMomentaryRotButton, m_end, FIELD_VECTOR),
|
||||
DEFINE_FIELD(CMomentaryRotButton, m_sounds, FIELD_INTEGER),
|
||||
};
|
||||
|
||||
IMPLEMENT_SAVERESTORE(CMomentaryRotButton, CBaseToggle)
|
||||
LINK_ENTITY_TO_CLASS(momentary_rot_button, CMomentaryRotButton, CCSMomentaryRotButton)
|
||||
|
||||
@ -1137,6 +1124,11 @@ void CMomentaryRotButton::UpdateSelfReturn(float value)
|
||||
}
|
||||
}
|
||||
|
||||
TYPEDESCRIPTION CEnvSpark::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CEnvSpark, m_flDelay, FIELD_FLOAT),
|
||||
};
|
||||
|
||||
IMPLEMENT_SAVERESTORE(CEnvSpark, CBaseEntity)
|
||||
LINK_ENTITY_TO_CLASS(env_spark, CEnvSpark, CCSEnvSpark)
|
||||
LINK_ENTITY_TO_CLASS(env_debris, CEnvSpark, CCSEnvSpark)
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[3];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
string_t m_globalstate;
|
||||
int m_triggermode;
|
||||
@ -59,8 +59,9 @@ public:
|
||||
virtual void Restart();
|
||||
virtual int Save(CSave &save);
|
||||
virtual int Restore(CRestore &restore);
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION m_SaveData[1];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
Vector m_vecSpawn;
|
||||
#endif
|
||||
|
||||
@ -103,7 +104,7 @@ public:
|
||||
|
||||
public:
|
||||
static CMomentaryRotButton *Instance(edict_t *pent) { return (CMomentaryRotButton *)GET_PRIVATE(pent); }
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[6];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
int m_lastUsed;
|
||||
int m_direction;
|
||||
@ -131,7 +132,8 @@ public:
|
||||
void EXPORT SparkStop(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[1];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
float m_flDelay;
|
||||
};
|
||||
|
||||
|
@ -1,39 +1,7 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
CCareerTaskManager *TheCareerTasks = nullptr;
|
||||
|
||||
const TaskInfo taskInfo[] =
|
||||
{
|
||||
{ "defuse", EVENT_BOMB_DEFUSED, &CCareerTask::NewTask },
|
||||
{ "plant", EVENT_BOMB_PLANTED, &CCareerTask::NewTask },
|
||||
{ "rescue", EVENT_HOSTAGE_RESCUED, &CCareerTask::NewTask },
|
||||
{ "killall", EVENT_KILL_ALL, &CCareerTask::NewTask },
|
||||
{ "kill", EVENT_KILL, &CCareerTask::NewTask },
|
||||
{ "killwith", EVENT_KILL, &CCareerTask::NewTask },
|
||||
{ "killblind", EVENT_KILL_FLASHBANGED, &CCareerTask::NewTask },
|
||||
{ "killvip", EVENT_KILL, &CCareerTask::NewTask },
|
||||
{ "headshot", EVENT_HEADSHOT, &CCareerTask::NewTask },
|
||||
{ "headshotwith", EVENT_HEADSHOT, &CCareerTask::NewTask },
|
||||
{ "winfast", EVENT_ROUND_WIN, &CCareerTask::NewTask },
|
||||
{ "rescue", EVENT_HOSTAGE_RESCUED, &CCareerTask::NewTask },
|
||||
{ "rescueall", EVENT_ALL_HOSTAGES_RESCUED, &CCareerTask::NewTask },
|
||||
{ "injure", EVENT_PLAYER_TOOK_DAMAGE, &CCareerTask::NewTask },
|
||||
{ "injurewith", EVENT_PLAYER_TOOK_DAMAGE, &CCareerTask::NewTask },
|
||||
{ "killdefuser", EVENT_KILL, &CCareerTask::NewTask },
|
||||
{ "stoprescue", EVENT_KILL, &CCareerTask::NewTask },
|
||||
{ "defendhostages", EVENT_ROUND_WIN, &CCareerTask::NewTask },
|
||||
{ "hostagessurvive", EVENT_ROUND_WIN, &CCareerTask::NewTask },
|
||||
{ "preventdefuse", EVENT_ROUND_WIN, &CPreventDefuseTask::NewTask },
|
||||
{ nullptr, EVENT_INVALID, &CCareerTask::NewTask },
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
CCareerTask *CPreventDefuseTask::NewTask(const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete)
|
||||
{
|
||||
CPreventDefuseTask *pNewTask = new CPreventDefuseTask(taskName, event, weaponName, n, mustLive, crossRounds, id, isComplete);
|
||||
@ -439,22 +407,45 @@ void CCareerTaskManager::SetFinishedTaskTime(int val)
|
||||
m_finishedTaskRound = CSGameRules()->m_iTotalRoundsPlayed;
|
||||
}
|
||||
|
||||
const TaskInfo CCareerTaskManager::m_taskInfo[] =
|
||||
{
|
||||
{ "defuse", EVENT_BOMB_DEFUSED, &CCareerTask::NewTask },
|
||||
{ "plant", EVENT_BOMB_PLANTED, &CCareerTask::NewTask },
|
||||
{ "rescue", EVENT_HOSTAGE_RESCUED, &CCareerTask::NewTask },
|
||||
{ "killall", EVENT_KILL_ALL, &CCareerTask::NewTask },
|
||||
{ "kill", EVENT_KILL, &CCareerTask::NewTask },
|
||||
{ "killwith", EVENT_KILL, &CCareerTask::NewTask },
|
||||
{ "killblind", EVENT_KILL_FLASHBANGED, &CCareerTask::NewTask },
|
||||
{ "killvip", EVENT_KILL, &CCareerTask::NewTask },
|
||||
{ "headshot", EVENT_HEADSHOT, &CCareerTask::NewTask },
|
||||
{ "headshotwith", EVENT_HEADSHOT, &CCareerTask::NewTask },
|
||||
{ "winfast", EVENT_ROUND_WIN, &CCareerTask::NewTask },
|
||||
{ "rescue", EVENT_HOSTAGE_RESCUED, &CCareerTask::NewTask },
|
||||
{ "rescueall", EVENT_ALL_HOSTAGES_RESCUED, &CCareerTask::NewTask },
|
||||
{ "injure", EVENT_PLAYER_TOOK_DAMAGE, &CCareerTask::NewTask },
|
||||
{ "injurewith", EVENT_PLAYER_TOOK_DAMAGE, &CCareerTask::NewTask },
|
||||
{ "killdefuser", EVENT_KILL, &CCareerTask::NewTask },
|
||||
{ "stoprescue", EVENT_KILL, &CCareerTask::NewTask },
|
||||
{ "defendhostages", EVENT_ROUND_WIN, &CCareerTask::NewTask },
|
||||
{ "hostagessurvive", EVENT_ROUND_WIN, &CCareerTask::NewTask },
|
||||
{ "preventdefuse", EVENT_ROUND_WIN, &CPreventDefuseTask::NewTask },
|
||||
{ nullptr, EVENT_INVALID, &CCareerTask::NewTask },
|
||||
};
|
||||
|
||||
void CCareerTaskManager::AddTask(const char *taskName, const char *weaponName, int eventCount, bool mustLive, bool crossRounds, bool isComplete)
|
||||
{
|
||||
++m_nextId;
|
||||
m_nextId++;
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(taskInfo); ++i)
|
||||
for (auto &taskInfo : m_taskInfo)
|
||||
{
|
||||
const TaskInfo *pTaskInfo = &taskInfo[ i ];
|
||||
|
||||
if (pTaskInfo->taskName)
|
||||
if (taskInfo.taskName)
|
||||
{
|
||||
if (!Q_stricmp(pTaskInfo->taskName, taskName))
|
||||
if (!Q_stricmp(taskInfo.taskName, taskName))
|
||||
{
|
||||
CCareerTask *newTask = pTaskInfo->factory
|
||||
CCareerTask *newTask = taskInfo.factory
|
||||
(
|
||||
pTaskInfo->taskName,
|
||||
pTaskInfo->event,
|
||||
taskInfo.taskName,
|
||||
taskInfo.event,
|
||||
weaponName,
|
||||
eventCount,
|
||||
mustLive,
|
||||
@ -465,7 +456,7 @@ void CCareerTaskManager::AddTask(const char *taskName, const char *weaponName, i
|
||||
|
||||
m_tasks.push_back(newTask);
|
||||
|
||||
if (pTaskInfo->event == EVENT_ROUND_WIN && !Q_strcmp(taskName, "winfast"))
|
||||
if (taskInfo.event == EVENT_ROUND_WIN && !Q_strcmp(taskName, "winfast"))
|
||||
{
|
||||
m_taskTime = eventCount;
|
||||
|
||||
|
@ -35,6 +35,7 @@ class CCareerTask
|
||||
public:
|
||||
CCareerTask() {};
|
||||
CCareerTask(const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete);
|
||||
|
||||
public:
|
||||
virtual void OnEvent(GameEventType event, CBasePlayer *pAttacker, CBasePlayer *pVictim);
|
||||
virtual void Reset();
|
||||
@ -72,15 +73,23 @@ private:
|
||||
bool m_vip;
|
||||
};
|
||||
|
||||
typedef std::STD_LIST<CCareerTask *> CareerTaskList;
|
||||
typedef std::list<CCareerTask *> CareerTaskList;
|
||||
typedef CareerTaskList::iterator CareerTaskListIt;
|
||||
|
||||
typedef CCareerTask *(*TaskFactoryFunction)(const char *taskName, GameEventType event, const char *weaponName, int eventCount, bool mustLive, bool crossRounds, int nextId, bool isComplete);
|
||||
using TaskFactoryFunction = CCareerTask *(*)(const char *taskName, GameEventType event, const char *weaponName, int eventCount, bool mustLive, bool crossRounds, int nextId, bool isComplete);
|
||||
|
||||
struct TaskInfo
|
||||
{
|
||||
const char *taskName;
|
||||
GameEventType event;
|
||||
TaskFactoryFunction factory;
|
||||
};
|
||||
|
||||
class CPreventDefuseTask: public CCareerTask
|
||||
{
|
||||
public:
|
||||
CPreventDefuseTask(const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete);
|
||||
|
||||
public:
|
||||
virtual void OnEvent(GameEventType event, CBasePlayer *pAttacker, CBasePlayer *pVictim);
|
||||
virtual void Reset();
|
||||
@ -124,6 +133,8 @@ public:
|
||||
void UnlatchRoundEndMessage();
|
||||
|
||||
private:
|
||||
static const TaskInfo m_taskInfo[];
|
||||
|
||||
CareerTaskList m_tasks;
|
||||
|
||||
int m_nextId;
|
||||
@ -136,11 +147,4 @@ private:
|
||||
bool m_shouldLatchRoundEndMessage;
|
||||
};
|
||||
|
||||
struct TaskInfo
|
||||
{
|
||||
const char *taskName;
|
||||
GameEventType event;
|
||||
TaskFactoryFunction factory;
|
||||
};
|
||||
|
||||
extern CCareerTaskManager *TheCareerTasks;
|
||||
|
@ -1,10 +1,5 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
DLL_FUNCTIONS gFunctionTable =
|
||||
{
|
||||
&GameDLLInit,
|
||||
@ -68,20 +63,8 @@ NEW_DLL_FUNCTIONS gNewDLLFunctions =
|
||||
nullptr
|
||||
};
|
||||
|
||||
// Global Savedata for Delay
|
||||
TYPEDESCRIPTION CBaseEntity::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CBaseEntity, m_pGoalEnt, FIELD_CLASSPTR),
|
||||
DEFINE_FIELD(CBaseEntity, m_pfnThink, FIELD_FUNCTION), // UNDONE: Build table of these!
|
||||
DEFINE_FIELD(CBaseEntity, m_pfnTouch, FIELD_FUNCTION),
|
||||
DEFINE_FIELD(CBaseEntity, m_pfnUse, FIELD_FUNCTION),
|
||||
DEFINE_FIELD(CBaseEntity, m_pfnBlocked, FIELD_FUNCTION),
|
||||
};
|
||||
|
||||
CMemoryPool hashItemMemPool(sizeof(hash_item_t), 64);
|
||||
|
||||
#endif // HOOK_GAMEDLL
|
||||
|
||||
int CaseInsensitiveHash(const char *string, int iBounds)
|
||||
{
|
||||
unsigned int hash = 0;
|
||||
@ -107,7 +90,7 @@ void EmptyEntityHashTable()
|
||||
int i;
|
||||
hash_item_t *item, *temp, *free;
|
||||
|
||||
for (i = 0; i < stringsHashTable.Count(); ++i)
|
||||
for (i = 0; i < stringsHashTable.Count(); i++)
|
||||
{
|
||||
item = &stringsHashTable[i];
|
||||
temp = item->next;
|
||||
@ -292,7 +275,7 @@ C_DLLEXPORT int GetEntityAPI(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion
|
||||
|
||||
Q_memcpy(pFunctionTable, &gFunctionTable, sizeof(DLL_FUNCTIONS));
|
||||
stringsHashTable.AddMultipleToTail(2048);
|
||||
for (int i = 0; i < stringsHashTable.Count(); ++i)
|
||||
for (int i = 0; i < stringsHashTable.Count(); i++)
|
||||
{
|
||||
stringsHashTable[i].next = nullptr;
|
||||
}
|
||||
@ -338,7 +321,7 @@ int DispatchSpawn(edict_t *pent)
|
||||
// Try to get the pointer again, in case the spawn function deleted the entity.
|
||||
// UNDONE: Spawn() should really return a code to ask that the entity be deleted, but
|
||||
// that would touch too much code for me to do that right now.
|
||||
pEntity = (CBaseEntity *)GET_PRIVATE(pent);
|
||||
pEntity = GET_PRIVATE<CBaseEntity>(pent);
|
||||
|
||||
if (pEntity)
|
||||
{
|
||||
@ -397,7 +380,7 @@ void DispatchKeyValue(edict_t *pentKeyvalue, KeyValueData *pkvd)
|
||||
return;
|
||||
|
||||
// Get the actualy entity object
|
||||
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pentKeyvalue);
|
||||
CBaseEntity *pEntity = GET_PRIVATE<CBaseEntity>(pentKeyvalue);
|
||||
if (!pEntity)
|
||||
return;
|
||||
|
||||
@ -408,8 +391,8 @@ void DispatchKeyValue(edict_t *pentKeyvalue, KeyValueData *pkvd)
|
||||
// while it builds the graph
|
||||
void DispatchTouch(edict_t *pentTouched, edict_t *pentOther)
|
||||
{
|
||||
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pentTouched);
|
||||
CBaseEntity *pOther = (CBaseEntity *)GET_PRIVATE(pentOther);
|
||||
CBaseEntity *pEntity = GET_PRIVATE<CBaseEntity>(pentTouched);
|
||||
CBaseEntity *pOther = GET_PRIVATE<CBaseEntity>(pentOther);
|
||||
|
||||
if (pEntity && pOther && !((pEntity->pev->flags | pOther->pev->flags) & FL_KILLME))
|
||||
pEntity->Touch(pOther);
|
||||
@ -417,8 +400,8 @@ void DispatchTouch(edict_t *pentTouched, edict_t *pentOther)
|
||||
|
||||
void DispatchUse(edict_t *pentUsed, edict_t *pentOther)
|
||||
{
|
||||
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pentUsed);
|
||||
CBaseEntity *pOther = (CBaseEntity *)GET_PRIVATE(pentOther);
|
||||
CBaseEntity *pEntity = GET_PRIVATE<CBaseEntity>(pentUsed);
|
||||
CBaseEntity *pOther = GET_PRIVATE<CBaseEntity>(pentOther);
|
||||
|
||||
if (pEntity && !(pEntity->pev->flags & FL_KILLME))
|
||||
pEntity->Use(pOther, pOther, USE_TOGGLE, 0);
|
||||
@ -426,7 +409,7 @@ void DispatchUse(edict_t *pentUsed, edict_t *pentOther)
|
||||
|
||||
void DispatchThink(edict_t *pent)
|
||||
{
|
||||
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent);
|
||||
CBaseEntity *pEntity = GET_PRIVATE<CBaseEntity>(pent);
|
||||
|
||||
if (pEntity)
|
||||
{
|
||||
@ -441,8 +424,8 @@ void DispatchThink(edict_t *pent)
|
||||
|
||||
void DispatchBlocked(edict_t *pentBlocked, edict_t *pentOther)
|
||||
{
|
||||
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pentBlocked);
|
||||
CBaseEntity *pOther = (CBaseEntity *)GET_PRIVATE(pentOther);
|
||||
CBaseEntity *pEntity = GET_PRIVATE<CBaseEntity>(pentBlocked);
|
||||
CBaseEntity *pOther = GET_PRIVATE<CBaseEntity>(pentOther);
|
||||
|
||||
if (pEntity)
|
||||
{
|
||||
@ -452,11 +435,11 @@ void DispatchBlocked(edict_t *pentBlocked, edict_t *pentOther)
|
||||
|
||||
void DispatchSave(edict_t *pent, SAVERESTOREDATA *pSaveData)
|
||||
{
|
||||
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent);
|
||||
CBaseEntity *pEntity = GET_PRIVATE<CBaseEntity>(pent);
|
||||
|
||||
if (pEntity && pSaveData)
|
||||
{
|
||||
ENTITYTABLE *pTable = &pSaveData->pTable[ pSaveData->currentIndex ];
|
||||
ENTITYTABLE *pTable = &pSaveData->pTable[pSaveData->currentIndex];
|
||||
|
||||
if (pTable->pent != pent)
|
||||
{
|
||||
@ -497,7 +480,7 @@ CBaseEntity *FindGlobalEntity(string_t classname, string_t globalname)
|
||||
|
||||
if (pReturn)
|
||||
{
|
||||
if (!FClassnameIs(pReturn->pev, STRING(classname)))
|
||||
if (!FClassnameIs(pReturn->pev, classname))
|
||||
{
|
||||
ALERT(at_console, "Global entity found %s, wrong class %s\n", STRING(globalname), STRING(pReturn->pev->classname));
|
||||
pReturn = nullptr;
|
||||
@ -509,7 +492,7 @@ CBaseEntity *FindGlobalEntity(string_t classname, string_t globalname)
|
||||
|
||||
int DispatchRestore(edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity)
|
||||
{
|
||||
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent);
|
||||
CBaseEntity *pEntity = GET_PRIVATE<CBaseEntity>(pent);
|
||||
|
||||
if (pEntity && pSaveData)
|
||||
{
|
||||
@ -578,7 +561,7 @@ int DispatchRestore(edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity)
|
||||
}
|
||||
|
||||
// Again, could be deleted, get the pointer again.
|
||||
pEntity = (CBaseEntity *)GET_PRIVATE(pent);
|
||||
pEntity = GET_PRIVATE<CBaseEntity>(pent);
|
||||
|
||||
// Is this an overriding global entity (coming over the transition), or one restoring in a level
|
||||
if (globalEntity)
|
||||
@ -623,14 +606,14 @@ int DispatchRestore(edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity)
|
||||
|
||||
void DispatchObjectCollsionBox(edict_t *pent)
|
||||
{
|
||||
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent);
|
||||
CBaseEntity *pEntity = GET_PRIVATE<CBaseEntity>(pent);
|
||||
if (pEntity)
|
||||
{
|
||||
pEntity->SetObjectCollisionBox();
|
||||
return;
|
||||
}
|
||||
else
|
||||
SetObjectCollisionBox(&pent->v);
|
||||
|
||||
SetObjectCollisionBox(&pent->v);
|
||||
}
|
||||
|
||||
void SaveWriteFields(SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount)
|
||||
@ -735,11 +718,21 @@ CBaseEntity *CBaseEntity::GetNextTarget()
|
||||
return Instance(pTarget);
|
||||
}
|
||||
|
||||
// Global Savedata for Delay
|
||||
TYPEDESCRIPTION CBaseEntity::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CBaseEntity, m_pGoalEnt, FIELD_CLASSPTR),
|
||||
DEFINE_FIELD(CBaseEntity, m_pfnThink, FIELD_FUNCTION), // UNDONE: Build table of these!
|
||||
DEFINE_FIELD(CBaseEntity, m_pfnTouch, FIELD_FUNCTION),
|
||||
DEFINE_FIELD(CBaseEntity, m_pfnUse, FIELD_FUNCTION),
|
||||
DEFINE_FIELD(CBaseEntity, m_pfnBlocked, FIELD_FUNCTION),
|
||||
};
|
||||
|
||||
int CBaseEntity::Save(CSave &save)
|
||||
{
|
||||
if (save.WriteEntVars("ENTVARS", pev))
|
||||
{
|
||||
return save.WriteFields("BASE", this, IMPL(m_SaveData), ARRAYSIZE(IMPL(m_SaveData)));
|
||||
return save.WriteFields("BASE", this, m_SaveData, ARRAYSIZE(m_SaveData));
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -750,7 +743,7 @@ int CBaseEntity::Restore(CRestore &restore)
|
||||
int status = restore.ReadEntVars("ENTVARS", pev);
|
||||
if (status)
|
||||
{
|
||||
status = restore.ReadFields("BASE", this, IMPL(m_SaveData), ARRAYSIZE(IMPL(m_SaveData)));
|
||||
status = restore.ReadFields("BASE", this, m_SaveData, ARRAYSIZE(m_SaveData));
|
||||
}
|
||||
|
||||
if (pev->modelindex != 0 && !FStringNull(pev->model))
|
||||
@ -781,7 +774,7 @@ void SetObjectCollisionBox(entvars_t *pev)
|
||||
int i;
|
||||
|
||||
max = 0;
|
||||
for (i = 0; i < 3; ++i)
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
v = Q_fabs(float_precision(((float *)pev->mins)[i]));
|
||||
if (v > max)
|
||||
@ -795,7 +788,7 @@ void SetObjectCollisionBox(entvars_t *pev)
|
||||
max = v;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 3; ++i)
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
((float *)pev->absmin)[i] = ((float *)pev->origin)[i] - max;
|
||||
((float *)pev->absmax)[i] = ((float *)pev->origin)[i] + max;
|
||||
@ -907,7 +900,7 @@ int CBaseEntity::DamageDecal(int bitsDamageType)
|
||||
|
||||
// NOTE: szName must be a pointer to constant memory, e.g. "monster_class" because the entity
|
||||
// will keep a pointer to it after this call.
|
||||
CBaseEntity *CBaseEntity::Create(char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner)
|
||||
CBaseEntity *CBaseEntity::Create(const char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner)
|
||||
{
|
||||
edict_t *pent = CREATE_NAMED_ENTITY(MAKE_STRING(szName));
|
||||
if (FNullEnt(pent))
|
||||
@ -1021,7 +1014,7 @@ void CBaseEntity::FireBullets(ULONG cShots, Vector vecSrc, Vector vecDirShooting
|
||||
ClearMultiDamage();
|
||||
gMultiDamage.type = (DMG_BULLET | DMG_NEVERGIB);
|
||||
|
||||
for (ULONG iShot = 1; iShot <= cShots; ++iShot)
|
||||
for (ULONG iShot = 1; iShot <= cShots; iShot++)
|
||||
{
|
||||
int spark = 0;
|
||||
|
||||
@ -1395,7 +1388,7 @@ void CBaseEntity::TraceBleed(float flDamage, Vector vecDir, TraceResult *ptr, in
|
||||
cCount = 4;
|
||||
}
|
||||
|
||||
for (i = 0; i < cCount; ++i)
|
||||
for (i = 0; i < cCount; i++)
|
||||
{
|
||||
// trace in the opposite direction the shot came from (the direction the shot is going)
|
||||
vecTraceDir = vecDir * -1.0f;
|
||||
|
@ -155,13 +155,12 @@ public:
|
||||
BOOL IsLockedByMaster() { return FALSE; }
|
||||
|
||||
public:
|
||||
static CBaseEntity *Instance(edict_t *pent)
|
||||
static CBaseEntity *Instance(edict_t *pEdict)
|
||||
{
|
||||
if (!pent)
|
||||
pent = ENT(0);
|
||||
if (!pEdict)
|
||||
pEdict = ENT(0);
|
||||
|
||||
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent);
|
||||
return pEntity;
|
||||
return GET_PRIVATE<CBaseEntity>(pEdict);
|
||||
}
|
||||
|
||||
static CBaseEntity *Instance(entvars_t *pev) { return Instance(ENT(pev)); }
|
||||
@ -185,7 +184,7 @@ public:
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
static CBaseEntity *Create(char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner = nullptr);
|
||||
static CBaseEntity *Create(const char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner = nullptr);
|
||||
edict_t *edict() { return ENT(pev); }
|
||||
EOFFSET eoffset() { return OFFSET(pev); }
|
||||
int entindex() { return ENTINDEX(edict()); }
|
||||
@ -199,7 +198,7 @@ public:
|
||||
CBaseEntity *m_pGoalEnt; // path corner we are heading towards
|
||||
CBaseEntity *m_pLink; // used for temporary link-list operations.
|
||||
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[5];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
// fundamental callbacks
|
||||
void (CBaseEntity::*m_pfnThink)();
|
||||
@ -330,7 +329,7 @@ public:
|
||||
void SUB_UseTargets(CBaseEntity *pActivator, USE_TYPE useType, float value);
|
||||
void EXPORT DelayThink();
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[2];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
float m_flDelay;
|
||||
string_t m_iszKillTarget;
|
||||
@ -370,7 +369,7 @@ public:
|
||||
#endif
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[5];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
// animation needs
|
||||
float m_flFrameRate; // computed FPS for current sequence
|
||||
@ -402,7 +401,7 @@ public:
|
||||
static float AxisDelta(int flags, const Vector &angle1, const Vector &angle2);
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[19];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
TOGGLE_STATE m_toggle_state;
|
||||
float m_flActivateFinished; // like attack_finished, but for doors
|
||||
@ -501,7 +500,7 @@ public:
|
||||
BUTTON_CODE ButtonResponseToTouch();
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[8];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
BOOL m_fStayPushed; // button stays pushed in until touched again?
|
||||
BOOL m_fRotating; // a rotating button? default is a sliding button.
|
||||
@ -541,7 +540,7 @@ public:
|
||||
void EXPORT Register();
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[4];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
EHandle m_rgEntities[MAX_MS_TARGETS];
|
||||
int m_rgTriggered[MAX_MS_TARGETS];
|
||||
@ -575,9 +574,6 @@ T *GetClassPtr(T *a)
|
||||
a->m_pEntity->m_pContainingEntity = a;
|
||||
#endif
|
||||
|
||||
#if defined(HOOK_GAMEDLL) && defined(_WIN32) && !defined(REGAMEDLL_UNIT_TESTS)
|
||||
VirtualTableInit((void *)a, stripClass(typeid(T).name()));
|
||||
#endif
|
||||
}
|
||||
|
||||
return a;
|
||||
|
@ -1,13 +1,9 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
int giPrecacheGrunt = 0;
|
||||
int gmsgWeapPickup = 0;
|
||||
int gmsgHudText = 0;
|
||||
int gmsgHudTextPro = 0;
|
||||
int gmsgHudTextArgs = 0;
|
||||
int gmsgShake = 0;
|
||||
int gmsgFade = 0;
|
||||
@ -137,8 +133,6 @@ static entity_field_alias_t custom_entity_field_alias[] =
|
||||
{ "animtime", 0 },
|
||||
};
|
||||
|
||||
#endif // HOOK_GAMEDLL
|
||||
|
||||
bool g_bServerActive = false;
|
||||
PLAYERPVSSTATUS g_PVSStatus[MAX_CLIENTS];
|
||||
unsigned short m_usResetDecals;
|
||||
@ -157,8 +151,8 @@ void LinkUserMessages()
|
||||
gmsgDamage = REG_USER_MSG("Damage", 12);
|
||||
gmsgBattery = REG_USER_MSG("Battery", 2);
|
||||
gmsgTrain = REG_USER_MSG("Train", 1);
|
||||
gmsgHudText = REG_USER_MSG("HudTextPro", -1);
|
||||
REG_USER_MSG("HudText", -1);
|
||||
gmsgHudTextPro = REG_USER_MSG("HudTextPro", -1);
|
||||
gmsgHudText = REG_USER_MSG("HudText", -1);
|
||||
gmsgSayText = REG_USER_MSG("SayText", -1);
|
||||
gmsgTextMsg = REG_USER_MSG("TextMsg", -1);
|
||||
gmsgWeaponList = REG_USER_MSG("WeaponList", -1);
|
||||
@ -233,29 +227,28 @@ void LinkUserMessages()
|
||||
|
||||
void WriteSigonMessages()
|
||||
{
|
||||
for (int i = 0; i < MAX_WEAPONS; ++i)
|
||||
for (int i = 0; i < MAX_WEAPONS; i++)
|
||||
{
|
||||
ItemInfo &II = IMPL_CLASS(CBasePlayerItem, m_ItemInfoArray)[i];
|
||||
|
||||
if (!II.iId)
|
||||
ItemInfo &info = CBasePlayerItem::m_ItemInfoArray[i];
|
||||
if (!info.iId)
|
||||
continue;
|
||||
|
||||
const char *pszName;
|
||||
if (!II.pszName)
|
||||
if (!info.pszName)
|
||||
pszName = "Empty";
|
||||
else
|
||||
pszName = II.pszName;
|
||||
pszName = info.pszName;
|
||||
|
||||
MESSAGE_BEGIN(MSG_INIT, gmsgWeaponList);
|
||||
WRITE_STRING(pszName);
|
||||
WRITE_BYTE(CBasePlayer::GetAmmoIndex(II.pszAmmo1));
|
||||
WRITE_BYTE(II.iMaxAmmo1);
|
||||
WRITE_BYTE(CBasePlayer::GetAmmoIndex(II.pszAmmo2));
|
||||
WRITE_BYTE(II.iMaxAmmo2);
|
||||
WRITE_BYTE(II.iSlot);
|
||||
WRITE_BYTE(II.iPosition);
|
||||
WRITE_BYTE(II.iId);
|
||||
WRITE_BYTE(II.iFlags);
|
||||
WRITE_BYTE(CBasePlayer::GetAmmoIndex(info.pszAmmo1));
|
||||
WRITE_BYTE(info.iMaxAmmo1);
|
||||
WRITE_BYTE(CBasePlayer::GetAmmoIndex(info.pszAmmo2));
|
||||
WRITE_BYTE(info.iMaxAmmo2);
|
||||
WRITE_BYTE(info.iSlot);
|
||||
WRITE_BYTE(info.iPosition);
|
||||
WRITE_BYTE(info.iId);
|
||||
WRITE_BYTE(info.iFlags);
|
||||
MESSAGE_END();
|
||||
}
|
||||
}
|
||||
@ -1016,10 +1009,10 @@ bool CanBuyThis(CBasePlayer *pPlayer, int iWeapon)
|
||||
if (pPlayer->HasShield() && iWeapon == WEAPON_SHIELDGUN)
|
||||
return false;
|
||||
|
||||
if (pPlayer->m_rgpPlayerItems[ PISTOL_SLOT ] && pPlayer->m_rgpPlayerItems[ PISTOL_SLOT ]->m_iId == WEAPON_ELITE && iWeapon == WEAPON_SHIELDGUN)
|
||||
if (pPlayer->m_rgpPlayerItems[PISTOL_SLOT] && pPlayer->m_rgpPlayerItems[PISTOL_SLOT]->m_iId == WEAPON_ELITE && iWeapon == WEAPON_SHIELDGUN)
|
||||
return false;
|
||||
|
||||
if (pPlayer->m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ] && pPlayer->m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ]->m_iId == iWeapon)
|
||||
if (pPlayer->m_rgpPlayerItems[PRIMARY_WEAPON_SLOT] && pPlayer->m_rgpPlayerItems[PRIMARY_WEAPON_SLOT]->m_iId == iWeapon)
|
||||
{
|
||||
if (g_bClientPrintEnable)
|
||||
{
|
||||
@ -1029,7 +1022,7 @@ bool CanBuyThis(CBasePlayer *pPlayer, int iWeapon)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pPlayer->m_rgpPlayerItems[ PISTOL_SLOT ] && pPlayer->m_rgpPlayerItems[ PISTOL_SLOT ]->m_iId == iWeapon)
|
||||
if (pPlayer->m_rgpPlayerItems[PISTOL_SLOT] && pPlayer->m_rgpPlayerItems[PISTOL_SLOT]->m_iId == iWeapon)
|
||||
{
|
||||
if (g_bClientPrintEnable)
|
||||
{
|
||||
@ -1673,7 +1666,7 @@ void EXT_FUNC __API_HOOK(HandleMenu_ChooseAppearance)(CBasePlayer *pPlayer, int
|
||||
pPlayer->m_iModelName = appearance.model_id;
|
||||
|
||||
pPlayer->SetClientUserInfoModel(GET_INFO_BUFFER(pPlayer->edict()), appearance.model_name);
|
||||
pPlayer->SetNewPlayerModel(sPlayerModelFiles[ appearance.model_name_index ]);
|
||||
pPlayer->SetNewPlayerModel(sPlayerModelFiles[appearance.model_name_index]);
|
||||
|
||||
if (CSGameRules()->m_bMapHasVIPSafetyZone)
|
||||
{
|
||||
@ -2236,12 +2229,12 @@ bool BuyAmmo(CBasePlayer *pPlayer, int nSlot, bool bBlinkMoney)
|
||||
// nSlot == 1 : Primary weapons
|
||||
// nSlot == 2 : Secondary weapons
|
||||
|
||||
CBasePlayerItem *pItem = pPlayer->m_rgpPlayerItems[ nSlot ];
|
||||
CBasePlayerItem *pItem = pPlayer->m_rgpPlayerItems[nSlot];
|
||||
|
||||
if (pPlayer->HasShield())
|
||||
{
|
||||
if (pPlayer->m_rgpPlayerItems[ PISTOL_SLOT ])
|
||||
pItem = pPlayer->m_rgpPlayerItems[ PISTOL_SLOT ];
|
||||
if (pPlayer->m_rgpPlayerItems[PISTOL_SLOT])
|
||||
pItem = pPlayer->m_rgpPlayerItems[PISTOL_SLOT];
|
||||
}
|
||||
|
||||
if (pItem)
|
||||
@ -3625,19 +3618,8 @@ void EXT_FUNC StartFrame()
|
||||
|
||||
CLocalNav::Think();
|
||||
|
||||
static cvar_t *skill = nullptr;
|
||||
if (!skill)
|
||||
{
|
||||
skill = CVAR_GET_POINTER("skill");
|
||||
}
|
||||
|
||||
gpGlobals->teamplay = 1.0f;
|
||||
|
||||
if (skill)
|
||||
g_iSkillLevel = int(skill->value);
|
||||
|
||||
else
|
||||
g_iSkillLevel = 0;
|
||||
g_iSkillLevel = g_pskill ? (int)g_pskill->value : 0;
|
||||
|
||||
if (TheBots) {
|
||||
TheBots->StartFrame();
|
||||
@ -4422,12 +4404,12 @@ void EXT_FUNC CreateBaseline(int player, int eindex, struct entity_state_s *base
|
||||
|
||||
void Entity_FieldInit(struct delta_s *pFields)
|
||||
{
|
||||
entity_field_alias[ FIELD_ORIGIN0 ].field = DELTA_FINDFIELD(pFields, entity_field_alias[ FIELD_ORIGIN0 ].name);
|
||||
entity_field_alias[ FIELD_ORIGIN1 ].field = DELTA_FINDFIELD(pFields, entity_field_alias[ FIELD_ORIGIN1 ].name);
|
||||
entity_field_alias[ FIELD_ORIGIN2 ].field = DELTA_FINDFIELD(pFields, entity_field_alias[ FIELD_ORIGIN2 ].name);
|
||||
entity_field_alias[ FIELD_ANGLES0 ].field = DELTA_FINDFIELD(pFields, entity_field_alias[ FIELD_ANGLES0 ].name);
|
||||
entity_field_alias[ FIELD_ANGLES1 ].field = DELTA_FINDFIELD(pFields, entity_field_alias[ FIELD_ANGLES1 ].name);
|
||||
entity_field_alias[ FIELD_ANGLES2 ].field = DELTA_FINDFIELD(pFields, entity_field_alias[ FIELD_ANGLES2 ].name);
|
||||
entity_field_alias[FIELD_ORIGIN0].field = DELTA_FINDFIELD(pFields, entity_field_alias[FIELD_ORIGIN0].name);
|
||||
entity_field_alias[FIELD_ORIGIN1].field = DELTA_FINDFIELD(pFields, entity_field_alias[FIELD_ORIGIN1].name);
|
||||
entity_field_alias[FIELD_ORIGIN2].field = DELTA_FINDFIELD(pFields, entity_field_alias[FIELD_ORIGIN2].name);
|
||||
entity_field_alias[FIELD_ANGLES0].field = DELTA_FINDFIELD(pFields, entity_field_alias[FIELD_ANGLES0].name);
|
||||
entity_field_alias[FIELD_ANGLES1].field = DELTA_FINDFIELD(pFields, entity_field_alias[FIELD_ANGLES1].name);
|
||||
entity_field_alias[FIELD_ANGLES2].field = DELTA_FINDFIELD(pFields, entity_field_alias[FIELD_ANGLES2].name);
|
||||
}
|
||||
|
||||
// Callback for sending entity_state_t info over network.
|
||||
@ -4451,39 +4433,39 @@ void Entity_Encode(struct delta_s *pFields, const unsigned char *from, const uns
|
||||
|
||||
if (localplayer)
|
||||
{
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[ FIELD_ORIGIN0 ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[ FIELD_ORIGIN1 ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[ FIELD_ORIGIN2 ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[FIELD_ORIGIN0].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[FIELD_ORIGIN1].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[FIELD_ORIGIN2].field);
|
||||
}
|
||||
if (t->impacttime != 0 && t->starttime != 0)
|
||||
{
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[ FIELD_ORIGIN0 ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[ FIELD_ORIGIN1 ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[ FIELD_ORIGIN2 ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[FIELD_ORIGIN0].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[FIELD_ORIGIN1].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[FIELD_ORIGIN2].field);
|
||||
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[ FIELD_ANGLES0 ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[ FIELD_ANGLES1 ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[ FIELD_ANGLES2 ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[FIELD_ANGLES0].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[FIELD_ANGLES1].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[FIELD_ANGLES2].field);
|
||||
}
|
||||
if (t->movetype == MOVETYPE_FOLLOW && t->aiment != 0)
|
||||
{
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[ FIELD_ORIGIN0 ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[ FIELD_ORIGIN1 ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[ FIELD_ORIGIN2 ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[FIELD_ORIGIN0].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[FIELD_ORIGIN1].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[FIELD_ORIGIN2].field);
|
||||
}
|
||||
else if (t->aiment != f->aiment)
|
||||
{
|
||||
DELTA_SETBYINDEX(pFields, entity_field_alias[ FIELD_ORIGIN0 ].field);
|
||||
DELTA_SETBYINDEX(pFields, entity_field_alias[ FIELD_ORIGIN1 ].field);
|
||||
DELTA_SETBYINDEX(pFields, entity_field_alias[ FIELD_ORIGIN2 ].field);
|
||||
DELTA_SETBYINDEX(pFields, entity_field_alias[FIELD_ORIGIN0].field);
|
||||
DELTA_SETBYINDEX(pFields, entity_field_alias[FIELD_ORIGIN1].field);
|
||||
DELTA_SETBYINDEX(pFields, entity_field_alias[FIELD_ORIGIN2].field);
|
||||
}
|
||||
}
|
||||
|
||||
void Player_FieldInit(struct delta_s *pFields)
|
||||
{
|
||||
player_field_alias[ FIELD_ORIGIN0 ].field = DELTA_FINDFIELD(pFields, player_field_alias[ FIELD_ORIGIN0 ].name);
|
||||
player_field_alias[ FIELD_ORIGIN1 ].field = DELTA_FINDFIELD(pFields, player_field_alias[ FIELD_ORIGIN1 ].name);
|
||||
player_field_alias[ FIELD_ORIGIN2 ].field = DELTA_FINDFIELD(pFields, player_field_alias[ FIELD_ORIGIN2 ].name);
|
||||
player_field_alias[FIELD_ORIGIN0].field = DELTA_FINDFIELD(pFields, player_field_alias[FIELD_ORIGIN0].name);
|
||||
player_field_alias[FIELD_ORIGIN1].field = DELTA_FINDFIELD(pFields, player_field_alias[FIELD_ORIGIN1].name);
|
||||
player_field_alias[FIELD_ORIGIN2].field = DELTA_FINDFIELD(pFields, player_field_alias[FIELD_ORIGIN2].name);
|
||||
}
|
||||
|
||||
// Callback for sending entity_state_t for players info over network.
|
||||
@ -4507,35 +4489,35 @@ void Player_Encode(struct delta_s *pFields, const unsigned char *from, const uns
|
||||
|
||||
if (localplayer)
|
||||
{
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[ FIELD_ORIGIN0 ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[ FIELD_ORIGIN1 ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[ FIELD_ORIGIN2 ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[FIELD_ORIGIN0].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[FIELD_ORIGIN1].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[FIELD_ORIGIN2].field);
|
||||
}
|
||||
if (t->movetype == MOVETYPE_FOLLOW && t->aiment != 0)
|
||||
{
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[ FIELD_ORIGIN0 ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[ FIELD_ORIGIN1 ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[ FIELD_ORIGIN2 ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[FIELD_ORIGIN0].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[FIELD_ORIGIN1].field);
|
||||
DELTA_UNSETBYINDEX(pFields, entity_field_alias[FIELD_ORIGIN2].field);
|
||||
}
|
||||
else if (t->aiment != f->aiment)
|
||||
{
|
||||
DELTA_SETBYINDEX(pFields, entity_field_alias[ FIELD_ORIGIN0 ].field);
|
||||
DELTA_SETBYINDEX(pFields, entity_field_alias[ FIELD_ORIGIN1 ].field);
|
||||
DELTA_SETBYINDEX(pFields, entity_field_alias[ FIELD_ORIGIN2 ].field);
|
||||
DELTA_SETBYINDEX(pFields, entity_field_alias[FIELD_ORIGIN0].field);
|
||||
DELTA_SETBYINDEX(pFields, entity_field_alias[FIELD_ORIGIN1].field);
|
||||
DELTA_SETBYINDEX(pFields, entity_field_alias[FIELD_ORIGIN2].field);
|
||||
}
|
||||
}
|
||||
|
||||
void Custom_Entity_FieldInit(delta_s *pFields)
|
||||
{
|
||||
custom_entity_field_alias[ CUSTOMFIELD_ORIGIN0 ].field = DELTA_FINDFIELD(pFields, custom_entity_field_alias[ CUSTOMFIELD_ORIGIN0 ].name);
|
||||
custom_entity_field_alias[ CUSTOMFIELD_ORIGIN1 ].field = DELTA_FINDFIELD(pFields, custom_entity_field_alias[ CUSTOMFIELD_ORIGIN1 ].name);
|
||||
custom_entity_field_alias[ CUSTOMFIELD_ORIGIN2 ].field = DELTA_FINDFIELD(pFields, custom_entity_field_alias[ CUSTOMFIELD_ORIGIN2 ].name);
|
||||
custom_entity_field_alias[ CUSTOMFIELD_ANGLES0 ].field = DELTA_FINDFIELD(pFields, custom_entity_field_alias[ CUSTOMFIELD_ANGLES0 ].name);
|
||||
custom_entity_field_alias[ CUSTOMFIELD_ANGLES1 ].field = DELTA_FINDFIELD(pFields, custom_entity_field_alias[ CUSTOMFIELD_ANGLES1 ].name);
|
||||
custom_entity_field_alias[ CUSTOMFIELD_ANGLES2 ].field = DELTA_FINDFIELD(pFields, custom_entity_field_alias[ CUSTOMFIELD_ANGLES2 ].name);
|
||||
custom_entity_field_alias[ CUSTOMFIELD_SKIN ].field = DELTA_FINDFIELD(pFields, custom_entity_field_alias[ CUSTOMFIELD_SKIN ].name);
|
||||
custom_entity_field_alias[ CUSTOMFIELD_SEQUENCE ].field = DELTA_FINDFIELD(pFields, custom_entity_field_alias[ CUSTOMFIELD_SEQUENCE ].name);
|
||||
custom_entity_field_alias[ CUSTOMFIELD_ANIMTIME ].field = DELTA_FINDFIELD(pFields, custom_entity_field_alias[ CUSTOMFIELD_ANIMTIME ].name);
|
||||
custom_entity_field_alias[CUSTOMFIELD_ORIGIN0].field = DELTA_FINDFIELD(pFields, custom_entity_field_alias[CUSTOMFIELD_ORIGIN0].name);
|
||||
custom_entity_field_alias[CUSTOMFIELD_ORIGIN1].field = DELTA_FINDFIELD(pFields, custom_entity_field_alias[CUSTOMFIELD_ORIGIN1].name);
|
||||
custom_entity_field_alias[CUSTOMFIELD_ORIGIN2].field = DELTA_FINDFIELD(pFields, custom_entity_field_alias[CUSTOMFIELD_ORIGIN2].name);
|
||||
custom_entity_field_alias[CUSTOMFIELD_ANGLES0].field = DELTA_FINDFIELD(pFields, custom_entity_field_alias[CUSTOMFIELD_ANGLES0].name);
|
||||
custom_entity_field_alias[CUSTOMFIELD_ANGLES1].field = DELTA_FINDFIELD(pFields, custom_entity_field_alias[CUSTOMFIELD_ANGLES1].name);
|
||||
custom_entity_field_alias[CUSTOMFIELD_ANGLES2].field = DELTA_FINDFIELD(pFields, custom_entity_field_alias[CUSTOMFIELD_ANGLES2].name);
|
||||
custom_entity_field_alias[CUSTOMFIELD_SKIN].field = DELTA_FINDFIELD(pFields, custom_entity_field_alias[CUSTOMFIELD_SKIN].name);
|
||||
custom_entity_field_alias[CUSTOMFIELD_SEQUENCE].field = DELTA_FINDFIELD(pFields, custom_entity_field_alias[CUSTOMFIELD_SEQUENCE].name);
|
||||
custom_entity_field_alias[CUSTOMFIELD_ANIMTIME].field = DELTA_FINDFIELD(pFields, custom_entity_field_alias[CUSTOMFIELD_ANIMTIME].name);
|
||||
}
|
||||
|
||||
// Callback for sending entity_state_t info ( for custom entities ) over network.
|
||||
@ -4560,27 +4542,27 @@ void Custom_Encode(struct delta_s *pFields, const unsigned char *from, const uns
|
||||
{
|
||||
if (beamType != BEAM_ENTPOINT)
|
||||
{
|
||||
DELTA_UNSETBYINDEX(pFields, custom_entity_field_alias[ CUSTOMFIELD_ORIGIN0 ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, custom_entity_field_alias[ CUSTOMFIELD_ORIGIN1 ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, custom_entity_field_alias[ CUSTOMFIELD_ORIGIN2 ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, custom_entity_field_alias[CUSTOMFIELD_ORIGIN0].field);
|
||||
DELTA_UNSETBYINDEX(pFields, custom_entity_field_alias[CUSTOMFIELD_ORIGIN1].field);
|
||||
DELTA_UNSETBYINDEX(pFields, custom_entity_field_alias[CUSTOMFIELD_ORIGIN2].field);
|
||||
}
|
||||
|
||||
DELTA_UNSETBYINDEX(pFields, custom_entity_field_alias[ CUSTOMFIELD_ANGLES0 ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, custom_entity_field_alias[ CUSTOMFIELD_ANGLES1 ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, custom_entity_field_alias[ CUSTOMFIELD_ANGLES2 ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, custom_entity_field_alias[CUSTOMFIELD_ANGLES0].field);
|
||||
DELTA_UNSETBYINDEX(pFields, custom_entity_field_alias[CUSTOMFIELD_ANGLES1].field);
|
||||
DELTA_UNSETBYINDEX(pFields, custom_entity_field_alias[CUSTOMFIELD_ANGLES2].field);
|
||||
}
|
||||
|
||||
if (beamType != BEAM_ENTS && beamType != BEAM_ENTPOINT)
|
||||
{
|
||||
DELTA_UNSETBYINDEX(pFields, custom_entity_field_alias[ CUSTOMFIELD_SKIN ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, custom_entity_field_alias[ CUSTOMFIELD_SEQUENCE ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, custom_entity_field_alias[CUSTOMFIELD_SKIN].field);
|
||||
DELTA_UNSETBYINDEX(pFields, custom_entity_field_alias[CUSTOMFIELD_SEQUENCE].field);
|
||||
}
|
||||
|
||||
// animtime is compared by rounding first
|
||||
// see if we really shouldn't actually send it
|
||||
if (int(f->animtime) == int(t->animtime))
|
||||
{
|
||||
DELTA_UNSETBYINDEX(pFields, custom_entity_field_alias[ CUSTOMFIELD_ANIMTIME ].field);
|
||||
DELTA_UNSETBYINDEX(pFields, custom_entity_field_alias[CUSTOMFIELD_ANIMTIME].field);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4756,7 +4738,7 @@ void EXT_FUNC UpdateClientData(const edict_t *ent, int sendweapons, struct clien
|
||||
if ((unsigned int)weapon->m_iPrimaryAmmoType < MAX_AMMO_SLOTS)
|
||||
{
|
||||
cd->vuser4.x = weapon->m_iPrimaryAmmoType;
|
||||
cd->vuser4.y = pPlayer->m_rgAmmo[ weapon->m_iPrimaryAmmoType ];
|
||||
cd->vuser4.y = pPlayer->m_rgAmmo[weapon->m_iPrimaryAmmoType];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -210,6 +210,7 @@ inline const char *GetTeamName(int team)
|
||||
extern int giPrecacheGrunt;
|
||||
extern int gmsgWeapPickup;
|
||||
extern int gmsgHudText;
|
||||
extern int gmsgHudTextPro;
|
||||
extern int gmsgHudTextArgs;
|
||||
extern int gmsgShake;
|
||||
extern int gmsgFade;
|
||||
|
@ -1,10 +1,5 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
DebugOutputLevel outputLevel[] =
|
||||
{
|
||||
{ "bot", DEBUG_BOT },
|
||||
@ -16,9 +11,7 @@ DebugOutputLevel outputLevel[] =
|
||||
};
|
||||
|
||||
unsigned int theDebugOutputTypes;
|
||||
static char theDebugBuffer[MAX_DEBUG_BUFF_SIZE];
|
||||
|
||||
#endif
|
||||
char theDebugBuffer[MAX_DEBUG_BUFF_SIZE];
|
||||
|
||||
bool IsDeveloper()
|
||||
{
|
||||
|
@ -1,10 +1,5 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
TYPEDESCRIPTION CBaseDoor::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CBaseDoor, m_bHealthValue, FIELD_CHARACTER),
|
||||
@ -16,13 +11,6 @@ TYPEDESCRIPTION CBaseDoor::m_SaveData[] =
|
||||
DEFINE_FIELD(CBaseDoor, m_bUnlockedSentence, FIELD_CHARACTER),
|
||||
};
|
||||
|
||||
TYPEDESCRIPTION CMomentaryDoor::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CMomentaryDoor, m_bMoveSnd, FIELD_CHARACTER),
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
IMPLEMENT_SAVERESTORE(CBaseDoor, CBaseToggle)
|
||||
|
||||
// play door or button locked or unlocked sounds.
|
||||
@ -957,6 +945,11 @@ void CRotDoor::SetToggleState(int state)
|
||||
UTIL_SetOrigin(pev, pev->origin);
|
||||
}
|
||||
|
||||
TYPEDESCRIPTION CMomentaryDoor::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CMomentaryDoor, m_bMoveSnd, FIELD_CHARACTER),
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS(momentary_door, CMomentaryDoor, CCSMomentaryDoor)
|
||||
IMPLEMENT_SAVERESTORE(CMomentaryDoor, CBaseToggle)
|
||||
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
virtual void Blocked(CBaseEntity *pOther);
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[7];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
// used to selectivly override defaults
|
||||
void EXPORT DoorTouch(CBaseEntity *pOther);
|
||||
@ -110,7 +110,7 @@ public:
|
||||
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[1];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
byte m_bMoveSnd; // sound a door makes while moving
|
||||
};
|
||||
|
@ -1,10 +1,5 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
TYPEDESCRIPTION CBubbling::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CBubbling, m_density, FIELD_INTEGER),
|
||||
@ -12,56 +7,6 @@ TYPEDESCRIPTION CBubbling::m_SaveData[] =
|
||||
DEFINE_FIELD(CBubbling, m_state, FIELD_INTEGER),
|
||||
};
|
||||
|
||||
TYPEDESCRIPTION CLightning::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CLightning, m_active, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CLightning, m_iszStartEntity, FIELD_STRING),
|
||||
DEFINE_FIELD(CLightning, m_iszEndEntity, FIELD_STRING),
|
||||
DEFINE_FIELD(CLightning, m_life, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CLightning, m_boltWidth, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CLightning, m_noiseAmplitude, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CLightning, m_brightness, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CLightning, m_speed, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CLightning, m_restrike, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CLightning, m_spriteTexture, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CLightning, m_iszSpriteName, FIELD_STRING),
|
||||
DEFINE_FIELD(CLightning, m_frameStart, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CLightning, m_radius, FIELD_FLOAT),
|
||||
};
|
||||
|
||||
TYPEDESCRIPTION CLaser::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CLaser, m_pSprite, FIELD_CLASSPTR),
|
||||
DEFINE_FIELD(CLaser, m_iszSpriteName, FIELD_STRING),
|
||||
DEFINE_FIELD(CLaser, m_firePosition, FIELD_POSITION_VECTOR),
|
||||
};
|
||||
|
||||
TYPEDESCRIPTION CGlow::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CGlow, m_lastTime, FIELD_TIME),
|
||||
DEFINE_FIELD(CGlow, m_maxFrame, FIELD_FLOAT),
|
||||
};
|
||||
|
||||
TYPEDESCRIPTION CSprite::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CSprite, m_lastTime, FIELD_TIME),
|
||||
DEFINE_FIELD(CSprite, m_maxFrame, FIELD_FLOAT),
|
||||
};
|
||||
|
||||
TYPEDESCRIPTION CGibShooter::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CGibShooter, m_iGibs, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CGibShooter, m_iGibCapacity, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CGibShooter, m_iGibMaterial, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CGibShooter, m_iGibModelIndex, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CGibShooter, m_flGibVelocity, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CGibShooter, m_flVariance, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CGibShooter, m_flGibLife, FIELD_FLOAT),
|
||||
};
|
||||
|
||||
#endif // HOOK_GAMEDLL
|
||||
|
||||
LINK_ENTITY_TO_CLASS(info_target, CPointEntity, CCSPointEntity)
|
||||
LINK_ENTITY_TO_CLASS(env_bubbles, CBubbling, CCSBubbling)
|
||||
IMPLEMENT_SAVERESTORE(CBubbling, CBaseEntity)
|
||||
|
||||
@ -352,6 +297,23 @@ void CBeam::DoSparks(const Vector &start, const Vector &end)
|
||||
}
|
||||
}
|
||||
|
||||
TYPEDESCRIPTION CLightning::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CLightning, m_active, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CLightning, m_iszStartEntity, FIELD_STRING),
|
||||
DEFINE_FIELD(CLightning, m_iszEndEntity, FIELD_STRING),
|
||||
DEFINE_FIELD(CLightning, m_life, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CLightning, m_boltWidth, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CLightning, m_noiseAmplitude, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CLightning, m_brightness, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CLightning, m_speed, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CLightning, m_restrike, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CLightning, m_spriteTexture, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CLightning, m_iszSpriteName, FIELD_STRING),
|
||||
DEFINE_FIELD(CLightning, m_frameStart, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CLightning, m_radius, FIELD_FLOAT),
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS(env_lightning, CLightning, CCSLightning)
|
||||
LINK_ENTITY_TO_CLASS(env_beam, CLightning, CCSLightning)
|
||||
IMPLEMENT_SAVERESTORE(CLightning, CBeam)
|
||||
@ -850,6 +812,13 @@ void CLightning::BeamUpdateVars()
|
||||
}
|
||||
}
|
||||
|
||||
TYPEDESCRIPTION CLaser::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CLaser, m_pSprite, FIELD_CLASSPTR),
|
||||
DEFINE_FIELD(CLaser, m_iszSpriteName, FIELD_STRING),
|
||||
DEFINE_FIELD(CLaser, m_firePosition, FIELD_POSITION_VECTOR),
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS(env_laser, CLaser, CCSLaser)
|
||||
IMPLEMENT_SAVERESTORE(CLaser, CBeam)
|
||||
|
||||
@ -1011,6 +980,12 @@ void CLaser::StrikeThink()
|
||||
pev->nextthink = gpGlobals->time + 0.1f;
|
||||
}
|
||||
|
||||
TYPEDESCRIPTION CGlow::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CGlow, m_lastTime, FIELD_TIME),
|
||||
DEFINE_FIELD(CGlow, m_maxFrame, FIELD_FLOAT),
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS(env_glow, CGlow, CCSGlow)
|
||||
IMPLEMENT_SAVERESTORE(CGlow, CPointEntity)
|
||||
|
||||
@ -1102,6 +1077,12 @@ void CBombGlow::Think()
|
||||
pev->nextthink = gpGlobals->time + 0.05f;
|
||||
}
|
||||
|
||||
TYPEDESCRIPTION CSprite::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CSprite, m_lastTime, FIELD_TIME),
|
||||
DEFINE_FIELD(CSprite, m_maxFrame, FIELD_FLOAT),
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS(env_sprite, CSprite, CCSSprite)
|
||||
IMPLEMENT_SAVERESTORE(CSprite, CPointEntity)
|
||||
|
||||
@ -1278,6 +1259,17 @@ void CSprite::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTyp
|
||||
}
|
||||
}
|
||||
|
||||
TYPEDESCRIPTION CGibShooter::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CGibShooter, m_iGibs, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CGibShooter, m_iGibCapacity, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CGibShooter, m_iGibMaterial, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CGibShooter, m_iGibModelIndex, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CGibShooter, m_flGibVelocity, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CGibShooter, m_flVariance, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CGibShooter, m_flGibLife, FIELD_FLOAT),
|
||||
};
|
||||
|
||||
IMPLEMENT_SAVERESTORE(CGibShooter, CBaseDelay)
|
||||
LINK_ENTITY_TO_CLASS(gibshooter, CGibShooter, CCSGibShooter)
|
||||
|
||||
@ -2014,3 +2006,27 @@ void CItemSoda::CanTouch(CBaseEntity *pOther)
|
||||
SetThink(&CItemSoda::SUB_Remove);
|
||||
pev->nextthink = gpGlobals->time;
|
||||
}
|
||||
|
||||
LINK_ENTITY_TO_CLASS(info_intermission, CInfoIntermission, CCSInfoIntermission)
|
||||
|
||||
void CInfoIntermission::Spawn()
|
||||
{
|
||||
UTIL_SetOrigin(pev, pev->origin);
|
||||
|
||||
pev->solid = SOLID_NOT;
|
||||
pev->effects = EF_NODRAW;
|
||||
pev->v_angle = g_vecZero;
|
||||
pev->nextthink = gpGlobals->time + 2.0f; // let targets spawn!
|
||||
}
|
||||
|
||||
void CInfoIntermission::Think()
|
||||
{
|
||||
// find my target
|
||||
edict_t *pTarget = FIND_ENTITY_BY_TARGETNAME(nullptr, STRING(pev->target));
|
||||
|
||||
if (!FNullEnt(pTarget))
|
||||
{
|
||||
pev->v_angle = UTIL_VecToAngles((pTarget->v.origin - pev->origin).Normalize());
|
||||
pev->v_angle.x = -pev->v_angle.x;
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ public:
|
||||
void EXPORT AnimateUntilDead();
|
||||
static CSprite *SpriteCreate(const char *pSpriteName, const Vector &origin, BOOL animate);
|
||||
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[2];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
private:
|
||||
float m_lastTime;
|
||||
@ -211,7 +211,7 @@ public:
|
||||
void EXPORT StrikeThink();
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[3];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
CSprite *m_pSprite;
|
||||
int m_iszSpriteName;
|
||||
@ -235,7 +235,7 @@ public:
|
||||
void EXPORT FizzThink();
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[3];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
int m_density;
|
||||
int m_frequency;
|
||||
@ -272,7 +272,7 @@ public:
|
||||
void BeamUpdateVars();
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[13];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
int m_active;
|
||||
int m_iszStartEntity;
|
||||
@ -300,7 +300,7 @@ public:
|
||||
void Animate(float frames);
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[2];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
float m_lastTime;
|
||||
float m_maxFrame;
|
||||
@ -335,7 +335,7 @@ public:
|
||||
void EXPORT ShootThink();
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[7];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
int m_iGibs;
|
||||
int m_iGibCapacity;
|
||||
@ -487,4 +487,12 @@ public:
|
||||
void EXPORT CanTouch(CBaseEntity *pOther);
|
||||
};
|
||||
|
||||
// Multiplayer intermission spots.
|
||||
class CInfoIntermission: public CPointEntity
|
||||
{
|
||||
public:
|
||||
virtual void Spawn();
|
||||
virtual void Think();
|
||||
};
|
||||
|
||||
int IsPointEntity(CBaseEntity *pEnt);
|
||||
|
@ -189,7 +189,7 @@ inline bool EntityHandle<T>::operator==(T *pEntity) const
|
||||
template <typename T>
|
||||
inline EntityHandle<T>::operator bool() const
|
||||
{
|
||||
return Get() != nullptr;
|
||||
return IsValid();
|
||||
}
|
||||
|
||||
// Gets the Entity this handle refers to.
|
||||
|
@ -1,18 +1,5 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
TYPEDESCRIPTION CEnvExplosion::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CEnvExplosion, m_iMagnitude, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CEnvExplosion, m_spriteScale, FIELD_INTEGER),
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
LINK_ENTITY_TO_CLASS(spark_shower, CShower, CCSShower)
|
||||
|
||||
void CShower::Spawn()
|
||||
@ -67,6 +54,12 @@ void CShower::Touch(CBaseEntity *pOther)
|
||||
}
|
||||
}
|
||||
|
||||
TYPEDESCRIPTION CEnvExplosion::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CEnvExplosion, m_iMagnitude, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CEnvExplosion, m_spriteScale, FIELD_INTEGER),
|
||||
};
|
||||
|
||||
IMPLEMENT_SAVERESTORE(CEnvExplosion, CBaseMonster)
|
||||
LINK_ENTITY_TO_CLASS(env_explosion, CEnvExplosion, CCSEnvExplosion)
|
||||
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
void EXPORT Smoke();
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[2];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
int m_iMagnitude;
|
||||
int m_spriteScale;
|
||||
|
@ -39,15 +39,12 @@
|
||||
#include "strtools.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#define NOWINRES
|
||||
#define NOSERVICE
|
||||
#define NOMCX
|
||||
#define NOIME
|
||||
#include "winsani_in.h"
|
||||
#include "windows.h"
|
||||
#include "winsani_out.h"
|
||||
#undef PlaySound
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
|
@ -1,14 +1,9 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
// Just add more items to the bottom of this array and they will automagically be supported
|
||||
// This is done instead of just a classname in the FGD so we can control which entities can
|
||||
// be spawned, and still remain fairly flexible
|
||||
const char *CBreakable::pSpawnObjects[] =
|
||||
const char *CBreakable::m_pszSpawnObjects[] =
|
||||
{
|
||||
nullptr,
|
||||
"item_battery",
|
||||
@ -44,14 +39,14 @@ const char *CBreakable::pSpawnObjects[] =
|
||||
"weapon_flashbang"
|
||||
};
|
||||
|
||||
const char *CBreakable::pSoundsWood[] =
|
||||
const char *CBreakable::m_pszSoundsWood[] =
|
||||
{
|
||||
"debris/wood1.wav",
|
||||
"debris/wood2.wav",
|
||||
"debris/wood3.wav"
|
||||
};
|
||||
|
||||
const char *CBreakable::pSoundsFlesh[] =
|
||||
const char *CBreakable::m_pszSoundsFlesh[] =
|
||||
{
|
||||
"debris/flesh1.wav",
|
||||
"debris/flesh2.wav",
|
||||
@ -61,34 +56,27 @@ const char *CBreakable::pSoundsFlesh[] =
|
||||
"debris/flesh7.wav"
|
||||
};
|
||||
|
||||
const char *CBreakable::pSoundsMetal[] =
|
||||
const char *CBreakable::m_pszSoundsMetal[] =
|
||||
{
|
||||
"debris/metal1.wav",
|
||||
"debris/metal2.wav",
|
||||
"debris/metal3.wav"
|
||||
};
|
||||
|
||||
const char *CBreakable::pSoundsConcrete[] =
|
||||
const char *CBreakable::m_pszSoundsConcrete[] =
|
||||
{
|
||||
"debris/concrete1.wav",
|
||||
"debris/concrete2.wav",
|
||||
"debris/concrete3.wav"
|
||||
};
|
||||
|
||||
const char *CBreakable::pSoundsGlass[] =
|
||||
const char *CBreakable::m_pszSoundsGlass[] =
|
||||
{
|
||||
"debris/glass1.wav",
|
||||
"debris/glass2.wav",
|
||||
"debris/glass3.wav"
|
||||
};
|
||||
|
||||
char *CPushable::m_soundNames[] =
|
||||
{
|
||||
"debris/pushbox1.wav",
|
||||
"debris/pushbox2.wav",
|
||||
"debris/pushbox3.wav"
|
||||
};
|
||||
|
||||
TYPEDESCRIPTION CBreakable::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CBreakable, m_Material, FIELD_INTEGER),
|
||||
@ -98,80 +86,6 @@ TYPEDESCRIPTION CBreakable::m_SaveData[] =
|
||||
DEFINE_FIELD(CBreakable, m_iszSpawnObject, FIELD_STRING),
|
||||
};
|
||||
|
||||
TYPEDESCRIPTION CPushable::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CPushable, m_maxSpeed, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CPushable, m_soundTime, FIELD_TIME),
|
||||
};
|
||||
|
||||
#endif // HOOK_GAMEDLL
|
||||
|
||||
void CBreakable::KeyValue(KeyValueData *pkvd)
|
||||
{
|
||||
// UNDONE_WC: explicitly ignoring these fields, but they shouldn't be in the map file!
|
||||
if (FStrEq(pkvd->szKeyName, "explosion"))
|
||||
{
|
||||
if (!Q_stricmp(pkvd->szValue, "directed"))
|
||||
m_Explosion = expDirected;
|
||||
|
||||
else if (!Q_stricmp(pkvd->szValue, "random"))
|
||||
m_Explosion = expRandom;
|
||||
else
|
||||
m_Explosion = expRandom;
|
||||
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "material"))
|
||||
{
|
||||
Materials type = (Materials)Q_atoi(pkvd->szValue);
|
||||
|
||||
// 0:glass, 1:wood, 2:metal, 3:flesh etc
|
||||
if (type < 0 || type >= matLastMaterial)
|
||||
m_Material = matWood;
|
||||
else
|
||||
m_Material = type;
|
||||
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "deadmodel"))
|
||||
{
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "shards"))
|
||||
{
|
||||
//m_iShards = Q_atof(pkvd->szValue);
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "gibmodel"))
|
||||
{
|
||||
m_iszGibModel = ALLOC_STRING(pkvd->szValue);
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "spawnobject"))
|
||||
{
|
||||
int object = Q_atoi(pkvd->szValue);
|
||||
if (object > 0 && object < ARRAYSIZE(pSpawnObjects))
|
||||
{
|
||||
m_iszSpawnObject = MAKE_STRING(pSpawnObjects[object]);
|
||||
}
|
||||
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "explodemagnitude"))
|
||||
{
|
||||
ExplosionSetMagnitude(Q_atoi(pkvd->szValue));
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "lip"))
|
||||
{
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
CBaseDelay::KeyValue(pkvd);
|
||||
}
|
||||
}
|
||||
|
||||
LINK_ENTITY_TO_CLASS(func_breakable, CBreakable, CCSBreakable)
|
||||
IMPLEMENT_SAVERESTORE(CBreakable, CBaseEntity)
|
||||
|
||||
@ -245,6 +159,72 @@ void CBreakable::Restart()
|
||||
}
|
||||
}
|
||||
|
||||
void CBreakable::KeyValue(KeyValueData *pkvd)
|
||||
{
|
||||
// UNDONE_WC: explicitly ignoring these fields, but they shouldn't be in the map file!
|
||||
if (FStrEq(pkvd->szKeyName, "explosion"))
|
||||
{
|
||||
if (!Q_stricmp(pkvd->szValue, "directed"))
|
||||
m_Explosion = expDirected;
|
||||
|
||||
else if (!Q_stricmp(pkvd->szValue, "random"))
|
||||
m_Explosion = expRandom;
|
||||
else
|
||||
m_Explosion = expRandom;
|
||||
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "material"))
|
||||
{
|
||||
Materials type = (Materials)Q_atoi(pkvd->szValue);
|
||||
|
||||
// 0:glass, 1:wood, 2:metal, 3:flesh etc
|
||||
if (type < 0 || type >= matLastMaterial)
|
||||
m_Material = matWood;
|
||||
else
|
||||
m_Material = type;
|
||||
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "deadmodel"))
|
||||
{
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "shards"))
|
||||
{
|
||||
//m_iShards = Q_atof(pkvd->szValue);
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "gibmodel"))
|
||||
{
|
||||
m_iszGibModel = ALLOC_STRING(pkvd->szValue);
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "spawnobject"))
|
||||
{
|
||||
int object = Q_atoi(pkvd->szValue);
|
||||
if (object > 0 && object < ARRAYSIZE(m_pszSpawnObjects))
|
||||
{
|
||||
m_iszSpawnObject = MAKE_STRING(m_pszSpawnObjects[object]);
|
||||
}
|
||||
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "explodemagnitude"))
|
||||
{
|
||||
ExplosionSetMagnitude(Q_atoi(pkvd->szValue));
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "lip"))
|
||||
{
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
CBaseDelay::KeyValue(pkvd);
|
||||
}
|
||||
}
|
||||
|
||||
const char **CBreakable::MaterialSoundList(Materials precacheMaterial, int &soundCount)
|
||||
{
|
||||
const char **pSoundList;
|
||||
@ -253,35 +233,35 @@ const char **CBreakable::MaterialSoundList(Materials precacheMaterial, int &soun
|
||||
{
|
||||
case matWood:
|
||||
{
|
||||
pSoundList = pSoundsWood;
|
||||
soundCount = ARRAYSIZE(pSoundsWood);
|
||||
pSoundList = m_pszSoundsWood;
|
||||
soundCount = ARRAYSIZE(m_pszSoundsWood);
|
||||
break;
|
||||
}
|
||||
case matFlesh:
|
||||
{
|
||||
pSoundList = pSoundsFlesh;
|
||||
soundCount = ARRAYSIZE(pSoundsFlesh);
|
||||
pSoundList = m_pszSoundsFlesh;
|
||||
soundCount = ARRAYSIZE(m_pszSoundsFlesh);
|
||||
break;
|
||||
}
|
||||
case matGlass:
|
||||
case matComputer:
|
||||
case matUnbreakableGlass:
|
||||
{
|
||||
pSoundList = pSoundsGlass;
|
||||
soundCount = ARRAYSIZE(pSoundsGlass);
|
||||
pSoundList = m_pszSoundsGlass;
|
||||
soundCount = ARRAYSIZE(m_pszSoundsGlass);
|
||||
break;
|
||||
}
|
||||
case matMetal:
|
||||
{
|
||||
pSoundList = pSoundsMetal;
|
||||
soundCount = ARRAYSIZE(pSoundsMetal);
|
||||
pSoundList = m_pszSoundsMetal;
|
||||
soundCount = ARRAYSIZE(m_pszSoundsMetal);
|
||||
break;
|
||||
}
|
||||
case matCinderBlock:
|
||||
case matRocks:
|
||||
{
|
||||
pSoundList = pSoundsConcrete;
|
||||
soundCount = ARRAYSIZE(pSoundsConcrete);
|
||||
pSoundList = m_pszSoundsConcrete;
|
||||
soundCount = ARRAYSIZE(m_pszSoundsConcrete);
|
||||
break;
|
||||
}
|
||||
case matCeilingTile:
|
||||
@ -315,7 +295,7 @@ void CBreakable::MaterialSoundRandom(edict_t *pEdict, Materials soundMaterial, f
|
||||
|
||||
if (soundCount)
|
||||
{
|
||||
EMIT_SOUND(pEdict, CHAN_BODY, pSoundList[ RANDOM_LONG(0, soundCount - 1) ], volume, 1.0);
|
||||
EMIT_SOUND(pEdict, CHAN_BODY, pSoundList[RANDOM_LONG(0, soundCount - 1)], volume, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -386,13 +366,13 @@ void CBreakable::Precache()
|
||||
|
||||
if (pGibName)
|
||||
{
|
||||
m_idShard = PRECACHE_MODEL((char *)pGibName);
|
||||
m_idShard = PRECACHE_MODEL(pGibName);
|
||||
}
|
||||
|
||||
// Precache the spawn item's data
|
||||
if (m_iszSpawnObject)
|
||||
{
|
||||
UTIL_PrecacheOther((char *)STRING(m_iszSpawnObject));
|
||||
UTIL_PrecacheOther(STRING(m_iszSpawnObject));
|
||||
}
|
||||
}
|
||||
|
||||
@ -863,6 +843,19 @@ int CBreakable::DamageDecal(int bitsDamageType)
|
||||
return CBaseEntity::DamageDecal(bitsDamageType);
|
||||
}
|
||||
|
||||
TYPEDESCRIPTION CPushable::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CPushable, m_maxSpeed, FIELD_FLOAT),
|
||||
DEFINE_FIELD(CPushable, m_soundTime, FIELD_TIME),
|
||||
};
|
||||
|
||||
const char *CPushable::m_soundNames[] =
|
||||
{
|
||||
"debris/pushbox1.wav",
|
||||
"debris/pushbox2.wav",
|
||||
"debris/pushbox3.wav"
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS(func_pushable, CPushable, CCSPushable)
|
||||
IMPLEMENT_SAVERESTORE(CPushable, CBreakable)
|
||||
|
||||
@ -903,7 +896,7 @@ void CPushable::Spawn()
|
||||
|
||||
void CPushable::Precache()
|
||||
{
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int i = 0; i < ARRAYSIZE(m_soundNames); i++)
|
||||
{
|
||||
PRECACHE_SOUND(m_soundNames[i]);
|
||||
}
|
||||
|
@ -97,14 +97,14 @@ public:
|
||||
static void MaterialSoundRandom(edict_t *pEdict, Materials soundMaterial, float volume);
|
||||
static const char **MaterialSoundList(Materials precacheMaterial, int &soundCount);
|
||||
|
||||
static const char *pSoundsWood[3];
|
||||
static const char *pSoundsFlesh[6];
|
||||
static const char *pSoundsGlass[3];
|
||||
static const char *pSoundsMetal[3];
|
||||
static const char *pSoundsConcrete[3];
|
||||
static const char *pSpawnObjects[32];
|
||||
static const char *m_pszSpawnObjects[32];
|
||||
static const char *m_pszSoundsWood[3];
|
||||
static const char *m_pszSoundsFlesh[6];
|
||||
static const char *m_pszSoundsMetal[3];
|
||||
static const char *m_pszSoundsConcrete[3];
|
||||
static const char *m_pszSoundsGlass[3];
|
||||
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[5];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
public:
|
||||
Materials m_Material;
|
||||
@ -149,8 +149,8 @@ public:
|
||||
float MaxSpeed() const { return m_maxSpeed; }
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[2];
|
||||
static char *m_soundNames[3];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
static const char *m_soundNames[];
|
||||
|
||||
int m_lastSound;
|
||||
float m_maxSpeed;
|
||||
|
@ -1,10 +1,5 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
TYPEDESCRIPTION CFuncTank::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CFuncTank, m_yawCenter, FIELD_FLOAT),
|
||||
@ -35,18 +30,7 @@ TYPEDESCRIPTION CFuncTank::m_SaveData[] =
|
||||
DEFINE_FIELD(CFuncTank, m_iszMaster, FIELD_STRING),
|
||||
};
|
||||
|
||||
TYPEDESCRIPTION CFuncTankLaser::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CFuncTankLaser, m_pLaser, FIELD_CLASSPTR),
|
||||
DEFINE_FIELD(CFuncTankLaser, m_laserTime, FIELD_TIME),
|
||||
};
|
||||
|
||||
TYPEDESCRIPTION CFuncTankControls::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CFuncTankControls, m_pTank, FIELD_CLASSPTR),
|
||||
};
|
||||
|
||||
Vector gTankSpread[] =
|
||||
Vector CFuncTank::m_TankSpread[] =
|
||||
{
|
||||
Vector(0, 0, 0), // perfect
|
||||
Vector(0.025, 0.025, 0.025), // small cone
|
||||
@ -55,9 +39,7 @@ Vector gTankSpread[] =
|
||||
Vector(0.25, 0.25, 0.25), // extra-large cone
|
||||
};
|
||||
|
||||
#endif // HOOK_GAMEDLL
|
||||
|
||||
const int MAX_FIRING_SPREADS = ARRAYSIZE(gTankSpread);
|
||||
constexpr int MAX_FIRING_SPREADS = ARRAYSIZE(CFuncTank::m_TankSpread);
|
||||
|
||||
IMPLEMENT_SAVERESTORE(CFuncTank, CBaseEntity)
|
||||
|
||||
@ -379,7 +361,7 @@ void CFuncTank::Think()
|
||||
pev->avelocity = g_vecZero;
|
||||
TrackTarget();
|
||||
|
||||
if (Q_fabs(float_precision(pev->avelocity.x)) > 1 || Q_fabs(float_precision(pev->avelocity.y)) > 1)
|
||||
if (fabs(float_precision(pev->avelocity.x)) > 1 || fabs(float_precision(pev->avelocity.y)) > 1)
|
||||
StartRotSound();
|
||||
else
|
||||
StopRotSound();
|
||||
@ -526,7 +508,7 @@ void CFuncTank::TrackTarget()
|
||||
return;
|
||||
}
|
||||
|
||||
if (CanFire() && ((Q_fabs(distX) < m_pitchTolerance && Q_fabs(distY) < m_yawTolerance) || (pev->spawnflags & SF_TANK_LINEOFSIGHT)))
|
||||
if (CanFire() && ((fabs(distX) < m_pitchTolerance && fabs(distY) < m_yawTolerance) || (pev->spawnflags & SF_TANK_LINEOFSIGHT)))
|
||||
{
|
||||
bool fire = false;
|
||||
Vector forward;
|
||||
@ -569,13 +551,13 @@ void CFuncTank::AdjustAnglesForBarrel(Vector &angles, float distance)
|
||||
if (m_barrelPos.y)
|
||||
{
|
||||
r2 = m_barrelPos.y * m_barrelPos.y;
|
||||
angles.y += (180.0f / M_PI) * Q_atan2(m_barrelPos.y, Q_sqrt(d2 - r2));
|
||||
angles.y += (180.0f / M_PI) * atan2(m_barrelPos.y, Q_sqrt(d2 - r2));
|
||||
}
|
||||
|
||||
if (m_barrelPos.z)
|
||||
{
|
||||
r2 = m_barrelPos.z * m_barrelPos.z;
|
||||
angles.x += (180.0f / M_PI) * Q_atan2(-m_barrelPos.z, Q_sqrt(d2 - r2));
|
||||
angles.x += (180.0f / M_PI) * atan2(-m_barrelPos.z, Q_sqrt(d2 - r2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -665,7 +647,6 @@ void CFuncTankGun::Fire(const Vector &barrelEnd, const Vector &forward, entvars_
|
||||
UTIL_MakeAimVectors(pev->angles);
|
||||
|
||||
int bulletCount = int((gpGlobals->time - m_fireLast) * m_fireRate);
|
||||
|
||||
if (bulletCount > 0)
|
||||
{
|
||||
for (int i = 0; i < bulletCount; i++)
|
||||
@ -673,13 +654,13 @@ void CFuncTankGun::Fire(const Vector &barrelEnd, const Vector &forward, entvars_
|
||||
switch (m_bulletType)
|
||||
{
|
||||
case TANK_BULLET_9MM:
|
||||
FireBullets(1, barrelEnd, forward, gTankSpread[m_spread], 4096, BULLET_MONSTER_9MM, 1, m_iBulletDamage, pevAttacker);
|
||||
FireBullets(1, barrelEnd, forward, m_TankSpread[m_spread], 4096, BULLET_MONSTER_9MM, 1, m_iBulletDamage, pevAttacker);
|
||||
break;
|
||||
case TANK_BULLET_MP5:
|
||||
FireBullets(1, barrelEnd, forward, gTankSpread[m_spread], 4096, BULLET_MONSTER_MP5, 1, m_iBulletDamage, pevAttacker);
|
||||
FireBullets(1, barrelEnd, forward, m_TankSpread[m_spread], 4096, BULLET_MONSTER_MP5, 1, m_iBulletDamage, pevAttacker);
|
||||
break;
|
||||
case TANK_BULLET_12MM:
|
||||
FireBullets(1, barrelEnd, forward, gTankSpread[m_spread], 4096, BULLET_MONSTER_12MM, 1, m_iBulletDamage, pevAttacker);
|
||||
FireBullets(1, barrelEnd, forward, m_TankSpread[m_spread], 4096, BULLET_MONSTER_12MM, 1, m_iBulletDamage, pevAttacker);
|
||||
break;
|
||||
default:
|
||||
case TANK_BULLET_NONE:
|
||||
@ -696,6 +677,12 @@ void CFuncTankGun::Fire(const Vector &barrelEnd, const Vector &forward, entvars_
|
||||
}
|
||||
}
|
||||
|
||||
TYPEDESCRIPTION CFuncTankLaser::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CFuncTankLaser, m_pLaser, FIELD_CLASSPTR),
|
||||
DEFINE_FIELD(CFuncTankLaser, m_laserTime, FIELD_TIME),
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS(func_tanklaser, CFuncTankLaser, CCSFuncTankLaser)
|
||||
IMPLEMENT_SAVERESTORE(CFuncTankLaser, CFuncTank)
|
||||
|
||||
@ -761,22 +748,19 @@ void CFuncTankLaser::Think()
|
||||
|
||||
void CFuncTankLaser::Fire(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker)
|
||||
{
|
||||
int i;
|
||||
TraceResult tr;
|
||||
|
||||
if (m_fireLast != 0.0f && GetLaser())
|
||||
{
|
||||
// TankTrace needs gpGlobals->v_up, etc.
|
||||
UTIL_MakeAimVectors(pev->angles);
|
||||
|
||||
int bulletCount = int((gpGlobals->time - m_fireLast) * m_fireRate);
|
||||
|
||||
if (bulletCount)
|
||||
{
|
||||
for (i = 0; i < bulletCount; i++)
|
||||
TraceResult tr;
|
||||
for (int i = 0; i < bulletCount; i++)
|
||||
{
|
||||
m_pLaser->pev->origin = barrelEnd;
|
||||
TankTrace(barrelEnd, forward, gTankSpread[m_spread], tr);
|
||||
TankTrace(barrelEnd, forward, m_TankSpread[m_spread], tr);
|
||||
|
||||
m_laserTime = gpGlobals->time;
|
||||
m_pLaser->TurnOn();
|
||||
@ -804,14 +788,12 @@ void CFuncTankRocket::Precache()
|
||||
|
||||
void CFuncTankRocket::Fire(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (m_fireLast != 0.0f)
|
||||
{
|
||||
int bulletCount = int((gpGlobals->time - m_fireLast) * m_fireRate);
|
||||
if (bulletCount > 0)
|
||||
{
|
||||
for (i = 0; i < bulletCount; i++)
|
||||
for (int i = 0; i < bulletCount; i++)
|
||||
{
|
||||
CBaseEntity *pRocket = CBaseEntity::Create("rpg_rocket", barrelEnd, pev->angles, edict());
|
||||
}
|
||||
@ -854,7 +836,7 @@ void CFuncTankMortar::Fire(const Vector &barrelEnd, const Vector &forward, entva
|
||||
// TankTrace needs gpGlobals->v_up, etc.
|
||||
UTIL_MakeAimVectors(pev->angles);
|
||||
|
||||
TankTrace(barrelEnd, forward, gTankSpread[m_spread], tr);
|
||||
TankTrace(barrelEnd, forward, m_TankSpread[m_spread], tr);
|
||||
ExplosionCreate(tr.vecEndPos, pev->angles, edict(), pev->impulse, TRUE);
|
||||
CFuncTank::Fire(barrelEnd, forward, pev);
|
||||
}
|
||||
@ -865,6 +847,11 @@ void CFuncTankMortar::Fire(const Vector &barrelEnd, const Vector &forward, entva
|
||||
}
|
||||
}
|
||||
|
||||
TYPEDESCRIPTION CFuncTankControls::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CFuncTankControls, m_pTank, FIELD_CLASSPTR),
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS(func_tankcontrols, CFuncTankControls, CCSFuncTankControls)
|
||||
IMPLEMENT_SAVERESTORE(CFuncTankControls, CBaseEntity)
|
||||
|
||||
|
@ -101,7 +101,8 @@ public:
|
||||
void ControllerPostFrame();
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[26];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
static Vector m_TankSpread[];
|
||||
|
||||
protected:
|
||||
CBasePlayer *m_pController;
|
||||
@ -158,7 +159,7 @@ public:
|
||||
CLaser *GetLaser();
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[2];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
private:
|
||||
CLaser *m_pLaser;
|
||||
@ -190,6 +191,6 @@ public:
|
||||
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[1];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
CFuncTank *m_pTank;
|
||||
};
|
||||
|
@ -1,99 +1,96 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
cvar_t *g_pskill = nullptr;
|
||||
cvar_t *g_psv_gravity = nullptr;
|
||||
cvar_t *g_psv_aim = nullptr;
|
||||
cvar_t *g_footsteps = nullptr;
|
||||
cvar_t *g_psv_accelerate = nullptr;
|
||||
cvar_t *g_psv_friction = nullptr;
|
||||
cvar_t *g_psv_stopspeed = nullptr;
|
||||
cvar_t *g_psv_stepsize = nullptr;
|
||||
cvar_t *g_psv_clienttrace = nullptr;
|
||||
|
||||
cvar_t *g_psv_gravity = NULL;
|
||||
cvar_t *g_psv_aim = NULL;
|
||||
cvar_t *g_footsteps = NULL;
|
||||
cvar_t *g_psv_accelerate = NULL;
|
||||
cvar_t *g_psv_friction = NULL;
|
||||
cvar_t *g_psv_stopspeed = NULL;
|
||||
cvar_t displaysoundlist = { "displaysoundlist", "0", 0, 0.0f, NULL };
|
||||
cvar_t timelimit = { "mp_timelimit", "0", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t flashlight = { "mp_flashlight", "0", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t decalfrequency = { "decalfrequency", "30", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t fadetoblack = { "mp_fadetoblack", "0", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t displaysoundlist = { "displaysoundlist", "0", 0, 0.0f, nullptr };
|
||||
cvar_t timelimit = { "mp_timelimit", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t flashlight = { "mp_flashlight", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t decalfrequency = { "decalfrequency", "30", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t fadetoblack = { "mp_fadetoblack", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
|
||||
cvar_t fragsleft = { "mp_fragsleft", "0", FCVAR_SERVER | FCVAR_UNLOGGED, 0.0f, NULL }; // Don't spam console/log files/users with this changing
|
||||
cvar_t timeleft = { "mp_timeleft", "0", FCVAR_SERVER | FCVAR_UNLOGGED, 0.0f, NULL };
|
||||
cvar_t fragsleft = { "mp_fragsleft", "0", FCVAR_SERVER | FCVAR_UNLOGGED, 0.0f, nullptr }; // Don't spam console/log files/users with this changing
|
||||
cvar_t timeleft = { "mp_timeleft", "0", FCVAR_SERVER | FCVAR_UNLOGGED, 0.0f, nullptr };
|
||||
|
||||
cvar_t friendlyfire = { "mp_friendlyfire", "0", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t allowmonsters = { "mp_allowmonsters", "0", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t roundtime = { "mp_roundtime", "5", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t buytime = { "mp_buytime", "1.5", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t freezetime = { "mp_freezetime", "6", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t c4timer = { "mp_c4timer", "45", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t ghostfrequency = { "mp_ghostfrequency", "0.1", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t autokick = { "mp_autokick", "1", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t autokick_timeout = { "mp_autokick_timeout", "-1", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t restartround = { "sv_restartround", "0", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t sv_restart = { "sv_restart", "0", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t limitteams = { "mp_limitteams", "2", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t autoteambalance = { "mp_autoteambalance", "1", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t tkpunish = { "mp_tkpunish", "0", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t hostagepenalty = { "mp_hostagepenalty", "13", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t mirrordamage = { "mp_mirrordamage", "0", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t logmessages = { "mp_logmessages", "1", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t forcecamera = { "mp_forcecamera", "0", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t forcechasecam = { "mp_forcechasecam", "0", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t mapvoteratio = { "mp_mapvoteratio", "0.66", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t logdetail = { "mp_logdetail", "0", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t startmoney = { "mp_startmoney", "800", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t maxrounds = { "mp_maxrounds", "0", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t winlimit = { "mp_winlimit", "0", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t windifference = { "mp_windifference", "1", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t playerid = { "mp_playerid", "0", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t allow_spectators = { "allow_spectators", "1.0", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t mp_chattime = { "mp_chattime", "10", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t kick_percent = { "mp_kickpercent", "0.66", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t humans_join_team = { "humans_join_team", "any", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t sk_plr_9mm_bullet1 = { "sk_plr_9mm_bullet1", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_plr_9mm_bullet2 = { "sk_plr_9mm_bullet2", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_plr_9mm_bullet3 = { "sk_plr_9mm_bullet3", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_plr_357_bullet1 = { "sk_plr_357_bullet1", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_plr_357_bullet2 = { "sk_plr_357_bullet2", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_plr_357_bullet3 = { "sk_plr_357_bullet3", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_plr_9mmAR_bullet1 = { "sk_plr_9mmAR_bullet1", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_plr_9mmAR_bullet2 = { "sk_plr_9mmAR_bullet2", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_plr_9mmAR_bullet3 = { "sk_plr_9mmAR_bullet3", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_plr_9mmAR_grenade1 = { "sk_plr_9mmAR_grenade1", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_plr_9mmAR_grenade2 = { "sk_plr_9mmAR_grenade2", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_plr_9mmAR_grenade3 = { "sk_plr_9mmAR_grenade3", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_plr_buckshot1 = { "sk_plr_buckshot1", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_plr_buckshot2 = { "sk_plr_buckshot2", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_plr_buckshot3 = { "sk_plr_buckshot3", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_plr_rpg1 = { "sk_plr_rpg1", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_plr_rpg2 = { "sk_plr_rpg2", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_plr_rpg3 = { "sk_plr_rpg3", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_12mm_bullet1 = { "sk_12mm_bullet1", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_12mm_bullet2 = { "sk_12mm_bullet2", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_12mm_bullet3 = { "sk_12mm_bullet3", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_9mmAR_bullet1 = { "sk_9mmAR_bullet1", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_9mmAR_bullet2 = { "sk_9mmAR_bullet2", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_9mmAR_bullet3 = { "sk_9mmAR_bullet3", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_9mm_bullet1 = { "sk_9mm_bullet1", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_9mm_bullet2 = { "sk_9mm_bullet2", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_9mm_bullet3 = { "sk_9mm_bullet3", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_suitcharger1 = { "sk_suitcharger1", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_suitcharger2 = { "sk_suitcharger2", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_suitcharger3 = { "sk_suitcharger3", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_battery1 = { "sk_battery1", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_battery2 = { "sk_battery2", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_battery3 = { "sk_battery3", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_healthcharger1 = { "sk_healthcharger1", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_healthcharger2 = { "sk_healthcharger2", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_healthcharger3 = { "sk_healthcharger3", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_healthkit1 = { "sk_healthkit1", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_healthkit2 = { "sk_healthkit2", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_healthkit3 = { "sk_healthkit3", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_scientist_heal1 = { "sk_scientist_heal1", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_scientist_heal2 = { "sk_scientist_heal2", "0", 0, 0.0f, NULL };
|
||||
cvar_t sk_scientist_heal3 = { "sk_scientist_heal3", "0", 0, 0.0f, NULL };
|
||||
|
||||
#endif // HOOK_GAMEDLL
|
||||
cvar_t friendlyfire = { "mp_friendlyfire", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t allowmonsters = { "mp_allowmonsters", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t roundtime = { "mp_roundtime", "5", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t buytime = { "mp_buytime", "1.5", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t freezetime = { "mp_freezetime", "6", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t c4timer = { "mp_c4timer", "45", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t ghostfrequency = { "mp_ghostfrequency", "0.1", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t autokick = { "mp_autokick", "1", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t autokick_timeout = { "mp_autokick_timeout", "-1", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t restartround = { "sv_restartround", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t sv_restart = { "sv_restart", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t limitteams = { "mp_limitteams", "2", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t autoteambalance = { "mp_autoteambalance", "1", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t tkpunish = { "mp_tkpunish", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t hostagepenalty = { "mp_hostagepenalty", "13", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t mirrordamage = { "mp_mirrordamage", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t logmessages = { "mp_logmessages", "1", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t forcecamera = { "mp_forcecamera", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t forcechasecam = { "mp_forcechasecam", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t mapvoteratio = { "mp_mapvoteratio", "0.66", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t logdetail = { "mp_logdetail", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t startmoney = { "mp_startmoney", "800", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t maxrounds = { "mp_maxrounds", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t winlimit = { "mp_winlimit", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t windifference = { "mp_windifference", "1", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t playerid = { "mp_playerid", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t allow_spectators = { "allow_spectators", "1.0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t mp_chattime = { "mp_chattime", "10", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t kick_percent = { "mp_kickpercent", "0.66", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t humans_join_team = { "humans_join_team", "any", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mm_bullet1 = { "sk_plr_9mm_bullet1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mm_bullet2 = { "sk_plr_9mm_bullet2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mm_bullet3 = { "sk_plr_9mm_bullet3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_357_bullet1 = { "sk_plr_357_bullet1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_357_bullet2 = { "sk_plr_357_bullet2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_357_bullet3 = { "sk_plr_357_bullet3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mmAR_bullet1 = { "sk_plr_9mmAR_bullet1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mmAR_bullet2 = { "sk_plr_9mmAR_bullet2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mmAR_bullet3 = { "sk_plr_9mmAR_bullet3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mmAR_grenade1 = { "sk_plr_9mmAR_grenade1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mmAR_grenade2 = { "sk_plr_9mmAR_grenade2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_9mmAR_grenade3 = { "sk_plr_9mmAR_grenade3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_buckshot1 = { "sk_plr_buckshot1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_buckshot2 = { "sk_plr_buckshot2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_buckshot3 = { "sk_plr_buckshot3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_rpg1 = { "sk_plr_rpg1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_rpg2 = { "sk_plr_rpg2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_plr_rpg3 = { "sk_plr_rpg3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_12mm_bullet1 = { "sk_12mm_bullet1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_12mm_bullet2 = { "sk_12mm_bullet2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_12mm_bullet3 = { "sk_12mm_bullet3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_9mmAR_bullet1 = { "sk_9mmAR_bullet1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_9mmAR_bullet2 = { "sk_9mmAR_bullet2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_9mmAR_bullet3 = { "sk_9mmAR_bullet3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_9mm_bullet1 = { "sk_9mm_bullet1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_9mm_bullet2 = { "sk_9mm_bullet2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_9mm_bullet3 = { "sk_9mm_bullet3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_suitcharger1 = { "sk_suitcharger1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_suitcharger2 = { "sk_suitcharger2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_suitcharger3 = { "sk_suitcharger3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_battery1 = { "sk_battery1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_battery2 = { "sk_battery2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_battery3 = { "sk_battery3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_healthcharger1 = { "sk_healthcharger1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_healthcharger2 = { "sk_healthcharger2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_healthcharger3 = { "sk_healthcharger3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_healthkit1 = { "sk_healthkit1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_healthkit2 = { "sk_healthkit2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_healthkit3 = { "sk_healthkit3", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_scientist_heal1 = { "sk_scientist_heal1", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_scientist_heal2 = { "sk_scientist_heal2", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sk_scientist_heal3 = { "sk_scientist_heal3", "0", 0, 0.0f, nullptr };
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
|
||||
@ -110,7 +107,6 @@ cvar_t auto_join_team = { "mp_auto_join_team", "0", 0, 0.0f, nullptr };
|
||||
cvar_t max_teamkills = { "mp_max_teamkills", "3", 0, 3.0f, nullptr };
|
||||
cvar_t fraglimit = { "mp_fraglimit", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t round_restart_delay = { "mp_round_restart_delay", "5", FCVAR_SERVER, 0.0f, nullptr };
|
||||
|
||||
cvar_t showtriggers = { "showtriggers", "0", 0, 0.0f, nullptr }; // debug cvar shows triggers
|
||||
// TODO: Maybe it's better to register in the engine?
|
||||
|
||||
@ -141,12 +137,15 @@ void GameDLL_EndRound_f()
|
||||
|
||||
void EXT_FUNC GameDLLInit()
|
||||
{
|
||||
g_pskill = CVAR_GET_POINTER("skill");
|
||||
g_psv_gravity = CVAR_GET_POINTER("sv_gravity");
|
||||
g_psv_aim = CVAR_GET_POINTER("sv_aim");
|
||||
g_footsteps = CVAR_GET_POINTER("mp_footsteps");
|
||||
g_psv_accelerate = CVAR_GET_POINTER("sv_accelerate");
|
||||
g_psv_friction = CVAR_GET_POINTER("sv_friction");
|
||||
g_psv_stopspeed = CVAR_GET_POINTER("sv_stopspeed");
|
||||
g_psv_stepsize = CVAR_GET_POINTER("sv_stepsize");
|
||||
g_psv_clienttrace = CVAR_GET_POINTER("sv_clienttrace");
|
||||
|
||||
CVAR_REGISTER(&displaysoundlist);
|
||||
CVAR_REGISTER(&timelimit);
|
||||
|
@ -40,12 +40,15 @@
|
||||
#define PLAYERID_TEAMONLY 1
|
||||
#define PLAYERID_OFF 2
|
||||
|
||||
extern cvar_t *g_pskill;
|
||||
extern cvar_t *g_psv_gravity;
|
||||
extern cvar_t *g_psv_aim;
|
||||
extern cvar_t *g_footsteps;
|
||||
extern cvar_t *g_psv_accelerate;
|
||||
extern cvar_t *g_psv_friction;
|
||||
extern cvar_t *g_psv_stopspeed;
|
||||
extern cvar_t *g_psv_stepsize;
|
||||
extern cvar_t *g_psv_clienttrace;
|
||||
extern cvar_t *g_footsteps;
|
||||
|
||||
extern cvar_t displaysoundlist;
|
||||
extern cvar_t timelimit;
|
||||
|
@ -1,14 +1,7 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
CGameRules *g_pGameRules = nullptr;
|
||||
|
||||
#endif
|
||||
|
||||
CGameRules::CGameRules()
|
||||
{
|
||||
m_bFreezePeriod = FALSE;
|
||||
@ -19,13 +12,11 @@ CGameRules::CGameRules()
|
||||
Q_strcpy(m_GameDesc, AreRunningCZero() ? "Condition Zero" : "Counter-Strike");
|
||||
}
|
||||
|
||||
#ifndef HOOK_GAMEDLL
|
||||
CGameRules::~CGameRules()
|
||||
{
|
||||
delete[] m_GameDesc;
|
||||
m_GameDesc = nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
// this is the game name that gets seen in the server browser
|
||||
const char *CGameRules::GetGameDescription()
|
||||
|
@ -217,10 +217,7 @@ class CGameRules
|
||||
{
|
||||
public:
|
||||
CGameRules();
|
||||
|
||||
#ifndef HOOK_GAMEDLL
|
||||
virtual ~CGameRules();
|
||||
#endif
|
||||
|
||||
virtual void RefreshSkillData(); // fill skill data struct with proper values
|
||||
virtual void Think() = 0; // runs every server frame, should handle any timer tasks, periodic events, etc.
|
||||
@ -335,8 +332,8 @@ public:
|
||||
BOOL m_bBombDropped;
|
||||
|
||||
// custom
|
||||
CUSTOM_MEMBER char *m_GameDesc;
|
||||
CUSTOM_MEMBER bool m_bGameOver; // intermission or finale (deprecated name g_fGameOver)
|
||||
char *m_GameDesc;
|
||||
bool m_bGameOver; // intermission or finale (deprecated name g_fGameOver)
|
||||
};
|
||||
|
||||
// CHalfLifeRules - rules for the single player Half-Life game.
|
||||
@ -344,10 +341,7 @@ class CHalfLifeRules: public CGameRules
|
||||
{
|
||||
public:
|
||||
CHalfLifeRules();
|
||||
|
||||
#ifndef HOOK_GAMEDLL
|
||||
virtual ~CHalfLifeRules() {};
|
||||
#endif
|
||||
|
||||
virtual void Think();
|
||||
virtual BOOL IsAllowedToSpawn(CBaseEntity *pEntity);
|
||||
@ -773,11 +767,11 @@ protected:
|
||||
bool m_bSkipSpawn;
|
||||
|
||||
// custom
|
||||
CUSTOM_MEMBER bool m_bSkipShowMenu;
|
||||
CUSTOM_MEMBER bool m_bNeededPlayers;
|
||||
CUSTOM_MEMBER float m_flEscapeRatio;
|
||||
CUSTOM_MEMBER float m_flTimeLimit;
|
||||
CUSTOM_MEMBER float m_flGameStartTime;
|
||||
bool m_bSkipShowMenu;
|
||||
bool m_bNeededPlayers;
|
||||
float m_flEscapeRatio;
|
||||
float m_flTimeLimit;
|
||||
float m_flGameStartTime;
|
||||
};
|
||||
|
||||
typedef struct mapcycle_item_s
|
||||
|
@ -1,10 +1,5 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
TYPEDESCRIPTION CGrenade::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CGrenade, m_fAttenu, FIELD_FLOAT),
|
||||
@ -24,8 +19,6 @@ TYPEDESCRIPTION CGrenade::m_SaveData[] =
|
||||
DEFINE_FIELD(CGrenade, m_usEvent, FIELD_INTEGER),
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
LINK_ENTITY_TO_CLASS(grenade, CGrenade, CCSGrenade)
|
||||
|
||||
void CGrenade::Explode(Vector vecSrc, Vector vecAim)
|
||||
|
@ -1,14 +1,7 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
const Vector g_vecZero(0, 0, 0);
|
||||
|
||||
#endif
|
||||
|
||||
int g_Language;
|
||||
int g_iSkillLevel;
|
||||
|
||||
|
@ -1,10 +1,5 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
TYPEDESCRIPTION CRecharge::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CRecharge, m_flNextCharge, FIELD_TIME),
|
||||
@ -14,8 +9,6 @@ TYPEDESCRIPTION CRecharge::m_SaveData[] =
|
||||
DEFINE_FIELD(CRecharge, m_flSoundTime, FIELD_TIME),
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
IMPLEMENT_SAVERESTORE(CRecharge, CBaseEntity)
|
||||
LINK_ENTITY_TO_CLASS(func_recharge, CRecharge, CCSRecharge)
|
||||
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
void EXPORT Recharge();
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[5];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
float m_flNextCharge;
|
||||
int m_iReactivate;
|
||||
|
@ -1,34 +1,15 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
TYPEDESCRIPTION CCycler::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CCycler, m_animate, FIELD_INTEGER),
|
||||
};
|
||||
|
||||
TYPEDESCRIPTION CCyclerSprite::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CCyclerSprite, m_animate, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CCyclerSprite, m_lastTime, FIELD_TIME),
|
||||
DEFINE_FIELD(CCyclerSprite, m_maxFrame, FIELD_FLOAT),
|
||||
};
|
||||
|
||||
TYPEDESCRIPTION CWreckage::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CWreckage, m_flStartTime, FIELD_TIME),
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
IMPLEMENT_SAVERESTORE(CCycler, CBaseToggle)
|
||||
|
||||
void CGenericCycler::Spawn()
|
||||
{
|
||||
GenericCyclerSpawn((char *)STRING(pev->model), Vector(-16, -16, 0), Vector(16, 16, 72));
|
||||
GenericCyclerSpawn(pev->model, Vector(-16, -16, 0), Vector(16, 16, 72));
|
||||
}
|
||||
|
||||
LINK_ENTITY_TO_CLASS(cycler, CGenericCycler, CCSGenericCycler)
|
||||
@ -41,7 +22,7 @@ void CCyclerProbe::Spawn()
|
||||
}
|
||||
|
||||
// Cycler member functions
|
||||
void CCycler::GenericCyclerSpawn(char *szModel, Vector vecMin, Vector vecMax)
|
||||
void CCycler::GenericCyclerSpawn(const char *szModel, Vector vecMin, Vector vecMax)
|
||||
{
|
||||
if (!szModel || !szModel[0])
|
||||
{
|
||||
@ -161,6 +142,13 @@ BOOL CCycler::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
TYPEDESCRIPTION CCyclerSprite::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CCyclerSprite, m_animate, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CCyclerSprite, m_lastTime, FIELD_TIME),
|
||||
DEFINE_FIELD(CCyclerSprite, m_maxFrame, FIELD_FLOAT),
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS(cycler_sprite, CCyclerSprite, CCSCyclerSprite)
|
||||
IMPLEMENT_SAVERESTORE(CCyclerSprite, CBaseEntity)
|
||||
|
||||
@ -176,8 +164,8 @@ void CCyclerSprite::Spawn()
|
||||
m_animate = 1;
|
||||
m_lastTime = gpGlobals->time;
|
||||
|
||||
PRECACHE_MODEL((char *)STRING(pev->model));
|
||||
SET_MODEL(ENT(pev), STRING(pev->model));
|
||||
PRECACHE_MODEL(pev->model);
|
||||
SET_MODEL(ENT(pev), pev->model);
|
||||
|
||||
m_maxFrame = float(MODEL_FRAMES(pev->modelindex) - 1);
|
||||
|
||||
@ -249,8 +237,8 @@ void CWeaponCycler::Spawn()
|
||||
pev->solid = SOLID_SLIDEBOX;
|
||||
pev->movetype = MOVETYPE_NONE;
|
||||
|
||||
PRECACHE_MODEL((char *)STRING(pev->model));
|
||||
SET_MODEL(ENT(pev), STRING(pev->model));
|
||||
PRECACHE_MODEL(pev->model);
|
||||
SET_MODEL(ENT(pev), pev->model);
|
||||
|
||||
m_iszModel = pev->model;
|
||||
m_iModel = pev->modelindex;
|
||||
@ -302,6 +290,11 @@ void CWeaponCycler::SecondaryAttack()
|
||||
m_flNextSecondaryAttack = gpGlobals->time + 0.3f;
|
||||
}
|
||||
|
||||
TYPEDESCRIPTION CWreckage::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CWreckage, m_flStartTime, FIELD_TIME),
|
||||
};
|
||||
|
||||
IMPLEMENT_SAVERESTORE(CWreckage, CBaseToggle)
|
||||
LINK_ENTITY_TO_CLASS(cycler_wreckage, CWreckage, CCSWreckage)
|
||||
|
||||
@ -315,10 +308,10 @@ void CWreckage::Spawn()
|
||||
pev->frame = 0;
|
||||
pev->nextthink = gpGlobals->time + 0.1f;
|
||||
|
||||
if (!FStringNull(pev->model))
|
||||
if (!pev->model.IsNull())
|
||||
{
|
||||
PRECACHE_MODEL((char *)STRING(pev->model));
|
||||
SET_MODEL(ENT(pev), STRING(pev->model));
|
||||
PRECACHE_MODEL(pev->model);
|
||||
SET_MODEL(ENT(pev), pev->model);
|
||||
}
|
||||
|
||||
// pev->scale = 5.0;
|
||||
@ -327,9 +320,9 @@ void CWreckage::Spawn()
|
||||
|
||||
void CWreckage::Precache()
|
||||
{
|
||||
if (!FStringNull(pev->model))
|
||||
if (!pev->model.IsNull())
|
||||
{
|
||||
PRECACHE_MODEL((char *)STRING(pev->model));
|
||||
PRECACHE_MODEL(pev->model);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,11 +42,11 @@ public:
|
||||
virtual void Think();
|
||||
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
|
||||
|
||||
public:
|
||||
void GenericCyclerSpawn(char *szModel, Vector vecMin, Vector vecMax);
|
||||
protected:
|
||||
void GenericCyclerSpawn(const char *szModel, Vector vecMin, Vector vecMax);
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[1];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
int m_animate;
|
||||
};
|
||||
@ -82,7 +82,7 @@ public:
|
||||
inline int ShouldAnimate() { return (m_animate && m_maxFrame > 1.0f); }
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[3];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
int m_animate;
|
||||
float m_lastTime;
|
||||
@ -120,7 +120,7 @@ public:
|
||||
virtual void Think();
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[1];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
int m_flStartTime;
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
//! Holds engine functionality callbacks
|
||||
// Holds engine functionality callbacks
|
||||
enginefuncs_t g_engfuncs;
|
||||
globalvars_t *gpGlobals;
|
||||
|
||||
@ -14,3 +14,30 @@ C_DLLEXPORT void WINAPI GiveFnptrsToDll(enginefuncs_t *pEnginefuncsTable, global
|
||||
|
||||
Regamedll_Game_Init();
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
// DLL entry point
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
if (fdwReason == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
}
|
||||
else if (fdwReason == DLL_PROCESS_DETACH)
|
||||
{
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#else // _WIN32
|
||||
|
||||
void __attribute__((constructor)) DllMainLoad()
|
||||
{
|
||||
}
|
||||
|
||||
void __attribute__((destructor)) DllMainUnload()
|
||||
{
|
||||
}
|
||||
|
||||
#endif // _WIN32
|
||||
|
@ -1,21 +1,5 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
TYPEDESCRIPTION CWallHealth::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CWallHealth, m_flNextCharge, FIELD_TIME),
|
||||
DEFINE_FIELD(CWallHealth, m_iReactivate, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CWallHealth, m_iJuice, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CWallHealth, m_iOn, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CWallHealth, m_flSoundTime, FIELD_TIME),
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
LINK_ENTITY_TO_CLASS(item_healthkit, CHealthKit, CCSHealthKit)
|
||||
|
||||
void CHealthKit::Spawn()
|
||||
@ -50,7 +34,7 @@ BOOL CHealthKit::MyTouch(CBasePlayer *pPlayer)
|
||||
if (pPlayer->TakeHealth(healthValue, DMG_GENERIC))
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgItemPickup, nullptr, pPlayer->pev);
|
||||
WRITE_STRING(STRING(pev->classname));
|
||||
WRITE_STRING(pev->classname);
|
||||
MESSAGE_END();
|
||||
|
||||
EMIT_SOUND(ENT(pPlayer->pev), CHAN_ITEM, "items/smallmedkit1.wav", VOL_NORM, ATTN_NORM);
|
||||
@ -66,6 +50,15 @@ BOOL CHealthKit::MyTouch(CBasePlayer *pPlayer)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
TYPEDESCRIPTION CWallHealth::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CWallHealth, m_flNextCharge, FIELD_TIME),
|
||||
DEFINE_FIELD(CWallHealth, m_iReactivate, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CWallHealth, m_iJuice, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CWallHealth, m_iOn, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CWallHealth, m_flSoundTime, FIELD_TIME),
|
||||
};
|
||||
|
||||
IMPLEMENT_SAVERESTORE(CWallHealth, CBaseEntity)
|
||||
LINK_ENTITY_TO_CLASS(func_healthcharger, CWallHealth, CCSWallHealth)
|
||||
|
||||
@ -97,7 +90,7 @@ void CWallHealth::Spawn()
|
||||
UTIL_SetOrigin(pev, pev->origin);
|
||||
UTIL_SetSize(pev, pev->mins, pev->maxs);
|
||||
|
||||
SET_MODEL(ENT(pev), STRING(pev->model));
|
||||
SET_MODEL(ENT(pev), pev->model);
|
||||
|
||||
int healthValue = (int)gSkillData.healthchargerCapacity;
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
void EXPORT Off();
|
||||
void EXPORT Recharge();
|
||||
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[5];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
float m_flNextCharge;
|
||||
int m_iReactivate;
|
||||
|
@ -1,9 +1,32 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
cvar_t cv_hostage_debug = { "hostage_debug", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
cvar_t cv_hostage_stop = { "hostage_stop", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
@ -11,8 +34,6 @@ cvar_t cv_hostage_stop = { "hostage_stop", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||
CHostageManager *g_pHostages = nullptr;
|
||||
int g_iHostageNumber = 0;
|
||||
|
||||
#endif
|
||||
|
||||
struct
|
||||
{
|
||||
HostageChatterType type;
|
||||
@ -231,7 +252,7 @@ void CHostage::Spawn()
|
||||
m_vOldPos = Vector(9999, 9999, 9999);
|
||||
m_iHostageIndex = ++g_iHostageNumber;
|
||||
|
||||
nTargetNode = -1;
|
||||
m_nTargetNode = NODE_INVALID_EMPTY;
|
||||
m_fHasPath = FALSE;
|
||||
|
||||
m_flLastPathCheck = -1;
|
||||
@ -247,10 +268,9 @@ void CHostage::Spawn()
|
||||
|
||||
void CHostage::Precache()
|
||||
{
|
||||
static int which = 0;
|
||||
|
||||
if (AreImprovAllowed())
|
||||
{
|
||||
static int which = 0;
|
||||
switch (which)
|
||||
{
|
||||
case REGULAR_GUY:
|
||||
@ -277,13 +297,13 @@ void CHostage::Precache()
|
||||
else
|
||||
{
|
||||
m_whichModel = REGULAR_GUY;
|
||||
if (FStringNull(pev->model))
|
||||
if (pev->model.IsNull())
|
||||
{
|
||||
pev->model = MAKE_STRING("models/scientist.mdl");
|
||||
}
|
||||
}
|
||||
|
||||
PRECACHE_MODEL((char *)STRING(pev->model));
|
||||
PRECACHE_MODEL(pev->model);
|
||||
PRECACHE_SOUND("hostage/hos1.wav");
|
||||
PRECACHE_SOUND("hostage/hos2.wav");
|
||||
PRECACHE_SOUND("hostage/hos3.wav");
|
||||
@ -292,12 +312,11 @@ void CHostage::Precache()
|
||||
PRECACHE_MODEL("sprites/smoke.spr");
|
||||
}
|
||||
|
||||
void CHostage::SetActivity(int act)
|
||||
void CHostage::SetActivity(Activity act)
|
||||
{
|
||||
if (m_Activity != act)
|
||||
{
|
||||
int sequence = LookupActivity(act);
|
||||
|
||||
if (sequence != ACT_INVALID)
|
||||
{
|
||||
if (pev->sequence != sequence)
|
||||
@ -393,7 +412,7 @@ void CHostage::IdleThink()
|
||||
CBaseEntity *pSpot = nullptr;
|
||||
while ((pSpot = UTIL_FindEntityByClassname(pSpot, "info_hostage_rescue")))
|
||||
{
|
||||
if ((pSpot->pev->origin - pev->origin).Length() < RESCUE_HOSTAGES_RADIUS)
|
||||
if ((pSpot->pev->origin - pev->origin).Length() < MAX_HOSTAGES_RESCUE_RADIUS)
|
||||
{
|
||||
m_bRescueMe = TRUE;
|
||||
break;
|
||||
@ -406,7 +425,7 @@ void CHostage::IdleThink()
|
||||
|
||||
while ((pSpot = UTIL_FindEntityByClassname(pSpot, "info_player_start")))
|
||||
{
|
||||
if ((pSpot->pev->origin - pev->origin).Length() < RESCUE_HOSTAGES_RADIUS)
|
||||
if ((pSpot->pev->origin - pev->origin).Length() < MAX_HOSTAGES_RESCUE_RADIUS)
|
||||
{
|
||||
m_bRescueMe = TRUE;
|
||||
break;
|
||||
@ -548,7 +567,7 @@ void CHostage::RePosition()
|
||||
pev->nextthink = gpGlobals->time + RANDOM_FLOAT(0.1, 0.2);
|
||||
|
||||
m_fHasPath = FALSE;
|
||||
nTargetNode = -1;
|
||||
m_nTargetNode = NODE_INVALID_EMPTY;
|
||||
|
||||
m_flLastPathCheck = -1;
|
||||
m_flPathAcquired = -1;
|
||||
@ -879,7 +898,7 @@ void CHostage::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTy
|
||||
{
|
||||
m_State = STAND;
|
||||
m_hTargetEnt = nullptr;
|
||||
m_hStoppedTargetEnt = pActivator;
|
||||
m_hStoppedTargetEnt = static_cast<CBasePlayer *>(pActivator);
|
||||
}
|
||||
else
|
||||
m_State = FOLLOW;
|
||||
@ -1006,14 +1025,15 @@ void CHostage::DoFollow()
|
||||
|
||||
if (m_fHasPath)
|
||||
{
|
||||
nTargetNode = m_LocalNav->GetFurthestTraversableNode(pev->origin, vecNodes, m_nPathNodes, TRUE);
|
||||
m_nTargetNode = m_LocalNav->GetFurthestTraversableNode(pev->origin, vecNodes, m_nPathNodes, TRUE);
|
||||
|
||||
if (!nTargetNode)
|
||||
if (!m_nTargetNode)
|
||||
{
|
||||
if ((vecNodes[nTargetNode] - pev->origin).Length2D() < HOSTAGE_STEPSIZE)
|
||||
nTargetNode = -1;
|
||||
if ((vecNodes[m_nTargetNode] - pev->origin).Length2D() < HOSTAGE_STEPSIZE)
|
||||
m_nTargetNode = NODE_INVALID_EMPTY;
|
||||
}
|
||||
if (nTargetNode == -1)
|
||||
|
||||
if (m_nTargetNode == NODE_INVALID_EMPTY)
|
||||
{
|
||||
m_fHasPath = FALSE;
|
||||
m_flPathCheckInterval = 0.1f;
|
||||
@ -1023,15 +1043,15 @@ void CHostage::DoFollow()
|
||||
if (gpGlobals->time < m_flFlinchTime)
|
||||
return;
|
||||
|
||||
if (nTargetNode != -1)
|
||||
if (m_nTargetNode != NODE_INVALID_EMPTY)
|
||||
{
|
||||
if (pev->flags & FL_ONGROUND)
|
||||
PointAt(vecNodes[nTargetNode]);
|
||||
PointAt(vecNodes[m_nTargetNode]);
|
||||
|
||||
if (pev->movetype == MOVETYPE_FLY)
|
||||
pev->v_angle.x = -60;
|
||||
|
||||
MoveToward(vecNodes[nTargetNode]);
|
||||
MoveToward(vecNodes[m_nTargetNode]);
|
||||
m_bStuck = FALSE;
|
||||
}
|
||||
else if (IsAlive())
|
||||
@ -1050,7 +1070,7 @@ void CHostage::DoFollow()
|
||||
{
|
||||
if (m_flPathAcquired != -1 && m_flPathAcquired + 2 > gpGlobals->time)
|
||||
{
|
||||
if (pev->velocity.Length2D() < 1 || nTargetNode == -1)
|
||||
if (pev->velocity.Length2D() < 1 || m_nTargetNode == NODE_INVALID_EMPTY)
|
||||
{
|
||||
Wiggle();
|
||||
}
|
||||
@ -1067,7 +1087,6 @@ void CHostage::PointAt(const Vector &vecLoc)
|
||||
|
||||
void CHostage::MoveToward(const Vector &vecLoc)
|
||||
{
|
||||
int nFwdMove;
|
||||
Vector vecFwd;
|
||||
Vector vecbigDest;
|
||||
Vector vecMove;
|
||||
@ -1080,15 +1099,15 @@ void CHostage::MoveToward(const Vector &vecLoc)
|
||||
Vector vecAng(0, UTIL_VecToAngles(vecMove).y, 0);
|
||||
UTIL_MakeVectorsPrivate(vecAng, vecFwd, nullptr, nullptr);
|
||||
|
||||
if ((vecFwd * s_flStepSize_LocalNav).Length2D() <= (vecLoc - pev->origin).Length2D())
|
||||
flDist = (vecFwd * s_flStepSize_LocalNav).Length2D();
|
||||
if ((vecFwd * m_LocalNav->m_flStepSize).Length2D() <= (vecLoc - pev->origin).Length2D())
|
||||
flDist = (vecFwd * m_LocalNav->m_flStepSize).Length2D();
|
||||
else
|
||||
flDist = (vecLoc - pev->origin).Length2D();
|
||||
|
||||
vecbigDest = pev->origin + (vecFwd * flDist);
|
||||
nFwdMove = m_LocalNav->PathTraversable(pev->origin, vecbigDest, FALSE);
|
||||
|
||||
if (nFwdMove != PATH_TRAVERSABLE_EMPTY)
|
||||
auto nFwdMove = m_LocalNav->PathTraversable(pev->origin, vecbigDest, FALSE);
|
||||
if (nFwdMove != PTRAVELS_EMPTY)
|
||||
{
|
||||
float_precision flSpeed = 250;
|
||||
|
||||
@ -1111,7 +1130,7 @@ void CHostage::MoveToward(const Vector &vecLoc)
|
||||
pev->velocity.x = vecFwd.x * flSpeed;
|
||||
pev->velocity.y = vecFwd.y * flSpeed;
|
||||
|
||||
if (nFwdMove == PATH_TRAVERSABLE_STEPJUMPABLE)
|
||||
if (nFwdMove == PTRAVELS_STEPJUMPABLE)
|
||||
{
|
||||
if (pev->flags & FL_ONGROUND)
|
||||
{
|
||||
@ -1157,8 +1176,8 @@ void CHostage::NavReady()
|
||||
vecDest.z += pFollowing->pev->mins.z;
|
||||
m_LocalNav->SetTargetEnt(pFollowing);
|
||||
|
||||
node_index_t nindexPath = m_LocalNav->FindPath(pev->origin, vecDest, flRadius, 1);
|
||||
if (nindexPath == -1)
|
||||
node_index_t nindexPath = m_LocalNav->FindPath(pev->origin, vecDest, flRadius, TRUE);
|
||||
if (nindexPath == NODE_INVALID_EMPTY)
|
||||
{
|
||||
if (!m_fHasPath)
|
||||
{
|
||||
@ -1173,7 +1192,7 @@ void CHostage::NavReady()
|
||||
else
|
||||
{
|
||||
m_fHasPath = TRUE;
|
||||
nTargetNode = -1;
|
||||
m_nTargetNode = NODE_INVALID_EMPTY;
|
||||
m_flPathAcquired = gpGlobals->time;
|
||||
m_flPathCheckInterval = 0.5f;
|
||||
|
||||
@ -1255,7 +1274,7 @@ void CHostage::Wiggle()
|
||||
|
||||
for (auto& dir : wiggle_directions) {
|
||||
Vector dest = pev->origin + dir;
|
||||
if (m_LocalNav->PathTraversable(pev->origin, dest, TRUE) == PATH_TRAVERSABLE_EMPTY)
|
||||
if (m_LocalNav->PathTraversable(pev->origin, dest, TRUE) == PTRAVELS_EMPTY)
|
||||
vec = vec - dir;
|
||||
}
|
||||
|
||||
@ -1297,7 +1316,7 @@ void CHostage::PreThink()
|
||||
|
||||
vecSrc = pev->origin;
|
||||
|
||||
flInterval = s_flStepSize_LocalNav;
|
||||
flInterval = m_LocalNav->m_flStepSize;
|
||||
vecDest = vecSrc + pev->velocity * gpGlobals->frametime;
|
||||
vecDest.z = vecSrc.z;
|
||||
|
||||
@ -1376,21 +1395,22 @@ void CHostageManager::ServerActivate()
|
||||
{
|
||||
m_hostageCount = 0;
|
||||
|
||||
CBaseEntity *pEntity = nullptr;
|
||||
while ((pEntity = UTIL_FindEntityByClassname(pEntity, "hostage_entity")))
|
||||
CHostage *pHostage = nullptr;
|
||||
while ((pHostage = UTIL_FindEntityByClassname(pHostage, "hostage_entity")))
|
||||
{
|
||||
AddHostage((CHostage *)pEntity);
|
||||
AddHostage(pHostage);
|
||||
}
|
||||
|
||||
if (AreImprovAllowed())
|
||||
{
|
||||
for (auto& sound : hostageSoundStruct) {
|
||||
m_chatter.AddSound(sound.type, sound.fileName);
|
||||
for (auto& snd : hostageSoundStruct) {
|
||||
m_chatter.AddSound(snd.type, snd.fileName);
|
||||
}
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
if (!AreRunningCZero())
|
||||
if (!AreRunningCZero()) {
|
||||
LoadNavigationMap();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -1480,7 +1500,7 @@ void CHostageManager::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEnt
|
||||
{
|
||||
for (int i = 0; i < m_hostageCount; i++)
|
||||
{
|
||||
CHostageImprov *improv = m_hostage[ i ]->m_improv;
|
||||
CHostageImprov *improv = m_hostage[i]->m_improv;
|
||||
if (improv)
|
||||
{
|
||||
improv->OnGameEvent(event, entity, other);
|
||||
|
@ -28,19 +28,17 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define MAX_NODES 100
|
||||
#define MAX_HOSTAGES 12
|
||||
#define MAX_HOSTAGES_NAV 20
|
||||
const int MAX_NODES = 100;
|
||||
const int MAX_HOSTAGES = 12;
|
||||
const int MAX_HOSTAGES_NAV = 20;
|
||||
|
||||
#define HOSTAGE_STEPSIZE 26.0f
|
||||
#define HOSTAGE_STEPSIZE_DEFAULT 18.0f
|
||||
const float HOSTAGE_STEPSIZE = 26.0f;
|
||||
const float MAX_HOSTAGES_RESCUE_RADIUS = 256.0f; // rescue zones from legacy info_*
|
||||
|
||||
#define VEC_HOSTAGE_VIEW Vector(0, 0, 12)
|
||||
#define VEC_HOSTAGE_HULL_MIN Vector(-10, -10, 0)
|
||||
#define VEC_HOSTAGE_HULL_MAX Vector(10, 10, 62)
|
||||
|
||||
#define VEC_HOSTAGE_CROUCH Vector(10, 10, 30)
|
||||
#define RESCUE_HOSTAGES_RADIUS 256.0f // rescue zones from legacy info_*
|
||||
|
||||
class CHostage;
|
||||
class CLocalNav;
|
||||
@ -105,8 +103,8 @@ public:
|
||||
void EXPORT IdleThink();
|
||||
void EXPORT Remove();
|
||||
void RePosition();
|
||||
void SetActivity(int act);
|
||||
int GetActivity() { return m_Activity; }
|
||||
void SetActivity(Activity act);
|
||||
Activity GetActivity() { return m_Activity; }
|
||||
float GetModifiedDamage(float flDamage, int nHitGroup);
|
||||
void SetFlinchActivity();
|
||||
void SetDeathActivity();
|
||||
@ -152,11 +150,10 @@ public:
|
||||
|
||||
bool IsValid() const { return (pev->takedamage == DAMAGE_YES); }
|
||||
bool IsDead() const { return (pev->deadflag == DEAD_DEAD); }
|
||||
bool IsAtHome() const { return (pev->origin - m_vStart).IsLengthGreaterThan(20) != true; }
|
||||
bool IsAtHome() const { return !(pev->origin - m_vStart).IsLengthGreaterThan(20); }
|
||||
const Vector *GetHomePosition() const { return &m_vStart; }
|
||||
|
||||
public:
|
||||
int m_Activity;
|
||||
BOOL m_bTouched;
|
||||
BOOL m_bRescueMe;
|
||||
float m_flFlinchTime;
|
||||
@ -165,17 +162,17 @@ public:
|
||||
int m_iModel;
|
||||
int m_iSkin;
|
||||
float m_flNextRadarTime;
|
||||
enum state { FOLLOW, STAND, DUCK, SCARED, IDLE, FOLLOWPATH }
|
||||
m_State;
|
||||
enum state { FOLLOW, STAND, DUCK, SCARED, IDLE, FOLLOWPATH };
|
||||
state m_State;
|
||||
Vector m_vStart;
|
||||
Vector m_vStartAngles;
|
||||
Vector m_vPathToFollow[20];
|
||||
Vector m_vPathToFollow[MAX_HOSTAGES_NAV];
|
||||
int m_iWaypoint;
|
||||
CBasePlayer *m_target;
|
||||
CLocalNav *m_LocalNav;
|
||||
int nTargetNode;
|
||||
int m_nTargetNode;
|
||||
Vector vecNodes[MAX_NODES];
|
||||
EHANDLE m_hStoppedTargetEnt;
|
||||
EntityHandle<CBasePlayer> m_hStoppedTargetEnt;
|
||||
float m_flNextFullThink;
|
||||
float m_flPathCheckInterval;
|
||||
float m_flLastPathCheck;
|
||||
@ -188,8 +185,8 @@ public:
|
||||
float m_flStuckTime;
|
||||
CHostageImprov *m_improv;
|
||||
|
||||
enum ModelType { REGULAR_GUY, OLD_GUY, BLACK_GUY, GOOFY_GUY }
|
||||
m_whichModel;
|
||||
enum ModelType { REGULAR_GUY, OLD_GUY, BLACK_GUY, GOOFY_GUY };
|
||||
ModelType m_whichModel;
|
||||
};
|
||||
|
||||
class SimpleChatter
|
||||
@ -218,7 +215,7 @@ public:
|
||||
void Shuffle(ChatterSet *chatter);
|
||||
|
||||
private:
|
||||
ChatterSet m_chatter[21];
|
||||
ChatterSet m_chatter[NUM_HOSTAGE_CHATTER_TYPES];
|
||||
};
|
||||
|
||||
class CHostageManager
|
||||
@ -246,12 +243,12 @@ public:
|
||||
{
|
||||
for (int i = 0; i < m_hostageCount; i++)
|
||||
{
|
||||
CHostage *hostage = m_hostage[i];
|
||||
CHostage *pHostage = m_hostage[i];
|
||||
|
||||
if (!hostage || hostage->pev->deadflag == DEAD_DEAD)
|
||||
if (!pHostage || pHostage->pev->deadflag == DEAD_DEAD)
|
||||
continue;
|
||||
|
||||
if (func(hostage) == false)
|
||||
if (!func(pHostage))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
inline void DrawAxes(const Vector &origin, int red, int green, int blue)
|
||||
|
@ -1,21 +1,44 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
EntityHandle<CHostage> CLocalNav::m_hQueue[MAX_HOSTAGES_NAV];
|
||||
EntityHandle<CHostage> CLocalNav::m_hHostages[MAX_HOSTAGES_NAV];
|
||||
|
||||
float CLocalNav::s_flStepSize;
|
||||
int CLocalNav::qptr;
|
||||
EHANDLE CLocalNav::_queue[MAX_HOSTAGES_NAV];
|
||||
int CLocalNav::tot_inqueue;
|
||||
float CLocalNav::nodeval;
|
||||
float CLocalNav::flNextCvarCheck;
|
||||
float CLocalNav::flLastThinkTime;
|
||||
EHANDLE CLocalNav::hostages[MAX_HOSTAGES_NAV];
|
||||
int CLocalNav::tot_hostages;
|
||||
int CLocalNav::m_CurRequest = 0;
|
||||
int CLocalNav::m_NumRequest = 0;
|
||||
int CLocalNav::m_NumHostages = 0;
|
||||
int CLocalNav::m_NodeValue = 0;
|
||||
|
||||
#endif
|
||||
float CLocalNav::m_flStepSize = 18.0f; // sv_stepsize by default
|
||||
float CLocalNav::m_flNextCvarCheck = 0.0f;
|
||||
float CLocalNav::m_flLastThinkTime = 0.0f;
|
||||
|
||||
CLocalNav::CLocalNav(CHostage *pOwner)
|
||||
{
|
||||
@ -23,12 +46,10 @@ CLocalNav::CLocalNav(CHostage *pOwner)
|
||||
m_pTargetEnt = nullptr;
|
||||
m_nodeArr = new localnode_t[MAX_NODES];
|
||||
|
||||
if (tot_hostages >= MAX_HOSTAGES_NAV)
|
||||
{
|
||||
if (m_NumHostages >= MAX_HOSTAGES_NAV)
|
||||
return;
|
||||
}
|
||||
|
||||
hostages[tot_hostages++] = pOwner;
|
||||
m_hHostages[m_NumHostages++] = pOwner;
|
||||
}
|
||||
|
||||
CLocalNav::~CLocalNav()
|
||||
@ -61,7 +82,7 @@ node_index_t CLocalNav::AddNode(node_index_t nindexParent, Vector &vecLoc, int o
|
||||
|
||||
localnode_t *CLocalNav::GetNode(node_index_t nindex)
|
||||
{
|
||||
return &m_nodeArr[ nindex ];
|
||||
return &m_nodeArr[nindex];
|
||||
}
|
||||
|
||||
node_index_t CLocalNav::NodeExists(int offsetX, int offsetY)
|
||||
@ -82,7 +103,7 @@ node_index_t CLocalNav::NodeExists(int offsetX, int offsetY)
|
||||
return nindexCurrent;
|
||||
}
|
||||
|
||||
void CLocalNav::AddPathNodes(node_index_t nindexSource, int fNoMonsters)
|
||||
void CLocalNav::AddPathNodes(node_index_t nindexSource, BOOL fNoMonsters)
|
||||
{
|
||||
AddPathNode(nindexSource, 1, 0, fNoMonsters);
|
||||
AddPathNode(nindexSource, -1, 0, fNoMonsters);
|
||||
@ -94,9 +115,9 @@ void CLocalNav::AddPathNodes(node_index_t nindexSource, int fNoMonsters)
|
||||
AddPathNode(nindexSource, -1, -1, fNoMonsters);
|
||||
}
|
||||
|
||||
void CLocalNav::AddPathNode(node_index_t nindexSource, int offsetX, int offsetY, int fNoMonsters)
|
||||
void CLocalNav::AddPathNode(node_index_t nindexSource, int offsetX, int offsetY, BOOL fNoMonsters)
|
||||
{
|
||||
int bDepth;
|
||||
byte bDepth;
|
||||
Vector vecSource, vecDest;
|
||||
int offsetXAbs, offsetYAbs;
|
||||
|
||||
@ -173,7 +194,7 @@ void CLocalNav::AddPathNode(node_index_t nindexSource, int offsetX, int offsetY,
|
||||
}
|
||||
}
|
||||
|
||||
if (PathTraversable(nodeSource->vecLoc, vecDest, fNoMonsters) != PATH_TRAVERSABLE_EMPTY)
|
||||
if (PathTraversable(nodeSource->vecLoc, vecDest, fNoMonsters) != PTRAVELS_EMPTY)
|
||||
{
|
||||
nodeCurrent = nodeSource;
|
||||
nindexSource = nindexCurrent;
|
||||
@ -183,10 +204,10 @@ void CLocalNav::AddPathNode(node_index_t nindexSource, int offsetX, int offsetY,
|
||||
}
|
||||
|
||||
vecSource = nodeCurrent->vecLoc;
|
||||
bDepth = int(nodeCurrent->bDepth) + 1;
|
||||
bDepth = (nodeCurrent->bDepth + 1) & 0xff;
|
||||
}
|
||||
|
||||
if (PathTraversable(vecSource, vecDest, fNoMonsters) != PATH_TRAVERSABLE_EMPTY)
|
||||
if (PathTraversable(vecSource, vecDest, fNoMonsters) != PTRAVELS_EMPTY)
|
||||
{
|
||||
AddNode(nindexSource, vecDest, offsetXAbs, offsetYAbs, bDepth);
|
||||
}
|
||||
@ -225,7 +246,7 @@ node_index_t CLocalNav::GetBestNode(Vector &vecOrigin, Vector &vecDest)
|
||||
flZDiff = 1.0;
|
||||
}
|
||||
|
||||
if ((flDistToDest * flZDiff) <= s_flStepSize)
|
||||
if ((flDistToDest * flZDiff) <= m_flStepSize)
|
||||
flZDiff = 1.0;
|
||||
else
|
||||
flZDiff = 1.25;
|
||||
@ -238,13 +259,13 @@ node_index_t CLocalNav::GetBestNode(Vector &vecOrigin, Vector &vecDest)
|
||||
}
|
||||
}
|
||||
|
||||
++nindexCurrent;
|
||||
nindexCurrent++;
|
||||
}
|
||||
|
||||
return nindexBest;
|
||||
}
|
||||
|
||||
int CLocalNav::SetupPathNodes(node_index_t nindex, Vector *vecNodes, int fNoMonsters)
|
||||
int CLocalNav::SetupPathNodes(node_index_t nindex, Vector *vecNodes, BOOL fNoMonsters)
|
||||
{
|
||||
node_index_t nCurrentIndex = nindex;
|
||||
int nNodeCount = 0;
|
||||
@ -253,7 +274,7 @@ int CLocalNav::SetupPathNodes(node_index_t nindex, Vector *vecNodes, int fNoMons
|
||||
{
|
||||
localnode_t *nodeCurrent = GetNode(nCurrentIndex);
|
||||
Vector vecCurrentLoc = nodeCurrent->vecLoc;
|
||||
vecNodes[ nNodeCount++ ] = vecCurrentLoc;
|
||||
vecNodes[nNodeCount++] = vecCurrentLoc;
|
||||
|
||||
nCurrentIndex = nodeCurrent->nindexParent;
|
||||
}
|
||||
@ -261,21 +282,21 @@ int CLocalNav::SetupPathNodes(node_index_t nindex, Vector *vecNodes, int fNoMons
|
||||
return nNodeCount;
|
||||
}
|
||||
|
||||
int CLocalNav::GetFurthestTraversableNode(Vector &vecStartingLoc, Vector *vecNodes, int nTotalNodes, int fNoMonsters)
|
||||
node_index_t CLocalNav::GetFurthestTraversableNode(Vector &vecStartingLoc, Vector *vecNodes, int nTotalNodes, BOOL fNoMonsters)
|
||||
{
|
||||
int nCount = 0;
|
||||
while (nCount < nTotalNodes)
|
||||
{
|
||||
if (PathTraversable(vecStartingLoc, vecNodes[nCount], fNoMonsters) != PATH_TRAVERSABLE_EMPTY)
|
||||
if (PathTraversable(vecStartingLoc, vecNodes[nCount], fNoMonsters) != PTRAVELS_EMPTY)
|
||||
return nCount;
|
||||
|
||||
++nCount;
|
||||
nCount++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
return NODE_INVALID_EMPTY;
|
||||
}
|
||||
|
||||
node_index_t CLocalNav::FindPath(Vector &vecStart, Vector &vecDest, float flTargetRadius, int fNoMonsters)
|
||||
node_index_t CLocalNav::FindPath(Vector &vecStart, Vector &vecDest, float flTargetRadius, BOOL fNoMonsters)
|
||||
{
|
||||
node_index_t nIndexBest = FindDirectPath(vecStart, vecDest, flTargetRadius, fNoMonsters);
|
||||
|
||||
@ -320,92 +341,92 @@ node_index_t CLocalNav::FindPath(Vector &vecStart, Vector &vecDest, float flTarg
|
||||
}
|
||||
|
||||
if (m_nindexAvailableNode <= 10)
|
||||
nodeval += 2;
|
||||
m_NodeValue += 2;
|
||||
|
||||
else if (m_nindexAvailableNode <= 20)
|
||||
nodeval += 4;
|
||||
m_NodeValue += 4;
|
||||
|
||||
else if (m_nindexAvailableNode <= 30)
|
||||
nodeval += 8;
|
||||
m_NodeValue += 8;
|
||||
|
||||
else if (m_nindexAvailableNode <= 40)
|
||||
nodeval += 13;
|
||||
m_NodeValue += 13;
|
||||
|
||||
else if (m_nindexAvailableNode <= 50)
|
||||
nodeval += 19;
|
||||
m_NodeValue += 19;
|
||||
|
||||
else if (m_nindexAvailableNode <= 60)
|
||||
nodeval += 26;
|
||||
m_NodeValue += 26;
|
||||
|
||||
else if (m_nindexAvailableNode <= 70)
|
||||
nodeval += 34;
|
||||
m_NodeValue += 34;
|
||||
|
||||
else if (m_nindexAvailableNode <= 80)
|
||||
nodeval += 43;
|
||||
m_NodeValue += 43;
|
||||
|
||||
else if (m_nindexAvailableNode <= 90)
|
||||
nodeval += 53;
|
||||
m_NodeValue += 53;
|
||||
|
||||
else if (m_nindexAvailableNode <= 100)
|
||||
nodeval += 64;
|
||||
m_NodeValue += 64;
|
||||
|
||||
else if (m_nindexAvailableNode <= 110)
|
||||
nodeval += 76;
|
||||
m_NodeValue += 76;
|
||||
|
||||
else if (m_nindexAvailableNode <= 120)
|
||||
nodeval += 89;
|
||||
m_NodeValue += 89;
|
||||
|
||||
else if (m_nindexAvailableNode <= 130)
|
||||
nodeval += 103;
|
||||
m_NodeValue += 103;
|
||||
|
||||
else if (m_nindexAvailableNode <= 140)
|
||||
nodeval += 118;
|
||||
m_NodeValue += 118;
|
||||
|
||||
else if (m_nindexAvailableNode <= 150)
|
||||
nodeval += 134;
|
||||
m_NodeValue += 134;
|
||||
|
||||
else if (m_nindexAvailableNode <= 160)
|
||||
nodeval += 151;
|
||||
m_NodeValue += 151;
|
||||
else
|
||||
nodeval += 169;
|
||||
m_NodeValue += 169;
|
||||
|
||||
return nIndexBest;
|
||||
}
|
||||
|
||||
node_index_t CLocalNav::FindDirectPath(Vector &vecStart, Vector &vecDest, float flTargetRadius, int fNoMonsters)
|
||||
node_index_t CLocalNav::FindDirectPath(Vector &vecStart, Vector &vecDest, float flTargetRadius, BOOL fNoMonsters)
|
||||
{
|
||||
Vector vecActualDest;
|
||||
Vector vecPathDir;
|
||||
Vector vecNodeLoc;
|
||||
node_index_t nindexLast;
|
||||
node_index_t nIndexLast;
|
||||
|
||||
vecPathDir = NormalizeSubtract<float_precision, float, float, float_precision>(vecStart, vecDest);
|
||||
vecActualDest = vecDest - (vecPathDir * flTargetRadius);
|
||||
|
||||
if (PathTraversable(vecStart, vecActualDest, fNoMonsters) == PATH_TRAVERSABLE_EMPTY)
|
||||
if (PathTraversable(vecStart, vecActualDest, fNoMonsters) == PTRAVELS_EMPTY)
|
||||
{
|
||||
return NODE_INVALID_EMPTY;
|
||||
}
|
||||
|
||||
nindexLast = NODE_INVALID_EMPTY;
|
||||
nIndexLast = NODE_INVALID_EMPTY;
|
||||
vecNodeLoc = vecStart;
|
||||
m_nindexAvailableNode = 0;
|
||||
|
||||
while ((vecNodeLoc - vecActualDest).Length2D() >= HOSTAGE_STEPSIZE)
|
||||
{
|
||||
node_index_t nindexCurrent = nindexLast;
|
||||
node_index_t nindexCurrent = nIndexLast;
|
||||
|
||||
vecNodeLoc = vecNodeLoc + (vecPathDir * HOSTAGE_STEPSIZE);
|
||||
nindexLast = AddNode(nindexCurrent, vecNodeLoc);
|
||||
nIndexLast = AddNode(nindexCurrent, vecNodeLoc);
|
||||
|
||||
if (nindexLast == NODE_INVALID_EMPTY)
|
||||
if (nIndexLast == NODE_INVALID_EMPTY)
|
||||
break;
|
||||
}
|
||||
|
||||
return nindexLast;
|
||||
return nIndexLast;
|
||||
}
|
||||
|
||||
BOOL CLocalNav::PathClear(Vector &vecOrigin, Vector &vecDest, int fNoMonsters, TraceResult &tr)
|
||||
BOOL CLocalNav::PathClear(Vector &vecOrigin, Vector &vecDest, BOOL fNoMonsters, TraceResult &tr)
|
||||
{
|
||||
TRACE_MONSTER_HULL(m_pOwner->edict(), vecOrigin, vecDest, fNoMonsters, m_pOwner->edict(), &tr);
|
||||
|
||||
@ -424,14 +445,20 @@ BOOL CLocalNav::PathClear(Vector &vecOrigin, Vector &vecDest, int fNoMonsters, T
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters)
|
||||
BOOL CLocalNav::PathClear(Vector &vecSource, Vector &vecDest, BOOL fNoMonsters)
|
||||
{
|
||||
TraceResult tr;
|
||||
return PathClear(vecSource, vecDest, fNoMonsters, tr);
|
||||
}
|
||||
|
||||
PathTraversAble CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, BOOL fNoMonsters)
|
||||
{
|
||||
TraceResult tr;
|
||||
Vector vecSrcTmp;
|
||||
Vector vecDestTmp;
|
||||
Vector vecDir;
|
||||
float_precision flTotal;
|
||||
int retval = PATH_TRAVERSABLE_EMPTY;
|
||||
auto retval = PTRAVELS_EMPTY;
|
||||
|
||||
vecSrcTmp = vecSource;
|
||||
vecDestTmp = vecDest - vecSource;
|
||||
@ -443,15 +470,15 @@ int CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonste
|
||||
|
||||
while (flTotal > 1.0f)
|
||||
{
|
||||
if (flTotal >= s_flStepSize)
|
||||
if (flTotal >= m_flStepSize)
|
||||
{
|
||||
#ifndef PLAY_GAMEDLL
|
||||
vecDestTmp = vecSrcTmp + (vecDir * s_flStepSize);
|
||||
vecDestTmp = vecSrcTmp + (vecDir * m_flStepSize);
|
||||
#else
|
||||
// TODO: fix test demo
|
||||
vecDestTmp[0] = vecSrcTmp[0] + (vecDir[0] * s_flStepSize);
|
||||
vecDestTmp[1] = vecSrcTmp[1] + float(vecDir[1] * s_flStepSize);
|
||||
vecDestTmp[2] = vecSrcTmp[2] + (vecDir[2] * s_flStepSize);
|
||||
vecDestTmp[0] = vecSrcTmp[0] + (vecDir[0] * m_flStepSize);
|
||||
vecDestTmp[1] = vecSrcTmp[1] + float(vecDir[1] * m_flStepSize);
|
||||
vecDestTmp[2] = vecSrcTmp[2] + (vecDir[2] * m_flStepSize);
|
||||
#endif
|
||||
|
||||
}
|
||||
@ -464,23 +491,23 @@ int CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonste
|
||||
{
|
||||
vecDestTmp = tr.vecEndPos;
|
||||
|
||||
if (retval == PATH_TRAVERSABLE_EMPTY)
|
||||
if (retval == PTRAVELS_EMPTY)
|
||||
{
|
||||
retval = PATH_TRAVERSABLE_SLOPE;
|
||||
retval = PTRAVELS_SLOPE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tr.fStartSolid)
|
||||
{
|
||||
return PATH_TRAVERSABLE_EMPTY;
|
||||
return PTRAVELS_EMPTY;
|
||||
}
|
||||
|
||||
if (tr.pHit && !fNoMonsters && tr.pHit->v.classname)
|
||||
{
|
||||
if (FClassnameIs(tr.pHit, "hostage_entity"))
|
||||
{
|
||||
return PATH_TRAVERSABLE_EMPTY;
|
||||
return PTRAVELS_EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
@ -490,21 +517,21 @@ int CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonste
|
||||
{
|
||||
if (StepTraversable(vecSrcTmp, vecDestTmp, fNoMonsters, tr))
|
||||
{
|
||||
if (retval == PATH_TRAVERSABLE_EMPTY)
|
||||
if (retval == PTRAVELS_EMPTY)
|
||||
{
|
||||
retval = PATH_TRAVERSABLE_STEP;
|
||||
retval = PTRAVELS_STEP;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!StepJumpable(vecSrcTmp, vecDestTmp, fNoMonsters, tr))
|
||||
{
|
||||
return PATH_TRAVERSABLE_EMPTY;
|
||||
return PTRAVELS_EMPTY;
|
||||
}
|
||||
|
||||
if (retval == PATH_TRAVERSABLE_EMPTY)
|
||||
if (retval == PTRAVELS_EMPTY)
|
||||
{
|
||||
retval = PATH_TRAVERSABLE_STEPJUMPABLE;
|
||||
retval = PTRAVELS_STEPJUMPABLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -512,12 +539,12 @@ int CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonste
|
||||
{
|
||||
if (!SlopeTraversable(vecSrcTmp, vecDestTmp, fNoMonsters, tr))
|
||||
{
|
||||
return PATH_TRAVERSABLE_EMPTY;
|
||||
return PTRAVELS_EMPTY;
|
||||
}
|
||||
|
||||
if (retval == PATH_TRAVERSABLE_EMPTY)
|
||||
if (retval == PTRAVELS_EMPTY)
|
||||
{
|
||||
retval = PATH_TRAVERSABLE_SLOPE;
|
||||
retval = PTRAVELS_SLOPE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -526,7 +553,7 @@ int CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonste
|
||||
|
||||
if (PathClear(vecDestTmp, vecDropDest, fNoMonsters, tr))
|
||||
{
|
||||
return PATH_TRAVERSABLE_EMPTY;
|
||||
return PTRAVELS_EMPTY;
|
||||
}
|
||||
|
||||
if (!tr.fStartSolid)
|
||||
@ -548,7 +575,7 @@ int CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonste
|
||||
return retval;
|
||||
}
|
||||
|
||||
BOOL CLocalNav::SlopeTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr)
|
||||
BOOL CLocalNav::SlopeTraversable(Vector &vecSource, Vector &vecDest, BOOL fNoMonsters, TraceResult &tr)
|
||||
{
|
||||
Vector vecSlopeEnd;
|
||||
Vector vecDown;
|
||||
@ -572,7 +599,7 @@ BOOL CLocalNav::SlopeTraversable(Vector &vecSource, Vector &vecDest, int fNoMons
|
||||
vecSlopeEnd = tr.vecEndPos;
|
||||
|
||||
vecDown = vecSlopeEnd;
|
||||
vecDown.z -= s_flStepSize;
|
||||
vecDown.z -= m_flStepSize;
|
||||
|
||||
if (!PathClear(vecSlopeEnd, vecDown, fNoMonsters, tr))
|
||||
{
|
||||
@ -587,7 +614,7 @@ BOOL CLocalNav::SlopeTraversable(Vector &vecSource, Vector &vecDest, int fNoMons
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CLocalNav::LadderTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr)
|
||||
BOOL CLocalNav::LadderTraversable(Vector &vecSource, Vector &vecDest, BOOL fNoMonsters, TraceResult &tr)
|
||||
{
|
||||
Vector vecStepStart;
|
||||
Vector vecStepDest;
|
||||
@ -611,7 +638,7 @@ BOOL CLocalNav::LadderTraversable(Vector &vecSource, Vector &vecDest, int fNoMon
|
||||
return PathTraversable(vecStepStart, vecDest, fNoMonsters);
|
||||
}
|
||||
|
||||
BOOL CLocalNav::StepTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr)
|
||||
BOOL CLocalNav::StepTraversable(Vector &vecSource, Vector &vecDest, BOOL fNoMonsters, TraceResult &tr)
|
||||
{
|
||||
Vector vecStepStart;
|
||||
Vector vecStepDest;
|
||||
@ -621,7 +648,7 @@ BOOL CLocalNav::StepTraversable(Vector &vecSource, Vector &vecDest, int fNoMonst
|
||||
vecStepStart = vecSource;
|
||||
vecStepDest = vecDest;
|
||||
|
||||
vecStepStart.z += s_flStepSize;
|
||||
vecStepStart.z += m_flStepSize;
|
||||
vecStepDest.z = vecStepStart.z;
|
||||
|
||||
if (!PathClear(vecStepStart, vecStepDest, fNoMonsters, tr))
|
||||
@ -638,7 +665,7 @@ BOOL CLocalNav::StepTraversable(Vector &vecSource, Vector &vecDest, int fNoMonst
|
||||
vecStepStart = tr.vecEndPos;
|
||||
|
||||
vecStepDest = vecStepStart;
|
||||
vecStepDest.z -= s_flStepSize;
|
||||
vecStepDest.z -= m_flStepSize;
|
||||
|
||||
if (!PathClear(vecStepStart, vecStepDest, fNoMonsters, tr))
|
||||
{
|
||||
@ -653,12 +680,12 @@ BOOL CLocalNav::StepTraversable(Vector &vecSource, Vector &vecDest, int fNoMonst
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CLocalNav::StepJumpable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr)
|
||||
BOOL CLocalNav::StepJumpable(Vector &vecSource, Vector &vecDest, BOOL fNoMonsters, TraceResult &tr)
|
||||
{
|
||||
Vector vecStepStart;
|
||||
Vector vecStepDest;
|
||||
float flFwdFraction;
|
||||
float flJumpHeight = s_flStepSize + 1.0f;
|
||||
float flJumpHeight = m_flStepSize + 1.0f;
|
||||
|
||||
vecStepStart = vecSource;
|
||||
vecStepStart.z += flJumpHeight;
|
||||
@ -686,7 +713,7 @@ BOOL CLocalNav::StepJumpable(Vector &vecSource, Vector &vecDest, int fNoMonsters
|
||||
|
||||
vecStepStart = tr.vecEndPos;
|
||||
vecStepDest = vecStepStart;
|
||||
vecStepDest.z -= s_flStepSize;
|
||||
vecStepDest.z -= m_flStepSize;
|
||||
|
||||
if (!PathClear(vecStepStart, vecStepDest, fNoMonsters, tr))
|
||||
{
|
||||
@ -746,120 +773,107 @@ BOOL CLocalNav::LadderHit(Vector &vecSource, Vector &vecDest, TraceResult &tr)
|
||||
|
||||
void CLocalNav::Think()
|
||||
{
|
||||
EHANDLE hCallback;
|
||||
static cvar_t *sv_stepsize = nullptr;
|
||||
|
||||
if (gpGlobals->time >= flNextCvarCheck)
|
||||
static cvar_t *sv_stepsize = NULL;
|
||||
if (gpGlobals->time >= m_flNextCvarCheck)
|
||||
{
|
||||
if (sv_stepsize)
|
||||
s_flStepSize = sv_stepsize->value;
|
||||
if (sv_stepsize != NULL)
|
||||
m_flStepSize = sv_stepsize->value;
|
||||
else
|
||||
{
|
||||
sv_stepsize = CVAR_GET_POINTER("sv_stepsize");
|
||||
s_flStepSize = s_flStepSize ? sv_stepsize->value : HOSTAGE_STEPSIZE_DEFAULT;
|
||||
m_flStepSize = sv_stepsize ? sv_stepsize->value : 18;
|
||||
}
|
||||
|
||||
flNextCvarCheck = gpGlobals->time + 1.0f;
|
||||
m_flNextCvarCheck = gpGlobals->time + 1.0f;
|
||||
}
|
||||
|
||||
HostagePrethink();
|
||||
|
||||
float flElapsedTime = gpGlobals->time - flLastThinkTime;
|
||||
nodeval -= flElapsedTime * 250;
|
||||
flLastThinkTime = gpGlobals->time;
|
||||
float flElapsedTime = gpGlobals->time - m_flLastThinkTime;
|
||||
m_NodeValue -= flElapsedTime * 250;
|
||||
m_flLastThinkTime = gpGlobals->time;
|
||||
|
||||
if (nodeval < 0)
|
||||
nodeval = 0;
|
||||
if (m_NodeValue < 0)
|
||||
m_NodeValue = 0;
|
||||
|
||||
else if (nodeval > 17)
|
||||
else if (m_NodeValue > 17)
|
||||
return;
|
||||
|
||||
if (tot_inqueue)
|
||||
if (m_NumRequest)
|
||||
{
|
||||
hCallback = _queue[qptr];
|
||||
auto hHostage = m_hQueue[m_CurRequest];
|
||||
while (!hHostage.IsValid() && m_NumRequest > 0)
|
||||
{
|
||||
if (++m_CurRequest == MAX_HOSTAGES_NAV)
|
||||
m_CurRequest = 0;
|
||||
|
||||
if (!hCallback)
|
||||
m_NumRequest--;
|
||||
if (m_NumRequest <= 0)
|
||||
{
|
||||
while (tot_inqueue > 0)
|
||||
{
|
||||
if (++qptr == MAX_HOSTAGES_NAV)
|
||||
qptr = 0;
|
||||
|
||||
tot_inqueue--;
|
||||
if (!tot_inqueue)
|
||||
{
|
||||
hCallback = nullptr;
|
||||
hHostage = nullptr;
|
||||
break;
|
||||
}
|
||||
|
||||
hCallback = _queue[qptr];
|
||||
|
||||
if (hCallback)
|
||||
break;
|
||||
}
|
||||
hHostage = m_hQueue[m_CurRequest];
|
||||
}
|
||||
|
||||
if (hCallback)
|
||||
if (hHostage.IsValid())
|
||||
{
|
||||
CHostage *pHostage = GetClassPtr<CCSHostage>((CHostage *)hCallback->pev);
|
||||
if (++m_CurRequest == MAX_HOSTAGES_NAV)
|
||||
m_CurRequest = 0;
|
||||
|
||||
if (++qptr == MAX_HOSTAGES_NAV)
|
||||
qptr = 0;
|
||||
|
||||
tot_inqueue--;
|
||||
pHostage->NavReady();
|
||||
m_NumRequest--;
|
||||
hHostage->NavReady();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CLocalNav::RequestNav(CHostage *pCaller)
|
||||
{
|
||||
int curr = qptr;
|
||||
int curr = m_CurRequest;
|
||||
int found = 0;
|
||||
|
||||
if (nodeval <= 17 && !tot_inqueue)
|
||||
if (m_NodeValue <= 17 && !m_NumRequest)
|
||||
{
|
||||
pCaller->NavReady();
|
||||
return;
|
||||
}
|
||||
|
||||
if (tot_inqueue >= MAX_HOSTAGES_NAV)
|
||||
if (m_NumRequest >= MAX_HOSTAGES_NAV)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < tot_inqueue; ++i)
|
||||
for (int i = 0; i < m_NumRequest; i++)
|
||||
{
|
||||
CHostage *pQueueItem = GetClassPtr<CCSHostage>((CHostage *)_queue[curr]->pev);
|
||||
|
||||
if (pQueueItem == pCaller)
|
||||
if (m_hQueue[curr] == pCaller)
|
||||
return;
|
||||
|
||||
if (++curr == MAX_HOSTAGES_NAV)
|
||||
curr = 0;
|
||||
}
|
||||
|
||||
_queue[curr] = pCaller;
|
||||
++tot_inqueue;
|
||||
m_hQueue[curr] = pCaller;
|
||||
m_NumRequest++;
|
||||
}
|
||||
|
||||
void CLocalNav::Reset()
|
||||
{
|
||||
flNextCvarCheck = 0;
|
||||
flLastThinkTime = 0;
|
||||
tot_inqueue = 0;
|
||||
qptr = 0;
|
||||
nodeval = 0;
|
||||
tot_hostages = 0;
|
||||
m_flNextCvarCheck = 0.0f;
|
||||
m_flLastThinkTime = 0.0f;
|
||||
|
||||
m_NumRequest = 0;
|
||||
m_CurRequest = 0;
|
||||
m_NumHostages = 0;
|
||||
m_NodeValue = 0;
|
||||
}
|
||||
|
||||
void CLocalNav::HostagePrethink()
|
||||
{
|
||||
for (int iCount = 0; iCount < tot_hostages; ++iCount)
|
||||
for (int i = 0; i < m_NumHostages; i++)
|
||||
{
|
||||
if (hostages[ iCount ])
|
||||
{
|
||||
GetClassPtr<CCSHostage>((CHostage *)hostages[ iCount ]->pev)->PreThink();
|
||||
if (m_hHostages[i].IsValid()) {
|
||||
m_hHostages[i]->PreThink();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,14 +28,16 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define NODE_INVALID_EMPTY -1
|
||||
enum PathTraversAble
|
||||
{
|
||||
PTRAVELS_EMPTY,
|
||||
PTRAVELS_SLOPE,
|
||||
PTRAVELS_STEP,
|
||||
PTRAVELS_STEPJUMPABLE,
|
||||
};
|
||||
|
||||
#define PATH_TRAVERSABLE_EMPTY 0
|
||||
#define PATH_TRAVERSABLE_SLOPE 1
|
||||
#define PATH_TRAVERSABLE_STEP 2
|
||||
#define PATH_TRAVERSABLE_STEPJUMPABLE 3
|
||||
|
||||
typedef int node_index_t;
|
||||
using node_index_t = int;
|
||||
constexpr node_index_t NODE_INVALID_EMPTY = {-1};
|
||||
|
||||
typedef struct localnode_s
|
||||
{
|
||||
@ -48,10 +50,6 @@ typedef struct localnode_s
|
||||
|
||||
} localnode_t;
|
||||
|
||||
#ifndef HOOK_GAMEDLL
|
||||
#define s_flStepSize_LocalNav m_LocalNav->s_flStepSize
|
||||
#endif
|
||||
|
||||
class CLocalNav
|
||||
{
|
||||
public:
|
||||
@ -66,44 +64,40 @@ public:
|
||||
m_pTargetEnt = nullptr;
|
||||
}
|
||||
|
||||
node_index_t FindPath(Vector &vecStart, Vector &vecDest, float flTargetRadius, int fNoMonsters);
|
||||
int SetupPathNodes(node_index_t nindex, Vector *vecNodes, int fNoMonsters);
|
||||
int GetFurthestTraversableNode(Vector &vecStartingLoc, Vector *vecNodes, int nTotalNodes, int fNoMonsters);
|
||||
int PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters);
|
||||
BOOL PathClear(Vector &vecOrigin, Vector &vecDest, int fNoMonsters, TraceResult &tr);
|
||||
BOOL PathClear(Vector &vecSource, Vector &vecDest, BOOL fNoMonsters)
|
||||
{
|
||||
TraceResult tr;
|
||||
return PathClear(vecSource, vecDest, fNoMonsters, tr);
|
||||
}
|
||||
node_index_t FindPath(Vector &vecStart, Vector &vecDest, float flTargetRadius, BOOL fNoMonsters);
|
||||
int SetupPathNodes(node_index_t nindex, Vector *vecNodes, BOOL fNoMonsters);
|
||||
node_index_t GetFurthestTraversableNode(Vector &vecStartingLoc, Vector *vecNodes, int nTotalNodes, BOOL fNoMonsters);
|
||||
PathTraversAble PathTraversable(Vector &vecSource, Vector &vecDest, BOOL fNoMonsters);
|
||||
BOOL PathClear(Vector &vecOrigin, Vector &vecDest, BOOL fNoMonsters, TraceResult &tr);
|
||||
BOOL PathClear(Vector &vecSource, Vector &vecDest, BOOL fNoMonsters);
|
||||
node_index_t AddNode(node_index_t nindexParent, Vector &vecLoc, int offsetX = 0, int offsetY = 0, byte bDepth = 0);
|
||||
localnode_t *GetNode(node_index_t nindex);
|
||||
node_index_t NodeExists(int offsetX, int offsetY);
|
||||
void AddPathNodes(node_index_t nindexSource, int fNoMonsters);
|
||||
void AddPathNode(node_index_t nindexSource, int offsetX, int offsetY, int fNoMonsters);
|
||||
void AddPathNodes(node_index_t nindexSource, BOOL fNoMonsters);
|
||||
void AddPathNode(node_index_t nindexSource, int offsetX, int offsetY, BOOL fNoMonsters);
|
||||
node_index_t GetBestNode(Vector &vecOrigin, Vector &vecDest);
|
||||
BOOL SlopeTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr);
|
||||
BOOL LadderTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr);
|
||||
BOOL StepTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr);
|
||||
BOOL StepJumpable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr);
|
||||
node_index_t FindDirectPath(Vector &vecStart, Vector &vecDest, float flTargetRadius, int fNoMonsters);
|
||||
BOOL SlopeTraversable(Vector &vecSource, Vector &vecDest, BOOL fNoMonsters, TraceResult &tr);
|
||||
BOOL LadderTraversable(Vector &vecSource, Vector &vecDest, BOOL fNoMonsters, TraceResult &tr);
|
||||
BOOL StepTraversable(Vector &vecSource, Vector &vecDest, BOOL fNoMonsters, TraceResult &tr);
|
||||
BOOL StepJumpable(Vector &vecSource, Vector &vecDest, BOOL fNoMonsters, TraceResult &tr);
|
||||
node_index_t FindDirectPath(Vector &vecStart, Vector &vecDest, float flTargetRadius, BOOL fNoMonsters);
|
||||
BOOL LadderHit(Vector &vecSource, Vector &vecDest, TraceResult &tr);
|
||||
|
||||
static void Think();
|
||||
static void RequestNav(CHostage *pCaller);
|
||||
static void Reset();
|
||||
static void HostagePrethink();
|
||||
static float s_flStepSize;
|
||||
static float m_flStepSize;
|
||||
|
||||
private:
|
||||
static EHANDLE _queue[MAX_HOSTAGES_NAV];
|
||||
static int qptr;
|
||||
static int tot_inqueue;
|
||||
static float nodeval;
|
||||
static float flNextCvarCheck;
|
||||
static float flLastThinkTime;
|
||||
static EHANDLE hostages[MAX_HOSTAGES_NAV];
|
||||
static int tot_hostages;
|
||||
static EntityHandle<CHostage> m_hQueue[MAX_HOSTAGES_NAV];
|
||||
static EntityHandle<CHostage> m_hHostages[MAX_HOSTAGES_NAV];
|
||||
static int m_CurRequest;
|
||||
static int m_NumRequest;
|
||||
static int m_NumHostages;
|
||||
static int m_NodeValue;
|
||||
static float m_flNextCvarCheck;
|
||||
static float m_flLastThinkTime;
|
||||
|
||||
CHostage *m_pOwner;
|
||||
edict_t *m_pTargetEnt;
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
void HostageAnimateState::Reset()
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
void HostageEscapeToCoverState::OnEnter(CHostageImprov *improv)
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
void HostageFollowState::OnEnter(CHostageImprov *improv)
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
void HostageIdleState::OnEnter(CHostageImprov *improv)
|
||||
|
@ -1,3 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
void HostageRetreatState::OnEnter(CHostageImprov *improv)
|
||||
|
@ -278,7 +278,7 @@ BOOL CItemAntidote::MyTouch(CBasePlayer *pPlayer)
|
||||
#endif
|
||||
|
||||
pPlayer->SetSuitUpdate("!HEV_DET4", SUIT_SENTENCE, SUIT_NEXT_IN_1MIN);
|
||||
pPlayer->m_rgItems[ ITEM_ID_ANTIDOTE ] += 1;
|
||||
pPlayer->m_rgItems[ITEM_ID_ANTIDOTE] += 1;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -301,7 +301,7 @@ void CItemSecurity::Precache()
|
||||
|
||||
BOOL CItemSecurity::MyTouch(CBasePlayer *pPlayer)
|
||||
{
|
||||
pPlayer->m_rgItems[ ITEM_ID_SECURITY ] += 1;
|
||||
pPlayer->m_rgItems[ITEM_ID_SECURITY] += 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1,18 +1,11 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
TYPEDESCRIPTION CLight::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CLight, m_iStyle, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CLight, m_iszPattern, FIELD_STRING),
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
LINK_ENTITY_TO_CLASS(light, CLight, CCSLight)
|
||||
IMPLEMENT_SAVERESTORE(CLight, CPointEntity)
|
||||
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
virtual int Restore(CRestore &restore);
|
||||
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
|
||||
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[2];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
private:
|
||||
int m_iStyle;
|
||||
|
@ -1,32 +1,10 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
/*
|
||||
* Globals initialization
|
||||
*/
|
||||
#ifndef HOOK_GAMEDLL
|
||||
|
||||
TYPEDESCRIPTION CRuleEntity::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CRuleEntity, m_iszMaster, FIELD_STRING),
|
||||
};
|
||||
|
||||
// Save parms as a block. Will break save/restore if the structure changes, but this entity didn't ship with Half-Life, so
|
||||
// it can't impact saved Half-Life games.
|
||||
TYPEDESCRIPTION CGameText::m_SaveData[] =
|
||||
{
|
||||
DEFINE_ARRAY(CGameText, m_textParms, FIELD_CHARACTER, sizeof(hudtextparms_t)),
|
||||
};
|
||||
|
||||
TYPEDESCRIPTION CGamePlayerZone::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CGamePlayerZone, m_iszInTarget, FIELD_STRING),
|
||||
DEFINE_FIELD(CGamePlayerZone, m_iszOutTarget, FIELD_STRING),
|
||||
DEFINE_FIELD(CGamePlayerZone, m_iszInCount, FIELD_STRING),
|
||||
DEFINE_FIELD(CGamePlayerZone, m_iszOutCount, FIELD_STRING),
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
IMPLEMENT_SAVERESTORE(CRuleEntity, CBaseEntity)
|
||||
|
||||
void CRuleEntity::Spawn()
|
||||
@ -121,6 +99,13 @@ void CGameEnd::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTy
|
||||
g_pGameRules->EndMultiplayerGame();
|
||||
}
|
||||
|
||||
// Save parms as a block. Will break save/restore if the structure changes, but this entity didn't ship with Half-Life, so
|
||||
// it can't impact saved Half-Life games.
|
||||
TYPEDESCRIPTION CGameText::m_SaveData[] =
|
||||
{
|
||||
DEFINE_ARRAY(CGameText, m_textParms, FIELD_CHARACTER, sizeof(hudtextparms_t)),
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS(game_text, CGameText, CCSGameText)
|
||||
IMPLEMENT_SAVERESTORE(CGameText, CRulePointEntity)
|
||||
|
||||
@ -362,6 +347,14 @@ void CGameTeamSet::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u
|
||||
}
|
||||
}
|
||||
|
||||
TYPEDESCRIPTION CGamePlayerZone::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD(CGamePlayerZone, m_iszInTarget, FIELD_STRING),
|
||||
DEFINE_FIELD(CGamePlayerZone, m_iszOutTarget, FIELD_STRING),
|
||||
DEFINE_FIELD(CGamePlayerZone, m_iszInCount, FIELD_STRING),
|
||||
DEFINE_FIELD(CGamePlayerZone, m_iszOutCount, FIELD_STRING),
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS(game_zone_player, CGamePlayerZone, CCSGamePlayerZone)
|
||||
IMPLEMENT_SAVERESTORE(CGamePlayerZone, CRuleBrushEntity)
|
||||
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
virtual int Restore(CRestore &restore);
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[1];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
void SetMaster(string_t iszMaster) { m_iszMaster = iszMaster; }
|
||||
|
||||
@ -107,7 +107,7 @@ public:
|
||||
const char *MessageGet() const { return STRING(pev->message); }
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[1];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
private:
|
||||
hudtextparms_t m_textParms;
|
||||
@ -168,7 +168,7 @@ public:
|
||||
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
|
||||
|
||||
public:
|
||||
static TYPEDESCRIPTION IMPL(m_SaveData)[4];
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
bool HasOnlyAlive() const { return (pev->spawnflags & SF_GAME_PZONE_ONLY_ALIVE) == SF_GAME_PZONE_ONLY_ALIVE; }
|
||||
|
||||
private:
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user