Reverse Hostages cs 1.6, SV_StudioSetupBones

Added project build mp.dll/cs.so
work final the reverse-engineering for CS 1.6
This commit is contained in:
s1lentq 2015-12-06 01:40:30 +06:00
parent dc557b37f2
commit 48ec89893a
120 changed files with 5984 additions and 4073 deletions

View File

@ -8,38 +8,36 @@ group = 'regamedll'
apply plugin: 'idea'
idea {
project {
languageLevel = 'JDK_1_7'
}
project {
languageLevel = 'JDK_1_7'
}
}
def gitInfo = GitVersioner.versionForDir(project.rootDir)
if (!gitInfo) {
throw new RuntimeException('Running outside git repository')
throw new RuntimeException('Running outside git repository')
}
RegamedllVersionInfo versionInfo
if (gitInfo.tag && gitInfo.tag[0] == 'v') {
def m = gitInfo.tag =~ /^v(\d+)\.(\d+)(\.(\d+))?$/
if (!m.find()) {
throw new RuntimeException("Invalid git version tag name ${gitInfo.tag}")
}
def m = gitInfo.tag =~ /^v(\d+)\.(\d+)(\.(\d+))?$/
if (!m.find()) {
throw new RuntimeException("Invalid git version tag name ${gitInfo.tag}")
}
versionInfo = new RegamedllVersionInfo(
majorVersion: m.group(1) as int,
minorVersion: m.group(2) as int,
maintenanceVersion: m.group(4) ? (m.group(4) as int) : null,
lastCommitDate: gitInfo.lastCommitDate
)
versionInfo = new RegamedllVersionInfo(
majorVersion: m.group(1) as int,
minorVersion: m.group(2) as int,
maintenanceVersion: m.group(4) ? (m.group(4) as int) : null,
lastCommitDate: gitInfo.lastCommitDate
)
} else {
versionInfo = new RegamedllVersionInfo(
majorVersion: project.majorVersion as int,
minorVersion: project.minorVersion as int,
suffix: 'SNAPSHOT',
lastCommitDate: gitInfo.lastCommitDate
)
versionInfo = new RegamedllVersionInfo(
majorVersion: project.majorVersion as int,
minorVersion: project.minorVersion as int,
suffix: 'SNAPSHOT',
lastCommitDate: gitInfo.lastCommitDate
)
}
project.ext.regamedllVersionInfo = versionInfo
@ -48,5 +46,5 @@ project.version = versionInfo.asMavenVersion()
apply from: 'publish.gradle'
task wrapper(type: Wrapper) {
gradleVersion = '2.4'
gradleVersion = '2.4'
}

View File

@ -1,6 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.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>
@ -22,6 +30,18 @@
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MP|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MP Play|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
@ -35,6 +55,12 @@
<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)'=='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>
@ -55,6 +81,36 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug MP|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..\include\</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeaderFile>bzlib_private.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug MP Play|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..\include\</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeaderFile>bzlib_private.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
@ -86,6 +142,8 @@
<ClCompile Include="..\src\huffman.c" />
<ClCompile Include="..\src\precompiled.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug MP|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug MP Play|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\src\randtable.c" />

View File

@ -1,6 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.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>
@ -38,6 +46,18 @@
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MP|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug MP Play|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Nav|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
@ -57,6 +77,12 @@
<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)'=='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>
@ -78,6 +104,38 @@
<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)'=='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>

View File

@ -23,6 +23,8 @@ 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 Play|Win32 = Release Play|Win32
@ -30,6 +32,10 @@ Global
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
@ -40,6 +46,10 @@ Global
{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
@ -50,6 +60,10 @@ Global
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Release|Win32.Build.0 = Release|Win32
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Tests|Win32.ActiveCfg = Debug|Win32
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Tests|Win32.Build.0 = Debug|Win32
{792DF067-9904-4579-99B9-46C17277ADE3}.Debug MP Play|Win32.ActiveCfg = Debug MP Play|Win32
{792DF067-9904-4579-99B9-46C17277ADE3}.Debug MP Play|Win32.Build.0 = Debug MP Play|Win32
{792DF067-9904-4579-99B9-46C17277ADE3}.Debug MP|Win32.ActiveCfg = Debug MP|Win32
{792DF067-9904-4579-99B9-46C17277ADE3}.Debug MP|Win32.Build.0 = Debug MP|Win32
{792DF067-9904-4579-99B9-46C17277ADE3}.Debug Play|Win32.ActiveCfg = Debug|Win32
{792DF067-9904-4579-99B9-46C17277ADE3}.Debug Play|Win32.Build.0 = Debug|Win32
{792DF067-9904-4579-99B9-46C17277ADE3}.Debug|Win32.ActiveCfg = Debug|Win32

View File

@ -2,139 +2,139 @@ import org.doomedsociety.gradlecpp.GradleCppUtils
import org.apache.commons.io.FilenameUtils
void _copyFileToDir(String from, String to) {
def dst = new File(project.file(to), FilenameUtils.getName(from))
GradleCppUtils.copyFile(project.file(from), dst, false)
def dst = new File(project.file(to), FilenameUtils.getName(from))
GradleCppUtils.copyFile(project.file(from), dst, false)
}
void _copyFile(String from, String to) {
GradleCppUtils.copyFile(project.file(from), project.file(to), false)
GradleCppUtils.copyFile(project.file(from), project.file(to), false)
}
task publishPrepareFiles {
//dependsOn ':flightrec/decoder:uberjar'
doLast {
def pubRootDir = project.file('publish/publishRoot')
if (pubRootDir.exists()) {
if (!pubRootDir.deleteDir()) {
throw new RuntimeException("Failed to delete ${pubRootDir}")
}
}
//dependsOn ':flightrec/decoder:uberjar'
doLast {
def pubRootDir = project.file('publish/publishRoot')
if (pubRootDir.exists()) {
if (!pubRootDir.deleteDir()) {
throw new RuntimeException("Failed to delete ${pubRootDir}")
}
}
pubRootDir.mkdirs()
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')
// 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
//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')
//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
//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')
//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')
//hlsdk
//project.file('publish/publishRoot/hlsdk').mkdirs()
//copy {
// from 'regamedll/common'
// into 'publish/publishRoot/hlsdk/common'
//}
//copy {
// from 'regamedll/dlls'
// into 'publish/publishRoot/hlsdk/dlls'
//}
//copy {
// from 'regamedll/pm_shared'
// into 'publish/publishRoot/hlsdk/pm_shared'
//}
//copy {
// from 'regamedll/public'
// into 'publish/publishRoot/hlsdk/public'
// include 'interface.h', 'interface.cpp', 'FileSystem.h'
//}
//hlsdk
//project.file('publish/publishRoot/hlsdk').mkdirs()
//copy {
// from 'regamedll/common'
// into 'publish/publishRoot/hlsdk/common'
//}
//copy {
// from 'regamedll/dlls'
// into 'publish/publishRoot/hlsdk/dlls'
//}
//copy {
// from 'regamedll/pm_shared'
// into 'publish/publishRoot/hlsdk/pm_shared'
//}
//copy {
// from 'regamedll/public'
// into 'publish/publishRoot/hlsdk/public'
// include 'interface.h', 'interface.cpp', 'FileSystem.h'
//}
}
}
}
task publishPackage(type: Zip, dependsOn: 'publishPrepareFiles') {
baseName = "regamedll-dist-${project.version}"
destinationDir file('publish')
from 'publish/publishRoot'
baseName = "regamedll-dist-${project.version}"
destinationDir file('publish')
from 'publish/publishRoot'
}
publishing {
publications {
maven(MavenPublication) {
version project.version
artifact publishPackage
publications {
maven(MavenPublication) {
version project.version
artifact publishPackage
pom.withXml {
asNode().children().last() + {
resolveStrategy = DELEGATE_FIRST
name project.name
description project.description
//url github
//scm {
// url "${github}.git"
// connection "scm:git:${github}.git"
//}
/*
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'dreamstalker'
name 'dreamstalker'
}
}
*/
}
}
}
}
pom.withXml {
asNode().children().last() + {
resolveStrategy = DELEGATE_FIRST
name project.name
description project.description
//url github
//scm {
// url "${github}.git"
// connection "scm:git:${github}.git"
//}
/*
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'dreamstalker'
name 'dreamstalker'
}
}
*/
}
}
}
}
}
Properties repoCreds = new Properties()
project.ext.repoCreds = repoCreds
if (file('repo_creds.properties').exists()) {
println 'Loading maven repo credentials'
file('repo_creds.properties').withReader('UTF-8', { Reader r ->
repoCreds.load(r)
})
println 'Loading maven repo credentials'
file('repo_creds.properties').withReader('UTF-8', { Reader r ->
repoCreds.load(r)
})
}
publishing {
repositories {
maven {
if (project.version.contains('SNAPSHOT')) {
url "http://nexus.rehlds.org/nexus/content/repositories/regamedll-snapshots/"
} else {
url "http://nexus.rehlds.org/nexus/content/repositories/regamedll-releases/"
}
credentials {
username repoCreds.getProperty('username')
password repoCreds.getProperty('password')
}
}
}
repositories {
maven {
if (project.version.contains('SNAPSHOT')) {
url "http://nexus.rehlds.org/nexus/content/repositories/regamedll-snapshots/"
} else {
url "http://nexus.rehlds.org/nexus/content/repositories/regamedll-releases/"
}
credentials {
username repoCreds.getProperty('username')
password repoCreds.getProperty('password')
}
}
}
}
task doPublish {
dependsOn 'publishPackage'
if (repoCreds.getProperty('username') && repoCreds.getProperty('password')) {
dependsOn 'publish'
//dependsOn ':flightrec/decoder_api:publish'
}
dependsOn 'publishPackage'
if (repoCreds.getProperty('username') && repoCreds.getProperty('password')) {
dependsOn 'publish'
//dependsOn ':flightrec/decoder_api:publish'
}
}

View File

@ -33,16 +33,16 @@ repositories {
}
configurations {
regamedll_tests
regamedll_tests
}
dependencies {
regamedll_tests 'regamedll.testdemos:cstrike-fulltests-2:2.0'
regamedll_tests 'regamedll.testdemos:czero-ladder_hard:2.0'
//regamedll_tests 'regamedll.testdemos:cstrike-multiplayer-2:2.0'
//regamedll_tests 'regamedll.testdemos:cstrike-hostage-2:2.0'
//regamedll_tests 'regamedll.testdemos:cstrike-weapon-1:1.0'
regamedll_tests 'regamedll.testdemos:czero-czbot_game-2:2.0'
//regamedll_tests 'regamedll.testdemos:cstrike-fulltests-2:2.0'
//regamedll_tests 'regamedll.testdemos:czero-ladder_hard:2.0'
//regamedll_tests 'regamedll.testdemos:cstrike-multiplayer-2:2.0'
//regamedll_tests 'regamedll.testdemos:cstrike-hostage-2:2.0'
//regamedll_tests 'regamedll.testdemos:cstrike-weapon-1:1.0'
//regamedll_tests 'regamedll.testdemos:czero-czbot_game-2:2.0'
}
@ -50,313 +50,335 @@ project.ext.dep_bzip2 = project(':dep/bzip2')
project.ext.dep_cppunitlite = project(':dep/cppunitlite')
void createIntergrationTestTask(NativeBinarySpec b) {
boolean regamedllFixes = b.flavor.name.contains('regamedllFixes')
boolean regamedllFixes = b.flavor.name.contains('regamedllFixes')
if (!(b instanceof SharedLibraryBinarySpec)) return
if (!GradleCppUtils.windows) return
if (regamedllFixes) return
if (!(b instanceof SharedLibraryBinarySpec)) return
if (!GradleCppUtils.windows) return
if (regamedllFixes) return
def libLinkTask = GradleCppUtils.getLinkTask(b)
String unitTestTask = b.hasProperty('cppUnitTestTask') ? b.cppUnitTestTask : null
def libLinkTask = GradleCppUtils.getLinkTask(b)
String unitTestTask = b.hasProperty('cppUnitTestTask') ? b.cppUnitTestTask : null
def depFiles = []
depFiles.addAll(libLinkTask.outputs.files.files)
def depFiles = []
depFiles.addAll(libLinkTask.outputs.files.files)
def demoItgTestTask = project.tasks.create(b.namingScheme.getTaskName('demoItgTest'), RegamedllPlayTestTask)
demoItgTestTask.with {
regamedllImageRoot = new File(project.projectDir, '_regamedllTestImg')
regamedllTestLogs = new File(this.project.buildDir, "_regamedllTestLogs/${b.name}")
testDemos = project.configurations.regamedll_tests
testFor = b
def demoItgTestTask = project.tasks.create(b.namingScheme.getTaskName('demoItgTest'), RegamedllPlayTestTask)
demoItgTestTask.with {
regamedllImageRoot = new File(project.projectDir, '_regamedllTestImg')
regamedllTestLogs = new File(this.project.buildDir, "_regamedllTestLogs/${b.name}")
testDemos = project.configurations.regamedll_tests
testFor = b
//inputs/outputs for up-to-date check
inputs.files depFiles
inputs.files testDemos.files
outputs.dir regamedllTestLogs
//inputs/outputs for up-to-date check
inputs.files depFiles
inputs.files testDemos.files
outputs.dir regamedllTestLogs
//dependencies on library and test executable
dependsOn libLinkTask
if (unitTestTask) {
dependsOn unitTestTask
}
//dependencies on library and test executable
dependsOn libLinkTask
if (unitTestTask) {
dependsOn unitTestTask
}
postExtractAction {
def binaryOutFile = GradleCppUtils.getBinaryOutputFile(b)
GradleCppUtils.copyFile(binaryOutFile, new File(regamedllImageRoot, binaryOutFile.name), true)
}
}
postExtractAction {
def binaryOutFile = GradleCppUtils.getBinaryOutputFile(b)
GradleCppUtils.copyFile(binaryOutFile, new File(regamedllImageRoot, binaryOutFile.name), true)
}
}
b.buildTask.dependsOn demoItgTestTask
b.buildTask.dependsOn demoItgTestTask
}
void setupUnitTests(NativeBinarySpec bin) {
boolean unitTestExecutable = bin.component.name.endsWith('_tests')
if (!unitTestExecutable) return
boolean unitTestExecutable = bin.component.name.endsWith('_tests')
if (!unitTestExecutable) return
GradleCppUtils.getLinkTask(bin).doLast {
String srcPath = '' + projectDir + (GradleCppUtils.windows ? '/lib/steam_api.dll' : '/lib/linux32/libsteam_api.so')
String dstPath = bin.executableFile.parent + (GradleCppUtils.windows ? '/steam_api.dll' : '/libsteam_api.so')
GradleCppUtils.copyFile(srcPath, dstPath, true)
}
GradleCppUtils.getLinkTask(bin).doLast {
String srcPath = '' + projectDir + (GradleCppUtils.windows ? '/lib/steam_api.dll' : '/lib/linux32/libsteam_api.so')
String dstPath = bin.executableFile.parent + (GradleCppUtils.windows ? '/steam_api.dll' : '/libsteam_api.so')
GradleCppUtils.copyFile(srcPath, dstPath, true)
}
}
void postEvaluate(NativeBinarySpec b) {
// attach generateAppVersion task to all 'compile source' tasks
GradleCppUtils.getCompileTasks(b).each { Task t ->
t.dependsOn project.generateAppVersion
}
// attach generateAppVersion task to all 'compile source' tasks
GradleCppUtils.getCompileTasks(b).each { Task t ->
t.dependsOn project.generateAppVersion
}
setupUnitTests(b)
createIntergrationTestTask(b)
setupUnitTests(b)
createIntergrationTestTask(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')
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', '/testsuite', '/hookers', '/public', '/public/regamedll')
ToolchainConfig cfg = rootProject.createToolchainConfig(b)
cfg.projectInclude(dep_bzip2, '/include')
cfg.projectInclude(project, '', '/engine', '/common', '/dlls', '/game_shared', '/pm_shared', '/regamedll', '/testsuite', '/hookers', '/public', '/public/regamedll')
cfg.projectInclude(dep_bzip2, '/include')
if (unitTestExecutable) {
cfg.projectInclude(dep_cppunitlite, '/include')
b.lib LazyNativeDepSet.create(dep_cppunitlite, 'cppunitlite', b.buildType.name, true)
}
b.lib LazyNativeDepSet.create(dep_bzip2, 'bzip2', b.buildType.name, true)
if (unitTestExecutable)
{
cfg.projectInclude(dep_cppunitlite, '/include')
b.lib LazyNativeDepSet.create(dep_cppunitlite, 'cppunitlite', b.buildType.name, true)
}
b.lib LazyNativeDepSet.create(dep_bzip2, 'bzip2', b.buildType.name, true)
cfg.singleDefines 'USE_BREAKPAD_HANDLER', 'DEDICATED', 'REGAMEDLL_SELF', 'HOOK_GAMEDLL', 'CLIENT_WEAPONS'
cfg.singleDefines 'USE_BREAKPAD_HANDLER', 'DEDICATED', 'REGAMEDLL_SELF', 'CLIENT_WEAPONS'
if (cfg instanceof MsvcToolchainConfig) {
if (cfg instanceof MsvcToolchainConfig)
{
cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig(
enabled: true,
pchHeader: 'precompiled.h',
pchSourceSet: 'regamedll_pch'
);
cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig(
enabled: true,
pchHeader: 'precompiled.h',
pchSourceSet: 'regamedll_pch'
)
cfg.singleDefines('_CRT_SECURE_NO_WARNINGS')
if (!regamedllFixes) {
cfg.compilerOptions.floatingPointModel = FloatingPointModel.PRECISE
cfg.compilerOptions.enhancedInstructionsSet = EnhancedInstructionsSet.DISABLED
}
if (mpLib) {
cfg.linkerOptions.randomizedBaseAddress = false
cfg.linkerOptions.baseAddress = '0x4970000'
}
cfg.projectLibpath(project, '/lib')
cfg.extraLibs 'steam_api.lib', 'psapi.lib', 'ws2_32.lib', 'kernel32.lib', 'user32.lib', 'advapi32.lib'
} else if (cfg instanceof GccToolchainConfig) {
cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions(
enabled: true,
pchSourceSet: 'regamedll_pch'
)
cfg.compilerOptions.languageStandard = 'c++0x'
cfg.defines([
'_stricmp': 'strcasecmp',
'_strnicmp': 'strncasecmp',
'_strdup': 'strdup',
'_unlink': 'unlink',
'_vsnprintf': 'vsnprintf',
'_write' : 'write',
'_close' : 'close',
])
cfg.singleDefines('_CRT_SECURE_NO_WARNINGS')
if (!regamedllFixes)
{
cfg.compilerOptions.floatingPointModel = FloatingPointModel.PRECISE
cfg.compilerOptions.enhancedInstructionsSet = EnhancedInstructionsSet.DISABLED
}
cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp', '-g'
cfg.projectLibpath(project, '/lib/linux32')
cfg.extraLibs 'dl', 'm', 'stdc++', 'steam_api'
}
if (mpLib)
{
cfg.linkerOptions.randomizedBaseAddress = false
cfg.linkerOptions.baseAddress = '0x4970000'
}
if (unitTestExecutable) {
cfg.singleDefines 'REGAMEDLL_UNIT_TESTS'
}
cfg.projectLibpath(project, '/lib')
cfg.extraLibs 'steam_api.lib', 'psapi.lib', 'ws2_32.lib', 'kernel32.lib', 'user32.lib', 'advapi32.lib'
}
else if (cfg instanceof GccToolchainConfig) {
cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions(
enabled: true,
pchSourceSet: 'regamedll_pch'
);
if (regamedllFixes) {
cfg.singleDefines 'REGAMEDLL_FIXES', 'REGAMEDLL_CHECKS'
}
cfg.compilerOptions.languageStandard = 'c++0x'
cfg.defines([
'_stricmp': 'strcasecmp',
'_strnicmp': 'strncasecmp',
'_strdup': 'strdup',
'_unlink': 'unlink',
'_vsnprintf': 'vsnprintf',
'_write' : 'write',
'_close' : 'close',
])
ToolchainConfigUtils.apply(project, cfg, b)
cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp', '-g'
cfg.projectLibpath(project, '/lib/linux32')
cfg.extraLibs 'dl', 'm', 'stdc++', 'steam_api'
}
GradleCppUtils.onTasksCreated(project, 'postEvaluate', {
postEvaluate(b)
})
if (mpLib && GradleCppUtils.windows && !unitTestExecutable) {
cfg.linkerOptions.definitionFile = "${projectDir}\\msvc\\mp.def";
}
if (!unitTestExecutable && !mpLib)
{
cfg.singleDefines 'HOOK_GAMEDLL'
}
if (unitTestExecutable)
{
cfg.singleDefines 'REGAMEDLL_UNIT_TESTS'
}
if (regamedllFixes)
{
cfg.singleDefines 'REGAMEDLL_FIXES', 'REGAMEDLL_CHECKS'
}
ToolchainConfigUtils.apply(project, cfg, b)
GradleCppUtils.onTasksCreated(project, 'postEvaluate', {
postEvaluate(b)
})
}
class RegamedllSrc {
static void regamedll_src(def h) {
h.regamedll_src(CppSourceSet) {
static void regamedll_src(def h) {
h.regamedll_src(CppSourceSet) {
source {
srcDirs "engine", "dlls", "game_shared", "pm_shared", "regamedll", "public", "version"
if (GradleCppUtils.windows) {
srcDirs "testsuite"
source {
srcDirs "engine", "dlls", "game_shared", "pm_shared", "regamedll", "public", "version"
if (GradleCppUtils.windows) {
srcDirs "testsuite"
}
include "**/*.cpp"
exclude "precompiled.cpp"
if (GradleCppUtils.windows) {
exclude "tier0/platform_linux.cpp"
} else {
exclude "tier0/platform_win32.cpp"
}
//exclude "interface.cpp"
}
source {
srcDirs "hookers"
include "**/*.cpp"
exclude "6153_hooker.cpp", "hooker.cpp", "main.cpp", "main_mp.cpp"
// if (!GradleCppUtils.windows)
// exclude "regamedll_debug.cpp"
}
}
}
include "**/*.cpp"
exclude "precompiled.cpp"
static void regamedll_pch(def h) {
h.regamedll_pch(CppSourceSet) {
source {
srcDirs "regamedll"
include "precompiled.cpp"
}
}
}
if (GradleCppUtils.windows) {
exclude "tier0/platform_linux.cpp"
} else {
exclude "tier0/platform_win32.cpp"
}
static void regamedll_hooker_src(def h) {
h.regamedll_hooker_src(CppSourceSet) {
source {
srcDirs "hookers"
include "6153_hooker.cpp", "hooker.cpp"
}
}
}
//exclude "interface.cpp"
}
static void regamedll_hooker_main_src(def h) {
h.regamedll_hooker_main_src(CppSourceSet) {
source {
srcDirs "hookers"
include "main.cpp"
}
}
}
source {
srcDirs "hookers"
include "**/*.cpp"
exclude "6153_hooker.cpp", "hooker.cpp", "main.cpp", "main_mp.cpp"
// if (!GradleCppUtils.windows)
// exclude "regamedll_debug.cpp"
}
}
}
static void regamedll_mp_main_src(def h) {
h.regamedll_mp_main_src(CppSourceSet) {
source {
srcDirs "hookers"
include "main_mp.cpp"
exclude "memory.cpp"
}
}
}
static void regamedll_pch(def h) {
h.regamedll_pch(CppSourceSet) {
source {
srcDirs "regamedll"
include "precompiled.cpp"
}
}
}
static void regamedll_hooker_src(def h) {
h.regamedll_hooker_src(CppSourceSet) {
source {
srcDirs "hookers"
include "6153_hooker.cpp", "hooker.cpp"
}
}
}
static void regamedll_hooker_main_src(def h) {
h.regamedll_hooker_main_src(CppSourceSet) {
source {
srcDirs "hookers"
include "main.cpp"
}
}
}
static void regamedll_mp_main_src(def h) {
h.regamedll_mp_main_src(CppSourceSet) {
source {
srcDirs "hookers"
include "main_mp.cpp"
}
}
}
static void regamedll_tests_src(def h) {
h.regamedll_tests_src(CppSourceSet) {
source {
srcDir "unittests"
include "**/*.cpp"
}
}
}
static void regamedll_tests_src(def h) {
h.regamedll_tests_src(CppSourceSet) {
source {
srcDir "unittests"
include "**/*.cpp"
}
}
}
}
model {
buildTypes {
debug
release
}
buildTypes {
debug
release
}
platforms {
x86 {
architecture "x86"
}
}
platforms {
x86 {
architecture "x86"
}
}
toolChains {
visualCpp(VisualCpp) {
}
icc(Icc) {
}
}
toolChains {
visualCpp(VisualCpp) {
}
icc(Icc) {
}
}
flavors {
regamedllNofixes
regamedllFixes
}
flavors {
regamedllNofixes
regamedllFixes
}
components {
regamedll_hooker_gamedll(NativeLibrarySpec) {
targetPlatform 'x86'
baseName 'filesystem_stdio'
components {
regamedll_hooker_gamedll(NativeLibrarySpec) {
targetPlatform 'x86'
baseName 'filesystem_stdio'
sources {
RegamedllSrc.regamedll_pch(it)
RegamedllSrc.regamedll_src(it)
RegamedllSrc.regamedll_hooker_src(it)
RegamedllSrc.regamedll_hooker_main_src(it)
}
sources {
RegamedllSrc.regamedll_pch(it)
RegamedllSrc.regamedll_src(it)
RegamedllSrc.regamedll_hooker_src(it)
RegamedllSrc.regamedll_hooker_main_src(it)
}
binaries.all { NativeBinarySpec b -> project.setupToolchain(b) }
}
binaries.all { NativeBinarySpec b -> project.setupToolchain(b) }
}
//regamedll_mp_gamedll(NativeLibrarySpec) {
// targetPlatform 'x86'
// baseName GradleCppUtils.windows ? 'mp' : 'cs'
// sources {
// RegamedllSrc.regamedll_pch(it)
// RegamedllSrc.regamedll_src(it)
// RegamedllSrc.regamedll_mp_main_src(it)
// }
// binaries.all { NativeBinarySpec b -> project.setupToolchain(b) }
//}
regamedll_mp_gamedll(NativeLibrarySpec) {
targetPlatform 'x86'
baseName GradleCppUtils.windows ? 'mp' : 'cs'
sources {
RegamedllSrc.regamedll_pch(it)
RegamedllSrc.regamedll_src(it)
RegamedllSrc.regamedll_mp_main_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)
}
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) }
}
binaries.all { NativeBinarySpec b -> project.setupToolchain(b) }
}
//regamedll_mp_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 {
RegamedllSrc.regamedll_pch(it)
RegamedllSrc.regamedll_src(it)
RegamedllSrc.regamedll_tests_src(it)
}
binaries.all { NativeBinarySpec b -> project.setupToolchain(b) }
}
}
}
task buildRelease {
dependsOn binaries.withType(SharedLibraryBinarySpec).matching { SharedLibraryBinarySpec blib ->
blib.buildable && (blib.buildType.name == 'release' /*|| blib.buildType.name == 'debug'*/) && !blib.name.contains('RegamedllFixes')
}
dependsOn binaries.withType(SharedLibraryBinarySpec).matching { SharedLibraryBinarySpec blib ->
blib.buildable && blib.buildType.name == 'release' && !blib.name.contains('Regamedll_hooker_gamedll')
}
}
task prepareDevEnvTests {
def regamedllTests = new File(project.projectDir, '_dev/testDemos')
def regamedllTests = new File(project.projectDir, '_dev/testDemos')
inputs.files configurations.regamedll_tests.files
outputs.dir regamedllTests
inputs.files configurations.regamedll_tests.files
outputs.dir regamedllTests
doLast {
regamedllTests.mkdirs()
configurations.regamedll_tests.files.each { File f ->
def t = zipTree(f)
copy {
into new File(regamedllTests, FilenameUtils.getBaseName(f.absolutePath))
from t
}
}
}
doLast {
regamedllTests.mkdirs()
configurations.regamedll_tests.files.each { File f ->
def t = zipTree(f)
copy {
into new File(regamedllTests, FilenameUtils.getBaseName(f.absolutePath))
from t
}
}
}
}
task prepareDevEnvGamedll << {
@ -370,31 +392,30 @@ task prepareDevEnvGamedll << {
}
task prepareDevEnv {
dependsOn prepareDevEnvGamedll, prepareDevEnvTests
dependsOn prepareDevEnvGamedll, prepareDevEnvTests
}
tasks.clean.doLast {
project.file('version/appversion.h').delete()
project.file('version/appversion.h').delete()
}
task generateAppVersion {
RegamedllVersionInfo verInfo = (RegamedllVersionInfo) rootProject.regamedllVersionInfo
def tplFile = project.file('version/appversion.vm')
def renderedFile = project.file('version/appversion.h')
inputs.file tplFile
inputs.file project.file('gradle.properties')
outputs.file renderedFile
inputs.property('version', verInfo.asMavenVersion())
inputs.property('lastCommitDate', verInfo.lastCommitDate.toString())
doLast {
def templateCtx = [
verInfo: verInfo
]
def content = VelocityUtils.renderTemplate(tplFile, templateCtx)
renderedFile.delete()

View File

@ -44,7 +44,7 @@ public:
virtual void Killed(entvars_t *pevAttacker, int iGib);
virtual int BloodColor(void)
{
return BloodColor_();
return DONT_BLEED;
}
public:
void EXPORT TankThink(void);
@ -59,7 +59,7 @@ public:
void Killed_(entvars_t *pevAttacker, int iGib);
int BloodColor_(void)
{
return DONT_BLEED;
return BloodColor();
}
#endif // HOOK_GAMEDLL

View File

@ -211,16 +211,21 @@ public:
#endif // HOOK_GAMEDLL
};/* size: 152, cachelines: 3, members: 1 */
C_DLLEXPORT void ammo_9mm(entvars_t *pev); // C9MMAmmo
C_DLLEXPORT void ammo_buckshot(entvars_t *pev); // CBuckShotAmmo
C_DLLEXPORT void ammo_556nato(entvars_t *pev); // C556NatoAmmo
C_DLLEXPORT void ammo_556natobox(entvars_t *pev); // C556NatoBoxAmmo
C_DLLEXPORT void ammo_762nato(entvars_t *pev); // C762NatoAmmo
C_DLLEXPORT void ammo_45acp(entvars_t *pev); // C45ACPAmmo
C_DLLEXPORT void ammo_50ae(entvars_t *pev); // C50AEAmmo
C_DLLEXPORT void ammo_338magnum(entvars_t *pev); // C338MagnumAmmo
C_DLLEXPORT void ammo_57mm(entvars_t *pev); // C57MMAmmo
C_DLLEXPORT void ammo_357sig(entvars_t *pev); // C357SIGAmmo
#ifdef HOOK_GAMEDLL
// linked objects
C_DLLEXPORT void ammo_9mm(entvars_t *pev);
C_DLLEXPORT void ammo_buckshot(entvars_t *pev);
C_DLLEXPORT void ammo_556nato(entvars_t *pev);
C_DLLEXPORT void ammo_556natobox(entvars_t *pev);
C_DLLEXPORT void ammo_762nato(entvars_t *pev);
C_DLLEXPORT void ammo_45acp(entvars_t *pev);
C_DLLEXPORT void ammo_50ae(entvars_t *pev);
C_DLLEXPORT void ammo_338magnum(entvars_t *pev);
C_DLLEXPORT void ammo_57mm(entvars_t *pev);
C_DLLEXPORT void ammo_357sig(entvars_t *pev);
#endif // HOOK_GAMEDLL
#endif // AMMO_H

View File

@ -692,25 +692,20 @@ void QuaternionSlerp(vec_t *p, vec_t *q, float t, vec_t *qt)
}
}
void (*pQuaternionMatrix)(vec_t *quaternion, float matrix[3][4]);
/* <15cd0> ../cstrike/dlls/animation.cpp:700 */
NOBODY void __declspec(naked) QuaternionMatrix(vec_t *quaternion, float matrix[3][4])
void QuaternionMatrix(vec_t *quaternion, float (*matrix)[4])
{
UNTESTED
__asm
{
jmp pQuaternionMatrix
}
//matrix[0][0] = 1.0 - 2.0 * quaternion[1] * quaternion[1] - 2.0 * quaternion[2] * quaternion[2];
//matrix[1][1] = 2.0 * quaternion[2] * quaternion[3] + quaternion[0] * quaternion[1];
//matrix[2][2] = 2.0 * quaternion[2] * quaternion[0] - 2.0 * quaternion[3] * quaternion[1];
//matrix[0][1] = 2.0 * quaternion[0] * quaternion[1] - 2.0 * quaternion[2] * quaternion[3];
//matrix[1][2] = 1.0 - 2.0 * quaternion[0] * quaternion[0] - 2.0 * quaternion[2] * quaternion[2];
//matrix[3][0] = 2.0 * quaternion[2] * quaternion[1] + quaternion[0] * quaternion[3];
//matrix[0][2] = 2.0 * quaternion[2] * quaternion[0] + quaternion[3] * quaternion[1];
//matrix[2][0] = 2.0 * quaternion[2] * quaternion[1] - 2.0 * quaternion[0] * quaternion[3];
matrix[0][0] = 1.0 - 2.0 * quaternion[1] * quaternion[1] - 2.0 * quaternion[2] * quaternion[2];
matrix[1][0] = 2.0 * quaternion[0] * quaternion[1] + 2.0 * quaternion[3] * quaternion[2];
matrix[2][0] = 2.0 * quaternion[0] * quaternion[2] - 2.0 * quaternion[3] * quaternion[1];
matrix[0][1] = 2.0 * quaternion[0] * quaternion[1] - 2.0 * quaternion[3] * quaternion[2];
matrix[1][1] = 1.0 - 2.0 * quaternion[0] * quaternion[0] - 2.0 * quaternion[2] * quaternion[2];
matrix[2][1] = 2.0 * quaternion[1] * quaternion[2] + 2.0 * quaternion[3] * quaternion[0];
matrix[0][2] = 2.0 * quaternion[0] * quaternion[2] + 2.0 * quaternion[3] * quaternion[1];
matrix[1][2] = 2.0 * quaternion[1] * quaternion[2] - 2.0 * quaternion[3] * quaternion[0];
matrix[2][2] = 1.0 - 2.0 * quaternion[0] * quaternion[0] - 2.0 * quaternion[1] * quaternion[1];
}
/* <15d12> ../cstrike/dlls/animation.cpp:715 */
@ -743,11 +738,11 @@ mstudioanim_t *StudioGetAnim(model_t *m_pSubModel, mstudioseqdesc_t *pseqdesc)
}
/* <15d90> ../cstrike/dlls/animation.cpp:749 */
NOXREF mstudioanim_t *LookupAnimation(studiohdr_t *pstudiohdr, model_s *model, mstudioseqdesc_t *pseqdesc, int index)
mstudioanim_t *LookupAnimation(model_t *model, mstudioseqdesc_t *pseqdesc, int index)
{
mstudioanim_t *panim = StudioGetAnim(model, pseqdesc);
if (index >= 0 && index <= (pseqdesc->numblends - 1))
panim += index * pstudiohdr->numbones;
panim += index * g_pstudiohdr->numbones;
return panim;
}
@ -774,11 +769,11 @@ void StudioCalcBoneAdj(float dadt, float *adj, const byte *pcontroller1, const b
int a, b;
a = (pcontroller1[j] + 128) % 256;
b = (pcontroller2[j] + 128) % 256;
value = ((a * dadt) + (b * (1 - dadt)) - 128) * (360.0/256.0) + pbonecontroller[j].start;
value = ((a * dadt) + (b * (1 - dadt)) - 128) * (360.0 / 256.0) + pbonecontroller[j].start;
}
else
{
value = ((pcontroller1[i] * dadt + (pcontroller2[i]) * (1.0 - dadt))) * (360.0/256.0) + pbonecontroller[j].start;
value = ((pcontroller1[i] * dadt + (pcontroller2[i]) * (1.0 - dadt))) * (360.0 / 256.0) + pbonecontroller[j].start;
}
}
else
@ -986,7 +981,7 @@ void StudioSlerpBones(vec4_t *q1, float pos1[][3], vec4_t *q2, float pos2[][3],
}
/* <160de> ../cstrike/dlls/animation.cpp:994 */
NOXREF void StudioCalcRotations(mstudiobone_t *pbones, int *chain, int chainlength, float *adj, float pos[128][3], vec4_t *q, mstudioseqdesc_t *pseqdesc, mstudioanim_t *panim, float f, float s)
void StudioCalcRotations(mstudiobone_t *pbones, int *chain, int chainlength, float *adj, float pos[128][3], vec4_t *q, mstudioseqdesc_t *pseqdesc, mstudioanim_t *panim, float f, float s)
{
int i;
int j;
@ -995,8 +990,8 @@ NOXREF void StudioCalcRotations(mstudiobone_t *pbones, int *chain, int chainleng
{
j = chain[i];
StudioCalcBoneQuaterion((int)f, s, &pbones[ j ], &panim[ j ], adj, &(*q)[j]);
StudioCalcBonePosition((int)f, s, &pbones[ j ], &panim[ j ], adj, pos[j]);
StudioCalcBoneQuaterion((int)f, s, &pbones[j], &panim[j], adj, q[j]);
StudioCalcBonePosition((int)f, s, &pbones[j], &panim[j], adj, pos[j]);
}
}
@ -1019,275 +1014,239 @@ void ConcatTransforms(float in1[3][4], float in2[3][4], float out[3][4])
out[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] + in1[2][2] * in2[2][3] + in1[2][3];
}
/* <16247> ../cstrike/dlls/animation.cpp:1115 */
NOBODY void SV_StudioSetupBones(struct model_s *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)
float_precision StudioEstimateFrame(float frame, mstudioseqdesc_t *pseqdesc)
{
// {
// int i; // 1117
// int j; // 1117
// float f; // 1118
// float subframe; // 1118
// float adj; // 1119
// mstudiobone_t *pbones; // 1120
// mstudioseqdesc_t *pseqdesc; // 1121
// mstudioanim_t *panim; // 1122
// float pos; // 1124
// float bonematrix; // 1125
// float q; // 1126
// float pos3; // 1127
// float q2; // 1128
// int chain; // 1130
// int chainlength; // 1131
// vec3_t temp_angles; // 1354
// StudioCalcBoneAdj(float dadt,
// float *adj,
// const byte *pcontroller1,
// const byte *pcontroller2,
// byte mouthopen); // 1175
// {
// float b; // 1295
// }
// {
// float pos3; // 1186
// float q3; // 1187
// float pos4; // 1188
// float q4; // 1189
// float s; // 1191
// float t; // 1192
// LookupAnimation(studiohdr_t *pstudiohdr,
// model_s *model,
// mstudioseqdesc_t *pseqdesc,
// int index); // 1236
// StudioCalcRotations(mstudiobone_t *pbones,
// int *chain,
// int chainlength,
// float *adj,
// float *pos,
// vec4_t *q,
// mstudioseqdesc_t *pseqdesc,
// mstudioanim_t *panim,
// float f,
// float s); // 1237
// LookupAnimation(studiohdr_t *pstudiohdr,
// model_s *model,
// mstudioseqdesc_t *pseqdesc,
// int index); // 1238
// StudioCalcRotations(mstudiobone_t *pbones,
// int *chain,
// int chainlength,
// float *adj,
// float *pos,
// vec4_t *q,
// mstudioseqdesc_t *pseqdesc,
// mstudioanim_t *panim,
// float f,
// float s); // 1239
// LookupAnimation(studiohdr_t *pstudiohdr,
// model_s *model,
// mstudioseqdesc_t *pseqdesc,
// int index); // 1240
// StudioCalcRotations(mstudiobone_t *pbones,
// int *chain,
// int chainlength,
// float *adj,
// float *pos,
// vec4_t *q,
// mstudioseqdesc_t *pseqdesc,
// mstudioanim_t *panim,
// float f,
// float s); // 1241
// LookupAnimation(studiohdr_t *pstudiohdr,
// model_s *model,
// mstudioseqdesc_t *pseqdesc,
// int index); // 1242
// StudioCalcRotations(mstudiobone_t *pbones,
// int *chain,
// int chainlength,
// float *adj,
// float *pos,
// vec4_t *q,
// mstudioseqdesc_t *pseqdesc,
// mstudioanim_t *panim,
// float f,
// float s); // 1243
// LookupAnimation(studiohdr_t *pstudiohdr,
// model_s *model,
// mstudioseqdesc_t *pseqdesc,
// int index); // 1257
// StudioCalcRotations(mstudiobone_t *pbones,
// int *chain,
// int chainlength,
// float *adj,
// float *pos,
// vec4_t *q,
// mstudioseqdesc_t *pseqdesc,
// mstudioanim_t *panim,
// float f,
// float s); // 1258
// LookupAnimation(studiohdr_t *pstudiohdr,
// model_s *model,
// mstudioseqdesc_t *pseqdesc,
// int index); // 1259
// StudioCalcRotations(mstudiobone_t *pbones,
// int *chain,
// int chainlength,
// float *adj,
// float *pos,
// vec4_t *q,
// mstudioseqdesc_t *pseqdesc,
// mstudioanim_t *panim,
// float f,
// float s); // 1260
// LookupAnimation(studiohdr_t *pstudiohdr,
// model_s *model,
// mstudioseqdesc_t *pseqdesc,
// int index); // 1261
// StudioCalcRotations(mstudiobone_t *pbones,
// int *chain,
// int chainlength,
// float *adj,
// float *pos,
// vec4_t *q,
// mstudioseqdesc_t *pseqdesc,
// mstudioanim_t *panim,
// float f,
// float s); // 1262
// LookupAnimation(studiohdr_t *pstudiohdr,
// model_s *model,
// mstudioseqdesc_t *pseqdesc,
// int index); // 1263
// StudioCalcRotations(mstudiobone_t *pbones,
// int *chain,
// int chainlength,
// float *adj,
// float *pos,
// vec4_t *q,
// mstudioseqdesc_t *pseqdesc,
// mstudioanim_t *panim,
// float f,
// float s); // 1264
// LookupAnimation(studiohdr_t *pstudiohdr,
// model_s *model,
// mstudioseqdesc_t *pseqdesc,
// int index); // 1272
// StudioCalcRotations(mstudiobone_t *pbones,
// int *chain,
// int chainlength,
// float *adj,
// float *pos,
// vec4_t *q,
// mstudioseqdesc_t *pseqdesc,
// mstudioanim_t *panim,
// float f,
// float s); // 1273
// LookupAnimation(studiohdr_t *pstudiohdr,
// model_s *model,
// mstudioseqdesc_t *pseqdesc,
// int index); // 1274
// StudioCalcRotations(mstudiobone_t *pbones,
// int *chain,
// int chainlength,
// float *adj,
// float *pos,
// vec4_t *q,
// mstudioseqdesc_t *pseqdesc,
// mstudioanim_t *panim,
// float f,
// float s); // 1275
// LookupAnimation(studiohdr_t *pstudiohdr,
// model_s *model,
// mstudioseqdesc_t *pseqdesc,
// int index); // 1276
// StudioCalcRotations(mstudiobone_t *pbones,
// int *chain,
// int chainlength,
// float *adj,
// float *pos,
// vec4_t *q,
// mstudioseqdesc_t *pseqdesc,
// mstudioanim_t *panim,
// float f,
// float s); // 1277
// LookupAnimation(studiohdr_t *pstudiohdr,
// model_s *model,
// mstudioseqdesc_t *pseqdesc,
// int index); // 1278
// StudioCalcRotations(mstudiobone_t *pbones,
// int *chain,
// int chainlength,
// float *adj,
// float *pos,
// vec4_t *q,
// mstudioseqdesc_t *pseqdesc,
// mstudioanim_t *panim,
// float f,
// float s); // 1279
// StudioCalcRotations(mstudiobone_t *pbones,
// int *chain,
// int chainlength,
// float *adj,
// float *pos,
// vec4_t *q,
// mstudioseqdesc_t *pseqdesc,
// mstudioanim_t *panim,
// float f,
// float s); // 1222
// LookupAnimation(studiohdr_t *pstudiohdr,
// model_s *model,
// mstudioseqdesc_t *pseqdesc,
// int index); // 1223
// StudioCalcRotations(mstudiobone_t *pbones,
// int *chain,
// int chainlength,
// float *adj,
// float *pos,
// vec4_t *q,
// mstudioseqdesc_t *pseqdesc,
// mstudioanim_t *panim,
// float f,
// float s); // 1224
// LookupAnimation(studiohdr_t *pstudiohdr,
// model_s *model,
// mstudioseqdesc_t *pseqdesc,
// int index); // 1225
// StudioCalcRotations(mstudiobone_t *pbones,
// int *chain,
// int chainlength,
// float *adj,
// float *pos,
// vec4_t *q,
// mstudioseqdesc_t *pseqdesc,
// mstudioanim_t *panim,
// float f,
// float s); // 1226
// LookupAnimation(studiohdr_t *pstudiohdr,
// model_s *model,
// mstudioseqdesc_t *pseqdesc,
// int index); // 1227
// StudioCalcRotations(mstudiobone_t *pbones,
// int *chain,
// int chainlength,
// float *adj,
// float *pos,
// vec4_t *q,
// mstudioseqdesc_t *pseqdesc,
// mstudioanim_t *panim,
// float f,
// float s); // 1228
// }
// {
// int copy; // 1323
// int gaitsequence; // 1324
// StudioCalcRotations(mstudiobone_t *pbones,
// int *chain,
// int chainlength,
// float *adj,
// float *pos,
// vec4_t *q,
// mstudioseqdesc_t *pseqdesc,
// mstudioanim_t *panim,
// float f,
// float s); // 1333
// }
// }
if (pseqdesc->numframes <= 1)
return 0;
return (float_precision)(pseqdesc->numframes - 1) * frame / 256;
}
/* <16247> ../cstrike/dlls/animation.cpp:1115 */
void 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)
{
int i, j;
float_precision f;
float subframe;
float adj[MAXSTUDIOCONTROLLERS];
mstudiobone_t *pbones;
mstudioseqdesc_t *pseqdesc;
mstudioanim_t *panim;
float bonematrix[3][4];
int chain[MAXSTUDIOBONES];
int chainlength;
vec3_t temp_angles;
static float pos[MAXSTUDIOBONES][3], pos2[MAXSTUDIOBONES][3];
static float q[MAXSTUDIOBONES][4], q2[MAXSTUDIOBONES][4];
g_pstudiohdr = (studiohdr_t *)IEngineStudio.Mod_Extradata(pModel);
// Bound sequence number
if (sequence < 0 || sequence >= g_pstudiohdr->numseq)
sequence = 0;
pbones = (mstudiobone_t *)((byte *)g_pstudiohdr + g_pstudiohdr->boneindex);
pseqdesc = (mstudioseqdesc_t *)((byte *)g_pstudiohdr + g_pstudiohdr->seqindex) + sequence;
panim = StudioGetAnim(pModel, pseqdesc);
if (iBone < -1 || iBone >= g_pstudiohdr->numbones)
iBone = 0;
if (iBone == -1)
{
chainlength = g_pstudiohdr->numbones;
for (i = 0; i < chainlength; i++)
chain[(chainlength - i) - 1] = i;
}
else
{
chainlength = 0;
for (i = iBone; i != -1; i = pbones[i].parent)
chain[chainlength++] = i;
}
f = StudioEstimateFrame(frame, pseqdesc);
subframe = (int)f;
f -= subframe;
StudioCalcBoneAdj(0, adj, pcontroller, pcontroller, 0);
StudioCalcRotations(pbones, chain, chainlength, adj, pos, q, pseqdesc, panim, subframe, f);
if (pseqdesc->numblends != 9)
{
if (pseqdesc->numblends > 1)
{
float b = (float_precision)pblending[0] / 255.0f;
pseqdesc = (mstudioseqdesc_t *)((byte *)g_pstudiohdr + g_pstudiohdr->seqindex) + sequence;
panim = StudioGetAnim(pModel, pseqdesc);
panim += g_pstudiohdr->numbones;
StudioCalcRotations(pbones, chain, chainlength, adj, pos2, q2, pseqdesc, panim, subframe, f);
StudioSlerpBones(q, pos, q2, pos2, b);
}
}
// This game knows how to do nine way blending
else
{
static float pos3[MAXSTUDIOBONES][3], pos4[MAXSTUDIOBONES][3];
static float q3[MAXSTUDIOBONES][4], q4[MAXSTUDIOBONES][4];
float_precision s, t;
s = GetPlayerYaw(pEdict);
t = GetPlayerPitch(pEdict);
// Blending is 0-127 == Left to Middle, 128 to 255 == Middle to right
if (s <= 127.0f)
{
// Scale 0-127 blending up to 0-255
s = (s * 2.0f);
if (t <= 127.0f)
{
t = (t * 2.0f);
StudioCalcRotations(pbones, chain, chainlength, adj, pos, q, pseqdesc, panim, subframe, f);
panim = LookupAnimation(pModel, pseqdesc, 1);
StudioCalcRotations(pbones, chain, chainlength, adj, pos2, q2, pseqdesc, panim, subframe, f);
panim = LookupAnimation(pModel, pseqdesc, 3);
StudioCalcRotations(pbones, chain, chainlength, adj, pos3, q3, pseqdesc, panim, subframe, f);
panim = LookupAnimation(pModel, pseqdesc, 4);
StudioCalcRotations(pbones, chain, chainlength, adj, pos4, q4, pseqdesc, panim, subframe, f);
}
else
{
t = 2.0f * (t - 127.0f);
panim = LookupAnimation(pModel, pseqdesc, 3);
StudioCalcRotations(pbones, chain, chainlength, adj, pos, q, pseqdesc, panim, subframe, f);
panim = LookupAnimation(pModel, pseqdesc, 4);
StudioCalcRotations(pbones, chain, chainlength, adj, pos2, q2, pseqdesc, panim, subframe, f);
panim = LookupAnimation(pModel, pseqdesc, 6);
StudioCalcRotations(pbones, chain, chainlength, adj, pos3, q3, pseqdesc, panim, subframe, f);
panim = LookupAnimation(pModel, pseqdesc, 7);
StudioCalcRotations(pbones, chain, chainlength, adj, pos4, q4, pseqdesc, panim, subframe, f);
}
}
else
{
// Scale 127-255 blending up to 0-255
s = 2.0f * (s - 127.0f);
if (t <= 127.0f)
{
t = (t * 2.0f);
panim = LookupAnimation(pModel, pseqdesc, 1);
StudioCalcRotations(pbones, chain, chainlength, adj, pos, q, pseqdesc, panim, subframe, f);
panim = LookupAnimation(pModel, pseqdesc, 2);
StudioCalcRotations(pbones, chain, chainlength, adj, pos2, q2, pseqdesc, panim, subframe, f);
panim = LookupAnimation(pModel, pseqdesc, 4);
StudioCalcRotations(pbones, chain, chainlength, adj, pos3, q3, pseqdesc, panim, subframe, f);
panim = LookupAnimation(pModel, pseqdesc, 5);
StudioCalcRotations(pbones, chain, chainlength, adj, pos4, q4, pseqdesc, panim, subframe, f);
}
else
{
t = 2.0f * (t - 127.0f);
panim = LookupAnimation(pModel, pseqdesc, 4);
StudioCalcRotations(pbones, chain, chainlength, adj, pos, q, pseqdesc, panim, subframe, f);
panim = LookupAnimation(pModel, pseqdesc, 5);
StudioCalcRotations(pbones, chain, chainlength, adj, pos2, q2, pseqdesc, panim, subframe, f);
panim = LookupAnimation(pModel, pseqdesc, 7);
StudioCalcRotations(pbones, chain, chainlength, adj, pos3, q3, pseqdesc, panim, subframe, f);
panim = LookupAnimation(pModel, pseqdesc, 8);
StudioCalcRotations(pbones, chain, chainlength, adj, pos4, q4, pseqdesc, panim, subframe, f);
}
}
// Normalize interpolant
s /= 255.0f;
t /= 255.0f;
// Spherically interpolate the bones
StudioSlerpBones(q, pos, q2, pos2, s);
StudioSlerpBones(q3, pos3, q4, pos4, s);
StudioSlerpBones(q, pos, q3, pos3, t);
}
if (pseqdesc->numblends == 9 && sequence < ANIM_FIRST_DEATH_SEQUENCE && sequence != ANIM_SWIM_1 && sequence != ANIM_SWIM_2)
{
int copy = 1;
int gaitsequence = GetPlayerGaitsequence(pEdict); // calc gait animation
if (gaitsequence < 0 || gaitsequence >= g_pstudiohdr->numseq)
gaitsequence = 0;
pseqdesc = (mstudioseqdesc_t *)((byte *)g_pstudiohdr + g_pstudiohdr->seqindex) + gaitsequence;
panim = StudioGetAnim(pModel, pseqdesc);
StudioCalcRotations(pbones, chain, chainlength, adj, pos2, q2, pseqdesc, panim, 0, 0);
for (i = 0; i < g_pstudiohdr->numbones; i++)
{
if (!Q_strcmp(pbones[i].name, "Bip01 Spine"))
{
copy = 0;
}
else if (!Q_strcmp(pbones[pbones[i].parent].name, "Bip01 Pelvis"))
{
copy = 1;
}
if (copy)
{
Q_memcpy(pos[i], pos2[i], sizeof(pos[i]));
Q_memcpy(q[i], q2[i], sizeof(q[i]));
}
}
}
VectorCopy(angles, temp_angles);
if (pEdict)
{
temp_angles[1] = UTIL_GetPlayerGaitYaw(g_engfuncs.pfnIndexOfEdict(pEdict));
if (temp_angles[1] < 0)
temp_angles[1] += 360.0f;
}
AngleMatrix(temp_angles, (*g_pRotationMatrix));
(*g_pRotationMatrix)[0][3] = origin[0];
(*g_pRotationMatrix)[1][3] = origin[1];
(*g_pRotationMatrix)[2][3] = origin[2];
for (i = chainlength - 1; i >= 0; i--)
{
j = chain[i];
QuaternionMatrix(q[j], bonematrix);
bonematrix[0][3] = pos[j][0];
bonematrix[1][3] = pos[j][1];
bonematrix[2][3] = pos[j][2];
if (pbones[j].parent == -1)
ConcatTransforms((*g_pRotationMatrix), bonematrix, (*g_pBoneTransform)[j]);
else
ConcatTransforms((*g_pBoneTransform)[pbones[j].parent], bonematrix, (*g_pBoneTransform)[j]);
}
}

View File

@ -32,6 +32,10 @@
#pragma once
#endif
#define ANIM_SWIM_1 8
#define ANIM_SWIM_2 9
#define ANIM_FIRST_DEATH_SEQUENCE 101
#include "com_model.h"
#include "studio.h"
#include "r_studioint.h"
@ -54,16 +58,16 @@ int GetBodygroup(void *pmodel, entvars_t *pev, int iGroup);
C_DLLEXPORT int Server_GetBlendingInterface(int version, struct sv_blending_interface_s **ppinterface, struct engine_studio_api_s *pstudio, float *rotationmatrix, float *bonetransform);
void AngleQuaternion(vec_t *angles, vec_t *quaternion);
void QuaternionSlerp(vec_t *p, vec_t *q, float t, vec_t *qt);
NOBODY void QuaternionMatrix(vec_t *quaternion, float matrix[3][4]);
NOBODY void QuaternionMatrix(vec_t *quaternion, float (*matrix)[4]);
mstudioanim_t *StudioGetAnim(model_t *m_pSubModel, mstudioseqdesc_t *pseqdesc);
NOXREF mstudioanim_t *LookupAnimation(studiohdr_t *pstudiohdr, model_s *model, mstudioseqdesc_t *pseqdesc, int index);
mstudioanim_t *LookupAnimation(model_t *model, mstudioseqdesc_t *pseqdesc, int index);
void StudioCalcBoneAdj(float dadt, float *adj, const byte *pcontroller1, const byte *pcontroller2, byte mouthopen);
void StudioCalcBoneQuaterion(int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *q);
void StudioCalcBonePosition(int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *pos);
void StudioSlerpBones(vec4_t *q1, float pos1[][3], vec4_t *q2, float pos2[][3], float s);
NOXREF void StudioCalcRotations(mstudiobone_t *pbones, int *chain, int chainlength, float *adj, float pos[128][3], vec4_t *q, mstudioseqdesc_t *pseqdesc, mstudioanim_t *panim, float f, float s);
void StudioCalcRotations(mstudiobone_t *pbones, int *chain, int chainlength, float *adj, float pos[128][3], vec4_t *q, mstudioseqdesc_t *pseqdesc, mstudioanim_t *panim, float f, float s);
void ConcatTransforms(float in1[3][4], float in2[3][4], float out[3][4]);
NOBODY void SV_StudioSetupBones(struct model_s *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);
void 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);
#ifdef HOOK_GAMEDLL
@ -91,7 +95,4 @@ extern float sinom;
extern float sclp;
extern float sclq;
// refs
extern void (*pQuaternionMatrix)(vec_t *quaternion, float matrix[3][4]);
#endif // ANIMATION_H

View File

@ -49,11 +49,11 @@ public:
virtual void Killed(entvars_t *pevAttacker, int iGib);
virtual int BloodColor(void)
{
return BloodColor_();
return m_bloodColor;
}
virtual BOOL IsAlive(void)
{
return IsAlive_();
return (pev->deadflag != DEAD_DEAD);
}
virtual float ChangeYaw(int speed);
virtual BOOL HasHumanGibs(void);
@ -80,14 +80,6 @@ public:
int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
int TakeHealth_(float flHealth, int bitsDamageType);
void Killed_(entvars_t *pevAttacker, int iGib);
int BloodColor_(void)
{
return m_bloodColor;
}
BOOL IsAlive_(void)
{
return (pev->deadflag != DEAD_DEAD);
}
float ChangeYaw_(int speed);
BOOL HasHumanGibs_(void);
BOOL HasAlienGibs_(void);

View File

@ -62,17 +62,13 @@ public:
// Bmodels don't go across transitions
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION;
}
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#ifdef HOOK_GAMEDLL
void Spawn_(void);
int ObjectCaps_(void)
{
return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION;
}
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
@ -129,17 +125,13 @@ public:
virtual void KeyValue(KeyValueData *pkvd);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION;
}
#ifdef HOOK_GAMEDLL
void Spawn_(void);
void KeyValue_(KeyValueData *pkvd);
int ObjectCaps_(void)
{
return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION;
}
#endif // HOOK_GAMEDLL
@ -189,7 +181,7 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION;
}
virtual void Blocked(CBaseEntity *pOther);
@ -200,10 +192,6 @@ public:
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION;
}
void Blocked_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL
@ -238,7 +226,7 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION;
}
virtual void Touch(CBaseEntity *pOther);
virtual void Blocked(CBaseEntity *pOther);
@ -249,10 +237,6 @@ public:
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION;
}
void Touch_(CBaseEntity *pOther);
void Blocked_(CBaseEntity *pOther);
@ -283,6 +267,8 @@ public:
Vector VecBModelOrigin(entvars_t *pevBModel);
#ifdef HOOK_GAMEDLL
// linked objects
C_DLLEXPORT void func_wall(entvars_t *pev);
C_DLLEXPORT void func_wall_toggle(entvars_t *pev);
@ -292,4 +278,6 @@ C_DLLEXPORT void func_monsterclip(entvars_t *pev);
C_DLLEXPORT void func_rotating(entvars_t *pev);
C_DLLEXPORT void func_pendulum(entvars_t *pev);
#endif // HOOK_GAMEDLL
#endif // BMODELS_H

View File

@ -108,8 +108,19 @@ NOBODY void CCSBot::BotTouch(CBaseEntity *other)
}
/* <2e89e3> ../cstrike/dlls/bot/cs_bot.cpp:335 */
NOBODY bool CCSBot::IsBusy(void) const
bool CCSBot::IsBusy(void) const
{
if (IsAttacking() ||
IsBuying() ||
IsDefusingBomb() ||
GetTask() == PLANT_BOMB ||
GetTask() == RESCUE_HOSTAGES ||
IsSniping())
{
return true;
}
return false;
}
/* <2e8a0c> ../cstrike/dlls/bot/cs_bot.cpp:351 */
@ -344,18 +355,25 @@ void CCSBot::DecreaseMorale(void)
}
/* <2e984c> ../cstrike/dlls/bot/cs_bot.cpp:857 */
NOBODY bool CCSBot::IsRogue(void) const
bool CCSBot::IsRogue(void) const
{
// {
// class CCSBotManager *ctrl; // 859
// AllowRogues(const class CCSBotManager *const this); // 860
// IsElapsed(const class CountdownTimer *const this); // 864
// {
// float const rogueChance; // 869
// Start(CountdownTimer *const this,
// float duration); // 866
// }
// }
CCSBotManager *ctrl = TheCSBots();
if (!ctrl->AllowRogues())
return false;
// periodically re-evaluate our rogue status
if (m_rogueTimer.IsElapsed())
{
m_rogueTimer.Start(RANDOM_FLOAT(10, 30));
// our chance of going rogue is inversely proportional to our teamwork attribute
const float rogueChance = 100.0f * (1.0f - GetProfile()->GetTeamwork());
m_isRogue = (RANDOM_FLOAT(0, 100) < rogueChance);
}
return m_isRogue;
}
/* <2e98f1> ../cstrike/dlls/bot/cs_bot.cpp:882 */

View File

@ -449,7 +449,7 @@ public:
{
return m_combatRange;
}
NOBODY bool IsRogue(void)const;
bool IsRogue(void)const;
void SetRogue(bool rogue)
{
m_isRogue = rogue;
@ -469,7 +469,7 @@ public:
return m_safeTime;
}
NOBODY bool IsUnhealthy(void);
NOBODY void Idle(void);
void Idle(void);
NOBODY void Hide(CNavArea *searchFromArea = NULL, float duration = -1.0f, float hideRange = 750.0f, bool holdPosition = false);
NOBODY void Hide(const Vector *hidingSpot = NULL, float duration = -1.0f, bool holdPosition = false);
@ -483,7 +483,7 @@ public:
NOBODY bool IsHunting(void) const;
NOBODY void Attack(CBasePlayer *victim);
NOBODY void FireWeaponAtEnemy(void);
NOBODY void StopAttacking(void);
void StopAttacking(void);
bool IsAttacking(void) const;
NOBODY void MoveTo(const Vector *pos, RouteType route = SAFEST_ROUTE);
NOBODY bool IsMovingTo(void) const;
@ -498,13 +498,13 @@ public:
return false;
}
NOBODY void DefuseBomb(void);
NOBODY bool IsDefusingBomb(void) const;
bool IsDefusingBomb(void) const;
NOBODY bool CanSeePlantedBomb(void) const;
NOBODY void EscapeFromBomb(void);
NOBODY bool IsEscapingFromBomb(void) const;
NOBODY void RescueHostages(void);
NOBODY void UseEntity(CBaseEntity *entity);
NOBODY bool IsBuying(void) const;
bool IsBuying(void) const;
NOBODY void Panic(CBasePlayer *enemy);
NOBODY void Follow(CBasePlayer *player);
NOBODY void ContinueFollowing(void);
@ -571,7 +571,7 @@ public:
return GetGameState()->IsAtPlantedBombsite();
}
NOBODY bool GuardRandomZone(float range = 500.0f);
NOBODY bool IsBusy(void) const;
bool IsBusy(void) const;
enum TaskType
{
@ -884,7 +884,7 @@ public:
bool IsUsingSniperRifle(void);
bool IsUsingAWP(void);
NOBODY bool IsSniper(void);
NOBODY bool IsSniping(void);
bool IsSniping(void) const;
bool IsUsingShotgun(void);
bool IsUsingMachinegun(void);
void ThrowGrenade(const Vector *target);
@ -926,7 +926,7 @@ public:
NOBODY void BotDeathThink(void);
NOBODY CBasePlayer *FindNearbyPlayer(void);
void AdjustSafeTime(void);
NOBODY void SetState(BotState *state);
void SetState(BotState *state);
NOBODY void MoveTowardsPosition(const Vector *pos);
NOBODY void MoveAwayFromPosition(const Vector *pos);
NOBODY void StrafeAwayFromPosition(const Vector *pos);
@ -1312,11 +1312,13 @@ public:
m_bot = bot;
m_route = route;
}
float operator() (CNavArea *area, CNavArea *fromArea, const CNavLadder *ladder)
float operator()(CNavArea *area, CNavArea *fromArea, const CNavLadder *ladder)
{
/*#define NAV_MESH_JUMP 0x0002
float baseDangerFactor = 100.0f;
float dangerFactor = (1.0f - (0.95f * m_bot->GetProfile()->GetAggression())) * baseDangerFactor;
if (fromArea == NULL)
{
if (m_route == FASTEST_ROUTE)
@ -1396,8 +1398,10 @@ public:
}
return cost;
}*/
return 0.0f;
}
private:
CCSBot *m_bot;
RouteType m_route;
@ -1510,5 +1514,6 @@ float StayOnLadderLine(CCSBot *me, const CNavLadder *ladder);
extern void (*pCCSBot__UpdateLookAngles)(void);
extern void (*pCCSBot__Update)(void);
extern void (*pCCSBot__ResetValues)(void);
#endif // CS_BOT_H

View File

@ -16,21 +16,34 @@ CBaseEntity *g_pSelectedZombieSpawn;
#endif // HOOK_GAMEDLL
/* <303469> ../cstrike/dlls/bot/cs_bot_chatter.cpp:32 */
NOBODY const Vector *GetRandomSpotAtPlace(Place place)
const Vector *GetRandomSpotAtPlace(Place place)
{
// {
// int count; // 34
// iterator iter; // 35
// int which; // 46
// {
// class CNavArea *area; // 38
// }
// operator++(_List_iterator<CNavArea*> *const this); // 36
// operator++(_List_iterator<CNavArea*> *const this); // 47
// {
// class CNavArea *area; // 49
// }
// }
int count = 0;
NavAreaList::iterator iter;
int which;
for (iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter)
{
CNavArea *area = (*iter);
if (area->GetPlace() == place)
++count;
}
if (count == 0)
return NULL;
which = RANDOM_LONG(0, count - 1);
for (iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter)
{
CNavArea *area = (*iter);
if (area->GetPlace() == place && which == 0)
return area->GetCenter();
}
return NULL;
}
/* <303541> ../cstrike/dlls/bot/cs_bot_chatter.cpp:62 */
@ -71,6 +84,8 @@ NOBODY void BotBombStatusMeme::Interpret(CCSBot *sender, CCSBot *receiver) const
// class CCSBot *receiver); // 137
}
// A teammate has asked that we follow him
/* <302c87> ../cstrike/dlls/bot/cs_bot_chatter.cpp:167 */
NOBODY void BotFollowMeme::Interpret(CCSBot *sender, CCSBot *receiver) const
{
@ -82,6 +97,28 @@ NOBODY void BotFollowMeme::Interpret(CCSBot *sender, CCSBot *receiver) const
// Interpret(const class BotFollowMeme *const this,
// class CCSBot *sender,
// class CCSBot *receiver); // 167
if (receiver->IsRogue())
return;
// if we're busy, ignore
if (receiver->IsBusy())
return;
PathCost pathCost(receiver);
float travelDistance = NavAreaTravelDistance(receiver->GetLastKnownArea(), TheNavAreaGrid.GetNearestNavArea(&sender->pev->origin), pathCost);
if (travelDistance < 0.0f)
return;
const float tooFar = 1000.0f;
if (travelDistance > tooFar)
return;
// begin following
receiver->Follow(sender);
// acknowledge
receiver->GetChatter()->Say("CoveringFriend");
}
/* <302759> ../cstrike/dlls/bot/cs_bot_chatter.cpp:200 */
@ -295,6 +332,7 @@ NOBODY BotPhraseManager::BotPhraseManager(void)
/* <303c45> ../cstrike/dlls/bot/cs_bot_chatter.cpp:417 */
NOBODY void BotPhraseManager::OnMapChange(void)
{
m_placeCount = 0;
}
/* <303c70> ../cstrike/dlls/bot/cs_bot_chatter.cpp:425 */

View File

@ -686,7 +686,7 @@ inline void BotChatterInterface::Say(const char *phraseName, float lifetime, flo
AddStatement(say);*/
}
NOBODY const Vector *GetRandomSpotAtPlace(Place place);
const Vector *GetRandomSpotAtPlace(Place place);
#ifdef HOOK_GAMEDLL

View File

@ -107,9 +107,16 @@ NOBODY bool CCSBot::__MAKE_VHOOK(Initialize)(const BotProfile *profile)
return true;
}
void (*pCCSBot__ResetValues)(void);
/* <3341dc> ../cstrike/dlls/bot/cs_bot_init.cpp:167 */
NOBODY void CCSBot::ResetValues(void)
NOBODY void __declspec(naked) CCSBot::ResetValues(void)
{
__asm
{
jmp pCCSBot__ResetValues
}
/*
m_chatter.Reset();//TODO: Reverse me
m_gameState.Reset();//TODO: Reverse me
@ -261,15 +268,27 @@ NOBODY void CCSBot::ResetValues(void)
// start in idle state
StopAttacking();//TODO: Reverse me
Idle();//TODO: Reverse me
*/
}
/* <3342e4> ../cstrike/dlls/bot/cs_bot_init.cpp:336 */
NOBODY void CCSBot::__MAKE_VHOOK(SpawnBot)(void)
{
// {
// class CCSBotManager *ctrl; // 338
// SetLearningMapFlag(CCSBotManager *const this); // 357
// }
CCSBotManager *ctrl = TheCSBots();
ctrl->ValidateMapData();
ResetValues();
Q_strcpy(m_name, STRING(pev->netname));
SetState(&m_buyState);
SetTouch(&CCSBot::BotTouch);
if (!TheNavAreaList.empty() && !ctrl->IsLearningMap())
{
ctrl->SetLearningMapFlag();
StartLearnProcess();
}
}
/* <3338f7> ../cstrike/dlls/bot/cs_bot_init.cpp:366 */

View File

@ -5,7 +5,7 @@
*/
#ifndef HOOK_GAMEDLL
const float updateTimesliceDuration;
const float updateTimesliceDuration = 0.0f;
#else
@ -98,6 +98,14 @@ NOBODY void CCSBot::StartLearnProcess(void)
// SnapToGrid(Vector *pos); // 193
// StartNormalProcess(CCSBot *const this); // 199
// }
Vector pos;
Vector normal;
startProgressMeter("#CZero_LearningMap");
drawProgressMeter(0, "#CZero_LearningMap");
}
/* <343d37> ../cstrike/dlls/bot/cs_bot_learn.cpp:217 */

View File

@ -30,7 +30,7 @@ cvar_t cv_bot_allow_grenades = { "bot_allow_grenades", "1", FCVAR_SERVER, 0.0f,
cvar_t cv_bot_allow_snipers = { "bot_allow_snipers", "1", FCVAR_SERVER, 0.0f, NULL };
cvar_t cv_bot_allow_shield = { "bot_allow_shield", "1", FCVAR_SERVER, 0.0f, NULL };
cvar_t cv_bot_join_team = { "bot_join_team", "any", FCVAR_SERVER, 0.0f, NULL };
cvar_t cv_bot_join_after_player = { &unk_1EF09A, "1", FCVAR_SERVER, 0.0f, NULL };
cvar_t cv_bot_join_after_player = { "bot_join_after_player", "1", FCVAR_SERVER, 0.0f, NULL };
cvar_t cv_bot_auto_vacate = { "bot_auto_vacate", "1", FCVAR_SERVER, 0.0f, NULL };
cvar_t cv_bot_zombie = { "bot_zombie", "0", FCVAR_SERVER, 0.0f, NULL };
cvar_t cv_bot_defer_to_human = { "bot_defer_to_human", "0", FCVAR_SERVER, 0.0f, NULL };
@ -223,7 +223,7 @@ void CCSBotManager::__MAKE_VHOOK(ServerActivate)(void)
m_bServerActive = true;
AddServerCommands();
TheBotPhrases->m_placeCount = 0;
TheBotPhrases->OnMapChange();
}
/* <36afcd> ../cstrike/dlls/bot/cs_bot_manager.cpp:369 */
@ -822,7 +822,6 @@ void CCSBotManager::ValidateMapData(void)
IMPLEMENT_ARRAY(m_isMapDataLoaded) = true;
// TODO: Reverse me
if (LoadNavigationMap())
{
CONSOLE_ECHO("Failed to load navigation map.\n");
@ -1085,22 +1084,26 @@ NOBODY const CCSBotManager::Zone *CCSBotManager::GetZone(const Vector *pos) cons
// }
}
// Return the closest zone to the given position
/* <36bbfd> ../cstrike/dlls/bot/cs_bot_manager.cpp:1392 */
NOBODY const CCSBotManager::Zone *CCSBotManager::GetClosestZone(const Vector *pos) const
const CCSBotManager::Zone *CCSBotManager::GetClosestZone(const Vector *pos) const
{
// {
// const class Zone *close; // 1394
// float closeRangeSq; // 1395
// {
// int z; // 1397
// {
// float rangeSq; // 1399
// operator-(const Vector *const this,
// const Vector &v); // 1399
// LengthSquared(const Vector *const this); // 1399
// }
// }
// }
const Zone *close = NULL;
float closeRangeSq = 1e9f;
for (int z = 0; z < m_zoneCount; z++)
{
float rangeSq = (m_zone[z].m_center - (*pos)).LengthSquared();
if (rangeSq < closeRangeSq)
{
closeRangeSq = rangeSq;
close = &m_zone[z];
}
}
return close;
}
/* <36bcc9> ../cstrike/dlls/bot/cs_bot_manager.cpp:1415 */

View File

@ -211,7 +211,7 @@ public:
return &m_zone[i];
}
NOBODY const Zone *GetZone(const Vector *pos) const;
NOBODY const Zone *GetClosestZone(const Vector *pos) const;
const Zone *GetClosestZone(const Vector *pos) const;
const Zone *GetClosestZone(const CBaseEntity *entity) const
{
return GetClosestZone(&entity->pev->origin);
@ -457,6 +457,9 @@ NOBODY void UTIL_DrawBox(Extent *extent, int lifetime, int red, int green, int b
typedef const CCSBotManager::Zone *(CCSBotManager::*GET_ZONE_INT)(int) const;
typedef const CCSBotManager::Zone *(CCSBotManager::*GET_ZONE_VECTOR)(const Vector *pos) const;
typedef const CCSBotManager::Zone *(CCSBotManager::*GET_CLOSEST_ZONE_ENT)(const CBaseEntity *entity) const;
typedef const CCSBotManager::Zone *(CCSBotManager::*GET_CLOSEST_ZONE_VECTOR)(const Vector *pos) const;
#endif // HOOK_GAMEDLL
// refs

View File

@ -1,7 +1,7 @@
#include "precompiled.h"
/* <3b3a2a> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:16 */
NOBODY void CCSBot::SetState(BotState *state)
void CCSBot::SetState(BotState *state)
{
PrintIfWatched("SetState: %s -> %s\n", (m_state != NULL) ? m_state->GetName() : "NULL", state->GetName());
@ -22,7 +22,7 @@ NOBODY void CCSBot::SetState(BotState *state)
}
/* <3b3ab4> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:34 */
NOBODY void CCSBot::Idle(void)
void CCSBot::Idle(void)
{
SetTask(SEEK_AND_DESTROY);
SetState(&m_idleState);
@ -221,7 +221,7 @@ NOBODY void CCSBot::Attack(CBasePlayer *victim)
}
/* <3b4416> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:366 */
NOBODY void CCSBot::StopAttacking(void)
void CCSBot::StopAttacking(void)
{
PrintIfWatched("ATTACK END\n");
m_attackState.OnExit(this);//TODO: Reverse me
@ -246,14 +246,21 @@ NOBODY bool CCSBot::IsEscapingFromBomb(void) const
}
/* <3b44c6> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:399 */
NOBODY bool CCSBot::IsDefusingBomb(void) const
bool CCSBot::IsDefusingBomb(void) const
{
if (m_state == static_cast<const BotState *>(&m_defuseBombState))
return true;
return false;
}
/* <3b44ed> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:411 */
bool CCSBot::IsHiding(void) const
{
return (m_state == static_cast<const BotState *>(&m_hideState));
if (m_state == static_cast<const BotState *>(&m_hideState))
return true;
return false;
}
/* <3b450f> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:423 */
@ -276,8 +283,12 @@ NOBODY bool CCSBot::IsMovingTo(void) const
}
/* <3b4598> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:460 */
NOBODY bool CCSBot::IsBuying(void) const
bool CCSBot::IsBuying(void) const
{
if (m_state == static_cast<const BotState *>(&m_buyState))
return true;
return false;
}
/* <3b45bf> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:472 */

View File

@ -3,7 +3,9 @@
/* <3c635f> ../cstrike/dlls/bot/cs_bot_update.cpp:26 */
void CCSBot::__MAKE_VHOOK(Upkeep)(void)
{
if (IMPLEMENT_ARRAY_CLASS(CCSBotManager, m_isLearningMap) || !IsAlive())
CCSBotManager *ctrl = TheCSBots();
if (ctrl->IsLearningMap() || !IsAlive())
return;
if (m_isRapidFiring)
@ -145,7 +147,7 @@ void CCSBot::__MAKE_VHOOK(Upkeep)(void)
void (*pCCSBot__Update)(void);
/* <3c6e1e> ../cstrike/dlls/bot/cs_bot_update.cpp:208 */
void __declspec(naked) CCSBot::Update_(void)
void __declspec(naked) CCSBot::__MAKE_VHOOK(Update)(void)
{
__asm
{

View File

@ -176,9 +176,15 @@ NOBODY bool CCSBot::IsSniper(void)
// }
}
// Return true if we are actively sniping (moving to sniper spot or settled in)
/* <3ea4c1> ../cstrike/dlls/bot/cs_bot_weapon.cpp:405 */
NOBODY bool CCSBot::IsSniping(void)
bool CCSBot::IsSniping(void) const
{
if (GetTask() == MOVE_TO_SNIPER_SPOT || GetTask() == SNIPING)
return true;
return false;
}
/* <3ea4e8> ../cstrike/dlls/bot/cs_bot_weapon.cpp:417 */

View File

@ -31,9 +31,15 @@ NOBODY void AttackState::OnEnter(CCSBot *me)
/* <51a140> ../cstrike/dlls/bot/states/cs_bot_attack.cpp:135 */
NOBODY void AttackState::StopAttacking(CCSBot *me)
{
me->m_isAttacking = false;
// StopAttacking(AttackState *const this,
// class CCSBot *me); // 135
if (me->m_task == CCSBot::SNIPING)
{
// stay in our hiding spot
me->Hide(me->GetLastKnownArea(), -1.0f, 50.0f);
}
else
{
me->StopAttacking();
}
}
/* <51997e> ../cstrike/dlls/bot/states/cs_bot_attack.cpp:152 */

View File

@ -107,18 +107,6 @@ public:
virtual int Save(CSave &save);
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
}
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#ifdef HOOK_GAMEDLL
void Spawn_(void);
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
int flags = CBaseToggle::ObjectCaps() & (~FCAP_ACROSS_TRANSITION);
@ -129,6 +117,14 @@ public:
return (flags | FCAP_CONTINUOUS_USE);
}
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#ifdef HOOK_GAMEDLL
void Spawn_(void);
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
@ -216,6 +212,8 @@ public:
char *ButtonSound(int sound);
void DoSpark(entvars_t *pev, const Vector &location);
#ifdef HOOK_GAMEDLL
// linked objects
C_DLLEXPORT void env_global(entvars_t *pev);
C_DLLEXPORT void multisource(entvars_t *pev);
@ -226,4 +224,6 @@ C_DLLEXPORT void env_spark(entvars_t *pev);
C_DLLEXPORT void env_debris(entvars_t *pev);
C_DLLEXPORT void button_target(entvars_t *pev);
#endif // HOOK_GAMEDLL
#endif // BUTTON_H

View File

@ -373,7 +373,7 @@ void CCareerTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer *pVicti
WRITE_BYTE(m_id);
MESSAGE_END();
if (TheTutor)
if (TheTutor != NULL)
{
TheTutor->OnEvent(EVENT_CAREER_TASK_DONE);
}

View File

@ -45,17 +45,13 @@ public:
virtual void Reset(void);
virtual bool IsTaskCompletableThisRound(void)
{
return IsTaskCompletableThisRound_();
return true;
}
#ifdef HOOK_GAMEDLL
void OnEvent_(GameEventType event, CBasePlayer *pAttacker, CBasePlayer *pVictim);
void Reset_(void);
bool IsTaskCompletableThisRound_(void)
{
return true;
}
#endif // HOOK_GAMEDLL
@ -192,17 +188,13 @@ public:
virtual void Reset(void);
virtual bool IsTaskCompletableThisRound(void)
{
return IsTaskCompletableThisRound_();
return m_bombPlantedThisRound && !m_defuseStartedThisRound;
}
#ifdef HOOK_GAMEDLL
void OnEvent_(GameEventType event, CBasePlayer *pAttacker, CBasePlayer *pVictim);
void Reset_(void);
bool IsTaskCompletableThisRound_(void)
{
return m_bombPlantedThisRound && !m_defuseStartedThisRound;
}
#endif // HOOK_GAMEDLL

View File

@ -96,10 +96,8 @@ int CaseInsensitiveHash(const char *string, int iBounds)
{
unsigned int hash = 0;
if (!string[0])
{
if (!*string)
return 0;
}
while (*string)
{
@ -107,6 +105,7 @@ int CaseInsensitiveHash(const char *string, int iBounds)
hash = *string + 2 * hash;
else
hash = *string + 2 * hash + ' ';
string++;
}
@ -394,7 +393,6 @@ 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++)
{
stringsHashTable[i].next = NULL;
@ -405,7 +403,7 @@ C_DLLEXPORT int GetEntityAPI(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion
}
/* <3161a> ../cstrike/dlls/cbase.cpp:471 */
NOXREF extern "C" C_EXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion)
NOXREF int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion)
{
if (!pFunctionTable || *interfaceVersion != INTERFACE_VERSION)
{
@ -418,7 +416,7 @@ NOXREF extern "C" C_EXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int
}
/* <3165b> ../cstrike/dlls/cbase.cpp:485 */
extern "C" C_EXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion)
C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion)
{
if (!pFunctionTable || *interfaceVersion != NEW_DLL_FUNCTIONS_VERSION)
{
@ -548,7 +546,7 @@ void DispatchThink(edict_t *pent)
if (pEntity != NULL)
{
if ((pEntity->pev->flags & FL_DORMANT))
if (pEntity->pev->flags & FL_DORMANT)
{
ALERT(at_error, "Dormant entity %s is thinking!!\n", STRING(pEntity->pev->classname));
}

View File

@ -319,10 +319,7 @@ public:
{
return CLASS_NONE;
}
virtual void DeathNotice(entvars_t *pevChild)
{
return DeathNotice_(pevChild);
}
virtual void DeathNotice(entvars_t *pevChild) {}
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType);
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual int TakeHealth(float flHealth, int bitsDamageType);
@ -346,7 +343,7 @@ public:
}
virtual int GetToggleState(void)
{
return GetToggleState_();
return TS_AT_TOP;
}
virtual void AddPoints(int score, BOOL bAllowNegativeScore) {}
virtual void AddPointsToTeam(int score, BOOL bAllowNegativeScore) {}
@ -364,7 +361,7 @@ public:
}
virtual float GetDelay(void)
{
return GetDelay_();
return 0.0f;
}
virtual int IsMoving(void)
{
@ -464,7 +461,7 @@ public:
}
virtual Vector BodyTarget(const Vector &posSrc)
{
return BodyTarget_(posSrc);
return Center();
}
virtual int Illumination(void)
{
@ -479,27 +476,14 @@ public:
int Save_(CSave &save);
int Restore_(CRestore &restore);
void SetObjectCollisionBox_(void);
void DeathNotice_(entvars_t *pevChild) {}
void TraceAttack_(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType);
int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
int TakeHealth_(float flHealth, int bitsDamageType);
void Killed_(entvars_t *pevAttacker, int iGib);
void TraceBleed_(float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType);
int GetToggleState_(void)
{
return TS_AT_TOP;
}
float GetDelay_(void)
{
return 0.0f;
}
int DamageDecal_(int bitsDamageType);
BOOL IsInWorld_(void);
CBaseEntity *GetNextTarget_(void);
Vector BodyTarget_(const Vector &posSrc)
{
return Center();
}
BOOL FVisible_(CBaseEntity *pEntity);
BOOL FVisible_(const Vector &vecOrigin);
@ -643,16 +627,12 @@ public:
virtual void Spawn(void);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
#ifdef HOOK_GAMEDLL
void Spawn_(void);
int ObjectCaps_(void)
{
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
#endif // HOOK_GAMEDLL
@ -667,7 +647,7 @@ public:
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return (CPointEntity::ObjectCaps() | FCAP_MASTER);
}
virtual BOOL IsTriggered(CBaseEntity *pActivator);
virtual int Save(CSave &save);
@ -678,10 +658,6 @@ public:
void Spawn_(void);
void KeyValue_(KeyValueData *pkvd);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
int ObjectCaps_(void)
{
return (CPointEntity::ObjectCaps() | FCAP_MASTER);
}
BOOL IsTriggered_(CBaseEntity *pActivator);
int Save_(CSave &save);
int Restore_(CRestore &restore);
@ -797,6 +773,7 @@ public:
int Restore_(CRestore &restore);
#endif // HOOK_GAMEDLL
public:
void LinearMove(Vector vecDest, float flSpeed);
void EXPORT LinearMoveDone(void);
@ -857,7 +834,12 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
if (pev->takedamage == DAMAGE_NO)
{
return FCAP_IMPULSE_USE;
}
return (CBaseToggle::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
#ifdef HOOK_GAMEDLL
@ -868,15 +850,6 @@ public:
int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
if (pev->takedamage == DAMAGE_NO)
{
return FCAP_IMPULSE_USE;
}
return (CBaseToggle::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
#endif // HOOK_GAMEDLL
@ -956,25 +929,12 @@ class CCorpse: public CBaseEntity
public:
/* <1dabe0> ../cstrike/dlls/world.cpp:209 */
virtual int ObjectCaps(void)
{
ObjectCaps_();
}
#ifdef HOOK_GAMEDLL
int ObjectCaps_(void)
{
return FCAP_DONT_SAVE;
}
#endif // HOOK_GAMEDLL
};/* size: 152, cachelines: 3, members: 1 */
template <class T>
T *GetClassPtr(T *a)
{
@ -987,7 +947,7 @@ T *GetClassPtr(T *a)
a = new(pev) T;
a->pev = pev;
#if defined(_WIN32) && !defined(REGAMEDLL_UNIT_TESTS)
#if defined(HOOK_GAMEDLL) && defined(_WIN32) && !defined(REGAMEDLL_UNIT_TESTS)
VirtualTableInit((void *)a, stripClass(typeid(T).name()));
#endif // _WIN32 && HOOK_GAMEDLL
@ -1005,9 +965,9 @@ void REMOVE_ENTITY(edict_t *e);
void CONSOLE_ECHO_(char *pszMsg, ...);
void loopPerformance(void);
extern "C" C_EXPORT int GetEntityAPI(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion);
NOXREF extern "C" C_EXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion);
extern "C" C_EXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion);
C_DLLEXPORT int GetEntityAPI(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion);
NOXREF int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion);
C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion);
int DispatchSpawn(edict_t *pent);
void DispatchKeyValue(edict_t *pentKeyvalue, KeyValueData *pkvd);

View File

@ -26,7 +26,7 @@ char *sPlayerModelFiles[] =
"models/player/militia/militia.mdl" // CZ
};
bool g_skipCareerInitialSpawn;
bool g_skipCareerInitialSpawn = false;
static entity_field_alias_t entity_field_alias[] =
{
@ -43,7 +43,7 @@ static entity_field_alias_t player_field_alias[] =
{ "origin[0]", 0 },
{ "origin[1]", 0 },
{ "origin[2]", 0 },
}
};
static entity_field_alias_t custom_entity_field_alias[] =
{
@ -56,7 +56,7 @@ static entity_field_alias_t custom_entity_field_alias[] =
{ "skin", 0 },
{ "sequence", 0 },
{ "animtime", 0 },
}
};
static int g_serveractive = 0;
@ -184,7 +184,7 @@ void ClientDisconnect(edict_t *pEntity)
g_pGameRules->ClientDisconnected(pEntity);
}
if (pPlayer && pPlayer->IsBot())
if (TheBots != NULL && pPlayer && pPlayer->IsBot())
{
TheBots->ClientDisconnect(pPlayer);
}
@ -592,7 +592,11 @@ void ClientPutInServer(edict_t *pEntity)
pPlayer->pev->angles = gpGlobals->v_forward;
}
TheBots->OnEvent(EVENT_PLAYER_CHANGED_TEAM, (CBaseEntity *)pPlayer);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_PLAYER_CHANGED_TEAM, (CBaseEntity *)pPlayer);
}
pPlayer->m_iJoiningState = SHOWLTEXT;
static char sName[128];
@ -1085,7 +1089,7 @@ void BuyPistol(CBasePlayer *pPlayer, int iSlot)
pPlayer->GiveNamedItem(pszWeapon);
pPlayer->AddAccount(-iWeaponPrice);
if (TheTutor)
if (TheTutor != NULL)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer);
}
@ -1147,7 +1151,7 @@ void BuyShotgun(CBasePlayer *pPlayer, int iSlot)
pPlayer->GiveNamedItem(pszWeapon);
pPlayer->AddAccount(-iWeaponPrice);
if (TheTutor)
if (TheTutor != NULL)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer);
}
@ -1233,7 +1237,7 @@ void BuySubMachineGun(CBasePlayer *pPlayer, int iSlot)
pPlayer->GiveNamedItem(pszWeapon);
pPlayer->AddAccount(-iWeaponPrice);
if (TheTutor)
if (TheTutor != NULL)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer);
}
@ -1282,7 +1286,7 @@ void BuyWeaponByWeaponID(CBasePlayer *pPlayer, WeaponIdType weaponID)
pPlayer->GiveNamedItem(info->entityName);
pPlayer->AddAccount(-info->cost);
if (TheTutor)
if (TheTutor != NULL)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer);
}
@ -1436,7 +1440,7 @@ void BuyRifle(CBasePlayer *pPlayer, int iSlot)
pPlayer->GiveNamedItem(pszWeapon);
pPlayer->AddAccount(-iWeaponPrice);
if (TheTutor)
if (TheTutor != NULL)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer);
}
@ -1480,7 +1484,7 @@ void BuyMachineGun(CBasePlayer *pPlayer, int iSlot)
pPlayer->GiveNamedItem(pszWeapon);
pPlayer->AddAccount(-iWeaponPrice);
if (TheTutor)
if (TheTutor != NULL)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer);
}
@ -1783,7 +1787,7 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot)
pPlayer->AddAccount(-iItemPrice);
}
if (TheTutor)
if (TheTutor != NULL)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer);
}
@ -2096,7 +2100,10 @@ BOOL HandleMenu_ChooseTeam(CBasePlayer *player, int slot)
player->m_pIntroCamera = NULL;
player->m_bTeamChanged = true;
TheBots->OnEvent(EVENT_PLAYER_CHANGED_TEAM, player);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_PLAYER_CHANGED_TEAM, player);
}
TeamChangeUpdate(player, player->m_iTeam);
@ -2260,7 +2267,10 @@ BOOL HandleMenu_ChooseTeam(CBasePlayer *player, int slot)
oldTeam = player->m_iTeam;
player->m_iTeam = team;
TheBots->OnEvent(EVENT_PLAYER_CHANGED_TEAM, player);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_PLAYER_CHANGED_TEAM, player);
}
TeamChangeUpdate(player, team);
@ -2326,7 +2336,10 @@ void Radio1(CBasePlayer *player, int slot)
break;
}
TheBots->OnEvent((GameEventType)(EVENT_START_RADIO_1 + slot), player);
if (TheBots != NULL)
{
TheBots->OnEvent((GameEventType)(EVENT_START_RADIO_1 + slot), player);
}
}
/* <474ca> ../cstrike/dlls/client.cpp:2596 */
@ -2367,7 +2380,10 @@ void Radio2(CBasePlayer *player, int slot)
break;
}
TheBots->OnEvent((GameEventType)(EVENT_START_RADIO_2 + slot), player);
if (TheBots != NULL)
{
TheBots->OnEvent((GameEventType)(EVENT_START_RADIO_2 + slot), player);
}
}
/* <474f4> ../cstrike/dlls/client.cpp:2639 */
@ -2421,7 +2437,10 @@ void Radio3(CBasePlayer *player, int slot)
break;
}
TheBots->OnEvent((GameEventType)(EVENT_START_RADIO_3 + slot), player);
if (TheBots != NULL)
{
TheBots->OnEvent((GameEventType)(EVENT_START_RADIO_3 + slot), player);
}
}
/* <49402> ../cstrike/dlls/client.cpp:2698 */
@ -3128,7 +3147,7 @@ void ClientCommand(edict_t *pEntity)
if (player->m_signals.GetState() & SIGNAL_BUY)
{
if (TheTutor)
if (TheTutor != NULL)
{
TheTutor->OnEvent(EVENT_TUTOR_BUY_MENU_OPENNED);
}
@ -3277,7 +3296,7 @@ void ClientCommand(edict_t *pEntity)
while (BuyAmmo(player, PRIMARY_WEAPON_SLOT, false))
;
if (TheTutor)
if (TheTutor != NULL)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, player);
}
@ -3296,7 +3315,7 @@ void ClientCommand(edict_t *pEntity)
while (BuyAmmo(player, PISTOL_SLOT, false))
;
if (TheTutor)
if (TheTutor != NULL)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, player);
}
@ -3531,8 +3550,11 @@ void ClientCommand(edict_t *pEntity)
if (mp->ClientCommand_DeadOrAlive(GetClassPtr((CBasePlayer *)pev), pcmd))
return;
if (TheBots->ClientCommand(GetClassPtr((CBasePlayer *)pev), pcmd))
return;
if (TheBots != NULL)
{
if (TheBots->ClientCommand(GetClassPtr((CBasePlayer *)pev), pcmd))
return;
}
if (FStrEq(pcmd, "mp_debug"))
{
@ -3701,7 +3723,8 @@ void ClientCommand(edict_t *pEntity)
{
BuyAmmo(player, PRIMARY_WEAPON_SLOT, true);
player->BuildRebuyStruct();
if (TheTutor)
if (TheTutor != NULL)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, player);
}
@ -3713,7 +3736,8 @@ void ClientCommand(edict_t *pEntity)
{
BuyAmmo(player, PISTOL_SLOT, true);
player->BuildRebuyStruct();
if (TheTutor)
if (TheTutor != NULL)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, player);
}
@ -3748,7 +3772,7 @@ void ClientCommand(edict_t *pEntity)
ShowVGUIMenu(player, VGUI_Menu_Buy, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4 | MENU_KEY_5 | MENU_KEY_6 | MENU_KEY_7 | MENU_KEY_8 | MENU_KEY_0), "#Buy");
player->m_iMenu = Menu_Buy;
if (TheBots)
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_TUTOR_BUY_MENU_OPENNED);
}
@ -3910,9 +3934,13 @@ void ServerDeactivate(void)
// Peform any shutdown operations here...
g_pGameRules->ServerDeactivate();
CLocalNav::Reset();
TheBots->ServerDeactivate();
if (g_pHostages)
if (TheBots != NULL)
{
TheBots->ServerDeactivate();
}
if (g_pHostages != NULL)
{
g_pHostages->ServerDeactivate();
}
@ -3956,14 +3984,17 @@ void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
LinkUserMessages();
WriteSigonMessages();
if (g_pGameRules)
if (g_pGameRules != NULL)
{
g_pGameRules->CheckMapConditions();
}
TheBots->ServerActivate();
if (TheBots != NULL)
{
TheBots->ServerActivate();
}
if (g_pHostages)
if (g_pHostages != NULL)
{
g_pHostages->ServerActivate();
}
@ -4038,9 +4069,12 @@ void StartFrame(void)
else
g_iSkillLevel = 0;
TheBots->StartFrame();
if (TheBots != NULL)
{
TheBots->StartFrame();
}
if (TheTutor)
if (TheTutor != NULL)
{
TheTutor->StartFrame(gpGlobals->time);
}
@ -4175,14 +4209,17 @@ void ClientPrecache(void)
for (i = 0; i < numPlayerModels; i++)
PRECACHE_MODEL(sPlayerModelFiles[i]);
for (i = FirstCustomSkin; i <= LastCustomSkin; i++)
if (isCZero)
{
const char *fname = TheBotProfiles->GetCustomSkinFname(i);
for (i = FirstCustomSkin; i <= LastCustomSkin; i++)
{
const char *fname = TheBotProfiles->GetCustomSkinFname(i);
if (!fname)
break;
if (!fname)
break;
PRECACHE_MODEL((char *)fname);
PRECACHE_MODEL((char *)fname);
}
}
PRECACHE_MODEL("models/p_ak47.mdl");
@ -4237,14 +4274,17 @@ void ClientPrecache(void)
for (i = 0; i < numPlayerModels; i++)
ENGINE_FORCE_UNMODIFIED(force_model_specifybounds, (float *)&vMin, (float *)&vMax, sPlayerModelFiles[i]);
for (i = FirstCustomSkin; i <= LastCustomSkin; i++)
if (isCZero)
{
const char *fname = TheBotProfiles->GetCustomSkinFname(i);
for (i = FirstCustomSkin; i <= LastCustomSkin; i++)
{
const char *fname = TheBotProfiles->GetCustomSkinFname(i);
if (!fname)
break;
if (!fname)
break;
ENGINE_FORCE_UNMODIFIED(force_model_specifybounds_if_avail, (float *)&vMin, (float *)&vMax, fname);
ENGINE_FORCE_UNMODIFIED(force_model_specifybounds_if_avail, (float *)&vMin, (float *)&vMax, fname);
}
}
ENGINE_FORCE_UNMODIFIED(force_exactfile, (float *)&temp, (float *)&temp, "sprites/black_smoke1.spr");

View File

@ -126,8 +126,6 @@ typedef struct
extern PLAYERPVSSTATUS g_PVSStatus[32];
#ifdef HOOK_GAMEDLL
extern float g_flTimeLimit;// exported
extern float g_flResetTime;
extern bool g_bClientPrintEnable;
@ -140,8 +138,6 @@ extern entity_field_alias_t player_field_alias[3];
extern entity_field_alias_t custom_entity_field_alias[9];
extern int g_serveractive;
#endif // HOOK_GAMEDLL
extern unsigned short m_usResetDecals;
extern unsigned short g_iShadowSprite;

View File

@ -1066,7 +1066,7 @@ void RadiusFlash(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker,
pPlayer->Blind(fadeTime * 0.33, fadeHold, fadeTime, alpha);
if (TheBots)
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_PLAYER_BLINDED_BY_FLASHBANG, pPlayer);
}
@ -1773,7 +1773,7 @@ Vector CBaseEntity::FireBullets3(Vector vecSrc, Vector vecDirShooting, float vec
ClearMultiDamage();
UTIL_TraceLine(vecSrc, vecEnd, dont_ignore_monsters, ENT(pev), &tr);
if (tr.flFraction != 1.0f)
if (TheBots != NULL && tr.flFraction != 1.0f)
{
TheBots->OnEvent(EVENT_BULLET_IMPACT, this, (CBaseEntity *)&tr.vecEndPos);
}

View File

@ -538,7 +538,10 @@ void CBaseDoor::DoorGoUp(void)
EMIT_SOUND(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noiseMoving), VOL_NORM, ATTN_NORM);
}
TheBots->OnEvent(EVENT_DOOR, m_hActivator);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_DOOR, m_hActivator);
}
}
}
@ -689,7 +692,10 @@ void CBaseDoor::DoorGoDown(void)
EMIT_SOUND(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noiseMoving), VOL_NORM, ATTN_NORM);
}
TheBots->OnEvent(EVENT_DOOR, m_hActivator);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_DOOR, m_hActivator);
}
}
}

View File

@ -60,7 +60,10 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
if (pev->spawnflags & SF_ITEM_USE_ONLY)
return (CBaseToggle::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_IMPULSE_USE;
else
return (CBaseToggle::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
virtual void SetToggleState(int state);
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -74,13 +77,6 @@ public:
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
if (pev->spawnflags & SF_ITEM_USE_ONLY)
return (CBaseToggle::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_IMPULSE_USE;
else
return (CBaseToggle::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
void SetToggleState_(int state);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
void Blocked_(CBaseEntity *pOther);
@ -145,7 +141,7 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return CBaseToggle::ObjectCaps() & ~FCAP_ACROSS_TRANSITION;
}
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -156,10 +152,6 @@ public:
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return CBaseToggle::ObjectCaps() & ~FCAP_ACROSS_TRANSITION;
}
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
@ -174,10 +166,14 @@ public:
void PlayLockSounds(entvars_t *pev, locksound_t *pls, int flocked, int fbutton);
#ifdef HOOK_GAMEDLL
// linked objects
C_DLLEXPORT void func_door(entvars_t *pev);
C_DLLEXPORT void func_water(entvars_t *pev);
C_DLLEXPORT void func_door_rotating(entvars_t *pev);
C_DLLEXPORT void momentary_door(entvars_t *pev);
#endif // HOOK_GAMEDLL
#endif // DOORS_H

View File

@ -79,7 +79,11 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
int flags = 0;
if (pev->spawnflags & SF_SPRITE_TEMPORARY)
flags = FCAP_DONT_SAVE;
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | flags;
}
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -90,14 +94,6 @@ public:
void Restart_(void);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
int flags = 0;
if (pev->spawnflags & SF_SPRITE_TEMPORARY)
flags = FCAP_DONT_SAVE;
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | flags;
}
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
@ -180,19 +176,6 @@ public:
virtual void Spawn(void);
virtual void Precache(void);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
}
virtual Vector Center(void)
{
return Center_();
}
#ifdef HOOK_GAMEDLL
void Spawn_(void);
void Precache_(void);
int ObjectCaps_(void)
{
int flags = 0;
if (pev->spawnflags & SF_BEAM_TEMPORARY)
@ -200,11 +183,16 @@ public:
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | flags;
}
Vector Center_(void)
virtual Vector Center(void)
{
return (GetStartPos() + GetEndPos()) * 0.5;
}
#ifdef HOOK_GAMEDLL
void Spawn_(void);
void Precache_(void);
#endif // HOOK_GAMEDLL
public:
@ -388,7 +376,7 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -399,10 +387,6 @@ public:
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
@ -640,22 +624,22 @@ public:
public:
/* <7205b> ../cstrike/dlls/effects.cpp:1776 */
inline int Color(void)
int Color(void)
{
return pev->impulse;
}
/* <72079> ../cstrike/dlls/effects.cpp:1777 */
inline float BloodAmount(void)
float BloodAmount(void)
{
return pev->dmg;
}
/* <72092> ../cstrike/dlls/effects.cpp:1779 */
inline void SetColor(int color)
void SetColor(int color)
{
pev->impulse = color;
}
/* <720b7> ../cstrike/dlls/effects.cpp:1780 */
inline void SetBloodAmount(float amount)
void SetBloodAmount(float amount)
{
pev->dmg = amount;
}
@ -684,42 +668,42 @@ public:
public:
/* <7210f> ../cstrike/dlls/effects.cpp:1893 */
inline float Amplitude(void)
float Amplitude(void)
{
return pev->scale;
}
/* <7212d> ../cstrike/dlls/effects.cpp:1894 */
inline float Frequency(void)
float Frequency(void)
{
return pev->dmg_save;
}
/* <72146> ../cstrike/dlls/effects.cpp:1895 */
inline float Duration(void)
float Duration(void)
{
return pev->dmg_take;
}
/* <7215f> ../cstrike/dlls/effects.cpp:1896 */
inline float Radius(void)
float Radius(void)
{
return pev->dmg;
}
/* <72178> ../cstrike/dlls/effects.cpp:1898 */
inline void SetAmplitude(float amplitude)
void SetAmplitude(float amplitude)
{
pev->scale = amplitude;
}
/* <7219d> ../cstrike/dlls/effects.cpp:1899 */
inline void SetFrequency(float frequency)
void SetFrequency(float frequency)
{
pev->dmg_save = frequency;
}
/* <721c2> ../cstrike/dlls/effects.cpp:1900 */
inline void SetDuration(float duration)
void SetDuration(float duration)
{
pev->dmg_take = duration;
}
/* <721e7> ../cstrike/dlls/effects.cpp:1901 */
inline void SetRadius(float radius)
void SetRadius(float radius)
{
pev->dmg = radius;
}
@ -744,22 +728,22 @@ public:
public:
/* <72231> ../cstrike/dlls/effects.cpp:1971 */
inline float Duration(void)
float Duration(void)
{
return pev->dmg_take;
}
/* <7224f> ../cstrike/dlls/effects.cpp:1972 */
inline float HoldTime(void)
float HoldTime(void)
{
return pev->dmg_save;
}
/* <72268> ../cstrike/dlls/effects.cpp:1974 */
inline void SetDuration(float duration)
void SetDuration(float duration)
{
pev->dmg_take = duration;
}
/* <7228d> ../cstrike/dlls/effects.cpp:1975 */
inline void SetHoldTime(float hold)
void SetHoldTime(float hold)
{
pev->dmg_save = hold;
}
@ -847,6 +831,8 @@ public:
int IsPointEntity(CBaseEntity *pEnt);
#ifdef HOOK_GAMEDLL
// linked objects
C_DLLEXPORT void info_target(entvars_t *pev);
C_DLLEXPORT void env_bubbles(entvars_t *pev);
@ -868,4 +854,6 @@ C_DLLEXPORT void env_funnel(entvars_t *pev);
C_DLLEXPORT void env_beverage(entvars_t *pev);
C_DLLEXPORT void item_sodacan(entvars_t *pev);
#endif // HOOK_GAMEDLL
#endif // EFFECTS_H

View File

@ -46,7 +46,7 @@ public:
virtual void Spawn(void);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return FCAP_DONT_SAVE;
}
virtual void Think(void);
virtual void Touch(CBaseEntity *pOther);
@ -54,10 +54,6 @@ public:
#ifdef HOOK_GAMEDLL
void Spawn_(void);
int ObjectCaps_(void)
{
return FCAP_DONT_SAVE;
}
void Think_(void);
void Touch_(CBaseEntity *pOther);
@ -99,8 +95,12 @@ public:
void ExplosionCreate(const Vector &center, Vector &angles, edict_t *pOwner, int magnitude, BOOL doDamage);
#ifdef HOOK_GAMEDLL
// linked objects
C_DLLEXPORT void spark_shower(entvars_t *pev);
C_DLLEXPORT void env_explosion(entvars_t *pev);
#endif // HOOK_GAMEDLL
#endif // EXPLODE_H

View File

@ -708,9 +708,12 @@ void CBreakable::Die(void)
break;
}
cFlag = BREAK_GLASS;
TheBots->OnEvent(EVENT_BREAK_GLASS, this);
break;
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_BREAK_GLASS, this);
}
break;
case matWood:
switch (RANDOM_LONG(0, 1))
{
@ -720,7 +723,11 @@ void CBreakable::Die(void)
break;
}
cFlag = BREAK_WOOD;
TheBots->OnEvent(EVENT_BREAK_WOOD, this);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_BREAK_WOOD, this);
}
break;
case matMetal:
@ -733,7 +740,11 @@ void CBreakable::Die(void)
break;
}
cFlag = BREAK_METAL;
TheBots->OnEvent(EVENT_BREAK_METAL, this);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_BREAK_METAL, this);
}
break;
case matFlesh:
@ -745,7 +756,11 @@ void CBreakable::Die(void)
break;
}
cFlag = BREAK_FLESH;
TheBots->OnEvent(EVENT_BREAK_FLESH, this);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_BREAK_FLESH, this);
}
break;
case matCinderBlock:
@ -758,7 +773,11 @@ void CBreakable::Die(void)
break;
}
cFlag = BREAK_CONCRETE;
TheBots->OnEvent(EVENT_BREAK_CONCRETE, this);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_BREAK_CONCRETE, this);
}
break;
case matCeilingTile:

View File

@ -92,7 +92,7 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
// To spark when hit
@ -112,10 +112,6 @@ public:
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
void TraceAttack_(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType);
int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
int DamageDecal_(int bitsDamageType);
@ -132,15 +128,15 @@ public:
void EXPORT Die(void);
inline BOOL Explodable(void)
BOOL Explodable(void)
{
return ExplosionMagnitude() > 0;
}
inline int ExplosionMagnitude(void)
int ExplosionMagnitude(void)
{
return pev->impulse;
}
inline void ExplosionSetMagnitude(int magnitude)
void ExplosionSetMagnitude(int magnitude)
{
pev->impulse = magnitude;
}
@ -180,7 +176,7 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_CONTINUOUS_USE;
}
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual void Touch(CBaseEntity *pOther);
@ -193,10 +189,6 @@ public:
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_CONTINUOUS_USE;
}
int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
void Touch_(CBaseEntity *pOther);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -215,7 +207,7 @@ public:
}
#endif
}
inline float MaxSpeed(void)
float MaxSpeed(void)
{
return m_maxSpeed;
}
@ -232,8 +224,12 @@ public:
};/* size: 200, cachelines: 4, members: 6 */
#ifdef HOOK_GAMEDLL
// linked objects
C_DLLEXPORT void func_breakable(entvars_t *pev);
C_DLLEXPORT void func_pushable(entvars_t *pev);
#endif // HOOK_GAMEDLL
#endif // FUNC_BREAK_H

View File

@ -61,7 +61,7 @@ public:
// Bmodels don't go across transitions
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION;
}
virtual BOOL OnControls(entvars_t *pevTest);
virtual void Think(void);
@ -79,10 +79,6 @@ public:
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION;
}
BOOL OnControls_(entvars_t *pevTest);
void Think_(void);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -95,23 +91,23 @@ public:
void StartRotSound(void);
void StopRotSound(void);
inline BOOL IsActive(void)
BOOL IsActive(void)
{
return (pev->spawnflags & SF_TANK_ACTIVE) == SF_TANK_ACTIVE;
}
inline void TankActivate(void)
void TankActivate(void)
{
pev->spawnflags |= SF_TANK_ACTIVE;
pev->nextthink = pev->ltime + 0.1f;
m_fireLast = 0.0f;
}
inline void TankDeactivate(void)
void TankDeactivate(void)
{
pev->spawnflags &= ~SF_TANK_ACTIVE;
m_fireLast = 0.0f;
StopRotSound();
}
inline BOOL CanFire(void)
BOOL CanFire(void)
{
return (gpGlobals->time - m_lastSightTime) < m_persist;
}
@ -262,7 +258,7 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_IMPULSE_USE;
}
virtual void Think(void);
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -272,10 +268,6 @@ public:
void Spawn_(void);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_IMPULSE_USE;
}
void Think_(void);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -296,6 +288,8 @@ extern Vector gTankSpread[5];
#endif // HOOK_GAMEDLL
#ifdef HOOK_GAMEDLL
// linked objects
C_DLLEXPORT void func_tank(entvars_t *pev);
C_DLLEXPORT void func_tanklaser(entvars_t *pev);
@ -303,4 +297,6 @@ C_DLLEXPORT void func_tankrocket(entvars_t *pev);
C_DLLEXPORT void func_tankmortar(entvars_t *pev);
C_DLLEXPORT void func_tankcontrols(entvars_t *pev);
#endif // HOOK_GAMEDLL
#endif // FUNC_TANK_H

View File

@ -16,7 +16,7 @@ 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 fragsleft = { "mp_fragsleft", "", FCVAR_SERVER | FCVAR_UNLOGGED, 0.0f, NULL };
cvar_t fragsleft = { "mp_fragsleft", "0", FCVAR_SERVER | FCVAR_UNLOGGED, 0.0f, NULL };
cvar_t timeleft = { "mp_timeleft", "0", FCVAR_SERVER | FCVAR_UNLOGGED, 0.0f, NULL };
cvar_t friendlyfire = { "mp_friendlyfire", "0", FCVAR_SERVER, 0.0f, NULL };
cvar_t allowmonsters = { "mp_allowmonsters", "0", FCVAR_SERVER, 0.0f, NULL };
@ -47,7 +47,7 @@ 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", "0", 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 };

View File

@ -68,7 +68,7 @@ BOOL CGameRules::__MAKE_VHOOK(CanHavePlayerItem)(CBasePlayer *pPlayer, CBasePlay
CCSBotManager *ctrl = TheCSBots();
if (pPlayer->IsBot() && !ctrl->IsWeaponUseable(pWeapon))
if (pPlayer->IsBot() && ctrl != NULL && !ctrl->IsWeaponUseable(pWeapon))
{
return FALSE;
}
@ -124,24 +124,26 @@ void CGameRules::__MAKE_VHOOK(RefreshSkillData)(void)
void (*pInstallGameRules)(void);
/* <ada23> ../cstrike/dlls/gamerules.cpp:157 */
#ifdef HOOK_GAMEDLL
NOBODY __declspec(naked) CGameRules *InstallGameRules(void)
{
__asm
{
jmp pInstallGameRules
}
#if 0
}
#else
CGameRules *InstallGameRules(void)
{
SERVER_COMMAND("exec game.cfg\n");
SERVER_EXECUTE();
if (!gpGlobals->deathmatch)
{
return new CHalfLifeTraining;
}
return new CHalfLifeMultiplay;
#endif
}
#endif // HOOK_GAMEDLL
#ifdef HOOK_GAMEDLL

View File

@ -184,12 +184,12 @@ public:
virtual BOOL IsDeathmatch(void) = 0;
virtual BOOL IsTeamplay(void)
{
return IsTeamplay_();
return FALSE;
}
virtual BOOL IsCoOp(void) = 0;
virtual const char *GetGameDescription(void)
{
return GetGameDescription_();
return "Counter-Strike";
}
virtual BOOL ClientConnected(edict_t *pEntity, const char *pszName, const char *pszAddress, char *szRejectReason) = 0;
virtual void InitHUD(CBasePlayer *pl) = 0;
@ -198,11 +198,11 @@ public:
virtual float FlPlayerFallDamage(CBasePlayer *pPlayer) = 0;
virtual BOOL FPlayerCanTakeDamage(CBasePlayer *pPlayer, CBaseEntity *pAttacker)
{
return FPlayerCanTakeDamage_(pPlayer, pAttacker);
return TRUE;
}
virtual BOOL ShouldAutoAim(CBasePlayer *pPlayer, edict_t *target)
{
return ShouldAutoAim_(pPlayer, target);
return TRUE;
}
virtual void PlayerSpawn(CBasePlayer *pPlayer) = 0;
virtual void PlayerThink(CBasePlayer *pPlayer) = 0;
@ -211,15 +211,15 @@ public:
virtual edict_t *GetPlayerSpawnSpot(CBasePlayer *pPlayer);
virtual BOOL AllowAutoTargetCrosshair(void)
{
return AllowAutoTargetCrosshair_();
return TRUE;
}
virtual BOOL ClientCommand_DeadOrAlive(CBasePlayer *pPlayer, const char *pcmd)
{
return ClientCommand_DeadOrAlive_(pPlayer, pcmd);
return FALSE;
}
virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd)
{
return ClientCommand_(pPlayer, pcmd);
return FALSE;
}
virtual void ClientUserInfoChanged(CBasePlayer *pPlayer, char *infobuffer) {};
virtual int IPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled) = 0;
@ -244,7 +244,7 @@ public:
virtual float FlHealthChargerRechargeTime(void) = 0;
virtual float FlHEVChargerRechargeTime(void)
{
return FlHEVChargerRechargeTime_();
return 0.0f;
}
virtual int DeadPlayerWeapons(CBasePlayer *pPlayer) = 0;
virtual int DeadPlayerAmmo(CBasePlayer *pPlayer) = 0;
@ -252,24 +252,24 @@ public:
virtual int PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget) = 0;
virtual int GetTeamIndex(const char *pTeamName)
{
return GetTeamIndex_(pTeamName);
return -1;
}
virtual const char *GetIndexedTeamName(int teamIndex)
{
return GetIndexedTeamName_(teamIndex);
return "";
}
virtual BOOL IsValidTeam(const char *pTeamName)
{
return IsValidTeam_(pTeamName);
return TRUE;
}
virtual void ChangePlayerTeam(CBasePlayer *pPlayer, const char *pTeamName, BOOL bKill, BOOL bGib) {};
virtual const char *SetDefaultPlayerTeam(CBasePlayer *pPlayer)
{
return SetDefaultPlayerTeam_(pPlayer);
return "";
}
virtual BOOL PlayTextureSounds(void)
{
return PlayTextureSounds_();
return TRUE;
}
virtual BOOL FAllowMonsters(void) = 0;
virtual void EndMultiplayerGame(void) {};
@ -277,7 +277,7 @@ public:
// Stuff that is shared between client and server.
virtual BOOL IsFreezePeriod(void)
{
return IsFreezePeriod_();
return m_bFreezePeriod;
}
virtual void ServerDeactivate(void) {};
virtual void CheckMapConditions(void) {};
@ -285,65 +285,9 @@ public:
#ifdef HOOK_GAMEDLL
void RefreshSkillData_(void);
BOOL IsTeamplay_(void)
{
return FALSE;
}
const char *GetGameDescription_(void)
{
return "Counter-Strike";
}
BOOL FPlayerCanTakeDamage_(CBasePlayer *pPlayer, CBaseEntity *pAttacker)
{
return TRUE;
}
BOOL ShouldAutoAim_(CBasePlayer *pPlayer, edict_t *target)
{
return TRUE;
}
edict_t *GetPlayerSpawnSpot_(CBasePlayer *pPlayer);
BOOL AllowAutoTargetCrosshair_(void)
{
return TRUE;
}
BOOL ClientCommand_DeadOrAlive_(CBasePlayer *pPlayer, const char *pcmd)
{
return FALSE;
}
BOOL ClientCommand_(CBasePlayer *pPlayer, const char *pcmd)
{
return FALSE;
}
BOOL CanHavePlayerItem_(CBasePlayer *pPlayer, CBasePlayerItem *pItem);
BOOL CanHaveAmmo_(CBasePlayer *pPlayer, const char *pszAmmoName, int iMaxCarry);
float FlHEVChargerRechargeTime_(void)
{
return 0.0f;
}
int GetTeamIndex_(const char *pTeamName)
{
return -1;
}
const char *GetIndexedTeamName_(int teamIndex)
{
return "";
}
BOOL IsValidTeam_(const char *pTeamName)
{
return TRUE;
}
const char *SetDefaultPlayerTeam_(CBasePlayer *pPlayer)
{
return "";
}
BOOL PlayTextureSounds_(void)
{
return TRUE;
}
BOOL IsFreezePeriod_(void)
{
return m_bFreezePeriod;
}
#endif // HOOK_GAMEDLL
@ -364,7 +308,7 @@ public:
virtual BOOL FAllowFlashlight(void)
{
return TRUE;
};
}
virtual BOOL FShouldSwitchWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon);
virtual BOOL GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon);
virtual BOOL IsMultiplayer(void);
@ -411,10 +355,6 @@ public:
void Think_(void);
BOOL IsAllowedToSpawn_(CBaseEntity *pEntity);
BOOL FAllowFlashlight_(void)
{
return TRUE;
};
BOOL FShouldSwitchWeapon_(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon);
BOOL GetNextBestWeapon_(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon);
BOOL IsMultiplayer_(void);
@ -450,10 +390,6 @@ public:
float FlHealthChargerRechargeTime_(void);
int DeadPlayerWeapons_(CBasePlayer *pPlayer);
int DeadPlayerAmmo_(CBasePlayer *pPlayer);
const char *GetTeamID_(CBaseEntity *pEntity)
{
return "";
};
int PlayerRelationship_(CBasePlayer *pPlayer, CBaseEntity *pTarget);
BOOL FAllowMonsters_(void);
@ -516,17 +452,17 @@ public:
virtual int DeadPlayerAmmo(CBasePlayer *pPlayer);
virtual const char *GetTeamID(CBaseEntity *pEntity)
{
return GetTeamID_(pEntity);
return "";
}
virtual int PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget);
virtual BOOL PlayTextureSounds(void)
{
return PlayTextureSounds_();
return FALSE;
}
virtual BOOL FAllowMonsters(void);
virtual void EndMultiplayerGame(void)
{
EndMultiplayerGame_();
GoToIntermission();
}
virtual void ServerDeactivate(void);
virtual void CheckMapConditions(void);
@ -591,20 +527,8 @@ public:
float FlHEVChargerRechargeTime_(void);
int DeadPlayerWeapons_(CBasePlayer *pPlayer);
int DeadPlayerAmmo_(CBasePlayer *pPlayer);
const char *GetTeamID_(CBaseEntity *pEntity)
{
return "";
}
int PlayerRelationship_(CBasePlayer *pPlayer, CBaseEntity *pTarget);
BOOL PlayTextureSounds_(void)
{
return FALSE;
}
BOOL FAllowMonsters_(void);
void EndMultiplayerGame_(void)
{
GoToIntermission();
}
void ServerDeactivate_(void);
void CheckMapConditions_(void);
void CleanUpMap_(void);
@ -796,6 +720,7 @@ typedef struct mapcycle_item_s
int minplayers;
int maxplayers;
char rulebuffer[MAX_RULE_BUFFER];
} mapcycle_item_t;
/* size: 1068, cachelines: 17, members: 5 */
@ -888,7 +813,11 @@ int GetMapCount(void);
// refs
extern void (*pInstallGameRules)(void);
#ifdef HOOK_GAMEDLL
// linked objects
C_DLLEXPORT void info_map_parameters(entvars_t *pev);
#endif // HOOK_GAMEDLL
#endif // GAMERULES_H

View File

@ -67,7 +67,10 @@ void CGrenade::Explode(TraceResult *pTrace, int bitsDamageType)
else
pevOwner = NULL;
TheBots->OnEvent(EVENT_FLASHBANG_GRENADE_EXPLODED, CBaseEntity::Instance(pev->owner), (CBaseEntity *)&pev->origin);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_FLASHBANG_GRENADE_EXPLODED, CBaseEntity::Instance(pev->owner), (CBaseEntity *)&pev->origin);
}
// can't traceline attack owner if this is set
pev->owner = NULL;
@ -118,7 +121,10 @@ void CGrenade::Explode2(TraceResult *pTrace, int bitsDamageType)
if (mp->IsCareer())
{
TheCareerTasks->LatchRoundEndMessage();
if (TheCareerTasks != NULL)
{
TheCareerTasks->LatchRoundEndMessage();
}
}
m_bJustBlew = true;
@ -185,7 +191,10 @@ void CGrenade::Explode2(TraceResult *pTrace, int bitsDamageType)
if (mp->IsCareer())
{
TheCareerTasks->UnlatchRoundEndMessage();
if (TheCareerTasks != NULL)
{
TheCareerTasks->UnlatchRoundEndMessage();
}
}
// tell director about it
@ -271,7 +280,10 @@ void CGrenade::Explode3(TraceResult *pTrace, int bitsDamageType)
else
pevOwner = NULL;
TheBots->OnEvent(EVENT_HE_GRENADE_EXPLODED, CBaseEntity::Instance(pev->owner));
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_HE_GRENADE_EXPLODED, CBaseEntity::Instance(pev->owner));
}
pev->owner = NULL;
RadiusDamage(pev, pevOwner, pev->dmg, CLASS_NONE, bitsDamageType);
@ -508,7 +520,11 @@ void CGrenade::SG_Smoke(void)
else
{
pev->effects |= EF_NODRAW;
TheBots->RemoveGrenade(this);
if (TheBots != NULL)
{
TheBots->RemoveGrenade(this);
}
UTIL_Remove(this);
}
}
@ -559,8 +575,11 @@ void CGrenade::SG_Detonate(void)
UTIL_TraceLine(vecSpot, vecSpot + Vector(0, 0, -40), ignore_monsters, ENT(pev), &tr);
TheBots->OnEvent(EVENT_SMOKE_GRENADE_EXPLODED, CBaseEntity::Instance(pev->owner));
TheBots->AddGrenade(WEAPON_SMOKEGRENADE, this);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_SMOKE_GRENADE_EXPLODED, CBaseEntity::Instance(pev->owner));
TheBots->AddGrenade(WEAPON_SMOKEGRENADE, this);
}
EMIT_SOUND(ENT(pev), CHAN_WEAPON, "weapons/sg_explode.wav", VOL_NORM, ATTN_NORM);
@ -914,22 +933,10 @@ CGrenade *CGrenade::ShootTimed2(entvars_t *pevOwner, Vector vecStart, Vector vec
return pGrenade;
}
extern bool bActivateGo;
/* <b9dd0> ../cstrike/dlls/ggrenade.cpp:1069 */
CGrenade *CGrenade::ShootTimed(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time)
{
/*if (bActivateGo)
{
static int iNum = 0;
_logf("#%d. vecStart: (%.12f, %.12f, %.12f) | vecVelocity: (%.12f, %.12f, %.12f)", iNum,
vecStart[0], vecStart[1], vecStart[2],
vecVelocity[0], vecVelocity[1], vecVelocity[2]);
//_logf("\n\n");
iNum++;
}*/
CGrenade *pGrenade = GetClassPtr((CGrenade *)NULL);
pGrenade->Spawn();
@ -989,11 +996,17 @@ void CGrenade::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller,
}
SET_CLIENT_MAXSPEED(player->edict(), 1);
TheBots->OnEvent(EVENT_BOMB_DEFUSING, pActivator);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_BOMB_DEFUSING, pActivator);
}
if (g_pGameRules->IsCareer())
{
TheCareerTasks->HandleEvent(EVENT_BOMB_DEFUSING);
if (TheCareerTasks != NULL)
{
TheCareerTasks->HandleEvent(EVENT_BOMB_DEFUSING);
}
}
if (player->m_bHasDefuser)
@ -1203,7 +1216,10 @@ void CGrenade::C4Think(void)
m_flNextBeep = gpGlobals->time + 1.4;
EMIT_SOUND(ENT(pev), CHAN_VOICE, m_sBeepName, VOL_NORM, m_fAttenu);
TheBots->OnEvent(EVENT_BOMB_BEEP, this);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_BOMB_BEEP, this);
}
}
if (gpGlobals->time >= m_flNextBlink)
@ -1224,7 +1240,10 @@ void CGrenade::C4Think(void)
if (gpGlobals->time >= m_flC4Blow)
{
TheBots->OnEvent(EVENT_BOMB_EXPLODED);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_BOMB_EXPLODED);
}
MESSAGE_BEGIN(MSG_ALL, gmsgScenarioIcon);
WRITE_BYTE(0);
@ -1280,7 +1299,10 @@ void CGrenade::C4Think(void)
m_bStartDefuse = false;
m_flDefuseCountDown = 0;
TheBots->OnEvent(EVENT_BOMB_DEFUSE_ABORTED);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_BOMB_DEFUSE_ABORTED);
}
}
}
else
@ -1288,7 +1310,11 @@ void CGrenade::C4Think(void)
if (pPlayer != NULL && m_pBombDefuser->pev->deadflag == DEAD_NO)
{
Broadcast("BOMBDEF");
TheBots->OnEvent(EVENT_BOMB_DEFUSED, (CBaseEntity *)m_pBombDefuser);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_BOMB_DEFUSED, (CBaseEntity *)m_pBombDefuser);
}
MESSAGE_BEGIN(MSG_SPEC, SVC_DIRECTOR);
WRITE_BYTE(9);
@ -1316,9 +1342,9 @@ void CGrenade::C4Think(void)
WRITE_BYTE(0);
MESSAGE_END();
if (g_pGameRules->IsCareer())
if (g_pGameRules->IsCareer() && !pPlayer->IsBot())
{
if (!pPlayer->IsBot())
if (TheCareerTasks != NULL)
{
TheCareerTasks->HandleEvent(EVENT_BOMB_DEFUSED, pPlayer);
}
@ -1347,7 +1373,10 @@ void CGrenade::C4Think(void)
m_bStartDefuse = false;
m_pBombDefuser = NULL;
TheBots->OnEvent(EVENT_BOMB_DEFUSE_ABORTED);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_BOMB_DEFUSE_ABORTED);
}
}
}
}

View File

@ -45,7 +45,7 @@
#define gDisplayTitle (*pgDisplayTitle)
#define g_fGameOver (*pg_fGameOver)
#endif //HOOK_GAMEDLL
#endif // HOOK_GAMEDLL
extern const Vector g_vecZero;
extern int g_Language;
@ -58,4 +58,4 @@ extern int g_iSkillLevel;
extern int gDisplayTitle;
extern BOOL g_fGameOver;
#endif // NODES_H
#endif // GLOBALS_H

View File

@ -42,7 +42,7 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return ((CBaseToggle::ObjectCaps()|FCAP_CONTINUOUS_USE) & ~FCAP_ACROSS_TRANSITION);
}
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -53,10 +53,6 @@ public:
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return ((CBaseToggle::ObjectCaps()|FCAP_CONTINUOUS_USE) & ~FCAP_ACROSS_TRANSITION);
}
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL

View File

@ -41,7 +41,7 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return (CBaseEntity::ObjectCaps() | FCAP_IMPULSE_USE);
}
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
@ -58,10 +58,6 @@ public:
void Spawn_(void);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return (CBaseEntity::ObjectCaps() | FCAP_IMPULSE_USE);
}
int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
void Think_(void);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -120,7 +116,7 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return (CBaseEntity::ObjectCaps() | FCAP_DONT_SAVE | FCAP_IMPULSE_USE);
}
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual void Think(void);
@ -132,10 +128,6 @@ public:
void Restart_(void);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return (CBaseEntity::ObjectCaps() | FCAP_DONT_SAVE | FCAP_IMPULSE_USE);
}
int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
void Think_(void);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -226,6 +218,8 @@ public:
};/* size: 408, cachelines: 7, members: 3 */
#ifdef HOOK_GAMEDLL
// linked objects
C_DLLEXPORT void cycler(entvars_t *pev);
C_DLLEXPORT void cycler_prdroid(entvars_t *pev);
@ -233,4 +227,6 @@ C_DLLEXPORT void cycler_sprite(entvars_t *pev);
C_DLLEXPORT void cycler_weapon(entvars_t *pev);
C_DLLEXPORT void cycler_wreckage(entvars_t *pev);
#endif // HOOK_GAMEDLL
#endif // H_CYCLER_H

View File

@ -1,8 +1,13 @@
#include "precompiled.h"
//! Holds engine functionality callbacks
enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals;
// Receive engine function table from engine.
// This appears to be the _first_ DLL routine called by the engine, so we
// do some setup operations here.
/* <d0737> ../cstrike/dlls/h_export.cpp:58 */
C_DLLEXPORT void WINAPI GiveFnptrsToDll(enginefuncs_t *pEnginefuncsTable,globalvars_t *pGlobals)
{

View File

@ -32,12 +32,6 @@
#pragma once
#endif
#ifdef _WIN32
// WINAPI
#else
#define WINAPI /* */
#endif // _WIN32
#ifdef HOOK_GAMEDLL
#define g_engfuncs (*pg_engfuncs)
@ -48,6 +42,10 @@
extern enginefuncs_t g_engfuncs;
extern globalvars_t *gpGlobals;
#ifdef HOOK_GAMEDLL
C_DLLEXPORT void WINAPI GiveFnptrsToDll(enginefuncs_t *pEnginefuncsTable,globalvars_t *pGlobals);
#endif // HOOK_GAMEDLL
#endif // H_EXPORT_H

View File

@ -61,7 +61,7 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return (CBaseToggle::ObjectCaps() | FCAP_CONTINUOUS_USE) & ~FCAP_ACROSS_TRANSITION;
}
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -72,10 +72,6 @@ public:
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return (CBaseToggle::ObjectCaps() | FCAP_CONTINUOUS_USE) & ~FCAP_ACROSS_TRANSITION;
}
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL

File diff suppressed because it is too large Load Diff

View File

@ -32,6 +32,7 @@
#pragma once
#endif
// Improved the hostages from CZero
#include "hostage/hostage_improv.h"
#define MAX_NODES 100
@ -45,6 +46,8 @@
#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)
class CHostage;
class CLocalNav;
class CHostageImprov;
@ -96,76 +99,20 @@ extern cvar_t cv_hostage_stop;
class CHostage: public CBaseMonster
{
public:
NOBODY virtual void Spawn(void);
NOBODY virtual void Precache(void);
NOBODY virtual int ObjectCaps(void);
virtual void Spawn(void);
virtual void Precache(void);
virtual int ObjectCaps(void);
virtual int Classify(void)
{
return CLASS_HUMAN_PASSIVE;
}
NOBODY virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual int BloodColor(void)
{
return BLOOD_COLOR_RED;
}
NOBODY virtual void Touch(CBaseEntity *pOther);
NOBODY virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
public:
NOBODY void EXPORT IdleThink(void);
NOBODY void Remove(void);
void RePosition(void);
void SetActivity(int act);
NOBODY int GetActivity(void);
NOBODY float GetModifiedDamage(float flDamage, int nHitGroup);
NOBODY void SetFlinchActivity(void);
NOBODY void SetDeathActivity(void);
NOBODY void PlayPainSound(void);
NOBODY void PlayFollowRescueSound(void);
NOBODY void AnnounceDeath(CBasePlayer *pAttacker);
NOBODY void ApplyHostagePenalty(CBasePlayer *pAttacker);
NOBODY void GiveCTTouchBonus(CBasePlayer *pPlayer);
NOBODY void SendHostagePositionMsg(void);
NOBODY void SendHostageEventMsg(void);
NOBODY void DoFollow(void);
NOBODY BOOL IsOnLadder(void);
NOBODY void PointAt(const Vector &vecLoc);
NOBODY void MoveToward(const Vector &vecLoc);
void NavReady(void);
NOBODY void Wiggle(void);
void PreThink(void);
NOBODY bool IsFollowingSomeone(void)
{
UNTESTED
return m_improv->IsFollowing(NULL);
}
NOBODY CBaseEntity *GetLeader(void)
{
UNTESTED
if (m_improv != NULL)
{
return m_improv->GetFollowLeader();
}
return NULL;
}
NOBODY bool IsFollowing(const CBaseEntity *entity)
{
return (entity == m_hTargetEnt && m_State == FOLLOW);
}
NOBODY bool IsValid(void)
{
UNTESTED
return (pev->takedamage == DAMAGE_YES);
}
NOBODY bool IsDead(void)
{
UNTESTED
return (pev->deadflag == DEAD_DEAD);
}
NOBODY bool IsAtHome(void);//
NOBODY const Vector *GetHomePosition(void);//
virtual void Touch(CBaseEntity *pOther);
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#ifdef HOOK_GAMEDLL
@ -178,6 +125,68 @@ public:
#endif // HOOK_GAMEDLL
public:
void EXPORT IdleThink(void);
void EXPORT Remove(void);
void RePosition(void);
void SetActivity(int act);
int GetActivity(void)
{
return m_Activity;
}
float GetModifiedDamage(float flDamage, int nHitGroup);
void SetFlinchActivity(void);
void SetDeathActivity(void);
void PlayPainSound(void);
void PlayFollowRescueSound(void);
void AnnounceDeath(CBasePlayer *pAttacker);
void ApplyHostagePenalty(CBasePlayer *pAttacker);
void GiveCTTouchBonus(CBasePlayer *pPlayer);
void SendHostagePositionMsg(void);
void SendHostageEventMsg(void);
void DoFollow(void);
BOOL IsOnLadder(void);
void PointAt(const Vector &vecLoc);
void MoveToward(const Vector &vecLoc);
void NavReady(void);
void Wiggle(void);
void PreThink(void);
bool IsFollowingSomeone(void)
{
UNTESTED
return m_improv->IsFollowing();
}
CBaseEntity *GetLeader(void)
{
UNTESTED
if (m_improv != NULL)
{
return m_improv->GetFollowLeader();
}
return NULL;
}
bool IsFollowing(const CBaseEntity *entity)
{
return (entity == m_hTargetEnt && m_State == FOLLOW);
}
bool IsValid(void)
{
UNTESTED
return (pev->takedamage == DAMAGE_YES);
}
bool IsDead(void)
{
UNTESTED
return (pev->deadflag == DEAD_DEAD);
}
bool IsAtHome(void)
{
return (pev->origin - m_vStart).IsLengthGreaterThan(20) != true;
}
NOBODY const Vector *GetHomePosition(void);
public:
enum state
{
@ -247,7 +256,7 @@ public:
struct ChatterSet
{
struct SoundFile file[32];
SoundFile file[32];
int count;
int index;
bool needsShuffle;
@ -284,17 +293,18 @@ public:
{
return &m_chatter;
}
NOBODY bool IsNearbyHostageTalking(CHostageImprov *improv);
NOBODY bool IsNearbyHostageJumping(CHostageImprov *improv);
NOBODY void OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other);
UNTESTED inline CHostage *GetClosestHostage(const Vector &pos, float *resultRange = NULL)
bool IsNearbyHostageTalking(CHostageImprov *improv);
bool IsNearbyHostageJumping(CHostageImprov *improv);
void OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other);
inline CHostage *GetClosestHostage(const Vector &pos, float *resultRange = NULL)
{
float closeRange = 100000000.0f;
float range;
float closeRange = 1e8f;
CHostage *close = NULL;
for (int i = 0; i < m_hostageCount; i++)
{
float range = (m_hostage[ i ]->pev->origin - pos).Length();
range = (m_hostage[ i ]->pev->origin - pos).Length();
if (range < closeRange)
{
@ -309,9 +319,7 @@ public:
return close;
}
template<
typename T
>
template<typename T>
bool ForEachHostage(T &func)
{
UNTESTED
@ -364,10 +372,18 @@ private:
//// }
//}
#ifdef HOOK_GAMEDLL
// linked object
C_DLLEXPORT void hostage_entity(entvars_t *pev);
C_DLLEXPORT void monster_scientist(entvars_t *pev);
#endif // HOOK_GAMEDLL
void Hostage_RegisterCVars(void);
NOBODY void InstallHostageManager(void);
void InstallHostageManager(void);
// refs
extern void (*pCHostage__IdleThink)(void);
extern void (CBaseEntity::*pCHostage__IdleThink)(void);
#endif // HOSTAGE_H

File diff suppressed because it is too large Load Diff

View File

@ -40,8 +40,9 @@ enum HostageChatterType;
class CHostageImprov: public CImprov
{
public:
//CHostageImprov(void) {};
CHostageImprov(CBaseEntity *entity);
virtual ~CHostageImprov(void)
~CHostageImprov(void)
{
//~HostageAnimateState(); // 49
//~HostageFollowState(); // 49
@ -56,7 +57,7 @@ public:
//if (m_behavior.IsState(NULL))
// IImprovEvent::OnMoveToSuccess(goal);
}
NOBODY virtual void OnMoveToFailure(const Vector &goal, MoveToFailureType reason);
virtual void OnMoveToFailure(const Vector &goal, MoveToFailureType reason);
NOBODY virtual void OnInjury(float amount)
{
//m_behavior.Update();
@ -69,35 +70,38 @@ public:
NOBODY virtual void FaceTo(const Vector &goal);
NOBODY virtual void ClearFaceTo(void);
NOBODY virtual bool IsAtMoveGoal(float error = 20.0f) const;
NOBODY virtual bool HasLookAt(void) const
virtual bool HasLookAt(void) const
{
return m_isLookingAt;
}
NOBODY virtual bool HasFaceTo(void) const
virtual bool HasFaceTo(void) const
{
return m_isFacingTo;
}
NOBODY virtual bool IsAtFaceGoal(void) const;
NOBODY virtual bool IsFriendInTheWay(const Vector &goalPos) const;
NOBODY virtual bool IsFriendInTheWay(CBaseEntity *myFriend, const Vector &goalPos) const;
NOBODY virtual void MoveForward(void)
virtual void MoveForward(void)
{
m_moveFlags |= IN_FORWARD;
}
NOBODY virtual void MoveBackward(void)
virtual void MoveBackward(void)
{
m_moveFlags |= IN_BACK;
}
NOBODY virtual void StrafeLeft(void)
virtual void StrafeLeft(void)
{
m_moveFlags |= IN_MOVELEFT;
}
NOBODY virtual void StrafeRight(void)
virtual void StrafeRight(void)
{
m_moveFlags |= IN_MOVERIGHT;
}
NOBODY virtual bool Jump(void);
NOBODY virtual void Crouch(void);
#define HOSTAGE_MUST_JUMP true
virtual bool Jump(void);
virtual void Crouch(void);
virtual void StandUp(void);
NOBODY virtual void TrackPath(const Vector &pathGoal, float deltaT);
NOBODY virtual void StartLadder(const CNavLadder *ladder, NavTraverseType how, const Vector *approachPos, const Vector *departPos);
@ -106,53 +110,53 @@ public:
NOBODY virtual void Run(void);
NOBODY virtual void Walk(void);
NOBODY virtual void Stop(void);
NOBODY virtual float GetMoveAngle(void) const
virtual float GetMoveAngle(void) const
{
return m_moveAngle;
}
NOBODY virtual float GetFaceAngle(void) const
virtual float GetFaceAngle(void) const
{
return m_moveAngle;
}
NOBODY virtual const Vector &GetFeet(void) const;
NOBODY virtual const Vector &GetCentroid(void);
NOBODY virtual const Vector &GetEyes(void) const;
NOBODY virtual bool IsRunning(void) const
virtual const Vector &GetFeet(void) const;
virtual const Vector &GetCentroid(void) const;
virtual const Vector &GetEyes(void) const;
virtual bool IsRunning(void) const
{
return (m_moveType == Running);
}
NOBODY virtual bool IsWalking(void) const
virtual bool IsWalking(void) const
{
return (m_moveType == Walking);
}
NOBODY virtual bool IsStopped(void) const
virtual bool IsStopped(void) const
{
return (m_moveType == Stopped);
}
NOBODY virtual bool IsCrouching(void) const
virtual bool IsCrouching(void) const
{
return m_isCrouching;
}
NOBODY virtual bool IsJumping(void) const
virtual bool IsJumping(void) const
{
UNTESTED
return (m_jumpTimer.IsElapsed() == false);
}
NOBODY virtual bool IsUsingLadder(void) const
virtual bool IsUsingLadder(void) const
{
return false;
}
NOBODY virtual bool IsOnGround(void) const;
NOBODY virtual bool IsMoving(void) const;
NOBODY virtual bool CanRun(void) const
virtual bool CanRun(void) const
{
return true;
}
NOBODY virtual bool CanCrouch(void) const
virtual bool CanCrouch(void) const
{
return true;
}
NOBODY virtual bool CanJump(void) const
virtual bool CanJump(void) const
{
return true;
}
@ -160,7 +164,7 @@ public:
NOBODY virtual bool IsPlayerLookingAtMe(CBasePlayer *other, float cosTolerance = 0.95f) const;
NOBODY virtual CBasePlayer *IsAnyPlayerLookingAtMe(int team = 0, float cosTolerance = 0.95f) const;
NOBODY virtual CBasePlayer *GetClosestPlayerByTravelDistance(int team = 0, float *range = NULL) const;
NOBODY virtual CNavArea *GetLastKnownArea(void) const
virtual CNavArea *GetLastKnownArea(void) const
{
return m_lastKnownArea;
}
@ -190,33 +194,9 @@ public:
void FaceTo_(const Vector &goal);
void ClearFaceTo_(void);
bool IsAtMoveGoal_(float error = 20.0f) const;
bool HasLookAt_(void) const
{
return m_isLookingAt;
}
bool HasFaceTo_(void) const
{
return m_isFacingTo;
}
bool IsAtFaceGoal_(void) const;
bool IsFriendInTheWay_(const Vector &goalPos) const;
bool IsFriendInTheWay_(CBaseEntity *myFriend, const Vector &goalPos) const;
void MoveForward_(void)
{
m_moveFlags |= IN_FORWARD;
}
void MoveBackward_(void)
{
m_moveFlags |= IN_BACK;
}
void StrafeLeft_(void)
{
m_moveFlags |= IN_MOVELEFT;
}
void StrafeRight_(void)
{
m_moveFlags |= IN_MOVERIGHT;
}
bool Jump_(void);
void Crouch_(void);
void StandUp_(void);
@ -227,64 +207,15 @@ public:
void Run_(void);
void Walk_(void);
void Stop_(void);
float GetMoveAngle_(void) const
{
return m_moveAngle;
}
float GetFaceAngle_(void) const
{
return m_moveAngle;
}
const Vector &GetFeet_(void) const;
const Vector &GetCentroid_(void);
const Vector &GetCentroid_(void) const;
const Vector &GetEyes_(void) const;
bool IsRunning_(void) const
{
return (m_moveType == Running);
}
bool IsWalking_(void) const
{
return (m_moveType == Walking);
}
bool IsStopped_(void) const
{
return (m_moveType == Stopped);
}
bool IsCrouching_(void) const
{
return m_isCrouching;
}
bool IsJumping_(void) const
{
UNTESTED
return (m_jumpTimer.IsElapsed() == false);
}
bool IsUsingLadder_(void) const
{
return false;
}
bool IsOnGround_(void) const;
bool IsMoving_(void) const;
bool CanRun_(void) const
{
return true;
}
bool CanCrouch_(void) const
{
return true;
}
bool CanJump_(void) const
{
return true;
}
bool IsVisible_(const Vector &pos, bool testFOV = false) const;
bool IsPlayerLookingAtMe_(CBasePlayer *other, float cosTolerance = 0.95f) const;
CBasePlayer *IsAnyPlayerLookingAtMe_(int team = 0, float cosTolerance = 0.95f) const;
CBasePlayer *GetClosestPlayerByTravelDistance_(int team = 0, float *range = NULL) const;
CNavArea *GetLastKnownArea_(void) const
{
return m_lastKnownArea;
}
void OnUpdate_(float deltaT);
void OnUpkeep_(float deltaT);
void OnReset_(void);
@ -308,10 +239,7 @@ public:
SCARED,
TERRIFIED,
};
//{
// UNTESTED
// return m_behavior.IsState(&m_followState);
//}
void FaceOutwards(void);
bool IsFriendInTheWay(void);
void SetKnownGoodPosition(const Vector &pos);
@ -323,7 +251,7 @@ public:
void SetMoveLimit(MoveType limit)
{
m_moveLimit = limit;
};
}
MoveType GetMoveLimit(void)
{
return m_moveLimit;
@ -339,7 +267,12 @@ public:
UNTESTED
return m_behavior.IsState(&m_idleState);
}
void Follow(CBasePlayer *leader);
void Follow(CBasePlayer *leader)
{
UNTESTED
m_followState.SetLeader(leader);
m_behavior.SetState(&m_followState);
}
bool IsFollowing(const CBaseEntity *leader = NULL)
{
UNTESTED
@ -362,13 +295,19 @@ public:
bool IsTerroristNearby(void);
void Frighten(ScareType scare);
bool IsScared(void);
ScareType GetScareIntensity(void);
ScareType GetScareIntensity(void)
{
return m_scareIntensity;
}
bool IsIgnoringTerrorists(void);
float GetAggression(void);
void Chatter(HostageChatterType sayType, bool mustSpeak);
void DelayedChatter(float delayTime, HostageChatterType sayType, bool mustSpeak);
void UpdateDelayedChatter(void);
bool IsTalking(void);
void Chatter(HostageChatterType sayType, bool mustSpeak = true);
void DelayedChatter(float delayTime, HostageChatterType sayType, bool mustSpeak = false);
NOXREF void UpdateDelayedChatter(void);
bool IsTalking(void) const
{
return m_talkingTimer.IsElapsed();
}
void UpdateGrenadeReactions(void);
void Afraid(void);
void Wave(void);
@ -378,7 +317,10 @@ public:
void Flinch(Activity activity);
void UpdateIdleActivity(Activity activity, Activity fidget);
void UpdateStationaryAnimation(void);
CHostage *GetEntity(void);
CHostage *GetEntity(void)
{
return m_hostage;
}
void CheckForNearbyTerrorists(void);
void UpdatePosition(float);
void MoveTowards(const Vector &pos, float deltaT);
@ -390,16 +332,20 @@ public:
}
void Wiggle(void);
void ClearPath(void);
bool DiscontinuityJump(float ground, bool onlyJumpDown, bool mustJump);
#define HOSTAGE_ONLY_JUMP_DOWN true
bool DiscontinuityJump(float ground, bool onlyJumpDown = false, bool mustJump = false);
void UpdateVision(void);
public:
CountdownTimer m_coughTimer;
CountdownTimer m_grenadeTimer;
private:
/*private:*/
CHostage *m_hostage;
CNavArea *m_lastKnownArea;
Vector m_centroid;
Vector m_eye;
mutable Vector m_centroid;
mutable Vector m_eye;
HostageStateMachine m_behavior;
HostageIdleState m_idleState;
HostageEscapeState m_escapeState;
@ -482,6 +428,24 @@ public:
}; /* size: 20, cachelines: 1, members: 3 */
/* <46f426> ../cstrike/dlls/hostage/hostage_improv.h:400 */
class HostagePathCost
{
public:
bool operator()(CNavArea *area, class CNavArea *fromArea, const CNavLadder *ladder)
{
// {
// float dist;
// float cost;
// {
// const float ladderCost = 0.0f;
// const float crouchPenalty = 0.0f;
// const float jumpPenalty = 0.0f;
// }
// }
}
};
/* <4700b6> ../cstrike/dlls/hostage/hostage_improv.cpp:931 */
class KeepPersonalSpace
{
@ -547,4 +511,7 @@ typedef bool (CHostageImprov::*IS_FRIEND_IN_THE_WAY_CBASE)(CBaseEntity *, const
#endif // HOOK_GAMEDLL
// refs
extern void (*pCHostageImprov__FaceTowards)();
#endif // HOSTAGE_IMPROV_H

View File

@ -7,37 +7,47 @@
float CLocalNav::s_flStepSize;
int CLocalNav::qptr;
EHANDLE CLocalNav::_queue[ MAX_HOSTAGES_NAV ];
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 ];
EHANDLE CLocalNav::hostages[MAX_HOSTAGES_NAV];
int CLocalNav::tot_hostages;
#else
float (*CLocalNav::ps_flStepSize);
int (*CLocalNav::pqptr);
EHANDLE (*CLocalNav::pqueue)[ MAX_HOSTAGES_NAV ];
EHANDLE (*CLocalNav::pqueue)[MAX_HOSTAGES_NAV];
int (*CLocalNav::ptot_inqueue);
float (*CLocalNav::pnodeval);
float (*CLocalNav::pflNextCvarCheck);
float (*CLocalNav::pflLastThinkTime);
EHANDLE (*CLocalNav::phostages)[ MAX_HOSTAGES_NAV ];
EHANDLE (*CLocalNav::phostages)[MAX_HOSTAGES_NAV];
int (*CLocalNav::ptot_hostages);
#endif // HOOK_GAMEDLL
/* <485b67> ../cstrike/dlls/hostage/hostage_localnav.cpp:45 */
NOBODY CLocalNav::CLocalNav(CHostage *pOwner)
CLocalNav::CLocalNav(CHostage *pOwner)
{
m_pOwner = pOwner;
m_pTargetEnt = NULL;
m_nodeArr = new localnode_t[MAX_NODES];
if (tot_hostages >= MAX_HOSTAGES_NAV)
{
return;
}
hostages[tot_hostages++] = pOwner;
}
/* <485b09> ../cstrike/dlls/hostage/hostage_localnav.cpp:68 */
NOBODY CLocalNav::~CLocalNav(void)
CLocalNav::~CLocalNav(void)
{
// ~CLocalNav(CLocalNav::~CLocalNav(// int const __in_chrg); // 71
delete m_nodeArr;
}
/* <485b91> ../cstrike/dlls/hostage/hostage_localnav.cpp:74 */
@ -269,11 +279,18 @@ int CLocalNav::SetupPathNodes(node_index_t nindex, Vector *vecNodes, int fNoMons
}
/* <486a56> ../cstrike/dlls/hostage/hostage_localnav.cpp:290 */
NOBODY int CLocalNav::GetFurthestTraversableNode(Vector &vecStartingLoc, Vector *vecNodes, int nTotalNodes, int fNoMonsters)
int CLocalNav::GetFurthestTraversableNode(Vector &vecStartingLoc, Vector *vecNodes, int nTotalNodes, int fNoMonsters)
{
// {
// int nCount; // 292
// }
int nCount = 0;
while (nCount < nTotalNodes)
{
if (PathTraversable(vecStartingLoc, vecNodes[nCount], fNoMonsters) != PATH_TRAVERSABLE_EMPTY)
return nCount;
nCount++;
}
return -1;
}
/* <486d8d> ../cstrike/dlls/hostage/hostage_localnav.cpp:304 */
@ -424,6 +441,7 @@ BOOL CLocalNav::PathClear(Vector &vecOrigin, Vector &vecDest, int fNoMonsters, T
m_fTargetEntHit = TRUE;
return TRUE;
}
return FALSE;
}
@ -452,6 +470,7 @@ int CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonste
#ifndef HOOK_GAMEDLL
vecDestTmp = vecSrcTmp + (vecDir * s_flStepSize);
#else
// 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);
@ -592,20 +611,28 @@ BOOL CLocalNav::SlopeTraversable(Vector &vecSource, Vector &vecDest, int fNoMons
}
/* <487085> ../cstrike/dlls/hostage/hostage_localnav.cpp:635 */
NOBODY BOOL CLocalNav::LadderTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr)
BOOL CLocalNav::LadderTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr)
{
// {
// Vector vecLadderStart; // 637
// Vector vecLadderDest; // 638
// PathClear(CLocalNav *const this,
// Vector &vecOrigin,
// Vector &vecDest,
// int fNoMonsters,
// TraceResult &tr); // 646
// operator-(const Vector *const this,
// const Vector &v); // 651
// Length(const Vector *const this); // 651
// }
Vector vecStepStart;
Vector vecStepDest;
vecStepStart = tr.vecEndPos;
vecStepDest = vecStepStart;
vecStepDest.z += HOSTAGE_STEPSIZE;
if (!PathClear(vecStepStart, vecStepDest, fNoMonsters, tr))
{
if (tr.fStartSolid)
return FALSE;
if ((tr.vecEndPos - vecStepStart).Length() < 1)
return FALSE;
}
vecStepStart = tr.vecEndPos;
vecDest.z = tr.vecEndPos.z;
return PathTraversable(vecStepStart, vecDest, fNoMonsters);
}
/* <4871ef> ../cstrike/dlls/hostage/hostage_localnav.cpp:662 */
@ -707,82 +734,44 @@ BOOL CLocalNav::StepJumpable(Vector &vecSource, Vector &vecDest, int fNoMonsters
}
/* <487588> ../cstrike/dlls/hostage/hostage_localnav.cpp:824 */
NOBODY BOOL CLocalNav::LadderHit(Vector &vecSource, Vector &vecDest, TraceResult &tr)
BOOL CLocalNav::LadderHit(Vector &vecSource, Vector &vecDest, TraceResult &tr)
{
// {
// Vector vecFwd; // 826
// Vector vecRight; // 827
// Vector vecUp; // 828
// operator-(const Vector *const this); // 832
// UTIL_MakeVectorsPrivate(Vector &vecAngles,
// float *p_vForward,
// float *p_vRight,
// float *p_vUp); // 832
// operator*(const Vector *const this,
// float fl); // 834
// operator*(const Vector *const this,
// float fl); // 834
// operator+(const Vector *const this,
// const Vector &v); // 834
// operator+(const Vector *const this,
// const Vector &v); // 834
// operator*(const Vector *const this,
// float fl); // 836
// operator+(const Vector *const this,
// const Vector &v); // 836
// operator*(const Vector *const this,
// float fl); // 836
// operator-(const Vector *const this,
// const Vector &v); // 836
// operator*(const Vector *const this,
// float fl); // 838
// operator*(const Vector *const this,
// float fl); // 838
// operator*(const Vector *const this,
// float fl); // 838
// operator+(const Vector *const this,
// const Vector &v); // 838
// operator+(const Vector *const this,
// const Vector &v); // 838
// operator+(const Vector *const this,
// const Vector &v); // 838
// operator*(const Vector *const this,
// float fl); // 840
// operator*(const Vector *const this,
// float fl); // 840
// operator+(const Vector *const this,
// const Vector &v); // 840
// operator*(const Vector *const this,
// float fl); // 840
// operator-(const Vector *const this,
// const Vector &v); // 840
// operator+(const Vector *const this,
// const Vector &v); // 840
// operator*(const Vector *const this,
// float fl); // 842
// operator*(const Vector *const this,
// float fl); // 842
// operator+(const Vector *const this,
// const Vector &v); // 842
// operator+(const Vector *const this,
// const Vector &v); // 842
// operator*(const Vector *const this,
// float fl); // 842
// operator-(const Vector *const this,
// const Vector &v); // 842
// operator*(const Vector *const this,
// float fl); // 844
// operator+(const Vector *const this,
// const Vector &v); // 844
// operator*(const Vector *const this,
// float fl); // 844
// operator-(const Vector *const this,
// const Vector &v); // 844
// operator*(const Vector *const this,
// float fl); // 844
// operator-(const Vector *const this,
// const Vector &v); // 844
// }
Vector vecFwd, vecRight, vecUp;
Vector vecAngles, vecOrigin;
vecAngles = UTIL_VecToAngles(-tr.vecPlaneNormal);
UTIL_MakeVectorsPrivate(vecAngles, vecFwd, vecRight, vecUp);
vecOrigin = tr.vecEndPos + (vecFwd * 15) + (vecUp * 36);
if (UTIL_PointContents(vecOrigin) == CONTENTS_LADDER)
return true;
vecOrigin = tr.vecEndPos + (vecFwd * 15) - (vecUp * 36);
if (UTIL_PointContents(vecOrigin) == CONTENTS_LADDER)
return true;
vecOrigin = tr.vecEndPos + (vecFwd * 15) + (vecRight * 16) + (vecUp * 36);
if (UTIL_PointContents(vecOrigin) == CONTENTS_LADDER)
return true;
vecOrigin = tr.vecEndPos + (vecFwd * 15) - (vecRight * 16) + (vecUp * 36);
if (UTIL_PointContents(vecOrigin) == CONTENTS_LADDER)
return true;
vecOrigin = tr.vecEndPos + (vecFwd * 15) + (vecRight * 16) - (vecUp * 36);
if (UTIL_PointContents(vecOrigin) == CONTENTS_LADDER)
return true;
vecOrigin = tr.vecEndPos + (vecFwd * 15) - (vecRight * 16) + (vecUp * 36);
if (UTIL_PointContents(vecOrigin) == CONTENTS_LADDER)
return true;
return false;
}
/* <487eeb> ../cstrike/dlls/hostage/hostage_localnav.cpp:851 */
@ -818,7 +807,7 @@ void CLocalNav::Think(void)
if (tot_inqueue)
{
hCallback = _queue[ qptr ];
hCallback = _queue[qptr];
if (!hCallback)
{
@ -834,7 +823,7 @@ void CLocalNav::Think(void)
break;
}
hCallback = _queue[ qptr ];
hCallback = _queue[qptr];
if (hCallback)
break;
@ -857,17 +846,33 @@ void CLocalNav::Think(void)
/* <487ccd> ../cstrike/dlls/hostage/hostage_localnav.cpp:922 */
void CLocalNav::RequestNav(CHostage *pCaller)
{
// {
// int curr; // 932
// int found; // 933
// {
// int i; // 934
// {
// class CHostage *pQueueItem; // 936
// GetClassPtr<CHostage>(CHostage *a); // 938
// }
// }
// }
int curr = qptr;
int found = 0;
if (nodeval <= 17 && !tot_inqueue)
{
pCaller->NavReady();
return;
}
if (tot_inqueue >= MAX_HOSTAGES_NAV)
{
return;
}
for (int i = 0; i < tot_inqueue; i++)
{
CHostage *pQueueItem = GetClassPtr((CHostage *)_queue[curr]->pev);
if (pQueueItem == pCaller)
return;
if (++curr == MAX_HOSTAGES_NAV)
curr = 0;
}
_queue[curr] = pCaller;
tot_inqueue++;
}
/* <487e03> ../cstrike/dlls/hostage/hostage_localnav.cpp:964 */

View File

@ -56,6 +56,8 @@ typedef struct localnode_s
#ifdef HOOK_GAMEDLL
#define s_flStepSize_LocalNav (*m_LocalNav->ps_flStepSize)
#define flNextCvarCheck (*pflNextCvarCheck)
#define s_flStepSize (*ps_flStepSize)
#define flLastThinkTime (*pflLastThinkTime)
@ -66,6 +68,10 @@ typedef struct localnode_s
#define _queue (*pqueue)
#define hostages (*phostages)
#else
#define s_flStepSize_LocalNav m_LocalNav->s_flStepSize
#endif // HOOK_GAMEDLL
/* <45aaa2> ../cstrike/dlls/hostage/hostage_localnav.h:58 */
@ -85,7 +91,7 @@ public:
node_index_t FindPath(Vector &vecStart, Vector &vecDest, float flTargetRadius, int fNoMonsters);
int SetupPathNodes(node_index_t nindex, Vector *vecNodes, int fNoMonsters);
NOBODY int GetFurthestTraversableNode(Vector &vecStartingLoc, Vector *vecNodes, int nTotalNodes, 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)
@ -100,22 +106,22 @@ public:
void AddPathNode(node_index_t nindexSource, int offsetX, int offsetY, int fNoMonsters);
node_index_t GetBestNode(Vector &vecOrigin, Vector &vecDest);
BOOL SlopeTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr);
NOBODY BOOL LadderTraversable(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);
NOBODY BOOL LadderHit(Vector &vecSource, Vector &vecDest, TraceResult &tr);
BOOL LadderHit(Vector &vecSource, Vector &vecDest, TraceResult &tr);
NOBODY static void Think(void);
NOBODY static void RequestNav(CHostage *pCaller);
static void Think(void);
static void RequestNav(CHostage *pCaller);
static void Reset(void);
static void HostagePrethink(void);
static float s_flStepSize;
#ifndef HOOK_GAMEDLL
private:
#endif // HOOK_GAMEDLL
static float s_flStepSize;
static EHANDLE _queue[ MAX_HOSTAGES_NAV ];
static int qptr;
static int tot_inqueue;

View File

@ -39,7 +39,6 @@ class HostageState: public SimpleState<CHostageImprov *>, public IImprovEvent
{
public:
virtual ~HostageState(void) {};
virtual void UpdateStationaryAnimation(CHostageImprov *improv) {};
};/* size: 12, cachelines: 1, members: 2 */
@ -50,21 +49,32 @@ class HostageStateMachine: public SimpleStateMachine<CHostageImprov *, HostageSt
public:
virtual void OnMoveToSuccess(const Vector &goal)
{
//TODO: UNTESTED
//Update();
if (m_state != NULL)
{
m_state->OnMoveToSuccess(goal);
}
}
virtual void OnMoveToFailure(const Vector &goal, MoveToFailureType reason)
{
//TODO: UNTESTED
Update();
if (m_state != NULL)
{
m_state->OnMoveToFailure(goal, reason);
}
}
virtual void OnInjury(float amount)
{
//TODO: UNTESTED
Update();
if (m_state != NULL)
{
m_state->OnInjury(amount);
}
}
void UpdateStationaryAnimation(CHostageImprov *improv)
{
if (m_state != NULL)
{
m_state->UpdateStationaryAnimation(improv);
}
}
void UpdateStationaryAnimation(CHostageImprov *improv) {};
};/* size: 16, cachelines: 1, members: 2 */
@ -95,6 +105,16 @@ public:
m_fleeTimer.Invalidate();
m_mustFlee = true;
}
#ifdef HOOK_GAMEDLL
void OnEnter_(CHostageImprov *improv);
void OnUpdate_(CHostageImprov *improv);
void OnExit_(CHostageImprov *improv);
void UpdateStationaryAnimation_(CHostageImprov *improv);
#endif // HOOK_GAMEDLL
private:
CountdownTimer m_waveTimer;
CountdownTimer m_fleeTimer;
@ -203,6 +223,18 @@ public:
return "Retreat";
}
#ifdef HOOK_GAMEDLL
void OnEnter_(CHostageImprov *improv);
void OnUpdate_(CHostageImprov *improv);
void OnExit_(CHostageImprov *improv);
const char *GetName_(void) const
{
return GetName();
}
#endif // HOOK_GAMEDLL
};/* size: 12, cachelines: 1, members: 1 */
/* <46fd1e> ../cstrike/dlls/hostage/hostage_states.h:149 */
@ -219,6 +251,7 @@ public:
return "Follow";
}
virtual void UpdateStationaryAnimation(CHostageImprov *improv);
public:
void SetLeader(CBaseEntity *leader)
{
@ -254,6 +287,15 @@ public:
{
return "Animate";
}
#ifdef HOOK_GAMEDLL
void OnEnter_(CHostageImprov *improv);
void OnUpdate_(CHostageImprov *improv);
void OnExit_(CHostageImprov *improv);
#endif // HOOK_GAMEDLL
public:
struct SeqInfo
{
@ -284,13 +326,12 @@ public:
};
void Reset(void);
void AddSequence(CHostageImprov *improv, const char *seqName, float holdTime, float rate);
void AddSequence(CHostageImprov *improv, int activity, float holdTime, float rate);
void AddSequence(CHostageImprov *improv, const char *seqName, float holdTime = -1.0f, float rate = 1.0f);
void AddSequence(CHostageImprov *improv, int activity, float holdTime = -1.0f, float rate = 1.0f);
bool IsBusy(void)
{
// TODO: i'm unsure
return (GetPerformance() != None);
return (m_sequenceCount > 0);
}
bool IsPlaying(CHostageImprov *improv, const char *seqName);
int GetCurrentSequenceID(void)

View File

@ -10,61 +10,114 @@ void HostageAnimateState::Reset(void)
/* <4110c7> ../cstrike/dlls/hostage/states/hostage_animate.cpp:20 */
void HostageAnimateState::StartSequence(CHostageImprov *improv, const SeqInfo *seqInfo)
{
// {
// class CHostage *hostage; // 24
// }
if (seqInfo->seqID >= 0)
{
CHostage *hostage = improv->GetEntity();
hostage->pev->sequence = seqInfo->seqID;
hostage->ResetSequenceInfo();
hostage->m_fSequenceLoops = (seqInfo->holdTime > 0) ? TRUE : FALSE;
hostage->pev->frame = (seqInfo->rate < 0) ? 255 : 0;
hostage->pev->framerate = seqInfo->rate * hostage->pev->framerate;
}
m_isHolding = false;
}
/* <41110a> ../cstrike/dlls/hostage/states/hostage_animate.cpp:41 */
void HostageAnimateState::AddSequence(CHostageImprov *improv, const char *seqName, float holdTime, float rate)
{
// {
// class CHostage *hostage; // 46
// StartSequence(HostageAnimateState *const this,
// class CHostageImprov *improv,
// const class SeqInfo *seqInfo); // 55
// }
int seqIndex;
CHostage *hostage = improv->GetEntity();
if (m_sequenceCount >= 8)
return;
if (seqName != NULL)
seqIndex = hostage->LookupSequence(seqName);
else
seqIndex = -1;
m_sequence[m_sequenceCount].seqID = seqIndex;
m_sequence[m_sequenceCount].holdTime = holdTime;
m_sequence[m_sequenceCount].rate = rate;
m_currentSequence = 0;
m_sequenceCount++;
StartSequence(improv, m_sequence);
}
/* <4111be> ../cstrike/dlls/hostage/states/hostage_animate.cpp:62 */
void HostageAnimateState::AddSequence(CHostageImprov *improv, int activity, float holdTime, float rate)
{
// {
// class CHostage *hostage; // 64
// void *model; // 66
// StartSequence(HostageAnimateState *const this,
// class CHostageImprov *improv,
// const class SeqInfo *seqInfo); // 77
// }
CHostage *hostage = improv->GetEntity();
void *model = GET_MODEL_PTR(hostage->edict());
if (model != NULL)
{
m_sequence[m_sequenceCount].seqID = LookupActivity(model, hostage->pev, activity);
m_sequence[m_sequenceCount].holdTime = holdTime;
m_sequence[m_sequenceCount].rate = rate;
m_currentSequence = 0;
m_sequenceCount++;
}
StartSequence(improv, m_sequence);
}
/* <41127f> ../cstrike/dlls/hostage/states/hostage_animate.cpp:81 */
bool HostageAnimateState::IsDoneHolding(void)
{
// IsElapsed(const class CountdownTimer *const this); // 88
// Start(CountdownTimer *const this,
// float duration); // 96
if (m_sequence[m_currentSequence].holdTime < 0)
return true;
if (m_isHolding)
return m_holdTimer.IsElapsed();
m_isHolding = true;
m_holdTimer.Start(m_sequence[m_currentSequence].holdTime);
return false;
}
/* <410d45> ../cstrike/dlls/hostage/states/hostage_animate.cpp:103 */
void HostageAnimateState::OnEnter(CHostageImprov *improv)
void HostageAnimateState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv)
{
;
}
/* <410d79> ../cstrike/dlls/hostage/states/hostage_animate.cpp:139 */
void HostageAnimateState::OnExit(CHostageImprov *improv)
void HostageAnimateState::__MAKE_VHOOK(OnExit)(CHostageImprov *improv)
{
;
}
/* <410fb2> ../cstrike/dlls/hostage/states/hostage_animate.cpp:108 */
void HostageAnimateState::OnUpdate(CHostageImprov *improv)
void HostageAnimateState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv)
{
// {
// class CHostage *hostage; // 113
// IsDoneHolding(HostageAnimateState *const this); // 118
// }
// OnUpdate(HostageAnimateState *const this,
// class CHostageImprov *improv); // 108
if (m_sequenceCount <= 0)
return;
if (!improv->m_hostage->m_fSequenceFinished && m_sequence[m_currentSequence].seqID >= 0)
return;
if (m_sequence[m_currentSequence].holdTime >= 0)
{
if (!IsDoneHolding())
{
return;
}
}
if (++m_currentSequence == m_sequenceCount)
{
m_sequenceCount = 0;
m_performance = None;
return;
}
StartSequence(improv, &m_sequence[m_currentSequence]);
}
/* <4112d1> ../cstrike/dlls/hostage/states/hostage_animate.cpp:147 */
@ -75,3 +128,22 @@ bool HostageAnimateState::IsPlaying(CHostageImprov *improv, const char *seqName)
// int id; // 154
// }
}
#ifdef HOOK_GAMEDLL
void HostageAnimateState::OnEnter(CHostageImprov *improv)
{
OnEnter_(improv);
}
void HostageAnimateState::OnUpdate(CHostageImprov *improv)
{
OnUpdate_(improv);
}
void HostageAnimateState::OnExit(CHostageImprov *improv)
{
OnExit_(improv);
}
#endif // HOOK_GAMEDLL

View File

@ -1,73 +1,62 @@
#include "precompiled.h"
/* <43c558> ../cstrike/dlls/hostage/states/hostage_idle.cpp:15 */
void HostageIdleState::OnEnter(CHostageImprov *improv)
void HostageIdleState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv)
{
// Invalidate(CountdownTimer *const this); // 18
m_moveState = MoveDone;
m_fleeTimer.Invalidate();
m_mustFlee = false;
}
/* <43c197> ../cstrike/dlls/hostage/states/hostage_idle.cpp:23 */
void HostageIdleState::OnUpdate(CHostageImprov *improv)
void HostageIdleState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv)
{
// {
// class CHostage *hostage; // 29
// float const pushbackRange; // 107
// class CBasePlayer *rescuer; // 119
// class CBasePlayer *captor; // 120
// {
// float const terroristRecentTime; // 48
// {
// float const fleeChance; // 52
// }
// }
// {
// const Vector *spot; // 62
// }
// {
// float const crouchChance; // 90
// }
// {
// float const waveRange; // 188
// {
// float rangeT; // 132
// float const attentionRange; // 135
// {
// float const cosTolerance; // 139
// TraceResult result; // 147
// }
// }
// {
// float const closeRange; // 168
// {
// enum HostageChatterType say; // 173
// }
// }
// }
// {
// float const closeRange; // 207
// {
// float const minThreatenTime; // 224
// }
// }
// {
// float const stayHomeDuration; // 256
// {
// float sightTimeT; // 264
// float sightTimeCT; // 265
// float const waitTime; // 266
// }
// }
// }
}
/* <43c59b> ../cstrike/dlls/hostage/states/hostage_idle.cpp:297 */
void HostageIdleState::OnExit(CHostageImprov *improv)
void HostageIdleState::__MAKE_VHOOK(OnExit)(CHostageImprov *improv)
{
}
/* <43c783> ../cstrike/dlls/hostage/states/hostage_idle.cpp:307 */
void HostageIdleState::__MAKE_VHOOK(UpdateStationaryAnimation)(CHostageImprov *improv)
{
if (improv->IsScared())
{
if (improv->GetScareIntensity() == CHostageImprov::TERRIFIED)
improv->Afraid();
else
improv->UpdateIdleActivity(ACT_IDLE_SCARED, ACT_RESET);
}
else if (improv->IsAtHome())
{
improv->UpdateIdleActivity(ACT_IDLE, ACT_IDLE_FIDGET);
}
else
improv->UpdateIdleActivity(ACT_IDLE_SNEAKY, ACT_IDLE_SNEAKY_FIDGET);
}
#ifdef HOOK_GAMEDLL
void HostageIdleState::OnEnter(CHostageImprov *improv)
{
OnEnter_(improv);
}
void HostageIdleState::OnUpdate(CHostageImprov *improv)
{
OnUpdate_(improv);
}
void HostageIdleState::OnExit(CHostageImprov *improv)
{
OnExit_(improv);
}
void HostageIdleState::UpdateStationaryAnimation(CHostageImprov *improv)
{
// UpdateStationaryAnimation(HostageIdleState *const this,
// class CHostageImprov *improv); // 307
UpdateStationaryAnimation_(improv);
}
#endif // HOOK_GAMEDLL

View File

@ -1,12 +1,14 @@
#include "precompiled.h"
/* <449fee> ../cstrike/dlls/hostage/states/hostage_retreat.cpp:12 */
void HostageRetreatState::OnEnter(CHostageImprov *improv)
void HostageRetreatState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv)
{
improv->Walk();
improv->MoveTo(improv->m_hostage->m_vStart);
}
/* <44a220> ../cstrike/dlls/hostage/states/hostage_retreat.cpp:20 */
void HostageRetreatState::OnUpdate(CHostageImprov *improv)
void HostageRetreatState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv)
{
// {
// class CBasePlayer *player; // 40
@ -19,6 +21,26 @@ void HostageRetreatState::OnUpdate(CHostageImprov *improv)
}
/* <44a023> ../cstrike/dlls/hostage/states/hostage_retreat.cpp:79 */
void HostageRetreatState::__MAKE_VHOOK(OnExit)(CHostageImprov *improv)
{
;
}
#ifdef HOOK_GAMEDLL
void HostageRetreatState::OnEnter(CHostageImprov *improv)
{
OnEnter_(improv);
}
void HostageRetreatState::OnUpdate(CHostageImprov *improv)
{
OnUpdate_(improv);
}
void HostageRetreatState::OnExit(CHostageImprov *improv)
{
OnExit_(improv);
}
#endif // HOOK_GAMEDLL

View File

@ -328,8 +328,10 @@ BOOL CItemKevlar::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
WRITE_BYTE(0);
MESSAGE_END();
if (TheTutor)
if (TheTutor != NULL)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer);
}
return TRUE;
}
@ -367,8 +369,10 @@ BOOL CItemAssaultSuit::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
WRITE_BYTE(1);
MESSAGE_END();
if (TheTutor)
if (TheTutor != NULL)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer);
}
return TRUE;
}
@ -412,8 +416,10 @@ BOOL CItemThighPack::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
SendItemStatus(pPlayer);
EMIT_SOUND(pPlayer->edict(), CHAN_VOICE, "items/kevlar.wav", VOL_NORM, ATTN_NORM);
if (TheTutor)
if (TheTutor != NULL)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer);
}
return TRUE;
}

View File

@ -59,7 +59,6 @@ public:
static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[2];
private:
int m_iStyle;
int m_iszPattern;
BOOL m_iStartedOff;

View File

@ -145,19 +145,19 @@ public:
#endif // HOOK_GAMEDLL
public:
inline int Points(void)
int Points(void)
{
return (int)(pev->frags);
}
inline BOOL AllowNegativeScore(void)
BOOL AllowNegativeScore(void)
{
return pev->spawnflags & SF_SCORE_NEGATIVE;
}
inline BOOL AwardToTeam(void)
BOOL AwardToTeam(void)
{
return pev->spawnflags & SF_SCORE_TEAM;
}
inline void SetPoints(int points)
void SetPoints(int points)
{
pev->frags = points;
}
@ -202,15 +202,15 @@ public:
#endif // HOOK_GAMEDLL
public:
inline BOOL MessageToAll(void)
BOOL MessageToAll(void)
{
return (pev->spawnflags & SF_ENVTEXT_ALLPLAYERS) == SF_ENVTEXT_ALLPLAYERS;
}
inline void MessageSet(const char *pMessage)
void MessageSet(const char *pMessage)
{
pev->message = ALLOC_STRING(pMessage);
}
inline const char *MessageGet(void)
const char *MessageGet(void)
{
return STRING(pev->message);
}
@ -237,7 +237,7 @@ public:
virtual void KeyValue(KeyValueData *pkvd);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return (CRulePointEntity::ObjectCaps() | FCAP_MASTER);
}
virtual BOOL IsTriggered(CBaseEntity *pActivator);
virtual const char *TeamID(void);
@ -246,10 +246,6 @@ public:
#ifdef HOOK_GAMEDLL
void KeyValue_(KeyValueData *pkvd);
int ObjectCaps_(void)
{
return (CRulePointEntity::ObjectCaps() | FCAP_MASTER);
}
BOOL IsTriggered_(CBaseEntity *pActivator);
const char *TeamID_(void);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -257,11 +253,11 @@ public:
#endif // HOOK_GAMEDLL
public:
inline BOOL RemoveOnFire(void)
BOOL RemoveOnFire(void)
{
return (pev->spawnflags & SF_TEAMMASTER_FIREONCE) == SF_TEAMMASTER_FIREONCE;
}
inline BOOL AnyTeam(void)
BOOL AnyTeam(void)
{
return (pev->spawnflags & SF_TEAMMASTER_ANYTEAM) == SF_TEAMMASTER_ANYTEAM;
}
@ -292,11 +288,11 @@ public:
#endif // HOOK_GAMEDLL
public:
inline BOOL RemoveOnFire(void)
BOOL RemoveOnFire(void)
{
return (pev->spawnflags & SF_TEAMSET_FIREONCE) == SF_TEAMSET_FIREONCE;
}
inline BOOL ShouldClearTeam(void)
BOOL ShouldClearTeam(void)
{
return (pev->spawnflags & SF_TEAMSET_CLEARTEAM) == SF_TEAMSET_CLEARTEAM;
}
@ -351,7 +347,7 @@ public:
#endif // HOOK_GAMEDLL
public:
inline BOOL RemoveOnFire(void)
BOOL RemoveOnFire(void)
{
return (pev->spawnflags & SF_PKILL_FIREONCE) == SF_PKILL_FIREONCE;
}
@ -377,45 +373,45 @@ public:
#endif // HOOK_GAMEDLL
public:
inline BOOL RemoveOnFire(void)
BOOL RemoveOnFire(void)
{
return (pev->spawnflags & SF_GAMECOUNT_FIREONCE) == SF_GAMECOUNT_FIREONCE;
}
inline BOOL ResetOnFire(void)
BOOL ResetOnFire(void)
{
return (pev->spawnflags & SF_GAMECOUNT_RESET) == SF_GAMECOUNT_RESET;
}
inline void CountUp(void)
void CountUp(void)
{
pev->frags++;
}
inline void CountDown(void)
void CountDown(void)
{
pev->frags--;
}
inline void ResetCount(void)
void ResetCount(void)
{
pev->frags = pev->dmg;
}
inline int CountValue(void)
int CountValue(void)
{
return (int)(pev->frags);
}
inline int LimitValue(void)
int LimitValue(void)
{
return (int)(pev->health);
}
inline BOOL HitLimit(void)
BOOL HitLimit(void)
{
return CountValue() == LimitValue();
}
private:
inline void SetCountValue(int value)
void SetCountValue(int value)
{
pev->frags = value;
}
inline void SetInitialValue(int value)
void SetInitialValue(int value)
{
pev->dmg = value;
}
@ -438,7 +434,7 @@ public:
#endif // HOOK_GAMEDLL
public:
inline BOOL RemoveOnFire(void)
BOOL RemoveOnFire(void)
{
return (pev->spawnflags & SF_GAMECOUNTSET_FIREONCE) == SF_GAMECOUNTSET_FIREONCE;
}
@ -465,7 +461,7 @@ public:
#endif // HOOK_GAMEDLL
public:
inline BOOL UseOnly(void)
BOOL UseOnly(void)
{
return (pev->spawnflags & SF_PLAYEREQUIP_USEONLY) == SF_PLAYEREQUIP_USEONLY;
}
@ -497,15 +493,15 @@ public:
#endif // HOOK_GAMEDLL
private:
inline BOOL RemoveOnFire(void)
BOOL RemoveOnFire(void)
{
return (pev->spawnflags & SF_PTEAM_FIREONCE) == SF_PTEAM_FIREONCE;
}
inline BOOL ShouldKillPlayer(void)
BOOL ShouldKillPlayer(void)
{
return (pev->spawnflags & SF_PTEAM_KILL) == SF_PTEAM_KILL;
}
inline BOOL ShouldGibPlayer(void)
BOOL ShouldGibPlayer(void)
{
return (pev->spawnflags & SF_PTEAM_GIB) == SF_PTEAM_GIB;
}
@ -513,6 +509,8 @@ private:
};/* size: 156, cachelines: 3, members: 1 */
#ifdef HOOK_GAMEDLL
// linked objects
C_DLLEXPORT void game_score(entvars_t *pev);
C_DLLEXPORT void game_end(entvars_t *pev);
@ -526,4 +524,6 @@ C_DLLEXPORT void game_counter_set(entvars_t *pev);
C_DLLEXPORT void game_player_equip(entvars_t *pev);
C_DLLEXPORT void game_player_team(entvars_t *pev);
#endif // HOOK_GAMEDLL
#endif // MAPRULES_H

View File

@ -115,15 +115,9 @@ class CGib: public CBaseEntity
{
public:
virtual int ObjectCaps(void)
{
return ObjectCaps_();
}
#ifdef HOOK_GAMEDLL
int ObjectCaps_(void)
{
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_DONT_SAVE;
}
#endif // HOOK_GAMEDLL
public:
void Spawn(const char *szGibModel);

View File

@ -45,7 +45,7 @@ public:
// Bmodels don't go across transitions
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return CBaseToggle::ObjectCaps() & ~FCAP_ACROSS_TRANSITION;
}
#ifdef HOOK_GAMEDLL
@ -55,10 +55,6 @@ public:
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return CBaseToggle::ObjectCaps() & ~FCAP_ACROSS_TRANSITION;
}
#endif // HOOK_GAMEDLL
@ -99,9 +95,12 @@ public:
};/* size: 504, cachelines: 8, members: 2 */
#if HOOK_GAMEDLL
// linked objects
C_DLLEXPORT void func_mortar_field(entvars_t *pev);
C_DLLEXPORT void monster_mortar(entvars_t *pev);
#endif // HOOK_GAMEDLL
#endif // MORTAR_H

View File

@ -16,7 +16,7 @@ cvar_t *sv_clienttrace;
#endif // HOOK_GAMEDLL
CCStrikeGameMgrHelper g_GameMgrHelper;
CHalfLifeMultiplay *g_pMPGameRules;
CHalfLifeMultiplay *g_pMPGameRules = NULL;
/* <1153e2> ../cstrike/dlls/multiplay_gamerules.cpp:92 */
bool IsBotSpeaking(void)
@ -134,15 +134,10 @@ void SV_CareerAddTask_f(void)
bool crossRounds = Q_atoi(CMD_ARGV(5)) != 0;
bool isComplete = Q_atoi(CMD_ARGV(6)) != 0;
TheCareerTasks->AddTask
(
taskName,
weaponName,
reps,
mustLive,
crossRounds,
isComplete
);
if (TheCareerTasks != NULL)
{
TheCareerTasks->AddTask(taskName, weaponName, reps, mustLive, crossRounds, isComplete);
}
}
/* <111640> ../cstrike/dlls/multiplay_gamerules.cpp:213 */
@ -313,7 +308,10 @@ void EndRoundMessage(const char *sentence, int event)
case ROUND_VIP_NOT_ESCAPED:
team = GetTeam(TERRORIST);
// tell bots the terrorists won the round
TheBots->OnEvent(EVENT_TERRORISTS_WIN);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_TERRORISTS_WIN);
}
break;
case ROUND_VIP_ESCAPED:
case ROUND_CTS_PREVENT_ESCAPE:
@ -325,12 +323,18 @@ void EndRoundMessage(const char *sentence, int event)
case ROUND_TERRORISTS_NOT_ESCAPED:
team = GetTeam(CT);
// tell bots the CTs won the round
TheBots->OnEvent(EVENT_CTS_WIN);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_CTS_WIN);
}
break;
default:
teamTriggered = false;
// tell bots the round was a draw
TheBots->OnEvent(EVENT_ROUND_DRAW);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_ROUND_DRAW);
}
break;
}
@ -906,6 +910,9 @@ void CHalfLifeMultiplay::TerminateRound(float tmDelay, int iWinStatus)
/* <114a6a> ../cstrike/dlls/multiplay_gamerules.cpp:995 */
void CHalfLifeMultiplay::QueueCareerRoundEndMenu(float tmDelay, int iWinStatus)
{
if (TheCareerTasks == NULL)
return;
if (m_fCareerMatchMenuTime != 0.0f)
return;
@ -1162,8 +1169,10 @@ bool CHalfLifeMultiplay::NeededPlayersCheck(bool &bNeededPlayers)
TerminateRound(IsCareer() ? 0 : 3, WINSTATUS_DRAW);
m_bFirstConnected = true;
TheBots->OnEvent(EVENT_GAME_COMMENCE);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_GAME_COMMENCE);
}
return true;
}
@ -1196,7 +1205,10 @@ bool CHalfLifeMultiplay::VIPRoundEndCheck(bool bNeededPlayers)
MESSAGE_END();
EndRoundMessage("#VIP_Escaped", ROUND_VIP_ESCAPED);
TheBots->OnEvent(EVENT_VIP_ESCAPED);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_VIP_ESCAPED);
}
TerminateRound(5, WINSTATUS_CTS);
if (IsCareer())
@ -1220,7 +1232,10 @@ bool CHalfLifeMultiplay::VIPRoundEndCheck(bool bNeededPlayers)
}
EndRoundMessage("#VIP_Assassinated", ROUND_VIP_ASSASSINATED);
TheBots->OnEvent(EVENT_VIP_ASSASSINATED);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_VIP_ASSASSINATED);
}
TerminateRound(5, WINSTATUS_TERRORISTS);
if (IsCareer())
@ -1490,11 +1505,17 @@ bool CHalfLifeMultiplay::HostageRescueRoundEndCheck(bool bNeededPlayers)
}
EndRoundMessage("#All_Hostages_Rescued", ROUND_ALL_HOSTAGES_RESCUED);
TheBots->OnEvent(EVENT_ALL_HOSTAGES_RESCUED);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_ALL_HOSTAGES_RESCUED);
}
if (IsCareer())
{
TheCareerTasks->HandleEvent(EVENT_ALL_HOSTAGES_RESCUED);
if (TheCareerTasks != NULL)
{
TheCareerTasks->HandleEvent(EVENT_ALL_HOSTAGES_RESCUED);
}
}
TerminateRound(5, WINSTATUS_CTS);
@ -1669,7 +1690,10 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(CheckMapConditions)(void)
void CHalfLifeMultiplay::__MAKE_VHOOK(RestartRound)(void)
{
// tell bots that the round is restarting
TheBots->RestartRound();
if (TheBots != NULL)
{
TheBots->RestartRound();
}
if (g_pHostages != NULL)
{
@ -1780,7 +1804,10 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(RestartRound)(void)
plr->Reset();
}
TheBots->OnEvent(EVENT_NEW_MATCH);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_NEW_MATCH);
}
}
m_bFreezePeriod = TRUE;
@ -2031,7 +2058,10 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(RestartRound)(void)
GiveC4();
}
TheBots->OnEvent(EVENT_BUY_TIME_START);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_BUY_TIME_START);
}
// Reset game variables
m_flIntermissionEndTime = 0;
@ -2442,7 +2472,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(Think)(void)
{
RestartRound();
}
else
else if (TheCareerTasks != NULL)
{
bool isBotSpeaking = false;
@ -2505,14 +2535,8 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(Think)(void)
pPlayer->m_iHideHUD |= HIDEHUD_ALL;
m_fTeamCount = gpGlobals->time + 100000.0;
UTIL_LogPrintf
(
"Career Round %d %d %d %d\n",
m_iRoundWinStatus,
m_iNumCTWins,
m_iNumTerroristWins,
TheCareerTasks->AreAllTasksComplete()
);
UTIL_LogPrintf("Career Round %d %d %d %d\n", m_iRoundWinStatus, m_iNumCTWins,
m_iNumTerroristWins, TheCareerTasks->AreAllTasksComplete());
break;
}
@ -2588,14 +2612,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(Think)(void)
WRITE_BYTE(m_iRoundWinStatus);
MESSAGE_END();
UTIL_LogPrintf
(
"Career Match %d %d %d %d\n",
m_iRoundWinStatus,
m_iNumCTWins,
m_iNumTerroristWins,
TheCareerTasks->AreAllTasksComplete()
);
UTIL_LogPrintf("Career Match %d %d %d %d\n", m_iRoundWinStatus, m_iNumCTWins, m_iNumTerroristWins, TheCareerTasks->AreAllTasksComplete());
SERVER_COMMAND("setpause\n");
}
@ -2747,7 +2764,10 @@ void CHalfLifeMultiplay::CheckFreezePeriodExpired(void)
bool bCTPlayed = false;
bool bTPlayed = false;
TheCareerTasks->HandleEvent(EVENT_ROUND_START);
if (TheCareerTasks != NULL)
{
TheCareerTasks->HandleEvent(EVENT_ROUND_START);
}
for (int i = 1; i <= gpGlobals->maxClients; i++)
{
@ -2781,8 +2801,15 @@ void CHalfLifeMultiplay::CheckFreezePeriodExpired(void)
plr->SyncRoundTimer();
}
TheBots->OnEvent(EVENT_ROUND_START);
TheCareerTasks->HandleEvent(EVENT_ROUND_START);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_ROUND_START);
}
if (TheCareerTasks != NULL)
{
TheCareerTasks->HandleEvent(EVENT_ROUND_START);
}
}
void CHalfLifeMultiplay::CheckRoundTimeExpired(void)
@ -3017,7 +3044,12 @@ void CHalfLifeMultiplay::CareerRestart(void)
m_bCompleteReset = true;
m_fCareerRoundMenuTime = 0;
m_fCareerMatchMenuTime = 0;
TheCareerTasks->Reset(false);
if (TheCareerTasks != NULL)
{
TheCareerTasks->Reset(false);
}
m_bSkipSpawn = false;
for (int i = 1; i <= gpGlobals->maxClients; i++)
@ -4128,14 +4160,10 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(GoToIntermission)(void)
WRITE_BYTE(m_iRoundWinStatus);
MESSAGE_END();
UTIL_LogPrintf
(
"Career Match %d %d %d %d\n",
m_iRoundWinStatus,
m_iNumCTWins,
m_iNumTerroristWins,
TheCareerTasks->AreAllTasksComplete()
);
if (TheCareerTasks != NULL)
{
UTIL_LogPrintf("Career Match %d %d %d %d\n", m_iRoundWinStatus, m_iNumCTWins, m_iNumTerroristWins, TheCareerTasks->AreAllTasksComplete());
}
}
MESSAGE_BEGIN(MSG_ALL, SVC_INTERMISSION);

View File

@ -67,15 +67,11 @@ public:
#ifdef HOOK_GAMEDLL
#define WorldGraph (*pWorldGraph)
typedef int (CGraph::*FIND_NEAREST_NODE_ENTITY)(const Vector &, CBaseEntity *);
typedef int (CGraph::*FIND_NEAREST_NODE_INT)(const Vector &, int);
#endif // HOOK_GAMEDLL
#ifdef HOOK_GAMEDLL
#define WorldGraph (*pWorldGraph)
#endif //HOOK_GAMEDLL
extern CGraph WorldGraph;

View File

@ -42,7 +42,7 @@ public:
virtual int Restore(CRestore &restore);
float GetDelay(void)
{
return GetDelay_();
return m_flWait;
}
#ifdef HOOK_GAMEDLL
@ -51,10 +51,7 @@ public:
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
float GetDelay_(void)
{
return m_flWait;
}
#endif // HOOK_GAMEDLL
public:
@ -65,7 +62,11 @@ private:
};/* size: 156, cachelines: 3, members: 3 */
#ifdef HOOK_GAMEDLL
// linked objects
C_DLLEXPORT void path_corner(entvars_t *pev);
#endif // HOOK_GAMEDLL
#endif // PATHCORNER_H

View File

@ -56,13 +56,13 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION;
}
// This is done to fix spawn flag collisions between this class and a derived class
virtual BOOL IsTogglePlat(void)
{
return IsTogglePlat_();
return (pev->spawnflags & SF_PLAT_TOGGLE) != 0;
}
#ifdef HOOK_GAMEDLL
@ -71,14 +71,6 @@ public:
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION;
}
BOOL IsTogglePlat_(void)
{
return (pev->spawnflags & SF_PLAT_TOGGLE) != 0;
}
#endif // HOOK_GAMEDLL
@ -131,16 +123,12 @@ class CPlatTrigger: public CBaseEntity
public:
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_DONT_SAVE;
}
virtual void Touch(CBaseEntity *pOther);
#ifdef HOOK_GAMEDLL
int ObjectCaps_(void)
{
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_DONT_SAVE;
}
void Touch_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL
@ -244,16 +232,12 @@ public:
virtual void Spawn(void);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION;
}
#ifdef HOOK_GAMEDLL
void Spawn_(void);
int ObjectCaps_(void)
{
return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION;
}
#endif // HOOK_GAMEDLL
@ -355,7 +339,6 @@ public:
#endif // HOOK_GAMEDLL
};/* size: 380, cachelines: 6, members: 1 */
/* <12caec> ../cstrike/dlls/plats.cpp:2136 */
@ -367,22 +350,22 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION;
}
virtual void Activate(void);
virtual int Classify(void)
{
return Classify_();
return CLASS_MACHINE;
}
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual int BloodColor(void)
{
return BloodColor_();
return DONT_BLEED;
}
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
virtual Vector BodyTarget(const Vector &posSrc)
{
return BodyTarget_(posSrc);
return pev->origin;
}
#ifdef HOOK_GAMEDLL
@ -390,25 +373,9 @@ public:
void Spawn_(void);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION;
}
void Activate_(void);
int Classify_(void)
{
return CLASS_MACHINE;
}
int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
int BloodColor_(void)
{
return DONT_BLEED;
}
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
Vector BodyTarget_(const Vector &posSrc)
{
return pev->origin;
}
#endif // HOOK_GAMEDLL
@ -430,6 +397,8 @@ void PlatSpawnInsideTrigger(entvars_t *pevPlatform);
//float Fix(float angle);
void FixupAngles(Vector &v);
#ifdef HOOK_GAMEDLL
// linked objects
C_DLLEXPORT void func_plat(entvars_t *pev);
C_DLLEXPORT void func_platrot(entvars_t *pev);
@ -440,4 +409,6 @@ C_DLLEXPORT void func_trackchange(entvars_t *pev);
C_DLLEXPORT void func_trackautochange(entvars_t *pev);
C_DLLEXPORT void func_guntarget(entvars_t *pev);
#endif // HOOK_GAMEDLL
#endif // PLATS_H

View File

@ -9,6 +9,11 @@
#ifndef HOOK_GAMEDLL
int giPrecacheGrunt = 0;
int gmsgWeapPickup = 0;
int gmsgHudText = 0;
int gmsgHudTextArgs = 0;
int gmsgShake = 0;
int gmsgFade = 0;
int gmsgFlashlight = 0;
int gmsgFlashBattery = 0;
int gmsgResetHUD = 0;
@ -186,7 +191,7 @@ char *CDeadHEV::m_szPoses[] =
"deadtable"
};
#else //HOOK_GAMEDLL
#else // HOOK_GAMEDLL
int giPrecacheGrunt;
int gmsgWeapPickup;
@ -687,18 +692,20 @@ void CBasePlayer::Radio(const char *msg_id, const char *msg_verbose, short pitch
{
// search the place name where is located the player
const char *placeName = NULL;
Place playerPlace = TheNavAreaGrid.GetPlace(&pev->origin);
const BotPhraseList *placeList = TheBotPhrases->GetPlaceList();
for (BotPhraseList::const_iterator iter = placeList->begin(); iter != placeList->end(); ++iter)
if (TheBotPhrases != NULL)
{
if ((*iter)->GetID() == playerPlace)
Place playerPlace = TheNavAreaGrid.GetPlace(&pev->origin);
const BotPhraseList *placeList = TheBotPhrases->GetPlaceList();
for (BotPhraseList::const_iterator iter = placeList->begin(); iter != placeList->end(); ++iter)
{
placeName = (*iter)->GetName();
break;
if ((*iter)->GetID() == playerPlace)
{
placeName = (*iter)->GetName();
break;
}
}
}
if (placeName != NULL)
ClientPrint(pEntity->pev, HUD_PRINTRADIO, NumAsString(entindex()), "#Game_radio_location", STRING(pev->netname), placeName, msg_verbose);
else
@ -1195,8 +1202,10 @@ int CBasePlayer::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe
{
CHalfLifeMultiplay *mp = g_pGameRules;
if (TheBots)
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_PLAYER_TOOK_DAMAGE, this, pAttack);
}
if (mp->IsCareer())
{
@ -1211,7 +1220,10 @@ int CBasePlayer::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe
if (killedByHumanPlayer)
{
TheCareerTasks->HandleEnemyInjury(GetWeaponName(pevInflictor, pevAttacker), pPlayer->HasShield(), pPlayer);
if (TheCareerTasks != NULL)
{
TheCareerTasks->HandleEnemyInjury(GetWeaponName(pevInflictor, pevAttacker), pPlayer->HasShield(), pPlayer);
}
}
}
}
@ -1415,7 +1427,7 @@ int CBasePlayer::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe
{
CHalfLifeMultiplay *mp = g_pGameRules;
if (TheBots)
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_PLAYER_TOOK_DAMAGE, this, pAttack);
}
@ -1433,7 +1445,10 @@ int CBasePlayer::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe
if (killedByHumanPlayer)
{
TheCareerTasks->HandleEnemyInjury(GetWeaponName(pevInflictor, pevAttacker), pPlayer->HasShield(), pPlayer);
if (TheCareerTasks != NULL)
{
TheCareerTasks->HandleEnemyInjury(GetWeaponName(pevInflictor, pevAttacker), pPlayer->HasShield(), pPlayer);
}
}
}
}
@ -1976,18 +1991,24 @@ void CBasePlayer::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib)
CBaseEntity *pAttackerEntity = CBaseEntity::Instance(pevAttacker);
TheBots->OnEvent(EVENT_PLAYER_DIED, this, pAttackerEntity);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_PLAYER_DIED, this, pAttackerEntity);
}
if (g_pGameRules->IsCareer())
{
bool killerHasShield = false;
bool wasBlind = false;
if (!IsBot())
if (TheCareerTasks != NULL)
{
TheCareerTasks->HandleEvent(EVENT_DIE, NULL, this);
if (!IsBot())
{
TheCareerTasks->HandleEvent(EVENT_DIE, NULL, this);
}
TheCareerTasks->HandleDeath(m_iTeam, this);
}
TheCareerTasks->HandleDeath(m_iTeam, this);
if (!m_bKilledByBomb)
{
@ -2013,7 +2034,10 @@ void CBasePlayer::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib)
if (killedByHumanPlayer)
{
TheCareerTasks->HandleEnemyKill(wasBlind, GetWeaponName(g_pevLastInflictor, pevAttacker), m_bHeadshotKilled, killerHasShield, this, pPlayer);
if (TheCareerTasks != NULL)
{
TheCareerTasks->HandleEnemyKill(wasBlind, GetWeaponName(g_pevLastInflictor, pevAttacker), m_bHeadshotKilled, killerHasShield, this, pPlayer);
}
}
}
}
@ -2318,7 +2342,10 @@ void CBasePlayer::SetAnimation(PLAYER_ANIM playerAnim)
else
{
m_IdealActivity = ACT_HOP;
TheBots->OnEvent(EVENT_PLAYER_JUMPED, this);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_PLAYER_JUMPED, this);
}
}
break;
}
@ -2343,7 +2370,10 @@ void CBasePlayer::SetAnimation(PLAYER_ANIM playerAnim)
else
{
m_IdealActivity = ACT_RANGE_ATTACK1;
TheBots->OnEvent(EVENT_WEAPON_FIRED, this);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_WEAPON_FIRED, this);
}
}
break;
}
@ -2354,7 +2384,10 @@ void CBasePlayer::SetAnimation(PLAYER_ANIM playerAnim)
else
{
m_IdealActivity = ACT_RANGE_ATTACK2;
TheBots->OnEvent(EVENT_WEAPON_FIRED, this);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_WEAPON_FIRED, this);
}
}
break;
}
@ -2365,7 +2398,10 @@ void CBasePlayer::SetAnimation(PLAYER_ANIM playerAnim)
else
{
m_IdealActivity = ACT_RELOAD;
TheBots->OnEvent(EVENT_WEAPON_RELOADED, this);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_WEAPON_RELOADED, this);
}
}
break;
}
@ -2564,7 +2600,12 @@ void CBasePlayer::SetAnimation(PLAYER_ANIM playerAnim)
//TODO: maybe away used variable 'speed'?
//if (speed > 150.0f)
if (pev->velocity.Length2D() > 150.0f)
TheBots->OnEvent(EVENT_PLAYER_FOOTSTEP, this);
{
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_PLAYER_FOOTSTEP, this);
}
}
}
}
}
@ -3215,7 +3256,7 @@ void CBasePlayer::SyncRoundTimer(void)
MESSAGE_END();
}
if (mp->IsCareer())
if (TheCareerTasks != NULL && mp->IsCareer())
{
int remaining = 0;
bool shouldCountDown = false;
@ -3275,7 +3316,7 @@ void ShowMenu2(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, int f
}
/* <154e29> ../cstrike/dlls/player.cpp:3721 */
void WINAPI_HOOK CBasePlayer::MenuPrint(const char *msg)
void CBasePlayer::MenuPrint(const char *msg)
{
const char *msg_portion = msg;
char sbuf[MAX_BUFFER_MENU_BRIEFING + 1];
@ -4861,7 +4902,10 @@ void CBasePlayer::__MAKE_VHOOK(PostThink)(void)
m_LastHitGroup = HITGROUP_GENERIC;
TakeDamage(VARS(eoNullEntity), VARS(eoNullEntity), flFallDamage, DMG_FALL);
pev->punchangle.x = 0;
TheBots->OnEvent(EVENT_PLAYER_LANDED_FROM_HEIGHT, this);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_PLAYER_LANDED_FROM_HEIGHT, this);
}
}
}
}
@ -6808,7 +6852,6 @@ void CBasePlayer::__MAKE_VHOOK(UpdateClientData)(void)
if (m_iFOV != m_iClientFOV)
{
// cache FOV change at end of function, so weapon updates can see that FOV has changed
pev->fov = m_iFOV;
MESSAGE_BEGIN(MSG_ONE, gmsgSetFOV, NULL, pev);
@ -6867,7 +6910,7 @@ void CBasePlayer::__MAKE_VHOOK(UpdateClientData)(void)
// causes screen to flash, and pain compass to show direction of damage
edict_t *other = pev->dmg_inflictor;
if (other)
if (other != NULL)
{
CBaseEntity *pEntity = CBaseEntity::Instance(other);
@ -7258,7 +7301,7 @@ void CBasePlayer::UpdateStatusBar(void)
if (!FNullEnt(tr.pHit))
{
CBaseEntity *pEntity = CBaseEntity::Instance(tr.pHit);
bool isVisiblePlayer = (!TheBots->IsLineBlockedBySmoke(&pev->origin, &pEntity->pev->origin) && pEntity->Classify() == CLASS_PLAYER);
bool isVisiblePlayer = (TheBots != NULL && !TheBots->IsLineBlockedBySmoke(&pev->origin, &pEntity->pev->origin) && pEntity->Classify() == CLASS_PLAYER);
if (gpGlobals->time >= m_blindUntilTime && isVisiblePlayer)
{
@ -7485,8 +7528,11 @@ void CBasePlayer::DropPlayerItem(const char *pszItemName)
pWeaponBox->SetThink(&CWeaponBox::BombThink);
pWeaponBox->pev->nextthink = gpGlobals->time + 1;
TheCSBots()->SetLooseBomb(pWeaponBox);
TheCSBots()->OnEvent(EVENT_BOMB_DROPPED);
if (TheBots != NULL)
{
TheCSBots()->SetLooseBomb(pWeaponBox);
TheCSBots()->OnEvent(EVENT_BOMB_DROPPED);
}
}
if (pWeapon->iFlags() & ITEM_FLAG_EXHAUSTIBLE)
@ -7649,7 +7695,10 @@ void CBasePlayer::SwitchTeam(void)
}
MESSAGE_END();
TheBots->OnEvent(EVENT_PLAYER_CHANGED_TEAM, this);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_PLAYER_CHANGED_TEAM, this);
}
UpdateLocation(true);
@ -8074,7 +8123,7 @@ void CBasePlayer::CalculateYawBlend(void)
float dt;
float maxyaw = 255.0f;
float_precision flYaw;
float_precision flYaw; // view direction relative to movement
float_precision blend_yaw;
dt = gpGlobals->frametime;
@ -8087,6 +8136,7 @@ void CBasePlayer::CalculateYawBlend(void)
StudioEstimateGait();
// calc side to side turning
flYaw = fmod((float_precision)(pev->angles.y - m_flGaityaw), 360);
if (flYaw < -180)
@ -8149,11 +8199,13 @@ void CBasePlayer::StudioProcessGait(void)
pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + pev->gaitsequence;
// calc gait frame
if (pseqdesc->linearmovement.x > 0.0f)
m_flGaitframe += (m_flGaitMovement / pseqdesc->linearmovement.x) * pseqdesc->numframes;
else
m_flGaitframe += pev->framerate * pseqdesc->fps * dt;
// do modulo
m_flGaitframe -= (int)(m_flGaitframe / pseqdesc->numframes) * pseqdesc->numframes;
if (m_flGaitframe < 0)
@ -8847,6 +8899,9 @@ const char *CBasePlayer::PickSecondaryCareerTaskWeapon(void)
/* <15b9ea> ../cstrike/dlls/player.cpp:10759 */
const char *CBasePlayer::PickFlashKillWeaponString(void)
{
if (TheCareerTasks == NULL)
return NULL;
bool foundOne = false;
for (CareerTaskListIt it = TheCareerTasks->GetTasks()->begin(); it != TheCareerTasks->GetTasks()->end(); ++it)
@ -8869,6 +8924,9 @@ const char *CBasePlayer::PickFlashKillWeaponString(void)
/* <15baa1> ../cstrike/dlls/player.cpp:10787 */
const char *CBasePlayer::PickGrenadeKillWeaponString(void)
{
if (TheCareerTasks == NULL)
return NULL;
bool foundOne = false;
for (CareerTaskListIt it = TheCareerTasks->GetTasks()->begin(); it != TheCareerTasks->GetTasks()->end(); ++it)
@ -9164,8 +9222,10 @@ void CBasePlayer::Rebuy(void)
m_bIsInRebuy = false;
if (TheTutor)
if (TheTutor != NULL)
{
TheTutor->OnEvent(EVENT_PLAYER_LEFT_BUY_ZONE);
}
}
/* <15c96a> ../cstrike/dlls/player.cpp:11200 */

View File

@ -33,7 +33,6 @@
#endif
#include "hintmessage.h"
//#include "weapons.h"
#define MAX_BUFFER_MENU 175//?
#define MAX_BUFFER_MENU_BRIEFING 50
@ -430,16 +429,12 @@ public:
virtual void Think(void);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return FCAP_DONT_SAVE;
}
#ifdef HOOK_GAMEDLL
void Think_(void);
int ObjectCaps_(void)
{
return FCAP_DONT_SAVE;
}
#endif // HOOK_GAMEDLL
@ -461,14 +456,13 @@ public:
class CBasePlayer: public CBaseMonster
{
public:
virtual void Spawn(void);
virtual void Precache(void);
virtual int Save(CSave &save);
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return (CBaseMonster::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
virtual int Classify(void);
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType);
@ -482,38 +476,38 @@ public:
virtual int GiveAmmo(int iAmount, char *szName, int iMax);
virtual void StartSneaking(void)
{
StartSneaking_();
m_tSneaking = gpGlobals->time - 1;
}
virtual void StopSneaking(void)
{
StopSneaking_();
m_tSneaking = gpGlobals->time + 30;
}
virtual BOOL IsSneaking(void)
{
return IsSneaking_();
return m_tSneaking <= gpGlobals->time;
}
virtual BOOL IsAlive(void)
{
return IsAlive_();
return (pev->deadflag == DEAD_NO && pev->health > 0.0f);
}
virtual BOOL IsPlayer(void)
{
return IsPlayer_();
return (pev->flags & FL_SPECTATOR) != FL_SPECTATOR;
}
virtual BOOL IsNetClient(void)
{
return IsNetClient_();
return TRUE;
}
virtual const char *TeamID(void);
virtual BOOL FBecomeProne(void);
virtual Vector BodyTarget(const Vector &posSrc)
{
return BodyTarget_(posSrc);
return Center() + pev->view_ofs * RANDOM_FLOAT(0.5, 1.1);
}
virtual int Illumination(void);
virtual BOOL ShouldFadeOnDeath(void)
{
return ShouldFadeOnDeath_();
return FALSE;
}
virtual void ResetMaxSpeed(void);
virtual void Jump(void);
@ -523,7 +517,7 @@ public:
virtual Vector GetGunPosition(void);
virtual BOOL IsBot(void)
{
return IsBot_();
return FALSE;
}
virtual void UpdateClientData(void);
virtual void ImpulseCommands(void);
@ -532,7 +526,7 @@ public:
virtual void Blind(float flUntilTime, float flHoldTime, float flFadeTime, int iAlpha);
virtual void OnTouchingWeapon(CWeaponBox *pWeapon)
{
OnTouchingWeapon_(pWeapon);
;
}
#ifdef HOOK_GAMEDLL
@ -541,10 +535,6 @@ public:
void Precache_(void);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return (CBaseMonster::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
int Classify_(void);
void TraceAttack_(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType);
int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
@ -555,60 +545,20 @@ public:
BOOL AddPlayerItem_(CBasePlayerItem *pItem);
BOOL RemovePlayerItem_(CBasePlayerItem *pItem);
int GiveAmmo_(int iAmount,char *szName,int iMax);
void StartSneaking_(void)
{
m_tSneaking = gpGlobals->time - 1;
}
void StopSneaking_(void)
{
m_tSneaking = gpGlobals->time + 30;
}
BOOL IsSneaking_(void)
{
return m_tSneaking <= gpGlobals->time;
}
BOOL IsAlive_(void)
{
return (pev->deadflag == DEAD_NO && pev->health > 0.0f);
}
BOOL IsPlayer_(void)
{
return (pev->flags & FL_SPECTATOR) != FL_SPECTATOR;
}
BOOL IsNetClient_(void)
{
return TRUE;
}
const char *TeamID_(void);
BOOL FBecomeProne_(void);
Vector BodyTarget_(const Vector &posSrc)
{
return Center() + pev->view_ofs * RANDOM_FLOAT(0.5, 1.1);
}
int Illumination_(void);
BOOL ShouldFadeOnDeath_(void)
{
return FALSE;
}
void ResetMaxSpeed_(void);
void Jump_(void);
void Duck_(void);
void PreThink_(void);
void PostThink_(void);
Vector GetGunPosition_(void);
BOOL IsBot_(void)
{
return FALSE;
}
void UpdateClientData_(void);
void ImpulseCommands_(void);
void RoundRespawn_(void);
Vector GetAutoaimVector_(float flDelta);
void Blind_(float flUntilTime, float flHoldTime, float flFadeTime, int iAlpha);
void OnTouchingWeapon_(CWeaponBox *pWeapon)
{
;
}
#endif // HOOK_GAMEDLL
@ -699,7 +649,7 @@ public:
void HostageUsed(void);
void JoiningThink(void);
void RemoveLevelText(void);
void WINAPI_HOOK MenuPrint(const char *msg);
void MenuPrint(const char *msg);
void ResetMenu(void);
void SyncRoundTimer(void);
void CheckSuitUpdate(void);
@ -743,7 +693,7 @@ public:
bool SelectSpawnSpot(const char *pEntClassName, CBaseEntity* &pSpot);
bool IsReloading(void)
{
if (m_pActiveItem && ((CBasePlayerWeapon *)m_pActiveItem)->m_fInReload)
if (m_pActiveItem != NULL && ((CBasePlayerWeapon *)m_pActiveItem)->m_fInReload)
return true;
return false;
@ -962,10 +912,8 @@ public:
static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_playerSaveData)[40];
//TOOD: check out!
//protected:
int m_modelIndexPlayer;//++1964
/*protected:*/
int m_modelIndexPlayer;
char m_szAnimExtention[32];
int m_iGaitsequence;
@ -1132,6 +1080,8 @@ extern int gmsgBrass;
extern int gmsgFog;
extern int gmsgShowTimer;
#ifdef HOOK_GAMEDLL
// linked objects
C_DLLEXPORT void player(entvars_t *pev);
C_DLLEXPORT void weapon_shield(entvars_t *pev);
@ -1140,6 +1090,8 @@ C_DLLEXPORT void player_loadsaved(entvars_t *pev);
C_DLLEXPORT void player_weaponstrip(entvars_t *pev);
C_DLLEXPORT void monster_hevsuit_dead(entvars_t *pev);
#endif // HOOK_GAMEDLL
void OLD_CheckBuyZone(CBasePlayer *player);
void OLD_CheckBombTarget(CBasePlayer *player);
void OLD_CheckRescueZone(CBasePlayer *player);

View File

@ -55,35 +55,35 @@ public:
void EXPORT LoadThink(void);
public:
inline float Duration(void)
float Duration(void)
{
return pev->dmg_take;
}
inline float HoldTime(void)
float HoldTime(void)
{
return pev->dmg_save;
}
inline float MessageTime(void)
float MessageTime(void)
{
return m_messageTime;
}
inline float LoadTime(void)
float LoadTime(void)
{
return m_loadTime;
}
inline void SetDuration(float duration)
void SetDuration(float duration)
{
pev->dmg_take = duration;
}
inline void SetHoldTime(float hold)
void SetHoldTime(float hold)
{
pev->dmg_save = hold;
}
inline void SetMessageTime(float time)
void SetMessageTime(float time)
{
m_messageTime = time;
}
inline void SetLoadTime(float time)
void SetLoadTime(float time)
{
m_loadTime = time;
}

View File

@ -53,13 +53,13 @@
#endif // HOOK_GAMEDLL
#define IMPLEMENT_SAVERESTORE(derivedClass, baseClass)\
int derivedClass::Save_(CSave &save)\
int derivedClass::__MAKE_VHOOK(Save)(CSave &save)\
{\
if (!baseClass::Save(save))\
return 0;\
return save.WriteFields(#derivedClass, this, IMPLEMENT_ARRAY(m_SaveData), ARRAYSIZE(IMPLEMENT_ARRAY(m_SaveData)));\
}\
int derivedClass::Restore_(CRestore &restore)\
int derivedClass::__MAKE_VHOOK(Restore)(CRestore &restore)\
{\
if (!baseClass::Restore(restore))\
return 0;\
@ -173,25 +173,20 @@ public:
short ReadShort(void);
int ReadNamedInt(const char *pName);
char *ReadNamedString(const char *pName);
inline int Empty(void)
int Empty(void)
{
return (m_pdata == NULL || ((m_pdata->pCurrentData - m_pdata->pBaseData) >= m_pdata->bufferSize));
}
inline void SetGlobalMode(int global)
void SetGlobalMode(int global)
{
m_global = global;
}
inline void PrecacheMode(BOOL mode)
void PrecacheMode(BOOL mode)
{
m_precache = mode;
}
#ifdef HOOK_GAMEDLL
public:
#else
private:
#endif // HOOK_GAMEDLL
char *BufferPointer(void);
void BufferReadBytes(char *pOutput, int size);
void BufferSkipBytes(int bytes);
@ -220,7 +215,7 @@ public:
GLOBALESTATE EntityGetState(string_t globalname);
int EntityInTable(string_t globalname)
{
return (Find(globalname) != NULL) ? 1 : 0;
return (Find(globalname) != NULL) ? TRUE : FALSE;
}
int Save(CSave &save);
int Restore(CRestore &restore);
@ -228,14 +223,9 @@ public:
static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[1];
#ifdef HOOK_GAMEDLL
public:
#else
private:
#endif // HOOK_GAMEDLL
globalentity_t *Find(string_t globalname);
private:
globalentity_t *m_pList;
int m_listCount;

View File

@ -120,7 +120,7 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
#ifdef HOOK_GAMEDLL
@ -131,10 +131,6 @@ public:
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
#endif // HOOK_GAMEDLL
@ -192,7 +188,7 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
#ifdef HOOK_GAMEDLL
@ -202,10 +198,6 @@ public:
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
#endif // HOOK_GAMEDLL

View File

@ -89,7 +89,7 @@ public:
virtual void Precache(void);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return FCAP_DONT_SAVE;
}
virtual void Think(void);
@ -97,10 +97,6 @@ public:
void Spawn_(void);
void Precache_(void);
int ObjectCaps_(void)
{
return FCAP_DONT_SAVE;
}
void Think_(void);
#endif // HOOK_GAMEDLL
@ -147,7 +143,11 @@ private:
extern CSoundEnt *pSoundEnt;
#ifdef HOOK_GAMEDLL
// linked objects
C_DLLEXPORT void soundent(entvars_t *pev);
#endif // HOOK_GAMEDLL
#endif // SOUNDENT_H

View File

@ -42,13 +42,12 @@ public:
void SpectatorThink(void);
#ifdef HOOK_GAMEDLL
void Spawn_(void);
#endif // HOOK_GAMEDLL
#ifndef HOOK_GAMEDLL
private:
#endif // HOOK_GAMEDLL
void SpectatorImpulseCommand(void);
};/* size: 152, cachelines: 3, members: 1 */

View File

@ -66,6 +66,8 @@ void FireTargets(const char *targetName, CBaseEntity *pActivator, CBaseEntity *p
void SetMovedir(entvars_t *pev);
NOXREF BOOL FEntIsVisible(entvars_t *pev, entvars_t *pevTarget);
#ifdef HOOK_GAMEDLL
// linked objects
C_DLLEXPORT void info_null(entvars_t *pev);
C_DLLEXPORT void info_player_deathmatch(entvars_t *pev);
@ -76,4 +78,6 @@ C_DLLEXPORT void info_hostage_rescue(entvars_t *pev);
C_DLLEXPORT void info_bomb_target(entvars_t *pev);
C_DLLEXPORT void DelayedUse(entvars_t *pev);
#endif // HOOK_GAMEDLL
#endif // SUBS_H

View File

@ -54,7 +54,7 @@ void CHalfLifeTraining::HostageDied(void)
{
CBasePlayer *pPlayer = reinterpret_cast<CBasePlayer *>(UTIL_PlayerByIndex(1));
if (pPlayer)
if (pPlayer != NULL)
{
pPlayer->pev->radsuit_finished = gpGlobals->time + 3;
}
@ -205,7 +205,10 @@ void CHalfLifeTraining::__MAKE_VHOOK(PlayerThink)(CBasePlayer *pPlayer)
pPlayer->pev->scale = pPlayer->m_iAccount;
pPlayer->pev->ideal_yaw = pPlayer->m_bHasDefuser;
TheBots->OnEvent(EVENT_PLAYER_CHANGED_TEAM, pPlayer);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_PLAYER_CHANGED_TEAM, pPlayer);
}
}
/* <18b79c> ../cstrike/dlls/training_gamerules.cpp:151 */

View File

@ -40,7 +40,7 @@ public:
public:
virtual BOOL IsMultiplayer(void)
{
return IsMultiplayer_();
return FALSE;
}
virtual BOOL IsDeathmatch(void);
virtual void InitHUD(CBasePlayer *pl);
@ -55,10 +55,6 @@ public:
#ifdef HOOK_GAMEDLL
BOOL IsMultiplayer_(void)
{
return FALSE;
}
BOOL IsDeathmatch_(void);
void InitHUD_(CBasePlayer *pl);
void PlayerSpawn_(CBasePlayer *pPlayer);
@ -75,7 +71,6 @@ public:
static void HostageDied(void);
static bool PlayerCanBuy(CBasePlayer *pPlayer);
//private:
float FillAccountTime;
float ServerRestartTime;
BOOL fInBuyArea;
@ -94,7 +89,7 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
virtual void Think(void);
virtual void Touch(CBaseEntity *pOther);
@ -105,10 +100,6 @@ public:
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
void Think_(void);
void Touch_(CBaseEntity *pOther);
@ -158,8 +149,12 @@ private:
};/* size: 300, cachelines: 5, members: 8 */
#ifdef HOOK_GAMEDLL
// linked objects
C_DLLEXPORT void func_grencatch(entvars_t *pev);
C_DLLEXPORT void func_weaponcheck(entvars_t *pev);
#endif // HOOK_GAMEDLL
#endif // TRAINING_GAMERULES_H

View File

@ -110,7 +110,7 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_DIRECTIONAL_USE;
}
virtual void OverrideReset(void);
virtual BOOL OnControls(entvars_t *pev);
@ -125,10 +125,6 @@ public:
void KeyValue_(KeyValueData* pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_DIRECTIONAL_USE;
}
void OverrideReset_(void);
BOOL OnControls_(entvars_t *pev);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -190,7 +186,7 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_DIRECTIONAL_USE;
}
virtual int Classify(void);
virtual void OverrideReset(void);
@ -206,10 +202,6 @@ public:
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_DIRECTIONAL_USE;
}
int Classify_(void);
void OverrideReset_(void);
BOOL OnControls_(entvars_t *pev);
@ -282,7 +274,11 @@ private:
};/* size: 364, cachelines: 6, members: 35 */
#ifdef HOOK_GAMEDLL
// linked objects
C_DLLEXPORT void path_track(entvars_t *pev);
#endif // HOOK_GAMEDLL
#endif // TRAINS_H

View File

@ -77,7 +77,7 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
#ifdef HOOK_GAMEDLL
@ -86,10 +86,6 @@ public:
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
#endif // HOOK_GAMEDLL
@ -117,7 +113,7 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return (CBaseDelay::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
virtual void Think(void);
@ -128,10 +124,6 @@ public:
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return (CBaseDelay::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
void Think_(void);
#endif // HOOK_GAMEDLL
@ -154,7 +146,7 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return (CBaseDelay::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -164,10 +156,6 @@ public:
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return (CBaseDelay::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
@ -195,7 +183,7 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return (CBaseToggle::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
virtual BOOL HasTarget(string_t targetname);
@ -206,10 +194,6 @@ public:
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return (CBaseToggle::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
BOOL HasTarget_(string_t targetname);
#endif // HOOK_GAMEDLL
@ -220,7 +204,7 @@ public:
private:
/* <19dfe1> ../cstrike/dlls/triggers.cpp:293 */
inline BOOL IsClone(void)
BOOL IsClone(void)
{
if (pev->spawnflags & SF_MULTIMAN_CLONE)
{
@ -230,7 +214,7 @@ private:
return FALSE;
}
/* <19e4f3> ../cstrike/dlls/triggers.cpp:294 */
inline BOOL ShouldClone(void)
BOOL ShouldClone(void)
{
if (IsClone())
{
@ -286,16 +270,12 @@ public:
virtual void KeyValue(KeyValueData *pkvd);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return (CBaseToggle::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
#ifdef HOOK_GAMEDLL
void KeyValue_(KeyValueData *pkvd);
int ObjectCaps_(void)
{
return (CBaseToggle::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
#endif // HOOK_GAMEDLL
@ -498,7 +478,7 @@ public:
virtual void Precache(void);
virtual int ObjectCaps(void) // Always go across transitions
{
return ObjectCaps_();
return (CBaseDelay::ObjectCaps() | FCAP_FORCE_TRANSITION);
}
virtual void Think(void);
@ -506,10 +486,6 @@ public:
void Spawn_(void);
void Precache_(void);
int ObjectCaps_(void)
{
return (CBaseDelay::ObjectCaps() | FCAP_FORCE_TRANSITION);
}
void Think_(void);
#endif // HOOK_GAMEDLL
@ -756,7 +732,7 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -766,10 +742,6 @@ public:
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
@ -792,7 +764,7 @@ public:
virtual int Restore(CRestore &restore);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -802,10 +774,6 @@ public:
void KeyValue_(KeyValueData *pkvd);
int Save_(CSave &save);
int Restore_(CRestore &restore);
int ObjectCaps_(void)
{
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL

View File

@ -37,7 +37,7 @@ float s_nextCvarCheckTime;
/* <1dfdbc> ../cstrike/dlls/tutor.cpp:32 */
void InstallTutor(bool start)
{
if (TheTutor)
if (TheTutor != NULL)
{
delete TheTutor;
TheTutor = NULL;

View File

@ -32,6 +32,8 @@
#pragma once
#endif
#ifdef HOOK_GAMEDLL
#define s_tutorDisabledThisGame (*ps_tutorDisabledThisGame)
#define s_nextCvarCheckTime (*ps_nextCvarCheckTime)
@ -46,6 +48,8 @@
#define cv_tutor_message_character_display_time_coefficient (*pcv_tutor_message_character_display_time_coefficient)
#define cv_tutor_hint_interval_time (*pcv_tutor_hint_interval_time)
#endif // HOOK_GAMEDLL
extern bool s_tutorDisabledThisGame;
extern float s_nextCvarCheckTime;

View File

@ -1,6 +1,6 @@
#include "precompiled.h"
CBaseTutor *TheTutor;
CBaseTutor *TheTutor = NULL;
/* <1f545d> ../cstrike/dlls/tutor_base_tutor.cpp:22 */
TutorMessageEvent::TutorMessageEvent(int mid, int duplicateID, float time, float lifetime, int priority)

View File

@ -72,7 +72,6 @@ public:
virtual char *GetCurrentStateString(void);
#ifdef HOOK_GAMEDLL
public:
bool UpdateState_(GameEventType event, CBaseEntity *entity, CBaseEntity *other);
char *GetCurrentStateString_(void);
@ -80,10 +79,7 @@ public:
#endif // HOOK_GAMEDLL
#ifndef HOOK_GAMEDLL
protected:
#endif // HOOK_GAMEDLL
virtual CBaseTutorState *ConstructNewState(int stateType);
};/* size: 8, cachelines: 1, members: 1 */
@ -157,7 +153,9 @@ protected:
};/* size: 8, cachelines: 1, members: 1 */
#ifdef HOOK_GAMEDLL
#define g_TutorStateStrings (*pg_TutorStateStrings)
#endif // HOOK_GAMEDLL
extern char *const g_TutorStateStrings[20];

View File

@ -255,7 +255,6 @@ enum TutorMessageID
TUTOR_NUM_MESSAGES
};
//typedef map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, TutorMessage*, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, TutorMessage*> > > TutorMessageMap;
typedef std::map<std::string, TutorMessage *> TutorMessageMap;
typedef TutorMessageMap::iterator TutorMessageMapIter;

View File

@ -1,22 +1,7 @@
#include "precompiled.h"
#if 1
void *addr_orig;
char patchByte[5];
char patchByteOriginal[5];
//static DWORD oldProtection;
///VirtualProtect(addr_orig,5,PAGE_EXECUTE_READWRITE,&oldProtection);
//memcpy(addr_orig,patchByteOriginal,5);
//pWeaponUSP(a);
//int seedad = pUTIL_SharedRandomLong(seed,low,high);
//memcpy(addr_orig,patchByte,5);
#endif
unsigned int glSeed;
CUtlVector< hash_item_t > stringsHashTable;
CUtlVector<hash_item_t> stringsHashTable;
/*
* Globals initialization
@ -580,21 +565,10 @@ CBaseEntity *UTIL_PlayerByIndex(int playerIndex)
return pPlayer;
}
extern bool bActivateGo;
/* <1abab0> ../cstrike/dlls/util.cpp:728 */
void UTIL_MakeVectors(const Vector &vecAngles)
{
/*if (bActivateGo)
{
static int iNum = 0;
_logf("#%d. vecAngles: (%.12f, %.12f, %.12f)", iNum,
vecAngles[0], vecAngles[1], vecAngles[2]);
//_logf("\n\n");
iNum++;
}*/
MAKE_VECTORS(vecAngles);
}
@ -2454,12 +2428,14 @@ NOXREF int GetPlayerTeam(int index)
/* <1b5412> ../cstrike/dlls/util.cpp:2775 */
bool UTIL_IsGame(const char *gameName)
{
#ifndef CSTRIKE
if (gameName != NULL)
{
static char gameDir[256];
GET_GAME_DIR(gameDir);
return (Q_stricmp(gameDir, gameName) == 0);
}
#endif // CSTRIKE
return false;
}

View File

@ -279,7 +279,7 @@ inline entvars_t *VARS(EOFFSET eoffset)
}
/* <2ee03> ../cstrike/dlls/util.h:189 */
inline int ENTINDEX(edict_t *pEdict)
inline int ENTINDEX(const edict_t *pEdict)
{
return (*g_engfuncs.pfnIndexOfEdict)(pEdict);
}
@ -496,12 +496,4 @@ typedef int (CSaveRestoreBuffer::*CSAVERESTOREBUFFER_POINTER)(const char *,const
#endif // HOOK_GAMEDLL
#if 1
extern void *addr_orig;
extern char patchByte[5];
extern char patchByteOriginal[5];
#endif
#endif // UTIL_H

View File

@ -37,58 +37,64 @@ class Vector2D
{
public:
vec_t x, y;
inline Vector2D(void) : x(0.0), y(0.0)
{
}
inline Vector2D(float X, float Y) : x(0.0), y(0.0)
Vector2D(void) : x(0.0), y(0.0) {}
Vector2D(float X, float Y) : x(0.0), y(0.0)
{
x = X;
y = Y;
}
inline Vector2D operator+(const Vector2D &v) const
Vector2D operator+(const Vector2D &v) const
{
return Vector2D(x + v.x, y + v.y);
}
inline Vector2D operator-(const Vector2D &v) const
Vector2D operator-(const Vector2D &v) const
{
return Vector2D(x - v.x, y - v.y);
}
#ifdef HOOK_GAMEDLL
inline Vector2D operator*(float_precision fl) const
Vector2D operator*(float_precision fl) const
{
return Vector2D((vec_t)(x * fl), (vec_t)(y * fl));
}
inline Vector2D operator/(float_precision fl) const
Vector2D operator/(float_precision fl) const
{
return Vector2D((vec_t)(x / fl), (vec_t)(y / fl));
}
inline Vector2D operator/=(float_precision fl) const
Vector2D operator/=(float_precision fl) const
{
return Vector2D((vec_t)(x / fl), (vec_t)(y / fl));
}
#else
inline Vector2D operator*(float fl) const
Vector2D operator*(float fl) const
{
return Vector2D(x * fl, y * fl);
}
inline Vector2D operator/(float fl) const
Vector2D operator/(float fl) const
{
return Vector2D(x / fl, y / fl);
}
inline Vector2D operator/=(float fl) const
Vector2D operator/=(float fl) const
{
return Vector2D(x / fl, y / fl);
}
#endif // HOOK_GAMEDLL
inline double Length(void) const
float_precision Length(void) const
{
return sqrt((float_precision)(x * x + y * y));
}
inline float LengthSquared(void) const
float LengthSquared(void) const
{
return (x * x + y * y);
}
inline Vector2D Normalize(void) const
operator float*()
{
return &x;
}
operator const float*() const
{
return &x;
}
Vector2D Normalize(void) const
{
float_precision flLen = Length();
if (!flLen)
@ -102,15 +108,15 @@ public:
return Vector2D(x * flLen, y * flLen);
#endif // HOOK_GAMEDLL
}
inline bool IsLengthLessThan(float length) const
bool IsLengthLessThan(float length) const
{
return (LengthSquared() < length * length);
}
inline bool IsLengthGreaterThan(float length) const
bool IsLengthGreaterThan(float length) const
{
return (LengthSquared() > length * length);
}
inline float_precision NormalizeInPlace(void)
float_precision NormalizeInPlace(void)
{
float_precision flLen = Length();
if (flLen > 0.0)
@ -125,7 +131,7 @@ public:
}
return flLen;
}
inline bool IsZero(float tolerance = 0.01f) const
bool IsZero(float tolerance = 0.01f) const
{
return (x > -tolerance && x < tolerance &&
y > -tolerance && y < tolerance);
@ -137,6 +143,7 @@ inline float DotProduct(const Vector2D &a, const Vector2D &b)
{
return (a.x * b.x + a.y * b.y);
}
inline Vector2D operator*(float fl, const Vector2D &v)
{
return v * fl;
@ -147,82 +154,79 @@ class Vector
{
public:
vec_t x, y, z;
inline Vector(void) : x(0.0), y(0.0), z(0.0)
{
}
inline Vector(float X, float Y, float Z) : x(0.0), y(0.0), z(0.0)
Vector(void) : x(0.0), y(0.0), z(0.0) {}
Vector(float X, float Y, float Z) : x(0.0), y(0.0), z(0.0)
{
x = X;
y = Y;
z = Z;
}
inline Vector(const Vector &v) : x(0.0), y(0.0), z(0.0)
Vector(const Vector &v) : x(0.0), y(0.0), z(0.0)
{
x = v.x;
y = v.y;
z = v.z;
}
inline Vector(const float rgfl[3]) : x(0.0), y(0.0), z(0.0)
Vector(const float rgfl[3]) : x(0.0), y(0.0), z(0.0)
{
x = rgfl[0];
y = rgfl[1];
z = rgfl[2];
}
inline Vector operator-(void) const
Vector operator-(void) const
{
return Vector(-x, -y, -z);
}
inline int operator==(const Vector &v) const
int operator==(const Vector &v) const
{
return x == v.x && y == v.y && z == v.z;
}
inline int operator!=(const Vector &v) const
int operator!=(const Vector &v) const
{
return !(*this == v);
}
inline Vector operator+(const Vector &v) const
Vector operator+(const Vector &v) const
{
return Vector(x + v.x, y + v.y, z + v.z);
}
inline Vector operator-(const Vector &v) const
Vector operator-(const Vector &v) const
{
return Vector(x - v.x, y - v.y, z - v.z);
}
#ifdef HOOK_GAMEDLL
inline Vector operator*(float_precision fl) const
Vector operator*(float_precision fl) const
{
return Vector((vec_t)(x * fl), (vec_t)(y * fl), (vec_t)(z * fl));
}
inline Vector operator/(float_precision fl) const
Vector operator/(float_precision fl) const
{
return Vector((vec_t)(x / fl), (vec_t)(y / fl), (vec_t)(z / fl));
}
inline Vector operator/=(float_precision fl) const
Vector operator/=(float_precision fl) const
{
return Vector((vec_t)(x / fl), (vec_t)(y / fl), (vec_t)(z / fl));
}
#else
inline Vector operator*(float fl) const
Vector operator*(float fl) const
{
return Vector(x * fl, y * fl, z * fl);
}
inline Vector operator/(float fl) const
Vector operator/(float fl) const
{
return Vector(x / fl, y / fl, z / fl);
}
inline Vector operator/=(float fl) const
Vector operator/=(float fl) const
{
return Vector(x / fl, y / fl, z / fl);
}
#endif // HOOK_GAMEDLL
inline void CopyToArray(float *rgfl) const
void CopyToArray(float *rgfl) const
{
rgfl[0] = x;
rgfl[1] = y;
rgfl[2] = z;
}
inline float_precision Length(void) const
float_precision Length(void) const
{
float_precision x1 = (float_precision)x;
float_precision y1 = (float_precision)y;
@ -232,7 +236,7 @@ public:
//return sqrt((float_precision)(x * x + y * y + z * z));
}
inline float LengthSquared(void) const
float LengthSquared(void) const
{
return (x * x + y * y + z * z);
}
@ -245,7 +249,7 @@ public:
return &x;
}
#ifndef HOOK_GAMEDLL
inline Vector Normalize(void)
Vector Normalize(void)
{
float flLen = Length();
if (flLen == 0)
@ -255,7 +259,7 @@ public:
return Vector(x * flLen, y * flLen, z * flLen);
}
#else
inline Vector Normalize(void)
Vector Normalize(void)
{
float_precision flLen = Length();
if (flLen == 0)
@ -264,8 +268,9 @@ public:
vec_t fTemp = (vec_t)(1 / flLen);
return Vector(x * fTemp, y * fTemp, z * fTemp);
}
#endif // HOOK_GAMEDLL
// for out precision normalize
inline Vector NormalizePrecision(void)
Vector NormalizePrecision(void)
{
#ifndef HOOK_GAMEDLL
return Normalize();
@ -278,50 +283,71 @@ public:
return Vector((vec_t)(x * flLen), (vec_t)(y * flLen), (vec_t)(z * flLen));
#endif // HOOK_GAMEDLL
}
#endif // HOOK_GAMEDLL
inline Vector2D Make2D(void) const
Vector2D Make2D(void) const
{
Vector2D Vec2;
Vec2.x = x;
Vec2.y = y;
return Vec2;
}
inline double Length2D(void) const
float_precision Length2D(void) const
{
return sqrt((float_precision)(x * x + y * y));
}
inline bool IsLengthLessThan(float length) const
bool IsLengthLessThan(float length) const
{
return (LengthSquared() < length * length);
}
inline bool IsLengthGreaterThan(float length) const
bool IsLengthGreaterThan(float length) const
{
UNTESTED
return (LengthSquared() > length * length);
}
inline float_precision NormalizeInPlace(void)
#ifdef HOOK_GAMEDLL
float_precision NormalizeInPlace(void)
{
float_precision flLen = Length();
if (flLen > 0.0)
if (flLen > 0)
{
x /= (vec_t)flLen;
y /= (vec_t)flLen;
z /= (vec_t)flLen;
x = (vec_t)(1 / flLen * x);
y = (vec_t)(1 / flLen * y);
z = (vec_t)(1 / flLen * z);
}
else
{
x = 0.0;
y = 0.0;
z = 1.0;
x = 0;
y = 0;
z = 1;
}
return flLen;
}
#else // HOOK_GAMEDLL
float NormalizeInPlace(void)
{
float flLen = Length();
if (flLen > 0)
{
x /= flLen;
y /= flLen;
z /= flLen;
}
else
{
x = 0;
y = 0;
z = 1;
}
return flLen;
}
inline bool IsZero(float tolerance = 0.01f) const
#endif // HOOK_GAMEDLL
bool IsZero(float tolerance = 0.01f) const
{
return (x > -tolerance && x < tolerance &&
y > -tolerance && y < tolerance &&
z > -tolerance && z < tolerance);
}
};/* size: 12, cachelines: 1, members: 3 */
/* <1c0d1> ../cstrike/dlls/vector.h:184 */
@ -402,4 +428,35 @@ inline Vector NormalizeSubtract(Vector vecStart, Vector vecDest)
return dir;
}
#ifdef HOOK_GAMEDLL
template<
typename X,
typename Y,
typename LenType
>
inline Vector NormalizeMulScalar(Vector2D vec, float scalar)
{
LenType flLen;
X floatX;
Y floatY;
flLen = (LenType)vec.Length();
if (flLen <= 0.0)
{
floatX = 1;
floatY = 0;
}
else
{
flLen = 1 / flLen;
floatX = vec.x * flLen;
floatY = vec.y * flLen;
}
return Vector((vec_t)(floatX * scalar), (vec_t)(floatY * scalar), 0);
}
#endif // HOOK_GAMEDLL
#endif // VECTOR_H

View File

@ -58,16 +58,12 @@ public:
virtual void Spawn(void);
virtual int ObjectCaps(void)
{
return ObjectCaps_();
return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION;
}
#ifdef HOOK_GAMEDLL
void Spawn_(void);
int ObjectCaps_(void)
{
return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION;
}
#endif // HOOK_GAMEDLL
@ -79,8 +75,12 @@ public:
float_precision Fix2(float angle);
void FixupAngles2(Vector &v);
#ifdef HOOK_GAMEDLL
// linked objects
C_DLLEXPORT void func_vehicle(entvars_t *pev);
C_DLLEXPORT void func_vehiclecontrols(entvars_t *pev);
#endif // HOOK_GAMEDLL
#endif // VEHICLE_H

View File

@ -1767,7 +1767,7 @@ void CWeaponBox::__MAKE_VHOOK(Touch)(CBaseEntity *pOther)
CCSBotManager *ctrl = TheCSBots();
if ((pPlayer->HasShield() && pItem->m_iId == WEAPON_ELITE)
|| (pPlayer->IsBot() && !ctrl->IsWeaponUseable(pItem)))
|| (pPlayer->IsBot() && (ctrl != NULL && !ctrl->IsWeaponUseable(pItem))))
{
return;
}
@ -1832,9 +1832,15 @@ void CWeaponBox::__MAKE_VHOOK(Touch)(CBaseEntity *pOther)
}
CCSBotManager *csBots = TheCSBots();
if (csBots != NULL)
{
csBots->SetLooseBomb(NULL);
}
csBots->SetLooseBomb(NULL);
TheBots->OnEvent(EVENT_BOMB_PICKED_UP, pPlayer);
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_BOMB_PICKED_UP, pPlayer);
}
}
if (i >= PRIMARY_WEAPON_SLOT && i <= PISTOL_SLOT && pPlayer->m_rgpPlayerItems[i] != NULL)

View File

@ -1043,12 +1043,12 @@ public:
}
virtual BOOL IsPistol(void)
{
#ifdef REGAMEDLL_FIXES
#ifdef REGAMEDLL_FIXES
return FALSE;
#else
#else
// TODO: why the object flashbang is IsPistol?
return TRUE;
#endif // REGAMEDLL_FIXES
#endif // REGAMEDLL_FIXES
}
#ifdef HOOK_GAMEDLL
@ -2133,6 +2133,7 @@ void W_Precache(void);
BOOL CanAttack(float attack_time, float curtime, BOOL isPredicted);
#ifdef HOOK_GAMEDLL
// linked object
C_DLLEXPORT void weapon_knife(entvars_t *pev);
C_DLLEXPORT void weapon_glock18(entvars_t *pev);
@ -2166,6 +2167,7 @@ C_DLLEXPORT void weapon_tmp(entvars_t *pev);
C_DLLEXPORT void armoury_entity(entvars_t *pev);
C_DLLEXPORT void weaponbox(entvars_t *pev);
#endif // HOOK_GAMEDLL
#endif // WEAPONS_H

View File

@ -7,41 +7,41 @@
AutoBuyInfoStruct g_autoBuyInfo[] =
{
{ AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_RIFLE, "galil", "weapon_galil" },
{ AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_RIFLE, "ak47", "weapon_ak47" },
{ AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_SNIPERRIFLE, "scout", "weapon_scout" },
{ AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_RIFLE, "sg552", "weapon_sg552" },
{ AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_SNIPERRIFLE, "awp", "weapon_awp" },
{ AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_SNIPERRIFLE, "g3sg1", "weapon_g3sg1" },
{ AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_RIFLE, "famas", "weapon_famas" },
{ AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_RIFLE, "m4a1", "weapon_m4a1" },
{ AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_RIFLE, "aug", "weapon_aug" },
{ AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_SNIPERRIFLE, "sg550", "weapon_sg550" },
{ AUTOBUYCLASS_SECONDARY | AUTOBUYCLASS_PISTOL, "glock", "weapon_glock18" },
{ AUTOBUYCLASS_SECONDARY | AUTOBUYCLASS_PISTOL, "usp", "weapon_usp" },
{ AUTOBUYCLASS_SECONDARY | AUTOBUYCLASS_PISTOL, "p228", "weapon_p228" },
{ AUTOBUYCLASS_SECONDARY | AUTOBUYCLASS_PISTOL, "deagle", "weapon_deagle" },
{ AUTOBUYCLASS_SECONDARY | AUTOBUYCLASS_PISTOL, "elites", "weapon_elite" },
{ AUTOBUYCLASS_SECONDARY | AUTOBUYCLASS_PISTOL, "fn57", "weapon_fiveseven" },
{ AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_SHOTGUN, "m3", "weapon_m3" },
{ AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_SHOTGUN, "xm1014", "weapon_xm1014" },
{ AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_SMG, "mac10", "weapon_mac10" },
{ AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_SMG, "tmp", "weapon_tmp" },
{ AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_SMG, "mp5", "weapon_mp5navy" },
{ AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_SMG, "ump45", "weapon_ump45" },
{ AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_SMG, "p90", "weapon_p90" },
{ AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_MACHINEGUN, "m249", "weapon_m249" },
{ AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_AMMO, "primammo", "primammo" },
{ AUTOBUYCLASS_SECONDARY | AUTOBUYCLASS_AMMO, "secammo", "secammo" },
{ AUTOBUYCLASS_ARMOR, "vest", "item_kevlar" },
{ AUTOBUYCLASS_ARMOR, "vesthelm", "item_assaultsuit" },
{ AUTOBUYCLASS_GRENADE, "flash", "weapon_flashbang" },
{ AUTOBUYCLASS_GRENADE, "hegren", "weapon_hegrenade" },
{ AUTOBUYCLASS_GRENADE, "sgren", "weapon_smokegrenade"},
{ AUTOBUYCLASS_NIGHTVISION, "nvgs", "nvgs" },
{ AUTOBUYCLASS_DEFUSER, "defuser", "defuser" },
{ AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_SHIELD, "shield", "shield" },
{ 0, NULL, NULL }
{ (AutoBuyClassType)(AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_RIFLE), "galil", "weapon_galil" },
{ (AutoBuyClassType)(AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_RIFLE), "ak47", "weapon_ak47" },
{ (AutoBuyClassType)(AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_SNIPERRIFLE), "scout", "weapon_scout" },
{ (AutoBuyClassType)(AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_RIFLE), "sg552", "weapon_sg552" },
{ (AutoBuyClassType)(AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_SNIPERRIFLE), "awp", "weapon_awp" },
{ (AutoBuyClassType)(AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_SNIPERRIFLE), "g3sg1", "weapon_g3sg1" },
{ (AutoBuyClassType)(AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_RIFLE), "famas", "weapon_famas" },
{ (AutoBuyClassType)(AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_RIFLE), "m4a1", "weapon_m4a1" },
{ (AutoBuyClassType)(AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_RIFLE), "aug", "weapon_aug" },
{ (AutoBuyClassType)(AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_SNIPERRIFLE), "sg550", "weapon_sg550" },
{ (AutoBuyClassType)(AUTOBUYCLASS_SECONDARY | AUTOBUYCLASS_PISTOL), "glock", "weapon_glock18" },
{ (AutoBuyClassType)(AUTOBUYCLASS_SECONDARY | AUTOBUYCLASS_PISTOL), "usp", "weapon_usp" },
{ (AutoBuyClassType)(AUTOBUYCLASS_SECONDARY | AUTOBUYCLASS_PISTOL), "p228", "weapon_p228" },
{ (AutoBuyClassType)(AUTOBUYCLASS_SECONDARY | AUTOBUYCLASS_PISTOL), "deagle", "weapon_deagle" },
{ (AutoBuyClassType)(AUTOBUYCLASS_SECONDARY | AUTOBUYCLASS_PISTOL), "elites", "weapon_elite" },
{ (AutoBuyClassType)(AUTOBUYCLASS_SECONDARY | AUTOBUYCLASS_PISTOL), "fn57", "weapon_fiveseven" },
{ (AutoBuyClassType)(AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_SHOTGUN), "m3", "weapon_m3" },
{ (AutoBuyClassType)(AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_SHOTGUN), "xm1014", "weapon_xm1014" },
{ (AutoBuyClassType)(AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_SMG), "mac10", "weapon_mac10" },
{ (AutoBuyClassType)(AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_SMG), "tmp", "weapon_tmp" },
{ (AutoBuyClassType)(AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_SMG), "mp5", "weapon_mp5navy" },
{ (AutoBuyClassType)(AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_SMG), "ump45", "weapon_ump45" },
{ (AutoBuyClassType)(AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_SMG), "p90", "weapon_p90" },
{ (AutoBuyClassType)(AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_MACHINEGUN), "m249", "weapon_m249" },
{ (AutoBuyClassType)(AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_AMMO), "primammo", "primammo" },
{ (AutoBuyClassType)(AUTOBUYCLASS_SECONDARY | AUTOBUYCLASS_AMMO), "secammo", "secammo" },
{ (AutoBuyClassType)(AUTOBUYCLASS_ARMOR), "vest", "item_kevlar" },
{ (AutoBuyClassType)(AUTOBUYCLASS_ARMOR), "vesthelm", "item_assaultsuit" },
{ (AutoBuyClassType)(AUTOBUYCLASS_GRENADE), "flash", "weapon_flashbang" },
{ (AutoBuyClassType)(AUTOBUYCLASS_GRENADE), "hegren", "weapon_hegrenade" },
{ (AutoBuyClassType)(AUTOBUYCLASS_GRENADE), "sgren", "weapon_smokegrenade"},
{ (AutoBuyClassType)(AUTOBUYCLASS_NIGHTVISION), "nvgs", "nvgs" },
{ (AutoBuyClassType)(AUTOBUYCLASS_DEFUSER), "defuser", "defuser" },
{ (AutoBuyClassType)(AUTOBUYCLASS_PRIMARY | AUTOBUYCLASS_SHIELD), "shield", "shield" },
{ (AutoBuyClassType)0, NULL, NULL }
};
WeaponAliasInfo weaponAliasInfo[] =
@ -179,13 +179,12 @@ WeaponClassAliasInfo weaponClassAliasInfo[] =
{ "machinegun", WEAPONCLASS_MACHINEGUN },
{ "shotgun", WEAPONCLASS_SHOTGUN },
{ "rifle", WEAPONCLASS_RIFLE },
{ "rifle", WEAPONCLASS_RIFLE },
{ "sniper", WEAPONCLASS_SNIPERRIFLE },
{ "none", WEAPONCLASS_NONE },
{ NULL, WEAPONCLASS_NONE }
};
WeaponInfoStruct weaponInfo[27] =
WeaponInfoStruct weaponInfo[] =
{
{ WEAPON_P228, P228_PRICE, AMMO_357SIG_PRICE, AMMO_357SIG_BUY, P228_MAX_CLIP, MAX_AMMO_357SIG, AMMO_357SIG, "weapon_p228" },
{ WEAPON_GLOCK, GLOCK18_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, GLOCK18_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_glock18" },

View File

@ -49,11 +49,15 @@ void SaveGlobalState(SAVERESTOREDATA *pSaveData);
void RestoreGlobalState(SAVERESTOREDATA *pSaveData);
void ResetGlobalState(void);
#ifdef HOOK_GAMEDLL
// linked object
C_DLLEXPORT void infodecal(entvars_t *pev);
C_DLLEXPORT void bodyque(entvars_t *pev);
C_DLLEXPORT void worldspawn(entvars_t *pev);
#endif // HOOK_GAMEDLL
extern edict_t *g_pBodyQueueHead;
extern CGlobalState gGlobalState;
extern float g_flWeaponCheat;

View File

@ -188,10 +188,12 @@ void CC4::__MAKE_VHOOK(PrimaryAttack)(void)
MESSAGE_END();
UTIL_ClientPrintAll(HUD_PRINTCENTER, "#Bomb_Planted");
if (TheBots != NULL)
{
TheBots->OnEvent(EVENT_BOMB_PLANTED, m_pPlayer, pBomb);
}
TheBots->OnEvent(EVENT_BOMB_PLANTED, m_pPlayer, pBomb);
if (g_pGameRules->IsCareer() && !m_pPlayer->IsBot())
if (TheCareerTasks != NULL && g_pGameRules->IsCareer() && !m_pPlayer->IsBot())
{
TheCareerTasks->HandleEvent(EVENT_BOMB_PLANTED, m_pPlayer);
}

View File

@ -123,7 +123,12 @@ void CELITE::ELITEFire(float flSpread, float flCycleTime, BOOL fUseSemi)
Vector vecSrc;
Vector vecDir;
#ifdef REGAMEDLL_FIXES
flCycleTime -= 0.078;
#else
flCycleTime -= 0.125;
#endif // REGAMEDLL_FIXES
m_iShotsFired++;
if (m_iShotsFired > 1)

View File

@ -181,82 +181,82 @@ void CHEGrenade::ResetPlayerShieldAnim(void)
/* <26a24e> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:202 */
void CHEGrenade::__MAKE_VHOOK(WeaponIdle)(void)
{
if (m_flReleaseThrow == 0 && m_flStartThrow != 0.0f)
m_flReleaseThrow = gpGlobals->time;
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
return;
{
if (m_flReleaseThrow == 0 && m_flStartThrow != 0.0f)
m_flReleaseThrow = gpGlobals->time;
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
return;
if (m_flStartThrow)
{
m_pPlayer->Radio("%!MRAD_FIREINHOLE", "#Fire_in_the_hole");
Vector angThrow = m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle;
{
m_pPlayer->Radio("%!MRAD_FIREINHOLE", "#Fire_in_the_hole");
Vector angThrow = m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle;
if (angThrow.x < 0)
angThrow.x = -10 + angThrow.x * ((90 - 10) / 90.0);
else
angThrow.x = -10 + angThrow.x * ((90 + 10) / 90.0);
float_precision flVel = (90.0 - angThrow.x) * 6.0;
if (flVel > 750.0f)
flVel = 750.0f;
UTIL_MakeVectors(angThrow);
Vector vecSrc = m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_forward * 16;
Vector vecThrow = gpGlobals->v_forward * flVel + m_pPlayer->pev->velocity;
CGrenade::ShootTimed2(m_pPlayer->pev, vecSrc, vecThrow, 1.5, m_pPlayer->m_iTeam, m_usCreateExplosion);
SendWeaponAnim(HEGRENADE_THROW, UseDecrement() != FALSE);
SetPlayerShieldAnim();
// player "shoot" animation
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
m_flStartThrow = 0;
m_flNextPrimaryAttack = GetNextAttackDelay(0.5);
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.75;
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
if (!m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
angThrow.x = -10 + angThrow.x * ((90 + 10) / 90.0);
float flVel = (90.0 - angThrow.x) * 6.0;
if (flVel > 750.0f)
flVel = 750.0f;
UTIL_MakeVectors(angThrow);
Vector vecSrc = m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_forward * 16;
Vector vecThrow = gpGlobals->v_forward * flVel + m_pPlayer->pev->velocity;
CGrenade::ShootTimed2(m_pPlayer->pev, vecSrc, vecThrow, 1.5, m_pPlayer->m_iTeam, m_usCreateExplosion);
SendWeaponAnim(HEGRENADE_THROW, UseDecrement() != FALSE);
SetPlayerShieldAnim();
// player "shoot" animation
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
m_flStartThrow = 0;
m_flNextPrimaryAttack = GetNextAttackDelay(0.5);
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.75;
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
if (!m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
// just threw last grenade
// set attack times in the future, and weapon idle in the future so we can see the whole throw
// animation, weapon idle will automatically retire the weapon for us.
// ensure that the animation can finish playing
m_flTimeWeaponIdle = m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay(0.5);
}
ResetPlayerShieldAnim();
// animation, weapon idle will automatically retire the weapon for us.
// ensure that the animation can finish playing
m_flTimeWeaponIdle = m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay(0.5);
}
ResetPlayerShieldAnim();
}
else if (m_flReleaseThrow > 0)
{
// we've finished the throw, restart.
m_flStartThrow = 0;
else if (m_flReleaseThrow > 0)
{
// we've finished the throw, restart.
m_flStartThrow = 0;
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
SendWeaponAnim(HEGRENADE_DRAW, UseDecrement() != FALSE);
}
else
{
RetireWeapon();
return;
}
{
RetireWeapon();
return;
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + RANDOM_FLOAT(10, 15);
m_flReleaseThrow = -1;
m_flReleaseThrow = -1;
}
else if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
{
if (m_pPlayer->HasShield())
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
@ -271,7 +271,6 @@ void CHEGrenade::__MAKE_VHOOK(WeaponIdle)(void)
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + RANDOM_FLOAT(10, 15);
}
}
}
/* <26b021> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:303 */

View File

@ -250,18 +250,10 @@ void CM4A1::M4A1Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
/* <28110b> ../cstrike/dlls/wpn_shared/wpn_m4a1.cpp:257 */
void CM4A1::__MAKE_VHOOK(Reload)(void)
{
int iResult;
if (m_pPlayer->ammo_556nato <= 0)
return;
if ((m_iWeaponState & WPNSTATE_M4A1_SILENCED) == WPNSTATE_M4A1_SILENCED)
{
iResult = DefaultReload(M4A1_MAX_CLIP, M4A1_RELOAD, M4A1_RELOAD_TIME);
}
else
iResult = DefaultReload(M4A1_MAX_CLIP, M4A1_UNSIL_RELOAD, M4A1_RELOAD_TIME);
if (iResult)
if (DefaultReload(M4A1_MAX_CLIP, ((m_iWeaponState & WPNSTATE_M4A1_SILENCED) == WPNSTATE_M4A1_SILENCED) ? M4A1_RELOAD : M4A1_UNSIL_RELOAD, M4A1_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);

View File

@ -94,8 +94,6 @@ void CMP5N::__MAKE_VHOOK(PrimaryAttack)(void)
/* <28bcc0> ../cstrike/dlls/wpn_shared/wpn_mp5navy.cpp:117 */
void CMP5N::MP5NFire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
{
_LOG_TRACE
Vector vecAiming, vecSrc, vecDir;
int flag;

View File

@ -157,12 +157,12 @@ void CBotManager::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *entity
bot->OnEvent(event, entity, other);
}
if (TheTutor)
if (TheTutor != NULL)
{
TheTutor->OnEvent(event, entity, other);
}
if (g_pHostages)
if (g_pHostages != NULL)
{
g_pHostages->OnEvent(event, entity, other);
}

View File

@ -292,11 +292,14 @@ NOBODY bool UTIL_IsTeamAllBots(int team)
return (botCount) ? true : false;
}
// Return the closest active player to the given position.
// If 'distance' is non-NULL, the distance to the closest player is returned in it.
/* <4ad86a> ../game_shared/bot/bot_util.cpp:343 */
NOBODY extern CBasePlayer *UTIL_GetClosestPlayer(const Vector *pos, float *distance)
/*extern*/ CBasePlayer *UTIL_GetClosestPlayer(const Vector *pos, float *distance)
{
CBasePlayer *closePlayer = NULL;
float closeDistSq = 999999999999.9f;
float closeDistSq = 1.0e12f; // 999999999999.9f
for (int i = 1; i <= gpGlobals->maxClients; i++)
{
@ -312,7 +315,7 @@ NOBODY extern CBasePlayer *UTIL_GetClosestPlayer(const Vector *pos, float *dista
if (distSq < closeDistSq)
{
closeDistSq = distSq;
closePlayer = static_cast<CBasePlayer *>(player);
closePlayer = player;
}
}
@ -322,8 +325,11 @@ NOBODY extern CBasePlayer *UTIL_GetClosestPlayer(const Vector *pos, float *dista
return closePlayer;
}
// Return the closest active player on the given team to the given position.
// If 'distance' is non-NULL, the distance to the closest player is returned in it.
/* <4ad86a> ../game_shared/bot/bot_util.cpp:343 */
NOBODY extern CBasePlayer *UTIL_GetClosestPlayer(const Vector *pos, int team, float *distance)
NOBODY /*extern*/ CBasePlayer *UTIL_GetClosestPlayer(const Vector *pos, int team, float *distance)
{
CBasePlayer *closePlayer = NULL;
float closeDistSq = 999999999999.9f;
@ -345,7 +351,7 @@ NOBODY extern CBasePlayer *UTIL_GetClosestPlayer(const Vector *pos, int team, fl
if (distSq < closeDistSq)
{
closeDistSq = distSq;
closePlayer = static_cast<CBasePlayer *>(player);
closePlayer = player;
}
}
@ -366,7 +372,7 @@ void UTIL_ConstructBotNetName(char *name, int nameLength, const BotProfile *prof
{
if (profile == NULL)
{
name[0] = 0;
name[0] = '\0';
return;
}
@ -563,128 +569,134 @@ float BotSIN(float angle)
return cosTable[ i ];
}
// Determine if this event is audible, and if so, return its audible range and priority
/* <4ae2c5> ../game_shared/bot/bot_util.cpp:694 */
NOBODY bool IsGameEventAudible(GameEventType event, CBaseEntity *entity, CBaseEntity *other, float *range, PriorityType *priority, bool *isHostile)
bool IsGameEventAudible(GameEventType event, CBaseEntity *entity, CBaseEntity *other, float *range, PriorityType *priority, bool *isHostile)
{
CBasePlayer *player = static_cast<CBasePlayer *>(entity);
if (entity == NULL || !player->IsPlayer())
player = NULL;
const float ShortRange = 1000.0f;
const float NormalRange = 2000.0f;
switch (event)
{
case EVENT_WEAPON_FIRED:
/// TODO: Check weapon type (knives are pretty quiet)
/// TODO: Use actual volume, account for silencers, etc.
case EVENT_WEAPON_FIRED:
{
if (player->m_pActiveItem == NULL)
return false;
switch (player->m_pActiveItem->m_iId)
{
if (player->m_pActiveItem == NULL)
return false;
switch (player->m_pActiveItem->m_iId)
{
case WEAPON_HEGRENADE:
case WEAPON_SMOKEGRENADE:
case WEAPON_FLASHBANG:
case WEAPON_SHIELDGUN:
case WEAPON_C4:
return false;
case WEAPON_KNIFE:
case WEAPON_TMP:
*range = ShortRange;
break;
case WEAPON_M4A1:
{
CBasePlayerWeapon *pWeapon = static_cast<CBasePlayerWeapon *>(player->m_pActiveItem);
if (pWeapon->m_iWeaponState & WPNSTATE_M4A1_SILENCED)
{
*range = ShortRange;
}
else
{
*range = NormalRange;
}
break;
}
case WEAPON_USP:
{
CBasePlayerWeapon *pWeapon = static_cast<CBasePlayerWeapon *>(player->m_pActiveItem);
if (pWeapon->m_iWeaponState & WPNSTATE_M4A1_SILENCED)
{
*range = ShortRange;
}
else
{
*range = NormalRange;
}
break;
}
case WEAPON_AWP:
*range = 99999.0f;
break;
default:
*range = NormalRange;
break;
}
*priority = PRIORITY_HIGH;
*isHostile = true;
return true;
// silent "firing"
case WEAPON_HEGRENADE:
case WEAPON_SMOKEGRENADE:
case WEAPON_FLASHBANG:
case WEAPON_SHIELDGUN:
case WEAPON_C4:
return false;
// quiet
case WEAPON_KNIFE:
case WEAPON_TMP:
*range = ShortRange;
break;
// M4A1 - check for silencer
case WEAPON_M4A1:
{
CBasePlayerWeapon *pWeapon = static_cast<CBasePlayerWeapon *>(player->m_pActiveItem);
if (pWeapon->m_iWeaponState & WPNSTATE_M4A1_SILENCED)
*range = ShortRange;
else
*range = NormalRange;
break;
}
case EVENT_HE_GRENADE_EXPLODED:
// USP - check for silencer
case WEAPON_USP:
{
CBasePlayerWeapon *pWeapon = static_cast<CBasePlayerWeapon *>(player->m_pActiveItem);
if (pWeapon->m_iWeaponState & WPNSTATE_USP_SILENCED)
*range = ShortRange;
else
*range = NormalRange;
break;
}
// loud
case WEAPON_AWP:
*range = 99999.0f;
*priority = PRIORITY_HIGH;
*isHostile = true;
return true;
break;
// normal
default:
*range = NormalRange;
break;
}
case EVENT_FLASHBANG_GRENADE_EXPLODED:
*range = 1000.0f;
*priority = PRIORITY_LOW;
*isHostile = true;
return true;
case EVENT_SMOKE_GRENADE_EXPLODED:
*range = 1000.0f;
*priority = PRIORITY_LOW;
*isHostile = true;
return true;
case EVENT_GRENADE_BOUNCED:
*range = 500.0f;
*priority = PRIORITY_LOW;
*isHostile = true;
return true;
case EVENT_BREAK_GLASS:
case EVENT_BREAK_WOOD:
case EVENT_BREAK_METAL:
case EVENT_BREAK_FLESH:
case EVENT_BREAK_CONCRETE:
*range = 1100.0f;
*priority = PRIORITY_MEDIUM;
*isHostile = true;
return true;
case EVENT_DOOR:
*range = 1100.0f;
*priority = PRIORITY_MEDIUM;
*isHostile = false;
return true;
case EVENT_WEAPON_FIRED_ON_EMPTY:
case EVENT_PLAYER_FOOTSTEP:
case EVENT_WEAPON_RELOADED:
case EVENT_WEAPON_ZOOMED:
case EVENT_PLAYER_LANDED_FROM_HEIGHT:
*range = 1100.0f;
*priority = PRIORITY_LOW;
*isHostile = false;
return true;
case EVENT_HOSTAGE_USED:
case EVENT_HOSTAGE_CALLED_FOR_HELP:
*range = 1200.0f;
*priority = PRIORITY_MEDIUM;
*isHostile = false;
return true;
*priority = PRIORITY_HIGH;
*isHostile = true;
return true;
}
case EVENT_HE_GRENADE_EXPLODED:
*range = 99999.0f;
*priority = PRIORITY_HIGH;
*isHostile = true;
return true;
case EVENT_FLASHBANG_GRENADE_EXPLODED:
*range = 1000.0f;
*priority = PRIORITY_LOW;
*isHostile = true;
return true;
case EVENT_SMOKE_GRENADE_EXPLODED:
*range = 1000.0f;
*priority = PRIORITY_LOW;
*isHostile = true;
return true;
case EVENT_GRENADE_BOUNCED:
*range = 500.0f;
*priority = PRIORITY_LOW;
*isHostile = true;
return true;
case EVENT_BREAK_GLASS:
case EVENT_BREAK_WOOD:
case EVENT_BREAK_METAL:
case EVENT_BREAK_FLESH:
case EVENT_BREAK_CONCRETE:
*range = 1100.0f;
*priority = PRIORITY_MEDIUM;
*isHostile = true;
return true;
case EVENT_DOOR:
*range = 1100.0f;
*priority = PRIORITY_MEDIUM;
*isHostile = false;
return true;
case EVENT_WEAPON_FIRED_ON_EMPTY:
case EVENT_PLAYER_FOOTSTEP:
case EVENT_WEAPON_RELOADED:
case EVENT_WEAPON_ZOOMED:
case EVENT_PLAYER_LANDED_FROM_HEIGHT:
*range = 1100.0f;
*priority = PRIORITY_LOW;
*isHostile = false;
return true;
case EVENT_HOSTAGE_USED:
case EVENT_HOSTAGE_CALLED_FOR_HELP:
*range = 1200.0f;
*priority = PRIORITY_MEDIUM;
*isHostile = false;
return true;
}
return false;
}

Some files were not shown because too many files have changed in this diff Show More