Refactoring and cleanup.

Fixed some critical bugs and typos (carrer_task, tutor, zbot and other)
Added command line option `-bots` to run bots in CS 1.6
Removed the tests demo record/player from myself the project and also dependency of the steam library.
Fixed the progress bar when generating a nav file.
This commit is contained in:
s1lentq 2016-02-23 05:13:52 +06:00
parent eb92f4a615
commit 3d252fe527
297 changed files with 4374 additions and 26994 deletions

View File

@ -50,11 +50,9 @@ model {
}
}
binaries.all { NativeBinarySpec b ->
project.setupToolchain(b)
}
}
}
}

View File

@ -55,12 +55,8 @@ void createIntergrationTestTask(NativeBinarySpec b) {
if (!GradleCppUtils.windows) return
if (regamedllFixes) return
def libLinkTask = GradleCppUtils.getLinkTask(b)
String unitTestTask = b.hasProperty('cppUnitTestTask') ? b.cppUnitTestTask : null
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')
@ -69,12 +65,10 @@ void createIntergrationTestTask(NativeBinarySpec b) {
testFor = b
//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
//dependencies on test executable
if (unitTestTask) {
dependsOn unitTestTask
}
@ -88,17 +82,6 @@ void createIntergrationTestTask(NativeBinarySpec b) {
b.buildTask.dependsOn demoItgTestTask
}
void setupUnitTests(NativeBinarySpec bin) {
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)
}
}
void postEvaluate(NativeBinarySpec b) {
// attach generateAppVersion task to all 'compile source' tasks
@ -106,7 +89,6 @@ void postEvaluate(NativeBinarySpec b) {
t.dependsOn project.generateAppVersion
}
setupUnitTests(b)
createIntergrationTestTask(b)
}
@ -117,7 +99,7 @@ void setupToolchain(NativeBinarySpec b)
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')
cfg.projectInclude(project, '', '/engine', '/common', '/dlls', '/game_shared', '/pm_shared', '/regamedll', '/hookers', '/public', '/public/regamedll')
if (unitTestExecutable)
{
@ -147,9 +129,6 @@ void setupToolchain(NativeBinarySpec b)
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)
{
@ -172,8 +151,7 @@ void setupToolchain(NativeBinarySpec b)
cfg.linkerOptions.args '-no-opt-class-analysis'
cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp', '-g'
cfg.projectLibpath(project, '/lib/linux32')
cfg.extraLibs 'dl', 'm', 'stdc++', 'steam_api'
cfg.extraLibs 'dl', 'm', 'stdc++'
}
if (mpLib && GradleCppUtils.windows && !unitTestExecutable)
@ -183,8 +161,6 @@ void setupToolchain(NativeBinarySpec b)
if (!unitTestExecutable)
{
//cfg.singleDefines 'CSTRIKE'
if (!mpLib)
{
cfg.singleDefines 'HOOK_GAMEDLL'
@ -201,7 +177,6 @@ void setupToolchain(NativeBinarySpec b)
}
ToolchainConfigUtils.apply(project, cfg, b)
GradleCppUtils.onTasksCreated(project, 'postEvaluate', {
postEvaluate(b)
})
@ -213,27 +188,21 @@ class RegamedllSrc {
source {
srcDirs "engine", "dlls", "game_shared", "pm_shared", "regamedll", "public", "version"
if (GradleCppUtils.windows) {
srcDirs "testsuite"
}
include "**/*.cpp"
exclude "precompiled.cpp"
exclude "tier0/dbg.cpp", "utlsymbol.cpp", "utlbuffer.cpp"
if (GradleCppUtils.windows) {
if (GradleCppUtils.windows)
{
exclude "tier0/platform_linux.cpp"
} else {
}
else
{
exclude "tier0/platform_win32.cpp"
exclude "classes_dummy.cpp"
}
}
source {
srcDirs "hookers"
include "**/*.cpp"
exclude "6153_hooker.cpp", "hooker.cpp", "main.cpp", "main_mp.cpp", "hooker_impl.cpp"
}
}
}
@ -250,26 +219,16 @@ class RegamedllSrc {
h.regamedll_hooker_src(CppSourceSet) {
source {
srcDirs "hookers"
include "6153_hooker.cpp", "hooker.cpp", "hooker_impl.cpp"
include "main.cpp", "6153_hooker.cpp", "hooker.cpp", "memory.cpp", "hooker_impl.cpp", "RegameDLLRuntimeConfig.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) {
static void regamedll_mp_src(def h) {
h.regamedll_mp_src(CppSourceSet) {
source {
srcDirs "hookers"
include "main_mp.cpp"
exclude "memory.cpp"
}
}
}
@ -318,7 +277,6 @@ model {
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) }
@ -330,7 +288,7 @@ model {
sources {
RegamedllSrc.regamedll_pch(it)
RegamedllSrc.regamedll_src(it)
RegamedllSrc.regamedll_mp_main_src(it)
RegamedllSrc.regamedll_mp_src(it)
}
binaries.all { NativeBinarySpec b -> project.setupToolchain(b) }
}

View File

@ -32,7 +32,9 @@
#pragma once
#endif
#include "maintypes.h"
#include "custom.h"
#include "bspfile.h"
#define STUDIO_RENDER 1
#define STUDIO_EVENTS 2
@ -157,7 +159,7 @@ struct decal_s
typedef struct mleaf_s
{
// common with node
// common with node
int contents; // wil be a negative contents number
int visframe; // node needs to be traversed if current
@ -165,7 +167,7 @@ typedef struct mleaf_s
struct mnode_s *parent;
// leaf specific
// leaf specific
byte *compressed_vis;
struct efrag_s *efrags;
@ -279,7 +281,7 @@ typedef struct model_s
color24 *lightdata;
char *entities;
// additional model data
// additional model data
cache_user_t cache; // only access through Mod_Extradata
} model_t;

View File

@ -33,10 +33,26 @@
#endif
// buttons
#ifndef IN_BUTTONS_H
#include "in_buttons.h"
#endif
// Max # of clients allowed in a server.
#define MAX_CLIENTS 32
// How many bits to use to encode an edict.
#define MAX_EDICT_BITS 11 // # of bits needed to represent max edicts
// Max # of edicts in a level (2048)
#define MAX_EDICTS (1<<MAX_EDICT_BITS)
// How many data slots to use when in multiplayer (must be power of 2)
#define MULTIPLAYER_BACKUP 64
// Same for single player
#define SINGLEPLAYER_BACKUP 8
// Constants shared by the engine and dlls
// This header file included by engine files and DLL files.
// Most came from server.h
// edict->flags
#define FL_FLY (1<<0) // Changes the SV_Movestep() behavior to not need to be on ground
#define FL_SWIM (1<<1) // Changes the SV_Movestep() behavior to not need to be on ground (but stay in water)
#define FL_CONVEYOR (1<<2)

View File

@ -39,7 +39,7 @@
typedef double float_precision;
#else // PLAY_GAMEDLL
#else
typedef float float_precision;
@ -86,11 +86,11 @@ inline T operator& (T a, T b) { return (T)((type)a & (type)b); }
template<class T, class type=typename std::underlying_type<T>::type>
inline T operator^ (T a, T b) { return (T)((type)a ^ (type)b); }
template<class T, class type=typename std::underlying_type<T>::type>
inline T& operator|= (T& a, T b){ return (T&)((type&)a |= (type)b); }
inline T& operator|= (T& a, T b) { return (T&)((type&)a |= (type)b); }
template<class T, class type=typename std::underlying_type<T>::type>
inline T& operator&= (T& a, T b){ return (T&)((type&)a &= (type)b); }
inline T& operator&= (T& a, T b) { return (T&)((type&)a &= (type)b); }
template<class T, class type=typename std::underlying_type<T>::type>
inline T& operator^= (T& a, T b){ return (T&)((type&)a ^= (type)b); }
inline T& operator^= (T& a, T b) { return (T&)((type&)a ^= (type)b); }
#define VectorSubtract(a,b,c) {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];}
#define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];}

View File

@ -10,15 +10,11 @@ TYPEDESCRIPTION CAirtank::m_SaveData[] =
DEFINE_FIELD(CAirtank, m_state, FIELD_INTEGER)
};
#endif // HOOK_GAMEDLL
#endif
/* <5329> ../cstrike/dlls/airtank.cpp:41 */
LINK_ENTITY_TO_CLASS(item_airtank, CAirtank);
/* <5211> ../cstrike/dlls/airtank.cpp:47 */
IMPLEMENT_SAVERESTORE(CAirtank, CGrenade);
/* <50dd> ../cstrike/dlls/airtank.cpp:50 */
void CAirtank::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -41,14 +37,12 @@ void CAirtank::__MAKE_VHOOK(Spawn)()
m_state = 1;
}
/* <4fef> ../cstrike/dlls/airtank.cpp:71 */
void CAirtank::__MAKE_VHOOK(Precache)()
{
PRECACHE_MODEL("models/w_oxygen.mdl");
PRECACHE_SOUND("doors/aliendoor3.wav");
}
/* <503d> ../cstrike/dlls/airtank.cpp:78 */
void CAirtank::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib)
{
pev->owner = ENT(pevAttacker);
@ -57,7 +51,6 @@ void CAirtank::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib)
Explode(pev->origin, Vector(0, 0, -1));
}
/* <5016> ../cstrike/dlls/airtank.cpp:88 */
void CAirtank::TankThink()
{
// Fire trigger
@ -65,7 +58,6 @@ void CAirtank::TankThink()
SUB_UseTargets(this, USE_TOGGLE, 0);
}
/* <525d> ../cstrike/dlls/airtank.cpp:96 */
void CAirtank::TankTouch(CBaseEntity *pOther)
{
if (!pOther->IsPlayer())

View File

@ -32,10 +32,8 @@
#pragma once
#endif
/* <468c> ../cstrike/dlls/airtank.cpp:23 */
class CAirtank: public CGrenade
{
public:
virtual void Spawn();
virtual void Precache();
@ -56,7 +54,7 @@ public:
int Restore_(CRestore &restore);
void Killed_(entvars_t *pevAttacker, int iGib);
#endif // HOOK_GAMEDLL
#endif
public:
static TYPEDESCRIPTION IMPL(m_SaveData)[1];

View File

@ -1,6 +1,5 @@
#include "precompiled.h"
/* <a6c7> ../cstrike/dlls/ammo.cpp:16 */
void C9MMAmmo::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -8,14 +7,12 @@ void C9MMAmmo::__MAKE_VHOOK(Spawn)()
CBasePlayerAmmo::Spawn();
}
/* <a3e2> ../cstrike/dlls/ammo.cpp:22 */
void C9MMAmmo::__MAKE_VHOOK(Precache)()
{
PRECACHE_MODEL("models/w_9mmclip.mdl");
PRECACHE_SOUND("items/9mmclip1.wav");
}
/* <a861> ../cstrike/dlls/ammo.cpp:27 */
BOOL C9MMAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
{
if (pOther->GiveAmmo(AMMO_9MM_BUY, "9mm", MAX_AMMO_9MM) == -1)
@ -27,10 +24,8 @@ BOOL C9MMAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
return TRUE;
}
/* <ace9> ../cstrike/dlls/ammo.cpp:37 */
LINK_ENTITY_TO_CLASS(ammo_9mm, C9MMAmmo);
/* <a6a0> ../cstrike/dlls/ammo.cpp:42 */
void CBuckShotAmmo::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -38,14 +33,12 @@ void CBuckShotAmmo::__MAKE_VHOOK(Spawn)()
CBasePlayerAmmo::Spawn();
}
/* <a409> ../cstrike/dlls/ammo.cpp:48 */
void CBuckShotAmmo::__MAKE_VHOOK(Precache)()
{
PRECACHE_MODEL("models/w_shotbox.mdl");
PRECACHE_SOUND("items/9mmclip1.wav");
}
/* <a7d0> ../cstrike/dlls/ammo.cpp:53 */
BOOL CBuckShotAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
{
if (pOther->GiveAmmo(AMMO_BUCKSHOT_BUY, "buckshot", MAX_AMMO_BUCKSHOT) == -1)
@ -57,10 +50,8 @@ BOOL CBuckShotAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
return TRUE;
}
/* <adb3> ../cstrike/dlls/ammo.cpp:63 */
LINK_ENTITY_TO_CLASS(ammo_buckshot, CBuckShotAmmo);
/* <a679> ../cstrike/dlls/ammo.cpp:69 */
void C556NatoAmmo::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -68,14 +59,12 @@ void C556NatoAmmo::__MAKE_VHOOK(Spawn)()
CBasePlayerAmmo::Spawn();
}
/* <a430> ../cstrike/dlls/ammo.cpp:75 */
void C556NatoAmmo::__MAKE_VHOOK(Precache)()
{
PRECACHE_MODEL("models/w_9mmclip.mdl");
PRECACHE_SOUND("items/9mmclip1.wav");
}
/* <a8f2> ../cstrike/dlls/ammo.cpp:80 */
BOOL C556NatoAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
{
if (pOther->GiveAmmo(AMMO_556NATO_BUY, "556Nato", MAX_AMMO_556NATO) == -1)
@ -87,10 +76,8 @@ BOOL C556NatoAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
return TRUE;
}
/* <ae7d> ../cstrike/dlls/ammo.cpp:90 */
LINK_ENTITY_TO_CLASS(ammo_556nato, C556NatoAmmo);
/* <a652> ../cstrike/dlls/ammo.cpp:95 */
void C556NatoBoxAmmo::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -98,14 +85,12 @@ void C556NatoBoxAmmo::__MAKE_VHOOK(Spawn)()
CBasePlayerAmmo::Spawn();
}
/* <a457> ../cstrike/dlls/ammo.cpp:101 */
void C556NatoBoxAmmo::__MAKE_VHOOK(Precache)()
{
PRECACHE_MODEL("models/w_9mmclip.mdl");
PRECACHE_SOUND("items/9mmclip1.wav");
}
/* <a983> ../cstrike/dlls/ammo.cpp:106 */
BOOL C556NatoBoxAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
{
if (pOther->GiveAmmo(AMMO_556NATOBOX_BUY, "556NatoBox", MAX_AMMO_556NATOBOX) == -1)
@ -117,10 +102,8 @@ BOOL C556NatoBoxAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
return TRUE;
}
/* <af47> ../cstrike/dlls/ammo.cpp:116 */
LINK_ENTITY_TO_CLASS(ammo_556natobox, C556NatoBoxAmmo);
/* <a62b> ../cstrike/dlls/ammo.cpp:121 */
void C762NatoAmmo::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -128,14 +111,12 @@ void C762NatoAmmo::__MAKE_VHOOK(Spawn)()
CBasePlayerAmmo::Spawn();
}
/* <a47e> ../cstrike/dlls/ammo.cpp:127 */
void C762NatoAmmo::__MAKE_VHOOK(Precache)()
{
PRECACHE_MODEL("models/w_9mmclip.mdl");
PRECACHE_SOUND("items/9mmclip1.wav");
}
/* <aa14> ../cstrike/dlls/ammo.cpp:132 */
BOOL C762NatoAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
{
if (pOther->GiveAmmo(AMMO_762NATO_BUY, "762Nato", MAX_AMMO_762NATO) == -1)
@ -147,10 +128,8 @@ BOOL C762NatoAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
return TRUE;
}
/* <b011> ../cstrike/dlls/ammo.cpp:142 */
LINK_ENTITY_TO_CLASS(ammo_762nato, C762NatoAmmo);
/* <a604> ../cstrike/dlls/ammo.cpp:147 */
void C45ACPAmmo::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -158,14 +137,12 @@ void C45ACPAmmo::__MAKE_VHOOK(Spawn)()
CBasePlayerAmmo::Spawn();
}
/* <a4a5> ../cstrike/dlls/ammo.cpp:153 */
void C45ACPAmmo::__MAKE_VHOOK(Precache)()
{
PRECACHE_MODEL("models/w_9mmclip.mdl");
PRECACHE_SOUND("items/9mmclip1.wav");
}
/* <aaa5> ../cstrike/dlls/ammo.cpp:158 */
BOOL C45ACPAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
{
if (pOther->GiveAmmo(AMMO_45ACP_BUY, "45acp", MAX_AMMO_45ACP) == -1)
@ -177,10 +154,8 @@ BOOL C45ACPAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
return TRUE;
}
/* <b0db> ../cstrike/dlls/ammo.cpp:168 */
LINK_ENTITY_TO_CLASS(ammo_45acp, C45ACPAmmo);
/* <a5dd> ../cstrike/dlls/ammo.cpp:173 */
void C50AEAmmo::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -188,14 +163,12 @@ void C50AEAmmo::__MAKE_VHOOK(Spawn)()
CBasePlayerAmmo::Spawn();
}
/* <a4cc> ../cstrike/dlls/ammo.cpp:179 */
void C50AEAmmo::__MAKE_VHOOK(Precache)()
{
PRECACHE_MODEL("models/w_9mmclip.mdl");
PRECACHE_SOUND("items/9mmclip1.wav");
}
/* <ab36> ../cstrike/dlls/ammo.cpp:184 */
BOOL C50AEAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
{
if (pOther->GiveAmmo(AMMO_50AE_BUY, "50AE", MAX_AMMO_50AE) == -1)
@ -207,10 +180,8 @@ BOOL C50AEAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
return TRUE;
}
/* <b1a5> ../cstrike/dlls/ammo.cpp:194 */
LINK_ENTITY_TO_CLASS(ammo_50ae, C50AEAmmo);
/* <a5b6> ../cstrike/dlls/ammo.cpp:199 */
void C338MagnumAmmo::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -218,14 +189,12 @@ void C338MagnumAmmo::__MAKE_VHOOK(Spawn)()
CBasePlayerAmmo::Spawn();
}
/* <a4f3> ../cstrike/dlls/ammo.cpp:205 */
void C338MagnumAmmo::__MAKE_VHOOK(Precache)()
{
PRECACHE_MODEL("models/w_9mmclip.mdl");
PRECACHE_SOUND("items/9mmclip1.wav");
}
/* <abc7> ../cstrike/dlls/ammo.cpp:210 */
BOOL C338MagnumAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
{
if (pOther->GiveAmmo(AMMO_338MAG_BUY, "338Magnum", MAX_AMMO_338MAGNUM) == -1)
@ -237,10 +206,8 @@ BOOL C338MagnumAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
return TRUE;
}
/* <b26f> ../cstrike/dlls/ammo.cpp:220 */
LINK_ENTITY_TO_CLASS(ammo_338magnum, C338MagnumAmmo);
/* <a58f> ../cstrike/dlls/ammo.cpp:226 */
void C57MMAmmo::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -248,14 +215,12 @@ void C57MMAmmo::__MAKE_VHOOK(Spawn)()
CBasePlayerAmmo::Spawn();
}
/* <a51a> ../cstrike/dlls/ammo.cpp:232 */
void C57MMAmmo::__MAKE_VHOOK(Precache)()
{
PRECACHE_MODEL("models/w_9mmclip.mdl");
PRECACHE_SOUND("items/9mmclip1.wav");
}
/* <ac58> ../cstrike/dlls/ammo.cpp:237 */
BOOL C57MMAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
{
if (pOther->GiveAmmo(AMMO_57MM_BUY, "57mm", MAX_AMMO_57MM) == -1)
@ -267,10 +232,8 @@ BOOL C57MMAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
return TRUE;
}
/* <b339> ../cstrike/dlls/ammo.cpp:247 */
LINK_ENTITY_TO_CLASS(ammo_57mm, C57MMAmmo);
/* <a568> ../cstrike/dlls/ammo.cpp:251 */
void C357SIGAmmo::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -278,14 +241,12 @@ void C357SIGAmmo::__MAKE_VHOOK(Spawn)()
CBasePlayerAmmo::Spawn();
}
/* <a541> ../cstrike/dlls/ammo.cpp:257 */
void C357SIGAmmo::__MAKE_VHOOK(Precache)()
{
PRECACHE_MODEL("models/w_9mmclip.mdl");
PRECACHE_SOUND("items/9mmclip1.wav");
}
/* <a73d> ../cstrike/dlls/ammo.cpp:262 */
BOOL C357SIGAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
{
if (pOther->GiveAmmo(AMMO_357SIG_BUY, "357SIG", MAX_AMMO_357SIG) == -1)
@ -297,5 +258,4 @@ BOOL C357SIGAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
return TRUE;
}
/* <b403> ../cstrike/dlls/ammo.cpp:272 */
LINK_ENTITY_TO_CLASS(ammo_357sig, C357SIGAmmo);

View File

@ -32,7 +32,6 @@
#pragma once
#endif
/* <9792> ../cstrike/dlls/ammo.cpp:14 */
class C9MMAmmo: public CBasePlayerAmmo
{
public:
@ -46,11 +45,10 @@ public:
void Precache_();
BOOL AddAmmo_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL
#endif
};
/* <97df> ../cstrike/dlls/ammo.cpp:40 */
class CBuckShotAmmo: public CBasePlayerAmmo
{
public:
@ -64,11 +62,10 @@ public:
void Precache_();
BOOL AddAmmo_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL
#endif
};
/* <982c> ../cstrike/dlls/ammo.cpp:67 */
class C556NatoAmmo: public CBasePlayerAmmo
{
public:
@ -82,11 +79,10 @@ public:
void Precache_();
BOOL AddAmmo_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL
#endif
};
/* <9879> ../cstrike/dlls/ammo.cpp:93 */
class C556NatoBoxAmmo: public CBasePlayerAmmo
{
public:
@ -100,11 +96,10 @@ public:
void Precache_();
BOOL AddAmmo_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL
#endif
};
/* <98c6> ../cstrike/dlls/ammo.cpp:119 */
class C762NatoAmmo: public CBasePlayerAmmo
{
public:
@ -118,11 +113,10 @@ public:
void Precache_();
BOOL AddAmmo_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL
#endif
};
/* <9913> ../cstrike/dlls/ammo.cpp:145 */
class C45ACPAmmo: public CBasePlayerAmmo
{
public:
@ -136,11 +130,10 @@ public:
void Precache_();
BOOL AddAmmo_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL
#endif
};
/* <9960> ../cstrike/dlls/ammo.cpp:171 */
class C50AEAmmo: public CBasePlayerAmmo
{
public:
@ -154,11 +147,10 @@ public:
void Precache_();
BOOL AddAmmo_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL
#endif
};
/* <99ad> ../cstrike/dlls/ammo.cpp:197 */
class C338MagnumAmmo: public CBasePlayerAmmo
{
public:
@ -172,11 +164,10 @@ public:
void Precache_();
BOOL AddAmmo_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL
#endif
};
/* <99fa> ../cstrike/dlls/ammo.cpp:224 */
class C57MMAmmo: public CBasePlayerAmmo
{
public:
@ -190,11 +181,9 @@ public:
void Precache_();
BOOL AddAmmo_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL
#endif
};
/* <9a47> ../cstrike/dlls/ammo.cpp:249 */
class C357SIGAmmo: public CBasePlayerAmmo
{
public:
@ -208,7 +197,7 @@ public:
void Precache_();
BOOL AddAmmo_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL
#endif
};

View File

@ -14,12 +14,10 @@ TYPEDESCRIPTION CBaseAnimating::m_SaveData[] =
DEFINE_FIELD(CBaseMonster, m_fSequenceLoops, FIELD_BOOLEAN),
};
#endif // HOOK_GAMEDLL
#endif
/* <10583> ../cstrike/dlls/animating.cpp:38 */
IMPLEMENT_SAVERESTORE(CBaseAnimating, CBaseDelay);
/* <105cf> ../cstrike/dlls/animating.cpp:45 */
float CBaseAnimating::StudioFrameAdvance(float flInterval)
{
if (flInterval == 0.0f)
@ -42,7 +40,7 @@ float CBaseAnimating::StudioFrameAdvance(float flInterval)
if (pev->frame < 0.0 || pev->frame >= 256.0)
{
if (m_fSequenceLoops)
pev->frame -= (int)(pev->frame / 256.0) * 256.0;
pev->frame -= int(pev->frame / 256.0) * 256.0;
else
pev->frame = (pev->frame < 0) ? 0 : 255;
@ -52,21 +50,18 @@ float CBaseAnimating::StudioFrameAdvance(float flInterval)
return flInterval;
}
/* <10605> ../cstrike/dlls/animating.cpp:77 */
int CBaseAnimating::LookupActivity(int activity)
{
void *pmodel = GET_MODEL_PTR(ENT(pev));
return ::LookupActivity(pmodel, pev, activity);
}
/* <10653> ../cstrike/dlls/animating.cpp:91 */
int CBaseAnimating::LookupActivityHeaviest(int activity)
{
void *pmodel = GET_MODEL_PTR(ENT(pev));
return ::LookupActivityHeaviest(pmodel, pev, activity);
}
/* <107b1> ../cstrike/dlls/animating.cpp:136 */
void CBaseAnimating::DispatchAnimEvents(float flInterval)
{
MonsterEvent_t event;
@ -100,14 +95,12 @@ void CBaseAnimating::DispatchAnimEvents(float flInterval)
}
}
/* <106a1> ../cstrike/dlls/animating.cpp:100 */
int CBaseAnimating::LookupSequence(const char *label)
{
void *pmodel = GET_MODEL_PTR(ENT(pev));
return ::LookupSequence(pmodel, label);
}
/* <10711> ../cstrike/dlls/animating.cpp:110 */
void CBaseAnimating::ResetSequenceInfo()
{
void *pmodel = GET_MODEL_PTR(ENT(pev));
@ -121,14 +114,12 @@ void CBaseAnimating::ResetSequenceInfo()
m_flLastEventCheck = gpGlobals->time;
}
/* <1077c> ../cstrike/dlls/animating.cpp:126 */
BOOL CBaseAnimating::GetSequenceFlags()
{
void *pmodel = GET_MODEL_PTR(ENT(pev));
return ::GetSequenceFlags(pmodel, pev);
}
/* <10837> ../cstrike/dlls/animating.cpp:171 */
float CBaseAnimating::SetBoneController(int iController, float flValue)
{
void *pmodel = GET_MODEL_PTR(ENT(pev));
@ -136,7 +127,6 @@ float CBaseAnimating::SetBoneController(int iController, float flValue)
return SetController(pmodel, pev, iController, flValue);
}
/* <10893> ../cstrike/dlls/animating.cpp:180 */
void CBaseAnimating::InitBoneControllers()
{
void *pmodel = GET_MODEL_PTR(ENT(pev));
@ -147,26 +137,22 @@ void CBaseAnimating::InitBoneControllers()
SetController(pmodel, pev, 3, 0);
}
/* <108d3> ../cstrike/dlls/animating.cpp:192 */
NOXREF float CBaseAnimating::SetBlending(int iBlender, float flValue)
{
void *pmodel = GET_MODEL_PTR(ENT(pev));
return ::SetBlending(pmodel, pev, iBlender, flValue);
}
/* <1092f> ../cstrike/dlls/animating.cpp:201 */
NOXREF void CBaseAnimating::GetBonePosition(int iBone, Vector &origin, Vector &angles)
{
GET_BONE_POSITION(ENT(pev), iBone, origin, angles);
}
/* <10984> ../cstrike/dlls/animating.cpp:208 */
NOXREF void CBaseAnimating::GetAttachment(int iAttachment, Vector &origin, Vector &angles)
{
GET_ATTACHMENT(ENT(pev), iAttachment, origin, angles);
}
/* <109d4> ../cstrike/dlls/animating.cpp:215 */
NOXREF int CBaseAnimating::FindTransition(int iEndingSequence, int iGoalSequence, int *piDir)
{
void *pmodel = GET_MODEL_PTR(ENT(pev));
@ -185,31 +171,26 @@ NOXREF int CBaseAnimating::FindTransition(int iEndingSequence, int iGoalSequence
return ::FindTransition(pmodel, iEndingSequence, iGoalSequence, piDir);
}
/* <10a5d> ../cstrike/dlls/animating.cpp:234 */
NOXREF void CBaseAnimating::GetAutomovement(Vector &origin, Vector &angles, float flInterval)
{
;
}
/* <10aad> ../cstrike/dlls/animating.cpp:239 */
NOXREF void CBaseAnimating::SetBodygroup(int iGroup, int iValue)
{
::SetBodygroup(GET_MODEL_PTR(ENT(pev)), pev, iGroup, iValue);
}
/* <10af0> ../cstrike/dlls/animating.cpp:244 */
NOXREF int CBaseAnimating::GetBodygroup(int iGroup)
{
return ::GetBodygroup(GET_MODEL_PTR(ENT(pev)), pev, iGroup);
}
/* <10b5f> ../cstrike/dlls/animating.cpp:250 */
int CBaseAnimating::ExtractBbox(int sequence, float *mins, float *maxs)
{
return ::ExtractBbox(GET_MODEL_PTR(ENT(pev)), sequence, mins, maxs);
}
/* <10b99> ../cstrike/dlls/animating.cpp:258 */
void CBaseAnimating::SetSequenceBox()
{
Vector mins, maxs;
@ -222,10 +203,10 @@ void CBaseAnimating::SetSequenceBox()
float yaw = pev->angles.y * (M_PI / 180.0);
Vector xvector, yvector;
xvector.x = cos(yaw);
xvector.y = sin(yaw);
yvector.x = -sin(yaw);
yvector.y = cos(yaw);
xvector.x = Q_cos(yaw);
xvector.y = Q_sin(yaw);
yvector.x = -Q_sin(yaw);
yvector.y = Q_cos(yaw);
Vector bounds[2];
bounds[0] = mins;

View File

@ -5,13 +5,15 @@
*/
#ifndef HOOK_GAMEDLL
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);
sv_blending_interface_t svBlending =
{
SV_BLENDING_INTERFACE_VERSION,
SV_StudioSetupBones
};
#endif // HOOK_GAMEDLL
#endif
server_studio_api_t IEngineStudio;
studiohdr_t *g_pstudiohdr;
@ -19,7 +21,6 @@ studiohdr_t *g_pstudiohdr;
float (*g_pRotationMatrix)[3][4];
float (*g_pBoneTransform)[128][3][4];
/* <1523e> ../cstrike/dlls/animation.cpp:57 */
int ExtractBbox(void *pmodel, int sequence, float *mins, float *maxs)
{
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel;
@ -42,7 +43,6 @@ int ExtractBbox(void *pmodel, int sequence, float *mins, float *maxs)
return 1;
}
/* <152c6> ../cstrike/dlls/animation.cpp:81 */
int LookupActivity(void *pmodel, entvars_t *pev, int activity)
{
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel;
@ -112,7 +112,6 @@ int LookupActivity(void *pmodel, entvars_t *pev, int activity)
return ACT_INVALID;
}
/* <1539a> ../cstrike/dlls/animation.cpp:149 */
int LookupActivityHeaviest(void *pmodel, entvars_t *pev, int activity)
{
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel;
@ -141,7 +140,6 @@ int LookupActivityHeaviest(void *pmodel, entvars_t *pev, int activity)
return seq;
}
/* <15439> ../cstrike/dlls/animation.cpp:178 */
NOXREF void GetEyePosition(void *pmodel, float *vecEyePosition)
{
studiohdr_t *pstudiohdr;
@ -159,7 +157,6 @@ NOXREF void GetEyePosition(void *pmodel, float *vecEyePosition)
vecEyePosition[2] = pstudiohdr->eyeposition[2];
}
/* <15485> ../cstrike/dlls/animation.cpp:193 */
int LookupSequence(void *pmodel, const char *label)
{
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel;
@ -181,7 +178,6 @@ int LookupSequence(void *pmodel, const char *label)
return ACT_INVALID;
}
/* <1518c> ../cstrike/dlls/animation.cpp:215 */
int IsSoundEvent(int eventNumber)
{
if (eventNumber == SCRIPT_EVENT_SOUND || eventNumber == SCRIPT_EVENT_SOUND_VOICE)
@ -192,7 +188,6 @@ int IsSoundEvent(int eventNumber)
return 0;
}
/* <15539> ../cstrike/dlls/animation.cpp:223 */
NOXREF void SequencePrecache(void *pmodel, const char *pSequenceName)
{
int index = LookupSequence(pmodel, pSequenceName);
@ -229,7 +224,6 @@ NOXREF void SequencePrecache(void *pmodel, const char *pSequenceName)
}
}
/* <15634> ../cstrike/dlls/animation.cpp:263 */
void GetSequenceInfo(void *pmodel, entvars_t *pev, float *pflFrameRate, float *pflGroundSpeed)
{
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel;
@ -246,7 +240,7 @@ void GetSequenceInfo(void *pmodel, entvars_t *pev, float *pflFrameRate, float *p
return;
}
mstudioseqdesc_t *pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + (int)pev->sequence;
mstudioseqdesc_t *pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + int(pev->sequence);
if (pseqdesc->numframes <= 1)
{
*pflFrameRate = 256.0f;
@ -255,11 +249,10 @@ void GetSequenceInfo(void *pmodel, entvars_t *pev, float *pflFrameRate, float *p
}
*pflFrameRate = pseqdesc->fps * 256.0f / (pseqdesc->numframes - 1);
*pflGroundSpeed = sqrt(pseqdesc->linearmovement[0] * pseqdesc->linearmovement[0] + pseqdesc->linearmovement[1] * pseqdesc->linearmovement[1] + pseqdesc->linearmovement[2] * pseqdesc->linearmovement[2]);
*pflGroundSpeed = Q_sqrt(pseqdesc->linearmovement[0] * pseqdesc->linearmovement[0] + pseqdesc->linearmovement[1] * pseqdesc->linearmovement[1] + pseqdesc->linearmovement[2] * pseqdesc->linearmovement[2]);
*pflGroundSpeed = *pflGroundSpeed * pseqdesc->fps / (pseqdesc->numframes - 1);
}
/* <156b3> ../cstrike/dlls/animation.cpp:297 */
int GetSequenceFlags(void *pmodel, entvars_t *pev)
{
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel;
@ -269,11 +262,10 @@ int GetSequenceFlags(void *pmodel, entvars_t *pev)
return 0;
}
mstudioseqdesc_t *pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + (int)pev->sequence;
mstudioseqdesc_t *pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + int(pev->sequence);
return pseqdesc->flags;
}
/* <15717> ../cstrike/dlls/animation.cpp:312 */
int GetAnimationEvent(void *pmodel, entvars_t *pev, MonsterEvent_t *pMonsterEvent, float flStart, float flEnd, int index)
{
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel;
@ -283,9 +275,7 @@ int GetAnimationEvent(void *pmodel, entvars_t *pev, MonsterEvent_t *pMonsterEven
return 0;
}
// int events = 0;
mstudioseqdesc_t *pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + (int)pev->sequence;
mstudioseqdesc_t *pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + int(pev->sequence);
mstudioevent_t *pevent = (mstudioevent_t *)((byte *)pstudiohdr + pseqdesc->eventindex);
if (pseqdesc->numevents == 0 || index > pseqdesc->numevents)
@ -325,7 +315,6 @@ int GetAnimationEvent(void *pmodel, entvars_t *pev, MonsterEvent_t *pMonsterEven
return 0;
}
/* <157e1> ../cstrike/dlls/animation.cpp:359 */
float SetController(void *pmodel, entvars_t *pev, int iController, float flValue)
{
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel;
@ -354,10 +343,10 @@ float SetController(void *pmodel, entvars_t *pev, int iController, float flValue
if (pbonecontroller->end > pbonecontroller->start + 359.0)
{
if (flValue > 360.0)
flValue = flValue - (int64_t)(flValue / 360.0) * 360.0;
flValue = flValue - int64(flValue / 360.0) * 360.0;
else if (flValue < 0.0)
flValue = flValue + (int64_t)((flValue / -360.0) + 1) * 360.0;
flValue = flValue + int64((flValue / -360.0) + 1) * 360.0;
}
else
{
@ -369,7 +358,7 @@ float SetController(void *pmodel, entvars_t *pev, int iController, float flValue
}
}
int setting = (int64_t)(255.0f * (flValue - pbonecontroller->start) / (pbonecontroller->end - pbonecontroller->start));
int setting = int64(255.0f * (flValue - pbonecontroller->start) / (pbonecontroller->end - pbonecontroller->start));
if (setting < 0)
setting = 0;
@ -382,7 +371,6 @@ float SetController(void *pmodel, entvars_t *pev, int iController, float flValue
return setting * (1.0f / 255.0f) * (pbonecontroller->end - pbonecontroller->start) + pbonecontroller->start;
}
/* <15883> ../cstrike/dlls/animation.cpp:414 */
float SetBlending(void *pmodel, entvars_t *pev, int iBlender, float flValue)
{
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel;
@ -391,7 +379,7 @@ float SetBlending(void *pmodel, entvars_t *pev, int iBlender, float flValue)
return flValue;
}
mstudioseqdesc_t *pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + (int)pev->sequence;
mstudioseqdesc_t *pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + int(pev->sequence);
if (pseqdesc->blendtype[iBlender] == 0)
{
@ -419,7 +407,7 @@ float SetBlending(void *pmodel, entvars_t *pev, int iBlender, float flValue)
}
}
int setting = (int64_t)(255.0f * (flValue - pseqdesc->blendstart[iBlender]) / (pseqdesc->blendend[iBlender] - pseqdesc->blendstart[iBlender]));
int setting = int64(255.0f * (flValue - pseqdesc->blendstart[iBlender]) / (pseqdesc->blendend[iBlender] - pseqdesc->blendstart[iBlender]));
if (setting < 0)
setting = 0;
@ -432,7 +420,6 @@ float SetBlending(void *pmodel, entvars_t *pev, int iBlender, float flValue)
return setting * (1.0 / 255.0) * (pseqdesc->blendend[iBlender] - pseqdesc->blendstart[iBlender]) + pseqdesc->blendstart[iBlender];
}
/* <15917> ../cstrike/dlls/animation.cpp:458 */
int FindTransition(void *pmodel, int iEndingAnim, int iGoalAnim, int *piDir)
{
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel;
@ -497,7 +484,6 @@ int FindTransition(void *pmodel, int iEndingAnim, int iGoalAnim, int *piDir)
return iGoalAnim;
}
/* <159d8> ../cstrike/dlls/animation.cpp:523 */
void SetBodygroup(void *pmodel, entvars_t *pev, int iGroup, int iValue)
{
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel;
@ -522,7 +508,6 @@ void SetBodygroup(void *pmodel, entvars_t *pev, int iGroup, int iValue)
pev->body += (iValue - iCurrent) * pbodypart->base;
}
/* <15a6d> ../cstrike/dlls/animation.cpp:545 */
int GetBodygroup(void *pmodel, entvars_t *pev, int iGroup)
{
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel;
@ -541,7 +526,6 @@ int GetBodygroup(void *pmodel, entvars_t *pev, int iGroup)
return iCurrent;
}
/* <15aed> ../cstrike/dlls/animation.cpp:605 */
C_DLLEXPORT int Server_GetBlendingInterface(int version, struct sv_blending_interface_s **ppinterface, struct engine_studio_api_s *pstudio, float *rotationmatrix, float *bonetransform)
{
if (version != SV_BLENDING_INTERFACE_VERSION)
@ -560,7 +544,6 @@ C_DLLEXPORT int Server_GetBlendingInterface(int version, struct sv_blending_inte
return 1;
}
/* <15ba5> ../cstrike/dlls/animation.cpp:630 */
#ifdef REGAMEDLL_FIXES // SSE2 version
void AngleQuaternion(vec_t *angles, vec_t *quaternion)
{
@ -605,16 +588,16 @@ void AngleQuaternion(vec_t *angles, vec_t *quaternion)
float ftmp2;
angle = angles[ROLL] * 0.5;
sy = sin(angle);
cy = cos(angle);
sy = Q_sin(angle);
cy = Q_cos(angle);
angle = angles[YAW] * 0.5;
sp_ = sin(angle);
cp = cos(angle);
sp_ = Q_sin(angle);
cp = Q_cos(angle);
angle = angles[PITCH] * 0.5;
sr = sin(angle);
cr = cos(angle);
sr = Q_sin(angle);
cr = Q_cos(angle);
ftmp0 = sr * cp;
ftmp1 = cr * sp_;
@ -628,7 +611,6 @@ void AngleQuaternion(vec_t *angles, vec_t *quaternion)
}
#endif // REGAMEDLL_FIXES
/* <15c4d> ../cstrike/dlls/animation.cpp:653 */
void QuaternionSlerp(vec_t *p, vec_t *q, float t, vec_t *qt)
{
int i;
@ -654,13 +636,13 @@ void QuaternionSlerp(vec_t *p, vec_t *q, float t, vec_t *qt)
{
if ((1.0 - cosom) > 0.00000001)
{
float_precision cosomega = acos((float_precision)cosom);
float_precision cosomega = Q_acos(float_precision(cosom));
float omega = cosomega;
float sinom = sin(cosomega);
float sinom = Q_sin(cosomega);
sclp = sin((1.0 - t) * omega) / sinom;
sclq = sin((float_precision)(omega * t)) / sinom;
sclp = Q_sin((1.0 - t) * omega) / sinom;
sclq = Q_sin(float_precision(omega * t)) / sinom;
}
else
{
@ -678,15 +660,14 @@ void QuaternionSlerp(vec_t *p, vec_t *q, float t, vec_t *qt)
qt[2] = -q[3];
qt[3] = q[2];
sclp = sin((1.0 - t) * 0.5 * M_PI);
sclq = sin(t * 0.5 * M_PI);
sclp = Q_sin((1.0 - t) * 0.5 * M_PI);
sclq = Q_sin(t * 0.5 * M_PI);
for (i = 0; i < 3; ++i)
qt[i] = sclp * p[i] + sclq * qt[i];
}
}
/* <15cd0> ../cstrike/dlls/animation.cpp:700 */
void QuaternionMatrix(vec_t *quaternion, float (*matrix)[4])
{
matrix[0][0] = 1.0 - 2.0 * quaternion[1] * quaternion[1] - 2.0 * quaternion[2] * quaternion[2];
@ -702,7 +683,6 @@ void QuaternionMatrix(vec_t *quaternion, float (*matrix)[4])
matrix[2][2] = 1.0 - 2.0 * quaternion[0] * quaternion[0] - 2.0 * quaternion[1] * quaternion[1];
}
/* <15d12> ../cstrike/dlls/animation.cpp:715 */
mstudioanim_t *StudioGetAnim(model_t *m_pSubModel, mstudioseqdesc_t *pseqdesc)
{
mstudioseqgroup_t *pseqgroup;
@ -731,7 +711,6 @@ mstudioanim_t *StudioGetAnim(model_t *m_pSubModel, mstudioseqdesc_t *pseqdesc)
return (mstudioanim_t *)((byte *)paSequences[ pseqdesc->seqgroup ].data + pseqdesc->animindex);
}
/* <15d90> ../cstrike/dlls/animation.cpp:749 */
mstudioanim_t *LookupAnimation(model_t *model, mstudioseqdesc_t *pseqdesc, int index)
{
mstudioanim_t *panim = StudioGetAnim(model, pseqdesc);
@ -741,7 +720,6 @@ mstudioanim_t *LookupAnimation(model_t *model, mstudioseqdesc_t *pseqdesc, int i
return panim;
}
/* <151a9> ../cstrike/dlls/animation.cpp:770 */
void StudioCalcBoneAdj(float dadt, float *adj, const byte *pcontroller1, const byte *pcontroller2, byte mouthopen)
{
int i, j;
@ -758,7 +736,7 @@ void StudioCalcBoneAdj(float dadt, float *adj, const byte *pcontroller1, const b
// check for 360% wrapping
if (pbonecontroller[j].type & STUDIO_RLOOP)
{
if (abs(pcontroller1[i] - pcontroller2[i]) > 128)
if (Q_abs(pcontroller1[i] - pcontroller2[i]) > 128)
{
int a, b;
a = (pcontroller1[j] + 128) % 256;
@ -767,7 +745,7 @@ void StudioCalcBoneAdj(float dadt, float *adj, const byte *pcontroller1, const b
}
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
@ -808,7 +786,6 @@ void StudioCalcBoneAdj(float dadt, float *adj, const byte *pcontroller1, const b
}
}
/* <15ea6> ../cstrike/dlls/animation.cpp:828 */
void StudioCalcBoneQuaterion(int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *q)
{
int j, k;
@ -890,7 +867,6 @@ void StudioCalcBoneQuaterion(int frame, float s, mstudiobone_t *pbone, mstudioan
AngleQuaternion(angle1, q);
}
/* <15f94> ../cstrike/dlls/animation.cpp:908 */
void StudioCalcBonePosition(int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *pos)
{
int j, k;
@ -944,7 +920,6 @@ void StudioCalcBonePosition(int frame, float s, mstudiobone_t *pbone, mstudioani
}
}
/* <1603c> ../cstrike/dlls/animation.cpp:970 */
void StudioSlerpBones(vec4_t *q1, float pos1[][3], vec4_t *q2, float pos2[][3], float s)
{
int i;
@ -974,7 +949,6 @@ void StudioSlerpBones(vec4_t *q1, float pos1[][3], vec4_t *q2, float pos2[][3],
}
}
/* <160de> ../cstrike/dlls/animation.cpp:994 */
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;
@ -984,12 +958,11 @@ void StudioCalcRotations(mstudiobone_t *pbones, int *chain, int chainlength, flo
{
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]);
}
}
/* <161fd> ../cstrike/dlls/animation.cpp:1006 */
void ConcatTransforms(float in1[3][4], float in2[3][4], float out[3][4])
{
out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] + in1[0][2] * in2[2][0];
@ -1013,10 +986,9 @@ float_precision StudioEstimateFrame(float frame, mstudioseqdesc_t *pseqdesc)
if (pseqdesc->numframes <= 1)
return 0;
return (float_precision)(pseqdesc->numframes - 1) * frame / 256;
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;
@ -1063,17 +1035,17 @@ void SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t
}
f = StudioEstimateFrame(frame, pseqdesc);
subframe = (int)f;
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 != NUM_BLENDING)
{
if (pseqdesc->numblends > 1)
{
float b = (float_precision)pblending[0] / 255.0f;
float b = float_precision(pblending[0]) / 255.0f;
pseqdesc = (mstudioseqdesc_t *)((byte *)g_pstudiohdr + g_pstudiohdr->seqindex) + sequence;
panim = StudioGetAnim(pModel, pseqdesc);
@ -1215,10 +1187,10 @@ void SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t
VectorCopy(angles, temp_angles);
#ifdef REGAMEDLL_FIXES
if(pEdict != NULL && CBaseEntity::Instance((edict_t*)pEdict)->IsPlayer())
#ifndef REGAMEDLL_FIXES
if (pEdict != NULL)
#else
if(pEdict != NULL)
if (pEdict != NULL && CBaseEntity::Instance(const_cast<edict_t *>(pEdict))->IsPlayer())
#endif
{
temp_angles[1] = UTIL_GetPlayerGaitYaw(ENTINDEX(pEdict));

View File

@ -32,41 +32,30 @@
#pragma once
#endif
#define NUM_BLENDING 9
#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"
#include "monsterevent.h"
int IsSoundEvent(int eventNumber);
int ExtractBbox(void *pmodel, int sequence, float *mins, float *maxs);
int LookupActivity(void *pmodel, entvars_t *pev, int activity);
int LookupActivityHeaviest(void *pmodel, entvars_t *pev, int activity);
NOXREF void GetEyePosition(void *pmodel, float *vecEyePosition);
int LookupSequence(void *pmodel, const char *label);
int IsSoundEvent(int eventNumber);
NOXREF void SequencePrecache(void *pmodel, const char *pSequenceName);
void GetSequenceInfo(void *pmodel, entvars_t *pev, float *pflFrameRate, float *pflGroundSpeed);
int GetSequenceFlags(void *pmodel, entvars_t *pev);
int GetAnimationEvent(void *pmodel, entvars_t *pev, MonsterEvent_t *pMonsterEvent, float flStart, float flEnd, int index);
float SetController(void *pmodel, entvars_t *pev, int iController, float flValue);
float SetBlending(void *pmodel, entvars_t *pev, int iBlender, float flValue);
void GetEyePosition(void *pmodel, float *vecEyePosition);
void SequencePrecache(void *pmodel, const char *pSequenceName);
int FindTransition(void *pmodel, int iEndingAnim, int iGoalAnim, int *piDir);
void SetBodygroup(void *pmodel, entvars_t *pev, int iGroup, int iValue);
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);
void QuaternionMatrix(vec_t *quaternion, float (*matrix)[4]);
mstudioanim_t *StudioGetAnim(model_t *m_pSubModel, mstudioseqdesc_t *pseqdesc);
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);
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]);
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 GetAnimationEvent(void *pmodel, entvars_t *pev, MonsterEvent_t *pMonsterEvent, float flStart, float flEnd, int index);
int ExtractBbox(void *pmodel, int sequence, float *mins, float *maxs);
#endif // ANIMATION_H

View File

@ -33,12 +33,9 @@
#endif
void RadiusFlash(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore = 0, int bitsDamageType = 0);
float GetAmountOfPlayerVisible(Vector vecSrc, CBaseEntity *entity);
void RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType);
void RadiusDamage2(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType);
NOXREF char *vstr(float *v);
/* <48ecff> ../cstrike/dlls/basemonster.h:18 */
class CBaseMonster: public CBaseToggle
{
public:
@ -54,7 +51,7 @@ public:
virtual BOOL HasAlienGibs();
virtual void FadeMonster();
virtual void GibMonster();
NOXREF virtual Activity GetDeathActivity();
virtual Activity GetDeathActivity();
virtual void BecomeDead();
virtual BOOL ShouldFadeOnDeath();
virtual int IRelationship(CBaseEntity *pTarget);
@ -89,22 +86,20 @@ public:
BOOL FInViewCone_(CBaseEntity *pEntity);
BOOL FInViewCone_(const Vector *pOrigin);
#endif // HOOK_GAMEDLL
#endif
public:
void MakeIdealYaw(Vector vecTarget);
NOXREF Activity GetSmallFlinchActivity();
Activity GetSmallFlinchActivity();
BOOL ShouldGibMonster(int iGib);
void CallGibMonster();
BOOL FCheckAITrigger();
int DeadTakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
float DamageForce(float damage);
void RadiusDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType);
NOXREF void RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType);
void RadiusDamage2(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType)
{
::RadiusDamage2(vecSrc, pevInflictor, pevAttacker, flDamage, flDamage * (RANDOM_FLOAT(0.5, 1.5) + 3), iClassIgnore, bitsDamageType);
}
void RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType);
void RadiusDamage2(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType);
void SetConditions(int iConditions) { m_afConditions |= iConditions; }
void ClearConditions(int iConditions) { m_afConditions &= ~iConditions; }
BOOL HasConditions(int iConditions) { return (m_afConditions & iConditions) ? TRUE : FALSE; }
@ -117,9 +112,9 @@ public:
void StopAnimation() { pev->framerate = 0.0f; }
NOXREF void CorpseFallThink();
NOXREF CBaseEntity *CheckTraceHullAttack(float flDist, int iDamage, int iDmgType);
NOXREF void MakeDamageBloodDecal(int cCount, float flNoise, TraceResult *ptr, Vector &vecDir);
void EXPORT CorpseFallThink();
CBaseEntity *CheckTraceHullAttack(float flDist, int iDamage, int iDmgType);
void MakeDamageBloodDecal(int cCount, float flNoise, TraceResult *ptr, Vector &vecDir);
void MonsterUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { m_IdealMonsterState = MONSTERSTATE_ALERT; }
void BloodSplat(const Vector &vecSrc, const Vector &vecDir, int HitLocation, int iVelocity);

View File

@ -26,20 +26,16 @@ TYPEDESCRIPTION CPendulum::m_SaveData[] =
DEFINE_FIELD(CPendulum, m_start, FIELD_VECTOR),
};
#endif // HOOK_GAMEDLL
#endif
// BModelOrigin - calculates origin of a bmodel from absmin/size because all bmodel origins are 0 0 0
/* <1c36f> ../cstrike/dlls/bmodels.cpp:43 */
Vector VecBModelOrigin(entvars_t *pevBModel)
{
return pevBModel->absmin + (pevBModel->size * 0.5);
}
/* <1e384> ../cstrike/dlls/bmodels.cpp:63 */
LINK_ENTITY_TO_CLASS(func_wall, CFuncWall);
/* <1d193> ../cstrike/dlls/bmodels.cpp:65 */
void CFuncWall::__MAKE_VHOOK(Spawn)()
{
pev->angles = g_vecZero;
@ -54,19 +50,16 @@ void CFuncWall::__MAKE_VHOOK(Spawn)()
pev->flags |= FL_WORLDBRUSH;
}
/* <1d873> ../cstrike/dlls/bmodels.cpp:77 */
void CFuncWall::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
if (ShouldToggle(useType, (int)(pev->frame)))
if (ShouldToggle(useType, int(pev->frame)))
{
pev->frame = 1.0 - pev->frame;
}
}
/* <1e44e> ../cstrike/dlls/bmodels.cpp:96 */
LINK_ENTITY_TO_CLASS(func_wall_toggle, CFuncWallToggle);
/* <1e28f> ../cstrike/dlls/bmodels.cpp:98 */
void CFuncWallToggle::__MAKE_VHOOK(Spawn)()
{
CFuncWall::Spawn();
@ -77,7 +70,6 @@ void CFuncWallToggle::__MAKE_VHOOK(Spawn)()
}
}
/* <1e518> ../cstrike/dlls/bmodels.cpp:106 */
void CFuncWallToggle::TurnOff()
{
pev->solid = SOLID_NOT;
@ -85,7 +77,6 @@ void CFuncWallToggle::TurnOff()
UTIL_SetOrigin(pev, pev->origin);
}
/* <1e53a> ../cstrike/dlls/bmodels.cpp:114 */
void CFuncWallToggle::TurnOn()
{
pev->solid = SOLID_BSP;
@ -93,7 +84,6 @@ void CFuncWallToggle::TurnOn()
UTIL_SetOrigin(pev, pev->origin);
}
/* <1e55c> ../cstrike/dlls/bmodels.cpp:122 */
BOOL CFuncWallToggle::IsOn()
{
if (pev->solid == SOLID_NOT)
@ -104,7 +94,6 @@ BOOL CFuncWallToggle::IsOn()
return TRUE;
}
/* <1e101> ../cstrike/dlls/bmodels.cpp:130 */
void CFuncWallToggle::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
int status = IsOn();
@ -118,10 +107,8 @@ void CFuncWallToggle::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pC
}
}
/* <1e57d> ../cstrike/dlls/bmodels.cpp:155 */
LINK_ENTITY_TO_CLASS(func_conveyor, CFuncConveyor);
/* <1e1c3> ../cstrike/dlls/bmodels.cpp:156 */
void CFuncConveyor::__MAKE_VHOOK(Spawn)()
{
SetMovedir(pev);
@ -147,12 +134,10 @@ void CFuncConveyor::__MAKE_VHOOK(Spawn)()
}
// HACKHACK -- This is ugly, but encode the speed in the rendercolor to avoid adding more data to the network stream
/* <1e647> ../cstrike/dlls/bmodels.cpp:179 */
void CFuncConveyor::UpdateSpeed(float speed)
{
// Encode it as an integer with 4 fractional bits
int speedCode = (int)(fabs((float_precision)speed) * 16.0);
int speedCode = int(Q_fabs(float_precision(speed)) * 16.0);
if (speed < 0)
pev->rendercolor.x = 1;
@ -163,30 +148,26 @@ void CFuncConveyor::UpdateSpeed(float speed)
pev->rendercolor.z = (speedCode & 0xFF);
}
/* <1e021> ../cstrike/dlls/bmodels.cpp:194 */
void CFuncConveyor::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
pev->speed = -pev->speed;
UpdateSpeed(pev->speed);
}
/* <1e695> ../cstrike/dlls/bmodels.cpp:217 */
LINK_ENTITY_TO_CLASS(func_illusionary, CFuncIllusionary);
/* <1ddc9> ../cstrike/dlls/bmodels.cpp:219 */
void CFuncIllusionary::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
//skin is used for content type
if (FStrEq(pkvd->szKeyName, "skin"))
{
pev->skin = (int)Q_atof(pkvd->szValue);
pev->skin = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else
CBaseToggle::KeyValue(pkvd);
}
/* <1d1db> ../cstrike/dlls/bmodels.cpp:230 */
void CFuncIllusionary::__MAKE_VHOOK(Spawn)()
{
pev->angles = g_vecZero;
@ -203,10 +184,8 @@ void CFuncIllusionary::__MAKE_VHOOK(Spawn)()
// MAKE_STATIC(ENT(pev));
}
/* <1e75f> ../cstrike/dlls/bmodels.cpp:262 */
LINK_ENTITY_TO_CLASS(func_monsterclip, CFuncMonsterClip);
/* <1e24f> ../cstrike/dlls/bmodels.cpp:264 */
void CFuncMonsterClip::__MAKE_VHOOK(Spawn)()
{
CFuncWall::Spawn();
@ -219,13 +198,10 @@ void CFuncMonsterClip::__MAKE_VHOOK(Spawn)()
pev->flags |= FL_MONSTERCLIP;
}
/* <1e82c> ../cstrike/dlls/bmodels.cpp:313 */
LINK_ENTITY_TO_CLASS(func_rotating, CFuncRotating);
/* <1d826> ../cstrike/dlls/bmodels.cpp:310 */
IMPLEMENT_SAVERESTORE(CFuncRotating, CBaseEntity);
/* <1dc21> ../cstrike/dlls/bmodels.cpp:315 */
void CFuncRotating::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "fanfriction"))
@ -275,8 +251,6 @@ void CFuncRotating::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
// "dmg" damage to inflict when blocked (2 default)
// REVERSE will cause the it to rotate in the opposite direction.
/* <1d5c4> ../cstrike/dlls/bmodels.cpp:362 */
void CFuncRotating::__MAKE_VHOOK(Spawn)()
{
// set final pitch. Must not be PITCH_NORM, since we
@ -375,7 +349,6 @@ void CFuncRotating::__MAKE_VHOOK(Spawn)()
Precache();
}
/* <1d28a> ../cstrike/dlls/bmodels.cpp:447 */
void CFuncRotating::__MAKE_VHOOK(Precache)()
{
char *szSoundFile = (char *)STRING(pev->message);
@ -439,8 +412,6 @@ void CFuncRotating::__MAKE_VHOOK(Precache)()
}
// Touch - will hurt others based on how fast the brush is spinning
/* <1dea4> ../cstrike/dlls/bmodels.cpp:517 */
void CFuncRotating::HurtTouch(CBaseEntity *pOther)
{
entvars_t *pevOther = pOther->pev;
@ -460,7 +431,6 @@ void CFuncRotating::HurtTouch(CBaseEntity *pOther)
// RampPitchVol - ramp pitch and volume up to final values, based on difference
// between how fast we're going vs how fast we plan to go
/* <1e8f9> ../cstrike/dlls/bmodels.cpp:540 */
void CFuncRotating::RampPitchVol(int fUp)
{
Vector vecAVel = pev->avelocity;
@ -472,12 +442,12 @@ void CFuncRotating::RampPitchVol(int fUp)
int pitch;
// get current angular velocity
vecCur = abs((int)(vecAVel.x != 0 ? vecAVel.x : (vecAVel.y != 0 ? vecAVel.y : vecAVel.z)));
vecCur = Q_abs(int(vecAVel.x != 0 ? vecAVel.x : (vecAVel.y != 0 ? vecAVel.y : vecAVel.z)));
// get target angular velocity
vecFinal = (pev->movedir.x != 0 ? pev->movedir.x : (pev->movedir.y != 0 ? pev->movedir.y : pev->movedir.z));
vecFinal *= pev->speed;
vecFinal = abs((int)vecFinal);
vecFinal = Q_abs(int(vecFinal));
// calc volume and pitch as % of final vol and pitch
fpct = vecCur / vecFinal;
@ -485,7 +455,7 @@ void CFuncRotating::RampPitchVol(int fUp)
//if (fUp)
//{
// // spinup volume ramps up from 50% max vol
// fvol = m_flVolume * (0.5 + fpct/2.0);
// fvol = m_flVolume * (0.5 + fpct / 2.0);
//}
//else
{
@ -495,7 +465,7 @@ void CFuncRotating::RampPitchVol(int fUp)
fpitch = FANPITCHMIN + (FANPITCHMAX - FANPITCHMIN) * fpct;
pitch = (int)fpitch;
pitch = int(fpitch);
if (pitch == PITCH_NORM)
{
pitch = PITCH_NORM - 1;
@ -506,8 +476,6 @@ void CFuncRotating::RampPitchVol(int fUp)
}
// SpinUp - accelerates a non-moving func_rotating up to it's speed
/* <1ea74> ../cstrike/dlls/bmodels.cpp:585 */
void CFuncRotating::SpinUp()
{
//rotational velocity
@ -520,9 +488,9 @@ void CFuncRotating::SpinUp()
vecAVel = pev->avelocity;
// if we've met or exceeded target speed, set target speed and stop thinking
if (abs((int)vecAVel.x) >= abs((int)(pev->movedir.x * pev->speed))
&& abs((int)vecAVel.y) >= abs((int)(pev->movedir.y * pev->speed))
&& abs((int)vecAVel.z) >= abs((int)(pev->movedir.z * pev->speed)))
if (Q_abs(int(vecAVel.x)) >= Q_abs(int(pev->movedir.x * pev->speed))
&& Q_abs(int(vecAVel.y)) >= Q_abs(int(pev->movedir.y * pev->speed))
&& Q_abs(int(vecAVel.z)) >= Q_abs(int(pev->movedir.z * pev->speed)))
{
// set speed in case we overshot
pev->avelocity = pev->movedir * pev->speed;
@ -537,7 +505,6 @@ void CFuncRotating::SpinUp()
}
}
/* <1e9c3> ../cstrike/dlls/bmodels.cpp:615 */
void CFuncRotating::SpinDown()
{
//rotational velocity
@ -579,15 +546,12 @@ void CFuncRotating::SpinDown()
}
}
/* <1d304> ../cstrike/dlls/bmodels.cpp:653 */
void CFuncRotating::Rotate()
{
pev->nextthink = pev->ltime + 10;
}
// Rotating Use - when a rotating brush is triggered
/* <1d60e> ../cstrike/dlls/bmodels.cpp:661 */
void CFuncRotating::RotatingUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
// is this a brush that should accelerate and decelerate when turned on/off (fan)?
@ -633,20 +597,14 @@ void CFuncRotating::RotatingUse(CBaseEntity *pActivator, CBaseEntity *pCaller, U
}
// RotatingBlocked - An entity has blocked the brush
/* <1d325> ../cstrike/dlls/bmodels.cpp:706 */
void CFuncRotating::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther)
{
pOther->TakeDamage(pev, pev, pev->dmg, DMG_CRUSH);
}
/* <1eb14> ../cstrike/dlls/bmodels.cpp:747 */
LINK_ENTITY_TO_CLASS(func_pendulum, CPendulum);
/* <1d7d9> ../cstrike/dlls/bmodels.cpp:761 */
IMPLEMENT_SAVERESTORE(CPendulum, CBaseEntity);
/* <1db2a> ../cstrike/dlls/bmodels.cpp:765 */
void CPendulum::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "distance"))
@ -663,7 +621,6 @@ void CPendulum::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CBaseEntity::KeyValue(pkvd);
}
/* <1d9c7> ../cstrike/dlls/bmodels.cpp:782 */
void CPendulum::__MAKE_VHOOK(Spawn)()
{
// set the axis of rotation
@ -685,7 +642,7 @@ void CPendulum::__MAKE_VHOOK(Spawn)()
pev->speed = 100;
// Calculate constant acceleration from speed and distance
m_accel = (pev->speed * pev->speed) / (2 * fabs((float_precision)m_distance));
m_accel = (pev->speed * pev->speed) / (2 * Q_fabs(float_precision(m_distance)));
m_maxSpeed = pev->speed;
m_start = pev->angles;
m_center = pev->angles + (m_distance * 0.5) * pev->movedir;
@ -705,7 +662,6 @@ void CPendulum::__MAKE_VHOOK(Spawn)()
}
}
/* <1d8ec> ../cstrike/dlls/bmodels.cpp:821 */
void CPendulum::PendulumUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
// Pendulum is moving, stop it and auto-return if necessary
@ -741,7 +697,6 @@ void CPendulum::PendulumUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T
}
}
/* <1d381> ../cstrike/dlls/bmodels.cpp:852 */
void CPendulum::Stop()
{
pev->angles = m_start;
@ -750,13 +705,11 @@ void CPendulum::Stop()
pev->avelocity = g_vecZero;
}
/* <1d3a7> ../cstrike/dlls/bmodels.cpp:861 */
void CPendulum::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther)
{
m_time = gpGlobals->time;
}
/* <1d533> ../cstrike/dlls/bmodels.cpp:867 */
void CPendulum::Swing()
{
float delta, dt;
@ -808,7 +761,6 @@ void CPendulum::Swing()
}
}
/* <1d3f5> ../cstrike/dlls/bmodels.cpp:909 */
void CPendulum::__MAKE_VHOOK(Touch)(CBaseEntity *pOther)
{
entvars_t *pevOther = pOther->pev;
@ -832,7 +784,6 @@ void CPendulum::__MAKE_VHOOK(Touch)(CBaseEntity *pOther)
pevOther->velocity = (pevOther->origin - VecBModelOrigin(pev)).Normalize() * damage;
}
/* <1da85> ../cstrike/dlls/bmodels.cpp:931 */
void CPendulum::RopeTouch(CBaseEntity *pOther)
{
entvars_t *pevOther = pOther->pev;

View File

@ -56,8 +56,6 @@
#define noiseRunning noise3
// This is just a solid wall if not inhibited
/* <1c494> ../cstrike/dlls/bmodels.cpp:53 */
class CFuncWall: public CBaseEntity
{
public:
@ -72,11 +70,10 @@ public:
void Spawn_();
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
};
/* <1c4e1> ../cstrike/dlls/bmodels.cpp:86 */
class CFuncWallToggle: public CFuncWall
{
public:
@ -88,16 +85,14 @@ public:
void Spawn_();
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
public:
void TurnOff();
void TurnOn();
BOOL IsOn();
};
/* <1c52e> ../cstrike/dlls/bmodels.cpp:147 */
class CFuncConveyor: public CFuncWall
{
public:
@ -109,16 +104,13 @@ public:
void Spawn_();
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
public:
void UpdateSpeed(float speed);
};
// A simple entity that looks solid but lets you walk through it.
/* <1c65b> ../cstrike/dlls/bmodels.cpp:208 */
class CFuncIllusionary: public CBaseToggle
{
public:
@ -131,11 +123,10 @@ public:
void Spawn_();
void KeyValue_(KeyValueData *pkvd);
#endif // HOOK_GAMEDLL
#endif
public:
void EXPORT SloshTouch(CBaseEntity *pOther);
};
// Monster only clip brush
@ -145,8 +136,6 @@ public:
//
// otherwise it will be invisible and not solid. This can be used to keep
// specific monsters out of certain areas
/* <1c6a8> ../cstrike/dlls/bmodels.cpp:255 */
class CFuncMonsterClip: public CFuncWall
{
public:
@ -160,11 +149,10 @@ public:
void Spawn_();
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
};
/* <1c6fa> ../cstrike/dlls/bmodels.cpp:274 */
class CFuncRotating: public CBaseEntity
{
public:
@ -186,7 +174,7 @@ public:
int Restore_(CRestore &restore);
void Blocked_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL
#endif
public:
void EXPORT SpinUp();
@ -199,7 +187,6 @@ public:
public:
static TYPEDESCRIPTION IMPL(m_SaveData)[5];
public:
float m_flFanFriction;
float m_flAttenuation;
float m_flVolume;
@ -207,7 +194,6 @@ public:
int m_sounds;
};
/* <1c748> ../cstrike/dlls/bmodels.cpp:720 */
class CPendulum: public CBaseEntity
{
public:
@ -228,7 +214,7 @@ public:
void Touch_(CBaseEntity *pOther);
void Blocked_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL
#endif
public:
void EXPORT Swing();
@ -238,9 +224,9 @@ public:
// this touch func makes the pendulum a rope
void EXPORT RopeTouch(CBaseEntity *pOther);
public:
static TYPEDESCRIPTION IMPL(m_SaveData)[8];
public:
float m_accel; // Acceleration
float m_distance;
float m_time;

View File

@ -1,8 +1,6 @@
#include "precompiled.h"
// Return the number of bots following the given player
/* <2e85c8> ../cstrike/dlls/bot/cs_bot.cpp:24 */
int GetBotFollowCount(CBasePlayer *leader)
{
int count = 0;
@ -37,8 +35,6 @@ int GetBotFollowCount(CBasePlayer *leader)
}
// Change movement speed to walking
/* <2e86df> ../cstrike/dlls/bot/cs_bot.cpp:62 */
void CCSBot::__MAKE_VHOOK(Walk)()
{
if (m_mustRunTimer.IsElapsed())
@ -53,8 +49,6 @@ void CCSBot::__MAKE_VHOOK(Walk)()
// Return true if jump was started.
// This is extended from the base jump to disallow jumping when in a crouch area.
/* <2e8732> ../cstrike/dlls/bot/cs_bot.cpp:80 */
bool CCSBot::__MAKE_VHOOK(Jump)(bool mustJump)
{
// prevent jumping if we're crouched, unless we're in a crouchjump area - jump wins
@ -72,8 +66,6 @@ bool CCSBot::__MAKE_VHOOK(Jump)(bool mustJump)
// Invoked when injured by something
// NOTE: We dont want to directly call Attack() here, or the bots will have super-human reaction times when injured
/* <2e8e39> ../cstrike/dlls/bot/cs_bot.cpp:97 */
int CCSBot::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
CBaseEntity *attacker = GetClassPtr((CBaseEntity *)pevInflictor);
@ -151,8 +143,6 @@ int CCSBot::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAtta
}
// Invoked when killed
/* <2e8769> ../cstrike/dlls/bot/cs_bot.cpp:171 */
void CCSBot::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib)
{
PrintIfWatched("Killed( attacker = %s )\n", STRING(pevAttacker->netname));
@ -172,8 +162,6 @@ void CCSBot::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib)
}
// Return true if line segment intersects rectagular volume
/* <2e7c11> ../cstrike/dlls/bot/cs_bot.cpp:200 */
bool IsIntersectingBox(const Vector *start, const Vector *end, const Vector *boxMin, const Vector *boxMax)
{
unsigned char startFlags = 0;
@ -220,8 +208,6 @@ bool IsIntersectingBox(const Vector *start, const Vector *end, const Vector *box
}
// When bot is touched by another entity.
/* <2e87d9> ../cstrike/dlls/bot/cs_bot.cpp:253 */
void CCSBot::BotTouch(CBaseEntity *other)
{
// if we have touched a higher-priority player, make way
@ -247,7 +233,7 @@ void CCSBot::BotTouch(CBaseEntity *other)
// they are higher priority - make way, unless we're already making way for someone more important
if (m_avoid != NULL)
{
unsigned int avoidPri = TheCSBots()->GetPlayerPriority(static_cast<CBasePlayer *>(static_cast<CBaseEntity *>(m_avoid)));
unsigned int avoidPri = TheCSBots()->GetPlayerPriority(static_cast<CBasePlayer *>(m_avoid));
if (avoidPri < otherPri)
{
// ignore 'other' because we're already avoiding someone better
@ -287,7 +273,7 @@ void CCSBot::BotTouch(CBaseEntity *other)
if (IsUsingGrenade())
{
EquipBestWeapon(0);
EquipBestWeapon();
return;
}
@ -296,7 +282,6 @@ void CCSBot::BotTouch(CBaseEntity *other)
}
}
/* <2e89e3> ../cstrike/dlls/bot/cs_bot.cpp:335 */
bool CCSBot::IsBusy() const
{
if (IsAttacking() ||
@ -312,13 +297,11 @@ bool CCSBot::IsBusy() const
return false;
}
/* <2e8a0c> ../cstrike/dlls/bot/cs_bot.cpp:351 */
void CCSBot::BotDeathThink()
{
;
}
/* <2e8a34> ../cstrike/dlls/bot/cs_bot.cpp:358 */
CBasePlayer *CCSBot::FindNearbyPlayer()
{
CBaseEntity *pEntity = NULL;
@ -340,8 +323,6 @@ CBasePlayer *CCSBot::FindNearbyPlayer()
}
// Assign given player as our current enemy to attack
/* <2e8abd> ../cstrike/dlls/bot/cs_bot.cpp:385 */
void CCSBot::SetEnemy(CBasePlayer *enemy)
{
if (m_enemy != enemy)
@ -354,8 +335,6 @@ void CCSBot::SetEnemy(CBasePlayer *enemy)
// If we are not on the navigation mesh (m_currentArea == NULL),
// move towards last known area.
// Return false if off mesh.
/* <2e8af6> ../cstrike/dlls/bot/cs_bot.cpp:400 */
bool CCSBot::StayOnNavMesh()
{
if (m_currentArea != NULL)
@ -403,7 +382,6 @@ bool CCSBot::StayOnNavMesh()
return false;
}
/* <2e8c56> ../cstrike/dlls/bot/cs_bot.cpp:450 */
void CCSBot::Panic(CBasePlayer *enemy)
{
if (IsSurprised())
@ -465,7 +443,6 @@ void CCSBot::Panic(CBasePlayer *enemy)
PrintIfWatched("Aaaah!\n");
}
/* <2e9047> ../cstrike/dlls/bot/cs_bot.cpp:527 */
bool CCSBot::IsDoingScenario() const
{
if (cv_bot_defer_to_human.value <= 0.0f)
@ -475,16 +452,12 @@ bool CCSBot::IsDoingScenario() const
}
// Return true if we noticed the bomb on the ground or on the radar (for T's only)
/* <2e9070> ../cstrike/dlls/bot/cs_bot.cpp:544 */
bool CCSBot::NoticeLooseBomb() const
{
CCSBotManager *ctrl = TheCSBots();
if (ctrl->GetScenario() != CCSBotManager::SCENARIO_DEFUSE_BOMB)
if (TheCSBots()->GetScenario() != CCSBotManager::SCENARIO_DEFUSE_BOMB)
return false;
CBaseEntity *bomb = ctrl->GetLooseBomb();
CBaseEntity *bomb = TheCSBots()->GetLooseBomb();
if (bomb != NULL)
{
@ -496,16 +469,12 @@ bool CCSBot::NoticeLooseBomb() const
}
// Return true if can see the bomb lying on the ground
/* <2e90d4> ../cstrike/dlls/bot/cs_bot.cpp:566 */
bool CCSBot::CanSeeLooseBomb() const
{
CCSBotManager *ctrl = TheCSBots();
if (ctrl->GetScenario() != CCSBotManager::SCENARIO_DEFUSE_BOMB)
if (TheCSBots()->GetScenario() != CCSBotManager::SCENARIO_DEFUSE_BOMB)
return false;
CBaseEntity *bomb = ctrl->GetLooseBomb();
CBaseEntity *bomb = TheCSBots()->GetLooseBomb();
if (bomb != NULL)
{
@ -517,13 +486,9 @@ bool CCSBot::CanSeeLooseBomb() const
}
// Return true if can see the planted bomb
/* <2e9140> ../cstrike/dlls/bot/cs_bot.cpp:588 */
bool CCSBot::CanSeePlantedBomb() const
{
CCSBotManager *ctrl = TheCSBots();
if (ctrl->GetScenario() != CCSBotManager::SCENARIO_DEFUSE_BOMB)
if (TheCSBots()->GetScenario() != CCSBotManager::SCENARIO_DEFUSE_BOMB)
return false;
if (!GetGameState()->IsBombPlanted())
@ -538,8 +503,6 @@ bool CCSBot::CanSeePlantedBomb() const
}
// Return last enemy that hurt us
/* <2e918e> ../cstrike/dlls/bot/cs_bot.cpp:610 */
CBasePlayer *CCSBot::GetAttacker() const
{
if (m_attacker != NULL && m_attacker->IsAlive())
@ -549,8 +512,6 @@ CBasePlayer *CCSBot::GetAttacker() const
}
// Immediately jump off of our ladder, if we're on one
/* <2e91b7> ../cstrike/dlls/bot/cs_bot.cpp:622 */
void CCSBot::GetOffLadder()
{
if (IsUsingLadder())
@ -561,8 +522,6 @@ void CCSBot::GetOffLadder()
}
// Return time when given spot was last checked
/* <2e91f1> ../cstrike/dlls/bot/cs_bot.cpp:637 */
float CCSBot::GetHidingSpotCheckTimestamp(HidingSpot *spot) const
{
for (int i = 0; i < m_checkedHidingSpotCount; ++i)
@ -576,8 +535,6 @@ float CCSBot::GetHidingSpotCheckTimestamp(HidingSpot *spot) const
// Set the timestamp of the given spot to now.
// If the spot is not in the set, overwrite the least recently checked spot.
/* <2e9240> ../cstrike/dlls/bot/cs_bot.cpp:651 */
void CCSBot::SetHidingSpotCheckTimestamp(HidingSpot *spot)
{
int leastRecent = 0;
@ -616,8 +573,6 @@ void CCSBot::SetHidingSpotCheckTimestamp(HidingSpot *spot)
}
// Periodic check of hostage count in case we lost some
/* <2e92b8> ../cstrike/dlls/bot/cs_bot.cpp:693 */
void CCSBot::UpdateHostageEscortCount()
{
const float updateInterval = 1.0f;
@ -646,16 +601,12 @@ void CCSBot::UpdateHostageEscortCount()
}
// Return true if we are outnumbered by enemies
/* <2e940d> ../cstrike/dlls/bot/cs_bot.cpp:722 */
bool CCSBot::IsOutnumbered() const
{
return (GetNearbyFriendCount() < GetNearbyEnemyCount() - 1) ? true : false;
}
// Return number of enemies we are outnumbered by
/* <2e94a0> ../cstrike/dlls/bot/cs_bot.cpp:731 */
int CCSBot::OutnumberedCount() const
{
if (IsOutnumbered())
@ -667,11 +618,8 @@ int CCSBot::OutnumberedCount() const
}
// Return the closest "important" enemy for the given scenario (bomb carrier, VIP, hostage escorter)
/* <2e95cb> ../cstrike/dlls/bot/cs_bot.cpp:744 */
CBasePlayer *CCSBot::GetImportantEnemy(bool checkVisibility) const
{
CCSBotManager *ctrl = TheCSBots();
CBasePlayer *nearEnemy = NULL;
float nearDist = 999999999.9f;
@ -703,7 +651,7 @@ CBasePlayer *CCSBot::GetImportantEnemy(bool checkVisibility) const
continue;
// is it "important"
if (!ctrl->IsImportantPlayer(player))
if (!TheCSBots()->IsImportantPlayer(player))
continue;
// is it closest?
@ -724,8 +672,6 @@ CBasePlayer *CCSBot::GetImportantEnemy(bool checkVisibility) const
}
// Sets our current disposition
/* <2e9719> ../cstrike/dlls/bot/cs_bot.cpp:801 */
void CCSBot::SetDisposition(DispositionType disposition)
{
m_disposition = disposition;
@ -737,8 +683,6 @@ void CCSBot::SetDisposition(DispositionType disposition)
}
// Return our current disposition
/* <2e9762> ../cstrike/dlls/bot/cs_bot.cpp:814 */
CCSBot::DispositionType CCSBot::GetDisposition() const
{
if (!m_ignoreEnemiesTimer.IsElapsed())
@ -748,16 +692,12 @@ CCSBot::DispositionType CCSBot::GetDisposition() const
}
// Ignore enemies for a short durationy
/* <2e979b> ../cstrike/dlls/bot/cs_bot.cpp:826 */
void CCSBot::IgnoreEnemies(float duration)
{
m_ignoreEnemiesTimer.Start(duration);
}
// Increase morale one step
/* <2e97fc> ../cstrike/dlls/bot/cs_bot.cpp:835 */
void CCSBot::IncreaseMorale()
{
if (m_morale < EXCELLENT)
@ -767,8 +707,6 @@ void CCSBot::IncreaseMorale()
}
// Decrease morale one step
/* <2e9824> ../cstrike/dlls/bot/cs_bot.cpp:845 */
void CCSBot::DecreaseMorale()
{
if (m_morale > TERRIBLE)
@ -779,13 +717,9 @@ void CCSBot::DecreaseMorale()
// Return true if we are acting like a rogue (not listening to teammates, not doing scenario goals)
// TODO: Account for morale
/* <2e984c> ../cstrike/dlls/bot/cs_bot.cpp:857 */
bool CCSBot::IsRogue() const
{
CCSBotManager *ctrl = TheCSBots();
if (!ctrl->AllowRogues())
if (!TheCSBots()->AllowRogues())
return false;
// periodically re-evaluate our rogue status
@ -803,21 +737,17 @@ bool CCSBot::IsRogue() const
}
// Return true if we are in a hurry
/* <2e98f1> ../cstrike/dlls/bot/cs_bot.cpp:882 */
bool CCSBot::IsHurrying() const
{
if (!m_hurryTimer.IsElapsed())
return true;
CCSBotManager *ctrl = TheCSBots();
// if the bomb has been planted, we are in a hurry, CT or T (they could be defusing it!)
if (ctrl->GetScenario() == CCSBotManager::SCENARIO_DEFUSE_BOMB && ctrl->IsBombPlanted())
if (TheCSBots()->GetScenario() == CCSBotManager::SCENARIO_DEFUSE_BOMB && TheCSBots()->IsBombPlanted())
return true;
// if we are a T and hostages are being rescued, we are in a hurry
if (ctrl->GetScenario() == CCSBotManager::SCENARIO_RESCUE_HOSTAGES
if (TheCSBots()->GetScenario() == CCSBotManager::SCENARIO_RESCUE_HOSTAGES
&& m_iTeam == TERRORIST
&& GetGameState()->AreAllHostagesBeingRescued())
return true;
@ -826,67 +756,47 @@ bool CCSBot::IsHurrying() const
}
// Return true if it is the early, "safe", part of the round
/* <2e9942> ../cstrike/dlls/bot/cs_bot.cpp:906 */
bool CCSBot::IsSafe() const
{
CCSBotManager *ctrl = TheCSBots();
if (ctrl->GetElapsedRoundTime() < m_safeTime)
if (TheCSBots()->GetElapsedRoundTime() < m_safeTime)
return true;
return false;
}
// Return true if it is well past the early, "safe", part of the round
/* <2e9987> ../cstrike/dlls/bot/cs_bot.cpp:920 */
bool CCSBot::IsWellPastSafe() const
{
CCSBotManager *ctrl = TheCSBots();
if (ctrl->GetElapsedRoundTime() > 1.25f * m_safeTime)
if (TheCSBots()->GetElapsedRoundTime() > 1.25f * m_safeTime)
return true;
return false;
}
// Return true if we were in the safe time last update, but not now
/* <2e99d8> ../cstrike/dlls/bot/cs_bot.cpp:934 */
bool CCSBot::IsEndOfSafeTime() const
{
return m_wasSafe && !IsSafe();
}
// Return the amount of "safe time" we have left
/* <2e9a3e> ../cstrike/dlls/bot/cs_bot.cpp:943 */
float CCSBot::GetSafeTimeRemaining() const
{
CCSBotManager *ctrl = TheCSBots();
return m_safeTime - ctrl->GetElapsedRoundTime();
return m_safeTime - TheCSBots()->GetElapsedRoundTime();
}
// Called when enemy seen to adjust safe time for this round
/* <2e9a8f> ../cstrike/dlls/bot/cs_bot.cpp:954 */
void CCSBot::AdjustSafeTime()
{
CCSBotManager *ctrl = TheCSBots();
// if we spotted an enemy sooner than we thought possible, adjust our notion of "safe" time
if (m_safeTime > ctrl->GetElapsedRoundTime())
if (m_safeTime > TheCSBots()->GetElapsedRoundTime())
{
// since right now is not safe, adjust safe time to be a few seconds ago
m_safeTime = ctrl->GetElapsedRoundTime() - 2.0f;
m_safeTime = TheCSBots()->GetElapsedRoundTime() - 2.0f;
}
}
// Return true if we haven't seen an enemy for "a long time"
/* <2e9ad0> ../cstrike/dlls/bot/cs_bot.cpp:970 */
bool CCSBot::HasNotSeenEnemyForLongTime() const
{
const float longTime = 30.0f;
@ -894,16 +804,13 @@ bool CCSBot::HasNotSeenEnemyForLongTime() const
}
// Pick a random zone and hide near it
/* <2e9b26> ../cstrike/dlls/bot/cs_bot.cpp:980 */
bool CCSBot::GuardRandomZone(float range)
{
CCSBotManager *ctrl = TheCSBots();
const CCSBotManager::Zone *zone = ctrl->GetRandomZone();
const CCSBotManager::Zone *zone = TheCSBots()->GetRandomZone();
if (zone != NULL)
{
CNavArea *rescueArea = ctrl->GetRandomAreaInZone(zone);
CNavArea *rescueArea = TheCSBots()->GetRandomAreaInZone(zone);
if (rescueArea != NULL)
{
Hide(rescueArea, -1.0f, range);
@ -916,8 +823,6 @@ bool CCSBot::GuardRandomZone(float range)
// Do a breadth-first search to find a good retreat spot.
// Don't pick a spot that a Player is currently occupying.
/* <2e9c1f> ../cstrike/dlls/bot/cs_bot.cpp:1066 */
const Vector *FindNearbyRetreatSpot(CCSBot *me, float maxRange)
{
CNavArea *area = me->GetLastKnownArea();
@ -938,8 +843,6 @@ const Vector *FindNearbyRetreatSpot(CCSBot *me, float maxRange)
// Return euclidean distance to farthest escorted hostage.
// Return -1 if no hostage is following us.
/* <2eaa1d> ../cstrike/dlls/bot/cs_bot.cpp:1116 */
float CCSBot::GetRangeToFarthestEscortedHostage() const
{
FarthestHostage away(this);

View File

@ -56,16 +56,15 @@
extern int _navAreaCount;
extern int _currentIndex;
extern struct BuyInfo primaryWeaponBuyInfoCT[ PRIMARY_WEAPON_BUY_COUNT ];
extern struct BuyInfo secondaryWeaponBuyInfoCT[ SECONDARY_WEAPON_BUY_COUNT ];
extern struct BuyInfo primaryWeaponBuyInfoCT[PRIMARY_WEAPON_BUY_COUNT];
extern struct BuyInfo secondaryWeaponBuyInfoCT[SECONDARY_WEAPON_BUY_COUNT];
extern struct BuyInfo primaryWeaponBuyInfoT[ PRIMARY_WEAPON_BUY_COUNT ];
extern struct BuyInfo secondaryWeaponBuyInfoT[ SECONDARY_WEAPON_BUY_COUNT ];
extern struct BuyInfo primaryWeaponBuyInfoT[PRIMARY_WEAPON_BUY_COUNT];
extern struct BuyInfo secondaryWeaponBuyInfoT[SECONDARY_WEAPON_BUY_COUNT];
class CCSBot;
class BotChatterInterface;
/* <3327a8> ../cstrike/dlls/bot/cs_bot.h:44 */
class BotState
{
public:
@ -75,7 +74,6 @@ public:
virtual const char *GetName() const = 0;
};
/* <3328b8> ../cstrike/dlls/bot/cs_bot.h:53 */
class IdleState: public BotState
{
public:
@ -88,10 +86,9 @@ public:
void OnEnter_(CCSBot *me);
void OnUpdate_(CCSBot *me);
#endif // HOOK_GAMEDLL
#endif
};
/* <3328d9> ../cstrike/dlls/bot/cs_bot.h:61 */
class HuntState: public BotState
{
public:
@ -106,14 +103,13 @@ public:
void OnUpdate_(CCSBot *me);
void OnExit_(CCSBot *me);
#endif // HOOK_GAMEDLL
#endif
void ClearHuntArea() { m_huntArea = NULL; }
private:
CNavArea *m_huntArea;
};
/* <3328fb> ../cstrike/dlls/bot/cs_bot.h:75 */
class AttackState: public BotState
{
public:
@ -128,7 +124,7 @@ public:
void OnUpdate_(CCSBot *me);
void OnExit_(CCSBot *me);
#endif // HOOK_GAMEDLL
#endif
void SetCrouchAndHold(bool crouch) { m_crouchAndHold = crouch; }
void StopAttacking(CCSBot *me);
@ -160,7 +156,6 @@ protected:
CountdownTimer m_retreatTimer;
};
/* <332922> ../cstrike/dlls/bot/cs_bot.h:120 */
class InvestigateNoiseState: public BotState
{
public:
@ -175,14 +170,13 @@ public:
void OnUpdate_(CCSBot *me);
void OnExit_(CCSBot *me);
#endif // HOOK_GAMEDLL
#endif
private:
void AttendCurrentNoise(CCSBot *me);
Vector m_checkNoisePosition;
};
/* <332949> ../cstrike/dlls/bot/cs_bot.h:133 */
class BuyState: public BotState
{
public:
@ -197,7 +191,7 @@ public:
void OnUpdate_(CCSBot *me);
void OnExit_(CCSBot *me);
#endif // HOOK_GAMEDLL
#endif
private:
bool m_isInitialDelay;
@ -211,7 +205,6 @@ private:
bool m_buyPistol;
};
/* <332970> ../cstrike/dlls/bot/cs_bot.h:154 */
class MoveToState: public BotState
{
public:
@ -226,7 +219,7 @@ public:
void OnUpdate_(CCSBot *me);
void OnExit_(CCSBot *me);
#endif // HOOK_GAMEDLL
#endif
void SetGoalPosition(const Vector &pos) { m_goalPosition = pos; }
void SetRouteType(RouteType route) { m_routeType = route; }
@ -238,7 +231,6 @@ private:
bool m_askedForCover;
};
/* <332997> ../cstrike/dlls/bot/cs_bot.h:171 */
class FetchBombState: public BotState
{
public:
@ -251,11 +243,10 @@ public:
void OnEnter_(CCSBot *me);
void OnUpdate_(CCSBot *me);
#endif // HOOK_GAMEDLL
#endif
};
/* <3329be> ../cstrike/dlls/bot/cs_bot.h:179 */
class PlantBombState: public BotState
{
public:
@ -270,11 +261,10 @@ public:
void OnUpdate_(CCSBot *me);
void OnExit_(CCSBot *me);
#endif // HOOK_GAMEDLL
#endif
};
/* <3329e5> ../cstrike/dlls/bot/cs_bot.h:188 */
class DefuseBombState: public BotState
{
public:
@ -289,10 +279,9 @@ public:
void OnUpdate_(CCSBot *me);
void OnExit_(CCSBot *me);
#endif // HOOK_GAMEDLL
#endif
};
/* <332a0c> ../cstrike/dlls/bot/cs_bot.h:197 */
class HideState: public BotState
{
public:
@ -307,7 +296,7 @@ public:
void OnUpdate_(CCSBot *me);
void OnExit_(CCSBot *me);
#endif // HOOK_GAMEDLL
#endif
public:
void SetHidingSpot(const Vector &pos) { m_hidingSpot = pos; }
@ -337,7 +326,6 @@ private:
Vector m_leaderAnchorPos;
};
/* <332a33> ../cstrike/dlls/bot/cs_bot.h:234 */
class EscapeFromBombState: public BotState
{
public:
@ -352,11 +340,10 @@ public:
void OnUpdate_(CCSBot *me);
void OnExit_(CCSBot *me);
#endif // HOOK_GAMEDLL
#endif
};
/* <332a5a> ../cstrike/dlls/bot/cs_bot.h:243 */
class FollowState: public BotState
{
public:
@ -371,11 +358,13 @@ public:
void OnUpdate_(CCSBot *me);
void OnExit_(CCSBot *me);
#endif // HOOK_GAMEDLL
#endif
void SetLeader(CBaseEntity *leader) { m_leader = leader; }
#ifndef HOOK_GAMEDLL
private:
#endif
void ComputeLeaderMotionState(float leaderSpeed);
EHANDLE m_leader;
@ -405,7 +394,6 @@ private:
CountdownTimer m_idleTimer;
};
/* <332a81> ../cstrike/dlls/bot/cs_bot.h:282 */
class UseEntityState: public BotState
{
public:
@ -420,7 +408,7 @@ public:
void OnUpdate_(CCSBot *me);
void OnExit_(CCSBot *me);
#endif // HOOK_GAMEDLL
#endif
void SetEntity(CBaseEntity *entity) { m_entity = entity; }
@ -429,8 +417,6 @@ private:
};
// The Counter-strike Bot
/* <32b267> ../cstrike/dlls/bot/cs_bot.h:300 */
class CCSBot: public CBot
{
public:
@ -478,7 +464,7 @@ public:
bool IsEnemyPartVisible_(VisiblePartType part) const;
void RoundRespawn_();
#endif // HOOK_GAMEDLL
#endif
public:
void Disconnect();
@ -494,7 +480,7 @@ public:
bool IsEndOfSafeTime() const; // return true if we were in the safe time last update, but not now
float GetSafeTimeRemaining() const; // return the amount of "safe time" we have left
float GetSafeTime() const; // return what we think the total "safe time" for this map is
NOXREF bool IsUnhealthy() const; // returns true if bot is low on health
//bool IsUnhealthy() const; // returns true if bot is low on health
// behaviors
void Idle();
@ -639,7 +625,7 @@ public:
CNavArea *GetNoiseArea() const; // return area where noise was heard
void ForgetNoise(); // clear the last heard noise
bool CanSeeNoisePosition() const; // return true if we directly see where we think the noise came from
NOXREF float GetNoiseRange() const; // return approximate distance to last noise heard
float GetNoiseRange() const; // return approximate distance to last noise heard
bool CanHearNearbyEnemyGunfire(float range = -1.0f) const; // return true if we hear nearby threatening enemy gunfire within given range (-1 == infinite)
PriorityType GetNoisePriority() const; // return priority of last heard noise
@ -706,14 +692,14 @@ public:
#define NO_SPEED_CHANGE false
PathResult UpdatePathMovement(bool allowSpeedChange = true); // move along our computed path - if allowSpeedChange is true, bot will walk when near goal to ensure accuracy
NOXREF bool AStarSearch(CNavArea *startArea, CNavArea *goalArea); // find shortest path from startArea to goalArea - don't actually buid the path
bool AStarSearch(CNavArea *startArea, CNavArea *goalArea); // find shortest path from startArea to goalArea - don't actually buid the path
bool ComputePath(CNavArea *goalArea, const Vector *goal, RouteType route); // compute path to goal position
bool StayOnNavMesh();
CNavArea *GetLastKnownArea() const; // return the last area we know we were inside of
const Vector &GetPathEndpoint() const; // return final position of our current path
float GetPathDistanceRemaining() const; // eturn estimated distance left to travel along path
void ResetStuckMonitor();
NOXREF bool IsAreaVisible(CNavArea *area) const; // is any portion of the area visible to this bot
bool IsAreaVisible(CNavArea *area) const; // is any portion of the area visible to this bot
const Vector &GetPathPosition(int numpath) const;
bool GetSimpleGroundHeightWithFloor(const Vector *pos, float *height, Vector *normal = NULL); // find "simple" ground height, treating current nav area as part of the floor
@ -759,7 +745,7 @@ public:
// approach points
void ComputeApproachPoints(); // determine the set of "approach points" representing where the enemy can enter this region
NOXREF void UpdateApproachPoints(); // recompute the approach point set if we have moved far enough to invalidate the current ones
void UpdateApproachPoints(); // recompute the approach point set if we have moved far enough to invalidate the current ones
void ClearApproachPoints();
void DrawApproachPoints(); // for debugging
float GetHidingSpotCheckTimestamp(HidingSpot *spot) const; // return time when given spot was last checked
@ -815,7 +801,7 @@ public:
#ifndef HOOK_GAMEDLL
private:
#endif // HOOK_GAMEDLL
#endif
friend class CCSBotManager;
// TODO: Get rid of these
@ -874,7 +860,7 @@ private:
Vector m_goalPosition;
EHANDLE m_goalEntity;
void MoveTowardsPosition(const Vector *pos); // move towards position, independant of view angle
NOXREF void MoveAwayFromPosition(const Vector *pos); // move away from position, independant of view angle
void MoveAwayFromPosition(const Vector *pos); // move away from position, independant of view angle
void StrafeAwayFromPosition(const Vector *pos); // strafe (sidestep) away from position, independant of view angle
void StuckCheck(); // check if we have become stuck
@ -895,7 +881,7 @@ private:
Vector pos; // our movement goal position at this point in the path
const CNavLadder *ladder; // if "how" refers to a ladder, this is it
}
m_path[ MAX_PATH_LENGTH ];
m_path[MAX_PATH_LENGTH];
int m_pathLength;
int m_pathIndex;
float m_areaEnteredTimestamp;
@ -993,12 +979,12 @@ private:
float m_peripheralTimestamp;
enum { MAX_APPROACH_POINTS = 16 };
Vector m_approachPoint[ MAX_APPROACH_POINTS ];
Vector m_approachPoint[MAX_APPROACH_POINTS];
unsigned char m_approachPointCount;
Vector m_approachPointViewPosition; // the position used when computing current approachPoint set
bool BendLineOfSight(const Vector *eye, const Vector *point, Vector *bend) const; // "bend" our line of sight until we can see the target point. Return bend point, false if cant bend.
NOXREF bool FindApproachPointNearestPath(Vector *pos); // find the approach point that is nearest to our current path, ahead of us
bool FindApproachPointNearestPath(Vector *pos); // find the approach point that is nearest to our current path, ahead of us
bool m_isWaitingToTossGrenade; // lining up throw
CountdownTimer m_tossGrenadeTimer; // timeout timer for grenade tossing
@ -1013,7 +999,7 @@ private:
HidingSpot *spot;
float timestamp;
}
m_checkedHidingSpot[ MAX_CHECKED_SPOTS ];
m_checkedHidingSpot[MAX_CHECKED_SPOTS];
int m_checkedHidingSpotCount;
// view angle mechanism
@ -1052,7 +1038,7 @@ private:
float timestamp;
bool isEnemy;
}
m_watchInfo[ MAX_CLIENTS ];
m_watchInfo[MAX_CLIENTS];
mutable EHANDLE m_bomber; // points to bomber if we can see him
int m_nearbyFriendCount; // number of nearby teammates
@ -1082,7 +1068,7 @@ private:
bool isReloading;
bool isProtectedByShield;
}
m_enemyQueue[ MAX_ENEMY_QUEUE ]; // round-robin queue for simulating reaction times
m_enemyQueue[MAX_ENEMY_QUEUE]; // round-robin queue for simulating reaction times
byte m_enemyQueueIndex;
byte m_enemyQueueCount;
@ -1099,7 +1085,7 @@ private:
float m_stuckJumpTimestamp; // time for next jump when stuck
enum { MAX_VEL_SAMPLES = 5 };
float m_avgVel[ MAX_VEL_SAMPLES ];
float m_avgVel[MAX_VEL_SAMPLES];
int m_avgVelIndex;
int m_avgVelCount;
Vector m_lastOrigin;
@ -1154,129 +1140,113 @@ private:
};
// Inlines
/* <51934c> ../cstrike/dlls/bot/cs_bot.h:316 */
inline float CCSBot::GetCombatRange() const
{
return m_combatRange;
}
/* <58de9b> ../cstrike/dlls/bot/cs_bot.h:318 */
inline void CCSBot::SetRogue(bool rogue)
{
m_isRogue = rogue;
}
/* <519617> ../cstrike/dlls/bot/cs_bot.h:320 */
inline void CCSBot::Hurry(float duration)
{
m_hurryTimer.Start(duration);
}
/* <5a0773> ../cstrike/dlls/bot/cs_bot.h:326 */
inline float CCSBot::GetSafeTime() const
{
return m_safeTime;
}
/* <5c4b10> ../cstrike/dlls/bot/cs_bot.h:355 */
inline bool CCSBot::IsCarryingBomb() const
{
return m_bHasC4;
}
/* <5a07aa> ../cstrike/dlls/bot/cs_bot.h:369 */
inline bool CCSBot::IsFollowing() const
{
return m_isFollowing;
}
/* <57bf57> ../cstrike/dlls/bot/cs_bot.h:370 */
inline CBasePlayer *CCSBot::GetFollowLeader()
{
return m_leader;
}
/* <3c5a20> ../cstrike/dlls/bot/cs_bot.h:375 */
inline float CCSBot::GetFollowDuration() const
{
return gpGlobals->time - m_followTimestamp;
}
/* <3c5a39> ../cstrike/dlls/bot/cs_bot.h:376 */
inline bool CCSBot::CanAutoFollow() const
{
return (gpGlobals->time > m_allowAutoFollowTime);
}
/* <3c5a52> ../cstrike/dlls/bot/cs_bot.h:381 */
inline void CCSBot::AimAtEnemy()
{
m_isAimingAtEnemy = true;
}
/* <3c5a70> ../cstrike/dlls/bot/cs_bot.h:382 */
inline void CCSBot::StopAiming()
{
m_isAimingAtEnemy = false;
}
/* <3c5a89> ../cstrike/dlls/bot/cs_bot.h:383 */
inline bool CCSBot::IsAimingAtEnemy() const
{
return m_isAimingAtEnemy;
}
/* <3e9c5e> ../cstrike/dlls/bot/cs_bot.h:385 */
inline bool CCSBot::IsSurprised() const
{
return gpGlobals->time - m_surpriseTimestamp < 5.0f;
if (gpGlobals->time - m_surpriseTimestamp < 5.0f)
return true;
return false;
}
/* <3ea00d> ../cstrike/dlls/bot/cs_bot.h:386 */
inline float CCSBot::GetSurpriseDelay() const
{
return gpGlobals->time - IsSurprised() ? m_surpriseDelay : 0.0f;
if (!IsSurprised())
return 0.0f;
return m_surpriseDelay;
}
/* <51938e> ../cstrike/dlls/bot/cs_bot.h:387 */
inline void CCSBot::ClearSurpriseDelay()
{
m_surpriseDelay = 0.0f;
m_surpriseTimestamp = 0.0f;
}
/* <5e2f12> ../cstrike/dlls/bot/cs_bot.h:389 */
inline float CCSBot::GetStateTimestamp() const
{
return m_stateTimestamp;
}
/* <5c4c60> ../cstrike/dlls/bot/cs_bot.h:394 */
inline CSGameState *CCSBot::GetGameState()
{
return &m_gameState;
}
/* <2e7d45> ../cstrike/dlls/bot/cs_bot.h:395 */
inline const CSGameState *CCSBot::GetGameState() const
{
return &m_gameState;
}
/* <5c4ce8> ../cstrike/dlls/bot/cs_bot.h:397 */
inline bool CCSBot::IsAtBombsite()
{
return (m_signals.GetState() & SIGNAL_BOMB) == SIGNAL_BOMB;
}
/* <5a07c3> ../cstrike/dlls/bot/cs_bot.h:453 */
inline CCSBot::MoraleType CCSBot::GetMorale() const
{
return m_morale;
}
/* <5b2dba> ../cstrike/dlls/bot/cs_bot.h:459 */
inline bool CCSBot::IsNoiseHeard() const
{
if (m_noiseTimestamp <= 0.0f)
@ -1289,214 +1259,179 @@ inline bool CCSBot::IsNoiseHeard() const
return false;
}
/* <5d3f92> ../cstrike/dlls/bot/cs_bot.h:426 */
inline void CCSBot::SetTask(TaskType task, CBaseEntity *entity)
{
m_task = task;
m_taskEntity = entity;
}
/* <5e2f30> ../cstrike/dlls/bot/cs_bot.h:427 */
inline CCSBot::TaskType CCSBot::GetTask() const
{
return m_task;
}
/* <5c4c42> ../cstrike/dlls/bot/cs_bot.h:428 */
inline CBaseEntity *CCSBot::GetTaskEntity()
{
return m_taskEntity;
}
/* <5b2d33> ../cstrike/dlls/bot/cs_bot.h:474 */
inline CNavArea *CCSBot::GetNoiseArea() const
{
return m_noiseArea;
}
/* <5b2d51> ../cstrike/dlls/bot/cs_bot.h:475 */
inline void CCSBot::ForgetNoise()
{
m_noiseTimestamp = 0.0f;
}
/* <5b2d6f> ../cstrike/dlls/bot/cs_bot.h:487 */
inline PriorityType CCSBot::GetNoisePriority() const
{
return m_noisePriority;
}
/* <5c4ccf> ../cstrike/dlls/bot/cs_bot.h:491 */
inline BotChatterInterface *CCSBot::GetChatter()
{
return &m_chatter;
}
/* <111238> ../cstrike/dlls/bot/cs_bot.h:508 */
inline bool CCSBot::IsUsingVoice() const
{
return (m_voiceFeedbackEndTimestamp != 0.0f);
}
/* <519493> ../cstrike/dlls/bot/cs_bot.h:513 */
inline CBasePlayer *CCSBot::GetEnemy()
{
return m_enemy;
}
/* <57bfbd> ../cstrike/dlls/bot/cs_bot.h:514 */
inline int CCSBot::GetNearbyEnemyCount() const
{
return Q_min(GetEnemiesRemaining(), m_nearbyEnemyCount);
}
/* <2fecad> ../cstrike/dlls/bot/cs_bot.h:515 */
inline unsigned int CCSBot::GetEnemyPlace() const
{
return m_enemyPlace;
}
/* <2eff13> ../cstrike/dlls/bot/cs_bot.h:516 */
inline bool CCSBot::CanSeeBomber() const
{
return (m_bomber == NULL) ? false : true;
}
/* <3c6110> ../cstrike/dlls/bot/cs_bot.h:517 */
inline CBasePlayer *CCSBot::GetBomber() const
{
return m_bomber;
}
/* <2fecc8> ../cstrike/dlls/bot/cs_bot.h:519 */
inline int CCSBot::GetNearbyFriendCount() const
{
return Q_min(GetFriendsRemaining(), m_nearbyFriendCount);
}
/* <3a138c> ../cstrike/dlls/bot/cs_bot.h:521 */
inline CBasePlayer *CCSBot::GetClosestVisibleFriend() const
{
return m_closestVisibleFriend;
}
/* <3c615b> ../cstrike/dlls/bot/cs_bot.h:521 */
inline CBasePlayer *CCSBot::GetClosestVisibleHumanFriend() const
{
return m_closestVisibleHumanFriend;
}
/* <57bfd6> ../cstrike/dlls/bot/cs_bot.h:536 */
inline float CCSBot::GetTimeSinceAttacked() const
{
return gpGlobals->time - m_attackedTimestamp;
}
/* <56ae2c> ../cstrike/dlls/bot/cs_bot.h:537 */
inline float CCSBot::GetFirstSawEnemyTimestamp() const
{
return m_firstSawEnemyTimestamp;
}
/* <58df07> ../cstrike/dlls/bot/cs_bot.h:538 */
inline float CCSBot::GetLastSawEnemyTimestamp() const
{
return m_lastSawEnemyTimestamp;
}
/* <3e9ccc> ../cstrike/dlls/bot/cs_bot.h:539 */
inline float CCSBot::GetTimeSinceLastSawEnemy() const
{
return gpGlobals->time - m_lastSawEnemyTimestamp;
}
/* <3e9ce5> ../cstrike/dlls/bot/cs_bot.h:540 */
inline float CCSBot::GetTimeSinceAcquiredCurrentEnemy() const
{
return gpGlobals->time - m_currentEnemyAcquireTimestamp;
}
/* <5196d7> ../cstrike/dlls/bot/cs_bot.h:542 */
inline const Vector &CCSBot::GetLastKnownEnemyPosition() const
{
return m_lastEnemyPosition;
}
/* <5e2f49> ../cstrike/dlls/bot/cs_bot.h:543 */
inline bool CCSBot::IsEnemyVisible() const
{
return m_isEnemyVisible;
}
/* <519429> ../cstrike/dlls/bot/cs_bot.h:544 */
inline float CCSBot::GetEnemyDeathTimestamp() const
{
return m_enemyDeathTimestamp;
}
/* <519442> ../cstrike/dlls/bot/cs_bot.h:547 */
inline int CCSBot::GetLastVictimID() const
{
return m_lastVictimID;
}
/* <5b2da1> ../cstrike/dlls/bot/cs_bot.h:550 */
inline bool CCSBot::HasPath() const
{
return m_pathLength != 0;
}
/* <5a07f5> ../cstrike/dlls/bot/cs_bot.h:551 */
inline void CCSBot::DestroyPath()
{
m_pathLength = 0;
m_pathLadder = NULL;
}
/* <5a0813> ../cstrike/dlls/bot/cs_bot.h:567 */
inline CNavArea *CCSBot::GetLastKnownArea() const
{
return m_lastKnownArea;
}
/* <51963c> ../cstrike/dlls/bot/cs_bot.h:568 */
inline const Vector &CCSBot::GetPathEndpoint() const
{
return m_path[ m_pathLength - 1 ].pos;
return m_path[m_pathLength - 1].pos;
}
/* <5c1be3> ../cstrike/dlls/bot/cs_bot.h:571 */
inline const Vector &CCSBot::GetPathPosition(int numpath) const
{
return m_path[ numpath ].pos;
return m_path[numpath].pos;
}
/* <5c4b79> ../cstrike/dlls/bot/cs_bot.h:577 */
inline bool CCSBot::IsUsingLadder() const
{
return m_pathLadder != NULL;
}
/* <5a0c27> ../cstrike/dlls/bot/cs_bot.h:580 */
inline void CCSBot::SetGoalEntity(CBaseEntity *entity)
{
m_goalEntity = entity;
}
/* <5c4d01> ../cstrike/dlls/bot/cs_bot.h:581 */
inline CBaseEntity *CCSBot::GetGoalEntity()
{
return m_goalEntity;
}
/* <5195f2> ../cstrike/dlls/bot/cs_bot.h:586 */
inline void CCSBot::ForceRun(float duration)
{
Run();
m_mustRunTimer.Start(duration);
}
/* <3d8238> ../cstrike/dlls/bot/cs_bot.h:598 */
inline void CCSBot::SetLookAngles(float yaw, float pitch)
{
m_lookYaw = yaw;
@ -1508,13 +1443,11 @@ inline void CCSBot::SetForwardAngle(float angle)
m_forwardAngle = angle;
}
/* <57c008> ../cstrike/dlls/bot/cs_bot.h:609 */
inline void CCSBot::SetLookAheadAngle(float angle)
{
m_lookAheadAngle = angle;
}
/* <5e2f62> ../cstrike/dlls/bot/cs_bot.h:612 */
inline void CCSBot::ClearLookAt()
{
//PrintIfWatched("ClearLookAt()\n");
@ -1522,7 +1455,6 @@ inline void CCSBot::ClearLookAt()
m_lookAtDesc = NULL;
}
/* <3d8287> ../cstrike/dlls/bot/cs_bot.h:618 */
inline bool CCSBot::IsLookingAtSpot(PriorityType pri) const
{
if (m_lookAtSpotState != NOT_LOOKING_AT_SPOT && m_lookAtSpotPriority >= pri)
@ -1531,7 +1463,6 @@ inline bool CCSBot::IsLookingAtSpot(PriorityType pri) const
return false;
}
/* <3e9d59> ../cstrike/dlls/bot/cs_bot.h:625 */
inline bool CCSBot::IsViewMoving(float angleVelThreshold) const
{
if (m_lookYawVel < angleVelThreshold && m_lookYawVel > -angleVelThreshold &&
@ -1539,34 +1470,30 @@ inline bool CCSBot::IsViewMoving(float angleVelThreshold) const
{
return false;
}
return true;
}
/* <57c047> ../cstrike/dlls/bot/cs_bot.h:651 */
inline void CCSBot::ClearApproachPoints()
{
m_approachPointCount = 0;
}
/* <3e9d7e> ../cstrike/dlls/bot/cs_bot.h:674 */
inline bool CCSBot::IsThrowingGrenade() const
{
return m_isWaitingToTossGrenade;
}
/* <3e9d97> ../cstrike/dlls/bot/cs_bot.h:679 */
inline void CCSBot::StartRapidFire()
{
m_isRapidFiring = true;
}
/* <3e9db0> ../cstrike/dlls/bot/cs_bot.h:680 */
inline void CCSBot::StopRapidFire()
{
m_isRapidFiring = false;
}
/* <51954d> ../cstrike/dlls/bot/cs_bot.h:684 */
inline CCSBot::ZoomType CCSBot::GetZoomLevel() const
{
if (m_iFOV > 60.0f)
@ -1578,26 +1505,22 @@ inline CCSBot::ZoomType CCSBot::GetZoomLevel() const
return HIGH_ZOOM;
}
/* <5c4b92> ../cstrike/dlls/bot/cs_bot.h:698 */
inline int CCSBot::GetHostageEscortCount() const
{
return m_hostageEscortCount;
}
/* <5e2f80> ../cstrike/dlls/bot/cs_bot.h:699 */
inline void CCSBot::IncreaseHostageEscortCount()
{
++m_hostageEscortCount;
}
/* <5a0c4d> ../cstrike/dlls/bot/cs_bot.h:701 */
inline void CCSBot::ResetWaitForHostagePatience()
{
m_isWaitingForHostage = false;
m_inhibitWaitingForHostageTimer.Invalidate();
}
/* <5d402a> ../cstrike/dlls/bot/cs_bot.h:1055 */
inline float CCSBot::GetFeetZ() const
{
if (IsCrouching())
@ -1612,7 +1535,6 @@ inline float CCSBot::GetFeetZ() const
}
}
/* <5b2dd3> ../cstrike/dlls/bot/cs_bot.h:1063 */
inline const Vector *CCSBot::GetNoisePosition() const
{
if (m_noiseTimestamp > 0.0f)
@ -1621,7 +1543,6 @@ inline const Vector *CCSBot::GetNoisePosition() const
return NULL;
}
/* <519655> ../cstrike/dlls/bot/cs_bot.h:1071 */
inline bool CCSBot::IsAwareOfEnemyDeath() const
{
if (GetEnemyDeathTimestamp() == 0.0f)
@ -1636,7 +1557,6 @@ inline bool CCSBot::IsAwareOfEnemyDeath() const
return false;
}
/* <568b12> ../cstrike/dlls/bot/cs_bot.h:1085 */
inline bool CCSBot::IsNotMoving() const
{
const float stillSpeed = 10.0f;
@ -1648,7 +1568,6 @@ inline bool CCSBot::HasAnyAmmo(CBasePlayerWeapon *weapon) const
return (weapon->m_iClip != 0 || m_rgAmmo[weapon->m_iPrimaryAmmoType] > 0);
}
/* <2e8465> ../cstrike/dlls/bot/cs_bot.cpp:1004 */
class CollectRetreatSpotsFunctor
{
public:
@ -1697,7 +1616,7 @@ public:
if (owner != NULL && m_me->m_iTeam != owner->m_iTeam)
continue;
m_spot[ m_count++ ] = spot->GetPosition();
m_spot[m_count++] = spot->GetPosition();
}
// if we've filled up, stop searching
@ -1710,11 +1629,10 @@ public:
CCSBot *m_me;
float m_range;
const Vector *m_spot[ MAX_SPOTS ];
const Vector *m_spot[MAX_SPOTS];
int m_count;
};
/* <2e7f9f> ../cstrike/dlls/bot/cs_bot.cpp:1088 */
class FarthestHostage
{
public:
@ -1736,26 +1654,6 @@ public:
}
return true;
/*if (hostage->pev->takedamage != DAMAGE_YES)
return true;
if (hostage->m_improv != NULL)
{
if (!hostage->IsFollowingSomeone() || m_me != hostage->GetLeader())
return true;
}
else if (!hostage->IsFollowing(m_me))
return true;
float range = (hostage->Center() - m_me->pev->origin).Length();
if (range > m_farRange)
{
m_farRange = range;
}
return true;*/
}
const CCSBot *m_me;
@ -1763,8 +1661,6 @@ public:
};
// Functor used with NavAreaBuildPath()
/* <5a0af3> ../cstrike/dlls/bot/cs_bot.h:1114 */
class PathCost
{
public:
@ -1892,7 +1788,7 @@ public:
{
// cost is proportional to the density of teammates in this area
const float costPerFriendPerUnit = 50000.0f;
cost += costPerFriendPerUnit * (float)area->GetPlayerCount(m_bot->m_iTeam, m_bot) / size;
cost += costPerFriendPerUnit * float(area->GetPlayerCount(m_bot->m_iTeam, m_bot)) / size;
}
}
@ -1907,7 +1803,6 @@ private:
RouteType m_route;
};
/* <568fae> ../cstrike/dlls/bot/states/cs_bot_follow.cpp:95 */
class FollowTargetCollector
{
public:
@ -1941,8 +1836,6 @@ public:
}
enum { MAX_TARGET_AREAS = 128 };
/* <568dc3> ../cstrike/dlls/bot/states/cs_bot_follow.cpp:124 */
bool operator()(CNavArea *area)
{
if (m_targetAreaCount >= MAX_TARGET_AREAS)
@ -1953,7 +1846,7 @@ public:
{
if (m_forward.IsZero())
{
m_targetArea[ m_targetAreaCount++ ] = area;
m_targetArea[m_targetAreaCount++] = area;
}
else
{
@ -1963,7 +1856,7 @@ public:
//if (DotProduct(to, m_forward) > 0.7071f)
if ((to.x * m_forward.x + to.y * m_forward.y) > 0.7071f)
m_targetArea[ m_targetAreaCount++ ] = area;
m_targetArea[m_targetAreaCount++] = area;
}
}
@ -1973,7 +1866,7 @@ public:
CBasePlayer *m_player;
Vector2D m_forward;
Vector2D m_cutoff;
CNavArea *m_targetArea[ MAX_TARGET_AREAS ];
CNavArea *m_targetArea[MAX_TARGET_AREAS];
int m_targetAreaCount;
};

View File

@ -11,9 +11,8 @@ CBaseEntity *g_pSelectedZombieSpawn = NULL;
CountdownTimer BotChatterInterface::m_encourageTimer;
IntervalTimer BotChatterInterface::m_radioSilenceInterval[ 2 ];
#endif // HOOK_GAMEDLL
#endif
/* <303469> ../cstrike/dlls/bot/cs_bot_chatter.cpp:32 */
const Vector *GetRandomSpotAtPlace(Place place)
{
int count = 0;
@ -45,8 +44,6 @@ const Vector *GetRandomSpotAtPlace(Place place)
}
// Transmit meme to other bots
/* <303541> ../cstrike/dlls/bot/cs_bot_chatter.cpp:62 */
void BotMeme::Transmit(CCSBot *sender) const
{
for (int i = 1; i <= gpGlobals->maxClients; ++i)
@ -89,8 +86,6 @@ void BotMeme::Transmit(CCSBot *sender) const
}
// A teammate called for help - respond
/* <301f03> ../cstrike/dlls/bot/cs_bot_chatter.cpp:104 */
void BotHelpMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const
{
const float maxHelpRange = 3000.0f; // 2000
@ -98,8 +93,6 @@ void BotHelpMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) cons
}
// A teammate reported information about a bombsite
/* <306b4f> ../cstrike/dlls/bot/cs_bot_chatter.cpp:114 */
void BotBombsiteStatusMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const
{
// remember this bombsite's status
@ -120,8 +113,6 @@ void BotBombsiteStatusMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *rece
}
// A teammate reported information about the bomb
/* <306ab6> ../cstrike/dlls/bot/cs_bot_chatter.cpp:137 */
void BotBombStatusMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const
{
// update our gamestate based on teammate's report
@ -152,8 +143,6 @@ void BotBombStatusMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver
}
// A teammate has asked that we follow him
/* <302c87> ../cstrike/dlls/bot/cs_bot_chatter.cpp:167 */
void BotFollowMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const
{
if (receiver->IsRogue())
@ -180,8 +169,6 @@ void BotFollowMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) co
}
// A teammate has asked us to defend a place
/* <302759> ../cstrike/dlls/bot/cs_bot_chatter.cpp:200 */
void BotDefendHereMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const
{
if (receiver->IsRogue())
@ -213,8 +200,6 @@ void BotDefendHereMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver
}
// A teammate has asked where the bomb is planted
/* <3082a5> ../cstrike/dlls/bot/cs_bot_chatter.cpp:234 */
void BotWhereBombMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const
{
int zone = receiver->GetGameState()->GetPlantedBombsite();
@ -224,16 +209,12 @@ void BotWhereBombMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver)
}
// A teammate has asked us to report in
/* <30a56e> ../cstrike/dlls/bot/cs_bot_chatter.cpp:246 */
void BotRequestReportMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const
{
receiver->GetChatter()->ReportingIn();
}
// A teammate told us all the hostages are gone
/* <3025b5> ../cstrike/dlls/bot/cs_bot_chatter.cpp:256 */
void BotAllHostagesGoneMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const
{
receiver->GetGameState()->AllHostagesGone();
@ -243,8 +224,6 @@ void BotAllHostagesGoneMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *rec
}
// A teammate told us a CT is talking to a hostage
/* <3029a9> ../cstrike/dlls/bot/cs_bot_chatter.cpp:269 */
void BotHostageBeingTakenMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const
{
receiver->GetGameState()->HostageWasTaken();
@ -259,13 +238,11 @@ void BotHostageBeingTakenMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *r
receiver->GetChatter()->Say("Affirmative");
}
/* <303609> ../cstrike/dlls/bot/cs_bot_chatter.cpp:285 */
BotSpeakable::BotSpeakable()
{
m_phrase = NULL;
}
/* <303655> ../cstrike/dlls/bot/cs_bot_chatter.cpp:291 */
BotSpeakable::~BotSpeakable()
{
if (m_phrase != NULL)
@ -275,7 +252,6 @@ BotSpeakable::~BotSpeakable()
}
}
/* <30ba3b> ../cstrike/dlls/bot/cs_bot_chatter.cpp:303 */
BotPhrase::BotPhrase(unsigned int id, bool isPlace)
{
m_name = NULL;
@ -290,12 +266,11 @@ BotPhrase::BotPhrase(unsigned int id, bool isPlace)
InitVoiceBank(0);
}
/* <3036c2> ../cstrike/dlls/bot/cs_bot_chatter.cpp:314 */
BotPhrase::~BotPhrase()
{
for (uint32 bank = 0; bank < m_voiceBank.size(); ++bank)
for (size_t bank = 0; bank < m_voiceBank.size(); ++bank)
{
for (uint32 speakable = 0; speakable < m_voiceBank[bank]->size(); ++speakable)
for (size_t speakable = 0; speakable < m_voiceBank[bank]->size(); ++speakable)
{
delete (*m_voiceBank[bank])[speakable];
}
@ -303,10 +278,12 @@ BotPhrase::~BotPhrase()
}
if (m_name != NULL)
delete [] m_name;
{
delete[] m_name;
m_name = NULL;
}
}
/* <30b837> ../cstrike/dlls/bot/cs_bot_chatter.cpp:326 */
void BotPhrase::InitVoiceBank(int bankIndex)
{
while (m_numVoiceBanks <= bankIndex)
@ -319,8 +296,6 @@ void BotPhrase::InitVoiceBank(int bankIndex)
}
// Return a random speakable - avoid repeating
/* <303917> ../cstrike/dlls/bot/cs_bot_chatter.cpp:340 */
char *BotPhrase::GetSpeakable(int bankIndex, float *duration) const
{
if (bankIndex < 0 || bankIndex >= m_numVoiceBanks || m_count[bankIndex] == 0)
@ -376,19 +351,16 @@ char *BotPhrase::GetSpeakable(int bankIndex, float *duration) const
}
// Randomly shuffle the speakable order
/* <30395a> ../cstrike/dlls/bot/cs_bot_chatter.cpp:395 */
#ifndef HOOK_GAMEDLL
void BotPhrase::Randomize()
{
for (uint32 i = 0; i < m_voiceBank.size(); ++i)
for (size_t i = 0; i < m_voiceBank.size(); ++i)
{
std::random_shuffle(m_voiceBank[i]->begin(), m_voiceBank[i]->end());
}
}
#endif // HOOK_GAMEDLL
#endif
/* <303b3f> ../cstrike/dlls/bot/cs_bot_chatter.cpp:409 */
BotPhraseManager::BotPhraseManager()
{
for (int i = 0; i < MAX_PLACES_PER_MAP; ++i)
@ -398,16 +370,12 @@ BotPhraseManager::BotPhraseManager()
}
// Invoked when map changes
/* <303c45> ../cstrike/dlls/bot/cs_bot_chatter.cpp:417 */
void BotPhraseManager::OnMapChange()
{
m_placeCount = 0;
}
// Invoked when the round resets
/* <303c70> ../cstrike/dlls/bot/cs_bot_chatter.cpp:425 */
void BotPhraseManager::OnRoundRestart()
{
// effectively reset all interval timers
@ -427,8 +395,6 @@ void BotPhraseManager::OnRoundRestart()
}
// Initialize phrase system from database file
/* <30c1fc> ../cstrike/dlls/bot/cs_bot_chatter.cpp:443 */
bool BotPhraseManager::Initialize(const char *filename, int bankIndex)
{
bool isDefault = (bankIndex == 0);
@ -672,44 +638,27 @@ bool BotPhraseManager::Initialize(const char *filename, int bankIndex)
}
FREE_FILE(phraseDataFile);
return true;
}
/* <30409e> ../cstrike/dlls/bot/cs_bot_chatter.cpp:682 */
BotPhraseManager::~BotPhraseManager()
{
BotPhraseList::iterator iter;
for (iter = m_list.begin(); iter != m_list.end(); ++iter)
{
const BotPhrase *phrase = *iter;
if (phrase != NULL)
{
delete phrase;
}
}
delete (*iter);
for (iter = m_placeList.begin(); iter != m_placeList.end(); ++iter)
{
const BotPhrase *phrase = *iter;
if (phrase != NULL)
{
delete phrase;
}
}
delete (*iter);
m_list.clear();
m_placeList.clear();
}
/* <3043ec> ../cstrike/dlls/bot/cs_bot_chatter.cpp:708 */
Place BotPhraseManager::NameToID(const char *name) const
{
for (BotPhraseList::const_iterator iter = m_placeList.begin(); iter != m_placeList.end(); ++iter)
{
const BotPhrase *phrase = *iter;
const BotPhrase *phrase = (*iter);
if (!Q_stricmp(phrase->m_name, name))
return phrase->m_id;
@ -717,7 +666,7 @@ Place BotPhraseManager::NameToID(const char *name) const
for (BotPhraseList::const_iterator iter = m_list.begin(); iter != m_list.end(); ++iter)
{
const BotPhrase *phrase = *iter;
const BotPhrase *phrase = (*iter);
if (!Q_stricmp(phrase->m_name, name))
return phrase->m_id;
@ -726,12 +675,11 @@ Place BotPhraseManager::NameToID(const char *name) const
return 0;
}
/* <3044b4> ../cstrike/dlls/bot/cs_bot_chatter.cpp:732 */
const char *BotPhraseManager::IDToName(Place id) const
{
for (BotPhraseList::const_iterator iter = m_placeList.begin(); iter != m_placeList.end(); ++iter)
{
const BotPhrase *phrase = *iter;
const BotPhrase *phrase = (*iter);
if (phrase->m_id == id)
return phrase->m_name;
@ -739,7 +687,7 @@ const char *BotPhraseManager::IDToName(Place id) const
for (BotPhraseList::const_iterator iter = m_list.begin(); iter != m_list.end(); ++iter)
{
const BotPhrase *phrase = *iter;
const BotPhrase *phrase = (*iter);
if (phrase->m_id == id)
return phrase->m_name;
@ -749,13 +697,11 @@ const char *BotPhraseManager::IDToName(Place id) const
}
// Given a name, return the associated phrase collection
/* <304597> ../cstrike/dlls/bot/cs_bot_chatter.cpp:758 */
const BotPhrase *BotPhraseManager::GetPhrase(const char *name) const
{
for (BotPhraseList::const_iterator iter = m_list.begin(); iter != m_list.end(); ++iter)
{
const BotPhrase *phrase = *iter;
const BotPhrase *phrase = (*iter);
if (!Q_stricmp(phrase->m_name, name))
return phrase;
@ -765,15 +711,14 @@ const BotPhrase *BotPhraseManager::GetPhrase(const char *name) const
return NULL;
}
/*
// Given an id, return the associated phrase collection
// TODO: Store phrases in a vector to make this fast
/*
const BotPhrase *BotPhraseManager::GetPhrase(unsigned int id) const
{
for (BotPhraseList::const_iterator iter = m_list.begin(); iter != m_list.end(); ++iter)
{
const BotPhrase *phrase = *iter;
const BotPhrase *phrase = (*iter);
if (phrase->m_id == id)
return phrase;
@ -785,8 +730,6 @@ const BotPhrase *BotPhraseManager::GetPhrase(unsigned int id) const
*/
// Given a name, return the associated Place phrase collection
/* <304654> ../cstrike/dlls/bot/cs_bot_chatter.cpp:793 */
const BotPhrase *BotPhraseManager::GetPlace(const char *name) const
{
if (name == NULL)
@ -794,7 +737,7 @@ const BotPhrase *BotPhraseManager::GetPlace(const char *name) const
for (BotPhraseList::const_iterator iter = m_placeList.begin(); iter != m_placeList.end(); ++iter)
{
const BotPhrase *phrase = *iter;
const BotPhrase *phrase = (*iter);
if (!Q_stricmp(phrase->m_name, name))
return phrase;
@ -804,8 +747,6 @@ const BotPhrase *BotPhraseManager::GetPlace(const char *name) const
}
// Given a place, return the associated Place phrase collection
/* <3046eb> ../cstrike/dlls/bot/cs_bot_chatter.cpp:811 */
const BotPhrase *BotPhraseManager::GetPlace(PlaceCriteria place) const
{
if (place == UNDEFINED_PLACE)
@ -813,7 +754,7 @@ const BotPhrase *BotPhraseManager::GetPlace(PlaceCriteria place) const
for (BotPhraseList::const_iterator iter = m_placeList.begin(); iter != m_placeList.end(); ++iter)
{
const BotPhrase *phrase = *iter;
const BotPhrase *phrase = (*iter);
if (phrase->m_id == place)
return phrase;
@ -822,7 +763,6 @@ const BotPhrase *BotPhraseManager::GetPlace(PlaceCriteria place) const
return NULL;
}
/* <30477e> ../cstrike/dlls/bot/cs_bot_chatter.cpp:830 */
BotStatement::BotStatement(BotChatterInterface *chatter, BotStatementType type, float expireDuration)
{
m_chatter = chatter;
@ -847,32 +787,27 @@ BotStatement::BotStatement(BotChatterInterface *chatter, BotStatementType type,
m_conditionCount = 0;
}
/* <3047bd> ../cstrike/dlls/bot/cs_bot_chatter.cpp:855 */
BotStatement::~BotStatement()
{
if (m_meme != NULL)
{
delete m_meme;
m_meme = NULL;
}
}
/* <3047e0> ../cstrike/dlls/bot/cs_bot_chatter.cpp:863 */
CCSBot *BotStatement::GetOwner() const
{
return m_chatter->GetOwner();
}
// Attach a meme to this statement, to be transmitted to other friendly bots when spoken
/* <304803> ../cstrike/dlls/bot/cs_bot_chatter.cpp:872 */
void BotStatement::AttachMeme(BotMeme *meme)
{
m_meme = meme;
}
// Add a conditions that must be true for the statement to be spoken
/* <30482f> ../cstrike/dlls/bot/cs_bot_chatter.cpp:881 */
void BotStatement::AddCondition(ConditionType condition)
{
if (m_conditionCount < MAX_BOT_CONDITIONS)
@ -880,8 +815,6 @@ void BotStatement::AddCondition(ConditionType condition)
}
// Return true if this statement is "important" and not personality chatter
/* <30485b> ../cstrike/dlls/bot/cs_bot_chatter.cpp:891 */
bool BotStatement::IsImportant() const
{
// if a statement contains any important phrases, it is important
@ -899,8 +832,6 @@ bool BotStatement::IsImportant() const
}
// Verify all attached conditions
/* <3048bc> ../cstrike/dlls/bot/cs_bot_chatter.cpp:911 */
bool BotStatement::IsValid() const
{
for (int i = 0; i < m_conditionCount; ++i)
@ -932,8 +863,6 @@ bool BotStatement::IsValid() const
}
// Return true if this statement is essentially the same as the given one
/* <30492d> ../cstrike/dlls/bot/cs_bot_chatter.cpp:950 */
bool BotStatement::IsRedundant(const BotStatement *say) const
{
// special cases
@ -970,8 +899,6 @@ bool BotStatement::IsRedundant(const BotStatement *say) const
}
// Return true if this statement is no longer appropriate to say
/* <304977> ../cstrike/dlls/bot/cs_bot_chatter.cpp:990 */
bool BotStatement::IsObsolete() const
{
// if the round is over, the only things we should say are emotes
@ -995,8 +922,6 @@ bool BotStatement::IsObsolete() const
}
// Possibly change what were going to say base on what teammate is saying
/* <3049b6> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1008 */
void BotStatement::Convert(const BotStatement *say)
{
if (GetType() == REPORT_MY_PLAN && say->GetType() == REPORT_MY_PLAN)
@ -1025,7 +950,6 @@ void BotStatement::Convert(const BotStatement *say)
}
}
/* <304a7c> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1037 */
void BotStatement::AppendPhrase(const BotPhrase *phrase)
{
if (phrase == NULL)
@ -1039,8 +963,6 @@ void BotStatement::AppendPhrase(const BotPhrase *phrase)
}
// Special phrases that depend on the context
/* <304acf> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1052 */
void BotStatement::AppendPhrase(ContextType contextPhrase)
{
if (m_count < MAX_BOT_PHRASES)
@ -1052,8 +974,6 @@ void BotStatement::AppendPhrase(ContextType contextPhrase)
// Say our statement
// m_index refers to the phrase currently being spoken, or -1 if we havent started yet
/* <304b22> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1065 */
bool BotStatement::Update()
{
CCSBot *me = GetOwner();
@ -1249,8 +1169,6 @@ bool BotStatement::Update()
// If this statement refers to a specific place, return that place
// Places can be implicit in the statement, or explicitly defined
/* <2fee36> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1266 */
Place BotStatement::GetPlace() const
{
// return any explicitly set place if we have one
@ -1268,8 +1186,6 @@ Place BotStatement::GetPlace() const
}
// Return true if this statement has an associated count
/* <305289> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1283 */
bool BotStatement::HasCount() const
{
for (int i = 0; i < m_count; ++i)
@ -1285,7 +1201,6 @@ enum PitchHack { P_HI, P_NORMAL, P_LOW };
static int nextPitch = P_HI;
/* <305543> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1308 */
BotChatterInterface::BotChatterInterface(CCSBot *me)
{
m_me = me;
@ -1308,7 +1223,6 @@ BotChatterInterface::BotChatterInterface(CCSBot *me)
Reset();
}
/* <305307> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1334 */
BotChatterInterface::~BotChatterInterface()
{
// free pending statements
@ -1321,8 +1235,6 @@ BotChatterInterface::~BotChatterInterface()
}
// Reset to initial state
/* <305386> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1347 */
void BotChatterInterface::Reset()
{
BotStatement *msg, *nextMsg;
@ -1354,8 +1266,6 @@ void BotChatterInterface::Reset()
}
// Register a statement for speaking
/* <305661> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1381 */
void BotChatterInterface::AddStatement(BotStatement *statement, bool mustAdd)
{
// don't add statements if bot chatter is shut off
@ -1443,8 +1353,6 @@ void BotChatterInterface::AddStatement(BotStatement *statement, bool mustAdd)
}
// Remove a statement
/* <3056fa> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1462 */
void BotChatterInterface::RemoveStatement(BotStatement *statement)
{
if (statement->m_next != NULL)
@ -1459,8 +1367,6 @@ void BotChatterInterface::RemoveStatement(BotStatement *statement)
}
// Track nearby enemy count and report enemy activity
/* <3087ee> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1479 */
void BotChatterInterface::ReportEnemies()
{
if (!m_me->IsAlive())
@ -1492,15 +1398,12 @@ void BotChatterInterface::ReportEnemies()
}
}
/* <305743> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1515 */
void BotChatterInterface::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
{
;
}
// Invoked when we die
/* <30579e> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1524 */
void BotChatterInterface::OnDeath()
{
if (IsTalking())
@ -1524,8 +1427,6 @@ void BotChatterInterface::OnDeath()
}
// Process ongoing chatter for this bot
/* <308852> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1549 */
void BotChatterInterface::Update()
{
// report enemy activity
@ -1605,8 +1506,6 @@ void BotChatterInterface::Update()
}
// Returns the statement that is being spoken, or is next to be spoken if no-one is speaking now
/* <305915> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1635 */
BotStatement *BotChatterInterface::GetActiveStatement()
{
// keep track of statement waiting longest to be spoken - it is next
@ -1664,8 +1563,6 @@ BotStatement *BotChatterInterface::GetActiveStatement()
}
// Return true if we speaking makes sense now
/* <305a35> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1694 */
bool BotChatterInterface::ShouldSpeak() const
{
// don't talk to non-existent friends
@ -1679,27 +1576,22 @@ bool BotChatterInterface::ShouldSpeak() const
return true;
}
/* <305a8f> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1708 */
float BotChatterInterface::GetRadioSilenceDuration()
{
return IMPL(m_radioSilenceInterval)[ m_me->m_iTeam - 1 ].GetElapsedTime();
}
/* <305b15> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1714 */
void BotChatterInterface::ResetRadioSilenceDuration()
{
IMPL(m_radioSilenceInterval)[m_me->m_iTeam - 1].Reset();
}
/* <305d7b> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1732 */
inline void SayWhere(BotStatement *say, Place place)
{
say->AppendPhrase(TheBotPhrases->GetPlace(place));
}
// Report enemy sightings
/* <305b50> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1740 */
void BotChatterInterface::EnemySpotted()
{
// NOTE: This could be a few seconds out of date (enemy is in an adjacent place)
@ -1718,7 +1610,6 @@ void BotChatterInterface::EnemySpotted()
AddStatement(say);
}
/* <305da4> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1759 */
NOXREF void BotChatterInterface::Clear(Place place)
{
BotStatement *say = new BotStatement(this, REPORT_INFORMATION, 10.0f);
@ -1729,8 +1620,6 @@ NOXREF void BotChatterInterface::Clear(Place place)
}
// Request enemy activity report
/* <305ffa> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1773 */
void BotChatterInterface::ReportIn()
{
BotStatement *say = new BotStatement(this, REPORT_REQUEST_INFORMATION, 10.0f);
@ -1742,11 +1631,8 @@ void BotChatterInterface::ReportIn()
}
// Report our situtation
/* <309851> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1788 */
void BotChatterInterface::ReportingIn()
{
CCSBotManager *ctrl = TheCSBots();
BotStatement *say = new BotStatement(this, REPORT_INFORMATION, 10.0f);
// where are we
@ -1768,10 +1654,10 @@ void BotChatterInterface::ReportingIn()
}
case CCSBot::GUARD_LOOSE_BOMB:
{
if (ctrl->GetLooseBomb())
if (TheCSBots()->GetLooseBomb())
{
say->AppendPhrase(TheBotPhrases->GetPhrase("GuardingLooseBomb"));
say->AttachMeme(new BotBombStatusMeme(CSGameState::LOOSE, ctrl->GetLooseBomb()->pev->origin));
say->AttachMeme(new BotBombStatusMeme(CSGameState::LOOSE, TheCSBots()->GetLooseBomb()->pev->origin));
}
break;
}
@ -1841,7 +1727,6 @@ void BotChatterInterface::ReportingIn()
AddStatement(say);
}
/* <3084cf> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1896 */
bool BotChatterInterface::NeedBackup()
{
const float minRequestInterval = 10.0f;
@ -1873,7 +1758,6 @@ bool BotChatterInterface::NeedBackup()
return true;
}
/* <3061a8> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1929 */
void BotChatterInterface::PinnedDown()
{
// this is a form of "need backup"
@ -1896,7 +1780,6 @@ void BotChatterInterface::PinnedDown()
AddStatement(say);
}
/* <3064e2> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1952 */
void BotChatterInterface::HeardNoise(const Vector *pos)
{
if (TheCSBots()->IsRoundOver())
@ -1920,7 +1803,6 @@ void BotChatterInterface::HeardNoise(const Vector *pos)
}
}
/* <3066a7> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1978 */
void BotChatterInterface::KilledMyEnemy(int victimID)
{
// only report if we killed the last enemy in the area
@ -1933,7 +1815,6 @@ void BotChatterInterface::KilledMyEnemy(int victimID)
AddStatement(say);
}
/* <306853> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1993 */
void BotChatterInterface::EnemiesRemaining()
{
// only report if we killed the last enemy in the area
@ -1946,7 +1827,6 @@ void BotChatterInterface::EnemiesRemaining()
AddStatement(say);
}
/* <306974> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2008 */
void BotChatterInterface::Affirmative()
{
BotStatement *say = new BotStatement(this, REPORT_ACKNOWLEDGE, 3.0f);
@ -1954,7 +1834,6 @@ void BotChatterInterface::Affirmative()
AddStatement(say);
}
/* <306bb2> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2018 */
void BotChatterInterface::Negative()
{
BotStatement *say = new BotStatement(this, REPORT_ACKNOWLEDGE, 3.0f);
@ -1962,7 +1841,6 @@ void BotChatterInterface::Negative()
AddStatement(say);
}
/* <306cf4> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2028 */
void BotChatterInterface::GoingToPlantTheBomb(Place place)
{
if (TheCSBots()->IsRoundOver())
@ -1981,7 +1859,6 @@ void BotChatterInterface::GoingToPlantTheBomb(Place place)
AddStatement(say);
}
/* <306ef6> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2050 */
void BotChatterInterface::PlantingTheBomb(Place place)
{
if (TheCSBots()->IsRoundOver())
@ -1994,7 +1871,6 @@ void BotChatterInterface::PlantingTheBomb(Place place)
AddStatement(say);
}
/* <3070c8> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2066 */
void BotChatterInterface::TheyPickedUpTheBomb()
{
if (TheCSBots()->IsRoundOver())
@ -2014,7 +1890,6 @@ void BotChatterInterface::TheyPickedUpTheBomb()
AddStatement(say);
}
/* <307272> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2090 */
void BotChatterInterface::SpottedBomber(CBasePlayer *bomber)
{
if (m_me->GetGameState()->IsBombMoving())
@ -2044,7 +1919,6 @@ void BotChatterInterface::SpottedBomber(CBasePlayer *bomber)
AddStatement(say);
}
/* <30761a> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2122 */
void BotChatterInterface::SpottedLooseBomb(CBaseEntity *bomb)
{
if (TheCSBots()->IsRoundOver())
@ -2078,7 +1952,6 @@ void BotChatterInterface::SpottedLooseBomb(CBaseEntity *bomb)
}
}
/* <30795b> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2157 */
NOXREF void BotChatterInterface::GuardingLooseBomb(CBaseEntity *bomb)
{
if (TheCSBots()->IsRoundOver() || !bomb)
@ -2090,7 +1963,7 @@ NOXREF void BotChatterInterface::GuardingLooseBomb(CBaseEntity *bomb)
return;
m_planInterval.Reset();
#endif // REGAMEDLL_FIXES
#endif
// update our gamestate
m_me->GetGameState()->UpdateLooseBomb(&bomb->pev->origin);
@ -2110,7 +1983,6 @@ NOXREF void BotChatterInterface::GuardingLooseBomb(CBaseEntity *bomb)
AddStatement(say);
}
/* <307c56> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2186 */
void BotChatterInterface::RequestBombLocation()
{
// only ask once per round
@ -2126,7 +1998,6 @@ void BotChatterInterface::RequestBombLocation()
AddStatement(say);
}
/* <307de2> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2205 */
void BotChatterInterface::BombsiteClear(int zoneIndex)
{
const CCSBotManager::Zone *zone = TheCSBots()->GetZone(zoneIndex);
@ -2141,7 +2012,6 @@ void BotChatterInterface::BombsiteClear(int zoneIndex)
AddStatement(say);
}
/* <3080b8> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2223 */
void BotChatterInterface::FoundPlantedBomb(int zoneIndex)
{
const CCSBotManager::Zone *zone = TheCSBots()->GetZone(zoneIndex);
@ -2155,7 +2025,6 @@ void BotChatterInterface::FoundPlantedBomb(int zoneIndex)
AddStatement(say);
}
/* <308308> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2242 */
void BotChatterInterface::Scared()
{
const float minInterval = 10.0f;
@ -2170,7 +2039,6 @@ void BotChatterInterface::Scared()
AddStatement(say);
}
/* <308b60> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2259 */
void BotChatterInterface::CelebrateWin()
{
BotStatement *say = new BotStatement(this, REPORT_EMOTE, 15.0f);
@ -2179,19 +2047,18 @@ void BotChatterInterface::CelebrateWin()
say->SetStartTime(gpGlobals->time + RANDOM_FLOAT(2.0f, 5.0f));
const float quickRound = 45.0f;
CCSBotManager *ctrl = TheCSBots();
if (m_me->GetFriendsRemaining() == 0)
{
// we were the last man standing
if (ctrl->GetElapsedRoundTime() < quickRound)
if (TheCSBots()->GetElapsedRoundTime() < quickRound)
say->AppendPhrase(TheBotPhrases->GetPhrase("WonRoundQuickly"));
else if (RANDOM_FLOAT(0.0f, 100.0f) < 33.3f)
say->AppendPhrase(TheBotPhrases->GetPhrase("LastManStanding"));
}
else
{
if (ctrl->GetElapsedRoundTime() < quickRound)
if (TheCSBots()->GetElapsedRoundTime() < quickRound)
{
if (RANDOM_FLOAT(0.0f, 100.0f) < 33.3f)
say->AppendPhrase(TheBotPhrases->GetPhrase("WonRoundQuickly"));
@ -2205,11 +2072,9 @@ void BotChatterInterface::CelebrateWin()
AddStatement(say);
}
/* <308e52> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2294 */
void BotChatterInterface::AnnouncePlan(const char *phraseName, Place place)
{
CCSBotManager *ctrl = TheCSBots();
if (ctrl->IsRoundOver())
if (TheCSBots()->IsRoundOver())
return;
BotStatement *say = new BotStatement(this, REPORT_MY_PLAN, 10.0f);
@ -2217,11 +2082,10 @@ void BotChatterInterface::AnnouncePlan(const char *phraseName, Place place)
say->SetPlace(place);
// wait at least a short time after round start
say->SetStartTime(ctrl->GetRoundStartTime() + RANDOM_FLOAT(2.0, 3.0f));
say->SetStartTime(TheCSBots()->GetRoundStartTime() + RANDOM_FLOAT(2.0, 3.0f));
AddStatement(say);
}
/* <308fdd> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2312 */
void BotChatterInterface::GuardingHostages(Place place, bool isPlan)
{
if (TheCSBots()->IsRoundOver())
@ -2233,7 +2097,7 @@ void BotChatterInterface::GuardingHostages(Place place, bool isPlan)
#ifdef REGAMEDLL_FIXES
m_planInterval.Reset();
#endif // REGAMEDLL_FIXES
#endif
if (isPlan)
AnnouncePlan("GoingToGuardHostages", place);
@ -2241,7 +2105,6 @@ void BotChatterInterface::GuardingHostages(Place place, bool isPlan)
Say("GuardingHostages");
}
/* <3091eb> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2329 */
void BotChatterInterface::GuardingHostageEscapeZone(bool isPlan)
{
if (TheCSBots()->IsRoundOver())
@ -2253,7 +2116,7 @@ void BotChatterInterface::GuardingHostageEscapeZone(bool isPlan)
#ifdef REGAMEDLL_FIXES
m_planInterval.Reset();
#endif // REGAMEDLL_FIXES
#endif
if (isPlan)
AnnouncePlan("GoingToGuardHostageEscapeZone", UNDEFINED_PLACE);
@ -2261,7 +2124,6 @@ void BotChatterInterface::GuardingHostageEscapeZone(bool isPlan)
Say("GuardingHostageEscapeZone");
}
/* <3093a9> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2346 */
void BotChatterInterface::HostagesBeingTaken()
{
if (TheCSBots()->IsRoundOver())
@ -2273,7 +2135,6 @@ void BotChatterInterface::HostagesBeingTaken()
AddStatement(say);
}
/* <309542> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2361 */
void BotChatterInterface::HostagesTaken()
{
if (TheCSBots()->IsRoundOver())
@ -2284,13 +2145,11 @@ void BotChatterInterface::HostagesTaken()
AddStatement(say);
}
/* <309691> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2375 */
void BotChatterInterface::TalkingToHostages()
{
;
}
/* <3096bc> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2380 */
void BotChatterInterface::EscortingHostages()
{
if (TheCSBots()->IsRoundOver())
@ -2307,7 +2166,6 @@ void BotChatterInterface::EscortingHostages()
}
}
/* <30a5b9> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2400 */
NOXREF void BotChatterInterface::HostageDown()
{
if (TheCSBots()->IsRoundOver())
@ -2318,7 +2176,6 @@ NOXREF void BotChatterInterface::HostageDown()
AddStatement(say);
}
/* <30a708> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2414 */
void BotChatterInterface::Encourage(const char *phraseName, float repeatInterval, float lifetime)
{
if (IMPL(m_encourageTimer).IsElapsed())
@ -2328,7 +2185,6 @@ void BotChatterInterface::Encourage(const char *phraseName, float repeatInterval
}
}
/* <30a905> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2427 */
void BotChatterInterface::KilledFriend()
{
BotStatement *say = new BotStatement(this, REPORT_KILLED_FRIEND, 2.0f);
@ -2339,7 +2195,6 @@ void BotChatterInterface::KilledFriend()
AddStatement(say);
}
/* <30aa67> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2440 */
void BotChatterInterface::FriendlyFire()
{
BotStatement *say = new BotStatement(this, REPORT_FRIENDLY_FIRE, 1.0f);

View File

@ -45,8 +45,6 @@ typedef unsigned int CountCriteria;
// A meme is a unit information that bots use to
// transmit information to each other via the radio
/* <2fe97b> ../cstrike/dlls/bot/cs_bot_chatter.h:42 */
class BotMeme
{
public:
@ -63,7 +61,7 @@ public:
void Interpret_(CCSBot *sender, CCSBot *receiver) const;
#endif // HOOK_GAMEDLL
#endif
};
@ -76,11 +74,10 @@ public:
void Interpret_(CCSBot *sender, CCSBot *receiver) const;
#endif // HOOK_GAMEDLL
#endif
};
/* <2ff7ef> ../cstrike/dlls/bot/cs_bot_chatter.h:53 */
class BotHelpMeme: public BotMeme
{
public:
@ -94,13 +91,12 @@ public:
void Interpret_(CCSBot *sender, CCSBot *receiver) const;
#endif // HOOK_GAMEDLL
#endif
private:
Place m_place;
};
/* <2ff65e> ../cstrike/dlls/bot/cs_bot_chatter.h:70 */
class BotBombsiteStatusMeme: public BotMeme
{
public:
@ -117,14 +113,13 @@ public:
void Interpret_(CCSBot *sender, CCSBot *receiver) const;
#endif // HOOK_GAMEDLL
#endif
private:
int m_zoneIndex; // the bombsite
StatusType m_status; // whether it is cleared or the bomb is there (planted)
};
/* <2ff6de> ../cstrike/dlls/bot/cs_bot_chatter.h:87 */
class BotBombStatusMeme: public BotMeme
{
public:
@ -141,14 +136,13 @@ public:
void Interpret_(CCSBot *sender, CCSBot *receiver) const;
#endif // HOOK_GAMEDLL
#endif
private:
CSGameState::BombState m_state;
Vector m_pos;
};
/* <2ff75d> ../cstrike/dlls/bot/cs_bot_chatter.h:101 */
class BotFollowMeme: public BotMeme
{
public:
@ -158,10 +152,9 @@ public:
void Interpret_(CCSBot *sender, CCSBot *receiver) const;
#endif // HOOK_GAMEDLL
#endif
};
/* <2ff731> ../cstrike/dlls/bot/cs_bot_chatter.h:111 */
class BotDefendHereMeme: public BotMeme
{
public:
@ -175,13 +168,12 @@ public:
void Interpret_(CCSBot *sender, CCSBot *receiver) const;
#endif // HOOK_GAMEDLL
#endif
private:
Vector m_pos;
};
/* <2ff696> ../cstrike/dlls/bot/cs_bot_chatter.h:123 */
class BotWhereBombMeme: public BotMeme
{
public:
@ -191,10 +183,9 @@ public:
void Interpret_(CCSBot *sender, CCSBot *receiver) const;
#endif // HOOK_GAMEDLL
#endif
};
/* <2ff81b> ../cstrike/dlls/bot/cs_bot_chatter.h:130 */
class BotRequestReportMeme: public BotMeme
{
public:
@ -204,7 +195,7 @@ public:
void Interpret_(CCSBot *sender, CCSBot *receiver) const;
#endif // HOOK_GAMEDLL
#endif
};
@ -268,7 +259,7 @@ public:
#ifndef HOOK_GAMEDLL
private:
#endif // HOOK_GAMEDLL
#endif
friend class BotPhraseManager;
BotPhrase(unsigned int id, bool isPlace);
@ -292,20 +283,17 @@ private:
typedef std::STD_LIST<BotPhrase *> BotPhraseList;
/* <2fea0e> ../cstrike/dlls/bot/cs_bot_chatter.h:239 */
inline void BotPhrase::ClearCriteria() const
{
m_placeCriteria = ANY_PLACE;
m_countCriteria = UNDEFINED_COUNT;
}
/* <2fea2a> ../cstrike/dlls/bot/cs_bot_chatter.h:245 */
inline void BotPhrase::SetPlaceCriteria(PlaceCriteria place) const
{
m_placeCriteria = place;
}
/* <2fea52> ../cstrike/dlls/bot/cs_bot_chatter.h:250 */
inline void BotPhrase::SetCountCriteria(CountCriteria count) const
{
m_countCriteria = count;
@ -348,7 +336,7 @@ public:
#ifndef HOOK_GAMEDLL
private:
#endif // HOOK_GAMEDLL
#endif
int FindPlaceIndex(Place where) const;
@ -364,11 +352,10 @@ private:
IntervalTimer timer;
};
mutable PlaceTimeInfo m_placeStatementHistory[ MAX_PLACES_PER_MAP ];
mutable PlaceTimeInfo m_placeStatementHistory[MAX_PLACES_PER_MAP];
mutable int m_placeCount;
};
/* <2fea95> ../cstrike/dlls/bot/cs_bot_chatter.h:298 */
inline int BotPhraseManager::FindPlaceIndex(Place where) const
{
for (int i = 0; i < m_placeCount; ++i)
@ -387,7 +374,6 @@ inline int BotPhraseManager::FindPlaceIndex(Place where) const
return -1;
}
/* <2ff83d> ../cstrike/dlls/bot/cs_bot_chatter.h:319 */
inline float BotPhraseManager::GetPlaceStatementInterval(Place place) const
{
int index = FindPlaceIndex(place);
@ -398,10 +384,9 @@ inline float BotPhraseManager::GetPlaceStatementInterval(Place place) const
if (index >= m_placeCount)
return 999999.9f;
return m_placeStatementHistory[ index ].timer.GetElapsedTime();
return m_placeStatementHistory[index].timer.GetElapsedTime();
}
/* <2ff876> ../cstrike/dlls/bot/cs_bot_chatter.h:335 */
inline void BotPhraseManager::ResetPlaceStatementInterval(Place place) const
{
int index = FindPlaceIndex(place);
@ -506,10 +491,10 @@ public:
};
}
m_statement[ MAX_BOT_PHRASES ];
m_statement[MAX_BOT_PHRASES];
enum { MAX_BOT_CONDITIONS = 4 };
ConditionType m_condition[ MAX_BOT_CONDITIONS ]; // conditions that must be true for the statement to be said
ConditionType m_condition[MAX_BOT_CONDITIONS]; // conditions that must be true for the statement to be said
int m_conditionCount;
int m_index; // m_index refers to the phrase currently being spoken, or -1 if we havent started yet
@ -565,7 +550,7 @@ public:
void KilledMyEnemy(int victimID);
void EnemiesRemaining();
NOXREF void Clear(Place place);
void Clear(Place place);
void ReportIn(); // ask for current situation
void ReportingIn(); // report current situation
@ -582,7 +567,7 @@ public:
void PlantingTheBomb(Place place);
void SpottedBomber(CBasePlayer *bomber);
void SpottedLooseBomb(CBaseEntity *bomb);
NOXREF void GuardingLooseBomb(CBaseEntity *bomb);
void GuardingLooseBomb(CBaseEntity *bomb);
void RequestBombLocation();
#define IS_PLAN true
@ -592,7 +577,7 @@ public:
void HostagesTaken();
void TalkingToHostages();
void EscortingHostages();
NOXREF void HostageDown();
void HostageDown();
void CelebrateWin();
@ -605,7 +590,7 @@ public:
#ifndef HOOK_GAMEDLL
private:
#endif // HOOK_GAMEDLL
#endif
BotStatement *m_statementList; // list of all active/pending messages for this bot
void ReportEnemies(); // track nearby enemy count and generate enemy activity statements
@ -632,7 +617,6 @@ private:
static CountdownTimer IMPL(m_encourageTimer); // timer to know when we can "encourage" the human player again - shared by all bots
};
/* <2fec2d> ../cstrike/dlls/bot/cs_bot_chatter.h:572 */
inline BotChatterInterface::VerbosityType BotChatterInterface::GetVerbosity() const
{
const char *string = cv_bot_chatter.string;
@ -652,7 +636,6 @@ inline BotChatterInterface::VerbosityType BotChatterInterface::GetVerbosity() co
return NORMAL;
}
/* <2fec4a> ../cstrike/dlls/bot/cs_bot_chatter.h:590 */
inline bool BotChatterInterface::IsTalking() const
{
if (m_statementList != NULL)
@ -663,7 +646,6 @@ inline bool BotChatterInterface::IsTalking() const
return false;
}
/* <3f2bad> ../cstrike/dlls/bot/cs_bot_chatter.h:596 */
inline BotStatement *BotChatterInterface::GetStatement() const
{
return m_statementList;
@ -672,7 +654,6 @@ inline BotStatement *BotChatterInterface::GetStatement() const
extern BotPhraseManager *TheBotPhrases;
extern CBaseEntity *g_pSelectedZombieSpawn;
/* <5c4dcf> ../cstrike/dlls/bot/cs_bot_chatter.h:604 */
inline void BotChatterInterface::Say(const char *phraseName, float lifetime, float delay)
{
BotStatement *say = new BotStatement(this, REPORT_MY_INTENTION, lifetime);

View File

@ -1,6 +1,5 @@
#include "precompiled.h"
/* <31d087> ../cstrike/dlls/bot/cs_bot_event.cpp:22 */
void CCSBot::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
{
GetGameState()->OnEvent(event, entity, other);
@ -47,7 +46,7 @@ void CCSBot::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *entity, CBa
CBasePlayer *killer = static_cast<CBasePlayer *>(other);
// check that attacker is an enemy (for friendly fire, etc)
if (killer && killer->IsPlayer())
if (killer != NULL && killer->IsPlayer())
{
// check if we saw our friend die - dont check FOV - assume we're aware of our surroundings in combat
// snipers stay put
@ -75,10 +74,10 @@ void CCSBot::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *entity, CBa
case EVENT_PLAYER_DIED:
{
CBasePlayer *victim = player;
CBasePlayer *killer = (other && other->IsPlayer()) ? static_cast<CBasePlayer *>(other) : NULL;
CBasePlayer *killer = (other != NULL && other->IsPlayer()) ? static_cast<CBasePlayer *>(other) : NULL;
// if the human player died in the single player game, tell the team
if (g_pGameRules->IsCareer() && !victim->IsBot() && victim->m_iTeam == m_iTeam)
if (CSGameRules()->IsCareer() && !victim->IsBot() && victim->m_iTeam == m_iTeam)
{
GetChatter()->Say("CommanderDown", 20.0f);
}
@ -136,7 +135,7 @@ void CCSBot::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *entity, CBa
if (IsVisible(&victim->pev->origin, CHECK_FOV))
{
// congratulate teammates on their kills
if (killer != NULL && killer != this)
if (killer != this)
{
float delay = RANDOM_FLOAT(2.0f, 3.0f);
if (killer->IsBot())
@ -147,7 +146,7 @@ void CCSBot::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *entity, CBa
else
{
// humans get the honorific
if (g_pGameRules->IsCareer())
if (CSGameRules()->IsCareer())
GetChatter()->Say("NiceShotCommander", 3.0f, delay);
else
GetChatter()->Say("NiceShotSir", 3.0f, delay);

View File

@ -35,9 +35,8 @@ cvar_t cv_bot_defer_to_human = { "bot_defer_to_human", "0", FCVAR_SERVER, 0.0f,
cvar_t cv_bot_chatter = { "bot_chatter", "normal", FCVAR_SERVER, 0.0f, NULL };
cvar_t cv_bot_profile_db = { "bot_profile_db", "BotProfile.db", FCVAR_SERVER, 0.0f, NULL };
#endif // HOOK_GAMEDLL
#endif
/* <333bca> ../cstrike/dlls/bot/cs_bot_init.cpp:57 */
void InstallBotControl()
{
if (TheBots != NULL)
@ -49,8 +48,6 @@ void InstallBotControl()
}
// Engine callback for custom server commands
/* <333cb3> ../cstrike/dlls/bot/cs_bot_init.cpp:68 */
void Bot_ServerCommand()
{
if (TheBots != NULL)
@ -60,10 +57,9 @@ void Bot_ServerCommand()
}
}
/* <333cec> ../cstrike/dlls/bot/cs_bot_init.cpp:81 */
void Bot_RegisterCvars()
{
if (!g_bIsCzeroGame)
if (!AreBotsAllowed())
return;
CVAR_REGISTER(&cv_bot_traceview);
@ -98,16 +94,12 @@ void Bot_RegisterCvars()
}
// Constructor
/* <333d1e> ../cstrike/dlls/bot/cs_bot_init.cpp:129 */
CCSBot::CCSBot() : m_chatter(this), m_gameState(this)
{
;
}
// Prepare bot for action
/* <3342ac> ../cstrike/dlls/bot/cs_bot_init.cpp:137 */
bool CCSBot::__MAKE_VHOOK(Initialize)(const BotProfile *profile)
{
// extend
@ -134,8 +126,6 @@ bool CCSBot::__MAKE_VHOOK(Initialize)(const BotProfile *profile)
}
// Reset internal data to initial state
/* <3341dc> ../cstrike/dlls/bot/cs_bot_init.cpp:167 */
void CCSBot::ResetValues()
{
m_chatter.Reset();
@ -282,7 +272,7 @@ void CCSBot::ResetValues()
m_enemyQueue[i].isReloading = false;
m_enemyQueue[i].isProtectedByShield = false;
}
#endif // REGAMEDLL_FIXES
#endif
// start in idle state
StopAttacking();
@ -291,13 +281,9 @@ void CCSBot::ResetValues()
// Called when bot is placed in map, and when bots are reset after a round ends.
// NOTE: For some reason, this can be called twice when a bot is added.
/* <3342e4> ../cstrike/dlls/bot/cs_bot_init.cpp:336 */
void CCSBot::__MAKE_VHOOK(SpawnBot)()
{
CCSBotManager *ctrl = TheCSBots();
ctrl->ValidateMapData();
TheCSBots()->ValidateMapData();
ResetValues();
Q_strcpy(m_name, STRING(pev->netname));
@ -305,14 +291,13 @@ void CCSBot::__MAKE_VHOOK(SpawnBot)()
SetState(&m_buyState);
SetTouch(&CCSBot::BotTouch);
if (TheNavAreaList.empty() && !ctrl->IsLearningMap())
if (TheNavAreaList.empty() && !TheCSBots()->IsLearningMap())
{
ctrl->SetLearningMapFlag();
TheCSBots()->SetLearningMapFlag();
StartLearnProcess();
}
}
/* <3338f7> ../cstrike/dlls/bot/cs_bot_init.cpp:366 */
void CCSBot::__MAKE_VHOOK(RoundRespawn)()
{
// do the normal player spawn process
@ -320,7 +305,6 @@ void CCSBot::__MAKE_VHOOK(RoundRespawn)()
EndVoiceFeedback();
}
/* <334332> ../cstrike/dlls/bot/cs_bot_init.cpp:378 */
void CCSBot::Disconnect()
{
EndVoiceFeedback();

View File

@ -5,14 +5,12 @@ const float updateTimesliceDuration = 0.5f;
int _navAreaCount = 0;
int _currentIndex = 0;
/* <343cbe> ../cstrike/dlls/bot/cs_bot_learn.cpp:95 */
inline CNavNode *LadderEndSearch(CBaseEntity *entity, const Vector *pos, NavDirType mountDir)
{
Vector center = *pos;
AddDirectionVector(&center, mountDir, HalfHumanWidth);
// Test the ladder dismount point first, then each cardinal direction one and two steps away
for (int d = (-1); d < 2 * NUM_DIRECTIONS; ++d)
{
Vector tryPos = center;
@ -36,13 +34,12 @@ inline CNavNode *LadderEndSearch(CBaseEntity *entity, const Vector *pos, NavDirT
TraceResult result;
UTIL_TraceLine(center + Vector(0, 0, fudge), tryPos + Vector(0, 0, fudge), ignore_monsters, dont_ignore_glass, ENT(entity->pev), &result);
#ifndef REGAMEDLL_FIXES
if (result.flFraction != 1.0f)
if (result.flFraction != 1.0f
#ifdef REGAMEDLL_FIXES
|| result.fStartSolid
#endif
)
continue;
#else
if (result.flFraction != 1.0f || result.fStartSolid)
continue;
#endif // REGAMEDLL_ADD
// if no node exists here, create one and continue the search
if (CNavNode::GetNode(&tryPos) == NULL)
@ -54,7 +51,6 @@ inline CNavNode *LadderEndSearch(CBaseEntity *entity, const Vector *pos, NavDirT
return NULL;
}
/* <343a56> ../cstrike/dlls/bot/cs_bot_learn.cpp:30 */
CNavNode *CCSBot::AddNode(const Vector *destPos, const Vector *normal, NavDirType dir, CNavNode *source)
{
// check if a node exists at this location
@ -73,7 +69,7 @@ CNavNode *CCSBot::AddNode(const Vector *destPos, const Vector *normal, NavDirTyp
// optimization: if deltaZ changes very little, assume connection is commutative
const float zTolerance = 10.0f; // 50.0f;
if (fabs(source->GetPosition()->z - destPos->z) < zTolerance)
if (Q_fabs(source->GetPosition()->z - destPos->z) < zTolerance)
{
node->ConnectTo(source, OppositeDirection(dir));
node->MarkAsVisited(OppositeDirection(dir));
@ -119,17 +115,15 @@ CNavNode *CCSBot::AddNode(const Vector *destPos, const Vector *normal, NavDirTyp
return node;
}
/* <343b40> ../cstrike/dlls/bot/cs_bot_learn.cpp:150 */
void drawProgressMeter(float progress, char *title)
{
MESSAGE_BEGIN(MSG_ALL, gmsgBotProgress);
WRITE_BYTE(FLAG_PROGRESS_DRAW);
WRITE_BYTE((int)progress);
WRITE_BYTE(int(progress * 100.0f));
WRITE_STRING(title);
MESSAGE_END();
}
/* <3435ce> ../cstrike/dlls/bot/cs_bot_learn.cpp:159 */
void startProgressMeter(const char *title)
{
MESSAGE_BEGIN(MSG_ALL, gmsgBotProgress);
@ -138,7 +132,6 @@ void startProgressMeter(const char *title)
MESSAGE_END();
}
/* <3435a8> ../cstrike/dlls/bot/cs_bot_learn.cpp:167 */
void hideProgressMeter()
{
MESSAGE_BEGIN(MSG_ALL, gmsgBotProgress);
@ -146,7 +139,6 @@ void hideProgressMeter()
MESSAGE_END();
}
/* <343b63> ../cstrike/dlls/bot/cs_bot_learn.cpp:182 */
void CCSBot::StartLearnProcess()
{
startProgressMeter("#CZero_LearningMap");
@ -176,8 +168,6 @@ void CCSBot::StartLearnProcess()
// outwards, tracking all valid steps and generating a directed graph of CNavNodes.
// Sample the map one "step" in a cardinal direction to learn the map.
// Returns true if sampling needs to continue, or false if done.
/* <343d37> ../cstrike/dlls/bot/cs_bot_learn.cpp:217 */
bool CCSBot::LearnStep()
{
// take a step
@ -338,7 +328,7 @@ bool CCSBot::LearnStep()
{
walkable = false;
}
#endif // REGAMEDLL_FIXES
#endif
if (walkable)
{
// we can move here
@ -355,7 +345,6 @@ bool CCSBot::LearnStep()
}
}
/* <34489e> ../cstrike/dlls/bot/cs_bot_learn.cpp:392 */
void CCSBot::UpdateLearnProcess()
{
float startTime = g_engfuncs.pfnTime();
@ -369,7 +358,6 @@ void CCSBot::UpdateLearnProcess()
}
}
/* <344750> ../cstrike/dlls/bot/cs_bot_learn.cpp:409 */
void CCSBot::StartAnalyzeAlphaProcess()
{
m_processMode = PROCESS_ANALYZE_ALPHA;
@ -385,7 +373,6 @@ void CCSBot::StartAnalyzeAlphaProcess()
drawProgressMeter(0, "#CZero_AnalyzingHidingSpots");
}
/* <34396c> ../cstrike/dlls/bot/cs_bot_learn.cpp:427 */
bool CCSBot::AnalyzeAlphaStep()
{
++_currentIndex;
@ -400,7 +387,6 @@ bool CCSBot::AnalyzeAlphaStep()
return true;
}
/* <3448de> ../cstrike/dlls/bot/cs_bot_learn.cpp:443 */
void CCSBot::UpdateAnalyzeAlphaProcess()
{
float startTime = g_engfuncs.pfnTime();
@ -408,18 +394,17 @@ void CCSBot::UpdateAnalyzeAlphaProcess()
{
if (AnalyzeAlphaStep() == false)
{
drawProgressMeter(50, "#CZero_AnalyzingHidingSpots");
drawProgressMeter(0.5f, "#CZero_AnalyzingHidingSpots");
CleanupApproachAreaAnalysisPrep();
StartAnalyzeBetaProcess();
return;
}
}
float progress = _currentIndex / _navAreaCount * 50.0f;
float progress = (double(_currentIndex) / double(_navAreaCount)) * 0.5f;
drawProgressMeter(progress, "#CZero_AnalyzingHidingSpots");
}
/* <344aed> ../cstrike/dlls/bot/cs_bot_learn.cpp:467 */
void CCSBot::StartAnalyzeBetaProcess()
{
m_processMode = PROCESS_ANALYZE_BETA;
@ -429,7 +414,6 @@ void CCSBot::StartAnalyzeBetaProcess()
_currentIndex = 0;
}
/* <3437c8> ../cstrike/dlls/bot/cs_bot_learn.cpp:479 */
bool CCSBot::AnalyzeBetaStep()
{
++_currentIndex;
@ -444,7 +428,6 @@ bool CCSBot::AnalyzeBetaStep()
return true;
}
/* <344b8d> ../cstrike/dlls/bot/cs_bot_learn.cpp:495 */
void CCSBot::UpdateAnalyzeBetaProcess()
{
float startTime = g_engfuncs.pfnTime();
@ -452,23 +435,21 @@ void CCSBot::UpdateAnalyzeBetaProcess()
{
if (AnalyzeBetaStep() == false)
{
drawProgressMeter(100, "#CZero_AnalyzingApproachPoints");
drawProgressMeter(1, "#CZero_AnalyzingApproachPoints");
StartSaveProcess();
return;
}
}
float progress = ((_currentIndex / _navAreaCount) + 1.0f) * 50.0f;
float progress = (double(_currentIndex) / double(_navAreaCount) + 1.0f) * 0.5f;
drawProgressMeter(progress, "#CZero_AnalyzingApproachPoints");
}
/* <344d1f> ../cstrike/dlls/bot/cs_bot_learn.cpp:517 */
void CCSBot::StartSaveProcess()
{
m_processMode = PROCESS_SAVE;
}
/* <344d41> ../cstrike/dlls/bot/cs_bot_learn.cpp:527 */
void CCSBot::UpdateSaveProcess()
{
char filename[256];
@ -489,11 +470,15 @@ void CCSBot::UpdateSaveProcess()
hideProgressMeter();
StartNormalProcess();
#ifndef REGAMEDLL_FIXES
Q_sprintf(cmd, "map %s\n", STRING(gpGlobals->mapname));
#else
Q_sprintf(cmd, "changelevel %s\n", STRING(gpGlobals->mapname));
#endif
SERVER_COMMAND(cmd);
}
/* <344e24> ../cstrike/dlls/bot/cs_bot_learn.cpp:554 */
void CCSBot::StartNormalProcess()
{
m_processMode = PROCESS_NORMAL;

View File

@ -2,8 +2,6 @@
// Listen for enemy noises, and determine if we should react to them.
// Returns true if heard a noise and should move to investigate.
/* <354545> ../cstrike/dlls/bot/cs_bot_listen.cpp:17 */
bool CCSBot::ShouldInvestigateNoise(float *retNoiseDist)
{
if (m_isNoiseTravelRangeChecked)
@ -25,7 +23,7 @@ bool CCSBot::ShouldInvestigateNoise(float *retNoiseDist)
float noiseDist = toNoise.Length();
float const oneStoreyHeight = 120.0f;
if (abs(int64(toNoise.z)) > oneStoreyHeight)
if (Q_abs(int64(toNoise.z)) > oneStoreyHeight)
{
PathCost pc(this);
float travelDistToNoise = NavAreaTravelDistance(m_lastKnownArea, m_noiseArea, pc);
@ -72,8 +70,6 @@ bool CCSBot::ShouldInvestigateNoise(float *retNoiseDist)
// Return true if we hear nearby threatening enemy gunfire within given range
// -1 == infinite range
/* <354c8d> ../cstrike/dlls/bot/cs_bot_listen.cpp:104 */
bool CCSBot::CanHearNearbyEnemyGunfire(float range) const
{
// only attend to noise if it just happened
@ -108,8 +104,6 @@ bool CCSBot::CanHearNearbyEnemyGunfire(float range) const
// Return true if we directly see where we think the noise came from
// NOTE: Dont check FOV, since this is used to determine if we should turn our head to look at the noise
// NOTE: Dont use IsVisible(), because smoke shouldnt cause us to not look toward noises
/* <354e7b> ../cstrike/dlls/bot/cs_bot_listen.cpp:141 */
bool CCSBot::CanSeeNoisePosition() const
{
TraceResult result;
@ -126,8 +120,6 @@ bool CCSBot::CanSeeNoisePosition() const
// Return true if we decided to look towards the most recent noise source
// Assumes m_noisePosition is valid.
/* <354f48> ../cstrike/dlls/bot/cs_bot_listen.cpp:160 */
bool CCSBot::UpdateLookAtNoise()
{
// make sure a noise exists

View File

@ -13,23 +13,8 @@ bool CCSBotManager::m_isLearningMap = false;
bool CCSBotManager::m_isAnalysisRequested = false;
NavEditCmdType CCSBotManager::m_editCmd = EDIT_NONE;
#endif // HOOK_GAMEDLL
#endif
// Determine whether bots can be used or not
inline bool AreBotsAllowed()
{
// If they pass in -nobots, don't allow bots. This is for people who host servers, to
// allow them to disallow bots to enforce CPU limits.
int nobots = ENG_CHECK_PARM("-nobots", NULL);
if (nobots)
{
return false;
}
return true;
}
/* <36b3b4> ../cstrike/dlls/bot/cs_bot_manager.cpp:45 */
CCSBotManager::CCSBotManager()
{
IMPL(m_flNextCVarCheck) = 0.0f;
@ -44,7 +29,7 @@ CCSBotManager::CCSBotManager()
IMPL(m_isAnalysisRequested) = false;
IMPL(m_editCmd) = EDIT_NONE;
m_navPlace = false;
m_navPlace = 0;
m_roundStartTimestamp = 0.0f;
m_bServerActive = false;
@ -102,8 +87,6 @@ CCSBotManager::CCSBotManager()
}
// Invoked when a new round begins
/* <36b22a> ../cstrike/dlls/bot/cs_bot_manager.cpp:111 */
void CCSBotManager::__MAKE_VHOOK(RestartRound)()
{
// extend
@ -133,7 +116,6 @@ void CCSBotManager::__MAKE_VHOOK(RestartRound)()
m_canRespawn = true;
}
/* <36aebc> ../cstrike/dlls/bot/cs_bot_manager.cpp:142 */
void UTIL_DrawBox(Extent *extent, int lifetime, int red, int green, int blue)
{
Vector v[8];
@ -187,7 +169,6 @@ void UTIL_DrawBox(Extent *extent, int lifetime, int red, int green, int blue)
// Called each frame
/* <36b13d> ../cstrike/dlls/bot/cs_bot_manager.cpp:195 */
void CCSBotManager::__MAKE_VHOOK(StartFrame)()
{
// EXTEND
@ -206,8 +187,6 @@ void CCSBotManager::__MAKE_VHOOK(StartFrame)()
}
// Return true if the bot can use this weapon
/* <36b62a> ../cstrike/dlls/bot/cs_bot_manager.cpp:276 */
bool CCSBotManager::IsWeaponUseable(CBasePlayerItem *item) const
{
if (item == NULL)
@ -226,7 +205,7 @@ bool CCSBotManager::IsWeaponUseable(CBasePlayerItem *item) const
#ifndef REGAMEDLL_FIXES
// TODO: already is checked shotguns!
|| (!AllowShotguns() && weaponClass == WEAPONCLASS_SHOTGUN)
#endif // REGAMEDLL_FIXES
#endif
|| (!AllowSnipers() && weaponClass == WEAPONCLASS_SNIPERRIFLE)
|| (!AllowSubMachineGuns() && weaponClass == WEAPONCLASS_SUBMACHINEGUN)
|| (!AllowTacticalShield() && item->m_iId == WEAPON_SHIELDGUN)
@ -240,8 +219,6 @@ bool CCSBotManager::IsWeaponUseable(CBasePlayerItem *item) const
}
// Return true if this player is on "defense"
/* <36b68c> ../cstrike/dlls/bot/cs_bot_manager.cpp:306 */
bool CCSBotManager::IsOnDefense(CBasePlayer *player) const
{
switch (GetScenario())
@ -260,16 +237,12 @@ bool CCSBotManager::IsOnDefense(CBasePlayer *player) const
}
// Return true if this player is on "offense"
/* <36b6b8> ../cstrike/dlls/bot/cs_bot_manager.cpp:327 */
bool CCSBotManager::IsOnOffense(CBasePlayer *player) const
{
return !IsOnDefense(player);
}
// Invoked when a map has just been loaded
/* <36a3b6> ../cstrike/dlls/bot/cs_bot_manager.cpp:331 */
void CCSBotManager::__MAKE_VHOOK(ServerActivate)()
{
DestroyNavigationMap();
@ -290,17 +263,11 @@ void CCSBotManager::__MAKE_VHOOK(ServerActivate)()
TheBotPhrases->OnMapChange();
}
/* <36afcd> ../cstrike/dlls/bot/cs_bot_manager.cpp:369 */
void CCSBotManager::__MAKE_VHOOK(AddServerCommand)(const char *cmd)
{
#if defined(HOOK_GAMEDLL) && !defined(REGAMEDLL_UNIT_TESTS)
ADD_SERVER_COMMAND((char *)cmd, (xcommand_t)GetOriginalFuncAddrOrDefault("_Z17Bot_ServerCommandv", (void *)Bot_ServerCommand));
#else
ADD_SERVER_COMMAND((char *)cmd, Bot_ServerCommand);
#endif // HOOK_GAMEDLL
}
/* <36b0e0> ../cstrike/dlls/bot/cs_bot_manager.cpp:375 */
void CCSBotManager::__MAKE_VHOOK(AddServerCommands)()
{
static bool fFirstTime = true;
@ -310,8 +277,9 @@ void CCSBotManager::__MAKE_VHOOK(AddServerCommands)()
fFirstTime = false;
if (g_bIsCzeroGame)
{
if (!AreBotsAllowed())
return;
AddServerCommand("bot_about");
AddServerCommand("bot_add");
AddServerCommand("bot_add_t");
@ -353,22 +321,19 @@ void CCSBotManager::__MAKE_VHOOK(AddServerCommands)()
AddServerCommand("bot_nav_corner_raise");
AddServerCommand("bot_nav_corner_lower");
AddServerCommand("bot_nav_check_consistency");
}
}
/* <36b2ac> ../cstrike/dlls/bot/cs_bot_manager.cpp:413 */
void CCSBotManager::__MAKE_VHOOK(ServerDeactivate)()
{
m_bServerActive = false;
}
/* <36b5fa> ../cstrike/dlls/bot/cs_bot_manager.cpp:415 */
void CCSBotManager::__MAKE_VHOOK(ClientDisconnect)(CBasePlayer *pPlayer)
{
if (pPlayer != NULL && pPlayer->IsBot())
{
entvars_t *temp = VARS(pPlayer->edict());
CCSBot *pBot = static_cast<CCSBot *>(pPlayer);
CCSBot *pBot = dynamic_cast<CCSBot *>(pPlayer);
if (pBot != NULL)
{
@ -388,7 +353,6 @@ void CCSBotManager::__MAKE_VHOOK(ClientDisconnect)(CBasePlayer *pPlayer)
}
}
/* <36b714> ../cstrike/dlls/bot/cs_bot_manager.cpp:464 */
void PrintAllEntities()
{
for (int i = 1; i < gpGlobals->maxEntities; ++i)
@ -402,10 +366,9 @@ void PrintAllEntities()
}
}
/* <36ace2> ../cstrike/dlls/bot/cs_bot_manager.cpp:484 */
void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd)
{
if (!m_bServerActive || !g_bIsCzeroGame)
if (!m_bServerActive || !AreBotsAllowed())
return;
char buffer[400];
@ -491,7 +454,7 @@ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd)
// adjust bot quota so kicked bot is not immediately added back in
int newQuota = cv_bot_quota.value - 1;
SERVER_COMMAND(UTIL_VarArgs("kick \"%s\"\n", name));
CVAR_SET_FLOAT("bot_quota", clamp(newQuota, 0, (int)cv_bot_quota.value));
CVAR_SET_FLOAT("bot_quota", clamp(newQuota, 0, int(cv_bot_quota.value)));
}
}
}
@ -633,10 +596,12 @@ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd)
const BotPhraseList *placeList = TheBotPhrases->GetPlaceList();
for (BotPhraseList::const_iterator iter = placeList->begin(); iter != placeList->end(); ++iter, ++i)
{
if ((*iter)->GetID() == GetNavPlace())
CONSOLE_ECHO("--> %-26s", (*iter)->GetName());
const BotPhrase *phrase = (*iter);
if (phrase->GetID() == GetNavPlace())
CONSOLE_ECHO("--> %-26s", phrase->GetName());
else
CONSOLE_ECHO("%-30s", (*iter)->GetName());
CONSOLE_ECHO("%-30s", phrase->GetName());
if (!(i % 3))
CONSOLE_ECHO("\n");
@ -651,12 +616,14 @@ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd)
bool isAmbiguous = false;
for (BotPhraseList::const_iterator iter = placeList->begin(); iter != placeList->end(); ++iter)
{
if (!Q_strnicmp((*iter)->GetName(), msg, Q_strlen(msg)))
const BotPhrase *phrase = (*iter);
if (!Q_strnicmp(phrase->GetName(), msg, Q_strlen(msg)))
{
// check for exact match in case of subsets of other strings
if (!Q_strcmp((*iter)->GetName(), msg))
if (!Q_strcmp(phrase->GetName(), msg))
{
found = (*iter);
found = phrase;
isAmbiguous = false;
break;
}
@ -667,7 +634,7 @@ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd)
}
else
{
found = (*iter);
found = phrase;
}
}
}
@ -790,7 +757,6 @@ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd)
}
}
/* <36b6e1> ../cstrike/dlls/bot/cs_bot_manager.cpp:896 */
BOOL CCSBotManager::__MAKE_VHOOK(ClientCommand)(CBasePlayer *pPlayer, const char *pcmd)
{
#ifndef REGAMEDLL_FIXES
@ -798,14 +764,12 @@ BOOL CCSBotManager::__MAKE_VHOOK(ClientCommand)(CBasePlayer *pPlayer, const char
{
UTIL_GetLocalPlayer();
}
#endif // REGAMEDLL_FIXES
#endif
return FALSE;
}
// Process the "bot_add" console command
/* <36c3c2> ../cstrike/dlls/bot/cs_bot_manager.cpp:903 */
bool CCSBotManager::BotAddCommand(BotProfileTeamType team, bool isFromConsole)
{
// dont allow bots to join if the Navigation Area is being generated
@ -852,9 +816,7 @@ bool CCSBotManager::BotAddCommand(BotProfileTeamType team, bool isFromConsole)
{
// in career, ignore humans
bool ignoreHumans = false;
CHalfLifeMultiplay *mp = g_pGameRules;
if (mp != NULL && mp->IsCareer())
if (CSGameRules() != NULL && CSGameRules()->IsCareer())
ignoreHumans = true;
if (UTIL_IsNameTaken(CMD_ARGV(1), ignoreHumans))
@ -885,14 +847,14 @@ bool CCSBotManager::BotAddCommand(BotProfileTeamType team, bool isFromConsole)
}
// Keep a minimum quota of bots in the game
/* <36d10f> ../cstrike/dlls/bot/cs_bot_manager.cpp:979 */
void CCSBotManager::MaintainBotQuota()
{
if (!AreBotsAllowed())
return;
if (IMPL(m_isLearningMap))
return;
CHalfLifeMultiplay *mp = g_pGameRules;
int totalHumansInGame = UTIL_HumansInGame();
int humanPlayersInGame = UTIL_HumansInGame(IGNORE_SPECTATORS);
@ -900,12 +862,12 @@ void CCSBotManager::MaintainBotQuota()
if (!IS_DEDICATED_SERVER() && totalHumansInGame == 0)
return;
int desiredBotCount = (int)cv_bot_quota.value;
int desiredBotCount = int(cv_bot_quota.value);
int botsInGame = UTIL_BotsInGame();
if (cv_bot_quota_match.value > 0.0)
{
desiredBotCount = (int)(humanPlayersInGame * cv_bot_quota_match.value);
desiredBotCount = int(humanPlayersInGame * cv_bot_quota_match.value);
}
// wait for a player to join, if necessary
@ -925,7 +887,7 @@ void CCSBotManager::MaintainBotQuota()
if (desiredBotCount > botsInGame)
{
// don't try to add a bot if all teams are full
if (!mp->TeamFull(TERRORIST) || !mp->TeamFull(CT))
if (!CSGameRules()->TeamFull(TERRORIST) || !CSGameRules()->TeamFull(CT))
BotAddCommand(BOT_TEAM_ANY);
}
else if (desiredBotCount < botsInGame)
@ -939,20 +901,20 @@ void CCSBotManager::MaintainBotQuota()
TeamName kickTeam;
// remove from the team that has more players
if (mp->m_iNumTerrorist > mp->m_iNumCT)
if (CSGameRules()->m_iNumTerrorist > CSGameRules()->m_iNumCT)
{
kickTeam = TERRORIST;
}
else if (mp->m_iNumTerrorist < mp->m_iNumCT)
else if (CSGameRules()->m_iNumTerrorist < CSGameRules()->m_iNumCT)
{
kickTeam = CT;
}
// remove from the team that's winning
else if (mp->m_iNumTerroristWins > mp->m_iNumCTWins)
else if (CSGameRules()->m_iNumTerroristWins > CSGameRules()->m_iNumCTWins)
{
kickTeam = TERRORIST;
}
else if (mp->m_iNumCTWins > mp->m_iNumTerroristWins)
else if (CSGameRules()->m_iNumCTWins > CSGameRules()->m_iNumTerroristWins)
{
kickTeam = CT;
}
@ -974,21 +936,21 @@ void CCSBotManager::MaintainBotQuota()
}
else
{
if (mp != NULL && !mp->IsCareer())
if (CSGameRules() != NULL && !CSGameRules()->IsCareer())
return;
bool humansAreCTs = (Q_strcmp(humans_join_team.string, "CT") == 0);
if (humansAreCTs)
{
if (mp->m_iNumCT <= 6)
if (CSGameRules()->m_iNumCT <= 6)
return;
UTIL_KickBotFromTeam(CT);
}
else
{
if (mp->m_iNumTerrorist <= 6)
if (CSGameRules()->m_iNumTerrorist <= 6)
return;
UTIL_KickBotFromTeam(TERRORIST);
@ -998,7 +960,6 @@ void CCSBotManager::MaintainBotQuota()
}
}
/* <36d1dd> ../cstrike/dlls/bot/cs_bot_manager.cpp:1086 */
void CCSBotManager::MonitorBotCVars()
{
if (cv_bot_nav_edit.value != 0.0f)
@ -1050,11 +1011,9 @@ private:
};
// Search the map entities to determine the game scenario and define important zones.
/* <36b780> ../cstrike/dlls/bot/cs_bot_manager.cpp:1109 */
void CCSBotManager::ValidateMapData()
{
if (IMPL(m_isMapDataLoaded) || !g_bIsCzeroGame)
if (IMPL(m_isMapDataLoaded) || !AreBotsAllowed())
return;
IMPL(m_isMapDataLoaded) = true;
@ -1192,17 +1151,12 @@ void CCSBotManager::ValidateMapData()
}
}
/* <36c2b2> ../cstrike/dlls/bot/cs_bot_manager.cpp:1278 */
#ifndef HOOK_GAMEDLL
bool CCSBotManager::AddBot(const BotProfile *profile, BotProfileTeamType team)
{
if (!g_bIsCzeroGame)
if (!AreBotsAllowed())
return false;
CHalfLifeMultiplay *mp = g_pGameRules;
int nTeamSlot = UNASSIGNED;
if (team == BOT_TEAM_ANY)
{
// if team not specified, check cv_bot_join_team cvar for preference
@ -1223,13 +1177,13 @@ bool CCSBotManager::AddBot(const BotProfile *profile, BotProfileTeamType team)
nTeamSlot = SelectDefaultTeam();
}
if (nTeamSlot == UNASSIGNED || mp->TeamFull(nTeamSlot))
if (nTeamSlot == UNASSIGNED || CSGameRules()->TeamFull(nTeamSlot))
{
CONSOLE_ECHO("Could not add bot to the game: Team is full\n");
return false;
}
if (mp->TeamStacked(nTeamSlot, UNASSIGNED))
if (CSGameRules()->TeamStacked(nTeamSlot, UNASSIGNED))
{
CONSOLE_ECHO("Could not add bot to the game: Team is stacked (to disable this check, set mp_limitteams and mp_autoteambalance to zero and restart the round).\n");
return false;
@ -1270,11 +1224,8 @@ bool CCSBotManager::AddBot(const BotProfile *profile, BotProfileTeamType team)
return false;
}
#endif // HOOK_GAMEDLL
// Return the zone that contains the given position
/* <36bb90> ../cstrike/dlls/bot/cs_bot_manager.cpp:1375 */
const CCSBotManager::Zone *CCSBotManager::GetZone(const Vector *pos) const
{
for (int z = 0; z < m_zoneCount; ++z)
@ -1289,8 +1240,6 @@ const CCSBotManager::Zone *CCSBotManager::GetZone(const Vector *pos) const
}
// Return the closest zone to the given position
/* <36bbfd> ../cstrike/dlls/bot/cs_bot_manager.cpp:1392 */
const CCSBotManager::Zone *CCSBotManager::GetClosestZone(const Vector *pos) const
{
const Zone *close = NULL;
@ -1311,8 +1260,6 @@ const CCSBotManager::Zone *CCSBotManager::GetClosestZone(const Vector *pos) cons
}
// Return a random position inside the given zone
/* <36bcc9> ../cstrike/dlls/bot/cs_bot_manager.cpp:1415 */
const Vector *CCSBotManager::GetRandomPositionInZone(const Zone *zone) const
{
static Vector pos;
@ -1351,8 +1298,6 @@ const Vector *CCSBotManager::GetRandomPositionInZone(const Zone *zone) const
}
// Return a random area inside the given zone
/* <36bd64> ../cstrike/dlls/bot/cs_bot_manager.cpp:1458 */
CNavArea *CCSBotManager::GetRandomAreaInZone(const Zone *zone) const
{
// TODO: improvement is needed
@ -1362,7 +1307,6 @@ CNavArea *CCSBotManager::GetRandomAreaInZone(const Zone *zone) const
return zone->m_area[ RANDOM_LONG(0, zone->m_areaCount - 1) ];
}
/* <36b02d> ../cstrike/dlls/bot/cs_bot_manager.cpp:1477 */
void CCSBotManager::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
{
switch (event)
@ -1404,14 +1348,11 @@ void CCSBotManager::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *enti
}
// Get the time remaining before the planted bomb explodes
/* <36bdb3> ../cstrike/dlls/bot/cs_bot_manager.cpp:1541 */
float CCSBotManager::GetBombTimeLeft() const
{
return (g_pGameRules->m_iC4Timer - (gpGlobals->time - m_bombPlantTimestamp));
return (CSGameRules()->m_iC4Timer - (gpGlobals->time - m_bombPlantTimestamp));
}
/* <36bddb> ../cstrike/dlls/bot/cs_bot_manager.cpp:1547 */
void CCSBotManager::SetLooseBomb(CBaseEntity *bomb)
{
m_looseBomb = bomb;
@ -1427,8 +1368,6 @@ void CCSBotManager::SetLooseBomb(CBaseEntity *bomb)
}
// Return true if player is important to scenario (VIP, bomb carrier, etc)
/* <36b14d> ../cstrike/dlls/bot/cs_bot_manager.cpp:1565 */
bool CCSBotManager::__MAKE_VHOOK(IsImportantPlayer)(CBasePlayer *player) const
{
switch (GetScenario())
@ -1460,8 +1399,6 @@ bool CCSBotManager::__MAKE_VHOOK(IsImportantPlayer)(CBasePlayer *player) const
}
// Return priority of player (0 = max pri)
/* <36b1a7> ../cstrike/dlls/bot/cs_bot_manager.cpp:1602 */
unsigned int CCSBotManager::__MAKE_VHOOK(GetPlayerPriority)(CBasePlayer *player) const
{
const unsigned int lowestPriority = 0xFFFFFFFF;
@ -1513,8 +1450,6 @@ unsigned int CCSBotManager::__MAKE_VHOOK(GetPlayerPriority)(CBasePlayer *player)
// Return the last time the given radio message was sent for given team
// 'teamID' can be TEAM_CT or TEAM_TERRORIST
/* <36be2e> ../cstrike/dlls/bot/cs_bot_manager.cpp:1655 */
float CCSBotManager::GetRadioMessageTimestamp(GameEventType event, int teamID) const
{
if (event <= EVENT_START_RADIO_1 || event >= EVENT_END_RADIO)
@ -1525,8 +1460,6 @@ float CCSBotManager::GetRadioMessageTimestamp(GameEventType event, int teamID) c
}
// Return the interval since the last time this message was sent
/* <36be76> ../cstrike/dlls/bot/cs_bot_manager.cpp:1667 */
float CCSBotManager::GetRadioMessageInterval(GameEventType event, int teamID) const
{
if (event <= EVENT_START_RADIO_1 || event >= EVENT_END_RADIO)
@ -1538,8 +1471,6 @@ float CCSBotManager::GetRadioMessageInterval(GameEventType event, int teamID) co
// Set the given radio message timestamp.
// 'teamID' can be TEAM_CT or TEAM_TERRORIST
/* <36bebe> ../cstrike/dlls/bot/cs_bot_manager.cpp:1680 */
void CCSBotManager::SetRadioMessageTimestamp(GameEventType event, int teamID)
{
if (event <= EVENT_START_RADIO_1 || event >= EVENT_END_RADIO)
@ -1550,8 +1481,6 @@ void CCSBotManager::SetRadioMessageTimestamp(GameEventType event, int teamID)
}
// Reset all radio message timestamps
/* <36bf06> ../cstrike/dlls/bot/cs_bot_manager.cpp:1690 */
void CCSBotManager::ResetRadioMessageTimestamps()
{
for (int t = 0; t < ARRAYSIZE(m_radioMsgTimestamp[0]); ++t)

View File

@ -72,12 +72,12 @@ public:
unsigned int GetPlayerPriority_(CBasePlayer *player) const;
bool IsImportantPlayer_(CBasePlayer *player) const;
#endif // HOOK_GAMEDLL
#endif
public:
void ValidateMapData();
bool IsLearningMap() const { return IMPL(m_isLearningMap); }
void SetLearningMapFlag() { IMPL(m_isLearningMap) = true;}
void SetLearningMapFlag() { IMPL(m_isLearningMap) = true; }
bool IsAnalysisRequested() const { return IMPL(m_isAnalysisRequested); }
void RequestAnalysis() { IMPL(m_isAnalysisRequested) = true; }
void AckAnalysisRequest() { IMPL(m_isAnalysisRequested) = false; }
@ -168,7 +168,7 @@ public:
if (!m_zoneCount)
return NULL;
return &m_zone[ RANDOM_LONG(0, m_zoneCount - 1) ];
return &m_zone[RANDOM_LONG(0, m_zoneCount - 1)];
}
bool IsBombPlanted() const { return m_isBombPlanted; } // returns true if bomb has been planted
@ -214,7 +214,7 @@ public:
void SetNavPlace(unsigned int place) { m_navPlace = place; }
enum SkillType { LOW, AVERAGE, HIGH, RANDOM };
NOXREF const char *GetRandomBotName(SkillType skill);
const char *GetRandomBotName(SkillType skill);
static void MonitorBotCVars();
static void MaintainBotQuota();
@ -225,7 +225,7 @@ public:
#ifndef HOOK_GAMEDLL
private:
#endif // HOOK_GAMEDLL
#endif
static float IMPL(m_flNextCVarCheck);
static bool IMPL(m_isMapDataLoaded); // true if we've attempted to load map data
static bool IMPL(m_isLearningMap);
@ -233,7 +233,7 @@ private:
GameScenarioType m_gameScenario; // what kind of game are we playing
Zone m_zone[ MAX_ZONES ];
Zone m_zone[MAX_ZONES];
int m_zoneCount;
bool m_isBombPlanted; // true if bomb has been planted
@ -260,18 +260,22 @@ private:
bool m_bServerActive;
};
/* <2e81a8> ../cstrike/dlls/bot/cs_bot_manager.h:24 */
NOXREF inline int OtherTeam(int team)
inline int OtherTeam(int team)
{
return (team == TERRORIST) ? CT : TERRORIST;
}
/* <111bd2> ../cstrike/dlls/bot/cs_bot_manager.h:266 */
inline CCSBotManager *TheCSBots()
{
return reinterpret_cast<CCSBotManager *>(TheBots);
}
// Determine whether bots can be used or not
inline bool AreBotsAllowed()
{
return g_bAllowedCSBot;
}
void PrintAllEntities();
void UTIL_DrawBox(Extent *extent, int lifetime, int red, int green, int blue);

View File

@ -1,8 +1,6 @@
#include "precompiled.h"
// Reset the stuck-checker.
/* <37c284> ../cstrike/dlls/bot/cs_bot_nav.cpp:16 */
void CCSBot::ResetStuckMonitor()
{
if (m_isStuck)
@ -24,8 +22,6 @@ void CCSBot::ResetStuckMonitor()
}
// Test if we have become stuck
/* <37c2a6> ../cstrike/dlls/bot/cs_bot_nav.cpp:37 */
void CCSBot::StuckCheck()
{
if (m_isStuck)
@ -99,8 +95,6 @@ void CCSBot::StuckCheck()
}
// Check if we need to jump due to height change
/* <37c05d> ../cstrike/dlls/bot/cs_bot_nav.cpp:114 */
bool CCSBot::DiscontinuityJump(float ground, bool onlyJumpDown, bool mustJump)
{
// don't try to jump again.
@ -141,8 +135,6 @@ bool CCSBot::DiscontinuityJump(float ground, bool onlyJumpDown, bool mustJump)
}
// Find "simple" ground height, treating current nav area as part of the floor
/* <37c448> ../cstrike/dlls/bot/cs_bot_nav.cpp:154 */
bool CCSBot::GetSimpleGroundHeightWithFloor(const Vector *pos, float *height, Vector *normal)
{
if (GetSimpleGroundHeight(pos, height, normal))
@ -159,7 +151,6 @@ bool CCSBot::GetSimpleGroundHeightWithFloor(const Vector *pos, float *height, Ve
return false;
}
/* <37c4b8> ../cstrike/dlls/bot/cs_bot_nav.cpp:172 */
Place CCSBot::GetPlace() const
{
if (m_lastKnownArea != NULL)
@ -168,7 +159,6 @@ Place CCSBot::GetPlace() const
return UNDEFINED_PLACE;
}
/* <37c4de> ../cstrike/dlls/bot/cs_bot_nav.cpp:184 */
void CCSBot::MoveTowardsPosition(const Vector *pos)
{
// Jump up on ledges
@ -179,8 +169,8 @@ void CCSBot::MoveTowardsPosition(const Vector *pos)
// NOTE: We need to do this frequently to catch edges at the right time
// TODO: Look ahead *along path* instead of straight line
if ((m_lastKnownArea == NULL || !(m_lastKnownArea->GetAttributes() & NAV_NO_JUMP)) &&
!IsOnLadder() && !m_isJumpCrouching)
if ((m_lastKnownArea == NULL || !(m_lastKnownArea->GetAttributes() & NAV_NO_JUMP))
&& !IsOnLadder() && !m_isJumpCrouching)
{
float ground;
Vector aheadRay(pos->x - pev->origin.x, pos->y - pev->origin.y, 0);
@ -263,8 +253,6 @@ void CCSBot::MoveTowardsPosition(const Vector *pos)
}
// Move away from position, independant of view angle
/* <37ca96> ../cstrike/dlls/bot/cs_bot_nav.cpp:282 */
NOXREF void CCSBot::MoveAwayFromPosition(const Vector *pos)
{
// compute our current forward and lateral vectors
@ -294,8 +282,6 @@ NOXREF void CCSBot::MoveAwayFromPosition(const Vector *pos)
}
// Strafe (sidestep) away from position, independant of view angle
/* <37cb85> ../cstrike/dlls/bot/cs_bot_nav.cpp:314 */
void CCSBot::StrafeAwayFromPosition(const Vector *pos)
{
// compute our current forward and lateral vectors
@ -317,8 +303,6 @@ void CCSBot::StrafeAwayFromPosition(const Vector *pos)
}
// For getting un-stuck
/* <37cc52> ../cstrike/dlls/bot/cs_bot_nav.cpp:338 */
void CCSBot::Wiggle()
{
if (IsCrouching())
@ -361,8 +345,6 @@ void CCSBot::Wiggle()
}
// Determine approach points from eye position and approach areas of current area
/* <37cc94> ../cstrike/dlls/bot/cs_bot_nav.cpp:383 */
void CCSBot::ComputeApproachPoints()
{
m_approachPointCount = 0;
@ -407,7 +389,6 @@ void CCSBot::ComputeApproachPoints()
}
}
/* <37cd67> ../cstrike/dlls/bot/cs_bot_nav.cpp:422 */
void CCSBot::DrawApproachPoints()
{
for (int i = 0; i < m_approachPointCount; ++i)
@ -417,8 +398,6 @@ void CCSBot::DrawApproachPoints()
}
// Find the approach point that is nearest to our current path, ahead of us
/* <37ce12> ../cstrike/dlls/bot/cs_bot_nav.cpp:435 */
NOXREF bool CCSBot::FindApproachPointNearestPath(Vector *pos)
{
if (!HasPath())

View File

@ -1,8 +1,6 @@
#include "precompiled.h"
// Determine actual path positions bot will move between along the path
/* <38db02> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:30 */
bool CCSBot::ComputePathPositions()
{
if (m_pathLength == 0)
@ -125,8 +123,6 @@ bool CCSBot::ComputePathPositions()
}
// If next step of path uses a ladder, prepare to traverse it
/* <38d424> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:155 */
void CCSBot::SetupLadderMovement()
{
if (m_pathIndex < 1 || m_pathLength == 0)
@ -187,8 +183,6 @@ void CCSBot::SetupLadderMovement()
}
// TODO: What about ladders whose top AND bottom are messed up?
/* <38dd85> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:213 */
void CCSBot::ComputeLadderEndpoint(bool isAscending)
{
TraceResult result;
@ -221,8 +215,6 @@ void CCSBot::ComputeLadderEndpoint(bool isAscending)
// Navigate our current ladder. Return true if we are doing ladder navigation.
// TODO: Need Push() and Pop() for run/walk context to keep ladder speed contained.
/* <38de76> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:248 */
bool CCSBot::UpdateLadderMovement()
{
if (m_pathLadder == NULL)
@ -303,7 +295,7 @@ bool CCSBot::UpdateLadderMovement()
{
Vector2D perp(-m_pathLadder->m_dirVector.y, m_pathLadder->m_dirVector.x);
if (abs(int64(d.x * perp.x + d.y * perp.y)) < tolerance && d.Length() < closeToGoal)
if (Q_abs(int64(d.x * perp.x + d.y * perp.y)) < tolerance && d.Length() < closeToGoal)
approached = true;
}
@ -359,7 +351,7 @@ bool CCSBot::UpdateLadderMovement()
{
Vector2D perp(-m_pathLadder->m_dirVector.y, m_pathLadder->m_dirVector.x);
if (abs(int64(d.x * perp.x + d.y * perp.y)) < tolerance && d.Length() < closeToGoal)
if (Q_abs(int64(d.x * perp.x + d.y * perp.y)) < tolerance && d.Length() < closeToGoal)
approached = true;
}
@ -582,8 +574,6 @@ bool CCSBot::UpdateLadderMovement()
// Compute closest point on path to given point
// NOTE: This does not do line-of-sight tests, so closest point may be thru the floor, etc
/* <38e44d> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:609 */
bool CCSBot::FindClosestPointOnPath(const Vector *worldPos, int startIndex, int endIndex, Vector *close) const
{
if (!HasPath() || close == NULL)
@ -637,8 +627,6 @@ bool CCSBot::FindClosestPointOnPath(const Vector *worldPos, int startIndex, int
// Return the closest point to our current position on our current path
// If "local" is true, only check the portion of the path surrounding m_pathIndex.
/* <38e6d0> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:665 */
int CCSBot::FindOurPositionOnPath(Vector *close, bool local) const
{
if (!HasPath())
@ -724,8 +712,6 @@ int CCSBot::FindOurPositionOnPath(Vector *close, bool local) const
}
// Test for un-jumpable height change, or unrecoverable fall
/* <38c911> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:752 */
bool CCSBot::IsStraightLinePathWalkable(const Vector *goal) const
{
// this is causing hang-up problems when crawling thru ducts/windows that drop off into rooms (they fail the "falling" check)
@ -782,8 +768,6 @@ return true;
// Compute a point a fixed distance ahead along our path.
// Returns path index just after point.
/* <38ec40> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:810 */
int CCSBot::FindPathPoint(float aheadRange, Vector *point, int *prevIndex)
{
// find path index just past aheadRange
@ -859,8 +843,7 @@ int CCSBot::FindPathPoint(float aheadRange, Vector *point, int *prevIndex)
}
// we need the point just *ahead* of us
++startIndex;
if (startIndex >= m_pathLength)
if (++startIndex >= m_pathLength)
startIndex = m_pathLength - 1;
// if we hit a ladder, stop, or jump area, must stop
@ -1021,8 +1004,6 @@ int CCSBot::FindPathPoint(float aheadRange, Vector *point, int *prevIndex)
}
// Set the current index along the path
/* <38f761> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1052 */
void CCSBot::SetPathIndex(int newIndex)
{
m_pathIndex = Q_min(newIndex, m_pathLength - 1);
@ -1045,8 +1026,6 @@ void CCSBot::SetPathIndex(int newIndex)
}
// Return true if nearing a jump in the path
/* <38cafc> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1077 */
bool CCSBot::IsNearJump() const
{
if (m_pathIndex == 0 || m_pathIndex >= m_pathLength)
@ -1067,8 +1046,6 @@ bool CCSBot::IsNearJump() const
}
// Return approximately how much damage will will take from the given fall height
/* <38f844> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1100 */
float CCSBot::GetApproximateFallDamage(float height) const
{
// empirically discovered height values
@ -1084,8 +1061,6 @@ float CCSBot::GetApproximateFallDamage(float height) const
}
// Return true if a friend is between us and the given position
/* <38f89b> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1118 */
bool CCSBot::IsFriendInTheWay(const Vector *goalPos) const
{
// do this check less often to ease CPU burden
@ -1161,8 +1136,6 @@ bool CCSBot::IsFriendInTheWay(const Vector *goalPos) const
}
// Do reflex avoidance movements if our "feelers" are touched
/* <38fbd5> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1197 */
void CCSBot::FeelerReflexAdjustment(Vector *goalPosition)
{
// if we are in a "precise" area, do not do feeler adjustments
@ -1267,8 +1240,6 @@ void CCSBot::FeelerReflexAdjustment(Vector *goalPosition)
}
// Move along the path. Return false if end of path reached.
/* <3912bf> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1300 */
CCSBot::PathResult CCSBot::UpdatePathMovement(bool allowSpeedChange)
{
if (m_pathLength == 0)
@ -1574,8 +1545,6 @@ CCSBot::PathResult CCSBot::UpdatePathMovement(bool allowSpeedChange)
}
// Build trivial path to goal, assuming we are already in the same area
/* <3906a6> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1634 */
void CCSBot::BuildTrivialPath(const Vector *goal)
{
m_pathIndex = 1;
@ -1602,8 +1571,6 @@ void CCSBot::BuildTrivialPath(const Vector *goal)
// Compute shortest path to goal position via A* algorithm
// If 'goalArea' is NULL, path will get as close as it can.
/* <3907cd> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1664 */
bool CCSBot::ComputePath(CNavArea *goalArea, const Vector *goal, RouteType route)
{
// Throttle re-pathing
@ -1631,7 +1598,7 @@ bool CCSBot::ComputePath(CNavArea *goalArea, const Vector *goal, RouteType route
pathEndPosition = *goal;
// make sure path end position is on the ground
if (goalArea)
if (goalArea != NULL)
pathEndPosition.z = goalArea->GetZ(&pathEndPosition);
else
GetGroundHeight(&pathEndPosition, &pathEndPosition.z);
@ -1731,8 +1698,6 @@ bool CCSBot::ComputePath(CNavArea *goalArea, const Vector *goal, RouteType route
}
// Return estimated distance left to travel along path
/* <390ef6> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1798 */
float CCSBot::GetPathDistanceRemaining() const
{
if (!HasPath())
@ -1753,8 +1718,6 @@ float CCSBot::GetPathDistanceRemaining() const
}
// Draw a portion of our current path for debugging.
/* <390fb1> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1821 */
void CCSBot::DrawPath()
{
if (!HasPath())

View File

@ -2,7 +2,6 @@
// Returns true if the radio message is an order to do something
// NOTE: "Report in" is not considered a "command" because it doesnt ask the bot to go somewhere, or change its mind
/* <3a3689> ../cstrike/dlls/bot/cs_bot_radio.cpp:19 */
bool CCSBot::IsRadioCommand(GameEventType event) const
{
if (event == EVENT_RADIO_AFFIRMATIVE
@ -18,8 +17,6 @@ bool CCSBot::IsRadioCommand(GameEventType event) const
}
// Respond to radio commands from HUMAN players
/* <3a36e0> ../cstrike/dlls/bot/cs_bot_radio.cpp:37 */
void CCSBot::RespondToRadioCommands()
{
// bots use the chatter system to respond to each other
@ -74,7 +71,6 @@ void CCSBot::RespondToRadioCommands()
return;
}
CCSBotManager *ctrl = TheCSBots();
CBasePlayer *player = m_radioSubject;
if (player == NULL)
return;
@ -142,7 +138,7 @@ void CCSBot::RespondToRadioCommands()
}
case EVENT_RADIO_GET_OUT_OF_THERE:
{
if (ctrl->IsBombPlanted())
if (TheCSBots()->IsBombPlanted())
{
EscapeFromBomb();
player->InhibitAutoFollow(inhibitAutoFollowDuration);
@ -154,11 +150,11 @@ void CCSBot::RespondToRadioCommands()
{
// if this is a defusal scenario, and the bomb is planted,
// and a human player cleared a bombsite, check it off our list too
if (ctrl->GetScenario() == CCSBotManager::SCENARIO_DEFUSE_BOMB)
if (TheCSBots()->GetScenario() == CCSBotManager::SCENARIO_DEFUSE_BOMB)
{
if (m_iTeam == CT && ctrl->IsBombPlanted())
if (m_iTeam == CT && TheCSBots()->IsBombPlanted())
{
const CCSBotManager::Zone *zone = ctrl->GetClosestZone(player);
const CCSBotManager::Zone *zone = TheCSBots()->GetClosestZone(player);
if (zone != NULL)
{
@ -196,8 +192,6 @@ void CCSBot::RespondToRadioCommands()
}
// Send voice chatter. Also sends the entindex.
/* <3a397f> ../cstrike/dlls/bot/cs_bot_radio.cpp:220 */
void CCSBot::StartVoiceFeedback(float duration)
{
m_voiceFeedbackStartTimestamp = gpGlobals->time;
@ -213,7 +207,6 @@ void CCSBot::StartVoiceFeedback(float duration)
}
}
/* <3a3a32> ../cstrike/dlls/bot/cs_bot_radio.cpp:241 */
void CCSBot::EndVoiceFeedback(bool force)
{
if (!force && !m_voiceFeedbackEndTimestamp)
@ -228,8 +221,6 @@ void CCSBot::EndVoiceFeedback(bool force)
}
// Decide if we should move to help the player, return true if we will
/* <3a3bcd> ../cstrike/dlls/bot/cs_bot_radio.cpp:259 */
bool CCSBot::RespondToHelpRequest(CBasePlayer *them, Place place, float maxRange)
{
if (IsRogue())
@ -290,8 +281,6 @@ bool CCSBot::RespondToHelpRequest(CBasePlayer *them, Place place, float maxRange
}
// Send a radio message
/* <3a4316> ../cstrike/dlls/bot/cs_bot_radio.cpp:319 */
void CCSBot::SendRadioMessage(GameEventType event)
{
// make sure this is a radio event
@ -300,11 +289,10 @@ void CCSBot::SendRadioMessage(GameEventType event)
return;
}
CCSBotManager *ctrl = TheCSBots();
PrintIfWatched("%3.1f: SendRadioMessage( %s )\n", gpGlobals->time, GameEventName[ event ]);
// note the time the message was sent
ctrl->SetRadioMessageTimestamp(event, m_iTeam);
TheCSBots()->SetRadioMessageTimestamp(event, m_iTeam);
m_lastRadioSentTimestamp = gpGlobals->time;

View File

@ -1,8 +1,6 @@
#include "precompiled.h"
// This method is the ONLY legal way to change a bot's current state
/* <3b3a2a> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:16 */
void CCSBot::SetState(BotState *state)
{
PrintIfWatched("SetState: %s -> %s\n", (m_state != NULL) ? m_state->GetName() : "NULL", state->GetName());
@ -20,21 +18,18 @@ void CCSBot::SetState(BotState *state)
m_stateTimestamp = gpGlobals->time;
}
/* <3b3ab4> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:34 */
void CCSBot::Idle()
{
SetTask(SEEK_AND_DESTROY);
SetState(&m_idleState);
}
/* <3b3afa> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:41 */
void CCSBot::EscapeFromBomb()
{
SetTask(ESCAPE_FROM_BOMB);
SetState(&m_escapeFromBombState);
}
/* <3b3b4b> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:48 */
void CCSBot::Follow(CBasePlayer *player)
{
if (player == NULL)
@ -53,8 +48,6 @@ void CCSBot::Follow(CBasePlayer *player)
}
// Continue following our leader after finishing what we were doing
/* <3b3bd1> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:69 */
void CCSBot::ContinueFollowing()
{
SetTask(FOLLOW);
@ -63,8 +56,6 @@ void CCSBot::ContinueFollowing()
}
// Stop following
/* <3b3c57> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:83 */
void CCSBot::StopFollowing()
{
m_isFollowing = false;
@ -73,16 +64,12 @@ void CCSBot::StopFollowing()
}
// Begin process of rescuing hostages
/* <3b3c7e> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:94 */
void CCSBot::RescueHostages()
{
SetTask(RESCUE_HOSTAGES);
}
// Use the entity
/* <3b3cc9> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:103 */
void CCSBot::UseEntity(CBaseEntity *entity)
{
m_useEntityState.SetEntity(entity);
@ -92,8 +79,6 @@ void CCSBot::UseEntity(CBaseEntity *entity)
// DEPRECATED: Use TryToHide() instead.
// Move to a hiding place.
// If 'searchFromArea' is non-NULL, hiding spots are looked for from that area first.
/* <3b3d23> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:116 */
void CCSBot::Hide(CNavArea *searchFromArea, float duration, float hideRange, bool holdPosition)
{
DestroyPath();
@ -152,8 +137,6 @@ void CCSBot::Hide(CNavArea *searchFromArea, float duration, float hideRange, boo
}
// Move to the given hiding place
/* <3b3e98> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:171 */
void CCSBot::Hide(const Vector *hidingSpot, float duration, bool holdPosition)
{
CNavArea *hideArea = TheNavAreaGrid.GetNearestNavArea(hidingSpot);
@ -185,8 +168,6 @@ void CCSBot::Hide(const Vector *hidingSpot, float duration, bool holdPosition)
// Try to hide nearby. Return true if hiding, false if can't hide here.
// If 'searchFromArea' is non-NULL, hiding spots are looked for from that area first.
/* <3b3fc1> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:205 */
bool CCSBot::TryToHide(CNavArea *searchFromArea, float duration, float hideRange, bool holdPosition, bool useNearest)
{
CNavArea *source;
@ -235,8 +216,6 @@ bool CCSBot::TryToHide(CNavArea *searchFromArea, float duration, float hideRange
}
// Retreat to a nearby hiding spot, away from enemies
/* <3b40ed> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:256 */
bool CCSBot::TryToRetreat()
{
const float maxRange = 1000.0f;
@ -261,7 +240,6 @@ bool CCSBot::TryToRetreat()
return false;
}
/* <3b426a> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:280 */
void CCSBot::Hunt()
{
SetState(&m_huntState);
@ -269,8 +247,6 @@ void CCSBot::Hunt()
// Attack our the given victim
// NOTE: Attacking does not change our task.
/* <3b4291> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:290 */
void CCSBot::Attack(CBasePlayer *victim)
{
if (victim == NULL)
@ -309,7 +285,7 @@ void CCSBot::Attack(CBasePlayer *victim)
Vector toEnemy = victim->pev->origin - pev->origin;
Vector idealAngle = UTIL_VecToAngles(toEnemy);
float deltaYaw = abs((int)(m_lookYaw - idealAngle.y));
float_precision deltaYaw = float_precision(Q_abs(int64(m_lookYaw - idealAngle.y)));
while (deltaYaw > 180.0f)
deltaYaw -= 360.0f;
@ -319,7 +295,7 @@ void CCSBot::Attack(CBasePlayer *victim)
// immediately aim at enemy - accuracy penalty depending on how far we must turn to aim
// accuracy is halved if we have to turn 180 degrees
float turn = deltaYaw / 180.0f;
float turn = deltaYaw * 0.0055555557;/// 180.0f;
float accuracy = GetProfile()->GetSkill() / (1.0f + turn);
SetAimOffset(accuracy);
@ -330,8 +306,6 @@ void CCSBot::Attack(CBasePlayer *victim)
}
// Exit the Attack state
/* <3b4416> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:366 */
void CCSBot::StopAttacking()
{
PrintIfWatched("ATTACK END\n");
@ -345,15 +319,12 @@ void CCSBot::StopAttacking()
}
}
/* <3b447d> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:378 */
bool CCSBot::IsAttacking() const
{
return m_isAttacking;
}
// Return true if we are escaping from the bomb
/* <3b449f> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:387 */
bool CCSBot::IsEscapingFromBomb() const
{
if (m_state == static_cast<const BotState *>(&m_escapeFromBombState))
@ -363,8 +334,6 @@ bool CCSBot::IsEscapingFromBomb() const
}
// Return true if we are defusing the bomb
/* <3b44c6> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:399 */
bool CCSBot::IsDefusingBomb() const
{
if (m_state == static_cast<const BotState *>(&m_defuseBombState))
@ -374,8 +343,6 @@ bool CCSBot::IsDefusingBomb() const
}
// Return true if we are hiding
/* <3b44ed> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:411 */
bool CCSBot::IsHiding() const
{
if (m_state == static_cast<const BotState *>(&m_hideState))
@ -385,8 +352,6 @@ bool CCSBot::IsHiding() const
}
// Return true if we are hiding and at our hiding spot
/* <3b450f> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:423 */
bool CCSBot::IsAtHidingSpot() const
{
if (!IsHiding())
@ -396,8 +361,6 @@ bool CCSBot::IsAtHidingSpot() const
}
// Return true if we are huting
/* <3b454a> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:435 */
bool CCSBot::IsHunting() const
{
if (m_state == static_cast<const BotState *>(&m_huntState))
@ -407,8 +370,6 @@ bool CCSBot::IsHunting() const
}
// Return true if we are in the MoveTo state
/* <3b4571> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:447 */
bool CCSBot::IsMovingTo() const
{
if (m_state == static_cast<const BotState *>(&m_moveToState))
@ -418,8 +379,6 @@ bool CCSBot::IsMovingTo() const
}
// Return true if we are buying
/* <3b4598> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:460 */
bool CCSBot::IsBuying() const
{
if (m_state == static_cast<const BotState *>(&m_buyState))
@ -429,8 +388,6 @@ bool CCSBot::IsBuying() const
}
// Move to potentially distant position
/* <3b45bf> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:472 */
void CCSBot::MoveTo(const Vector *pos, RouteType route)
{
m_moveToState.SetGoalPosition(*pos);
@ -438,29 +395,23 @@ void CCSBot::MoveTo(const Vector *pos, RouteType route)
SetState(&m_moveToState);
}
/* <3b463c> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:480 */
void CCSBot::PlantBomb()
{
SetState(&m_plantBombState);
}
// Bomb has been dropped - go get it
/* <3b4663> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:489 */
void CCSBot::FetchBomb()
{
SetState(&m_fetchBombState);
}
/* <3b468a> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:495 */
void CCSBot::DefuseBomb()
{
SetState(&m_defuseBombState);
}
// Investigate recent enemy noise
/* <3b46b1> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:504 */
void CCSBot::InvestigateNoise()
{
SetState(&m_investigateNoiseState);

View File

@ -1,13 +1,9 @@
#include "precompiled.h"
// Lightweight maintenance, invoked frequently
/* <3c635f> ../cstrike/dlls/bot/cs_bot_update.cpp:26 */
void CCSBot::__MAKE_VHOOK(Upkeep)()
{
CCSBotManager *ctrl = TheCSBots();
if (ctrl->IsLearningMap() || !IsAlive())
if (TheCSBots()->IsLearningMap() || !IsAlive())
return;
if (m_isRapidFiring)
@ -151,15 +147,11 @@ void CCSBot::__MAKE_VHOOK(Upkeep)()
}
// Heavyweight processing, invoked less often
/* <3c6e1e> ../cstrike/dlls/bot/cs_bot_update.cpp:208 */
void CCSBot::__MAKE_VHOOK(Update)()
{
CCSBotManager *ctrl = TheCSBots();
if (ctrl->IsAnalysisRequested() && m_processMode == PROCESS_NORMAL)
if (TheCSBots()->IsAnalysisRequested() && m_processMode == PROCESS_NORMAL)
{
ctrl->AckAnalysisRequest();
TheCSBots()->AckAnalysisRequest();
StartAnalyzeAlphaProcess();
}
@ -191,7 +183,7 @@ void CCSBot::__MAKE_VHOOK(Update)()
}
// show line of fire
if ((cv_bot_traceview.value == 100.0f && IsLocalPlayerWatchingMe()) || cv_bot_traceview.value == 101.0f)
if ((cv_bot_traceview.value == 100.0 && IsLocalPlayerWatchingMe()) || cv_bot_traceview.value == 101.0)
{
UTIL_MakeVectors(pev->punchangle + pev->v_angle);
@ -207,18 +199,46 @@ void CCSBot::__MAKE_VHOOK(Update)()
}
}
//
// Debug beam rendering
if (cv_bot_traceview.value == 2.0f && IsLocalPlayerWatchingMe() || cv_bot_traceview.value == 3.0f)
//
// show approach points
if ((cv_bot_traceview.value == 2.0f && IsLocalPlayerWatchingMe()) || cv_bot_traceview.value == 3.0f)
DrawApproachPoints();
if (cv_bot_traceview.value == 4.0f && IsLocalPlayerWatchingMe() || cv_bot_traceview.value == 5.0f)
// show encounter spot data
if ((cv_bot_traceview.value == 4.0f && IsLocalPlayerWatchingMe()) || cv_bot_traceview.value == 5.0f)
{
// ...
if (m_spotEncounter != NULL)
{
UTIL_DrawBeamPoints(m_spotEncounter->path.from, m_spotEncounter->path.to, 3, 0, 0, 255);
Vector dir = m_spotEncounter->path.to - m_spotEncounter->path.from;
float length = dir.NormalizeInPlace();
const SpotOrder *order;
Vector along;
for (SpotOrderList::const_iterator iter = m_spotEncounter->spotList.begin(); iter != m_spotEncounter->spotList.end(); ++iter)
{
order = &(*iter);
along = m_spotEncounter->path.from + order->t * length * dir;
UTIL_DrawBeamPoints(along, *order->spot->GetPosition(), 3, 0, 255, 255);
}
}
}
// show path navigation data
if (cv_bot_traceview.value == 1.0f && IsLocalPlayerWatchingMe())
{
// ...
Vector from = GetEyePosition();
const float size = 50.0f;
Vector arrow(size * float(Q_cos(m_lookAheadAngle * M_PI / 180.0f)), size * float(Q_sin(m_lookAheadAngle * M_PI / 180.0f)), 0.0f);
UTIL_DrawBeamPoints(from, from + arrow, 1, 0, 255, 255);
}
if (cv_bot_stop.value != 0.0f)
@ -275,6 +295,7 @@ void CCSBot::__MAKE_VHOOK(Update)()
default: Crouch(); break;
}
}
if (m_blindFire)
{
PrimaryAttack();
@ -294,10 +315,14 @@ void CCSBot::__MAKE_VHOOK(Update)()
// adjust our personal "safe" time
AdjustSafeTime();
if (IsUsingGrenade())
{
ThrowGrenade(&threat->pev->origin);
}
else
{
// Decide if we should attack
bool doAttack = false;
if (!IsUsingGrenade())
{
switch (GetDisposition())
{
case IGNORE_ENEMIES:
@ -327,26 +352,10 @@ void CCSBot::__MAKE_VHOOK(Update)()
break;
}
}
}
else
ThrowGrenade(&pev->origin);
// if we aren't attacking but we are being attacked, retaliate
if (!doAttack && !IsAttacking() && GetDisposition() != IGNORE_ENEMIES)
{
const float recentAttackDuration = 1.0f;
if (GetTimeSinceAttacked() < recentAttackDuration)
{
// we may not be attacking our attacker, but at least we're not just taking it
// (since m_attacker isn't reaction-time delayed, we can't directly use it)
doAttack = true;
PrintIfWatched("Ouch! Retaliating!\n");
}
}
if (doAttack)
{
if (GetEnemy() == NULL || !IsAttacking() || threat != GetEnemy())
if (GetEnemy() == NULL || threat != GetEnemy() || !IsAttacking())
{
if (IsUsingKnife() && IsHiding())
{
@ -369,8 +378,22 @@ void CCSBot::__MAKE_VHOOK(Update)()
SetEnemy(threat);
m_isEnemyVisible = true;
}
}
ctrl->SetLastSeenEnemyTimestamp();
// if we aren't attacking but we are being attacked, retaliate
if (GetDisposition() != IGNORE_ENEMIES && !IsAttacking())
{
const float recentAttackDuration = 1.0f;
if (GetTimeSinceAttacked() < recentAttackDuration)
{
// we may not be attacking our attacker, but at least we're not just taking it
// (since m_attacker isn't reaction-time delayed, we can't directly use it)
Attack(threat);
PrintIfWatched("Ouch! Retaliating!\n");
}
}
TheCSBots()->SetLastSeenEnemyTimestamp();
}
// Validate existing enemy, if any
@ -384,6 +407,7 @@ void CCSBot::__MAKE_VHOOK(Update)()
}
else
{
const int dada = offsetof(CCSBot, m_visibleEnemyParts);
// check LOS to current enemy (chest & head), in case he's dead (GetNearestEnemy() only returns live players)
// note we're not checking FOV - once we've acquired an enemy (which does check FOV), assume we know roughly where he is
if (IsVisible(m_enemy, false, &m_visibleEnemyParts))
@ -462,7 +486,6 @@ void CCSBot::__MAKE_VHOOK(Update)()
m_isWaitingToTossGrenade = false;
}
if (IsHunting() && IsWellPastSafe() && IsUsingGrenade())
{
EquipBestWeapon(MUST_EQUIP);
@ -540,10 +563,10 @@ void CCSBot::__MAKE_VHOOK(Update)()
GetChatter()->SpottedBomber(GetBomber());
if (CanSeeLooseBomb())
GetChatter()->SpottedLooseBomb(ctrl->GetLooseBomb());
GetChatter()->SpottedLooseBomb(TheCSBots()->GetLooseBomb());
// Scenario interrupts
switch (ctrl->GetScenario())
switch (TheCSBots()->GetScenario())
{
case CCSBotManager::SCENARIO_DEFUSE_BOMB:
{
@ -556,9 +579,9 @@ void CCSBot::__MAKE_VHOOK(Update)()
gonnaBlowTime *= 0.66f;
if (!IsEscapingFromBomb() // we aren't already escaping the bomb
&& ctrl->IsBombPlanted() // is the bomb planted
&& TheCSBots()->IsBombPlanted() // is the bomb planted
&& GetGameState()->IsPlantedBombLocationKnown() // we know where the bomb is
&& ctrl->GetBombTimeLeft() < gonnaBlowTime // is the bomb about to explode
&& TheCSBots()->GetBombTimeLeft() < gonnaBlowTime // is the bomb about to explode
&& !IsDefusingBomb() // we aren't defusing the bomb
&& !IsAttacking()) // we aren't in the midst of a firefight
{
@ -598,7 +621,7 @@ void CCSBot::__MAKE_VHOOK(Update)()
// give us a chance to do something else.
const float earliestAutoFollowTime = 5.0f;
const float minAutoFollowTeamwork = 0.4f;
if (ctrl->GetElapsedRoundTime() > earliestAutoFollowTime
if (TheCSBots()->GetElapsedRoundTime() > earliestAutoFollowTime
&& GetProfile()->GetTeamwork() > minAutoFollowTeamwork
&& CanAutoFollow()
&& !IsBusy()
@ -629,7 +652,7 @@ void CCSBot::__MAKE_VHOOK(Update)()
Follow(leader);
PrintIfWatched("Auto-Following %s\n", STRING(leader->pev->netname));
if (g_pGameRules->IsCareer())
if (CSGameRules()->IsCareer())
{
GetChatter()->Say("FollowingCommander", 10.0f);
}
@ -678,7 +701,7 @@ void CCSBot::__MAKE_VHOOK(Update)()
{
if (GetMorale() * -40.0 > RANDOM_FLOAT(0.0f, 100.0f))
{
if (ctrl->IsOnOffense(this) || !ctrl->IsDefenseRushing())
if (TheCSBots()->IsOnOffense(this) || !TheCSBots()->IsDefenseRushing())
{
SetDisposition(OPPORTUNITY_FIRE);
Hide(m_lastKnownArea, RANDOM_FLOAT(3.0f, 15.0f));

View File

@ -1,8 +1,6 @@
#include "precompiled.h"
// Used to update view angles to stay on a ladder
/* <3d8352> ../cstrike/dlls/bot/cs_bot_vision.cpp:16 */
float StayOnLadderLine(CCSBot *me, const CNavLadder *ladder)
{
// determine our facing
@ -25,12 +23,10 @@ float StayOnLadderLine(CCSBot *me, const CNavLadder *ladder)
return 0.0f;
}
#ifndef HOOK_GAMEDLL
// Move actual view angles towards desired ones.
// This is the only place v_angle is altered.
// TODO: Make stiffness and turn rate constants timestep invariant.
/* <3d882c> ../cstrike/dlls/bot/cs_bot_vision.cpp:48 */
#ifndef HOOK_GAMEDLL
void CCSBot::UpdateLookAngles()
{
const float deltaT = g_flBotCommandInterval;
@ -198,8 +194,6 @@ void CCSBot::UpdateLookAngles()
#endif // HOOK_GAMEDLL
// Return true if we can see the point
/* <3d8c91> ../cstrike/dlls/bot/cs_bot_vision.cpp:238 */
bool CCSBot::__MAKE_VHOOK(IsVisible)(const Vector *pos, bool testFOV) const
{
// we can't see anything if we're blind
@ -227,8 +221,6 @@ bool CCSBot::__MAKE_VHOOK(IsVisible)(const Vector *pos, bool testFOV) const
// Return true if we can see any part of the player
// Check parts in order of importance. Return the first part seen in "visParts" if it is non-NULL.
/* <3d8d9b> ../cstrike/dlls/bot/cs_bot_vision.cpp:269 */
bool CCSBot::__MAKE_VHOOK(IsVisible)(CBasePlayer *player, bool testFOV, unsigned char *visParts) const
{
Vector spot = player->pev->origin;
@ -283,7 +275,6 @@ bool CCSBot::__MAKE_VHOOK(IsVisible)(CBasePlayer *player, bool testFOV, unsigned
return false;
}
/* <3d8f9f> ../cstrike/dlls/bot/cs_bot_vision.cpp:302 */
bool CCSBot::__MAKE_VHOOK(IsEnemyPartVisible)(VisiblePartType part) const
{
if (!IsEnemyVisible())
@ -292,7 +283,6 @@ bool CCSBot::__MAKE_VHOOK(IsEnemyPartVisible)(VisiblePartType part) const
return (m_visibleEnemyParts & part) != 0;
}
/* <3d8f0d> ../cstrike/dlls/bot/cs_bot_vision.cpp:331 */
void CCSBot::UpdateLookAt()
{
Vector to = m_lookAtSpot - EyePosition();
@ -303,8 +293,6 @@ void CCSBot::UpdateLookAt()
}
// Look at the given point in space for the given duration (-1 means forever)
/* <3d900c> ../cstrike/dlls/bot/cs_bot_vision.cpp:345 */
void CCSBot::SetLookAt(const char *desc, const Vector *pos, PriorityType pri, float duration, bool clearIfClose, float angleTolerance)
{
if (pos == NULL)
@ -338,16 +326,12 @@ void CCSBot::SetLookAt(const char *desc, const Vector *pos, PriorityType pri, fl
}
// Block all "look at" and "look around" behavior for given duration - just look ahead
/* <3d90a7> ../cstrike/dlls/bot/cs_bot_vision.cpp:383 */
void CCSBot::InhibitLookAround(float duration)
{
m_inhibitLookAroundTimestamp = gpGlobals->time + duration;
}
// Update enounter spot timestamps, etc
/* <3d90d3> ../cstrike/dlls/bot/cs_bot_vision.cpp:392 */
void CCSBot::UpdatePeripheralVision()
{
// if we update at 10Hz, this ensures we test once every three
@ -383,8 +367,6 @@ void CCSBot::UpdatePeripheralVision()
}
// Update the "looking around" behavior.
/* <3d91af> ../cstrike/dlls/bot/cs_bot_vision.cpp:429 */
void CCSBot::UpdateLookAround(bool updateNow)
{
// check if looking around has been inhibited
@ -504,8 +486,8 @@ void CCSBot::UpdateLookAround(bool updateNow)
// figure out how far along the path segment we are
Vector delta = m_spotEncounter->path.to - m_spotEncounter->path.from;
float_precision length = delta.Length();
float adx = (float)abs(int64(delta.x));
float ady = (float)abs(int64(delta.y));
float adx = float(Q_abs(int64(delta.x)));
float ady = float(Q_abs(int64(delta.y)));
float_precision t;
if (adx > ady)
@ -523,7 +505,7 @@ void CCSBot::UpdateLookAround(bool updateNow)
t = 1.0f;
// collect the unchecked spots so far
#define MAX_DANGER_SPOTS 8
const int MAX_DANGER_SPOTS = 8;
HidingSpot *dangerSpot[MAX_DANGER_SPOTS];
int dangerSpotCount = 0;
int dangerIndex = 0;
@ -571,8 +553,6 @@ void CCSBot::UpdateLookAround(bool updateNow)
}
// "Bend" our line of sight around corners until we can "see" the point.
/* <3d9618> ../cstrike/dlls/bot/cs_bot_vision.cpp:628 */
bool CCSBot::BendLineOfSight(const Vector *eye, const Vector *point, Vector *bend) const
{
// if we can directly see the point, use it
@ -652,7 +632,6 @@ bool CCSBot::BendLineOfSight(const Vector *eye, const Vector *point, Vector *ben
return false;
}
/* <3d99e8> ../cstrike/dlls/bot/cs_bot_vision.cpp:707 */
CBasePlayer *CCSBot::FindMostDangerousThreat()
{
// maximum number of simulataneously attendable threats
@ -907,8 +886,6 @@ CBasePlayer *CCSBot::FindMostDangerousThreat()
}
// Update our reaction time queue
/* <3d9f7d> ../cstrike/dlls/bot/cs_bot_vision.cpp:960 */
void CCSBot::UpdateReactionQueue()
{
// zombies dont see any threats
@ -935,8 +912,7 @@ void CCSBot::UpdateReactionQueue()
}
// queue is round-robin
++m_enemyQueueIndex;
if (m_enemyQueueIndex >= MAX_ENEMY_QUEUE)
if (++m_enemyQueueIndex >= MAX_ENEMY_QUEUE)
m_enemyQueueIndex = 0;
if (m_enemyQueueCount < MAX_ENEMY_QUEUE)
@ -949,18 +925,16 @@ void CCSBot::UpdateReactionQueue()
reactionTime = maxReactionTime;
// "rewind" time back to our reaction time
int reactionTimeSteps = (int)((reactionTime / g_flBotFullThinkInterval) + 0.5f);
int reactionTimeSteps = int((reactionTime / g_flBotFullThinkInterval) + 0.5f);
int i = now - reactionTimeSteps;
if (i < 0)
i += MAX_ENEMY_QUEUE;
m_enemyQueueAttendIndex = (byte)i;
m_enemyQueueAttendIndex = byte(i);
}
// Return the most dangerous threat we are "conscious" of
/* <3da052> ../cstrike/dlls/bot/cs_bot_vision.cpp:1013 */
CBasePlayer *CCSBot::GetRecognizedEnemy()
{
if (m_enemyQueueAttendIndex >= m_enemyQueueCount)
@ -970,8 +944,6 @@ CBasePlayer *CCSBot::GetRecognizedEnemy()
}
// Return true if the enemy we are "conscious" of is reloading
/* <3da075> ../cstrike/dlls/bot/cs_bot_vision.cpp:1025 */
bool CCSBot::IsRecognizedEnemyReloading()
{
if (m_enemyQueueAttendIndex >= m_enemyQueueCount)
@ -981,8 +953,6 @@ bool CCSBot::IsRecognizedEnemyReloading()
}
// Return true if the enemy we are "conscious" of is hiding behind a shield
/* <3da09d> ../cstrike/dlls/bot/cs_bot_vision.cpp:1037 */
bool CCSBot::IsRecognizedEnemyProtectedByShield()
{
if (m_enemyQueueAttendIndex >= m_enemyQueueCount)
@ -992,8 +962,6 @@ bool CCSBot::IsRecognizedEnemyProtectedByShield()
}
// Return distance to closest enemy we are "conscious" of
/* <3da0c5> ../cstrike/dlls/bot/cs_bot_vision.cpp:1049 */
float CCSBot::GetRangeToNearestRecognizedEnemy()
{
const CBasePlayer *enemy = GetRecognizedEnemy();
@ -1007,8 +975,6 @@ float CCSBot::GetRangeToNearestRecognizedEnemy()
}
// Blind the bot for the given duration
/* <3da170> ../cstrike/dlls/bot/cs_bot_vision.cpp:1063 */
void CCSBot::__MAKE_VHOOK(Blind)(float duration, float holdTime, float fadeTime, int alpha)
{
// extend

View File

@ -2,8 +2,6 @@
// Fire our active weapon towards our current enemy
// NOTE: Aiming our weapon is handled in RunBotUpkeep()
/* <3eb434> ../cstrike/dlls/bot/cs_bot_weapon.cpp:17 */
void CCSBot::FireWeaponAtEnemy()
{
CBasePlayer *enemy = GetEnemy();
@ -38,7 +36,7 @@ void CCSBot::FireWeaponAtEnemy()
const float_precision halfPI = (M_PI / 180.0f);
float_precision yaw = pev->v_angle[ YAW ] * halfPI;
Vector2D dir(cos(yaw), sin(yaw));
Vector2D dir(Q_cos(yaw), Q_sin(yaw));
float_precision onTarget = DotProduct(toAimSpot, dir);
// aim more precisely with a sniper rifle
@ -46,7 +44,7 @@ void CCSBot::FireWeaponAtEnemy()
const float_precision halfSize = (IsUsingSniperRifle()) ? HalfHumanWidth : 2.0f * HalfHumanWidth;
// aiming tolerance depends on how close the target is - closer targets subtend larger angles
float_precision aimTolerance = cos(atan(halfSize / rangeToEnemy));
float_precision aimTolerance = Q_cos(Q_atan(halfSize / rangeToEnemy));
if (onTarget > aimTolerance)
{
@ -150,8 +148,6 @@ void CCSBot::FireWeaponAtEnemy()
}
// Set the current aim offset using given accuracy (1.0 = perfect aim, 0.0f = terrible aim)
/* <3ea12d> ../cstrike/dlls/bot/cs_bot_weapon.cpp:210 */
void CCSBot::SetAimOffset(float accuracy)
{
// if our accuracy is less than perfect, it will improve as we "focus in" while not rotating our view
@ -181,7 +177,7 @@ void CCSBot::SetAimOffset(float accuracy)
PrintIfWatched("Accuracy = %4.3f\n", accuracy);
float range = (m_lastEnemyPosition - pev->origin).Length();
const float_precision maxOffset = range * ((float_precision)m_iFOV / DEFAULT_FOV) * 0.1;
const float_precision maxOffset = range * (float_precision(m_iFOV) / DEFAULT_FOV) * 0.1;
float error = maxOffset * (1 - accuracy);
m_aimOffsetGoal[0] = RANDOM_FLOAT(-error, error);
@ -189,12 +185,10 @@ void CCSBot::SetAimOffset(float accuracy)
m_aimOffsetGoal[2] = RANDOM_FLOAT(-error, error);
// define time when aim offset will automatically be updated
m_aimOffsetTimestamp = gpGlobals->time + RANDOM_FLOAT(0.25, 1);
m_aimOffsetTimestamp = gpGlobals->time + RANDOM_FLOAT(0.25f, 1.0f);
}
// Wiggle aim error based on GetProfile()->GetSkill()
/* <3ea224> ../cstrike/dlls/bot/cs_bot_weapon.cpp:252 */
void CCSBot::UpdateAimOffset()
{
if (gpGlobals->time >= m_aimOffsetTimestamp)
@ -213,8 +207,6 @@ void CCSBot::UpdateAimOffset()
// Change our zoom level to be appropriate for the given range.
// Return true if the zoom level changed.
/* <3ea2b7> ../cstrike/dlls/bot/cs_bot_weapon.cpp:271 */
bool CCSBot::AdjustZoom(float range)
{
bool adjustZoom = false;
@ -269,8 +261,6 @@ bool CCSBot::AdjustZoom(float range)
}
// Return true if the given weapon is a sniper rifle
/* <3e9e2d> ../cstrike/dlls/bot/cs_bot_weapon.cpp:320 */
bool isSniperRifle(CBasePlayerItem *item)
{
switch (item->m_iId)
@ -286,7 +276,6 @@ bool isSniperRifle(CBasePlayerItem *item)
}
}
/* <3ea3ab> ../cstrike/dlls/bot/cs_bot_weapon.cpp:342 */
bool CCSBot::IsUsingAWP() const
{
CBasePlayerWeapon *weapon = GetActiveWeapon();
@ -298,8 +287,6 @@ bool CCSBot::IsUsingAWP() const
}
// Returns true if we are using a weapon with a removable silencer
/* <3ea3ce> ../cstrike/dlls/bot/cs_bot_weapon.cpp:357 */
bool CCSBot::DoesActiveWeaponHaveSilencer() const
{
CBasePlayerWeapon *weapon = GetActiveWeapon();
@ -314,8 +301,6 @@ bool CCSBot::DoesActiveWeaponHaveSilencer() const
}
// Return true if we are using a sniper rifle
/* <3ea3f1> ../cstrike/dlls/bot/cs_bot_weapon.cpp:375 */
bool CCSBot::IsUsingSniperRifle() const
{
CBasePlayerWeapon *weapon = GetActiveWeapon();
@ -327,8 +312,6 @@ bool CCSBot::IsUsingSniperRifle() const
}
// Return true if we have a sniper rifle in our inventory
/* <3ea462> ../cstrike/dlls/bot/cs_bot_weapon.cpp:387 */
bool CCSBot::IsSniper() const
{
for (int i = 0; i < MAX_ITEM_TYPES; ++i)
@ -348,8 +331,6 @@ bool CCSBot::IsSniper() const
}
// Return true if we are actively sniping (moving to sniper spot or settled in)
/* <3ea4c1> ../cstrike/dlls/bot/cs_bot_weapon.cpp:405 */
bool CCSBot::IsSniping() const
{
if (GetTask() == MOVE_TO_SNIPER_SPOT || GetTask() == SNIPING)
@ -359,8 +340,6 @@ bool CCSBot::IsSniping() const
}
// Return true if we are using a shotgun
/* <3ea4e8> ../cstrike/dlls/bot/cs_bot_weapon.cpp:417 */
bool CCSBot::IsUsingShotgun() const
{
CBasePlayerWeapon *weapon = GetActiveWeapon();
@ -375,8 +354,6 @@ bool CCSBot::IsUsingShotgun() const
}
// Returns true if using the big 'ol machinegun
/* <3ea50f> ../cstrike/dlls/bot/cs_bot_weapon.cpp:437 */
bool CCSBot::IsUsingMachinegun() const
{
CBasePlayerWeapon *weapon = GetActiveWeapon();
@ -388,8 +365,6 @@ bool CCSBot::IsUsingMachinegun() const
}
// Return true if primary weapon doesn't exist or is totally out of ammo
/* <3ea532> ../cstrike/dlls/bot/cs_bot_weapon.cpp:449 */
bool CCSBot::IsPrimaryWeaponEmpty() const
{
CBasePlayerWeapon *weapon = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ]);
@ -405,8 +380,6 @@ bool CCSBot::IsPrimaryWeaponEmpty() const
}
// Return true if pistol doesn't exist or is totally out of ammo
/* <3ea578> ../cstrike/dlls/bot/cs_bot_weapon.cpp:467 */
bool CCSBot::IsPistolEmpty() const
{
CBasePlayerWeapon *weapon = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[ PISTOL_SLOT ]);
@ -424,8 +397,6 @@ bool CCSBot::IsPistolEmpty() const
}
// Equip the given item
/* <3ea5d9> ../cstrike/dlls/bot/cs_bot_weapon.cpp:485 */
bool CCSBot::DoEquip(CBasePlayerWeapon *gun)
{
if (gun == NULL)
@ -446,38 +417,35 @@ bool CCSBot::DoEquip(CBasePlayerWeapon *gun)
const float minEquipInterval = 5.0f;
// Equip the best weapon we are carrying that has ammo
/* <3ea621> ../cstrike/dlls/bot/cs_bot_weapon.cpp:510 */
void CCSBot::EquipBestWeapon(bool mustEquip)
{
// throttle how often equipping is allowed
if (!mustEquip && m_equipTimer.GetElapsedTime() < minEquipInterval)
return;
CCSBotManager *ctrl = TheCSBots();
CBasePlayerWeapon *primary = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ]);
if (primary != NULL)
{
WeaponClassType weaponClass = WeaponIDToWeaponClass(primary->m_iId);
if ((ctrl->AllowShotguns() && weaponClass == WEAPONCLASS_SHOTGUN)
|| (ctrl->AllowMachineGuns() && weaponClass == WEAPONCLASS_MACHINEGUN)
|| (ctrl->AllowRifles() && weaponClass == WEAPONCLASS_RIFLE)
if ((TheCSBots()->AllowShotguns() && weaponClass == WEAPONCLASS_SHOTGUN)
|| (TheCSBots()->AllowMachineGuns() && weaponClass == WEAPONCLASS_MACHINEGUN)
|| (TheCSBots()->AllowRifles() && weaponClass == WEAPONCLASS_RIFLE)
#ifndef REGAMEDLL_FIXES
// TODO: already is checked shotguns!
|| (ctrl->AllowShotguns() && weaponClass == WEAPONCLASS_SHOTGUN)
#endif // REGAMEDLL_FIXES
|| (ctrl->AllowSnipers() && weaponClass == WEAPONCLASS_SNIPERRIFLE)
|| (ctrl->AllowSubMachineGuns() && weaponClass == WEAPONCLASS_SUBMACHINEGUN)
|| (ctrl->AllowTacticalShield() && primary->m_iId == WEAPON_SHIELDGUN))
|| (TheCSBots()->AllowShotguns() && weaponClass == WEAPONCLASS_SHOTGUN)
#endif
|| (TheCSBots()->AllowSnipers() && weaponClass == WEAPONCLASS_SNIPERRIFLE)
|| (TheCSBots()->AllowSubMachineGuns() && weaponClass == WEAPONCLASS_SUBMACHINEGUN)
|| (TheCSBots()->AllowTacticalShield() && primary->m_iId == WEAPON_SHIELDGUN))
{
if (DoEquip(primary))
return;
}
}
if (ctrl->AllowPistols())
if (TheCSBots()->AllowPistols())
{
if (DoEquip(static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[ PISTOL_SLOT ])))
return;
@ -488,8 +456,6 @@ void CCSBot::EquipBestWeapon(bool mustEquip)
}
// Equip our pistol
/* <3ea7fe> ../cstrike/dlls/bot/cs_bot_weapon.cpp:557 */
void CCSBot::EquipPistol()
{
// throttle how often equipping is allowed
@ -504,8 +470,6 @@ void CCSBot::EquipPistol()
}
// Equip the knife
/* <3ea91a> ../cstrike/dlls/bot/cs_bot_weapon.cpp:575 */
void CCSBot::EquipKnife()
{
if (!IsUsingKnife())
@ -519,8 +483,6 @@ void CCSBot::EquipKnife()
}
// Return true if we have a grenade in our inventory
/* <3ea98b> ../cstrike/dlls/bot/cs_bot_weapon.cpp:589 */
bool CCSBot::HasGrenade() const
{
CBasePlayerWeapon *grenade = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[ GRENADE_SLOT ]);
@ -528,8 +490,6 @@ bool CCSBot::HasGrenade() const
}
// Equip a grenade, return false if we cant
/* <3ea9ae> ../cstrike/dlls/bot/cs_bot_weapon.cpp:598 */
bool CCSBot::EquipGrenade(bool noSmoke)
{
// snipers don't use grenades
@ -557,8 +517,6 @@ bool CCSBot::EquipGrenade(bool noSmoke)
}
// Returns true if we have knife equipped
/* <3eaa8c> ../cstrike/dlls/bot/cs_bot_weapon.cpp:624 */
bool CCSBot::IsUsingKnife() const
{
CBasePlayerWeapon *weapon = GetActiveWeapon();
@ -570,8 +528,6 @@ bool CCSBot::IsUsingKnife() const
}
// Returns true if we have pistol equipped
/* <3eaac2> ../cstrike/dlls/bot/cs_bot_weapon.cpp:638 */
bool CCSBot::IsUsingPistol() const
{
CBasePlayerWeapon *weapon = GetActiveWeapon();
@ -583,8 +539,6 @@ bool CCSBot::IsUsingPistol() const
}
// Returns true if we have a grenade equipped
/* <3eab09> ../cstrike/dlls/bot/cs_bot_weapon.cpp:652 */
bool CCSBot::IsUsingGrenade() const
{
CBasePlayerWeapon *weapon = GetActiveWeapon();
@ -600,7 +554,6 @@ bool CCSBot::IsUsingGrenade() const
return false;
}
/* <3eab3f> ../cstrike/dlls/bot/cs_bot_weapon.cpp:672 */
bool CCSBot::IsUsingHEGrenade() const
{
CBasePlayerWeapon *weapon = GetActiveWeapon();
@ -612,8 +565,6 @@ bool CCSBot::IsUsingHEGrenade() const
}
// Begin the process of throwing the grenade
/* <3eab80> ../cstrike/dlls/bot/cs_bot_weapon.cpp:690 */
void CCSBot::ThrowGrenade(const Vector *target)
{
if (IsUsingGrenade() && !m_isWaitingToTossGrenade)
@ -628,8 +579,6 @@ void CCSBot::ThrowGrenade(const Vector *target)
}
// Find spot to throw grenade ahead of us and "around the corner" along our path
/* <3eac08> ../cstrike/dlls/bot/cs_bot_weapon.cpp:709 */
bool CCSBot::FindGrenadeTossPathTarget(Vector *pos)
{
if (!HasPath())
@ -728,8 +677,6 @@ bool CCSBot::FindGrenadeTossPathTarget(Vector *pos)
}
// Reload our weapon if we must
/* <3eaf22> ../cstrike/dlls/bot/cs_bot_weapon.cpp:810 */
void CCSBot::ReloadCheck()
{
const float safeReloadWaitTime = 3.0f;
@ -802,8 +749,6 @@ void CCSBot::ReloadCheck()
}
// Silence/unsilence our weapon if we must
/* <3eb0ac> ../cstrike/dlls/bot/cs_bot_weapon.cpp:885 */
void CCSBot::SilencerCheck()
{
// longer than reload check because reloading should take precedence
@ -819,7 +764,7 @@ void CCSBot::SilencerCheck()
#ifdef REGAMEDLL_FIXES
if (GetTimeSinceLastSawEnemy() < safeSilencerWaitTime)
return;
#endif // REGAMEDLL_FIXES
#endif
// don't touch the silencer if there are enemies nearby
if (GetNearbyEnemyCount() == 0)
@ -839,7 +784,7 @@ void CCSBot::SilencerCheck()
// equip silencer if we want to and we don't have a shield.
if (isSilencerOn != (GetProfile()->PrefersSilencer() || GetProfile()->GetSkill() > 0.7f) && !HasShield())
#endif // REGAMEDLL_FIXES
#endif
{
PrintIfWatched("%s silencer!\n", (isSilencerOn) ? "Unequipping" : "Equipping");
myGun->SecondaryAttack();
@ -848,8 +793,6 @@ void CCSBot::SilencerCheck()
}
// Invoked when in contact with a CWeaponBox
/* <3eb1a9> ../cstrike/dlls/bot/cs_bot_weapon.cpp:926 */
void CCSBot::__MAKE_VHOOK(OnTouchingWeapon)(CWeaponBox *box)
{
CBasePlayerItem *droppedGun = dynamic_cast<CBasePlayerItem *>(box->m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ]);
@ -896,8 +839,6 @@ void CCSBot::__MAKE_VHOOK(OnTouchingWeapon)(CWeaponBox *box)
// Return true if a friend is in our weapon's way
// TODO: Check more rays for safety.
/* <3eb277> ../cstrike/dlls/bot/cs_bot_weapon.cpp:977 */
bool CCSBot::IsFriendInLineOfFire()
{
UTIL_MakeVectors(pev->punchangle + pev->v_angle);
@ -928,8 +869,6 @@ bool CCSBot::IsFriendInLineOfFire()
// Return line-of-sight distance to obstacle along weapon fire ray
// TODO: Re-use this computation with IsFriendInLineOfFire()
/* <3eb84d> ../cstrike/dlls/bot/cs_bot_weapon.cpp:1009 */
float CCSBot::ComputeWeaponSightRange()
{
UTIL_MakeVectors(pev->punchangle + pev->v_angle);

View File

@ -1,6 +1,5 @@
#include "precompiled.h"
/* <3fcd6b> ../cstrike/dlls/bot/cs_gamestate.cpp:27 */
CSGameState::CSGameState(CCSBot *owner)
{
m_owner = owner;
@ -29,20 +28,16 @@ CSGameState::CSGameState(CCSBot *owner)
}
// Reset at round start
/* <3fd4f4> ../cstrike/dlls/bot/cs_gamestate.cpp:55 */
void CSGameState::Reset()
{
int i;
CCSBotManager *ctrl = TheCSBots();
m_isRoundOver = false;
// bomb
m_bombState = MOVING;
m_lastSawBomber.Invalidate();
m_lastSawLooseBomb.Invalidate();
m_bombsiteCount = ctrl->GetZoneCount();
m_bombsiteCount = TheCSBots()->GetZoneCount();
m_isPlantedBombPosKnown = false;
m_plantedBombsite = UNKNOWN;
@ -70,8 +65,6 @@ void CSGameState::Reset()
}
// Update game state based on events we have received
/* <3fce67> ../cstrike/dlls/bot/cs_gamestate.cpp:97 */
void CSGameState::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
{
switch (event)
@ -103,14 +96,11 @@ void CSGameState::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity
}
// True if round has been won or lost (but not yet reset)
/* <3fcf9c> ../cstrike/dlls/bot/cs_gamestate.cpp:144 */
bool CSGameState::IsRoundOver() const
{
return m_isRoundOver;
}
/* <3fcfc6> ../cstrike/dlls/bot/cs_gamestate.cpp:150 */
void CSGameState::SetBombState(BombState state)
{
// if state changed, reset "last seen" timestamps
@ -120,7 +110,6 @@ void CSGameState::SetBombState(BombState state)
}
}
/* <3fcff2> ../cstrike/dlls/bot/cs_gamestate.cpp:160 */
void CSGameState::UpdateLooseBomb(const Vector *pos)
{
m_looseBombPos = *pos;
@ -130,13 +119,11 @@ void CSGameState::UpdateLooseBomb(const Vector *pos)
SetBombState(LOOSE);
}
/* <3fd06e> ../cstrike/dlls/bot/cs_gamestate.cpp:170 */
float CSGameState::TimeSinceLastSawLooseBomb() const
{
return m_lastSawLooseBomb.GetElapsedTime();
}
/* <3fd0f4> ../cstrike/dlls/bot/cs_gamestate.cpp:176 */
bool CSGameState::IsLooseBombLocationKnown() const
{
if (m_bombState != LOOSE)
@ -145,7 +132,6 @@ bool CSGameState::IsLooseBombLocationKnown() const
return (m_lastSawLooseBomb.HasStarted()) ? true : false;
}
/* <3fd135> ../cstrike/dlls/bot/cs_gamestate.cpp:185 */
void CSGameState::UpdateBomber(const Vector *pos)
{
m_bomberPos = *pos;
@ -155,13 +141,11 @@ void CSGameState::UpdateBomber(const Vector *pos)
SetBombState(MOVING);
}
/* <3fd1b1> ../cstrike/dlls/bot/cs_gamestate.cpp:195 */
float CSGameState::TimeSinceLastSawBomber() const
{
return m_lastSawBomber.GetElapsedTime();
}
/* <3fd237> ../cstrike/dlls/bot/cs_gamestate.cpp:201 */
bool CSGameState::IsPlantedBombLocationKnown() const
{
if (m_bombState != PLANTED)
@ -171,8 +155,6 @@ bool CSGameState::IsPlantedBombLocationKnown() const
}
// Return the zone index of the planted bombsite, or UNKNOWN
/* <3fd25a> ../cstrike/dlls/bot/cs_gamestate.cpp:213 */
int CSGameState::GetPlantedBombsite() const
{
if (m_bombState != PLANTED)
@ -182,15 +164,12 @@ int CSGameState::GetPlantedBombsite() const
}
// Return true if we are currently in the bombsite where the bomb is planted
/* <3fd284> ../cstrike/dlls/bot/cs_gamestate.cpp:225 */
bool CSGameState::IsAtPlantedBombsite() const
{
if (m_bombState != PLANTED)
return false;
CCSBotManager *ctrl = TheCSBots();
const CCSBotManager::Zone *zone = ctrl->GetClosestZone(&m_owner->pev->origin);
const CCSBotManager::Zone *zone = TheCSBots()->GetClosestZone(&m_owner->pev->origin);
if (zone != NULL)
{
@ -201,8 +180,6 @@ bool CSGameState::IsAtPlantedBombsite() const
}
// Return the zone index of the next bombsite to search
/* <3fd2d2> ../cstrike/dlls/bot/cs_gamestate.cpp:246 */
int CSGameState::GetNextBombsiteToSearch()
{
if (m_bombsiteCount <= 0)
@ -232,8 +209,6 @@ int CSGameState::GetNextBombsiteToSearch()
// Returns position of bomb in its various states (moving, loose, planted),
// or NULL if we don't know where the bomb is
/* <3fd32c> ../cstrike/dlls/bot/cs_gamestate.cpp:277 */
const Vector *CSGameState::GetBombPosition() const
{
switch (m_bombState)
@ -265,12 +240,9 @@ const Vector *CSGameState::GetBombPosition() const
}
// We see the planted bomb at 'pos'
/* <3fd373> ../cstrike/dlls/bot/cs_gamestate.cpp:313 */
void CSGameState::UpdatePlantedBomb(const Vector *pos)
{
CCSBotManager *ctrl = TheCSBots();
const CCSBotManager::Zone *zone = ctrl->GetClosestZone(pos);
const CCSBotManager::Zone *zone = TheCSBots()->GetClosestZone(pos);
if (zone == NULL)
{
@ -288,8 +260,6 @@ void CSGameState::UpdatePlantedBomb(const Vector *pos)
}
// Someone told us where the bomb is planted
/* <3fd3dd> ../cstrike/dlls/bot/cs_gamestate.cpp:337 */
void CSGameState::MarkBombsiteAsPlanted(int zoneIndex)
{
m_plantedBombsite = zoneIndex;
@ -297,15 +267,12 @@ void CSGameState::MarkBombsiteAsPlanted(int zoneIndex)
}
// Someone told us a bombsite is clear
/* <3fd43a> ../cstrike/dlls/bot/cs_gamestate.cpp:347 */
void CSGameState::ClearBombsite(int zoneIndex)
{
if (zoneIndex >= 0 && zoneIndex < m_bombsiteCount)
m_isBombsiteClear[zoneIndex] = true;
}
/* <3fd475> ../cstrike/dlls/bot/cs_gamestate.cpp:354 */
bool CSGameState::IsBombsiteClear(int zoneIndex) const
{
if (zoneIndex >= 0 && zoneIndex < m_bombsiteCount)
@ -314,7 +281,6 @@ bool CSGameState::IsBombsiteClear(int zoneIndex) const
return false;
}
/* <3fd4b0> ../cstrike/dlls/bot/cs_gamestate.cpp:367 */
void CSGameState::InitializeHostageInfo()
{
m_hostageCount = 0;
@ -345,8 +311,6 @@ void CSGameState::InitializeHostageInfo()
// If NULL is returned, we don't think there are any hostages left, or we dont know where they are.
// NOTE: a T can remember a hostage who has died. knowPos will be filled in, but NULL will be
// returned, since CHostages get deleted when they die.
/* <3fd5ab> ../cstrike/dlls/bot/cs_gamestate.cpp:398 */
CHostage *CSGameState::GetNearestFreeHostage(Vector *knowPos) const
{
if (m_owner == NULL)
@ -412,8 +376,6 @@ CHostage *CSGameState::GetNearestFreeHostage(Vector *knowPos) const
}
// Return the location of a "free" hostage, or NULL if we dont know of any
/* <3fdbd3> ../cstrike/dlls/bot/cs_gamestate.cpp:461 */
const Vector *CSGameState::GetRandomFreeHostagePosition()
{
// TODO: use static?
@ -460,8 +422,6 @@ const Vector *CSGameState::GetRandomFreeHostagePosition()
// If we can see any of the positions where we think a hostage is, validate it
// Return status of any changes (a hostage died or was moved)
/* <3fdcd2> ../cstrike/dlls/bot/cs_gamestate.cpp:509 */
CSGameState::ValidateStatusType CSGameState::ValidateHostagePositions()
{
// limit how often we validate
@ -578,8 +538,6 @@ CSGameState::ValidateStatusType CSGameState::ValidateHostagePositions()
// Return the nearest visible free hostage
// Since we can actually see any hostage we return, we know its actual position
/* <3fdef7> ../cstrike/dlls/bot/cs_gamestate.cpp:626 */
CHostage *CSGameState::GetNearestVisibleFreeHostage() const
{
CHostage *close = NULL;
@ -621,8 +579,6 @@ CHostage *CSGameState::GetNearestVisibleFreeHostage() const
}
// Return true if there are no free hostages
/* <3fe064> ../cstrike/dlls/bot/cs_gamestate.cpp:668 */
bool CSGameState::AreAllHostagesBeingRescued() const
{
// if the hostages have all been rescued, they are not being rescued any longer
@ -664,8 +620,6 @@ bool CSGameState::AreAllHostagesBeingRescued() const
}
// All hostages have been rescued or are dead
/* <3fe148> ../cstrike/dlls/bot/cs_gamestate.cpp:712 */
bool CSGameState::AreAllHostagesGone() const
{
if (m_allHostagesRescued)
@ -693,8 +647,6 @@ bool CSGameState::AreAllHostagesGone() const
}
// Someone told us all the hostages are gone
/* <3fe1a2> ../cstrike/dlls/bot/cs_gamestate.cpp:742 */
void CSGameState::AllHostagesGone()
{
for (int i = 0; i < m_hostageCount; ++i)

View File

@ -105,7 +105,7 @@ public:
#ifndef HOOK_GAMEDLL
private:
#endif // HOOK_GAMEDLL
#endif
CCSBot *m_owner; // who owns this gamestate
bool m_isRoundOver; // true if round is over, but no yet reset
@ -141,10 +141,10 @@ private:
bool isAlive;
bool isFree; // not being escorted by a CT
}
m_hostage[ MAX_HOSTAGES ];
m_hostage[MAX_HOSTAGES];
int m_hostageCount; // number of hostages left in map
CountdownTimer m_validateInterval;
NOXREF CBaseEntity *GetNearestHostage() const; // return the closest live hostage
CBaseEntity *GetNearestHostage() const; // return the closest live hostage
void InitializeHostageInfo(); // initialize our knowledge of the number and location of hostages
bool m_allHostagesRescued; // if true, so every hostages been is rescued

View File

@ -1,8 +1,6 @@
#include "precompiled.h"
// Begin attacking
/* <519735> ../cstrike/dlls/bot/states/cs_bot_attack.cpp:16 */
void AttackState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
{
CBasePlayer *enemy = me->GetEnemy();
@ -113,7 +111,6 @@ void AttackState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
m_isCoward = (RANDOM_FLOAT(0.0f, 100.0f) > 100.0f * me->GetProfile()->GetAggression());
}
/* <51a140> ../cstrike/dlls/bot/states/cs_bot_attack.cpp:135 */
void AttackState::StopAttacking(CCSBot *me)
{
if (me->m_task == CCSBot::SNIPING)
@ -128,8 +125,6 @@ void AttackState::StopAttacking(CCSBot *me)
}
// Perform attack behavior
/* <51997e> ../cstrike/dlls/bot/states/cs_bot_attack.cpp:152 */
void AttackState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
// can't be stuck while attacking
@ -540,8 +535,6 @@ void AttackState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
}
// Finish attack
/* <5198d4> ../cstrike/dlls/bot/states/cs_bot_attack.cpp:578 */
void AttackState::__MAKE_VHOOK(OnExit)(CCSBot *me)
{
me->PrintIfWatched("AttackState:OnExit()\n");

View File

@ -1,6 +1,5 @@
#include "precompiled.h"
/* <5291fd> ../cstrike/dlls/bot/states/cs_bot_buy.cpp:18 */
bool HasDefaultPistol(CCSBot *me)
{
CBasePlayerWeapon *pistol = static_cast<CBasePlayerWeapon *>(me->m_rgpPlayerItems[ PISTOL_SLOT ]);
@ -18,12 +17,8 @@ bool HasDefaultPistol(CCSBot *me)
}
// Buy weapons, armor, etc.
/* <5299e4> ../cstrike/dlls/bot/states/cs_bot_buy.cpp:37 */
void BuyState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
{
CCSBotManager *ctrl = TheCSBots();
m_retries = 0;
m_prefRetries = 0;
m_prefIndex = 0;
@ -39,10 +34,10 @@ void BuyState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
if (me->m_iTeam == CT)
{
if (ctrl->GetScenario() == CCSBotManager::SCENARIO_DEFUSE_BOMB)
if (TheCSBots()->GetScenario() == CCSBotManager::SCENARIO_DEFUSE_BOMB)
{
// CT's sometimes buy defuse kits in the bomb scenario (except in career mode, where the player should defuse)
if (g_pGameRules->IsCareer() == false)
if (!CSGameRules()->IsCareer())
{
const float buyDefuseKitChance = 50.0f; // 100.0f * (me->GetProfile()->GetSkill() + 0.2f);
if (RANDOM_FLOAT(0.0f, 100.0f) < buyDefuseKitChance)
@ -53,7 +48,7 @@ void BuyState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
}
// determine if we want a tactical shield
if (!me->m_bHasPrimary && ctrl->AllowTacticalShield())
if (!me->m_bHasPrimary && TheCSBots()->AllowTacticalShield())
{
if (me->m_iAccount > 2500)
{
@ -65,7 +60,7 @@ void BuyState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
}
}
if (ctrl->AllowGrenades())
if (TheCSBots()->AllowGrenades())
{
m_buyGrenade = (RANDOM_FLOAT(0.0f, 100.0f) < 33.3f) ? true : false;
}
@ -76,7 +71,7 @@ void BuyState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
m_buyPistol = false;
if (ctrl->AllowPistols())
if (TheCSBots()->AllowPistols())
{
CBasePlayerWeapon *pistol = static_cast<CBasePlayerWeapon *>(me->m_rgpPlayerItems[ PISTOL_SLOT ]);
@ -87,12 +82,12 @@ void BuyState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
if (HasDefaultPistol(me))
{
// if everything other than pistols is disallowed, buy a pistol
if (ctrl->AllowShotguns() == false &&
ctrl->AllowSubMachineGuns() == false &&
ctrl->AllowRifles() == false &&
ctrl->AllowMachineGuns() == false &&
ctrl->AllowTacticalShield() == false &&
ctrl->AllowSnipers() == false)
if (TheCSBots()->AllowShotguns() == false &&
TheCSBots()->AllowSubMachineGuns() == false &&
TheCSBots()->AllowRifles() == false &&
TheCSBots()->AllowMachineGuns() == false &&
TheCSBots()->AllowTacticalShield() == false &&
TheCSBots()->AllowSnipers() == false)
{
m_buyPistol = (RANDOM_FLOAT(0, 100) < 75.0f);
}
@ -201,8 +196,6 @@ BuyInfo secondaryWeaponBuyInfoT[ SECONDARY_WEAPON_BUY_COUNT ];
#endif // HOOK_GAMEDLL
// Given a weapon alias, return the kind of weapon it is
/* <52972b> ../cstrike/dlls/bot/states/cs_bot_buy.cpp:212 */
inline WeaponType GetWeaponType(const char *alias)
{
int i;
@ -227,7 +220,6 @@ inline WeaponType GetWeaponType(const char *alias)
return NUM_WEAPON_TYPES;
}
/* <529753> ../cstrike/dlls/bot/states/cs_bot_buy.cpp:241 */
void BuyState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
// wait for a Navigation Mesh
@ -247,11 +239,22 @@ void BuyState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
// if we're done buying and still in the freeze period, wait
if (m_doneBuying)
{
if (g_pGameRules->IsMultiplayer() && g_pGameRules->IsFreezePeriod())
if (CSGameRules()->IsMultiplayer() && CSGameRules()->IsFreezePeriod())
{
#ifdef REGAMEDLL_FIXES
// make sure we're locked and loaded
me->EquipBestWeapon(MUST_EQUIP);
me->Reload();
me->ResetStuckMonitor();
#endif
return;
}
me->Idle();
//return;
#ifdef REGAMEDLL_FIXES
return;
#endif
}
// is the bot spawned outside of a buy zone?
@ -262,8 +265,6 @@ void BuyState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
return;
}
CCSBotManager *ctrl = TheCSBots();
// try to buy some weapons
const float buyInterval = 0.2f; // 0.02f
if (gpGlobals->time - me->GetStateTimestamp() > buyInterval)
@ -307,7 +308,7 @@ void BuyState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
if (weaponPreference == WEAPON_SHIELDGUN)
{
if (ctrl->AllowTacticalShield())
if (TheCSBots()->AllowTacticalShield())
buyAlias = "shield";
}
else
@ -318,27 +319,27 @@ void BuyState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
switch (type)
{
case PISTOL:
if (!ctrl->AllowPistols())
if (!TheCSBots()->AllowPistols())
buyAlias = NULL;
break;
case SHOTGUN:
if (!ctrl->AllowShotguns())
if (!TheCSBots()->AllowShotguns())
buyAlias = NULL;
break;
case SUB_MACHINE_GUN:
if (!ctrl->AllowSubMachineGuns())
if (!TheCSBots()->AllowSubMachineGuns())
buyAlias = NULL;
break;
case RIFLE:
if (!ctrl->AllowRifles())
if (!TheCSBots()->AllowRifles())
buyAlias = NULL;
break;
case MACHINE_GUN:
if (!ctrl->AllowMachineGuns())
if (!TheCSBots()->AllowMachineGuns())
buyAlias = NULL;
break;
case SNIPER_RIFLE:
if (!ctrl->AllowSnipers())
if (!TheCSBots()->AllowSnipers())
buyAlias = NULL;
break;
}
@ -382,11 +383,11 @@ void BuyState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
for (int i = 0; i < PRIMARY_WEAPON_BUY_COUNT; ++i)
{
if ((masterPrimary[i].type == SHOTGUN && ctrl->AllowShotguns()) ||
(masterPrimary[i].type == SUB_MACHINE_GUN && ctrl->AllowSubMachineGuns()) ||
(masterPrimary[i].type == RIFLE && ctrl->AllowRifles()) ||
(masterPrimary[i].type == SNIPER_RIFLE && ctrl->AllowSnipers() && wantSniper) ||
(masterPrimary[i].type == MACHINE_GUN && ctrl->AllowMachineGuns()))
if ((masterPrimary[i].type == SHOTGUN && TheCSBots()->AllowShotguns()) ||
(masterPrimary[i].type == SUB_MACHINE_GUN && TheCSBots()->AllowSubMachineGuns()) ||
(masterPrimary[i].type == RIFLE && TheCSBots()->AllowRifles()) ||
(masterPrimary[i].type == SNIPER_RIFLE && TheCSBots()->AllowSnipers() && wantSniper) ||
(masterPrimary[i].type == MACHINE_GUN && TheCSBots()->AllowMachineGuns()))
{
stockPrimary[ stockPrimaryCount++ ] = &masterPrimary[i];
}
@ -398,7 +399,7 @@ void BuyState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
int which;
// on hard difficulty levels, bots try to buy preferred weapons on the first pass
if (m_retries == 0 && ctrl->GetDifficultyLevel() >= BOT_HARD)
if (m_retries == 0 && TheCSBots()->GetDifficultyLevel() >= BOT_HARD)
{
// count up available preferred weapons
int prefCount = 0;
@ -448,7 +449,7 @@ void BuyState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
me->ClientCommand("vest");
// pistols - if we have no preferred pistol, buy at random
if (ctrl->AllowPistols() && !me->GetProfile()->HasPistolPreference())
if (TheCSBots()->AllowPistols() && !me->GetProfile()->HasPistolPreference())
{
if (m_buyPistol)
{
@ -515,7 +516,6 @@ void BuyState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
}
}
/* <5296f1> ../cstrike/dlls/bot/states/cs_bot_buy.cpp:529 */
void BuyState::__MAKE_VHOOK(OnExit)(CCSBot *me)
{
me->ResetStuckMonitor();

View File

@ -1,8 +1,6 @@
#include "precompiled.h"
// Begin defusing the bomb
/* <539f0e> ../cstrike/dlls/bot/states/cs_bot_defuse_bomb.cpp:16 */
void DefuseBombState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
{
me->Crouch();
@ -11,12 +9,9 @@ void DefuseBombState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
}
// Defuse the bomb
/* <539eac> ../cstrike/dlls/bot/states/cs_bot_defuse_bomb.cpp:27 */
void DefuseBombState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
const Vector *bombPos = me->GetGameState()->GetBombPosition();
CCSBotManager *ctrl = TheCSBots();
if (bombPos == NULL)
{
@ -34,13 +29,13 @@ void DefuseBombState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
if (gpGlobals->time - me->GetStateTimestamp() > 1.0f)
{
// if we missed starting the defuse, give up
if (ctrl->GetBombDefuser() == NULL)
if (TheCSBots()->GetBombDefuser() == NULL)
{
me->PrintIfWatched("Failed to start defuse, giving up\n");
me->Idle();
return;
}
else if (ctrl->GetBombDefuser() != me)
else if (TheCSBots()->GetBombDefuser() != me)
{
// if someone else got the defuse, give up
me->PrintIfWatched("Someone else started defusing, giving up\n");
@ -50,14 +45,13 @@ void DefuseBombState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
}
// if bomb has been defused, give up
if (!ctrl->IsBombPlanted())
if (!TheCSBots()->IsBombPlanted())
{
me->Idle();
return;
}
}
/* <539e36> ../cstrike/dlls/bot/states/cs_bot_defuse_bomb.cpp:73 */
void DefuseBombState::__MAKE_VHOOK(OnExit)(CCSBot *me)
{
me->StandUp();

View File

@ -1,6 +1,5 @@
#include "precompiled.h"
/* <5499ae> ../cstrike/dlls/bot/states/cs_bot_escape_from_bomb.cpp:16 */
void EscapeFromBombState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
{
me->StandUp();
@ -10,8 +9,6 @@ void EscapeFromBombState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
}
// Escape from the bomb
/* <549be9> ../cstrike/dlls/bot/states/cs_bot_escape_from_bomb.cpp:28 */
void EscapeFromBombState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
const Vector *bombPos = me->GetGameState()->GetBombPosition();
@ -40,7 +37,6 @@ void EscapeFromBombState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
}
}
/* <549976> ../cstrike/dlls/bot/states/cs_bot_escape_from_bomb.cpp:60 */
void EscapeFromBombState::__MAKE_VHOOK(OnExit)(CCSBot *me)
{
me->EquipBestWeapon();

View File

@ -1,16 +1,12 @@
#include "precompiled.h"
// Move to the bomb on the floor and pick it up
/* <5587b3> ../cstrike/dlls/bot/states/cs_bot_fetch_bomb.cpp:17 */
void FetchBombState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
{
me->DestroyPath();
}
// Move to the bomb on the floor and pick it up
/* <5587fa> ../cstrike/dlls/bot/states/cs_bot_fetch_bomb.cpp:26 */
void FetchBombState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
if (me->IsCarryingBomb())

View File

@ -1,8 +1,6 @@
#include "precompiled.h"
// Follow our leader
/* <56918b> ../cstrike/dlls/bot/states/cs_bot_follow.cpp:16 */
void FollowState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
{
me->StandUp();
@ -32,8 +30,6 @@ void FollowState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
}
// Determine the leader's motion state by tracking his speed
/* <569268> ../cstrike/dlls/bot/states/cs_bot_follow.cpp:48 */
void FollowState::ComputeLeaderMotionState(float leaderSpeed)
{
// walk = 130, run = 250
@ -76,8 +72,6 @@ void FollowState::ComputeLeaderMotionState(float leaderSpeed)
// Follow our leader
// TODO: Clean up this nasty mess
/* <569368> ../cstrike/dlls/bot/states/cs_bot_follow.cpp:164 */
void FollowState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
// if we lost our leader, give up
@ -260,7 +254,6 @@ void FollowState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
}
}
/* <569231> ../cstrike/dlls/bot/states/cs_bot_follow.cpp:353 */
void FollowState::__MAKE_VHOOK(OnExit)(CCSBot *me)
{
;

View File

@ -2,8 +2,6 @@
// Begin moving to a nearby hidey-hole.
// NOTE: Do not forget this state may include a very long "move-to" time to get to our hidey spot!
/* <57c261> ../cstrike/dlls/bot/states/cs_bot_hide.cpp:22 */
void HideState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
{
m_isAtSpot = false;
@ -42,12 +40,8 @@ void HideState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
// Move to a nearby hidey-hole.
// NOTE: Do not forget this state may include a very long "move-to" time to get to our hidey spot!
/* <57c35e> ../cstrike/dlls/bot/states/cs_bot_hide.cpp:59 */
void HideState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
CCSBotManager *ctrl = TheCSBots();
// wait until finished reloading to leave hide state
if (!me->IsActiveWeaponReloading())
{
@ -56,16 +50,16 @@ void HideState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
if (me->GetTask() == CCSBot::GUARD_LOOSE_BOMB)
{
// if we're guarding the loose bomb, continue to guard it but pick a new spot
me->Hide(ctrl->GetLooseBombArea());
me->Hide(TheCSBots()->GetLooseBombArea());
return;
}
else if (me->GetTask() == CCSBot::GUARD_BOMB_ZONE)
{
// if we're guarding a bombsite, continue to guard it but pick a new spot
const CCSBotManager::Zone *zone = ctrl->GetClosestZone(&me->pev->origin);
const CCSBotManager::Zone *zone = TheCSBots()->GetClosestZone(&me->pev->origin);
if (zone != NULL)
{
CNavArea *area = ctrl->GetRandomAreaInZone(zone);
CNavArea *area = TheCSBots()->GetRandomAreaInZone(zone);
if (area != NULL)
{
me->Hide(area);
@ -117,7 +111,7 @@ void HideState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
// TODO: Perhaps tie in to TakeDamage(), so it works for human players, too
// Scenario logic
switch (ctrl->GetScenario())
switch (TheCSBots()->GetScenario())
{
case CCSBotManager::SCENARIO_DEFUSE_BOMB:
{
@ -125,22 +119,22 @@ void HideState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
// if we are just holding position (due to a radio order) and the bomb has just planted, go defuse it
if (me->GetTask() == CCSBot::HOLD_POSITION &&
ctrl->IsBombPlanted() &&
ctrl->GetBombPlantTimestamp() > me->GetStateTimestamp())
TheCSBots()->IsBombPlanted() &&
TheCSBots()->GetBombPlantTimestamp() > me->GetStateTimestamp())
{
me->Idle();
return;
}
// if we are guarding the defuser and he dies/gives up, stop hiding (to choose another defuser)
if (me->GetTask() == CCSBot::GUARD_BOMB_DEFUSER && ctrl->GetBombDefuser() == NULL)
if (me->GetTask() == CCSBot::GUARD_BOMB_DEFUSER && TheCSBots()->GetBombDefuser() == NULL)
{
me->Idle();
return;
}
// if we are guarding the loose bomb and it is picked up, stop hiding
if (me->GetTask() == CCSBot::GUARD_LOOSE_BOMB && ctrl->GetLooseBomb() == NULL)
if (me->GetTask() == CCSBot::GUARD_LOOSE_BOMB && TheCSBots()->GetLooseBomb() == NULL)
{
me->GetChatter()->TheyPickedUpTheBomb();
me->Idle();
@ -155,7 +149,7 @@ void HideState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
}
// if we are guarding (bombsite, initial encounter, etc) and the bomb is planted, go defuse it
if (me->IsDoingScenario() && me->GetTask() == CCSBot::GUARD_BOMB_ZONE && ctrl->IsBombPlanted())
if (me->IsDoingScenario() && me->GetTask() == CCSBot::GUARD_BOMB_ZONE && TheCSBots()->IsBombPlanted())
{
me->Idle();
return;
@ -166,16 +160,16 @@ void HideState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
else
{
// if we are near the ticking bomb and someone starts defusing it, attack!
if (ctrl->GetBombDefuser())
if (TheCSBots()->GetBombDefuser())
{
Vector toDefuser = ctrl->GetBombDefuser()->pev->origin;
Vector toDefuser = TheCSBots()->GetBombDefuser()->pev->origin;
const float hearDefuseRange = 2000.0f;
if ((toDefuser - me->pev->origin).IsLengthLessThan(hearDefuseRange))
{
// if we are nearby, attack, otherwise move to the bomb (which will cause us to attack when we see defuser)
if (me->CanSeePlantedBomb())
{
me->Attack(ctrl->GetBombDefuser());
me->Attack(TheCSBots()->GetBombDefuser());
}
else
{
@ -286,16 +280,16 @@ void HideState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
if (me->m_iTeam == CT)
{
if (me->GetTask() == CCSBot::GUARD_BOMB_ZONE && me->IsAtHidingSpot() && ctrl->IsBombPlanted())
if (me->GetTask() == CCSBot::GUARD_BOMB_ZONE && me->IsAtHidingSpot() && TheCSBots()->IsBombPlanted())
{
if (me->GetNearbyEnemyCount() == 0)
{
const float someTime = 30.0f;
const float littleTime = 11.0;
if (ctrl->GetBombTimeLeft() > someTime)
if (TheCSBots()->GetBombTimeLeft() > someTime)
me->GetChatter()->Encourage("BombsiteSecure", RANDOM_FLOAT(10.0f, 15.0f));
else if (ctrl->GetBombTimeLeft() > littleTime)
else if (TheCSBots()->GetBombTimeLeft() > littleTime)
me->GetChatter()->Encourage("WaitingForHumanToDefuseBomb", RANDOM_FLOAT(5.0f, 8.0f));
else
me->GetChatter()->Encourage("WaitingForHumanToDefuseBombPanic", RANDOM_FLOAT(3.0f, 4.0f));
@ -401,9 +395,15 @@ void HideState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
me->PrintIfWatched("No available hiding spots - hiding where I'm at.\n");
// hide where we are
#ifndef REGAMEDLL_FIXES
m_hidingSpot.x = me->pev->origin.x;
m_hidingSpot.x = me->pev->origin.y;
m_hidingSpot.z = me->GetFeetZ();
#else
m_hidingSpot.x = me->pev->origin.x;
m_hidingSpot.y = me->pev->origin.y;
m_hidingSpot.z = me->GetFeetZ();
#endif
}
else
{
@ -421,7 +421,6 @@ void HideState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
}
}
/* <57c2c8> ../cstrike/dlls/bot/states/cs_bot_hide.cpp:450 */
void HideState::__MAKE_VHOOK(OnExit)(CCSBot *me)
{
m_isHoldingPosition = false;

View File

@ -1,8 +1,6 @@
#include "precompiled.h"
// Begin the hunt
/* <58e6e0> ../cstrike/dlls/bot/states/cs_bot_hunt.cpp:18 */
void HuntState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
{
// lurking death
@ -18,8 +16,6 @@ void HuntState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
}
// Hunt down our enemies
/* <58e452> ../cstrike/dlls/bot/states/cs_bot_hunt.cpp:38 */
void HuntState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
// if we've been hunting for a long time, drop into Idle for a moment to
@ -34,10 +30,8 @@ void HuntState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
return;
}
CCSBotManager *ctrl = TheCSBots();
// scenario logic
if (ctrl->GetScenario() == CCSBotManager::SCENARIO_DEFUSE_BOMB)
if (TheCSBots()->GetScenario() == CCSBotManager::SCENARIO_DEFUSE_BOMB)
{
if (me->m_iTeam == TERRORIST)
{
@ -45,7 +39,7 @@ void HuntState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
if (me->IsCarryingBomb())
{
const float safeTime = 3.0f;
if (ctrl->IsTimeToPlantBomb() || (me->IsAtBombsite() && gpGlobals->time - me->GetLastSawEnemyTimestamp() > safeTime))
if (TheCSBots()->IsTimeToPlantBomb() || (me->IsAtBombsite() && gpGlobals->time - me->GetLastSawEnemyTimestamp() > safeTime))
{
me->Idle();
return;
@ -75,14 +69,14 @@ void HuntState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
// if we are near the loose bomb and can see it, hide nearby and guard it
me->SetTask(CCSBot::GUARD_LOOSE_BOMB);
me->Hide(ctrl->GetLooseBombArea());
me->GetChatter()->AnnouncePlan("GoingToGuardLooseBomb", ctrl->GetLooseBombArea()->GetPlace());
me->Hide(TheCSBots()->GetLooseBombArea());
me->GetChatter()->AnnouncePlan("GoingToGuardLooseBomb", TheCSBots()->GetLooseBombArea()->GetPlace());
return;
}
else if (ctrl->IsBombPlanted())
else if (TheCSBots()->IsBombPlanted())
{
// rogues will defuse a bomb, but not guard the defuser
if (!me->IsRogue() || !ctrl->GetBombDefuser())
if (!me->IsRogue() || !TheCSBots()->GetBombDefuser())
{
// search for the planted bomb to defuse
me->Idle();
@ -91,7 +85,7 @@ void HuntState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
}
}
}
else if (ctrl->GetScenario() == CCSBotManager::SCENARIO_RESCUE_HOSTAGES)
else if (TheCSBots()->GetScenario() == CCSBotManager::SCENARIO_RESCUE_HOSTAGES)
{
if (me->m_iTeam == TERRORIST)
{
@ -194,8 +188,6 @@ void HuntState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
}
// Done hunting
/* <58e418> ../cstrike/dlls/bot/states/cs_bot_hunt.cpp:211 */
void HuntState::__MAKE_VHOOK(OnExit)(CCSBot *me)
{
;

View File

@ -6,8 +6,6 @@ const float sniperHideRange = 2000.0f;
// The Idle state.
// We never stay in the Idle state - it is a "home base" for the state machine that
// does various checks to determine what we should do next.
/* <5a12ee> ../cstrike/dlls/bot/states/cs_bot_idle.cpp:26 */
void IdleState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
{
me->DestroyPath();
@ -22,7 +20,6 @@ void IdleState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
me->SetDisposition(CCSBot::ENGAGE_AND_INVESTIGATE);
}
/* <5a0c66> ../cstrike/dlls/bot/states/cs_bot_idle.cpp:46 */
void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
// all other states assume GetLastKnownArea() is valid, ensure that it is
@ -50,19 +47,17 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
}
}
CCSBotManager *ctrl = TheCSBots();
// if round is over, hunt
if (me->GetGameState()->IsRoundOver())
{
// if we are escorting hostages, try to get to the rescue zone
if (me->GetHostageEscortCount())
{
const CCSBotManager::Zone *zone = ctrl->GetClosestZone(me->GetLastKnownArea(), PathCost(me, FASTEST_ROUTE));
const CCSBotManager::Zone *zone = TheCSBots()->GetClosestZone(me->GetLastKnownArea(), PathCost(me, FASTEST_ROUTE));
me->SetTask(CCSBot::RESCUE_HOSTAGES);
me->Run();
me->SetDisposition(CCSBot::SELF_DEFENSE);
me->MoveTo(ctrl->GetRandomPositionInZone(zone), FASTEST_ROUTE);
me->MoveTo(TheCSBots()->GetRandomPositionInZone(zone), FASTEST_ROUTE);
me->PrintIfWatched("Trying to rescue hostages at the end of the round\n");
return;
}
@ -82,7 +77,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
}
// Scenario logic
switch (ctrl->GetScenario())
switch (TheCSBots()->GetScenario())
{
case CCSBotManager::SCENARIO_DEFUSE_BOMB:
{
@ -97,7 +92,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
if (me->GetGameState()->GetPlantedBombsite() != CSGameState::UNKNOWN)
{
// T's always know where the bomb is - go defend it
const CCSBotManager::Zone *zone = ctrl->GetZone(me->GetGameState()->GetPlantedBombsite());
const CCSBotManager::Zone *zone = TheCSBots()->GetZone(me->GetGameState()->GetPlantedBombsite());
me->SetTask(CCSBot::GUARD_TICKING_BOMB);
Place place = TheNavAreaGrid.GetPlace(&zone->m_center);
@ -125,7 +120,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
int zoneIndex = me->GetGameState()->GetNextBombsiteToSearch();
// move to bombsite - if we reach it, we'll update its cleared status, causing us to select another
const Vector *pos = ctrl->GetRandomPositionInZone(ctrl->GetZone(zoneIndex));
const Vector *pos = TheCSBots()->GetRandomPositionInZone(TheCSBots()->GetZone(zoneIndex));
if (pos != NULL)
{
me->SetTask(CCSBot::FIND_TICKING_BOMB);
@ -148,14 +143,14 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
return;
}
else if (ctrl->IsTimeToPlantBomb())
else if (TheCSBots()->IsTimeToPlantBomb())
{
// move to the closest bomb site
const CCSBotManager::Zone *zone = ctrl->GetClosestZone(me->GetLastKnownArea(), PathCost(me));
const CCSBotManager::Zone *zone = TheCSBots()->GetClosestZone(me->GetLastKnownArea(), PathCost(me));
if (zone != NULL)
{
// pick a random spot within the bomb zone
const Vector *pos = ctrl->GetRandomPositionInZone(zone);
const Vector *pos = TheCSBots()->GetRandomPositionInZone(zone);
if (pos != NULL)
{
// move to bombsite
@ -210,7 +205,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
if (bombPos != NULL)
{
// if someone is defusing the bomb, guard them
if (ctrl->GetBombDefuser())
if (TheCSBots()->GetBombDefuser())
{
if (!me->IsRogue())
{
@ -239,7 +234,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
else if (me->GetGameState()->GetPlantedBombsite() != CSGameState::UNKNOWN)
{
// we know which bombsite, but not exactly where the bomb is, go there
const CCSBotManager::Zone *zone = ctrl->GetZone(me->GetGameState()->GetPlantedBombsite());
const CCSBotManager::Zone *zone = TheCSBots()->GetZone(me->GetGameState()->GetPlantedBombsite());
if (zone != NULL)
{
if (me->IsDoingScenario())
@ -266,9 +261,9 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
const CCSBotManager::Zone *zone = NULL;
float travelDistance = 9999999.9f;
for (int z = 0; z < ctrl->GetZoneCount(); ++z)
for (int z = 0; z < TheCSBots()->GetZoneCount(); ++z)
{
if (ctrl->GetZone(z)->m_areaCount == 0)
if (TheCSBots()->GetZone(z)->m_areaCount == 0)
continue;
// don't check bombsites that have been cleared
@ -277,11 +272,11 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
// just use the first overlapping nav area as a reasonable approximation
ShortestPathCost pathCost = ShortestPathCost();
float_precision dist = NavAreaTravelDistance(me->GetLastKnownArea(), TheNavAreaGrid.GetNearestNavArea(&ctrl->GetZone(z)->m_center), pathCost);
float_precision dist = NavAreaTravelDistance(me->GetLastKnownArea(), TheNavAreaGrid.GetNearestNavArea(&TheCSBots()->GetZone(z)->m_center), pathCost);
if (/*dist >= 0.0f && */dist < travelDistance)
{
zone = ctrl->GetZone(z);
zone = TheCSBots()->GetZone(z);
travelDistance = dist;
}
}
@ -299,13 +294,13 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
if (zone == NULL)
{
int zoneIndex = me->GetGameState()->GetNextBombsiteToSearch();
zone = ctrl->GetZone(zoneIndex);
zone = TheCSBots()->GetZone(zoneIndex);
}
// move to bombsite - if we reach it, we'll update its cleared status, causing us to select another
if (zone != NULL)
{
const Vector *pos = ctrl->GetRandomPositionInZone(zone);
const Vector *pos = TheCSBots()->GetRandomPositionInZone(zone);
if (pos != NULL)
{
me->SetTask(CCSBot::FIND_TICKING_BOMB);
@ -334,10 +329,10 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
else
{
// snipe bomb zone(s)
const CCSBotManager::Zone *zone = ctrl->GetRandomZone();
const CCSBotManager::Zone *zone = TheCSBots()->GetRandomZone();
if (zone != NULL)
{
snipingArea = ctrl->GetRandomAreaInZone(zone);
snipingArea = TheCSBots()->GetRandomAreaInZone(zone);
me->PrintIfWatched("Sniping near bombsite\n");
}
}
@ -355,7 +350,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
// rogues just hunt, unless they want to snipe
// if the whole team has decided to rush, hunt
// if we know the bomb is dropped, hunt for enemies and the loose bomb
if (me->IsRogue() || ctrl->IsDefenseRushing() || me->GetGameState()->IsLooseBombLocationKnown())
if (me->IsRogue() || TheCSBots()->IsDefenseRushing() || me->GetGameState()->IsLooseBombLocationKnown())
{
me->Hunt();
return;
@ -372,10 +367,10 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
float guardRange = 500.0f + 100.0f * (me->GetMorale() + 3);
// guard bomb zone(s)
const CCSBotManager::Zone *zone = ctrl->GetRandomZone();
const CCSBotManager::Zone *zone = TheCSBots()->GetRandomZone();
if (zone != NULL)
{
CNavArea *area = ctrl->GetRandomAreaInZone(zone);
CNavArea *area = TheCSBots()->GetRandomAreaInZone(zone);
if (area != NULL)
{
me->PrintIfWatched("I'm guarding a bombsite\n");
@ -401,10 +396,10 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
if (RANDOM_FLOAT(0, 100) <= defenseSniperCampChance)
{
// snipe escape zone(s)
const CCSBotManager::Zone *zone = ctrl->GetRandomZone();
const CCSBotManager::Zone *zone = TheCSBots()->GetRandomZone();
if (zone != NULL)
{
CNavArea *area = ctrl->GetRandomAreaInZone(zone);
CNavArea *area = TheCSBots()->GetRandomAreaInZone(zone);
if (area != NULL)
{
me->SetTask(CCSBot::MOVE_TO_SNIPER_SPOT);
@ -419,7 +414,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
// rogues just hunt, unless they want to snipe
// if the whole team has decided to rush, hunt
if (me->IsRogue() || ctrl->IsDefenseRushing())
if (me->IsRogue() || TheCSBots()->IsDefenseRushing())
break;
// the lower our morale gets, the more we want to camp the escape zone(s)
@ -428,10 +423,10 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
if (RANDOM_FLOAT(0.0f, 100.0f) < guardEscapeZoneChance)
{
// guard escape zone(s)
const CCSBotManager::Zone *zone = ctrl->GetRandomZone();
const CCSBotManager::Zone *zone = TheCSBots()->GetRandomZone();
if (zone != NULL)
{
CNavArea *area = ctrl->GetRandomAreaInZone(zone);
CNavArea *area = TheCSBots()->GetRandomAreaInZone(zone);
if (area != NULL)
{
// guard the escape zone - stay closer if our morale is low
@ -455,21 +450,21 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
const float earlyTime = 20.0f;
const CCSBotManager::Zone *zone = NULL;
if (ctrl->GetElapsedRoundTime() < earlyTime)
if (TheCSBots()->GetElapsedRoundTime() < earlyTime)
{
// pick random zone
zone = ctrl->GetRandomZone();
zone = TheCSBots()->GetRandomZone();
}
else
{
// pick closest zone
zone = ctrl->GetClosestZone(me->GetLastKnownArea(), PathCost(me));
zone = TheCSBots()->GetClosestZone(me->GetLastKnownArea(), PathCost(me));
}
if (zone != NULL)
{
// pick a random spot within the escape zone
const Vector *pos = ctrl->GetRandomPositionInZone(zone);
const Vector *pos = TheCSBots()->GetRandomPositionInZone(zone);
if (pos != NULL)
{
// move to escape zone
@ -479,7 +474,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
// tell team to follow
const float repeatTime = 30.0f;
if (me->GetFriendsRemaining() && ctrl->GetRadioMessageInterval(EVENT_RADIO_FOLLOW_ME, me->m_iTeam) > repeatTime)
if (me->GetFriendsRemaining() && TheCSBots()->GetRadioMessageInterval(EVENT_RADIO_FOLLOW_ME, me->m_iTeam) > repeatTime)
me->SendRadioMessage(EVENT_RADIO_FOLLOW_ME);
return;
}
@ -518,7 +513,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
else
{
// later in the game, camp either hostages or escape zone
const float campZoneChance = 100.0f * (ctrl->GetElapsedRoundTime() - me->GetSafeTime()) / 120.0f;
const float campZoneChance = 100.0f * (TheCSBots()->GetElapsedRoundTime() - me->GetSafeTime()) / 120.0f;
campHostages = (RANDOM_FLOAT(0, 100) > campZoneChance) ? true : false;
}
@ -576,7 +571,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
// if the whole team has decided to rush, hunt
if (me->GetFriendsRemaining())
{
if (me->IsRogue() || ctrl->IsDefenseRushing() || RANDOM_FLOAT(0, 100) < huntChance)
if (me->IsRogue() || TheCSBots()->IsDefenseRushing() || RANDOM_FLOAT(0, 100) < huntChance)
{
me->Hunt();
return;
@ -673,7 +668,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
// if we are escorting hostages, determine where to take them
if (me->GetHostageEscortCount())
zone = ctrl->GetClosestZone(me->GetLastKnownArea(), PathCost(me, FASTEST_ROUTE));
zone = TheCSBots()->GetClosestZone(me->GetLastKnownArea(), PathCost(me, FASTEST_ROUTE));
// if we are escorting hostages and there are more hostages to rescue,
// determine whether it's faster to rescue the ones we have, or go get the remaining ones
@ -727,7 +722,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
me->SetTask(CCSBot::RESCUE_HOSTAGES);
me->Run();
me->SetDisposition(CCSBot::SELF_DEFENSE);
me->MoveTo(ctrl->GetRandomPositionInZone(zone), FASTEST_ROUTE);
me->MoveTo(TheCSBots()->GetRandomPositionInZone(zone), FASTEST_ROUTE);
me->PrintIfWatched("I'm rescuing hostages\n");
me->GetChatter()->EscortingHostages();
return;

View File

@ -1,8 +1,6 @@
#include "precompiled.h"
// Move towards currently heard noise
/* <5b3114> ../cstrike/dlls/bot/states/cs_bot_investigate_noise.cpp:17 */
void InvestigateNoiseState::AttendCurrentNoise(CCSBot *me)
{
if (!me->IsNoiseHeard() && me->GetNoisePosition())
@ -23,15 +21,12 @@ void InvestigateNoiseState::AttendCurrentNoise(CCSBot *me)
me->ForgetNoise();
}
/* <5b2f37> ../cstrike/dlls/bot/states/cs_bot_investigate_noise.cpp:38 */
void InvestigateNoiseState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
{
AttendCurrentNoise(me);
}
// Use TravelDistance instead of distance...
/* <5b2fa2> ../cstrike/dlls/bot/states/cs_bot_investigate_noise.cpp:47 */
void InvestigateNoiseState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
float newNoiseDist;
@ -109,7 +104,6 @@ void InvestigateNoiseState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
}
}
/* <5b2e95> ../cstrike/dlls/bot/states/cs_bot_investigate_noise.cpp:129 */
void InvestigateNoiseState::__MAKE_VHOOK(OnExit)(CCSBot *me)
{
// reset to run mode in case we were sneaking about

View File

@ -1,8 +1,6 @@
#include "precompiled.h"
// Move to a potentially far away position.
/* <5c4e91> ../cstrike/dlls/bot/states/cs_bot_move_to.cpp:21 */
void MoveToState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
{
if (me->IsUsingKnife() && me->IsWellPastSafe() && !me->IsHurrying())
@ -37,12 +35,8 @@ void MoveToState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
}
// Move to a potentially far away position.
/* <5c4edf> ../cstrike/dlls/bot/states/cs_bot_move_to.cpp:55 */
void MoveToState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
CCSBotManager *ctrl = TheCSBots();
// assume that we are paying attention and close enough to know our enemy died
if (me->GetTask() == CCSBot::MOVE_TO_LAST_KNOWN_ENEMY_POSITION)
{
@ -60,7 +54,7 @@ void MoveToState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
me->UpdateLookAround();
// Scenario logic
switch (ctrl->GetScenario())
switch (TheCSBots()->GetScenario())
{
case CCSBotManager::SCENARIO_DEFUSE_BOMB:
{
@ -83,13 +77,13 @@ void MoveToState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
}
// check off bombsites that we explore or happen to stumble into
for (int z = 0; z < ctrl->GetZoneCount(); ++z)
for (int z = 0; z < TheCSBots()->GetZoneCount(); ++z)
{
// don't re-check zones
if (me->GetGameState()->IsBombsiteClear(z))
continue;
if (ctrl->GetZone(z)->m_extent.Contains(&me->pev->origin))
if (TheCSBots()->GetZone(z)->m_extent.Contains(&me->pev->origin))
{
// note this bombsite is clear
me->GetGameState()->ClearBombsite(z);
@ -118,7 +112,7 @@ void MoveToState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
case CCSBot::DEFUSE_BOMB:
{
// if we are trying to defuse the bomb, and someone has started defusing, guard them instead
if (me->CanSeePlantedBomb() && ctrl->GetBombDefuser())
if (me->CanSeePlantedBomb() && TheCSBots()->GetBombDefuser())
{
me->GetChatter()->Say("CoveringFriend");
me->Idle();
@ -263,7 +257,8 @@ void MoveToState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
if (bombPos != NULL)
{
const float defuseRange = 100.0f;
Vector toBomb = *bombPos - me->pev->origin + Vector(0, 0, me->GetFeetZ());
Vector toBomb = *bombPos - me->pev->origin;
toBomb.z = bombPos->z - me->GetFeetZ();
if (toBomb.IsLengthLessThan(defuseRange))
{
@ -292,7 +287,6 @@ void MoveToState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
}
}
/* <5c4e54> ../cstrike/dlls/bot/states/cs_bot_move_to.cpp:320 */
void MoveToState::__MAKE_VHOOK(OnExit)(CCSBot *me)
{
// reset to run in case we were walking near our goal position

View File

@ -1,8 +1,6 @@
#include "precompiled.h"
// Plant the bomb.
/* <5d4160> ../cstrike/dlls/bot/states/cs_bot_plant_bomb.cpp:17 */
void PlantBombState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
{
me->Crouch();
@ -16,8 +14,6 @@ void PlantBombState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
}
// Plant the bomb.
/* <5d40d0> ../cstrike/dlls/bot/states/cs_bot_plant_bomb.cpp:36 */
void PlantBombState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
CBasePlayerWeapon *gun = me->GetActiveWeapon();
@ -48,7 +44,6 @@ void PlantBombState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
me->Idle();
}
/* <5d4088> ../cstrike/dlls/bot/states/cs_bot_plant_bomb.cpp:65 */
void PlantBombState::__MAKE_VHOOK(OnExit)(CCSBot *me)
{
// equip our rifle (in case we were interrupted while holding C4)

View File

@ -2,14 +2,11 @@
// Face the entity and "use" it
// NOTE: This state assumes we are standing in range of the entity to be used, with no obstructions.
/* <5e3017> ../cstrike/dlls/bot/states/cs_bot_use_entity.cpp:17 */
void UseEntityState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
{
;
}
/* <5e308c> ../cstrike/dlls/bot/states/cs_bot_use_entity.cpp:21 */
void UseEntityState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
// in the very rare situation where two or more bots "used" a hostage at the same time,
@ -41,7 +38,6 @@ void UseEntityState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
}
}
/* <5e304a> ../cstrike/dlls/bot/states/cs_bot_use_entity.cpp:54 */
void UseEntityState::__MAKE_VHOOK(OnExit)(CCSBot *me)
{
me->ClearLookAt();

View File

@ -52,13 +52,9 @@ TYPEDESCRIPTION CEnvSpark::m_SaveData[] =
#endif // HOOK_GAMEDLL
/* <260d6> ../cstrike/dlls/buttons.cpp:62 */
IMPLEMENT_SAVERESTORE(CEnvGlobal, CBaseEntity);
/* <272af> ../cstrike/dlls/buttons.cpp:64 */
LINK_ENTITY_TO_CLASS(env_global, CEnvGlobal);
/* <26863> ../cstrike/dlls/buttons.cpp:66 */
void CEnvGlobal::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
pkvd->fHandled = TRUE;
@ -80,7 +76,6 @@ void CEnvGlobal::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CPointEntity::KeyValue(pkvd);
}
/* <26486> ../cstrike/dlls/buttons.cpp:80 */
void CEnvGlobal::__MAKE_VHOOK(Spawn)()
{
if (!m_globalstate)
@ -98,7 +93,6 @@ void CEnvGlobal::__MAKE_VHOOK(Spawn)()
}
}
/* <25ee7> ../cstrike/dlls/buttons.cpp:95 */
void CEnvGlobal::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
GLOBALESTATE oldState = gGlobalState.EntityGetState(m_globalstate);
@ -140,15 +134,10 @@ void CEnvGlobal::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller
gGlobalState.EntityAdd(m_globalstate, gpGlobals->mapname, newState);
}
/* <2616f> ../cstrike/dlls/buttons.cpp:141 */
IMPLEMENT_SAVERESTORE(CMultiSource, CBaseEntity);
/* <27379> ../cstrike/dlls/buttons.cpp:143 */
LINK_ENTITY_TO_CLASS(multisource, CMultiSource);
// Cache user-entity-field values until spawn is called.
/* <26d1e> ../cstrike/dlls/buttons.cpp:148 */
void CMultiSource::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "style")
@ -168,13 +157,12 @@ void CMultiSource::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CPointEntity::KeyValue(pkvd);
}
/* <256e2> ../cstrike/dlls/buttons.cpp:168 */
void CMultiSource::__MAKE_VHOOK(Spawn)()
{
// set up think for later registration
pev->solid = SOLID_NOT;
pev->movetype = MOVETYPE_NONE;
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
// Until it's initialized
pev->spawnflags |= SF_MULTI_INIT;
@ -182,7 +170,6 @@ void CMultiSource::__MAKE_VHOOK(Spawn)()
SetThink(&CMultiSource::Register);
}
/* <2633b> ../cstrike/dlls/buttons.cpp:179 */
void CMultiSource::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
int i = 0;
@ -219,7 +206,6 @@ void CMultiSource::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCall
}
}
/* <26419> ../cstrike/dlls/buttons.cpp:211 */
BOOL CMultiSource::__MAKE_VHOOK(IsTriggered)(CBaseEntity *)
{
// Is everything triggered?
@ -227,7 +213,7 @@ BOOL CMultiSource::__MAKE_VHOOK(IsTriggered)(CBaseEntity *)
// Still initializing?
if (pev->spawnflags & SF_MULTI_INIT)
return 0;
return FALSE;
while (i < m_iTotal)
{
@ -240,14 +226,13 @@ BOOL CMultiSource::__MAKE_VHOOK(IsTriggered)(CBaseEntity *)
{
if (FStringNull(m_globalstate) || gGlobalState.EntityGetState(m_globalstate) == GLOBAL_ON)
{
return 1;
return TRUE;
}
}
return 0;
return FALSE;
}
/* <25d5a> ../cstrike/dlls/buttons.cpp:236 */
void CMultiSource::Register()
{
edict_t *pentTarget = NULL;
@ -288,10 +273,8 @@ void CMultiSource::Register()
pev->spawnflags &= ~SF_MULTI_INIT;
}
/* <262ee> ../cstrike/dlls/buttons.cpp:287 */
IMPLEMENT_SAVERESTORE(CBaseButton, CBaseToggle);
/* <25709> ../cstrike/dlls/buttons.cpp:289 */
void CBaseButton::__MAKE_VHOOK(Precache)()
{
char *pszSound;
@ -310,14 +293,14 @@ void CBaseButton::__MAKE_VHOOK(Precache)()
// get door button sounds, for doors which require buttons to open
if (m_bLockedSound)
{
pszSound = ButtonSound((int)m_bLockedSound);
pszSound = ButtonSound(int(m_bLockedSound));
PRECACHE_SOUND(pszSound);
m_ls.sLockedSound = ALLOC_STRING(pszSound);
}
if (m_bUnlockedSound)
{
pszSound = ButtonSound((int)m_bUnlockedSound);
pszSound = ButtonSound(int(m_bUnlockedSound));
PRECACHE_SOUND(pszSound);
m_ls.sUnlockedSound = ALLOC_STRING(pszSound);
}
@ -352,8 +335,6 @@ void CBaseButton::__MAKE_VHOOK(Precache)()
}
// Cache user-entity-field values until spawn is called.
/* <269cb> ../cstrike/dlls/buttons.cpp:355 */
void CBaseButton::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "changetarget"))
@ -363,22 +344,22 @@ void CBaseButton::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
}
else if (FStrEq(pkvd->szKeyName, "locked_sound"))
{
m_bLockedSound = (int)Q_atof(pkvd->szValue);
m_bLockedSound = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "locked_sentence"))
{
m_bLockedSentence = (int)Q_atof(pkvd->szValue);
m_bLockedSentence = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "unlocked_sound"))
{
m_bUnlockedSound = (int)Q_atof(pkvd->szValue);
m_bUnlockedSound = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "unlocked_sentence"))
{
m_bUnlockedSentence = (int)Q_atof(pkvd->szValue);
m_bUnlockedSentence = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "sounds"))
@ -391,8 +372,6 @@ void CBaseButton::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
}
// ButtonShot
/* <26e90> ../cstrike/dlls/buttons.cpp:394 */
int CBaseButton::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
BUTTON_CODE code = ButtonResponseToTouch();
@ -446,11 +425,8 @@ int CBaseButton::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe
// 1) wooden clunk
// 2) metallic click
// 3) in-out
/* <27443> ../cstrike/dlls/buttons.cpp:439 */
LINK_ENTITY_TO_CLASS(func_button, CBaseButton);
/* <25c2c> ../cstrike/dlls/buttons.cpp:442 */
void CBaseButton::__MAKE_VHOOK(Spawn)()
{
char *pszSound;
@ -471,7 +447,7 @@ void CBaseButton::__MAKE_VHOOK(Spawn)()
SetThink(&CBaseButton::ButtonSpark);
// no hurry, make sure everything else spawns
pev->nextthink = gpGlobals->time + 0.5;
pev->nextthink = gpGlobals->time + 0.5f;
}
SetMovedir(pev);
@ -503,7 +479,7 @@ void CBaseButton::__MAKE_VHOOK(Spawn)()
m_vecPosition1 = pev->origin;
// Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big
m_vecPosition2 = m_vecPosition1 + (pev->movedir * (fabs((float_precision)(pev->movedir.x * (pev->size.x - 2))) + fabs((float_precision)(pev->movedir.y * (pev->size.y - 2))) + fabs((float_precision)(pev->movedir.z * (pev->size.z - 2))) - m_flLip));
m_vecPosition2 = m_vecPosition1 + (pev->movedir * (Q_fabs(float_precision(pev->movedir.x * (pev->size.x - 2))) + Q_fabs(float_precision(pev->movedir.y * (pev->size.y - 2))) + Q_fabs(float_precision(pev->movedir.z * (pev->size.z - 2))) - m_flLip));
// Is this a non-moving button?
if (((m_vecPosition2 - m_vecPosition1).Length() < 1) || (pev->spawnflags & SF_BUTTON_DONTMOVE))
@ -529,8 +505,6 @@ void CBaseButton::__MAKE_VHOOK(Spawn)()
// Button sound table.
// Also used by CBaseDoor to get 'touched' door lock/unlock sounds
/* <24738> ../cstrike/dlls/buttons.cpp:511 */
char *ButtonSound(int sound)
{
char *pszSound;
@ -566,16 +540,15 @@ char *ButtonSound(int sound)
}
// Makes flagged buttons spark when turned off
/* <2752e> ../cstrike/dlls/buttons.cpp:551 */
void DoSpark(entvars_t *pev, const Vector &location)
{
Vector tmp = location + (pev->size * 0.5);
Vector tmp = location + (pev->size * 0.5f);
UTIL_Sparks(tmp);
//random volume range
float flVolume = RANDOM_FLOAT(0.25 , 0.75) * 0.4;
float flVolume = RANDOM_FLOAT(0.25f, 0.75f) * 0.4f;
// NOTE: not to change it
switch ((int)(RANDOM_FLOAT(0, 1) * 6))
{
case 0: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark1.wav", flVolume, ATTN_NORM); break;
@ -587,7 +560,6 @@ void DoSpark(entvars_t *pev, const Vector &location)
}
}
/* <277fa> ../cstrike/dlls/buttons.cpp:568 */
void CBaseButton::ButtonSpark()
{
SetThink(&CBaseButton::ButtonSpark);
@ -599,8 +571,6 @@ void CBaseButton::ButtonSpark()
}
// Button's Use function
/* <2719b> ../cstrike/dlls/buttons.cpp:580 */
void CBaseButton::ButtonUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
// Ignore touches if button is moving, or pushed-in and waiting to auto-come-out.
@ -622,11 +592,12 @@ void CBaseButton::ButtonUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T
ButtonActivate();
}
/* <27821> ../cstrike/dlls/buttons.cpp:603 */
CBaseButton::BUTTON_CODE CBaseButton::ButtonResponseToTouch()
{
// Ignore touches if button is moving, or pushed-in and waiting to auto-come-out.
if (m_toggle_state == TS_GOING_UP || m_toggle_state == TS_GOING_DOWN || (m_toggle_state == TS_AT_TOP && !m_fStayPushed && !(pev->spawnflags & SF_BUTTON_TOGGLE)))
if (m_toggle_state == TS_GOING_UP
|| m_toggle_state == TS_GOING_DOWN
|| (m_toggle_state == TS_AT_TOP && !m_fStayPushed && !(pev->spawnflags & SF_BUTTON_TOGGLE)))
{
return BUTTON_NOTHING;
}
@ -645,8 +616,6 @@ CBaseButton::BUTTON_CODE CBaseButton::ButtonResponseToTouch()
}
// Touching a button simply "activates" it.
/* <27047> ../cstrike/dlls/buttons.cpp:628 */
void CBaseButton::ButtonTouch(CBaseEntity *pOther)
{
// Ignore touches by anything but players
@ -683,8 +652,6 @@ void CBaseButton::ButtonTouch(CBaseEntity *pOther)
}
// Starts the button moving "in/up".
/* <27843> ../cstrike/dlls/buttons.cpp:664 */
void CBaseButton::ButtonActivate()
{
EMIT_SOUND(ENT(pev), CHAN_VOICE, (char *)STRING(pev->noise), VOL_NORM, ATTN_NORM);
@ -716,8 +683,6 @@ void CBaseButton::ButtonActivate()
}
// Button has reached the "in/up" position. Activate its "targets", and pause before "popping out".
/* <263dd> ../cstrike/dlls/buttons.cpp:693 */
void CBaseButton::TriggerAndWait()
{
assert(m_toggle_state == TS_GOING_UP);
@ -752,8 +717,6 @@ void CBaseButton::TriggerAndWait()
}
// Starts the button moving "out/down".
/* <25bb7> ../cstrike/dlls/buttons.cpp:730 */
void CBaseButton::ButtonReturn()
{
assert(m_toggle_state == TS_AT_TOP);
@ -774,8 +737,6 @@ void CBaseButton::ButtonReturn()
}
// Button has returned to start state. Quiesce it.
/* <26658> ../cstrike/dlls/buttons.cpp:748 */
void CBaseButton::ButtonBackHome()
{
assert(m_toggle_state == TS_GOING_DOWN);
@ -791,10 +752,8 @@ void CBaseButton::ButtonBackHome()
{
edict_t *pentTarget = NULL;
while (true)
while ((pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(pev->target))) != NULL)
{
pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(pev->target));
if (FNullEnt(pentTarget))
break;
@ -826,14 +785,12 @@ void CBaseButton::ButtonBackHome()
SetThink(&CBaseButton::ButtonSpark);
// no hurry.
pev->nextthink = gpGlobals->time + 0.5;
pev->nextthink = gpGlobals->time + 0.5f;
}
}
/* <278a4> ../cstrike/dlls/buttons.cpp:806 */
LINK_ENTITY_TO_CLASS(func_rot_button, CRotButton);
/* <25a06> ../cstrike/dlls/buttons.cpp:808 */
void CRotButton::__MAKE_VHOOK(Spawn)()
{
char *pszSound;
@ -898,13 +855,9 @@ void CRotButton::__MAKE_VHOOK(Spawn)()
//SetTouch(ButtonTouch);
}
/* <262a1> ../cstrike/dlls/buttons.cpp:918 */
IMPLEMENT_SAVERESTORE(CMomentaryRotButton, CBaseToggle);
/* <27971> ../cstrike/dlls/buttons.cpp:920 */
LINK_ENTITY_TO_CLASS(momentary_rot_button, CMomentaryRotButton);
/* <25acc> ../cstrike/dlls/buttons.cpp:922 */
void CMomentaryRotButton::__MAKE_VHOOK(Spawn)()
{
CBaseToggle::AxisDir(pev);
@ -945,7 +898,6 @@ void CMomentaryRotButton::__MAKE_VHOOK(Spawn)()
m_lastUsed = 0;
}
/* <2678f> ../cstrike/dlls/buttons.cpp:958 */
void CMomentaryRotButton::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "returnspeed"))
@ -962,7 +914,6 @@ void CMomentaryRotButton::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CBaseToggle::KeyValue(pkvd);
}
/* <27a57> ../cstrike/dlls/buttons.cpp:974 */
void CMomentaryRotButton::PlaySound()
{
EMIT_SOUND(ENT(pev), CHAN_VOICE, (char *)STRING(pev->noise), VOL_NORM, ATTN_NORM);
@ -971,8 +922,6 @@ void CMomentaryRotButton::PlaySound()
// BUGBUG: This design causes a latentcy. When the button is retriggered, the first impulse
// will send the target in the wrong direction because the parameter is calculated based on the
// current, not future position.
/* <27dc0> ../cstrike/dlls/buttons.cpp:982 */
void CMomentaryRotButton::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
pev->ideal_yaw = CBaseToggle::AxisDelta(pev->spawnflags, pev->angles, m_start) / m_flMoveDistance;
@ -988,7 +937,6 @@ void CMomentaryRotButton::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity
#endif
}
/* <27c49> ../cstrike/dlls/buttons.cpp:990 */
void CMomentaryRotButton::UpdateAllButtons(float value, int start)
{
// Update all rot buttons attached to the same target
@ -1016,14 +964,13 @@ void CMomentaryRotButton::UpdateAllButtons(float value, int start)
}
}
/* <27ab8> ../cstrike/dlls/buttons.cpp:1015 */
void CMomentaryRotButton::UpdateSelf(float value)
{
BOOL fplaysound = FALSE;
bool fplaysound = false;
if (!m_lastUsed)
{
fplaysound = TRUE;
fplaysound = true;
m_direction = -m_direction;
}
@ -1050,25 +997,22 @@ void CMomentaryRotButton::UpdateSelf(float value)
// HACKHACK -- If we're going slow, we'll get multiple player packets per frame, bump nexthink on each one to avoid stalling
if (pev->nextthink < pev->ltime)
pev->nextthink = pev->ltime + 0.1;
pev->nextthink = pev->ltime + 0.1f;
else
pev->nextthink += 0.1;
pev->nextthink += 0.1f;
pev->avelocity = (m_direction * pev->speed) * pev->movedir;
SetThink(&CMomentaryRotButton::Off);
}
/* <26550> ../cstrike/dlls/buttons.cpp:1053 */
void CMomentaryRotButton::UpdateTarget(float value)
{
if (!FStringNull(pev->target))
{
edict_t *pentTarget = NULL;
while (true)
while ((pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(pev->target))) != NULL)
{
pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(pev->target));
if (FNullEnt(pentTarget))
break;
@ -1082,7 +1026,6 @@ void CMomentaryRotButton::UpdateTarget(float value)
}
}
/* <25f88> ../cstrike/dlls/buttons.cpp:1072 */
void CMomentaryRotButton::Off()
{
pev->avelocity = g_vecZero;
@ -1098,7 +1041,6 @@ void CMomentaryRotButton::Off()
SetThink(NULL);
}
/* <27d60> ../cstrike/dlls/buttons.cpp:1086 */
void CMomentaryRotButton::Return()
{
float value = CBaseToggle::AxisDelta(pev->spawnflags, pev->angles, m_start) / m_flMoveDistance;
@ -1112,7 +1054,6 @@ void CMomentaryRotButton::Return()
}
}
/* <27bce> ../cstrike/dlls/buttons.cpp:1096 */
void CMomentaryRotButton::UpdateSelfReturn(float value)
{
if (value <= 0)
@ -1125,20 +1066,14 @@ void CMomentaryRotButton::UpdateSelfReturn(float value)
else
{
pev->avelocity = -m_returnSpeed * pev->movedir;
pev->nextthink = pev->ltime + 0.1;
pev->nextthink = pev->ltime + 0.1f;
}
}
/* <26122> ../cstrike/dlls/buttons.cpp:1141 */
IMPLEMENT_SAVERESTORE(CEnvSpark, CBaseEntity);
/* <27e77> ../cstrike/dlls/buttons.cpp:1143 */
LINK_ENTITY_TO_CLASS(env_spark, CEnvSpark);
/* <27f44> ../cstrike/dlls/buttons.cpp:1144 */
LINK_ENTITY_TO_CLASS(env_debris, CEnvSpark);
/* <257b7> ../cstrike/dlls/buttons.cpp:1146 */
void CEnvSpark::__MAKE_VHOOK(Spawn)()
{
SetThink(NULL);
@ -1162,17 +1097,16 @@ void CEnvSpark::__MAKE_VHOOK(Spawn)()
else
SetThink(&CEnvSpark::SparkThink);
pev->nextthink = gpGlobals->time + (0.1 + RANDOM_FLOAT(0, 1.5));
pev->nextthink = gpGlobals->time + (0.1f + RANDOM_FLOAT(0.0f, 1.5f));
if (m_flDelay <= 0)
if (m_flDelay <= 0.0f)
{
m_flDelay = 1.5;
m_flDelay = 1.5f;
}
Precache();
}
/* <257de> ../cstrike/dlls/buttons.cpp:1173 */
void CEnvSpark::__MAKE_VHOOK(Precache)()
{
PRECACHE_SOUND("buttons/spark1.wav");
@ -1183,7 +1117,6 @@ void CEnvSpark::__MAKE_VHOOK(Precache)()
PRECACHE_SOUND("buttons/spark6.wav");
}
/* <26b97> ../cstrike/dlls/buttons.cpp:1183 */
void CEnvSpark::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "MaxDelay"))
@ -1202,32 +1135,27 @@ void CEnvSpark::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CBaseEntity::KeyValue(pkvd);
}
/* <277d3> ../cstrike/dlls/buttons.cpp:1201 */
void CEnvSpark::SparkThink()
{
pev->nextthink = gpGlobals->time + 0.1 + RANDOM_FLOAT(0, m_flDelay);
pev->nextthink = gpGlobals->time + 0.1f + RANDOM_FLOAT(0, m_flDelay);
DoSpark(pev, pev->origin);
}
/* <25805> ../cstrike/dlls/buttons.cpp:1207 */
void CEnvSpark::SparkStart(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
SetUse(&CEnvSpark::SparkStop);
SetThink(&CEnvSpark::SparkThink);
pev->nextthink = gpGlobals->time + (0.1 + RANDOM_FLOAT(0, m_flDelay));
pev->nextthink = gpGlobals->time + (0.1f + RANDOM_FLOAT(0, m_flDelay));
}
/* <25868> ../cstrike/dlls/buttons.cpp:1214 */
void CEnvSpark::SparkStop(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
SetUse(&CEnvSpark::SparkStart);
SetThink(NULL);
}
/* <28011> ../cstrike/dlls/buttons.cpp:1233 */
LINK_ENTITY_TO_CLASS(button_target, CButtonTarget);
/* <258ca> ../cstrike/dlls/buttons.cpp:1235 */
void CButtonTarget::__MAKE_VHOOK(Spawn)()
{
pev->movetype = MOVETYPE_PUSH;
@ -1242,10 +1170,9 @@ void CButtonTarget::__MAKE_VHOOK(Spawn)()
}
}
/* <25fc3> ../cstrike/dlls/buttons.cpp:1246 */
void CButtonTarget::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
if (!ShouldToggle(useType, (int)pev->frame))
if (!ShouldToggle(useType, int(pev->frame)))
return;
pev->frame = 1 - pev->frame;
@ -1258,10 +1185,9 @@ void CButtonTarget::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCal
SUB_UseTargets(pActivator, USE_OFF, 0);
}
/* <258f1> ../cstrike/dlls/buttons.cpp:1258 */
int CButtonTarget::__MAKE_VHOOK(ObjectCaps)()
{
int caps = CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION;
int caps = (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
if (pev->spawnflags & SF_BTARGET_USE)
return caps | FCAP_IMPULSE_USE;
@ -1269,7 +1195,6 @@ int CButtonTarget::__MAKE_VHOOK(ObjectCaps)()
return caps;
}
/* <2592e> ../cstrike/dlls/buttons.cpp:1269 */
int CButtonTarget::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
Use(Instance(pevAttacker), this, USE_TOGGLE, 0);

View File

@ -54,7 +54,6 @@
#define SF_BTARGET_USE 0x0001
#define SF_BTARGET_ON 0x0002
/* <249a3> ../cstrike/dlls/buttons.cpp:38 */
class CEnvGlobal: public CPointEntity
{
public:
@ -72,18 +71,16 @@ public:
int Restore_(CRestore &restore);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
public:
static TYPEDESCRIPTION IMPL(m_SaveData)[3];
public:
string_t m_globalstate;
int m_triggermode;
int m_initialstate;
};
/* <24b67> ../cstrike/dlls/buttons.cpp:800 */
class CRotButton: public CBaseButton
{
public:
@ -93,11 +90,9 @@ public:
void Spawn_();
#endif // HOOK_GAMEDLL
#endif
};
/* <24bba> ../cstrike/dlls/buttons.cpp:873 */
class CMomentaryRotButton: public CBaseToggle
{
public:
@ -126,7 +121,7 @@ public:
int Restore_(CRestore &restore);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
public:
void EXPORT Off();
@ -139,8 +134,6 @@ public:
public:
static CMomentaryRotButton *Instance(edict_t *pent) { return (CMomentaryRotButton *)GET_PRIVATE(pent); }
public:
static TYPEDESCRIPTION IMPL(m_SaveData)[6];
int m_lastUsed;
@ -151,7 +144,6 @@ public:
int m_sounds;
};
/* <24c08> ../cstrike/dlls/buttons.cpp:1117 */
class CEnvSpark: public CBaseEntity
{
public:
@ -169,7 +161,7 @@ public:
int Save_(CSave &save);
int Restore_(CRestore &restore);
#endif // HOOK_GAMEDLL
#endif
public:
void EXPORT SparkThink();
@ -182,7 +174,6 @@ public:
float m_flDelay;
};
/* <24c24> ../cstrike/dlls/buttons.cpp:1223 */
class CButtonTarget: public CBaseEntity
{
public:
@ -198,7 +189,7 @@ public:
int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
};

View File

@ -32,9 +32,8 @@ const TaskInfo taskInfo[] =
{ NULL, EVENT_INVALID, &CCareerTask::NewTask }
};
#endif // HOOK_GAMEDLL
#endif
/* <1ef647> ../cstrike/dlls/career_tasks.cpp:133 */
CCareerTask *CPreventDefuseTask::NewTask(const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete)
{
CPreventDefuseTask *pNewTask = new CPreventDefuseTask(taskName, event, weaponName, n, mustLive, crossRounds, id, isComplete);
@ -42,10 +41,9 @@ CCareerTask *CPreventDefuseTask::NewTask(const char *taskName, GameEventType eve
pNewTask->m_bombPlantedThisRound = false;
pNewTask->m_defuseStartedThisRound = false;
return (CCareerTask *)pNewTask;
return reinterpret_cast<CCareerTask *>(pNewTask);
}
/* <1ef5db> ../cstrike/dlls/career_tasks.cpp:139 */
CPreventDefuseTask::CPreventDefuseTask(const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete)
{
CCareerTask(taskName, event, weaponName, n, mustLive, crossRounds, id, isComplete);
@ -54,7 +52,6 @@ CPreventDefuseTask::CPreventDefuseTask(const char *taskName, GameEventType event
m_defuseStartedThisRound = false;
}
/* <1ef296> ../cstrike/dlls/career_tasks.cpp:147 */
void CPreventDefuseTask::__MAKE_VHOOK(Reset)()
{
m_bombPlantedThisRound = false;
@ -63,7 +60,6 @@ void CPreventDefuseTask::__MAKE_VHOOK(Reset)()
CCareerTask::Reset();
}
/* <1efbf8> ../cstrike/dlls/career_tasks.cpp:156 */
void CPreventDefuseTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer *pAttacker, CBasePlayer *pVictim)
{
if (IsComplete())
@ -87,14 +83,12 @@ void CPreventDefuseTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer
}
}
/* <1ef4e1> ../cstrike/dlls/career_tasks.cpp:186 */
CCareerTask *CCareerTask::NewTask(const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete)
{
CCareerTask *pTask = new CCareerTask(taskName, event, weaponName, n, mustLive, crossRounds, id, isComplete);
return pTask;
}
/* <1ef43f> ../cstrike/dlls/career_tasks.cpp:192 */
CCareerTask::CCareerTask(const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete)
{
m_isComplete = isComplete;
@ -129,7 +123,6 @@ CCareerTask::CCareerTask(const char *taskName, GameEventType event, const char *
}
}
/* <1ef211> ../cstrike/dlls/career_tasks.cpp:240 */
void CCareerTask::__MAKE_VHOOK(Reset)()
{
m_eventsSeen = 0;
@ -147,7 +140,6 @@ void CCareerTask::__MAKE_VHOOK(Reset)()
MESSAGE_END();
}
/* <1ef74c> ../cstrike/dlls/career_tasks.cpp:256 */
void CCareerTask::SendPartialNotification()
{
MESSAGE_BEGIN(MSG_ALL, gmsgCZCareer);
@ -159,18 +151,13 @@ void CCareerTask::SendPartialNotification()
UTIL_LogPrintf("Career Task Partial %d %d\n", m_id, m_eventsSeen);
}
/* <1efc6c> ../cstrike/dlls/career_tasks.cpp:268 */
void CCareerTask::OnWeaponKill(int weaponId, int weaponClassId, bool headshot, bool killerHasShield, CBasePlayer *pAttacker, CBasePlayer *pVictim)
{
if (m_isComplete || m_event != EVENT_KILL && (m_event != EVENT_HEADSHOT || !headshot))
{
if (m_isComplete || (m_event != EVENT_KILL && (m_event != EVENT_HEADSHOT || !headshot)))
return;
}
if (!pVictim || (m_defuser && !pVictim->m_bIsDefusing) || (m_vip && !pVictim->m_bIsVIP))
{
return;
}
if (m_rescuer)
{
@ -187,7 +174,7 @@ void CCareerTask::OnWeaponKill(int weaponId, int weaponClassId, bool headshot, b
if (!hostage->IsFollowingSomeone())
continue;
if (hostage->IsValid() && hostage->m_target == pAttacker)
if (hostage->IsValid() && hostage->m_target == pVictim)
++hostages_;
}
@ -205,9 +192,9 @@ void CCareerTask::OnWeaponKill(int weaponId, int weaponClassId, bool headshot, b
if (m_weaponId != weaponId)
return;
}
else if (m_weaponClassId)
else
{
if (m_weaponClassId != weaponClassId)
if (!m_weaponClassId || m_weaponClassId != weaponClassId)
return;
}
@ -215,13 +202,10 @@ void CCareerTask::OnWeaponKill(int weaponId, int weaponClassId, bool headshot, b
SendPartialNotification();
}
/* <1efe16> ../cstrike/dlls/career_tasks.cpp:348 */
void CCareerTask::OnWeaponInjury(int weaponId, int weaponClassId, bool attackerHasShield, CBasePlayer *pAttacker)
{
if (m_isComplete || m_event != EVENT_PLAYER_TOOK_DAMAGE)
{
return;
}
if (m_weaponId == WEAPON_SHIELDGUN)
{
@ -233,9 +217,9 @@ void CCareerTask::OnWeaponInjury(int weaponId, int weaponClassId, bool attackerH
if (m_weaponId != weaponId)
return;
}
else if (m_weaponClassId)
else
{
if (m_weaponClassId != weaponClassId)
if (!m_weaponClassId || m_weaponClassId != weaponClassId)
return;
}
@ -243,7 +227,6 @@ void CCareerTask::OnWeaponInjury(int weaponId, int weaponClassId, bool attackerH
SendPartialNotification();
}
/* <1ef79d> ../cstrike/dlls/career_tasks.cpp:385 */
void CCareerTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer *pVictim, CBasePlayer *pAttacker)
{
if (m_isComplete)
@ -279,9 +262,9 @@ void CCareerTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer *pVicti
}
}
if (m_event != EVENT_KILL || (!m_weaponId && !m_weaponClassId)
&& m_event != EVENT_HEADSHOT || (!m_weaponId && !m_weaponClassId)
&& m_event != EVENT_PLAYER_TOOK_DAMAGE || (!m_weaponId && !m_weaponClassId))
if ((m_event != EVENT_KILL || (!m_weaponId && !m_weaponClassId))
&& (m_event != EVENT_HEADSHOT || (!m_weaponId && !m_weaponClassId))
&& (m_event != EVENT_PLAYER_TOOK_DAMAGE || (!m_weaponId && !m_weaponClassId)))
{
if (m_event == EVENT_ROUND_WIN)
{
@ -363,7 +346,7 @@ void CCareerTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer *pVicti
if (m_event == EVENT_ROUND_WIN && !Q_strcmp(m_name, "winfast"))
{
TheCareerTasks->SetFinishedTaskTime((int)TheCareerTasks->GetRoundElapsedTime());
TheCareerTasks->SetFinishedTaskTime(int(TheCareerTasks->GetRoundElapsedTime()));
UTIL_GetLocalPlayer()->SyncRoundTimer();
}
}
@ -395,7 +378,7 @@ void CCareerTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer *pVicti
if (m_event == EVENT_ROUND_WIN && !Q_strcmp(m_name, "winfast"))
{
TheCareerTasks->SetFinishedTaskTime((int)TheCareerTasks->GetRoundElapsedTime());
TheCareerTasks->SetFinishedTaskTime(int(TheCareerTasks->GetRoundElapsedTime()));
UTIL_GetLocalPlayer()->SyncRoundTimer();
}
@ -416,7 +399,6 @@ void CCareerTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer *pVicti
}
}
/* <1efeed> ../cstrike/dlls/career_tasks.cpp:623 */
void CCareerTaskManager::Create()
{
if (TheCareerTasks != NULL)
@ -428,22 +410,18 @@ void CCareerTaskManager::Create()
TheCareerTasks = new CCareerTaskManager;
}
/* <1eff77> ../cstrike/dlls/career_tasks.cpp:636 */
CCareerTaskManager::CCareerTaskManager()
{
m_taskTime = 0;
Reset();
}
/* <1effeb> ../cstrike/dlls/career_tasks.cpp:643 */
void CCareerTaskManager::Reset(bool deleteTasks)
{
if (deleteTasks)
{
for (CareerTaskListIt it = m_tasks.begin(); it != m_tasks.end(); ++it)
{
delete (*it);
}
m_tasks.clear();
m_nextId = 0;
@ -464,16 +442,12 @@ void CCareerTaskManager::Reset(bool deleteTasks)
m_roundStartTime = gpGlobals->time + CVAR_GET_FLOAT("mp_freezetime");
}
/* <1f014e> ../cstrike/dlls/career_tasks.cpp:671 */
void CCareerTaskManager::SetFinishedTaskTime(int val)
{
CHalfLifeMultiplay *mp = g_pGameRules;
m_finishedTaskTime = val;
m_finishedTaskRound = mp->m_iTotalRoundsPlayed;
m_finishedTaskRound = CSGameRules()->m_iTotalRoundsPlayed;
}
/* <1f018b> ../cstrike/dlls/career_tasks.cpp:679 */
void CCareerTaskManager::AddTask(const char *taskName, const char *weaponName, int eventCount, bool mustLive, bool crossRounds, bool isComplete)
{
++m_nextId;
@ -521,7 +495,6 @@ void CCareerTaskManager::AddTask(const char *taskName, const char *weaponName, i
MESSAGE_END();
}
/* <1f0381> ../cstrike/dlls/career_tasks.cpp:721 */
void CCareerTaskManager::HandleEvent(GameEventType event, CBasePlayer *pAttacker, CBasePlayer *pVictim)
{
if (event == EVENT_ROUND_START)
@ -542,7 +515,6 @@ void CCareerTaskManager::HandleEvent(GameEventType event, CBasePlayer *pAttacker
}
}
/* <1f0462> ../cstrike/dlls/career_tasks.cpp:748 */
void CCareerTaskManager::HandleWeaponKill(int weaponId, int weaponClassId, bool headshot, bool killerHasShield, CBasePlayer *pAttacker, CBasePlayer *pVictim)
{
for (CareerTaskListIt it = m_tasks.begin(); it != m_tasks.end(); ++it)
@ -551,11 +523,9 @@ void CCareerTaskManager::HandleWeaponKill(int weaponId, int weaponClassId, bool
}
}
/* <1f04ed> ../cstrike/dlls/career_tasks.cpp:757 */
void CCareerTaskManager::HandleEnemyKill(bool wasBlind, const char *weaponName, bool headshot, bool killerHasShield, CBasePlayer *pAttacker, CBasePlayer *pVictim)
{
HandleWeaponKill(AliasToWeaponID(weaponName), AliasToWeaponClass(weaponName), headshot, killerHasShield, pAttacker, pVictim);
HandleEvent(EVENT_KILL, pAttacker, pVictim);
if (headshot)
@ -568,7 +538,6 @@ void CCareerTaskManager::HandleEnemyKill(bool wasBlind, const char *weaponName,
}
}
/* <1f079c> ../cstrike/dlls/career_tasks.cpp:768 */
void CCareerTaskManager::HandleWeaponInjury(int weaponId, int weaponClassId, bool attackerHasShield, CBasePlayer *pAttacker)
{
for (CareerTaskListIt it = m_tasks.begin(); it != m_tasks.end(); ++it)
@ -577,14 +546,12 @@ void CCareerTaskManager::HandleWeaponInjury(int weaponId, int weaponClassId, boo
}
}
/* <1f0815> ../cstrike/dlls/career_tasks.cpp:777 */
void CCareerTaskManager::HandleEnemyInjury(const char *weaponName, bool attackerHasShield, CBasePlayer *pAttacker)
{
HandleWeaponInjury(AliasToWeaponID(weaponName), AliasToWeaponClass(weaponName), attackerHasShield, pAttacker);
HandleEvent(EVENT_PLAYER_TOOK_DAMAGE);
}
/* <1f094e> ../cstrike/dlls/career_tasks.cpp:784 */
void CCareerTaskManager::HandleDeath(int team, CBasePlayer *pAttacker)
{
int enemyTeam = (Q_strcmp(humans_join_team.string, "CT") != 0) ? CT : TERRORIST;
@ -607,7 +574,6 @@ void CCareerTaskManager::HandleDeath(int team, CBasePlayer *pAttacker)
}
}
/* <1f0a5d> ../cstrike/dlls/career_tasks.cpp:805 */
bool CCareerTaskManager::AreAllTasksComplete()
{
for (CareerTaskListIt it = m_tasks.begin(); it != m_tasks.end(); ++it)
@ -619,32 +585,28 @@ bool CCareerTaskManager::AreAllTasksComplete()
return true;
}
/* <1f0abc> ../cstrike/dlls/career_tasks.cpp:818 */
int CCareerTaskManager::GetNumRemainingTasks()
{
int ret = 0;
for (CareerTaskListIt it = m_tasks.begin(); it != m_tasks.end(); ++it)
{
if (!(*it)->IsComplete())
ret++;
++ret;
}
return ret;
}
/* <1f0b33> ../cstrike/dlls/career_tasks.cpp:832 */
float CCareerTaskManager::GetRoundElapsedTime()
{
return (gpGlobals->time - m_roundStartTime);
}
/* <1f0b56> ../cstrike/dlls/career_tasks.cpp:838 */
void CCareerTaskManager::LatchRoundEndMessage()
{
m_shouldLatchRoundEndMessage = true;
}
/* <1f0b81> ../cstrike/dlls/career_tasks.cpp:844 */
void CCareerTaskManager::UnlatchRoundEndMessage()
{
m_shouldLatchRoundEndMessage = false;

View File

@ -34,7 +34,6 @@
#include <list>
/* <1ef43f> ../cstrike/dlls/career_tasks.cpp:192 */
class CCareerTask
{
public:
@ -50,7 +49,7 @@ public:
void OnEvent_(GameEventType event, CBasePlayer *pAttacker, CBasePlayer *pVictim);
void Reset_();
#endif // HOOK_GAMEDLL
#endif
public:
static CCareerTask *NewTask(const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete);
@ -58,7 +57,7 @@ public:
void OnWeaponKill(int weaponId, int weaponClassId, bool headshot, bool killerHasShield, CBasePlayer *pAttacker, CBasePlayer *pVictim);
void OnWeaponInjury(int weaponId, int weaponClassId, bool attackerHasShield, CBasePlayer *pAttacker);
bool IsComplete() { return m_isComplete;}
bool IsComplete() { return m_isComplete; }
const char *GetTaskName() { return m_name; }
int GetWeaponId() { return m_weaponId; }
@ -89,7 +88,6 @@ typedef CareerTaskList::iterator CareerTaskListIt;
typedef CCareerTask *(*TaskFactoryFunction)(const char *taskName, GameEventType event, const char *weaponName, int eventCount, bool mustLive, bool crossRounds, int nextId, bool isComplete);
/* <1ef56d> ../cstrike/dlls/career_tasks.cpp:139 */
class CPreventDefuseTask: public CCareerTask
{
public:
@ -104,7 +102,7 @@ public:
void OnEvent_(GameEventType event, CBasePlayer *pAttacker, CBasePlayer *pVictim);
void Reset_();
#endif // HOOK_GAMEDLL
#endif
public:
static CCareerTask *NewTask(const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete);
@ -114,7 +112,6 @@ protected:
bool m_defuseStartedThisRound;
};
/* <1efed1> ../cstrike/dlls/career_tasks.cpp:636 */
class CCareerTaskManager
{
public:

View File

@ -81,7 +81,6 @@ BOOL gTouchDisabled = FALSE;
#endif // HOOK_GAMEDLL
/* <30850> ../cstrike/dlls/cbase.cpp:117 */
int CaseInsensitiveHash(const char *string, int iBounds)
{
unsigned int hash = 0;
@ -102,7 +101,6 @@ int CaseInsensitiveHash(const char *string, int iBounds)
return (hash % iBounds);
}
/* <30d81> ../cstrike/dlls/cbase.cpp:136 */
void EmptyEntityHashTable()
{
int i;
@ -127,7 +125,6 @@ void EmptyEntityHashTable()
}
}
/* <2f053> ../cstrike/dlls/cbase.cpp:156 */
void AddEntityHashValue(entvars_t *pev, const char *value, hash_types_e fieldType)
{
int count;
@ -201,7 +198,6 @@ void AddEntityHashValue(entvars_t *pev, const char *value, hash_types_e fieldTyp
}
}
/* <2f0c8> ../cstrike/dlls/cbase.cpp:255 */
void RemoveEntityHashValue(entvars_t *pev, const char *value, hash_types_e fieldType)
{
int hash;
@ -269,7 +265,6 @@ void RemoveEntityHashValue(entvars_t *pev, const char *value, hash_types_e field
}
}
/* <31125> ../cstrike/dlls/cbase.cpp:337 */
void printEntities()
{
for (int i = 0; i < stringsHashTable.Count(); ++i)
@ -288,8 +283,7 @@ void printEntities()
}
}
/* <311e9> ../cstrike/dlls/cbase.cpp:354 */
edict_t *CREATE_NAMED_ENTITY(string_t iClass)
NOINLINE edict_t *CREATE_NAMED_ENTITY(string_t iClass)
{
edict_t *named = g_engfuncs.pfnCreateNamedEntity(iClass);
if (named != NULL)
@ -300,7 +294,6 @@ edict_t *CREATE_NAMED_ENTITY(string_t iClass)
return named;
}
/* <31249> ../cstrike/dlls/cbase.cpp:366 */
void REMOVE_ENTITY(edict_t *e)
{
if (e != NULL)
@ -309,7 +302,6 @@ void REMOVE_ENTITY(edict_t *e)
}
}
/* <30158> ../cstrike/dlls/cbase.cpp:375 */
void CONSOLE_ECHO_(char *pszMsg, ...)
{
va_list argptr;
@ -322,7 +314,6 @@ void CONSOLE_ECHO_(char *pszMsg, ...)
SERVER_PRINT(szStr);
}
/* <31273> ../cstrike/dlls/cbase.cpp:386 */
void loopPerformance()
{
CPerformanceCounter loopCounter;
@ -375,7 +366,6 @@ void loopPerformance()
CONSOLE_ECHO(" Time in new search loop %.4f\n", (end - start) * 1000.0);
}
/* <313df> ../cstrike/dlls/cbase.cpp:451 */
C_DLLEXPORT int GetEntityAPI(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion)
{
if (!pFunctionTable || interfaceVersion != INTERFACE_VERSION)
@ -392,7 +382,6 @@ C_DLLEXPORT int GetEntityAPI(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion
return 1;
}
/* <3161a> ../cstrike/dlls/cbase.cpp:471 */
NOXREF int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion)
{
if (!pFunctionTable || *interfaceVersion != INTERFACE_VERSION)
@ -405,7 +394,6 @@ NOXREF int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion)
return 1;
}
/* <3165b> ../cstrike/dlls/cbase.cpp:485 */
C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion)
{
if (!pFunctionTable || *interfaceVersion != NEW_DLL_FUNCTIONS_VERSION)
@ -418,7 +406,6 @@ C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pFunctionTable, int *inter
return 1;
}
/* <30ab0> ../cstrike/dlls/cbase.cpp:498 */
int EXT_FUNC DispatchSpawn(edict_t *pent)
{
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent);
@ -437,7 +424,7 @@ int EXT_FUNC DispatchSpawn(edict_t *pent)
if (pEntity != NULL)
{
if (g_pGameRules && !g_pGameRules->IsAllowedToSpawn(pEntity))
if (g_pGameRules != NULL && !g_pGameRules->IsAllowedToSpawn(pEntity))
{
// return that this entity should be deleted
return -1;
@ -479,7 +466,6 @@ int EXT_FUNC DispatchSpawn(edict_t *pent)
return 0;
}
/* <2e8a0> ../cstrike/dlls/cbase.cpp:549 */
void EXT_FUNC DispatchKeyValue(edict_t *pentKeyvalue, KeyValueData *pkvd)
{
if (!pkvd || !pentKeyvalue)
@ -503,8 +489,6 @@ void EXT_FUNC DispatchKeyValue(edict_t *pentKeyvalue, KeyValueData *pkvd)
// HACKHACK -- this is a hack to keep the node graph entity from "touching" things (like triggers)
// while it builds the graph
/* <2e7db> ../cstrike/dlls/cbase.cpp:574 */
void EXT_FUNC DispatchTouch(edict_t *pentTouched, edict_t *pentOther)
{
if (gTouchDisabled)
@ -517,19 +501,17 @@ void EXT_FUNC DispatchTouch(edict_t *pentTouched, edict_t *pentOther)
pEntity->Touch(pOther);
}
/* <2fa9b> ../cstrike/dlls/cbase.cpp:587 */
void EXT_FUNC DispatchUse(edict_t *pentUsed, edict_t *pentOther)
{
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pentUsed);
CBaseEntity *pOther = (CBaseEntity *)GET_PRIVATE(pentOther);
if (pEntity && !(pEntity->pev->flags & FL_KILLME))
if (pEntity != NULL && !(pEntity->pev->flags & FL_KILLME))
{
pEntity->Use(pOther, pOther, USE_TOGGLE, 0);
}
}
/* <2fb2f> ../cstrike/dlls/cbase.cpp:596 */
void EXT_FUNC DispatchThink(edict_t *pent)
{
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent);
@ -545,7 +527,6 @@ void EXT_FUNC DispatchThink(edict_t *pent)
}
}
/* <2fb89> ../cstrike/dlls/cbase.cpp:612 */
void EXT_FUNC DispatchBlocked(edict_t *pentBlocked, edict_t *pentOther)
{
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pentBlocked);
@ -557,7 +538,6 @@ void EXT_FUNC DispatchBlocked(edict_t *pentBlocked, edict_t *pentOther)
}
}
/* <2ff56> ../cstrike/dlls/cbase.cpp:621 */
void EXT_FUNC DispatchSave(edict_t *pent, SAVERESTOREDATA *pSaveData)
{
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent);
@ -598,8 +578,6 @@ void EXT_FUNC DispatchSave(edict_t *pent, SAVERESTOREDATA *pSaveData)
// Find the matching global entity. Spit out an error if the designer made entities of
// different classes with the same global name
/* <31697> ../cstrike/dlls/cbase.cpp:656 */
CBaseEntity *FindGlobalEntity(string_t classname, string_t globalname)
{
edict_t *pent = FIND_ENTITY_BY_STRING(NULL, "globalname", STRING(globalname));
@ -617,7 +595,6 @@ CBaseEntity *FindGlobalEntity(string_t classname, string_t globalname)
return pReturn;
}
/* <3179c> ../cstrike/dlls/cbase.cpp:673 */
int EXT_FUNC DispatchRestore(edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity)
{
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent);
@ -732,7 +709,6 @@ int EXT_FUNC DispatchRestore(edict_t *pent, SAVERESTOREDATA *pSaveData, int glob
return 0;
}
/* <2fdcd> ../cstrike/dlls/cbase.cpp:776 */
void EXT_FUNC DispatchObjectCollsionBox(edict_t *pent)
{
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent);
@ -746,21 +722,18 @@ void EXT_FUNC DispatchObjectCollsionBox(edict_t *pent)
}
/* <2fe94> ../cstrike/dlls/cbase.cpp:788 */
void EXT_FUNC SaveWriteFields(SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount)
{
CSave saveHelper(pSaveData);
saveHelper.WriteFields(pname, pBaseData, pFields, fieldCount);
}
/* <30047> ../cstrike/dlls/cbase.cpp:795 */
void EXT_FUNC SaveReadFields(SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount)
{
CRestore restoreHelper(pSaveData);
restoreHelper.ReadFields(pname, pBaseData, pFields, fieldCount);
}
/* <31a74> ../cstrike/dlls/cbase.cpp:802 */
edict_t *EHANDLE::Get()
{
if (!m_pent || m_pent->serialnumber != m_serialnumber)
@ -769,7 +742,6 @@ edict_t *EHANDLE::Get()
return m_pent;
}
/* <31a95> ../cstrike/dlls/cbase.cpp:814 */
edict_t *EHANDLE::Set(edict_t *pent)
{
m_pent = pent;
@ -779,13 +751,11 @@ edict_t *EHANDLE::Set(edict_t *pent)
return pent;
}
/* <31ace> ../cstrike/dlls/cbase.cpp:823 */
EHANDLE::operator CBaseEntity *()
{
return (CBaseEntity *)GET_PRIVATE(Get());
}
/* <31b30> ../cstrike/dlls/cbase.cpp:829 */
CBaseEntity *EHANDLE::operator=(CBaseEntity *pEntity)
{
if (pEntity != NULL)
@ -803,19 +773,16 @@ CBaseEntity *EHANDLE::operator=(CBaseEntity *pEntity)
return pEntity;
}
/* <31b69> ../cstrike/dlls/cbase.cpp:845 */
EHANDLE::operator int()
{
return Get() != NULL;
}
/* <31bac> ../cstrike/dlls/cbase.cpp:850 */
CBaseEntity *EHANDLE::operator->()
{
return (CBaseEntity *)GET_PRIVATE(Get());
}
/* <301be> ../cstrike/dlls/cbase.cpp:857 */
int CBaseEntity::__MAKE_VHOOK(TakeHealth)(float flHealth, int bitsDamageType)
{
if (pev->takedamage == DAMAGE_NO)
@ -834,7 +801,6 @@ int CBaseEntity::__MAKE_VHOOK(TakeHealth)(float flHealth, int bitsDamageType)
return 1;
}
/* <305af> ../cstrike/dlls/cbase.cpp:876 */
int CBaseEntity::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
Vector vecTemp;
@ -845,11 +811,13 @@ int CBaseEntity::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe
// UNDONE: some entity types may be immune or resistant to some bitsDamageType
// if Attacker == Inflictor, the attack was a melee or other instant-hit attack.
// (that is, no actual entity projectile was involved in the attack so use the shooter's origin).
#ifndef REGAMEDLL_FIXES
if (pevAttacker == pevInflictor)
{
vecTemp = pevInflictor->origin - (VecBModelOrigin(pev));
}
else
#endif
{
// an actual missile was involved.
vecTemp = pevInflictor->origin - (VecBModelOrigin(pev));
@ -884,7 +852,6 @@ int CBaseEntity::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe
return 1;
}
/* <2fe50> ../cstrike/dlls/cbase.cpp:927 */
void CBaseEntity::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib)
{
pev->takedamage = DAMAGE_NO;
@ -892,7 +859,6 @@ void CBaseEntity::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib)
UTIL_Remove(this);
}
/* <2fc1c> ../cstrike/dlls/cbase.cpp:935 */
CBaseEntity *CBaseEntity::__MAKE_VHOOK(GetNextTarget)()
{
if (FStringNull(pev->target))
@ -908,7 +874,6 @@ CBaseEntity *CBaseEntity::__MAKE_VHOOK(GetNextTarget)()
return Instance(pTarget);
}
/* <302a6> ../cstrike/dlls/cbase.cpp:958 */
int CBaseEntity::__MAKE_VHOOK(Save)(CSave &save)
{
if (save.WriteEntVars("ENTVARS", pev))
@ -919,7 +884,6 @@ int CBaseEntity::__MAKE_VHOOK(Save)(CSave &save)
return 0;
}
/* <30440> ../cstrike/dlls/cbase.cpp:966 */
int CBaseEntity::__MAKE_VHOOK(Restore)(CRestore &restore)
{
int status;
@ -949,7 +913,6 @@ int CBaseEntity::__MAKE_VHOOK(Restore)(CRestore &restore)
return status;
}
/* <2fcf6> ../cstrike/dlls/cbase.cpp:991 */
void SetObjectCollisionBox(entvars_t *pev)
{
if ((pev->solid == SOLID_BSP) && (pev->angles.x || pev->angles.y || pev->angles.z))
@ -961,13 +924,13 @@ void SetObjectCollisionBox(entvars_t *pev)
max = 0;
for (i = 0; i < 3; ++i)
{
v = fabs((float_precision)((float *)pev->mins)[i]);
v = Q_fabs(float_precision(((float *)pev->mins)[i]));
if (v > max)
{
max = v;
}
v = fabs((float_precision)((float *)pev->maxs)[i]);
v = Q_fabs(float_precision(((float *)pev->maxs)[i]));
if (v > max)
{
max = v;
@ -994,13 +957,11 @@ void SetObjectCollisionBox(entvars_t *pev)
pev->absmax.z += 1;
}
/* <2fe2a> ../cstrike/dlls/cbase.cpp:1030 */
void CBaseEntity::__MAKE_VHOOK(SetObjectCollisionBox)()
{
::SetObjectCollisionBox(pev);
}
/* <31c0e> ../cstrike/dlls/cbase.cpp:1036 */
int CBaseEntity::Intersects(CBaseEntity *pOther)
{
if (pOther->pev->absmin.x > pev->absmax.x
@ -1013,7 +974,6 @@ int CBaseEntity::Intersects(CBaseEntity *pOther)
return 1;
}
/* <31c43> ../cstrike/dlls/cbase.cpp:1048 */
void CBaseEntity::MakeDormant()
{
pev->flags |= FL_DORMANT;
@ -1034,13 +994,11 @@ void CBaseEntity::MakeDormant()
UTIL_SetOrigin(pev, pev->origin);
}
/* <31c66> ../cstrike/dlls/cbase.cpp:1064 */
int CBaseEntity::IsDormant()
{
return (pev->flags & FL_DORMANT) == FL_DORMANT;
}
/* <30221> ../cstrike/dlls/cbase.cpp:1069 */
BOOL CBaseEntity::__MAKE_VHOOK(IsInWorld)()
{
// position
@ -1066,7 +1024,6 @@ BOOL CBaseEntity::__MAKE_VHOOK(IsInWorld)()
return TRUE;
}
/* <31c8c> ../cstrike/dlls/cbase.cpp:1089 */
int CBaseEntity::ShouldToggle(USE_TYPE useType, BOOL currentState)
{
if (useType != USE_TOGGLE && useType != USE_SET)
@ -1078,7 +1035,6 @@ int CBaseEntity::ShouldToggle(USE_TYPE useType, BOOL currentState)
return 1;
}
/* <30258> ../cstrike/dlls/cbase.cpp:1100 */
int CBaseEntity::__MAKE_VHOOK(DamageDecal)(int bitsDamageType)
{
if (pev->rendermode == kRenderTransAlpha)
@ -1092,8 +1048,6 @@ int CBaseEntity::__MAKE_VHOOK(DamageDecal)(int bitsDamageType)
// NOTE: szName must be a pointer to constant memory, e.g. "monster_class" because the entity
// will keep a pointer to it after this call.
/* <31cd1> ../cstrike/dlls/cbase.cpp:1115 */
CBaseEntity *CBaseEntity::Create(char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner)
{
edict_t *pent;
@ -1117,7 +1071,6 @@ CBaseEntity *CBaseEntity::Create(char *szName, const Vector &vecOrigin, const Ve
return pEntity;
}
/* <30885> ../cstrike/dlls/cbase.cpp:1134 */
void OnFreeEntPrivateData(edict_t *pEnt)
{
CBaseEntity *pEntity = CBaseEntity::Instance(pEnt);

View File

@ -32,11 +32,10 @@
#pragma once
#endif
#include "saverestore.h"
#include "schedule.h"
#include "monsterevent.h"
#include <utlvector.h>
#include "game_shared/perf_counter.h"
#undef CREATE_NAMED_ENTITY
#undef REMOVE_ENTITY
@ -182,10 +181,7 @@
#define EXPORT /**/
#endif // _WIN32
enum hash_types_e
{
CLASSNAME
};
enum hash_types_e { CLASSNAME };
typedef struct hash_item_s
{
@ -256,7 +252,6 @@ private:
int m_serialnumber;
};
/* <48e9c1> ../cstrike/dlls/cbase.h:166 */
class CBaseEntity
{
public:
@ -360,11 +355,11 @@ public:
BOOL FVisible_(CBaseEntity *pEntity);
BOOL FVisible_(const Vector &vecOrigin);
#endif // HOOK_GAMEDLL
#endif
public:
void *operator new(size_t stAllocateBlock, entvars_t *pevnew) { return ALLOC_PRIVATE(ENT(pevnew), stAllocateBlock); }
void operator delete(void *pMem, entvars_t *pev) { pev->flags |= FL_KILLME; }
void operator delete(void *pMem, entvars_t *pevnew) { pevnew->flags |= FL_KILLME; }
void UpdateOnRemove();
void EXPORT SUB_Remove();
void EXPORT SUB_DoNothing();
@ -447,19 +442,9 @@ public:
bool has_disconnected;
};
/* <48d2a5> ../cstrike/dlls/cbase.h:273 */
inline int FNullEnt(CBaseEntity *ent)
{
return (ent == NULL || FNullEnt(ent->edict()));
}
inline int FNullEnt(CBaseEntity *ent) { return (ent == NULL || FNullEnt(ent->edict())); }
inline int FNullEnt(EHANDLE hent) { return (hent == NULL || FNullEnt(OFFSET(hent.Get()))); }
/* <48d67d> ../cstrike/dlls/cbase.h:273 */
inline int FNullEnt(EHANDLE hent)
{
return (hent == NULL || FNullEnt(OFFSET(hent.Get())));
}
/* <19e6b5> ../cstrike/dlls/cbase.h:450 */
class CPointEntity: public CBaseEntity
{
public:
@ -470,11 +455,10 @@ public:
void Spawn_();
#endif // HOOK_GAMEDLL
#endif
};
/* <249f0> ../cstrike/dlls/cbase.h:484 */
class CMultiSource: public CPointEntity
{
public:
@ -495,7 +479,7 @@ public:
int Save_(CSave &save);
int Restore_(CRestore &restore);
#endif // HOOK_GAMEDLL
#endif
public:
void EXPORT Register();
@ -509,7 +493,6 @@ public:
string_t m_globalstate;
};
/* <48ea00> ../cstrike/dlls/cbase.h:509 */
class CBaseDelay: public CBaseEntity
{
public:
@ -523,7 +506,7 @@ public:
int Save_(CSave &save);
int Restore_(CRestore &restore);
#endif // HOOK_GAMEDLL
#endif
public:
void SUB_UseTargets(CBaseEntity *pActivator, USE_TYPE useType, float value);
@ -535,7 +518,6 @@ public:
int m_iszKillTarget;
};
/* <48ea6f> ../cstrike/dlls/cbase.h:526 */
class CBaseAnimating: public CBaseDelay
{
public:
@ -548,7 +530,7 @@ public:
int Save_(CSave &save);
int Restore_(CRestore &restore);
#endif // HOOK_GAMEDLL
#endif
public:
float StudioFrameAdvance(float flInterval = 0.0f);
@ -561,13 +543,13 @@ public:
float SetBoneController(int iController, float flValue = 0.0f);
void InitBoneControllers();
NOXREF float SetBlending(int iBlender, float flValue);
NOXREF void GetBonePosition(int iBone, Vector &origin, Vector &angles);
NOXREF void GetAutomovement(Vector &origin, Vector &angles, float flInterval = 0.1f);
NOXREF int FindTransition(int iEndingSequence, int iGoalSequence, int *piDir);
NOXREF void GetAttachment(int iAttachment, Vector &origin, Vector &angles);
NOXREF void SetBodygroup(int iGroup, int iValue);
NOXREF int GetBodygroup(int iGroup);
float SetBlending(int iBlender, float flValue);
void GetBonePosition(int iBone, Vector &origin, Vector &angles);
void GetAutomovement(Vector &origin, Vector &angles, float flInterval = 0.1f);
int FindTransition(int iEndingSequence, int iGoalSequence, int *piDir);
void GetAttachment(int iAttachment, Vector &origin, Vector &angles);
void SetBodygroup(int iGroup, int iValue);
int GetBodygroup(int iGroup);
int ExtractBbox(int sequence, float *mins, float *maxs);
void SetSequenceBox();
@ -581,7 +563,6 @@ public:
BOOL m_fSequenceLoops;
};
/* <48eb06> ../cstrike/dlls/cbase.h:569 */
class CBaseToggle: public CBaseAnimating
{
public:
@ -597,14 +578,14 @@ public:
int Save_(CSave &save);
int Restore_(CRestore &restore);
#endif // HOOK_GAMEDLL
#endif
public:
void LinearMove(Vector vecDest, float flSpeed);
void EXPORT LinearMoveDone();
void AngularMove(Vector vecDestAngle, float flSpeed);
void EXPORT AngularMoveDone();
NOXREF BOOL IsLockedByMaster();
BOOL IsLockedByMaster();
public:
static float AxisValue(int flags, const Vector &angles);
@ -638,8 +619,6 @@ public:
#include "basemonster.h"
// Generic Button
/* <24b19> ../cstrike/dlls/cbase.h:745 */
class CBaseButton: public CBaseToggle
{
enum BUTTON_CODE
@ -675,14 +654,14 @@ public:
int Save_(CSave &save);
int Restore_(CRestore &restore);
#endif // HOOK_GAMEDLL
#endif
public:
NOXREF void RotSpawn();
void RotSpawn();
void ButtonActivate();
NOXREF void SparkSoundCache();
void SparkSoundCache();
NOXREF void EXPORT ButtonShot();
void EXPORT ButtonShot();
void EXPORT ButtonTouch(CBaseEntity *pOther);
void EXPORT ButtonSpark();
void EXPORT TriggerAndWait();
@ -706,7 +685,6 @@ public:
int m_sounds;
};
/* <1da023> ../cstrike/dlls/cbase.h:861 */
class CWorld: public CBaseEntity
{
public:
@ -720,7 +698,7 @@ public:
void Precache_();
void KeyValue_(KeyValueData *pkvd);
#endif // HOOK_GAMEDLL
#endif
};
@ -738,14 +716,19 @@ T *GetClassPtr(T *a)
#if defined(HOOK_GAMEDLL) && defined(_WIN32) && !defined(REGAMEDLL_UNIT_TESTS)
VirtualTableInit((void *)a, stripClass(typeid(T).name()));
#endif // _WIN32 && HOOK_GAMEDLL
#endif
}
return a;
}
#ifdef REGAMEDLL_SELF
extern CUtlVector<hash_item_t> stringsHashTable;
#endif
C_DLLEXPORT int GetEntityAPI(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion);
C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion);
int CaseInsensitiveHash(const char *string, int iBounds);
void EmptyEntityHashTable();
@ -756,11 +739,6 @@ edict_t *CREATE_NAMED_ENTITY(string_t iClass);
void REMOVE_ENTITY(edict_t *e);
void CONSOLE_ECHO_(char *pszMsg, ...);
void loopPerformance();
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);
void DispatchTouch(edict_t *pentTouched, edict_t *pentOther);

File diff suppressed because it is too large Load Diff

View File

@ -101,7 +101,10 @@ struct entity_field_alias_t
int field;
};
extern float g_flTimeLimit;
C_DLLEXPORT float g_flTimeLimit;
C_DLLEXPORT int CountTeams();
C_DLLEXPORT int CountTeamPlayers(int iTeam);
extern float g_flResetTime;
extern bool g_skipCareerInitialSpawn;
@ -110,7 +113,7 @@ extern unsigned short g_iShadowSprite;
int CMD_ARGC_();
const char *CMD_ARGV_(int i);
NOXREF void set_suicide_frame(entvars_t *pev);
void set_suicide_frame(entvars_t *pev);
void TeamChangeUpdate(CBasePlayer *player, int team_id);
void BlinkAccount(CBasePlayer *player, int numBlinks);
BOOL ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *szRejectReason);
@ -119,9 +122,7 @@ void respawn(entvars_t *pev, BOOL fCopyCorpse = FALSE);
void ClientKill(edict_t *pEntity);
void ShowMenu(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText);
void ShowVGUIMenu(CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu);
NOXREF C_DLLEXPORT int CountTeams();
void ListPlayers(CBasePlayer *current);
C_DLLEXPORT int CountTeamPlayers(int iTeam);
void ProcessKickVote(CBasePlayer *pVotingPlayer, CBasePlayer *pKickPlayer);
TeamName SelectDefaultTeam();
void CheckStartMoney();
@ -146,7 +147,7 @@ void Radio3(CBasePlayer *player, int slot);
bool BuyGunAmmo(CBasePlayer *player, CBasePlayerItem *weapon, bool bBlinkMoney);
bool BuyAmmo(CBasePlayer *player, int nSlot, bool bBlinkMoney);
CBaseEntity *EntityFromUserID(int userID);
NOXREF int CountPlayersInServer();
int CountPlayersInServer();
BOOL HandleBuyAliasCommands(CBasePlayer *pPlayer, const char *pszCommand);
BOOL HandleRadioAliasCommands(CBasePlayer *pPlayer, const char *pszCommand);
void ClientCommand(edict_t *pEntity);

View File

@ -1,6 +1,5 @@
#include "precompiled.h"
/* <5f4cb> ../cstrike/dlls/combat.cpp:52 */
void CGib::LimitVelocity()
{
float length = pev->velocity.Length();
@ -14,7 +13,6 @@ void CGib::LimitVelocity()
}
}
/* <60320> ../cstrike/dlls/combat.cpp:63 */
NOXREF void CGib::SpawnStickyGibs(entvars_t *pevVictim, Vector vecOrigin, int cGibs)
{
int i;
@ -78,7 +76,6 @@ NOXREF void CGib::SpawnStickyGibs(entvars_t *pevVictim, Vector vecOrigin, int cG
}
}
/* <5ff7f> ../cstrike/dlls/combat.cpp:132 */
void CGib::SpawnHeadGib(entvars_t *pevVictim)
{
CGib *pGib = GetClassPtr((CGib *)NULL);
@ -112,6 +109,7 @@ void CGib::SpawnHeadGib(entvars_t *pevVictim)
}
else
{
// TODO: fix test demo
pGib->pev->velocity.z = RANDOM_FLOAT(200, 300);
pGib->pev->velocity.y = RANDOM_FLOAT(-100, 100);
pGib->pev->velocity.x = RANDOM_FLOAT(-100, 100);
@ -138,7 +136,6 @@ void CGib::SpawnHeadGib(entvars_t *pevVictim)
pGib->LimitVelocity();
}
/* <606c8> ../cstrike/dlls/combat.cpp:190 */
void CGib::SpawnRandomGibs(entvars_t *pevVictim, int cGibs, int human)
{
int cSplat;
@ -207,7 +204,6 @@ void CGib::SpawnRandomGibs(entvars_t *pevVictim, int cGibs, int human)
}
}
/* <5f58a> ../cstrike/dlls/combat.cpp:263 */
BOOL CBaseMonster::__MAKE_VHOOK(HasHumanGibs)()
{
int myClass = Classify();
@ -221,7 +217,6 @@ BOOL CBaseMonster::__MAKE_VHOOK(HasHumanGibs)()
return FALSE;
}
/* <5f5ca> ../cstrike/dlls/combat.cpp:278 */
BOOL CBaseMonster::__MAKE_VHOOK(HasAlienGibs)()
{
int myClass = Classify();
@ -236,7 +231,6 @@ BOOL CBaseMonster::__MAKE_VHOOK(HasAlienGibs)()
return FALSE;
}
/* <5f60a> ../cstrike/dlls/combat.cpp:295 */
void CBaseMonster::__MAKE_VHOOK(FadeMonster)()
{
StopAnimation();
@ -250,11 +244,10 @@ void CBaseMonster::__MAKE_VHOOK(FadeMonster)()
SUB_StartFadeOut();
}
/* <60a59> ../cstrike/dlls/combat.cpp:310 */
void CBaseMonster::__MAKE_VHOOK(GibMonster)()
{
TraceResult tr;
BOOL gibbed = FALSE;
bool gibbed = false;
EMIT_SOUND(ENT(pev), CHAN_WEAPON, "common/bodysplat.wav", VOL_NORM, ATTN_NORM);
@ -269,7 +262,7 @@ void CBaseMonster::__MAKE_VHOOK(GibMonster)()
// throw some human gibs.
CGib::SpawnRandomGibs(pev, 4, 1);
}
gibbed = TRUE;
gibbed = true;
}
else if (HasAlienGibs())
{
@ -279,7 +272,7 @@ void CBaseMonster::__MAKE_VHOOK(GibMonster)()
// Throw alien gibs
CGib::SpawnRandomGibs(pev, 4, 0);
}
gibbed = TRUE;
gibbed = true;
}
if (!IsPlayer())
@ -297,8 +290,6 @@ void CBaseMonster::__MAKE_VHOOK(GibMonster)()
// GetDeathActivity - determines the best type of death
// anim to play.
/* <5f65e> ../cstrike/dlls/combat.cpp:355 */
Activity CBaseMonster::__MAKE_VHOOK(GetDeathActivity)()
{
Activity deathActivity;
@ -417,8 +408,6 @@ Activity CBaseMonster::__MAKE_VHOOK(GetDeathActivity)()
// GetSmallFlinchActivity - determines the best type of flinch
// anim to play.
/* <5f848> ../cstrike/dlls/combat.cpp:476 */
NOXREF Activity CBaseMonster::GetSmallFlinchActivity()
{
Activity flinchActivity;
@ -466,7 +455,6 @@ NOXREF Activity CBaseMonster::GetSmallFlinchActivity()
return flinchActivity;
}
/* <5f8a6> ../cstrike/dlls/combat.cpp:525 */
void CBaseMonster::__MAKE_VHOOK(BecomeDead)()
{
// don't let autoaim aim at corpses.
@ -482,7 +470,6 @@ void CBaseMonster::__MAKE_VHOOK(BecomeDead)()
pev->movetype = MOVETYPE_TOSS;
}
/* <5f8cc> ../cstrike/dlls/combat.cpp:542 */
BOOL CBaseMonster::ShouldGibMonster(int iGib)
{
if ((iGib == GIB_NORMAL && pev->health < GIB_HEALTH_VALUE) || (iGib == GIB_ALWAYS))
@ -493,7 +480,6 @@ BOOL CBaseMonster::ShouldGibMonster(int iGib)
return FALSE;
}
/* <5f8f8> ../cstrike/dlls/combat.cpp:551 */
void CBaseMonster::CallGibMonster()
{
BOOL fade = FALSE;
@ -537,7 +523,6 @@ void CBaseMonster::CallGibMonster()
UTIL_Remove(this);
}
/* <5f938> ../cstrike/dlls/combat.cpp:598 */
void CBaseMonster::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib)
{
// unsigned int cCount = 0;
@ -586,7 +571,6 @@ void CBaseMonster::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib)
m_IdealMonsterState = MONSTERSTATE_DEAD;
}
/* <5e84e> ../cstrike/dlls/combat.cpp:652 */
void CBaseEntity::SUB_StartFadeOut()
{
if (pev->rendermode == kRenderNormal)
@ -602,7 +586,6 @@ void CBaseEntity::SUB_StartFadeOut()
SetThink(&CBaseEntity::SUB_FadeOut);
}
/* <5ea72> ../cstrike/dlls/combat.cpp:667 */
void CBaseEntity::SUB_FadeOut()
{
if (pev->renderamt > 7)
@ -618,7 +601,6 @@ void CBaseEntity::SUB_FadeOut()
}
}
/* <5eab1> ../cstrike/dlls/combat.cpp:688 */
void CGib::WaitTillLand()
{
if (!IsInWorld())
@ -639,7 +621,6 @@ void CGib::WaitTillLand()
pev->nextthink = gpGlobals->time + 0.5f;
}
/* <5eee0> ../cstrike/dlls/combat.cpp:718 */
void CGib::BounceGibTouch(CBaseEntity *pOther)
{
if (pev->flags & FL_ONGROUND)
@ -663,7 +644,7 @@ void CGib::BounceGibTouch(CBaseEntity *pOther)
if (m_material != matNone && !RANDOM_LONG(0, 2))
{
float zvel = fabs(pev->velocity.z);
float zvel = Q_fabs(pev->velocity.z);
float volume = 0.8 * Q_min(1.0f, zvel / 450);
CBreakable::MaterialSoundRandom(edict(), (Materials)m_material, volume);
@ -672,8 +653,6 @@ void CGib::BounceGibTouch(CBaseEntity *pOther)
}
// Sticky gib puts blood on the wall and stays put.
/* <5ed6d> ../cstrike/dlls/combat.cpp:761 */
void CGib::StickyGibTouch(CBaseEntity *pOther)
{
Vector vecSpot;
@ -700,7 +679,6 @@ void CGib::StickyGibTouch(CBaseEntity *pOther)
pev->movetype = MOVETYPE_NONE;
}
/* <5fb0b> ../cstrike/dlls/combat.cpp:789 */
void CGib::Spawn(const char *szGibModel)
{
pev->movetype = MOVETYPE_BOUNCE;
@ -717,11 +695,7 @@ void CGib::Spawn(const char *szGibModel)
/// hopefully this will fix the VELOCITY TOO LOW crap
pev->solid = SOLID_SLIDEBOX;
if (pev->classname)
RemoveEntityHashValue(pev, STRING(pev->classname), CLASSNAME);
MAKE_STRING_CLASS("gib", pev);
AddEntityHashValue(pev, STRING(pev->classname), CLASSNAME);
SET_MODEL(ENT(pev), szGibModel);
UTIL_SetSize(pev, Vector(0, 0, 0), Vector(0, 0, 0));
@ -738,7 +712,6 @@ void CGib::Spawn(const char *szGibModel)
m_cBloodDecals = 5;
}
/* <60aea> ../cstrike/dlls/combat.cpp:815 */
int CBaseMonster::__MAKE_VHOOK(TakeHealth)(float flHealth, int bitsDamageType)
{
if (pev->takedamage == DAMAGE_NO)
@ -758,8 +731,6 @@ int CBaseMonster::__MAKE_VHOOK(TakeHealth)(float flHealth, int bitsDamageType)
//
// Time-based damage: only occurs while the monster is within the trigger_hurt.
// When a monster is poisoned via an arrow etc it takes all the poison damage at once.
/* <60d7a> ../cstrike/dlls/combat.cpp:845 */
int CBaseMonster::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
float flTake;
@ -801,7 +772,7 @@ int CBaseMonster::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *p
vecDir = NormalizeSubtract<
float_precision, float, float_precision, float_precision
>(Center(), pInflictor->Center() - Vector(0, 0, 10));
#endif // PLAY_GAMEDLL
#endif
vecDir = g_vecAttackDir = vecDir.Normalize();
}
}
@ -853,20 +824,7 @@ int CBaseMonster::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *p
}
else
{
//m_vecEnemyLKP = pev->origin + (g_vecAttackDir * 64);
Vector v38;
float v37 = g_vecAttackDir[2] * 64.0;
v38[0] = g_vecAttackDir[0] * 64.0 + pev->origin[0];
v38[1] = g_vecAttackDir[1] * 64.0 + pev->origin[1];
double dbl_v29 = v37 + pev->origin[2];
float v30 = v38[1];
m_vecEnemyLKP[0] = v38[0];
v38[2] = dbl_v29;
float v32 = v38[2];
m_vecEnemyLKP[1] = v30;
m_vecEnemyLKP[2] = v32;
m_vecEnemyLKP = pev->origin + (g_vecAttackDir * 64);
}
MakeIdealYaw(m_vecEnemyLKP);
@ -887,8 +845,6 @@ int CBaseMonster::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *p
}
// DeadTakeDamage - takedamage function called when a monster's corpse is damaged.
/* <60b32> ../cstrike/dlls/combat.cpp:981 */
int CBaseMonster::DeadTakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
// grab the vector of the incoming attack. ( pretend that the inflictor is a little lower than it really is, so the body will tend to fly upward a bit).
@ -935,7 +891,6 @@ int CBaseMonster::DeadTakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker
return 1;
}
/* <61120> ../cstrike/dlls/combat.cpp:1027 */
float CBaseMonster::DamageForce(float damage)
{
float_precision force = damage * ((32 * 32 * 72.0) / (pev->size.x * pev->size.y * pev->size.z)) * 5;
@ -947,7 +902,6 @@ float CBaseMonster::DamageForce(float damage)
return force;
}
/* <61174> ../cstrike/dlls/combat.cpp:1044 */
void RadiusFlash(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType)
{
CBaseEntity *pEntity = NULL;
@ -1070,7 +1024,6 @@ void RadiusFlash(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker,
}
}
/* <5f042> ../cstrike/dlls/combat.cpp:1185 */
float GetAmountOfPlayerVisible(Vector vecSrc, CBaseEntity *entity)
{
float retval = 0.0f;
@ -1139,7 +1092,6 @@ float GetAmountOfPlayerVisible(Vector vecSrc, CBaseEntity *entity)
return retval;
}
/* <5dc27> ../cstrike/dlls/combat.cpp:1262 */
void RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType)
{
CBaseEntity *pEntity = NULL;
@ -1208,7 +1160,6 @@ void RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker
}
}
/* <5dcf9> ../cstrike/dlls/combat.cpp:1349 */
void RadiusDamage2(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType)
{
CBaseEntity *pEntity = NULL;
@ -1274,22 +1225,20 @@ void RadiusDamage2(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacke
}
}
/* <5e0d2> ../cstrike/dlls/combat.cpp:1442 */
void CBaseMonster::RadiusDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType)
{
if (flDamage > 80)
::RadiusDamage(pev->origin, pevInflictor, pevAttacker, flDamage, flDamage * 3.5, iClassIgnore, bitsDamageType);
else
RadiusDamage2(pev->origin, pevInflictor, pevAttacker, flDamage, iClassIgnore, bitsDamageType);
::RadiusDamage2(pev->origin, pevInflictor, pevAttacker, flDamage, flDamage * (RANDOM_FLOAT(0.5, 1.5) + 3), iClassIgnore, bitsDamageType);
}
/* <5e0d2> ../cstrike/dlls/combat.cpp:1448 */
NOXREF void CBaseMonster::RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType)
{
if (flDamage > 80)
::RadiusDamage(vecSrc, pevInflictor, pevAttacker, flDamage, flDamage * 3.5, iClassIgnore, bitsDamageType);
else
RadiusDamage2(vecSrc, pevInflictor, pevAttacker, flDamage, iClassIgnore, bitsDamageType);
::RadiusDamage2(vecSrc, pevInflictor, pevAttacker, flDamage, flDamage * (RANDOM_FLOAT(0.5, 1.5) + 3), iClassIgnore, bitsDamageType);
}
// CheckTraceHullAttack - expects a length to trace, amount
@ -1298,8 +1247,6 @@ NOXREF void CBaseMonster::RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, e
// other stuff to the victim (punchangle, etc)
//
// Used for many contact-range melee attacks. Bites, claws, etc.
/* <61949> ../cstrike/dlls/combat.cpp:1454 */
NOXREF CBaseEntity *CBaseMonster::CheckTraceHullAttack(float flDist, int iDamage, int iDmgType)
{
TraceResult tr;
@ -1333,8 +1280,6 @@ NOXREF CBaseEntity *CBaseMonster::CheckTraceHullAttack(float flDist, int iDamage
// FInViewCone - returns true is the passed ent is in
// the caller's forward view cone. The dot product is performed
// in 2d, making the view cone infinitely tall.
/* <61ae6> ../cstrike/dlls/combat.cpp:1490 */
BOOL CBaseMonster::__MAKE_VHOOK(FInViewCone)(CBaseEntity *pEntity)
{
Vector2D vec2LOS;
@ -1360,8 +1305,6 @@ BOOL CBaseMonster::__MAKE_VHOOK(FInViewCone)(CBaseEntity *pEntity)
// FInViewCone - returns true is the passed vector is in
// the caller's forward view cone. The dot product is performed
// in 2d, making the view cone infinitely tall.
/* <61be6> ../cstrike/dlls/combat.cpp:1517 */
BOOL CBaseMonster::__MAKE_VHOOK(FInViewCone)(const Vector *pOrigin)
{
Vector2D vec2LOS;
@ -1386,8 +1329,6 @@ BOOL CBaseMonster::__MAKE_VHOOK(FInViewCone)(const Vector *pOrigin)
// FVisible - returns true if a line can be traced from
// the caller's eyes to the target
/* <5ecb4> ../cstrike/dlls/combat.cpp:1543 */
BOOL CBaseEntity::__MAKE_VHOOK(FVisible)(CBaseEntity *pEntity)
{
TraceResult tr;
@ -1421,8 +1362,6 @@ BOOL CBaseEntity::__MAKE_VHOOK(FVisible)(CBaseEntity *pEntity)
// FVisible - returns true if a line can be traced from
// the caller's eyes to the target vector
/* <5e9bb> ../cstrike/dlls/combat.cpp:1576 */
BOOL CBaseEntity::__MAKE_VHOOK(FVisible)(const Vector &vecOrigin)
{
TraceResult tr;
@ -1445,7 +1384,6 @@ BOOL CBaseEntity::__MAKE_VHOOK(FVisible)(const Vector &vecOrigin)
}
}
/* <5e872> ../cstrike/dlls/combat.cpp:1600 */
void CBaseEntity::__MAKE_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
{
Vector vecOrigin = ptr->vecEndPos - vecDir * 4;
@ -1464,7 +1402,6 @@ void CBaseEntity::__MAKE_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDama
}
}
/* <61ce5> ../cstrike/dlls/combat.cpp:1647 */
void CBaseMonster::__MAKE_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
{
Vector vecOrigin = ptr->vecEndPos - vecDir * 4;
@ -1510,7 +1447,6 @@ void CBaseMonster::__MAKE_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDam
}
}
/* <61df9> ../cstrike/dlls/combat.cpp:1704 */
void CBaseEntity::FireBullets(ULONG cShots, Vector vecSrc, Vector vecDirShooting, Vector vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker)
{
static int tracerCount;
@ -1606,7 +1542,7 @@ void CBaseEntity::FireBullets(ULONG cShots, Vector vecSrc, Vector vecDirShooting
break;
case BULLET_PLAYER_BUCKSHOT:
flDamage = ((1 - tr.flFraction) * 20);
pEntity->TraceAttack(pevAttacker, (int)flDamage, vecDir, &tr, DMG_BULLET);
pEntity->TraceAttack(pevAttacker, int(flDamage), vecDir, &tr, DMG_BULLET);
break;
case BULLET_PLAYER_357:
pEntity->TraceAttack(pevAttacker, gSkillData.plrDmg357, vecDir, &tr, DMG_BULLET);
@ -1649,13 +1585,12 @@ void CBaseEntity::FireBullets(ULONG cShots, Vector vecSrc, Vector vecDirShooting
}
// make bullet trails
UTIL_BubbleTrail(vecSrc, tr.vecEndPos, (int)((flDistance * tr.flFraction) / 64));
UTIL_BubbleTrail(vecSrc, tr.vecEndPos, int((flDistance * tr.flFraction) / 64));
}
ApplyMultiDamage(pev, pevAttacker);
}
/* <62693> ../cstrike/dlls/combat.cpp:1856 */
NOXREF char *vstr(float *v)
{
static int idx = 0;
@ -1669,8 +1604,6 @@ NOXREF char *vstr(float *v)
// Go to the trouble of combining multiple pellets into a single damage call.
// This version is used by Players, uses the random seed generator to sync client and server side shots.
/* <62709> ../cstrike/dlls/combat.cpp:1869 */
Vector CBaseEntity::FireBullets3(Vector vecSrc, Vector vecDirShooting, float vecSpread, float flDistance, int iPenetration, int iBulletType, int iDamage, float flRangeModifier, entvars_t *pevAttacker, bool bPistol, int shared_rand)
{
int iOriginalPenetration = iPenetration;
@ -1826,7 +1759,7 @@ Vector CBaseEntity::FireBullets3(Vector vecSrc, Vector vecDirShooting, float vec
iPenetration--;
flCurrentDistance = tr.flFraction * flDistance;
iCurrentDamage *= pow(flRangeModifier, flCurrentDistance / 500);
iCurrentDamage *= Q_pow(flRangeModifier, flCurrentDistance / 500);
if (flCurrentDistance > flPenetrationDistance)
{
@ -1886,7 +1819,6 @@ Vector CBaseEntity::FireBullets3(Vector vecSrc, Vector vecDirShooting, float vec
return Vector(x * vecSpread, y * vecSpread, 0);
}
/* <5eb17> ../cstrike/dlls/combat.cpp:2075 */
void CBaseEntity::__MAKE_VHOOK(TraceBleed)(float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
{
if (BloodColor() == DONT_BLEED)
@ -1941,7 +1873,6 @@ void CBaseEntity::__MAKE_VHOOK(TraceBleed)(float flDamage, Vector vecDir, TraceR
}
}
/* <62e0e> ../cstrike/dlls/combat.cpp:2145 */
NOXREF void CBaseMonster::MakeDamageBloodDecal(int cCount, float flNoise, TraceResult *ptr, Vector &vecDir)
{
// make blood decal on the wall!
@ -1971,14 +1902,13 @@ NOXREF void CBaseMonster::MakeDamageBloodDecal(int cCount, float flNoise, TraceR
UTIL_TraceLine(ptr->vecEndPos, ptr->vecEndPos + vecTraceDir * 172, ignore_monsters, ENT(pev), &Bloodtr);
if (Bloodtr.flFraction != 1.0)
if (Bloodtr.flFraction != 1.0f)
{
UTIL_BloodDecalTrace(&Bloodtr, BloodColor());
}
}
}
/* <62f3e> ../cstrike/dlls/combat.cpp:2197 */
void CBaseMonster::BloodSplat(const Vector &vecSrc, const Vector &vecDir, int HitLocation, int iVelocity)
{
if (HitLocation != HITGROUP_HEAD)

View File

@ -18,15 +18,13 @@ DebugOutputLevel outputLevel[ NUM_LEVELS ] =
unsigned int theDebugOutputTypes;
static char theDebugBuffer[ DebugBufferSize ];
#endif // HOOK_GAMEDLL
#endif
/* <22fe8b> ../cstrike/dlls/debug.cpp:39 */
bool IsDeveloper()
{
return (CVAR_GET_FLOAT("developer") > 0.0);
}
/* <22ff69> ../cstrike/dlls/debug.cpp:45 */
NOXREF void UTIL_DPrintf(DebugOutputType outputType, char *pszMsg, ...)
{
if (!IsDeveloper())
@ -43,7 +41,6 @@ NOXREF void UTIL_DPrintf(DebugOutputType outputType, char *pszMsg, ...)
}
}
/* <22fe23> ../cstrike/dlls/debug.cpp:56 */
void UTIL_DPrintf(char *pszMsg, ...)
{
if (!IsDeveloper())
@ -57,7 +54,6 @@ void UTIL_DPrintf(char *pszMsg, ...)
SERVER_PRINT(theDebugBuffer);
}
/* <22fe97> ../cstrike/dlls/debug.cpp:78 */
void PrintDebugFlags()
{
char *tmp;
@ -75,7 +71,6 @@ void PrintDebugFlags()
SERVER_PRINT(theDebugBuffer);
}
/* <22fed4> ../cstrike/dlls/debug.cpp:94 */
void SetDebugFlag(const char *flagStr, bool state)
{
if (flagStr != NULL)
@ -103,7 +98,6 @@ void SetDebugFlag(const char *flagStr, bool state)
SERVER_PRINT(SharedVarArgs("mp_debug: unknown variable '%s'\n", flagStr));
}
/* <23001f> ../cstrike/dlls/debug.cpp:126 */
void PrintDebugFlag(const char *flagStr)
{
if (flagStr != NULL)
@ -125,7 +119,6 @@ void PrintDebugFlag(const char *flagStr)
SERVER_PRINT(SharedVarArgs("mp_debug: unknown variable '%s'\n", flagStr));
}
/* <2300a9> ../cstrike/dlls/debug.cpp:149 */
void UTIL_SetDprintfFlags(const char *flagStr)
{
if (!IsDeveloper())
@ -145,7 +138,6 @@ void UTIL_SetDprintfFlags(const char *flagStr)
PrintDebugFlags();
}
/* <23012d> ../cstrike/dlls/debug.cpp:175 */
NOXREF void UTIL_BotDPrintf(char *pszMsg, ...)
{
if (!IsDeveloper())
@ -162,7 +154,6 @@ NOXREF void UTIL_BotDPrintf(char *pszMsg, ...)
}
}
/* <230181> ../cstrike/dlls/debug.cpp:193 */
void UTIL_CareerDPrintf(char *pszMsg, ...)
{
if (!IsDeveloper())
@ -179,7 +170,6 @@ void UTIL_CareerDPrintf(char *pszMsg, ...)
}
}
/* <2301d5> ../cstrike/dlls/debug.cpp:211 */
NOXREF void UTIL_TutorDPrintf(char *pszMsg, ...)
{
if (!IsDeveloper())
@ -196,7 +186,6 @@ NOXREF void UTIL_TutorDPrintf(char *pszMsg, ...)
}
}
/* <230229> ../cstrike/dlls/debug.cpp:229 */
NOXREF void UTIL_StatsDPrintf(char *pszMsg, ...)
{
if (!IsDeveloper())
@ -213,7 +202,6 @@ NOXREF void UTIL_StatsDPrintf(char *pszMsg, ...)
}
}
/* <23027d> ../cstrike/dlls/debug.cpp:247 */
NOXREF void UTIL_HostageDPrintf(char *pszMsg, ...)
{
if (!IsDeveloper())

View File

@ -54,7 +54,7 @@ struct DebugOutputLevel
};
bool IsDeveloper();
NOXREF void UTIL_DPrintf(DebugOutputType outputType, char *pszMsg, ...);
void UTIL_DPrintf(DebugOutputType outputType, char *pszMsg, ...);
void UTIL_DPrintf(char *pszMsg, ...);
void PrintDebugFlags();
@ -62,10 +62,10 @@ void SetDebugFlag(const char *flagStr, bool state);
void PrintDebugFlag(const char *flagStr);
void UTIL_SetDprintfFlags(const char *flagStr);
NOXREF void UTIL_BotDPrintf(char *pszMsg, ...);
void UTIL_BotDPrintf(char *pszMsg, ...);
void UTIL_CareerDPrintf(char *pszMsg, ...);
NOXREF void UTIL_TutorDPrintf(char *pszMsg, ...);
NOXREF void UTIL_StatsDPrintf(char *pszMsg, ...);
NOXREF void UTIL_HostageDPrintf(char *pszMsg, ...);
void UTIL_TutorDPrintf(char *pszMsg, ...);
void UTIL_StatsDPrintf(char *pszMsg, ...);
void UTIL_HostageDPrintf(char *pszMsg, ...);
#endif // DEBUG_H

View File

@ -21,9 +21,8 @@ TYPEDESCRIPTION CMomentaryDoor::m_SaveData[] =
DEFINE_FIELD(CMomentaryDoor, m_bMoveSnd, FIELD_CHARACTER),
};
#endif // HOOK_GAMEDLL
#endif
/* <693c0> ../cstrike/dlls/doors.cpp:98 */
IMPLEMENT_SAVERESTORE(CBaseDoor, CBaseToggle);
// play door or button locked or unlocked sounds.
@ -31,8 +30,6 @@ IMPLEMENT_SAVERESTORE(CBaseDoor, CBaseToggle);
// if flocked is true, play 'door is locked' sound,
// otherwise play 'door is unlocked' sound
// NOTE: this routine is shared by doors and buttons
/* <68561> ../cstrike/dlls/doors.cpp:112 */
void PlayLockSounds(entvars_t *pev, locksound_t *pls, int flocked, int fbutton)
{
// LOCKED SOUND
@ -116,49 +113,47 @@ void PlayLockSounds(entvars_t *pev, locksound_t *pls, int flocked, int fbutton)
}
// Cache user-entity-field values until spawn is called.
/* <69a4f> ../cstrike/dlls/doors.cpp:201 */
void CBaseDoor::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
//skin is used for content type
if (FStrEq(pkvd->szKeyName, "skin"))
{
pev->skin = (int)Q_atof(pkvd->szValue);
pev->skin = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "movesnd"))
{
m_bMoveSnd = (int)Q_atof(pkvd->szValue);
m_bMoveSnd = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "stopsnd"))
{
m_bStopSnd = (int)Q_atof(pkvd->szValue);
m_bStopSnd = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "healthvalue"))
{
m_bHealthValue = (int)Q_atof(pkvd->szValue);
m_bHealthValue = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "locked_sound"))
{
m_bLockedSound = (int)Q_atof(pkvd->szValue);
m_bLockedSound = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "locked_sentence"))
{
m_bLockedSentence = (int)Q_atof(pkvd->szValue);
m_bLockedSentence = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "unlocked_sound"))
{
m_bUnlockedSound = (int)Q_atof(pkvd->szValue);
m_bUnlockedSound = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "unlocked_sentence"))
{
m_bUnlockedSentence = (int)Q_atof(pkvd->szValue);
m_bUnlockedSentence = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "WaveHeight"))
@ -192,22 +187,17 @@ void CBaseDoor::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
// 2) base
// 3) stone chain
// 4) screechy metal
/* <69f8b> ../cstrike/dlls/doors.cpp:278 */
LINK_ENTITY_TO_CLASS(func_door, CBaseDoor);
// func_water - same as a door.
/* <6a058> ../cstrike/dlls/doors.cpp:282 */
LINK_ENTITY_TO_CLASS(func_water, CBaseDoor);
/* <690bc> ../cstrike/dlls/doors.cpp:285 */
void CBaseDoor::__MAKE_VHOOK(Spawn)()
{
Precache();
SetMovedir(pev);
//normal door
// normal door
if (pev->skin == 0)
{
if (pev->spawnflags & SF_DOOR_PASSABLE)
@ -233,7 +223,7 @@ void CBaseDoor::__MAKE_VHOOK(Spawn)()
m_vecPosition1 = pev->origin;
// Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big
m_vecPosition2 = m_vecPosition1 + (pev->movedir * (fabs((float_precision)(pev->movedir.x * (pev->size.x - 2))) + fabs((float_precision)(pev->movedir.y * (pev->size.y - 2))) + fabs((float_precision)(pev->movedir.z * (pev->size.z - 2))) - m_flLip));
m_vecPosition2 = m_vecPosition1 + (pev->movedir * (Q_fabs(float_precision(pev->movedir.x * (pev->size.x - 2))) + Q_fabs(float_precision(pev->movedir.y * (pev->size.y - 2))) + Q_fabs(float_precision(pev->movedir.z * (pev->size.z - 2))) - m_flLip));
assert(("door start/end positions are equal", m_vecPosition1 != m_vecPosition2));
@ -261,7 +251,6 @@ void CBaseDoor::__MAKE_VHOOK(Spawn)()
m_lastBlockedTimestamp = 0;
}
/* <69949> ../cstrike/dlls/doors.cpp:334 */
void CBaseDoor::__MAKE_VHOOK(Restart)()
{
SetMovedir(pev);
@ -274,7 +263,6 @@ void CBaseDoor::__MAKE_VHOOK(Restart)()
SetTouch(&CBaseDoor::DoorTouch);
}
/* <69289> ../cstrike/dlls/doors.cpp:350 */
void CBaseDoor::__MAKE_VHOOK(SetToggleState)(int state)
{
if (state == TS_AT_TOP)
@ -286,7 +274,6 @@ void CBaseDoor::__MAKE_VHOOK(SetToggleState)(int state)
#define noiseMoving noise1
#define noiseArrived noise2
/* <6924c> ../cstrike/dlls/doors.cpp:359 */
void CBaseDoor::__MAKE_VHOOK(Precache)()
{
char *pszSound;
@ -388,14 +375,14 @@ void CBaseDoor::__MAKE_VHOOK(Precache)()
// get door button sounds, for doors which are directly 'touched' to open
if (m_bLockedSound)
{
pszSound = ButtonSound((int)m_bLockedSound);
pszSound = ButtonSound(int(m_bLockedSound));
PRECACHE_SOUND(pszSound);
m_ls.sLockedSound = ALLOC_STRING(pszSound);
}
if (m_bUnlockedSound)
{
pszSound = ButtonSound((int)m_bUnlockedSound);
pszSound = ButtonSound(int(m_bUnlockedSound));
PRECACHE_SOUND(pszSound);
m_ls.sUnlockedSound = ALLOC_STRING(pszSound);
}
@ -430,8 +417,6 @@ void CBaseDoor::__MAKE_VHOOK(Precache)()
}
// Doors not tied to anything (e.g. button, another door) can be touched, to make them activate.
/* <6a3b8> ../cstrike/dlls/doors.cpp:508 */
void CBaseDoor::DoorTouch(CBaseEntity *pOther)
{
entvars_t *pevToucher = pOther->pev;
@ -467,8 +452,6 @@ void CBaseDoor::DoorTouch(CBaseEntity *pOther)
}
// Used by SUB_UseTargets, when a door is the target of a button.
/* <6a33b> ../cstrike/dlls/doors.cpp:543 */
void CBaseDoor::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
m_hActivator = pActivator;
@ -481,8 +464,6 @@ void CBaseDoor::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller,
}
// Causes the door to "do its thing", i.e. start moving, and cascade activation.
/* <6a319> ../cstrike/dlls/doors.cpp:554 */
int CBaseDoor::DoorActivate()
{
if (!UTIL_IsMasterTriggered(m_sMaster, m_hActivator))
@ -512,8 +493,6 @@ int CBaseDoor::DoorActivate()
}
// Starts the door going to its "up" position (simply ToggleData->vecPosition2).
/* <6a125> ../cstrike/dlls/doors.cpp:588 */
void CBaseDoor::DoorGoUp()
{
entvars_t *pevActivator;
@ -571,14 +550,14 @@ void CBaseDoor::DoorGoUp()
{
if (toActivator.y < loY)
{
if (abs((int)momentArmY) > abs((int)momentArmX))
if (Q_abs(int(momentArmY)) > Q_abs(int(momentArmX)))
sign = (momentArmY < 0) ? 1 : -1;
else
sign = (momentArmX > 0) ? 1 : -1;
}
else if (toActivator.y > hiY)
{
if (abs((int)momentArmY) > abs((int)momentArmX))
if (Q_abs(int(momentArmY)) > Q_abs(int(momentArmX)))
sign = (momentArmY < 0) ? 1 : -1;
else
sign = (momentArmX < 0) ? 1 : -1;
@ -597,14 +576,14 @@ void CBaseDoor::DoorGoUp()
}
else if (toActivator.y < loY)
{
if (abs((int)momentArmY) > abs((int)momentArmX))
if (Q_abs(int(momentArmY)) > Q_abs(int(momentArmX)))
sign = (momentArmY > 0) ? 1 : -1;
else
sign = (momentArmX > 0) ? 1 : -1;
}
else if (toActivator.y > hiY)
{
if (abs((int)momentArmY) > abs((int)momentArmX))
if (Q_abs(int(momentArmY)) > Q_abs(int(momentArmX)))
sign = (momentArmY > 0) ? 1 : -1;
else
sign = (momentArmX < 0) ? 1 : -1;
@ -627,8 +606,6 @@ void CBaseDoor::DoorGoUp()
}
// The door has reached the "up" position. Either go back down, or wait for another activation.
/* <6940c> ../cstrike/dlls/doors.cpp:721 */
void CBaseDoor::DoorHitTop()
{
if (!(pev->spawnflags & SF_DOOR_SILENT))
@ -672,8 +649,6 @@ void CBaseDoor::DoorHitTop()
}
// Starts the door going to its "down" position (simply ToggleData->vecPosition1).
/* <697ad> ../cstrike/dlls/doors.cpp:762 */
void CBaseDoor::DoorGoDown()
{
bool isReversing = (m_toggle_state == TS_GOING_UP);
@ -696,7 +671,7 @@ void CBaseDoor::DoorGoDown()
#ifdef DOOR_ASSERT
assert(m_toggle_state == TS_AT_TOP);
#endif // DOOR_ASSERT
#endif
m_toggle_state = TS_GOING_DOWN;
@ -712,8 +687,6 @@ void CBaseDoor::DoorGoDown()
}
// The door has reached the "down" position. Back to quiescence.
/* <694a5> ../cstrike/dlls/doors.cpp:791 */
void CBaseDoor::DoorHitBottom()
{
if (!(pev->spawnflags & SF_DOOR_SILENT))
@ -747,7 +720,6 @@ void CBaseDoor::DoorHitBottom()
}
}
/* <6a465> ../cstrike/dlls/doors.cpp:817 */
void CBaseDoor::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther)
{
edict_t *pentTarget = NULL;
@ -868,12 +840,8 @@ void CBaseDoor::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther)
// 2) base
// 3) stone chain
// 4) screechy metal
/* <6a767> ../cstrike/dlls/doors.cpp:943 */
LINK_ENTITY_TO_CLASS(func_door_rotating, CRotDoor);
/* <698be> ../cstrike/dlls/doors.cpp:946 */
void CRotDoor::__MAKE_VHOOK(Restart)()
{
CBaseToggle::AxisDir(pev);
@ -901,7 +869,6 @@ void CRotDoor::__MAKE_VHOOK(Restart)()
DoorGoDown();
}
/* <69177> ../cstrike/dlls/doors.cpp:978 */
void CRotDoor::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -961,7 +928,6 @@ void CRotDoor::__MAKE_VHOOK(Spawn)()
}
}
/* <68fcc> ../cstrike/dlls/doors.cpp:1028 */
void CRotDoor::__MAKE_VHOOK(SetToggleState)(int state)
{
if (state == TS_AT_TOP)
@ -972,13 +938,9 @@ void CRotDoor::__MAKE_VHOOK(SetToggleState)(int state)
UTIL_SetOrigin(pev, pev->origin);
}
/* <6a834> ../cstrike/dlls/doors.cpp:1056 */
LINK_ENTITY_TO_CLASS(momentary_door, CMomentaryDoor);
/* <69373> ../cstrike/dlls/doors.cpp:1063 */
IMPLEMENT_SAVERESTORE(CMomentaryDoor, CBaseToggle);
/* <69001> ../cstrike/dlls/doors.cpp:1065 */
void CMomentaryDoor::__MAKE_VHOOK(Spawn)()
{
SetMovedir(pev);
@ -998,7 +960,7 @@ void CMomentaryDoor::__MAKE_VHOOK(Spawn)()
m_vecPosition1 = pev->origin;
// Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big
m_vecPosition2 = m_vecPosition1 + (pev->movedir * (fabs((float_precision)(pev->movedir.x * (pev->size.x - 2))) + fabs((float_precision)(pev->movedir.y * (pev->size.y - 2))) + fabs((float_precision)(pev->movedir.z * (pev->size.z - 2))) - m_flLip));
m_vecPosition2 = m_vecPosition1 + (pev->movedir * (Q_fabs(float_precision(pev->movedir.x * (pev->size.x - 2))) + Q_fabs(float_precision(pev->movedir.y * (pev->size.y - 2))) + Q_fabs(float_precision(pev->movedir.z * (pev->size.z - 2))) - m_flLip));
assert(("door start/end positions are equal", m_vecPosition1 != m_vecPosition2));
if (pev->spawnflags & SF_DOOR_START_OPEN)
@ -1014,7 +976,6 @@ void CMomentaryDoor::__MAKE_VHOOK(Spawn)()
Precache();
}
/* <68fa5> ../cstrike/dlls/doors.cpp:1096 */
void CMomentaryDoor::__MAKE_VHOOK(Precache)()
{
// set the door's "in-motion" sound
@ -1061,29 +1022,27 @@ void CMomentaryDoor::__MAKE_VHOOK(Precache)()
}
}
/* <69970> ../cstrike/dlls/doors.cpp:1143 */
void CMomentaryDoor::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "movesnd"))
{
m_bMoveSnd = (int)Q_atof(pkvd->szValue);
m_bMoveSnd = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "stopsnd"))
{
//m_bStopSnd =(int) Q_atof(pkvd->szValue);
//m_bStopSnd = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "healthvalue"))
{
//m_bHealthValue = (int)Q_atof(pkvd->szValue);
//m_bHealthValue = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else
CBaseToggle::KeyValue(pkvd);
}
/* <6953e> ../cstrike/dlls/doors.cpp:1165 */
void CMomentaryDoor::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
// Momentary buttons will pass down a float in here

View File

@ -48,7 +48,6 @@
#define SF_DOOR_NOMONSTERS 512 // Monster can't open
#define SF_DOOR_SILENT 0x80000000
/* <6840f> ../cstrike/dlls/doors.cpp:34 */
class CBaseDoor: public CBaseToggle
{
public:
@ -81,7 +80,7 @@ public:
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
void Blocked_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL
#endif
public:
static TYPEDESCRIPTION IMPL(m_SaveData)[7];
@ -110,7 +109,6 @@ public:
float m_lastBlockedTimestamp;
};
/* <684c0> ../cstrike/dlls/doors.cpp:935 */
class CRotDoor: public CBaseDoor
{
public:
@ -124,11 +122,10 @@ public:
void Restart_();
void SetToggleState_(int state);
#endif // HOOK_GAMEDLL
#endif
};
/* <68513> ../cstrike/dlls/doors.cpp:1039 */
class CMomentaryDoor: public CBaseToggle
{
public:
@ -149,7 +146,7 @@ public:
int Restore_(CRestore &restore);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
public:
static TYPEDESCRIPTION IMPL(m_SaveData)[1];

View File

@ -61,16 +61,10 @@ TYPEDESCRIPTION CGibShooter::m_SaveData[] =
#endif // HOOK_GAMEDLL
/* <76042> ../cstrike/dlls/effects.cpp:33 */
LINK_ENTITY_TO_CLASS(info_target, CPointEntity);
/* <7610e> ../cstrike/dlls/effects.cpp:57 */
LINK_ENTITY_TO_CLASS(env_bubbles, CBubbling);
/* <741e0> ../cstrike/dlls/effects.cpp:68 */
IMPLEMENT_SAVERESTORE(CBubbling, CBaseEntity);
/* <7344d> ../cstrike/dlls/effects.cpp:73 */
void CBubbling::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -101,14 +95,12 @@ void CBubbling::__MAKE_VHOOK(Spawn)()
m_state = 0;
}
/* <73489> ../cstrike/dlls/effects.cpp:99 */
void CBubbling::__MAKE_VHOOK(Precache)()
{
// Precache bubble sprite
m_bubbleModel = PRECACHE_MODEL("sprites/bubble.spr");
}
/* <742a4> ../cstrike/dlls/effects.cpp:105 */
void CBubbling::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
if (ShouldToggle(useType, m_state))
@ -126,7 +118,6 @@ void CBubbling::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller,
}
}
/* <74aae> ../cstrike/dlls/effects.cpp:123 */
void CBubbling::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "density"))
@ -148,7 +139,6 @@ void CBubbling::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CBaseEntity::KeyValue(pkvd);
}
/* <73d03> ../cstrike/dlls/effects.cpp:145 */
void CBubbling::FizzThink()
{
MESSAGE_BEGIN(MSG_PAS, SVC_TEMPENTITY, VecBModelOrigin(pev));
@ -164,10 +154,8 @@ void CBubbling::FizzThink()
pev->nextthink = gpGlobals->time + 2.5f - (0.1f * m_frequency);
}
/* <7620c> ../cstrike/dlls/effects.cpp:166 */
LINK_ENTITY_TO_CLASS(beam, CBeam);
/* <734b0> ../cstrike/dlls/effects.cpp:168 */
void CBeam::__MAKE_VHOOK(Spawn)()
{
// Remove model & collisions
@ -175,7 +163,6 @@ void CBeam::__MAKE_VHOOK(Spawn)()
Precache();
}
/* <734d6> ../cstrike/dlls/effects.cpp:174 */
void CBeam::__MAKE_VHOOK(Precache)()
{
if (pev->owner)
@ -188,21 +175,18 @@ void CBeam::__MAKE_VHOOK(Precache)()
}
}
/* <762d8> ../cstrike/dlls/effects.cpp:182 */
void CBeam::SetStartEntity(int entityIndex)
{
pev->sequence = (entityIndex & 0x0FFF) | ((pev->sequence & 0xF000) << 12);
pev->owner = INDEXENT(entityIndex);
}
/* <76303> ../cstrike/dlls/effects.cpp:188 */
void CBeam::SetEndEntity(int entityIndex)
{
pev->skin = (entityIndex & 0x0FFF) | ((pev->skin & 0xF000) << 12);
pev->aiment = INDEXENT(entityIndex);
}
/* <7632e> ../cstrike/dlls/effects.cpp:196 */
const Vector &CBeam::GetStartPos()
{
if (GetType() == BEAM_ENTS)
@ -214,7 +198,6 @@ const Vector &CBeam::GetStartPos()
return pev->origin;
}
/* <7639a> ../cstrike/dlls/effects.cpp:207 */
const Vector &CBeam::GetEndPos()
{
int type = GetType();
@ -232,24 +215,17 @@ const Vector &CBeam::GetEndPos()
return pev->angles;
}
/* <76540> ../cstrike/dlls/effects.cpp:222 */
CBeam *CBeam::BeamCreate(const char *pSpriteName, int width)
{
// Create a new entity with CBeam private data
CBeam *pBeam = GetClassPtr((CBeam *)NULL);
if (pBeam->pev->classname)
RemoveEntityHashValue(pBeam->pev, STRING(pBeam->pev->classname), CLASSNAME);
MAKE_STRING_CLASS("beam", pBeam->pev);
AddEntityHashValue(pBeam->pev, STRING(pBeam->pev->classname), CLASSNAME);
pBeam->BeamInit(pSpriteName, width);
return pBeam;
}
/* <76422> ../cstrike/dlls/effects.cpp:234 */
void CBeam::BeamInit(const char *pSpriteName, int width)
{
pev->flags |= FL_CUSTOMENTITY;
@ -268,7 +244,6 @@ void CBeam::BeamInit(const char *pSpriteName, int width)
pev->rendermode = 0;
}
/* <76a56> ../cstrike/dlls/effects.cpp:251 */
void CBeam::PointsInit(const Vector &start, const Vector &end)
{
SetType(BEAM_POINTS);
@ -279,7 +254,6 @@ void CBeam::PointsInit(const Vector &start, const Vector &end)
RelinkBeam();
}
/* <7695b> ../cstrike/dlls/effects.cpp:262 */
void CBeam::HoseInit(const Vector &start, const Vector &direction)
{
SetType(BEAM_HOSE);
@ -290,7 +264,6 @@ void CBeam::HoseInit(const Vector &start, const Vector &direction)
RelinkBeam();
}
/* <76887> ../cstrike/dlls/effects.cpp:273 */
void CBeam::PointEntInit(const Vector &start, int endIndex)
{
SetType(BEAM_ENTPOINT);
@ -301,7 +274,6 @@ void CBeam::PointEntInit(const Vector &start, int endIndex)
RelinkBeam();
}
/* <767ab> ../cstrike/dlls/effects.cpp:283 */
void CBeam::EntsInit(int startIndex, int endIndex)
{
SetType(BEAM_ENTS);
@ -312,7 +284,6 @@ void CBeam::EntsInit(int startIndex, int endIndex)
RelinkBeam();
}
/* <7663a> ../cstrike/dlls/effects.cpp:294 */
void CBeam::RelinkBeam()
{
const Vector &startPos = GetStartPos();
@ -333,7 +304,6 @@ void CBeam::RelinkBeam()
UTIL_SetOrigin(pev, pev->origin);
}
/* <77305> ../cstrike/dlls/effects.cpp:311 */
void CBeam::TriggerTouch(CBaseEntity *pOther)
{
if (pOther->pev->flags & (FL_CLIENT | FL_MONSTER))
@ -347,7 +317,6 @@ void CBeam::TriggerTouch(CBaseEntity *pOther)
}
}
/* <773e2> ../cstrike/dlls/effects.cpp:325 */
CBaseEntity *CBeam::RandomTargetname(const char *szName)
{
int total = 0;
@ -366,7 +335,6 @@ CBaseEntity *CBeam::RandomTargetname(const char *szName)
return pEntity;
}
/* <77431> ../cstrike/dlls/effects.cpp:341 */
void CBeam::DoSparks(const Vector &start, const Vector &end)
{
if (pev->spawnflags & (SF_BEAM_SPARKSTART | SF_BEAM_SPARKEND))
@ -382,16 +350,10 @@ void CBeam::DoSparks(const Vector &start, const Vector &end)
}
}
/* <774c2> ../cstrike/dlls/effects.cpp:402 */
LINK_ENTITY_TO_CLASS(env_lightning, CLightning);
/* <77592> ../cstrike/dlls/effects.cpp:403 */
LINK_ENTITY_TO_CLASS(env_beam, CLightning);
/* <74192> ../cstrike/dlls/effects.cpp:441 */
IMPLEMENT_SAVERESTORE(CLightning, CBeam);
/* <744b2> ../cstrike/dlls/effects.cpp:444 */
void CLightning::__MAKE_VHOOK(Spawn)()
{
if (FStringNull(m_iszSpriteName))
@ -443,21 +405,18 @@ void CLightning::__MAKE_VHOOK(Spawn)()
}
}
/* <7357f> ../cstrike/dlls/effects.cpp:493 */
void CLightning::__MAKE_VHOOK(Precache)()
{
m_spriteTexture = PRECACHE_MODEL((char *)STRING(m_iszSpriteName));
CBeam::Precache();
}
/* <786a1> ../cstrike/dlls/effects.cpp:500 */
void CLightning::__MAKE_VHOOK(Activate)()
{
if (ServerSide())
BeamUpdateVars();
}
/* <7536c> ../cstrike/dlls/effects.cpp:507 */
void CLightning::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "LightningStart"))
@ -519,7 +478,6 @@ void CLightning::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CBeam::KeyValue(pkvd);
}
/* <75ad3> ../cstrike/dlls/effects.cpp:569 */
void CLightning::ToggleUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
if (!ShouldToggle(useType, m_active))
@ -545,7 +503,6 @@ void CLightning::ToggleUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
}
}
/* <7422d> ../cstrike/dlls/effects.cpp:593 */
void CLightning::StrikeUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
if (!ShouldToggle(useType, m_active))
@ -566,7 +523,6 @@ void CLightning::StrikeUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
SetUse(NULL);
}
/* <71e66> ../cstrike/dlls/effects.cpp:614 */
int IsPointEntity(CBaseEntity *pEnt)
{
if (!pEnt->pev->modelindex)
@ -580,7 +536,6 @@ int IsPointEntity(CBaseEntity *pEnt)
return 0;
}
/* <77f64> ../cstrike/dlls/effects.cpp:625 */
void CLightning::StrikeThink()
{
if (m_life != 0.0f)
@ -671,13 +626,13 @@ void CLightning::StrikeThink()
WRITE_SHORT(m_spriteTexture);
WRITE_BYTE(m_frameStart); // framestart
WRITE_BYTE((int)pev->framerate); // framerate
WRITE_BYTE((int)(m_life*10.0)); // life
WRITE_BYTE(int(pev->framerate)); // framerate
WRITE_BYTE(int(m_life * 10.0)); // life
WRITE_BYTE(m_boltWidth); // width
WRITE_BYTE(m_noiseAmplitude); // noise
WRITE_BYTE((int)pev->rendercolor.x); // r, g, b
WRITE_BYTE((int)pev->rendercolor.y); // r, g, b
WRITE_BYTE((int)pev->rendercolor.z); // r, g, b
WRITE_BYTE(int(pev->rendercolor.x)); // r, g, b
WRITE_BYTE(int(pev->rendercolor.y)); // r, g, b
WRITE_BYTE(int(pev->rendercolor.z)); // r, g, b
WRITE_BYTE(pev->renderamt); // brightness
WRITE_BYTE(m_speed); // speed
MESSAGE_END();
@ -693,7 +648,6 @@ void CLightning::StrikeThink()
}
}
/* <77680> ../cstrike/dlls/effects.cpp:731 */
void CBeam::BeamDamage(TraceResult *ptr)
{
RelinkBeam();
@ -721,7 +675,6 @@ void CBeam::BeamDamage(TraceResult *ptr)
pev->dmgtime = gpGlobals->time;
}
/* <777dd> ../cstrike/dlls/effects.cpp:753 */
void CLightning::DamageThink()
{
pev->nextthink = gpGlobals->time + 0.1f;
@ -731,7 +684,6 @@ void CLightning::DamageThink()
BeamDamage(&tr);
}
/* <77a90> ../cstrike/dlls/effects.cpp:763 */
void CLightning::Zap(const Vector &vecSrc, const Vector &vecDest)
{
MESSAGE_BEGIN(MSG_BROADCAST, SVC_TEMPENTITY);
@ -744,21 +696,20 @@ void CLightning::Zap(const Vector &vecSrc, const Vector &vecDest)
WRITE_COORD(vecDest.z);
WRITE_SHORT(m_spriteTexture);
WRITE_BYTE(m_frameStart); // framestart
WRITE_BYTE((int)pev->framerate); // framerate
WRITE_BYTE((int)(m_life * 10.0)); // life
WRITE_BYTE(int(pev->framerate)); // framerate
WRITE_BYTE(int(m_life * 10.0)); // life
WRITE_BYTE(m_boltWidth); // width
WRITE_BYTE(m_noiseAmplitude); // noise
WRITE_BYTE((int)pev->rendercolor.x); // r, g, b
WRITE_BYTE((int)pev->rendercolor.y); // r, g, b
WRITE_BYTE((int)pev->rendercolor.z); // r, g, b
WRITE_BYTE((int)pev->renderamt); // brightness
WRITE_BYTE(int(pev->rendercolor.x)); // r, g, b
WRITE_BYTE(int(pev->rendercolor.y)); // r, g, b
WRITE_BYTE(int(pev->rendercolor.z)); // r, g, b
WRITE_BYTE(int(pev->renderamt)); // brightness
WRITE_BYTE(m_speed); // speed
MESSAGE_END();
DoSparks(vecSrc, vecDest);
}
/* <77b45> ../cstrike/dlls/effects.cpp:789 */
void CLightning::RandomArea()
{
for (int iLoops = 0; iLoops < 10; iLoops++)
@ -801,7 +752,6 @@ void CLightning::RandomArea()
}
}
/* <77de8> ../cstrike/dlls/effects.cpp:831 */
void CLightning::RandomPoint(Vector &vecSrc)
{
for (int iLoops = 0; iLoops < 10; iLoops++)
@ -823,7 +773,6 @@ void CLightning::RandomPoint(Vector &vecSrc)
}
}
/* <78313> ../cstrike/dlls/effects.cpp:855 */
void CLightning::BeamUpdateVars()
{
int beamType;
@ -897,13 +846,9 @@ void CLightning::BeamUpdateVars()
}
}
/* <786d8> ../cstrike/dlls/effects.cpp:920 */
LINK_ENTITY_TO_CLASS(env_laser, CLaser);
/* <74144> ../cstrike/dlls/effects.cpp:929 */
IMPLEMENT_SAVERESTORE(CLaser, CBeam);
/* <76b3f> ../cstrike/dlls/effects.cpp:931 */
void CLaser::__MAKE_VHOOK(Spawn)()
{
if (FStringNull(pev->model))
@ -935,7 +880,6 @@ void CLaser::__MAKE_VHOOK(Spawn)()
TurnOn();
}
/* <73d82> ../cstrike/dlls/effects.cpp:960 */
void CLaser::__MAKE_VHOOK(Precache)()
{
pev->modelindex = PRECACHE_MODEL((char *)STRING(pev->model));
@ -946,7 +890,6 @@ void CLaser::__MAKE_VHOOK(Precache)()
}
}
/* <74ff2> ../cstrike/dlls/effects.cpp:968 */
void CLaser::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "LaserTarget"))
@ -993,7 +936,6 @@ void CLaser::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CBeam::KeyValue(pkvd);
}
/* <787a8> ../cstrike/dlls/effects.cpp:1015 */
int CLaser::IsOn()
{
if (pev->effects & EF_NODRAW)
@ -1002,7 +944,6 @@ int CLaser::IsOn()
return 1;
}
/* <787c9> ../cstrike/dlls/effects.cpp:1023 */
void CLaser::TurnOff()
{
pev->effects |= EF_NODRAW;
@ -1014,7 +955,6 @@ void CLaser::TurnOff()
}
}
/* <78804> ../cstrike/dlls/effects.cpp:1032 */
void CLaser::TurnOn()
{
pev->effects &= ~EF_NODRAW;
@ -1028,7 +968,6 @@ void CLaser::TurnOn()
pev->nextthink = gpGlobals->time;
}
/* <75f0a> ../cstrike/dlls/effects.cpp:1042 */
void CLaser::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
int active = IsOn();
@ -1042,7 +981,6 @@ void CLaser::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, US
TurnOn();
}
/* <78841> ../cstrike/dlls/effects.cpp:1059 */
void CLaser::FireAtPoint(TraceResult &tr)
{
SetEndPos(tr.vecEndPos);
@ -1054,7 +992,6 @@ void CLaser::FireAtPoint(TraceResult &tr)
DoSparks(GetStartPos(), tr.vecEndPos);
}
/* <778f6> ../cstrike/dlls/effects.cpp:1069 */
void CLaser::StrikeThink()
{
CBaseEntity *pEnd = RandomTargetname(STRING(pev->message));
@ -1068,13 +1005,9 @@ void CLaser::StrikeThink()
pev->nextthink = gpGlobals->time + 0.1f;
}
/* <7894f> ../cstrike/dlls/effects.cpp:1099 */
LINK_ENTITY_TO_CLASS(env_glow, CGlow);
/* <740f6> ../cstrike/dlls/effects.cpp:1107 */
IMPLEMENT_SAVERESTORE(CGlow, CPointEntity);
/* <735a6> ../cstrike/dlls/effects.cpp:1109 */
void CGlow::__MAKE_VHOOK(Spawn)()
{
pev->solid = SOLID_NOT;
@ -1085,7 +1018,7 @@ void CGlow::__MAKE_VHOOK(Spawn)()
PRECACHE_MODEL((char *)STRING(pev->model));
SET_MODEL(ENT(pev), STRING(pev->model));
m_maxFrame = (float)MODEL_FRAMES(pev->modelindex) - 1;
m_maxFrame = float(MODEL_FRAMES(pev->modelindex) - 1);
if (m_maxFrame > 1.0f && pev->framerate != 0.0f)
{
@ -1095,7 +1028,6 @@ void CGlow::__MAKE_VHOOK(Spawn)()
m_lastTime = gpGlobals->time;
}
/* <74606> ../cstrike/dlls/effects.cpp:1127 */
void CGlow::__MAKE_VHOOK(Think)()
{
Animate(pev->framerate * (gpGlobals->time - m_lastTime));
@ -1104,22 +1036,21 @@ void CGlow::__MAKE_VHOOK(Think)()
m_lastTime = gpGlobals->time;
}
/* <78a1f> ../cstrike/dlls/effects.cpp:1136 */
void CGlow::Animate(float frames)
{
if (m_maxFrame > 0)
pev->frame = fmod((float_precision)(pev->frame + frames), (float_precision)m_maxFrame);
{
pev->frame = Q_fmod(float_precision(pev->frame + frames), float_precision(m_maxFrame));
}
}
/* <78a4a> ../cstrike/dlls/effects.cpp:1157 */
LINK_ENTITY_TO_CLASS(env_bombglow, CBombGlow);
/* <735cd> ../cstrike/dlls/effects.cpp:1161 */
void CBombGlow::__MAKE_VHOOK(Spawn)()
{
#ifdef REGAMEDLL_FIXES
PRECACHE_MODEL("sprites/flare1.spr");
#endif // REGAMEDLL_FIXES
#endif
pev->solid = SOLID_NOT;
pev->movetype = MOVETYPE_NONE;
@ -1138,7 +1069,6 @@ void CBombGlow::__MAKE_VHOOK(Spawn)()
m_bSetModel = false;
}
/* <73a40> ../cstrike/dlls/effects.cpp:1184 */
void CBombGlow::__MAKE_VHOOK(Think)()
{
if (!m_bSetModel)
@ -1166,13 +1096,9 @@ void CBombGlow::__MAKE_VHOOK(Think)()
pev->nextthink = gpGlobals->time + 0.05f;
}
/* <78b1a> ../cstrike/dlls/effects.cpp:1226 */
LINK_ENTITY_TO_CLASS(env_sprite, CSprite);
/* <740a8> ../cstrike/dlls/effects.cpp:1234 */
IMPLEMENT_SAVERESTORE(CSprite, CPointEntity);
/* <75dc8> ../cstrike/dlls/effects.cpp:1236 */
void CSprite::__MAKE_VHOOK(Spawn)()
{
pev->solid = SOLID_NOT;
@ -1182,7 +1108,7 @@ void CSprite::__MAKE_VHOOK(Spawn)()
Precache();
SET_MODEL(ENT(pev), STRING(pev->model));
m_maxFrame = (float)MODEL_FRAMES(pev->modelindex) - 1;
m_maxFrame = float(MODEL_FRAMES(pev->modelindex) - 1);
if (pev->targetname && !(pev->spawnflags & SF_SPRITE_STARTON))
TurnOff();
@ -1197,7 +1123,6 @@ void CSprite::__MAKE_VHOOK(Spawn)()
}
}
/* <75d55> ../cstrike/dlls/effects.cpp:1260 */
void CSprite::__MAKE_VHOOK(Restart)()
{
pev->solid = SOLID_NOT;
@ -1211,7 +1136,6 @@ void CSprite::__MAKE_VHOOK(Restart)()
TurnOn();
}
/* <74436> ../cstrike/dlls/effects.cpp:1273 */
void CSprite::__MAKE_VHOOK(Precache)()
{
PRECACHE_MODEL((char *)STRING(pev->model));
@ -1227,7 +1151,6 @@ void CSprite::__MAKE_VHOOK(Precache)()
}
}
/* <78bea> ../cstrike/dlls/effects.cpp:1289 */
void CSprite::SpriteInit(const char *pSpriteName, const Vector &origin)
{
pev->model = MAKE_STRING(pSpriteName);
@ -1235,17 +1158,12 @@ void CSprite::SpriteInit(const char *pSpriteName, const Vector &origin)
Spawn();
}
/* <78c1d> ../cstrike/dlls/effects.cpp:1296 */
CSprite *CSprite::SpriteCreate(const char *pSpriteName, const Vector &origin, BOOL animate)
{
CSprite *pSprite = GetClassPtr((CSprite *)NULL);
pSprite->SpriteInit(pSpriteName, origin);
if (pSprite->pev->classname)
RemoveEntityHashValue(pSprite->pev, STRING(pSprite->pev->classname), CLASSNAME);
MAKE_STRING_CLASS("env_sprite", pSprite->pev);
AddEntityHashValue(pSprite->pev, STRING(pSprite->pev->classname), CLASSNAME);
pSprite->pev->solid = SOLID_NOT;
pSprite->pev->movetype = MOVETYPE_NOCLIP;
@ -1258,7 +1176,6 @@ CSprite *CSprite::SpriteCreate(const char *pSpriteName, const Vector &origin, BO
return pSprite;
}
/* <75679> ../cstrike/dlls/effects.cpp:1310 */
void CSprite::AnimateThink()
{
Animate(pev->framerate * (gpGlobals->time - m_lastTime));
@ -1266,7 +1183,6 @@ void CSprite::AnimateThink()
m_lastTime = gpGlobals->time;
}
/* <78d6b> ../cstrike/dlls/effects.cpp:1318 */
void CSprite::AnimateUntilDead()
{
if (gpGlobals->time > pev->dmgtime)
@ -1280,7 +1196,6 @@ void CSprite::AnimateUntilDead()
}
}
/* <78de9> ../cstrike/dlls/effects.cpp:1329 */
NOXREF void CSprite::Expand(float scaleSpeed, float fadeSpeed)
{
pev->speed = scaleSpeed;
@ -1291,7 +1206,6 @@ NOXREF void CSprite::Expand(float scaleSpeed, float fadeSpeed)
m_lastTime = gpGlobals->time;
}
/* <73e2e> ../cstrike/dlls/effects.cpp:1340 */
void CSprite::ExpandThink()
{
float frametime = gpGlobals->time - m_lastTime;
@ -1311,7 +1225,6 @@ void CSprite::ExpandThink()
}
}
/* <78e2e> ../cstrike/dlls/effects.cpp:1358 */
void CSprite::Animate(float frames)
{
pev->frame += frames;
@ -1322,18 +1235,16 @@ void CSprite::Animate(float frames)
TurnOff();
else if (m_maxFrame > 0)
pev->frame = fmod((float_precision)pev->frame, (float_precision)m_maxFrame);
pev->frame = Q_fmod(float_precision(pev->frame), float_precision(m_maxFrame));
}
}
/* <78e73> ../cstrike/dlls/effects.cpp:1376 */
void CSprite::TurnOff()
{
pev->effects = EF_NODRAW;
pev->nextthink = 0;
}
/* <78e94> ../cstrike/dlls/effects.cpp:1383 */
void CSprite::TurnOn()
{
pev->effects = 0;
@ -1348,7 +1259,6 @@ void CSprite::TurnOn()
pev->frame = 0;
}
/* <75e27> ../cstrike/dlls/effects.cpp:1396 */
void CSprite::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
int on = pev->effects != EF_NODRAW;
@ -1362,13 +1272,9 @@ void CSprite::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, U
}
}
/* <7405a> ../cstrike/dlls/effects.cpp:1448 */
IMPLEMENT_SAVERESTORE(CGibShooter, CBaseDelay);
/* <78eb7> ../cstrike/dlls/effects.cpp:1449 */
LINK_ENTITY_TO_CLASS(gibshooter, CGibShooter);
/* <73dbb> ../cstrike/dlls/effects.cpp:1452 */
void CGibShooter::__MAKE_VHOOK(Precache)()
{
if (g_Language == LANGUAGE_GERMAN)
@ -1381,7 +1287,6 @@ void CGibShooter::__MAKE_VHOOK(Precache)()
}
}
/* <74886> ../cstrike/dlls/effects.cpp:1465 */
void CGibShooter::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "m_iGibs"))
@ -1408,14 +1313,12 @@ void CGibShooter::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CBaseDelay::KeyValue(pkvd);
}
/* <735f4> ../cstrike/dlls/effects.cpp:1493 */
void CGibShooter::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
SetThink(&CGibShooter::ShootThink);
pev->nextthink = gpGlobals->time;
}
/* <73cb5> ../cstrike/dlls/effects.cpp:1499 */
void CGibShooter::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -1437,7 +1340,6 @@ void CGibShooter::__MAKE_VHOOK(Spawn)()
pev->body = MODEL_FRAMES(m_iGibModelIndex);
}
/* <744ff> ../cstrike/dlls/effects.cpp:1521 */
CGib *CGibShooter::__MAKE_VHOOK(CreateGib)()
{
if (CVAR_GET_FLOAT("violence_hgibs") == 0)
@ -1459,7 +1361,6 @@ CGib *CGibShooter::__MAKE_VHOOK(CreateGib)()
return pGib;
}
/* <75751> ../cstrike/dlls/effects.cpp:1541 */
void CGibShooter::ShootThink()
{
pev->nextthink = m_flDelay + gpGlobals->time;
@ -1524,10 +1425,8 @@ void CGibShooter::ShootThink()
}
}
/* <78f87> ../cstrike/dlls/effects.cpp:1600 */
LINK_ENTITY_TO_CLASS(env_shooter, CEnvShooter);
/* <749e7> ../cstrike/dlls/effects.cpp:1602 */
void CEnvShooter::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "shootmodel"))
@ -1567,14 +1466,12 @@ void CEnvShooter::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CGibShooter::KeyValue(pkvd);
}
/* <73cdc> ../cstrike/dlls/effects.cpp:1644 */
void CEnvShooter::__MAKE_VHOOK(Precache)()
{
m_iGibModelIndex = PRECACHE_MODEL((char *)STRING(pev->model));
CBreakable::MaterialSoundPrecache((Materials)m_iGibMaterial);
}
/* <7464b> ../cstrike/dlls/effects.cpp:1651 */
CGib *CEnvShooter::__MAKE_VHOOK(CreateGib)()
{
CGib *pGib = GetClassPtr((CGib *)NULL);
@ -1600,22 +1497,18 @@ CGib *CEnvShooter::__MAKE_VHOOK(CreateGib)()
return pGib;
}
/* <79057> ../cstrike/dlls/effects.cpp:1696 */
LINK_ENTITY_TO_CLASS(test_effect, CTestEffect);
/* <73656> ../cstrike/dlls/effects.cpp:1698 */
void CTestEffect::__MAKE_VHOOK(Spawn)()
{
Precache();
}
/* <7367c> ../cstrike/dlls/effects.cpp:1703 */
void CTestEffect::__MAKE_VHOOK(Precache)()
{
PRECACHE_MODEL("sprites/lgtning.spr");
}
/* <76e39> ../cstrike/dlls/effects.cpp:1708 */
void CTestEffect::TestThink()
{
int i;
@ -1627,7 +1520,13 @@ void CTestEffect::TestThink()
TraceResult tr;
Vector vecSrc = pev->origin;
Vector vecDir = Vector(RANDOM_FLOAT(-1, 1), RANDOM_FLOAT(-1, 1),RANDOM_FLOAT(-1, 1));
Vector vecDir;
// TODO: fix test demo
vecDir.z = RANDOM_FLOAT(-1, 1);
vecDir.y = RANDOM_FLOAT(-1, 1);
vecDir.x = RANDOM_FLOAT(-1, 1);
vecDir = vecDir.Normalize();
UTIL_TraceLine(vecSrc, vecSrc + vecDir * 128, ignore_monsters, ENT(pev), &tr);
@ -1638,18 +1537,17 @@ void CTestEffect::TestThink()
pbeam->SetScrollRate(12);
m_flBeamTime[m_iBeam] = gpGlobals->time;
m_pBeam[m_iBeam] = pbeam;
m_iBeam++;
m_pBeam[m_iBeam++] = pbeam;
}
if (t < 3.0)
{
for (i = 0; i < m_iBeam; ++i)
{
t = (gpGlobals->time - m_flBeamTime[i]) / (3 + m_flStartTime - m_flBeamTime[i]);
m_pBeam[i]->SetBrightness(255 * t);
t = (gpGlobals->time - m_flBeamTime[i]) / (3.0f + m_flStartTime - m_flBeamTime[i]);
m_pBeam[i]->SetBrightness(int(255.0f * t));
}
pev->nextthink = gpGlobals->time + 0.1f;
}
else
@ -1665,7 +1563,6 @@ void CTestEffect::TestThink()
}
}
/* <736a2> ../cstrike/dlls/effects.cpp:1759 */
void CTestEffect::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
SetThink(&CTestEffect::TestThink);
@ -1674,10 +1571,8 @@ void CTestEffect::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCalle
m_flStartTime = gpGlobals->time;
}
/* <79127> ../cstrike/dlls/effects.cpp:1788 */
LINK_ENTITY_TO_CLASS(env_blood, CBlood);
/* <73c8f> ../cstrike/dlls/effects.cpp:1797 */
void CBlood::__MAKE_VHOOK(Spawn)()
{
pev->solid = SOLID_NOT;
@ -1688,7 +1583,6 @@ void CBlood::__MAKE_VHOOK(Spawn)()
SetMovedir(pev);
}
/* <74c34> ../cstrike/dlls/effects.cpp:1807 */
void CBlood::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "color"))
@ -1715,7 +1609,6 @@ void CBlood::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CPointEntity::KeyValue(pkvd);
}
/* <791f7> ../cstrike/dlls/effects.cpp:1834 */
Vector CBlood::Direction()
{
if (pev->spawnflags & SF_BLOOD_RANDOM)
@ -1724,7 +1617,6 @@ Vector CBlood::Direction()
return pev->movedir;
}
/* <79256> ../cstrike/dlls/effects.cpp:1843 */
Vector CBlood::BloodPosition(CBaseEntity *pActivator)
{
if (pev->spawnflags & SF_BLOOD_PLAYER)
@ -1745,13 +1637,12 @@ Vector CBlood::BloodPosition(CBaseEntity *pActivator)
return pev->origin;
}
/* <79351> ../cstrike/dlls/effects.cpp:1863 */
void CBlood::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
if (pev->spawnflags & SF_BLOOD_STREAM)
UTIL_BloodStream(BloodPosition(pActivator), Direction(), (Color() == BLOOD_COLOR_RED) ? 70 : Color(), (int)BloodAmount());
UTIL_BloodStream(BloodPosition(pActivator), Direction(), (Color() == BLOOD_COLOR_RED) ? 70 : Color(), int(BloodAmount()));
else
UTIL_BloodDrips(BloodPosition(pActivator), Direction(), Color(), (int)BloodAmount());
UTIL_BloodDrips(BloodPosition(pActivator), Direction(), Color(), int(BloodAmount()));
if (pev->spawnflags & SF_BLOOD_DECAL)
{
@ -1768,10 +1659,8 @@ void CBlood::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, US
}
}
/* <79594> ../cstrike/dlls/effects.cpp:1905 */
LINK_ENTITY_TO_CLASS(env_shake, CShake);
/* <73705> ../cstrike/dlls/effects.cpp:1919 */
void CShake::__MAKE_VHOOK(Spawn)()
{
pev->solid = SOLID_NOT;
@ -1783,7 +1672,6 @@ void CShake::__MAKE_VHOOK(Spawn)()
pev->dmg = 0;
}
/* <74d76> ../cstrike/dlls/effects.cpp:1931 */
void CShake::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "amplitude"))
@ -1810,16 +1698,13 @@ void CShake::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CPointEntity::KeyValue(pkvd);
}
/* <73c2d> ../cstrike/dlls/effects.cpp:1958 */
void CShake::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
UTIL_ScreenShake(pev->origin, Amplitude(), Frequency(), Duration(), Radius());
}
/* <79664> ../cstrike/dlls/effects.cpp:1979 */
LINK_ENTITY_TO_CLASS(env_fade, CFade);
/* <7372b> ../cstrike/dlls/effects.cpp:1987 */
void CFade::__MAKE_VHOOK(Spawn)()
{
pev->solid = SOLID_NOT;
@ -1828,7 +1713,6 @@ void CFade::__MAKE_VHOOK(Spawn)()
pev->frame = 0;
}
/* <74efa> ../cstrike/dlls/effects.cpp:1996 */
void CFade::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "duration"))
@ -1845,7 +1729,6 @@ void CFade::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CPointEntity::KeyValue(pkvd);
}
/* <73bb4> ../cstrike/dlls/effects.cpp:2013 */
void CFade::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
int fadeFlags = 0;
@ -1860,19 +1743,17 @@ void CFade::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE
{
if (pActivator->IsNetClient())
{
UTIL_ScreenFade(pActivator, pev->rendercolor, Duration(), HoldTime(), (int)pev->renderamt, fadeFlags);
UTIL_ScreenFade(pActivator, pev->rendercolor, Duration(), HoldTime(), int(pev->renderamt), fadeFlags);
}
}
else
UTIL_ScreenFadeAll(pev->rendercolor, Duration(), HoldTime(), (int)pev->renderamt, fadeFlags);
UTIL_ScreenFadeAll(pev->rendercolor, Duration(), HoldTime(), int(pev->renderamt), fadeFlags);
SUB_UseTargets(this, USE_TOGGLE, 0);
}
/* <79734> ../cstrike/dlls/effects.cpp:2048 */
LINK_ENTITY_TO_CLASS(env_message, CMessage);
/* <73751> ../cstrike/dlls/effects.cpp:2051 */
void CMessage::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -1906,7 +1787,6 @@ void CMessage::__MAKE_VHOOK(Spawn)()
pev->scale = 1.0f;
}
/* <73df7> ../cstrike/dlls/effects.cpp:2085 */
void CMessage::__MAKE_VHOOK(Precache)()
{
if (pev->noise)
@ -1915,7 +1795,6 @@ void CMessage::__MAKE_VHOOK(Precache)()
}
}
/* <74765> ../cstrike/dlls/effects.cpp:2091 */
void CMessage::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "messagesound"))
@ -1937,7 +1816,6 @@ void CMessage::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CPointEntity::KeyValue(pkvd);
}
/* <73aa5> ../cstrike/dlls/effects.cpp:2113 */
void CMessage::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
CBaseEntity *pPlayer = NULL;
@ -1967,16 +1845,13 @@ void CMessage::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller,
SUB_UseTargets(this, USE_TOGGLE, 0);
}
/* <79804> ../cstrike/dlls/effects.cpp:2160 */
LINK_ENTITY_TO_CLASS(env_funnel, CEnvFunnel);
/* <73778> ../cstrike/dlls/effects.cpp:2155 */
void CEnvFunnel::__MAKE_VHOOK(Precache)()
{
m_iSprite = PRECACHE_MODEL("sprites/flare6.spr");
}
/* <7379f> ../cstrike/dlls/effects.cpp:2162 */
void CEnvFunnel::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
MESSAGE_BEGIN(MSG_BROADCAST, SVC_TEMPENTITY);
@ -2003,7 +1878,6 @@ void CEnvFunnel::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller
pev->nextthink = gpGlobals->time;
}
/* <7382b> ../cstrike/dlls/effects.cpp:2187 */
void CEnvFunnel::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -2011,17 +1885,14 @@ void CEnvFunnel::__MAKE_VHOOK(Spawn)()
pev->effects = EF_NODRAW;
}
/* <73852> ../cstrike/dlls/effects.cpp:2207 */
void CEnvBeverage::__MAKE_VHOOK(Precache)()
{
PRECACHE_MODEL("models/can.mdl");
PRECACHE_SOUND("weapons/g_bounce3.wav");
}
/* <798d4> ../cstrike/dlls/effects.cpp:2213 */
LINK_ENTITY_TO_CLASS(env_beverage, CEnvBeverage);
/* <7439c> ../cstrike/dlls/effects.cpp:2215 */
void CEnvBeverage::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
if (pev->frags != 0.0f || pev->health <= 0.0f)
@ -2044,7 +1915,6 @@ void CEnvBeverage::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCall
pev->health--;
}
/* <73879> ../cstrike/dlls/effects.cpp:2242 */
void CEnvBeverage::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -2058,16 +1928,13 @@ void CEnvBeverage::__MAKE_VHOOK(Spawn)()
}
}
/* <738a0> ../cstrike/dlls/effects.cpp:2267 */
void CItemSoda::__MAKE_VHOOK(Precache)()
{
;
}
/* <799a4> ../cstrike/dlls/effects.cpp:2271 */
LINK_ENTITY_TO_CLASS(item_sodacan, CItemSoda);
/* <738c6> ../cstrike/dlls/effects.cpp:2273 */
void CItemSoda::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -2081,7 +1948,6 @@ void CItemSoda::__MAKE_VHOOK(Spawn)()
pev->nextthink = gpGlobals->time + 0.5f;
}
/* <73961> ../cstrike/dlls/effects.cpp:2286 */
void CItemSoda::CanThink()
{
EMIT_SOUND(ENT(pev), CHAN_WEAPON, "weapons/g_bounce3.wav", VOL_NORM, ATTN_NORM);
@ -2093,7 +1959,6 @@ void CItemSoda::CanThink()
SetTouch(&CItemSoda::CanTouch);
}
/* <7431d> ../cstrike/dlls/effects.cpp:2296 */
void CItemSoda::CanTouch(CBaseEntity *pOther)
{
if (!pOther->IsPlayer())

View File

@ -68,7 +68,6 @@
#define SF_MESSAGE_ONCE 0x0001 // Fade in, not out
#define SF_MESSAGE_ALL 0x0002 // Send to all clients
/* <7249d> ../cstrike/dlls/effects.h:33 */
class CSprite: public CPointEntity
{
public:
@ -96,14 +95,14 @@ public:
int Restore_(CRestore &restore);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
public:
void EXPORT AnimateThink();
void EXPORT ExpandThink();
void Animate(float frames);
NOXREF void Expand(float scaleSpeed, float fadeSpeed);
void Expand(float scaleSpeed, float fadeSpeed);
void SpriteInit(const char *pSpriteName, const Vector &origin);
void SetAttachment(edict_t *pEntity, int attachment)
@ -154,7 +153,6 @@ private:
float m_maxFrame;
};
/* <723cb> ../cstrike/dlls/effects.h:105 */
class CBeam: public CBaseEntity
{
public:
@ -175,7 +173,7 @@ public:
void Spawn_();
void Precache_();
#endif // HOOK_GAMEDLL
#endif
public:
void EXPORT TriggerTouch(CBaseEntity *pOther);
@ -194,7 +192,7 @@ public:
void SetWidth(int width) { pev->scale = width; }
void SetNoise(int amplitude) { pev->body = amplitude; }
void SetColor(int r, int g, int b) { pev->rendercolor.x = r; pev->rendercolor.y = g; pev->rendercolor.z = b; }
void SetBrightness(int brightness) { pev->renderamt = brightness;}
void SetBrightness(int brightness) { pev->renderamt = brightness; }
void SetFrame(float frame) { pev->frame = frame; }
void SetScrollRate(int speed) { pev->animtime = speed; }
int GetType() const { return pev->rendermode & 0x0F; }
@ -237,7 +235,6 @@ public:
}
};
/* <72402> ../cstrike/dlls/effects.h:188 */
class CLaser: public CBeam
{
public:
@ -257,7 +254,7 @@ public:
int Restore_(CRestore &restore);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
public:
void TurnOn();
@ -275,7 +272,6 @@ public:
Vector m_firePosition;
};
/* <7237e> ../cstrike/dlls/effects.cpp:36 */
class CBubbling: public CBaseEntity
{
public:
@ -296,7 +292,7 @@ public:
int Restore_(CRestore &restore);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
public:
void EXPORT FizzThink();
@ -310,7 +306,6 @@ public:
int m_state;
};
/* <723e6> ../cstrike/dlls/effects.cpp:357 */
class CLightning: public CBeam
{
public:
@ -330,7 +325,7 @@ public:
int Restore_(CRestore &restore);
void Activate_();
#endif // HOOK_GAMEDLL
#endif
public:
void EXPORT StrikeThink();
@ -368,7 +363,6 @@ public:
float m_radius;
};
/* <7244f> ../cstrike/dlls/effects.cpp:1085 */
class CGlow: public CPointEntity
{
public:
@ -384,7 +378,7 @@ public:
int Restore_(CRestore &restore);
void Think_();
#endif // HOOK_GAMEDLL
#endif
void Animate(float frames);
@ -395,7 +389,6 @@ public:
float m_maxFrame;
};
/* <724b8> ../cstrike/dlls/effects.cpp:1146 */
class CBombGlow: public CSprite
{
public:
@ -407,7 +400,7 @@ public:
void Spawn_();
void Think_();
#endif // HOOK_GAMEDLL
#endif
public:
float m_lastTime;
@ -415,7 +408,6 @@ public:
bool m_bSetModel;
};
/* <72581> ../cstrike/dlls/effects.cpp:1413 */
class CGibShooter: public CBaseDelay
{
public:
@ -437,7 +429,7 @@ public:
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
CGib *CreateGib_();
#endif // HOOK_GAMEDLL
#endif
public:
void EXPORT ShootThink();
@ -455,7 +447,6 @@ public:
float m_flGibLife;
};
/* <725ef> ../cstrike/dlls/effects.cpp:1592 */
class CEnvShooter: public CGibShooter
{
public:
@ -469,13 +460,12 @@ public:
void KeyValue_(KeyValueData *pkvd);
CGib *CreateGib_();
#endif // HOOK_GAMEDLL
#endif
};
#define MAX_BEAM 24
/* <7263d> ../cstrike/dlls/effects.cpp:1679 */
class CTestEffect: public CBaseDelay
{
public:
@ -489,7 +479,7 @@ public:
void Precache_();
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
public:
void EXPORT TestThink();
@ -504,7 +494,6 @@ public:
float m_flStartTime;
};
/* <72690> ../cstrike/dlls/effects.cpp:1769 */
class CBlood: public CPointEntity
{
public:
@ -518,7 +507,7 @@ public:
void KeyValue_(KeyValueData *pkvd);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
public:
int Color() const { return pev->impulse; }
@ -532,7 +521,6 @@ public:
Vector BloodPosition(CBaseEntity *pActivator);
};
/* <726de> ../cstrike/dlls/effects.cpp:1886 */
class CShake: public CPointEntity
{
public:
@ -546,7 +534,7 @@ public:
void KeyValue_(KeyValueData *pkvd);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
public:
float Amplitude() const { return pev->scale; }
@ -560,7 +548,6 @@ public:
void SetRadius(float radius) { pev->dmg = radius; }
};
/* <7272c> ../cstrike/dlls/effects.cpp:1964 */
class CFade: public CPointEntity
{
public:
@ -574,7 +561,7 @@ public:
void KeyValue_(KeyValueData *pkvd);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
public:
float Duration() const { return pev->dmg_take; }
@ -584,7 +571,6 @@ public:
void SetHoldTime(float hold) { pev->dmg_save = hold; }
};
/* <7277a> ../cstrike/dlls/effects.cpp:2038 */
class CMessage: public CPointEntity
{
public:
@ -600,11 +586,10 @@ public:
void KeyValue_(KeyValueData *pkvd);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
};
/* <727c8> ../cstrike/dlls/effects.cpp:2145 */
class CEnvFunnel: public CBaseDelay
{
public:
@ -618,13 +603,12 @@ public:
void Precache_();
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
public:
int m_iSprite;
};
/* <7281b> ../cstrike/dlls/effects.cpp:2199 */
class CEnvBeverage: public CBaseDelay
{
public:
@ -638,11 +622,10 @@ public:
void Precache_();
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
};
/* <72869> ../cstrike/dlls/effects.cpp:2258 */
class CItemSoda: public CBaseEntity
{
public:
@ -654,7 +637,7 @@ public:
void Spawn_();
void Precache_();
#endif // HOOK_GAMEDLL
#endif
public:
void EXPORT CanThink();

View File

@ -93,13 +93,11 @@ extern enginefuncs_t g_engfuncs;
#define GET_TIMES_TUTOR_MESSAGE_SHOWN (*g_engfuncs.pfnGetTimesTutorMessageShown)
#define ENG_CHECK_PARM (*g_engfuncs.pfnEngCheckParm)
/* <472a4> ../cstrike/dlls/enginecallback.h:77 */
inline void MESSAGE_BEGIN(int msg_dest, int msg_type, const float *pOrigin = NULL, edict_t *ed = NULL)
{
(*g_engfuncs.pfnMessageBegin)(msg_dest,msg_type,pOrigin,ed);
}
/* <464e> ../cstrike/dlls/enginecallback.h:97 */
inline void *GET_PRIVATE(edict_t *pent)
{
if (pent)
@ -185,4 +183,4 @@ inline void *GET_PRIVATE(edict_t *pent)
#define ENGINE_FORCE_UNMODIFIED (*g_engfuncs.pfnForceUnmodified)
#define PLAYER_CNX_STATS (*g_engfuncs.pfnGetPlayerStats)
#endif //ENGINECALLBACK_H
#endif // ENGINECALLBACK_H

View File

@ -11,12 +11,10 @@ TYPEDESCRIPTION CEnvExplosion::m_SaveData[] =
DEFINE_FIELD(CEnvExplosion, m_spriteScale, FIELD_INTEGER),
};
#endif // HOOK_GAMEDLL
#endif
/* <7f660> ../cstrike/dlls/explode.cpp:37 */
LINK_ENTITY_TO_CLASS(spark_shower, CShower);
/* <7f49c> ../cstrike/dlls/explode.cpp:39 */
void CShower::__MAKE_VHOOK(Spawn)()
{
pev->velocity = RANDOM_FLOAT(200, 300) * pev->angles;
@ -42,7 +40,6 @@ void CShower::__MAKE_VHOOK(Spawn)()
pev->angles = g_vecZero;
}
/* <7f475> ../cstrike/dlls/explode.cpp:61 */
void CShower::__MAKE_VHOOK(Think)()
{
UTIL_Sparks(pev->origin);
@ -57,7 +54,6 @@ void CShower::__MAKE_VHOOK(Think)()
pev->flags &= ~FL_ONGROUND;
}
/* <7f122> ../cstrike/dlls/explode.cpp:73 */
void CShower::__MAKE_VHOOK(Touch)(CBaseEntity *pOther)
{
if (pev->flags & FL_ONGROUND)
@ -71,13 +67,9 @@ void CShower::__MAKE_VHOOK(Touch)(CBaseEntity *pOther)
}
}
/* <7f566> ../cstrike/dlls/explode.cpp:106 */
IMPLEMENT_SAVERESTORE(CEnvExplosion, CBaseMonster);
/* <7f72a> ../cstrike/dlls/explode.cpp:107 */
LINK_ENTITY_TO_CLASS(env_explosion, CEnvExplosion);
/* <7f5b2> ../cstrike/dlls/explode.cpp:109 */
void CEnvExplosion::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "iMagnitude"))
@ -89,7 +81,6 @@ void CEnvExplosion::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CBaseEntity::KeyValue(pkvd);
}
/* <7f1a5> ../cstrike/dlls/explode.cpp:120 */
void CEnvExplosion::__MAKE_VHOOK(Spawn)()
{
pev->solid = SOLID_NOT;
@ -103,16 +94,15 @@ void CEnvExplosion::__MAKE_VHOOK(Spawn)()
flSpriteScale = 10.0f;
}
m_spriteScale = (int)flSpriteScale;
m_spriteScale = int(flSpriteScale);
}
/* <7f233> ../cstrike/dlls/explode.cpp:150 */
void CEnvExplosion::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
TraceResult tr;
pev->model = iStringNull;//invisible
pev->solid = SOLID_NOT;//intangible
pev->model = iStringNull;// invisible
pev->solid = SOLID_NOT;// intangible
Vector vecSpot;// trace starts here!
@ -125,15 +115,11 @@ void CEnvExplosion::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCal
{
pev->origin = tr.vecEndPos + (tr.vecPlaneNormal * (m_iMagnitude - 24) * 0.6f);
}
else
{
pev->origin = pev->origin;
}
// draw decal
if (! (pev->spawnflags & SF_ENVEXPLOSION_NODECAL))
{
if (RANDOM_FLOAT(0, 1) < 0.5)
if (RANDOM_FLOAT(0, 1) < 0.5f)
{
UTIL_DecalTrace(&tr, DECAL_SCORCH1);
}
@ -152,7 +138,7 @@ void CEnvExplosion::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCal
WRITE_COORD(pev->origin.y);
WRITE_COORD(pev->origin.z);
WRITE_SHORT(g_sModelIndexFireball);
WRITE_BYTE((byte)m_spriteScale); // scale * 10
WRITE_BYTE(byte(m_spriteScale)); // scale * 10
WRITE_BYTE(15); // framerate
WRITE_BYTE(TE_EXPLFLAG_NONE);
MESSAGE_END();
@ -192,7 +178,6 @@ void CEnvExplosion::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCal
}
}
/* <7f1e1> ../cstrike/dlls/explode.cpp:235 */
void CEnvExplosion::Smoke()
{
if (!(pev->spawnflags & SF_ENVEXPLOSION_NOSMOKE))
@ -203,7 +188,7 @@ void CEnvExplosion::Smoke()
WRITE_COORD(pev->origin.y);
WRITE_COORD(pev->origin.z);
WRITE_SHORT(g_sModelIndexSmoke);
WRITE_BYTE((byte)m_spriteScale); // scale * 10
WRITE_BYTE(byte(m_spriteScale)); // scale * 10
WRITE_BYTE(12); // framerate
MESSAGE_END();
}
@ -215,8 +200,6 @@ void CEnvExplosion::Smoke()
}
// HACKHACK -- create one of these and fake a keyvalue to get the right explosion setup
/* <7f7f4> ../cstrike/dlls/explode.cpp:258 */
void ExplosionCreate(const Vector &center, Vector &angles, edict_t *pOwner, int magnitude, BOOL doDamage)
{
KeyValueData kvd;

View File

@ -39,7 +39,6 @@
#define SF_ENVEXPLOSION_NODECAL (1<<4) // don't make a scorch mark
#define SF_ENVEXPLOSION_NOSPARKS (1<<5) // don't make a scorch mark
/* <7e4a8> ../cstrike/dlls/explode.cpp:29 */
class CShower: public CBaseEntity
{
public:
@ -54,11 +53,10 @@ public:
void Think_();
void Touch_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL
#endif
};
/* <7e66b> ../cstrike/dlls/explode.cpp:84 */
class CEnvExplosion: public CBaseMonster
{
public:
@ -76,7 +74,7 @@ public:
int Restore_(CRestore &restore);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
public:
void EXPORT Smoke();

View File

@ -106,7 +106,6 @@ TYPEDESCRIPTION CPushable::m_SaveData[] =
#endif // HOOK_GAMEDLL
/* <85bf3> ../cstrike/dlls/func_break.cpp:76 */
void CBreakable::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
// UNDONE_WC: explicitly ignoring these fields, but they shouldn't be in the map file!
@ -170,13 +169,9 @@ void CBreakable::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CBaseDelay::KeyValue(pkvd);
}
/* <86426> ../cstrike/dlls/func_break.cpp:139 */
LINK_ENTITY_TO_CLASS(func_breakable, CBreakable);
/* <85b30> ../cstrike/dlls/func_break.cpp:155 */
IMPLEMENT_SAVERESTORE(CBreakable, CBaseEntity);
/* <85663> ../cstrike/dlls/func_break.cpp:157 */
void CBreakable::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -217,7 +212,6 @@ void CBreakable::__MAKE_VHOOK(Spawn)()
}
}
/* <8568a> ../cstrike/dlls/func_break.cpp:191 */
void CBreakable::__MAKE_VHOOK(Restart)()
{
pev->solid = SOLID_BSP;
@ -248,7 +242,6 @@ void CBreakable::__MAKE_VHOOK(Restart)()
}
}
/* <864f1> ../cstrike/dlls/func_break.cpp:260 */
const char **CBreakable::MaterialSoundList(Materials precacheMaterial, int &soundCount)
{
const char **pSoundList = NULL;
@ -298,7 +291,6 @@ const char **CBreakable::MaterialSoundList(Materials precacheMaterial, int &soun
return pSoundList;
}
/* <86526> ../cstrike/dlls/func_break.cpp:303 */
void CBreakable::MaterialSoundPrecache(Materials precacheMaterial)
{
const char **pSoundList;
@ -312,7 +304,6 @@ void CBreakable::MaterialSoundPrecache(Materials precacheMaterial)
}
}
/* <86598> ../cstrike/dlls/func_break.cpp:316 */
void CBreakable::MaterialSoundRandom(edict_t *pEdict, Materials soundMaterial, float volume)
{
int soundCount = 0;
@ -324,7 +315,6 @@ void CBreakable::MaterialSoundRandom(edict_t *pEdict, Materials soundMaterial, f
}
}
/* <8634b> ../cstrike/dlls/func_break.cpp:328 */
void CBreakable::__MAKE_VHOOK(Precache)()
{
const char *pGibName = NULL;
@ -402,7 +392,6 @@ void CBreakable::__MAKE_VHOOK(Precache)()
}
}
/* <86676> ../cstrike/dlls/func_break.cpp:401 */
void CBreakable::DamageSound()
{
int pitch;
@ -476,7 +465,6 @@ void CBreakable::DamageSound()
}
}
/* <8691c> ../cstrike/dlls/func_break.cpp:475 */
void CBreakable::BreakTouch(CBaseEntity *pOther)
{
float flDamage;
@ -497,7 +485,7 @@ void CBreakable::BreakTouch(CBaseEntity *pOther)
pev->takedamage = DAMAGE_NO;
pev->deadflag = DEAD_DEAD;
pev->effects = EF_NODRAW;
#endif // REGAMEDLL_FIXES
#endif
Die();
}
@ -538,8 +526,6 @@ void CBreakable::BreakTouch(CBaseEntity *pOther)
// Smash the our breakable object
// Break when triggered
/* <85f2d> ../cstrike/dlls/func_break.cpp:538 */
void CBreakable::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
if (IsBreakable())
@ -552,13 +538,12 @@ void CBreakable::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller
pev->takedamage = DAMAGE_NO;
pev->deadflag = DEAD_DEAD;
pev->effects = EF_NODRAW;
#endif // REGAMEDLL_FIXES
#endif
Die();
}
}
/* <85964> ../cstrike/dlls/func_break.cpp:554 */
void CBreakable::__MAKE_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
{
// random spark if this is a 'computer' object
@ -595,8 +580,6 @@ void CBreakable::__MAKE_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDamag
// Special takedamage for func_breakable. Allows us to make
// exceptions that are breakable-specific
// bitsDamageType indicates the type of damage sustained ie: DMG_CRUSH
/* <86719> ../cstrike/dlls/func_break.cpp:588 */
int CBreakable::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
Vector vecTemp;
@ -646,7 +629,7 @@ int CBreakable::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pev
pev->takedamage = DAMAGE_NO;
pev->deadflag = DEAD_DEAD;
pev->effects = EF_NODRAW;
#endif // REGAMEDLL_FIXES
#endif
Die();
if (m_flDelay == 0.0f)
@ -664,7 +647,6 @@ int CBreakable::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pev
return 1;
}
/* <856fe> ../cstrike/dlls/func_break.cpp:653 */
void CBreakable::Die()
{
Vector vecSpot; // shard origin
@ -678,7 +660,7 @@ void CBreakable::Die()
pev->takedamage = DAMAGE_NO;
pev->deadflag = DEAD_DEAD;
pev->effects = EF_NODRAW;
#endif // REGAMEDLL_FIXES
#endif
pitch = 95 + RANDOM_LONG(0, 29);
@ -687,7 +669,7 @@ void CBreakable::Die()
// The more negative pev->health, the louder
// the sound should be.
fvol = RANDOM_FLOAT(0.85, 1.0) + (abs((int)pev->health) / 100.0f);
fvol = RANDOM_FLOAT(0.85f, 1.0f) + (Q_abs(int(pev->health)) / 100.0f);
if (fvol > 1.0f)
fvol = 1.0f;
@ -791,7 +773,7 @@ void CBreakable::Die()
vecVelocity.z = 0;
}
vecSpot = pev->origin + (pev->mins + pev->maxs) * 0.5;
vecSpot = pev->origin + (pev->mins + pev->maxs) * 0.5f;
MESSAGE_BEGIN(MSG_PVS, SVC_TEMPENTITY, vecSpot);
WRITE_BYTE(TE_BREAKMODEL);
@ -827,14 +809,11 @@ void CBreakable::Die()
CBaseEntity *pList[256];
int count = UTIL_EntitiesInBox(pList, ARRAYSIZE(pList), mins, maxs, FL_ONGROUND);
if (count)
{
for (int i = 0; i < count; ++i)
{
pList[i]->pev->flags &= ~FL_ONGROUND;
pList[i]->pev->groundentity = NULL;
}
}
pev->solid = SOLID_NOT;
SUB_UseTargets(NULL, USE_TOGGLE, 0);
@ -853,13 +832,11 @@ void CBreakable::Die()
}
}
/* <86992> ../cstrike/dlls/func_break.cpp:833 */
BOOL CBreakable::IsBreakable()
{
return m_Material != matUnbreakableGlass;
}
/* <85a99> ../cstrike/dlls/func_break.cpp:839 */
int CBreakable::__MAKE_VHOOK(DamageDecal)(int bitsDamageType)
{
if (m_Material == matGlass)
@ -871,13 +848,9 @@ int CBreakable::__MAKE_VHOOK(DamageDecal)(int bitsDamageType)
return CBaseEntity::DamageDecal(bitsDamageType);
}
/* <869b4> ../cstrike/dlls/func_break.cpp:888 */
LINK_ENTITY_TO_CLASS(func_pushable, CPushable);
/* <85e0b> ../cstrike/dlls/func_break.cpp:886 */
IMPLEMENT_SAVERESTORE(CPushable, CBreakable);
/* <856d7> ../cstrike/dlls/func_break.cpp:893 */
void CPushable::__MAKE_VHOOK(Spawn)()
{
if (pev->spawnflags & SF_PUSH_BREAKABLE)
@ -905,11 +878,10 @@ void CPushable::__MAKE_VHOOK(Spawn)()
UTIL_SetOrigin(pev, pev->origin);
// Multiply by area of the box's cross-section (assume 1000 units^3 standard volume)
pev->skin = (int)((pev->skin * (pev->maxs.x - pev->mins.x) * (pev->maxs.y - pev->mins.y)) * 0.0005);
pev->skin = int((pev->skin * (pev->maxs.x - pev->mins.x) * (pev->maxs.y - pev->mins.y)) * 0.0005);
m_soundTime = 0;
}
/* <863eb> ../cstrike/dlls/func_break.cpp:920 */
void CPushable::__MAKE_VHOOK(Precache)()
{
for (int i = 0; i < 3; ++i)
@ -923,7 +895,6 @@ void CPushable::__MAKE_VHOOK(Precache)()
}
}
/* <85fa3> ../cstrike/dlls/func_break.cpp:930 */
void CPushable::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "size"))
@ -950,11 +921,10 @@ void CPushable::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
UTIL_SetSize(pev, VEC_HULL_MIN, VEC_HULL_MAX);
break;
}
}
else if (FStrEq(pkvd->szKeyName, "buoyancy"))
{
pev->skin = (int)Q_atof(pkvd->szValue);
pev->skin = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else
@ -962,8 +932,6 @@ void CPushable::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
}
// Pull the func_pushable
/* <86c0d> ../cstrike/dlls/func_break.cpp:969 */
void CPushable::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
if (!pActivator || !pActivator->IsPlayer())
@ -982,7 +950,6 @@ void CPushable::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller,
}
}
/* <86b99> ../cstrike/dlls/func_break.cpp:983 */
void CPushable::__MAKE_VHOOK(Touch)(CBaseEntity *pOther)
{
if (FClassnameIs(pOther->pev, "worldspawn"))
@ -991,11 +958,10 @@ void CPushable::__MAKE_VHOOK(Touch)(CBaseEntity *pOther)
Move(pOther, 1);
}
/* <86a82> ../cstrike/dlls/func_break.cpp:992 */
void CPushable::Move(CBaseEntity *pOther, int push)
{
entvars_t *pevToucher = pOther->pev;
int playerTouch = 0;
bool bPlayerTouch = false;
// Is entity standing on this pushable ?
if ((pevToucher->flags & FL_ONGROUND) && pevToucher->groundentity && VARS(pevToucher->groundentity) == pev)
@ -1017,12 +983,12 @@ void CPushable::Move(CBaseEntity *pOther, int push)
return;
}
playerTouch = 1;
bPlayerTouch = true;
}
float_precision factor;
if (playerTouch)
if (bPlayerTouch)
{
// Don't push away from jumping/falling players unless in water
if (!(pevToucher->flags & FL_ONGROUND))
@ -1041,7 +1007,7 @@ void CPushable::Move(CBaseEntity *pOther, int push)
pev->velocity.x += pevToucher->velocity.x * factor;
pev->velocity.y += pevToucher->velocity.y * factor;
float_precision length = sqrt(pev->velocity.x * pev->velocity.x + pev->velocity.y * pev->velocity.y);
float_precision length = Q_sqrt(pev->velocity.x * pev->velocity.x + pev->velocity.y * pev->velocity.y);
if (push && (length > MaxSpeed()))
{
@ -1049,7 +1015,7 @@ void CPushable::Move(CBaseEntity *pOther, int push)
pev->velocity.y = (pev->velocity.y * MaxSpeed() / length);
}
if (playerTouch)
if (bPlayerTouch)
{
pevToucher->velocity.x = pev->velocity.x;
pevToucher->velocity.y = pev->velocity.y;
@ -1064,7 +1030,7 @@ void CPushable::Move(CBaseEntity *pOther, int push)
EMIT_SOUND(ENT(pev), CHAN_WEAPON, m_soundNames[m_lastSound], 0.5, ATTN_NORM);
//SetThink(StopSound);
//pev->nextthink = pev->ltime + 0.1;
//pev->nextthink = pev->ltime + 0.1f;
}
else
STOP_SOUND(ENT(pev), CHAN_WEAPON, m_soundNames[m_lastSound]);
@ -1072,7 +1038,6 @@ void CPushable::Move(CBaseEntity *pOther, int push)
}
}
/* <868b0> ../cstrike/dlls/func_break.cpp:1061 */
int CPushable::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
if (pev->spawnflags & SF_PUSH_BREAKABLE)

View File

@ -67,7 +67,6 @@ typedef enum
} Materials;
/* <84d53> ../cstrike/dlls/func_break.h:23 */
class CBreakable: public CBaseDelay
{
public:
@ -102,14 +101,14 @@ public:
int DamageDecal_(int bitsDamageType);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
public:
void EXPORT BreakTouch(CBaseEntity *pOther);
void DamageSound();
BOOL IsBreakable();
NOXREF BOOL SparkWhenHit();
BOOL SparkWhenHit();
void EXPORT Die();
@ -141,7 +140,6 @@ public:
float m_flHealth;
};
/* <84da0> ../cstrike/dlls/func_break.cpp:851 */
class CPushable: public CBreakable
{
public:
@ -166,7 +164,7 @@ public:
void Touch_(CBaseEntity *pOther);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
public:
void Move(CBaseEntity *pMover, int push);

View File

@ -57,12 +57,10 @@ Vector gTankSpread[] =
#endif // HOOK_GAMEDLL
#define MAX_FIRING_SPREADS ARRAYSIZE(gTankSpread)
const int MAX_FIRING_SPREADS = ARRAYSIZE(gTankSpread);
/* <8d76a> ../cstrike/dlls/func_tank.cpp:164 */
IMPLEMENT_SAVERESTORE(CFuncTank, CBaseEntity);
/* <8ea25> ../cstrike/dlls/func_tank.cpp:177 */
void CFuncTank::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -92,7 +90,6 @@ void CFuncTank::__MAKE_VHOOK(Spawn)()
pev->oldorigin = pev->origin;
}
/* <8d64d> ../cstrike/dlls/func_tank.cpp:202 */
void CFuncTank::__MAKE_VHOOK(Precache)()
{
if (m_iszSpriteSmoke)
@ -111,7 +108,6 @@ void CFuncTank::__MAKE_VHOOK(Precache)()
}
}
/* <8e19e> ../cstrike/dlls/func_tank.cpp:214 */
void CFuncTank::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "yawrate"))
@ -223,7 +219,6 @@ void CFuncTank::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CBaseEntity::KeyValue(pkvd);
}
/* <8dca8> ../cstrike/dlls/func_tank.cpp:329 */
BOOL CFuncTank::__MAKE_VHOOK(OnControls)(entvars_t *pevTest)
{
if (!(pev->spawnflags & SF_TANK_CANCONTROL))
@ -239,7 +234,6 @@ BOOL CFuncTank::__MAKE_VHOOK(OnControls)(entvars_t *pevTest)
return FALSE;
}
/* <8eba8> ../cstrike/dlls/func_tank.cpp:342 */
BOOL CFuncTank::StartControl(CBasePlayer *pController)
{
if (m_pController != NULL)
@ -265,7 +259,7 @@ BOOL CFuncTank::StartControl(CBasePlayer *pController)
#ifdef REGAMEDLL_FIXES
m_pController->pev->viewmodel = 0;
m_pController->m_iFOV = DEFAULT_FOV;
#endif // REGAMEDLL_FIXES
#endif
}
m_pController->m_iHideHUD |= HIDEHUD_WEAPONS;
@ -276,7 +270,6 @@ BOOL CFuncTank::StartControl(CBasePlayer *pController)
return TRUE;
}
/* <8ebde> ../cstrike/dlls/func_tank.cpp:372 */
void CFuncTank::StopControl()
{
// TODO: bring back the controllers current weapon
@ -306,7 +299,6 @@ void CFuncTank::StopControl()
}
}
/* <8ec15> ../cstrike/dlls/func_tank.cpp:398 */
void CFuncTank::ControllerPostFrame()
{
assert(m_pController != NULL);
@ -314,7 +306,7 @@ void CFuncTank::ControllerPostFrame()
if (gpGlobals->time < m_flNextAttack)
return;
if (m_pController->pev->button & IN_ATTACK)
if (m_pController != NULL && m_pController->pev->button & IN_ATTACK)
{
Vector vecForward;
UTIL_MakeVectorsPrivate(pev->angles, vecForward, NULL, NULL);
@ -322,7 +314,7 @@ void CFuncTank::ControllerPostFrame()
m_fireLast = gpGlobals->time - (1.0f / m_fireRate) - 0.01f;
Fire(BarrelPosition(), vecForward, m_pController->pev);
if (m_pController && m_pController->IsPlayer())
if (m_pController->IsPlayer())
{
m_pController->m_iWeaponVolume = LOUD_GUN_VOLUME;
}
@ -331,7 +323,6 @@ void CFuncTank::ControllerPostFrame()
}
}
/* <8ee12> ../cstrike/dlls/func_tank.cpp:424 */
void CFuncTank::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
// player controlled turret
@ -366,13 +357,11 @@ void CFuncTank::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller,
}
}
/* <8ef04> ../cstrike/dlls/func_tank.cpp:459 */
edict_t *CFuncTank::FindTarget(edict_t *pPlayer)
{
return pPlayer;
}
/* <8ef2d> ../cstrike/dlls/func_tank.cpp:466 */
BOOL CFuncTank::InRange(float range)
{
if (range < m_minRange)
@ -384,24 +373,22 @@ BOOL CFuncTank::InRange(float range)
return TRUE;
}
/* <8f717> ../cstrike/dlls/func_tank.cpp:477 */
void CFuncTank::__MAKE_VHOOK(Think)()
{
pev->avelocity = g_vecZero;
TrackTarget();
if (fabs((float_precision)pev->avelocity.x) > 1 || fabs((float_precision)pev->avelocity.y) > 1)
if (Q_fabs(float_precision(pev->avelocity.x)) > 1 || Q_fabs(float_precision(pev->avelocity.y)) > 1)
StartRotSound();
else
StopRotSound();
}
/* <8efe4> ../cstrike/dlls/func_tank.cpp:488 */
void CFuncTank::TrackTarget()
{
TraceResult tr;
edict_t *pPlayer = FIND_CLIENT_IN_PVS(edict());
BOOL updateTime = FALSE, lineOfSight;
bool updateTime = false, lineOfSight = false;
Vector angles, direction, targetPosition, barrelEnd;
edict_t *pTarget = NULL;
@ -446,17 +433,16 @@ void CFuncTank::TrackTarget()
return;
UTIL_TraceLine(barrelEnd, targetPosition, dont_ignore_monsters, edict(), &tr);
lineOfSight = FALSE;
// No line of sight, don't track
if (tr.flFraction == 1.0f || tr.pHit == pTarget)
{
lineOfSight = TRUE;
lineOfSight = true;
CBaseEntity *pInstance = CBaseEntity::Instance(pTarget);
if (InRange(range) && pInstance && pInstance->IsAlive())
{
updateTime = TRUE;
updateTime = true;
m_sightOrigin = UpdateTargetPosition(pInstance);
}
}
@ -483,14 +469,14 @@ void CFuncTank::TrackTarget()
angles.y = m_yawCenter + m_yawRange;
// Don't update if you saw the player, but out of range
updateTime = FALSE;
updateTime = false;
}
else if (angles.y < (m_yawCenter - m_yawRange))
{
angles.y = (m_yawCenter - m_yawRange);
// Don't update if you saw the player, but out of range
updateTime = FALSE;
updateTime = false;
}
if (updateTime)
@ -539,9 +525,9 @@ void CFuncTank::TrackTarget()
return;
}
if (CanFire() && ((fabs(distX) < m_pitchTolerance && fabs(distY) < m_yawTolerance) || (pev->spawnflags & SF_TANK_LINEOFSIGHT)))
if (CanFire() && ((Q_fabs(distX) < m_pitchTolerance && Q_fabs(distY) < m_yawTolerance) || (pev->spawnflags & SF_TANK_LINEOFSIGHT)))
{
BOOL fire = FALSE;
bool fire = false;
Vector forward;
UTIL_MakeVectorsPrivate(pev->angles, forward, NULL, NULL);
@ -552,11 +538,11 @@ void CFuncTank::TrackTarget()
if (tr.pHit == pTarget)
{
fire = TRUE;
fire = true;
}
}
else
fire = TRUE;
fire = true;
if (fire)
{
@ -570,8 +556,6 @@ void CFuncTank::TrackTarget()
}
// If barrel is offset, add in additional rotation
/* <8ef79> ../cstrike/dlls/func_tank.cpp:632 */
void CFuncTank::AdjustAnglesForBarrel(Vector &angles, float distance)
{
float_precision r2, d2;
@ -584,20 +568,18 @@ void CFuncTank::AdjustAnglesForBarrel(Vector &angles, float distance)
if (m_barrelPos.y)
{
r2 = m_barrelPos.y * m_barrelPos.y;
angles.y += (180.0f / M_PI) * atan2(m_barrelPos.y, sqrt(d2 - r2));
angles.y += (180.0f / M_PI) * Q_atan2(m_barrelPos.y, Q_sqrt(d2 - r2));
}
if (m_barrelPos.z)
{
r2 = m_barrelPos.z * m_barrelPos.z;
angles.x += (180.0f / M_PI) * atan2(-m_barrelPos.z, sqrt(d2 - r2));
angles.x += (180.0f / M_PI) * Q_atan2(-m_barrelPos.z, Q_sqrt(d2 - r2));
}
}
}
// Fire targets and spawn sprites
/* <8d4ad> ../cstrike/dlls/func_tank.cpp:656 */
void CFuncTank::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker)
{
if (m_fireLast != 0.0f)
@ -630,7 +612,6 @@ void CFuncTank::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &forwar
m_fireLast = gpGlobals->time;
}
/* <8f830> ../cstrike/dlls/func_tank.cpp:684 */
void CFuncTank::TankTrace(const Vector &vecStart, const Vector &vecForward, const Vector &vecSpread, TraceResult &tr)
{
// get circular gaussian spread
@ -652,7 +633,6 @@ void CFuncTank::TankTrace(const Vector &vecStart, const Vector &vecForward, cons
UTIL_TraceLine(vecStart, vecEnd, dont_ignore_monsters, edict(), &tr);
}
/* <8f9c0> ../cstrike/dlls/func_tank.cpp:703 */
void CFuncTank::StartRotSound()
{
if (!pev->noise || (pev->spawnflags & SF_TANK_SOUNDON))
@ -664,7 +644,6 @@ void CFuncTank::StartRotSound()
EMIT_SOUND(edict(), CHAN_STATIC, (char *)STRING(pev->noise), 0.85, ATTN_NORM);
}
/* <8fa1b> ../cstrike/dlls/func_tank.cpp:712 */
void CFuncTank::StopRotSound()
{
if (pev->spawnflags & SF_TANK_SOUNDON)
@ -675,10 +654,8 @@ void CFuncTank::StopRotSound()
pev->spawnflags &= ~SF_TANK_SOUNDON;
}
/* <8fa65> ../cstrike/dlls/func_tank.cpp:724 */
LINK_ENTITY_TO_CLASS(func_tank, CFuncTankGun);
/* <8c3d5> ../cstrike/dlls/func_tank.cpp:726 */
void CFuncTankGun::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker)
{
if (m_fireLast != 0.0f)
@ -686,7 +663,7 @@ void CFuncTankGun::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &for
// FireBullets needs gpGlobals->v_up, etc.
UTIL_MakeAimVectors(pev->angles);
int bulletCount = (int)((gpGlobals->time - m_fireLast) * m_fireRate);
int bulletCount = int((gpGlobals->time - m_fireLast) * m_fireRate);
if (bulletCount > 0)
{
@ -716,13 +693,9 @@ void CFuncTankGun::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &for
CFuncTank::Fire(barrelEnd, forward, pevAttacker);
}
/* <8fb34> ../cstrike/dlls/func_tank.cpp:785 */
LINK_ENTITY_TO_CLASS(func_tanklaser, CFuncTankLaser);
/* <8e07c> ../cstrike/dlls/func_tank.cpp:793 */
IMPLEMENT_SAVERESTORE(CFuncTankLaser, CFuncTank);
/* <8deed> ../cstrike/dlls/func_tank.cpp:795 */
void CFuncTankLaser::__MAKE_VHOOK(Activate)()
{
if (!GetLaser())
@ -736,7 +709,6 @@ void CFuncTankLaser::__MAKE_VHOOK(Activate)()
}
}
/* <8e8ca> ../cstrike/dlls/func_tank.cpp:809 */
void CFuncTankLaser::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "laserentity"))
@ -748,7 +720,6 @@ void CFuncTankLaser::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CFuncTank::KeyValue(pkvd);
}
/* <8dd79> ../cstrike/dlls/func_tank.cpp:821 */
CLaser *CFuncTankLaser::GetLaser()
{
if (m_pLaser != NULL)
@ -773,7 +744,6 @@ CLaser *CFuncTankLaser::GetLaser()
return m_pLaser;
}
/* <8f809> ../cstrike/dlls/func_tank.cpp:845 */
void CFuncTankLaser::__MAKE_VHOOK(Think)()
{
if (m_pLaser != NULL && gpGlobals->time > m_laserTime)
@ -784,7 +754,6 @@ void CFuncTankLaser::__MAKE_VHOOK(Think)()
CFuncTank::Think();
}
/* <8df51> ../cstrike/dlls/func_tank.cpp:854 */
void CFuncTankLaser::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker)
{
int i;
@ -795,7 +764,8 @@ void CFuncTankLaser::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &f
// TankTrace needs gpGlobals->v_up, etc.
UTIL_MakeAimVectors(pev->angles);
int bulletCount = (int)((gpGlobals->time - m_fireLast) * m_fireRate);
int bulletCount = int((gpGlobals->time - m_fireLast) * m_fireRate);
if (bulletCount)
{
for (i = 0; i < bulletCount; ++i)
@ -819,24 +789,22 @@ void CFuncTankLaser::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &f
}
}
/* <8fc2f> ../cstrike/dlls/func_tank.cpp:893 */
LINK_ENTITY_TO_CLASS(func_tankrocket, CFuncTankRocket);
/* <8e736> ../cstrike/dlls/func_tank.cpp:895 */
void CFuncTankRocket::__MAKE_VHOOK(Precache)()
{
UTIL_PrecacheOther("rpg_rocket");
CFuncTank::Precache();
}
/* <8d7b6> ../cstrike/dlls/func_tank.cpp:903 */
void CFuncTankRocket::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker)
{
int i;
if (m_fireLast != 0.0f)
{
int bulletCount = (int)((gpGlobals->time - m_fireLast) * m_fireRate);
int bulletCount = int((gpGlobals->time - m_fireLast) * m_fireRate);
if (bulletCount > 0)
{
for (i = 0; i < bulletCount; ++i)
@ -851,10 +819,8 @@ void CFuncTankRocket::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &
CFuncTank::Fire(barrelEnd, forward, pev);
}
/* <8fcfe> ../cstrike/dlls/func_tank.cpp:930 */
LINK_ENTITY_TO_CLASS(func_tankmortar, CFuncTankMortar);
/* <8e790> ../cstrike/dlls/func_tank.cpp:933 */
void CFuncTankMortar::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "iMagnitude"))
@ -866,12 +832,11 @@ void CFuncTankMortar::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CFuncTank::KeyValue(pkvd);
}
/* <8dbfa> ../cstrike/dlls/func_tank.cpp:945 */
void CFuncTankMortar::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker)
{
if (m_fireLast != 0.0f)
{
int bulletCount = (int)((gpGlobals->time - m_fireLast) * m_fireRate);
int bulletCount = int((gpGlobals->time - m_fireLast) * m_fireRate);
// Only create 1 explosion
if (bulletCount > 0)
@ -892,17 +857,13 @@ void CFuncTankMortar::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &
CFuncTank::Fire(barrelEnd, forward, pev);
}
/* <8fdcd> ../cstrike/dlls/func_tank.cpp:988 */
LINK_ENTITY_TO_CLASS(func_tankcontrols, CFuncTankControls);
/* <8d71d> ../cstrike/dlls/func_tank.cpp:995 */
IMPLEMENT_SAVERESTORE(CFuncTankControls, CBaseEntity);
/* <8d310> ../cstrike/dlls/func_tank.cpp:1003 */
void CFuncTankControls::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
// pass the Use command onto the controls
if (m_pTank)
if (m_pTank != NULL)
{
m_pTank->Use(pActivator, pCaller, useType, value);
}
@ -911,7 +872,6 @@ void CFuncTankControls::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *
assert(m_pTank != NULL);
}
/* <8d39a> ../cstrike/dlls/func_tank.cpp:1012 */
void CFuncTankControls::__MAKE_VHOOK(Think)()
{
edict_t *pTarget = NULL;
@ -920,7 +880,7 @@ void CFuncTankControls::__MAKE_VHOOK(Think)()
{
pTarget = FIND_ENTITY_BY_TARGETNAME(pTarget, STRING(pev->target));
}
while (!FNullEnt(pTarget) && Q_strncmp(STRING(pTarget->v.classname), "func_tank", 9));
while (!FNullEnt(pTarget) && Q_strncmp(STRING(pTarget->v.classname), "func_tank", 9) != 0);
if (FNullEnt(pTarget))
{
@ -931,7 +891,6 @@ void CFuncTankControls::__MAKE_VHOOK(Think)()
m_pTank = static_cast<CFuncTank *>(Instance(pTarget));
}
/* <8d373> ../cstrike/dlls/func_tank.cpp:1030 */
void CFuncTankControls::__MAKE_VHOOK(Spawn)()
{
pev->solid = SOLID_TRIGGER;

View File

@ -48,7 +48,6 @@ enum TANKBULLET
TANK_BULLET_12MM, // explosion?
};
/* <8c75e> ../cstrike/dlls/func_tank.cpp:46 */
class CFuncTank: public CBaseEntity
{
public:
@ -78,7 +77,7 @@ public:
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
void Fire_(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker);
#endif // HOOK_GAMEDLL
#endif
public:
void TrackTarget();
@ -157,7 +156,6 @@ protected:
int m_iszMaster; // Master entity (game_team_master or multisource)
};
/* <8c79a> ../cstrike/dlls/func_tank.cpp:719 */
class CFuncTankGun: public CFuncTank
{
public:
@ -167,11 +165,10 @@ public:
void Fire_(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker);
#endif // HOOK_GAMEDLL
#endif
};
/* <8c7e8> ../cstrike/dlls/func_tank.cpp:768 */
class CFuncTankLaser: public CFuncTank
{
public:
@ -191,7 +188,7 @@ public:
void Think_();
void Fire_(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker);
#endif // HOOK_GAMEDLL
#endif
CLaser *GetLaser();
@ -203,7 +200,6 @@ private:
float m_laserTime;
};
/* <8c836> ../cstrike/dlls/func_tank.cpp:887 */
class CFuncTankRocket: public CFuncTank
{
public:
@ -215,11 +211,10 @@ public:
void Precache_();
void Fire_(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker);
#endif // HOOK_GAMEDLL
#endif
};
/* <8c884> ../cstrike/dlls/func_tank.cpp:924 */
class CFuncTankMortar: public CFuncTank
{
public:
@ -231,11 +226,10 @@ public:
void KeyValue_(KeyValueData *pkvd);
void Fire_(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker);
#endif // HOOK_GAMEDLL
#endif
};
/* <8c8d2> ../cstrike/dlls/func_tank.cpp:974 */
class CFuncTankControls: public CBaseEntity
{
public:
@ -254,7 +248,7 @@ public:
void Think_();
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
public:
static TYPEDESCRIPTION IMPL(m_SaveData)[1];

View File

@ -111,11 +111,8 @@ void GameDLL_Version_f()
CONSOLE_ECHO("ReGameDLL API version %i.%i\n", REGAMEDLL_API_VERSION_MAJOR, REGAMEDLL_API_VERSION_MINOR);
}
/* <9c900> ../cstrike/dlls/game.cpp:500 */
void EXT_FUNC GameDLLInit()
{
g_bIsCzeroGame = UTIL_IsGame("czero");
g_psv_gravity = CVAR_GET_POINTER("sv_gravity");
g_psv_aim = CVAR_GET_POINTER("sv_aim");
g_footsteps = CVAR_GET_POINTER("mp_footsteps");
@ -163,6 +160,7 @@ void EXT_FUNC GameDLLInit()
// Remove unused cvars
#ifndef REGAMEDLL_FIXES
CVAR_REGISTER(&sk_plr_9mm_bullet1);
CVAR_REGISTER(&sk_plr_9mm_bullet2);
CVAR_REGISTER(&sk_plr_9mm_bullet3);
@ -205,6 +203,7 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&sk_scientist_heal1);
CVAR_REGISTER(&sk_scientist_heal2);
CVAR_REGISTER(&sk_scientist_heal3);
#endif // REGAMEDLL_FIXES
#ifdef REGAMEDLL_ADD

View File

@ -136,7 +136,7 @@ extern cvar_t sk_scientist_heal3;
extern cvar_t maxmoney;
extern cvar_t round_infinite;
#endif // REGAMEDLL_ADD
#endif
void GameDLLInit();

View File

@ -5,11 +5,10 @@
*/
#ifndef HOOK_GAMEDLL
CHalfLifeMultiplay *g_pGameRules = NULL;
CGameRules *g_pGameRules = NULL;
#endif //HOOK_GAMEDLL
#endif
/* <ad93d> ../cstrike/dlls/gamerules.cpp:36 */
BOOL CGameRules::__MAKE_VHOOK(CanHaveAmmo)(CBasePlayer *pPlayer, const char *pszAmmoName, int iMaxCarry)
{
int iAmmoIndex;
@ -31,7 +30,6 @@ BOOL CGameRules::__MAKE_VHOOK(CanHaveAmmo)(CBasePlayer *pPlayer, const char *psz
return FALSE;
}
/* <ad89d> ../cstrike/dlls/gamerules.cpp:59 */
edict_t *CGameRules::__MAKE_VHOOK(GetPlayerSpawnSpot)(CBasePlayer *pPlayer)
{
// gat valid spawn point
@ -39,23 +37,22 @@ edict_t *CGameRules::__MAKE_VHOOK(GetPlayerSpawnSpot)(CBasePlayer *pPlayer)
// Move the player to the place it said.
#ifndef PLAY_GAMEDLL
pPlayer->pev->origin = VARS(pentSpawnSpot)->origin + Vector(0, 0, 1);
pPlayer->pev->origin = pentSpawnSpot->v.origin + Vector(0, 0, 1);
#else
// TODO: fix test demo
pPlayer->pev->origin = VARS(pentSpawnSpot)->origin;
pPlayer->pev->origin = pentSpawnSpot->v.origin;
pPlayer->pev->origin.z += 1;
#endif // PLAY_GAMEDLL
#endif
pPlayer->pev->v_angle = g_vecZero;
pPlayer->pev->velocity = g_vecZero;
pPlayer->pev->angles = VARS(pentSpawnSpot)->angles;
pPlayer->pev->angles = pentSpawnSpot->v.angles;
pPlayer->pev->punchangle = g_vecZero;
pPlayer->pev->fixangle = 1;
return pentSpawnSpot;
}
/* <ad9a3> ../cstrike/dlls/gamerules.cpp:75 */
BOOL CGameRules::__MAKE_VHOOK(CanHavePlayerItem)(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon)
{
// only living players can have items
@ -64,9 +61,7 @@ BOOL CGameRules::__MAKE_VHOOK(CanHavePlayerItem)(CBasePlayer *pPlayer, CBasePlay
return FALSE;
}
CCSBotManager *ctrl = TheCSBots();
if (pPlayer->IsBot() && ctrl != NULL && !ctrl->IsWeaponUseable(pWeapon))
if (pPlayer->IsBot() && TheCSBots() != NULL && !TheCSBots()->IsWeaponUseable(pWeapon))
{
return FALSE;
}
@ -96,10 +91,9 @@ BOOL CGameRules::__MAKE_VHOOK(CanHavePlayerItem)(CBasePlayer *pPlayer, CBasePlay
return TRUE;
}
/* <ad85d> ../cstrike/dlls/gamerules.cpp:119 */
void CGameRules::__MAKE_VHOOK(RefreshSkillData)()
{
int iSkill = (int)CVAR_GET_FLOAT("skill");
int iSkill = int(CVAR_GET_FLOAT("skill"));
if (iSkill < 1)
iSkill = 1;
@ -119,7 +113,6 @@ void CGameRules::__MAKE_VHOOK(RefreshSkillData)()
gSkillData.healthkitCapacity = 15;
}
/* <ada23> ../cstrike/dlls/gamerules.cpp:157 */
CGameRules *InstallGameRules()
{
SERVER_COMMAND("exec game.cfg\n");

View File

@ -128,6 +128,8 @@ enum RewardAccount
REWARD_KILLED_VIP = 2500,
REWARD_VIP_HAVE_SELF_RESCUED = 2500,
REWARD_TAKEN_HOSTAGE = 1000
};
// custom enum
@ -185,7 +187,6 @@ enum
class CItem;
/* <166901> ../cstrike/dlls/gamerules.h:86 */
class CGameRules
{
public:
@ -262,7 +263,7 @@ public:
BOOL CanHavePlayerItem_(CBasePlayer *pPlayer, CBasePlayerItem *pItem);
BOOL CanHaveAmmo_(CBasePlayer *pPlayer, const char *pszAmmoName, int iMaxCarry);
#endif // HOOK_GAMEDLL
#endif
public:
BOOL m_bFreezePeriod;
@ -416,9 +417,9 @@ public:
virtual int DeadPlayerAmmo(CBasePlayer *pPlayer);
virtual const char *GetTeamID(CBaseEntity *pEntity) { return ""; }
virtual int PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget);
virtual BOOL PlayTextureSounds() { return FALSE;}
virtual BOOL PlayTextureSounds() { return FALSE; }
virtual BOOL FAllowMonsters();
virtual void EndMultiplayerGame() { GoToIntermission();}
virtual void EndMultiplayerGame() { GoToIntermission(); }
virtual void ServerDeactivate();
virtual void CheckMapConditions();
@ -536,7 +537,7 @@ public:
void CareerRestart();
bool ShouldSkipSpawn() const { return m_bSkipSpawn; }
void MarkSpawnSkipped() { m_bSkipSpawn = false; }
NOXREF void PlayerJoinedTeam(CBasePlayer *pPlayer) { }
void PlayerJoinedTeam(CBasePlayer *pPlayer) { }
float TimeRemaining() { return m_iRoundTimeSecs - gpGlobals->time + m_fRoundCount; }
BOOL TeamFull(int team_id);
BOOL TeamStacked(int newTeam_id, int curTeam_id);
@ -627,7 +628,7 @@ public:
int m_iTotalArmourCount;
int m_iUnBalancedRounds; // keeps track of the # of consecutive rounds that have gone by where one team outnumbers the other team by more than 2
int m_iNumEscapeRounds; // keeps track of the # of consecutive rounds of escape played.. Teams will be swapped after 8 rounds
int m_iMapVotes[ MAX_VOTE_MAPS ];
int m_iMapVotes[MAX_VOTE_MAPS];
int m_iLastPick;
int m_iMaxMapTime;
int m_iMaxRounds;
@ -638,7 +639,7 @@ public:
float m_flForceChaseCamValue;
float m_flFadeToBlackValue;
CBasePlayer *m_pVIP;
CBasePlayer *VIPQueue[ MAX_VIP_QUEUES ];
CBasePlayer *VIPQueue[MAX_VIP_QUEUES];
protected:
float m_flIntermissionEndTime;
@ -671,7 +672,6 @@ typedef struct mapcycle_s
} mapcycle_t;
/* <11192b> ../cstrike/dlls/multiplay_gamerules.cpp:257 */
class CMapInfo: public CPointEntity
{
public:
@ -683,14 +683,13 @@ public:
void Spawn_();
void KeyValue_(KeyValueData *pkvd);
#endif // HOOK_GAMEDLL
#endif
public:
int m_iBuyingStatus;
float m_flBombRadius;
};
/* <111732> ../cstrike/dlls/multiplay_gamerules.cpp:292 */
class CCStrikeGameMgrHelper: public IVoiceGameMgrHelper
{
public:
@ -700,14 +699,19 @@ public:
bool CanPlayerHearPlayer_(CBasePlayer *pListener, CBasePlayer *pSender);
#endif // HOOK_GAMEDLL
#endif
};
extern CHalfLifeMultiplay *g_pGameRules;
extern CGameRules *g_pGameRules;
CGameRules *InstallGameRules();
inline CHalfLifeMultiplay *CSGameRules()
{
return reinterpret_cast<CHalfLifeMultiplay *>(g_pGameRules);
}
bool IsBotSpeaking();
void SV_Continue_f();
void SV_Tutor_Toggle_f();

View File

@ -24,12 +24,10 @@ TYPEDESCRIPTION CGrenade::m_SaveData[] =
DEFINE_FIELD(CGrenade, m_usEvent, FIELD_INTEGER),
};
#endif // HOOK_GAMEDLL
#endif
/* <b8dad> ../cstrike/dlls/ggrenade.cpp:52 */
LINK_ENTITY_TO_CLASS(grenade, CGrenade);
/* <b8e83> ../cstrike/dlls/ggrenade.cpp:60 */
void CGrenade::Explode(Vector vecSrc, Vector vecAim)
{
TraceResult tr;
@ -38,8 +36,6 @@ void CGrenade::Explode(Vector vecSrc, Vector vecAim)
}
// UNDONE: temporary scorching for PreAlpha - find a less sleazy permenant solution.
/* <b8f35> ../cstrike/dlls/ggrenade.cpp:69 */
void CGrenade::Explode(TraceResult *pTrace, int bitsDamageType)
{
float flRndSound; // sound randomizer
@ -57,11 +53,7 @@ void CGrenade::Explode(TraceResult *pTrace, int bitsDamageType)
int iContents = UTIL_PointContents(pev->origin);
CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3);
entvars_t *pevOwner;
if (pev->owner)
pevOwner = VARS(pev->owner);
else
pevOwner = NULL;
entvars_t *pevOwner = VARS(pev->owner);
if (TheBots != NULL)
{
@ -101,11 +93,9 @@ void CGrenade::Explode(TraceResult *pTrace, int bitsDamageType)
}
}
/* <b9159> ../cstrike/dlls/ggrenade.cpp:186 */
void CGrenade::Explode2(TraceResult *pTrace, int bitsDamageType)
{
float flRndSound; // sound randomizer
CHalfLifeMultiplay *mp = g_pGameRules;
pev->model = iStringNull; // invisible
pev->solid = SOLID_NOT; // intangible
@ -113,9 +103,9 @@ void CGrenade::Explode2(TraceResult *pTrace, int bitsDamageType)
UTIL_ScreenShake(pTrace->vecEndPos, 25, 150, 1, 3000);
mp->m_bTargetBombed = true;
CSGameRules()->m_bTargetBombed = true;
if (mp->IsCareer())
if (CSGameRules()->IsCareer())
{
if (TheCareerTasks != NULL)
{
@ -124,7 +114,7 @@ void CGrenade::Explode2(TraceResult *pTrace, int bitsDamageType)
}
m_bJustBlew = true;
mp->CheckWinConditions();
CSGameRules()->CheckWinConditions();
// Pull out of the wall a bit
if (pTrace->flFraction != 1.0f)
@ -178,16 +168,12 @@ void CGrenade::Explode2(TraceResult *pTrace, int bitsDamageType)
EMIT_SOUND(ENT(pev), CHAN_WEAPON, "weapons/c4_explode1.wav", VOL_NORM, 0.25);
CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3);
entvars_t *pevOwner;
if (pev->owner)
pevOwner = VARS(pev->owner);
else
pevOwner = NULL;
entvars_t *pevOwner = VARS(pev->owner);
pev->owner = NULL;
RadiusDamage(pev, pevOwner, mp->m_flBombRadius, CLASS_NONE, bitsDamageType);
RadiusDamage(pev, pevOwner, CSGameRules()->m_flBombRadius, CLASS_NONE, bitsDamageType);
if (mp->IsCareer())
if (CSGameRules()->IsCareer())
{
if (TheCareerTasks != NULL)
{
@ -235,7 +221,6 @@ void CGrenade::Explode2(TraceResult *pTrace, int bitsDamageType)
}
}
/* <b94f3> ../cstrike/dlls/ggrenade.cpp:330 */
void CGrenade::Explode3(TraceResult *pTrace, int bitsDamageType)
{
float flRndSound; // sound randomizer
@ -274,11 +259,7 @@ void CGrenade::Explode3(TraceResult *pTrace, int bitsDamageType)
CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3);
entvars_t *pevOwner;
if (pev->owner)
pevOwner = VARS(pev->owner);
else
pevOwner = NULL;
entvars_t *pevOwner = VARS(pev->owner);
if (TheBots != NULL)
{
@ -313,7 +294,6 @@ void CGrenade::Explode3(TraceResult *pTrace, int bitsDamageType)
Create("spark_shower", pev->origin, pTrace->vecPlaneNormal, NULL);
}
/* <b97af> ../cstrike/dlls/ggrenade.cpp:420 */
NOXREF void CGrenade::SG_Explode(TraceResult *pTrace, int bitsDamageType)
{
float flRndSound; // sound randomizer
@ -363,7 +343,6 @@ NOXREF void CGrenade::SG_Explode(TraceResult *pTrace, int bitsDamageType)
}
}
/* <b6c26> ../cstrike/dlls/ggrenade.cpp:475 */
void CGrenade::Smoke3_C()
{
if (UTIL_PointContents(pev->origin) == CONTENTS_WATER)
@ -386,7 +365,6 @@ void CGrenade::Smoke3_C()
UTIL_Remove(this);
}
/* <b995d> ../cstrike/dlls/ggrenade.cpp:497 */
void CGrenade::Smoke3_B()
{
if (UTIL_PointContents(pev->origin) == CONTENTS_WATER)
@ -406,11 +384,10 @@ void CGrenade::Smoke3_B()
MESSAGE_END();
}
pev->nextthink = gpGlobals->time + 0.15;
pev->nextthink = gpGlobals->time + 0.15f;
SetThink(&CGrenade::Smoke3_A);
}
/* <b6b2a> ../cstrike/dlls/ggrenade.cpp:520 */
void CGrenade::Smoke3_A()
{
if (UTIL_PointContents(pev->origin) == CONTENTS_WATER)
@ -431,7 +408,6 @@ void CGrenade::Smoke3_A()
}
}
/* <b6a2e> ../cstrike/dlls/ggrenade.cpp:544 */
void CGrenade::Smoke2()
{
if (UTIL_PointContents(pev->origin) == CONTENTS_WATER)
@ -454,7 +430,6 @@ void CGrenade::Smoke2()
UTIL_Remove(this);
}
/* <b6932> ../cstrike/dlls/ggrenade.cpp:567 */
void CGrenade::Smoke()
{
if (UTIL_PointContents(pev->origin) == CONTENTS_WATER)
@ -477,7 +452,6 @@ void CGrenade::Smoke()
UTIL_Remove(this);
}
/* <b6d22> ../cstrike/dlls/ggrenade.cpp:591 */
void CGrenade::SG_Smoke()
{
int iMaxSmokePuffs = 100;
@ -496,12 +470,12 @@ void CGrenade::SG_Smoke()
origin = gpGlobals->v_forward * RANDOM_FLOAT(3, 8);
flSmokeInterval = RANDOM_FLOAT(1.5, 3.5) * iMaxSmokePuffs;
flSmokeInterval = RANDOM_FLOAT(1.5f, 3.5f) * iMaxSmokePuffs;
R_angle = m_angle / (180.00433335 / M_PI);
x_old = cos((float_precision)R_angle);
y_old = sin((float_precision)R_angle);
x_old = Q_cos(float_precision(R_angle));
y_old = Q_sin(float_precision(R_angle));
angle.x = origin.x * x_old - origin.y * y_old;
angle.y = origin.x * y_old + origin.y * x_old;
@ -529,22 +503,18 @@ void CGrenade::SG_Smoke()
}
}
/* <b8467> ../cstrike/dlls/ggrenade.cpp:664 */
void CGrenade::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib)
{
Detonate();
}
// Timed grenade, this think is called when time runs out.
/* <b9a59> ../cstrike/dlls/ggrenade.cpp:671 */
void CGrenade::DetonateUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
SetThink(&CGrenade::Detonate);
pev->nextthink = gpGlobals->time;
}
/* <b9abf> ../cstrike/dlls/ggrenade.cpp:677 */
void CGrenade::PreDetonate()
{
CSoundEnt::InsertSound(bits_SOUND_DANGER, pev->origin, 400, 0.3);
@ -553,7 +523,6 @@ void CGrenade::PreDetonate()
pev->nextthink = gpGlobals->time + 1.0f;
}
/* <b789e> ../cstrike/dlls/ggrenade.cpp:686 */
void CGrenade::Detonate()
{
TraceResult tr;
@ -564,7 +533,6 @@ void CGrenade::Detonate()
Explode(&tr, DMG_BLAST);
}
/* <b7355> ../cstrike/dlls/ggrenade.cpp:698 */
void CGrenade::SG_Detonate()
{
TraceResult tr;
@ -590,9 +558,8 @@ void CGrenade::SG_Detonate()
CBaseEntity *pEnt = CBaseEntity::Instance(pentFind);
if (pEnt)
if (pEnt != NULL)
{
//float_precision
float fDistance = (pEnt->pev->origin - pev->origin).Length();
if (fDistance != 0.0f && fDistance <= 250.0f)
@ -617,7 +584,6 @@ void CGrenade::SG_Detonate()
SetThink(&CGrenade::SG_Smoke);
}
/* <b8009> ../cstrike/dlls/ggrenade.cpp:752 */
void CGrenade::Detonate2()
{
TraceResult tr;
@ -629,7 +595,6 @@ void CGrenade::Detonate2()
Explode2(&tr, DMG_BLAST);
}
/* <b7c81> ../cstrike/dlls/ggrenade.cpp:764 */
void CGrenade::Detonate3()
{
TraceResult tr;
@ -641,8 +606,6 @@ void CGrenade::Detonate3()
}
// Contact grenade, explode when it touches something
/* <b7956> ../cstrike/dlls/ggrenade.cpp:780 */
void CGrenade::ExplodeTouch(CBaseEntity *pOther)
{
TraceResult tr;
@ -655,7 +618,6 @@ void CGrenade::ExplodeTouch(CBaseEntity *pOther)
Explode(&tr, DMG_BLAST);
}
/* <b7101> ../cstrike/dlls/ggrenade.cpp:794 */
void CGrenade::DangerSoundThink()
{
if (!IsInWorld())
@ -673,7 +635,6 @@ void CGrenade::DangerSoundThink()
}
}
/* <b7209> ../cstrike/dlls/ggrenade.cpp:812 */
void CGrenade::BounceTouch(CBaseEntity *pOther)
{
// don't hit the guy that launched this grenade
@ -740,7 +701,6 @@ void CGrenade::BounceTouch(CBaseEntity *pOther)
}
}
/* <b9ae7> ../cstrike/dlls/ggrenade.cpp:880 */
void CGrenade::SlideTouch(CBaseEntity *pOther)
{
// don't hit the guy that launched this grenade
@ -758,7 +718,6 @@ void CGrenade::SlideTouch(CBaseEntity *pOther)
}
}
/* <b7b20> ../cstrike/dlls/ggrenade.cpp:904 */
void CGrenade::__MAKE_VHOOK(BounceSound)()
{
if (pev->dmg > 50.0f)
@ -775,7 +734,6 @@ void CGrenade::__MAKE_VHOOK(BounceSound)()
}
}
/* <b6f28> ../cstrike/dlls/ggrenade.cpp:919 */
void CGrenade::TumbleThink()
{
if (!IsInWorld())
@ -809,7 +767,6 @@ void CGrenade::TumbleThink()
}
}
/* <b67e7> ../cstrike/dlls/ggrenade.cpp:949 */
void CGrenade::SG_TumbleThink()
{
if (!IsInWorld())
@ -846,19 +803,12 @@ void CGrenade::SG_TumbleThink()
}
}
/* <b7010> ../cstrike/dlls/ggrenade.cpp:985 */
void CGrenade::__MAKE_VHOOK(Spawn)()
{
m_iBounceCount = 0;
pev->movetype = MOVETYPE_BOUNCE;
if (pev->classname)
{
RemoveEntityHashValue(pev, STRING(pev->classname), CLASSNAME);
}
MAKE_STRING_CLASS("grenade", pev);
AddEntityHashValue(pev, STRING(pev->classname), CLASSNAME);
m_bIsC4 = false;
pev->solid = SOLID_BBOX;
@ -870,7 +820,6 @@ void CGrenade::__MAKE_VHOOK(Spawn)()
m_fRegisteredSound = FALSE;
}
/* <b9b56> ../cstrike/dlls/ggrenade.cpp:1000 */
NOXREF CGrenade *CGrenade::ShootContact(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity)
{
CGrenade *pGrenade = GetClassPtr((CGrenade *)NULL);
@ -899,7 +848,6 @@ NOXREF CGrenade *CGrenade::ShootContact(entvars_t *pevOwner, Vector vecStart, Ve
return pGrenade;
}
/* <b9c69> ../cstrike/dlls/ggrenade.cpp:1028 */
CGrenade *CGrenade::ShootTimed2(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, int iTeam, unsigned short usEvent)
{
CGrenade *pGrenade = GetClassPtr((CGrenade *)NULL);
@ -934,7 +882,6 @@ CGrenade *CGrenade::ShootTimed2(entvars_t *pevOwner, Vector vecStart, Vector vec
return pGrenade;
}
/* <b9dd0> ../cstrike/dlls/ggrenade.cpp:1069 */
CGrenade *CGrenade::ShootTimed(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time)
{
CGrenade *pGrenade = GetClassPtr((CGrenade *)NULL);
@ -976,7 +923,6 @@ CGrenade *CGrenade::ShootTimed(entvars_t *pevOwner, Vector vecStart, Vector vecV
return pGrenade;
}
/* <ba5be> ../cstrike/dlls/ggrenade.cpp:1113 */
void CGrenade::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
if (!m_bIsC4)
@ -1004,7 +950,7 @@ void CGrenade::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller,
TheBots->OnEvent(EVENT_BOMB_DEFUSING, pActivator);
}
if (g_pGameRules->IsCareer())
if (CSGameRules()->IsCareer())
{
if (TheCareerTasks != NULL)
{
@ -1039,7 +985,7 @@ void CGrenade::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller,
GETPLAYERUSERID(player->edict()),
GETPLAYERAUTHID(player->edict()));
// TODO show messages on clients on event
// TODO: show messages on clients on event
ClientPrint(player->pev, HUD_PRINTCENTER, "#Defusing_Bomb_Without_Defuse_Kit");
EMIT_SOUND(ENT(player->pev), CHAN_ITEM, "weapons/c4_disarm.wav", VOL_NORM, ATTN_NORM);
@ -1054,17 +1000,12 @@ void CGrenade::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller,
}
}
/* <b9eed> ../cstrike/dlls/ggrenade.cpp:1178 */
CGrenade *CGrenade::ShootSatchelCharge(entvars_t *pevOwner, Vector vecStart, Vector vecAngles)
{
CGrenade *pGrenade = GetClassPtr((CGrenade *)NULL);
pGrenade->pev->movetype = MOVETYPE_TOSS;
if (pGrenade->pev->classname)
RemoveEntityHashValue(pGrenade->pev, STRING(pGrenade->pev->classname), CLASSNAME);
MAKE_STRING_CLASS("grenade", pGrenade->pev);
AddEntityHashValue(pGrenade->pev, STRING(pGrenade->pev->classname), CLASSNAME);
pGrenade->pev->solid = SOLID_BBOX;
@ -1085,8 +1026,8 @@ CGrenade *CGrenade::ShootSatchelCharge(entvars_t *pevOwner, Vector vecStart, Vec
pGrenade->pev->spawnflags = SF_DETONATE;
pGrenade->pev->nextthink = gpGlobals->time + 0.1f;
pGrenade->m_flC4Blow = gpGlobals->time + g_pGameRules->m_iC4Timer;
pGrenade->m_flNextFreqInterval = (g_pGameRules->m_iC4Timer / 4);
pGrenade->m_flC4Blow = gpGlobals->time + CSGameRules()->m_iC4Timer;
pGrenade->m_flNextFreqInterval = float(CSGameRules()->m_iC4Timer / 4);
pGrenade->m_flNextFreq = gpGlobals->time;
pGrenade->m_iCurWave = 0;
@ -1113,7 +1054,6 @@ CGrenade *CGrenade::ShootSatchelCharge(entvars_t *pevOwner, Vector vecStart, Vec
return pGrenade;
}
/* <ba122> ../cstrike/dlls/ggrenade.cpp:1238 */
CGrenade *CGrenade::ShootSmokeGrenade(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, unsigned short usEvent)
{
CGrenade *pGrenade = GetClassPtr((CGrenade *)NULL);
@ -1150,7 +1090,6 @@ CGrenade *CGrenade::ShootSmokeGrenade(entvars_t *pevOwner, Vector vecStart, Vect
return pGrenade;
}
/* <b5701> ../cstrike/dlls/ggrenade.cpp:1284 */
void AnnounceFlashInterval(float interval, float offset)
{
if (!g_bIsCzeroGame)
@ -1160,12 +1099,11 @@ void AnnounceFlashInterval(float interval, float offset)
WRITE_BYTE(1);
WRITE_STRING("bombticking");
WRITE_BYTE(255);
WRITE_SHORT((int)interval); // interval
WRITE_SHORT((int)offset);
WRITE_SHORT(int(interval)); // interval
WRITE_SHORT(int(offset));
MESSAGE_END();
}
/* <b855a> ../cstrike/dlls/ggrenade.cpp:1300 */
void CGrenade::C4Think()
{
if (!IsInWorld())
@ -1358,7 +1296,7 @@ void CGrenade::C4Think()
WRITE_BYTE(0);
MESSAGE_END();
if (g_pGameRules->IsCareer() && !pPlayer->IsBot())
if (CSGameRules()->IsCareer() && !pPlayer->IsBot())
{
if (TheCareerTasks != NULL)
{
@ -1366,8 +1304,8 @@ void CGrenade::C4Think()
}
}
g_pGameRules->m_bBombDefused = true;
g_pGameRules->CheckWinConditions();
CSGameRules()->m_bBombDefused = true;
CSGameRules()->CheckWinConditions();
// give the defuser credit for defusing the bomb
m_pBombDefuser->pev->frags += 3.0f;
@ -1398,33 +1336,29 @@ void CGrenade::C4Think()
}
}
/* <b67b1> ../cstrike/dlls/ggrenade.cpp:1523 */
void CGrenade::C4Touch(CBaseEntity *pOther)
{
;
}
/* <ba24f> ../cstrike/dlls/ggrenade.cpp:1528 */
NOXREF void CGrenade::UseSatchelCharges(entvars_t *pevOwner, SATCHELCODE code)
{
edict_t *pentFind;
edict_t *pentOwner;
if (!pevOwner)
return;
edict_t *pentFind = NULL;
CBaseEntity *pOwner = CBaseEntity::Instance(pevOwner);
pentOwner = pOwner->edict();
pentFind = FIND_ENTITY_BY_CLASSNAME(NULL, "grenade");
while (!FNullEnt(pentFind))
while ((pentFind = FIND_ENTITY_BY_CLASSNAME(pentFind, "grenade")) != NULL)
{
if (FNullEnt(pentFind))
break;
CBaseEntity *pEnt = Instance(pentFind);
if (pEnt != NULL)
{
if ((pEnt->pev->spawnflags & SF_DETONATE) && pEnt->pev->owner == pentOwner)
if ((pEnt->pev->spawnflags & SF_DETONATE) && pEnt->pev->owner == pOwner->edict())
{
if (code == SATCHEL_DETONATE)
pEnt->Use(pOwner, pOwner, USE_ON, 0);
@ -1435,9 +1369,7 @@ NOXREF void CGrenade::UseSatchelCharges(entvars_t *pevOwner, SATCHELCODE code)
}
}
}
pentFind = FIND_ENTITY_BY_CLASSNAME(pentFind, "grenade");
}
}
/* <b6ed7> ../cstrike/dlls/ggrenade.cpp:1579 */
IMPLEMENT_SAVERESTORE(CGrenade, CBaseMonster);

View File

@ -6,15 +6,17 @@
#ifndef HOOK_GAMEDLL
const Vector g_vecZero = Vector(0, 0, 0);
u_long g_ulFrameCount = 0;
NOXREF u_long g_ulFrameCount = 0;
#endif // HOOK_GAMEDLL
#endif
int g_Language;
u_long g_ulModelIndexEyes;
NOXREF u_long g_ulModelIndexEyes;
Vector g_vecAttackDir;
int g_iSkillLevel;
int gDisplayTitle;
BOOL g_fGameOver;
bool g_bIsCzeroGame = false;
bool g_bAllowedCSBot = false;
bool g_bHostageImprov = false;

View File

@ -35,13 +35,15 @@
extern const Vector g_vecZero;
extern int g_Language;
extern NOXREF u_long g_ulFrameCount;
extern NOXREF u_long g_ulModelIndexEyes;
extern u_long g_ulFrameCount;
extern u_long g_ulModelIndexEyes;
extern Vector g_vecAttackDir;
extern int g_iSkillLevel;
extern int gDisplayTitle;
extern BOOL g_fGameOver;
extern bool g_bIsCzeroGame;
extern bool g_bAllowedCSBot;
extern bool g_bHostageImprov;
#endif // GLOBALS_H

View File

@ -2,7 +2,6 @@
BOOL g_fDrawLines = FALSE;
/* <c08f4> ../cstrike/dlls/h_ai.cpp:47 */
NOXREF BOOL FBoxVisible(entvars_t *pevLooker, entvars_t *pevTarget, Vector &vecTargetOrigin, float flSize)
{
// don't look through water
@ -41,8 +40,6 @@ NOXREF BOOL FBoxVisible(entvars_t *pevLooker, entvars_t *pevTarget, Vector &vecT
// VecCheckToss - returns the velocity at which an object should be lobbed from vecspot1 to land near vecspot2.
// returns g_vecZero if toss is not feasible.
/* <c0a19> ../cstrike/dlls/h_ai.cpp:78 */
NOXREF Vector VecCheckToss(entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flGravityAdj)
{
TraceResult tr;
@ -71,8 +68,8 @@ NOXREF Vector VecCheckToss(entvars_t *pev, const Vector &vecSpot1, Vector vecSpo
// How much time does it take to get there?
// get a rough idea of how high it can be thrown
vecMidPoint = vecSpot1 + (vecSpot2 - vecSpot1) * 0.5;
UTIL_TraceLine(vecMidPoint, vecMidPoint + Vector(0,0,500), ignore_monsters, ENT(pev), &tr);
vecMidPoint = vecSpot1 + (vecSpot2 - vecSpot1) * 0.5f;
UTIL_TraceLine(vecMidPoint, vecMidPoint + Vector(0, 0, 500), ignore_monsters, ENT(pev), &tr);
vecMidPoint = tr.vecEndPos;
// (subtract 15 so the grenade doesn't hit the ceiling)
@ -89,10 +86,10 @@ NOXREF Vector VecCheckToss(entvars_t *pev, const Vector &vecSpot1, Vector vecSpo
float distance2 = (vecMidPoint.z - vecSpot2.z);
// How long will it take for the grenade to travel this distance
float time1 = sqrt(distance1 / (0.5 * flGravity));
float time2 = sqrt(distance2 / (0.5 * flGravity));
float time1 = Q_sqrt(distance1 / (0.5f * flGravity));
float time2 = Q_sqrt(distance2 / (0.5f * flGravity));
if (time1 < 0.1)
if (time1 < 0.1f)
{
// too close
return g_vecZero;
@ -128,8 +125,6 @@ NOXREF Vector VecCheckToss(entvars_t *pev, const Vector &vecSpot1, Vector vecSpo
// VecCheckThrow - returns the velocity vector at which an object should be thrown from vecspot1 to hit vecspot2.
// returns g_vecZero if throw is not feasible.
/* <c0d21> ../cstrike/dlls/h_ai.cpp:164 */
NOXREF Vector VecCheckThrow(entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flSpeed, float flGravityAdj)
{
float flGravity = g_psv_gravity->value * flGravityAdj;
@ -138,13 +133,13 @@ NOXREF Vector VecCheckThrow(entvars_t *pev, const Vector &vecSpot1, Vector vecSp
// throw at a constant time
float time = vecGrenadeVel.Length() / flSpeed;
vecGrenadeVel = vecGrenadeVel * (1.0 / time);
vecGrenadeVel = vecGrenadeVel * (1.0f / time);
// adjust upward toss to compensate for gravity loss
vecGrenadeVel.z += flGravity * time * 0.5;
vecGrenadeVel.z += flGravity * time * 0.5f;
Vector vecApex = vecSpot1 + (vecSpot2 - vecSpot1) * 0.5;
vecApex.z += 0.5 * flGravity * (time * 0.5) * (time * 0.5);
Vector vecApex = vecSpot1 + (vecSpot2 - vecSpot1) * 0.5f;
vecApex.z += 0.5f * flGravity * (time * 0.5f) * (time * 0.5f);
TraceResult tr;
UTIL_TraceLine(vecSpot1, vecApex, dont_ignore_monsters, ENT(pev), &tr);

View File

@ -35,8 +35,8 @@
#define NUM_LATERAL_CHECKS 13 // how many checks are made on each side of a monster looking for lateral cover
#define NUM_LATERAL_LOS_CHECKS 6 // how many checks are made on each side of a monster looking for lateral cover
NOXREF BOOL FBoxVisible(entvars_t *pevLooker, entvars_t *pevTarget, Vector &vecTargetOrigin, float flSize);
NOXREF Vector VecCheckToss(entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flGravityAdj);
NOXREF Vector VecCheckThrow(entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flSpeed, float flGravityAdj);
BOOL FBoxVisible(entvars_t *pevLooker, entvars_t *pevTarget, Vector &vecTargetOrigin, float flSize);
Vector VecCheckToss(entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flGravityAdj);
Vector VecCheckThrow(entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flSpeed, float flGravityAdj);
#endif // H_AI_H

View File

@ -14,15 +14,11 @@ TYPEDESCRIPTION CRecharge::m_SaveData[] =
DEFINE_FIELD(CRecharge, m_flSoundTime, FIELD_TIME),
};
#endif // HOOK_GAMEDLL
#endif
/* <c61e2> ../cstrike/dlls/h_battery.cpp:61 */
IMPLEMENT_SAVERESTORE(CRecharge, CBaseEntity);
/* <c65cc> ../cstrike/dlls/h_battery.cpp:63 */
LINK_ENTITY_TO_CLASS(func_recharge, CRecharge);
/* <c648b> ../cstrike/dlls/h_battery.cpp:66 */
void CRecharge::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "style")
@ -42,7 +38,6 @@ void CRecharge::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CBaseToggle::KeyValue(pkvd);
}
/* <c616f> ../cstrike/dlls/h_battery.cpp:85 */
void CRecharge::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -55,11 +50,10 @@ void CRecharge::__MAKE_VHOOK(Spawn)()
UTIL_SetSize(pev, pev->mins, pev->maxs);
SET_MODEL(ENT(pev), STRING(pev->model));
m_iJuice = (int)gSkillData.suitchargerCapacity;
m_iJuice = int(gSkillData.suitchargerCapacity);
pev->frame = 0;
}
/* <c6122> ../cstrike/dlls/h_battery.cpp:99 */
void CRecharge::__MAKE_VHOOK(Precache)()
{
PRECACHE_SOUND("items/suitcharge1.wav");
@ -67,7 +61,6 @@ void CRecharge::__MAKE_VHOOK(Precache)()
PRECACHE_SOUND("items/suitchargeok1.wav");
}
/* <c630e> ../cstrike/dlls/h_battery.cpp:107 */
void CRecharge::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
// if it's not a player, ignore
@ -138,7 +131,6 @@ void CRecharge::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller,
m_flNextCharge = gpGlobals->time + 0.1f;
}
/* <c6149> ../cstrike/dlls/h_battery.cpp:178 */
void CRecharge::Recharge()
{
m_iJuice = gSkillData.suitchargerCapacity;
@ -146,7 +138,6 @@ void CRecharge::Recharge()
SetThink(&CRecharge::SUB_DoNothing);
}
/* <c622e> ../cstrike/dlls/h_battery.cpp:185 */
void CRecharge::Off()
{
// Stop looping sound.

View File

@ -52,7 +52,7 @@ public:
int Restore_(CRestore &restore);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
public:
void EXPORT Off();

View File

@ -22,24 +22,18 @@ TYPEDESCRIPTION CWreckage::m_SaveData[] =
DEFINE_FIELD(CWreckage, m_flStartTime, FIELD_TIME),
};
#endif // HOOK_GAMEDLL
#endif
/* <cce5f> ../cstrike/dlls/h_cycler.cpp:61 */
IMPLEMENT_SAVERESTORE(CCycler, CBaseToggle);
/* <cd01f> ../cstrike/dlls/h_cycler.cpp:70 */
void CGenericCycler::__MAKE_VHOOK(Spawn)()
{
GenericCyclerSpawn((char *)STRING(pev->model), Vector(-16, -16, 0), Vector(16, 16, 72));
}
/* <cd2d2> ../cstrike/dlls/h_cycler.cpp:72 */
LINK_ENTITY_TO_CLASS(cycler, CGenericCycler);
/* <cd39c> ../cstrike/dlls/h_cycler.cpp:85 */
LINK_ENTITY_TO_CLASS(cycler_prdroid, CCyclerProbe);
/* <cd16d> ../cstrike/dlls/h_cycler.cpp:86 */
void CCyclerProbe::__MAKE_VHOOK(Spawn)()
{
pev->origin = pev->origin + Vector(0, 0, 16);
@ -47,8 +41,6 @@ void CCyclerProbe::__MAKE_VHOOK(Spawn)()
}
// Cycler member functions
/* <cd466> ../cstrike/dlls/h_cycler.cpp:96 */
void CCycler::GenericCyclerSpawn(char *szModel, Vector vecMin, Vector vecMax)
{
if (!szModel || !szModel[0])
@ -58,13 +50,7 @@ void CCycler::GenericCyclerSpawn(char *szModel, Vector vecMin, Vector vecMax)
return;
}
if (pev->classname)
{
RemoveEntityHashValue(pev, STRING(pev->classname), CLASSNAME);
}
MAKE_STRING_CLASS("cycler", pev);
AddEntityHashValue(pev, STRING(pev->classname), CLASSNAME);
PRECACHE_MODEL(szModel);
SET_MODEL(ENT(pev), szModel);
@ -74,7 +60,6 @@ void CCycler::GenericCyclerSpawn(char *szModel, Vector vecMin, Vector vecMax)
UTIL_SetSize(pev, vecMin, vecMax);
}
/* <ccc91> ../cstrike/dlls/h_cycler.cpp:115 */
void CCycler::__MAKE_VHOOK(Spawn)()
{
InitBoneControllers();
@ -110,8 +95,6 @@ void CCycler::__MAKE_VHOOK(Spawn)()
}
// cycler think
/* <ccd3e> ../cstrike/dlls/h_cycler.cpp:151 */
void CCycler::__MAKE_VHOOK(Think)()
{
pev->nextthink = gpGlobals->time + 0.1f;
@ -140,8 +123,6 @@ void CCycler::__MAKE_VHOOK(Think)()
}
// CyclerUse - starts a rotation trend
/* <cc8bf> ../cstrike/dlls/h_cycler.cpp:176 */
void CCycler::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
m_animate = !m_animate;
@ -153,8 +134,6 @@ void CCycler::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, U
}
// CyclerPain , changes sequences when shot
/* <ccf43> ../cstrike/dlls/h_cycler.cpp:189 */
int CCycler::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
if (m_animate)
@ -182,13 +161,9 @@ int CCycler::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAtt
return 0;
}
/* <cd4f8> ../cstrike/dlls/h_cycler.cpp:246 */
LINK_ENTITY_TO_CLASS(cycler_sprite, CCyclerSprite);
/* <ccef7> ../cstrike/dlls/h_cycler.cpp:255 */
IMPLEMENT_SAVERESTORE(CCyclerSprite, CBaseEntity);
/* <cc943> ../cstrike/dlls/h_cycler.cpp:258 */
void CCyclerSprite::__MAKE_VHOOK(Spawn)()
{
pev->solid = SOLID_SLIDEBOX;
@ -204,19 +179,14 @@ void CCyclerSprite::__MAKE_VHOOK(Spawn)()
PRECACHE_MODEL((char *)STRING(pev->model));
SET_MODEL(ENT(pev), STRING(pev->model));
m_maxFrame = (float)MODEL_FRAMES(pev->modelindex) - 1;
m_maxFrame = float(MODEL_FRAMES(pev->modelindex) - 1);
m_renderfx = pev->renderfx;
m_rendermode = pev->rendermode;
m_renderamt = pev->renderamt;
for (int i = 0; i < ARRAYSIZE(pev->rendercolor); ++i)
{
pev->rendercolor[i] = m_rendercolor[i];
}
m_rendercolor = pev->rendercolor;
}
/* <cc982> ../cstrike/dlls/h_cycler.cpp:284 */
void CCyclerSprite::__MAKE_VHOOK(Restart)()
{
pev->solid = SOLID_SLIDEBOX;
@ -232,14 +202,9 @@ void CCyclerSprite::__MAKE_VHOOK(Restart)()
pev->renderfx = m_renderfx;
pev->rendermode = m_rendermode;
pev->renderamt = m_renderamt;
for (int i = 0; i < ARRAYSIZE(pev->rendercolor); ++i)
{
pev->rendercolor[i] = m_rendercolor[i];
}
pev->rendercolor = m_rendercolor;
}
/* <cd0ef> ../cstrike/dlls/h_cycler.cpp:305 */
void CCyclerSprite::__MAKE_VHOOK(Think)()
{
if (ShouldAnimate())
@ -251,14 +216,12 @@ void CCyclerSprite::__MAKE_VHOOK(Think)()
m_lastTime = gpGlobals->time;
}
/* <cc9c1> ../cstrike/dlls/h_cycler.cpp:315 */
void CCyclerSprite::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
m_animate = !m_animate;
ALERT(at_console, "Sprite: %s\n", STRING(pev->model));
}
/* <cd228> ../cstrike/dlls/h_cycler.cpp:322 */
int CCyclerSprite::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
if (m_maxFrame > 1.0)
@ -269,21 +232,18 @@ int CCyclerSprite::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *
return 1;
}
/* <cd5c2> ../cstrike/dlls/h_cycler.cpp:331 */
void CCyclerSprite::Animate(float frames)
{
pev->frame += frames;
if (m_maxFrame > 0)
{
pev->frame = fmod((float_precision)pev->frame, (float_precision)m_maxFrame);
pev->frame = Q_fmod(float_precision(pev->frame), float_precision(m_maxFrame));
}
}
/* <cd610> ../cstrike/dlls/h_cycler.cpp:358 */
LINK_ENTITY_TO_CLASS(cycler_weapon, CWeaponCycler);
/* <ccbf6> ../cstrike/dlls/h_cycler.cpp:361 */
void CWeaponCycler::__MAKE_VHOOK(Spawn)()
{
pev->solid = SOLID_SLIDEBOX;
@ -300,7 +260,6 @@ void CWeaponCycler::__MAKE_VHOOK(Spawn)()
SetTouch(&CWeaponCycler::DefaultTouch);
}
/* <cca7c> ../cstrike/dlls/h_cycler.cpp:378 */
BOOL CWeaponCycler::__MAKE_VHOOK(Deploy)()
{
m_pPlayer->pev->viewmodel = m_iszModel;
@ -312,20 +271,17 @@ BOOL CWeaponCycler::__MAKE_VHOOK(Deploy)()
return TRUE;
}
/* <ccaa3> ../cstrike/dlls/h_cycler.cpp:388 */
void CWeaponCycler::__MAKE_VHOOK(Holster)(int skiplocal)
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;
}
/* <ccad8> ../cstrike/dlls/h_cycler.cpp:394 */
void CWeaponCycler::__MAKE_VHOOK(PrimaryAttack)()
{
SendWeaponAnim(pev->sequence);
m_flNextPrimaryAttack = gpGlobals->time + 0.3f;
}
/* <ccb97> ../cstrike/dlls/h_cycler.cpp:403 */
void CWeaponCycler::__MAKE_VHOOK(SecondaryAttack)()
{
float flFrameRate, flGroundSpeed;
@ -346,13 +302,9 @@ void CWeaponCycler::__MAKE_VHOOK(SecondaryAttack)()
m_flNextSecondaryAttack = gpGlobals->time + 0.3f;
}
/* <cce12> ../cstrike/dlls/h_cycler.cpp:443 */
IMPLEMENT_SAVERESTORE(CWreckage, CBaseToggle);
/* <cd6dd> ../cstrike/dlls/h_cycler.cpp:446 */
LINK_ENTITY_TO_CLASS(cycler_wreckage, CWreckage);
/* <ccaff> ../cstrike/dlls/h_cycler.cpp:448 */
void CWreckage::__MAKE_VHOOK(Spawn)()
{
pev->solid = SOLID_NOT;
@ -370,10 +322,9 @@ void CWreckage::__MAKE_VHOOK(Spawn)()
}
// pev->scale = 5.0;
m_flStartTime = (int)gpGlobals->time;
m_flStartTime = int(gpGlobals->time);
}
/* <ccd07> ../cstrike/dlls/h_cycler.cpp:468 */
void CWreckage::__MAKE_VHOOK(Precache)()
{
if (!FStringNull(pev->model))
@ -382,7 +333,6 @@ void CWreckage::__MAKE_VHOOK(Precache)()
}
}
/* <ccb26> ../cstrike/dlls/h_cycler.cpp:474 */
void CWreckage::__MAKE_VHOOK(Think)()
{
StudioFrameAdvance();

View File

@ -32,7 +32,6 @@
#pragma once
#endif
/* <cb93c> ../cstrike/dlls/h_cycler.cpp:35 */
class CCycler: public CBaseMonster
{
public:
@ -56,7 +55,7 @@ public:
void Think_();
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
public:
void GenericCyclerSpawn(char *szModel, Vector vecMin, Vector vecMax);
@ -68,8 +67,6 @@ public:
};
// we should get rid of all the other cyclers and replace them with this.
/* <cb9b2> ../cstrike/dlls/h_cycler.cpp:67 */
class CGenericCycler: public CCycler
{
public:
@ -79,13 +76,11 @@ public:
void Spawn_();
#endif // HOOK_GAMEDLL
#endif
};
// Probe droid imported for tech demo compatibility
/* <cba04> ../cstrike/dlls/h_cycler.cpp:80 */
class CCyclerProbe: public CCycler
{
public:
@ -95,11 +90,10 @@ public:
void Spawn_();
#endif // HOOK_GAMEDLL
#endif
};
/* <cba56> ../cstrike/dlls/h_cycler.cpp:218 */
class CCyclerSprite: public CBaseEntity
{
public:
@ -122,7 +116,7 @@ public:
void Think_();
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
public:
void Animate(float frames);
@ -140,7 +134,6 @@ public:
vec3_t m_rendercolor;
};
/* <cbbc0> ../cstrike/dlls/h_cycler.cpp:344 */
class CWeaponCycler: public CBasePlayerWeapon
{
public:
@ -160,7 +153,7 @@ public:
void PrimaryAttack_();
void SecondaryAttack_();
#endif // HOOK_GAMEDLL
#endif
public:
int m_iszModel;
@ -168,8 +161,6 @@ public:
};
// Flaming Wreakage
/* <cbc13> ../cstrike/dlls/h_cycler.cpp:427 */
class CWreckage: public CBaseMonster
{
public:
@ -187,7 +178,7 @@ public:
int Restore_(CRestore &restore);
void Think_();
#endif // HOOK_GAMEDLL
#endif
public:
static TYPEDESCRIPTION IMPL(m_SaveData)[1];

View File

@ -7,15 +7,10 @@ globalvars_t *gpGlobals;
// Receive engine function table from engine.
// This appears to be the _first_ DLL routine called by the engine, so we
// do some setup operations here.
/* <d0737> ../cstrike/dlls/h_export.cpp:58 */
C_DLLEXPORT void WINAPI GiveFnptrsToDll(enginefuncs_t *pEnginefuncsTable, globalvars_t *pGlobals)
{
Q_memcpy(&g_engfuncs, pEnginefuncsTable, sizeof(enginefuncs_t));
gpGlobals = pGlobals;
#if defined(HOOK_GAMEDLL) && !defined(REGAMEDLL_UNIT_TESTS)
Regamedll_Game_Init();
#endif // HOOK_GAMEDLL
}

View File

@ -14,12 +14,10 @@ TYPEDESCRIPTION CWallHealth::m_SaveData[] =
DEFINE_FIELD(CWallHealth, m_flSoundTime, FIELD_TIME),
};
#endif // HOOK_GAMEDLL
#endif
/* <d637a> ../cstrike/dlls/healthkit.cpp:43 */
LINK_ENTITY_TO_CLASS(item_healthkit, CHealthKit);
/* <d5e25> ../cstrike/dlls/healthkit.cpp:55 */
void CHealthKit::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -28,14 +26,12 @@ void CHealthKit::__MAKE_VHOOK(Spawn)()
CItem::Spawn();
}
/* <d5d8a> ../cstrike/dlls/healthkit.cpp:63 */
void CHealthKit::__MAKE_VHOOK(Precache)()
{
PRECACHE_MODEL("models/w_medkit.mdl");
PRECACHE_SOUND("items/smallmedkit1.wav");
}
/* <d5fb9> ../cstrike/dlls/healthkit.cpp:69 */
BOOL CHealthKit::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
{
if (pPlayer->TakeHealth(gSkillData.healthkitCapacity, DMG_GENERIC))
@ -57,13 +53,9 @@ BOOL CHealthKit::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
return FALSE;
}
/* <d5e98> ../cstrike/dlls/healthkit.cpp:130 */
IMPLEMENT_SAVERESTORE(CWallHealth, CBaseEntity);
/* <d6444> ../cstrike/dlls/healthkit.cpp:132 */
LINK_ENTITY_TO_CLASS(func_healthcharger, CWallHealth);
/* <d60ed> ../cstrike/dlls/healthkit.cpp:135 */
void CWallHealth::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "style") || FStrEq(pkvd->szKeyName, "height") || FStrEq(pkvd->szKeyName, "value1") || FStrEq(pkvd->szKeyName, "value2") || FStrEq(pkvd->szKeyName, "value3"))
@ -79,7 +71,6 @@ void CWallHealth::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CBaseToggle::KeyValue(pkvd);
}
/* <d5dfe> ../cstrike/dlls/healthkit.cpp:154 */
void CWallHealth::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -93,11 +84,10 @@ void CWallHealth::__MAKE_VHOOK(Spawn)()
SET_MODEL(ENT(pev), STRING(pev->model));
m_iJuice = (int)gSkillData.healthchargerCapacity;
m_iJuice = int(gSkillData.healthchargerCapacity);
pev->frame = 0.0f;
}
/* <d5dd7> ../cstrike/dlls/healthkit.cpp:169 */
void CWallHealth::__MAKE_VHOOK(Precache)()
{
PRECACHE_SOUND("items/medshot4.wav");
@ -105,7 +95,6 @@ void CWallHealth::__MAKE_VHOOK(Precache)()
PRECACHE_SOUND("items/medcharge4.wav");
}
/* <d622e> ../cstrike/dlls/healthkit.cpp:177 */
void CWallHealth::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
// Make sure that we have a caller
@ -163,7 +152,6 @@ void CWallHealth::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCalle
m_flNextCharge = gpGlobals->time + 0.1f;
}
/* <d5f4d> ../cstrike/dlls/healthkit.cpp:236 */
void CWallHealth::Recharge()
{
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/medshot4.wav", VOL_NORM, ATTN_NORM);
@ -172,7 +160,6 @@ void CWallHealth::Recharge()
SetThink(&CWallHealth::SUB_DoNothing);
}
/* <d5ee4> ../cstrike/dlls/healthkit.cpp:244 */
void CWallHealth::Off()
{
// Stop looping sound.

View File

@ -32,7 +32,6 @@
#pragma once
#endif
/* <d521a> ../cstrike/dlls/healthkit.cpp:27 */
class CHealthKit: public CItem
{
public:
@ -46,11 +45,10 @@ public:
void Precache_();
BOOL MyTouch_(CBasePlayer *pPlayer);
#endif // HOOK_GAMEDLL
#endif
};
/* <d5342> ../cstrike/dlls/healthkit.cpp:99 */
class CWallHealth: public CBaseToggle
{
public:
@ -71,7 +69,7 @@ public:
int Restore_(CRestore &restore);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
public:
void EXPORT Off();

View File

@ -1,6 +1,5 @@
#include "precompiled.h"
/* <dbc23> ../cstrike/dlls/hintmessage.cpp:11 */
CHintMessage::CHintMessage(const char *hintString, bool isHint, CUtlVector<const char *> *args, float duration)
{
m_hintString = hintString;
@ -14,22 +13,19 @@ CHintMessage::CHintMessage(const char *hintString, bool isHint, CUtlVector<const
}
}
/* <db621> ../cstrike/dlls/hintmessage.cpp:27 */
CHintMessage::~CHintMessage()
{
for (int i = 0; i < m_args.Count(); ++i)
delete [] m_args[i];
delete[] m_args[i];
m_args.RemoveAll();
}
/* <db723> ../cstrike/dlls/hintmessage.cpp:37 */
void CHintMessage::Send(CBaseEntity *client)
{
UTIL_ShowMessageArgs(m_hintString, client, &m_args, m_isHint);
}
/* <db74d> ../cstrike/dlls/hintmessage.cpp:43 */
void CHintMessageQueue::Reset()
{
m_tmMessageEnd = 0;
@ -40,7 +36,6 @@ void CHintMessageQueue::Reset()
m_messages.RemoveAll();
}
/* <db866> ../cstrike/dlls/hintmessage.cpp:54 */
void CHintMessageQueue::Update(CBaseEntity *client)
{
if (gpGlobals->time <= m_tmMessageEnd)
@ -56,7 +51,6 @@ void CHintMessageQueue::Update(CBaseEntity *client)
m_messages.Remove(0);
}
/* <dbec2> ../cstrike/dlls/hintmessage.cpp:70 */
bool CHintMessageQueue::AddMessage(const char *message, float duration, bool isHint, CUtlVector<const char *> *args)
{
CHintMessage *msg = new CHintMessage(message, isHint, args, duration);

View File

@ -11,15 +11,11 @@ cvar_t cv_hostage_stop = { "hostage_stop", "0", FCVAR_SERVER, 0.0f, NULL };
CHostageManager *g_pHostages = NULL;
int g_iHostageNumber = 0;
#endif // HOOK_GAMEDLL
#endif
/* <45c3fa> ../cstrike/dlls/hostage/hostage.cpp:47 */
LINK_ENTITY_TO_CLASS(hostage_entity, CHostage);
/* <45c4d3> ../cstrike/dlls/hostage/hostage.cpp:48 */
LINK_ENTITY_TO_CLASS(monster_scientist, CHostage);
/* <45c228> ../cstrike/dlls/hostage/hostage.cpp:54 */
void CHostage::__MAKE_VHOOK(Spawn)()
{
if (!g_pHostages)
@ -29,13 +25,7 @@ void CHostage::__MAKE_VHOOK(Spawn)()
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;
@ -76,12 +66,12 @@ void CHostage::__MAKE_VHOOK(Spawn)()
DROP_TO_FLOOR(edict());
#ifdef HOOK_GAMEDLL
#ifndef HOOK_GAMEDLL
SetThink(&CHostage::IdleThink);
#else
// TODO: fix test demo
SetThink(pCHostage__IdleThink);
#else
SetThink(&CHostage::IdleThink);
#endif // HOOK_GAMEDLL
#endif
pev->nextthink = gpGlobals->time + RANDOM_FLOAT(0.1, 0.2);
@ -96,7 +86,7 @@ void CHostage::__MAKE_VHOOK(Spawn)()
m_flLastPathCheck = -1;
m_flPathAcquired = -1;
m_flPathCheckInterval = 0.1;
m_flPathCheckInterval = 0.1f;
m_flNextRadarTime = gpGlobals->time + RANDOM_FLOAT(0, 1);
m_LocalNav = new CLocalNav(this);
@ -105,7 +95,6 @@ void CHostage::__MAKE_VHOOK(Spawn)()
m_improv = NULL;
}
/* <45bf91> ../cstrike/dlls/hostage/hostage.cpp:137 */
void CHostage::__MAKE_VHOOK(Precache)()
{
static int which = 0;
@ -153,14 +142,13 @@ void CHostage::__MAKE_VHOOK(Precache)()
PRECACHE_MODEL("sprites/smoke.spr");
}
/* <45c5ac> ../cstrike/dlls/hostage/hostage.cpp:179 */
void CHostage::SetActivity(int act)
{
if (m_Activity != act)
{
int sequence = LookupActivity(act);
if (sequence != -1)
if (sequence != ACT_INVALID)
{
if (pev->sequence != sequence)
{
@ -178,7 +166,6 @@ void CHostage::SetActivity(int act)
}
}
/* <45f194> ../cstrike/dlls/hostage/hostage.cpp:204 */
void CHostage::IdleThink()
{
float flInterval;
@ -186,15 +173,11 @@ void CHostage::IdleThink()
const float giveUpTime = (1 / 30.0f);
float const updateRate = 0.1f;
if (!TheNavAreaList.empty())
if (AreImprovAllowed() && !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
@ -202,14 +185,13 @@ void CHostage::IdleThink()
if (m_improv != NULL)
{
delete m_improv;
}
m_improv = NULL;
}
}
pev->nextthink = gpGlobals->time + giveUpTime;
flInterval = StudioFrameAdvance(0);
flInterval = StudioFrameAdvance();
DispatchAnimEvents(flInterval);
if (m_improv != NULL)
@ -222,7 +204,7 @@ void CHostage::IdleThink()
return;
}
m_flNextFullThink = gpGlobals->time + 0.1;
m_flNextFullThink = gpGlobals->time + 0.1f;
if (pev->deadflag == DEAD_DEAD)
{
@ -251,19 +233,17 @@ void CHostage::IdleThink()
if (player == NULL || player->m_iTeam == CT)
{
if (!g_pGameRules->m_bMapHasRescueZone)
if (!CSGameRules()->m_bMapHasRescueZone)
{
BOOL bContinue = FALSE;
BOOL bResHostagePt = FALSE;
bool bResHostagePt = false;
if (UTIL_FindEntityByClassname(NULL, "info_hostage_rescue"))
bResHostagePt = TRUE;
bResHostagePt = true;
CBaseEntity *pSpot = NULL;
while ((pSpot = UTIL_FindEntityByClassname(pSpot, "info_hostage_rescue")) != NULL)
{
if ((pSpot->pev->origin - pev->origin).Length() < 256)
if ((pSpot->pev->origin - pev->origin).Length() < RESCUE_HOSTAGES_RADIUS)
{
m_bRescueMe = TRUE;
break;
@ -276,7 +256,7 @@ void CHostage::IdleThink()
while ((pSpot = UTIL_FindEntityByClassname(pSpot, "info_player_start")) != NULL)
{
if ((pSpot->pev->origin - pev->origin).Length() < 256)
if ((pSpot->pev->origin - pev->origin).Length() < RESCUE_HOSTAGES_RADIUS)
{
m_bRescueMe = TRUE;
break;
@ -292,7 +272,7 @@ void CHostage::IdleThink()
TheBots->OnEvent(EVENT_HOSTAGE_RESCUED, player, this);
}
if (TheCareerTasks != NULL && g_pGameRules->IsCareer() && player != NULL && !player->IsBot())
if (TheCareerTasks != NULL && CSGameRules()->IsCareer() && player != NULL && !player->IsBot())
{
TheCareerTasks->HandleEvent(EVENT_HOSTAGE_RESCUED, player);
}
@ -301,7 +281,7 @@ void CHostage::IdleThink()
if (player != NULL)
{
player->AddAccount(1000);
player->AddAccount(REWARD_TAKEN_HOSTAGE);
UTIL_LogPrintf("\"%s<%i><%s><CT>\" triggered \"Rescued_A_Hostage\"\n", STRING(player->pev->netname),
GETPLAYERUSERID(player->edict()), GETPLAYERAUTHID(player->edict()));
}
@ -319,8 +299,8 @@ void CHostage::IdleThink()
pev->effects |= EF_NODRAW;
Remove();
g_pGameRules->m_iHostagesRescued++;
g_pGameRules->CheckWinConditions();
CSGameRules()->m_iHostagesRescued++;
CSGameRules()->CheckWinConditions();
Broadcast((player != NULL) ? "rescued" : "escaped");
}
@ -337,11 +317,11 @@ void CHostage::IdleThink()
if (gpGlobals->time >= m_flFlinchTime)
{
if (pev->velocity.Length() > 160)
if (pev->velocity.Length() > 160.0f)
{
SetActivity(ACT_RUN);
}
else if (pev->velocity.Length() > 15)
else if (pev->velocity.Length() > 15.0f)
{
SetActivity(ACT_WALK);
}
@ -358,22 +338,21 @@ void CHostage::IdleThink()
{
Vector vDistance = m_vOldPos - pev->origin;
if (vDistance.Length() > 1)
if (vDistance.Length() > 1.0f)
{
m_vOldPos = pev->origin;
if (!g_pGameRules->m_fTeamCount)
if (!CSGameRules()->m_fTeamCount)
{
SendHostagePositionMsg();
}
}
m_flNextRadarTime = gpGlobals->time + 1;
m_flNextRadarTime = gpGlobals->time + 1.0f;
}
}
}
/* <45c041> ../cstrike/dlls/hostage/hostage.cpp:413 */
void CHostage::Remove()
{
pev->movetype = MOVETYPE_NONE;
@ -385,7 +364,6 @@ void CHostage::Remove()
m_flNextFullThink = -1;
}
/* <45c624> ../cstrike/dlls/hostage/hostage.cpp:426 */
void CHostage::RePosition()
{
pev->health = pev->max_health;
@ -412,13 +390,12 @@ void CHostage::RePosition()
DROP_TO_FLOOR(edict());
SetActivity(ACT_IDLE);
#ifdef HOOK_GAMEDLL
#ifndef HOOK_GAMEDLL
SetThink(&CHostage::IdleThink);
#else
// TODO: fix test demo
SetThink(pCHostage__IdleThink);
#else
SetThink(&CHostage::IdleThink);
#endif // HOOK_GAMEDLL
#endif
pev->nextthink = gpGlobals->time + RANDOM_FLOAT(0.1, 0.2);
m_fHasPath = FALSE;
@ -430,7 +407,6 @@ void CHostage::RePosition()
m_flNextFullThink = gpGlobals->time + RANDOM_FLOAT(0.1, 0.2);
}
/* <45ee7f> ../cstrike/dlls/hostage/hostage.cpp:469 */
int CHostage::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
float flActualDamage;
@ -470,14 +446,14 @@ int CHostage::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAt
}
}
if (pev->health > 0)
if (pev->health > 0.0f)
{
m_flFlinchTime = gpGlobals->time + 0.75;
m_flFlinchTime = gpGlobals->time + 0.75f;
SetFlinchActivity();
if (pAttacker != NULL)
{
pAttacker->AddAccount(-20 * (unsigned __int64)(signed __int64)flActualDamage);
pAttacker->AddAccount(-20 * int(flActualDamage));
if (TheBots != NULL)
{
@ -503,7 +479,7 @@ int CHostage::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAt
if (pAttacker != NULL)
{
pAttacker->AddAccount(20 * (-25 - (unsigned __int64)(signed __int64)flActualDamage));
pAttacker->AddAccount(20 * (-25 - int(flActualDamage)));
AnnounceDeath(pAttacker);
ApplyHostagePenalty(pAttacker);
}
@ -522,19 +498,18 @@ int CHostage::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAt
m_improv->Chatter(HOSTAGE_CHATTER_DEATH_CRY);
}
g_pGameRules->CheckWinConditions();
CSGameRules()->CheckWinConditions();
if (!g_pGameRules->m_fTeamCount)
if (!CSGameRules()->m_fTeamCount)
SendHostageEventMsg();
pev->nextthink = gpGlobals->time + 3;
pev->nextthink = gpGlobals->time + 3.0f;
SetThink(&CHostage::Remove);
}
return 0;
}
/* <45c783> ../cstrike/dlls/hostage/hostage.cpp:578 */
float CHostage::GetModifiedDamage(float flDamage, int nHitGroup)
{
switch (nHitGroup)
@ -553,7 +528,6 @@ float CHostage::GetModifiedDamage(float flDamage, int nHitGroup)
return flDamage;
}
/* <45c7d3> ../cstrike/dlls/hostage/hostage.cpp:597 */
void CHostage::PlayPainSound()
{
if (m_LastHitGroup != HITGROUP_HEAD)
@ -566,7 +540,6 @@ void CHostage::PlayPainSound()
}
}
/* <45c8c4> ../cstrike/dlls/hostage/hostage.cpp:612 */
void CHostage::SetFlinchActivity()
{
Activity activity = ACT_SMALL_FLINCH;
@ -580,7 +553,6 @@ void CHostage::SetFlinchActivity()
SetActivity(activity);
}
/* <45c960> ../cstrike/dlls/hostage/hostage.cpp:642 */
void CHostage::SetDeathActivity()
{
if (m_improv != NULL && m_improv->IsCrouching())
@ -636,7 +608,6 @@ void CHostage::SetDeathActivity()
}
}
/* <45cc41> ../cstrike/dlls/hostage/hostage.cpp:684 */
void CHostage::AnnounceDeath(CBasePlayer *pAttacker)
{
ClientPrint(pAttacker->pev, HUD_PRINTCENTER, "#Killed_Hostage");
@ -664,13 +635,12 @@ void CHostage::AnnounceDeath(CBasePlayer *pAttacker)
MESSAGE_END();
}
/* <45cd6b> ../cstrike/dlls/hostage/hostage.cpp:717 */
void CHostage::ApplyHostagePenalty(CBasePlayer *pAttacker)
{
if (pAttacker->m_iTeam != TERRORIST)
return;
int iHostagePenalty = (int)CVAR_GET_FLOAT("mp_hostagepenalty");
int iHostagePenalty = int(CVAR_GET_FLOAT("mp_hostagepenalty"));
if (iHostagePenalty)
{
@ -684,12 +654,11 @@ void CHostage::ApplyHostagePenalty(CBasePlayer *pAttacker)
SERVER_COMMAND(UTIL_VarArgs("kick #%d\n", GETPLAYERUSERID(pAttacker->edict())));
#else
CLIENT_COMMAND(pAttacker->edict(), "disconnect\n");
#endif // REGAMEDLL_FIXES
#endif
}
}
}
/* <45cfd6> ../cstrike/dlls/hostage/hostage.cpp:740 */
void CHostage::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
if (!pActivator->IsPlayer())
@ -713,7 +682,7 @@ void CHostage::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller,
if (gpGlobals->time >= m_flNextChange)
{
m_flNextChange = gpGlobals->time + 1;
m_flNextChange = gpGlobals->time + 1.0f;
if (m_improv != NULL)
{
@ -767,7 +736,6 @@ void CHostage::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller,
}
}
/* <45cdba> ../cstrike/dlls/hostage/hostage.cpp:833 */
void CHostage::PlayFollowRescueSound()
{
switch (RANDOM_LONG(0, 4))
@ -780,26 +748,23 @@ void CHostage::PlayFollowRescueSound()
}
}
/* <45d1ff> ../cstrike/dlls/hostage/hostage.cpp:851 */
void CHostage::GiveCTTouchBonus(CBasePlayer *pPlayer)
{
if (m_bTouched)
return;
m_bTouched = TRUE;
g_pGameRules->m_iAccountCT += 100;
CSGameRules()->m_iAccountCT += 100;
pPlayer->AddAccount(150);
UTIL_LogPrintf("\"%s<%i><%s><CT>\" triggered \"Touched_A_Hostage\"\n", STRING(pPlayer->pev->netname), GETPLAYERUSERID(pPlayer->edict()), GETPLAYERAUTHID(pPlayer->edict()));
}
/* <45bf69> ../cstrike/dlls/hostage/hostage.cpp:869 */
int CHostage::__MAKE_VHOOK(ObjectCaps)()
{
return (CBaseMonster::ObjectCaps() | FCAP_MUST_SPAWN | FCAP_ONOFF_USE);
}
/* <45c0e3> ../cstrike/dlls/hostage/hostage.cpp:876 */
void CHostage::__MAKE_VHOOK(Touch)(CBaseEntity *pOther)
{
Vector2D vPush;
@ -834,10 +799,9 @@ void CHostage::__MAKE_VHOOK(Touch)(CBaseEntity *pOther)
#else
// TODO: fix test demo
pev->velocity = pev->velocity + NormalizeMulScalar<float_precision, float_precision, float>(vPush, pushForce);
#endif // PLAY_GAMEDLL
#endif
}
/* <45dd66> ../cstrike/dlls/hostage/hostage.cpp:910 */
void CHostage::DoFollow()
{
CBaseEntity *pFollowing;
@ -848,7 +812,7 @@ void CHostage::DoFollow()
if (m_hTargetEnt == NULL)
return;
if (cv_hostage_stop.value > 0.0)
if (cv_hostage_stop.value > 0.0f)
{
m_State = STAND;
m_hTargetEnt = NULL;
@ -863,14 +827,14 @@ void CHostage::DoFollow()
vecDest.z += pFollowing->pev->mins.z;
flDistToDest = (vecDest - pev->origin).Length();
if (flDistToDest < 80 && (m_fHasPath || m_LocalNav->PathTraversable(pev->origin, vecDest, TRUE)))
if (flDistToDest < 80.0f && (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)
if (!m_fHasPath || pFollowing->pev->velocity.Length2D() > 1.0f)
{
m_flLastPathCheck = gpGlobals->time;
m_LocalNav->RequestNav(this);
@ -912,7 +876,7 @@ void CHostage::DoFollow()
{
if (IsFollowingSomeone())
{
if (!m_bStuck && flDistToDest > 200)
if (!m_bStuck && flDistToDest > 200.0f)
{
m_bStuck = TRUE;
m_flStuckTime = gpGlobals->time;
@ -932,7 +896,6 @@ void CHostage::DoFollow()
}
}
/* <45d278> ../cstrike/dlls/hostage/hostage.cpp:1018 */
void CHostage::PointAt(const Vector &vecLoc)
{
pev->angles.x = 0;
@ -940,7 +903,6 @@ void CHostage::PointAt(const Vector &vecLoc)
pev->angles.z = 0;
}
/* <45d34c> ../cstrike/dlls/hostage/hostage.cpp:1025 */
void CHostage::MoveToward(const Vector &vecLoc)
{
int nFwdMove;
@ -988,7 +950,7 @@ void CHostage::MoveToward(const Vector &vecLoc)
pev->velocity.x = vecFwd.x * flSpeed;
pev->velocity.y = vecFwd.y * flSpeed;
if (nFwdMove != PATH_TRAVERSABLE_STEP && nFwdMove == PATH_TRAVERSABLE_STEPJUMPABLE)
if (nFwdMove == PATH_TRAVERSABLE_STEPJUMPABLE)
{
if (pev->flags & FL_ONGROUND)
{
@ -998,18 +960,16 @@ void CHostage::MoveToward(const Vector &vecLoc)
}
}
/* <45d704> ../cstrike/dlls/hostage/hostage.cpp:1102 */
BOOL CHostage::IsOnLadder()
{
return pev->movetype == MOVETYPE_FLY;
}
/* <45d727> ../cstrike/dlls/hostage/hostage.cpp:1106 */
void CHostage::NavReady()
{
CBaseEntity *pFollowing;
Vector vecDest;
float flRadius = 40.0;
float flRadius = 40.0f;
if (!m_hTargetEnt)
{
@ -1041,7 +1001,7 @@ void CHostage::NavReady()
{
if (!m_fHasPath)
{
m_flPathCheckInterval += 0.1;
m_flPathCheckInterval += 0.1f;
if (m_flPathCheckInterval >= 0.5f)
{
@ -1054,13 +1014,12 @@ void CHostage::NavReady()
m_fHasPath = TRUE;
nTargetNode = -1;
m_flPathAcquired = gpGlobals->time;
m_flPathCheckInterval = 0.5;
m_flPathCheckInterval = 0.5f;
m_nPathNodes = m_LocalNav->SetupPathNodes(nindexPath, vecNodes, 1);
}
}
/* <45edaa> ../cstrike/dlls/hostage/hostage.cpp:1159 */
void CHostage::SendHostagePositionMsg()
{
CBaseEntity *pEntity = NULL;
@ -1091,7 +1050,6 @@ void CHostage::SendHostagePositionMsg()
}
}
/* <45ecd5> ../cstrike/dlls/hostage/hostage.cpp:1189 */
void CHostage::SendHostageEventMsg()
{
CBaseEntity *pEntity = NULL;
@ -1121,7 +1079,6 @@ void CHostage::SendHostageEventMsg()
}
}
/* <45d8a6> ../cstrike/dlls/hostage/hostage.cpp:1292 */
void CHostage::Wiggle()
{
TraceResult tr;
@ -1155,12 +1112,11 @@ void CHostage::Wiggle()
vec.y = vec.y + RANDOM_FLOAT(-3.0, 3.0);
vec.x = vec.x + RANDOM_FLOAT(-3.0, 3.0);
#endif // PLAY_GAMEDLL
#endif
pev->velocity = pev->velocity + (vec.Normalize() * 100);
}
/* <45e00c> ../cstrike/dlls/hostage/hostage.cpp:1346 */
void CHostage::PreThink()
{
Vector vecSrc;
@ -1193,14 +1149,14 @@ void CHostage::PreThink()
TRACE_MONSTER_HULL(edict(), vecSrc, vecDest, dont_ignore_monsters, edict(), &tr);
if (tr.fStartSolid || tr.flFraction == 1.0f || tr.vecPlaneNormal.z > 0.7f)
if (tr.fStartSolid || tr.flFraction == 1.0f || tr.vecPlaneNormal.z > MaxUnitZSlope)
{
return;
}
flOrigDist = (tr.vecEndPos - pev->origin).Length2D();
vecSrc.z += flInterval;
vecDest = vecSrc + (pev->velocity.Normalize() * 0.1);
vecDest = vecSrc + (pev->velocity.Normalize() * 0.1f);
vecDest.z = vecSrc.z;
TRACE_MONSTER_HULL(edict(), vecSrc, vecDest, dont_ignore_monsters, edict(), &tr);
@ -1216,7 +1172,7 @@ void CHostage::PreThink()
TRACE_MONSTER_HULL(edict(), vecSrc, vecDest, dont_ignore_monsters, edict(), &tr);
if (tr.vecPlaneNormal.z < 0.7f)
if (tr.vecPlaneNormal.z < MaxUnitZSlope)
{
return;
}
@ -1233,20 +1189,18 @@ void CHostage::PreThink()
}
}
/* <45e24e> ../cstrike/dlls/hostage/hostage.cpp:1421 */
void Hostage_RegisterCVars()
{
// These cvars are only used in czero
#ifdef REGAMEDLL_FIXES
if (!g_bIsCzeroGame)
return;
#endif // REGAMEDLL_FIXES
#endif
CVAR_REGISTER(&cv_hostage_debug);
CVAR_REGISTER(&cv_hostage_stop);
}
/* <45e2a6> ../cstrike/dlls/hostage/hostage.cpp:1430 */
void InstallHostageManager()
{
if (g_pHostages != NULL)
@ -1258,14 +1212,12 @@ void InstallHostageManager()
g_pHostages = new CHostageManager;
}
/* <45e375> ../cstrike/dlls/hostage/hostage.cpp:1443 */
CHostageManager::CHostageManager()
{
Q_memset(&m_chatter, 0, sizeof(m_chatter));
m_hostageCount = 0;
}
/* <45e39b> ../cstrike/dlls/hostage/hostage.cpp:1456 */
void CHostageManager::ServerActivate()
{
m_hostageCount = 0;
@ -1411,13 +1363,11 @@ void CHostageManager::ServerActivate()
}
}
/* <45e3a2> ../cstrike/dlls/hostage/hostage.cpp:1624 */
void CHostageManager::ServerDeactivate()
{
;
}
/* <45e3f7> ../cstrike/dlls/hostage/hostage.cpp:1631 */
void CHostageManager::RestartRound()
{
for (int i = 0; i < m_hostageCount; ++i)
@ -1429,7 +1379,6 @@ void CHostageManager::RestartRound()
}
}
/* <45e43d> ../cstrike/dlls/hostage/hostage.cpp:1640 */
void CHostageManager::AddHostage(CHostage *hostage)
{
if (m_hostageCount >= MAX_HOSTAGES)
@ -1451,7 +1400,6 @@ void CHostageManager::AddHostage(CHostage *hostage)
}
}
/* <45e47f> ../cstrike/dlls/hostage/hostage.cpp:1657 */
bool CHostageManager::IsNearbyHostageTalking(CHostageImprov *improv)
{
for (int i = 0; i < m_hostageCount; ++i)
@ -1474,7 +1422,6 @@ bool CHostageManager::IsNearbyHostageTalking(CHostageImprov *improv)
return false;
}
/* <45e57b> ../cstrike/dlls/hostage/hostage.cpp:1689 */
bool CHostageManager::IsNearbyHostageJumping(CHostageImprov *improv)
{
for (int i = 0; i < m_hostageCount; ++i)
@ -1497,7 +1444,6 @@ bool CHostageManager::IsNearbyHostageJumping(CHostageImprov *improv)
return false;
}
/* <45e642> ../cstrike/dlls/hostage/hostage.cpp:1716 */
void CHostageManager::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
{
for (int i = 0; i < m_hostageCount; ++i)
@ -1511,7 +1457,6 @@ void CHostageManager::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEnt
}
}
/* <45e6b8> ../cstrike/dlls/hostage/hostage.cpp:1726 */
SimpleChatter::SimpleChatter()
{
for (int i = 0; i < ARRAYSIZE(m_chatter); ++i)
@ -1522,22 +1467,18 @@ SimpleChatter::SimpleChatter()
}
}
/* <45e6f0> ../cstrike/dlls/hostage/hostage.cpp:1737 */
SimpleChatter::~SimpleChatter()
{
for (int i = 0; i < ARRAYSIZE(m_chatter); ++i)
{
for (int f = 0; f < m_chatter[i].count; f++)
{
if (m_chatter[i].file[f].filename != NULL)
{
delete[] m_chatter[i].file[f].filename;
}
m_chatter[i].file[f].filename = NULL;
}
}
}
/* <45e736> ../cstrike/dlls/hostage/hostage.cpp:1752 */
void SimpleChatter::AddSound(HostageChatterType type, char *filename)
{
ChatterSet *chatter;
@ -1556,7 +1497,6 @@ void SimpleChatter::AddSound(HostageChatterType type, char *filename)
PRECACHE_SOUND(filename);
}
/* <45e8c7> ../cstrike/dlls/hostage/hostage.cpp:1773 */
void SimpleChatter::Shuffle(ChatterSet *chatter)
{
if (!chatter->needsShuffle)
@ -1582,7 +1522,6 @@ void SimpleChatter::Shuffle(ChatterSet *chatter)
chatter->needsShuffle = false;
}
/* <45e979> ../cstrike/dlls/hostage/hostage.cpp:1793 */
char *SimpleChatter::GetSound(HostageChatterType type, float *duration)
{
ChatterSet *chatter = &m_chatter[type];
@ -1600,7 +1539,6 @@ char *SimpleChatter::GetSound(HostageChatterType type, float *duration)
return sound;
}
/* <45ea1b> ../cstrike/dlls/hostage/hostage.cpp:1818 */
float SimpleChatter::PlaySound(CBaseEntity *entity, HostageChatterType type)
{
CHostage *hostage;

View File

@ -39,14 +39,15 @@
#define MAX_HOSTAGES 12
#define MAX_HOSTAGES_NAV 20
#define HOSTAGE_STEPSIZE 26.0
#define HOSTAGE_STEPSIZE_DEFAULT 18.0
#define HOSTAGE_STEPSIZE 26.0f
#define HOSTAGE_STEPSIZE_DEFAULT 18.0f
#define VEC_HOSTAGE_VIEW Vector(0, 0, 12)
#define VEC_HOSTAGE_HULL_MIN Vector(-10, -10, 0)
#define VEC_HOSTAGE_HULL_MAX Vector(10, 10, 62)
#define VEC_HOSTAGE_CROUCH Vector(10, 10, 30)
#define RESCUE_HOSTAGES_RADIUS 256.0f // rescue zones from legacy info_*
class CHostage;
class CLocalNav;
@ -86,8 +87,6 @@ extern cvar_t cv_hostage_debug;
extern cvar_t cv_hostage_stop;
// A Counter-Strike Hostage Simple
/* <4858e5> ../cstrike/dlls/hostage/hostage.h:32 */
class CHostage: public CBaseMonster
{
public:
@ -109,7 +108,7 @@ public:
void Touch_(CBaseEntity *pOther);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL
#endif
public:
void EXPORT IdleThink();
@ -185,7 +184,7 @@ public:
CBasePlayer *m_target;
CLocalNav *m_LocalNav;
int nTargetNode;
Vector vecNodes[ MAX_NODES ];
Vector vecNodes[MAX_NODES];
EHANDLE m_hStoppedTargetEnt;
float m_flNextFullThink;
float m_flPathCheckInterval;
@ -224,11 +223,6 @@ public:
};
void AddSound(HostageChatterType type, char *filename);
#ifdef _WIN32
#undef PlaySound
#endif // _WIN32
float PlaySound(CBaseEntity *entity, HostageChatterType type);
char *GetSound(HostageChatterType type, float *duration);
void Shuffle(ChatterSet *chatter);
@ -237,7 +231,6 @@ private:
ChatterSet m_chatter[21];
};
/* <45b018> ../cstrike/dlls/hostage/hostage.h:247 */
class CHostageManager
{
public:
@ -282,12 +275,12 @@ public:
for (int i = 0; i < m_hostageCount; i++)
{
range = (m_hostage[ i ]->pev->origin - pos).Length();
range = (m_hostage[i]->pev->origin - pos).Length();
if (range < closeRange)
{
closeRange = range;
close = m_hostage[ i ];
close = m_hostage[i];
}
}
@ -298,11 +291,17 @@ public:
}
private:
CHostage *m_hostage[ MAX_HOSTAGES ];
CHostage *m_hostage[MAX_HOSTAGES];
int m_hostageCount;
SimpleChatter m_chatter;
};
// Determine whether hostage improv can be used or not
inline bool AreImprovAllowed()
{
return g_bHostageImprov;
}
void Hostage_RegisterCVars();
void InstallHostageManager();

View File

@ -1,6 +1,5 @@
#include "precompiled.h"
/* <4703fc> ../cstrike/dlls/hostage/hostage_improv.cpp:19 */
inline void DrawAxes(const Vector &origin, int red, int green, int blue)
{
float size = 10;
@ -13,20 +12,18 @@ inline void DrawAxes(const Vector &origin, int red, int green, int blue)
UTIL_DrawBeamPoints(origin + Vector(0, 0, size), origin - Vector(0, 0, size), 2, red, green, blue);
}
/* <47353e> ../cstrike/dlls/hostage/hostage_improv.cpp:41 */
CHostageImprov::CHostageImprov(CBaseEntity *entity)
{
m_animateState.Reset();
m_hostage = static_cast<CHostage *>(entity);
OnReset();
}
/* <470d33> ../cstrike/dlls/hostage/hostage_improv.cpp:52 */
bool CHostageImprov::__MAKE_VHOOK(IsAlive)() const
{
return m_hostage->pev->deadflag != DEAD_DEAD;
}
/* <474809> ../cstrike/dlls/hostage/hostage_improv.cpp:61 */
void CHostageImprov::__MAKE_VHOOK(MoveTo)(const Vector &goal)
{
m_moveGoal = goal;
@ -40,8 +37,6 @@ void CHostageImprov::__MAKE_VHOOK(MoveTo)(const Vector &goal)
}
// Find "simple" ground height, treating current nav area as part of the floor
/* <4717e4> ../cstrike/dlls/hostage/hostage_improv.cpp:78 */
bool CHostageImprov::__MAKE_VHOOK(GetSimpleGroundHeightWithFloor)(const Vector *pos, float *height, Vector *normal)
{
if (GetSimpleGroundHeight(pos, height, normal))
@ -57,8 +52,6 @@ bool CHostageImprov::__MAKE_VHOOK(GetSimpleGroundHeightWithFloor)(const Vector *
}
// Check if we need to jump due to height change
/* <473da4> ../cstrike/dlls/hostage/hostage_improv.cpp:96 */
bool CHostageImprov::DiscontinuityJump(float ground, bool onlyJumpDown, bool mustJump)
{
// Don't try to jump if in the air or crouching.
@ -81,33 +74,28 @@ bool CHostageImprov::DiscontinuityJump(float ground, bool onlyJumpDown, bool mus
return false;
}
/* <470d5b> ../cstrike/dlls/hostage/hostage_improv.cpp:116 */
void CHostageImprov::__MAKE_VHOOK(LookAt)(const Vector &target)
{
m_isLookingAt = true;
m_viewGoal = target;
}
/* <470d97> ../cstrike/dlls/hostage/hostage_improv.cpp:126 */
void CHostageImprov::__MAKE_VHOOK(ClearLookAt)()
{
m_isLookingAt = false;
}
/* <470dbf> ../cstrike/dlls/hostage/hostage_improv.cpp:135 */
void CHostageImprov::__MAKE_VHOOK(FaceTo)(const Vector &goal)
{
m_isFacingTo = true;
m_faceGoal = goal;
}
/* <470dfb> ../cstrike/dlls/hostage/hostage_improv.cpp:145 */
void CHostageImprov::__MAKE_VHOOK(ClearFaceTo)()
{
m_isFacingTo = false;
}
/* <476a30> ../cstrike/dlls/hostage/hostage_improv.cpp:154 */
void CHostageImprov::MoveTowards(const Vector &pos, float deltaT)
{
Vector move;
@ -122,10 +110,10 @@ void CHostageImprov::MoveTowards(const Vector &pos, float deltaT)
//
// 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())
if ((m_lastKnownArea == NULL || !(m_lastKnownArea->GetAttributes() & NAV_NO_JUMP))
&& !IsUsingLadder() && !IsJumping() && IsOnGround() && !IsCrouching())
{
float ground;
Vector aheadRay(pos.x - GetFeet().x, pos.y - GetFeet().y, 0);
@ -205,10 +193,9 @@ void CHostageImprov::MoveTowards(const Vector &pos, float deltaT)
m_vel.y = move.y * accelRate * deltaT + m_vel.y;
}
/* <473e46> ../cstrike/dlls/hostage/hostage_improv.cpp:262 */
bool CHostageImprov::FaceTowards(const Vector &target, float deltaT)
{
float error = 0;
bool bError = false;
Vector2D to = (target - GetFeet()).Make2D();
#ifndef PLAY_GAMEDLL
@ -229,7 +216,7 @@ bool CHostageImprov::FaceTowards(const Vector &target, float deltaT)
to.x = float_x / flLen;
to.y = float_y / flLen;
}
#endif // PLAY_GAMEDLL
#endif
float moveAngle = GetMoveAngle();
@ -245,12 +232,12 @@ bool CHostageImprov::FaceTowards(const Vector &target, float deltaT)
else
dot = -1.0f;
error = 1;
bError = true;
}
const float maxTurnRate = 0.05f;
if (error || fabs(dot) >= maxTurnRate)
if (bError || Q_fabs(dot) >= maxTurnRate)
{
const float tolerance = 300.0f;
float moveRatio = dot * deltaT * tolerance + moveAngle;
@ -267,7 +254,6 @@ bool CHostageImprov::FaceTowards(const Vector &target, float deltaT)
return true;
}
/* <47402b> ../cstrike/dlls/hostage/hostage_improv.cpp:308 */
void CHostageImprov::FaceOutwards()
{
TraceResult result;
@ -304,21 +290,17 @@ void CHostageImprov::FaceOutwards()
FaceTo(to);
}
/* <470e23> ../cstrike/dlls/hostage/hostage_improv.cpp:344 */
bool CHostageImprov::__MAKE_VHOOK(IsAtMoveGoal)(float error) const
{
return (GetFeet() - m_moveGoal).IsLengthLessThan(error);
}
/* <470eab> ../cstrike/dlls/hostage/hostage_improv.cpp:353 */
bool CHostageImprov::__MAKE_VHOOK(IsAtFaceGoal)() const
{
return false;
}
// Return true if a friend is between us and the given position
/* <46fb4b> ../cstrike/dlls/hostage/hostage_improv.cpp:395 */
bool CHostageImprov::__MAKE_VHOOK(IsFriendInTheWay)(const Vector &goalPos) const
{
// do this check less often to ease CPU burden
@ -367,8 +349,6 @@ bool CHostageImprov::__MAKE_VHOOK(IsFriendInTheWay)(const Vector &goalPos) const
}
// Return true if a friend is between us and the given entity
/* <472b83> ../cstrike/dlls/hostage/hostage_improv.cpp:453 */
bool CHostageImprov::__MAKE_VHOOK(IsFriendInTheWay)(CBaseEntity *myFriend, const Vector &goalPos) const
{
if (m_hostage == myFriend)
@ -412,7 +392,7 @@ bool CHostageImprov::__MAKE_VHOOK(IsFriendInTheWay)(CBaseEntity *myFriend, const
if (!myFriend->pev->velocity.IsZero())
{
if (DotProduct(myFriend->pev->velocity, m_hostage->pev->velocity) >= 0.0)
if (DotProduct(myFriend->pev->velocity, m_hostage->pev->velocity) >= 0.0f)
return false;
}
@ -420,7 +400,6 @@ bool CHostageImprov::__MAKE_VHOOK(IsFriendInTheWay)(CBaseEntity *myFriend, const
return true;
}
/* <474309> ../cstrike/dlls/hostage/hostage_improv.cpp:557 */
bool CHostageImprov::IsFriendInTheWay() const
{
CheckAhead check(this);
@ -430,13 +409,11 @@ bool CHostageImprov::IsFriendInTheWay() const
return check.IsBlocked();
}
/* <474631> ../cstrike/dlls/hostage/hostage_improv.cpp:568 */
float CHostageImprov::GetSpeed()
{
return -1.0f;
}
/* <46f249> ../cstrike/dlls/hostage/hostage_improv.cpp:592 */
bool CHostageImprov::__MAKE_VHOOK(Jump)()
{
if (IsCrouching() || g_pHostages->IsNearbyHostageJumping(this))
@ -466,19 +443,16 @@ bool CHostageImprov::__MAKE_VHOOK(Jump)()
return true;
}
/* <470ed3> ../cstrike/dlls/hostage/hostage_improv.cpp:632 */
void CHostageImprov::__MAKE_VHOOK(Run)()
{
m_moveType = m_moveLimit;
}
/* <470efb> ../cstrike/dlls/hostage/hostage_improv.cpp:638 */
void CHostageImprov::__MAKE_VHOOK(Walk)()
{
m_moveType = (m_moveLimit > Walking) ? Walking : m_moveLimit;
}
/* <470f23> ../cstrike/dlls/hostage/hostage_improv.cpp:644 */
void CHostageImprov::__MAKE_VHOOK(Stop)()
{
MoveTo(GetFeet());
@ -490,40 +464,34 @@ void CHostageImprov::__MAKE_VHOOK(Stop)()
m_moveType = m_moveLimit;
}
/* <470f4c> ../cstrike/dlls/hostage/hostage_improv.cpp:655 */
const Vector &CHostageImprov::__MAKE_VHOOK(GetFeet)() const
{
return m_hostage->pev->origin;
}
/* <470f74> ../cstrike/dlls/hostage/hostage_improv.cpp:661 */
const Vector &CHostageImprov::__MAKE_VHOOK(GetCentroid)() const
{
m_centroid = m_hostage->pev->origin + Vector(0, 0, 36);
m_centroid = m_hostage->pev->origin + Vector(0, 0, HalfHumanHeight);
return m_centroid;
}
/* <470f9c> ../cstrike/dlls/hostage/hostage_improv.cpp:671 */
const Vector &CHostageImprov::__MAKE_VHOOK(GetEyes)() const
{
m_eye = m_hostage->pev->origin + Vector(0, 0, 72) - Vector(0, 0, 7);
m_eye = m_hostage->pev->origin + Vector(0, 0, HumanHeight) - Vector(0, 0, 7);
return m_eye;
}
/* <470fc4> ../cstrike/dlls/hostage/hostage_improv.cpp:681 */
bool CHostageImprov::__MAKE_VHOOK(IsOnGround)() const
{
return (m_hostage->pev->flags & FL_ONGROUND) != 0;
}
/* <470fec> ../cstrike/dlls/hostage/hostage_improv.cpp:687 */
bool CHostageImprov::__MAKE_VHOOK(IsMoving)() const
{
float const epsilon = 10.0f;
return m_actualVel.IsLengthGreaterThan(epsilon);
}
/* <4715d1> ../cstrike/dlls/hostage/hostage_improv.cpp:697 */
bool CHostageImprov::__MAKE_VHOOK(IsVisible)(const Vector &pos, bool testFOV) const
{
const Vector eye = GetEyes();
@ -533,7 +501,6 @@ bool CHostageImprov::__MAKE_VHOOK(IsVisible)(const Vector &pos, bool testFOV) co
return result.flFraction == 1.0f;
}
/* <472938> ../cstrike/dlls/hostage/hostage_improv.cpp:728 */
bool CHostageImprov::__MAKE_VHOOK(IsPlayerLookingAtMe)(CBasePlayer *other, float cosTolerance) const
{
Vector2D toOther = (other->pev->origin - GetCentroid()).Make2D();
@ -555,7 +522,6 @@ bool CHostageImprov::__MAKE_VHOOK(IsPlayerLookingAtMe)(CBasePlayer *other, float
return false;
}
/* <472a9f> ../cstrike/dlls/hostage/hostage_improv.cpp:757 */
CBasePlayer *CHostageImprov::__MAKE_VHOOK(IsAnyPlayerLookingAtMe)(int team, float cosTolerance) const
{
for (int i = 1; i <= gpGlobals->maxClients; ++i)
@ -577,7 +543,6 @@ CBasePlayer *CHostageImprov::__MAKE_VHOOK(IsAnyPlayerLookingAtMe)(int team, floa
return NULL;
}
/* <472e7b> ../cstrike/dlls/hostage/hostage_improv.cpp:783 */
CBasePlayer *CHostageImprov::__MAKE_VHOOK(GetClosestPlayerByTravelDistance)(int team, float *range) const
{
CBasePlayer *close = NULL;
@ -614,7 +579,6 @@ CBasePlayer *CHostageImprov::__MAKE_VHOOK(GetClosestPlayerByTravelDistance)(int
return close;
}
/* <47166d> ../cstrike/dlls/hostage/hostage_improv.cpp:822 */
void CHostageImprov::__MAKE_VHOOK(OnReset)()
{
m_moveFlags = 0;
@ -671,13 +635,12 @@ void CHostageImprov::__MAKE_VHOOK(OnReset)()
Idle();
}
/* <474659> ../cstrike/dlls/hostage/hostage_improv.cpp:886 */
void CHostageImprov::UpdateVision()
{
if (!m_visionTimer.IsElapsed())
return;
m_visiblePlayerCount = false;
m_visiblePlayerCount = 0;
for (int i = 1; i <= gpGlobals->maxClients; ++i)
{
@ -706,10 +669,9 @@ void CHostageImprov::UpdateVision()
}
}
m_visionTimer.Start(RANDOM_FLOAT(0.4, 0.6));
m_visionTimer.Start(RANDOM_FLOAT(0.4f, 0.6f));
}
/* <476e49> ../cstrike/dlls/hostage/hostage_improv.cpp:997 */
void CHostageImprov::__MAKE_VHOOK(TrackPath)(const Vector &pathGoal, float deltaT)
{
FaceTowards(pathGoal, deltaT);
@ -719,7 +681,6 @@ void CHostageImprov::__MAKE_VHOOK(TrackPath)(const Vector &pathGoal, float delta
DrawAxes(pathGoal, 255, 0, 255);
}
/* <474781> ../cstrike/dlls/hostage/hostage_improv.cpp:1014 */
void CHostageImprov::SetKnownGoodPosition(const Vector &pos)
{
if (IsJumping() || IsCrouching())
@ -739,7 +700,6 @@ void CHostageImprov::SetKnownGoodPosition(const Vector &pos)
m_knownGoodPos = pos;
}
/* <47486d> ../cstrike/dlls/hostage/hostage_improv.cpp:1038 */
void CHostageImprov::ResetToKnownGoodPosition()
{
const float tolerance = 10.0f;
@ -771,13 +731,11 @@ void CHostageImprov::ResetToKnownGoodPosition()
Stop();
}
/* <47105c> ../cstrike/dlls/hostage/hostage_improv.cpp:1082 */
void CHostageImprov::__MAKE_VHOOK(StartLadder)(const CNavLadder *ladder, NavTraverseType how, const Vector *approachPos, const Vector *departPos)
{
m_traversingLadder = true;
}
/* <4710c4> ../cstrike/dlls/hostage/hostage_improv.cpp:1094 */
bool CHostageImprov::__MAKE_VHOOK(TraverseLadder)(const CNavLadder *ladder, NavTraverseType how, const Vector *approachPos, const Vector *departPos, float deltaT)
{
Vector goal;
@ -787,7 +745,7 @@ bool CHostageImprov::__MAKE_VHOOK(TraverseLadder)(const CNavLadder *ladder, NavT
goal = ladder->m_bottom;
AddDirectionVector(&goal, ladder->m_dir, 16);
if (ladder->m_top.z - 36.0f > GetFeet().z)
if (ladder->m_top.z - HalfHumanHeight > GetFeet().z)
{
const float atGoalRange = 50.0f;
if ((GetFeet() - goal).Make2D().IsLengthLessThan(atGoalRange))
@ -796,7 +754,7 @@ bool CHostageImprov::__MAKE_VHOOK(TraverseLadder)(const CNavLadder *ladder, NavT
}
}
if (ladder->m_bottom.z + 36.0f > GetFeet().z)
if (ladder->m_bottom.z + HalfHumanHeight > GetFeet().z)
return true;
}
else if (m_traversingLadder)
@ -883,7 +841,6 @@ bool CHostageImprov::__MAKE_VHOOK(TraverseLadder)(const CNavLadder *ladder, NavT
return false;
}
/* <477691> ../cstrike/dlls/hostage/hostage_improv.cpp:1214 */
void CHostageImprov::UpdatePosition(float deltaT)
{
CNavArea *area = TheNavAreaGrid.GetNavArea(&m_hostage->pev->origin);
@ -912,10 +869,17 @@ void CHostageImprov::UpdatePosition(float deltaT)
dir = m_jumpTarget - GetFeet();
dir.z = 0;
#ifndef PLAY_GAMEDLL
// TODO: fix test demo
dir.NormalizeInPlace();
m_hostage->pev->velocity.x = dir.x * pushSpeed;
m_hostage->pev->velocity.y = dir.y * pushSpeed;
#else
Vector vecRet = NormalizeMulScalar<float_precision, float_precision, float_precision, float>(dir, pushSpeed);
m_hostage->pev->velocity.x = vecRet.x;
m_hostage->pev->velocity.y = vecRet.y;
#endif
m_hostage->SetBoneController(0);
m_hostage->SetBoneController(1);
@ -1020,7 +984,6 @@ void CHostageImprov::UpdatePosition(float deltaT)
m_moveFlags = 0;
}
/* <47837a> ../cstrike/dlls/hostage/hostage_improv.cpp:1384 */
void CHostageImprov::__MAKE_VHOOK(OnUpkeep)(float deltaT)
{
if (IsAlive())
@ -1029,7 +992,6 @@ void CHostageImprov::__MAKE_VHOOK(OnUpkeep)(float deltaT)
}
}
/* <4749f9> ../cstrike/dlls/hostage/hostage_improv.cpp:1396 */
bool CHostageImprov::IsTerroristNearby()
{
if (m_nearbyTerroristTimer.IsElapsed())
@ -1041,7 +1003,6 @@ bool CHostageImprov::IsTerroristNearby()
return true;
}
/* <474ae7> ../cstrike/dlls/hostage/hostage_improv.cpp:1412 */
void CHostageImprov::CheckForNearbyTerrorists()
{
if (!m_checkNearbyTerroristTimer.IsElapsed())
@ -1063,7 +1024,6 @@ void CHostageImprov::CheckForNearbyTerrorists()
}
}
/* <4753ba> ../cstrike/dlls/hostage/hostage_improv.cpp:1440 */
void CHostageImprov::UpdateGrenadeReactions()
{
if (m_coughTimer.IsElapsed())
@ -1081,7 +1041,7 @@ void CHostageImprov::UpdateGrenadeReactions()
CBaseEntity *entity = NULL;
const float watchGrenadeRadius = 500.0f;
m_grenadeTimer.Start(RANDOM_FLOAT(0.4, 0.6));
m_grenadeTimer.Start(RANDOM_FLOAT(0.4f, 0.6f));
while ((entity = UTIL_FindEntityInSphere(entity, GetCentroid(), watchGrenadeRadius)) != NULL)
{
@ -1109,7 +1069,6 @@ void CHostageImprov::UpdateGrenadeReactions()
}
}
/* <475ce3> ../cstrike/dlls/hostage/hostage_improv.cpp:1502 */
void CHostageImprov::__MAKE_VHOOK(OnUpdate)(float deltaT)
{
if (!IsAlive() || cv_hostage_stop.value > 0.0f)
@ -1124,7 +1083,7 @@ void CHostageImprov::__MAKE_VHOOK(OnUpdate)(float deltaT)
}
else
{
m_blinkTimer.Start(RANDOM_FLOAT(0.5, 2.0));
m_blinkTimer.Start(RANDOM_FLOAT(0.5f, 2.0f));
m_blinkCounter = RANDOM_LONG(1, 2);
}
@ -1266,7 +1225,6 @@ void CHostageImprov::__MAKE_VHOOK(OnUpdate)(float deltaT)
m_animateState.OnUpdate(this);
}
/* <47552a> ../cstrike/dlls/hostage/hostage_improv.cpp:1705 */
void CHostageImprov::__MAKE_VHOOK(OnGameEvent)(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
{
switch (event)
@ -1290,7 +1248,7 @@ void CHostageImprov::__MAKE_VHOOK(OnGameEvent)(GameEventType event, CBaseEntity
if (!entity->IsPlayer() || entity->IsPlayer() && ((CBasePlayer *)entity)->m_iTeam != TERRORIST)
{
DelayedChatter(RANDOM_FLOAT(0.5, 0.7), HOSTAGE_CHATTER_SCARED_OF_MURDER, true);
DelayedChatter(RANDOM_FLOAT(0.5f, 0.7f), HOSTAGE_CHATTER_SCARED_OF_MURDER, true);
}
if (!entity->IsPlayer())
{
@ -1310,15 +1268,13 @@ void CHostageImprov::__MAKE_VHOOK(OnGameEvent)(GameEventType event, CBaseEntity
case EVENT_TERRORISTS_WIN:
Frighten(SCARED);
m_isDelayedChatterPending = false;
DelayedChatter(RANDOM_FLOAT(1.0, 4.0), HOSTAGE_CHATTER_TERRORISTS_WIN);
DelayedChatter(RANDOM_FLOAT(1.0f, 4.0f), 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);
DelayedChatter(RANDOM_FLOAT(1.0f, 4.0f), HOSTAGE_CHATTER_CTS_WIN);
return;
default:
break;
}
float range;
@ -1341,7 +1297,7 @@ void CHostageImprov::__MAKE_VHOOK(OnGameEvent)(GameEventType event, CBaseEntity
{
case EVENT_WEAPON_FIRED:
{
DelayedChatter(RANDOM_FLOAT(0.3, 1.0), HOSTAGE_CHATTER_SCARED_OF_GUNFIRE);
DelayedChatter(RANDOM_FLOAT(0.3f, 1.0f), HOSTAGE_CHATTER_SCARED_OF_GUNFIRE);
break;
}
case EVENT_HE_GRENADE_EXPLODED:
@ -1351,7 +1307,7 @@ void CHostageImprov::__MAKE_VHOOK(OnGameEvent)(GameEventType event, CBaseEntity
case EVENT_BREAK_METAL:
case EVENT_BREAK_FLESH:
case EVENT_BREAK_CONCRETE:
DelayedChatter(RANDOM_FLOAT(0.3, 1.0), HOSTAGE_CHATTER_LOOK_OUT);
DelayedChatter(RANDOM_FLOAT(0.3f, 1.0f), HOSTAGE_CHATTER_LOOK_OUT);
break;
default:
@ -1368,13 +1324,12 @@ void CHostageImprov::__MAKE_VHOOK(OnGameEvent)(GameEventType event, CBaseEntity
if ((GetEyes() - *impactPos).IsLengthLessThan(flashRange) && IsVisible(*impactPos))
{
DelayedChatter(RANDOM_FLOAT(0.0, 1.0), HOSTAGE_CHATTER_BLINDED, true);
DelayedChatter(RANDOM_FLOAT(0.0f, 1.0f), HOSTAGE_CHATTER_BLINDED, true);
Frighten(TERRIFIED);
}
}
}
/* <471e27> ../cstrike/dlls/hostage/hostage_improv.cpp:1854 */
void CHostageImprov::__MAKE_VHOOK(OnTouch)(CBaseEntity *other)
{
const char *classname;
@ -1413,14 +1368,14 @@ void CHostageImprov::__MAKE_VHOOK(OnTouch)(CBaseEntity *other)
Vector pos = alongFloor * lookAheadRange;
for (double offset = 1.0f; offset <= 18.0f; offset += 3.0f)
for (float_precision 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)
if (result.flFraction < 1.0f && result.vecPlaneNormal.z < MaxUnitZSlope)
{
isStep = true;
break;
@ -1499,28 +1454,23 @@ void CHostageImprov::__MAKE_VHOOK(OnTouch)(CBaseEntity *other)
}
}
/* <474ba8> ../cstrike/dlls/hostage/hostage_improv.cpp:2006 */
void CHostageImprov::ApplyForce(Vector force)
{
m_vel.x += force.x;
m_vel.y += force.y;
}
/* <474bd5> ../cstrike/dlls/hostage/hostage_improv.cpp:2016 */
bool CHostageImprov::IsAtHome() const
{
return m_hostage->IsAtHome();
}
/* <474c76> ../cstrike/dlls/hostage/hostage_improv.cpp:2025 */
bool CHostageImprov::CanSeeRescueZone() const
{
CCSBotManager *ctrl = TheCSBots();
if (ctrl == NULL)
if (TheCSBots() == NULL)
return false;
const CCSBotManager::Zone *zone = ctrl->GetClosestZone(&GetCentroid());
const CCSBotManager::Zone *zone = TheCSBots()->GetClosestZone(&GetCentroid());
if (zone != NULL)
return IsVisible(zone->m_center);
@ -1528,7 +1478,6 @@ bool CHostageImprov::CanSeeRescueZone() const
return false;
}
/* <474cd3> ../cstrike/dlls/hostage/hostage_improv.cpp:2047 */
CBasePlayer *CHostageImprov::GetClosestVisiblePlayer(int team)
{
CBasePlayer *close = NULL;
@ -1553,7 +1502,6 @@ CBasePlayer *CHostageImprov::GetClosestVisiblePlayer(int team)
return close;
}
/* <474db2> ../cstrike/dlls/hostage/hostage_improv.cpp:2080 */
float CHostageImprov::GetTimeSinceLastSawPlayer(int team)
{
float timeCT = m_lastSawCT.GetElapsedTime();
@ -1570,19 +1518,16 @@ float CHostageImprov::GetTimeSinceLastSawPlayer(int team)
}
}
/* <474f2c> ../cstrike/dlls/hostage/hostage_improv.cpp:2098 */
float CHostageImprov::GetTimeSinceLastInjury()
{
return m_lastInjuryTimer.GetElapsedTime();
}
/* <474fb3> ../cstrike/dlls/hostage/hostage_improv.cpp:2107 */
float CHostageImprov::GetTimeSinceLastNoise()
{
return m_lastNoiseTimer.GetElapsedTime();
}
/* <47503a> ../cstrike/dlls/hostage/hostage_improv.cpp:2117 */
bool CHostageImprov::IsScared() const
{
if (m_scaredTimer.IsElapsed())
@ -1593,7 +1538,6 @@ bool CHostageImprov::IsScared() const
return true;
}
/* <47506e> ../cstrike/dlls/hostage/hostage_improv.cpp:2129 */
void CHostageImprov::Frighten(ScareType scare)
{
const float ignoreTime = 10.0f;
@ -1621,7 +1565,6 @@ void CHostageImprov::Frighten(ScareType scare)
}
}
/* <475200> ../cstrike/dlls/hostage/hostage_improv.cpp:2165 */
void CHostageImprov::Afraid()
{
char animInto[32];
@ -1652,7 +1595,6 @@ void CHostageImprov::Afraid()
}
}
/* <475290> ../cstrike/dlls/hostage/hostage_improv.cpp:2201 */
void CHostageImprov::UpdateIdleActivity(Activity activity, Activity fidget)
{
if (m_animateState.IsBusy())
@ -1662,19 +1604,18 @@ void CHostageImprov::UpdateIdleActivity(Activity activity, Activity fidget)
if (m_didFidget || fidget == ACT_RESET)
{
m_animateState.AddSequence(this, activity, RANDOM_FLOAT(1, 10), RANDOM_FLOAT(0.9, 1.1));
m_animateState.AddSequence(this, activity, RANDOM_FLOAT(1, 10), RANDOM_FLOAT(0.9f, 1.1f));
m_didFidget = false;
}
else
{
m_animateState.AddSequence(this, fidget, -1, RANDOM_FLOAT(0.9, 1.5));
m_animateState.AddSequence(this, fidget, -1, RANDOM_FLOAT(0.9f, 1.5f));
m_didFidget = true;
}
}
/* <4752d9> ../cstrike/dlls/hostage/hostage_improv.cpp:2226 */
void CHostageImprov::Chatter(HostageChatterType sayType, bool mustSpeak)
{
if (!IsAlive() && sayType != HOSTAGE_CHATTER_DEATH_CRY)
@ -1691,7 +1632,6 @@ void CHostageImprov::Chatter(HostageChatterType sayType, bool mustSpeak)
}
}
/* <475b35> ../cstrike/dlls/hostage/hostage_improv.cpp:2249 */
void CHostageImprov::DelayedChatter(float delayTime, HostageChatterType sayType, bool mustSpeak)
{
if (!IsAlive())
@ -1706,7 +1646,6 @@ void CHostageImprov::DelayedChatter(float delayTime, HostageChatterType sayType,
}
}
/* <475bd4> ../cstrike/dlls/hostage/hostage_improv.cpp:2268 */
void CHostageImprov::UpdateDelayedChatter()
{
if (!m_isDelayedChatterPending)
@ -1720,7 +1659,7 @@ void CHostageImprov::UpdateDelayedChatter()
switch (m_delayedChatterType)
{
case HOSTAGE_CHATTER_SCARED_OF_GUNFIRE:
if (RANDOM_FLOAT(0, 100) <= 25)
if (RANDOM_FLOAT(0, 100) <= 25.0f)
{
Chatter(m_delayedChatterType, m_delayedChatterMustSpeak);
}
@ -1728,7 +1667,7 @@ void CHostageImprov::UpdateDelayedChatter()
case HOSTAGE_CHATTER_LOOK_OUT:
case HOSTAGE_CHATTER_PLEASE_RESCUE_ME:
case HOSTAGE_CHATTER_IMPATIENT_FOR_RESCUE:
if (RANDOM_FLOAT(0, 100) <= 60)
if (RANDOM_FLOAT(0, 100) <= 60.0f)
{
Chatter(m_delayedChatterType, m_delayedChatterMustSpeak);
}
@ -1739,7 +1678,6 @@ void CHostageImprov::UpdateDelayedChatter()
}
}
/* <4761eb> ../cstrike/dlls/hostage/hostage_improv.cpp:2307 */
void CHostageImprov::Flinch(Activity activity)
{
Chatter(HOSTAGE_CHATTER_PAIN, true);
@ -1752,31 +1690,27 @@ void CHostageImprov::Flinch(Activity activity)
}
}
/* <4762fe> ../cstrike/dlls/hostage/hostage_improv.cpp:2329 */
void CHostageImprov::CrouchDie()
{
m_animateState.Reset();
m_animateState.AddSequence(this, ACT_CROUCH_DIE);
}
/* <476327> ../cstrike/dlls/hostage/hostage_improv.cpp:2339 */
void CHostageImprov::Agree()
{
m_animateState.Reset();
m_animateState.AddSequence(this, ACT_YES);
}
/* <476350> ../cstrike/dlls/hostage/hostage_improv.cpp:2349 */
void CHostageImprov::Disagree()
{
if (m_animateState.GetPerformance() != HostageAnimateState::Disagreeing)
{
m_animateState.Reset();
m_animateState.AddSequence(this, ACT_NO, -1.0, RANDOM_FLOAT(1.5, 3.0));
m_animateState.AddSequence(this, ACT_NO, -1.0, RANDOM_FLOAT(1.5f, 3.0f));
}
}
/* <476395> ../cstrike/dlls/hostage/hostage_improv.cpp:2363 */
void CHostageImprov::Wave()
{
m_animateState.Reset();
@ -1785,8 +1719,6 @@ void CHostageImprov::Wave()
}
// Invoked when an improv fails to reach a MoveTo goal
/* <474938> ../cstrike/dlls/hostage/hostage_improv.cpp:2375 */
void CHostageImprov::__MAKE_VHOOK(OnMoveToFailure)(const Vector &goal, MoveToFailureType reason)
{
m_behavior.OnMoveToFailure(goal, reason);
@ -1797,14 +1729,13 @@ void CHostageImprov::__MAKE_VHOOK(OnMoveToFailure)(const Vector &goal, MoveToFai
}
}
/* <4763d7> ../cstrike/dlls/hostage/hostage_improv.cpp:2391 */
void CHostageImprov::Wiggle()
{
// for wiggling
if (m_wiggleTimer.IsElapsed())
{
m_wiggleDirection = static_cast<NavRelativeDirType>(RANDOM_LONG(FORWARD, LEFT));
m_wiggleTimer.Start(RANDOM_FLOAT(0.3, 0.5));
m_wiggleTimer.Start(RANDOM_FLOAT(0.3f, 0.5f));
}
const float force = 15.0f;
@ -1839,7 +1770,6 @@ void CHostageImprov::Wiggle()
}
}
/* <4766cc> ../cstrike/dlls/hostage/hostage_improv.cpp:2438 */
void CHostageImprov::ClearPath()
{
Vector start;
@ -1849,7 +1779,7 @@ void CHostageImprov::ClearPath()
if (!m_clearPathTimer.IsElapsed())
return;
m_clearPathTimer.Start(RANDOM_FLOAT(0.3, 0.5));
m_clearPathTimer.Start(RANDOM_FLOAT(0.3f, 0.5f));
const Vector eye = GetEyes();
start = eye;
@ -1887,7 +1817,6 @@ void CHostageImprov::ClearPath()
}
}
/* <471b3f> ../cstrike/dlls/hostage/hostage_improv.cpp:2497 */
void CHostageImprov::__MAKE_VHOOK(Crouch)()
{
const float minCrouchTime = 1.0f;
@ -1900,7 +1829,6 @@ void CHostageImprov::__MAKE_VHOOK(Crouch)()
UTIL_SetSize(m_hostage->pev, VEC_HOSTAGE_HULL_MIN, VEC_HOSTAGE_CROUCH);
}
/* <47195c> ../cstrike/dlls/hostage/hostage_improv.cpp:2516 */
void CHostageImprov::__MAKE_VHOOK(StandUp)()
{
if (!IsCrouching() || !m_minCrouchTimer.IsElapsed())
@ -1921,6 +1849,7 @@ void CHostageImprov::__MAKE_VHOOK(StandUp)()
}
}
// HalfHumanHeight
if (y == 36)
{
m_animateState.Reset();
@ -1929,7 +1858,6 @@ void CHostageImprov::__MAKE_VHOOK(StandUp)()
}
}
/* <477114> ../cstrike/dlls/hostage/hostage_improv.cpp:2558 */
void CHostageImprov::UpdateStationaryAnimation()
{
m_behavior.UpdateStationaryAnimation(this);

View File

@ -152,6 +152,10 @@ public:
#endif // HOOK_GAMEDLL
#ifdef PLAY_GAMEDLL
void ApplyForce2(float_precision x, float_precision y);
#endif
public:
enum MoveType { Stopped, Walking, Running };
enum ScareType { NERVOUS, SCARED, TERRIFIED };
@ -161,28 +165,8 @@ public:
void SetKnownGoodPosition(const Vector &pos);
const Vector &GetKnownGoodPosition() const { return m_knownGoodPos; }
void ResetToKnownGoodPosition();
void ResetJump()
{
if (m_hasJumpedIntoAir)
{
if (IsOnGround())
{
m_jumpTimer.Invalidate();
}
}
else if (!IsOnGround())
{
m_hasJumpedIntoAir = true;
}
}
void ResetJump();
void ApplyForce(Vector force); // apply a force to the hostage
#ifdef PLAY_GAMEDLL
void ApplyForce2(float_precision x, float_precision y)
{
m_vel.x += x;
m_vel.y += y;
}
#endif // PLAY_GAMEDLL
const Vector GetActualVelocity() const { return m_actualVel; }
void SetMoveLimit(MoveType limit) { m_moveLimit = limit; }
MoveType GetMoveLimit() const { return m_moveLimit; }
@ -217,11 +201,11 @@ public:
void Frighten(ScareType scare);
bool IsScared() const;
ScareType GetScareIntensity() const { return m_scareIntensity; }
bool IsIgnoringTerrorists() const { m_ignoreTerroristTimer.IsElapsed(); }
bool IsIgnoringTerrorists() const { return m_ignoreTerroristTimer.IsElapsed(); }
float GetAggression() const { return m_aggression; }
void Chatter(HostageChatterType sayType, bool mustSpeak = true);
void DelayedChatter(float delayTime, HostageChatterType sayType, bool mustSpeak = false);
NOXREF void UpdateDelayedChatter();
void UpdateDelayedChatter();
bool IsTalking() const { return m_talkingTimer.IsElapsed(); }
void UpdateGrenadeReactions();
void Afraid();
@ -234,7 +218,7 @@ public:
void UpdateStationaryAnimation();
CHostage *GetEntity() const { return m_hostage; }
void CheckForNearbyTerrorists();
void UpdatePosition(float);
void UpdatePosition(float deltaT);
void MoveTowards(const Vector &pos, float deltaT);
bool FaceTowards(const Vector &target, float deltaT); // rotate body to face towards "target"
float GetSpeed();
@ -317,12 +301,11 @@ private:
Vector m_jumpTarget;
CountdownTimer m_clearPathTimer;
bool m_traversingLadder;
EHANDLE m_visiblePlayer[ MAX_CLIENTS ];
EHANDLE m_visiblePlayer[MAX_CLIENTS];
int m_visiblePlayerCount;
CountdownTimer m_visionTimer;
};
/* <46fac7> ../cstrike/dlls/hostage/hostage_improv.cpp:363 */
class CheckWayFunctor
{
public:
@ -350,8 +333,6 @@ public:
// Functor used with NavAreaBuildPath() for building Hostage paths.
// Once we hook up crouching and ladders, this can be removed and ShortestPathCost() can be used instead.
/* <46f426> ../cstrike/dlls/hostage/hostage_improv.h:400 */
class HostagePathCost
{
public:
@ -398,7 +379,6 @@ public:
}
};
/* <4700b6> ../cstrike/dlls/hostage/hostage_improv.cpp:931 */
class KeepPersonalSpace
{
public:
@ -427,7 +407,8 @@ public:
range = to.NormalizeInPlace<float>();
#else
range = to.NormalizeInPlace();
#endif // PLAY_GAMEDLL
#endif
CBasePlayer *player = static_cast<CBasePlayer *>(entity);
const float spring = 50.0f;
@ -448,7 +429,7 @@ public:
#else
// TODO: fix test demo
m_improv->ApplyForce2(to.x * ds, to.y * ds);
#endif // PLAY_GAMEDLL
#endif
const float force = 0.1f;
m_improv->ApplyForce(m_speed * -force * m_velDir);
@ -462,7 +443,6 @@ private:
float m_speed;
};
/* <46fbb8> ../cstrike/dlls/hostage/hostage_improv.cpp:518 */
class CheckAhead
{
public:
@ -498,4 +478,26 @@ private:
bool m_isBlocked;
};
#ifdef PLAY_GAMEDLL
inline void CHostageImprov::ApplyForce2(float_precision x, float_precision y)
{
m_vel.x += x;
m_vel.y += y;
}
#endif
inline void CHostageImprov::ResetJump()
{
if (m_hasJumpedIntoAir)
{
if (IsOnGround())
{
m_jumpTimer.Invalidate();
}
}
else if (!IsOnGround())
{
m_hasJumpedIntoAir = true;
}
}
#endif // HOSTAGE_IMPROV_H

View File

@ -15,9 +15,8 @@ float CLocalNav::flLastThinkTime;
EHANDLE CLocalNav::hostages[MAX_HOSTAGES_NAV];
int CLocalNav::tot_hostages;
#endif // HOOK_GAMEDLL
#endif
/* <485b67> ../cstrike/dlls/hostage/hostage_localnav.cpp:45 */
CLocalNav::CLocalNav(CHostage *pOwner)
{
m_pOwner = pOwner;
@ -32,19 +31,18 @@ CLocalNav::CLocalNav(CHostage *pOwner)
hostages[tot_hostages++] = pOwner;
}
/* <485b09> ../cstrike/dlls/hostage/hostage_localnav.cpp:68 */
CLocalNav::~CLocalNav()
{
delete m_nodeArr;
m_nodeArr = NULL;
}
/* <485b91> ../cstrike/dlls/hostage/hostage_localnav.cpp:74 */
node_index_t CLocalNav::AddNode(node_index_t nindexParent, Vector &vecLoc, int offsetX, int offsetY, byte bDepth)
{
localnode_t *nodeNew;
if (m_nindexAvailableNode == MAX_NODES)
return -1;
return NODE_INVALID_EMPTY;
nodeNew = GetNode(m_nindexAvailableNode);
@ -58,13 +56,11 @@ node_index_t CLocalNav::AddNode(node_index_t nindexParent, Vector &vecLoc, int o
return m_nindexAvailableNode++;
}
/* <485570> ../cstrike/dlls/hostage/hostage_localnav.cpp:94 */
localnode_t *CLocalNav::GetNode(node_index_t nindex)
{
return &m_nodeArr[ nindex ];
}
/* <485c01> ../cstrike/dlls/hostage/hostage_localnav.cpp:100 */
node_index_t CLocalNav::NodeExists(int offsetX, int offsetY)
{
node_index_t nindexCurrent = NODE_INVALID_EMPTY;
@ -83,7 +79,6 @@ node_index_t CLocalNav::NodeExists(int offsetX, int offsetY)
return nindexCurrent;
}
/* <486d46> ../cstrike/dlls/hostage/hostage_localnav.cpp:123 */
void CLocalNav::AddPathNodes(node_index_t nindexSource, int fNoMonsters)
{
AddPathNode(nindexSource, 1, 0, fNoMonsters);
@ -96,14 +91,13 @@ void CLocalNav::AddPathNodes(node_index_t nindexSource, int fNoMonsters)
AddPathNode(nindexSource, -1, -1, fNoMonsters);
}
/* <486adb> ../cstrike/dlls/hostage/hostage_localnav.cpp:138 */
void CLocalNav::AddPathNode(node_index_t nindexSource, int offsetX, int offsetY, int fNoMonsters)
{
int bDepth;
Vector vecSource, vecDest;
int offsetXAbs, offsetYAbs;
if (nindexSource == -1)
if (nindexSource == NODE_INVALID_EMPTY)
{
bDepth = 1;
@ -111,7 +105,7 @@ void CLocalNav::AddPathNode(node_index_t nindexSource, int offsetX, int offsetY,
offsetYAbs = offsetY;
vecSource = m_vecStartingLoc;
vecDest = vecSource + Vector(((float_precision)offsetX * HOSTAGE_STEPSIZE), ((float_precision)offsetY * HOSTAGE_STEPSIZE), 0);
vecDest = vecSource + Vector(float_precision(offsetX) * HOSTAGE_STEPSIZE, float_precision(offsetY) * HOSTAGE_STEPSIZE, 0);
}
else
{
@ -131,7 +125,7 @@ void CLocalNav::AddPathNode(node_index_t nindexSource, int offsetX, int offsetY,
}
vecSource = nodeCurrent->vecLoc;
vecDest = vecSource + Vector(((float_precision)offsetX * HOSTAGE_STEPSIZE), ((float_precision)offsetY * HOSTAGE_STEPSIZE), 0);
vecDest = vecSource + Vector((float_precision(offsetX) * HOSTAGE_STEPSIZE), (float_precision(offsetY) * HOSTAGE_STEPSIZE), 0);
if (m_nindexAvailableNode)
{
@ -186,7 +180,7 @@ void CLocalNav::AddPathNode(node_index_t nindexSource, int offsetX, int offsetY,
}
vecSource = nodeCurrent->vecLoc;
bDepth = ((int)nodeCurrent->bDepth) + 1;
bDepth = int(nodeCurrent->bDepth) + 1;
}
if (PathTraversable(vecSource, vecDest, fNoMonsters) != PATH_TRAVERSABLE_EMPTY)
@ -195,7 +189,6 @@ void CLocalNav::AddPathNode(node_index_t nindexSource, int offsetX, int offsetY,
}
}
/* <485c63> ../cstrike/dlls/hostage/hostage_localnav.cpp:205 */
node_index_t CLocalNav::GetBestNode(Vector &vecOrigin, Vector &vecDest)
{
node_index_t nindexCurrent;
@ -203,7 +196,7 @@ node_index_t CLocalNav::GetBestNode(Vector &vecOrigin, Vector &vecDest)
node_index_t nindexBest;
float flBestVal;
nindexBest = -1;
nindexBest = NODE_INVALID_EMPTY;
nindexCurrent = 0;
flBestVal = 1000000.0;
@ -234,7 +227,7 @@ node_index_t CLocalNav::GetBestNode(Vector &vecOrigin, Vector &vecDest)
else
flZDiff = 1.25;
flCurrentVal = flZDiff * (((float_precision)nodeCurrent->bDepth * HOSTAGE_STEPSIZE) + flDistFromStart);
flCurrentVal = flZDiff * (float_precision(nodeCurrent->bDepth) * HOSTAGE_STEPSIZE + flDistFromStart);
if (flCurrentVal < flBestVal)
{
flBestVal = flCurrentVal;
@ -248,13 +241,12 @@ node_index_t CLocalNav::GetBestNode(Vector &vecOrigin, Vector &vecDest)
return nindexBest;
}
/* <485d79> ../cstrike/dlls/hostage/hostage_localnav.cpp:263 */
int CLocalNav::SetupPathNodes(node_index_t nindex, Vector *vecNodes, int fNoMonsters)
{
node_index_t nCurrentIndex = nindex;
int nNodeCount = 0;
while (nCurrentIndex != -1)
while (nCurrentIndex != NODE_INVALID_EMPTY)
{
localnode_t *nodeCurrent = GetNode(nCurrentIndex);
Vector vecCurrentLoc = nodeCurrent->vecLoc;
@ -266,7 +258,6 @@ int CLocalNav::SetupPathNodes(node_index_t nindex, Vector *vecNodes, int fNoMons
return nNodeCount;
}
/* <486a56> ../cstrike/dlls/hostage/hostage_localnav.cpp:290 */
int CLocalNav::GetFurthestTraversableNode(Vector &vecStartingLoc, Vector *vecNodes, int nTotalNodes, int fNoMonsters)
{
int nCount = 0;
@ -281,12 +272,11 @@ int CLocalNav::GetFurthestTraversableNode(Vector &vecStartingLoc, Vector *vecNod
return -1;
}
/* <486d8d> ../cstrike/dlls/hostage/hostage_localnav.cpp:304 */
node_index_t CLocalNav::FindPath(Vector &vecStart, Vector &vecDest, float flTargetRadius, int fNoMonsters)
{
node_index_t nIndexBest = FindDirectPath(vecStart, vecDest, flTargetRadius, fNoMonsters);
if (nIndexBest != -1)
if (nIndexBest != NODE_INVALID_EMPTY)
{
return nIndexBest;
}
@ -298,10 +288,10 @@ node_index_t CLocalNav::FindPath(Vector &vecStart, Vector &vecDest, float flTarg
m_vecStartingLoc = vecStart;
m_nindexAvailableNode = 0;
AddPathNodes(-1, fNoMonsters);
AddPathNodes(NODE_INVALID_EMPTY, fNoMonsters);
nIndexBest = GetBestNode(vecStart, vecDest);
while (nIndexBest != -1)
while (nIndexBest != NODE_INVALID_EMPTY)
{
node = GetNode(nIndexBest);
node->fSearched = TRUE;
@ -318,7 +308,7 @@ node_index_t CLocalNav::FindPath(Vector &vecStart, Vector &vecDest, float flTarg
if (((flDistToDest - flTargetRadius) > ((MAX_NODES - m_nindexAvailableNode) * HOSTAGE_STEPSIZE))
|| m_nindexAvailableNode == MAX_NODES)
{
nIndexBest = -1;
nIndexBest = NODE_INVALID_EMPTY;
break;
}
@ -379,7 +369,6 @@ node_index_t CLocalNav::FindPath(Vector &vecStart, Vector &vecDest, float flTarg
return nIndexBest;
}
/* <4867dc> ../cstrike/dlls/hostage/hostage_localnav.cpp:413 */
node_index_t CLocalNav::FindDirectPath(Vector &vecStart, Vector &vecDest, float flTargetRadius, int fNoMonsters)
{
Vector vecActualDest;
@ -392,10 +381,10 @@ node_index_t CLocalNav::FindDirectPath(Vector &vecStart, Vector &vecDest, float
if (PathTraversable(vecStart, vecActualDest, fNoMonsters) == PATH_TRAVERSABLE_EMPTY)
{
return -1;
return NODE_INVALID_EMPTY;
}
nindexLast = -1;
nindexLast = NODE_INVALID_EMPTY;
vecNodeLoc = vecStart;
m_nindexAvailableNode = 0;
@ -406,14 +395,13 @@ node_index_t CLocalNav::FindDirectPath(Vector &vecStart, Vector &vecDest, float
vecNodeLoc = vecNodeLoc + (vecPathDir * HOSTAGE_STEPSIZE);
nindexLast = AddNode(nindexCurrent, vecNodeLoc);
if (nindexLast == -1)
if (nindexLast == NODE_INVALID_EMPTY)
break;
}
return nindexLast;
}
/* <485e40> ../cstrike/dlls/hostage/hostage_localnav.cpp:449 */
BOOL CLocalNav::PathClear(Vector &vecOrigin, Vector &vecDest, int fNoMonsters, TraceResult &tr)
{
TRACE_MONSTER_HULL(m_pOwner->edict(), vecOrigin, vecDest, fNoMonsters, m_pOwner->edict(), &tr);
@ -433,7 +421,6 @@ BOOL CLocalNav::PathClear(Vector &vecOrigin, Vector &vecDest, int fNoMonsters, T
return FALSE;
}
/* <485ecf> ../cstrike/dlls/hostage/hostage_localnav.cpp:472 */
int CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters)
{
TraceResult tr;
@ -451,7 +438,7 @@ int CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonste
flTotal = vecDestTmp.Length2D();
while (flTotal > 1.0)
while (flTotal > 1.0f)
{
if (flTotal >= s_flStepSize)
{
@ -460,9 +447,9 @@ int CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonste
#else
// TODO: fix test demo
vecDestTmp[0] = vecSrcTmp[0] + (vecDir[0] * s_flStepSize);
vecDestTmp[1] = vecSrcTmp[1] + (float)(vecDir[1] * s_flStepSize);
vecDestTmp[1] = vecSrcTmp[1] + float(vecDir[1] * s_flStepSize);
vecDestTmp[2] = vecSrcTmp[2] + (vecDir[2] * s_flStepSize);
#endif // PLAY_GAMEDLL
#endif
}
else
@ -496,7 +483,7 @@ int CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonste
vecSrcTmp = tr.vecEndPos;
if (tr.vecPlaneNormal.z <= 0.7)
if (tr.vecPlaneNormal.z <= MaxUnitZSlope)
{
if (StepTraversable(vecSrcTmp, vecDestTmp, fNoMonsters, tr))
{
@ -558,7 +545,6 @@ int CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonste
return retval;
}
/* <486ea0> ../cstrike/dlls/hostage/hostage_localnav.cpp:593 */
BOOL CLocalNav::SlopeTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr)
{
Vector vecSlopeEnd;
@ -569,14 +555,14 @@ BOOL CLocalNav::SlopeTraversable(Vector &vecSource, Vector &vecDest, int fNoMons
vecDown = vecDest - vecSource;
vecAngles = UTIL_VecToAngles(tr.vecPlaneNormal);
vecSlopeEnd.z = vecDown.Length2D() * tan((float_precision)((90.0 - vecAngles.x) * (M_PI / 180))) + vecSource.z;
vecSlopeEnd.z = vecDown.Length2D() * Q_tan(float_precision((90.0 - vecAngles.x) * (M_PI / 180))) + vecSource.z;
if (!PathClear(vecSource, vecSlopeEnd, fNoMonsters, tr))
{
if (tr.fStartSolid)
return FALSE;
if ((tr.vecEndPos - vecSource).Length2D() < 1.0)
if ((tr.vecEndPos - vecSource).Length2D() < 1.0f)
return FALSE;
}
@ -598,7 +584,6 @@ BOOL CLocalNav::SlopeTraversable(Vector &vecSource, Vector &vecDest, int fNoMons
return TRUE;
}
/* <487085> ../cstrike/dlls/hostage/hostage_localnav.cpp:635 */
BOOL CLocalNav::LadderTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr)
{
Vector vecStepStart;
@ -613,7 +598,7 @@ BOOL CLocalNav::LadderTraversable(Vector &vecSource, Vector &vecDest, int fNoMon
if (tr.fStartSolid)
return FALSE;
if ((tr.vecEndPos - vecStepStart).Length() < 1)
if ((tr.vecEndPos - vecStepStart).Length() < 1.0f)
return FALSE;
}
@ -623,7 +608,6 @@ BOOL CLocalNav::LadderTraversable(Vector &vecSource, Vector &vecDest, int fNoMon
return PathTraversable(vecStepStart, vecDest, fNoMonsters);
}
/* <4871ef> ../cstrike/dlls/hostage/hostage_localnav.cpp:662 */
BOOL CLocalNav::StepTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr)
{
Vector vecStepStart;
@ -644,7 +628,7 @@ BOOL CLocalNav::StepTraversable(Vector &vecSource, Vector &vecDest, int fNoMonst
flFwdFraction = (tr.vecEndPos - vecStepStart).Length();
if (flFwdFraction < 1.0)
if (flFwdFraction < 1.0f)
return FALSE;
}
@ -666,21 +650,20 @@ BOOL CLocalNav::StepTraversable(Vector &vecSource, Vector &vecDest, int fNoMonst
return TRUE;
}
/* <4873b3> ../cstrike/dlls/hostage/hostage_localnav.cpp:713 */
BOOL CLocalNav::StepJumpable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr)
{
Vector vecStepStart;
Vector vecStepDest;
//BOOL fFwdTrace = FALSE; // unused?
float flFwdFraction;
float flJumpHeight = s_flStepSize + 1.0;
float flJumpHeight = s_flStepSize + 1.0f;
//BOOL fJumpClear = FALSE; // unused?
//edict_t *hit = NULL; // unused?
vecStepStart = vecSource;
vecStepStart.z += flJumpHeight;
while (flJumpHeight < 40.0)
while (flJumpHeight < 40.0f)
{
vecStepDest = vecDest;
vecStepDest.z = vecStepStart.z;
@ -692,10 +675,10 @@ BOOL CLocalNav::StepJumpable(Vector &vecSource, Vector &vecDest, int fNoMonsters
flFwdFraction = (tr.vecEndPos - vecStepStart).Length2D();
if (flFwdFraction < 1.0)
if (flFwdFraction < 1.0f)
{
flJumpHeight += 10.0;
vecStepStart.z += 10.0;
flJumpHeight += 10.0f;
vecStepStart.z += 10.0f;
continue;
}
@ -721,7 +704,6 @@ BOOL CLocalNav::StepJumpable(Vector &vecSource, Vector &vecDest, int fNoMonsters
return FALSE;
}
/* <487588> ../cstrike/dlls/hostage/hostage_localnav.cpp:824 */
BOOL CLocalNav::LadderHit(Vector &vecSource, Vector &vecDest, TraceResult &tr)
{
Vector vecFwd, vecRight, vecUp;
@ -762,7 +744,6 @@ BOOL CLocalNav::LadderHit(Vector &vecSource, Vector &vecDest, TraceResult &tr)
return false;
}
/* <487eeb> ../cstrike/dlls/hostage/hostage_localnav.cpp:851 */
void CLocalNav::Think()
{
EHANDLE hCallback;
@ -778,7 +759,7 @@ void CLocalNav::Think()
s_flStepSize = s_flStepSize ? sv_stepsize->value : HOSTAGE_STEPSIZE_DEFAULT;
}
flNextCvarCheck = gpGlobals->time + 1;
flNextCvarCheck = gpGlobals->time + 1.0f;
}
HostagePrethink();
@ -831,7 +812,6 @@ void CLocalNav::Think()
}
}
/* <487ccd> ../cstrike/dlls/hostage/hostage_localnav.cpp:922 */
void CLocalNav::RequestNav(CHostage *pCaller)
{
int curr = qptr;
@ -863,7 +843,6 @@ void CLocalNav::RequestNav(CHostage *pCaller)
++tot_inqueue;
}
/* <487e03> ../cstrike/dlls/hostage/hostage_localnav.cpp:964 */
void CLocalNav::Reset()
{
flNextCvarCheck = 0;
@ -874,7 +853,6 @@ void CLocalNav::Reset()
tot_hostages = 0;
}
/* <487e14> ../cstrike/dlls/hostage/hostage_localnav.cpp:976 */
void CLocalNav::HostagePrethink()
{
for (int iCount = 0; iCount < tot_hostages; ++iCount)

View File

@ -41,7 +41,6 @@
typedef int node_index_t;
/* <48522d> ../cstrike/dlls/hostage/hostage_localnav.h:43 */
typedef struct localnode_s
{
Vector vecLoc;
@ -57,9 +56,8 @@ typedef struct localnode_s
#define s_flStepSize_LocalNav m_LocalNav->s_flStepSize
#endif // HOOK_GAMEDLL
#endif
/* <45aaa2> ../cstrike/dlls/hostage/hostage_localnav.h:58 */
class CLocalNav
{
public:
@ -68,7 +66,7 @@ public:
void SetTargetEnt(CBaseEntity *pTarget)
{
if (pTarget)
if (pTarget != NULL)
m_pTargetEnt = pTarget->edict();
else
m_pTargetEnt = NULL;
@ -105,21 +103,17 @@ public:
#ifndef HOOK_GAMEDLL
private:
#endif // HOOK_GAMEDLL
#endif
static EHANDLE _queue[ MAX_HOSTAGES_NAV ];
static EHANDLE _queue[MAX_HOSTAGES_NAV];
static int qptr;
static int tot_inqueue;
static float nodeval;
static float flNextCvarCheck;
static float flLastThinkTime;
static EHANDLE hostages[ MAX_HOSTAGES_NAV ];
static EHANDLE hostages[MAX_HOSTAGES_NAV];
static int tot_hostages;
#ifdef HOOK_GAMEDLL
private:
#endif // HOOK_GAMEDLL
CHostage *m_pOwner;
edict_t *m_pTargetEnt;
BOOL m_fTargetEntHit;

View File

@ -34,7 +34,6 @@
class CHostageImprov;
/* <46f85d> ../cstrike/dlls/hostage/hostage_states.h:16 */
class HostageState: public SimpleState<CHostageImprov *>, public IImprovEvent
{
public:
@ -42,7 +41,6 @@ public:
virtual void UpdateStationaryAnimation(CHostageImprov *improv) {};
};
/* <46f922> ../cstrike/dlls/hostage/hostage_states.h:26 */
class HostageStateMachine: public SimpleStateMachine<CHostageImprov *, HostageState>, public IImprovEvent
{
public:
@ -68,7 +66,6 @@ public:
}
};
/* <46fccf> ../cstrike/dlls/hostage/hostage_states.h:38 */
class HostageIdleState: public HostageState
{
public:
@ -90,7 +87,7 @@ public:
void OnExit_(CHostageImprov *improv);
void UpdateStationaryAnimation_(CHostageImprov *improv);
#endif // HOOK_GAMEDLL
#endif
private:
CountdownTimer m_waveTimer;
@ -112,7 +109,6 @@ private:
bool m_mustFlee;
};
/* <46f8ec> ../cstrike/dlls/hostage/hostage_states.h:71 */
class HostageEscapeToCoverState: public HostageState
{
public:
@ -131,7 +127,7 @@ public:
void OnExit_(CHostageImprov *improv);
void OnMoveToFailure_(const Vector &goal, MoveToFailureType reason);
#endif // HOOK_GAMEDLL
#endif
public:
void SetRescueGoal(const Vector &rescueGoal) { m_rescueGoal = rescueGoal; }
@ -142,7 +138,6 @@ private:
bool m_canEscape;
};
/* <46f907> ../cstrike/dlls/hostage/hostage_states.h:92 */
class HostageEscapeLookAroundState: public HostageState
{
public:
@ -159,13 +154,12 @@ public:
void OnUpdate_(CHostageImprov *improv);
void OnExit_(CHostageImprov *improv);
#endif // HOOK_GAMEDLL
#endif
private:
CountdownTimer m_timer;
};
/* <46fcea> ../cstrike/dlls/hostage/hostage_states.h:109 */
class HostageEscapeState: public HostageState
{
public:
@ -188,7 +182,7 @@ public:
void OnUpdate_(CHostageImprov *improv);
void OnExit_(CHostageImprov *improv);
#endif // HOOK_GAMEDLL
#endif
public:
void ToCover() { m_behavior.SetState(&m_toCoverState); }
@ -202,7 +196,6 @@ private:
CountdownTimer m_runTimer;
};
/* <46fd03> ../cstrike/dlls/hostage/hostage_states.h:138 */
class HostageRetreatState: public HostageState
{
public:
@ -219,11 +212,10 @@ public:
void OnUpdate_(CHostageImprov *improv);
void OnExit_(CHostageImprov *improv);
#endif // HOOK_GAMEDLL
#endif
};
/* <46fd1e> ../cstrike/dlls/hostage/hostage_states.h:149 */
class HostageFollowState: public HostageState
{
public:
@ -242,7 +234,7 @@ public:
void OnExit_(CHostageImprov *improv);
void UpdateStationaryAnimation_(CHostageImprov *improv);
#endif // HOOK_GAMEDLL
#endif
public:
void SetLeader(CBaseEntity *leader) { m_leader = leader; }
@ -260,7 +252,6 @@ private:
CountdownTimer m_waitForFriendTimer;
};
/* <46fd39> ../cstrike/dlls/hostage/hostage_states.h:186 */
class HostageAnimateState: public HostageState
{
public:
@ -277,7 +268,7 @@ public:
void OnUpdate_(CHostageImprov *improv);
void OnExit_(CHostageImprov *improv);
#endif // HOOK_GAMEDLL
#endif
public:
struct SeqInfo
@ -312,7 +303,7 @@ public:
void AddSequence(CHostageImprov *improv, int activity, float holdTime = -1.0f, float rate = 1.0f);
bool IsBusy() const { return (m_sequenceCount > 0); }
NOXREF bool IsPlaying(CHostageImprov *improv, const char *seqName) const;
bool IsPlaying(CHostageImprov *improv, const char *seqName) const;
int GetCurrentSequenceID() { return m_currentSequence; }
PerformanceType GetPerformance() const { return m_performance; }
void SetPerformance(PerformanceType performance) { m_performance = performance; }
@ -321,7 +312,7 @@ public:
private:
enum { MAX_SEQUENCES = 8 };
struct SeqInfo m_sequence[ MAX_SEQUENCES ];
struct SeqInfo m_sequence[MAX_SEQUENCES];
int m_sequenceCount;
int m_currentSequence;
enum PerformanceType m_performance;

View File

@ -1,13 +1,11 @@
#include "precompiled.h"
/* <4110a1> ../cstrike/dlls/hostage/states/hostage_animate.cpp:13 */
void HostageAnimateState::Reset()
{
m_sequenceCount = 0;
m_performance = None;
}
/* <4110c7> ../cstrike/dlls/hostage/states/hostage_animate.cpp:20 */
void HostageAnimateState::StartSequence(CHostageImprov *improv, const SeqInfo *seqInfo)
{
if (seqInfo->seqID >= 0)
@ -24,13 +22,12 @@ void HostageAnimateState::StartSequence(CHostageImprov *improv, const SeqInfo *s
m_isHolding = false;
}
/* <41110a> ../cstrike/dlls/hostage/states/hostage_animate.cpp:41 */
void HostageAnimateState::AddSequence(CHostageImprov *improv, const char *seqName, float holdTime, float rate)
{
int seqIndex;
CHostage *hostage = improv->GetEntity();
if (m_sequenceCount >= 8)
if (m_sequenceCount >= MAX_SEQUENCES)
return;
if (seqName != NULL)
@ -40,15 +37,12 @@ void HostageAnimateState::AddSequence(CHostageImprov *improv, const char *seqNam
m_sequence[m_sequenceCount].seqID = seqIndex;
m_sequence[m_sequenceCount].holdTime = holdTime;
m_sequence[m_sequenceCount].rate = rate;
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)
{
CHostage *hostage = improv->GetEntity();
@ -58,16 +52,13 @@ void HostageAnimateState::AddSequence(CHostageImprov *improv, int activity, floa
{
m_sequence[m_sequenceCount].seqID = LookupActivity(model, hostage->pev, activity);
m_sequence[m_sequenceCount].holdTime = holdTime;
m_sequence[m_sequenceCount].rate = rate;
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()
{
if (m_sequence[m_currentSequence].holdTime < 0)
@ -81,13 +72,11 @@ bool HostageAnimateState::IsDoneHolding()
return false;
}
/* <410d45> ../cstrike/dlls/hostage/states/hostage_animate.cpp:103 */
void HostageAnimateState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv)
{
;
}
/* <410fb2> ../cstrike/dlls/hostage/states/hostage_animate.cpp:108 */
void HostageAnimateState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv)
{
if (m_sequenceCount <= 0)
@ -114,13 +103,11 @@ void HostageAnimateState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv)
StartSequence(improv, &m_sequence[m_currentSequence]);
}
/* <410d79> ../cstrike/dlls/hostage/states/hostage_animate.cpp:139 */
void HostageAnimateState::__MAKE_VHOOK(OnExit)(CHostageImprov *improv)
{
;
}
/* <4112d1> ../cstrike/dlls/hostage/states/hostage_animate.cpp:147 */
NOXREF bool HostageAnimateState::IsPlaying(CHostageImprov *improv, const char *seqName) const
{
int id = 0;

View File

@ -1,6 +1,5 @@
#include "precompiled.h"
/* <4205b1> ../cstrike/dlls/hostage/states/hostage_escape.cpp:12 */
void HostageEscapeToCoverState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv)
{
CNavPath path;
@ -36,7 +35,6 @@ void HostageEscapeToCoverState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv)
m_canEscape = true;
}
/* <41fd51> ../cstrike/dlls/hostage/states/hostage_escape.cpp:52 */
void HostageEscapeToCoverState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv)
{
if (!m_canEscape)
@ -69,22 +67,17 @@ void HostageEscapeToCoverState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv)
}
}
/* <41f65f> ../cstrike/dlls/hostage/states/hostage_escape.cpp:95 */
void HostageEscapeToCoverState::__MAKE_VHOOK(OnExit)(CHostageImprov *improv)
{
;
}
/* <41faaf> ../cstrike/dlls/hostage/states/hostage_escape.cpp:100 */
#ifndef HOOK_GAMEDLL
void HostageEscapeToCoverState::__MAKE_VHOOK(OnMoveToFailure)(const Vector &goal, MoveToFailureType reason)
{
HostageEscapeState *escape = static_cast<HostageEscapeState *>(GetParent());
escape->LookAround();
}
#endif // HOOK_GAMEDLL
/* <41fa2f> ../cstrike/dlls/hostage/states/hostage_escape.cpp:110 */
void HostageEscapeLookAroundState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv)
{
m_timer.Start(RANDOM_FLOAT(5, 10));
@ -93,7 +86,6 @@ void HostageEscapeLookAroundState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv)
improv->FaceOutwards();
}
/* <41fc67> ../cstrike/dlls/hostage/states/hostage_escape.cpp:119 */
void HostageEscapeLookAroundState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv)
{
improv->UpdateIdleActivity(ACT_IDLE_SNEAKY, ACT_IDLE_SNEAKY_FIDGET);
@ -105,17 +97,14 @@ void HostageEscapeLookAroundState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv
}
}
/* <41f693> ../cstrike/dlls/hostage/states/hostage_escape.cpp:133 */
void HostageEscapeLookAroundState::__MAKE_VHOOK(OnExit)(CHostageImprov *improv)
{
improv->ClearFaceTo();
}
/* <41fb6b> ../cstrike/dlls/hostage/states/hostage_escape.cpp:145 */
void HostageEscapeState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv)
{
CCSBotManager *ctrl = TheCSBots();
const CCSBotManager::Zone *zone = ctrl->GetRandomZone();
const CCSBotManager::Zone *zone = TheCSBots()->GetRandomZone();
if (zone != NULL)
{
@ -128,7 +117,6 @@ void HostageEscapeState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv)
m_canEscape = true;
}
/* <41fe8e> ../cstrike/dlls/hostage/states/hostage_escape.cpp:167 */
void HostageEscapeState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv)
{
if (!m_canEscape || (improv->IsScared() && improv->GetScareIntensity() == CHostageImprov::TERRIFIED))
@ -176,7 +164,6 @@ void HostageEscapeState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv)
}
}
/* <41f6c7> ../cstrike/dlls/hostage/states/hostage_escape.cpp:230 */
void HostageEscapeState::__MAKE_VHOOK(OnExit)(CHostageImprov *improv)
{
improv->Run();

View File

@ -1,6 +1,5 @@
#include "precompiled.h"
/* <42e3e3> ../cstrike/dlls/hostage/states/hostage_follow.cpp:12 */
void HostageFollowState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv)
{
improv->Chatter(HOSTAGE_CHATTER_START_FOLLOW);
@ -22,7 +21,6 @@ void HostageFollowState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv)
}
}
/* <42deaf> ../cstrike/dlls/hostage/states/hostage_follow.cpp:40 */
void HostageFollowState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv)
{
// if we lost our leader, give up
@ -44,7 +42,7 @@ void HostageFollowState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv)
const float maxPathLength = 3000.0f;
const float giveUpRange = 1000.0f;
if (range > giveUpRange || improv->GetPath()->GetSegmentCount() > 0 && improv->GetPath()->GetLength() > maxPathLength)
if (range > giveUpRange || (improv->GetPath()->GetSegmentCount() > 0 && improv->GetPath()->GetLength() > maxPathLength))
{
improv->Idle();
return;
@ -162,7 +160,7 @@ void HostageFollowState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv)
if (GetGroundHeight(&sideStepPos, &ground))
{
if (abs((int)(ground - improv->GetFeet().z)) < 18.0f)
if (Q_abs(int(ground - improv->GetFeet().z)) < 18.0f)
{
const float push = 20.0f;
Vector lat = cross * push;
@ -194,13 +192,11 @@ void HostageFollowState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv)
}
}
/* <42e1aa> ../cstrike/dlls/hostage/states/hostage_follow.cpp:256 */
void HostageFollowState::__MAKE_VHOOK(OnExit)(CHostageImprov *improv)
{
improv->Stop();
}
/* <42e38f> ../cstrike/dlls/hostage/states/hostage_follow.cpp:270 */
void HostageFollowState::__MAKE_VHOOK(UpdateStationaryAnimation)(CHostageImprov *improv)
{
if (improv->IsScared())

View File

@ -1,6 +1,5 @@
#include "precompiled.h"
/* <43c558> ../cstrike/dlls/hostage/states/hostage_idle.cpp:15 */
void HostageIdleState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv)
{
m_moveState = MoveDone;
@ -8,7 +7,6 @@ void HostageIdleState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv)
m_mustFlee = false;
}
/* <43c197> ../cstrike/dlls/hostage/states/hostage_idle.cpp:23 */
void HostageIdleState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv)
{
if (!UTIL_ActivePlayersInGame())
@ -228,17 +226,14 @@ void HostageIdleState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv)
}
}
}
}
/* <43c59b> ../cstrike/dlls/hostage/states/hostage_idle.cpp:297 */
void HostageIdleState::__MAKE_VHOOK(OnExit)(CHostageImprov *improv)
{
improv->StandUp();
improv->ClearFaceTo();
}
/* <43c783> ../cstrike/dlls/hostage/states/hostage_idle.cpp:307 */
void HostageIdleState::__MAKE_VHOOK(UpdateStationaryAnimation)(CHostageImprov *improv)
{
if (improv->IsScared())

View File

@ -1,13 +1,11 @@
#include "precompiled.h"
/* <449fee> ../cstrike/dlls/hostage/states/hostage_retreat.cpp:12 */
void HostageRetreatState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv)
{
improv->Walk();
improv->MoveTo(improv->GetEntity()->m_vStart);
}
/* <44a220> ../cstrike/dlls/hostage/states/hostage_retreat.cpp:20 */
void HostageRetreatState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv)
{
if (improv->IsAtHome())
@ -39,7 +37,6 @@ void HostageRetreatState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv)
improv->Walk();
}
/* <44a023> ../cstrike/dlls/hostage/states/hostage_retreat.cpp:79 */
void HostageRetreatState::__MAKE_VHOOK(OnExit)(CHostageImprov *improv)
{
;

View File

@ -1,9 +1,7 @@
#include "precompiled.h"
/* <e2209> ../cstrike/dlls/items.cpp:46 */
LINK_ENTITY_TO_CLASS(world_items, CWorldItem);
/* <e173b> ../cstrike/dlls/items.cpp:48 */
void CWorldItem::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "type"))
@ -15,7 +13,6 @@ void CWorldItem::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CBaseEntity::KeyValue(pkvd);
}
/* <e163a> ../cstrike/dlls/items.cpp:59 */
void CWorldItem::__MAKE_VHOOK(Spawn)()
{
CBaseEntity *pEntity = NULL;
@ -48,7 +45,6 @@ void CWorldItem::__MAKE_VHOOK(Spawn)()
REMOVE_ENTITY(edict());
}
/* <e15a6> ../cstrike/dlls/items.cpp:94 */
void CItem::__MAKE_VHOOK(Spawn)()
{
pev->movetype = MOVETYPE_TOSS;
@ -66,7 +62,6 @@ void CItem::__MAKE_VHOOK(Spawn)()
}
}
/* <e16d4> ../cstrike/dlls/items.cpp:112 */
void CItem::ItemTouch(CBaseEntity *pOther)
{
if (!pOther->IsPlayer() || pOther->pev->deadflag != DEAD_NO)
@ -92,7 +87,6 @@ void CItem::ItemTouch(CBaseEntity *pOther)
UTIL_Remove(this);
}
/* <e1566> ../cstrike/dlls/items.cpp:154 */
CBaseEntity *CItem::__MAKE_VHOOK(Respawn)()
{
SetTouch(NULL);
@ -108,7 +102,6 @@ CBaseEntity *CItem::__MAKE_VHOOK(Respawn)()
return this;
}
/* <e1509> ../cstrike/dlls/items.cpp:166 */
void CItem::Materialize()
{
if (pev->effects & EF_NODRAW)
@ -123,7 +116,6 @@ void CItem::Materialize()
SetTouch(&CItem::ItemTouch);
}
/* <e2158> ../cstrike/dlls/items.cpp:190 */
void CItemSuit::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -131,14 +123,12 @@ void CItemSuit::__MAKE_VHOOK(Spawn)()
CItem::Spawn();
}
/* <e13a2> ../cstrike/dlls/items.cpp:196 */
void CItemSuit::__MAKE_VHOOK(Precache)()
{
PRECACHE_MODEL("models/w_kevlar.mdl");
PRECACHE_SOUND("items/tr_kevlar.wav");
}
/* <e1b04> ../cstrike/dlls/items.cpp:201 */
BOOL CItemSuit::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
{
if (pPlayer->pev->weapons & (1 << WEAPON_SUIT))
@ -152,10 +142,8 @@ BOOL CItemSuit::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
return TRUE;
}
/* <e22d3> ../cstrike/dlls/items.cpp:216 */
LINK_ENTITY_TO_CLASS(item_suit, CItemSuit);
/* <e20a7> ../cstrike/dlls/items.cpp:221 */
void CItemBattery::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -163,14 +151,12 @@ void CItemBattery::__MAKE_VHOOK(Spawn)()
CItem::Spawn();
}
/* <e13c9> ../cstrike/dlls/items.cpp:227 */
void CItemBattery::__MAKE_VHOOK(Precache)()
{
PRECACHE_MODEL("models/w_battery.mdl");
PRECACHE_SOUND("items/gunpickup2.wav");
}
/* <e1a20> ../cstrike/dlls/items.cpp:232 */
BOOL CItemBattery::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
{
if (pPlayer->pev->armorvalue < MAX_NORMAL_BATTERY && (pPlayer->pev->weapons & (1 << WEAPON_SUIT)))
@ -189,7 +175,7 @@ BOOL CItemBattery::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
// Suit reports new power level
// For some reason this wasn't working in release build -- round it.
pct = (int)((float)(pPlayer->pev->armorvalue * 100.0f) * (1.0f / MAX_NORMAL_BATTERY) + 0.5f);
pct = int(float(pPlayer->pev->armorvalue * 100.0f) * (1.0f / MAX_NORMAL_BATTERY) + 0.5f);
pct = (pct / 5);
if (pct > 0)
@ -203,10 +189,8 @@ BOOL CItemBattery::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
return FALSE;
}
/* <e239d> ../cstrike/dlls/items.cpp:266 */
LINK_ENTITY_TO_CLASS(item_battery, CItemBattery);
/* <e1ff5> ../cstrike/dlls/items.cpp:271 */
void CItemAntidote::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -214,13 +198,11 @@ void CItemAntidote::__MAKE_VHOOK(Spawn)()
CItem::Spawn();
}
/* <e13f0> ../cstrike/dlls/items.cpp:277 */
void CItemAntidote::__MAKE_VHOOK(Precache)()
{
PRECACHE_MODEL("models/w_antidote.mdl");
}
/* <e1530> ../cstrike/dlls/items.cpp:281 */
BOOL CItemAntidote::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
{
pPlayer->SetSuitUpdate("!HEV_DET4", FALSE, SUIT_NEXT_IN_1MIN);
@ -229,10 +211,8 @@ BOOL CItemAntidote::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
return TRUE;
}
/* <e246a> ../cstrike/dlls/items.cpp:290 */
LINK_ENTITY_TO_CLASS(item_antidote, CItemAntidote);
/* <e1f43> ../cstrike/dlls/items.cpp:295 */
void CItemSecurity::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -240,23 +220,19 @@ void CItemSecurity::__MAKE_VHOOK(Spawn)()
CItem::Spawn();
}
/* <e1416> ../cstrike/dlls/items.cpp:301 */
void CItemSecurity::__MAKE_VHOOK(Precache)()
{
PRECACHE_MODEL("models/w_security.mdl");
}
/* <e143c> ../cstrike/dlls/items.cpp:305 */
BOOL CItemSecurity::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
{
pPlayer->m_rgItems[ ITEM_SECURITY ] += 1;
return TRUE;
}
/* <e2537> ../cstrike/dlls/items.cpp:312 */
LINK_ENTITY_TO_CLASS(item_security, CItemSecurity);
/* <e1e91> ../cstrike/dlls/items.cpp:316 */
void CItemLongJump::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -264,13 +240,11 @@ void CItemLongJump::__MAKE_VHOOK(Spawn)()
CItem::Spawn();
}
/* <e1471> ../cstrike/dlls/items.cpp:322 */
void CItemLongJump::__MAKE_VHOOK(Precache)()
{
PRECACHE_MODEL("models/w_longjump.mdl");
}
/* <e17e9> ../cstrike/dlls/items.cpp:326 */
BOOL CItemLongJump::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
{
if (pPlayer->m_fLongJump)
@ -294,10 +268,8 @@ BOOL CItemLongJump::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
return FALSE;
}
/* <e2604> ../cstrike/dlls/items.cpp:350 */
LINK_ENTITY_TO_CLASS(item_longjump, CItemLongJump);
/* <e1ddf> ../cstrike/dlls/items.cpp:354 */
void CItemKevlar::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -305,13 +277,11 @@ void CItemKevlar::__MAKE_VHOOK(Spawn)()
CItem::Spawn();
}
/* <e1497> ../cstrike/dlls/items.cpp:360 */
void CItemKevlar::__MAKE_VHOOK(Precache)()
{
PRECACHE_MODEL("models/w_kevlar.mdl");
}
/* <e1b9d> ../cstrike/dlls/items.cpp:364 */
BOOL CItemKevlar::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
{
if (pPlayer->m_iKevlar == ARMOR_TYPE_EMPTY)
@ -336,10 +306,8 @@ BOOL CItemKevlar::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
return TRUE;
}
/* <e26d1> ../cstrike/dlls/items.cpp:390 */
LINK_ENTITY_TO_CLASS(item_kevlar, CItemKevlar);
/* <e1d2d> ../cstrike/dlls/items.cpp:395 */
void CItemAssaultSuit::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -347,13 +315,11 @@ void CItemAssaultSuit::__MAKE_VHOOK(Spawn)()
CItem::Spawn();
}
/* <e14bd> ../cstrike/dlls/items.cpp:401 */
void CItemAssaultSuit::__MAKE_VHOOK(Precache)()
{
PRECACHE_MODEL("models/w_assault.mdl");
}
/* <e1942> ../cstrike/dlls/items.cpp:405 */
BOOL CItemAssaultSuit::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
{
pPlayer->m_iKevlar = ARMOR_TYPE_HELMET;
@ -377,10 +343,8 @@ BOOL CItemAssaultSuit::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
return TRUE;
}
/* <e279e> ../cstrike/dlls/items.cpp:429 */
LINK_ENTITY_TO_CLASS(item_assaultsuit, CItemAssaultSuit);
/* <e1c7b> ../cstrike/dlls/items.cpp:434 */
void CItemThighPack::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -388,13 +352,11 @@ void CItemThighPack::__MAKE_VHOOK(Spawn)()
CItem::Spawn();
}
/* <e14e3> ../cstrike/dlls/items.cpp:440 */
void CItemThighPack::__MAKE_VHOOK(Precache)()
{
PRECACHE_MODEL("models/w_thighpack.mdl");
}
/* <e1873> ../cstrike/dlls/items.cpp:444 */
BOOL CItemThighPack::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
{
if (pPlayer->m_iTeam != CT || pPlayer->m_bHasDefuser)
@ -424,5 +386,4 @@ BOOL CItemThighPack::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
return TRUE;
}
/* <e286b> ../cstrike/dlls/items.cpp:474 */
LINK_ENTITY_TO_CLASS(item_thighpack, CItemThighPack);

View File

@ -39,27 +39,25 @@
#define ITEM_BATTERY 4
#define ITEM_SUIT 5
/* <e0742> ../cstrike/dlls/items.h:19 */
class CItem: public CBaseEntity
{
public:
virtual void Spawn();
virtual CBaseEntity *Respawn();
virtual BOOL MyTouch(CBasePlayer *pPlayer) { return FALSE;}
virtual BOOL MyTouch(CBasePlayer *pPlayer) { return FALSE; }
#ifdef HOOK_GAMEDLL
void Spawn_();
CBaseEntity *Respawn_();
#endif // HOOK_GAMEDLL
#endif
public:
void EXPORT ItemTouch(CBaseEntity *pOther);
void EXPORT Materialize();
};
/* <e06f5> ../cstrike/dlls/items.cpp:38 */
class CWorldItem: public CBaseEntity
{
public:
@ -71,13 +69,12 @@ public:
void Spawn_();
void KeyValue_(KeyValueData *pkvd);
#endif // HOOK_GAMEDLL
#endif
public:
int m_iType;
};
/* <e075d> ../cstrike/dlls/items.cpp:188 */
class CItemSuit: public CItem
{
public:
@ -91,11 +88,10 @@ public:
void Precache_();
BOOL MyTouch_(CBasePlayer *pPlayer);
#endif // HOOK_GAMEDLL
#endif
};
/* <e07aa> ../cstrike/dlls/items.cpp:219 */
class CItemBattery: public CItem
{
public:
@ -109,11 +105,10 @@ public:
void Precache_();
BOOL MyTouch_(CBasePlayer *pPlayer);
#endif // HOOK_GAMEDLL
#endif
};
/* <e07f7> ../cstrike/dlls/items.cpp:269 */
class CItemAntidote: public CItem
{
public:
@ -127,11 +122,10 @@ public:
void Precache_();
BOOL MyTouch_(CBasePlayer *pPlayer);
#endif // HOOK_GAMEDLL
#endif
};
/* <e084a> ../cstrike/dlls/items.cpp:293 */
class CItemSecurity: public CItem
{
public:
@ -145,11 +139,10 @@ public:
void Precache_();
BOOL MyTouch_(CBasePlayer *pPlayer);
#endif // HOOK_GAMEDLL
#endif
};
/* <e089d> ../cstrike/dlls/items.cpp:314 */
class CItemLongJump: public CItem
{
public:
@ -163,11 +156,10 @@ public:
void Precache_();
BOOL MyTouch_(CBasePlayer *pPlayer);
#endif // HOOK_GAMEDLL
#endif
};
/* <e08eb> ../cstrike/dlls/items.cpp:352 */
class CItemKevlar: public CItem
{
public:
@ -181,11 +173,10 @@ public:
void Precache_();
BOOL MyTouch_(CBasePlayer *pPlayer);
#endif // HOOK_GAMEDLL
#endif
};
/* <e093e> ../cstrike/dlls/items.cpp:393 */
class CItemAssaultSuit: public CItem
{
public:
@ -199,11 +190,10 @@ public:
void Precache_();
BOOL MyTouch_(CBasePlayer *pPlayer);
#endif // HOOK_GAMEDLL
#endif
};
/* <e0991> ../cstrike/dlls/items.cpp:432 */
class CItemThighPack: public CItem
{
public:
@ -217,7 +207,7 @@ public:
void Precache_();
BOOL MyTouch_(CBasePlayer *pPlayer);
#endif // HOOK_GAMEDLL
#endif
};

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