diff --git a/build.gradle b/build.gradle index 4d3fef80..0a879287 100644 --- a/build.gradle +++ b/build.gradle @@ -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' } diff --git a/dep/bzip2/msvc/bzip2.vcxproj b/dep/bzip2/msvc/bzip2.vcxproj index 30333ad6..6dbe07d9 100644 --- a/dep/bzip2/msvc/bzip2.vcxproj +++ b/dep/bzip2/msvc/bzip2.vcxproj @@ -1,6 +1,14 @@  + + Debug MP Play + Win32 + + + Debug MP + Win32 + Debug Win32 @@ -22,6 +30,18 @@ v120 Unicode + + StaticLibrary + true + v120 + Unicode + + + StaticLibrary + true + v120 + Unicode + StaticLibrary false @@ -35,6 +55,12 @@ + + + + + + @@ -55,6 +81,36 @@ true + + + Use + Level3 + Disabled + _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + $(ProjectDir)..\include\ + MultiThreadedDebug + bzlib_private.h + + + Windows + true + + + + + Use + Level3 + Disabled + _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + $(ProjectDir)..\include\ + MultiThreadedDebug + bzlib_private.h + + + Windows + true + + Level3 @@ -86,6 +142,8 @@ Create + Create + Create Create diff --git a/dep/cppunitlite/msvc/cppunitlite.vcxproj b/dep/cppunitlite/msvc/cppunitlite.vcxproj index 3fd9fc39..fb5ad527 100644 --- a/dep/cppunitlite/msvc/cppunitlite.vcxproj +++ b/dep/cppunitlite/msvc/cppunitlite.vcxproj @@ -1,6 +1,14 @@  + + Debug MP Play + Win32 + + + Debug MP + Win32 + Debug Win32 @@ -38,6 +46,18 @@ v120 MultiByte + + StaticLibrary + true + v120 + MultiByte + + + StaticLibrary + true + v120 + MultiByte + StaticLibrary true @@ -57,6 +77,12 @@ + + + + + + @@ -78,6 +104,38 @@ true + + + + + Level3 + Disabled + WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions) + MultiThreadedDebug + $(ProjectDir)..\include\ + CompileAsCpp + + + Windows + true + + + + + + + Level3 + Disabled + WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions) + MultiThreadedDebug + $(ProjectDir)..\include\ + CompileAsCpp + + + Windows + true + + Level3 diff --git a/msvc/ReGameDLL.sln b/msvc/ReGameDLL.sln index 4e770859..579bd225 100644 --- a/msvc/ReGameDLL.sln +++ b/msvc/ReGameDLL.sln @@ -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 diff --git a/publish.gradle b/publish.gradle index 012a439b..92baf2dd 100644 --- a/publish.gradle +++ b/publish.gradle @@ -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' + } } diff --git a/regamedll/build.gradle b/regamedll/build.gradle index a684182c..363ed910 100644 --- a/regamedll/build.gradle +++ b/regamedll/build.gradle @@ -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() diff --git a/regamedll/dlls/airtank.h b/regamedll/dlls/airtank.h index 66a8ae9f..70510a30 100644 --- a/regamedll/dlls/airtank.h +++ b/regamedll/dlls/airtank.h @@ -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 diff --git a/regamedll/dlls/ammo.h b/regamedll/dlls/ammo.h index 796a07fe..c8e8702d 100644 --- a/regamedll/dlls/ammo.h +++ b/regamedll/dlls/ammo.h @@ -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 diff --git a/regamedll/dlls/animation.cpp b/regamedll/dlls/animation.cpp index 099d6eb7..5ec9d9ef 100644 --- a/regamedll/dlls/animation.cpp +++ b/regamedll/dlls/animation.cpp @@ -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]); + } } diff --git a/regamedll/dlls/animation.h b/regamedll/dlls/animation.h index 19154292..024fbcf3 100644 --- a/regamedll/dlls/animation.h +++ b/regamedll/dlls/animation.h @@ -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 diff --git a/regamedll/dlls/basemonster.h b/regamedll/dlls/basemonster.h index 2e4f2d38..b2ed17f4 100644 --- a/regamedll/dlls/basemonster.h +++ b/regamedll/dlls/basemonster.h @@ -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); diff --git a/regamedll/dlls/bmodels.h b/regamedll/dlls/bmodels.h index 7b88099e..e27f9ded 100644 --- a/regamedll/dlls/bmodels.h +++ b/regamedll/dlls/bmodels.h @@ -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 diff --git a/regamedll/dlls/bot/cs_bot.cpp b/regamedll/dlls/bot/cs_bot.cpp index 30e8c4de..7ff38e83 100644 --- a/regamedll/dlls/bot/cs_bot.cpp +++ b/regamedll/dlls/bot/cs_bot.cpp @@ -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 */ diff --git a/regamedll/dlls/bot/cs_bot.h b/regamedll/dlls/bot/cs_bot.h index 3b7245a3..3602b3dd 100644 --- a/regamedll/dlls/bot/cs_bot.h +++ b/regamedll/dlls/bot/cs_bot.h @@ -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 diff --git a/regamedll/dlls/bot/cs_bot_chatter.cpp b/regamedll/dlls/bot/cs_bot_chatter.cpp index cb435223..d612b699 100644 --- a/regamedll/dlls/bot/cs_bot_chatter.cpp +++ b/regamedll/dlls/bot/cs_bot_chatter.cpp @@ -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 *const this); // 36 -// operator++(_List_iterator *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 */ diff --git a/regamedll/dlls/bot/cs_bot_chatter.h b/regamedll/dlls/bot/cs_bot_chatter.h index 58ff6158..171aab2f 100644 --- a/regamedll/dlls/bot/cs_bot_chatter.h +++ b/regamedll/dlls/bot/cs_bot_chatter.h @@ -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 diff --git a/regamedll/dlls/bot/cs_bot_init.cpp b/regamedll/dlls/bot/cs_bot_init.cpp index 80d19e2d..f7055d9d 100644 --- a/regamedll/dlls/bot/cs_bot_init.cpp +++ b/regamedll/dlls/bot/cs_bot_init.cpp @@ -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 */ diff --git a/regamedll/dlls/bot/cs_bot_learn.cpp b/regamedll/dlls/bot/cs_bot_learn.cpp index 58ba9bd1..cfde323a 100644 --- a/regamedll/dlls/bot/cs_bot_learn.cpp +++ b/regamedll/dlls/bot/cs_bot_learn.cpp @@ -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 */ diff --git a/regamedll/dlls/bot/cs_bot_manager.cpp b/regamedll/dlls/bot/cs_bot_manager.cpp index bda43be0..b0dc8f4a 100644 --- a/regamedll/dlls/bot/cs_bot_manager.cpp +++ b/regamedll/dlls/bot/cs_bot_manager.cpp @@ -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 */ diff --git a/regamedll/dlls/bot/cs_bot_manager.h b/regamedll/dlls/bot/cs_bot_manager.h index 82b8b7b5..56b75558 100644 --- a/regamedll/dlls/bot/cs_bot_manager.h +++ b/regamedll/dlls/bot/cs_bot_manager.h @@ -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 diff --git a/regamedll/dlls/bot/cs_bot_statemachine.cpp b/regamedll/dlls/bot/cs_bot_statemachine.cpp index 02a13f7c..24705bdc 100644 --- a/regamedll/dlls/bot/cs_bot_statemachine.cpp +++ b/regamedll/dlls/bot/cs_bot_statemachine.cpp @@ -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(&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(&m_hideState)); + if (m_state == static_cast(&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(&m_buyState)) + return true; + + return false; } /* <3b45bf> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:472 */ diff --git a/regamedll/dlls/bot/cs_bot_update.cpp b/regamedll/dlls/bot/cs_bot_update.cpp index df3e892e..3b890b7a 100644 --- a/regamedll/dlls/bot/cs_bot_update.cpp +++ b/regamedll/dlls/bot/cs_bot_update.cpp @@ -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 { diff --git a/regamedll/dlls/bot/cs_bot_weapon.cpp b/regamedll/dlls/bot/cs_bot_weapon.cpp index 5f6d29c7..15432d50 100644 --- a/regamedll/dlls/bot/cs_bot_weapon.cpp +++ b/regamedll/dlls/bot/cs_bot_weapon.cpp @@ -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 */ diff --git a/regamedll/dlls/bot/states/cs_bot_attack.cpp b/regamedll/dlls/bot/states/cs_bot_attack.cpp index c89f73fc..62750e4b 100644 --- a/regamedll/dlls/bot/states/cs_bot_attack.cpp +++ b/regamedll/dlls/bot/states/cs_bot_attack.cpp @@ -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 */ diff --git a/regamedll/dlls/buttons.h b/regamedll/dlls/buttons.h index 8811f9b0..a102a326 100644 --- a/regamedll/dlls/buttons.h +++ b/regamedll/dlls/buttons.h @@ -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 diff --git a/regamedll/dlls/career_tasks.cpp b/regamedll/dlls/career_tasks.cpp index e9049281..dba9f903 100644 --- a/regamedll/dlls/career_tasks.cpp +++ b/regamedll/dlls/career_tasks.cpp @@ -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); } diff --git a/regamedll/dlls/career_tasks.h b/regamedll/dlls/career_tasks.h index 9f620800..9b50dc16 100644 --- a/regamedll/dlls/career_tasks.h +++ b/regamedll/dlls/career_tasks.h @@ -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 diff --git a/regamedll/dlls/cbase.cpp b/regamedll/dlls/cbase.cpp index f7d09a78..eccf631d 100644 --- a/regamedll/dlls/cbase.cpp +++ b/regamedll/dlls/cbase.cpp @@ -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)); } diff --git a/regamedll/dlls/cbase.h b/regamedll/dlls/cbase.h index f9c7abda..79dd85d1 100644 --- a/regamedll/dlls/cbase.h +++ b/regamedll/dlls/cbase.h @@ -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 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); diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index 79636f69..7d5c3787 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -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"); diff --git a/regamedll/dlls/client.h b/regamedll/dlls/client.h index d1ec407e..7c696f40 100644 --- a/regamedll/dlls/client.h +++ b/regamedll/dlls/client.h @@ -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; diff --git a/regamedll/dlls/combat.cpp b/regamedll/dlls/combat.cpp index 1bdfed47..ea7c7164 100644 --- a/regamedll/dlls/combat.cpp +++ b/regamedll/dlls/combat.cpp @@ -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); } diff --git a/regamedll/dlls/doors.cpp b/regamedll/dlls/doors.cpp index 7188d4e8..837745f1 100644 --- a/regamedll/dlls/doors.cpp +++ b/regamedll/dlls/doors.cpp @@ -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); + } } } diff --git a/regamedll/dlls/doors.h b/regamedll/dlls/doors.h index 62cbbb5c..e40aabdb 100644 --- a/regamedll/dlls/doors.h +++ b/regamedll/dlls/doors.h @@ -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 diff --git a/regamedll/dlls/effects.h b/regamedll/dlls/effects.h index 890998db..7e0bc992 100644 --- a/regamedll/dlls/effects.h +++ b/regamedll/dlls/effects.h @@ -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 diff --git a/regamedll/dlls/explode.h b/regamedll/dlls/explode.h index 762e9982..480a784c 100644 --- a/regamedll/dlls/explode.h +++ b/regamedll/dlls/explode.h @@ -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 ¢er, 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 diff --git a/regamedll/dlls/func_break.cpp b/regamedll/dlls/func_break.cpp index d799210c..c30b7482 100644 --- a/regamedll/dlls/func_break.cpp +++ b/regamedll/dlls/func_break.cpp @@ -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: diff --git a/regamedll/dlls/func_break.h b/regamedll/dlls/func_break.h index b359b89c..0b3d2068 100644 --- a/regamedll/dlls/func_break.h +++ b/regamedll/dlls/func_break.h @@ -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 diff --git a/regamedll/dlls/func_tank.h b/regamedll/dlls/func_tank.h index 7008cff3..424e4076 100644 --- a/regamedll/dlls/func_tank.h +++ b/regamedll/dlls/func_tank.h @@ -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 diff --git a/regamedll/dlls/game.cpp b/regamedll/dlls/game.cpp index a156beef..31981715 100644 --- a/regamedll/dlls/game.cpp +++ b/regamedll/dlls/game.cpp @@ -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 }; diff --git a/regamedll/dlls/gamerules.cpp b/regamedll/dlls/gamerules.cpp index d570bb46..24444018 100644 --- a/regamedll/dlls/gamerules.cpp +++ b/regamedll/dlls/gamerules.cpp @@ -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); /* ../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 diff --git a/regamedll/dlls/gamerules.h b/regamedll/dlls/gamerules.h index 6764b651..0300d6f9 100644 --- a/regamedll/dlls/gamerules.h +++ b/regamedll/dlls/gamerules.h @@ -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 diff --git a/regamedll/dlls/ggrenade.cpp b/regamedll/dlls/ggrenade.cpp index c4e66a2a..62465c57 100644 --- a/regamedll/dlls/ggrenade.cpp +++ b/regamedll/dlls/ggrenade.cpp @@ -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; + /* ../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); + } } } } diff --git a/regamedll/dlls/globals.h b/regamedll/dlls/globals.h index 8965dc2d..bdaedc8e 100644 --- a/regamedll/dlls/globals.h +++ b/regamedll/dlls/globals.h @@ -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 diff --git a/regamedll/dlls/h_battery.h b/regamedll/dlls/h_battery.h index 86406c3b..b8ec60de 100644 --- a/regamedll/dlls/h_battery.h +++ b/regamedll/dlls/h_battery.h @@ -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 diff --git a/regamedll/dlls/h_cycler.h b/regamedll/dlls/h_cycler.h index 5a32ee8f..8bcd8a8a 100644 --- a/regamedll/dlls/h_cycler.h +++ b/regamedll/dlls/h_cycler.h @@ -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 diff --git a/regamedll/dlls/h_export.cpp b/regamedll/dlls/h_export.cpp index 80ef6a42..5cdf44ed 100644 --- a/regamedll/dlls/h_export.cpp +++ b/regamedll/dlls/h_export.cpp @@ -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. + /* ../cstrike/dlls/h_export.cpp:58 */ C_DLLEXPORT void WINAPI GiveFnptrsToDll(enginefuncs_t *pEnginefuncsTable,globalvars_t *pGlobals) { diff --git a/regamedll/dlls/h_export.h b/regamedll/dlls/h_export.h index cdfa81f7..8d9bc58e 100644 --- a/regamedll/dlls/h_export.h +++ b/regamedll/dlls/h_export.h @@ -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 diff --git a/regamedll/dlls/healthkit.h b/regamedll/dlls/healthkit.h index 24cb5abd..686b6c40 100644 --- a/regamedll/dlls/healthkit.h +++ b/regamedll/dlls/healthkit.h @@ -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 diff --git a/regamedll/dlls/hostage/hostage.cpp b/regamedll/dlls/hostage/hostage.cpp index 3d8babb0..31e4c59f 100644 --- a/regamedll/dlls/hostage/hostage.cpp +++ b/regamedll/dlls/hostage/hostage.cpp @@ -8,16 +8,21 @@ cvar_t cv_hostage_debug = { "hostage_debug", "0", FCVAR_SERVER, 0.0f, NULL }; cvar_t cv_hostage_stop = { "hostage_stop", "0", FCVAR_SERVER, 0.0f, NULL }; +CHostageManager *g_pHostages = NULL; +int g_iHostageNumber = 0; + #else cvar_t cv_hostage_debug; cvar_t cv_hostage_stop; -#endif // HOOK_GAMEDLL - CHostageManager *g_pHostages; int g_iHostageNumber; +void (CBaseEntity::*pCHostage__IdleThink)(void); + +#endif // HOOK_GAMEDLL + /* <45c3fa> ../cstrike/dlls/hostage/hostage.cpp:47 */ LINK_ENTITY_TO_CLASS(hostage_entity, CHostage); @@ -25,30 +30,137 @@ LINK_ENTITY_TO_CLASS(hostage_entity, CHostage); LINK_ENTITY_TO_CLASS(monster_scientist, CHostage); /* <45c228> ../cstrike/dlls/hostage/hostage.cpp:54 */ -NOBODY void CHostage::__MAKE_VHOOK(Spawn)(void) +void CHostage::__MAKE_VHOOK(Spawn)(void) { -// MAKE_STRING_CLASS(const char *str, -// entvars_t *pev); // 61 -// SetActivity(CHostage *const this, -// int act); // 83 -// Vector(Vector *const this, -// float X, -// float Y, -// float Z); // 93 -// Vector(Vector *const this, -// float X, -// float Y, -// float Z); // 93 -// edict(CBaseEntity *const this); // 102 -// CHostageManager(CHostageManager *const this); // 57 + if (!g_pHostages) + { + g_pHostages = new CHostageManager; + } + + Precache(); + + if (pev->classname) + { + RemoveEntityHashValue(pev, STRING(pev->classname), CLASSNAME); + } + + MAKE_STRING_CLASS("hostage_entity", pev); + AddEntityHashValue(pev, STRING(pev->classname), CLASSNAME); + + pev->movetype = MOVETYPE_STEP; + pev->solid = SOLID_SLIDEBOX; + pev->takedamage = DAMAGE_YES; + pev->flags |= FL_MONSTER; + pev->deadflag = DEAD_NO; + pev->max_health = 100; + pev->health = pev->max_health; + pev->gravity = 1; + pev->view_ofs = VEC_HOSTAGE_VIEW; + pev->velocity = Vector(0, 0, 0); + + if (pev->spawnflags & SF_MONSTER_HITMONSTERCLIP) + pev->flags |= FL_MONSTERCLIP; + + if (pev->skin < 0) + pev->skin = 0; + + SET_MODEL(edict(), STRING(pev->model)); + SetActivity(ACT_IDLE); + + m_flNextChange = 0; + m_State = STAND; + m_hTargetEnt = NULL; + m_hStoppedTargetEnt = NULL; + m_vPathToFollow[0] = Vector(0, 0, 0); + m_flFlinchTime = 0; + m_bRescueMe = FALSE; + + UTIL_SetSize(pev, VEC_HOSTAGE_HULL_MIN, VEC_HOSTAGE_HULL_MAX); + UTIL_MakeVectors(pev->v_angle); + + SetBoneController(0, UTIL_VecToYaw(gpGlobals->v_forward)); + SetBoneController(1, 0); + SetBoneController(2, 0); + SetBoneController(3, 0); + SetBoneController(4, 0); + + DROP_TO_FLOOR(edict()); + +#ifdef HOOK_GAMEDLL + // TODO: fix test demo + SetThink(pCHostage__IdleThink); +#else + SetThink(&CHostage::IdleThink); +#endif // HOOK_GAMEDLL + + pev->nextthink = gpGlobals->time + RANDOM_FLOAT(0.1, 0.2); + + m_flNextFullThink = gpGlobals->time + RANDOM_FLOAT(0.1, 0.2); + m_vStart = pev->origin; + m_vStartAngles = pev->angles; + m_vOldPos = Vector(9999, 9999, 9999); + m_iHostageIndex = ++g_iHostageNumber; + + nTargetNode = -1; + m_fHasPath = FALSE; + + m_flLastPathCheck = -1; + m_flPathAcquired = -1; + m_flPathCheckInterval = 0.1; + m_flNextRadarTime = gpGlobals->time + RANDOM_FLOAT(0, 1); + + m_LocalNav = new CLocalNav(this); + m_bStuck = FALSE; + m_flStuckTime = 0; + m_improv = NULL; } /* <45bf91> ../cstrike/dlls/hostage/hostage.cpp:137 */ -NOBODY void CHostage::__MAKE_VHOOK(Precache)(void) +void CHostage::__MAKE_VHOOK(Precache)(void) { -// { -// int which; // 141 -// } + static int which = 0; + + if (UTIL_IsGame("czero")) + { + switch (which) + { + case REGULAR_GUY: + pev->model = MAKE_STRING("models/hostageA.mdl"); + break; + case OLD_GUY: + pev->model = MAKE_STRING("models/hostageB.mdl"); + break; + case BLACK_GUY: + pev->model = MAKE_STRING("models/hostageC.mdl"); + break; + case GOOFY_GUY: + pev->model = MAKE_STRING("models/hostageD.mdl"); + break; + default: + break; + } + + m_whichModel = static_cast(which); + + if (++which > 3) + which = 0; + } + else + { + m_whichModel = REGULAR_GUY; + if (FStringNull(pev->model)) + { + pev->model = MAKE_STRING("models/scientist.mdl"); + } + } + + PRECACHE_MODEL((char *)STRING(pev->model)); + PRECACHE_SOUND("hostage/hos1.wav"); + PRECACHE_SOUND("hostage/hos2.wav"); + PRECACHE_SOUND("hostage/hos3.wav"); + PRECACHE_SOUND("hostage/hos4.wav"); + PRECACHE_SOUND("hostage/hos5.wav"); + PRECACHE_MODEL("sprites/smoke.spr"); } /* <45c5ac> ../cstrike/dlls/hostage/hostage.cpp:179 */ @@ -76,83 +188,215 @@ void CHostage::SetActivity(int act) } } -void (*pCHostage__IdleThink)(void); - /* <45f194> ../cstrike/dlls/hostage/hostage.cpp:204 */ -NOBODY void __declspec(naked) CHostage::IdleThink(void) +void CHostage::IdleThink(void) { - __asm - { - jmp pCHostage__IdleThink + float flInterval; + const float upkeepRate = 0.3f; + const float giveUpTime = (1 / 30.0f); + float const updateRate = 0.1f; + + if (!TheNavAreaList.empty()) + { + if (!m_improv) + { + m_improv = new CHostageImprov(this); + + #if defined(HOOK_GAMEDLL) && defined(_WIN32) && !defined(REGAMEDLL_UNIT_TESTS) + VirtualTableInit((void *)m_improv, "CHostageImprov"); + #endif // HOOK_GAMEDLL && _WIN32 && !REGAMEDLL_UNIT_TESTS + } + } + else + { + if (m_improv != NULL) + { + delete m_improv; + } + + m_improv = NULL; + } + + pev->nextthink = gpGlobals->time + giveUpTime; + + flInterval = StudioFrameAdvance(0); + DispatchAnimEvents(flInterval); + + if (m_improv != NULL) + { + m_improv->OnUpkeep(upkeepRate); + } + + if (m_flNextFullThink > gpGlobals->time) + { + return; + } + + m_flNextFullThink = gpGlobals->time + 0.1; + + if (pev->deadflag == DEAD_DEAD) + { + UTIL_SetSize(pev, Vector(0, 0, 0), Vector(0, 0, 0)); + return; + } + + if (m_hTargetEnt != NULL && (m_bStuck && gpGlobals->time - m_flStuckTime > 5.0 || m_hTargetEnt->pev->deadflag != DEAD_NO)) + { + m_State = STAND; + m_hTargetEnt = NULL; + m_bStuck = FALSE; + } + + if (m_hTargetEnt != NULL || m_improv != NULL) + { + CBasePlayer *player = NULL; + + if (m_improv != NULL) + { + if (IsFollowingSomeone()) + { + player = (CBasePlayer *)m_improv->GetFollowLeader(); + } + } + else + { + player = GetClassPtr((CBasePlayer *)m_hTargetEnt->pev); + } + + if (!player || player->m_iTeam == CT) + { + if (!g_pGameRules->m_bMapHasRescueZone) + { + BOOL bContinue = FALSE; + BOOL bResHostagePt = FALSE; + + if (UTIL_FindEntityByClassname(NULL, "info_hostage_rescue")) + bResHostagePt = TRUE; + + CBaseEntity *pSpot = NULL; + + while ((pSpot = UTIL_FindEntityByClassname(pSpot, "info_hostage_rescue")) != NULL) + { + if ((pSpot->pev->origin - pev->origin).Length() < 256) + { + m_bRescueMe = TRUE; + break; + } + } + + if (!bResHostagePt) + { + pSpot = NULL; + + while ((pSpot = UTIL_FindEntityByClassname(pSpot, "info_player_start")) != NULL) + { + if ((pSpot->pev->origin - pev->origin).Length() < 256) + { + m_bRescueMe = TRUE; + break; + } + } + } + } + + if (m_bRescueMe) + { + if (TheBots != NULL) + { + TheBots->OnEvent(EVENT_HOSTAGE_RESCUED, player, this); + } + + if (TheCareerTasks != NULL && g_pGameRules->IsCareer() && player != NULL && !player->IsBot()) + { + TheCareerTasks->HandleEvent(EVENT_HOSTAGE_RESCUED, player); + } + + pev->deadflag = DEAD_RESPAWNABLE; + + if (player != NULL) + { + player->AddAccount(1000); + UTIL_LogPrintf("\"%s<%i><%s>\" triggered \"Rescued_A_Hostage\"\n", STRING(player->pev->netname), + GETPLAYERUSERID(player->edict()), GETPLAYERAUTHID(player->edict())); + } + + SendHostageEventMsg(); + + MESSAGE_BEGIN(MSG_SPEC, SVC_DIRECTOR); + WRITE_BYTE(9); + WRITE_BYTE(DRC_CMD_EVENT); + WRITE_SHORT((player != NULL) ? player->entindex() : 0); + WRITE_SHORT(player->entindex()); + WRITE_LONG(15); + MESSAGE_END(); + + pev->effects |= EF_NODRAW; + Remove(); + + g_pGameRules->m_iHostagesRescued++; + g_pGameRules->CheckWinConditions(); + + Broadcast((player != NULL) ? "rescued" : "escaped"); + } + } + } + + if (m_improv != NULL) + { + m_improv->OnUpdate(updateRate); + } + else + { + DoFollow(); + + if (gpGlobals->time >= m_flFlinchTime) + { + if (pev->velocity.Length() > 160) + { + SetActivity(ACT_RUN); + } + else if (pev->velocity.Length() > 15) + { + SetActivity(ACT_WALK); + } + else + { + SetActivity(ACT_IDLE); + } + } + } + + if (pev->deadflag != DEAD_DEAD && !(pev->effects & EF_NODRAW)) + { + if (m_flNextRadarTime <= gpGlobals->time) + { + Vector vDistance = m_vOldPos - pev->origin; + + if (vDistance.Length() > 1) + { + m_vOldPos = pev->origin; + + if (!g_pGameRules->m_fTeamCount) + { + SendHostagePositionMsg(); + } + } + + m_flNextRadarTime = gpGlobals->time + 1; + } } -// { -// float const upkeepRate; // 220 -// float flInterval; // 224 -// float const updateRate; // 236 -// { -// float const giveUpTime; // 249 -// } -// { -// class CBasePlayer *player; // 263 -// GetFollowLeader(const class CHostageImprov *const this); // 263 -// { -// class CBaseEntity *pSpot; // 271 -// BOOL bContinue; // 272 -// BOOL bResHostagePt; // 272 -// operator-(const Vector *const this, -// const Vector &v); // 284 -// Length(const Vector *const this); // 284 -// operator-(const Vector *const this, -// const Vector &v); // 298 -// Length(const Vector *const this); // 298 -// } -// edict(CBaseEntity *const this); // 332 -// edict(CBaseEntity *const this); // 332 -// MESSAGE_BEGIN(int msg_dest, -// int msg_type, -// const float *pOrigin, -// edict_t *ed); // 337 -// edict(CBaseEntity *const this); // 340 -// ENTINDEX(edict_t *pEdict); // 340 -// edict(CBaseEntity *const this); // 341 -// ENTINDEX(edict_t *pEdict); // 341 -// Remove(CHostage *const this); // 346 -// } -// Vector(Vector *const this, -// float X, -// float Y, -// float Z); // 242 -// Vector(Vector *const this, -// float X, -// float Y, -// float Z); // 242 -// { -// Vector vDistance; // 395 -// operator-(const Vector *const this, -// const Vector &v); // 395 -// Length(const Vector *const this); // 397 -// } -// Length(const Vector *const this); // 378 -// SetActivity(CHostage *const this, -// int act); // 379 -// Length(const Vector *const this); // 380 -// SetActivity(CHostage *const this, -// int act); // 381 -// SetActivity(CHostage *const this, -// int act); // 383 -// } } /* <45c041> ../cstrike/dlls/hostage/hostage.cpp:413 */ -NOBODY void CHostage::Remove(void) +void CHostage::Remove(void) { -// Vector(Vector::Remove(// float X, -// float Y, -// float Z); // 419 -// Vector(Vector *const this, -// float X, -// float Y, -// float Z); // 419 + pev->movetype = MOVETYPE_NONE; + pev->solid = SOLID_NOT; + pev->takedamage = DAMAGE_NO; + + UTIL_SetSize(pev, Vector(0, 0, 0), Vector(0, 0, 0)); + pev->nextthink = -1; + m_flNextFullThink = -1; } /* <45c624> ../cstrike/dlls/hostage/hostage.cpp:426 */ @@ -182,7 +426,13 @@ void CHostage::RePosition(void) DROP_TO_FLOOR(edict()); SetActivity(ACT_IDLE); +#ifdef HOOK_GAMEDLL + // TODO: fix test demo + SetThink(pCHostage__IdleThink); +#else SetThink(&CHostage::IdleThink); +#endif // HOOK_GAMEDLL + pev->nextthink = gpGlobals->time + RANDOM_FLOAT(0.1, 0.2); m_fHasPath = FALSE; @@ -195,248 +445,588 @@ void CHostage::RePosition(void) } /* <45ee7f> ../cstrike/dlls/hostage/hostage.cpp:469 */ -NOBODY int CHostage::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) +int CHostage::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { -// { -// float flActualDamage; // 471 -// class CBasePlayer *pAttacker; // 472 -// GetModifiedDamage(CHostage *const this, -// float flDamage, -// int nHitGroup); // 475 -// PlayPainSound(CHostage *const this); // 485 -// { -// class CBaseEntity *pAttackingEnt; // 489 -// GetClassPtr(CBaseEntity *a); // 492 -// } -// ApplyHostagePenalty(CHostage *const this, -// class CBasePlayer *pAttacker); // 518 -// SetFlinchActivity(CHostage *const this); // 552 -// } + float flActualDamage; + CBasePlayer *pAttacker = NULL; + + flActualDamage = GetModifiedDamage(flDamage, m_LastHitGroup); + + if (flActualDamage > pev->health) + flActualDamage = pev->health; + + pev->health -= flActualDamage; + + if (m_improv != NULL) + { + m_improv->OnInjury(flActualDamage); + } + + PlayPainSound(); + + if (pevAttacker != NULL) + { + CBaseEntity *pAttackingEnt = GetClassPtr((CBaseEntity *)pevAttacker); + + if (pAttackingEnt->Classify() == CLASS_VEHICLE) + { + CBaseEntity *pDriver = ((CFuncVehicle *)pAttackingEnt)->m_pDriver; + + if (pDriver != NULL) + { + pevAttacker = pDriver->pev; + } + } + + if (pAttackingEnt->IsPlayer()) + { + pAttacker = GetClassPtr((CBasePlayer *)pevAttacker); + } + } + + if (pev->health > 0) + { + m_flFlinchTime = gpGlobals->time + 0.75; + SetFlinchActivity(); + + if (pAttacker != NULL) + { + pAttacker->AddAccount(-20 * (unsigned __int64)(signed __int64)flActualDamage); + + if (TheBots != NULL) + { + TheBots->OnEvent(EVENT_HOSTAGE_DAMAGED, this, pAttacker); + } + + ClientPrint(pAttacker->pev, HUD_PRINTCENTER, "#Injured_Hostage"); + if (!(pAttacker->m_flDisplayHistory & DHF_HOSTAGE_INJURED)) + { + pAttacker->HintMessage("#Hint_careful_around_hostages"); + pAttacker->m_flDisplayHistory |= DHF_HOSTAGE_INJURED; + } + + return 1; + } + } + else + { + pev->health = 0; + pev->movetype = MOVETYPE_TOSS; + pev->flags &= ~FL_ONGROUND; + SetDeathActivity(); + + if (pAttacker != NULL) + { + pAttacker->AddAccount(20 * (-25 - (unsigned __int64)(signed __int64)flActualDamage)); + AnnounceDeath(pAttacker); + ApplyHostagePenalty(pAttacker); + } + + pev->takedamage = DAMAGE_NO; + pev->deadflag = DEAD_DEAD; + pev->solid = SOLID_NOT; + + if (TheBots != NULL) + { + TheBots->OnEvent(EVENT_HOSTAGE_KILLED, this, pAttacker); + } + + if (m_improv != NULL) + { + m_improv->Chatter(HOSTAGE_CHATTER_DEATH_CRY); + } + + g_pGameRules->CheckWinConditions(); + + if (!g_pGameRules->m_fTeamCount) + SendHostageEventMsg(); + + pev->nextthink = gpGlobals->time + 3; + SetThink(&CHostage::Remove); + } + + return 0; } /* <45c783> ../cstrike/dlls/hostage/hostage.cpp:578 */ -NOBODY float CHostage::GetModifiedDamage(float flDamage, int nHitGroup) +float CHostage::GetModifiedDamage(float flDamage, int nHitGroup) { + switch (nHitGroup) + { + case HITGROUP_GENERIC: flDamage *= 1.75; break; + case HITGROUP_HEAD: flDamage *= 2.5; break; + case HITGROUP_CHEST: flDamage *= 1.5; break; + case HITGROUP_STOMACH: flDamage *= 1.75; break; + case HITGROUP_LEFTARM: + case HITGROUP_RIGHTARM: flDamage *= 0.75; break; + case HITGROUP_LEFTLEG: + case HITGROUP_RIGHTLEG: flDamage *= 0.6; break; + default: flDamage *= 1.5; break; + } + + return flDamage; } /* <45c7d3> ../cstrike/dlls/hostage/hostage.cpp:597 */ -NOBODY void CHostage::PlayPainSound(void) +void CHostage::PlayPainSound(void) { -// EMIT_SOUND(edict_t *entity, -// int channel, -// const char *sample, -// float volume, -// float attenuation); // 603 -// EMIT_SOUND(edict_t *entity, -// int channel, -// const char *sample, -// float volume, -// float attenuation); // 605 + if (m_LastHitGroup != HITGROUP_HEAD) + return; + + switch (RANDOM_LONG(0, 1)) + { + case 0: EMIT_SOUND(edict(), CHAN_VOICE, "player/headshot1.wav", VOL_NORM, ATTN_NORM); break; + case 1: EMIT_SOUND(edict(), CHAN_VOICE, "player/headshot2.wav", VOL_NORM, ATTN_NORM); break; + } } /* <45c8c4> ../cstrike/dlls/hostage/hostage.cpp:612 */ -NOBODY void CHostage::SetFlinchActivity(void) +void CHostage::SetFlinchActivity(void) { -// { -// Activity activity; // 616 -// SetActivity(CHostage *const this, -// int act); // 637 -// } + Activity activity = ACT_SMALL_FLINCH; + + if (m_improv != NULL) + { + m_improv->Flinch(activity); + return; + } + + SetActivity(activity); } /* <45c960> ../cstrike/dlls/hostage/hostage.cpp:642 */ -NOBODY void CHostage::SetDeathActivity(void) +void CHostage::SetDeathActivity(void) { -// SetActivity(CHostage::SetDeathActivity(// int act); // 675 -// SetActivity(CHostage *const this, -// int act); // 678 -// SetActivity(CHostage *const this, -// int act); // 676 -// SetActivity(CHostage *const this, -// int act); // 677 -// SetActivity(CHostage *const this, -// int act); // 658 -// SetActivity(CHostage *const this, -// int act); // 656 + if (m_improv != NULL && m_improv->IsCrouching()) + { + m_improv->CrouchDie(); + return; + } + + if (UTIL_IsGame("czero")) + { + switch (m_LastHitGroup) + { + case HITGROUP_GENERIC: + case HITGROUP_LEFTARM: + case HITGROUP_RIGHTARM: + case HITGROUP_LEFTLEG: + case HITGROUP_RIGHTLEG: + SetActivity(ACT_DIESIMPLE); + break; + case HITGROUP_HEAD: + SetActivity(ACT_DIE_HEADSHOT); + break; + case HITGROUP_CHEST: + SetActivity(ACT_DIE_CHESTSHOT); + break; + case HITGROUP_STOMACH: + SetActivity(ACT_DIE_GUTSHOT); + break; + } + + return; + } + + // for CS 1.6 + switch (m_LastHitGroup) + { + case HITGROUP_GENERIC: + case HITGROUP_HEAD: + SetActivity(ACT_DIE_HEADSHOT); + break; + case HITGROUP_CHEST: + case HITGROUP_RIGHTARM: + SetActivity(ACT_DIESIMPLE); + break; + case HITGROUP_STOMACH: + case HITGROUP_RIGHTLEG: + SetActivity(ACT_DIEFORWARD); + break; + case HITGROUP_LEFTARM: + case HITGROUP_LEFTLEG: + SetActivity(ACT_DIEBACKWARD); + break; + } } /* <45cc41> ../cstrike/dlls/hostage/hostage.cpp:684 */ -NOBODY void CHostage::AnnounceDeath(CBasePlayer *pAttacker) +void CHostage::AnnounceDeath(CBasePlayer *pAttacker) { -// edict(CBaseEntity *const this); // 704 -// edict(CBaseEntity *const this); // 704 -// MESSAGE_BEGIN(int msg_dest, -// int msg_type, -// const float *pOrigin, -// edict_t *ed); // 707 -// edict(CBaseEntity *const this); // 710 -// ENTINDEX(edict_t *pEdict); // 710 -// edict(CBaseEntity *const this); // 711 -// ENTINDEX(edict_t *pEdict); // 711 + ClientPrint(pAttacker->pev, HUD_PRINTCENTER, "#Killed_Hostage"); + + if (!(pAttacker->m_flDisplayHistory & DHF_HOSTAGE_KILLED)) + { + pAttacker->HintMessage("#Hint_lost_money"); + pAttacker->m_flDisplayHistory |= DHF_HOSTAGE_KILLED; + } + + if (!g_pGameRules->IsMultiplayer()) + { + CHalfLifeTraining::HostageDied(); + } + + UTIL_LogPrintf("\"%s<%i><%s><%s>\" triggered \"Killed_A_Hostage\"\n", STRING(pAttacker->pev->netname), GETPLAYERUSERID(pAttacker->edict()), + GETPLAYERAUTHID(pAttacker->edict()), GetTeam(pAttacker->m_iTeam)); + + MESSAGE_BEGIN(MSG_SPEC, SVC_DIRECTOR); + WRITE_BYTE(9); + WRITE_BYTE(DRC_CMD_EVENT); + WRITE_SHORT(ENTINDEX(pAttacker->edict())); + WRITE_SHORT(ENTINDEX(edict())); + WRITE_LONG(15); + MESSAGE_END(); } /* <45cd6b> ../cstrike/dlls/hostage/hostage.cpp:717 */ -NOBODY void CHostage::ApplyHostagePenalty(CBasePlayer *pAttacker) +void CHostage::ApplyHostagePenalty(CBasePlayer *pAttacker) { -// { -// int iHostagePenalty; // 719 -// edict(CBaseEntity *const this); // 735 -// } + if (pAttacker->m_iTeam != TERRORIST) + return; + + int iHostagePenalty = (int)CVAR_GET_FLOAT("mp_hostagepenalty"); + + if (iHostagePenalty) + { + if (pAttacker->m_iHostagesKilled++ == iHostagePenalty) + { + pAttacker->HintMessage("#Hint_removed_for_next_hostage_killed", TRUE); + } + else if (pAttacker->m_iHostagesKilled >= iHostagePenalty) + { + #ifdef REGAMEDLL_FIXES + SERVER_COMMAND(UTIL_VarArgs("kick #%d\n", GETPLAYERUSERID(pAttacker->edict()))); + #else + CLIENT_COMMAND(pAttacker->edict(), "disconnect\n"); + #endif // REGAMEDLL_FIXES + } + } } /* <45cfd6> ../cstrike/dlls/hostage/hostage.cpp:740 */ -NOBODY void CHostage::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) +void CHostage::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { -// { -// class CBasePlayer *pPlayer; // 742 -// } -// Use(CHostage *const this, -// class CBaseEntity *pActivator, -// class CBaseEntity *pCaller, -// USE_TYPE useType, -// float value); // 740 + if (!pActivator->IsPlayer()) + return; + + if (pev->takedamage == DAMAGE_NO) + return; + + CBasePlayer *pPlayer = (CBasePlayer *)pActivator; + + if (pPlayer->m_iTeam != CT) + { + if (!(pPlayer->m_flDisplayHistory & DHF_HOSTAGE_CTMOVE)) + { + pPlayer->m_flDisplayHistory |= DHF_HOSTAGE_CTMOVE; + pPlayer->HintMessage("#Only_CT_Can_Move_Hostages", FALSE, TRUE); + } + + return; + } + + if (gpGlobals->time >= m_flNextChange) + { + m_flNextChange = gpGlobals->time + 1; + + if (m_improv != NULL) + { + if (m_improv->IsFollowing() && pActivator == m_improv->GetFollowLeader()) + { + m_improv->Agree(); + m_improv->Idle(); + m_improv->Chatter(HOSTAGE_CHATTER_STOP_FOLLOW); + } + else + { + m_improv->Follow(pPlayer); + + if (TheBots != NULL) + { + TheBots->OnEvent(EVENT_HOSTAGE_USED, pActivator); + } + } + } + else + { + m_flPathAcquired = gpGlobals->time; + + if (pActivator != m_hTargetEnt) + { + m_State = FOLLOW; + m_hTargetEnt = pActivator; + m_hStoppedTargetEnt = NULL; + } + else if (m_State == FOLLOW) + { + m_State = STAND; + m_hTargetEnt = NULL; + m_hStoppedTargetEnt = pActivator; + } + else + m_State = FOLLOW; + + if (m_State == FOLLOW) + { + PlayFollowRescueSound(); + if (TheBots != NULL) + { + TheBots->OnEvent(EVENT_HOSTAGE_USED, pActivator); + } + } + } + + GiveCTTouchBonus(pPlayer); + pPlayer->HostageUsed(); + } } /* <45cdba> ../cstrike/dlls/hostage/hostage.cpp:833 */ -NOBODY void CHostage::PlayFollowRescueSound(void) +void CHostage::PlayFollowRescueSound(void) { -// EMIT_SOUND(edict_t *entity, -// int channel, -// const char *sample, -// float volume, -// float attenuation); // 845 -// EMIT_SOUND(edict_t *entity, -// int channel, -// const char *sample, -// float volume, -// float attenuation); // 843 -// EMIT_SOUND(edict_t *entity, -// int channel, -// const char *sample, -// float volume, -// float attenuation); // 837 -// EMIT_SOUND(edict_t *entity, -// int channel, -// const char *sample, -// float volume, -// float attenuation); // 839 -// EMIT_SOUND(edict_t *entity, -// int channel, -// const char *sample, -// float volume, -// float attenuation); // 841 + switch (RANDOM_LONG(0, 4)) + { + case 0: EMIT_SOUND(ENT(pev), CHAN_VOICE, "hostage/hos1.wav", VOL_NORM, ATTN_NORM); break; + case 1: EMIT_SOUND(ENT(pev), CHAN_VOICE, "hostage/hos2.wav", VOL_NORM, ATTN_NORM); break; + case 2: EMIT_SOUND(ENT(pev), CHAN_VOICE, "hostage/hos3.wav", VOL_NORM, ATTN_NORM); break; + case 3: EMIT_SOUND(ENT(pev), CHAN_VOICE, "hostage/hos4.wav", VOL_NORM, ATTN_NORM); break; + case 4: EMIT_SOUND(ENT(pev), CHAN_VOICE, "hostage/hos5.wav", VOL_NORM, ATTN_NORM); break; + } } /* <45d1ff> ../cstrike/dlls/hostage/hostage.cpp:851 */ -NOBODY void CHostage::GiveCTTouchBonus(CBasePlayer *pPlayer) +void CHostage::GiveCTTouchBonus(CBasePlayer *pPlayer) { -// edict(CBaseEntity *const this); // 865 -// edict(CBaseEntity *const this); // 865 + if (m_bTouched) + return; + + m_bTouched = TRUE; + g_pGameRules->m_iAccountCT += 100; + + pPlayer->AddAccount(150); + UTIL_LogPrintf("\"%s<%i><%s>\" triggered \"Touched_A_Hostage\"\n", STRING(pPlayer->pev->netname), GETPLAYERUSERID(pPlayer->edict()), GETPLAYERAUTHID(pPlayer->edict())); } /* <45bf69> ../cstrike/dlls/hostage/hostage.cpp:869 */ -NOBODY int CHostage::__MAKE_VHOOK(ObjectCaps)(void) +int CHostage::__MAKE_VHOOK(ObjectCaps)(void) { + return CBaseMonster::ObjectCaps() | FCAP_MUST_SPAWN | FCAP_ONOFF_USE; } /* <45c0e3> ../cstrike/dlls/hostage/hostage.cpp:876 */ -NOBODY void CHostage::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) +void CHostage::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) { -// { -// class Vector2D vPush; // 901 -// float const pushForce; // 904 -// FClassnameIs(entvars_t *pev, -// const char *szClassname); // 895 -// { -// class CBasePlayer *pPlayer; // 888 -// } -// } -// Touch(CHostage *const this, -// class CBaseEntity *pOther); // 876 + Vector2D vPush; + const float pushForce = 50.0f; + + if (m_improv != NULL) + { + m_improv->OnTouch(pOther); + return; + } + + CBasePlayer *pPlayer = (CBasePlayer *)pOther; + + if (pPlayer->IsPlayer()) + { + if (pPlayer->m_iTeam != CT) + return; + } + else + { + if (!FClassnameIs(pPlayer->pev, "hostage_entity")) + return; + } + + vPush = (pev->origin - pOther->pev->origin).Make2D(); + +#ifndef HOOK_GAMEDLL + vPush = vPush.Normalize() * pushForce; + + pev->velocity.x += vPush.x; + pev->velocity.y += vPush.y; +#else + // TODO: fix test demo + pev->velocity = pev->velocity + NormalizeMulScalar(vPush, pushForce); +#endif // HOOK_GAMEDLL } /* <45dd66> ../cstrike/dlls/hostage/hostage.cpp:910 */ -NOBODY void CHostage::DoFollow(void) +void CHostage::DoFollow(void) { -// { -// class CBaseEntity *pFollowing; // 912 -// Vector vecDest; // 913 -// float flRadius; // 914 -// float flDistToDest; // 915 -// GetClassPtr(CBaseEntity *a); // 930 -// SetTargetEnt(CLocalNav *const this, -// class CBaseEntity *pTarget); // 931 -// operator-(const Vector *const this, -// const Vector &v); // 937 -// Length(const Vector *const this); // 937 -// Length2D(const Vector *const this); // 1009 -// operator-(const Vector *const this, -// const Vector &v); // 964 -// Length2D(const Vector *const this); // 964 -// Length2D(const Vector *const this); // 952 -// IsFollowingSomeone(CHostage *const this); // 994 -// PointAt(CHostage *const this, -// const Vector &vecLoc); // 985 -// } + CBaseEntity *pFollowing; + Vector vecDest; + float flRadius = 0; + float flDistToDest; + + if (m_hTargetEnt == NULL) + return; + + if (cv_hostage_stop.value > 0.0) + { + m_State = STAND; + m_hTargetEnt = NULL; + m_hStoppedTargetEnt = NULL; + return; + } + + pFollowing = GetClassPtr((CBaseEntity *)m_hTargetEnt->pev); + m_LocalNav->SetTargetEnt(pFollowing); + + vecDest = pFollowing->pev->origin; + vecDest.z += pFollowing->pev->mins.z; + flDistToDest = (vecDest - pev->origin).Length(); + + if (flDistToDest < 80 && (m_fHasPath || m_LocalNav->PathTraversable(pev->origin, vecDest, TRUE))) + return; + + if (pev->flags & FL_ONGROUND) + { + if (m_flPathCheckInterval + m_flLastPathCheck < gpGlobals->time) + { + if (!m_fHasPath || pFollowing->pev->velocity.Length2D() > 1) + { + m_flLastPathCheck = gpGlobals->time; + m_LocalNav->RequestNav(this); + } + } + } + + if (m_fHasPath) + { + nTargetNode = m_LocalNav->GetFurthestTraversableNode(pev->origin, vecNodes, m_nPathNodes, TRUE); + + if (!nTargetNode) + { + if ((vecNodes[nTargetNode] - pev->origin).Length2D() < HOSTAGE_STEPSIZE) + nTargetNode = -1; + } + if (nTargetNode == -1) + { + m_fHasPath = FALSE; + m_flPathCheckInterval = 0.1f; + } + } + + if (gpGlobals->time < m_flFlinchTime) + return; + + if (nTargetNode != -1) + { + if (pev->flags & FL_ONGROUND) + PointAt(vecNodes[nTargetNode]); + + if (pev->movetype == MOVETYPE_FLY) + pev->v_angle.x = -60; + + MoveToward(vecNodes[nTargetNode]); + m_bStuck = FALSE; + } + else if (pev->takedamage == DAMAGE_YES) + { + if (m_improv != NULL) + { + if (IsFollowingSomeone()) + { + if (!m_bStuck && flDistToDest > 200) + { + m_bStuck = TRUE; + m_flStuckTime = gpGlobals->time; + } + } + } + else if (m_hTargetEnt != NULL && m_State == FOLLOW) + { + if (!m_bStuck && flDistToDest > 200) + { + m_bStuck = TRUE; + m_flStuckTime = gpGlobals->time; + } + } + } + + if (pev->flags & FL_ONGROUND) + { + if (m_flPathAcquired != -1 && m_flPathAcquired + 2 > gpGlobals->time) + { + if (pev->velocity.Length2D() < 1 || nTargetNode == -1) + { + Wiggle(); + } + } + } } /* <45d278> ../cstrike/dlls/hostage/hostage.cpp:1018 */ -NOBODY void CHostage::PointAt(const Vector &vecLoc) +void CHostage::PointAt(const Vector &vecLoc) { -// operator-(const Vector *const this, -// const Vector &v); // 1022 + pev->angles.x = 0; + pev->angles.y = UTIL_VecToAngles(vecLoc - pev->origin).y; + pev->angles.z = 0; } /* <45d34c> ../cstrike/dlls/hostage/hostage.cpp:1025 */ -NOBODY void CHostage::MoveToward(const Vector &vecLoc) +void CHostage::MoveToward(const Vector &vecLoc) { -// { -// int nFwdMove; // 1027 -// Vector vecFwd; // 1028 -// Vector vecbigDest; // 1029 -// Vector vecMove; // 1030 -// class CBaseEntity *pFollowing; // 1032 -// Vector vecAng; // 1034 -// float flDist; // 1040 -// GetClassPtr(CBaseEntity *a); // 1032 -// UTIL_MakeVectorsPrivate(Vector &vecAngles, -// float *p_vForward, -// float *p_vRight, -// float *p_vUp); // 1038 -// operator-(const Vector *const this, -// const Vector &v); // 1036 -// operator-(const Vector *const this, -// const Vector &v); // 1040 -// Length2D(const Vector *const this); // 1040 -// operator*(const Vector *const this, -// float fl); // 1040 -// Length2D(const Vector *const this); // 1040 -// operator-(const Vector *const this, -// const Vector &v); // 1040 -// Length2D(const Vector *const this); // 1040 -// operator*(const Vector *const this, -// float fl); // 1041 -// operator+(const Vector *const this, -// const Vector &v); // 1043 -// { -// float flSpeed; // 1049 -// Vector vecDest; // 1051 -// { -// float flDist; // 1061 -// operator-(const Vector *const this, -// const Vector &v); // 1063 -// Length(const Vector *const this); // 1063 -// } -// } -// operator*(const Vector *const this, -// float fl); // 1040 -// Length2D(const Vector *const this); // 1040 -// } + int nFwdMove; + Vector vecFwd; + Vector vecbigDest; + Vector vecMove; + CBaseEntity *pFollowing; + Vector vecAng; + float_precision flDist; + + pFollowing = GetClassPtr((CBaseEntity *)m_hTargetEnt->pev); + vecMove = vecLoc - pev->origin; + vecAng = UTIL_VecToAngles(vecMove); + vecAng = Vector(0, vecAng.y, 0); + UTIL_MakeVectorsPrivate(vecAng, vecFwd, NULL, NULL); + + if ((vecFwd * s_flStepSize_LocalNav).Length2D() <= (vecLoc - pev->origin).Length2D()) + flDist = (vecFwd * s_flStepSize_LocalNav).Length2D(); + else + flDist = (vecLoc - pev->origin).Length2D(); + + vecbigDest = pev->origin + (vecFwd * flDist); + nFwdMove = m_LocalNav->PathTraversable(pev->origin, vecbigDest, FALSE); + + if (nFwdMove != PATH_TRAVERSABLE_EMPTY) + { + float_precision flSpeed = 250; + + vecbigDest = pFollowing->pev->origin; + vecbigDest.z += pFollowing->pev->mins.z; + + if (pev->flags & FL_ONGROUND) + { + flSpeed = (vecbigDest - pev->origin).Length(); + + if (flSpeed >= 110) + { + if (flSpeed >= 250) + flSpeed = 400; + else + flSpeed = 300; + } + } + + pev->velocity.x = vecFwd.x * flSpeed; + pev->velocity.y = vecFwd.y * flSpeed; + + if (nFwdMove != PATH_TRAVERSABLE_STEP && nFwdMove == PATH_TRAVERSABLE_STEPJUMPABLE) + { + if (pev->flags & FL_ONGROUND) + { + pev->velocity.z = 270; + } + } + } } /* <45d704> ../cstrike/dlls/hostage/hostage.cpp:1102 */ -NOBODY BOOL CHostage::IsOnLadder(void) +BOOL CHostage::IsOnLadder(void) { + return pev->movetype == MOVETYPE_FLY; } /* <45d727> ../cstrike/dlls/hostage/hostage.cpp:1106 */ @@ -496,78 +1086,103 @@ void CHostage::NavReady(void) } /* <45edaa> ../cstrike/dlls/hostage/hostage.cpp:1159 */ -NOBODY void CHostage::SendHostagePositionMsg(void) +void CHostage::SendHostagePositionMsg(void) { -// { -// class CBaseEntity *pEntity; // 1161 -// edict(CBaseEntity *const this); // 1165 -// FNullEnt(const edict_t *pent); // 1165 -// { -// class CBasePlayer *pTempPlayer; // 1169 -// MESSAGE_BEGIN(int msg_dest, -// int msg_type, -// const float *pOrigin, -// entvars_t *ent); // 1173 -// } -// } + CBaseEntity *pEntity = NULL; + + while ((pEntity = UTIL_FindEntityByClassname(pEntity, "player")) != NULL) + { + if (FNullEnt(pEntity->edict())) + break; + + if (!pEntity->IsPlayer()) + continue; + + if (pEntity->pev->flags == FL_DORMANT) + continue; + + CBasePlayer *pTempPlayer = GetClassPtr((CBasePlayer *)pEntity->pev); + + if (pTempPlayer->pev->deadflag == DEAD_NO && pTempPlayer->m_iTeam == CT) + { + MESSAGE_BEGIN(MSG_ONE, gmsgHostagePos, NULL, pTempPlayer->pev); + WRITE_BYTE(0); + WRITE_BYTE(m_iHostageIndex); + WRITE_COORD(pev->origin.x); + WRITE_COORD(pev->origin.y); + WRITE_COORD(pev->origin.z); + MESSAGE_END(); + } + } } /* <45ecd5> ../cstrike/dlls/hostage/hostage.cpp:1189 */ -NOBODY void CHostage::SendHostageEventMsg(void) +void CHostage::SendHostageEventMsg(void) { -// { -// class CBaseEntity *pEntity; // 1191 -// edict(CBaseEntity *const this); // 1195 -// FNullEnt(const edict_t *pent); // 1195 -// { -// class CBasePlayer *pTempPlayer; // 1199 -// MESSAGE_BEGIN(int msg_dest, -// int msg_type, -// const float *pOrigin, -// entvars_t *ent); // 1203 -// } -// } + CBaseEntity *pEntity = NULL; + + while ((pEntity = UTIL_FindEntityByClassname(pEntity, "player")) != NULL) + { + if (FNullEnt(pEntity->edict())) + break; + + if (!pEntity->IsPlayer()) + continue; + + if (pEntity->pev->flags == FL_DORMANT) + continue; + + CBasePlayer *pTempPlayer = GetClassPtr((CBasePlayer *)pEntity->pev); + + if (pTempPlayer->pev->deadflag == DEAD_NO && pTempPlayer->m_iTeam == CT) + { + MESSAGE_BEGIN(MSG_ONE, gmsgHostageK, NULL, pTempPlayer->pev); + WRITE_BYTE(m_iHostageIndex); + MESSAGE_END(); + } + + if (pTempPlayer->pev->deadflag == DEAD_NO) + pTempPlayer->SendHostageIcons(); + } } /* <45d8a6> ../cstrike/dlls/hostage/hostage.cpp:1292 */ -NOBODY void CHostage::Wiggle(void) +void CHostage::Wiggle(void) { -// { -// TraceResult tr; // 1294 -// Vector vec; // 1295 -// Vector wiggle_directions; // 1297 -// operator*(const Vector *const this, -// float fl); // 1307 -// { -// int i; // 1309 -// { -// Vector dest; // 1311 -// operator+(const Vector *const this, -// const Vector &v); // 1311 -// operator-(const Vector *const this, -// const Vector &v); // 1314 -// } -// } -// operator*(const Vector *const this, -// float fl); // 1307 -// operator*(const Vector *const this, -// float fl); // 1307 -// operator*(const Vector *const this, -// float fl); // 1307 -// operator*(const Vector *const this, -// float fl); // 1307 -// operator*(const Vector *const this, -// float fl); // 1307 -// operator*(const Vector *const this, -// float fl); // 1307 -// operator*(const Vector *const this, -// float fl); // 1307 -// operator+(const Vector *const this, -// const Vector &v); // 1338 -// Normalize(const Vector *const this); // 1340 -// operator+(const Vector *const this, -// const Vector &v); // 1340 -// } + TraceResult tr; + Vector vec = Vector(0, 0, 0); + Vector wiggle_directions[] = + { + Vector(50, 0, 0), + Vector(-50, 0, 0), + Vector(0, 50, 0), + Vector(0, -50, 0), + Vector(50, 50, 0), + Vector(50, -50, 0), + Vector(-50, 50, 0), + Vector(-50, -50, 0) + }; + + for (int i = 0; i < ARRAYSIZE(wiggle_directions); i++) + { + Vector dest = pev->origin + wiggle_directions[i]; + + if (m_LocalNav->PathTraversable(pev->origin, dest, TRUE) == PATH_TRAVERSABLE_EMPTY) + { + vec = vec - wiggle_directions[i]; + } + } + +#ifndef HOOK_GAMEDLL + vec = vec + Vector(RANDOM_FLOAT(-3, 3), RANDOM_FLOAT(-3, 3), 0); +#else + // TODO: fix test demo + vec.y = vec.y + RANDOM_FLOAT(-3.0, 3.0); + vec.x = vec.x + RANDOM_FLOAT(-3.0, 3.0); + +#endif // HOOK_GAMEDLL + + pev->velocity = pev->velocity + (vec.Normalize() * 100); } /* <45e00c> ../cstrike/dlls/hostage/hostage.cpp:1346 */ @@ -597,12 +1212,7 @@ void CHostage::PreThink(void) vecSrc = pev->origin; -#ifndef HOOK_GAMEDLL - flInterval = m_LocalNav->ps_flStepSize; -#else - flInterval = (*m_LocalNav->ps_flStepSize); -#endif // HOOK_GAMEDLL - + flInterval = s_flStepSize_LocalNav; vecDest = vecSrc + pev->velocity * gpGlobals->frametime; vecDest.z = vecSrc.z; @@ -656,20 +1266,22 @@ void Hostage_RegisterCVars(void) } /* <45e2a6> ../cstrike/dlls/hostage/hostage.cpp:1430 */ -NOBODY void InstallHostageManager(void) +void InstallHostageManager(void) { -// ~CHostageManager(CHostageManager *const this, -// int const __in_chrg); // 1433 -// CHostageManager(CHostageManager *const this); // 1435 + if (g_pHostages != NULL) + { + delete g_pHostages; + g_pHostages = NULL; + } + + g_pHostages = new CHostageManager; } /* <45e375> ../cstrike/dlls/hostage/hostage.cpp:1443 */ -NOBODY CHostageManager::CHostageManager(void) +CHostageManager::CHostageManager(void) { Q_memset(&m_chatter, 0, sizeof(m_chatter)); m_hostageCount = 0; - -// SimpleChatter(SimpleChatter *const this); // 1443 } /* <45e39b> ../cstrike/dlls/hostage/hostage.cpp:1456 */ @@ -829,9 +1441,9 @@ void CHostageManager::RestartRound(void) { for (int i = 0; i < m_hostageCount; i++) { - if (m_hostage[ i ]->m_improv != NULL) + if (m_hostage[i]->m_improv != NULL) { - m_hostage[ i ]->m_improv->OnReset(); + m_hostage[i]->m_improv->OnReset(); } } } @@ -859,36 +1471,49 @@ void CHostageManager::AddHostage(CHostage *hostage) } /* <45e47f> ../cstrike/dlls/hostage/hostage.cpp:1657 */ -NOBODY bool CHostageManager::IsNearbyHostageTalking(CHostageImprov *improv) +bool CHostageManager::IsNearbyHostageTalking(CHostageImprov *improv) { -// { -// int i; // 1659 -// { -// const class CHostageImprov *other; // 1663 -// float const closeRange; // 1671 -// operator-(const Vector *const this, -// const Vector &v); // 1672 -// IsLengthGreaterThan(const Vector *const this, -// float length); // 1672 -// IsTalking(const class CHostageImprov *const this); // 1675 -// } -// } + for (int i = 0; i < m_hostageCount; i++) + { + const float closeRange = 500.0f; + const CHostageImprov *other = m_hostage[i]->m_improv; + + if (other == NULL) + continue; + + if (!other->IsAlive() || other == improv) + continue; + + if (!(improv->GetCentroid() - other->GetCentroid()).IsLengthGreaterThan(closeRange) && !other->IsTalking()) + { + return true; + } + } + + return false; } /* <45e57b> ../cstrike/dlls/hostage/hostage.cpp:1689 */ -NOBODY bool CHostageManager::IsNearbyHostageJumping(CHostageImprov *improv) +bool CHostageManager::IsNearbyHostageJumping(CHostageImprov *improv) { -// { -// int i; // 1691 -// { -// const class CHostageImprov *other; // 1695 -// float const closeRange; // 1703 -// operator-(const Vector *const this, -// const Vector &v); // 1704 -// IsLengthGreaterThan(const Vector *const this, -// float length); // 1704 -// } -// } + for (int i = 0; i < m_hostageCount; i++) + { + const float closeRange = 500.0f; + const CHostageImprov *other = m_hostage[i]->m_improv; + + if (other == NULL) + continue; + + if (!other->IsAlive() || other == improv) + continue; + + if (!(improv->GetCentroid() - other->GetCentroid()).IsLengthGreaterThan(closeRange) && other->IsJumping()) + { + return true; + } + } + + return false; } /* <45e642> ../cstrike/dlls/hostage/hostage.cpp:1716 */ @@ -923,7 +1548,7 @@ SimpleChatter::~SimpleChatter(void) { for (int f = 0; f < m_chatter[i].count; f++) { - if (m_chatter[i].file[f].filename) + if (m_chatter[i].file[f].filename != NULL) { delete[] m_chatter[i].file[f].filename; } @@ -937,12 +1562,12 @@ void SimpleChatter::AddSound(HostageChatterType type, char *filename) ChatterSet *chatter; char actualFilename[128]; - chatter = &m_chatter[ type ]; + chatter = &m_chatter[type]; Q_snprintf(actualFilename, sizeof(actualFilename), "sound\\%s", filename); - chatter->file[ chatter->count ].filename = CloneString(filename); - chatter->file[ chatter->count ].duration = (double)GET_APPROX_WAVE_PLAY_LEN(actualFilename) / 1000.0; + chatter->file[chatter->count].filename = CloneString(filename); + chatter->file[chatter->count].duration = (double)GET_APPROX_WAVE_PLAY_LEN(actualFilename) / 1000.0; chatter->needsShuffle = true; chatter->count++; @@ -951,45 +1576,94 @@ void SimpleChatter::AddSound(HostageChatterType type, char *filename) } /* <45e8c7> ../cstrike/dlls/hostage/hostage.cpp:1773 */ -NOBODY void SimpleChatter::Shuffle(ChatterSet *chatter) +void SimpleChatter::Shuffle(ChatterSet *chatter) { -// { -// int i; // 1775 -// { -// int j; // 1777 -// { -// class SoundFile tmp; // 1781 -// } -// } -// } + if (!chatter->needsShuffle) + return; + + for (int i = 1; i < chatter->count; i++) + { + for (int j = i; j < chatter->count; j++) + { + if (RANDOM_LONG(0, 100) < 50) + { + SoundFile tmp; + tmp.filename = chatter->file[i - 1].filename; + tmp.duration = chatter->file[i - 1].duration; + + chatter->file[i - 1] = chatter->file[j]; + chatter->file[j].filename = tmp.filename; + chatter->file[j].duration = tmp.duration; + } + } + } + + chatter->needsShuffle = false; } /* <45e979> ../cstrike/dlls/hostage/hostage.cpp:1793 */ -NOBODY char *SimpleChatter::GetSound(HostageChatterType type, float *duration) +char *SimpleChatter::GetSound(HostageChatterType type, float *duration) { -// { -// class ChatterSet *chatter; // 1795 -// char *sound; // 1805 -// Shuffle(SimpleChatter *const this, -// class ChatterSet *chatter); // 1800 -// } + ChatterSet *chatter = &m_chatter[type]; + char *sound; + + Shuffle(chatter); + sound = chatter->file[chatter->index].filename; + *duration = chatter->file[chatter->index].duration; + + if (++chatter->index >= chatter->count) + { + chatter->index = 0; + } + + return sound; } /* <45ea1b> ../cstrike/dlls/hostage/hostage.cpp:1818 */ -NOBODY float SimpleChatter::PlaySound(CBaseEntity *entity, HostageChatterType type) -{ -// { -// class CHostage *hostage; // 1821 -// float duration; // 1823 -// char *sound; // 1824 -// GetSound(SimpleChatter *const this, -// enum HostageChatterType type, -// float *duration); // 1824 -// { -// int pitch; // 1828 -// int attenuation; // 1838 -// } -// } +float SimpleChatter::PlaySound(CBaseEntity *entity, HostageChatterType type) +{ + CHostage *hostage; + float duration; + char *sound; + int pitch; + int attenuation = 1; + + sound = GetSound(type, &duration); + hostage = reinterpret_cast(entity); + + if (sound == NULL) + { + return 0; + } + + switch (hostage->m_whichModel) + { + case CHostage::REGULAR_GUY: + pitch = 92; + break; + case CHostage::BLACK_GUY: + pitch = 86; + break; + case CHostage::GOOFY_GUY: + pitch = 100; + break; + case CHostage::OLD_GUY: + default: + pitch = 88; + break; + } + + EMIT_SOUND_DYN(ENT(hostage->pev), CHAN_VOICE, sound, VOL_NORM, attenuation, 0, pitch); + + if (type == HOSTAGE_CHATTER_CALL_TO_RESCUER) + { + if (TheBots != NULL) + { + TheBots->OnEvent(EVENT_HOSTAGE_CALLED_FOR_HELP, hostage); + } + } + + return duration; } #ifdef HOOK_GAMEDLL diff --git a/regamedll/dlls/hostage/hostage.h b/regamedll/dlls/hostage/hostage.h index 9ff94ad8..29ee0705 100644 --- a/regamedll/dlls/hostage/hostage.h +++ b/regamedll/dlls/hostage/hostage.h @@ -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 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 diff --git a/regamedll/dlls/hostage/hostage_improv.cpp b/regamedll/dlls/hostage/hostage_improv.cpp index a4c345eb..69899a49 100644 --- a/regamedll/dlls/hostage/hostage_improv.cpp +++ b/regamedll/dlls/hostage/hostage_improv.cpp @@ -1,7 +1,7 @@ #include "precompiled.h" /* <4703fc> ../cstrike/dlls/hostage/hostage_improv.cpp:19 */ -NOBODY inline void DrawAxes(Vector &origin, int red, int green, int blue) +inline void DrawAxes(Vector &origin, int red, int green, int blue) { // { // float size; // 21 @@ -11,142 +11,207 @@ NOBODY inline void DrawAxes(Vector &origin, int red, int green, int blue) /* <47353e> ../cstrike/dlls/hostage/hostage_improv.cpp:41 */ CHostageImprov::CHostageImprov(CBaseEntity *entity) { -// HostageEscapeState(HostageEscapeState *const this); // 41 -// CountdownTimer(CountdownTimer *const this); // 41 -// CountdownTimer(CountdownTimer *const this); // 41 -// HostageStateMachine(HostageStateMachine *const this); // 41 -// HostageIdleState(HostageIdleState *const this); // 41 -// HostageRetreatState(HostageRetreatState *const this); // 41 -// HostageFollowState(HostageFollowState *const this); // 41 -// HostageAnimateState(HostageAnimateState *const this); // 41 -// CNavPath(CNavPath *const this); // 41 -// IntervalTimer(IntervalTimer *const this); // 41 -// IntervalTimer(IntervalTimer *const this); // 41 -// CountdownTimer(CountdownTimer *const this); // 41 -// CountdownTimer(CountdownTimer *const this); // 41 -// CountdownTimer(CountdownTimer *const this); // 41 -// CountdownTimer(CountdownTimer *const this); // 41 -// CountdownTimer(CountdownTimer *const this); // 41 -// IntervalTimer(IntervalTimer *const this); // 41 -// IntervalTimer(IntervalTimer *const this); // 41 -// CountdownTimer(CountdownTimer *const this); // 41 -// CountdownTimer(CountdownTimer *const this); // 41 -// CountdownTimer(CountdownTimer *const this); // 41 -// CountdownTimer(CountdownTimer *const this); // 41 -// CountdownTimer(CountdownTimer *const this); // 41 -// IntervalTimer(IntervalTimer *const this); // 41 -// CountdownTimer(CountdownTimer *const this); // 41 -// CountdownTimer(CountdownTimer *const this); // 41 -// CountdownTimer(CountdownTimer *const this); // 41 -// CountdownTimer(CountdownTimer *const this); // 41 -// CountdownTimer(CountdownTimer *const this); // 41 -// CountdownTimer(CountdownTimer *const this); // 41 -// CountdownTimer(CountdownTimer *const this); // 41 + m_hostage = reinterpret_cast(entity); + OnReset(); } /* <470d33> ../cstrike/dlls/hostage/hostage_improv.cpp:52 */ -NOBODY bool CHostageImprov::__MAKE_VHOOK(IsAlive)(void) const +bool CHostageImprov::__MAKE_VHOOK(IsAlive)(void) const { + return m_hostage->pev->deadflag != DEAD_DEAD; } /* <474809> ../cstrike/dlls/hostage/hostage_improv.cpp:61 */ -NOBODY void CHostageImprov::__MAKE_VHOOK(MoveTo)(const Vector &goal) +void CHostageImprov::__MAKE_VHOOK(MoveTo)(const Vector &goal) { -// Invalidate(CNavPath *const this); // 64 -// MoveTo(CHostageImprov *const this, -// const Vector &goal); // 61 + m_moveGoal = goal; + m_path.Invalidate(); + + if (m_hasKnownGoodPos) + return; + + m_hasKnownGoodPos = true; + SetKnownGoodPosition(GetFeet()); } +// Find "simple" ground height, treating current nav area as part of the floor + /* <4717e4> ../cstrike/dlls/hostage/hostage_improv.cpp:78 */ -NOBODY bool CHostageImprov::__MAKE_VHOOK(GetSimpleGroundHeightWithFloor)(const Vector *pos, float *height, Vector *normal) +bool CHostageImprov::__MAKE_VHOOK(GetSimpleGroundHeightWithFloor)(const Vector *pos, float *height, Vector *normal) { -// GetSimpleGroundHeightWithFloor(CHostageImprov *const this, -// const Vector *pos, -// float *height, -// Vector *normal); // 78 + if (GetSimpleGroundHeight(pos, height, normal)) + { + // our current nav area also serves as a ground polygon + if (m_lastKnownArea != NULL && m_lastKnownArea->IsOverlapping(pos)) + *height = Q_max((*height), m_lastKnownArea->GetZ(pos)); + + return true; + } + + return false; } +// Check if we need to jump due to height change + /* <473da4> ../cstrike/dlls/hostage/hostage_improv.cpp:96 */ -NOBODY bool CHostageImprov::DiscontinuityJump(float ground, bool onlyJumpDown, bool mustJump) +bool CHostageImprov::DiscontinuityJump(float ground, bool onlyJumpDown, bool mustJump) { -// { -// float dz; // 101 -// } -// DiscontinuityJump(CHostageImprov *const this, -// float ground, -// bool onlyJumpDown, -// bool mustJump); // 96 + // Don't try to jump if in the air or crouching. + if (IsJumping() || IsCrouching() || IsUsingLadder()) + return false; + + float dz = ground - GetFeet().z; + + if (dz > StepHeight && !onlyJumpDown) + { + Jump(); + return true; + } + else if (dz < -JumpHeight) + { + Jump(); + return true; + } + + return false; } /* <470d5b> ../cstrike/dlls/hostage/hostage_improv.cpp:116 */ -NOBODY void CHostageImprov::__MAKE_VHOOK(LookAt)(const Vector &target) +void CHostageImprov::__MAKE_VHOOK(LookAt)(const Vector &target) { + m_isLookingAt = true; + m_viewGoal = target; } /* <470d97> ../cstrike/dlls/hostage/hostage_improv.cpp:126 */ -NOBODY void CHostageImprov::__MAKE_VHOOK(ClearLookAt)(void) +void CHostageImprov::__MAKE_VHOOK(ClearLookAt)(void) { + m_isLookingAt = false; } /* <470dbf> ../cstrike/dlls/hostage/hostage_improv.cpp:135 */ -NOBODY void CHostageImprov::__MAKE_VHOOK(FaceTo)(const Vector &goal) +void CHostageImprov::__MAKE_VHOOK(FaceTo)(const Vector &goal) { + m_isFacingTo = true; + m_faceGoal = goal; } /* <470dfb> ../cstrike/dlls/hostage/hostage_improv.cpp:145 */ -NOBODY void CHostageImprov::__MAKE_VHOOK(ClearFaceTo)(void) +void CHostageImprov::__MAKE_VHOOK(ClearFaceTo)(void) { + m_isFacingTo = false; } /* <476a30> ../cstrike/dlls/hostage/hostage_improv.cpp:154 */ -NOBODY void CHostageImprov::MoveTowards(const Vector &pos, float deltaT) -{ -// { -// Vector move; // 228 -// float accelRate; // 236 -// float const crouchWalkRate; // 237 -// { -// float ground; // 180 -// Vector aheadRay; // 181 -// bool jumped; // 186 -// NormalizeInPlace(Vector *const this); // 182 -// { -// float const farLookAheadRange; // 189 -// Vector normal; // 190 -// Vector stepAhead; // 191 -// operator*(float fl, -// const Vector &v); // 191 -// operator+(const Vector *const this, -// const Vector &v); // 191 -// } -// { -// float const lookAheadRange; // 204 -// Vector stepAhead; // 205 -// operator*(float fl, -// const Vector &v); // 205 -// operator+(const Vector *const this, -// const Vector &v); // 205 -// } -// { -// float const lookAheadRange; // 216 -// Vector stepAhead; // 217 -// operator*(float fl, -// const Vector &v); // 217 -// operator+(const Vector *const this, -// const Vector &v); // 217 -// } -// } -// operator-(const Vector *const this, -// const Vector &v); // 228 -// IsZero(Vector *const this, -// float tolerance); // 231 -// NormalizeInPlace(Vector *const this); // 232 -// } +void CHostageImprov::MoveTowards(const Vector &pos, float deltaT) +{ + Vector move; + float_precision accelRate; + const float crouchWalkRate = 250.0f; + + // + // Jump up on ledges + // Because we may not be able to get to our goal position and enter the next + // area because our extent collides with a nearby vertical ledge, make sure + // we look far enough ahead to avoid this situation. + // Can't look too far ahead, or bots will try to jump up slopes. + // + // NOTE: We need to do this frequently to catch edges at the right time + // @todo Look ahead *along path* instead of straight line + // + + ClearPath(); + + if ((m_lastKnownArea == NULL || !(m_lastKnownArea->GetAttributes() & 8)) && !IsUsingLadder() && !IsJumping() && IsOnGround() && !IsCrouching()) + { + float ground; + Vector aheadRay(pos.x - GetFeet().x, pos.y - GetFeet().y, 0); + aheadRay.NormalizeInPlace(); + + bool jumped = false; + if (IsRunning()) + { + const float farLookAheadRange = 80.0f; + Vector normal; + Vector stepAhead = GetFeet() + farLookAheadRange * aheadRay; + stepAhead.z += HumanHeight; + + if (GetSimpleGroundHeightWithFloor(&stepAhead, &ground, &normal )) + { + if (normal.z > 0.9f) + jumped = DiscontinuityJump(ground, HOSTAGE_ONLY_JUMP_DOWN); + } + } + + if (!jumped) + { + // close up jumping + // cant be less or will miss jumps over low walls + const float lookAheadRange = 30.0f; + Vector stepAhead = GetFeet() + lookAheadRange * aheadRay; + stepAhead.z += HumanHeight; + + if (GetSimpleGroundHeightWithFloor(&stepAhead, &ground)) + { + jumped = DiscontinuityJump(ground); + } + } + + if (!jumped) + { + // about to fall gap-jumping + const float lookAheadRange = 10.0f; + Vector stepAhead = GetFeet() + lookAheadRange * aheadRay; + stepAhead.z += HumanHeight; + + if (GetSimpleGroundHeightWithFloor(&stepAhead, &ground)) + { + jumped = DiscontinuityJump(ground, HOSTAGE_ONLY_JUMP_DOWN, HOSTAGE_MUST_JUMP); + } + } + } + + move = (pos - GetFeet()); + move.z = 0; + + if (!move.IsZero()) + { + move.NormalizeInPlace(); + } + + switch (m_moveType) + { + case Stopped: + accelRate = 0; + break; + case Walking: + if (IsCrouching()) + accelRate = crouchWalkRate; + else + accelRate = 400; + break; + case Running: + if (IsCrouching()) + accelRate = crouchWalkRate; + else + accelRate = 1000; + break; + } + + m_vel.x = move.x * accelRate * deltaT + m_vel.x; + m_vel.y = move.y * accelRate * deltaT + m_vel.y; } +void (*pCHostageImprov__FaceTowards)(); + /* <473e46> ../cstrike/dlls/hostage/hostage_improv.cpp:262 */ -NOBODY bool CHostageImprov::FaceTowards(const Vector &target, float deltaT) +NOBODY bool __declspec(naked) CHostageImprov::FaceTowards(const Vector &target, float deltaT) { + __asm + { + jmp pCHostageImprov__FaceTowards + } + // { // class Vector2D to; // 264 // float moveAngle; // 267 @@ -326,8 +391,15 @@ NOBODY void CHostageImprov::__MAKE_VHOOK(Walk)(void) } /* <470f23> ../cstrike/dlls/hostage/hostage_improv.cpp:644 */ -NOBODY void CHostageImprov::__MAKE_VHOOK(Stop)(void) +void CHostageImprov::__MAKE_VHOOK(Stop)(void) { + MoveTo(GetFeet()); + m_hostage->pev->velocity = Vector(0, 0, 0); + + if (m_moveLimit > Stopped) + m_moveType = Stopped; + else + m_moveType = m_moveLimit; } /* <470f4c> ../cstrike/dlls/hostage/hostage_improv.cpp:655 */ @@ -337,15 +409,17 @@ const Vector &CHostageImprov::__MAKE_VHOOK(GetFeet)(void) const } /* <470f74> ../cstrike/dlls/hostage/hostage_improv.cpp:661 */ -NOBODY const Vector &CHostageImprov::__MAKE_VHOOK(GetCentroid)(void) +const Vector &CHostageImprov::__MAKE_VHOOK(GetCentroid)(void) const { m_centroid = m_hostage->pev->origin + Vector(0, 0, 36); return m_centroid; } /* <470f9c> ../cstrike/dlls/hostage/hostage_improv.cpp:671 */ -NOBODY const Vector &CHostageImprov::__MAKE_VHOOK(GetEyes)(void) const +const Vector &CHostageImprov::__MAKE_VHOOK(GetEyes)(void) const { + m_eye = m_hostage->pev->origin + Vector(0, 0, 72) - Vector(0, 0, 7); + return m_eye; } /* <470fc4> ../cstrike/dlls/hostage/hostage_improv.cpp:681 */ @@ -364,14 +438,13 @@ NOBODY bool CHostageImprov::__MAKE_VHOOK(IsMoving)(void) const } /* <4715d1> ../cstrike/dlls/hostage/hostage_improv.cpp:697 */ -NOBODY bool CHostageImprov::__MAKE_VHOOK(IsVisible)(const Vector &pos, bool testFOV) const +bool CHostageImprov::__MAKE_VHOOK(IsVisible)(const Vector &pos, bool testFOV) const { -// { -// class Vectorconst eye; // 707 -// TraceResult result; // 715 -// Vector(Vector *const this, -// const Vector &v); // 707 -// } + const Vector eye = GetEyes(); + TraceResult result; + + UTIL_TraceLine(eye, pos, ignore_monsters, ignore_glass, m_hostage->edict(), &result); + return result.flFraction == 1.0f; } /* <472938> ../cstrike/dlls/hostage/hostage_improv.cpp:728 */ @@ -505,30 +578,61 @@ NOBODY void CHostageImprov::__MAKE_VHOOK(TrackPath)(const Vector &pathGoal, floa } /* <474781> ../cstrike/dlls/hostage/hostage_improv.cpp:1014 */ -NOBODY void CHostageImprov::SetKnownGoodPosition(const Vector &pos) +void CHostageImprov::SetKnownGoodPosition(const Vector &pos) { -// SetKnownGoodPosition(CHostageImprov *const this, -// const Vector &pos); // 1014 + if (IsJumping() || IsCrouching()) + return; + + if (m_hasKnownGoodPos) + { + if (m_priorKnownGoodPosTimer.IsElapsed()) + { + m_hasPriorKnownGoodPos = true; + m_priorKnownGoodPos = m_knownGoodPos; + m_priorKnownGoodPosTimer.Start(1); + } + } + + m_hasKnownGoodPos = true; + m_knownGoodPos = pos; } /* <47486d> ../cstrike/dlls/hostage/hostage_improv.cpp:1038 */ -NOBODY void CHostageImprov::ResetToKnownGoodPosition(void) +void CHostageImprov::ResetToKnownGoodPosition(void) { -// { -// float const tolerance; // 1044 -// operator-(const Vector *const this, -// const Vector &v); // 1045 -// IsLengthLessThan(const Vector *const this, -// float length); // 1045 -// Start(CountdownTimer *const this, -// float duration); // 1055 -// } -// Invalidate(CNavPath *const this); // 1073 + const float tolerance = 10.0f; + + if (m_hasKnownGoodPos) + { + if ((m_hostage->pev->origin - m_knownGoodPos).IsLengthLessThan(tolerance)) + { + if (m_hasPriorKnownGoodPos) + { + m_hasPriorKnownGoodPos = false; + m_knownGoodPos = m_priorKnownGoodPos; + m_priorKnownGoodPosTimer.Start(5); + } + else + { + m_hasKnownGoodPos = false; + m_knownGoodPos = m_hostage->m_vStart; + } + } + } + else + m_knownGoodPos = m_hostage->m_vStart; + + m_hostage->pev->origin = m_knownGoodPos; + m_hostage->pev->velocity = Vector(0, 0, 0); + m_path.Invalidate(); + + Stop(); } /* <47105c> ../cstrike/dlls/hostage/hostage_improv.cpp:1082 */ -NOBODY void CHostageImprov::__MAKE_VHOOK(StartLadder)(const class CNavLadder *ladder, NavTraverseType how, const Vector *approachPos, const Vector *departPos) +void CHostageImprov::__MAKE_VHOOK(StartLadder)(const class CNavLadder *ladder, NavTraverseType how, const Vector *approachPos, const Vector *departPos) { + m_traversingLadder = true; } /* <4710c4> ../cstrike/dlls/hostage/hostage_improv.cpp:1094 */ @@ -587,54 +691,54 @@ NOBODY bool CHostageImprov::__MAKE_VHOOK(TraverseLadder)(const CNavLadder *ladde /* <477691> ../cstrike/dlls/hostage/hostage_improv.cpp:1214 */ NOBODY void CHostageImprov::UpdatePosition(float deltaT) { -// { -// class CNavArea *area; // 1217 -// float const friction; // 1344 -// float speed; // 1349 -// float const maxSpeed; // 1351 -// class KeepPersonalSpace spacer; // 1365 -// { -// float const pushSpeed; // 1258 -// Vector dir; // 1260 -// operator-(const Vector *const this, -// const Vector &v); // 1260 -// NormalizeInPlace(Vector *const this); // 1262 -// ResetJump(CHostageImprov *const this); // 1247 -// } -// { -// Vector angles; // 1282 -// float yaw; // 1284 -// float pitch; // 1288 -// operator-(const Vector *const this, -// const Vector &v); // 1282 -// } -// { -// class HostagePathCost pathCost; // 1322 -// Compute(CNavPath *const this, -// const Vector *start, -// const Vector *goal, -// class HostagePathCost &costFunc); // 1323 -// SetPath(CNavPathFollower *const this, -// class CNavPath *path); // 1326 -// SetImprov(CNavPathFollower *const this, -// class CImprov *improv); // 1325 -// Debug(CNavPathFollower *const this, -// bool status); // 1328 -// } -// IsElapsed(const class CountdownTimer *const this); // 1333 -// ResetStuck(CNavPathFollower *const this); // 1336 -// NormalizeInPlace(Vector2D *const this); // 1349 -// operator*(float fl, -// const class Vector2D &v); // 1355 -// KeepPersonalSpace(KeepPersonalSpace *const this, -// class CHostageImprov *improv); // 1365 -// ForEachPlayer(KeepPersonalSpace &func); // 1366 -// DrawAxes(Vector &origin, -// int red, -// int green, -// int blue); // 1223 -// ForEachHostage(const class CHostageManager *const this, -// class KeepPersonalSpace &func); // 1369 +// { +// class CNavArea *area; // 1217 +// float const friction; // 1344 +// float speed; // 1349 +// float const maxSpeed; // 1351 +// class KeepPersonalSpace spacer; // 1365 +// { +// float const pushSpeed; // 1258 +// Vector dir; // 1260 +// operator-(const Vector *const this, +// const Vector &v); // 1260 +// NormalizeInPlace(Vector *const this); // 1262 +// ResetJump(CHostageImprov *const this); // 1247 +// } +// { +// Vector angles; // 1282 +// float yaw; // 1284 +// float pitch; // 1288 +// operator-(const Vector *const this, +// const Vector &v); // 1282 +// } +// { +// class HostagePathCost pathCost; // 1322 +// Compute(CNavPath *const this, +// const Vector *start, +// const Vector *goal, +// class HostagePathCost &costFunc); // 1323 +// SetPath(CNavPathFollower *const this, +// class CNavPath *path); // 1326 +// SetImprov(CNavPathFollower *const this, +// class CImprov *improv); // 1325 +// Debug(CNavPathFollower *const this, +// bool status); // 1328 +// } +// IsElapsed(const class CountdownTimer *const this); // 1333 +// ResetStuck(CNavPathFollower *const this); // 1336 +// NormalizeInPlace(Vector2D *const this); // 1349 +// operator*(float fl, +// const class Vector2D &v); // 1355 +// KeepPersonalSpace(KeepPersonalSpace *const this, +// class CHostageImprov *improv); // 1365 +// ForEachPlayer(KeepPersonalSpace &func); // 1366 +// DrawAxes(Vector &origin, +// int red, +// int green, +// int blue); // 1223 +// ForEachHostage(const class CHostageManager *const this, +// class KeepPersonalSpace &func); // 1369 // } } @@ -644,27 +748,38 @@ NOBODY void CHostageImprov::__MAKE_VHOOK(OnUpkeep)(float deltaT) } /* <4749f9> ../cstrike/dlls/hostage/hostage_improv.cpp:1396 */ -NOBODY bool CHostageImprov::IsTerroristNearby(void) +bool CHostageImprov::IsTerroristNearby(void) { -// IsElapsed(const class CountdownTimer *const this); // 1399 -// CheckForNearbyTerrorists(CHostageImprov *const this); // 1403 + if (m_nearbyTerroristTimer.IsElapsed()) + { + CheckForNearbyTerrorists(); + return m_isTerroristNearby; + } + + return true; } /* <474ae7> ../cstrike/dlls/hostage/hostage_improv.cpp:1412 */ -NOBODY void CHostageImprov::CheckForNearbyTerrorists(void) +void CHostageImprov::CheckForNearbyTerrorists(void) { -// { -// float const checkInterval; // 1418 -// float range; // 1423 -// IsElapsed(const class CountdownTimer *const this); // 1414 -// Start(CountdownTimer *const this, -// float duration); // 1419 -// { -// float const nearbyTerroristRange; // 1427 -// Start(CountdownTimer *const this, -// float duration); // 1431 -// } -// } + const float checkInterval = 2.0f; + float range; + + if (!m_checkNearbyTerroristTimer.IsElapsed()) + return; + + m_checkNearbyTerroristTimer.Start(checkInterval); + m_isTerroristNearby = false; + + if (GetClosestPlayerByTravelDistance(TERRORIST, &range)) + { + const float nearbyTerroristRange = 2000.0f; + if (range < nearbyTerroristRange) + { + m_isTerroristNearby = true; + m_nearbyTerroristTimer.Start(10); + } + } } /* <4753ba> ../cstrike/dlls/hostage/hostage_improv.cpp:1440 */ @@ -710,412 +825,651 @@ NOBODY void CHostageImprov::__MAKE_VHOOK(OnUpdate)(float deltaT) } /* <47552a> ../cstrike/dlls/hostage/hostage_improv.cpp:1705 */ -NOBODY void CHostageImprov::__MAKE_VHOOK(OnGameEvent)(GameEventType event, CBaseEntity *entity, CBaseEntity *other) +void CHostageImprov::__MAKE_VHOOK(OnGameEvent)(GameEventType event, CBaseEntity *entity, CBaseEntity *other) { -// DelayedChatter(CHostageImprov *const this, -// float delayTime, -// enum HostageChatterType sayType, -// bool mustSpeak); // 1780 -// { -// Vector *impactPos; // 1713 -// float const nearRange; // 1715 -// operator-(const Vector *const this, -// const Vector &v); // 1716 -// IsLengthLessThan(const Vector *const this, -// float length); // 1716 -// } -// DelayedChatter(CHostageImprov *const this, -// float delayTime, -// enum HostageChatterType sayType, -// bool mustSpeak); // 1736 -// OnInjury(HostageIdleState *const this, -// float amount); // 1742 -// Invalidate(CountdownTimer *const this); // 1764 -// DelayedChatter(CHostageImprov *const this, -// float delayTime, -// enum HostageChatterType sayType, -// bool mustSpeak); // 1769 -// { -// float range; // 1788 -// enum PriorityType priority; // 1789 -// bool isHostile; // 1790 -// { -// float const fudge; // 1793 -// operator-(const Vector *const this, -// const Vector &v); // 1795 -// IsLengthLessThan(const Vector *const this, -// float length); // 1795 -// Start(IntervalTimer *const this); // 1798 -// DelayedChatter(CHostageImprov *const this, -// float delayTime, -// enum HostageChatterType sayType, -// bool mustSpeak); // 1810 -// DelayedChatter(CHostageImprov *const this, -// float delayTime, -// enum HostageChatterType sayType, -// bool mustSpeak); // 1822 -// } -// } -// { -// Vector *impactPos; // 1835 -// float const flashRange; // 1837 -// operator-(const Vector *const this, -// const Vector &v); // 1838 -// IsLengthLessThan(const Vector *const this, -// float length); // 1838 -// DelayedChatter(CHostageImprov *const this, -// float delayTime, -// enum HostageChatterType sayType, -// bool mustSpeak); // 1843 -// } + switch (event) + { + case EVENT_BULLET_IMPACT: + { + Vector *impactPos = (Vector *)other; + const float nearRange = 100.0f; + + if ((GetCentroid() - *impactPos).IsLengthLessThan(nearRange)) + { + Frighten(TERRIFIED); + } + break; + } + case EVENT_PLAYER_DIED: + case EVENT_HOSTAGE_KILLED: + if (IsVisible(entity->pev->origin, true)) + { + Frighten(TERRIFIED); + + if (!entity->IsPlayer() || entity->IsPlayer() && ((CBasePlayer *)entity)->m_iTeam != TERRORIST) + { + DelayedChatter(RANDOM_FLOAT(0.5, 0.7), HOSTAGE_CHATTER_SCARED_OF_MURDER, true); + } + if (!entity->IsPlayer()) + { + m_idleState.OnInjury(0); + } + } + break; + case EVENT_HOSTAGE_RESCUED: + if (m_hostage == other) + { + if (!entity) + return; + + Chatter(HOSTAGE_CHATTER_RESCUED); + } + break; + case EVENT_TERRORISTS_WIN: + Frighten(SCARED); + m_isDelayedChatterPending = false; + DelayedChatter(RANDOM_FLOAT(1.0, 4.0), HOSTAGE_CHATTER_TERRORISTS_WIN); + return; + case EVENT_CTS_WIN: + m_scaredTimer.Invalidate(); + m_isDelayedChatterPending = false; + DelayedChatter(RANDOM_FLOAT(1.0, 4.0), HOSTAGE_CHATTER_CTS_WIN); + return; + default: + break; + } + + float range; + PriorityType priority; + bool isHostile; + + if (entity != NULL && IsGameEventAudible(event, entity, other, &range, &priority, &isHostile)) + { + const float fudge = 0.4f; + + if ((m_hostage->pev->origin - entity->pev->origin).IsLengthLessThan(range * fudge)) + { + m_lastNoiseTimer.Start(); + + if (isHostile) + { + Frighten(SCARED); + + switch (event) + { + case EVENT_WEAPON_FIRED: + { + DelayedChatter(RANDOM_FLOAT(0.3, 1.0), HOSTAGE_CHATTER_SCARED_OF_GUNFIRE); + break; + } + case EVENT_HE_GRENADE_EXPLODED: + case EVENT_SMOKE_GRENADE_EXPLODED: + case EVENT_BREAK_GLASS: + case EVENT_BREAK_WOOD: + case EVENT_BREAK_METAL: + case EVENT_BREAK_FLESH: + case EVENT_BREAK_CONCRETE: + DelayedChatter(RANDOM_FLOAT(0.3, 1.0), HOSTAGE_CHATTER_LOOK_OUT); + break; + + default: + break; + } + } + } + } + + if (event == EVENT_FLASHBANG_GRENADE_EXPLODED) + { + Vector *impactPos = (Vector *)other; + const float flashRange = 1000.0f; + + if ((GetEyes() - *impactPos).IsLengthLessThan(flashRange) && IsVisible(*impactPos)) + { + DelayedChatter(RANDOM_FLOAT(0.0, 1.0), HOSTAGE_CHATTER_BLINDED, true); + Frighten(TERRIFIED); + } + } } /* <471e27> ../cstrike/dlls/hostage/hostage_improv.cpp:1854 */ -NOBODY void CHostageImprov::__MAKE_VHOOK(OnTouch)(CBaseEntity *other) -{ -// { -// const char *classname; // 1856 -// class Vector2D to; // 1994 -// float const pushForce; // 1997 -// Start(IntervalTimer *const this); // 1862 -// FStrEq(const char *sz1, -// const char *sz2); // 1864 -// { -// float const lookAheadRange; // 1866 -// float ground; // 1870 -// Vector normal; // 1871 -// Vector alongFloor; // 1881 -// TraceResult result; // 1885 -// bool isStep; // 1886 -// Vector(Vector *const this, -// float X, -// float Y, -// float Z); // 1871 -// { -// float offset; // 1887 -// { -// Vector pos; // 1889 -// Vector(Vector *const this, -// const Vector &v); // 1889 -// operator*(float fl, -// const Vector &v); // 1892 -// operator+(const Vector *const this, -// const Vector &v); // 1892 -// } -// } -// CrossProduct(Vector &a, -// const Vector &b); // 1881 -// { -// bool isSeam; // 1942 -// float const checkSeamRange; // 1943 -// Vector posBehind; // 1946 -// operator*(float fl, -// const Vector &v); // 1946 -// operator-(const Vector *const this, -// const Vector &v); // 1946 -// operator+(const Vector *const this, -// const Vector &v); // 1947 -// DotProduct(Vector &a, -// const Vector &b); // 1949 -// { -// Vector posAhead; // 1956 -// operator+(const Vector *const this, -// const Vector &v); // 1956 -// operator+(const Vector *const this, -// const Vector &v); // 1957 -// DotProduct(Vector &a, -// const Vector &b); // 1959 -// } -// { -// float const nudge; // 1971 -// } -// } -// operator*(float fl, -// const Vector &v); // 1878 -// Vector(Vector *const this, -// const Vector &v); // 1878 -// operator+(const Vector *const this, -// const Vector &v); // 1878 -// { -// float stepAheadGround; // 1909 -// Vector stepAheadNormal; // 1910 -// Start(CountdownTimer *const this, -// float duration); // 1907 -// { -// float range; // 1912 -// { -// Vector stepAhead; // 1914 -// { -// float dz; // 1927 -// } -// operator+(const Vector *const this, -// const Vector &v); // 1914 -// operator*(float fl, -// const Vector &v); // 1914 -// } -// } -// } -// } -// FStrEq(const char *sz1, -// const char *sz2); // 1983 -// operator-(const Vector *const this, -// const Vector &v); // 1994 -// NormalizeInPlace(Vector2D *const this); // 1995 -// FClassnameIs(entvars_t *pev, -// const char *szClassname); // 1990 -// } +void CHostageImprov::__MAKE_VHOOK(OnTouch)(CBaseEntity *other) +{ + const char *classname; + Vector2D to; + const float pushForce = 20.0f; + + classname = STRING(other->pev->classname); + + if (cv_hostage_debug.value != 0.0) + { + CONSOLE_ECHO("%5.1f: Hostage hit '%s'\n", gpGlobals->time, classname); + } + + m_collisionTimer.Start(); + + if (FStrEq(classname, "worldspawn")) + { + const float lookAheadRange = 30.0f; + float ground; + Vector normal = Vector(0, 0, 1); + Vector alongFloor; + TraceResult result; + bool isStep = false; + + UTIL_MakeVectors(m_hostage->pev->angles); + + if (!GetSimpleGroundHeightWithFloor(&GetEyes(), &ground, &normal)) + return; + + if (cv_hostage_debug.value < 0.0) + { + UTIL_DrawBeamPoints(GetFeet() + normal * 50, GetFeet(), 2, 255, 255, 0); + } + + alongFloor = CrossProduct(normal, gpGlobals->v_right); + + Vector pos = alongFloor * lookAheadRange; + + for (float offset = 1.0f; offset <= 18.0f; offset += 3.0f) + { + Vector vecStart = GetFeet(); + vecStart.z += offset; + + UTIL_TraceLine(vecStart, vecStart + pos, ignore_monsters, dont_ignore_glass, m_hostage->pev->pContainingEntity, &result); + + if (result.flFraction < 1.0f && result.vecPlaneNormal[2] < 0.7f) + { + isStep = true; + break; + } + } + + if (isStep) + { + float stepAheadGround = pos.z; + Vector stepAheadNormal = Vector(0, 0, stepAheadGround); + + m_inhibitObstacleAvoidance.Start(0.5); + + for (float range = 1.0f; range <= 30.5f; range += 5.0f) + { + Vector stepAhead = GetFeet() + alongFloor * range; + + if (GetSimpleGroundHeightWithFloor(&stepAhead, &stepAheadGround, &stepAheadNormal)) + { + float dz = stepAheadGround - GetFeet().z; + + if (dz > 0.0f && dz < 18.0f) + { + m_hostage->pev->origin.z = stepAheadGround + 3.0f; + break; + } + } + } + } + else if (!IsMoving() && !IsUsingLadder()) + { + bool isSeam = false; + const float checkSeamRange = 50.0f; + Vector posBehind; + + posBehind = GetEyes() - alongFloor * checkSeamRange; + UTIL_TraceLine(posBehind, posBehind - Vector(0, 0, 9999), ignore_monsters, dont_ignore_glass, m_hostage->pev->pContainingEntity, &result); + + if (result.flFraction < 1.0f && DotProduct(result.vecPlaneNormal, normal) < 1.0f) + { + isSeam = true; + } + else + { + Vector posAhead = GetEyes() + alongFloor * checkSeamRange; + UTIL_TraceLine(posAhead, posAhead - Vector(0, 0, 9999), ignore_monsters, dont_ignore_glass, m_hostage->pev->pContainingEntity, &result); + + if (result.flFraction < 1.0f && DotProduct(result.vecPlaneNormal, normal) < 1.0f) + isSeam = true; + } + + if (isSeam) + { + if (cv_hostage_debug.value != 0.0) + { + CONSOLE_ECHO("Hostage stuck on seam.\n"); + } + + const float nudge = 3.0f; + m_hostage->pev->origin.z += nudge; + } + } + } + else if (FStrEq(classname, "func_breakable")) + { + other->TakeDamage(m_hostage->pev, m_hostage->pev, 9999.9, DMG_BULLET); + } + else if (other->IsPlayer() || FClassnameIs(other->pev, "hostage_entity")) + { + to = (m_hostage->pev->origin - other->pev->origin).Make2D(); + to.NormalizeInPlace(); + + m_vel.x += to.x * pushForce; + m_vel.y += to.y * pushForce; + } } /* <474ba8> ../cstrike/dlls/hostage/hostage_improv.cpp:2006 */ -NOBODY void CHostageImprov::ApplyForce(Vector force) +void CHostageImprov::ApplyForce(Vector force) { + m_vel.x += force.x; + m_vel.y += force.y; } /* <474bd5> ../cstrike/dlls/hostage/hostage_improv.cpp:2016 */ -NOBODY bool CHostageImprov::IsAtHome(void) +bool CHostageImprov::IsAtHome(void) { -// IsAtHome(const class CHostage *const this); // 2018 + return m_hostage->IsAtHome(); } /* <474c76> ../cstrike/dlls/hostage/hostage_improv.cpp:2025 */ -NOBODY bool CHostageImprov::CanSeeRescueZone(void) +bool CHostageImprov::CanSeeRescueZone(void) { -// { -// class CCSBotManager *ctrl; // 2027 -// const class Zone *zone; // 2031 -// } + CCSBotManager *ctrl = TheCSBots(); + + if (ctrl == NULL) + return false; + + const CCSBotManager::Zone *zone = ctrl->GetClosestZone(&GetCentroid()); + + if (zone != NULL) + return IsVisible(zone->m_center); + + return false; } /* <474cd3> ../cstrike/dlls/hostage/hostage_improv.cpp:2047 */ -NOBODY CBasePlayer *CHostageImprov::GetClosestVisiblePlayer(int team) +CBasePlayer *CHostageImprov::GetClosestVisiblePlayer(int team) { -// { -// class CBasePlayer *close; // 2049 -// float closeRangeSq; // 2050 -// { -// int i; // 2052 -// { -// class CBasePlayer *player; // 2054 -// float rangeSq; // 2064 -// operator-(const Vector *const this, -// const Vector &v); // 2064 -// LengthSquared(const Vector *const this); // 2064 -// } -// } -// } + CBasePlayer *close = NULL; + float closeRangeSq = 1e8f; + + for (int i = 0; i < m_visiblePlayerCount; i++) + { + CBasePlayer *player = (CBasePlayer *)((CBaseEntity *)m_visiblePlayer[i]); + + if (player == NULL || (team > 0 && player->m_iTeam != team)) + continue; + + float_precision rangeSq = (GetCentroid() - player->pev->origin).LengthSquared(); + + if (rangeSq < closeRangeSq) + { + closeRangeSq = rangeSq; + close = player; + } + } + + return close; } /* <474db2> ../cstrike/dlls/hostage/hostage_improv.cpp:2080 */ -NOBODY float CHostageImprov::GetTimeSinceLastSawPlayer(int team) +float CHostageImprov::GetTimeSinceLastSawPlayer(int team) { -// { -// float timeCT; // 2088 -// float timeT; // 2089 -// GetElapsedTime(const class IntervalTimer *const this); // 2086 -// GetElapsedTime(const class IntervalTimer *const this); // 2088 -// GetElapsedTime(const class IntervalTimer *const this); // 2089 -// GetElapsedTime(const class IntervalTimer *const this); // 2083 -// } + float timeCT = m_lastSawCT.GetElapsedTime(); + float timeT = m_lastSawT.GetElapsedTime(); + + switch (team) + { + case TERRORIST: + return timeT; + case CT: + return timeCT; + default: + return (timeCT < timeT) ? timeCT : timeT; + } } /* <474f2c> ../cstrike/dlls/hostage/hostage_improv.cpp:2098 */ -NOBODY float CHostageImprov::GetTimeSinceLastInjury(void) +float CHostageImprov::GetTimeSinceLastInjury(void) { -// GetElapsedTime(const class IntervalTimer *const this); // 2100 + return m_lastInjuryTimer.GetElapsedTime(); } /* <474fb3> ../cstrike/dlls/hostage/hostage_improv.cpp:2107 */ -NOBODY float CHostageImprov::GetTimeSinceLastNoise(void) +float CHostageImprov::GetTimeSinceLastNoise(void) { -// GetElapsedTime(const class IntervalTimer *const this); // 2109 + return m_lastNoiseTimer.GetElapsedTime(); } /* <47503a> ../cstrike/dlls/hostage/hostage_improv.cpp:2117 */ -NOBODY bool CHostageImprov::IsScared(void) +bool CHostageImprov::IsScared(void) { -// IsElapsed(const class CountdownTimer *const this); // 2119 + if (m_scaredTimer.IsElapsed()) + { + return m_animateState.GetPerformance() == HostageAnimateState::Afraid; + } + + return true; } /* <47506e> ../cstrike/dlls/hostage/hostage_improv.cpp:2129 */ -NOBODY void CHostageImprov::Frighten(ScareType scare) +void CHostageImprov::Frighten(ScareType scare) { -// IsScared(const class CHostageImprov *const this); // 2132 -// Invalidate(CountdownTimer *const this); // 2137 -// Start(CountdownTimer *const this, -// float duration); // 2145 -// { -// float const ignoreTime; // 2152 -// Start(CountdownTimer *const this, -// float duration); // 2149 -// Start(CountdownTimer *const this, -// float duration); // 2153 -// } + const float ignoreTime = 10.0f; + + if (!IsScared()) + { + m_animateState.Reset(); + m_blinkTimer.Invalidate(); + } + + m_scareIntensity = scare; + + switch (scare) + { + case NERVOUS: + m_scaredTimer.Start(RANDOM_FLOAT(2, 4)); + break; + case SCARED: + m_scaredTimer.Start(RANDOM_FLOAT(3, 8)); + break; + case TERRIFIED: + m_scaredTimer.Start(RANDOM_FLOAT(5, 10)); + m_ignoreTerroristTimer.Start(ignoreTime); + break; + } } /* <475200> ../cstrike/dlls/hostage/hostage_improv.cpp:2165 */ -NOBODY void CHostageImprov::Afraid(void) +void CHostageImprov::Afraid(void) { -// { -// int which; // 2185 -// char animInto; // 2186 -// char animLoop; // 2186 -// char animExit; // 2186 -// SetPerformance(HostageAnimateState *const this, -// enum PerformanceType performance); // 2182 -// } + char animInto[32]; + char animLoop[32]; + char animExit[32]; + + if (IsCrouching()) + return; + + if (m_animateState.GetPerformance() == HostageAnimateState::Flinching || + m_animateState.GetPerformance() == HostageAnimateState::Afraid) + return; + + if (!IsMoving()) + { + m_animateState.Reset(); + m_animateState.SetPerformance(HostageAnimateState::Afraid); + + int which = RANDOM_LONG(0, 100) % 3 + 1; + + Q_sprintf(animInto, "cower_into_%d", which); + Q_sprintf(animLoop, "cower_loop_%d", which); + Q_sprintf(animExit, "cower_exit_%d", which); + + m_animateState.AddSequence(this, animInto); + m_animateState.AddSequence(this, animLoop, RANDOM_FLOAT(3, 10)); + m_animateState.AddSequence(this, animExit); + } } /* <475290> ../cstrike/dlls/hostage/hostage_improv.cpp:2201 */ -NOBODY void CHostageImprov::UpdateIdleActivity(Activity activity, Activity fidget) +void CHostageImprov::UpdateIdleActivity(Activity activity, Activity fidget) { + if (m_animateState.IsBusy()) + return; + + m_animateState.Reset(); + + if (m_didFidget || fidget == ACT_RESET) + { + m_animateState.AddSequence(this, activity, RANDOM_FLOAT(1, 10), RANDOM_FLOAT(0.9, 1.1)); + m_didFidget = false; + + } + else + { + m_animateState.AddSequence(this, fidget, -1, RANDOM_FLOAT(0.9, 1.5)); + m_didFidget = true; + + } } /* <4752d9> ../cstrike/dlls/hostage/hostage_improv.cpp:2226 */ -NOBODY void CHostageImprov::Chatter(HostageChatterType sayType, bool mustSpeak) +void CHostageImprov::Chatter(HostageChatterType sayType, bool mustSpeak) { -// { -// float duration; // 2239 -// } -// IsElapsed(const class CountdownTimer *const this); // 2235 -// Chatter(CHostageImprov *const this, -// enum HostageChatterType sayType, -// bool mustSpeak); // 2226 + if (!IsAlive() && sayType != HOSTAGE_CHATTER_DEATH_CRY) + return; + + if (g_pHostages->IsNearbyHostageTalking(this) && !mustSpeak) + return; + + if (m_chatterTimer.IsElapsed() || mustSpeak) + { + m_chatterTimer.Start(RANDOM_FLOAT(5, 15)); + float duration = g_pHostages->GetChatter()->PlaySound(m_hostage, sayType); + m_talkingTimer.Start(duration); + } } /* <475b35> ../cstrike/dlls/hostage/hostage_improv.cpp:2249 */ -NOBODY void CHostageImprov::DelayedChatter(float delayTime, HostageChatterType sayType, bool mustSpeak) +void CHostageImprov::DelayedChatter(float delayTime, HostageChatterType sayType, bool mustSpeak) { -// DelayedChatter(CHostageImprov *const this, -// float delayTime, -// enum HostageChatterType sayType, -// bool mustSpeak); // 2249 + if (!IsAlive()) + return; + + if (!m_isDelayedChatterPending || mustSpeak) + { + m_isDelayedChatterPending = true; + m_delayedChatterTimer.Start(delayTime); + m_delayedChatterType = sayType; + m_delayedChatterMustSpeak = mustSpeak; + } } /* <475bd4> ../cstrike/dlls/hostage/hostage_improv.cpp:2268 */ -NOBODY void CHostageImprov::UpdateDelayedChatter(void) +NOXREF void CHostageImprov::UpdateDelayedChatter(void) { -// IsElapsed(const class CountdownTimer *const this); // 2270 -// Chatter(CHostageImprov *const this, -// enum HostageChatterType sayType, -// bool mustSpeak); // 2299 + if (!m_isDelayedChatterPending) + return; + + if (!m_delayedChatterTimer.IsElapsed()) + return; + + m_isDelayedChatterPending = false; + + switch (m_delayedChatterType) + { + case HOSTAGE_CHATTER_SCARED_OF_GUNFIRE: + if (RANDOM_FLOAT(0, 100) < 25) + { + Chatter(m_delayedChatterType, m_delayedChatterMustSpeak); + } + break; + case HOSTAGE_CHATTER_LOOK_OUT: + case HOSTAGE_CHATTER_PLEASE_RESCUE_ME: + case HOSTAGE_CHATTER_IMPATIENT_FOR_RESCUE: + if (RANDOM_FLOAT(0, 100) < 60) + { + Chatter(m_delayedChatterType, m_delayedChatterMustSpeak); + } + break; + default: + Chatter(m_delayedChatterType, m_delayedChatterMustSpeak); + break; + } } /* <4761eb> ../cstrike/dlls/hostage/hostage_improv.cpp:2307 */ -NOBODY void CHostageImprov::Flinch(Activity activity) +void CHostageImprov::Flinch(Activity activity) { -// Chatter(CHostageImprov *const this, -// enum HostageChatterType sayType, -// bool mustSpeak); // 2310 -// SetPerformance(HostageAnimateState *const this, -// enum PerformanceType performance); // 2321 + Chatter(HOSTAGE_CHATTER_PAIN, true); + + if (!IsCrouching() && !IsMoving()) + { + m_animateState.Reset(); + m_animateState.SetPerformance(HostageAnimateState::Flinching); + m_animateState.AddSequence(this, activity); + } } /* <4762fe> ../cstrike/dlls/hostage/hostage_improv.cpp:2329 */ -NOBODY void CHostageImprov::CrouchDie(void) +void CHostageImprov::CrouchDie(void) { + m_animateState.Reset(); + m_animateState.AddSequence(this, ACT_CROUCH_DIE); } /* <476327> ../cstrike/dlls/hostage/hostage_improv.cpp:2339 */ -NOBODY void CHostageImprov::Agree(void) +void CHostageImprov::Agree(void) { + m_animateState.Reset(); + m_animateState.AddSequence(this, ACT_YES); } /* <476350> ../cstrike/dlls/hostage/hostage_improv.cpp:2349 */ -NOBODY void CHostageImprov::Disagree(void) +void CHostageImprov::Disagree(void) { -// SetPerformance(HostageAnimateState::Disagree(// enum PerformanceType performance); // 2355 + if (m_animateState.GetPerformance() != HostageAnimateState::Disagreeing) + { + m_animateState.Reset(); + m_animateState.AddSequence(this, ACT_NO, -1.0, RANDOM_FLOAT(1.5, 3.0)); + } } /* <476395> ../cstrike/dlls/hostage/hostage_improv.cpp:2363 */ -NOBODY void CHostageImprov::Wave(void) +void CHostageImprov::Wave(void) { -// SetPerformance(HostageAnimateState::Wave(// enum PerformanceType performance); // 2366 + m_animateState.Reset(); + m_animateState.SetPerformance(HostageAnimateState::Waving); + m_animateState.AddSequence(this, ACT_WAVE); } /* <474938> ../cstrike/dlls/hostage/hostage_improv.cpp:2375 */ -NOBODY void CHostageImprov::__MAKE_VHOOK(OnMoveToFailure)(const Vector &goal, MoveToFailureType reason) +void CHostageImprov::__MAKE_VHOOK(OnMoveToFailure)(const Vector &goal, MoveToFailureType reason) { -// OnMoveToFailure(HostageStateMachine *const this, -// const Vector &goal, -// enum MoveToFailureType reason); // 2378 + m_behavior.OnMoveToFailure(goal, reason); + + if (reason == FAIL_STUCK) + { + ResetToKnownGoodPosition(); + } } /* <4763d7> ../cstrike/dlls/hostage/hostage_improv.cpp:2391 */ -NOBODY void CHostageImprov::Wiggle(void) +void CHostageImprov::Wiggle(void) { -// { -// Vector dir; // 2399 -// Vector lat; // 2400 -// float const force; // 2402 -// float const minStuckJumpTime; // 2423 -// IsElapsed(const class CountdownTimer *const this); // 2393 -// GetStuckDuration(const class CNavPathFollower *const this); // 2424 -// operator*(float fl, -// const Vector &v); // 2419 -// ApplyForce(CHostageImprov *const this, -// Vector force); // 2419 -// Start(CountdownTimer *const this, -// float duration); // 2396 -// Start(CountdownTimer *const this, -// float duration); // 2429 -// operator*(float fl, -// const Vector &v); // 2407 -// operator*(float fl, -// const Vector &v); // 2411 -// ApplyForce(CHostageImprov *const this, -// Vector force); // 2411 -// operator*(float fl, -// const Vector &v); // 2415 -// } + Vector dir; + Vector lat; + + const float force = 15.0f; + const float minStuckJumpTime = 0.5f; + + // for wiggling + if (m_wiggleTimer.IsElapsed()) + { + m_wiggleDirection = static_cast(RANDOM_LONG(FORWARD, LEFT)); + m_wiggleTimer.Start(RANDOM_FLOAT(0.3, 0.5)); + } + + lat.x = BotCOS(m_moveAngle); + lat.y = BotSIN(m_moveAngle); + lat.z = 0; + + switch (m_wiggleDirection) + { + case FORWARD: + dir.x = lat.x; + dir.y = lat.y; + + ApplyForce(dir * force); + break; + case RIGHT: + dir.x = -lat.y; + dir.y = lat.x; + + ApplyForce(dir * -force); + break; + case BACKWARD: + dir.x = lat.x; + dir.y = lat.y; + + ApplyForce(dir * -force); + break; + case LEFT: + dir.x = -lat.y; + dir.y = lat.x; + + ApplyForce(dir * force); + break; + default: + break; + } + + if (m_follower.GetStuckDuration() > minStuckJumpTime && m_wiggleJumpTimer.IsElapsed()) + { + if (Jump()) + { + m_wiggleJumpTimer.Start(RANDOM_FLOAT(0.75, 1.2)); + } + } } /* <4766cc> ../cstrike/dlls/hostage/hostage_improv.cpp:2438 */ -NOBODY void CHostageImprov::ClearPath(void) +void CHostageImprov::ClearPath(void) { -// { -// class Vectorconst eye; // 2448 -// Vector start; // 2451 -// Vector end; // 2452 -// TraceResult result; // 2459 -// IsElapsed(const class CountdownTimer *const this); // 2440 -// Start(CountdownTimer *const this, -// float duration); // 2445 -// Vector(Vector *const this, -// const Vector &v); // 2448 -// Vector(Vector *const this, -// const Vector &v); // 2451 -// operator*(const Vector *const this, -// float fl); // 2453 -// operator+(const Vector *const this, -// const Vector &v); // 2454 -// { -// entvars_t *entity; // 2463 -// VARS(edict_t *pent); // 2463 -// FClassnameIs(entvars_t *pev, -// const char *szClassname); // 2467 -// FClassnameIs(entvars_t *pev, -// const char *szClassname); // 2467 -// { -// class CBaseEntity *pObject; // 2469 -// Instance(edict_t *pent); // 2469 -// } -// FClassnameIs(entvars_t *pev, -// const char *szClassname); // 2479 -// { -// class CBaseEntity *pObject; // 2481 -// Instance(edict_t *pent); // 2481 -// } -// } -// } + Vector start; + Vector end; + TraceResult result; + + if (!m_clearPathTimer.IsElapsed()) + return; + + m_clearPathTimer.Start(RANDOM_FLOAT(0.3, 0.5)); + + const Vector eye = GetEyes(); + start = eye; + + UTIL_MakeVectors(m_hostage->pev->angles); + end = gpGlobals->v_forward * 64 + start; + + UTIL_TraceLine(start, end, ignore_monsters, dont_ignore_glass, m_hostage->edict(), &result); + + if (result.flFraction == 1.0f) + return; + + if (result.pHit != NULL) + { + entvars_t *entity = VARS(result.pHit); + + if (FClassnameIs(entity, "func_door") || FClassnameIs(entity, "func_door_rotating")) + { + CBaseEntity *pObject = CBaseEntity::Instance(entity); + + if (pObject != NULL) + { + pObject->Touch(m_hostage); + } + } + else if (FClassnameIs(entity, "func_breakable") && entity->takedamage == DAMAGE_YES) + { + CBaseEntity *pObject = CBaseEntity::Instance(entity); + + if (pObject != NULL) + { + pObject->TakeDamage(m_hostage->pev, m_hostage->pev, 9999.9, DMG_BULLET); + } + } + } } /* <471b3f> ../cstrike/dlls/hostage/hostage_improv.cpp:2497 */ -NOBODY void CHostageImprov::__MAKE_VHOOK(Crouch)(void) +void CHostageImprov::__MAKE_VHOOK(Crouch)(void) { -// { -// float const minCrouchTime; // 2503 -// } -// Crouch(CHostageImprov *const this); // 2497 + const float minCrouchTime = 1.0f; + + if (IsCrouching()) + return; + + m_isCrouching = true; + m_minCrouchTimer.Start(minCrouchTime); + UTIL_SetSize(m_hostage->pev, VEC_HOSTAGE_HULL_MIN, VEC_HOSTAGE_CROUCH); } /* <47195c> ../cstrike/dlls/hostage/hostage_improv.cpp:2516 */ @@ -1148,9 +1502,9 @@ void CHostageImprov::__MAKE_VHOOK(StandUp)(void) } /* <477114> ../cstrike/dlls/hostage/hostage_improv.cpp:2558 */ -NOBODY void CHostageImprov::UpdateStationaryAnimation(void) +void CHostageImprov::UpdateStationaryAnimation(void) { -// UpdateStationaryAnimation(HostageStateMachine::UpdateStationaryAnimation(// class CHostageImprov *improv); // 2560 + m_behavior.UpdateStationaryAnimation(this); } #ifdef HOOK_GAMEDLL @@ -1266,7 +1620,7 @@ const Vector &CHostageImprov::GetFeet(void) const return GetFeet_(); } -const Vector &CHostageImprov::GetCentroid(void) +const Vector &CHostageImprov::GetCentroid(void) const { return GetCentroid_(); } diff --git a/regamedll/dlls/hostage/hostage_improv.h b/regamedll/dlls/hostage/hostage_improv.h index c1963a84..06143ca6 100644 --- a/regamedll/dlls/hostage/hostage_improv.h +++ b/regamedll/dlls/hostage/hostage_improv.h @@ -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 diff --git a/regamedll/dlls/hostage/hostage_localnav.cpp b/regamedll/dlls/hostage/hostage_localnav.cpp index 6edf5786..7a867ea4 100644 --- a/regamedll/dlls/hostage/hostage_localnav.cpp +++ b/regamedll/dlls/hostage/hostage_localnav.cpp @@ -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 *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 */ diff --git a/regamedll/dlls/hostage/hostage_localnav.h b/regamedll/dlls/hostage/hostage_localnav.h index 08f0edd8..78bbc9a8 100644 --- a/regamedll/dlls/hostage/hostage_localnav.h +++ b/regamedll/dlls/hostage/hostage_localnav.h @@ -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; diff --git a/regamedll/dlls/hostage/hostage_states.h b/regamedll/dlls/hostage/hostage_states.h index e7c2cfbc..7471af1f 100644 --- a/regamedll/dlls/hostage/hostage_states.h +++ b/regamedll/dlls/hostage/hostage_states.h @@ -39,7 +39,6 @@ class HostageState: public SimpleState, public IImprovEvent { public: virtual ~HostageState(void) {}; - virtual void UpdateStationaryAnimation(CHostageImprov *improv) {}; };/* size: 12, cachelines: 1, members: 2 */ @@ -50,21 +49,32 @@ class HostageStateMachine: public SimpleStateMachineOnMoveToSuccess(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) diff --git a/regamedll/dlls/hostage/states/hostage_animate.cpp b/regamedll/dlls/hostage/states/hostage_animate.cpp index 40be5f9c..5720625b 100644 --- a/regamedll/dlls/hostage/states/hostage_animate.cpp +++ b/regamedll/dlls/hostage/states/hostage_animate.cpp @@ -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 diff --git a/regamedll/dlls/hostage/states/hostage_idle.cpp b/regamedll/dlls/hostage/states/hostage_idle.cpp index b870dc12..8045324d 100644 --- a/regamedll/dlls/hostage/states/hostage_idle.cpp +++ b/regamedll/dlls/hostage/states/hostage_idle.cpp @@ -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 diff --git a/regamedll/dlls/hostage/states/hostage_retreat.cpp b/regamedll/dlls/hostage/states/hostage_retreat.cpp index 82b87cf5..96cbb7bc 100644 --- a/regamedll/dlls/hostage/states/hostage_retreat.cpp +++ b/regamedll/dlls/hostage/states/hostage_retreat.cpp @@ -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 \ No newline at end of file diff --git a/regamedll/dlls/items.cpp b/regamedll/dlls/items.cpp index 055644c3..7bb54fdd 100644 --- a/regamedll/dlls/items.cpp +++ b/regamedll/dlls/items.cpp @@ -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; } diff --git a/regamedll/dlls/lights.h b/regamedll/dlls/lights.h index c6d30090..a2994b2c 100644 --- a/regamedll/dlls/lights.h +++ b/regamedll/dlls/lights.h @@ -59,7 +59,6 @@ public: static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[2]; private: - int m_iStyle; int m_iszPattern; BOOL m_iStartedOff; diff --git a/regamedll/dlls/maprules.h b/regamedll/dlls/maprules.h index d2dcb8a3..54cbe8a7 100644 --- a/regamedll/dlls/maprules.h +++ b/regamedll/dlls/maprules.h @@ -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 diff --git a/regamedll/dlls/monsters.h b/regamedll/dlls/monsters.h index 18d36109..689892ba 100644 --- a/regamedll/dlls/monsters.h +++ b/regamedll/dlls/monsters.h @@ -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); diff --git a/regamedll/dlls/mortar.h b/regamedll/dlls/mortar.h index 0ef1e770..2111cec6 100644 --- a/regamedll/dlls/mortar.h +++ b/regamedll/dlls/mortar.h @@ -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 diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index c5716202..55ce55bc 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -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); diff --git a/regamedll/dlls/nodes.h b/regamedll/dlls/nodes.h index 03a52ede..61d29d16 100644 --- a/regamedll/dlls/nodes.h +++ b/regamedll/dlls/nodes.h @@ -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; diff --git a/regamedll/dlls/pathcorner.h b/regamedll/dlls/pathcorner.h index acf7b8ba..26bfc926 100644 --- a/regamedll/dlls/pathcorner.h +++ b/regamedll/dlls/pathcorner.h @@ -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 diff --git a/regamedll/dlls/plats.h b/regamedll/dlls/plats.h index b9260b74..5cf1aca5 100644 --- a/regamedll/dlls/plats.h +++ b/regamedll/dlls/plats.h @@ -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 diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 8ce8bcdd..aa559d3a 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -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 */ diff --git a/regamedll/dlls/player.h b/regamedll/dlls/player.h index 3888fd1b..54ee04af 100644 --- a/regamedll/dlls/player.h +++ b/regamedll/dlls/player.h @@ -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); diff --git a/regamedll/dlls/revert_saved.h b/regamedll/dlls/revert_saved.h index 7685fd5a..cc0c10e8 100644 --- a/regamedll/dlls/revert_saved.h +++ b/regamedll/dlls/revert_saved.h @@ -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; } diff --git a/regamedll/dlls/saverestore.h b/regamedll/dlls/saverestore.h index 4c0d79b3..82c0a97d 100644 --- a/regamedll/dlls/saverestore.h +++ b/regamedll/dlls/saverestore.h @@ -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; diff --git a/regamedll/dlls/sound.h b/regamedll/dlls/sound.h index b3f3a49a..5057f122 100644 --- a/regamedll/dlls/sound.h +++ b/regamedll/dlls/sound.h @@ -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 diff --git a/regamedll/dlls/soundent.h b/regamedll/dlls/soundent.h index ba2b38b4..c1107ea2 100644 --- a/regamedll/dlls/soundent.h +++ b/regamedll/dlls/soundent.h @@ -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 diff --git a/regamedll/dlls/spectator.h b/regamedll/dlls/spectator.h index 9f198a6f..eb750df0 100644 --- a/regamedll/dlls/spectator.h +++ b/regamedll/dlls/spectator.h @@ -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 */ diff --git a/regamedll/dlls/subs.h b/regamedll/dlls/subs.h index 958a58e6..fa562b86 100644 --- a/regamedll/dlls/subs.h +++ b/regamedll/dlls/subs.h @@ -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 diff --git a/regamedll/dlls/training_gamerules.cpp b/regamedll/dlls/training_gamerules.cpp index 9f207967..751a1f84 100644 --- a/regamedll/dlls/training_gamerules.cpp +++ b/regamedll/dlls/training_gamerules.cpp @@ -54,7 +54,7 @@ void CHalfLifeTraining::HostageDied(void) { CBasePlayer *pPlayer = reinterpret_cast(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 */ diff --git a/regamedll/dlls/training_gamerules.h b/regamedll/dlls/training_gamerules.h index 995d36ef..37767b19 100644 --- a/regamedll/dlls/training_gamerules.h +++ b/regamedll/dlls/training_gamerules.h @@ -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 diff --git a/regamedll/dlls/trains.h b/regamedll/dlls/trains.h index 2044f7e9..74a6e26f 100644 --- a/regamedll/dlls/trains.h +++ b/regamedll/dlls/trains.h @@ -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 diff --git a/regamedll/dlls/triggers.h b/regamedll/dlls/triggers.h index 77354053..5aaeb0c2 100644 --- a/regamedll/dlls/triggers.h +++ b/regamedll/dlls/triggers.h @@ -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 diff --git a/regamedll/dlls/tutor.cpp b/regamedll/dlls/tutor.cpp index a2bcb8eb..4768167e 100644 --- a/regamedll/dlls/tutor.cpp +++ b/regamedll/dlls/tutor.cpp @@ -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; diff --git a/regamedll/dlls/tutor.h b/regamedll/dlls/tutor.h index baf6944a..e26422b7 100644 --- a/regamedll/dlls/tutor.h +++ b/regamedll/dlls/tutor.h @@ -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; diff --git a/regamedll/dlls/tutor_base_tutor.cpp b/regamedll/dlls/tutor_base_tutor.cpp index 3a76fa8b..51b761ad 100644 --- a/regamedll/dlls/tutor_base_tutor.cpp +++ b/regamedll/dlls/tutor_base_tutor.cpp @@ -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) diff --git a/regamedll/dlls/tutor_cs_states.h b/regamedll/dlls/tutor_cs_states.h index b31044d3..b6de0652 100644 --- a/regamedll/dlls/tutor_cs_states.h +++ b/regamedll/dlls/tutor_cs_states.h @@ -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]; diff --git a/regamedll/dlls/tutor_cs_tutor.h b/regamedll/dlls/tutor_cs_tutor.h index 6f2722d3..d4c474f7 100644 --- a/regamedll/dlls/tutor_cs_tutor.h +++ b/regamedll/dlls/tutor_cs_tutor.h @@ -255,7 +255,6 @@ enum TutorMessageID TUTOR_NUM_MESSAGES }; -//typedef map, std::allocator >, TutorMessage*, std::less, std::allocator > >, std::allocator, std::allocator >, TutorMessage*> > > TutorMessageMap; typedef std::map TutorMessageMap; typedef TutorMessageMap::iterator TutorMessageMapIter; diff --git a/regamedll/dlls/util.cpp b/regamedll/dlls/util.cpp index 7bf1509e..caa2340a 100644 --- a/regamedll/dlls/util.cpp +++ b/regamedll/dlls/util.cpp @@ -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 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; } diff --git a/regamedll/dlls/util.h b/regamedll/dlls/util.h index 2a2de87e..46fd4fda 100644 --- a/regamedll/dlls/util.h +++ b/regamedll/dlls/util.h @@ -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 diff --git a/regamedll/dlls/vector.h b/regamedll/dlls/vector.h index 41aba08d..f517e303 100644 --- a/regamedll/dlls/vector.h +++ b/regamedll/dlls/vector.h @@ -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 diff --git a/regamedll/dlls/vehicle.h b/regamedll/dlls/vehicle.h index 673467f8..068cf107 100644 --- a/regamedll/dlls/vehicle.h +++ b/regamedll/dlls/vehicle.h @@ -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 diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index ac128102..c756b51f 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -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) diff --git a/regamedll/dlls/weapons.h b/regamedll/dlls/weapons.h index 96fd6a5f..9796aeb5 100644 --- a/regamedll/dlls/weapons.h +++ b/regamedll/dlls/weapons.h @@ -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 diff --git a/regamedll/dlls/weapontype.cpp b/regamedll/dlls/weapontype.cpp index ffcf8f27..e060153c 100644 --- a/regamedll/dlls/weapontype.cpp +++ b/regamedll/dlls/weapontype.cpp @@ -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" }, diff --git a/regamedll/dlls/world.h b/regamedll/dlls/world.h index 914196da..43bfc92c 100644 --- a/regamedll/dlls/world.h +++ b/regamedll/dlls/world.h @@ -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; diff --git a/regamedll/dlls/wpn_shared/wpn_c4.cpp b/regamedll/dlls/wpn_shared/wpn_c4.cpp index 98cfd182..765b1c63 100644 --- a/regamedll/dlls/wpn_shared/wpn_c4.cpp +++ b/regamedll/dlls/wpn_shared/wpn_c4.cpp @@ -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); } diff --git a/regamedll/dlls/wpn_shared/wpn_elite.cpp b/regamedll/dlls/wpn_shared/wpn_elite.cpp index 9cd3b598..8daf40ea 100644 --- a/regamedll/dlls/wpn_shared/wpn_elite.cpp +++ b/regamedll/dlls/wpn_shared/wpn_elite.cpp @@ -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) diff --git a/regamedll/dlls/wpn_shared/wpn_hegrenade.cpp b/regamedll/dlls/wpn_shared/wpn_hegrenade.cpp index 501b9b28..9b7f1f2d 100644 --- a/regamedll/dlls/wpn_shared/wpn_hegrenade.cpp +++ b/regamedll/dlls/wpn_shared/wpn_hegrenade.cpp @@ -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 */ diff --git a/regamedll/dlls/wpn_shared/wpn_m4a1.cpp b/regamedll/dlls/wpn_shared/wpn_m4a1.cpp index 0221d7b7..73833b56 100644 --- a/regamedll/dlls/wpn_shared/wpn_m4a1.cpp +++ b/regamedll/dlls/wpn_shared/wpn_m4a1.cpp @@ -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); diff --git a/regamedll/dlls/wpn_shared/wpn_mp5navy.cpp b/regamedll/dlls/wpn_shared/wpn_mp5navy.cpp index 1add5176..2703eacd 100644 --- a/regamedll/dlls/wpn_shared/wpn_mp5navy.cpp +++ b/regamedll/dlls/wpn_shared/wpn_mp5navy.cpp @@ -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; diff --git a/regamedll/game_shared/bot/bot_manager.cpp b/regamedll/game_shared/bot/bot_manager.cpp index e27cb63c..21fd767c 100644 --- a/regamedll/game_shared/bot/bot_manager.cpp +++ b/regamedll/game_shared/bot/bot_manager.cpp @@ -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); } diff --git a/regamedll/game_shared/bot/bot_util.cpp b/regamedll/game_shared/bot/bot_util.cpp index 1a43e39d..8973d4ed 100644 --- a/regamedll/game_shared/bot/bot_util.cpp +++ b/regamedll/game_shared/bot/bot_util.cpp @@ -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(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(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(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(player->m_pActiveItem); - if (pWeapon->m_iWeaponState & WPNSTATE_M4A1_SILENCED) - { - *range = ShortRange; - } - else - { - *range = NormalRange; - } - break; - } - case WEAPON_USP: - { - CBasePlayerWeapon *pWeapon = static_cast(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(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(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; } diff --git a/regamedll/game_shared/bot/bot_util.h b/regamedll/game_shared/bot/bot_util.h index 5f78bb17..c22be29a 100644 --- a/regamedll/game_shared/bot/bot_util.h +++ b/regamedll/game_shared/bot/bot_util.h @@ -45,6 +45,8 @@ enum PriorityType PRIORITY_UNINTERRUPTABLE }; +// Simple class for tracking intervals of game time + /* <504550> ../game_shared/bot/bot_util.h:131 */ class IntervalTimer { @@ -54,37 +56,38 @@ public: m_timestamp = -1.0f; } /* <4c1587> ../game_shared/bot/bot_util.h:136 */ - NOBODY inline void Reset(void) + void Reset(void) { m_timestamp = gpGlobals->time; } /* <5c4948> ../game_shared/bot/bot_util.h:141 */ - NOBODY inline void Start(void) + void Start(void) { m_timestamp = gpGlobals->time; } /* <568aac> ../game_shared/bot/bot_util.h:146 */ - NOBODY inline void Invalidate(void) + void Invalidate(void) { m_timestamp = -1.0f; } /* <5687b3> ../game_shared/bot/bot_util.h:151 */ - NOBODY inline bool HasStarted(void) const + bool HasStarted(void) const { return (m_timestamp > 0.0f); } + // if not started, elapsed time is very large /* <5687d1> ../game_shared/bot/bot_util.h:157 */ - NOBODY inline float GetElapsedTime(void) const + float GetElapsedTime(void) const { return (HasStarted()) ? (gpGlobals->time - m_timestamp) : 99999.9f; } /* <2ff607> ../game_shared/bot/bot_util.h:162 */ - NOBODY inline bool IsLessThen(float duration) const + bool IsLessThen(float duration) const { return (gpGlobals->time - m_timestamp < duration) ? true : false; } /* <0> (null):0 */ - NOBODY inline bool IsGreaterThen(float duration) const + bool IsGreaterThen(float duration) const { return (gpGlobals->time - m_timestamp > duration) ? true : false; } @@ -93,6 +96,8 @@ private: };/* size: 4, cachelines: 1, members: 1 */ +// Simple class for counting down a short interval of time + /* <46f878> ../game_shared/bot/bot_util.h:183 */ class CountdownTimer { @@ -103,37 +108,40 @@ public: m_duration = 0.0f; } /* <569025> ../game_shared/bot/bot_util.h:189 */ - NOBODY inline void Reset(void) + void Reset(void) { m_timestamp = gpGlobals->time + m_duration; } /* <568aca> ../game_shared/bot/bot_util.h:194 */ - NOBODY inline void Start(float duration) + void Start(float duration) { m_timestamp = gpGlobals->time + duration; m_duration = duration; } /* <5687b3> ../game_shared/bot/bot_util.h:151 */ - NOBODY inline bool HasStarted(void) const + bool HasStarted(void) const { return (m_timestamp > 0.0f); } /* <5c4621> ../game_shared/bot/bot_util.h:200 */ - NOBODY inline void Invalidate(void) + void Invalidate(void) { m_timestamp = -1.0f; } /* <5c463f> ../game_shared/bot/bot_util.h:210 */ - NOBODY inline bool IsElapsed(void) const + bool IsElapsed(void) const { return (gpGlobals->time > m_timestamp); } + private: float m_duration; float m_timestamp; };/* size: 8, cachelines: 1, members: 2 */ +// Return true if the given entity is valid + /* <14ed68> ../game_shared/bot/bot_util.h:224 */ inline bool IsEntityValid(CBaseEntity *entity) { @@ -152,41 +160,50 @@ inline bool IsEntityValid(CBaseEntity *entity) return true; } +// Given two line segments: startA to endA, and startB to endB, return true if they intesect +// and put the intersection point in "result". +// Note that this computes the intersection of the 2D (x,y) projection of the line segments. + /* <4c0851> ../game_shared/bot/bot_util.h:247 */ inline bool IsIntersecting2D(const Vector &startA, const Vector &endA, const Vector &startB, const Vector &endB, Vector *result = NULL) { float denom = (endA.x - startA.x) * (endB.y - startB.y) - (endA.y - startA.y) * (endB.x - startB.x); if (denom == 0.0f) { + // parallel return false; } float numS = (startA.y - startB.y) * (endB.x - startB.x) - (startA.x - startB.x) * (endB.y - startB.y); if (numS == 0.0f) { + // coincident return true; } float numT = (startA.y - startB.y) * (endA.x - startA.x) - (startA.x - startB.x) * (endA.y - startA.y); float s = numS / denom; if (s < 0.0f || s > 1.0f) { + // intersection is not within line segment of startA to endA return false; } float t = numT / denom; if (t < 0.0f || t > 1.0f) { + // intersection is not within line segment of startB to endB return false; } + + // compute intesection point if (result) { *result = startA + s * (endA - startA); - //*result = startA + s * (endA - startA); - //(*result).x = startA.x + s * (endA.x - startA.x); - //(*result).y = startA.y + s * (endA.y - startA.y); - //(*result).z = startA.z + s * (endA.z - startA.z); } return true; } +// Iterate over all active players in the game, invoking functor on each. +// If functor returns false, stop iteration and return false. + /* <4700e1> ../game_shared/bot/bot_util.h:294 */ template < typename Functor @@ -208,6 +225,8 @@ bool ForEachPlayer(Functor &func) return true; } +// For zombie game + /* ../game_shared/bot/bot_util.h:317 */ inline bool IsZombieGame(void) { @@ -236,7 +255,7 @@ NOBODY int UTIL_HumansOnTeam(int teamID, bool isAlive = false); NOBODY int UTIL_BotsInGame(void); bool UTIL_KickBotFromTeam(TeamName kickTeam); NOBODY bool UTIL_IsTeamAllBots(int team); -NOBODY CBasePlayer *UTIL_GetClosestPlayer(const Vector *pos, float *distance = NULL); +CBasePlayer *UTIL_GetClosestPlayer(const Vector *pos, float *distance = NULL); NOBODY CBasePlayer *UTIL_GetClosestPlayer(const Vector *pos, int team, float *distance = NULL); const char *UTIL_GetBotPrefix(); void UTIL_ConstructBotNetName(char *name, int nameLength, const BotProfile *profile); @@ -253,7 +272,7 @@ void BotPrecache(void); void InitBotTrig(void); float BotCOS(float angle); float BotSIN(float angle); -NOBODY bool IsGameEventAudible(enum GameEventType event, CBaseEntity *entity, CBaseEntity *other, float *range, PriorityType *priority, bool *isHostile); +bool IsGameEventAudible(enum GameEventType event, CBaseEntity *entity, CBaseEntity *other, float *range, PriorityType *priority, bool *isHostile); NOBODY void HintMessageToAllPlayers(const char *message); #ifdef HOOK_GAMEDLL diff --git a/regamedll/game_shared/bot/improv.h b/regamedll/game_shared/bot/improv.h index fd9f7291..faf1d90f 100644 --- a/regamedll/game_shared/bot/improv.h +++ b/regamedll/game_shared/bot/improv.h @@ -35,11 +35,13 @@ class CBaseEntity; class CNavLadder; +// Improv-specific events + /* <46f4d9> ../game_shared/bot/improv.h:17 */ class IImprovEvent { public: - virtual void OnMoveToSuccess(const Vector &goal) {}; + virtual void OnMoveToSuccess(const Vector &goal) {}; // invoked when an improv reaches its MoveTo goal enum MoveToFailureType { @@ -48,30 +50,34 @@ public: FAIL_FELL_OFF, }; - virtual void OnMoveToFailure(const Vector &goal, MoveToFailureType reason) {}; - virtual void OnInjury(float amount) {}; + virtual void OnMoveToFailure(const Vector &goal, MoveToFailureType reason) {}; // invoked when an improv fails to reach a MoveTo goal + virtual void OnInjury(float amount) {}; // invoked when the improv is injured };/* size: 4, cachelines: 1, members: 1 */ +// The Improv interface definition +// An "Improv" is an improvisational actor that simulates the +// behavor of a human in an unscripted, "make it up as you go" manner. + class CImprov: public IImprovEvent { public: virtual ~CImprov(void) {}; - virtual bool IsAlive(void) const = 0; + virtual bool IsAlive(void) const = 0; // return true if this improv is alive - virtual void MoveTo(const Vector &goal) = 0; - virtual void LookAt(const Vector &target) = 0; - virtual void ClearLookAt(void) = 0; - virtual void FaceTo(const Vector &goal) = 0; - virtual void ClearFaceTo(void) = 0; + virtual void MoveTo(const Vector &goal) = 0; // move improv towards far-away goal (pathfind) + virtual void LookAt(const Vector &target) = 0; // define desired view target + virtual void ClearLookAt(void) = 0; // remove view goal + virtual void FaceTo(const Vector &goal) = 0; // orient body towards goal + virtual void ClearFaceTo(void) = 0; // remove body orientation goal - virtual bool IsAtMoveGoal(float error = 20.0f) const = 0; - virtual bool HasLookAt(void) const = 0; - virtual bool HasFaceTo(void) const = 0; - virtual bool IsAtFaceGoal(void) const = 0; - virtual bool IsFriendInTheWay(const Vector &goalPos) const = 0; - virtual bool IsFriendInTheWay(CBaseEntity *myFriend, const Vector &goalPos) const = 0; + virtual bool IsAtMoveGoal(float error = 20.0f) const = 0; // return true if improv is standing on its movement goal + virtual bool HasLookAt(void) const = 0; // return true if improv has a look at goal + virtual bool HasFaceTo(void) const = 0; // return true if improv has a face to goal + virtual bool IsAtFaceGoal(void) const = 0; // return true if improv is facing towards its face goal + virtual bool IsFriendInTheWay(const Vector &goalPos) const = 0; // return true if a friend is blocking our line to the given goal position + virtual bool IsFriendInTheWay(CBaseEntity *myFriend, const Vector &goalPos) const = 0; // return true if the given friend is blocking our line to the given goal position virtual void MoveForward(void) = 0; virtual void MoveBackward(void) = 0; @@ -79,22 +85,22 @@ public: virtual void StrafeRight(void) = 0; virtual bool Jump(void) = 0; virtual void Crouch(void) = 0; - virtual void StandUp(void) = 0; + virtual void StandUp(void) = 0; // "un-crouch" - virtual void TrackPath(const Vector &pathGoal, float deltaT) = 0; - virtual void StartLadder(const CNavLadder *ladder, enum NavTraverseType how, const Vector *approachPos, const Vector *departPos) = 0; + virtual void TrackPath(const Vector &pathGoal, float deltaT) = 0; // move along path by following "pathGoal" + virtual void StartLadder(const CNavLadder *ladder, enum NavTraverseType how, const Vector *approachPos, const Vector *departPos) = 0; // invoked when a ladder is encountered while following a path - virtual bool TraverseLadder(const CNavLadder *ladder, enum NavTraverseType how, const Vector *approachPos, const Vector *departPos, float deltaT) = 0; - virtual bool GetSimpleGroundHeightWithFloor(const Vector *pos, float *height, Vector *normal = NULL) = 0; + virtual bool TraverseLadder(const CNavLadder *ladder, enum NavTraverseType how, const Vector *approachPos, const Vector *departPos, float deltaT) = 0; // traverse given ladder + virtual bool GetSimpleGroundHeightWithFloor(const Vector *pos, float *height, Vector *normal = NULL) = 0; // find "simple" ground height, treating current nav area as part of the floor virtual void Run(void) = 0; virtual void Walk(void) = 0; virtual void Stop(void) = 0; - virtual float GetMoveAngle(void) const = 0; - virtual float GetFaceAngle(void) const = 0; + virtual float GetMoveAngle(void) const = 0; // return direction of movement + virtual float GetFaceAngle(void) const = 0; // return direction of view - virtual const Vector &GetFeet(void) const = 0; + virtual const Vector &GetFeet(void) const = 0; // return position of "feet" - point below centroid of improv at feet level virtual const Vector &GetCentroid(void) const = 0; virtual const Vector &GetEyes(void) const = 0; @@ -106,23 +112,23 @@ public: virtual bool IsJumping(void) const = 0; virtual bool IsUsingLadder(void) const = 0; virtual bool IsOnGround(void) const = 0; - virtual bool IsMoving(void) const = 0; + virtual bool IsMoving(void) const = 0; // if true, improv is walking, crawling, running somewhere virtual bool CanRun(void) const = 0; virtual bool CanCrouch(void) const = 0; virtual bool CanJump(void) const = 0; - virtual bool IsVisible(const Vector &pos, bool testFOV = false) const = 0; - virtual bool IsPlayerLookingAtMe(CBasePlayer *other, float cosTolerance = 0.95f) const = 0; + virtual bool IsVisible(const Vector &pos, bool testFOV = false) const = 0; // return true if improv can see position + virtual bool IsPlayerLookingAtMe(CBasePlayer *other, float cosTolerance = 0.95f) const = 0; // return true if 'other' is looking right at me + virtual CBasePlayer *IsAnyPlayerLookingAtMe(int team = 0, float cosTolerance = 0.95f) const = 0; // return player on given team that is looking right at me (team == 0 means any team), NULL otherwise - virtual CBasePlayer *IsAnyPlayerLookingAtMe(int team = 0, float cosTolerance = 0.95f) const = 0; - virtual CBasePlayer *GetClosestPlayerByTravelDistance(int team = 0, float *range = NULL) const = 0; + virtual CBasePlayer *GetClosestPlayerByTravelDistance(int team = 0, float *range = NULL) const = 0; // return actual travel distance to closest player on given team (team == 0 means any team) virtual CNavArea *GetLastKnownArea(void) const = 0; - virtual void OnUpdate(float deltaT) = 0; - virtual void OnUpkeep(float deltaT) = 0; - virtual void OnReset(void) = 0; - virtual void OnGameEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other) = 0; - virtual void OnTouch(CBaseEntity *other) = 0; + virtual void OnUpdate(float deltaT) = 0; // a less frequent, full update 'tick' + virtual void OnUpkeep(float deltaT) = 0; // a frequent, lightweight update 'tick' + virtual void OnReset(void) = 0; // reset improv to initial state + virtual void OnGameEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other) = 0; // invoked when an event occurs in the game + virtual void OnTouch(CBaseEntity *other) = 0; // "other" has touched us };/* size: 4, cachelines: 1, members: 1 */ diff --git a/regamedll/game_shared/bot/nav.h b/regamedll/game_shared/bot/nav.h index 1f034961..5248ddf4 100644 --- a/regamedll/game_shared/bot/nav.h +++ b/regamedll/game_shared/bot/nav.h @@ -179,14 +179,14 @@ inline NavDirType OppositeDirection(NavDirType dir) { switch (dir) { - case NORTH: - return SOUTH; - case EAST: - return WEST; - case SOUTH: - return NORTH; - case WEST: - return EAST; + case NORTH: + return SOUTH; + case EAST: + return WEST; + case SOUTH: + return NORTH; + case WEST: + return EAST; } return NORTH; @@ -197,14 +197,14 @@ inline NavDirType DirectionLeft(NavDirType dir) { switch (dir) { - case NORTH: - return WEST; - case SOUTH: - return EAST; - case EAST: - return NORTH; - case WEST: - return SOUTH; + case NORTH: + return WEST; + case SOUTH: + return EAST; + case EAST: + return NORTH; + case WEST: + return SOUTH; } return NORTH; @@ -215,14 +215,14 @@ inline NavDirType DirectionRight(NavDirType dir) { switch (dir) { - case NORTH: - return EAST; - case SOUTH: - return WEST; - case EAST: - return SOUTH; - case WEST: - return NORTH; + case NORTH: + return EAST; + case SOUTH: + return WEST; + case EAST: + return SOUTH; + case WEST: + return NORTH; } return NORTH; @@ -233,18 +233,18 @@ inline void AddDirectionVector(Vector *v, NavDirType dir, float amount) { switch (dir) { - case NORTH: - v->y -= amount; - return; - case EAST: - v->x += amount; - return; - case SOUTH: - v->y += amount; - return; - case WEST: - v->x -= amount; - return; + case NORTH: + v->y -= amount; + return; + case EAST: + v->x += amount; + return; + case SOUTH: + v->y += amount; + return; + case WEST: + v->x -= amount; + return; } } @@ -253,14 +253,14 @@ inline float DirectionToAngle(NavDirType dir) { switch (dir) { - case NORTH: - return 270.0f; - case EAST: - return 0.0f; - case SOUTH: - return 90.0f; - case WEST: - return 180.0f; + case NORTH: + return 270.0f; + case EAST: + return 0.0f; + case SOUTH: + return 90.0f; + case WEST: + return 180.0f; } return 0.0f; @@ -292,22 +292,22 @@ inline void DirectionToVector2D(NavDirType dir, Vector2D *v) { switch (dir) { - case NORTH: - v->x = 0.0f; - v->y = -1.0f; - break; - case SOUTH: - v->x = 0.0f; - v->y = 1.0f; - break; - case EAST: - v->x = 1.0f; - v->y = 0.0f; - break; - case WEST: - v->x = -1.0f; - v->y = 0.0f; - break; + case NORTH: + v->x = 0.0f; + v->y = -1.0f; + break; + case SOUTH: + v->x = 0.0f; + v->y = 1.0f; + break; + case EAST: + v->x = 1.0f; + v->y = 0.0f; + break; + case WEST: + v->x = -1.0f; + v->y = 0.0f; + break; } } diff --git a/regamedll/game_shared/bot/nav_area.cpp b/regamedll/game_shared/bot/nav_area.cpp index aa5c25ab..8d4fe49e 100644 --- a/regamedll/game_shared/bot/nav_area.cpp +++ b/regamedll/game_shared/bot/nav_area.cpp @@ -705,19 +705,43 @@ NOBODY void StripNavigationAreas(void) } /* <4d1b9c> ../game_shared/bot/nav_area.cpp:1057 */ -NOBODY inline CNavArea *FindFirstAreaInDirection(const Vector *start, NavDirType dir, float range, float beneathLimit, CBaseEntity *traceIgnore, Vector *closePos) +inline CNavArea *FindFirstAreaInDirection(const Vector *start, NavDirType dir, float range, float beneathLimit, CBaseEntity *traceIgnore = NULL, Vector *closePos = NULL) { -// { -// class CNavArea *area; // 1059 -// Vector pos; // 1061 -// int end; // 1063 -// { -// int i; // 1065 -// { -// TraceResult result; // 1070 -// } -// } -// } + CNavArea *area = NULL; + Vector pos = *start; + int end = (int)((range / GenerationStepSize) + 0.5f); + + for (int i = 1; i <= end; i++) + { + AddDirectionVector(&pos, dir, GenerationStepSize); + + // make sure we dont look thru the wall + TraceResult result; + + if (traceIgnore) + UTIL_TraceLine(*start, pos, ignore_monsters, ENT(traceIgnore->pev), &result); + else + UTIL_TraceLine(*start, pos, ignore_monsters, NULL, &result); + + if (result.flFraction != 1.0f) + break; + + area = TheNavAreaGrid.GetNavArea(&pos, beneathLimit); + + if (area != NULL) + { + if (closePos) + { + closePos->x = pos.x; + closePos->y = pos.y; + closePos->z = area->GetZ(pos.x, pos.y); + } + + break; + } + } + + return area; } /* <4c3de4> ../game_shared/bot/nav_area.cpp:1102 */ @@ -1009,125 +1033,212 @@ NOBODY int BuildArea(CNavNode *node, int width, int height) /* <4d3581> ../game_shared/bot/nav_area.cpp:1645 */ NOBODY void BuildLadders(void) { -// { -// TraceResult result; // 1650 -// class CBaseEntity *entity; // 1651 -// DestroyLadders(void); // 1648 -// edict(CBaseEntity *const this); // 1652 -// FNullEnt(const edict_t *pent); // 1652 -// { -// class CNavLadder *ladder; // 1654 -// float xSize; // 1666 -// float ySize; // 1667 -// Vector along; // 1698 -// float length; // 1699 -// Vector on; // 1700 -// Vector out; // 1700 -// float const minLadderClearance; // 1701 -// float const inc; // 1704 -// float t; // 1705 -// float const nearLadderRange; // 1746 -// Vector center; // 1753 -// float topZ; // 1813 -// bool topAdjusted; // 1814 -// class CNavArea *topAreaList; // 1815 -// { -// Vector from; // 1685 -// Vector to; // 1686 -// operator+(const Vector *const this, -// const Vector &v); // 1685 -// operator+(const Vector *const this, -// const Vector &v); // 1686 -// } -// { -// Vector from; // 1672 -// Vector to; // 1673 -// operator+(const Vector *const this, -// const Vector &v); // 1672 -// operator+(const Vector *const this, -// const Vector &v); // 1673 -// } -// CNavLadder(CNavLadder *const this); // 1654 -// operator-(const Vector *const this, -// const Vector &v); // 1698 -// NormalizeInPlace(Vector *const this); // 1699 -// AddDirectionVector(Vector *v, -// enum NavDirType dir, -// float amount); // 1711 -// operator*(float fl, -// const Vector &v); // 1708 -// operator+(const Vector *const this, -// const Vector &v); // 1708 -// operator-(const Vector *const this, -// const Vector &v); // 1741 -// Length(const Vector *const this); // 1741 -// DirectionToVector2D(NavDirType dir, -// class Vector2D *v); // 1743 -// operator+(const Vector *const this, -// const Vector &v); // 1753 -// AddDirectionVector(Vector *v, -// enum NavDirType dir, -// float amount); // 1754 -// AddLadderUp(CNavArea *const this, -// class CNavLadder *ladder); // 1764 -// operator+(const Vector *const this, -// const Vector &v); // 1772 -// AddDirectionVector(Vector *v, -// enum NavDirType dir, -// float amount); // 1773 -// FindFirstAreaInDirection(const Vector *start, -// enum NavDirType dir, -// float range, -// float beneathLimit, -// class CBaseEntity *traceIgnore, -// Vector *closePos); // 1776 -// FindFirstAreaInDirection(const Vector *start, -// enum NavDirType dir, -// float range, -// float beneathLimit, -// class CBaseEntity *traceIgnore, -// Vector *closePos); // 1781 -// FindFirstAreaInDirection(const Vector *start, -// enum NavDirType dir, -// float range, -// float beneathLimit, -// class CBaseEntity *traceIgnore, -// Vector *closePos); // 1786 -// FindFirstAreaInDirection(const Vector *start, -// enum NavDirType dir, -// float range, -// float beneathLimit, -// class CBaseEntity *traceIgnore, -// Vector *closePos); // 1791 -// AddLadderDown(CNavArea *const this, -// class CNavLadder *ladder); // 1801 -// AddLadderDown(CNavArea *const this, -// class CNavLadder *ladder); // 1804 -// AddLadderDown(CNavArea *const this, -// class CNavLadder *ladder); // 1807 -// AddLadderDown(CNavArea *const this, -// class CNavLadder *ladder); // 1810 -// { -// int a; // 1821 -// { -// class CNavArea *topArea; // 1823 -// Vector close; // 1827 -// } -// } -// { -// Vector bottomSpot; // 1846 -// } -// push_back(list> *const this, -// const value_type &__x); // 1853 -// AddDirectionVector(Vector *v, -// enum NavDirType dir, -// float amount); // 1729 -// operator*(float fl, -// const Vector &v); // 1726 -// operator-(const Vector *const this, -// const Vector &v); // 1726 -// } -// } + // remove any left-over ladders + DestroyLadders(); + + TraceResult result; + CBaseEntity *entity = UTIL_FindEntityByClassname(NULL, "func_ladder"); + while (entity && !FNullEnt(entity->edict())) + { + CNavLadder *ladder = new CNavLadder; + + // compute top & bottom of ladder + ladder->m_top.x = (entity->pev->absmin.x + entity->pev->absmax.x) / 2.0f; + ladder->m_top.y = (entity->pev->absmin.y + entity->pev->absmax.y) / 2.0f; + ladder->m_top.z = entity->pev->absmax.z; + + ladder->m_bottom.x = ladder->m_top.x; + ladder->m_bottom.y = ladder->m_top.y; + ladder->m_bottom.z = entity->pev->absmin.z; + + // determine facing - assumes "normal" runged ladder + float xSize = entity->pev->absmax.x - entity->pev->absmin.x; + float ySize = entity->pev->absmax.y - entity->pev->absmin.y; + + if (xSize > ySize) + { + // ladder is facing north or south - determine which way + // "pull in" traceline from bottom and top in case ladder abuts floor and/or ceiling + Vector from = ladder->m_bottom + Vector(0.0f, GenerationStepSize, GenerationStepSize); + Vector to = ladder->m_top + Vector(0.0f, GenerationStepSize, -GenerationStepSize); + + UTIL_TraceLine(from, to, ignore_monsters, ENT(entity->pev), &result); + + if (result.flFraction != 1.0f || result.fStartSolid) + ladder->m_dir = NORTH; + else + ladder->m_dir = SOUTH; + } + else + { + // ladder is facing east or west - determine which way + Vector from = ladder->m_bottom + Vector(GenerationStepSize, 0.0f, GenerationStepSize); + Vector to = ladder->m_top + Vector(GenerationStepSize, 0.0f, -GenerationStepSize); + + UTIL_TraceLine(from, to, ignore_monsters, ENT(entity->pev), &result); + + if (result.flFraction != 1.0f || result.fStartSolid) + ladder->m_dir = WEST; + else + ladder->m_dir = EAST; + } + + // adjust top and bottom of ladder to make sure they are reachable + // (cs_office has a crate right in front of the base of a ladder) + Vector along = ladder->m_top - ladder->m_bottom; + float length = along.NormalizeInPlace(); + + Vector on, out; + const float minLadderClearance = 32.0f; + + // adjust bottom to bypass blockages + const float inc = 10.0f; + float t; + + for (t = 0.0f; t <= length; t += inc) + { + on = ladder->m_bottom + t * along; + + out = on; + AddDirectionVector(&out, ladder->m_dir, minLadderClearance); + UTIL_TraceLine(on, out, ignore_monsters, ENT(entity->pev), &result); + + if (result.flFraction == 1.0f && !result.fStartSolid) + { + // found viable ladder bottom + ladder->m_bottom = on; + break; + } + } + + // adjust top to bypass blockages + for (t = 0.0f; t <= length; t += inc) + { + on = ladder->m_top - t * along; + + out = on; + AddDirectionVector(&out, ladder->m_dir, minLadderClearance); + UTIL_TraceLine(on, out, ignore_monsters, ENT(entity->pev), &result); + + if (result.flFraction == 1.0f && !result.fStartSolid) + { + // found viable ladder top + ladder->m_top = on; + break; + } + } + + ladder->m_length = (ladder->m_top - ladder->m_bottom).Length(); + DirectionToVector2D(ladder->m_dir, &ladder->m_dirVector); + + ladder->m_entity = entity; + const float nearLadderRange = 75.0f; + + // Find naviagtion area at bottom of ladder + // get approximate postion of player on ladder + + Vector center = ladder->m_bottom + Vector(0, 0, GenerationStepSize); + AddDirectionVector(¢er, ladder->m_dir, HalfHumanWidth); + + ladder->m_bottomArea = TheNavAreaGrid.GetNearestNavArea(¢er, true); + if (!ladder->m_bottomArea) + { + ALERT(at_console, "ERROR: Unconnected ladder bottom at (%g, %g, %g)\n", ladder->m_bottom.x, ladder->m_bottom.y, ladder->m_bottom.z); + } + else + { + // store reference to ladder in the area + ladder->m_bottomArea->AddLadderUp(ladder); + } + + // Find adjacent navigation areas at the top of the ladder + // get approximate postion of player on ladder + + center = ladder->m_top + Vector(0, 0, GenerationStepSize); + AddDirectionVector(¢er, ladder->m_dir, HalfHumanWidth); + + // find "ahead" area + ladder->m_topForwardArea = FindFirstAreaInDirection(¢er, OppositeDirection(ladder->m_dir), nearLadderRange, 120.0f, entity); + if (ladder->m_topForwardArea == ladder->m_bottomArea) + ladder->m_topForwardArea = NULL; + + // find "left" area + ladder->m_topLeftArea = FindFirstAreaInDirection(¢er, DirectionLeft(ladder->m_dir), nearLadderRange, 120.0f, entity); + if (ladder->m_topLeftArea == ladder->m_bottomArea) + ladder->m_topLeftArea = NULL; + + // find "right" area + ladder->m_topRightArea = FindFirstAreaInDirection(¢er, DirectionRight(ladder->m_dir), nearLadderRange, 120.0f, entity); + if (ladder->m_topRightArea == ladder->m_bottomArea) + ladder->m_topRightArea = NULL; + + // find "behind" area - must look farther, since ladder is against the wall away from this area + ladder->m_topBehindArea = FindFirstAreaInDirection(¢er, ladder->m_dir, 2.0f * nearLadderRange, 120.0f, entity); + if (ladder->m_topBehindArea == ladder->m_bottomArea) + ladder->m_topBehindArea = NULL; + + // can't include behind area, since it is not used when going up a ladder + if (!ladder->m_topForwardArea && !ladder->m_topLeftArea && !ladder->m_topRightArea) + ALERT(at_console, "ERROR: Unconnected ladder top at (%g, %g, %g)\n", ladder->m_top.x, ladder->m_top.y, ladder->m_top.z); + + // store reference to ladder in the area(s) + if (ladder->m_topForwardArea) + ladder->m_topForwardArea->AddLadderDown(ladder); + + if (ladder->m_topLeftArea) + ladder->m_topLeftArea->AddLadderDown(ladder); + + if (ladder->m_topRightArea) + ladder->m_topRightArea->AddLadderDown(ladder); + + if (ladder->m_topBehindArea) + ladder->m_topBehindArea->AddLadderDown(ladder); + + // adjust top of ladder to highest connected area + float topZ = -99999.9f; + bool topAdjusted = false; + + CNavArea *topAreaList[4]; + topAreaList[0] = ladder->m_topForwardArea; + topAreaList[1] = ladder->m_topLeftArea; + topAreaList[2] = ladder->m_topRightArea; + topAreaList[3] = ladder->m_topBehindArea; + + for (int a = 0; a < 4; ++a) + { + CNavArea *topArea = topAreaList[a]; + if (topArea == NULL) + continue; + + Vector close; + topArea->GetClosestPointOnArea(&ladder->m_top, &close); + if (topZ < close.z) + { + topZ = close.z; + topAdjusted = true; + } + } + + if (topAdjusted) + ladder->m_top.z = topZ; + + // + // Determine whether this ladder is "dangling" or not + // "Dangling" ladders are too high to go up + // + ladder->m_isDangling = false; + if (ladder->m_bottomArea) + { + Vector bottomSpot; + ladder->m_bottomArea->GetClosestPointOnArea(&ladder->m_bottom, &bottomSpot); + if (ladder->m_bottom.z - bottomSpot.z > HumanHeight) + ladder->m_isDangling = true; + } + + // add ladder to global list + TheNavLadderList.push_back(ladder); + entity = UTIL_FindEntityByClassname(entity, "func_ladder"); + } } /* <4c85c3> ../game_shared/bot/nav_area.cpp:1864 */ @@ -1179,13 +1290,12 @@ NOBODY void GenerateNavigationAreaMesh(void) } /* <4c86fa> ../game_shared/bot/nav_area.cpp:1975 */ -NOBODY bool CNavArea::IsOverlapping(const Vector *pos) const +bool CNavArea::IsOverlapping(const Vector *pos) const { - if (pos->x >= m_extent.lo.x && pos->x <= m_extent.hi.x && - pos->y >= m_extent.lo.y && pos->y <= m_extent.hi.y) - return true; - - return false; + return (pos->x >= m_extent.lo.x + && pos->x <= m_extent.hi.x + && pos->y >= m_extent.lo.y + && pos->y <= m_extent.hi.y); } /* <4c8726> ../game_shared/bot/nav_area.cpp:1988 */ @@ -1967,19 +2077,29 @@ NOBODY void DrawDanger(void) } /* <4ce523> ../game_shared/bot/nav_area.cpp:3356 */ -NOBODY bool IsSpotOccupied(CBaseEntity *me, const Vector *pos) +bool IsSpotOccupied(CBaseEntity *me, const Vector *pos) { -// { -// float const closeRange; // 3358 -// float range; // 3361 -// class CBasePlayer *player; // 3362 -// { -// class CHostage *hostage; // 3373 -// GetClosestHostage(CHostageManager *const this, -// const Vector &pos, -// float *resultRange); // 3373 -// } -// } + const float closeRange = 75.0f; + + // is there a player in this spot + float range; + CBasePlayer *player = UTIL_GetClosestPlayer(pos, &range); + + if (player != me) + { + if (player && range < closeRange) + return true; + } + + // is there is a hostage in this spot + if (g_pHostages != NULL) + { + CHostage *hostage = g_pHostages->GetClosestHostage(*pos, &range); + if (hostage != NULL && hostage != me && range < closeRange) + return true; + } + + return false; } /* <4c118b> ../game_shared/bot/nav_area.cpp:3385 */ @@ -2038,7 +2158,7 @@ public: return; for (int j = i + 1; j < m_count; ++j) - m_hidingSpot[j-1] = m_hidingSpot[j]; + m_hidingSpot[j - 1] = m_hidingSpot[j]; --m_count; } @@ -2212,20 +2332,26 @@ const Vector *FindNearbyRetreatSpot(CBaseEntity *me, const Vector *start, CNavAr if (startArea == NULL) return NULL; + // collect hiding spots with decent "cover" CollectHidingSpotsFunctor collector(me, start, maxRange, HidingSpot::IN_COVER, UNDEFINED_PLACE, useCrouchAreas); SearchSurroundingAreas(startArea, start, collector, maxRange); if (collector.m_count == 0) return NULL; + // find the closest unoccupied hiding spot that crosses the least lines of fire and has the best cover for (int i = 0; i < collector.m_count; ++i) { + // check if we would have to cross a line of fire to reach this hiding spot if (IsCrossingLineOfFire(*start, *collector.m_hidingSpot[i], me)) { collector.RemoveSpot(i); + // back up a step, so iteration won't skip a spot --i; continue; } + + // check if there is someone on the avoidTeam near this hiding spot if (avoidTeam) { float range; @@ -2234,7 +2360,10 @@ const Vector *FindNearbyRetreatSpot(CBaseEntity *me, const Vector *start, CNavAr const float dangerRange = 150.0f; if (range < dangerRange) { + // there is an avoidable player too near this spot - remove it collector.RemoveSpot(i); + + // back up a step, so iteration won't skip a spot --i; continue; } @@ -2245,6 +2374,7 @@ const Vector *FindNearbyRetreatSpot(CBaseEntity *me, const Vector *start, CNavAr if (collector.m_count <= 0) return NULL; + // all remaining spots are ok - pick one at random int which = RANDOM_LONG(0, collector.m_count - 1); return collector.m_hidingSpot[which]; } @@ -2740,13 +2870,33 @@ bool GetGroundHeight(const Vector *pos, float *height, Vector *normal) return true; } +// Return the "simple" ground height below this point in "height". +// This function is much faster, but less tolerant. Make sure the give position is "well behaved". +// Return false if position is invalid (outside of map, in a solid area, etc). + /* <4cf4d2> ../game_shared/bot/nav_area.cpp:4724 */ -NOBODY bool GetSimpleGroundHeight(const Vector *pos, float *height, Vector *normal) +bool GetSimpleGroundHeight(const Vector *pos, float *height, Vector *normal) { -// { -// Vector to; // 4726 -// TraceResult result; // 4731 -// } + Vector to; + to.x = pos->x; + to.y = pos->y; + to.z = pos->z - 9999.9f; + + TraceResult result; + + UTIL_TraceLine(*pos, to, ignore_monsters, dont_ignore_glass, NULL, &result); + + if (result.fStartSolid) + return false; + + *height = result.vecEndPos.z; + + if (normal != NULL) + { + *normal = result.vecPlaneNormal; + } + + return true; } /* <4c0912> ../game_shared/bot/nav_area.cpp:4757 */ diff --git a/regamedll/game_shared/bot/nav_area.h b/regamedll/game_shared/bot/nav_area.h index 0deba227..18f07b3b 100644 --- a/regamedll/game_shared/bot/nav_area.h +++ b/regamedll/game_shared/bot/nav_area.h @@ -806,14 +806,15 @@ bool NavAreaBuildPath(CNavArea *startArea, CNavArea *goalArea, const Vector *goa float initCost = costFunc(startArea, NULL, NULL); if (initCost < 0.0f) return false; + startArea->SetCostSoFar(initCost); startArea->AddToOpenList(); if (closestArea) *closestArea = startArea; - float closestAreaDist = startArea->GetTotalCost(); + float closestAreaDist = startArea->GetTotalCost(); while (!CNavArea::IsOpenListEmpty()) { CNavArea *area = CNavArea::PopOpenList(); @@ -841,8 +842,8 @@ bool NavAreaBuildPath(CNavArea *startArea, CNavArea *goalArea, const Vector *goa BEHIND, NUM_TOP_DIRECTIONS }; - int ladderTopDir; + int ladderTopDir; while (true) { CNavArea *newArea; @@ -960,8 +961,10 @@ bool NavAreaBuildPath(CNavArea *startArea, CNavArea *goalArea, const Vector *goa newArea->AddToOpenList(); } } + area->AddToClosedList(); } + return false; } @@ -1068,10 +1071,13 @@ void SearchSurroundingAreas(CNavArea *startArea, const Vector *startPos, Functor while (!CNavArea::IsOpenListEmpty()) { - + // get next area to check CNavArea *area = CNavArea::PopOpenList(); + + // invoke functor on area if (func(area)) { + // explore adjacent floor areas for (int dir = 0; dir < NUM_DIRECTIONS; ++dir) { int count = area->GetAdjacentCount((NavDirType)dir); @@ -1082,23 +1088,31 @@ void SearchSurroundingAreas(CNavArea *startArea, const Vector *startPos, Functor } } + // explore adjacent areas connected by ladders NavLadderList::const_iterator ladderIt; + + // check up ladders const NavLadderList *ladderList = area->GetLadderList(LADDER_UP); if (ladderList) { for (ladderIt = ladderList->begin(); ladderIt != ladderList->end(); ++ladderIt) { const CNavLadder *ladder = *ladderIt; + + // cannot use this ladder if the ladder bottom is hanging above our head if (ladder->m_isDangling) { continue; } + // do not use BEHIND connection, as its very hard to get to when going up a ladder AddAreaToOpenList(ladder->m_topForwardArea, area, startPos, maxRange); AddAreaToOpenList(ladder->m_topLeftArea, area, startPos, maxRange); AddAreaToOpenList(ladder->m_topRightArea, area, startPos, maxRange); } } + + // check down ladders ladderList = area->GetLadderList(LADDER_DOWN); if (ladderList) { @@ -1210,8 +1224,8 @@ typedef const Vector *(FIND_SPOT_CBASE)(CBaseEntity *, const Vector *, CNavArea typedef void (CNavArea::*SAVE_FD)(int fd, unsigned int version); typedef void (CNavArea::*SAVE_FILE)(FILE *fp); -typedef void (CNavArea::*OVERLAP_VECTOR)(Vector *pos); -typedef void (CNavArea::*OVERLAP_CNAV)(CNavArea *area); +typedef bool (CNavArea::*OVERLAP_VECTOR)(const Vector *pos) const; +typedef bool (CNavArea::*OVERLAP_CNAV)(const CNavArea *area) const; typedef float (CNavArea::*GETZ_VECTOR)(const Vector *pos) const; typedef float (CNavArea::*GETZ_TWO_FLOAT)(float x, float y) const; @@ -1274,14 +1288,14 @@ NOBODY void ClassifySniperSpot(HidingSpot *spot); NOBODY void DestroyHidingSpots(void); NOBODY void EditNavAreas(NavEditCmdType cmd); bool GetGroundHeight(const Vector *pos, float *height, Vector *normal = NULL); -NOBODY bool GetSimpleGroundHeight(const Vector *pos, float *height, Vector *normal = NULL); +bool GetSimpleGroundHeight(const Vector *pos, float *height, Vector *normal = NULL); NOBODY inline bool IsAreaVisible(const Vector *pos, const CNavArea *area); NOBODY CNavArea *GetMarkedArea(void); void EditNavAreasReset(void); NOBODY void DrawHidingSpots(const CNavArea *area); NOBODY void IncreaseDangerNearby(int teamID, float amount, CNavArea *startArea, const Vector *pos, float maxRadius); NOBODY void DrawDanger(void); -NOBODY bool IsSpotOccupied(CBaseEntity *me, const Vector *pos); +bool IsSpotOccupied(CBaseEntity *me, const Vector *pos); NOBODY const Vector *FindNearbyHidingSpot(CBaseEntity *me, const Vector *pos, CNavArea *startArea, float maxRange = 1000.0f, bool isSniper = false, bool useNearest = false); NOBODY const Vector *FindNearbyRetreatSpot(CBaseEntity *me, const Vector *start, CNavArea *startArea, float maxRange = 1000.0f, int avoidTeam = 0, bool useCrouchAreas = true); NOBODY bool IsCrossingLineOfFire(const Vector &start, const Vector &finish, CBaseEntity *ignore = NULL, int ignoreTeam = 0); @@ -1292,7 +1306,7 @@ void CleanupApproachAreaAnalysisPrep(void); void DestroyLadders(void); NOBODY void DestroyNavigationMap(void); NOBODY void StripNavigationAreas(void); -NOBODY inline CNavArea *FindFirstAreaInDirection(const Vector *start, NavDirType dir, float range, float beneathLimit, CBaseEntity *traceIgnore, Vector *closePos); +inline CNavArea *FindFirstAreaInDirection(const Vector *start, NavDirType dir, float range, float beneathLimit, CBaseEntity *traceIgnore, Vector *closePos); NOBODY inline bool testJumpDown(const Vector *fromPos, const Vector *toPos); NOBODY inline CNavArea *findJumpDownArea(const Vector *fromPos, NavDirType dir); NOBODY void ConnectGeneratedAreas(void); diff --git a/regamedll/game_shared/bot/nav_file.cpp b/regamedll/game_shared/bot/nav_file.cpp index a2d11c13..e4cbbb33 100644 --- a/regamedll/game_shared/bot/nav_file.cpp +++ b/regamedll/game_shared/bot/nav_file.cpp @@ -888,137 +888,138 @@ NOBODY NavErrorType __declspec(naked) LoadNavigationMap(void) { jmp pLoadNavigationMap } +/* + // since the navigation map is destroyed on map change, + // if it exists it has already been loaded for this map + if (!TheNavAreaList.empty()) + return NAV_OK; - //// since the navigation map is destroyed on map change, - //// if it exists it has already been loaded for this map - //if (!TheNavAreaList.empty()) - // return NAV_OK; + // nav filename is derived from map filename + char filename[256]; + Q_sprintf(filename, "maps\\%s.nav", STRING(gpGlobals->mapname)); - //// nav filename is derived from map filename - //char filename[256]; - //Q_sprintf(filename, "maps\\%s.nav", STRING(gpGlobals->mapname)); + // free previous navigation map data + DestroyNavigationMap(); + placeDirectory.Reset(); - //// free previous navigation map data - //DestroyNavigationMap(); - //placeDirectory.Reset(); + IMPLEMENT_ARRAY_CLASS(CNavArea, m_nextID) = 1; - //IMPLEMENT_ARRAY_CLASS(CNavArea, m_nextID) = 1; + SteamFile navFile(filename); - //SteamFile navFile(filename); + if (!navFile.IsValid()) + return NAV_CANT_ACCESS_FILE; - //if (!navFile.IsValid()) - // return NAV_CANT_ACCESS_FILE; + // check magic number + bool result; + unsigned int magic; + result = navFile.Read(&magic, sizeof(unsigned int)); + if (!result || magic != NAV_MAGIC_NUMBER) + { + CONSOLE_ECHO("ERROR: Invalid navigation file '%s'.\n", filename); + return NAV_INVALID_FILE; + } - //// check magic number - //bool result; - //unsigned int magic; - //result = navFile.Read(&magic, sizeof(unsigned int)); - //if (!result || magic != NAV_MAGIC_NUMBER) - //{ - // CONSOLE_ECHO("ERROR: Invalid navigation file '%s'.\n", filename); - // return NAV_INVALID_FILE; - //} + // read file version number + unsigned int version; + result = navFile.Read(&version, sizeof(unsigned int)); + if (!result || version > 5) + { + CONSOLE_ECHO("ERROR: Unknown navigation file version.\n"); + return NAV_BAD_FILE_VERSION; + } - //// read file version number - //unsigned int version; - //result = navFile.Read(&version, sizeof(unsigned int)); - //if (!result || version > 5) - //{ - // CONSOLE_ECHO("ERROR: Unknown navigation file version.\n"); - // return NAV_BAD_FILE_VERSION; - //} + if (version >= 4) + { + // get size of source bsp file and verify that the bsp hasn't changed + unsigned int saveBspSize; + navFile.Read(&saveBspSize, sizeof(unsigned int)); - //if (version >= 4) - //{ - // // get size of source bsp file and verify that the bsp hasn't changed - // unsigned int saveBspSize; - // navFile.Read(&saveBspSize, sizeof(unsigned int)); + // verify size + char *bspFilename = GetBspFilename(filename); + if (bspFilename == NULL) + return NAV_INVALID_FILE; - // // verify size - // char *bspFilename = GetBspFilename(filename); - // if (bspFilename == NULL) - // return NAV_INVALID_FILE; + unsigned int bspSize = (unsigned int)GET_FILE_SIZE(bspFilename); - // unsigned int bspSize = (unsigned int)GET_FILE_SIZE(bspFilename); + if (bspSize != saveBspSize) + { + // this nav file is out of date for this bsp file + char *msg = "*** WARNING ***\nThe AI navigation data is from a different version of this map.\nThe CPU players will likely not perform well.\n"; + HintMessageToAllPlayers(msg); + CONSOLE_ECHO("\n-----------------\n"); + CONSOLE_ECHO(msg); + CONSOLE_ECHO("-----------------\n\n"); + } + } - // if (bspSize != saveBspSize) - // { - // // this nav file is out of date for this bsp file - // char *msg = "*** WARNING ***\nThe AI navigation data is from a different version of this map.\nThe CPU players will likely not perform well.\n"; - // HintMessageToAllPlayers(msg); - // CONSOLE_ECHO("\n-----------------\n"); - // CONSOLE_ECHO(msg); - // CONSOLE_ECHO("-----------------\n\n"); - // } - //} + // load Place directory + if (version >= 5) + { + placeDirectory.Load(&navFile); + } - //// load Place directory - //if (version >= 5) - //{ - // placeDirectory.Load(&navFile); - //} + // get number of areas + unsigned int count; + result = navFile.Read(&count, sizeof(unsigned int)); - //// get number of areas - //unsigned int count; - //result = navFile.Read(&count, sizeof(unsigned int)); + Extent extent; + extent.lo.x = 9999999999.9f; + extent.lo.y = 9999999999.9f; + extent.hi.x = -9999999999.9f; + extent.hi.y = -9999999999.9f; - //Extent extent; - //extent.lo.x = 9999999999.9f; - //extent.lo.y = 9999999999.9f; - //extent.hi.x = -9999999999.9f; - //extent.hi.y = -9999999999.9f; + // load the areas and compute total extent + for (unsigned int i = 0; i < count; i++) + { + CNavArea *area = new CNavArea; + area->Load(&navFile, version); + TheNavAreaList.push_back(area); - //// load the areas and compute total extent - //for (unsigned int i = 0; i < count; i++) - //{ - // CNavArea *area = new CNavArea; - // area->Load(&navFile, version); - // TheNavAreaList.push_back(area); + const Extent *areaExtent = area->GetExtent(); - // const Extent *areaExtent = area->GetExtent(); + // check validity of nav area + if (areaExtent->lo.x >= areaExtent->hi.x || areaExtent->lo.y >= areaExtent->hi.y) + CONSOLE_ECHO("WARNING: Degenerate Navigation Area #%d at ( %g, %g, %g )\n", + area->GetID(), area->m_center.x, area->m_center.y, area->m_center.z); - // // check validity of nav area - // if (areaExtent->lo.x >= areaExtent->hi.x || areaExtent->lo.y >= areaExtent->hi.y) - // CONSOLE_ECHO("WARNING: Degenerate Navigation Area #%d at ( %g, %g, %g )\n", - // area->GetID(), area->m_center.x, area->m_center.y, area->m_center.z); + if (areaExtent->lo.x < extent.lo.x) + extent.lo.x = areaExtent->lo.x; - // if (areaExtent->lo.x < extent.lo.x) - // extent.lo.x = areaExtent->lo.x; + if (areaExtent->lo.y < extent.lo.y) + extent.lo.y = areaExtent->lo.y; - // if (areaExtent->lo.y < extent.lo.y) - // extent.lo.y = areaExtent->lo.y; + if (areaExtent->hi.x > extent.hi.x) + extent.hi.x = areaExtent->hi.x; - // if (areaExtent->hi.x > extent.hi.x) - // extent.hi.x = areaExtent->hi.x; + if (areaExtent->hi.y > extent.hi.y) + extent.hi.y = areaExtent->hi.y; + } - // if (areaExtent->hi.y > extent.hi.y) - // extent.hi.y = areaExtent->hi.y; - //} + // add the areas to the grid + TheNavAreaGrid.Initialize(extent.lo.x, extent.hi.x, extent.lo.y, extent.hi.y); - //// add the areas to the grid - //TheNavAreaGrid.Initialize(extent.lo.x, extent.hi.x, extent.lo.y, extent.hi.y); + NavAreaList::iterator iter; + for (iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter) + TheNavAreaGrid.AddNavArea(*iter); - //NavAreaList::iterator iter; - //for (iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter) - // TheNavAreaGrid.AddNavArea(*iter); + // allow areas to connect to each other, etc + for (iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter) + { + CNavArea *area = *iter; + area->PostLoad(); + } - //// allow areas to connect to each other, etc - //for (iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter) - //{ - // CNavArea *area = *iter; - // area->PostLoad(); - //} + // load legacy location file (Places) + if (version < 5) + { + LoadLocationFile(filename); + } - //// load legacy location file (Places) - //if (version < 5) - //{ - // LoadLocationFile(filename); - //} + // + // Set up all the ladders + // + BuildLadders(); - //// - //// Set up all the ladders - //// - //BuildLadders(); - - //return NAV_OK; + return NAV_OK; +*/ } diff --git a/regamedll/game_shared/bot/nav_path.cpp b/regamedll/game_shared/bot/nav_path.cpp index c5cb60fb..3743473e 100644 --- a/regamedll/game_shared/bot/nav_path.cpp +++ b/regamedll/game_shared/bot/nav_path.cpp @@ -1,7 +1,7 @@ #include "precompiled.h" /* <505025> ../game_shared/bot/nav_path.cpp:24 */ -bool CNavPath::ComputePathPositions(void) +NOBODY bool CNavPath::ComputePathPositions(void) { // { // int i; // 34 @@ -52,7 +52,7 @@ bool CNavPath::ComputePathPositions(void) } /* <50525f> ../game_shared/bot/nav_path.cpp:148 */ -bool CNavPath::IsAtEnd(const Vector &pos) const +NOBODY bool CNavPath::IsAtEnd(const Vector &pos) const { // { // float const epsilon; // 153 @@ -64,7 +64,7 @@ bool CNavPath::IsAtEnd(const Vector &pos) const } /* <5052f6> ../game_shared/bot/nav_path.cpp:161 */ -float CNavPath::GetLength(void) const +NOBODY float CNavPath::GetLength(void) const { // { // float length; // 163 @@ -78,7 +78,7 @@ float CNavPath::GetLength(void) const } /* <50537f> ../game_shared/bot/nav_path.cpp:177 */ -bool CNavPath::GetPointAlongPath(float distAlong, Vector *pointOnPath) const +NOBODY bool CNavPath::GetPointAlongPath(float distAlong, Vector *pointOnPath) const { // { // float lengthSoFar; // 188 @@ -102,7 +102,7 @@ bool CNavPath::GetPointAlongPath(float distAlong, Vector *pointOnPath) const } /* <5054da> ../game_shared/bot/nav_path.cpp:218 */ -int CNavPath::GetSegmentIndexAlongPath(float distAlong) const +NOBODY int CNavPath::GetSegmentIndexAlongPath(float distAlong) const { // { // float lengthSoFar; // 228 @@ -117,7 +117,7 @@ int CNavPath::GetSegmentIndexAlongPath(float distAlong) const } /* <50557e> ../game_shared/bot/nav_path.cpp:250 */ -bool CNavPath::FindClosestPointOnPath(const Vector *worldPos, int startIndex, int endIndex, Vector *close) const +NOBODY bool CNavPath::FindClosestPointOnPath(const Vector *worldPos, int startIndex, int endIndex, Vector *close) const { // { // Vector along; // 255 @@ -149,17 +149,42 @@ bool CNavPath::FindClosestPointOnPath(const Vector *worldPos, int startIndex, in // } } +// Build trivial path when start and goal are in the same nav area + /* <5057df> ../game_shared/bot/nav_path.cpp:305 */ bool CNavPath::BuildTrivialPath(const Vector *start, const Vector *goal) { -// { -// class CNavArea *startArea; // 309 -// class CNavArea *goalArea; // 313 -// } + m_segmentCount = 0; + + CNavArea *startArea = TheNavAreaGrid.GetNearestNavArea(start); + if (startArea == NULL) + return false; + + CNavArea *goalArea = TheNavAreaGrid.GetNearestNavArea(goal); + if (goalArea == NULL) + return false; + + m_segmentCount = 2; + + m_path[0].area = startArea; + m_path[0].pos.x = start->x; + m_path[0].pos.y = start->y; + m_path[0].pos.z = startArea->GetZ(start); + m_path[0].ladder = NULL; + m_path[0].how = NUM_TRAVERSE_TYPES; + + m_path[1].area = goalArea; + m_path[1].pos.x = goal->x; + m_path[1].pos.y = goal->y; + m_path[1].pos.z = goalArea->GetZ(goal); + m_path[1].ladder = NULL; + m_path[1].how = NUM_TRAVERSE_TYPES; + + return true; } /* <505853> ../game_shared/bot/nav_path.cpp:340 */ -void CNavPath::Draw(void) +NOBODY void CNavPath::Draw(void) { // { // int i; // 345 @@ -171,7 +196,7 @@ void CNavPath::Draw(void) } /* <505931> ../game_shared/bot/nav_path.cpp:357 */ -int CNavPath::FindNextOccludedNode(int anchor) +NOBODY int CNavPath::FindNextOccludedNode(int anchor) { // { // int lastVisible; // 359 @@ -205,24 +230,24 @@ int CNavPath::FindNextOccludedNode(int anchor) } /* <505c26> ../game_shared/bot/nav_path.cpp:396 */ -void CNavPath::Optimize(void) +NOBODY void CNavPath::Optimize(void) { } /* <505c6d> ../game_shared/bot/nav_path.cpp:436 */ -CNavPathFollower::CNavPathFollower(void) +NOBODY CNavPathFollower::CNavPathFollower(void) { // CStuckMonitor(CStuckMonitor *const this); // 436 } /* <505cce> ../game_shared/bot/nav_path.cpp:447 */ -void CNavPathFollower::Reset(void) +NOBODY void CNavPathFollower::Reset(void) { // Reset(CStuckMonitor *const this); // 452 } /* <507c31> ../game_shared/bot/nav_path.cpp:459 */ -void CNavPathFollower::Update(float deltaT, bool avoidObstacles) +NOBODY void CNavPathFollower::Update(float deltaT, bool avoidObstacles) { // { // const class PathSegment *node; // 464 @@ -295,7 +320,7 @@ void CNavPathFollower::Update(float deltaT, bool avoidObstacles) } /* <505d18> ../game_shared/bot/nav_path.cpp:662 */ -int CNavPathFollower::FindOurPositionOnPath(Vector *close, bool local) const +NOBODY int CNavPathFollower::FindOurPositionOnPath(Vector *close, bool local) const { // { // Vector along; // 667 @@ -349,7 +374,7 @@ int CNavPathFollower::FindOurPositionOnPath(Vector *close, bool local) const } /* <506248> ../game_shared/bot/nav_path.cpp:750 */ -int CNavPathFollower::FindPathPoint(float aheadRange, Vector *point, int *prevIndex) +NOBODY int CNavPathFollower::FindPathPoint(float aheadRange, Vector *point, int *prevIndex) { // { // int afterIndex; // 753 @@ -502,7 +527,7 @@ int CNavPathFollower::FindPathPoint(float aheadRange, Vector *point, int *prevIn } /* <507004> ../game_shared/bot/nav_path.cpp:1000 */ -void CNavPathFollower::FeelerReflexAdjustment(Vector *goalPosition, float height) +NOBODY void CNavPathFollower::FeelerReflexAdjustment(Vector *goalPosition, float height) { // { // Vector dir; // 1006 @@ -573,18 +598,18 @@ void CNavPathFollower::FeelerReflexAdjustment(Vector *goalPosition, float height } /* <507a31> ../game_shared/bot/nav_path.cpp:1098 */ -CStuckMonitor::CStuckMonitor(void) +NOBODY CStuckMonitor::CStuckMonitor(void) { // IntervalTimer(IntervalTimer *const this); // 1098 } /* <507a73> ../game_shared/bot/nav_path.cpp:1108 */ -void CStuckMonitor::Reset(void) +NOBODY void CStuckMonitor::Reset(void) { } /* <507a96> ../game_shared/bot/nav_path.cpp:1119 */ -void CStuckMonitor::Update(CImprov *improv) +NOBODY void CStuckMonitor::Update(CImprov *improv) { // { // float const unstuckRange; // 1124 diff --git a/regamedll/game_shared/bot/nav_path.h b/regamedll/game_shared/bot/nav_path.h index eb3059b1..e9f10cbf 100644 --- a/regamedll/game_shared/bot/nav_path.h +++ b/regamedll/game_shared/bot/nav_path.h @@ -180,7 +180,9 @@ private: // determine actual path positions bool ComputePathPositions(void); - +#ifdef HOOK_GAMEDLL +public: +#endif // HOOK_GAMEDLL // utility function for when start and goal are in the same area bool BuildTrivialPath(const Vector *start, const Vector *goal); @@ -207,7 +209,7 @@ public: return m_isStuck ? m_stuckTimer.GetElapsedTime() : 0.0f; } -private: +/*private:*/ bool m_isStuck; // if true, we are stuck Vector m_stuckSpot; // the location where we became stuck IntervalTimer m_stuckTimer; // how long we have been stuck diff --git a/regamedll/hookers/6153_hooker.cpp b/regamedll/hookers/6153_hooker.cpp index 2571e026..fbf29ba2 100644 --- a/regamedll/hookers/6153_hooker.cpp +++ b/regamedll/hookers/6153_hooker.cpp @@ -104,6 +104,7 @@ extern const size_t g_BaseOffset = 0x00000000; //#define GameShr_BotProfile_Region //#define VoiceManager_Region //#define Vector_Region + //#define Data_References_Region //#define Function_References_Region @@ -227,7 +228,7 @@ FunctionHook g_FunctionHooks[] = #ifndef Monsters_Region //CGib //virtual func - { 0x01D70C90, "_ZN4CGib10ObjectCapsEv", mfunc_ptr_cast(&CGib::ObjectCaps_) }, + //{ 0x01D70C90, "_ZN4CGib10ObjectCapsEv", mfunc_ptr_cast(&CGib::ObjectCaps_) }, // DEFAULT //non-virtual func { 0x01D6FFE0, "_ZN4CGib5SpawnEPKc", mfunc_ptr_cast(&CGib::Spawn) }, { 0x01D6FCA0, "_ZN4CGib14BounceGibTouchEP11CBaseEntity", mfunc_ptr_cast(&CGib::BounceGibTouch) }, @@ -381,7 +382,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x01D01BB0, "_ZN11CBaseEntity8ActivateEv", mfunc_ptr_cast(&CBaseEntity::Activate_) }, // PURE //{ 0x01D638B0, "_ZN11CBaseEntity21SetObjectCollisionBoxEv", mfunc_ptr_cast(&CBaseEntity::SetObjectCollisionBox_) }, // default //{ 0x01D01BC0, "_ZN11CBaseEntity8ClassifyEv", mfunc_ptr_cast(&CBaseEntity::Classify_) }, // default - { 0x01D01BD0, "_ZN11CBaseEntity11DeathNoticeEP9entvars_s", mfunc_ptr_cast(&CBaseEntity::DeathNotice_) }, + //{ 0x01D01BD0, "_ZN11CBaseEntity11DeathNoticeEP9entvars_s", mfunc_ptr_cast(&CBaseEntity::DeathNotice_) }, // default { 0x01D719D0, "_ZN11CBaseEntity11TraceAttackEP9entvars_sf6VectorP11TraceResulti", mfunc_ptr_cast(&CBaseEntity::TraceAttack_) }, { 0x01D63210, "_ZN11CBaseEntity10TakeDamageEP9entvars_sS1_fi", mfunc_ptr_cast(&CBaseEntity::TakeDamage_) }, { 0x01D63190, "_ZN11CBaseEntity10TakeHealthEfi", mfunc_ptr_cast(&CBaseEntity::TakeHealth_) }, @@ -391,13 +392,13 @@ FunctionHook g_FunctionHooks[] = //{ 0x01D01BF0, "_ZN11CBaseEntity11IsTriggeredEPS_", mfunc_ptr_cast(&CBaseEntity::IsTriggered_) }, // default //{ 0x01D01C00, "_ZN11CBaseEntity16MyMonsterPointerEv", mfunc_ptr_cast(&CBaseEntity::MyMonsterPointer_) }, // default //{ 0x01D01C10, "_ZN11CBaseEntity21MySquadMonsterPointerEv", mfunc_ptr_cast(&CBaseEntity::MySquadMonsterPointer_) }, // default - { 0x01D01C20, "_ZN11CBaseEntity14GetToggleStateEv", mfunc_ptr_cast(&CBaseEntity::GetToggleState_) }, + //{ 0x01D01C20, "_ZN11CBaseEntity14GetToggleStateEv", mfunc_ptr_cast(&CBaseEntity::GetToggleState_) }, // default //{ 0x01D01C30, "_ZN11CBaseEntity9AddPointsEii", mfunc_ptr_cast(&CBaseEntity::AddPoints_) }, // PURE //{ 0x01D01C40, "_ZN11CBaseEntity15AddPointsToTeamEii", mfunc_ptr_cast(&CBaseEntity::AddPointsToTeam_) }, // PURE //{ 0x01D01C50, "_ZN11CBaseEntity13AddPlayerItemEP15CBasePlayerItem", mfunc_ptr_cast(&CBaseEntity::AddPlayerItem_) }, // default //{ 0x01D01C60, "_ZN11CBaseEntity16RemovePlayerItemEP15CBasePlayerItem", mfunc_ptr_cast(&CBaseEntity::RemovePlayerItem_) }, // default //{ 0x01D01C70, "_ZN11CBaseEntity8GiveAmmoEiPci", mfunc_ptr_cast(&CBaseEntity::GiveAmmo_) }, // default - { 0x01D01C80, "_ZN11CBaseEntity8GetDelayEv", mfunc_ptr_cast(&CBaseEntity::GetDelay_) }, + //{ 0x01D01C80, "_ZN11CBaseEntity8GetDelayEv", mfunc_ptr_cast(&CBaseEntity::GetDelay_) }, // DEFAULT ////{ 0x01D01C90, "_ZN11CBaseEntity8IsMovingEv", mfunc_ptr_cast(&CBaseEntity::IsMoving_) }, //{ 0x01D01CE0, "_ZN11CBaseEntity13OverrideResetEv", mfunc_ptr_cast(&CBaseEntity::OverrideReset_) }, // PURE { 0x01D63AF0, "_ZN11CBaseEntity11DamageDecalEi", mfunc_ptr_cast(&CBaseEntity::DamageDecal_) }, @@ -425,7 +426,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x01D01EE0, "_ZN11CBaseEntity6CenterEv", mfunc_ptr_cast(&CBaseEntity::Center_) }, // default //{ 0x01D01F40, "_ZN11CBaseEntity11EyePositionEv", mfunc_ptr_cast(&CBaseEntity::EyePosition_) }, // default //{ 0x01D01F70, "_ZN11CBaseEntity11EarPositionEv", mfunc_ptr_cast(&CBaseEntity::EarPosition_) }, // default - { 0x01D01FA0, "_ZN11CBaseEntity10BodyTargetERK6Vector", mfunc_ptr_cast(&CBaseEntity::BodyTarget_) }, + //{ 0x01D01FA0, "_ZN11CBaseEntity10BodyTargetERK6Vector", mfunc_ptr_cast(&CBaseEntity::BodyTarget_) },// default //{ 0x01D01FC0, "_ZN11CBaseEntity12IlluminationEv", mfunc_ptr_cast(&CBaseEntity::Illumination_) }, // default { 0x01D71840, "_ZN11CBaseEntity8FVisibleEPS_", mfunc_ptr_cast(&CBaseEntity::FVisible_) }, { 0x01D71950, "_ZN11CBaseEntity8FVisibleERK6Vector", mfunc_ptr_cast(&CBaseEntity::FVisible_) }, @@ -449,7 +450,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D63B20, "_ZN11CBaseEntity6CreateEPcRK6VectorS3_P7edict_s", mfunc_ptr_cast(&CBaseEntity::Create) }, //CPointEntity { 0x01DBACC0, "_ZN12CPointEntity5SpawnEv", mfunc_ptr_cast(&CPointEntity::Spawn_) }, - { 0x01D60CB0, "_ZN12CPointEntity10ObjectCapsEv", mfunc_ptr_cast(&CPointEntity::ObjectCaps_) }, + //{ 0x01D60CB0, "_ZN12CPointEntity10ObjectCapsEv", mfunc_ptr_cast(&CPointEntity::ObjectCaps_) }, // default //CNullEntity { 0x01DBACD0, "_ZN11CNullEntity5SpawnEv", mfunc_ptr_cast(&CNullEntity::Spawn_) }, //CBaseDMStart @@ -530,7 +531,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x01DBAB20, "_ZN14CBaseSpectator16SpectatorConnectEv", mfunc_ptr_cast(&CBaseSpectator::SpectatorConnect) }, // NOXREF //{ 0x01DBAB50, "_ZN14CBaseSpectator19SpectatorDisconnectEv", mfunc_ptr_cast(&CBaseSpectator::SpectatorDisconnect) }, // NOXREF //{ 0x01DBAC40, "_ZN14CBaseSpectator14SpectatorThinkEv", mfunc_ptr_cast(&CBaseSpectator::SpectatorThink) }, // NOXREF - { 0x01DBAB60, "_ZN14CBaseSpectator23SpectatorImpulseCommandEv", mfunc_ptr_cast(&CBaseSpectator::SpectatorImpulseCommand) }, + //{ 0x01DBAB60, "_ZN14CBaseSpectator23SpectatorImpulseCommandEv", mfunc_ptr_cast(&CBaseSpectator::SpectatorImpulseCommand) }, // PRIVATE #endif // Spectator_Region @@ -542,8 +543,8 @@ FunctionHook g_FunctionHooks[] = { 0x01D70180, "_ZN12CBaseMonster10TakeDamageEP9entvars_sS1_fi", mfunc_ptr_cast(&CBaseMonster::TakeDamage_) }, { 0x01D70130, "_ZN12CBaseMonster10TakeHealthEfi", mfunc_ptr_cast(&CBaseMonster::TakeHealth_) }, { 0x01D6F9D0, "_ZN12CBaseMonster6KilledEP9entvars_si", mfunc_ptr_cast(&CBaseMonster::Killed_) }, - { 0x01D20F50, "_ZN12CBaseMonster10BloodColorEv", mfunc_ptr_cast(&CBaseMonster::BloodColor_) }, - { 0x01D24CF0, "_ZN12CBaseMonster7IsAliveEv", mfunc_ptr_cast(&CBaseMonster::IsAlive_) }, + //{ 0x01D20F50, "_ZN12CBaseMonster10BloodColorEv", mfunc_ptr_cast(&CBaseMonster::BloodColor_) }, // DEFAULT + //{ 0x01D24CF0, "_ZN12CBaseMonster7IsAliveEv", mfunc_ptr_cast(&CBaseMonster::IsAlive_) }, // DEFAULT { 0x01D8ABF0, "_ZN12CBaseMonster9ChangeYawEi", mfunc_ptr_cast(&CBaseMonster::ChangeYaw_) }, { 0x01D6F360, "_ZN12CBaseMonster12HasHumanGibsEv", mfunc_ptr_cast(&CBaseMonster::HasHumanGibs_) }, { 0x01D6F390, "_ZN12CBaseMonster12HasAlienGibsEv", mfunc_ptr_cast(&CBaseMonster::HasAlienGibs_) }, @@ -592,7 +593,7 @@ FunctionHook g_FunctionHooks[] = { 0x01DA5E40, "_ZN11CBasePlayer8PrecacheEv", mfunc_ptr_cast(&CBasePlayer::Precache_) }, { 0x01DA5EE0, "_ZN11CBasePlayer4SaveER5CSave", mfunc_ptr_cast(&CBasePlayer::Save_) }, { 0x01DA6080, "_ZN11CBasePlayer7RestoreER8CRestore", mfunc_ptr_cast(&CBasePlayer::Restore_) }, - { 0x01D210A0, "_ZN11CBasePlayer10ObjectCapsEv", mfunc_ptr_cast(&CBasePlayer::ObjectCaps_) }, + //{ 0x01D210A0, "_ZN11CBasePlayer10ObjectCapsEv", mfunc_ptr_cast(&CBasePlayer::ObjectCaps_) }, // DEFAULT { 0x01DA3550, "_ZN11CBasePlayer8ClassifyEv", mfunc_ptr_cast(&CBasePlayer::Classify_) }, { 0x01D9BE00, "_ZN11CBasePlayer11TraceAttackEP9entvars_sf6VectorP11TraceResulti", mfunc_ptr_cast(&CBasePlayer::TraceAttack_) }, { 0x01D9C4C0, "_ZN11CBasePlayer10TakeDamageEP9entvars_sS1_fi", mfunc_ptr_cast(&CBasePlayer::TakeDamage_) }, @@ -603,30 +604,30 @@ FunctionHook g_FunctionHooks[] = { 0x01DA86C0, "_ZN11CBasePlayer13AddPlayerItemEP15CBasePlayerItem", mfunc_ptr_cast(&CBasePlayer::AddPlayerItem_) }, { 0x01DA8960, "_ZN11CBasePlayer16RemovePlayerItemEP15CBasePlayerItem", mfunc_ptr_cast(&CBasePlayer::RemovePlayerItem_) }, { 0x01DA8AA0, "_ZN11CBasePlayer8GiveAmmoEiPci", mfunc_ptr_cast(&CBasePlayer::GiveAmmo_) }, - { 0x01D20FD0, "_ZN11CBasePlayer13StartSneakingEv", mfunc_ptr_cast(&CBasePlayer::StartSneaking_) }, - { 0x01D20FF0, "_ZN11CBasePlayer12StopSneakingEv", mfunc_ptr_cast(&CBasePlayer::StopSneaking_) }, - { 0x01D21010, "_ZN11CBasePlayer10IsSneakingEv", mfunc_ptr_cast(&CBasePlayer::IsSneaking_) }, - { 0x01D21030, "_ZN11CBasePlayer7IsAliveEv", mfunc_ptr_cast(&CBasePlayer::IsAlive_) }, - { 0x01D21070, "_ZN11CBasePlayer8IsPlayerEv", mfunc_ptr_cast(&CBasePlayer::IsPlayer_) }, - { 0x01D21090, "_ZN11CBasePlayer11IsNetClientEv", mfunc_ptr_cast(&CBasePlayer::IsNetClient_) }, + //{ 0x01D20FD0, "_ZN11CBasePlayer13StartSneakingEv", mfunc_ptr_cast(&CBasePlayer::StartSneaking_) }, // DEFAULT + //{ 0x01D20FF0, "_ZN11CBasePlayer12StopSneakingEv", mfunc_ptr_cast(&CBasePlayer::StopSneaking_) }, // DEFAULT + //{ 0x01D21010, "_ZN11CBasePlayer10IsSneakingEv", mfunc_ptr_cast(&CBasePlayer::IsSneaking_) }, // DEFAULT + //{ 0x01D21030, "_ZN11CBasePlayer7IsAliveEv", mfunc_ptr_cast(&CBasePlayer::IsAlive_) }, // DEFAULT + //{ 0x01D21070, "_ZN11CBasePlayer8IsPlayerEv", mfunc_ptr_cast(&CBasePlayer::IsPlayer_) }, // DEFAULT + //{ 0x01D21090, "_ZN11CBasePlayer11IsNetClientEv", mfunc_ptr_cast(&CBasePlayer::IsNetClient_) }, // DEFAULT { 0x01DA6950, "_ZN11CBasePlayer6TeamIDEv", mfunc_ptr_cast(&CBasePlayer::TeamID_) }, { 0x01DA9BF0, "_ZN11CBasePlayer12FBecomeProneEv", mfunc_ptr_cast(&CBasePlayer::FBecomeProne_) }, - { 0x01D20F60, "_ZN11CBasePlayer10BodyTargetERK6Vector", mfunc_ptr_cast(&CBasePlayer::BodyTarget_) }, + //{ 0x01D20F60, "_ZN11CBasePlayer10BodyTargetERK6Vector", mfunc_ptr_cast(&CBasePlayer::BodyTarget_) }, // DEFAULT { 0x01DA9C50, "_ZN11CBasePlayer12IlluminationEv", mfunc_ptr_cast(&CBasePlayer::Illumination_) }, - { 0x01D21060, "_ZN11CBasePlayer17ShouldFadeOnDeathEv", mfunc_ptr_cast(&CBasePlayer::ShouldFadeOnDeath_) }, + //{ 0x01D21060, "_ZN11CBasePlayer17ShouldFadeOnDeathEv", mfunc_ptr_cast(&CBasePlayer::ShouldFadeOnDeath_) }, // DEFAULT { 0x01DA9CB0, "_ZN11CBasePlayer13ResetMaxSpeedEv", mfunc_ptr_cast(&CBasePlayer::ResetMaxSpeed_) }, { 0x01DA3310, "_ZN11CBasePlayer4JumpEv", mfunc_ptr_cast(&CBasePlayer::Jump_) }, { 0x01DA3530, "_ZN11CBasePlayer4DuckEv", mfunc_ptr_cast(&CBasePlayer::Duck_) }, { 0x01DA3850, "_ZN11CBasePlayer8PreThinkEv", mfunc_ptr_cast(&CBasePlayer::PreThink_) }, { 0x01DA4610, "_ZN11CBasePlayer9PostThinkEv", mfunc_ptr_cast(&CBasePlayer::PostThink_) }, { 0x01D9BD80, "_ZN11CBasePlayer14GetGunPositionEv", mfunc_ptr_cast(&CBasePlayer::GetGunPosition_) }, - { 0x01D25AD0, "_ZN11CBasePlayer5IsBotEv", mfunc_ptr_cast(&CBasePlayer::IsBot_) }, + //{ 0x01D25AD0, "_ZN11CBasePlayer5IsBotEv", mfunc_ptr_cast(&CBasePlayer::IsBot_) }, // DEFAULT { 0x01DA8F90, "_ZN11CBasePlayer16UpdateClientDataEv", mfunc_ptr_cast(&CBasePlayer::UpdateClientData_) }, { 0x01DA7020, "_ZN11CBasePlayer15ImpulseCommandsEv", mfunc_ptr_cast(&CBasePlayer::ImpulseCommands_) }, { 0x01DA2490, "_ZN11CBasePlayer12RoundRespawnEv", mfunc_ptr_cast(&CBasePlayer::RoundRespawn_) }, { 0x01DA9DC0, "_ZN11CBasePlayer16GetAutoaimVectorEf", mfunc_ptr_cast(&CBasePlayer::GetAutoaimVector_) }, { 0x01DAA220, "_ZN11CBasePlayer5BlindEfffi", mfunc_ptr_cast(&CBasePlayer::Blind_) }, - { 0x01D25AE0, "_ZN11CBasePlayer16OnTouchingWeaponEP10CWeaponBox", mfunc_ptr_cast(&CBasePlayer::OnTouchingWeapon_) }, // pure + //{ 0x01D25AE0, "_ZN11CBasePlayer16OnTouchingWeaponEP10CWeaponBox", mfunc_ptr_cast(&CBasePlayer::OnTouchingWeapon_) }, // DEFAULT //non-virtual func { 0x01DAC8D0, "_ZN11CBasePlayer21SpawnClientSideCorpseEv", mfunc_ptr_cast(&CBasePlayer::SpawnClientSideCorpse) }, { 0x01D93750, "_ZN11CBasePlayer23Observer_FindNextPlayerEbPKc", mfunc_ptr_cast(&CBasePlayer::Observer_FindNextPlayer) }, @@ -728,7 +729,7 @@ FunctionHook g_FunctionHooks[] = { 0x01DA3290, "_ZN11CBasePlayer11HostageUsedEv", mfunc_ptr_cast(&CBasePlayer::HostageUsed) }, { 0x01DA1680, "_ZN11CBasePlayer12JoiningThinkEv", mfunc_ptr_cast(&CBasePlayer::JoiningThink) }, //{ 0x01DA1480, "_ZN11CBasePlayer15RemoveLevelTextEv", mfunc_ptr_cast(&CBasePlayer::RemoveLevelText) }, // NOXREF - { 0x01DA14D0, "_ZN11CBasePlayer9MenuPrintEPS_PKc", mfunc_ptr_cast(&CBasePlayer::MenuPrint) }, + //!!{ 0x01DA14D0, "_ZN11CBasePlayer9MenuPrintEPS_PKc", mfunc_ptr_cast(&CBasePlayer::MenuPrint) }, hook with attribute __stdcall //{ 0x01DA11F0, "_ZN11CBasePlayer9ResetMenuEv", mfunc_ptr_cast(&CBasePlayer::ResetMenu) }, // NOXREF { 0x01DA1240, "_ZN11CBasePlayer14SyncRoundTimerEv", mfunc_ptr_cast(&CBasePlayer::SyncRoundTimer) }, { 0x01DA4220, "_ZN11CBasePlayer15CheckSuitUpdateEv", mfunc_ptr_cast(&CBasePlayer::CheckSuitUpdate) }, @@ -844,7 +845,7 @@ FunctionHook g_FunctionHooks[] = //CSprayCan //virtual func { 0x01DA6A30, "_ZN9CSprayCan5ThinkEv", mfunc_ptr_cast(&CSprayCan::Think_) }, - { 0x01DA73B0, "_ZN9CSprayCan10ObjectCapsEv", mfunc_ptr_cast(&CSprayCan::ObjectCaps_) }, + //{ 0x01DA73B0, "_ZN9CSprayCan10ObjectCapsEv", mfunc_ptr_cast(&CSprayCan::ObjectCaps_) }, // DEFAULT //non-virtual func { 0x01DA6970, "_ZN9CSprayCan5SpawnEP9entvars_s", mfunc_ptr_cast(&CSprayCan::Spawn) }, // NOXREF //CBloodSplat @@ -890,7 +891,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D79440, "_ZN7CSprite7RestartEv", mfunc_ptr_cast(&CSprite::Restart_) }, { 0x01D79290, "_ZN7CSprite4SaveER5CSave", mfunc_ptr_cast(&CSprite::Save_) }, { 0x01D792C0, "_ZN7CSprite7RestoreER8CRestore", mfunc_ptr_cast(&CSprite::Restore_) }, - { 0x01D78660, "_ZN7CSprite10ObjectCapsEv", mfunc_ptr_cast(&CSprite::ObjectCaps_) }, + //{ 0x01D78660, "_ZN7CSprite10ObjectCapsEv", mfunc_ptr_cast(&CSprite::ObjectCaps_) }, // DEFAULT { 0x01D79AE0, "_ZN7CSprite3UseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CSprite::Use_) }, //non-virtual func { 0x01D79740, "_ZN7CSprite12AnimateThinkEv", mfunc_ptr_cast(&CSprite::AnimateThink) }, @@ -914,8 +915,8 @@ FunctionHook g_FunctionHooks[] = //virtual func { 0x01D75E00, "_ZN5CBeam5SpawnEv", mfunc_ptr_cast(&CBeam::Spawn_) }, { 0x01D75E20, "_ZN5CBeam8PrecacheEv", mfunc_ptr_cast(&CBeam::Precache_) }, - { 0x01D788B0, "_ZN5CBeam10ObjectCapsEv", mfunc_ptr_cast(&CBeam::ObjectCaps_) }, - { 0x01D78D20, "_ZN5CBeam6CenterEv", mfunc_ptr_cast(&CBeam::Center_) }, + //{ 0x01D788B0, "_ZN5CBeam10ObjectCapsEv", mfunc_ptr_cast(&CBeam::ObjectCaps_) }, // DEFAULT + //{ 0x01D78D20, "_ZN5CBeam6CenterEv", mfunc_ptr_cast(&CBeam::Center_) }, // DEFAULT //non-virtual func { 0x01D76660, "_ZN5CBeam12TriggerTouchEP11CBaseEntity", mfunc_ptr_cast(&CBeam::TriggerTouch) }, //{ 0x0, "_ZN5CBeam7SetTypeEi", mfunc_ptr_cast(&CBeam::SetType) }, // NOXREF @@ -978,7 +979,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D75C30, "_ZN9CBubbling8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CBubbling::KeyValue_) }, { 0x01D75A30, "_ZN9CBubbling4SaveER5CSave", mfunc_ptr_cast(&CBubbling::Save_) }, { 0x01D75A60, "_ZN9CBubbling7RestoreER8CRestore", mfunc_ptr_cast(&CBubbling::Restore_) }, - { 0x01D75A20, "_ZN9CBubbling10ObjectCapsEv", mfunc_ptr_cast(&CBubbling::ObjectCaps_) }, + //{ 0x01D75A20, "_ZN9CBubbling10ObjectCapsEv", mfunc_ptr_cast(&CBubbling::ObjectCaps_) }, // DEFAULT { 0x01D75BC0, "_ZN9CBubbling3UseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CBubbling::Use_) }, //non-virtual func { 0x01D75CF0, "_ZN9CBubbling9FizzThinkEv", mfunc_ptr_cast(&CBubbling::FizzThink) }, @@ -1126,8 +1127,8 @@ FunctionHook g_FunctionHooks[] = { 0x01D953E0, "_ZN14CBasePlatTrain8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CBasePlatTrain::KeyValue_) }, { 0x01D95380, "_ZN14CBasePlatTrain4SaveER5CSave", mfunc_ptr_cast(&CBasePlatTrain::Save_) }, { 0x01D953B0, "_ZN14CBasePlatTrain7RestoreER8CRestore", mfunc_ptr_cast(&CBasePlatTrain::Restore_) }, - { 0x01D95890, "_ZN14CBasePlatTrain10ObjectCapsEv", mfunc_ptr_cast(&CBasePlatTrain::ObjectCaps_) }, - { 0x01D958A0, "_ZN14CBasePlatTrain12IsTogglePlatEv", mfunc_ptr_cast(&CBasePlatTrain::IsTogglePlat_) }, + //{ 0x01D95890, "_ZN14CBasePlatTrain10ObjectCapsEv", mfunc_ptr_cast(&CBasePlatTrain::ObjectCaps_) }, // DEFAULT + //{ 0x01D958A0, "_ZN14CBasePlatTrain12IsTogglePlatEv", mfunc_ptr_cast(&CBasePlatTrain::IsTogglePlat_) }, // DEFAULT //CFuncPlat //virtual func { 0x01D95AF0, "_ZN9CFuncPlat5SpawnEv", mfunc_ptr_cast(&CFuncPlat::Spawn_) }, @@ -1145,7 +1146,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D95830, "_ZN9CFuncPlat13CallHitBottomEv", mfunc_ptr_cast(&CFuncPlat::CallHitBottom) }, //CPlatTrigger //virtual func - { 0x01D95AE0, "_ZN12CPlatTrigger10ObjectCapsEv", mfunc_ptr_cast(&CPlatTrigger::ObjectCaps_) }, + //{ 0x01D95AE0, "_ZN12CPlatTrigger10ObjectCapsEv", mfunc_ptr_cast(&CPlatTrigger::ObjectCaps_) }, // DEFAULT { 0x01D95C90, "_ZN12CPlatTrigger5TouchEP11CBaseEntity", mfunc_ptr_cast(&CPlatTrigger::Touch_) }, //non-virtual func { 0x01D95B50, "_ZN12CPlatTrigger18SpawnInsideTriggerEP9CFuncPlat", mfunc_ptr_cast(&CPlatTrigger::SpawnInsideTrigger) }, @@ -1184,7 +1185,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D97310, "_ZN15CFuncTrackTrain8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CFuncTrackTrain::KeyValue_) }, { 0x01D97260, "_ZN15CFuncTrackTrain4SaveER5CSave", mfunc_ptr_cast(&CFuncTrackTrain::Save_) }, { 0x01D97290, "_ZN15CFuncTrackTrain7RestoreER8CRestore", mfunc_ptr_cast(&CFuncTrackTrain::Restore_) }, - { 0x01D97630, "_ZN15CFuncTrackTrain10ObjectCapsEv", mfunc_ptr_cast(&CFuncTrackTrain::ObjectCaps_) }, + //{ 0x01D97630, "_ZN15CFuncTrackTrain10ObjectCapsEv", mfunc_ptr_cast(&CFuncTrackTrain::ObjectCaps_) }, // DEFAULT { 0x01D98980, "_ZN15CFuncTrackTrain13OverrideResetEv", mfunc_ptr_cast(&CFuncTrackTrain::OverrideReset_) }, { 0x01D98490, "_ZN15CFuncTrackTrain10OnControlsEP9entvars_s", mfunc_ptr_cast(&CFuncTrackTrain::OnControls_) }, { 0x01D97640, "_ZN15CFuncTrackTrain3UseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CFuncTrackTrain::Use_) }, @@ -1203,7 +1204,7 @@ FunctionHook g_FunctionHooks[] = //CFuncTrainControls //virtual func { 0x01D98FF0, "_ZN18CFuncTrainControls5SpawnEv", mfunc_ptr_cast(&CFuncTrainControls::Spawn_) }, - { 0x01D98E60, "_ZN18CFuncTrainControls10ObjectCapsEv", mfunc_ptr_cast(&CFuncTrainControls::ObjectCaps_) }, + //{ 0x01D98E60, "_ZN18CFuncTrainControls10ObjectCapsEv", mfunc_ptr_cast(&CFuncTrainControls::ObjectCaps_) }, // DEFAULT //non-virtual func { 0x01D98E70, "_ZN18CFuncTrainControls4FindEv", mfunc_ptr_cast(&CFuncTrainControls::Find) }, //CFuncTrackChange @@ -1238,13 +1239,13 @@ FunctionHook g_FunctionHooks[] = { 0x01D9A480, "_ZN10CGunTarget5SpawnEv", mfunc_ptr_cast(&CGunTarget::Spawn_) }, { 0x01D9A420, "_ZN10CGunTarget4SaveER5CSave", mfunc_ptr_cast(&CGunTarget::Save_) }, { 0x01D9A450, "_ZN10CGunTarget7RestoreER8CRestore", mfunc_ptr_cast(&CGunTarget::Restore_) }, - { 0x01D9A410, "_ZN10CGunTarget10ObjectCapsEv", mfunc_ptr_cast(&CGunTarget::ObjectCaps_) }, + //{ 0x01D9A410, "_ZN10CGunTarget10ObjectCapsEv", mfunc_ptr_cast(&CGunTarget::ObjectCaps_) }, // DEFAULT { 0x01D9A550, "_ZN10CGunTarget8ActivateEv", mfunc_ptr_cast(&CGunTarget::Activate_) }, - { 0x01D9A3E0, "_ZN10CGunTarget8ClassifyEv", mfunc_ptr_cast(&CGunTarget::Classify_) }, + //{ 0x01D9A3E0, "_ZN10CGunTarget8ClassifyEv", mfunc_ptr_cast(&CGunTarget::Classify_) }, // DEFAULT { 0x01D9A8D0, "_ZN10CGunTarget10TakeDamageEP9entvars_sS1_fi", mfunc_ptr_cast(&CGunTarget::TakeDamage_) }, - { 0x01D9A3D0, "_ZN10CGunTarget10BloodColorEv", mfunc_ptr_cast(&CGunTarget::BloodColor_) }, + //{ 0x01D9A3D0, "_ZN10CGunTarget10BloodColorEv", mfunc_ptr_cast(&CGunTarget::BloodColor_) }, // DEFAULT { 0x01D9A990, "_ZN10CGunTarget3UseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CGunTarget::Use_) }, - { 0x01D9A3F0, "_ZN10CGunTarget10BodyTargetERK6Vector", mfunc_ptr_cast(&CGunTarget::BodyTarget_) }, + //{ 0x01D9A3F0, "_ZN10CGunTarget10BodyTargetERK6Vector", mfunc_ptr_cast(&CGunTarget::BodyTarget_) }, // DEFAULT //non-virtual func { 0x01D9A610, "_ZN10CGunTarget4NextEv", mfunc_ptr_cast(&CGunTarget::Next) }, { 0x01D9A600, "_ZN10CGunTarget5StartEv", mfunc_ptr_cast(&CGunTarget::Start) }, @@ -1294,7 +1295,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D94590, "_ZN11CPathCorner8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CPathCorner::KeyValue_) }, { 0x01D94530, "_ZN11CPathCorner4SaveER5CSave", mfunc_ptr_cast(&CPathCorner::Save_) }, { 0x01D94560, "_ZN11CPathCorner7RestoreER8CRestore", mfunc_ptr_cast(&CPathCorner::Restore_) }, - { 0x01D94520, "_ZN11CPathCorner8GetDelayEv", mfunc_ptr_cast(&CPathCorner::GetDelay_) }, + //{ 0x01D94520, "_ZN11CPathCorner8GetDelayEv", mfunc_ptr_cast(&CPathCorner::GetDelay_) }, // DEFAULT //linked objects { 0x01D944D0, "path_corner", (size_t)&path_corner }, @@ -1310,7 +1311,7 @@ FunctionHook g_FunctionHooks[] = { 0x01DC9370, "_ZN12CFuncVehicle8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CFuncVehicle::KeyValue_) }, { 0x01DC92C0, "_ZN12CFuncVehicle4SaveER5CSave", mfunc_ptr_cast(&CFuncVehicle::Save_) }, { 0x01DC92F0, "_ZN12CFuncVehicle7RestoreER8CRestore", mfunc_ptr_cast(&CFuncVehicle::Restore_) }, - { 0x01DCB970, "_ZN12CFuncVehicle10ObjectCapsEv", mfunc_ptr_cast(&CFuncVehicle::ObjectCaps_) }, + //{ 0x01DCB970, "_ZN12CFuncVehicle10ObjectCapsEv", mfunc_ptr_cast(&CFuncVehicle::ObjectCaps_) }, // DEFAULT { 0x01DCBFB0, "_ZN12CFuncVehicle8ClassifyEv", mfunc_ptr_cast(&CFuncVehicle::Classify_) }, { 0x01DCBF20, "_ZN12CFuncVehicle13OverrideResetEv", mfunc_ptr_cast(&CFuncVehicle::OverrideReset_) }, { 0x01DCBA30, "_ZN12CFuncVehicle10OnControlsEP9entvars_s", mfunc_ptr_cast(&CFuncVehicle::OnControls_) }, @@ -1341,7 +1342,7 @@ FunctionHook g_FunctionHooks[] = //CFuncVehicleControls //virtual func { 0x01DCC5F0, "_ZN20CFuncVehicleControls5SpawnEv", mfunc_ptr_cast(&CFuncVehicleControls::Spawn_) }, - { 0x01DCC460, "_ZN20CFuncVehicleControls10ObjectCapsEv", mfunc_ptr_cast(&CFuncVehicleControls::ObjectCaps_) }, + //{ 0x01DCC460, "_ZN20CFuncVehicleControls10ObjectCapsEv", mfunc_ptr_cast(&CFuncVehicleControls::ObjectCaps_) }, // DEFAULT //non-virtual func { 0x01DCC470, "_ZN20CFuncVehicleControls4FindEv", mfunc_ptr_cast(&CFuncVehicleControls::Find) }, //linked objects @@ -1358,7 +1359,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D7E1E0, "_ZN9CFuncTank8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CFuncTank::KeyValue_) }, { 0x01D7DEB0, "_ZN9CFuncTank4SaveER5CSave", mfunc_ptr_cast(&CFuncTank::Save_) }, { 0x01D7DEE0, "_ZN9CFuncTank7RestoreER8CRestore", mfunc_ptr_cast(&CFuncTank::Restore_) }, - { 0x01D7FA70, "_ZN9CFuncTank10ObjectCapsEv", mfunc_ptr_cast(&CFuncTank::ObjectCaps_) }, + //{ 0x01D7FA70, "_ZN9CFuncTank10ObjectCapsEv", mfunc_ptr_cast(&CFuncTank::ObjectCaps_) }, // DEFAULT //{ 0x01D7E620, "_ZN9CFuncTank10OnControlsEP9entvars_s", mfunc_ptr_cast(&CFuncTank::OnControls_) }, // DEFAULT { 0x01D7EBD0, "_ZN9CFuncTank5ThinkEv", mfunc_ptr_cast(&CFuncTank::Think_) }, { 0x01D7E9A0, "_ZN9CFuncTank3UseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CFuncTank::Use_) }, @@ -1406,7 +1407,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D80590, "_ZN17CFuncTankControls5SpawnEv", mfunc_ptr_cast(&CFuncTankControls::Spawn_) }, { 0x01D80450, "_ZN17CFuncTankControls4SaveER5CSave", mfunc_ptr_cast(&CFuncTankControls::Save_) }, { 0x01D80480, "_ZN17CFuncTankControls7RestoreER8CRestore", mfunc_ptr_cast(&CFuncTankControls::Restore_) }, - { 0x01D804B0, "_ZN17CFuncTankControls10ObjectCapsEv", mfunc_ptr_cast(&CFuncTankControls::ObjectCaps_) }, + //{ 0x01D804B0, "_ZN17CFuncTankControls10ObjectCapsEv", mfunc_ptr_cast(&CFuncTankControls::ObjectCaps_) }, // DEFAULT { 0x01D804E0, "_ZN17CFuncTankControls5ThinkEv", mfunc_ptr_cast(&CFuncTankControls::Think_) }, { 0x01D804C0, "_ZN17CFuncTankControls3UseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CFuncTankControls::Use_) }, //linked objects @@ -1428,7 +1429,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D7C180, "_ZN10CBreakable8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CBreakable::KeyValue_) }, { 0x01D7C3B0, "_ZN10CBreakable4SaveER5CSave", mfunc_ptr_cast(&CBreakable::Save_) }, { 0x01D7C3E0, "_ZN10CBreakable7RestoreER8CRestore", mfunc_ptr_cast(&CBreakable::Restore_) }, - { 0x01D7DEA0, "_ZN10CBreakable10ObjectCapsEv", mfunc_ptr_cast(&CBreakable::ObjectCaps_) }, + //{ 0x01D7DEA0, "_ZN10CBreakable10ObjectCapsEv", mfunc_ptr_cast(&CBreakable::ObjectCaps_) }, // DEFAULT { 0x01D7CDC0, "_ZN10CBreakable11TraceAttackEP9entvars_sf6VectorP11TraceResulti", mfunc_ptr_cast(&CBreakable::TraceAttack_) }, { 0x01D7CEB0, "_ZN10CBreakable10TakeDamageEP9entvars_sS1_fi", mfunc_ptr_cast(&CBreakable::TakeDamage_) }, { 0x01D7D6D0, "_ZN10CBreakable11DamageDecalEi", mfunc_ptr_cast(&CBreakable::DamageDecal_) }, @@ -1452,7 +1453,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D7D960, "_ZN9CPushable8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CPushable::KeyValue_) }, { 0x01D7D700, "_ZN9CPushable4SaveER5CSave", mfunc_ptr_cast(&CPushable::Save_) }, { 0x01D7D750, "_ZN9CPushable7RestoreER8CRestore", mfunc_ptr_cast(&CPushable::Restore_) }, - { 0x01D7D7F0, "_ZN9CPushable10ObjectCapsEv", mfunc_ptr_cast(&CPushable::ObjectCaps_) }, + //{ 0x01D7D7F0, "_ZN9CPushable10ObjectCapsEv", mfunc_ptr_cast(&CPushable::ObjectCaps_) }, // DEFAULT { 0x01D7DE70, "_ZN9CPushable10TakeDamageEP9entvars_sS1_fi", mfunc_ptr_cast(&CPushable::TakeDamage_) }, { 0x01D7DC30, "_ZN9CPushable5TouchEP11CBaseEntity", mfunc_ptr_cast(&CPushable::Touch_) }, { 0x01D7DB40, "_ZN9CPushable3UseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CPushable::Use_) }, @@ -1476,7 +1477,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D73AA0, "_ZN9CBaseDoor8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CBaseDoor::KeyValue_) }, { 0x01D73820, "_ZN9CBaseDoor4SaveER5CSave", mfunc_ptr_cast(&CBaseDoor::Save_) }, { 0x01D73850, "_ZN9CBaseDoor7RestoreER8CRestore", mfunc_ptr_cast(&CBaseDoor::Restore_) }, - { 0x01D73D10, "_ZN9CBaseDoor10ObjectCapsEv", mfunc_ptr_cast(&CBaseDoor::ObjectCaps_) }, + //{ 0x01D73D10, "_ZN9CBaseDoor10ObjectCapsEv", mfunc_ptr_cast(&CBaseDoor::ObjectCaps_) }, // DEFAULT { 0x01D73F90, "_ZN9CBaseDoor14SetToggleStateEi", mfunc_ptr_cast(&CBaseDoor::SetToggleState_) }, { 0x01D74540, "_ZN9CBaseDoor3UseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CBaseDoor::Use_) }, { 0x01D74CB0, "_ZN9CBaseDoor7BlockedEP11CBaseEntity", mfunc_ptr_cast(&CBaseDoor::Blocked_) }, @@ -1499,7 +1500,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D75780, "_ZN14CMomentaryDoor8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CMomentaryDoor::KeyValue_) }, { 0x01D75450, "_ZN14CMomentaryDoor4SaveER5CSave", mfunc_ptr_cast(&CMomentaryDoor::Save_) }, { 0x01D75480, "_ZN14CMomentaryDoor7RestoreER8CRestore", mfunc_ptr_cast(&CMomentaryDoor::Restore_) }, - { 0x01D75440, "_ZN14CMomentaryDoor10ObjectCapsEv", mfunc_ptr_cast(&CMomentaryDoor::ObjectCaps_) }, + //{ 0x01D75440, "_ZN14CMomentaryDoor10ObjectCapsEv", mfunc_ptr_cast(&CMomentaryDoor::ObjectCaps_) }, // DEFAULT { 0x01D75820, "_ZN14CMomentaryDoor3UseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CMomentaryDoor::Use_) }, //non-class func { 0x01D73880, "_Z14PlayLockSoundsP9entvars_sP10locksoundsii", (size_t)&PlayLockSounds }, @@ -1516,7 +1517,7 @@ FunctionHook g_FunctionHooks[] = //CFuncWall //virtual func { 0x01D5CFE0, "_ZN9CFuncWall5SpawnEv", mfunc_ptr_cast(&CFuncWall::Spawn_) }, - { 0x01D5CFD0, "_ZN9CFuncWall10ObjectCapsEv", mfunc_ptr_cast(&CFuncWall::ObjectCaps_) }, + //{ 0x01D5CFD0, "_ZN9CFuncWall10ObjectCapsEv", mfunc_ptr_cast(&CFuncWall::ObjectCaps_) }, // DEFAULT { 0x01D5D060, "_ZN9CFuncWall3UseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CFuncWall::Use_) }, //CFuncWallToggle //virtual func @@ -1536,7 +1537,7 @@ FunctionHook g_FunctionHooks[] = //virtual func { 0x01D5D640, "_ZN16CFuncIllusionary5SpawnEv", mfunc_ptr_cast(&CFuncIllusionary::Spawn_) }, { 0x01D5D5E0, "_ZN16CFuncIllusionary8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CFuncIllusionary::KeyValue_) }, - { 0x01D5D5D0, "_ZN16CFuncIllusionary10ObjectCapsEv", mfunc_ptr_cast(&CFuncIllusionary::ObjectCaps_) }, + //{ 0x01D5D5D0, "_ZN16CFuncIllusionary10ObjectCapsEv", mfunc_ptr_cast(&CFuncIllusionary::ObjectCaps_) }, // DEFAULT //CFuncMonsterClip //virtual func { 0x01D5D700, "_ZN16CFuncMonsterClip5SpawnEv", mfunc_ptr_cast(&CFuncMonsterClip::Spawn_) }, @@ -1548,7 +1549,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D5D870, "_ZN13CFuncRotating8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CFuncRotating::KeyValue_) }, { 0x01D5D7B0, "_ZN13CFuncRotating4SaveER5CSave", mfunc_ptr_cast(&CFuncRotating::Save_) }, { 0x01D5D7E0, "_ZN13CFuncRotating7RestoreER8CRestore", mfunc_ptr_cast(&CFuncRotating::Restore_) }, - { 0x01D5D860, "_ZN13CFuncRotating10ObjectCapsEv", mfunc_ptr_cast(&CFuncRotating::ObjectCaps_) }, + //{ 0x01D5D860, "_ZN13CFuncRotating10ObjectCapsEv", mfunc_ptr_cast(&CFuncRotating::ObjectCaps_) }, // DEFAULT { 0x01D5E590, "_ZN13CFuncRotating7BlockedEP11CBaseEntity", mfunc_ptr_cast(&CFuncRotating::Blocked_) }, //non-virtual func { 0x01D5E050, "_ZN13CFuncRotating6SpinUpEv", mfunc_ptr_cast(&CFuncRotating::SpinUp) }, @@ -1563,7 +1564,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D5E670, "_ZN9CPendulum8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CPendulum::KeyValue_) }, { 0x01D5E610, "_ZN9CPendulum4SaveER5CSave", mfunc_ptr_cast(&CPendulum::Save_) }, { 0x01D5E640, "_ZN9CPendulum7RestoreER8CRestore", mfunc_ptr_cast(&CPendulum::Restore_) }, - { 0x01D5E600, "_ZN9CPendulum10ObjectCapsEv", mfunc_ptr_cast(&CPendulum::ObjectCaps_) }, + //{ 0x01D5E600, "_ZN9CPendulum10ObjectCapsEv", mfunc_ptr_cast(&CPendulum::ObjectCaps_) }, // DEFAULT { 0x01D5EC10, "_ZN9CPendulum5TouchEP11CBaseEntity", mfunc_ptr_cast(&CPendulum::Touch_) }, { 0x01D5EA10, "_ZN9CPendulum7BlockedEP11CBaseEntity", mfunc_ptr_cast(&CPendulum::Blocked_) }, //non-virtual func @@ -1598,7 +1599,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D5F1E0, "_ZN12CMultiSource5SpawnEv", mfunc_ptr_cast(&CMultiSource::Spawn_) }, { 0x01D5F120, "_ZN12CMultiSource8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CMultiSource::KeyValue_) }, { 0x01D5F230, "_ZN12CMultiSource3UseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CMultiSource::Use_) }, - { 0x01D60DF0, "_ZN12CMultiSource10ObjectCapsEv", mfunc_ptr_cast(&CMultiSource::ObjectCaps_) }, + //{ 0x01D60DF0, "_ZN12CMultiSource10ObjectCapsEv", mfunc_ptr_cast(&CMultiSource::ObjectCaps_) }, // DEFAULT { 0x01D5F310, "_ZN12CMultiSource11IsTriggeredEP11CBaseEntity", mfunc_ptr_cast(&CMultiSource::IsTriggered_) }, { 0x01D5F070, "_ZN12CMultiSource4SaveER5CSave", mfunc_ptr_cast(&CMultiSource::Save_) }, { 0x01D5F0A0, "_ZN12CMultiSource7RestoreER8CRestore", mfunc_ptr_cast(&CMultiSource::Restore_) }, @@ -1611,7 +1612,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D5F7D0, "_ZN11CBaseButton8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CBaseButton::KeyValue_) }, { 0x01D5F4B0, "_ZN11CBaseButton4SaveER5CSave", mfunc_ptr_cast(&CBaseButton::Save_) }, { 0x01D5F4E0, "_ZN11CBaseButton7RestoreER8CRestore", mfunc_ptr_cast(&CBaseButton::Restore_) }, - { 0x01D610F0, "_ZN11CBaseButton10ObjectCapsEv", mfunc_ptr_cast(&CBaseButton::ObjectCaps_) }, + //{ 0x01D610F0, "_ZN11CBaseButton10ObjectCapsEv", mfunc_ptr_cast(&CBaseButton::ObjectCaps_) }, // DEFAULT { 0x01D5F930, "_ZN11CBaseButton10TakeDamageEP9entvars_sS1_fi", mfunc_ptr_cast(&CBaseButton::TakeDamage_) }, //non-virtual func //{ 0x0, "_ZN11CBaseButton8RotSpawnEv", mfunc_ptr_cast(&CBaseButton::RotSpawn) }, // NOXREF @@ -1637,7 +1638,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D60BF0, "_ZN19CMomentaryRotButton8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CMomentaryRotButton::KeyValue_) }, { 0x01D60940, "_ZN19CMomentaryRotButton4SaveER5CSave", mfunc_ptr_cast(&CMomentaryRotButton::Save_) }, { 0x01D60970, "_ZN19CMomentaryRotButton7RestoreER8CRestore", mfunc_ptr_cast(&CMomentaryRotButton::Restore_) }, - { 0x01D609F0, "_ZN19CMomentaryRotButton10ObjectCapsEv", mfunc_ptr_cast(&CMomentaryRotButton::ObjectCaps_) }, + //{ 0x01D609F0, "_ZN19CMomentaryRotButton10ObjectCapsEv", mfunc_ptr_cast(&CMomentaryRotButton::ObjectCaps_) }, // DEFAULT { 0x01D60CC0, "_ZN19CMomentaryRotButton3UseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CMomentaryRotButton::Use_) }, //non-virtual func { 0x01D61180, "_ZN19CMomentaryRotButton3OffEv", mfunc_ptr_cast(&CMomentaryRotButton::Off) }, @@ -1682,7 +1683,7 @@ FunctionHook g_FunctionHooks[] = //CShower //virtual func { 0x01D7B960, "_ZN7CShower5SpawnEv", mfunc_ptr_cast(&CShower::Spawn_) }, - { 0x01D7B950, "_ZN7CShower10ObjectCapsEv", mfunc_ptr_cast(&CShower::ObjectCaps_) }, + //{ 0x01D7B950, "_ZN7CShower10ObjectCapsEv", mfunc_ptr_cast(&CShower::ObjectCaps_) }, // DEFAULT { 0x01D7BAD0, "_ZN7CShower5ThinkEv", mfunc_ptr_cast(&CShower::Think_) }, { 0x01D7BB60, "_ZN7CShower5TouchEP11CBaseEntity", mfunc_ptr_cast(&CShower::Touch_) }, //linked objects @@ -1711,7 +1712,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D8A500, "_ZN16CFuncMortarField8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CFuncMortarField::KeyValue_) }, { 0x01D8A4A0, "_ZN16CFuncMortarField4SaveER5CSave", mfunc_ptr_cast(&CFuncMortarField::Save_) }, { 0x01D8A4D0, "_ZN16CFuncMortarField7RestoreER8CRestore", mfunc_ptr_cast(&CFuncMortarField::Restore_) }, - { 0x01D8A490, "_ZN16CFuncMortarField10ObjectCapsEv", mfunc_ptr_cast(&CFuncMortarField::ObjectCaps_) }, + //{ 0x01D8A490, "_ZN16CFuncMortarField10ObjectCapsEv", mfunc_ptr_cast(&CFuncMortarField::ObjectCaps_) }, // DEFAULT //non-virtual func { 0x01D8A6B0, "_ZN16CFuncMortarField8FieldUseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CFuncMortarField::FieldUse) }, //linked objects @@ -1742,7 +1743,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D86980, "_ZN11CWallHealth8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CWallHealth::KeyValue_) }, { 0x01D868C0, "_ZN11CWallHealth4SaveER5CSave", mfunc_ptr_cast(&CWallHealth::Save_) }, { 0x01D868F0, "_ZN11CWallHealth7RestoreER8CRestore", mfunc_ptr_cast(&CWallHealth::Restore_) }, - { 0x01D86970, "_ZN11CWallHealth10ObjectCapsEv", mfunc_ptr_cast(&CWallHealth::ObjectCaps_) }, + //{ 0x01D86970, "_ZN11CWallHealth10ObjectCapsEv", mfunc_ptr_cast(&CWallHealth::ObjectCaps_) }, // DEFAULT { 0x01D86AF0, "_ZN11CWallHealth3UseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CWallHealth::Use_) }, //non-virtual func { 0x01D86D90, "_ZN11CWallHealth3OffEv", mfunc_ptr_cast(&CWallHealth::Off) }, @@ -1809,7 +1810,7 @@ FunctionHook g_FunctionHooks[] = //CGameTeamMaster //virtual func { 0x01D894B0, "_ZN15CGameTeamMaster8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CGameTeamMaster::KeyValue_) }, - { 0x01D894A0, "_ZN15CGameTeamMaster10ObjectCapsEv", mfunc_ptr_cast(&CGameTeamMaster::ObjectCaps_) }, + //{ 0x01D894A0, "_ZN15CGameTeamMaster10ObjectCapsEv", mfunc_ptr_cast(&CGameTeamMaster::ObjectCaps_) }, // DEFAULT { 0x01D89690, "_ZN15CGameTeamMaster11IsTriggeredEP11CBaseEntity", mfunc_ptr_cast(&CGameTeamMaster::IsTriggered_) }, { 0x01D896E0, "_ZN15CGameTeamMaster6TeamIDEv", mfunc_ptr_cast(&CGameTeamMaster::TeamID_) }, { 0x01D895A0, "_ZN15CGameTeamMaster3UseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CGameTeamMaster::Use_) }, @@ -1952,7 +1953,7 @@ FunctionHook g_FunctionHooks[] = { 0x01DBD220, "_ZN17CFrictionModifier8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CFrictionModifier::KeyValue_) }, { 0x01DBD140, "_ZN17CFrictionModifier4SaveER5CSave", mfunc_ptr_cast(&CFrictionModifier::Save_) }, { 0x01DBD170, "_ZN17CFrictionModifier7RestoreER8CRestore", mfunc_ptr_cast(&CFrictionModifier::Restore_) }, - { 0x01DBD130, "_ZN17CFrictionModifier10ObjectCapsEv", mfunc_ptr_cast(&CFrictionModifier::ObjectCaps_) }, + //{ 0x01DBD130, "_ZN17CFrictionModifier10ObjectCapsEv", mfunc_ptr_cast(&CFrictionModifier::ObjectCaps_) }, // DEFAULT //non-virtual func { 0x01DBD1F0, "_ZN17CFrictionModifier14ChangeFrictionEP11CBaseEntity", mfunc_ptr_cast(&CFrictionModifier::ChangeFriction) }, //CAutoTrigger @@ -1960,7 +1961,7 @@ FunctionHook g_FunctionHooks[] = { 0x01DBD400, "_ZN12CAutoTrigger5SpawnEv", mfunc_ptr_cast(&CAutoTrigger::Spawn_) }, { 0x01DBD410, "_ZN12CAutoTrigger8PrecacheEv", mfunc_ptr_cast(&CAutoTrigger::Precache_) }, { 0x01DBD340, "_ZN12CAutoTrigger8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CAutoTrigger::KeyValue_) }, - { 0x01DBD2D0, "_ZN12CAutoTrigger10ObjectCapsEv", mfunc_ptr_cast(&CAutoTrigger::ObjectCaps_) }, + //{ 0x01DBD2D0, "_ZN12CAutoTrigger10ObjectCapsEv", mfunc_ptr_cast(&CAutoTrigger::ObjectCaps_) }, // DEFAULT { 0x01DBD2E0, "_ZN12CAutoTrigger4SaveER5CSave", mfunc_ptr_cast(&CAutoTrigger::Save_) }, { 0x01DBD310, "_ZN12CAutoTrigger7RestoreER8CRestore", mfunc_ptr_cast(&CAutoTrigger::Restore_) }, { 0x01DBD430, "_ZN12CAutoTrigger5ThinkEv", mfunc_ptr_cast(&CAutoTrigger::Think_) }, @@ -1970,7 +1971,7 @@ FunctionHook g_FunctionHooks[] = { 0x01DBD540, "_ZN13CTriggerRelay8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CTriggerRelay::KeyValue_) }, { 0x01DBD4E0, "_ZN13CTriggerRelay4SaveER5CSave", mfunc_ptr_cast(&CTriggerRelay::Save_) }, { 0x01DBD510, "_ZN13CTriggerRelay7RestoreER8CRestore", mfunc_ptr_cast(&CTriggerRelay::Restore_) }, - { 0x01DBD4D0, "_ZN13CTriggerRelay10ObjectCapsEv", mfunc_ptr_cast(&CTriggerRelay::ObjectCaps_) }, + //{ 0x01DBD4D0, "_ZN13CTriggerRelay10ObjectCapsEv", mfunc_ptr_cast(&CTriggerRelay::ObjectCaps_) }, // DEFAULT { 0x01DBD5D0, "_ZN13CTriggerRelay3UseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CTriggerRelay::Use_) }, //CMultiManager //virtual func @@ -1979,7 +1980,7 @@ FunctionHook g_FunctionHooks[] = { 0x01DBD6C0, "_ZN13CMultiManager8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CMultiManager::KeyValue_) }, { 0x01DBD660, "_ZN13CMultiManager4SaveER5CSave", mfunc_ptr_cast(&CMultiManager::Save_) }, { 0x01DBD690, "_ZN13CMultiManager7RestoreER8CRestore", mfunc_ptr_cast(&CMultiManager::Restore_) }, - { 0x01DBD650, "_ZN13CMultiManager10ObjectCapsEv", mfunc_ptr_cast(&CMultiManager::ObjectCaps_) }, + //{ 0x01DBD650, "_ZN13CMultiManager10ObjectCapsEv", mfunc_ptr_cast(&CMultiManager::ObjectCaps_) }, // DEFAULT { 0x01DBD8A0, "_ZN13CMultiManager9HasTargetEj", mfunc_ptr_cast(&CMultiManager::HasTarget_) }, //non-virtual func { 0x01DBD930, "_ZN13CMultiManager12ManagerThinkEv", mfunc_ptr_cast(&CMultiManager::ManagerThink) }, @@ -1992,7 +1993,7 @@ FunctionHook g_FunctionHooks[] = //CBaseTrigger //virtual func { 0x01DBDE40, "_ZN12CBaseTrigger8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CBaseTrigger::KeyValue_) }, - { 0x01DBDD80, "_ZN12CBaseTrigger10ObjectCapsEv", mfunc_ptr_cast(&CBaseTrigger::ObjectCaps_) }, + //{ 0x01DBDD80, "_ZN12CBaseTrigger10ObjectCapsEv", mfunc_ptr_cast(&CBaseTrigger::ObjectCaps_) }, // DEFAULT //non-virtual func //{ 0x01DBDD90, "_ZN12CBaseTrigger11InitTriggerEv", mfunc_ptr_cast(&CBaseTrigger::InitTrigger) }, // NOXREF { 0x01DC06D0, "_ZN12CBaseTrigger13TeleportTouchEP11CBaseEntity", mfunc_ptr_cast(&CBaseTrigger::TeleportTouch) }, @@ -2045,7 +2046,7 @@ FunctionHook g_FunctionHooks[] = //virtual func { 0x01DBF550, "_ZN11CFireAndDie5SpawnEv", mfunc_ptr_cast(&CFireAndDie::Spawn_) }, { 0x01DBF5B0, "_ZN11CFireAndDie8PrecacheEv", mfunc_ptr_cast(&CFireAndDie::Precache_) }, - { 0x01DBF540, "_ZN11CFireAndDie10ObjectCapsEv", mfunc_ptr_cast(&CFireAndDie::ObjectCaps_) }, + //{ 0x01DBF540, "_ZN11CFireAndDie10ObjectCapsEv", mfunc_ptr_cast(&CFireAndDie::ObjectCaps_) }, // DEFAULT { 0x01DBF5D0, "_ZN11CFireAndDie5ThinkEv", mfunc_ptr_cast(&CFireAndDie::Think_) }, //CChangeLevel //virtual func @@ -2127,7 +2128,7 @@ FunctionHook g_FunctionHooks[] = { 0x01DC17A0, "_ZN20CTriggerChangeTarget8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CTriggerChangeTarget::KeyValue_) }, { 0x01DC1740, "_ZN20CTriggerChangeTarget4SaveER5CSave", mfunc_ptr_cast(&CTriggerChangeTarget::Save_) }, { 0x01DC1770, "_ZN20CTriggerChangeTarget7RestoreER8CRestore", mfunc_ptr_cast(&CTriggerChangeTarget::Restore_) }, - { 0x01DC1730, "_ZN20CTriggerChangeTarget10ObjectCapsEv", mfunc_ptr_cast(&CTriggerChangeTarget::ObjectCaps_) }, + //{ 0x01DC1730, "_ZN20CTriggerChangeTarget10ObjectCapsEv", mfunc_ptr_cast(&CTriggerChangeTarget::ObjectCaps_) }, // DEFAULT { 0x01DC1800, "_ZN20CTriggerChangeTarget3UseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CTriggerChangeTarget::Use_) }, //CTriggerCamera //virtual func @@ -2135,7 +2136,7 @@ FunctionHook g_FunctionHooks[] = { 0x01DC19A0, "_ZN14CTriggerCamera8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CTriggerCamera::KeyValue_) }, { 0x01DC18C0, "_ZN14CTriggerCamera4SaveER5CSave", mfunc_ptr_cast(&CTriggerCamera::Save_) }, { 0x01DC18F0, "_ZN14CTriggerCamera7RestoreER8CRestore", mfunc_ptr_cast(&CTriggerCamera::Restore_) }, - { 0x01DC18B0, "_ZN14CTriggerCamera10ObjectCapsEv", mfunc_ptr_cast(&CTriggerCamera::ObjectCaps_) }, + //{ 0x01DC18B0, "_ZN14CTriggerCamera10ObjectCapsEv", mfunc_ptr_cast(&CTriggerCamera::ObjectCaps_) }, // DEFAULT { 0x01DC1A90, "_ZN14CTriggerCamera3UseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CTriggerCamera::Use_) }, //non-virtual func { 0x01DC1DC0, "_ZN14CTriggerCamera12FollowTargetEv", mfunc_ptr_cast(&CTriggerCamera::FollowTarget) }, @@ -2209,7 +2210,7 @@ FunctionHook g_FunctionHooks[] = #ifndef World_Region //virtual func - { 0x01DD1750, "_ZN7CCorpse10ObjectCapsEv", mfunc_ptr_cast(&CCorpse::ObjectCaps_) }, + //{ 0x01DD1750, "_ZN7CCorpse10ObjectCapsEv", mfunc_ptr_cast(&CCorpse::ObjectCaps_) }, // DEFAULT //non-virtual func { 0x01DD1420, "_ZN6CDecal5SpawnEv", mfunc_ptr_cast(&CDecal::Spawn_) }, { 0x01DD15C0, "_ZN6CDecal11StaticDecalEv", mfunc_ptr_cast(&CDecal::StaticDecal) }, @@ -2219,7 +2220,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x01DD1770, "_Z12ClearBodyQuev", (size_t)&ClearBodyQue }, // NOXREF //{ 0x01DD1780, "_ZN12CGlobalStateC2Ev", mfunc_ptr_cast(&CGlobalState__CGlobalState) }, //{ 0x01DD1790, "_ZN12CGlobalState5ResetEv", mfunc_ptr_cast(&CGlobalState::Reset) }, // NOXREF - { 0x01DD17A0, "_ZN12CGlobalState4FindEj", mfunc_ptr_cast(&CGlobalState::Find) }, + //{ 0x01DD17A0, "_ZN12CGlobalState4FindEj", mfunc_ptr_cast(&CGlobalState::Find) }, // PRIVATE { 0x01DD1810, "_ZN12CGlobalState11DumpGlobalsEv", mfunc_ptr_cast(&CGlobalState::DumpGlobals) }, { 0x01DD1860, "_ZN12CGlobalState9EntityAddEjj12GLOBALESTATE", mfunc_ptr_cast(&CGlobalState::EntityAdd) }, { 0x01DD18D0, "_ZN12CGlobalState14EntitySetStateEj12GLOBALESTATE", mfunc_ptr_cast(&CGlobalState::EntitySetState) }, @@ -2266,7 +2267,7 @@ FunctionHook g_FunctionHooks[] = //virtual func { 0x01DBA5B0, "_ZN9CSoundEnt5SpawnEv", mfunc_ptr_cast(&CSoundEnt::Spawn_) }, { 0x01DBA760, "_ZN9CSoundEnt8PrecacheEv", mfunc_ptr_cast(&CSoundEnt::Precache_) }, - { 0x01DBAB10, "_ZN9CSoundEnt10ObjectCapsEv", mfunc_ptr_cast(&CSoundEnt::ObjectCaps_) }, + //{ 0x01DBAB10, "_ZN9CSoundEnt10ObjectCapsEv", mfunc_ptr_cast(&CSoundEnt::ObjectCaps_) }, // DEFAULT { 0x01DBA5E0, "_ZN9CSoundEnt5ThinkEv", mfunc_ptr_cast(&CSoundEnt::Think_) }, //non-virtual func { 0x01DBA8F0, "_ZN9CSoundEnt10InitializeEv", mfunc_ptr_cast(&CSoundEnt::Initialize) }, @@ -2292,7 +2293,7 @@ FunctionHook g_FunctionHooks[] = { 0x01DB7900, "_ZN15CAmbientGeneric8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CAmbientGeneric::KeyValue_) }, { 0x01DB6C90, "_ZN15CAmbientGeneric4SaveER5CSave", mfunc_ptr_cast(&CAmbientGeneric::Save_) }, { 0x01DB6CC0, "_ZN15CAmbientGeneric7RestoreER8CRestore", mfunc_ptr_cast(&CAmbientGeneric::Restore_) }, - { 0x01DB6C80, "_ZN15CAmbientGeneric10ObjectCapsEv", mfunc_ptr_cast(&CAmbientGeneric::ObjectCaps_) }, + //{ 0x01DB6C80, "_ZN15CAmbientGeneric10ObjectCapsEv", mfunc_ptr_cast(&CAmbientGeneric::ObjectCaps_) }, // DEFAULT //non-virtual func { 0x01DB7060, "_ZN15CAmbientGeneric9RampThinkEv", mfunc_ptr_cast(&CAmbientGeneric::RampThink) }, { 0x01DB7440, "_ZN15CAmbientGeneric19InitModulationParmsEv", mfunc_ptr_cast(&CAmbientGeneric::InitModulationParms) }, @@ -2311,7 +2312,7 @@ FunctionHook g_FunctionHooks[] = { 0x01DBA480, "_ZN8CSpeaker8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CSpeaker::KeyValue_) }, { 0x01DB9F70, "_ZN8CSpeaker4SaveER5CSave", mfunc_ptr_cast(&CSpeaker::Save_) }, { 0x01DB9FA0, "_ZN8CSpeaker7RestoreER8CRestore", mfunc_ptr_cast(&CSpeaker::Restore_) }, - { 0x01DB9F60, "_ZN8CSpeaker10ObjectCapsEv", mfunc_ptr_cast(&CSpeaker::ObjectCaps_) }, + //{ 0x01DB9F60, "_ZN8CSpeaker10ObjectCapsEv", mfunc_ptr_cast(&CSpeaker::ObjectCaps_) }, // DEFAULT //non-virtual func { 0x01DBA3F0, "_ZN8CSpeaker9ToggleUseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CSpeaker::ToggleUse) }, { 0x01DBA0D0, "_ZN8CSpeaker12SpeakerThinkEv", mfunc_ptr_cast(&CSpeaker::SpeakerThink) }, @@ -2477,7 +2478,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x01DC7AF0, "_ZN8CRestore12ReadNamedIntEPKc", mfunc_ptr_cast(&CRestore::ReadNamedInt) }, // NOXREF //{ 0x01DC7C10, "_ZN8CRestore15ReadNamedStringEPKc", mfunc_ptr_cast(&CRestore::ReadNamedString) }, // NOXREF //{ 0x01DC7D30, "_ZN8CRestore13BufferPointerEv", mfunc_ptr_cast(&CRestore::BufferPointer) }, // NOXREF - { 0x01DC7D40, "_ZN8CRestore15BufferReadBytesEPci", mfunc_ptr_cast(&CRestore::BufferReadBytes) }, + //{ 0x01DC7D40, "_ZN8CRestore15BufferReadBytesEPci", mfunc_ptr_cast(&CRestore::BufferReadBytes) }, // PRIVATE //{ 0x01DC7DC0, "_ZN8CRestore15BufferSkipBytesEi", mfunc_ptr_cast(&CRestore::BufferSkipBytes) }, // NOXREF //{ 0x01DC7E20, "_ZN8CRestore17BufferSkipZStringEv", mfunc_ptr_cast(&CRestore::BufferSkipZString) }, // NOXREF //{ 0x01DC7EA0, "_ZN8CRestore18BufferCheckZStringEPKc", mfunc_ptr_cast(&CRestore::BufferCheckZString) }, // NOXREF @@ -2512,27 +2513,27 @@ FunctionHook g_FunctionHooks[] = //{ 0x01D80C90, "_Z16InstallGameRulesv", (size_t)&InstallGameRules }, { 0x01D80C00, "_ZN10CGameRules16RefreshSkillDataEv", mfunc_ptr_cast(&CGameRules::RefreshSkillData_) }, - { 0x01D8EBB0, "_ZN10CGameRules10IsTeamplayEv", mfunc_ptr_cast(&CGameRules::IsTeamplay_) }, - { 0x01D8EBC0, "_ZN10CGameRules18GetGameDescriptionEv", mfunc_ptr_cast(&CGameRules::GetGameDescription_) }, + //{ 0x01D8EBB0, "_ZN10CGameRules10IsTeamplayEv", mfunc_ptr_cast(&CGameRules::IsTeamplay_) }, // DEFAULT + //{ 0x01D8EBC0, "_ZN10CGameRules18GetGameDescriptionEv", mfunc_ptr_cast(&CGameRules::GetGameDescription_) }, // DEFAULT //{ 0x01D8EBD0, "_ZN10CGameRules14UpdateGameModeEP11CBasePlayer", mfunc_ptr_cast(&CGameRules::UpdateGameMode_) }, // PURE - { 0x01D8EBE0, "_ZN10CGameRules20FPlayerCanTakeDamageEP11CBasePlayerP11CBaseEntity", mfunc_ptr_cast(&CGameRules::FPlayerCanTakeDamage_) }, - { 0x01D8EBF0, "_ZN10CGameRules13ShouldAutoAimEP11CBasePlayerP7edict_s", mfunc_ptr_cast(&CGameRules::ShouldAutoAim_) }, + //{ 0x01D8EBE0, "_ZN10CGameRules20FPlayerCanTakeDamageEP11CBasePlayerP11CBaseEntity", mfunc_ptr_cast(&CGameRules::FPlayerCanTakeDamage_) }, // DEFAULT + //{ 0x01D8EBF0, "_ZN10CGameRules13ShouldAutoAimEP11CBasePlayerP7edict_s", mfunc_ptr_cast(&CGameRules::ShouldAutoAim_) }, // DEFAULT { 0x01D80A60, "_ZN10CGameRules18GetPlayerSpawnSpotEP11CBasePlayer", mfunc_ptr_cast(&CGameRules::GetPlayerSpawnSpot_) }, - { 0x01D8EC00, "_ZN10CGameRules24AllowAutoTargetCrosshairEv", mfunc_ptr_cast(&CGameRules::AllowAutoTargetCrosshair_) }, - { 0x01D8EC10, "_ZN10CGameRules25ClientCommand_DeadOrAliveEP11CBasePlayerPKc", mfunc_ptr_cast(&CGameRules::ClientCommand_DeadOrAlive_) }, - { 0x01D8EC60, "_ZN10CGameRules13ClientCommandEP11CBasePlayerPKc", mfunc_ptr_cast(&CGameRules::ClientCommand_) }, + //{ 0x01D8EC00, "_ZN10CGameRules24AllowAutoTargetCrosshairEv", mfunc_ptr_cast(&CGameRules::AllowAutoTargetCrosshair_) }, // DEFAULT + //{ 0x01D8EC10, "_ZN10CGameRules25ClientCommand_DeadOrAliveEP11CBasePlayerPKc", mfunc_ptr_cast(&CGameRules::ClientCommand_DeadOrAlive_) }, // DEFAULT + //{ 0x01D8EC60, "_ZN10CGameRules13ClientCommandEP11CBasePlayerPKc", mfunc_ptr_cast(&CGameRules::ClientCommand_) }, // DEFAULT //{ 0x01D8EC70, "_ZN10CGameRules21ClientUserInfoChangedEP11CBasePlayerPc", mfunc_ptr_cast(&CGameRules::ClientUserInfoChanged_) }, // PURE { 0x01D80B60, "_ZN10CGameRules17CanHavePlayerItemEP11CBasePlayerP15CBasePlayerItem", mfunc_ptr_cast(&CGameRules::CanHavePlayerItem_) }, { 0x01D80A20, "_ZN10CGameRules11CanHaveAmmoEP11CBasePlayerPKci", mfunc_ptr_cast(&CGameRules::CanHaveAmmo_) }, - { 0x01D8EC80, "_ZN10CGameRules24FlHEVChargerRechargeTimeEv", mfunc_ptr_cast(&CGameRules::FlHEVChargerRechargeTime_) }, - { 0x01D8EC90, "_ZN10CGameRules12GetTeamIndexEPKc", mfunc_ptr_cast(&CGameRules::GetTeamIndex_) }, - { 0x01D8ED40, "_ZN10CGameRules18GetIndexedTeamNameEi", mfunc_ptr_cast(&CGameRules::GetIndexedTeamName_) }, - { 0x01D8ED50, "_ZN10CGameRules11IsValidTeamEPKc", mfunc_ptr_cast(&CGameRules::IsValidTeam_) }, + //{ 0x01D8EC80, "_ZN10CGameRules24FlHEVChargerRechargeTimeEv", mfunc_ptr_cast(&CGameRules::FlHEVChargerRechargeTime_) }, // DEFAULT + //{ 0x01D8EC90, "_ZN10CGameRules12GetTeamIndexEPKc", mfunc_ptr_cast(&CGameRules::GetTeamIndex_) }, // DEFAULT + //{ 0x01D8ED40, "_ZN10CGameRules18GetIndexedTeamNameEi", mfunc_ptr_cast(&CGameRules::GetIndexedTeamName_) }, // DEFAULT + //{ 0x01D8ED50, "_ZN10CGameRules11IsValidTeamEPKc", mfunc_ptr_cast(&CGameRules::IsValidTeam_) }, // DEFAULT //{ 0x01D8ED60, "_ZN10CGameRules16ChangePlayerTeamEP11CBasePlayerPKcii", mfunc_ptr_cast(&CGameRules::ChangePlayerTeam_) }, // PURE - { 0x01D8ED70, "_ZN10CGameRules20SetDefaultPlayerTeamEP11CBasePlayer", mfunc_ptr_cast(&CGameRules::SetDefaultPlayerTeam_) }, - { 0x01D8ED80, "_ZN10CGameRules17PlayTextureSoundsEv", mfunc_ptr_cast(&CGameRules::PlayTextureSounds_) }, + //{ 0x01D8ED70, "_ZN10CGameRules20SetDefaultPlayerTeamEP11CBasePlayer", mfunc_ptr_cast(&CGameRules::SetDefaultPlayerTeam_) }, // DEFAULT + //{ 0x01D8ED80, "_ZN10CGameRules17PlayTextureSoundsEv", mfunc_ptr_cast(&CGameRules::PlayTextureSounds_) }, // DEFAULT //{ 0x01D8ED90, "_ZN10CGameRules18EndMultiplayerGameEv", mfunc_ptr_cast(&CGameRules::EndMultiplayerGame_) }, // PURE - { 0x01D8EDA0, "_ZN10CGameRules14IsFreezePeriodEv", mfunc_ptr_cast(&CGameRules::IsFreezePeriod_) }, + //{ 0x01D8EDA0, "_ZN10CGameRules14IsFreezePeriodEv", mfunc_ptr_cast(&CGameRules::IsFreezePeriod_) }, // DEFAULT //{ 0x01D8EDB0, "_ZN10CGameRules16ServerDeactivateEv", mfunc_ptr_cast(&CGameRules::ServerDeactivate_) }, // PURE //{ 0x01D8EDC0, "_ZN10CGameRules18CheckMapConditionsEv", mfunc_ptr_cast(&CGameRules::CheckMapConditions_) }, // PURE @@ -2542,8 +2543,8 @@ FunctionHook g_FunctionHooks[] = //{ 0x01DB6730, "", mfunc_ptr_cast(&CHalfLifeRules::CHalfLifeRules) }, { 0x01DB6750, "_ZN14CHalfLifeRules5ThinkEv", mfunc_ptr_cast(&CHalfLifeRules::Think_) }, // PURE - { 0x01DB6AF0, "_ZN14CHalfLifeRules16IsAllowedToSpawnEP11CBaseEntity", mfunc_ptr_cast(&CHalfLifeRules::IsAllowedToSpawn_) }, - { 0x01DB6BB0, "_ZN14CHalfLifeRules16FAllowFlashlightEv", mfunc_ptr_cast(&CHalfLifeRules::FAllowFlashlight_) }, + //{ 0x01DB6AF0, "_ZN14CHalfLifeRules16IsAllowedToSpawnEP11CBaseEntity", mfunc_ptr_cast(&CHalfLifeRules::IsAllowedToSpawn_) }, + //{ 0x01DB6BB0, "_ZN14CHalfLifeRules16FAllowFlashlightEv", mfunc_ptr_cast(&CHalfLifeRules::FAllowFlashlight_) }, // DEFAULT { 0x01DB6790, "_ZN14CHalfLifeRules19FShouldSwitchWeaponEP11CBasePlayerP15CBasePlayerItem", mfunc_ptr_cast(&CHalfLifeRules::FShouldSwitchWeapon_) }, { 0x01DB67C0, "_ZN14CHalfLifeRules17GetNextBestWeaponEP11CBasePlayerP15CBasePlayerItem", mfunc_ptr_cast(&CHalfLifeRules::GetNextBestWeapon_) }, { 0x01DB6760, "_ZN14CHalfLifeRules13IsMultiplayerEv", mfunc_ptr_cast(&CHalfLifeRules::IsMultiplayer_) }, @@ -2579,7 +2580,7 @@ FunctionHook g_FunctionHooks[] = { 0x01DB6B60, "_ZN14CHalfLifeRules27FlHealthChargerRechargeTimeEv", mfunc_ptr_cast(&CHalfLifeRules::FlHealthChargerRechargeTime_) }, { 0x01DB6B70, "_ZN14CHalfLifeRules17DeadPlayerWeaponsEP11CBasePlayer", mfunc_ptr_cast(&CHalfLifeRules::DeadPlayerWeapons_) }, { 0x01DB6B80, "_ZN14CHalfLifeRules14DeadPlayerAmmoEP11CBasePlayer", mfunc_ptr_cast(&CHalfLifeRules::DeadPlayerAmmo_) }, - { 0x01DB6BC0, "_ZN14CHalfLifeRules9GetTeamIDEP11CBaseEntity", mfunc_ptr_cast(&CHalfLifeRules::GetTeamID_) }, + //{ 0x01DB6BC0, "_ZN14CHalfLifeRules9GetTeamIDEP11CBaseEntity", mfunc_ptr_cast(&CHalfLifeRules::GetTeamID_) }, // DEFAULT { 0x01DB6B90, "_ZN14CHalfLifeRules18PlayerRelationshipEP11CBasePlayerP11CBaseEntity", mfunc_ptr_cast(&CHalfLifeRules::PlayerRelationship_) }, { 0x01DB6BA0, "_ZN14CHalfLifeRules14FAllowMonstersEv", mfunc_ptr_cast(&CHalfLifeRules::FAllowMonsters_) }, @@ -2636,11 +2637,11 @@ FunctionHook g_FunctionHooks[] = { 0x01D92250, "_ZN18CHalfLifeMultiplay24FlHEVChargerRechargeTimeEv", mfunc_ptr_cast(&CHalfLifeMultiplay::FlHEVChargerRechargeTime_) }, { 0x01D92260, "_ZN18CHalfLifeMultiplay17DeadPlayerWeaponsEP11CBasePlayer", mfunc_ptr_cast(&CHalfLifeMultiplay::DeadPlayerWeapons_) }, { 0x01D92270, "_ZN18CHalfLifeMultiplay14DeadPlayerAmmoEP11CBasePlayer", mfunc_ptr_cast(&CHalfLifeMultiplay::DeadPlayerAmmo_) }, - { 0x01D8EDD0, "_ZN18CHalfLifeMultiplay9GetTeamIDEP11CBaseEntity", mfunc_ptr_cast(&CHalfLifeMultiplay::GetTeamID_) }, + //{ 0x01D8EDD0, "_ZN18CHalfLifeMultiplay9GetTeamIDEP11CBaseEntity", mfunc_ptr_cast(&CHalfLifeMultiplay::GetTeamID_) }, // DEFAULT { 0x01D922D0, "_ZN18CHalfLifeMultiplay18PlayerRelationshipEP11CBasePlayerP11CBaseEntity", mfunc_ptr_cast(&CHalfLifeMultiplay::PlayerRelationship_) }, - { 0x01D8EDE0, "_ZN18CHalfLifeMultiplay17PlayTextureSoundsEv", mfunc_ptr_cast(&CHalfLifeMultiplay::PlayTextureSounds_) }, + //{ 0x01D8EDE0, "_ZN18CHalfLifeMultiplay17PlayTextureSoundsEv", mfunc_ptr_cast(&CHalfLifeMultiplay::PlayTextureSounds_) }, // DEFAULT { 0x01D92450, "_ZN18CHalfLifeMultiplay14FAllowMonstersEv", mfunc_ptr_cast(&CHalfLifeMultiplay::FAllowMonsters_) }, - { 0x01D8EE20, "_ZN18CHalfLifeMultiplay18EndMultiplayerGameEv", mfunc_ptr_cast(&CHalfLifeMultiplay::EndMultiplayerGame_) }, + //{ 0x01D8EE20, "_ZN18CHalfLifeMultiplay18EndMultiplayerGameEv", mfunc_ptr_cast(&CHalfLifeMultiplay::EndMultiplayerGame_) }, // DEFAULT { 0x01D8B4B0, "_ZN18CHalfLifeMultiplay16ServerDeactivateEv", mfunc_ptr_cast(&CHalfLifeMultiplay::ServerDeactivate_) }, { 0x01D8DFD0, "_ZN18CHalfLifeMultiplay18CheckMapConditionsEv", mfunc_ptr_cast(&CHalfLifeMultiplay::CheckMapConditions_) }, { 0x01D8C050, "_ZN18CHalfLifeMultiplay10CleanUpMapEv", mfunc_ptr_cast(&CHalfLifeMultiplay::CleanUpMap_) }, @@ -2714,7 +2715,7 @@ FunctionHook g_FunctionHooks[] = //CHalfLifeTraining //virtual func //{ 0x01DBBE50, "_ZN17CHalfLifeTrainingC2Ev", mfunc_ptr_cast(&CHalfLifeTraining::CHalfLifeTraining) } - { 0x01DBBE70, "_ZN17CHalfLifeTraining13IsMultiplayerEv", mfunc_ptr_cast(&CHalfLifeTraining::IsMultiplayer_) }, + //{ 0x01DBBE70, "_ZN17CHalfLifeTraining13IsMultiplayerEv", mfunc_ptr_cast(&CHalfLifeTraining::IsMultiplayer_) }, // DEFAULT { 0x01DBBE90, "_ZN17CHalfLifeTraining12IsDeathmatchEv", mfunc_ptr_cast(&CHalfLifeTraining::IsDeathmatch_) }, { 0x01DBBEA0, "_ZN17CHalfLifeTraining7InitHUDEP11CBasePlayer", mfunc_ptr_cast(&CHalfLifeTraining::InitHUD_) }, // PURE { 0x01DBC3E0, "_ZN17CHalfLifeTraining11PlayerSpawnEP11CBasePlayer", mfunc_ptr_cast(&CHalfLifeTraining::PlayerSpawn_) }, @@ -2734,7 +2735,7 @@ FunctionHook g_FunctionHooks[] = { 0x01DBCC00, "_ZN14CBaseGrenCatch8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CBaseGrenCatch::KeyValue_) }, { 0x01DBC7F0, "_ZN14CBaseGrenCatch4SaveER5CSave", mfunc_ptr_cast(&CBaseGrenCatch::Save_) }, { 0x01DBC820, "_ZN14CBaseGrenCatch7RestoreER8CRestore", mfunc_ptr_cast(&CBaseGrenCatch::Restore_) }, - { 0x01DBC8A0, "_ZN14CBaseGrenCatch10ObjectCapsEv", mfunc_ptr_cast(&CBaseGrenCatch::ObjectCaps_) }, + //{ 0x01DBC8A0, "_ZN14CBaseGrenCatch10ObjectCapsEv", mfunc_ptr_cast(&CBaseGrenCatch::ObjectCaps_) }, // DEFAULT { 0x01DBC970, "_ZN14CBaseGrenCatch5ThinkEv", mfunc_ptr_cast(&CBaseGrenCatch::Think_) }, { 0x01DBC930, "_ZN14CBaseGrenCatch5TouchEP11CBaseEntity", mfunc_ptr_cast(&CBaseGrenCatch::Touch_) }, //CFuncWeaponCheck @@ -2757,7 +2758,7 @@ FunctionHook g_FunctionHooks[] = //virtual func { 0x01DDD150, "_ZN11CCareerTask7OnEventE13GameEventTypeP11CBasePlayerS2_", mfunc_ptr_cast(&CCareerTask::OnEvent_) }, { 0x01DDCCD0, "_ZN11CCareerTask5ResetEv", mfunc_ptr_cast(&CCareerTask::Reset_) }, - { 0x01DDDDE0, "_ZNK11CCareerTask26IsTaskCompletableThisRoundEv", mfunc_ptr_cast(&CCareerTask::IsTaskCompletableThisRound_) }, + //{ 0x01DDDDE0, "_ZNK11CCareerTask26IsTaskCompletableThisRoundEv", mfunc_ptr_cast(&CCareerTask::IsTaskCompletableThisRound_) }, // DEFAULT //non-virtual func //{ 0x01DDCB80, "_ZN11CCareerTask7NewTaskEPKc13GameEventTypeS1_ibbib", mfunc_ptr_cast(&CCareerTask::NewTask) }, { 0x01DDCDB0, "_ZN11CCareerTask12OnWeaponKillEiibbP11CBasePlayerS1_", mfunc_ptr_cast(&CCareerTask::OnWeaponKill) }, @@ -2794,7 +2795,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x01DDCA60, "_ZN18CPreventDefuseTaskC2EPKc13GameEventTypeS1_ibbib", mfunc_ptr_cast(&CPreventDefuseTask::CPreventDefuseTask) }, { 0x01DDCB30, "_ZN18CPreventDefuseTask7OnEventE13GameEventTypeP11CBasePlayerS2_", mfunc_ptr_cast(&CPreventDefuseTask::OnEvent_) }, { 0x01DDCAB0, "_ZN18CPreventDefuseTask5ResetEv", mfunc_ptr_cast(&CPreventDefuseTask::Reset_) }, - { 0x01DDDDF0, "_ZNK18CPreventDefuseTask26IsTaskCompletableThisRoundEv", mfunc_ptr_cast(&CPreventDefuseTask::IsTaskCompletableThisRound_) }, + //{ 0x01DDDDF0, "_ZNK18CPreventDefuseTask26IsTaskCompletableThisRoundEv", mfunc_ptr_cast(&CPreventDefuseTask::IsTaskCompletableThisRound_) }, // DEFAULT //non-virtual func //{ 0x01DDCA00, "_ZN18CPreventDefuseTask7NewTaskEPKc13GameEventTypeS1_ibbib", mfunc_ptr_cast(&CPreventDefuseTask::NewTask) }, @@ -3562,7 +3563,6 @@ FunctionHook g_FunctionHooks[] = { 0x01D5B080, "Server_GetBlendingInterface", (size_t)&Server_GetBlendingInterface }, { 0x01D5B0E0, "_Z15AngleQuaternionPfS_", (size_t)&AngleQuaternion }, { 0x01D5B190, "_Z15QuaternionSlerpPfS_fS_", (size_t)&QuaternionSlerp }, - //{ 0x01D5B350, "_Z16QuaternionMatrixPfPA4_f", (size_t)&QuaternionMatrix }, { 0x01D5B430, "_Z13StudioGetAnimP7model_sP16mstudioseqdesc_t", (size_t)&StudioGetAnim }, //{ 0x01D5B4C0, "_Z15LookupAnimationP11studiohdr_tP7model_sP16mstudioseqdesc_ti", (size_t)&LookupAnimation }, // NOXREF { 0x01D5B500, "_Z17StudioCalcBoneAdjfPfPKhS1_h", (size_t)&StudioCalcBoneAdj }, @@ -3571,7 +3571,12 @@ FunctionHook g_FunctionHooks[] = { 0x01D5BA20, "_Z16StudioSlerpBonesPA4_fPA3_fS0_S2_f", (size_t)&StudioSlerpBones }, //{ 0x01D5BB50, "_Z19StudioCalcRotationsP13mstudiobone_tPiiPfPA3_fPA4_fP16mstudioseqdesc_tP13mstudioanim_tff", (size_t)&StudioCalcRotations }, // NOXREF { 0x01D5BBE0, "_Z16ConcatTransformsPA4_fS0_S0_", (size_t)&ConcatTransforms }, - //{ 0x01D5BD20, "_Z19SV_StudioSetupBonesP7model_sfiPKfS2_PKhS4_iPK7edict_s", (size_t)&SV_StudioSetupBones }, + +#if 1 + // NOTE: both functions must be involved in the hooks or also both disable their. + { 0x01D5B350, "_Z16QuaternionMatrixPfPA4_f", (size_t)&QuaternionMatrix }, + { 0x01D5BD20, "_Z19SV_StudioSetupBonesP7model_sfiPKfS2_PKhS4_iPK7edict_s", (size_t)&SV_StudioSetupBones }, +#endif #endif // Animation_Region @@ -3695,8 +3700,8 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZNK13CCSBotManager11GetScenarioEv", mfunc_ptr_cast(&CCSBotManager::GameScenarioType GetScenario) }, //{ 0x0, "_ZNK13CCSBotManager7GetZoneEi", mfunc_ptr_cast(&CCSBotManager::GetZone) }, // NOXREF //{ 0x01D25530, "_ZNK13CCSBotManager7GetZoneEPK6Vector", mfunc_ptr_cast(&CCSBotManager::GetZone) }, - //{ 0x0, "_ZNK13CCSBotManager14GetClosestZoneEPK6void", mfunc_ptr_cast(&CCSBotManager::GetClosestZone) }, - //{ 0x0, "_ZNK13CCSBotManager14GetClosestZoneEPK11CBaseEntity", mfunc_ptr_cast(&CCSBotManager::GetClosestZone) }, + { 0x01D255C0, "_ZNK13CCSBotManager14GetClosestZoneEPK6Vector", mfunc_ptr_cast(&CCSBotManager::GetClosestZone) }, + //{ 0x0, "_ZNK13CCSBotManager14GetClosestZoneEPK11CBaseEntity", mfunc_ptr_cast(&CCSBotManager::GetClosestZone) }, //{ 0x0, "_ZNK13CCSBotManager12GetZoneCountEv", mfunc_ptr_cast(&CCSBotManager::GetZoneCount) }, //{ 0x0, "_ZNK13CCSBotManager23GetRandomPositionInZoneEPKNS_4ZoneE", mfunc_ptr_cast(&CCSBotManager::GetRandomPositionInZone) }, //{ 0x01D25750, "_ZNK13CCSBotManager19GetRandomAreaInZoneEPKNS_4ZoneE", mfunc_ptr_cast(&CCSBotManager::GetRandomAreaInZone) }, @@ -3741,7 +3746,6 @@ FunctionHook g_FunctionHooks[] = //{ 0x01D248B0, "_ZN13CCSBotManager13BotAddCommandE18BotProfileTeamTypeb", mfunc_ptr_cast(&CCSBotManager::BotAddCommand) }, //{ 0x01D238A0, "_Z16PrintAllEntitiesv", (size_t)&PrintAllEntities }, // NOXREF //{ 0x01D23020, "_Z12UTIL_DrawBoxP6Extentiiii", (size_t)&UTIL_DrawBox }, - //CCSBot //{ 0x0, "_ZN6CCSBotC2Ev", mfunc_ptr_cast(&CCSBot::CCSBot) }, //virtual func @@ -3751,7 +3755,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZN6CCSBot5BlindEfffi", mfunc_ptr_cast(&CCSBot::Blind_) }, //{ 0x01D32370, "_ZN6CCSBot16OnTouchingWeaponEP10CWeaponBox", mfunc_ptr_cast(&CCSBot::OnTouchingWeapon_) }, //{ 0x01D20A60, "_ZN6CCSBot10InitializeEPK10BotProfile", mfunc_ptr_cast(&CCSBot::Initialize_) }, - //{ 0x0, "_ZN6CCSBot8SpawnBotEv", mfunc_ptr_cast(&CCSBot::SpawnBot_) }, + //{ 0x01D20E40, "_ZN6CCSBot8SpawnBotEv", mfunc_ptr_cast(&CCSBot::SpawnBot_) }, { 0x01D2D370, "_ZN6CCSBot6UpkeepEv", mfunc_ptr_cast(&CCSBot::Upkeep_) }, //{ 0x01D2D9B0, "_ZN6CCSBot6UpdateEv", mfunc_ptr_cast(&CCSBot::Update_) }, // using refs //{ 0x0, "_ZN6CCSBot4WalkEv", mfunc_ptr_cast(&CCSBot::Walk_) }, @@ -3763,7 +3767,7 @@ FunctionHook g_FunctionHooks[] = //non-virtual func { 0x01D20EE0, "_ZN6CCSBot10DisconnectEv", mfunc_ptr_cast(&CCSBot::Disconnect) }, //{ 0x0, "_ZNK6CCSBot14GetCombatRangeEv", mfunc_ptr_cast(&CCSBot::GetCombatRange) }, - //{ 0x0, "_ZNK6CCSBot7IsRogueEv", mfunc_ptr_cast(&CCSBot::IsRogue) }, + { 0x01D184D0, "_ZNK6CCSBot7IsRogueEv", mfunc_ptr_cast(&CCSBot::IsRogue) }, //{ 0x0, "_ZN6CCSBot8SetRogueEb", mfunc_ptr_cast(&CCSBot::SetRogue) }, //{ 0x0, "_ZNK6CCSBot10IsHurryingEv", mfunc_ptr_cast(&CCSBot::IsHurrying) }, //{ 0x0, "_ZN6CCSBot5HurryEf", mfunc_ptr_cast(&CCSBot::Hurry) }, @@ -3773,8 +3777,8 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZNK6CCSBot20GetSafeTimeRemainingEv", mfunc_ptr_cast(&CCSBot::GetSafeTimeRemaining) }, //{ 0x0, "_ZNK6CCSBot11GetSafeTimeEv", mfunc_ptr_cast(&CCSBot::GetSafeTime) }, //{ 0x0, "_ZNK6CCSBot11IsUnhealthyEv", mfunc_ptr_cast(&CCSBot::IsUnhealthy) }, - //{ 0x01D2BE50, "_ZN6CCSBot4IdleEv", mfunc_ptr_cast(&CCSBot::Idle) }, - //{ 0x0, "_ZN6CCSBot4HideEP8CNavAreaffb", mfunc_ptr_cast(&CCSBot::Hide) }, + { 0x01D2BE50, "_ZN6CCSBot4IdleEv", mfunc_ptr_cast(&CCSBot::Idle) }, + //{ 0x01D2C360, "_ZN6CCSBot4HideEP8CNavAreaffb", mfunc_ptr_cast(&CCSBot::Hide) }, //{ 0x0, "_ZN6CCSBot4HideEPK6Vectorfb", mfunc_ptr_cast(&CCSBot::Hide) }, //{ 0x0, "_ZN6CCSBot9TryToHideEP8CNavAreaffbb", mfunc_ptr_cast(&CCSBot::TryToHide) }, //{ 0x0, "_ZN6CCSBot12TryToRetreatEv", mfunc_ptr_cast(&CCSBot::TryToRetreat) }, @@ -3784,7 +3788,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZNK6CCSBot9IsHuntingEv", mfunc_ptr_cast(&CCSBot::IsHunting) }, //{ 0x01D2CB60, "_ZN6CCSBot6AttackEP11CBasePlayer", mfunc_ptr_cast(&CCSBot::Attack) }, //{ 0x0, "_ZN6CCSBot17FireWeaponAtEnemyEv", mfunc_ptr_cast(&CCSBot::FireWeaponAtEnemy) }, - //{ 0x01D2CD80, "_ZN6CCSBot13StopAttackingEv", mfunc_ptr_cast(&CCSBot::StopAttacking) }, + { 0x01D2CD80, "_ZN6CCSBot13StopAttackingEv", mfunc_ptr_cast(&CCSBot::StopAttacking) }, { 0x01D2CE50, "_ZNK6CCSBot11IsAttackingEv", mfunc_ptr_cast(&CCSBot::IsAttacking) }, //{ 0x01D2CF40, "_ZN6CCSBot6MoveToEPK6Vector9RouteType", mfunc_ptr_cast(&CCSBot::MoveTo) }, //{ 0x0, "_ZNK6CCSBot10IsMovingToEv", mfunc_ptr_cast(&CCSBot::IsMovingTo) }, @@ -3794,13 +3798,13 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZNK6CCSBot15CanSeeLooseBombEv", mfunc_ptr_cast(&CCSBot::CanSeeLooseBomb) }, //{ 0x0, "_ZNK6CCSBot14IsCarryingBombEv", mfunc_ptr_cast(&CCSBot::IsCarryingBomb) }, //{ 0x0, "_ZN6CCSBot10DefuseBombEv", mfunc_ptr_cast(&CCSBot::DefuseBomb) }, - //{ 0x0, "_ZNK6CCSBot14IsDefusingBombEv", mfunc_ptr_cast(&CCSBot::IsDefusingBomb) }, + { 0x01D2CE80, "_ZNK6CCSBot14IsDefusingBombEv", mfunc_ptr_cast(&CCSBot::IsDefusingBomb) }, //{ 0x0, "_ZNK6CCSBot17CanSeePlantedBombEv", mfunc_ptr_cast(&CCSBot::CanSeePlantedBomb) }, //{ 0x0, "_ZN6CCSBot14EscapeFromBombEv", mfunc_ptr_cast(&CCSBot::EscapeFromBomb) }, //{ 0x0, "_ZNK6CCSBot18IsEscapingFromBombEv", mfunc_ptr_cast(&CCSBot::IsEscapingFromBomb) }, //{ 0x0, "_ZN6CCSBot14RescueHostagesEv", mfunc_ptr_cast(&CCSBot::RescueHostages) }, //{ 0x0, "_ZN6CCSBot9UseEntityEP11CBaseEntity", mfunc_ptr_cast(&CCSBot::UseEntity) }, - //{ 0x0, "_ZNK6CCSBot8IsBuyingEv", mfunc_ptr_cast(&CCSBot::IsBuying) }, + { 0x01D2CF20, "_ZNK6CCSBot8IsBuyingEv", mfunc_ptr_cast(&CCSBot::IsBuying) }, //{ 0x0, "_ZN6CCSBot5PanicEP11CBasePlayer", mfunc_ptr_cast(&CCSBot::Panic) }, //{ 0x0, "_ZN6CCSBot6FollowEP11CBasePlayer", mfunc_ptr_cast(&CCSBot::Follow) }, //{ 0x0, "_ZN6CCSBot17ContinueFollowingEv", mfunc_ptr_cast(&CCSBot::ContinueFollowing) }, @@ -3822,7 +3826,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZN6CCSBot12GetGameStateEv", mfunc_ptr_cast(&CCSBot::GetGameState) }, //{ 0x0, "_ZN6CCSBot12IsAtBombsiteEv", mfunc_ptr_cast(&CCSBot::IsAtBombsite) }, //{ 0x01D18740, "_ZN6CCSBot15GuardRandomZoneEf", mfunc_ptr_cast(&CCSBot::GuardRandomZone) }, - //{ 0x0, "_ZNK6CCSBot6IsBusyEv", mfunc_ptr_cast(&CCSBot::IsBusy) }, + { 0x01D17900, "_ZNK6CCSBot6IsBusyEv", mfunc_ptr_cast(&CCSBot::IsBusy) }, //{ 0x0, "_ZN6CCSBot7SetTaskENS_8TaskTypeEP11CBaseEntity", mfunc_ptr_cast(&CCSBot::SetTask) }, //{ 0x0, "_ZNK6CCSBot7GetTaskEv", mfunc_ptr_cast(&CCSBot::GetTask) }, //{ 0x0, "_ZN6CCSBot13GetTaskEntityEv", mfunc_ptr_cast(&CCSBot::GetTaskEntity) }, @@ -3840,7 +3844,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZN6CCSBot11ForgetNoiseEv", mfunc_ptr_cast(&CCSBot::ForgetNoise) }, //{ 0x0, "_ZNK6CCSBot19CanSeeNoisePositionEv", mfunc_ptr_cast(&CCSBot::CanSeeNoisePosition) }, //{ 0x0, "_ZNK6CCSBot13GetNoiseRangeEv", mfunc_ptr_cast(&CCSBot::GetNoiseRange) }, - //{ 0x0, "_ZNK6CCSBot25CanHearNearbyEnemyGunfireEf", mfunc_ptr_cast(&CCSBot::CanHearNearbyEnemyGunfire) }, + //{ 0x01D227C0, "_ZNK6CCSBot25CanHearNearbyEnemyGunfireEf", mfunc_ptr_cast(&CCSBot::CanHearNearbyEnemyGunfire) }, //{ 0x0, "_ZNK6CCSBot16GetNoisePriorityEv", mfunc_ptr_cast(&CCSBot::GetNoisePriority) }, //{ 0x0, "_ZN6CCSBot16SendRadioMessageE13GameEventType", mfunc_ptr_cast(&CCSBot::SendRadioMessage) }, //{ 0x0, "_ZN6CCSBot10GetChatterEv", mfunc_ptr_cast(&CCSBot::GetChatter) }, @@ -3904,7 +3908,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZN6CCSBot22FeelerReflexAdjustmentEP6Vector", mfunc_ptr_cast(&CCSBot::FeelerReflexAdjustment) }, //{ 0x0, "_ZN6CCSBot13SetLookAnglesEff", mfunc_ptr_cast(&CCSBot::SetLookAngles) }, //2@@{ 0x01D2EDD0, "_ZN6CCSBot16UpdateLookAnglesEv", mfunc_ptr_cast(&CCSBot::UpdateLookAngles) }, // Using REFS - //{ 0x0, "_ZN6CCSBot16UpdateLookAroundEb", mfunc_ptr_cast(&CCSBot::UpdateLookAround) }, + //{ 0x01D2F9C0, "_ZN6CCSBot16UpdateLookAroundEb", mfunc_ptr_cast(&CCSBot::UpdateLookAround) }, //{ 0x0, "_ZN6CCSBot17InhibitLookAroundEf", mfunc_ptr_cast(&CCSBot::InhibitLookAround) }, //{ 0x0, "_ZN6CCSBot15SetForwardAngleEf", mfunc_ptr_cast(&CCSBot::SetForwardAngle) }, // NOXREF //{ 0x0, "_ZN6CCSBot17SetLookAheadAngleEf", mfunc_ptr_cast(&CCSBot::SetLookAheadAngle) }, // NOXREF @@ -3913,13 +3917,13 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZNK6CCSBot15IsLookingAtSpotE12PriorityType", mfunc_ptr_cast(&CCSBot::IsLookingAtSpot) }, //{ 0x0, "_ZNK6CCSBot12IsViewMovingEf", mfunc_ptr_cast(&CCSBot::IsViewMoving) }, //{ 0x0, "_ZNK6CCSBot14GetEyePositionEv", mfunc_ptr_cast(&CCSBot::GetEyePosition) }, - //{ 0x0, "_ZN6CCSBot23ComputeWeaponSightRangeEv", mfunc_ptr_cast(&CCSBot::ComputeWeaponSightRange) }, + //{ 0x01D32560, "_ZN6CCSBot23ComputeWeaponSightRangeEv", mfunc_ptr_cast(&CCSBot::ComputeWeaponSightRange) }, //{ 0x01D26890, "_ZN6CCSBot21ComputeApproachPointsEv", mfunc_ptr_cast(&CCSBot::ComputeApproachPoints) }, //{ 0x0, "_ZN6CCSBot20UpdateApproachPointsEv", mfunc_ptr_cast(&CCSBot::UpdateApproachPoints) }, //{ 0x0, "_ZN6CCSBot19ClearApproachPointsEv", mfunc_ptr_cast(&CCSBot::ClearApproachPoints) }, //{ 0x01D269D0, "_ZN6CCSBot18DrawApproachPointsEv", mfunc_ptr_cast(&CCSBot::DrawApproachPoints) }, - //{ 0x0, "_ZNK6CCSBot27GetHidingSpotCheckTimestampEP10HidingSpot", mfunc_ptr_cast(&CCSBot::GetHidingSpotCheckTimestamp) }, - //{ 0x0, "_ZN6CCSBot27SetHidingSpotCheckTimestampEP10HidingSpot", mfunc_ptr_cast(&CCSBot::SetHidingSpotCheckTimestamp) }, + //{ 0x01D17FA0, "_ZNK6CCSBot27GetHidingSpotCheckTimestampEP10HidingSpot", mfunc_ptr_cast(&CCSBot::GetHidingSpotCheckTimestamp) }, + //{ 0x01D17FF0, "_ZN6CCSBot27SetHidingSpotCheckTimestampEP10HidingSpot", mfunc_ptr_cast(&CCSBot::SetHidingSpotCheckTimestamp) }, //{ 0x0, "_ZN6CCSBot15EquipBestWeaponEb", mfunc_ptr_cast(&CCSBot::EquipBestWeapon) }, //{ 0x0, "_ZN6CCSBot11EquipPistolEv", mfunc_ptr_cast(&CCSBot::EquipPistol) }, //{ 0x0, "_ZN6CCSBot10EquipKnifeEv", mfunc_ptr_cast(&CCSBot::EquipKnife) }, @@ -3930,7 +3934,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D313F0, "_ZNK6CCSBot18IsUsingSniperRifleEv", mfunc_ptr_cast(&CCSBot::IsUsingSniperRifle) }, { 0x01D313A0, "_ZNK6CCSBot10IsUsingAWPEv", mfunc_ptr_cast(&CCSBot::IsUsingAWP) }, //{ 0x0, "_ZNK6CCSBot8IsSniperEv", mfunc_ptr_cast(&CCSBot::IsSniper) }, - //{ 0x0, "_ZNK6CCSBot9IsSnipingEv", mfunc_ptr_cast(&CCSBot::IsSniping) }, + { 0x01D314B0, "_ZNK6CCSBot9IsSnipingEv", mfunc_ptr_cast(&CCSBot::IsSniping) }, { 0x01D314D0, "_ZNK6CCSBot14IsUsingShotgunEv", mfunc_ptr_cast(&CCSBot::IsUsingShotgun) }, { 0x01D31500, "_ZNK6CCSBot17IsUsingMachinegunEv", mfunc_ptr_cast(&CCSBot::IsUsingMachinegun) }, { 0x01D31AB0, "_ZN6CCSBot12ThrowGrenadeEPK6Vector", mfunc_ptr_cast(&CCSBot::ThrowGrenade) }, @@ -3942,7 +3946,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZN6CCSBot13StopRapidFireEv", mfunc_ptr_cast(&CCSBot::StopRapidFire) }, //{ 0x0, "_ZNK6CCSBot13IsRapidFiringEv", mfunc_ptr_cast(&CCSBot::IsRapidFiring) }, //{ 0x0, "_ZNK6CCSBot12GetZoomLevelEv", mfunc_ptr_cast(&CCSBot::GetZoomLevel) }, - //{ 0x0, "_ZN6CCSBot10AdjustZoomEf", mfunc_ptr_cast(&CCSBot::AdjustZoom) }, + //{ 0x01D31280, "_ZN6CCSBot10AdjustZoomEf", mfunc_ptr_cast(&CCSBot::AdjustZoom) }, //{ 0x0, "_ZNK6CCSBot20IsPrimaryWeaponEmptyEv", mfunc_ptr_cast(&CCSBot::IsPrimaryWeaponEmpty) }, //{ 0x0, "_ZNK6CCSBot13IsPistolEmptyEv", mfunc_ptr_cast(&CCSBot::IsPistolEmpty) }, //{ 0x0, "_ZNK6CCSBot21GetHostageEscortCountEv", mfunc_ptr_cast(&CCSBot::GetHostageEscortCount) }, @@ -3953,7 +3957,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x01D17950, "_ZN6CCSBot13BotDeathThinkEv", mfunc_ptr_cast(&CCSBot::BotDeathThink) }, // PURE //{ 0x0, "_ZN6CCSBot16FindNearbyPlayerEv", mfunc_ptr_cast(&CCSBot::FindNearbyPlayer) }, { 0x01D186E0, "_ZN6CCSBot14AdjustSafeTimeEv", mfunc_ptr_cast(&CCSBot::AdjustSafeTime) }, - //{ 0x01D2BD80, "_ZN6CCSBot8SetStateEP8BotState", mfunc_ptr_cast(&CCSBot::SetState) }, + { 0x01D2BD80, "_ZN6CCSBot8SetStateEP8BotState", mfunc_ptr_cast(&CCSBot::SetState) }, //{ 0x0, "_ZN6CCSBot19MoveTowardsPositionEPK6Vector", mfunc_ptr_cast(&CCSBot::MoveTowardsPosition) }, //{ 0x0, "_ZN6CCSBot20MoveAwayFromPositionEPK6Vector", mfunc_ptr_cast(&CCSBot::MoveAwayFromPosition) }, //{ 0x0, "_ZN6CCSBot22StrafeAwayFromPositionEPK6Vector", mfunc_ptr_cast(&CCSBot::StrafeAwayFromPosition) }, @@ -3971,7 +3975,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZN6CCSBot20UpdateLadderMovementEv", mfunc_ptr_cast(&CCSBot::UpdateLadderMovement) }, //{ 0x0, "_ZN6CCSBot21ComputeLadderEndpointEb", mfunc_ptr_cast(&CCSBot::ComputeLadderEndpoint) }, //{ 0x0, "_ZN6CCSBot24UpdateHostageEscortCountEv", mfunc_ptr_cast(&CCSBot::UpdateHostageEscortCount) }, - //{ 0x0, "_ZN6CCSBot17UpdateLookAtNoiseEv", mfunc_ptr_cast(&CCSBot::UpdateLookAtNoise) }, + //{ 0x01D22A70, "_ZN6CCSBot17UpdateLookAtNoiseEv", mfunc_ptr_cast(&CCSBot::UpdateLookAtNoise) }, { 0x01D2F760, "_ZN6CCSBot12UpdateLookAtEv", mfunc_ptr_cast(&CCSBot::UpdateLookAt) }, //{ 0x0, "_ZN6CCSBot22UpdatePeripheralVisionEv", mfunc_ptr_cast(&CCSBot::UpdatePeripheralVision) }, //{ 0x0, "_ZNK6CCSBot15BendLineOfSightEPK6VectorS2_PS0_", mfunc_ptr_cast(&CCSBot::BendLineOfSight) }, @@ -3987,7 +3991,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZNK6CCSBot14IsRadioCommandE13GameEventType", mfunc_ptr_cast(&CCSBot::IsRadioCommand) }, { 0x01D2BA00, "_ZN6CCSBot16EndVoiceFeedbackEb", mfunc_ptr_cast(&CCSBot::EndVoiceFeedback) }, //{ 0x0, "_ZN6CCSBot7AddNodeEPK6VectorS2_10NavDirTypeP8CNavNode", mfunc_ptr_cast(&CCSBot::AddNode) }, - //{ 0x0, "_ZN6CCSBot17StartLearnProcessEv", mfunc_ptr_cast(&CCSBot::StartLearnProcess) }, + //{ 0x01D21610, "_ZN6CCSBot17StartLearnProcessEv", mfunc_ptr_cast(&CCSBot::StartLearnProcess) }, //{ 0x01D21EF0, "_ZN6CCSBot18UpdateLearnProcessEv", mfunc_ptr_cast(&CCSBot::UpdateLearnProcess) }, //{ 0x0, "_ZN6CCSBot9LearnStepEv", mfunc_ptr_cast(&CCSBot::LearnStep) }, { 0x01D21FE0, "_ZN6CCSBot24StartAnalyzeAlphaProcessEv", mfunc_ptr_cast(&CCSBot::StartAnalyzeAlphaProcess) }, @@ -4070,13 +4074,13 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZN9HuntState13ClearHuntAreaEv", mfunc_ptr_cast(&HuntState::ClearHuntArea) }, // NOXREF //AttackState //virtual func - //{ 0x01D10960, "_ZN11AttackState7OnEnterEP6CCSBot", mfunc_ptr_cast(&AttackState::OnEnter) }, - //{ 0x0, "_ZN11AttackState8OnUpdateEP6CCSBot", mfunc_ptr_cast(&AttackState::OnUpdate) }, - //{ 0x0, "_ZN11AttackState6OnExitEP6CCSBot", mfunc_ptr_cast(&AttackState::OnExit) }, - //{ 0x0, "_ZNK11AttackState7GetNameEv", mfunc_ptr_cast(&AttackState::GetName) }, + //{ 0x01D10960, "_ZN11AttackState7OnEnterEP6CCSBot", mfunc_ptr_cast(&AttackState::OnEnter_) }, + //{ 0x01D10CF0, "_ZN11AttackState8OnUpdateEP6CCSBot", mfunc_ptr_cast(&AttackState::OnUpdate_) }, + //{ 0x01D11860, "_ZN11AttackState6OnExitEP6CCSBot", mfunc_ptr_cast(&AttackState::OnExit_) }, + //{ 0x01D212E0, "_ZNK11AttackState7GetNameEv", mfunc_ptr_cast(&AttackState::GetName_) }, //non-virtual func //{ 0x0, "_ZN11AttackState16SetCrouchAndHoldEb", mfunc_ptr_cast(&AttackState::SetCrouchAndHold) }, // NOXREF - //{ 0x0, "_ZN11AttackState13StopAttackingEP6CCSBot", mfunc_ptr_cast(&AttackState::StopAttacking) }, + //{ 0x01D10CC0, "_ZN11AttackState13StopAttackingEP6CCSBot", mfunc_ptr_cast(&AttackState::StopAttacking) }, // NOXREF //InvestigateNoiseState //virtual func //{ 0x0, "_ZN21InvestigateNoiseState7OnEnterEP6CCSBot", mfunc_ptr_cast(&InvestigateNoiseState::OnEnter) }, @@ -4194,7 +4198,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZN4CBot11MoveForwardEv", mfunc_ptr_cast(&CBot::MoveForward_) }, //{ 0x0, "_ZN4CBot12MoveBackwardEv", mfunc_ptr_cast(&CBot::MoveBackward_) }, //{ 0x0, "_ZN4CBot10StrafeLeftEv", mfunc_ptr_cast(&CBot::StrafeLeft_) }, - //{ 0x0, "_ZN4CBot11StrafeRightEv", mfunc_ptr_cast(&CBot::StrafeRight_) }, + //{ 0x0, "_ZN4CBot11StrafeRightEv", mfunc_ptr_cast(&CBot::StrafeRight_) }, // DEFAULT //{ 0x0, "_ZN4CBot4JumpEb", mfunc_ptr_cast(&CBot::Jump_) }, //{ 0x0, "_ZN4CBot13ClearMovementEv", mfunc_ptr_cast(&CBot::ClearMovement_) }, //{ 0x0, "_ZN4CBot14UseEnvironmentEv", mfunc_ptr_cast(&CBot::UseEnvironment_) }, @@ -4255,7 +4259,7 @@ FunctionHook g_FunctionHooks[] = //BotBombStatusMeme //{ 0x0, "_ZNK17BotBombStatusMeme9InterpretEP6CCSBotS1_", mfunc_ptr_cast(&BotBombStatusMeme::Interpret) }, //BotFollowMeme - //{ 0x0, "_ZNK13BotFollowMeme9InterpretEP6CCSBotS1_", mfunc_ptr_cast(&BotFollowMeme::Interpret) }, + //{ 0x01D19080, "_ZNK13BotFollowMeme9InterpretEP6CCSBotS1_", mfunc_ptr_cast(&BotFollowMeme::Interpret) }, //BotDefendHereMeme //{ 0x0, "_ZNK17BotDefendHereMeme9InterpretEP6CCSBotS1_", mfunc_ptr_cast(&BotDefendHereMeme::Interpret) }, //BotWhereBombMeme @@ -4377,8 +4381,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZN19BotChatterInterface12FriendlyFireEv", mfunc_ptr_cast(&BotChatterInterface::FriendlyFire) }, //{ 0x01D1B630, "_ZN19BotChatterInterface13ReportEnemiesEv", mfunc_ptr_cast(&BotChatterInterface::ReportEnemies) }, //{ 0x0, "_ZNK19BotChatterInterface11ShouldSpeakEv", mfunc_ptr_cast(&BotChatterInterface::ShouldSpeak) }, - - //{ 0x0, "_Z20GetRandomSpotAtPlacej", (size_t)&GetRandomSpotAtPlace }, + { 0x01D18C30, "_Z20GetRandomSpotAtPlacej", (size_t)&GetRandomSpotAtPlace }, #endif // Bot_Region @@ -4392,7 +4395,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_Z15UTIL_BotsInGamev", (size_t)&UTIL_BotsInGame }, { 0x01D36A00, "_Z20UTIL_KickBotFromTeam8TeamName", (size_t)&UTIL_KickBotFromTeam }, //{ 0x0, "_Z18UTIL_IsTeamAllBotsi", (size_t)&UTIL_IsTeamAllBots }, - //{ 0x0, "_Z21UTIL_GetClosestPlayerPK6VectorPf", mfunc_ptr_cast(&UTIL_GetClosestPlayer) }, + { 0x01D36CE0, "_Z21UTIL_GetClosestPlayerPK6VectorPf", mfunc_ptr_cast(&UTIL_GetClosestPlayer) }, //{ 0x0, "_Z21UTIL_GetClosestPlayerPK6VectoriPf", mfunc_ptr_cast(&UTIL_GetClosestPlayer) }, //{ 0x01D36F90, "_Z17UTIL_GetBotPrefixv", (size_t)&UTIL_GetBotPrefix }, // NOXREF { 0x01D36FA0, "_Z24UTIL_ConstructBotNetNamePciPK10BotProfile", (size_t)&UTIL_ConstructBotNetName }, @@ -4411,7 +4414,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D37690, "_Z6BotCOSf", (size_t)&BotCOS }, { 0x01D37700, "_Z6BotSINf", (size_t)&BotSIN }, - //{ 0x01D37770, "_Z18IsGameEventAudible13GameEventTypeP11CBaseEntityS1_PfP12PriorityTypePb", (size_t)&IsGameEventAudible }, + { 0x01D37770, "_Z18IsGameEventAudible13GameEventTypeP11CBaseEntityS1_PfP12PriorityTypePb", (size_t)&IsGameEventAudible }, { 0x01D37A00, "_Z23HintMessageToAllPlayersPKc", (size_t)&HintMessageToAllPlayers }, #endif // CS_Util_Region @@ -4438,7 +4441,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D85130, "_ZN9CRecharge8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CRecharge::KeyValue_) }, { 0x01D85070, "_ZN9CRecharge4SaveER5CSave", mfunc_ptr_cast(&CRecharge::Save_) }, { 0x01D850A0, "_ZN9CRecharge7RestoreER8CRestore", mfunc_ptr_cast(&CRecharge::Restore_) }, - { 0x01D85120, "_ZN9CRecharge10ObjectCapsEv", mfunc_ptr_cast(&CRecharge::ObjectCaps_) }, + //{ 0x01D85120, "_ZN9CRecharge10ObjectCapsEv", mfunc_ptr_cast(&CRecharge::ObjectCaps_) }, // DEFAULT { 0x01D852A0, "_ZN9CRecharge3UseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CRecharge::Use_) }, //non-virtual func //{ 0x01D850D0, "func_recharge", (size_t)&func_recharge }, @@ -4449,7 +4452,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D85AA0, "_ZN7CCycler5SpawnEv", mfunc_ptr_cast(&CCycler::Spawn_) }, { 0x01D85630, "_ZN7CCycler4SaveER5CSave", mfunc_ptr_cast(&CCycler::Save_) }, { 0x01D85660, "_ZN7CCycler7RestoreER8CRestore", mfunc_ptr_cast(&CCycler::Restore_) }, - { 0x01D856E0, "_ZN7CCycler10ObjectCapsEv", mfunc_ptr_cast(&CCycler::ObjectCaps_) }, + //{ 0x01D856E0, "_ZN7CCycler10ObjectCapsEv", mfunc_ptr_cast(&CCycler::ObjectCaps_) }, // DEFAULT { 0x01D85C60, "_ZN7CCycler10TakeDamageEP9entvars_sS1_fi", mfunc_ptr_cast(&CCycler::TakeDamage_) }, //{ 0x01D856F0, "_ZN7CCycler7IsAliveEv", mfunc_ptr_cast(&CCycler::IsAlive_) }, // DEFAULT { 0x01D85B80, "_ZN7CCycler5ThinkEv", mfunc_ptr_cast(&CCycler::Think_) }, @@ -4468,7 +4471,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D85F00, "_ZN13CCyclerSprite7RestartEv", mfunc_ptr_cast(&CCyclerSprite::Restart_) }, { 0x01D85D80, "_ZN13CCyclerSprite4SaveER5CSave", mfunc_ptr_cast(&CCyclerSprite::Save_) }, { 0x01D85DB0, "_ZN13CCyclerSprite7RestoreER8CRestore", mfunc_ptr_cast(&CCyclerSprite::Restore_) }, - { 0x01D85D70, "_ZN13CCyclerSprite10ObjectCapsEv", mfunc_ptr_cast(&CCyclerSprite::ObjectCaps_) }, + //{ 0x01D85D70, "_ZN13CCyclerSprite10ObjectCapsEv", mfunc_ptr_cast(&CCyclerSprite::ObjectCaps_) }, // DEFAULT { 0x01D86090, "_ZN13CCyclerSprite10TakeDamageEP9entvars_sS1_fi", mfunc_ptr_cast(&CCyclerSprite::TakeDamage_) }, { 0x01D85FB0, "_ZN13CCyclerSprite5ThinkEv", mfunc_ptr_cast(&CCyclerSprite::Think_) }, { 0x01D86050, "_ZN13CCyclerSprite3UseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CCyclerSprite::Use_) }, @@ -4683,7 +4686,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x01DD35B0, "_ZN19CCSTutorStateSystemD0Ev", mfunc_ptr_cast(&CCSTutorStateSystem::~CCSTutorStateSystem) }, { 0x01DD3620, "_ZN19CCSTutorStateSystem11UpdateStateE13GameEventTypeP11CBaseEntityS2_", mfunc_ptr_cast(&CCSTutorStateSystem::UpdateState_) }, { 0x01DD36B0, "_ZN19CCSTutorStateSystem21GetCurrentStateStringEv", mfunc_ptr_cast(&CCSTutorStateSystem::GetCurrentStateString_) }, - { 0x01DD36C0, "_ZN19CCSTutorStateSystem17ConstructNewStateEi", mfunc_ptr_cast(&CCSTutorStateSystem::ConstructNewState_) }, + //{ 0x01DD36C0, "_ZN19CCSTutorStateSystem17ConstructNewStateEi", mfunc_ptr_cast(&CCSTutorStateSystem::ConstructNewState_) }, // PROTECTED //CCSTutorUndefinedState //{ 0x01DD3760, "_ZN22CCSTutorUndefinedStateC2Ev", mfunc_ptr_cast(&CCSTutorUndefinedState::CCSTutorUndefinedState) }, //{ 0x01DD3780, "_ZN22CCSTutorUndefinedStateD0Ev", mfunc_ptr_cast(&CCSTutorUndefinedState::~CCSTutorUndefinedState) }, @@ -4777,13 +4780,16 @@ FunctionHook g_FunctionHooks[] = #endif // VoiceManager_Region #ifndef Vector_Region - + { 0x01D71160, "_ZN8Vector2D16NormalizeInPlaceEv", mfunc_ptr_cast(&Vector2D::NormalizeInPlace) }, + { 0x01D290C0, "_ZN6Vector16NormalizeInPlaceEv", mfunc_ptr_cast(&Vector::NormalizeInPlace) }, + #ifdef _WIN32 { 0x01D12570, "", mfunc_ptr_cast(&Vector::Length) }, { 0x01D4EA30, "", mfunc_ptr_cast(&Vector::Normalize) }, { 0x01DCB800, "", mfunc_ptr_cast(&Vector::operator==) }, + { 0x01D130D0, "", mfunc_ptr_cast(&Vector::IsLengthLessThan) }, #endif // _WIN32 @@ -4894,8 +4900,9 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZNK8CNavPath22FindClosestPointOnPathEPK6VectoriiPS0_", mfunc_ptr_cast(&CNavPath::FindClosestPointOnPath) }, //{ 0x0, "_ZN8CNavPath8OptimizeEv", mfunc_ptr_cast(&CNavPath::Optimize) }, //{ 0x0, "_ZN8CNavPath20ComputePathPositionsEv", mfunc_ptr_cast(&CNavPath::ComputePathPositions) }, - //{ 0x0, "_ZN8CNavPath16BuildTrivialPathEPK6VectorS2_", mfunc_ptr_cast(&CNavPath::BuildTrivialPath) }, + { 0x01D47A00, "_ZN8CNavPath16BuildTrivialPathEPK6VectorS2_", mfunc_ptr_cast(&CNavPath::BuildTrivialPath) }, //{ 0x0, "_ZN8CNavPath20FindNextOccludedNodeEi", mfunc_ptr_cast(&CNavPath::FindNextOccludedNode) }, + //CStuckMonitor //{ 0x0, "", mfunc_ptr_cast(&CStuckMonitor::CStuckMonitor) }, //{ 0x0, "_ZN13CStuckMonitor5ResetEv", mfunc_ptr_cast(&CStuckMonitor::Reset) }, @@ -4942,7 +4949,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZN8CNavArea10SpliceEditEPS_", mfunc_ptr_cast(&CNavArea::SpliceEdit) }, //{ 0x0, "_ZN8CNavArea9MergeEditEPS_", mfunc_ptr_cast(&CNavArea::MergeEdit) }, //{ 0x0, "_ZN8CNavArea5StripEv", mfunc_ptr_cast(&CNavArea::Strip) }, - //{ 0x0, "_ZNK8CNavArea13IsOverlappingEPK6Vector", mfunc_ptr_cast(&CNavArea::IsOverlapping) }, + { 0x01D3C6C0, "_ZNK8CNavArea13IsOverlappingEPK6Vector", mfunc_ptr_cast(&CNavArea::IsOverlapping) }, //{ 0x0, "_ZNK8CNavArea13IsOverlappingEPKS_", mfunc_ptr_cast(&CNavArea::IsOverlapping) }, //{ 0x0, "_ZNK8CNavArea14IsOverlappingXEPKS_", mfunc_ptr_cast(&CNavArea::IsOverlappingX) }, //{ 0x0, "_ZNK8CNavArea14IsOverlappingYEPKS_", mfunc_ptr_cast(&CNavArea::IsOverlappingY) }, @@ -4962,7 +4969,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZN8CNavArea13AddToOpenListEv", mfunc_ptr_cast(&CNavArea::AddToOpenList) }, //{ 0x0, "_ZN8CNavArea16UpdateOnOpenListEv", mfunc_ptr_cast(&CNavArea::UpdateOnOpenList) }, //{ 0x01D3DBC0, "_ZN8CNavArea18RemoveFromOpenListEv", mfunc_ptr_cast(&CNavArea::RemoveFromOpenList) }, - //{ 0x0, "_ZN8CNavArea16ClearSearchListsEv", mfunc_ptr_cast(&CNavArea::ClearSearchLists) }, + //{ 0x01D3DC10, "_ZN8CNavArea16ClearSearchListsEv", mfunc_ptr_cast(&CNavArea::ClearSearchLists) }, //{ 0x0, "_ZNK8CNavArea9GetCornerE13NavCornerType", mfunc_ptr_cast(&CNavArea::GetCorner) }, //{ 0x0, "_ZNK8CNavArea21IsHidingSpotCollisionEPK6Vector", mfunc_ptr_cast(&CNavArea::IsHidingSpotCollision) }, //{ 0x0, "_ZN8CNavArea18ComputeHidingSpotsEv", mfunc_ptr_cast(&CNavArea::ComputeHidingSpots) }, @@ -4970,7 +4977,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZN8CNavArea16GetSpotEncounterEPKS_S1_", mfunc_ptr_cast(&CNavArea::GetSpotEncounter) }, //{ 0x0, "_ZN8CNavArea17AddSpotEncountersEPKS_10NavDirTypeS1_S2_", mfunc_ptr_cast(&CNavArea::AddSpotEncounters) }, //{ 0x0, "_ZN8CNavArea21ComputeSpotEncountersEv", mfunc_ptr_cast(&CNavArea::ComputeSpotEncounters) }, - //{ 0x0, "_ZN8CNavArea11DecayDangerEv", mfunc_ptr_cast(&CNavArea::DecayDanger) }, + //{ 0x01D3ED20, "_ZN8CNavArea11DecayDangerEv", mfunc_ptr_cast(&CNavArea::DecayDanger) }, //{ 0x0, "_ZN8CNavArea14IncreaseDangerEif", mfunc_ptr_cast(&CNavArea::IncreaseDanger) }, //{ 0x0, "_ZN8CNavArea9GetDangerEi", mfunc_ptr_cast(&CNavArea::GetDanger) }, //{ 0x0, "_ZNK8CNavArea14GetPlayerCountEiP11CBasePlayer", mfunc_ptr_cast(&CNavArea::GetPlayerCount) }, @@ -4995,16 +5002,16 @@ FunctionHook g_FunctionHooks[] = { 0x01D37CF0, "_Z18DestroyHidingSpotsv", (size_t)&DestroyHidingSpots }, //{ 0x01D40920, "_Z12EditNavAreas14NavEditCmdType", (size_t)&EditNavAreas }, { 0x01D42540, "_Z15GetGroundHeightPK6VectorPfPS_", (size_t)&GetGroundHeight }, - //{ 0x0, "_Z21GetSimpleGroundHeightPK6VectorPfPS_", (size_t)&GetSimpleGroundHeight }, + { 0x01D42740, "_Z21GetSimpleGroundHeightPK6VectorPfPS_", (size_t)&GetSimpleGroundHeight }, //{ 0x0, "", (size_t)&IsAreaVisible }, // NOXREF //{ 0x01D40250, "_Z13GetMarkedAreav", (size_t)&GetMarkedArea }, //{ 0x01D40260, "_Z17EditNavAreasResetv", (size_t)&EditNavAreasReset }, // NOXREF //{ 0x0, "_Z15DrawHidingSpotsPK8CNavArea", (size_t)&DrawHidingSpots }, //{ 0x01D3EE10, "_Z20IncreaseDangerNearbyifP8CNavAreaPK6Vectorf", (size_t)&IncreaseDangerNearby }, //{ 0x01D3F020, "_Z10DrawDangerv", (size_t)&DrawDanger }, - //{ 0x0, "_Z14IsSpotOccupiedP11CBaseEntityPK6Vector", (size_t)&IsSpotOccupied }, + { 0x01D3F1C0, "_Z14IsSpotOccupiedP11CBaseEntityPK6Vector", (size_t)&IsSpotOccupied }, //{ 0x0, "_Z20FindNearbyHidingSpotP11CBaseEntityPK6VectorP8CNavAreafbb", (size_t)&FindNearbyHidingSpot }, - //{ 0x01D187B0, "_Z21FindNearbyRetreatSpotP11CBaseEntityPK6VectorP8CNavAreafib", mfunc_ptr_cast(&FindNearbyRetreatSpot) }, + //{ 0x01D3FDE0, "_Z21FindNearbyRetreatSpotP11CBaseEntityPK6VectorP8CNavAreafib", mfunc_ptr_cast(&FindNearbyRetreatSpot) }, //{ 0x0, "_Z20IsCrossingLineOfFireRK6VectorS1_P11CBaseEntityi", (size_t)&IsCrossingLineOfFire }, //{ 0x0, "_Z20FindRandomHidingSpotP11CBaseEntityjb", (size_t)&FindRandomHidingSpot }, //{ 0x01D37FB0, "_Z17GetHidingSpotByIDj", (size_t)&GetHidingSpotByID }, @@ -5024,7 +5031,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_Z13SquareUpAreasv", (size_t)&SquareUpAreas }, //{ 0x0, "_Z8TestAreaP8CNavNodeii", (size_t)&TestArea }, //{ 0x0, "_Z9BuildAreaP8CNavNodeii", (size_t)&BuildArea }, - //{ 0x0, "_Z12BuildLaddersv", (size_t)&BuildLadders }, + //!@{ 0x01D3B3F0, "_Z12BuildLaddersv", (size_t)&BuildLadders }, //{ 0x0, "_Z13MarkJumpAreasv", (size_t)&MarkJumpAreas }, //{ 0x0, "_Z26GenerateNavigationAreaMeshv", (size_t)&GenerateNavigationAreaMesh }, @@ -5036,68 +5043,68 @@ FunctionHook g_FunctionHooks[] = //{ 0x01D50DA0, "", mfunc_ptr_cast(&CHostageImprov::CHostageImprov) }, //virtual func //{ 0x0, "_ZN14CHostageImprov15OnMoveToSuccessERK6Vector", mfunc_ptr_cast(&CHostageImprov::OnMoveToSuccess_) }, - //{ 0x0, "_ZN14CHostageImprov15OnMoveToFailureERK6VectorN12IImprovEvent17MoveToFailureTypeE", mfunc_ptr_cast(&CHostageImprov::OnMoveToFailure_) }, + { 0x01D562D0, "_ZN14CHostageImprov15OnMoveToFailureERK6VectorN12IImprovEvent17MoveToFailureTypeE", mfunc_ptr_cast(&CHostageImprov::OnMoveToFailure_) }, //{ 0x0, "_ZN14CHostageImprov8OnInjuryEf", mfunc_ptr_cast(&CHostageImprov::OnInjury_) }, - //{ 0x01D51040, "_ZNK14CHostageImprov7IsAliveEv", mfunc_ptr_cast(&CHostageImprov::IsAlive_) }, - //{ 0x0, "_ZN14CHostageImprov6MoveToERK6Vector", mfunc_ptr_cast(&CHostageImprov::MoveTo_) }, - //{ 0x0, "_ZN14CHostageImprov6LookAtERK6Vector", mfunc_ptr_cast(&CHostageImprov::LookAt_) }, - //{ 0x0, "_ZN14CHostageImprov11ClearLookAtEv", mfunc_ptr_cast(&CHostageImprov::ClearLookAt_) }, - //{ 0x0, "_ZN14CHostageImprov6FaceToERK6Vector", mfunc_ptr_cast(&CHostageImprov::FaceTo_) }, - //{ 0x0, "_ZN14CHostageImprov11ClearFaceToEv", mfunc_ptr_cast(&CHostageImprov::ClearFaceTo_) }, + { 0x01D51040, "_ZNK14CHostageImprov7IsAliveEv", mfunc_ptr_cast(&CHostageImprov::IsAlive_) }, + { 0x01D51060, "_ZN14CHostageImprov6MoveToERK6Vector", mfunc_ptr_cast(&CHostageImprov::MoveTo_) }, + { 0x01D51240, "_ZN14CHostageImprov6LookAtERK6Vector", mfunc_ptr_cast(&CHostageImprov::LookAt_) }, + { 0x01D51270, "_ZN14CHostageImprov11ClearLookAtEv", mfunc_ptr_cast(&CHostageImprov::ClearLookAt_) }, + { 0x01D51280, "_ZN14CHostageImprov6FaceToERK6Vector", mfunc_ptr_cast(&CHostageImprov::FaceTo_) }, + { 0x01D512B0, "_ZN14CHostageImprov11ClearFaceToEv", mfunc_ptr_cast(&CHostageImprov::ClearFaceTo_) }, //{ 0x0, "_ZNK14CHostageImprov12IsAtMoveGoalEf", mfunc_ptr_cast(&CHostageImprov::IsAtMoveGoal_) }, - //{ 0x0, "_ZNK14CHostageImprov9HasLookAtEv", mfunc_ptr_cast(&CHostageImprov::HasLookAt_) }, - //{ 0x0, "_ZNK14CHostageImprov9HasFaceToEv", mfunc_ptr_cast(&CHostageImprov::HasFaceTo_) }, + //{ 0x0, "_ZNK14CHostageImprov9HasLookAtEv", mfunc_ptr_cast(&CHostageImprov::HasLookAt_) }, // DEFAULT + //{ 0x0, "_ZNK14CHostageImprov9HasFaceToEv", mfunc_ptr_cast(&CHostageImprov::HasFaceTo_) }, // DEFAULT //{ 0x0, "_ZNK14CHostageImprov12IsAtFaceGoalEv", mfunc_ptr_cast(&CHostageImprov::IsAtFaceGoal_) }, //{ 0x0, "_ZNK14CHostageImprov16IsFriendInTheWayERK6Vector", mfunc_ptr_cast(&CHostageImprov::IsFriendInTheWay_) }, //{ 0x0, "_ZNK14CHostageImprov16IsFriendInTheWayEP11CBaseEntityRK6Vector", mfunc_ptr_cast(&CHostageImprov::IsFriendInTheWay_) }, - //{ 0x0, "_ZN14CHostageImprov11MoveForwardEv", mfunc_ptr_cast(&CHostageImprov::MoveForward_) }, - //{ 0x0, "_ZN14CHostageImprov12MoveBackwardEv", mfunc_ptr_cast(&CHostageImprov::MoveBackward_) }, - //{ 0x0, "_ZN14CHostageImprov10StrafeLeftEv", mfunc_ptr_cast(&CHostageImprov::StrafeLeft_) }, + //{ 0x0, "_ZN14CHostageImprov11MoveForwardEv", mfunc_ptr_cast(&CHostageImprov::MoveForward_) }, // DEFAULT + //{ 0x0, "_ZN14CHostageImprov12MoveBackwardEv", mfunc_ptr_cast(&CHostageImprov::MoveBackward_) }, // DEFAULT + //{ 0x0, "_ZN14CHostageImprov10StrafeLeftEv", mfunc_ptr_cast(&CHostageImprov::StrafeLeft_) }, // DEFAULT //{ 0x0, "_ZN14CHostageImprov11StrafeRightEv", mfunc_ptr_cast(&CHostageImprov::StrafeRight_) }, //{ 0x0, "_ZN14CHostageImprov4JumpEv", mfunc_ptr_cast(&CHostageImprov::Jump_) }, - //{ 0x01D56710, "_ZN14CHostageImprov6CrouchEv", mfunc_ptr_cast(&CHostageImprov::Crouch_) }, + { 0x01D56710, "_ZN14CHostageImprov6CrouchEv", mfunc_ptr_cast(&CHostageImprov::Crouch_) }, { 0x01D567A0, "_ZN14CHostageImprov7StandUpEv", mfunc_ptr_cast(&CHostageImprov::StandUp_) }, //{ 0x0, "_ZN14CHostageImprov9TrackPathERK6Vectorf", mfunc_ptr_cast(&CHostageImprov::TrackPath_) }, - //{ 0x0, "_ZN14CHostageImprov11StartLadderEPK10CNavLadder15NavTraverseTypePK6VectorS6_", mfunc_ptr_cast(&CHostageImprov::StartLadder_) }, - //{ 0x0, "_ZN14CHostageImprov14TraverseLadderEPK10CNavLadder15NavTraverseTypePK6VectorS6_f", mfunc_ptr_cast(&CHostageImprov::TraverseLadder_) }, - //{ 0x01D51150, "_ZN14CHostageImprov30GetSimpleGroundHeightWithFloorEPK6VectorPfPS0_", mfunc_ptr_cast(&CHostageImprov::GetSimpleGroundHeightWithFloor_) }, + { 0x01D530D0, "_ZN14CHostageImprov11StartLadderEPK10CNavLadder15NavTraverseTypePK6VectorS6_", mfunc_ptr_cast(&CHostageImprov::StartLadder_) }, + //{ 0x01D530E0, "_ZN14CHostageImprov14TraverseLadderEPK10CNavLadder15NavTraverseTypePK6VectorS6_f", mfunc_ptr_cast(&CHostageImprov::TraverseLadder_) }, + { 0x01D51150, "_ZN14CHostageImprov30GetSimpleGroundHeightWithFloorEPK6VectorPfPS0_", mfunc_ptr_cast(&CHostageImprov::GetSimpleGroundHeightWithFloor_) }, //{ 0x0, "_ZN14CHostageImprov3RunEv", mfunc_ptr_cast(&CHostageImprov::Run_) }, //{ 0x0, "_ZN14CHostageImprov4WalkEv", mfunc_ptr_cast(&CHostageImprov::Walk_) }, - //{ 0x0, "_ZN14CHostageImprov4StopEv", mfunc_ptr_cast(&CHostageImprov::Stop_) }, - //{ 0x0, "_ZNK14CHostageImprov12GetMoveAngleEv", mfunc_ptr_cast(&CHostageImprov::GetMoveAngle_) }, - //{ 0x0, "_ZNK14CHostageImprov12GetFaceAngleEv", mfunc_ptr_cast(&CHostageImprov::GetFaceAngle_) }, + { 0x01D52380, "_ZN14CHostageImprov4StopEv", mfunc_ptr_cast(&CHostageImprov::Stop_) }, + //{ 0x0, "_ZNK14CHostageImprov12GetMoveAngleEv", mfunc_ptr_cast(&CHostageImprov::GetMoveAngle_) }, // DEFAULT + //{ 0x0, "_ZNK14CHostageImprov12GetFaceAngleEv", mfunc_ptr_cast(&CHostageImprov::GetFaceAngle_) }, // DEFAULT { 0x01D523F0, "_ZNK14CHostageImprov7GetFeetEv", mfunc_ptr_cast(&CHostageImprov::GetFeet_) }, - //{ 0x01D52400, "_ZNK14CHostageImprov11GetCentroidEv", mfunc_ptr_cast(&CHostageImprov::GetCentroid_) }, - //{ 0x01D52430, "_ZNK14CHostageImprov7GetEyesEv", mfunc_ptr_cast(&CHostageImprov::GetEyes_) }, - //{ 0x0, "_ZNK14CHostageImprov9IsRunningEv", mfunc_ptr_cast(&CHostageImprov::IsRunning_) }, - //{ 0x0, "_ZNK14CHostageImprov9IsWalkingEv", mfunc_ptr_cast(&CHostageImprov::IsWalking_) }, - //{ 0x01D56CC0, "_ZNK14CHostageImprov9IsStoppedEv", mfunc_ptr_cast(&CHostageImprov::IsStopped_) }, - //{ 0x0, "_ZNK14CHostageImprov11IsCrouchingEv", mfunc_ptr_cast(&CHostageImprov::IsCrouching_) }, - //{ 0x0, "_ZNK14CHostageImprov9IsJumpingEv", mfunc_ptr_cast(&CHostageImprov::IsJumping_) }, - //{ 0x0, "_ZNK14CHostageImprov13IsUsingLadderEv", mfunc_ptr_cast(&CHostageImprov::IsUsingLadder_) }, + { 0x01D52400, "_ZNK14CHostageImprov11GetCentroidEv", mfunc_ptr_cast(&CHostageImprov::GetCentroid_) }, + { 0x01D52430, "_ZNK14CHostageImprov7GetEyesEv", mfunc_ptr_cast(&CHostageImprov::GetEyes_) }, + //{ 0x0, "_ZNK14CHostageImprov9IsRunningEv", mfunc_ptr_cast(&CHostageImprov::IsRunning_) }, // DEFAULT + //{ 0x0, "_ZNK14CHostageImprov9IsWalkingEv", mfunc_ptr_cast(&CHostageImprov::IsWalking_) }, // DEFAULT + //{ 0x01D56CC0, "_ZNK14CHostageImprov9IsStoppedEv", mfunc_ptr_cast(&CHostageImprov::IsStopped_) }, // DEFAULT + //{ 0x0, "_ZNK14CHostageImprov11IsCrouchingEv", mfunc_ptr_cast(&CHostageImprov::IsCrouching_) }, // DEFAULT + //{ 0x0, "_ZNK14CHostageImprov9IsJumpingEv", mfunc_ptr_cast(&CHostageImprov::IsJumping_) }, // DEFAULT + //{ 0x0, "_ZNK14CHostageImprov13IsUsingLadderEv", mfunc_ptr_cast(&CHostageImprov::IsUsingLadder_) }, // DEFAULT //{ 0x0, "_ZNK14CHostageImprov10IsOnGroundEv", mfunc_ptr_cast(&CHostageImprov::IsOnGround_) }, //{ 0x0, "_ZNK14CHostageImprov8IsMovingEv", mfunc_ptr_cast(&CHostageImprov::IsMoving_) }, - //{ 0x0, "_ZNK14CHostageImprov6CanRunEv", mfunc_ptr_cast(&CHostageImprov::CanRun_) }, - //{ 0x0, "_ZNK14CHostageImprov9CanCrouchEv", mfunc_ptr_cast(&CHostageImprov::CanCrouch_) }, - //{ 0x0, "_ZNK14CHostageImprov7CanJumpEv", mfunc_ptr_cast(&CHostageImprov::CanJump_) }, - //{ 0x0, "_ZNK14CHostageImprov9IsVisibleERK6Vectorb", mfunc_ptr_cast(&CHostageImprov::IsVisible_) }, + //{ 0x0, "_ZNK14CHostageImprov6CanRunEv", mfunc_ptr_cast(&CHostageImprov::CanRun_) }, // DEFAULT + //{ 0x0, "_ZNK14CHostageImprov9CanCrouchEv", mfunc_ptr_cast(&CHostageImprov::CanCrouch_) }, // DEFAULT + //{ 0x0, "_ZNK14CHostageImprov7CanJumpEv", mfunc_ptr_cast(&CHostageImprov::CanJump_) }, // DEFAULT + { 0x01D524C0, "_ZNK14CHostageImprov9IsVisibleERK6Vectorb", mfunc_ptr_cast(&CHostageImprov::IsVisible_) }, //{ 0x0, "_ZNK14CHostageImprov19IsPlayerLookingAtMeEP11CBasePlayerf", mfunc_ptr_cast(&CHostageImprov::IsPlayerLookingAtMe_) }, //{ 0x0, "_ZNK14CHostageImprov22IsAnyPlayerLookingAtMeEif", mfunc_ptr_cast(&CHostageImprov::IsAnyPlayerLookingAtMe_) }, //{ 0x0, "_ZNK14CHostageImprov32GetClosestPlayerByTravelDistanceEiPf", mfunc_ptr_cast(&CHostageImprov::GetClosestPlayerByTravelDistance_) }, - //{ 0x01D56D60, "_ZNK14CHostageImprov16GetLastKnownAreaEv", mfunc_ptr_cast(&CHostageImprov::GetLastKnownArea_) }, + //{ 0x01D56D60, "_ZNK14CHostageImprov16GetLastKnownAreaEv", mfunc_ptr_cast(&CHostageImprov::GetLastKnownArea_) }, // DEFAULT //{ 0x0, "_ZN14CHostageImprov8OnUpdateEf", mfunc_ptr_cast(&CHostageImprov::OnUpdate_) }, //{ 0x0, "_ZN14CHostageImprov8OnUpkeepEf", mfunc_ptr_cast(&CHostageImprov::OnUpkeep_) }, { 0x01D52A60, "_ZN14CHostageImprov7OnResetEv", mfunc_ptr_cast(&CHostageImprov::OnReset_) }, - //{ 0x0, "_ZN14CHostageImprov11OnGameEventE13GameEventTypeP11CBaseEntityS2_", mfunc_ptr_cast(&CHostageImprov::OnGameEvent_) }, - //{ 0x0, "_ZN14CHostageImprov7OnTouchEP11CBaseEntity", mfunc_ptr_cast(&CHostageImprov::OnTouch_) }, + { 0x01D54C10, "_ZN14CHostageImprov11OnGameEventE13GameEventTypeP11CBaseEntityS2_", mfunc_ptr_cast(&CHostageImprov::OnGameEvent_) }, + { 0x01D55280, "_ZN14CHostageImprov7OnTouchEP11CBaseEntity", mfunc_ptr_cast(&CHostageImprov::OnTouch_) }, //non-virtual func - //{ 0x0, "_ZN14CHostageImprov12FaceOutwardsEv", mfunc_ptr_cast(&CHostageImprov::FaceOutwards) }, + //{ 0x01D51900, "_ZN14CHostageImprov12FaceOutwardsEv", mfunc_ptr_cast(&CHostageImprov::FaceOutwards) }, //{ 0x0, "_ZNK14CHostageImprov16IsFriendInTheWayEv", mfunc_ptr_cast(&CHostageImprov::IsFriendInTheWay) }, //{ 0x01D52EE0, "_ZN14CHostageImprov20SetKnownGoodPositionERK6Vector", mfunc_ptr_cast(&CHostageImprov::SetKnownGoodPosition) }, // NOXREF //{ 0x0, "_ZNK14CHostageImprov20GetKnownGoodPositionEv", mfunc_ptr_cast(&CHostageImprov::GetKnownGoodPosition) }, - //{ 0x0, "_ZN14CHostageImprov24ResetToKnownGoodPositionEv", mfunc_ptr_cast(&CHostageImprov::ResetToKnownGoodPosition) }, + { 0x01D52F90, "_ZN14CHostageImprov24ResetToKnownGoodPositionEv", mfunc_ptr_cast(&CHostageImprov::ResetToKnownGoodPosition) }, //{ 0x0, "_ZN14CHostageImprov9ResetJumpEv", mfunc_ptr_cast(&CHostageImprov::ResetJump) }, - //{ 0x0, "_ZN14CHostageImprov10ApplyForceE6Vector", mfunc_ptr_cast(&CHostageImprov::ApplyForce) }, + { 0x01D55950, "_ZN14CHostageImprov10ApplyForceE6Vector", mfunc_ptr_cast(&CHostageImprov::ApplyForce) }, //{ 0x0, "_ZNK14CHostageImprov17GetActualVelocityEv", mfunc_ptr_cast(&CHostageImprov::GetActualVelocity) }, //{ 0x0, "_ZN14CHostageImprov12SetMoveLimitENS_8MoveTypeE", mfunc_ptr_cast(&CHostageImprov::SetMoveLimit) }, //{ 0x0, "_ZNK14CHostageImprov12GetMoveLimitEv", mfunc_ptr_cast(&CHostageImprov::GetMoveLimit) }, @@ -5111,41 +5118,41 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZNK14CHostageImprov10IsEscapingEv", mfunc_ptr_cast(&CHostageImprov::IsEscaping) }, //{ 0x0, "_ZN14CHostageImprov7RetreatEv", mfunc_ptr_cast(&CHostageImprov::Retreat) }, //{ 0x0, "_ZNK14CHostageImprov12IsRetreatingEv", mfunc_ptr_cast(&CHostageImprov::IsRetreating) }, - //{ 0x0, "_ZNK14CHostageImprov8IsAtHomeEv", mfunc_ptr_cast(&CHostageImprov::IsAtHome) }, - //{ 0x0, "_ZNK14CHostageImprov16CanSeeRescueZoneEv", mfunc_ptr_cast(&CHostageImprov::CanSeeRescueZone) }, + { 0x01D55980, "_ZNK14CHostageImprov8IsAtHomeEv", mfunc_ptr_cast(&CHostageImprov::IsAtHome) }, + { 0x01D559D0, "_ZNK14CHostageImprov16CanSeeRescueZoneEv", mfunc_ptr_cast(&CHostageImprov::CanSeeRescueZone) }, //{ 0x0, "_ZNK14CHostageImprov15GetFollowLeaderEv", mfunc_ptr_cast(&CHostageImprov::GetFollowLeader) }, - //{ 0x0, "_ZN14CHostageImprov23GetClosestVisiblePlayerEi", mfunc_ptr_cast(&CHostageImprov::GetClosestVisiblePlayer) }, - //{ 0x0, "_ZN14CHostageImprov25GetTimeSinceLastSawPlayerEi", mfunc_ptr_cast(&CHostageImprov::GetTimeSinceLastSawPlayer) }, + { 0x01D55A10, "_ZN14CHostageImprov23GetClosestVisiblePlayerEi", mfunc_ptr_cast(&CHostageImprov::GetClosestVisiblePlayer) }, + { 0x01D55AD0, "_ZN14CHostageImprov25GetTimeSinceLastSawPlayerEi", mfunc_ptr_cast(&CHostageImprov::GetTimeSinceLastSawPlayer) }, //{ 0x01D55B90, "_ZN14CHostageImprov22GetTimeSinceLastInjuryEv", mfunc_ptr_cast(&CHostageImprov::GetTimeSinceLastInjury) }, // NOXREF //{ 0x01D55BC0, "_ZN14CHostageImprov21GetTimeSinceLastNoiseEv", mfunc_ptr_cast(&CHostageImprov::GetTimeSinceLastNoise) }, // NOXREF - //{ 0x01D540C0, "_ZN14CHostageImprov17IsTerroristNearbyEv", mfunc_ptr_cast(&CHostageImprov::IsTerroristNearby) }, // NOXREF - //{ 0x0, "_ZN14CHostageImprov8FrightenENS_9ScareTypeE", mfunc_ptr_cast(&CHostageImprov::Frighten) }, - //{ 0x0, "_ZNK14CHostageImprov8IsScaredEv", mfunc_ptr_cast(&CHostageImprov::IsScared) }, + { 0x01D54010, "_ZN14CHostageImprov17IsTerroristNearbyEv", mfunc_ptr_cast(&CHostageImprov::IsTerroristNearby) }, + { 0x01D55C20, "_ZN14CHostageImprov8FrightenENS_9ScareTypeE", mfunc_ptr_cast(&CHostageImprov::Frighten) }, + { 0x01D55BF0, "_ZNK14CHostageImprov8IsScaredEv", mfunc_ptr_cast(&CHostageImprov::IsScared) }, //{ 0x0, "_ZNK14CHostageImprov17GetScareIntensityEv", mfunc_ptr_cast(&CHostageImprov::GetScareIntensity) }, //{ 0x0, "_ZNK14CHostageImprov20IsIgnoringTerroristsEv", mfunc_ptr_cast(&CHostageImprov::IsIgnoringTerrorists) }, //{ 0x0, "_ZNK14CHostageImprov13GetAggressionEv", mfunc_ptr_cast(&CHostageImprov::GetAggression) }, - //{ 0x0, "_ZN14CHostageImprov7ChatterE18HostageChatterTypeb", mfunc_ptr_cast(&CHostageImprov::Chatter) }, - //{ 0x0, "_ZN14CHostageImprov14DelayedChatterEf18HostageChatterTypeb", mfunc_ptr_cast(&CHostageImprov::DelayedChatter) }, + { 0x01D55ED0, "_ZN14CHostageImprov7ChatterE18HostageChatterTypeb", mfunc_ptr_cast(&CHostageImprov::Chatter) }, + { 0x01D55F80, "_ZN14CHostageImprov14DelayedChatterEf18HostageChatterTypeb", mfunc_ptr_cast(&CHostageImprov::DelayedChatter) }, //{ 0x01D55FE0, "_ZN14CHostageImprov20UpdateDelayedChatterEv", mfunc_ptr_cast(&CHostageImprov::UpdateDelayedChatter) }, // NOXREF //{ 0x0, "_ZNK14CHostageImprov9IsTalkingEv", mfunc_ptr_cast(&CHostageImprov::IsTalking) }, //{ 0x0, "_ZN14CHostageImprov22UpdateGrenadeReactionsEv", mfunc_ptr_cast(&CHostageImprov::UpdateGrenadeReactions) }, - //{ 0x0, "_ZN14CHostageImprov6AfraidEv", mfunc_ptr_cast(&CHostageImprov::Afraid) }, - //{ 0x0, "_ZN14CHostageImprov4WaveEv", mfunc_ptr_cast(&CHostageImprov::Wave) }, - //{ 0x0, "_ZN14CHostageImprov5AgreeEv", mfunc_ptr_cast(&CHostageImprov::Agree) }, - //{ 0x0, "_ZN14CHostageImprov8DisagreeEv", mfunc_ptr_cast(&CHostageImprov::Disagree) }, - //{ 0x0, "_ZN14CHostageImprov9CrouchDieEv", mfunc_ptr_cast(&CHostageImprov::CrouchDie) }, - //{ 0x0, "_ZN14CHostageImprov6FlinchE8Activity", mfunc_ptr_cast(&CHostageImprov::Flinch) }, - //{ 0x01D55E20, "_ZN14CHostageImprov18UpdateIdleActivityE8ActivityS0_", mfunc_ptr_cast(&CHostageImprov::UpdateIdleActivity) }, + { 0x01D55D20, "_ZN14CHostageImprov6AfraidEv", mfunc_ptr_cast(&CHostageImprov::Afraid) }, + { 0x01D56290, "_ZN14CHostageImprov4WaveEv", mfunc_ptr_cast(&CHostageImprov::Wave) }, + { 0x01D56210, "_ZN14CHostageImprov5AgreeEv", mfunc_ptr_cast(&CHostageImprov::Agree) }, + { 0x01D56240, "_ZN14CHostageImprov8DisagreeEv", mfunc_ptr_cast(&CHostageImprov::Disagree) }, + //{ 0x01D561E0, "_ZN14CHostageImprov9CrouchDieEv", mfunc_ptr_cast(&CHostageImprov::CrouchDie) }, // NOXREF + { 0x01D56120, "_ZN14CHostageImprov6FlinchE8Activity", mfunc_ptr_cast(&CHostageImprov::Flinch) }, + { 0x01D55E20, "_ZN14CHostageImprov18UpdateIdleActivityE8ActivityS0_", mfunc_ptr_cast(&CHostageImprov::UpdateIdleActivity) }, //{ 0x01D56910, "_ZN14CHostageImprov25UpdateStationaryAnimationEv", mfunc_ptr_cast(&CHostageImprov::UpdateStationaryAnimation) }, // NOXREF //{ 0x0, "_ZNK14CHostageImprov9GetEntityEv", mfunc_ptr_cast(&CHostageImprov::GetEntity) }, - //{ 0x0, "_ZN14CHostageImprov24CheckForNearbyTerroristsEv", mfunc_ptr_cast(&CHostageImprov::CheckForNearbyTerrorists) }, - //{ 0x0, "_ZN14CHostageImprov14UpdatePositionEf", mfunc_ptr_cast(&CHostageImprov::UpdatePosition) }, - //{ 0x0, "_ZN14CHostageImprov11MoveTowardsERK6Vectorf", mfunc_ptr_cast(&CHostageImprov::MoveTowards) }, - //{ 0x0, "_ZN14CHostageImprov11FaceTowardsERK6Vectorf", mfunc_ptr_cast(&CHostageImprov::FaceTowards) }, + //{ 0x01D540C0, "_ZN14CHostageImprov24CheckForNearbyTerroristsEv", mfunc_ptr_cast(&CHostageImprov::CheckForNearbyTerrorists) }, // NOXREF + //{ 0x01D534F0, "_ZN14CHostageImprov14UpdatePositionEf", mfunc_ptr_cast(&CHostageImprov::UpdatePosition) }, + { 0x01D512C0, "_ZN14CHostageImprov11MoveTowardsERK6Vectorf", mfunc_ptr_cast(&CHostageImprov::MoveTowards) }, + //{ 0x01D517A0, "_ZN14CHostageImprov11FaceTowardsERK6Vectorf", mfunc_ptr_cast(&CHostageImprov::FaceTowards) }, //{ 0x0, "_ZN14CHostageImprov8GetSpeedEv", mfunc_ptr_cast(&CHostageImprov::GetSpeed) }, //{ 0x0, "_ZN14CHostageImprov12SetMoveAngleEf", mfunc_ptr_cast(&CHostageImprov::SetMoveAngle) }, - //{ 0x01D56300, "_ZN14CHostageImprov6WiggleEv", mfunc_ptr_cast(&CHostageImprov::Wiggle) }, - //{ 0x0, "_ZN14CHostageImprov9ClearPathEv", mfunc_ptr_cast(&CHostageImprov::ClearPath) }, + { 0x01D56300, "_ZN14CHostageImprov6WiggleEv", mfunc_ptr_cast(&CHostageImprov::Wiggle) }, + { 0x01D564E0, "_ZN14CHostageImprov9ClearPathEv", mfunc_ptr_cast(&CHostageImprov::ClearPath) }, //{ 0x01D511C0, "_ZN14CHostageImprov17DiscontinuityJumpEfbb", mfunc_ptr_cast(&CHostageImprov::DiscontinuityJump) }, // NOXREF //{ 0x0, "_ZN14CHostageImprov12UpdateVisionEv", mfunc_ptr_cast(&CHostageImprov::UpdateVision) }, //HostageState @@ -5155,19 +5162,19 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZN12HostageState25UpdateStationaryAnimationEP14CHostageImprov", mfunc_ptr_cast(&HostageState::UpdateStationaryAnimation) }, //HostageIdleState //virtual func - //{ 0x0, "_ZN16HostageIdleState7OnEnterEP14CHostageImprov", mfunc_ptr_cast(&HostageIdleState::OnEnter) }, - //{ 0x0, "_ZN16HostageIdleState8OnUpdateEP14CHostageImprov", mfunc_ptr_cast(&HostageIdleState::OnUpdate) }, - //{ 0x0, "_ZN16HostageIdleState6OnExitEP14CHostageImprov", mfunc_ptr_cast(&HostageIdleState::OnExit) }, - //{ 0x0, "_ZNK16HostageIdleState7GetNameEv", mfunc_ptr_cast(&HostageIdleState::GetName) }, - //{ 0x01D4BBD0, "_ZN16HostageIdleState25UpdateStationaryAnimationEP14CHostageImprov", mfunc_ptr_cast(&HostageIdleState::UpdateStationaryAnimation) }, - //{ 0x0, "_ZN16HostageIdleState15OnMoveToSuccessERK6Vector", mfunc_ptr_cast(&HostageIdleState::OnMoveToSuccess) }, - //{ 0x0, "_ZN16HostageIdleState15OnMoveToFailureERK6VectorN12IImprovEvent17MoveToFailureTypeE", mfunc_ptr_cast(&HostageIdleState::OnMoveToFailure) }, - //{ 0x0, "_ZN16HostageIdleState8OnInjuryEf", mfunc_ptr_cast(&HostageIdleState::OnInjury) }, + { 0x01D4B3A0, "_ZN16HostageIdleState7OnEnterEP14CHostageImprov", mfunc_ptr_cast(&HostageIdleState::OnEnter_) }, + //{ 0x01D4B3C0, "_ZN16HostageIdleState8OnUpdateEP14CHostageImprov", mfunc_ptr_cast(&HostageIdleState::OnUpdate_) }, + //{ 0x0, "_ZN16HostageIdleState6OnExitEP14CHostageImprov", mfunc_ptr_cast(&HostageIdleState::OnExit_) }, + //{ 0x0, "_ZNK16HostageIdleState7GetNameEv", mfunc_ptr_cast(&HostageIdleState::GetName_) }, // DEFAULT + { 0x01D4BBD0, "_ZN16HostageIdleState25UpdateStationaryAnimationEP14CHostageImprov", mfunc_ptr_cast(&HostageIdleState::UpdateStationaryAnimation_) }, + //{ 0x0, "_ZN16HostageIdleState15OnMoveToSuccessERK6Vector", mfunc_ptr_cast(&HostageIdleState::OnMoveToSuccess_) }, // DEFAULT + //{ 0x0, "_ZN16HostageIdleState15OnMoveToFailureERK6VectorN12IImprovEvent17MoveToFailureTypeE", mfunc_ptr_cast(&HostageIdleState::OnMoveToFailure_) }, // DEFAULT + //{ 0x0, "_ZN16HostageIdleState8OnInjuryEf", mfunc_ptr_cast(&HostageIdleState::OnInjury_) }, // DEFAULT //HostageStateMachine //virtual func - //{ 0x0, "_ZN19HostageStateMachine15OnMoveToSuccessERK6Vector", mfunc_ptr_cast(&HostageStateMachine::OnMoveToSuccess) }, - //{ 0x0, "_ZN19HostageStateMachine15OnMoveToFailureERK6VectorN12IImprovEvent17MoveToFailureTypeE", mfunc_ptr_cast(&HostageStateMachine::OnMoveToFailure) }, - //{ 0x0, "_ZN19HostageStateMachine8OnInjuryEf", mfunc_ptr_cast(&HostageStateMachine::OnInjury) }, + //{ 0x01D569D0, "_ZN19HostageStateMachine15OnMoveToSuccessERK6Vector", mfunc_ptr_cast(&HostageStateMachine::OnMoveToSuccess) }, + //{ 0x01D569F0, "_ZN19HostageStateMachine15OnMoveToFailureERK6VectorN12IImprovEvent17MoveToFailureTypeE", mfunc_ptr_cast(&HostageStateMachine::OnMoveToFailure) }, + //{ 0x01D56A10, "_ZN19HostageStateMachine8OnInjuryEf", mfunc_ptr_cast(&HostageStateMachine::OnInjury) }, //non-virtual func //{ 0x0, "_ZN19HostageStateMachine25UpdateStationaryAnimationEP14CHostageImprov", mfunc_ptr_cast(&HostageStateMachine::UpdateStationaryAnimation) }, //HostageEscapeToCoverState @@ -5197,10 +5204,10 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZN18HostageEscapeState10LookAroundEv", mfunc_ptr_cast(&HostageEscapeState::LookAround) }, //HostageRetreatState //virtual func - //{ 0x0, "_ZN19HostageRetreatState7OnEnterEP14CHostageImprov", mfunc_ptr_cast(&HostageRetreatState::OnEnter) }, - //{ 0x0, "_ZN19HostageRetreatState8OnUpdateEP14CHostageImprov", mfunc_ptr_cast(&HostageRetreatState::OnUpdate) }, - //{ 0x0, "_ZN19HostageRetreatState6OnExitEP14CHostageImprov", mfunc_ptr_cast(&HostageRetreatState::OnExit) }, - //{ 0x0, "_ZNK19HostageRetreatState7GetNameEv", mfunc_ptr_cast(&HostageRetreatState::GetName) }, + //{ 0x01D4BC30, "_ZN19HostageRetreatState7OnEnterEP14CHostageImprov", mfunc_ptr_cast(&HostageRetreatState::OnEnter_) }, + { 0x01D4BC50, "_ZN19HostageRetreatState8OnUpdateEP14CHostageImprov", mfunc_ptr_cast(&HostageRetreatState::OnUpdate_) }, + //{ 0x01D4BDB0, "_ZN19HostageRetreatState6OnExitEP14CHostageImprov", mfunc_ptr_cast(&HostageRetreatState::OnExit_) }, + //{ 0x01D56BD0, "_ZNK19HostageRetreatState7GetNameEv", mfunc_ptr_cast(&HostageRetreatState::GetName_) }, //HostageFollowState //virtual func //{ 0x0, "_ZN18HostageFollowState7OnEnterEP14CHostageImprov", mfunc_ptr_cast(&HostageFollowState::OnEnter) }, @@ -5213,90 +5220,98 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZNK18HostageFollowState9GetLeaderEv", mfunc_ptr_cast(&HostageFollowState::GetLeader) }, //HostageAnimateState //virtual func - //{ 0x0, "_ZN19HostageAnimateState7OnEnterEP14CHostageImprov", mfunc_ptr_cast(&HostageAnimateState::OnEnter) }, - //{ 0x0, "_ZN19HostageAnimateState8OnUpdateEP14CHostageImprov", mfunc_ptr_cast(&HostageAnimateState::OnUpdate) }, - //{ 0x0, "_ZN19HostageAnimateState6OnExitEP14CHostageImprov", mfunc_ptr_cast(&HostageAnimateState::OnExit) }, - //{ 0x0, "_ZNK19HostageAnimateState7GetNameEv", mfunc_ptr_cast(&HostageAnimateState::GetName) }, + //{ 0x01D4A060, "_ZN19HostageAnimateState7OnEnterEP14CHostageImprov", mfunc_ptr_cast(&HostageAnimateState::OnEnter_) }, + { 0x01D4A070, "_ZN19HostageAnimateState8OnUpdateEP14CHostageImprov", mfunc_ptr_cast(&HostageAnimateState::OnUpdate_) }, + //{ 0x01D4A1B0, "_ZN19HostageAnimateState6OnExitEP14CHostageImprov", mfunc_ptr_cast(&HostageAnimateState::OnExit_) }, + //{ 0x01D56BF0, "_ZNK19HostageAnimateState7GetNameEv", mfunc_ptr_cast(&HostageAnimateState::GetName_) }, //non-virtual func { 0x01D49D60, "_ZN19HostageAnimateState5ResetEv", mfunc_ptr_cast(&HostageAnimateState::Reset) }, - //{ 0x0, "_ZN19HostageAnimateState11AddSequenceEP14CHostageImprovPKcff", mfunc_ptr_cast(&HostageAnimateState::AddSequence) }, - //{ 0x01D49F00, "_ZN19HostageAnimateState11AddSequenceEP14CHostageImproviff", mfunc_ptr_cast(&HostageAnimateState::AddSequence) }, + { 0x01D49E10, "_ZN19HostageAnimateState11AddSequenceEP14CHostageImprovPKcff", mfunc_ptr_cast(&HostageAnimateState::AddSequence) }, + { 0x01D49F00, "_ZN19HostageAnimateState11AddSequenceEP14CHostageImproviff", mfunc_ptr_cast(&HostageAnimateState::AddSequence) }, //{ 0x0, "_ZNK19HostageAnimateState6IsBusyEv", mfunc_ptr_cast(&HostageAnimateState::IsBusy) }, //{ 0x0, "_ZNK19HostageAnimateState9IsPlayingEP14CHostageImprovPKc", mfunc_ptr_cast(&HostageAnimateState::IsPlaying) }, //{ 0x0, "_ZN19HostageAnimateState20GetCurrentSequenceIDEv", mfunc_ptr_cast(&HostageAnimateState::GetCurrentSequenceID) }, // NOXREF //{ 0x0, "_ZNK19HostageAnimateState14GetPerformanceEv", mfunc_ptr_cast(&HostageAnimateState::GetPerformance) }, //{ 0x0, "_ZN19HostageAnimateState14SetPerformanceENS_15PerformanceTypeE", mfunc_ptr_cast(&HostageAnimateState::SetPerformance) }, - //{ 0x0, "_ZN19HostageAnimateState13StartSequenceEP14CHostageImprovPKNS_7SeqInfoE", mfunc_ptr_cast(&HostageAnimateState::StartSequence) }, - //{ 0x0, "_ZN19HostageAnimateState13IsDoneHoldingEv", mfunc_ptr_cast(&HostageAnimateState::IsDoneHolding) }, + //{ 0x01D49D70, "_ZN19HostageAnimateState13StartSequenceEP14CHostageImprovPKNS_7SeqInfoE", mfunc_ptr_cast(&HostageAnimateState::StartSequence) }, // NOXREF + { 0x01D4A000, "_ZN19HostageAnimateState13IsDoneHoldingEv", mfunc_ptr_cast(&HostageAnimateState::IsDoneHolding) }, //CHostage + //virtual func - //{ 0x0, "_ZN8CHostage5SpawnEv", mfunc_ptr_cast(&CHostage::Spawn_) }, - //{ 0x0, "_ZN8CHostage8PrecacheEv", mfunc_ptr_cast(&CHostage::Precache_) }, - //{ 0x0, "_ZN8CHostage10ObjectCapsEv", mfunc_ptr_cast(&CHostage::ObjectCaps_) }, - //{ 0x0, "_ZN8CHostage8ClassifyEv", mfunc_ptr_cast(&CHostage::Classify_) }, - //{ 0x0, "_ZN8CHostage10TakeDamageEP9entvars_sS1_fi", mfunc_ptr_cast(&CHostage::TakeDamage_) }, - //{ 0x0, "_ZN8CHostage10BloodColorEv", mfunc_ptr_cast(&CHostage::BloodColor_) }, - //{ 0x0, "_ZN8CHostage5TouchEP11CBaseEntity", mfunc_ptr_cast(&CHostage::Touch_) }, - //{ 0x0, "_ZN8CHostage3UseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CHostage::Use_) }, + //!!{ 0x01D4BE60, "_ZN8CHostage5SpawnEv", mfunc_ptr_cast(&CHostage::Spawn_) }, // do not use the hook together CHostage::IdleThink + { 0x01D4C2C0, "_ZN8CHostage8PrecacheEv", mfunc_ptr_cast(&CHostage::Precache_) }, + { 0x01D4DB00, "_ZN8CHostage10ObjectCapsEv", mfunc_ptr_cast(&CHostage::ObjectCaps_) }, + //{ 0x01D50D80, "_ZN8CHostage8ClassifyEv", mfunc_ptr_cast(&CHostage::Classify_) }, + { 0x01D4CE30, "_ZN8CHostage10TakeDamageEP9entvars_sS1_fi", mfunc_ptr_cast(&CHostage::TakeDamage_) }, + //{ 0x01D50D90, "_ZN8CHostage10BloodColorEv", mfunc_ptr_cast(&CHostage::BloodColor_) }, + { 0x01D4DB10, "_ZN8CHostage5TouchEP11CBaseEntity", mfunc_ptr_cast(&CHostage::Touch_) }, + { 0x01D4D710, "_ZN8CHostage3UseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CHostage::Use_) }, + //non-virtual func - //{ 0x01D4C450, "_ZN8CHostage9IdleThinkEv", mfunc_ptr_cast(&CHostage::IdleThink) }, // export func - //{ 0x0, "_ZN8CHostage6RemoveEv", mfunc_ptr_cast(&CHostage::Remove) }, - { 0x01D4CC20, "_ZN8CHostage10RePositionEv", mfunc_ptr_cast(&CHostage::RePosition) }, + //!!{ 0x01D4C450, "_ZN8CHostage9IdleThinkEv", mfunc_ptr_cast(&CHostage::IdleThink) }, // export func + { 0x01D4CBB0, "_ZN8CHostage6RemoveEv", mfunc_ptr_cast(&CHostage::Remove) }, + { 0x01D4CC20, "_ZN8CHostage10RePositionEv", mfunc_ptr_cast(&CHostage::RePosition) }, // do not use the hook together CHostage::IdleThink { 0x01D4C3E0, "_ZN8CHostage11SetActivityEi", mfunc_ptr_cast(&CHostage::SetActivity) }, - //{ 0x0, "_ZN8CHostage11GetActivityEv", mfunc_ptr_cast(&CHostage::GetActivity) }, - //{ 0x0, "_ZN8CHostage17GetModifiedDamageEfi", mfunc_ptr_cast(&CHostage::GetModifiedDamage) }, + //{ 0x0, "_ZN8CHostage11GetActivityEv", mfunc_ptr_cast(&CHostage::GetActivity) }, // NOXREF + //{ 0x01D4D290, "_ZN8CHostage17GetModifiedDamageEfi", mfunc_ptr_cast(&CHostage::GetModifiedDamage) }, // NOXREF //{ 0x01D4D390, "_ZN8CHostage17SetFlinchActivityEv", mfunc_ptr_cast(&CHostage::SetFlinchActivity) }, // NOXREF - //{ 0x0, "_ZN8CHostage16SetDeathActivityEv", mfunc_ptr_cast(&CHostage::SetDeathActivity) }, + { 0x01D4D400, "_ZN8CHostage16SetDeathActivityEv", mfunc_ptr_cast(&CHostage::SetDeathActivity) }, //{ 0x01D4D310, "_ZN8CHostage13PlayPainSoundEv", mfunc_ptr_cast(&CHostage::PlayPainSound) }, // NOXREF - //{ 0x0, "_ZN8CHostage21PlayFollowRescueSoundEv", mfunc_ptr_cast(&CHostage::PlayFollowRescueSound) }, - //{ 0x0, "_ZN8CHostage13AnnounceDeathEP11CBasePlayer", mfunc_ptr_cast(&CHostage::AnnounceDeath) }, + { 0x01D4D990, "_ZN8CHostage21PlayFollowRescueSoundEv", mfunc_ptr_cast(&CHostage::PlayFollowRescueSound) }, + { 0x01D4D580, "_ZN8CHostage13AnnounceDeathEP11CBasePlayer", mfunc_ptr_cast(&CHostage::AnnounceDeath) }, //{ 0x01D4D6A0, "_ZN8CHostage19ApplyHostagePenaltyEP11CBasePlayer", mfunc_ptr_cast(&CHostage::ApplyHostagePenalty) }, // NOXREF //{ 0x01D4DA80, "_ZN8CHostage16GiveCTTouchBonusEP11CBasePlayer", mfunc_ptr_cast(&CHostage::GiveCTTouchBonus) }, // NOXREF - //{ 0x01D4E580, "_ZN8CHostage22SendHostagePositionMsgEv", mfunc_ptr_cast(&CHostage::SendHostagePositionMsg) }, - //{ 0x0, "_ZN8CHostage19SendHostageEventMsgEv", mfunc_ptr_cast(&CHostage::SendHostageEventMsg) }, - //{ 0x01D4DC10, "_ZN8CHostage8DoFollowEv", mfunc_ptr_cast(&CHostage::DoFollow) }, + { 0x01D4E580, "_ZN8CHostage22SendHostagePositionMsgEv", mfunc_ptr_cast(&CHostage::SendHostagePositionMsg) }, + { 0x01D4E6F0, "_ZN8CHostage19SendHostageEventMsgEv", mfunc_ptr_cast(&CHostage::SendHostageEventMsg) }, + { 0x01D4DC10, "_ZN8CHostage8DoFollowEv", mfunc_ptr_cast(&CHostage::DoFollow) }, //{ 0x01D4E380, "_ZN8CHostage10IsOnLadderEv", mfunc_ptr_cast(&CHostage::IsOnLadder) }, // NOXREF - //{ 0x0, "_ZN8CHostage7PointAtERK6Vector", mfunc_ptr_cast(&CHostage::PointAt) }, - //{ 0x01D4E080, "_ZN8CHostage10MoveTowardERK6Vector", mfunc_ptr_cast(&CHostage::MoveToward) }, + { 0x01D4E010, "_ZN8CHostage7PointAtERK6Vector", mfunc_ptr_cast(&CHostage::PointAt) }, // NOXREF + { 0x01D4E080, "_ZN8CHostage10MoveTowardERK6Vector", mfunc_ptr_cast(&CHostage::MoveToward) }, { 0x01D4E3A0, "_ZN8CHostage8NavReadyEv", mfunc_ptr_cast(&CHostage::NavReady) }, - //{ 0x01D4E850, "_ZN8CHostage6WiggleEv", mfunc_ptr_cast(&CHostage::Wiggle) }, + { 0x01D4E850, "_ZN8CHostage6WiggleEv", mfunc_ptr_cast(&CHostage::Wiggle) }, { 0x01D4EAB0, "_ZN8CHostage8PreThinkEv", mfunc_ptr_cast(&CHostage::PreThink) }, - //{ 0x0, "_ZN8CHostage18IsFollowingSomeoneEv", mfunc_ptr_cast(&CHostage::IsFollowingSomeone) }, - //{ 0x0, "_ZN8CHostage9GetLeaderEv", mfunc_ptr_cast(&CHostage::GetLeader) }, - //{ 0x0, "_ZN8CHostage11IsFollowingEPK11CBaseEntity", mfunc_ptr_cast(&CHostage::IsFollowing) }, - //{ 0x0, "_ZN8CHostage7IsValidEv", mfunc_ptr_cast(&CHostage::IsValid) }, - //{ 0x0, "_ZN8CHostage6IsDeadEv", mfunc_ptr_cast(&CHostage::IsDead) }, - //{ 0x0, "_ZNK8CHostage8IsAtHomeEv", mfunc_ptr_cast(&CHostage::IsAtHome) }, - //{ 0x0, "_ZNK8CHostage15GetHomePositionEv", mfunc_ptr_cast(&CHostage::GetHomePosition) }, + //{ 0x0, "_ZN8CHostage18IsFollowingSomeoneEv", mfunc_ptr_cast(&CHostage::IsFollowingSomeone) }, // NOXREF + //{ 0x0, "_ZN8CHostage9GetLeaderEv", mfunc_ptr_cast(&CHostage::GetLeader) }, // NOXREF + //{ 0x0, "_ZN8CHostage11IsFollowingEPK11CBaseEntity", mfunc_ptr_cast(&CHostage::IsFollowing) }, // NOXREF + //{ 0x0, "_ZN8CHostage7IsValidEv", mfunc_ptr_cast(&CHostage::IsValid) }, // NOXREF + //{ 0x0, "_ZN8CHostage6IsDeadEv", mfunc_ptr_cast(&CHostage::IsDead) }, // NOXREF + //{ 0x0, "_ZNK8CHostage8IsAtHomeEv", mfunc_ptr_cast(&CHostage::IsAtHome) }, // NOXREF + //{ 0x0, "_ZNK8CHostage15GetHomePositionEv", mfunc_ptr_cast(&CHostage::GetHomePosition) }, // NOXREF + + { 0x01D4BDC0, "hostage_entity", (size_t)&hostage_entity }, + { 0x01D4BE10, "monster_scientist", (size_t)&monster_scientist }, //CHostageManager - //{ 0x01D4EE20, "_Z21Hostage_RegisterCVarsv", (size_t)&Hostage_RegisterCVars }, // NOXREF - //{ 0x01D4EE40, "_Z21InstallHostageManagerv", (size_t)&InstallHostageManager }, + //{ 0x01D4EEE0, "_ZN15CHostageManagerC2Ev", mfunc_ptr_cast(&CHostageManager::CHostageManager) }, { 0x01D4EF10, "_ZN15CHostageManager14ServerActivateEv", mfunc_ptr_cast(&CHostageManager::ServerActivate) }, //{ 0x0, "_ZN15CHostageManager16ServerDeactivateEv", mfunc_ptr_cast(&CHostageManager::ServerDeactivate) }, { 0x01D50670, "_ZN15CHostageManager12RestartRoundEv", mfunc_ptr_cast(&CHostageManager::RestartRound) }, //{ 0x01D506A0, "_ZN15CHostageManager10AddHostageEP8CHostage", mfunc_ptr_cast(&CHostageManager::AddHostage) }, // NOXREF //{ 0x0, "_ZN15CHostageManager10GetChatterEv", mfunc_ptr_cast(&CHostageManager::GetChatter) }, - //{ 0x0, "_ZNK15CHostageManager22IsNearbyHostageTalkingEP14CHostageImprov", mfunc_ptr_cast(&CHostageManager::IsNearbyHostageTalking) }, - //{ 0x0, "_ZNK15CHostageManager22IsNearbyHostageJumpingEP14CHostageImprov", mfunc_ptr_cast(&CHostageManager::IsNearbyHostageJumping) }, + { 0x01D506D0, "_ZNK15CHostageManager22IsNearbyHostageTalkingEP14CHostageImprov", mfunc_ptr_cast(&CHostageManager::IsNearbyHostageTalking) }, + //{ 0x01D50790, "_ZNK15CHostageManager22IsNearbyHostageJumpingEP14CHostageImprov", mfunc_ptr_cast(&CHostageManager::IsNearbyHostageJumping) }, { 0x01D50850, "_ZN15CHostageManager7OnEventE13GameEventTypeP11CBaseEntityS2_", mfunc_ptr_cast(&CHostageManager::OnEvent) }, //{ 0x0, "_ZN15CHostageManager17GetClosestHostageERK6VectorPf", mfunc_ptr_cast(&CHostageManager::GetClosestHostage) }, + //{ 0x01D4EE20, "_Z21Hostage_RegisterCVarsv", (size_t)&Hostage_RegisterCVars }, // NOXREF + //{ 0x01D4EE40, "_Z21InstallHostageManagerv", (size_t)&InstallHostageManager }, //SimpleChatter //{ 0x01D508A0, "_ZN13SimpleChatterC2Ev", mfunc_ptr_cast(&SimpleChatter::SimpleChatter) }, //{ 0x01D508D0, "_ZN13SimpleChatterD2Ev", mfunc_ptr_cast(&SimpleChatter::~SimpleChatter) }, { 0x01D50910, "_ZN13SimpleChatter8AddSoundE18HostageChatterTypePc", mfunc_ptr_cast(&SimpleChatter::AddSound) }, - //{ 0x01D50B40, "_ZN13SimpleChatter9PlaySoundEP11CBaseEntity18HostageChatterType", mfunc_ptr_cast(&SimpleChatter::PlaySound) }, - //{ 0x0, "_ZN13SimpleChatter8GetSoundE18HostageChatterTypePf", mfunc_ptr_cast(&SimpleChatter::GetSound) }, - //{ 0x0, "_ZN13SimpleChatter7ShuffleEPNS_10ChatterSetE", mfunc_ptr_cast(&SimpleChatter::Shuffle) }, + { 0x01D50B40, "_ZN13SimpleChatter9PlaySoundEP11CBaseEntity18HostageChatterType", mfunc_ptr_cast(&SimpleChatter::PlaySound) }, + //{ 0x01D50A60, "_ZN13SimpleChatter8GetSoundE18HostageChatterTypePf", mfunc_ptr_cast(&SimpleChatter::GetSound) }, // NOXREF + //{ 0x01D509E0, "_ZN13SimpleChatter7ShuffleEPNS_10ChatterSetE", mfunc_ptr_cast(&SimpleChatter::Shuffle) }, // NOXREF //CLocalNav + //{ 0x01D56E80, "_ZN9CLocalNavC2EP8CHostage", mfunc_ptr_cast(&CLocalNav::CLocalNav) }, + //{ 0x01D56ED0, "_ZN9CLocalNavD2Ev", mfunc_ptr_cast(&CLocalNav::~CLocalNav) }, //{ 0x0, "_ZN9CLocalNav12SetTargetEntEP11CBaseEntity", mfunc_ptr_cast(&CLocalNav::SetTargetEnt) }, // NOXREF { 0x01D57420, "_ZN9CLocalNav8FindPathER6VectorS1_fi", mfunc_ptr_cast(&CLocalNav::FindPath) }, { 0x01D57380, "_ZN9CLocalNav14SetupPathNodesEiP6Vectori", mfunc_ptr_cast(&CLocalNav::SetupPathNodes) }, - //{ 0x01D573D0, "_ZN9CLocalNav26GetFurthestTraversableNodeER6VectorPS0_ii", mfunc_ptr_cast(&CLocalNav::GetFurthestTraversableNode) }, + { 0x01D573D0, "_ZN9CLocalNav26GetFurthestTraversableNodeER6VectorPS0_ii", mfunc_ptr_cast(&CLocalNav::GetFurthestTraversableNode) }, { 0x01D57AC0, "_ZN9CLocalNav15PathTraversableER6VectorS1_i", mfunc_ptr_cast(&CLocalNav::PathTraversable) }, //{ 0x01D57A50, "_ZN9CLocalNav9PathClearER6VectorS1_iR11TraceResult", mfunc_ptr_cast(&CLocalNav::PathClear) }, // NOXREF //{ 0x0, "_ZN9CLocalNav9PathClearER6VectorS1_i", mfunc_ptr_cast(&CLocalNav::PathClear) }, // NOXREF { 0x01D58AC0, "_ZN9CLocalNav5ThinkEv", mfunc_ptr_cast(&CLocalNav::Think) }, - //{ 0x01D58D50, "_ZN9CLocalNav10RequestNavEP8CHostage", mfunc_ptr_cast(&CLocalNav::RequestNav) }, + //!@{ 0x01D58D50, "_ZN9CLocalNav10RequestNavEP8CHostage", mfunc_ptr_cast(&CLocalNav::RequestNav) }, { 0x01D58E20, "_ZN9CLocalNav5ResetEv", mfunc_ptr_cast(&CLocalNav::Reset) }, //{ 0x01D58E50, "_ZN9CLocalNav15HostagePrethinkEv", mfunc_ptr_cast(&CLocalNav::HostagePrethink) }, // NOXREF //{ 0x01D56F20, "_ZN9CLocalNav7AddNodeEiR6Vectoriih", mfunc_ptr_cast(&CLocalNav::AddNode) }, // NOXREF @@ -5306,11 +5321,11 @@ FunctionHook g_FunctionHooks[] = { 0x01D57040, "_ZN9CLocalNav11AddPathNodeEiiii", mfunc_ptr_cast(&CLocalNav::AddPathNode) }, { 0x01D57290, "_ZN9CLocalNav11GetBestNodeER6VectorS1_", mfunc_ptr_cast(&CLocalNav::GetBestNode) }, { 0x01D57EB0, "_ZN9CLocalNav16SlopeTraversableER6VectorS1_iR11TraceResult", mfunc_ptr_cast(&CLocalNav::SlopeTraversable) }, - //{ 0x01D580A0, "_ZN9CLocalNav17LadderTraversableER6VectorS1_iR11TraceResult", mfunc_ptr_cast(&CLocalNav::LadderTraversable) }, + { 0x01D580A0, "_ZN9CLocalNav17LadderTraversableER6VectorS1_iR11TraceResult", mfunc_ptr_cast(&CLocalNav::LadderTraversable) }, { 0x01D581D0, "_ZN9CLocalNav15StepTraversableER6VectorS1_iR11TraceResult", mfunc_ptr_cast(&CLocalNav::StepTraversable) }, { 0x01D583C0, "_ZN9CLocalNav12StepJumpableER6VectorS1_iR11TraceResult", mfunc_ptr_cast(&CLocalNav::StepJumpable) }, { 0x01D57810, "_ZN9CLocalNav14FindDirectPathER6VectorS1_fi", mfunc_ptr_cast(&CLocalNav::FindDirectPath) }, - //{ 0x01D585C0, "_ZN9CLocalNav9LadderHitER6VectorS1_R11TraceResult", mfunc_ptr_cast(&CLocalNav::LadderHit) }, + { 0x01D585C0, "_ZN9CLocalNav9LadderHitER6VectorS1_R11TraceResult", mfunc_ptr_cast(&CLocalNav::LadderHit) }, #endif // Hostage_Region @@ -5371,6 +5386,13 @@ VirtualTableRef g_TableRefs[] = { 0x01DF61DC, "CCSBot", 116 }, { 0x01DF64F0, "CCSBotManager", 12 }, { 0x01DF6C9C, "CHostage", 76 }, + { 0x01DF6FF4, "CImprov", 56 }, + { 0x01DF6E24, "CHostageImprov", 56 }, + { 0x01DF6F70, "HostageRetreatState", 4 }, + { 0x01DF6FE4, "HostageStateMachine", 4 }, + { 0x01DF7180, "HostageEscapeToCoverState", 4 }, + { 0x01DF6F18, "HostageAnimateState", 4 }, + { 0x01E00BBC, "CArmoury", CBASE_VIRTUAL_COUNT }, { 0x01DFE4E4, "CSoundEnt", CBASE_VIRTUAL_COUNT }, { 0x01DFE20C, "CAmbientGeneric", CBASE_VIRTUAL_COUNT }, @@ -5534,6 +5556,9 @@ VirtualTableRef g_TableRefs[] = { 0x01E01000, "CCSTutorBuyMenuState", 3 }, { 0x01E01010, "CCSTutorWaitingForStartState", 3 }, + { 0x01DF6478, "AttackState", 4 }, + { 0x01DF6FC8, "HostageIdleState", 4 }, + { NULL, NULL } // BaseClass__for_vtbl }; @@ -5547,7 +5572,7 @@ AddressRef g_FunctionRefs[] = { 0x01D43710, "_ZNK12CNavAreaGrid10GetNavAreaEPK6Vectorf", (size_t)&pGetNavArea }, { 0x01D2EDD0, "_ZN6CCSBot16UpdateLookAnglesEv", (size_t)&pCCSBot__UpdateLookAngles }, { 0x01D2D9B0, "_ZN6CCSBot6UpdateEv", (size_t)&pCCSBot__Update }, - { 0x01D5B350, "_Z16QuaternionMatrixPfPA4_f", (size_t)&pQuaternionMatrix }, + { 0x01D20AE0, "_ZN6CCSBot11ResetValuesEv", (size_t)&pCCSBot__ResetValues }, { 0x01D46310, "_Z17LoadNavigationMapv", (size_t)&pLoadNavigationMap }, { 0x01D19C70, "_ZN9BotPhrase9RandomizeEv", (size_t)&pBotPhrase__Randomize }, @@ -5556,6 +5581,7 @@ AddressRef g_FunctionRefs[] = { 0x01D3A060, "_Z20DestroyNavigationMapv", (size_t)&pDestroyNavigationMap }, { 0x01D80C90, "_Z16InstallGameRulesv", (size_t)&pInstallGameRules }, { 0x01D4C450, "_ZN8CHostage9IdleThinkEv", (size_t)&pCHostage__IdleThink }, + { 0x01D517A0, "_ZN14CHostageImprov11FaceTowardsERK6Vectorf", (size_t)&pCHostageImprov__FaceTowards }, #endif // Function_References_Region diff --git a/regamedll/hookers/memory.cpp b/regamedll/hookers/memory.cpp index 061df5ec..9945387f 100644 --- a/regamedll/hookers/memory.cpp +++ b/regamedll/hookers/memory.cpp @@ -725,7 +725,7 @@ bool HIDDEN HookFunction(Module *module, FunctionHook *hook) *(size_t *)&patch[1] = hook->handlerFunc - hook->originalAddress - 5; patch[0] = 0xE9; -#if 1 +#if 0 if (strcmp(hook->symbolName,"_ZNK9BotPhrase12GetSpeakableEiPf")==0) { addr_orig = (void *)hook->originalAddress; @@ -820,7 +820,7 @@ const char *stripClass(const char *str) return &string[ curlen ]; } -#if defined(_WIN32) && !defined(REGAMEDLL_UNIT_TESTS) +#if defined(HOOK_GAMEDLL) && defined(_WIN32) && !defined(REGAMEDLL_UNIT_TESTS) void VirtualTableInit(void *ptr, const char *baseClass) { diff --git a/regamedll/hookers/memory.h b/regamedll/hookers/memory.h index dfe45492..32ebb8d7 100644 --- a/regamedll/hookers/memory.h +++ b/regamedll/hookers/memory.h @@ -144,7 +144,7 @@ bool HIDDEN FindDataRef(Module *module, AddressRef *ref); void FindAllCalls(Section* section, CFuncAddr** calls, uint32_t findRefsTo); #endif -#if defined(_WIN32) && !defined(REGAMEDLL_UNIT_TESTS) +#if defined(HOOK_GAMEDLL) && defined(_WIN32) && !defined(REGAMEDLL_UNIT_TESTS) const char *stripClass(const char *str); void VirtualTableInit(void *ptr, const char *baseClass = NULL); diff --git a/regamedll/hookers/osconfig.h b/regamedll/hookers/osconfig.h index 32ef578d..1e1f224a 100644 --- a/regamedll/hookers/osconfig.h +++ b/regamedll/hookers/osconfig.h @@ -143,14 +143,19 @@ #ifdef HOOK_GAMEDLL #define WINAPI_HOOK __stdcall +#else + #define WINAPI_HOOK /**/ #endif // HOOK_GAMEDLL #define STDCALL __stdcall #define HIDDEN - #define _DLLEXPORT __declspec(dllexport) - #define _DECL_NAKED __declspec(naked) - #define C_DLLEXPORT extern "C" __declspec(dllexport) + // Attributes to specify an "exported" function, visible from outside the + // DLL. + #undef DLLEXPORT + #define DLLEXPORT __declspec(dllexport) + // WINAPI should be provided in the windows compiler headers. + // It's usually defined to something like "__stdcall". typedef int socklen_t; #define SOCKET_FIONBIO(s, m) ioctlsocket(s, FIONBIO, (u_long*)&m) @@ -182,9 +187,10 @@ #define CDECL __attribute__ ((cdecl)) #define STDCALL __attribute__ ((stdcall)) #define HIDDEN __attribute__((visibility("hidden"))) - #define _DLLEXPORT __attribute__((visibility("default"))) - #define _DECL_NAKED __attribute__((naked)) - #define C_DLLEXPORT extern "C" __attribute__((visibility("default"))) + + #undef DLLEXPORT + #define DLLEXPORT __attribute__((visibility("default"))) + #define WINAPI /* */ typedef int SOCKET; #define INVALID_SOCKET (SOCKET)(~0) @@ -207,6 +213,15 @@ #endif #endif // _WIN32 +// Simplified macro for declaring/defining exported DLL functions. They +// need to be 'extern "C"' so that the C++ compiler enforces parameter +// type-matching, rather than considering routines with mis-matched +// arguments/types to be overloaded functions... +// +// AFAIK, this is os-independent, but it's included here in osdep.h where +// DLLEXPORT is defined, for convenience. +#define C_DLLEXPORT extern "C" DLLEXPORT + #ifdef _WIN32 static const bool __isWindows = true; static const bool __isLinux = false; @@ -216,7 +231,6 @@ #endif extern void regamedll_log(const char *fmt, ...); - extern void regamedll_syserror(const char *fmt, ...); #endif // OSCONFIG_H diff --git a/regamedll/msvc/PostBuild_mp.bat b/regamedll/msvc/PostBuild_mp.bat new file mode 100644 index 00000000..b0a94b59 --- /dev/null +++ b/regamedll/msvc/PostBuild_mp.bat @@ -0,0 +1,39 @@ +@echo OFF +:: +:: Post-build auto-deploy script +:: Create and fill PublishPath_mp.txt file with path to deployment folder +:: I.e. PublishPath_mp.txt should contain one line with a folder path +:: Call it so: +:: IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)") +:: + +SET targetDir=%~1 +SET targetName=%~2 +SET targetExt=%~3 +SET projectDir=%~4 +SET destination= + +IF NOT EXIST "%projectDir%\PublishPath_mp.txt" ( + ECHO No deployment path specified. Create PublishPath_mp.txt near PostBuild.bat with paths on separate lines for auto deployment. + exit /B 0 +) + +FOR /f "tokens=* delims= usebackq" %%a IN ("%projectDir%\PublishPath_mp.txt") DO ( + ECHO Deploying to: %%a + IF NOT "%%a" == "" ( + copy /Y "%targetDir%%targetName%%targetExt%" "%%a" + IF NOT ERRORLEVEL 1 ( + IF EXIST "%targetDir%%targetName%.pdb" ( + copy /Y "%targetDir%%targetName%.pdb" "%%a" + ) + ) ELSE ( + ECHO PostBuild.bat ^(27^) : warning : Can't copy '%targetName%%targetExt%' to deploy path '%%a' + ) + ) +) + +IF "%%a" == "" ( + ECHO No deployment path specified. +) + +exit /B 0 \ No newline at end of file diff --git a/regamedll/msvc/ReGameDLL.vcxproj b/regamedll/msvc/ReGameDLL.vcxproj index 36462c5c..f758ce12 100644 --- a/regamedll/msvc/ReGameDLL.vcxproj +++ b/regamedll/msvc/ReGameDLL.vcxproj @@ -1,6 +1,14 @@  + + Debug MP Play + Win32 + + + Debug MP + Win32 + Debug Play Win32 @@ -31,49 +39,75 @@ false false + false + false false false + + + + false false + false + false false false + + + + false + + + + false false false false + false + false false false + + + + false false + false + false false false false false + false + false false false @@ -81,6 +115,10 @@ false + + + + false false @@ -88,100 +126,140 @@ false + + + + false false + + + + false + false + false false false + false + false false false false + false + false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false @@ -205,34 +283,50 @@ false false + false + false false false + false + false false false + false + false false false + false + false false false + false + false false false + false + false false false + false + false false false + false + false @@ -274,167 +368,223 @@ false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false false + false + false false false false + false + false false false false @@ -442,6 +592,8 @@ false false + false + false false false @@ -456,19 +608,34 @@ - + + true + true + true + true + true + + + true + true - true true true + true + + true true - + + true + + + @@ -482,6 +649,8 @@ true true true + true + true @@ -495,20 +664,52 @@ Create precompiled.h Create + Create + Create precompiled.h + precompiled.h + precompiled.h Create precompiled.h - - - - - - - - + + true + + + + + true + + + + + true + + + + + true + + + + + true + true + + + true + true + + + true + true + + + true + true + @@ -540,17 +741,31 @@ + + + + + + + + + + + + false + false + false @@ -713,11 +928,15 @@ true true + true + true true true true + true + true true @@ -751,6 +970,18 @@ MultiByte v120 + + DynamicLibrary + true + MultiByte + v120 + + + DynamicLibrary + true + MultiByte + v120 + Application true @@ -780,6 +1011,12 @@ + + + + + + @@ -803,6 +1040,18 @@ + + mp + AllRules.ruleset + + + + + mp + AllRules.ruleset + + + filesystem_stdio AllRules.ruleset @@ -841,7 +1090,7 @@ Level3 Disabled true - HOOK_GAMEDLL;REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;DEDICATED;_CRT_SECURE_NO_WARNINGS;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;NOMINMAX;%(PreprocessorDefinitions) + HOOK_GAMEDLL;REGAMEDLL_FIXES;REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;DEDICATED;_CRT_SECURE_NO_WARNINGS;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;NOMINMAX;%(PreprocessorDefinitions) Precise /arch:IA32 %(AdditionalOptions) MultiThreadedDebug @@ -904,6 +1153,78 @@ subversion.always.run + + + IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\") + Setup version from SVN revision + + + $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\common;$(ProjectDir)\..\dlls;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\regamedll\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) + Level3 + Disabled + true + CSTRIKE;REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;DEDICATED;_CRT_SECURE_NO_WARNINGS;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions) + Precise + /arch:IA32 %(AdditionalOptions) + MultiThreadedDebug + Use + precompiled.h + + + true + psapi.lib;ws2_32.lib;$(ProjectDir)../lib/steam_api.lib;%(AdditionalDependencies) + + + mp.def + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + IF EXIST "$(ProjectDir)PostBuild_mp.bat" (CALL "$(ProjectDir)PostBuild_mp.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)") + Automatic deployment script + + + echo Empty Action + Force build to run Pre-Build event + subversion.always.run + subversion.always.run + + + + + IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\") + Setup version from SVN revision + + + $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\common;$(ProjectDir)\..\dlls;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\regamedll\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) + Level3 + Disabled + true + REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;DEDICATED;_CRT_SECURE_NO_WARNINGS;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions) + Precise + /arch:IA32 %(AdditionalOptions) + MultiThreadedDebug + Use + precompiled.h + + + true + psapi.lib;ws2_32.lib;$(ProjectDir)../lib/steam_api.lib;%(AdditionalDependencies) + + + mp.def + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + IF EXIST "$(ProjectDir)PostBuild_mp.bat" (CALL "$(ProjectDir)PostBuild_mp.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)") + Automatic deployment script + + + echo Empty Action + Force build to run Pre-Build event + subversion.always.run + subversion.always.run + + IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\") diff --git a/regamedll/msvc/mp.def b/regamedll/msvc/mp.def new file mode 100644 index 00000000..2a12a7c4 --- /dev/null +++ b/regamedll/msvc/mp.def @@ -0,0 +1,5 @@ +LIBRARY mp +EXPORTS + GiveFnptrsToDll @1 +SECTIONS + .data READ WRITE diff --git a/regamedll/pm_shared/pm_shared.cpp b/regamedll/pm_shared/pm_shared.cpp index 186134f3..00db4e6a 100644 --- a/regamedll/pm_shared/pm_shared.cpp +++ b/regamedll/pm_shared/pm_shared.cpp @@ -29,7 +29,7 @@ static int pm_shared_initialized = 0; -static vec_t rgv3tStuckTable[54][3]; +static vec3_t rgv3tStuckTable[54]; static int rgStuckLast[MAX_CLIENTS][2]; static int pm_gcTextures = 0; @@ -2666,7 +2666,11 @@ void PM_DropPunchAngle(vec_t *punchangle) len = VectorNormalize(punchangle); len -= (10.0 + len * 0.5) * pmove->frametime; +#ifdef HOOK_GAMEDLL len = Q_max(len, 0.0); +#else + len = Q_max(len, 0.0f); +#endif // HOOK_GAMEDLL VectorScale(punchangle, len, punchangle); } @@ -3172,9 +3176,9 @@ void PM_CreateStuckTable(void) } // This module implements the shared player physics code between any particular game and -// the engine. The same PM_Move routine is built into the game .dll and the client .dll and is -// invoked by each side as appropriate. There should be no distinction, internally, between server -// and client. This will ensure that prediction behaves appropriately. +// the engine. The same PM_Move routine is built into the game .dll and the client .dll and is +// invoked by each side as appropriate. There should be no distinction, internally, between server +// and client. This will ensure that prediction behaves appropriately. /* <2ce182> ../cstrike/pm_shared/pm_shared.c:3596 */ void PM_Move(struct playermove_s *ppmove, int server) diff --git a/regamedll/unittests/struct_offsets_tests.cpp b/regamedll/unittests/struct_offsets_tests.cpp index 1c944025..ae5be87d 100644 --- a/regamedll/unittests/struct_offsets_tests.cpp +++ b/regamedll/unittests/struct_offsets_tests.cpp @@ -62,13 +62,14 @@ TEST(StructOffsets, ReversingChecks, 5000) REPEAT_SIZEOF_PRINT(CCareerTaskManager); REPEAT_SIZEOF_PRINT(CCareerTask); REPEAT_SIZEOF_PRINT(CPreventDefuseTask); - + // offset the members REPEAT_OFFSETOF_PRINT(CBaseEntity, pev); REPEAT_OFFSETOF_PRINT(CBaseEntity, has_disconnected); //REPEAT_OFFSETOF_PRINT(CPreventDefuseTask, m_bombPlantedThisRound); //REPEAT_OFFSETOF_PRINT(CPreventDefuseTask, m_defuseStartedThisRound); +#ifdef HOOK_GAMEDLL // assert CHECK_CLASS_SIZE(CNavArea, 0x238u, 0x214u); @@ -81,7 +82,7 @@ TEST(StructOffsets, ReversingChecks, 5000) CHECK_CLASS_SIZE(BotPhraseManager, 0x21Cu, 0x214u); CHECK_CLASS_SIZE(BotPhrase, 0x50, 0x44); - + CHECK_CLASS_SIZE(CHalfLifeMultiplay, 0x2D0u, 0x2C4u); CHECK_CLASS_SIZE(CHalfLifeTraining, 0x2E8u, 0x2D8u); CHECK_CLASS_SIZE(CGib, 0x98, 0xA8); @@ -102,6 +103,7 @@ TEST(StructOffsets, ReversingChecks, 5000) //CHECK_CLASS_SIZE(HostageStateMachine, 0x10, 0x10); //CHECK_CLASS_SIZE(HostageFollowState, 0x4C, 0x4C); //CHECK_CLASS_SIZE(CCSBot, 0x2CA0, 0x2CA0); +#endif // HOOK_GAMEDLL } #pragma warning( pop ) diff --git a/shared.gradle b/shared.gradle index b251219b..2ca4ca2c 100644 --- a/shared.gradle +++ b/shared.gradle @@ -10,24 +10,24 @@ apply from: 'shared_msvc.gradle' apply from: 'shared_icc.gradle' rootProject.ext.createToolchainConfig = { NativeBinarySpec bin -> - BinaryKind binaryKind - if (bin instanceof NativeExecutableBinarySpec) { - binaryKind = BinaryKind.EXECUTABLE - } else if (bin instanceof SharedLibraryBinarySpec) { - binaryKind = BinaryKind.SHARED_LIBRARY - } else if (bin instanceof StaticLibraryBinarySpec) { - binaryKind = BinaryKind.STATIC_LIBRARY - } else { - throw new RuntimeException("Unknown executable kind ${bin.class.name}") - } + BinaryKind binaryKind + if (bin instanceof NativeExecutableBinarySpec) { + binaryKind = BinaryKind.EXECUTABLE + } else if (bin instanceof SharedLibraryBinarySpec) { + binaryKind = BinaryKind.SHARED_LIBRARY + } else if (bin instanceof StaticLibraryBinarySpec) { + binaryKind = BinaryKind.STATIC_LIBRARY + } else { + throw new RuntimeException("Unknown executable kind ${bin.class.name}") + } - boolean releaseBuild = bin.buildType.name.toLowerCase() == 'release' + boolean releaseBuild = bin.buildType.name.toLowerCase() == 'release' - if (bin.toolChain instanceof VisualCpp) { - return rootProject.createMsvcConfig(releaseBuild, binaryKind) - } else if (bin.toolChain instanceof Icc) { - return rootProject.createIccConfig(releaseBuild, binaryKind) - } else { - throw new RuntimeException("Unknown native toolchain: ${bin.toolChain.class.name}") - } + if (bin.toolChain instanceof VisualCpp) { + return rootProject.createMsvcConfig(releaseBuild, binaryKind) + } else if (bin.toolChain instanceof Icc) { + return rootProject.createIccConfig(releaseBuild, binaryKind) + } else { + throw new RuntimeException("Unknown native toolchain: ${bin.toolChain.class.name}") + } } diff --git a/shared_icc.gradle b/shared_icc.gradle index 2ad70b59..793dbe6d 100644 --- a/shared_icc.gradle +++ b/shared_icc.gradle @@ -3,62 +3,56 @@ import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig import org.doomedsociety.gradlecpp.gcc.OptimizationLevel rootProject.ext.createIccConfig = { boolean release, BinaryKind binKind -> - GccToolchainConfig cfg - if (release) { - cfg = new GccToolchainConfig( - compilerOptions: new GccToolchainConfig.CompilerOptions( - optimizationLevel: OptimizationLevel.LEVEL_3, - stackProtector: false, - interProceduralOptimizations: true, + GccToolchainConfig cfg + if (release) { + cfg = new GccToolchainConfig( + compilerOptions: new GccToolchainConfig.CompilerOptions( + optimizationLevel: OptimizationLevel.LEVEL_3, + stackProtector: false, + interProceduralOptimizations: true, - noBuiltIn: true, + noBuiltIn: true, - intelExtensions: false, - asmBlocks: true, + intelExtensions: false, + asmBlocks: true, - positionIndependentCode: false - ), + positionIndependentCode: false + ), + linkerOptions: new GccToolchainConfig.LinkerOptions( + interProceduralOptimizations: true, + stripSymbolTable: true, + staticLibGcc: true, + staticIntel: true, + ), + librarianOptions: new GccToolchainConfig.LibrarianOptions( + ) + ) + } else { + //debug + cfg = new GccToolchainConfig( + compilerOptions: new GccToolchainConfig.CompilerOptions( + optimizationLevel: OptimizationLevel.DISABLE, + stackProtector: true, + interProceduralOptimizations: false, - linkerOptions: new GccToolchainConfig.LinkerOptions( - interProceduralOptimizations: true, - stripSymbolTable: true, - staticLibGcc: true, - staticIntel: true, - ), + noBuiltIn: true, + intelExtensions: false, + asmBlocks: true, - librarianOptions: new GccToolchainConfig.LibrarianOptions( + extraDefines: [ + '_ITERATOR_DEBUG_LEVEL': 0, // for std::list, disable debug iterator in debug mode + ] + ), + linkerOptions: new GccToolchainConfig.LinkerOptions( + interProceduralOptimizations: false, + stripSymbolTable: false, + staticLibGcc: true, + staticIntel: true, + ), + librarianOptions: new GccToolchainConfig.LibrarianOptions( + ) + ) + } - ) - ) - } else { - //debug - cfg = new GccToolchainConfig( - compilerOptions: new GccToolchainConfig.CompilerOptions( - optimizationLevel: OptimizationLevel.DISABLE, - stackProtector: true, - interProceduralOptimizations: false, - - noBuiltIn: true, - intelExtensions: false, - asmBlocks: true, - - extraDefines: [ - '_ITERATOR_DEBUG_LEVEL': 0, // for std::list, disable debug iterator in debug mode - ] - ), - - linkerOptions: new GccToolchainConfig.LinkerOptions( - interProceduralOptimizations: false, - stripSymbolTable: false, - staticLibGcc: true, - staticIntel: true, - ), - - librarianOptions: new GccToolchainConfig.LibrarianOptions( - - ) - ) - } - - return cfg + return cfg } diff --git a/shared_msvc.gradle b/shared_msvc.gradle index 1c58e306..ea8fe42e 100644 --- a/shared_msvc.gradle +++ b/shared_msvc.gradle @@ -13,112 +13,106 @@ import org.doomedsociety.gradlecpp.msvc.RuntimeChecks import org.doomedsociety.gradlecpp.msvc.WarningLevel rootProject.ext.createMsvcConfig = { boolean release, BinaryKind binKind -> - MsvcToolchainConfig cfg - if (release) { - cfg = new MsvcToolchainConfig( - compilerOptions: new MsvcToolchainConfig.CompilerOptions( - codeGeneration: CodeGenerationKind.MULTITHREADED, - optimizationLevel: OptimizationLevel.FULL_OPTIMIZATION, - debugInfoFormat: DebugInfoFormat.PROGRAM_DATABASE, - runtimeChecks: RuntimeChecks.DEFAULT, - cppExceptions: CppExceptions.ENABLED_WITH_SEH, - warningLevel: WarningLevel.LEVEL_3, - callingConvention: CallingConvention.CDECL, - enhancedInstructionsSet: EnhancedInstructionsSet.SSE2, - floatingPointModel: FloatingPointModel.FAST, + MsvcToolchainConfig cfg + if (release) { + cfg = new MsvcToolchainConfig( + compilerOptions: new MsvcToolchainConfig.CompilerOptions( + codeGeneration: CodeGenerationKind.MULTITHREADED, + optimizationLevel: OptimizationLevel.FULL_OPTIMIZATION, + debugInfoFormat: DebugInfoFormat.PROGRAM_DATABASE, + runtimeChecks: RuntimeChecks.DEFAULT, + cppExceptions: CppExceptions.ENABLED_WITH_SEH, + warningLevel: WarningLevel.LEVEL_3, + callingConvention: CallingConvention.CDECL, + enhancedInstructionsSet: EnhancedInstructionsSet.SSE2, + floatingPointModel: FloatingPointModel.FAST, - enableMinimalRebuild: false, - omitFramePointers: false, - wholeProgramOptimization: true, - enabledFunctionLevelLinking: true, - enableSecurityCheck: true, - analyzeCode: false, - sdlChecks: false, - treatWarningsAsErrors: false, - treatWchartAsBuiltin: true, - forceConformanceInForLoopScope: true, + enableMinimalRebuild: false, + omitFramePointers: false, + wholeProgramOptimization: true, + enabledFunctionLevelLinking: true, + enableSecurityCheck: true, + analyzeCode: false, + sdlChecks: false, + treatWarningsAsErrors: false, + treatWchartAsBuiltin: true, + forceConformanceInForLoopScope: true, - extraDefines: [ - 'WIN32': null, - '_MBCS': null, - 'NDEBUG': null, - ] - ), + extraDefines: [ + 'WIN32': null, + '_MBCS': null, + 'NDEBUG': null, + ] + ), + linkerOptions: new MsvcToolchainConfig.LinkerOptions( + linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG, + errorReportingMode: ErrorReporting.NO_ERROR_REPORT, - linkerOptions: new MsvcToolchainConfig.LinkerOptions( - linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG, - errorReportingMode: ErrorReporting.NO_ERROR_REPORT, + enableIncrementalLinking: false, + eliminateUnusedRefs: true, + enableCOMDATFolding: true, + generateDebugInfo: true, + dataExecutionPrevention: true, + randomizedBaseAddress: true, + ), + librarianOptions: new MsvcToolchainConfig.LibrarianOptions( + linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG + ), + generatePdb: true + ) + } else { + //debug + cfg = new MsvcToolchainConfig( + compilerOptions: new MsvcToolchainConfig.CompilerOptions( + codeGeneration: CodeGenerationKind.MULTITHREADED_DEBUG, + optimizationLevel: OptimizationLevel.DISABLED, + debugInfoFormat: DebugInfoFormat.PROGRAM_DATABASE, + runtimeChecks: RuntimeChecks.DEFAULT, + cppExceptions: CppExceptions.ENABLED_WITH_SEH, + warningLevel: WarningLevel.LEVEL_3, + callingConvention: CallingConvention.CDECL, + enhancedInstructionsSet: EnhancedInstructionsSet.SSE2, + floatingPointModel: FloatingPointModel.FAST, - enableIncrementalLinking: false, - eliminateUnusedRefs: true, - enableCOMDATFolding: true, - generateDebugInfo: true, - dataExecutionPrevention: true, - randomizedBaseAddress: true - ), + enableMinimalRebuild: true, + omitFramePointers: false, + wholeProgramOptimization: false, + enabledFunctionLevelLinking: true, + enableSecurityCheck: true, + analyzeCode: false, + sdlChecks: false, + treatWarningsAsErrors: false, + treatWchartAsBuiltin: true, + forceConformanceInForLoopScope: true, - librarianOptions: new MsvcToolchainConfig.LibrarianOptions( - linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG - ), + extraDefines: [ + 'WIN32': null, + '_MBCS': null, + '_DEBUG': null, + '_ITERATOR_DEBUG_LEVEL': 0, // for std::list, disable debug iterator in debug mode + ] + ), + linkerOptions: new MsvcToolchainConfig.LinkerOptions( + linkTimeCodeGenKind: LinkTimeCodeGenKind.DEFAULT, + errorReportingMode: ErrorReporting.NO_ERROR_REPORT, - generatePdb: true - ) - } else { - //debug - cfg = new MsvcToolchainConfig( - compilerOptions: new MsvcToolchainConfig.CompilerOptions( - codeGeneration: CodeGenerationKind.MULTITHREADED_DEBUG, - optimizationLevel: OptimizationLevel.DISABLED, - debugInfoFormat: DebugInfoFormat.PROGRAM_DATABASE, - runtimeChecks: RuntimeChecks.DEFAULT, - cppExceptions: CppExceptions.ENABLED_WITH_SEH, - warningLevel: WarningLevel.LEVEL_3, - callingConvention: CallingConvention.CDECL, - enhancedInstructionsSet: EnhancedInstructionsSet.SSE2, - floatingPointModel: FloatingPointModel.FAST, + enableIncrementalLinking: true, + eliminateUnusedRefs: false, + enableCOMDATFolding: false, + generateDebugInfo: true, + dataExecutionPrevention: true, + randomizedBaseAddress: true + ), + librarianOptions: new MsvcToolchainConfig.LibrarianOptions( + linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG + ), + generatePdb: true + ) - enableMinimalRebuild: true, - omitFramePointers: false, - wholeProgramOptimization: false, - enabledFunctionLevelLinking: true, - enableSecurityCheck: true, - analyzeCode: false, - sdlChecks: false, - treatWarningsAsErrors: false, - treatWchartAsBuiltin: true, - forceConformanceInForLoopScope: true, + if (binKind == BinaryKind.STATIC_LIBRARY) { + cfg.compilerConfig.extraDefines['_LIB'] = null + } + } - extraDefines: [ - 'WIN32': null, - '_MBCS': null, - '_DEBUG': null, - '_ITERATOR_DEBUG_LEVEL': 0, // for std::list, disable debug iterator in debug mode - ] - ), - - linkerOptions: new MsvcToolchainConfig.LinkerOptions( - linkTimeCodeGenKind: LinkTimeCodeGenKind.DEFAULT, - errorReportingMode: ErrorReporting.NO_ERROR_REPORT, - - enableIncrementalLinking: true, - eliminateUnusedRefs: false, - enableCOMDATFolding: false, - generateDebugInfo: true, - dataExecutionPrevention: true, - randomizedBaseAddress: true - ), - - librarianOptions: new MsvcToolchainConfig.LibrarianOptions( - linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG - ), - - generatePdb: true - ) - - if (binKind == BinaryKind.STATIC_LIBRARY) { - cfg.compilerConfig.extraDefines['_LIB'] = null - } - } - - return cfg + return cfg } \ No newline at end of file