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

@ -9,52 +9,50 @@ apply plugin: 'cpp'
apply plugin: IccCompilerPlugin apply plugin: IccCompilerPlugin
void setupToolchain(NativeBinarySpec b) { void setupToolchain(NativeBinarySpec b) {
def cfg = rootProject.createToolchainConfig(b) def cfg = rootProject.createToolchainConfig(b)
ToolchainConfigUtils.apply(project, cfg, b) ToolchainConfigUtils.apply(project, cfg, b)
} }
model { model {
buildTypes { buildTypes {
debug debug
release release
} }
platforms { platforms {
x86 { x86 {
architecture "x86" architecture "x86"
} }
} }
toolChains { toolChains {
visualCpp(VisualCpp) { visualCpp(VisualCpp) {
} }
icc(Icc) { icc(Icc) {
} }
} }
components { components {
cppunitlite(NativeLibrarySpec) { cppunitlite(NativeLibrarySpec) {
targetPlatform 'x86' targetPlatform 'x86'
sources { sources {
cppul_main(CppSourceSet) { cppul_main(CppSourceSet) {
source { source {
srcDir "src" srcDir "src"
include "**/*.cpp" include "**/*.cpp"
} }
exportedHeaders { exportedHeaders {
srcDir "include" srcDir "include"
} }
} }
} }
binaries.all { NativeBinarySpec b -> binaries.all { NativeBinarySpec b ->
project.setupToolchain(b) project.setupToolchain(b)
} }
} }
} }
} }

View File

@ -55,12 +55,8 @@ void createIntergrationTestTask(NativeBinarySpec b) {
if (!GradleCppUtils.windows) return if (!GradleCppUtils.windows) return
if (regamedllFixes) return if (regamedllFixes) return
def libLinkTask = GradleCppUtils.getLinkTask(b)
String unitTestTask = b.hasProperty('cppUnitTestTask') ? b.cppUnitTestTask : null 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) def demoItgTestTask = project.tasks.create(b.namingScheme.getTaskName('demoItgTest'), RegamedllPlayTestTask)
demoItgTestTask.with { demoItgTestTask.with {
regamedllImageRoot = new File(project.projectDir, '_regamedllTestImg') regamedllImageRoot = new File(project.projectDir, '_regamedllTestImg')
@ -69,12 +65,10 @@ void createIntergrationTestTask(NativeBinarySpec b) {
testFor = b testFor = b
//inputs/outputs for up-to-date check //inputs/outputs for up-to-date check
inputs.files depFiles
inputs.files testDemos.files inputs.files testDemos.files
outputs.dir regamedllTestLogs outputs.dir regamedllTestLogs
//dependencies on library and test executable //dependencies on test executable
dependsOn libLinkTask
if (unitTestTask) { if (unitTestTask) {
dependsOn unitTestTask dependsOn unitTestTask
} }
@ -88,17 +82,6 @@ void createIntergrationTestTask(NativeBinarySpec b) {
b.buildTask.dependsOn demoItgTestTask 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) { void postEvaluate(NativeBinarySpec b) {
// attach generateAppVersion task to all 'compile source' tasks // attach generateAppVersion task to all 'compile source' tasks
@ -106,7 +89,6 @@ void postEvaluate(NativeBinarySpec b) {
t.dependsOn project.generateAppVersion t.dependsOn project.generateAppVersion
} }
setupUnitTests(b)
createIntergrationTestTask(b) createIntergrationTestTask(b)
} }
@ -117,7 +99,7 @@ void setupToolchain(NativeBinarySpec b)
boolean regamedllFixes = b.flavor.name.contains('regamedllFixes') boolean regamedllFixes = b.flavor.name.contains('regamedllFixes')
ToolchainConfig cfg = rootProject.createToolchainConfig(b) 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) if (unitTestExecutable)
{ {
@ -147,9 +129,6 @@ void setupToolchain(NativeBinarySpec b)
cfg.linkerOptions.randomizedBaseAddress = false cfg.linkerOptions.randomizedBaseAddress = false
cfg.linkerOptions.baseAddress = '0x4970000' 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) else if (cfg instanceof GccToolchainConfig)
{ {
@ -172,8 +151,7 @@ void setupToolchain(NativeBinarySpec b)
cfg.linkerOptions.args '-no-opt-class-analysis' cfg.linkerOptions.args '-no-opt-class-analysis'
cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp', '-g' cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp', '-g'
cfg.projectLibpath(project, '/lib/linux32') cfg.extraLibs 'dl', 'm', 'stdc++'
cfg.extraLibs 'dl', 'm', 'stdc++', 'steam_api'
} }
if (mpLib && GradleCppUtils.windows && !unitTestExecutable) if (mpLib && GradleCppUtils.windows && !unitTestExecutable)
@ -183,8 +161,6 @@ void setupToolchain(NativeBinarySpec b)
if (!unitTestExecutable) if (!unitTestExecutable)
{ {
//cfg.singleDefines 'CSTRIKE'
if (!mpLib) if (!mpLib)
{ {
cfg.singleDefines 'HOOK_GAMEDLL' cfg.singleDefines 'HOOK_GAMEDLL'
@ -201,7 +177,6 @@ void setupToolchain(NativeBinarySpec b)
} }
ToolchainConfigUtils.apply(project, cfg, b) ToolchainConfigUtils.apply(project, cfg, b)
GradleCppUtils.onTasksCreated(project, 'postEvaluate', { GradleCppUtils.onTasksCreated(project, 'postEvaluate', {
postEvaluate(b) postEvaluate(b)
}) })
@ -213,27 +188,21 @@ class RegamedllSrc {
source { source {
srcDirs "engine", "dlls", "game_shared", "pm_shared", "regamedll", "public", "version" srcDirs "engine", "dlls", "game_shared", "pm_shared", "regamedll", "public", "version"
if (GradleCppUtils.windows) {
srcDirs "testsuite"
}
include "**/*.cpp" include "**/*.cpp"
exclude "precompiled.cpp" exclude "precompiled.cpp"
exclude "tier0/dbg.cpp", "utlsymbol.cpp", "utlbuffer.cpp" exclude "tier0/dbg.cpp", "utlsymbol.cpp", "utlbuffer.cpp"
if (GradleCppUtils.windows) { if (GradleCppUtils.windows)
{
exclude "tier0/platform_linux.cpp" exclude "tier0/platform_linux.cpp"
} else { }
else
{
exclude "tier0/platform_win32.cpp" exclude "tier0/platform_win32.cpp"
exclude "classes_dummy.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) { h.regamedll_hooker_src(CppSourceSet) {
source { source {
srcDirs "hookers" 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) { static void regamedll_mp_src(def h) {
h.regamedll_hooker_main_src(CppSourceSet) { h.regamedll_mp_src(CppSourceSet) {
source {
srcDirs "hookers"
include "main.cpp"
}
}
}
static void regamedll_mp_main_src(def h) {
h.regamedll_mp_main_src(CppSourceSet) {
source { source {
srcDirs "hookers" srcDirs "hookers"
include "main_mp.cpp" include "main_mp.cpp"
exclude "memory.cpp"
} }
} }
} }
@ -318,7 +277,6 @@ model {
RegamedllSrc.regamedll_pch(it) RegamedllSrc.regamedll_pch(it)
RegamedllSrc.regamedll_src(it) RegamedllSrc.regamedll_src(it)
RegamedllSrc.regamedll_hooker_src(it) RegamedllSrc.regamedll_hooker_src(it)
RegamedllSrc.regamedll_hooker_main_src(it)
} }
binaries.all { NativeBinarySpec b -> project.setupToolchain(b) } binaries.all { NativeBinarySpec b -> project.setupToolchain(b) }
@ -330,7 +288,7 @@ model {
sources { sources {
RegamedllSrc.regamedll_pch(it) RegamedllSrc.regamedll_pch(it)
RegamedllSrc.regamedll_src(it) RegamedllSrc.regamedll_src(it)
RegamedllSrc.regamedll_mp_main_src(it) RegamedllSrc.regamedll_mp_src(it)
} }
binaries.all { NativeBinarySpec b -> project.setupToolchain(b) } binaries.all { NativeBinarySpec b -> project.setupToolchain(b) }
} }

View File

@ -32,7 +32,9 @@
#pragma once #pragma once
#endif #endif
#include "maintypes.h"
#include "custom.h" #include "custom.h"
#include "bspfile.h"
#define STUDIO_RENDER 1 #define STUDIO_RENDER 1
#define STUDIO_EVENTS 2 #define STUDIO_EVENTS 2
@ -67,231 +69,231 @@ typedef enum modtype_e
mod_studio, mod_studio,
} modtype_t; } modtype_t;
// must match definition in modelgen.h // must match definition in modelgen.h
#ifndef SYNCTYPE_T #ifndef SYNCTYPE_T
#define SYNCTYPE_T #define SYNCTYPE_T
typedef enum typedef enum
{ {
ST_SYNC = 0, ST_SYNC = 0,
ST_RAND ST_RAND
} synctype_t; } synctype_t;
#endif #endif
// plane_t structure // plane_t structure
typedef struct mplane_s typedef struct mplane_s
{ {
vec3_t normal; // surface normal vec3_t normal; // surface normal
float dist; // closest appoach to origin float dist; // closest appoach to origin
byte type; // for texture axis selection and fast side tests byte type; // for texture axis selection and fast side tests
byte signbits; // signx + signy<<1 + signz<<1 byte signbits; // signx + signy<<1 + signz<<1
byte pad[2]; byte pad[2];
} mplane_t; } mplane_t;
typedef struct typedef struct
{ {
vec3_t position; vec3_t position;
} mvertex_t; } mvertex_t;
typedef struct typedef struct
{ {
unsigned short v[2]; unsigned short v[2];
unsigned int cachededgeoffset; unsigned int cachededgeoffset;
} medge_t; } medge_t;
typedef struct texture_s typedef struct texture_s
{ {
char name[16]; char name[16];
unsigned width; unsigned width;
unsigned height; unsigned height;
int anim_total; // total tenths in sequence ( 0 = no) int anim_total; // total tenths in sequence ( 0 = no)
int anim_min, anim_max; // time for this frame min <=time< max int anim_min, anim_max; // time for this frame min <=time< max
struct texture_s *anim_next; // in the animation sequence struct texture_s *anim_next; // in the animation sequence
struct texture_s *alternate_anims; // bmodels in frame 1 use these struct texture_s *alternate_anims; // bmodels in frame 1 use these
unsigned offsets[ MIPLEVELS ]; // four mip maps stored unsigned offsets[ MIPLEVELS ]; // four mip maps stored
unsigned paloffset; unsigned paloffset;
} texture_t; } texture_t;
typedef struct typedef struct
{ {
float vecs[2][4]; // [s/t] unit vectors in world space. float vecs[2][4]; // [s/t] unit vectors in world space.
// [i][3] is the s/t offset relative to the origin. // [i][3] is the s/t offset relative to the origin.
// s or t = dot(3Dpoint,vecs[i])+vecs[i][3] // s or t = dot(3Dpoint,vecs[i])+vecs[i][3]
float mipadjust; // ?? mipmap limits for very small surfaces float mipadjust; // ?? mipmap limits for very small surfaces
texture_t *texture; texture_t *texture;
int flags; // sky or slime, no lightmap or 256 subdivision int flags; // sky or slime, no lightmap or 256 subdivision
} mtexinfo_t; } mtexinfo_t;
typedef struct mnode_s typedef struct mnode_s
{ {
int contents; // 0, to differentiate from leafs int contents; // 0, to differentiate from leafs
int visframe; // node needs to be traversed if current int visframe; // node needs to be traversed if current
short minmaxs[6]; // for bounding box culling short minmaxs[6]; // for bounding box culling
struct mnode_s *parent; struct mnode_s *parent;
mplane_t *plane; mplane_t *plane;
struct mnode_s *children[2]; struct mnode_s *children[2];
unsigned short firstsurface; unsigned short firstsurface;
unsigned short numsurfaces; unsigned short numsurfaces;
} mnode_t; } mnode_t;
typedef struct msurface_s msurface_t; typedef struct msurface_s msurface_t;
typedef struct decal_s decal_t; typedef struct decal_s decal_t;
// JAY: Compress this as much as possible // JAY: Compress this as much as possible
struct decal_s struct decal_s
{ {
decal_t *pnext; // linked list for each surface decal_t *pnext; // linked list for each surface
msurface_t *psurface; // Surface id for persistence / unlinking msurface_t *psurface; // Surface id for persistence / unlinking
short dx; // Offsets into surface texture (in texture coordinates, so we don't need floats) short dx; // Offsets into surface texture (in texture coordinates, so we don't need floats)
short dy; short dy;
short texture; // Decal texture short texture; // Decal texture
byte scale; // Pixel scale byte scale; // Pixel scale
byte flags; // Decal flags byte flags; // Decal flags
short entityIndex; // Entity this is attached to short entityIndex; // Entity this is attached to
}; };
typedef struct mleaf_s typedef struct mleaf_s
{ {
// common with node // common with node
int contents; // wil be a negative contents number int contents; // wil be a negative contents number
int visframe; // node needs to be traversed if current int visframe; // node needs to be traversed if current
short minmaxs[6]; // for bounding box culling short minmaxs[6]; // for bounding box culling
struct mnode_s *parent; struct mnode_s *parent;
// leaf specific // leaf specific
byte *compressed_vis; byte *compressed_vis;
struct efrag_s *efrags; struct efrag_s *efrags;
msurface_t **firstmarksurface; msurface_t **firstmarksurface;
int nummarksurfaces; int nummarksurfaces;
int key; // BSP sequence number for leaf's contents int key; // BSP sequence number for leaf's contents
byte ambient_sound_level[ NUM_AMBIENTS ]; byte ambient_sound_level[ NUM_AMBIENTS ];
} mleaf_t; } mleaf_t;
struct msurface_s struct msurface_s
{ {
int visframe; // should be drawn when node is crossed int visframe; // should be drawn when node is crossed
int dlightframe; // last frame the surface was checked by an animated light int dlightframe; // last frame the surface was checked by an animated light
int dlightbits; // dynamically generated. Indicates if the surface illumination int dlightbits; // dynamically generated. Indicates if the surface illumination
// is modified by an animated light. // is modified by an animated light.
mplane_t *plane; // pointer to shared plane mplane_t *plane; // pointer to shared plane
int flags; // see SURF_ #defines int flags; // see SURF_ #defines
int firstedge; // look up in model->surfedges[], negative numbers int firstedge; // look up in model->surfedges[], negative numbers
int numedges; // are backwards edges int numedges; // are backwards edges
struct surfcache_s *cachespots[ MIPLEVELS ]; struct surfcache_s *cachespots[ MIPLEVELS ];
short texturemins[2]; // smallest s/t position on the surface. short texturemins[2]; // smallest s/t position on the surface.
short extents[2]; // ?? s/t texture size, 1..256 for all non-sky surfaces short extents[2]; // ?? s/t texture size, 1..256 for all non-sky surfaces
mtexinfo_t *texinfo; mtexinfo_t *texinfo;
byte styles[ MAXLIGHTMAPS ]; // index into d_lightstylevalue[] for animated lights byte styles[ MAXLIGHTMAPS ]; // index into d_lightstylevalue[] for animated lights
// no one surface can be effected by more than 4 // no one surface can be effected by more than 4
// animated lights. // animated lights.
color24 *samples; color24 *samples;
decal_t *pdecals; decal_t *pdecals;
}; };
typedef struct hull_s typedef struct hull_s
{ {
dclipnode_t *clipnodes; dclipnode_t *clipnodes;
mplane_t *planes; mplane_t *planes;
int firstclipnode; int firstclipnode;
int lastclipnode; int lastclipnode;
vec3_t clip_mins; vec3_t clip_mins;
vec3_t clip_maxs; vec3_t clip_maxs;
} hull_t; } hull_t;
#if !defined(CACHE_USER) && !defined(QUAKEDEF_H) #if !defined(CACHE_USER) && !defined(QUAKEDEF_H)
#define CACHE_USER #define CACHE_USER
typedef struct cache_user_s typedef struct cache_user_s
{ {
void *data; void *data;
} cache_user_t; } cache_user_t;
#endif #endif
typedef struct model_s typedef struct model_s
{ {
char name[ MAX_MODEL_NAME ]; char name[ MAX_MODEL_NAME ];
qboolean needload; // bmodels and sprites don't cache normally qboolean needload; // bmodels and sprites don't cache normally
modtype_t type; modtype_t type;
int numframes; int numframes;
synctype_t synctype; synctype_t synctype;
int flags; int flags;
// volume occupied by the model // volume occupied by the model
vec3_t mins, maxs; vec3_t mins, maxs;
float radius; float radius;
// brush model // brush model
int firstmodelsurface, nummodelsurfaces; int firstmodelsurface, nummodelsurfaces;
int numsubmodels; int numsubmodels;
dmodel_t *submodels; dmodel_t *submodels;
int numplanes; int numplanes;
mplane_t *planes; mplane_t *planes;
int numleafs; // number of visible leafs, not counting 0 int numleafs; // number of visible leafs, not counting 0
struct mleaf_s *leafs; struct mleaf_s *leafs;
int numvertexes; int numvertexes;
mvertex_t *vertexes; mvertex_t *vertexes;
int numedges; int numedges;
medge_t *edges; medge_t *edges;
int numnodes; int numnodes;
mnode_t *nodes; mnode_t *nodes;
int numtexinfo; int numtexinfo;
mtexinfo_t *texinfo; mtexinfo_t *texinfo;
int numsurfaces; int numsurfaces;
msurface_t *surfaces; msurface_t *surfaces;
int numsurfedges; int numsurfedges;
int *surfedges; int *surfedges;
int numclipnodes; int numclipnodes;
dclipnode_t *clipnodes; dclipnode_t *clipnodes;
int nummarksurfaces; int nummarksurfaces;
msurface_t **marksurfaces; msurface_t **marksurfaces;
hull_t hulls[ MAX_MAP_HULLS ]; hull_t hulls[ MAX_MAP_HULLS ];
int numtextures; int numtextures;
texture_t **textures; texture_t **textures;
byte *visdata; byte *visdata;
color24 *lightdata; color24 *lightdata;
char *entities; char *entities;
// additional model data // additional model data
cache_user_t cache; // only access through Mod_Extradata cache_user_t cache; // only access through Mod_Extradata
} model_t; } model_t;
typedef vec_t vec4_t[4]; typedef vec_t vec4_t[4];
typedef struct alight_s typedef struct alight_s
{ {
int ambientlight; // clip at 128 int ambientlight; // clip at 128
int shadelight; // clip at 192 - ambientlight int shadelight; // clip at 192 - ambientlight
vec3_t color; vec3_t color;
float *plightvec; float *plightvec;
} alight_t; } alight_t;
typedef struct auxvert_s typedef struct auxvert_s
@ -299,41 +301,41 @@ typedef struct auxvert_s
float fv[3]; // viewspace x, y float fv[3]; // viewspace x, y
} auxvert_t; } auxvert_t;
#define MAX_INFO_STRING 256 #define MAX_INFO_STRING 256
#define MAX_SCOREBOARDNAME 32 #define MAX_SCOREBOARDNAME 32
typedef struct player_info_s typedef struct player_info_s
{ {
// User id on server // User id on server
int userid; int userid;
// User info string // User info string
char userinfo[ MAX_INFO_STRING ]; char userinfo[ MAX_INFO_STRING ];
// Name // Name
char name[ MAX_SCOREBOARDNAME ]; char name[ MAX_SCOREBOARDNAME ];
// Spectator or not, unused // Spectator or not, unused
int spectator; int spectator;
int ping; int ping;
int packet_loss; int packet_loss;
// skin information // skin information
char model[MAX_QPATH]; char model[MAX_QPATH];
int topcolor; int topcolor;
int bottomcolor; int bottomcolor;
// last frame rendered // last frame rendered
int renderframe; int renderframe;
// Gait frame estimation // Gait frame estimation
int gaitsequence; int gaitsequence;
float gaitframe; float gaitframe;
float gaityaw; float gaityaw;
vec3_t prevgaitorigin; vec3_t prevgaitorigin;
customization_t customdata; customization_t customdata;
} player_info_t; } player_info_t;
#endif // COM_MODEL_H #endif // COM_MODEL_H

View File

@ -33,10 +33,26 @@
#endif #endif
// buttons // buttons
#ifndef IN_BUTTONS_H
#include "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_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_SWIM (1<<1) // Changes the SV_Movestep() behavior to not need to be on ground (but stay in water)
#define FL_CONVEYOR (1<<2) #define FL_CONVEYOR (1<<2)
@ -139,81 +155,81 @@
#define TE_EXPLFLAG_NOSOUND 4 // do not play client explosion sound #define TE_EXPLFLAG_NOSOUND 4 // do not play client explosion sound
#define TE_EXPLFLAG_NOPARTICLES 8 // do not draw particles #define TE_EXPLFLAG_NOPARTICLES 8 // do not draw particles
#define TE_TAREXPLOSION 4 // Quake1 "tarbaby" explosion with sound #define TE_TAREXPLOSION 4 // Quake1 "tarbaby" explosion with sound
#define TE_SMOKE 5 // alphablend sprite, move vertically 30 pps #define TE_SMOKE 5 // alphablend sprite, move vertically 30 pps
#define TE_TRACER 6 // tracer effect from point to point #define TE_TRACER 6 // tracer effect from point to point
#define TE_LIGHTNING 7 // TE_BEAMPOINTS with simplified parameters #define TE_LIGHTNING 7 // TE_BEAMPOINTS with simplified parameters
#define TE_BEAMENTS 8 #define TE_BEAMENTS 8
#define TE_SPARKS 9 // 8 random tracers with gravity, ricochet sprite #define TE_SPARKS 9 // 8 random tracers with gravity, ricochet sprite
#define TE_LAVASPLASH 10 // Quake1 lava splash #define TE_LAVASPLASH 10 // Quake1 lava splash
#define TE_TELEPORT 11 // Quake1 teleport splash #define TE_TELEPORT 11 // Quake1 teleport splash
#define TE_EXPLOSION2 12 // Quake1 colormaped (base palette) particle explosion with sound #define TE_EXPLOSION2 12 // Quake1 colormaped (base palette) particle explosion with sound
#define TE_BSPDECAL 13 // Decal from the .BSP file #define TE_BSPDECAL 13 // Decal from the .BSP file
#define TE_IMPLOSION 14 // tracers moving toward a point #define TE_IMPLOSION 14 // tracers moving toward a point
#define TE_SPRITETRAIL 15 // line of moving glow sprites with gravity, fadeout, and collisions #define TE_SPRITETRAIL 15 // line of moving glow sprites with gravity, fadeout, and collisions
#define TE_BEAM 16 // obsolete #define TE_BEAM 16 // obsolete
#define TE_SPRITE 17 // additive sprite, plays 1 cycle #define TE_SPRITE 17 // additive sprite, plays 1 cycle
#define TE_BEAMSPRITE 18 // A beam with a sprite at the end #define TE_BEAMSPRITE 18 // A beam with a sprite at the end
#define TE_BEAMTORUS 19 // screen aligned beam ring, expands to max radius over lifetime #define TE_BEAMTORUS 19 // screen aligned beam ring, expands to max radius over lifetime
#define TE_BEAMDISK 20 // disk that expands to max radius over lifetime #define TE_BEAMDISK 20 // disk that expands to max radius over lifetime
#define TE_BEAMCYLINDER 21 // cylinder that expands to max radius over lifetime #define TE_BEAMCYLINDER 21 // cylinder that expands to max radius over lifetime
#define TE_BEAMFOLLOW 22 // create a line of decaying beam segments until entity stops moving #define TE_BEAMFOLLOW 22 // create a line of decaying beam segments until entity stops moving
#define TE_GLOWSPRITE 23 #define TE_GLOWSPRITE 23
#define TE_BEAMRING 24 // connect a beam ring to two entities #define TE_BEAMRING 24 // connect a beam ring to two entities
#define TE_STREAK_SPLASH 25 // oriented shower of tracers #define TE_STREAK_SPLASH 25 // oriented shower of tracers
#define TE_BEAMHOSE 26 // obsolete #define TE_BEAMHOSE 26 // obsolete
#define TE_DLIGHT 27 // dynamic light, effect world, minor entity effect #define TE_DLIGHT 27 // dynamic light, effect world, minor entity effect
#define TE_ELIGHT 28 // point entity light, no world effect #define TE_ELIGHT 28 // point entity light, no world effect
#define TE_TEXTMESSAGE 29 #define TE_TEXTMESSAGE 29
#define TE_LINE 30 #define TE_LINE 30
#define TE_BOX 31 #define TE_BOX 31
#define TE_KILLBEAM 99 // kill all beams attached to entity #define TE_KILLBEAM 99 // kill all beams attached to entity
#define TE_LARGEFUNNEL 100 #define TE_LARGEFUNNEL 100
#define TE_BLOODSTREAM 101 // particle spray #define TE_BLOODSTREAM 101 // particle spray
#define TE_SHOWLINE 102 // line of particles every 5 units, dies in 30 seconds #define TE_SHOWLINE 102 // line of particles every 5 units, dies in 30 seconds
#define TE_BLOOD 103 // particle spray #define TE_BLOOD 103 // particle spray
#define TE_DECAL 104 // Decal applied to a brush entity (not the world) #define TE_DECAL 104 // Decal applied to a brush entity (not the world)
#define TE_FIZZ 105 // create alpha sprites inside of entity, float upwards #define TE_FIZZ 105 // create alpha sprites inside of entity, float upwards
#define TE_MODEL 106 // create a moving model that bounces and makes a sound when it hits #define TE_MODEL 106 // create a moving model that bounces and makes a sound when it hits
#define TE_EXPLODEMODEL 107 // spherical shower of models, picks from set #define TE_EXPLODEMODEL 107 // spherical shower of models, picks from set
#define TE_BREAKMODEL 108 // box of models or sprites #define TE_BREAKMODEL 108 // box of models or sprites
#define TE_GUNSHOTDECAL 109 // decal and ricochet sound #define TE_GUNSHOTDECAL 109 // decal and ricochet sound
#define TE_SPRITE_SPRAY 110 // spay of alpha sprites #define TE_SPRITE_SPRAY 110 // spay of alpha sprites
#define TE_ARMOR_RICOCHET 111 // quick spark sprite, client ricochet sound. #define TE_ARMOR_RICOCHET 111 // quick spark sprite, client ricochet sound.
#define TE_PLAYERDECAL 112 // ??? #define TE_PLAYERDECAL 112 // ???
#define TE_BUBBLES 113 // create alpha sprites inside of box, float upwards #define TE_BUBBLES 113 // create alpha sprites inside of box, float upwards
#define TE_BUBBLETRAIL 114 // create alpha sprites along a line, float upwards #define TE_BUBBLETRAIL 114 // create alpha sprites along a line, float upwards
#define TE_BLOODSPRITE 115 // spray of opaque sprite1's that fall, single sprite2 for 1..2 secs (this is a high-priority tent) #define TE_BLOODSPRITE 115 // spray of opaque sprite1's that fall, single sprite2 for 1..2 secs (this is a high-priority tent)
#define TE_WORLDDECAL 116 // Decal applied to the world brush #define TE_WORLDDECAL 116 // Decal applied to the world brush
#define TE_WORLDDECALHIGH 117 // Decal (with texture index > 256) applied to world brush #define TE_WORLDDECALHIGH 117 // Decal (with texture index > 256) applied to world brush
#define TE_DECALHIGH 118 // Same as TE_DECAL, but the texture index was greater than 256 #define TE_DECALHIGH 118 // Same as TE_DECAL, but the texture index was greater than 256
#define TE_PROJECTILE 119 // Makes a projectile (like a nail) (this is a high-priority tent) #define TE_PROJECTILE 119 // Makes a projectile (like a nail) (this is a high-priority tent)
#define TE_SPRAY 120 // Throws a shower of sprites or models #define TE_SPRAY 120 // Throws a shower of sprites or models
#define TE_PLAYERSPRITES 121 // sprites emit from a player's bounding box (ONLY use for players!) #define TE_PLAYERSPRITES 121 // sprites emit from a player's bounding box (ONLY use for players!)
#define TE_PARTICLEBURST 122 // very similar to lavasplash. #define TE_PARTICLEBURST 122 // very similar to lavasplash.
#define TE_FIREFIELD 123 // makes a field of fire. #define TE_FIREFIELD 123 // makes a field of fire.
// to keep network traffic low, this message has associated flags that fit into a byte: // to keep network traffic low, this message has associated flags that fit into a byte:
#define TEFIRE_FLAG_ALLFLOAT 1 // all sprites will drift upwards as they animate #define TEFIRE_FLAG_ALLFLOAT 1 // all sprites will drift upwards as they animate
#define TEFIRE_FLAG_SOMEFLOAT 2 // some of the sprites will drift upwards. (50% chance) #define TEFIRE_FLAG_SOMEFLOAT 2 // some of the sprites will drift upwards. (50% chance)
#define TEFIRE_FLAG_LOOP 4 // if set, sprite plays at 15 fps, otherwise plays at whatever rate stretches the animation over the sprite's duration. #define TEFIRE_FLAG_LOOP 4 // if set, sprite plays at 15 fps, otherwise plays at whatever rate stretches the animation over the sprite's duration.
#define TEFIRE_FLAG_ALPHA 8 // if set, sprite is rendered alpha blended at 50% else, opaque #define TEFIRE_FLAG_ALPHA 8 // if set, sprite is rendered alpha blended at 50% else, opaque
#define TEFIRE_FLAG_PLANAR 16 // if set, all fire sprites have same initial Z instead of randomly filling a cube. #define TEFIRE_FLAG_PLANAR 16 // if set, all fire sprites have same initial Z instead of randomly filling a cube.
#define TEFIRE_FLAG_ADDITIVE 32 // if set, sprite is rendered non-opaque with additive #define TEFIRE_FLAG_ADDITIVE 32 // if set, sprite is rendered non-opaque with additive
#define TE_PLAYERATTACHMENT 124 // attaches a TENT to a player (this is a high-priority tent) #define TE_PLAYERATTACHMENT 124 // attaches a TENT to a player (this is a high-priority tent)
#define TE_KILLPLAYERATTACHMENTS 125 // will expire all TENTS attached to a player. #define TE_KILLPLAYERATTACHMENTS 125 // will expire all TENTS attached to a player.
#define TE_MULTIGUNSHOT 126 // much more compact shotgun message #define TE_MULTIGUNSHOT 126 // much more compact shotgun message
#define TE_USERTRACER 127 // larger message than the standard tracer, but allows some customization. #define TE_USERTRACER 127 // larger message than the standard tracer, but allows some customization.
#define MSG_BROADCAST 0 // unreliable to all #define MSG_BROADCAST 0 // unreliable to all
#define MSG_ONE 1 // reliable to one (msg_entity) #define MSG_ONE 1 // reliable to one (msg_entity)
#define MSG_ALL 2 // reliable to all #define MSG_ALL 2 // reliable to all
#define MSG_INIT 3 // write to the init string #define MSG_INIT 3 // write to the init string
#define MSG_PVS 4 // Ents in PVS of org #define MSG_PVS 4 // Ents in PVS of org
#define MSG_PAS 5 // Ents in PAS of org #define MSG_PAS 5 // Ents in PAS of org
#define MSG_PVS_R 6 // Reliable to PVS #define MSG_PVS_R 6 // Reliable to PVS
#define MSG_PAS_R 7 // Reliable to PAS #define MSG_PAS_R 7 // Reliable to PAS
#define MSG_ONE_UNRELIABLE 8 // Send to one client, but don't put in reliable stream, put in unreliable datagram ( could be dropped ) #define MSG_ONE_UNRELIABLE 8 // Send to one client, but don't put in reliable stream, put in unreliable datagram ( could be dropped )
#define MSG_SPEC 9 // Sends to all spectator proxies #define MSG_SPEC 9 // Sends to all spectator proxies
// contents of a spot in the world // contents of a spot in the world
#define CONTENTS_EMPTY -1 #define CONTENTS_EMPTY -1
@ -242,11 +258,11 @@
#define CHAN_VOICE 2 #define CHAN_VOICE 2
#define CHAN_ITEM 3 #define CHAN_ITEM 3
#define CHAN_BODY 4 #define CHAN_BODY 4
#define CHAN_STREAM 5 // allocate stream channel from the static or dynamic area #define CHAN_STREAM 5 // allocate stream channel from the static or dynamic area
#define CHAN_STATIC 6 // allocate channel from the static area #define CHAN_STATIC 6 // allocate channel from the static area
#define CHAN_NETWORKVOICE_BASE 7 // voice data coming across the network #define CHAN_NETWORKVOICE_BASE 7 // voice data coming across the network
#define CHAN_NETWORKVOICE_END 500 // network voice data reserves slots (CHAN_NETWORKVOICE_BASE through CHAN_NETWORKVOICE_END). #define CHAN_NETWORKVOICE_END 500 // network voice data reserves slots (CHAN_NETWORKVOICE_BASE through CHAN_NETWORKVOICE_END).
#define CHAN_BOT 501 // channel used for bot chatter. #define CHAN_BOT 501 // channel used for bot chatter.
// attenuation values // attenuation values
#define ATTN_NONE 0 #define ATTN_NONE 0
@ -255,8 +271,8 @@
#define ATTN_STATIC 1.25 #define ATTN_STATIC 1.25
// pitch values // pitch values
#define PITCH_NORM 100 // non-pitch shifted #define PITCH_NORM 100 // non-pitch shifted
#define PITCH_LOW 95 // other values are possible - 0-255, where 255 is very high #define PITCH_LOW 95 // other values are possible - 0-255, where 255 is very high
#define PITCH_HIGH 120 #define PITCH_HIGH 120
// volume values // volume values
@ -267,8 +283,8 @@
// Trains // Trains
#define SF_TRAIN_WAIT_RETRIGGER 1 #define SF_TRAIN_WAIT_RETRIGGER 1
#define SF_TRAIN_START_ON 4 // Train is initially moving #define SF_TRAIN_START_ON 4 // Train is initially moving
#define SF_TRAIN_PASSABLE 8 // Train is not solid -- used to make water trains #define SF_TRAIN_PASSABLE 8 // Train is not solid -- used to make water trains
// Break Model Defines // Break Model Defines
#define BREAK_TYPEMASK 0x4F #define BREAK_TYPEMASK 0x4F

View File

@ -39,7 +39,7 @@
typedef double float_precision; typedef double float_precision;
#else // PLAY_GAMEDLL #else
typedef float float_precision; typedef float float_precision;
@ -68,29 +68,29 @@ typedef union DLONG_u
#define M_PI 3.14159265358979323846 #define M_PI 3.14159265358979323846
template <typename T> template <typename T>
T Q_min(T a, T b) { return (a < b) ? a : b; } T Q_min(T a, T b) { return (a < b) ? a : b; }
template <typename T> template <typename T>
T Q_max(T a, T b) { return (a > b) ? a : b; } T Q_max(T a, T b) { return (a > b) ? a : b; }
template <typename T> template <typename T>
T clamp(T a, T min, T max) { return (a > max) ? max : (a < min) ? min : a; } T clamp(T a, T min, T max) { return (a > max) ? max : (a < min) ? min : a; }
// bitwise operators templates // bitwise operators templates
template<class T, class type=typename std::underlying_type<T>::type> template<class T, class type=typename std::underlying_type<T>::type>
inline T operator~ (T a) { return (T)~(type)a; } inline T operator~ (T a) { return (T)~(type)a; }
template<class T, class type=typename std::underlying_type<T>::type> 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> 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> 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> 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> 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> 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 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];} #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) DEFINE_FIELD(CAirtank, m_state, FIELD_INTEGER)
}; };
#endif // HOOK_GAMEDLL #endif
/* <5329> ../cstrike/dlls/airtank.cpp:41 */
LINK_ENTITY_TO_CLASS(item_airtank, CAirtank); LINK_ENTITY_TO_CLASS(item_airtank, CAirtank);
/* <5211> ../cstrike/dlls/airtank.cpp:47 */
IMPLEMENT_SAVERESTORE(CAirtank, CGrenade); IMPLEMENT_SAVERESTORE(CAirtank, CGrenade);
/* <50dd> ../cstrike/dlls/airtank.cpp:50 */
void CAirtank::__MAKE_VHOOK(Spawn)() void CAirtank::__MAKE_VHOOK(Spawn)()
{ {
Precache(); Precache();
@ -41,14 +37,12 @@ void CAirtank::__MAKE_VHOOK(Spawn)()
m_state = 1; m_state = 1;
} }
/* <4fef> ../cstrike/dlls/airtank.cpp:71 */
void CAirtank::__MAKE_VHOOK(Precache)() void CAirtank::__MAKE_VHOOK(Precache)()
{ {
PRECACHE_MODEL("models/w_oxygen.mdl"); PRECACHE_MODEL("models/w_oxygen.mdl");
PRECACHE_SOUND("doors/aliendoor3.wav"); PRECACHE_SOUND("doors/aliendoor3.wav");
} }
/* <503d> ../cstrike/dlls/airtank.cpp:78 */
void CAirtank::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib) void CAirtank::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib)
{ {
pev->owner = ENT(pevAttacker); 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)); Explode(pev->origin, Vector(0, 0, -1));
} }
/* <5016> ../cstrike/dlls/airtank.cpp:88 */
void CAirtank::TankThink() void CAirtank::TankThink()
{ {
// Fire trigger // Fire trigger
@ -65,7 +58,6 @@ void CAirtank::TankThink()
SUB_UseTargets(this, USE_TOGGLE, 0); SUB_UseTargets(this, USE_TOGGLE, 0);
} }
/* <525d> ../cstrike/dlls/airtank.cpp:96 */
void CAirtank::TankTouch(CBaseEntity *pOther) void CAirtank::TankTouch(CBaseEntity *pOther)
{ {
if (!pOther->IsPlayer()) if (!pOther->IsPlayer())

View File

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

View File

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

View File

@ -32,7 +32,6 @@
#pragma once #pragma once
#endif #endif
/* <9792> ../cstrike/dlls/ammo.cpp:14 */
class C9MMAmmo: public CBasePlayerAmmo class C9MMAmmo: public CBasePlayerAmmo
{ {
public: public:
@ -46,11 +45,10 @@ public:
void Precache_(); void Precache_();
BOOL AddAmmo_(CBaseEntity *pOther); BOOL AddAmmo_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL #endif
}; };
/* <97df> ../cstrike/dlls/ammo.cpp:40 */
class CBuckShotAmmo: public CBasePlayerAmmo class CBuckShotAmmo: public CBasePlayerAmmo
{ {
public: public:
@ -64,11 +62,10 @@ public:
void Precache_(); void Precache_();
BOOL AddAmmo_(CBaseEntity *pOther); BOOL AddAmmo_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL #endif
}; };
/* <982c> ../cstrike/dlls/ammo.cpp:67 */
class C556NatoAmmo: public CBasePlayerAmmo class C556NatoAmmo: public CBasePlayerAmmo
{ {
public: public:
@ -82,11 +79,10 @@ public:
void Precache_(); void Precache_();
BOOL AddAmmo_(CBaseEntity *pOther); BOOL AddAmmo_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL #endif
}; };
/* <9879> ../cstrike/dlls/ammo.cpp:93 */
class C556NatoBoxAmmo: public CBasePlayerAmmo class C556NatoBoxAmmo: public CBasePlayerAmmo
{ {
public: public:
@ -100,11 +96,10 @@ public:
void Precache_(); void Precache_();
BOOL AddAmmo_(CBaseEntity *pOther); BOOL AddAmmo_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL #endif
}; };
/* <98c6> ../cstrike/dlls/ammo.cpp:119 */
class C762NatoAmmo: public CBasePlayerAmmo class C762NatoAmmo: public CBasePlayerAmmo
{ {
public: public:
@ -118,11 +113,10 @@ public:
void Precache_(); void Precache_();
BOOL AddAmmo_(CBaseEntity *pOther); BOOL AddAmmo_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL #endif
}; };
/* <9913> ../cstrike/dlls/ammo.cpp:145 */
class C45ACPAmmo: public CBasePlayerAmmo class C45ACPAmmo: public CBasePlayerAmmo
{ {
public: public:
@ -136,11 +130,10 @@ public:
void Precache_(); void Precache_();
BOOL AddAmmo_(CBaseEntity *pOther); BOOL AddAmmo_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL #endif
}; };
/* <9960> ../cstrike/dlls/ammo.cpp:171 */
class C50AEAmmo: public CBasePlayerAmmo class C50AEAmmo: public CBasePlayerAmmo
{ {
public: public:
@ -154,11 +147,10 @@ public:
void Precache_(); void Precache_();
BOOL AddAmmo_(CBaseEntity *pOther); BOOL AddAmmo_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL #endif
}; };
/* <99ad> ../cstrike/dlls/ammo.cpp:197 */
class C338MagnumAmmo: public CBasePlayerAmmo class C338MagnumAmmo: public CBasePlayerAmmo
{ {
public: public:
@ -172,11 +164,10 @@ public:
void Precache_(); void Precache_();
BOOL AddAmmo_(CBaseEntity *pOther); BOOL AddAmmo_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL #endif
}; };
/* <99fa> ../cstrike/dlls/ammo.cpp:224 */
class C57MMAmmo: public CBasePlayerAmmo class C57MMAmmo: public CBasePlayerAmmo
{ {
public: public:
@ -190,11 +181,9 @@ public:
void Precache_(); void Precache_();
BOOL AddAmmo_(CBaseEntity *pOther); BOOL AddAmmo_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL #endif
}; };
/* <9a47> ../cstrike/dlls/ammo.cpp:249 */
class C357SIGAmmo: public CBasePlayerAmmo class C357SIGAmmo: public CBasePlayerAmmo
{ {
public: public:
@ -208,7 +197,7 @@ public:
void Precache_(); void Precache_();
BOOL AddAmmo_(CBaseEntity *pOther); 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), DEFINE_FIELD(CBaseMonster, m_fSequenceLoops, FIELD_BOOLEAN),
}; };
#endif // HOOK_GAMEDLL #endif
/* <10583> ../cstrike/dlls/animating.cpp:38 */
IMPLEMENT_SAVERESTORE(CBaseAnimating, CBaseDelay); IMPLEMENT_SAVERESTORE(CBaseAnimating, CBaseDelay);
/* <105cf> ../cstrike/dlls/animating.cpp:45 */
float CBaseAnimating::StudioFrameAdvance(float flInterval) float CBaseAnimating::StudioFrameAdvance(float flInterval)
{ {
if (flInterval == 0.0f) if (flInterval == 0.0f)
@ -42,7 +40,7 @@ float CBaseAnimating::StudioFrameAdvance(float flInterval)
if (pev->frame < 0.0 || pev->frame >= 256.0) if (pev->frame < 0.0 || pev->frame >= 256.0)
{ {
if (m_fSequenceLoops) if (m_fSequenceLoops)
pev->frame -= (int)(pev->frame / 256.0) * 256.0; pev->frame -= int(pev->frame / 256.0) * 256.0;
else else
pev->frame = (pev->frame < 0) ? 0 : 255; pev->frame = (pev->frame < 0) ? 0 : 255;
@ -52,21 +50,18 @@ float CBaseAnimating::StudioFrameAdvance(float flInterval)
return flInterval; return flInterval;
} }
/* <10605> ../cstrike/dlls/animating.cpp:77 */
int CBaseAnimating::LookupActivity(int activity) int CBaseAnimating::LookupActivity(int activity)
{ {
void *pmodel = GET_MODEL_PTR(ENT(pev)); void *pmodel = GET_MODEL_PTR(ENT(pev));
return ::LookupActivity(pmodel, pev, activity); return ::LookupActivity(pmodel, pev, activity);
} }
/* <10653> ../cstrike/dlls/animating.cpp:91 */
int CBaseAnimating::LookupActivityHeaviest(int activity) int CBaseAnimating::LookupActivityHeaviest(int activity)
{ {
void *pmodel = GET_MODEL_PTR(ENT(pev)); void *pmodel = GET_MODEL_PTR(ENT(pev));
return ::LookupActivityHeaviest(pmodel, pev, activity); return ::LookupActivityHeaviest(pmodel, pev, activity);
} }
/* <107b1> ../cstrike/dlls/animating.cpp:136 */
void CBaseAnimating::DispatchAnimEvents(float flInterval) void CBaseAnimating::DispatchAnimEvents(float flInterval)
{ {
MonsterEvent_t event; MonsterEvent_t event;
@ -100,14 +95,12 @@ void CBaseAnimating::DispatchAnimEvents(float flInterval)
} }
} }
/* <106a1> ../cstrike/dlls/animating.cpp:100 */
int CBaseAnimating::LookupSequence(const char *label) int CBaseAnimating::LookupSequence(const char *label)
{ {
void *pmodel = GET_MODEL_PTR(ENT(pev)); void *pmodel = GET_MODEL_PTR(ENT(pev));
return ::LookupSequence(pmodel, label); return ::LookupSequence(pmodel, label);
} }
/* <10711> ../cstrike/dlls/animating.cpp:110 */
void CBaseAnimating::ResetSequenceInfo() void CBaseAnimating::ResetSequenceInfo()
{ {
void *pmodel = GET_MODEL_PTR(ENT(pev)); void *pmodel = GET_MODEL_PTR(ENT(pev));
@ -121,14 +114,12 @@ void CBaseAnimating::ResetSequenceInfo()
m_flLastEventCheck = gpGlobals->time; m_flLastEventCheck = gpGlobals->time;
} }
/* <1077c> ../cstrike/dlls/animating.cpp:126 */
BOOL CBaseAnimating::GetSequenceFlags() BOOL CBaseAnimating::GetSequenceFlags()
{ {
void *pmodel = GET_MODEL_PTR(ENT(pev)); void *pmodel = GET_MODEL_PTR(ENT(pev));
return ::GetSequenceFlags(pmodel, pev); return ::GetSequenceFlags(pmodel, pev);
} }
/* <10837> ../cstrike/dlls/animating.cpp:171 */
float CBaseAnimating::SetBoneController(int iController, float flValue) float CBaseAnimating::SetBoneController(int iController, float flValue)
{ {
void *pmodel = GET_MODEL_PTR(ENT(pev)); void *pmodel = GET_MODEL_PTR(ENT(pev));
@ -136,7 +127,6 @@ float CBaseAnimating::SetBoneController(int iController, float flValue)
return SetController(pmodel, pev, iController, flValue); return SetController(pmodel, pev, iController, flValue);
} }
/* <10893> ../cstrike/dlls/animating.cpp:180 */
void CBaseAnimating::InitBoneControllers() void CBaseAnimating::InitBoneControllers()
{ {
void *pmodel = GET_MODEL_PTR(ENT(pev)); void *pmodel = GET_MODEL_PTR(ENT(pev));
@ -147,26 +137,22 @@ void CBaseAnimating::InitBoneControllers()
SetController(pmodel, pev, 3, 0); SetController(pmodel, pev, 3, 0);
} }
/* <108d3> ../cstrike/dlls/animating.cpp:192 */
NOXREF float CBaseAnimating::SetBlending(int iBlender, float flValue) NOXREF float CBaseAnimating::SetBlending(int iBlender, float flValue)
{ {
void *pmodel = GET_MODEL_PTR(ENT(pev)); void *pmodel = GET_MODEL_PTR(ENT(pev));
return ::SetBlending(pmodel, pev, iBlender, flValue); return ::SetBlending(pmodel, pev, iBlender, flValue);
} }
/* <1092f> ../cstrike/dlls/animating.cpp:201 */
NOXREF void CBaseAnimating::GetBonePosition(int iBone, Vector &origin, Vector &angles) NOXREF void CBaseAnimating::GetBonePosition(int iBone, Vector &origin, Vector &angles)
{ {
GET_BONE_POSITION(ENT(pev), iBone, origin, 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) NOXREF void CBaseAnimating::GetAttachment(int iAttachment, Vector &origin, Vector &angles)
{ {
GET_ATTACHMENT(ENT(pev), iAttachment, origin, angles); GET_ATTACHMENT(ENT(pev), iAttachment, origin, angles);
} }
/* <109d4> ../cstrike/dlls/animating.cpp:215 */
NOXREF int CBaseAnimating::FindTransition(int iEndingSequence, int iGoalSequence, int *piDir) NOXREF int CBaseAnimating::FindTransition(int iEndingSequence, int iGoalSequence, int *piDir)
{ {
void *pmodel = GET_MODEL_PTR(ENT(pev)); 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); return ::FindTransition(pmodel, iEndingSequence, iGoalSequence, piDir);
} }
/* <10a5d> ../cstrike/dlls/animating.cpp:234 */
NOXREF void CBaseAnimating::GetAutomovement(Vector &origin, Vector &angles, float flInterval) NOXREF void CBaseAnimating::GetAutomovement(Vector &origin, Vector &angles, float flInterval)
{ {
; ;
} }
/* <10aad> ../cstrike/dlls/animating.cpp:239 */
NOXREF void CBaseAnimating::SetBodygroup(int iGroup, int iValue) NOXREF void CBaseAnimating::SetBodygroup(int iGroup, int iValue)
{ {
::SetBodygroup(GET_MODEL_PTR(ENT(pev)), pev, iGroup, iValue); ::SetBodygroup(GET_MODEL_PTR(ENT(pev)), pev, iGroup, iValue);
} }
/* <10af0> ../cstrike/dlls/animating.cpp:244 */
NOXREF int CBaseAnimating::GetBodygroup(int iGroup) NOXREF int CBaseAnimating::GetBodygroup(int iGroup)
{ {
return ::GetBodygroup(GET_MODEL_PTR(ENT(pev)), pev, 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) int CBaseAnimating::ExtractBbox(int sequence, float *mins, float *maxs)
{ {
return ::ExtractBbox(GET_MODEL_PTR(ENT(pev)), sequence, mins, maxs); return ::ExtractBbox(GET_MODEL_PTR(ENT(pev)), sequence, mins, maxs);
} }
/* <10b99> ../cstrike/dlls/animating.cpp:258 */
void CBaseAnimating::SetSequenceBox() void CBaseAnimating::SetSequenceBox()
{ {
Vector mins, maxs; Vector mins, maxs;
@ -222,10 +203,10 @@ void CBaseAnimating::SetSequenceBox()
float yaw = pev->angles.y * (M_PI / 180.0); float yaw = pev->angles.y * (M_PI / 180.0);
Vector xvector, yvector; Vector xvector, yvector;
xvector.x = cos(yaw); xvector.x = Q_cos(yaw);
xvector.y = sin(yaw); xvector.y = Q_sin(yaw);
yvector.x = -sin(yaw); yvector.x = -Q_sin(yaw);
yvector.y = cos(yaw); yvector.y = Q_cos(yaw);
Vector bounds[2]; Vector bounds[2];
bounds[0] = mins; bounds[0] = mins;

View File

@ -5,13 +5,15 @@
*/ */
#ifndef HOOK_GAMEDLL #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_t svBlending =
{ {
SV_BLENDING_INTERFACE_VERSION, SV_BLENDING_INTERFACE_VERSION,
SV_StudioSetupBones SV_StudioSetupBones
}; };
#endif // HOOK_GAMEDLL #endif
server_studio_api_t IEngineStudio; server_studio_api_t IEngineStudio;
studiohdr_t *g_pstudiohdr; studiohdr_t *g_pstudiohdr;
@ -19,7 +21,6 @@ studiohdr_t *g_pstudiohdr;
float (*g_pRotationMatrix)[3][4]; float (*g_pRotationMatrix)[3][4];
float (*g_pBoneTransform)[128][3][4]; float (*g_pBoneTransform)[128][3][4];
/* <1523e> ../cstrike/dlls/animation.cpp:57 */
int ExtractBbox(void *pmodel, int sequence, float *mins, float *maxs) int ExtractBbox(void *pmodel, int sequence, float *mins, float *maxs)
{ {
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel; studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel;
@ -42,7 +43,6 @@ int ExtractBbox(void *pmodel, int sequence, float *mins, float *maxs)
return 1; return 1;
} }
/* <152c6> ../cstrike/dlls/animation.cpp:81 */
int LookupActivity(void *pmodel, entvars_t *pev, int activity) int LookupActivity(void *pmodel, entvars_t *pev, int activity)
{ {
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel; studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel;
@ -112,7 +112,6 @@ int LookupActivity(void *pmodel, entvars_t *pev, int activity)
return ACT_INVALID; return ACT_INVALID;
} }
/* <1539a> ../cstrike/dlls/animation.cpp:149 */
int LookupActivityHeaviest(void *pmodel, entvars_t *pev, int activity) int LookupActivityHeaviest(void *pmodel, entvars_t *pev, int activity)
{ {
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel; studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel;
@ -141,7 +140,6 @@ int LookupActivityHeaviest(void *pmodel, entvars_t *pev, int activity)
return seq; return seq;
} }
/* <15439> ../cstrike/dlls/animation.cpp:178 */
NOXREF void GetEyePosition(void *pmodel, float *vecEyePosition) NOXREF void GetEyePosition(void *pmodel, float *vecEyePosition)
{ {
studiohdr_t *pstudiohdr; studiohdr_t *pstudiohdr;
@ -159,7 +157,6 @@ NOXREF void GetEyePosition(void *pmodel, float *vecEyePosition)
vecEyePosition[2] = pstudiohdr->eyeposition[2]; vecEyePosition[2] = pstudiohdr->eyeposition[2];
} }
/* <15485> ../cstrike/dlls/animation.cpp:193 */
int LookupSequence(void *pmodel, const char *label) int LookupSequence(void *pmodel, const char *label)
{ {
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel; studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel;
@ -181,7 +178,6 @@ int LookupSequence(void *pmodel, const char *label)
return ACT_INVALID; return ACT_INVALID;
} }
/* <1518c> ../cstrike/dlls/animation.cpp:215 */
int IsSoundEvent(int eventNumber) int IsSoundEvent(int eventNumber)
{ {
if (eventNumber == SCRIPT_EVENT_SOUND || eventNumber == SCRIPT_EVENT_SOUND_VOICE) if (eventNumber == SCRIPT_EVENT_SOUND || eventNumber == SCRIPT_EVENT_SOUND_VOICE)
@ -192,7 +188,6 @@ int IsSoundEvent(int eventNumber)
return 0; return 0;
} }
/* <15539> ../cstrike/dlls/animation.cpp:223 */
NOXREF void SequencePrecache(void *pmodel, const char *pSequenceName) NOXREF void SequencePrecache(void *pmodel, const char *pSequenceName)
{ {
int index = LookupSequence(pmodel, 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) void GetSequenceInfo(void *pmodel, entvars_t *pev, float *pflFrameRate, float *pflGroundSpeed)
{ {
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel; studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel;
@ -246,7 +240,7 @@ void GetSequenceInfo(void *pmodel, entvars_t *pev, float *pflFrameRate, float *p
return; 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) if (pseqdesc->numframes <= 1)
{ {
*pflFrameRate = 256.0f; *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); *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); *pflGroundSpeed = *pflGroundSpeed * pseqdesc->fps / (pseqdesc->numframes - 1);
} }
/* <156b3> ../cstrike/dlls/animation.cpp:297 */
int GetSequenceFlags(void *pmodel, entvars_t *pev) int GetSequenceFlags(void *pmodel, entvars_t *pev)
{ {
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel; studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel;
@ -269,11 +262,10 @@ int GetSequenceFlags(void *pmodel, entvars_t *pev)
return 0; 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; 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) int GetAnimationEvent(void *pmodel, entvars_t *pev, MonsterEvent_t *pMonsterEvent, float flStart, float flEnd, int index)
{ {
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel; studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel;
@ -283,9 +275,7 @@ int GetAnimationEvent(void *pmodel, entvars_t *pev, MonsterEvent_t *pMonsterEven
return 0; 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); mstudioevent_t *pevent = (mstudioevent_t *)((byte *)pstudiohdr + pseqdesc->eventindex);
if (pseqdesc->numevents == 0 || index > pseqdesc->numevents) if (pseqdesc->numevents == 0 || index > pseqdesc->numevents)
@ -325,7 +315,6 @@ int GetAnimationEvent(void *pmodel, entvars_t *pev, MonsterEvent_t *pMonsterEven
return 0; return 0;
} }
/* <157e1> ../cstrike/dlls/animation.cpp:359 */
float SetController(void *pmodel, entvars_t *pev, int iController, float flValue) float SetController(void *pmodel, entvars_t *pev, int iController, float flValue)
{ {
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel; 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 (pbonecontroller->end > pbonecontroller->start + 359.0)
{ {
if (flValue > 360.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) 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 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) if (setting < 0)
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; 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) float SetBlending(void *pmodel, entvars_t *pev, int iBlender, float flValue)
{ {
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel; studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel;
@ -391,7 +379,7 @@ float SetBlending(void *pmodel, entvars_t *pev, int iBlender, float flValue)
return 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) 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) if (setting < 0)
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]; 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) int FindTransition(void *pmodel, int iEndingAnim, int iGoalAnim, int *piDir)
{ {
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel; studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel;
@ -497,7 +484,6 @@ int FindTransition(void *pmodel, int iEndingAnim, int iGoalAnim, int *piDir)
return iGoalAnim; return iGoalAnim;
} }
/* <159d8> ../cstrike/dlls/animation.cpp:523 */
void SetBodygroup(void *pmodel, entvars_t *pev, int iGroup, int iValue) void SetBodygroup(void *pmodel, entvars_t *pev, int iGroup, int iValue)
{ {
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel; 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; pev->body += (iValue - iCurrent) * pbodypart->base;
} }
/* <15a6d> ../cstrike/dlls/animation.cpp:545 */
int GetBodygroup(void *pmodel, entvars_t *pev, int iGroup) int GetBodygroup(void *pmodel, entvars_t *pev, int iGroup)
{ {
studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel; studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel;
@ -541,7 +526,6 @@ int GetBodygroup(void *pmodel, entvars_t *pev, int iGroup)
return iCurrent; 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) 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) if (version != SV_BLENDING_INTERFACE_VERSION)
@ -560,7 +544,6 @@ C_DLLEXPORT int Server_GetBlendingInterface(int version, struct sv_blending_inte
return 1; return 1;
} }
/* <15ba5> ../cstrike/dlls/animation.cpp:630 */
#ifdef REGAMEDLL_FIXES // SSE2 version #ifdef REGAMEDLL_FIXES // SSE2 version
void AngleQuaternion(vec_t *angles, vec_t *quaternion) void AngleQuaternion(vec_t *angles, vec_t *quaternion)
{ {
@ -605,16 +588,16 @@ void AngleQuaternion(vec_t *angles, vec_t *quaternion)
float ftmp2; float ftmp2;
angle = angles[ROLL] * 0.5; angle = angles[ROLL] * 0.5;
sy = sin(angle); sy = Q_sin(angle);
cy = cos(angle); cy = Q_cos(angle);
angle = angles[YAW] * 0.5; angle = angles[YAW] * 0.5;
sp_ = sin(angle); sp_ = Q_sin(angle);
cp = cos(angle); cp = Q_cos(angle);
angle = angles[PITCH] * 0.5; angle = angles[PITCH] * 0.5;
sr = sin(angle); sr = Q_sin(angle);
cr = cos(angle); cr = Q_cos(angle);
ftmp0 = sr * cp; ftmp0 = sr * cp;
ftmp1 = cr * sp_; ftmp1 = cr * sp_;
@ -628,7 +611,6 @@ void AngleQuaternion(vec_t *angles, vec_t *quaternion)
} }
#endif // REGAMEDLL_FIXES #endif // REGAMEDLL_FIXES
/* <15c4d> ../cstrike/dlls/animation.cpp:653 */
void QuaternionSlerp(vec_t *p, vec_t *q, float t, vec_t *qt) void QuaternionSlerp(vec_t *p, vec_t *q, float t, vec_t *qt)
{ {
int i; 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) 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 omega = cosomega;
float sinom = sin(cosomega); float sinom = Q_sin(cosomega);
sclp = sin((1.0 - t) * omega) / sinom; sclp = Q_sin((1.0 - t) * omega) / sinom;
sclq = sin((float_precision)(omega * t)) / sinom; sclq = Q_sin(float_precision(omega * t)) / sinom;
} }
else else
{ {
@ -678,15 +660,14 @@ void QuaternionSlerp(vec_t *p, vec_t *q, float t, vec_t *qt)
qt[2] = -q[3]; qt[2] = -q[3];
qt[3] = q[2]; qt[3] = q[2];
sclp = sin((1.0 - t) * 0.5 * M_PI); sclp = Q_sin((1.0 - t) * 0.5 * M_PI);
sclq = sin(t * 0.5 * M_PI); sclq = Q_sin(t * 0.5 * M_PI);
for (i = 0; i < 3; ++i) for (i = 0; i < 3; ++i)
qt[i] = sclp * p[i] + sclq * qt[i]; qt[i] = sclp * p[i] + sclq * qt[i];
} }
} }
/* <15cd0> ../cstrike/dlls/animation.cpp:700 */
void QuaternionMatrix(vec_t *quaternion, float (*matrix)[4]) 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]; 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]; 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) mstudioanim_t *StudioGetAnim(model_t *m_pSubModel, mstudioseqdesc_t *pseqdesc)
{ {
mstudioseqgroup_t *pseqgroup; 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); 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 *LookupAnimation(model_t *model, mstudioseqdesc_t *pseqdesc, int index)
{ {
mstudioanim_t *panim = StudioGetAnim(model, pseqdesc); mstudioanim_t *panim = StudioGetAnim(model, pseqdesc);
@ -741,7 +720,6 @@ mstudioanim_t *LookupAnimation(model_t *model, mstudioseqdesc_t *pseqdesc, int i
return panim; return panim;
} }
/* <151a9> ../cstrike/dlls/animation.cpp:770 */
void StudioCalcBoneAdj(float dadt, float *adj, const byte *pcontroller1, const byte *pcontroller2, byte mouthopen) void StudioCalcBoneAdj(float dadt, float *adj, const byte *pcontroller1, const byte *pcontroller2, byte mouthopen)
{ {
int i, j; int i, j;
@ -758,7 +736,7 @@ void StudioCalcBoneAdj(float dadt, float *adj, const byte *pcontroller1, const b
// check for 360% wrapping // check for 360% wrapping
if (pbonecontroller[j].type & STUDIO_RLOOP) if (pbonecontroller[j].type & STUDIO_RLOOP)
{ {
if (abs(pcontroller1[i] - pcontroller2[i]) > 128) if (Q_abs(pcontroller1[i] - pcontroller2[i]) > 128)
{ {
int a, b; int a, b;
a = (pcontroller1[j] + 128) % 256; a = (pcontroller1[j] + 128) % 256;
@ -767,7 +745,7 @@ void StudioCalcBoneAdj(float dadt, float *adj, const byte *pcontroller1, const b
} }
else 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 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) void StudioCalcBoneQuaterion(int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *q)
{ {
int j, k; int j, k;
@ -890,7 +867,6 @@ void StudioCalcBoneQuaterion(int frame, float s, mstudiobone_t *pbone, mstudioan
AngleQuaternion(angle1, q); 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) void StudioCalcBonePosition(int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *pos)
{ {
int j, k; 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) void StudioSlerpBones(vec4_t *q1, float pos1[][3], vec4_t *q2, float pos2[][3], float s)
{ {
int i; 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) void StudioCalcRotations(mstudiobone_t *pbones, int *chain, int chainlength, float *adj, float pos[128][3], vec4_t *q, mstudioseqdesc_t *pseqdesc, mstudioanim_t *panim, float f, float s)
{ {
int i; int i;
@ -984,12 +958,11 @@ void StudioCalcRotations(mstudiobone_t *pbones, int *chain, int chainlength, flo
{ {
j = chain[i]; j = chain[i];
StudioCalcBoneQuaterion((int)f, s, &pbones[j], &panim[j], adj, q[j]); StudioCalcBoneQuaterion(int(f), s, &pbones[j], &panim[j], adj, q[j]);
StudioCalcBonePosition((int)f, s, &pbones[j], &panim[j], adj, pos[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]) 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]; 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) if (pseqdesc->numframes <= 1)
return 0; 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) 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; int i, j;
@ -1063,17 +1035,17 @@ void SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t
} }
f = StudioEstimateFrame(frame, pseqdesc); f = StudioEstimateFrame(frame, pseqdesc);
subframe = (int)f; subframe = int(f);
f -= subframe; f -= subframe;
StudioCalcBoneAdj(0, adj, pcontroller, pcontroller, 0); StudioCalcBoneAdj(0, adj, pcontroller, pcontroller, 0);
StudioCalcRotations(pbones, chain, chainlength, adj, pos, q, pseqdesc, panim, subframe, f); StudioCalcRotations(pbones, chain, chainlength, adj, pos, q, pseqdesc, panim, subframe, f);
if (pseqdesc->numblends != 9) if (pseqdesc->numblends != NUM_BLENDING)
{ {
if (pseqdesc->numblends > 1) 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; pseqdesc = (mstudioseqdesc_t *)((byte *)g_pstudiohdr + g_pstudiohdr->seqindex) + sequence;
panim = StudioGetAnim(pModel, pseqdesc); 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); VectorCopy(angles, temp_angles);
#ifdef REGAMEDLL_FIXES #ifndef REGAMEDLL_FIXES
if(pEdict != NULL && CBaseEntity::Instance((edict_t*)pEdict)->IsPlayer()) if (pEdict != NULL)
#else #else
if(pEdict != NULL) if (pEdict != NULL && CBaseEntity::Instance(const_cast<edict_t *>(pEdict))->IsPlayer())
#endif #endif
{ {
temp_angles[1] = UTIL_GetPlayerGaitYaw(ENTINDEX(pEdict)); temp_angles[1] = UTIL_GetPlayerGaitYaw(ENTINDEX(pEdict));

View File

@ -32,41 +32,30 @@
#pragma once #pragma once
#endif #endif
#define NUM_BLENDING 9
#define ANIM_SWIM_1 8 #define ANIM_SWIM_1 8
#define ANIM_SWIM_2 9 #define ANIM_SWIM_2 9
#define ANIM_FIRST_DEATH_SEQUENCE 101 #define ANIM_FIRST_DEATH_SEQUENCE 101
#include "com_model.h" #include "monsterevent.h"
#include "studio.h"
#include "r_studioint.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 LookupActivity(void *pmodel, entvars_t *pev, int activity);
int LookupActivityHeaviest(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 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); void GetSequenceInfo(void *pmodel, entvars_t *pev, float *pflFrameRate, float *pflGroundSpeed);
int GetSequenceFlags(void *pmodel, entvars_t *pev); 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 SetController(void *pmodel, entvars_t *pev, int iController, float flValue);
float SetBlending(void *pmodel, entvars_t *pev, int iBlender, 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); int FindTransition(void *pmodel, int iEndingAnim, int iGoalAnim, int *piDir);
void SetBodygroup(void *pmodel, entvars_t *pev, int iGroup, int iValue); void SetBodygroup(void *pmodel, entvars_t *pev, int iGroup, int iValue);
int GetBodygroup(void *pmodel, entvars_t *pev, int iGroup); 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); int GetAnimationEvent(void *pmodel, entvars_t *pev, MonsterEvent_t *pMonsterEvent, float flStart, float flEnd, int index);
void QuaternionSlerp(vec_t *p, vec_t *q, float t, vec_t *qt); int ExtractBbox(void *pmodel, int sequence, float *mins, float *maxs);
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);
#endif // ANIMATION_H #endif // ANIMATION_H

View File

@ -33,12 +33,9 @@
#endif #endif
void RadiusFlash(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore = 0, int bitsDamageType = 0); 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 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); 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 class CBaseMonster: public CBaseToggle
{ {
public: public:
@ -54,7 +51,7 @@ public:
virtual BOOL HasAlienGibs(); virtual BOOL HasAlienGibs();
virtual void FadeMonster(); virtual void FadeMonster();
virtual void GibMonster(); virtual void GibMonster();
NOXREF virtual Activity GetDeathActivity(); virtual Activity GetDeathActivity();
virtual void BecomeDead(); virtual void BecomeDead();
virtual BOOL ShouldFadeOnDeath(); virtual BOOL ShouldFadeOnDeath();
virtual int IRelationship(CBaseEntity *pTarget); virtual int IRelationship(CBaseEntity *pTarget);
@ -89,37 +86,35 @@ public:
BOOL FInViewCone_(CBaseEntity *pEntity); BOOL FInViewCone_(CBaseEntity *pEntity);
BOOL FInViewCone_(const Vector *pOrigin); BOOL FInViewCone_(const Vector *pOrigin);
#endif // HOOK_GAMEDLL #endif
public: public:
void MakeIdealYaw(Vector vecTarget); void MakeIdealYaw(Vector vecTarget);
NOXREF Activity GetSmallFlinchActivity(); Activity GetSmallFlinchActivity();
BOOL ShouldGibMonster(int iGib); BOOL ShouldGibMonster(int iGib);
void CallGibMonster(); void CallGibMonster();
BOOL FCheckAITrigger(); BOOL FCheckAITrigger();
int DeadTakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType); int DeadTakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
float DamageForce(float damage); float DamageForce(float damage);
void RadiusDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType); 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 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 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 SetConditions(int iConditions) { m_afConditions |= iConditions; }
void ClearConditions(int iConditions) { m_afConditions &= ~iConditions; }
BOOL HasConditions(int iConditions) { return (m_afConditions & iConditions) ? TRUE : FALSE; }
BOOL HasAllConditions(int iConditions) { return ((m_afConditions & iConditions) == iConditions) ? TRUE : FALSE; }
void Remember(int iMemory) { m_afMemory |= iMemory; } void SetConditions(int iConditions) { m_afConditions |= iConditions; }
void Forget(int iMemory) { m_afMemory &= ~iMemory; } void ClearConditions(int iConditions) { m_afConditions &= ~iConditions; }
BOOL HasMemory(int iMemory) { return (m_afMemory & iMemory) ? TRUE : FALSE; } BOOL HasConditions(int iConditions) { return (m_afConditions & iConditions) ? TRUE : FALSE; }
BOOL HasAllMemories(int iMemory) { return ((m_afMemory & iMemory) == iMemory) ? TRUE : FALSE; } BOOL HasAllConditions(int iConditions) { return ((m_afConditions & iConditions) == iConditions) ? TRUE : FALSE; }
void StopAnimation() { pev->framerate = 0.0f; } void Remember(int iMemory) { m_afMemory |= iMemory; }
void Forget(int iMemory) { m_afMemory &= ~iMemory; }
BOOL HasMemory(int iMemory) { return (m_afMemory & iMemory) ? TRUE : FALSE; }
BOOL HasAllMemories(int iMemory) { return ((m_afMemory & iMemory) == iMemory) ? TRUE : FALSE; }
NOXREF void CorpseFallThink(); void StopAnimation() { pev->framerate = 0.0f; }
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 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); 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), 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 // 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) Vector VecBModelOrigin(entvars_t *pevBModel)
{ {
return pevBModel->absmin + (pevBModel->size * 0.5); return pevBModel->absmin + (pevBModel->size * 0.5);
} }
/* <1e384> ../cstrike/dlls/bmodels.cpp:63 */
LINK_ENTITY_TO_CLASS(func_wall, CFuncWall); LINK_ENTITY_TO_CLASS(func_wall, CFuncWall);
/* <1d193> ../cstrike/dlls/bmodels.cpp:65 */
void CFuncWall::__MAKE_VHOOK(Spawn)() void CFuncWall::__MAKE_VHOOK(Spawn)()
{ {
pev->angles = g_vecZero; pev->angles = g_vecZero;
@ -54,19 +50,16 @@ void CFuncWall::__MAKE_VHOOK(Spawn)()
pev->flags |= FL_WORLDBRUSH; pev->flags |= FL_WORLDBRUSH;
} }
/* <1d873> ../cstrike/dlls/bmodels.cpp:77 */
void CFuncWall::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) 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; pev->frame = 1.0 - pev->frame;
} }
} }
/* <1e44e> ../cstrike/dlls/bmodels.cpp:96 */
LINK_ENTITY_TO_CLASS(func_wall_toggle, CFuncWallToggle); LINK_ENTITY_TO_CLASS(func_wall_toggle, CFuncWallToggle);
/* <1e28f> ../cstrike/dlls/bmodels.cpp:98 */
void CFuncWallToggle::__MAKE_VHOOK(Spawn)() void CFuncWallToggle::__MAKE_VHOOK(Spawn)()
{ {
CFuncWall::Spawn(); CFuncWall::Spawn();
@ -77,7 +70,6 @@ void CFuncWallToggle::__MAKE_VHOOK(Spawn)()
} }
} }
/* <1e518> ../cstrike/dlls/bmodels.cpp:106 */
void CFuncWallToggle::TurnOff() void CFuncWallToggle::TurnOff()
{ {
pev->solid = SOLID_NOT; pev->solid = SOLID_NOT;
@ -85,7 +77,6 @@ void CFuncWallToggle::TurnOff()
UTIL_SetOrigin(pev, pev->origin); UTIL_SetOrigin(pev, pev->origin);
} }
/* <1e53a> ../cstrike/dlls/bmodels.cpp:114 */
void CFuncWallToggle::TurnOn() void CFuncWallToggle::TurnOn()
{ {
pev->solid = SOLID_BSP; pev->solid = SOLID_BSP;
@ -93,7 +84,6 @@ void CFuncWallToggle::TurnOn()
UTIL_SetOrigin(pev, pev->origin); UTIL_SetOrigin(pev, pev->origin);
} }
/* <1e55c> ../cstrike/dlls/bmodels.cpp:122 */
BOOL CFuncWallToggle::IsOn() BOOL CFuncWallToggle::IsOn()
{ {
if (pev->solid == SOLID_NOT) if (pev->solid == SOLID_NOT)
@ -104,7 +94,6 @@ BOOL CFuncWallToggle::IsOn()
return TRUE; return TRUE;
} }
/* <1e101> ../cstrike/dlls/bmodels.cpp:130 */
void CFuncWallToggle::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) void CFuncWallToggle::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{ {
int status = IsOn(); 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); LINK_ENTITY_TO_CLASS(func_conveyor, CFuncConveyor);
/* <1e1c3> ../cstrike/dlls/bmodels.cpp:156 */
void CFuncConveyor::__MAKE_VHOOK(Spawn)() void CFuncConveyor::__MAKE_VHOOK(Spawn)()
{ {
SetMovedir(pev); 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 // 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) void CFuncConveyor::UpdateSpeed(float speed)
{ {
// Encode it as an integer with 4 fractional bits // 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) if (speed < 0)
pev->rendercolor.x = 1; pev->rendercolor.x = 1;
@ -163,30 +148,26 @@ void CFuncConveyor::UpdateSpeed(float speed)
pev->rendercolor.z = (speedCode & 0xFF); 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) void CFuncConveyor::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{ {
pev->speed = -pev->speed; pev->speed = -pev->speed;
UpdateSpeed(pev->speed); UpdateSpeed(pev->speed);
} }
/* <1e695> ../cstrike/dlls/bmodels.cpp:217 */
LINK_ENTITY_TO_CLASS(func_illusionary, CFuncIllusionary); LINK_ENTITY_TO_CLASS(func_illusionary, CFuncIllusionary);
/* <1ddc9> ../cstrike/dlls/bmodels.cpp:219 */
void CFuncIllusionary::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) void CFuncIllusionary::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{ {
//skin is used for content type //skin is used for content type
if (FStrEq(pkvd->szKeyName, "skin")) if (FStrEq(pkvd->szKeyName, "skin"))
{ {
pev->skin = (int)Q_atof(pkvd->szValue); pev->skin = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE; pkvd->fHandled = TRUE;
} }
else else
CBaseToggle::KeyValue(pkvd); CBaseToggle::KeyValue(pkvd);
} }
/* <1d1db> ../cstrike/dlls/bmodels.cpp:230 */
void CFuncIllusionary::__MAKE_VHOOK(Spawn)() void CFuncIllusionary::__MAKE_VHOOK(Spawn)()
{ {
pev->angles = g_vecZero; pev->angles = g_vecZero;
@ -203,10 +184,8 @@ void CFuncIllusionary::__MAKE_VHOOK(Spawn)()
// MAKE_STATIC(ENT(pev)); // MAKE_STATIC(ENT(pev));
} }
/* <1e75f> ../cstrike/dlls/bmodels.cpp:262 */
LINK_ENTITY_TO_CLASS(func_monsterclip, CFuncMonsterClip); LINK_ENTITY_TO_CLASS(func_monsterclip, CFuncMonsterClip);
/* <1e24f> ../cstrike/dlls/bmodels.cpp:264 */
void CFuncMonsterClip::__MAKE_VHOOK(Spawn)() void CFuncMonsterClip::__MAKE_VHOOK(Spawn)()
{ {
CFuncWall::Spawn(); CFuncWall::Spawn();
@ -219,13 +198,10 @@ void CFuncMonsterClip::__MAKE_VHOOK(Spawn)()
pev->flags |= FL_MONSTERCLIP; pev->flags |= FL_MONSTERCLIP;
} }
/* <1e82c> ../cstrike/dlls/bmodels.cpp:313 */
LINK_ENTITY_TO_CLASS(func_rotating, CFuncRotating); LINK_ENTITY_TO_CLASS(func_rotating, CFuncRotating);
/* <1d826> ../cstrike/dlls/bmodels.cpp:310 */
IMPLEMENT_SAVERESTORE(CFuncRotating, CBaseEntity); IMPLEMENT_SAVERESTORE(CFuncRotating, CBaseEntity);
/* <1dc21> ../cstrike/dlls/bmodels.cpp:315 */
void CFuncRotating::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) void CFuncRotating::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{ {
if (FStrEq(pkvd->szKeyName, "fanfriction")) if (FStrEq(pkvd->szKeyName, "fanfriction"))
@ -275,8 +251,6 @@ void CFuncRotating::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
// "dmg" damage to inflict when blocked (2 default) // "dmg" damage to inflict when blocked (2 default)
// REVERSE will cause the it to rotate in the opposite direction. // REVERSE will cause the it to rotate in the opposite direction.
/* <1d5c4> ../cstrike/dlls/bmodels.cpp:362 */
void CFuncRotating::__MAKE_VHOOK(Spawn)() void CFuncRotating::__MAKE_VHOOK(Spawn)()
{ {
// set final pitch. Must not be PITCH_NORM, since we // set final pitch. Must not be PITCH_NORM, since we
@ -375,7 +349,6 @@ void CFuncRotating::__MAKE_VHOOK(Spawn)()
Precache(); Precache();
} }
/* <1d28a> ../cstrike/dlls/bmodels.cpp:447 */
void CFuncRotating::__MAKE_VHOOK(Precache)() void CFuncRotating::__MAKE_VHOOK(Precache)()
{ {
char *szSoundFile = (char *)STRING(pev->message); 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 // Touch - will hurt others based on how fast the brush is spinning
/* <1dea4> ../cstrike/dlls/bmodels.cpp:517 */
void CFuncRotating::HurtTouch(CBaseEntity *pOther) void CFuncRotating::HurtTouch(CBaseEntity *pOther)
{ {
entvars_t *pevOther = pOther->pev; 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 // 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 // between how fast we're going vs how fast we plan to go
/* <1e8f9> ../cstrike/dlls/bmodels.cpp:540 */
void CFuncRotating::RampPitchVol(int fUp) void CFuncRotating::RampPitchVol(int fUp)
{ {
Vector vecAVel = pev->avelocity; Vector vecAVel = pev->avelocity;
@ -472,12 +442,12 @@ void CFuncRotating::RampPitchVol(int fUp)
int pitch; int pitch;
// get current angular velocity // 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 // get target angular velocity
vecFinal = (pev->movedir.x != 0 ? pev->movedir.x : (pev->movedir.y != 0 ? pev->movedir.y : pev->movedir.z)); vecFinal = (pev->movedir.x != 0 ? pev->movedir.x : (pev->movedir.y != 0 ? pev->movedir.y : pev->movedir.z));
vecFinal *= pev->speed; vecFinal *= pev->speed;
vecFinal = abs((int)vecFinal); vecFinal = Q_abs(int(vecFinal));
// calc volume and pitch as % of final vol and pitch // calc volume and pitch as % of final vol and pitch
fpct = vecCur / vecFinal; fpct = vecCur / vecFinal;
@ -485,7 +455,7 @@ void CFuncRotating::RampPitchVol(int fUp)
//if (fUp) //if (fUp)
//{ //{
// // spinup volume ramps up from 50% max vol // // 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 //else
{ {
@ -495,7 +465,7 @@ void CFuncRotating::RampPitchVol(int fUp)
fpitch = FANPITCHMIN + (FANPITCHMAX - FANPITCHMIN) * fpct; fpitch = FANPITCHMIN + (FANPITCHMAX - FANPITCHMIN) * fpct;
pitch = (int)fpitch; pitch = int(fpitch);
if (pitch == PITCH_NORM) if (pitch == PITCH_NORM)
{ {
pitch = PITCH_NORM - 1; 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 // SpinUp - accelerates a non-moving func_rotating up to it's speed
/* <1ea74> ../cstrike/dlls/bmodels.cpp:585 */
void CFuncRotating::SpinUp() void CFuncRotating::SpinUp()
{ {
//rotational velocity //rotational velocity
@ -520,9 +488,9 @@ void CFuncRotating::SpinUp()
vecAVel = pev->avelocity; vecAVel = pev->avelocity;
// if we've met or exceeded target speed, set target speed and stop thinking // 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)) if (Q_abs(int(vecAVel.x)) >= Q_abs(int(pev->movedir.x * pev->speed))
&& abs((int)vecAVel.y) >= abs((int)(pev->movedir.y * pev->speed)) && Q_abs(int(vecAVel.y)) >= Q_abs(int(pev->movedir.y * pev->speed))
&& abs((int)vecAVel.z) >= abs((int)(pev->movedir.z * pev->speed))) && Q_abs(int(vecAVel.z)) >= Q_abs(int(pev->movedir.z * pev->speed)))
{ {
// set speed in case we overshot // set speed in case we overshot
pev->avelocity = pev->movedir * pev->speed; pev->avelocity = pev->movedir * pev->speed;
@ -537,7 +505,6 @@ void CFuncRotating::SpinUp()
} }
} }
/* <1e9c3> ../cstrike/dlls/bmodels.cpp:615 */
void CFuncRotating::SpinDown() void CFuncRotating::SpinDown()
{ {
//rotational velocity //rotational velocity
@ -579,15 +546,12 @@ void CFuncRotating::SpinDown()
} }
} }
/* <1d304> ../cstrike/dlls/bmodels.cpp:653 */
void CFuncRotating::Rotate() void CFuncRotating::Rotate()
{ {
pev->nextthink = pev->ltime + 10; pev->nextthink = pev->ltime + 10;
} }
// Rotating Use - when a rotating brush is triggered // 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) 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)? // 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 // RotatingBlocked - An entity has blocked the brush
/* <1d325> ../cstrike/dlls/bmodels.cpp:706 */
void CFuncRotating::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther) void CFuncRotating::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther)
{ {
pOther->TakeDamage(pev, pev, pev->dmg, DMG_CRUSH); pOther->TakeDamage(pev, pev, pev->dmg, DMG_CRUSH);
} }
/* <1eb14> ../cstrike/dlls/bmodels.cpp:747 */
LINK_ENTITY_TO_CLASS(func_pendulum, CPendulum); LINK_ENTITY_TO_CLASS(func_pendulum, CPendulum);
/* <1d7d9> ../cstrike/dlls/bmodels.cpp:761 */
IMPLEMENT_SAVERESTORE(CPendulum, CBaseEntity); IMPLEMENT_SAVERESTORE(CPendulum, CBaseEntity);
/* <1db2a> ../cstrike/dlls/bmodels.cpp:765 */
void CPendulum::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) void CPendulum::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{ {
if (FStrEq(pkvd->szKeyName, "distance")) if (FStrEq(pkvd->szKeyName, "distance"))
@ -663,7 +621,6 @@ void CPendulum::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CBaseEntity::KeyValue(pkvd); CBaseEntity::KeyValue(pkvd);
} }
/* <1d9c7> ../cstrike/dlls/bmodels.cpp:782 */
void CPendulum::__MAKE_VHOOK(Spawn)() void CPendulum::__MAKE_VHOOK(Spawn)()
{ {
// set the axis of rotation // set the axis of rotation
@ -685,7 +642,7 @@ void CPendulum::__MAKE_VHOOK(Spawn)()
pev->speed = 100; pev->speed = 100;
// Calculate constant acceleration from speed and distance // 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_maxSpeed = pev->speed;
m_start = pev->angles; m_start = pev->angles;
m_center = pev->angles + (m_distance * 0.5) * pev->movedir; 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) void CPendulum::PendulumUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{ {
// Pendulum is moving, stop it and auto-return if necessary // 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() void CPendulum::Stop()
{ {
pev->angles = m_start; pev->angles = m_start;
@ -750,13 +705,11 @@ void CPendulum::Stop()
pev->avelocity = g_vecZero; pev->avelocity = g_vecZero;
} }
/* <1d3a7> ../cstrike/dlls/bmodels.cpp:861 */
void CPendulum::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther) void CPendulum::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther)
{ {
m_time = gpGlobals->time; m_time = gpGlobals->time;
} }
/* <1d533> ../cstrike/dlls/bmodels.cpp:867 */
void CPendulum::Swing() void CPendulum::Swing()
{ {
float delta, dt; float delta, dt;
@ -808,7 +761,6 @@ void CPendulum::Swing()
} }
} }
/* <1d3f5> ../cstrike/dlls/bmodels.cpp:909 */
void CPendulum::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) void CPendulum::__MAKE_VHOOK(Touch)(CBaseEntity *pOther)
{ {
entvars_t *pevOther = pOther->pev; entvars_t *pevOther = pOther->pev;
@ -832,7 +784,6 @@ void CPendulum::__MAKE_VHOOK(Touch)(CBaseEntity *pOther)
pevOther->velocity = (pevOther->origin - VecBModelOrigin(pev)).Normalize() * damage; pevOther->velocity = (pevOther->origin - VecBModelOrigin(pev)).Normalize() * damage;
} }
/* <1da85> ../cstrike/dlls/bmodels.cpp:931 */
void CPendulum::RopeTouch(CBaseEntity *pOther) void CPendulum::RopeTouch(CBaseEntity *pOther)
{ {
entvars_t *pevOther = pOther->pev; entvars_t *pevOther = pOther->pev;

View File

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

View File

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

View File

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

View File

@ -11,9 +11,8 @@ CBaseEntity *g_pSelectedZombieSpawn = NULL;
CountdownTimer BotChatterInterface::m_encourageTimer; CountdownTimer BotChatterInterface::m_encourageTimer;
IntervalTimer BotChatterInterface::m_radioSilenceInterval[ 2 ]; IntervalTimer BotChatterInterface::m_radioSilenceInterval[ 2 ];
#endif // HOOK_GAMEDLL #endif
/* <303469> ../cstrike/dlls/bot/cs_bot_chatter.cpp:32 */
const Vector *GetRandomSpotAtPlace(Place place) const Vector *GetRandomSpotAtPlace(Place place)
{ {
int count = 0; int count = 0;
@ -45,8 +44,6 @@ const Vector *GetRandomSpotAtPlace(Place place)
} }
// Transmit meme to other bots // Transmit meme to other bots
/* <303541> ../cstrike/dlls/bot/cs_bot_chatter.cpp:62 */
void BotMeme::Transmit(CCSBot *sender) const void BotMeme::Transmit(CCSBot *sender) const
{ {
for (int i = 1; i <= gpGlobals->maxClients; ++i) for (int i = 1; i <= gpGlobals->maxClients; ++i)
@ -89,8 +86,6 @@ void BotMeme::Transmit(CCSBot *sender) const
} }
// A teammate called for help - respond // 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 void BotHelpMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const
{ {
const float maxHelpRange = 3000.0f; // 2000 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 // 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 void BotBombsiteStatusMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const
{ {
// remember this bombsite's status // 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 // 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 void BotBombStatusMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const
{ {
// update our gamestate based on teammate's report // 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 // 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 void BotFollowMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const
{ {
if (receiver->IsRogue()) 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 // 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 void BotDefendHereMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const
{ {
if (receiver->IsRogue()) 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 // 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 void BotWhereBombMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const
{ {
int zone = receiver->GetGameState()->GetPlantedBombsite(); 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 // 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 void BotRequestReportMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const
{ {
receiver->GetChatter()->ReportingIn(); receiver->GetChatter()->ReportingIn();
} }
// A teammate told us all the hostages are gone // 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 void BotAllHostagesGoneMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const
{ {
receiver->GetGameState()->AllHostagesGone(); 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 // 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 void BotHostageBeingTakenMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const
{ {
receiver->GetGameState()->HostageWasTaken(); receiver->GetGameState()->HostageWasTaken();
@ -259,13 +238,11 @@ void BotHostageBeingTakenMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *r
receiver->GetChatter()->Say("Affirmative"); receiver->GetChatter()->Say("Affirmative");
} }
/* <303609> ../cstrike/dlls/bot/cs_bot_chatter.cpp:285 */
BotSpeakable::BotSpeakable() BotSpeakable::BotSpeakable()
{ {
m_phrase = NULL; m_phrase = NULL;
} }
/* <303655> ../cstrike/dlls/bot/cs_bot_chatter.cpp:291 */
BotSpeakable::~BotSpeakable() BotSpeakable::~BotSpeakable()
{ {
if (m_phrase != NULL) 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) BotPhrase::BotPhrase(unsigned int id, bool isPlace)
{ {
m_name = NULL; m_name = NULL;
@ -290,12 +266,11 @@ BotPhrase::BotPhrase(unsigned int id, bool isPlace)
InitVoiceBank(0); InitVoiceBank(0);
} }
/* <3036c2> ../cstrike/dlls/bot/cs_bot_chatter.cpp:314 */
BotPhrase::~BotPhrase() 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]; delete (*m_voiceBank[bank])[speakable];
} }
@ -303,10 +278,12 @@ BotPhrase::~BotPhrase()
} }
if (m_name != NULL) 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) void BotPhrase::InitVoiceBank(int bankIndex)
{ {
while (m_numVoiceBanks <= bankIndex) while (m_numVoiceBanks <= bankIndex)
@ -319,8 +296,6 @@ void BotPhrase::InitVoiceBank(int bankIndex)
} }
// Return a random speakable - avoid repeating // Return a random speakable - avoid repeating
/* <303917> ../cstrike/dlls/bot/cs_bot_chatter.cpp:340 */
char *BotPhrase::GetSpeakable(int bankIndex, float *duration) const char *BotPhrase::GetSpeakable(int bankIndex, float *duration) const
{ {
if (bankIndex < 0 || bankIndex >= m_numVoiceBanks || m_count[bankIndex] == 0) 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 // Randomly shuffle the speakable order
/* <30395a> ../cstrike/dlls/bot/cs_bot_chatter.cpp:395 */
#ifndef HOOK_GAMEDLL #ifndef HOOK_GAMEDLL
void BotPhrase::Randomize() 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()); 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() BotPhraseManager::BotPhraseManager()
{ {
for (int i = 0; i < MAX_PLACES_PER_MAP; ++i) for (int i = 0; i < MAX_PLACES_PER_MAP; ++i)
@ -398,16 +370,12 @@ BotPhraseManager::BotPhraseManager()
} }
// Invoked when map changes // Invoked when map changes
/* <303c45> ../cstrike/dlls/bot/cs_bot_chatter.cpp:417 */
void BotPhraseManager::OnMapChange() void BotPhraseManager::OnMapChange()
{ {
m_placeCount = 0; m_placeCount = 0;
} }
// Invoked when the round resets // Invoked when the round resets
/* <303c70> ../cstrike/dlls/bot/cs_bot_chatter.cpp:425 */
void BotPhraseManager::OnRoundRestart() void BotPhraseManager::OnRoundRestart()
{ {
// effectively reset all interval timers // effectively reset all interval timers
@ -427,8 +395,6 @@ void BotPhraseManager::OnRoundRestart()
} }
// Initialize phrase system from database file // Initialize phrase system from database file
/* <30c1fc> ../cstrike/dlls/bot/cs_bot_chatter.cpp:443 */
bool BotPhraseManager::Initialize(const char *filename, int bankIndex) bool BotPhraseManager::Initialize(const char *filename, int bankIndex)
{ {
bool isDefault = (bankIndex == 0); bool isDefault = (bankIndex == 0);
@ -672,44 +638,27 @@ bool BotPhraseManager::Initialize(const char *filename, int bankIndex)
} }
FREE_FILE(phraseDataFile); FREE_FILE(phraseDataFile);
return true; return true;
} }
/* <30409e> ../cstrike/dlls/bot/cs_bot_chatter.cpp:682 */
BotPhraseManager::~BotPhraseManager() BotPhraseManager::~BotPhraseManager()
{ {
BotPhraseList::iterator iter; BotPhraseList::iterator iter;
for (iter = m_list.begin(); iter != m_list.end(); ++iter) for (iter = m_list.begin(); iter != m_list.end(); ++iter)
{ delete (*iter);
const BotPhrase *phrase = *iter;
if (phrase != NULL)
{
delete phrase;
}
}
for (iter = m_placeList.begin(); iter != m_placeList.end(); ++iter) for (iter = m_placeList.begin(); iter != m_placeList.end(); ++iter)
{ delete (*iter);
const BotPhrase *phrase = *iter;
if (phrase != NULL)
{
delete phrase;
}
}
m_list.clear(); m_list.clear();
m_placeList.clear(); m_placeList.clear();
} }
/* <3043ec> ../cstrike/dlls/bot/cs_bot_chatter.cpp:708 */
Place BotPhraseManager::NameToID(const char *name) const Place BotPhraseManager::NameToID(const char *name) const
{ {
for (BotPhraseList::const_iterator iter = m_placeList.begin(); iter != m_placeList.end(); ++iter) 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)) if (!Q_stricmp(phrase->m_name, name))
return phrase->m_id; 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) 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)) if (!Q_stricmp(phrase->m_name, name))
return phrase->m_id; return phrase->m_id;
@ -726,12 +675,11 @@ Place BotPhraseManager::NameToID(const char *name) const
return 0; return 0;
} }
/* <3044b4> ../cstrike/dlls/bot/cs_bot_chatter.cpp:732 */
const char *BotPhraseManager::IDToName(Place id) const const char *BotPhraseManager::IDToName(Place id) const
{ {
for (BotPhraseList::const_iterator iter = m_placeList.begin(); iter != m_placeList.end(); ++iter) 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) if (phrase->m_id == id)
return phrase->m_name; 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) 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) if (phrase->m_id == id)
return phrase->m_name; return phrase->m_name;
@ -749,13 +697,11 @@ const char *BotPhraseManager::IDToName(Place id) const
} }
// Given a name, return the associated phrase collection // 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 const BotPhrase *BotPhraseManager::GetPhrase(const char *name) const
{ {
for (BotPhraseList::const_iterator iter = m_list.begin(); iter != m_list.end(); ++iter) 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)) if (!Q_stricmp(phrase->m_name, name))
return phrase; return phrase;
@ -765,15 +711,14 @@ const BotPhrase *BotPhraseManager::GetPhrase(const char *name) const
return NULL; return NULL;
} }
/*
// Given an id, return the associated phrase collection // Given an id, return the associated phrase collection
// TODO: Store phrases in a vector to make this fast // TODO: Store phrases in a vector to make this fast
/*
const BotPhrase *BotPhraseManager::GetPhrase(unsigned int id) const const BotPhrase *BotPhraseManager::GetPhrase(unsigned int id) const
{ {
for (BotPhraseList::const_iterator iter = m_list.begin(); iter != m_list.end(); ++iter) 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) if (phrase->m_id == id)
return phrase; return phrase;
@ -785,8 +730,6 @@ const BotPhrase *BotPhraseManager::GetPhrase(unsigned int id) const
*/ */
// Given a name, return the associated Place phrase collection // 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 const BotPhrase *BotPhraseManager::GetPlace(const char *name) const
{ {
if (name == NULL) 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) 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)) if (!Q_stricmp(phrase->m_name, name))
return phrase; return phrase;
@ -804,8 +747,6 @@ const BotPhrase *BotPhraseManager::GetPlace(const char *name) const
} }
// Given a place, return the associated Place phrase collection // 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 const BotPhrase *BotPhraseManager::GetPlace(PlaceCriteria place) const
{ {
if (place == UNDEFINED_PLACE) 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) 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) if (phrase->m_id == place)
return phrase; return phrase;
@ -822,7 +763,6 @@ const BotPhrase *BotPhraseManager::GetPlace(PlaceCriteria place) const
return NULL; return NULL;
} }
/* <30477e> ../cstrike/dlls/bot/cs_bot_chatter.cpp:830 */
BotStatement::BotStatement(BotChatterInterface *chatter, BotStatementType type, float expireDuration) BotStatement::BotStatement(BotChatterInterface *chatter, BotStatementType type, float expireDuration)
{ {
m_chatter = chatter; m_chatter = chatter;
@ -847,32 +787,27 @@ BotStatement::BotStatement(BotChatterInterface *chatter, BotStatementType type,
m_conditionCount = 0; m_conditionCount = 0;
} }
/* <3047bd> ../cstrike/dlls/bot/cs_bot_chatter.cpp:855 */
BotStatement::~BotStatement() BotStatement::~BotStatement()
{ {
if (m_meme != NULL) if (m_meme != NULL)
{ {
delete m_meme; delete m_meme;
m_meme = NULL;
} }
} }
/* <3047e0> ../cstrike/dlls/bot/cs_bot_chatter.cpp:863 */
CCSBot *BotStatement::GetOwner() const CCSBot *BotStatement::GetOwner() const
{ {
return m_chatter->GetOwner(); return m_chatter->GetOwner();
} }
// Attach a meme to this statement, to be transmitted to other friendly bots when spoken // 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) void BotStatement::AttachMeme(BotMeme *meme)
{ {
m_meme = meme; m_meme = meme;
} }
// Add a conditions that must be true for the statement to be spoken // 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) void BotStatement::AddCondition(ConditionType condition)
{ {
if (m_conditionCount < MAX_BOT_CONDITIONS) 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 // Return true if this statement is "important" and not personality chatter
/* <30485b> ../cstrike/dlls/bot/cs_bot_chatter.cpp:891 */
bool BotStatement::IsImportant() const bool BotStatement::IsImportant() const
{ {
// if a statement contains any important phrases, it is important // if a statement contains any important phrases, it is important
@ -899,8 +832,6 @@ bool BotStatement::IsImportant() const
} }
// Verify all attached conditions // Verify all attached conditions
/* <3048bc> ../cstrike/dlls/bot/cs_bot_chatter.cpp:911 */
bool BotStatement::IsValid() const bool BotStatement::IsValid() const
{ {
for (int i = 0; i < m_conditionCount; ++i) 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 // 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 bool BotStatement::IsRedundant(const BotStatement *say) const
{ {
// special cases // special cases
@ -970,8 +899,6 @@ bool BotStatement::IsRedundant(const BotStatement *say) const
} }
// Return true if this statement is no longer appropriate to say // Return true if this statement is no longer appropriate to say
/* <304977> ../cstrike/dlls/bot/cs_bot_chatter.cpp:990 */
bool BotStatement::IsObsolete() const bool BotStatement::IsObsolete() const
{ {
// if the round is over, the only things we should say are emotes // 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 // 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) void BotStatement::Convert(const BotStatement *say)
{ {
if (GetType() == REPORT_MY_PLAN && say->GetType() == REPORT_MY_PLAN) 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) void BotStatement::AppendPhrase(const BotPhrase *phrase)
{ {
if (phrase == NULL) if (phrase == NULL)
@ -1039,8 +963,6 @@ void BotStatement::AppendPhrase(const BotPhrase *phrase)
} }
// Special phrases that depend on the context // Special phrases that depend on the context
/* <304acf> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1052 */
void BotStatement::AppendPhrase(ContextType contextPhrase) void BotStatement::AppendPhrase(ContextType contextPhrase)
{ {
if (m_count < MAX_BOT_PHRASES) if (m_count < MAX_BOT_PHRASES)
@ -1052,8 +974,6 @@ void BotStatement::AppendPhrase(ContextType contextPhrase)
// Say our statement // Say our statement
// m_index refers to the phrase currently being spoken, or -1 if we havent started yet // 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() bool BotStatement::Update()
{ {
CCSBot *me = GetOwner(); CCSBot *me = GetOwner();
@ -1249,8 +1169,6 @@ bool BotStatement::Update()
// If this statement refers to a specific place, return that place // If this statement refers to a specific place, return that place
// Places can be implicit in the statement, or explicitly defined // Places can be implicit in the statement, or explicitly defined
/* <2fee36> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1266 */
Place BotStatement::GetPlace() const Place BotStatement::GetPlace() const
{ {
// return any explicitly set place if we have one // 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 // Return true if this statement has an associated count
/* <305289> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1283 */
bool BotStatement::HasCount() const bool BotStatement::HasCount() const
{ {
for (int i = 0; i < m_count; ++i) 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; static int nextPitch = P_HI;
/* <305543> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1308 */
BotChatterInterface::BotChatterInterface(CCSBot *me) BotChatterInterface::BotChatterInterface(CCSBot *me)
{ {
m_me = me; m_me = me;
@ -1308,7 +1223,6 @@ BotChatterInterface::BotChatterInterface(CCSBot *me)
Reset(); Reset();
} }
/* <305307> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1334 */
BotChatterInterface::~BotChatterInterface() BotChatterInterface::~BotChatterInterface()
{ {
// free pending statements // free pending statements
@ -1321,8 +1235,6 @@ BotChatterInterface::~BotChatterInterface()
} }
// Reset to initial state // Reset to initial state
/* <305386> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1347 */
void BotChatterInterface::Reset() void BotChatterInterface::Reset()
{ {
BotStatement *msg, *nextMsg; BotStatement *msg, *nextMsg;
@ -1354,8 +1266,6 @@ void BotChatterInterface::Reset()
} }
// Register a statement for speaking // Register a statement for speaking
/* <305661> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1381 */
void BotChatterInterface::AddStatement(BotStatement *statement, bool mustAdd) void BotChatterInterface::AddStatement(BotStatement *statement, bool mustAdd)
{ {
// don't add statements if bot chatter is shut off // don't add statements if bot chatter is shut off
@ -1443,8 +1353,6 @@ void BotChatterInterface::AddStatement(BotStatement *statement, bool mustAdd)
} }
// Remove a statement // Remove a statement
/* <3056fa> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1462 */
void BotChatterInterface::RemoveStatement(BotStatement *statement) void BotChatterInterface::RemoveStatement(BotStatement *statement)
{ {
if (statement->m_next != NULL) if (statement->m_next != NULL)
@ -1459,8 +1367,6 @@ void BotChatterInterface::RemoveStatement(BotStatement *statement)
} }
// Track nearby enemy count and report enemy activity // Track nearby enemy count and report enemy activity
/* <3087ee> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1479 */
void BotChatterInterface::ReportEnemies() void BotChatterInterface::ReportEnemies()
{ {
if (!m_me->IsAlive()) 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) void BotChatterInterface::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
{ {
; ;
} }
// Invoked when we die // Invoked when we die
/* <30579e> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1524 */
void BotChatterInterface::OnDeath() void BotChatterInterface::OnDeath()
{ {
if (IsTalking()) if (IsTalking())
@ -1524,8 +1427,6 @@ void BotChatterInterface::OnDeath()
} }
// Process ongoing chatter for this bot // Process ongoing chatter for this bot
/* <308852> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1549 */
void BotChatterInterface::Update() void BotChatterInterface::Update()
{ {
// report enemy activity // 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 // 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() BotStatement *BotChatterInterface::GetActiveStatement()
{ {
// keep track of statement waiting longest to be spoken - it is next // 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 // Return true if we speaking makes sense now
/* <305a35> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1694 */
bool BotChatterInterface::ShouldSpeak() const bool BotChatterInterface::ShouldSpeak() const
{ {
// don't talk to non-existent friends // don't talk to non-existent friends
@ -1679,27 +1576,22 @@ bool BotChatterInterface::ShouldSpeak() const
return true; return true;
} }
/* <305a8f> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1708 */
float BotChatterInterface::GetRadioSilenceDuration() float BotChatterInterface::GetRadioSilenceDuration()
{ {
return IMPL(m_radioSilenceInterval)[ m_me->m_iTeam - 1 ].GetElapsedTime(); return IMPL(m_radioSilenceInterval)[ m_me->m_iTeam - 1 ].GetElapsedTime();
} }
/* <305b15> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1714 */
void BotChatterInterface::ResetRadioSilenceDuration() void BotChatterInterface::ResetRadioSilenceDuration()
{ {
IMPL(m_radioSilenceInterval)[m_me->m_iTeam - 1].Reset(); 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) inline void SayWhere(BotStatement *say, Place place)
{ {
say->AppendPhrase(TheBotPhrases->GetPlace(place)); say->AppendPhrase(TheBotPhrases->GetPlace(place));
} }
// Report enemy sightings // Report enemy sightings
/* <305b50> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1740 */
void BotChatterInterface::EnemySpotted() void BotChatterInterface::EnemySpotted()
{ {
// NOTE: This could be a few seconds out of date (enemy is in an adjacent place) // 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); AddStatement(say);
} }
/* <305da4> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1759 */
NOXREF void BotChatterInterface::Clear(Place place) NOXREF void BotChatterInterface::Clear(Place place)
{ {
BotStatement *say = new BotStatement(this, REPORT_INFORMATION, 10.0f); BotStatement *say = new BotStatement(this, REPORT_INFORMATION, 10.0f);
@ -1729,8 +1620,6 @@ NOXREF void BotChatterInterface::Clear(Place place)
} }
// Request enemy activity report // Request enemy activity report
/* <305ffa> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1773 */
void BotChatterInterface::ReportIn() void BotChatterInterface::ReportIn()
{ {
BotStatement *say = new BotStatement(this, REPORT_REQUEST_INFORMATION, 10.0f); BotStatement *say = new BotStatement(this, REPORT_REQUEST_INFORMATION, 10.0f);
@ -1742,11 +1631,8 @@ void BotChatterInterface::ReportIn()
} }
// Report our situtation // Report our situtation
/* <309851> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1788 */
void BotChatterInterface::ReportingIn() void BotChatterInterface::ReportingIn()
{ {
CCSBotManager *ctrl = TheCSBots();
BotStatement *say = new BotStatement(this, REPORT_INFORMATION, 10.0f); BotStatement *say = new BotStatement(this, REPORT_INFORMATION, 10.0f);
// where are we // where are we
@ -1768,10 +1654,10 @@ void BotChatterInterface::ReportingIn()
} }
case CCSBot::GUARD_LOOSE_BOMB: case CCSBot::GUARD_LOOSE_BOMB:
{ {
if (ctrl->GetLooseBomb()) if (TheCSBots()->GetLooseBomb())
{ {
say->AppendPhrase(TheBotPhrases->GetPhrase("GuardingLooseBomb")); 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; break;
} }
@ -1841,7 +1727,6 @@ void BotChatterInterface::ReportingIn()
AddStatement(say); AddStatement(say);
} }
/* <3084cf> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1896 */
bool BotChatterInterface::NeedBackup() bool BotChatterInterface::NeedBackup()
{ {
const float minRequestInterval = 10.0f; const float minRequestInterval = 10.0f;
@ -1873,7 +1758,6 @@ bool BotChatterInterface::NeedBackup()
return true; return true;
} }
/* <3061a8> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1929 */
void BotChatterInterface::PinnedDown() void BotChatterInterface::PinnedDown()
{ {
// this is a form of "need backup" // this is a form of "need backup"
@ -1896,7 +1780,6 @@ void BotChatterInterface::PinnedDown()
AddStatement(say); AddStatement(say);
} }
/* <3064e2> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1952 */
void BotChatterInterface::HeardNoise(const Vector *pos) void BotChatterInterface::HeardNoise(const Vector *pos)
{ {
if (TheCSBots()->IsRoundOver()) 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) void BotChatterInterface::KilledMyEnemy(int victimID)
{ {
// only report if we killed the last enemy in the area // only report if we killed the last enemy in the area
@ -1933,7 +1815,6 @@ void BotChatterInterface::KilledMyEnemy(int victimID)
AddStatement(say); AddStatement(say);
} }
/* <306853> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1993 */
void BotChatterInterface::EnemiesRemaining() void BotChatterInterface::EnemiesRemaining()
{ {
// only report if we killed the last enemy in the area // only report if we killed the last enemy in the area
@ -1946,7 +1827,6 @@ void BotChatterInterface::EnemiesRemaining()
AddStatement(say); AddStatement(say);
} }
/* <306974> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2008 */
void BotChatterInterface::Affirmative() void BotChatterInterface::Affirmative()
{ {
BotStatement *say = new BotStatement(this, REPORT_ACKNOWLEDGE, 3.0f); BotStatement *say = new BotStatement(this, REPORT_ACKNOWLEDGE, 3.0f);
@ -1954,7 +1834,6 @@ void BotChatterInterface::Affirmative()
AddStatement(say); AddStatement(say);
} }
/* <306bb2> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2018 */
void BotChatterInterface::Negative() void BotChatterInterface::Negative()
{ {
BotStatement *say = new BotStatement(this, REPORT_ACKNOWLEDGE, 3.0f); BotStatement *say = new BotStatement(this, REPORT_ACKNOWLEDGE, 3.0f);
@ -1962,7 +1841,6 @@ void BotChatterInterface::Negative()
AddStatement(say); AddStatement(say);
} }
/* <306cf4> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2028 */
void BotChatterInterface::GoingToPlantTheBomb(Place place) void BotChatterInterface::GoingToPlantTheBomb(Place place)
{ {
if (TheCSBots()->IsRoundOver()) if (TheCSBots()->IsRoundOver())
@ -1981,7 +1859,6 @@ void BotChatterInterface::GoingToPlantTheBomb(Place place)
AddStatement(say); AddStatement(say);
} }
/* <306ef6> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2050 */
void BotChatterInterface::PlantingTheBomb(Place place) void BotChatterInterface::PlantingTheBomb(Place place)
{ {
if (TheCSBots()->IsRoundOver()) if (TheCSBots()->IsRoundOver())
@ -1994,7 +1871,6 @@ void BotChatterInterface::PlantingTheBomb(Place place)
AddStatement(say); AddStatement(say);
} }
/* <3070c8> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2066 */
void BotChatterInterface::TheyPickedUpTheBomb() void BotChatterInterface::TheyPickedUpTheBomb()
{ {
if (TheCSBots()->IsRoundOver()) if (TheCSBots()->IsRoundOver())
@ -2014,7 +1890,6 @@ void BotChatterInterface::TheyPickedUpTheBomb()
AddStatement(say); AddStatement(say);
} }
/* <307272> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2090 */
void BotChatterInterface::SpottedBomber(CBasePlayer *bomber) void BotChatterInterface::SpottedBomber(CBasePlayer *bomber)
{ {
if (m_me->GetGameState()->IsBombMoving()) if (m_me->GetGameState()->IsBombMoving())
@ -2044,7 +1919,6 @@ void BotChatterInterface::SpottedBomber(CBasePlayer *bomber)
AddStatement(say); AddStatement(say);
} }
/* <30761a> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2122 */
void BotChatterInterface::SpottedLooseBomb(CBaseEntity *bomb) void BotChatterInterface::SpottedLooseBomb(CBaseEntity *bomb)
{ {
if (TheCSBots()->IsRoundOver()) 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) NOXREF void BotChatterInterface::GuardingLooseBomb(CBaseEntity *bomb)
{ {
if (TheCSBots()->IsRoundOver() || !bomb) if (TheCSBots()->IsRoundOver() || !bomb)
@ -2090,7 +1963,7 @@ NOXREF void BotChatterInterface::GuardingLooseBomb(CBaseEntity *bomb)
return; return;
m_planInterval.Reset(); m_planInterval.Reset();
#endif // REGAMEDLL_FIXES #endif
// update our gamestate // update our gamestate
m_me->GetGameState()->UpdateLooseBomb(&bomb->pev->origin); m_me->GetGameState()->UpdateLooseBomb(&bomb->pev->origin);
@ -2110,7 +1983,6 @@ NOXREF void BotChatterInterface::GuardingLooseBomb(CBaseEntity *bomb)
AddStatement(say); AddStatement(say);
} }
/* <307c56> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2186 */
void BotChatterInterface::RequestBombLocation() void BotChatterInterface::RequestBombLocation()
{ {
// only ask once per round // only ask once per round
@ -2126,7 +1998,6 @@ void BotChatterInterface::RequestBombLocation()
AddStatement(say); AddStatement(say);
} }
/* <307de2> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2205 */
void BotChatterInterface::BombsiteClear(int zoneIndex) void BotChatterInterface::BombsiteClear(int zoneIndex)
{ {
const CCSBotManager::Zone *zone = TheCSBots()->GetZone(zoneIndex); const CCSBotManager::Zone *zone = TheCSBots()->GetZone(zoneIndex);
@ -2141,7 +2012,6 @@ void BotChatterInterface::BombsiteClear(int zoneIndex)
AddStatement(say); AddStatement(say);
} }
/* <3080b8> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2223 */
void BotChatterInterface::FoundPlantedBomb(int zoneIndex) void BotChatterInterface::FoundPlantedBomb(int zoneIndex)
{ {
const CCSBotManager::Zone *zone = TheCSBots()->GetZone(zoneIndex); const CCSBotManager::Zone *zone = TheCSBots()->GetZone(zoneIndex);
@ -2155,7 +2025,6 @@ void BotChatterInterface::FoundPlantedBomb(int zoneIndex)
AddStatement(say); AddStatement(say);
} }
/* <308308> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2242 */
void BotChatterInterface::Scared() void BotChatterInterface::Scared()
{ {
const float minInterval = 10.0f; const float minInterval = 10.0f;
@ -2170,7 +2039,6 @@ void BotChatterInterface::Scared()
AddStatement(say); AddStatement(say);
} }
/* <308b60> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2259 */
void BotChatterInterface::CelebrateWin() void BotChatterInterface::CelebrateWin()
{ {
BotStatement *say = new BotStatement(this, REPORT_EMOTE, 15.0f); 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)); say->SetStartTime(gpGlobals->time + RANDOM_FLOAT(2.0f, 5.0f));
const float quickRound = 45.0f; const float quickRound = 45.0f;
CCSBotManager *ctrl = TheCSBots();
if (m_me->GetFriendsRemaining() == 0) if (m_me->GetFriendsRemaining() == 0)
{ {
// we were the last man standing // we were the last man standing
if (ctrl->GetElapsedRoundTime() < quickRound) if (TheCSBots()->GetElapsedRoundTime() < quickRound)
say->AppendPhrase(TheBotPhrases->GetPhrase("WonRoundQuickly")); say->AppendPhrase(TheBotPhrases->GetPhrase("WonRoundQuickly"));
else if (RANDOM_FLOAT(0.0f, 100.0f) < 33.3f) else if (RANDOM_FLOAT(0.0f, 100.0f) < 33.3f)
say->AppendPhrase(TheBotPhrases->GetPhrase("LastManStanding")); say->AppendPhrase(TheBotPhrases->GetPhrase("LastManStanding"));
} }
else else
{ {
if (ctrl->GetElapsedRoundTime() < quickRound) if (TheCSBots()->GetElapsedRoundTime() < quickRound)
{ {
if (RANDOM_FLOAT(0.0f, 100.0f) < 33.3f) if (RANDOM_FLOAT(0.0f, 100.0f) < 33.3f)
say->AppendPhrase(TheBotPhrases->GetPhrase("WonRoundQuickly")); say->AppendPhrase(TheBotPhrases->GetPhrase("WonRoundQuickly"));
@ -2205,11 +2072,9 @@ void BotChatterInterface::CelebrateWin()
AddStatement(say); AddStatement(say);
} }
/* <308e52> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2294 */
void BotChatterInterface::AnnouncePlan(const char *phraseName, Place place) void BotChatterInterface::AnnouncePlan(const char *phraseName, Place place)
{ {
CCSBotManager *ctrl = TheCSBots(); if (TheCSBots()->IsRoundOver())
if (ctrl->IsRoundOver())
return; return;
BotStatement *say = new BotStatement(this, REPORT_MY_PLAN, 10.0f); 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); say->SetPlace(place);
// wait at least a short time after round start // 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); AddStatement(say);
} }
/* <308fdd> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2312 */
void BotChatterInterface::GuardingHostages(Place place, bool isPlan) void BotChatterInterface::GuardingHostages(Place place, bool isPlan)
{ {
if (TheCSBots()->IsRoundOver()) if (TheCSBots()->IsRoundOver())
@ -2233,7 +2097,7 @@ void BotChatterInterface::GuardingHostages(Place place, bool isPlan)
#ifdef REGAMEDLL_FIXES #ifdef REGAMEDLL_FIXES
m_planInterval.Reset(); m_planInterval.Reset();
#endif // REGAMEDLL_FIXES #endif
if (isPlan) if (isPlan)
AnnouncePlan("GoingToGuardHostages", place); AnnouncePlan("GoingToGuardHostages", place);
@ -2241,7 +2105,6 @@ void BotChatterInterface::GuardingHostages(Place place, bool isPlan)
Say("GuardingHostages"); Say("GuardingHostages");
} }
/* <3091eb> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2329 */
void BotChatterInterface::GuardingHostageEscapeZone(bool isPlan) void BotChatterInterface::GuardingHostageEscapeZone(bool isPlan)
{ {
if (TheCSBots()->IsRoundOver()) if (TheCSBots()->IsRoundOver())
@ -2253,7 +2116,7 @@ void BotChatterInterface::GuardingHostageEscapeZone(bool isPlan)
#ifdef REGAMEDLL_FIXES #ifdef REGAMEDLL_FIXES
m_planInterval.Reset(); m_planInterval.Reset();
#endif // REGAMEDLL_FIXES #endif
if (isPlan) if (isPlan)
AnnouncePlan("GoingToGuardHostageEscapeZone", UNDEFINED_PLACE); AnnouncePlan("GoingToGuardHostageEscapeZone", UNDEFINED_PLACE);
@ -2261,7 +2124,6 @@ void BotChatterInterface::GuardingHostageEscapeZone(bool isPlan)
Say("GuardingHostageEscapeZone"); Say("GuardingHostageEscapeZone");
} }
/* <3093a9> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2346 */
void BotChatterInterface::HostagesBeingTaken() void BotChatterInterface::HostagesBeingTaken()
{ {
if (TheCSBots()->IsRoundOver()) if (TheCSBots()->IsRoundOver())
@ -2273,7 +2135,6 @@ void BotChatterInterface::HostagesBeingTaken()
AddStatement(say); AddStatement(say);
} }
/* <309542> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2361 */
void BotChatterInterface::HostagesTaken() void BotChatterInterface::HostagesTaken()
{ {
if (TheCSBots()->IsRoundOver()) if (TheCSBots()->IsRoundOver())
@ -2284,13 +2145,11 @@ void BotChatterInterface::HostagesTaken()
AddStatement(say); AddStatement(say);
} }
/* <309691> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2375 */
void BotChatterInterface::TalkingToHostages() void BotChatterInterface::TalkingToHostages()
{ {
; ;
} }
/* <3096bc> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2380 */
void BotChatterInterface::EscortingHostages() void BotChatterInterface::EscortingHostages()
{ {
if (TheCSBots()->IsRoundOver()) if (TheCSBots()->IsRoundOver())
@ -2307,7 +2166,6 @@ void BotChatterInterface::EscortingHostages()
} }
} }
/* <30a5b9> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2400 */
NOXREF void BotChatterInterface::HostageDown() NOXREF void BotChatterInterface::HostageDown()
{ {
if (TheCSBots()->IsRoundOver()) if (TheCSBots()->IsRoundOver())
@ -2318,7 +2176,6 @@ NOXREF void BotChatterInterface::HostageDown()
AddStatement(say); AddStatement(say);
} }
/* <30a708> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2414 */
void BotChatterInterface::Encourage(const char *phraseName, float repeatInterval, float lifetime) void BotChatterInterface::Encourage(const char *phraseName, float repeatInterval, float lifetime)
{ {
if (IMPL(m_encourageTimer).IsElapsed()) 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() void BotChatterInterface::KilledFriend()
{ {
BotStatement *say = new BotStatement(this, REPORT_KILLED_FRIEND, 2.0f); BotStatement *say = new BotStatement(this, REPORT_KILLED_FRIEND, 2.0f);
@ -2339,7 +2195,6 @@ void BotChatterInterface::KilledFriend()
AddStatement(say); AddStatement(say);
} }
/* <30aa67> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2440 */
void BotChatterInterface::FriendlyFire() void BotChatterInterface::FriendlyFire()
{ {
BotStatement *say = new BotStatement(this, REPORT_FRIENDLY_FIRE, 1.0f); 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 // A meme is a unit information that bots use to
// transmit information to each other via the radio // transmit information to each other via the radio
/* <2fe97b> ../cstrike/dlls/bot/cs_bot_chatter.h:42 */
class BotMeme class BotMeme
{ {
public: public:
@ -63,7 +61,7 @@ public:
void Interpret_(CCSBot *sender, CCSBot *receiver) const; void Interpret_(CCSBot *sender, CCSBot *receiver) const;
#endif // HOOK_GAMEDLL #endif
}; };
@ -76,11 +74,10 @@ public:
void Interpret_(CCSBot *sender, CCSBot *receiver) const; void Interpret_(CCSBot *sender, CCSBot *receiver) const;
#endif // HOOK_GAMEDLL #endif
}; };
/* <2ff7ef> ../cstrike/dlls/bot/cs_bot_chatter.h:53 */
class BotHelpMeme: public BotMeme class BotHelpMeme: public BotMeme
{ {
public: public:
@ -94,13 +91,12 @@ public:
void Interpret_(CCSBot *sender, CCSBot *receiver) const; void Interpret_(CCSBot *sender, CCSBot *receiver) const;
#endif // HOOK_GAMEDLL #endif
private: private:
Place m_place; Place m_place;
}; };
/* <2ff65e> ../cstrike/dlls/bot/cs_bot_chatter.h:70 */
class BotBombsiteStatusMeme: public BotMeme class BotBombsiteStatusMeme: public BotMeme
{ {
public: public:
@ -117,14 +113,13 @@ public:
void Interpret_(CCSBot *sender, CCSBot *receiver) const; void Interpret_(CCSBot *sender, CCSBot *receiver) const;
#endif // HOOK_GAMEDLL #endif
private: private:
int m_zoneIndex; // the bombsite int m_zoneIndex; // the bombsite
StatusType m_status; // whether it is cleared or the bomb is there (planted) 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 class BotBombStatusMeme: public BotMeme
{ {
public: public:
@ -141,14 +136,13 @@ public:
void Interpret_(CCSBot *sender, CCSBot *receiver) const; void Interpret_(CCSBot *sender, CCSBot *receiver) const;
#endif // HOOK_GAMEDLL #endif
private: private:
CSGameState::BombState m_state; CSGameState::BombState m_state;
Vector m_pos; Vector m_pos;
}; };
/* <2ff75d> ../cstrike/dlls/bot/cs_bot_chatter.h:101 */
class BotFollowMeme: public BotMeme class BotFollowMeme: public BotMeme
{ {
public: public:
@ -158,10 +152,9 @@ public:
void Interpret_(CCSBot *sender, CCSBot *receiver) const; void Interpret_(CCSBot *sender, CCSBot *receiver) const;
#endif // HOOK_GAMEDLL #endif
}; };
/* <2ff731> ../cstrike/dlls/bot/cs_bot_chatter.h:111 */
class BotDefendHereMeme: public BotMeme class BotDefendHereMeme: public BotMeme
{ {
public: public:
@ -175,13 +168,12 @@ public:
void Interpret_(CCSBot *sender, CCSBot *receiver) const; void Interpret_(CCSBot *sender, CCSBot *receiver) const;
#endif // HOOK_GAMEDLL #endif
private: private:
Vector m_pos; Vector m_pos;
}; };
/* <2ff696> ../cstrike/dlls/bot/cs_bot_chatter.h:123 */
class BotWhereBombMeme: public BotMeme class BotWhereBombMeme: public BotMeme
{ {
public: public:
@ -191,10 +183,9 @@ public:
void Interpret_(CCSBot *sender, CCSBot *receiver) const; void Interpret_(CCSBot *sender, CCSBot *receiver) const;
#endif // HOOK_GAMEDLL #endif
}; };
/* <2ff81b> ../cstrike/dlls/bot/cs_bot_chatter.h:130 */
class BotRequestReportMeme: public BotMeme class BotRequestReportMeme: public BotMeme
{ {
public: public:
@ -204,7 +195,7 @@ public:
void Interpret_(CCSBot *sender, CCSBot *receiver) const; void Interpret_(CCSBot *sender, CCSBot *receiver) const;
#endif // HOOK_GAMEDLL #endif
}; };
@ -258,17 +249,17 @@ public:
void SetPlaceCriteria(PlaceCriteria place) const; // all returned phrases must have this place criteria void SetPlaceCriteria(PlaceCriteria place) const; // all returned phrases must have this place criteria
void SetCountCriteria(CountCriteria count) const; // all returned phrases must have this count criteria void SetCountCriteria(CountCriteria count) const; // all returned phrases must have this count criteria
const char *GetName() const { return m_name; } const char *GetName() const { return m_name; }
Place GetID() const { return m_id; } Place GetID() const { return m_id; }
GameEventType GetRadioEquivalent() const { return m_radioEvent; } GameEventType GetRadioEquivalent() const { return m_radioEvent; }
bool IsImportant() const { return m_isImportant; } // return true if this phrase is part of an important statement bool IsImportant() const { return m_isImportant; } // return true if this phrase is part of an important statement
bool IsPlace() const { return m_isPlace; } bool IsPlace() const { return m_isPlace; }
void Randomize(); // randomly shuffle the speakable order void Randomize(); // randomly shuffle the speakable order
#ifndef HOOK_GAMEDLL #ifndef HOOK_GAMEDLL
private: private:
#endif // HOOK_GAMEDLL #endif
friend class BotPhraseManager; friend class BotPhraseManager;
BotPhrase(unsigned int id, bool isPlace); BotPhrase(unsigned int id, bool isPlace);
@ -292,20 +283,17 @@ private:
typedef std::STD_LIST<BotPhrase *> BotPhraseList; typedef std::STD_LIST<BotPhrase *> BotPhraseList;
/* <2fea0e> ../cstrike/dlls/bot/cs_bot_chatter.h:239 */
inline void BotPhrase::ClearCriteria() const inline void BotPhrase::ClearCriteria() const
{ {
m_placeCriteria = ANY_PLACE; m_placeCriteria = ANY_PLACE;
m_countCriteria = UNDEFINED_COUNT; m_countCriteria = UNDEFINED_COUNT;
} }
/* <2fea2a> ../cstrike/dlls/bot/cs_bot_chatter.h:245 */
inline void BotPhrase::SetPlaceCriteria(PlaceCriteria place) const inline void BotPhrase::SetPlaceCriteria(PlaceCriteria place) const
{ {
m_placeCriteria = place; m_placeCriteria = place;
} }
/* <2fea52> ../cstrike/dlls/bot/cs_bot_chatter.h:250 */
inline void BotPhrase::SetCountCriteria(CountCriteria count) const inline void BotPhrase::SetCountCriteria(CountCriteria count) const
{ {
m_countCriteria = count; m_countCriteria = count;
@ -338,7 +326,7 @@ public:
// given an id, return the associated Place phrase collection // given an id, return the associated Place phrase collection
const BotPhrase *GetPlace(PlaceCriteria place) const; const BotPhrase *GetPlace(PlaceCriteria place) const;
const BotPhraseList *GetPlaceList() const { return &m_placeList; } const BotPhraseList *GetPlaceList() const { return &m_placeList; }
// return time last statement of given type was emitted by a teammate for the given place // return time last statement of given type was emitted by a teammate for the given place
float GetPlaceStatementInterval(Place place) const; float GetPlaceStatementInterval(Place place) const;
@ -348,7 +336,7 @@ public:
#ifndef HOOK_GAMEDLL #ifndef HOOK_GAMEDLL
private: private:
#endif // HOOK_GAMEDLL #endif
int FindPlaceIndex(Place where) const; int FindPlaceIndex(Place where) const;
@ -364,11 +352,10 @@ private:
IntervalTimer timer; IntervalTimer timer;
}; };
mutable PlaceTimeInfo m_placeStatementHistory[ MAX_PLACES_PER_MAP ]; mutable PlaceTimeInfo m_placeStatementHistory[MAX_PLACES_PER_MAP];
mutable int m_placeCount; mutable int m_placeCount;
}; };
/* <2fea95> ../cstrike/dlls/bot/cs_bot_chatter.h:298 */
inline int BotPhraseManager::FindPlaceIndex(Place where) const inline int BotPhraseManager::FindPlaceIndex(Place where) const
{ {
for (int i = 0; i < m_placeCount; ++i) for (int i = 0; i < m_placeCount; ++i)
@ -387,7 +374,6 @@ inline int BotPhraseManager::FindPlaceIndex(Place where) const
return -1; return -1;
} }
/* <2ff83d> ../cstrike/dlls/bot/cs_bot_chatter.h:319 */
inline float BotPhraseManager::GetPlaceStatementInterval(Place place) const inline float BotPhraseManager::GetPlaceStatementInterval(Place place) const
{ {
int index = FindPlaceIndex(place); int index = FindPlaceIndex(place);
@ -398,10 +384,9 @@ inline float BotPhraseManager::GetPlaceStatementInterval(Place place) const
if (index >= m_placeCount) if (index >= m_placeCount)
return 999999.9f; 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 inline void BotPhraseManager::ResetPlaceStatementInterval(Place place) const
{ {
int index = FindPlaceIndex(place); int index = FindPlaceIndex(place);
@ -423,19 +408,19 @@ public:
~BotStatement(); ~BotStatement();
public: public:
BotChatterInterface *GetChatter() const { return m_chatter; } BotChatterInterface *GetChatter() const { return m_chatter; }
CCSBot *GetOwner() const; CCSBot *GetOwner() const;
BotStatementType GetType() const { return m_type; } // return the type of statement this is BotStatementType GetType() const { return m_type; } // return the type of statement this is
bool IsImportant() const; // return true if this statement is "important" and not personality chatter bool IsImportant() const; // return true if this statement is "important" and not personality chatter
bool HasSubject() const { return (m_subject != UNDEFINED_SUBJECT); } bool HasSubject() const { return (m_subject != UNDEFINED_SUBJECT); }
void SetSubject(int playerID) { m_subject = playerID; } // who this statement is about void SetSubject(int playerID) { m_subject = playerID; } // who this statement is about
int GetSubject() const { return m_subject; } // who this statement is about int GetSubject() const { return m_subject; } // who this statement is about
bool HasPlace() const { return (GetPlace()) ? true : false; } bool HasPlace() const { return (GetPlace()) ? true : false; }
Place GetPlace() const; // if this statement refers to a specific place, return that place Place GetPlace() const; // if this statement refers to a specific place, return that place
void SetPlace(Place where) { m_place = where; } // explicitly set place void SetPlace(Place where) { m_place = where; } // explicitly set place
bool HasCount() const; // return true if this statement has an associated count bool HasCount() const; // return true if this statement has an associated count
@ -445,8 +430,8 @@ public:
void AppendPhrase(const BotPhrase *phrase); void AppendPhrase(const BotPhrase *phrase);
void SetStartTime(float timestamp) { m_startTime = timestamp; } // define the earliest time this statement can be spoken void SetStartTime(float timestamp) { m_startTime = timestamp; } // define the earliest time this statement can be spoken
float GetStartTime() const { return m_startTime; } float GetStartTime() const { return m_startTime; }
enum ConditionType enum ConditionType
{ {
@ -470,8 +455,8 @@ public:
void AppendPhrase(ContextType contextPhrase); // special phrases that depend on the context void AppendPhrase(ContextType contextPhrase); // special phrases that depend on the context
bool Update(); // emit statement over time, return false if statement is done bool Update(); // emit statement over time, return false if statement is done
bool IsSpeaking() const { return m_isSpeaking; } // return true if this statement is currently being spoken bool IsSpeaking() const { return m_isSpeaking; } // return true if this statement is currently being spoken
float GetTimestamp() const { return m_timestamp; } // get time statement was created (but not necessarily started talking) float GetTimestamp() const { return m_timestamp; } // get time statement was created (but not necessarily started talking)
void AttachMeme(BotMeme *meme); // attach a meme to this statement, to be transmitted to other friendly bots when spoken void AttachMeme(BotMeme *meme); // attach a meme to this statement, to be transmitted to other friendly bots when spoken
@ -506,10 +491,10 @@ public:
}; };
} }
m_statement[ MAX_BOT_PHRASES ]; m_statement[MAX_BOT_PHRASES];
enum { MAX_BOT_CONDITIONS = 4 }; 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_conditionCount;
int m_index; // m_index refers to the phrase currently being spoken, or -1 if we havent started yet 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 KilledMyEnemy(int victimID);
void EnemiesRemaining(); void EnemiesRemaining();
NOXREF void Clear(Place place); void Clear(Place place);
void ReportIn(); // ask for current situation void ReportIn(); // ask for current situation
void ReportingIn(); // report current situation void ReportingIn(); // report current situation
@ -582,7 +567,7 @@ public:
void PlantingTheBomb(Place place); void PlantingTheBomb(Place place);
void SpottedBomber(CBasePlayer *bomber); void SpottedBomber(CBasePlayer *bomber);
void SpottedLooseBomb(CBaseEntity *bomb); void SpottedLooseBomb(CBaseEntity *bomb);
NOXREF void GuardingLooseBomb(CBaseEntity *bomb); void GuardingLooseBomb(CBaseEntity *bomb);
void RequestBombLocation(); void RequestBombLocation();
#define IS_PLAN true #define IS_PLAN true
@ -592,7 +577,7 @@ public:
void HostagesTaken(); void HostagesTaken();
void TalkingToHostages(); void TalkingToHostages();
void EscortingHostages(); void EscortingHostages();
NOXREF void HostageDown(); void HostageDown();
void CelebrateWin(); void CelebrateWin();
@ -605,7 +590,7 @@ public:
#ifndef HOOK_GAMEDLL #ifndef HOOK_GAMEDLL
private: private:
#endif // HOOK_GAMEDLL #endif
BotStatement *m_statementList; // list of all active/pending messages for this bot BotStatement *m_statementList; // list of all active/pending messages for this bot
void ReportEnemies(); // track nearby enemy count and generate enemy activity statements 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 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 inline BotChatterInterface::VerbosityType BotChatterInterface::GetVerbosity() const
{ {
const char *string = cv_bot_chatter.string; const char *string = cv_bot_chatter.string;
@ -652,7 +636,6 @@ inline BotChatterInterface::VerbosityType BotChatterInterface::GetVerbosity() co
return NORMAL; return NORMAL;
} }
/* <2fec4a> ../cstrike/dlls/bot/cs_bot_chatter.h:590 */
inline bool BotChatterInterface::IsTalking() const inline bool BotChatterInterface::IsTalking() const
{ {
if (m_statementList != NULL) if (m_statementList != NULL)
@ -663,7 +646,6 @@ inline bool BotChatterInterface::IsTalking() const
return false; return false;
} }
/* <3f2bad> ../cstrike/dlls/bot/cs_bot_chatter.h:596 */
inline BotStatement *BotChatterInterface::GetStatement() const inline BotStatement *BotChatterInterface::GetStatement() const
{ {
return m_statementList; return m_statementList;
@ -672,7 +654,6 @@ inline BotStatement *BotChatterInterface::GetStatement() const
extern BotPhraseManager *TheBotPhrases; extern BotPhraseManager *TheBotPhrases;
extern CBaseEntity *g_pSelectedZombieSpawn; extern CBaseEntity *g_pSelectedZombieSpawn;
/* <5c4dcf> ../cstrike/dlls/bot/cs_bot_chatter.h:604 */
inline void BotChatterInterface::Say(const char *phraseName, float lifetime, float delay) inline void BotChatterInterface::Say(const char *phraseName, float lifetime, float delay)
{ {
BotStatement *say = new BotStatement(this, REPORT_MY_INTENTION, lifetime); BotStatement *say = new BotStatement(this, REPORT_MY_INTENTION, lifetime);

View File

@ -1,6 +1,5 @@
#include "precompiled.h" #include "precompiled.h"
/* <31d087> ../cstrike/dlls/bot/cs_bot_event.cpp:22 */
void CCSBot::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *entity, CBaseEntity *other) void CCSBot::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
{ {
GetGameState()->OnEvent(event, entity, 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); CBasePlayer *killer = static_cast<CBasePlayer *>(other);
// check that attacker is an enemy (for friendly fire, etc) // 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 // check if we saw our friend die - dont check FOV - assume we're aware of our surroundings in combat
// snipers stay put // snipers stay put
@ -75,10 +74,10 @@ void CCSBot::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *entity, CBa
case EVENT_PLAYER_DIED: case EVENT_PLAYER_DIED:
{ {
CBasePlayer *victim = player; 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 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); 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)) if (IsVisible(&victim->pev->origin, CHECK_FOV))
{ {
// congratulate teammates on their kills // congratulate teammates on their kills
if (killer != NULL && killer != this) if (killer != this)
{ {
float delay = RANDOM_FLOAT(2.0f, 3.0f); float delay = RANDOM_FLOAT(2.0f, 3.0f);
if (killer->IsBot()) if (killer->IsBot())
@ -147,7 +146,7 @@ void CCSBot::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *entity, CBa
else else
{ {
// humans get the honorific // humans get the honorific
if (g_pGameRules->IsCareer()) if (CSGameRules()->IsCareer())
GetChatter()->Say("NiceShotCommander", 3.0f, delay); GetChatter()->Say("NiceShotCommander", 3.0f, delay);
else else
GetChatter()->Say("NiceShotSir", 3.0f, delay); 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_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 }; 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() void InstallBotControl()
{ {
if (TheBots != NULL) if (TheBots != NULL)
@ -49,8 +48,6 @@ void InstallBotControl()
} }
// Engine callback for custom server commands // Engine callback for custom server commands
/* <333cb3> ../cstrike/dlls/bot/cs_bot_init.cpp:68 */
void Bot_ServerCommand() void Bot_ServerCommand()
{ {
if (TheBots != NULL) if (TheBots != NULL)
@ -60,10 +57,9 @@ void Bot_ServerCommand()
} }
} }
/* <333cec> ../cstrike/dlls/bot/cs_bot_init.cpp:81 */
void Bot_RegisterCvars() void Bot_RegisterCvars()
{ {
if (!g_bIsCzeroGame) if (!AreBotsAllowed())
return; return;
CVAR_REGISTER(&cv_bot_traceview); CVAR_REGISTER(&cv_bot_traceview);
@ -98,16 +94,12 @@ void Bot_RegisterCvars()
} }
// Constructor // Constructor
/* <333d1e> ../cstrike/dlls/bot/cs_bot_init.cpp:129 */
CCSBot::CCSBot() : m_chatter(this), m_gameState(this) CCSBot::CCSBot() : m_chatter(this), m_gameState(this)
{ {
; ;
} }
// Prepare bot for action // Prepare bot for action
/* <3342ac> ../cstrike/dlls/bot/cs_bot_init.cpp:137 */
bool CCSBot::__MAKE_VHOOK(Initialize)(const BotProfile *profile) bool CCSBot::__MAKE_VHOOK(Initialize)(const BotProfile *profile)
{ {
// extend // extend
@ -134,8 +126,6 @@ bool CCSBot::__MAKE_VHOOK(Initialize)(const BotProfile *profile)
} }
// Reset internal data to initial state // Reset internal data to initial state
/* <3341dc> ../cstrike/dlls/bot/cs_bot_init.cpp:167 */
void CCSBot::ResetValues() void CCSBot::ResetValues()
{ {
m_chatter.Reset(); m_chatter.Reset();
@ -282,7 +272,7 @@ void CCSBot::ResetValues()
m_enemyQueue[i].isReloading = false; m_enemyQueue[i].isReloading = false;
m_enemyQueue[i].isProtectedByShield = false; m_enemyQueue[i].isProtectedByShield = false;
} }
#endif // REGAMEDLL_FIXES #endif
// start in idle state // start in idle state
StopAttacking(); StopAttacking();
@ -291,13 +281,9 @@ void CCSBot::ResetValues()
// Called when bot is placed in map, and when bots are reset after a round ends. // 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. // 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)() void CCSBot::__MAKE_VHOOK(SpawnBot)()
{ {
CCSBotManager *ctrl = TheCSBots(); TheCSBots()->ValidateMapData();
ctrl->ValidateMapData();
ResetValues(); ResetValues();
Q_strcpy(m_name, STRING(pev->netname)); Q_strcpy(m_name, STRING(pev->netname));
@ -305,14 +291,13 @@ void CCSBot::__MAKE_VHOOK(SpawnBot)()
SetState(&m_buyState); SetState(&m_buyState);
SetTouch(&CCSBot::BotTouch); SetTouch(&CCSBot::BotTouch);
if (TheNavAreaList.empty() && !ctrl->IsLearningMap()) if (TheNavAreaList.empty() && !TheCSBots()->IsLearningMap())
{ {
ctrl->SetLearningMapFlag(); TheCSBots()->SetLearningMapFlag();
StartLearnProcess(); StartLearnProcess();
} }
} }
/* <3338f7> ../cstrike/dlls/bot/cs_bot_init.cpp:366 */
void CCSBot::__MAKE_VHOOK(RoundRespawn)() void CCSBot::__MAKE_VHOOK(RoundRespawn)()
{ {
// do the normal player spawn process // do the normal player spawn process
@ -320,7 +305,6 @@ void CCSBot::__MAKE_VHOOK(RoundRespawn)()
EndVoiceFeedback(); EndVoiceFeedback();
} }
/* <334332> ../cstrike/dlls/bot/cs_bot_init.cpp:378 */
void CCSBot::Disconnect() void CCSBot::Disconnect()
{ {
EndVoiceFeedback(); EndVoiceFeedback();

View File

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

View File

@ -2,8 +2,6 @@
// Listen for enemy noises, and determine if we should react to them. // Listen for enemy noises, and determine if we should react to them.
// Returns true if heard a noise and should move to investigate. // 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) bool CCSBot::ShouldInvestigateNoise(float *retNoiseDist)
{ {
if (m_isNoiseTravelRangeChecked) if (m_isNoiseTravelRangeChecked)
@ -25,7 +23,7 @@ bool CCSBot::ShouldInvestigateNoise(float *retNoiseDist)
float noiseDist = toNoise.Length(); float noiseDist = toNoise.Length();
float const oneStoreyHeight = 120.0f; float const oneStoreyHeight = 120.0f;
if (abs(int64(toNoise.z)) > oneStoreyHeight) if (Q_abs(int64(toNoise.z)) > oneStoreyHeight)
{ {
PathCost pc(this); PathCost pc(this);
float travelDistToNoise = NavAreaTravelDistance(m_lastKnownArea, m_noiseArea, pc); 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 // Return true if we hear nearby threatening enemy gunfire within given range
// -1 == infinite range // -1 == infinite range
/* <354c8d> ../cstrike/dlls/bot/cs_bot_listen.cpp:104 */
bool CCSBot::CanHearNearbyEnemyGunfire(float range) const bool CCSBot::CanHearNearbyEnemyGunfire(float range) const
{ {
// only attend to noise if it just happened // 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 // 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 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 // 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 bool CCSBot::CanSeeNoisePosition() const
{ {
TraceResult result; TraceResult result;
@ -126,8 +120,6 @@ bool CCSBot::CanSeeNoisePosition() const
// Return true if we decided to look towards the most recent noise source // Return true if we decided to look towards the most recent noise source
// Assumes m_noisePosition is valid. // Assumes m_noisePosition is valid.
/* <354f48> ../cstrike/dlls/bot/cs_bot_listen.cpp:160 */
bool CCSBot::UpdateLookAtNoise() bool CCSBot::UpdateLookAtNoise()
{ {
// make sure a noise exists // make sure a noise exists

View File

@ -13,23 +13,8 @@ bool CCSBotManager::m_isLearningMap = false;
bool CCSBotManager::m_isAnalysisRequested = false; bool CCSBotManager::m_isAnalysisRequested = false;
NavEditCmdType CCSBotManager::m_editCmd = EDIT_NONE; 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() CCSBotManager::CCSBotManager()
{ {
IMPL(m_flNextCVarCheck) = 0.0f; IMPL(m_flNextCVarCheck) = 0.0f;
@ -44,7 +29,7 @@ CCSBotManager::CCSBotManager()
IMPL(m_isAnalysisRequested) = false; IMPL(m_isAnalysisRequested) = false;
IMPL(m_editCmd) = EDIT_NONE; IMPL(m_editCmd) = EDIT_NONE;
m_navPlace = false; m_navPlace = 0;
m_roundStartTimestamp = 0.0f; m_roundStartTimestamp = 0.0f;
m_bServerActive = false; m_bServerActive = false;
@ -102,8 +87,6 @@ CCSBotManager::CCSBotManager()
} }
// Invoked when a new round begins // Invoked when a new round begins
/* <36b22a> ../cstrike/dlls/bot/cs_bot_manager.cpp:111 */
void CCSBotManager::__MAKE_VHOOK(RestartRound)() void CCSBotManager::__MAKE_VHOOK(RestartRound)()
{ {
// extend // extend
@ -133,7 +116,6 @@ void CCSBotManager::__MAKE_VHOOK(RestartRound)()
m_canRespawn = true; 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) void UTIL_DrawBox(Extent *extent, int lifetime, int red, int green, int blue)
{ {
Vector v[8]; Vector v[8];
@ -187,7 +169,6 @@ void UTIL_DrawBox(Extent *extent, int lifetime, int red, int green, int blue)
// Called each frame // Called each frame
/* <36b13d> ../cstrike/dlls/bot/cs_bot_manager.cpp:195 */
void CCSBotManager::__MAKE_VHOOK(StartFrame)() void CCSBotManager::__MAKE_VHOOK(StartFrame)()
{ {
// EXTEND // EXTEND
@ -206,8 +187,6 @@ void CCSBotManager::__MAKE_VHOOK(StartFrame)()
} }
// Return true if the bot can use this weapon // Return true if the bot can use this weapon
/* <36b62a> ../cstrike/dlls/bot/cs_bot_manager.cpp:276 */
bool CCSBotManager::IsWeaponUseable(CBasePlayerItem *item) const bool CCSBotManager::IsWeaponUseable(CBasePlayerItem *item) const
{ {
if (item == NULL) if (item == NULL)
@ -226,7 +205,7 @@ bool CCSBotManager::IsWeaponUseable(CBasePlayerItem *item) const
#ifndef REGAMEDLL_FIXES #ifndef REGAMEDLL_FIXES
// TODO: already is checked shotguns! // TODO: already is checked shotguns!
|| (!AllowShotguns() && weaponClass == WEAPONCLASS_SHOTGUN) || (!AllowShotguns() && weaponClass == WEAPONCLASS_SHOTGUN)
#endif // REGAMEDLL_FIXES #endif
|| (!AllowSnipers() && weaponClass == WEAPONCLASS_SNIPERRIFLE) || (!AllowSnipers() && weaponClass == WEAPONCLASS_SNIPERRIFLE)
|| (!AllowSubMachineGuns() && weaponClass == WEAPONCLASS_SUBMACHINEGUN) || (!AllowSubMachineGuns() && weaponClass == WEAPONCLASS_SUBMACHINEGUN)
|| (!AllowTacticalShield() && item->m_iId == WEAPON_SHIELDGUN) || (!AllowTacticalShield() && item->m_iId == WEAPON_SHIELDGUN)
@ -240,8 +219,6 @@ bool CCSBotManager::IsWeaponUseable(CBasePlayerItem *item) const
} }
// Return true if this player is on "defense" // Return true if this player is on "defense"
/* <36b68c> ../cstrike/dlls/bot/cs_bot_manager.cpp:306 */
bool CCSBotManager::IsOnDefense(CBasePlayer *player) const bool CCSBotManager::IsOnDefense(CBasePlayer *player) const
{ {
switch (GetScenario()) switch (GetScenario())
@ -260,16 +237,12 @@ bool CCSBotManager::IsOnDefense(CBasePlayer *player) const
} }
// Return true if this player is on "offense" // Return true if this player is on "offense"
/* <36b6b8> ../cstrike/dlls/bot/cs_bot_manager.cpp:327 */
bool CCSBotManager::IsOnOffense(CBasePlayer *player) const bool CCSBotManager::IsOnOffense(CBasePlayer *player) const
{ {
return !IsOnDefense(player); return !IsOnDefense(player);
} }
// Invoked when a map has just been loaded // Invoked when a map has just been loaded
/* <36a3b6> ../cstrike/dlls/bot/cs_bot_manager.cpp:331 */
void CCSBotManager::__MAKE_VHOOK(ServerActivate)() void CCSBotManager::__MAKE_VHOOK(ServerActivate)()
{ {
DestroyNavigationMap(); DestroyNavigationMap();
@ -290,17 +263,11 @@ void CCSBotManager::__MAKE_VHOOK(ServerActivate)()
TheBotPhrases->OnMapChange(); TheBotPhrases->OnMapChange();
} }
/* <36afcd> ../cstrike/dlls/bot/cs_bot_manager.cpp:369 */
void CCSBotManager::__MAKE_VHOOK(AddServerCommand)(const char *cmd) 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); ADD_SERVER_COMMAND((char *)cmd, Bot_ServerCommand);
#endif // HOOK_GAMEDLL
} }
/* <36b0e0> ../cstrike/dlls/bot/cs_bot_manager.cpp:375 */
void CCSBotManager::__MAKE_VHOOK(AddServerCommands)() void CCSBotManager::__MAKE_VHOOK(AddServerCommands)()
{ {
static bool fFirstTime = true; static bool fFirstTime = true;
@ -310,65 +277,63 @@ void CCSBotManager::__MAKE_VHOOK(AddServerCommands)()
fFirstTime = false; fFirstTime = false;
if (g_bIsCzeroGame) if (!AreBotsAllowed())
{ return;
AddServerCommand("bot_about");
AddServerCommand("bot_add"); AddServerCommand("bot_about");
AddServerCommand("bot_add_t"); AddServerCommand("bot_add");
AddServerCommand("bot_add_ct"); AddServerCommand("bot_add_t");
AddServerCommand("bot_kill"); AddServerCommand("bot_add_ct");
AddServerCommand("bot_kick"); AddServerCommand("bot_kill");
AddServerCommand("bot_knives_only"); AddServerCommand("bot_kick");
AddServerCommand("bot_pistols_only"); AddServerCommand("bot_knives_only");
AddServerCommand("bot_snipers_only"); AddServerCommand("bot_pistols_only");
AddServerCommand("bot_all_weapons"); AddServerCommand("bot_snipers_only");
AddServerCommand("entity_dump"); AddServerCommand("bot_all_weapons");
AddServerCommand("bot_nav_delete"); AddServerCommand("entity_dump");
AddServerCommand("bot_nav_split"); AddServerCommand("bot_nav_delete");
AddServerCommand("bot_nav_merge"); AddServerCommand("bot_nav_split");
AddServerCommand("bot_nav_mark"); AddServerCommand("bot_nav_merge");
AddServerCommand("bot_nav_begin_area"); AddServerCommand("bot_nav_mark");
AddServerCommand("bot_nav_end_area"); AddServerCommand("bot_nav_begin_area");
AddServerCommand("bot_nav_connect"); AddServerCommand("bot_nav_end_area");
AddServerCommand("bot_nav_disconnect"); AddServerCommand("bot_nav_connect");
AddServerCommand("bot_nav_splice"); AddServerCommand("bot_nav_disconnect");
AddServerCommand("bot_nav_crouch"); AddServerCommand("bot_nav_splice");
AddServerCommand("bot_nav_jump"); AddServerCommand("bot_nav_crouch");
AddServerCommand("bot_nav_precise"); AddServerCommand("bot_nav_jump");
AddServerCommand("bot_nav_no_jump"); AddServerCommand("bot_nav_precise");
AddServerCommand("bot_nav_analyze"); AddServerCommand("bot_nav_no_jump");
AddServerCommand("bot_nav_strip"); AddServerCommand("bot_nav_analyze");
AddServerCommand("bot_nav_save"); AddServerCommand("bot_nav_strip");
AddServerCommand("bot_nav_load"); AddServerCommand("bot_nav_save");
AddServerCommand("bot_nav_use_place"); AddServerCommand("bot_nav_load");
AddServerCommand("bot_nav_place_floodfill"); AddServerCommand("bot_nav_use_place");
AddServerCommand("bot_nav_place_pick"); AddServerCommand("bot_nav_place_floodfill");
AddServerCommand("bot_nav_toggle_place_mode"); AddServerCommand("bot_nav_place_pick");
AddServerCommand("bot_nav_toggle_place_painting"); AddServerCommand("bot_nav_toggle_place_mode");
AddServerCommand("bot_goto_mark"); AddServerCommand("bot_nav_toggle_place_painting");
AddServerCommand("bot_memory_usage"); AddServerCommand("bot_goto_mark");
AddServerCommand("bot_nav_mark_unnamed"); AddServerCommand("bot_memory_usage");
AddServerCommand("bot_nav_warp"); AddServerCommand("bot_nav_mark_unnamed");
AddServerCommand("bot_nav_corner_select"); AddServerCommand("bot_nav_warp");
AddServerCommand("bot_nav_corner_raise"); AddServerCommand("bot_nav_corner_select");
AddServerCommand("bot_nav_corner_lower"); AddServerCommand("bot_nav_corner_raise");
AddServerCommand("bot_nav_check_consistency"); AddServerCommand("bot_nav_corner_lower");
} AddServerCommand("bot_nav_check_consistency");
} }
/* <36b2ac> ../cstrike/dlls/bot/cs_bot_manager.cpp:413 */
void CCSBotManager::__MAKE_VHOOK(ServerDeactivate)() void CCSBotManager::__MAKE_VHOOK(ServerDeactivate)()
{ {
m_bServerActive = false; m_bServerActive = false;
} }
/* <36b5fa> ../cstrike/dlls/bot/cs_bot_manager.cpp:415 */
void CCSBotManager::__MAKE_VHOOK(ClientDisconnect)(CBasePlayer *pPlayer) void CCSBotManager::__MAKE_VHOOK(ClientDisconnect)(CBasePlayer *pPlayer)
{ {
if (pPlayer != NULL && pPlayer->IsBot()) if (pPlayer != NULL && pPlayer->IsBot())
{ {
entvars_t *temp = VARS(pPlayer->edict()); entvars_t *temp = VARS(pPlayer->edict());
CCSBot *pBot = static_cast<CCSBot *>(pPlayer); CCSBot *pBot = dynamic_cast<CCSBot *>(pPlayer);
if (pBot != NULL) 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() void PrintAllEntities()
{ {
for (int i = 1; i < gpGlobals->maxEntities; ++i) 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) void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd)
{ {
if (!m_bServerActive || !g_bIsCzeroGame) if (!m_bServerActive || !AreBotsAllowed())
return; return;
char buffer[400]; 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 // adjust bot quota so kicked bot is not immediately added back in
int newQuota = cv_bot_quota.value - 1; int newQuota = cv_bot_quota.value - 1;
SERVER_COMMAND(UTIL_VarArgs("kick \"%s\"\n", name)); 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(); const BotPhraseList *placeList = TheBotPhrases->GetPlaceList();
for (BotPhraseList::const_iterator iter = placeList->begin(); iter != placeList->end(); ++iter, ++i) for (BotPhraseList::const_iterator iter = placeList->begin(); iter != placeList->end(); ++iter, ++i)
{ {
if ((*iter)->GetID() == GetNavPlace()) const BotPhrase *phrase = (*iter);
CONSOLE_ECHO("--> %-26s", (*iter)->GetName());
if (phrase->GetID() == GetNavPlace())
CONSOLE_ECHO("--> %-26s", phrase->GetName());
else else
CONSOLE_ECHO("%-30s", (*iter)->GetName()); CONSOLE_ECHO("%-30s", phrase->GetName());
if (!(i % 3)) if (!(i % 3))
CONSOLE_ECHO("\n"); CONSOLE_ECHO("\n");
@ -651,12 +616,14 @@ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd)
bool isAmbiguous = false; bool isAmbiguous = false;
for (BotPhraseList::const_iterator iter = placeList->begin(); iter != placeList->end(); ++iter) 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 // 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; isAmbiguous = false;
break; break;
} }
@ -667,7 +634,7 @@ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd)
} }
else 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) BOOL CCSBotManager::__MAKE_VHOOK(ClientCommand)(CBasePlayer *pPlayer, const char *pcmd)
{ {
#ifndef REGAMEDLL_FIXES #ifndef REGAMEDLL_FIXES
@ -798,14 +764,12 @@ BOOL CCSBotManager::__MAKE_VHOOK(ClientCommand)(CBasePlayer *pPlayer, const char
{ {
UTIL_GetLocalPlayer(); UTIL_GetLocalPlayer();
} }
#endif // REGAMEDLL_FIXES #endif
return FALSE; return FALSE;
} }
// Process the "bot_add" console command // Process the "bot_add" console command
/* <36c3c2> ../cstrike/dlls/bot/cs_bot_manager.cpp:903 */
bool CCSBotManager::BotAddCommand(BotProfileTeamType team, bool isFromConsole) bool CCSBotManager::BotAddCommand(BotProfileTeamType team, bool isFromConsole)
{ {
// dont allow bots to join if the Navigation Area is being generated // 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 // in career, ignore humans
bool ignoreHumans = false; bool ignoreHumans = false;
CHalfLifeMultiplay *mp = g_pGameRules; if (CSGameRules() != NULL && CSGameRules()->IsCareer())
if (mp != NULL && mp->IsCareer())
ignoreHumans = true; ignoreHumans = true;
if (UTIL_IsNameTaken(CMD_ARGV(1), ignoreHumans)) 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 // Keep a minimum quota of bots in the game
/* <36d10f> ../cstrike/dlls/bot/cs_bot_manager.cpp:979 */
void CCSBotManager::MaintainBotQuota() void CCSBotManager::MaintainBotQuota()
{ {
if (!AreBotsAllowed())
return;
if (IMPL(m_isLearningMap)) if (IMPL(m_isLearningMap))
return; return;
CHalfLifeMultiplay *mp = g_pGameRules;
int totalHumansInGame = UTIL_HumansInGame(); int totalHumansInGame = UTIL_HumansInGame();
int humanPlayersInGame = UTIL_HumansInGame(IGNORE_SPECTATORS); int humanPlayersInGame = UTIL_HumansInGame(IGNORE_SPECTATORS);
@ -900,12 +862,12 @@ void CCSBotManager::MaintainBotQuota()
if (!IS_DEDICATED_SERVER() && totalHumansInGame == 0) if (!IS_DEDICATED_SERVER() && totalHumansInGame == 0)
return; return;
int desiredBotCount = (int)cv_bot_quota.value; int desiredBotCount = int(cv_bot_quota.value);
int botsInGame = UTIL_BotsInGame(); int botsInGame = UTIL_BotsInGame();
if (cv_bot_quota_match.value > 0.0) 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 // wait for a player to join, if necessary
@ -925,7 +887,7 @@ void CCSBotManager::MaintainBotQuota()
if (desiredBotCount > botsInGame) if (desiredBotCount > botsInGame)
{ {
// don't try to add a bot if all teams are full // 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); BotAddCommand(BOT_TEAM_ANY);
} }
else if (desiredBotCount < botsInGame) else if (desiredBotCount < botsInGame)
@ -939,20 +901,20 @@ void CCSBotManager::MaintainBotQuota()
TeamName kickTeam; TeamName kickTeam;
// remove from the team that has more players // remove from the team that has more players
if (mp->m_iNumTerrorist > mp->m_iNumCT) if (CSGameRules()->m_iNumTerrorist > CSGameRules()->m_iNumCT)
{ {
kickTeam = TERRORIST; kickTeam = TERRORIST;
} }
else if (mp->m_iNumTerrorist < mp->m_iNumCT) else if (CSGameRules()->m_iNumTerrorist < CSGameRules()->m_iNumCT)
{ {
kickTeam = CT; kickTeam = CT;
} }
// remove from the team that's winning // 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; kickTeam = TERRORIST;
} }
else if (mp->m_iNumCTWins > mp->m_iNumTerroristWins) else if (CSGameRules()->m_iNumCTWins > CSGameRules()->m_iNumTerroristWins)
{ {
kickTeam = CT; kickTeam = CT;
} }
@ -974,21 +936,21 @@ void CCSBotManager::MaintainBotQuota()
} }
else else
{ {
if (mp != NULL && !mp->IsCareer()) if (CSGameRules() != NULL && !CSGameRules()->IsCareer())
return; return;
bool humansAreCTs = (Q_strcmp(humans_join_team.string, "CT") == 0); bool humansAreCTs = (Q_strcmp(humans_join_team.string, "CT") == 0);
if (humansAreCTs) if (humansAreCTs)
{ {
if (mp->m_iNumCT <= 6) if (CSGameRules()->m_iNumCT <= 6)
return; return;
UTIL_KickBotFromTeam(CT); UTIL_KickBotFromTeam(CT);
} }
else else
{ {
if (mp->m_iNumTerrorist <= 6) if (CSGameRules()->m_iNumTerrorist <= 6)
return; return;
UTIL_KickBotFromTeam(TERRORIST); UTIL_KickBotFromTeam(TERRORIST);
@ -998,7 +960,6 @@ void CCSBotManager::MaintainBotQuota()
} }
} }
/* <36d1dd> ../cstrike/dlls/bot/cs_bot_manager.cpp:1086 */
void CCSBotManager::MonitorBotCVars() void CCSBotManager::MonitorBotCVars()
{ {
if (cv_bot_nav_edit.value != 0.0f) 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. // 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() void CCSBotManager::ValidateMapData()
{ {
if (IMPL(m_isMapDataLoaded) || !g_bIsCzeroGame) if (IMPL(m_isMapDataLoaded) || !AreBotsAllowed())
return; return;
IMPL(m_isMapDataLoaded) = true; 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) bool CCSBotManager::AddBot(const BotProfile *profile, BotProfileTeamType team)
{ {
if (!g_bIsCzeroGame) if (!AreBotsAllowed())
return false; return false;
CHalfLifeMultiplay *mp = g_pGameRules;
int nTeamSlot = UNASSIGNED; int nTeamSlot = UNASSIGNED;
if (team == BOT_TEAM_ANY) if (team == BOT_TEAM_ANY)
{ {
// if team not specified, check cv_bot_join_team cvar for preference // 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(); 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"); CONSOLE_ECHO("Could not add bot to the game: Team is full\n");
return false; 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"); 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; return false;
@ -1270,11 +1224,8 @@ bool CCSBotManager::AddBot(const BotProfile *profile, BotProfileTeamType team)
return false; return false;
} }
#endif // HOOK_GAMEDLL
// Return the zone that contains the given position // 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 const CCSBotManager::Zone *CCSBotManager::GetZone(const Vector *pos) const
{ {
for (int z = 0; z < m_zoneCount; ++z) 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 // 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 CCSBotManager::Zone *CCSBotManager::GetClosestZone(const Vector *pos) const
{ {
const Zone *close = NULL; 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 // 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 const Vector *CCSBotManager::GetRandomPositionInZone(const Zone *zone) const
{ {
static Vector pos; static Vector pos;
@ -1351,8 +1298,6 @@ const Vector *CCSBotManager::GetRandomPositionInZone(const Zone *zone) const
} }
// Return a random area inside the given zone // Return a random area inside the given zone
/* <36bd64> ../cstrike/dlls/bot/cs_bot_manager.cpp:1458 */
CNavArea *CCSBotManager::GetRandomAreaInZone(const Zone *zone) const CNavArea *CCSBotManager::GetRandomAreaInZone(const Zone *zone) const
{ {
// TODO: improvement is needed // 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) ]; 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) void CCSBotManager::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
{ {
switch (event) switch (event)
@ -1404,14 +1348,11 @@ void CCSBotManager::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *enti
} }
// Get the time remaining before the planted bomb explodes // Get the time remaining before the planted bomb explodes
/* <36bdb3> ../cstrike/dlls/bot/cs_bot_manager.cpp:1541 */
float CCSBotManager::GetBombTimeLeft() const 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) void CCSBotManager::SetLooseBomb(CBaseEntity *bomb)
{ {
m_looseBomb = 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) // 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 bool CCSBotManager::__MAKE_VHOOK(IsImportantPlayer)(CBasePlayer *player) const
{ {
switch (GetScenario()) switch (GetScenario())
@ -1460,8 +1399,6 @@ bool CCSBotManager::__MAKE_VHOOK(IsImportantPlayer)(CBasePlayer *player) const
} }
// Return priority of player (0 = max pri) // 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 unsigned int CCSBotManager::__MAKE_VHOOK(GetPlayerPriority)(CBasePlayer *player) const
{ {
const unsigned int lowestPriority = 0xFFFFFFFF; 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 // Return the last time the given radio message was sent for given team
// 'teamID' can be TEAM_CT or TEAM_TERRORIST // '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 float CCSBotManager::GetRadioMessageTimestamp(GameEventType event, int teamID) const
{ {
if (event <= EVENT_START_RADIO_1 || event >= EVENT_END_RADIO) 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 // 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 float CCSBotManager::GetRadioMessageInterval(GameEventType event, int teamID) const
{ {
if (event <= EVENT_START_RADIO_1 || event >= EVENT_END_RADIO) 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. // Set the given radio message timestamp.
// 'teamID' can be TEAM_CT or TEAM_TERRORIST // 'teamID' can be TEAM_CT or TEAM_TERRORIST
/* <36bebe> ../cstrike/dlls/bot/cs_bot_manager.cpp:1680 */
void CCSBotManager::SetRadioMessageTimestamp(GameEventType event, int teamID) void CCSBotManager::SetRadioMessageTimestamp(GameEventType event, int teamID)
{ {
if (event <= EVENT_START_RADIO_1 || event >= EVENT_END_RADIO) 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 // Reset all radio message timestamps
/* <36bf06> ../cstrike/dlls/bot/cs_bot_manager.cpp:1690 */
void CCSBotManager::ResetRadioMessageTimestamps() void CCSBotManager::ResetRadioMessageTimestamps()
{ {
for (int t = 0; t < ARRAYSIZE(m_radioMsgTimestamp[0]); ++t) for (int t = 0; t < ARRAYSIZE(m_radioMsgTimestamp[0]); ++t)

View File

@ -72,15 +72,15 @@ public:
unsigned int GetPlayerPriority_(CBasePlayer *player) const; unsigned int GetPlayerPriority_(CBasePlayer *player) const;
bool IsImportantPlayer_(CBasePlayer *player) const; bool IsImportantPlayer_(CBasePlayer *player) const;
#endif // HOOK_GAMEDLL #endif
public: public:
void ValidateMapData(); void ValidateMapData();
bool IsLearningMap() const { return IMPL(m_isLearningMap); } 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); } bool IsAnalysisRequested() const { return IMPL(m_isAnalysisRequested); }
void RequestAnalysis() { IMPL(m_isAnalysisRequested) = true; } void RequestAnalysis() { IMPL(m_isAnalysisRequested) = true; }
void AckAnalysisRequest() { IMPL(m_isAnalysisRequested) = false; } void AckAnalysisRequest() { IMPL(m_isAnalysisRequested) = false; }
// difficulty levels // difficulty levels
static BotDifficultyType GetDifficultyLevel() static BotDifficultyType GetDifficultyLevel()
@ -105,7 +105,7 @@ public:
SCENARIO_RESCUE_HOSTAGES, SCENARIO_RESCUE_HOSTAGES,
SCENARIO_ESCORT_VIP SCENARIO_ESCORT_VIP
}; };
GameScenarioType GetScenario() const { return m_gameScenario; } GameScenarioType GetScenario() const { return m_gameScenario; }
// "zones" // "zones"
// depending on the game mode, these are bomb zones, rescue zones, etc. // depending on the game mode, these are bomb zones, rescue zones, etc.
@ -122,11 +122,11 @@ public:
Extent m_extent; Extent m_extent;
}; };
const Zone *GetZone(int i) const { return &m_zone[i]; } const Zone *GetZone(int i) const { return &m_zone[i]; }
const Zone *GetZone(const Vector *pos) const; // return the zone that contains the given position const Zone *GetZone(const Vector *pos) const; // return the zone that contains the given position
const Zone *GetClosestZone(const Vector *pos) const; // return the closest zone to the given position const Zone *GetClosestZone(const Vector *pos) const; // return the closest zone to the given position
const Zone *GetClosestZone(const CBaseEntity *entity) const { return GetClosestZone(&entity->pev->origin); } // return the closest zone to the given entity const Zone *GetClosestZone(const CBaseEntity *entity) const { return GetClosestZone(&entity->pev->origin); } // return the closest zone to the given entity
int GetZoneCount() const { return m_zoneCount; } int GetZoneCount() const { return m_zoneCount; }
const Vector *GetRandomPositionInZone(const Zone *zone) const; const Vector *GetRandomPositionInZone(const Zone *zone) const;
CNavArea *GetRandomAreaInZone(const Zone *zone) const; CNavArea *GetRandomAreaInZone(const Zone *zone) const;
@ -168,16 +168,16 @@ public:
if (!m_zoneCount) if (!m_zoneCount)
return NULL; 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 bool IsBombPlanted() const { return m_isBombPlanted; } // returns true if bomb has been planted
float GetBombPlantTimestamp() const { return m_bombPlantTimestamp; } // return time bomb was planted float GetBombPlantTimestamp() const { return m_bombPlantTimestamp; } // return time bomb was planted
bool IsTimeToPlantBomb() const { return (gpGlobals->time >= m_earliestBombPlantTimestamp); } // return true if it's ok to try to plant bomb bool IsTimeToPlantBomb() const { return (gpGlobals->time >= m_earliestBombPlantTimestamp); } // return true if it's ok to try to plant bomb
CBasePlayer *GetBombDefuser() const { return m_bombDefuser; } // return the player currently defusing the bomb, or NULL CBasePlayer *GetBombDefuser() const { return m_bombDefuser; } // return the player currently defusing the bomb, or NULL
float GetBombTimeLeft() const; // get the time remaining before the planted bomb explodes float GetBombTimeLeft() const; // get the time remaining before the planted bomb explodes
CBaseEntity *GetLooseBomb() { return m_looseBomb; } // return the bomb if it is loose on the ground CBaseEntity *GetLooseBomb() { return m_looseBomb; } // return the bomb if it is loose on the ground
CNavArea *GetLooseBombArea() const { return m_looseBombArea; } // return area that bomb is in/near CNavArea *GetLooseBombArea() const { return m_looseBombArea; } // return area that bomb is in/near
void SetLooseBomb(CBaseEntity *bomb); void SetLooseBomb(CBaseEntity *bomb);
float GetRadioMessageTimestamp(GameEventType event, int teamID) const; // return the last time the given radio message was sent for given team float GetRadioMessageTimestamp(GameEventType event, int teamID) const; // return the last time the given radio message was sent for given team
@ -185,36 +185,36 @@ public:
void SetRadioMessageTimestamp(GameEventType event, int teamID); void SetRadioMessageTimestamp(GameEventType event, int teamID);
void ResetRadioMessageTimestamps(); void ResetRadioMessageTimestamps();
float GetLastSeenEnemyTimestamp() const { return m_lastSeenEnemyTimestamp; } // return the last time anyone has seen an enemy float GetLastSeenEnemyTimestamp() const { return m_lastSeenEnemyTimestamp; } // return the last time anyone has seen an enemy
void SetLastSeenEnemyTimestamp() { m_lastSeenEnemyTimestamp = gpGlobals->time; } void SetLastSeenEnemyTimestamp() { m_lastSeenEnemyTimestamp = gpGlobals->time; }
float GetRoundStartTime() const { return m_roundStartTimestamp; } float GetRoundStartTime() const { return m_roundStartTimestamp; }
float GetElapsedRoundTime() const { return gpGlobals->time - m_roundStartTimestamp; } // return the elapsed time since the current round began float GetElapsedRoundTime() const { return gpGlobals->time - m_roundStartTimestamp; } // return the elapsed time since the current round began
bool AllowRogues() const { return cv_bot_allow_rogues.value != 0.0f; } bool AllowRogues() const { return cv_bot_allow_rogues.value != 0.0f; }
bool AllowPistols() const { return cv_bot_allow_pistols.value != 0.0f; } bool AllowPistols() const { return cv_bot_allow_pistols.value != 0.0f; }
bool AllowShotguns() const { return cv_bot_allow_shotguns.value != 0.0f; } bool AllowShotguns() const { return cv_bot_allow_shotguns.value != 0.0f; }
bool AllowSubMachineGuns() const { return cv_bot_allow_sub_machine_guns.value != 0.0f; } bool AllowSubMachineGuns() const { return cv_bot_allow_sub_machine_guns.value != 0.0f; }
bool AllowRifles() const { return cv_bot_allow_rifles.value != 0.0f; } bool AllowRifles() const { return cv_bot_allow_rifles.value != 0.0f; }
bool AllowMachineGuns() const { return cv_bot_allow_machine_guns.value != 0.0f; } bool AllowMachineGuns() const { return cv_bot_allow_machine_guns.value != 0.0f; }
bool AllowGrenades() const { return cv_bot_allow_grenades.value != 0.0f; } bool AllowGrenades() const { return cv_bot_allow_grenades.value != 0.0f; }
bool AllowSnipers() const { return cv_bot_allow_snipers.value != 0.0f; } bool AllowSnipers() const { return cv_bot_allow_snipers.value != 0.0f; }
bool AllowTacticalShield() const { return cv_bot_allow_shield.value != 0.0f; } bool AllowTacticalShield() const { return cv_bot_allow_shield.value != 0.0f; }
bool AllowFriendlyFireDamage() const { return friendlyfire.value != 0.0f; } bool AllowFriendlyFireDamage() const { return friendlyfire.value != 0.0f; }
bool IsWeaponUseable(CBasePlayerItem *item) const; // return true if the bot can use this weapon bool IsWeaponUseable(CBasePlayerItem *item) const; // return true if the bot can use this weapon
bool IsDefenseRushing() const { return m_isDefenseRushing; } // returns true if defense team has "decided" to rush this round bool IsDefenseRushing() const { return m_isDefenseRushing; } // returns true if defense team has "decided" to rush this round
bool IsOnDefense(CBasePlayer *player) const; // return true if this player is on "defense" bool IsOnDefense(CBasePlayer *player) const; // return true if this player is on "defense"
bool IsOnOffense(CBasePlayer *player) const; // return true if this player is on "offense" bool IsOnOffense(CBasePlayer *player) const; // return true if this player is on "offense"
bool IsRoundOver() const { return m_isRoundOver; } // return true if the round has ended bool IsRoundOver() const { return m_isRoundOver; } // return true if the round has ended
unsigned int GetNavPlace() const { return m_navPlace; } unsigned int GetNavPlace() const { return m_navPlace; }
void SetNavPlace(unsigned int place) { m_navPlace = place; } void SetNavPlace(unsigned int place) { m_navPlace = place; }
enum SkillType { LOW, AVERAGE, HIGH, RANDOM }; enum SkillType { LOW, AVERAGE, HIGH, RANDOM };
NOXREF const char *GetRandomBotName(SkillType skill); const char *GetRandomBotName(SkillType skill);
static void MonitorBotCVars(); static void MonitorBotCVars();
static void MaintainBotQuota(); static void MaintainBotQuota();
@ -225,7 +225,7 @@ public:
#ifndef HOOK_GAMEDLL #ifndef HOOK_GAMEDLL
private: private:
#endif // HOOK_GAMEDLL #endif
static float IMPL(m_flNextCVarCheck); static float IMPL(m_flNextCVarCheck);
static bool IMPL(m_isMapDataLoaded); // true if we've attempted to load map data static bool IMPL(m_isMapDataLoaded); // true if we've attempted to load map data
static bool IMPL(m_isLearningMap); static bool IMPL(m_isLearningMap);
@ -233,7 +233,7 @@ private:
GameScenarioType m_gameScenario; // what kind of game are we playing GameScenarioType m_gameScenario; // what kind of game are we playing
Zone m_zone[ MAX_ZONES ]; Zone m_zone[MAX_ZONES];
int m_zoneCount; int m_zoneCount;
bool m_isBombPlanted; // true if bomb has been planted bool m_isBombPlanted; // true if bomb has been planted
@ -260,18 +260,22 @@ private:
bool m_bServerActive; bool m_bServerActive;
}; };
/* <2e81a8> ../cstrike/dlls/bot/cs_bot_manager.h:24 */ inline int OtherTeam(int team)
NOXREF inline int OtherTeam(int team)
{ {
return (team == TERRORIST) ? CT : TERRORIST; return (team == TERRORIST) ? CT : TERRORIST;
} }
/* <111bd2> ../cstrike/dlls/bot/cs_bot_manager.h:266 */
inline CCSBotManager *TheCSBots() inline CCSBotManager *TheCSBots()
{ {
return reinterpret_cast<CCSBotManager *>(TheBots); return reinterpret_cast<CCSBotManager *>(TheBots);
} }
// Determine whether bots can be used or not
inline bool AreBotsAllowed()
{
return g_bAllowedCSBot;
}
void PrintAllEntities(); void PrintAllEntities();
void UTIL_DrawBox(Extent *extent, int lifetime, int red, int green, int blue); void UTIL_DrawBox(Extent *extent, int lifetime, int red, int green, int blue);

View File

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

View File

@ -1,8 +1,6 @@
#include "precompiled.h" #include "precompiled.h"
// Determine actual path positions bot will move between along the path // Determine actual path positions bot will move between along the path
/* <38db02> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:30 */
bool CCSBot::ComputePathPositions() bool CCSBot::ComputePathPositions()
{ {
if (m_pathLength == 0) if (m_pathLength == 0)
@ -125,8 +123,6 @@ bool CCSBot::ComputePathPositions()
} }
// If next step of path uses a ladder, prepare to traverse it // If next step of path uses a ladder, prepare to traverse it
/* <38d424> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:155 */
void CCSBot::SetupLadderMovement() void CCSBot::SetupLadderMovement()
{ {
if (m_pathIndex < 1 || m_pathLength == 0) 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? // 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) void CCSBot::ComputeLadderEndpoint(bool isAscending)
{ {
TraceResult result; TraceResult result;
@ -221,8 +215,6 @@ void CCSBot::ComputeLadderEndpoint(bool isAscending)
// Navigate our current ladder. Return true if we are doing ladder navigation. // 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. // 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() bool CCSBot::UpdateLadderMovement()
{ {
if (m_pathLadder == NULL) if (m_pathLadder == NULL)
@ -303,7 +295,7 @@ bool CCSBot::UpdateLadderMovement()
{ {
Vector2D perp(-m_pathLadder->m_dirVector.y, m_pathLadder->m_dirVector.x); 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; approached = true;
} }
@ -359,7 +351,7 @@ bool CCSBot::UpdateLadderMovement()
{ {
Vector2D perp(-m_pathLadder->m_dirVector.y, m_pathLadder->m_dirVector.x); 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; approached = true;
} }
@ -582,8 +574,6 @@ bool CCSBot::UpdateLadderMovement()
// Compute closest point on path to given point // 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 // 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 bool CCSBot::FindClosestPointOnPath(const Vector *worldPos, int startIndex, int endIndex, Vector *close) const
{ {
if (!HasPath() || close == NULL) 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 // 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. // 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 int CCSBot::FindOurPositionOnPath(Vector *close, bool local) const
{ {
if (!HasPath()) if (!HasPath())
@ -724,8 +712,6 @@ int CCSBot::FindOurPositionOnPath(Vector *close, bool local) const
} }
// Test for un-jumpable height change, or unrecoverable fall // 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 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) // 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. // Compute a point a fixed distance ahead along our path.
// Returns path index just after point. // Returns path index just after point.
/* <38ec40> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:810 */
int CCSBot::FindPathPoint(float aheadRange, Vector *point, int *prevIndex) int CCSBot::FindPathPoint(float aheadRange, Vector *point, int *prevIndex)
{ {
// find path index just past aheadRange // 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 // we need the point just *ahead* of us
++startIndex; if (++startIndex >= m_pathLength)
if (startIndex >= m_pathLength)
startIndex = m_pathLength - 1; startIndex = m_pathLength - 1;
// if we hit a ladder, stop, or jump area, must stop // 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 // Set the current index along the path
/* <38f761> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1052 */
void CCSBot::SetPathIndex(int newIndex) void CCSBot::SetPathIndex(int newIndex)
{ {
m_pathIndex = Q_min(newIndex, m_pathLength - 1); 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 // Return true if nearing a jump in the path
/* <38cafc> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1077 */
bool CCSBot::IsNearJump() const bool CCSBot::IsNearJump() const
{ {
if (m_pathIndex == 0 || m_pathIndex >= m_pathLength) 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 // 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 float CCSBot::GetApproximateFallDamage(float height) const
{ {
// empirically discovered height values // 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 // 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 bool CCSBot::IsFriendInTheWay(const Vector *goalPos) const
{ {
// do this check less often to ease CPU burden // 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 // Do reflex avoidance movements if our "feelers" are touched
/* <38fbd5> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1197 */
void CCSBot::FeelerReflexAdjustment(Vector *goalPosition) void CCSBot::FeelerReflexAdjustment(Vector *goalPosition)
{ {
// if we are in a "precise" area, do not do feeler adjustments // 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. // 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) CCSBot::PathResult CCSBot::UpdatePathMovement(bool allowSpeedChange)
{ {
if (m_pathLength == 0) 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 // 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) void CCSBot::BuildTrivialPath(const Vector *goal)
{ {
m_pathIndex = 1; m_pathIndex = 1;
@ -1602,8 +1571,6 @@ void CCSBot::BuildTrivialPath(const Vector *goal)
// Compute shortest path to goal position via A* algorithm // Compute shortest path to goal position via A* algorithm
// If 'goalArea' is NULL, path will get as close as it can. // 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) bool CCSBot::ComputePath(CNavArea *goalArea, const Vector *goal, RouteType route)
{ {
// Throttle re-pathing // Throttle re-pathing
@ -1631,7 +1598,7 @@ bool CCSBot::ComputePath(CNavArea *goalArea, const Vector *goal, RouteType route
pathEndPosition = *goal; pathEndPosition = *goal;
// make sure path end position is on the ground // make sure path end position is on the ground
if (goalArea) if (goalArea != NULL)
pathEndPosition.z = goalArea->GetZ(&pathEndPosition); pathEndPosition.z = goalArea->GetZ(&pathEndPosition);
else else
GetGroundHeight(&pathEndPosition, &pathEndPosition.z); 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 // Return estimated distance left to travel along path
/* <390ef6> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1798 */
float CCSBot::GetPathDistanceRemaining() const float CCSBot::GetPathDistanceRemaining() const
{ {
if (!HasPath()) if (!HasPath())
@ -1753,8 +1718,6 @@ float CCSBot::GetPathDistanceRemaining() const
} }
// Draw a portion of our current path for debugging. // Draw a portion of our current path for debugging.
/* <390fb1> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1821 */
void CCSBot::DrawPath() void CCSBot::DrawPath()
{ {
if (!HasPath()) if (!HasPath())

View File

@ -2,7 +2,6 @@
// Returns true if the radio message is an order to do something // 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 // 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 bool CCSBot::IsRadioCommand(GameEventType event) const
{ {
if (event == EVENT_RADIO_AFFIRMATIVE if (event == EVENT_RADIO_AFFIRMATIVE
@ -18,8 +17,6 @@ bool CCSBot::IsRadioCommand(GameEventType event) const
} }
// Respond to radio commands from HUMAN players // Respond to radio commands from HUMAN players
/* <3a36e0> ../cstrike/dlls/bot/cs_bot_radio.cpp:37 */
void CCSBot::RespondToRadioCommands() void CCSBot::RespondToRadioCommands()
{ {
// bots use the chatter system to respond to each other // bots use the chatter system to respond to each other
@ -74,7 +71,6 @@ void CCSBot::RespondToRadioCommands()
return; return;
} }
CCSBotManager *ctrl = TheCSBots();
CBasePlayer *player = m_radioSubject; CBasePlayer *player = m_radioSubject;
if (player == NULL) if (player == NULL)
return; return;
@ -142,7 +138,7 @@ void CCSBot::RespondToRadioCommands()
} }
case EVENT_RADIO_GET_OUT_OF_THERE: case EVENT_RADIO_GET_OUT_OF_THERE:
{ {
if (ctrl->IsBombPlanted()) if (TheCSBots()->IsBombPlanted())
{ {
EscapeFromBomb(); EscapeFromBomb();
player->InhibitAutoFollow(inhibitAutoFollowDuration); player->InhibitAutoFollow(inhibitAutoFollowDuration);
@ -154,11 +150,11 @@ void CCSBot::RespondToRadioCommands()
{ {
// if this is a defusal scenario, and the bomb is planted, // if this is a defusal scenario, and the bomb is planted,
// and a human player cleared a bombsite, check it off our list too // 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) if (zone != NULL)
{ {
@ -196,8 +192,6 @@ void CCSBot::RespondToRadioCommands()
} }
// Send voice chatter. Also sends the entindex. // Send voice chatter. Also sends the entindex.
/* <3a397f> ../cstrike/dlls/bot/cs_bot_radio.cpp:220 */
void CCSBot::StartVoiceFeedback(float duration) void CCSBot::StartVoiceFeedback(float duration)
{ {
m_voiceFeedbackStartTimestamp = gpGlobals->time; 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) void CCSBot::EndVoiceFeedback(bool force)
{ {
if (!force && !m_voiceFeedbackEndTimestamp) 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 // 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) bool CCSBot::RespondToHelpRequest(CBasePlayer *them, Place place, float maxRange)
{ {
if (IsRogue()) if (IsRogue())
@ -290,8 +281,6 @@ bool CCSBot::RespondToHelpRequest(CBasePlayer *them, Place place, float maxRange
} }
// Send a radio message // Send a radio message
/* <3a4316> ../cstrike/dlls/bot/cs_bot_radio.cpp:319 */
void CCSBot::SendRadioMessage(GameEventType event) void CCSBot::SendRadioMessage(GameEventType event)
{ {
// make sure this is a radio event // make sure this is a radio event
@ -300,11 +289,10 @@ void CCSBot::SendRadioMessage(GameEventType event)
return; return;
} }
CCSBotManager *ctrl = TheCSBots();
PrintIfWatched("%3.1f: SendRadioMessage( %s )\n", gpGlobals->time, GameEventName[ event ]); PrintIfWatched("%3.1f: SendRadioMessage( %s )\n", gpGlobals->time, GameEventName[ event ]);
// note the time the message was sent // note the time the message was sent
ctrl->SetRadioMessageTimestamp(event, m_iTeam); TheCSBots()->SetRadioMessageTimestamp(event, m_iTeam);
m_lastRadioSentTimestamp = gpGlobals->time; m_lastRadioSentTimestamp = gpGlobals->time;

View File

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

View File

@ -1,13 +1,9 @@
#include "precompiled.h" #include "precompiled.h"
// Lightweight maintenance, invoked frequently // Lightweight maintenance, invoked frequently
/* <3c635f> ../cstrike/dlls/bot/cs_bot_update.cpp:26 */
void CCSBot::__MAKE_VHOOK(Upkeep)() void CCSBot::__MAKE_VHOOK(Upkeep)()
{ {
CCSBotManager *ctrl = TheCSBots(); if (TheCSBots()->IsLearningMap() || !IsAlive())
if (ctrl->IsLearningMap() || !IsAlive())
return; return;
if (m_isRapidFiring) if (m_isRapidFiring)
@ -151,15 +147,11 @@ void CCSBot::__MAKE_VHOOK(Upkeep)()
} }
// Heavyweight processing, invoked less often // Heavyweight processing, invoked less often
/* <3c6e1e> ../cstrike/dlls/bot/cs_bot_update.cpp:208 */
void CCSBot::__MAKE_VHOOK(Update)() void CCSBot::__MAKE_VHOOK(Update)()
{ {
CCSBotManager *ctrl = TheCSBots(); if (TheCSBots()->IsAnalysisRequested() && m_processMode == PROCESS_NORMAL)
if (ctrl->IsAnalysisRequested() && m_processMode == PROCESS_NORMAL)
{ {
ctrl->AckAnalysisRequest(); TheCSBots()->AckAnalysisRequest();
StartAnalyzeAlphaProcess(); StartAnalyzeAlphaProcess();
} }
@ -191,7 +183,7 @@ void CCSBot::__MAKE_VHOOK(Update)()
} }
// show line of fire // 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); UTIL_MakeVectors(pev->punchangle + pev->v_angle);
@ -207,18 +199,46 @@ void CCSBot::__MAKE_VHOOK(Update)()
} }
} }
//
// Debug beam rendering // 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(); 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()) 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) if (cv_bot_stop.value != 0.0f)
@ -275,6 +295,7 @@ void CCSBot::__MAKE_VHOOK(Update)()
default: Crouch(); break; default: Crouch(); break;
} }
} }
if (m_blindFire) if (m_blindFire)
{ {
PrimaryAttack(); PrimaryAttack();
@ -294,10 +315,14 @@ void CCSBot::__MAKE_VHOOK(Update)()
// adjust our personal "safe" time // adjust our personal "safe" time
AdjustSafeTime(); AdjustSafeTime();
// Decide if we should attack if (IsUsingGrenade())
bool doAttack = false;
if (!IsUsingGrenade())
{ {
ThrowGrenade(&threat->pev->origin);
}
else
{
// Decide if we should attack
bool doAttack = false;
switch (GetDisposition()) switch (GetDisposition())
{ {
case IGNORE_ENEMIES: case IGNORE_ENEMIES:
@ -327,50 +352,48 @@ void CCSBot::__MAKE_VHOOK(Update)()
break; break;
} }
} }
if (doAttack)
{
if (GetEnemy() == NULL || threat != GetEnemy() || !IsAttacking())
{
if (IsUsingKnife() && IsHiding())
{
// if hiding with a knife, wait until threat is close
const float knifeAttackRange = 250.0f;
if ((pev->origin - threat->pev->origin).IsLengthLessThan(knifeAttackRange))
{
Attack(threat);
}
}
else
{
Attack(threat);
}
}
}
else
{
// dont attack, but keep track of nearby enemies
SetEnemy(threat);
m_isEnemyVisible = true;
}
} }
else
ThrowGrenade(&pev->origin);
// if we aren't attacking but we are being attacked, retaliate // if we aren't attacking but we are being attacked, retaliate
if (!doAttack && !IsAttacking() && GetDisposition() != IGNORE_ENEMIES) if (GetDisposition() != IGNORE_ENEMIES && !IsAttacking())
{ {
const float recentAttackDuration = 1.0f; const float recentAttackDuration = 1.0f;
if (GetTimeSinceAttacked() < recentAttackDuration) if (GetTimeSinceAttacked() < recentAttackDuration)
{ {
// we may not be attacking our attacker, but at least we're not just taking it // 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) // (since m_attacker isn't reaction-time delayed, we can't directly use it)
doAttack = true; Attack(threat);
PrintIfWatched("Ouch! Retaliating!\n"); PrintIfWatched("Ouch! Retaliating!\n");
} }
} }
if (doAttack) TheCSBots()->SetLastSeenEnemyTimestamp();
{
if (GetEnemy() == NULL || !IsAttacking() || threat != GetEnemy())
{
if (IsUsingKnife() && IsHiding())
{
// if hiding with a knife, wait until threat is close
const float knifeAttackRange = 250.0f;
if ((pev->origin - threat->pev->origin).IsLengthLessThan(knifeAttackRange))
{
Attack(threat);
}
}
else
{
Attack(threat);
}
}
}
else
{
// dont attack, but keep track of nearby enemies
SetEnemy(threat);
m_isEnemyVisible = true;
}
ctrl->SetLastSeenEnemyTimestamp();
} }
// Validate existing enemy, if any // Validate existing enemy, if any
@ -384,6 +407,7 @@ void CCSBot::__MAKE_VHOOK(Update)()
} }
else 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) // 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 // 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)) if (IsVisible(m_enemy, false, &m_visibleEnemyParts))
@ -462,7 +486,6 @@ void CCSBot::__MAKE_VHOOK(Update)()
m_isWaitingToTossGrenade = false; m_isWaitingToTossGrenade = false;
} }
if (IsHunting() && IsWellPastSafe() && IsUsingGrenade()) if (IsHunting() && IsWellPastSafe() && IsUsingGrenade())
{ {
EquipBestWeapon(MUST_EQUIP); EquipBestWeapon(MUST_EQUIP);
@ -540,10 +563,10 @@ void CCSBot::__MAKE_VHOOK(Update)()
GetChatter()->SpottedBomber(GetBomber()); GetChatter()->SpottedBomber(GetBomber());
if (CanSeeLooseBomb()) if (CanSeeLooseBomb())
GetChatter()->SpottedLooseBomb(ctrl->GetLooseBomb()); GetChatter()->SpottedLooseBomb(TheCSBots()->GetLooseBomb());
// Scenario interrupts // Scenario interrupts
switch (ctrl->GetScenario()) switch (TheCSBots()->GetScenario())
{ {
case CCSBotManager::SCENARIO_DEFUSE_BOMB: case CCSBotManager::SCENARIO_DEFUSE_BOMB:
{ {
@ -556,9 +579,9 @@ void CCSBot::__MAKE_VHOOK(Update)()
gonnaBlowTime *= 0.66f; gonnaBlowTime *= 0.66f;
if (!IsEscapingFromBomb() // we aren't already escaping the bomb 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 && 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 && !IsDefusingBomb() // we aren't defusing the bomb
&& !IsAttacking()) // we aren't in the midst of a firefight && !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. // give us a chance to do something else.
const float earliestAutoFollowTime = 5.0f; const float earliestAutoFollowTime = 5.0f;
const float minAutoFollowTeamwork = 0.4f; const float minAutoFollowTeamwork = 0.4f;
if (ctrl->GetElapsedRoundTime() > earliestAutoFollowTime if (TheCSBots()->GetElapsedRoundTime() > earliestAutoFollowTime
&& GetProfile()->GetTeamwork() > minAutoFollowTeamwork && GetProfile()->GetTeamwork() > minAutoFollowTeamwork
&& CanAutoFollow() && CanAutoFollow()
&& !IsBusy() && !IsBusy()
@ -629,7 +652,7 @@ void CCSBot::__MAKE_VHOOK(Update)()
Follow(leader); Follow(leader);
PrintIfWatched("Auto-Following %s\n", STRING(leader->pev->netname)); PrintIfWatched("Auto-Following %s\n", STRING(leader->pev->netname));
if (g_pGameRules->IsCareer()) if (CSGameRules()->IsCareer())
{ {
GetChatter()->Say("FollowingCommander", 10.0f); 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 (GetMorale() * -40.0 > RANDOM_FLOAT(0.0f, 100.0f))
{ {
if (ctrl->IsOnOffense(this) || !ctrl->IsDefenseRushing()) if (TheCSBots()->IsOnOffense(this) || !TheCSBots()->IsDefenseRushing())
{ {
SetDisposition(OPPORTUNITY_FIRE); SetDisposition(OPPORTUNITY_FIRE);
Hide(m_lastKnownArea, RANDOM_FLOAT(3.0f, 15.0f)); Hide(m_lastKnownArea, RANDOM_FLOAT(3.0f, 15.0f));

View File

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

View File

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

View File

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

View File

@ -55,13 +55,13 @@ public:
EXPLODED, // the bomb has exploded EXPLODED, // the bomb has exploded
}; };
bool IsBombMoving() const { return (m_bombState == MOVING); } bool IsBombMoving() const { return (m_bombState == MOVING); }
bool IsBombLoose() const { return (m_bombState == LOOSE); } bool IsBombLoose() const { return (m_bombState == LOOSE); }
bool IsBombPlanted() const { return (m_bombState == PLANTED); } bool IsBombPlanted() const { return (m_bombState == PLANTED); }
bool IsBombDefused() const { return (m_bombState == DEFUSED); } bool IsBombDefused() const { return (m_bombState == DEFUSED); }
bool IsBombExploded() const { return (m_bombState == EXPLODED); } bool IsBombExploded() const { return (m_bombState == EXPLODED); }
void UpdateLooseBomb(const Vector *pos); // we see the loose bomb void UpdateLooseBomb(const Vector *pos); // we see the loose bomb
float TimeSinceLastSawLooseBomb() const; // how long has is been since we saw the loose bomb float TimeSinceLastSawLooseBomb() const; // how long has is been since we saw the loose bomb
bool IsLooseBombLocationKnown() const; // do we know where the loose bomb is bool IsLooseBombLocationKnown() const; // do we know where the loose bomb is
@ -72,7 +72,7 @@ public:
bool IsPlantedBombLocationKnown() const; // do we know where the bomb was planted bool IsPlantedBombLocationKnown() const; // do we know where the bomb was planted
void MarkBombsiteAsPlanted(int zoneIndex); // mark bombsite as the location of the planted bomb void MarkBombsiteAsPlanted(int zoneIndex); // mark bombsite as the location of the planted bomb
enum { UNKNOWN = -1 }; enum { UNKNOWN = -1 };
int GetPlantedBombsite() const; // return the zone index of the planted bombsite, or UNKNOWN int GetPlantedBombsite() const; // return the zone index of the planted bombsite, or UNKNOWN
bool IsAtPlantedBombsite() const; // return true if we are currently in the bombsite where the bomb is planted bool IsAtPlantedBombsite() const; // return true if we are currently in the bombsite where the bomb is planted
@ -105,7 +105,7 @@ public:
#ifndef HOOK_GAMEDLL #ifndef HOOK_GAMEDLL
private: private:
#endif // HOOK_GAMEDLL #endif
CCSBot *m_owner; // who owns this gamestate CCSBot *m_owner; // who owns this gamestate
bool m_isRoundOver; // true if round is over, but no yet reset bool m_isRoundOver; // true if round is over, but no yet reset
@ -139,12 +139,12 @@ private:
Vector knownPos; Vector knownPos;
bool isValid; bool isValid;
bool isAlive; bool isAlive;
bool isFree; // not being escorted by a CT 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 int m_hostageCount; // number of hostages left in map
CountdownTimer m_validateInterval; 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 void InitializeHostageInfo(); // initialize our knowledge of the number and location of hostages
bool m_allHostagesRescued; // if true, so every hostages been is rescued bool m_allHostagesRescued; // if true, so every hostages been is rescued

View File

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

View File

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

View File

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

View File

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

View File

@ -1,16 +1,12 @@
#include "precompiled.h" #include "precompiled.h"
// Move to the bomb on the floor and pick it up // 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) void FetchBombState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
{ {
me->DestroyPath(); me->DestroyPath();
} }
// Move to the bomb on the floor and pick it up // 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) void FetchBombState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{ {
if (me->IsCarryingBomb()) if (me->IsCarryingBomb())

View File

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

View File

@ -2,8 +2,6 @@
// Begin moving to a nearby hidey-hole. // 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! // 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) void HideState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
{ {
m_isAtSpot = false; m_isAtSpot = false;
@ -42,12 +40,8 @@ void HideState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
// Move to a nearby hidey-hole. // 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! // 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) void HideState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{ {
CCSBotManager *ctrl = TheCSBots();
// wait until finished reloading to leave hide state // wait until finished reloading to leave hide state
if (!me->IsActiveWeaponReloading()) if (!me->IsActiveWeaponReloading())
{ {
@ -56,16 +50,16 @@ void HideState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
if (me->GetTask() == CCSBot::GUARD_LOOSE_BOMB) if (me->GetTask() == CCSBot::GUARD_LOOSE_BOMB)
{ {
// if we're guarding the loose bomb, continue to guard it but pick a new spot // 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; return;
} }
else if (me->GetTask() == CCSBot::GUARD_BOMB_ZONE) else if (me->GetTask() == CCSBot::GUARD_BOMB_ZONE)
{ {
// if we're guarding a bombsite, continue to guard it but pick a new spot // 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) if (zone != NULL)
{ {
CNavArea *area = ctrl->GetRandomAreaInZone(zone); CNavArea *area = TheCSBots()->GetRandomAreaInZone(zone);
if (area != NULL) if (area != NULL)
{ {
me->Hide(area); 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 // TODO: Perhaps tie in to TakeDamage(), so it works for human players, too
// Scenario logic // Scenario logic
switch (ctrl->GetScenario()) switch (TheCSBots()->GetScenario())
{ {
case CCSBotManager::SCENARIO_DEFUSE_BOMB: 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 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 && if (me->GetTask() == CCSBot::HOLD_POSITION &&
ctrl->IsBombPlanted() && TheCSBots()->IsBombPlanted() &&
ctrl->GetBombPlantTimestamp() > me->GetStateTimestamp()) TheCSBots()->GetBombPlantTimestamp() > me->GetStateTimestamp())
{ {
me->Idle(); me->Idle();
return; return;
} }
// if we are guarding the defuser and he dies/gives up, stop hiding (to choose another defuser) // 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(); me->Idle();
return; return;
} }
// if we are guarding the loose bomb and it is picked up, stop hiding // 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->GetChatter()->TheyPickedUpTheBomb();
me->Idle(); 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 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(); me->Idle();
return; return;
@ -166,16 +160,16 @@ void HideState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
else else
{ {
// if we are near the ticking bomb and someone starts defusing it, attack! // 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; const float hearDefuseRange = 2000.0f;
if ((toDefuser - me->pev->origin).IsLengthLessThan(hearDefuseRange)) 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 we are nearby, attack, otherwise move to the bomb (which will cause us to attack when we see defuser)
if (me->CanSeePlantedBomb()) if (me->CanSeePlantedBomb())
{ {
me->Attack(ctrl->GetBombDefuser()); me->Attack(TheCSBots()->GetBombDefuser());
} }
else else
{ {
@ -286,16 +280,16 @@ void HideState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{ {
if (me->m_iTeam == CT) 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) if (me->GetNearbyEnemyCount() == 0)
{ {
const float someTime = 30.0f; const float someTime = 30.0f;
const float littleTime = 11.0; const float littleTime = 11.0;
if (ctrl->GetBombTimeLeft() > someTime) if (TheCSBots()->GetBombTimeLeft() > someTime)
me->GetChatter()->Encourage("BombsiteSecure", RANDOM_FLOAT(10.0f, 15.0f)); 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)); me->GetChatter()->Encourage("WaitingForHumanToDefuseBomb", RANDOM_FLOAT(5.0f, 8.0f));
else else
me->GetChatter()->Encourage("WaitingForHumanToDefuseBombPanic", RANDOM_FLOAT(3.0f, 4.0f)); 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"); me->PrintIfWatched("No available hiding spots - hiding where I'm at.\n");
// hide where we are // hide where we are
#ifndef REGAMEDLL_FIXES
m_hidingSpot.x = me->pev->origin.x; m_hidingSpot.x = me->pev->origin.x;
m_hidingSpot.x = me->pev->origin.y; m_hidingSpot.x = me->pev->origin.y;
m_hidingSpot.z = me->GetFeetZ(); 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 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) void HideState::__MAKE_VHOOK(OnExit)(CCSBot *me)
{ {
m_isHoldingPosition = false; m_isHoldingPosition = false;

View File

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

View File

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

View File

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

View File

@ -1,8 +1,6 @@
#include "precompiled.h" #include "precompiled.h"
// Move to a potentially far away position. // 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) void MoveToState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
{ {
if (me->IsUsingKnife() && me->IsWellPastSafe() && !me->IsHurrying()) 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. // 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) void MoveToState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{ {
CCSBotManager *ctrl = TheCSBots();
// assume that we are paying attention and close enough to know our enemy died // assume that we are paying attention and close enough to know our enemy died
if (me->GetTask() == CCSBot::MOVE_TO_LAST_KNOWN_ENEMY_POSITION) if (me->GetTask() == CCSBot::MOVE_TO_LAST_KNOWN_ENEMY_POSITION)
{ {
@ -60,7 +54,7 @@ void MoveToState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
me->UpdateLookAround(); me->UpdateLookAround();
// Scenario logic // Scenario logic
switch (ctrl->GetScenario()) switch (TheCSBots()->GetScenario())
{ {
case CCSBotManager::SCENARIO_DEFUSE_BOMB: 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 // 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 // don't re-check zones
if (me->GetGameState()->IsBombsiteClear(z)) if (me->GetGameState()->IsBombsiteClear(z))
continue; 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 // note this bombsite is clear
me->GetGameState()->ClearBombsite(z); me->GetGameState()->ClearBombsite(z);
@ -118,7 +112,7 @@ void MoveToState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
case CCSBot::DEFUSE_BOMB: case CCSBot::DEFUSE_BOMB:
{ {
// if we are trying to defuse the bomb, and someone has started defusing, guard them instead // 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->GetChatter()->Say("CoveringFriend");
me->Idle(); me->Idle();
@ -263,7 +257,8 @@ void MoveToState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
if (bombPos != NULL) if (bombPos != NULL)
{ {
const float defuseRange = 100.0f; 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)) 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) void MoveToState::__MAKE_VHOOK(OnExit)(CCSBot *me)
{ {
// reset to run in case we were walking near our goal position // reset to run in case we were walking near our goal position

View File

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

View File

@ -2,14 +2,11 @@
// Face the entity and "use" it // Face the entity and "use" it
// NOTE: This state assumes we are standing in range of the entity to be used, with no obstructions. // 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) 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) void UseEntityState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{ {
// in the very rare situation where two or more bots "used" a hostage at the same time, // 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) void UseEntityState::__MAKE_VHOOK(OnExit)(CCSBot *me)
{ {
me->ClearLookAt(); me->ClearLookAt();

View File

@ -52,13 +52,9 @@ TYPEDESCRIPTION CEnvSpark::m_SaveData[] =
#endif // HOOK_GAMEDLL #endif // HOOK_GAMEDLL
/* <260d6> ../cstrike/dlls/buttons.cpp:62 */
IMPLEMENT_SAVERESTORE(CEnvGlobal, CBaseEntity); IMPLEMENT_SAVERESTORE(CEnvGlobal, CBaseEntity);
/* <272af> ../cstrike/dlls/buttons.cpp:64 */
LINK_ENTITY_TO_CLASS(env_global, CEnvGlobal); LINK_ENTITY_TO_CLASS(env_global, CEnvGlobal);
/* <26863> ../cstrike/dlls/buttons.cpp:66 */
void CEnvGlobal::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) void CEnvGlobal::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{ {
pkvd->fHandled = TRUE; pkvd->fHandled = TRUE;
@ -80,7 +76,6 @@ void CEnvGlobal::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CPointEntity::KeyValue(pkvd); CPointEntity::KeyValue(pkvd);
} }
/* <26486> ../cstrike/dlls/buttons.cpp:80 */
void CEnvGlobal::__MAKE_VHOOK(Spawn)() void CEnvGlobal::__MAKE_VHOOK(Spawn)()
{ {
if (!m_globalstate) 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) void CEnvGlobal::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{ {
GLOBALESTATE oldState = gGlobalState.EntityGetState(m_globalstate); 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); gGlobalState.EntityAdd(m_globalstate, gpGlobals->mapname, newState);
} }
/* <2616f> ../cstrike/dlls/buttons.cpp:141 */
IMPLEMENT_SAVERESTORE(CMultiSource, CBaseEntity); IMPLEMENT_SAVERESTORE(CMultiSource, CBaseEntity);
/* <27379> ../cstrike/dlls/buttons.cpp:143 */
LINK_ENTITY_TO_CLASS(multisource, CMultiSource); LINK_ENTITY_TO_CLASS(multisource, CMultiSource);
// Cache user-entity-field values until spawn is called. // Cache user-entity-field values until spawn is called.
/* <26d1e> ../cstrike/dlls/buttons.cpp:148 */
void CMultiSource::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) void CMultiSource::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{ {
if (FStrEq(pkvd->szKeyName, "style") if (FStrEq(pkvd->szKeyName, "style")
@ -168,13 +157,12 @@ void CMultiSource::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CPointEntity::KeyValue(pkvd); CPointEntity::KeyValue(pkvd);
} }
/* <256e2> ../cstrike/dlls/buttons.cpp:168 */
void CMultiSource::__MAKE_VHOOK(Spawn)() void CMultiSource::__MAKE_VHOOK(Spawn)()
{ {
// set up think for later registration // set up think for later registration
pev->solid = SOLID_NOT; pev->solid = SOLID_NOT;
pev->movetype = MOVETYPE_NONE; pev->movetype = MOVETYPE_NONE;
pev->nextthink = gpGlobals->time + 0.1; pev->nextthink = gpGlobals->time + 0.1f;
// Until it's initialized // Until it's initialized
pev->spawnflags |= SF_MULTI_INIT; pev->spawnflags |= SF_MULTI_INIT;
@ -182,7 +170,6 @@ void CMultiSource::__MAKE_VHOOK(Spawn)()
SetThink(&CMultiSource::Register); SetThink(&CMultiSource::Register);
} }
/* <2633b> ../cstrike/dlls/buttons.cpp:179 */
void CMultiSource::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) void CMultiSource::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{ {
int i = 0; 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 *) BOOL CMultiSource::__MAKE_VHOOK(IsTriggered)(CBaseEntity *)
{ {
// Is everything triggered? // Is everything triggered?
@ -227,7 +213,7 @@ BOOL CMultiSource::__MAKE_VHOOK(IsTriggered)(CBaseEntity *)
// Still initializing? // Still initializing?
if (pev->spawnflags & SF_MULTI_INIT) if (pev->spawnflags & SF_MULTI_INIT)
return 0; return FALSE;
while (i < m_iTotal) while (i < m_iTotal)
{ {
@ -240,14 +226,13 @@ BOOL CMultiSource::__MAKE_VHOOK(IsTriggered)(CBaseEntity *)
{ {
if (FStringNull(m_globalstate) || gGlobalState.EntityGetState(m_globalstate) == GLOBAL_ON) 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() void CMultiSource::Register()
{ {
edict_t *pentTarget = NULL; edict_t *pentTarget = NULL;
@ -288,10 +273,8 @@ void CMultiSource::Register()
pev->spawnflags &= ~SF_MULTI_INIT; pev->spawnflags &= ~SF_MULTI_INIT;
} }
/* <262ee> ../cstrike/dlls/buttons.cpp:287 */
IMPLEMENT_SAVERESTORE(CBaseButton, CBaseToggle); IMPLEMENT_SAVERESTORE(CBaseButton, CBaseToggle);
/* <25709> ../cstrike/dlls/buttons.cpp:289 */
void CBaseButton::__MAKE_VHOOK(Precache)() void CBaseButton::__MAKE_VHOOK(Precache)()
{ {
char *pszSound; char *pszSound;
@ -310,14 +293,14 @@ void CBaseButton::__MAKE_VHOOK(Precache)()
// get door button sounds, for doors which require buttons to open // get door button sounds, for doors which require buttons to open
if (m_bLockedSound) if (m_bLockedSound)
{ {
pszSound = ButtonSound((int)m_bLockedSound); pszSound = ButtonSound(int(m_bLockedSound));
PRECACHE_SOUND(pszSound); PRECACHE_SOUND(pszSound);
m_ls.sLockedSound = ALLOC_STRING(pszSound); m_ls.sLockedSound = ALLOC_STRING(pszSound);
} }
if (m_bUnlockedSound) if (m_bUnlockedSound)
{ {
pszSound = ButtonSound((int)m_bUnlockedSound); pszSound = ButtonSound(int(m_bUnlockedSound));
PRECACHE_SOUND(pszSound); PRECACHE_SOUND(pszSound);
m_ls.sUnlockedSound = ALLOC_STRING(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. // Cache user-entity-field values until spawn is called.
/* <269cb> ../cstrike/dlls/buttons.cpp:355 */
void CBaseButton::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) void CBaseButton::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{ {
if (FStrEq(pkvd->szKeyName, "changetarget")) if (FStrEq(pkvd->szKeyName, "changetarget"))
@ -363,22 +344,22 @@ void CBaseButton::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
} }
else if (FStrEq(pkvd->szKeyName, "locked_sound")) else if (FStrEq(pkvd->szKeyName, "locked_sound"))
{ {
m_bLockedSound = (int)Q_atof(pkvd->szValue); m_bLockedSound = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE; pkvd->fHandled = TRUE;
} }
else if (FStrEq(pkvd->szKeyName, "locked_sentence")) else if (FStrEq(pkvd->szKeyName, "locked_sentence"))
{ {
m_bLockedSentence = (int)Q_atof(pkvd->szValue); m_bLockedSentence = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE; pkvd->fHandled = TRUE;
} }
else if (FStrEq(pkvd->szKeyName, "unlocked_sound")) else if (FStrEq(pkvd->szKeyName, "unlocked_sound"))
{ {
m_bUnlockedSound = (int)Q_atof(pkvd->szValue); m_bUnlockedSound = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE; pkvd->fHandled = TRUE;
} }
else if (FStrEq(pkvd->szKeyName, "unlocked_sentence")) else if (FStrEq(pkvd->szKeyName, "unlocked_sentence"))
{ {
m_bUnlockedSentence = (int)Q_atof(pkvd->szValue); m_bUnlockedSentence = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE; pkvd->fHandled = TRUE;
} }
else if (FStrEq(pkvd->szKeyName, "sounds")) else if (FStrEq(pkvd->szKeyName, "sounds"))
@ -391,8 +372,6 @@ void CBaseButton::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
} }
// ButtonShot // ButtonShot
/* <26e90> ../cstrike/dlls/buttons.cpp:394 */
int CBaseButton::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) int CBaseButton::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{ {
BUTTON_CODE code = ButtonResponseToTouch(); BUTTON_CODE code = ButtonResponseToTouch();
@ -446,11 +425,8 @@ int CBaseButton::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe
// 1) wooden clunk // 1) wooden clunk
// 2) metallic click // 2) metallic click
// 3) in-out // 3) in-out
/* <27443> ../cstrike/dlls/buttons.cpp:439 */
LINK_ENTITY_TO_CLASS(func_button, CBaseButton); LINK_ENTITY_TO_CLASS(func_button, CBaseButton);
/* <25c2c> ../cstrike/dlls/buttons.cpp:442 */
void CBaseButton::__MAKE_VHOOK(Spawn)() void CBaseButton::__MAKE_VHOOK(Spawn)()
{ {
char *pszSound; char *pszSound;
@ -471,7 +447,7 @@ void CBaseButton::__MAKE_VHOOK(Spawn)()
SetThink(&CBaseButton::ButtonSpark); SetThink(&CBaseButton::ButtonSpark);
// no hurry, make sure everything else spawns // no hurry, make sure everything else spawns
pev->nextthink = gpGlobals->time + 0.5; pev->nextthink = gpGlobals->time + 0.5f;
} }
SetMovedir(pev); SetMovedir(pev);
@ -503,7 +479,7 @@ void CBaseButton::__MAKE_VHOOK(Spawn)()
m_vecPosition1 = pev->origin; m_vecPosition1 = pev->origin;
// Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big // 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? // Is this a non-moving button?
if (((m_vecPosition2 - m_vecPosition1).Length() < 1) || (pev->spawnflags & SF_BUTTON_DONTMOVE)) if (((m_vecPosition2 - m_vecPosition1).Length() < 1) || (pev->spawnflags & SF_BUTTON_DONTMOVE))
@ -529,65 +505,61 @@ void CBaseButton::__MAKE_VHOOK(Spawn)()
// Button sound table. // Button sound table.
// Also used by CBaseDoor to get 'touched' door lock/unlock sounds // Also used by CBaseDoor to get 'touched' door lock/unlock sounds
/* <24738> ../cstrike/dlls/buttons.cpp:511 */
char *ButtonSound(int sound) char *ButtonSound(int sound)
{ {
char *pszSound; char *pszSound;
switch (sound) switch (sound)
{ {
case 0: pszSound = "common/null.wav"; break; case 0: pszSound = "common/null.wav"; break;
case 1: pszSound = "buttons/button1.wav"; break; case 1: pszSound = "buttons/button1.wav"; break;
case 2: pszSound = "buttons/button2.wav"; break; case 2: pszSound = "buttons/button2.wav"; break;
case 3: pszSound = "buttons/button3.wav"; break; case 3: pszSound = "buttons/button3.wav"; break;
case 4: pszSound = "buttons/button4.wav"; break; case 4: pszSound = "buttons/button4.wav"; break;
case 5: pszSound = "buttons/button5.wav"; break; case 5: pszSound = "buttons/button5.wav"; break;
case 6: pszSound = "buttons/button6.wav"; break; case 6: pszSound = "buttons/button6.wav"; break;
case 7: pszSound = "buttons/button7.wav"; break; case 7: pszSound = "buttons/button7.wav"; break;
case 8: pszSound = "buttons/button8.wav"; break; case 8: pszSound = "buttons/button8.wav"; break;
case 9: pszSound = "buttons/button9.wav"; break; case 9: pszSound = "buttons/button9.wav"; break;
case 10: pszSound = "buttons/button10.wav"; break; case 10: pszSound = "buttons/button10.wav"; break;
case 11: pszSound = "buttons/button11.wav"; break; case 11: pszSound = "buttons/button11.wav"; break;
case 12: pszSound = "buttons/latchlocked1.wav"; break; case 12: pszSound = "buttons/latchlocked1.wav"; break;
case 13: pszSound = "buttons/latchunlocked1.wav"; break; case 13: pszSound = "buttons/latchunlocked1.wav"; break;
case 14: pszSound = "buttons/lightswitch2.wav"; break; case 14: pszSound = "buttons/lightswitch2.wav"; break;
// next 6 slots reserved for any additional sliding button sounds we may add // next 6 slots reserved for any additional sliding button sounds we may add
case 21: pszSound = "buttons/lever1.wav"; break; case 21: pszSound = "buttons/lever1.wav"; break;
case 22: pszSound = "buttons/lever2.wav"; break; case 22: pszSound = "buttons/lever2.wav"; break;
case 23: pszSound = "buttons/lever3.wav"; break; case 23: pszSound = "buttons/lever3.wav"; break;
case 24: pszSound = "buttons/lever4.wav"; break; case 24: pszSound = "buttons/lever4.wav"; break;
case 25: pszSound = "buttons/lever5.wav"; break; case 25: pszSound = "buttons/lever5.wav"; break;
default: pszSound = "buttons/button9.wav"; break; default: pszSound = "buttons/button9.wav"; break;
} }
return pszSound; return pszSound;
} }
// Makes flagged buttons spark when turned off // Makes flagged buttons spark when turned off
/* <2752e> ../cstrike/dlls/buttons.cpp:551 */
void DoSpark(entvars_t *pev, const Vector &location) 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); UTIL_Sparks(tmp);
//random volume range //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)) switch ((int)(RANDOM_FLOAT(0, 1) * 6))
{ {
case 0: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark1.wav", flVolume, ATTN_NORM); break; case 0: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark1.wav", flVolume, ATTN_NORM); break;
case 1: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark2.wav", flVolume, ATTN_NORM); break; case 1: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark2.wav", flVolume, ATTN_NORM); break;
case 2: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark3.wav", flVolume, ATTN_NORM); break; case 2: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark3.wav", flVolume, ATTN_NORM); break;
case 3: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark4.wav", flVolume, ATTN_NORM); break; case 3: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark4.wav", flVolume, ATTN_NORM); break;
case 4: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark5.wav", flVolume, ATTN_NORM); break; case 4: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark5.wav", flVolume, ATTN_NORM); break;
case 5: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark6.wav", flVolume, ATTN_NORM); break; case 5: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark6.wav", flVolume, ATTN_NORM); break;
} }
} }
/* <277fa> ../cstrike/dlls/buttons.cpp:568 */
void CBaseButton::ButtonSpark() void CBaseButton::ButtonSpark()
{ {
SetThink(&CBaseButton::ButtonSpark); SetThink(&CBaseButton::ButtonSpark);
@ -599,8 +571,6 @@ void CBaseButton::ButtonSpark()
} }
// Button's Use function // Button's Use function
/* <2719b> ../cstrike/dlls/buttons.cpp:580 */
void CBaseButton::ButtonUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) 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. // 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(); ButtonActivate();
} }
/* <27821> ../cstrike/dlls/buttons.cpp:603 */
CBaseButton::BUTTON_CODE CBaseButton::ButtonResponseToTouch() CBaseButton::BUTTON_CODE CBaseButton::ButtonResponseToTouch()
{ {
// Ignore touches if button is moving, or pushed-in and waiting to auto-come-out. // 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; return BUTTON_NOTHING;
} }
@ -645,8 +616,6 @@ CBaseButton::BUTTON_CODE CBaseButton::ButtonResponseToTouch()
} }
// Touching a button simply "activates" it. // Touching a button simply "activates" it.
/* <27047> ../cstrike/dlls/buttons.cpp:628 */
void CBaseButton::ButtonTouch(CBaseEntity *pOther) void CBaseButton::ButtonTouch(CBaseEntity *pOther)
{ {
// Ignore touches by anything but players // Ignore touches by anything but players
@ -683,8 +652,6 @@ void CBaseButton::ButtonTouch(CBaseEntity *pOther)
} }
// Starts the button moving "in/up". // Starts the button moving "in/up".
/* <27843> ../cstrike/dlls/buttons.cpp:664 */
void CBaseButton::ButtonActivate() void CBaseButton::ButtonActivate()
{ {
EMIT_SOUND(ENT(pev), CHAN_VOICE, (char *)STRING(pev->noise), VOL_NORM, ATTN_NORM); 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". // Button has reached the "in/up" position. Activate its "targets", and pause before "popping out".
/* <263dd> ../cstrike/dlls/buttons.cpp:693 */
void CBaseButton::TriggerAndWait() void CBaseButton::TriggerAndWait()
{ {
assert(m_toggle_state == TS_GOING_UP); assert(m_toggle_state == TS_GOING_UP);
@ -752,8 +717,6 @@ void CBaseButton::TriggerAndWait()
} }
// Starts the button moving "out/down". // Starts the button moving "out/down".
/* <25bb7> ../cstrike/dlls/buttons.cpp:730 */
void CBaseButton::ButtonReturn() void CBaseButton::ButtonReturn()
{ {
assert(m_toggle_state == TS_AT_TOP); assert(m_toggle_state == TS_AT_TOP);
@ -774,8 +737,6 @@ void CBaseButton::ButtonReturn()
} }
// Button has returned to start state. Quiesce it. // Button has returned to start state. Quiesce it.
/* <26658> ../cstrike/dlls/buttons.cpp:748 */
void CBaseButton::ButtonBackHome() void CBaseButton::ButtonBackHome()
{ {
assert(m_toggle_state == TS_GOING_DOWN); assert(m_toggle_state == TS_GOING_DOWN);
@ -791,10 +752,8 @@ void CBaseButton::ButtonBackHome()
{ {
edict_t *pentTarget = NULL; 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)) if (FNullEnt(pentTarget))
break; break;
@ -826,14 +785,12 @@ void CBaseButton::ButtonBackHome()
SetThink(&CBaseButton::ButtonSpark); SetThink(&CBaseButton::ButtonSpark);
// no hurry. // 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); LINK_ENTITY_TO_CLASS(func_rot_button, CRotButton);
/* <25a06> ../cstrike/dlls/buttons.cpp:808 */
void CRotButton::__MAKE_VHOOK(Spawn)() void CRotButton::__MAKE_VHOOK(Spawn)()
{ {
char *pszSound; char *pszSound;
@ -898,13 +855,9 @@ void CRotButton::__MAKE_VHOOK(Spawn)()
//SetTouch(ButtonTouch); //SetTouch(ButtonTouch);
} }
/* <262a1> ../cstrike/dlls/buttons.cpp:918 */
IMPLEMENT_SAVERESTORE(CMomentaryRotButton, CBaseToggle); IMPLEMENT_SAVERESTORE(CMomentaryRotButton, CBaseToggle);
/* <27971> ../cstrike/dlls/buttons.cpp:920 */
LINK_ENTITY_TO_CLASS(momentary_rot_button, CMomentaryRotButton); LINK_ENTITY_TO_CLASS(momentary_rot_button, CMomentaryRotButton);
/* <25acc> ../cstrike/dlls/buttons.cpp:922 */
void CMomentaryRotButton::__MAKE_VHOOK(Spawn)() void CMomentaryRotButton::__MAKE_VHOOK(Spawn)()
{ {
CBaseToggle::AxisDir(pev); CBaseToggle::AxisDir(pev);
@ -945,7 +898,6 @@ void CMomentaryRotButton::__MAKE_VHOOK(Spawn)()
m_lastUsed = 0; m_lastUsed = 0;
} }
/* <2678f> ../cstrike/dlls/buttons.cpp:958 */
void CMomentaryRotButton::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) void CMomentaryRotButton::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{ {
if (FStrEq(pkvd->szKeyName, "returnspeed")) if (FStrEq(pkvd->szKeyName, "returnspeed"))
@ -962,7 +914,6 @@ void CMomentaryRotButton::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CBaseToggle::KeyValue(pkvd); CBaseToggle::KeyValue(pkvd);
} }
/* <27a57> ../cstrike/dlls/buttons.cpp:974 */
void CMomentaryRotButton::PlaySound() void CMomentaryRotButton::PlaySound()
{ {
EMIT_SOUND(ENT(pev), CHAN_VOICE, (char *)STRING(pev->noise), VOL_NORM, ATTN_NORM); 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 // 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 // will send the target in the wrong direction because the parameter is calculated based on the
// current, not future position. // current, not future position.
/* <27dc0> ../cstrike/dlls/buttons.cpp:982 */
void CMomentaryRotButton::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) 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; 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 #endif
} }
/* <27c49> ../cstrike/dlls/buttons.cpp:990 */
void CMomentaryRotButton::UpdateAllButtons(float value, int start) void CMomentaryRotButton::UpdateAllButtons(float value, int start)
{ {
// Update all rot buttons attached to the same target // 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) void CMomentaryRotButton::UpdateSelf(float value)
{ {
BOOL fplaysound = FALSE; bool fplaysound = false;
if (!m_lastUsed) if (!m_lastUsed)
{ {
fplaysound = TRUE; fplaysound = true;
m_direction = -m_direction; 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 // 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) if (pev->nextthink < pev->ltime)
pev->nextthink = pev->ltime + 0.1; pev->nextthink = pev->ltime + 0.1f;
else else
pev->nextthink += 0.1; pev->nextthink += 0.1f;
pev->avelocity = (m_direction * pev->speed) * pev->movedir; pev->avelocity = (m_direction * pev->speed) * pev->movedir;
SetThink(&CMomentaryRotButton::Off); SetThink(&CMomentaryRotButton::Off);
} }
/* <26550> ../cstrike/dlls/buttons.cpp:1053 */
void CMomentaryRotButton::UpdateTarget(float value) void CMomentaryRotButton::UpdateTarget(float value)
{ {
if (!FStringNull(pev->target)) if (!FStringNull(pev->target))
{ {
edict_t *pentTarget = NULL; 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)) if (FNullEnt(pentTarget))
break; break;
@ -1082,7 +1026,6 @@ void CMomentaryRotButton::UpdateTarget(float value)
} }
} }
/* <25f88> ../cstrike/dlls/buttons.cpp:1072 */
void CMomentaryRotButton::Off() void CMomentaryRotButton::Off()
{ {
pev->avelocity = g_vecZero; pev->avelocity = g_vecZero;
@ -1098,7 +1041,6 @@ void CMomentaryRotButton::Off()
SetThink(NULL); SetThink(NULL);
} }
/* <27d60> ../cstrike/dlls/buttons.cpp:1086 */
void CMomentaryRotButton::Return() void CMomentaryRotButton::Return()
{ {
float value = CBaseToggle::AxisDelta(pev->spawnflags, pev->angles, m_start) / m_flMoveDistance; 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) void CMomentaryRotButton::UpdateSelfReturn(float value)
{ {
if (value <= 0) if (value <= 0)
@ -1125,20 +1066,14 @@ void CMomentaryRotButton::UpdateSelfReturn(float value)
else else
{ {
pev->avelocity = -m_returnSpeed * pev->movedir; 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); IMPLEMENT_SAVERESTORE(CEnvSpark, CBaseEntity);
/* <27e77> ../cstrike/dlls/buttons.cpp:1143 */
LINK_ENTITY_TO_CLASS(env_spark, CEnvSpark); LINK_ENTITY_TO_CLASS(env_spark, CEnvSpark);
/* <27f44> ../cstrike/dlls/buttons.cpp:1144 */
LINK_ENTITY_TO_CLASS(env_debris, CEnvSpark); LINK_ENTITY_TO_CLASS(env_debris, CEnvSpark);
/* <257b7> ../cstrike/dlls/buttons.cpp:1146 */
void CEnvSpark::__MAKE_VHOOK(Spawn)() void CEnvSpark::__MAKE_VHOOK(Spawn)()
{ {
SetThink(NULL); SetThink(NULL);
@ -1162,17 +1097,16 @@ void CEnvSpark::__MAKE_VHOOK(Spawn)()
else else
SetThink(&CEnvSpark::SparkThink); 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(); Precache();
} }
/* <257de> ../cstrike/dlls/buttons.cpp:1173 */
void CEnvSpark::__MAKE_VHOOK(Precache)() void CEnvSpark::__MAKE_VHOOK(Precache)()
{ {
PRECACHE_SOUND("buttons/spark1.wav"); PRECACHE_SOUND("buttons/spark1.wav");
@ -1183,7 +1117,6 @@ void CEnvSpark::__MAKE_VHOOK(Precache)()
PRECACHE_SOUND("buttons/spark6.wav"); PRECACHE_SOUND("buttons/spark6.wav");
} }
/* <26b97> ../cstrike/dlls/buttons.cpp:1183 */
void CEnvSpark::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) void CEnvSpark::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{ {
if (FStrEq(pkvd->szKeyName, "MaxDelay")) if (FStrEq(pkvd->szKeyName, "MaxDelay"))
@ -1202,32 +1135,27 @@ void CEnvSpark::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CBaseEntity::KeyValue(pkvd); CBaseEntity::KeyValue(pkvd);
} }
/* <277d3> ../cstrike/dlls/buttons.cpp:1201 */
void CEnvSpark::SparkThink() 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); DoSpark(pev, pev->origin);
} }
/* <25805> ../cstrike/dlls/buttons.cpp:1207 */
void CEnvSpark::SparkStart(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) void CEnvSpark::SparkStart(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{ {
SetUse(&CEnvSpark::SparkStop); SetUse(&CEnvSpark::SparkStop);
SetThink(&CEnvSpark::SparkThink); 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) void CEnvSpark::SparkStop(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{ {
SetUse(&CEnvSpark::SparkStart); SetUse(&CEnvSpark::SparkStart);
SetThink(NULL); SetThink(NULL);
} }
/* <28011> ../cstrike/dlls/buttons.cpp:1233 */
LINK_ENTITY_TO_CLASS(button_target, CButtonTarget); LINK_ENTITY_TO_CLASS(button_target, CButtonTarget);
/* <258ca> ../cstrike/dlls/buttons.cpp:1235 */
void CButtonTarget::__MAKE_VHOOK(Spawn)() void CButtonTarget::__MAKE_VHOOK(Spawn)()
{ {
pev->movetype = MOVETYPE_PUSH; 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) 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; return;
pev->frame = 1 - pev->frame; pev->frame = 1 - pev->frame;
@ -1258,10 +1185,9 @@ void CButtonTarget::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCal
SUB_UseTargets(pActivator, USE_OFF, 0); SUB_UseTargets(pActivator, USE_OFF, 0);
} }
/* <258f1> ../cstrike/dlls/buttons.cpp:1258 */
int CButtonTarget::__MAKE_VHOOK(ObjectCaps)() 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) if (pev->spawnflags & SF_BTARGET_USE)
return caps | FCAP_IMPULSE_USE; return caps | FCAP_IMPULSE_USE;
@ -1269,7 +1195,6 @@ int CButtonTarget::__MAKE_VHOOK(ObjectCaps)()
return caps; return caps;
} }
/* <2592e> ../cstrike/dlls/buttons.cpp:1269 */
int CButtonTarget::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) int CButtonTarget::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{ {
Use(Instance(pevAttacker), this, USE_TOGGLE, 0); Use(Instance(pevAttacker), this, USE_TOGGLE, 0);

View File

@ -54,7 +54,6 @@
#define SF_BTARGET_USE 0x0001 #define SF_BTARGET_USE 0x0001
#define SF_BTARGET_ON 0x0002 #define SF_BTARGET_ON 0x0002
/* <249a3> ../cstrike/dlls/buttons.cpp:38 */
class CEnvGlobal: public CPointEntity class CEnvGlobal: public CPointEntity
{ {
public: public:
@ -72,18 +71,16 @@ public:
int Restore_(CRestore &restore); int Restore_(CRestore &restore);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL #endif
public: public:
static TYPEDESCRIPTION IMPL(m_SaveData)[3]; static TYPEDESCRIPTION IMPL(m_SaveData)[3];
public:
string_t m_globalstate; string_t m_globalstate;
int m_triggermode; int m_triggermode;
int m_initialstate; int m_initialstate;
}; };
/* <24b67> ../cstrike/dlls/buttons.cpp:800 */
class CRotButton: public CBaseButton class CRotButton: public CBaseButton
{ {
public: public:
@ -93,11 +90,9 @@ public:
void Spawn_(); void Spawn_();
#endif // HOOK_GAMEDLL #endif
}; };
/* <24bba> ../cstrike/dlls/buttons.cpp:873 */
class CMomentaryRotButton: public CBaseToggle class CMomentaryRotButton: public CBaseToggle
{ {
public: public:
@ -126,7 +121,7 @@ public:
int Restore_(CRestore &restore); int Restore_(CRestore &restore);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL #endif
public: public:
void EXPORT Off(); void EXPORT Off();
@ -139,8 +134,6 @@ public:
public: public:
static CMomentaryRotButton *Instance(edict_t *pent) { return (CMomentaryRotButton *)GET_PRIVATE(pent); } static CMomentaryRotButton *Instance(edict_t *pent) { return (CMomentaryRotButton *)GET_PRIVATE(pent); }
public:
static TYPEDESCRIPTION IMPL(m_SaveData)[6]; static TYPEDESCRIPTION IMPL(m_SaveData)[6];
int m_lastUsed; int m_lastUsed;
@ -151,7 +144,6 @@ public:
int m_sounds; int m_sounds;
}; };
/* <24c08> ../cstrike/dlls/buttons.cpp:1117 */
class CEnvSpark: public CBaseEntity class CEnvSpark: public CBaseEntity
{ {
public: public:
@ -169,7 +161,7 @@ public:
int Save_(CSave &save); int Save_(CSave &save);
int Restore_(CRestore &restore); int Restore_(CRestore &restore);
#endif // HOOK_GAMEDLL #endif
public: public:
void EXPORT SparkThink(); void EXPORT SparkThink();
@ -182,7 +174,6 @@ public:
float m_flDelay; float m_flDelay;
}; };
/* <24c24> ../cstrike/dlls/buttons.cpp:1223 */
class CButtonTarget: public CBaseEntity class CButtonTarget: public CBaseEntity
{ {
public: public:
@ -198,7 +189,7 @@ public:
int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType); int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); 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 } { 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) 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); 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_bombPlantedThisRound = false;
pNewTask->m_defuseStartedThisRound = 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) 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); CCareerTask(taskName, event, weaponName, n, mustLive, crossRounds, id, isComplete);
@ -54,7 +52,6 @@ CPreventDefuseTask::CPreventDefuseTask(const char *taskName, GameEventType event
m_defuseStartedThisRound = false; m_defuseStartedThisRound = false;
} }
/* <1ef296> ../cstrike/dlls/career_tasks.cpp:147 */
void CPreventDefuseTask::__MAKE_VHOOK(Reset)() void CPreventDefuseTask::__MAKE_VHOOK(Reset)()
{ {
m_bombPlantedThisRound = false; m_bombPlantedThisRound = false;
@ -63,7 +60,6 @@ void CPreventDefuseTask::__MAKE_VHOOK(Reset)()
CCareerTask::Reset(); CCareerTask::Reset();
} }
/* <1efbf8> ../cstrike/dlls/career_tasks.cpp:156 */
void CPreventDefuseTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer *pAttacker, CBasePlayer *pVictim) void CPreventDefuseTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer *pAttacker, CBasePlayer *pVictim)
{ {
if (IsComplete()) 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 *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); CCareerTask *pTask = new CCareerTask(taskName, event, weaponName, n, mustLive, crossRounds, id, isComplete);
return pTask; 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) CCareerTask::CCareerTask(const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete)
{ {
m_isComplete = 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)() void CCareerTask::__MAKE_VHOOK(Reset)()
{ {
m_eventsSeen = 0; m_eventsSeen = 0;
@ -147,7 +140,6 @@ void CCareerTask::__MAKE_VHOOK(Reset)()
MESSAGE_END(); MESSAGE_END();
} }
/* <1ef74c> ../cstrike/dlls/career_tasks.cpp:256 */
void CCareerTask::SendPartialNotification() void CCareerTask::SendPartialNotification()
{ {
MESSAGE_BEGIN(MSG_ALL, gmsgCZCareer); MESSAGE_BEGIN(MSG_ALL, gmsgCZCareer);
@ -159,18 +151,13 @@ void CCareerTask::SendPartialNotification()
UTIL_LogPrintf("Career Task Partial %d %d\n", m_id, m_eventsSeen); 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) 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; return;
}
if (!pVictim || (m_defuser && !pVictim->m_bIsDefusing) || (m_vip && !pVictim->m_bIsVIP)) if (!pVictim || (m_defuser && !pVictim->m_bIsDefusing) || (m_vip && !pVictim->m_bIsVIP))
{
return; return;
}
if (m_rescuer) if (m_rescuer)
{ {
@ -187,7 +174,7 @@ void CCareerTask::OnWeaponKill(int weaponId, int weaponClassId, bool headshot, b
if (!hostage->IsFollowingSomeone()) if (!hostage->IsFollowingSomeone())
continue; continue;
if (hostage->IsValid() && hostage->m_target == pAttacker) if (hostage->IsValid() && hostage->m_target == pVictim)
++hostages_; ++hostages_;
} }
@ -195,33 +182,30 @@ void CCareerTask::OnWeaponKill(int weaponId, int weaponClassId, bool headshot, b
return; return;
} }
if (m_weaponId == WEAPON_SHIELDGUN) if (m_weaponId == WEAPON_SHIELDGUN)
{ {
if (!killerHasShield) if (!killerHasShield)
return; return;
} }
else if (m_weaponId) else if (m_weaponId)
{ {
if (m_weaponId != weaponId) if (m_weaponId != weaponId)
return; return;
} }
else if (m_weaponClassId) else
{ {
if (m_weaponClassId != weaponClassId) if (!m_weaponClassId || m_weaponClassId != weaponClassId)
return; return;
} }
++m_eventsSeen; ++m_eventsSeen;
SendPartialNotification(); SendPartialNotification();
} }
/* <1efe16> ../cstrike/dlls/career_tasks.cpp:348 */
void CCareerTask::OnWeaponInjury(int weaponId, int weaponClassId, bool attackerHasShield, CBasePlayer *pAttacker) void CCareerTask::OnWeaponInjury(int weaponId, int weaponClassId, bool attackerHasShield, CBasePlayer *pAttacker)
{ {
if (m_isComplete || m_event != EVENT_PLAYER_TOOK_DAMAGE) if (m_isComplete || m_event != EVENT_PLAYER_TOOK_DAMAGE)
{
return; return;
}
if (m_weaponId == WEAPON_SHIELDGUN) if (m_weaponId == WEAPON_SHIELDGUN)
{ {
@ -233,9 +217,9 @@ void CCareerTask::OnWeaponInjury(int weaponId, int weaponClassId, bool attackerH
if (m_weaponId != weaponId) if (m_weaponId != weaponId)
return; return;
} }
else if (m_weaponClassId) else
{ {
if (m_weaponClassId != weaponClassId) if (!m_weaponClassId || m_weaponClassId != weaponClassId)
return; return;
} }
@ -243,7 +227,6 @@ void CCareerTask::OnWeaponInjury(int weaponId, int weaponClassId, bool attackerH
SendPartialNotification(); SendPartialNotification();
} }
/* <1ef79d> ../cstrike/dlls/career_tasks.cpp:385 */
void CCareerTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer *pVictim, CBasePlayer *pAttacker) void CCareerTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer *pVictim, CBasePlayer *pAttacker)
{ {
if (m_isComplete) 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) if ((m_event != EVENT_KILL || (!m_weaponId && !m_weaponClassId))
&& m_event != EVENT_HEADSHOT || (!m_weaponId && !m_weaponClassId) && (m_event != EVENT_HEADSHOT || (!m_weaponId && !m_weaponClassId))
&& m_event != EVENT_PLAYER_TOOK_DAMAGE || (!m_weaponId && !m_weaponClassId)) && (m_event != EVENT_PLAYER_TOOK_DAMAGE || (!m_weaponId && !m_weaponClassId)))
{ {
if (m_event == EVENT_ROUND_WIN) 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")) if (m_event == EVENT_ROUND_WIN && !Q_strcmp(m_name, "winfast"))
{ {
TheCareerTasks->SetFinishedTaskTime((int)TheCareerTasks->GetRoundElapsedTime()); TheCareerTasks->SetFinishedTaskTime(int(TheCareerTasks->GetRoundElapsedTime()));
UTIL_GetLocalPlayer()->SyncRoundTimer(); 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")) if (m_event == EVENT_ROUND_WIN && !Q_strcmp(m_name, "winfast"))
{ {
TheCareerTasks->SetFinishedTaskTime((int)TheCareerTasks->GetRoundElapsedTime()); TheCareerTasks->SetFinishedTaskTime(int(TheCareerTasks->GetRoundElapsedTime()));
UTIL_GetLocalPlayer()->SyncRoundTimer(); 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() void CCareerTaskManager::Create()
{ {
if (TheCareerTasks != NULL) if (TheCareerTasks != NULL)
@ -428,22 +410,18 @@ void CCareerTaskManager::Create()
TheCareerTasks = new CCareerTaskManager; TheCareerTasks = new CCareerTaskManager;
} }
/* <1eff77> ../cstrike/dlls/career_tasks.cpp:636 */
CCareerTaskManager::CCareerTaskManager() CCareerTaskManager::CCareerTaskManager()
{ {
m_taskTime = 0; m_taskTime = 0;
Reset(); Reset();
} }
/* <1effeb> ../cstrike/dlls/career_tasks.cpp:643 */
void CCareerTaskManager::Reset(bool deleteTasks) void CCareerTaskManager::Reset(bool deleteTasks)
{ {
if (deleteTasks) if (deleteTasks)
{ {
for (CareerTaskListIt it = m_tasks.begin(); it != m_tasks.end(); ++it) for (CareerTaskListIt it = m_tasks.begin(); it != m_tasks.end(); ++it)
{
delete (*it); delete (*it);
}
m_tasks.clear(); m_tasks.clear();
m_nextId = 0; m_nextId = 0;
@ -464,16 +442,12 @@ void CCareerTaskManager::Reset(bool deleteTasks)
m_roundStartTime = gpGlobals->time + CVAR_GET_FLOAT("mp_freezetime"); m_roundStartTime = gpGlobals->time + CVAR_GET_FLOAT("mp_freezetime");
} }
/* <1f014e> ../cstrike/dlls/career_tasks.cpp:671 */
void CCareerTaskManager::SetFinishedTaskTime(int val) void CCareerTaskManager::SetFinishedTaskTime(int val)
{ {
CHalfLifeMultiplay *mp = g_pGameRules;
m_finishedTaskTime = val; 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) void CCareerTaskManager::AddTask(const char *taskName, const char *weaponName, int eventCount, bool mustLive, bool crossRounds, bool isComplete)
{ {
++m_nextId; ++m_nextId;
@ -521,7 +495,6 @@ void CCareerTaskManager::AddTask(const char *taskName, const char *weaponName, i
MESSAGE_END(); MESSAGE_END();
} }
/* <1f0381> ../cstrike/dlls/career_tasks.cpp:721 */
void CCareerTaskManager::HandleEvent(GameEventType event, CBasePlayer *pAttacker, CBasePlayer *pVictim) void CCareerTaskManager::HandleEvent(GameEventType event, CBasePlayer *pAttacker, CBasePlayer *pVictim)
{ {
if (event == EVENT_ROUND_START) 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) 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) 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) 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); HandleWeaponKill(AliasToWeaponID(weaponName), AliasToWeaponClass(weaponName), headshot, killerHasShield, pAttacker, pVictim);
HandleEvent(EVENT_KILL, pAttacker, pVictim); HandleEvent(EVENT_KILL, pAttacker, pVictim);
if (headshot) 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) void CCareerTaskManager::HandleWeaponInjury(int weaponId, int weaponClassId, bool attackerHasShield, CBasePlayer *pAttacker)
{ {
for (CareerTaskListIt it = m_tasks.begin(); it != m_tasks.end(); ++it) 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) void CCareerTaskManager::HandleEnemyInjury(const char *weaponName, bool attackerHasShield, CBasePlayer *pAttacker)
{ {
HandleWeaponInjury(AliasToWeaponID(weaponName), AliasToWeaponClass(weaponName), attackerHasShield, pAttacker); HandleWeaponInjury(AliasToWeaponID(weaponName), AliasToWeaponClass(weaponName), attackerHasShield, pAttacker);
HandleEvent(EVENT_PLAYER_TOOK_DAMAGE); HandleEvent(EVENT_PLAYER_TOOK_DAMAGE);
} }
/* <1f094e> ../cstrike/dlls/career_tasks.cpp:784 */
void CCareerTaskManager::HandleDeath(int team, CBasePlayer *pAttacker) void CCareerTaskManager::HandleDeath(int team, CBasePlayer *pAttacker)
{ {
int enemyTeam = (Q_strcmp(humans_join_team.string, "CT") != 0) ? CT : TERRORIST; 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() bool CCareerTaskManager::AreAllTasksComplete()
{ {
for (CareerTaskListIt it = m_tasks.begin(); it != m_tasks.end(); ++it) for (CareerTaskListIt it = m_tasks.begin(); it != m_tasks.end(); ++it)
@ -619,32 +585,28 @@ bool CCareerTaskManager::AreAllTasksComplete()
return true; return true;
} }
/* <1f0abc> ../cstrike/dlls/career_tasks.cpp:818 */
int CCareerTaskManager::GetNumRemainingTasks() int CCareerTaskManager::GetNumRemainingTasks()
{ {
int ret = 0; int ret = 0;
for (CareerTaskListIt it = m_tasks.begin(); it != m_tasks.end(); ++it) for (CareerTaskListIt it = m_tasks.begin(); it != m_tasks.end(); ++it)
{ {
if (!(*it)->IsComplete()) if (!(*it)->IsComplete())
ret++; ++ret;
} }
return ret; return ret;
} }
/* <1f0b33> ../cstrike/dlls/career_tasks.cpp:832 */
float CCareerTaskManager::GetRoundElapsedTime() float CCareerTaskManager::GetRoundElapsedTime()
{ {
return (gpGlobals->time - m_roundStartTime); return (gpGlobals->time - m_roundStartTime);
} }
/* <1f0b56> ../cstrike/dlls/career_tasks.cpp:838 */
void CCareerTaskManager::LatchRoundEndMessage() void CCareerTaskManager::LatchRoundEndMessage()
{ {
m_shouldLatchRoundEndMessage = true; m_shouldLatchRoundEndMessage = true;
} }
/* <1f0b81> ../cstrike/dlls/career_tasks.cpp:844 */
void CCareerTaskManager::UnlatchRoundEndMessage() void CCareerTaskManager::UnlatchRoundEndMessage()
{ {
m_shouldLatchRoundEndMessage = false; m_shouldLatchRoundEndMessage = false;

View File

@ -34,7 +34,6 @@
#include <list> #include <list>
/* <1ef43f> ../cstrike/dlls/career_tasks.cpp:192 */
class CCareerTask class CCareerTask
{ {
public: public:
@ -50,7 +49,7 @@ public:
void OnEvent_(GameEventType event, CBasePlayer *pAttacker, CBasePlayer *pVictim); void OnEvent_(GameEventType event, CBasePlayer *pAttacker, CBasePlayer *pVictim);
void Reset_(); void Reset_();
#endif // HOOK_GAMEDLL #endif
public: public:
static CCareerTask *NewTask(const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete); static CCareerTask *NewTask(const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete);
@ -58,13 +57,13 @@ public:
void OnWeaponKill(int weaponId, int weaponClassId, bool headshot, bool killerHasShield, CBasePlayer *pAttacker, CBasePlayer *pVictim); void OnWeaponKill(int weaponId, int weaponClassId, bool headshot, bool killerHasShield, CBasePlayer *pAttacker, CBasePlayer *pVictim);
void OnWeaponInjury(int weaponId, int weaponClassId, bool attackerHasShield, CBasePlayer *pAttacker); 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; } const char *GetTaskName() { return m_name; }
int GetWeaponId() { return m_weaponId; } int GetWeaponId() { return m_weaponId; }
int GetWeaponClassId() { return m_weaponClassId; } int GetWeaponClassId() { return m_weaponClassId; }
bool IsValidFor(CBasePlayer *pPlayer) { return true; } bool IsValidFor(CBasePlayer *pPlayer) { return true; }
void SendPartialNotification(); void SendPartialNotification();
private: private:
@ -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); 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 class CPreventDefuseTask: public CCareerTask
{ {
public: public:
@ -104,7 +102,7 @@ public:
void OnEvent_(GameEventType event, CBasePlayer *pAttacker, CBasePlayer *pVictim); void OnEvent_(GameEventType event, CBasePlayer *pAttacker, CBasePlayer *pVictim);
void Reset_(); void Reset_();
#endif // HOOK_GAMEDLL #endif
public: public:
static CCareerTask *NewTask(const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete); 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; bool m_defuseStartedThisRound;
}; };
/* <1efed1> ../cstrike/dlls/career_tasks.cpp:636 */
class CCareerTaskManager class CCareerTaskManager
{ {
public: public:

View File

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

View File

@ -32,11 +32,10 @@
#pragma once #pragma once
#endif #endif
#include "saverestore.h"
#include "schedule.h"
#include "monsterevent.h" #include "monsterevent.h"
#include <utlvector.h>
#include "game_shared/perf_counter.h"
#undef CREATE_NAMED_ENTITY #undef CREATE_NAMED_ENTITY
#undef REMOVE_ENTITY #undef REMOVE_ENTITY
@ -182,10 +181,7 @@
#define EXPORT /**/ #define EXPORT /**/
#endif // _WIN32 #endif // _WIN32
enum hash_types_e enum hash_types_e { CLASSNAME };
{
CLASSNAME
};
typedef struct hash_item_s typedef struct hash_item_s
{ {
@ -246,7 +242,7 @@ public:
operator int(); operator int();
operator CBaseEntity*(); operator CBaseEntity*();
operator CBasePlayer*() { return static_cast<CBasePlayer *>(GET_PRIVATE(Get())); } operator CBasePlayer*() { return static_cast<CBasePlayer *>(GET_PRIVATE(Get())); }
CBaseEntity *operator=(CBaseEntity *pEntity); CBaseEntity *operator=(CBaseEntity *pEntity);
CBaseEntity *operator->(); CBaseEntity *operator->();
@ -256,7 +252,6 @@ private:
int m_serialnumber; int m_serialnumber;
}; };
/* <48e9c1> ../cstrike/dlls/cbase.h:166 */
class CBaseEntity class CBaseEntity
{ {
public: public:
@ -360,11 +355,11 @@ public:
BOOL FVisible_(CBaseEntity *pEntity); BOOL FVisible_(CBaseEntity *pEntity);
BOOL FVisible_(const Vector &vecOrigin); BOOL FVisible_(const Vector &vecOrigin);
#endif // HOOK_GAMEDLL #endif
public: public:
void *operator new(size_t stAllocateBlock, entvars_t *pevnew) { return ALLOC_PRIVATE(ENT(pevnew), stAllocateBlock); } 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 UpdateOnRemove();
void EXPORT SUB_Remove(); void EXPORT SUB_Remove();
void EXPORT SUB_DoNothing(); void EXPORT SUB_DoNothing();
@ -447,19 +442,9 @@ public:
bool has_disconnected; 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) inline int FNullEnt(EHANDLE hent) { return (hent == NULL || FNullEnt(OFFSET(hent.Get()))); }
{
return (ent == NULL || FNullEnt(ent->edict()));
}
/* <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 class CPointEntity: public CBaseEntity
{ {
public: public:
@ -470,11 +455,10 @@ public:
void Spawn_(); void Spawn_();
#endif // HOOK_GAMEDLL #endif
}; };
/* <249f0> ../cstrike/dlls/cbase.h:484 */
class CMultiSource: public CPointEntity class CMultiSource: public CPointEntity
{ {
public: public:
@ -495,7 +479,7 @@ public:
int Save_(CSave &save); int Save_(CSave &save);
int Restore_(CRestore &restore); int Restore_(CRestore &restore);
#endif // HOOK_GAMEDLL #endif
public: public:
void EXPORT Register(); void EXPORT Register();
@ -509,7 +493,6 @@ public:
string_t m_globalstate; string_t m_globalstate;
}; };
/* <48ea00> ../cstrike/dlls/cbase.h:509 */
class CBaseDelay: public CBaseEntity class CBaseDelay: public CBaseEntity
{ {
public: public:
@ -523,7 +506,7 @@ public:
int Save_(CSave &save); int Save_(CSave &save);
int Restore_(CRestore &restore); int Restore_(CRestore &restore);
#endif // HOOK_GAMEDLL #endif
public: public:
void SUB_UseTargets(CBaseEntity *pActivator, USE_TYPE useType, float value); void SUB_UseTargets(CBaseEntity *pActivator, USE_TYPE useType, float value);
@ -535,7 +518,6 @@ public:
int m_iszKillTarget; int m_iszKillTarget;
}; };
/* <48ea6f> ../cstrike/dlls/cbase.h:526 */
class CBaseAnimating: public CBaseDelay class CBaseAnimating: public CBaseDelay
{ {
public: public:
@ -548,7 +530,7 @@ public:
int Save_(CSave &save); int Save_(CSave &save);
int Restore_(CRestore &restore); int Restore_(CRestore &restore);
#endif // HOOK_GAMEDLL #endif
public: public:
float StudioFrameAdvance(float flInterval = 0.0f); float StudioFrameAdvance(float flInterval = 0.0f);
@ -561,13 +543,13 @@ public:
float SetBoneController(int iController, float flValue = 0.0f); float SetBoneController(int iController, float flValue = 0.0f);
void InitBoneControllers(); void InitBoneControllers();
NOXREF float SetBlending(int iBlender, float flValue); float SetBlending(int iBlender, float flValue);
NOXREF void GetBonePosition(int iBone, Vector &origin, Vector &angles); void GetBonePosition(int iBone, Vector &origin, Vector &angles);
NOXREF void GetAutomovement(Vector &origin, Vector &angles, float flInterval = 0.1f); void GetAutomovement(Vector &origin, Vector &angles, float flInterval = 0.1f);
NOXREF int FindTransition(int iEndingSequence, int iGoalSequence, int *piDir); int FindTransition(int iEndingSequence, int iGoalSequence, int *piDir);
NOXREF void GetAttachment(int iAttachment, Vector &origin, Vector &angles); void GetAttachment(int iAttachment, Vector &origin, Vector &angles);
NOXREF void SetBodygroup(int iGroup, int iValue); void SetBodygroup(int iGroup, int iValue);
NOXREF int GetBodygroup(int iGroup); int GetBodygroup(int iGroup);
int ExtractBbox(int sequence, float *mins, float *maxs); int ExtractBbox(int sequence, float *mins, float *maxs);
void SetSequenceBox(); void SetSequenceBox();
@ -581,7 +563,6 @@ public:
BOOL m_fSequenceLoops; BOOL m_fSequenceLoops;
}; };
/* <48eb06> ../cstrike/dlls/cbase.h:569 */
class CBaseToggle: public CBaseAnimating class CBaseToggle: public CBaseAnimating
{ {
public: public:
@ -597,14 +578,14 @@ public:
int Save_(CSave &save); int Save_(CSave &save);
int Restore_(CRestore &restore); int Restore_(CRestore &restore);
#endif // HOOK_GAMEDLL #endif
public: public:
void LinearMove(Vector vecDest, float flSpeed); void LinearMove(Vector vecDest, float flSpeed);
void EXPORT LinearMoveDone(); void EXPORT LinearMoveDone();
void AngularMove(Vector vecDestAngle, float flSpeed); void AngularMove(Vector vecDestAngle, float flSpeed);
void EXPORT AngularMoveDone(); void EXPORT AngularMoveDone();
NOXREF BOOL IsLockedByMaster(); BOOL IsLockedByMaster();
public: public:
static float AxisValue(int flags, const Vector &angles); static float AxisValue(int flags, const Vector &angles);
@ -638,8 +619,6 @@ public:
#include "basemonster.h" #include "basemonster.h"
// Generic Button // Generic Button
/* <24b19> ../cstrike/dlls/cbase.h:745 */
class CBaseButton: public CBaseToggle class CBaseButton: public CBaseToggle
{ {
enum BUTTON_CODE enum BUTTON_CODE
@ -675,14 +654,14 @@ public:
int Save_(CSave &save); int Save_(CSave &save);
int Restore_(CRestore &restore); int Restore_(CRestore &restore);
#endif // HOOK_GAMEDLL #endif
public: public:
NOXREF void RotSpawn(); void RotSpawn();
void ButtonActivate(); void ButtonActivate();
NOXREF void SparkSoundCache(); void SparkSoundCache();
NOXREF void EXPORT ButtonShot(); void EXPORT ButtonShot();
void EXPORT ButtonTouch(CBaseEntity *pOther); void EXPORT ButtonTouch(CBaseEntity *pOther);
void EXPORT ButtonSpark(); void EXPORT ButtonSpark();
void EXPORT TriggerAndWait(); void EXPORT TriggerAndWait();
@ -706,7 +685,6 @@ public:
int m_sounds; int m_sounds;
}; };
/* <1da023> ../cstrike/dlls/cbase.h:861 */
class CWorld: public CBaseEntity class CWorld: public CBaseEntity
{ {
public: public:
@ -720,7 +698,7 @@ public:
void Precache_(); void Precache_();
void KeyValue_(KeyValueData *pkvd); 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) #if defined(HOOK_GAMEDLL) && defined(_WIN32) && !defined(REGAMEDLL_UNIT_TESTS)
VirtualTableInit((void *)a, stripClass(typeid(T).name())); VirtualTableInit((void *)a, stripClass(typeid(T).name()));
#endif // _WIN32 && HOOK_GAMEDLL #endif
} }
return a; return a;
} }
#ifdef REGAMEDLL_SELF
extern CUtlVector<hash_item_t> stringsHashTable; 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); int CaseInsensitiveHash(const char *string, int iBounds);
void EmptyEntityHashTable(); void EmptyEntityHashTable();
@ -756,11 +739,6 @@ edict_t *CREATE_NAMED_ENTITY(string_t iClass);
void REMOVE_ENTITY(edict_t *e); void REMOVE_ENTITY(edict_t *e);
void CONSOLE_ECHO_(char *pszMsg, ...); void CONSOLE_ECHO_(char *pszMsg, ...);
void loopPerformance(); 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); int DispatchSpawn(edict_t *pent);
void DispatchKeyValue(edict_t *pentKeyvalue, KeyValueData *pkvd); void DispatchKeyValue(edict_t *pentKeyvalue, KeyValueData *pkvd);
void DispatchTouch(edict_t *pentTouched, edict_t *pentOther); 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; 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 float g_flResetTime;
extern bool g_skipCareerInitialSpawn; extern bool g_skipCareerInitialSpawn;
@ -110,7 +113,7 @@ extern unsigned short g_iShadowSprite;
int CMD_ARGC_(); int CMD_ARGC_();
const char *CMD_ARGV_(int i); 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 TeamChangeUpdate(CBasePlayer *player, int team_id);
void BlinkAccount(CBasePlayer *player, int numBlinks); void BlinkAccount(CBasePlayer *player, int numBlinks);
BOOL ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *szRejectReason); 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 ClientKill(edict_t *pEntity);
void ShowMenu(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText); void ShowMenu(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText);
void ShowVGUIMenu(CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu); void ShowVGUIMenu(CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu);
NOXREF C_DLLEXPORT int CountTeams();
void ListPlayers(CBasePlayer *current); void ListPlayers(CBasePlayer *current);
C_DLLEXPORT int CountTeamPlayers(int iTeam);
void ProcessKickVote(CBasePlayer *pVotingPlayer, CBasePlayer *pKickPlayer); void ProcessKickVote(CBasePlayer *pVotingPlayer, CBasePlayer *pKickPlayer);
TeamName SelectDefaultTeam(); TeamName SelectDefaultTeam();
void CheckStartMoney(); void CheckStartMoney();
@ -146,7 +147,7 @@ void Radio3(CBasePlayer *player, int slot);
bool BuyGunAmmo(CBasePlayer *player, CBasePlayerItem *weapon, bool bBlinkMoney); bool BuyGunAmmo(CBasePlayer *player, CBasePlayerItem *weapon, bool bBlinkMoney);
bool BuyAmmo(CBasePlayer *player, int nSlot, bool bBlinkMoney); bool BuyAmmo(CBasePlayer *player, int nSlot, bool bBlinkMoney);
CBaseEntity *EntityFromUserID(int userID); CBaseEntity *EntityFromUserID(int userID);
NOXREF int CountPlayersInServer(); int CountPlayersInServer();
BOOL HandleBuyAliasCommands(CBasePlayer *pPlayer, const char *pszCommand); BOOL HandleBuyAliasCommands(CBasePlayer *pPlayer, const char *pszCommand);
BOOL HandleRadioAliasCommands(CBasePlayer *pPlayer, const char *pszCommand); BOOL HandleRadioAliasCommands(CBasePlayer *pPlayer, const char *pszCommand);
void ClientCommand(edict_t *pEntity); void ClientCommand(edict_t *pEntity);

View File

@ -1,6 +1,5 @@
#include "precompiled.h" #include "precompiled.h"
/* <5f4cb> ../cstrike/dlls/combat.cpp:52 */
void CGib::LimitVelocity() void CGib::LimitVelocity()
{ {
float length = pev->velocity.Length(); 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) NOXREF void CGib::SpawnStickyGibs(entvars_t *pevVictim, Vector vecOrigin, int cGibs)
{ {
int i; 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) void CGib::SpawnHeadGib(entvars_t *pevVictim)
{ {
CGib *pGib = GetClassPtr((CGib *)NULL); CGib *pGib = GetClassPtr((CGib *)NULL);
@ -112,6 +109,7 @@ void CGib::SpawnHeadGib(entvars_t *pevVictim)
} }
else else
{ {
// TODO: fix test demo
pGib->pev->velocity.z = RANDOM_FLOAT(200, 300); pGib->pev->velocity.z = RANDOM_FLOAT(200, 300);
pGib->pev->velocity.y = RANDOM_FLOAT(-100, 100); pGib->pev->velocity.y = RANDOM_FLOAT(-100, 100);
pGib->pev->velocity.x = RANDOM_FLOAT(-100, 100); pGib->pev->velocity.x = RANDOM_FLOAT(-100, 100);
@ -138,7 +136,6 @@ void CGib::SpawnHeadGib(entvars_t *pevVictim)
pGib->LimitVelocity(); pGib->LimitVelocity();
} }
/* <606c8> ../cstrike/dlls/combat.cpp:190 */
void CGib::SpawnRandomGibs(entvars_t *pevVictim, int cGibs, int human) void CGib::SpawnRandomGibs(entvars_t *pevVictim, int cGibs, int human)
{ {
int cSplat; 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)() BOOL CBaseMonster::__MAKE_VHOOK(HasHumanGibs)()
{ {
int myClass = Classify(); int myClass = Classify();
@ -221,7 +217,6 @@ BOOL CBaseMonster::__MAKE_VHOOK(HasHumanGibs)()
return FALSE; return FALSE;
} }
/* <5f5ca> ../cstrike/dlls/combat.cpp:278 */
BOOL CBaseMonster::__MAKE_VHOOK(HasAlienGibs)() BOOL CBaseMonster::__MAKE_VHOOK(HasAlienGibs)()
{ {
int myClass = Classify(); int myClass = Classify();
@ -236,7 +231,6 @@ BOOL CBaseMonster::__MAKE_VHOOK(HasAlienGibs)()
return FALSE; return FALSE;
} }
/* <5f60a> ../cstrike/dlls/combat.cpp:295 */
void CBaseMonster::__MAKE_VHOOK(FadeMonster)() void CBaseMonster::__MAKE_VHOOK(FadeMonster)()
{ {
StopAnimation(); StopAnimation();
@ -250,11 +244,10 @@ void CBaseMonster::__MAKE_VHOOK(FadeMonster)()
SUB_StartFadeOut(); SUB_StartFadeOut();
} }
/* <60a59> ../cstrike/dlls/combat.cpp:310 */
void CBaseMonster::__MAKE_VHOOK(GibMonster)() void CBaseMonster::__MAKE_VHOOK(GibMonster)()
{ {
TraceResult tr; TraceResult tr;
BOOL gibbed = FALSE; bool gibbed = false;
EMIT_SOUND(ENT(pev), CHAN_WEAPON, "common/bodysplat.wav", VOL_NORM, ATTN_NORM); 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. // throw some human gibs.
CGib::SpawnRandomGibs(pev, 4, 1); CGib::SpawnRandomGibs(pev, 4, 1);
} }
gibbed = TRUE; gibbed = true;
} }
else if (HasAlienGibs()) else if (HasAlienGibs())
{ {
@ -279,7 +272,7 @@ void CBaseMonster::__MAKE_VHOOK(GibMonster)()
// Throw alien gibs // Throw alien gibs
CGib::SpawnRandomGibs(pev, 4, 0); CGib::SpawnRandomGibs(pev, 4, 0);
} }
gibbed = TRUE; gibbed = true;
} }
if (!IsPlayer()) if (!IsPlayer())
@ -297,8 +290,6 @@ void CBaseMonster::__MAKE_VHOOK(GibMonster)()
// GetDeathActivity - determines the best type of death // GetDeathActivity - determines the best type of death
// anim to play. // anim to play.
/* <5f65e> ../cstrike/dlls/combat.cpp:355 */
Activity CBaseMonster::__MAKE_VHOOK(GetDeathActivity)() Activity CBaseMonster::__MAKE_VHOOK(GetDeathActivity)()
{ {
Activity deathActivity; Activity deathActivity;
@ -417,8 +408,6 @@ Activity CBaseMonster::__MAKE_VHOOK(GetDeathActivity)()
// GetSmallFlinchActivity - determines the best type of flinch // GetSmallFlinchActivity - determines the best type of flinch
// anim to play. // anim to play.
/* <5f848> ../cstrike/dlls/combat.cpp:476 */
NOXREF Activity CBaseMonster::GetSmallFlinchActivity() NOXREF Activity CBaseMonster::GetSmallFlinchActivity()
{ {
Activity flinchActivity; Activity flinchActivity;
@ -466,7 +455,6 @@ NOXREF Activity CBaseMonster::GetSmallFlinchActivity()
return flinchActivity; return flinchActivity;
} }
/* <5f8a6> ../cstrike/dlls/combat.cpp:525 */
void CBaseMonster::__MAKE_VHOOK(BecomeDead)() void CBaseMonster::__MAKE_VHOOK(BecomeDead)()
{ {
// don't let autoaim aim at corpses. // don't let autoaim aim at corpses.
@ -482,7 +470,6 @@ void CBaseMonster::__MAKE_VHOOK(BecomeDead)()
pev->movetype = MOVETYPE_TOSS; pev->movetype = MOVETYPE_TOSS;
} }
/* <5f8cc> ../cstrike/dlls/combat.cpp:542 */
BOOL CBaseMonster::ShouldGibMonster(int iGib) BOOL CBaseMonster::ShouldGibMonster(int iGib)
{ {
if ((iGib == GIB_NORMAL && pev->health < GIB_HEALTH_VALUE) || (iGib == GIB_ALWAYS)) if ((iGib == GIB_NORMAL && pev->health < GIB_HEALTH_VALUE) || (iGib == GIB_ALWAYS))
@ -493,7 +480,6 @@ BOOL CBaseMonster::ShouldGibMonster(int iGib)
return FALSE; return FALSE;
} }
/* <5f8f8> ../cstrike/dlls/combat.cpp:551 */
void CBaseMonster::CallGibMonster() void CBaseMonster::CallGibMonster()
{ {
BOOL fade = FALSE; BOOL fade = FALSE;
@ -537,7 +523,6 @@ void CBaseMonster::CallGibMonster()
UTIL_Remove(this); UTIL_Remove(this);
} }
/* <5f938> ../cstrike/dlls/combat.cpp:598 */
void CBaseMonster::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib) void CBaseMonster::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib)
{ {
// unsigned int cCount = 0; // unsigned int cCount = 0;
@ -586,7 +571,6 @@ void CBaseMonster::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib)
m_IdealMonsterState = MONSTERSTATE_DEAD; m_IdealMonsterState = MONSTERSTATE_DEAD;
} }
/* <5e84e> ../cstrike/dlls/combat.cpp:652 */
void CBaseEntity::SUB_StartFadeOut() void CBaseEntity::SUB_StartFadeOut()
{ {
if (pev->rendermode == kRenderNormal) if (pev->rendermode == kRenderNormal)
@ -602,7 +586,6 @@ void CBaseEntity::SUB_StartFadeOut()
SetThink(&CBaseEntity::SUB_FadeOut); SetThink(&CBaseEntity::SUB_FadeOut);
} }
/* <5ea72> ../cstrike/dlls/combat.cpp:667 */
void CBaseEntity::SUB_FadeOut() void CBaseEntity::SUB_FadeOut()
{ {
if (pev->renderamt > 7) if (pev->renderamt > 7)
@ -618,7 +601,6 @@ void CBaseEntity::SUB_FadeOut()
} }
} }
/* <5eab1> ../cstrike/dlls/combat.cpp:688 */
void CGib::WaitTillLand() void CGib::WaitTillLand()
{ {
if (!IsInWorld()) if (!IsInWorld())
@ -639,7 +621,6 @@ void CGib::WaitTillLand()
pev->nextthink = gpGlobals->time + 0.5f; pev->nextthink = gpGlobals->time + 0.5f;
} }
/* <5eee0> ../cstrike/dlls/combat.cpp:718 */
void CGib::BounceGibTouch(CBaseEntity *pOther) void CGib::BounceGibTouch(CBaseEntity *pOther)
{ {
if (pev->flags & FL_ONGROUND) if (pev->flags & FL_ONGROUND)
@ -663,7 +644,7 @@ void CGib::BounceGibTouch(CBaseEntity *pOther)
if (m_material != matNone && !RANDOM_LONG(0, 2)) 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); float volume = 0.8 * Q_min(1.0f, zvel / 450);
CBreakable::MaterialSoundRandom(edict(), (Materials)m_material, volume); 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. // Sticky gib puts blood on the wall and stays put.
/* <5ed6d> ../cstrike/dlls/combat.cpp:761 */
void CGib::StickyGibTouch(CBaseEntity *pOther) void CGib::StickyGibTouch(CBaseEntity *pOther)
{ {
Vector vecSpot; Vector vecSpot;
@ -700,7 +679,6 @@ void CGib::StickyGibTouch(CBaseEntity *pOther)
pev->movetype = MOVETYPE_NONE; pev->movetype = MOVETYPE_NONE;
} }
/* <5fb0b> ../cstrike/dlls/combat.cpp:789 */
void CGib::Spawn(const char *szGibModel) void CGib::Spawn(const char *szGibModel)
{ {
pev->movetype = MOVETYPE_BOUNCE; pev->movetype = MOVETYPE_BOUNCE;
@ -717,11 +695,7 @@ void CGib::Spawn(const char *szGibModel)
/// hopefully this will fix the VELOCITY TOO LOW crap /// hopefully this will fix the VELOCITY TOO LOW crap
pev->solid = SOLID_SLIDEBOX; pev->solid = SOLID_SLIDEBOX;
if (pev->classname)
RemoveEntityHashValue(pev, STRING(pev->classname), CLASSNAME);
MAKE_STRING_CLASS("gib", pev); MAKE_STRING_CLASS("gib", pev);
AddEntityHashValue(pev, STRING(pev->classname), CLASSNAME);
SET_MODEL(ENT(pev), szGibModel); SET_MODEL(ENT(pev), szGibModel);
UTIL_SetSize(pev, Vector(0, 0, 0), Vector(0, 0, 0)); UTIL_SetSize(pev, Vector(0, 0, 0), Vector(0, 0, 0));
@ -738,7 +712,6 @@ void CGib::Spawn(const char *szGibModel)
m_cBloodDecals = 5; m_cBloodDecals = 5;
} }
/* <60aea> ../cstrike/dlls/combat.cpp:815 */
int CBaseMonster::__MAKE_VHOOK(TakeHealth)(float flHealth, int bitsDamageType) int CBaseMonster::__MAKE_VHOOK(TakeHealth)(float flHealth, int bitsDamageType)
{ {
if (pev->takedamage == DAMAGE_NO) 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. // 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. // 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) int CBaseMonster::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{ {
float flTake; float flTake;
@ -801,7 +772,7 @@ int CBaseMonster::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *p
vecDir = NormalizeSubtract< vecDir = NormalizeSubtract<
float_precision, float, float_precision, float_precision float_precision, float, float_precision, float_precision
>(Center(), pInflictor->Center() - Vector(0, 0, 10)); >(Center(), pInflictor->Center() - Vector(0, 0, 10));
#endif // PLAY_GAMEDLL #endif
vecDir = g_vecAttackDir = vecDir.Normalize(); vecDir = g_vecAttackDir = vecDir.Normalize();
} }
} }
@ -853,20 +824,7 @@ int CBaseMonster::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *p
} }
else else
{ {
//m_vecEnemyLKP = pev->origin + (g_vecAttackDir * 64); 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;
} }
MakeIdealYaw(m_vecEnemyLKP); 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. // 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) 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). // 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; return 1;
} }
/* <61120> ../cstrike/dlls/combat.cpp:1027 */
float CBaseMonster::DamageForce(float damage) float CBaseMonster::DamageForce(float damage)
{ {
float_precision force = damage * ((32 * 32 * 72.0) / (pev->size.x * pev->size.y * pev->size.z)) * 5; 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; return force;
} }
/* <61174> ../cstrike/dlls/combat.cpp:1044 */
void RadiusFlash(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType) void RadiusFlash(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType)
{ {
CBaseEntity *pEntity = NULL; 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 GetAmountOfPlayerVisible(Vector vecSrc, CBaseEntity *entity)
{ {
float retval = 0.0f; float retval = 0.0f;
@ -1139,7 +1092,6 @@ float GetAmountOfPlayerVisible(Vector vecSrc, CBaseEntity *entity)
return retval; 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) void RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType)
{ {
CBaseEntity *pEntity = NULL; 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) void RadiusDamage2(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType)
{ {
CBaseEntity *pEntity = NULL; 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) void CBaseMonster::RadiusDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType)
{ {
if (flDamage > 80) if (flDamage > 80)
::RadiusDamage(pev->origin, pevInflictor, pevAttacker, flDamage, flDamage * 3.5, iClassIgnore, bitsDamageType); ::RadiusDamage(pev->origin, pevInflictor, pevAttacker, flDamage, flDamage * 3.5, iClassIgnore, bitsDamageType);
else 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) NOXREF void CBaseMonster::RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType)
{ {
if (flDamage > 80) if (flDamage > 80)
::RadiusDamage(vecSrc, pevInflictor, pevAttacker, flDamage, flDamage * 3.5, iClassIgnore, bitsDamageType); ::RadiusDamage(vecSrc, pevInflictor, pevAttacker, flDamage, flDamage * 3.5, iClassIgnore, bitsDamageType);
else 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 // 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) // other stuff to the victim (punchangle, etc)
// //
// Used for many contact-range melee attacks. Bites, claws, 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) NOXREF CBaseEntity *CBaseMonster::CheckTraceHullAttack(float flDist, int iDamage, int iDmgType)
{ {
TraceResult tr; TraceResult tr;
@ -1333,8 +1280,6 @@ NOXREF CBaseEntity *CBaseMonster::CheckTraceHullAttack(float flDist, int iDamage
// FInViewCone - returns true is the passed ent is in // FInViewCone - returns true is the passed ent is in
// the caller's forward view cone. The dot product is performed // the caller's forward view cone. The dot product is performed
// in 2d, making the view cone infinitely tall. // in 2d, making the view cone infinitely tall.
/* <61ae6> ../cstrike/dlls/combat.cpp:1490 */
BOOL CBaseMonster::__MAKE_VHOOK(FInViewCone)(CBaseEntity *pEntity) BOOL CBaseMonster::__MAKE_VHOOK(FInViewCone)(CBaseEntity *pEntity)
{ {
Vector2D vec2LOS; Vector2D vec2LOS;
@ -1360,8 +1305,6 @@ BOOL CBaseMonster::__MAKE_VHOOK(FInViewCone)(CBaseEntity *pEntity)
// FInViewCone - returns true is the passed vector is in // FInViewCone - returns true is the passed vector is in
// the caller's forward view cone. The dot product is performed // the caller's forward view cone. The dot product is performed
// in 2d, making the view cone infinitely tall. // in 2d, making the view cone infinitely tall.
/* <61be6> ../cstrike/dlls/combat.cpp:1517 */
BOOL CBaseMonster::__MAKE_VHOOK(FInViewCone)(const Vector *pOrigin) BOOL CBaseMonster::__MAKE_VHOOK(FInViewCone)(const Vector *pOrigin)
{ {
Vector2D vec2LOS; Vector2D vec2LOS;
@ -1386,8 +1329,6 @@ BOOL CBaseMonster::__MAKE_VHOOK(FInViewCone)(const Vector *pOrigin)
// FVisible - returns true if a line can be traced from // FVisible - returns true if a line can be traced from
// the caller's eyes to the target // the caller's eyes to the target
/* <5ecb4> ../cstrike/dlls/combat.cpp:1543 */
BOOL CBaseEntity::__MAKE_VHOOK(FVisible)(CBaseEntity *pEntity) BOOL CBaseEntity::__MAKE_VHOOK(FVisible)(CBaseEntity *pEntity)
{ {
TraceResult tr; TraceResult tr;
@ -1421,8 +1362,6 @@ BOOL CBaseEntity::__MAKE_VHOOK(FVisible)(CBaseEntity *pEntity)
// FVisible - returns true if a line can be traced from // FVisible - returns true if a line can be traced from
// the caller's eyes to the target vector // the caller's eyes to the target vector
/* <5e9bb> ../cstrike/dlls/combat.cpp:1576 */
BOOL CBaseEntity::__MAKE_VHOOK(FVisible)(const Vector &vecOrigin) BOOL CBaseEntity::__MAKE_VHOOK(FVisible)(const Vector &vecOrigin)
{ {
TraceResult tr; 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) void CBaseEntity::__MAKE_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
{ {
Vector vecOrigin = ptr->vecEndPos - vecDir * 4; 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) void CBaseMonster::__MAKE_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
{ {
Vector vecOrigin = ptr->vecEndPos - vecDir * 4; 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) 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; static int tracerCount;
@ -1606,7 +1542,7 @@ void CBaseEntity::FireBullets(ULONG cShots, Vector vecSrc, Vector vecDirShooting
break; break;
case BULLET_PLAYER_BUCKSHOT: case BULLET_PLAYER_BUCKSHOT:
flDamage = ((1 - tr.flFraction) * 20); flDamage = ((1 - tr.flFraction) * 20);
pEntity->TraceAttack(pevAttacker, (int)flDamage, vecDir, &tr, DMG_BULLET); pEntity->TraceAttack(pevAttacker, int(flDamage), vecDir, &tr, DMG_BULLET);
break; break;
case BULLET_PLAYER_357: case BULLET_PLAYER_357:
pEntity->TraceAttack(pevAttacker, gSkillData.plrDmg357, vecDir, &tr, DMG_BULLET); 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 // 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); ApplyMultiDamage(pev, pevAttacker);
} }
/* <62693> ../cstrike/dlls/combat.cpp:1856 */
NOXREF char *vstr(float *v) NOXREF char *vstr(float *v)
{ {
static int idx = 0; 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. // 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. // 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) 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; int iOriginalPenetration = iPenetration;
@ -1826,7 +1759,7 @@ Vector CBaseEntity::FireBullets3(Vector vecSrc, Vector vecDirShooting, float vec
iPenetration--; iPenetration--;
flCurrentDistance = tr.flFraction * flDistance; flCurrentDistance = tr.flFraction * flDistance;
iCurrentDamage *= pow(flRangeModifier, flCurrentDistance / 500); iCurrentDamage *= Q_pow(flRangeModifier, flCurrentDistance / 500);
if (flCurrentDistance > flPenetrationDistance) if (flCurrentDistance > flPenetrationDistance)
{ {
@ -1886,7 +1819,6 @@ Vector CBaseEntity::FireBullets3(Vector vecSrc, Vector vecDirShooting, float vec
return Vector(x * vecSpread, y * vecSpread, 0); 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) void CBaseEntity::__MAKE_VHOOK(TraceBleed)(float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
{ {
if (BloodColor() == DONT_BLEED) 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) NOXREF void CBaseMonster::MakeDamageBloodDecal(int cCount, float flNoise, TraceResult *ptr, Vector &vecDir)
{ {
// make blood decal on the wall! // 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); 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()); UTIL_BloodDecalTrace(&Bloodtr, BloodColor());
} }
} }
} }
/* <62f3e> ../cstrike/dlls/combat.cpp:2197 */
void CBaseMonster::BloodSplat(const Vector &vecSrc, const Vector &vecDir, int HitLocation, int iVelocity) void CBaseMonster::BloodSplat(const Vector &vecSrc, const Vector &vecDir, int HitLocation, int iVelocity)
{ {
if (HitLocation != HITGROUP_HEAD) if (HitLocation != HITGROUP_HEAD)

View File

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

View File

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

View File

@ -21,9 +21,8 @@ TYPEDESCRIPTION CMomentaryDoor::m_SaveData[] =
DEFINE_FIELD(CMomentaryDoor, m_bMoveSnd, FIELD_CHARACTER), DEFINE_FIELD(CMomentaryDoor, m_bMoveSnd, FIELD_CHARACTER),
}; };
#endif // HOOK_GAMEDLL #endif
/* <693c0> ../cstrike/dlls/doors.cpp:98 */
IMPLEMENT_SAVERESTORE(CBaseDoor, CBaseToggle); IMPLEMENT_SAVERESTORE(CBaseDoor, CBaseToggle);
// play door or button locked or unlocked sounds. // 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, // if flocked is true, play 'door is locked' sound,
// otherwise play 'door is unlocked' sound // otherwise play 'door is unlocked' sound
// NOTE: this routine is shared by doors and buttons // 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) void PlayLockSounds(entvars_t *pev, locksound_t *pls, int flocked, int fbutton)
{ {
// LOCKED SOUND // 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. // Cache user-entity-field values until spawn is called.
/* <69a4f> ../cstrike/dlls/doors.cpp:201 */
void CBaseDoor::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) void CBaseDoor::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{ {
//skin is used for content type //skin is used for content type
if (FStrEq(pkvd->szKeyName, "skin")) if (FStrEq(pkvd->szKeyName, "skin"))
{ {
pev->skin = (int)Q_atof(pkvd->szValue); pev->skin = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE; pkvd->fHandled = TRUE;
} }
else if (FStrEq(pkvd->szKeyName, "movesnd")) else if (FStrEq(pkvd->szKeyName, "movesnd"))
{ {
m_bMoveSnd = (int)Q_atof(pkvd->szValue); m_bMoveSnd = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE; pkvd->fHandled = TRUE;
} }
else if (FStrEq(pkvd->szKeyName, "stopsnd")) else if (FStrEq(pkvd->szKeyName, "stopsnd"))
{ {
m_bStopSnd = (int)Q_atof(pkvd->szValue); m_bStopSnd = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE; pkvd->fHandled = TRUE;
} }
else if (FStrEq(pkvd->szKeyName, "healthvalue")) else if (FStrEq(pkvd->szKeyName, "healthvalue"))
{ {
m_bHealthValue = (int)Q_atof(pkvd->szValue); m_bHealthValue = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE; pkvd->fHandled = TRUE;
} }
else if (FStrEq(pkvd->szKeyName, "locked_sound")) else if (FStrEq(pkvd->szKeyName, "locked_sound"))
{ {
m_bLockedSound = (int)Q_atof(pkvd->szValue); m_bLockedSound = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE; pkvd->fHandled = TRUE;
} }
else if (FStrEq(pkvd->szKeyName, "locked_sentence")) else if (FStrEq(pkvd->szKeyName, "locked_sentence"))
{ {
m_bLockedSentence = (int)Q_atof(pkvd->szValue); m_bLockedSentence = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE; pkvd->fHandled = TRUE;
} }
else if (FStrEq(pkvd->szKeyName, "unlocked_sound")) else if (FStrEq(pkvd->szKeyName, "unlocked_sound"))
{ {
m_bUnlockedSound = (int)Q_atof(pkvd->szValue); m_bUnlockedSound = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE; pkvd->fHandled = TRUE;
} }
else if (FStrEq(pkvd->szKeyName, "unlocked_sentence")) else if (FStrEq(pkvd->szKeyName, "unlocked_sentence"))
{ {
m_bUnlockedSentence = (int)Q_atof(pkvd->szValue); m_bUnlockedSentence = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE; pkvd->fHandled = TRUE;
} }
else if (FStrEq(pkvd->szKeyName, "WaveHeight")) else if (FStrEq(pkvd->szKeyName, "WaveHeight"))
@ -192,22 +187,17 @@ void CBaseDoor::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
// 2) base // 2) base
// 3) stone chain // 3) stone chain
// 4) screechy metal // 4) screechy metal
/* <69f8b> ../cstrike/dlls/doors.cpp:278 */
LINK_ENTITY_TO_CLASS(func_door, CBaseDoor); LINK_ENTITY_TO_CLASS(func_door, CBaseDoor);
// func_water - same as a door. // func_water - same as a door.
/* <6a058> ../cstrike/dlls/doors.cpp:282 */
LINK_ENTITY_TO_CLASS(func_water, CBaseDoor); LINK_ENTITY_TO_CLASS(func_water, CBaseDoor);
/* <690bc> ../cstrike/dlls/doors.cpp:285 */
void CBaseDoor::__MAKE_VHOOK(Spawn)() void CBaseDoor::__MAKE_VHOOK(Spawn)()
{ {
Precache(); Precache();
SetMovedir(pev); SetMovedir(pev);
//normal door // normal door
if (pev->skin == 0) if (pev->skin == 0)
{ {
if (pev->spawnflags & SF_DOOR_PASSABLE) if (pev->spawnflags & SF_DOOR_PASSABLE)
@ -233,7 +223,7 @@ void CBaseDoor::__MAKE_VHOOK(Spawn)()
m_vecPosition1 = pev->origin; m_vecPosition1 = pev->origin;
// Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big // 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)); assert(("door start/end positions are equal", m_vecPosition1 != m_vecPosition2));
@ -261,7 +251,6 @@ void CBaseDoor::__MAKE_VHOOK(Spawn)()
m_lastBlockedTimestamp = 0; m_lastBlockedTimestamp = 0;
} }
/* <69949> ../cstrike/dlls/doors.cpp:334 */
void CBaseDoor::__MAKE_VHOOK(Restart)() void CBaseDoor::__MAKE_VHOOK(Restart)()
{ {
SetMovedir(pev); SetMovedir(pev);
@ -274,7 +263,6 @@ void CBaseDoor::__MAKE_VHOOK(Restart)()
SetTouch(&CBaseDoor::DoorTouch); SetTouch(&CBaseDoor::DoorTouch);
} }
/* <69289> ../cstrike/dlls/doors.cpp:350 */
void CBaseDoor::__MAKE_VHOOK(SetToggleState)(int state) void CBaseDoor::__MAKE_VHOOK(SetToggleState)(int state)
{ {
if (state == TS_AT_TOP) if (state == TS_AT_TOP)
@ -286,7 +274,6 @@ void CBaseDoor::__MAKE_VHOOK(SetToggleState)(int state)
#define noiseMoving noise1 #define noiseMoving noise1
#define noiseArrived noise2 #define noiseArrived noise2
/* <6924c> ../cstrike/dlls/doors.cpp:359 */
void CBaseDoor::__MAKE_VHOOK(Precache)() void CBaseDoor::__MAKE_VHOOK(Precache)()
{ {
char *pszSound; char *pszSound;
@ -388,14 +375,14 @@ void CBaseDoor::__MAKE_VHOOK(Precache)()
// get door button sounds, for doors which are directly 'touched' to open // get door button sounds, for doors which are directly 'touched' to open
if (m_bLockedSound) if (m_bLockedSound)
{ {
pszSound = ButtonSound((int)m_bLockedSound); pszSound = ButtonSound(int(m_bLockedSound));
PRECACHE_SOUND(pszSound); PRECACHE_SOUND(pszSound);
m_ls.sLockedSound = ALLOC_STRING(pszSound); m_ls.sLockedSound = ALLOC_STRING(pszSound);
} }
if (m_bUnlockedSound) if (m_bUnlockedSound)
{ {
pszSound = ButtonSound((int)m_bUnlockedSound); pszSound = ButtonSound(int(m_bUnlockedSound));
PRECACHE_SOUND(pszSound); PRECACHE_SOUND(pszSound);
m_ls.sUnlockedSound = ALLOC_STRING(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. // 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) void CBaseDoor::DoorTouch(CBaseEntity *pOther)
{ {
entvars_t *pevToucher = pOther->pev; 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. // 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) void CBaseDoor::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{ {
m_hActivator = pActivator; 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. // Causes the door to "do its thing", i.e. start moving, and cascade activation.
/* <6a319> ../cstrike/dlls/doors.cpp:554 */
int CBaseDoor::DoorActivate() int CBaseDoor::DoorActivate()
{ {
if (!UTIL_IsMasterTriggered(m_sMaster, m_hActivator)) 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). // Starts the door going to its "up" position (simply ToggleData->vecPosition2).
/* <6a125> ../cstrike/dlls/doors.cpp:588 */
void CBaseDoor::DoorGoUp() void CBaseDoor::DoorGoUp()
{ {
entvars_t *pevActivator; entvars_t *pevActivator;
@ -571,14 +550,14 @@ void CBaseDoor::DoorGoUp()
{ {
if (toActivator.y < loY) 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; sign = (momentArmY < 0) ? 1 : -1;
else else
sign = (momentArmX > 0) ? 1 : -1; sign = (momentArmX > 0) ? 1 : -1;
} }
else if (toActivator.y > hiY) 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; sign = (momentArmY < 0) ? 1 : -1;
else else
sign = (momentArmX < 0) ? 1 : -1; sign = (momentArmX < 0) ? 1 : -1;
@ -597,14 +576,14 @@ void CBaseDoor::DoorGoUp()
} }
else if (toActivator.y < loY) 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; sign = (momentArmY > 0) ? 1 : -1;
else else
sign = (momentArmX > 0) ? 1 : -1; sign = (momentArmX > 0) ? 1 : -1;
} }
else if (toActivator.y > hiY) 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; sign = (momentArmY > 0) ? 1 : -1;
else else
sign = (momentArmX < 0) ? 1 : -1; 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. // 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() void CBaseDoor::DoorHitTop()
{ {
if (!(pev->spawnflags & SF_DOOR_SILENT)) if (!(pev->spawnflags & SF_DOOR_SILENT))
@ -672,8 +649,6 @@ void CBaseDoor::DoorHitTop()
} }
// Starts the door going to its "down" position (simply ToggleData->vecPosition1). // Starts the door going to its "down" position (simply ToggleData->vecPosition1).
/* <697ad> ../cstrike/dlls/doors.cpp:762 */
void CBaseDoor::DoorGoDown() void CBaseDoor::DoorGoDown()
{ {
bool isReversing = (m_toggle_state == TS_GOING_UP); bool isReversing = (m_toggle_state == TS_GOING_UP);
@ -696,7 +671,7 @@ void CBaseDoor::DoorGoDown()
#ifdef DOOR_ASSERT #ifdef DOOR_ASSERT
assert(m_toggle_state == TS_AT_TOP); assert(m_toggle_state == TS_AT_TOP);
#endif // DOOR_ASSERT #endif
m_toggle_state = TS_GOING_DOWN; m_toggle_state = TS_GOING_DOWN;
@ -712,8 +687,6 @@ void CBaseDoor::DoorGoDown()
} }
// The door has reached the "down" position. Back to quiescence. // The door has reached the "down" position. Back to quiescence.
/* <694a5> ../cstrike/dlls/doors.cpp:791 */
void CBaseDoor::DoorHitBottom() void CBaseDoor::DoorHitBottom()
{ {
if (!(pev->spawnflags & SF_DOOR_SILENT)) 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) void CBaseDoor::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther)
{ {
edict_t *pentTarget = NULL; edict_t *pentTarget = NULL;
@ -868,12 +840,8 @@ void CBaseDoor::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther)
// 2) base // 2) base
// 3) stone chain // 3) stone chain
// 4) screechy metal // 4) screechy metal
/* <6a767> ../cstrike/dlls/doors.cpp:943 */
LINK_ENTITY_TO_CLASS(func_door_rotating, CRotDoor); LINK_ENTITY_TO_CLASS(func_door_rotating, CRotDoor);
/* <698be> ../cstrike/dlls/doors.cpp:946 */
void CRotDoor::__MAKE_VHOOK(Restart)() void CRotDoor::__MAKE_VHOOK(Restart)()
{ {
CBaseToggle::AxisDir(pev); CBaseToggle::AxisDir(pev);
@ -901,7 +869,6 @@ void CRotDoor::__MAKE_VHOOK(Restart)()
DoorGoDown(); DoorGoDown();
} }
/* <69177> ../cstrike/dlls/doors.cpp:978 */
void CRotDoor::__MAKE_VHOOK(Spawn)() void CRotDoor::__MAKE_VHOOK(Spawn)()
{ {
Precache(); Precache();
@ -961,7 +928,6 @@ void CRotDoor::__MAKE_VHOOK(Spawn)()
} }
} }
/* <68fcc> ../cstrike/dlls/doors.cpp:1028 */
void CRotDoor::__MAKE_VHOOK(SetToggleState)(int state) void CRotDoor::__MAKE_VHOOK(SetToggleState)(int state)
{ {
if (state == TS_AT_TOP) if (state == TS_AT_TOP)
@ -972,13 +938,9 @@ void CRotDoor::__MAKE_VHOOK(SetToggleState)(int state)
UTIL_SetOrigin(pev, pev->origin); UTIL_SetOrigin(pev, pev->origin);
} }
/* <6a834> ../cstrike/dlls/doors.cpp:1056 */
LINK_ENTITY_TO_CLASS(momentary_door, CMomentaryDoor); LINK_ENTITY_TO_CLASS(momentary_door, CMomentaryDoor);
/* <69373> ../cstrike/dlls/doors.cpp:1063 */
IMPLEMENT_SAVERESTORE(CMomentaryDoor, CBaseToggle); IMPLEMENT_SAVERESTORE(CMomentaryDoor, CBaseToggle);
/* <69001> ../cstrike/dlls/doors.cpp:1065 */
void CMomentaryDoor::__MAKE_VHOOK(Spawn)() void CMomentaryDoor::__MAKE_VHOOK(Spawn)()
{ {
SetMovedir(pev); SetMovedir(pev);
@ -998,7 +960,7 @@ void CMomentaryDoor::__MAKE_VHOOK(Spawn)()
m_vecPosition1 = pev->origin; m_vecPosition1 = pev->origin;
// Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big // 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)); assert(("door start/end positions are equal", m_vecPosition1 != m_vecPosition2));
if (pev->spawnflags & SF_DOOR_START_OPEN) if (pev->spawnflags & SF_DOOR_START_OPEN)
@ -1014,7 +976,6 @@ void CMomentaryDoor::__MAKE_VHOOK(Spawn)()
Precache(); Precache();
} }
/* <68fa5> ../cstrike/dlls/doors.cpp:1096 */
void CMomentaryDoor::__MAKE_VHOOK(Precache)() void CMomentaryDoor::__MAKE_VHOOK(Precache)()
{ {
// set the door's "in-motion" sound // 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) void CMomentaryDoor::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{ {
if (FStrEq(pkvd->szKeyName, "movesnd")) if (FStrEq(pkvd->szKeyName, "movesnd"))
{ {
m_bMoveSnd = (int)Q_atof(pkvd->szValue); m_bMoveSnd = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE; pkvd->fHandled = TRUE;
} }
else if (FStrEq(pkvd->szKeyName, "stopsnd")) else if (FStrEq(pkvd->szKeyName, "stopsnd"))
{ {
//m_bStopSnd =(int) Q_atof(pkvd->szValue); //m_bStopSnd = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE; pkvd->fHandled = TRUE;
} }
else if (FStrEq(pkvd->szKeyName, "healthvalue")) else if (FStrEq(pkvd->szKeyName, "healthvalue"))
{ {
//m_bHealthValue = (int)Q_atof(pkvd->szValue); //m_bHealthValue = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE; pkvd->fHandled = TRUE;
} }
else else
CBaseToggle::KeyValue(pkvd); CBaseToggle::KeyValue(pkvd);
} }
/* <6953e> ../cstrike/dlls/doors.cpp:1165 */
void CMomentaryDoor::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) void CMomentaryDoor::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{ {
// Momentary buttons will pass down a float in here // 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_NOMONSTERS 512 // Monster can't open
#define SF_DOOR_SILENT 0x80000000 #define SF_DOOR_SILENT 0x80000000
/* <6840f> ../cstrike/dlls/doors.cpp:34 */
class CBaseDoor: public CBaseToggle class CBaseDoor: public CBaseToggle
{ {
public: public:
@ -81,7 +80,7 @@ public:
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
void Blocked_(CBaseEntity *pOther); void Blocked_(CBaseEntity *pOther);
#endif // HOOK_GAMEDLL #endif
public: public:
static TYPEDESCRIPTION IMPL(m_SaveData)[7]; static TYPEDESCRIPTION IMPL(m_SaveData)[7];
@ -110,7 +109,6 @@ public:
float m_lastBlockedTimestamp; float m_lastBlockedTimestamp;
}; };
/* <684c0> ../cstrike/dlls/doors.cpp:935 */
class CRotDoor: public CBaseDoor class CRotDoor: public CBaseDoor
{ {
public: public:
@ -124,11 +122,10 @@ public:
void Restart_(); void Restart_();
void SetToggleState_(int state); void SetToggleState_(int state);
#endif // HOOK_GAMEDLL #endif
}; };
/* <68513> ../cstrike/dlls/doors.cpp:1039 */
class CMomentaryDoor: public CBaseToggle class CMomentaryDoor: public CBaseToggle
{ {
public: public:
@ -149,7 +146,7 @@ public:
int Restore_(CRestore &restore); int Restore_(CRestore &restore);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL #endif
public: public:
static TYPEDESCRIPTION IMPL(m_SaveData)[1]; static TYPEDESCRIPTION IMPL(m_SaveData)[1];

View File

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

View File

@ -68,7 +68,6 @@
#define SF_MESSAGE_ONCE 0x0001 // Fade in, not out #define SF_MESSAGE_ONCE 0x0001 // Fade in, not out
#define SF_MESSAGE_ALL 0x0002 // Send to all clients #define SF_MESSAGE_ALL 0x0002 // Send to all clients
/* <7249d> ../cstrike/dlls/effects.h:33 */
class CSprite: public CPointEntity class CSprite: public CPointEntity
{ {
public: public:
@ -96,14 +95,14 @@ public:
int Restore_(CRestore &restore); int Restore_(CRestore &restore);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL #endif
public: public:
void EXPORT AnimateThink(); void EXPORT AnimateThink();
void EXPORT ExpandThink(); void EXPORT ExpandThink();
void Animate(float frames); 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 SpriteInit(const char *pSpriteName, const Vector &origin);
void SetAttachment(edict_t *pEntity, int attachment) void SetAttachment(edict_t *pEntity, int attachment)
@ -131,10 +130,10 @@ public:
pev->renderfx = fx; pev->renderfx = fx;
} }
void SetTexture(int spriteIndex) { pev->modelindex = spriteIndex; } void SetTexture(int spriteIndex) { pev->modelindex = spriteIndex; }
void SetScale(float scale) { pev->scale = scale; } void SetScale(float scale) { pev->scale = scale; }
void SetColor(int r, int g, int b) { pev->rendercolor.x = r; pev->rendercolor.y = g; pev->rendercolor.z = b; } 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 AnimateAndDie(float_precision framerate) void AnimateAndDie(float_precision framerate)
{ {
@ -154,7 +153,6 @@ private:
float m_maxFrame; float m_maxFrame;
}; };
/* <723cb> ../cstrike/dlls/effects.h:105 */
class CBeam: public CBaseEntity class CBeam: public CBaseEntity
{ {
public: public:
@ -175,42 +173,42 @@ public:
void Spawn_(); void Spawn_();
void Precache_(); void Precache_();
#endif // HOOK_GAMEDLL #endif
public: public:
void EXPORT TriggerTouch(CBaseEntity *pOther); void EXPORT TriggerTouch(CBaseEntity *pOther);
void SetType(int type) { pev->rendermode = (pev->rendermode & 0xF0) | (type & 0x0F); } void SetType(int type) { pev->rendermode = (pev->rendermode & 0xF0) | (type & 0x0F); }
void SetFlags(int flags) { pev->rendermode = (pev->rendermode & 0x0F) | (flags & 0xF0); } void SetFlags(int flags) { pev->rendermode = (pev->rendermode & 0x0F) | (flags & 0xF0); }
void SetStartPos(const Vector &pos) { pev->origin = pos; } void SetStartPos(const Vector &pos) { pev->origin = pos; }
void SetEndPos(const Vector &pos) { pev->angles = pos; } void SetEndPos(const Vector &pos) { pev->angles = pos; }
void SetStartEntity(int entityIndex); void SetStartEntity(int entityIndex);
void SetEndEntity(int entityIndex); void SetEndEntity(int entityIndex);
void SetStartAttachment(int attachment) { pev->sequence = (pev->sequence & 0x0FFF) | ((attachment & 0xF) << 12); } void SetStartAttachment(int attachment) { pev->sequence = (pev->sequence & 0x0FFF) | ((attachment & 0xF) << 12); }
void SetEndAttachment(int attachment) { pev->skin = (pev->skin & 0x0FFF) | ((attachment & 0xF) << 12); } void SetEndAttachment(int attachment) { pev->skin = (pev->skin & 0x0FFF) | ((attachment & 0xF) << 12); }
void SetTexture(int spriteIndex) { pev->modelindex = spriteIndex; } void SetTexture(int spriteIndex) { pev->modelindex = spriteIndex; }
void SetWidth(int width) { pev->scale = width; } void SetWidth(int width) { pev->scale = width; }
void SetNoise(int amplitude) { pev->body = amplitude; } 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 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 SetFrame(float frame) { pev->frame = frame; }
void SetScrollRate(int speed) { pev->animtime = speed; } void SetScrollRate(int speed) { pev->animtime = speed; }
int GetType() const { return pev->rendermode & 0x0F; } int GetType() const { return pev->rendermode & 0x0F; }
int GetFlags() const { return pev->rendermode & 0xF0; } int GetFlags() const { return pev->rendermode & 0xF0; }
int GetStartEntity() const { return pev->sequence & 0xFFF; } int GetStartEntity() const { return pev->sequence & 0xFFF; }
int GetEndEntity() const { return pev->skin & 0xFFF; } int GetEndEntity() const { return pev->skin & 0xFFF; }
const Vector &GetStartPos(); const Vector &GetStartPos();
const Vector &GetEndPos(); const Vector &GetEndPos();
int GetTexture() const { return pev->modelindex; } int GetTexture() const { return pev->modelindex; }
int GetWidth() const { return pev->scale; } int GetWidth() const { return pev->scale; }
int GetNoise() const { return pev->body; } int GetNoise() const { return pev->body; }
int GetBrightness() const { return pev->renderamt; } int GetBrightness() const { return pev->renderamt; }
int GetFrame() const { return pev->frame; } int GetFrame() const { return pev->frame; }
int GetScrollRate() const { return pev->animtime; } int GetScrollRate() const { return pev->animtime; }
void RelinkBeam(); void RelinkBeam();
void DoSparks(const Vector &start, const Vector &end); void DoSparks(const Vector &start, const Vector &end);
@ -237,7 +235,6 @@ public:
} }
}; };
/* <72402> ../cstrike/dlls/effects.h:188 */
class CLaser: public CBeam class CLaser: public CBeam
{ {
public: public:
@ -257,7 +254,7 @@ public:
int Restore_(CRestore &restore); int Restore_(CRestore &restore);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL #endif
public: public:
void TurnOn(); void TurnOn();
@ -275,7 +272,6 @@ public:
Vector m_firePosition; Vector m_firePosition;
}; };
/* <7237e> ../cstrike/dlls/effects.cpp:36 */
class CBubbling: public CBaseEntity class CBubbling: public CBaseEntity
{ {
public: public:
@ -296,7 +292,7 @@ public:
int Restore_(CRestore &restore); int Restore_(CRestore &restore);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL #endif
public: public:
void EXPORT FizzThink(); void EXPORT FizzThink();
@ -310,7 +306,6 @@ public:
int m_state; int m_state;
}; };
/* <723e6> ../cstrike/dlls/effects.cpp:357 */
class CLightning: public CBeam class CLightning: public CBeam
{ {
public: public:
@ -330,7 +325,7 @@ public:
int Restore_(CRestore &restore); int Restore_(CRestore &restore);
void Activate_(); void Activate_();
#endif // HOOK_GAMEDLL #endif
public: public:
void EXPORT StrikeThink(); void EXPORT StrikeThink();
@ -368,7 +363,6 @@ public:
float m_radius; float m_radius;
}; };
/* <7244f> ../cstrike/dlls/effects.cpp:1085 */
class CGlow: public CPointEntity class CGlow: public CPointEntity
{ {
public: public:
@ -384,7 +378,7 @@ public:
int Restore_(CRestore &restore); int Restore_(CRestore &restore);
void Think_(); void Think_();
#endif // HOOK_GAMEDLL #endif
void Animate(float frames); void Animate(float frames);
@ -395,7 +389,6 @@ public:
float m_maxFrame; float m_maxFrame;
}; };
/* <724b8> ../cstrike/dlls/effects.cpp:1146 */
class CBombGlow: public CSprite class CBombGlow: public CSprite
{ {
public: public:
@ -407,7 +400,7 @@ public:
void Spawn_(); void Spawn_();
void Think_(); void Think_();
#endif // HOOK_GAMEDLL #endif
public: public:
float m_lastTime; float m_lastTime;
@ -415,7 +408,6 @@ public:
bool m_bSetModel; bool m_bSetModel;
}; };
/* <72581> ../cstrike/dlls/effects.cpp:1413 */
class CGibShooter: public CBaseDelay class CGibShooter: public CBaseDelay
{ {
public: public:
@ -437,7 +429,7 @@ public:
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
CGib *CreateGib_(); CGib *CreateGib_();
#endif // HOOK_GAMEDLL #endif
public: public:
void EXPORT ShootThink(); void EXPORT ShootThink();
@ -455,7 +447,6 @@ public:
float m_flGibLife; float m_flGibLife;
}; };
/* <725ef> ../cstrike/dlls/effects.cpp:1592 */
class CEnvShooter: public CGibShooter class CEnvShooter: public CGibShooter
{ {
public: public:
@ -469,13 +460,12 @@ public:
void KeyValue_(KeyValueData *pkvd); void KeyValue_(KeyValueData *pkvd);
CGib *CreateGib_(); CGib *CreateGib_();
#endif // HOOK_GAMEDLL #endif
}; };
#define MAX_BEAM 24 #define MAX_BEAM 24
/* <7263d> ../cstrike/dlls/effects.cpp:1679 */
class CTestEffect: public CBaseDelay class CTestEffect: public CBaseDelay
{ {
public: public:
@ -489,7 +479,7 @@ public:
void Precache_(); void Precache_();
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL #endif
public: public:
void EXPORT TestThink(); void EXPORT TestThink();
@ -504,7 +494,6 @@ public:
float m_flStartTime; float m_flStartTime;
}; };
/* <72690> ../cstrike/dlls/effects.cpp:1769 */
class CBlood: public CPointEntity class CBlood: public CPointEntity
{ {
public: public:
@ -518,21 +507,20 @@ public:
void KeyValue_(KeyValueData *pkvd); void KeyValue_(KeyValueData *pkvd);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL #endif
public: public:
int Color() const { return pev->impulse; } int Color() const { return pev->impulse; }
float BloodAmount() const { return pev->dmg; } float BloodAmount() const { return pev->dmg; }
void SetColor(int color) { pev->impulse = color; } void SetColor(int color) { pev->impulse = color; }
void SetBloodAmount(float amount) { pev->dmg = amount; } void SetBloodAmount(float amount) { pev->dmg = amount; }
public: public:
Vector Direction(); Vector Direction();
Vector BloodPosition(CBaseEntity *pActivator); Vector BloodPosition(CBaseEntity *pActivator);
}; };
/* <726de> ../cstrike/dlls/effects.cpp:1886 */
class CShake: public CPointEntity class CShake: public CPointEntity
{ {
public: public:
@ -546,21 +534,20 @@ public:
void KeyValue_(KeyValueData *pkvd); void KeyValue_(KeyValueData *pkvd);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL #endif
public: public:
float Amplitude() const { return pev->scale; } float Amplitude() const { return pev->scale; }
float Frequency() const { return pev->dmg_save; } float Frequency() const { return pev->dmg_save; }
float Duration() const { return pev->dmg_take; } float Duration() const { return pev->dmg_take; }
float Radius() const { return pev->dmg; } float Radius() const { return pev->dmg; }
void SetAmplitude(float amplitude) { pev->scale = amplitude; } void SetAmplitude(float amplitude) { pev->scale = amplitude; }
void SetFrequency(float frequency) { pev->dmg_save = frequency; } void SetFrequency(float frequency) { pev->dmg_save = frequency; }
void SetDuration(float duration) { pev->dmg_take = duration; } void SetDuration(float duration) { pev->dmg_take = duration; }
void SetRadius(float radius) { pev->dmg = radius; } void SetRadius(float radius) { pev->dmg = radius; }
}; };
/* <7272c> ../cstrike/dlls/effects.cpp:1964 */
class CFade: public CPointEntity class CFade: public CPointEntity
{ {
public: public:
@ -574,17 +561,16 @@ public:
void KeyValue_(KeyValueData *pkvd); void KeyValue_(KeyValueData *pkvd);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL #endif
public: public:
float Duration() const { return pev->dmg_take; } float Duration() const { return pev->dmg_take; }
float HoldTime() const { return pev->dmg_save; } float HoldTime() const { return pev->dmg_save; }
void SetDuration(float duration) { pev->dmg_take = duration; } void SetDuration(float duration) { pev->dmg_take = duration; }
void SetHoldTime(float hold) { pev->dmg_save = hold; } void SetHoldTime(float hold) { pev->dmg_save = hold; }
}; };
/* <7277a> ../cstrike/dlls/effects.cpp:2038 */
class CMessage: public CPointEntity class CMessage: public CPointEntity
{ {
public: public:
@ -600,11 +586,10 @@ public:
void KeyValue_(KeyValueData *pkvd); void KeyValue_(KeyValueData *pkvd);
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); 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 class CEnvFunnel: public CBaseDelay
{ {
public: public:
@ -618,13 +603,12 @@ public:
void Precache_(); void Precache_();
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL #endif
public: public:
int m_iSprite; int m_iSprite;
}; };
/* <7281b> ../cstrike/dlls/effects.cpp:2199 */
class CEnvBeverage: public CBaseDelay class CEnvBeverage: public CBaseDelay
{ {
public: public:
@ -638,11 +622,10 @@ public:
void Precache_(); void Precache_();
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); 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 class CItemSoda: public CBaseEntity
{ {
public: public:
@ -654,7 +637,7 @@ public:
void Spawn_(); void Spawn_();
void Precache_(); void Precache_();
#endif // HOOK_GAMEDLL #endif
public: public:
void EXPORT CanThink(); void EXPORT CanThink();

View File

@ -93,13 +93,11 @@ extern enginefuncs_t g_engfuncs;
#define GET_TIMES_TUTOR_MESSAGE_SHOWN (*g_engfuncs.pfnGetTimesTutorMessageShown) #define GET_TIMES_TUTOR_MESSAGE_SHOWN (*g_engfuncs.pfnGetTimesTutorMessageShown)
#define ENG_CHECK_PARM (*g_engfuncs.pfnEngCheckParm) #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) 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); (*g_engfuncs.pfnMessageBegin)(msg_dest,msg_type,pOrigin,ed);
} }
/* <464e> ../cstrike/dlls/enginecallback.h:97 */
inline void *GET_PRIVATE(edict_t *pent) inline void *GET_PRIVATE(edict_t *pent)
{ {
if (pent) if (pent)
@ -185,4 +183,4 @@ inline void *GET_PRIVATE(edict_t *pent)
#define ENGINE_FORCE_UNMODIFIED (*g_engfuncs.pfnForceUnmodified) #define ENGINE_FORCE_UNMODIFIED (*g_engfuncs.pfnForceUnmodified)
#define PLAYER_CNX_STATS (*g_engfuncs.pfnGetPlayerStats) #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), DEFINE_FIELD(CEnvExplosion, m_spriteScale, FIELD_INTEGER),
}; };
#endif // HOOK_GAMEDLL #endif
/* <7f660> ../cstrike/dlls/explode.cpp:37 */
LINK_ENTITY_TO_CLASS(spark_shower, CShower); LINK_ENTITY_TO_CLASS(spark_shower, CShower);
/* <7f49c> ../cstrike/dlls/explode.cpp:39 */
void CShower::__MAKE_VHOOK(Spawn)() void CShower::__MAKE_VHOOK(Spawn)()
{ {
pev->velocity = RANDOM_FLOAT(200, 300) * pev->angles; pev->velocity = RANDOM_FLOAT(200, 300) * pev->angles;
@ -42,7 +40,6 @@ void CShower::__MAKE_VHOOK(Spawn)()
pev->angles = g_vecZero; pev->angles = g_vecZero;
} }
/* <7f475> ../cstrike/dlls/explode.cpp:61 */
void CShower::__MAKE_VHOOK(Think)() void CShower::__MAKE_VHOOK(Think)()
{ {
UTIL_Sparks(pev->origin); UTIL_Sparks(pev->origin);
@ -57,7 +54,6 @@ void CShower::__MAKE_VHOOK(Think)()
pev->flags &= ~FL_ONGROUND; pev->flags &= ~FL_ONGROUND;
} }
/* <7f122> ../cstrike/dlls/explode.cpp:73 */
void CShower::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) void CShower::__MAKE_VHOOK(Touch)(CBaseEntity *pOther)
{ {
if (pev->flags & FL_ONGROUND) 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); IMPLEMENT_SAVERESTORE(CEnvExplosion, CBaseMonster);
/* <7f72a> ../cstrike/dlls/explode.cpp:107 */
LINK_ENTITY_TO_CLASS(env_explosion, CEnvExplosion); LINK_ENTITY_TO_CLASS(env_explosion, CEnvExplosion);
/* <7f5b2> ../cstrike/dlls/explode.cpp:109 */
void CEnvExplosion::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) void CEnvExplosion::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{ {
if (FStrEq(pkvd->szKeyName, "iMagnitude")) if (FStrEq(pkvd->szKeyName, "iMagnitude"))
@ -89,7 +81,6 @@ void CEnvExplosion::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
CBaseEntity::KeyValue(pkvd); CBaseEntity::KeyValue(pkvd);
} }
/* <7f1a5> ../cstrike/dlls/explode.cpp:120 */
void CEnvExplosion::__MAKE_VHOOK(Spawn)() void CEnvExplosion::__MAKE_VHOOK(Spawn)()
{ {
pev->solid = SOLID_NOT; pev->solid = SOLID_NOT;
@ -103,16 +94,15 @@ void CEnvExplosion::__MAKE_VHOOK(Spawn)()
flSpriteScale = 10.0f; 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) void CEnvExplosion::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{ {
TraceResult tr; TraceResult tr;
pev->model = iStringNull;//invisible pev->model = iStringNull;// invisible
pev->solid = SOLID_NOT;//intangible pev->solid = SOLID_NOT;// intangible
Vector vecSpot;// trace starts here! 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); pev->origin = tr.vecEndPos + (tr.vecPlaneNormal * (m_iMagnitude - 24) * 0.6f);
} }
else
{
pev->origin = pev->origin;
}
// draw decal // draw decal
if (! (pev->spawnflags & SF_ENVEXPLOSION_NODECAL)) 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); 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.y);
WRITE_COORD(pev->origin.z); WRITE_COORD(pev->origin.z);
WRITE_SHORT(g_sModelIndexFireball); WRITE_SHORT(g_sModelIndexFireball);
WRITE_BYTE((byte)m_spriteScale); // scale * 10 WRITE_BYTE(byte(m_spriteScale)); // scale * 10
WRITE_BYTE(15); // framerate WRITE_BYTE(15); // framerate
WRITE_BYTE(TE_EXPLFLAG_NONE); WRITE_BYTE(TE_EXPLFLAG_NONE);
MESSAGE_END(); MESSAGE_END();
@ -192,7 +178,6 @@ void CEnvExplosion::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCal
} }
} }
/* <7f1e1> ../cstrike/dlls/explode.cpp:235 */
void CEnvExplosion::Smoke() void CEnvExplosion::Smoke()
{ {
if (!(pev->spawnflags & SF_ENVEXPLOSION_NOSMOKE)) if (!(pev->spawnflags & SF_ENVEXPLOSION_NOSMOKE))
@ -203,7 +188,7 @@ void CEnvExplosion::Smoke()
WRITE_COORD(pev->origin.y); WRITE_COORD(pev->origin.y);
WRITE_COORD(pev->origin.z); WRITE_COORD(pev->origin.z);
WRITE_SHORT(g_sModelIndexSmoke); WRITE_SHORT(g_sModelIndexSmoke);
WRITE_BYTE((byte)m_spriteScale); // scale * 10 WRITE_BYTE(byte(m_spriteScale)); // scale * 10
WRITE_BYTE(12); // framerate WRITE_BYTE(12); // framerate
MESSAGE_END(); MESSAGE_END();
} }
@ -215,8 +200,6 @@ void CEnvExplosion::Smoke()
} }
// HACKHACK -- create one of these and fake a keyvalue to get the right explosion setup // 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) void ExplosionCreate(const Vector &center, Vector &angles, edict_t *pOwner, int magnitude, BOOL doDamage)
{ {
KeyValueData kvd; KeyValueData kvd;

View File

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

View File

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

View File

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

View File

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

View File

@ -48,7 +48,6 @@ enum TANKBULLET
TANK_BULLET_12MM, // explosion? TANK_BULLET_12MM, // explosion?
}; };
/* <8c75e> ../cstrike/dlls/func_tank.cpp:46 */
class CFuncTank: public CBaseEntity class CFuncTank: public CBaseEntity
{ {
public: public:
@ -78,7 +77,7 @@ public:
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
void Fire_(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker); void Fire_(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker);
#endif // HOOK_GAMEDLL #endif
public: public:
void TrackTarget(); void TrackTarget();
@ -157,7 +156,6 @@ protected:
int m_iszMaster; // Master entity (game_team_master or multisource) int m_iszMaster; // Master entity (game_team_master or multisource)
}; };
/* <8c79a> ../cstrike/dlls/func_tank.cpp:719 */
class CFuncTankGun: public CFuncTank class CFuncTankGun: public CFuncTank
{ {
public: public:
@ -167,11 +165,10 @@ public:
void Fire_(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker); 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 class CFuncTankLaser: public CFuncTank
{ {
public: public:
@ -191,7 +188,7 @@ public:
void Think_(); void Think_();
void Fire_(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker); void Fire_(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker);
#endif // HOOK_GAMEDLL #endif
CLaser *GetLaser(); CLaser *GetLaser();
@ -203,7 +200,6 @@ private:
float m_laserTime; float m_laserTime;
}; };
/* <8c836> ../cstrike/dlls/func_tank.cpp:887 */
class CFuncTankRocket: public CFuncTank class CFuncTankRocket: public CFuncTank
{ {
public: public:
@ -215,11 +211,10 @@ public:
void Precache_(); void Precache_();
void Fire_(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker); 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 class CFuncTankMortar: public CFuncTank
{ {
public: public:
@ -231,11 +226,10 @@ public:
void KeyValue_(KeyValueData *pkvd); void KeyValue_(KeyValueData *pkvd);
void Fire_(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker); 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 class CFuncTankControls: public CBaseEntity
{ {
public: public:
@ -254,7 +248,7 @@ public:
void Think_(); void Think_();
void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#endif // HOOK_GAMEDLL #endif
public: public:
static TYPEDESCRIPTION IMPL(m_SaveData)[1]; 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); 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() void EXT_FUNC GameDLLInit()
{ {
g_bIsCzeroGame = UTIL_IsGame("czero");
g_psv_gravity = CVAR_GET_POINTER("sv_gravity"); g_psv_gravity = CVAR_GET_POINTER("sv_gravity");
g_psv_aim = CVAR_GET_POINTER("sv_aim"); g_psv_aim = CVAR_GET_POINTER("sv_aim");
g_footsteps = CVAR_GET_POINTER("mp_footsteps"); g_footsteps = CVAR_GET_POINTER("mp_footsteps");
@ -163,6 +160,7 @@ void EXT_FUNC GameDLLInit()
// Remove unused cvars // Remove unused cvars
#ifndef REGAMEDLL_FIXES #ifndef REGAMEDLL_FIXES
CVAR_REGISTER(&sk_plr_9mm_bullet1); CVAR_REGISTER(&sk_plr_9mm_bullet1);
CVAR_REGISTER(&sk_plr_9mm_bullet2); CVAR_REGISTER(&sk_plr_9mm_bullet2);
CVAR_REGISTER(&sk_plr_9mm_bullet3); CVAR_REGISTER(&sk_plr_9mm_bullet3);
@ -205,6 +203,7 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&sk_scientist_heal1); CVAR_REGISTER(&sk_scientist_heal1);
CVAR_REGISTER(&sk_scientist_heal2); CVAR_REGISTER(&sk_scientist_heal2);
CVAR_REGISTER(&sk_scientist_heal3); CVAR_REGISTER(&sk_scientist_heal3);
#endif // REGAMEDLL_FIXES #endif // REGAMEDLL_FIXES
#ifdef REGAMEDLL_ADD #ifdef REGAMEDLL_ADD

View File

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

View File

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

View File

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

View File

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

View File

@ -6,15 +6,17 @@
#ifndef HOOK_GAMEDLL #ifndef HOOK_GAMEDLL
const Vector g_vecZero = Vector(0, 0, 0); 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; int g_Language;
u_long g_ulModelIndexEyes; NOXREF u_long g_ulModelIndexEyes;
Vector g_vecAttackDir; Vector g_vecAttackDir;
int g_iSkillLevel; int g_iSkillLevel;
int gDisplayTitle; int gDisplayTitle;
BOOL g_fGameOver; BOOL g_fGameOver;
bool g_bIsCzeroGame = false; bool g_bIsCzeroGame = false;
bool g_bAllowedCSBot = false;
bool g_bHostageImprov = false;

View File

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

View File

@ -2,7 +2,6 @@
BOOL g_fDrawLines = FALSE; BOOL g_fDrawLines = FALSE;
/* <c08f4> ../cstrike/dlls/h_ai.cpp:47 */
NOXREF BOOL FBoxVisible(entvars_t *pevLooker, entvars_t *pevTarget, Vector &vecTargetOrigin, float flSize) NOXREF BOOL FBoxVisible(entvars_t *pevLooker, entvars_t *pevTarget, Vector &vecTargetOrigin, float flSize)
{ {
// don't look through water // 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. // 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. // 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) NOXREF Vector VecCheckToss(entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flGravityAdj)
{ {
TraceResult tr; 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? // How much time does it take to get there?
// get a rough idea of how high it can be thrown // get a rough idea of how high it can be thrown
vecMidPoint = vecSpot1 + (vecSpot2 - vecSpot1) * 0.5; vecMidPoint = vecSpot1 + (vecSpot2 - vecSpot1) * 0.5f;
UTIL_TraceLine(vecMidPoint, vecMidPoint + Vector(0,0,500), ignore_monsters, ENT(pev), &tr); UTIL_TraceLine(vecMidPoint, vecMidPoint + Vector(0, 0, 500), ignore_monsters, ENT(pev), &tr);
vecMidPoint = tr.vecEndPos; vecMidPoint = tr.vecEndPos;
// (subtract 15 so the grenade doesn't hit the ceiling) // (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); float distance2 = (vecMidPoint.z - vecSpot2.z);
// How long will it take for the grenade to travel this distance // How long will it take for the grenade to travel this distance
float time1 = sqrt(distance1 / (0.5 * flGravity)); float time1 = Q_sqrt(distance1 / (0.5f * flGravity));
float time2 = sqrt(distance2 / (0.5 * flGravity)); float time2 = Q_sqrt(distance2 / (0.5f * flGravity));
if (time1 < 0.1) if (time1 < 0.1f)
{ {
// too close // too close
return g_vecZero; 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. // 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. // 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) NOXREF Vector VecCheckThrow(entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flSpeed, float flGravityAdj)
{ {
float flGravity = g_psv_gravity->value * 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 // throw at a constant time
float time = vecGrenadeVel.Length() / flSpeed; float time = vecGrenadeVel.Length() / flSpeed;
vecGrenadeVel = vecGrenadeVel * (1.0 / time); vecGrenadeVel = vecGrenadeVel * (1.0f / time);
// adjust upward toss to compensate for gravity loss // 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; Vector vecApex = vecSpot1 + (vecSpot2 - vecSpot1) * 0.5f;
vecApex.z += 0.5 * flGravity * (time * 0.5) * (time * 0.5); vecApex.z += 0.5f * flGravity * (time * 0.5f) * (time * 0.5f);
TraceResult tr; TraceResult tr;
UTIL_TraceLine(vecSpot1, vecApex, dont_ignore_monsters, ENT(pev), &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_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 #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); 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); 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); Vector VecCheckThrow(entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flSpeed, float flGravityAdj);
#endif // H_AI_H #endif // H_AI_H

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,5 @@
#include "precompiled.h" #include "precompiled.h"
/* <4703fc> ../cstrike/dlls/hostage/hostage_improv.cpp:19 */
inline void DrawAxes(const Vector &origin, int red, int green, int blue) inline void DrawAxes(const Vector &origin, int red, int green, int blue)
{ {
float size = 10; 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); 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) CHostageImprov::CHostageImprov(CBaseEntity *entity)
{ {
m_animateState.Reset();
m_hostage = static_cast<CHostage *>(entity); m_hostage = static_cast<CHostage *>(entity);
OnReset(); OnReset();
} }
/* <470d33> ../cstrike/dlls/hostage/hostage_improv.cpp:52 */
bool CHostageImprov::__MAKE_VHOOK(IsAlive)() const bool CHostageImprov::__MAKE_VHOOK(IsAlive)() const
{ {
return m_hostage->pev->deadflag != DEAD_DEAD; return m_hostage->pev->deadflag != DEAD_DEAD;
} }
/* <474809> ../cstrike/dlls/hostage/hostage_improv.cpp:61 */
void CHostageImprov::__MAKE_VHOOK(MoveTo)(const Vector &goal) void CHostageImprov::__MAKE_VHOOK(MoveTo)(const Vector &goal)
{ {
m_moveGoal = 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 // 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) bool CHostageImprov::__MAKE_VHOOK(GetSimpleGroundHeightWithFloor)(const Vector *pos, float *height, Vector *normal)
{ {
if (GetSimpleGroundHeight(pos, height, 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 // 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) bool CHostageImprov::DiscontinuityJump(float ground, bool onlyJumpDown, bool mustJump)
{ {
// Don't try to jump if in the air or crouching. // 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; return false;
} }
/* <470d5b> ../cstrike/dlls/hostage/hostage_improv.cpp:116 */
void CHostageImprov::__MAKE_VHOOK(LookAt)(const Vector &target) void CHostageImprov::__MAKE_VHOOK(LookAt)(const Vector &target)
{ {
m_isLookingAt = true; m_isLookingAt = true;
m_viewGoal = target; m_viewGoal = target;
} }
/* <470d97> ../cstrike/dlls/hostage/hostage_improv.cpp:126 */
void CHostageImprov::__MAKE_VHOOK(ClearLookAt)() void CHostageImprov::__MAKE_VHOOK(ClearLookAt)()
{ {
m_isLookingAt = false; m_isLookingAt = false;
} }
/* <470dbf> ../cstrike/dlls/hostage/hostage_improv.cpp:135 */
void CHostageImprov::__MAKE_VHOOK(FaceTo)(const Vector &goal) void CHostageImprov::__MAKE_VHOOK(FaceTo)(const Vector &goal)
{ {
m_isFacingTo = true; m_isFacingTo = true;
m_faceGoal = goal; m_faceGoal = goal;
} }
/* <470dfb> ../cstrike/dlls/hostage/hostage_improv.cpp:145 */
void CHostageImprov::__MAKE_VHOOK(ClearFaceTo)() void CHostageImprov::__MAKE_VHOOK(ClearFaceTo)()
{ {
m_isFacingTo = false; m_isFacingTo = false;
} }
/* <476a30> ../cstrike/dlls/hostage/hostage_improv.cpp:154 */
void CHostageImprov::MoveTowards(const Vector &pos, float deltaT) void CHostageImprov::MoveTowards(const Vector &pos, float deltaT)
{ {
Vector move; 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 // NOTE: We need to do this frequently to catch edges at the right time
// TODO: Look ahead *along path* instead of straight line // TODO: Look ahead *along path* instead of straight line
ClearPath(); 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; float ground;
Vector aheadRay(pos.x - GetFeet().x, pos.y - GetFeet().y, 0); 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; 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) bool CHostageImprov::FaceTowards(const Vector &target, float deltaT)
{ {
float error = 0; bool bError = false;
Vector2D to = (target - GetFeet()).Make2D(); Vector2D to = (target - GetFeet()).Make2D();
#ifndef PLAY_GAMEDLL #ifndef PLAY_GAMEDLL
@ -229,7 +216,7 @@ bool CHostageImprov::FaceTowards(const Vector &target, float deltaT)
to.x = float_x / flLen; to.x = float_x / flLen;
to.y = float_y / flLen; to.y = float_y / flLen;
} }
#endif // PLAY_GAMEDLL #endif
float moveAngle = GetMoveAngle(); float moveAngle = GetMoveAngle();
@ -245,12 +232,12 @@ bool CHostageImprov::FaceTowards(const Vector &target, float deltaT)
else else
dot = -1.0f; dot = -1.0f;
error = 1; bError = true;
} }
const float maxTurnRate = 0.05f; const float maxTurnRate = 0.05f;
if (error || fabs(dot) >= maxTurnRate) if (bError || Q_fabs(dot) >= maxTurnRate)
{ {
const float tolerance = 300.0f; const float tolerance = 300.0f;
float moveRatio = dot * deltaT * tolerance + moveAngle; float moveRatio = dot * deltaT * tolerance + moveAngle;
@ -267,7 +254,6 @@ bool CHostageImprov::FaceTowards(const Vector &target, float deltaT)
return true; return true;
} }
/* <47402b> ../cstrike/dlls/hostage/hostage_improv.cpp:308 */
void CHostageImprov::FaceOutwards() void CHostageImprov::FaceOutwards()
{ {
TraceResult result; TraceResult result;
@ -304,21 +290,17 @@ void CHostageImprov::FaceOutwards()
FaceTo(to); FaceTo(to);
} }
/* <470e23> ../cstrike/dlls/hostage/hostage_improv.cpp:344 */
bool CHostageImprov::__MAKE_VHOOK(IsAtMoveGoal)(float error) const bool CHostageImprov::__MAKE_VHOOK(IsAtMoveGoal)(float error) const
{ {
return (GetFeet() - m_moveGoal).IsLengthLessThan(error); return (GetFeet() - m_moveGoal).IsLengthLessThan(error);
} }
/* <470eab> ../cstrike/dlls/hostage/hostage_improv.cpp:353 */
bool CHostageImprov::__MAKE_VHOOK(IsAtFaceGoal)() const bool CHostageImprov::__MAKE_VHOOK(IsAtFaceGoal)() const
{ {
return false; return false;
} }
// Return true if a friend is between us and the given position // 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 bool CHostageImprov::__MAKE_VHOOK(IsFriendInTheWay)(const Vector &goalPos) const
{ {
// do this check less often to ease CPU burden // 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 // 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 bool CHostageImprov::__MAKE_VHOOK(IsFriendInTheWay)(CBaseEntity *myFriend, const Vector &goalPos) const
{ {
if (m_hostage == myFriend) if (m_hostage == myFriend)
@ -412,7 +392,7 @@ bool CHostageImprov::__MAKE_VHOOK(IsFriendInTheWay)(CBaseEntity *myFriend, const
if (!myFriend->pev->velocity.IsZero()) 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; return false;
} }
@ -420,7 +400,6 @@ bool CHostageImprov::__MAKE_VHOOK(IsFriendInTheWay)(CBaseEntity *myFriend, const
return true; return true;
} }
/* <474309> ../cstrike/dlls/hostage/hostage_improv.cpp:557 */
bool CHostageImprov::IsFriendInTheWay() const bool CHostageImprov::IsFriendInTheWay() const
{ {
CheckAhead check(this); CheckAhead check(this);
@ -430,13 +409,11 @@ bool CHostageImprov::IsFriendInTheWay() const
return check.IsBlocked(); return check.IsBlocked();
} }
/* <474631> ../cstrike/dlls/hostage/hostage_improv.cpp:568 */
float CHostageImprov::GetSpeed() float CHostageImprov::GetSpeed()
{ {
return -1.0f; return -1.0f;
} }
/* <46f249> ../cstrike/dlls/hostage/hostage_improv.cpp:592 */
bool CHostageImprov::__MAKE_VHOOK(Jump)() bool CHostageImprov::__MAKE_VHOOK(Jump)()
{ {
if (IsCrouching() || g_pHostages->IsNearbyHostageJumping(this)) if (IsCrouching() || g_pHostages->IsNearbyHostageJumping(this))
@ -466,19 +443,16 @@ bool CHostageImprov::__MAKE_VHOOK(Jump)()
return true; return true;
} }
/* <470ed3> ../cstrike/dlls/hostage/hostage_improv.cpp:632 */
void CHostageImprov::__MAKE_VHOOK(Run)() void CHostageImprov::__MAKE_VHOOK(Run)()
{ {
m_moveType = m_moveLimit; m_moveType = m_moveLimit;
} }
/* <470efb> ../cstrike/dlls/hostage/hostage_improv.cpp:638 */
void CHostageImprov::__MAKE_VHOOK(Walk)() void CHostageImprov::__MAKE_VHOOK(Walk)()
{ {
m_moveType = (m_moveLimit > Walking) ? Walking : m_moveLimit; m_moveType = (m_moveLimit > Walking) ? Walking : m_moveLimit;
} }
/* <470f23> ../cstrike/dlls/hostage/hostage_improv.cpp:644 */
void CHostageImprov::__MAKE_VHOOK(Stop)() void CHostageImprov::__MAKE_VHOOK(Stop)()
{ {
MoveTo(GetFeet()); MoveTo(GetFeet());
@ -490,40 +464,34 @@ void CHostageImprov::__MAKE_VHOOK(Stop)()
m_moveType = m_moveLimit; m_moveType = m_moveLimit;
} }
/* <470f4c> ../cstrike/dlls/hostage/hostage_improv.cpp:655 */
const Vector &CHostageImprov::__MAKE_VHOOK(GetFeet)() const const Vector &CHostageImprov::__MAKE_VHOOK(GetFeet)() const
{ {
return m_hostage->pev->origin; return m_hostage->pev->origin;
} }
/* <470f74> ../cstrike/dlls/hostage/hostage_improv.cpp:661 */
const Vector &CHostageImprov::__MAKE_VHOOK(GetCentroid)() const 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; return m_centroid;
} }
/* <470f9c> ../cstrike/dlls/hostage/hostage_improv.cpp:671 */
const Vector &CHostageImprov::__MAKE_VHOOK(GetEyes)() const 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; return m_eye;
} }
/* <470fc4> ../cstrike/dlls/hostage/hostage_improv.cpp:681 */
bool CHostageImprov::__MAKE_VHOOK(IsOnGround)() const bool CHostageImprov::__MAKE_VHOOK(IsOnGround)() const
{ {
return (m_hostage->pev->flags & FL_ONGROUND) != 0; return (m_hostage->pev->flags & FL_ONGROUND) != 0;
} }
/* <470fec> ../cstrike/dlls/hostage/hostage_improv.cpp:687 */
bool CHostageImprov::__MAKE_VHOOK(IsMoving)() const bool CHostageImprov::__MAKE_VHOOK(IsMoving)() const
{ {
float const epsilon = 10.0f; float const epsilon = 10.0f;
return m_actualVel.IsLengthGreaterThan(epsilon); return m_actualVel.IsLengthGreaterThan(epsilon);
} }
/* <4715d1> ../cstrike/dlls/hostage/hostage_improv.cpp:697 */
bool CHostageImprov::__MAKE_VHOOK(IsVisible)(const Vector &pos, bool testFOV) const bool CHostageImprov::__MAKE_VHOOK(IsVisible)(const Vector &pos, bool testFOV) const
{ {
const Vector eye = GetEyes(); const Vector eye = GetEyes();
@ -533,7 +501,6 @@ bool CHostageImprov::__MAKE_VHOOK(IsVisible)(const Vector &pos, bool testFOV) co
return result.flFraction == 1.0f; return result.flFraction == 1.0f;
} }
/* <472938> ../cstrike/dlls/hostage/hostage_improv.cpp:728 */
bool CHostageImprov::__MAKE_VHOOK(IsPlayerLookingAtMe)(CBasePlayer *other, float cosTolerance) const bool CHostageImprov::__MAKE_VHOOK(IsPlayerLookingAtMe)(CBasePlayer *other, float cosTolerance) const
{ {
Vector2D toOther = (other->pev->origin - GetCentroid()).Make2D(); Vector2D toOther = (other->pev->origin - GetCentroid()).Make2D();
@ -555,7 +522,6 @@ bool CHostageImprov::__MAKE_VHOOK(IsPlayerLookingAtMe)(CBasePlayer *other, float
return false; return false;
} }
/* <472a9f> ../cstrike/dlls/hostage/hostage_improv.cpp:757 */
CBasePlayer *CHostageImprov::__MAKE_VHOOK(IsAnyPlayerLookingAtMe)(int team, float cosTolerance) const CBasePlayer *CHostageImprov::__MAKE_VHOOK(IsAnyPlayerLookingAtMe)(int team, float cosTolerance) const
{ {
for (int i = 1; i <= gpGlobals->maxClients; ++i) for (int i = 1; i <= gpGlobals->maxClients; ++i)
@ -577,7 +543,6 @@ CBasePlayer *CHostageImprov::__MAKE_VHOOK(IsAnyPlayerLookingAtMe)(int team, floa
return NULL; return NULL;
} }
/* <472e7b> ../cstrike/dlls/hostage/hostage_improv.cpp:783 */
CBasePlayer *CHostageImprov::__MAKE_VHOOK(GetClosestPlayerByTravelDistance)(int team, float *range) const CBasePlayer *CHostageImprov::__MAKE_VHOOK(GetClosestPlayerByTravelDistance)(int team, float *range) const
{ {
CBasePlayer *close = NULL; CBasePlayer *close = NULL;
@ -614,7 +579,6 @@ CBasePlayer *CHostageImprov::__MAKE_VHOOK(GetClosestPlayerByTravelDistance)(int
return close; return close;
} }
/* <47166d> ../cstrike/dlls/hostage/hostage_improv.cpp:822 */
void CHostageImprov::__MAKE_VHOOK(OnReset)() void CHostageImprov::__MAKE_VHOOK(OnReset)()
{ {
m_moveFlags = 0; m_moveFlags = 0;
@ -671,13 +635,12 @@ void CHostageImprov::__MAKE_VHOOK(OnReset)()
Idle(); Idle();
} }
/* <474659> ../cstrike/dlls/hostage/hostage_improv.cpp:886 */
void CHostageImprov::UpdateVision() void CHostageImprov::UpdateVision()
{ {
if (!m_visionTimer.IsElapsed()) if (!m_visionTimer.IsElapsed())
return; return;
m_visiblePlayerCount = false; m_visiblePlayerCount = 0;
for (int i = 1; i <= gpGlobals->maxClients; ++i) 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) void CHostageImprov::__MAKE_VHOOK(TrackPath)(const Vector &pathGoal, float deltaT)
{ {
FaceTowards(pathGoal, deltaT); FaceTowards(pathGoal, deltaT);
@ -719,7 +681,6 @@ void CHostageImprov::__MAKE_VHOOK(TrackPath)(const Vector &pathGoal, float delta
DrawAxes(pathGoal, 255, 0, 255); DrawAxes(pathGoal, 255, 0, 255);
} }
/* <474781> ../cstrike/dlls/hostage/hostage_improv.cpp:1014 */
void CHostageImprov::SetKnownGoodPosition(const Vector &pos) void CHostageImprov::SetKnownGoodPosition(const Vector &pos)
{ {
if (IsJumping() || IsCrouching()) if (IsJumping() || IsCrouching())
@ -739,7 +700,6 @@ void CHostageImprov::SetKnownGoodPosition(const Vector &pos)
m_knownGoodPos = pos; m_knownGoodPos = pos;
} }
/* <47486d> ../cstrike/dlls/hostage/hostage_improv.cpp:1038 */
void CHostageImprov::ResetToKnownGoodPosition() void CHostageImprov::ResetToKnownGoodPosition()
{ {
const float tolerance = 10.0f; const float tolerance = 10.0f;
@ -771,13 +731,11 @@ void CHostageImprov::ResetToKnownGoodPosition()
Stop(); 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) void CHostageImprov::__MAKE_VHOOK(StartLadder)(const CNavLadder *ladder, NavTraverseType how, const Vector *approachPos, const Vector *departPos)
{ {
m_traversingLadder = true; 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) bool CHostageImprov::__MAKE_VHOOK(TraverseLadder)(const CNavLadder *ladder, NavTraverseType how, const Vector *approachPos, const Vector *departPos, float deltaT)
{ {
Vector goal; Vector goal;
@ -787,7 +745,7 @@ bool CHostageImprov::__MAKE_VHOOK(TraverseLadder)(const CNavLadder *ladder, NavT
goal = ladder->m_bottom; goal = ladder->m_bottom;
AddDirectionVector(&goal, ladder->m_dir, 16); 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; const float atGoalRange = 50.0f;
if ((GetFeet() - goal).Make2D().IsLengthLessThan(atGoalRange)) 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; return true;
} }
else if (m_traversingLadder) else if (m_traversingLadder)
@ -883,7 +841,6 @@ bool CHostageImprov::__MAKE_VHOOK(TraverseLadder)(const CNavLadder *ladder, NavT
return false; return false;
} }
/* <477691> ../cstrike/dlls/hostage/hostage_improv.cpp:1214 */
void CHostageImprov::UpdatePosition(float deltaT) void CHostageImprov::UpdatePosition(float deltaT)
{ {
CNavArea *area = TheNavAreaGrid.GetNavArea(&m_hostage->pev->origin); CNavArea *area = TheNavAreaGrid.GetNavArea(&m_hostage->pev->origin);
@ -912,10 +869,17 @@ void CHostageImprov::UpdatePosition(float deltaT)
dir = m_jumpTarget - GetFeet(); dir = m_jumpTarget - GetFeet();
dir.z = 0; dir.z = 0;
#ifndef PLAY_GAMEDLL
// TODO: fix test demo
dir.NormalizeInPlace(); dir.NormalizeInPlace();
m_hostage->pev->velocity.x = dir.x * pushSpeed; m_hostage->pev->velocity.x = dir.x * pushSpeed;
m_hostage->pev->velocity.y = dir.y * 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(0);
m_hostage->SetBoneController(1); m_hostage->SetBoneController(1);
@ -1020,7 +984,6 @@ void CHostageImprov::UpdatePosition(float deltaT)
m_moveFlags = 0; m_moveFlags = 0;
} }
/* <47837a> ../cstrike/dlls/hostage/hostage_improv.cpp:1384 */
void CHostageImprov::__MAKE_VHOOK(OnUpkeep)(float deltaT) void CHostageImprov::__MAKE_VHOOK(OnUpkeep)(float deltaT)
{ {
if (IsAlive()) if (IsAlive())
@ -1029,7 +992,6 @@ void CHostageImprov::__MAKE_VHOOK(OnUpkeep)(float deltaT)
} }
} }
/* <4749f9> ../cstrike/dlls/hostage/hostage_improv.cpp:1396 */
bool CHostageImprov::IsTerroristNearby() bool CHostageImprov::IsTerroristNearby()
{ {
if (m_nearbyTerroristTimer.IsElapsed()) if (m_nearbyTerroristTimer.IsElapsed())
@ -1041,7 +1003,6 @@ bool CHostageImprov::IsTerroristNearby()
return true; return true;
} }
/* <474ae7> ../cstrike/dlls/hostage/hostage_improv.cpp:1412 */
void CHostageImprov::CheckForNearbyTerrorists() void CHostageImprov::CheckForNearbyTerrorists()
{ {
if (!m_checkNearbyTerroristTimer.IsElapsed()) if (!m_checkNearbyTerroristTimer.IsElapsed())
@ -1063,7 +1024,6 @@ void CHostageImprov::CheckForNearbyTerrorists()
} }
} }
/* <4753ba> ../cstrike/dlls/hostage/hostage_improv.cpp:1440 */
void CHostageImprov::UpdateGrenadeReactions() void CHostageImprov::UpdateGrenadeReactions()
{ {
if (m_coughTimer.IsElapsed()) if (m_coughTimer.IsElapsed())
@ -1081,7 +1041,7 @@ void CHostageImprov::UpdateGrenadeReactions()
CBaseEntity *entity = NULL; CBaseEntity *entity = NULL;
const float watchGrenadeRadius = 500.0f; 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) 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) void CHostageImprov::__MAKE_VHOOK(OnUpdate)(float deltaT)
{ {
if (!IsAlive() || cv_hostage_stop.value > 0.0f) if (!IsAlive() || cv_hostage_stop.value > 0.0f)
@ -1124,7 +1083,7 @@ void CHostageImprov::__MAKE_VHOOK(OnUpdate)(float deltaT)
} }
else 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); m_blinkCounter = RANDOM_LONG(1, 2);
} }
@ -1266,7 +1225,6 @@ void CHostageImprov::__MAKE_VHOOK(OnUpdate)(float deltaT)
m_animateState.OnUpdate(this); m_animateState.OnUpdate(this);
} }
/* <47552a> ../cstrike/dlls/hostage/hostage_improv.cpp:1705 */
void CHostageImprov::__MAKE_VHOOK(OnGameEvent)(GameEventType event, CBaseEntity *entity, CBaseEntity *other) void CHostageImprov::__MAKE_VHOOK(OnGameEvent)(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
{ {
switch (event) switch (event)
@ -1290,7 +1248,7 @@ void CHostageImprov::__MAKE_VHOOK(OnGameEvent)(GameEventType event, CBaseEntity
if (!entity->IsPlayer() || entity->IsPlayer() && ((CBasePlayer *)entity)->m_iTeam != TERRORIST) 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()) if (!entity->IsPlayer())
{ {
@ -1310,15 +1268,13 @@ void CHostageImprov::__MAKE_VHOOK(OnGameEvent)(GameEventType event, CBaseEntity
case EVENT_TERRORISTS_WIN: case EVENT_TERRORISTS_WIN:
Frighten(SCARED); Frighten(SCARED);
m_isDelayedChatterPending = false; 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; return;
case EVENT_CTS_WIN: case EVENT_CTS_WIN:
m_scaredTimer.Invalidate(); m_scaredTimer.Invalidate();
m_isDelayedChatterPending = false; 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; return;
default:
break;
} }
float range; float range;
@ -1341,7 +1297,7 @@ void CHostageImprov::__MAKE_VHOOK(OnGameEvent)(GameEventType event, CBaseEntity
{ {
case EVENT_WEAPON_FIRED: 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; break;
} }
case EVENT_HE_GRENADE_EXPLODED: case EVENT_HE_GRENADE_EXPLODED:
@ -1351,7 +1307,7 @@ void CHostageImprov::__MAKE_VHOOK(OnGameEvent)(GameEventType event, CBaseEntity
case EVENT_BREAK_METAL: case EVENT_BREAK_METAL:
case EVENT_BREAK_FLESH: case EVENT_BREAK_FLESH:
case EVENT_BREAK_CONCRETE: 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; break;
default: default:
@ -1368,13 +1324,12 @@ void CHostageImprov::__MAKE_VHOOK(OnGameEvent)(GameEventType event, CBaseEntity
if ((GetEyes() - *impactPos).IsLengthLessThan(flashRange) && IsVisible(*impactPos)) 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); Frighten(TERRIFIED);
} }
} }
} }
/* <471e27> ../cstrike/dlls/hostage/hostage_improv.cpp:1854 */
void CHostageImprov::__MAKE_VHOOK(OnTouch)(CBaseEntity *other) void CHostageImprov::__MAKE_VHOOK(OnTouch)(CBaseEntity *other)
{ {
const char *classname; const char *classname;
@ -1413,14 +1368,14 @@ void CHostageImprov::__MAKE_VHOOK(OnTouch)(CBaseEntity *other)
Vector pos = alongFloor * lookAheadRange; 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(); Vector vecStart = GetFeet();
vecStart.z += offset; vecStart.z += offset;
UTIL_TraceLine(vecStart, vecStart + pos, ignore_monsters, dont_ignore_glass, m_hostage->pev->pContainingEntity, &result); 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; isStep = true;
break; 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) void CHostageImprov::ApplyForce(Vector force)
{ {
m_vel.x += force.x; m_vel.x += force.x;
m_vel.y += force.y; m_vel.y += force.y;
} }
/* <474bd5> ../cstrike/dlls/hostage/hostage_improv.cpp:2016 */
bool CHostageImprov::IsAtHome() const bool CHostageImprov::IsAtHome() const
{ {
return m_hostage->IsAtHome(); return m_hostage->IsAtHome();
} }
/* <474c76> ../cstrike/dlls/hostage/hostage_improv.cpp:2025 */
bool CHostageImprov::CanSeeRescueZone() const bool CHostageImprov::CanSeeRescueZone() const
{ {
CCSBotManager *ctrl = TheCSBots(); if (TheCSBots() == NULL)
if (ctrl == NULL)
return false; return false;
const CCSBotManager::Zone *zone = ctrl->GetClosestZone(&GetCentroid()); const CCSBotManager::Zone *zone = TheCSBots()->GetClosestZone(&GetCentroid());
if (zone != NULL) if (zone != NULL)
return IsVisible(zone->m_center); return IsVisible(zone->m_center);
@ -1528,7 +1478,6 @@ bool CHostageImprov::CanSeeRescueZone() const
return false; return false;
} }
/* <474cd3> ../cstrike/dlls/hostage/hostage_improv.cpp:2047 */
CBasePlayer *CHostageImprov::GetClosestVisiblePlayer(int team) CBasePlayer *CHostageImprov::GetClosestVisiblePlayer(int team)
{ {
CBasePlayer *close = NULL; CBasePlayer *close = NULL;
@ -1553,7 +1502,6 @@ CBasePlayer *CHostageImprov::GetClosestVisiblePlayer(int team)
return close; return close;
} }
/* <474db2> ../cstrike/dlls/hostage/hostage_improv.cpp:2080 */
float CHostageImprov::GetTimeSinceLastSawPlayer(int team) float CHostageImprov::GetTimeSinceLastSawPlayer(int team)
{ {
float timeCT = m_lastSawCT.GetElapsedTime(); 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() float CHostageImprov::GetTimeSinceLastInjury()
{ {
return m_lastInjuryTimer.GetElapsedTime(); return m_lastInjuryTimer.GetElapsedTime();
} }
/* <474fb3> ../cstrike/dlls/hostage/hostage_improv.cpp:2107 */
float CHostageImprov::GetTimeSinceLastNoise() float CHostageImprov::GetTimeSinceLastNoise()
{ {
return m_lastNoiseTimer.GetElapsedTime(); return m_lastNoiseTimer.GetElapsedTime();
} }
/* <47503a> ../cstrike/dlls/hostage/hostage_improv.cpp:2117 */
bool CHostageImprov::IsScared() const bool CHostageImprov::IsScared() const
{ {
if (m_scaredTimer.IsElapsed()) if (m_scaredTimer.IsElapsed())
@ -1593,7 +1538,6 @@ bool CHostageImprov::IsScared() const
return true; return true;
} }
/* <47506e> ../cstrike/dlls/hostage/hostage_improv.cpp:2129 */
void CHostageImprov::Frighten(ScareType scare) void CHostageImprov::Frighten(ScareType scare)
{ {
const float ignoreTime = 10.0f; 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() void CHostageImprov::Afraid()
{ {
char animInto[32]; 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) void CHostageImprov::UpdateIdleActivity(Activity activity, Activity fidget)
{ {
if (m_animateState.IsBusy()) if (m_animateState.IsBusy())
@ -1662,19 +1604,18 @@ void CHostageImprov::UpdateIdleActivity(Activity activity, Activity fidget)
if (m_didFidget || fidget == ACT_RESET) 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; m_didFidget = false;
} }
else 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; m_didFidget = true;
} }
} }
/* <4752d9> ../cstrike/dlls/hostage/hostage_improv.cpp:2226 */
void CHostageImprov::Chatter(HostageChatterType sayType, bool mustSpeak) void CHostageImprov::Chatter(HostageChatterType sayType, bool mustSpeak)
{ {
if (!IsAlive() && sayType != HOSTAGE_CHATTER_DEATH_CRY) 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) void CHostageImprov::DelayedChatter(float delayTime, HostageChatterType sayType, bool mustSpeak)
{ {
if (!IsAlive()) if (!IsAlive())
@ -1706,7 +1646,6 @@ void CHostageImprov::DelayedChatter(float delayTime, HostageChatterType sayType,
} }
} }
/* <475bd4> ../cstrike/dlls/hostage/hostage_improv.cpp:2268 */
void CHostageImprov::UpdateDelayedChatter() void CHostageImprov::UpdateDelayedChatter()
{ {
if (!m_isDelayedChatterPending) if (!m_isDelayedChatterPending)
@ -1720,7 +1659,7 @@ void CHostageImprov::UpdateDelayedChatter()
switch (m_delayedChatterType) switch (m_delayedChatterType)
{ {
case HOSTAGE_CHATTER_SCARED_OF_GUNFIRE: case HOSTAGE_CHATTER_SCARED_OF_GUNFIRE:
if (RANDOM_FLOAT(0, 100) <= 25) if (RANDOM_FLOAT(0, 100) <= 25.0f)
{ {
Chatter(m_delayedChatterType, m_delayedChatterMustSpeak); Chatter(m_delayedChatterType, m_delayedChatterMustSpeak);
} }
@ -1728,7 +1667,7 @@ void CHostageImprov::UpdateDelayedChatter()
case HOSTAGE_CHATTER_LOOK_OUT: case HOSTAGE_CHATTER_LOOK_OUT:
case HOSTAGE_CHATTER_PLEASE_RESCUE_ME: case HOSTAGE_CHATTER_PLEASE_RESCUE_ME:
case HOSTAGE_CHATTER_IMPATIENT_FOR_RESCUE: case HOSTAGE_CHATTER_IMPATIENT_FOR_RESCUE:
if (RANDOM_FLOAT(0, 100) <= 60) if (RANDOM_FLOAT(0, 100) <= 60.0f)
{ {
Chatter(m_delayedChatterType, m_delayedChatterMustSpeak); 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) void CHostageImprov::Flinch(Activity activity)
{ {
Chatter(HOSTAGE_CHATTER_PAIN, true); 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() void CHostageImprov::CrouchDie()
{ {
m_animateState.Reset(); m_animateState.Reset();
m_animateState.AddSequence(this, ACT_CROUCH_DIE); m_animateState.AddSequence(this, ACT_CROUCH_DIE);
} }
/* <476327> ../cstrike/dlls/hostage/hostage_improv.cpp:2339 */
void CHostageImprov::Agree() void CHostageImprov::Agree()
{ {
m_animateState.Reset(); m_animateState.Reset();
m_animateState.AddSequence(this, ACT_YES); m_animateState.AddSequence(this, ACT_YES);
} }
/* <476350> ../cstrike/dlls/hostage/hostage_improv.cpp:2349 */
void CHostageImprov::Disagree() void CHostageImprov::Disagree()
{ {
if (m_animateState.GetPerformance() != HostageAnimateState::Disagreeing) if (m_animateState.GetPerformance() != HostageAnimateState::Disagreeing)
{ {
m_animateState.Reset(); 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() void CHostageImprov::Wave()
{ {
m_animateState.Reset(); m_animateState.Reset();
@ -1785,8 +1719,6 @@ void CHostageImprov::Wave()
} }
// Invoked when an improv fails to reach a MoveTo goal // 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) void CHostageImprov::__MAKE_VHOOK(OnMoveToFailure)(const Vector &goal, MoveToFailureType reason)
{ {
m_behavior.OnMoveToFailure(goal, 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() void CHostageImprov::Wiggle()
{ {
// for wiggling // for wiggling
if (m_wiggleTimer.IsElapsed()) if (m_wiggleTimer.IsElapsed())
{ {
m_wiggleDirection = static_cast<NavRelativeDirType>(RANDOM_LONG(FORWARD, LEFT)); 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; const float force = 15.0f;
@ -1839,7 +1770,6 @@ void CHostageImprov::Wiggle()
} }
} }
/* <4766cc> ../cstrike/dlls/hostage/hostage_improv.cpp:2438 */
void CHostageImprov::ClearPath() void CHostageImprov::ClearPath()
{ {
Vector start; Vector start;
@ -1849,7 +1779,7 @@ void CHostageImprov::ClearPath()
if (!m_clearPathTimer.IsElapsed()) if (!m_clearPathTimer.IsElapsed())
return; return;
m_clearPathTimer.Start(RANDOM_FLOAT(0.3, 0.5)); m_clearPathTimer.Start(RANDOM_FLOAT(0.3f, 0.5f));
const Vector eye = GetEyes(); const Vector eye = GetEyes();
start = eye; start = eye;
@ -1887,7 +1817,6 @@ void CHostageImprov::ClearPath()
} }
} }
/* <471b3f> ../cstrike/dlls/hostage/hostage_improv.cpp:2497 */
void CHostageImprov::__MAKE_VHOOK(Crouch)() void CHostageImprov::__MAKE_VHOOK(Crouch)()
{ {
const float minCrouchTime = 1.0f; 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); 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)() void CHostageImprov::__MAKE_VHOOK(StandUp)()
{ {
if (!IsCrouching() || !m_minCrouchTimer.IsElapsed()) if (!IsCrouching() || !m_minCrouchTimer.IsElapsed())
@ -1921,6 +1849,7 @@ void CHostageImprov::__MAKE_VHOOK(StandUp)()
} }
} }
// HalfHumanHeight
if (y == 36) if (y == 36)
{ {
m_animateState.Reset(); m_animateState.Reset();
@ -1929,7 +1858,6 @@ void CHostageImprov::__MAKE_VHOOK(StandUp)()
} }
} }
/* <477114> ../cstrike/dlls/hostage/hostage_improv.cpp:2558 */
void CHostageImprov::UpdateStationaryAnimation() void CHostageImprov::UpdateStationaryAnimation()
{ {
m_behavior.UpdateStationaryAnimation(this); m_behavior.UpdateStationaryAnimation(this);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,5 @@
#include "precompiled.h" #include "precompiled.h"
/* <42e3e3> ../cstrike/dlls/hostage/states/hostage_follow.cpp:12 */
void HostageFollowState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv) void HostageFollowState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv)
{ {
improv->Chatter(HOSTAGE_CHATTER_START_FOLLOW); 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) void HostageFollowState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv)
{ {
// if we lost our leader, give up // 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 maxPathLength = 3000.0f;
const float giveUpRange = 1000.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(); improv->Idle();
return; return;
@ -162,7 +160,7 @@ void HostageFollowState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv)
if (GetGroundHeight(&sideStepPos, &ground)) 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; const float push = 20.0f;
Vector lat = cross * push; 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) void HostageFollowState::__MAKE_VHOOK(OnExit)(CHostageImprov *improv)
{ {
improv->Stop(); improv->Stop();
} }
/* <42e38f> ../cstrike/dlls/hostage/states/hostage_follow.cpp:270 */
void HostageFollowState::__MAKE_VHOOK(UpdateStationaryAnimation)(CHostageImprov *improv) void HostageFollowState::__MAKE_VHOOK(UpdateStationaryAnimation)(CHostageImprov *improv)
{ {
if (improv->IsScared()) if (improv->IsScared())

View File

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

View File

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

View File

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

View File

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

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